From: Andrea Amorese Date: Fri, 8 Oct 2021 09:30:29 +0000 (+0200) Subject: Built motion from commit 0d7cdd56.|2.5.36 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=27b6d928e52f62537335ff36d533a38fa3594cc9;p=motion2.git Built motion from commit 0d7cdd56.|2.5.36 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 29c7e4e..ae38788 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-08T08:54:01.078Z", + "time": "2021-10-08T09:16:04.527Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e9052fd..54ce375 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-08T08:54:01.078Z", + "time": "2021-10-08T09:16:04.527Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index dc34b1a..eb21530 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 _0xedc4=['contactManager','integration','motionbar','jscripty','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x19de1c,_0x15affb){var _0x3abf1e=function(_0x3c7c49){while(--_0x3c7c49){_0x19de1c['push'](_0x19de1c['shift']());}};_0x3abf1e(++_0x15affb);}(_0xedc4,0x13a));var _0x4edc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xedc4[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x4edc('0x0'));module[_0x4edc('0x1')]={'name':{'type':Sequelize[_0x4edc('0x2')],'get':function(_0xfc94a3){return this[_0x4edc('0x3')](_0x4edc('0x4'));}},'action':{'type':Sequelize[_0x4edc('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4edc('0x6'),_0x4edc('0x7'),_0x4edc('0x8'),_0x4edc('0x9'),'urlForward','browser',_0x4edc('0xa'),_0x4edc('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4edc('0xc')},'data1':{'type':Sequelize[_0x4edc('0x5')](0x1000),'comment':_0x4edc('0xd')},'data2':{'type':Sequelize[_0x4edc('0x5')](0x1000),'comment':_0x4edc('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4edc('0xf')},'data4':{'type':Sequelize[_0x4edc('0x5')](0x1000),'comments':_0x4edc('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x4edc('0x11')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x4edc('0x12')],'comments':_0x4edc('0x13')}}; \ No newline at end of file +var _0x3411=['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]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x5eb307,_0x580bef){var _0x5c5862=function(_0x311b41){while(--_0x311b41){_0x5eb307['push'](_0x5eb307['shift']());}};_0x5c5862(++_0x580bef);}(_0x3411,0x1c7));var _0x1341=function(_0x1a3429,_0x2ef9cf){_0x1a3429=_0x1a3429-0x0;var _0xf1981d=_0x3411[_0x1a3429];return _0xf1981d;};'use strict';var Sequelize=require(_0x1341('0x0'));module[_0x1341('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5ea50b){return this[_0x1341('0x2')](_0x1341('0x3'));}},'action':{'type':Sequelize[_0x1341('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1341('0x5'),_0x1341('0x6'),_0x1341('0x7'),_0x1341('0x8'),'urlForward','browser','bot',_0x1341('0x9')]],'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[_0x1341('0x4')](0x1000),'comment':_0x1341('0xa')},'data2':{'type':Sequelize[_0x1341('0x4')](0x1000),'comment':_0x1341('0xb')},'data3':{'type':Sequelize[_0x1341('0x4')](0x1000),'comment':_0x1341('0xc')},'data4':{'type':Sequelize[_0x1341('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x1341('0xd')},'data6':{'type':Sequelize[_0x1341('0x4')],'comments':_0x1341('0xe')},'data7':{'type':Sequelize[_0x1341('0xf')],'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 566f4cc..abed405 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 _0x83d2=['sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','stack','name','body','Action','find','catch','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util'];(function(_0xb55ca6,_0x4a7b9a){var _0x275452=function(_0x42b6a6){while(--_0x42b6a6){_0xb55ca6['push'](_0xb55ca6['shift']());}};_0x275452(++_0x4a7b9a);}(_0x83d2,0x1ef));var _0x283d=function(_0x352385,_0x138e61){_0x352385=_0x352385-0x0;var _0x191119=_0x83d2[_0x352385];return _0x191119;};'use strict';var emlformat=require(_0x283d('0x0'));var rimraf=require(_0x283d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x283d('0x2'));var rp=require(_0x283d('0x3'));var moment=require(_0x283d('0x4'));var BPromise=require(_0x283d('0x5'));var Mustache=require('mustache');var util=require(_0x283d('0x6'));var path=require(_0x283d('0x7'));var sox=require(_0x283d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x283d('0x9'));var squel=require(_0x283d('0xa'));var crypto=require('crypto');var jsforce=require(_0x283d('0xb'));var deskjs=require(_0x283d('0xc'));var toCsv=require(_0x283d('0xd'));var querystring=require(_0x283d('0xe'));var Papa=require(_0x283d('0xf'));var Redis=require('ioredis');var authService=require(_0x283d('0x10'));var qs=require(_0x283d('0x11'));var as=require(_0x283d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x283d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x283d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b050a,_0x2d0a73){_0x2d0a73=_0x2d0a73||0xcc;return function(_0x3d14f2){if(_0x3d14f2){return _0x5b050a[_0x283d('0x15')](_0x2d0a73);}return _0x5b050a[_0x283d('0x16')](_0x2d0a73)[_0x283d('0x17')]();};}function respondWithResult(_0x4a6f55,_0xb5dd90){_0xb5dd90=_0xb5dd90||0xc8;return function(_0x2a5598){if(_0x2a5598){return _0x4a6f55[_0x283d('0x16')](_0xb5dd90)[_0x283d('0x18')](_0x2a5598);}};}function respondWithFilteredResult(_0x2ea13d,_0x779fe4){return function(_0x212320){if(_0x212320){var _0x74a20=typeof _0x779fe4[_0x283d('0x19')]==='undefined'&&typeof _0x779fe4[_0x283d('0x1a')]===_0x283d('0x1b');var _0x2a26b7=_0x212320[_0x283d('0x1c')];var _0x214c45=_0x74a20?0x0:_0x779fe4['offset'];var _0x5abb4c=_0x74a20?_0x212320['count']:_0x779fe4[_0x283d('0x19')]+_0x779fe4['limit'];var _0x433aa5;if(_0x5abb4c>=_0x2a26b7){_0x5abb4c=_0x2a26b7;_0x433aa5=0xc8;}else{_0x433aa5=0xce;}_0x2ea13d[_0x283d('0x16')](_0x433aa5);return _0x2ea13d[_0x283d('0x1d')]('Content-Range',_0x214c45+'-'+_0x5abb4c+'/'+_0x2a26b7)['json'](_0x212320);}return null;};}function patchUpdates(_0x5cfef8){return function(_0x5090e0){try{jsonpatch[_0x283d('0x1e')](_0x5090e0,_0x5cfef8,!![]);}catch(_0x151c33){return BPromise[_0x283d('0x1f')](_0x151c33);}return _0x5090e0['save']();};}function saveUpdates(_0x5a14c5,_0x2796ba){return function(_0xf00355){if(_0xf00355){return _0xf00355[_0x283d('0x20')](_0x5a14c5)[_0x283d('0x21')](function(_0x515f84){return _0x515f84;});}return null;};}function removeEntity(_0x488679,_0x42d8a2){return function(_0x3fbc60){if(_0x3fbc60){return _0x3fbc60['destroy']()['then'](function(){_0x488679[_0x283d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cde30,_0x38cd50){return function(_0x9497ff){if(!_0x9497ff){_0x1cde30[_0x283d('0x15')](0x194);}return _0x9497ff;};}function handleError(_0xfbca94,_0x12027a){_0x12027a=_0x12027a||0x1f4;return function(_0xdc7b34){logger[_0x283d('0x22')](_0xdc7b34[_0x283d('0x23')]);if(_0xdc7b34[_0x283d('0x24')]){delete _0xdc7b34[_0x283d('0x24')];}_0xfbca94['status'](_0x12027a)['send'](_0xdc7b34);};}exports[_0x283d('0x20')]=function(_0x4e3287,_0x575242){if(_0x4e3287[_0x283d('0x25')]['id']){delete _0x4e3287[_0x283d('0x25')]['id'];}return db[_0x283d('0x26')][_0x283d('0x27')]({'where':{'id':_0x4e3287['params']['id']}})[_0x283d('0x21')](handleEntityNotFound(_0x575242,null))[_0x283d('0x21')](saveUpdates(_0x4e3287[_0x283d('0x25')],null))[_0x283d('0x21')](respondWithResult(_0x575242,null))[_0x283d('0x28')](handleError(_0x575242,null));};exports[_0x283d('0x29')]=function(_0x847ebf,_0x5d2c2d){return db[_0x283d('0x26')]['find']({'where':{'id':_0x847ebf[_0x283d('0x2a')]['id']}})[_0x283d('0x21')](handleEntityNotFound(_0x5d2c2d,null))[_0x283d('0x21')](removeEntity(_0x5d2c2d,null))['catch'](handleError(_0x5d2c2d,null));}; \ No newline at end of file +var _0xec9b=['params','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','status','apply','reject','update','then','destroy','error','stack','name','send','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xec9b,0xa6));var _0xbec9=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0xec9b[_0x54da5b];return _0x285d3b;};'use strict';var emlformat=require(_0xbec9('0x0'));var rimraf=require(_0xbec9('0x1'));var zipdir=require(_0xbec9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec9('0x3'));var moment=require('moment');var BPromise=require(_0xbec9('0x4'));var Mustache=require('mustache');var util=require(_0xbec9('0x5'));var path=require('path');var sox=require(_0xbec9('0x6'));var csv=require(_0xbec9('0x7'));var ejs=require(_0xbec9('0x8'));var fs=require('fs');var fs_extra=require(_0xbec9('0x9'));var _=require(_0xbec9('0xa'));var squel=require(_0xbec9('0xb'));var crypto=require(_0xbec9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbec9('0xd'));var toCsv=require(_0xbec9('0x7'));var querystring=require(_0xbec9('0xe'));var Papa=require('papaparse');var Redis=require(_0xbec9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbec9('0x10'));var as=require(_0xbec9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbec9('0x12'))('api');var utils=require(_0xbec9('0x13'));var config=require(_0xbec9('0x14'));var licenseUtil=require(_0xbec9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55cf0b,_0x87cb61){_0x87cb61=_0x87cb61||0xcc;return function(_0x335d89){if(_0x335d89){return _0x55cf0b[_0xbec9('0x16')](_0x87cb61);}return _0x55cf0b['status'](_0x87cb61)[_0xbec9('0x17')]();};}function respondWithResult(_0x5d3bb7,_0xf3c927){_0xf3c927=_0xf3c927||0xc8;return function(_0x10ba6e){if(_0x10ba6e){return _0x5d3bb7['status'](_0xf3c927)[_0xbec9('0x18')](_0x10ba6e);}};}function respondWithFilteredResult(_0x29aeaf,_0x3b9627){return function(_0xced470){if(_0xced470){var _0x8f9b5e=typeof _0x3b9627[_0xbec9('0x19')]==='undefined'&&typeof _0x3b9627['limit']===_0xbec9('0x1a');var _0x56b291=_0xced470['count'];var _0x21fe5c=_0x8f9b5e?0x0:_0x3b9627[_0xbec9('0x19')];var _0x13a982=_0x8f9b5e?_0xced470['count']:_0x3b9627[_0xbec9('0x19')]+_0x3b9627[_0xbec9('0x1b')];var _0x17ccda;if(_0x13a982>=_0x56b291){_0x13a982=_0x56b291;_0x17ccda=0xc8;}else{_0x17ccda=0xce;}_0x29aeaf[_0xbec9('0x1c')](_0x17ccda);return _0x29aeaf['set']('Content-Range',_0x21fe5c+'-'+_0x13a982+'/'+_0x56b291)[_0xbec9('0x18')](_0xced470);}return null;};}function patchUpdates(_0x41fd58){return function(_0x59f045){try{jsonpatch[_0xbec9('0x1d')](_0x59f045,_0x41fd58,!![]);}catch(_0x6e9259){return BPromise[_0xbec9('0x1e')](_0x6e9259);}return _0x59f045['save']();};}function saveUpdates(_0x35c2fe,_0x44dbeb){return function(_0x422cec){if(_0x422cec){return _0x422cec[_0xbec9('0x1f')](_0x35c2fe)[_0xbec9('0x20')](function(_0x5b8e14){return _0x5b8e14;});}return null;};}function removeEntity(_0x3c6923,_0x984064){return function(_0x10583a){if(_0x10583a){return _0x10583a[_0xbec9('0x21')]()[_0xbec9('0x20')](function(){_0x3c6923[_0xbec9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e2ef,_0x2a33bf){return function(_0x2c1780){if(!_0x2c1780){_0x22e2ef['sendStatus'](0x194);}return _0x2c1780;};}function handleError(_0x21d2bf,_0x36ce62){_0x36ce62=_0x36ce62||0x1f4;return function(_0x43ec8c){logger[_0xbec9('0x22')](_0x43ec8c[_0xbec9('0x23')]);if(_0x43ec8c[_0xbec9('0x24')]){delete _0x43ec8c['name'];}_0x21d2bf[_0xbec9('0x1c')](_0x36ce62)[_0xbec9('0x25')](_0x43ec8c);};}exports[_0xbec9('0x1f')]=function(_0x4c4fee,_0x5c65de){if(_0x4c4fee[_0xbec9('0x26')]['id']){delete _0x4c4fee[_0xbec9('0x26')]['id'];}return db['Action']['find']({'where':{'id':_0x4c4fee[_0xbec9('0x27')]['id']}})[_0xbec9('0x20')](handleEntityNotFound(_0x5c65de,null))['then'](saveUpdates(_0x4c4fee[_0xbec9('0x26')],null))['then'](respondWithResult(_0x5c65de,null))[_0xbec9('0x28')](handleError(_0x5c65de,null));};exports[_0xbec9('0x21')]=function(_0x1b40fe,_0x3eb2c0){return db['Action']['find']({'where':{'id':_0x1b40fe[_0xbec9('0x27')]['id']}})[_0xbec9('0x20')](handleEntityNotFound(_0x3eb2c0,null))[_0xbec9('0x20')](removeEntity(_0x3eb2c0,null))[_0xbec9('0x28')](handleError(_0x3eb2c0,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index cf99f85..4a3c3fa 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 _0xb746=['../../config/logger','api','moment','bluebird','rimraf','./action.attributes','Action','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb746,0x187));var _0x6b74=function(_0x9b74c5,_0x468f39){_0x9b74c5=_0x9b74c5-0x0;var _0x4a734c=_0xb746[_0x9b74c5];return _0x4a734c;};'use strict';var _=require('lodash');var util=require(_0x6b74('0x0'));var logger=require(_0x6b74('0x1'))(_0x6b74('0x2'));var moment=require(_0x6b74('0x3'));var BPromise=require(_0x6b74('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b74('0x5'));var config=require('../../config/environment');var attributes=require(_0x6b74('0x6'));module['exports']=function(_0x27467b,_0x1551aa){return _0x27467b['define'](_0x6b74('0x7'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aa7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x152350,_0x3b0fe2){var _0x23a26b=function(_0x5148ca){while(--_0x5148ca){_0x152350['push'](_0x152350['shift']());}};_0x23a26b(++_0x3b0fe2);}(_0x3aa7,0x18d));var _0x73aa=function(_0x2af6e0,_0x4ceb6f){_0x2af6e0=_0x2af6e0-0x0;var _0x31938d=_0x3aa7[_0x2af6e0];return _0x31938d;};'use strict';var _=require(_0x73aa('0x0'));var util=require(_0x73aa('0x1'));var logger=require(_0x73aa('0x2'))('api');var moment=require('moment');var BPromise=require(_0x73aa('0x3'));var rp=require(_0x73aa('0x4'));var fs=require('fs');var path=require(_0x73aa('0x5'));var rimraf=require(_0x73aa('0x6'));var config=require(_0x73aa('0x7'));var attributes=require('./action.attributes');module[_0x73aa('0x8')]=function(_0x766401,_0x3d53c0){return _0x766401[_0x73aa('0x9')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index a554c19..b71b552 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x44dc48,_0x29051b){var _0x3d398b=function(_0x7fd359){while(--_0x7fd359){_0x44dc48['push'](_0x44dc48['shift']());}};_0x3d398b(++_0x29051b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x497d84,_0x4fad8d){_0x497d84=_0x497d84-0x0;var _0x28b334=_0x7fbe[_0x497d84];return _0x28b334;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x4ea60d,_0x36cd19){_0x4ea60d=_0x4ea60d-0x0;var _0x4130fe=_0x7a54[_0x4ea60d];return _0x4130fe;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 609a03b..637b5b3 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 _0xaaec=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaaec,0x169));var _0xcaae=function(_0x5b6d2a,_0x2a4e3b){_0x5b6d2a=_0x5b6d2a-0x0;var _0x536640=_0xaaec[_0x5b6d2a];return _0x536640;};'use strict';var multer=require(_0xcaae('0x0'));var util=require(_0xcaae('0x1'));var path=require(_0xcaae('0x2'));var timeout=require(_0xcaae('0x3'));var express=require(_0xcaae('0x4'));var router=express[_0xcaae('0x5')]();var fs_extra=require(_0xcaae('0x6'));var auth=require(_0xcaae('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcaae('0x8'));var controller=require('./action.controller');router[_0xcaae('0x9')](_0xcaae('0xa'),auth[_0xcaae('0xb')](),controller['update']);router[_0xcaae('0xc')](_0xcaae('0xa'),auth[_0xcaae('0xb')](),controller[_0xcaae('0xd')]);module[_0xcaae('0xe')]=router; \ No newline at end of file +var _0x2308=['express','Router','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path'];(function(_0x1ab91c,_0x14e58d){var _0x327b58=function(_0x19c481){while(--_0x19c481){_0x1ab91c['push'](_0x1ab91c['shift']());}};_0x327b58(++_0x14e58d);}(_0x2308,0x1b8));var _0x8230=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x2308[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x8230('0x0'));var util=require('util');var path=require(_0x8230('0x1'));var timeout=require('connect-timeout');var express=require(_0x8230('0x2'));var router=express[_0x8230('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8230('0x4'));var config=require(_0x8230('0x5'));var controller=require('./action.controller');router[_0x8230('0x6')](_0x8230('0x7'),auth[_0x8230('0x8')](),controller[_0x8230('0x9')]);router[_0x8230('0xa')](_0x8230('0x7'),auth[_0x8230('0x8')](),controller[_0x8230('0xb')]);module[_0x8230('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 35259b2..cdaa1d5 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x4ac831,_0x49cab2){var _0x4d161a=function(_0x12d23a){while(--_0x12d23a){_0x4ac831['push'](_0x4ac831['shift']());}};_0x4d161a(++_0x49cab2);}(_0x6f47,0xc7));var _0x76f4=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x6f47[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x4b477a,_0x3e3f1e){var _0x291072=function(_0x2539a9){while(--_0x2539a9){_0x4b477a['push'](_0x4b477a['shift']());}};_0x291072(++_0x3e3f1e);}(_0xac9d,0x14d));var _0xdac9=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xac9d[_0x5e3701];return _0x345dcf;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2cbbcc6..f9244b7 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 _0x78c9=['sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%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)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignTable','foreignKey','table','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','HOUR(%s)','from','output','web','%s-%s.%s','randomstring','csv','custom','cdr','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','QueryTypes','run','runReport','ValidationErrorItem','%s.%s\x20=\x20%s.%s','request-promise','bluebird','mustache','path','sox','to-csv','ejs','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','dbH','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','get','error','stack','name','send','index','AnalyticCustomReport','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0xef7e4,_0x339d9b){var _0x5a9b8e=function(_0x26e000){while(--_0x26e000){_0xef7e4['push'](_0xef7e4['shift']());}};_0x5a9b8e(++_0x339d9b);}(_0x78c9,0x68));var _0x978c=function(_0x14434e,_0x27b314){_0x14434e=_0x14434e-0x0;var _0x56d749=_0x78c9[_0x14434e];return _0x56d749;};'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(_0x978c('0x0'));var moment=require('moment');var BPromise=require(_0x978c('0x1'));var Mustache=require(_0x978c('0x2'));var util=require('util');var path=require(_0x978c('0x3'));var sox=require(_0x978c('0x4'));var csv=require(_0x978c('0x5'));var ejs=require(_0x978c('0x6'));var fs=require('fs');var fs_extra=require(_0x978c('0x7'));var _=require(_0x978c('0x8'));var squel=require('squel');var crypto=require(_0x978c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x978c('0xa'));var toCsv=require(_0x978c('0x5'));var querystring=require('querystring');var Papa=require(_0x978c('0xb'));var Redis=require(_0x978c('0xc'));var authService=require(_0x978c('0xd'));var qs=require(_0x978c('0xe'));var as=require(_0x978c('0xf'));var hardwareService=require(_0x978c('0x10'));var logger=require(_0x978c('0x11'))(_0x978c('0x12'));var utils=require(_0x978c('0x13'));var config=require(_0x978c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x978c('0x15'))['db'];var dbH=require(_0x978c('0x15'))[_0x978c('0x16')];function respondWithStatusCode(_0x3d0f69,_0x310aa4){_0x310aa4=_0x310aa4||0xcc;return function(_0x29db44){if(_0x29db44){return _0x3d0f69[_0x978c('0x17')](_0x310aa4);}return _0x3d0f69['status'](_0x310aa4)['end']();};}function respondWithResult(_0x2ca64b,_0x3a876e){_0x3a876e=_0x3a876e||0xc8;return function(_0x58cc7c){if(_0x58cc7c){return _0x2ca64b[_0x978c('0x18')](_0x3a876e)[_0x978c('0x19')](_0x58cc7c);}};}function respondWithFilteredResult(_0x1d9942,_0x2f6bf3){return function(_0x138af1){if(_0x138af1){var _0xba78d2=typeof _0x2f6bf3[_0x978c('0x1a')]==='undefined'&&typeof _0x2f6bf3[_0x978c('0x1b')]===_0x978c('0x1c');var _0x5c9a11=_0x138af1[_0x978c('0x1d')];var _0x746ba=_0xba78d2?0x0:_0x2f6bf3[_0x978c('0x1a')];var _0x17589b=_0xba78d2?_0x138af1[_0x978c('0x1d')]:_0x2f6bf3[_0x978c('0x1a')]+_0x2f6bf3[_0x978c('0x1b')];var _0xb1bf62;if(_0x17589b>=_0x5c9a11){_0x17589b=_0x5c9a11;_0xb1bf62=0xc8;}else{_0xb1bf62=0xce;}_0x1d9942[_0x978c('0x18')](_0xb1bf62);return _0x1d9942[_0x978c('0x1e')](_0x978c('0x1f'),_0x746ba+'-'+_0x17589b+'/'+_0x5c9a11)[_0x978c('0x19')](_0x138af1);}return null;};}function patchUpdates(_0x129b82){return function(_0x56ca1a){try{jsonpatch[_0x978c('0x20')](_0x56ca1a,_0x129b82,!![]);}catch(_0x373a85){return BPromise['reject'](_0x373a85);}return _0x56ca1a[_0x978c('0x21')]();};}function saveUpdates(_0x5f5a50,_0x350e32){return function(_0x38286e){if(_0x38286e){return _0x38286e[_0x978c('0x22')](_0x5f5a50)['then'](function(_0x558eba){return _0x558eba;});}return null;};}function removeEntity(_0x1b5250,_0x32b345){return function(_0x202e29){if(_0x202e29){return _0x202e29[_0x978c('0x23')]()[_0x978c('0x24')](function(){var _0x5cf006=_0x202e29[_0x978c('0x25')]({'plain':!![]});var _0x5b6d94='CustomReports';return db['UserProfileResource'][_0x978c('0x23')]({'where':{'type':_0x5b6d94,'resourceId':_0x5cf006['id']}})[_0x978c('0x24')](function(){return _0x202e29;});})[_0x978c('0x24')](function(){_0x1b5250[_0x978c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x165678,_0x5de1f3){return function(_0x4e3c68){if(!_0x4e3c68){_0x165678[_0x978c('0x17')](0x194);}return _0x4e3c68;};}function handleError(_0x12e742,_0x216947){_0x216947=_0x216947||0x1f4;return function(_0x5e7f9b){logger[_0x978c('0x26')](_0x5e7f9b[_0x978c('0x27')]);if(_0x5e7f9b['name']){delete _0x5e7f9b[_0x978c('0x28')];}_0x12e742[_0x978c('0x18')](_0x216947)[_0x978c('0x29')](_0x5e7f9b);};}exports[_0x978c('0x2a')]=function(_0x5d09dc,_0x3a6eb0){var _0x8423b7={},_0x371c0c={},_0x2ad336={'count':0x0,'rows':[]};var _0x12c710=_['map'](db[_0x978c('0x2b')]['rawAttributes'],function(_0x4576db){return{'name':_0x4576db[_0x978c('0x2c')],'type':_0x4576db[_0x978c('0x2d')]['key']};});_0x371c0c[_0x978c('0x2e')]=_[_0x978c('0x2f')](_0x12c710,'name');_0x371c0c[_0x978c('0x30')]=_[_0x978c('0x31')](_0x5d09dc[_0x978c('0x30')]);_0x371c0c[_0x978c('0x32')]=_[_0x978c('0x33')](_0x371c0c[_0x978c('0x2e')],_0x371c0c[_0x978c('0x30')]);_0x8423b7[_0x978c('0x34')]=_[_0x978c('0x33')](_0x371c0c[_0x978c('0x2e')],qs['fields'](_0x5d09dc[_0x978c('0x30')]['fields']));_0x8423b7[_0x978c('0x34')]=_0x8423b7[_0x978c('0x34')][_0x978c('0x35')]?_0x8423b7[_0x978c('0x34')]:_0x371c0c[_0x978c('0x2e')];if(!_0x5d09dc[_0x978c('0x30')][_0x978c('0x36')](_0x978c('0x37'))){_0x8423b7[_0x978c('0x1b')]=qs[_0x978c('0x1b')](_0x5d09dc[_0x978c('0x30')][_0x978c('0x1b')]);_0x8423b7[_0x978c('0x1a')]=qs[_0x978c('0x1a')](_0x5d09dc[_0x978c('0x30')]['offset']);}_0x8423b7[_0x978c('0x38')]=qs['sort'](_0x5d09dc[_0x978c('0x30')][_0x978c('0x39')]);_0x8423b7[_0x978c('0x3a')]=qs[_0x978c('0x32')](_['pick'](_0x5d09dc[_0x978c('0x30')],_0x371c0c[_0x978c('0x32')]),_0x12c710);if(_0x5d09dc[_0x978c('0x30')][_0x978c('0x3b')]){_0x8423b7['where']=_[_0x978c('0x3c')](_0x8423b7[_0x978c('0x3a')],{'$or':_['map'](_0x12c710,function(_0x596362){if(_0x596362[_0x978c('0x2d')]!==_0x978c('0x3d')){var _0xa789e7={};_0xa789e7[_0x596362[_0x978c('0x28')]]={'$like':'%'+_0x5d09dc[_0x978c('0x30')]['filter']+'%'};return _0xa789e7;}})});}_0x8423b7=_[_0x978c('0x3c')]({},_0x8423b7,_0x5d09dc[_0x978c('0x3e')]);var _0x2a542f={'where':_0x8423b7[_0x978c('0x3a')]};return db[_0x978c('0x2b')][_0x978c('0x1d')](_0x2a542f)[_0x978c('0x24')](function(_0x1092a7){_0x2ad336[_0x978c('0x1d')]=_0x1092a7;if(_0x5d09dc[_0x978c('0x30')][_0x978c('0x3f')]){_0x8423b7['include']=[{'all':!![]}];}return db[_0x978c('0x2b')][_0x978c('0x40')](_0x8423b7);})['then'](function(_0x5938d4){_0x2ad336[_0x978c('0x41')]=_0x5938d4;return _0x2ad336;})[_0x978c('0x24')](respondWithFilteredResult(_0x3a6eb0,_0x8423b7))[_0x978c('0x42')](handleError(_0x3a6eb0,null));};exports['show']=function(_0x43f670,_0x45723e){var _0x319b1b={'raw':![],'where':{'id':_0x43f670[_0x978c('0x43')]['id']}},_0x5e12e0={};_0x5e12e0[_0x978c('0x2e')]=_[_0x978c('0x31')](db[_0x978c('0x2b')]['rawAttributes']);_0x5e12e0[_0x978c('0x30')]=_[_0x978c('0x31')](_0x43f670[_0x978c('0x30')]);_0x5e12e0['filters']=_[_0x978c('0x33')](_0x5e12e0['model'],_0x5e12e0[_0x978c('0x30')]);_0x319b1b[_0x978c('0x34')]=_[_0x978c('0x33')](_0x5e12e0[_0x978c('0x2e')],qs['fields'](_0x43f670[_0x978c('0x30')][_0x978c('0x44')]));_0x319b1b[_0x978c('0x34')]=_0x319b1b[_0x978c('0x34')][_0x978c('0x35')]?_0x319b1b['attributes']:_0x5e12e0[_0x978c('0x2e')];if(_0x43f670[_0x978c('0x30')][_0x978c('0x3f')]){_0x319b1b[_0x978c('0x45')]=[{'all':!![]}];}_0x319b1b=_[_0x978c('0x3c')]({},_0x319b1b,_0x43f670['options']);return db[_0x978c('0x2b')][_0x978c('0x46')](_0x319b1b)[_0x978c('0x24')](handleEntityNotFound(_0x45723e,null))['then'](respondWithResult(_0x45723e,null))['catch'](handleError(_0x45723e,null));};exports[_0x978c('0x47')]=function(_0x42836c,_0x4784bf){return db[_0x978c('0x2b')][_0x978c('0x47')](_0x42836c[_0x978c('0x48')],{})[_0x978c('0x24')](function(_0x1e95c0){var _0xc56a09=_0x42836c[_0x978c('0x49')][_0x978c('0x25')]({'plain':!![]});if(!_0xc56a09)throw new Error(_0x978c('0x4a'));if(_0xc56a09[_0x978c('0x4b')]===_0x978c('0x49')){var _0x99ee1a=_0x1e95c0[_0x978c('0x25')]({'plain':!![]});var _0x227427=_0x978c('0x4c');return db['UserProfileSection'][_0x978c('0x46')]({'where':{'name':_0x227427,'userProfileId':_0xc56a09[_0x978c('0x4d')]},'raw':!![]})[_0x978c('0x24')](function(_0x5f9995){if(_0x5f9995&&_0x5f9995[_0x978c('0x4e')]===0x0){return db[_0x978c('0x4f')][_0x978c('0x47')]({'name':_0x99ee1a[_0x978c('0x28')],'resourceId':_0x99ee1a['id'],'type':_0x978c('0x50'),'sectionId':_0x5f9995['id']},{})[_0x978c('0x24')](function(){return _0x1e95c0;});}else{return _0x1e95c0;}})[_0x978c('0x42')](function(_0x5a9f41){logger[_0x978c('0x26')](_0x978c('0x51'),_0x5a9f41);throw _0x5a9f41;});}return _0x1e95c0;})['then'](respondWithResult(_0x4784bf,0xc9))['catch'](handleError(_0x4784bf,null));};exports[_0x978c('0x22')]=function(_0x31596e,_0x35fe01){if(_0x31596e[_0x978c('0x48')]['id']){delete _0x31596e[_0x978c('0x48')]['id'];}return db[_0x978c('0x2b')][_0x978c('0x46')]({'where':{'id':_0x31596e[_0x978c('0x43')]['id']}})[_0x978c('0x24')](handleEntityNotFound(_0x35fe01,null))[_0x978c('0x24')](saveUpdates(_0x31596e[_0x978c('0x48')],null))[_0x978c('0x24')](respondWithResult(_0x35fe01,null))[_0x978c('0x42')](handleError(_0x35fe01,null));};exports[_0x978c('0x23')]=function(_0x278e36,_0x2a531e){return db[_0x978c('0x2b')][_0x978c('0x46')]({'where':{'id':_0x278e36[_0x978c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a531e,null))[_0x978c('0x24')](removeEntity(_0x2a531e,null))[_0x978c('0x42')](handleError(_0x2a531e,null));};exports[_0x978c('0x52')]=function(_0x442c20,_0xebaddc){var _0x3d3d6a=0xa;var _0x1f9c14=[_0x978c('0x53'),_0x978c('0x54'),_0x978c('0x55'),_0x978c('0x56')];var _0x2a85f6={'SUM':_0x978c('0x57'),'COUNT':_0x978c('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x978c('0x59'),'MIN':_0x978c('0x5a'),'AVG':_0x978c('0x5b'),'GROUP_CONCAT':_0x978c('0x5c'),'GROUP_CONCAT ASC':_0x978c('0x5d'),'GROUP_CONCAT DESC':_0x978c('0x5e')};var _0xd83a6c={'SEC_TO_TIME':_0x978c('0x5f'),'DATE':_0x978c('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x978c('0x61'),'UNIX_TIMESTAMP':_0x978c('0x62')};var _0x1a1360=function(_0x11a741){return!_['includes']([_0x978c('0x63'),_0x978c('0x64'),_0x978c('0x65'),_0x978c('0x66')],_0x11a741);};var _0x55497d=function(_0x5eec85){if(!_0x5eec85||!_0x5eec85['rules'][_0x978c('0x35')]){return'';}for(var _0x5f5629='(',_0x1bb55d=0x0;_0x1bb55d<_0x5eec85[_0x978c('0x67')][_0x978c('0x35')];_0x1bb55d+=0x1){_0x1bb55d>0x0&&(_0x5f5629+='\x20'+_0x5eec85[_0x978c('0x68')]+'\x20');_0x5f5629+=_0x5eec85[_0x978c('0x67')][_0x1bb55d][_0x978c('0x69')]?_0x55497d(_0x5eec85['rules'][_0x1bb55d][_0x978c('0x69')]):_0x5eec85[_0x978c('0x67')][_0x1bb55d][_0x978c('0x6a')]+'\x20'+_0x5eec85['rules'][_0x1bb55d][_0x978c('0x6b')]+(_0x1a1360(_0x5eec85[_0x978c('0x67')][_0x1bb55d]['condition'])?'\x20'+_0x5eec85[_0x978c('0x67')][_0x1bb55d][_0x978c('0x6c')]:'');}return _0x5f5629+')';};var _0x5ce3e0={'where':{'id':_0x442c20[_0x978c('0x43')]['id']}},_0x2a3394,_0x3cb368,_0x292e36,_0x5579ff,_0x3d14e1;_0x5ce3e0=_['merge']({},_0x5ce3e0,_0x442c20[_0x978c('0x3e')]);return db[_0x978c('0x2b')]['find'](_0x5ce3e0)[_0x978c('0x24')](function(_0x31cf3a){if(_0x31cf3a){_0x2a3394=_0x31cf3a;return _0x31cf3a[_0x978c('0x6d')]();}return null;})[_0x978c('0x24')](function(_0x45471e){if(_0x45471e){if(!_0x45471e[_0x978c('0x35')]){throw new db[(_0x978c('0x6e'))]['ValidationErrorItem'](_0x978c('0x6f'),0x193);}_0x3cb368=_0x45471e;return db[_0x978c('0x70')]['findAll']({'raw':!![]});}return null;})[_0x978c('0x24')](function(_0x46170){if(_0x46170){_0x292e36=_[_0x978c('0x71')](_0x46170,'id');var _0x37e460;var _0x211f2f=squel[_0x978c('0x72')]();_0x211f2f['from'](_0x2a3394['table']);for(var _0x2a48d8=0x0;_0x2a48d8<_0x3cb368[_0x978c('0x35')];_0x2a48d8+=0x1){_0x37e460=_0x3cb368[_0x2a48d8][_0x978c('0x73')]?_0x292e36[_0x3cb368[_0x2a48d8][_0x978c('0x73')]][_0x978c('0x74')]:_0x3cb368[_0x2a48d8][_0x978c('0x6a')];_0x37e460=_0x3cb368[_0x2a48d8][_0x978c('0x75')]?_[_0x978c('0x76')](_0x2a85f6[_0x3cb368[_0x2a48d8][_0x978c('0x75')]],'%s',_0x37e460):_0x37e460;_0x37e460=_0x3cb368[_0x2a48d8][_0x978c('0x77')]?_['replace'](_0xd83a6c[_0x3cb368[_0x2a48d8][_0x978c('0x77')]],'%s',_0x37e460):_0x37e460;if(_0x3cb368[_0x2a48d8][_0x978c('0x78')]){_0x211f2f[_0x978c('0x69')](_0x37e460);}_0x3cb368[_0x2a48d8]['orderBy']&&_0x211f2f[_0x978c('0x38')](_0x37e460,_0x3cb368[_0x2a48d8][_0x978c('0x79')]===_0x978c('0x7a')?![]:!![]);_0x211f2f[_0x978c('0x6a')](_0x37e460,_0x3cb368[_0x2a48d8][_0x978c('0x7b')]||_0x37e460);}if(_0x2a3394['joins']){_0x2a3394[_0x978c('0x7c')]=JSON[_0x978c('0x7d')](_0x2a3394[_0x978c('0x7c')]);for(var _0x11f195=0x0;_0x11f195<_0x2a3394[_0x978c('0x7c')]['length'];_0x11f195+=0x1){if(_0x2a3394[_0x978c('0x7c')][_0x11f195]['type']&&_[_0x978c('0x7e')](_0x1f9c14,_0x2a3394[_0x978c('0x7c')][_0x11f195]['type'])&&_0x2a3394[_0x978c('0x7c')][_0x11f195]['parentKey']&&_0x2a3394[_0x978c('0x7c')][_0x11f195][_0x978c('0x7f')]&&_0x2a3394[_0x978c('0x7c')][_0x11f195][_0x978c('0x80')]){_0x211f2f[_0x2a3394['joins'][_0x11f195][_0x978c('0x2d')]](_0x2a3394[_0x978c('0x7c')][_0x11f195][_0x978c('0x7f')],null,util[_0x978c('0x77')]('%s.%s\x20=\x20%s.%s',_0x2a3394[_0x978c('0x81')],_0x2a3394['joins'][_0x11f195][_0x978c('0x82')],_0x2a3394[_0x978c('0x7c')][_0x11f195][_0x978c('0x7f')],_0x2a3394['joins'][_0x11f195][_0x978c('0x80')]));}}}if(_0x2a3394['conditions']){_0x2a3394[_0x978c('0x83')]=JSON[_0x978c('0x7d')](_0x2a3394[_0x978c('0x83')]);_0x211f2f[_0x978c('0x3a')](_0x55497d(_0x2a3394[_0x978c('0x83')][_0x978c('0x69')]));}_0x3d14e1=_0x211f2f[_0x978c('0x84')]();_0x211f2f['limit'](_0x3d3d6a);_0x211f2f[_0x978c('0x1a')](0x0);logger[_0x978c('0x85')](_0x978c('0x86'),_0x211f2f['toString']());return dbH[_0x978c('0x87')][_0x978c('0x30')](_0x211f2f[_0x978c('0x88')](),{'type':dbH[_0x978c('0x87')]['QueryTypes'][_0x978c('0x89')]});}})[_0x978c('0x24')](respondWithResult(_0xebaddc,null))[_0x978c('0x42')](handleError(_0xebaddc,null));};function runReport(_0x12bef9,_0x28a28a,_0x4e9e58){var _0x1fdc17=_0x28a28a['name'];var _0x4954cb=0xa;var _0xfaf3b2=['join',_0x978c('0x54'),_0x978c('0x55'),'cross_join'];var _0x3d3a17={'SUM':_0x978c('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x978c('0x5a'),'AVG':_0x978c('0x5b'),'GROUP_CONCAT':_0x978c('0x5c'),'GROUP_CONCAT ASC':_0x978c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ad14a={'SEC_TO_TIME':_0x978c('0x5f'),'DATE':_0x978c('0x60'),'HOUR':_0x978c('0x8a'),'ROUND':_0x978c('0x61'),'UNIX_TIMESTAMP':_0x978c('0x62')};var _0x1e329f=function(_0x244f55){return!_[_0x978c('0x7e')](['IS\x20NULL',_0x978c('0x64'),_0x978c('0x65'),_0x978c('0x66')],_0x244f55);};var _0x2b7e62=function(_0x14d3f2){if(!_0x14d3f2||!_0x14d3f2[_0x978c('0x67')]['length']){return'';}for(var _0x1cf714='(',_0x39f05f=0x0;_0x39f05f<_0x14d3f2[_0x978c('0x67')][_0x978c('0x35')];_0x39f05f+=0x1){_0x39f05f>0x0&&(_0x1cf714+='\x20'+_0x14d3f2[_0x978c('0x68')]+'\x20');_0x1cf714+=_0x14d3f2['rules'][_0x39f05f][_0x978c('0x69')]?_0x2b7e62(_0x14d3f2[_0x978c('0x67')][_0x39f05f][_0x978c('0x69')]):_0x14d3f2[_0x978c('0x67')][_0x39f05f][_0x978c('0x6a')]+'\x20'+_0x14d3f2[_0x978c('0x67')][_0x39f05f][_0x978c('0x6b')]+(_0x1e329f(_0x14d3f2[_0x978c('0x67')][_0x39f05f][_0x978c('0x6b')])?'\x20'+_0x14d3f2[_0x978c('0x67')][_0x39f05f][_0x978c('0x6c')]:'');}return _0x1cf714+')';};var _0x1c59c5={'where':{'id':_0x12bef9['id']}},_0x3ff17c,_0x5cdea6,_0x40cbd8,_0x191ac6,_0x1312dd;_0x1c59c5=_['merge']({},_0x1c59c5,_0x4e9e58);return db[_0x978c('0x2b')][_0x978c('0x46')](_0x1c59c5)[_0x978c('0x24')](function(_0x372c96){if(_0x372c96){_0x3ff17c=_0x372c96;return _0x372c96['getFields']();}return null;})[_0x978c('0x24')](function(_0x13e54d){if(_0x13e54d){if(!_0x13e54d[_0x978c('0x35')]){throw new db[(_0x978c('0x6e'))]['ValidationErrorItem'](_0x978c('0x6f'),0x193);}_0x5cdea6=_0x13e54d;return db[_0x978c('0x70')][_0x978c('0x40')]({'raw':!![]});}return null;})['then'](function(_0x2b54a2){if(_0x2b54a2){_0x40cbd8=_[_0x978c('0x71')](_0x2b54a2,'id');var _0x39f8b2;var _0x302863=squel[_0x978c('0x72')]();_0x302863[_0x978c('0x8b')](_0x3ff17c[_0x978c('0x81')]);for(var _0x149d53=0x0;_0x149d53<_0x5cdea6['length'];_0x149d53+=0x1){_0x39f8b2=_0x5cdea6[_0x149d53]['MetricId']?_0x40cbd8[_0x5cdea6[_0x149d53][_0x978c('0x73')]][_0x978c('0x74')]:_0x5cdea6[_0x149d53][_0x978c('0x6a')];_0x39f8b2=_0x5cdea6[_0x149d53][_0x978c('0x75')]?_[_0x978c('0x76')](_0x3d3a17[_0x5cdea6[_0x149d53][_0x978c('0x75')]],'%s',_0x39f8b2):_0x39f8b2;_0x39f8b2=_0x5cdea6[_0x149d53][_0x978c('0x77')]?_[_0x978c('0x76')](_0x4ad14a[_0x5cdea6[_0x149d53]['format']],'%s',_0x39f8b2):_0x39f8b2;if(_0x5cdea6[_0x149d53][_0x978c('0x78')]){_0x302863[_0x978c('0x69')](_0x39f8b2);}_0x5cdea6[_0x149d53]['orderBy']&&_0x302863['order'](_0x39f8b2,_0x5cdea6[_0x149d53]['orderBy']===_0x978c('0x7a')?![]:!![]);_0x302863[_0x978c('0x6a')](_0x39f8b2,_0x5cdea6[_0x149d53]['alias']||_0x39f8b2);}if(_0x3ff17c[_0x978c('0x7c')]){_0x3ff17c[_0x978c('0x7c')]=JSON[_0x978c('0x7d')](_0x3ff17c['joins']);for(var _0x5026b4=0x0;_0x5026b4<_0x3ff17c[_0x978c('0x7c')]['length'];_0x5026b4+=0x1){if(_0x3ff17c[_0x978c('0x7c')][_0x5026b4][_0x978c('0x2d')]&&_['includes'](_0xfaf3b2,_0x3ff17c['joins'][_0x5026b4]['type'])&&_0x3ff17c[_0x978c('0x7c')][_0x5026b4][_0x978c('0x82')]&&_0x3ff17c[_0x978c('0x7c')][_0x5026b4][_0x978c('0x7f')]&&_0x3ff17c[_0x978c('0x7c')][_0x5026b4][_0x978c('0x80')]){_0x302863[_0x3ff17c[_0x978c('0x7c')][_0x5026b4]['type']](_0x3ff17c[_0x978c('0x7c')][_0x5026b4]['foreignTable'],null,util[_0x978c('0x77')]('%s.%s\x20=\x20%s.%s',_0x3ff17c[_0x978c('0x81')],_0x3ff17c[_0x978c('0x7c')][_0x5026b4][_0x978c('0x82')],_0x3ff17c[_0x978c('0x7c')][_0x5026b4][_0x978c('0x7f')],_0x3ff17c[_0x978c('0x7c')][_0x5026b4][_0x978c('0x80')]));}}}if(_0x3ff17c['conditions']){_0x3ff17c[_0x978c('0x83')]=JSON[_0x978c('0x7d')](_0x3ff17c[_0x978c('0x83')]);_0x302863[_0x978c('0x3a')](_0x2b7e62(_0x3ff17c[_0x978c('0x83')]['group']));}_0x1312dd=_0x302863[_0x978c('0x84')]();_0x302863[_0x978c('0x1b')](_0x4954cb);_0x302863['offset'](0x0);return;}})['then'](function(){if(_0x28a28a[_0x978c('0x8c')]===_0x978c('0x8d')){return null;}var _0x40ffa4=_[_0x978c('0x3c')](_0x28a28a,{'name':_0x28a28a['fullPath']||_0x28a28a[_0x978c('0x28')]||_0x3ff17c['name'],'basename':_0x1fdc17,'savename':util[_0x978c('0x77')](_0x978c('0x8e'),_0x28a28a[_0x978c('0x28')]||_0x3ff17c[_0x978c('0x28')],require(_0x978c('0x8f'))['generate'](0x4),_0x28a28a[_0x978c('0x8c')]||_0x978c('0x90')),'reportId':_0x3ff17c['id'],'reportType':_0x978c('0x91')});return db['AnalyticExtractedReport'][_0x978c('0x47')](_0x40ffa4,{'raw':!![]});})['then'](function(_0x2ad50d){if(_0x3ff17c['table']===_0x978c('0x92')){_0x1312dd['where'](_0x3ff17c['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x28a28a[_0x978c('0x93')],_0x28a28a['endDate']);}else{_0x1312dd[_0x978c('0x3a')](_0x3ff17c['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x28a28a[_0x978c('0x93')],_0x28a28a[_0x978c('0x94')]);}if(_0x2ad50d){logger[_0x978c('0x95')](_0x978c('0x96'),_0x1312dd[_0x978c('0x88')]());require('child_process')[_0x978c('0x97')](path[_0x978c('0x53')](__dirname,_0x978c('0x98'),_0x2ad50d[_0x978c('0x8c')]),[_0x2ad50d['id'],_0x1312dd['toString'](),path['join'](__dirname,_0x978c('0x99'),_0x2ad50d[_0x978c('0x9a')]),_0x1fdc17]);return _0x2ad50d;}else{var _0x287bca=squel[_0x978c('0x72')]();_0x287bca['from']('('+_0x1312dd[_0x978c('0x88')]()+')',_0x978c('0x9b'));_0x287bca[_0x978c('0x6a')]('COUNT(*)',_0x978c('0x1d'));_0x1312dd[_0x978c('0x1b')](_0x28a28a[_0x978c('0x1b')]||_0x4954cb);_0x1312dd[_0x978c('0x1a')](_0x28a28a[_0x978c('0x1a')]||0x0);return dbH[_0x978c('0x87')][_0x978c('0x30')](_0x287bca['toString'](),{'type':dbH[_0x978c('0x87')][_0x978c('0x9c')][_0x978c('0x89')]})[_0x978c('0x24')](function(_0x20eade){if(!_0x20eade[_0x978c('0x35')]){_0x191ac6=0x0;}else{_0x191ac6=_0x20eade[0x0][_0x978c('0x1d')]||0x0;}return dbH[_0x978c('0x87')][_0x978c('0x30')](_0x1312dd[_0x978c('0x88')](),{'type':dbH[_0x978c('0x87')]['QueryTypes'][_0x978c('0x89')]});})[_0x978c('0x24')](function(_0x15cf28){return{'rows':_0x15cf28||[],'count':_0x191ac6};});}});}exports[_0x978c('0x9d')]=function(_0xfc53a9,_0x567dbb){return runReport(_0xfc53a9[_0x978c('0x43')],_0xfc53a9[_0x978c('0x30')],_0xfc53a9[_0x978c('0x3e')])[_0x978c('0x24')](respondWithResult(_0x567dbb,null))[_0x978c('0x42')](handleError(_0x567dbb,null));};exports[_0x978c('0x9e')]=runReport;exports[_0x978c('0x30')]=function(_0x5e249e,_0xa1350c){var _0x5018a7=0xa;var _0x48dfc1=[_0x978c('0x53'),_0x978c('0x54'),_0x978c('0x55'),'cross_join'];var _0xc1b682={'SUM':'SUM(%s)','COUNT':_0x978c('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x978c('0x59'),'MIN':_0x978c('0x5a'),'AVG':_0x978c('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x978c('0x5d'),'GROUP_CONCAT DESC':_0x978c('0x5e')};var _0xc5a5d7={'SEC_TO_TIME':_0x978c('0x5f'),'DATE':_0x978c('0x60'),'HOUR':_0x978c('0x8a'),'ROUND':_0x978c('0x61'),'UNIX_TIMESTAMP':_0x978c('0x62')};var _0x3be2df=function(_0x6dcf21){return!_['includes'](['IS\x20NULL',_0x978c('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x6dcf21);};var _0x22b5b6=function(_0x329018){if(!_0x329018||!_0x329018['rules'][_0x978c('0x35')]){return'';}for(var _0x4bf82e='(',_0x3b5c70=0x0;_0x3b5c70<_0x329018['rules']['length'];_0x3b5c70+=0x1){_0x3b5c70>0x0&&(_0x4bf82e+='\x20'+_0x329018[_0x978c('0x68')]+'\x20');_0x4bf82e+=_0x329018[_0x978c('0x67')][_0x3b5c70][_0x978c('0x69')]?_0x22b5b6(_0x329018[_0x978c('0x67')][_0x3b5c70][_0x978c('0x69')]):_0x329018[_0x978c('0x67')][_0x3b5c70]['field']+'\x20'+_0x329018[_0x978c('0x67')][_0x3b5c70][_0x978c('0x6b')]+(_0x3be2df(_0x329018[_0x978c('0x67')][_0x3b5c70][_0x978c('0x6b')])?'\x20'+_0x329018[_0x978c('0x67')][_0x3b5c70][_0x978c('0x6c')]:'');}return _0x4bf82e+')';};var _0xf0dbec={'where':{'id':_0x5e249e['params']['id']}},_0x3f71a2,_0x2e512d,_0x3d9a21,_0x48cd4d,_0x5c9234;_0xf0dbec=_[_0x978c('0x3c')]({},_0xf0dbec,_0x5e249e['options']);return db['AnalyticCustomReport'][_0x978c('0x46')](_0xf0dbec)[_0x978c('0x24')](function(_0x9843e3){if(_0x9843e3){_0x3f71a2=_0x9843e3;return _0x9843e3[_0x978c('0x6d')]();}return null;})[_0x978c('0x24')](function(_0x2f090e){if(_0x2f090e){if(!_0x2f090e['length']){throw new db[(_0x978c('0x6e'))][(_0x978c('0x9f'))](_0x978c('0x6f'),0x193);}_0x2e512d=_0x2f090e;return db[_0x978c('0x70')][_0x978c('0x40')]({'raw':!![]});}return null;})[_0x978c('0x24')](function(_0x44f54a){if(_0x44f54a){_0x3d9a21=_[_0x978c('0x71')](_0x44f54a,'id');var _0x2466ad;var _0x4168ec=squel[_0x978c('0x72')]();_0x4168ec['from'](_0x3f71a2[_0x978c('0x81')]);for(var _0x3caa1f=0x0;_0x3caa1f<_0x2e512d['length'];_0x3caa1f+=0x1){_0x2466ad=_0x2e512d[_0x3caa1f][_0x978c('0x73')]?_0x3d9a21[_0x2e512d[_0x3caa1f]['MetricId']][_0x978c('0x74')]:_0x2e512d[_0x3caa1f][_0x978c('0x6a')];_0x2466ad=_0x2e512d[_0x3caa1f][_0x978c('0x75')]?_[_0x978c('0x76')](_0xc1b682[_0x2e512d[_0x3caa1f][_0x978c('0x75')]],'%s',_0x2466ad):_0x2466ad;_0x2466ad=_0x2e512d[_0x3caa1f]['format']?_[_0x978c('0x76')](_0xc5a5d7[_0x2e512d[_0x3caa1f]['format']],'%s',_0x2466ad):_0x2466ad;if(_0x2e512d[_0x3caa1f][_0x978c('0x78')]){_0x4168ec['group'](_0x2466ad);}_0x2e512d[_0x3caa1f]['orderBy']&&_0x4168ec[_0x978c('0x38')](_0x2466ad,_0x2e512d[_0x3caa1f][_0x978c('0x79')]===_0x978c('0x7a')?![]:!![]);_0x4168ec[_0x978c('0x6a')](_0x2466ad,_0x2e512d[_0x3caa1f][_0x978c('0x7b')]||_0x2466ad);}if(_0x3f71a2[_0x978c('0x7c')]){_0x3f71a2[_0x978c('0x7c')]=JSON[_0x978c('0x7d')](_0x3f71a2[_0x978c('0x7c')]);for(var _0x284f57=0x0;_0x284f57<_0x3f71a2[_0x978c('0x7c')][_0x978c('0x35')];_0x284f57+=0x1){if(_0x3f71a2[_0x978c('0x7c')][_0x284f57][_0x978c('0x2d')]&&_['includes'](_0x48dfc1,_0x3f71a2[_0x978c('0x7c')][_0x284f57][_0x978c('0x2d')])&&_0x3f71a2[_0x978c('0x7c')][_0x284f57][_0x978c('0x82')]&&_0x3f71a2['joins'][_0x284f57]['foreignTable']&&_0x3f71a2[_0x978c('0x7c')][_0x284f57][_0x978c('0x80')]){_0x4168ec[_0x3f71a2[_0x978c('0x7c')][_0x284f57][_0x978c('0x2d')]](_0x3f71a2['joins'][_0x284f57][_0x978c('0x7f')],null,util[_0x978c('0x77')](_0x978c('0xa0'),_0x3f71a2[_0x978c('0x81')],_0x3f71a2[_0x978c('0x7c')][_0x284f57][_0x978c('0x82')],_0x3f71a2[_0x978c('0x7c')][_0x284f57][_0x978c('0x7f')],_0x3f71a2[_0x978c('0x7c')][_0x284f57]['foreignKey']));}}}if(_0x3f71a2[_0x978c('0x83')]){_0x3f71a2[_0x978c('0x83')]=JSON[_0x978c('0x7d')](_0x3f71a2['conditions']);_0x4168ec[_0x978c('0x3a')](_0x22b5b6(_0x3f71a2['conditions'][_0x978c('0x69')]));}_0x5c9234=_0x4168ec[_0x978c('0x84')]();_0x4168ec[_0x978c('0x1b')](_0x5018a7);_0x4168ec[_0x978c('0x1a')](0x0);logger[_0x978c('0x85')](_0x978c('0x86'),_0x4168ec['toString']());return dbH['sequelize'][_0x978c('0x30')](_0x4168ec[_0x978c('0x88')](),{'type':dbH[_0x978c('0x87')]['QueryTypes'][_0x978c('0x89')]});}})[_0x978c('0x24')](function(){return{'sql':_0x5c9234['toString']()};})[_0x978c('0x24')](respondWithResult(_0xa1350c,null))['catch'](handleError(_0xa1350c,null));}; \ No newline at end of file +var _0xdcde=['save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','include','findAll','params','includeAll','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','options','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','parentKey','clone','web','fullPath','%s-%s.%s','randomstring','generate','output','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x26b1a5,_0x3ffb3e){var _0xb21c93=function(_0x1578dd){while(--_0x1578dd){_0x26b1a5['push'](_0x26b1a5['shift']());}};_0xb21c93(++_0x3ffb3e);}(_0xdcde,0x1d0));var _0xedcd=function(_0x6b942a,_0x311643){_0x6b942a=_0x6b942a-0x0;var _0x22129d=_0xdcde[_0x6b942a];return _0x22129d;};'use strict';var emlformat=require(_0xedcd('0x0'));var rimraf=require(_0xedcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedcd('0x2'));var rp=require(_0xedcd('0x3'));var moment=require(_0xedcd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xedcd('0x5'));var sox=require(_0xedcd('0x6'));var csv=require(_0xedcd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedcd('0x8'));var _=require(_0xedcd('0x9'));var squel=require(_0xedcd('0xa'));var crypto=require(_0xedcd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xedcd('0xc'));var toCsv=require(_0xedcd('0x7'));var querystring=require(_0xedcd('0xd'));var Papa=require(_0xedcd('0xe'));var Redis=require(_0xedcd('0xf'));var authService=require(_0xedcd('0x10'));var qs=require(_0xedcd('0x11'));var as=require(_0xedcd('0x12'));var hardwareService=require(_0xedcd('0x13'));var logger=require(_0xedcd('0x14'))(_0xedcd('0x15'));var utils=require(_0xedcd('0x16'));var config=require(_0xedcd('0x17'));var licenseUtil=require(_0xedcd('0x18'));var db=require(_0xedcd('0x19'))['db'];var dbH=require(_0xedcd('0x19'))['dbH'];function respondWithStatusCode(_0x219b4a,_0x2f521a){_0x2f521a=_0x2f521a||0xcc;return function(_0x590620){if(_0x590620){return _0x219b4a[_0xedcd('0x1a')](_0x2f521a);}return _0x219b4a[_0xedcd('0x1b')](_0x2f521a)['end']();};}function respondWithResult(_0x4a9390,_0x3fb712){_0x3fb712=_0x3fb712||0xc8;return function(_0x599981){if(_0x599981){return _0x4a9390['status'](_0x3fb712)[_0xedcd('0x1c')](_0x599981);}};}function respondWithFilteredResult(_0x39a87a,_0x48a5f7){return function(_0x543628){if(_0x543628){var _0x981b01=typeof _0x48a5f7[_0xedcd('0x1d')]==='undefined'&&typeof _0x48a5f7[_0xedcd('0x1e')]===_0xedcd('0x1f');var _0x2e0095=_0x543628[_0xedcd('0x20')];var _0x4b7365=_0x981b01?0x0:_0x48a5f7['offset'];var _0x329f94=_0x981b01?_0x543628[_0xedcd('0x20')]:_0x48a5f7[_0xedcd('0x1d')]+_0x48a5f7[_0xedcd('0x1e')];var _0x5b33d8;if(_0x329f94>=_0x2e0095){_0x329f94=_0x2e0095;_0x5b33d8=0xc8;}else{_0x5b33d8=0xce;}_0x39a87a[_0xedcd('0x1b')](_0x5b33d8);return _0x39a87a[_0xedcd('0x21')](_0xedcd('0x22'),_0x4b7365+'-'+_0x329f94+'/'+_0x2e0095)['json'](_0x543628);}return null;};}function patchUpdates(_0x3e84d5){return function(_0x506c11){try{jsonpatch[_0xedcd('0x23')](_0x506c11,_0x3e84d5,!![]);}catch(_0x251b49){return BPromise[_0xedcd('0x24')](_0x251b49);}return _0x506c11[_0xedcd('0x25')]();};}function saveUpdates(_0x3267ba,_0x5aba2b){return function(_0x4e7360){if(_0x4e7360){return _0x4e7360[_0xedcd('0x26')](_0x3267ba)[_0xedcd('0x27')](function(_0x1b51d9){return _0x1b51d9;});}return null;};}function removeEntity(_0x4b3e3d,_0xd70440){return function(_0x516c49){if(_0x516c49){return _0x516c49[_0xedcd('0x28')]()[_0xedcd('0x27')](function(){var _0xa7558e=_0x516c49[_0xedcd('0x29')]({'plain':!![]});var _0xdbd925='CustomReports';return db[_0xedcd('0x2a')]['destroy']({'where':{'type':_0xdbd925,'resourceId':_0xa7558e['id']}})[_0xedcd('0x27')](function(){return _0x516c49;});})[_0xedcd('0x27')](function(){_0x4b3e3d[_0xedcd('0x1b')](0xcc)[_0xedcd('0x2b')]();});}};}function handleEntityNotFound(_0x379f6f,_0x202068){return function(_0x3e6aab){if(!_0x3e6aab){_0x379f6f[_0xedcd('0x1a')](0x194);}return _0x3e6aab;};}function handleError(_0x46110e,_0x359e1b){_0x359e1b=_0x359e1b||0x1f4;return function(_0x7d81f8){logger['error'](_0x7d81f8[_0xedcd('0x2c')]);if(_0x7d81f8[_0xedcd('0x2d')]){delete _0x7d81f8[_0xedcd('0x2d')];}_0x46110e['status'](_0x359e1b)[_0xedcd('0x2e')](_0x7d81f8);};}exports[_0xedcd('0x2f')]=function(_0x16554e,_0x5d93ad){var _0x39e327={},_0x4d86a3={},_0x4251fe={'count':0x0,'rows':[]};var _0xb2e186=_[_0xedcd('0x30')](db[_0xedcd('0x31')][_0xedcd('0x32')],function(_0x16c9c0){return{'name':_0x16c9c0['fieldName'],'type':_0x16c9c0[_0xedcd('0x33')][_0xedcd('0x34')]};});_0x4d86a3[_0xedcd('0x35')]=_[_0xedcd('0x30')](_0xb2e186,_0xedcd('0x2d'));_0x4d86a3['query']=_['keys'](_0x16554e[_0xedcd('0x36')]);_0x4d86a3[_0xedcd('0x37')]=_[_0xedcd('0x38')](_0x4d86a3[_0xedcd('0x35')],_0x4d86a3[_0xedcd('0x36')]);_0x39e327[_0xedcd('0x39')]=_[_0xedcd('0x38')](_0x4d86a3['model'],qs[_0xedcd('0x3a')](_0x16554e[_0xedcd('0x36')]['fields']));_0x39e327[_0xedcd('0x39')]=_0x39e327[_0xedcd('0x39')][_0xedcd('0x3b')]?_0x39e327[_0xedcd('0x39')]:_0x4d86a3[_0xedcd('0x35')];if(!_0x16554e[_0xedcd('0x36')][_0xedcd('0x3c')](_0xedcd('0x3d'))){_0x39e327['limit']=qs['limit'](_0x16554e[_0xedcd('0x36')][_0xedcd('0x1e')]);_0x39e327[_0xedcd('0x1d')]=qs['offset'](_0x16554e[_0xedcd('0x36')]['offset']);}_0x39e327[_0xedcd('0x3e')]=qs[_0xedcd('0x3f')](_0x16554e[_0xedcd('0x36')]['sort']);_0x39e327[_0xedcd('0x40')]=qs[_0xedcd('0x37')](_[_0xedcd('0x41')](_0x16554e[_0xedcd('0x36')],_0x4d86a3[_0xedcd('0x37')]),_0xb2e186);if(_0x16554e[_0xedcd('0x36')][_0xedcd('0x42')]){_0x39e327[_0xedcd('0x40')]=_['merge'](_0x39e327[_0xedcd('0x40')],{'$or':_[_0xedcd('0x30')](_0xb2e186,function(_0x32506c){if(_0x32506c['type']!=='VIRTUAL'){var _0x40a8bc={};_0x40a8bc[_0x32506c['name']]={'$like':'%'+_0x16554e[_0xedcd('0x36')][_0xedcd('0x42')]+'%'};return _0x40a8bc;}})});}_0x39e327=_['merge']({},_0x39e327,_0x16554e['options']);var _0x202258={'where':_0x39e327[_0xedcd('0x40')]};return db[_0xedcd('0x31')][_0xedcd('0x20')](_0x202258)[_0xedcd('0x27')](function(_0xf78174){_0x4251fe[_0xedcd('0x20')]=_0xf78174;if(_0x16554e[_0xedcd('0x36')]['includeAll']){_0x39e327[_0xedcd('0x43')]=[{'all':!![]}];}return db[_0xedcd('0x31')][_0xedcd('0x44')](_0x39e327);})[_0xedcd('0x27')](function(_0xfc44b1){_0x4251fe['rows']=_0xfc44b1;return _0x4251fe;})[_0xedcd('0x27')](respondWithFilteredResult(_0x5d93ad,_0x39e327))['catch'](handleError(_0x5d93ad,null));};exports['show']=function(_0x3dd8b3,_0x4a5aa7){var _0x580568={'raw':![],'where':{'id':_0x3dd8b3[_0xedcd('0x45')]['id']}},_0x5d4744={};_0x5d4744['model']=_['keys'](db[_0xedcd('0x31')][_0xedcd('0x32')]);_0x5d4744[_0xedcd('0x36')]=_['keys'](_0x3dd8b3[_0xedcd('0x36')]);_0x5d4744[_0xedcd('0x37')]=_[_0xedcd('0x38')](_0x5d4744[_0xedcd('0x35')],_0x5d4744['query']);_0x580568[_0xedcd('0x39')]=_[_0xedcd('0x38')](_0x5d4744['model'],qs[_0xedcd('0x3a')](_0x3dd8b3[_0xedcd('0x36')][_0xedcd('0x3a')]));_0x580568[_0xedcd('0x39')]=_0x580568[_0xedcd('0x39')][_0xedcd('0x3b')]?_0x580568[_0xedcd('0x39')]:_0x5d4744[_0xedcd('0x35')];if(_0x3dd8b3['query'][_0xedcd('0x46')]){_0x580568['include']=[{'all':!![]}];}_0x580568=_['merge']({},_0x580568,_0x3dd8b3['options']);return db[_0xedcd('0x31')][_0xedcd('0x47')](_0x580568)[_0xedcd('0x27')](handleEntityNotFound(_0x4a5aa7,null))[_0xedcd('0x27')](respondWithResult(_0x4a5aa7,null))[_0xedcd('0x48')](handleError(_0x4a5aa7,null));};exports[_0xedcd('0x49')]=function(_0x5755ed,_0x29647d){return db[_0xedcd('0x31')][_0xedcd('0x49')](_0x5755ed[_0xedcd('0x4a')],{})[_0xedcd('0x27')](function(_0x79890f){var _0x443e4e=_0x5755ed[_0xedcd('0x4b')][_0xedcd('0x29')]({'plain':!![]});if(!_0x443e4e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x443e4e[_0xedcd('0x4c')]===_0xedcd('0x4b')){var _0xdc975a=_0x79890f[_0xedcd('0x29')]({'plain':!![]});var _0x1e67a0='Reports';return db[_0xedcd('0x4d')][_0xedcd('0x47')]({'where':{'name':_0x1e67a0,'userProfileId':_0x443e4e[_0xedcd('0x4e')]},'raw':!![]})['then'](function(_0x1072f6){if(_0x1072f6&&_0x1072f6[_0xedcd('0x4f')]===0x0){return db['UserProfileResource'][_0xedcd('0x49')]({'name':_0xdc975a['name'],'resourceId':_0xdc975a['id'],'type':_0xedcd('0x50'),'sectionId':_0x1072f6['id']},{})['then'](function(){return _0x79890f;});}else{return _0x79890f;}})['catch'](function(_0x307d8b){logger[_0xedcd('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x307d8b);throw _0x307d8b;});}return _0x79890f;})[_0xedcd('0x27')](respondWithResult(_0x29647d,0xc9))[_0xedcd('0x48')](handleError(_0x29647d,null));};exports[_0xedcd('0x26')]=function(_0x12dafb,_0x407dad){if(_0x12dafb[_0xedcd('0x4a')]['id']){delete _0x12dafb['body']['id'];}return db[_0xedcd('0x31')][_0xedcd('0x47')]({'where':{'id':_0x12dafb['params']['id']}})[_0xedcd('0x27')](handleEntityNotFound(_0x407dad,null))[_0xedcd('0x27')](saveUpdates(_0x12dafb['body'],null))[_0xedcd('0x27')](respondWithResult(_0x407dad,null))['catch'](handleError(_0x407dad,null));};exports[_0xedcd('0x28')]=function(_0x3551b9,_0x2ab786){return db[_0xedcd('0x31')][_0xedcd('0x47')]({'where':{'id':_0x3551b9['params']['id']}})[_0xedcd('0x27')](handleEntityNotFound(_0x2ab786,null))['then'](removeEntity(_0x2ab786,null))[_0xedcd('0x48')](handleError(_0x2ab786,null));};exports[_0xedcd('0x52')]=function(_0x5ca493,_0x2540a3){var _0x279185=0xa;var _0x2a3358=[_0xedcd('0x53'),_0xedcd('0x54'),_0xedcd('0x55'),_0xedcd('0x56')];var _0x5af447={'SUM':_0xedcd('0x57'),'COUNT':_0xedcd('0x58'),'COUNT DISTINCT':_0xedcd('0x59'),'MAX':_0xedcd('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xedcd('0x5b')};var _0x2e02c7={'SEC_TO_TIME':_0xedcd('0x5c'),'DATE':_0xedcd('0x5d'),'HOUR':_0xedcd('0x5e'),'ROUND':_0xedcd('0x5f'),'UNIX_TIMESTAMP':_0xedcd('0x60')};var _0x305e6f=function(_0x5e05f2){return!_[_0xedcd('0x61')]([_0xedcd('0x62'),_0xedcd('0x63'),_0xedcd('0x64'),_0xedcd('0x65')],_0x5e05f2);};var _0x4ee1be=function(_0x4ebb41){if(!_0x4ebb41||!_0x4ebb41[_0xedcd('0x66')]['length']){return'';}for(var _0x4d0305='(',_0x50ea42=0x0;_0x50ea42<_0x4ebb41['rules']['length'];_0x50ea42+=0x1){_0x50ea42>0x0&&(_0x4d0305+='\x20'+_0x4ebb41[_0xedcd('0x67')]+'\x20');_0x4d0305+=_0x4ebb41['rules'][_0x50ea42][_0xedcd('0x68')]?_0x4ee1be(_0x4ebb41[_0xedcd('0x66')][_0x50ea42][_0xedcd('0x68')]):_0x4ebb41['rules'][_0x50ea42][_0xedcd('0x69')]+'\x20'+_0x4ebb41[_0xedcd('0x66')][_0x50ea42][_0xedcd('0x6a')]+(_0x305e6f(_0x4ebb41[_0xedcd('0x66')][_0x50ea42]['condition'])?'\x20'+_0x4ebb41[_0xedcd('0x66')][_0x50ea42][_0xedcd('0x6b')]:'');}return _0x4d0305+')';};var _0x2ec2db={'where':{'id':_0x5ca493['params']['id']}},_0x177bbf,_0x274de0,_0x1a11d2,_0x52a901,_0x10b757;_0x2ec2db=_[_0xedcd('0x6c')]({},_0x2ec2db,_0x5ca493[_0xedcd('0x6d')]);return db[_0xedcd('0x31')][_0xedcd('0x47')](_0x2ec2db)['then'](function(_0x4eff26){if(_0x4eff26){_0x177bbf=_0x4eff26;return _0x4eff26['getFields']();}return null;})[_0xedcd('0x27')](function(_0x58fd12){if(_0x58fd12){if(!_0x58fd12[_0xedcd('0x3b')]){throw new db[(_0xedcd('0x6e'))][(_0xedcd('0x6f'))](_0xedcd('0x70'),0x193);}_0x274de0=_0x58fd12;return db[_0xedcd('0x71')][_0xedcd('0x44')]({'raw':!![]});}return null;})[_0xedcd('0x27')](function(_0x1bff43){if(_0x1bff43){_0x1a11d2=_[_0xedcd('0x72')](_0x1bff43,'id');var _0x5de8fa;var _0x3bd228=squel[_0xedcd('0x73')]();_0x3bd228[_0xedcd('0x74')](_0x177bbf[_0xedcd('0x75')]);for(var _0xa51eca=0x0;_0xa51eca<_0x274de0[_0xedcd('0x3b')];_0xa51eca+=0x1){_0x5de8fa=_0x274de0[_0xa51eca][_0xedcd('0x76')]?_0x1a11d2[_0x274de0[_0xa51eca]['MetricId']]['metric']:_0x274de0[_0xa51eca][_0xedcd('0x69')];_0x5de8fa=_0x274de0[_0xa51eca][_0xedcd('0x77')]?_[_0xedcd('0x78')](_0x5af447[_0x274de0[_0xa51eca][_0xedcd('0x77')]],'%s',_0x5de8fa):_0x5de8fa;_0x5de8fa=_0x274de0[_0xa51eca][_0xedcd('0x79')]?_[_0xedcd('0x78')](_0x2e02c7[_0x274de0[_0xa51eca][_0xedcd('0x79')]],'%s',_0x5de8fa):_0x5de8fa;if(_0x274de0[_0xa51eca][_0xedcd('0x7a')]){_0x3bd228[_0xedcd('0x68')](_0x5de8fa);}_0x274de0[_0xa51eca][_0xedcd('0x7b')]&&_0x3bd228[_0xedcd('0x3e')](_0x5de8fa,_0x274de0[_0xa51eca][_0xedcd('0x7b')]===_0xedcd('0x7c')?![]:!![]);_0x3bd228[_0xedcd('0x69')](_0x5de8fa,_0x274de0[_0xa51eca][_0xedcd('0x7d')]||_0x5de8fa);}if(_0x177bbf[_0xedcd('0x7e')]){_0x177bbf[_0xedcd('0x7e')]=JSON[_0xedcd('0x7f')](_0x177bbf[_0xedcd('0x7e')]);for(var _0x26239b=0x0;_0x26239b<_0x177bbf[_0xedcd('0x7e')][_0xedcd('0x3b')];_0x26239b+=0x1){if(_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x33')]&&_[_0xedcd('0x61')](_0x2a3358,_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x33')])&&_0x177bbf['joins'][_0x26239b]['parentKey']&&_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x80')]&&_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x81')]){_0x3bd228[_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x33')]](_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x80')],null,util[_0xedcd('0x79')](_0xedcd('0x82'),_0x177bbf[_0xedcd('0x75')],_0x177bbf[_0xedcd('0x7e')][_0x26239b]['parentKey'],_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x80')],_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x81')]));}}}if(_0x177bbf[_0xedcd('0x83')]){_0x177bbf[_0xedcd('0x83')]=JSON[_0xedcd('0x7f')](_0x177bbf['conditions']);_0x3bd228[_0xedcd('0x40')](_0x4ee1be(_0x177bbf[_0xedcd('0x83')][_0xedcd('0x68')]));}_0x10b757=_0x3bd228['clone']();_0x3bd228[_0xedcd('0x1e')](_0x279185);_0x3bd228[_0xedcd('0x1d')](0x0);logger[_0xedcd('0x84')](_0xedcd('0x85'),_0x3bd228[_0xedcd('0x86')]());return dbH[_0xedcd('0x87')][_0xedcd('0x36')](_0x3bd228['toString'](),{'type':dbH[_0xedcd('0x87')][_0xedcd('0x88')][_0xedcd('0x89')]});}})[_0xedcd('0x27')](respondWithResult(_0x2540a3,null))['catch'](handleError(_0x2540a3,null));};function runReport(_0x124a23,_0x249b9f,_0x8963ea){var _0x14113a=_0x249b9f['name'];var _0x5f4a84=0xa;var _0x441917=[_0xedcd('0x53'),_0xedcd('0x54'),_0xedcd('0x55'),_0xedcd('0x56')];var _0x2dbdb4={'SUM':_0xedcd('0x57'),'COUNT':_0xedcd('0x58'),'COUNT DISTINCT':_0xedcd('0x59'),'MAX':_0xedcd('0x5a'),'MIN':_0xedcd('0x8a'),'AVG':_0xedcd('0x8b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xedcd('0x8c'),'GROUP_CONCAT DESC':_0xedcd('0x5b')};var _0xa0034b={'SEC_TO_TIME':_0xedcd('0x5c'),'DATE':_0xedcd('0x5d'),'HOUR':_0xedcd('0x5e'),'ROUND':_0xedcd('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3fcc70=function(_0xcf840d){return!_['includes'](['IS\x20NULL',_0xedcd('0x63'),_0xedcd('0x64'),_0xedcd('0x65')],_0xcf840d);};var _0x50dcb5=function(_0x3425db){if(!_0x3425db||!_0x3425db[_0xedcd('0x66')][_0xedcd('0x3b')]){return'';}for(var _0x5aa4f1='(',_0x3c65f6=0x0;_0x3c65f6<_0x3425db[_0xedcd('0x66')][_0xedcd('0x3b')];_0x3c65f6+=0x1){_0x3c65f6>0x0&&(_0x5aa4f1+='\x20'+_0x3425db[_0xedcd('0x67')]+'\x20');_0x5aa4f1+=_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x68')]?_0x50dcb5(_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x68')]):_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x69')]+'\x20'+_0x3425db['rules'][_0x3c65f6][_0xedcd('0x6a')]+(_0x3fcc70(_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x6a')])?'\x20'+_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x6b')]:'');}return _0x5aa4f1+')';};var _0x5ab59a={'where':{'id':_0x124a23['id']}},_0x19185c,_0x42f1af,_0x147b86,_0x457e5a,_0x20f54c;_0x5ab59a=_[_0xedcd('0x6c')]({},_0x5ab59a,_0x8963ea);return db[_0xedcd('0x31')][_0xedcd('0x47')](_0x5ab59a)['then'](function(_0x3894a8){if(_0x3894a8){_0x19185c=_0x3894a8;return _0x3894a8[_0xedcd('0x8d')]();}return null;})[_0xedcd('0x27')](function(_0x3769cf){if(_0x3769cf){if(!_0x3769cf[_0xedcd('0x3b')]){throw new db[(_0xedcd('0x6e'))]['ValidationErrorItem'](_0xedcd('0x70'),0x193);}_0x42f1af=_0x3769cf;return db[_0xedcd('0x71')][_0xedcd('0x44')]({'raw':!![]});}return null;})[_0xedcd('0x27')](function(_0x485513){if(_0x485513){_0x147b86=_['keyBy'](_0x485513,'id');var _0x53f476;var _0x6de9af=squel['select']();_0x6de9af[_0xedcd('0x74')](_0x19185c[_0xedcd('0x75')]);for(var _0x992ba3=0x0;_0x992ba3<_0x42f1af[_0xedcd('0x3b')];_0x992ba3+=0x1){_0x53f476=_0x42f1af[_0x992ba3][_0xedcd('0x76')]?_0x147b86[_0x42f1af[_0x992ba3][_0xedcd('0x76')]]['metric']:_0x42f1af[_0x992ba3][_0xedcd('0x69')];_0x53f476=_0x42f1af[_0x992ba3][_0xedcd('0x77')]?_[_0xedcd('0x78')](_0x2dbdb4[_0x42f1af[_0x992ba3][_0xedcd('0x77')]],'%s',_0x53f476):_0x53f476;_0x53f476=_0x42f1af[_0x992ba3][_0xedcd('0x79')]?_['replace'](_0xa0034b[_0x42f1af[_0x992ba3]['format']],'%s',_0x53f476):_0x53f476;if(_0x42f1af[_0x992ba3][_0xedcd('0x7a')]){_0x6de9af[_0xedcd('0x68')](_0x53f476);}_0x42f1af[_0x992ba3][_0xedcd('0x7b')]&&_0x6de9af[_0xedcd('0x3e')](_0x53f476,_0x42f1af[_0x992ba3][_0xedcd('0x7b')]==='DESC'?![]:!![]);_0x6de9af[_0xedcd('0x69')](_0x53f476,_0x42f1af[_0x992ba3]['alias']||_0x53f476);}if(_0x19185c[_0xedcd('0x7e')]){_0x19185c[_0xedcd('0x7e')]=JSON[_0xedcd('0x7f')](_0x19185c[_0xedcd('0x7e')]);for(var _0x1cecaa=0x0;_0x1cecaa<_0x19185c[_0xedcd('0x7e')][_0xedcd('0x3b')];_0x1cecaa+=0x1){if(_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x33')]&&_[_0xedcd('0x61')](_0x441917,_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x33')])&&_0x19185c[_0xedcd('0x7e')][_0x1cecaa]['parentKey']&&_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x80')]&&_0x19185c['joins'][_0x1cecaa][_0xedcd('0x81')]){_0x6de9af[_0x19185c['joins'][_0x1cecaa]['type']](_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x80')],null,util[_0xedcd('0x79')](_0xedcd('0x82'),_0x19185c[_0xedcd('0x75')],_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x8e')],_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x80')],_0x19185c['joins'][_0x1cecaa][_0xedcd('0x81')]));}}}if(_0x19185c[_0xedcd('0x83')]){_0x19185c[_0xedcd('0x83')]=JSON[_0xedcd('0x7f')](_0x19185c['conditions']);_0x6de9af['where'](_0x50dcb5(_0x19185c[_0xedcd('0x83')][_0xedcd('0x68')]));}_0x20f54c=_0x6de9af[_0xedcd('0x8f')]();_0x6de9af[_0xedcd('0x1e')](_0x5f4a84);_0x6de9af['offset'](0x0);return;}})['then'](function(){if(_0x249b9f['output']===_0xedcd('0x90')){return null;}var _0xdf23=_['merge'](_0x249b9f,{'name':_0x249b9f[_0xedcd('0x91')]||_0x249b9f[_0xedcd('0x2d')]||_0x19185c['name'],'basename':_0x14113a,'savename':util[_0xedcd('0x79')](_0xedcd('0x92'),_0x249b9f[_0xedcd('0x2d')]||_0x19185c[_0xedcd('0x2d')],require(_0xedcd('0x93'))[_0xedcd('0x94')](0x4),_0x249b9f[_0xedcd('0x95')]||'csv'),'reportId':_0x19185c['id'],'reportType':_0xedcd('0x96')});return db[_0xedcd('0x97')][_0xedcd('0x49')](_0xdf23,{'raw':!![]});})[_0xedcd('0x27')](function(_0x74ba12){if(_0x19185c[_0xedcd('0x75')]===_0xedcd('0x98')){_0x20f54c['where'](_0x19185c[_0xedcd('0x75')]+_0xedcd('0x99'),_0x249b9f[_0xedcd('0x9a')],_0x249b9f[_0xedcd('0x9b')]);}else{_0x20f54c[_0xedcd('0x40')](_0x19185c[_0xedcd('0x75')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x249b9f[_0xedcd('0x9a')],_0x249b9f[_0xedcd('0x9b')]);}if(_0x74ba12){logger[_0xedcd('0x9c')](_0xedcd('0x9d'),_0x20f54c[_0xedcd('0x86')]());require(_0xedcd('0x9e'))[_0xedcd('0x9f')](path[_0xedcd('0x53')](__dirname,'../../components/export/',_0x74ba12['output']),[_0x74ba12['id'],_0x20f54c[_0xedcd('0x86')](),path[_0xedcd('0x53')](__dirname,_0xedcd('0xa0'),_0x74ba12[_0xedcd('0xa1')]),_0x14113a]);return _0x74ba12;}else{var _0x11e3bc=squel[_0xedcd('0x73')]();_0x11e3bc[_0xedcd('0x74')]('('+_0x20f54c[_0xedcd('0x86')]()+')',_0xedcd('0xa2'));_0x11e3bc['field'](_0xedcd('0xa3'),_0xedcd('0x20'));_0x20f54c[_0xedcd('0x1e')](_0x249b9f['limit']||_0x5f4a84);_0x20f54c[_0xedcd('0x1d')](_0x249b9f[_0xedcd('0x1d')]||0x0);return dbH[_0xedcd('0x87')]['query'](_0x11e3bc['toString'](),{'type':dbH[_0xedcd('0x87')][_0xedcd('0x88')][_0xedcd('0x89')]})[_0xedcd('0x27')](function(_0x4e67ab){if(!_0x4e67ab[_0xedcd('0x3b')]){_0x457e5a=0x0;}else{_0x457e5a=_0x4e67ab[0x0]['count']||0x0;}return dbH[_0xedcd('0x87')][_0xedcd('0x36')](_0x20f54c[_0xedcd('0x86')](),{'type':dbH[_0xedcd('0x87')][_0xedcd('0x88')]['SELECT']});})[_0xedcd('0x27')](function(_0x3a9c48){return{'rows':_0x3a9c48||[],'count':_0x457e5a};});}});}exports[_0xedcd('0xa4')]=function(_0x15624b,_0x50d069){return runReport(_0x15624b['params'],_0x15624b['query'],_0x15624b['options'])[_0xedcd('0x27')](respondWithResult(_0x50d069,null))[_0xedcd('0x48')](handleError(_0x50d069,null));};exports[_0xedcd('0xa5')]=runReport;exports['query']=function(_0x272cc3,_0x482663){var _0x214efe=0xa;var _0x51a69a=['join',_0xedcd('0x54'),_0xedcd('0x55'),_0xedcd('0x56')];var _0x2ea0a2={'SUM':'SUM(%s)','COUNT':_0xedcd('0x58'),'COUNT DISTINCT':_0xedcd('0x59'),'MAX':_0xedcd('0x5a'),'MIN':_0xedcd('0x8a'),'AVG':_0xedcd('0x8b'),'GROUP_CONCAT':_0xedcd('0xa6'),'GROUP_CONCAT ASC':_0xedcd('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x8aaf73={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xedcd('0x5d'),'HOUR':_0xedcd('0x5e'),'ROUND':_0xedcd('0x5f'),'UNIX_TIMESTAMP':_0xedcd('0x60')};var _0x408f54=function(_0x150802){return!_[_0xedcd('0x61')]([_0xedcd('0x62'),'IS\x20NOT\x20NULL',_0xedcd('0x64'),_0xedcd('0x65')],_0x150802);};var _0x12355e=function(_0x1275bd){if(!_0x1275bd||!_0x1275bd[_0xedcd('0x66')][_0xedcd('0x3b')]){return'';}for(var _0x5ae020='(',_0x29a1a2=0x0;_0x29a1a2<_0x1275bd[_0xedcd('0x66')]['length'];_0x29a1a2+=0x1){_0x29a1a2>0x0&&(_0x5ae020+='\x20'+_0x1275bd[_0xedcd('0x67')]+'\x20');_0x5ae020+=_0x1275bd['rules'][_0x29a1a2][_0xedcd('0x68')]?_0x12355e(_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x68')]):_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x69')]+'\x20'+_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x6a')]+(_0x408f54(_0x1275bd[_0xedcd('0x66')][_0x29a1a2]['condition'])?'\x20'+_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x6b')]:'');}return _0x5ae020+')';};var _0x358e11={'where':{'id':_0x272cc3[_0xedcd('0x45')]['id']}},_0x139fbf,_0x4c902e,_0x7019c5,_0x18df84,_0x2cc929;_0x358e11=_[_0xedcd('0x6c')]({},_0x358e11,_0x272cc3[_0xedcd('0x6d')]);return db[_0xedcd('0x31')]['find'](_0x358e11)['then'](function(_0x4c51fd){if(_0x4c51fd){_0x139fbf=_0x4c51fd;return _0x4c51fd[_0xedcd('0x8d')]();}return null;})[_0xedcd('0x27')](function(_0xca8b18){if(_0xca8b18){if(!_0xca8b18[_0xedcd('0x3b')]){throw new db[(_0xedcd('0x6e'))][(_0xedcd('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4c902e=_0xca8b18;return db[_0xedcd('0x71')]['findAll']({'raw':!![]});}return null;})[_0xedcd('0x27')](function(_0xac03f7){if(_0xac03f7){_0x7019c5=_['keyBy'](_0xac03f7,'id');var _0x31234f;var _0x1e4301=squel[_0xedcd('0x73')]();_0x1e4301[_0xedcd('0x74')](_0x139fbf['table']);for(var _0x2662b4=0x0;_0x2662b4<_0x4c902e[_0xedcd('0x3b')];_0x2662b4+=0x1){_0x31234f=_0x4c902e[_0x2662b4][_0xedcd('0x76')]?_0x7019c5[_0x4c902e[_0x2662b4]['MetricId']]['metric']:_0x4c902e[_0x2662b4]['field'];_0x31234f=_0x4c902e[_0x2662b4][_0xedcd('0x77')]?_[_0xedcd('0x78')](_0x2ea0a2[_0x4c902e[_0x2662b4][_0xedcd('0x77')]],'%s',_0x31234f):_0x31234f;_0x31234f=_0x4c902e[_0x2662b4][_0xedcd('0x79')]?_['replace'](_0x8aaf73[_0x4c902e[_0x2662b4][_0xedcd('0x79')]],'%s',_0x31234f):_0x31234f;if(_0x4c902e[_0x2662b4][_0xedcd('0x7a')]){_0x1e4301[_0xedcd('0x68')](_0x31234f);}_0x4c902e[_0x2662b4]['orderBy']&&_0x1e4301[_0xedcd('0x3e')](_0x31234f,_0x4c902e[_0x2662b4][_0xedcd('0x7b')]==='DESC'?![]:!![]);_0x1e4301[_0xedcd('0x69')](_0x31234f,_0x4c902e[_0x2662b4][_0xedcd('0x7d')]||_0x31234f);}if(_0x139fbf[_0xedcd('0x7e')]){_0x139fbf['joins']=JSON[_0xedcd('0x7f')](_0x139fbf[_0xedcd('0x7e')]);for(var _0x210532=0x0;_0x210532<_0x139fbf[_0xedcd('0x7e')][_0xedcd('0x3b')];_0x210532+=0x1){if(_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x33')]&&_['includes'](_0x51a69a,_0x139fbf['joins'][_0x210532]['type'])&&_0x139fbf['joins'][_0x210532][_0xedcd('0x8e')]&&_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x80')]&&_0x139fbf['joins'][_0x210532]['foreignKey']){_0x1e4301[_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x33')]](_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x80')],null,util[_0xedcd('0x79')](_0xedcd('0x82'),_0x139fbf[_0xedcd('0x75')],_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x8e')],_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x80')],_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x81')]));}}}if(_0x139fbf[_0xedcd('0x83')]){_0x139fbf[_0xedcd('0x83')]=JSON[_0xedcd('0x7f')](_0x139fbf[_0xedcd('0x83')]);_0x1e4301['where'](_0x12355e(_0x139fbf['conditions'][_0xedcd('0x68')]));}_0x2cc929=_0x1e4301[_0xedcd('0x8f')]();_0x1e4301[_0xedcd('0x1e')](_0x214efe);_0x1e4301[_0xedcd('0x1d')](0x0);logger[_0xedcd('0x84')](_0xedcd('0x85'),_0x1e4301[_0xedcd('0x86')]());return dbH[_0xedcd('0x87')]['query'](_0x1e4301['toString'](),{'type':dbH[_0xedcd('0x87')]['QueryTypes']['SELECT']});}})[_0xedcd('0x27')](function(){return{'sql':_0x2cc929[_0xedcd('0x86')]()};})['then'](respondWithResult(_0x482663,null))[_0xedcd('0x48')](handleError(_0x482663,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 532d808..951019a 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 _0xc7ee=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util'];(function(_0x3e83b8,_0xc2c8de){var _0x1a6cce=function(_0x4d308a){while(--_0x4d308a){_0x3e83b8['push'](_0x3e83b8['shift']());}};_0x1a6cce(++_0xc2c8de);}(_0xc7ee,0x19e));var _0xec7e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc7ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xec7e('0x0'));var util=require(_0xec7e('0x1'));var logger=require(_0xec7e('0x2'))(_0xec7e('0x3'));var moment=require(_0xec7e('0x4'));var BPromise=require(_0xec7e('0x5'));var rp=require(_0xec7e('0x6'));var fs=require('fs');var path=require(_0xec7e('0x7'));var rimraf=require('rimraf');var config=require(_0xec7e('0x8'));var attributes=require(_0xec7e('0x9'));module[_0xec7e('0xa')]=function(_0x40bd1a,_0x4cbba6){return _0x40bd1a[_0xec7e('0xb')]('AnalyticCustomReport',attributes,{'tableName':_0xec7e('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1078=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x57a4f3,_0xa978ac){var _0x16e7d2=function(_0x214142){while(--_0x214142){_0x57a4f3['push'](_0x57a4f3['shift']());}};_0x16e7d2(++_0xa978ac);}(_0x1078,0xff));var _0x8107=function(_0x3e8b0d,_0x42a07a){_0x3e8b0d=_0x3e8b0d-0x0;var _0x82951f=_0x1078[_0x3e8b0d];return _0x82951f;};'use strict';var _=require(_0x8107('0x0'));var util=require('util');var logger=require(_0x8107('0x1'))('api');var moment=require(_0x8107('0x2'));var BPromise=require(_0x8107('0x3'));var rp=require(_0x8107('0x4'));var fs=require('fs');var path=require(_0x8107('0x5'));var rimraf=require(_0x8107('0x6'));var config=require(_0x8107('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x8107('0x8')]=function(_0x4412b2,_0x4b0392){return _0x4412b2['define'](_0x8107('0x9'),attributes,{'tableName':_0x8107('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 3fdb354..dbb2229 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 _0x0746=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x0746,0x156));var _0x6074=function(_0xa28700,_0x10200d){_0xa28700=_0xa28700-0x0;var _0x3bc9e8=_0x0746[_0xa28700];return _0x3bc9e8;};'use strict';var _=require(_0x6074('0x0'));var util=require(_0x6074('0x1'));var moment=require('moment');var BPromise=require(_0x6074('0x2'));var rs=require(_0x6074('0x3'));var fs=require('fs');var Redis=require(_0x6074('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6074('0x5'));var logger=require(_0x6074('0x6'))(_0x6074('0x7'));var config=require('../../config/environment');var jayson=require(_0x6074('0x8'));var client=jayson['client'][_0x6074('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16f4ee,_0x22cacd,_0x45cef0){return new BPromise(function(_0x1af619,_0x25c818){return client[_0x6074('0xa')](_0x16f4ee,_0x45cef0)[_0x6074('0xb')](function(_0x4cad00){logger[_0x6074('0xc')](_0x6074('0xd'),_0x22cacd,'request\x20sent');logger[_0x6074('0xe')](_0x6074('0xf'),_0x22cacd,'request\x20sent',JSON[_0x6074('0x10')](_0x4cad00));if(_0x4cad00[_0x6074('0x11')]){if(_0x4cad00[_0x6074('0x11')][_0x6074('0x12')]===0x1f4){logger[_0x6074('0x11')](_0x6074('0xd'),_0x22cacd,_0x4cad00[_0x6074('0x11')][_0x6074('0x13')]);return _0x25c818(_0x4cad00[_0x6074('0x11')][_0x6074('0x13')]);}logger['error'](_0x6074('0xd'),_0x22cacd,_0x4cad00[_0x6074('0x11')][_0x6074('0x13')]);return _0x1af619(_0x4cad00[_0x6074('0x11')][_0x6074('0x13')]);}else{logger[_0x6074('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x22cacd,'request\x20sent');_0x1af619(_0x4cad00[_0x6074('0x14')][_0x6074('0x13')]);}})[_0x6074('0x15')](function(_0x132a8b){logger[_0x6074('0x11')](_0x6074('0xd'),_0x22cacd,_0x132a8b);_0x25c818(_0x132a8b);});});} \ No newline at end of file +var _0x71a1=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x26b00e,_0x245a09){var _0x3764c3=function(_0x30fe77){while(--_0x30fe77){_0x26b00e['push'](_0x26b00e['shift']());}};_0x3764c3(++_0x245a09);}(_0x71a1,0x11c));var _0x171a=function(_0x49081c,_0x45d068){_0x49081c=_0x49081c-0x0;var _0x2da921=_0x71a1[_0x49081c];return _0x2da921;};'use strict';var _=require(_0x171a('0x0'));var util=require(_0x171a('0x1'));var moment=require(_0x171a('0x2'));var BPromise=require(_0x171a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x171a('0x4'));var db=require(_0x171a('0x5'))['db'];var utils=require(_0x171a('0x6'));var logger=require(_0x171a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x171a('0x8'));var client=jayson[_0x171a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7f8c,_0x5e8980,_0x1a4570){return new BPromise(function(_0x5dae66,_0x496d70){return client[_0x171a('0xa')](_0x2d7f8c,_0x1a4570)[_0x171a('0xb')](function(_0x20b3f6){logger[_0x171a('0xc')](_0x171a('0xd'),_0x5e8980,_0x171a('0xe'));logger[_0x171a('0xf')](_0x171a('0x10'),_0x5e8980,_0x171a('0xe'),JSON[_0x171a('0x11')](_0x20b3f6));if(_0x20b3f6[_0x171a('0x12')]){if(_0x20b3f6[_0x171a('0x12')]['code']===0x1f4){logger['error'](_0x171a('0xd'),_0x5e8980,_0x20b3f6[_0x171a('0x12')][_0x171a('0x13')]);return _0x496d70(_0x20b3f6[_0x171a('0x12')][_0x171a('0x13')]);}logger[_0x171a('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5e8980,_0x20b3f6['error'][_0x171a('0x13')]);return _0x5dae66(_0x20b3f6[_0x171a('0x12')][_0x171a('0x13')]);}else{logger['info'](_0x171a('0xd'),_0x5e8980,_0x171a('0xe'));_0x5dae66(_0x20b3f6['result'][_0x171a('0x13')]);}})[_0x171a('0x14')](function(_0x364611){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x5e8980,_0x364611);_0x496d70(_0x364611);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 041261e..e552358 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 _0x56be=['/:id/query','query','post','create','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','preview','/:id/run','run'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x56be,0x17d));var _0xe56b=function(_0x5aeb81,_0x16f01a){_0x5aeb81=_0x5aeb81-0x0;var _0x5e89e7=_0x56be[_0x5aeb81];return _0x5e89e7;};'use strict';var multer=require(_0xe56b('0x0'));var util=require(_0xe56b('0x1'));var path=require(_0xe56b('0x2'));var timeout=require('connect-timeout');var express=require(_0xe56b('0x3'));var router=express['Router']();var fs_extra=require(_0xe56b('0x4'));var auth=require(_0xe56b('0x5'));var interaction=require(_0xe56b('0x6'));var config=require(_0xe56b('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xe56b('0x8')]('/',auth['isAuthenticated'](),controller[_0xe56b('0x9')]);router[_0xe56b('0x8')](_0xe56b('0xa'),auth[_0xe56b('0xb')](),controller['show']);router[_0xe56b('0x8')]('/:id/preview',auth[_0xe56b('0xb')](),controller[_0xe56b('0xc')]);router['get'](_0xe56b('0xd'),auth['isAuthenticated'](),controller[_0xe56b('0xe')]);router[_0xe56b('0x8')](_0xe56b('0xf'),auth[_0xe56b('0xb')](),controller[_0xe56b('0x10')]);router[_0xe56b('0x11')]('/',auth[_0xe56b('0xb')](),controller[_0xe56b('0x12')]);router[_0xe56b('0x13')]('/:id',auth[_0xe56b('0xb')](),controller['update']);router[_0xe56b('0x14')]('/:id',auth[_0xe56b('0xb')](),controller['destroy']);module[_0xe56b('0x15')]=router; \ No newline at end of file +var _0x93f7=['/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','exports','path','express','Router','fs-extra','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x93f7,0x1c5));var _0x793f=function(_0x1a9aec,_0x21b537){_0x1a9aec=_0x1a9aec-0x0;var _0x375a51=_0x93f7[_0x1a9aec];return _0x375a51;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x793f('0x0'));var timeout=require('connect-timeout');var express=require(_0x793f('0x1'));var router=express[_0x793f('0x2')]();var fs_extra=require(_0x793f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x793f('0x4'));var controller=require(_0x793f('0x5'));router[_0x793f('0x6')]('/',auth[_0x793f('0x7')](),controller[_0x793f('0x8')]);router[_0x793f('0x6')](_0x793f('0x9'),auth[_0x793f('0x7')](),controller[_0x793f('0xa')]);router['get'](_0x793f('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x793f('0x6')](_0x793f('0xc'),auth[_0x793f('0x7')](),controller[_0x793f('0xd')]);router['get'](_0x793f('0xe'),auth[_0x793f('0x7')](),controller[_0x793f('0xf')]);router[_0x793f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x793f('0x11')](_0x793f('0x9'),auth[_0x793f('0x7')](),controller['update']);router[_0x793f('0x12')]('/:id',auth[_0x793f('0x7')](),controller[_0x793f('0x13')]);module[_0x793f('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 673887b..c29e8a5 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 _0x24ca=['sequelize','STRING','TEXT'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x24ca,0x1bc));var _0xa24c=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x24ca[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0xae24=['sequelize','STRING'];(function(_0x86c459,_0x426bd0){var _0xefa9ff=function(_0x168c67){while(--_0x168c67){_0x86c459['push'](_0x86c459['shift']());}};_0xefa9ff(++_0x426bd0);}(_0xae24,0x182));var _0x4ae2=function(_0xe35036,_0x529e36){_0xe35036=_0xe35036-0x0;var _0x4e47f0=_0xae24[_0xe35036];return _0x4e47f0;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e50ee32..c13472b 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x2207a2,_0x3ef379){var _0x3a7e51=function(_0x3b2e37){while(--_0x3b2e37){_0x2207a2['push'](_0x2207a2['shift']());}};_0x3a7e51(++_0x3ef379);}(_0x53ec,0x192));var _0xc53e=function(_0x55822d,_0x58b6ea){_0x55822d=_0x55822d-0x0;var _0x39eb7d=_0x53ec[_0x55822d];return _0x39eb7d;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_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\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x2869c1,_0x34d7ec){var _0x522a30=function(_0x2af3e7){while(--_0x2af3e7){_0x2869c1['push'](_0x2869c1['shift']());}};_0x522a30(++_0x34d7ec);}(_0x187d,0x93));var _0xd187=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x187d[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 95cae10..0a7bd2f 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 _0x1380=['../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3f29bc,_0x102fa1){var _0x253de9=function(_0x3ee168){while(--_0x3ee168){_0x3f29bc['push'](_0x3f29bc['shift']());}};_0x253de9(++_0x102fa1);}(_0x1380,0xe9));var _0x0138=function(_0x253d9c,_0x11705b){_0x253d9c=_0x253d9c-0x0;var _0x2f0e70=_0x1380[_0x253d9c];return _0x2f0e70;};'use strict';var _=require(_0x0138('0x0'));var util=require(_0x0138('0x1'));var logger=require('../../config/logger')(_0x0138('0x2'));var moment=require(_0x0138('0x3'));var BPromise=require(_0x0138('0x4'));var rp=require(_0x0138('0x5'));var fs=require('fs');var path=require(_0x0138('0x6'));var rimraf=require('rimraf');var config=require(_0x0138('0x7'));var attributes=require(_0x0138('0x8'));module[_0x0138('0x9')]=function(_0x4b4bad,_0x5421eb){return _0x4b4bad[_0x0138('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x0138('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe2a=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x386858,_0x26deda){var _0x104a60=function(_0x499286){while(--_0x499286){_0x386858['push'](_0x386858['shift']());}};_0x104a60(++_0x26deda);}(_0xbe2a,0x93));var _0xabe2=function(_0x5b6c71,_0x578194){_0x5b6c71=_0x5b6c71-0x0;var _0x35029b=_0xbe2a[_0x5b6c71];return _0x35029b;};'use strict';var _=require(_0xabe2('0x0'));var util=require(_0xabe2('0x1'));var logger=require(_0xabe2('0x2'))(_0xabe2('0x3'));var moment=require(_0xabe2('0x4'));var BPromise=require(_0xabe2('0x5'));var rp=require(_0xabe2('0x6'));var fs=require('fs');var path=require(_0xabe2('0x7'));var rimraf=require('rimraf');var config=require(_0xabe2('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0xabe2('0x9')]=function(_0x3edb35,_0x3f08c8){return _0x3edb35[_0xabe2('0xa')](_0xabe2('0xb'),attributes,{'tableName':_0xabe2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 819a0e6..12c8003 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 _0xe703=['util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash'];(function(_0x2a9aeb,_0x7deebe){var _0x25acaa=function(_0x196a52){while(--_0x196a52){_0x2a9aeb['push'](_0x2a9aeb['shift']());}};_0x25acaa(++_0x7deebe);}(_0xe703,0x167));var _0x3e70=function(_0xb14b26,_0x38cf9f){_0xb14b26=_0xb14b26-0x0;var _0xfdb28a=_0xe703[_0xb14b26];return _0xfdb28a;};'use strict';var _=require(_0x3e70('0x0'));var util=require(_0x3e70('0x1'));var moment=require(_0x3e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e70('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e70('0x4'));var logger=require('../../config/logger')(_0x3e70('0x5'));var config=require(_0x3e70('0x6'));var jayson=require(_0x3e70('0x7'));var client=jayson[_0x3e70('0x8')][_0x3e70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d2c6f,_0xe359f4,_0x1140a5){return new BPromise(function(_0x31fe44,_0x31d644){return client[_0x3e70('0xa')](_0x2d2c6f,_0x1140a5)[_0x3e70('0xb')](function(_0x1492f7){logger[_0x3e70('0xc')](_0x3e70('0xd'),_0xe359f4,_0x3e70('0xe'));logger[_0x3e70('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xe359f4,'request\x20sent',JSON['stringify'](_0x1492f7));if(_0x1492f7[_0x3e70('0x10')]){if(_0x1492f7[_0x3e70('0x10')]['code']===0x1f4){logger[_0x3e70('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xe359f4,_0x1492f7[_0x3e70('0x10')]['message']);return _0x31d644(_0x1492f7[_0x3e70('0x10')]['message']);}logger['error'](_0x3e70('0xd'),_0xe359f4,_0x1492f7[_0x3e70('0x10')]['message']);return _0x31fe44(_0x1492f7[_0x3e70('0x10')][_0x3e70('0x11')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0xe359f4,_0x3e70('0xe'));_0x31fe44(_0x1492f7[_0x3e70('0x12')]['message']);}})[_0x3e70('0x13')](function(_0x523b7e){logger[_0x3e70('0x10')](_0x3e70('0xd'),_0xe359f4,_0x523b7e);_0x31d644(_0x523b7e);});});} \ No newline at end of file +var _0xf25b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util'];(function(_0x34793f,_0x59a6af){var _0x3a7e23=function(_0x29de0f){while(--_0x29de0f){_0x34793f['push'](_0x34793f['shift']());}};_0x3a7e23(++_0x59a6af);}(_0xf25b,0xc4));var _0xbf25=function(_0x450b29,_0x187d77){_0x450b29=_0x450b29-0x0;var _0x28df4f=_0xf25b[_0x450b29];return _0x28df4f;};'use strict';var _=require(_0xbf25('0x0'));var util=require(_0xbf25('0x1'));var moment=require('moment');var BPromise=require(_0xbf25('0x2'));var rs=require(_0xbf25('0x3'));var fs=require('fs');var Redis=require(_0xbf25('0x4'));var db=require(_0xbf25('0x5'))['db'];var utils=require(_0xbf25('0x6'));var logger=require('../../config/logger')(_0xbf25('0x7'));var config=require(_0xbf25('0x8'));var jayson=require(_0xbf25('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x140857,_0x30c468,_0x31f78e){return new BPromise(function(_0x5e6fd2,_0x783b18){return client[_0xbf25('0xa')](_0x140857,_0x31f78e)[_0xbf25('0xb')](function(_0x145ff2){logger[_0xbf25('0xc')](_0xbf25('0xd'),_0x30c468,_0xbf25('0xe'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x30c468,_0xbf25('0xe'),JSON['stringify'](_0x145ff2));if(_0x145ff2[_0xbf25('0xf')]){if(_0x145ff2['error'][_0xbf25('0x10')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x30c468,_0x145ff2['error'][_0xbf25('0x11')]);return _0x783b18(_0x145ff2['error']['message']);}logger[_0xbf25('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x30c468,_0x145ff2[_0xbf25('0xf')]['message']);return _0x5e6fd2(_0x145ff2[_0xbf25('0xf')][_0xbf25('0x11')]);}else{logger[_0xbf25('0xc')](_0xbf25('0xd'),_0x30c468,_0xbf25('0xe'));_0x5e6fd2(_0x145ff2['result'][_0xbf25('0x11')]);}})['catch'](function(_0x4cdd99){logger[_0xbf25('0xf')](_0xbf25('0xd'),_0x30c468,_0x4cdd99);_0x783b18(_0x4cdd99);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b0b9bee..cd1ca94 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 _0x9dbf=['run','/:id/query','query','post','create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dbf,0x1ab));var _0xf9db=function(_0x5d58e8,_0x1575da){_0x5d58e8=_0x5d58e8-0x0;var _0x5ca75e=_0x9dbf[_0x5d58e8];return _0x5ca75e;};'use strict';var multer=require('multer');var util=require(_0xf9db('0x0'));var path=require(_0xf9db('0x1'));var timeout=require(_0xf9db('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf9db('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf9db('0x4'));var config=require(_0xf9db('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xf9db('0x6')]('/',auth[_0xf9db('0x7')](),controller[_0xf9db('0x8')]);router[_0xf9db('0x6')](_0xf9db('0x9'),auth[_0xf9db('0x7')](),controller[_0xf9db('0xa')]);router[_0xf9db('0x6')](_0xf9db('0xb'),auth[_0xf9db('0x7')](),controller['preview']);router[_0xf9db('0x6')](_0xf9db('0xc'),auth['isAuthenticated'](),controller[_0xf9db('0xd')]);router['get'](_0xf9db('0xe'),auth['isAuthenticated'](),controller[_0xf9db('0xf')]);router[_0xf9db('0x10')]('/',auth[_0xf9db('0x7')](),controller[_0xf9db('0x11')]);router[_0xf9db('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf9db('0x13')](_0xf9db('0x9'),auth[_0xf9db('0x7')](),controller[_0xf9db('0x14')]);module[_0xf9db('0x15')]=router; \ No newline at end of file +var _0x5295=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','preview','run','/:id/query','query','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x5295,0x6c));var _0x5529=function(_0x23b93f,_0xbd249c){_0x23b93f=_0x23b93f-0x0;var _0x5794bc=_0x5295[_0x23b93f];return _0x5794bc;};'use strict';var multer=require(_0x5529('0x0'));var util=require(_0x5529('0x1'));var path=require(_0x5529('0x2'));var timeout=require(_0x5529('0x3'));var express=require(_0x5529('0x4'));var router=express[_0x5529('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5529('0x6'));var interaction=require(_0x5529('0x7'));var config=require(_0x5529('0x8'));var controller=require(_0x5529('0x9'));router[_0x5529('0xa')]('/',auth[_0x5529('0xb')](),controller['index']);router[_0x5529('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5529('0xa')]('/:id/preview',auth['isAuthenticated'](),controller[_0x5529('0xc')]);router[_0x5529('0xa')]('/:id/run',auth[_0x5529('0xb')](),controller[_0x5529('0xd')]);router[_0x5529('0xa')](_0x5529('0xe'),auth[_0x5529('0xb')](),controller[_0x5529('0xf')]);router[_0x5529('0x10')]('/',auth['isAuthenticated'](),controller[_0x5529('0x11')]);router[_0x5529('0x12')](_0x5529('0x13'),auth[_0x5529('0xb')](),controller[_0x5529('0x14')]);router[_0x5529('0x15')](_0x5529('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x5529('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2d0abe2..cb929d7 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 _0x1930=['moment','ENUM','csv','pdf','xlsx','STRING','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1930,0xcf));var _0x0193=function(_0x384d56,_0x42698f){_0x384d56=_0x384d56-0x0;var _0x29b118=_0x1930[_0x384d56];return _0x29b118;};'use strict';var Sequelize=require(_0x0193('0x0'));var moment=require(_0x0193('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x0193('0x2')](_0x0193('0x3'),_0x0193('0x4'),_0x0193('0x5')),'allowNull':![],'defaultValue':_0x0193('0x3')},'savename':{'type':Sequelize[_0x0193('0x6')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0193('0x7')]},'endDate':{'type':Sequelize[_0x0193('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x0193('0x8')},'type':{'type':Sequelize['ENUM'](_0x0193('0x9'),_0x0193('0xa')),'allowNull':![],'defaultValue':_0x0193('0x9')},'reportId':{'type':Sequelize[_0x0193('0xb')](0xb)[_0x0193('0xc')]},'reportType':{'type':Sequelize[_0x0193('0x6')]}}; \ No newline at end of file +var _0xcb2f=['manual','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x4b3b5f,_0x2b3d54){var _0xfb1baf=function(_0x6ba288){while(--_0x6ba288){_0x4b3b5f['push'](_0x4b3b5f['shift']());}};_0xfb1baf(++_0x2b3d54);}(_0xcb2f,0x10f));var _0xfcb2=function(_0x34c00e,_0x4873a9){_0x34c00e=_0x34c00e-0x0;var _0x1e9548=_0xcb2f[_0x34c00e];return _0x1e9548;};'use strict';var Sequelize=require(_0xfcb2('0x0'));var moment=require('moment');module[_0xfcb2('0x1')]={'name':{'type':Sequelize[_0xfcb2('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xfcb2('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xfcb2('0x3')](_0xfcb2('0x4'),_0xfcb2('0x5'),_0xfcb2('0x6')),'allowNull':![],'defaultValue':_0xfcb2('0x4')},'savename':{'type':Sequelize[_0xfcb2('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xfcb2('0x7')]},'endDate':{'type':Sequelize[_0xfcb2('0x7')]},'status':{'type':Sequelize[_0xfcb2('0x2')],'defaultValue':_0xfcb2('0x8')},'type':{'type':Sequelize[_0xfcb2('0x3')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xfcb2('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xfcb2('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5b37819..5cecfdc 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 _0xa28a=['fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','basename','savename','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','join','root','format','%s.%s','toLowerCase','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0xa28a,0xf1));var _0xaa28=function(_0x55fd31,_0x2e7d09){_0x55fd31=_0x55fd31-0x0;var _0x1a16ed=_0xa28a[_0x55fd31];return _0x1a16ed;};'use strict';var emlformat=require(_0xaa28('0x0'));var rimraf=require(_0xaa28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaa28('0x2'));var moment=require(_0xaa28('0x3'));var BPromise=require(_0xaa28('0x4'));var Mustache=require(_0xaa28('0x5'));var util=require(_0xaa28('0x6'));var path=require(_0xaa28('0x7'));var sox=require(_0xaa28('0x8'));var csv=require(_0xaa28('0x9'));var ejs=require(_0xaa28('0xa'));var fs=require('fs');var fs_extra=require(_0xaa28('0xb'));var _=require('lodash');var squel=require(_0xaa28('0xc'));var crypto=require(_0xaa28('0xd'));var jsforce=require(_0xaa28('0xe'));var deskjs=require(_0xaa28('0xf'));var toCsv=require(_0xaa28('0x9'));var querystring=require(_0xaa28('0x10'));var Papa=require(_0xaa28('0x11'));var Redis=require(_0xaa28('0x12'));var authService=require(_0xaa28('0x13'));var qs=require(_0xaa28('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa28('0x15'));var logger=require(_0xaa28('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa28('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a81f1,_0x4e356f){_0x4e356f=_0x4e356f||0xcc;return function(_0x2f14ac){if(_0x2f14ac){return _0x3a81f1[_0xaa28('0x18')](_0x4e356f);}return _0x3a81f1[_0xaa28('0x19')](_0x4e356f)[_0xaa28('0x1a')]();};}function respondWithResult(_0xef51e2,_0x1b7bb6){_0x1b7bb6=_0x1b7bb6||0xc8;return function(_0x2af5e6){if(_0x2af5e6){return _0xef51e2[_0xaa28('0x19')](_0x1b7bb6)[_0xaa28('0x1b')](_0x2af5e6);}};}function respondWithFilteredResult(_0x3ada81,_0x307d0e){return function(_0x2b3a9b){if(_0x2b3a9b){var _0x3730b0=typeof _0x307d0e['offset']===_0xaa28('0x1c')&&typeof _0x307d0e[_0xaa28('0x1d')]===_0xaa28('0x1c');var _0x514e1e=_0x2b3a9b[_0xaa28('0x1e')];var _0x5c13b9=_0x3730b0?0x0:_0x307d0e[_0xaa28('0x1f')];var _0x3a4626=_0x3730b0?_0x2b3a9b[_0xaa28('0x1e')]:_0x307d0e[_0xaa28('0x1f')]+_0x307d0e[_0xaa28('0x1d')];var _0x3a0063;if(_0x3a4626>=_0x514e1e){_0x3a4626=_0x514e1e;_0x3a0063=0xc8;}else{_0x3a0063=0xce;}_0x3ada81[_0xaa28('0x19')](_0x3a0063);return _0x3ada81[_0xaa28('0x20')](_0xaa28('0x21'),_0x5c13b9+'-'+_0x3a4626+'/'+_0x514e1e)['json'](_0x2b3a9b);}return null;};}function patchUpdates(_0x2faa10){return function(_0x4ae8a2){try{jsonpatch['apply'](_0x4ae8a2,_0x2faa10,!![]);}catch(_0xba2cae){return BPromise[_0xaa28('0x22')](_0xba2cae);}return _0x4ae8a2[_0xaa28('0x23')]();};}function saveUpdates(_0x14e127,_0x4bf30e){return function(_0x29c0ad){if(_0x29c0ad){return _0x29c0ad['update'](_0x14e127)[_0xaa28('0x24')](function(_0x1bc0de){return _0x1bc0de;});}return null;};}function removeEntity(_0x34f1b3,_0x8b7347){return function(_0x362763){if(_0x362763){return _0x362763[_0xaa28('0x25')]()[_0xaa28('0x24')](function(){var _0x7d27e9=_0x362763['get']({'plain':!![]});var _0x14a539=_0xaa28('0x26');return db[_0xaa28('0x27')][_0xaa28('0x25')]({'where':{'type':_0x14a539,'resourceId':_0x7d27e9['id']}})[_0xaa28('0x24')](function(){return _0x362763;});})[_0xaa28('0x24')](function(){_0x34f1b3[_0xaa28('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f15a,_0x5f1fdd){return function(_0x4e336b){if(!_0x4e336b){_0x26f15a['sendStatus'](0x194);}return _0x4e336b;};}function handleError(_0x3f7e01,_0x53c7ec){_0x53c7ec=_0x53c7ec||0x1f4;return function(_0x22b1eb){logger[_0xaa28('0x28')](_0x22b1eb[_0xaa28('0x29')]);if(_0x22b1eb[_0xaa28('0x2a')]){delete _0x22b1eb['name'];}_0x3f7e01[_0xaa28('0x19')](_0x53c7ec)[_0xaa28('0x2b')](_0x22b1eb);};}exports['index']=function(_0xfa55d1,_0xd10b7e){var _0x502be2={},_0x351270={},_0x198a30={'count':0x0,'rows':[]};var _0x359594=_[_0xaa28('0x2c')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x2309bf){return{'name':_0x2309bf[_0xaa28('0x2d')],'type':_0x2309bf[_0xaa28('0x2e')][_0xaa28('0x2f')]};});_0x351270[_0xaa28('0x30')]=_[_0xaa28('0x2c')](_0x359594,_0xaa28('0x2a'));_0x351270[_0xaa28('0x31')]=_[_0xaa28('0x32')](_0xfa55d1[_0xaa28('0x31')]);_0x351270['filters']=_[_0xaa28('0x33')](_0x351270[_0xaa28('0x30')],_0x351270['query']);_0x502be2[_0xaa28('0x34')]=_[_0xaa28('0x33')](_0x351270[_0xaa28('0x30')],qs[_0xaa28('0x35')](_0xfa55d1[_0xaa28('0x31')][_0xaa28('0x35')]));_0x502be2[_0xaa28('0x34')]=_0x502be2['attributes'][_0xaa28('0x36')]?_0x502be2[_0xaa28('0x34')]:_0x351270[_0xaa28('0x30')];if(!_0xfa55d1[_0xaa28('0x31')][_0xaa28('0x37')](_0xaa28('0x38'))){_0x502be2[_0xaa28('0x1d')]=qs[_0xaa28('0x1d')](_0xfa55d1[_0xaa28('0x31')][_0xaa28('0x1d')]);_0x502be2[_0xaa28('0x1f')]=qs[_0xaa28('0x1f')](_0xfa55d1[_0xaa28('0x31')][_0xaa28('0x1f')]);}_0x502be2[_0xaa28('0x39')]=qs[_0xaa28('0x3a')](_0xfa55d1[_0xaa28('0x31')]['sort']);_0x502be2['where']=qs[_0xaa28('0x3b')](_[_0xaa28('0x3c')](_0xfa55d1[_0xaa28('0x31')],_0x351270[_0xaa28('0x3b')]),_0x359594);if(_0xfa55d1[_0xaa28('0x31')]['filter']){_0x502be2[_0xaa28('0x3d')]=_[_0xaa28('0x3e')](_0x502be2[_0xaa28('0x3d')],{'$or':_[_0xaa28('0x2c')](_0x359594,function(_0x231426){if(_0x231426[_0xaa28('0x2e')]!==_0xaa28('0x3f')){var _0x2298e6={};_0x2298e6[_0x231426['name']]={'$like':'%'+_0xfa55d1[_0xaa28('0x31')][_0xaa28('0x40')]+'%'};return _0x2298e6;}})});}_0x502be2=_[_0xaa28('0x3e')]({},_0x502be2,_0xfa55d1[_0xaa28('0x41')]);var _0x1e95cd={'where':_0x502be2['where']};return db[_0xaa28('0x42')][_0xaa28('0x1e')](_0x1e95cd)[_0xaa28('0x24')](function(_0x43d6a1){_0x198a30[_0xaa28('0x1e')]=_0x43d6a1;if(_0xfa55d1[_0xaa28('0x31')][_0xaa28('0x43')]){_0x502be2[_0xaa28('0x44')]=[{'all':!![]}];}return db[_0xaa28('0x42')][_0xaa28('0x45')](_0x502be2);})[_0xaa28('0x24')](function(_0x233236){_0x198a30[_0xaa28('0x46')]=_0x233236;return _0x198a30;})[_0xaa28('0x24')](respondWithFilteredResult(_0xd10b7e,_0x502be2))['catch'](handleError(_0xd10b7e,null));};exports['show']=function(_0x3bc549,_0x4003d4){var _0xebe5dc={'raw':!![],'where':{'id':_0x3bc549[_0xaa28('0x47')]['id']}},_0x240b10={};_0x240b10[_0xaa28('0x30')]=_['keys'](db[_0xaa28('0x42')][_0xaa28('0x48')]);_0x240b10[_0xaa28('0x31')]=_[_0xaa28('0x32')](_0x3bc549['query']);_0x240b10[_0xaa28('0x3b')]=_[_0xaa28('0x33')](_0x240b10[_0xaa28('0x30')],_0x240b10[_0xaa28('0x31')]);_0xebe5dc[_0xaa28('0x34')]=_['intersection'](_0x240b10[_0xaa28('0x30')],qs[_0xaa28('0x35')](_0x3bc549[_0xaa28('0x31')]['fields']));_0xebe5dc[_0xaa28('0x34')]=_0xebe5dc[_0xaa28('0x34')][_0xaa28('0x36')]?_0xebe5dc['attributes']:_0x240b10[_0xaa28('0x30')];if(_0x3bc549[_0xaa28('0x31')]['includeAll']){_0xebe5dc[_0xaa28('0x44')]=[{'all':!![]}];}_0xebe5dc=_['merge']({},_0xebe5dc,_0x3bc549['options']);return db[_0xaa28('0x42')][_0xaa28('0x49')](_0xebe5dc)[_0xaa28('0x24')](handleEntityNotFound(_0x4003d4,null))[_0xaa28('0x24')](respondWithResult(_0x4003d4,null))[_0xaa28('0x4a')](handleError(_0x4003d4,null));};exports['create']=function(_0x405f25,_0x447a39){return db[_0xaa28('0x42')][_0xaa28('0x4b')](_0x405f25['body'],{})[_0xaa28('0x24')](function(_0x187014){var _0x51d819=_0x405f25[_0xaa28('0x4c')][_0xaa28('0x4d')]({'plain':!![]});if(!_0x51d819)throw new Error(_0xaa28('0x4e'));if(_0x51d819[_0xaa28('0x4f')]==='user'){var _0x25fcc2=_0x187014['get']({'plain':!![]});var _0x6f7e35=_0xaa28('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x6f7e35,'userProfileId':_0x51d819[_0xaa28('0x50')]},'raw':!![]})['then'](function(_0x3310d6){if(_0x3310d6&&_0x3310d6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x25fcc2['name'],'resourceId':_0x25fcc2['id'],'type':_0x3310d6['name'],'sectionId':_0x3310d6['id']},{})[_0xaa28('0x24')](function(){return _0x187014;});}else{return _0x187014;}})['catch'](function(_0x374ee4){logger[_0xaa28('0x28')](_0xaa28('0x51'),_0x374ee4);throw _0x374ee4;});}return _0x187014;})[_0xaa28('0x24')](respondWithResult(_0x447a39,0xc9))[_0xaa28('0x4a')](handleError(_0x447a39,null));};exports[_0xaa28('0x52')]=function(_0x469b0a,_0x35cb5f){if(_0x469b0a['body']['id']){delete _0x469b0a[_0xaa28('0x53')]['id'];}return db['AnalyticExtractedReport'][_0xaa28('0x49')]({'where':{'id':_0x469b0a[_0xaa28('0x47')]['id']}})[_0xaa28('0x24')](handleEntityNotFound(_0x35cb5f,null))[_0xaa28('0x24')](saveUpdates(_0x469b0a[_0xaa28('0x53')],null))[_0xaa28('0x24')](respondWithResult(_0x35cb5f,null))[_0xaa28('0x4a')](handleError(_0x35cb5f,null));};exports[_0xaa28('0x25')]=function(_0x4e12bd,_0x155d00){return db['AnalyticExtractedReport'][_0xaa28('0x49')]({'where':{'id':_0x4e12bd[_0xaa28('0x47')]['id']}})[_0xaa28('0x24')](handleEntityNotFound(_0x155d00,null))[_0xaa28('0x24')](removeEntity(_0x155d00,null))[_0xaa28('0x4a')](handleError(_0x155d00,null));};exports['download']=function(_0x54f942,_0x3d8b27,_0x41e290){return db[_0xaa28('0x42')][_0xaa28('0x49')]({'where':{'id':_0x54f942['params']['id']},'attributes':[_0xaa28('0x2a'),_0xaa28('0x54'),_0xaa28('0x55'),'output'],'raw':!![]})[_0xaa28('0x24')](handleEntityNotFound(_0x3d8b27,null))['then'](function(_0x33709d){if(_0x33709d){if(!fs[_0xaa28('0x56')](path['join'](config['root'],_0xaa28('0x57'),_0x33709d[_0xaa28('0x55')]))){throw new db[(_0xaa28('0x58'))][(_0xaa28('0x59'))](_0xaa28('0x5a'));}if(_0x54f942['query'][_0xaa28('0x5b')]){return _0x3d8b27[_0xaa28('0x18')](0xc8);}return _0x3d8b27[_0xaa28('0x5c')](path[_0xaa28('0x5d')](config[_0xaa28('0x5e')],_0xaa28('0x57'),_0x33709d[_0xaa28('0x55')]),util[_0xaa28('0x5f')](_0xaa28('0x60'),_0x33709d[_0xaa28('0x54')]||_0x33709d['name'],_0x33709d['output'][_0xaa28('0x61')]()));}})['catch'](handleError(_0x3d8b27,null));}; \ No newline at end of file +var _0x2f28=['merge','AnalyticExtractedReport','includeAll','include','findAll','catch','show','params','fields','options','find','create','body','role','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','existsSync','join','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','format','%s.%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','get','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','sort','where','filter'];(function(_0x5c585c,_0x284a29){var _0x14ea80=function(_0xe7bbec){while(--_0xe7bbec){_0x5c585c['push'](_0x5c585c['shift']());}};_0x14ea80(++_0x284a29);}(_0x2f28,0x192));var _0x82f2=function(_0x1d38be,_0x5a9cc6){_0x1d38be=_0x1d38be-0x0;var _0x254ab4=_0x2f28[_0x1d38be];return _0x254ab4;};'use strict';var emlformat=require(_0x82f2('0x0'));var rimraf=require(_0x82f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82f2('0x2'));var rp=require('request-promise');var moment=require(_0x82f2('0x3'));var BPromise=require(_0x82f2('0x4'));var Mustache=require(_0x82f2('0x5'));var util=require('util');var path=require(_0x82f2('0x6'));var sox=require(_0x82f2('0x7'));var csv=require(_0x82f2('0x8'));var ejs=require(_0x82f2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82f2('0xa'));var squel=require(_0x82f2('0xb'));var crypto=require(_0x82f2('0xc'));var jsforce=require(_0x82f2('0xd'));var deskjs=require(_0x82f2('0xe'));var toCsv=require(_0x82f2('0x8'));var querystring=require(_0x82f2('0xf'));var Papa=require(_0x82f2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82f2('0x11'));var logger=require(_0x82f2('0x12'))(_0x82f2('0x13'));var utils=require(_0x82f2('0x14'));var config=require(_0x82f2('0x15'));var licenseUtil=require(_0x82f2('0x16'));var db=require(_0x82f2('0x17'))['db'];function respondWithStatusCode(_0x1ef00d,_0x4ff9ec){_0x4ff9ec=_0x4ff9ec||0xcc;return function(_0x463823){if(_0x463823){return _0x1ef00d[_0x82f2('0x18')](_0x4ff9ec);}return _0x1ef00d[_0x82f2('0x19')](_0x4ff9ec)[_0x82f2('0x1a')]();};}function respondWithResult(_0x494809,_0x17ca12){_0x17ca12=_0x17ca12||0xc8;return function(_0x1af885){if(_0x1af885){return _0x494809['status'](_0x17ca12)[_0x82f2('0x1b')](_0x1af885);}};}function respondWithFilteredResult(_0x399ead,_0x10a07d){return function(_0x17c434){if(_0x17c434){var _0x5ed86f=typeof _0x10a07d[_0x82f2('0x1c')]==='undefined'&&typeof _0x10a07d[_0x82f2('0x1d')]==='undefined';var _0x4d7980=_0x17c434[_0x82f2('0x1e')];var _0x38946a=_0x5ed86f?0x0:_0x10a07d[_0x82f2('0x1c')];var _0x4da754=_0x5ed86f?_0x17c434[_0x82f2('0x1e')]:_0x10a07d[_0x82f2('0x1c')]+_0x10a07d[_0x82f2('0x1d')];var _0x222958;if(_0x4da754>=_0x4d7980){_0x4da754=_0x4d7980;_0x222958=0xc8;}else{_0x222958=0xce;}_0x399ead[_0x82f2('0x19')](_0x222958);return _0x399ead[_0x82f2('0x1f')]('Content-Range',_0x38946a+'-'+_0x4da754+'/'+_0x4d7980)['json'](_0x17c434);}return null;};}function patchUpdates(_0x549134){return function(_0x23a1fa){try{jsonpatch[_0x82f2('0x20')](_0x23a1fa,_0x549134,!![]);}catch(_0x54c84e){return BPromise[_0x82f2('0x21')](_0x54c84e);}return _0x23a1fa[_0x82f2('0x22')]();};}function saveUpdates(_0x120834,_0x1fba22){return function(_0x1b396b){if(_0x1b396b){return _0x1b396b[_0x82f2('0x23')](_0x120834)[_0x82f2('0x24')](function(_0x2b08b3){return _0x2b08b3;});}return null;};}function removeEntity(_0x4a0f4d,_0x56c5dd){return function(_0x364067){if(_0x364067){return _0x364067[_0x82f2('0x25')]()[_0x82f2('0x24')](function(){var _0x123620=_0x364067[_0x82f2('0x26')]({'plain':!![]});var _0x4b61cf='ExtractedReports';return db['UserProfileResource'][_0x82f2('0x25')]({'where':{'type':_0x4b61cf,'resourceId':_0x123620['id']}})[_0x82f2('0x24')](function(){return _0x364067;});})[_0x82f2('0x24')](function(){_0x4a0f4d['status'](0xcc)[_0x82f2('0x1a')]();});}};}function handleEntityNotFound(_0x215d9e,_0xc53486){return function(_0x4cf013){if(!_0x4cf013){_0x215d9e['sendStatus'](0x194);}return _0x4cf013;};}function handleError(_0x40c8b3,_0x3ec7f9){_0x3ec7f9=_0x3ec7f9||0x1f4;return function(_0x43a5e4){logger[_0x82f2('0x27')](_0x43a5e4[_0x82f2('0x28')]);if(_0x43a5e4[_0x82f2('0x29')]){delete _0x43a5e4['name'];}_0x40c8b3[_0x82f2('0x19')](_0x3ec7f9)[_0x82f2('0x2a')](_0x43a5e4);};}exports['index']=function(_0x5a0720,_0x1d8917){var _0x51a381={},_0x1b475f={},_0x27d7fe={'count':0x0,'rows':[]};var _0xf89ae4=_[_0x82f2('0x2b')](db['AnalyticExtractedReport'][_0x82f2('0x2c')],function(_0x4b9ebd){return{'name':_0x4b9ebd[_0x82f2('0x2d')],'type':_0x4b9ebd[_0x82f2('0x2e')][_0x82f2('0x2f')]};});_0x1b475f[_0x82f2('0x30')]=_['map'](_0xf89ae4,'name');_0x1b475f[_0x82f2('0x31')]=_[_0x82f2('0x32')](_0x5a0720[_0x82f2('0x31')]);_0x1b475f[_0x82f2('0x33')]=_[_0x82f2('0x34')](_0x1b475f[_0x82f2('0x30')],_0x1b475f['query']);_0x51a381[_0x82f2('0x35')]=_['intersection'](_0x1b475f[_0x82f2('0x30')],qs['fields'](_0x5a0720[_0x82f2('0x31')]['fields']));_0x51a381[_0x82f2('0x35')]=_0x51a381[_0x82f2('0x35')][_0x82f2('0x36')]?_0x51a381[_0x82f2('0x35')]:_0x1b475f[_0x82f2('0x30')];if(!_0x5a0720['query']['hasOwnProperty']('nolimit')){_0x51a381[_0x82f2('0x1d')]=qs[_0x82f2('0x1d')](_0x5a0720['query'][_0x82f2('0x1d')]);_0x51a381[_0x82f2('0x1c')]=qs[_0x82f2('0x1c')](_0x5a0720[_0x82f2('0x31')][_0x82f2('0x1c')]);}_0x51a381['order']=qs[_0x82f2('0x37')](_0x5a0720[_0x82f2('0x31')][_0x82f2('0x37')]);_0x51a381[_0x82f2('0x38')]=qs['filters'](_['pick'](_0x5a0720[_0x82f2('0x31')],_0x1b475f[_0x82f2('0x33')]),_0xf89ae4);if(_0x5a0720[_0x82f2('0x31')][_0x82f2('0x39')]){_0x51a381['where']=_[_0x82f2('0x3a')](_0x51a381[_0x82f2('0x38')],{'$or':_[_0x82f2('0x2b')](_0xf89ae4,function(_0xef74e2){if(_0xef74e2[_0x82f2('0x2e')]!=='VIRTUAL'){var _0x6fae50={};_0x6fae50[_0xef74e2[_0x82f2('0x29')]]={'$like':'%'+_0x5a0720[_0x82f2('0x31')][_0x82f2('0x39')]+'%'};return _0x6fae50;}})});}_0x51a381=_[_0x82f2('0x3a')]({},_0x51a381,_0x5a0720['options']);var _0x51e77e={'where':_0x51a381['where']};return db[_0x82f2('0x3b')][_0x82f2('0x1e')](_0x51e77e)['then'](function(_0x1eda7b){_0x27d7fe[_0x82f2('0x1e')]=_0x1eda7b;if(_0x5a0720['query'][_0x82f2('0x3c')]){_0x51a381[_0x82f2('0x3d')]=[{'all':!![]}];}return db[_0x82f2('0x3b')][_0x82f2('0x3e')](_0x51a381);})[_0x82f2('0x24')](function(_0x2a765){_0x27d7fe['rows']=_0x2a765;return _0x27d7fe;})[_0x82f2('0x24')](respondWithFilteredResult(_0x1d8917,_0x51a381))[_0x82f2('0x3f')](handleError(_0x1d8917,null));};exports[_0x82f2('0x40')]=function(_0x2c076a,_0x57f035){var _0x2fb4b9={'raw':!![],'where':{'id':_0x2c076a[_0x82f2('0x41')]['id']}},_0x56dd6f={};_0x56dd6f['model']=_['keys'](db[_0x82f2('0x3b')]['rawAttributes']);_0x56dd6f[_0x82f2('0x31')]=_['keys'](_0x2c076a[_0x82f2('0x31')]);_0x56dd6f['filters']=_[_0x82f2('0x34')](_0x56dd6f['model'],_0x56dd6f[_0x82f2('0x31')]);_0x2fb4b9[_0x82f2('0x35')]=_[_0x82f2('0x34')](_0x56dd6f[_0x82f2('0x30')],qs['fields'](_0x2c076a[_0x82f2('0x31')][_0x82f2('0x42')]));_0x2fb4b9[_0x82f2('0x35')]=_0x2fb4b9[_0x82f2('0x35')]['length']?_0x2fb4b9[_0x82f2('0x35')]:_0x56dd6f[_0x82f2('0x30')];if(_0x2c076a[_0x82f2('0x31')][_0x82f2('0x3c')]){_0x2fb4b9['include']=[{'all':!![]}];}_0x2fb4b9=_['merge']({},_0x2fb4b9,_0x2c076a[_0x82f2('0x43')]);return db['AnalyticExtractedReport'][_0x82f2('0x44')](_0x2fb4b9)[_0x82f2('0x24')](handleEntityNotFound(_0x57f035,null))[_0x82f2('0x24')](respondWithResult(_0x57f035,null))[_0x82f2('0x3f')](handleError(_0x57f035,null));};exports[_0x82f2('0x45')]=function(_0x53cec8,_0xc0daf9){return db[_0x82f2('0x3b')][_0x82f2('0x45')](_0x53cec8[_0x82f2('0x46')],{})['then'](function(_0x5739d9){var _0x313222=_0x53cec8['user'][_0x82f2('0x26')]({'plain':!![]});if(!_0x313222)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x313222[_0x82f2('0x47')]===_0x82f2('0x48')){var _0x100a60=_0x5739d9[_0x82f2('0x26')]({'plain':!![]});var _0xb9dbb4=_0x82f2('0x49');return db[_0x82f2('0x4a')][_0x82f2('0x44')]({'where':{'name':_0xb9dbb4,'userProfileId':_0x313222[_0x82f2('0x4b')]},'raw':!![]})[_0x82f2('0x24')](function(_0x495bcf){if(_0x495bcf&&_0x495bcf[_0x82f2('0x4c')]===0x0){return db[_0x82f2('0x4d')][_0x82f2('0x45')]({'name':_0x100a60[_0x82f2('0x29')],'resourceId':_0x100a60['id'],'type':_0x495bcf[_0x82f2('0x29')],'sectionId':_0x495bcf['id']},{})[_0x82f2('0x24')](function(){return _0x5739d9;});}else{return _0x5739d9;}})[_0x82f2('0x3f')](function(_0x344c97){logger[_0x82f2('0x27')](_0x82f2('0x4e'),_0x344c97);throw _0x344c97;});}return _0x5739d9;})['then'](respondWithResult(_0xc0daf9,0xc9))[_0x82f2('0x3f')](handleError(_0xc0daf9,null));};exports[_0x82f2('0x23')]=function(_0x3d656a,_0x5ccf2c){if(_0x3d656a[_0x82f2('0x46')]['id']){delete _0x3d656a['body']['id'];}return db[_0x82f2('0x3b')][_0x82f2('0x44')]({'where':{'id':_0x3d656a[_0x82f2('0x41')]['id']}})[_0x82f2('0x24')](handleEntityNotFound(_0x5ccf2c,null))[_0x82f2('0x24')](saveUpdates(_0x3d656a[_0x82f2('0x46')],null))[_0x82f2('0x24')](respondWithResult(_0x5ccf2c,null))[_0x82f2('0x3f')](handleError(_0x5ccf2c,null));};exports[_0x82f2('0x25')]=function(_0x4cc342,_0x1f6572){return db[_0x82f2('0x3b')][_0x82f2('0x44')]({'where':{'id':_0x4cc342['params']['id']}})[_0x82f2('0x24')](handleEntityNotFound(_0x1f6572,null))[_0x82f2('0x24')](removeEntity(_0x1f6572,null))[_0x82f2('0x3f')](handleError(_0x1f6572,null));};exports['download']=function(_0x1df177,_0xffb473,_0x30b993){return db[_0x82f2('0x3b')][_0x82f2('0x44')]({'where':{'id':_0x1df177[_0x82f2('0x41')]['id']},'attributes':[_0x82f2('0x29'),_0x82f2('0x4f'),'savename',_0x82f2('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0xffb473,null))[_0x82f2('0x24')](function(_0x47c93d){if(_0x47c93d){if(!fs[_0x82f2('0x51')](path[_0x82f2('0x52')](config['root'],_0x82f2('0x53'),_0x47c93d[_0x82f2('0x54')]))){throw new db['Sequelize'][(_0x82f2('0x55'))](_0x82f2('0x56'));}if(_0x1df177[_0x82f2('0x31')][_0x82f2('0x57')]){return _0xffb473[_0x82f2('0x18')](0xc8);}return _0xffb473[_0x82f2('0x58')](path[_0x82f2('0x52')](config[_0x82f2('0x59')],_0x82f2('0x53'),_0x47c93d[_0x82f2('0x54')]),util[_0x82f2('0x5a')](_0x82f2('0x5b'),_0x47c93d[_0x82f2('0x4f')]||_0x47c93d[_0x82f2('0x29')],_0x47c93d[_0x82f2('0x50')]['toLowerCase']()));}})[_0x82f2('0x3f')](handleError(_0xffb473,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index dd79301..3263b57 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 _0xbb3c=['request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x3dac86,_0x7bab84){var _0x4fa090=function(_0x210168){while(--_0x210168){_0x3dac86['push'](_0x3dac86['shift']());}};_0x4fa090(++_0x7bab84);}(_0xbb3c,0x1a8));var _0xcbb3=function(_0x1c0522,_0x25b14b){_0x1c0522=_0x1c0522-0x0;var _0x103228=_0xbb3c[_0x1c0522];return _0x103228;};'use strict';var _=require(_0xcbb3('0x0'));var util=require(_0xcbb3('0x1'));var logger=require(_0xcbb3('0x2'))(_0xcbb3('0x3'));var moment=require(_0xcbb3('0x4'));var BPromise=require('bluebird');var rp=require(_0xcbb3('0x5'));var fs=require('fs');var path=require(_0xcbb3('0x6'));var rimraf=require(_0xcbb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xcbb3('0x8'));module[_0xcbb3('0x9')]=function(_0x233deb,_0x4c4810){return _0x233deb[_0xcbb3('0xa')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x010b=['../../config/logger','moment','request-promise','path','rimraf','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x4b9459,_0x4460b2){var _0x21717b=function(_0x53b39a){while(--_0x53b39a){_0x4b9459['push'](_0x4b9459['shift']());}};_0x21717b(++_0x4460b2);}(_0x010b,0x127));var _0xb010=function(_0x5cbc9f,_0x75250b){_0x5cbc9f=_0x5cbc9f-0x0;var _0x21e0a7=_0x010b[_0x5cbc9f];return _0x21e0a7;};'use strict';var _=require(_0xb010('0x0'));var util=require(_0xb010('0x1'));var logger=require(_0xb010('0x2'))('api');var moment=require(_0xb010('0x3'));var BPromise=require('bluebird');var rp=require(_0xb010('0x4'));var fs=require('fs');var path=require(_0xb010('0x5'));var rimraf=require(_0xb010('0x6'));var config=require('../../config/environment');var attributes=require(_0xb010('0x7'));module['exports']=function(_0x1f5d05,_0x50658c){return _0x1f5d05[_0xb010('0x8')](_0xb010('0x9'),attributes,{'tableName':_0xb010('0xa'),'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 807e4fa..03a0ed0 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 _0xc736=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x30b7f8,_0x5c69c4){var _0x75a35e=function(_0x61aa22){while(--_0x61aa22){_0x30b7f8['push'](_0x30b7f8['shift']());}};_0x75a35e(++_0x5c69c4);}(_0xc736,0x1a3));var _0x6c73=function(_0x27b0c9,_0xbf9d76){_0x27b0c9=_0x27b0c9-0x0;var _0x22eeac=_0xc736[_0x27b0c9];return _0x22eeac;};'use strict';var _=require(_0x6c73('0x0'));var util=require(_0x6c73('0x1'));var moment=require(_0x6c73('0x2'));var BPromise=require(_0x6c73('0x3'));var rs=require(_0x6c73('0x4'));var fs=require('fs');var Redis=require(_0x6c73('0x5'));var db=require(_0x6c73('0x6'))['db'];var utils=require(_0x6c73('0x7'));var logger=require('../../config/logger')(_0x6c73('0x8'));var config=require(_0x6c73('0x9'));var jayson=require(_0x6c73('0xa'));var client=jayson[_0x6c73('0xb')][_0x6c73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13b14e,_0x47e111,_0x308a5f){return new BPromise(function(_0x2ec9b0,_0x3f4c53){return client[_0x6c73('0xd')](_0x13b14e,_0x308a5f)[_0x6c73('0xe')](function(_0x2bc126){logger['info'](_0x6c73('0xf'),_0x47e111,_0x6c73('0x10'));logger[_0x6c73('0x11')](_0x6c73('0x12'),_0x47e111,_0x6c73('0x10'),JSON[_0x6c73('0x13')](_0x2bc126));if(_0x2bc126[_0x6c73('0x14')]){if(_0x2bc126[_0x6c73('0x14')][_0x6c73('0x15')]===0x1f4){logger[_0x6c73('0x14')](_0x6c73('0xf'),_0x47e111,_0x2bc126[_0x6c73('0x14')][_0x6c73('0x16')]);return _0x3f4c53(_0x2bc126[_0x6c73('0x14')][_0x6c73('0x16')]);}logger[_0x6c73('0x14')](_0x6c73('0xf'),_0x47e111,_0x2bc126['error'][_0x6c73('0x16')]);return _0x2ec9b0(_0x2bc126[_0x6c73('0x14')][_0x6c73('0x16')]);}else{logger['info'](_0x6c73('0xf'),_0x47e111,_0x6c73('0x10'));_0x2ec9b0(_0x2bc126[_0x6c73('0x17')][_0x6c73('0x16')]);}})[_0x6c73('0x18')](function(_0x589de6){logger['error'](_0x6c73('0xf'),_0x47e111,_0x589de6);_0x3f4c53(_0x589de6);});});} \ No newline at end of file +var _0x8ca9=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird'];(function(_0x238cec,_0x2ad1ad){var _0x654aa9=function(_0x2a00c0){while(--_0x2a00c0){_0x238cec['push'](_0x238cec['shift']());}};_0x654aa9(++_0x2ad1ad);}(_0x8ca9,0x1a1));var _0x98ca=function(_0x8d0f51,_0x386e61){_0x8d0f51=_0x8d0f51-0x0;var _0x3166e7=_0x8ca9[_0x8d0f51];return _0x3166e7;};'use strict';var _=require('lodash');var util=require(_0x98ca('0x0'));var moment=require(_0x98ca('0x1'));var BPromise=require(_0x98ca('0x2'));var rs=require(_0x98ca('0x3'));var fs=require('fs');var Redis=require(_0x98ca('0x4'));var db=require(_0x98ca('0x5'))['db'];var utils=require(_0x98ca('0x6'));var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson[_0x98ca('0x9')][_0x98ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55aa2e,_0x5f57b3,_0x58aa49){return new BPromise(function(_0x29f20d,_0x7166c6){return client['request'](_0x55aa2e,_0x58aa49)[_0x98ca('0xb')](function(_0xfd452b){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x5f57b3,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x5f57b3,_0x98ca('0xe'),JSON['stringify'](_0xfd452b));if(_0xfd452b[_0x98ca('0x11')]){if(_0xfd452b[_0x98ca('0x11')][_0x98ca('0x12')]===0x1f4){logger[_0x98ca('0x11')](_0x98ca('0xd'),_0x5f57b3,_0xfd452b[_0x98ca('0x11')][_0x98ca('0x13')]);return _0x7166c6(_0xfd452b[_0x98ca('0x11')][_0x98ca('0x13')]);}logger[_0x98ca('0x11')](_0x98ca('0xd'),_0x5f57b3,_0xfd452b[_0x98ca('0x11')][_0x98ca('0x13')]);return _0x29f20d(_0xfd452b['error'][_0x98ca('0x13')]);}else{logger[_0x98ca('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5f57b3,'request\x20sent');_0x29f20d(_0xfd452b['result']['message']);}})[_0x98ca('0x14')](function(_0x4f176b){logger['error'](_0x98ca('0xd'),_0x5f57b3,_0x4f176b);_0x7166c6(_0x4f176b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index bf60edb..bce2d68 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 _0x8b84=['download','create','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x6e44a,_0x59d32e){var _0x60a105=function(_0x264c21){while(--_0x264c21){_0x6e44a['push'](_0x6e44a['shift']());}};_0x60a105(++_0x59d32e);}(_0x8b84,0x89));var _0x48b8=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8b84[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x48b8('0x0'));var util=require(_0x48b8('0x1'));var path=require(_0x48b8('0x2'));var timeout=require(_0x48b8('0x3'));var express=require(_0x48b8('0x4'));var router=express[_0x48b8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x48b8('0x6'));var config=require(_0x48b8('0x7'));var controller=require(_0x48b8('0x8'));router[_0x48b8('0x9')]('/',auth[_0x48b8('0xa')](),controller[_0x48b8('0xb')]);router[_0x48b8('0x9')](_0x48b8('0xc'),auth[_0x48b8('0xa')](),controller[_0x48b8('0xd')]);router['get'](_0x48b8('0xe'),auth['isAuthenticated'](),controller[_0x48b8('0xf')]);router['post']('/',auth[_0x48b8('0xa')](),controller[_0x48b8('0x10')]);router['put'](_0x48b8('0xc'),auth[_0x48b8('0xa')](),controller['update']);router[_0x48b8('0x11')](_0x48b8('0xc'),auth[_0x48b8('0xa')](),controller['destroy']);module[_0x48b8('0x12')]=router; \ No newline at end of file +var _0x06ee=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','post'];(function(_0x2704cc,_0x5157bc){var _0x14e16e=function(_0x5c26de){while(--_0x5c26de){_0x2704cc['push'](_0x2704cc['shift']());}};_0x14e16e(++_0x5157bc);}(_0x06ee,0x110));var _0xe06e=function(_0x2c8be4,_0x380f0e){_0x2c8be4=_0x2c8be4-0x0;var _0x442531=_0x06ee[_0x2c8be4];return _0x442531;};'use strict';var multer=require('multer');var util=require(_0xe06e('0x0'));var path=require(_0xe06e('0x1'));var timeout=require('connect-timeout');var express=require(_0xe06e('0x2'));var router=express[_0xe06e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe06e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe06e('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0xe06e('0x6')]('/',auth[_0xe06e('0x7')](),controller[_0xe06e('0x8')]);router[_0xe06e('0x6')](_0xe06e('0x9'),auth['isAuthenticated'](),controller[_0xe06e('0xa')]);router[_0xe06e('0x6')]('/:id/download',auth[_0xe06e('0x7')](),controller[_0xe06e('0xb')]);router[_0xe06e('0xc')]('/',auth['isAuthenticated'](),controller[_0xe06e('0xd')]);router[_0xe06e('0xe')](_0xe06e('0x9'),auth['isAuthenticated'](),controller[_0xe06e('0xf')]);router[_0xe06e('0x10')](_0xe06e('0x9'),auth[_0xe06e('0x7')](),controller[_0xe06e('0x11')]);module[_0xe06e('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 7e1327d..04f4f4d 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 _0x3346=['exports','TEXT','STRING','BOOLEAN'];(function(_0xb6ff7c,_0x13229b){var _0x275d41=function(_0x2d1fa4){while(--_0x2d1fa4){_0xb6ff7c['push'](_0xb6ff7c['shift']());}};_0x275d41(++_0x13229b);}(_0x3346,0x1dc));var _0x6334=function(_0x58c39e,_0x68277e){_0x58c39e=_0x58c39e-0x0;var _0x4f911a=_0x3346[_0x58c39e];return _0x4f911a;};'use strict';var Sequelize=require('sequelize');module[_0x6334('0x0')]={'field':{'type':Sequelize[_0x6334('0x1')]},'alias':{'type':Sequelize[_0x6334('0x2')]},'function':{'type':Sequelize[_0x6334('0x2')]},'format':{'type':Sequelize[_0x6334('0x2')]},'groupBy':{'type':Sequelize[_0x6334('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6334('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x746e=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x451429,_0x542d1b){var _0x52194c=function(_0x583990){while(--_0x583990){_0x451429['push'](_0x451429['shift']());}};_0x52194c(++_0x542d1b);}(_0x746e,0xf6));var _0xe746=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x746e[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0xe746('0x0'));module[_0xe746('0x1')]={'field':{'type':Sequelize[_0xe746('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xe746('0x3')]},'format':{'type':Sequelize[_0xe746('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe746('0x3')]},'custom':{'type':Sequelize[_0xe746('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 8f6df31..cc63e26 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 _0x8460=['pick','filter','merge','options','AnalyticFieldReport','includeAll','findAll','rows','catch','params','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where'];(function(_0x598bc1,_0x543990){var _0x14625d=function(_0x568ae7){while(--_0x568ae7){_0x598bc1['push'](_0x598bc1['shift']());}};_0x14625d(++_0x543990);}(_0x8460,0xfd));var _0x0846=function(_0x2c61cf,_0x4cef5c){_0x2c61cf=_0x2c61cf-0x0;var _0x5cc93d=_0x8460[_0x2c61cf];return _0x5cc93d;};'use strict';var emlformat=require(_0x0846('0x0'));var rimraf=require(_0x0846('0x1'));var zipdir=require(_0x0846('0x2'));var jsonpatch=require(_0x0846('0x3'));var rp=require('request-promise');var moment=require(_0x0846('0x4'));var BPromise=require(_0x0846('0x5'));var Mustache=require(_0x0846('0x6'));var util=require(_0x0846('0x7'));var path=require(_0x0846('0x8'));var sox=require(_0x0846('0x9'));var csv=require(_0x0846('0xa'));var ejs=require(_0x0846('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0846('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0846('0xd'));var toCsv=require(_0x0846('0xa'));var querystring=require('querystring');var Papa=require(_0x0846('0xe'));var Redis=require(_0x0846('0xf'));var authService=require(_0x0846('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0846('0x11'));var config=require(_0x0846('0x12'));var licenseUtil=require(_0x0846('0x13'));var db=require(_0x0846('0x14'))['db'];function respondWithStatusCode(_0x248775,_0x4d37ac){_0x4d37ac=_0x4d37ac||0xcc;return function(_0x3fb504){if(_0x3fb504){return _0x248775[_0x0846('0x15')](_0x4d37ac);}return _0x248775[_0x0846('0x16')](_0x4d37ac)[_0x0846('0x17')]();};}function respondWithResult(_0xfb69d2,_0x8abc34){_0x8abc34=_0x8abc34||0xc8;return function(_0x35207e){if(_0x35207e){return _0xfb69d2['status'](_0x8abc34)['json'](_0x35207e);}};}function respondWithFilteredResult(_0x2ed17d,_0x246598){return function(_0x161ab0){if(_0x161ab0){var _0xb8b8b1=typeof _0x246598[_0x0846('0x18')]===_0x0846('0x19')&&typeof _0x246598[_0x0846('0x1a')]===_0x0846('0x19');var _0x45f173=_0x161ab0[_0x0846('0x1b')];var _0x533cd0=_0xb8b8b1?0x0:_0x246598[_0x0846('0x18')];var _0x5e3c58=_0xb8b8b1?_0x161ab0[_0x0846('0x1b')]:_0x246598[_0x0846('0x18')]+_0x246598[_0x0846('0x1a')];var _0x474f33;if(_0x5e3c58>=_0x45f173){_0x5e3c58=_0x45f173;_0x474f33=0xc8;}else{_0x474f33=0xce;}_0x2ed17d[_0x0846('0x16')](_0x474f33);return _0x2ed17d[_0x0846('0x1c')]('Content-Range',_0x533cd0+'-'+_0x5e3c58+'/'+_0x45f173)[_0x0846('0x1d')](_0x161ab0);}return null;};}function patchUpdates(_0x2e15cd){return function(_0x58c37c){try{jsonpatch[_0x0846('0x1e')](_0x58c37c,_0x2e15cd,!![]);}catch(_0x440631){return BPromise[_0x0846('0x1f')](_0x440631);}return _0x58c37c[_0x0846('0x20')]();};}function saveUpdates(_0x329668,_0x4c590f){return function(_0x2822e8){if(_0x2822e8){return _0x2822e8[_0x0846('0x21')](_0x329668)[_0x0846('0x22')](function(_0x52bd0c){return _0x52bd0c;});}return null;};}function removeEntity(_0xe56b39,_0x5d06d4){return function(_0xefddcc){if(_0xefddcc){return _0xefddcc[_0x0846('0x23')]()[_0x0846('0x22')](function(){_0xe56b39['status'](0xcc)[_0x0846('0x17')]();});}};}function handleEntityNotFound(_0xc80035,_0x11aee6){return function(_0x754c77){if(!_0x754c77){_0xc80035[_0x0846('0x15')](0x194);}return _0x754c77;};}function handleError(_0xb08fcc,_0x15742e){_0x15742e=_0x15742e||0x1f4;return function(_0x2c7e8c){logger[_0x0846('0x24')](_0x2c7e8c['stack']);if(_0x2c7e8c[_0x0846('0x25')]){delete _0x2c7e8c[_0x0846('0x25')];}_0xb08fcc[_0x0846('0x16')](_0x15742e)[_0x0846('0x26')](_0x2c7e8c);};}exports['index']=function(_0x65b6a2,_0x52c8e1){var _0x2d5e8e={},_0x19d780={},_0x1e766e={'count':0x0,'rows':[]};var _0xf41f8f=_[_0x0846('0x27')](db['AnalyticFieldReport'][_0x0846('0x28')],function(_0x415ead){return{'name':_0x415ead[_0x0846('0x29')],'type':_0x415ead[_0x0846('0x2a')][_0x0846('0x2b')]};});_0x19d780[_0x0846('0x2c')]=_[_0x0846('0x27')](_0xf41f8f,_0x0846('0x25'));_0x19d780['query']=_[_0x0846('0x2d')](_0x65b6a2['query']);_0x19d780[_0x0846('0x2e')]=_[_0x0846('0x2f')](_0x19d780[_0x0846('0x2c')],_0x19d780[_0x0846('0x30')]);_0x2d5e8e[_0x0846('0x31')]=_[_0x0846('0x2f')](_0x19d780[_0x0846('0x2c')],qs['fields'](_0x65b6a2[_0x0846('0x30')][_0x0846('0x32')]));_0x2d5e8e[_0x0846('0x31')]=_0x2d5e8e[_0x0846('0x31')][_0x0846('0x33')]?_0x2d5e8e[_0x0846('0x31')]:_0x19d780[_0x0846('0x2c')];if(!_0x65b6a2['query']['hasOwnProperty'](_0x0846('0x34'))){_0x2d5e8e[_0x0846('0x1a')]=qs[_0x0846('0x1a')](_0x65b6a2[_0x0846('0x30')][_0x0846('0x1a')]);_0x2d5e8e[_0x0846('0x18')]=qs['offset'](_0x65b6a2['query'][_0x0846('0x18')]);}_0x2d5e8e['order']=qs[_0x0846('0x35')](_0x65b6a2[_0x0846('0x30')]['sort']);_0x2d5e8e[_0x0846('0x36')]=qs[_0x0846('0x2e')](_[_0x0846('0x37')](_0x65b6a2[_0x0846('0x30')],_0x19d780[_0x0846('0x2e')]),_0xf41f8f);if(_0x65b6a2['query'][_0x0846('0x38')]){_0x2d5e8e[_0x0846('0x36')]=_[_0x0846('0x39')](_0x2d5e8e['where'],{'$or':_[_0x0846('0x27')](_0xf41f8f,function(_0x51f2e9){if(_0x51f2e9[_0x0846('0x2a')]!=='VIRTUAL'){var _0x204d05={};_0x204d05[_0x51f2e9['name']]={'$like':'%'+_0x65b6a2['query'][_0x0846('0x38')]+'%'};return _0x204d05;}})});}_0x2d5e8e=_['merge']({},_0x2d5e8e,_0x65b6a2[_0x0846('0x3a')]);var _0x3fc864={'where':_0x2d5e8e[_0x0846('0x36')]};return db[_0x0846('0x3b')][_0x0846('0x1b')](_0x3fc864)[_0x0846('0x22')](function(_0x4b4bc7){_0x1e766e['count']=_0x4b4bc7;if(_0x65b6a2['query'][_0x0846('0x3c')]){_0x2d5e8e['include']=[{'all':!![]}];}return db[_0x0846('0x3b')][_0x0846('0x3d')](_0x2d5e8e);})[_0x0846('0x22')](function(_0xe27d5b){_0x1e766e[_0x0846('0x3e')]=_0xe27d5b;return _0x1e766e;})['then'](respondWithFilteredResult(_0x52c8e1,_0x2d5e8e))[_0x0846('0x3f')](handleError(_0x52c8e1,null));};exports['show']=function(_0x5b1ae2,_0x3ef49e){var _0x3a0456={'raw':![],'where':{'id':_0x5b1ae2[_0x0846('0x40')]['id']}},_0x42b0c9={};_0x42b0c9[_0x0846('0x2c')]=_[_0x0846('0x2d')](db[_0x0846('0x3b')][_0x0846('0x28')]);_0x42b0c9[_0x0846('0x30')]=_['keys'](_0x5b1ae2['query']);_0x42b0c9['filters']=_['intersection'](_0x42b0c9[_0x0846('0x2c')],_0x42b0c9[_0x0846('0x30')]);_0x3a0456[_0x0846('0x31')]=_[_0x0846('0x2f')](_0x42b0c9['model'],qs['fields'](_0x5b1ae2[_0x0846('0x30')]['fields']));_0x3a0456[_0x0846('0x31')]=_0x3a0456[_0x0846('0x31')]['length']?_0x3a0456['attributes']:_0x42b0c9[_0x0846('0x2c')];if(_0x5b1ae2['query']['includeAll']){_0x3a0456[_0x0846('0x41')]=[{'all':!![]}];}_0x3a0456=_[_0x0846('0x39')]({},_0x3a0456,_0x5b1ae2['options']);return db[_0x0846('0x3b')][_0x0846('0x42')](_0x3a0456)[_0x0846('0x22')](handleEntityNotFound(_0x3ef49e,null))['then'](respondWithResult(_0x3ef49e,null))['catch'](handleError(_0x3ef49e,null));};exports['create']=function(_0x48eb85,_0x3bd659){return db['AnalyticFieldReport'][_0x0846('0x43')](_0x48eb85[_0x0846('0x44')],{})[_0x0846('0x22')](respondWithResult(_0x3bd659,0xc9))['catch'](handleError(_0x3bd659,null));};exports[_0x0846('0x45')]=function(_0x2c63e7,_0x4bc156){return db[_0x0846('0x3b')][_0x0846('0x45')](_0x2c63e7[_0x0846('0x44')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4bc156,0xc9))[_0x0846('0x3f')](handleError(_0x4bc156,null));};exports[_0x0846('0x21')]=function(_0x165db6,_0x1796db){if(_0x165db6[_0x0846('0x44')]['id']){delete _0x165db6['body']['id'];}return db[_0x0846('0x3b')]['find']({'where':{'id':_0x165db6[_0x0846('0x40')]['id']}})[_0x0846('0x22')](handleEntityNotFound(_0x1796db,null))[_0x0846('0x22')](saveUpdates(_0x165db6['body'],null))[_0x0846('0x22')](respondWithResult(_0x1796db,null))['catch'](handleError(_0x1796db,null));};exports[_0x0846('0x23')]=function(_0x2dc676,_0x316228){return db[_0x0846('0x3b')][_0x0846('0x42')]({'where':{'id':_0x2dc676['params']['id']}})[_0x0846('0x22')](handleEntityNotFound(_0x316228,null))['then'](removeEntity(_0x316228,null))[_0x0846('0x3f')](handleError(_0x316228,null));};exports[_0x0846('0x46')]=function(_0x4aa19b,_0x37deea){return db[_0x0846('0x3b')][_0x0846('0x23')]({'where':{'id':_0x4aa19b[_0x0846('0x30')][_0x0846('0x47')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x37deea,0xcc))['catch'](handleError(_0x37deea,null));};exports[_0x0846('0x48')]=function(_0x3ac39b,_0x1586cc,_0x48c1b7){return db[_0x0846('0x49')][_0x0846('0x4a')]({'where':{'id':_0x3ac39b[_0x0846('0x40')]['id']}})[_0x0846('0x22')](handleEntityNotFound(_0x1586cc,null))[_0x0846('0x22')](function(_0x1c2f3e){if(_0x1c2f3e){return db[_0x0846('0x4b')]['transaction'](function(_0x5d9b5e){return db['AnalyticFieldReport'][_0x0846('0x23')]({'where':{'CustomReportId':_0x3ac39b['params']['id']},'transaction':_0x5d9b5e})[_0x0846('0x22')](function(_0x1906e2){var _0x144751=_[_0x0846('0x27')](_0x3ac39b[_0x0846('0x44')],function(_0x3defdf){delete _0x3defdf['id'];_0x3defdf[_0x0846('0x4c')]=_0x3ac39b[_0x0846('0x40')]['id'];return _0x3defdf;});return db['AnalyticFieldReport'][_0x0846('0x45')](_0x144751,{'transaction':_0x5d9b5e});});})[_0x0846('0x22')](function(){return db[_0x0846('0x3b')][_0x0846('0x3d')]({'where':{'CustomReportId':_0x3ac39b[_0x0846('0x40')]['id']}});});}})[_0x0846('0x22')](respondWithResult(_0x1586cc,null))['catch'](handleError(_0x1586cc,null));}; \ No newline at end of file +var _0xbe39=['body','bulkCreate','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','params','sequelize','CustomReportId','findAll','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','AnalyticFieldReport','fieldName','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','rows','catch','keys','rawAttributes','fields','includeAll','include','find','create'];(function(_0x538175,_0xec25f3){var _0x5464bc=function(_0x1d568f){while(--_0x1d568f){_0x538175['push'](_0x538175['shift']());}};_0x5464bc(++_0xec25f3);}(_0xbe39,0x196));var _0x9be3=function(_0x49b06a,_0x38699b){_0x49b06a=_0x49b06a-0x0;var _0x77a508=_0xbe39[_0x49b06a];return _0x77a508;};'use strict';var emlformat=require(_0x9be3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9be3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9be3('0x2'));var util=require(_0x9be3('0x3'));var path=require(_0x9be3('0x4'));var sox=require(_0x9be3('0x5'));var csv=require(_0x9be3('0x6'));var ejs=require(_0x9be3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9be3('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9be3('0x9'));var toCsv=require(_0x9be3('0x6'));var querystring=require(_0x9be3('0xa'));var Papa=require(_0x9be3('0xb'));var Redis=require(_0x9be3('0xc'));var authService=require(_0x9be3('0xd'));var qs=require(_0x9be3('0xe'));var as=require(_0x9be3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9be3('0x10'))(_0x9be3('0x11'));var utils=require(_0x9be3('0x12'));var config=require(_0x9be3('0x13'));var licenseUtil=require(_0x9be3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x496471,_0x256f50){_0x256f50=_0x256f50||0xcc;return function(_0x153adc){if(_0x153adc){return _0x496471['sendStatus'](_0x256f50);}return _0x496471['status'](_0x256f50)['end']();};}function respondWithResult(_0x454e8f,_0x575f2c){_0x575f2c=_0x575f2c||0xc8;return function(_0x428e7d){if(_0x428e7d){return _0x454e8f[_0x9be3('0x15')](_0x575f2c)[_0x9be3('0x16')](_0x428e7d);}};}function respondWithFilteredResult(_0x391891,_0x3fb740){return function(_0x3e58a4){if(_0x3e58a4){var _0x477139=typeof _0x3fb740[_0x9be3('0x17')]===_0x9be3('0x18')&&typeof _0x3fb740['limit']===_0x9be3('0x18');var _0xe93937=_0x3e58a4[_0x9be3('0x19')];var _0x3f3637=_0x477139?0x0:_0x3fb740[_0x9be3('0x17')];var _0x4d09c2=_0x477139?_0x3e58a4[_0x9be3('0x19')]:_0x3fb740[_0x9be3('0x17')]+_0x3fb740[_0x9be3('0x1a')];var _0x42734d;if(_0x4d09c2>=_0xe93937){_0x4d09c2=_0xe93937;_0x42734d=0xc8;}else{_0x42734d=0xce;}_0x391891[_0x9be3('0x15')](_0x42734d);return _0x391891[_0x9be3('0x1b')](_0x9be3('0x1c'),_0x3f3637+'-'+_0x4d09c2+'/'+_0xe93937)[_0x9be3('0x16')](_0x3e58a4);}return null;};}function patchUpdates(_0x23dd78){return function(_0x557eb5){try{jsonpatch[_0x9be3('0x1d')](_0x557eb5,_0x23dd78,!![]);}catch(_0x3b34aa){return BPromise[_0x9be3('0x1e')](_0x3b34aa);}return _0x557eb5[_0x9be3('0x1f')]();};}function saveUpdates(_0x4fcac7,_0x315056){return function(_0x4f65e2){if(_0x4f65e2){return _0x4f65e2[_0x9be3('0x20')](_0x4fcac7)[_0x9be3('0x21')](function(_0x507fc6){return _0x507fc6;});}return null;};}function removeEntity(_0x14d077,_0x33df60){return function(_0x14bfc2){if(_0x14bfc2){return _0x14bfc2['destroy']()['then'](function(){_0x14d077['status'](0xcc)[_0x9be3('0x22')]();});}};}function handleEntityNotFound(_0x38ecc8,_0x39bde9){return function(_0x73292b){if(!_0x73292b){_0x38ecc8[_0x9be3('0x23')](0x194);}return _0x73292b;};}function handleError(_0x1287c9,_0x449c0b){_0x449c0b=_0x449c0b||0x1f4;return function(_0x2e8c52){logger[_0x9be3('0x24')](_0x2e8c52[_0x9be3('0x25')]);if(_0x2e8c52[_0x9be3('0x26')]){delete _0x2e8c52[_0x9be3('0x26')];}_0x1287c9[_0x9be3('0x15')](_0x449c0b)[_0x9be3('0x27')](_0x2e8c52);};}exports['index']=function(_0x3b2eec,_0x4fa5f2){var _0x49f4e3={},_0x5ed091={},_0x15e32b={'count':0x0,'rows':[]};var _0x38625b=_['map'](db[_0x9be3('0x28')]['rawAttributes'],function(_0x450df5){return{'name':_0x450df5[_0x9be3('0x29')],'type':_0x450df5['type'][_0x9be3('0x2a')]};});_0x5ed091[_0x9be3('0x2b')]=_[_0x9be3('0x2c')](_0x38625b,'name');_0x5ed091[_0x9be3('0x2d')]=_['keys'](_0x3b2eec[_0x9be3('0x2d')]);_0x5ed091[_0x9be3('0x2e')]=_['intersection'](_0x5ed091['model'],_0x5ed091[_0x9be3('0x2d')]);_0x49f4e3['attributes']=_[_0x9be3('0x2f')](_0x5ed091[_0x9be3('0x2b')],qs['fields'](_0x3b2eec[_0x9be3('0x2d')]['fields']));_0x49f4e3[_0x9be3('0x30')]=_0x49f4e3[_0x9be3('0x30')][_0x9be3('0x31')]?_0x49f4e3[_0x9be3('0x30')]:_0x5ed091['model'];if(!_0x3b2eec[_0x9be3('0x2d')][_0x9be3('0x32')]('nolimit')){_0x49f4e3[_0x9be3('0x1a')]=qs[_0x9be3('0x1a')](_0x3b2eec['query'][_0x9be3('0x1a')]);_0x49f4e3[_0x9be3('0x17')]=qs[_0x9be3('0x17')](_0x3b2eec['query'][_0x9be3('0x17')]);}_0x49f4e3[_0x9be3('0x33')]=qs[_0x9be3('0x34')](_0x3b2eec['query'][_0x9be3('0x34')]);_0x49f4e3[_0x9be3('0x35')]=qs['filters'](_[_0x9be3('0x36')](_0x3b2eec[_0x9be3('0x2d')],_0x5ed091[_0x9be3('0x2e')]),_0x38625b);if(_0x3b2eec[_0x9be3('0x2d')][_0x9be3('0x37')]){_0x49f4e3['where']=_[_0x9be3('0x38')](_0x49f4e3[_0x9be3('0x35')],{'$or':_['map'](_0x38625b,function(_0x49d692){if(_0x49d692[_0x9be3('0x39')]!==_0x9be3('0x3a')){var _0x5a0823={};_0x5a0823[_0x49d692[_0x9be3('0x26')]]={'$like':'%'+_0x3b2eec[_0x9be3('0x2d')][_0x9be3('0x37')]+'%'};return _0x5a0823;}})});}_0x49f4e3=_[_0x9be3('0x38')]({},_0x49f4e3,_0x3b2eec['options']);var _0x449870={'where':_0x49f4e3['where']};return db[_0x9be3('0x28')][_0x9be3('0x19')](_0x449870)['then'](function(_0x1a711e){_0x15e32b[_0x9be3('0x19')]=_0x1a711e;if(_0x3b2eec[_0x9be3('0x2d')]['includeAll']){_0x49f4e3['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x49f4e3);})[_0x9be3('0x21')](function(_0x51a451){_0x15e32b[_0x9be3('0x3b')]=_0x51a451;return _0x15e32b;})['then'](respondWithFilteredResult(_0x4fa5f2,_0x49f4e3))[_0x9be3('0x3c')](handleError(_0x4fa5f2,null));};exports['show']=function(_0x3c13ce,_0x5f3a45){var _0x192552={'raw':![],'where':{'id':_0x3c13ce['params']['id']}},_0x4bf943={};_0x4bf943['model']=_[_0x9be3('0x3d')](db[_0x9be3('0x28')][_0x9be3('0x3e')]);_0x4bf943[_0x9be3('0x2d')]=_[_0x9be3('0x3d')](_0x3c13ce[_0x9be3('0x2d')]);_0x4bf943[_0x9be3('0x2e')]=_['intersection'](_0x4bf943[_0x9be3('0x2b')],_0x4bf943['query']);_0x192552[_0x9be3('0x30')]=_[_0x9be3('0x2f')](_0x4bf943[_0x9be3('0x2b')],qs[_0x9be3('0x3f')](_0x3c13ce[_0x9be3('0x2d')][_0x9be3('0x3f')]));_0x192552[_0x9be3('0x30')]=_0x192552[_0x9be3('0x30')][_0x9be3('0x31')]?_0x192552[_0x9be3('0x30')]:_0x4bf943['model'];if(_0x3c13ce['query'][_0x9be3('0x40')]){_0x192552[_0x9be3('0x41')]=[{'all':!![]}];}_0x192552=_[_0x9be3('0x38')]({},_0x192552,_0x3c13ce['options']);return db[_0x9be3('0x28')][_0x9be3('0x42')](_0x192552)[_0x9be3('0x21')](handleEntityNotFound(_0x5f3a45,null))['then'](respondWithResult(_0x5f3a45,null))[_0x9be3('0x3c')](handleError(_0x5f3a45,null));};exports[_0x9be3('0x43')]=function(_0x465111,_0xff0281){return db[_0x9be3('0x28')]['create'](_0x465111[_0x9be3('0x44')],{})['then'](respondWithResult(_0xff0281,0xc9))['catch'](handleError(_0xff0281,null));};exports[_0x9be3('0x45')]=function(_0x21a524,_0x20523b){return db['AnalyticFieldReport'][_0x9be3('0x45')](_0x21a524[_0x9be3('0x44')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x20523b,0xc9))[_0x9be3('0x3c')](handleError(_0x20523b,null));};exports[_0x9be3('0x20')]=function(_0x23fe06,_0x22bd07){if(_0x23fe06['body']['id']){delete _0x23fe06[_0x9be3('0x44')]['id'];}return db[_0x9be3('0x28')][_0x9be3('0x42')]({'where':{'id':_0x23fe06['params']['id']}})[_0x9be3('0x21')](handleEntityNotFound(_0x22bd07,null))[_0x9be3('0x21')](saveUpdates(_0x23fe06[_0x9be3('0x44')],null))[_0x9be3('0x21')](respondWithResult(_0x22bd07,null))[_0x9be3('0x3c')](handleError(_0x22bd07,null));};exports[_0x9be3('0x46')]=function(_0x17bf05,_0x14debf){return db[_0x9be3('0x28')][_0x9be3('0x42')]({'where':{'id':_0x17bf05['params']['id']}})['then'](handleEntityNotFound(_0x14debf,null))['then'](removeEntity(_0x14debf,null))[_0x9be3('0x3c')](handleError(_0x14debf,null));};exports[_0x9be3('0x47')]=function(_0xc98161,_0x23313d){return db[_0x9be3('0x28')]['destroy']({'where':{'id':_0xc98161[_0x9be3('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x9be3('0x21')](respondWithResult(_0x23313d,0xcc))[_0x9be3('0x3c')](handleError(_0x23313d,null));};exports[_0x9be3('0x48')]=function(_0xc5e5c1,_0x8fbfff,_0x5753b3){return db[_0x9be3('0x49')][_0x9be3('0x4a')]({'where':{'id':_0xc5e5c1[_0x9be3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8fbfff,null))['then'](function(_0x429321){if(_0x429321){return db[_0x9be3('0x4c')]['transaction'](function(_0x2457c4){return db[_0x9be3('0x28')][_0x9be3('0x46')]({'where':{'CustomReportId':_0xc5e5c1[_0x9be3('0x4b')]['id']},'transaction':_0x2457c4})[_0x9be3('0x21')](function(_0x566e58){var _0xae6ddc=_[_0x9be3('0x2c')](_0xc5e5c1[_0x9be3('0x44')],function(_0x2f8f8f){delete _0x2f8f8f['id'];_0x2f8f8f[_0x9be3('0x4d')]=_0xc5e5c1[_0x9be3('0x4b')]['id'];return _0x2f8f8f;});return db[_0x9be3('0x28')]['bulkCreate'](_0xae6ddc,{'transaction':_0x2457c4});});})[_0x9be3('0x21')](function(){return db[_0x9be3('0x28')][_0x9be3('0x4e')]({'where':{'CustomReportId':_0xc5e5c1['params']['id']}});});}})[_0x9be3('0x21')](respondWithResult(_0x8fbfff,null))[_0x9be3('0x3c')](handleError(_0x8fbfff,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e21abf0..526259f 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 _0x67c7=['request-promise','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird'];(function(_0x4240d4,_0x51ba60){var _0x2d5b49=function(_0x35f2ad){while(--_0x35f2ad){_0x4240d4['push'](_0x4240d4['shift']());}};_0x2d5b49(++_0x51ba60);}(_0x67c7,0x8b));var _0x767c=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x67c7[_0x4d40dd];return _0x1c51f2;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var logger=require(_0x767c('0x2'))(_0x767c('0x3'));var moment=require('moment');var BPromise=require(_0x767c('0x4'));var rp=require(_0x767c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x767c('0x6'));var config=require(_0x767c('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x767c('0x8')]=function(_0x5c623b,_0x144c91){return _0x5c623b[_0x767c('0x9')](_0x767c('0xa'),attributes,{'tableName':_0x767c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf5d=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x136d15,_0x50f7e5){var _0xcde364=function(_0x18ee22){while(--_0x18ee22){_0x136d15['push'](_0x136d15['shift']());}};_0xcde364(++_0x50f7e5);}(_0xbf5d,0xbc));var _0xdbf5=function(_0x4569fb,_0x1952f2){_0x4569fb=_0x4569fb-0x0;var _0x19f7b9=_0xbf5d[_0x4569fb];return _0x19f7b9;};'use strict';var _=require(_0xdbf5('0x0'));var util=require(_0xdbf5('0x1'));var logger=require(_0xdbf5('0x2'))(_0xdbf5('0x3'));var moment=require(_0xdbf5('0x4'));var BPromise=require(_0xdbf5('0x5'));var rp=require(_0xdbf5('0x6'));var fs=require('fs');var path=require(_0xdbf5('0x7'));var rimraf=require(_0xdbf5('0x8'));var config=require(_0xdbf5('0x9'));var attributes=require(_0xdbf5('0xa'));module[_0xdbf5('0xb')]=function(_0x15c29d,_0x114b9a){return _0x15c29d['define'](_0xdbf5('0xc'),attributes,{'tableName':_0xdbf5('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 7c5ac44..ebf06a7 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 _0x7df4=['rpc','../../config/environment','jayson/promise','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7df4,0x19e));var _0x47df=function(_0x2bfd90,_0x102539){_0x2bfd90=_0x2bfd90-0x0;var _0x33e709=_0x7df4[_0x2bfd90];return _0x33e709;};'use strict';var _=require(_0x47df('0x0'));var util=require('util');var moment=require(_0x47df('0x1'));var BPromise=require(_0x47df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47df('0x3'));var db=require(_0x47df('0x4'))['db'];var utils=require(_0x47df('0x5'));var logger=require('../../config/logger')(_0x47df('0x6'));var config=require(_0x47df('0x7'));var jayson=require(_0x47df('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x192fff,_0x19508b,_0x4df8f3){return new BPromise(function(_0x59677b,_0x5367c7){return client[_0x47df('0x9')](_0x192fff,_0x4df8f3)['then'](function(_0x1534ba){logger[_0x47df('0xa')](_0x47df('0xb'),_0x19508b,_0x47df('0xc'));logger['debug'](_0x47df('0xd'),_0x19508b,_0x47df('0xc'),JSON[_0x47df('0xe')](_0x1534ba));if(_0x1534ba['error']){if(_0x1534ba['error'][_0x47df('0xf')]===0x1f4){logger[_0x47df('0x10')](_0x47df('0xb'),_0x19508b,_0x1534ba[_0x47df('0x10')][_0x47df('0x11')]);return _0x5367c7(_0x1534ba[_0x47df('0x10')][_0x47df('0x11')]);}logger['error'](_0x47df('0xb'),_0x19508b,_0x1534ba[_0x47df('0x10')][_0x47df('0x11')]);return _0x59677b(_0x1534ba[_0x47df('0x10')][_0x47df('0x11')]);}else{logger[_0x47df('0xa')](_0x47df('0xb'),_0x19508b,_0x47df('0xc'));_0x59677b(_0x1534ba[_0x47df('0x12')][_0x47df('0x11')]);}})[_0x47df('0x13')](function(_0x21d302){logger[_0x47df('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x19508b,_0x21d302);_0x5367c7(_0x21d302);});});} \ No newline at end of file +var _0xf661=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x4f60a7,_0x41a500){var _0x300253=function(_0x17d5ec){while(--_0x17d5ec){_0x4f60a7['push'](_0x4f60a7['shift']());}};_0x300253(++_0x41a500);}(_0xf661,0x65));var _0x1f66=function(_0x494e0f,_0xd8adfe){_0x494e0f=_0x494e0f-0x0;var _0x39f102=_0xf661[_0x494e0f];return _0x39f102;};'use strict';var _=require(_0x1f66('0x0'));var util=require(_0x1f66('0x1'));var moment=require(_0x1f66('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f66('0x4'))['db'];var utils=require(_0x1f66('0x5'));var logger=require(_0x1f66('0x6'))(_0x1f66('0x7'));var config=require(_0x1f66('0x8'));var jayson=require(_0x1f66('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7f04,_0x22b1f9,_0x483e85){return new BPromise(function(_0x213590,_0x41826f){return client[_0x1f66('0xa')](_0x2f7f04,_0x483e85)[_0x1f66('0xb')](function(_0xeb77e3){logger[_0x1f66('0xc')](_0x1f66('0xd'),_0x22b1f9,'request\x20sent');logger[_0x1f66('0xe')](_0x1f66('0xf'),_0x22b1f9,_0x1f66('0x10'),JSON[_0x1f66('0x11')](_0xeb77e3));if(_0xeb77e3[_0x1f66('0x12')]){if(_0xeb77e3['error'][_0x1f66('0x13')]===0x1f4){logger[_0x1f66('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x22b1f9,_0xeb77e3['error']['message']);return _0x41826f(_0xeb77e3[_0x1f66('0x12')][_0x1f66('0x14')]);}logger[_0x1f66('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x22b1f9,_0xeb77e3['error'][_0x1f66('0x14')]);return _0x213590(_0xeb77e3['error']['message']);}else{logger['info'](_0x1f66('0xd'),_0x22b1f9,_0x1f66('0x10'));_0x213590(_0xeb77e3[_0x1f66('0x15')][_0x1f66('0x14')]);}})[_0x1f66('0x16')](function(_0x382fd9){logger['error'](_0x1f66('0xd'),_0x22b1f9,_0x382fd9);_0x41826f(_0x382fd9);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7ddb17d..7ceaf59 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(_0x10f00b,_0xed670e){var _0x3569f2=function(_0x5012c5){while(--_0x5012c5){_0x10f00b['push'](_0x10f00b['shift']());}};_0x3569f2(++_0xed670e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0xc6800a,_0x4eac70){var _0x4919d3=function(_0x1ccfa6){while(--_0x1ccfa6){_0xc6800a['push'](_0xc6800a['shift']());}};_0x4919d3(++_0x4eac70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 abf1185..083fd0c 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 _0x205d=['STRING','TEXT','sequelize','exports'];(function(_0x3b006b,_0x1866ce){var _0x449ef6=function(_0x3a656b){while(--_0x3a656b){_0x3b006b['push'](_0x3b006b['shift']());}};_0x449ef6(++_0x1866ce);}(_0x205d,0xf6));var _0xd205=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x205d[_0x3b7a0c];return _0x3bb70f;};'use strict';var Sequelize=require(_0xd205('0x0'));module[_0xd205('0x1')]={'name':{'type':Sequelize[_0xd205('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd205('0x3')]},'description':{'type':Sequelize[_0xd205('0x2')]}}; \ No newline at end of file +var _0x9780=['STRING','name','TEXT'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x9780,0x1d4));var _0x0978=function(_0x255036,_0xf94145){_0x255036=_0x255036-0x0;var _0x3c4c56=_0x9780[_0x255036];return _0x3c4c56;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0978('0x0')],'allowNull':![],'unique':_0x0978('0x1')},'table':{'type':Sequelize[_0x0978('0x0')]},'metric':{'type':Sequelize[_0x0978('0x2')]},'description':{'type':Sequelize[_0x0978('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f653218..d847fbc 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 _0x34e8=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','AnalyticMetric','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','Metrics','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x2d3a4d,_0x47561e){var _0x3a94a3=function(_0x2f48da){while(--_0x2f48da){_0x2d3a4d['push'](_0x2d3a4d['shift']());}};_0x3a94a3(++_0x47561e);}(_0x34e8,0x12c));var _0x834e=function(_0xc64d0f,_0x32382c){_0xc64d0f=_0xc64d0f-0x0;var _0x725c33=_0x34e8[_0xc64d0f];return _0x725c33;};'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['AnalyticMetric'][_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 +var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x2576b0,_0x3fb339){var _0x2a6658=function(_0x3b5908){while(--_0x3b5908){_0x2576b0['push'](_0x2576b0['shift']());}};_0x2a6658(++_0x3fb339);}(_0xe5b3,0x133));var _0x3e5b=function(_0x59622b,_0x26e364){_0x59622b=_0x59622b-0x0;var _0x453424=_0xe5b3[_0x59622b];return _0x453424;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7695bfd..2fb9752 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 _0xaaee=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xaaee,0x132));var _0xeaae=function(_0x2fffe3,_0x2f33af){_0x2fffe3=_0x2fffe3-0x0;var _0x343c34=_0xaaee[_0x2fffe3];return _0x343c34;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var logger=require(_0xeaae('0x2'))(_0xeaae('0x3'));var moment=require(_0xeaae('0x4'));var BPromise=require('bluebird');var rp=require(_0xeaae('0x5'));var fs=require('fs');var path=require(_0xeaae('0x6'));var rimraf=require(_0xeaae('0x7'));var config=require(_0xeaae('0x8'));var attributes=require(_0xeaae('0x9'));module[_0xeaae('0xa')]=function(_0xb5ad89,_0x491e4){return _0xb5ad89[_0xeaae('0xb')](_0xeaae('0xc'),attributes,{'tableName':_0xeaae('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2178=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x515ab1,_0x133504){var _0x2589ba=function(_0x430cf9){while(--_0x430cf9){_0x515ab1['push'](_0x515ab1['shift']());}};_0x2589ba(++_0x133504);}(_0x2178,0x1b0));var _0x8217=function(_0x155a36,_0x4bf39){_0x155a36=_0x155a36-0x0;var _0x3c99d0=_0x2178[_0x155a36];return _0x3c99d0;};'use strict';var _=require(_0x8217('0x0'));var util=require('util');var logger=require(_0x8217('0x1'))(_0x8217('0x2'));var moment=require(_0x8217('0x3'));var BPromise=require('bluebird');var rp=require(_0x8217('0x4'));var fs=require('fs');var path=require(_0x8217('0x5'));var rimraf=require('rimraf');var config=require(_0x8217('0x6'));var attributes=require(_0x8217('0x7'));module[_0x8217('0x8')]=function(_0x16da6e,_0x18f4bd){return _0x16da6e[_0x8217('0x9')](_0x8217('0xa'),attributes,{'tableName':_0x8217('0xb'),'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 dc89738..fe4d50e 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 _0x62f3=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x5788ff,_0x1162bb){var _0x37b9fc=function(_0x28b3bf){while(--_0x28b3bf){_0x5788ff['push'](_0x5788ff['shift']());}};_0x37b9fc(++_0x1162bb);}(_0x62f3,0x190));var _0x362f=function(_0x3478a0,_0x2744cf){_0x3478a0=_0x3478a0-0x0;var _0x5eb76e=_0x62f3[_0x3478a0];return _0x5eb76e;};'use strict';var _=require(_0x362f('0x0'));var util=require('util');var moment=require(_0x362f('0x1'));var BPromise=require(_0x362f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x362f('0x3'));var db=require(_0x362f('0x4'))['db'];var utils=require(_0x362f('0x5'));var logger=require(_0x362f('0x6'))('rpc');var config=require(_0x362f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x362f('0x8')][_0x362f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x237a00,_0x24058e,_0x2560c8){return new BPromise(function(_0xd0c949,_0x287933){return client[_0x362f('0xa')](_0x237a00,_0x2560c8)[_0x362f('0xb')](function(_0x367be1){logger['info'](_0x362f('0xc'),_0x24058e,_0x362f('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x24058e,'request\x20sent',JSON[_0x362f('0xe')](_0x367be1));if(_0x367be1[_0x362f('0xf')]){if(_0x367be1[_0x362f('0xf')][_0x362f('0x10')]===0x1f4){logger[_0x362f('0xf')](_0x362f('0xc'),_0x24058e,_0x367be1['error'][_0x362f('0x11')]);return _0x287933(_0x367be1[_0x362f('0xf')][_0x362f('0x11')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x24058e,_0x367be1['error'][_0x362f('0x11')]);return _0xd0c949(_0x367be1[_0x362f('0xf')][_0x362f('0x11')]);}else{logger[_0x362f('0x12')](_0x362f('0xc'),_0x24058e,_0x362f('0xd'));_0xd0c949(_0x367be1[_0x362f('0x13')]['message']);}})[_0x362f('0x14')](function(_0x3d5eaf){logger[_0x362f('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x24058e,_0x3d5eaf);_0x287933(_0x3d5eaf);});});} \ No newline at end of file +var _0x91fa=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5c0f4c,_0x43faf6){var _0x129b93=function(_0x51b101){while(--_0x51b101){_0x5c0f4c['push'](_0x5c0f4c['shift']());}};_0x129b93(++_0x43faf6);}(_0x91fa,0x183));var _0xa91f=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0x91fa[_0x390143];return _0x11361b;};'use strict';var _=require(_0xa91f('0x0'));var util=require('util');var moment=require(_0xa91f('0x1'));var BPromise=require(_0xa91f('0x2'));var rs=require(_0xa91f('0x3'));var fs=require('fs');var Redis=require(_0xa91f('0x4'));var db=require(_0xa91f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa91f('0x6'))(_0xa91f('0x7'));var config=require(_0xa91f('0x8'));var jayson=require(_0xa91f('0x9'));var client=jayson[_0xa91f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42ee7e,_0x8617c6,_0x32274b){return new BPromise(function(_0x1da2b6,_0x458653){return client[_0xa91f('0xb')](_0x42ee7e,_0x32274b)[_0xa91f('0xc')](function(_0x175961){logger[_0xa91f('0xd')](_0xa91f('0xe'),_0x8617c6,'request\x20sent');logger[_0xa91f('0xf')](_0xa91f('0x10'),_0x8617c6,_0xa91f('0x11'),JSON[_0xa91f('0x12')](_0x175961));if(_0x175961[_0xa91f('0x13')]){if(_0x175961['error'][_0xa91f('0x14')]===0x1f4){logger[_0xa91f('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x8617c6,_0x175961[_0xa91f('0x13')][_0xa91f('0x15')]);return _0x458653(_0x175961[_0xa91f('0x13')][_0xa91f('0x15')]);}logger[_0xa91f('0x13')](_0xa91f('0xe'),_0x8617c6,_0x175961[_0xa91f('0x13')][_0xa91f('0x15')]);return _0x1da2b6(_0x175961[_0xa91f('0x13')]['message']);}else{logger[_0xa91f('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x8617c6,_0xa91f('0x11'));_0x1da2b6(_0x175961[_0xa91f('0x16')][_0xa91f('0x15')]);}})[_0xa91f('0x17')](function(_0x25cb92){logger[_0xa91f('0x13')](_0xa91f('0xe'),_0x8617c6,_0x25cb92);_0x458653(_0x25cb92);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 0b5d952..cdbacfb 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 _0xedf2=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xedf2,0x1ac));var _0x2edf=function(_0x5b3c24,_0x3bd2ed){_0x5b3c24=_0x5b3c24-0x0;var _0x4b397f=_0xedf2[_0x5b3c24];return _0x4b397f;};'use strict';var multer=require('multer');var util=require(_0x2edf('0x0'));var path=require(_0x2edf('0x1'));var timeout=require(_0x2edf('0x2'));var express=require('express');var router=express[_0x2edf('0x3')]();var fs_extra=require(_0x2edf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2edf('0x5'));var config=require(_0x2edf('0x6'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x2edf('0x7')](),controller[_0x2edf('0x8')]);router['get']('/:id',auth[_0x2edf('0x7')](),controller['show']);router[_0x2edf('0x9')]('/',auth['isAuthenticated'](),controller[_0x2edf('0xa')]);router[_0x2edf('0xb')](_0x2edf('0xc'),auth[_0x2edf('0x7')](),controller[_0x2edf('0xd')]);router[_0x2edf('0xe')](_0x2edf('0xc'),auth[_0x2edf('0x7')](),controller[_0x2edf('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0fda=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x55ffdb,_0x295851){_0x55ffdb=_0x55ffdb-0x0;var _0x15bf09=_0x0fda[_0x55ffdb];return _0x15bf09;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var timeout=require(_0xa0fd('0x2'));var express=require(_0xa0fd('0x3'));var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xa0fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0fd('0x8')](_0xa0fd('0x9'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xb')]);router['post']('/',auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xc')]);router[_0xa0fd('0xd')](_0xa0fd('0x9'),auth['isAuthenticated'](),controller[_0xa0fd('0xe')]);router[_0xa0fd('0xf')](_0xa0fd('0x9'),auth['isAuthenticated'](),controller[_0xa0fd('0x10')]);module[_0xa0fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a1585e7..ae45cda 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 _0x655e=['sequelize','exports'];(function(_0x5e6d6c,_0x3dfa7a){var _0x94199c=function(_0xc22720){while(--_0xc22720){_0x5e6d6c['push'](_0x5e6d6c['shift']());}};_0x94199c(++_0x3dfa7a);}(_0x655e,0x14e));var _0xe655=function(_0x488daa,_0x91f011){_0x488daa=_0x488daa-0x0;var _0x332fd7=_0x655e[_0x488daa];return _0x332fd7;};'use strict';var Sequelize=require(_0xe655('0x0'));module[_0xe655('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x0717=['exports','sequelize'];(function(_0x545cd3,_0x56761a){var _0x663f8b=function(_0x364458){while(--_0x364458){_0x545cd3['push'](_0x545cd3['shift']());}};_0x663f8b(++_0x56761a);}(_0x0717,0x7d));var _0x7071=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0717[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x7071('0x0'));module[_0x7071('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7d502d1..6e37b09 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 _0xa9ba=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x58b5f7,_0x57f8ad){var _0x9f828=function(_0x1d6eaf){while(--_0x1d6eaf){_0x58b5f7['push'](_0x58b5f7['shift']());}};_0x9f828(++_0x57f8ad);}(_0xa9ba,0x119));var _0xaa9b=function(_0x4b3d69,_0x2b9573){_0x4b3d69=_0x4b3d69-0x0;var _0x5089ed=_0xa9ba[_0x4b3d69];return _0x5089ed;};'use strict';var emlformat=require(_0xaa9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa9b('0x1'));var jsonpatch=require(_0xaa9b('0x2'));var rp=require(_0xaa9b('0x3'));var moment=require(_0xaa9b('0x4'));var BPromise=require(_0xaa9b('0x5'));var Mustache=require(_0xaa9b('0x6'));var util=require(_0xaa9b('0x7'));var path=require('path');var sox=require(_0xaa9b('0x8'));var csv=require(_0xaa9b('0x9'));var ejs=require(_0xaa9b('0xa'));var fs=require('fs');var fs_extra=require(_0xaa9b('0xb'));var _=require('lodash');var squel=require(_0xaa9b('0xc'));var crypto=require(_0xaa9b('0xd'));var jsforce=require(_0xaa9b('0xe'));var deskjs=require(_0xaa9b('0xf'));var toCsv=require(_0xaa9b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa9b('0x10'));var authService=require(_0xaa9b('0x11'));var qs=require(_0xaa9b('0x12'));var as=require(_0xaa9b('0x13'));var hardwareService=require(_0xaa9b('0x14'));var logger=require(_0xaa9b('0x15'))(_0xaa9b('0x16'));var utils=require(_0xaa9b('0x17'));var config=require(_0xaa9b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa9b('0x19'))['db'];function respondWithStatusCode(_0x5b4a83,_0x204e61){_0x204e61=_0x204e61||0xcc;return function(_0x4094c9){if(_0x4094c9){return _0x5b4a83['sendStatus'](_0x204e61);}return _0x5b4a83['status'](_0x204e61)[_0xaa9b('0x1a')]();};}function respondWithResult(_0x3d5f1e,_0x42c25d){_0x42c25d=_0x42c25d||0xc8;return function(_0x29faf1){if(_0x29faf1){return _0x3d5f1e[_0xaa9b('0x1b')](_0x42c25d)[_0xaa9b('0x1c')](_0x29faf1);}};}function respondWithFilteredResult(_0x827231,_0x393bc5){return function(_0x9e5155){if(_0x9e5155){var _0x260ab9=typeof _0x393bc5['offset']==='undefined'&&typeof _0x393bc5['limit']===_0xaa9b('0x1d');var _0x4e43e7=_0x9e5155[_0xaa9b('0x1e')];var _0x10d7c3=_0x260ab9?0x0:_0x393bc5[_0xaa9b('0x1f')];var _0xf63245=_0x260ab9?_0x9e5155[_0xaa9b('0x1e')]:_0x393bc5[_0xaa9b('0x1f')]+_0x393bc5[_0xaa9b('0x20')];var _0x3f0483;if(_0xf63245>=_0x4e43e7){_0xf63245=_0x4e43e7;_0x3f0483=0xc8;}else{_0x3f0483=0xce;}_0x827231[_0xaa9b('0x1b')](_0x3f0483);return _0x827231[_0xaa9b('0x21')](_0xaa9b('0x22'),_0x10d7c3+'-'+_0xf63245+'/'+_0x4e43e7)[_0xaa9b('0x1c')](_0x9e5155);}return null;};}function patchUpdates(_0x5f1f3e){return function(_0x34405a){try{jsonpatch[_0xaa9b('0x23')](_0x34405a,_0x5f1f3e,!![]);}catch(_0x2c0fb4){return BPromise['reject'](_0x2c0fb4);}return _0x34405a[_0xaa9b('0x24')]();};}function saveUpdates(_0x19a2b9,_0x466c1a){return function(_0x9c0687){if(_0x9c0687){return _0x9c0687[_0xaa9b('0x25')](_0x19a2b9)[_0xaa9b('0x26')](function(_0x2fc2cb){return _0x2fc2cb;});}return null;};}function removeEntity(_0x16d92d,_0x489dc0){return function(_0x1ea1ca){if(_0x1ea1ca){return _0x1ea1ca[_0xaa9b('0x27')]()[_0xaa9b('0x26')](function(){_0x16d92d['status'](0xcc)[_0xaa9b('0x1a')]();});}};}function handleEntityNotFound(_0xcbbb77,_0x12a5e7){return function(_0x366ca7){if(!_0x366ca7){_0xcbbb77[_0xaa9b('0x28')](0x194);}return _0x366ca7;};}function handleError(_0x11ff17,_0x12b374){_0x12b374=_0x12b374||0x1f4;return function(_0x184ef9){logger[_0xaa9b('0x29')](_0x184ef9['stack']);if(_0x184ef9['name']){delete _0x184ef9[_0xaa9b('0x2a')];}_0x11ff17[_0xaa9b('0x1b')](_0x12b374)['send'](_0x184ef9);};}exports[_0xaa9b('0x2b')]=function(_0x1874c3,_0xb8c036){var _0x2ae875={},_0x2b3bdc={},_0x946785={'count':0x0,'rows':[]};var _0x3cae21=_[_0xaa9b('0x2c')](db[_0xaa9b('0x2d')][_0xaa9b('0x2e')],function(_0x23746c){return{'name':_0x23746c[_0xaa9b('0x2f')],'type':_0x23746c['type'][_0xaa9b('0x30')]};});_0x2b3bdc[_0xaa9b('0x31')]=_['map'](_0x3cae21,_0xaa9b('0x2a'));_0x2b3bdc['query']=_['keys'](_0x1874c3[_0xaa9b('0x32')]);_0x2b3bdc[_0xaa9b('0x33')]=_[_0xaa9b('0x34')](_0x2b3bdc[_0xaa9b('0x31')],_0x2b3bdc['query']);_0x2ae875[_0xaa9b('0x35')]=_[_0xaa9b('0x34')](_0x2b3bdc[_0xaa9b('0x31')],qs[_0xaa9b('0x36')](_0x1874c3['query'][_0xaa9b('0x36')]));_0x2ae875[_0xaa9b('0x35')]=_0x2ae875[_0xaa9b('0x35')][_0xaa9b('0x37')]?_0x2ae875[_0xaa9b('0x35')]:_0x2b3bdc[_0xaa9b('0x31')];if(!_0x1874c3[_0xaa9b('0x32')][_0xaa9b('0x38')](_0xaa9b('0x39'))){_0x2ae875[_0xaa9b('0x20')]=qs['limit'](_0x1874c3[_0xaa9b('0x32')][_0xaa9b('0x20')]);_0x2ae875['offset']=qs['offset'](_0x1874c3[_0xaa9b('0x32')][_0xaa9b('0x1f')]);}_0x2ae875['order']=qs[_0xaa9b('0x3a')](_0x1874c3[_0xaa9b('0x32')]['sort']);_0x2ae875[_0xaa9b('0x3b')]=qs[_0xaa9b('0x33')](_[_0xaa9b('0x3c')](_0x1874c3['query'],_0x2b3bdc['filters']),_0x3cae21);if(_0x1874c3[_0xaa9b('0x32')][_0xaa9b('0x3d')]){_0x2ae875[_0xaa9b('0x3b')]=_[_0xaa9b('0x3e')](_0x2ae875['where'],{'$or':_['map'](_0x3cae21,function(_0xd42f0a){if(_0xd42f0a[_0xaa9b('0x3f')]!=='VIRTUAL'){var _0xc84494={};_0xc84494[_0xd42f0a[_0xaa9b('0x2a')]]={'$like':'%'+_0x1874c3[_0xaa9b('0x32')]['filter']+'%'};return _0xc84494;}})});}_0x2ae875=_[_0xaa9b('0x3e')]({},_0x2ae875,_0x1874c3[_0xaa9b('0x40')]);var _0x2cb86d={'where':_0x2ae875[_0xaa9b('0x3b')]};return db[_0xaa9b('0x2d')][_0xaa9b('0x1e')](_0x2cb86d)['then'](function(_0x3e71f3){_0x946785['count']=_0x3e71f3;if(_0x1874c3[_0xaa9b('0x32')][_0xaa9b('0x41')]){_0x2ae875['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xaa9b('0x42')](_0x2ae875);})[_0xaa9b('0x26')](function(_0x5db66e){_0x946785[_0xaa9b('0x43')]=_0x5db66e;return _0x946785;})[_0xaa9b('0x26')](respondWithFilteredResult(_0xb8c036,_0x2ae875))[_0xaa9b('0x44')](handleError(_0xb8c036,null));};exports[_0xaa9b('0x45')]=function(_0x6d985f,_0x3cf149){var _0x54bdfa={'raw':!![],'where':{'id':_0x6d985f[_0xaa9b('0x46')]['id']}},_0x307b0f={};_0x307b0f[_0xaa9b('0x31')]=_['keys'](db[_0xaa9b('0x2d')]['rawAttributes']);_0x307b0f[_0xaa9b('0x32')]=_['keys'](_0x6d985f[_0xaa9b('0x32')]);_0x307b0f['filters']=_['intersection'](_0x307b0f[_0xaa9b('0x31')],_0x307b0f[_0xaa9b('0x32')]);_0x54bdfa[_0xaa9b('0x35')]=_[_0xaa9b('0x34')](_0x307b0f[_0xaa9b('0x31')],qs[_0xaa9b('0x36')](_0x6d985f[_0xaa9b('0x32')][_0xaa9b('0x36')]));_0x54bdfa[_0xaa9b('0x35')]=_0x54bdfa[_0xaa9b('0x35')][_0xaa9b('0x37')]?_0x54bdfa[_0xaa9b('0x35')]:_0x307b0f[_0xaa9b('0x31')];if(_0x6d985f['query']['includeAll']){_0x54bdfa[_0xaa9b('0x47')]=[{'all':!![]}];}_0x54bdfa=_[_0xaa9b('0x3e')]({},_0x54bdfa,_0x6d985f[_0xaa9b('0x40')]);return db['AnalyticTreeReport'][_0xaa9b('0x48')](_0x54bdfa)['then'](handleEntityNotFound(_0x3cf149,null))['then'](respondWithResult(_0x3cf149,null))['catch'](handleError(_0x3cf149,null));};exports[_0xaa9b('0x49')]=function(_0x2845d9,_0x5cd771){return db[_0xaa9b('0x2d')][_0xaa9b('0x49')](_0x2845d9[_0xaa9b('0x4a')],{})['then'](respondWithResult(_0x5cd771,0xc9))[_0xaa9b('0x44')](handleError(_0x5cd771,null));};exports[_0xaa9b('0x25')]=function(_0x2c0b7a,_0x2077e8){if(_0x2c0b7a[_0xaa9b('0x4a')]['id']){delete _0x2c0b7a[_0xaa9b('0x4a')]['id'];}return db[_0xaa9b('0x2d')][_0xaa9b('0x48')]({'where':{'id':_0x2c0b7a[_0xaa9b('0x46')]['id']}})[_0xaa9b('0x26')](handleEntityNotFound(_0x2077e8,null))[_0xaa9b('0x26')](saveUpdates(_0x2c0b7a[_0xaa9b('0x4a')],null))['then'](respondWithResult(_0x2077e8,null))[_0xaa9b('0x44')](handleError(_0x2077e8,null));};exports[_0xaa9b('0x27')]=function(_0x24e2d0,_0x28916e){return db['AnalyticTreeReport'][_0xaa9b('0x48')]({'where':{'id':_0x24e2d0[_0xaa9b('0x46')]['id']}})[_0xaa9b('0x26')](handleEntityNotFound(_0x28916e,null))[_0xaa9b('0x26')](removeEntity(_0x28916e,null))['catch'](handleError(_0x28916e,null));}; \ No newline at end of file +var _0xc96d=['filters','intersection','fields','attributes','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','show','keys','length','find','catch','create','body','update','params','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','rawAttributes','type','key','map','query'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0xc96d,0x1e4));var _0xdc96=function(_0x364e40,_0x83d809){_0x364e40=_0x364e40-0x0;var _0x4fed2a=_0xc96d[_0x364e40];return _0x4fed2a;};'use strict';var emlformat=require(_0xdc96('0x0'));var rimraf=require(_0xdc96('0x1'));var zipdir=require(_0xdc96('0x2'));var jsonpatch=require(_0xdc96('0x3'));var rp=require(_0xdc96('0x4'));var moment=require(_0xdc96('0x5'));var BPromise=require(_0xdc96('0x6'));var Mustache=require(_0xdc96('0x7'));var util=require(_0xdc96('0x8'));var path=require(_0xdc96('0x9'));var sox=require('sox');var csv=require(_0xdc96('0xa'));var ejs=require(_0xdc96('0xb'));var fs=require('fs');var fs_extra=require(_0xdc96('0xc'));var _=require(_0xdc96('0xd'));var squel=require(_0xdc96('0xe'));var crypto=require(_0xdc96('0xf'));var jsforce=require(_0xdc96('0x10'));var deskjs=require(_0xdc96('0x11'));var toCsv=require(_0xdc96('0xa'));var querystring=require(_0xdc96('0x12'));var Papa=require(_0xdc96('0x13'));var Redis=require('ioredis');var authService=require(_0xdc96('0x14'));var qs=require(_0xdc96('0x15'));var as=require(_0xdc96('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdc96('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc96('0x18'))['db'];function respondWithStatusCode(_0x25cdba,_0x3d38a9){_0x3d38a9=_0x3d38a9||0xcc;return function(_0x3bc79e){if(_0x3bc79e){return _0x25cdba[_0xdc96('0x19')](_0x3d38a9);}return _0x25cdba[_0xdc96('0x1a')](_0x3d38a9)[_0xdc96('0x1b')]();};}function respondWithResult(_0x8c040e,_0x5c0ba5){_0x5c0ba5=_0x5c0ba5||0xc8;return function(_0x1e1183){if(_0x1e1183){return _0x8c040e['status'](_0x5c0ba5)[_0xdc96('0x1c')](_0x1e1183);}};}function respondWithFilteredResult(_0x32a48a,_0x40eb6d){return function(_0x5488eb){if(_0x5488eb){var _0x5f3a9c=typeof _0x40eb6d['offset']===_0xdc96('0x1d')&&typeof _0x40eb6d[_0xdc96('0x1e')]===_0xdc96('0x1d');var _0x47b4a9=_0x5488eb[_0xdc96('0x1f')];var _0x3a38d4=_0x5f3a9c?0x0:_0x40eb6d[_0xdc96('0x20')];var _0x4bf0ae=_0x5f3a9c?_0x5488eb[_0xdc96('0x1f')]:_0x40eb6d[_0xdc96('0x20')]+_0x40eb6d[_0xdc96('0x1e')];var _0x4943b7;if(_0x4bf0ae>=_0x47b4a9){_0x4bf0ae=_0x47b4a9;_0x4943b7=0xc8;}else{_0x4943b7=0xce;}_0x32a48a['status'](_0x4943b7);return _0x32a48a[_0xdc96('0x21')](_0xdc96('0x22'),_0x3a38d4+'-'+_0x4bf0ae+'/'+_0x47b4a9)[_0xdc96('0x1c')](_0x5488eb);}return null;};}function patchUpdates(_0x48b11e){return function(_0x3957ff){try{jsonpatch['apply'](_0x3957ff,_0x48b11e,!![]);}catch(_0x1acc4f){return BPromise[_0xdc96('0x23')](_0x1acc4f);}return _0x3957ff[_0xdc96('0x24')]();};}function saveUpdates(_0x4625fb,_0x5418c6){return function(_0x4e5124){if(_0x4e5124){return _0x4e5124['update'](_0x4625fb)[_0xdc96('0x25')](function(_0x4947d3){return _0x4947d3;});}return null;};}function removeEntity(_0x18abed,_0x2b95dc){return function(_0x249d58){if(_0x249d58){return _0x249d58[_0xdc96('0x26')]()[_0xdc96('0x25')](function(){_0x18abed[_0xdc96('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466086,_0x4052fd){return function(_0x583fff){if(!_0x583fff){_0x466086[_0xdc96('0x19')](0x194);}return _0x583fff;};}function handleError(_0x5639ea,_0x3b8561){_0x3b8561=_0x3b8561||0x1f4;return function(_0xbffd29){logger[_0xdc96('0x27')](_0xbffd29[_0xdc96('0x28')]);if(_0xbffd29[_0xdc96('0x29')]){delete _0xbffd29['name'];}_0x5639ea[_0xdc96('0x1a')](_0x3b8561)[_0xdc96('0x2a')](_0xbffd29);};}exports['index']=function(_0x2de094,_0x463ff8){var _0x2617ce={},_0x3592b1={},_0x15d94d={'count':0x0,'rows':[]};var _0x1990f1=_['map'](db['AnalyticTreeReport'][_0xdc96('0x2b')],function(_0x3b8258){return{'name':_0x3b8258['fieldName'],'type':_0x3b8258[_0xdc96('0x2c')][_0xdc96('0x2d')]};});_0x3592b1['model']=_[_0xdc96('0x2e')](_0x1990f1,'name');_0x3592b1[_0xdc96('0x2f')]=_['keys'](_0x2de094[_0xdc96('0x2f')]);_0x3592b1[_0xdc96('0x30')]=_[_0xdc96('0x31')](_0x3592b1['model'],_0x3592b1[_0xdc96('0x2f')]);_0x2617ce['attributes']=_['intersection'](_0x3592b1['model'],qs[_0xdc96('0x32')](_0x2de094['query']['fields']));_0x2617ce[_0xdc96('0x33')]=_0x2617ce[_0xdc96('0x33')]['length']?_0x2617ce[_0xdc96('0x33')]:_0x3592b1[_0xdc96('0x34')];if(!_0x2de094['query'][_0xdc96('0x35')]('nolimit')){_0x2617ce[_0xdc96('0x1e')]=qs['limit'](_0x2de094[_0xdc96('0x2f')]['limit']);_0x2617ce[_0xdc96('0x20')]=qs[_0xdc96('0x20')](_0x2de094[_0xdc96('0x2f')][_0xdc96('0x20')]);}_0x2617ce[_0xdc96('0x36')]=qs[_0xdc96('0x37')](_0x2de094['query'][_0xdc96('0x37')]);_0x2617ce[_0xdc96('0x38')]=qs[_0xdc96('0x30')](_[_0xdc96('0x39')](_0x2de094['query'],_0x3592b1[_0xdc96('0x30')]),_0x1990f1);if(_0x2de094[_0xdc96('0x2f')][_0xdc96('0x3a')]){_0x2617ce['where']=_[_0xdc96('0x3b')](_0x2617ce['where'],{'$or':_[_0xdc96('0x2e')](_0x1990f1,function(_0x3fed23){if(_0x3fed23[_0xdc96('0x2c')]!==_0xdc96('0x3c')){var _0x3e7f50={};_0x3e7f50[_0x3fed23[_0xdc96('0x29')]]={'$like':'%'+_0x2de094[_0xdc96('0x2f')][_0xdc96('0x3a')]+'%'};return _0x3e7f50;}})});}_0x2617ce=_['merge']({},_0x2617ce,_0x2de094[_0xdc96('0x3d')]);var _0x2cb1ca={'where':_0x2617ce[_0xdc96('0x38')]};return db[_0xdc96('0x3e')]['count'](_0x2cb1ca)[_0xdc96('0x25')](function(_0x477c23){_0x15d94d[_0xdc96('0x1f')]=_0x477c23;if(_0x2de094[_0xdc96('0x2f')][_0xdc96('0x3f')]){_0x2617ce[_0xdc96('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xdc96('0x41')](_0x2617ce);})[_0xdc96('0x25')](function(_0x26b6fe){_0x15d94d[_0xdc96('0x42')]=_0x26b6fe;return _0x15d94d;})[_0xdc96('0x25')](respondWithFilteredResult(_0x463ff8,_0x2617ce))['catch'](handleError(_0x463ff8,null));};exports[_0xdc96('0x43')]=function(_0x1ae9cb,_0x5347cd){var _0x21ff11={'raw':!![],'where':{'id':_0x1ae9cb['params']['id']}},_0x5d7021={};_0x5d7021[_0xdc96('0x34')]=_['keys'](db[_0xdc96('0x3e')]['rawAttributes']);_0x5d7021[_0xdc96('0x2f')]=_[_0xdc96('0x44')](_0x1ae9cb[_0xdc96('0x2f')]);_0x5d7021[_0xdc96('0x30')]=_[_0xdc96('0x31')](_0x5d7021['model'],_0x5d7021[_0xdc96('0x2f')]);_0x21ff11[_0xdc96('0x33')]=_['intersection'](_0x5d7021[_0xdc96('0x34')],qs[_0xdc96('0x32')](_0x1ae9cb[_0xdc96('0x2f')][_0xdc96('0x32')]));_0x21ff11[_0xdc96('0x33')]=_0x21ff11[_0xdc96('0x33')][_0xdc96('0x45')]?_0x21ff11['attributes']:_0x5d7021[_0xdc96('0x34')];if(_0x1ae9cb[_0xdc96('0x2f')][_0xdc96('0x3f')]){_0x21ff11[_0xdc96('0x40')]=[{'all':!![]}];}_0x21ff11=_[_0xdc96('0x3b')]({},_0x21ff11,_0x1ae9cb[_0xdc96('0x3d')]);return db['AnalyticTreeReport'][_0xdc96('0x46')](_0x21ff11)[_0xdc96('0x25')](handleEntityNotFound(_0x5347cd,null))['then'](respondWithResult(_0x5347cd,null))[_0xdc96('0x47')](handleError(_0x5347cd,null));};exports['create']=function(_0x4c6557,_0x5d76c6){return db['AnalyticTreeReport'][_0xdc96('0x48')](_0x4c6557[_0xdc96('0x49')],{})[_0xdc96('0x25')](respondWithResult(_0x5d76c6,0xc9))['catch'](handleError(_0x5d76c6,null));};exports[_0xdc96('0x4a')]=function(_0x4a00f7,_0x5c7cf6){if(_0x4a00f7[_0xdc96('0x49')]['id']){delete _0x4a00f7[_0xdc96('0x49')]['id'];}return db[_0xdc96('0x3e')]['find']({'where':{'id':_0x4a00f7[_0xdc96('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5c7cf6,null))[_0xdc96('0x25')](saveUpdates(_0x4a00f7['body'],null))['then'](respondWithResult(_0x5c7cf6,null))[_0xdc96('0x47')](handleError(_0x5c7cf6,null));};exports['destroy']=function(_0x48337e,_0x266f1e){return db[_0xdc96('0x3e')]['find']({'where':{'id':_0x48337e[_0xdc96('0x4b')]['id']}})[_0xdc96('0x25')](handleEntityNotFound(_0x266f1e,null))['then'](removeEntity(_0x266f1e,null))[_0xdc96('0x47')](handleError(_0x266f1e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3f241f1..457cf3c 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 _0xeacb=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','analytics_report_trees','lodash'];(function(_0x5c9f8e,_0x2fff41){var _0x237ddc=function(_0x539e5e){while(--_0x539e5e){_0x5c9f8e['push'](_0x5c9f8e['shift']());}};_0x237ddc(++_0x2fff41);}(_0xeacb,0x77));var _0xbeac=function(_0x496c0b,_0x4bf5b4){_0x496c0b=_0x496c0b-0x0;var _0x531a60=_0xeacb[_0x496c0b];return _0x531a60;};'use strict';var _=require(_0xbeac('0x0'));var util=require(_0xbeac('0x1'));var logger=require(_0xbeac('0x2'))('api');var moment=require(_0xbeac('0x3'));var BPromise=require(_0xbeac('0x4'));var rp=require(_0xbeac('0x5'));var fs=require('fs');var path=require(_0xbeac('0x6'));var rimraf=require(_0xbeac('0x7'));var config=require(_0xbeac('0x8'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x3a35e1,_0x595725){return _0x3a35e1['define']('AnalyticTreeReport',attributes,{'tableName':_0xbeac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ff6=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','lodash','util','../../config/logger','api','moment'];(function(_0x4a567a,_0x9c9416){var _0x5bc161=function(_0x2c11d0){while(--_0x2c11d0){_0x4a567a['push'](_0x4a567a['shift']());}};_0x5bc161(++_0x9c9416);}(_0x1ff6,0x17b));var _0x61ff=function(_0x5b8c2b,_0x155bc3){_0x5b8c2b=_0x5b8c2b-0x0;var _0xe1ff56=_0x1ff6[_0x5b8c2b];return _0xe1ff56;};'use strict';var _=require(_0x61ff('0x0'));var util=require(_0x61ff('0x1'));var logger=require(_0x61ff('0x2'))(_0x61ff('0x3'));var moment=require(_0x61ff('0x4'));var BPromise=require(_0x61ff('0x5'));var rp=require(_0x61ff('0x6'));var fs=require('fs');var path=require(_0x61ff('0x7'));var rimraf=require(_0x61ff('0x8'));var config=require(_0x61ff('0x9'));var attributes=require(_0x61ff('0xa'));module[_0x61ff('0xb')]=function(_0x41888a,_0x82f97e){return _0x41888a['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 6ef1aad..eea84c5 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1aefb5,_0x31a9e0){var _0x330327=function(_0x29bab4){while(--_0x29bab4){_0x1aefb5['push'](_0x1aefb5['shift']());}};_0x330327(++_0x31a9e0);}(_0xdb28,0x106));var _0x8db2=function(_0x486f3d,_0x1fb6a7){_0x486f3d=_0x486f3d-0x0;var _0x545068=_0xdb28[_0x486f3d];return _0x545068;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x55571d,_0x3f8d26){var _0x361198=function(_0x273ffd){while(--_0x273ffd){_0x55571d['push'](_0x55571d['shift']());}};_0x361198(++_0x3f8d26);}(_0x1261,0x144));var _0x1126=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x1261[_0x30c649];return _0x3edfb9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0173d49..9319957 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 _0x6f86=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','create','put','/:id','update','delete','destroy','exports'];(function(_0x64cd41,_0x5964e4){var _0x5d06ea=function(_0x1fe8f3){while(--_0x1fe8f3){_0x64cd41['push'](_0x64cd41['shift']());}};_0x5d06ea(++_0x5964e4);}(_0x6f86,0x110));var _0x66f8=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0x6f86[_0x38cb7c];return _0x2a5f5e;};'use strict';var multer=require(_0x66f8('0x0'));var util=require(_0x66f8('0x1'));var path=require('path');var timeout=require(_0x66f8('0x2'));var express=require(_0x66f8('0x3'));var router=express[_0x66f8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66f8('0x5'));var config=require(_0x66f8('0x6'));var controller=require(_0x66f8('0x7'));router[_0x66f8('0x8')]('/',auth[_0x66f8('0x9')](),controller['index']);router[_0x66f8('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x66f8('0xa')]);router[_0x66f8('0xb')](_0x66f8('0xc'),auth['isAuthenticated'](),controller[_0x66f8('0xd')]);router[_0x66f8('0xe')](_0x66f8('0xc'),auth[_0x66f8('0x9')](),controller[_0x66f8('0xf')]);module[_0x66f8('0x10')]=router; \ No newline at end of file +var _0x8522=['create','put','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x18becc,_0x1600ef){var _0xf6760f=function(_0x4c8a2d){while(--_0x4c8a2d){_0x18becc['push'](_0x18becc['shift']());}};_0xf6760f(++_0x1600ef);}(_0x8522,0x124));var _0x2852=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0x8522[_0x28fbbf];return _0x543af6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2852('0x0'));var timeout=require(_0x2852('0x1'));var express=require(_0x2852('0x2'));var router=express[_0x2852('0x3')]();var fs_extra=require(_0x2852('0x4'));var auth=require(_0x2852('0x5'));var interaction=require(_0x2852('0x6'));var config=require(_0x2852('0x7'));var controller=require(_0x2852('0x8'));router['get']('/',auth[_0x2852('0x9')](),controller[_0x2852('0xa')]);router[_0x2852('0xb')](_0x2852('0xc'),auth[_0x2852('0x9')](),controller[_0x2852('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2852('0xe')]);router[_0x2852('0xf')](_0x2852('0xc'),auth['isAuthenticated'](),controller[_0x2852('0x10')]);router['delete'](_0x2852('0xc'),auth['isAuthenticated'](),controller[_0x2852('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6073d4e..d0c68ff 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 _0x402f=['STRING','sequelize'];(function(_0x5de1be,_0x52033b){var _0x28ded8=function(_0x102cb3){while(--_0x102cb3){_0x5de1be['push'](_0x5de1be['shift']());}};_0x28ded8(++_0x52033b);}(_0x402f,0x6f));var _0xf402=function(_0x5d9645,_0x1588b1){_0x5d9645=_0x5d9645-0x0;var _0x1a6252=_0x402f[_0x5d9645];return _0x1a6252;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'name':{'type':Sequelize[_0xf402('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x85d8=['sequelize','exports','STRING'];(function(_0x58a2d1,_0x704141){var _0x5833db=function(_0x2af0b2){while(--_0x2af0b2){_0x58a2d1['push'](_0x58a2d1['shift']());}};_0x5833db(++_0x704141);}(_0x85d8,0x1b0));var _0x885d=function(_0x238d72,_0x5b9350){_0x238d72=_0x238d72-0x0;var _0x29e624=_0x85d8[_0x238d72];return _0x29e624;};'use strict';var Sequelize=require(_0x885d('0x0'));module[_0x885d('0x1')]={'name':{'type':Sequelize[_0x885d('0x2')]},'basename':{'type':Sequelize[_0x885d('0x2')]},'type':{'type':Sequelize[_0x885d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 459d61b..d8f8e4b 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 _0x60c5=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','includeAll','include','Attachment','findAll','rows','show','params','merge','options','find','clone','get','omit','createdAt','updatedAt','body','create','catch','file','originalname','basename','filename','download','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x14573f,_0x6acdc2){var _0xfcc373=function(_0x568d45){while(--_0x568d45){_0x14573f['push'](_0x14573f['shift']());}};_0xfcc373(++_0x6acdc2);}(_0x60c5,0x10f));var _0x560c=function(_0x484cb1,_0x5a031e){_0x484cb1=_0x484cb1-0x0;var _0x3c61fa=_0x60c5[_0x484cb1];return _0x3c61fa;};'use strict';var emlformat=require(_0x560c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x560c('0x1'));var jsonpatch=require(_0x560c('0x2'));var rp=require(_0x560c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x560c('0x4'));var util=require(_0x560c('0x5'));var path=require(_0x560c('0x6'));var sox=require('sox');var csv=require(_0x560c('0x7'));var ejs=require(_0x560c('0x8'));var fs=require('fs');var fs_extra=require(_0x560c('0x9'));var _=require(_0x560c('0xa'));var squel=require(_0x560c('0xb'));var crypto=require(_0x560c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x560c('0xd'));var toCsv=require(_0x560c('0x7'));var querystring=require(_0x560c('0xe'));var Papa=require(_0x560c('0xf'));var Redis=require(_0x560c('0x10'));var authService=require(_0x560c('0x11'));var qs=require(_0x560c('0x12'));var as=require(_0x560c('0x13'));var hardwareService=require(_0x560c('0x14'));var logger=require(_0x560c('0x15'))(_0x560c('0x16'));var utils=require(_0x560c('0x17'));var config=require(_0x560c('0x18'));var licenseUtil=require(_0x560c('0x19'));var db=require(_0x560c('0x1a'))['db'];function respondWithStatusCode(_0x393d71,_0x5a622f){_0x5a622f=_0x5a622f||0xcc;return function(_0x492374){if(_0x492374){return _0x393d71[_0x560c('0x1b')](_0x5a622f);}return _0x393d71[_0x560c('0x1c')](_0x5a622f)[_0x560c('0x1d')]();};}function respondWithResult(_0x222ff4,_0xf69131){_0xf69131=_0xf69131||0xc8;return function(_0x2feedf){if(_0x2feedf){return _0x222ff4[_0x560c('0x1c')](_0xf69131)[_0x560c('0x1e')](_0x2feedf);}};}function respondWithFilteredResult(_0x267f73,_0x25f3c1){return function(_0x4be569){if(_0x4be569){var _0x264c54=typeof _0x25f3c1[_0x560c('0x1f')]===_0x560c('0x20')&&typeof _0x25f3c1[_0x560c('0x21')]==='undefined';var _0x405287=_0x4be569[_0x560c('0x22')];var _0x4458df=_0x264c54?0x0:_0x25f3c1[_0x560c('0x1f')];var _0x3c0daa=_0x264c54?_0x4be569[_0x560c('0x22')]:_0x25f3c1[_0x560c('0x1f')]+_0x25f3c1[_0x560c('0x21')];var _0x4a433b;if(_0x3c0daa>=_0x405287){_0x3c0daa=_0x405287;_0x4a433b=0xc8;}else{_0x4a433b=0xce;}_0x267f73[_0x560c('0x1c')](_0x4a433b);return _0x267f73[_0x560c('0x23')]('Content-Range',_0x4458df+'-'+_0x3c0daa+'/'+_0x405287)[_0x560c('0x1e')](_0x4be569);}return null;};}function patchUpdates(_0x8af431){return function(_0x1daeeb){try{jsonpatch[_0x560c('0x24')](_0x1daeeb,_0x8af431,!![]);}catch(_0x290b47){return BPromise[_0x560c('0x25')](_0x290b47);}return _0x1daeeb[_0x560c('0x26')]();};}function saveUpdates(_0x23c711,_0xca396c){return function(_0x4c29e8){if(_0x4c29e8){return _0x4c29e8[_0x560c('0x27')](_0x23c711)['then'](function(_0x39b5e0){return _0x39b5e0;});}return null;};}function removeEntity(_0x2c6c23,_0x45ebb1){return function(_0x5493a8){if(_0x5493a8){return _0x5493a8[_0x560c('0x28')]()[_0x560c('0x29')](function(){_0x2c6c23['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d79a,_0x8cf338){return function(_0x4a8719){if(!_0x4a8719){_0x48d79a[_0x560c('0x1b')](0x194);}return _0x4a8719;};}function handleError(_0xdf59fe,_0x2f4897){_0x2f4897=_0x2f4897||0x1f4;return function(_0x488ce9){logger[_0x560c('0x2a')](_0x488ce9['stack']);if(_0x488ce9[_0x560c('0x2b')]){delete _0x488ce9['name'];}_0xdf59fe[_0x560c('0x1c')](_0x2f4897)[_0x560c('0x2c')](_0x488ce9);};}exports[_0x560c('0x2d')]=function(_0x24bca7,_0x31cc31){var _0x36cc85={},_0x1266d7={},_0x14e1df={'count':0x0,'rows':[]};var _0x2e4676=_[_0x560c('0x2e')](db['Attachment'][_0x560c('0x2f')],function(_0x2e69cc){return{'name':_0x2e69cc['fieldName'],'type':_0x2e69cc['type'][_0x560c('0x30')]};});_0x1266d7[_0x560c('0x31')]=_[_0x560c('0x2e')](_0x2e4676,_0x560c('0x2b'));_0x1266d7[_0x560c('0x32')]=_[_0x560c('0x33')](_0x24bca7[_0x560c('0x32')]);_0x1266d7[_0x560c('0x34')]=_[_0x560c('0x35')](_0x1266d7['model'],_0x1266d7[_0x560c('0x32')]);_0x36cc85[_0x560c('0x36')]=_[_0x560c('0x35')](_0x1266d7['model'],qs[_0x560c('0x37')](_0x24bca7[_0x560c('0x32')]['fields']));_0x36cc85['attributes']=_0x36cc85[_0x560c('0x36')][_0x560c('0x38')]?_0x36cc85['attributes']:_0x1266d7[_0x560c('0x31')];if(!_0x24bca7[_0x560c('0x32')][_0x560c('0x39')](_0x560c('0x3a'))){_0x36cc85[_0x560c('0x21')]=qs['limit'](_0x24bca7[_0x560c('0x32')][_0x560c('0x21')]);_0x36cc85[_0x560c('0x1f')]=qs[_0x560c('0x1f')](_0x24bca7[_0x560c('0x32')][_0x560c('0x1f')]);}_0x36cc85[_0x560c('0x3b')]=qs[_0x560c('0x3c')](_0x24bca7[_0x560c('0x32')][_0x560c('0x3c')]);_0x36cc85[_0x560c('0x3d')]=qs[_0x560c('0x34')](_[_0x560c('0x3e')](_0x24bca7[_0x560c('0x32')],_0x1266d7[_0x560c('0x34')]),_0x2e4676);if(_0x24bca7['query']['filter']){_0x36cc85[_0x560c('0x3d')]=_['merge'](_0x36cc85['where'],{'$or':_['map'](_0x2e4676,function(_0xedd7f0){if(_0xedd7f0[_0x560c('0x3f')]!==_0x560c('0x40')){var _0x500803={};_0x500803[_0xedd7f0[_0x560c('0x2b')]]={'$like':'%'+_0x24bca7[_0x560c('0x32')]['filter']+'%'};return _0x500803;}})});}_0x36cc85=_['merge']({},_0x36cc85,_0x24bca7['options']);var _0x57ff47={'where':_0x36cc85[_0x560c('0x3d')]};return db['Attachment'][_0x560c('0x22')](_0x57ff47)[_0x560c('0x29')](function(_0x318b21){_0x14e1df[_0x560c('0x22')]=_0x318b21;if(_0x24bca7['query'][_0x560c('0x41')]){_0x36cc85[_0x560c('0x42')]=[{'all':!![]}];}return db[_0x560c('0x43')][_0x560c('0x44')](_0x36cc85);})[_0x560c('0x29')](function(_0x959095){_0x14e1df[_0x560c('0x45')]=_0x959095;return _0x14e1df;})[_0x560c('0x29')](respondWithFilteredResult(_0x31cc31,_0x36cc85))['catch'](handleError(_0x31cc31,null));};exports[_0x560c('0x46')]=function(_0x5d7c43,_0x455ffd){var _0x19011c={'raw':!![],'where':{'id':_0x5d7c43[_0x560c('0x47')]['id']}},_0x3fadf2={};_0x3fadf2['model']=_[_0x560c('0x33')](db[_0x560c('0x43')][_0x560c('0x2f')]);_0x3fadf2[_0x560c('0x32')]=_['keys'](_0x5d7c43['query']);_0x3fadf2['filters']=_[_0x560c('0x35')](_0x3fadf2[_0x560c('0x31')],_0x3fadf2[_0x560c('0x32')]);_0x19011c[_0x560c('0x36')]=_[_0x560c('0x35')](_0x3fadf2[_0x560c('0x31')],qs[_0x560c('0x37')](_0x5d7c43[_0x560c('0x32')][_0x560c('0x37')]));_0x19011c['attributes']=_0x19011c[_0x560c('0x36')][_0x560c('0x38')]?_0x19011c['attributes']:_0x3fadf2[_0x560c('0x31')];if(_0x5d7c43[_0x560c('0x32')][_0x560c('0x41')]){_0x19011c[_0x560c('0x42')]=[{'all':!![]}];}_0x19011c=_[_0x560c('0x48')]({},_0x19011c,_0x5d7c43[_0x560c('0x49')]);return db[_0x560c('0x43')][_0x560c('0x4a')](_0x19011c)[_0x560c('0x29')](handleEntityNotFound(_0x455ffd,null))[_0x560c('0x29')](respondWithResult(_0x455ffd,null))['catch'](handleError(_0x455ffd,null));};exports[_0x560c('0x4b')]=function(_0x4581a9,_0x3d2c6c){var _0x8ade42={'where':{'id':_0x4581a9[_0x560c('0x47')]['id']}},_0x403a21={};_0x403a21[_0x560c('0x31')]=_[_0x560c('0x33')](db['Attachment']['rawAttributes']);_0x8ade42['attributes']=_[_0x560c('0x35')](_0x403a21[_0x560c('0x31')],qs[_0x560c('0x37')](_0x4581a9[_0x560c('0x32')][_0x560c('0x37')]));_0x8ade42[_0x560c('0x36')]=_0x8ade42['attributes']['length']?_0x8ade42['attributes']:_0x403a21[_0x560c('0x31')];if(_0x4581a9[_0x560c('0x32')][_0x560c('0x41')]){_0x8ade42['include']=[{'all':!![]}];}_0x8ade42=_[_0x560c('0x48')]({},_0x8ade42,_0x4581a9[_0x560c('0x49')]);return db[_0x560c('0x43')][_0x560c('0x4a')](_0x8ade42)[_0x560c('0x29')](handleEntityNotFound(_0x3d2c6c,null))[_0x560c('0x29')](function(_0xe8b931){if(_0xe8b931){var _0x2a9287=_0xe8b931[_0x560c('0x4c')]({'plain':!![]});_0x2a9287=qs[_0x560c('0x4d')](_0x2a9287,['id',_0x560c('0x4e'),_0x560c('0x4f')]);_0x4581a9['body']=_[_0x560c('0x4d')](_0x4581a9[_0x560c('0x50')],['id',_0x560c('0x4e'),_0x560c('0x4f')]);return db[_0x560c('0x43')][_0x560c('0x51')](_[_0x560c('0x48')](_0x2a9287,_0x4581a9['body']),{'include':_0x4581a9[_0x560c('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x560c('0x29')](respondWithResult(_0x3d2c6c,0xc9))['catch'](handleError(_0x3d2c6c,null));};exports[_0x560c('0x27')]=function(_0x2ccdd4,_0x5f4251){if(_0x2ccdd4[_0x560c('0x50')]['id']){delete _0x2ccdd4[_0x560c('0x50')]['id'];}return db[_0x560c('0x43')][_0x560c('0x4a')]({'where':{'id':_0x2ccdd4[_0x560c('0x47')]['id']}})[_0x560c('0x29')](handleEntityNotFound(_0x5f4251,null))[_0x560c('0x29')](saveUpdates(_0x2ccdd4[_0x560c('0x50')],null))[_0x560c('0x29')](respondWithResult(_0x5f4251,null))[_0x560c('0x52')](handleError(_0x5f4251,null));};exports[_0x560c('0x28')]=function(_0x533777,_0x7526b4){return db[_0x560c('0x43')][_0x560c('0x4a')]({'where':{'id':_0x533777[_0x560c('0x47')]['id']}})[_0x560c('0x29')](handleEntityNotFound(_0x7526b4,null))[_0x560c('0x29')](removeEntity(_0x7526b4,null))[_0x560c('0x52')](handleError(_0x7526b4,null));};exports[_0x560c('0x51')]=function(_0x590e80,_0x559891,_0x50f34f){_0x590e80[_0x560c('0x50')][_0x560c('0x2b')]=_0x590e80[_0x560c('0x53')][_0x560c('0x54')];_0x590e80['body'][_0x560c('0x55')]=_0x590e80[_0x560c('0x53')][_0x560c('0x56')];_0x590e80[_0x560c('0x50')][_0x560c('0x3f')]=_0x590e80['file']['mimetype'];return db[_0x560c('0x43')][_0x560c('0x51')](_0x590e80[_0x560c('0x50')])[_0x560c('0x29')](respondWithResult(_0x559891,0xc9))[_0x560c('0x52')](handleError(_0x559891,null));};exports[_0x560c('0x57')]=function(_0x558ebc,_0x43580d,_0x23621c){return db[_0x560c('0x43')]['findOne']({'where':{'id':_0x558ebc[_0x560c('0x47')]['id']},'raw':!![]})[_0x560c('0x29')](handleEntityNotFound(_0x43580d,null))['then'](function(_0x396f4a){if(_0x396f4a){var _0x498ce9=_0x396f4a[_0x560c('0x58')]!==null;var _0x49eeec=path[_0x560c('0x59')](config['root'],_0x560c('0x5a'));if(_0x498ce9){_0x49eeec=path['join'](_0x49eeec,_0x560c('0x5b'));}var _0x3531a5=path['join'](_0x49eeec,_0x396f4a['basename']);return _0x43580d[_0x560c('0x57')](_0x3531a5);}})['catch'](handleError(_0x43580d,null));}; \ No newline at end of file +var _0xfd1b=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','rows','catch','show','params','length','find','get','createdAt','updatedAt','body','omit','create','destroy','file','basename','filename','mimetype','findOne','ChatOfflineMessageId','root','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x57b3f9,_0x5a4ef5){var _0xbc5579=function(_0x4f67a0){while(--_0x4f67a0){_0x57b3f9['push'](_0x57b3f9['shift']());}};_0xbc5579(++_0x5a4ef5);}(_0xfd1b,0x1ab));var _0xbfd1=function(_0x2e3dd1,_0x29b549){_0x2e3dd1=_0x2e3dd1-0x0;var _0x39de59=_0xfd1b[_0x2e3dd1];return _0x39de59;};'use strict';var emlformat=require(_0xbfd1('0x0'));var rimraf=require(_0xbfd1('0x1'));var zipdir=require(_0xbfd1('0x2'));var jsonpatch=require(_0xbfd1('0x3'));var rp=require(_0xbfd1('0x4'));var moment=require('moment');var BPromise=require(_0xbfd1('0x5'));var Mustache=require(_0xbfd1('0x6'));var util=require('util');var path=require(_0xbfd1('0x7'));var sox=require(_0xbfd1('0x8'));var csv=require(_0xbfd1('0x9'));var ejs=require(_0xbfd1('0xa'));var fs=require('fs');var fs_extra=require(_0xbfd1('0xb'));var _=require(_0xbfd1('0xc'));var squel=require(_0xbfd1('0xd'));var crypto=require(_0xbfd1('0xe'));var jsforce=require(_0xbfd1('0xf'));var deskjs=require(_0xbfd1('0x10'));var toCsv=require(_0xbfd1('0x9'));var querystring=require('querystring');var Papa=require(_0xbfd1('0x11'));var Redis=require('ioredis');var authService=require(_0xbfd1('0x12'));var qs=require(_0xbfd1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfd1('0x14'));var logger=require(_0xbfd1('0x15'))('api');var utils=require(_0xbfd1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbfd1('0x17'))['db'];function respondWithStatusCode(_0x36ab7a,_0x1ec7c5){_0x1ec7c5=_0x1ec7c5||0xcc;return function(_0x5cee80){if(_0x5cee80){return _0x36ab7a[_0xbfd1('0x18')](_0x1ec7c5);}return _0x36ab7a[_0xbfd1('0x19')](_0x1ec7c5)[_0xbfd1('0x1a')]();};}function respondWithResult(_0x258fde,_0x1e15df){_0x1e15df=_0x1e15df||0xc8;return function(_0x49fa53){if(_0x49fa53){return _0x258fde[_0xbfd1('0x19')](_0x1e15df)[_0xbfd1('0x1b')](_0x49fa53);}};}function respondWithFilteredResult(_0x50a2ea,_0x4be34d){return function(_0x3e96ca){if(_0x3e96ca){var _0x240654=typeof _0x4be34d['offset']===_0xbfd1('0x1c')&&typeof _0x4be34d[_0xbfd1('0x1d')]==='undefined';var _0x5a5f33=_0x3e96ca[_0xbfd1('0x1e')];var _0x57b2f2=_0x240654?0x0:_0x4be34d[_0xbfd1('0x1f')];var _0x36d79b=_0x240654?_0x3e96ca[_0xbfd1('0x1e')]:_0x4be34d[_0xbfd1('0x1f')]+_0x4be34d[_0xbfd1('0x1d')];var _0x29fcfe;if(_0x36d79b>=_0x5a5f33){_0x36d79b=_0x5a5f33;_0x29fcfe=0xc8;}else{_0x29fcfe=0xce;}_0x50a2ea[_0xbfd1('0x19')](_0x29fcfe);return _0x50a2ea[_0xbfd1('0x20')](_0xbfd1('0x21'),_0x57b2f2+'-'+_0x36d79b+'/'+_0x5a5f33)[_0xbfd1('0x1b')](_0x3e96ca);}return null;};}function patchUpdates(_0xe11483){return function(_0x4a6419){try{jsonpatch['apply'](_0x4a6419,_0xe11483,!![]);}catch(_0x1ce5d4){return BPromise[_0xbfd1('0x22')](_0x1ce5d4);}return _0x4a6419[_0xbfd1('0x23')]();};}function saveUpdates(_0x436f45,_0x45b4a4){return function(_0x2a77c6){if(_0x2a77c6){return _0x2a77c6[_0xbfd1('0x24')](_0x436f45)['then'](function(_0x42b616){return _0x42b616;});}return null;};}function removeEntity(_0x337f34,_0xd1ccc4){return function(_0x4a981a){if(_0x4a981a){return _0x4a981a['destroy']()['then'](function(){_0x337f34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8151,_0x283cdd){return function(_0x4ea1fe){if(!_0x4ea1fe){_0x4e8151[_0xbfd1('0x18')](0x194);}return _0x4ea1fe;};}function handleError(_0x36f07e,_0x2bf725){_0x2bf725=_0x2bf725||0x1f4;return function(_0xeda9d0){logger[_0xbfd1('0x25')](_0xeda9d0['stack']);if(_0xeda9d0[_0xbfd1('0x26')]){delete _0xeda9d0[_0xbfd1('0x26')];}_0x36f07e[_0xbfd1('0x19')](_0x2bf725)[_0xbfd1('0x27')](_0xeda9d0);};}exports[_0xbfd1('0x28')]=function(_0xd0fab8,_0x15533d){var _0x1febe6={},_0x890073={},_0x22df43={'count':0x0,'rows':[]};var _0x281bc8=_[_0xbfd1('0x29')](db[_0xbfd1('0x2a')][_0xbfd1('0x2b')],function(_0x3e2df4){return{'name':_0x3e2df4[_0xbfd1('0x2c')],'type':_0x3e2df4[_0xbfd1('0x2d')][_0xbfd1('0x2e')]};});_0x890073[_0xbfd1('0x2f')]=_[_0xbfd1('0x29')](_0x281bc8,_0xbfd1('0x26'));_0x890073[_0xbfd1('0x30')]=_[_0xbfd1('0x31')](_0xd0fab8[_0xbfd1('0x30')]);_0x890073[_0xbfd1('0x32')]=_[_0xbfd1('0x33')](_0x890073[_0xbfd1('0x2f')],_0x890073['query']);_0x1febe6[_0xbfd1('0x34')]=_[_0xbfd1('0x33')](_0x890073['model'],qs[_0xbfd1('0x35')](_0xd0fab8[_0xbfd1('0x30')][_0xbfd1('0x35')]));_0x1febe6[_0xbfd1('0x34')]=_0x1febe6[_0xbfd1('0x34')]['length']?_0x1febe6[_0xbfd1('0x34')]:_0x890073['model'];if(!_0xd0fab8['query'][_0xbfd1('0x36')]('nolimit')){_0x1febe6['limit']=qs[_0xbfd1('0x1d')](_0xd0fab8[_0xbfd1('0x30')][_0xbfd1('0x1d')]);_0x1febe6[_0xbfd1('0x1f')]=qs[_0xbfd1('0x1f')](_0xd0fab8[_0xbfd1('0x30')][_0xbfd1('0x1f')]);}_0x1febe6['order']=qs[_0xbfd1('0x37')](_0xd0fab8[_0xbfd1('0x30')][_0xbfd1('0x37')]);_0x1febe6[_0xbfd1('0x38')]=qs['filters'](_[_0xbfd1('0x39')](_0xd0fab8['query'],_0x890073[_0xbfd1('0x32')]),_0x281bc8);if(_0xd0fab8[_0xbfd1('0x30')]['filter']){_0x1febe6['where']=_[_0xbfd1('0x3a')](_0x1febe6['where'],{'$or':_[_0xbfd1('0x29')](_0x281bc8,function(_0x11fc76){if(_0x11fc76[_0xbfd1('0x2d')]!==_0xbfd1('0x3b')){var _0x1916d1={};_0x1916d1[_0x11fc76[_0xbfd1('0x26')]]={'$like':'%'+_0xd0fab8[_0xbfd1('0x30')][_0xbfd1('0x3c')]+'%'};return _0x1916d1;}})});}_0x1febe6=_[_0xbfd1('0x3a')]({},_0x1febe6,_0xd0fab8[_0xbfd1('0x3d')]);var _0x3d025c={'where':_0x1febe6[_0xbfd1('0x38')]};return db[_0xbfd1('0x2a')]['count'](_0x3d025c)[_0xbfd1('0x3e')](function(_0x5ad8f4){_0x22df43['count']=_0x5ad8f4;if(_0xd0fab8[_0xbfd1('0x30')][_0xbfd1('0x3f')]){_0x1febe6[_0xbfd1('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x1febe6);})[_0xbfd1('0x3e')](function(_0x25303a){_0x22df43[_0xbfd1('0x41')]=_0x25303a;return _0x22df43;})[_0xbfd1('0x3e')](respondWithFilteredResult(_0x15533d,_0x1febe6))[_0xbfd1('0x42')](handleError(_0x15533d,null));};exports[_0xbfd1('0x43')]=function(_0x265abb,_0x434b27){var _0x4d8c5d={'raw':!![],'where':{'id':_0x265abb[_0xbfd1('0x44')]['id']}},_0x380185={};_0x380185[_0xbfd1('0x2f')]=_[_0xbfd1('0x31')](db[_0xbfd1('0x2a')]['rawAttributes']);_0x380185['query']=_[_0xbfd1('0x31')](_0x265abb[_0xbfd1('0x30')]);_0x380185['filters']=_['intersection'](_0x380185[_0xbfd1('0x2f')],_0x380185['query']);_0x4d8c5d[_0xbfd1('0x34')]=_[_0xbfd1('0x33')](_0x380185['model'],qs['fields'](_0x265abb[_0xbfd1('0x30')][_0xbfd1('0x35')]));_0x4d8c5d[_0xbfd1('0x34')]=_0x4d8c5d[_0xbfd1('0x34')][_0xbfd1('0x45')]?_0x4d8c5d['attributes']:_0x380185[_0xbfd1('0x2f')];if(_0x265abb[_0xbfd1('0x30')][_0xbfd1('0x3f')]){_0x4d8c5d[_0xbfd1('0x40')]=[{'all':!![]}];}_0x4d8c5d=_[_0xbfd1('0x3a')]({},_0x4d8c5d,_0x265abb[_0xbfd1('0x3d')]);return db[_0xbfd1('0x2a')][_0xbfd1('0x46')](_0x4d8c5d)[_0xbfd1('0x3e')](handleEntityNotFound(_0x434b27,null))[_0xbfd1('0x3e')](respondWithResult(_0x434b27,null))[_0xbfd1('0x42')](handleError(_0x434b27,null));};exports['clone']=function(_0xc29bc2,_0x1efc64){var _0x2184f8={'where':{'id':_0xc29bc2[_0xbfd1('0x44')]['id']}},_0x3cf05c={};_0x3cf05c[_0xbfd1('0x2f')]=_[_0xbfd1('0x31')](db[_0xbfd1('0x2a')][_0xbfd1('0x2b')]);_0x2184f8['attributes']=_[_0xbfd1('0x33')](_0x3cf05c[_0xbfd1('0x2f')],qs['fields'](_0xc29bc2['query']['fields']));_0x2184f8[_0xbfd1('0x34')]=_0x2184f8[_0xbfd1('0x34')][_0xbfd1('0x45')]?_0x2184f8[_0xbfd1('0x34')]:_0x3cf05c[_0xbfd1('0x2f')];if(_0xc29bc2[_0xbfd1('0x30')][_0xbfd1('0x3f')]){_0x2184f8['include']=[{'all':!![]}];}_0x2184f8=_[_0xbfd1('0x3a')]({},_0x2184f8,_0xc29bc2[_0xbfd1('0x3d')]);return db[_0xbfd1('0x2a')][_0xbfd1('0x46')](_0x2184f8)[_0xbfd1('0x3e')](handleEntityNotFound(_0x1efc64,null))[_0xbfd1('0x3e')](function(_0x24bbb6){if(_0x24bbb6){var _0x358a5d=_0x24bbb6[_0xbfd1('0x47')]({'plain':!![]});_0x358a5d=qs['omit'](_0x358a5d,['id',_0xbfd1('0x48'),_0xbfd1('0x49')]);_0xc29bc2[_0xbfd1('0x4a')]=_[_0xbfd1('0x4b')](_0xc29bc2['body'],['id',_0xbfd1('0x48'),_0xbfd1('0x49')]);return db['Attachment'][_0xbfd1('0x4c')](_[_0xbfd1('0x3a')](_0x358a5d,_0xc29bc2['body']),{'include':_0xc29bc2['query'][_0xbfd1('0x3f')]?[{'all':!![]}]:undefined});}})[_0xbfd1('0x3e')](respondWithResult(_0x1efc64,0xc9))[_0xbfd1('0x42')](handleError(_0x1efc64,null));};exports[_0xbfd1('0x24')]=function(_0x8f22a1,_0x3a4d78){if(_0x8f22a1[_0xbfd1('0x4a')]['id']){delete _0x8f22a1[_0xbfd1('0x4a')]['id'];}return db[_0xbfd1('0x2a')]['find']({'where':{'id':_0x8f22a1[_0xbfd1('0x44')]['id']}})[_0xbfd1('0x3e')](handleEntityNotFound(_0x3a4d78,null))['then'](saveUpdates(_0x8f22a1['body'],null))['then'](respondWithResult(_0x3a4d78,null))['catch'](handleError(_0x3a4d78,null));};exports[_0xbfd1('0x4d')]=function(_0x517dfa,_0x264ecf){return db[_0xbfd1('0x2a')][_0xbfd1('0x46')]({'where':{'id':_0x517dfa['params']['id']}})['then'](handleEntityNotFound(_0x264ecf,null))['then'](removeEntity(_0x264ecf,null))[_0xbfd1('0x42')](handleError(_0x264ecf,null));};exports[_0xbfd1('0x4c')]=function(_0x4c8dfe,_0x3ffb30,_0x1d9e6a){_0x4c8dfe[_0xbfd1('0x4a')][_0xbfd1('0x26')]=_0x4c8dfe[_0xbfd1('0x4e')]['originalname'];_0x4c8dfe[_0xbfd1('0x4a')][_0xbfd1('0x4f')]=_0x4c8dfe[_0xbfd1('0x4e')][_0xbfd1('0x50')];_0x4c8dfe[_0xbfd1('0x4a')]['type']=_0x4c8dfe[_0xbfd1('0x4e')][_0xbfd1('0x51')];return db[_0xbfd1('0x2a')]['create'](_0x4c8dfe[_0xbfd1('0x4a')])[_0xbfd1('0x3e')](respondWithResult(_0x3ffb30,0xc9))[_0xbfd1('0x42')](handleError(_0x3ffb30,null));};exports['download']=function(_0x22b08e,_0x4484da,_0x46c44b){return db[_0xbfd1('0x2a')][_0xbfd1('0x52')]({'where':{'id':_0x22b08e[_0xbfd1('0x44')]['id']},'raw':!![]})[_0xbfd1('0x3e')](handleEntityNotFound(_0x4484da,null))[_0xbfd1('0x3e')](function(_0x377387){if(_0x377387){var _0x5df941=_0x377387[_0xbfd1('0x53')]!==null;var _0x138b1d=path['join'](config[_0xbfd1('0x54')],'server/files/attachments/');if(_0x5df941){_0x138b1d=path[_0xbfd1('0x55')](_0x138b1d,_0xbfd1('0x56'));}var _0x446b55=path[_0xbfd1('0x55')](_0x138b1d,_0x377387[_0xbfd1('0x4f')]);return _0x4484da['download'](_0x446b55);}})[_0xbfd1('0x42')](handleError(_0x4484da,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 97296da..e209036 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 _0x03ed=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03ed,0x191));var _0xd03e=function(_0x563c25,_0x41e2c3){_0x563c25=_0x563c25-0x0;var _0x532eb6=_0x03ed[_0x563c25];return _0x532eb6;};'use strict';var _=require(_0xd03e('0x0'));var util=require(_0xd03e('0x1'));var logger=require(_0xd03e('0x2'))('api');var moment=require(_0xd03e('0x3'));var BPromise=require(_0xd03e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd03e('0x5'));var rimraf=require(_0xd03e('0x6'));var config=require(_0xd03e('0x7'));var attributes=require(_0xd03e('0x8'));module[_0xd03e('0x9')]=function(_0x40613d,_0x57f7cb){return _0x40613d[_0xd03e('0xa')](_0xd03e('0xb'),attributes,{'tableName':_0xd03e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7fa=['../../config/environment','exports','define','attachments','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x152ba8,_0x56f0cc){var _0x2759dc=function(_0x48a9cd){while(--_0x48a9cd){_0x152ba8['push'](_0x152ba8['shift']());}};_0x2759dc(++_0x56f0cc);}(_0xe7fa,0xd5));var _0xae7f=function(_0x2743ad,_0x5669b6){_0x2743ad=_0x2743ad-0x0;var _0x15a93b=_0xe7fa[_0x2743ad];return _0x15a93b;};'use strict';var _=require('lodash');var util=require(_0xae7f('0x0'));var logger=require('../../config/logger')(_0xae7f('0x1'));var moment=require(_0xae7f('0x2'));var BPromise=require(_0xae7f('0x3'));var rp=require(_0xae7f('0x4'));var fs=require('fs');var path=require(_0xae7f('0x5'));var rimraf=require(_0xae7f('0x6'));var config=require(_0xae7f('0x7'));var attributes=require('./attachment.attributes');module[_0xae7f('0x8')]=function(_0x347f98,_0x352ad5){return _0x347f98[_0xae7f('0x9')]('Attachment',attributes,{'tableName':_0xae7f('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 7ef1c15..0c91b15 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 _0x7341=['../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','then','CreateAttachment','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x883aed,_0x4c442b){var _0x1e82ef=function(_0x36fa33){while(--_0x36fa33){_0x883aed['push'](_0x883aed['shift']());}};_0x1e82ef(++_0x4c442b);}(_0x7341,0xe4));var _0x1734=function(_0x20837d,_0x473e9f){_0x20837d=_0x20837d-0x0;var _0x5c9287=_0x7341[_0x20837d];return _0x5c9287;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1734('0x0'));var BPromise=require('bluebird');var rs=require(_0x1734('0x1'));var fs=require('fs');var Redis=require(_0x1734('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1734('0x3'));var logger=require(_0x1734('0x4'))(_0x1734('0x5'));var config=require(_0x1734('0x6'));var jayson=require(_0x1734('0x7'));var client=jayson[_0x1734('0x8')][_0x1734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c7349,_0x1ca30b,_0x2c223d){return new BPromise(function(_0x45c529,_0x5b8977){return client[_0x1734('0xa')](_0x4c7349,_0x2c223d)['then'](function(_0x56f0d5){logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));logger[_0x1734('0xe')](_0x1734('0xf'),_0x1ca30b,_0x1734('0xd'),JSON[_0x1734('0x10')](_0x56f0d5));if(_0x56f0d5[_0x1734('0x11')]){if(_0x56f0d5[_0x1734('0x11')][_0x1734('0x12')]===0x1f4){logger['error'](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x5b8977(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}logger[_0x1734('0x11')](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x45c529(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}else{logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));_0x45c529(_0x56f0d5[_0x1734('0x14')][_0x1734('0x13')]);}})[_0x1734('0x15')](function(_0x1ea188){logger[_0x1734('0x11')]('Attachment,\x20%s,\x20%s',_0x1ca30b,_0x1ea188);_0x5b8977(_0x1ea188);});});}exports['CreateAttachment']=function(_0x1fa9c0){var _0x665ddc=this;return new Promise(function(_0x4a86d1,_0x212e63){return db['Attachment']['create'](_0x1fa9c0['body'],{'raw':_0x1fa9c0[_0x1734('0x16')]?_0x1fa9c0['options'][_0x1734('0x17')]===undefined?!![]:![]:!![]})[_0x1734('0x18')](function(_0x4fc4ed){logger['info']('CreateAttachment',_0x1fa9c0);logger[_0x1734('0xe')]('CreateAttachment',_0x1fa9c0,JSON[_0x1734('0x10')](_0x4fc4ed));_0x4a86d1(_0x4fc4ed);})['catch'](function(_0x215ae4){logger[_0x1734('0x11')](_0x1734('0x19'),_0x215ae4[_0x1734('0x13')],_0x1fa9c0);_0x212e63(_0x665ddc[_0x1734('0x11')](0x1f4,_0x215ae4[_0x1734('0x13')]));});});}; \ No newline at end of file +var _0x3667=['request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xc9e63e,_0x85efd1){var _0x2c224a=function(_0x5cca5b){while(--_0x5cca5b){_0xc9e63e['push'](_0xc9e63e['shift']());}};_0x2c224a(++_0x85efd1);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var moment=require(_0x7366('0x2'));var BPromise=require(_0x7366('0x3'));var rs=require(_0x7366('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7366('0x5'))['db'];var utils=require(_0x7366('0x6'));var logger=require('../../config/logger')(_0x7366('0x7'));var config=require(_0x7366('0x8'));var jayson=require(_0x7366('0x9'));var client=jayson[_0x7366('0xa')][_0x7366('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x589397,_0x28f6c8,_0xa1a3c5){return new BPromise(function(_0x2dd32b,_0x26e9a9){return client[_0x7366('0xc')](_0x589397,_0xa1a3c5)[_0x7366('0xd')](function(_0x1995c7){logger[_0x7366('0xe')](_0x7366('0xf'),_0x28f6c8,_0x7366('0x10'));logger[_0x7366('0x11')](_0x7366('0x12'),_0x28f6c8,_0x7366('0x10'),JSON[_0x7366('0x13')](_0x1995c7));if(_0x1995c7[_0x7366('0x14')]){if(_0x1995c7[_0x7366('0x14')][_0x7366('0x15')]===0x1f4){logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);return _0x26e9a9(_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);}logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);return _0x2dd32b(_0x1995c7[_0x7366('0x14')]['message']);}else{logger[_0x7366('0xe')](_0x7366('0xf'),_0x28f6c8,_0x7366('0x10'));_0x2dd32b(_0x1995c7[_0x7366('0x17')][_0x7366('0x16')]);}})[_0x7366('0x18')](function(_0x2bc2af){logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x2bc2af);_0x26e9a9(_0x2bc2af);});});}exports[_0x7366('0x19')]=function(_0x1a71f5){var _0x49e50b=this;return new Promise(function(_0x208ac8,_0x4ffbc7){return db[_0x7366('0x1a')][_0x7366('0x1b')](_0x1a71f5[_0x7366('0x1c')],{'raw':_0x1a71f5['options']?_0x1a71f5[_0x7366('0x1d')][_0x7366('0x1e')]===undefined?!![]:![]:!![]})[_0x7366('0xd')](function(_0x532ce2){logger[_0x7366('0xe')](_0x7366('0x19'),_0x1a71f5);logger['debug'](_0x7366('0x19'),_0x1a71f5,JSON[_0x7366('0x13')](_0x532ce2));_0x208ac8(_0x532ce2);})[_0x7366('0x18')](function(_0x1a12d2){logger[_0x7366('0x14')](_0x7366('0x19'),_0x1a12d2[_0x7366('0x16')],_0x1a71f5);_0x4ffbc7(_0x49e50b[_0x7366('0x14')](0x1f4,_0x1a12d2[_0x7366('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 72dacfe..a336926 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x462f5e,_0x39c6fb){var _0xb96df2=function(_0x4259c4){while(--_0x4259c4){_0x462f5e['push'](_0x462f5e['shift']());}};_0xb96df2(++_0x39c6fb);}(_0xb10b,0x12a));var _0xbb10=function(_0xef4fc0,_0x33cc41){_0xef4fc0=_0xef4fc0-0x0;var _0x57dade=_0xb10b[_0xef4fc0];return _0x57dade;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1d33785..647dae3 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 _0x6f9b=['then','find','map','emails','value','admin','user','agent','disabled','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','moment','../../config/environment','signToken','../../config/utils','login','google','/login','profile','email','authenticate','clientID','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x8a8c28,_0x2d4a07){var _0x588b3a=function(_0x3d4ac5){while(--_0x3d4ac5){_0x8a8c28['push'](_0x8a8c28['shift']());}};_0x588b3a(++_0x2d4a07);}(_0x6f9b,0x118));var _0xb6f9=function(_0x25b043,_0x1609a5){_0x25b043=_0x25b043-0x0;var _0x4e51e9=_0x6f9b[_0x25b043];return _0x4e51e9;};'use strict';var _=require('lodash');var passport=require(_0xb6f9('0x0'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0xb6f9('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xb6f9('0x2'));var signToken=require('../../components/auth/service')[_0xb6f9('0x3')];var utils=require(_0xb6f9('0x4'));exports[_0xb6f9('0x5')]=passport['authenticate'](_0xb6f9('0x6'),{'failureRedirect':_0xb6f9('0x7'),'scope':[_0xb6f9('0x8'),_0xb6f9('0x9')],'session':![]});exports['callback']=passport[_0xb6f9('0xa')](_0xb6f9('0x6'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0xb6f9('0x6')]?config[_0xb6f9('0x6')][_0xb6f9('0xb')]:'id','clientSecret':config['google']?config[_0xb6f9('0x6')]['clientSecret']:'secret','callbackURL':config[_0xb6f9('0x6')]?config[_0xb6f9('0x6')][_0xb6f9('0xc')]:''},function(_0x2e1824,_0xc9261b,_0x3b1cc1,_0x4aa2c0){var _0x5b0ec4,_0x343084;return db[_0xb6f9('0xd')][_0xb6f9('0xe')]({'where':{'id':0x1},'attributes':[_0xb6f9('0xf'),_0xb6f9('0x10')],'raw':!![]})[_0xb6f9('0x11')](function(_0x2200c3){_0x5b0ec4=_0x2200c3;return db['User'][_0xb6f9('0x12')]({'where':{'email':_[_0xb6f9('0x13')](_0x3b1cc1[_0xb6f9('0x14')],_0xb6f9('0x15')),'role':{'$or':[_0xb6f9('0x16'),_0xb6f9('0x17'),_0xb6f9('0x18')]}}});})[_0xb6f9('0x11')](function(_0x4670d5){_0x343084=_0x4670d5;if(_0x343084){if(_0x343084[_0xb6f9('0x19')]){return _0x4aa2c0('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x5b0ec4[_0xb6f9('0x10')]>0x0){if(_0x343084['blocked']){if(moment(_0x343084[_0xb6f9('0x1a')])[_0xb6f9('0x1b')](_0x5b0ec4[_0xb6f9('0x10')],_0xb6f9('0x1c'))>moment()){return _0x4aa2c0(_0xb6f9('0x1d'));}else{return utils[_0xb6f9('0x1e')](_0x343084,0x0,![],null)[_0xb6f9('0x11')](function(){return utils[_0xb6f9('0x1f')](_0x343084);})['then'](function(){return _0x4aa2c0(null,_0x343084);});}}else{return utils[_0xb6f9('0x1f')](_0x343084)[_0xb6f9('0x11')](function(){return _0x4aa2c0(null,_0x343084);});}}else{return utils[_0xb6f9('0x1f')](_0x343084)[_0xb6f9('0x11')](function(){return _0x4aa2c0(null,_0x343084);});}}return _0x4aa2c0(_0xb6f9('0x1d'));})[_0xb6f9('0x20')](function(_0x220e47){_0x4aa2c0(_0x220e47);});})); \ No newline at end of file +var _0xa112=['passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','authenticate','google','/login','profile','email','clientID','secret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','User','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','getLicense','catch','lodash'];(function(_0x37e85c,_0x1a26f7){var _0x1a7ccc=function(_0x3b018f){while(--_0x3b018f){_0x37e85c['push'](_0x37e85c['shift']());}};_0x1a7ccc(++_0x1a26f7);}(_0xa112,0x153));var _0x2a11=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xa112[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x2a11('0x0'));var passport=require(_0x2a11('0x1'));var GoogleStrategy=require(_0x2a11('0x2'))[_0x2a11('0x3')];var moment=require(_0x2a11('0x4'));var db=require(_0x2a11('0x5'))['db'];var config=require(_0x2a11('0x6'));var signToken=require(_0x2a11('0x7'))['signToken'];var utils=require(_0x2a11('0x8'));exports['login']=passport[_0x2a11('0x9')](_0x2a11('0xa'),{'failureRedirect':_0x2a11('0xb'),'scope':[_0x2a11('0xc'),_0x2a11('0xd')],'session':![]});exports['callback']=passport['authenticate'](_0x2a11('0xa'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x2a11('0xa')]?config[_0x2a11('0xa')][_0x2a11('0xe')]:'id','clientSecret':config[_0x2a11('0xa')]?config[_0x2a11('0xa')]['clientSecret']:_0x2a11('0xf'),'callbackURL':config[_0x2a11('0xa')]?config[_0x2a11('0xa')][_0x2a11('0x10')]:''},function(_0x16b7e3,_0x22f378,_0x520c47,_0x395d3f){var _0x512568,_0x32d040;return db[_0x2a11('0x11')]['findOne']({'where':{'id':0x1},'attributes':[_0x2a11('0x12'),_0x2a11('0x13')],'raw':!![]})[_0x2a11('0x14')](function(_0x1092bc){_0x512568=_0x1092bc;return db[_0x2a11('0x15')]['find']({'where':{'email':_['map'](_0x520c47[_0x2a11('0x16')],_0x2a11('0x17')),'role':{'$or':[_0x2a11('0x18'),_0x2a11('0x19'),_0x2a11('0x1a')]}}});})[_0x2a11('0x14')](function(_0x5e0110){_0x32d040=_0x5e0110;if(_0x32d040){if(_0x32d040[_0x2a11('0x1b')]){return _0x395d3f(_0x2a11('0x1c'));}else if(_0x512568[_0x2a11('0x13')]>0x0){if(_0x32d040[_0x2a11('0x1d')]){if(moment(_0x32d040[_0x2a11('0x1e')])['add'](_0x512568[_0x2a11('0x13')],_0x2a11('0x1f'))>moment()){return _0x395d3f(_0x2a11('0x1c'));}else{return utils['clearBlockUser'](_0x32d040,0x0,![],null)[_0x2a11('0x14')](function(){return utils['getLicense'](_0x32d040);})[_0x2a11('0x14')](function(){return _0x395d3f(null,_0x32d040);});}}else{return utils[_0x2a11('0x20')](_0x32d040)[_0x2a11('0x14')](function(){return _0x395d3f(null,_0x32d040);});}}else{return utils[_0x2a11('0x20')](_0x32d040)[_0x2a11('0x14')](function(){return _0x395d3f(null,_0x32d040);});}}return _0x395d3f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x2a11('0x21')](function(_0x4a334c){_0x395d3f(_0x4a334c);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7d09faf..a7f8fbc 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 _0xc911=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x183180,_0x2739e3){var _0x1b42e2=function(_0x4df432){while(--_0x4df432){_0x183180['push'](_0x183180['shift']());}};_0x1b42e2(++_0x2739e3);}(_0xc911,0x1ea));var _0x1c91=function(_0x31a880,_0x200652){_0x31a880=_0x31a880-0x0;var _0x13ebf9=_0xc911[_0x31a880];return _0x13ebf9;};'use strict';var express=require(_0x1c91('0x0'));var passport=require(_0x1c91('0x1'));var router=express[_0x1c91('0x2')]();var controller=require(_0x1c91('0x3'));var userController=require(_0x1c91('0x4'));var authService=require(_0x1c91('0x5'));router[_0x1c91('0x6')]('/',controller['login']);router['get'](_0x1c91('0x7'),controller[_0x1c91('0x8')],authService[_0x1c91('0x9')],userController['login'],authService[_0x1c91('0xa')]);module[_0x1c91('0xb')]=router; \ No newline at end of file +var _0x56d8=['/callback','setTokenCookie','exports','express','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x935fc8,_0x2e6376){var _0x2bd2e4=function(_0x35a00f){while(--_0x35a00f){_0x935fc8['push'](_0x935fc8['shift']());}};_0x2bd2e4(++_0x2e6376);}(_0x56d8,0x1a1));var _0x856d=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x56d8[_0x9df060];return _0x338dfe;};'use strict';var express=require(_0x856d('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x856d('0x1'));var userController=require(_0x856d('0x2'));var authService=require(_0x856d('0x3'));router[_0x856d('0x4')]('/',controller[_0x856d('0x5')]);router[_0x856d('0x4')](_0x856d('0x6'),controller['callback'],authService['isMiddleware'],userController[_0x856d('0x5')],authService[_0x856d('0x7')]);module[_0x856d('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5e0e52b..1357b53 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 _0x1663=['disabled','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','forgot','body','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','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://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','passport','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','salt','role','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','blockDuration','minutes','clearBlockUser'];(function(_0x4ecf0a,_0x5bffc3){var _0x163994=function(_0x3a0d66){while(--_0x3a0d66){_0x4ecf0a['push'](_0x4ecf0a['shift']());}};_0x163994(++_0x5bffc3);}(_0x1663,0x95));var _0x3166=function(_0x1db6ce,_0x43fd8f){_0x1db6ce=_0x1db6ce-0x0;var _0x1b73ce=_0x1663[_0x1db6ce];return _0x1b73ce;};'use strict';var util=require('util');var passport=require(_0x3166('0x0'));var LocalStrategy=require('passport-local')[_0x3166('0x1')];var jayson=require('jayson/promise');var _=require(_0x3166('0x2'));var rs=require(_0x3166('0x3'));var moment=require(_0x3166('0x4'));var db=require(_0x3166('0x5'))['db'];var authService=require(_0x3166('0x6'));var utils=require(_0x3166('0x7'));var client=jayson[_0x3166('0x8')][_0x3166('0x9')]({'port':0x232b});function localAuthenticate(_0x26923d,_0x338308,_0x256a56,_0x2c7d74){var _0x4ac68e,_0x492c9f;return db[_0x3166('0xa')][_0x3166('0xb')]({'where':{'id':0x1},'attributes':[_0x3166('0xc'),'blockDuration'],'raw':!![]})[_0x3166('0xd')](function(_0x297904){_0x4ac68e=_0x297904;return _0x26923d[_0x3166('0xb')]({'attributes':['id',_0x3166('0xe'),'password',_0x3166('0xf'),_0x3166('0x10'),'disabled','blocked',_0x3166('0x11'),_0x3166('0x12')],'where':{'name':_0x338308,'role':{'$or':[_0x3166('0x13'),'user','agent']}}});})[_0x3166('0xd')](function(_0x4889da){if(!_0x4889da||_0x4889da&&_0x4889da[_0x3166('0xe')]!==_0x338308){throw new Error(_0x3166('0x14'));}else{_0x492c9f=_0x4889da;return _0x492c9f;}})['then'](function(){_0x492c9f[_0x3166('0x15')](_0x256a56,function(_0xc05bd8,_0x5745a9){var _0x1d1ad4=_0x492c9f[_0x3166('0x12')]+0x1;if(_0xc05bd8){return _0x2c7d74(_0xc05bd8);}else if(!_0x5745a9){if(_0x492c9f['disabled']){return _0x2c7d74(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ac68e['allowedLoginAttempts']>0x0){if(_0x492c9f[_0x3166('0x16')]){if(_0x4ac68e['blockDuration']>0x0){if(moment(_0x492c9f[_0x3166('0x11')])[_0x3166('0x17')](_0x4ac68e[_0x3166('0x18')],_0x3166('0x19'))>moment()){return _0x2c7d74(null,![],{'message':_0x3166('0x14')});}else{return utils[_0x3166('0x1a')](_0x492c9f,_0x1d1ad4,![],null)[_0x3166('0xd')](function(){return _0x2c7d74(null,![],{'message':_0x3166('0x14')});});}}else{return _0x2c7d74(null,![],{'message':_0x3166('0x14')});}}else{if(_0x1d1ad4>=_0x4ac68e[_0x3166('0xc')]){return utils[_0x3166('0x1a')](_0x492c9f,0x0,!![],moment())[_0x3166('0xd')](function(){return _0x2c7d74(null,![],{'message':_0x3166('0x14')});});}else{return utils[_0x3166('0x1a')](_0x492c9f,_0x1d1ad4,![],null)[_0x3166('0xd')](function(){return _0x2c7d74(null,![],{'message':_0x3166('0x14')});});}}}else{return _0x2c7d74(null,![],{'message':_0x3166('0x14')});}}else{if(_0x492c9f[_0x3166('0x1b')]){return _0x2c7d74(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ac68e[_0x3166('0xc')]>0x0){if(_0x492c9f[_0x3166('0x16')]){if(_0x4ac68e[_0x3166('0x18')]>0x0){if(moment(_0x492c9f['blockedAt'])['add'](_0x4ac68e[_0x3166('0x18')],_0x3166('0x19'))>moment()){return _0x2c7d74(null,![],{'message':_0x3166('0x14')});}else{return utils[_0x3166('0x1a')](_0x492c9f,0x0,![],null)['then'](function(){return utils[_0x3166('0x1c')](_0x492c9f);})[_0x3166('0xd')](function(){return _0x2c7d74(null,_0x492c9f);});}}else{return _0x2c7d74(null,![],{'message':_0x3166('0x14')});}}else{return utils[_0x3166('0x1a')](_0x492c9f,0x0,![],null)['then'](function(){return utils['getLicense'](_0x492c9f);})[_0x3166('0xd')](function(){return _0x2c7d74(null,_0x492c9f);})[_0x3166('0x1d')](function(_0x3f0af5){return _0x2c7d74(null,![],_0x3f0af5);});}}else{if(_0x492c9f['blocked']){return _0x2c7d74(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x492c9f)[_0x3166('0xd')](function(){return _0x2c7d74(null,_0x492c9f);});}}}});})[_0x3166('0x1d')](function(_0x3e63e8){return _0x2c7d74(null,![],_0x3e63e8);});}function sendServiceMail(_0x14bd96){return db['MailAccount'][_0x3166('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x3166('0xe'),_0x3166('0x1f')],'include':[{'model':db[_0x3166('0x20')],'as':_0x3166('0x21')}]})['then'](function(_0x31f80d){if(!_0x31f80d){throw new Error(_0x3166('0x22'));}var _0x2ebbd2={'tls':{'rejectUnauthorized':![]}};if(_0x31f80d[_0x3166('0x21')][_0x3166('0x23')]){_0x2ebbd2[_0x3166('0x23')]=_0x31f80d[_0x3166('0x21')][_0x3166('0x23')];}else{_0x2ebbd2[_0x3166('0x24')]=_0x31f80d['Smtp'][_0x3166('0x24')];_0x2ebbd2[_0x3166('0x25')]=_0x31f80d[_0x3166('0x21')][_0x3166('0x25')];_0x2ebbd2[_0x3166('0x26')]=_0x31f80d[_0x3166('0x21')]['secure'];}if(_0x31f80d[_0x3166('0x21')][_0x3166('0x27')]){_0x2ebbd2[_0x3166('0x28')]={'user':_0x31f80d['Smtp'][_0x3166('0x29')],'pass':_0x31f80d[_0x3166('0x21')][_0x3166('0x2a')]};}var _0x2b8a53={'account':_0x2ebbd2,'message':_[_0x3166('0x2b')]({'from':util[_0x3166('0x2c')](_0x3166('0x2d'),_0x31f80d[_0x3166('0xe')],_0x31f80d['email']||_0x31f80d[_0x3166('0x21')]['user'])},_0x14bd96)};return client[_0x3166('0x2e')](_0x3166('0x2f'),_0x2b8a53);})[_0x3166('0xd')](function(_0x4d49c4){if(_0x4d49c4['error']){throw new Error(util['format'](_0x3166('0x30'),_0x4d49c4['error'][_0x3166('0x31')]||JSON[_0x3166('0x32')](_0x4d49c4['error'])));}return!![];});}function handleError(_0x15d5dc,_0x89c676,_0x4236d2){return _0x15d5dc[_0x3166('0x33')](_0x89c676||0x1f4)[_0x3166('0x34')]({'message':_0x4236d2?_0x4236d2[_0x3166('0x31')]||_0x4236d2:''});}exports[_0x3166('0x35')]=function(_0x2c0380,_0x194f95,_0x46de27){passport['authenticate'](_0x3166('0x36'),function(_0x188346,_0xe558a3,_0x67a703){var _0x2f3dd8=_0x188346||_0x67a703;if(_0x2f3dd8){return handleError(_0x194f95,0x191,_0x2f3dd8);}if(!_0xe558a3){return handleError(_0x194f95,0x194,{'message':_0x3166('0x37')});}else{var _0x3b286e={'payload':{'id':_0xe558a3['id'],'role':_0xe558a3[_0x3166('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3b286e)[_0x3166('0xd')](function(_0x10017b){_0x194f95[_0x3166('0x38')]({'id':_0xe558a3['id'],'token':_0x10017b,'statusCall':'','isAlreadyLogged':_0xe558a3['online']});});}})(_0x2c0380,_0x194f95,_0x46de27);};exports[_0x3166('0x39')]=function(_0x4ae2a4,_0x2ec78d,_0x270e36){if(!_0x4ae2a4[_0x3166('0x3a')][_0x3166('0x1f')]){return handleError(_0x2ec78d,0x1f4,{'message':_0x3166('0x3b')});}var _0x588b99=rs[_0x3166('0x3c')]();_0x4ae2a4[_0x3166('0x3a')][_0x3166('0x1f')]=_0x4ae2a4[_0x3166('0x3a')]['email'][_0x3166('0x3d')]()[_0x3166('0x3e')]();var _0x48757a;return db[_0x3166('0xa')][_0x3166('0xb')]({'where':{'id':0x1},'attributes':[_0x3166('0xc'),'blockDuration'],'raw':!![]})[_0x3166('0xd')](function(_0x568079){_0x48757a=_0x568079;return db[_0x3166('0x3f')][_0x3166('0x1e')]({'where':{'email':_0x4ae2a4[_0x3166('0x3a')][_0x3166('0x1f')]}});})[_0x3166('0xd')](function(_0x37b3b2){if(!_0x37b3b2){throw new Error(_0x3166('0x40'));}if(_0x37b3b2['disabled']){throw new Error(_0x3166('0x41'));}if(_0x37b3b2[_0x3166('0x16')]){if(moment(_0x37b3b2['blockedAt'])[_0x3166('0x17')](_0x48757a[_0x3166('0x18')],_0x3166('0x19'))>moment()){throw new Error(_0x3166('0x42'));}else{_0x37b3b2[_0x3166('0x16')]=![];_0x37b3b2[_0x3166('0x11')]=null;}}_0x37b3b2[_0x3166('0x43')]=_0x588b99;_0x37b3b2[_0x3166('0x44')]=Date[_0x3166('0x45')]()+0x36ee80;return _0x37b3b2[_0x3166('0x46')]();})[_0x3166('0xd')](function(){return sendServiceMail({'to':_0x4ae2a4[_0x3166('0x3a')][_0x3166('0x1f')],'subject':_0x3166('0x47'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x3166('0x48')+_0x3166('0x49')+_0x4ae2a4['headers'][_0x3166('0x24')]+_0x3166('0x4a')+_0x588b99+'\x0a\x0a'+_0x3166('0x4b')});})[_0x3166('0xd')](function(){_0x2ec78d[_0x3166('0x33')](0xc8)['send']({'message':_0x3166('0x4c')});})[_0x3166('0x1d')](function(_0x1dd6d3){return handleError(_0x2ec78d,0x1f4,_0x1dd6d3);});};exports[_0x3166('0x4d')]=function(_0x911d40,_0x237b5b,_0x3e874d){return db[_0x3166('0x3f')]['find']({'where':{'resetPasswordToken':_0x911d40[_0x3166('0x4e')][_0x3166('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x3166('0x45')]()}}})[_0x3166('0xd')](function(_0x325b6c){if(!_0x325b6c){throw new Error(_0x3166('0x50'));}return db[_0x3166('0xa')][_0x3166('0xb')]({'attributes':['id',_0x3166('0x51'),'enforcePasswordHistory',_0x3166('0x52')]})[_0x3166('0xd')](function(_0x162c5f){if(_0x162c5f[_0x3166('0x51')])authService['validatePasswordPattern'](_0x911d40[_0x3166('0x3a')][_0x3166('0x53')]);if(!_0x162c5f[_0x3166('0x54')]||!_0x325b6c[_0x3166('0x55')])return _0x325b6c;authService[_0x3166('0x56')](_0x911d40[_0x3166('0x3a')][_0x3166('0x53')],_0x325b6c[_0x3166('0x55')],_0x162c5f[_0x3166('0x52')]);return _0x325b6c;})[_0x3166('0xd')](function(){_0x325b6c[_0x3166('0x53')]=_0x911d40[_0x3166('0x3a')][_0x3166('0x53')];_0x325b6c[_0x3166('0x43')]=null;_0x325b6c['resetPasswordExpires']=null;return _0x325b6c[_0x3166('0x46')]();});})[_0x3166('0xd')](function(){_0x237b5b[_0x3166('0x33')](0xc8)[_0x3166('0x34')]({'message':_0x3166('0x57')});})['catch'](function(_0x3074c4){return handleError(_0x237b5b,0x1f4,_0x3074c4);});};passport['use'](new LocalStrategy({'usernameField':_0x3166('0xe'),'passwordField':_0x3166('0x53')},function(_0x1f4ba4,_0x4f56ed,_0x484ad1){return localAuthenticate(db[_0x3166('0x3f')],_0x1f4ba4,_0x4f56ed,_0x484ad1);})); \ No newline at end of file +var _0x75c5=['../../components/auth/service','client','http','Setting','findOne','blockDuration','then','name','salt','disabled','blocked','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp','host','port','secure','authentication','auth','format','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','email','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','blockedAt','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb'];(function(_0x44d2a1,_0x22c302){var _0x319606=function(_0x397b82){while(--_0x397b82){_0x44d2a1['push'](_0x44d2a1['shift']());}};_0x319606(++_0x22c302);}(_0x75c5,0xfb));var _0x575c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75c5[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x575c('0x0'));var passport=require(_0x575c('0x1'));var LocalStrategy=require(_0x575c('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x575c('0x3'));var rs=require(_0x575c('0x4'));var moment=require(_0x575c('0x5'));var db=require(_0x575c('0x6'))['db'];var authService=require(_0x575c('0x7'));var utils=require('../../config/utils');var client=jayson[_0x575c('0x8')][_0x575c('0x9')]({'port':0x232b});function localAuthenticate(_0x62e644,_0xc786e7,_0x2d0629,_0x204764){var _0x163b31,_0x207199;return db[_0x575c('0xa')][_0x575c('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x575c('0xc')],'raw':!![]})[_0x575c('0xd')](function(_0x54767d){_0x163b31=_0x54767d;return _0x62e644[_0x575c('0xb')]({'attributes':['id',_0x575c('0xe'),'password',_0x575c('0xf'),'role',_0x575c('0x10'),_0x575c('0x11'),'blockedAt','loginAttempts'],'where':{'name':_0xc786e7,'role':{'$or':['admin',_0x575c('0x12'),_0x575c('0x13')]}}});})[_0x575c('0xd')](function(_0x1d71bb){if(!_0x1d71bb||_0x1d71bb&&_0x1d71bb[_0x575c('0xe')]!==_0xc786e7){throw new Error(_0x575c('0x14'));}else{_0x207199=_0x1d71bb;return _0x207199;}})['then'](function(){_0x207199[_0x575c('0x15')](_0x2d0629,function(_0x40a57c,_0xa2cd02){var _0x41edcb=_0x207199[_0x575c('0x16')]+0x1;if(_0x40a57c){return _0x204764(_0x40a57c);}else if(!_0xa2cd02){if(_0x207199[_0x575c('0x10')]){return _0x204764(null,![],{'message':_0x575c('0x14')});}else if(_0x163b31[_0x575c('0x17')]>0x0){if(_0x207199['blocked']){if(_0x163b31[_0x575c('0xc')]>0x0){if(moment(_0x207199['blockedAt'])[_0x575c('0x18')](_0x163b31[_0x575c('0xc')],_0x575c('0x19'))>moment()){return _0x204764(null,![],{'message':_0x575c('0x14')});}else{return utils[_0x575c('0x1a')](_0x207199,_0x41edcb,![],null)[_0x575c('0xd')](function(){return _0x204764(null,![],{'message':_0x575c('0x14')});});}}else{return _0x204764(null,![],{'message':_0x575c('0x14')});}}else{if(_0x41edcb>=_0x163b31[_0x575c('0x17')]){return utils[_0x575c('0x1a')](_0x207199,0x0,!![],moment())[_0x575c('0xd')](function(){return _0x204764(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x575c('0x1a')](_0x207199,_0x41edcb,![],null)['then'](function(){return _0x204764(null,![],{'message':_0x575c('0x14')});});}}}else{return _0x204764(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x207199[_0x575c('0x10')]){return _0x204764(null,![],{'message':_0x575c('0x14')});}else if(_0x163b31['allowedLoginAttempts']>0x0){if(_0x207199['blocked']){if(_0x163b31[_0x575c('0xc')]>0x0){if(moment(_0x207199['blockedAt'])[_0x575c('0x18')](_0x163b31['blockDuration'],_0x575c('0x19'))>moment()){return _0x204764(null,![],{'message':_0x575c('0x14')});}else{return utils[_0x575c('0x1a')](_0x207199,0x0,![],null)[_0x575c('0xd')](function(){return utils[_0x575c('0x1b')](_0x207199);})[_0x575c('0xd')](function(){return _0x204764(null,_0x207199);});}}else{return _0x204764(null,![],{'message':_0x575c('0x14')});}}else{return utils[_0x575c('0x1a')](_0x207199,0x0,![],null)[_0x575c('0xd')](function(){return utils[_0x575c('0x1b')](_0x207199);})[_0x575c('0xd')](function(){return _0x204764(null,_0x207199);})['catch'](function(_0x32c038){return _0x204764(null,![],_0x32c038);});}}else{if(_0x207199[_0x575c('0x11')]){return _0x204764(null,![],{'message':_0x575c('0x14')});}else{return utils[_0x575c('0x1b')](_0x207199)[_0x575c('0xd')](function(){return _0x204764(null,_0x207199);});}}}});})[_0x575c('0x1c')](function(_0x41497a){return _0x204764(null,![],_0x41497a);});}function sendServiceMail(_0x17b1cd){return db[_0x575c('0x1d')]['find']({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x575c('0x1e')],'as':'Smtp'}]})[_0x575c('0xd')](function(_0x1bcd11){if(!_0x1bcd11){throw new Error(_0x575c('0x1f'));}var _0x594575={'tls':{'rejectUnauthorized':![]}};if(_0x1bcd11['Smtp'][_0x575c('0x20')]){_0x594575['service']=_0x1bcd11[_0x575c('0x21')][_0x575c('0x20')];}else{_0x594575['host']=_0x1bcd11[_0x575c('0x21')][_0x575c('0x22')];_0x594575[_0x575c('0x23')]=_0x1bcd11[_0x575c('0x21')][_0x575c('0x23')];_0x594575[_0x575c('0x24')]=_0x1bcd11[_0x575c('0x21')][_0x575c('0x24')];}if(_0x1bcd11[_0x575c('0x21')][_0x575c('0x25')]){_0x594575[_0x575c('0x26')]={'user':_0x1bcd11[_0x575c('0x21')]['user'],'pass':_0x1bcd11['Smtp']['pass']};}var _0x18f0ec={'account':_0x594575,'message':_['merge']({'from':util[_0x575c('0x27')]('\x22%s\x22\x20<%s>',_0x1bcd11[_0x575c('0xe')],_0x1bcd11['email']||_0x1bcd11[_0x575c('0x21')][_0x575c('0x12')])},_0x17b1cd)};return client[_0x575c('0x28')]('SendMail',_0x18f0ec);})[_0x575c('0xd')](function(_0x1e694e){if(_0x1e694e[_0x575c('0x29')]){throw new Error(util['format'](_0x575c('0x2a'),_0x1e694e[_0x575c('0x29')][_0x575c('0x2b')]||JSON[_0x575c('0x2c')](_0x1e694e[_0x575c('0x29')])));}return!![];});}function handleError(_0x3bdd1b,_0x50f9f1,_0x441865){return _0x3bdd1b[_0x575c('0x2d')](_0x50f9f1||0x1f4)[_0x575c('0x2e')]({'message':_0x441865?_0x441865[_0x575c('0x2b')]||_0x441865:''});}exports[_0x575c('0x2f')]=function(_0x1503dd,_0x5ca678,_0x5005f6){passport[_0x575c('0x15')](_0x575c('0x30'),function(_0x38c7c1,_0x59ea5e,_0x34acf5){var _0x4bbea=_0x38c7c1||_0x34acf5;if(_0x4bbea){return handleError(_0x5ca678,0x191,_0x4bbea);}if(!_0x59ea5e){return handleError(_0x5ca678,0x194,{'message':_0x575c('0x31')});}else{var _0x13e11f={'payload':{'id':_0x59ea5e['id'],'role':_0x59ea5e[_0x575c('0x32')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x13e11f)[_0x575c('0xd')](function(_0x563913){_0x5ca678[_0x575c('0x33')]({'id':_0x59ea5e['id'],'token':_0x563913,'statusCall':'','isAlreadyLogged':_0x59ea5e['online']});});}})(_0x1503dd,_0x5ca678,_0x5005f6);};exports['forgot']=function(_0x246816,_0x2a8c06,_0x13a789){if(!_0x246816['body'][_0x575c('0x34')]){return handleError(_0x2a8c06,0x1f4,{'message':_0x575c('0x35')});}var _0x76fe12=rs[_0x575c('0x36')]();_0x246816[_0x575c('0x37')][_0x575c('0x34')]=_0x246816[_0x575c('0x37')][_0x575c('0x34')][_0x575c('0x38')]()[_0x575c('0x39')]();var _0x245666;return db[_0x575c('0xa')][_0x575c('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x575c('0xc')],'raw':!![]})[_0x575c('0xd')](function(_0x10b9d2){_0x245666=_0x10b9d2;return db[_0x575c('0x3a')][_0x575c('0x3b')]({'where':{'email':_0x246816[_0x575c('0x37')][_0x575c('0x34')]}});})[_0x575c('0xd')](function(_0x56315a){if(!_0x56315a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x56315a[_0x575c('0x10')]){throw new Error(_0x575c('0x3c'));}if(_0x56315a[_0x575c('0x11')]){if(moment(_0x56315a[_0x575c('0x3d')])['add'](_0x245666[_0x575c('0xc')],_0x575c('0x19'))>moment()){throw new Error(_0x575c('0x3e'));}else{_0x56315a[_0x575c('0x11')]=![];_0x56315a['blockedAt']=null;}}_0x56315a[_0x575c('0x3f')]=_0x76fe12;_0x56315a[_0x575c('0x40')]=Date['now']()+0x36ee80;return _0x56315a[_0x575c('0x41')]();})[_0x575c('0xd')](function(){return sendServiceMail({'to':_0x246816['body'][_0x575c('0x34')],'subject':_0x575c('0x42'),'text':_0x575c('0x43')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x575c('0x44')+_0x246816[_0x575c('0x45')][_0x575c('0x22')]+_0x575c('0x46')+_0x76fe12+'\x0a\x0a'+_0x575c('0x47')});})[_0x575c('0xd')](function(){_0x2a8c06[_0x575c('0x2d')](0xc8)[_0x575c('0x2e')]({'message':_0x575c('0x48')});})[_0x575c('0x1c')](function(_0x4fa6cc){return handleError(_0x2a8c06,0x1f4,_0x4fa6cc);});};exports[_0x575c('0x49')]=function(_0x3bf240,_0xf04b49,_0x7af69f){return db['User']['find']({'where':{'resetPasswordToken':_0x3bf240[_0x575c('0x4a')][_0x575c('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x575c('0xd')](function(_0x2419b5){if(!_0x2419b5){throw new Error(_0x575c('0x4c'));}return db[_0x575c('0xa')][_0x575c('0xb')]({'attributes':['id',_0x575c('0x4d'),_0x575c('0x4e'),_0x575c('0x4f')]})[_0x575c('0xd')](function(_0x116bed){if(_0x116bed[_0x575c('0x4d')])authService[_0x575c('0x50')](_0x3bf240['body'][_0x575c('0x51')]);if(!_0x116bed['enforcePasswordHistory']||!_0x2419b5[_0x575c('0x52')])return _0x2419b5;authService[_0x575c('0x53')](_0x3bf240[_0x575c('0x37')][_0x575c('0x51')],_0x2419b5[_0x575c('0x52')],_0x116bed[_0x575c('0x4f')]);return _0x2419b5;})[_0x575c('0xd')](function(){_0x2419b5[_0x575c('0x51')]=_0x3bf240[_0x575c('0x37')][_0x575c('0x51')];_0x2419b5['resetPasswordToken']=null;_0x2419b5[_0x575c('0x40')]=null;return _0x2419b5[_0x575c('0x41')]();});})[_0x575c('0xd')](function(){_0xf04b49[_0x575c('0x2d')](0xc8)[_0x575c('0x2e')]({'message':_0x575c('0x54')});})[_0x575c('0x1c')](function(_0x3defd2){return handleError(_0xf04b49,0x1f4,_0x3defd2);});};passport[_0x575c('0x55')](new LocalStrategy({'usernameField':'name','passwordField':_0x575c('0x51')},function(_0x2b2999,_0x1226a1,_0x2392e6){return localAuthenticate(db['User'],_0x2b2999,_0x1226a1,_0x2392e6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ab92876..3fc3291 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 _0x5713=['login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x2c71a0,_0x4e210d){var _0x5b0451=function(_0x121c9e){while(--_0x121c9e){_0x2c71a0['push'](_0x2c71a0['shift']());}};_0x5b0451(++_0x4e210d);}(_0x5713,0xd8));var _0x3571=function(_0xf84af4,_0x3ffc0e){_0xf84af4=_0xf84af4-0x0;var _0x17f0d1=_0x5713[_0xf84af4];return _0x17f0d1;};'use strict';var express=require(_0x3571('0x0'));var router=express[_0x3571('0x1')]();var controller=require(_0x3571('0x2'));router[_0x3571('0x3')]('/',controller[_0x3571('0x4')]);router[_0x3571('0x3')](_0x3571('0x5'),controller[_0x3571('0x6')]);router[_0x3571('0x3')](_0x3571('0x7'),controller[_0x3571('0x8')]);module[_0x3571('0x9')]=router; \ No newline at end of file +var _0xa8a8=['/forgot','/reset/:token','exports','./authLocal.controller','login','post'];(function(_0x153cdb,_0x440c79){var _0xa3085f=function(_0x55d65e){while(--_0x55d65e){_0x153cdb['push'](_0x153cdb['shift']());}};_0xa3085f(++_0x440c79);}(_0xa8a8,0x9f));var _0x8a8a=function(_0x384131,_0x41a880){_0x384131=_0x384131-0x0;var _0x1fd8e1=_0xa8a8[_0x384131];return _0x1fd8e1;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x8a8a('0x0'));router['post']('/',controller[_0x8a8a('0x1')]);router[_0x8a8a('0x2')](_0x8a8a('0x3'),controller['forgot']);router[_0x8a8a('0x2')](_0x8a8a('0x4'),controller['reset']);module[_0x8a8a('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index beeebd3..be507bf 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 _0x5cd1=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x5cc098,_0x4937cc){var _0xb55379=function(_0x437f0f){while(--_0x437f0f){_0x5cc098['push'](_0x5cc098['shift']());}};_0xb55379(++_0x4937cc);}(_0x5cd1,0x175));var _0x15cd=function(_0x250964,_0x228b17){_0x250964=_0x250964-0x0;var _0x384ec9=_0x5cd1[_0x250964];return _0x384ec9;};'use strict';var Sequelize=require(_0x15cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15cd('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x15cd('0x1')]},'description':{'type':Sequelize[_0x15cd('0x1')]},'status':{'type':Sequelize[_0x15cd('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x15cd('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7fe3=['sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7fe3,0x81));var _0x37fe=function(_0x3fd49e,_0x268790){_0x3fd49e=_0x3fd49e-0x0;var _0x12f9da=_0x7fe3[_0x3fd49e];return _0x12f9da;};'use strict';var Sequelize=require(_0x37fe('0x0'));module[_0x37fe('0x1')]={'name':{'type':Sequelize[_0x37fe('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x37fe('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 3ac76ad..3e423c8 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 _0x2d37=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','Automation','find','create','body','params','destroy','addConditions','ids','omit','getConditions','Condition','hasOwnProperty','nolimit','Action','addActions','getActions','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort'];(function(_0x5c78b1,_0x4e2c1c){var _0x1cb28b=function(_0x26dab8){while(--_0x26dab8){_0x5c78b1['push'](_0x5c78b1['shift']());}};_0x1cb28b(++_0x4e2c1c);}(_0x2d37,0x125));var _0x72d3=function(_0x5a87b9,_0x140958){_0x5a87b9=_0x5a87b9-0x0;var _0x3e90e9=_0x2d37[_0x5a87b9];return _0x3e90e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x72d3('0x0'));var zipdir=require(_0x72d3('0x1'));var jsonpatch=require(_0x72d3('0x2'));var rp=require(_0x72d3('0x3'));var moment=require(_0x72d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x72d3('0x5'));var util=require('util');var path=require(_0x72d3('0x6'));var sox=require(_0x72d3('0x7'));var csv=require(_0x72d3('0x8'));var ejs=require(_0x72d3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72d3('0xa'));var squel=require('squel');var crypto=require(_0x72d3('0xb'));var jsforce=require(_0x72d3('0xc'));var deskjs=require(_0x72d3('0xd'));var toCsv=require(_0x72d3('0x8'));var querystring=require(_0x72d3('0xe'));var Papa=require(_0x72d3('0xf'));var Redis=require(_0x72d3('0x10'));var authService=require(_0x72d3('0x11'));var qs=require(_0x72d3('0x12'));var as=require(_0x72d3('0x13'));var hardwareService=require(_0x72d3('0x14'));var logger=require(_0x72d3('0x15'))(_0x72d3('0x16'));var utils=require('../../config/utils');var config=require(_0x72d3('0x17'));var licenseUtil=require(_0x72d3('0x18'));var db=require(_0x72d3('0x19'))['db'];function respondWithStatusCode(_0x1d18f6,_0x4eb096){_0x4eb096=_0x4eb096||0xcc;return function(_0x33a0c0){if(_0x33a0c0){return _0x1d18f6['sendStatus'](_0x4eb096);}return _0x1d18f6[_0x72d3('0x1a')](_0x4eb096)[_0x72d3('0x1b')]();};}function respondWithResult(_0x26a72e,_0x544548){_0x544548=_0x544548||0xc8;return function(_0x297ff2){if(_0x297ff2){return _0x26a72e[_0x72d3('0x1a')](_0x544548)[_0x72d3('0x1c')](_0x297ff2);}};}function respondWithFilteredResult(_0x227f2e,_0x525d03){return function(_0xa61e87){if(_0xa61e87){var _0x4bc707=typeof _0x525d03[_0x72d3('0x1d')]===_0x72d3('0x1e')&&typeof _0x525d03['limit']==='undefined';var _0x1f986a=_0xa61e87[_0x72d3('0x1f')];var _0x2b5d46=_0x4bc707?0x0:_0x525d03[_0x72d3('0x1d')];var _0x3ee2f7=_0x4bc707?_0xa61e87[_0x72d3('0x1f')]:_0x525d03['offset']+_0x525d03[_0x72d3('0x20')];var _0x57df7f;if(_0x3ee2f7>=_0x1f986a){_0x3ee2f7=_0x1f986a;_0x57df7f=0xc8;}else{_0x57df7f=0xce;}_0x227f2e[_0x72d3('0x1a')](_0x57df7f);return _0x227f2e[_0x72d3('0x21')]('Content-Range',_0x2b5d46+'-'+_0x3ee2f7+'/'+_0x1f986a)[_0x72d3('0x1c')](_0xa61e87);}return null;};}function patchUpdates(_0x2465a4){return function(_0x38b81c){try{jsonpatch[_0x72d3('0x22')](_0x38b81c,_0x2465a4,!![]);}catch(_0x323fe6){return BPromise[_0x72d3('0x23')](_0x323fe6);}return _0x38b81c[_0x72d3('0x24')]();};}function saveUpdates(_0x49e144,_0x49d136){return function(_0x1c11ff){if(_0x1c11ff){return _0x1c11ff[_0x72d3('0x25')](_0x49e144)[_0x72d3('0x26')](function(_0x4829c5){return _0x4829c5;});}return null;};}function removeEntity(_0x394d67,_0x517652){return function(_0x2a1f62){if(_0x2a1f62){return _0x2a1f62['destroy']()[_0x72d3('0x26')](function(){_0x394d67[_0x72d3('0x1a')](0xcc)[_0x72d3('0x1b')]();});}};}function handleEntityNotFound(_0x53f679,_0x198557){return function(_0x51d7fb){if(!_0x51d7fb){_0x53f679[_0x72d3('0x27')](0x194);}return _0x51d7fb;};}function handleError(_0x5d6b59,_0x55dbbf){_0x55dbbf=_0x55dbbf||0x1f4;return function(_0x1e7be2){logger[_0x72d3('0x28')](_0x1e7be2[_0x72d3('0x29')]);if(_0x1e7be2[_0x72d3('0x2a')]){delete _0x1e7be2[_0x72d3('0x2a')];}_0x5d6b59[_0x72d3('0x1a')](_0x55dbbf)[_0x72d3('0x2b')](_0x1e7be2);};}exports[_0x72d3('0x2c')]=function(_0xc1803d,_0x29a356){var _0x383da0={},_0xdd1eb8={},_0x36ed3b={'count':0x0,'rows':[]};var _0x5c33cc=_[_0x72d3('0x2d')](db['Automation'][_0x72d3('0x2e')],function(_0x33c01d){return{'name':_0x33c01d[_0x72d3('0x2f')],'type':_0x33c01d[_0x72d3('0x30')][_0x72d3('0x31')]};});_0xdd1eb8[_0x72d3('0x32')]=_['map'](_0x5c33cc,_0x72d3('0x2a'));_0xdd1eb8[_0x72d3('0x33')]=_[_0x72d3('0x34')](_0xc1803d['query']);_0xdd1eb8[_0x72d3('0x35')]=_[_0x72d3('0x36')](_0xdd1eb8['model'],_0xdd1eb8[_0x72d3('0x33')]);_0x383da0[_0x72d3('0x37')]=_[_0x72d3('0x36')](_0xdd1eb8[_0x72d3('0x32')],qs[_0x72d3('0x38')](_0xc1803d[_0x72d3('0x33')][_0x72d3('0x38')]));_0x383da0['attributes']=_0x383da0['attributes'][_0x72d3('0x39')]?_0x383da0[_0x72d3('0x37')]:_0xdd1eb8[_0x72d3('0x32')];if(!_0xc1803d[_0x72d3('0x33')]['hasOwnProperty']('nolimit')){_0x383da0[_0x72d3('0x20')]=qs['limit'](_0xc1803d[_0x72d3('0x33')][_0x72d3('0x20')]);_0x383da0[_0x72d3('0x1d')]=qs[_0x72d3('0x1d')](_0xc1803d[_0x72d3('0x33')]['offset']);}_0x383da0['order']=qs[_0x72d3('0x3a')](_0xc1803d[_0x72d3('0x33')]['sort']);_0x383da0[_0x72d3('0x3b')]=qs[_0x72d3('0x35')](_[_0x72d3('0x3c')](_0xc1803d[_0x72d3('0x33')],_0xdd1eb8['filters']),_0x5c33cc);if(_0xc1803d[_0x72d3('0x33')][_0x72d3('0x3d')]){_0x383da0[_0x72d3('0x3b')]=_[_0x72d3('0x3e')](_0x383da0[_0x72d3('0x3b')],{'$or':_['map'](_0x5c33cc,function(_0x39e080){if(_0x39e080[_0x72d3('0x30')]!==_0x72d3('0x3f')){var _0x541cf1={};_0x541cf1[_0x39e080[_0x72d3('0x2a')]]={'$like':'%'+_0xc1803d[_0x72d3('0x33')]['filter']+'%'};return _0x541cf1;}})});}_0x383da0=_[_0x72d3('0x3e')]({},_0x383da0,_0xc1803d[_0x72d3('0x40')]);var _0x4879e7={'where':_0x383da0[_0x72d3('0x3b')]};return db['Automation'][_0x72d3('0x1f')](_0x4879e7)['then'](function(_0x2a5f7f){_0x36ed3b['count']=_0x2a5f7f;if(_0xc1803d['query'][_0x72d3('0x41')]){_0x383da0[_0x72d3('0x42')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x383da0);})[_0x72d3('0x26')](function(_0x15d5cc){_0x36ed3b[_0x72d3('0x43')]=_0x15d5cc;return _0x36ed3b;})['then'](respondWithFilteredResult(_0x29a356,_0x383da0))[_0x72d3('0x44')](handleError(_0x29a356,null));};exports[_0x72d3('0x45')]=function(_0xbf4894,_0x4d0bcd){var _0x58ac34={'raw':![],'where':{'id':_0xbf4894['params']['id']}},_0x3a0f9a={};_0x3a0f9a['model']=_[_0x72d3('0x34')](db[_0x72d3('0x46')][_0x72d3('0x2e')]);_0x3a0f9a[_0x72d3('0x33')]=_[_0x72d3('0x34')](_0xbf4894[_0x72d3('0x33')]);_0x3a0f9a[_0x72d3('0x35')]=_[_0x72d3('0x36')](_0x3a0f9a[_0x72d3('0x32')],_0x3a0f9a[_0x72d3('0x33')]);_0x58ac34['attributes']=_[_0x72d3('0x36')](_0x3a0f9a[_0x72d3('0x32')],qs[_0x72d3('0x38')](_0xbf4894['query'][_0x72d3('0x38')]));_0x58ac34[_0x72d3('0x37')]=_0x58ac34[_0x72d3('0x37')][_0x72d3('0x39')]?_0x58ac34[_0x72d3('0x37')]:_0x3a0f9a[_0x72d3('0x32')];if(_0xbf4894[_0x72d3('0x33')][_0x72d3('0x41')]){_0x58ac34[_0x72d3('0x42')]=[{'all':!![]}];}_0x58ac34=_[_0x72d3('0x3e')]({},_0x58ac34,_0xbf4894[_0x72d3('0x40')]);return db[_0x72d3('0x46')][_0x72d3('0x47')](_0x58ac34)[_0x72d3('0x26')](handleEntityNotFound(_0x4d0bcd,null))[_0x72d3('0x26')](respondWithResult(_0x4d0bcd,null))[_0x72d3('0x44')](handleError(_0x4d0bcd,null));};exports[_0x72d3('0x48')]=function(_0x4aaf3a,_0x22a7e8){return db[_0x72d3('0x46')][_0x72d3('0x48')](_0x4aaf3a[_0x72d3('0x49')],{})['then'](respondWithResult(_0x22a7e8,0xc9))[_0x72d3('0x44')](handleError(_0x22a7e8,null));};exports['update']=function(_0x442a5c,_0x32b510){if(_0x442a5c[_0x72d3('0x49')]['id']){delete _0x442a5c[_0x72d3('0x49')]['id'];}return db[_0x72d3('0x46')][_0x72d3('0x47')]({'where':{'id':_0x442a5c[_0x72d3('0x4a')]['id']}})[_0x72d3('0x26')](handleEntityNotFound(_0x32b510,null))['then'](saveUpdates(_0x442a5c[_0x72d3('0x49')],null))[_0x72d3('0x26')](respondWithResult(_0x32b510,null))['catch'](handleError(_0x32b510,null));};exports[_0x72d3('0x4b')]=function(_0x1c06d9,_0x14eaee){return db[_0x72d3('0x46')]['find']({'where':{'id':_0x1c06d9['params']['id']}})[_0x72d3('0x26')](handleEntityNotFound(_0x14eaee,null))['then'](removeEntity(_0x14eaee,null))[_0x72d3('0x44')](handleError(_0x14eaee,null));};exports[_0x72d3('0x4c')]=function(_0x17461c,_0x5a8fc0,_0x2d7ef5){return db['Condition'][_0x72d3('0x47')]({'where':{'id':_0x17461c['params']['id']}})[_0x72d3('0x26')](handleEntityNotFound(_0x5a8fc0,null))[_0x72d3('0x26')](function(_0x462ce2){if(_0x462ce2){return _0x462ce2[_0x72d3('0x4c')](_0x17461c[_0x72d3('0x49')][_0x72d3('0x4d')],_[_0x72d3('0x4e')](_0x17461c[_0x72d3('0x49')],[_0x72d3('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x5a8fc0,null))['catch'](handleError(_0x5a8fc0,null));};exports[_0x72d3('0x4f')]=function(_0x65db4e,_0x24248f,_0x30577c){var _0x2afc67={};var _0x17df19={};var _0x169069;var _0x40c6d4;return db[_0x72d3('0x46')]['findOne']({'where':{'id':_0x65db4e[_0x72d3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24248f,null))[_0x72d3('0x26')](function(_0x44acd0){if(_0x44acd0){_0x169069=_0x44acd0;_0x17df19['model']=_[_0x72d3('0x34')](db[_0x72d3('0x50')][_0x72d3('0x2e')]);_0x17df19[_0x72d3('0x33')]=_[_0x72d3('0x34')](_0x65db4e[_0x72d3('0x33')]);_0x17df19[_0x72d3('0x35')]=_[_0x72d3('0x36')](_0x17df19[_0x72d3('0x32')],_0x17df19['query']);_0x2afc67[_0x72d3('0x37')]=_[_0x72d3('0x36')](_0x17df19[_0x72d3('0x32')],qs[_0x72d3('0x38')](_0x65db4e[_0x72d3('0x33')]['fields']));_0x2afc67[_0x72d3('0x37')]=_0x2afc67[_0x72d3('0x37')][_0x72d3('0x39')]?_0x2afc67[_0x72d3('0x37')]:_0x17df19['model'];_0x2afc67['order']=qs['sort'](_0x65db4e['query']['sort']);_0x2afc67[_0x72d3('0x3b')]=qs['filters'](_[_0x72d3('0x3c')](_0x65db4e[_0x72d3('0x33')],_0x17df19[_0x72d3('0x35')]));if(_0x65db4e[_0x72d3('0x33')][_0x72d3('0x3d')]){_0x2afc67[_0x72d3('0x3b')]=_[_0x72d3('0x3e')](_0x2afc67[_0x72d3('0x3b')],{'$or':_[_0x72d3('0x2d')](_0x2afc67[_0x72d3('0x37')],function(_0x4f18f1){var _0x36f59a={};_0x36f59a[_0x4f18f1]={'$like':'%'+_0x65db4e[_0x72d3('0x33')]['filter']+'%'};return _0x36f59a;})});}_0x2afc67=_[_0x72d3('0x3e')]({},_0x2afc67,_0x65db4e[_0x72d3('0x40')]);return _0x169069[_0x72d3('0x4f')](_0x2afc67);}})['then'](function(_0x1f4d01){if(_0x1f4d01){_0x40c6d4=_0x1f4d01[_0x72d3('0x39')];if(!_0x65db4e[_0x72d3('0x33')][_0x72d3('0x51')](_0x72d3('0x52'))){_0x2afc67[_0x72d3('0x20')]=qs['limit'](_0x65db4e[_0x72d3('0x33')][_0x72d3('0x20')]);_0x2afc67['offset']=qs['offset'](_0x65db4e[_0x72d3('0x33')][_0x72d3('0x1d')]);}return _0x169069[_0x72d3('0x4f')](_0x2afc67);}})[_0x72d3('0x26')](function(_0x2ff533){if(_0x2ff533){return _0x2ff533?{'count':_0x40c6d4,'rows':_0x2ff533}:null;}})['then'](respondWithResult(_0x24248f,null))[_0x72d3('0x44')](handleError(_0x24248f,null));};exports['addActions']=function(_0x460710,_0x525a1a,_0x265fca){return db[_0x72d3('0x53')][_0x72d3('0x47')]({'where':{'id':_0x460710['params']['id']}})[_0x72d3('0x26')](handleEntityNotFound(_0x525a1a,null))[_0x72d3('0x26')](function(_0x52bd44){if(_0x52bd44){return _0x52bd44[_0x72d3('0x54')](_0x460710['body'][_0x72d3('0x4d')],_[_0x72d3('0x4e')](_0x460710[_0x72d3('0x49')],[_0x72d3('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x525a1a,null))[_0x72d3('0x44')](handleError(_0x525a1a,null));};exports[_0x72d3('0x55')]=function(_0x2579ea,_0x5ea626,_0x3a3d58){var _0x217a4c={};var _0x1bfcc1={};var _0x1b3fe7;var _0x30e6ff;return db[_0x72d3('0x46')][_0x72d3('0x56')]({'where':{'id':_0x2579ea[_0x72d3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ea626,null))[_0x72d3('0x26')](function(_0x48ac72){if(_0x48ac72){_0x1b3fe7=_0x48ac72;_0x1bfcc1[_0x72d3('0x32')]=_['keys'](db[_0x72d3('0x53')][_0x72d3('0x2e')]);_0x1bfcc1[_0x72d3('0x33')]=_[_0x72d3('0x34')](_0x2579ea[_0x72d3('0x33')]);_0x1bfcc1[_0x72d3('0x35')]=_[_0x72d3('0x36')](_0x1bfcc1[_0x72d3('0x32')],_0x1bfcc1[_0x72d3('0x33')]);_0x217a4c[_0x72d3('0x37')]=_[_0x72d3('0x36')](_0x1bfcc1[_0x72d3('0x32')],qs[_0x72d3('0x38')](_0x2579ea[_0x72d3('0x33')][_0x72d3('0x38')]));_0x217a4c[_0x72d3('0x37')]=_0x217a4c['attributes'][_0x72d3('0x39')]?_0x217a4c[_0x72d3('0x37')]:_0x1bfcc1[_0x72d3('0x32')];_0x217a4c[_0x72d3('0x57')]=qs[_0x72d3('0x3a')](_0x2579ea[_0x72d3('0x33')][_0x72d3('0x3a')]);_0x217a4c['where']=qs[_0x72d3('0x35')](_['pick'](_0x2579ea[_0x72d3('0x33')],_0x1bfcc1[_0x72d3('0x35')]));if(_0x2579ea[_0x72d3('0x33')]['filter']){_0x217a4c[_0x72d3('0x3b')]=_[_0x72d3('0x3e')](_0x217a4c['where'],{'$or':_['map'](_0x217a4c[_0x72d3('0x37')],function(_0x106882){var _0x5ee176={};_0x5ee176[_0x106882]={'$like':'%'+_0x2579ea['query']['filter']+'%'};return _0x5ee176;})});}_0x217a4c=_['merge']({},_0x217a4c,_0x2579ea[_0x72d3('0x40')]);return _0x1b3fe7[_0x72d3('0x55')](_0x217a4c);}})['then'](function(_0x5c7e18){if(_0x5c7e18){_0x30e6ff=_0x5c7e18[_0x72d3('0x39')];if(!_0x2579ea['query'][_0x72d3('0x51')](_0x72d3('0x52'))){_0x217a4c['limit']=qs[_0x72d3('0x20')](_0x2579ea[_0x72d3('0x33')][_0x72d3('0x20')]);_0x217a4c[_0x72d3('0x1d')]=qs[_0x72d3('0x1d')](_0x2579ea[_0x72d3('0x33')][_0x72d3('0x1d')]);}return _0x1b3fe7[_0x72d3('0x55')](_0x217a4c);}})[_0x72d3('0x26')](function(_0x2c763c){if(_0x2c763c){return _0x2c763c?{'count':_0x30e6ff,'rows':_0x2c763c}:null;}})[_0x72d3('0x26')](respondWithResult(_0x5ea626,null))[_0x72d3('0x44')](handleError(_0x5ea626,null));}; \ No newline at end of file +var _0xa0e8=['zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','Automation','fieldName','type','model','query','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','then','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','eml-format'];(function(_0xb01aa9,_0xf6be7d){var _0x23c06c=function(_0x102f03){while(--_0x102f03){_0xb01aa9['push'](_0xb01aa9['shift']());}};_0x23c06c(++_0xf6be7d);}(_0xa0e8,0x1a8));var _0x8a0e=function(_0x26075f,_0x5b1d30){_0x26075f=_0x26075f-0x0;var _0xeb85bf=_0xa0e8[_0x26075f];return _0xeb85bf;};'use strict';var emlformat=require(_0x8a0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a0e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a0e('0x2'));var moment=require(_0x8a0e('0x3'));var BPromise=require(_0x8a0e('0x4'));var Mustache=require(_0x8a0e('0x5'));var util=require('util');var path=require(_0x8a0e('0x6'));var sox=require(_0x8a0e('0x7'));var csv=require(_0x8a0e('0x8'));var ejs=require(_0x8a0e('0x9'));var fs=require('fs');var fs_extra=require(_0x8a0e('0xa'));var _=require(_0x8a0e('0xb'));var squel=require(_0x8a0e('0xc'));var crypto=require(_0x8a0e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8a0e('0xe'));var toCsv=require(_0x8a0e('0x8'));var querystring=require(_0x8a0e('0xf'));var Papa=require(_0x8a0e('0x10'));var Redis=require(_0x8a0e('0x11'));var authService=require(_0x8a0e('0x12'));var qs=require(_0x8a0e('0x13'));var as=require(_0x8a0e('0x14'));var hardwareService=require(_0x8a0e('0x15'));var logger=require(_0x8a0e('0x16'))(_0x8a0e('0x17'));var utils=require(_0x8a0e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8a0e('0x19'));var db=require(_0x8a0e('0x1a'))['db'];function respondWithStatusCode(_0x320b1f,_0x3972ef){_0x3972ef=_0x3972ef||0xcc;return function(_0x273edd){if(_0x273edd){return _0x320b1f[_0x8a0e('0x1b')](_0x3972ef);}return _0x320b1f[_0x8a0e('0x1c')](_0x3972ef)['end']();};}function respondWithResult(_0x294bc1,_0x28dd53){_0x28dd53=_0x28dd53||0xc8;return function(_0xe0ab2){if(_0xe0ab2){return _0x294bc1[_0x8a0e('0x1c')](_0x28dd53)[_0x8a0e('0x1d')](_0xe0ab2);}};}function respondWithFilteredResult(_0x2b5af5,_0xf251d6){return function(_0x56633c){if(_0x56633c){var _0x63411e=typeof _0xf251d6[_0x8a0e('0x1e')]===_0x8a0e('0x1f')&&typeof _0xf251d6[_0x8a0e('0x20')]==='undefined';var _0x181b2b=_0x56633c['count'];var _0x4c5b2a=_0x63411e?0x0:_0xf251d6[_0x8a0e('0x1e')];var _0x300f57=_0x63411e?_0x56633c['count']:_0xf251d6[_0x8a0e('0x1e')]+_0xf251d6[_0x8a0e('0x20')];var _0x507546;if(_0x300f57>=_0x181b2b){_0x300f57=_0x181b2b;_0x507546=0xc8;}else{_0x507546=0xce;}_0x2b5af5[_0x8a0e('0x1c')](_0x507546);return _0x2b5af5[_0x8a0e('0x21')]('Content-Range',_0x4c5b2a+'-'+_0x300f57+'/'+_0x181b2b)[_0x8a0e('0x1d')](_0x56633c);}return null;};}function patchUpdates(_0x41af1c){return function(_0x30b494){try{jsonpatch[_0x8a0e('0x22')](_0x30b494,_0x41af1c,!![]);}catch(_0x5d309e){return BPromise[_0x8a0e('0x23')](_0x5d309e);}return _0x30b494[_0x8a0e('0x24')]();};}function saveUpdates(_0xa49dae,_0x1363e8){return function(_0x486705){if(_0x486705){return _0x486705[_0x8a0e('0x25')](_0xa49dae)['then'](function(_0x5e93d1){return _0x5e93d1;});}return null;};}function removeEntity(_0x54e2b9,_0x4e2edf){return function(_0x57b3b9){if(_0x57b3b9){return _0x57b3b9[_0x8a0e('0x26')]()['then'](function(){_0x54e2b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47958f,_0x516db4){return function(_0x52ff2c){if(!_0x52ff2c){_0x47958f[_0x8a0e('0x1b')](0x194);}return _0x52ff2c;};}function handleError(_0x384dfd,_0x2fb4c5){_0x2fb4c5=_0x2fb4c5||0x1f4;return function(_0xba2ab4){logger[_0x8a0e('0x27')](_0xba2ab4[_0x8a0e('0x28')]);if(_0xba2ab4[_0x8a0e('0x29')]){delete _0xba2ab4[_0x8a0e('0x29')];}_0x384dfd[_0x8a0e('0x1c')](_0x2fb4c5)[_0x8a0e('0x2a')](_0xba2ab4);};}exports[_0x8a0e('0x2b')]=function(_0x48aad2,_0x5bfdc9){var _0xfadf56={},_0x25aef1={},_0x44232d={'count':0x0,'rows':[]};var _0x4177ca=_[_0x8a0e('0x2c')](db[_0x8a0e('0x2d')]['rawAttributes'],function(_0x3df4d5){return{'name':_0x3df4d5[_0x8a0e('0x2e')],'type':_0x3df4d5[_0x8a0e('0x2f')]['key']};});_0x25aef1[_0x8a0e('0x30')]=_[_0x8a0e('0x2c')](_0x4177ca,_0x8a0e('0x29'));_0x25aef1['query']=_['keys'](_0x48aad2[_0x8a0e('0x31')]);_0x25aef1['filters']=_[_0x8a0e('0x32')](_0x25aef1[_0x8a0e('0x30')],_0x25aef1[_0x8a0e('0x31')]);_0xfadf56['attributes']=_['intersection'](_0x25aef1[_0x8a0e('0x30')],qs[_0x8a0e('0x33')](_0x48aad2[_0x8a0e('0x31')][_0x8a0e('0x33')]));_0xfadf56[_0x8a0e('0x34')]=_0xfadf56[_0x8a0e('0x34')][_0x8a0e('0x35')]?_0xfadf56[_0x8a0e('0x34')]:_0x25aef1[_0x8a0e('0x30')];if(!_0x48aad2['query']['hasOwnProperty']('nolimit')){_0xfadf56['limit']=qs['limit'](_0x48aad2[_0x8a0e('0x31')]['limit']);_0xfadf56['offset']=qs[_0x8a0e('0x1e')](_0x48aad2[_0x8a0e('0x31')][_0x8a0e('0x1e')]);}_0xfadf56[_0x8a0e('0x36')]=qs['sort'](_0x48aad2[_0x8a0e('0x31')][_0x8a0e('0x37')]);_0xfadf56[_0x8a0e('0x38')]=qs['filters'](_[_0x8a0e('0x39')](_0x48aad2['query'],_0x25aef1[_0x8a0e('0x3a')]),_0x4177ca);if(_0x48aad2[_0x8a0e('0x31')][_0x8a0e('0x3b')]){_0xfadf56['where']=_['merge'](_0xfadf56[_0x8a0e('0x38')],{'$or':_[_0x8a0e('0x2c')](_0x4177ca,function(_0x58d5a8){if(_0x58d5a8[_0x8a0e('0x2f')]!==_0x8a0e('0x3c')){var _0x3eb2ec={};_0x3eb2ec[_0x58d5a8[_0x8a0e('0x29')]]={'$like':'%'+_0x48aad2[_0x8a0e('0x31')]['filter']+'%'};return _0x3eb2ec;}})});}_0xfadf56=_[_0x8a0e('0x3d')]({},_0xfadf56,_0x48aad2[_0x8a0e('0x3e')]);var _0xfa8632={'where':_0xfadf56['where']};return db[_0x8a0e('0x2d')][_0x8a0e('0x3f')](_0xfa8632)[_0x8a0e('0x40')](function(_0x8390da){_0x44232d[_0x8a0e('0x3f')]=_0x8390da;if(_0x48aad2[_0x8a0e('0x31')][_0x8a0e('0x41')]){_0xfadf56[_0x8a0e('0x42')]=[{'all':!![]}];}return db[_0x8a0e('0x2d')]['findAll'](_0xfadf56);})['then'](function(_0x4dfc47){_0x44232d[_0x8a0e('0x43')]=_0x4dfc47;return _0x44232d;})[_0x8a0e('0x40')](respondWithFilteredResult(_0x5bfdc9,_0xfadf56))[_0x8a0e('0x44')](handleError(_0x5bfdc9,null));};exports['show']=function(_0x308d2b,_0x12ff29){var _0x18701c={'raw':![],'where':{'id':_0x308d2b[_0x8a0e('0x45')]['id']}},_0x5d686d={};_0x5d686d[_0x8a0e('0x30')]=_[_0x8a0e('0x46')](db[_0x8a0e('0x2d')][_0x8a0e('0x47')]);_0x5d686d[_0x8a0e('0x31')]=_[_0x8a0e('0x46')](_0x308d2b['query']);_0x5d686d[_0x8a0e('0x3a')]=_[_0x8a0e('0x32')](_0x5d686d['model'],_0x5d686d[_0x8a0e('0x31')]);_0x18701c[_0x8a0e('0x34')]=_['intersection'](_0x5d686d[_0x8a0e('0x30')],qs[_0x8a0e('0x33')](_0x308d2b[_0x8a0e('0x31')][_0x8a0e('0x33')]));_0x18701c[_0x8a0e('0x34')]=_0x18701c['attributes'][_0x8a0e('0x35')]?_0x18701c[_0x8a0e('0x34')]:_0x5d686d[_0x8a0e('0x30')];if(_0x308d2b['query'][_0x8a0e('0x41')]){_0x18701c['include']=[{'all':!![]}];}_0x18701c=_['merge']({},_0x18701c,_0x308d2b[_0x8a0e('0x3e')]);return db[_0x8a0e('0x2d')][_0x8a0e('0x48')](_0x18701c)[_0x8a0e('0x40')](handleEntityNotFound(_0x12ff29,null))[_0x8a0e('0x40')](respondWithResult(_0x12ff29,null))[_0x8a0e('0x44')](handleError(_0x12ff29,null));};exports[_0x8a0e('0x49')]=function(_0x195796,_0x465b7a){return db['Automation']['create'](_0x195796[_0x8a0e('0x4a')],{})[_0x8a0e('0x40')](respondWithResult(_0x465b7a,0xc9))[_0x8a0e('0x44')](handleError(_0x465b7a,null));};exports[_0x8a0e('0x25')]=function(_0x110fe8,_0x372f3f){if(_0x110fe8['body']['id']){delete _0x110fe8[_0x8a0e('0x4a')]['id'];}return db[_0x8a0e('0x2d')][_0x8a0e('0x48')]({'where':{'id':_0x110fe8['params']['id']}})[_0x8a0e('0x40')](handleEntityNotFound(_0x372f3f,null))['then'](saveUpdates(_0x110fe8[_0x8a0e('0x4a')],null))['then'](respondWithResult(_0x372f3f,null))[_0x8a0e('0x44')](handleError(_0x372f3f,null));};exports[_0x8a0e('0x26')]=function(_0x140fb3,_0x192c3c){return db[_0x8a0e('0x2d')][_0x8a0e('0x48')]({'where':{'id':_0x140fb3['params']['id']}})[_0x8a0e('0x40')](handleEntityNotFound(_0x192c3c,null))[_0x8a0e('0x40')](removeEntity(_0x192c3c,null))[_0x8a0e('0x44')](handleError(_0x192c3c,null));};exports[_0x8a0e('0x4b')]=function(_0x52b8ed,_0x51a524,_0xcf2ab1){return db[_0x8a0e('0x4c')][_0x8a0e('0x48')]({'where':{'id':_0x52b8ed[_0x8a0e('0x45')]['id']}})[_0x8a0e('0x40')](handleEntityNotFound(_0x51a524,null))[_0x8a0e('0x40')](function(_0x230304){if(_0x230304){return _0x230304['addConditions'](_0x52b8ed[_0x8a0e('0x4a')][_0x8a0e('0x4d')],_[_0x8a0e('0x4e')](_0x52b8ed[_0x8a0e('0x4a')],[_0x8a0e('0x4d'),'id'])||{});}})[_0x8a0e('0x40')](respondWithResult(_0x51a524,null))[_0x8a0e('0x44')](handleError(_0x51a524,null));};exports[_0x8a0e('0x4f')]=function(_0x251ad5,_0x27fcf4,_0x54e90e){var _0x446991={};var _0x4dcc51={};var _0x3cad27;var _0x578032;return db[_0x8a0e('0x2d')][_0x8a0e('0x50')]({'where':{'id':_0x251ad5[_0x8a0e('0x45')]['id']}})[_0x8a0e('0x40')](handleEntityNotFound(_0x27fcf4,null))[_0x8a0e('0x40')](function(_0x35803d){if(_0x35803d){_0x3cad27=_0x35803d;_0x4dcc51['model']=_[_0x8a0e('0x46')](db[_0x8a0e('0x4c')]['rawAttributes']);_0x4dcc51['query']=_[_0x8a0e('0x46')](_0x251ad5[_0x8a0e('0x31')]);_0x4dcc51['filters']=_[_0x8a0e('0x32')](_0x4dcc51[_0x8a0e('0x30')],_0x4dcc51[_0x8a0e('0x31')]);_0x446991[_0x8a0e('0x34')]=_['intersection'](_0x4dcc51['model'],qs[_0x8a0e('0x33')](_0x251ad5['query']['fields']));_0x446991['attributes']=_0x446991['attributes'][_0x8a0e('0x35')]?_0x446991['attributes']:_0x4dcc51[_0x8a0e('0x30')];_0x446991['order']=qs[_0x8a0e('0x37')](_0x251ad5[_0x8a0e('0x31')][_0x8a0e('0x37')]);_0x446991['where']=qs['filters'](_[_0x8a0e('0x39')](_0x251ad5[_0x8a0e('0x31')],_0x4dcc51[_0x8a0e('0x3a')]));if(_0x251ad5['query'][_0x8a0e('0x3b')]){_0x446991[_0x8a0e('0x38')]=_[_0x8a0e('0x3d')](_0x446991['where'],{'$or':_[_0x8a0e('0x2c')](_0x446991[_0x8a0e('0x34')],function(_0x350f89){var _0x55f3cf={};_0x55f3cf[_0x350f89]={'$like':'%'+_0x251ad5['query']['filter']+'%'};return _0x55f3cf;})});}_0x446991=_['merge']({},_0x446991,_0x251ad5[_0x8a0e('0x3e')]);return _0x3cad27[_0x8a0e('0x4f')](_0x446991);}})[_0x8a0e('0x40')](function(_0x59a903){if(_0x59a903){_0x578032=_0x59a903[_0x8a0e('0x35')];if(!_0x251ad5[_0x8a0e('0x31')]['hasOwnProperty'](_0x8a0e('0x51'))){_0x446991[_0x8a0e('0x20')]=qs[_0x8a0e('0x20')](_0x251ad5[_0x8a0e('0x31')][_0x8a0e('0x20')]);_0x446991[_0x8a0e('0x1e')]=qs[_0x8a0e('0x1e')](_0x251ad5['query'][_0x8a0e('0x1e')]);}return _0x3cad27[_0x8a0e('0x4f')](_0x446991);}})[_0x8a0e('0x40')](function(_0x26dafc){if(_0x26dafc){return _0x26dafc?{'count':_0x578032,'rows':_0x26dafc}:null;}})[_0x8a0e('0x40')](respondWithResult(_0x27fcf4,null))['catch'](handleError(_0x27fcf4,null));};exports[_0x8a0e('0x52')]=function(_0x46df62,_0x48f9b4,_0x137eab){return db[_0x8a0e('0x53')][_0x8a0e('0x48')]({'where':{'id':_0x46df62[_0x8a0e('0x45')]['id']}})[_0x8a0e('0x40')](handleEntityNotFound(_0x48f9b4,null))[_0x8a0e('0x40')](function(_0x55a358){if(_0x55a358){return _0x55a358[_0x8a0e('0x52')](_0x46df62['body'][_0x8a0e('0x4d')],_[_0x8a0e('0x4e')](_0x46df62[_0x8a0e('0x4a')],[_0x8a0e('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x48f9b4,null))['catch'](handleError(_0x48f9b4,null));};exports[_0x8a0e('0x54')]=function(_0x54bd2c,_0x1848b8,_0x1ac8c5){var _0x33a2da={};var _0x623404={};var _0x3e6f82;var _0x2be170;return db[_0x8a0e('0x2d')][_0x8a0e('0x50')]({'where':{'id':_0x54bd2c[_0x8a0e('0x45')]['id']}})[_0x8a0e('0x40')](handleEntityNotFound(_0x1848b8,null))[_0x8a0e('0x40')](function(_0x49a9f0){if(_0x49a9f0){_0x3e6f82=_0x49a9f0;_0x623404[_0x8a0e('0x30')]=_[_0x8a0e('0x46')](db['Action']['rawAttributes']);_0x623404['query']=_['keys'](_0x54bd2c['query']);_0x623404[_0x8a0e('0x3a')]=_[_0x8a0e('0x32')](_0x623404[_0x8a0e('0x30')],_0x623404['query']);_0x33a2da[_0x8a0e('0x34')]=_[_0x8a0e('0x32')](_0x623404['model'],qs[_0x8a0e('0x33')](_0x54bd2c['query'][_0x8a0e('0x33')]));_0x33a2da[_0x8a0e('0x34')]=_0x33a2da[_0x8a0e('0x34')]['length']?_0x33a2da[_0x8a0e('0x34')]:_0x623404[_0x8a0e('0x30')];_0x33a2da['order']=qs['sort'](_0x54bd2c[_0x8a0e('0x31')][_0x8a0e('0x37')]);_0x33a2da[_0x8a0e('0x38')]=qs[_0x8a0e('0x3a')](_[_0x8a0e('0x39')](_0x54bd2c[_0x8a0e('0x31')],_0x623404[_0x8a0e('0x3a')]));if(_0x54bd2c[_0x8a0e('0x31')]['filter']){_0x33a2da[_0x8a0e('0x38')]=_[_0x8a0e('0x3d')](_0x33a2da[_0x8a0e('0x38')],{'$or':_[_0x8a0e('0x2c')](_0x33a2da[_0x8a0e('0x34')],function(_0x56245a){var _0x4adcea={};_0x4adcea[_0x56245a]={'$like':'%'+_0x54bd2c[_0x8a0e('0x31')][_0x8a0e('0x3b')]+'%'};return _0x4adcea;})});}_0x33a2da=_[_0x8a0e('0x3d')]({},_0x33a2da,_0x54bd2c['options']);return _0x3e6f82['getActions'](_0x33a2da);}})['then'](function(_0x25b73b){if(_0x25b73b){_0x2be170=_0x25b73b['length'];if(!_0x54bd2c['query']['hasOwnProperty'](_0x8a0e('0x51'))){_0x33a2da['limit']=qs['limit'](_0x54bd2c[_0x8a0e('0x31')][_0x8a0e('0x20')]);_0x33a2da['offset']=qs[_0x8a0e('0x1e')](_0x54bd2c[_0x8a0e('0x31')][_0x8a0e('0x1e')]);}return _0x3e6f82['getActions'](_0x33a2da);}})[_0x8a0e('0x40')](function(_0x4577d0){if(_0x4577d0){return _0x4577d0?{'count':_0x2be170,'rows':_0x4577d0}:null;}})[_0x8a0e('0x40')](respondWithResult(_0x1848b8,null))['catch'](handleError(_0x1848b8,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2cca668..a7c10a5 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 _0x9c9b=['../../config/logger','api','moment','bluebird','path','./automation.attributes','exports','define','Automation','lodash'];(function(_0x1206d7,_0x1b0ed7){var _0x5e1142=function(_0x33ab8a){while(--_0x33ab8a){_0x1206d7['push'](_0x1206d7['shift']());}};_0x5e1142(++_0x1b0ed7);}(_0x9c9b,0x149));var _0xb9c9=function(_0x264c4f,_0x75d0e9){_0x264c4f=_0x264c4f-0x0;var _0x55922d=_0x9c9b[_0x264c4f];return _0x55922d;};'use strict';var _=require(_0xb9c9('0x0'));var util=require('util');var logger=require(_0xb9c9('0x1'))(_0xb9c9('0x2'));var moment=require(_0xb9c9('0x3'));var BPromise=require(_0xb9c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb9c9('0x6'));module[_0xb9c9('0x7')]=function(_0x4ecd0,_0x3f1a27){return _0x4ecd0[_0xb9c9('0x8')](_0xb9c9('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4996=['api','moment','bluebird','path','../../config/environment','define','util'];(function(_0x81c1ef,_0x5a49ea){var _0x4b83d6=function(_0x4d6706){while(--_0x4d6706){_0x81c1ef['push'](_0x81c1ef['shift']());}};_0x4b83d6(++_0x5a49ea);}(_0x4996,0xbc));var _0x6499=function(_0x55214a,_0x30f5ac){_0x55214a=_0x55214a-0x0;var _0x58cb5b=_0x4996[_0x55214a];return _0x58cb5b;};'use strict';var _=require('lodash');var util=require(_0x6499('0x0'));var logger=require('../../config/logger')(_0x6499('0x1'));var moment=require(_0x6499('0x2'));var BPromise=require(_0x6499('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6499('0x4'));var rimraf=require('rimraf');var config=require(_0x6499('0x5'));var attributes=require('./automation.attributes');module['exports']=function(_0x269d75,_0x119f29){return _0x269d75[_0x6499('0x6')]('Automation',attributes,{'tableName':'tools_automations','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 b1ebb9b..692ad70 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 _0x04fa=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','request\x20sent'];(function(_0x2fb6ee,_0x261eed){var _0x2b80ee=function(_0x3672a2){while(--_0x3672a2){_0x2fb6ee['push'](_0x2fb6ee['shift']());}};_0x2b80ee(++_0x261eed);}(_0x04fa,0x119));var _0xa04f=function(_0xac7f40,_0x2aa742){_0xac7f40=_0xac7f40-0x0;var _0x33531f=_0x04fa[_0xac7f40];return _0x33531f;};'use strict';var _=require('lodash');var util=require(_0xa04f('0x0'));var moment=require(_0xa04f('0x1'));var BPromise=require(_0xa04f('0x2'));var rs=require(_0xa04f('0x3'));var fs=require('fs');var Redis=require(_0xa04f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa04f('0x5'));var logger=require('../../config/logger')(_0xa04f('0x6'));var config=require(_0xa04f('0x7'));var jayson=require(_0xa04f('0x8'));var client=jayson['client'][_0xa04f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c521c,_0x315771,_0x56f898){return new BPromise(function(_0x303e54,_0x4a2e03){return client['request'](_0x2c521c,_0x56f898)['then'](function(_0x5ea498){logger[_0xa04f('0xa')]('Automation,\x20%s,\x20%s',_0x315771,'request\x20sent');logger[_0xa04f('0xb')](_0xa04f('0xc'),_0x315771,'request\x20sent',JSON[_0xa04f('0xd')](_0x5ea498));if(_0x5ea498['error']){if(_0x5ea498[_0xa04f('0xe')][_0xa04f('0xf')]===0x1f4){logger['error'](_0xa04f('0x10'),_0x315771,_0x5ea498[_0xa04f('0xe')]['message']);return _0x4a2e03(_0x5ea498['error']['message']);}logger[_0xa04f('0xe')](_0xa04f('0x10'),_0x315771,_0x5ea498[_0xa04f('0xe')][_0xa04f('0x11')]);return _0x303e54(_0x5ea498[_0xa04f('0xe')][_0xa04f('0x11')]);}else{logger['info'](_0xa04f('0x10'),_0x315771,_0xa04f('0x12'));_0x303e54(_0x5ea498['result'][_0xa04f('0x11')]);}})[_0xa04f('0x13')](function(_0x505abc){logger[_0xa04f('0xe')]('Automation,\x20%s,\x20%s',_0x315771,_0x505abc);_0x4a2e03(_0x505abc);});});} \ No newline at end of file +var _0x70e3=['then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xb4c1f4,_0x10648f){var _0x443ccc=function(_0x16a69a){while(--_0x16a69a){_0xb4c1f4['push'](_0xb4c1f4['shift']());}};_0x443ccc(++_0x10648f);}(_0x70e3,0x9d));var _0x370e=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x70e3[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0x370e('0x0'));var util=require(_0x370e('0x1'));var moment=require(_0x370e('0x2'));var BPromise=require(_0x370e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x370e('0x4'));var db=require(_0x370e('0x5'))['db'];var utils=require(_0x370e('0x6'));var logger=require('../../config/logger')(_0x370e('0x7'));var config=require(_0x370e('0x8'));var jayson=require(_0x370e('0x9'));var client=jayson[_0x370e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2aaf,_0x5f57ea,_0x4a6884){return new BPromise(function(_0x5e5c79,_0x4086c4){return client['request'](_0x3a2aaf,_0x4a6884)[_0x370e('0xb')](function(_0x52d611){logger[_0x370e('0xc')](_0x370e('0xd'),_0x5f57ea,'request\x20sent');logger['debug'](_0x370e('0xe'),_0x5f57ea,_0x370e('0xf'),JSON[_0x370e('0x10')](_0x52d611));if(_0x52d611[_0x370e('0x11')]){if(_0x52d611[_0x370e('0x11')]['code']===0x1f4){logger[_0x370e('0x11')](_0x370e('0xd'),_0x5f57ea,_0x52d611[_0x370e('0x11')][_0x370e('0x12')]);return _0x4086c4(_0x52d611[_0x370e('0x11')][_0x370e('0x12')]);}logger[_0x370e('0x11')](_0x370e('0xd'),_0x5f57ea,_0x52d611[_0x370e('0x11')][_0x370e('0x12')]);return _0x5e5c79(_0x52d611[_0x370e('0x11')]['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x5f57ea,_0x370e('0xf'));_0x5e5c79(_0x52d611[_0x370e('0x13')][_0x370e('0x12')]);}})[_0x370e('0x14')](function(_0xb8381f){logger[_0x370e('0x11')]('Automation,\x20%s,\x20%s',_0x5f57ea,_0xb8381f);_0x4086c4(_0xb8381f);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4e5f6d5..a284468 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 _0x1294=['../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','getActions','post','addActions','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service'];(function(_0x2da402,_0x14a691){var _0x31a57d=function(_0x3cfb60){while(--_0x3cfb60){_0x2da402['push'](_0x2da402['shift']());}};_0x31a57d(++_0x14a691);}(_0x1294,0xb8));var _0x4129=function(_0xa09242,_0x13dfdc){_0xa09242=_0xa09242-0x0;var _0x411cd0=_0x1294[_0xa09242];return _0x411cd0;};'use strict';var multer=require(_0x4129('0x0'));var util=require('util');var path=require(_0x4129('0x1'));var timeout=require('connect-timeout');var express=require(_0x4129('0x2'));var router=express[_0x4129('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4129('0x4'));var interaction=require(_0x4129('0x5'));var config=require(_0x4129('0x6'));var controller=require(_0x4129('0x7'));router[_0x4129('0x8')]('/',auth[_0x4129('0x9')](),controller[_0x4129('0xa')]);router[_0x4129('0x8')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0xc')]);router[_0x4129('0x8')]('/:id/conditions',auth[_0x4129('0x9')](),controller[_0x4129('0xd')]);router[_0x4129('0x8')]('/:id/actions',auth['isAuthenticated'](),controller[_0x4129('0xe')]);router[_0x4129('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x4129('0xf')]('/:id/actions',auth[_0x4129('0x9')](),controller[_0x4129('0x10')]);router[_0x4129('0x11')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0x12')]);router[_0x4129('0x13')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd847=['../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get','/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x41a6f4,_0x2a5df9){var _0x40785e=function(_0x2ad2a8){while(--_0x2ad2a8){_0x41a6f4['push'](_0x41a6f4['shift']());}};_0x40785e(++_0x2a5df9);}(_0xd847,0x18a));var _0x7d84=function(_0x300cdb,_0x88b46){_0x300cdb=_0x300cdb-0x0;var _0x54e47f=_0xd847[_0x300cdb];return _0x54e47f;};'use strict';var multer=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var path=require(_0x7d84('0x2'));var timeout=require(_0x7d84('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7d84('0x4'));var auth=require(_0x7d84('0x5'));var interaction=require(_0x7d84('0x6'));var config=require(_0x7d84('0x7'));var controller=require(_0x7d84('0x8'));router['get']('/',auth[_0x7d84('0x9')](),controller['index']);router[_0x7d84('0xa')](_0x7d84('0xb'),auth[_0x7d84('0x9')](),controller[_0x7d84('0xc')]);router[_0x7d84('0xa')](_0x7d84('0xd'),auth['isAuthenticated'](),controller[_0x7d84('0xe')]);router['get']('/:id/actions',auth[_0x7d84('0x9')](),controller[_0x7d84('0xf')]);router[_0x7d84('0x10')]('/',auth[_0x7d84('0x9')](),controller[_0x7d84('0x11')]);router[_0x7d84('0x10')](_0x7d84('0xd'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x12')]);router[_0x7d84('0x10')](_0x7d84('0x13'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x14')]);router[_0x7d84('0x15')](_0x7d84('0xb'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x16')]);router[_0x7d84('0x17')](_0x7d84('0xb'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x18')]);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 5e4b95b..7bf3be7 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 _0x52bb=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','#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)','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x367805,_0x34f058){var _0x5dad09=function(_0x494004){while(--_0x494004){_0x367805['push'](_0x367805['shift']());}};_0x5dad09(++_0x34f058);}(_0x52bb,0xd4));var _0xb52b=function(_0x377a3f,_0x5239fe){_0x377a3f=_0x377a3f-0x0;var _0x3328e8=_0x52bb[_0x377a3f];return _0x3328e8;};'use strict';var Sequelize=require(_0xb52b('0x0'));module[_0xb52b('0x1')]={'name':{'type':Sequelize[_0xb52b('0x2')],'unique':_0xb52b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb52b('0x4')](_0xb52b('0x5')),'allowNull':![],'defaultValue':_0xb52b('0x5')},'description':{'type':Sequelize[_0xb52b('0x2')]},'active':{'type':Sequelize[_0xb52b('0x6')],'defaultValue':0x0,'comment':_0xb52b('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xb52b('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xb52b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xb52b('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xb52b('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb52b('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb52b('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xb52b('0x9')](0x3)[_0xb52b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb52b('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb52b('0x9')](0x3)[_0xb52b('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb52b('0x9')](0x5)[_0xb52b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb52b('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb52b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb52b('0x2')],'defaultValue':_0xb52b('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xb52b('0x4')](_0xb52b('0xe'),'never',_0xb52b('0xf')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xb52b('0x9')](0x9)[_0xb52b('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb52b('0x10')},'dialAMDGreeting':{'type':Sequelize[_0xb52b('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb52b('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb52b('0x9')](0x9)[_0xb52b('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb52b('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb52b('0x9')](0x9)[_0xb52b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb52b('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xb52b('0x9')](0x9)[_0xb52b('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb52b('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb52b('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb52b('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb52b('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb52b('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb52b('0x9')](0x5)[_0xb52b('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb52b('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb52b('0x4')]('DESC','ASC'),'defaultValue':_0xb52b('0x18')},'dialPrefix':{'type':Sequelize[_0xb52b('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xb52b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb52b('0x19')},'dialCutDigit':{'type':Sequelize[_0xb52b('0x9')](0x3)[_0xb52b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb52b('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb52b('0x9')](0x3)[_0xb52b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb52b('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb52b('0x9')](0x5)[_0xb52b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb52b('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xb52b('0x9')](0x3)[_0xb52b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb52b('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xb52b('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb52b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb52b('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb52b('0x9')](0x5)[_0xb52b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb52b('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0xb52b('0x9')](0x3)[_0xb52b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb52b('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb52b('0x9')](0x5)[_0xb52b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb52b('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb52b('0x9')](0x3)[_0xb52b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb52b('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb52b('0x9')](0x5)[_0xb52b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x2581=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x4845cd,_0x4e7997){var _0x38d59a=function(_0x4bb7e3){while(--_0x4bb7e3){_0x4845cd['push'](_0x4845cd['shift']());}};_0x38d59a(++_0x4e7997);}(_0x2581,0x72));var _0x1258=function(_0x21ef4c,_0x3dbb09){_0x21ef4c=_0x21ef4c-0x0;var _0xf4326=_0x2581[_0x21ef4c];return _0xf4326;};'use strict';var Sequelize=require(_0x1258('0x0'));module[_0x1258('0x1')]={'name':{'type':Sequelize[_0x1258('0x2')],'unique':_0x1258('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1258('0x4')](_0x1258('0x5')),'allowNull':![],'defaultValue':_0x1258('0x5')},'description':{'type':Sequelize[_0x1258('0x2')]},'active':{'type':Sequelize[_0x1258('0x6')],'defaultValue':0x0,'comment':_0x1258('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x1258('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1258('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1258('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1258('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1258('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1258('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1258('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1258('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1258('0xe')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x3,'comment':_0x1258('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1258('0xa')](0x5)[_0x1258('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1258('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1258('0x2')],'defaultValue':_0x1258('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x1258('0x4')](_0x1258('0x11'),'never',_0x1258('0x12')),'defaultValue':_0x1258('0x11')},'dialAMDActive':{'type':Sequelize[_0x1258('0x6')],'defaultValue':0x0,'comment':_0x1258('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x1258('0xa')](0x9)[_0x1258('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1258('0xa')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1258('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1258('0xa')](0x9)[_0x1258('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1258('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1258('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1258('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1258('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1258('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1258('0xa')](0x9)[_0x1258('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1258('0xa')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1258('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1258('0xa')](0x5)[_0x1258('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1258('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1258('0xa')](0x9)[_0x1258('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1258('0x1a'),_0x1258('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1258('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1258('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1258('0xa')](0x5)[_0x1258('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1258('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x1258('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1258('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1258('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)[_0x1258('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1258('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1258('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1258('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1258('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index afb4ba3..44d2147 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 _0xc803=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','stack','name','index','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Campaign','include','catch','show','params','includeAll','find','create','body','role','user','userProfileId','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','pick','CmHopper','findAll','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','ContactId','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','from','push','all','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x4e19b4,_0x563cdb){var _0x5c01a4=function(_0x3560a3){while(--_0x3560a3){_0x4e19b4['push'](_0x4e19b4['shift']());}};_0x5c01a4(++_0x563cdb);}(_0xc803,0xee));var _0x3c80=function(_0x371192,_0x4c73e7){_0x371192=_0x371192-0x0;var _0x501884=_0xc803[_0x371192];return _0x501884;};'use strict';var emlformat=require(_0x3c80('0x0'));var rimraf=require(_0x3c80('0x1'));var zipdir=require(_0x3c80('0x2'));var jsonpatch=require(_0x3c80('0x3'));var rp=require(_0x3c80('0x4'));var moment=require(_0x3c80('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c80('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3c80('0x7'));var csv=require(_0x3c80('0x8'));var ejs=require(_0x3c80('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c80('0xa'));var squel=require(_0x3c80('0xb'));var crypto=require(_0x3c80('0xc'));var jsforce=require(_0x3c80('0xd'));var deskjs=require(_0x3c80('0xe'));var toCsv=require(_0x3c80('0x8'));var querystring=require(_0x3c80('0xf'));var Papa=require('papaparse');var Redis=require(_0x3c80('0x10'));var authService=require(_0x3c80('0x11'));var qs=require(_0x3c80('0x12'));var as=require(_0x3c80('0x13'));var hardwareService=require(_0x3c80('0x14'));var logger=require(_0x3c80('0x15'))(_0x3c80('0x16'));var utils=require('../../config/utils');var config=require(_0x3c80('0x17'));var licenseUtil=require(_0x3c80('0x18'));var db=require(_0x3c80('0x19'))['db'];function respondWithStatusCode(_0x58d6a7,_0x4c04b0){_0x4c04b0=_0x4c04b0||0xcc;return function(_0x2345cd){if(_0x2345cd){return _0x58d6a7[_0x3c80('0x1a')](_0x4c04b0);}return _0x58d6a7['status'](_0x4c04b0)['end']();};}function respondWithResult(_0x11fc16,_0x2f977f){_0x2f977f=_0x2f977f||0xc8;return function(_0x12ee3e){if(_0x12ee3e){return _0x11fc16[_0x3c80('0x1b')](_0x2f977f)[_0x3c80('0x1c')](_0x12ee3e);}};}function respondWithFilteredResult(_0xf36af2,_0x235837){return function(_0x384ddb){if(_0x384ddb){var _0xf87dfd=typeof _0x235837[_0x3c80('0x1d')]===_0x3c80('0x1e')&&typeof _0x235837[_0x3c80('0x1f')]===_0x3c80('0x1e');var _0x3e9f38=_0x384ddb[_0x3c80('0x20')];var _0x552a09=_0xf87dfd?0x0:_0x235837[_0x3c80('0x1d')];var _0x13cc91=_0xf87dfd?_0x384ddb['count']:_0x235837['offset']+_0x235837[_0x3c80('0x1f')];var _0x3296cc;if(_0x13cc91>=_0x3e9f38){_0x13cc91=_0x3e9f38;_0x3296cc=0xc8;}else{_0x3296cc=0xce;}_0xf36af2[_0x3c80('0x1b')](_0x3296cc);return _0xf36af2['set'](_0x3c80('0x21'),_0x552a09+'-'+_0x13cc91+'/'+_0x3e9f38)[_0x3c80('0x1c')](_0x384ddb);}return null;};}function patchUpdates(_0x16eb38){return function(_0x2d9756){try{jsonpatch[_0x3c80('0x22')](_0x2d9756,_0x16eb38,!![]);}catch(_0x3846c7){return BPromise[_0x3c80('0x23')](_0x3846c7);}return _0x2d9756[_0x3c80('0x24')]();};}function saveUpdates(_0x290fb8,_0x47777e){return function(_0x1969e3){if(_0x1969e3){return _0x1969e3[_0x3c80('0x25')](_0x290fb8)[_0x3c80('0x26')](function(_0x365397){return _0x365397;});}return null;};}function removeEntity(_0x47b751,_0x47ea73){return function(_0x41f755){if(_0x41f755){return _0x41f755[_0x3c80('0x27')]()['then'](function(){var _0xbdd4a8=_0x41f755[_0x3c80('0x28')]({'plain':!![]});var _0x28cf47=_0x3c80('0x29');return db[_0x3c80('0x2a')][_0x3c80('0x27')]({'where':{'type':_0x28cf47,'resourceId':_0xbdd4a8['id']}})[_0x3c80('0x26')](function(){return _0x41f755;});})[_0x3c80('0x26')](function(){_0x47b751[_0x3c80('0x1b')](0xcc)[_0x3c80('0x2b')]();});}};}function handleEntityNotFound(_0x1b489e,_0xcd4bb4){return function(_0x4e72e3){if(!_0x4e72e3){_0x1b489e[_0x3c80('0x1a')](0x194);}return _0x4e72e3;};}function handleError(_0x39ad49,_0x2ed6f5){_0x2ed6f5=_0x2ed6f5||0x1f4;return function(_0x29f4d7){logger[_0x3c80('0x2c')](_0x29f4d7[_0x3c80('0x2d')]);if(_0x29f4d7[_0x3c80('0x2e')]){delete _0x29f4d7[_0x3c80('0x2e')];}_0x39ad49[_0x3c80('0x1b')](_0x2ed6f5)['send'](_0x29f4d7);};}exports[_0x3c80('0x2f')]=function(_0xf55c17,_0x23a498){var _0x4186c5={},_0x6bec82={},_0x496d33={'count':0x0,'rows':[]};var _0x131ac4=_['map'](db['Campaign'][_0x3c80('0x30')],function(_0x585c32){return{'name':_0x585c32['fieldName'],'type':_0x585c32[_0x3c80('0x31')]['key']};});_0x6bec82[_0x3c80('0x32')]=_['map'](_0x131ac4,_0x3c80('0x2e'));_0x6bec82[_0x3c80('0x33')]=_[_0x3c80('0x34')](_0xf55c17[_0x3c80('0x33')]);_0x6bec82[_0x3c80('0x35')]=_[_0x3c80('0x36')](_0x6bec82[_0x3c80('0x32')],_0x6bec82['query']);_0x4186c5['attributes']=_[_0x3c80('0x36')](_0x6bec82[_0x3c80('0x32')],qs[_0x3c80('0x37')](_0xf55c17[_0x3c80('0x33')][_0x3c80('0x37')]));_0x4186c5['attributes']=_0x4186c5[_0x3c80('0x38')][_0x3c80('0x39')]?_0x4186c5[_0x3c80('0x38')]:_0x6bec82['model'];if(!_0xf55c17[_0x3c80('0x33')][_0x3c80('0x3a')](_0x3c80('0x3b'))){_0x4186c5[_0x3c80('0x1f')]=qs['limit'](_0xf55c17['query'][_0x3c80('0x1f')]);_0x4186c5[_0x3c80('0x1d')]=qs['offset'](_0xf55c17[_0x3c80('0x33')][_0x3c80('0x1d')]);}_0x4186c5[_0x3c80('0x3c')]=qs[_0x3c80('0x3d')](_0xf55c17[_0x3c80('0x33')][_0x3c80('0x3d')]);_0x4186c5[_0x3c80('0x3e')]=qs[_0x3c80('0x35')](_['pick'](_0xf55c17[_0x3c80('0x33')],_0x6bec82[_0x3c80('0x35')]),_0x131ac4);if(_0xf55c17['query'][_0x3c80('0x3f')]){_0x4186c5[_0x3c80('0x3e')]=_[_0x3c80('0x40')](_0x4186c5[_0x3c80('0x3e')],{'$or':_[_0x3c80('0x41')](_0x131ac4,function(_0x4f6408){if(_0x4f6408['type']!==_0x3c80('0x42')){var _0x6f883d={};_0x6f883d[_0x4f6408[_0x3c80('0x2e')]]={'$like':'%'+_0xf55c17['query']['filter']+'%'};return _0x6f883d;}})});}_0x4186c5=_[_0x3c80('0x40')]({},_0x4186c5,_0xf55c17[_0x3c80('0x43')]);var _0x5bf7a6={'where':_0x4186c5[_0x3c80('0x3e')]};return db[_0x3c80('0x44')]['count'](_0x5bf7a6)[_0x3c80('0x26')](function(_0x39dcf8){_0x496d33[_0x3c80('0x20')]=_0x39dcf8;if(_0xf55c17['query']['includeAll']){_0x4186c5[_0x3c80('0x45')]=[{'all':!![]}];}return db[_0x3c80('0x44')]['findAll'](_0x4186c5);})[_0x3c80('0x26')](function(_0x21dcd9){_0x496d33['rows']=_0x21dcd9;return _0x496d33;})[_0x3c80('0x26')](respondWithFilteredResult(_0x23a498,_0x4186c5))[_0x3c80('0x46')](handleError(_0x23a498,null));};exports[_0x3c80('0x47')]=function(_0x4c353f,_0x4e0289){var _0x34bdaf={'raw':![],'where':{'id':_0x4c353f[_0x3c80('0x48')]['id']}},_0x3ac7af={};_0x3ac7af[_0x3c80('0x32')]=_[_0x3c80('0x34')](db[_0x3c80('0x44')][_0x3c80('0x30')]);_0x3ac7af[_0x3c80('0x33')]=_[_0x3c80('0x34')](_0x4c353f[_0x3c80('0x33')]);_0x3ac7af[_0x3c80('0x35')]=_['intersection'](_0x3ac7af[_0x3c80('0x32')],_0x3ac7af[_0x3c80('0x33')]);_0x34bdaf['attributes']=_['intersection'](_0x3ac7af[_0x3c80('0x32')],qs[_0x3c80('0x37')](_0x4c353f['query'][_0x3c80('0x37')]));_0x34bdaf[_0x3c80('0x38')]=_0x34bdaf[_0x3c80('0x38')]['length']?_0x34bdaf[_0x3c80('0x38')]:_0x3ac7af[_0x3c80('0x32')];if(_0x4c353f['query'][_0x3c80('0x49')]){_0x34bdaf[_0x3c80('0x45')]=[{'all':!![]}];}_0x34bdaf=_['merge']({},_0x34bdaf,_0x4c353f[_0x3c80('0x43')]);return db[_0x3c80('0x44')][_0x3c80('0x4a')](_0x34bdaf)['then'](handleEntityNotFound(_0x4e0289,null))[_0x3c80('0x26')](respondWithResult(_0x4e0289,null))[_0x3c80('0x46')](handleError(_0x4e0289,null));};exports[_0x3c80('0x4b')]=function(_0x4d0a0e,_0x493896){return db[_0x3c80('0x44')]['create'](_0x4d0a0e[_0x3c80('0x4c')],{})[_0x3c80('0x26')](function(_0x58c9c1){var _0x72c79=_0x4d0a0e['user'][_0x3c80('0x28')]({'plain':!![]});if(!_0x72c79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x72c79[_0x3c80('0x4d')]===_0x3c80('0x4e')){var _0x3401b6=_0x58c9c1[_0x3c80('0x28')]({'plain':!![]});var _0x4eb52e='IvrCampaigns';return db['UserProfileSection'][_0x3c80('0x4a')]({'where':{'name':_0x4eb52e,'userProfileId':_0x72c79[_0x3c80('0x4f')]},'raw':!![]})[_0x3c80('0x26')](function(_0x2796ae){if(_0x2796ae&&_0x2796ae['autoAssociation']===0x0){return db[_0x3c80('0x2a')][_0x3c80('0x4b')]({'name':_0x3401b6[_0x3c80('0x2e')],'resourceId':_0x3401b6['id'],'type':_0x2796ae[_0x3c80('0x2e')],'sectionId':_0x2796ae['id']},{})[_0x3c80('0x26')](function(){return _0x58c9c1;});}else{return _0x58c9c1;}})['catch'](function(_0x557a69){logger[_0x3c80('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557a69);throw _0x557a69;});}return _0x58c9c1;})[_0x3c80('0x26')](respondWithResult(_0x493896,0xc9))[_0x3c80('0x46')](handleError(_0x493896,null));};exports['clone']=function(_0x6ba051,_0x19eb3e){var _0x366ab2={'where':{'id':_0x6ba051['params']['id']}},_0x23ed79={};_0x23ed79['model']=_[_0x3c80('0x34')](db[_0x3c80('0x44')][_0x3c80('0x30')]);_0x366ab2['attributes']=_[_0x3c80('0x36')](_0x23ed79['model'],qs[_0x3c80('0x37')](_0x6ba051[_0x3c80('0x33')][_0x3c80('0x37')]));_0x366ab2[_0x3c80('0x38')]=_0x366ab2[_0x3c80('0x38')]['length']?_0x366ab2['attributes']:_0x23ed79[_0x3c80('0x32')];if(_0x6ba051['query'][_0x3c80('0x49')]){_0x366ab2[_0x3c80('0x45')]=[{'all':!![]}];}_0x366ab2=_['merge']({},_0x366ab2,_0x6ba051['options']);return db[_0x3c80('0x44')]['find'](_0x366ab2)[_0x3c80('0x26')](handleEntityNotFound(_0x19eb3e,null))['then'](function(_0x53628f){if(_0x53628f){var _0x32d30=_0x53628f[_0x3c80('0x28')]({'plain':!![]});_0x32d30=qs[_0x3c80('0x50')](_0x32d30,['id',_0x3c80('0x51'),_0x3c80('0x52')]);_0x6ba051[_0x3c80('0x4c')]=_[_0x3c80('0x50')](_0x6ba051[_0x3c80('0x4c')],['id',_0x3c80('0x51'),'updatedAt']);return db['Campaign'][_0x3c80('0x4b')](_[_0x3c80('0x40')](_0x32d30,_0x6ba051[_0x3c80('0x4c')]),{'include':_0x6ba051['query'][_0x3c80('0x49')]?[{'all':!![]}]:undefined})[_0x3c80('0x26')](function(_0x43704a){var _0x208fd5=_0x6ba051[_0x3c80('0x4e')]['get']({'plain':!![]});if(!_0x208fd5)throw new Error(_0x3c80('0x53'));if(_0x208fd5[_0x3c80('0x4d')]==='user'){var _0x7d655=_0x43704a['get']({'plain':!![]});var _0x4e0490='IvrCampaigns';return db['UserProfileSection'][_0x3c80('0x4a')]({'where':{'name':_0x4e0490,'userProfileId':_0x208fd5[_0x3c80('0x4f')]},'raw':!![]})['then'](function(_0x42b926){if(_0x42b926&&_0x42b926[_0x3c80('0x54')]===0x0){return db['UserProfileResource'][_0x3c80('0x4b')]({'name':_0x7d655['name'],'resourceId':_0x7d655['id'],'type':_0x42b926[_0x3c80('0x2e')],'sectionId':_0x42b926['id']},{})[_0x3c80('0x26')](function(){return _0x43704a;});}else{return _0x43704a;}})[_0x3c80('0x46')](function(_0xa4ccb9){logger[_0x3c80('0x2c')](_0x3c80('0x55'),_0xa4ccb9);throw _0xa4ccb9;});}return _0x43704a;});}})[_0x3c80('0x26')](respondWithResult(_0x19eb3e,0xc9))[_0x3c80('0x46')](handleError(_0x19eb3e,null));};exports[_0x3c80('0x25')]=function(_0x50fa85,_0x3c6f47){if(_0x50fa85[_0x3c80('0x4c')]['id']){delete _0x50fa85['body']['id'];}return db[_0x3c80('0x44')][_0x3c80('0x4a')]({'where':{'id':_0x50fa85[_0x3c80('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c6f47,null))[_0x3c80('0x26')](saveUpdates(_0x50fa85[_0x3c80('0x4c')],null))[_0x3c80('0x26')](respondWithResult(_0x3c6f47,null))[_0x3c80('0x46')](handleError(_0x3c6f47,null));};exports[_0x3c80('0x27')]=function(_0x43afad,_0x57cfda){return db[_0x3c80('0x44')]['find']({'where':{'id':_0x43afad[_0x3c80('0x48')]['id']}})['then'](handleEntityNotFound(_0x57cfda,null))['then'](removeEntity(_0x57cfda,null))[_0x3c80('0x46')](handleError(_0x57cfda,null));};exports[_0x3c80('0x56')]=function(_0x26463c,_0x15531d,_0x4dd67b){var _0x22d4d4={'raw':!![],'where':{}};var _0x292d73={};var _0x3368e1={'count':0x0,'rows':[]};return db[_0x3c80('0x44')][_0x3c80('0x57')]({'where':{'id':_0x26463c[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0x15531d,null))[_0x3c80('0x26')](function(_0x5da323){if(_0x5da323){_0x292d73['model']=_[_0x3c80('0x34')](db['CmHopper'][_0x3c80('0x30')]);_0x292d73[_0x3c80('0x33')]=_[_0x3c80('0x34')](_0x26463c[_0x3c80('0x33')]);_0x292d73[_0x3c80('0x35')]=_[_0x3c80('0x36')](_0x292d73['model'],_0x292d73[_0x3c80('0x33')]);_0x22d4d4[_0x3c80('0x38')]=_[_0x3c80('0x36')](_0x292d73['model'],qs[_0x3c80('0x37')](_0x26463c['query'][_0x3c80('0x37')]));_0x22d4d4[_0x3c80('0x38')]=_0x22d4d4[_0x3c80('0x38')][_0x3c80('0x39')]?_0x22d4d4[_0x3c80('0x38')]:_0x292d73[_0x3c80('0x32')];if(!_0x26463c['query'][_0x3c80('0x3a')](_0x3c80('0x3b'))){_0x22d4d4[_0x3c80('0x1f')]=qs[_0x3c80('0x1f')](_0x26463c['query'][_0x3c80('0x1f')]);_0x22d4d4[_0x3c80('0x1d')]=qs[_0x3c80('0x1d')](_0x26463c[_0x3c80('0x33')][_0x3c80('0x1d')]);}_0x22d4d4[_0x3c80('0x3c')]=qs[_0x3c80('0x3d')](_0x26463c[_0x3c80('0x33')][_0x3c80('0x3d')]);_0x22d4d4[_0x3c80('0x3e')]=qs[_0x3c80('0x35')](_[_0x3c80('0x58')](_0x26463c[_0x3c80('0x33')],_0x292d73[_0x3c80('0x35')]));_0x22d4d4[_0x3c80('0x3e')]['CampaignId']=_0x5da323['id'];if(_0x26463c[_0x3c80('0x33')][_0x3c80('0x3f')]){_0x22d4d4[_0x3c80('0x3e')]=_[_0x3c80('0x40')](_0x22d4d4[_0x3c80('0x3e')],{'$or':_[_0x3c80('0x41')](_0x22d4d4['attributes'],function(_0x57323c){var _0x451687={};_0x451687[_0x57323c]={'$like':'%'+_0x26463c[_0x3c80('0x33')][_0x3c80('0x3f')]+'%'};return _0x451687;})});}_0x22d4d4=_['merge']({},_0x22d4d4,_0x26463c['options']);return db[_0x3c80('0x59')][_0x3c80('0x20')]({'where':_0x22d4d4[_0x3c80('0x3e')]})['then'](function(_0x4c4833){_0x3368e1[_0x3c80('0x20')]=_0x4c4833;if(_0x26463c[_0x3c80('0x33')][_0x3c80('0x49')]){_0x22d4d4['include']=[{'all':!![]}];}return db[_0x3c80('0x59')][_0x3c80('0x5a')](_0x22d4d4);})[_0x3c80('0x26')](function(_0x26d3ef){_0x3368e1[_0x3c80('0x5b')]=_0x26d3ef;return _0x3368e1;});}})[_0x3c80('0x26')](respondWithFilteredResult(_0x15531d,_0x22d4d4))[_0x3c80('0x46')](handleError(_0x15531d,null));};exports['getHopperHistories']=function(_0x4307f9,_0x44b5fc,_0x15cdaf){var _0x27e064={'raw':!![],'where':{}};var _0x1db1c3={};var _0x28a852={'count':0x0,'rows':[]};return db['Campaign'][_0x3c80('0x57')]({'where':{'id':_0x4307f9[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0x44b5fc,null))[_0x3c80('0x26')](function(_0x4f390c){if(_0x4f390c){_0x1db1c3[_0x3c80('0x32')]=_[_0x3c80('0x34')](db[_0x3c80('0x5c')][_0x3c80('0x30')]);_0x1db1c3[_0x3c80('0x33')]=_[_0x3c80('0x34')](_0x4307f9[_0x3c80('0x33')]);_0x1db1c3['filters']=_[_0x3c80('0x36')](_0x1db1c3[_0x3c80('0x32')],_0x1db1c3[_0x3c80('0x33')]);_0x27e064[_0x3c80('0x38')]=_[_0x3c80('0x36')](_0x1db1c3[_0x3c80('0x32')],qs[_0x3c80('0x37')](_0x4307f9[_0x3c80('0x33')]['fields']));_0x27e064[_0x3c80('0x38')]=_0x27e064['attributes'][_0x3c80('0x39')]?_0x27e064[_0x3c80('0x38')]:_0x1db1c3[_0x3c80('0x32')];if(!_0x4307f9['query']['hasOwnProperty'](_0x3c80('0x3b'))){_0x27e064[_0x3c80('0x1f')]=qs[_0x3c80('0x1f')](_0x4307f9[_0x3c80('0x33')]['limit']);_0x27e064['offset']=qs['offset'](_0x4307f9['query'][_0x3c80('0x1d')]);}_0x27e064[_0x3c80('0x3c')]=qs[_0x3c80('0x3d')](_0x4307f9[_0x3c80('0x33')][_0x3c80('0x3d')]);_0x27e064[_0x3c80('0x3e')]=qs[_0x3c80('0x35')](_[_0x3c80('0x58')](_0x4307f9[_0x3c80('0x33')],_0x1db1c3['filters']));_0x27e064[_0x3c80('0x3e')]['CampaignId']=_0x4f390c['id'];if(_0x4307f9[_0x3c80('0x33')][_0x3c80('0x3f')]){_0x27e064['where']=_[_0x3c80('0x40')](_0x27e064[_0x3c80('0x3e')],{'$or':_[_0x3c80('0x41')](_0x27e064[_0x3c80('0x38')],function(_0x22f5a4){var _0x1937d2={};_0x1937d2[_0x22f5a4]={'$like':'%'+_0x4307f9[_0x3c80('0x33')]['filter']+'%'};return _0x1937d2;})});}_0x27e064=_[_0x3c80('0x40')]({},_0x27e064,_0x4307f9['options']);return db[_0x3c80('0x5c')][_0x3c80('0x20')]({'where':_0x27e064['where']})[_0x3c80('0x26')](function(_0x5126e7){_0x28a852[_0x3c80('0x20')]=_0x5126e7;if(_0x4307f9[_0x3c80('0x33')][_0x3c80('0x49')]){_0x27e064[_0x3c80('0x45')]=[{'all':!![]}];}return db[_0x3c80('0x5c')][_0x3c80('0x5a')](_0x27e064);})[_0x3c80('0x26')](function(_0x2d0f87){_0x28a852[_0x3c80('0x5b')]=_0x2d0f87;return _0x28a852;});}})['then'](respondWithFilteredResult(_0x44b5fc,_0x27e064))['catch'](handleError(_0x44b5fc,null));};exports[_0x3c80('0x5d')]=function(_0x297a03,_0x49e2c4,_0x33e767){var _0x581298={'raw':!![],'where':{}};var _0x3b1c17={};var _0x957367={'count':0x0,'rows':[]};return db[_0x3c80('0x44')][_0x3c80('0x57')]({'where':{'id':_0x297a03[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0x49e2c4,null))[_0x3c80('0x26')](function(_0x552cdc){if(_0x552cdc){_0x3b1c17[_0x3c80('0x32')]=_[_0x3c80('0x34')](db[_0x3c80('0x5e')][_0x3c80('0x30')]);_0x3b1c17[_0x3c80('0x33')]=_[_0x3c80('0x34')](_0x297a03[_0x3c80('0x33')]);_0x3b1c17[_0x3c80('0x35')]=_[_0x3c80('0x36')](_0x3b1c17[_0x3c80('0x32')],_0x3b1c17[_0x3c80('0x33')]);_0x581298[_0x3c80('0x38')]=_[_0x3c80('0x36')](_0x3b1c17[_0x3c80('0x32')],qs[_0x3c80('0x37')](_0x297a03[_0x3c80('0x33')][_0x3c80('0x37')]));_0x581298[_0x3c80('0x38')]=_0x581298[_0x3c80('0x38')][_0x3c80('0x39')]?_0x581298['attributes']:_0x3b1c17[_0x3c80('0x32')];if(!_0x297a03[_0x3c80('0x33')][_0x3c80('0x3a')](_0x3c80('0x3b'))){_0x581298[_0x3c80('0x1f')]=qs['limit'](_0x297a03[_0x3c80('0x33')][_0x3c80('0x1f')]);_0x581298[_0x3c80('0x1d')]=qs[_0x3c80('0x1d')](_0x297a03[_0x3c80('0x33')][_0x3c80('0x1d')]);}_0x581298[_0x3c80('0x3c')]=qs[_0x3c80('0x3d')](_0x297a03[_0x3c80('0x33')][_0x3c80('0x3d')]);_0x581298['where']=qs[_0x3c80('0x35')](_[_0x3c80('0x58')](_0x297a03[_0x3c80('0x33')],_0x3b1c17[_0x3c80('0x35')]));_0x581298[_0x3c80('0x3e')][_0x3c80('0x5f')]=_0x552cdc['id'];if(_0x297a03[_0x3c80('0x33')][_0x3c80('0x3f')]){_0x581298[_0x3c80('0x3e')]=_[_0x3c80('0x40')](_0x581298[_0x3c80('0x3e')],{'$or':_['map'](_0x581298[_0x3c80('0x38')],function(_0x4b7db5){var _0xd2ec78={};_0xd2ec78[_0x4b7db5]={'$like':'%'+_0x297a03[_0x3c80('0x33')][_0x3c80('0x3f')]+'%'};return _0xd2ec78;})});}_0x581298=_[_0x3c80('0x40')]({},_0x581298,_0x297a03[_0x3c80('0x43')]);return db[_0x3c80('0x5e')][_0x3c80('0x20')]({'where':_0x581298['where']})[_0x3c80('0x26')](function(_0xe28e8a){_0x957367[_0x3c80('0x20')]=_0xe28e8a;if(_0x297a03[_0x3c80('0x33')][_0x3c80('0x49')]){_0x581298[_0x3c80('0x45')]=[{'all':!![]}];}return db[_0x3c80('0x5e')][_0x3c80('0x5a')](_0x581298);})[_0x3c80('0x26')](function(_0x39a52f){_0x957367[_0x3c80('0x5b')]=_0x39a52f;return _0x957367;});}})[_0x3c80('0x26')](respondWithFilteredResult(_0x49e2c4,_0x581298))[_0x3c80('0x46')](handleError(_0x49e2c4,null));};exports['getHopperBlacks']=function(_0x536e35,_0x2ba5fc,_0x298cb7){var _0x1a4bdd={'raw':!![],'where':{}};var _0x552853={};var _0x32df7e={'count':0x0,'rows':[]};return db[_0x3c80('0x44')][_0x3c80('0x57')]({'where':{'id':_0x536e35[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0x2ba5fc,null))['then'](function(_0x50e8e2){if(_0x50e8e2){_0x552853['model']=_[_0x3c80('0x34')](db[_0x3c80('0x60')][_0x3c80('0x30')]);_0x552853[_0x3c80('0x33')]=_[_0x3c80('0x34')](_0x536e35['query']);_0x552853['filters']=_['intersection'](_0x552853[_0x3c80('0x32')],_0x552853[_0x3c80('0x33')]);_0x1a4bdd[_0x3c80('0x38')]=_[_0x3c80('0x36')](_0x552853[_0x3c80('0x32')],qs[_0x3c80('0x37')](_0x536e35[_0x3c80('0x33')][_0x3c80('0x37')]));_0x1a4bdd[_0x3c80('0x38')]=_0x1a4bdd[_0x3c80('0x38')][_0x3c80('0x39')]?_0x1a4bdd['attributes']:_0x552853[_0x3c80('0x32')];if(!_0x536e35[_0x3c80('0x33')][_0x3c80('0x3a')]('nolimit')){_0x1a4bdd[_0x3c80('0x1f')]=qs[_0x3c80('0x1f')](_0x536e35['query'][_0x3c80('0x1f')]);_0x1a4bdd['offset']=qs[_0x3c80('0x1d')](_0x536e35['query'][_0x3c80('0x1d')]);}_0x1a4bdd[_0x3c80('0x3c')]=qs['sort'](_0x536e35['query']['sort']);_0x1a4bdd['where']=qs[_0x3c80('0x35')](_['pick'](_0x536e35[_0x3c80('0x33')],_0x552853[_0x3c80('0x35')]));_0x1a4bdd[_0x3c80('0x3e')][_0x3c80('0x5f')]=_0x50e8e2['id'];if(_0x536e35[_0x3c80('0x33')][_0x3c80('0x3f')]){_0x1a4bdd[_0x3c80('0x3e')]=_['merge'](_0x1a4bdd[_0x3c80('0x3e')],{'$or':_[_0x3c80('0x41')](_0x1a4bdd[_0x3c80('0x38')],function(_0x283731){var _0x4798b1={};_0x4798b1[_0x283731]={'$like':'%'+_0x536e35['query'][_0x3c80('0x3f')]+'%'};return _0x4798b1;})});}_0x1a4bdd=_['merge']({},_0x1a4bdd,_0x536e35['options']);return db[_0x3c80('0x60')][_0x3c80('0x20')]({'where':_0x1a4bdd[_0x3c80('0x3e')]})['then'](function(_0x5e9653){_0x32df7e[_0x3c80('0x20')]=_0x5e9653;if(_0x536e35[_0x3c80('0x33')][_0x3c80('0x49')]){_0x1a4bdd[_0x3c80('0x45')]=[{'all':!![]}];}return db[_0x3c80('0x60')][_0x3c80('0x5a')](_0x1a4bdd);})[_0x3c80('0x26')](function(_0xf2260){_0x32df7e[_0x3c80('0x5b')]=_0xf2260;return _0x32df7e;});}})[_0x3c80('0x26')](respondWithFilteredResult(_0x2ba5fc,_0x1a4bdd))[_0x3c80('0x46')](handleError(_0x2ba5fc,null));};exports[_0x3c80('0x61')]=function(_0x1c5c56,_0xc8fd33,_0x553da0){var _0x40fc50={};var _0xcd4219={};var _0x4d3d88;var _0x159137;return db['Campaign']['findOne']({'where':{'id':_0x1c5c56['params']['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0xc8fd33,null))[_0x3c80('0x26')](function(_0x5f5499){if(_0x5f5499){_0x4d3d88=_0x5f5499;_0xcd4219[_0x3c80('0x32')]=_['keys'](db[_0x3c80('0x62')][_0x3c80('0x30')]);_0xcd4219['query']=_['keys'](_0x1c5c56[_0x3c80('0x33')]);_0xcd4219[_0x3c80('0x35')]=_[_0x3c80('0x36')](_0xcd4219[_0x3c80('0x32')],_0xcd4219[_0x3c80('0x33')]);_0x40fc50[_0x3c80('0x38')]=_['intersection'](_0xcd4219['model'],qs[_0x3c80('0x37')](_0x1c5c56[_0x3c80('0x33')][_0x3c80('0x37')]));_0x40fc50[_0x3c80('0x38')]=_0x40fc50[_0x3c80('0x38')]['length']?_0x40fc50[_0x3c80('0x38')]:_0xcd4219['model'];_0x40fc50[_0x3c80('0x3c')]=qs[_0x3c80('0x3d')](_0x1c5c56[_0x3c80('0x33')][_0x3c80('0x3d')]);_0x40fc50[_0x3c80('0x3e')]=qs[_0x3c80('0x35')](_['pick'](_0x1c5c56[_0x3c80('0x33')],_0xcd4219[_0x3c80('0x35')]));if(_0x1c5c56[_0x3c80('0x33')][_0x3c80('0x3f')]){_0x40fc50[_0x3c80('0x3e')]=_[_0x3c80('0x40')](_0x40fc50[_0x3c80('0x3e')],{'$or':_[_0x3c80('0x41')](_0x40fc50[_0x3c80('0x38')],function(_0x4e9d2f){var _0x1f8343={};_0x1f8343[_0x4e9d2f]={'$like':'%'+_0x1c5c56['query'][_0x3c80('0x3f')]+'%'};return _0x1f8343;})});}_0x40fc50=_[_0x3c80('0x40')]({},_0x40fc50,_0x1c5c56[_0x3c80('0x43')]);return _0x4d3d88[_0x3c80('0x61')](_0x40fc50);}})[_0x3c80('0x26')](function(_0x35b752){if(_0x35b752){_0x159137=_0x35b752['length'];if(!_0x1c5c56[_0x3c80('0x33')]['hasOwnProperty'](_0x3c80('0x3b'))){_0x40fc50[_0x3c80('0x1f')]=qs[_0x3c80('0x1f')](_0x1c5c56['query']['limit']);_0x40fc50[_0x3c80('0x1d')]=qs[_0x3c80('0x1d')](_0x1c5c56[_0x3c80('0x33')][_0x3c80('0x1d')]);}return _0x4d3d88[_0x3c80('0x61')](_0x40fc50);}})[_0x3c80('0x26')](function(_0x32cd91){if(_0x32cd91){return _0x32cd91?{'count':_0x159137,'rows':_0x32cd91}:null;}})[_0x3c80('0x26')](respondWithResult(_0xc8fd33,null))[_0x3c80('0x46')](handleError(_0xc8fd33,null));};exports['addLists']=function(_0x2e622c,_0x7d6f66,_0x2778d5){var _0x107b83,_0x46fd92;return db[_0x3c80('0x44')][_0x3c80('0x4a')]({'where':{'id':_0x2e622c[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0x7d6f66,null))[_0x3c80('0x26')](function(_0x5eb362){if(_0x5eb362){_0x46fd92=_0x5eb362;return _0x5eb362[_0x3c80('0x63')](_0x2e622c[_0x3c80('0x4c')][_0x3c80('0x64')],_[_0x3c80('0x50')](_0x2e622c[_0x3c80('0x4c')],[_0x3c80('0x64'),'id'])||{});}return null;})['spread'](function(_0x3fa957){var _0x259de2;_0x107b83=_0x3fa957||[];var _0x5a1352=[];if(_0x3fa957){for(var _0x21f95c=0x0;_0x21f95c<_0x3fa957[_0x3c80('0x39')];_0x21f95c+=0x1){var _0x41e5b6=_0x3fa957[_0x21f95c][_0x3c80('0x28')]({'plain':!![]});_0x46fd92[_0x3c80('0x65')]=_0x2e622c[_0x3c80('0x4c')][_0x3c80('0x65')]?_0x2e622c[_0x3c80('0x4c')][_0x3c80('0x65')]:_0x46fd92[_0x3c80('0x65')];switch(_0x46fd92[_0x3c80('0x65')]){case _0x3c80('0x66'):_0x259de2=squel[_0x3c80('0x67')]()['into'](_0x3c80('0x68'))[_0x3c80('0x69')]([_0x3c80('0x6a'),_0x3c80('0x6b'),'ContactId',_0x3c80('0x6c'),_0x3c80('0x5f'),_0x3c80('0x51'),_0x3c80('0x52')],squel[_0x3c80('0x6d')]()[_0x3c80('0x6e')]('phone',_0x3c80('0x6a'))[_0x3c80('0x6e')]('NOW()',_0x3c80('0x6b'))[_0x3c80('0x6e')]('id',_0x3c80('0x6f'))[_0x3c80('0x6e')](_0x41e5b6[_0x3c80('0x70')][_0x3c80('0x71')](),_0x3c80('0x6c'))[_0x3c80('0x6e')](_0x2e622c[_0x3c80('0x48')]['id'][_0x3c80('0x71')](),_0x3c80('0x5f'))[_0x3c80('0x6e')](_0x3c80('0x72'),'createdAt')[_0x3c80('0x6e')](_0x3c80('0x72'),_0x3c80('0x52'))['from'](_0x3c80('0x73'))[_0x3c80('0x3e')](_0x3c80('0x74'))[_0x3c80('0x3e')](_0x3c80('0x75'),_0x41e5b6[_0x3c80('0x70')][_0x3c80('0x71')]())['where'](_0x3c80('0x76'))[_0x3c80('0x3e')](_0x3c80('0x77'),squel['select']()[_0x3c80('0x6e')](_0x3c80('0x78'))['from'](_0x3c80('0x79'))[_0x3c80('0x3e')](_0x3c80('0x7a'),_0x2e622c[_0x3c80('0x48')]['id'][_0x3c80('0x71')]()))[_0x3c80('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x3c80('0x7b'))['from'](_0x3c80('0x68'))[_0x3c80('0x3e')]('CampaignId\x20=\x20?',_0x2e622c[_0x3c80('0x48')]['id']['toString']())))['toString']();break;case _0x3c80('0x7c'):_0x259de2=squel[_0x3c80('0x67')]()[_0x3c80('0x7d')](_0x3c80('0x68'))[_0x3c80('0x69')]([_0x3c80('0x6a'),'scheduledAt',_0x3c80('0x6f'),'ListId',_0x3c80('0x5f'),_0x3c80('0x51'),'updatedAt'],squel['select']()[_0x3c80('0x6e')](_0x3c80('0x6a'),'phone')[_0x3c80('0x6e')](_0x3c80('0x72'),'scheduledAt')[_0x3c80('0x6e')]('id','ContactId')[_0x3c80('0x6e')](_0x41e5b6[_0x3c80('0x70')]['toString'](),_0x3c80('0x6c'))['field'](_0x2e622c[_0x3c80('0x48')]['id'][_0x3c80('0x71')](),_0x3c80('0x5f'))['field'](_0x3c80('0x72'),_0x3c80('0x51'))['field'](_0x3c80('0x72'),_0x3c80('0x52'))['from'](_0x3c80('0x73'))[_0x3c80('0x3e')](_0x3c80('0x74'))[_0x3c80('0x3e')](_0x3c80('0x75'),_0x41e5b6[_0x3c80('0x70')][_0x3c80('0x71')]())[_0x3c80('0x3e')](_0x3c80('0x76'))['where'](_0x3c80('0x77'),squel['select']()[_0x3c80('0x6e')](_0x3c80('0x7b'))[_0x3c80('0x7e')](_0x3c80('0x68'))[_0x3c80('0x3e')](_0x3c80('0x7a'),_0x2e622c['params']['id']['toString']())))[_0x3c80('0x71')]();break;default:_0x259de2=squel['insert']()[_0x3c80('0x7d')](_0x3c80('0x68'))[_0x3c80('0x69')]([_0x3c80('0x6a'),_0x3c80('0x6b'),_0x3c80('0x6f'),'ListId','CampaignId','createdAt',_0x3c80('0x52')],squel['select']()['field'](_0x3c80('0x6a'),_0x3c80('0x6a'))[_0x3c80('0x6e')](_0x3c80('0x72'),_0x3c80('0x6b'))[_0x3c80('0x6e')]('id',_0x3c80('0x6f'))['field'](_0x41e5b6['CmListId'][_0x3c80('0x71')](),_0x3c80('0x6c'))['field'](_0x2e622c[_0x3c80('0x48')]['id']['toString'](),_0x3c80('0x5f'))['field'](_0x3c80('0x72'),_0x3c80('0x51'))[_0x3c80('0x6e')]('NOW()','updatedAt')[_0x3c80('0x7e')](_0x3c80('0x73'))[_0x3c80('0x3e')](_0x3c80('0x74'))[_0x3c80('0x3e')](_0x3c80('0x75'),_0x41e5b6[_0x3c80('0x70')]['toString']())[_0x3c80('0x3e')](_0x3c80('0x76')))[_0x3c80('0x71')]();}_0x5a1352[_0x3c80('0x7f')](db['sequelize'][_0x3c80('0x33')](_0x259de2));}return BPromise[_0x3c80('0x80')](_0x5a1352);}})[_0x3c80('0x26')](function(){return _0x107b83;})['then'](respondWithResult(_0x7d6f66,null))[_0x3c80('0x46')](handleError(_0x7d6f66,null));};exports['removeLists']=function(_0x3a7c98,_0x22842e,_0x64afec){return db[_0x3c80('0x44')][_0x3c80('0x4a')]({'where':{'id':_0x3a7c98[_0x3c80('0x48')]['id']}})['then'](handleEntityNotFound(_0x22842e,null))['then'](function(_0x2703de){if(_0x2703de){return _0x2703de[_0x3c80('0x81')](_0x3a7c98[_0x3c80('0x33')][_0x3c80('0x64')]);}})[_0x3c80('0x26')](function(_0x263cc1){if(_0x263cc1){return db[_0x3c80('0x59')][_0x3c80('0x27')]({'where':{'ListId':_0x3a7c98[_0x3c80('0x33')][_0x3c80('0x64')],'CampaignId':_0x3a7c98[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](function(){return _0x263cc1;});}})[_0x3c80('0x26')](respondWithStatusCode(_0x22842e,null))[_0x3c80('0x46')](handleError(_0x22842e,null));};exports[_0x3c80('0x82')]=function(_0x52caf2,_0x95cfdf,_0x4067e7){var _0x37ee66={};var _0x2763a0={};var _0x32fab6;var _0x152742;return db[_0x3c80('0x44')][_0x3c80('0x57')]({'where':{'id':_0x52caf2[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0x95cfdf,null))[_0x3c80('0x26')](function(_0x1f9900){if(_0x1f9900){_0x32fab6=_0x1f9900;_0x2763a0[_0x3c80('0x32')]=_[_0x3c80('0x34')](db[_0x3c80('0x62')][_0x3c80('0x30')]);_0x2763a0['query']=_[_0x3c80('0x34')](_0x52caf2[_0x3c80('0x33')]);_0x2763a0[_0x3c80('0x35')]=_[_0x3c80('0x36')](_0x2763a0[_0x3c80('0x32')],_0x2763a0[_0x3c80('0x33')]);_0x37ee66[_0x3c80('0x38')]=_['intersection'](_0x2763a0[_0x3c80('0x32')],qs[_0x3c80('0x37')](_0x52caf2[_0x3c80('0x33')][_0x3c80('0x37')]));_0x37ee66[_0x3c80('0x38')]=_0x37ee66[_0x3c80('0x38')]['length']?_0x37ee66[_0x3c80('0x38')]:_0x2763a0['model'];_0x37ee66[_0x3c80('0x3c')]=qs[_0x3c80('0x3d')](_0x52caf2[_0x3c80('0x33')]['sort']);_0x37ee66[_0x3c80('0x3e')]=qs['filters'](_[_0x3c80('0x58')](_0x52caf2[_0x3c80('0x33')],_0x2763a0[_0x3c80('0x35')]));if(_0x52caf2[_0x3c80('0x33')][_0x3c80('0x3f')]){_0x37ee66[_0x3c80('0x3e')]=_[_0x3c80('0x40')](_0x37ee66[_0x3c80('0x3e')],{'$or':_[_0x3c80('0x41')](_0x37ee66[_0x3c80('0x38')],function(_0x54f8a2){var _0x2f150c={};_0x2f150c[_0x54f8a2]={'$like':'%'+_0x52caf2[_0x3c80('0x33')][_0x3c80('0x3f')]+'%'};return _0x2f150c;})});}_0x37ee66=_[_0x3c80('0x40')]({},_0x37ee66,_0x52caf2[_0x3c80('0x43')]);return _0x32fab6[_0x3c80('0x82')](_0x37ee66);}})[_0x3c80('0x26')](function(_0x34eb42){if(_0x34eb42){_0x152742=_0x34eb42['length'];if(!_0x52caf2['query'][_0x3c80('0x3a')](_0x3c80('0x3b'))){_0x37ee66[_0x3c80('0x1f')]=qs[_0x3c80('0x1f')](_0x52caf2[_0x3c80('0x33')][_0x3c80('0x1f')]);_0x37ee66[_0x3c80('0x1d')]=qs[_0x3c80('0x1d')](_0x52caf2['query'][_0x3c80('0x1d')]);}return _0x32fab6['getBlackLists'](_0x37ee66);}})['then'](function(_0x1eb504){if(_0x1eb504){return _0x1eb504?{'count':_0x152742,'rows':_0x1eb504}:null;}})['then'](respondWithResult(_0x95cfdf,null))[_0x3c80('0x46')](handleError(_0x95cfdf,null));};exports[_0x3c80('0x83')]=function(_0x31b434,_0xe2985f,_0x4924a9){var _0x5575cf,_0x4c2d6d;return db[_0x3c80('0x44')][_0x3c80('0x4a')]({'where':{'id':_0x31b434[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0xe2985f,null))[_0x3c80('0x26')](function(_0x35742c){if(_0x35742c){_0x4c2d6d=_0x35742c;return _0x35742c[_0x3c80('0x83')](_0x31b434[_0x3c80('0x4c')][_0x3c80('0x64')],_[_0x3c80('0x50')](_0x31b434[_0x3c80('0x4c')],['ids','id'])||{});}return null;})[_0x3c80('0x84')](function(_0x8e379a){var _0x2fa2eb;_0x5575cf=_0x8e379a||[];var _0x34abbf=[];if(_0x8e379a){for(var _0x5ca0fe=0x0;_0x5ca0fe<_0x8e379a[_0x3c80('0x39')];_0x5ca0fe+=0x1){var _0x1344f9=_0x8e379a[_0x5ca0fe]['get']({'plain':!![]});_0x2fa2eb=squel[_0x3c80('0x67')]()[_0x3c80('0x7d')]('cm_hopper_black')[_0x3c80('0x69')](['phone',_0x3c80('0x6f'),'ListId',_0x3c80('0x5f'),'createdAt',_0x3c80('0x52')],squel[_0x3c80('0x6d')]()[_0x3c80('0x6e')](_0x3c80('0x6a'),_0x3c80('0x6a'))[_0x3c80('0x6e')]('id','ContactId')[_0x3c80('0x6e')](_0x1344f9[_0x3c80('0x70')]['toString'](),_0x3c80('0x6c'))[_0x3c80('0x6e')](_0x31b434['params']['id'][_0x3c80('0x71')](),_0x3c80('0x5f'))['field'](_0x3c80('0x72'),_0x3c80('0x51'))[_0x3c80('0x6e')](_0x3c80('0x72'),'updatedAt')[_0x3c80('0x7e')](_0x3c80('0x73'))[_0x3c80('0x3e')](_0x3c80('0x74'))[_0x3c80('0x3e')](_0x3c80('0x75'),_0x1344f9[_0x3c80('0x70')]['toString']())[_0x3c80('0x3e')](_0x3c80('0x76')))['toString']();_0x34abbf[_0x3c80('0x7f')](db['sequelize'][_0x3c80('0x33')](_0x2fa2eb));}return BPromise[_0x3c80('0x80')](_0x34abbf);}})[_0x3c80('0x26')](function(){return _0x5575cf;})[_0x3c80('0x26')](respondWithResult(_0xe2985f,null))[_0x3c80('0x46')](handleError(_0xe2985f,null));};exports[_0x3c80('0x85')]=function(_0x46e6b9,_0x249b23,_0x552d16){return db[_0x3c80('0x44')]['find']({'where':{'id':_0x46e6b9[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](handleEntityNotFound(_0x249b23,null))[_0x3c80('0x26')](function(_0x5cf2bc){if(_0x5cf2bc){return _0x5cf2bc['removeBlackLists'](_0x46e6b9[_0x3c80('0x33')][_0x3c80('0x64')]);}})['then'](function(_0x532049){if(_0x532049){return db[_0x3c80('0x60')][_0x3c80('0x27')]({'where':{'ListId':_0x46e6b9[_0x3c80('0x33')][_0x3c80('0x64')],'CampaignId':_0x46e6b9[_0x3c80('0x48')]['id']}})[_0x3c80('0x26')](function(){return _0x532049;});}})['then'](respondWithStatusCode(_0x249b23,null))[_0x3c80('0x46')](handleError(_0x249b23,null));}; \ No newline at end of file +var _0x6526=['phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','cm_contacts','select','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','map','Campaign','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','CampaignId','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0x6526,0xa2));var _0x6652=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x6526[_0x553a87];return _0x12d1e6;};'use strict';var emlformat=require(_0x6652('0x0'));var rimraf=require(_0x6652('0x1'));var zipdir=require(_0x6652('0x2'));var jsonpatch=require(_0x6652('0x3'));var rp=require(_0x6652('0x4'));var moment=require(_0x6652('0x5'));var BPromise=require(_0x6652('0x6'));var Mustache=require('mustache');var util=require(_0x6652('0x7'));var path=require('path');var sox=require(_0x6652('0x8'));var csv=require(_0x6652('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6652('0xa'));var _=require('lodash');var squel=require(_0x6652('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6652('0xc'));var toCsv=require(_0x6652('0x9'));var querystring=require(_0x6652('0xd'));var Papa=require(_0x6652('0xe'));var Redis=require(_0x6652('0xf'));var authService=require(_0x6652('0x10'));var qs=require(_0x6652('0x11'));var as=require(_0x6652('0x12'));var hardwareService=require(_0x6652('0x13'));var logger=require(_0x6652('0x14'))('api');var utils=require(_0x6652('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6652('0x16'));var db=require(_0x6652('0x17'))['db'];function respondWithStatusCode(_0x31ef0b,_0x209674){_0x209674=_0x209674||0xcc;return function(_0x386c30){if(_0x386c30){return _0x31ef0b['sendStatus'](_0x209674);}return _0x31ef0b[_0x6652('0x18')](_0x209674)[_0x6652('0x19')]();};}function respondWithResult(_0x3b04b3,_0x296531){_0x296531=_0x296531||0xc8;return function(_0x4b4f84){if(_0x4b4f84){return _0x3b04b3[_0x6652('0x18')](_0x296531)[_0x6652('0x1a')](_0x4b4f84);}};}function respondWithFilteredResult(_0x43547c,_0x435da9){return function(_0x5b010c){if(_0x5b010c){var _0x49859e=typeof _0x435da9[_0x6652('0x1b')]==='undefined'&&typeof _0x435da9[_0x6652('0x1c')]===_0x6652('0x1d');var _0x281f41=_0x5b010c['count'];var _0x31a6ca=_0x49859e?0x0:_0x435da9[_0x6652('0x1b')];var _0x453c65=_0x49859e?_0x5b010c[_0x6652('0x1e')]:_0x435da9[_0x6652('0x1b')]+_0x435da9[_0x6652('0x1c')];var _0x2b0740;if(_0x453c65>=_0x281f41){_0x453c65=_0x281f41;_0x2b0740=0xc8;}else{_0x2b0740=0xce;}_0x43547c['status'](_0x2b0740);return _0x43547c[_0x6652('0x1f')](_0x6652('0x20'),_0x31a6ca+'-'+_0x453c65+'/'+_0x281f41)[_0x6652('0x1a')](_0x5b010c);}return null;};}function patchUpdates(_0x20699b){return function(_0x911b6e){try{jsonpatch[_0x6652('0x21')](_0x911b6e,_0x20699b,!![]);}catch(_0x1c0f19){return BPromise['reject'](_0x1c0f19);}return _0x911b6e[_0x6652('0x22')]();};}function saveUpdates(_0x580fe5,_0x1f9d27){return function(_0x21441d){if(_0x21441d){return _0x21441d['update'](_0x580fe5)[_0x6652('0x23')](function(_0x4761c5){return _0x4761c5;});}return null;};}function removeEntity(_0x4e4102,_0x5cb432){return function(_0x294f99){if(_0x294f99){return _0x294f99[_0x6652('0x24')]()[_0x6652('0x23')](function(){var _0x4f0c24=_0x294f99[_0x6652('0x25')]({'plain':!![]});var _0x5eb5eb='IvrCampaigns';return db[_0x6652('0x26')][_0x6652('0x24')]({'where':{'type':_0x5eb5eb,'resourceId':_0x4f0c24['id']}})[_0x6652('0x23')](function(){return _0x294f99;});})[_0x6652('0x23')](function(){_0x4e4102[_0x6652('0x18')](0xcc)[_0x6652('0x19')]();});}};}function handleEntityNotFound(_0x50d035,_0x30209c){return function(_0xd8bd18){if(!_0xd8bd18){_0x50d035[_0x6652('0x27')](0x194);}return _0xd8bd18;};}function handleError(_0x5ceece,_0x3c3958){_0x3c3958=_0x3c3958||0x1f4;return function(_0x2fb2f0){logger[_0x6652('0x28')](_0x2fb2f0[_0x6652('0x29')]);if(_0x2fb2f0[_0x6652('0x2a')]){delete _0x2fb2f0[_0x6652('0x2a')];}_0x5ceece[_0x6652('0x18')](_0x3c3958)[_0x6652('0x2b')](_0x2fb2f0);};}exports['index']=function(_0x4ffb2b,_0x583d7a){var _0x444cb1={},_0x894c3={},_0x2d8e95={'count':0x0,'rows':[]};var _0x358b55=_[_0x6652('0x2c')](db[_0x6652('0x2d')]['rawAttributes'],function(_0x23deda){return{'name':_0x23deda[_0x6652('0x2e')],'type':_0x23deda[_0x6652('0x2f')][_0x6652('0x30')]};});_0x894c3[_0x6652('0x31')]=_[_0x6652('0x2c')](_0x358b55,_0x6652('0x2a'));_0x894c3[_0x6652('0x32')]=_[_0x6652('0x33')](_0x4ffb2b[_0x6652('0x32')]);_0x894c3[_0x6652('0x34')]=_['intersection'](_0x894c3[_0x6652('0x31')],_0x894c3['query']);_0x444cb1[_0x6652('0x35')]=_[_0x6652('0x36')](_0x894c3[_0x6652('0x31')],qs[_0x6652('0x37')](_0x4ffb2b[_0x6652('0x32')][_0x6652('0x37')]));_0x444cb1[_0x6652('0x35')]=_0x444cb1['attributes'][_0x6652('0x38')]?_0x444cb1['attributes']:_0x894c3['model'];if(!_0x4ffb2b[_0x6652('0x32')][_0x6652('0x39')](_0x6652('0x3a'))){_0x444cb1[_0x6652('0x1c')]=qs[_0x6652('0x1c')](_0x4ffb2b[_0x6652('0x32')][_0x6652('0x1c')]);_0x444cb1['offset']=qs[_0x6652('0x1b')](_0x4ffb2b[_0x6652('0x32')][_0x6652('0x1b')]);}_0x444cb1[_0x6652('0x3b')]=qs[_0x6652('0x3c')](_0x4ffb2b[_0x6652('0x32')]['sort']);_0x444cb1[_0x6652('0x3d')]=qs[_0x6652('0x34')](_[_0x6652('0x3e')](_0x4ffb2b[_0x6652('0x32')],_0x894c3[_0x6652('0x34')]),_0x358b55);if(_0x4ffb2b[_0x6652('0x32')][_0x6652('0x3f')]){_0x444cb1[_0x6652('0x3d')]=_['merge'](_0x444cb1[_0x6652('0x3d')],{'$or':_['map'](_0x358b55,function(_0x599a23){if(_0x599a23[_0x6652('0x2f')]!==_0x6652('0x40')){var _0x5c1c4d={};_0x5c1c4d[_0x599a23[_0x6652('0x2a')]]={'$like':'%'+_0x4ffb2b[_0x6652('0x32')][_0x6652('0x3f')]+'%'};return _0x5c1c4d;}})});}_0x444cb1=_['merge']({},_0x444cb1,_0x4ffb2b[_0x6652('0x41')]);var _0xdb942a={'where':_0x444cb1['where']};return db[_0x6652('0x2d')]['count'](_0xdb942a)[_0x6652('0x23')](function(_0x20bab0){_0x2d8e95[_0x6652('0x1e')]=_0x20bab0;if(_0x4ffb2b['query'][_0x6652('0x42')]){_0x444cb1[_0x6652('0x43')]=[{'all':!![]}];}return db[_0x6652('0x2d')][_0x6652('0x44')](_0x444cb1);})[_0x6652('0x23')](function(_0x1980e5){_0x2d8e95['rows']=_0x1980e5;return _0x2d8e95;})[_0x6652('0x23')](respondWithFilteredResult(_0x583d7a,_0x444cb1))[_0x6652('0x45')](handleError(_0x583d7a,null));};exports[_0x6652('0x46')]=function(_0xb7bcd3,_0x2ab18b){var _0xb3cdca={'raw':![],'where':{'id':_0xb7bcd3[_0x6652('0x47')]['id']}},_0x3c3388={};_0x3c3388[_0x6652('0x31')]=_[_0x6652('0x33')](db[_0x6652('0x2d')][_0x6652('0x48')]);_0x3c3388['query']=_[_0x6652('0x33')](_0xb7bcd3['query']);_0x3c3388[_0x6652('0x34')]=_[_0x6652('0x36')](_0x3c3388['model'],_0x3c3388[_0x6652('0x32')]);_0xb3cdca[_0x6652('0x35')]=_[_0x6652('0x36')](_0x3c3388[_0x6652('0x31')],qs[_0x6652('0x37')](_0xb7bcd3[_0x6652('0x32')][_0x6652('0x37')]));_0xb3cdca[_0x6652('0x35')]=_0xb3cdca[_0x6652('0x35')][_0x6652('0x38')]?_0xb3cdca[_0x6652('0x35')]:_0x3c3388['model'];if(_0xb7bcd3[_0x6652('0x32')][_0x6652('0x42')]){_0xb3cdca[_0x6652('0x43')]=[{'all':!![]}];}_0xb3cdca=_[_0x6652('0x49')]({},_0xb3cdca,_0xb7bcd3[_0x6652('0x41')]);return db[_0x6652('0x2d')][_0x6652('0x4a')](_0xb3cdca)[_0x6652('0x23')](handleEntityNotFound(_0x2ab18b,null))[_0x6652('0x23')](respondWithResult(_0x2ab18b,null))[_0x6652('0x45')](handleError(_0x2ab18b,null));};exports[_0x6652('0x4b')]=function(_0xda945a,_0x4f3b94){return db['Campaign'][_0x6652('0x4b')](_0xda945a[_0x6652('0x4c')],{})['then'](function(_0x6d105a){var _0x4dfb54=_0xda945a[_0x6652('0x4d')][_0x6652('0x25')]({'plain':!![]});if(!_0x4dfb54)throw new Error(_0x6652('0x4e'));if(_0x4dfb54[_0x6652('0x4f')]===_0x6652('0x4d')){var _0x340d03=_0x6d105a['get']({'plain':!![]});var _0x623f6b=_0x6652('0x50');return db[_0x6652('0x51')][_0x6652('0x4a')]({'where':{'name':_0x623f6b,'userProfileId':_0x4dfb54[_0x6652('0x52')]},'raw':!![]})[_0x6652('0x23')](function(_0x33d714){if(_0x33d714&&_0x33d714['autoAssociation']===0x0){return db[_0x6652('0x26')]['create']({'name':_0x340d03[_0x6652('0x2a')],'resourceId':_0x340d03['id'],'type':_0x33d714['name'],'sectionId':_0x33d714['id']},{})[_0x6652('0x23')](function(){return _0x6d105a;});}else{return _0x6d105a;}})[_0x6652('0x45')](function(_0x444163){logger[_0x6652('0x28')](_0x6652('0x53'),_0x444163);throw _0x444163;});}return _0x6d105a;})['then'](respondWithResult(_0x4f3b94,0xc9))['catch'](handleError(_0x4f3b94,null));};exports[_0x6652('0x54')]=function(_0x48cbae,_0x32c82f){var _0x5944e8={'where':{'id':_0x48cbae[_0x6652('0x47')]['id']}},_0x1390d2={};_0x1390d2[_0x6652('0x31')]=_['keys'](db[_0x6652('0x2d')][_0x6652('0x48')]);_0x5944e8[_0x6652('0x35')]=_['intersection'](_0x1390d2['model'],qs[_0x6652('0x37')](_0x48cbae[_0x6652('0x32')][_0x6652('0x37')]));_0x5944e8['attributes']=_0x5944e8[_0x6652('0x35')]['length']?_0x5944e8[_0x6652('0x35')]:_0x1390d2[_0x6652('0x31')];if(_0x48cbae[_0x6652('0x32')][_0x6652('0x42')]){_0x5944e8[_0x6652('0x43')]=[{'all':!![]}];}_0x5944e8=_['merge']({},_0x5944e8,_0x48cbae['options']);return db[_0x6652('0x2d')]['find'](_0x5944e8)[_0x6652('0x23')](handleEntityNotFound(_0x32c82f,null))['then'](function(_0x399919){if(_0x399919){var _0x2b65e9=_0x399919[_0x6652('0x25')]({'plain':!![]});_0x2b65e9=qs[_0x6652('0x55')](_0x2b65e9,['id','createdAt',_0x6652('0x56')]);_0x48cbae[_0x6652('0x4c')]=_[_0x6652('0x55')](_0x48cbae[_0x6652('0x4c')],['id',_0x6652('0x57'),_0x6652('0x56')]);return db[_0x6652('0x2d')][_0x6652('0x4b')](_[_0x6652('0x49')](_0x2b65e9,_0x48cbae[_0x6652('0x4c')]),{'include':_0x48cbae['query'][_0x6652('0x42')]?[{'all':!![]}]:undefined})[_0x6652('0x23')](function(_0x116c95){var _0x46e273=_0x48cbae[_0x6652('0x4d')][_0x6652('0x25')]({'plain':!![]});if(!_0x46e273)throw new Error(_0x6652('0x4e'));if(_0x46e273[_0x6652('0x4f')]===_0x6652('0x4d')){var _0x3ba822=_0x116c95[_0x6652('0x25')]({'plain':!![]});var _0x3b7156=_0x6652('0x50');return db[_0x6652('0x51')]['find']({'where':{'name':_0x3b7156,'userProfileId':_0x46e273[_0x6652('0x52')]},'raw':!![]})[_0x6652('0x23')](function(_0xfe2e2){if(_0xfe2e2&&_0xfe2e2[_0x6652('0x58')]===0x0){return db[_0x6652('0x26')][_0x6652('0x4b')]({'name':_0x3ba822['name'],'resourceId':_0x3ba822['id'],'type':_0xfe2e2[_0x6652('0x2a')],'sectionId':_0xfe2e2['id']},{})['then'](function(){return _0x116c95;});}else{return _0x116c95;}})[_0x6652('0x45')](function(_0x52caab){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52caab);throw _0x52caab;});}return _0x116c95;});}})[_0x6652('0x23')](respondWithResult(_0x32c82f,0xc9))[_0x6652('0x45')](handleError(_0x32c82f,null));};exports['update']=function(_0x70b025,_0x4e4480){if(_0x70b025['body']['id']){delete _0x70b025[_0x6652('0x4c')]['id'];}return db[_0x6652('0x2d')]['find']({'where':{'id':_0x70b025['params']['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x4e4480,null))[_0x6652('0x23')](saveUpdates(_0x70b025[_0x6652('0x4c')],null))[_0x6652('0x23')](respondWithResult(_0x4e4480,null))['catch'](handleError(_0x4e4480,null));};exports[_0x6652('0x24')]=function(_0x441e6c,_0x3f48c8){return db[_0x6652('0x2d')][_0x6652('0x4a')]({'where':{'id':_0x441e6c[_0x6652('0x47')]['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x3f48c8,null))[_0x6652('0x23')](removeEntity(_0x3f48c8,null))[_0x6652('0x45')](handleError(_0x3f48c8,null));};exports[_0x6652('0x59')]=function(_0x506c89,_0x417c89,_0x22e190){var _0x27bdc3={'raw':!![],'where':{}};var _0x2be797={};var _0x486194={'count':0x0,'rows':[]};return db[_0x6652('0x2d')][_0x6652('0x5a')]({'where':{'id':_0x506c89[_0x6652('0x47')]['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x417c89,null))[_0x6652('0x23')](function(_0x3b3cac){if(_0x3b3cac){_0x2be797['model']=_['keys'](db[_0x6652('0x5b')][_0x6652('0x48')]);_0x2be797[_0x6652('0x32')]=_[_0x6652('0x33')](_0x506c89[_0x6652('0x32')]);_0x2be797[_0x6652('0x34')]=_['intersection'](_0x2be797[_0x6652('0x31')],_0x2be797[_0x6652('0x32')]);_0x27bdc3[_0x6652('0x35')]=_['intersection'](_0x2be797['model'],qs['fields'](_0x506c89[_0x6652('0x32')][_0x6652('0x37')]));_0x27bdc3[_0x6652('0x35')]=_0x27bdc3[_0x6652('0x35')]['length']?_0x27bdc3[_0x6652('0x35')]:_0x2be797[_0x6652('0x31')];if(!_0x506c89['query'][_0x6652('0x39')](_0x6652('0x3a'))){_0x27bdc3[_0x6652('0x1c')]=qs[_0x6652('0x1c')](_0x506c89['query'][_0x6652('0x1c')]);_0x27bdc3[_0x6652('0x1b')]=qs[_0x6652('0x1b')](_0x506c89[_0x6652('0x32')]['offset']);}_0x27bdc3[_0x6652('0x3b')]=qs[_0x6652('0x3c')](_0x506c89[_0x6652('0x32')][_0x6652('0x3c')]);_0x27bdc3[_0x6652('0x3d')]=qs['filters'](_[_0x6652('0x3e')](_0x506c89[_0x6652('0x32')],_0x2be797['filters']));_0x27bdc3['where'][_0x6652('0x5c')]=_0x3b3cac['id'];if(_0x506c89[_0x6652('0x32')][_0x6652('0x3f')]){_0x27bdc3[_0x6652('0x3d')]=_[_0x6652('0x49')](_0x27bdc3[_0x6652('0x3d')],{'$or':_[_0x6652('0x2c')](_0x27bdc3[_0x6652('0x35')],function(_0x5fd026){var _0x5f0560={};_0x5f0560[_0x5fd026]={'$like':'%'+_0x506c89['query'][_0x6652('0x3f')]+'%'};return _0x5f0560;})});}_0x27bdc3=_['merge']({},_0x27bdc3,_0x506c89['options']);return db[_0x6652('0x5b')][_0x6652('0x1e')]({'where':_0x27bdc3['where']})[_0x6652('0x23')](function(_0x1b3751){_0x486194[_0x6652('0x1e')]=_0x1b3751;if(_0x506c89[_0x6652('0x32')]['includeAll']){_0x27bdc3[_0x6652('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0x6652('0x44')](_0x27bdc3);})[_0x6652('0x23')](function(_0x44b760){_0x486194['rows']=_0x44b760;return _0x486194;});}})[_0x6652('0x23')](respondWithFilteredResult(_0x417c89,_0x27bdc3))['catch'](handleError(_0x417c89,null));};exports['getHopperHistories']=function(_0x541909,_0x512bf7,_0x1802d6){var _0x9ace91={'raw':!![],'where':{}};var _0x542667={};var _0x4253e9={'count':0x0,'rows':[]};return db[_0x6652('0x2d')][_0x6652('0x5a')]({'where':{'id':_0x541909[_0x6652('0x47')]['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x512bf7,null))[_0x6652('0x23')](function(_0x401124){if(_0x401124){_0x542667['model']=_[_0x6652('0x33')](db['CmHopperHistory'][_0x6652('0x48')]);_0x542667[_0x6652('0x32')]=_[_0x6652('0x33')](_0x541909[_0x6652('0x32')]);_0x542667['filters']=_[_0x6652('0x36')](_0x542667[_0x6652('0x31')],_0x542667[_0x6652('0x32')]);_0x9ace91['attributes']=_[_0x6652('0x36')](_0x542667['model'],qs['fields'](_0x541909['query']['fields']));_0x9ace91[_0x6652('0x35')]=_0x9ace91[_0x6652('0x35')][_0x6652('0x38')]?_0x9ace91['attributes']:_0x542667[_0x6652('0x31')];if(!_0x541909[_0x6652('0x32')][_0x6652('0x39')](_0x6652('0x3a'))){_0x9ace91[_0x6652('0x1c')]=qs[_0x6652('0x1c')](_0x541909[_0x6652('0x32')][_0x6652('0x1c')]);_0x9ace91[_0x6652('0x1b')]=qs[_0x6652('0x1b')](_0x541909[_0x6652('0x32')][_0x6652('0x1b')]);}_0x9ace91[_0x6652('0x3b')]=qs[_0x6652('0x3c')](_0x541909[_0x6652('0x32')][_0x6652('0x3c')]);_0x9ace91[_0x6652('0x3d')]=qs[_0x6652('0x34')](_[_0x6652('0x3e')](_0x541909[_0x6652('0x32')],_0x542667[_0x6652('0x34')]));_0x9ace91[_0x6652('0x3d')][_0x6652('0x5c')]=_0x401124['id'];if(_0x541909[_0x6652('0x32')][_0x6652('0x3f')]){_0x9ace91[_0x6652('0x3d')]=_[_0x6652('0x49')](_0x9ace91[_0x6652('0x3d')],{'$or':_[_0x6652('0x2c')](_0x9ace91['attributes'],function(_0x45d20b){var _0x17e180={};_0x17e180[_0x45d20b]={'$like':'%'+_0x541909[_0x6652('0x32')][_0x6652('0x3f')]+'%'};return _0x17e180;})});}_0x9ace91=_[_0x6652('0x49')]({},_0x9ace91,_0x541909[_0x6652('0x41')]);return db['CmHopperHistory'][_0x6652('0x1e')]({'where':_0x9ace91[_0x6652('0x3d')]})[_0x6652('0x23')](function(_0x27363c){_0x4253e9[_0x6652('0x1e')]=_0x27363c;if(_0x541909[_0x6652('0x32')][_0x6652('0x42')]){_0x9ace91[_0x6652('0x43')]=[{'all':!![]}];}return db[_0x6652('0x5d')]['findAll'](_0x9ace91);})['then'](function(_0xe168f4){_0x4253e9[_0x6652('0x5e')]=_0xe168f4;return _0x4253e9;});}})[_0x6652('0x23')](respondWithFilteredResult(_0x512bf7,_0x9ace91))[_0x6652('0x45')](handleError(_0x512bf7,null));};exports[_0x6652('0x5f')]=function(_0x30d2e2,_0x254837,_0x377fb2){var _0x7c638f={'raw':!![],'where':{}};var _0x301133={};var _0x22f870={'count':0x0,'rows':[]};return db[_0x6652('0x2d')]['findOne']({'where':{'id':_0x30d2e2[_0x6652('0x47')]['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x254837,null))[_0x6652('0x23')](function(_0x322adc){if(_0x322adc){_0x301133[_0x6652('0x31')]=_['keys'](db[_0x6652('0x60')][_0x6652('0x48')]);_0x301133[_0x6652('0x32')]=_[_0x6652('0x33')](_0x30d2e2[_0x6652('0x32')]);_0x301133[_0x6652('0x34')]=_[_0x6652('0x36')](_0x301133[_0x6652('0x31')],_0x301133[_0x6652('0x32')]);_0x7c638f[_0x6652('0x35')]=_['intersection'](_0x301133[_0x6652('0x31')],qs['fields'](_0x30d2e2[_0x6652('0x32')][_0x6652('0x37')]));_0x7c638f[_0x6652('0x35')]=_0x7c638f['attributes'][_0x6652('0x38')]?_0x7c638f['attributes']:_0x301133[_0x6652('0x31')];if(!_0x30d2e2[_0x6652('0x32')][_0x6652('0x39')]('nolimit')){_0x7c638f[_0x6652('0x1c')]=qs['limit'](_0x30d2e2[_0x6652('0x32')][_0x6652('0x1c')]);_0x7c638f[_0x6652('0x1b')]=qs[_0x6652('0x1b')](_0x30d2e2['query']['offset']);}_0x7c638f[_0x6652('0x3b')]=qs[_0x6652('0x3c')](_0x30d2e2[_0x6652('0x32')][_0x6652('0x3c')]);_0x7c638f[_0x6652('0x3d')]=qs[_0x6652('0x34')](_['pick'](_0x30d2e2[_0x6652('0x32')],_0x301133[_0x6652('0x34')]));_0x7c638f['where']['CampaignId']=_0x322adc['id'];if(_0x30d2e2['query'][_0x6652('0x3f')]){_0x7c638f['where']=_[_0x6652('0x49')](_0x7c638f[_0x6652('0x3d')],{'$or':_[_0x6652('0x2c')](_0x7c638f[_0x6652('0x35')],function(_0x1dd439){var _0x15781e={};_0x15781e[_0x1dd439]={'$like':'%'+_0x30d2e2['query'][_0x6652('0x3f')]+'%'};return _0x15781e;})});}_0x7c638f=_[_0x6652('0x49')]({},_0x7c638f,_0x30d2e2['options']);return db[_0x6652('0x60')][_0x6652('0x1e')]({'where':_0x7c638f['where']})[_0x6652('0x23')](function(_0x18b396){_0x22f870['count']=_0x18b396;if(_0x30d2e2[_0x6652('0x32')][_0x6652('0x42')]){_0x7c638f[_0x6652('0x43')]=[{'all':!![]}];}return db[_0x6652('0x60')][_0x6652('0x44')](_0x7c638f);})['then'](function(_0x16994d){_0x22f870[_0x6652('0x5e')]=_0x16994d;return _0x22f870;});}})[_0x6652('0x23')](respondWithFilteredResult(_0x254837,_0x7c638f))[_0x6652('0x45')](handleError(_0x254837,null));};exports['getHopperBlacks']=function(_0x3d48e5,_0x30c32f,_0x1da683){var _0x3b8225={'raw':!![],'where':{}};var _0x16f648={};var _0x13bc9d={'count':0x0,'rows':[]};return db[_0x6652('0x2d')][_0x6652('0x5a')]({'where':{'id':_0x3d48e5[_0x6652('0x47')]['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x30c32f,null))['then'](function(_0x52caf5){if(_0x52caf5){_0x16f648[_0x6652('0x31')]=_[_0x6652('0x33')](db[_0x6652('0x61')][_0x6652('0x48')]);_0x16f648[_0x6652('0x32')]=_[_0x6652('0x33')](_0x3d48e5[_0x6652('0x32')]);_0x16f648['filters']=_[_0x6652('0x36')](_0x16f648['model'],_0x16f648[_0x6652('0x32')]);_0x3b8225['attributes']=_['intersection'](_0x16f648[_0x6652('0x31')],qs[_0x6652('0x37')](_0x3d48e5[_0x6652('0x32')][_0x6652('0x37')]));_0x3b8225[_0x6652('0x35')]=_0x3b8225[_0x6652('0x35')][_0x6652('0x38')]?_0x3b8225[_0x6652('0x35')]:_0x16f648[_0x6652('0x31')];if(!_0x3d48e5[_0x6652('0x32')][_0x6652('0x39')](_0x6652('0x3a'))){_0x3b8225[_0x6652('0x1c')]=qs[_0x6652('0x1c')](_0x3d48e5['query']['limit']);_0x3b8225[_0x6652('0x1b')]=qs[_0x6652('0x1b')](_0x3d48e5[_0x6652('0x32')][_0x6652('0x1b')]);}_0x3b8225[_0x6652('0x3b')]=qs[_0x6652('0x3c')](_0x3d48e5[_0x6652('0x32')][_0x6652('0x3c')]);_0x3b8225['where']=qs['filters'](_[_0x6652('0x3e')](_0x3d48e5[_0x6652('0x32')],_0x16f648[_0x6652('0x34')]));_0x3b8225[_0x6652('0x3d')][_0x6652('0x5c')]=_0x52caf5['id'];if(_0x3d48e5[_0x6652('0x32')][_0x6652('0x3f')]){_0x3b8225[_0x6652('0x3d')]=_['merge'](_0x3b8225['where'],{'$or':_[_0x6652('0x2c')](_0x3b8225['attributes'],function(_0x3e2371){var _0x61272b={};_0x61272b[_0x3e2371]={'$like':'%'+_0x3d48e5[_0x6652('0x32')][_0x6652('0x3f')]+'%'};return _0x61272b;})});}_0x3b8225=_[_0x6652('0x49')]({},_0x3b8225,_0x3d48e5[_0x6652('0x41')]);return db[_0x6652('0x61')]['count']({'where':_0x3b8225['where']})['then'](function(_0x430386){_0x13bc9d[_0x6652('0x1e')]=_0x430386;if(_0x3d48e5[_0x6652('0x32')][_0x6652('0x42')]){_0x3b8225[_0x6652('0x43')]=[{'all':!![]}];}return db[_0x6652('0x61')][_0x6652('0x44')](_0x3b8225);})[_0x6652('0x23')](function(_0x5aaace){_0x13bc9d[_0x6652('0x5e')]=_0x5aaace;return _0x13bc9d;});}})[_0x6652('0x23')](respondWithFilteredResult(_0x30c32f,_0x3b8225))[_0x6652('0x45')](handleError(_0x30c32f,null));};exports[_0x6652('0x62')]=function(_0x3f9dc0,_0x4bc4da,_0x314a8b){var _0x4de1fd={};var _0xd82e5d={};var _0x7ed149;var _0x450ffc;return db[_0x6652('0x2d')][_0x6652('0x5a')]({'where':{'id':_0x3f9dc0['params']['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x4bc4da,null))[_0x6652('0x23')](function(_0x5530eb){if(_0x5530eb){_0x7ed149=_0x5530eb;_0xd82e5d[_0x6652('0x31')]=_[_0x6652('0x33')](db[_0x6652('0x63')]['rawAttributes']);_0xd82e5d[_0x6652('0x32')]=_[_0x6652('0x33')](_0x3f9dc0['query']);_0xd82e5d[_0x6652('0x34')]=_[_0x6652('0x36')](_0xd82e5d[_0x6652('0x31')],_0xd82e5d[_0x6652('0x32')]);_0x4de1fd[_0x6652('0x35')]=_[_0x6652('0x36')](_0xd82e5d[_0x6652('0x31')],qs[_0x6652('0x37')](_0x3f9dc0[_0x6652('0x32')][_0x6652('0x37')]));_0x4de1fd[_0x6652('0x35')]=_0x4de1fd[_0x6652('0x35')]['length']?_0x4de1fd[_0x6652('0x35')]:_0xd82e5d[_0x6652('0x31')];_0x4de1fd[_0x6652('0x3b')]=qs[_0x6652('0x3c')](_0x3f9dc0['query']['sort']);_0x4de1fd[_0x6652('0x3d')]=qs[_0x6652('0x34')](_[_0x6652('0x3e')](_0x3f9dc0[_0x6652('0x32')],_0xd82e5d[_0x6652('0x34')]));if(_0x3f9dc0['query']['filter']){_0x4de1fd[_0x6652('0x3d')]=_['merge'](_0x4de1fd['where'],{'$or':_[_0x6652('0x2c')](_0x4de1fd['attributes'],function(_0x12e996){var _0x494e88={};_0x494e88[_0x12e996]={'$like':'%'+_0x3f9dc0[_0x6652('0x32')][_0x6652('0x3f')]+'%'};return _0x494e88;})});}_0x4de1fd=_['merge']({},_0x4de1fd,_0x3f9dc0[_0x6652('0x41')]);return _0x7ed149[_0x6652('0x62')](_0x4de1fd);}})['then'](function(_0x1c95cb){if(_0x1c95cb){_0x450ffc=_0x1c95cb[_0x6652('0x38')];if(!_0x3f9dc0[_0x6652('0x32')][_0x6652('0x39')](_0x6652('0x3a'))){_0x4de1fd[_0x6652('0x1c')]=qs['limit'](_0x3f9dc0[_0x6652('0x32')]['limit']);_0x4de1fd[_0x6652('0x1b')]=qs[_0x6652('0x1b')](_0x3f9dc0[_0x6652('0x32')]['offset']);}return _0x7ed149[_0x6652('0x62')](_0x4de1fd);}})['then'](function(_0x498302){if(_0x498302){return _0x498302?{'count':_0x450ffc,'rows':_0x498302}:null;}})[_0x6652('0x23')](respondWithResult(_0x4bc4da,null))['catch'](handleError(_0x4bc4da,null));};exports[_0x6652('0x64')]=function(_0x4476f9,_0x428576,_0x22e1b2){var _0x5ddb77,_0x52a842;return db[_0x6652('0x2d')][_0x6652('0x4a')]({'where':{'id':_0x4476f9['params']['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x428576,null))[_0x6652('0x23')](function(_0x1496e8){if(_0x1496e8){_0x52a842=_0x1496e8;return _0x1496e8[_0x6652('0x64')](_0x4476f9[_0x6652('0x4c')][_0x6652('0x65')],_[_0x6652('0x55')](_0x4476f9['body'],[_0x6652('0x65'),'id'])||{});}return null;})[_0x6652('0x66')](function(_0x2e74e3){var _0x330f16;_0x5ddb77=_0x2e74e3||[];var _0x51ab11=[];if(_0x2e74e3){for(var _0x4aaca3=0x0;_0x4aaca3<_0x2e74e3[_0x6652('0x38')];_0x4aaca3+=0x1){var _0x3b47d6=_0x2e74e3[_0x4aaca3]['get']({'plain':!![]});_0x52a842[_0x6652('0x67')]=_0x4476f9['body'][_0x6652('0x67')]?_0x4476f9[_0x6652('0x4c')]['dialCheckDuplicateType']:_0x52a842[_0x6652('0x67')];switch(_0x52a842[_0x6652('0x67')]){case _0x6652('0x68'):_0x330f16=squel['insert']()[_0x6652('0x69')](_0x6652('0x6a'))[_0x6652('0x6b')]([_0x6652('0x6c'),_0x6652('0x6d'),_0x6652('0x6e'),_0x6652('0x6f'),'CampaignId',_0x6652('0x57'),_0x6652('0x56')],squel['select']()[_0x6652('0x70')]('phone','phone')[_0x6652('0x70')](_0x6652('0x71'),_0x6652('0x6d'))[_0x6652('0x70')]('id',_0x6652('0x6e'))[_0x6652('0x70')](_0x3b47d6[_0x6652('0x72')][_0x6652('0x73')](),_0x6652('0x6f'))[_0x6652('0x70')](_0x4476f9[_0x6652('0x47')]['id'][_0x6652('0x73')](),_0x6652('0x5c'))['field'](_0x6652('0x71'),'createdAt')[_0x6652('0x70')](_0x6652('0x71'),'updatedAt')['from']('cm_contacts')[_0x6652('0x3d')](_0x6652('0x74'))[_0x6652('0x3d')](_0x6652('0x75'),_0x3b47d6[_0x6652('0x72')][_0x6652('0x73')]())['where'](_0x6652('0x76'))[_0x6652('0x3d')](_0x6652('0x77'),squel['select']()[_0x6652('0x70')](_0x6652('0x78'))[_0x6652('0x79')](_0x6652('0x7a'))[_0x6652('0x3d')](_0x6652('0x7b'),_0x4476f9['params']['id'][_0x6652('0x73')]()))[_0x6652('0x3d')](_0x6652('0x77'),squel['select']()[_0x6652('0x70')](_0x6652('0x7c'))[_0x6652('0x79')](_0x6652('0x6a'))['where']('CampaignId\x20=\x20?',_0x4476f9['params']['id']['toString']())))[_0x6652('0x73')]();break;case'onlyIfOpen':_0x330f16=squel[_0x6652('0x7d')]()[_0x6652('0x69')](_0x6652('0x6a'))[_0x6652('0x6b')]([_0x6652('0x6c'),_0x6652('0x6d'),_0x6652('0x6e'),_0x6652('0x6f'),_0x6652('0x5c'),_0x6652('0x57'),_0x6652('0x56')],squel['select']()[_0x6652('0x70')](_0x6652('0x6c'),_0x6652('0x6c'))[_0x6652('0x70')]('NOW()',_0x6652('0x6d'))[_0x6652('0x70')]('id',_0x6652('0x6e'))[_0x6652('0x70')](_0x3b47d6[_0x6652('0x72')][_0x6652('0x73')](),'ListId')[_0x6652('0x70')](_0x4476f9[_0x6652('0x47')]['id']['toString'](),_0x6652('0x5c'))['field'](_0x6652('0x71'),_0x6652('0x57'))[_0x6652('0x70')](_0x6652('0x71'),_0x6652('0x56'))['from'](_0x6652('0x7e'))[_0x6652('0x3d')](_0x6652('0x74'))[_0x6652('0x3d')]('ListId\x20=\x20?',_0x3b47d6[_0x6652('0x72')][_0x6652('0x73')]())[_0x6652('0x3d')](_0x6652('0x76'))[_0x6652('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6652('0x7f')]()[_0x6652('0x70')](_0x6652('0x7c'))[_0x6652('0x79')]('cm_hopper')[_0x6652('0x3d')](_0x6652('0x7b'),_0x4476f9[_0x6652('0x47')]['id'][_0x6652('0x73')]())))[_0x6652('0x73')]();break;default:_0x330f16=squel['insert']()[_0x6652('0x69')]('cm_hopper')['fromQuery'](['phone',_0x6652('0x6d'),_0x6652('0x6e'),_0x6652('0x6f'),_0x6652('0x5c'),_0x6652('0x57'),_0x6652('0x56')],squel[_0x6652('0x7f')]()[_0x6652('0x70')](_0x6652('0x6c'),'phone')['field'](_0x6652('0x71'),_0x6652('0x6d'))['field']('id',_0x6652('0x6e'))['field'](_0x3b47d6[_0x6652('0x72')][_0x6652('0x73')](),'ListId')[_0x6652('0x70')](_0x4476f9[_0x6652('0x47')]['id'][_0x6652('0x73')](),_0x6652('0x5c'))[_0x6652('0x70')]('NOW()','createdAt')[_0x6652('0x70')]('NOW()',_0x6652('0x56'))[_0x6652('0x79')]('cm_contacts')[_0x6652('0x3d')](_0x6652('0x74'))[_0x6652('0x3d')](_0x6652('0x75'),_0x3b47d6['CmListId'][_0x6652('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x51ab11[_0x6652('0x80')](db['sequelize'][_0x6652('0x32')](_0x330f16));}return BPromise[_0x6652('0x81')](_0x51ab11);}})[_0x6652('0x23')](function(){return _0x5ddb77;})[_0x6652('0x23')](respondWithResult(_0x428576,null))[_0x6652('0x45')](handleError(_0x428576,null));};exports[_0x6652('0x82')]=function(_0xb1d39e,_0x49368c,_0x4d8267){return db[_0x6652('0x2d')][_0x6652('0x4a')]({'where':{'id':_0xb1d39e['params']['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x49368c,null))['then'](function(_0xaff0c){if(_0xaff0c){return _0xaff0c[_0x6652('0x82')](_0xb1d39e[_0x6652('0x32')][_0x6652('0x65')]);}})['then'](function(_0x49990d){if(_0x49990d){return db['CmHopper'][_0x6652('0x24')]({'where':{'ListId':_0xb1d39e[_0x6652('0x32')][_0x6652('0x65')],'CampaignId':_0xb1d39e[_0x6652('0x47')]['id']}})[_0x6652('0x23')](function(){return _0x49990d;});}})[_0x6652('0x23')](respondWithStatusCode(_0x49368c,null))[_0x6652('0x45')](handleError(_0x49368c,null));};exports[_0x6652('0x83')]=function(_0x3f0a9c,_0x52fdb5,_0x3f9128){var _0xd4db6e={};var _0x39cbc5={};var _0x51832d;var _0xe17d31;return db[_0x6652('0x2d')][_0x6652('0x5a')]({'where':{'id':_0x3f0a9c[_0x6652('0x47')]['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x52fdb5,null))[_0x6652('0x23')](function(_0x24707a){if(_0x24707a){_0x51832d=_0x24707a;_0x39cbc5[_0x6652('0x31')]=_['keys'](db[_0x6652('0x63')][_0x6652('0x48')]);_0x39cbc5[_0x6652('0x32')]=_[_0x6652('0x33')](_0x3f0a9c[_0x6652('0x32')]);_0x39cbc5[_0x6652('0x34')]=_[_0x6652('0x36')](_0x39cbc5['model'],_0x39cbc5[_0x6652('0x32')]);_0xd4db6e[_0x6652('0x35')]=_[_0x6652('0x36')](_0x39cbc5[_0x6652('0x31')],qs[_0x6652('0x37')](_0x3f0a9c[_0x6652('0x32')][_0x6652('0x37')]));_0xd4db6e['attributes']=_0xd4db6e[_0x6652('0x35')][_0x6652('0x38')]?_0xd4db6e[_0x6652('0x35')]:_0x39cbc5['model'];_0xd4db6e[_0x6652('0x3b')]=qs['sort'](_0x3f0a9c['query'][_0x6652('0x3c')]);_0xd4db6e[_0x6652('0x3d')]=qs[_0x6652('0x34')](_[_0x6652('0x3e')](_0x3f0a9c[_0x6652('0x32')],_0x39cbc5[_0x6652('0x34')]));if(_0x3f0a9c[_0x6652('0x32')]['filter']){_0xd4db6e[_0x6652('0x3d')]=_[_0x6652('0x49')](_0xd4db6e[_0x6652('0x3d')],{'$or':_[_0x6652('0x2c')](_0xd4db6e[_0x6652('0x35')],function(_0x566793){var _0x1012af={};_0x1012af[_0x566793]={'$like':'%'+_0x3f0a9c[_0x6652('0x32')][_0x6652('0x3f')]+'%'};return _0x1012af;})});}_0xd4db6e=_[_0x6652('0x49')]({},_0xd4db6e,_0x3f0a9c[_0x6652('0x41')]);return _0x51832d[_0x6652('0x83')](_0xd4db6e);}})[_0x6652('0x23')](function(_0x5d844e){if(_0x5d844e){_0xe17d31=_0x5d844e[_0x6652('0x38')];if(!_0x3f0a9c[_0x6652('0x32')][_0x6652('0x39')]('nolimit')){_0xd4db6e[_0x6652('0x1c')]=qs['limit'](_0x3f0a9c['query'][_0x6652('0x1c')]);_0xd4db6e[_0x6652('0x1b')]=qs[_0x6652('0x1b')](_0x3f0a9c[_0x6652('0x32')][_0x6652('0x1b')]);}return _0x51832d[_0x6652('0x83')](_0xd4db6e);}})['then'](function(_0x57d355){if(_0x57d355){return _0x57d355?{'count':_0xe17d31,'rows':_0x57d355}:null;}})[_0x6652('0x23')](respondWithResult(_0x52fdb5,null))['catch'](handleError(_0x52fdb5,null));};exports[_0x6652('0x84')]=function(_0x202586,_0x167ba3,_0x37215b){var _0x238a21,_0xbfbfdd;return db[_0x6652('0x2d')][_0x6652('0x4a')]({'where':{'id':_0x202586['params']['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x167ba3,null))[_0x6652('0x23')](function(_0x4767b7){if(_0x4767b7){_0xbfbfdd=_0x4767b7;return _0x4767b7['addBlackLists'](_0x202586['body'][_0x6652('0x65')],_[_0x6652('0x55')](_0x202586[_0x6652('0x4c')],[_0x6652('0x65'),'id'])||{});}return null;})['spread'](function(_0x37f18e){var _0x48ac53;_0x238a21=_0x37f18e||[];var _0x40dc76=[];if(_0x37f18e){for(var _0x418402=0x0;_0x418402<_0x37f18e[_0x6652('0x38')];_0x418402+=0x1){var _0x4dec79=_0x37f18e[_0x418402][_0x6652('0x25')]({'plain':!![]});_0x48ac53=squel['insert']()['into'](_0x6652('0x85'))[_0x6652('0x6b')]([_0x6652('0x6c'),_0x6652('0x6e'),_0x6652('0x6f'),_0x6652('0x5c'),_0x6652('0x57'),_0x6652('0x56')],squel[_0x6652('0x7f')]()[_0x6652('0x70')](_0x6652('0x6c'),'phone')[_0x6652('0x70')]('id',_0x6652('0x6e'))['field'](_0x4dec79[_0x6652('0x72')][_0x6652('0x73')](),_0x6652('0x6f'))[_0x6652('0x70')](_0x202586[_0x6652('0x47')]['id']['toString'](),_0x6652('0x5c'))[_0x6652('0x70')](_0x6652('0x71'),_0x6652('0x57'))['field'](_0x6652('0x71'),_0x6652('0x56'))[_0x6652('0x79')](_0x6652('0x7e'))['where']('deletedAt\x20IS\x20NULL')[_0x6652('0x3d')]('ListId\x20=\x20?',_0x4dec79[_0x6652('0x72')]['toString']())[_0x6652('0x3d')](_0x6652('0x76')))[_0x6652('0x73')]();_0x40dc76['push'](db['sequelize'][_0x6652('0x32')](_0x48ac53));}return BPromise['all'](_0x40dc76);}})[_0x6652('0x23')](function(){return _0x238a21;})[_0x6652('0x23')](respondWithResult(_0x167ba3,null))[_0x6652('0x45')](handleError(_0x167ba3,null));};exports[_0x6652('0x86')]=function(_0x255ad3,_0x1e07b5,_0xace7f6){return db[_0x6652('0x2d')][_0x6652('0x4a')]({'where':{'id':_0x255ad3[_0x6652('0x47')]['id']}})[_0x6652('0x23')](handleEntityNotFound(_0x1e07b5,null))['then'](function(_0x27f859){if(_0x27f859){return _0x27f859[_0x6652('0x86')](_0x255ad3[_0x6652('0x32')]['ids']);}})['then'](function(_0x28b2ae){if(_0x28b2ae){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x255ad3['query'][_0x6652('0x65')],'CampaignId':_0x255ad3[_0x6652('0x47')]['id']}})[_0x6652('0x23')](function(){return _0x28b2ae;});}})['then'](respondWithStatusCode(_0x1e07b5,null))[_0x6652('0x45')](handleError(_0x1e07b5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index fdd7dca..a1da653 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(_0x131679,_0x298f2b){var _0x3c8158=function(_0x53da41){while(--_0x53da41){_0x131679['push'](_0x131679['shift']());}};_0x3c8158(++_0x298f2b);}(_0x7a54,0x106));var _0x47a5=function(_0x5b0b58,_0xbd1e6d){_0x5b0b58=_0x5b0b58-0x0;var _0x4f6ed3=_0x7a54[_0x5b0b58];return _0x4f6ed3;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3d391b,_0x139db6){var _0x34adb6=function(_0x464b1e){while(--_0x464b1e){_0x3d391b['push'](_0x3d391b['shift']());}};_0x34adb6(++_0x139db6);}(_0x7a54,0x106));var _0x47a5=function(_0x3bdbe6,_0x484bbf){_0x3bdbe6=_0x3bdbe6-0x0;var _0xe7b61d=_0x7a54[_0x3bdbe6];return _0xe7b61d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ac96e34..a07fae8 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 _0xa588=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','limit','include','map','model','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0xa588,0xe1));var _0x8a58=function(_0x5e8422,_0xb949e2){_0x5e8422=_0x5e8422-0x0;var _0x4144b8=_0xa588[_0x5e8422];return _0x4144b8;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var moment=require(_0x8a58('0x1'));var BPromise=require(_0x8a58('0x2'));var rs=require(_0x8a58('0x3'));var fs=require('fs');var Redis=require(_0x8a58('0x4'));var db=require(_0x8a58('0x5'))['db'];var utils=require(_0x8a58('0x6'));var logger=require(_0x8a58('0x7'))(_0x8a58('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a58('0x9'));var client=jayson[_0x8a58('0xa')][_0x8a58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35d5ad,_0xe0af18,_0x140f99){return new BPromise(function(_0x77b421,_0x585376){return client['request'](_0x35d5ad,_0x140f99)[_0x8a58('0xc')](function(_0x39a20e){logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));logger['debug'](_0x8a58('0x10'),_0xe0af18,_0x8a58('0xf'),JSON[_0x8a58('0x11')](_0x39a20e));if(_0x39a20e[_0x8a58('0x12')]){if(_0x39a20e['error']['code']===0x1f4){logger[_0x8a58('0x12')]('Campaign,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x585376(_0x39a20e['error'][_0x8a58('0x13')]);}logger[_0x8a58('0x12')]('Campaign,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x77b421(_0x39a20e['error'][_0x8a58('0x13')]);}else{logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));_0x77b421(_0x39a20e[_0x8a58('0x14')][_0x8a58('0x13')]);}})[_0x8a58('0x15')](function(_0x49ee0e){logger['error'](_0x8a58('0xe'),_0xe0af18,_0x49ee0e);_0x585376(_0x49ee0e);});});}exports[_0x8a58('0x16')]=function(_0x18a14d){var _0x4b5012=this;return new Promise(function(_0x282f2d,_0xe73eb9){return db['Campaign'][_0x8a58('0x17')]({'raw':_0x18a14d[_0x8a58('0x18')]?_0x18a14d[_0x8a58('0x18')][_0x8a58('0x19')]===undefined?!![]:![]:!![],'where':_0x18a14d[_0x8a58('0x18')]?_0x18a14d[_0x8a58('0x18')][_0x8a58('0x1a')]||null:null,'attributes':_0x18a14d[_0x8a58('0x18')]?_0x18a14d[_0x8a58('0x18')][_0x8a58('0x1b')]||null:null,'limit':_0x18a14d[_0x8a58('0x18')]?_0x18a14d[_0x8a58('0x18')][_0x8a58('0x1c')]||null:null,'include':_0x18a14d[_0x8a58('0x18')]?_0x18a14d['options'][_0x8a58('0x1d')]?_[_0x8a58('0x1e')](_0x18a14d[_0x8a58('0x18')][_0x8a58('0x1d')],function(_0x22c898){return{'model':db[_0x22c898[_0x8a58('0x1f')]],'as':_0x22c898['as'],'attributes':_0x22c898[_0x8a58('0x1b')],'include':_0x22c898['include']?_[_0x8a58('0x1e')](_0x22c898[_0x8a58('0x1d')],function(_0x30c96b){return{'model':db[_0x30c96b[_0x8a58('0x1f')]],'as':_0x30c96b['as'],'attributes':_0x30c96b['attributes'],'include':_0x30c96b[_0x8a58('0x1d')]?_[_0x8a58('0x1e')](_0x30c96b[_0x8a58('0x1d')],function(_0x4d4835){return{'model':db[_0x4d4835[_0x8a58('0x1f')]],'as':_0x4d4835['as'],'attributes':_0x4d4835[_0x8a58('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8a58('0xc')](function(_0x27d7c8){logger[_0x8a58('0xd')](_0x8a58('0x16'),_0x18a14d);logger[_0x8a58('0x20')]('GetCampaign',_0x18a14d,JSON[_0x8a58('0x11')](_0x27d7c8));_0x282f2d(_0x27d7c8);})['catch'](function(_0x501aa1){logger['error']('GetCampaign',_0x501aa1['message'],_0x18a14d);_0xe73eb9(_0x4b5012[_0x8a58('0x12')](0x1f4,_0x501aa1[_0x8a58('0x13')]));});});}; \ No newline at end of file +var _0xa477=['Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x404f01,_0x365b18){var _0x16201a=function(_0x258c37){while(--_0x258c37){_0x404f01['push'](_0x404f01['shift']());}};_0x16201a(++_0x365b18);}(_0xa477,0xe6));var _0x7a47=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa477[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')]({'raw':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1d')]||null:null,'attributes':_0x5a4e79['options']?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1e')]||null:null,'limit':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1f')]||null:null,'include':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x20')]?_[_0x7a47('0x21')](_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x20')],function(_0xe9bb12){return{'model':db[_0xe9bb12['model']],'as':_0xe9bb12['as'],'attributes':_0xe9bb12['attributes'],'include':_0xe9bb12[_0x7a47('0x20')]?_[_0x7a47('0x21')](_0xe9bb12[_0x7a47('0x20')],function(_0x3e598b){return{'model':db[_0x3e598b['model']],'as':_0x3e598b['as'],'attributes':_0x3e598b[_0x7a47('0x1e')],'include':_0x3e598b[_0x7a47('0x20')]?_['map'](_0x3e598b[_0x7a47('0x20')],function(_0x324a85){return{'model':db[_0x324a85[_0x7a47('0x22')]],'as':_0x324a85['as'],'attributes':_0x324a85[_0x7a47('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a47('0xd')](function(_0x5b2a0c){logger[_0x7a47('0xe')](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON['stringify'](_0x5b2a0c));_0x4a24b6(_0x5b2a0c);})['catch'](function(_0x5d4b9c){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x5d4b9c[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x5d4b9c[_0x7a47('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f7a3c49..d1cb38e 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 _0x15f9=['/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','put','update','delete','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getHoppers','getHopperHistories'];(function(_0x54f322,_0x24a660){var _0xb0a1d5=function(_0x523587){while(--_0x523587){_0x54f322['push'](_0x54f322['shift']());}};_0xb0a1d5(++_0x24a660);}(_0x15f9,0x150));var _0x915f=function(_0x22afdd,_0x517791){_0x22afdd=_0x22afdd-0x0;var _0x1588e1=_0x15f9[_0x22afdd];return _0x1588e1;};'use strict';var multer=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var path=require(_0x915f('0x2'));var timeout=require(_0x915f('0x3'));var express=require(_0x915f('0x4'));var router=express[_0x915f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x915f('0x6'));var interaction=require(_0x915f('0x7'));var config=require(_0x915f('0x8'));var controller=require('./campaign.controller');router[_0x915f('0x9')]('/',auth['isAuthenticated'](),controller[_0x915f('0xa')]);router[_0x915f('0x9')](_0x915f('0xb'),auth[_0x915f('0xc')](),controller[_0x915f('0xd')]);router[_0x915f('0x9')]('/:id/hoppers',auth[_0x915f('0xc')](),controller[_0x915f('0xe')]);router[_0x915f('0x9')]('/:id/hopper_histories',auth[_0x915f('0xc')](),controller[_0x915f('0xf')]);router['get'](_0x915f('0x10'),auth[_0x915f('0xc')](),controller[_0x915f('0x11')]);router[_0x915f('0x9')](_0x915f('0x12'),auth[_0x915f('0xc')](),controller[_0x915f('0x13')]);router[_0x915f('0x9')](_0x915f('0x14'),auth['isAuthenticated'](),controller[_0x915f('0x15')]);router[_0x915f('0x9')](_0x915f('0x16'),auth[_0x915f('0xc')](),controller[_0x915f('0x17')]);router['post']('/',auth[_0x915f('0xc')](),controller[_0x915f('0x18')]);router[_0x915f('0x19')](_0x915f('0x1a'),auth[_0x915f('0xc')](),controller['clone']);router[_0x915f('0x19')]('/:id/lists',auth[_0x915f('0xc')](),controller['addLists']);router[_0x915f('0x19')](_0x915f('0x16'),auth[_0x915f('0xc')](),controller['addBlackLists']);router[_0x915f('0x1b')](_0x915f('0xb'),auth[_0x915f('0xc')](),controller[_0x915f('0x1c')]);router[_0x915f('0x1d')]('/:id',auth[_0x915f('0xc')](),controller['destroy']);router[_0x915f('0x1d')](_0x915f('0x14'),auth[_0x915f('0xc')](),controller[_0x915f('0x1e')]);router[_0x915f('0x1d')](_0x915f('0x16'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x915f('0x1f')]=router; \ No newline at end of file +var _0xaf23=['destroy','removeLists','multer','path','connect-timeout','express','Router','../../components/auth/service','./campaign.controller','get','isAuthenticated','/:id','getHoppers','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','/:id/blacklists','addBlackLists','put','delete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xaf23,0x106));var _0x3af2=function(_0xa16401,_0x9a9949){_0xa16401=_0xa16401-0x0;var _0x3d5676=_0xaf23[_0xa16401];return _0x3d5676;};'use strict';var multer=require(_0x3af2('0x0'));var util=require('util');var path=require(_0x3af2('0x1'));var timeout=require(_0x3af2('0x2'));var express=require(_0x3af2('0x3'));var router=express[_0x3af2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3af2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3af2('0x6'));router[_0x3af2('0x7')]('/',auth[_0x3af2('0x8')](),controller['index']);router['get'](_0x3af2('0x9'),auth[_0x3af2('0x8')](),controller['show']);router['get']('/:id/hoppers',auth[_0x3af2('0x8')](),controller[_0x3af2('0xa')]);router[_0x3af2('0x7')]('/:id/hopper_histories',auth[_0x3af2('0x8')](),controller[_0x3af2('0xb')]);router[_0x3af2('0x7')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x3af2('0x7')](_0x3af2('0xc'),auth[_0x3af2('0x8')](),controller[_0x3af2('0xd')]);router[_0x3af2('0x7')](_0x3af2('0xe'),auth[_0x3af2('0x8')](),controller[_0x3af2('0xf')]);router[_0x3af2('0x7')]('/:id/blacklists',auth[_0x3af2('0x8')](),controller[_0x3af2('0x10')]);router[_0x3af2('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3af2('0x12'),auth[_0x3af2('0x8')](),controller[_0x3af2('0x13')]);router['post'](_0x3af2('0xe'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x3af2('0x14'),auth[_0x3af2('0x8')](),controller[_0x3af2('0x15')]);router[_0x3af2('0x16')]('/:id',auth[_0x3af2('0x8')](),controller['update']);router[_0x3af2('0x17')](_0x3af2('0x9'),auth[_0x3af2('0x8')](),controller[_0x3af2('0x18')]);router[_0x3af2('0x17')]('/:id/lists',auth[_0x3af2('0x8')](),controller[_0x3af2('0x19')]);router[_0x3af2('0x17')](_0x3af2('0x14'),auth[_0x3af2('0x8')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 687447c..753848f 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 _0x0ae9=['TEXT','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x47ff1c,_0x41c0eb){var _0x446fe0=function(_0x19d672){while(--_0x19d672){_0x47ff1c['push'](_0x47ff1c['shift']());}};_0x446fe0(++_0x41c0eb);}(_0x0ae9,0x161));var _0x90ae=function(_0x295e5c,_0x3811f6){_0x295e5c=_0x295e5c-0x0;var _0x21b5d3=_0x0ae9[_0x295e5c];return _0x21b5d3;};'use strict';var Sequelize=require(_0x90ae('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x90ae('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x90ae('0x2')]},'name':{'type':Sequelize[_0x90ae('0x3')],'get':function(){return this[_0x90ae('0x4')](_0x90ae('0x5'));}}}; \ No newline at end of file +var _0x482b=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x31b591,_0x11d791){var _0x5040ff=function(_0x544cc5){while(--_0x544cc5){_0x31b591['push'](_0x31b591['shift']());}};_0x5040ff(++_0x11d791);}(_0x482b,0x89));var _0xb482=function(_0x3de54a,_0x43c911){_0x3de54a=_0x3de54a-0x0;var _0x9f02e2=_0x482b[_0x3de54a];return _0x9f02e2;};'use strict';var Sequelize=require(_0xb482('0x0'));module['exports']={'key':{'type':Sequelize[_0xb482('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb482('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb482('0x1')]},'name':{'type':Sequelize[_0xb482('0x3')],'get':function(){return this[_0xb482('0x4')](_0xb482('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c9d3381..9b0350b 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 _0x59b7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','stack','name','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','CannedAnswer','include','findAll','catch','show','params','rawAttributes','includeAll','options','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse'];(function(_0x410f44,_0x4c6e4d){var _0x2e424a=function(_0x298251){while(--_0x298251){_0x410f44['push'](_0x410f44['shift']());}};_0x2e424a(++_0x4c6e4d);}(_0x59b7,0xf2));var _0x759b=function(_0x78c58d,_0x51c068){_0x78c58d=_0x78c58d-0x0;var _0x13a0c3=_0x59b7[_0x78c58d];return _0x13a0c3;};'use strict';var emlformat=require(_0x759b('0x0'));var rimraf=require(_0x759b('0x1'));var zipdir=require(_0x759b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x759b('0x3'));var moment=require(_0x759b('0x4'));var BPromise=require(_0x759b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x759b('0x6'));var csv=require(_0x759b('0x7'));var ejs=require(_0x759b('0x8'));var fs=require('fs');var fs_extra=require(_0x759b('0x9'));var _=require(_0x759b('0xa'));var squel=require('squel');var crypto=require(_0x759b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x759b('0x7'));var querystring=require('querystring');var Papa=require(_0x759b('0xc'));var Redis=require(_0x759b('0xd'));var authService=require(_0x759b('0xe'));var qs=require(_0x759b('0xf'));var as=require(_0x759b('0x10'));var hardwareService=require(_0x759b('0x11'));var logger=require(_0x759b('0x12'))('api');var utils=require(_0x759b('0x13'));var config=require(_0x759b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x759b('0x15'))['db'];function respondWithStatusCode(_0x5ae926,_0x38279b){_0x38279b=_0x38279b||0xcc;return function(_0x4accb0){if(_0x4accb0){return _0x5ae926[_0x759b('0x16')](_0x38279b);}return _0x5ae926[_0x759b('0x17')](_0x38279b)['end']();};}function respondWithResult(_0x37eded,_0x30b057){_0x30b057=_0x30b057||0xc8;return function(_0x46ad2d){if(_0x46ad2d){return _0x37eded['status'](_0x30b057)[_0x759b('0x18')](_0x46ad2d);}};}function respondWithFilteredResult(_0x2796eb,_0x48dfd8){return function(_0x23dddf){if(_0x23dddf){var _0x360a9b=typeof _0x48dfd8[_0x759b('0x19')]===_0x759b('0x1a')&&typeof _0x48dfd8[_0x759b('0x1b')]===_0x759b('0x1a');var _0xd8e6ce=_0x23dddf[_0x759b('0x1c')];var _0x492719=_0x360a9b?0x0:_0x48dfd8[_0x759b('0x19')];var _0x45e26c=_0x360a9b?_0x23dddf['count']:_0x48dfd8[_0x759b('0x19')]+_0x48dfd8['limit'];var _0x3ef7d1;if(_0x45e26c>=_0xd8e6ce){_0x45e26c=_0xd8e6ce;_0x3ef7d1=0xc8;}else{_0x3ef7d1=0xce;}_0x2796eb[_0x759b('0x17')](_0x3ef7d1);return _0x2796eb[_0x759b('0x1d')](_0x759b('0x1e'),_0x492719+'-'+_0x45e26c+'/'+_0xd8e6ce)['json'](_0x23dddf);}return null;};}function patchUpdates(_0x447073){return function(_0x468733){try{jsonpatch[_0x759b('0x1f')](_0x468733,_0x447073,!![]);}catch(_0x21a0f1){return BPromise['reject'](_0x21a0f1);}return _0x468733[_0x759b('0x20')]();};}function saveUpdates(_0xe22e5f,_0x5e5f79){return function(_0x592218){if(_0x592218){return _0x592218[_0x759b('0x21')](_0xe22e5f)[_0x759b('0x22')](function(_0x1560e1){return _0x1560e1;});}return null;};}function removeEntity(_0x70fda9,_0x5ec9c8){return function(_0xa4f7a4){if(_0xa4f7a4){return _0xa4f7a4['destroy']()['then'](function(){var _0x7ef435=_0xa4f7a4[_0x759b('0x23')]({'plain':!![]});var _0x4363a1='CannedAnswers';return db[_0x759b('0x24')][_0x759b('0x25')]({'where':{'type':_0x4363a1,'resourceId':_0x7ef435['id']}})['then'](function(){return _0xa4f7a4;});})[_0x759b('0x22')](function(){_0x70fda9[_0x759b('0x17')](0xcc)[_0x759b('0x26')]();});}};}function handleEntityNotFound(_0x3fd4fb,_0x5b6a62){return function(_0x1d98d9){if(!_0x1d98d9){_0x3fd4fb[_0x759b('0x16')](0x194);}return _0x1d98d9;};}function handleError(_0x43b20d,_0x219af8){_0x219af8=_0x219af8||0x1f4;return function(_0x12699f){logger['error'](_0x12699f[_0x759b('0x27')]);if(_0x12699f['name']){delete _0x12699f[_0x759b('0x28')];}_0x43b20d[_0x759b('0x17')](_0x219af8)['send'](_0x12699f);};}exports[_0x759b('0x29')]=function(_0x175f4c,_0x5270c0){var _0x5285a2={},_0x34ddf7={},_0x3cd465={'count':0x0,'rows':[]};var _0x4200ef=_[_0x759b('0x2a')](db['CannedAnswer']['rawAttributes'],function(_0x886387){return{'name':_0x886387[_0x759b('0x2b')],'type':_0x886387[_0x759b('0x2c')][_0x759b('0x2d')]};});_0x34ddf7[_0x759b('0x2e')]=_['map'](_0x4200ef,_0x759b('0x28'));_0x34ddf7['query']=_[_0x759b('0x2f')](_0x175f4c[_0x759b('0x30')]);_0x34ddf7[_0x759b('0x31')]=_['intersection'](_0x34ddf7[_0x759b('0x2e')],_0x34ddf7[_0x759b('0x30')]);_0x5285a2[_0x759b('0x32')]=_[_0x759b('0x33')](_0x34ddf7[_0x759b('0x2e')],qs[_0x759b('0x34')](_0x175f4c[_0x759b('0x30')][_0x759b('0x34')]));_0x5285a2[_0x759b('0x32')]=_0x5285a2[_0x759b('0x32')][_0x759b('0x35')]?_0x5285a2['attributes']:_0x34ddf7[_0x759b('0x2e')];if(!_0x175f4c['query'][_0x759b('0x36')]('nolimit')){_0x5285a2['limit']=qs[_0x759b('0x1b')](_0x175f4c['query'][_0x759b('0x1b')]);_0x5285a2[_0x759b('0x19')]=qs[_0x759b('0x19')](_0x175f4c[_0x759b('0x30')][_0x759b('0x19')]);}_0x5285a2[_0x759b('0x37')]=qs['sort'](_0x175f4c['query'][_0x759b('0x38')]);_0x5285a2[_0x759b('0x39')]=qs[_0x759b('0x31')](_[_0x759b('0x3a')](_0x175f4c['query'],_0x34ddf7[_0x759b('0x31')]),_0x4200ef);if(_0x175f4c['query'][_0x759b('0x3b')]){_0x5285a2['where']=_['merge'](_0x5285a2[_0x759b('0x39')],{'$or':[{'key':{'$like':'%'+_0x175f4c['query']['filter']+'%'}},{'value':{'$like':'%'+_0x175f4c['query'][_0x759b('0x3b')]+'%'}}]});}_0x5285a2=_[_0x759b('0x3c')]({},_0x5285a2,_0x175f4c['options']);var _0x536ff2={'where':_0x5285a2[_0x759b('0x39')]};return db[_0x759b('0x3d')][_0x759b('0x1c')](_0x536ff2)['then'](function(_0x4b78e4){_0x3cd465[_0x759b('0x1c')]=_0x4b78e4;if(_0x175f4c[_0x759b('0x30')]['includeAll']){_0x5285a2[_0x759b('0x3e')]=[{'all':!![]}];}return db[_0x759b('0x3d')][_0x759b('0x3f')](_0x5285a2);})['then'](function(_0x12df6a){_0x3cd465['rows']=_0x12df6a;return _0x3cd465;})['then'](respondWithFilteredResult(_0x5270c0,_0x5285a2))[_0x759b('0x40')](handleError(_0x5270c0,null));};exports[_0x759b('0x41')]=function(_0x4dc5c5,_0x353444){var _0x18b723={'raw':!![],'where':{'id':_0x4dc5c5[_0x759b('0x42')]['id']}},_0x39091c={};_0x39091c[_0x759b('0x2e')]=_[_0x759b('0x2f')](db['CannedAnswer'][_0x759b('0x43')]);_0x39091c[_0x759b('0x30')]=_[_0x759b('0x2f')](_0x4dc5c5[_0x759b('0x30')]);_0x39091c[_0x759b('0x31')]=_[_0x759b('0x33')](_0x39091c[_0x759b('0x2e')],_0x39091c[_0x759b('0x30')]);_0x18b723[_0x759b('0x32')]=_[_0x759b('0x33')](_0x39091c[_0x759b('0x2e')],qs['fields'](_0x4dc5c5[_0x759b('0x30')]['fields']));_0x18b723[_0x759b('0x32')]=_0x18b723[_0x759b('0x32')][_0x759b('0x35')]?_0x18b723[_0x759b('0x32')]:_0x39091c[_0x759b('0x2e')];if(_0x4dc5c5[_0x759b('0x30')][_0x759b('0x44')]){_0x18b723[_0x759b('0x3e')]=[{'all':!![]}];}_0x18b723=_['merge']({},_0x18b723,_0x4dc5c5[_0x759b('0x45')]);return db[_0x759b('0x3d')]['find'](_0x18b723)[_0x759b('0x22')](handleEntityNotFound(_0x353444,null))[_0x759b('0x22')](respondWithResult(_0x353444,null))['catch'](handleError(_0x353444,null));};exports[_0x759b('0x21')]=function(_0xbf4fd3,_0x53c83f){if(_0xbf4fd3[_0x759b('0x46')]['id']){delete _0xbf4fd3['body']['id'];}return db['CannedAnswer'][_0x759b('0x47')]({'where':{'id':_0xbf4fd3[_0x759b('0x42')]['id']}})['then'](handleEntityNotFound(_0x53c83f,null))[_0x759b('0x22')](saveUpdates(_0xbf4fd3['body'],null))['then'](respondWithResult(_0x53c83f,null))[_0x759b('0x40')](handleError(_0x53c83f,null));};exports[_0x759b('0x25')]=function(_0x2c9b2c,_0x5cc98b){return db[_0x759b('0x3d')]['find']({'where':{'id':_0x2c9b2c[_0x759b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5cc98b,null))[_0x759b('0x22')](removeEntity(_0x5cc98b,null))[_0x759b('0x40')](handleError(_0x5cc98b,null));};exports['create']=function(_0x33efd7,_0xfe2c7c){var _0x28af5f={'key':_0x33efd7['body'][_0x759b('0x2d')]};if(_0x33efd7[_0x759b('0x46')][_0x759b('0x48')]){_0x28af5f[_0x759b('0x48')]=_0x33efd7[_0x759b('0x46')][_0x759b('0x48')];}else if(_0x33efd7[_0x759b('0x46')][_0x759b('0x49')]){_0x28af5f[_0x759b('0x49')]=_0x33efd7[_0x759b('0x46')]['SmsAccountId'];}else if(_0x33efd7['body'][_0x759b('0x4a')]){_0x28af5f[_0x759b('0x4a')]=_0x33efd7[_0x759b('0x46')][_0x759b('0x4a')];}else if(_0x33efd7[_0x759b('0x46')][_0x759b('0x4b')]){_0x28af5f[_0x759b('0x4b')]=_0x33efd7['body'][_0x759b('0x4b')];}return db[_0x759b('0x3d')]['find']({'where':_0x28af5f})['then'](function(_0x52befc){if(_0x52befc){throw new db[(_0x759b('0x4c'))][(_0x759b('0x4d'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x759b('0x4e')](_0x33efd7['body']);})[_0x759b('0x22')](function(_0x314f98){var _0x554ea8=_0x33efd7['user'][_0x759b('0x23')]({'plain':!![]});if(!_0x554ea8)throw new Error(_0x759b('0x4f'));if(_0x554ea8[_0x759b('0x50')]==='user'){var _0x35e088=_0x314f98[_0x759b('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x759b('0x47')]({'where':{'name':_0x759b('0x51'),'userProfileId':_0x554ea8[_0x759b('0x52')]},'raw':!![]})['then'](function(_0x1dcc1d){if(_0x1dcc1d&&_0x1dcc1d[_0x759b('0x53')]===0x0){return db[_0x759b('0x24')]['create']({'name':_0x35e088['name'],'resourceId':_0x35e088['id'],'type':_0x1dcc1d[_0x759b('0x28')],'sectionId':_0x1dcc1d['id']},{})[_0x759b('0x22')](function(){return _0x314f98;});}else{return _0x314f98;}})[_0x759b('0x40')](function(_0x1cda16){logger[_0x759b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cda16);throw _0x1cda16;});}return _0x314f98;})['then'](respondWithResult(_0xfe2c7c,0xc9))[_0x759b('0x40')](handleError(_0xfe2c7c,null));}; \ No newline at end of file +var _0x29d6=['ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','autoAssociation','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/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','destroy','get','CannedAnswers','UserProfileResource','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','CannedAnswer','includeAll','rows','catch','show','params','keys','include','merge','options','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize'];(function(_0x14845b,_0x5d8458){var _0x50998b=function(_0x324776){while(--_0x324776){_0x14845b['push'](_0x14845b['shift']());}};_0x50998b(++_0x5d8458);}(_0x29d6,0x11a));var _0x629d=function(_0x56a176,_0x298477){_0x56a176=_0x56a176-0x0;var _0x539ef2=_0x29d6[_0x56a176];return _0x539ef2;};'use strict';var emlformat=require(_0x629d('0x0'));var rimraf=require(_0x629d('0x1'));var zipdir=require(_0x629d('0x2'));var jsonpatch=require(_0x629d('0x3'));var rp=require(_0x629d('0x4'));var moment=require(_0x629d('0x5'));var BPromise=require(_0x629d('0x6'));var Mustache=require(_0x629d('0x7'));var util=require(_0x629d('0x8'));var path=require(_0x629d('0x9'));var sox=require(_0x629d('0xa'));var csv=require(_0x629d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x629d('0xc'));var _=require(_0x629d('0xd'));var squel=require(_0x629d('0xe'));var crypto=require(_0x629d('0xf'));var jsforce=require(_0x629d('0x10'));var deskjs=require(_0x629d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x629d('0x12'));var Redis=require(_0x629d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x629d('0x14'));var as=require(_0x629d('0x15'));var hardwareService=require(_0x629d('0x16'));var logger=require(_0x629d('0x17'))(_0x629d('0x18'));var utils=require(_0x629d('0x19'));var config=require(_0x629d('0x1a'));var licenseUtil=require(_0x629d('0x1b'));var db=require(_0x629d('0x1c'))['db'];function respondWithStatusCode(_0xd1b214,_0x51b95a){_0x51b95a=_0x51b95a||0xcc;return function(_0x29ca50){if(_0x29ca50){return _0xd1b214[_0x629d('0x1d')](_0x51b95a);}return _0xd1b214[_0x629d('0x1e')](_0x51b95a)[_0x629d('0x1f')]();};}function respondWithResult(_0x40c3ea,_0x547a26){_0x547a26=_0x547a26||0xc8;return function(_0x10a370){if(_0x10a370){return _0x40c3ea[_0x629d('0x1e')](_0x547a26)[_0x629d('0x20')](_0x10a370);}};}function respondWithFilteredResult(_0x596821,_0x2f0d3e){return function(_0x30c3e8){if(_0x30c3e8){var _0x1003c9=typeof _0x2f0d3e[_0x629d('0x21')]===_0x629d('0x22')&&typeof _0x2f0d3e[_0x629d('0x23')]===_0x629d('0x22');var _0x45d71c=_0x30c3e8[_0x629d('0x24')];var _0x125435=_0x1003c9?0x0:_0x2f0d3e[_0x629d('0x21')];var _0x596404=_0x1003c9?_0x30c3e8[_0x629d('0x24')]:_0x2f0d3e[_0x629d('0x21')]+_0x2f0d3e['limit'];var _0x417505;if(_0x596404>=_0x45d71c){_0x596404=_0x45d71c;_0x417505=0xc8;}else{_0x417505=0xce;}_0x596821[_0x629d('0x1e')](_0x417505);return _0x596821[_0x629d('0x25')](_0x629d('0x26'),_0x125435+'-'+_0x596404+'/'+_0x45d71c)['json'](_0x30c3e8);}return null;};}function patchUpdates(_0x3f37e4){return function(_0x51d3b0){try{jsonpatch[_0x629d('0x27')](_0x51d3b0,_0x3f37e4,!![]);}catch(_0x40eafe){return BPromise[_0x629d('0x28')](_0x40eafe);}return _0x51d3b0[_0x629d('0x29')]();};}function saveUpdates(_0x8d43b,_0x3aaad3){return function(_0x2e5375){if(_0x2e5375){return _0x2e5375[_0x629d('0x2a')](_0x8d43b)['then'](function(_0x47ed7b){return _0x47ed7b;});}return null;};}function removeEntity(_0x3e5097,_0x2929cd){return function(_0x28ef28){if(_0x28ef28){return _0x28ef28[_0x629d('0x2b')]()['then'](function(){var _0x38104a=_0x28ef28[_0x629d('0x2c')]({'plain':!![]});var _0x594115=_0x629d('0x2d');return db[_0x629d('0x2e')][_0x629d('0x2b')]({'where':{'type':_0x594115,'resourceId':_0x38104a['id']}})[_0x629d('0x2f')](function(){return _0x28ef28;});})[_0x629d('0x2f')](function(){_0x3e5097[_0x629d('0x1e')](0xcc)[_0x629d('0x1f')]();});}};}function handleEntityNotFound(_0x31a4bb,_0x440a03){return function(_0x5d85d1){if(!_0x5d85d1){_0x31a4bb[_0x629d('0x1d')](0x194);}return _0x5d85d1;};}function handleError(_0x22b08e,_0x5c5af7){_0x5c5af7=_0x5c5af7||0x1f4;return function(_0x10caed){logger['error'](_0x10caed[_0x629d('0x30')]);if(_0x10caed['name']){delete _0x10caed[_0x629d('0x31')];}_0x22b08e['status'](_0x5c5af7)[_0x629d('0x32')](_0x10caed);};}exports['index']=function(_0x28db49,_0x230c5a){var _0x556684={},_0x3d0933={},_0x4d8f4f={'count':0x0,'rows':[]};var _0x4fea8c=_[_0x629d('0x33')](db['CannedAnswer'][_0x629d('0x34')],function(_0x3d1b44){return{'name':_0x3d1b44[_0x629d('0x35')],'type':_0x3d1b44[_0x629d('0x36')][_0x629d('0x37')]};});_0x3d0933[_0x629d('0x38')]=_[_0x629d('0x33')](_0x4fea8c,_0x629d('0x31'));_0x3d0933['query']=_['keys'](_0x28db49[_0x629d('0x39')]);_0x3d0933[_0x629d('0x3a')]=_[_0x629d('0x3b')](_0x3d0933[_0x629d('0x38')],_0x3d0933['query']);_0x556684[_0x629d('0x3c')]=_['intersection'](_0x3d0933['model'],qs[_0x629d('0x3d')](_0x28db49[_0x629d('0x39')][_0x629d('0x3d')]));_0x556684[_0x629d('0x3c')]=_0x556684['attributes'][_0x629d('0x3e')]?_0x556684[_0x629d('0x3c')]:_0x3d0933[_0x629d('0x38')];if(!_0x28db49[_0x629d('0x39')]['hasOwnProperty'](_0x629d('0x3f'))){_0x556684[_0x629d('0x23')]=qs[_0x629d('0x23')](_0x28db49[_0x629d('0x39')]['limit']);_0x556684['offset']=qs[_0x629d('0x21')](_0x28db49[_0x629d('0x39')][_0x629d('0x21')]);}_0x556684[_0x629d('0x40')]=qs[_0x629d('0x41')](_0x28db49[_0x629d('0x39')][_0x629d('0x41')]);_0x556684[_0x629d('0x42')]=qs[_0x629d('0x3a')](_[_0x629d('0x43')](_0x28db49[_0x629d('0x39')],_0x3d0933[_0x629d('0x3a')]),_0x4fea8c);if(_0x28db49[_0x629d('0x39')]['filter']){_0x556684[_0x629d('0x42')]=_['merge'](_0x556684[_0x629d('0x42')],{'$or':[{'key':{'$like':'%'+_0x28db49['query'][_0x629d('0x44')]+'%'}},{'value':{'$like':'%'+_0x28db49[_0x629d('0x39')][_0x629d('0x44')]+'%'}}]});}_0x556684=_['merge']({},_0x556684,_0x28db49['options']);var _0x42e1e4={'where':_0x556684['where']};return db[_0x629d('0x45')][_0x629d('0x24')](_0x42e1e4)['then'](function(_0x4bc6e0){_0x4d8f4f[_0x629d('0x24')]=_0x4bc6e0;if(_0x28db49['query'][_0x629d('0x46')]){_0x556684['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x556684);})['then'](function(_0x43e926){_0x4d8f4f[_0x629d('0x47')]=_0x43e926;return _0x4d8f4f;})[_0x629d('0x2f')](respondWithFilteredResult(_0x230c5a,_0x556684))[_0x629d('0x48')](handleError(_0x230c5a,null));};exports[_0x629d('0x49')]=function(_0x472a40,_0x4fc6da){var _0x3177a4={'raw':!![],'where':{'id':_0x472a40[_0x629d('0x4a')]['id']}},_0x130df1={};_0x130df1[_0x629d('0x38')]=_[_0x629d('0x4b')](db[_0x629d('0x45')]['rawAttributes']);_0x130df1['query']=_['keys'](_0x472a40[_0x629d('0x39')]);_0x130df1[_0x629d('0x3a')]=_[_0x629d('0x3b')](_0x130df1[_0x629d('0x38')],_0x130df1[_0x629d('0x39')]);_0x3177a4['attributes']=_[_0x629d('0x3b')](_0x130df1[_0x629d('0x38')],qs[_0x629d('0x3d')](_0x472a40[_0x629d('0x39')][_0x629d('0x3d')]));_0x3177a4[_0x629d('0x3c')]=_0x3177a4[_0x629d('0x3c')][_0x629d('0x3e')]?_0x3177a4[_0x629d('0x3c')]:_0x130df1[_0x629d('0x38')];if(_0x472a40[_0x629d('0x39')][_0x629d('0x46')]){_0x3177a4[_0x629d('0x4c')]=[{'all':!![]}];}_0x3177a4=_[_0x629d('0x4d')]({},_0x3177a4,_0x472a40[_0x629d('0x4e')]);return db[_0x629d('0x45')]['find'](_0x3177a4)[_0x629d('0x2f')](handleEntityNotFound(_0x4fc6da,null))[_0x629d('0x2f')](respondWithResult(_0x4fc6da,null))[_0x629d('0x48')](handleError(_0x4fc6da,null));};exports['update']=function(_0x3a8367,_0x341e2e){if(_0x3a8367[_0x629d('0x4f')]['id']){delete _0x3a8367[_0x629d('0x4f')]['id'];}return db[_0x629d('0x45')][_0x629d('0x50')]({'where':{'id':_0x3a8367[_0x629d('0x4a')]['id']}})[_0x629d('0x2f')](handleEntityNotFound(_0x341e2e,null))[_0x629d('0x2f')](saveUpdates(_0x3a8367[_0x629d('0x4f')],null))[_0x629d('0x2f')](respondWithResult(_0x341e2e,null))[_0x629d('0x48')](handleError(_0x341e2e,null));};exports[_0x629d('0x2b')]=function(_0x894a3c,_0x463b8e){return db[_0x629d('0x45')][_0x629d('0x50')]({'where':{'id':_0x894a3c[_0x629d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x463b8e,null))[_0x629d('0x2f')](removeEntity(_0x463b8e,null))[_0x629d('0x48')](handleError(_0x463b8e,null));};exports['create']=function(_0x4991d1,_0x13df96){var _0x37f611={'key':_0x4991d1[_0x629d('0x4f')]['key']};if(_0x4991d1['body'][_0x629d('0x51')]){_0x37f611['MailAccountId']=_0x4991d1[_0x629d('0x4f')][_0x629d('0x51')];}else if(_0x4991d1['body'][_0x629d('0x52')]){_0x37f611[_0x629d('0x52')]=_0x4991d1[_0x629d('0x4f')][_0x629d('0x52')];}else if(_0x4991d1[_0x629d('0x4f')]['OpenchannelAccountId']){_0x37f611['OpenchannelAccountId']=_0x4991d1[_0x629d('0x4f')][_0x629d('0x53')];}else if(_0x4991d1[_0x629d('0x4f')]['ChatWebsiteId']){_0x37f611[_0x629d('0x54')]=_0x4991d1[_0x629d('0x4f')][_0x629d('0x54')];}return db['CannedAnswer'][_0x629d('0x50')]({'where':_0x37f611})[_0x629d('0x2f')](function(_0x539dd1){if(_0x539dd1){throw new db[(_0x629d('0x55'))][(_0x629d('0x56'))](_0x629d('0x57'));}return db[_0x629d('0x45')]['create'](_0x4991d1[_0x629d('0x4f')]);})[_0x629d('0x2f')](function(_0xc2a0a0){var _0x3da611=_0x4991d1[_0x629d('0x58')][_0x629d('0x2c')]({'plain':!![]});if(!_0x3da611)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da611['role']===_0x629d('0x58')){var _0x2f814a=_0xc2a0a0[_0x629d('0x2c')]({'plain':!![]});return db[_0x629d('0x59')]['find']({'where':{'name':_0x629d('0x2d'),'userProfileId':_0x3da611['userProfileId']},'raw':!![]})[_0x629d('0x2f')](function(_0x549376){if(_0x549376&&_0x549376[_0x629d('0x5a')]===0x0){return db[_0x629d('0x2e')][_0x629d('0x5b')]({'name':_0x2f814a[_0x629d('0x31')],'resourceId':_0x2f814a['id'],'type':_0x549376['name'],'sectionId':_0x549376['id']},{})[_0x629d('0x2f')](function(){return _0xc2a0a0;});}else{return _0xc2a0a0;}})['catch'](function(_0x36c943){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c943);throw _0x36c943;});}return _0xc2a0a0;})['then'](respondWithResult(_0x13df96,0xc9))[_0x629d('0x48')](handleError(_0x13df96,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2cd1161..e814745 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 _0x2f9e=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','moment','request-promise','path'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x2f9e,0x166));var _0xe2f9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2f9e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe2f9('0x0'));var util=require(_0xe2f9('0x1'));var logger=require('../../config/logger')(_0xe2f9('0x2'));var moment=require(_0xe2f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe2f9('0x4'));var fs=require('fs');var path=require(_0xe2f9('0x5'));var rimraf=require(_0xe2f9('0x6'));var config=require(_0xe2f9('0x7'));var attributes=require(_0xe2f9('0x8'));module[_0xe2f9('0x9')]=function(_0x9b0a65,_0x516962){return _0x9b0a65[_0xe2f9('0xa')](_0xe2f9('0xb'),attributes,{'tableName':_0xe2f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2f9('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb6e6=['bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x2e1fe2,_0x4dc62a){var _0x4d7447=function(_0x5f1896){while(--_0x5f1896){_0x2e1fe2['push'](_0x2e1fe2['shift']());}};_0x4d7447(++_0x4dc62a);}(_0xb6e6,0xbf));var _0x6b6e=function(_0x2ff6ea,_0x4e373a){_0x2ff6ea=_0x2ff6ea-0x0;var _0x24a11c=_0xb6e6[_0x2ff6ea];return _0x24a11c;};'use strict';var _=require(_0x6b6e('0x0'));var util=require('util');var logger=require(_0x6b6e('0x1'))(_0x6b6e('0x2'));var moment=require(_0x6b6e('0x3'));var BPromise=require(_0x6b6e('0x4'));var rp=require(_0x6b6e('0x5'));var fs=require('fs');var path=require(_0x6b6e('0x6'));var rimraf=require(_0x6b6e('0x7'));var config=require(_0x6b6e('0x8'));var attributes=require(_0x6b6e('0x9'));module[_0x6b6e('0xa')]=function(_0x319018,_0x29ab81){return _0x319018[_0x6b6e('0xb')](_0x6b6e('0xc'),attributes,{'tableName':_0x6b6e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b6e('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3704fca..a002664 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(_0x238851,_0x546b8e){var _0x4910b6=function(_0x26c3d3){while(--_0x26c3d3){_0x238851['push'](_0x238851['shift']());}};_0x4910b6(++_0x546b8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x586128,_0x223852){var _0x8acfc6=function(_0x274d7c){while(--_0x274d7c){_0x586128['push'](_0x586128['shift']());}};_0x8acfc6(++_0x223852);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index c8e26a3..cb8f917 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 _0x1401=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','path','connect-timeout','express'];(function(_0x38521c,_0x22aeed){var _0x28b502=function(_0x1b55f3){while(--_0x1b55f3){_0x38521c['push'](_0x38521c['shift']());}};_0x28b502(++_0x22aeed);}(_0x1401,0x189));var _0x1140=function(_0x5d8a00,_0x56128f){_0x5d8a00=_0x5d8a00-0x0;var _0xa53ba1=_0x1401[_0x5d8a00];return _0xa53ba1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1140('0x0'));var timeout=require(_0x1140('0x1'));var express=require(_0x1140('0x2'));var router=express[_0x1140('0x3')]();var fs_extra=require(_0x1140('0x4'));var auth=require(_0x1140('0x5'));var interaction=require(_0x1140('0x6'));var config=require(_0x1140('0x7'));var controller=require('./cannedAnswer.controller');router[_0x1140('0x8')]('/',auth[_0x1140('0x9')](),controller[_0x1140('0xa')]);router[_0x1140('0x8')](_0x1140('0xb'),auth[_0x1140('0x9')](),controller[_0x1140('0xc')]);router[_0x1140('0xd')]('/',auth[_0x1140('0x9')](),controller['create']);router[_0x1140('0xe')](_0x1140('0xb'),auth[_0x1140('0x9')](),controller[_0x1140('0xf')]);router[_0x1140('0x10')]('/:id',auth[_0x1140('0x9')](),controller['destroy']);module[_0x1140('0x11')]=router; \ No newline at end of file +var _0x382c=['post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','/:id','show'];(function(_0x3744ba,_0x5e13bc){var _0x21e749=function(_0xf88887){while(--_0xf88887){_0x3744ba['push'](_0x3744ba['shift']());}};_0x21e749(++_0x5e13bc);}(_0x382c,0x126));var _0xc382=function(_0x3a604a,_0x1b5e07){_0x3a604a=_0x3a604a-0x0;var _0xde7ac9=_0x382c[_0x3a604a];return _0xde7ac9;};'use strict';var multer=require(_0xc382('0x0'));var util=require('util');var path=require(_0xc382('0x1'));var timeout=require(_0xc382('0x2'));var express=require(_0xc382('0x3'));var router=express['Router']();var fs_extra=require(_0xc382('0x4'));var auth=require(_0xc382('0x5'));var interaction=require(_0xc382('0x6'));var config=require('../../config/environment');var controller=require(_0xc382('0x7'));router[_0xc382('0x8')]('/',auth[_0xc382('0x9')](),controller['index']);router[_0xc382('0x8')](_0xc382('0xa'),auth['isAuthenticated'](),controller[_0xc382('0xb')]);router[_0xc382('0xc')]('/',auth['isAuthenticated'](),controller[_0xc382('0xd')]);router[_0xc382('0xe')](_0xc382('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc382('0xf')]('/:id',auth[_0xc382('0x9')](),controller[_0xc382('0x10')]);module[_0xc382('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 66061ec..9e6d31f 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 _0x1da6=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x447d73,_0x50f8c7){var _0x343b07=function(_0x467a77){while(--_0x467a77){_0x447d73['push'](_0x447d73['shift']());}};_0x343b07(++_0x50f8c7);}(_0x1da6,0x7c));var _0x61da=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0x1da6[_0x1fc82b];return _0x4c6679;};'use strict';var Sequelize=require(_0x61da('0x0'));module[_0x61da('0x1')]={'calldate':{'type':Sequelize[_0x61da('0x2')],'allowNull':![],'defaultValue':_0x61da('0x3')},'clid':{'type':Sequelize[_0x61da('0x4')]},'src':{'type':Sequelize[_0x61da('0x4')]},'dst':{'type':Sequelize[_0x61da('0x4')]},'dcontext':{'type':Sequelize[_0x61da('0x4')]},'channel':{'type':Sequelize[_0x61da('0x4')]},'dstchannel':{'type':Sequelize[_0x61da('0x4')]},'lastapp':{'type':Sequelize[_0x61da('0x4')]},'lastdata':{'type':Sequelize[_0x61da('0x4')]},'duration':{'type':Sequelize[_0x61da('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x61da('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x61da('0x4')]},'amaflags':{'type':Sequelize[_0x61da('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x61da('0x4')]},'userfield':{'type':Sequelize[_0x61da('0x4')]},'uniqueid':{'type':Sequelize[_0x61da('0x4')]},'linkedid':{'type':Sequelize[_0x61da('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x61da('0x4')]},'type':{'type':Sequelize[_0x61da('0x4')]},'tag':{'type':Sequelize[_0x61da('0x4')]}}; \ No newline at end of file +var _0x0f61=['INTEGER','exports','STRING'];(function(_0x20210e,_0x1603f6){var _0x439c00=function(_0x5b4cc2){while(--_0x5b4cc2){_0x20210e['push'](_0x20210e['shift']());}};_0x439c00(++_0x1603f6);}(_0x0f61,0xa6));var _0x10f6=function(_0x2a2dfc,_0x33b59c){_0x2a2dfc=_0x2a2dfc-0x0;var _0x124c3f=_0x0f61[_0x2a2dfc];return _0x124c3f;};'use strict';var Sequelize=require('sequelize');module[_0x10f6('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x10f6('0x1')]},'src':{'type':Sequelize[_0x10f6('0x1')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x10f6('0x1')]},'channel':{'type':Sequelize[_0x10f6('0x1')]},'dstchannel':{'type':Sequelize[_0x10f6('0x1')]},'lastapp':{'type':Sequelize[_0x10f6('0x1')]},'lastdata':{'type':Sequelize[_0x10f6('0x1')]},'duration':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x10f6('0x1')]},'amaflags':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x10f6('0x1')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x10f6('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x10f6('0x1')]},'peeraccount':{'type':Sequelize[_0x10f6('0x1')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x10f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index df2f1d9..72a6ff4 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 _0x106f=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','Cdr','findAll','params','create','body','catch','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util'];(function(_0x56f84a,_0x177f5c){var _0x1787b2=function(_0x25d335){while(--_0x25d335){_0x56f84a['push'](_0x56f84a['shift']());}};_0x1787b2(++_0x177f5c);}(_0x106f,0x162));var _0xf106=function(_0x2f9670,_0x4ae4ac){_0x2f9670=_0x2f9670-0x0;var _0x287620=_0x106f[_0x2f9670];return _0x287620;};'use strict';var emlformat=require(_0xf106('0x0'));var rimraf=require(_0xf106('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf106('0x2'));var rp=require(_0xf106('0x3'));var moment=require('moment');var BPromise=require(_0xf106('0x4'));var Mustache=require('mustache');var util=require(_0xf106('0x5'));var path=require(_0xf106('0x6'));var sox=require(_0xf106('0x7'));var csv=require(_0xf106('0x8'));var ejs=require(_0xf106('0x9'));var fs=require('fs');var fs_extra=require(_0xf106('0xa'));var _=require(_0xf106('0xb'));var squel=require('squel');var crypto=require(_0xf106('0xc'));var jsforce=require(_0xf106('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf106('0xe'));var qs=require(_0xf106('0xf'));var as=require(_0xf106('0x10'));var hardwareService=require(_0xf106('0x11'));var logger=require(_0xf106('0x12'))(_0xf106('0x13'));var utils=require(_0xf106('0x14'));var config=require(_0xf106('0x15'));var licenseUtil=require(_0xf106('0x16'));var db=require(_0xf106('0x17'))['db'];function respondWithStatusCode(_0x31eebf,_0x5e9da8){_0x5e9da8=_0x5e9da8||0xcc;return function(_0x2bd234){if(_0x2bd234){return _0x31eebf[_0xf106('0x18')](_0x5e9da8);}return _0x31eebf['status'](_0x5e9da8)['end']();};}function respondWithResult(_0x322351,_0x2cdbf6){_0x2cdbf6=_0x2cdbf6||0xc8;return function(_0x292a0d){if(_0x292a0d){return _0x322351['status'](_0x2cdbf6)[_0xf106('0x19')](_0x292a0d);}};}function respondWithFilteredResult(_0x26186f,_0xf05683){return function(_0x48bfdd){if(_0x48bfdd){var _0x1e17e6=typeof _0xf05683[_0xf106('0x1a')]==='undefined'&&typeof _0xf05683[_0xf106('0x1b')]===_0xf106('0x1c');var _0x62352=_0x48bfdd['count'];var _0x5d02c0=_0x1e17e6?0x0:_0xf05683[_0xf106('0x1a')];var _0x726d7c=_0x1e17e6?_0x48bfdd[_0xf106('0x1d')]:_0xf05683['offset']+_0xf05683[_0xf106('0x1b')];var _0x1a6816;if(_0x726d7c>=_0x62352){_0x726d7c=_0x62352;_0x1a6816=0xc8;}else{_0x1a6816=0xce;}_0x26186f[_0xf106('0x1e')](_0x1a6816);return _0x26186f[_0xf106('0x1f')](_0xf106('0x20'),_0x5d02c0+'-'+_0x726d7c+'/'+_0x62352)[_0xf106('0x19')](_0x48bfdd);}return null;};}function patchUpdates(_0x29ae70){return function(_0x232a54){try{jsonpatch[_0xf106('0x21')](_0x232a54,_0x29ae70,!![]);}catch(_0x4a9564){return BPromise['reject'](_0x4a9564);}return _0x232a54[_0xf106('0x22')]();};}function saveUpdates(_0x59abbc,_0x32ab30){return function(_0x3c729e){if(_0x3c729e){return _0x3c729e[_0xf106('0x23')](_0x59abbc)[_0xf106('0x24')](function(_0x450451){return _0x450451;});}return null;};}function removeEntity(_0x4f673f,_0x58febd){return function(_0x178890){if(_0x178890){return _0x178890[_0xf106('0x25')]()[_0xf106('0x24')](function(){_0x4f673f[_0xf106('0x1e')](0xcc)[_0xf106('0x26')]();});}};}function handleEntityNotFound(_0xf7de89,_0x9f99bb){return function(_0x118726){if(!_0x118726){_0xf7de89[_0xf106('0x18')](0x194);}return _0x118726;};}function handleError(_0x14b15e,_0x468fce){_0x468fce=_0x468fce||0x1f4;return function(_0x225c15){logger['error'](_0x225c15['stack']);if(_0x225c15['name']){delete _0x225c15[_0xf106('0x27')];}_0x14b15e[_0xf106('0x1e')](_0x468fce)[_0xf106('0x28')](_0x225c15);};}exports[_0xf106('0x29')]=function(_0x4265b3,_0x13b5d7){var _0x4f90d1={},_0x1394e8={},_0x269bff={'count':0x0,'rows':[]};var _0x1f8323=_[_0xf106('0x2a')](db['Cdr'][_0xf106('0x2b')],function(_0x444bde){return{'name':_0x444bde[_0xf106('0x2c')],'type':_0x444bde[_0xf106('0x2d')][_0xf106('0x2e')]};});_0x1394e8[_0xf106('0x2f')]=_['map'](_0x1f8323,_0xf106('0x27'));_0x1394e8[_0xf106('0x30')]=_[_0xf106('0x31')](_0x4265b3[_0xf106('0x30')]);_0x1394e8['filters']=_[_0xf106('0x32')](_0x1394e8[_0xf106('0x2f')],_0x1394e8['query']);_0x4f90d1[_0xf106('0x33')]=_[_0xf106('0x32')](_0x1394e8[_0xf106('0x2f')],qs[_0xf106('0x34')](_0x4265b3[_0xf106('0x30')][_0xf106('0x34')]));_0x4f90d1[_0xf106('0x33')]=_0x4f90d1[_0xf106('0x33')][_0xf106('0x35')]?_0x4f90d1[_0xf106('0x33')]:_0x1394e8[_0xf106('0x2f')];if(!_0x4265b3['query']['hasOwnProperty'](_0xf106('0x36'))){_0x4f90d1[_0xf106('0x1b')]=qs[_0xf106('0x1b')](_0x4265b3['query'][_0xf106('0x1b')]);_0x4f90d1[_0xf106('0x1a')]=qs[_0xf106('0x1a')](_0x4265b3[_0xf106('0x30')][_0xf106('0x1a')]);}_0x4f90d1['order']=qs[_0xf106('0x37')](_0x4265b3['query'][_0xf106('0x37')]);_0x4f90d1[_0xf106('0x38')]=qs[_0xf106('0x39')](_[_0xf106('0x3a')](_0x4265b3['query'],_0x1394e8[_0xf106('0x39')]),_0x1f8323);if(_0x4265b3[_0xf106('0x30')][_0xf106('0x3b')]){_0x4f90d1['where']=_['merge'](_0x4f90d1['where'],{'$or':_['map'](_0x1f8323,function(_0x58dba7){if(_0x58dba7[_0xf106('0x2d')]!=='VIRTUAL'){var _0x4beb79={};_0x4beb79[_0x58dba7[_0xf106('0x27')]]={'$like':'%'+_0x4265b3['query']['filter']+'%'};return _0x4beb79;}})});}_0x4f90d1=_[_0xf106('0x3c')]({},_0x4f90d1,_0x4265b3[_0xf106('0x3d')]);var _0x2d4c90={'where':_0x4f90d1[_0xf106('0x38')]};return db['Cdr'][_0xf106('0x1d')](_0x2d4c90)[_0xf106('0x24')](function(_0x583a72){_0x269bff[_0xf106('0x1d')]=_0x583a72;if(_0x4265b3[_0xf106('0x30')][_0xf106('0x3e')]){_0x4f90d1[_0xf106('0x3f')]=[{'all':!![]}];}return db[_0xf106('0x40')][_0xf106('0x41')](_0x4f90d1);})[_0xf106('0x24')](function(_0x57d61e){_0x269bff['rows']=_0x57d61e;return _0x269bff;})[_0xf106('0x24')](respondWithFilteredResult(_0x13b5d7,_0x4f90d1))['catch'](handleError(_0x13b5d7,null));};exports['show']=function(_0x37bb28,_0x390eee){var _0x5e6cb8={'raw':!![],'where':{'id':_0x37bb28[_0xf106('0x42')]['id']}},_0x47f4d3={};_0x47f4d3['model']=_[_0xf106('0x31')](db[_0xf106('0x40')][_0xf106('0x2b')]);_0x47f4d3[_0xf106('0x30')]=_[_0xf106('0x31')](_0x37bb28[_0xf106('0x30')]);_0x47f4d3[_0xf106('0x39')]=_[_0xf106('0x32')](_0x47f4d3[_0xf106('0x2f')],_0x47f4d3[_0xf106('0x30')]);_0x5e6cb8[_0xf106('0x33')]=_[_0xf106('0x32')](_0x47f4d3[_0xf106('0x2f')],qs[_0xf106('0x34')](_0x37bb28[_0xf106('0x30')][_0xf106('0x34')]));_0x5e6cb8[_0xf106('0x33')]=_0x5e6cb8[_0xf106('0x33')]['length']?_0x5e6cb8[_0xf106('0x33')]:_0x47f4d3[_0xf106('0x2f')];if(_0x37bb28[_0xf106('0x30')][_0xf106('0x3e')]){_0x5e6cb8[_0xf106('0x3f')]=[{'all':!![]}];}_0x5e6cb8=_['merge']({},_0x5e6cb8,_0x37bb28['options']);return db['Cdr']['find'](_0x5e6cb8)[_0xf106('0x24')](handleEntityNotFound(_0x390eee,null))['then'](respondWithResult(_0x390eee,null))['catch'](handleError(_0x390eee,null));};exports[_0xf106('0x43')]=function(_0x1a686d,_0xd50443){return db[_0xf106('0x40')]['create'](_0x1a686d[_0xf106('0x44')],{})[_0xf106('0x24')](respondWithResult(_0xd50443,0xc9))[_0xf106('0x45')](handleError(_0xd50443,null));};exports[_0xf106('0x23')]=function(_0x1bf065,_0x519192){if(_0x1bf065['body']['id']){delete _0x1bf065[_0xf106('0x44')]['id'];}return db[_0xf106('0x40')][_0xf106('0x46')]({'where':{'id':_0x1bf065['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x519192,null))[_0xf106('0x24')](saveUpdates(_0x1bf065[_0xf106('0x44')],null))[_0xf106('0x24')](respondWithResult(_0x519192,null))['catch'](handleError(_0x519192,null));};exports[_0xf106('0x25')]=function(_0x5b80a8,_0x50798d){return db[_0xf106('0x40')][_0xf106('0x46')]({'where':{'id':_0x5b80a8['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x50798d,null))[_0xf106('0x24')](removeEntity(_0x50798d,null))[_0xf106('0x45')](handleError(_0x50798d,null));};exports[_0xf106('0x47')]=function(_0x14375d,_0x391e3d){return db['Cdr']['describe']()[_0xf106('0x24')](respondWithResult(_0x391e3d,null))['catch'](handleError(_0x391e3d,null));}; \ No newline at end of file +var _0x8ce1=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','send','index','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x8ce1,0x183));var _0x18ce=function(_0x489c86,_0x3b80e5){_0x489c86=_0x489c86-0x0;var _0x4ee191=_0x8ce1[_0x489c86];return _0x4ee191;};'use strict';var emlformat=require(_0x18ce('0x0'));var rimraf=require(_0x18ce('0x1'));var zipdir=require(_0x18ce('0x2'));var jsonpatch=require(_0x18ce('0x3'));var rp=require(_0x18ce('0x4'));var moment=require(_0x18ce('0x5'));var BPromise=require(_0x18ce('0x6'));var Mustache=require(_0x18ce('0x7'));var util=require(_0x18ce('0x8'));var path=require(_0x18ce('0x9'));var sox=require(_0x18ce('0xa'));var csv=require(_0x18ce('0xb'));var ejs=require(_0x18ce('0xc'));var fs=require('fs');var fs_extra=require(_0x18ce('0xd'));var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xb'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var licenseUtil=require(_0x18ce('0x1a'));var db=require(_0x18ce('0x1b'))['db'];function respondWithStatusCode(_0x5e8c23,_0xbd514b){_0xbd514b=_0xbd514b||0xcc;return function(_0x402ba4){if(_0x402ba4){return _0x5e8c23[_0x18ce('0x1c')](_0xbd514b);}return _0x5e8c23[_0x18ce('0x1d')](_0xbd514b)[_0x18ce('0x1e')]();};}function respondWithResult(_0x5daf04,_0x176797){_0x176797=_0x176797||0xc8;return function(_0xdd4626){if(_0xdd4626){return _0x5daf04[_0x18ce('0x1d')](_0x176797)[_0x18ce('0x1f')](_0xdd4626);}};}function respondWithFilteredResult(_0x46e346,_0x36b5da){return function(_0x17460e){if(_0x17460e){var _0x4a934f=typeof _0x36b5da[_0x18ce('0x20')]===_0x18ce('0x21')&&typeof _0x36b5da[_0x18ce('0x22')]===_0x18ce('0x21');var _0x1edc10=_0x17460e[_0x18ce('0x23')];var _0x482458=_0x4a934f?0x0:_0x36b5da[_0x18ce('0x20')];var _0x29c691=_0x4a934f?_0x17460e[_0x18ce('0x23')]:_0x36b5da['offset']+_0x36b5da[_0x18ce('0x22')];var _0x2fa3d4;if(_0x29c691>=_0x1edc10){_0x29c691=_0x1edc10;_0x2fa3d4=0xc8;}else{_0x2fa3d4=0xce;}_0x46e346[_0x18ce('0x1d')](_0x2fa3d4);return _0x46e346['set'](_0x18ce('0x24'),_0x482458+'-'+_0x29c691+'/'+_0x1edc10)[_0x18ce('0x1f')](_0x17460e);}return null;};}function patchUpdates(_0x5d22cd){return function(_0x29c1ab){try{jsonpatch[_0x18ce('0x25')](_0x29c1ab,_0x5d22cd,!![]);}catch(_0x16802e){return BPromise[_0x18ce('0x26')](_0x16802e);}return _0x29c1ab[_0x18ce('0x27')]();};}function saveUpdates(_0xd41f29,_0x35abf9){return function(_0x545459){if(_0x545459){return _0x545459[_0x18ce('0x28')](_0xd41f29)['then'](function(_0x482c90){return _0x482c90;});}return null;};}function removeEntity(_0x5d2299,_0x32e910){return function(_0x576ecc){if(_0x576ecc){return _0x576ecc[_0x18ce('0x29')]()[_0x18ce('0x2a')](function(){_0x5d2299[_0x18ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53abbd,_0x55e17c){return function(_0x317812){if(!_0x317812){_0x53abbd[_0x18ce('0x1c')](0x194);}return _0x317812;};}function handleError(_0x12dbd2,_0x461113){_0x461113=_0x461113||0x1f4;return function(_0x62b2bd){logger[_0x18ce('0x2b')](_0x62b2bd['stack']);if(_0x62b2bd['name']){delete _0x62b2bd['name'];}_0x12dbd2[_0x18ce('0x1d')](_0x461113)[_0x18ce('0x2c')](_0x62b2bd);};}exports[_0x18ce('0x2d')]=function(_0x5f3ec2,_0x1a87f6){var _0xf2683f={},_0x1988e4={},_0x5ef96c={'count':0x0,'rows':[]};var _0x56d296=_['map'](db[_0x18ce('0x2e')][_0x18ce('0x2f')],function(_0x5c2d96){return{'name':_0x5c2d96['fieldName'],'type':_0x5c2d96[_0x18ce('0x30')][_0x18ce('0x31')]};});_0x1988e4[_0x18ce('0x32')]=_['map'](_0x56d296,'name');_0x1988e4[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x5f3ec2[_0x18ce('0x33')]);_0x1988e4[_0x18ce('0x35')]=_[_0x18ce('0x36')](_0x1988e4[_0x18ce('0x32')],_0x1988e4[_0x18ce('0x33')]);_0xf2683f[_0x18ce('0x37')]=_['intersection'](_0x1988e4['model'],qs[_0x18ce('0x38')](_0x5f3ec2[_0x18ce('0x33')]['fields']));_0xf2683f[_0x18ce('0x37')]=_0xf2683f['attributes'][_0x18ce('0x39')]?_0xf2683f['attributes']:_0x1988e4[_0x18ce('0x32')];if(!_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3a')]('nolimit')){_0xf2683f['limit']=qs[_0x18ce('0x22')](_0x5f3ec2[_0x18ce('0x33')]['limit']);_0xf2683f['offset']=qs[_0x18ce('0x20')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x20')]);}_0xf2683f[_0x18ce('0x3b')]=qs[_0x18ce('0x3c')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3c')]);_0xf2683f[_0x18ce('0x3d')]=qs[_0x18ce('0x35')](_[_0x18ce('0x3e')](_0x5f3ec2[_0x18ce('0x33')],_0x1988e4[_0x18ce('0x35')]),_0x56d296);if(_0x5f3ec2[_0x18ce('0x33')]['filter']){_0xf2683f[_0x18ce('0x3d')]=_[_0x18ce('0x3f')](_0xf2683f[_0x18ce('0x3d')],{'$or':_[_0x18ce('0x40')](_0x56d296,function(_0x1e67dd){if(_0x1e67dd[_0x18ce('0x30')]!==_0x18ce('0x41')){var _0x27c55a={};_0x27c55a[_0x1e67dd[_0x18ce('0x42')]]={'$like':'%'+_0x5f3ec2[_0x18ce('0x33')]['filter']+'%'};return _0x27c55a;}})});}_0xf2683f=_['merge']({},_0xf2683f,_0x5f3ec2[_0x18ce('0x43')]);var _0x23486c={'where':_0xf2683f[_0x18ce('0x3d')]};return db[_0x18ce('0x2e')][_0x18ce('0x23')](_0x23486c)[_0x18ce('0x2a')](function(_0x2eba88){_0x5ef96c['count']=_0x2eba88;if(_0x5f3ec2['query'][_0x18ce('0x44')]){_0xf2683f[_0x18ce('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x18ce('0x46')](_0xf2683f);})[_0x18ce('0x2a')](function(_0x2941ce){_0x5ef96c[_0x18ce('0x47')]=_0x2941ce;return _0x5ef96c;})[_0x18ce('0x2a')](respondWithFilteredResult(_0x1a87f6,_0xf2683f))[_0x18ce('0x48')](handleError(_0x1a87f6,null));};exports[_0x18ce('0x49')]=function(_0x2a96a7,_0x33b409){var _0x1d6d5f={'raw':!![],'where':{'id':_0x2a96a7[_0x18ce('0x4a')]['id']}},_0x3885e6={};_0x3885e6['model']=_[_0x18ce('0x34')](db[_0x18ce('0x2e')][_0x18ce('0x2f')]);_0x3885e6[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x2a96a7[_0x18ce('0x33')]);_0x3885e6[_0x18ce('0x35')]=_['intersection'](_0x3885e6['model'],_0x3885e6[_0x18ce('0x33')]);_0x1d6d5f[_0x18ce('0x37')]=_[_0x18ce('0x36')](_0x3885e6[_0x18ce('0x32')],qs['fields'](_0x2a96a7[_0x18ce('0x33')][_0x18ce('0x38')]));_0x1d6d5f[_0x18ce('0x37')]=_0x1d6d5f['attributes']['length']?_0x1d6d5f[_0x18ce('0x37')]:_0x3885e6[_0x18ce('0x32')];if(_0x2a96a7['query'][_0x18ce('0x44')]){_0x1d6d5f[_0x18ce('0x45')]=[{'all':!![]}];}_0x1d6d5f=_[_0x18ce('0x3f')]({},_0x1d6d5f,_0x2a96a7[_0x18ce('0x43')]);return db[_0x18ce('0x2e')][_0x18ce('0x4b')](_0x1d6d5f)[_0x18ce('0x2a')](handleEntityNotFound(_0x33b409,null))['then'](respondWithResult(_0x33b409,null))[_0x18ce('0x48')](handleError(_0x33b409,null));};exports[_0x18ce('0x4c')]=function(_0x476c6a,_0x1e445d){return db[_0x18ce('0x2e')][_0x18ce('0x4c')](_0x476c6a[_0x18ce('0x4d')],{})[_0x18ce('0x2a')](respondWithResult(_0x1e445d,0xc9))[_0x18ce('0x48')](handleError(_0x1e445d,null));};exports[_0x18ce('0x28')]=function(_0x1211d0,_0x3f9960){if(_0x1211d0[_0x18ce('0x4d')]['id']){delete _0x1211d0[_0x18ce('0x4d')]['id'];}return db['Cdr'][_0x18ce('0x4b')]({'where':{'id':_0x1211d0[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f9960,null))[_0x18ce('0x2a')](saveUpdates(_0x1211d0['body'],null))[_0x18ce('0x2a')](respondWithResult(_0x3f9960,null))['catch'](handleError(_0x3f9960,null));};exports[_0x18ce('0x29')]=function(_0x188f57,_0x3d5b1b){return db[_0x18ce('0x2e')]['find']({'where':{'id':_0x188f57[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d5b1b,null))['then'](removeEntity(_0x3d5b1b,null))[_0x18ce('0x48')](handleError(_0x3d5b1b,null));};exports[_0x18ce('0x4e')]=function(_0x8aa4a7,_0x5f164a){return db['Cdr'][_0x18ce('0x4e')]()[_0x18ce('0x2a')](respondWithResult(_0x5f164a,null))[_0x18ce('0x48')](handleError(_0x5f164a,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c5e9962..f194d4a 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(_0x4db898,_0x53c18a){var _0x284228=function(_0x58cb2d){while(--_0x58cb2d){_0x4db898['push'](_0x4db898['shift']());}};_0x284228(++_0x53c18a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x4a7f34,_0x246929){var _0x5b0d32=function(_0x4ae36d){while(--_0x4ae36d){_0x4a7f34['push'](_0x4a7f34['shift']());}};_0x5b0d32(++_0x246929);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index dc24662..0c886d4 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 _0xdd13=['lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x141972,_0x452e0a){var _0x3c80ba=function(_0x533e4e){while(--_0x533e4e){_0x141972['push'](_0x141972['shift']());}};_0x3c80ba(++_0x452e0a);}(_0xdd13,0x1b8));var _0x3dd1=function(_0x39164c,_0x31fa4c){_0x39164c=_0x39164c-0x0;var _0x2f7164=_0xdd13[_0x39164c];return _0x2f7164;};'use strict';var _=require(_0x3dd1('0x0'));var util=require(_0x3dd1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3dd1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dd1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dd1('0x4'))(_0x3dd1('0x5'));var config=require(_0x3dd1('0x6'));var jayson=require(_0x3dd1('0x7'));var client=jayson[_0x3dd1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x966bcf,_0x255304,_0xba331d){return new BPromise(function(_0x502423,_0xa2ced3){return client['request'](_0x966bcf,_0xba331d)[_0x3dd1('0x9')](function(_0x59ed43){logger[_0x3dd1('0xa')](_0x3dd1('0xb'),_0x255304,'request\x20sent');logger[_0x3dd1('0xc')](_0x3dd1('0xd'),_0x255304,_0x3dd1('0xe'),JSON[_0x3dd1('0xf')](_0x59ed43));if(_0x59ed43[_0x3dd1('0x10')]){if(_0x59ed43[_0x3dd1('0x10')][_0x3dd1('0x11')]===0x1f4){logger[_0x3dd1('0x10')](_0x3dd1('0xb'),_0x255304,_0x59ed43[_0x3dd1('0x10')][_0x3dd1('0x12')]);return _0xa2ced3(_0x59ed43[_0x3dd1('0x10')][_0x3dd1('0x12')]);}logger[_0x3dd1('0x10')](_0x3dd1('0xb'),_0x255304,_0x59ed43['error'][_0x3dd1('0x12')]);return _0x502423(_0x59ed43[_0x3dd1('0x10')][_0x3dd1('0x12')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x255304,_0x3dd1('0xe'));_0x502423(_0x59ed43['result'][_0x3dd1('0x12')]);}})[_0x3dd1('0x13')](function(_0x1eddf1){logger[_0x3dd1('0x10')](_0x3dd1('0xb'),_0x255304,_0x1eddf1);_0xa2ced3(_0x1eddf1);});});} \ No newline at end of file +var _0xee51=['debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x1964eb,_0x5bb316){var _0x2c74c3=function(_0x55e8e6){while(--_0x55e8e6){_0x1964eb['push'](_0x1964eb['shift']());}};_0x2c74c3(++_0x5bb316);}(_0xee51,0x16e));var _0x1ee5=function(_0x2867a6,_0x10d905){_0x2867a6=_0x2867a6-0x0;var _0x4afc2b=_0xee51[_0x2867a6];return _0x4afc2b;};'use strict';var _=require(_0x1ee5('0x0'));var util=require(_0x1ee5('0x1'));var moment=require(_0x1ee5('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ee5('0x3'));var fs=require('fs');var Redis=require(_0x1ee5('0x4'));var db=require(_0x1ee5('0x5'))['db'];var utils=require(_0x1ee5('0x6'));var logger=require(_0x1ee5('0x7'))('rpc');var config=require(_0x1ee5('0x8'));var jayson=require(_0x1ee5('0x9'));var client=jayson[_0x1ee5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58d3a1,_0x5c4a7d,_0x4564da){return new BPromise(function(_0x50709b,_0x413dcd){return client[_0x1ee5('0xb')](_0x58d3a1,_0x4564da)['then'](function(_0x413c96){logger['info'](_0x1ee5('0xc'),_0x5c4a7d,_0x1ee5('0xd'));logger[_0x1ee5('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5c4a7d,_0x1ee5('0xd'),JSON[_0x1ee5('0xf')](_0x413c96));if(_0x413c96[_0x1ee5('0x10')]){if(_0x413c96['error'][_0x1ee5('0x11')]===0x1f4){logger[_0x1ee5('0x10')](_0x1ee5('0xc'),_0x5c4a7d,_0x413c96[_0x1ee5('0x10')][_0x1ee5('0x12')]);return _0x413dcd(_0x413c96[_0x1ee5('0x10')]['message']);}logger[_0x1ee5('0x10')](_0x1ee5('0xc'),_0x5c4a7d,_0x413c96['error'][_0x1ee5('0x12')]);return _0x50709b(_0x413c96[_0x1ee5('0x10')]['message']);}else{logger['info'](_0x1ee5('0xc'),_0x5c4a7d,_0x1ee5('0xd'));_0x50709b(_0x413c96[_0x1ee5('0x13')][_0x1ee5('0x12')]);}})['catch'](function(_0x26a781){logger[_0x1ee5('0x10')]('Cdr,\x20%s,\x20%s',_0x5c4a7d,_0x26a781);_0x413dcd(_0x26a781);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f7f2ee2..3879ae0 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 _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(_0x24f2f5,_0xcb7905){var _0x39eef8=function(_0x23eb5f){while(--_0x23eb5f){_0x24f2f5['push'](_0x24f2f5['shift']());}};_0x39eef8(++_0xcb7905);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a350c,_0x2760a1){_0x4a350c=_0x4a350c-0x0;var _0x51bb79=_0xb10b[_0x4a350c];return _0x51bb79;};'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 +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(_0x40c5e0,_0x3b77ad){var _0x47ee12=function(_0x3c7009){while(--_0x3c7009){_0x40c5e0['push'](_0x40c5e0['shift']());}};_0x47ee12(++_0x3b77ad);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 3bfb903..b1b36c1 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 _0xb884=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x57a326,_0x590f66){var _0x36b730=function(_0x27a7bf){while(--_0x27a7bf){_0x57a326['push'](_0x57a326['shift']());}};_0x36b730(++_0x590f66);}(_0xb884,0x88));var _0x4b88=function(_0x1c2e29,_0x3ad48a){_0x1c2e29=_0x1c2e29-0x0;var _0x39174d=_0xb884[_0x1c2e29];return _0x39174d;};'use strict';var Sequelize=require(_0x4b88('0x0'));module[_0x4b88('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b88('0x2')},'appdata':{'type':Sequelize[_0x4b88('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4b88('0x4')],'defaultValue':_0x4b88('0x5')}}; \ No newline at end of file +var _0x1790=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x48d7a0,_0x1e2ba8){var _0x28a502=function(_0x3dc381){while(--_0x3dc381){_0x48d7a0['push'](_0x48d7a0['shift']());}};_0x28a502(++_0x1e2ba8);}(_0x1790,0x1a4));var _0x0179=function(_0x522279,_0x385259){_0x522279=_0x522279-0x0;var _0x477f7c=_0x1790[_0x522279];return _0x477f7c;};'use strict';var Sequelize=require('sequelize');module[_0x0179('0x0')]={'priority':{'type':Sequelize[_0x0179('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0179('0x2')],'allowNull':![],'defaultValue':_0x0179('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0179('0x2')],'defaultValue':_0x0179('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b5d54cf..2181d21 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 _0xb74d=['../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','length','include','merge','options','find','then','catch','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x27d640,_0x1a5f12){var _0x3c7a85=function(_0x51ce72){while(--_0x51ce72){_0x27d640['push'](_0x27d640['shift']());}};_0x3c7a85(++_0x1a5f12);}(_0xb74d,0x16e));var _0xdb74=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xb74d[_0x4063a4];return _0x17908d;};'use strict';var emlformat=require(_0xdb74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb74('0x2'));var moment=require('moment');var BPromise=require(_0xdb74('0x3'));var Mustache=require(_0xdb74('0x4'));var util=require(_0xdb74('0x5'));var path=require('path');var sox=require(_0xdb74('0x6'));var csv=require(_0xdb74('0x7'));var ejs=require(_0xdb74('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdb74('0x9'));var crypto=require('crypto');var jsforce=require(_0xdb74('0xa'));var deskjs=require(_0xdb74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdb74('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb74('0xd'));var authService=require(_0xdb74('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdb74('0xf'));var hardwareService=require(_0xdb74('0x10'));var logger=require(_0xdb74('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xdb74('0x12'));var licenseUtil=require(_0xdb74('0x13'));var db=require(_0xdb74('0x14'))['db'];function respondWithStatusCode(_0x31b9ad,_0xa88c98){_0xa88c98=_0xa88c98||0xcc;return function(_0x2e44a4){if(_0x2e44a4){return _0x31b9ad[_0xdb74('0x15')](_0xa88c98);}return _0x31b9ad[_0xdb74('0x16')](_0xa88c98)[_0xdb74('0x17')]();};}function respondWithResult(_0xad1802,_0x3cc3ba){_0x3cc3ba=_0x3cc3ba||0xc8;return function(_0x3cbbc5){if(_0x3cbbc5){return _0xad1802[_0xdb74('0x16')](_0x3cc3ba)['json'](_0x3cbbc5);}};}function respondWithFilteredResult(_0x3e8f63,_0x3d9d7a){return function(_0x23f848){if(_0x23f848){var _0x206b4d=typeof _0x3d9d7a['offset']==='undefined'&&typeof _0x3d9d7a[_0xdb74('0x18')]===_0xdb74('0x19');var _0x507d2f=_0x23f848[_0xdb74('0x1a')];var _0xe0fb05=_0x206b4d?0x0:_0x3d9d7a[_0xdb74('0x1b')];var _0x15184f=_0x206b4d?_0x23f848['count']:_0x3d9d7a[_0xdb74('0x1b')]+_0x3d9d7a[_0xdb74('0x18')];var _0x4367c7;if(_0x15184f>=_0x507d2f){_0x15184f=_0x507d2f;_0x4367c7=0xc8;}else{_0x4367c7=0xce;}_0x3e8f63['status'](_0x4367c7);return _0x3e8f63['set'](_0xdb74('0x1c'),_0xe0fb05+'-'+_0x15184f+'/'+_0x507d2f)['json'](_0x23f848);}return null;};}function patchUpdates(_0x2be7a7){return function(_0x17a268){try{jsonpatch[_0xdb74('0x1d')](_0x17a268,_0x2be7a7,!![]);}catch(_0x4484f2){return BPromise['reject'](_0x4484f2);}return _0x17a268[_0xdb74('0x1e')]();};}function saveUpdates(_0x305724,_0x29d840){return function(_0x22e5d4){if(_0x22e5d4){return _0x22e5d4[_0xdb74('0x1f')](_0x305724)['then'](function(_0x119434){return _0x119434;});}return null;};}function removeEntity(_0x4ff7a2,_0x3d9d1d){return function(_0x3fef84){if(_0x3fef84){return _0x3fef84[_0xdb74('0x20')]()['then'](function(){_0x4ff7a2[_0xdb74('0x16')](0xcc)[_0xdb74('0x17')]();});}};}function handleEntityNotFound(_0x429cee,_0x7fffbf){return function(_0x2d0049){if(!_0x2d0049){_0x429cee[_0xdb74('0x15')](0x194);}return _0x2d0049;};}function handleError(_0x2c908e,_0x40bcb2){_0x40bcb2=_0x40bcb2||0x1f4;return function(_0x9d8021){logger[_0xdb74('0x21')](_0x9d8021[_0xdb74('0x22')]);if(_0x9d8021['name']){delete _0x9d8021[_0xdb74('0x23')];}_0x2c908e[_0xdb74('0x16')](_0x40bcb2)[_0xdb74('0x24')](_0x9d8021);};}exports[_0xdb74('0x25')]=function(_0x1eea24,_0x3c1b45){var _0xd98810={'raw':!![],'where':{'id':_0x1eea24[_0xdb74('0x26')]['id']}},_0x2025c8={};_0x2025c8[_0xdb74('0x27')]=_['keys'](db[_0xdb74('0x28')][_0xdb74('0x29')]);_0x2025c8[_0xdb74('0x2a')]=_[_0xdb74('0x2b')](_0x1eea24[_0xdb74('0x2a')]);_0x2025c8['filters']=_[_0xdb74('0x2c')](_0x2025c8[_0xdb74('0x27')],_0x2025c8[_0xdb74('0x2a')]);_0xd98810[_0xdb74('0x2d')]=_['intersection'](_0x2025c8[_0xdb74('0x27')],qs['fields'](_0x1eea24['query'][_0xdb74('0x2e')]));_0xd98810[_0xdb74('0x2d')]=_0xd98810[_0xdb74('0x2d')][_0xdb74('0x2f')]?_0xd98810['attributes']:_0x2025c8[_0xdb74('0x27')];if(_0x1eea24[_0xdb74('0x2a')]['includeAll']){_0xd98810[_0xdb74('0x30')]=[{'all':!![]}];}_0xd98810=_[_0xdb74('0x31')]({},_0xd98810,_0x1eea24[_0xdb74('0x32')]);return db[_0xdb74('0x28')][_0xdb74('0x33')](_0xd98810)[_0xdb74('0x34')](handleEntityNotFound(_0x3c1b45,null))[_0xdb74('0x34')](respondWithResult(_0x3c1b45,null))[_0xdb74('0x35')](handleError(_0x3c1b45,null));};exports[_0xdb74('0x1f')]=function(_0x27c0a5,_0x360939){if(_0x27c0a5[_0xdb74('0x36')]['id']){delete _0x27c0a5[_0xdb74('0x36')]['id'];}return db['ChatApplication'][_0xdb74('0x33')]({'where':{'id':_0x27c0a5[_0xdb74('0x26')]['id']}})[_0xdb74('0x34')](handleEntityNotFound(_0x360939,null))[_0xdb74('0x34')](saveUpdates(_0x27c0a5[_0xdb74('0x36')],null))[_0xdb74('0x34')](respondWithResult(_0x360939,null))[_0xdb74('0x35')](handleError(_0x360939,null));};exports[_0xdb74('0x20')]=function(_0x1e5a32,_0x52d5e1){return db[_0xdb74('0x28')]['find']({'where':{'id':_0x1e5a32[_0xdb74('0x26')]['id']}})['then'](handleEntityNotFound(_0x52d5e1,null))[_0xdb74('0x34')](removeEntity(_0x52d5e1,null))[_0xdb74('0x35')](handleError(_0x52d5e1,null));}; \ No newline at end of file +var _0x85b5=['attributes','fields','length','includeAll','merge','options','ChatApplication','find','catch','update','body','params','destroy','eml-format','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','sendStatus','error','stack','name','show','model','keys','rawAttributes','query','filters','intersection'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x85b5,0x7f));var _0x585b=function(_0x190f8e,_0x4919b9){_0x190f8e=_0x190f8e-0x0;var _0x11819f=_0x85b5[_0x190f8e];return _0x11819f;};'use strict';var emlformat=require(_0x585b('0x0'));var rimraf=require(_0x585b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x585b('0x2'));var rp=require('request-promise');var moment=require(_0x585b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x585b('0x4'));var path=require('path');var sox=require(_0x585b('0x5'));var csv=require(_0x585b('0x6'));var ejs=require(_0x585b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x585b('0x8'));var squel=require('squel');var crypto=require(_0x585b('0x9'));var jsforce=require(_0x585b('0xa'));var deskjs=require(_0x585b('0xb'));var toCsv=require(_0x585b('0x6'));var querystring=require('querystring');var Papa=require(_0x585b('0xc'));var Redis=require(_0x585b('0xd'));var authService=require(_0x585b('0xe'));var qs=require(_0x585b('0xf'));var as=require(_0x585b('0x10'));var hardwareService=require(_0x585b('0x11'));var logger=require(_0x585b('0x12'))('api');var utils=require(_0x585b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x585b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16d608,_0x35bda0){_0x35bda0=_0x35bda0||0xcc;return function(_0x19336c){if(_0x19336c){return _0x16d608['sendStatus'](_0x35bda0);}return _0x16d608[_0x585b('0x15')](_0x35bda0)[_0x585b('0x16')]();};}function respondWithResult(_0x3d15ed,_0x299ee4){_0x299ee4=_0x299ee4||0xc8;return function(_0x3dcc28){if(_0x3dcc28){return _0x3d15ed[_0x585b('0x15')](_0x299ee4)[_0x585b('0x17')](_0x3dcc28);}};}function respondWithFilteredResult(_0x5ebc1a,_0x2f827f){return function(_0x41f50d){if(_0x41f50d){var _0x4c094e=typeof _0x2f827f['offset']===_0x585b('0x18')&&typeof _0x2f827f['limit']==='undefined';var _0x2f840e=_0x41f50d[_0x585b('0x19')];var _0x20c4ba=_0x4c094e?0x0:_0x2f827f['offset'];var _0x72fdc4=_0x4c094e?_0x41f50d[_0x585b('0x19')]:_0x2f827f[_0x585b('0x1a')]+_0x2f827f[_0x585b('0x1b')];var _0x562886;if(_0x72fdc4>=_0x2f840e){_0x72fdc4=_0x2f840e;_0x562886=0xc8;}else{_0x562886=0xce;}_0x5ebc1a[_0x585b('0x15')](_0x562886);return _0x5ebc1a[_0x585b('0x1c')](_0x585b('0x1d'),_0x20c4ba+'-'+_0x72fdc4+'/'+_0x2f840e)['json'](_0x41f50d);}return null;};}function patchUpdates(_0x5200ec){return function(_0x6bea29){try{jsonpatch['apply'](_0x6bea29,_0x5200ec,!![]);}catch(_0x484157){return BPromise[_0x585b('0x1e')](_0x484157);}return _0x6bea29[_0x585b('0x1f')]();};}function saveUpdates(_0x48d9f8,_0x183308){return function(_0x272a8d){if(_0x272a8d){return _0x272a8d['update'](_0x48d9f8)[_0x585b('0x20')](function(_0xe50751){return _0xe50751;});}return null;};}function removeEntity(_0x2122e0,_0x5bf9e4){return function(_0x1c8a7b){if(_0x1c8a7b){return _0x1c8a7b['destroy']()[_0x585b('0x20')](function(){_0x2122e0[_0x585b('0x15')](0xcc)[_0x585b('0x16')]();});}};}function handleEntityNotFound(_0x428a9a,_0x1b06a2){return function(_0x1b1241){if(!_0x1b1241){_0x428a9a[_0x585b('0x21')](0x194);}return _0x1b1241;};}function handleError(_0x799947,_0x100189){_0x100189=_0x100189||0x1f4;return function(_0x47099f){logger[_0x585b('0x22')](_0x47099f[_0x585b('0x23')]);if(_0x47099f[_0x585b('0x24')]){delete _0x47099f[_0x585b('0x24')];}_0x799947[_0x585b('0x15')](_0x100189)['send'](_0x47099f);};}exports[_0x585b('0x25')]=function(_0x205ffe,_0x19786){var _0x2cf48a={'raw':!![],'where':{'id':_0x205ffe['params']['id']}},_0x5dad9a={};_0x5dad9a[_0x585b('0x26')]=_[_0x585b('0x27')](db['ChatApplication'][_0x585b('0x28')]);_0x5dad9a[_0x585b('0x29')]=_['keys'](_0x205ffe[_0x585b('0x29')]);_0x5dad9a[_0x585b('0x2a')]=_[_0x585b('0x2b')](_0x5dad9a[_0x585b('0x26')],_0x5dad9a[_0x585b('0x29')]);_0x2cf48a[_0x585b('0x2c')]=_[_0x585b('0x2b')](_0x5dad9a[_0x585b('0x26')],qs[_0x585b('0x2d')](_0x205ffe[_0x585b('0x29')]['fields']));_0x2cf48a[_0x585b('0x2c')]=_0x2cf48a[_0x585b('0x2c')][_0x585b('0x2e')]?_0x2cf48a['attributes']:_0x5dad9a[_0x585b('0x26')];if(_0x205ffe[_0x585b('0x29')][_0x585b('0x2f')]){_0x2cf48a['include']=[{'all':!![]}];}_0x2cf48a=_[_0x585b('0x30')]({},_0x2cf48a,_0x205ffe[_0x585b('0x31')]);return db[_0x585b('0x32')][_0x585b('0x33')](_0x2cf48a)['then'](handleEntityNotFound(_0x19786,null))['then'](respondWithResult(_0x19786,null))[_0x585b('0x34')](handleError(_0x19786,null));};exports[_0x585b('0x35')]=function(_0x411914,_0x31918f){if(_0x411914[_0x585b('0x36')]['id']){delete _0x411914['body']['id'];}return db[_0x585b('0x32')][_0x585b('0x33')]({'where':{'id':_0x411914[_0x585b('0x37')]['id']}})[_0x585b('0x20')](handleEntityNotFound(_0x31918f,null))[_0x585b('0x20')](saveUpdates(_0x411914['body'],null))['then'](respondWithResult(_0x31918f,null))['catch'](handleError(_0x31918f,null));};exports[_0x585b('0x38')]=function(_0x199e54,_0x2c4b9f){return db[_0x585b('0x32')][_0x585b('0x33')]({'where':{'id':_0x199e54[_0x585b('0x37')]['id']}})[_0x585b('0x20')](handleEntityNotFound(_0x2c4b9f,null))[_0x585b('0x20')](removeEntity(_0x2c4b9f,null))[_0x585b('0x34')](handleError(_0x2c4b9f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7a2893f..5f449b2 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 _0x6fd4=['define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','./chatApplication.attributes','exports'];(function(_0x2bb15c,_0xc9adbe){var _0xeca3af=function(_0xa8e368){while(--_0xa8e368){_0x2bb15c['push'](_0x2bb15c['shift']());}};_0xeca3af(++_0xc9adbe);}(_0x6fd4,0x118));var _0x46fd=function(_0x33e5c4,_0x1cc395){_0x33e5c4=_0x33e5c4-0x0;var _0x258bc0=_0x6fd4[_0x33e5c4];return _0x258bc0;};'use strict';var _=require(_0x46fd('0x0'));var util=require(_0x46fd('0x1'));var logger=require(_0x46fd('0x2'))(_0x46fd('0x3'));var moment=require(_0x46fd('0x4'));var BPromise=require('bluebird');var rp=require(_0x46fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x46fd('0x6'));module[_0x46fd('0x7')]=function(_0x1f45b2,_0x376f28){return _0x1f45b2[_0x46fd('0x8')](_0x46fd('0x9'),attributes,{'tableName':_0x46fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x46fd('0xb')});}; \ No newline at end of file +var _0x7576=['exports','chat_applications','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes'];(function(_0x59c568,_0x29bff0){var _0x48c741=function(_0xccde92){while(--_0xccde92){_0x59c568['push'](_0x59c568['shift']());}};_0x48c741(++_0x29bff0);}(_0x7576,0x1d8));var _0x6757=function(_0x144bb0,_0xfcf538){_0x144bb0=_0x144bb0-0x0;var _0x526122=_0x7576[_0x144bb0];return _0x526122;};'use strict';var _=require(_0x6757('0x0'));var util=require('util');var logger=require(_0x6757('0x1'))('api');var moment=require(_0x6757('0x2'));var BPromise=require(_0x6757('0x3'));var rp=require(_0x6757('0x4'));var fs=require('fs');var path=require(_0x6757('0x5'));var rimraf=require(_0x6757('0x6'));var config=require('../../config/environment');var attributes=require(_0x6757('0x7'));module[_0x6757('0x8')]=function(_0x217dfc,_0x1d9431){return _0x217dfc['define']('ChatApplication',attributes,{'tableName':_0x6757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2d42f7a..cb42a67 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 _0xbcbe=['http','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xbcbe,0x89));var _0xebcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xebcb('0x0'));var util=require(_0xebcb('0x1'));var moment=require(_0xebcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebcb('0x3'));var db=require(_0xebcb('0x4'))['db'];var utils=require(_0xebcb('0x5'));var logger=require(_0xebcb('0x6'))('rpc');var config=require(_0xebcb('0x7'));var jayson=require(_0xebcb('0x8'));var client=jayson[_0xebcb('0x9')][_0xebcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2164a6,_0x637807,_0x3db9f3){return new BPromise(function(_0x1fb4f4,_0x3bf1c7){return client['request'](_0x2164a6,_0x3db9f3)[_0xebcb('0xb')](function(_0x224f4d){logger['info']('ChatApplication,\x20%s,\x20%s',_0x637807,_0xebcb('0xc'));logger[_0xebcb('0xd')](_0xebcb('0xe'),_0x637807,_0xebcb('0xc'),JSON[_0xebcb('0xf')](_0x224f4d));if(_0x224f4d[_0xebcb('0x10')]){if(_0x224f4d[_0xebcb('0x10')][_0xebcb('0x11')]===0x1f4){logger[_0xebcb('0x10')]('ChatApplication,\x20%s,\x20%s',_0x637807,_0x224f4d[_0xebcb('0x10')][_0xebcb('0x12')]);return _0x3bf1c7(_0x224f4d[_0xebcb('0x10')][_0xebcb('0x12')]);}logger['error'](_0xebcb('0x13'),_0x637807,_0x224f4d[_0xebcb('0x10')][_0xebcb('0x12')]);return _0x1fb4f4(_0x224f4d[_0xebcb('0x10')][_0xebcb('0x12')]);}else{logger['info'](_0xebcb('0x13'),_0x637807,'request\x20sent');_0x1fb4f4(_0x224f4d[_0xebcb('0x14')]['message']);}})['catch'](function(_0x8b9b1e){logger['error'](_0xebcb('0x13'),_0x637807,_0x8b9b1e);_0x3bf1c7(_0x8b9b1e);});});} \ No newline at end of file +var _0x8b3f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x13ca07,_0x22b8ef){var _0x48782e=function(_0x1c7850){while(--_0x1c7850){_0x13ca07['push'](_0x13ca07['shift']());}};_0x48782e(++_0x22b8ef);}(_0x8b3f,0x14c));var _0xf8b3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8b3f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf8b3('0x0'));var util=require(_0xf8b3('0x1'));var moment=require(_0xf8b3('0x2'));var BPromise=require(_0xf8b3('0x3'));var rs=require(_0xf8b3('0x4'));var fs=require('fs');var Redis=require(_0xf8b3('0x5'));var db=require(_0xf8b3('0x6'))['db'];var utils=require(_0xf8b3('0x7'));var logger=require(_0xf8b3('0x8'))('rpc');var config=require(_0xf8b3('0x9'));var jayson=require(_0xf8b3('0xa'));var client=jayson[_0xf8b3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f4eb3,_0x2b2d55,_0x455ecd){return new BPromise(function(_0x41c5b7,_0x24c3b1){return client['request'](_0x4f4eb3,_0x455ecd)[_0xf8b3('0xc')](function(_0x3509b){logger[_0xf8b3('0xd')](_0xf8b3('0xe'),_0x2b2d55,_0xf8b3('0xf'));logger[_0xf8b3('0x10')](_0xf8b3('0x11'),_0x2b2d55,_0xf8b3('0xf'),JSON[_0xf8b3('0x12')](_0x3509b));if(_0x3509b[_0xf8b3('0x13')]){if(_0x3509b[_0xf8b3('0x13')][_0xf8b3('0x14')]===0x1f4){logger[_0xf8b3('0x13')](_0xf8b3('0xe'),_0x2b2d55,_0x3509b[_0xf8b3('0x13')][_0xf8b3('0x15')]);return _0x24c3b1(_0x3509b[_0xf8b3('0x13')][_0xf8b3('0x15')]);}logger[_0xf8b3('0x13')]('ChatApplication,\x20%s,\x20%s',_0x2b2d55,_0x3509b[_0xf8b3('0x13')][_0xf8b3('0x15')]);return _0x41c5b7(_0x3509b[_0xf8b3('0x13')]['message']);}else{logger[_0xf8b3('0xd')](_0xf8b3('0xe'),_0x2b2d55,_0xf8b3('0xf'));_0x41c5b7(_0x3509b[_0xf8b3('0x16')][_0xf8b3('0x15')]);}})[_0xf8b3('0x17')](function(_0x5d6039){logger[_0xf8b3('0x13')](_0xf8b3('0xe'),_0x2b2d55,_0x5d6039);_0x24c3b1(_0x5d6039);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d398a84..3a10e50 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 _0xa090=['show','isAuthenticated','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id'];(function(_0x349ce1,_0x1a0cdf){var _0x36074d=function(_0x2633c3){while(--_0x2633c3){_0x349ce1['push'](_0x349ce1['shift']());}};_0x36074d(++_0x1a0cdf);}(_0xa090,0x155));var _0x0a09=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0xa090[_0x2e6dee];return _0x47706;};'use strict';var multer=require(_0x0a09('0x0'));var util=require(_0x0a09('0x1'));var path=require(_0x0a09('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a09('0x3'));var router=express[_0x0a09('0x4')]();var fs_extra=require(_0x0a09('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0a09('0x6'));var config=require(_0x0a09('0x7'));var controller=require(_0x0a09('0x8'));router[_0x0a09('0x9')](_0x0a09('0xa'),auth['isAuthenticated'](),controller[_0x0a09('0xb')]);router['put'](_0x0a09('0xa'),auth[_0x0a09('0xc')](),controller[_0x0a09('0xd')]);router[_0x0a09('0xe')](_0x0a09('0xa'),auth[_0x0a09('0xc')](),controller['destroy']);module[_0x0a09('0xf')]=router; \ No newline at end of file +var _0xdcaa=['connect-timeout','express','Router','fs-extra','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','exports','util','path'];(function(_0x6a3773,_0x2ddb5d){var _0x51d80a=function(_0x4c77fa){while(--_0x4c77fa){_0x6a3773['push'](_0x6a3773['shift']());}};_0x51d80a(++_0x2ddb5d);}(_0xdcaa,0x14e));var _0xadca=function(_0xc08b7,_0x28a0d9){_0xc08b7=_0xc08b7-0x0;var _0x1da626=_0xdcaa[_0xc08b7];return _0x1da626;};'use strict';var multer=require('multer');var util=require(_0xadca('0x0'));var path=require(_0xadca('0x1'));var timeout=require(_0xadca('0x2'));var express=require(_0xadca('0x3'));var router=express[_0xadca('0x4')]();var fs_extra=require(_0xadca('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xadca('0x6'));router[_0xadca('0x7')](_0xadca('0x8'),auth[_0xadca('0x9')](),controller[_0xadca('0xa')]);router[_0xadca('0xb')]('/:id',auth[_0xadca('0x9')](),controller['update']);router[_0xadca('0xc')](_0xadca('0x8'),auth[_0xadca('0x9')](),controller['destroy']);module[_0xadca('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 3af6ec5..47de148 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 _0xfc9b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2bfd04,_0x52a394){var _0x2cf661=function(_0x4e340f){while(--_0x4e340f){_0x2bfd04['push'](_0x2bfd04['shift']());}};_0x2cf661(++_0x52a394);}(_0xfc9b,0x74));var _0xbfc9=function(_0x2e8f5c,_0x3b4a4a){_0x2e8f5c=_0x2e8f5c-0x0;var _0xfdc216=_0xfc9b[_0x2e8f5c];return _0xfdc216;};'use strict';var Sequelize=require(_0xbfc9('0x0'));module[_0xbfc9('0x1')]={'name':{'type':Sequelize[_0xbfc9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbfc9('0x2')]},'write':{'type':Sequelize[_0xbfc9('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb1d2=['STRING','BOOLEAN'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb1d2,0x116));var _0x2b1d=function(_0x1bc368,_0x3900b8){_0x1bc368=_0x1bc368-0x0;var _0x18808d=_0xb1d2[_0x1bc368];return _0x18808d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2b1d('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x2b1d('0x0')]},'write':{'type':Sequelize[_0x2b1d('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 9d69d13..8daf782 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 _0xf9b8=['filter','VIRTUAL','merge','count','includeAll','include','rows','catch','show','params','find','create','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','options','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0xf9b8,0x154));var _0x8f9b=function(_0x53be96,_0x1186da){_0x53be96=_0x53be96-0x0;var _0x5dd03e=_0xf9b8[_0x53be96];return _0x5dd03e;};'use strict';var emlformat=require(_0x8f9b('0x0'));var rimraf=require(_0x8f9b('0x1'));var zipdir=require(_0x8f9b('0x2'));var jsonpatch=require(_0x8f9b('0x3'));var rp=require(_0x8f9b('0x4'));var moment=require(_0x8f9b('0x5'));var BPromise=require(_0x8f9b('0x6'));var Mustache=require(_0x8f9b('0x7'));var util=require(_0x8f9b('0x8'));var path=require(_0x8f9b('0x9'));var sox=require(_0x8f9b('0xa'));var csv=require(_0x8f9b('0xb'));var ejs=require(_0x8f9b('0xc'));var fs=require('fs');var fs_extra=require(_0x8f9b('0xd'));var _=require(_0x8f9b('0xe'));var squel=require(_0x8f9b('0xf'));var crypto=require(_0x8f9b('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8f9b('0x11'));var Redis=require(_0x8f9b('0x12'));var authService=require(_0x8f9b('0x13'));var qs=require(_0x8f9b('0x14'));var as=require(_0x8f9b('0x15'));var hardwareService=require(_0x8f9b('0x16'));var logger=require(_0x8f9b('0x17'))('api');var utils=require(_0x8f9b('0x18'));var config=require(_0x8f9b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8f9b('0x1a')](config[_0x8f9b('0x1b')],{'host':_0x8f9b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8f9b('0x1d'))[_0x8f9b('0x1e')](socket);function respondWithStatusCode(_0x42a6d7,_0x11a197){_0x11a197=_0x11a197||0xcc;return function(_0x83b9ef){if(_0x83b9ef){return _0x42a6d7[_0x8f9b('0x1f')](_0x11a197);}return _0x42a6d7['status'](_0x11a197)['end']();};}function respondWithResult(_0x46a999,_0x406c3b){_0x406c3b=_0x406c3b||0xc8;return function(_0x4bc0fb){if(_0x4bc0fb){return _0x46a999[_0x8f9b('0x20')](_0x406c3b)[_0x8f9b('0x21')](_0x4bc0fb);}};}function respondWithFilteredResult(_0xbe522,_0x5e6d0f){return function(_0x34444e){if(_0x34444e){var _0xf8fef2=typeof _0x5e6d0f[_0x8f9b('0x22')]===_0x8f9b('0x23')&&typeof _0x5e6d0f['limit']===_0x8f9b('0x23');var _0x3dec89=_0x34444e['count'];var _0x5d265b=_0xf8fef2?0x0:_0x5e6d0f[_0x8f9b('0x22')];var _0x208e85=_0xf8fef2?_0x34444e['count']:_0x5e6d0f[_0x8f9b('0x22')]+_0x5e6d0f[_0x8f9b('0x24')];var _0x52ee2d;if(_0x208e85>=_0x3dec89){_0x208e85=_0x3dec89;_0x52ee2d=0xc8;}else{_0x52ee2d=0xce;}_0xbe522['status'](_0x52ee2d);return _0xbe522[_0x8f9b('0x25')](_0x8f9b('0x26'),_0x5d265b+'-'+_0x208e85+'/'+_0x3dec89)[_0x8f9b('0x21')](_0x34444e);}return null;};}function patchUpdates(_0x800542){return function(_0x15c087){try{jsonpatch[_0x8f9b('0x27')](_0x15c087,_0x800542,!![]);}catch(_0x435ebc){return BPromise[_0x8f9b('0x28')](_0x435ebc);}return _0x15c087[_0x8f9b('0x29')]();};}function saveUpdates(_0x28a60f,_0x163af5){return function(_0x4cc6c2){if(_0x4cc6c2){return _0x4cc6c2['update'](_0x28a60f)['then'](function(_0x156a2b){return _0x156a2b;});}return null;};}function removeEntity(_0x412de8,_0x720586){return function(_0x1e553b){if(_0x1e553b){return _0x1e553b[_0x8f9b('0x2a')]()[_0x8f9b('0x2b')](function(){_0x412de8[_0x8f9b('0x20')](0xcc)[_0x8f9b('0x2c')]();});}};}function handleEntityNotFound(_0x2f15da,_0x3931fd){return function(_0x31b208){if(!_0x31b208){_0x2f15da[_0x8f9b('0x1f')](0x194);}return _0x31b208;};}function handleError(_0x29caaf,_0x1ce375){_0x1ce375=_0x1ce375||0x1f4;return function(_0x1da70f){logger[_0x8f9b('0x2d')](_0x1da70f[_0x8f9b('0x2e')]);if(_0x1da70f[_0x8f9b('0x2f')]){delete _0x1da70f['name'];}_0x29caaf['status'](_0x1ce375)['send'](_0x1da70f);};}exports[_0x8f9b('0x30')]=function(_0x3bed11,_0x223423){var _0x1dc981={},_0x4b3fda={},_0x490491={'count':0x0,'rows':[]};var _0x36d8ca=_[_0x8f9b('0x31')](db[_0x8f9b('0x32')][_0x8f9b('0x33')],function(_0x9ba310){return{'name':_0x9ba310[_0x8f9b('0x34')],'type':_0x9ba310['type'][_0x8f9b('0x35')]};});_0x4b3fda[_0x8f9b('0x36')]=_['map'](_0x36d8ca,'name');_0x4b3fda[_0x8f9b('0x37')]=_[_0x8f9b('0x38')](_0x3bed11[_0x8f9b('0x37')]);_0x4b3fda[_0x8f9b('0x39')]=_[_0x8f9b('0x3a')](_0x4b3fda[_0x8f9b('0x36')],_0x4b3fda[_0x8f9b('0x37')]);_0x1dc981['attributes']=_['intersection'](_0x4b3fda[_0x8f9b('0x36')],qs[_0x8f9b('0x3b')](_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x3b')]));_0x1dc981[_0x8f9b('0x3c')]=_0x1dc981[_0x8f9b('0x3c')][_0x8f9b('0x3d')]?_0x1dc981['attributes']:_0x4b3fda[_0x8f9b('0x36')];if(!_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x3e')](_0x8f9b('0x3f'))){_0x1dc981[_0x8f9b('0x24')]=qs[_0x8f9b('0x24')](_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x24')]);_0x1dc981[_0x8f9b('0x22')]=qs[_0x8f9b('0x22')](_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x22')]);}_0x1dc981[_0x8f9b('0x40')]=qs[_0x8f9b('0x41')](_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x41')]);_0x1dc981[_0x8f9b('0x42')]=qs[_0x8f9b('0x39')](_[_0x8f9b('0x43')](_0x3bed11[_0x8f9b('0x37')],_0x4b3fda[_0x8f9b('0x39')]),_0x36d8ca);if(_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x44')]){_0x1dc981[_0x8f9b('0x42')]=_['merge'](_0x1dc981[_0x8f9b('0x42')],{'$or':_[_0x8f9b('0x31')](_0x36d8ca,function(_0x2b8f1b){if(_0x2b8f1b['type']!==_0x8f9b('0x45')){var _0x48f4ab={};_0x48f4ab[_0x2b8f1b[_0x8f9b('0x2f')]]={'$like':'%'+_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x44')]+'%'};return _0x48f4ab;}})});}_0x1dc981=_[_0x8f9b('0x46')]({},_0x1dc981,_0x3bed11['options']);var _0x27e3f8={'where':_0x1dc981[_0x8f9b('0x42')]};return db[_0x8f9b('0x32')][_0x8f9b('0x47')](_0x27e3f8)[_0x8f9b('0x2b')](function(_0x342f7a){_0x490491[_0x8f9b('0x47')]=_0x342f7a;if(_0x3bed11[_0x8f9b('0x37')][_0x8f9b('0x48')]){_0x1dc981[_0x8f9b('0x49')]=[{'all':!![]}];}return db[_0x8f9b('0x32')]['findAll'](_0x1dc981);})[_0x8f9b('0x2b')](function(_0x2506fa){_0x490491[_0x8f9b('0x4a')]=_0x2506fa;return _0x490491;})[_0x8f9b('0x2b')](respondWithFilteredResult(_0x223423,_0x1dc981))[_0x8f9b('0x4b')](handleError(_0x223423,null));};exports[_0x8f9b('0x4c')]=function(_0x68e436,_0x19d995){var _0x4c0804={'raw':!![],'where':{'id':_0x68e436[_0x8f9b('0x4d')]['id']}},_0x1a5287={};_0x1a5287[_0x8f9b('0x36')]=_[_0x8f9b('0x38')](db[_0x8f9b('0x32')][_0x8f9b('0x33')]);_0x1a5287[_0x8f9b('0x37')]=_[_0x8f9b('0x38')](_0x68e436[_0x8f9b('0x37')]);_0x1a5287[_0x8f9b('0x39')]=_[_0x8f9b('0x3a')](_0x1a5287[_0x8f9b('0x36')],_0x1a5287[_0x8f9b('0x37')]);_0x4c0804['attributes']=_[_0x8f9b('0x3a')](_0x1a5287['model'],qs[_0x8f9b('0x3b')](_0x68e436[_0x8f9b('0x37')][_0x8f9b('0x3b')]));_0x4c0804[_0x8f9b('0x3c')]=_0x4c0804[_0x8f9b('0x3c')][_0x8f9b('0x3d')]?_0x4c0804[_0x8f9b('0x3c')]:_0x1a5287[_0x8f9b('0x36')];if(_0x68e436[_0x8f9b('0x37')][_0x8f9b('0x48')]){_0x4c0804[_0x8f9b('0x49')]=[{'all':!![]}];}_0x4c0804=_['merge']({},_0x4c0804,_0x68e436['options']);return db[_0x8f9b('0x32')][_0x8f9b('0x4e')](_0x4c0804)[_0x8f9b('0x2b')](handleEntityNotFound(_0x19d995,null))['then'](respondWithResult(_0x19d995,null))[_0x8f9b('0x4b')](handleError(_0x19d995,null));};exports[_0x8f9b('0x4f')]=function(_0x457c1e,_0x260e36){return db['ChatGroup'][_0x8f9b('0x4f')](_0x457c1e[_0x8f9b('0x50')],{})['then'](respondWithResult(_0x260e36,0xc9))[_0x8f9b('0x4b')](handleError(_0x260e36,null));};exports[_0x8f9b('0x51')]=function(_0x3c6621,_0x532ea3){if(_0x3c6621['body']['id']){delete _0x3c6621[_0x8f9b('0x50')]['id'];}return db[_0x8f9b('0x32')][_0x8f9b('0x4e')]({'where':{'id':_0x3c6621[_0x8f9b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x532ea3,null))['then'](saveUpdates(_0x3c6621[_0x8f9b('0x50')],null))[_0x8f9b('0x2b')](respondWithResult(_0x532ea3,null))[_0x8f9b('0x4b')](handleError(_0x532ea3,null));};exports[_0x8f9b('0x2a')]=function(_0x569f21,_0x249ba2){return db[_0x8f9b('0x32')][_0x8f9b('0x4e')]({'where':{'id':_0x569f21[_0x8f9b('0x4d')]['id']}})[_0x8f9b('0x2b')](handleEntityNotFound(_0x249ba2,null))['then'](removeEntity(_0x249ba2,null))['catch'](handleError(_0x249ba2,null));};exports['describe']=function(_0x52c55d,_0x368466){return db[_0x8f9b('0x32')][_0x8f9b('0x52')]()['then'](respondWithResult(_0x368466,null))[_0x8f9b('0x4b')](handleError(_0x368466,null));};exports[_0x8f9b('0x53')]=function(_0x30421d,_0x11d09d,_0x1892c8){return db[_0x8f9b('0x54')][_0x8f9b('0x47')]({'where':{'ChatGroupId':_0x30421d['params']['id'],'ToId':_0x30421d[_0x8f9b('0x55')]['id'],'read':![]}})[_0x8f9b('0x2b')](function(_0x359df5){return{'id':_[_0x8f9b('0x56')](_0x30421d['params']['id']),'count':_0x359df5};})[_0x8f9b('0x2b')](respondWithResult(_0x11d09d,null))['catch'](handleError(_0x11d09d,null));};exports['addMembers']=function(_0x214b6b,_0x38cc57,_0x266300){return db[_0x8f9b('0x32')][_0x8f9b('0x4e')]({'where':{'id':_0x214b6b[_0x8f9b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x38cc57,null))['then'](function(_0x501d97){if(_0x501d97){return _0x501d97[_0x8f9b('0x57')](_0x214b6b[_0x8f9b('0x50')][_0x8f9b('0x58')],_[_0x8f9b('0x59')](_0x214b6b['body'],[_0x8f9b('0x58'),'id'])||{});}})[_0x8f9b('0x2b')](respondWithResult(_0x38cc57,null))[_0x8f9b('0x4b')](handleError(_0x38cc57,null));};exports[_0x8f9b('0x5a')]=function(_0x12dc74,_0x4545f8,_0x26879b){var _0x492e73={};var _0x125c88={};var _0x473545;var _0x3da04c;return db[_0x8f9b('0x32')][_0x8f9b('0x5b')]({'where':{'id':_0x12dc74[_0x8f9b('0x4d')]['id']}})[_0x8f9b('0x2b')](handleEntityNotFound(_0x4545f8,null))[_0x8f9b('0x2b')](function(_0x250542){if(_0x250542){_0x473545=_0x250542;_0x125c88[_0x8f9b('0x36')]=_['keys'](db[_0x8f9b('0x5c')][_0x8f9b('0x33')]);_0x125c88[_0x8f9b('0x37')]=_[_0x8f9b('0x38')](_0x12dc74['query']);_0x125c88[_0x8f9b('0x39')]=_[_0x8f9b('0x3a')](_0x125c88[_0x8f9b('0x36')],_0x125c88['query']);_0x492e73[_0x8f9b('0x3c')]=_[_0x8f9b('0x3a')](_0x125c88[_0x8f9b('0x36')],qs['fields'](_0x12dc74['query'][_0x8f9b('0x3b')]));_0x492e73[_0x8f9b('0x3c')]=_0x492e73[_0x8f9b('0x3c')]['length']?_0x492e73[_0x8f9b('0x3c')]:_0x125c88[_0x8f9b('0x36')];_0x492e73[_0x8f9b('0x40')]=qs[_0x8f9b('0x41')](_0x12dc74[_0x8f9b('0x37')][_0x8f9b('0x41')]);_0x492e73['where']=qs[_0x8f9b('0x39')](_[_0x8f9b('0x43')](_0x12dc74[_0x8f9b('0x37')],_0x125c88['filters']));if(_0x12dc74[_0x8f9b('0x37')][_0x8f9b('0x44')]){_0x492e73['where']=_[_0x8f9b('0x46')](_0x492e73[_0x8f9b('0x42')],{'$or':_[_0x8f9b('0x31')](_0x492e73[_0x8f9b('0x3c')],function(_0x4727df){var _0x1a71b4={};_0x1a71b4[_0x4727df]={'$like':'%'+_0x12dc74[_0x8f9b('0x37')][_0x8f9b('0x44')]+'%'};return _0x1a71b4;})});}_0x492e73=_['merge']({},_0x492e73,_0x12dc74[_0x8f9b('0x5d')]);return _0x473545['getMembers'](_0x492e73);}})[_0x8f9b('0x2b')](function(_0x40f22e){if(_0x40f22e){_0x3da04c=_0x40f22e[_0x8f9b('0x3d')];if(!_0x12dc74['query'][_0x8f9b('0x3e')]('nolimit')){_0x492e73[_0x8f9b('0x24')]=qs[_0x8f9b('0x24')](_0x12dc74[_0x8f9b('0x37')][_0x8f9b('0x24')]);_0x492e73['offset']=qs[_0x8f9b('0x22')](_0x12dc74[_0x8f9b('0x37')][_0x8f9b('0x22')]);}return _0x473545[_0x8f9b('0x5a')](_0x492e73);}})[_0x8f9b('0x2b')](function(_0x18a80f){if(_0x18a80f){return _0x18a80f?{'count':_0x3da04c,'rows':_0x18a80f}:null;}})['then'](respondWithResult(_0x4545f8,null))[_0x8f9b('0x4b')](handleError(_0x4545f8,null));};exports[_0x8f9b('0x5e')]=function(_0x854691,_0x3c71ad,_0x2f1fb0){return db[_0x8f9b('0x32')][_0x8f9b('0x4e')]({'where':{'id':_0x854691[_0x8f9b('0x4d')]['id']}})[_0x8f9b('0x2b')](handleEntityNotFound(_0x3c71ad,null))[_0x8f9b('0x2b')](function(_0x5b5fb0){if(_0x5b5fb0){return _0x5b5fb0[_0x8f9b('0x5e')](_0x854691[_0x8f9b('0x37')]['ids']);}})[_0x8f9b('0x2b')](respondWithStatusCode(_0x3c71ad,null))['catch'](handleError(_0x3c71ad,null));};exports[_0x8f9b('0x5f')]=function(_0x41b7bc,_0x338e06,_0x41aecf){if(_0x41b7bc[_0x8f9b('0x50')]['id']){delete _0x41b7bc[_0x8f9b('0x50')]['id'];}return db[_0x8f9b('0x32')][_0x8f9b('0x4e')]({'where':{'id':_0x41b7bc[_0x8f9b('0x4d')]['id']}})[_0x8f9b('0x2b')](handleEntityNotFound(_0x338e06,null))[_0x8f9b('0x2b')](function(_0x3e9217){if(_0x3e9217){_0x41b7bc[_0x8f9b('0x50')][_0x8f9b('0x60')]=_0x3e9217['id'];return db['ChatInternalMessage'][_0x8f9b('0x4f')](_0x41b7bc[_0x8f9b('0x50')]);}})[_0x8f9b('0x2b')](respondWithResult(_0x338e06,null))[_0x8f9b('0x4b')](handleError(_0x338e06,null));};exports['getMessages']=function(_0x17012f,_0x1ee82e,_0x1ef05e){var _0x1475f7={};var _0x26b416={};var _0x6a2b0c;var _0x49cee1;return db[_0x8f9b('0x32')][_0x8f9b('0x5b')]({'where':{'id':_0x17012f['params']['id']}})[_0x8f9b('0x2b')](handleEntityNotFound(_0x1ee82e,null))[_0x8f9b('0x2b')](function(_0x58bb86){if(_0x58bb86){_0x6a2b0c=_0x58bb86;_0x26b416['model']=_[_0x8f9b('0x38')](db[_0x8f9b('0x54')][_0x8f9b('0x33')]);_0x26b416[_0x8f9b('0x37')]=_[_0x8f9b('0x38')](_0x17012f[_0x8f9b('0x37')]);_0x26b416[_0x8f9b('0x39')]=_[_0x8f9b('0x3a')](_0x26b416[_0x8f9b('0x36')],_0x26b416['query']);_0x1475f7[_0x8f9b('0x3c')]=_['intersection'](_0x26b416[_0x8f9b('0x36')],qs[_0x8f9b('0x3b')](_0x17012f[_0x8f9b('0x37')]['fields']));_0x1475f7['attributes']=_0x1475f7[_0x8f9b('0x3c')][_0x8f9b('0x3d')]?_0x1475f7[_0x8f9b('0x3c')]:_0x26b416[_0x8f9b('0x36')];_0x1475f7[_0x8f9b('0x40')]=qs[_0x8f9b('0x41')](_0x17012f[_0x8f9b('0x37')][_0x8f9b('0x41')]);_0x1475f7['where']=qs[_0x8f9b('0x39')](_[_0x8f9b('0x43')](_0x17012f[_0x8f9b('0x37')],_0x26b416[_0x8f9b('0x39')]));if(_0x17012f[_0x8f9b('0x37')]['filter']){_0x1475f7[_0x8f9b('0x42')]=_['merge'](_0x1475f7['where'],{'$or':_['map'](_0x1475f7[_0x8f9b('0x3c')],function(_0x5ea6a4){var _0x181bfd={};_0x181bfd[_0x5ea6a4]={'$like':'%'+_0x17012f['query']['filter']+'%'};return _0x181bfd;})});}if(_0x17012f[_0x8f9b('0x37')]['$gte']){var _0x15f9b4=_0x17012f[_0x8f9b('0x37')][_0x8f9b('0x61')][_0x8f9b('0x62')](',');var _0x2cf03f={};_0x2cf03f[_0x15f9b4[0x0]]={'$gte':moment(_0x15f9b4[0x1])[_0x8f9b('0x63')](_0x8f9b('0x64'))};_0x1475f7[_0x8f9b('0x42')]=_[_0x8f9b('0x46')](_0x1475f7[_0x8f9b('0x42')],_0x2cf03f);}_0x1475f7=_['merge']({},_0x1475f7,_0x17012f['options']);return _0x6a2b0c[_0x8f9b('0x65')](_0x1475f7);}})['then'](function(_0x52f672){if(_0x52f672){_0x49cee1=_0x52f672['length'];if(!_0x17012f[_0x8f9b('0x37')][_0x8f9b('0x3e')]('nolimit')){_0x1475f7[_0x8f9b('0x24')]=qs[_0x8f9b('0x24')](_0x17012f[_0x8f9b('0x37')]['limit']);_0x1475f7['offset']=qs['offset'](_0x17012f['query'][_0x8f9b('0x22')]);}return _0x6a2b0c[_0x8f9b('0x65')](_0x1475f7);}})[_0x8f9b('0x2b')](function(_0x5b562b){if(_0x5b562b){return _0x5b562b?{'count':_0x49cee1,'rows':_0x5b562b}:null;}})[_0x8f9b('0x2b')](respondWithResult(_0x1ee82e,null))[_0x8f9b('0x4b')](handleError(_0x1ee82e,null));}; \ No newline at end of file +var _0x3229=['sort','nolimit','removeMembers','ChatGroupId','findOne','pick','$gte','format','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','length','include','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers'];(function(_0x228058,_0x5f30e8){var _0x2ad92d=function(_0x459963){while(--_0x459963){_0x228058['push'](_0x228058['shift']());}};_0x2ad92d(++_0x5f30e8);}(_0x3229,0x17d));var _0x9322=function(_0x32a7f8,_0x1bbc99){_0x32a7f8=_0x32a7f8-0x0;var _0x399dc2=_0x3229[_0x32a7f8];return _0x399dc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9322('0x0'));var zipdir=require(_0x9322('0x1'));var jsonpatch=require(_0x9322('0x2'));var rp=require(_0x9322('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9322('0x4'));var util=require(_0x9322('0x5'));var path=require('path');var sox=require(_0x9322('0x6'));var csv=require(_0x9322('0x7'));var ejs=require(_0x9322('0x8'));var fs=require('fs');var fs_extra=require(_0x9322('0x9'));var _=require(_0x9322('0xa'));var squel=require(_0x9322('0xb'));var crypto=require(_0x9322('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9322('0xd'));var toCsv=require(_0x9322('0x7'));var querystring=require('querystring');var Papa=require(_0x9322('0xe'));var Redis=require(_0x9322('0xf'));var authService=require(_0x9322('0x10'));var qs=require(_0x9322('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9322('0x12'));var logger=require(_0x9322('0x13'))(_0x9322('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9322('0x15')]=_[_0x9322('0x16')](config[_0x9322('0x15')],{'host':_0x9322('0x17'),'port':0x18eb});var socket=require(_0x9322('0x18'))(new Redis(config[_0x9322('0x15')]));require('./chatGroup.socket')[_0x9322('0x19')](socket);function respondWithStatusCode(_0x2b191a,_0x2e0e83){_0x2e0e83=_0x2e0e83||0xcc;return function(_0x1ff072){if(_0x1ff072){return _0x2b191a[_0x9322('0x1a')](_0x2e0e83);}return _0x2b191a[_0x9322('0x1b')](_0x2e0e83)[_0x9322('0x1c')]();};}function respondWithResult(_0x3b3a47,_0x221336){_0x221336=_0x221336||0xc8;return function(_0xa29a68){if(_0xa29a68){return _0x3b3a47[_0x9322('0x1b')](_0x221336)['json'](_0xa29a68);}};}function respondWithFilteredResult(_0x19c8f7,_0x7f0e59){return function(_0x18b09e){if(_0x18b09e){var _0x198456=typeof _0x7f0e59[_0x9322('0x1d')]===_0x9322('0x1e')&&typeof _0x7f0e59['limit']===_0x9322('0x1e');var _0x33bd18=_0x18b09e['count'];var _0xd033ea=_0x198456?0x0:_0x7f0e59[_0x9322('0x1d')];var _0x5e192c=_0x198456?_0x18b09e[_0x9322('0x1f')]:_0x7f0e59[_0x9322('0x1d')]+_0x7f0e59[_0x9322('0x20')];var _0x4b4dfe;if(_0x5e192c>=_0x33bd18){_0x5e192c=_0x33bd18;_0x4b4dfe=0xc8;}else{_0x4b4dfe=0xce;}_0x19c8f7['status'](_0x4b4dfe);return _0x19c8f7[_0x9322('0x21')](_0x9322('0x22'),_0xd033ea+'-'+_0x5e192c+'/'+_0x33bd18)[_0x9322('0x23')](_0x18b09e);}return null;};}function patchUpdates(_0x308ac1){return function(_0x841ab9){try{jsonpatch[_0x9322('0x24')](_0x841ab9,_0x308ac1,!![]);}catch(_0x5af7ab){return BPromise[_0x9322('0x25')](_0x5af7ab);}return _0x841ab9[_0x9322('0x26')]();};}function saveUpdates(_0x4cce0b,_0x3ad72d){return function(_0x9239fb){if(_0x9239fb){return _0x9239fb[_0x9322('0x27')](_0x4cce0b)['then'](function(_0x1e92cb){return _0x1e92cb;});}return null;};}function removeEntity(_0x53bfe2,_0x779295){return function(_0x509bd1){if(_0x509bd1){return _0x509bd1[_0x9322('0x28')]()[_0x9322('0x29')](function(){_0x53bfe2[_0x9322('0x1b')](0xcc)[_0x9322('0x1c')]();});}};}function handleEntityNotFound(_0x5ff0f9,_0x3418a7){return function(_0x2d26d8){if(!_0x2d26d8){_0x5ff0f9[_0x9322('0x1a')](0x194);}return _0x2d26d8;};}function handleError(_0x4fb3df,_0x2e3334){_0x2e3334=_0x2e3334||0x1f4;return function(_0x47fe63){logger[_0x9322('0x2a')](_0x47fe63[_0x9322('0x2b')]);if(_0x47fe63[_0x9322('0x2c')]){delete _0x47fe63[_0x9322('0x2c')];}_0x4fb3df[_0x9322('0x1b')](_0x2e3334)['send'](_0x47fe63);};}exports[_0x9322('0x2d')]=function(_0x41d8f8,_0x721d91){var _0x324096={},_0x3bdd8f={},_0x2ed329={'count':0x0,'rows':[]};var _0x84642d=_[_0x9322('0x2e')](db[_0x9322('0x2f')][_0x9322('0x30')],function(_0x52e25e){return{'name':_0x52e25e[_0x9322('0x31')],'type':_0x52e25e[_0x9322('0x32')]['key']};});_0x3bdd8f[_0x9322('0x33')]=_['map'](_0x84642d,_0x9322('0x2c'));_0x3bdd8f[_0x9322('0x34')]=_[_0x9322('0x35')](_0x41d8f8[_0x9322('0x34')]);_0x3bdd8f[_0x9322('0x36')]=_['intersection'](_0x3bdd8f[_0x9322('0x33')],_0x3bdd8f[_0x9322('0x34')]);_0x324096[_0x9322('0x37')]=_[_0x9322('0x38')](_0x3bdd8f['model'],qs[_0x9322('0x39')](_0x41d8f8[_0x9322('0x34')][_0x9322('0x39')]));_0x324096[_0x9322('0x37')]=_0x324096[_0x9322('0x37')]['length']?_0x324096[_0x9322('0x37')]:_0x3bdd8f[_0x9322('0x33')];if(!_0x41d8f8[_0x9322('0x34')][_0x9322('0x3a')]('nolimit')){_0x324096[_0x9322('0x20')]=qs[_0x9322('0x20')](_0x41d8f8[_0x9322('0x34')][_0x9322('0x20')]);_0x324096[_0x9322('0x1d')]=qs[_0x9322('0x1d')](_0x41d8f8[_0x9322('0x34')][_0x9322('0x1d')]);}_0x324096[_0x9322('0x3b')]=qs['sort'](_0x41d8f8['query']['sort']);_0x324096[_0x9322('0x3c')]=qs['filters'](_['pick'](_0x41d8f8[_0x9322('0x34')],_0x3bdd8f[_0x9322('0x36')]),_0x84642d);if(_0x41d8f8[_0x9322('0x34')][_0x9322('0x3d')]){_0x324096[_0x9322('0x3c')]=_[_0x9322('0x3e')](_0x324096['where'],{'$or':_[_0x9322('0x2e')](_0x84642d,function(_0x364cad){if(_0x364cad[_0x9322('0x32')]!==_0x9322('0x3f')){var _0x1aa8fe={};_0x1aa8fe[_0x364cad[_0x9322('0x2c')]]={'$like':'%'+_0x41d8f8[_0x9322('0x34')]['filter']+'%'};return _0x1aa8fe;}})});}_0x324096=_['merge']({},_0x324096,_0x41d8f8[_0x9322('0x40')]);var _0x5cc57f={'where':_0x324096[_0x9322('0x3c')]};return db[_0x9322('0x2f')][_0x9322('0x1f')](_0x5cc57f)[_0x9322('0x29')](function(_0x31f970){_0x2ed329[_0x9322('0x1f')]=_0x31f970;if(_0x41d8f8[_0x9322('0x34')][_0x9322('0x41')]){_0x324096['include']=[{'all':!![]}];}return db[_0x9322('0x2f')][_0x9322('0x42')](_0x324096);})[_0x9322('0x29')](function(_0x320a35){_0x2ed329[_0x9322('0x43')]=_0x320a35;return _0x2ed329;})[_0x9322('0x29')](respondWithFilteredResult(_0x721d91,_0x324096))['catch'](handleError(_0x721d91,null));};exports['show']=function(_0x38c28b,_0xaf6745){var _0x57993c={'raw':!![],'where':{'id':_0x38c28b[_0x9322('0x44')]['id']}},_0xf4db25={};_0xf4db25[_0x9322('0x33')]=_[_0x9322('0x35')](db[_0x9322('0x2f')]['rawAttributes']);_0xf4db25[_0x9322('0x34')]=_[_0x9322('0x35')](_0x38c28b[_0x9322('0x34')]);_0xf4db25[_0x9322('0x36')]=_[_0x9322('0x38')](_0xf4db25[_0x9322('0x33')],_0xf4db25[_0x9322('0x34')]);_0x57993c[_0x9322('0x37')]=_['intersection'](_0xf4db25['model'],qs['fields'](_0x38c28b[_0x9322('0x34')][_0x9322('0x39')]));_0x57993c[_0x9322('0x37')]=_0x57993c[_0x9322('0x37')][_0x9322('0x45')]?_0x57993c[_0x9322('0x37')]:_0xf4db25[_0x9322('0x33')];if(_0x38c28b[_0x9322('0x34')]['includeAll']){_0x57993c[_0x9322('0x46')]=[{'all':!![]}];}_0x57993c=_[_0x9322('0x3e')]({},_0x57993c,_0x38c28b[_0x9322('0x40')]);return db[_0x9322('0x2f')][_0x9322('0x47')](_0x57993c)['then'](handleEntityNotFound(_0xaf6745,null))[_0x9322('0x29')](respondWithResult(_0xaf6745,null))[_0x9322('0x48')](handleError(_0xaf6745,null));};exports[_0x9322('0x49')]=function(_0xf058dd,_0x5ce7f1){return db[_0x9322('0x2f')][_0x9322('0x49')](_0xf058dd[_0x9322('0x4a')],{})[_0x9322('0x29')](respondWithResult(_0x5ce7f1,0xc9))[_0x9322('0x48')](handleError(_0x5ce7f1,null));};exports[_0x9322('0x27')]=function(_0x232fa0,_0x43ced9){if(_0x232fa0[_0x9322('0x4a')]['id']){delete _0x232fa0[_0x9322('0x4a')]['id'];}return db[_0x9322('0x2f')]['find']({'where':{'id':_0x232fa0['params']['id']}})[_0x9322('0x29')](handleEntityNotFound(_0x43ced9,null))[_0x9322('0x29')](saveUpdates(_0x232fa0['body'],null))[_0x9322('0x29')](respondWithResult(_0x43ced9,null))[_0x9322('0x48')](handleError(_0x43ced9,null));};exports[_0x9322('0x28')]=function(_0x5e0b58,_0x13bfe0){return db['ChatGroup'][_0x9322('0x47')]({'where':{'id':_0x5e0b58[_0x9322('0x44')]['id']}})[_0x9322('0x29')](handleEntityNotFound(_0x13bfe0,null))[_0x9322('0x29')](removeEntity(_0x13bfe0,null))['catch'](handleError(_0x13bfe0,null));};exports['describe']=function(_0x2e902a,_0x1703b8){return db[_0x9322('0x2f')][_0x9322('0x4b')]()['then'](respondWithResult(_0x1703b8,null))['catch'](handleError(_0x1703b8,null));};exports[_0x9322('0x4c')]=function(_0x5aca32,_0x1f8d90,_0x3f511e){return db[_0x9322('0x4d')][_0x9322('0x1f')]({'where':{'ChatGroupId':_0x5aca32[_0x9322('0x44')]['id'],'ToId':_0x5aca32[_0x9322('0x4e')]['id'],'read':![]}})[_0x9322('0x29')](function(_0x576b97){return{'id':_[_0x9322('0x4f')](_0x5aca32[_0x9322('0x44')]['id']),'count':_0x576b97};})[_0x9322('0x29')](respondWithResult(_0x1f8d90,null))[_0x9322('0x48')](handleError(_0x1f8d90,null));};exports[_0x9322('0x50')]=function(_0x290e4f,_0x51af7f,_0x50914a){return db[_0x9322('0x2f')][_0x9322('0x47')]({'where':{'id':_0x290e4f[_0x9322('0x44')]['id']}})['then'](handleEntityNotFound(_0x51af7f,null))[_0x9322('0x29')](function(_0x12b8e7){if(_0x12b8e7){return _0x12b8e7['addMembers'](_0x290e4f[_0x9322('0x4a')]['ids'],_[_0x9322('0x51')](_0x290e4f[_0x9322('0x4a')],[_0x9322('0x52'),'id'])||{});}})['then'](respondWithResult(_0x51af7f,null))['catch'](handleError(_0x51af7f,null));};exports[_0x9322('0x53')]=function(_0x318c8f,_0x4569fc,_0x223062){var _0x49f458={};var _0x172433={};var _0x4b17c3;var _0x185145;return db[_0x9322('0x2f')]['findOne']({'where':{'id':_0x318c8f['params']['id']}})['then'](handleEntityNotFound(_0x4569fc,null))['then'](function(_0x565575){if(_0x565575){_0x4b17c3=_0x565575;_0x172433[_0x9322('0x33')]=_[_0x9322('0x35')](db['User'][_0x9322('0x30')]);_0x172433[_0x9322('0x34')]=_['keys'](_0x318c8f[_0x9322('0x34')]);_0x172433[_0x9322('0x36')]=_['intersection'](_0x172433[_0x9322('0x33')],_0x172433[_0x9322('0x34')]);_0x49f458[_0x9322('0x37')]=_[_0x9322('0x38')](_0x172433[_0x9322('0x33')],qs['fields'](_0x318c8f[_0x9322('0x34')][_0x9322('0x39')]));_0x49f458[_0x9322('0x37')]=_0x49f458[_0x9322('0x37')][_0x9322('0x45')]?_0x49f458[_0x9322('0x37')]:_0x172433['model'];_0x49f458['order']=qs[_0x9322('0x54')](_0x318c8f[_0x9322('0x34')][_0x9322('0x54')]);_0x49f458[_0x9322('0x3c')]=qs[_0x9322('0x36')](_['pick'](_0x318c8f['query'],_0x172433[_0x9322('0x36')]));if(_0x318c8f['query'][_0x9322('0x3d')]){_0x49f458['where']=_[_0x9322('0x3e')](_0x49f458[_0x9322('0x3c')],{'$or':_['map'](_0x49f458[_0x9322('0x37')],function(_0x1e8462){var _0x236059={};_0x236059[_0x1e8462]={'$like':'%'+_0x318c8f[_0x9322('0x34')][_0x9322('0x3d')]+'%'};return _0x236059;})});}_0x49f458=_[_0x9322('0x3e')]({},_0x49f458,_0x318c8f['options']);return _0x4b17c3[_0x9322('0x53')](_0x49f458);}})[_0x9322('0x29')](function(_0x470e9b){if(_0x470e9b){_0x185145=_0x470e9b[_0x9322('0x45')];if(!_0x318c8f[_0x9322('0x34')][_0x9322('0x3a')](_0x9322('0x55'))){_0x49f458[_0x9322('0x20')]=qs[_0x9322('0x20')](_0x318c8f[_0x9322('0x34')]['limit']);_0x49f458[_0x9322('0x1d')]=qs['offset'](_0x318c8f['query'][_0x9322('0x1d')]);}return _0x4b17c3['getMembers'](_0x49f458);}})['then'](function(_0x163647){if(_0x163647){return _0x163647?{'count':_0x185145,'rows':_0x163647}:null;}})[_0x9322('0x29')](respondWithResult(_0x4569fc,null))[_0x9322('0x48')](handleError(_0x4569fc,null));};exports[_0x9322('0x56')]=function(_0x606e4b,_0x5939ca,_0x22f7bd){return db[_0x9322('0x2f')][_0x9322('0x47')]({'where':{'id':_0x606e4b['params']['id']}})[_0x9322('0x29')](handleEntityNotFound(_0x5939ca,null))[_0x9322('0x29')](function(_0x1be0f5){if(_0x1be0f5){return _0x1be0f5[_0x9322('0x56')](_0x606e4b['query'][_0x9322('0x52')]);}})['then'](respondWithStatusCode(_0x5939ca,null))[_0x9322('0x48')](handleError(_0x5939ca,null));};exports['addMessage']=function(_0x152c22,_0x1ee132,_0x2d8c1d){if(_0x152c22[_0x9322('0x4a')]['id']){delete _0x152c22[_0x9322('0x4a')]['id'];}return db[_0x9322('0x2f')][_0x9322('0x47')]({'where':{'id':_0x152c22[_0x9322('0x44')]['id']}})[_0x9322('0x29')](handleEntityNotFound(_0x1ee132,null))[_0x9322('0x29')](function(_0xb93ab){if(_0xb93ab){_0x152c22[_0x9322('0x4a')][_0x9322('0x57')]=_0xb93ab['id'];return db['ChatInternalMessage'][_0x9322('0x49')](_0x152c22[_0x9322('0x4a')]);}})[_0x9322('0x29')](respondWithResult(_0x1ee132,null))[_0x9322('0x48')](handleError(_0x1ee132,null));};exports['getMessages']=function(_0x3588d1,_0x38290b,_0x1e99fd){var _0x4d17b4={};var _0x1bf68a={};var _0x4d189b;var _0x50fa22;return db[_0x9322('0x2f')][_0x9322('0x58')]({'where':{'id':_0x3588d1[_0x9322('0x44')]['id']}})[_0x9322('0x29')](handleEntityNotFound(_0x38290b,null))[_0x9322('0x29')](function(_0xfa3837){if(_0xfa3837){_0x4d189b=_0xfa3837;_0x1bf68a[_0x9322('0x33')]=_[_0x9322('0x35')](db[_0x9322('0x4d')]['rawAttributes']);_0x1bf68a['query']=_[_0x9322('0x35')](_0x3588d1[_0x9322('0x34')]);_0x1bf68a['filters']=_[_0x9322('0x38')](_0x1bf68a[_0x9322('0x33')],_0x1bf68a['query']);_0x4d17b4['attributes']=_[_0x9322('0x38')](_0x1bf68a[_0x9322('0x33')],qs[_0x9322('0x39')](_0x3588d1['query']['fields']));_0x4d17b4[_0x9322('0x37')]=_0x4d17b4['attributes']['length']?_0x4d17b4[_0x9322('0x37')]:_0x1bf68a[_0x9322('0x33')];_0x4d17b4[_0x9322('0x3b')]=qs['sort'](_0x3588d1['query'][_0x9322('0x54')]);_0x4d17b4[_0x9322('0x3c')]=qs[_0x9322('0x36')](_[_0x9322('0x59')](_0x3588d1['query'],_0x1bf68a[_0x9322('0x36')]));if(_0x3588d1[_0x9322('0x34')][_0x9322('0x3d')]){_0x4d17b4[_0x9322('0x3c')]=_[_0x9322('0x3e')](_0x4d17b4[_0x9322('0x3c')],{'$or':_[_0x9322('0x2e')](_0x4d17b4[_0x9322('0x37')],function(_0x3e8c6c){var _0x24213d={};_0x24213d[_0x3e8c6c]={'$like':'%'+_0x3588d1['query'][_0x9322('0x3d')]+'%'};return _0x24213d;})});}if(_0x3588d1[_0x9322('0x34')][_0x9322('0x5a')]){var _0x4214c0=_0x3588d1[_0x9322('0x34')]['$gte']['split'](',');var _0x5053dc={};_0x5053dc[_0x4214c0[0x0]]={'$gte':moment(_0x4214c0[0x1])[_0x9322('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4d17b4[_0x9322('0x3c')]=_[_0x9322('0x3e')](_0x4d17b4['where'],_0x5053dc);}_0x4d17b4=_[_0x9322('0x3e')]({},_0x4d17b4,_0x3588d1[_0x9322('0x40')]);return _0x4d189b[_0x9322('0x5c')](_0x4d17b4);}})[_0x9322('0x29')](function(_0x1846ea){if(_0x1846ea){_0x50fa22=_0x1846ea['length'];if(!_0x3588d1[_0x9322('0x34')][_0x9322('0x3a')](_0x9322('0x55'))){_0x4d17b4[_0x9322('0x20')]=qs[_0x9322('0x20')](_0x3588d1['query']['limit']);_0x4d17b4[_0x9322('0x1d')]=qs['offset'](_0x3588d1[_0x9322('0x34')]['offset']);}return _0x4d189b[_0x9322('0x5c')](_0x4d17b4);}})[_0x9322('0x29')](function(_0x1eccd3){if(_0x1eccd3){return _0x1eccd3?{'count':_0x50fa22,'rows':_0x1eccd3}:null;}})[_0x9322('0x29')](respondWithResult(_0x38290b,null))[_0x9322('0x48')](handleError(_0x38290b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c05f1b2..a90a65d 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 _0xef0f=['events','ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0xef0f,0x168));var _0xfef0=function(_0x122fe4,_0x3c2207){_0x122fe4=_0x122fe4-0x0;var _0x5085af=_0xef0f[_0x122fe4];return _0x5085af;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xfef0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfef0('0x2')](0x0);var events={'afterCreate':_0xfef0('0x3'),'afterUpdate':'update','afterDestroy':_0xfef0('0x4')};function emitEvent(_0x11ab77){return function(_0x4618fb,_0x4e1af6,_0x2a6fcf){ChatGroupEvents[_0xfef0('0x5')](_0x11ab77+':'+_0x4618fb['id'],_0x4618fb);ChatGroupEvents[_0xfef0('0x5')](_0x11ab77,_0x4618fb);_0x2a6fcf(null);};}for(var e in events){if(events[_0xfef0('0x6')](e)){var event=events[e];ChatGroup[_0xfef0('0x7')](e,emitEvent(event));}}module[_0xfef0('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x8357=['events','../../mysqldb','setMaxListeners','save','update','emit','hook','exports'];(function(_0x2c9e54,_0x178247){var _0x25d074=function(_0x14e87e){while(--_0x14e87e){_0x2c9e54['push'](_0x2c9e54['shift']());}};_0x25d074(++_0x178247);}(_0x8357,0x140));var _0x7835=function(_0x5c5b95,_0x3994b4){_0x5c5b95=_0x5c5b95-0x0;var _0x26a867=_0x8357[_0x5c5b95];return _0x26a867;};'use strict';var EventEmitter=require(_0x7835('0x0'));var ChatGroup=require(_0x7835('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7835('0x2')](0x0);var events={'afterCreate':_0x7835('0x3'),'afterUpdate':_0x7835('0x4'),'afterDestroy':'remove'};function emitEvent(_0x468407){return function(_0x2f2cbe,_0x5e12bb,_0x2b1a89){ChatGroupEvents[_0x7835('0x5')](_0x468407+':'+_0x2f2cbe['id'],_0x2f2cbe);ChatGroupEvents[_0x7835('0x5')](_0x468407,_0x2f2cbe);_0x2b1a89(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x7835('0x6')](e,emitEvent(event));}}module[_0x7835('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3aaa71a..c9f4bbd 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 _0x061a=['./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x061a,0x86));var _0xa061=function(_0x4d5d70,_0x596ebe){_0x4d5d70=_0x4d5d70-0x0;var _0x3c1a83=_0x061a[_0x4d5d70];return _0x3c1a83;};'use strict';var _=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var logger=require(_0xa061('0x2'))(_0xa061('0x3'));var moment=require(_0xa061('0x4'));var BPromise=require(_0xa061('0x5'));var rp=require(_0xa061('0x6'));var fs=require('fs');var path=require(_0xa061('0x7'));var rimraf=require('rimraf');var config=require(_0xa061('0x8'));var attributes=require(_0xa061('0x9'));module[_0xa061('0xa')]=function(_0x250898,_0x25f283){return _0x250898['define'](_0xa061('0xb'),attributes,{'tableName':_0xa061('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x971a=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x971a,0x177));var _0xa971=function(_0x18cabd,_0x4c086d){_0x18cabd=_0x18cabd-0x0;var _0x737f87=_0x971a[_0x18cabd];return _0x737f87;};'use strict';var _=require('lodash');var util=require(_0xa971('0x0'));var logger=require(_0xa971('0x1'))(_0xa971('0x2'));var moment=require('moment');var BPromise=require(_0xa971('0x3'));var rp=require(_0xa971('0x4'));var fs=require('fs');var path=require(_0xa971('0x5'));var rimraf=require(_0xa971('0x6'));var config=require(_0xa971('0x7'));var attributes=require(_0xa971('0x8'));module[_0xa971('0x9')]=function(_0x536b51,_0x449d8b){return _0x536b51[_0xa971('0xa')](_0xa971('0xb'),attributes,{'tableName':_0xa971('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 3954a34..651a181 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 _0xd0bb=['moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x22895c,_0x4513e2){var _0x4b615d=function(_0x4787d7){while(--_0x4787d7){_0x22895c['push'](_0x22895c['shift']());}};_0x4b615d(++_0x4513e2);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x62acd5,_0x4ddb49){_0x62acd5=_0x62acd5-0x0;var _0x227ab4=_0xd0bb[_0x62acd5];return _0x227ab4;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});config[_0xbd0b('0xa')]=_[_0xbd0b('0xb')](config['redis'],{'host':_0xbd0b('0xc'),'port':0x18eb});var socket=require(_0xbd0b('0xd'))(new Redis(config[_0xbd0b('0xa')]));require(_0xbd0b('0xe'))[_0xbd0b('0xf')](socket);function respondWithRpcPromise(_0x53d5e8,_0x51cf98,_0x14bc5b){return new BPromise(function(_0x110cf1,_0x4a69ff){return client[_0xbd0b('0x10')](_0x53d5e8,_0x14bc5b)[_0xbd0b('0x11')](function(_0x526258){logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));logger[_0xbd0b('0x15')](_0xbd0b('0x16'),_0x51cf98,_0xbd0b('0x14'),JSON[_0xbd0b('0x17')](_0x526258));if(_0x526258[_0xbd0b('0x18')]){if(_0x526258[_0xbd0b('0x18')][_0xbd0b('0x19')]===0x1f4){logger[_0xbd0b('0x18')]('ChatGroup,\x20%s,\x20%s',_0x51cf98,_0x526258[_0xbd0b('0x18')]['message']);return _0x4a69ff(_0x526258['error'][_0xbd0b('0x1a')]);}logger[_0xbd0b('0x18')](_0xbd0b('0x13'),_0x51cf98,_0x526258[_0xbd0b('0x18')][_0xbd0b('0x1a')]);return _0x110cf1(_0x526258['error']['message']);}else{logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));_0x110cf1(_0x526258[_0xbd0b('0x1b')][_0xbd0b('0x1a')]);}})[_0xbd0b('0x1c')](function(_0x5aeb79){logger[_0xbd0b('0x18')]('ChatGroup,\x20%s,\x20%s',_0x51cf98,_0x5aeb79);_0x4a69ff(_0x5aeb79);});});} \ No newline at end of file +var _0x3d5d=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x224d08,_0xce2e9f){var _0x24c699=function(_0x2a851f){while(--_0x2a851f){_0x224d08['push'](_0x224d08['shift']());}};_0x24c699(++_0xce2e9f);}(_0x3d5d,0x104));var _0xd3d5=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x3d5d[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xd3d5('0x0'));var util=require(_0xd3d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3d5('0x2'));var fs=require('fs');var Redis=require(_0xd3d5('0x3'));var db=require(_0xd3d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3d5('0x5'))(_0xd3d5('0x6'));var config=require(_0xd3d5('0x7'));var jayson=require(_0xd3d5('0x8'));var client=jayson['client'][_0xd3d5('0x9')]({'port':0x232a});config['redis']=_[_0xd3d5('0xa')](config[_0xd3d5('0xb')],{'host':_0xd3d5('0xc'),'port':0x18eb});var socket=require(_0xd3d5('0xd'))(new Redis(config['redis']));require(_0xd3d5('0xe'))[_0xd3d5('0xf')](socket);function respondWithRpcPromise(_0x209305,_0x5c66cf,_0x3e64c4){return new BPromise(function(_0x3fba26,_0x5a2468){return client[_0xd3d5('0x10')](_0x209305,_0x3e64c4)[_0xd3d5('0x11')](function(_0x3e8301){logger[_0xd3d5('0x12')]('ChatGroup,\x20%s,\x20%s',_0x5c66cf,'request\x20sent');logger[_0xd3d5('0x13')](_0xd3d5('0x14'),_0x5c66cf,_0xd3d5('0x15'),JSON[_0xd3d5('0x16')](_0x3e8301));if(_0x3e8301[_0xd3d5('0x17')]){if(_0x3e8301['error'][_0xd3d5('0x18')]===0x1f4){logger[_0xd3d5('0x17')](_0xd3d5('0x19'),_0x5c66cf,_0x3e8301['error'][_0xd3d5('0x1a')]);return _0x5a2468(_0x3e8301['error']['message']);}logger[_0xd3d5('0x17')]('ChatGroup,\x20%s,\x20%s',_0x5c66cf,_0x3e8301[_0xd3d5('0x17')][_0xd3d5('0x1a')]);return _0x3fba26(_0x3e8301[_0xd3d5('0x17')]['message']);}else{logger[_0xd3d5('0x12')](_0xd3d5('0x19'),_0x5c66cf,_0xd3d5('0x15'));_0x3fba26(_0x3e8301[_0xd3d5('0x1b')][_0xd3d5('0x1a')]);}})[_0xd3d5('0x1c')](function(_0x42e079){logger[_0xd3d5('0x17')]('ChatGroup,\x20%s,\x20%s',_0x5c66cf,_0x42e079);_0x5a2468(_0x42e079);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 94eb806..76466f3 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 _0x9794=['removeListener','register','length','chatGroup:','./chatGroup.events','remove','update'];(function(_0x2318b2,_0x5737ed){var _0x56634a=function(_0x3001c2){while(--_0x3001c2){_0x2318b2['push'](_0x2318b2['shift']());}};_0x56634a(++_0x5737ed);}(_0x9794,0xdd));var _0x4979=function(_0x513d26,_0x5ea61f){_0x513d26=_0x513d26-0x0;var _0x42dd7a=_0x9794[_0x513d26];return _0x42dd7a;};'use strict';var ChatGroupEvents=require(_0x4979('0x0'));var events=['save',_0x4979('0x1'),_0x4979('0x2')];function createListener(_0x5c8287,_0x54eff4){return function(_0x293ec3){_0x54eff4['emit'](_0x5c8287,_0x293ec3);};}function removeListener(_0x2380cd,_0x126c77){return function(){ChatGroupEvents[_0x4979('0x3')](_0x2380cd,_0x126c77);};}exports[_0x4979('0x4')]=function(_0x24184c){for(var _0x4d77ee=0x0,_0x3d6231=events[_0x4979('0x5')];_0x4d77ee<_0x3d6231;_0x4d77ee++){var _0x297b7a=events[_0x4d77ee];var _0x344996=createListener(_0x4979('0x6')+_0x297b7a,_0x24184c);ChatGroupEvents['on'](_0x297b7a,_0x344996);}}; \ No newline at end of file +var _0xa0ae=['chatGroup:','./chatGroup.events','update','emit','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa0ae,0xe7));var _0xea0a=function(_0x28e4ec,_0x22f691){_0x28e4ec=_0x28e4ec-0x0;var _0x161a64=_0xa0ae[_0x28e4ec];return _0x161a64;};'use strict';var ChatGroupEvents=require(_0xea0a('0x0'));var events=['save','remove',_0xea0a('0x1')];function createListener(_0x3b624f,_0x57a0f4){return function(_0x4d9058){_0x57a0f4[_0xea0a('0x2')](_0x3b624f,_0x4d9058);};}function removeListener(_0x1ef389,_0x6891b9){return function(){ChatGroupEvents['removeListener'](_0x1ef389,_0x6891b9);};}exports[_0xea0a('0x3')]=function(_0x7489cd){for(var _0x2590b8=0x0,_0x158447=events['length'];_0x2590b8<_0x158447;_0x2590b8++){var _0x57376b=events[_0x2590b8];var _0x55d26f=createListener(_0xea0a('0x4')+_0x57376b,_0x7489cd);ChatGroupEvents['on'](_0x57376b,_0x55d26f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 09b3abf..0afe456 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 _0xc177=['removeMembers','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','getUnread','/:id/members','/:id/messages','getMessages','post','addMessage','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc177,0x12c));var _0x7c17=function(_0xb1ecad,_0x3dced1){_0xb1ecad=_0xb1ecad-0x0;var _0x40acd2=_0xc177[_0xb1ecad];return _0x40acd2;};'use strict';var multer=require(_0x7c17('0x0'));var util=require(_0x7c17('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c17('0x2'));var router=express[_0x7c17('0x3')]();var fs_extra=require(_0x7c17('0x4'));var auth=require(_0x7c17('0x5'));var interaction=require(_0x7c17('0x6'));var config=require(_0x7c17('0x7'));var controller=require(_0x7c17('0x8'));router[_0x7c17('0x9')]('/',auth[_0x7c17('0xa')](),controller['index']);router[_0x7c17('0x9')]('/describe',auth[_0x7c17('0xa')](),controller['describe']);router[_0x7c17('0x9')](_0x7c17('0xb'),auth[_0x7c17('0xa')](),controller['show']);router[_0x7c17('0x9')]('/:id/unread',auth['isAuthenticated'](),controller[_0x7c17('0xc')]);router['get'](_0x7c17('0xd'),auth[_0x7c17('0xa')](),controller['getMembers']);router[_0x7c17('0x9')](_0x7c17('0xe'),auth['isAuthenticated'](),controller[_0x7c17('0xf')]);router[_0x7c17('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c17('0x10')](_0x7c17('0xd'),auth[_0x7c17('0xa')](),controller['addMembers']);router[_0x7c17('0x10')](_0x7c17('0xe'),auth[_0x7c17('0xa')](),controller[_0x7c17('0x11')]);router[_0x7c17('0x12')](_0x7c17('0xb'),auth[_0x7c17('0xa')](),controller[_0x7c17('0x13')]);router[_0x7c17('0x14')](_0x7c17('0xb'),auth[_0x7c17('0xa')](),controller[_0x7c17('0x15')]);router[_0x7c17('0x14')]('/:id/members',auth[_0x7c17('0xa')](),controller[_0x7c17('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8e03=['create','/:id/members','addMessage','put','update','destroy','delete','removeMembers','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post'];(function(_0x5983f3,_0x216373){var _0x1c597f=function(_0x1fb2a7){while(--_0x1fb2a7){_0x5983f3['push'](_0x5983f3['shift']());}};_0x1c597f(++_0x216373);}(_0x8e03,0x74));var _0x38e0=function(_0x26006e,_0x19c18c){_0x26006e=_0x26006e-0x0;var _0x669312=_0x8e03[_0x26006e];return _0x669312;};'use strict';var multer=require(_0x38e0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x38e0('0x1'));var router=express[_0x38e0('0x2')]();var fs_extra=require(_0x38e0('0x3'));var auth=require(_0x38e0('0x4'));var interaction=require(_0x38e0('0x5'));var config=require(_0x38e0('0x6'));var controller=require('./chatGroup.controller');router[_0x38e0('0x7')]('/',auth[_0x38e0('0x8')](),controller[_0x38e0('0x9')]);router['get'](_0x38e0('0xa'),auth['isAuthenticated'](),controller[_0x38e0('0xb')]);router[_0x38e0('0x7')](_0x38e0('0xc'),auth[_0x38e0('0x8')](),controller['show']);router['get'](_0x38e0('0xd'),auth[_0x38e0('0x8')](),controller[_0x38e0('0xe')]);router[_0x38e0('0x7')]('/:id/members',auth[_0x38e0('0x8')](),controller[_0x38e0('0xf')]);router[_0x38e0('0x7')](_0x38e0('0x10'),auth[_0x38e0('0x8')](),controller[_0x38e0('0x11')]);router[_0x38e0('0x12')]('/',auth[_0x38e0('0x8')](),controller[_0x38e0('0x13')]);router[_0x38e0('0x12')](_0x38e0('0x14'),auth[_0x38e0('0x8')](),controller['addMembers']);router['post'](_0x38e0('0x10'),auth['isAuthenticated'](),controller[_0x38e0('0x15')]);router[_0x38e0('0x16')](_0x38e0('0xc'),auth[_0x38e0('0x8')](),controller[_0x38e0('0x17')]);router['delete'](_0x38e0('0xc'),auth[_0x38e0('0x8')](),controller[_0x38e0('0x18')]);router[_0x38e0('0x19')](_0x38e0('0x14'),auth['isAuthenticated'](),controller[_0x38e0('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index d4632f0..8f42e62 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 _0xee4e=['STRING','DATE','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT'];(function(_0x589890,_0x1578c9){var _0x1a023f=function(_0x558a92){while(--_0x558a92){_0x589890['push'](_0x589890['shift']());}};_0x1a023f(++_0x1578c9);}(_0xee4e,0x122));var _0xeee4=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xee4e[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0xeee4('0x0'));module[_0xeee4('0x1')]={'closed':{'type':Sequelize[_0xeee4('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xeee4('0x3')](_0xeee4('0x4'),_0xeee4('0x5')),'defaultValue':_0xeee4('0x4')},'ratingMessage':{'type':Sequelize[_0xeee4('0x6')]},'pathTranscript':{'type':Sequelize[_0xeee4('0x6')]},'mailTranscript':{'type':Sequelize[_0xeee4('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xeee4('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xeee4('0x7')]},'thirdDisposition':{'type':Sequelize[_0xeee4('0x7')]},'note':{'type':Sequelize[_0xeee4('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xeee4('0x7')]},'osName':{'type':Sequelize[_0xeee4('0x7')]},'osVersion':{'type':Sequelize[_0xeee4('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xeee4('0x7')]},'deviceType':{'type':Sequelize[_0xeee4('0x7')]},'referer':{'type':Sequelize[_0xeee4('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xeee4('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xeee4('0x8')]},'lastMsgAt':{'type':Sequelize[_0xeee4('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xeee4('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xeee4('0x7')]},'customerPort':{'type':Sequelize[_0xeee4('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xeee4('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xeee4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0db9=['long','DATE','BOOLEAN','sequelize','ENUM','star','TEXT','STRING'];(function(_0x50cd58,_0x563fa0){var _0x15594a=function(_0x145cc9){while(--_0x145cc9){_0x50cd58['push'](_0x50cd58['shift']());}};_0x15594a(++_0x563fa0);}(_0x0db9,0xa3));var _0x90db=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x0db9[_0x289a67];return _0x572b49;};'use strict';var Sequelize=require(_0x90db('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x90db('0x1')](_0x90db('0x2'),'thumb'),'defaultValue':_0x90db('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x90db('0x3')]},'mailTranscript':{'type':Sequelize[_0x90db('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x90db('0x4')]},'secondDisposition':{'type':Sequelize[_0x90db('0x4')]},'thirdDisposition':{'type':Sequelize[_0x90db('0x4')]},'note':{'type':Sequelize[_0x90db('0x4')]},'browserName':{'type':Sequelize[_0x90db('0x4')]},'browserVersion':{'type':Sequelize[_0x90db('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x90db('0x4')]},'deviceModel':{'type':Sequelize[_0x90db('0x4')]},'deviceVendor':{'type':Sequelize[_0x90db('0x4')]},'deviceType':{'type':Sequelize[_0x90db('0x4')]},'referer':{'type':Sequelize[_0x90db('0x3')]},'customerIp':{'type':Sequelize[_0x90db('0x4')]},'formData':{'type':Sequelize[_0x90db('0x3')](_0x90db('0x5'))},'read1stAt':{'type':Sequelize[_0x90db('0x6')]},'lastMsgAt':{'type':Sequelize[_0x90db('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x90db('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x90db('0x4')]},'customerPort':{'type':Sequelize[_0x90db('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x90db('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x90db('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9d98372..f6f0941 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 _0x9ffd=['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','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','params','includeAll','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooNote','vidaooApiKey','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','include','includeAgent','push','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','CmContact','firstName','attachments','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','stack','name','render','merge','body','contact','account','Users','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','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?'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x184bee,_0x2f56bf){_0x184bee=_0x184bee-0x0;var _0x5246cb=_0x9ffd[_0x184bee];return _0x5246cb;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var pdf=require(_0xd9ff('0x13'));var hardwareService=require(_0xd9ff('0x14'));var logger=require(_0xd9ff('0x15'))(_0xd9ff('0x16'));var utils=require(_0xd9ff('0x17'));var config=require(_0xd9ff('0x18'));var licenseUtil=require(_0xd9ff('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x1a')](config[_0xd9ff('0x1b')],{'host':_0xd9ff('0x1c'),'port':0x18eb});var socket=require(_0xd9ff('0x1d'))(new Redis(config[_0xd9ff('0x1b')]));require('./chatInteraction.socket')[_0xd9ff('0x1e')](socket);var jayson=require(_0xd9ff('0x1f'));var client=jayson['client'][_0xd9ff('0x20')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x547e28,_0x4c5718,_0x271287,_0x4f9d6d){return new BPromise(function(_0x35679e,_0xa30fd2){var _0x39c6ce=_0x4f9d6d||client;return _0x39c6ce[_0xd9ff('0x21')](_0x547e28,_0x271287)[_0xd9ff('0x22')](function(_0x2d4df1){logger[_0xd9ff('0x23')](_0xd9ff('0x24'),_0x4c5718,_0xd9ff('0x25'));logger[_0xd9ff('0x26')](_0xd9ff('0x27'),_0x4c5718,_0xd9ff('0x25'),JSON[_0xd9ff('0x28')](_0x2d4df1));if(_0x2d4df1['error']){if(_0x2d4df1['error'][_0xd9ff('0x29')]===0x1f4){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x2d4df1['error']['message']);return _0xa30fd2(_0x2d4df1['error'][_0xd9ff('0x2b')]);}logger['error'](_0xd9ff('0x24'),_0x4c5718,_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);return _0x35679e(_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);}else{logger[_0xd9ff('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,'request\x20sent');_0x35679e(_0x2d4df1[_0xd9ff('0x2c')]['message']);}})[_0xd9ff('0x2d')](function(_0x4d86fe){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x4d86fe);_0xa30fd2(_0x4d86fe);});});}function respondWithStatusCode(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0xcc;return function(_0x2138b4){if(_0x2138b4){return _0x10cbdd[_0xd9ff('0x2e')](_0x159e56);}return _0x10cbdd['status'](_0x159e56)[_0xd9ff('0x2f')]();};}function respondWithResult(_0xe11f88,_0x1c78c4){_0x1c78c4=_0x1c78c4||0xc8;return function(_0x4390f7){if(_0x4390f7){return _0xe11f88['status'](_0x1c78c4)[_0xd9ff('0x30')](_0x4390f7);}};}function respondWithFilteredResult(_0x3792d9,_0x44b5a7){return function(_0x45fb63){if(_0x45fb63){var _0x263d3a=typeof _0x44b5a7[_0xd9ff('0x31')]===_0xd9ff('0x32')&&typeof _0x44b5a7[_0xd9ff('0x33')]===_0xd9ff('0x32');var _0x5706cf=_0x45fb63[_0xd9ff('0x34')];var _0x4ba2be=_0x263d3a?0x0:_0x44b5a7[_0xd9ff('0x31')];var _0x29c532=_0x263d3a?_0x45fb63[_0xd9ff('0x34')]:_0x44b5a7['offset']+_0x44b5a7[_0xd9ff('0x33')];var _0x3b26da;if(_0x29c532>=_0x5706cf){_0x29c532=_0x5706cf;_0x3b26da=0xc8;}else{_0x3b26da=0xce;}_0x3792d9[_0xd9ff('0x35')](_0x3b26da);return _0x3792d9[_0xd9ff('0x36')]('Content-Range',_0x4ba2be+'-'+_0x29c532+'/'+_0x5706cf)[_0xd9ff('0x30')](_0x45fb63);}return null;};}function patchUpdates(_0x5743de){return function(_0x18c28b){try{jsonpatch[_0xd9ff('0x37')](_0x18c28b,_0x5743de,!![]);}catch(_0x323cb5){return BPromise[_0xd9ff('0x38')](_0x323cb5);}return _0x18c28b[_0xd9ff('0x39')]();};}function saveUpdates(_0xdf3947,_0x2cc2ae){return function(_0x281c7b){if(_0x281c7b){return _0x281c7b[_0xd9ff('0x3a')](_0xdf3947)[_0xd9ff('0x22')](function(_0x4813a5){return _0x4813a5;});}return null;};}function removeEntity(_0x34e9a9,_0x4670e4){return function(_0x66f4d){if(_0x66f4d){return _0x66f4d['destroy']()[_0xd9ff('0x22')](function(){_0x34e9a9[_0xd9ff('0x35')](0xcc)[_0xd9ff('0x2f')]();});}};}function handleEntityNotFound(_0x4ab10f,_0x3d449d){return function(_0x5e3ff9){if(!_0x5e3ff9){_0x4ab10f[_0xd9ff('0x2e')](0x194);}return _0x5e3ff9;};}function handleError(_0x4ae56b,_0x20a021){_0x20a021=_0x20a021||0x1f4;return function(_0x5db498){logger[_0xd9ff('0x2a')](_0x5db498[_0xd9ff('0x3b')]);if(_0x5db498[_0xd9ff('0x3c')]){delete _0x5db498['name'];}_0x4ae56b['status'](_0x20a021)['send'](_0x5db498);};}function getMustacheRender(_0x7ac3d1,_0x30fc5b){return Mustache[_0xd9ff('0x3d')](_0x7ac3d1,_[_0xd9ff('0x3e')](_0x30fc5b[_0xd9ff('0x3f')],{'contact':_0x30fc5b[_0xd9ff('0x40')],'message':_0x30fc5b['message'],'agent':_0x30fc5b['agent'],'interaction':_0x30fc5b['interaction'],'account':_0x30fc5b[_0xd9ff('0x41')]}))||'';}function getInteractionUsers(_0x252edc,_0x918c9a){return new BPromise(function(_0x32adae,_0x56b94d){try{if(_0x918c9a[_0x252edc['id']]){_0x252edc[_0xd9ff('0x42')]=_['map'](_0x918c9a[_0x252edc['id']],function(_0x3cff52){return{'id':_0x3cff52['id'],'fullname':_0x3cff52[_0xd9ff('0x43')]};});}}catch(_0x1bedaf){_0x56b94d(_0x1bedaf);}_0x32adae(_0x252edc);});}function getInteractionTags(_0x169dc7,_0x59fc07){return new BPromise(function(_0x1e34da,_0x2d4d97){try{if(_0x169dc7['TagIds']){_0x169dc7[_0xd9ff('0x44')]=[];_0x169dc7[_0xd9ff('0x45')][_0xd9ff('0x46')](',')[_0xd9ff('0x47')](function(_0x1fe44d){_0x169dc7[_0xd9ff('0x44')]['push'](_0x59fc07[_0x1fe44d]);});}delete _0x169dc7[_0xd9ff('0x45')];}catch(_0x116f28){_0x2d4d97(_0x116f28);}_0x1e34da(_0x169dc7);});}function updateChatInteraction(_0x10533a,_0x39fbbb,_0x472724){return new BPromise(function(_0x52aab8,_0x3178cd){return getInteractionUsers(_0x10533a,_0x472724)[_0xd9ff('0x22')](function(_0xe0bc49){return getInteractionTags(_0xe0bc49,_0x39fbbb);})['then'](function(_0x5d06dd){_0x52aab8(_0x5d06dd);})[_0xd9ff('0x2d')](function(_0x7eb1a){_0x3178cd(_0x7eb1a);});});}exports[_0xd9ff('0x48')]=function(_0x2dfb8f,_0x437561){var _0x30c69d={},_0x564ef4={},_0xd64585={'count':0x0,'rows':[]};var _0x2d3013=_['map'](db[_0xd9ff('0x49')][_0xd9ff('0x4a')],function(_0x13a1ec){return{'name':_0x13a1ec[_0xd9ff('0x4b')],'type':_0x13a1ec[_0xd9ff('0x4c')]['key']};});_0x564ef4['model']=_['map'](_0x2d3013,_0xd9ff('0x3c'));_0x564ef4['query']=_[_0xd9ff('0x4d')](_0x2dfb8f[_0xd9ff('0x4e')]);_0x564ef4[_0xd9ff('0x4f')]=_['intersection'](_0x564ef4[_0xd9ff('0x50')],_0x564ef4[_0xd9ff('0x4e')]);_0x30c69d['attributes']=_[_0xd9ff('0x51')](_0x564ef4[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x2dfb8f[_0xd9ff('0x4e')]['fields']));_0x30c69d[_0xd9ff('0x53')]=_0x30c69d['attributes'][_0xd9ff('0x54')]?_0x30c69d['attributes']:_0x564ef4[_0xd9ff('0x50')];if(!_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x30c69d[_0xd9ff('0x33')]=qs['limit'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2dfb8f['query']['offset']);}_0x30c69d['order']=qs[_0xd9ff('0x57')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x30c69d['where']=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0x2dfb8f[_0xd9ff('0x4e')],_0x564ef4[_0xd9ff('0x4f')]),_0x2d3013);var _0xfede73=[];var _0x40d391=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5a')]('id')[_0xd9ff('0x5a')](_0xd9ff('0x3c'))[_0xd9ff('0x5a')](_0xd9ff('0x5b'))[_0xd9ff('0x5c')]('tools_tags');var _0x3ed112=squel['select']()[_0xd9ff('0x5a')]('u.id')[_0xd9ff('0x5a')]('u.fullname')[_0xd9ff('0x5a')]('ui.ChatInteractionId')[_0xd9ff('0x5c')]('user_has_chat_interactions','ui')[_0xd9ff('0x5d')]('users','u',_0xd9ff('0x5e'));var _0x5da1a8=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5c')](_0xd9ff('0x5f'),'i')[_0xd9ff('0x5d')]('cm_contacts','c',_0xd9ff('0x60'))[_0xd9ff('0x5d')](_0xd9ff('0x61'),'o','o.id\x20=\x20i.UserId')[_0xd9ff('0x5d')](_0xd9ff('0x62'),'a',_0xd9ff('0x63'))[_0xd9ff('0x5d')](_0xd9ff('0x64'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xd9ff('0x5d')](_0xd9ff('0x65'),'it',_0xd9ff('0x66'))[_0xd9ff('0x5d')](_0xd9ff('0x67'),'t',_0xd9ff('0x68'));var _0x458fd4=squel['expr']();var _0x3be850=[];var _0x11251f=squel['expr']();var _0x1c885f;if(_0x2dfb8f[_0xd9ff('0x4e')]['search']){_0x1c885f=as[_0xd9ff('0x69')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x6a')]);var _0x54ea27=_0x1c885f['sqlOperator'];for(var _0x39473e=0x0;_0x39473e<_0x1c885f['conditions'][_0xd9ff('0x54')];_0x39473e++){var _0x1e4d0c=_0x1c885f[_0xd9ff('0x6b')][_0x39473e];var _0x102aea='i';var _0x53a230=_['find'](_0x2d3013,['name',_0x1e4d0c[_0xd9ff('0x5a')]]);if(!_0x53a230){switch(_0x1e4d0c[_0xd9ff('0x5a')]){case _0xd9ff('0x6c'):if(_0x1e4d0c[_0xd9ff('0x6d')]==0x1){_0x5da1a8[_0xd9ff('0x6e')]('`'+_0x1e4d0c['field']+_0xd9ff('0x6f'));}else{_0x5da1a8['having']('`'+_0x1e4d0c[_0xd9ff('0x5a')]+_0xd9ff('0x70'));}break;case _0xd9ff('0x71'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){if(_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')]('\x20')[_0xd9ff('0x54')]>0x1){_0x458fd4[_0x54ea27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd9ff('0x74')](_0x1e4d0c[_0xd9ff('0x6d')]),null);}else{var _0x4f5338='%'+_0x1e4d0c['value']+'%';_0x458fd4[_0x54ea27](_0xd9ff('0x75'),_0x4f5338,_0x4f5338,_0x4f5338);}}else{_0x53a230=_['find'](_0x2d3013,[_0xd9ff('0x3c'),_0xd9ff('0x76')]);_0x1e4d0c['field']=_0xd9ff('0x76');_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')]['start'],_0x58c9c2[_0xd9ff('0x6d')]['end']);}break;case'Tag':var _0x3dabb1=_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')](',')[_0xd9ff('0x79')](function(_0x56d822){return Number(_0x56d822);});_0x3dabb1[_0xd9ff('0x47')](function(_0x23b816){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x23b816+',%');});_0x3be850=_[_0xd9ff('0x7b')](_0x3be850,_0x3dabb1);break;case _0xd9ff('0x7c'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){_0x458fd4[_0x54ea27](_0xd9ff('0x7d'),'%'+_0x1e4d0c['value']+'%',null);}else{_0x53a230=_['find'](_0x2d3013,['name',_0xd9ff('0x7e')]);_0x1e4d0c[_0xd9ff('0x5a')]='UserId';_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}break;case _0xd9ff('0x3f'):_0x58c9c2=as['buildExpression']('me',null,_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2['value'][_0xd9ff('0x2f')]);break;}}else{var _0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2['value'][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}}}else{var _0x1cd620=_(_0x2dfb8f['query'])[_0xd9ff('0x4d')]()[_0xd9ff('0x79')](function(_0x1de5c9){return _['some'](_0x2d3013,[_0xd9ff('0x3c'),_0x1de5c9])?_0x1de5c9:undefined;})[_0xd9ff('0x80')]()[_0xd9ff('0x6d')]();if(!_['isEmpty'](_0x1cd620)){_0x1cd620[_0xd9ff('0x47')](function(_0x35926f){if(_0x35926f===_0xd9ff('0x81')){_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0x83'),[]['concat'](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]));}else if(_0x35926f===_0xd9ff('0x84')){var _0x59af0a=JSON[_0xd9ff('0x85')](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f])[_0xd9ff('0x86')];var _0x5d1973=JSON[_0xd9ff('0x85')](_0x2dfb8f['query'][_0x35926f])[_0xd9ff('0x87')];_0x5da1a8['where'](_0xd9ff('0x88'),_0x59af0a,_0x5d1973);}else{if(_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]===_0xd9ff('0x89')){_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8a'));}else{_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8b'),_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]);}}});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8c')]){if(_0x2dfb8f['query'][_0xd9ff('0x8c')]==0x1){_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8d'));}else{_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8e'));}}if(_0x2dfb8f[_0xd9ff('0x4e')]['tag']){_0x3be850=_['isArray'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')])?_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]:new Array(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]);_0x3be850['forEach'](function(_0x1d34a1){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x1d34a1+',%');});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x90')]){var _0x14c89f=_0x2dfb8f[_0xd9ff('0x4e')]['filter'][_0xd9ff('0x91')]('\x5c','\x5c\x5c')[_0xd9ff('0x91')](/'/g,'\x27\x27');if(qs[_0xd9ff('0x92')](_0x14c89f)){_0x458fd4['or'](_0xd9ff('0x93'),_0x14c89f+'%');}else{_0x458fd4['or'](_0xd9ff('0x94'),qs[_0xd9ff('0x74')](_0x14c89f))['or'](_0xd9ff('0x95'),_0x14c89f+'%');}}}_0x5da1a8[_0xd9ff('0x82')](_0x458fd4);_0x5da1a8['group'](_0xd9ff('0x96'));var _0x4c2ad5={'type':db[_0xd9ff('0x97')][_0xd9ff('0x98')][_0xd9ff('0x99')],'raw':!![]};var _0x2d2d1c=_0x5da1a8[_0xd9ff('0x9a')]();_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x96'));_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));if(_0x30c69d[_0xd9ff('0x9c')]){_0x30c69d[_0xd9ff('0x9c')][_0xd9ff('0x47')](function(_0x5d29b9){var _0x4413c4=_0x5d29b9[0x0]===_0xd9ff('0x9d')?_0x5d29b9[0x0]:'i.'+_0x5d29b9[0x0];_0x5da1a8[_0xd9ff('0x9c')](_0x4413c4,_0x5d29b9[0x1]===_0xd9ff('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x3be850)){_0x5da1a8[_0xd9ff('0x6e')](_0x11251f);_0x2d2d1c[_0xd9ff('0x82')]('t.id\x20IN\x20?',_0x3be850);}BPromise[_0xd9ff('0x9f')]()[_0xd9ff('0x22')](function(){if(!_0x1c885f){if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x81')])return;_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa0'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2dfb8f[_0xd9ff('0xa1')]['role']!==_0xd9ff('0xa2'))return;return _0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa3')]({'attributes':['id'],'raw':!![]})[_0xd9ff('0x22')](function(_0x320adb){if(_[_0xd9ff('0xa4')](_0x320adb)){_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa5'));_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0xa5'));}else{_0x2d2d1c[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));}});})[_0xd9ff('0x22')](function(){if(_0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa6')]===_0xd9ff('0xa2')&&!_0x1c885f&&!_0x2dfb8f[_0xd9ff('0x4e')]['ChatWebsiteId'])return[];return db['sequelize'][_0xd9ff('0x4e')](_0x2d2d1c['toString'](),_0x4c2ad5);})['then'](function(_0x4a55c1){_0xd64585['count']=_0x4a55c1[_0xd9ff('0x54')];if(_0xd64585[_0xd9ff('0x34')]===0x0)return[];return db[_0xd9ff('0xa7')]['query'](_0x40d391['toString'](),_0x4c2ad5)[_0xd9ff('0x22')](function(_0x5e7f52){_0xfede73=_[_0xd9ff('0xa8')](_0x5e7f52,'id');_0x4c2ad5=_['merge'](_0x4c2ad5,{'model':db[_0xd9ff('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x52')]){_0x30c69d[_0xd9ff('0x53')][_0xd9ff('0x47')](function(_0x4e6dd2){_0x5da1a8['field']('i.'+_0x4e6dd2);});}else{_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xa9'),'Account.key');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xaa'),_0xd9ff('0xab'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xac'),_0xd9ff('0x9d'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xad'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xae'),_0xd9ff('0xaf'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb0'),'Contact.lastName');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb1'),'Contact.email');_0x5da1a8['field'](_0xd9ff('0xb2'),_0xd9ff('0xb3'));_0x5da1a8['field'](_0xd9ff('0xb4'),_0xd9ff('0xb5'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb6'),_0xd9ff('0xb7'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb8'),_0xd9ff('0xb9'));_0x5da1a8['field']('o.internal','Owner.internal');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xba'),_0xd9ff('0x45'));}if(_0x30c69d['limit'])_0x5da1a8[_0xd9ff('0x33')](_0x30c69d[_0xd9ff('0x33')]);if(_0x30c69d[_0xd9ff('0x31')])_0x5da1a8[_0xd9ff('0x31')](_0x30c69d[_0xd9ff('0x31')]);return db[_0xd9ff('0xa7')]['query'](_0x5da1a8[_0xd9ff('0xbb')](),_0x4c2ad5);})['then'](function(_0x5cb3af){if(_0x5cb3af[_0xd9ff('0x54')]>0x0)_0x3ed112[_0xd9ff('0x82')](_0xd9ff('0xbc'),_['map'](_0x5cb3af,'id'));return db[_0xd9ff('0xa7')][_0xd9ff('0x4e')](_0x3ed112['toString'](),_0x4c2ad5)['then'](function(_0x4aa6d5){var _0x11840a=_[_0xd9ff('0xbd')](_0x4aa6d5,'ChatInteractionId');var _0x2871ec=[];_0x5cb3af[_0xd9ff('0x47')](function(_0x16e130){_0x2871ec['push'](updateChatInteraction(_0x16e130,_0xfede73,_0x11840a));});return BPromise['all'](_0x2871ec);});});})['then'](function(_0xdf2e33){_0xd64585['rows']=_0xdf2e33;return _0xd64585;})[_0xd9ff('0x22')](respondWithFilteredResult(_0x437561,_0x30c69d))[_0xd9ff('0x2d')](handleError(_0x437561,null));};exports['show']=function(_0x1b048b,_0x5eeeaf){var _0x3339e5={'raw':![],'where':{'id':_0x1b048b[_0xd9ff('0xbe')]['id']}},_0x1f7d87={};_0x1f7d87['model']=_[_0xd9ff('0x4d')](db['ChatInteraction']['rawAttributes']);_0x1f7d87['query']=_[_0xd9ff('0x4d')](_0x1b048b[_0xd9ff('0x4e')]);_0x1f7d87[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x1f7d87['model'],_0x1f7d87['query']);_0x3339e5[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x1f7d87[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x1b048b[_0xd9ff('0x4e')]['fields']));_0x3339e5['attributes']=_0x3339e5[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x3339e5[_0xd9ff('0x53')]:_0x1f7d87[_0xd9ff('0x50')];if(_0x1b048b[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x3339e5['include']=[{'all':!![]}];}_0x3339e5=_[_0xd9ff('0x3e')]({},_0x3339e5,_0x1b048b['options']);return db['ChatInteraction'][_0xd9ff('0xc0')](_0x3339e5)[_0xd9ff('0x22')](handleEntityNotFound(_0x5eeeaf,null))[_0xd9ff('0x22')](respondWithResult(_0x5eeeaf,null))[_0xd9ff('0x2d')](handleError(_0x5eeeaf,null));};exports['create']=function(_0x4e3fdd,_0x2cf8da){return db['ChatInteraction']['create'](_0x4e3fdd[_0xd9ff('0x3f')],{})['then'](respondWithResult(_0x2cf8da,0xc9))[_0xd9ff('0x2d')](handleError(_0x2cf8da,null));};exports['update']=function(_0x327cd8,_0xd95329){if(_0x327cd8[_0xd9ff('0x3f')]['id']){delete _0x327cd8[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x327cd8[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0xd95329,null))[_0xd9ff('0x22')](saveUpdates(_0x327cd8['body'],null))['then'](respondWithResult(_0xd95329,null))[_0xd9ff('0x2d')](handleError(_0xd95329,null));};exports[_0xd9ff('0xc1')]=function(_0x499869,_0x3c86ac){return db['ChatInteraction']['find']({'where':{'id':_0x499869[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x3c86ac,null))[_0xd9ff('0x22')](removeEntity(_0x3c86ac,null))[_0xd9ff('0x2d')](handleError(_0x3c86ac,null));};exports[_0xd9ff('0xc2')]=function(_0x11c84f,_0x2d0261){return db[_0xd9ff('0x49')][_0xd9ff('0xc2')]()[_0xd9ff('0x22')](respondWithResult(_0x2d0261,null))[_0xd9ff('0x2d')](handleError(_0x2d0261,null));};exports[_0xd9ff('0xc3')]=function(_0x73cfcf,_0x538f20){var _0x51feff=_0x73cfcf['params']['id'];var _0x30c62c;var _0x50b6b2;var _0x413aef;return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x51feff}})[_0xd9ff('0x22')](function(_0x54c390){_0x30c62c=_0x54c390;return db[_0xd9ff('0xc5')]['findOne']({'where':{'id':_0x54c390[_0xd9ff('0x81')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0xd9ff('0xc6'),'vidaooMetadata'],'raw':!![]});})[_0xd9ff('0x22')](function(_0x54524c){if(_0x54524c&&_0x54524c[_0xd9ff('0xc7')]&&_0x54524c[_0xd9ff('0xc8')]){_0x50b6b2=_0x54524c;var _0x696e18={'interaction':{'id':_0x51feff},'agent':{'id':_0x73cfcf[_0xd9ff('0xa1')]['id'],'name':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0x3c')],'fullname':_0x73cfcf['user']['fullname'],'email':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]},'contact':_0x73cfcf[_0xd9ff('0x3f')][_0xd9ff('0x40')],'account':_0x73cfcf[_0xd9ff('0x3f')]['account']};var _0x432854={'rejectUnauthorized':![],'method':_0xd9ff('0xca'),'url':_0xd9ff('0xcb'),'headers':{'X-APIKEY':_0x54524c[_0xd9ff('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]],'buttons':null,'topic':_0x50b6b2['vidaooTopic'],'note':_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xc6')])?null:getMustacheRender(_0x50b6b2[_0xd9ff('0xc6')],_0x696e18),'metadata':null},'redirect':_0xd9ff('0xcd'),'json':!![]};try{if(!_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xce')])){var _0x1c8e55=getMustacheRender(_0x50b6b2[_0xd9ff('0xce')],_0x696e18);var _0x29fdb8=JSON[_0xd9ff('0x85')](_0x1c8e55);_0x432854[_0xd9ff('0x3f')][_0xd9ff('0xcf')]=_0x29fdb8;}}catch(_0xfc755a){throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))](_0xd9ff('0xd1'));}return rp(_0x432854);}else{throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd9ff('0x22')](function(_0x282183){_0x413aef=_0x282183;if(_0x413aef['id']){var _0x3aba00={'body':_0x413aef[_0xd9ff('0xd2')],'ChatWebsiteId':_0x50b6b2['id'],'ChatInteractionId':_0x30c62c['id'],'direction':_0xd9ff('0xd3'),'UserId':_0x73cfcf[_0xd9ff('0xa1')]['id']};return db[_0xd9ff('0xd4')][_0xd9ff('0xd5')](_0x3aba00,{});}else{throw new db['Sequelize'][(_0xd9ff('0xd0'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd9ff('0x22')](function(){return _0x30c62c[_0xd9ff('0xd6')]({'vidaooSessionId':_0x413aef['id']});})[_0xd9ff('0x22')](respondWithResult(_0x538f20,null))[_0xd9ff('0x2d')](handleError(_0x538f20,null));};exports[_0xd9ff('0xd7')]=function(_0x204127,_0xf98666){if(_0x204127['body']['id']){delete _0x204127[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x204127[_0xd9ff('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x71')}]})[_0xd9ff('0x22')](handleEntityNotFound(_0xf98666,null))['then'](saveUpdates(_0x204127[_0xd9ff('0x3f')],null))[_0xd9ff('0x22')](respondWithResult(_0xf98666,null))['catch'](handleError(_0xf98666,null));};exports['abandon']=function(_0x5c4138,_0x560ea2,_0x1e6d5a){if(_0x5c4138[_0xd9ff('0x3f')]['id']){delete _0x5c4138[_0xd9ff('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5c4138[_0xd9ff('0xbe')]['id']}})['then'](function(_0x43a941){if(!_0x43a941){logger[_0xd9ff('0x2a')](_0xd9ff('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x560ea2['sendStatus'](0x194);}else{if(_0x43a941[_0xd9ff('0x7e')]){throw new db[(_0xd9ff('0x97'))]['ValidationError'](_0xd9ff('0xd9'));}}return _0x43a941;})[_0xd9ff('0x22')](function(_0x7efe12){if(_0x7efe12){return _0x7efe12[_0xd9ff('0x3a')]({'closed':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xda')],'disposition':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xdb')]})[_0xd9ff('0x22')](function(_0x3b7aeb){return _0x3b7aeb;});}})[_0xd9ff('0x22')](function(_0x37eb49){return respondWithRpcPromise(_0xd9ff('0xdc'),_0xd9ff('0xdd'),_0x5c4138[_0xd9ff('0x3f')],client9004);})[_0xd9ff('0x22')](respondWithResult(_0x560ea2,null))[_0xd9ff('0x2d')](handleError(_0x560ea2,null));};exports[_0xd9ff('0xde')]=function(_0x3b05c4,_0x32c04e,_0x1bcf8f){_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0x3c')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe0')];_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0xe1')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe2')];_0x3b05c4['body'][_0xd9ff('0x4c')]=_0x3b05c4[_0xd9ff('0xdf')]['mimetype'];return db[_0xd9ff('0xe3')][_0xd9ff('0xd5')](_0x3b05c4[_0xd9ff('0x3f')])[_0xd9ff('0x22')](respondWithResult(_0x32c04e,0xc9))[_0xd9ff('0x2d')](handleError(_0x32c04e,null));};exports[_0xd9ff('0xe4')]=function(_0x5978ad,_0x4ddfe7,_0x30c520){return db['ChatInteraction']['findOne']({'where':{'id':_0x5978ad[_0xd9ff('0xbe')]['id']},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null))['then'](function(_0x327362){if(_0x327362){if(_0x327362[_0xd9ff('0xda')]){return _0x4ddfe7[_0xd9ff('0x35')](0x193)[_0xd9ff('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0xd9ff('0xe3')][_0xd9ff('0xc4')]({'where':{'id':_0x5978ad['query'][_0xd9ff('0xe5')]},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null));}})['then'](function(_0x62f1f3){if(_0x62f1f3){var _0xd188cf=_0x62f1f3[_0xd9ff('0xe6')]!==null;var _0x5b2e9c=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],_0xd9ff('0xe9'));if(_0xd188cf){_0x5b2e9c=path['join'](_0x5b2e9c,_0xd9ff('0xea'));}var _0x53a25a=path[_0xd9ff('0xe7')](_0x5b2e9c,_0x62f1f3[_0xd9ff('0xe1')]);return _0x4ddfe7[_0xd9ff('0xeb')](_0x53a25a);}})[_0xd9ff('0x2d')](handleError(_0x4ddfe7,null));};exports[_0xd9ff('0xec')]=function(_0x10397d,_0x51039f){var _0x37ea50=null;var _0x3cf2ef=null;var _0x171195=null;var _0x24c066=null;if(_0x10397d[_0xd9ff('0x3f')]['id']){delete _0x10397d['body']['id'];}if(_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]){_0x24c066=path['join'](config[_0xd9ff('0xe8')],_0xd9ff('0xee'),util[_0xd9ff('0xef')](_0xd9ff('0xf0'),Date[_0xd9ff('0xf1')]()));_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xf2')]=_0x24c066;}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x10397d[_0xd9ff('0xbe')]['id']},'include':[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'include':[{'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c')}]}]})[_0xd9ff('0x22')](handleEntityNotFound(_0x51039f,null))[_0xd9ff('0x22')](saveUpdates(_0x10397d['body'],null))['then'](function(_0x497e36){if(_0x497e36){_0x37ea50=_0x497e36;return db[_0xd9ff('0xc5')]['find']({'where':{'id':_0x37ea50[_0xd9ff('0x81')]}});}})['then'](function(_0x4d4cc0){if(_0x4d4cc0){_0x171195=_0x4d4cc0;return db['CmContact'][_0xd9ff('0xc0')]({'where':{'id':_0x37ea50['ContactId']}});}})['then'](function(_0x474b4c){if(_0x474b4c){_0x3cf2ef=_0x474b4c;if(_0x24c066){var _0x144cf7=null;for(var _0x9eac7f=0x1;_0x9eac7f<_0x37ea50[_0xd9ff('0xf3')][_0xd9ff('0x54')];++_0x9eac7f){_0x144cf7=_0x37ea50[_0xd9ff('0xf3')][_0x9eac7f];var _0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');var _0x4531bc=_0x10397d['body']['customer']||util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0xd9ff('0xf7'),_0x144cf7[_0xd9ff('0x76')]);switch(_0x171195[_0xd9ff('0xf8')]){case _0xd9ff('0xf9'):_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')]('%s%d',_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');break;case _0xd9ff('0xfa'):_0x2450da=_0x144cf7['UserId']?_0x144cf7['User'][_0xd9ff('0xfb')]||_0x144cf7[_0xd9ff('0x7c')]['fullname']:_0xd9ff('0xf6');break;case _0xd9ff('0xfc'):_0x2450da=_0x144cf7['UserId']?_0x144cf7[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6');break;default:_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7['UserId']):_0xd9ff('0xf6');}var _0x62b518=util[_0xd9ff('0xef')](_0xd9ff('0xfd'),moment(_0x144cf7[_0xd9ff('0x84')])['format'](_0xd9ff('0xfe')),_0x144cf7[_0xd9ff('0xff')]==='in'?_0x4531bc:_0x2450da,_0x144cf7[_0xd9ff('0x3f')]);if(!_0x144cf7['secret']){fs[_0xd9ff('0x100')](_0x24c066,_0x62b518);}}return db[_0xd9ff('0x101')][_0xd9ff('0xc4')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd9ff('0x102'),'raw':!![]}]});}}})['then'](function(_0x5e07ae){if(_0x5e07ae&&_0x5e07ae['Smtp']&&_0x10397d['body']){var _0x578f41={'tls':{'rejectUnauthorized':![]}};if(_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')]){_0x578f41['service']=_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')];}else{_0x578f41[_0xd9ff('0x104')]=_0x5e07ae['Smtp'][_0xd9ff('0x104')];_0x578f41['port']=_0x5e07ae['Smtp'][_0xd9ff('0x105')];_0x578f41[_0xd9ff('0x106')]=_0x5e07ae[_0xd9ff('0x102')]['secure'];}if(_0x5e07ae['Smtp'][_0xd9ff('0x107')]){_0x578f41[_0xd9ff('0x108')]={'user':_0x5e07ae['Smtp'][_0xd9ff('0xa1')],'pass':_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x109')]};}return respondWithRpcPromise(_0xd9ff('0x10a'),_0xd9ff('0x10b'),{'account':_0x578f41,'message':{'from':util[_0xd9ff('0xef')](_0xd9ff('0x10c'),_0x5e07ae['name'],_0x5e07ae[_0xd9ff('0xc9')]||_0x5e07ae[_0xd9ff('0x102')]['user']),'to':_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')],'subject':'Mail\x20Transcript','text':util[_0xd9ff('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]),'attachments':[{'path':_0x24c066}]}})['then'](function(){return _0x37ea50;})[_0xd9ff('0x2d')](function(_0x4d6172){console[_0xd9ff('0x2a')](_0x4d6172);});}else{return _0x37ea50;}})[_0xd9ff('0x22')](respondWithStatusCode(_0x51039f,0xc8))[_0xd9ff('0x2d')](handleError(_0x51039f,null));};exports[_0xd9ff('0x10d')]=function(_0x6a2524,_0x356583,_0x5c1165){return db['ChatMessage'][_0xd9ff('0xc0')]({'where':{'id':_0x6a2524['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x356583,null))[_0xd9ff('0x22')](function(_0x599273){if(_0x599273){return _0x599273['addMessage'](_0x6a2524['body'][_0xd9ff('0x10e')],_[_0xd9ff('0x10f')](_0x6a2524[_0xd9ff('0x3f')],['ids','id'])||{});}})[_0xd9ff('0x22')](respondWithResult(_0x356583,null))[_0xd9ff('0x2d')](handleError(_0x356583,null));};exports[_0xd9ff('0x110')]=function(_0x2832b7,_0x618c47,_0x109140){var _0x278670={'raw':![],'where':{}};var _0x5e064d={};var _0x231b46={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x2832b7[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x618c47,null))[_0xd9ff('0x22')](function(_0x1802b1){if(_0x1802b1){_0x5e064d[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')][_0xd9ff('0x4a')]);_0x5e064d['query']=_['keys'](_0x2832b7[_0xd9ff('0x4e')]);_0x5e064d['filters']=_['intersection'](_0x5e064d[_0xd9ff('0x50')],_0x5e064d[_0xd9ff('0x4e')]);_0x278670[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x5e064d[_0xd9ff('0x50')],qs['fields'](_0x2832b7[_0xd9ff('0x4e')]['fields']));_0x278670[_0xd9ff('0x53')]=_0x278670[_0xd9ff('0x53')]['length']?_0x278670[_0xd9ff('0x53')]:_0x5e064d[_0xd9ff('0x50')];if(!_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x278670[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0x2832b7['query'][_0xd9ff('0x33')]);_0x278670[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x31')]);}_0x278670[_0xd9ff('0x9c')]=qs['sort'](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x278670[_0xd9ff('0x82')]=qs['filters'](_[_0xd9ff('0x58')](_0x2832b7['query'],_0x5e064d[_0xd9ff('0x4f')]));_0x278670['where'][_0xd9ff('0x111')]=_0x1802b1['id'];if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x278670['where']=_[_0xd9ff('0x3e')](_0x278670['where'],{'$or':_[_0xd9ff('0x79')](_0x278670[_0xd9ff('0x53')],function(_0x2b2a50){var _0x34f3f0={};_0x34f3f0[_0x2b2a50]={'$like':'%'+_0x2832b7[_0xd9ff('0x4e')]['filter']+'%'};return _0x34f3f0;})});}if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')]){var _0x955328=_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')][_0xd9ff('0x46')](',');var _0x5d95b1={};_0x5d95b1[_0x955328[0x0]]={'$gte':moment(_0x955328[0x1])['format'](_0xd9ff('0x112'))};_0x278670[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x278670[_0xd9ff('0x82')],_0x5d95b1);}_0x278670=_[_0xd9ff('0x3e')]({},_0x278670,_0x2832b7[_0xd9ff('0x113')]);return db[_0xd9ff('0xd4')]['count']({'where':_0x278670[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x3e90fe){_0x231b46[_0xd9ff('0x34')]=_0x3e90fe;if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x278670['include']=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x278670);})[_0xd9ff('0x22')](function(_0x33f933){_0x231b46[_0xd9ff('0x115')]=_0x33f933;return _0x231b46;});}})[_0xd9ff('0x22')](respondWithFilteredResult(_0x618c47,_0x278670))['catch'](handleError(_0x618c47,null));};exports['getMyMessages']=function(_0xf3a93b,_0x473ecf,_0x1213a4){var _0x6f731a={'where':{}},_0x193c57={},_0x4572b2={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0xf3a93b['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x473ecf,null))[_0xd9ff('0x22')](function(_0x4115a3){if(_0x4115a3){_0x193c57[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')]['rawAttributes']);_0x193c57[_0xd9ff('0x4e')]=_['keys'](_0xf3a93b['query']);_0x193c57[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],_0x193c57[_0xd9ff('0x4e')]);_0x6f731a[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0xf3a93b['query'][_0xd9ff('0x52')]));_0x6f731a['attributes']=_0x6f731a[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x6f731a[_0xd9ff('0x53')]:_0x193c57[_0xd9ff('0x50')];if(!_0xf3a93b['query'][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x6f731a[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x6f731a[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0xf3a93b[_0xd9ff('0x4e')]['offset']);}_0x6f731a[_0xd9ff('0x9c')]=qs['sort'](_0xf3a93b['query'][_0xd9ff('0x57')]);_0x6f731a[_0xd9ff('0x82')]=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0xf3a93b[_0xd9ff('0x4e')],_0x193c57[_0xd9ff('0x4f')]));_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x111')]=_0x4115a3['id'];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x6f731a[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x6f731a['where'],{'$or':_[_0xd9ff('0x79')](_0x6f731a['attributes'],function(_0x1bb980){var _0x3ccf5d={};_0x3ccf5d[_0x1bb980]={'$like':'%'+_0xf3a93b['query']['filter']+'%'};return _0x3ccf5d;})});}_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x116')]=![];if(_0xf3a93b['query']['id']){_0x6f731a[_0xd9ff('0x82')]['id']={'$gt':_0xf3a93b[_0xd9ff('0x4e')]['id']};}_0x6f731a=_['merge']({},_0x6f731a,_0xf3a93b[_0xd9ff('0x113')]);return db['ChatMessage'][_0xd9ff('0x34')]({'where':_0x6f731a[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x42d9ff){_0x4572b2[_0xd9ff('0x34')]=_0x42d9ff;_0x6f731a[_0xd9ff('0x117')]=[];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x118')]){_0x6f731a[_0xd9ff('0x117')][_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43'),_0xd9ff('0xfb')]});}if(_0xf3a93b['query'][_0xd9ff('0xbf')]){_0x6f731a[_0xd9ff('0x117')]=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x6f731a);})[_0xd9ff('0x22')](function(_0x314f18){_0x4572b2['rows']=_0x314f18;return _0x4572b2;});}})['then'](respondWithFilteredResult(_0x473ecf,_0x6f731a))['catch'](handleError(_0x473ecf,null));};exports['addTags']=function(_0x4699d3,_0x2e91a8,_0x4956b2){return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x4699d3[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2e91a8,null))['then'](function(_0x217023){if(_0x217023){return _0x217023[_0xd9ff('0x11a')](_0x4699d3['body']['ids'],_['omit'](_0x4699d3['body'],['ids','id'])||{})[_0xd9ff('0x11b')](function(){return db[_0xd9ff('0x11c')][_0xd9ff('0x114')]({'attributes':['id',_0xd9ff('0x3c'),_0xd9ff('0x5b')],'where':{'id':_0x4699d3[_0xd9ff('0x3f')][_0xd9ff('0x10e')]}});})[_0xd9ff('0x22')](function(_0x317f93){socket[_0xd9ff('0x11d')](_0xd9ff('0x11e'),{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]});return{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]};});}})[_0xd9ff('0x22')](respondWithResult(_0x2e91a8,null))[_0xd9ff('0x2d')](handleError(_0x2e91a8,null));};exports[_0xd9ff('0x11f')]=function(_0x404baf,_0x5d73cd,_0xdb719b){return db['ChatInteraction'][_0xd9ff('0xc0')]({'where':{'id':_0x404baf['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x5d73cd,null))[_0xd9ff('0x22')](function(_0x10935d){if(_0x10935d){return _0x10935d['removeTags'](_0x404baf['query']['ids']);}})['then'](respondWithStatusCode(_0x5d73cd,null))['catch'](handleError(_0x5d73cd,null));};exports[_0xd9ff('0xeb')]=function(_0x2031e9,_0x3b50d9){var _0x410fae=moment()[_0xd9ff('0x120')]()[_0xd9ff('0xbb')]();var _0x494da6=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server','files',_0xd9ff('0x121'));var _0x49c9cc=path[_0xd9ff('0xe7')](config['root'],_0xd9ff('0x122'),_0xd9ff('0x123'),'attachments');var _0x378746=path[_0xd9ff('0xe7')](_0x494da6,_0x410fae);var _0x2acbe3=util[_0xd9ff('0xef')]('transcript-%d-%s.zip',_0x2031e9['params']['id'],_0x410fae);var _0x46d12c=path[_0xd9ff('0xe7')](_0x494da6,_0x2acbe3);var _0x54f4aa=[];_0x54f4aa[_0xd9ff('0x119')]({'model':db['User'],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43')],'raw':!![]});_0x54f4aa[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x124')],'as':_0xd9ff('0x71'),'attributes':['id',_0xd9ff('0x125'),'lastName'],'raw':!![]});if(_0x2031e9['query'][_0xd9ff('0x126')]){_0x54f4aa['push']({'model':db[_0xd9ff('0xe3')],'as':'Attachment','raw':!![]});}var _0xd015e9=[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'attributes':['id','body',_0xd9ff('0x84'),_0xd9ff('0xff'),'secret','read'],'include':_0x54f4aa}];_0xd015e9['push']({'model':db[_0xd9ff('0xc5')],'as':_0xd9ff('0x127'),'attributes':['id',_0xd9ff('0x3c')]});_0xd015e9[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x128'),'attributes':['id',_0xd9ff('0x43')]});return db[_0xd9ff('0x49')]['find']({'where':{'id':_0x2031e9[_0xd9ff('0xbe')]['id']},'include':_0xd015e9})[_0xd9ff('0x22')](handleEntityNotFound(_0x3b50d9,null))[_0xd9ff('0x22')](function(_0x1b452e){if(_0x1b452e){var _0x3ab927=_0x1b452e[_0xd9ff('0x129')]({'plain':!![]});fs[_0xd9ff('0x12a')](_0x378746);var _0x2b6e15={'channel':_0xd9ff('0x12b'),'account':_0x3ab927['Account']['name'],'agent':_0x3ab927['Owner']?_0x3ab927[_0xd9ff('0x128')][_0xd9ff('0x43')]:'N.A.','createdAt':moment(_0x3ab927[_0xd9ff('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9ff('0xbb')](),'closedAt':_0x3ab927[_0xd9ff('0xda')]?moment(_0x3ab927[_0xd9ff('0x12c')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')]():'','disposition':_0x3ab927['disposition'],'chatInfo':{'browser':_0x3ab927[_0xd9ff('0x12d')],'os':_0x3ab927[_0xd9ff('0x12e')],'referer':_0x3ab927[_0xd9ff('0x12f')],'customerIp':_0x3ab927[_0xd9ff('0x130')],'customerPort':_0x3ab927[_0xd9ff('0x131')]?_0x3ab927['customerPort']:'N.A.'},'messages':_(_0x3ab927[_0xd9ff('0xf3')])[_0xd9ff('0x132')]()[_0xd9ff('0x90')]({'secret':![]})[_0xd9ff('0x79')](function(_0x319248){if(_0x319248[_0xd9ff('0xe3')]){var _0x1ea603=path[_0xd9ff('0xe7')](_0x49c9cc,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')]);if(fs[_0xd9ff('0x133')](_0x1ea603)){fs[_0xd9ff('0x134')](_0x1ea603)[_0xd9ff('0x135')](fs['createWriteStream'](path[_0xd9ff('0xe7')](_0x378746,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')])));}}return{'date':moment(_0x319248[_0xd9ff('0x84')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')](),'sender':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?_0x319248[_0xd9ff('0x7c')]?_0x319248[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6'):_0x319248['Contact'][_0xd9ff('0x125')]+(_0x319248[_0xd9ff('0x71')][_0xd9ff('0x136')]?'\x20'+_0x319248[_0xd9ff('0x71')]['lastName']:''),'body':_0x319248[_0xd9ff('0xe3')]?_0x319248['Attachment']['basename']:_0x319248[_0xd9ff('0x3f')],'direction':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?'A':'C','secret':_0x319248[_0xd9ff('0x116')],'read':_0x319248[_0xd9ff('0x8c')],'attachment':_0x319248[_0xd9ff('0xe3')]};})[_0xd9ff('0x6d')]()};return ejs['renderFile'](path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server',_0xd9ff('0x137'),_0xd9ff('0x138')),{'interaction':_0x2b6e15})[_0xd9ff('0x22')](function(_0xb07a14){var _0x1c419f=path[_0xd9ff('0xe7')](_0x378746,_0xd9ff('0x139')+_0x3ab927['id']+'-'+_0x410fae+_0xd9ff('0x13a'));var _0x3156c8={'path':_0x1c419f,'channel':_0xd9ff('0x12b'),'interactionId':_0x3ab927['id']};return pdf[_0xd9ff('0x13b')](_0xb07a14,_0x3156c8);})['then'](function(){return new BPromise(function(_0x567007,_0x1019f9){zipdir(_0x378746,{'saveTo':_0x46d12c},function(_0x2ab78a,_0x4649d9){if(_0x2ab78a)return _0x1019f9(_0x2ab78a);return _0x567007(_0x4649d9);});})[_0xd9ff('0x22')](function(){return new BPromise(function(_0x166033,_0x3c40e4){rimraf(_0x378746,function(_0x346d93){if(_0x346d93)_0x3c40e4(_0x346d93);return _0x166033();});});})[_0xd9ff('0x22')](function(){return _0x3b50d9['download'](_0x46d12c,_0x2acbe3,function(_0x22680e){if(_0x22680e){console['log'](_0xd9ff('0x13c'),_0x22680e);}else{fs[_0xd9ff('0x13d')](_0x46d12c);}});});});}else{return _0x3b50d9['sendStatus'](0xc8);}})[_0xd9ff('0x2d')](handleError(_0x3b50d9,null));}; \ No newline at end of file +var _0xef0f=['alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','mailTranscript','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','hasOwnProperty','includeAgent','addTags','setTags','omit','emit','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','mkdirSync','Chat','Owner','N.A.','browserName','osName','existsSync','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','save','update','destroy','end','stack','name','send','render','body','contact','interaction','account','Users','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`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','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','ChatWebsiteId','sequelize','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','keys','includeAll','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooMetadata','vidaooApiKey','email','isNull','vidaooNote','follow','metadata','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','originalname','basename','file','filename','mimetype','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','server/files/chat/upload/','format','now','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias'];(function(_0x2fc67b,_0x404917){var _0x2ca4b4=function(_0x39a5ba){while(--_0x39a5ba){_0x2fc67b['push'](_0x2fc67b['shift']());}};_0x2ca4b4(++_0x404917);}(_0xef0f,0x168));var _0xfef0=function(_0x4917de,_0x4cca9b){_0x4917de=_0x4917de-0x0;var _0x11d892=_0xef0f[_0x4917de];return _0x11d892;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var pdf=require(_0xfef0('0x14'));var hardwareService=require(_0xfef0('0x15'));var logger=require(_0xfef0('0x16'))(_0xfef0('0x17'));var utils=require(_0xfef0('0x18'));var config=require(_0xfef0('0x19'));var licenseUtil=require(_0xfef0('0x1a'));var db=require('../../mysqldb')['db'];config[_0xfef0('0x1b')]=_[_0xfef0('0x1c')](config[_0xfef0('0x1b')],{'host':_0xfef0('0x1d'),'port':0x18eb});var socket=require(_0xfef0('0x1e'))(new Redis(config[_0xfef0('0x1b')]));require(_0xfef0('0x1f'))['register'](socket);var jayson=require(_0xfef0('0x20'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson['client'][_0xfef0('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x284b6d,_0x3510a7,_0x1bce2f,_0x2a96d9){return new BPromise(function(_0x3f9a6c,_0x155833){var _0x2887e6=_0x2a96d9||client;return _0x2887e6['request'](_0x284b6d,_0x1bce2f)[_0xfef0('0x22')](function(_0x1642cd){logger[_0xfef0('0x23')](_0xfef0('0x24'),_0x3510a7,_0xfef0('0x25'));logger['debug'](_0xfef0('0x26'),_0x3510a7,'request\x20sent',JSON[_0xfef0('0x27')](_0x1642cd));if(_0x1642cd[_0xfef0('0x28')]){if(_0x1642cd[_0xfef0('0x28')]['code']===0x1f4){logger[_0xfef0('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x3510a7,_0x1642cd[_0xfef0('0x28')][_0xfef0('0x29')]);return _0x155833(_0x1642cd['error']['message']);}logger['error'](_0xfef0('0x24'),_0x3510a7,_0x1642cd['error'][_0xfef0('0x29')]);return _0x3f9a6c(_0x1642cd[_0xfef0('0x28')][_0xfef0('0x29')]);}else{logger[_0xfef0('0x23')](_0xfef0('0x24'),_0x3510a7,_0xfef0('0x25'));_0x3f9a6c(_0x1642cd['result']['message']);}})[_0xfef0('0x2a')](function(_0x1ffaa4){logger[_0xfef0('0x28')](_0xfef0('0x24'),_0x3510a7,_0x1ffaa4);_0x155833(_0x1ffaa4);});});}function respondWithStatusCode(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0xcc;return function(_0x5df04f){if(_0x5df04f){return _0xab231c[_0xfef0('0x2b')](_0xf60f2);}return _0xab231c[_0xfef0('0x2c')](_0xf60f2)['end']();};}function respondWithResult(_0x1a6758,_0x394bad){_0x394bad=_0x394bad||0xc8;return function(_0xca0cce){if(_0xca0cce){return _0x1a6758[_0xfef0('0x2c')](_0x394bad)[_0xfef0('0x2d')](_0xca0cce);}};}function respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c){return function(_0x3e026a){if(_0x3e026a){var _0x26cb9a=typeof _0x3e3c4c[_0xfef0('0x2e')]===_0xfef0('0x2f')&&typeof _0x3e3c4c[_0xfef0('0x30')]==='undefined';var _0x445625=_0x3e026a['count'];var _0x4eaf74=_0x26cb9a?0x0:_0x3e3c4c[_0xfef0('0x2e')];var _0x2ae54a=_0x26cb9a?_0x3e026a['count']:_0x3e3c4c['offset']+_0x3e3c4c['limit'];var _0x4f65cd;if(_0x2ae54a>=_0x445625){_0x2ae54a=_0x445625;_0x4f65cd=0xc8;}else{_0x4f65cd=0xce;}_0x1ac4a3['status'](_0x4f65cd);return _0x1ac4a3[_0xfef0('0x31')](_0xfef0('0x32'),_0x4eaf74+'-'+_0x2ae54a+'/'+_0x445625)[_0xfef0('0x2d')](_0x3e026a);}return null;};}function patchUpdates(_0x5cda6b){return function(_0x4d0778){try{jsonpatch['apply'](_0x4d0778,_0x5cda6b,!![]);}catch(_0x1f8110){return BPromise['reject'](_0x1f8110);}return _0x4d0778[_0xfef0('0x33')]();};}function saveUpdates(_0x3783f9,_0x1b9f39){return function(_0x4a2773){if(_0x4a2773){return _0x4a2773[_0xfef0('0x34')](_0x3783f9)['then'](function(_0x4234e4){return _0x4234e4;});}return null;};}function removeEntity(_0x1f21b7,_0x234d49){return function(_0xe5188e){if(_0xe5188e){return _0xe5188e[_0xfef0('0x35')]()[_0xfef0('0x22')](function(){_0x1f21b7[_0xfef0('0x2c')](0xcc)[_0xfef0('0x36')]();});}};}function handleEntityNotFound(_0x590e37,_0x24ea7c){return function(_0xea09ec){if(!_0xea09ec){_0x590e37[_0xfef0('0x2b')](0x194);}return _0xea09ec;};}function handleError(_0x36b2d1,_0xae697){_0xae697=_0xae697||0x1f4;return function(_0x262341){logger[_0xfef0('0x28')](_0x262341[_0xfef0('0x37')]);if(_0x262341[_0xfef0('0x38')]){delete _0x262341[_0xfef0('0x38')];}_0x36b2d1[_0xfef0('0x2c')](_0xae697)[_0xfef0('0x39')](_0x262341);};}function getMustacheRender(_0x366667,_0x4a8af4){return Mustache[_0xfef0('0x3a')](_0x366667,_['merge'](_0x4a8af4[_0xfef0('0x3b')],{'contact':_0x4a8af4[_0xfef0('0x3c')],'message':_0x4a8af4[_0xfef0('0x29')],'agent':_0x4a8af4['agent'],'interaction':_0x4a8af4[_0xfef0('0x3d')],'account':_0x4a8af4[_0xfef0('0x3e')]}))||'';}function getInteractionUsers(_0x3f2753,_0x5537c8){return new BPromise(function(_0x8613a0,_0x3abcc5){try{if(_0x5537c8[_0x3f2753['id']]){_0x3f2753[_0xfef0('0x3f')]=_['map'](_0x5537c8[_0x3f2753['id']],function(_0x3a6667){return{'id':_0x3a6667['id'],'fullname':_0x3a6667['fullname']};});}}catch(_0x49ed48){_0x3abcc5(_0x49ed48);}_0x8613a0(_0x3f2753);});}function getInteractionTags(_0xf30aff,_0x547a5d){return new BPromise(function(_0x5c3305,_0xbf6ddd){try{if(_0xf30aff[_0xfef0('0x40')]){_0xf30aff[_0xfef0('0x41')]=[];_0xf30aff[_0xfef0('0x40')][_0xfef0('0x42')](',')[_0xfef0('0x43')](function(_0x4dd8f8){_0xf30aff[_0xfef0('0x41')][_0xfef0('0x44')](_0x547a5d[_0x4dd8f8]);});}delete _0xf30aff['TagIds'];}catch(_0x54d5cb){_0xbf6ddd(_0x54d5cb);}_0x5c3305(_0xf30aff);});}function updateChatInteraction(_0x1d554e,_0x5dc824,_0x1fc518){return new BPromise(function(_0x22c940,_0x3c100c){return getInteractionUsers(_0x1d554e,_0x1fc518)[_0xfef0('0x22')](function(_0x199c57){return getInteractionTags(_0x199c57,_0x5dc824);})[_0xfef0('0x22')](function(_0x166a7b){_0x22c940(_0x166a7b);})[_0xfef0('0x2a')](function(_0x4e63f3){_0x3c100c(_0x4e63f3);});});}exports[_0xfef0('0x45')]=function(_0x50e372,_0x4b6da1){var _0x18c656={},_0x17d7f2={},_0x5bf416={'count':0x0,'rows':[]};var _0x2af79f=_['map'](db[_0xfef0('0x46')][_0xfef0('0x47')],function(_0x1f252e){return{'name':_0x1f252e[_0xfef0('0x48')],'type':_0x1f252e['type'][_0xfef0('0x49')]};});_0x17d7f2[_0xfef0('0x4a')]=_['map'](_0x2af79f,'name');_0x17d7f2[_0xfef0('0x4b')]=_['keys'](_0x50e372[_0xfef0('0x4b')]);_0x17d7f2[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x17d7f2[_0xfef0('0x4a')],_0x17d7f2[_0xfef0('0x4b')]);_0x18c656[_0xfef0('0x4e')]=_['intersection'](_0x17d7f2[_0xfef0('0x4a')],qs['fields'](_0x50e372['query'][_0xfef0('0x4f')]));_0x18c656[_0xfef0('0x4e')]=_0x18c656[_0xfef0('0x4e')]['length']?_0x18c656[_0xfef0('0x4e')]:_0x17d7f2['model'];if(!_0x50e372['query']['hasOwnProperty'](_0xfef0('0x50'))){_0x18c656[_0xfef0('0x30')]=qs[_0xfef0('0x30')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x18c656[_0xfef0('0x2e')]=qs[_0xfef0('0x2e')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x2e')]);}_0x18c656['order']=qs['sort'](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x51')]);_0x18c656[_0xfef0('0x52')]=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x50e372[_0xfef0('0x4b')],_0x17d7f2[_0xfef0('0x4c')]),_0x2af79f);var _0x20b647=[];var _0x5e989f=squel[_0xfef0('0x54')]()[_0xfef0('0x55')]('id')[_0xfef0('0x55')](_0xfef0('0x38'))[_0xfef0('0x55')]('color')['from']('tools_tags');var _0x445f3f=squel[_0xfef0('0x54')]()[_0xfef0('0x55')](_0xfef0('0x56'))['field'](_0xfef0('0x57'))[_0xfef0('0x55')](_0xfef0('0x58'))[_0xfef0('0x59')](_0xfef0('0x5a'),'ui')[_0xfef0('0x5b')](_0xfef0('0x5c'),'u','u.id\x20=\x20ui.UserId');var _0x3458b0=squel[_0xfef0('0x54')]()['from'](_0xfef0('0x5d'),'i')['left_join'](_0xfef0('0x5e'),'c',_0xfef0('0x5f'))['left_join'](_0xfef0('0x5c'),'o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0xfef0('0x60'))[_0xfef0('0x5b')](_0xfef0('0x61'),'me',_0xfef0('0x62'))[_0xfef0('0x5b')](_0xfef0('0x63'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xfef0('0x5b')](_0xfef0('0x64'),'t',_0xfef0('0x65'));var _0x45abb3=squel[_0xfef0('0x66')]();var _0x58d95e=[];var _0x59d1b6=squel['expr']();var _0x135653;if(_0x50e372['query'][_0xfef0('0x67')]){_0x135653=as[_0xfef0('0x68')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x67')]);var _0xd0255c=_0x135653['sqlOperator'];for(var _0x2abdb7=0x0;_0x2abdb7<_0x135653['conditions'][_0xfef0('0x69')];_0x2abdb7++){var _0x4a1316=_0x135653['conditions'][_0x2abdb7];var _0x3a12c5='i';var _0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0x4a1316[_0xfef0('0x55')]]);if(!_0x3c5640){switch(_0x4a1316[_0xfef0('0x55')]){case _0xfef0('0x6b'):if(_0x4a1316[_0xfef0('0x6c')]==0x1){_0x3458b0[_0xfef0('0x6d')]('`'+_0x4a1316[_0xfef0('0x55')]+_0xfef0('0x6e'));}else{_0x3458b0[_0xfef0('0x6d')]('`'+_0x4a1316['field']+_0xfef0('0x6f'));}break;case _0xfef0('0x70'):if(_0x4a1316[_0xfef0('0x71')]===_0xfef0('0x72')){if(_0x4a1316[_0xfef0('0x6c')]['split']('\x20')[_0xfef0('0x69')]>0x1){_0x45abb3[_0xd0255c](_0xfef0('0x73'),qs[_0xfef0('0x74')](_0x4a1316[_0xfef0('0x6c')]),null);}else{var _0x176fc7='%'+_0x4a1316[_0xfef0('0x6c')]+'%';_0x45abb3[_0xd0255c](_0xfef0('0x75'),_0x176fc7,_0x176fc7,_0x176fc7);}}else{_0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0xfef0('0x76')]);_0x4a1316['field']=_0xfef0('0x76');_0x1d7caf=as['buildExpression'](_0x3a12c5,_0x3c5640[_0xfef0('0x77')],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf[_0xfef0('0x78')],_0x1d7caf['value'][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x36')]);}break;case _0xfef0('0x7a'):var _0x1e0ad5=_0x4a1316['value'][_0xfef0('0x42')](',')[_0xfef0('0x7b')](function(_0x2ccb33){return Number(_0x2ccb33);});_0x1e0ad5['forEach'](function(_0x117b74){_0x59d1b6['or'](_0xfef0('0x7c'),'%,'+_0x117b74+',%');});_0x58d95e=_[_0xfef0('0x7d')](_0x58d95e,_0x1e0ad5);break;case _0xfef0('0x7e'):if(_0x4a1316[_0xfef0('0x71')]===_0xfef0('0x72')){_0x45abb3[_0xd0255c](_0xfef0('0x7f'),'%'+_0x4a1316['value']+'%',null);}else{_0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0xfef0('0x80')]);_0x4a1316[_0xfef0('0x55')]=_0xfef0('0x80');_0x1d7caf=as[_0xfef0('0x81')](_0x3a12c5,_0x3c5640['type'],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf[_0xfef0('0x78')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')]['end']);}break;case _0xfef0('0x3b'):_0x1d7caf=as[_0xfef0('0x81')]('me',null,_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf['text'],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x36')]);break;}}else{var _0x1d7caf=as['buildExpression'](_0x3a12c5,_0x3c5640['type'],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf['text'],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')]['end']);}}}else{var _0x24229e=_(_0x50e372['query'])['keys']()['map'](function(_0x2a92de){return _[_0xfef0('0x82')](_0x2af79f,['name',_0x2a92de])?_0x2a92de:undefined;})[_0xfef0('0x83')]()[_0xfef0('0x6c')]();if(!_[_0xfef0('0x84')](_0x24229e)){_0x24229e['forEach'](function(_0x3f2b55){if(_0x3f2b55==='ChatWebsiteId'){_0x3458b0['where'](_0xfef0('0x85'),[][_0xfef0('0x86')](_0x50e372[_0xfef0('0x4b')][_0x3f2b55]));}else if(_0x3f2b55===_0xfef0('0x87')){var _0x4df63b=JSON['parse'](_0x50e372['query'][_0x3f2b55])[_0xfef0('0x88')];var _0x546455=JSON[_0xfef0('0x89')](_0x50e372[_0xfef0('0x4b')][_0x3f2b55])[_0xfef0('0x8a')];_0x3458b0[_0xfef0('0x52')](_0xfef0('0x8b'),_0x4df63b,_0x546455);}else{if(_0x50e372['query'][_0x3f2b55]===_0xfef0('0x8c')){_0x3458b0['where']('i.'+_0x3f2b55+'\x20IS\x20NULL');}else{_0x3458b0[_0xfef0('0x52')]('i.'+_0x3f2b55+_0xfef0('0x8d'),_0x50e372[_0xfef0('0x4b')][_0x3f2b55]);}}});}if(_0x50e372[_0xfef0('0x4b')]['read']){if(_0x50e372['query'][_0xfef0('0x8e')]==0x1){_0x3458b0[_0xfef0('0x6d')]('`unreadMessages`\x20=\x200');}else{_0x3458b0[_0xfef0('0x6d')](_0xfef0('0x8f'));}}if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]){_0x58d95e=_[_0xfef0('0x91')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')])?_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]:new Array(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]);_0x58d95e[_0xfef0('0x43')](function(_0x3c1136){_0x59d1b6['or'](_0xfef0('0x7c'),'%,'+_0x3c1136+',%');});}if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x92')]){var _0x1a61e4=_0x50e372['query'][_0xfef0('0x92')][_0xfef0('0x93')]('\x5c','\x5c\x5c')[_0xfef0('0x93')](/'/g,'\x27\x27');if(qs[_0xfef0('0x94')](_0x1a61e4)){_0x45abb3['or'](_0xfef0('0x95'),_0x1a61e4+'%');}else{_0x45abb3['or'](_0xfef0('0x96'),qs[_0xfef0('0x74')](_0x1a61e4))['or'](_0xfef0('0x97'),_0x1a61e4+'%');}}}_0x3458b0[_0xfef0('0x52')](_0x45abb3);_0x3458b0[_0xfef0('0x98')](_0xfef0('0x99'));var _0x17c350={'type':db[_0xfef0('0x9a')]['QueryTypes'][_0xfef0('0x9b')],'raw':!![]};var _0x56af65=_0x3458b0['clone']();_0x56af65[_0xfef0('0x55')](_0xfef0('0x99'));_0x56af65['field'](_0xfef0('0x9c'),'unreadMessages');if(_0x18c656['order']){_0x18c656[_0xfef0('0x9d')][_0xfef0('0x43')](function(_0x4ebcf){var _0x437cb2=_0x4ebcf[0x0]==='contactName'?_0x4ebcf[0x0]:'i.'+_0x4ebcf[0x0];_0x3458b0[_0xfef0('0x9d')](_0x437cb2,_0x4ebcf[0x1]===_0xfef0('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x58d95e)){_0x3458b0[_0xfef0('0x6d')](_0x59d1b6);_0x56af65[_0xfef0('0x52')](_0xfef0('0x9f'),_0x58d95e);}BPromise['resolve']()['then'](function(){if(!_0x135653){if(_0x50e372[_0xfef0('0x4b')]['ChatWebsiteId'])return;_0x56af65['where'](_0xfef0('0xa0'));_0x3458b0['where'](_0xfef0('0xa0'));return;}if(_0x50e372[_0xfef0('0xa1')][_0xfef0('0xa2')]!==_0xfef0('0xa3'))return;return _0x50e372[_0xfef0('0xa1')][_0xfef0('0xa4')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x22')](function(_0x28cc77){if(_[_0xfef0('0x84')](_0x28cc77)){_0x56af65[_0xfef0('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');_0x3458b0[_0xfef0('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x56af65['where'](_0xfef0('0x85'),_['map'](_0x28cc77,'id'));_0x3458b0[_0xfef0('0x52')](_0xfef0('0x85'),_[_0xfef0('0x7b')](_0x28cc77,'id'));}});})[_0xfef0('0x22')](function(){if(_0x50e372[_0xfef0('0xa1')][_0xfef0('0xa2')]==='agent'&&!_0x135653&&!_0x50e372[_0xfef0('0x4b')][_0xfef0('0xa5')])return[];return db[_0xfef0('0xa6')][_0xfef0('0x4b')](_0x56af65[_0xfef0('0xa7')](),_0x17c350);})[_0xfef0('0x22')](function(_0x3cc27e){_0x5bf416[_0xfef0('0xa8')]=_0x3cc27e['length'];if(_0x5bf416[_0xfef0('0xa8')]===0x0)return[];return db[_0xfef0('0xa6')]['query'](_0x5e989f[_0xfef0('0xa7')](),_0x17c350)[_0xfef0('0x22')](function(_0x221b17){_0x20b647=_['keyBy'](_0x221b17,'id');_0x17c350=_[_0xfef0('0xa9')](_0x17c350,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x4f')]){_0x18c656['attributes'][_0xfef0('0x43')](function(_0x51f79b){_0x3458b0[_0xfef0('0x55')]('i.'+_0x51f79b);});}else{_0x3458b0[_0xfef0('0x55')](_0xfef0('0x9c'),_0xfef0('0x6b'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xaa'),_0xfef0('0xab'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xac'),_0xfef0('0xad'));_0x3458b0[_0xfef0('0x55')]('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',_0xfef0('0xae'));_0x3458b0['field']('i.*');_0x3458b0[_0xfef0('0x55')]('c.firstName',_0xfef0('0xaf'));_0x3458b0['field']('c.lastName',_0xfef0('0xb0'));_0x3458b0['field']('c.email','Contact.email');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb1'),_0xfef0('0xb2'));_0x3458b0[_0xfef0('0x55')]('c.mobile',_0xfef0('0xb3'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb4'),_0xfef0('0xb5'));_0x3458b0[_0xfef0('0x55')]('o.fullname','Owner.fullname');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb6'),'Owner.internal');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb7'),_0xfef0('0x40'));}if(_0x18c656[_0xfef0('0x30')])_0x3458b0[_0xfef0('0x30')](_0x18c656[_0xfef0('0x30')]);if(_0x18c656[_0xfef0('0x2e')])_0x3458b0[_0xfef0('0x2e')](_0x18c656['offset']);return db['sequelize'][_0xfef0('0x4b')](_0x3458b0[_0xfef0('0xa7')](),_0x17c350);})[_0xfef0('0x22')](function(_0x475eb7){if(_0x475eb7[_0xfef0('0x69')]>0x0)_0x445f3f[_0xfef0('0x52')](_0xfef0('0xb8'),_[_0xfef0('0x7b')](_0x475eb7,'id'));return db['sequelize']['query'](_0x445f3f[_0xfef0('0xa7')](),_0x17c350)[_0xfef0('0x22')](function(_0x374877){var _0xd780bb=_[_0xfef0('0xb9')](_0x374877,_0xfef0('0xba'));var _0x5ac2df=[];_0x475eb7[_0xfef0('0x43')](function(_0x1060c2){_0x5ac2df['push'](updateChatInteraction(_0x1060c2,_0x20b647,_0xd780bb));});return BPromise[_0xfef0('0xbb')](_0x5ac2df);});});})[_0xfef0('0x22')](function(_0x36873f){_0x5bf416[_0xfef0('0xbc')]=_0x36873f;return _0x5bf416;})[_0xfef0('0x22')](respondWithFilteredResult(_0x4b6da1,_0x18c656))[_0xfef0('0x2a')](handleError(_0x4b6da1,null));};exports['show']=function(_0x4dd6e8,_0x1084b9){var _0xd7c5b={'raw':![],'where':{'id':_0x4dd6e8[_0xfef0('0xbd')]['id']}},_0xd2c0be={};_0xd2c0be[_0xfef0('0x4a')]=_[_0xfef0('0xbe')](db['ChatInteraction'][_0xfef0('0x47')]);_0xd2c0be['query']=_[_0xfef0('0xbe')](_0x4dd6e8['query']);_0xd2c0be[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0xd2c0be['model'],_0xd2c0be[_0xfef0('0x4b')]);_0xd7c5b[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0xd2c0be['model'],qs['fields'](_0x4dd6e8['query'][_0xfef0('0x4f')]));_0xd7c5b['attributes']=_0xd7c5b[_0xfef0('0x4e')][_0xfef0('0x69')]?_0xd7c5b['attributes']:_0xd2c0be[_0xfef0('0x4a')];if(_0x4dd6e8['query'][_0xfef0('0xbf')]){_0xd7c5b[_0xfef0('0xc0')]=[{'all':!![]}];}_0xd7c5b=_[_0xfef0('0xa9')]({},_0xd7c5b,_0x4dd6e8[_0xfef0('0xc1')]);return db[_0xfef0('0x46')][_0xfef0('0x6a')](_0xd7c5b)[_0xfef0('0x22')](handleEntityNotFound(_0x1084b9,null))['then'](respondWithResult(_0x1084b9,null))[_0xfef0('0x2a')](handleError(_0x1084b9,null));};exports[_0xfef0('0xc2')]=function(_0x38f96f,_0x1bdf18){return db[_0xfef0('0x46')][_0xfef0('0xc2')](_0x38f96f[_0xfef0('0x3b')],{})[_0xfef0('0x22')](respondWithResult(_0x1bdf18,0xc9))[_0xfef0('0x2a')](handleError(_0x1bdf18,null));};exports[_0xfef0('0x34')]=function(_0x2a25cb,_0x34f1db){if(_0x2a25cb[_0xfef0('0x3b')]['id']){delete _0x2a25cb[_0xfef0('0x3b')]['id'];}return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x2a25cb[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x34f1db,null))[_0xfef0('0x22')](saveUpdates(_0x2a25cb[_0xfef0('0x3b')],null))[_0xfef0('0x22')](respondWithResult(_0x34f1db,null))[_0xfef0('0x2a')](handleError(_0x34f1db,null));};exports[_0xfef0('0x35')]=function(_0x191072,_0x5b5a15){return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x191072['params']['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x5b5a15,null))[_0xfef0('0x22')](removeEntity(_0x5b5a15,null))[_0xfef0('0x2a')](handleError(_0x5b5a15,null));};exports[_0xfef0('0xc3')]=function(_0xd9c290,_0x365938){return db[_0xfef0('0x46')][_0xfef0('0xc3')]()[_0xfef0('0x22')](respondWithResult(_0x365938,null))[_0xfef0('0x2a')](handleError(_0x365938,null));};exports[_0xfef0('0xc4')]=function(_0x4c6ddd,_0x17ac08){var _0x40afcb=_0x4c6ddd['params']['id'];var _0xaa5902;var _0x189964;var _0x524db7;return db[_0xfef0('0x46')]['findOne']({'where':{'id':_0x40afcb}})[_0xfef0('0x22')](function(_0x41aadf){_0xaa5902=_0x41aadf;return db[_0xfef0('0xc5')][_0xfef0('0xc6')]({'where':{'id':_0x41aadf[_0xfef0('0xa5')]},'attributes':['id','vidaooApiKey',_0xfef0('0xc7'),_0xfef0('0xc8'),'vidaooNote',_0xfef0('0xc9')],'raw':!![]});})['then'](function(_0x3a180e){if(_0x3a180e&&_0x3a180e[_0xfef0('0xca')]&&_0x3a180e[_0xfef0('0xc7')]){_0x189964=_0x3a180e;var _0x52fb8b={'interaction':{'id':_0x40afcb},'agent':{'id':_0x4c6ddd[_0xfef0('0xa1')]['id'],'name':_0x4c6ddd['user']['name'],'fullname':_0x4c6ddd[_0xfef0('0xa1')]['fullname'],'email':_0x4c6ddd[_0xfef0('0xa1')][_0xfef0('0xcb')]},'contact':_0x4c6ddd[_0xfef0('0x3b')][_0xfef0('0x3c')],'account':_0x4c6ddd[_0xfef0('0x3b')][_0xfef0('0x3e')]};var _0x7f9b61={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3a180e[_0xfef0('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4c6ddd['user'][_0xfef0('0xcb')]],'buttons':null,'topic':_0x189964[_0xfef0('0xc8')],'note':_[_0xfef0('0xcc')](_0x189964[_0xfef0('0xcd')])?null:getMustacheRender(_0x189964[_0xfef0('0xcd')],_0x52fb8b),'metadata':null},'redirect':_0xfef0('0xce'),'json':!![]};try{if(!_[_0xfef0('0xcc')](_0x189964[_0xfef0('0xc9')])){var _0x4a3b68=getMustacheRender(_0x189964['vidaooMetadata'],_0x52fb8b);var _0x3c5471=JSON[_0xfef0('0x89')](_0x4a3b68);_0x7f9b61[_0xfef0('0x3b')][_0xfef0('0xcf')]=_0x3c5471;}}catch(_0xdbd7f2){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x7f9b61);}else{throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xfef0('0x22')](function(_0x4f171b){_0x524db7=_0x4f171b;if(_0x524db7['id']){var _0x236523={'body':_0x524db7[_0xfef0('0xd1')],'ChatWebsiteId':_0x189964['id'],'ChatInteractionId':_0xaa5902['id'],'direction':_0xfef0('0xd2'),'UserId':_0x4c6ddd[_0xfef0('0xa1')]['id']};return db[_0xfef0('0xd3')][_0xfef0('0xc2')](_0x236523,{});}else{throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))](_0xfef0('0xd4'));}})[_0xfef0('0x22')](function(){return _0xaa5902[_0xfef0('0xd5')]({'vidaooSessionId':_0x524db7['id']});})['then'](respondWithResult(_0x17ac08,null))[_0xfef0('0x2a')](handleError(_0x17ac08,null));};exports['customUpdate']=function(_0xf763b1,_0x1fc6a0){if(_0xf763b1[_0xfef0('0x3b')]['id']){delete _0xf763b1[_0xfef0('0x3b')]['id'];}return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0xf763b1[_0xfef0('0xbd')]['id']},'include':[{'model':db[_0xfef0('0xd6')],'as':_0xfef0('0x70')}]})['then'](handleEntityNotFound(_0x1fc6a0,null))['then'](saveUpdates(_0xf763b1[_0xfef0('0x3b')],null))['then'](respondWithResult(_0x1fc6a0,null))[_0xfef0('0x2a')](handleError(_0x1fc6a0,null));};exports[_0xfef0('0xd7')]=function(_0x45049d,_0x238112,_0x3a7c93){if(_0x45049d['body']['id']){delete _0x45049d[_0xfef0('0x3b')]['id'];}return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x45049d[_0xfef0('0xbd')]['id']}})['then'](function(_0x34bcc3){if(!_0x34bcc3){logger['error'](_0xfef0('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x238112[_0xfef0('0x2b')](0x194);}else{if(_0x34bcc3['UserId']){throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))](_0xfef0('0xd9'));}}return _0x34bcc3;})['then'](function(_0x5c7b35){if(_0x5c7b35){return _0x5c7b35[_0xfef0('0x34')]({'closed':_0x45049d[_0xfef0('0x3b')][_0xfef0('0xda')],'disposition':_0x45049d[_0xfef0('0x3b')][_0xfef0('0xdb')]})[_0xfef0('0x22')](function(_0x3107e2){return _0x3107e2;});}})[_0xfef0('0x22')](function(_0x325d36){return respondWithRpcPromise('AbandonInteraction',_0xfef0('0xd7'),_0x45049d[_0xfef0('0x3b')],client9004);})[_0xfef0('0x22')](respondWithResult(_0x238112,null))[_0xfef0('0x2a')](handleError(_0x238112,null));};exports[_0xfef0('0xdc')]=function(_0xb1df6f,_0x42604b,_0x5969d2){_0xb1df6f[_0xfef0('0x3b')][_0xfef0('0x38')]=_0xb1df6f['file'][_0xfef0('0xdd')];_0xb1df6f[_0xfef0('0x3b')][_0xfef0('0xde')]=_0xb1df6f[_0xfef0('0xdf')][_0xfef0('0xe0')];_0xb1df6f['body'][_0xfef0('0x77')]=_0xb1df6f['file'][_0xfef0('0xe1')];return db['Attachment']['create'](_0xb1df6f['body'])[_0xfef0('0x22')](respondWithResult(_0x42604b,0xc9))['catch'](handleError(_0x42604b,null));};exports['attachmentDownload']=function(_0x25fed0,_0x43453b,_0x4da5b0){return db[_0xfef0('0x46')][_0xfef0('0xc6')]({'where':{'id':_0x25fed0[_0xfef0('0xbd')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x43453b,null))['then'](function(_0x39a2a7){if(_0x39a2a7){if(_0x39a2a7[_0xfef0('0xda')]){return _0x43453b[_0xfef0('0x2c')](0x193)[_0xfef0('0x2d')]({'status':0x193,'message':_0xfef0('0xe2')});}return db[_0xfef0('0xe3')][_0xfef0('0xc6')]({'where':{'id':_0x25fed0['query'][_0xfef0('0xe4')]},'raw':!![]})[_0xfef0('0x22')](handleEntityNotFound(_0x43453b,null));}})[_0xfef0('0x22')](function(_0x4544fe){if(_0x4544fe){var _0x5c0f32=_0x4544fe['ChatOfflineMessageId']!==null;var _0x461c91=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0xe7'));if(_0x5c0f32){_0x461c91=path[_0xfef0('0xe5')](_0x461c91,_0xfef0('0xe8'));}var _0xe24c2d=path['join'](_0x461c91,_0x4544fe['basename']);return _0x43453b['download'](_0xe24c2d);}})[_0xfef0('0x2a')](handleError(_0x43453b,null));};exports['close']=function(_0x38ac84,_0x4a1406){var _0x2daf2a=null;var _0x4f703e=null;var _0x20cf67=null;var _0x235122=null;if(_0x38ac84[_0xfef0('0x3b')]['id']){delete _0x38ac84[_0xfef0('0x3b')]['id'];}if(_0x38ac84[_0xfef0('0x3b')]['mailTranscript']){_0x235122=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0xe9'),util[_0xfef0('0xea')]('transcript-%s.txt',Date[_0xfef0('0xeb')]()));_0x38ac84['body']['pathTranscript']=_0x235122;}return db[_0xfef0('0x46')]['find']({'where':{'id':_0x38ac84['params']['id']},'include':[{'model':db[_0xfef0('0xd3')],'as':'Messages','include':[{'model':db[_0xfef0('0x7e')],'as':_0xfef0('0x7e')}]}]})[_0xfef0('0x22')](handleEntityNotFound(_0x4a1406,null))[_0xfef0('0x22')](saveUpdates(_0x38ac84[_0xfef0('0x3b')],null))[_0xfef0('0x22')](function(_0x4f6c50){if(_0x4f6c50){_0x2daf2a=_0x4f6c50;return db[_0xfef0('0xc5')][_0xfef0('0x6a')]({'where':{'id':_0x2daf2a[_0xfef0('0xa5')]}});}})['then'](function(_0x3ac462){if(_0x3ac462){_0x20cf67=_0x3ac462;return db['CmContact'][_0xfef0('0x6a')]({'where':{'id':_0x2daf2a[_0xfef0('0x76')]}});}})[_0xfef0('0x22')](function(_0x5ef687){if(_0x5ef687){_0x4f703e=_0x5ef687;if(_0x235122){var _0x906e55=null;for(var _0x4cec7d=0x1;_0x4cec7d<_0x2daf2a['Messages'][_0xfef0('0x69')];++_0x4cec7d){_0x906e55=_0x2daf2a[_0xfef0('0xec')][_0x4cec7d];var _0x58a4ef=_0x906e55[_0xfef0('0x80')]?util[_0xfef0('0xea')](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');var _0x484cc3=_0x38ac84[_0xfef0('0x3b')][_0xfef0('0xf0')]||util[_0xfef0('0xea')](_0xfef0('0xed'),_0xfef0('0xf1'),_0x906e55[_0xfef0('0x76')]);switch(_0x20cf67[_0xfef0('0xf2')]){case _0xfef0('0xf3'):_0x58a4ef=_0x906e55[_0xfef0('0x80')]?util['format'](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');break;case'agent_alias':_0x58a4ef=_0x906e55[_0xfef0('0x80')]?_0x906e55[_0xfef0('0x7e')][_0xfef0('0xf4')]||_0x906e55[_0xfef0('0x7e')][_0xfef0('0xf5')]:'System';break;case _0xfef0('0xf6'):_0x58a4ef=_0x906e55[_0xfef0('0x80')]?_0x906e55[_0xfef0('0x7e')]['fullname']:'System';break;default:_0x58a4ef=_0x906e55[_0xfef0('0x80')]?util[_0xfef0('0xea')](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');}var _0x4b4986=util[_0xfef0('0xea')](_0xfef0('0xf7'),moment(_0x906e55[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0xf8')),_0x906e55['direction']==='in'?_0x484cc3:_0x58a4ef,_0x906e55[_0xfef0('0x3b')]);if(!_0x906e55[_0xfef0('0xf9')]){fs[_0xfef0('0xfa')](_0x235122,_0x4b4986);}}return db[_0xfef0('0xfb')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xfef0('0xfc')],'as':'Smtp','raw':!![]}]});}}})[_0xfef0('0x22')](function(_0x402c7d){if(_0x402c7d&&_0x402c7d[_0xfef0('0xfd')]&&_0x38ac84[_0xfef0('0x3b')]){var _0x5315eb={'tls':{'rejectUnauthorized':![]}};if(_0x402c7d['Smtp'][_0xfef0('0xfe')]){_0x5315eb[_0xfef0('0xfe')]=_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xfe')];}else{_0x5315eb[_0xfef0('0xff')]=_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xff')];_0x5315eb['port']=_0x402c7d['Smtp'][_0xfef0('0x100')];_0x5315eb[_0xfef0('0x101')]=_0x402c7d['Smtp'][_0xfef0('0x101')];}if(_0x402c7d['Smtp']['authentication']){_0x5315eb[_0xfef0('0x102')]={'user':_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xa1')],'pass':_0x402c7d[_0xfef0('0xfd')][_0xfef0('0x103')]};}return respondWithRpcPromise('SendMail',_0xfef0('0x104'),{'account':_0x5315eb,'message':{'from':util[_0xfef0('0xea')](_0xfef0('0x105'),_0x402c7d[_0xfef0('0x38')],_0x402c7d['email']||_0x402c7d['Smtp']['user']),'to':_0x38ac84[_0xfef0('0x3b')]['mailTranscript'],'subject':_0xfef0('0x106'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x38ac84['body'][_0xfef0('0x107')]),'attachments':[{'path':_0x235122}]}})[_0xfef0('0x22')](function(){return _0x2daf2a;})['catch'](function(_0x411870){console['error'](_0x411870);});}else{return _0x2daf2a;}})[_0xfef0('0x22')](respondWithStatusCode(_0x4a1406,0xc8))[_0xfef0('0x2a')](handleError(_0x4a1406,null));};exports[_0xfef0('0x108')]=function(_0x9b2969,_0x1f842f,_0x36c978){return db[_0xfef0('0xd3')][_0xfef0('0x6a')]({'where':{'id':_0x9b2969[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x1f842f,null))['then'](function(_0x1d342a){if(_0x1d342a){return _0x1d342a[_0xfef0('0x108')](_0x9b2969['body'][_0xfef0('0x109')],_['omit'](_0x9b2969[_0xfef0('0x3b')],[_0xfef0('0x109'),'id'])||{});}})[_0xfef0('0x22')](respondWithResult(_0x1f842f,null))[_0xfef0('0x2a')](handleError(_0x1f842f,null));};exports[_0xfef0('0x10a')]=function(_0x422af1,_0xcb9eb8,_0x38e829){var _0x287403={'raw':![],'where':{}};var _0x2ebd8d={};var _0x115454={'count':0x0,'rows':[]};return db[_0xfef0('0x46')][_0xfef0('0xc6')]({'where':{'id':_0x422af1[_0xfef0('0xbd')]['id']}})['then'](handleEntityNotFound(_0xcb9eb8,null))[_0xfef0('0x22')](function(_0x5593de){if(_0x5593de){_0x2ebd8d['model']=_[_0xfef0('0xbe')](db['ChatMessage'][_0xfef0('0x47')]);_0x2ebd8d[_0xfef0('0x4b')]=_[_0xfef0('0xbe')](_0x422af1['query']);_0x2ebd8d[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x2ebd8d[_0xfef0('0x4a')],_0x2ebd8d[_0xfef0('0x4b')]);_0x287403[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0x2ebd8d[_0xfef0('0x4a')],qs[_0xfef0('0x4f')](_0x422af1[_0xfef0('0x4b')][_0xfef0('0x4f')]));_0x287403[_0xfef0('0x4e')]=_0x287403[_0xfef0('0x4e')][_0xfef0('0x69')]?_0x287403[_0xfef0('0x4e')]:_0x2ebd8d['model'];if(!_0x422af1[_0xfef0('0x4b')]['hasOwnProperty'](_0xfef0('0x50'))){_0x287403['limit']=qs[_0xfef0('0x30')](_0x422af1[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x287403[_0xfef0('0x2e')]=qs[_0xfef0('0x2e')](_0x422af1['query']['offset']);}_0x287403[_0xfef0('0x9d')]=qs[_0xfef0('0x51')](_0x422af1['query'][_0xfef0('0x51')]);_0x287403[_0xfef0('0x52')]=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x422af1[_0xfef0('0x4b')],_0x2ebd8d[_0xfef0('0x4c')]));_0x287403[_0xfef0('0x52')][_0xfef0('0xba')]=_0x5593de['id'];if(_0x422af1['query'][_0xfef0('0x92')]){_0x287403[_0xfef0('0x52')]=_['merge'](_0x287403[_0xfef0('0x52')],{'$or':_['map'](_0x287403[_0xfef0('0x4e')],function(_0x41790c){var _0x189965={};_0x189965[_0x41790c]={'$like':'%'+_0x422af1[_0xfef0('0x4b')][_0xfef0('0x92')]+'%'};return _0x189965;})});}if(_0x422af1[_0xfef0('0x4b')][_0xfef0('0x88')]){var _0x5b1b34=_0x422af1[_0xfef0('0x4b')][_0xfef0('0x88')]['split'](',');var _0xfa83e1={};_0xfa83e1[_0x5b1b34[0x0]]={'$gte':moment(_0x5b1b34[0x1])[_0xfef0('0xea')](_0xfef0('0x10b'))};_0x287403['where']=_[_0xfef0('0xa9')](_0x287403[_0xfef0('0x52')],_0xfa83e1);}_0x287403=_[_0xfef0('0xa9')]({},_0x287403,_0x422af1[_0xfef0('0xc1')]);return db[_0xfef0('0xd3')][_0xfef0('0xa8')]({'where':_0x287403[_0xfef0('0x52')]})[_0xfef0('0x22')](function(_0x464d00){_0x115454[_0xfef0('0xa8')]=_0x464d00;if(_0x422af1['query'][_0xfef0('0xbf')]){_0x287403[_0xfef0('0xc0')]=[{'all':!![]}];}return db[_0xfef0('0xd3')][_0xfef0('0x10c')](_0x287403);})[_0xfef0('0x22')](function(_0x1b23f0){_0x115454['rows']=_0x1b23f0;return _0x115454;});}})['then'](respondWithFilteredResult(_0xcb9eb8,_0x287403))[_0xfef0('0x2a')](handleError(_0xcb9eb8,null));};exports['getMyMessages']=function(_0x30f7d5,_0x1a53fa,_0x14a37e){var _0x303128={'where':{}},_0x2b3263={},_0x43e758={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xfef0('0xc6')]({'where':{'id':_0x30f7d5[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x1a53fa,null))[_0xfef0('0x22')](function(_0x273e8b){if(_0x273e8b){_0x2b3263[_0xfef0('0x4a')]=_[_0xfef0('0xbe')](db['ChatMessage'][_0xfef0('0x47')]);_0x2b3263[_0xfef0('0x4b')]=_[_0xfef0('0xbe')](_0x30f7d5[_0xfef0('0x4b')]);_0x2b3263[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x2b3263['model'],_0x2b3263['query']);_0x303128[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0x2b3263[_0xfef0('0x4a')],qs[_0xfef0('0x4f')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x4f')]));_0x303128[_0xfef0('0x4e')]=_0x303128[_0xfef0('0x4e')][_0xfef0('0x69')]?_0x303128[_0xfef0('0x4e')]:_0x2b3263[_0xfef0('0x4a')];if(!_0x30f7d5['query'][_0xfef0('0x10d')](_0xfef0('0x50'))){_0x303128[_0xfef0('0x30')]=qs[_0xfef0('0x30')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x303128['offset']=qs[_0xfef0('0x2e')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x2e')]);}_0x303128[_0xfef0('0x9d')]=qs['sort'](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x51')]);_0x303128['where']=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x30f7d5[_0xfef0('0x4b')],_0x2b3263[_0xfef0('0x4c')]));_0x303128[_0xfef0('0x52')][_0xfef0('0xba')]=_0x273e8b['id'];if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x92')]){_0x303128['where']=_[_0xfef0('0xa9')](_0x303128[_0xfef0('0x52')],{'$or':_['map'](_0x303128['attributes'],function(_0x3081e){var _0xd34b68={};_0xd34b68[_0x3081e]={'$like':'%'+_0x30f7d5[_0xfef0('0x4b')]['filter']+'%'};return _0xd34b68;})});}_0x303128[_0xfef0('0x52')][_0xfef0('0xf9')]=![];if(_0x30f7d5['query']['id']){_0x303128[_0xfef0('0x52')]['id']={'$gt':_0x30f7d5[_0xfef0('0x4b')]['id']};}_0x303128=_[_0xfef0('0xa9')]({},_0x303128,_0x30f7d5[_0xfef0('0xc1')]);return db[_0xfef0('0xd3')]['count']({'where':_0x303128[_0xfef0('0x52')]})['then'](function(_0x63bcae){_0x43e758['count']=_0x63bcae;_0x303128[_0xfef0('0xc0')]=[];if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x10e')]){_0x303128['include'][_0xfef0('0x44')]({'model':db[_0xfef0('0x7e')],'as':'User','attributes':['id','fullname',_0xfef0('0xf4')]});}if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0xbf')]){_0x303128['include']=[{'all':!![]}];}return db[_0xfef0('0xd3')][_0xfef0('0x10c')](_0x303128);})['then'](function(_0x527d0d){_0x43e758[_0xfef0('0xbc')]=_0x527d0d;return _0x43e758;});}})[_0xfef0('0x22')](respondWithFilteredResult(_0x1a53fa,_0x303128))['catch'](handleError(_0x1a53fa,null));};exports[_0xfef0('0x10f')]=function(_0x3f68ed,_0x45a5e8,_0x33cecb){return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0x3f68ed[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x45a5e8,null))[_0xfef0('0x22')](function(_0x53ce05){if(_0x53ce05){return _0x53ce05[_0xfef0('0x110')](_0x3f68ed[_0xfef0('0x3b')][_0xfef0('0x109')],_[_0xfef0('0x111')](_0x3f68ed[_0xfef0('0x3b')],[_0xfef0('0x109'),'id'])||{})['spread'](function(){return db[_0xfef0('0x7a')][_0xfef0('0x10c')]({'attributes':['id','name','color'],'where':{'id':_0x3f68ed[_0xfef0('0x3b')][_0xfef0('0x109')]}});})[_0xfef0('0x22')](function(_0x4697ee){socket[_0xfef0('0x112')]('chatInteractionTags:save',{'id':Number(_0x3f68ed[_0xfef0('0xbd')]['id']),'tags':_0x4697ee||[]});return{'id':Number(_0x3f68ed[_0xfef0('0xbd')]['id']),'tags':_0x4697ee||[]};});}})[_0xfef0('0x22')](respondWithResult(_0x45a5e8,null))['catch'](handleError(_0x45a5e8,null));};exports[_0xfef0('0x113')]=function(_0x2a229b,_0xcb6d50,_0x53ed7e){return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x2a229b[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0xcb6d50,null))['then'](function(_0x241763){if(_0x241763){return _0x241763[_0xfef0('0x113')](_0x2a229b['query'][_0xfef0('0x109')]);}})[_0xfef0('0x22')](respondWithStatusCode(_0xcb6d50,null))['catch'](handleError(_0xcb6d50,null));};exports[_0xfef0('0x114')]=function(_0x57e2d8,_0x3fdeae){var _0x30b0a9=moment()[_0xfef0('0x115')]()['toString']();var _0x416d36=path[_0xfef0('0xe5')](config['root'],_0xfef0('0x116'),_0xfef0('0x117'),_0xfef0('0x118'));var _0x50b3d7=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0x116'),_0xfef0('0x117'),_0xfef0('0x119'));var _0x2a9a1e=path[_0xfef0('0xe5')](_0x416d36,_0x30b0a9);var _0x584c9b=util[_0xfef0('0xea')](_0xfef0('0x11a'),_0x57e2d8[_0xfef0('0xbd')]['id'],_0x30b0a9);var _0x4f4c4e=path[_0xfef0('0xe5')](_0x416d36,_0x584c9b);var _0x1c6ab9=[];_0x1c6ab9[_0xfef0('0x44')]({'model':db[_0xfef0('0x7e')],'as':_0xfef0('0x7e'),'attributes':['id',_0xfef0('0xf5')],'raw':!![]});_0x1c6ab9['push']({'model':db[_0xfef0('0xd6')],'as':'Contact','attributes':['id',_0xfef0('0x11b'),_0xfef0('0x11c')],'raw':!![]});if(_0x57e2d8[_0xfef0('0x4b')][_0xfef0('0x119')]){_0x1c6ab9[_0xfef0('0x44')]({'model':db[_0xfef0('0xe3')],'as':'Attachment','raw':!![]});}var _0x937d8e=[{'model':db[_0xfef0('0xd3')],'as':_0xfef0('0xec'),'attributes':['id',_0xfef0('0x3b'),'createdAt',_0xfef0('0x11d'),_0xfef0('0xf9'),'read'],'include':_0x1c6ab9}];_0x937d8e['push']({'model':db[_0xfef0('0xc5')],'as':_0xfef0('0x11e'),'attributes':['id',_0xfef0('0x38')]});_0x937d8e[_0xfef0('0x44')]({'model':db['User'],'as':'Owner','attributes':['id',_0xfef0('0xf5')]});return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0x57e2d8[_0xfef0('0xbd')]['id']},'include':_0x937d8e})[_0xfef0('0x22')](handleEntityNotFound(_0x3fdeae,null))['then'](function(_0x2978cc){if(_0x2978cc){var _0x81bcee=_0x2978cc['get']({'plain':!![]});fs[_0xfef0('0x11f')](_0x2a9a1e);var _0xc8d0ca={'channel':_0xfef0('0x120'),'account':_0x81bcee[_0xfef0('0x11e')][_0xfef0('0x38')],'agent':_0x81bcee[_0xfef0('0x121')]?_0x81bcee['Owner']['fullname']:_0xfef0('0x122'),'createdAt':moment(_0x81bcee[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0x10b'))['toString'](),'closedAt':_0x81bcee['closed']?moment(_0x81bcee['closedAt'])[_0xfef0('0xea')](_0xfef0('0x10b'))[_0xfef0('0xa7')]():'','disposition':_0x81bcee[_0xfef0('0xdb')],'chatInfo':{'browser':_0x81bcee[_0xfef0('0x123')],'os':_0x81bcee[_0xfef0('0x124')],'referer':_0x81bcee['referer'],'customerIp':_0x81bcee['customerIp'],'customerPort':_0x81bcee['customerPort']?_0x81bcee['customerPort']:'N.A.'},'messages':_(_0x81bcee[_0xfef0('0xec')])['tail']()[_0xfef0('0x92')]({'secret':![]})[_0xfef0('0x7b')](function(_0x46ab62){if(_0x46ab62[_0xfef0('0xe3')]){var _0x3507a8=path['join'](_0x50b3d7,_0x46ab62[_0xfef0('0xe3')][_0xfef0('0xde')]);if(fs[_0xfef0('0x125')](_0x3507a8)){fs['createReadStream'](_0x3507a8)[_0xfef0('0x126')](fs[_0xfef0('0x127')](path[_0xfef0('0xe5')](_0x2a9a1e,_0x46ab62[_0xfef0('0xe3')][_0xfef0('0xde')])));}}return{'date':moment(_0x46ab62[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0x10b'))[_0xfef0('0xa7')](),'sender':_0x46ab62[_0xfef0('0x11d')]===_0xfef0('0xd2')?_0x46ab62[_0xfef0('0x7e')]?_0x46ab62[_0xfef0('0x7e')][_0xfef0('0xf5')]:_0xfef0('0xef'):_0x46ab62[_0xfef0('0x70')][_0xfef0('0x11b')]+(_0x46ab62[_0xfef0('0x70')][_0xfef0('0x11c')]?'\x20'+_0x46ab62[_0xfef0('0x70')]['lastName']:''),'body':_0x46ab62['Attachment']?_0x46ab62['Attachment']['basename']:_0x46ab62[_0xfef0('0x3b')],'direction':_0x46ab62[_0xfef0('0x11d')]===_0xfef0('0xd2')?'A':'C','secret':_0x46ab62['secret'],'read':_0x46ab62[_0xfef0('0x8e')],'attachment':_0x46ab62[_0xfef0('0xe3')]};})[_0xfef0('0x6c')]()};return ejs[_0xfef0('0x128')](path['join'](config['root'],'server',_0xfef0('0x129'),_0xfef0('0x12a')),{'interaction':_0xc8d0ca})[_0xfef0('0x22')](function(_0x2b1f64){var _0x55ecff=path[_0xfef0('0xe5')](_0x2a9a1e,_0xfef0('0x12b')+_0x81bcee['id']+'-'+_0x30b0a9+'.pdf');var _0x409147={'path':_0x55ecff,'channel':_0xfef0('0x120'),'interactionId':_0x81bcee['id']};return pdf[_0xfef0('0x12c')](_0x2b1f64,_0x409147);})[_0xfef0('0x22')](function(){return new BPromise(function(_0x27856d,_0x44081d){zipdir(_0x2a9a1e,{'saveTo':_0x4f4c4e},function(_0x177c9b,_0x322672){if(_0x177c9b)return _0x44081d(_0x177c9b);return _0x27856d(_0x322672);});})[_0xfef0('0x22')](function(){return new BPromise(function(_0x102b4e,_0x2a206b){rimraf(_0x2a9a1e,function(_0x279f5b){if(_0x279f5b)_0x2a206b(_0x279f5b);return _0x102b4e();});});})[_0xfef0('0x22')](function(){return _0x3fdeae[_0xfef0('0x114')](_0x4f4c4e,_0x584c9b,function(_0x44603e){if(_0x44603e){console['log'](_0xfef0('0x12d'),_0x44603e);}else{fs['unlinkSync'](_0x4f4c4e);}});});});}else{return _0x3fdeae[_0xfef0('0x2b')](0xc8);}})['catch'](handleError(_0x3fdeae,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 34bfd37..4dbd23c 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 _0x393b=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','catch','hasOwnProperty','exports','events'];(function(_0x1b3287,_0x15c015){var _0x10b1bc=function(_0x104798){while(--_0x104798){_0x1b3287['push'](_0x1b3287['shift']());}};_0x10b1bc(++_0x15c015);}(_0x393b,0x175));var _0xb393=function(_0x153846,_0x1227ad){_0x153846=_0x153846-0x0;var _0x3ee557=_0x393b[_0x153846];return _0x3ee557;};'use strict';var EventEmitter=require(_0xb393('0x0'));var ChatInteraction=require(_0xb393('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xb393('0x1'))['db'][_0xb393('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb393('0x3')](0x0);var events={'afterCreate':_0xb393('0x4'),'afterUpdate':_0xb393('0x5'),'afterDestroy':_0xb393('0x6')};function emitEvent(_0x34abd4){return function(_0xb4bd45,_0x2cde6c,_0xb3e9a6){_0xb4bd45[_0xb393('0x7')]({'attributes':['id'],'raw':!![]})[_0xb393('0x8')](function(_0x536302){_0xb4bd45[_0xb393('0x9')](_0xb393('0xa'),_0x536302['map'](function(_0x31770d){return{'id':_0x31770d['id']};}));return ChatMessage[_0xb393('0xb')]({'where':{'ChatInteractionId':_0xb4bd45['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb393('0x8')](function(_0xda4b75){_0xb4bd45[_0xb393('0x9')](_0xb393('0xc'),_0xda4b75[_0xb393('0xd')]);ChatInteractionEvents['emit'](_0x34abd4+':'+_0xb4bd45['id'],_0xb4bd45);ChatInteractionEvents['emit'](_0x34abd4,_0xb4bd45);_0xb3e9a6(null);})[_0xb393('0xe')](_0xb3e9a6(null));};}for(var e in events){if(events[_0xb393('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xb393('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x6eec=['setMaxListeners','save','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x3dda1e,_0x17a46c){var _0x4b8cee=function(_0x7b86e6){while(--_0x7b86e6){_0x3dda1e['push'](_0x3dda1e['shift']());}};_0x4b8cee(++_0x17a46c);}(_0x6eec,0x106));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc6ee('0x0'));var ChatInteraction=require(_0xc6ee('0x1'))['db'][_0xc6ee('0x2')];var ChatMessage=require(_0xc6ee('0x1'))['db'][_0xc6ee('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc6ee('0x4')](0x0);var events={'afterCreate':_0xc6ee('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21c022){return function(_0x2be781,_0x38ca93,_0x1a3bbd){_0x2be781[_0xc6ee('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e9732){_0x2be781[_0xc6ee('0x7')](_0xc6ee('0x8'),_0x5e9732[_0xc6ee('0x9')](function(_0x4a9edf){return{'id':_0x4a9edf['id']};}));return ChatMessage[_0xc6ee('0xa')]({'where':{'ChatInteractionId':_0x2be781['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc6ee('0xb')](function(_0x3f4276){_0x2be781[_0xc6ee('0x7')](_0xc6ee('0xc'),_0x3f4276[_0xc6ee('0xd')]);ChatInteractionEvents[_0xc6ee('0xe')](_0x21c022+':'+_0x2be781['id'],_0x2be781);ChatInteractionEvents['emit'](_0x21c022,_0x2be781);_0x1a3bbd(null);})[_0xc6ee('0xf')](_0x1a3bbd(null));};}for(var e in events){if(events[_0xc6ee('0x10')](e)){var event=events[e];ChatInteraction[_0xc6ee('0x11')](e,emitEvent(event));}}module[_0xc6ee('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e503823..2d6554f 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 _0x1413=['rimraf','exports','define','ChatInteraction','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x204d56,_0x5ea6c5){var _0x356855=function(_0x3e2c3a){while(--_0x3e2c3a){_0x204d56['push'](_0x204d56['shift']());}};_0x356855(++_0x5ea6c5);}(_0x1413,0x1c1));var _0x3141=function(_0x1e2356,_0x57568b){_0x1e2356=_0x1e2356-0x0;var _0x14bad6=_0x1413[_0x1e2356];return _0x14bad6;};'use strict';var _=require(_0x3141('0x0'));var util=require('util');var logger=require(_0x3141('0x1'))('api');var moment=require(_0x3141('0x2'));var BPromise=require(_0x3141('0x3'));var rp=require(_0x3141('0x4'));var fs=require('fs');var path=require(_0x3141('0x5'));var rimraf=require(_0x3141('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x3141('0x7')]=function(_0x3b05aa,_0x26079a){return _0x3b05aa[_0x3141('0x8')](_0x3141('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20e932,_0x5a7de7,_0x34224b){if(_0x20e932['changed']('closed')){_0x20e932[_0x3141('0xa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x34224b(null,_0x20e932);}},'charset':_0x3141('0xb'),'collate':_0x3141('0xc')});}; \ No newline at end of file +var _0xa446=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions'];(function(_0x2cefd2,_0x3eed48){var _0x528537=function(_0x4a529b){while(--_0x4a529b){_0x2cefd2['push'](_0x2cefd2['shift']());}};_0x528537(++_0x3eed48);}(_0xa446,0x185));var _0x6a44=function(_0xc59fc6,_0x1938fd){_0xc59fc6=_0xc59fc6-0x0;var _0xd96754=_0xa446[_0xc59fc6];return _0xd96754;};'use strict';var _=require(_0x6a44('0x0'));var util=require(_0x6a44('0x1'));var logger=require(_0x6a44('0x2'))('api');var moment=require(_0x6a44('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a44('0x4'));var rimraf=require(_0x6a44('0x5'));var config=require(_0x6a44('0x6'));var attributes=require(_0x6a44('0x7'));module[_0x6a44('0x8')]=function(_0x3c3252,_0x5e4f23){return _0x3c3252['define'](_0x6a44('0x9'),attributes,{'tableName':_0x6a44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46fdb2,_0x51a29c,_0x36cf42){if(_0x46fdb2['changed'](_0x6a44('0xb'))){_0x46fdb2[_0x6a44('0xc')]=moment()[_0x6a44('0xd')](_0x6a44('0xe'));}_0x36cf42(null,_0x46fdb2);}},'charset':'utf8mb4','collate':_0x6a44('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index f961dde..a757226 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 _0x5df6=['find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','debug','AddTagsToChatInteraction'];(function(_0x50de9b,_0x926c10){var _0x2841e0=function(_0x6d4fde){while(--_0x6d4fde){_0x50de9b['push'](_0x50de9b['shift']());}};_0x2841e0(++_0x926c10);}(_0x5df6,0x132));var _0x65df=function(_0x5f2a39,_0x3c4eb9){_0x5f2a39=_0x5f2a39-0x0;var _0x12d130=_0x5df6[_0x5f2a39];return _0x12d130;};'use strict';var _=require(_0x65df('0x0'));var util=require(_0x65df('0x1'));var moment=require(_0x65df('0x2'));var BPromise=require(_0x65df('0x3'));var rs=require(_0x65df('0x4'));var fs=require('fs');var Redis=require(_0x65df('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x65df('0x6'));var logger=require(_0x65df('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x65df('0x8'));var client=jayson[_0x65df('0x9')][_0x65df('0xa')]({'port':0x232a});config['redis']=_[_0x65df('0xb')](config[_0x65df('0xc')],{'host':_0x65df('0xd'),'port':0x18eb});var socket=require(_0x65df('0xe'))(new Redis(config[_0x65df('0xc')]));require(_0x65df('0xf'))['register'](socket);function respondWithRpcPromise(_0x544586,_0x554403,_0x567ece){return new BPromise(function(_0x5bcfcc,_0x9f32e9){return client[_0x65df('0x10')](_0x544586,_0x567ece)[_0x65df('0x11')](function(_0x242c8c){logger[_0x65df('0x12')](_0x65df('0x13'),_0x554403,_0x65df('0x14'));logger['debug'](_0x65df('0x15'),_0x554403,_0x65df('0x14'),JSON[_0x65df('0x16')](_0x242c8c));if(_0x242c8c[_0x65df('0x17')]){if(_0x242c8c[_0x65df('0x17')][_0x65df('0x18')]===0x1f4){logger[_0x65df('0x17')](_0x65df('0x13'),_0x554403,_0x242c8c['error']['message']);return _0x9f32e9(_0x242c8c[_0x65df('0x17')][_0x65df('0x19')]);}logger[_0x65df('0x17')](_0x65df('0x13'),_0x554403,_0x242c8c[_0x65df('0x17')]['message']);return _0x5bcfcc(_0x242c8c[_0x65df('0x17')][_0x65df('0x19')]);}else{logger['info'](_0x65df('0x13'),_0x554403,_0x65df('0x14'));_0x5bcfcc(_0x242c8c[_0x65df('0x1a')][_0x65df('0x19')]);}})[_0x65df('0x1b')](function(_0x2f2c14){logger[_0x65df('0x17')](_0x65df('0x13'),_0x554403,_0x2f2c14);_0x9f32e9(_0x2f2c14);});});}exports[_0x65df('0x1c')]=function(_0x2bf493){var _0x3e1b66=this;return new Promise(function(_0x45da6d,_0x3ea3e8){return db[_0x65df('0x1d')][_0x65df('0x1e')](_0x2bf493[_0x65df('0x1f')],{'raw':_0x2bf493[_0x65df('0x20')]?_0x2bf493[_0x65df('0x20')][_0x65df('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bf493[_0x65df('0x20')]?_0x2bf493[_0x65df('0x20')][_0x65df('0x22')]||null:null,'attributes':_0x2bf493['options']?_0x2bf493[_0x65df('0x20')][_0x65df('0x23')]||null:null,'limit':_0x2bf493['options']?_0x2bf493[_0x65df('0x20')]['limit']||null:null})[_0x65df('0x11')](function(_0x18d527){logger[_0x65df('0x12')](_0x65df('0x1c'),_0x2bf493);logger[_0x65df('0x24')](_0x65df('0x1c'),_0x2bf493,JSON[_0x65df('0x16')](_0x18d527));_0x45da6d(_0x18d527);})[_0x65df('0x1b')](function(_0xe410aa){logger[_0x65df('0x17')](_0x65df('0x1c'),_0xe410aa[_0x65df('0x19')],_0x2bf493);_0x3ea3e8(_0x3e1b66[_0x65df('0x17')](0x1f4,_0xe410aa[_0x65df('0x19')]));});});};exports[_0x65df('0x25')]=function(_0x56857e){return new Promise(function(_0x161882,_0x1927fb){return db[_0x65df('0x1d')][_0x65df('0x26')]({'where':_0x56857e['options']?_0x56857e['options'][_0x65df('0x22')]||null:null})[_0x65df('0x11')](function(_0x27e0d5){if(_0x27e0d5){return _0x27e0d5['addTags'](_0x56857e[_0x65df('0x1f')][_0x65df('0x27')],_[_0x65df('0x28')](_0x56857e[_0x65df('0x1f')],[_0x65df('0x27'),'id'])||{});}})[_0x65df('0x29')](function(_0x19aef4){logger[_0x65df('0x12')](_0x65df('0x2a'),_0x56857e);logger[_0x65df('0x24')]('AddTags',_0x56857e,JSON['stringify'](_0x19aef4));_0x161882(_0x19aef4);})[_0x65df('0x1b')](function(_0x4a16dc){logger[_0x65df('0x17')](_0x65df('0x2a'),_0x4a16dc[_0x65df('0x19')],_0x56857e);_0x1927fb(_this[_0x65df('0x17')](0x1f4,_0x4a16dc[_0x65df('0x19')]));});});}; \ No newline at end of file +var _0x113b=['ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateChatInteraction','ChatInteraction','body','options','attributes','limit','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatInteraction.socket','then'];(function(_0x30fa58,_0x51af0e){var _0x4598a8=function(_0x5d9e1f){while(--_0x5d9e1f){_0x30fa58['push'](_0x30fa58['shift']());}};_0x4598a8(++_0x51af0e);}(_0x113b,0x15f));var _0xb113=function(_0x211f5f,_0xc6daac){_0x211f5f=_0x211f5f-0x0;var _0x4feb86=_0x113b[_0x211f5f];return _0x4feb86;};'use strict';var _=require(_0xb113('0x0'));var util=require(_0xb113('0x1'));var moment=require(_0xb113('0x2'));var BPromise=require(_0xb113('0x3'));var rs=require(_0xb113('0x4'));var fs=require('fs');var Redis=require(_0xb113('0x5'));var db=require(_0xb113('0x6'))['db'];var utils=require(_0xb113('0x7'));var logger=require(_0xb113('0x8'))(_0xb113('0x9'));var config=require(_0xb113('0xa'));var jayson=require(_0xb113('0xb'));var client=jayson['client'][_0xb113('0xc')]({'port':0x232a});config['redis']=_[_0xb113('0xd')](config[_0xb113('0xe')],{'host':_0xb113('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb113('0xe')]));require(_0xb113('0x10'))['register'](socket);function respondWithRpcPromise(_0x562c62,_0x313e00,_0xa33b64){return new BPromise(function(_0x148bde,_0x58ad74){return client['request'](_0x562c62,_0xa33b64)[_0xb113('0x11')](function(_0x1e69b0){logger['info'](_0xb113('0x12'),_0x313e00,_0xb113('0x13'));logger[_0xb113('0x14')](_0xb113('0x15'),_0x313e00,_0xb113('0x13'),JSON[_0xb113('0x16')](_0x1e69b0));if(_0x1e69b0[_0xb113('0x17')]){if(_0x1e69b0[_0xb113('0x17')]['code']===0x1f4){logger[_0xb113('0x17')](_0xb113('0x12'),_0x313e00,_0x1e69b0['error'][_0xb113('0x18')]);return _0x58ad74(_0x1e69b0[_0xb113('0x17')][_0xb113('0x18')]);}logger[_0xb113('0x17')](_0xb113('0x12'),_0x313e00,_0x1e69b0[_0xb113('0x17')][_0xb113('0x18')]);return _0x148bde(_0x1e69b0[_0xb113('0x17')][_0xb113('0x18')]);}else{logger[_0xb113('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x313e00,_0xb113('0x13'));_0x148bde(_0x1e69b0['result']['message']);}})[_0xb113('0x1a')](function(_0x44e629){logger[_0xb113('0x17')](_0xb113('0x12'),_0x313e00,_0x44e629);_0x58ad74(_0x44e629);});});}exports[_0xb113('0x1b')]=function(_0x3fa7cd){var _0x12c467=this;return new Promise(function(_0x362ad1,_0x53a476){return db[_0xb113('0x1c')]['update'](_0x3fa7cd[_0xb113('0x1d')],{'raw':_0x3fa7cd['options']?_0x3fa7cd[_0xb113('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fa7cd['options']?_0x3fa7cd[_0xb113('0x1e')]['where']||null:null,'attributes':_0x3fa7cd[_0xb113('0x1e')]?_0x3fa7cd[_0xb113('0x1e')][_0xb113('0x1f')]||null:null,'limit':_0x3fa7cd[_0xb113('0x1e')]?_0x3fa7cd[_0xb113('0x1e')][_0xb113('0x20')]||null:null})['then'](function(_0x58b1ff){logger[_0xb113('0x19')](_0xb113('0x1b'),_0x3fa7cd);logger[_0xb113('0x14')](_0xb113('0x1b'),_0x3fa7cd,JSON[_0xb113('0x16')](_0x58b1ff));_0x362ad1(_0x58b1ff);})[_0xb113('0x1a')](function(_0x370945){logger[_0xb113('0x17')](_0xb113('0x1b'),_0x370945[_0xb113('0x18')],_0x3fa7cd);_0x53a476(_0x12c467[_0xb113('0x17')](0x1f4,_0x370945[_0xb113('0x18')]));});});};exports[_0xb113('0x21')]=function(_0x1f6c13){return new Promise(function(_0x1cbd8c,_0x4b7685){return db['ChatInteraction'][_0xb113('0x22')]({'where':_0x1f6c13[_0xb113('0x1e')]?_0x1f6c13[_0xb113('0x1e')][_0xb113('0x23')]||null:null})[_0xb113('0x11')](function(_0x1f0a01){if(_0x1f0a01){return _0x1f0a01[_0xb113('0x24')](_0x1f6c13[_0xb113('0x1d')][_0xb113('0x25')],_[_0xb113('0x26')](_0x1f6c13[_0xb113('0x1d')],[_0xb113('0x25'),'id'])||{});}})[_0xb113('0x27')](function(_0x379651){logger[_0xb113('0x19')](_0xb113('0x28'),_0x1f6c13);logger[_0xb113('0x14')]('AddTags',_0x1f6c13,JSON[_0xb113('0x16')](_0x379651));_0x1cbd8c(_0x379651);})[_0xb113('0x1a')](function(_0x3601d3){logger[_0xb113('0x17')](_0xb113('0x28'),_0x3601d3['message'],_0x1f6c13);_0x4b7685(_this[_0xb113('0x17')](0x1f4,_0x3601d3[_0xb113('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ec66587..e49d1bf 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 _0x40c2=['./chatInteraction.events','save','update','removeListener','register'];(function(_0x1e9751,_0x5a85b2){var _0x16769d=function(_0x3bc50d){while(--_0x3bc50d){_0x1e9751['push'](_0x1e9751['shift']());}};_0x16769d(++_0x5a85b2);}(_0x40c2,0x1b8));var _0x240c=function(_0x5b1f02,_0x2ae95d){_0x5b1f02=_0x5b1f02-0x0;var _0x51381b=_0x40c2[_0x5b1f02];return _0x51381b;};'use strict';var ChatInteractionEvents=require(_0x240c('0x0'));var events=[_0x240c('0x1'),'remove',_0x240c('0x2')];function createListener(_0x3b5e77,_0x4e3eb9){return function(_0x287696){_0x4e3eb9['emit'](_0x3b5e77,_0x287696);};}function removeListener(_0x58bff9,_0x42ae01){return function(){ChatInteractionEvents[_0x240c('0x3')](_0x58bff9,_0x42ae01);};}exports[_0x240c('0x4')]=function(_0x1b1990){for(var _0x2d3030=0x0,_0x51432e=events['length'];_0x2d3030<_0x51432e;_0x2d3030++){var _0x3292c4=events[_0x2d3030];var _0x1d0b92=createListener('chatInteraction:'+_0x3292c4,_0x1b1990);ChatInteractionEvents['on'](_0x3292c4,_0x1d0b92);}}; \ No newline at end of file +var _0x9500=['chatInteraction:','./chatInteraction.events','save','update','register','length'];(function(_0x5870c1,_0x173ba3){var _0x344685=function(_0x1984be){while(--_0x1984be){_0x5870c1['push'](_0x5870c1['shift']());}};_0x344685(++_0x173ba3);}(_0x9500,0x8b));var _0x0950=function(_0x1808f9,_0x322e07){_0x1808f9=_0x1808f9-0x0;var _0x2ffc89=_0x9500[_0x1808f9];return _0x2ffc89;};'use strict';var ChatInteractionEvents=require(_0x0950('0x0'));var events=[_0x0950('0x1'),'remove',_0x0950('0x2')];function createListener(_0x11f820,_0x49838d){return function(_0x1f6a8c){_0x49838d['emit'](_0x11f820,_0x1f6a8c);};}function removeListener(_0x388800,_0x1dd076){return function(){ChatInteractionEvents['removeListener'](_0x388800,_0x1dd076);};}exports[_0x0950('0x3')]=function(_0x2d1b1b){for(var _0xe88794=0x0,_0x228bdb=events[_0x0950('0x4')];_0xe88794<_0x228bdb;_0xe88794++){var _0x213e67=events[_0xe88794];var _0x53f009=createListener(_0x0950('0x5')+_0x213e67,_0x2d1b1b);ChatInteractionEvents['on'](_0x213e67,_0x53f009);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 5508062..4b9a1d0 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 _0x3803=['addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close','delete','removeTags','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','download','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','post'];(function(_0x491497,_0x249436){var _0xc2f47e=function(_0x1efab0){while(--_0x1efab0){_0x491497['push'](_0x491497['shift']());}};_0xc2f47e(++_0x249436);}(_0x3803,0x104));var _0x3380=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x3803[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3380('0x0'));var express=require('express');var router=express[_0x3380('0x1')]();var fs_extra=require(_0x3380('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3380('0x3'));var config=require(_0x3380('0x4'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x3380('0x5')](),controller[_0x3380('0x6')]);router[_0x3380('0x7')](_0x3380('0x8'),auth[_0x3380('0x5')](),controller[_0x3380('0x9')]);router['get'](_0x3380('0xa'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x3380('0x7')](_0x3380('0xb'),auth[_0x3380('0xc')](),controller[_0x3380('0xd')]);router[_0x3380('0x7')]('/:id/messages',auth[_0x3380('0x5')](),controller['getMessages']);router['get'](_0x3380('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x3380('0xf')]);router[_0x3380('0x7')](_0x3380('0x10'),auth[_0x3380('0x5')](),controller[_0x3380('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3380('0x12')]);router['post'](_0x3380('0x13'),auth['isAuthenticated'](),controller[_0x3380('0x14')]);var upload=multer({'storage':multer[_0x3380('0x15')]({'destination':function(_0x3a33a4,_0x3428af,_0x223cec){_0x223cec(null,path[_0x3380('0x16')](config[_0x3380('0x17')],_0x3380('0x18')));},'filename':function(_0x1d16e5,_0x70c04d,_0x41a9b8){_0x41a9b8(null,util[_0x3380('0x19')]('%s-%s',Date[_0x3380('0x1a')](),_0x70c04d[_0x3380('0x1b')][_0x3380('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x3380('0x1d'),upload[_0x3380('0x1e')](_0x3380('0x1f')),controller[_0x3380('0x20')]);router[_0x3380('0x21')]('/:id/messages',auth[_0x3380('0xc')](),controller[_0x3380('0x22')]);router[_0x3380('0x21')](_0x3380('0x23'),auth[_0x3380('0x5')](),interaction[_0x3380('0x24')](_0x3380('0x25'),_0x3380('0x26')),controller[_0x3380('0x27')]);router[_0x3380('0x28')]('/:id',auth['isAuthenticated'](),interaction[_0x3380('0x24')](_0x3380('0x25'),_0x3380('0x29')),controller[_0x3380('0x2a')]);router['put'](_0x3380('0x2b'),controller['customUpdate']);router[_0x3380('0x28')]('/:id/abandon',auth[_0x3380('0xc')](),controller[_0x3380('0x2c')]);router[_0x3380('0x28')](_0x3380('0x2d'),controller[_0x3380('0x2e')]);router[_0x3380('0x2f')](_0x3380('0xa'),auth[_0x3380('0x5')](),interaction[_0x3380('0x24')](_0x3380('0x25'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0x3380('0x23'),auth[_0x3380('0x5')](),controller[_0x3380('0x30')]);module['exports']=router; \ No newline at end of file +var _0xeb0d=['format','%s-%s','now','originalname','replace','single','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','/describe','describe','/:id','isChatInteractionAuthorized','show','isAuthenticated','getMessages','/:id/my_messages','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xeb0d,0x17e));var _0xdeb0=function(_0x587a71,_0x332e22){_0x587a71=_0x587a71-0x0;var _0x4b9fea=_0xeb0d[_0x587a71];return _0x4b9fea;};'use strict';var multer=require(_0xdeb0('0x0'));var util=require(_0xdeb0('0x1'));var path=require(_0xdeb0('0x2'));var timeout=require(_0xdeb0('0x3'));var express=require(_0xdeb0('0x4'));var router=express['Router']();var fs_extra=require(_0xdeb0('0x5'));var auth=require(_0xdeb0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdeb0('0x7'));var controller=require(_0xdeb0('0x8'));router[_0xdeb0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdeb0('0x9')](_0xdeb0('0xa'),auth['isAuthenticated'](),controller[_0xdeb0('0xb')]);router[_0xdeb0('0x9')](_0xdeb0('0xc'),auth[_0xdeb0('0xd')](),controller[_0xdeb0('0xe')]);router['get']('/:id/attachment_download',auth[_0xdeb0('0xd')](),controller['attachmentDownload']);router[_0xdeb0('0x9')]('/:id/messages',auth[_0xdeb0('0xf')](),controller[_0xdeb0('0x10')]);router[_0xdeb0('0x9')](_0xdeb0('0x11'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get']('/:id/download',auth[_0xdeb0('0xf')](),controller[_0xdeb0('0x12')]);router[_0xdeb0('0x13')]('/',auth[_0xdeb0('0xf')](),controller[_0xdeb0('0x14')]);router[_0xdeb0('0x13')](_0xdeb0('0x15'),auth['isAuthenticated'](),controller[_0xdeb0('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf33cc,_0x2eaeae,_0x201eb3){_0x201eb3(null,path[_0xdeb0('0x17')](config[_0xdeb0('0x18')],_0xdeb0('0x19')));},'filename':function(_0x3b1bc0,_0x1f99ad,_0x4e3799){_0x4e3799(null,util[_0xdeb0('0x1a')](_0xdeb0('0x1b'),Date[_0xdeb0('0x1c')](),_0x1f99ad[_0xdeb0('0x1d')][_0xdeb0('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdeb0('0x13')]('/:id/attachment_upload',upload[_0xdeb0('0x1f')]('file'),controller[_0xdeb0('0x20')]);router['post'](_0xdeb0('0x21'),auth[_0xdeb0('0xd')](),controller[_0xdeb0('0x22')]);router[_0xdeb0('0x13')]('/:id/tags',auth[_0xdeb0('0xf')](),interaction[_0xdeb0('0x23')](_0xdeb0('0x24'),_0xdeb0('0x25')),controller[_0xdeb0('0x26')]);router[_0xdeb0('0x27')](_0xdeb0('0xc'),auth[_0xdeb0('0xf')](),interaction[_0xdeb0('0x23')](_0xdeb0('0x24'),_0xdeb0('0x28')),controller['update']);router[_0xdeb0('0x27')](_0xdeb0('0x29'),controller[_0xdeb0('0x2a')]);router['put']('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0xdeb0('0x2b')]);router['put'](_0xdeb0('0x2c'),controller[_0xdeb0('0x2d')]);router[_0xdeb0('0x2e')](_0xdeb0('0xc'),auth[_0xdeb0('0xf')](),interaction[_0xdeb0('0x23')]('chat',_0xdeb0('0x2f')),controller[_0xdeb0('0x30')]);router['delete'](_0xdeb0('0x31'),auth[_0xdeb0('0xf')](),controller['removeTags']);module[_0xdeb0('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 0ee5b39..ca540b5 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 _0x1e89=['TEXT','medium','INTEGER','sequelize','exports'];(function(_0x568bd4,_0x150452){var _0x114086=function(_0x41b05d){while(--_0x41b05d){_0x568bd4['push'](_0x568bd4['shift']());}};_0x114086(++_0x150452);}(_0x1e89,0x157));var _0x91e8=function(_0xe0e537,_0x154c7b){_0xe0e537=_0xe0e537-0x0;var _0xf253bc=_0x1e89[_0xe0e537];return _0xf253bc;};'use strict';var Sequelize=require(_0x91e8('0x0'));module[_0x91e8('0x1')]={'body':{'type':Sequelize[_0x91e8('0x2')](_0x91e8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x91e8('0x4')]}}; \ No newline at end of file +var _0xac2d=['exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0xac2d,0x1f4));var _0xdac2=function(_0x2f0f05,_0x2ef4e2){_0x2f0f05=_0x2f0f05-0x0;var _0x59ce36=_0xac2d[_0x2f0f05];return _0x59ce36;};'use strict';var Sequelize=require('sequelize');module[_0xdac2('0x0')]={'body':{'type':Sequelize[_0xdac2('0x1')](_0xdac2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdac2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdac2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 4eb1856..9f9242f 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 _0xa107=['FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','then','destroy','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','params','length','includeAll','include','options','ChatInternalMessage','create','body','find','describe','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','user','fullname','userpic','online','allowmessenger','showWebBar','sort','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','messages'];(function(_0x357319,_0x55771e){var _0x1879f2=function(_0x337d58){while(--_0x337d58){_0x357319['push'](_0x357319['shift']());}};_0x1879f2(++_0x55771e);}(_0xa107,0x6e));var _0x7a10=function(_0x16cd8b,_0x524a80){_0x16cd8b=_0x16cd8b-0x0;var _0x16be5d=_0xa107[_0x16cd8b];return _0x16be5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a10('0x0'));var zipdir=require(_0x7a10('0x1'));var jsonpatch=require(_0x7a10('0x2'));var rp=require(_0x7a10('0x3'));var moment=require('moment');var BPromise=require(_0x7a10('0x4'));var Mustache=require(_0x7a10('0x5'));var util=require('util');var path=require(_0x7a10('0x6'));var sox=require(_0x7a10('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a10('0x8'));var squel=require(_0x7a10('0x9'));var crypto=require(_0x7a10('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7a10('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7a10('0xc'));var Papa=require(_0x7a10('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a10('0xe'));var hardwareService=require(_0x7a10('0xf'));var logger=require(_0x7a10('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x7a10('0x11'));var licenseUtil=require(_0x7a10('0x12'));var db=require(_0x7a10('0x13'))['db'];config[_0x7a10('0x14')]=_[_0x7a10('0x15')](config['redis'],{'host':_0x7a10('0x16'),'port':0x18eb});var socket=require(_0x7a10('0x17'))(new Redis(config[_0x7a10('0x14')]));require(_0x7a10('0x18'))[_0x7a10('0x19')](socket);function respondWithStatusCode(_0x227848,_0x272200){_0x272200=_0x272200||0xcc;return function(_0x3a3090){if(_0x3a3090){return _0x227848[_0x7a10('0x1a')](_0x272200);}return _0x227848[_0x7a10('0x1b')](_0x272200)[_0x7a10('0x1c')]();};}function respondWithResult(_0x80c8a2,_0x43f100){_0x43f100=_0x43f100||0xc8;return function(_0x33088b){if(_0x33088b){return _0x80c8a2[_0x7a10('0x1b')](_0x43f100)['json'](_0x33088b);}};}function respondWithFilteredResult(_0x22460a,_0x559c2e){return function(_0x4cc39b){if(_0x4cc39b){var _0x50a7fd=typeof _0x559c2e['offset']===_0x7a10('0x1d')&&typeof _0x559c2e[_0x7a10('0x1e')]===_0x7a10('0x1d');var _0x151168=_0x4cc39b['count'];var _0x3279be=_0x50a7fd?0x0:_0x559c2e[_0x7a10('0x1f')];var _0x373fb4=_0x50a7fd?_0x4cc39b[_0x7a10('0x20')]:_0x559c2e[_0x7a10('0x1f')]+_0x559c2e[_0x7a10('0x1e')];var _0x5a13a4;if(_0x373fb4>=_0x151168){_0x373fb4=_0x151168;_0x5a13a4=0xc8;}else{_0x5a13a4=0xce;}_0x22460a[_0x7a10('0x1b')](_0x5a13a4);return _0x22460a['set'](_0x7a10('0x21'),_0x3279be+'-'+_0x373fb4+'/'+_0x151168)[_0x7a10('0x22')](_0x4cc39b);}return null;};}function patchUpdates(_0x4c0636){return function(_0x3c4596){try{jsonpatch[_0x7a10('0x23')](_0x3c4596,_0x4c0636,!![]);}catch(_0x33dfe7){return BPromise[_0x7a10('0x24')](_0x33dfe7);}return _0x3c4596[_0x7a10('0x25')]();};}function saveUpdates(_0x4122d2,_0x1e936c){return function(_0x24379b){if(_0x24379b){return _0x24379b['update'](_0x4122d2)[_0x7a10('0x26')](function(_0x598947){return _0x598947;});}return null;};}function removeEntity(_0x1b953f,_0x5e138f){return function(_0x1d3a7a){if(_0x1d3a7a){return _0x1d3a7a[_0x7a10('0x27')]()[_0x7a10('0x26')](function(){_0x1b953f[_0x7a10('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x367733,_0x4f0d76){return function(_0x4bd948){if(!_0x4bd948){_0x367733['sendStatus'](0x194);}return _0x4bd948;};}function handleError(_0x591141,_0x1b1d7a){_0x1b1d7a=_0x1b1d7a||0x1f4;return function(_0x251991){logger['error'](_0x251991[_0x7a10('0x28')]);if(_0x251991[_0x7a10('0x29')]){delete _0x251991['name'];}_0x591141[_0x7a10('0x1b')](_0x1b1d7a)['send'](_0x251991);};}exports[_0x7a10('0x2a')]=function(_0x11649d,_0x1f5a3f){var _0x2f3d63={},_0x14b5d7={},_0x4b46c4={'count':0x0,'rows':[]};var _0x44cd14=_['map'](db['ChatInternalMessage'][_0x7a10('0x2b')],function(_0x969716){return{'name':_0x969716[_0x7a10('0x2c')],'type':_0x969716['type'][_0x7a10('0x2d')]};});_0x14b5d7[_0x7a10('0x2e')]=_[_0x7a10('0x2f')](_0x44cd14,_0x7a10('0x29'));_0x14b5d7[_0x7a10('0x30')]=_[_0x7a10('0x31')](_0x11649d['query']);_0x14b5d7[_0x7a10('0x32')]=_['intersection'](_0x14b5d7['model'],_0x14b5d7[_0x7a10('0x30')]);_0x2f3d63[_0x7a10('0x33')]=_[_0x7a10('0x34')](_0x14b5d7['model'],qs[_0x7a10('0x35')](_0x11649d[_0x7a10('0x30')][_0x7a10('0x35')]));_0x2f3d63[_0x7a10('0x33')]=_0x2f3d63[_0x7a10('0x33')]['length']?_0x2f3d63[_0x7a10('0x33')]:_0x14b5d7[_0x7a10('0x2e')];if(!_0x11649d['query'][_0x7a10('0x36')]('nolimit')){_0x2f3d63['limit']=qs[_0x7a10('0x1e')](_0x11649d[_0x7a10('0x30')][_0x7a10('0x1e')]);_0x2f3d63[_0x7a10('0x1f')]=qs['offset'](_0x11649d[_0x7a10('0x30')][_0x7a10('0x1f')]);}_0x2f3d63['order']=qs['sort'](_0x11649d['query']['sort']);_0x2f3d63[_0x7a10('0x37')]=qs[_0x7a10('0x32')](_[_0x7a10('0x38')](_0x11649d[_0x7a10('0x30')],_0x14b5d7[_0x7a10('0x32')]),_0x44cd14);if(_0x11649d[_0x7a10('0x30')][_0x7a10('0x39')]){_0x2f3d63[_0x7a10('0x37')]=_[_0x7a10('0x3a')](_0x2f3d63[_0x7a10('0x37')],{'$or':_[_0x7a10('0x2f')](_0x44cd14,function(_0x4a9fef){if(_0x4a9fef[_0x7a10('0x3b')]!==_0x7a10('0x3c')){var _0x1f0d31={};_0x1f0d31[_0x4a9fef['name']]={'$like':'%'+_0x11649d[_0x7a10('0x30')]['filter']+'%'};return _0x1f0d31;}})});}_0x2f3d63=_[_0x7a10('0x3a')]({},_0x2f3d63,_0x11649d['options']);var _0x4d2eb0={'where':_0x2f3d63[_0x7a10('0x37')]};return db['ChatInternalMessage'][_0x7a10('0x20')](_0x4d2eb0)[_0x7a10('0x26')](function(_0x42a3c6){_0x4b46c4[_0x7a10('0x20')]=_0x42a3c6;if(_0x11649d[_0x7a10('0x30')]['includeAll']){_0x2f3d63['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x7a10('0x3d')](_0x2f3d63);})['then'](function(_0x42ebb1){_0x4b46c4[_0x7a10('0x3e')]=_0x42ebb1;return _0x4b46c4;})[_0x7a10('0x26')](respondWithFilteredResult(_0x1f5a3f,_0x2f3d63))[_0x7a10('0x3f')](handleError(_0x1f5a3f,null));};exports['show']=function(_0x2c8b8a,_0x2e3434){var _0x59ee87={'raw':!![],'where':{'id':_0x2c8b8a[_0x7a10('0x40')]['id']}},_0x3bc81b={};_0x3bc81b[_0x7a10('0x2e')]=_[_0x7a10('0x31')](db['ChatInternalMessage'][_0x7a10('0x2b')]);_0x3bc81b[_0x7a10('0x30')]=_[_0x7a10('0x31')](_0x2c8b8a[_0x7a10('0x30')]);_0x3bc81b[_0x7a10('0x32')]=_['intersection'](_0x3bc81b['model'],_0x3bc81b[_0x7a10('0x30')]);_0x59ee87[_0x7a10('0x33')]=_[_0x7a10('0x34')](_0x3bc81b[_0x7a10('0x2e')],qs[_0x7a10('0x35')](_0x2c8b8a['query'][_0x7a10('0x35')]));_0x59ee87[_0x7a10('0x33')]=_0x59ee87[_0x7a10('0x33')][_0x7a10('0x41')]?_0x59ee87[_0x7a10('0x33')]:_0x3bc81b[_0x7a10('0x2e')];if(_0x2c8b8a[_0x7a10('0x30')][_0x7a10('0x42')]){_0x59ee87[_0x7a10('0x43')]=[{'all':!![]}];}_0x59ee87=_[_0x7a10('0x3a')]({},_0x59ee87,_0x2c8b8a[_0x7a10('0x44')]);return db[_0x7a10('0x45')]['find'](_0x59ee87)[_0x7a10('0x26')](handleEntityNotFound(_0x2e3434,null))[_0x7a10('0x26')](respondWithResult(_0x2e3434,null))['catch'](handleError(_0x2e3434,null));};exports[_0x7a10('0x46')]=function(_0x56b3d4,_0xcd94ae){return db[_0x7a10('0x45')][_0x7a10('0x46')](_0x56b3d4['body'],{})['then'](respondWithResult(_0xcd94ae,0xc9))[_0x7a10('0x3f')](handleError(_0xcd94ae,null));};exports['update']=function(_0x15a451,_0x44c824){if(_0x15a451[_0x7a10('0x47')]['id']){delete _0x15a451[_0x7a10('0x47')]['id'];}return db['ChatInternalMessage'][_0x7a10('0x48')]({'where':{'id':_0x15a451['params']['id']}})[_0x7a10('0x26')](handleEntityNotFound(_0x44c824,null))[_0x7a10('0x26')](saveUpdates(_0x15a451['body'],null))[_0x7a10('0x26')](respondWithResult(_0x44c824,null))[_0x7a10('0x3f')](handleError(_0x44c824,null));};exports[_0x7a10('0x27')]=function(_0x1ff5fe,_0x56bf0a){return db[_0x7a10('0x45')]['find']({'where':{'id':_0x1ff5fe['params']['id']}})[_0x7a10('0x26')](handleEntityNotFound(_0x56bf0a,null))[_0x7a10('0x26')](removeEntity(_0x56bf0a,null))['catch'](handleError(_0x56bf0a,null));};exports[_0x7a10('0x49')]=function(_0x284c3b,_0xa3d4f6){return db['ChatInternalMessage'][_0x7a10('0x49')]()['then'](respondWithResult(_0xa3d4f6,null))[_0x7a10('0x3f')](handleError(_0xa3d4f6,null));};function wrapUser(_0x4deccb){return function(_0x13ef39){var _0x5b7a79=_0x4deccb['get']({'plain':!![]});_0x5b7a79['messages']=[];if(_0x13ef39){_0x5b7a79['lastMessageAt']=_0x13ef39[_0x7a10('0x4a')];_0x5b7a79[_0x7a10('0x4b')]=_0x13ef39;}else{_0x5b7a79[_0x7a10('0x4c')]=moment(0x0)[_0x7a10('0x4d')](_0x7a10('0x4e'));_0x5b7a79[_0x7a10('0x4b')]={};}return _0x5b7a79;};}exports['getUsers']=function(_0x47e7ae,_0x120948,_0x530540){var _0x3ecc16=[];return db[_0x7a10('0x4f')]['findAll']({'where':{'role':[_0x7a10('0x50'),'admin',_0x7a10('0x51')]},'attributes':['id',_0x7a10('0x52'),_0x7a10('0x29'),'role',_0x7a10('0x53'),'internal',_0x7a10('0x54'),'lastLoginAt',_0x7a10('0x55'),_0x7a10('0x56')],'order':qs[_0x7a10('0x57')](_0x7a10('0x58')),'include':[{'model':db[_0x7a10('0x59')],'as':_0x7a10('0x5a'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x7a10('0x26')](function(_0x1c3eed){if(_0x1c3eed){var _0x513bbb=_0x47e7ae[_0x7a10('0x51')][_0x7a10('0x5b')]({'plain':!![]});if(!_0x513bbb)throw new Error(_0x7a10('0x5c'));if(_0x513bbb[_0x7a10('0x5d')]===_0x7a10('0x51')){return db['UserProfileSection'][_0x7a10('0x48')]({'where':{'name':'Agents','userProfileId':_0x513bbb[_0x7a10('0x5e')]},'raw':!![]})[_0x7a10('0x26')](function(_0x497707){if(_0x497707){if(_0x497707[_0x7a10('0x5f')]===0x0){return db[_0x7a10('0x60')][_0x7a10('0x3d')]({'where':{'sectionId':_0x497707['id']},'raw':!![]})['then'](function(_0x3b80a7){var _0x53ce17=[];if(_[_0x7a10('0x61')](_0x3b80a7)){_0x53ce17=_[_0x7a10('0x39')](_0x1c3eed,function(_0x92d640){if(_0x92d640[_0x7a10('0x5d')]!=='agent'){return _0x92d640;}});return _0x53ce17;}else{for(var _0x47c520=0x0;_0x47c520<_0x1c3eed[_0x7a10('0x41')];_0x47c520++){var _0x4c7882=_0x1c3eed[_0x47c520];if(_0x4c7882[_0x7a10('0x5d')]===_0x7a10('0x50')){var _0x2dee49=_[_0x7a10('0x48')](_0x3b80a7,function(_0x459526){return _0x459526['resourceId']===_0x4c7882['id'];});if(_0x2dee49)_0x53ce17[_0x7a10('0x62')](_0x4c7882);}else{_0x53ce17[_0x7a10('0x62')](_0x4c7882);}}return _0x53ce17;}});}else{return _0x1c3eed;}}else{var _0x1e84fc=_[_0x7a10('0x39')](_0x1c3eed,function(_0x3bd16f){if(_0x3bd16f[_0x7a10('0x5d')]!==_0x7a10('0x50')){return _0x3bd16f;}});return _0x1e84fc;}});}else{return _0x1c3eed;}}})[_0x7a10('0x26')](function(_0x392bdd){var _0x4ea09c=[];if(_0x392bdd){_0x3ecc16=_0x392bdd;for(var _0x174654=0x0;_0x174654<_0x392bdd[_0x7a10('0x41')];_0x174654+=0x1){_0x3ecc16[_0x174654][_0x7a10('0x63')]=[];_0x4ea09c['push'](db['ChatInternalMessage'][_0x7a10('0x48')]({'where':{'FromId':[_0x47e7ae[_0x7a10('0x51')]['id'],_0x392bdd[_0x174654]['id']],'ToId':[_0x47e7ae[_0x7a10('0x51')]['id'],_0x392bdd[_0x174654]['id']],'ChatGroupId':null},'attributes':['id',_0x7a10('0x4a'),_0x7a10('0x64'),_0x7a10('0x65'),_0x7a10('0x66'),_0x7a10('0x47')],'order':qs[_0x7a10('0x57')](_0x7a10('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7a10('0x26')](wrapUser(_0x392bdd[_0x174654])));}return BPromise[_0x7a10('0x68')](_0x4ea09c);}return[];})[_0x7a10('0x26')](function(_0x44b14a){return{'rows':_0x44b14a,'count':_0x44b14a['length']};})['then'](respondWithResult(_0x120948,null))['catch'](handleError(_0x120948,null));}; \ No newline at end of file +var _0x3bc8=['fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','createdAt','FromId','read','-createdAt','all','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','name','send','ChatInternalMessage','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','describe','messages','lastMessageAt','lastMessage','getUsers','User','agent','admin','user'];(function(_0x4dba31,_0x3ce4c5){var _0x35cec6=function(_0x2f272d){while(--_0x2f272d){_0x4dba31['push'](_0x4dba31['shift']());}};_0x35cec6(++_0x3ce4c5);}(_0x3bc8,0x160));var _0x83bc=function(_0x5d7ff4,_0x1384c1){_0x5d7ff4=_0x5d7ff4-0x0;var _0x3edd41=_0x3bc8[_0x5d7ff4];return _0x3edd41;};'use strict';var emlformat=require(_0x83bc('0x0'));var rimraf=require(_0x83bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x83bc('0x2'));var moment=require(_0x83bc('0x3'));var BPromise=require(_0x83bc('0x4'));var Mustache=require(_0x83bc('0x5'));var util=require(_0x83bc('0x6'));var path=require(_0x83bc('0x7'));var sox=require(_0x83bc('0x8'));var csv=require('to-csv');var ejs=require(_0x83bc('0x9'));var fs=require('fs');var fs_extra=require(_0x83bc('0xa'));var _=require(_0x83bc('0xb'));var squel=require(_0x83bc('0xc'));var crypto=require(_0x83bc('0xd'));var jsforce=require(_0x83bc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x83bc('0xf'));var querystring=require(_0x83bc('0x10'));var Papa=require('papaparse');var Redis=require(_0x83bc('0x11'));var authService=require(_0x83bc('0x12'));var qs=require(_0x83bc('0x13'));var as=require(_0x83bc('0x14'));var hardwareService=require(_0x83bc('0x15'));var logger=require(_0x83bc('0x16'))(_0x83bc('0x17'));var utils=require('../../config/utils');var config=require(_0x83bc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x83bc('0x19'))['db'];config[_0x83bc('0x1a')]=_['defaults'](config[_0x83bc('0x1a')],{'host':_0x83bc('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x83bc('0x1a')]));require(_0x83bc('0x1c'))[_0x83bc('0x1d')](socket);function respondWithStatusCode(_0x2dca73,_0x43ef1b){_0x43ef1b=_0x43ef1b||0xcc;return function(_0xe95bef){if(_0xe95bef){return _0x2dca73[_0x83bc('0x1e')](_0x43ef1b);}return _0x2dca73['status'](_0x43ef1b)[_0x83bc('0x1f')]();};}function respondWithResult(_0xfcb918,_0x4aa4eb){_0x4aa4eb=_0x4aa4eb||0xc8;return function(_0x34a759){if(_0x34a759){return _0xfcb918[_0x83bc('0x20')](_0x4aa4eb)[_0x83bc('0x21')](_0x34a759);}};}function respondWithFilteredResult(_0x22fdf3,_0x19f246){return function(_0x2b7afa){if(_0x2b7afa){var _0x381642=typeof _0x19f246[_0x83bc('0x22')]===_0x83bc('0x23')&&typeof _0x19f246[_0x83bc('0x24')]==='undefined';var _0x1272f4=_0x2b7afa[_0x83bc('0x25')];var _0x424d65=_0x381642?0x0:_0x19f246[_0x83bc('0x22')];var _0x2216f4=_0x381642?_0x2b7afa[_0x83bc('0x25')]:_0x19f246[_0x83bc('0x22')]+_0x19f246[_0x83bc('0x24')];var _0x526014;if(_0x2216f4>=_0x1272f4){_0x2216f4=_0x1272f4;_0x526014=0xc8;}else{_0x526014=0xce;}_0x22fdf3['status'](_0x526014);return _0x22fdf3[_0x83bc('0x26')](_0x83bc('0x27'),_0x424d65+'-'+_0x2216f4+'/'+_0x1272f4)[_0x83bc('0x21')](_0x2b7afa);}return null;};}function patchUpdates(_0x134ab2){return function(_0x298a99){try{jsonpatch['apply'](_0x298a99,_0x134ab2,!![]);}catch(_0x3b606c){return BPromise[_0x83bc('0x28')](_0x3b606c);}return _0x298a99['save']();};}function saveUpdates(_0x1c4246,_0x14a684){return function(_0x381d17){if(_0x381d17){return _0x381d17[_0x83bc('0x29')](_0x1c4246)[_0x83bc('0x2a')](function(_0x3a6d8d){return _0x3a6d8d;});}return null;};}function removeEntity(_0x43ae7f,_0x10bd13){return function(_0x3a4b90){if(_0x3a4b90){return _0x3a4b90[_0x83bc('0x2b')]()['then'](function(){_0x43ae7f[_0x83bc('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4330ec,_0x148709){return function(_0x2f01ef){if(!_0x2f01ef){_0x4330ec[_0x83bc('0x1e')](0x194);}return _0x2f01ef;};}function handleError(_0x162960,_0x2ca0c6){_0x2ca0c6=_0x2ca0c6||0x1f4;return function(_0x1a5de){logger[_0x83bc('0x2c')](_0x1a5de['stack']);if(_0x1a5de['name']){delete _0x1a5de[_0x83bc('0x2d')];}_0x162960['status'](_0x2ca0c6)[_0x83bc('0x2e')](_0x1a5de);};}exports['index']=function(_0x4daa60,_0x369b88){var _0x5724ff={},_0x2d0c01={},_0x4ce7ea={'count':0x0,'rows':[]};var _0x37faf2=_['map'](db[_0x83bc('0x2f')][_0x83bc('0x30')],function(_0x160900){return{'name':_0x160900['fieldName'],'type':_0x160900[_0x83bc('0x31')][_0x83bc('0x32')]};});_0x2d0c01[_0x83bc('0x33')]=_[_0x83bc('0x34')](_0x37faf2,_0x83bc('0x2d'));_0x2d0c01['query']=_[_0x83bc('0x35')](_0x4daa60[_0x83bc('0x36')]);_0x2d0c01[_0x83bc('0x37')]=_[_0x83bc('0x38')](_0x2d0c01['model'],_0x2d0c01[_0x83bc('0x36')]);_0x5724ff[_0x83bc('0x39')]=_['intersection'](_0x2d0c01[_0x83bc('0x33')],qs[_0x83bc('0x3a')](_0x4daa60[_0x83bc('0x36')][_0x83bc('0x3a')]));_0x5724ff[_0x83bc('0x39')]=_0x5724ff['attributes'][_0x83bc('0x3b')]?_0x5724ff[_0x83bc('0x39')]:_0x2d0c01[_0x83bc('0x33')];if(!_0x4daa60['query'][_0x83bc('0x3c')](_0x83bc('0x3d'))){_0x5724ff['limit']=qs['limit'](_0x4daa60['query'][_0x83bc('0x24')]);_0x5724ff[_0x83bc('0x22')]=qs[_0x83bc('0x22')](_0x4daa60[_0x83bc('0x36')][_0x83bc('0x22')]);}_0x5724ff[_0x83bc('0x3e')]=qs[_0x83bc('0x3f')](_0x4daa60[_0x83bc('0x36')][_0x83bc('0x3f')]);_0x5724ff[_0x83bc('0x40')]=qs[_0x83bc('0x37')](_[_0x83bc('0x41')](_0x4daa60[_0x83bc('0x36')],_0x2d0c01[_0x83bc('0x37')]),_0x37faf2);if(_0x4daa60[_0x83bc('0x36')][_0x83bc('0x42')]){_0x5724ff[_0x83bc('0x40')]=_[_0x83bc('0x43')](_0x5724ff['where'],{'$or':_['map'](_0x37faf2,function(_0x5202ca){if(_0x5202ca[_0x83bc('0x31')]!==_0x83bc('0x44')){var _0x5fcc26={};_0x5fcc26[_0x5202ca[_0x83bc('0x2d')]]={'$like':'%'+_0x4daa60[_0x83bc('0x36')][_0x83bc('0x42')]+'%'};return _0x5fcc26;}})});}_0x5724ff=_['merge']({},_0x5724ff,_0x4daa60['options']);var _0x3925dc={'where':_0x5724ff[_0x83bc('0x40')]};return db[_0x83bc('0x2f')]['count'](_0x3925dc)[_0x83bc('0x2a')](function(_0x2c7f62){_0x4ce7ea[_0x83bc('0x25')]=_0x2c7f62;if(_0x4daa60[_0x83bc('0x36')][_0x83bc('0x45')]){_0x5724ff[_0x83bc('0x46')]=[{'all':!![]}];}return db[_0x83bc('0x2f')][_0x83bc('0x47')](_0x5724ff);})[_0x83bc('0x2a')](function(_0xaef749){_0x4ce7ea[_0x83bc('0x48')]=_0xaef749;return _0x4ce7ea;})[_0x83bc('0x2a')](respondWithFilteredResult(_0x369b88,_0x5724ff))[_0x83bc('0x49')](handleError(_0x369b88,null));};exports[_0x83bc('0x4a')]=function(_0x5f0cd5,_0x1ea4fb){var _0x3328e9={'raw':!![],'where':{'id':_0x5f0cd5['params']['id']}},_0x36a1b2={};_0x36a1b2[_0x83bc('0x33')]=_[_0x83bc('0x35')](db[_0x83bc('0x2f')][_0x83bc('0x30')]);_0x36a1b2[_0x83bc('0x36')]=_[_0x83bc('0x35')](_0x5f0cd5[_0x83bc('0x36')]);_0x36a1b2['filters']=_[_0x83bc('0x38')](_0x36a1b2[_0x83bc('0x33')],_0x36a1b2[_0x83bc('0x36')]);_0x3328e9['attributes']=_[_0x83bc('0x38')](_0x36a1b2[_0x83bc('0x33')],qs['fields'](_0x5f0cd5[_0x83bc('0x36')]['fields']));_0x3328e9[_0x83bc('0x39')]=_0x3328e9[_0x83bc('0x39')][_0x83bc('0x3b')]?_0x3328e9['attributes']:_0x36a1b2['model'];if(_0x5f0cd5['query']['includeAll']){_0x3328e9['include']=[{'all':!![]}];}_0x3328e9=_[_0x83bc('0x43')]({},_0x3328e9,_0x5f0cd5[_0x83bc('0x4b')]);return db[_0x83bc('0x2f')][_0x83bc('0x4c')](_0x3328e9)[_0x83bc('0x2a')](handleEntityNotFound(_0x1ea4fb,null))[_0x83bc('0x2a')](respondWithResult(_0x1ea4fb,null))[_0x83bc('0x49')](handleError(_0x1ea4fb,null));};exports['create']=function(_0x43cf9e,_0x1dc7bb){return db[_0x83bc('0x2f')][_0x83bc('0x4d')](_0x43cf9e[_0x83bc('0x4e')],{})[_0x83bc('0x2a')](respondWithResult(_0x1dc7bb,0xc9))[_0x83bc('0x49')](handleError(_0x1dc7bb,null));};exports[_0x83bc('0x29')]=function(_0x4a9eb7,_0x3774de){if(_0x4a9eb7[_0x83bc('0x4e')]['id']){delete _0x4a9eb7['body']['id'];}return db[_0x83bc('0x2f')]['find']({'where':{'id':_0x4a9eb7['params']['id']}})[_0x83bc('0x2a')](handleEntityNotFound(_0x3774de,null))[_0x83bc('0x2a')](saveUpdates(_0x4a9eb7[_0x83bc('0x4e')],null))[_0x83bc('0x2a')](respondWithResult(_0x3774de,null))[_0x83bc('0x49')](handleError(_0x3774de,null));};exports[_0x83bc('0x2b')]=function(_0x47464a,_0x2529c9){return db['ChatInternalMessage']['find']({'where':{'id':_0x47464a['params']['id']}})[_0x83bc('0x2a')](handleEntityNotFound(_0x2529c9,null))['then'](removeEntity(_0x2529c9,null))[_0x83bc('0x49')](handleError(_0x2529c9,null));};exports[_0x83bc('0x4f')]=function(_0x3ffd6c,_0xc3887d){return db['ChatInternalMessage'][_0x83bc('0x4f')]()[_0x83bc('0x2a')](respondWithResult(_0xc3887d,null))[_0x83bc('0x49')](handleError(_0xc3887d,null));};function wrapUser(_0x384135){return function(_0x3dd356){var _0x389f55=_0x384135['get']({'plain':!![]});_0x389f55[_0x83bc('0x50')]=[];if(_0x3dd356){_0x389f55[_0x83bc('0x51')]=_0x3dd356['createdAt'];_0x389f55['lastMessage']=_0x3dd356;}else{_0x389f55[_0x83bc('0x51')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x389f55[_0x83bc('0x52')]={};}return _0x389f55;};}exports[_0x83bc('0x53')]=function(_0x19993b,_0x4a66b5,_0x14afbc){var _0x2151a5=[];return db[_0x83bc('0x54')][_0x83bc('0x47')]({'where':{'role':[_0x83bc('0x55'),_0x83bc('0x56'),_0x83bc('0x57')]},'attributes':['id',_0x83bc('0x58'),_0x83bc('0x2d'),_0x83bc('0x59'),'userpic',_0x83bc('0x5a'),'online',_0x83bc('0x5b'),_0x83bc('0x5c'),_0x83bc('0x5d')],'order':qs[_0x83bc('0x3f')](_0x83bc('0x5e')),'include':[{'model':db[_0x83bc('0x5f')],'as':_0x83bc('0x60'),'attributes':['id',_0x83bc('0x2d'),_0x83bc('0x31')],'through':{'attributes':[]}}]})[_0x83bc('0x2a')](function(_0x211b09){if(_0x211b09){var _0x11e988=_0x19993b['user']['get']({'plain':!![]});if(!_0x11e988)throw new Error(_0x83bc('0x61'));if(_0x11e988['role']===_0x83bc('0x57')){return db[_0x83bc('0x62')][_0x83bc('0x4c')]({'where':{'name':_0x83bc('0x63'),'userProfileId':_0x11e988[_0x83bc('0x64')]},'raw':!![]})[_0x83bc('0x2a')](function(_0x176e08){if(_0x176e08){if(_0x176e08[_0x83bc('0x65')]===0x0){return db[_0x83bc('0x66')][_0x83bc('0x47')]({'where':{'sectionId':_0x176e08['id']},'raw':!![]})[_0x83bc('0x2a')](function(_0x2c4495){var _0x5e65cf=[];if(_['isEmpty'](_0x2c4495)){_0x5e65cf=_[_0x83bc('0x42')](_0x211b09,function(_0x59fa74){if(_0x59fa74['role']!==_0x83bc('0x55')){return _0x59fa74;}});return _0x5e65cf;}else{for(var _0x5837bf=0x0;_0x5837bf<_0x211b09['length'];_0x5837bf++){var _0x5bd859=_0x211b09[_0x5837bf];if(_0x5bd859[_0x83bc('0x59')]===_0x83bc('0x55')){var _0x4665ad=_[_0x83bc('0x4c')](_0x2c4495,function(_0x40d219){return _0x40d219[_0x83bc('0x67')]===_0x5bd859['id'];});if(_0x4665ad)_0x5e65cf[_0x83bc('0x68')](_0x5bd859);}else{_0x5e65cf[_0x83bc('0x68')](_0x5bd859);}}return _0x5e65cf;}});}else{return _0x211b09;}}else{var _0x3c8eb4=_[_0x83bc('0x42')](_0x211b09,function(_0xa3610b){if(_0xa3610b['role']!=='agent'){return _0xa3610b;}});return _0x3c8eb4;}});}else{return _0x211b09;}}})[_0x83bc('0x2a')](function(_0x4ee8c4){var _0x196ba2=[];if(_0x4ee8c4){_0x2151a5=_0x4ee8c4;for(var _0x2fbc3d=0x0;_0x2fbc3d<_0x4ee8c4[_0x83bc('0x3b')];_0x2fbc3d+=0x1){_0x2151a5[_0x2fbc3d]['messages']=[];_0x196ba2[_0x83bc('0x68')](db[_0x83bc('0x2f')]['find']({'where':{'FromId':[_0x19993b[_0x83bc('0x57')]['id'],_0x4ee8c4[_0x2fbc3d]['id']],'ToId':[_0x19993b['user']['id'],_0x4ee8c4[_0x2fbc3d]['id']],'ChatGroupId':null},'attributes':['id',_0x83bc('0x69'),_0x83bc('0x6a'),'ToId',_0x83bc('0x6b'),'body'],'order':qs['sort'](_0x83bc('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x83bc('0x2a')](wrapUser(_0x4ee8c4[_0x2fbc3d])));}return BPromise[_0x83bc('0x6d')](_0x196ba2);}return[];})[_0x83bc('0x2a')](function(_0x1a12f7){return{'rows':_0x1a12f7,'count':_0x1a12f7[_0x83bc('0x3b')]};})[_0x83bc('0x2a')](respondWithResult(_0x4a66b5,null))['catch'](handleError(_0x4a66b5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 09abab2..7fd5ef0 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 _0x16d4=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x16d4,0x189));var _0x416d=function(_0x41cfc3,_0x105532){_0x41cfc3=_0x41cfc3-0x0;var _0x32fec6=_0x16d4[_0x41cfc3];return _0x32fec6;};'use strict';var EventEmitter=require(_0x416d('0x0'));var ChatInternalMessage=require(_0x416d('0x1'))['db'][_0x416d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x416d('0x3')](0x0);var events={'afterCreate':_0x416d('0x4'),'afterUpdate':'update','afterDestroy':_0x416d('0x5')};function emitEvent(_0x5c69ee){return function(_0x5660d2,_0x3e4280,_0x2ad1f8){ChatInternalMessageEvents[_0x416d('0x6')](_0x5c69ee+':'+_0x5660d2['id'],_0x5660d2);ChatInternalMessageEvents[_0x416d('0x6')](_0x5c69ee,_0x5660d2);_0x2ad1f8(null);};}for(var e in events){if(events[_0x416d('0x7')](e)){var event=events[e];ChatInternalMessage[_0x416d('0x8')](e,emitEvent(event));}}module[_0x416d('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xed53=['hook','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x9c9f1c,_0x326a86){var _0x7e30d2=function(_0x44d78e){while(--_0x44d78e){_0x9c9f1c['push'](_0x9c9f1c['shift']());}};_0x7e30d2(++_0x326a86);}(_0xed53,0xf9));var _0x3ed5=function(_0x1bc9b0,_0x3ff7fe){_0x1bc9b0=_0x1bc9b0-0x0;var _0xb8efcc=_0xed53[_0x1bc9b0];return _0xb8efcc;};'use strict';var EventEmitter=require(_0x3ed5('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3ed5('0x1')](0x0);var events={'afterCreate':_0x3ed5('0x2'),'afterUpdate':_0x3ed5('0x3'),'afterDestroy':_0x3ed5('0x4')};function emitEvent(_0x38d682){return function(_0x185c13,_0x439f64,_0x2485a9){ChatInternalMessageEvents[_0x3ed5('0x5')](_0x38d682+':'+_0x185c13['id'],_0x185c13);ChatInternalMessageEvents[_0x3ed5('0x5')](_0x38d682,_0x185c13);_0x2485a9(null);};}for(var e in events){if(events[_0x3ed5('0x6')](e)){var event=events[e];ChatInternalMessage[_0x3ed5('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0c486ba..7ed06d0 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 _0x63cb=['chat_internal_messages','util','../../config/logger','api','moment','path','rimraf','./chatInternalMessage.attributes','define','ChatInternalMessage'];(function(_0x14ec24,_0x45b628){var _0x161f74=function(_0x2c8fa2){while(--_0x2c8fa2){_0x14ec24['push'](_0x14ec24['shift']());}};_0x161f74(++_0x45b628);}(_0x63cb,0x17d));var _0xb63c=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x63cb[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require(_0xb63c('0x0'));var logger=require(_0xb63c('0x1'))(_0xb63c('0x2'));var moment=require(_0xb63c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb63c('0x4'));var rimraf=require(_0xb63c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb63c('0x6'));module['exports']=function(_0x423f1b,_0x5e4ebc){return _0x423f1b[_0xb63c('0x7')](_0xb63c('0x8'),attributes,{'tableName':_0xb63c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb080=['utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4'];(function(_0x1c052f,_0xc383d3){var _0x1829b1=function(_0x1d31c2){while(--_0x1d31c2){_0x1c052f['push'](_0x1c052f['shift']());}};_0x1829b1(++_0xc383d3);}(_0xb080,0xfe));var _0x0b08=function(_0x361600,_0x2934b2){_0x361600=_0x361600-0x0;var _0x4c3bfe=_0xb080[_0x361600];return _0x4c3bfe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b08('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0b08('0x1'));var rp=require(_0x0b08('0x2'));var fs=require('fs');var path=require(_0x0b08('0x3'));var rimraf=require('rimraf');var config=require(_0x0b08('0x4'));var attributes=require(_0x0b08('0x5'));module[_0x0b08('0x6')]=function(_0x3a546b,_0xd78b82){return _0x3a546b[_0x0b08('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0b08('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0b08('0x9'),'collate':_0x0b08('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 95ac4a4..6dd92d7 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 _0xd0f5=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x410344,_0x11c039){var _0x210ff4=function(_0x24501a){while(--_0x24501a){_0x410344['push'](_0x410344['shift']());}};_0x210ff4(++_0x11c039);}(_0xd0f5,0xb6));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d0f('0x0'));var util=require(_0x5d0f('0x1'));var moment=require(_0x5d0f('0x2'));var BPromise=require(_0x5d0f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d0f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d0f('0x5'));var logger=require('../../config/logger')(_0x5d0f('0x6'));var config=require(_0x5d0f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d0f('0x8')]['http']({'port':0x232a});config[_0x5d0f('0x9')]=_[_0x5d0f('0xa')](config[_0x5d0f('0x9')],{'host':_0x5d0f('0xb'),'port':0x18eb});var socket=require(_0x5d0f('0xc'))(new Redis(config[_0x5d0f('0x9')]));require(_0x5d0f('0xd'))[_0x5d0f('0xe')](socket);function respondWithRpcPromise(_0x5b6189,_0x195c92,_0x26e3ef){return new BPromise(function(_0x162d4b,_0x3005dd){return client['request'](_0x5b6189,_0x26e3ef)[_0x5d0f('0xf')](function(_0xbe0baf){logger[_0x5d0f('0x10')](_0x5d0f('0x11'),_0x195c92,_0x5d0f('0x12'));logger[_0x5d0f('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x195c92,'request\x20sent',JSON[_0x5d0f('0x14')](_0xbe0baf));if(_0xbe0baf[_0x5d0f('0x15')]){if(_0xbe0baf[_0x5d0f('0x15')][_0x5d0f('0x16')]===0x1f4){logger[_0x5d0f('0x15')](_0x5d0f('0x11'),_0x195c92,_0xbe0baf['error'][_0x5d0f('0x17')]);return _0x3005dd(_0xbe0baf['error'][_0x5d0f('0x17')]);}logger[_0x5d0f('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x195c92,_0xbe0baf[_0x5d0f('0x15')][_0x5d0f('0x17')]);return _0x162d4b(_0xbe0baf[_0x5d0f('0x15')][_0x5d0f('0x17')]);}else{logger[_0x5d0f('0x10')](_0x5d0f('0x11'),_0x195c92,_0x5d0f('0x12'));_0x162d4b(_0xbe0baf[_0x5d0f('0x18')][_0x5d0f('0x17')]);}})['catch'](function(_0x1c28b6){logger[_0x5d0f('0x15')](_0x5d0f('0x11'),_0x195c92,_0x1c28b6);_0x3005dd(_0x1c28b6);});});} \ No newline at end of file +var _0x24f5=['http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x24f5,0x1ee));var _0x524f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x24f5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x524f('0x0'));var util=require(_0x524f('0x1'));var moment=require(_0x524f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x524f('0x3'));var db=require(_0x524f('0x4'))['db'];var utils=require(_0x524f('0x5'));var logger=require(_0x524f('0x6'))(_0x524f('0x7'));var config=require(_0x524f('0x8'));var jayson=require(_0x524f('0x9'));var client=jayson['client'][_0x524f('0xa')]({'port':0x232a});config[_0x524f('0xb')]=_['defaults'](config['redis'],{'host':_0x524f('0xc'),'port':0x18eb});var socket=require(_0x524f('0xd'))(new Redis(config[_0x524f('0xb')]));require(_0x524f('0xe'))['register'](socket);function respondWithRpcPromise(_0x2543bc,_0x6a84e2,_0x7d62ad){return new BPromise(function(_0x5b1328,_0x39b202){return client[_0x524f('0xf')](_0x2543bc,_0x7d62ad)[_0x524f('0x10')](function(_0x5c9580){logger[_0x524f('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x6a84e2,_0x524f('0x12'));logger[_0x524f('0x13')](_0x524f('0x14'),_0x6a84e2,_0x524f('0x12'),JSON[_0x524f('0x15')](_0x5c9580));if(_0x5c9580[_0x524f('0x16')]){if(_0x5c9580['error'][_0x524f('0x17')]===0x1f4){logger[_0x524f('0x16')](_0x524f('0x18'),_0x6a84e2,_0x5c9580[_0x524f('0x16')][_0x524f('0x19')]);return _0x39b202(_0x5c9580[_0x524f('0x16')][_0x524f('0x19')]);}logger[_0x524f('0x16')](_0x524f('0x18'),_0x6a84e2,_0x5c9580[_0x524f('0x16')][_0x524f('0x19')]);return _0x5b1328(_0x5c9580[_0x524f('0x16')]['message']);}else{logger[_0x524f('0x11')](_0x524f('0x18'),_0x6a84e2,_0x524f('0x12'));_0x5b1328(_0x5c9580[_0x524f('0x1a')]['message']);}})[_0x524f('0x1b')](function(_0x23e594){logger['error'](_0x524f('0x18'),_0x6a84e2,_0x23e594);_0x39b202(_0x23e594);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1708879..add7062 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 _0xc72d=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','removeListener'];(function(_0x553a37,_0x137a47){var _0x328ab7=function(_0xc15892){while(--_0xc15892){_0x553a37['push'](_0x553a37['shift']());}};_0x328ab7(++_0x137a47);}(_0xc72d,0x17c));var _0xdc72=function(_0x2807d1,_0x348adf){_0x2807d1=_0x2807d1-0x0;var _0x1f954f=_0xc72d[_0x2807d1];return _0x1f954f;};'use strict';var ChatInternalMessageEvents=require(_0xdc72('0x0'));var events=[_0xdc72('0x1'),_0xdc72('0x2'),_0xdc72('0x3')];function createListener(_0x551370,_0x59bcea){return function(_0x3dc8df){_0x59bcea['emit'](_0x551370,_0x3dc8df);};}function removeListener(_0x167bb5,_0x36138d){return function(){ChatInternalMessageEvents[_0xdc72('0x4')](_0x167bb5,_0x36138d);};}exports[_0xdc72('0x5')]=function(_0x12adb1){for(var _0x46aef5=0x0,_0x183066=events['length'];_0x46aef5<_0x183066;_0x46aef5++){var _0x7b35a3=events[_0x46aef5];var _0x395e16=createListener(_0xdc72('0x6')+_0x7b35a3,_0x12adb1);ChatInternalMessageEvents['on'](_0x7b35a3,_0x395e16);}}; \ No newline at end of file +var _0xc0ff=['update','emit','removeListener','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x44433d,_0xf56466){var _0x2a5fce=function(_0x4d1d79){while(--_0x4d1d79){_0x44433d['push'](_0x44433d['shift']());}};_0x2a5fce(++_0xf56466);}(_0xc0ff,0x1d2));var _0xfc0f=function(_0x2acd64,_0x4e8ce8){_0x2acd64=_0x2acd64-0x0;var _0x3d3fce=_0xc0ff[_0x2acd64];return _0x3d3fce;};'use strict';var ChatInternalMessageEvents=require(_0xfc0f('0x0'));var events=[_0xfc0f('0x1'),'remove',_0xfc0f('0x2')];function createListener(_0x3535d6,_0x5b67e1){return function(_0x430e47){_0x5b67e1[_0xfc0f('0x3')](_0x3535d6,_0x430e47);};}function removeListener(_0x3a0713,_0x2d36db){return function(){ChatInternalMessageEvents[_0xfc0f('0x4')](_0x3a0713,_0x2d36db);};}exports['register']=function(_0x1956fc){for(var _0x7b5341=0x0,_0x558b6e=events['length'];_0x7b5341<_0x558b6e;_0x7b5341++){var _0x3d46ca=events[_0x7b5341];var _0x109e67=createListener(_0xfc0f('0x5')+_0x3d46ca,_0x1956fc);ChatInternalMessageEvents['on'](_0x3d46ca,_0x109e67);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8f2b5b9..5f18c97 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 _0x56bd=['getUsers','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users'];(function(_0x4fe53a,_0x340ea9){var _0x52bfab=function(_0x594fe6){while(--_0x594fe6){_0x4fe53a['push'](_0x4fe53a['shift']());}};_0x52bfab(++_0x340ea9);}(_0x56bd,0x81));var _0xd56b=function(_0x1a1dc6,_0xe0c56d){_0x1a1dc6=_0x1a1dc6-0x0;var _0x34f5d1=_0x56bd[_0x1a1dc6];return _0x34f5d1;};'use strict';var multer=require(_0xd56b('0x0'));var util=require(_0xd56b('0x1'));var path=require(_0xd56b('0x2'));var timeout=require(_0xd56b('0x3'));var express=require(_0xd56b('0x4'));var router=express['Router']();var fs_extra=require(_0xd56b('0x5'));var auth=require(_0xd56b('0x6'));var interaction=require(_0xd56b('0x7'));var config=require('../../config/environment');var controller=require(_0xd56b('0x8'));router[_0xd56b('0x9')]('/',auth[_0xd56b('0xa')](),controller[_0xd56b('0xb')]);router[_0xd56b('0x9')](_0xd56b('0xc'),auth[_0xd56b('0xa')](),controller[_0xd56b('0xd')]);router[_0xd56b('0x9')](_0xd56b('0xe'),auth[_0xd56b('0xa')](),controller[_0xd56b('0xf')]);router['get'](_0xd56b('0x10'),auth[_0xd56b('0xa')](),controller[_0xd56b('0x11')]);router[_0xd56b('0x12')]('/',auth[_0xd56b('0xa')](),controller[_0xd56b('0x13')]);router[_0xd56b('0x14')](_0xd56b('0x10'),controller['update']);router[_0xd56b('0x15')](_0xd56b('0x10'),auth[_0xd56b('0xa')](),controller[_0xd56b('0x16')]);module[_0xd56b('0x17')]=router; \ No newline at end of file +var _0x3436=['isAuthenticated','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','index','/describe'];(function(_0x58f1c7,_0x1f2630){var _0x57adbe=function(_0x110138){while(--_0x110138){_0x58f1c7['push'](_0x58f1c7['shift']());}};_0x57adbe(++_0x1f2630);}(_0x3436,0x1b6));var _0x6343=function(_0x337eb3,_0x399261){_0x337eb3=_0x337eb3-0x0;var _0x2877a6=_0x3436[_0x337eb3];return _0x2877a6;};'use strict';var multer=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var path=require(_0x6343('0x2'));var timeout=require(_0x6343('0x3'));var express=require(_0x6343('0x4'));var router=express[_0x6343('0x5')]();var fs_extra=require(_0x6343('0x6'));var auth=require(_0x6343('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6343('0x8'));router[_0x6343('0x9')]('/',auth['isAuthenticated'](),controller[_0x6343('0xa')]);router[_0x6343('0x9')](_0x6343('0xb'),auth[_0x6343('0xc')](),controller[_0x6343('0xd')]);router[_0x6343('0x9')](_0x6343('0xe'),auth[_0x6343('0xc')](),controller[_0x6343('0xf')]);router[_0x6343('0x9')](_0x6343('0x10'),auth[_0x6343('0xc')](),controller[_0x6343('0x11')]);router[_0x6343('0x12')]('/',auth[_0x6343('0xc')](),controller[_0x6343('0x13')]);router[_0x6343('0x14')](_0x6343('0x10'),controller[_0x6343('0x15')]);router[_0x6343('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x6343('0x17')]);module[_0x6343('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7563a63..76af87c 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 _0x8a5c=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x4e4abb,_0x109927){var _0x3956ce=function(_0x528b5a){while(--_0x528b5a){_0x4e4abb['push'](_0x4e4abb['shift']());}};_0x3956ce(++_0x109927);}(_0x8a5c,0x136));var _0xc8a5=function(_0x529d85,_0x8cac1c){_0x529d85=_0x529d85-0x0;var _0x41e283=_0x8a5c[_0x529d85];return _0x41e283;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'body':{'type':Sequelize[_0xc8a5('0x2')](_0xc8a5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc8a5('0x5')]('in',_0xc8a5('0x6')),'defaultValue':_0xc8a5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc8a5('0x7')]},'providerResponse':{'type':Sequelize[_0xc8a5('0x2')]}}; \ No newline at end of file +var _0x351d=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0x4744b1,_0x1f53ed){var _0xa1e07=function(_0x3a1e89){while(--_0x3a1e89){_0x4744b1['push'](_0x4744b1['shift']());}};_0xa1e07(++_0x1f53ed);}(_0x351d,0x90));var _0xd351=function(_0x4c533d,_0x3cc214){_0x4c533d=_0x4c533d-0x0;var _0x49b304=_0x351d[_0x4c533d];return _0x49b304;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'body':{'type':Sequelize[_0xd351('0x1')](_0xd351('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd351('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd351('0x4')]('in','out'),'defaultValue':_0xd351('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd351('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd351('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5656bf1..6ff3f20 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 _0x2155=['socket.io-emitter','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','json','undefined','offset','limit','set','apply','update','destroy','status','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','format','[CHATMESSAGE: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','QueryTypes','SELECT','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','interaction','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','User','internal','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x417eed,_0x1e8b99){var _0x7887d3=function(_0x303e1d){while(--_0x303e1d){_0x417eed['push'](_0x417eed['shift']());}};_0x7887d3(++_0x1e8b99);}(_0x2155,0x178));var _0x5215=function(_0xcd5ebe,_0x16080a){_0xcd5ebe=_0xcd5ebe-0x0;var _0x28f05b=_0x2155[_0xcd5ebe];return _0x28f05b;};'use strict';var emlformat=require(_0x5215('0x0'));var rimraf=require(_0x5215('0x1'));var zipdir=require(_0x5215('0x2'));var jsonpatch=require(_0x5215('0x3'));var rp=require(_0x5215('0x4'));var moment=require(_0x5215('0x5'));var BPromise=require(_0x5215('0x6'));var Mustache=require(_0x5215('0x7'));var util=require(_0x5215('0x8'));var path=require(_0x5215('0x9'));var sox=require(_0x5215('0xa'));var csv=require(_0x5215('0xb'));var ejs=require(_0x5215('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5215('0xd'));var squel=require(_0x5215('0xe'));var crypto=require(_0x5215('0xf'));var jsforce=require(_0x5215('0x10'));var deskjs=require(_0x5215('0x11'));var toCsv=require(_0x5215('0xb'));var querystring=require(_0x5215('0x12'));var Papa=require(_0x5215('0x13'));var Redis=require(_0x5215('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x5215('0x15'));var as=require(_0x5215('0x16'));var hardwareService=require(_0x5215('0x17'));var logger=require(_0x5215('0x18'))(_0x5215('0x19'));var utils=require(_0x5215('0x1a'));var config=require(_0x5215('0x1b'));var licenseUtil=require(_0x5215('0x1c'));var db=require(_0x5215('0x1d'))['db'];config[_0x5215('0x1e')]=_[_0x5215('0x1f')](config[_0x5215('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x5215('0x20'))(new Redis(config[_0x5215('0x1e')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x5215('0x21'));var client=jayson[_0x5215('0x22')][_0x5215('0x23')]({'port':0x232c});var client9002=jayson[_0x5215('0x22')][_0x5215('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x27aac3,_0xfa1c55,_0x21f477,_0x317b11){return new BPromise(function(_0x3c480f,_0x8eb00b){var _0x2732aa=_0x317b11||client;return _0x2732aa['request'](_0x27aac3,_0x21f477)[_0x5215('0x24')](function(_0x27102f){logger[_0x5215('0x25')](_0x5215('0x26'),_0xfa1c55,_0x5215('0x27'));logger[_0x5215('0x28')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xfa1c55,_0x5215('0x27'),JSON[_0x5215('0x29')](_0x27102f));if(_0x27102f[_0x5215('0x2a')]){if(_0x27102f[_0x5215('0x2a')][_0x5215('0x2b')]===0x1f4){logger[_0x5215('0x2a')](_0x5215('0x26'),_0xfa1c55,_0x27102f[_0x5215('0x2a')][_0x5215('0x2c')]);return _0x8eb00b(_0x27102f[_0x5215('0x2a')]['message']);}logger[_0x5215('0x2a')](_0x5215('0x26'),_0xfa1c55,_0x27102f[_0x5215('0x2a')][_0x5215('0x2c')]);return _0x3c480f(_0x27102f['error'][_0x5215('0x2c')]);}else{logger[_0x5215('0x25')]('ChatMessage,\x20%s,\x20%s',_0xfa1c55,_0x5215('0x27'));_0x3c480f(_0x27102f[_0x5215('0x2d')]['message']);}})['catch'](function(_0x546efa){logger[_0x5215('0x2a')]('ChatMessage,\x20%s,\x20%s',_0xfa1c55,_0x546efa);_0x8eb00b(_0x546efa);});});}function respondWithStatusCode(_0xcff80,_0x51df38){_0x51df38=_0x51df38||0xcc;return function(_0x423ac3){if(_0x423ac3){return _0xcff80[_0x5215('0x2e')](_0x51df38);}return _0xcff80['status'](_0x51df38)[_0x5215('0x2f')]();};}function respondWithResult(_0x3a7a6f,_0xd23e3){_0xd23e3=_0xd23e3||0xc8;return function(_0x2bde1e){if(_0x2bde1e){return _0x3a7a6f['status'](_0xd23e3)[_0x5215('0x30')](_0x2bde1e);}};}function respondWithFilteredResult(_0x1a832e,_0x342266){return function(_0x36d60d){if(_0x36d60d){var _0x26edf8=typeof _0x342266['offset']===_0x5215('0x31')&&typeof _0x342266['limit']===_0x5215('0x31');var _0x104dbf=_0x36d60d['count'];var _0x37024b=_0x26edf8?0x0:_0x342266['offset'];var _0x181520=_0x26edf8?_0x36d60d['count']:_0x342266[_0x5215('0x32')]+_0x342266[_0x5215('0x33')];var _0x4647b1;if(_0x181520>=_0x104dbf){_0x181520=_0x104dbf;_0x4647b1=0xc8;}else{_0x4647b1=0xce;}_0x1a832e['status'](_0x4647b1);return _0x1a832e[_0x5215('0x34')]('Content-Range',_0x37024b+'-'+_0x181520+'/'+_0x104dbf)[_0x5215('0x30')](_0x36d60d);}return null;};}function patchUpdates(_0x40039c){return function(_0x20b431){try{jsonpatch[_0x5215('0x35')](_0x20b431,_0x40039c,!![]);}catch(_0x4cf583){return BPromise['reject'](_0x4cf583);}return _0x20b431['save']();};}function saveUpdates(_0x520d42,_0x2c5928){return function(_0x4fd477){if(_0x4fd477){return _0x4fd477[_0x5215('0x36')](_0x520d42)[_0x5215('0x24')](function(_0x1332a7){return _0x1332a7;});}return null;};}function removeEntity(_0x45c000,_0x386a00){return function(_0x30563b){if(_0x30563b){return _0x30563b[_0x5215('0x37')]()['then'](function(){_0x45c000[_0x5215('0x38')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c635a,_0x3695bf){return function(_0x5d2080){if(!_0x5d2080){_0x2c635a[_0x5215('0x2e')](0x194);}return _0x5d2080;};}function handleError(_0x5d007f,_0x203b14){_0x203b14=_0x203b14||0x1f4;return function(_0x7c1614){logger['error'](_0x7c1614[_0x5215('0x39')]);if(_0x7c1614[_0x5215('0x3a')]){delete _0x7c1614['name'];}_0x5d007f['status'](_0x203b14)[_0x5215('0x3b')](_0x7c1614);};}exports[_0x5215('0x3c')]=function(_0x323e39,_0x5c94b2){var _0x415b7e={},_0x3739ce={},_0x784ffa={'count':0x0,'rows':[]};var _0x382506=_[_0x5215('0x3d')](db[_0x5215('0x3e')][_0x5215('0x3f')],function(_0x5bcb89){return{'name':_0x5bcb89[_0x5215('0x40')],'type':_0x5bcb89[_0x5215('0x41')][_0x5215('0x42')]};});_0x3739ce['model']=_[_0x5215('0x3d')](_0x382506,'name');_0x3739ce[_0x5215('0x43')]=_['keys'](_0x323e39['query']);_0x3739ce[_0x5215('0x44')]=_[_0x5215('0x45')](_0x3739ce[_0x5215('0x46')],_0x3739ce[_0x5215('0x43')]);_0x415b7e[_0x5215('0x47')]=_[_0x5215('0x45')](_0x3739ce[_0x5215('0x46')],qs[_0x5215('0x48')](_0x323e39[_0x5215('0x43')][_0x5215('0x48')]));_0x415b7e['attributes']=_0x415b7e[_0x5215('0x47')][_0x5215('0x49')]?_0x415b7e['attributes']:_0x3739ce[_0x5215('0x46')];if(!_0x323e39['query'][_0x5215('0x4a')](_0x5215('0x4b'))){_0x415b7e[_0x5215('0x33')]=qs[_0x5215('0x33')](_0x323e39[_0x5215('0x43')][_0x5215('0x33')]);_0x415b7e[_0x5215('0x32')]=qs[_0x5215('0x32')](_0x323e39['query'][_0x5215('0x32')]);}_0x415b7e[_0x5215('0x4c')]=qs['sort'](_0x323e39[_0x5215('0x43')]['sort']);_0x415b7e['where']=qs[_0x5215('0x44')](_[_0x5215('0x4d')](_0x323e39[_0x5215('0x43')],_0x3739ce[_0x5215('0x44')]),_0x382506);if(_0x323e39[_0x5215('0x43')][_0x5215('0x4e')]){_0x415b7e[_0x5215('0x4f')]=_['merge'](_0x415b7e[_0x5215('0x4f')],{'$or':_[_0x5215('0x3d')](_0x382506,function(_0x52c4cc){if(_0x52c4cc[_0x5215('0x41')]!=='VIRTUAL'){var _0x1f1e8f={};_0x1f1e8f[_0x52c4cc[_0x5215('0x3a')]]={'$like':'%'+_0x323e39[_0x5215('0x43')][_0x5215('0x4e')]+'%'};return _0x1f1e8f;}})});}_0x415b7e=_[_0x5215('0x50')]({},_0x415b7e,_0x323e39['options']);var _0x21c2fa={'where':_0x415b7e[_0x5215('0x4f')]};return db['ChatMessage'][_0x5215('0x51')](_0x21c2fa)[_0x5215('0x24')](function(_0x531073){_0x784ffa[_0x5215('0x51')]=_0x531073;if(_0x323e39['query'][_0x5215('0x52')]){_0x415b7e[_0x5215('0x53')]=[{'all':!![]}];}return db[_0x5215('0x3e')][_0x5215('0x54')](_0x415b7e);})[_0x5215('0x24')](function(_0x126660){_0x784ffa[_0x5215('0x55')]=_0x126660;return _0x784ffa;})['then'](respondWithFilteredResult(_0x5c94b2,_0x415b7e))[_0x5215('0x56')](handleError(_0x5c94b2,null));};exports[_0x5215('0x57')]=function(_0x3493f5,_0x26c653){var _0x5ccb80={'raw':!![],'where':{'id':_0x3493f5[_0x5215('0x58')]['id']}},_0x9311be={};_0x9311be[_0x5215('0x46')]=_[_0x5215('0x59')](db[_0x5215('0x3e')]['rawAttributes']);_0x9311be[_0x5215('0x43')]=_['keys'](_0x3493f5[_0x5215('0x43')]);_0x9311be['filters']=_[_0x5215('0x45')](_0x9311be[_0x5215('0x46')],_0x9311be[_0x5215('0x43')]);_0x5ccb80['attributes']=_[_0x5215('0x45')](_0x9311be[_0x5215('0x46')],qs[_0x5215('0x48')](_0x3493f5[_0x5215('0x43')][_0x5215('0x48')]));_0x5ccb80['attributes']=_0x5ccb80['attributes'][_0x5215('0x49')]?_0x5ccb80['attributes']:_0x9311be[_0x5215('0x46')];if(_0x3493f5[_0x5215('0x43')][_0x5215('0x52')]){_0x5ccb80[_0x5215('0x53')]=[{'all':!![]}];}_0x5ccb80=_[_0x5215('0x50')]({},_0x5ccb80,_0x3493f5[_0x5215('0x5a')]);return db[_0x5215('0x3e')]['find'](_0x5ccb80)['then'](handleEntityNotFound(_0x26c653,null))['then'](respondWithResult(_0x26c653,null))[_0x5215('0x56')](handleError(_0x26c653,null));};exports['create']=function(_0x173db8,_0x2ee470){return db[_0x5215('0x3e')][_0x5215('0x5b')](_0x173db8[_0x5215('0x5c')],{})[_0x5215('0x24')](respondWithResult(_0x2ee470,0xc9))[_0x5215('0x56')](handleError(_0x2ee470,null));};exports['update']=function(_0x4aa68f,_0xa2082d){if(_0x4aa68f[_0x5215('0x5c')]['id']){delete _0x4aa68f[_0x5215('0x5c')]['id'];}return db[_0x5215('0x3e')][_0x5215('0x5d')]({'where':{'id':_0x4aa68f[_0x5215('0x58')]['id']}})['then'](handleEntityNotFound(_0xa2082d,null))['then'](saveUpdates(_0x4aa68f['body'],null))[_0x5215('0x24')](respondWithResult(_0xa2082d,null))[_0x5215('0x56')](handleError(_0xa2082d,null));};exports['destroy']=function(_0x5e87ad,_0x1df04b){return db[_0x5215('0x3e')][_0x5215('0x5d')]({'where':{'id':_0x5e87ad['params']['id']}})['then'](handleEntityNotFound(_0x1df04b,null))[_0x5215('0x24')](removeEntity(_0x1df04b,null))['catch'](handleError(_0x1df04b,null));};exports['describe']=function(_0x435c33,_0x3989cf){return db[_0x5215('0x3e')]['describe']()['then'](respondWithResult(_0x3989cf,null))[_0x5215('0x56')](handleError(_0x3989cf,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x5215('0x5e')]=function(_0x2b4da6,_0xaab3c2,_0x99e83c){var _0x40a159={'agent':{},'channel':'chat'};if(_0x2b4da6[_0x5215('0x5c')]['id']){delete _0x2b4da6[_0x5215('0x5c')]['id'];}_0x2b4da6[_0x5215('0x5c')][_0x5215('0x5f')]=!![];_0x2b4da6[_0x5215('0x5c')]['readAt']=moment()['format'](_0x5215('0x60'));_0x2b4da6[_0x5215('0x5c')][_0x5215('0x61')]=_0x2b4da6[_0x5215('0x5c')][_0x5215('0x61')]||_0x2b4da6[_0x5215('0x62')]['id'];_0x40a159['agent']['id']=_0x2b4da6[_0x5215('0x5c')]['UserId'];return db[_0x5215('0x3e')][_0x5215('0x5d')]({'where':{'id':_0x2b4da6[_0x5215('0x58')]['id'],'UserId':null}})[_0x5215('0x24')](handleEntityNotFound(_0xaab3c2,null))[_0x5215('0x24')](saveUpdates(_0x2b4da6[_0x5215('0x5c')],null))[_0x5215('0x24')](function(_0xaad82c){if(_0xaad82c){_0x40a159[_0x5215('0x2c')]=_0xaad82c[_0x5215('0x63')]({'plain':!![]});return db[_0x5215('0x64')][_0x5215('0x5d')]({'where':{'id':_0xaad82c[_0x5215('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xaab3c2,null))[_0x5215('0x24')](function(_0x2463df){if(_0x2463df){return _0x2463df['update']({'UserId':_0x2b4da6['body'][_0x5215('0x61')],'read1stAt':_[_0x5215('0x66')](_0x2463df['read1stAt'])?moment()[_0x5215('0x67')](_0x5215('0x60')):undefined});}return null;})[_0x5215('0x24')](function(_0x3eabec){if(_0x3eabec){_0x40a159['interaction']=_0x3eabec['get']({'plain':!![]});interaction_log[_0x5215('0x25')](_0x5215('0x68'),_0x2b4da6[_0x5215('0x62')]['id'],_0x2b4da6[_0x5215('0x62')]['name'],_0x2b4da6[_0x5215('0x62')][_0x5215('0x69')],_0x40a159['interaction']['id'],_0x2b4da6[_0x5215('0x5c')]?JSON['stringify'](_0x2b4da6[_0x5215('0x5c')]):_0x5215('0x6a'));return respondWithRpcPromise(_0x5215('0x6b'),_0x5215('0x6c'),_0x40a159);}return null;})['then'](function(_0x3273e3){var _0x32ab2a=_0x5215('0x6d')+_0x3273e3[_0x5215('0x2c')][_0x5215('0x6e')];return db[_0x5215('0x6f')][_0x5215('0x43')](_0x32ab2a,{'type':db['Sequelize'][_0x5215('0x70')][_0x5215('0x71')],'raw':!![]})['then'](function(_0x357196){return _0x357196;});})[_0x5215('0x24')](function(_0x2bb322){if(_0x2bb322){_0x40a159[_0x5215('0x2c')]['contact']=_0x2bb322[0x0];if(!_0x2b4da6[_0x5215('0x5c')][_0x5215('0x61')])return;return db['User'][_0x5215('0x5d')]({'where':{'id':_0x2b4da6[_0x5215('0x5c')]['UserId'],'role':_0x5215('0x72')},'attributes':['id',_0x5215('0x3a'),_0x5215('0x73'),_0x5215('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1a2f27){if(!_0x1a2f27)return null;_0x40a159[_0x5215('0x2c')][_0x5215('0x72')]=_0x1a2f27;return _0x40a159;})[_0x5215('0x24')](function(_0x45bee1){if(_0x45bee1){if(_0x2b4da6['body'][_0x5215('0x75')]){_0x40a159[_0x5215('0x2c')][_0x5215('0x76')]=util[_0x5215('0x67')](_0x5215('0x77'),_0x2b4da6[_0x5215('0x62')]['name']);_0x40a159[_0x5215('0x2c')][_0x5215('0x78')]=_0x40a159[_0x5215('0x78')];_0x40a159[_0x5215('0x2c')][_0x5215('0x79')]=_0x40a159['channel'];_0x40a159[_0x5215('0x2c')][_0x5215('0x7a')]=_0x5215('0x5e');return respondWithRpcPromise(_0x5215('0x7b'),_0x5215('0x7b'),{'event':_0x5215('0x7c'),'message':_[_0x5215('0x50')](_0x40a159['message'],JSON[_0x5215('0x7d')](_0x40a159[_0x5215('0x7e')]['formData']))},client9002)[_0x5215('0x24')](function(){return _0x40a159;});}return _0x40a159;}return null;})[_0x5215('0x24')](respondWithResult(_0xaab3c2,null))[_0x5215('0x56')](handleError(_0xaab3c2,null));};var interaction_log=require(_0x5215('0x18'))(_0x5215('0x7f'));exports[_0x5215('0x80')]=function(_0x3dc302,_0x128043,_0x33b2eb){var _0x356023={'agent':{},'channel':'chat'};if(_0x3dc302[_0x5215('0x5c')]['id']){delete _0x3dc302[_0x5215('0x5c')]['id'];}_0x3dc302['body']['UserId']=_0x3dc302[_0x5215('0x5c')]['UserId']||_0x3dc302['user']['id'];_0x356023['agent']['id']=_0x3dc302[_0x5215('0x5c')][_0x5215('0x61')];return db[_0x5215('0x3e')]['find']({'where':{'id':_0x3dc302[_0x5215('0x58')]['id'],'UserId':null}})[_0x5215('0x24')](handleEntityNotFound(_0x128043,null))['then'](function(_0x308624){if(_0x308624){_0x356023[_0x5215('0x2c')]=_0x308624['get']({'plain':!![]});return db[_0x5215('0x64')][_0x5215('0x5d')]({'where':{'id':_0x308624[_0x5215('0x65')]}});}return null;})[_0x5215('0x24')](handleEntityNotFound(_0x128043,null))['then'](function(_0x26ee63){if(_0x26ee63){_0x356023[_0x5215('0x7e')]=_0x26ee63[_0x5215('0x63')]({'plain':!![]});interaction_log[_0x5215('0x25')](_0x5215('0x81'),_0x3dc302[_0x5215('0x62')]['id'],_0x3dc302[_0x5215('0x62')][_0x5215('0x3a')],_0x3dc302['user']['role'],_0x356023['interaction']['id'],_0x3dc302[_0x5215('0x5c')]?JSON[_0x5215('0x29')](_0x3dc302['body']):_0x5215('0x6a'));return respondWithRpcPromise(_0x5215('0x82'),_0x5215('0x83'),_0x356023);}return null;})[_0x5215('0x24')](function(_0x4b6eb4){var _0x3c345a=_0x5215('0x6d')+_0x4b6eb4['message'][_0x5215('0x6e')];return db[_0x5215('0x6f')][_0x5215('0x43')](_0x3c345a,{'type':db['Sequelize'][_0x5215('0x70')][_0x5215('0x71')],'raw':!![]})[_0x5215('0x24')](function(_0x5f4a7e){return _0x5f4a7e;});})[_0x5215('0x24')](function(_0x5dcc5a){if(_0x5dcc5a){_0x356023[_0x5215('0x2c')][_0x5215('0x84')]=_0x5dcc5a[0x0];if(!_0x3dc302[_0x5215('0x5c')][_0x5215('0x61')])return;return db[_0x5215('0x85')]['find']({'where':{'id':_0x3dc302['body'][_0x5215('0x61')],'role':'agent'},'attributes':['id',_0x5215('0x3a'),'fullname',_0x5215('0x74'),_0x5215('0x86')],'raw':!![]});}return null;})[_0x5215('0x24')](function(_0x48766c){if(!_0x48766c)return null;_0x356023['message'][_0x5215('0x72')]=_0x48766c;return _0x356023;})['then'](function(_0x11f24f){if(_0x11f24f){_0x11f24f[_0x5215('0x2c')]['interface']=util[_0x5215('0x67')](_0x5215('0x77'),_0x3dc302[_0x5215('0x62')][_0x5215('0x3a')]);_0x11f24f[_0x5215('0x2c')][_0x5215('0x78')]=_0x356023[_0x5215('0x78')];_0x11f24f['message']['motionChannel']=_0x356023[_0x5215('0x78')];_0x11f24f[_0x5215('0x2c')][_0x5215('0x7a')]=_0x5215('0x80');respondWithRpcPromise('EventManager',_0x5215('0x7b'),{'event':'rejectmessage','message':_[_0x5215('0x50')](_0x356023[_0x5215('0x2c')],JSON[_0x5215('0x7d')](_0x356023['interaction'][_0x5215('0x87')]))},client9002);return _0x356023;}return null;})[_0x5215('0x24')](respondWithResult(_0x128043,null))[_0x5215('0x56')](handleError(_0x128043,null));}; \ No newline at end of file +var _0x3ea5=['../../config/license/util','redis','defaults','./chatMessage.socket','register','http','client','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','length','find','create','body','params','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','ContactId','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x37b507,_0x10c37c){var _0x3a5aca=function(_0x82557f){while(--_0x82557f){_0x37b507['push'](_0x37b507['shift']());}};_0x3a5aca(++_0x10c37c);}(_0x3ea5,0x6b));var _0x53ea=function(_0x1c6c83,_0x2b099c){_0x1c6c83=_0x1c6c83-0x0;var _0x2d7849=_0x3ea5[_0x1c6c83];return _0x2d7849;};'use strict';var emlformat=require(_0x53ea('0x0'));var rimraf=require(_0x53ea('0x1'));var zipdir=require(_0x53ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53ea('0x3'));var moment=require(_0x53ea('0x4'));var BPromise=require(_0x53ea('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53ea('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x53ea('0x7'));var fs=require('fs');var fs_extra=require(_0x53ea('0x8'));var _=require(_0x53ea('0x9'));var squel=require(_0x53ea('0xa'));var crypto=require(_0x53ea('0xb'));var jsforce=require(_0x53ea('0xc'));var deskjs=require(_0x53ea('0xd'));var toCsv=require(_0x53ea('0xe'));var querystring=require(_0x53ea('0xf'));var Papa=require(_0x53ea('0x10'));var Redis=require(_0x53ea('0x11'));var authService=require(_0x53ea('0x12'));var qs=require(_0x53ea('0x13'));var as=require(_0x53ea('0x14'));var hardwareService=require(_0x53ea('0x15'));var logger=require(_0x53ea('0x16'))(_0x53ea('0x17'));var utils=require(_0x53ea('0x18'));var config=require(_0x53ea('0x19'));var licenseUtil=require(_0x53ea('0x1a'));var db=require('../../mysqldb')['db'];config[_0x53ea('0x1b')]=_[_0x53ea('0x1c')](config[_0x53ea('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53ea('0x1b')]));require(_0x53ea('0x1d'))[_0x53ea('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x53ea('0x1f')]({'port':0x232c});var client9002=jayson[_0x53ea('0x20')][_0x53ea('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4a65b1,_0x7e227e,_0x56534a,_0xa1747a){return new BPromise(function(_0x4bce34,_0xd79bc3){var _0x20a17d=_0xa1747a||client;return _0x20a17d['request'](_0x4a65b1,_0x56534a)[_0x53ea('0x21')](function(_0x224da9){logger[_0x53ea('0x22')](_0x53ea('0x23'),_0x7e227e,'request\x20sent');logger[_0x53ea('0x24')](_0x53ea('0x25'),_0x7e227e,_0x53ea('0x26'),JSON[_0x53ea('0x27')](_0x224da9));if(_0x224da9[_0x53ea('0x28')]){if(_0x224da9[_0x53ea('0x28')][_0x53ea('0x29')]===0x1f4){logger[_0x53ea('0x28')](_0x53ea('0x23'),_0x7e227e,_0x224da9['error'][_0x53ea('0x2a')]);return _0xd79bc3(_0x224da9[_0x53ea('0x28')][_0x53ea('0x2a')]);}logger[_0x53ea('0x28')]('ChatMessage,\x20%s,\x20%s',_0x7e227e,_0x224da9[_0x53ea('0x28')][_0x53ea('0x2a')]);return _0x4bce34(_0x224da9[_0x53ea('0x28')]['message']);}else{logger[_0x53ea('0x22')](_0x53ea('0x23'),_0x7e227e,_0x53ea('0x26'));_0x4bce34(_0x224da9[_0x53ea('0x2b')][_0x53ea('0x2a')]);}})[_0x53ea('0x2c')](function(_0x1fbecd){logger['error'](_0x53ea('0x23'),_0x7e227e,_0x1fbecd);_0xd79bc3(_0x1fbecd);});});}function respondWithStatusCode(_0x32e820,_0x4e3505){_0x4e3505=_0x4e3505||0xcc;return function(_0x16ef01){if(_0x16ef01){return _0x32e820['sendStatus'](_0x4e3505);}return _0x32e820[_0x53ea('0x2d')](_0x4e3505)[_0x53ea('0x2e')]();};}function respondWithResult(_0x4bc7d7,_0x4d7b12){_0x4d7b12=_0x4d7b12||0xc8;return function(_0x333a70){if(_0x333a70){return _0x4bc7d7[_0x53ea('0x2d')](_0x4d7b12)['json'](_0x333a70);}};}function respondWithFilteredResult(_0x47fcac,_0x5e69c2){return function(_0x8236b3){if(_0x8236b3){var _0x2cac2a=typeof _0x5e69c2[_0x53ea('0x2f')]===_0x53ea('0x30')&&typeof _0x5e69c2['limit']==='undefined';var _0x54da81=_0x8236b3['count'];var _0x5ea80f=_0x2cac2a?0x0:_0x5e69c2[_0x53ea('0x2f')];var _0x2a32de=_0x2cac2a?_0x8236b3[_0x53ea('0x31')]:_0x5e69c2[_0x53ea('0x2f')]+_0x5e69c2[_0x53ea('0x32')];var _0x23dcfb;if(_0x2a32de>=_0x54da81){_0x2a32de=_0x54da81;_0x23dcfb=0xc8;}else{_0x23dcfb=0xce;}_0x47fcac['status'](_0x23dcfb);return _0x47fcac['set'](_0x53ea('0x33'),_0x5ea80f+'-'+_0x2a32de+'/'+_0x54da81)[_0x53ea('0x34')](_0x8236b3);}return null;};}function patchUpdates(_0x37b641){return function(_0x418340){try{jsonpatch[_0x53ea('0x35')](_0x418340,_0x37b641,!![]);}catch(_0x24f441){return BPromise[_0x53ea('0x36')](_0x24f441);}return _0x418340[_0x53ea('0x37')]();};}function saveUpdates(_0xa78cdd,_0x31be8a){return function(_0x2c1b2b){if(_0x2c1b2b){return _0x2c1b2b[_0x53ea('0x38')](_0xa78cdd)[_0x53ea('0x21')](function(_0x3e78cf){return _0x3e78cf;});}return null;};}function removeEntity(_0x37118a,_0x2d6526){return function(_0xa57c37){if(_0xa57c37){return _0xa57c37[_0x53ea('0x39')]()[_0x53ea('0x21')](function(){_0x37118a[_0x53ea('0x2d')](0xcc)[_0x53ea('0x2e')]();});}};}function handleEntityNotFound(_0x217e2a,_0x1db91f){return function(_0xf5c0d1){if(!_0xf5c0d1){_0x217e2a[_0x53ea('0x3a')](0x194);}return _0xf5c0d1;};}function handleError(_0x125609,_0x53a666){_0x53a666=_0x53a666||0x1f4;return function(_0xd17c12){logger[_0x53ea('0x28')](_0xd17c12[_0x53ea('0x3b')]);if(_0xd17c12[_0x53ea('0x3c')]){delete _0xd17c12['name'];}_0x125609[_0x53ea('0x2d')](_0x53a666)[_0x53ea('0x3d')](_0xd17c12);};}exports[_0x53ea('0x3e')]=function(_0x2236c1,_0x2818dc){var _0x56f3bd={},_0xab010e={},_0x545c9b={'count':0x0,'rows':[]};var _0x311ad9=_[_0x53ea('0x3f')](db[_0x53ea('0x40')][_0x53ea('0x41')],function(_0x197f6c){return{'name':_0x197f6c['fieldName'],'type':_0x197f6c[_0x53ea('0x42')][_0x53ea('0x43')]};});_0xab010e['model']=_[_0x53ea('0x3f')](_0x311ad9,_0x53ea('0x3c'));_0xab010e[_0x53ea('0x44')]=_[_0x53ea('0x45')](_0x2236c1[_0x53ea('0x44')]);_0xab010e[_0x53ea('0x46')]=_[_0x53ea('0x47')](_0xab010e[_0x53ea('0x48')],_0xab010e[_0x53ea('0x44')]);_0x56f3bd['attributes']=_[_0x53ea('0x47')](_0xab010e[_0x53ea('0x48')],qs[_0x53ea('0x49')](_0x2236c1[_0x53ea('0x44')][_0x53ea('0x49')]));_0x56f3bd[_0x53ea('0x4a')]=_0x56f3bd['attributes']['length']?_0x56f3bd['attributes']:_0xab010e[_0x53ea('0x48')];if(!_0x2236c1[_0x53ea('0x44')][_0x53ea('0x4b')]('nolimit')){_0x56f3bd[_0x53ea('0x32')]=qs[_0x53ea('0x32')](_0x2236c1[_0x53ea('0x44')][_0x53ea('0x32')]);_0x56f3bd['offset']=qs[_0x53ea('0x2f')](_0x2236c1['query'][_0x53ea('0x2f')]);}_0x56f3bd['order']=qs[_0x53ea('0x4c')](_0x2236c1[_0x53ea('0x44')]['sort']);_0x56f3bd['where']=qs[_0x53ea('0x46')](_['pick'](_0x2236c1[_0x53ea('0x44')],_0xab010e[_0x53ea('0x46')]),_0x311ad9);if(_0x2236c1['query'][_0x53ea('0x4d')]){_0x56f3bd[_0x53ea('0x4e')]=_[_0x53ea('0x4f')](_0x56f3bd[_0x53ea('0x4e')],{'$or':_[_0x53ea('0x3f')](_0x311ad9,function(_0x47919c){if(_0x47919c[_0x53ea('0x42')]!=='VIRTUAL'){var _0x2685ad={};_0x2685ad[_0x47919c['name']]={'$like':'%'+_0x2236c1[_0x53ea('0x44')]['filter']+'%'};return _0x2685ad;}})});}_0x56f3bd=_['merge']({},_0x56f3bd,_0x2236c1[_0x53ea('0x50')]);var _0x3ad9b3={'where':_0x56f3bd['where']};return db[_0x53ea('0x40')][_0x53ea('0x31')](_0x3ad9b3)[_0x53ea('0x21')](function(_0xf15658){_0x545c9b['count']=_0xf15658;if(_0x2236c1['query'][_0x53ea('0x51')]){_0x56f3bd[_0x53ea('0x52')]=[{'all':!![]}];}return db[_0x53ea('0x40')][_0x53ea('0x53')](_0x56f3bd);})[_0x53ea('0x21')](function(_0xcd8cd5){_0x545c9b[_0x53ea('0x54')]=_0xcd8cd5;return _0x545c9b;})[_0x53ea('0x21')](respondWithFilteredResult(_0x2818dc,_0x56f3bd))[_0x53ea('0x2c')](handleError(_0x2818dc,null));};exports[_0x53ea('0x55')]=function(_0x2967df,_0x3eec17){var _0x1f20d7={'raw':!![],'where':{'id':_0x2967df['params']['id']}},_0x4cbd3d={};_0x4cbd3d[_0x53ea('0x48')]=_[_0x53ea('0x45')](db[_0x53ea('0x40')]['rawAttributes']);_0x4cbd3d[_0x53ea('0x44')]=_[_0x53ea('0x45')](_0x2967df[_0x53ea('0x44')]);_0x4cbd3d[_0x53ea('0x46')]=_[_0x53ea('0x47')](_0x4cbd3d[_0x53ea('0x48')],_0x4cbd3d[_0x53ea('0x44')]);_0x1f20d7['attributes']=_[_0x53ea('0x47')](_0x4cbd3d[_0x53ea('0x48')],qs[_0x53ea('0x49')](_0x2967df[_0x53ea('0x44')][_0x53ea('0x49')]));_0x1f20d7[_0x53ea('0x4a')]=_0x1f20d7['attributes'][_0x53ea('0x56')]?_0x1f20d7[_0x53ea('0x4a')]:_0x4cbd3d[_0x53ea('0x48')];if(_0x2967df[_0x53ea('0x44')][_0x53ea('0x51')]){_0x1f20d7[_0x53ea('0x52')]=[{'all':!![]}];}_0x1f20d7=_['merge']({},_0x1f20d7,_0x2967df[_0x53ea('0x50')]);return db[_0x53ea('0x40')][_0x53ea('0x57')](_0x1f20d7)['then'](handleEntityNotFound(_0x3eec17,null))[_0x53ea('0x21')](respondWithResult(_0x3eec17,null))[_0x53ea('0x2c')](handleError(_0x3eec17,null));};exports[_0x53ea('0x58')]=function(_0x1df92d,_0x2bd0e2){return db[_0x53ea('0x40')][_0x53ea('0x58')](_0x1df92d[_0x53ea('0x59')],{})[_0x53ea('0x21')](respondWithResult(_0x2bd0e2,0xc9))['catch'](handleError(_0x2bd0e2,null));};exports[_0x53ea('0x38')]=function(_0x2facc0,_0x95e93a){if(_0x2facc0[_0x53ea('0x59')]['id']){delete _0x2facc0['body']['id'];}return db[_0x53ea('0x40')]['find']({'where':{'id':_0x2facc0[_0x53ea('0x5a')]['id']}})[_0x53ea('0x21')](handleEntityNotFound(_0x95e93a,null))[_0x53ea('0x21')](saveUpdates(_0x2facc0[_0x53ea('0x59')],null))[_0x53ea('0x21')](respondWithResult(_0x95e93a,null))['catch'](handleError(_0x95e93a,null));};exports[_0x53ea('0x39')]=function(_0x25bdf1,_0x32d668){return db['ChatMessage'][_0x53ea('0x57')]({'where':{'id':_0x25bdf1[_0x53ea('0x5a')]['id']}})['then'](handleEntityNotFound(_0x32d668,null))[_0x53ea('0x21')](removeEntity(_0x32d668,null))[_0x53ea('0x2c')](handleError(_0x32d668,null));};exports[_0x53ea('0x5b')]=function(_0x4ee1b4,_0x52b6c8){return db[_0x53ea('0x40')][_0x53ea('0x5b')]()[_0x53ea('0x21')](respondWithResult(_0x52b6c8,null))['catch'](handleError(_0x52b6c8,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x53ea('0x5c')]=function(_0x2f549c,_0x1b8eae,_0xb05a8d){var _0x203a7e={'agent':{},'channel':_0x53ea('0x5d')};if(_0x2f549c[_0x53ea('0x59')]['id']){delete _0x2f549c[_0x53ea('0x59')]['id'];}_0x2f549c['body']['read']=!![];_0x2f549c[_0x53ea('0x59')][_0x53ea('0x5e')]=moment()[_0x53ea('0x5f')](_0x53ea('0x60'));_0x2f549c[_0x53ea('0x59')][_0x53ea('0x61')]=_0x2f549c[_0x53ea('0x59')][_0x53ea('0x61')]||_0x2f549c['user']['id'];_0x203a7e['agent']['id']=_0x2f549c[_0x53ea('0x59')][_0x53ea('0x61')];return db[_0x53ea('0x40')][_0x53ea('0x57')]({'where':{'id':_0x2f549c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1b8eae,null))[_0x53ea('0x21')](saveUpdates(_0x2f549c[_0x53ea('0x59')],null))['then'](function(_0x17e103){if(_0x17e103){_0x203a7e[_0x53ea('0x2a')]=_0x17e103['get']({'plain':!![]});return db['ChatInteraction'][_0x53ea('0x57')]({'where':{'id':_0x17e103[_0x53ea('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1b8eae,null))[_0x53ea('0x21')](function(_0x49073e){if(_0x49073e){return _0x49073e['update']({'UserId':_0x2f549c[_0x53ea('0x59')][_0x53ea('0x61')],'read1stAt':_[_0x53ea('0x63')](_0x49073e[_0x53ea('0x64')])?moment()[_0x53ea('0x5f')](_0x53ea('0x60')):undefined});}return null;})[_0x53ea('0x21')](function(_0x2d86a1){if(_0x2d86a1){_0x203a7e[_0x53ea('0x65')]=_0x2d86a1[_0x53ea('0x66')]({'plain':!![]});interaction_log[_0x53ea('0x22')](_0x53ea('0x67'),_0x2f549c[_0x53ea('0x68')]['id'],_0x2f549c[_0x53ea('0x68')][_0x53ea('0x3c')],_0x2f549c[_0x53ea('0x68')][_0x53ea('0x69')],_0x203a7e[_0x53ea('0x65')]['id'],_0x2f549c[_0x53ea('0x59')]?JSON['stringify'](_0x2f549c[_0x53ea('0x59')]):'null');return respondWithRpcPromise(_0x53ea('0x6a'),_0x53ea('0x6b'),_0x203a7e);}return null;})[_0x53ea('0x21')](function(_0x18a3df){var _0x2b3a50=_0x53ea('0x6c')+_0x18a3df[_0x53ea('0x2a')]['ContactId'];return db[_0x53ea('0x6d')][_0x53ea('0x44')](_0x2b3a50,{'type':db[_0x53ea('0x6e')][_0x53ea('0x6f')][_0x53ea('0x70')],'raw':!![]})['then'](function(_0x31e0a3){return _0x31e0a3;});})[_0x53ea('0x21')](function(_0x5565d4){if(_0x5565d4){_0x203a7e[_0x53ea('0x2a')][_0x53ea('0x71')]=_0x5565d4[0x0];if(!_0x2f549c['body'][_0x53ea('0x61')])return;return db[_0x53ea('0x72')]['find']({'where':{'id':_0x2f549c['body'][_0x53ea('0x61')],'role':_0x53ea('0x73')},'attributes':['id',_0x53ea('0x3c'),_0x53ea('0x74'),_0x53ea('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x414196){if(!_0x414196)return null;_0x203a7e[_0x53ea('0x2a')][_0x53ea('0x73')]=_0x414196;return _0x203a7e;})[_0x53ea('0x21')](function(_0x355393){if(_0x355393){if(_0x2f549c[_0x53ea('0x59')][_0x53ea('0x76')]){_0x203a7e['message'][_0x53ea('0x77')]=util[_0x53ea('0x5f')]('SIP/%s',_0x2f549c[_0x53ea('0x68')][_0x53ea('0x3c')]);_0x203a7e[_0x53ea('0x2a')][_0x53ea('0x78')]=_0x203a7e[_0x53ea('0x78')];_0x203a7e[_0x53ea('0x2a')][_0x53ea('0x79')]=_0x203a7e[_0x53ea('0x78')];_0x203a7e[_0x53ea('0x2a')][_0x53ea('0x7a')]=_0x53ea('0x5c');return respondWithRpcPromise(_0x53ea('0x7b'),_0x53ea('0x7b'),{'event':_0x53ea('0x7c'),'message':_[_0x53ea('0x4f')](_0x203a7e[_0x53ea('0x2a')],JSON['parse'](_0x203a7e[_0x53ea('0x65')][_0x53ea('0x7d')]))},client9002)[_0x53ea('0x21')](function(){return _0x203a7e;});}return _0x203a7e;}return null;})['then'](respondWithResult(_0x1b8eae,null))[_0x53ea('0x2c')](handleError(_0x1b8eae,null));};var interaction_log=require(_0x53ea('0x16'))(_0x53ea('0x7e'));exports['reject']=function(_0x31f3cc,_0x540625,_0x831c19){var _0x427e49={'agent':{},'channel':'chat'};if(_0x31f3cc[_0x53ea('0x59')]['id']){delete _0x31f3cc['body']['id'];}_0x31f3cc['body'][_0x53ea('0x61')]=_0x31f3cc[_0x53ea('0x59')][_0x53ea('0x61')]||_0x31f3cc['user']['id'];_0x427e49[_0x53ea('0x73')]['id']=_0x31f3cc[_0x53ea('0x59')]['UserId'];return db[_0x53ea('0x40')][_0x53ea('0x57')]({'where':{'id':_0x31f3cc['params']['id'],'UserId':null}})[_0x53ea('0x21')](handleEntityNotFound(_0x540625,null))[_0x53ea('0x21')](function(_0xf3bced){if(_0xf3bced){_0x427e49[_0x53ea('0x2a')]=_0xf3bced[_0x53ea('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x53ea('0x57')]({'where':{'id':_0xf3bced[_0x53ea('0x62')]}});}return null;})[_0x53ea('0x21')](handleEntityNotFound(_0x540625,null))['then'](function(_0x1da709){if(_0x1da709){_0x427e49['interaction']=_0x1da709['get']({'plain':!![]});interaction_log[_0x53ea('0x22')](_0x53ea('0x7f'),_0x31f3cc[_0x53ea('0x68')]['id'],_0x31f3cc['user']['name'],_0x31f3cc[_0x53ea('0x68')][_0x53ea('0x69')],_0x427e49[_0x53ea('0x65')]['id'],_0x31f3cc['body']?JSON[_0x53ea('0x27')](_0x31f3cc[_0x53ea('0x59')]):_0x53ea('0x80'));return respondWithRpcPromise('RejectMessage',_0x53ea('0x81'),_0x427e49);}return null;})[_0x53ea('0x21')](function(_0x5f1239){var _0x5b9067=_0x53ea('0x6c')+_0x5f1239[_0x53ea('0x2a')][_0x53ea('0x82')];return db[_0x53ea('0x6d')]['query'](_0x5b9067,{'type':db[_0x53ea('0x6e')][_0x53ea('0x6f')][_0x53ea('0x70')],'raw':!![]})[_0x53ea('0x21')](function(_0x5b4f96){return _0x5b4f96;});})['then'](function(_0x48457a){if(_0x48457a){_0x427e49[_0x53ea('0x2a')][_0x53ea('0x71')]=_0x48457a[0x0];if(!_0x31f3cc[_0x53ea('0x59')][_0x53ea('0x61')])return;return db[_0x53ea('0x72')]['find']({'where':{'id':_0x31f3cc[_0x53ea('0x59')][_0x53ea('0x61')],'role':_0x53ea('0x73')},'attributes':['id','name','fullname',_0x53ea('0x75'),'internal'],'raw':!![]});}return null;})[_0x53ea('0x21')](function(_0x1867e6){if(!_0x1867e6)return null;_0x427e49['message'][_0x53ea('0x73')]=_0x1867e6;return _0x427e49;})[_0x53ea('0x21')](function(_0x31b769){if(_0x31b769){_0x31b769[_0x53ea('0x2a')]['interface']=util[_0x53ea('0x5f')](_0x53ea('0x83'),_0x31f3cc[_0x53ea('0x68')][_0x53ea('0x3c')]);_0x31b769['message'][_0x53ea('0x78')]=_0x427e49[_0x53ea('0x78')];_0x31b769[_0x53ea('0x2a')]['motionChannel']=_0x427e49['channel'];_0x31b769[_0x53ea('0x2a')][_0x53ea('0x7a')]='reject';respondWithRpcPromise(_0x53ea('0x7b'),_0x53ea('0x7b'),{'event':_0x53ea('0x84'),'message':_[_0x53ea('0x4f')](_0x427e49[_0x53ea('0x2a')],JSON['parse'](_0x427e49['interaction'][_0x53ea('0x7d')]))},client9002);return _0x427e49;}return null;})[_0x53ea('0x21')](respondWithResult(_0x540625,null))[_0x53ea('0x2c')](handleError(_0x540625,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9c3f673..611f63b 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 _0x78d3=['update','remove','emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x1bb206,_0x2595b9){var _0x3bb6b0=function(_0x4ca1cf){while(--_0x4ca1cf){_0x1bb206['push'](_0x1bb206['shift']());}};_0x3bb6b0(++_0x2595b9);}(_0x78d3,0x113));var _0x378d=function(_0x38e7ef,_0x30d42f){_0x38e7ef=_0x38e7ef-0x0;var _0x435869=_0x78d3[_0x38e7ef];return _0x435869;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x378d('0x0'))['db'][_0x378d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x378d('0x2')](0x0);var events={'afterCreate':_0x378d('0x3'),'afterUpdate':_0x378d('0x4'),'afterDestroy':_0x378d('0x5')};function emitEvent(_0x4d6c56){return function(_0x42e7d1,_0x30d449,_0x5982d7){ChatMessageEvents[_0x378d('0x6')](_0x4d6c56+':'+_0x42e7d1['id'],_0x42e7d1);ChatMessageEvents[_0x378d('0x6')](_0x4d6c56,_0x42e7d1);_0x5982d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x378d('0x7')](e,emitEvent(event));}}module[_0x378d('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xa606=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hook','exports'];(function(_0x3e32d6,_0x37c0bb){var _0x52af90=function(_0x185bc1){while(--_0x185bc1){_0x3e32d6['push'](_0x3e32d6['shift']());}};_0x52af90(++_0x37c0bb);}(_0xa606,0x1c2));var _0x6a60=function(_0xb5b334,_0x5ac5db){_0xb5b334=_0xb5b334-0x0;var _0x33f163=_0xa606[_0xb5b334];return _0x33f163;};'use strict';var EventEmitter=require(_0x6a60('0x0'));var ChatMessage=require(_0x6a60('0x1'))['db'][_0x6a60('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6a60('0x3')](0x0);var events={'afterCreate':_0x6a60('0x4'),'afterUpdate':_0x6a60('0x5'),'afterDestroy':'remove'};function emitEvent(_0x183c5f){return function(_0x1906d1,_0x2ba824,_0x400e83){ChatMessageEvents[_0x6a60('0x6')](_0x183c5f+':'+_0x1906d1['id'],_0x1906d1);ChatMessageEvents['emit'](_0x183c5f,_0x1906d1);_0x400e83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x6a60('0x7')](e,emitEvent(event));}}module[_0x6a60('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 b5ff276..672e0ea 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 _0xaccd=['exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes'];(function(_0x50e059,_0x20d836){var _0x529b99=function(_0xda2e3f){while(--_0xda2e3f){_0x50e059['push'](_0x50e059['shift']());}};_0x529b99(++_0x20d836);}(_0xaccd,0x1e6));var _0xdacc=function(_0x15a431,_0x3b4537){_0x15a431=_0x15a431-0x0;var _0x42e793=_0xaccd[_0x15a431];return _0x42e793;};'use strict';var _=require('lodash');var util=require(_0xdacc('0x0'));var logger=require(_0xdacc('0x1'))(_0xdacc('0x2'));var moment=require(_0xdacc('0x3'));var BPromise=require(_0xdacc('0x4'));var rp=require(_0xdacc('0x5'));var fs=require('fs');var path=require(_0xdacc('0x6'));var rimraf=require(_0xdacc('0x7'));var config=require(_0xdacc('0x8'));var attributes=require(_0xdacc('0x9'));module[_0xdacc('0xa')]=function(_0x47fab0,_0x292950){return _0x47fab0[_0xdacc('0xb')](_0xdacc('0xc'),attributes,{'tableName':_0xdacc('0xd'),'paranoid':![],'indexes':[{'name':_0xdacc('0xe'),'fields':[_0xdacc('0xf')],'type':_0xdacc('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12a2c6,_0x6d1f66,_0x3398cc){var _0xfb06f0=_0x47fab0['models'];var _0x4c37a2=_0x12a2c6['get']({'plain':!![]});if(_0x4c37a2[_0xdacc('0x11')][_0xdacc('0x12')]()==='in'||_0x4c37a2['direction'][_0xdacc('0x12')]()===_0xdacc('0x13')&&!_0x4c37a2[_0xdacc('0x14')]&&!_['isNil'](_0x4c37a2[_0xdacc('0x15')])){_0xfb06f0[_0xdacc('0x16')][_0xdacc('0x17')]({'where':{'id':_0x4c37a2[_0xdacc('0x18')]}})[_0xdacc('0x19')](function(_0x14d4c5){if(_0x14d4c5){_0x14d4c5[_0xdacc('0x1a')]({'lastMsgAt':_0x4c37a2[_0xdacc('0x1b')],'lastMsgDirection':_0x4c37a2[_0xdacc('0x11')][_0xdacc('0x12')]()});}})[_0xdacc('0x1c')](function(_0x325d77){console[_0xdacc('0x1d')](_0x325d77);});}_0x3398cc();}},'charset':_0xdacc('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1340=['createdAt','error','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','then','update'];(function(_0x5da3fa,_0x3ebbe2){var _0x23f911=function(_0x2cc4b7){while(--_0x2cc4b7){_0x5da3fa['push'](_0x5da3fa['shift']());}};_0x23f911(++_0x3ebbe2);}(_0x1340,0xab));var _0x0134=function(_0x346cf3,_0x567c74){_0x346cf3=_0x346cf3-0x0;var _0x5e70ca=_0x1340[_0x346cf3];return _0x5e70ca;};'use strict';var _=require(_0x0134('0x0'));var util=require('util');var logger=require(_0x0134('0x1'))('api');var moment=require(_0x0134('0x2'));var BPromise=require(_0x0134('0x3'));var rp=require(_0x0134('0x4'));var fs=require('fs');var path=require(_0x0134('0x5'));var rimraf=require(_0x0134('0x6'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module['exports']=function(_0x3c1d6b,_0x4020b2){return _0x3c1d6b[_0x0134('0x7')]('ChatMessage',attributes,{'tableName':_0x0134('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x0134('0x9')],'type':_0x0134('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19afd9,_0x2fa26f,_0x7c9059){var _0x5c0476=_0x3c1d6b[_0x0134('0xb')];var _0x2954dd=_0x19afd9[_0x0134('0xc')]({'plain':!![]});if(_0x2954dd[_0x0134('0xd')][_0x0134('0xe')]()==='in'||_0x2954dd[_0x0134('0xd')][_0x0134('0xe')]()==='out'&&!_0x2954dd[_0x0134('0xf')]&&!_[_0x0134('0x10')](_0x2954dd[_0x0134('0x11')])){_0x5c0476['ChatInteraction'][_0x0134('0x12')]({'where':{'id':_0x2954dd['ChatInteractionId']}})[_0x0134('0x13')](function(_0x1546b8){if(_0x1546b8){_0x1546b8[_0x0134('0x14')]({'lastMsgAt':_0x2954dd[_0x0134('0x15')],'lastMsgDirection':_0x2954dd[_0x0134('0xd')][_0x0134('0xe')]()});}})['catch'](function(_0x30f748){console[_0x0134('0x16')](_0x30f748);});}_0x7c9059();}},'charset':_0x0134('0x17'),'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 458f4ba..f5d696f 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 _0x3f72=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','options','raw','info','CreateChatMessage','debug','util','moment','randomstring'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x3f72,0x1a1));var _0x23f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x23f7('0x0'));var moment=require(_0x23f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x23f7('0x2'));var fs=require('fs');var Redis=require(_0x23f7('0x3'));var db=require(_0x23f7('0x4'))['db'];var utils=require(_0x23f7('0x5'));var logger=require(_0x23f7('0x6'))(_0x23f7('0x7'));var config=require(_0x23f7('0x8'));var jayson=require(_0x23f7('0x9'));var client=jayson[_0x23f7('0xa')][_0x23f7('0xb')]({'port':0x232a});config[_0x23f7('0xc')]=_[_0x23f7('0xd')](config[_0x23f7('0xc')],{'host':_0x23f7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23f7('0xc')]));require('./chatMessage.socket')[_0x23f7('0xf')](socket);function respondWithRpcPromise(_0x511429,_0x2066df,_0x53c322){return new BPromise(function(_0x315741,_0x33ca97){return client[_0x23f7('0x10')](_0x511429,_0x53c322)[_0x23f7('0x11')](function(_0x33c043){logger['info'](_0x23f7('0x12'),_0x2066df,_0x23f7('0x13'));logger['debug'](_0x23f7('0x14'),_0x2066df,_0x23f7('0x13'),JSON[_0x23f7('0x15')](_0x33c043));if(_0x33c043[_0x23f7('0x16')]){if(_0x33c043[_0x23f7('0x16')]['code']===0x1f4){logger[_0x23f7('0x16')]('ChatMessage,\x20%s,\x20%s',_0x2066df,_0x33c043[_0x23f7('0x16')]['message']);return _0x33ca97(_0x33c043[_0x23f7('0x16')]['message']);}logger[_0x23f7('0x16')](_0x23f7('0x12'),_0x2066df,_0x33c043['error']['message']);return _0x315741(_0x33c043['error'][_0x23f7('0x17')]);}else{logger['info'](_0x23f7('0x12'),_0x2066df,_0x23f7('0x13'));_0x315741(_0x33c043['result'][_0x23f7('0x17')]);}})[_0x23f7('0x18')](function(_0x5da851){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2066df,_0x5da851);_0x33ca97(_0x5da851);});});}exports['CreateChatMessage']=function(_0x44fa5a){var _0x28e1d2=this;return new Promise(function(_0x3c7fb5,_0x281b67){return db['ChatMessage']['create'](_0x44fa5a['body'],{'raw':_0x44fa5a[_0x23f7('0x19')]?_0x44fa5a[_0x23f7('0x19')][_0x23f7('0x1a')]===undefined?!![]:![]:!![]})[_0x23f7('0x11')](function(_0x4071a4){logger[_0x23f7('0x1b')](_0x23f7('0x1c'),_0x44fa5a);logger[_0x23f7('0x1d')](_0x23f7('0x1c'),_0x44fa5a,JSON[_0x23f7('0x15')](_0x4071a4));_0x3c7fb5(_0x4071a4);})[_0x23f7('0x18')](function(_0x43d4da){logger[_0x23f7('0x16')](_0x23f7('0x1c'),_0x43d4da[_0x23f7('0x17')],_0x44fa5a);_0x281b67(_0x28e1d2[_0x23f7('0x16')](0x1f4,_0x43d4da[_0x23f7('0x17')]));});});}; \ No newline at end of file +var _0x14f1=['ChatMessage','create','body','options','CreateChatMessage','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x14f1,0x71));var _0x114f=function(_0x2e2234,_0x5240a0){_0x2e2234=_0x2e2234-0x0;var _0x44f2d6=_0x14f1[_0x2e2234];return _0x44f2d6;};'use strict';var _=require(_0x114f('0x0'));var util=require('util');var moment=require(_0x114f('0x1'));var BPromise=require(_0x114f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x114f('0x3'));var db=require(_0x114f('0x4'))['db'];var utils=require(_0x114f('0x5'));var logger=require(_0x114f('0x6'))(_0x114f('0x7'));var config=require(_0x114f('0x8'));var jayson=require(_0x114f('0x9'));var client=jayson[_0x114f('0xa')][_0x114f('0xb')]({'port':0x232a});config[_0x114f('0xc')]=_[_0x114f('0xd')](config[_0x114f('0xc')],{'host':_0x114f('0xe'),'port':0x18eb});var socket=require(_0x114f('0xf'))(new Redis(config[_0x114f('0xc')]));require(_0x114f('0x10'))[_0x114f('0x11')](socket);function respondWithRpcPromise(_0x49593b,_0x22dd83,_0x18a0de){return new BPromise(function(_0x2fce4d,_0x4cf410){return client[_0x114f('0x12')](_0x49593b,_0x18a0de)[_0x114f('0x13')](function(_0x4f6f91){logger[_0x114f('0x14')](_0x114f('0x15'),_0x22dd83,'request\x20sent');logger[_0x114f('0x16')](_0x114f('0x17'),_0x22dd83,_0x114f('0x18'),JSON[_0x114f('0x19')](_0x4f6f91));if(_0x4f6f91[_0x114f('0x1a')]){if(_0x4f6f91[_0x114f('0x1a')][_0x114f('0x1b')]===0x1f4){logger[_0x114f('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x22dd83,_0x4f6f91[_0x114f('0x1a')][_0x114f('0x1c')]);return _0x4cf410(_0x4f6f91[_0x114f('0x1a')][_0x114f('0x1c')]);}logger[_0x114f('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x22dd83,_0x4f6f91[_0x114f('0x1a')]['message']);return _0x2fce4d(_0x4f6f91[_0x114f('0x1a')][_0x114f('0x1c')]);}else{logger[_0x114f('0x14')]('ChatMessage,\x20%s,\x20%s',_0x22dd83,_0x114f('0x18'));_0x2fce4d(_0x4f6f91[_0x114f('0x1d')][_0x114f('0x1c')]);}})[_0x114f('0x1e')](function(_0x562637){logger[_0x114f('0x1a')](_0x114f('0x15'),_0x22dd83,_0x562637);_0x4cf410(_0x562637);});});}exports['CreateChatMessage']=function(_0x5970be){var _0x140f42=this;return new Promise(function(_0x24e0d3,_0x50244f){return db[_0x114f('0x1f')][_0x114f('0x20')](_0x5970be[_0x114f('0x21')],{'raw':_0x5970be[_0x114f('0x22')]?_0x5970be['options']['raw']===undefined?!![]:![]:!![]})[_0x114f('0x13')](function(_0x4dae99){logger[_0x114f('0x14')](_0x114f('0x23'),_0x5970be);logger[_0x114f('0x16')]('CreateChatMessage',_0x5970be,JSON[_0x114f('0x19')](_0x4dae99));_0x24e0d3(_0x4dae99);})[_0x114f('0x1e')](function(_0x3b747d){logger[_0x114f('0x1a')](_0x114f('0x23'),_0x3b747d[_0x114f('0x1c')],_0x5970be);_0x50244f(_0x140f42[_0x114f('0x1a')](0x1f4,_0x3b747d[_0x114f('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e2edbc3..f681725 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 _0x4ce6=['./chatMessage.events','remove','update','emit','length','chatMessage:'];(function(_0x59aaaf,_0x54e550){var _0x53caa5=function(_0x29aa3a){while(--_0x29aa3a){_0x59aaaf['push'](_0x59aaaf['shift']());}};_0x53caa5(++_0x54e550);}(_0x4ce6,0x108));var _0x64ce=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0x4ce6[_0x59dccc];return _0xc97bcb;};'use strict';var ChatMessageEvents=require(_0x64ce('0x0'));var events=['save',_0x64ce('0x1'),_0x64ce('0x2')];function createListener(_0x3f9718,_0x11bca6){return function(_0x3f0983){_0x11bca6[_0x64ce('0x3')](_0x3f9718,_0x3f0983);};}function removeListener(_0x4a8899,_0x469aa){return function(){ChatMessageEvents['removeListener'](_0x4a8899,_0x469aa);};}exports['register']=function(_0x31bc0f){for(var _0x262751=0x0,_0x5b8f2d=events[_0x64ce('0x4')];_0x262751<_0x5b8f2d;_0x262751++){var _0x3c279f=events[_0x262751];var _0x134230=createListener(_0x64ce('0x5')+_0x3c279f,_0x31bc0f);ChatMessageEvents['on'](_0x3c279f,_0x134230);}}; \ No newline at end of file +var _0x37c5=['remove','update','emit','removeListener','chatMessage:','save'];(function(_0x4dc4a9,_0x30d8bd){var _0x4cde6c=function(_0x16d036){while(--_0x16d036){_0x4dc4a9['push'](_0x4dc4a9['shift']());}};_0x4cde6c(++_0x30d8bd);}(_0x37c5,0xa7));var _0x537c=function(_0x147136,_0x503ee8){_0x147136=_0x147136-0x0;var _0x36638e=_0x37c5[_0x147136];return _0x36638e;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x537c('0x0'),_0x537c('0x1'),_0x537c('0x2')];function createListener(_0x11f076,_0x1c5b5f){return function(_0x183b59){_0x1c5b5f[_0x537c('0x3')](_0x11f076,_0x183b59);};}function removeListener(_0x42bd15,_0x2c0854){return function(){ChatMessageEvents[_0x537c('0x4')](_0x42bd15,_0x2c0854);};}exports['register']=function(_0x42c86a){for(var _0x1156f4=0x0,_0x336920=events['length'];_0x1156f4<_0x336920;_0x1156f4++){var _0x36bf4a=events[_0x1156f4];var _0x67f986=createListener(_0x537c('0x5')+_0x36bf4a,_0x42c86a);ChatMessageEvents['on'](_0x36bf4a,_0x67f986);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b91f0fc..7b788f6 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 _0x3fe9=['get','isAuthenticated','/describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x112ea0,_0x594ce7){var _0x4ac4cb=function(_0x50b93d){while(--_0x50b93d){_0x112ea0['push'](_0x112ea0['shift']());}};_0x4ac4cb(++_0x594ce7);}(_0x3fe9,0x125));var _0x93fe=function(_0x2d7199,_0x41ec28){_0x2d7199=_0x2d7199-0x0;var _0x32545d=_0x3fe9[_0x2d7199];return _0x32545d;};'use strict';var multer=require('multer');var util=require(_0x93fe('0x0'));var path=require('path');var timeout=require(_0x93fe('0x1'));var express=require(_0x93fe('0x2'));var router=express[_0x93fe('0x3')]();var fs_extra=require(_0x93fe('0x4'));var auth=require(_0x93fe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x93fe('0x6')]('/',auth[_0x93fe('0x7')](),controller['index']);router[_0x93fe('0x6')](_0x93fe('0x8'),auth[_0x93fe('0x7')](),controller['describe']);router[_0x93fe('0x6')](_0x93fe('0x9'),auth['isAuthenticated'](),controller[_0x93fe('0xa')]);router[_0x93fe('0xb')]('/',auth[_0x93fe('0x7')](),interaction['tracked'](_0x93fe('0xc'),_0x93fe('0xd')),controller[_0x93fe('0xe')]);router[_0x93fe('0xf')](_0x93fe('0x9'),controller[_0x93fe('0x10')]);router['put'](_0x93fe('0x11'),auth[_0x93fe('0x7')](),controller[_0x93fe('0x12')]);router[_0x93fe('0xf')](_0x93fe('0x13'),auth['isAuthenticated'](),controller[_0x93fe('0x14')]);router[_0x93fe('0x15')](_0x93fe('0x9'),auth[_0x93fe('0x7')](),controller[_0x93fe('0x16')]);module['exports']=router; \ No newline at end of file +var _0x35ab=['accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','put','/:id/accept'];(function(_0x16ecad,_0x205047){var _0x313ff7=function(_0x58b16a){while(--_0x58b16a){_0x16ecad['push'](_0x16ecad['shift']());}};_0x313ff7(++_0x205047);}(_0x35ab,0x101));var _0xb35a=function(_0x56d49a,_0x419ef9){_0x56d49a=_0x56d49a-0x0;var _0x2fe15f=_0x35ab[_0x56d49a];return _0x2fe15f;};'use strict';var multer=require('multer');var util=require(_0xb35a('0x0'));var path=require(_0xb35a('0x1'));var timeout=require(_0xb35a('0x2'));var express=require(_0xb35a('0x3'));var router=express[_0xb35a('0x4')]();var fs_extra=require(_0xb35a('0x5'));var auth=require(_0xb35a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb35a('0x7'));var controller=require(_0xb35a('0x8'));router['get']('/',auth[_0xb35a('0x9')](),controller[_0xb35a('0xa')]);router[_0xb35a('0xb')](_0xb35a('0xc'),auth[_0xb35a('0x9')](),controller['describe']);router['get'](_0xb35a('0xd'),auth[_0xb35a('0x9')](),controller[_0xb35a('0xe')]);router[_0xb35a('0xf')]('/',auth[_0xb35a('0x9')](),interaction[_0xb35a('0x10')](_0xb35a('0x11'),_0xb35a('0x12')),controller[_0xb35a('0x13')]);router['put'](_0xb35a('0xd'),controller[_0xb35a('0x14')]);router[_0xb35a('0x15')](_0xb35a('0x16'),auth[_0xb35a('0x9')](),controller[_0xb35a('0x17')]);router[_0xb35a('0x15')](_0xb35a('0x18'),auth[_0xb35a('0x9')](),controller[_0xb35a('0x19')]);router[_0xb35a('0x1a')]('/:id',auth[_0xb35a('0x9')](),controller[_0xb35a('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c81994b..47fdf6a 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 _0x8062=['sequelize','exports','medium'];(function(_0x4f52e8,_0x3f38af){var _0x1e08e4=function(_0x1c58da){while(--_0x1c58da){_0x4f52e8['push'](_0x4f52e8['shift']());}};_0x1e08e4(++_0x3f38af);}(_0x8062,0x78));var _0x2806=function(_0x294c1c,_0x567301){_0x294c1c=_0x294c1c-0x0;var _0x1e7943=_0x8062[_0x294c1c];return _0x1e7943;};'use strict';var Sequelize=require(_0x2806('0x0'));module[_0x2806('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2806('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xc8c5=['sequelize','exports','TEXT','medium'];(function(_0x3358e5,_0x382eea){var _0x405068=function(_0x515a35){while(--_0x515a35){_0x3358e5['push'](_0x3358e5['shift']());}};_0x405068(++_0x382eea);}(_0xc8c5,0x120));var _0x5c8c=function(_0x3a44e4,_0x3ab711){_0x3a44e4=_0x3a44e4-0x0;var _0x2c94c1=_0xc8c5[_0x3a44e4];return _0x2c94c1;};'use strict';var Sequelize=require(_0x5c8c('0x0'));module[_0x5c8c('0x1')]={'body':{'type':Sequelize[_0x5c8c('0x2')](_0x5c8c('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index d12c3a3..9642397 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x7a54,0x106));var _0x47a5=function(_0x4adb3f,_0x31b940){_0x4adb3f=_0x4adb3f-0x0;var _0x129c05=_0x7a54[_0x4adb3f];return _0x129c05;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1dcd0e,_0x47e39d){var _0xf97eb9=function(_0x1b1b92){while(--_0x1b1b92){_0x1dcd0e['push'](_0x1dcd0e['shift']());}};_0xf97eb9(++_0x47e39d);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7fdab4d..0525f19 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 _0x9198=['rimraf','../../config/environment','./chatOfflineMessage.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x165f4e,_0x4c3442){var _0x587f57=function(_0x148961){while(--_0x148961){_0x165f4e['push'](_0x165f4e['shift']());}};_0x587f57(++_0x4c3442);}(_0x9198,0x1c2));var _0x8919=function(_0x1ec5d1,_0xb995d0){_0x1ec5d1=_0x1ec5d1-0x0;var _0x40c32c=_0x9198[_0x1ec5d1];return _0x40c32c;};'use strict';var _=require(_0x8919('0x0'));var util=require(_0x8919('0x1'));var logger=require('../../config/logger')(_0x8919('0x2'));var moment=require(_0x8919('0x3'));var BPromise=require(_0x8919('0x4'));var rp=require(_0x8919('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8919('0x6'));var config=require(_0x8919('0x7'));var attributes=require(_0x8919('0x8'));module['exports']=function(_0x14cefe,_0x787f43){return _0x14cefe[_0x8919('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8919('0xa'),'collate':_0x8919('0xb')});}; \ No newline at end of file +var _0xea55=['util','api','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash'];(function(_0x883c67,_0x36280e){var _0x5cabbb=function(_0x13a1cb){while(--_0x13a1cb){_0x883c67['push'](_0x883c67['shift']());}};_0x5cabbb(++_0x36280e);}(_0xea55,0x9b));var _0x5ea5=function(_0x29d2c4,_0x388d74){_0x29d2c4=_0x29d2c4-0x0;var _0x367d36=_0xea55[_0x29d2c4];return _0x367d36;};'use strict';var _=require(_0x5ea5('0x0'));var util=require(_0x5ea5('0x1'));var logger=require('../../config/logger')(_0x5ea5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ea5('0x3'));var rimraf=require(_0x5ea5('0x4'));var config=require(_0x5ea5('0x5'));var attributes=require(_0x5ea5('0x6'));module[_0x5ea5('0x7')]=function(_0x557ea6,_0x52edaf){return _0x557ea6[_0x5ea5('0x8')](_0x5ea5('0x9'),attributes,{'tableName':_0x5ea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5ea5('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0bcb4b7..4a78199 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 _0x53ec=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x552dec,_0x27a96d){var _0xcd5ca6=function(_0x455e1f){while(--_0x455e1f){_0x552dec['push'](_0x552dec['shift']());}};_0xcd5ca6(++_0x27a96d);}(_0x53ec,0x179));var _0xc53e=function(_0x1b735a,_0x2ccf39){_0x1b735a=_0x1b735a-0x0;var _0x27570e=_0x53ec[_0x1b735a];return _0x27570e;};'use strict';var _=require('lodash');var util=require(_0xc53e('0x0'));var moment=require('moment');var BPromise=require(_0xc53e('0x1'));var rs=require(_0xc53e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc53e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc53e('0x4'));var config=require(_0xc53e('0x5'));var jayson=require(_0xc53e('0x6'));var client=jayson['client'][_0xc53e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d0df8,_0x54bb87,_0x157bb5){return new BPromise(function(_0x5c0fd3,_0x19b4f7){return client[_0xc53e('0x8')](_0x2d0df8,_0x157bb5)[_0xc53e('0x9')](function(_0x4123e0){logger[_0xc53e('0xa')](_0xc53e('0xb'),_0x54bb87,_0xc53e('0xc'));logger[_0xc53e('0xd')](_0xc53e('0xe'),_0x54bb87,_0xc53e('0xc'),JSON[_0xc53e('0xf')](_0x4123e0));if(_0x4123e0[_0xc53e('0x10')]){if(_0x4123e0[_0xc53e('0x10')][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x10')](_0xc53e('0xb'),_0x54bb87,_0x4123e0[_0xc53e('0x10')][_0xc53e('0x12')]);return _0x19b4f7(_0x4123e0[_0xc53e('0x10')][_0xc53e('0x12')]);}logger['error'](_0xc53e('0xb'),_0x54bb87,_0x4123e0['error'][_0xc53e('0x12')]);return _0x5c0fd3(_0x4123e0['error'][_0xc53e('0x12')]);}else{logger[_0xc53e('0xa')](_0xc53e('0xb'),_0x54bb87,'request\x20sent');_0x5c0fd3(_0x4123e0[_0xc53e('0x13')]['message']);}})[_0xc53e('0x14')](function(_0x526cd9){logger[_0xc53e('0x10')](_0xc53e('0xb'),_0x54bb87,_0x526cd9);_0x19b4f7(_0x526cd9);});});} \ No newline at end of file +var _0x45a0=['result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x19de1d,_0x260b0d){var _0x4b7411=function(_0x3e38d3){while(--_0x3e38d3){_0x19de1d['push'](_0x19de1d['shift']());}};_0x4b7411(++_0x260b0d);}(_0x45a0,0x1e8));var _0x045a=function(_0xd31f7b,_0x4f1ede){_0xd31f7b=_0xd31f7b-0x0;var _0xfdf0f1=_0x45a0[_0xd31f7b];return _0xfdf0f1;};'use strict';var _=require(_0x045a('0x0'));var util=require(_0x045a('0x1'));var moment=require('moment');var BPromise=require(_0x045a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x045a('0x3'));var logger=require(_0x045a('0x4'))(_0x045a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x045a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2af007,_0x9bc14b,_0x31014f){return new BPromise(function(_0x35cad9,_0x104ba2){return client[_0x045a('0x7')](_0x2af007,_0x31014f)['then'](function(_0xb9ac24){logger[_0x045a('0x8')](_0x045a('0x9'),_0x9bc14b,_0x045a('0xa'));logger[_0x045a('0xb')](_0x045a('0xc'),_0x9bc14b,_0x045a('0xa'),JSON[_0x045a('0xd')](_0xb9ac24));if(_0xb9ac24[_0x045a('0xe')]){if(_0xb9ac24['error']['code']===0x1f4){logger[_0x045a('0xe')](_0x045a('0x9'),_0x9bc14b,_0xb9ac24[_0x045a('0xe')]['message']);return _0x104ba2(_0xb9ac24[_0x045a('0xe')][_0x045a('0xf')]);}logger['error'](_0x045a('0x9'),_0x9bc14b,_0xb9ac24[_0x045a('0xe')]['message']);return _0x35cad9(_0xb9ac24['error']['message']);}else{logger[_0x045a('0x8')]('ChatOfflineMessage,\x20%s,\x20%s',_0x9bc14b,_0x045a('0xa'));_0x35cad9(_0xb9ac24[_0x045a('0x10')][_0x045a('0xf')]);}})[_0x045a('0x11')](function(_0x52025c){logger['error'](_0x045a('0x9'),_0x9bc14b,_0x52025c);_0x104ba2(_0x52025c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d493c41..57633c9 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 _0x099b=['index','/describe','describe','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated'];(function(_0x593e5d,_0x64636f){var _0x5c05d5=function(_0x4d7585){while(--_0x4d7585){_0x593e5d['push'](_0x593e5d['shift']());}};_0x5c05d5(++_0x64636f);}(_0x099b,0x1c1));var _0xb099=function(_0x2e0942,_0x18734d){_0x2e0942=_0x2e0942-0x0;var _0x1e0891=_0x099b[_0x2e0942];return _0x1e0891;};'use strict';var multer=require(_0xb099('0x0'));var util=require(_0xb099('0x1'));var path=require(_0xb099('0x2'));var timeout=require(_0xb099('0x3'));var express=require('express');var router=express[_0xb099('0x4')]();var fs_extra=require(_0xb099('0x5'));var auth=require(_0xb099('0x6'));var interaction=require(_0xb099('0x7'));var config=require(_0xb099('0x8'));var controller=require(_0xb099('0x9'));router['get']('/',auth[_0xb099('0xa')](),controller[_0xb099('0xb')]);router['get'](_0xb099('0xc'),auth[_0xb099('0xa')](),controller[_0xb099('0xd')]);router[_0xb099('0xe')](_0xb099('0xf'),auth[_0xb099('0xa')](),controller[_0xb099('0x10')]);router[_0xb099('0x11')]('/',auth[_0xb099('0xa')](),controller[_0xb099('0x12')]);router[_0xb099('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb099('0x14')](_0xb099('0xf'),auth[_0xb099('0xa')](),controller[_0xb099('0x15')]);module[_0xb099('0x16')]=router; \ No newline at end of file +var _0xe340=['index','/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./chatOfflineMessage.controller','isAuthenticated'];(function(_0x1fae35,_0x385d6a){var _0x22f1a7=function(_0x181ef9){while(--_0x181ef9){_0x1fae35['push'](_0x1fae35['shift']());}};_0x22f1a7(++_0x385d6a);}(_0xe340,0xb5));var _0x0e34=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe340[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0e34('0x0'));var util=require('util');var path=require(_0x0e34('0x1'));var timeout=require(_0x0e34('0x2'));var express=require('express');var router=express[_0x0e34('0x3')]();var fs_extra=require(_0x0e34('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e34('0x5'));var controller=require(_0x0e34('0x6'));router['get']('/',auth[_0x0e34('0x7')](),controller[_0x0e34('0x8')]);router['get'](_0x0e34('0x9'),auth[_0x0e34('0x7')](),controller[_0x0e34('0xa')]);router[_0x0e34('0xb')](_0x0e34('0xc'),auth[_0x0e34('0x7')](),controller[_0x0e34('0xd')]);router[_0x0e34('0xe')]('/',auth[_0x0e34('0x7')](),controller[_0x0e34('0xf')]);router[_0x0e34('0x10')](_0x0e34('0xc'),auth['isAuthenticated'](),controller[_0x0e34('0x11')]);router[_0x0e34('0x12')](_0x0e34('0xc'),auth[_0x0e34('0x7')](),controller[_0x0e34('0x13')]);module[_0x0e34('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index bf5f51f..770d824 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 _0x66f8=['mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x20715c,_0x1b4536){var _0x1bea2f=function(_0x532fb4){while(--_0x532fb4){_0x20715c['push'](_0x20715c['shift']());}};_0x1bea2f(++_0x1b4536);}(_0x66f8,0xb7));var _0x866f=function(_0x2bb72b,_0x1ce8b5){_0x2bb72b=_0x2bb72b-0x0;var _0xa68d8f=_0x66f8[_0x2bb72b];return _0xa68d8f;};'use strict';var Sequelize=require(_0x866f('0x0'));module[_0x866f('0x1')]={'name':{'type':Sequelize[_0x866f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x866f('0x3'),_0x866f('0x4')),'defaultValue':_0x866f('0x3')},'selector':{'type':Sequelize[_0x866f('0x2')]},'timeout':{'type':Sequelize[_0x866f('0x5')]}}; \ No newline at end of file +var _0xff8e=['timeout','INTEGER','exports','STRING','ENUM','mouseOver'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff8e,0x170));var _0xeff8=function(_0x4b8d30,_0x3a0870){_0x4b8d30=_0x4b8d30-0x0;var _0xd1a650=_0xff8e[_0x4b8d30];return _0xd1a650;};'use strict';var Sequelize=require('sequelize');module[_0xeff8('0x0')]={'name':{'type':Sequelize[_0xeff8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeff8('0x2')](_0xeff8('0x3'),_0xeff8('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xeff8('0x1')]},'timeout':{'type':Sequelize[_0xeff8('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index cb92d96..34441e4 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 _0x3dd6=['status','end','json','offset','undefined','count','limit','set','apply','save','update','then','stack','name','send','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','create','body','params','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x3dd6,0xcf));var _0x63dd=function(_0x4605a6,_0x4ee25f){_0x4605a6=_0x4605a6-0x0;var _0x18bc7a=_0x3dd6[_0x4605a6];return _0x18bc7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x63dd('0x0'));var rp=require(_0x63dd('0x1'));var moment=require(_0x63dd('0x2'));var BPromise=require(_0x63dd('0x3'));var Mustache=require(_0x63dd('0x4'));var util=require(_0x63dd('0x5'));var path=require('path');var sox=require(_0x63dd('0x6'));var csv=require('to-csv');var ejs=require(_0x63dd('0x7'));var fs=require('fs');var fs_extra=require(_0x63dd('0x8'));var _=require(_0x63dd('0x9'));var squel=require(_0x63dd('0xa'));var crypto=require(_0x63dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x63dd('0xc'));var toCsv=require(_0x63dd('0xd'));var querystring=require(_0x63dd('0xe'));var Papa=require(_0x63dd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x63dd('0x10'));var as=require(_0x63dd('0x11'));var hardwareService=require(_0x63dd('0x12'));var logger=require(_0x63dd('0x13'))(_0x63dd('0x14'));var utils=require('../../config/utils');var config=require(_0x63dd('0x15'));var licenseUtil=require(_0x63dd('0x16'));var db=require(_0x63dd('0x17'))['db'];function respondWithStatusCode(_0x35ba9e,_0x5a75b1){_0x5a75b1=_0x5a75b1||0xcc;return function(_0x4a842d){if(_0x4a842d){return _0x35ba9e[_0x63dd('0x18')](_0x5a75b1);}return _0x35ba9e[_0x63dd('0x19')](_0x5a75b1)[_0x63dd('0x1a')]();};}function respondWithResult(_0x313f45,_0x3a0981){_0x3a0981=_0x3a0981||0xc8;return function(_0x56c030){if(_0x56c030){return _0x313f45['status'](_0x3a0981)[_0x63dd('0x1b')](_0x56c030);}};}function respondWithFilteredResult(_0xa6ffcf,_0x2bb9f6){return function(_0x4d6623){if(_0x4d6623){var _0x4144eb=typeof _0x2bb9f6[_0x63dd('0x1c')]===_0x63dd('0x1d')&&typeof _0x2bb9f6['limit']===_0x63dd('0x1d');var _0x368f85=_0x4d6623[_0x63dd('0x1e')];var _0xaf3376=_0x4144eb?0x0:_0x2bb9f6[_0x63dd('0x1c')];var _0x19f8db=_0x4144eb?_0x4d6623[_0x63dd('0x1e')]:_0x2bb9f6[_0x63dd('0x1c')]+_0x2bb9f6[_0x63dd('0x1f')];var _0x8f2691;if(_0x19f8db>=_0x368f85){_0x19f8db=_0x368f85;_0x8f2691=0xc8;}else{_0x8f2691=0xce;}_0xa6ffcf[_0x63dd('0x19')](_0x8f2691);return _0xa6ffcf[_0x63dd('0x20')]('Content-Range',_0xaf3376+'-'+_0x19f8db+'/'+_0x368f85)[_0x63dd('0x1b')](_0x4d6623);}return null;};}function patchUpdates(_0x596046){return function(_0x466dac){try{jsonpatch[_0x63dd('0x21')](_0x466dac,_0x596046,!![]);}catch(_0x22ad3d){return BPromise['reject'](_0x22ad3d);}return _0x466dac[_0x63dd('0x22')]();};}function saveUpdates(_0x38bd01,_0x4a1622){return function(_0x887c58){if(_0x887c58){return _0x887c58[_0x63dd('0x23')](_0x38bd01)[_0x63dd('0x24')](function(_0xf8bc2){return _0xf8bc2;});}return null;};}function removeEntity(_0x3fd7ec,_0x379338){return function(_0x4b2451){if(_0x4b2451){return _0x4b2451['destroy']()['then'](function(){_0x3fd7ec[_0x63dd('0x19')](0xcc)[_0x63dd('0x1a')]();});}};}function handleEntityNotFound(_0x540a9f,_0x34d5d5){return function(_0x222e13){if(!_0x222e13){_0x540a9f['sendStatus'](0x194);}return _0x222e13;};}function handleError(_0x1a0fc4,_0x605388){_0x605388=_0x605388||0x1f4;return function(_0x59f685){logger['error'](_0x59f685[_0x63dd('0x25')]);if(_0x59f685[_0x63dd('0x26')]){delete _0x59f685[_0x63dd('0x26')];}_0x1a0fc4[_0x63dd('0x19')](_0x605388)[_0x63dd('0x27')](_0x59f685);};}exports['show']=function(_0x7ca662,_0x49dac2){var _0x1ecbff={'raw':!![],'where':{'id':_0x7ca662['params']['id']}},_0x4e2ca7={};_0x4e2ca7[_0x63dd('0x28')]=_[_0x63dd('0x29')](db[_0x63dd('0x2a')][_0x63dd('0x2b')]);_0x4e2ca7[_0x63dd('0x2c')]=_[_0x63dd('0x29')](_0x7ca662['query']);_0x4e2ca7[_0x63dd('0x2d')]=_[_0x63dd('0x2e')](_0x4e2ca7[_0x63dd('0x28')],_0x4e2ca7[_0x63dd('0x2c')]);_0x1ecbff['attributes']=_[_0x63dd('0x2e')](_0x4e2ca7[_0x63dd('0x28')],qs[_0x63dd('0x2f')](_0x7ca662['query'][_0x63dd('0x2f')]));_0x1ecbff[_0x63dd('0x30')]=_0x1ecbff[_0x63dd('0x30')][_0x63dd('0x31')]?_0x1ecbff['attributes']:_0x4e2ca7['model'];if(_0x7ca662[_0x63dd('0x2c')]['includeAll']){_0x1ecbff[_0x63dd('0x32')]=[{'all':!![]}];}_0x1ecbff=_[_0x63dd('0x33')]({},_0x1ecbff,_0x7ca662[_0x63dd('0x34')]);return db['ChatProactiveAction'][_0x63dd('0x35')](_0x1ecbff)[_0x63dd('0x24')](handleEntityNotFound(_0x49dac2,null))[_0x63dd('0x24')](respondWithResult(_0x49dac2,null))['catch'](handleError(_0x49dac2,null));};exports[_0x63dd('0x36')]=function(_0x3fb169,_0x266e82){return db[_0x63dd('0x2a')][_0x63dd('0x36')](_0x3fb169[_0x63dd('0x37')],{})['then'](respondWithResult(_0x266e82,0xc9))['catch'](handleError(_0x266e82,null));};exports[_0x63dd('0x23')]=function(_0x4c8d7f,_0x1ee993){if(_0x4c8d7f['body']['id']){delete _0x4c8d7f['body']['id'];}return db['ChatProactiveAction'][_0x63dd('0x35')]({'where':{'id':_0x4c8d7f[_0x63dd('0x38')]['id']}})[_0x63dd('0x24')](handleEntityNotFound(_0x1ee993,null))[_0x63dd('0x24')](saveUpdates(_0x4c8d7f[_0x63dd('0x37')],null))[_0x63dd('0x24')](respondWithResult(_0x1ee993,null))['catch'](handleError(_0x1ee993,null));};exports[_0x63dd('0x39')]=function(_0x506985,_0x1faecc){return db[_0x63dd('0x2a')][_0x63dd('0x35')]({'where':{'id':_0x506985[_0x63dd('0x38')]['id']}})[_0x63dd('0x24')](handleEntityNotFound(_0x1faecc,null))['then'](removeEntity(_0x1faecc,null))['catch'](handleError(_0x1faecc,null));}; \ No newline at end of file +var _0x41d9=['find','create','body','catch','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','destroy','then','sendStatus','error','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','attributes','fields','length','includeAll','include','merge','options'];(function(_0x43f5f3,_0x3c0f41){var _0x53dc4c=function(_0x2031e0){while(--_0x2031e0){_0x43f5f3['push'](_0x43f5f3['shift']());}};_0x53dc4c(++_0x3c0f41);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x941d('0x0'));var rimraf=require(_0x941d('0x1'));var zipdir=require(_0x941d('0x2'));var jsonpatch=require(_0x941d('0x3'));var rp=require(_0x941d('0x4'));var moment=require(_0x941d('0x5'));var BPromise=require(_0x941d('0x6'));var Mustache=require('mustache');var util=require(_0x941d('0x7'));var path=require(_0x941d('0x8'));var sox=require('sox');var csv=require(_0x941d('0x9'));var ejs=require(_0x941d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x941d('0xb'));var squel=require('squel');var crypto=require(_0x941d('0xc'));var jsforce=require(_0x941d('0xd'));var deskjs=require(_0x941d('0xe'));var toCsv=require(_0x941d('0x9'));var querystring=require(_0x941d('0xf'));var Papa=require('papaparse');var Redis=require(_0x941d('0x10'));var authService=require(_0x941d('0x11'));var qs=require(_0x941d('0x12'));var as=require(_0x941d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x941d('0x14'))(_0x941d('0x15'));var utils=require(_0x941d('0x16'));var config=require(_0x941d('0x17'));var licenseUtil=require(_0x941d('0x18'));var db=require(_0x941d('0x19'))['db'];function respondWithStatusCode(_0x4d93c4,_0x192331){_0x192331=_0x192331||0xcc;return function(_0x55c5aa){if(_0x55c5aa){return _0x4d93c4['sendStatus'](_0x192331);}return _0x4d93c4[_0x941d('0x1a')](_0x192331)[_0x941d('0x1b')]();};}function respondWithResult(_0xbd3711,_0x2aa972){_0x2aa972=_0x2aa972||0xc8;return function(_0x20a6ab){if(_0x20a6ab){return _0xbd3711[_0x941d('0x1a')](_0x2aa972)[_0x941d('0x1c')](_0x20a6ab);}};}function respondWithFilteredResult(_0x45d85d,_0x369b0b){return function(_0x1f1aeb){if(_0x1f1aeb){var _0x7df80e=typeof _0x369b0b['offset']===_0x941d('0x1d')&&typeof _0x369b0b[_0x941d('0x1e')]===_0x941d('0x1d');var _0x2e5c4f=_0x1f1aeb[_0x941d('0x1f')];var _0x3ac25f=_0x7df80e?0x0:_0x369b0b[_0x941d('0x20')];var _0x2c6ce5=_0x7df80e?_0x1f1aeb[_0x941d('0x1f')]:_0x369b0b['offset']+_0x369b0b[_0x941d('0x1e')];var _0x57f5e6;if(_0x2c6ce5>=_0x2e5c4f){_0x2c6ce5=_0x2e5c4f;_0x57f5e6=0xc8;}else{_0x57f5e6=0xce;}_0x45d85d[_0x941d('0x1a')](_0x57f5e6);return _0x45d85d[_0x941d('0x21')]('Content-Range',_0x3ac25f+'-'+_0x2c6ce5+'/'+_0x2e5c4f)[_0x941d('0x1c')](_0x1f1aeb);}return null;};}function patchUpdates(_0x5ac2e6){return function(_0x526708){try{jsonpatch[_0x941d('0x22')](_0x526708,_0x5ac2e6,!![]);}catch(_0xf6636){return BPromise[_0x941d('0x23')](_0xf6636);}return _0x526708['save']();};}function saveUpdates(_0x1309af,_0x3baf0b){return function(_0xc19c76){if(_0xc19c76){return _0xc19c76['update'](_0x1309af)['then'](function(_0x520bb2){return _0x520bb2;});}return null;};}function removeEntity(_0x306557,_0x26b7b6){return function(_0xd72c49){if(_0xd72c49){return _0xd72c49[_0x941d('0x24')]()[_0x941d('0x25')](function(){_0x306557['status'](0xcc)[_0x941d('0x1b')]();});}};}function handleEntityNotFound(_0x43a443,_0x11c2c9){return function(_0x48baff){if(!_0x48baff){_0x43a443[_0x941d('0x26')](0x194);}return _0x48baff;};}function handleError(_0x1ce2fe,_0x3190d4){_0x3190d4=_0x3190d4||0x1f4;return function(_0x3a72d7){logger[_0x941d('0x27')](_0x3a72d7[_0x941d('0x28')]);if(_0x3a72d7[_0x941d('0x29')]){delete _0x3a72d7[_0x941d('0x29')];}_0x1ce2fe[_0x941d('0x1a')](_0x3190d4)[_0x941d('0x2a')](_0x3a72d7);};}exports[_0x941d('0x2b')]=function(_0x1cacc4,_0x4cf929){var _0x30615a={'raw':!![],'where':{'id':_0x1cacc4['params']['id']}},_0x42050d={};_0x42050d[_0x941d('0x2c')]=_[_0x941d('0x2d')](db[_0x941d('0x2e')][_0x941d('0x2f')]);_0x42050d[_0x941d('0x30')]=_[_0x941d('0x2d')](_0x1cacc4[_0x941d('0x30')]);_0x42050d['filters']=_['intersection'](_0x42050d[_0x941d('0x2c')],_0x42050d[_0x941d('0x30')]);_0x30615a[_0x941d('0x31')]=_['intersection'](_0x42050d['model'],qs[_0x941d('0x32')](_0x1cacc4[_0x941d('0x30')][_0x941d('0x32')]));_0x30615a['attributes']=_0x30615a[_0x941d('0x31')][_0x941d('0x33')]?_0x30615a[_0x941d('0x31')]:_0x42050d[_0x941d('0x2c')];if(_0x1cacc4['query'][_0x941d('0x34')]){_0x30615a[_0x941d('0x35')]=[{'all':!![]}];}_0x30615a=_[_0x941d('0x36')]({},_0x30615a,_0x1cacc4[_0x941d('0x37')]);return db[_0x941d('0x2e')][_0x941d('0x38')](_0x30615a)['then'](handleEntityNotFound(_0x4cf929,null))['then'](respondWithResult(_0x4cf929,null))['catch'](handleError(_0x4cf929,null));};exports[_0x941d('0x39')]=function(_0x558846,_0x204259){return db[_0x941d('0x2e')][_0x941d('0x39')](_0x558846[_0x941d('0x3a')],{})[_0x941d('0x25')](respondWithResult(_0x204259,0xc9))[_0x941d('0x3b')](handleError(_0x204259,null));};exports[_0x941d('0x3c')]=function(_0x32d072,_0x202c89){if(_0x32d072[_0x941d('0x3a')]['id']){delete _0x32d072['body']['id'];}return db[_0x941d('0x2e')][_0x941d('0x38')]({'where':{'id':_0x32d072[_0x941d('0x3d')]['id']}})[_0x941d('0x25')](handleEntityNotFound(_0x202c89,null))[_0x941d('0x25')](saveUpdates(_0x32d072[_0x941d('0x3a')],null))[_0x941d('0x25')](respondWithResult(_0x202c89,null))[_0x941d('0x3b')](handleError(_0x202c89,null));};exports[_0x941d('0x24')]=function(_0xcdd784,_0x37b04c){return db[_0x941d('0x2e')][_0x941d('0x38')]({'where':{'id':_0xcdd784['params']['id']}})['then'](handleEntityNotFound(_0x37b04c,null))[_0x941d('0x25')](removeEntity(_0x37b04c,null))[_0x941d('0x3b')](handleError(_0x37b04c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 930d3b8..b2ee2b8 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 _0x4ba1=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33dced,_0x195a6c){var _0x42060a=function(_0x4eb20d){while(--_0x4eb20d){_0x33dced['push'](_0x33dced['shift']());}};_0x42060a(++_0x195a6c);}(_0x4ba1,0x1f2));var _0x14ba=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4ba1[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0x14ba('0x0'));var logger=require(_0x14ba('0x1'))(_0x14ba('0x2'));var moment=require(_0x14ba('0x3'));var BPromise=require(_0x14ba('0x4'));var rp=require(_0x14ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x14ba('0x6'));var attributes=require(_0x14ba('0x7'));module[_0x14ba('0x8')]=function(_0x4b4692,_0x135e3f){return _0x4b4692[_0x14ba('0x9')](_0x14ba('0xa'),attributes,{'tableName':_0x14ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a63=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xe8f1f9,_0x212021){var _0x16995e=function(_0x11cd04){while(--_0x11cd04){_0xe8f1f9['push'](_0xe8f1f9['shift']());}};_0x16995e(++_0x212021);}(_0x2a63,0x87));var _0x32a6=function(_0x14915a,_0x222f6b){_0x14915a=_0x14915a-0x0;var _0x2f683c=_0x2a63[_0x14915a];return _0x2f683c;};'use strict';var _=require(_0x32a6('0x0'));var util=require(_0x32a6('0x1'));var logger=require(_0x32a6('0x2'))(_0x32a6('0x3'));var moment=require(_0x32a6('0x4'));var BPromise=require(_0x32a6('0x5'));var rp=require(_0x32a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32a6('0x7'));var attributes=require(_0x32a6('0x8'));module[_0x32a6('0x9')]=function(_0x5a1e3b,_0x103b18){return _0x5a1e3b[_0x32a6('0xa')](_0x32a6('0xb'),attributes,{'tableName':_0x32a6('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 f2f6d5c..c32ef84 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 _0xafdb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f9361,_0x36dada){var _0x3b2b2a=function(_0x3666ff){while(--_0x3666ff){_0x4f9361['push'](_0x4f9361['shift']());}};_0x3b2b2a(++_0x36dada);}(_0xafdb,0x77));var _0xbafd=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0xafdb[_0x48b5e0];return _0x4287ea;};'use strict';var _=require(_0xbafd('0x0'));var util=require(_0xbafd('0x1'));var moment=require('moment');var BPromise=require(_0xbafd('0x2'));var rs=require(_0xbafd('0x3'));var fs=require('fs');var Redis=require(_0xbafd('0x4'));var db=require(_0xbafd('0x5'))['db'];var utils=require(_0xbafd('0x6'));var logger=require(_0xbafd('0x7'))(_0xbafd('0x8'));var config=require(_0xbafd('0x9'));var jayson=require(_0xbafd('0xa'));var client=jayson[_0xbafd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaf75fa,_0xfcf9ea,_0x157fac){return new BPromise(function(_0x593a3a,_0x4c37cf){return client['request'](_0xaf75fa,_0x157fac)[_0xbafd('0xc')](function(_0x147160){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0xfcf9ea,_0xbafd('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0xfcf9ea,_0xbafd('0xd'),JSON[_0xbafd('0xe')](_0x147160));if(_0x147160[_0xbafd('0xf')]){if(_0x147160[_0xbafd('0xf')][_0xbafd('0x10')]===0x1f4){logger[_0xbafd('0xf')](_0xbafd('0x11'),_0xfcf9ea,_0x147160[_0xbafd('0xf')][_0xbafd('0x12')]);return _0x4c37cf(_0x147160[_0xbafd('0xf')][_0xbafd('0x12')]);}logger[_0xbafd('0xf')](_0xbafd('0x11'),_0xfcf9ea,_0x147160[_0xbafd('0xf')][_0xbafd('0x12')]);return _0x593a3a(_0x147160[_0xbafd('0xf')][_0xbafd('0x12')]);}else{logger[_0xbafd('0x13')](_0xbafd('0x11'),_0xfcf9ea,_0xbafd('0xd'));_0x593a3a(_0x147160[_0xbafd('0x14')]['message']);}})['catch'](function(_0x2d7497){logger[_0xbafd('0xf')](_0xbafd('0x11'),_0xfcf9ea,_0x2d7497);_0x4c37cf(_0x2d7497);});});} \ No newline at end of file +var _0x26a1=['code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x31c32e,_0x4c2442){var _0x3d39b1=function(_0x5e3c03){while(--_0x5e3c03){_0x31c32e['push'](_0x31c32e['shift']());}};_0x3d39b1(++_0x4c2442);}(_0x26a1,0x115));var _0x126a=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x26a1[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x126a('0x0'));var BPromise=require('bluebird');var rs=require(_0x126a('0x1'));var fs=require('fs');var Redis=require(_0x126a('0x2'));var db=require(_0x126a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x126a('0x4'))(_0x126a('0x5'));var config=require(_0x126a('0x6'));var jayson=require(_0x126a('0x7'));var client=jayson['client'][_0x126a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2de2d9,_0x552442,_0x5d0659){return new BPromise(function(_0x176594,_0x1b45d2){return client[_0x126a('0x9')](_0x2de2d9,_0x5d0659)[_0x126a('0xa')](function(_0x4925be){logger[_0x126a('0xb')](_0x126a('0xc'),_0x552442,_0x126a('0xd'));logger['debug'](_0x126a('0xe'),_0x552442,_0x126a('0xd'),JSON[_0x126a('0xf')](_0x4925be));if(_0x4925be[_0x126a('0x10')]){if(_0x4925be['error'][_0x126a('0x11')]===0x1f4){logger[_0x126a('0x10')](_0x126a('0xc'),_0x552442,_0x4925be[_0x126a('0x10')]['message']);return _0x1b45d2(_0x4925be[_0x126a('0x10')][_0x126a('0x12')]);}logger[_0x126a('0x10')](_0x126a('0xc'),_0x552442,_0x4925be['error']['message']);return _0x176594(_0x4925be[_0x126a('0x10')][_0x126a('0x12')]);}else{logger['info'](_0x126a('0xc'),_0x552442,'request\x20sent');_0x176594(_0x4925be[_0x126a('0x13')][_0x126a('0x12')]);}})[_0x126a('0x14')](function(_0x3c06f3){logger['error'](_0x126a('0xc'),_0x552442,_0x3c06f3);_0x1b45d2(_0x3c06f3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f9277d1..c6eae9e 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 _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x222540,_0x4b6cc7){var _0x2cad4d=function(_0x525265){while(--_0x525265){_0x222540['push'](_0x222540['shift']());}};_0x2cad4d(++_0x4b6cc7);}(_0x6aa7,0x178));var _0x76aa=function(_0x9d5038,_0xe87931){_0x9d5038=_0x9d5038-0x0;var _0x43d0fb=_0x6aa7[_0x9d5038];return _0x43d0fb;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x54eb07,_0x335479){var _0x2b1bbb=function(_0x726a1e){while(--_0x726a1e){_0x54eb07['push'](_0x54eb07['shift']());}};_0x2b1bbb(++_0x335479);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4c56ad,_0x58b96f){_0x4c56ad=_0x4c56ad-0x0;var _0x216c05=_0xd8fb[_0x4c56ad];return _0x216c05;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 6206091..8a6d35b 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 _0x17ba=['roundrobin','sequelize','STRING','ENUM','rrmemory'];(function(_0xaf4af7,_0x6a8b6f){var _0x596009=function(_0x563e6f){while(--_0x563e6f){_0xaf4af7['push'](_0xaf4af7['shift']());}};_0x596009(++_0x6a8b6f);}(_0x17ba,0xb0));var _0xa17b=function(_0x45a506,_0x28c126){_0x45a506=_0x45a506-0x0;var _0xe7adc3=_0x17ba[_0x45a506];return _0xe7adc3;};'use strict';var Sequelize=require(_0xa17b('0x0'));module['exports']={'name':{'type':Sequelize[_0xa17b('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa17b('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa17b('0x2')](_0xa17b('0x3'),'beepall',_0xa17b('0x4'))}}; \ No newline at end of file +var _0x2628=['exports','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x5afa3a,_0x886fc7){var _0x43b612=function(_0xac89ec){while(--_0xac89ec){_0x5afa3a['push'](_0x5afa3a['shift']());}};_0x43b612(++_0x886fc7);}(_0x2628,0x15c));var _0x8262=function(_0x2693e7,_0x5c450b){_0x2693e7=_0x2693e7-0x0;var _0x1944c9=_0x2628[_0x2693e7];return _0x1944c9;};'use strict';var Sequelize=require('sequelize');module[_0x8262('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8262('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8262('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8262('0x3')](_0x8262('0x4'),'beepall',_0x8262('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d7ea397..ab701ce 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 _0xb505=['limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','ChatQueue','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','map','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','rawAttributes','find','create','body','user','ChatQueues','userProfileId','params','describe','getMembers','hasOwnProperty','nolimit','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','findOne','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','ids','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','compact','value','removeTeams','userChatQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueue,\x20%s,\x20%s','info','result','sendStatus','status','end','json','offset'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0xb505,0x66));var _0x5b50=function(_0x146b42,_0x282dac){_0x146b42=_0x146b42-0x0;var _0x548e50=_0xb505[_0x146b42];return _0x548e50;};'use strict';var emlformat=require(_0x5b50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b50('0x1'));var jsonpatch=require(_0x5b50('0x2'));var rp=require(_0x5b50('0x3'));var moment=require(_0x5b50('0x4'));var BPromise=require(_0x5b50('0x5'));var Mustache=require('mustache');var util=require(_0x5b50('0x6'));var path=require(_0x5b50('0x7'));var sox=require(_0x5b50('0x8'));var csv=require(_0x5b50('0x9'));var ejs=require(_0x5b50('0xa'));var fs=require('fs');var fs_extra=require(_0x5b50('0xb'));var _=require('lodash');var squel=require(_0x5b50('0xc'));var crypto=require(_0x5b50('0xd'));var jsforce=require(_0x5b50('0xe'));var deskjs=require(_0x5b50('0xf'));var toCsv=require(_0x5b50('0x9'));var querystring=require(_0x5b50('0x10'));var Papa=require(_0x5b50('0x11'));var Redis=require(_0x5b50('0x12'));var authService=require(_0x5b50('0x13'));var qs=require(_0x5b50('0x14'));var as=require(_0x5b50('0x15'));var hardwareService=require(_0x5b50('0x16'));var logger=require(_0x5b50('0x17'))('api');var utils=require(_0x5b50('0x18'));var config=require(_0x5b50('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5b50('0x1a')]=_[_0x5b50('0x1b')](config[_0x5b50('0x1a')],{'host':_0x5b50('0x1c'),'port':0x18eb});var socket=require(_0x5b50('0x1d'))(new Redis(config[_0x5b50('0x1a')]));require('./chatQueue.socket')[_0x5b50('0x1e')](socket);var jayson=require(_0x5b50('0x1f'));var client=jayson[_0x5b50('0x20')][_0x5b50('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x6d6599,_0x117661,_0x2102f5,_0x11a289){return new BPromise(function(_0x2f9722,_0x27c1d1){var _0xc8af7a=_0x11a289||client;return _0xc8af7a['request'](_0x6d6599,_0x2102f5)['then'](function(_0x32e5d1){logger['info']('ChatQueue,\x20%s,\x20%s',_0x117661,_0x5b50('0x22'));logger['debug'](_0x5b50('0x23'),_0x117661,_0x5b50('0x22'),JSON['stringify'](_0x32e5d1));if(_0x32e5d1[_0x5b50('0x24')]){if(_0x32e5d1[_0x5b50('0x24')][_0x5b50('0x25')]===0x1f4){logger[_0x5b50('0x24')]('ChatQueue,\x20%s,\x20%s',_0x117661,_0x32e5d1['error'][_0x5b50('0x26')]);return _0x27c1d1(_0x32e5d1[_0x5b50('0x24')][_0x5b50('0x26')]);}logger[_0x5b50('0x24')](_0x5b50('0x27'),_0x117661,_0x32e5d1[_0x5b50('0x24')][_0x5b50('0x26')]);return _0x2f9722(_0x32e5d1[_0x5b50('0x24')][_0x5b50('0x26')]);}else{logger[_0x5b50('0x28')](_0x5b50('0x27'),_0x117661,'request\x20sent');_0x2f9722(_0x32e5d1[_0x5b50('0x29')]['message']);}})['catch'](function(_0x2b98e1){logger[_0x5b50('0x24')]('ChatQueue,\x20%s,\x20%s',_0x117661,_0x2b98e1);_0x27c1d1(_0x2b98e1);});});}function respondWithStatusCode(_0x10200d,_0x39e87c){_0x39e87c=_0x39e87c||0xcc;return function(_0x533ce5){if(_0x533ce5){return _0x10200d[_0x5b50('0x2a')](_0x39e87c);}return _0x10200d[_0x5b50('0x2b')](_0x39e87c)[_0x5b50('0x2c')]();};}function respondWithResult(_0x8da761,_0x467316){_0x467316=_0x467316||0xc8;return function(_0x271f86){if(_0x271f86){return _0x8da761['status'](_0x467316)[_0x5b50('0x2d')](_0x271f86);}};}function respondWithFilteredResult(_0x265ca6,_0x8d82ad){return function(_0x29f01f){if(_0x29f01f){var _0x31f4fa=typeof _0x8d82ad[_0x5b50('0x2e')]==='undefined'&&typeof _0x8d82ad[_0x5b50('0x2f')]===_0x5b50('0x30');var _0x1c1804=_0x29f01f['count'];var _0x337363=_0x31f4fa?0x0:_0x8d82ad['offset'];var _0x580f6a=_0x31f4fa?_0x29f01f[_0x5b50('0x31')]:_0x8d82ad[_0x5b50('0x2e')]+_0x8d82ad[_0x5b50('0x2f')];var _0x3a2c58;if(_0x580f6a>=_0x1c1804){_0x580f6a=_0x1c1804;_0x3a2c58=0xc8;}else{_0x3a2c58=0xce;}_0x265ca6['status'](_0x3a2c58);return _0x265ca6[_0x5b50('0x32')](_0x5b50('0x33'),_0x337363+'-'+_0x580f6a+'/'+_0x1c1804)[_0x5b50('0x2d')](_0x29f01f);}return null;};}function patchUpdates(_0x4a745c){return function(_0x5082da){try{jsonpatch[_0x5b50('0x34')](_0x5082da,_0x4a745c,!![]);}catch(_0x35fa78){return BPromise[_0x5b50('0x35')](_0x35fa78);}return _0x5082da[_0x5b50('0x36')]();};}function saveUpdates(_0x459a28,_0x38dffe){return function(_0x2c8e1d){if(_0x2c8e1d){return _0x2c8e1d[_0x5b50('0x37')](_0x459a28)[_0x5b50('0x38')](function(_0x7572d8){return _0x7572d8;});}return null;};}function removeEntity(_0x2302d6,_0x2fe534){return function(_0x399943){if(_0x399943){return _0x399943[_0x5b50('0x39')]()[_0x5b50('0x38')](function(){var _0x2bb372=_0x399943[_0x5b50('0x3a')]({'plain':!![]});var _0x39ee93='ChatQueues';return db[_0x5b50('0x3b')][_0x5b50('0x39')]({'where':{'type':_0x39ee93,'resourceId':_0x2bb372['id']}})[_0x5b50('0x38')](function(){return _0x399943;});})[_0x5b50('0x38')](function(){_0x2302d6['status'](0xcc)[_0x5b50('0x2c')]();});}};}function handleEntityNotFound(_0x510987,_0x4b882a){return function(_0x353e20){if(!_0x353e20){_0x510987[_0x5b50('0x2a')](0x194);}return _0x353e20;};}function handleError(_0x11e518,_0x4f6375){_0x4f6375=_0x4f6375||0x1f4;return function(_0x365293){logger['error'](_0x365293['stack']);if(_0x365293[_0x5b50('0x3c')]){delete _0x365293['name'];}_0x11e518[_0x5b50('0x2b')](_0x4f6375)[_0x5b50('0x3d')](_0x365293);};}exports[_0x5b50('0x3e')]=function(_0x4f8787,_0x421ea0){var _0x3b9592={},_0x48c3f6={},_0x44134c={'count':0x0,'rows':[]};var _0x1a3e59=_['map'](db[_0x5b50('0x3f')]['rawAttributes'],function(_0xa1e975){return{'name':_0xa1e975['fieldName'],'type':_0xa1e975['type'][_0x5b50('0x40')]};});_0x48c3f6[_0x5b50('0x41')]=_['map'](_0x1a3e59,'name');_0x48c3f6[_0x5b50('0x42')]=_[_0x5b50('0x43')](_0x4f8787['query']);_0x48c3f6[_0x5b50('0x44')]=_[_0x5b50('0x45')](_0x48c3f6['model'],_0x48c3f6[_0x5b50('0x42')]);_0x3b9592[_0x5b50('0x46')]=_[_0x5b50('0x45')](_0x48c3f6[_0x5b50('0x41')],qs[_0x5b50('0x47')](_0x4f8787['query'][_0x5b50('0x47')]));_0x3b9592['attributes']=_0x3b9592[_0x5b50('0x46')][_0x5b50('0x48')]?_0x3b9592[_0x5b50('0x46')]:_0x48c3f6['model'];if(!_0x4f8787[_0x5b50('0x42')]['hasOwnProperty']('nolimit')){_0x3b9592['limit']=qs[_0x5b50('0x2f')](_0x4f8787[_0x5b50('0x42')][_0x5b50('0x2f')]);_0x3b9592[_0x5b50('0x2e')]=qs[_0x5b50('0x2e')](_0x4f8787[_0x5b50('0x42')][_0x5b50('0x2e')]);}_0x3b9592[_0x5b50('0x49')]=qs[_0x5b50('0x4a')](_0x4f8787[_0x5b50('0x42')][_0x5b50('0x4a')]);_0x3b9592['where']=qs[_0x5b50('0x44')](_[_0x5b50('0x4b')](_0x4f8787[_0x5b50('0x42')],_0x48c3f6[_0x5b50('0x44')]),_0x1a3e59);if(_0x4f8787['query'][_0x5b50('0x4c')]){_0x3b9592[_0x5b50('0x4d')]=_['merge'](_0x3b9592[_0x5b50('0x4d')],{'$or':_[_0x5b50('0x4e')](_0x1a3e59,function(_0x194ba8){if(_0x194ba8[_0x5b50('0x4f')]!==_0x5b50('0x50')){var _0x4baecb={};_0x4baecb[_0x194ba8[_0x5b50('0x3c')]]={'$like':'%'+_0x4f8787[_0x5b50('0x42')]['filter']+'%'};return _0x4baecb;}})});}_0x3b9592=_[_0x5b50('0x51')]({},_0x3b9592,_0x4f8787[_0x5b50('0x52')]);var _0x4734a5={'where':_0x3b9592['where']};return db[_0x5b50('0x3f')][_0x5b50('0x31')](_0x4734a5)[_0x5b50('0x38')](function(_0xf5a0dc){_0x44134c[_0x5b50('0x31')]=_0xf5a0dc;if(_0x4f8787[_0x5b50('0x42')][_0x5b50('0x53')]){_0x3b9592[_0x5b50('0x54')]=[{'all':!![]}];}return db[_0x5b50('0x3f')][_0x5b50('0x55')](_0x3b9592);})[_0x5b50('0x38')](function(_0x232dde){_0x44134c['rows']=_0x232dde;return _0x44134c;})[_0x5b50('0x38')](respondWithFilteredResult(_0x421ea0,_0x3b9592))[_0x5b50('0x56')](handleError(_0x421ea0,null));};exports['show']=function(_0x49af3b,_0x1a77df){var _0xca2dd3={'raw':!![],'where':{'id':_0x49af3b['params']['id']}},_0x31bf01={};_0x31bf01[_0x5b50('0x41')]=_[_0x5b50('0x43')](db[_0x5b50('0x3f')][_0x5b50('0x57')]);_0x31bf01[_0x5b50('0x42')]=_[_0x5b50('0x43')](_0x49af3b['query']);_0x31bf01[_0x5b50('0x44')]=_[_0x5b50('0x45')](_0x31bf01[_0x5b50('0x41')],_0x31bf01[_0x5b50('0x42')]);_0xca2dd3['attributes']=_[_0x5b50('0x45')](_0x31bf01[_0x5b50('0x41')],qs[_0x5b50('0x47')](_0x49af3b[_0x5b50('0x42')][_0x5b50('0x47')]));_0xca2dd3[_0x5b50('0x46')]=_0xca2dd3[_0x5b50('0x46')][_0x5b50('0x48')]?_0xca2dd3[_0x5b50('0x46')]:_0x31bf01[_0x5b50('0x41')];if(_0x49af3b[_0x5b50('0x42')][_0x5b50('0x53')]){_0xca2dd3[_0x5b50('0x54')]=[{'all':!![]}];}_0xca2dd3=_[_0x5b50('0x51')]({},_0xca2dd3,_0x49af3b[_0x5b50('0x52')]);return db[_0x5b50('0x3f')][_0x5b50('0x58')](_0xca2dd3)['then'](handleEntityNotFound(_0x1a77df,null))[_0x5b50('0x38')](respondWithResult(_0x1a77df,null))[_0x5b50('0x56')](handleError(_0x1a77df,null));};exports[_0x5b50('0x59')]=function(_0x4e87f3,_0x3d350c){return db[_0x5b50('0x3f')][_0x5b50('0x59')](_0x4e87f3[_0x5b50('0x5a')],{})[_0x5b50('0x38')](function(_0x2fb4c8){var _0x139477=_0x4e87f3[_0x5b50('0x5b')]['get']({'plain':!![]});if(!_0x139477)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x139477['role']===_0x5b50('0x5b')){var _0xaf3904=_0x2fb4c8[_0x5b50('0x3a')]({'plain':!![]});var _0x5a8865=_0x5b50('0x5c');return db['UserProfileSection'][_0x5b50('0x58')]({'where':{'name':_0x5a8865,'userProfileId':_0x139477[_0x5b50('0x5d')]},'raw':!![]})[_0x5b50('0x38')](function(_0x184f06){if(_0x184f06&&_0x184f06['autoAssociation']===0x0){return db[_0x5b50('0x3b')]['create']({'name':_0xaf3904['name'],'resourceId':_0xaf3904['id'],'type':_0x184f06['name'],'sectionId':_0x184f06['id']},{})[_0x5b50('0x38')](function(){return _0x2fb4c8;});}else{return _0x2fb4c8;}})[_0x5b50('0x56')](function(_0x5132f4){logger[_0x5b50('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5132f4);throw _0x5132f4;});}return _0x2fb4c8;})[_0x5b50('0x38')](respondWithResult(_0x3d350c,0xc9))[_0x5b50('0x56')](handleError(_0x3d350c,null));};exports[_0x5b50('0x37')]=function(_0x4b360a,_0x22a159){if(_0x4b360a[_0x5b50('0x5a')]['id']){delete _0x4b360a['body']['id'];}return db['ChatQueue'][_0x5b50('0x58')]({'where':{'id':_0x4b360a[_0x5b50('0x5e')]['id']}})['then'](handleEntityNotFound(_0x22a159,null))['then'](saveUpdates(_0x4b360a['body'],null))[_0x5b50('0x38')](respondWithResult(_0x22a159,null))[_0x5b50('0x56')](handleError(_0x22a159,null));};exports[_0x5b50('0x39')]=function(_0x7c92ea,_0xd3450b){return db[_0x5b50('0x3f')][_0x5b50('0x58')]({'where':{'id':_0x7c92ea[_0x5b50('0x5e')]['id']}})['then'](handleEntityNotFound(_0xd3450b,null))[_0x5b50('0x38')](removeEntity(_0xd3450b,null))[_0x5b50('0x56')](handleError(_0xd3450b,null));};exports[_0x5b50('0x5f')]=function(_0x703b0e,_0x36c826){return db[_0x5b50('0x3f')][_0x5b50('0x5f')]()[_0x5b50('0x38')](respondWithResult(_0x36c826,null))['catch'](handleError(_0x36c826,null));};exports[_0x5b50('0x60')]=function(_0x2bdb5c,_0x4e1591,_0x2ee221){var _0x393fab={'raw':!![],'where':{}},_0xe39495={},_0x58b8f9;return db[_0x5b50('0x3f')]['findOne']({'where':{'id':_0x2bdb5c['params']['id']}})[_0x5b50('0x38')](handleEntityNotFound(_0x4e1591,null))[_0x5b50('0x38')](function(_0x2f92dd){if(_0x2f92dd){_0x58b8f9=_0x2f92dd[_0x5b50('0x3a')]({'plain':!![]});_0xe39495[_0x5b50('0x41')]=_[_0x5b50('0x43')](db['UserChatQueue'][_0x5b50('0x57')]);_0xe39495[_0x5b50('0x42')]=_[_0x5b50('0x43')](_0x2bdb5c[_0x5b50('0x42')]);_0xe39495[_0x5b50('0x44')]=_[_0x5b50('0x45')](_0xe39495[_0x5b50('0x41')],_0xe39495[_0x5b50('0x42')]);_0x393fab['attributes']=_[_0x5b50('0x45')](_0xe39495[_0x5b50('0x41')],qs[_0x5b50('0x47')](_0x2bdb5c[_0x5b50('0x42')][_0x5b50('0x47')]));_0x393fab[_0x5b50('0x46')]=_0x393fab[_0x5b50('0x46')][_0x5b50('0x48')]?_0x393fab[_0x5b50('0x46')]:_0xe39495[_0x5b50('0x41')];if(!_0x2bdb5c[_0x5b50('0x42')][_0x5b50('0x61')](_0x5b50('0x62'))){_0x393fab[_0x5b50('0x2f')]=qs[_0x5b50('0x2f')](_0x2bdb5c[_0x5b50('0x42')][_0x5b50('0x2f')]);_0x393fab[_0x5b50('0x2e')]=qs[_0x5b50('0x2e')](_0x2bdb5c[_0x5b50('0x42')]['offset']);}_0x393fab['order']=qs[_0x5b50('0x4a')](_0x2bdb5c[_0x5b50('0x42')][_0x5b50('0x4a')]);_0x393fab['where']=qs[_0x5b50('0x44')](_['pick'](_0x2bdb5c[_0x5b50('0x42')],_0xe39495['filters']));_0x393fab[_0x5b50('0x4d')][_0x5b50('0x63')]=_0x2f92dd['id'];if(_0x2bdb5c['query'][_0x5b50('0x4c')]){_0x393fab[_0x5b50('0x4d')]=_[_0x5b50('0x51')](_0x393fab[_0x5b50('0x4d')],{'$or':_[_0x5b50('0x4e')](_0x393fab[_0x5b50('0x46')],function(_0x25c08d){var _0x5dcd4e={};_0x5dcd4e[_0x25c08d]={'$like':'%'+_0x2bdb5c['query'][_0x5b50('0x4c')]+'%'};return _0x5dcd4e;})});}_0x393fab=_['merge']({},_0x393fab,_0x2bdb5c[_0x5b50('0x52')]);return db[_0x5b50('0x64')][_0x5b50('0x55')](_0x393fab);}})[_0x5b50('0x38')](function(_0x26d2c0){if(_0x26d2c0){return db[_0x5b50('0x65')][_0x5b50('0x66')]({'where':{'id':_[_0x5b50('0x4e')](_0x26d2c0,_0x5b50('0x67')),'role':_0x5b50('0x68')},'attributes':['id',_0x5b50('0x3c'),_0x5b50('0x69'),_0x5b50('0x6a'),_0x5b50('0x6b')]});}})['then'](function(_0x106f1c){if(_0x106f1c){return{'count':_0x106f1c[_0x5b50('0x31')],'rows':_[_0x5b50('0x4e')](_0x106f1c[_0x5b50('0x6c')],function(_0x2ae5b0){return{'membername':_0x2ae5b0[_0x5b50('0x3c')],'UserId':_0x2ae5b0['id'],'queue_name':_0x58b8f9[_0x5b50('0x3c')],'ChatQueueId':_0x58b8f9['id'],'interface':util['format'](_0x5b50('0x6d'),_0x5b50('0x6e'),_0x2ae5b0[_0x5b50('0x3c')]),'penalty':0x0,'paused':_0x2ae5b0['chatPause'],'createdAt':_0x2ae5b0[_0x5b50('0x6b')],'updatedAt':_0x2ae5b0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e1591,_0x393fab))[_0x5b50('0x56')](handleError(_0x4e1591,null));};exports[_0x5b50('0x6f')]=function(_0x5ac650,_0x5b7641,_0xeaaf13){var _0x310891={};var _0x466b6d={};var _0x289b77;var _0x1717a7;return db[_0x5b50('0x3f')][_0x5b50('0x70')]({'where':{'id':_0x5ac650[_0x5b50('0x5e')]['id']}})[_0x5b50('0x38')](handleEntityNotFound(_0x5b7641,null))[_0x5b50('0x38')](function(_0x5a4f03){if(_0x5a4f03){_0x289b77=_0x5a4f03;_0x466b6d['model']=_[_0x5b50('0x43')](db[_0x5b50('0x71')][_0x5b50('0x57')]);_0x466b6d[_0x5b50('0x42')]=_[_0x5b50('0x43')](_0x5ac650['query']);_0x466b6d[_0x5b50('0x44')]=_[_0x5b50('0x45')](_0x466b6d[_0x5b50('0x41')],_0x466b6d[_0x5b50('0x42')]);_0x310891[_0x5b50('0x46')]=_[_0x5b50('0x45')](_0x466b6d[_0x5b50('0x41')],qs['fields'](_0x5ac650[_0x5b50('0x42')][_0x5b50('0x47')]));_0x310891[_0x5b50('0x46')]=_0x310891[_0x5b50('0x46')][_0x5b50('0x48')]?_0x310891[_0x5b50('0x46')]:_0x466b6d[_0x5b50('0x41')];_0x310891['order']=qs[_0x5b50('0x4a')](_0x5ac650[_0x5b50('0x42')][_0x5b50('0x4a')]);_0x310891[_0x5b50('0x4d')]=qs['filters'](_[_0x5b50('0x4b')](_0x5ac650[_0x5b50('0x42')],_0x466b6d[_0x5b50('0x44')]));if(_0x5ac650[_0x5b50('0x42')][_0x5b50('0x4c')]){_0x310891[_0x5b50('0x4d')]=_['merge'](_0x310891[_0x5b50('0x4d')],{'$or':_['map'](_0x310891[_0x5b50('0x46')],function(_0x1175e6){var _0x34a9c3={};_0x34a9c3[_0x1175e6]={'$like':'%'+_0x5ac650[_0x5b50('0x42')][_0x5b50('0x4c')]+'%'};return _0x34a9c3;})});}_0x310891=_[_0x5b50('0x51')]({},_0x310891,_0x5ac650['options']);return _0x289b77[_0x5b50('0x6f')](_0x310891);}})['then'](function(_0x5081f7){if(_0x5081f7){_0x1717a7=_0x5081f7[_0x5b50('0x48')];if(!_0x5ac650[_0x5b50('0x42')][_0x5b50('0x61')](_0x5b50('0x62'))){_0x310891[_0x5b50('0x2f')]=qs[_0x5b50('0x2f')](_0x5ac650[_0x5b50('0x42')][_0x5b50('0x2f')]);_0x310891[_0x5b50('0x2e')]=qs['offset'](_0x5ac650[_0x5b50('0x42')][_0x5b50('0x2e')]);}return _0x289b77[_0x5b50('0x6f')](_0x310891);}})['then'](function(_0x6ca155){if(_0x6ca155){return _0x6ca155?{'count':_0x1717a7,'rows':_0x6ca155}:null;}})[_0x5b50('0x38')](respondWithResult(_0x5b7641,null))[_0x5b50('0x56')](handleError(_0x5b7641,null));};exports['addTeams']=function(_0xa95303,_0x1f164f,_0x4be466){var _0x454b42=_0xa95303[_0x5b50('0x5a')]['ids'];return db[_0x5b50('0x71')][_0x5b50('0x55')]({'where':{'id':_0x454b42},'attributes':['id'],'include':[{'model':db[_0x5b50('0x65')],'as':_0x5b50('0x72'),'attributes':['id','name',_0x5b50('0x73'),_0x5b50('0x74'),'interface'],'raw':!![]}]})[_0x5b50('0x38')](function(_0x6191b){if(_0x6191b){var _0x7a7405=_[_0x5b50('0x75')](_0x6191b,function(_0x55cce9){var _0x5424bd=_0x55cce9['get']({'plain':!![]});return _0x5424bd['Agents'];});return db[_0x5b50('0x3f')]['find']({'where':{'id':_0xa95303['params']['id']}})[_0x5b50('0x38')](function(_0x535199){return db[_0x5b50('0x76')][_0x5b50('0x77')](function(_0x3b4394){return _0x535199['addTeams'](_0x454b42,{'transaction':_0x3b4394})['then'](function(){return BPromise[_0x5b50('0x78')](_0x7a7405,function(_0x372ae4){return db['UserChatQueue'][_0x5b50('0x79')]({'where':{'UserId':_0x372ae4['id'],'ChatQueueId':_0xa95303['params']['id']},'transaction':_0x3b4394});});})[_0x5b50('0x38')](function(){_0x7a7405[_0x5b50('0x7a')](function(_0x2a04cb){socket[_0x5b50('0x7b')]('userChatQueue:save',{'UserId':_0x2a04cb['id'],'ChatQueueId':_0x535199['id']});});});});});}})[_0x5b50('0x38')](respondWithStatusCode(_0x1f164f,null))[_0x5b50('0x56')](handleError(_0x1f164f,null));};exports['removeTeams']=function(_0x35e135,_0x42ea50,_0xb3b98d){return db[_0x5b50('0x71')][_0x5b50('0x55')]({'where':{'id':_0x35e135[_0x5b50('0x42')][_0x5b50('0x7c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5b50('0x38')](handleEntityNotFound(_0x42ea50,null))['then'](function(_0x2ead21){var _0x2cb6c0=_[_0x5b50('0x4e')](_0x2ead21,'id');var _0x3cb6f4=[];var _0x51371b=[];var _0x31fc86=squel[_0x5b50('0x7d')]();_0x31fc86[_0x5b50('0x7e')](_0x5b50('0x7f'))[_0x5b50('0x80')](_0x5b50('0x81'),'tq')['join'](_0x5b50('0x82'),'ut',_0x5b50('0x83'))['where'](_0x5b50('0x84'),_0x35e135['params']['id']);for(var _0x2a8563=0x0;_0x2a8563<_0x2ead21[_0x5b50('0x48')];_0x2a8563+=0x1){let _0x2c3391=_0x2ead21[_0x2a8563];for(var _0x23de35=0x0;_0x23de35<_0x2c3391[_0x5b50('0x72')][_0x5b50('0x48')];_0x23de35+=0x1){let _0x5e838b=_0x2c3391[_0x5b50('0x72')][_0x23de35];var _0x533440=_0x31fc86[_0x5b50('0x85')]();_0x533440[_0x5b50('0x4d')](_0x5b50('0x86'),_0x5e838b['id']);_0x51371b['push'](db[_0x5b50('0x76')][_0x5b50('0x42')](_0x533440[_0x5b50('0x87')](),{'type':db['sequelize'][_0x5b50('0x88')]['SELECT']})['then'](function(_0x2c7dd3){if(_0x2c7dd3[_0x5b50('0x48')]===0x1){return _0x5e838b['id'];}else{var _0x5be4c8=_[_0x5b50('0x89')](_[_0x5b50('0x4e')](_0x2c7dd3,_0x5b50('0x8a')),function(_0xce679){return _[_0x5b50('0x8b')](_0x2cb6c0,_0xce679);});if(_0x5be4c8){return _0x5e838b['id'];}}}));}}return BPromise['all'](_0x51371b)['then'](function(_0x204dcc){_0x3cb6f4=_(_0x3cb6f4)[_0x5b50('0x8c')](_0x204dcc)[_0x5b50('0x8d')]()[_0x5b50('0x8e')]();return db['ChatQueue'][_0x5b50('0x58')]({'where':{'id':_0x35e135[_0x5b50('0x5e')]['id']}})['then'](function(_0x4c33c8){return db['sequelize'][_0x5b50('0x77')](function(_0x2d7653){return _0x4c33c8[_0x5b50('0x8f')](_0x35e135[_0x5b50('0x42')][_0x5b50('0x7c')],{'transaction':_0x2d7653})['then'](function(){if(!_['isEmpty'](_0x3cb6f4)){return _0x4c33c8['removeAgents'](_0x3cb6f4,{'transaction':_0x2d7653});}})['then'](function(){_0x3cb6f4[_0x5b50('0x7a')](function(_0x4738cb){socket[_0x5b50('0x7b')](_0x5b50('0x90'),{'UserId':_0x4738cb,'ChatQueueId':_0x4c33c8['id']});});});});});});})[_0x5b50('0x38')](respondWithStatusCode(_0x42ea50,null))[_0x5b50('0x56')](handleError(_0x42ea50,null));};exports[_0x5b50('0x91')]=function(_0x5b0944,_0x2a8f86,_0x1ea58f){return db[_0x5b50('0x3f')][_0x5b50('0x58')]({'where':{'id':_0x5b0944[_0x5b50('0x5e')]['id']}})[_0x5b50('0x38')](handleEntityNotFound(_0x2a8f86,null))[_0x5b50('0x38')](function(_0x17c4be){if(_0x17c4be){return _0x17c4be[_0x5b50('0x91')](_0x5b0944[_0x5b50('0x5a')]['ids'],_[_0x5b50('0x92')](_0x5b0944[_0x5b50('0x5a')],[_0x5b50('0x7c'),'id'])||{})['spread'](function(_0x1b026a){for(var _0x13f482=0x0;_0x13f482<_0x5b0944['body']['ids'][_0x5b50('0x48')];_0x13f482+=0x1){socket[_0x5b50('0x7b')]('userChatQueue:save',{'UserId':Number(_0x5b0944[_0x5b50('0x5a')]['ids'][_0x13f482]),'ChatQueueId':Number(_0x5b0944['params']['id'])});}return _0x1b026a;});}})[_0x5b50('0x38')](respondWithResult(_0x2a8f86,null))[_0x5b50('0x56')](handleError(_0x2a8f86,null));};exports[_0x5b50('0x93')]=function(_0x40a388,_0x44f218,_0x1f829d){return db['ChatQueue'][_0x5b50('0x58')]({'where':{'id':_0x40a388[_0x5b50('0x5e')]['id']}})[_0x5b50('0x38')](handleEntityNotFound(_0x44f218,null))[_0x5b50('0x38')](function(_0x1c9549){if(_0x1c9549){return _0x1c9549[_0x5b50('0x93')](_0x40a388['query'][_0x5b50('0x7c')])[_0x5b50('0x38')](function(){if(_['isArray'](_0x40a388[_0x5b50('0x42')][_0x5b50('0x7c')])){for(var _0x3eb368=0x0;_0x3eb368<_0x40a388[_0x5b50('0x42')][_0x5b50('0x7c')][_0x5b50('0x48')];_0x3eb368+=0x1){socket[_0x5b50('0x7b')](_0x5b50('0x90'),{'UserId':Number(_0x40a388[_0x5b50('0x42')][_0x5b50('0x7c')][_0x3eb368]),'ChatQueueId':Number(_0x40a388[_0x5b50('0x5e')]['id'])});}}else{socket[_0x5b50('0x7b')](_0x5b50('0x90'),{'UserId':Number(_0x40a388[_0x5b50('0x42')][_0x5b50('0x7c')]),'ChatQueueId':Number(_0x40a388[_0x5b50('0x5e')]['id'])});}});}})[_0x5b50('0x38')](respondWithStatusCode(_0x44f218,null))[_0x5b50('0x56')](handleError(_0x44f218,null));};exports['getAgents']=function(_0xd9b301,_0x5dc579,_0x4c13f1){var _0x528fcd={};var _0x14f877={};var _0x52dc1d;var _0x519397;return db[_0x5b50('0x3f')][_0x5b50('0x70')]({'where':{'id':_0xd9b301[_0x5b50('0x5e')]['id']}})[_0x5b50('0x38')](handleEntityNotFound(_0x5dc579,null))[_0x5b50('0x38')](function(_0x1415d7){if(_0x1415d7){_0x52dc1d=_0x1415d7;_0x14f877[_0x5b50('0x41')]=_[_0x5b50('0x43')](db[_0x5b50('0x65')][_0x5b50('0x57')]);_0x14f877[_0x5b50('0x42')]=_[_0x5b50('0x43')](_0xd9b301[_0x5b50('0x42')]);_0x14f877['filters']=_[_0x5b50('0x45')](_0x14f877[_0x5b50('0x41')],_0x14f877[_0x5b50('0x42')]);_0x528fcd[_0x5b50('0x46')]=_[_0x5b50('0x45')](_0x14f877[_0x5b50('0x41')],qs[_0x5b50('0x47')](_0xd9b301['query'][_0x5b50('0x47')]));_0x528fcd['attributes']=_0x528fcd[_0x5b50('0x46')][_0x5b50('0x48')]?_0x528fcd[_0x5b50('0x46')]:_0x14f877[_0x5b50('0x41')];_0x528fcd[_0x5b50('0x49')]=qs[_0x5b50('0x4a')](_0xd9b301[_0x5b50('0x42')][_0x5b50('0x4a')]);_0x528fcd['where']=qs[_0x5b50('0x44')](_[_0x5b50('0x4b')](_0xd9b301[_0x5b50('0x42')],_0x14f877[_0x5b50('0x44')]));if(_0xd9b301['query'][_0x5b50('0x4c')]){_0x528fcd['where']=_[_0x5b50('0x51')](_0x528fcd['where'],{'$or':_[_0x5b50('0x4e')](_0x528fcd[_0x5b50('0x46')],function(_0x17eb8a){var _0x521bb0={};_0x521bb0[_0x17eb8a]={'$like':'%'+_0xd9b301[_0x5b50('0x42')][_0x5b50('0x4c')]+'%'};return _0x521bb0;})});}_0x528fcd=_[_0x5b50('0x51')]({},_0x528fcd,_0xd9b301[_0x5b50('0x52')]);return _0x52dc1d['getAgents'](_0x528fcd);}})[_0x5b50('0x38')](function(_0x27ee28){if(_0x27ee28){_0x519397=_0x27ee28[_0x5b50('0x48')];if(!_0xd9b301['query'][_0x5b50('0x61')]('nolimit')){_0x528fcd[_0x5b50('0x2f')]=qs[_0x5b50('0x2f')](_0xd9b301[_0x5b50('0x42')][_0x5b50('0x2f')]);_0x528fcd['offset']=qs[_0x5b50('0x2e')](_0xd9b301['query'][_0x5b50('0x2e')]);}return _0x52dc1d[_0x5b50('0x94')](_0x528fcd);}})['then'](function(_0xcb8ced){if(_0xcb8ced){return _0xcb8ced?{'count':_0x519397,'rows':_0xcb8ced}:null;}})[_0x5b50('0x38')](respondWithResult(_0x5dc579,null))[_0x5b50('0x56')](handleError(_0x5dc579,null));}; \ No newline at end of file +var _0x6c20=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request\x20sent','debug','error','code','ChatQueue,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','query','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','createdAt','format','%s/%s','chatPause','Team','getTeams','hasOwnProperty','User','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','userChatQueue:save','getAgents','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs'];(function(_0x569ea2,_0x4857f1){var _0xda711=function(_0xcada49){while(--_0xcada49){_0x569ea2['push'](_0x569ea2['shift']());}};_0xda711(++_0x4857f1);}(_0x6c20,0x88));var _0x06c2=function(_0x2775f4,_0x10ddd4){_0x2775f4=_0x2775f4-0x0;var _0x377a51=_0x6c20[_0x2775f4];return _0x377a51;};'use strict';var emlformat=require(_0x06c2('0x0'));var rimraf=require(_0x06c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x06c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x06c2('0x3'));var util=require(_0x06c2('0x4'));var path=require(_0x06c2('0x5'));var sox=require(_0x06c2('0x6'));var csv=require(_0x06c2('0x7'));var ejs=require(_0x06c2('0x8'));var fs=require('fs');var fs_extra=require(_0x06c2('0x9'));var _=require(_0x06c2('0xa'));var squel=require(_0x06c2('0xb'));var crypto=require('crypto');var jsforce=require(_0x06c2('0xc'));var deskjs=require(_0x06c2('0xd'));var toCsv=require(_0x06c2('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x06c2('0xe'));var qs=require(_0x06c2('0xf'));var as=require(_0x06c2('0x10'));var hardwareService=require(_0x06c2('0x11'));var logger=require(_0x06c2('0x12'))(_0x06c2('0x13'));var utils=require(_0x06c2('0x14'));var config=require(_0x06c2('0x15'));var licenseUtil=require(_0x06c2('0x16'));var db=require(_0x06c2('0x17'))['db'];config['redis']=_[_0x06c2('0x18')](config[_0x06c2('0x19')],{'host':_0x06c2('0x1a'),'port':0x18eb});var socket=require(_0x06c2('0x1b'))(new Redis(config['redis']));require(_0x06c2('0x1c'))['register'](socket);var jayson=require(_0x06c2('0x1d'));var client=jayson[_0x06c2('0x1e')][_0x06c2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3ca58e,_0x574a8b,_0x946f15,_0x224baa){return new BPromise(function(_0x112ab2,_0x1df697){var _0x5cec76=_0x224baa||client;return _0x5cec76['request'](_0x3ca58e,_0x946f15)['then'](function(_0x4bf48d){logger['info']('ChatQueue,\x20%s,\x20%s',_0x574a8b,_0x06c2('0x20'));logger[_0x06c2('0x21')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x574a8b,'request\x20sent',JSON['stringify'](_0x4bf48d));if(_0x4bf48d[_0x06c2('0x22')]){if(_0x4bf48d[_0x06c2('0x22')][_0x06c2('0x23')]===0x1f4){logger[_0x06c2('0x22')](_0x06c2('0x24'),_0x574a8b,_0x4bf48d[_0x06c2('0x22')][_0x06c2('0x25')]);return _0x1df697(_0x4bf48d['error'][_0x06c2('0x25')]);}logger[_0x06c2('0x22')](_0x06c2('0x24'),_0x574a8b,_0x4bf48d[_0x06c2('0x22')]['message']);return _0x112ab2(_0x4bf48d['error'][_0x06c2('0x25')]);}else{logger['info'](_0x06c2('0x24'),_0x574a8b,_0x06c2('0x20'));_0x112ab2(_0x4bf48d[_0x06c2('0x26')][_0x06c2('0x25')]);}})['catch'](function(_0x2d8373){logger[_0x06c2('0x22')](_0x06c2('0x24'),_0x574a8b,_0x2d8373);_0x1df697(_0x2d8373);});});}function respondWithStatusCode(_0xb56c17,_0x86da7a){_0x86da7a=_0x86da7a||0xcc;return function(_0x30bece){if(_0x30bece){return _0xb56c17[_0x06c2('0x27')](_0x86da7a);}return _0xb56c17[_0x06c2('0x28')](_0x86da7a)[_0x06c2('0x29')]();};}function respondWithResult(_0x413125,_0x391f87){_0x391f87=_0x391f87||0xc8;return function(_0x4c12ca){if(_0x4c12ca){return _0x413125[_0x06c2('0x28')](_0x391f87)[_0x06c2('0x2a')](_0x4c12ca);}};}function respondWithFilteredResult(_0x23ea70,_0x222124){return function(_0xe2b961){if(_0xe2b961){var _0x2c6a15=typeof _0x222124[_0x06c2('0x2b')]==='undefined'&&typeof _0x222124[_0x06c2('0x2c')]===_0x06c2('0x2d');var _0x2425ad=_0xe2b961[_0x06c2('0x2e')];var _0xe6b93c=_0x2c6a15?0x0:_0x222124['offset'];var _0x3e4d7f=_0x2c6a15?_0xe2b961[_0x06c2('0x2e')]:_0x222124['offset']+_0x222124[_0x06c2('0x2c')];var _0x5bd948;if(_0x3e4d7f>=_0x2425ad){_0x3e4d7f=_0x2425ad;_0x5bd948=0xc8;}else{_0x5bd948=0xce;}_0x23ea70[_0x06c2('0x28')](_0x5bd948);return _0x23ea70[_0x06c2('0x2f')](_0x06c2('0x30'),_0xe6b93c+'-'+_0x3e4d7f+'/'+_0x2425ad)['json'](_0xe2b961);}return null;};}function patchUpdates(_0x30fb98){return function(_0x414cc3){try{jsonpatch[_0x06c2('0x31')](_0x414cc3,_0x30fb98,!![]);}catch(_0x5be2cd){return BPromise[_0x06c2('0x32')](_0x5be2cd);}return _0x414cc3[_0x06c2('0x33')]();};}function saveUpdates(_0x5a69c1,_0x5bb12a){return function(_0x286ba4){if(_0x286ba4){return _0x286ba4['update'](_0x5a69c1)[_0x06c2('0x34')](function(_0x445a18){return _0x445a18;});}return null;};}function removeEntity(_0x2e5d4c,_0x5eee96){return function(_0xfd4e47){if(_0xfd4e47){return _0xfd4e47[_0x06c2('0x35')]()[_0x06c2('0x34')](function(){var _0x232c15=_0xfd4e47[_0x06c2('0x36')]({'plain':!![]});var _0x5dec20=_0x06c2('0x37');return db[_0x06c2('0x38')][_0x06c2('0x35')]({'where':{'type':_0x5dec20,'resourceId':_0x232c15['id']}})[_0x06c2('0x34')](function(){return _0xfd4e47;});})[_0x06c2('0x34')](function(){_0x2e5d4c[_0x06c2('0x28')](0xcc)[_0x06c2('0x29')]();});}};}function handleEntityNotFound(_0x1ad475,_0x1fe07a){return function(_0x110415){if(!_0x110415){_0x1ad475['sendStatus'](0x194);}return _0x110415;};}function handleError(_0x21a593,_0x2ccc33){_0x2ccc33=_0x2ccc33||0x1f4;return function(_0x1e053f){logger[_0x06c2('0x22')](_0x1e053f[_0x06c2('0x39')]);if(_0x1e053f[_0x06c2('0x3a')]){delete _0x1e053f['name'];}_0x21a593['status'](_0x2ccc33)['send'](_0x1e053f);};}exports[_0x06c2('0x3b')]=function(_0x22bd8c,_0x15260b){var _0x3c1bc0={},_0x271c20={},_0x1a5abf={'count':0x0,'rows':[]};var _0x5d5f19=_[_0x06c2('0x3c')](db[_0x06c2('0x3d')][_0x06c2('0x3e')],function(_0x315d89){return{'name':_0x315d89[_0x06c2('0x3f')],'type':_0x315d89[_0x06c2('0x40')]['key']};});_0x271c20['model']=_[_0x06c2('0x3c')](_0x5d5f19,_0x06c2('0x3a'));_0x271c20[_0x06c2('0x41')]=_['keys'](_0x22bd8c[_0x06c2('0x41')]);_0x271c20['filters']=_[_0x06c2('0x42')](_0x271c20['model'],_0x271c20[_0x06c2('0x41')]);_0x3c1bc0[_0x06c2('0x43')]=_[_0x06c2('0x42')](_0x271c20[_0x06c2('0x44')],qs[_0x06c2('0x45')](_0x22bd8c[_0x06c2('0x41')]['fields']));_0x3c1bc0['attributes']=_0x3c1bc0['attributes']['length']?_0x3c1bc0[_0x06c2('0x43')]:_0x271c20[_0x06c2('0x44')];if(!_0x22bd8c['query']['hasOwnProperty'](_0x06c2('0x46'))){_0x3c1bc0[_0x06c2('0x2c')]=qs[_0x06c2('0x2c')](_0x22bd8c[_0x06c2('0x41')][_0x06c2('0x2c')]);_0x3c1bc0[_0x06c2('0x2b')]=qs[_0x06c2('0x2b')](_0x22bd8c['query'][_0x06c2('0x2b')]);}_0x3c1bc0[_0x06c2('0x47')]=qs[_0x06c2('0x48')](_0x22bd8c[_0x06c2('0x41')][_0x06c2('0x48')]);_0x3c1bc0[_0x06c2('0x49')]=qs['filters'](_[_0x06c2('0x4a')](_0x22bd8c[_0x06c2('0x41')],_0x271c20[_0x06c2('0x4b')]),_0x5d5f19);if(_0x22bd8c[_0x06c2('0x41')][_0x06c2('0x4c')]){_0x3c1bc0[_0x06c2('0x49')]=_[_0x06c2('0x4d')](_0x3c1bc0[_0x06c2('0x49')],{'$or':_[_0x06c2('0x3c')](_0x5d5f19,function(_0x1168b5){if(_0x1168b5['type']!==_0x06c2('0x4e')){var _0x23e01e={};_0x23e01e[_0x1168b5[_0x06c2('0x3a')]]={'$like':'%'+_0x22bd8c[_0x06c2('0x41')]['filter']+'%'};return _0x23e01e;}})});}_0x3c1bc0=_[_0x06c2('0x4d')]({},_0x3c1bc0,_0x22bd8c[_0x06c2('0x4f')]);var _0x2ce4b6={'where':_0x3c1bc0['where']};return db['ChatQueue']['count'](_0x2ce4b6)[_0x06c2('0x34')](function(_0x13929e){_0x1a5abf[_0x06c2('0x2e')]=_0x13929e;if(_0x22bd8c[_0x06c2('0x41')][_0x06c2('0x50')]){_0x3c1bc0[_0x06c2('0x51')]=[{'all':!![]}];}return db[_0x06c2('0x3d')][_0x06c2('0x52')](_0x3c1bc0);})[_0x06c2('0x34')](function(_0x4d1cad){_0x1a5abf[_0x06c2('0x53')]=_0x4d1cad;return _0x1a5abf;})['then'](respondWithFilteredResult(_0x15260b,_0x3c1bc0))[_0x06c2('0x54')](handleError(_0x15260b,null));};exports['show']=function(_0x5f0168,_0x23434a){var _0x1c53ef={'raw':!![],'where':{'id':_0x5f0168[_0x06c2('0x55')]['id']}},_0x38290e={};_0x38290e['model']=_['keys'](db[_0x06c2('0x3d')][_0x06c2('0x3e')]);_0x38290e[_0x06c2('0x41')]=_[_0x06c2('0x56')](_0x5f0168['query']);_0x38290e[_0x06c2('0x4b')]=_[_0x06c2('0x42')](_0x38290e[_0x06c2('0x44')],_0x38290e[_0x06c2('0x41')]);_0x1c53ef[_0x06c2('0x43')]=_['intersection'](_0x38290e[_0x06c2('0x44')],qs[_0x06c2('0x45')](_0x5f0168['query'][_0x06c2('0x45')]));_0x1c53ef[_0x06c2('0x43')]=_0x1c53ef['attributes'][_0x06c2('0x57')]?_0x1c53ef[_0x06c2('0x43')]:_0x38290e[_0x06c2('0x44')];if(_0x5f0168['query'][_0x06c2('0x50')]){_0x1c53ef[_0x06c2('0x51')]=[{'all':!![]}];}_0x1c53ef=_[_0x06c2('0x4d')]({},_0x1c53ef,_0x5f0168['options']);return db[_0x06c2('0x3d')][_0x06c2('0x58')](_0x1c53ef)['then'](handleEntityNotFound(_0x23434a,null))['then'](respondWithResult(_0x23434a,null))[_0x06c2('0x54')](handleError(_0x23434a,null));};exports[_0x06c2('0x59')]=function(_0x4cd26a,_0x2c4bf0){return db[_0x06c2('0x3d')]['create'](_0x4cd26a[_0x06c2('0x5a')],{})[_0x06c2('0x34')](function(_0x55a9f4){var _0x3d10b5=_0x4cd26a[_0x06c2('0x5b')][_0x06c2('0x36')]({'plain':!![]});if(!_0x3d10b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d10b5[_0x06c2('0x5c')]===_0x06c2('0x5b')){var _0x151571=_0x55a9f4[_0x06c2('0x36')]({'plain':!![]});var _0x1f1fbc=_0x06c2('0x37');return db[_0x06c2('0x5d')][_0x06c2('0x58')]({'where':{'name':_0x1f1fbc,'userProfileId':_0x3d10b5[_0x06c2('0x5e')]},'raw':!![]})[_0x06c2('0x34')](function(_0x3e9d4b){if(_0x3e9d4b&&_0x3e9d4b[_0x06c2('0x5f')]===0x0){return db[_0x06c2('0x38')]['create']({'name':_0x151571[_0x06c2('0x3a')],'resourceId':_0x151571['id'],'type':_0x3e9d4b[_0x06c2('0x3a')],'sectionId':_0x3e9d4b['id']},{})[_0x06c2('0x34')](function(){return _0x55a9f4;});}else{return _0x55a9f4;}})['catch'](function(_0x46b368){logger[_0x06c2('0x22')](_0x06c2('0x60'),_0x46b368);throw _0x46b368;});}return _0x55a9f4;})['then'](respondWithResult(_0x2c4bf0,0xc9))[_0x06c2('0x54')](handleError(_0x2c4bf0,null));};exports['update']=function(_0x1c1676,_0x48f88d){if(_0x1c1676['body']['id']){delete _0x1c1676['body']['id'];}return db[_0x06c2('0x3d')][_0x06c2('0x58')]({'where':{'id':_0x1c1676['params']['id']}})[_0x06c2('0x34')](handleEntityNotFound(_0x48f88d,null))[_0x06c2('0x34')](saveUpdates(_0x1c1676[_0x06c2('0x5a')],null))['then'](respondWithResult(_0x48f88d,null))[_0x06c2('0x54')](handleError(_0x48f88d,null));};exports[_0x06c2('0x35')]=function(_0x1a9e22,_0x3e02a6){return db[_0x06c2('0x3d')][_0x06c2('0x58')]({'where':{'id':_0x1a9e22[_0x06c2('0x55')]['id']}})[_0x06c2('0x34')](handleEntityNotFound(_0x3e02a6,null))[_0x06c2('0x34')](removeEntity(_0x3e02a6,null))['catch'](handleError(_0x3e02a6,null));};exports[_0x06c2('0x61')]=function(_0x56a045,_0xf7d689){return db[_0x06c2('0x3d')]['describe']()[_0x06c2('0x34')](respondWithResult(_0xf7d689,null))[_0x06c2('0x54')](handleError(_0xf7d689,null));};exports[_0x06c2('0x62')]=function(_0x120669,_0x417b31,_0x5aa919){var _0x3244b8={'raw':!![],'where':{}},_0x2b41e9={},_0x60887e;return db[_0x06c2('0x3d')][_0x06c2('0x63')]({'where':{'id':_0x120669['params']['id']}})[_0x06c2('0x34')](handleEntityNotFound(_0x417b31,null))[_0x06c2('0x34')](function(_0x27484d){if(_0x27484d){_0x60887e=_0x27484d[_0x06c2('0x36')]({'plain':!![]});_0x2b41e9['model']=_[_0x06c2('0x56')](db[_0x06c2('0x64')]['rawAttributes']);_0x2b41e9[_0x06c2('0x41')]=_[_0x06c2('0x56')](_0x120669[_0x06c2('0x41')]);_0x2b41e9['filters']=_[_0x06c2('0x42')](_0x2b41e9[_0x06c2('0x44')],_0x2b41e9['query']);_0x3244b8[_0x06c2('0x43')]=_[_0x06c2('0x42')](_0x2b41e9[_0x06c2('0x44')],qs['fields'](_0x120669[_0x06c2('0x41')][_0x06c2('0x45')]));_0x3244b8['attributes']=_0x3244b8['attributes']['length']?_0x3244b8[_0x06c2('0x43')]:_0x2b41e9[_0x06c2('0x44')];if(!_0x120669[_0x06c2('0x41')]['hasOwnProperty']('nolimit')){_0x3244b8[_0x06c2('0x2c')]=qs[_0x06c2('0x2c')](_0x120669[_0x06c2('0x41')][_0x06c2('0x2c')]);_0x3244b8['offset']=qs[_0x06c2('0x2b')](_0x120669[_0x06c2('0x41')][_0x06c2('0x2b')]);}_0x3244b8[_0x06c2('0x47')]=qs['sort'](_0x120669[_0x06c2('0x41')][_0x06c2('0x48')]);_0x3244b8[_0x06c2('0x49')]=qs[_0x06c2('0x4b')](_[_0x06c2('0x4a')](_0x120669[_0x06c2('0x41')],_0x2b41e9[_0x06c2('0x4b')]));_0x3244b8[_0x06c2('0x49')][_0x06c2('0x65')]=_0x27484d['id'];if(_0x120669[_0x06c2('0x41')]['filter']){_0x3244b8['where']=_[_0x06c2('0x4d')](_0x3244b8[_0x06c2('0x49')],{'$or':_[_0x06c2('0x3c')](_0x3244b8['attributes'],function(_0x21950b){var _0x1adce9={};_0x1adce9[_0x21950b]={'$like':'%'+_0x120669[_0x06c2('0x41')][_0x06c2('0x4c')]+'%'};return _0x1adce9;})});}_0x3244b8=_[_0x06c2('0x4d')]({},_0x3244b8,_0x120669[_0x06c2('0x4f')]);return db['UserChatQueue']['findAll'](_0x3244b8);}})[_0x06c2('0x34')](function(_0x5f409b){if(_0x5f409b){return db['User'][_0x06c2('0x66')]({'where':{'id':_[_0x06c2('0x3c')](_0x5f409b,_0x06c2('0x67')),'role':_0x06c2('0x68')},'attributes':['id',_0x06c2('0x3a'),'chatPause','updatedAt',_0x06c2('0x69')]});}})[_0x06c2('0x34')](function(_0x26e380){if(_0x26e380){return{'count':_0x26e380[_0x06c2('0x2e')],'rows':_[_0x06c2('0x3c')](_0x26e380['rows'],function(_0x232ff2){return{'membername':_0x232ff2[_0x06c2('0x3a')],'UserId':_0x232ff2['id'],'queue_name':_0x60887e[_0x06c2('0x3a')],'ChatQueueId':_0x60887e['id'],'interface':util[_0x06c2('0x6a')](_0x06c2('0x6b'),'SIP',_0x232ff2[_0x06c2('0x3a')]),'penalty':0x0,'paused':_0x232ff2[_0x06c2('0x6c')],'createdAt':_0x232ff2[_0x06c2('0x69')],'updatedAt':_0x232ff2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x417b31,_0x3244b8))[_0x06c2('0x54')](handleError(_0x417b31,null));};exports['getTeams']=function(_0x7f8da1,_0x597918,_0x4ebea2){var _0xdd9b03={};var _0x21e6a1={};var _0x3729e6;var _0x2f7523;return db[_0x06c2('0x3d')][_0x06c2('0x63')]({'where':{'id':_0x7f8da1[_0x06c2('0x55')]['id']}})[_0x06c2('0x34')](handleEntityNotFound(_0x597918,null))['then'](function(_0x27ea45){if(_0x27ea45){_0x3729e6=_0x27ea45;_0x21e6a1[_0x06c2('0x44')]=_[_0x06c2('0x56')](db[_0x06c2('0x6d')][_0x06c2('0x3e')]);_0x21e6a1['query']=_[_0x06c2('0x56')](_0x7f8da1[_0x06c2('0x41')]);_0x21e6a1[_0x06c2('0x4b')]=_[_0x06c2('0x42')](_0x21e6a1[_0x06c2('0x44')],_0x21e6a1[_0x06c2('0x41')]);_0xdd9b03['attributes']=_['intersection'](_0x21e6a1[_0x06c2('0x44')],qs[_0x06c2('0x45')](_0x7f8da1[_0x06c2('0x41')][_0x06c2('0x45')]));_0xdd9b03['attributes']=_0xdd9b03[_0x06c2('0x43')][_0x06c2('0x57')]?_0xdd9b03[_0x06c2('0x43')]:_0x21e6a1['model'];_0xdd9b03['order']=qs[_0x06c2('0x48')](_0x7f8da1[_0x06c2('0x41')][_0x06c2('0x48')]);_0xdd9b03['where']=qs[_0x06c2('0x4b')](_[_0x06c2('0x4a')](_0x7f8da1[_0x06c2('0x41')],_0x21e6a1['filters']));if(_0x7f8da1[_0x06c2('0x41')][_0x06c2('0x4c')]){_0xdd9b03[_0x06c2('0x49')]=_[_0x06c2('0x4d')](_0xdd9b03['where'],{'$or':_[_0x06c2('0x3c')](_0xdd9b03[_0x06c2('0x43')],function(_0x3a099d){var _0x1f4346={};_0x1f4346[_0x3a099d]={'$like':'%'+_0x7f8da1[_0x06c2('0x41')][_0x06c2('0x4c')]+'%'};return _0x1f4346;})});}_0xdd9b03=_[_0x06c2('0x4d')]({},_0xdd9b03,_0x7f8da1[_0x06c2('0x4f')]);return _0x3729e6[_0x06c2('0x6e')](_0xdd9b03);}})['then'](function(_0x4d7cd){if(_0x4d7cd){_0x2f7523=_0x4d7cd[_0x06c2('0x57')];if(!_0x7f8da1['query'][_0x06c2('0x6f')]('nolimit')){_0xdd9b03['limit']=qs[_0x06c2('0x2c')](_0x7f8da1['query'][_0x06c2('0x2c')]);_0xdd9b03[_0x06c2('0x2b')]=qs[_0x06c2('0x2b')](_0x7f8da1[_0x06c2('0x41')][_0x06c2('0x2b')]);}return _0x3729e6[_0x06c2('0x6e')](_0xdd9b03);}})[_0x06c2('0x34')](function(_0x47a31f){if(_0x47a31f){return _0x47a31f?{'count':_0x2f7523,'rows':_0x47a31f}:null;}})[_0x06c2('0x34')](respondWithResult(_0x597918,null))[_0x06c2('0x54')](handleError(_0x597918,null));};exports['addTeams']=function(_0x495be6,_0x3aadcd,_0x606986){var _0x50543a=_0x495be6[_0x06c2('0x5a')]['ids'];return db[_0x06c2('0x6d')][_0x06c2('0x52')]({'where':{'id':_0x50543a},'attributes':['id'],'include':[{'model':db[_0x06c2('0x70')],'as':_0x06c2('0x71'),'attributes':['id',_0x06c2('0x3a'),_0x06c2('0x72'),_0x06c2('0x73'),'interface'],'raw':!![]}]})[_0x06c2('0x34')](function(_0x5b2845){if(_0x5b2845){var _0x1c5ca9=_[_0x06c2('0x74')](_0x5b2845,function(_0x5479f){var _0x5813a9=_0x5479f['get']({'plain':!![]});return _0x5813a9[_0x06c2('0x71')];});return db[_0x06c2('0x3d')][_0x06c2('0x58')]({'where':{'id':_0x495be6[_0x06c2('0x55')]['id']}})[_0x06c2('0x34')](function(_0x2ee3ee){return db[_0x06c2('0x75')][_0x06c2('0x76')](function(_0x405f1c){return _0x2ee3ee[_0x06c2('0x77')](_0x50543a,{'transaction':_0x405f1c})['then'](function(){return BPromise[_0x06c2('0x78')](_0x1c5ca9,function(_0x22d245){return db[_0x06c2('0x64')][_0x06c2('0x79')]({'where':{'UserId':_0x22d245['id'],'ChatQueueId':_0x495be6[_0x06c2('0x55')]['id']},'transaction':_0x405f1c});});})[_0x06c2('0x34')](function(){_0x1c5ca9['forEach'](function(_0x18c54f){socket[_0x06c2('0x7a')]('userChatQueue:save',{'UserId':_0x18c54f['id'],'ChatQueueId':_0x2ee3ee['id']});});});});});}})[_0x06c2('0x34')](respondWithStatusCode(_0x3aadcd,null))[_0x06c2('0x54')](handleError(_0x3aadcd,null));};exports[_0x06c2('0x7b')]=function(_0x25c4ad,_0x47f407,_0xf757af){return db[_0x06c2('0x6d')][_0x06c2('0x52')]({'where':{'id':_0x25c4ad['query'][_0x06c2('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x06c2('0x70')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x06c2('0x34')](handleEntityNotFound(_0x47f407,null))[_0x06c2('0x34')](function(_0x4930bb){var _0x27cd20=_['map'](_0x4930bb,'id');var _0x35e575=[];var _0x328cbe=[];var _0x2ecf6b=squel[_0x06c2('0x7d')]();_0x2ecf6b[_0x06c2('0x7e')](_0x06c2('0x7f'))[_0x06c2('0x80')](_0x06c2('0x81'),'tq')[_0x06c2('0x82')](_0x06c2('0x83'),'ut',_0x06c2('0x84'))[_0x06c2('0x49')](_0x06c2('0x85'),_0x25c4ad[_0x06c2('0x55')]['id']);for(var _0x2c6746=0x0;_0x2c6746<_0x4930bb[_0x06c2('0x57')];_0x2c6746+=0x1){let _0x1989ac=_0x4930bb[_0x2c6746];for(var _0x3ae042=0x0;_0x3ae042<_0x1989ac['Agents'][_0x06c2('0x57')];_0x3ae042+=0x1){let _0x377885=_0x1989ac[_0x06c2('0x71')][_0x3ae042];var _0xc753c2=_0x2ecf6b[_0x06c2('0x86')]();_0xc753c2['where'](_0x06c2('0x87'),_0x377885['id']);_0x328cbe[_0x06c2('0x88')](db['sequelize']['query'](_0xc753c2[_0x06c2('0x89')](),{'type':db['sequelize'][_0x06c2('0x8a')][_0x06c2('0x8b')]})['then'](function(_0x44ad5f){if(_0x44ad5f[_0x06c2('0x57')]===0x1){return _0x377885['id'];}else{var _0xb6f3a0=_['every'](_['map'](_0x44ad5f,'TeamId'),function(_0x9579b7){return _[_0x06c2('0x8c')](_0x27cd20,_0x9579b7);});if(_0xb6f3a0){return _0x377885['id'];}}}));}}return BPromise[_0x06c2('0x8d')](_0x328cbe)[_0x06c2('0x34')](function(_0x269f57){_0x35e575=_(_0x35e575)[_0x06c2('0x8e')](_0x269f57)['compact']()[_0x06c2('0x8f')]();return db[_0x06c2('0x3d')][_0x06c2('0x58')]({'where':{'id':_0x25c4ad[_0x06c2('0x55')]['id']}})[_0x06c2('0x34')](function(_0x509780){return db['sequelize'][_0x06c2('0x76')](function(_0xd95746){return _0x509780[_0x06c2('0x7b')](_0x25c4ad[_0x06c2('0x41')][_0x06c2('0x7c')],{'transaction':_0xd95746})['then'](function(){if(!_[_0x06c2('0x90')](_0x35e575)){return _0x509780[_0x06c2('0x91')](_0x35e575,{'transaction':_0xd95746});}})[_0x06c2('0x34')](function(){_0x35e575[_0x06c2('0x92')](function(_0x5e39e6){socket[_0x06c2('0x7a')](_0x06c2('0x93'),{'UserId':_0x5e39e6,'ChatQueueId':_0x509780['id']});});});});});});})[_0x06c2('0x34')](respondWithStatusCode(_0x47f407,null))[_0x06c2('0x54')](handleError(_0x47f407,null));};exports['addAgents']=function(_0x2cd3c2,_0x2dd6c0,_0x957c56){return db['ChatQueue'][_0x06c2('0x58')]({'where':{'id':_0x2cd3c2[_0x06c2('0x55')]['id']}})['then'](handleEntityNotFound(_0x2dd6c0,null))['then'](function(_0x544e55){if(_0x544e55){return _0x544e55[_0x06c2('0x94')](_0x2cd3c2[_0x06c2('0x5a')][_0x06c2('0x7c')],_['omit'](_0x2cd3c2[_0x06c2('0x5a')],[_0x06c2('0x7c'),'id'])||{})[_0x06c2('0x95')](function(_0x677295){for(var _0x37906e=0x0;_0x37906e<_0x2cd3c2['body'][_0x06c2('0x7c')][_0x06c2('0x57')];_0x37906e+=0x1){socket['emit'](_0x06c2('0x96'),{'UserId':Number(_0x2cd3c2[_0x06c2('0x5a')][_0x06c2('0x7c')][_0x37906e]),'ChatQueueId':Number(_0x2cd3c2[_0x06c2('0x55')]['id'])});}return _0x677295;});}})['then'](respondWithResult(_0x2dd6c0,null))[_0x06c2('0x54')](handleError(_0x2dd6c0,null));};exports[_0x06c2('0x91')]=function(_0x20ece4,_0x1388f9,_0x13ba26){return db[_0x06c2('0x3d')][_0x06c2('0x58')]({'where':{'id':_0x20ece4[_0x06c2('0x55')]['id']}})[_0x06c2('0x34')](handleEntityNotFound(_0x1388f9,null))['then'](function(_0x15d832){if(_0x15d832){return _0x15d832[_0x06c2('0x91')](_0x20ece4[_0x06c2('0x41')]['ids'])[_0x06c2('0x34')](function(){if(_['isArray'](_0x20ece4[_0x06c2('0x41')][_0x06c2('0x7c')])){for(var _0x2f008a=0x0;_0x2f008a<_0x20ece4[_0x06c2('0x41')][_0x06c2('0x7c')][_0x06c2('0x57')];_0x2f008a+=0x1){socket[_0x06c2('0x7a')](_0x06c2('0x93'),{'UserId':Number(_0x20ece4[_0x06c2('0x41')]['ids'][_0x2f008a]),'ChatQueueId':Number(_0x20ece4[_0x06c2('0x55')]['id'])});}}else{socket[_0x06c2('0x7a')](_0x06c2('0x93'),{'UserId':Number(_0x20ece4[_0x06c2('0x41')][_0x06c2('0x7c')]),'ChatQueueId':Number(_0x20ece4['params']['id'])});}});}})[_0x06c2('0x34')](respondWithStatusCode(_0x1388f9,null))['catch'](handleError(_0x1388f9,null));};exports['getAgents']=function(_0x28a0dc,_0x48a717,_0x4b7fc5){var _0x19a592={};var _0x3d16a7={};var _0xde813d;var _0x392502;return db[_0x06c2('0x3d')][_0x06c2('0x63')]({'where':{'id':_0x28a0dc[_0x06c2('0x55')]['id']}})[_0x06c2('0x34')](handleEntityNotFound(_0x48a717,null))[_0x06c2('0x34')](function(_0x55229c){if(_0x55229c){_0xde813d=_0x55229c;_0x3d16a7[_0x06c2('0x44')]=_['keys'](db[_0x06c2('0x70')]['rawAttributes']);_0x3d16a7['query']=_[_0x06c2('0x56')](_0x28a0dc[_0x06c2('0x41')]);_0x3d16a7[_0x06c2('0x4b')]=_[_0x06c2('0x42')](_0x3d16a7[_0x06c2('0x44')],_0x3d16a7[_0x06c2('0x41')]);_0x19a592[_0x06c2('0x43')]=_[_0x06c2('0x42')](_0x3d16a7[_0x06c2('0x44')],qs[_0x06c2('0x45')](_0x28a0dc['query']['fields']));_0x19a592[_0x06c2('0x43')]=_0x19a592[_0x06c2('0x43')]['length']?_0x19a592[_0x06c2('0x43')]:_0x3d16a7[_0x06c2('0x44')];_0x19a592[_0x06c2('0x47')]=qs[_0x06c2('0x48')](_0x28a0dc[_0x06c2('0x41')][_0x06c2('0x48')]);_0x19a592[_0x06c2('0x49')]=qs[_0x06c2('0x4b')](_['pick'](_0x28a0dc['query'],_0x3d16a7['filters']));if(_0x28a0dc['query'][_0x06c2('0x4c')]){_0x19a592[_0x06c2('0x49')]=_[_0x06c2('0x4d')](_0x19a592['where'],{'$or':_[_0x06c2('0x3c')](_0x19a592[_0x06c2('0x43')],function(_0x59c9bc){var _0x202801={};_0x202801[_0x59c9bc]={'$like':'%'+_0x28a0dc[_0x06c2('0x41')]['filter']+'%'};return _0x202801;})});}_0x19a592=_['merge']({},_0x19a592,_0x28a0dc[_0x06c2('0x4f')]);return _0xde813d[_0x06c2('0x97')](_0x19a592);}})[_0x06c2('0x34')](function(_0x5ced2e){if(_0x5ced2e){_0x392502=_0x5ced2e['length'];if(!_0x28a0dc['query']['hasOwnProperty'](_0x06c2('0x46'))){_0x19a592[_0x06c2('0x2c')]=qs['limit'](_0x28a0dc[_0x06c2('0x41')][_0x06c2('0x2c')]);_0x19a592[_0x06c2('0x2b')]=qs['offset'](_0x28a0dc[_0x06c2('0x41')][_0x06c2('0x2b')]);}return _0xde813d[_0x06c2('0x97')](_0x19a592);}})['then'](function(_0x44aee2){if(_0x44aee2){return _0x44aee2?{'count':_0x392502,'rows':_0x44aee2}:null;}})[_0x06c2('0x34')](respondWithResult(_0x48a717,null))[_0x06c2('0x54')](handleError(_0x48a717,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 6614f2e..55bbd1c 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 _0xbb5f=['setMaxListeners','save','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1712cd,_0x2dcca7){var _0x262485=function(_0x3c2fb9){while(--_0x3c2fb9){_0x1712cd['push'](_0x1712cd['shift']());}};_0x262485(++_0x2dcca7);}(_0xbb5f,0xbc));var _0xfbb5=function(_0xba10dd,_0x379c6b){_0xba10dd=_0xba10dd-0x0;var _0x24dae5=_0xbb5f[_0xba10dd];return _0x24dae5;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xfbb5('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xfbb5('0x1')](0x0);var events={'afterCreate':_0xfbb5('0x2'),'afterUpdate':'update','afterDestroy':_0xfbb5('0x3')};function emitEvent(_0x36094f){return function(_0xd48cfd,_0x64184a,_0x4d4499){ChatQueueEvents['emit'](_0x36094f+':'+_0xd48cfd['id'],_0xd48cfd);ChatQueueEvents['emit'](_0x36094f,_0xd48cfd);_0x4d4499(null);};}for(var e in events){if(events[_0xfbb5('0x4')](e)){var event=events[e];ChatQueue[_0xfbb5('0x5')](e,emitEvent(event));}}module[_0xfbb5('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x049e=['hasOwnProperty','hook','events','setMaxListeners','save','remove','emit'];(function(_0x3dd8cf,_0x1e1219){var _0x13a125=function(_0x544297){while(--_0x544297){_0x3dd8cf['push'](_0x3dd8cf['shift']());}};_0x13a125(++_0x1e1219);}(_0x049e,0x72));var _0xe049=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x049e[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0xe049('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe049('0x1')](0x0);var events={'afterCreate':_0xe049('0x2'),'afterUpdate':'update','afterDestroy':_0xe049('0x3')};function emitEvent(_0x22c752){return function(_0x14fa69,_0x23a950,_0x1379cb){ChatQueueEvents[_0xe049('0x4')](_0x22c752+':'+_0x14fa69['id'],_0x14fa69);ChatQueueEvents[_0xe049('0x4')](_0x22c752,_0x14fa69);_0x1379cb(null);};}for(var e in events){if(events[_0xe049('0x5')](e)){var event=events[e];ChatQueue[_0xe049('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ae8c182..9c198e8 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 _0xb435=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util'];(function(_0x86f333,_0xa6fa91){var _0x784b70=function(_0xd51115){while(--_0xd51115){_0x86f333['push'](_0x86f333['shift']());}};_0x784b70(++_0xa6fa91);}(_0xb435,0x178));var _0x5b43=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb435[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5b43('0x0'));var util=require(_0x5b43('0x1'));var logger=require('../../config/logger')(_0x5b43('0x2'));var moment=require(_0x5b43('0x3'));var BPromise=require(_0x5b43('0x4'));var rp=require(_0x5b43('0x5'));var fs=require('fs');var path=require(_0x5b43('0x6'));var rimraf=require(_0x5b43('0x7'));var config=require(_0x5b43('0x8'));var attributes=require(_0x5b43('0x9'));module[_0x5b43('0xa')]=function(_0x86b2de,_0x168b78){return _0x86b2de[_0x5b43('0xb')](_0x5b43('0xc'),attributes,{'tableName':_0x5b43('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf0f=['api','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x4b4027,_0x282103){var _0x1544c7=function(_0x556639){while(--_0x556639){_0x4b4027['push'](_0x4b4027['shift']());}};_0x1544c7(++_0x282103);}(_0xcf0f,0x99));var _0xfcf0=function(_0x44f9a5,_0x5952a1){_0x44f9a5=_0x44f9a5-0x0;var _0x41ca9a=_0xcf0f[_0x44f9a5];return _0x41ca9a;};'use strict';var _=require(_0xfcf0('0x0'));var util=require(_0xfcf0('0x1'));var logger=require(_0xfcf0('0x2'))(_0xfcf0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfcf0('0x4'));var fs=require('fs');var path=require(_0xfcf0('0x5'));var rimraf=require(_0xfcf0('0x6'));var config=require(_0xfcf0('0x7'));var attributes=require(_0xfcf0('0x8'));module[_0xfcf0('0x9')]=function(_0x684f86,_0x3c3fb6){return _0x684f86[_0xfcf0('0xa')](_0xfcf0('0xb'),attributes,{'tableName':_0xfcf0('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 5b98f08..a612b96 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 _0x13cc=['options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','debug','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','findAll'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x13cc,0x161));var _0xc13c=function(_0x7086d1,_0x16fbdd){_0x7086d1=_0x7086d1-0x0;var _0x300ce7=_0x13cc[_0x7086d1];return _0x300ce7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc13c('0x0'));var BPromise=require(_0xc13c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc13c('0x2'));var db=require(_0xc13c('0x3'))['db'];var utils=require(_0xc13c('0x4'));var logger=require(_0xc13c('0x5'))(_0xc13c('0x6'));var config=require(_0xc13c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc13c('0x8')]['http']({'port':0x232a});config[_0xc13c('0x9')]=_[_0xc13c('0xa')](config[_0xc13c('0x9')],{'host':_0xc13c('0xb'),'port':0x18eb});var socket=require(_0xc13c('0xc'))(new Redis(config[_0xc13c('0x9')]));require(_0xc13c('0xd'))['register'](socket);function respondWithRpcPromise(_0x494d38,_0x514064,_0x294739){return new BPromise(function(_0x201daf,_0x3a895e){return client[_0xc13c('0xe')](_0x494d38,_0x294739)[_0xc13c('0xf')](function(_0x4d16f7){logger[_0xc13c('0x10')]('ChatQueue,\x20%s,\x20%s',_0x514064,_0xc13c('0x11'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x514064,_0xc13c('0x11'),JSON[_0xc13c('0x12')](_0x4d16f7));if(_0x4d16f7[_0xc13c('0x13')]){if(_0x4d16f7[_0xc13c('0x13')][_0xc13c('0x14')]===0x1f4){logger[_0xc13c('0x13')](_0xc13c('0x15'),_0x514064,_0x4d16f7[_0xc13c('0x13')][_0xc13c('0x16')]);return _0x3a895e(_0x4d16f7[_0xc13c('0x13')]['message']);}logger[_0xc13c('0x13')](_0xc13c('0x15'),_0x514064,_0x4d16f7[_0xc13c('0x13')]['message']);return _0x201daf(_0x4d16f7[_0xc13c('0x13')][_0xc13c('0x16')]);}else{logger[_0xc13c('0x10')](_0xc13c('0x15'),_0x514064,_0xc13c('0x11'));_0x201daf(_0x4d16f7[_0xc13c('0x17')][_0xc13c('0x16')]);}})[_0xc13c('0x18')](function(_0x535808){logger[_0xc13c('0x13')](_0xc13c('0x15'),_0x514064,_0x535808);_0x3a895e(_0x535808);});});}exports[_0xc13c('0x19')]=function(_0x59f32c){var _0x455bda=this;return new Promise(function(_0xe1deaf,_0x52bc34){return db['ChatQueue'][_0xc13c('0x1a')]({'raw':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c['options'][_0xc13c('0x1c')]===undefined?!![]:![]:!![],'where':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c[_0xc13c('0x1b')][_0xc13c('0x1d')]||null:null,'attributes':_0x59f32c['options']?_0x59f32c['options'][_0xc13c('0x1e')]||null:null,'limit':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c[_0xc13c('0x1b')][_0xc13c('0x1f')]||null:null,'include':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c[_0xc13c('0x1b')][_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x59f32c[_0xc13c('0x1b')]['include'],function(_0x4abf16){return{'model':db[_0x4abf16[_0xc13c('0x22')]],'as':_0x4abf16['as'],'attributes':_0x4abf16[_0xc13c('0x1e')],'include':_0x4abf16[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x4abf16[_0xc13c('0x20')],function(_0x2a1b98){return{'model':db[_0x2a1b98[_0xc13c('0x22')]],'as':_0x2a1b98['as'],'attributes':_0x2a1b98[_0xc13c('0x1e')],'include':_0x2a1b98[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x2a1b98[_0xc13c('0x20')],function(_0x1b005a){return{'model':db[_0x1b005a['model']],'as':_0x1b005a['as'],'attributes':_0x1b005a[_0xc13c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc13c('0xf')](function(_0x1997f3){logger[_0xc13c('0x10')](_0xc13c('0x19'),_0x59f32c);logger['debug'](_0xc13c('0x19'),_0x59f32c,JSON[_0xc13c('0x12')](_0x1997f3));_0xe1deaf(_0x1997f3);})[_0xc13c('0x18')](function(_0x5b0c18){logger[_0xc13c('0x13')]('GetChatQueue',_0x5b0c18['message'],_0x59f32c);_0x52bc34(_0x455bda[_0xc13c('0x13')](0x1f4,_0x5b0c18[_0xc13c('0x16')]));});});};exports[_0xc13c('0x23')]=function(_0x153f04){var _0x544448=this;return new Promise(function(_0x1a44c4,_0x3958ec){return db['ChatQueue'][_0xc13c('0x24')]({'raw':_0x153f04[_0xc13c('0x1b')]?_0x153f04[_0xc13c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x153f04[_0xc13c('0x1b')]?_0x153f04[_0xc13c('0x1b')][_0xc13c('0x1d')]||null:null,'attributes':_0x153f04['options']?_0x153f04[_0xc13c('0x1b')][_0xc13c('0x1e')]||null:null,'include':_0x153f04['options']?_0x153f04[_0xc13c('0x1b')][_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x153f04[_0xc13c('0x1b')][_0xc13c('0x20')],function(_0x3552b1){return{'model':db[_0x3552b1[_0xc13c('0x22')]],'as':_0x3552b1['as'],'attributes':_0x3552b1[_0xc13c('0x1e')],'include':_0x3552b1[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x3552b1[_0xc13c('0x20')],function(_0x54a9ed){return{'model':db[_0x54a9ed[_0xc13c('0x22')]],'as':_0x54a9ed['as'],'attributes':_0x54a9ed[_0xc13c('0x1e')],'include':_0x54a9ed[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x54a9ed['include'],function(_0x11f9b9){return{'model':db[_0x11f9b9[_0xc13c('0x22')]],'as':_0x11f9b9['as'],'attributes':_0x11f9b9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bb516){logger['info'](_0xc13c('0x23'),_0x153f04);logger[_0xc13c('0x25')]('ShowChatQueue',_0x153f04,JSON[_0xc13c('0x12')](_0x4bb516));_0x1a44c4(_0x4bb516);})[_0xc13c('0x18')](function(_0xf35739){logger[_0xc13c('0x13')]('ShowChatQueue',_0xf35739['message'],_0x153f04);_0x3958ec(_0x544448[_0xc13c('0x13')](0x1f4,_0xf35739['message']));});});}; \ No newline at end of file +var _0xa81d=['include','map','model','GetChatQueue','ShowChatQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','where','attributes'];(function(_0xf8c877,_0x149b7c){var _0x31c063=function(_0x5e089f){while(--_0x5e089f){_0xf8c877['push'](_0xf8c877['shift']());}};_0x31c063(++_0x149b7c);}(_0xa81d,0x11e));var _0xda81=function(_0x382f44,_0x3a1b12){_0x382f44=_0x382f44-0x0;var _0x2fe454=_0xa81d[_0x382f44];return _0x2fe454;};'use strict';var _=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var moment=require('moment');var BPromise=require(_0xda81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda81('0x3'));var db=require(_0xda81('0x4'))['db'];var utils=require(_0xda81('0x5'));var logger=require(_0xda81('0x6'))(_0xda81('0x7'));var config=require(_0xda81('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xda81('0x9')]({'port':0x232a});config['redis']=_[_0xda81('0xa')](config[_0xda81('0xb')],{'host':_0xda81('0xc'),'port':0x18eb});var socket=require(_0xda81('0xd'))(new Redis(config[_0xda81('0xb')]));require(_0xda81('0xe'))['register'](socket);function respondWithRpcPromise(_0x4db7f3,_0xd1bd2a,_0x5af9c5){return new BPromise(function(_0xb545b5,_0x21afe9){return client[_0xda81('0xf')](_0x4db7f3,_0x5af9c5)[_0xda81('0x10')](function(_0x420c67){logger[_0xda81('0x11')](_0xda81('0x12'),_0xd1bd2a,_0xda81('0x13'));logger[_0xda81('0x14')](_0xda81('0x15'),_0xd1bd2a,'request\x20sent',JSON[_0xda81('0x16')](_0x420c67));if(_0x420c67[_0xda81('0x17')]){if(_0x420c67['error'][_0xda81('0x18')]===0x1f4){logger['error'](_0xda81('0x12'),_0xd1bd2a,_0x420c67['error'][_0xda81('0x19')]);return _0x21afe9(_0x420c67[_0xda81('0x17')][_0xda81('0x19')]);}logger[_0xda81('0x17')](_0xda81('0x12'),_0xd1bd2a,_0x420c67[_0xda81('0x17')]['message']);return _0xb545b5(_0x420c67[_0xda81('0x17')][_0xda81('0x19')]);}else{logger[_0xda81('0x11')](_0xda81('0x12'),_0xd1bd2a,_0xda81('0x13'));_0xb545b5(_0x420c67[_0xda81('0x1a')][_0xda81('0x19')]);}})[_0xda81('0x1b')](function(_0x415465){logger[_0xda81('0x17')](_0xda81('0x12'),_0xd1bd2a,_0x415465);_0x21afe9(_0x415465);});});}exports['GetChatQueue']=function(_0x186539){var _0x50b080=this;return new Promise(function(_0x291b6d,_0x2353bd){return db[_0xda81('0x1c')][_0xda81('0x1d')]({'raw':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x1f')]===undefined?!![]:![]:!![],'where':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x20')]||null:null,'attributes':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x21')]||null:null,'limit':_0x186539[_0xda81('0x1e')]?_0x186539['options']['limit']||null:null,'include':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x22')]?_[_0xda81('0x23')](_0x186539[_0xda81('0x1e')]['include'],function(_0x2caa71){return{'model':db[_0x2caa71[_0xda81('0x24')]],'as':_0x2caa71['as'],'attributes':_0x2caa71[_0xda81('0x21')],'include':_0x2caa71[_0xda81('0x22')]?_[_0xda81('0x23')](_0x2caa71[_0xda81('0x22')],function(_0x3e8a14){return{'model':db[_0x3e8a14[_0xda81('0x24')]],'as':_0x3e8a14['as'],'attributes':_0x3e8a14[_0xda81('0x21')],'include':_0x3e8a14[_0xda81('0x22')]?_[_0xda81('0x23')](_0x3e8a14['include'],function(_0x3948af){return{'model':db[_0x3948af[_0xda81('0x24')]],'as':_0x3948af['as'],'attributes':_0x3948af[_0xda81('0x21')]};}):[]};}):[]};}):[]:[]})[_0xda81('0x10')](function(_0x3d2e9b){logger[_0xda81('0x11')](_0xda81('0x25'),_0x186539);logger[_0xda81('0x14')](_0xda81('0x25'),_0x186539,JSON[_0xda81('0x16')](_0x3d2e9b));_0x291b6d(_0x3d2e9b);})[_0xda81('0x1b')](function(_0x3337f6){logger[_0xda81('0x17')](_0xda81('0x25'),_0x3337f6['message'],_0x186539);_0x2353bd(_0x50b080[_0xda81('0x17')](0x1f4,_0x3337f6[_0xda81('0x19')]));});});};exports[_0xda81('0x26')]=function(_0x5d939b){var _0x39d43f=this;return new Promise(function(_0x23edc3,_0x3d656c){return db[_0xda81('0x1c')][_0xda81('0x27')]({'raw':_0x5d939b[_0xda81('0x1e')]?_0x5d939b[_0xda81('0x1e')][_0xda81('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d939b['options']?_0x5d939b[_0xda81('0x1e')][_0xda81('0x20')]||null:null,'attributes':_0x5d939b['options']?_0x5d939b['options'][_0xda81('0x21')]||null:null,'include':_0x5d939b['options']?_0x5d939b[_0xda81('0x1e')][_0xda81('0x22')]?_[_0xda81('0x23')](_0x5d939b[_0xda81('0x1e')][_0xda81('0x22')],function(_0x58d4e3){return{'model':db[_0x58d4e3[_0xda81('0x24')]],'as':_0x58d4e3['as'],'attributes':_0x58d4e3[_0xda81('0x21')],'include':_0x58d4e3['include']?_['map'](_0x58d4e3[_0xda81('0x22')],function(_0x46b8b3){return{'model':db[_0x46b8b3[_0xda81('0x24')]],'as':_0x46b8b3['as'],'attributes':_0x46b8b3[_0xda81('0x21')],'include':_0x46b8b3[_0xda81('0x22')]?_[_0xda81('0x23')](_0x46b8b3['include'],function(_0x5acdeb){return{'model':db[_0x5acdeb[_0xda81('0x24')]],'as':_0x5acdeb['as'],'attributes':_0x5acdeb['attributes']};}):[]};}):[]};}):[]:[]})[_0xda81('0x10')](function(_0x3c8648){logger['info'](_0xda81('0x26'),_0x5d939b);logger['debug'](_0xda81('0x26'),_0x5d939b,JSON[_0xda81('0x16')](_0x3c8648));_0x23edc3(_0x3c8648);})[_0xda81('0x1b')](function(_0x1b9090){logger[_0xda81('0x17')](_0xda81('0x26'),_0x1b9090['message'],_0x5d939b);_0x3d656c(_0x39d43f[_0xda81('0x17')](0x1f4,_0x1b9090[_0xda81('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index cc0e3ed..3aa7c0c 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 _0x032e=['removeListener','register','length','chatQueue:','./chatQueue.events','remove','update','emit'];(function(_0x4daa52,_0x3ccbdb){var _0x3bb2f8=function(_0x5d682c){while(--_0x5d682c){_0x4daa52['push'](_0x4daa52['shift']());}};_0x3bb2f8(++_0x3ccbdb);}(_0x032e,0x124));var _0xe032=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x032e[_0x4243a3];return _0x1b2a33;};'use strict';var ChatQueueEvents=require(_0xe032('0x0'));var events=['save',_0xe032('0x1'),_0xe032('0x2')];function createListener(_0x5ca562,_0x4afba2){return function(_0x45ab5b){_0x4afba2[_0xe032('0x3')](_0x5ca562,_0x45ab5b);};}function removeListener(_0x2f44f6,_0x1983cc){return function(){ChatQueueEvents[_0xe032('0x4')](_0x2f44f6,_0x1983cc);};}exports[_0xe032('0x5')]=function(_0x2ba8a0){for(var _0x33ad0b=0x0,_0x37432f=events[_0xe032('0x6')];_0x33ad0b<_0x37432f;_0x33ad0b++){var _0x3289b0=events[_0x33ad0b];var _0xd84027=createListener(_0xe032('0x7')+_0x3289b0,_0x2ba8a0);ChatQueueEvents['on'](_0x3289b0,_0xd84027);}}; \ No newline at end of file +var _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x72b1,0x16e));var _0x172b=function(_0x29fe42,_0x5d2482){_0x29fe42=_0x29fe42-0x0;var _0xd286f7=_0x72b1[_0x29fe42];return _0xd286f7;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6c2845a..5323254 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x224f2b,_0x190c30){var _0x3124eb=function(_0x21f417){while(--_0x21f417){_0x224f2b['push'](_0x224f2b['shift']());}};_0x3124eb(++_0x190c30);}(_0x008c,0x188));var _0xc008=function(_0x3e95a8,_0xa7af87){_0x3e95a8=_0x3e95a8-0x0;var _0x1d8724=_0x008c[_0x3e95a8];return _0x1d8724;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x4f4157,_0x27aa4c){var _0x23a1b1=function(_0x24212f){while(--_0x24212f){_0x4f4157['push'](_0x4f4157['shift']());}};_0x23a1b1(++_0x27aa4c);}(_0x55ca,0x126));var _0xa55c=function(_0x50ce0c,_0x541b68){_0x50ce0c=_0x50ce0c-0x0;var _0x3c988c=_0x55ca[_0x50ce0c];return _0x3c988c;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 369cc83..a32b919 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 _0x1aa7=['DATE','STRING','moment','exports'];(function(_0x4a17e1,_0x3ef8cc){var _0x481f55=function(_0x4825f5){while(--_0x4825f5){_0x4a17e1['push'](_0x4a17e1['shift']());}};_0x481f55(++_0x3ef8cc);}(_0x1aa7,0x172));var _0x71aa=function(_0x47630e,_0x1faa32){_0x47630e=_0x47630e-0x0;var _0xcee537=_0x1aa7[_0x47630e];return _0xcee537;};'use strict';var moment=require(_0x71aa('0x0'));var Sequelize=require('sequelize');module[_0x71aa('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x71aa('0x2')]},'leaveAt':{'type':Sequelize[_0x71aa('0x2')]},'acceptAt':{'type':Sequelize[_0x71aa('0x2')]},'exitAt':{'type':Sequelize[_0x71aa('0x2')]},'reason':{'type':Sequelize[_0x71aa('0x3')]}}; \ No newline at end of file +var _0x37b4=['moment','sequelize','exports','STRING','DATE'];(function(_0x5af32b,_0x518fde){var _0x4e59b1=function(_0x3c5d2a){while(--_0x3c5d2a){_0x5af32b['push'](_0x5af32b['shift']());}};_0x4e59b1(++_0x518fde);}(_0x37b4,0x16d));var _0x437b=function(_0x319a03,_0x4456d4){_0x319a03=_0x319a03-0x0;var _0x3b6704=_0x37b4[_0x319a03];return _0x3b6704;};'use strict';var moment=require(_0x437b('0x0'));var Sequelize=require(_0x437b('0x1'));module[_0x437b('0x2')]={'uniqueid':{'type':Sequelize[_0x437b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x437b('0x3')]},'joinAt':{'type':Sequelize[_0x437b('0x4')]},'leaveAt':{'type':Sequelize[_0x437b('0x4')]},'acceptAt':{'type':Sequelize[_0x437b('0x4')]},'exitAt':{'type':Sequelize[_0x437b('0x4')]},'reason':{'type':Sequelize[_0x437b('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index cc13dfb..9ce3f72 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 _0xe558=['stack','name','send','index','ChatQueueReport','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0x3d1f09,_0x2ee8a3){var _0x11af6b=function(_0x37c0be){while(--_0x37c0be){_0x3d1f09['push'](_0x3d1f09['shift']());}};_0x11af6b(++_0x2ee8a3);}(_0xe558,0x70));var _0x8e55=function(_0x46da61,_0x4b812c){_0x46da61=_0x46da61-0x0;var _0x3a0412=_0xe558[_0x46da61];return _0x3a0412;};'use strict';var emlformat=require(_0x8e55('0x0'));var rimraf=require(_0x8e55('0x1'));var zipdir=require(_0x8e55('0x2'));var jsonpatch=require(_0x8e55('0x3'));var rp=require(_0x8e55('0x4'));var moment=require(_0x8e55('0x5'));var BPromise=require(_0x8e55('0x6'));var Mustache=require(_0x8e55('0x7'));var util=require(_0x8e55('0x8'));var path=require('path');var sox=require(_0x8e55('0x9'));var csv=require(_0x8e55('0xa'));var ejs=require(_0x8e55('0xb'));var fs=require('fs');var fs_extra=require(_0x8e55('0xc'));var _=require(_0x8e55('0xd'));var squel=require(_0x8e55('0xe'));var crypto=require('crypto');var jsforce=require(_0x8e55('0xf'));var deskjs=require(_0x8e55('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8e55('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e55('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e55('0x13'))(_0x8e55('0x14'));var utils=require(_0x8e55('0x15'));var config=require(_0x8e55('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e55('0x17'))['db'];function respondWithStatusCode(_0x4fae32,_0x5a6519){_0x5a6519=_0x5a6519||0xcc;return function(_0x519409){if(_0x519409){return _0x4fae32[_0x8e55('0x18')](_0x5a6519);}return _0x4fae32['status'](_0x5a6519)[_0x8e55('0x19')]();};}function respondWithResult(_0x2a5545,_0x17f17e){_0x17f17e=_0x17f17e||0xc8;return function(_0x2b5a04){if(_0x2b5a04){return _0x2a5545[_0x8e55('0x1a')](_0x17f17e)[_0x8e55('0x1b')](_0x2b5a04);}};}function respondWithFilteredResult(_0x1abd80,_0x23c198){return function(_0x83b32e){if(_0x83b32e){var _0xb2e25e=typeof _0x23c198[_0x8e55('0x1c')]===_0x8e55('0x1d')&&typeof _0x23c198[_0x8e55('0x1e')]===_0x8e55('0x1d');var _0x411b79=_0x83b32e['count'];var _0xda8f1a=_0xb2e25e?0x0:_0x23c198[_0x8e55('0x1c')];var _0x2d69e8=_0xb2e25e?_0x83b32e[_0x8e55('0x1f')]:_0x23c198['offset']+_0x23c198[_0x8e55('0x1e')];var _0x148b4a;if(_0x2d69e8>=_0x411b79){_0x2d69e8=_0x411b79;_0x148b4a=0xc8;}else{_0x148b4a=0xce;}_0x1abd80[_0x8e55('0x1a')](_0x148b4a);return _0x1abd80[_0x8e55('0x20')](_0x8e55('0x21'),_0xda8f1a+'-'+_0x2d69e8+'/'+_0x411b79)[_0x8e55('0x1b')](_0x83b32e);}return null;};}function patchUpdates(_0x2b7e2e){return function(_0x25e8b0){try{jsonpatch['apply'](_0x25e8b0,_0x2b7e2e,!![]);}catch(_0x4d69bc){return BPromise[_0x8e55('0x22')](_0x4d69bc);}return _0x25e8b0[_0x8e55('0x23')]();};}function saveUpdates(_0x69d8a7,_0x50641d){return function(_0x42adae){if(_0x42adae){return _0x42adae[_0x8e55('0x24')](_0x69d8a7)[_0x8e55('0x25')](function(_0xa9484f){return _0xa9484f;});}return null;};}function removeEntity(_0x12816e,_0x25a8f3){return function(_0x493308){if(_0x493308){return _0x493308[_0x8e55('0x26')]()[_0x8e55('0x25')](function(){_0x12816e['status'](0xcc)[_0x8e55('0x19')]();});}};}function handleEntityNotFound(_0x3f6fd8,_0x166148){return function(_0x2fe96d){if(!_0x2fe96d){_0x3f6fd8[_0x8e55('0x18')](0x194);}return _0x2fe96d;};}function handleError(_0x187f59,_0x2cf9dd){_0x2cf9dd=_0x2cf9dd||0x1f4;return function(_0x3b5d0f){logger[_0x8e55('0x27')](_0x3b5d0f[_0x8e55('0x28')]);if(_0x3b5d0f[_0x8e55('0x29')]){delete _0x3b5d0f['name'];}_0x187f59[_0x8e55('0x1a')](_0x2cf9dd)[_0x8e55('0x2a')](_0x3b5d0f);};}exports[_0x8e55('0x2b')]=function(_0x2a8ccb,_0x583def){var _0x28d10a={},_0x4b96c9={},_0x41bd2f={'count':0x0,'rows':[]};var _0x6023ea=_['map'](db[_0x8e55('0x2c')][_0x8e55('0x2d')],function(_0x454635){return{'name':_0x454635['fieldName'],'type':_0x454635[_0x8e55('0x2e')][_0x8e55('0x2f')]};});_0x4b96c9[_0x8e55('0x30')]=_[_0x8e55('0x31')](_0x6023ea,_0x8e55('0x29'));_0x4b96c9[_0x8e55('0x32')]=_[_0x8e55('0x33')](_0x2a8ccb[_0x8e55('0x32')]);_0x4b96c9['filters']=_['intersection'](_0x4b96c9['model'],_0x4b96c9[_0x8e55('0x32')]);_0x28d10a[_0x8e55('0x34')]=_[_0x8e55('0x35')](_0x4b96c9['model'],qs[_0x8e55('0x36')](_0x2a8ccb['query']['fields']));_0x28d10a[_0x8e55('0x34')]=_0x28d10a[_0x8e55('0x34')]['length']?_0x28d10a[_0x8e55('0x34')]:_0x4b96c9[_0x8e55('0x30')];if(!_0x2a8ccb[_0x8e55('0x32')][_0x8e55('0x37')](_0x8e55('0x38'))){_0x28d10a['limit']=qs[_0x8e55('0x1e')](_0x2a8ccb[_0x8e55('0x32')][_0x8e55('0x1e')]);_0x28d10a[_0x8e55('0x1c')]=qs['offset'](_0x2a8ccb[_0x8e55('0x32')][_0x8e55('0x1c')]);}_0x28d10a[_0x8e55('0x39')]=qs['sort'](_0x2a8ccb[_0x8e55('0x32')][_0x8e55('0x3a')]);_0x28d10a[_0x8e55('0x3b')]=qs[_0x8e55('0x3c')](_[_0x8e55('0x3d')](_0x2a8ccb[_0x8e55('0x32')],_0x4b96c9['filters']),_0x6023ea);if(_0x2a8ccb[_0x8e55('0x32')][_0x8e55('0x3e')]){_0x28d10a[_0x8e55('0x3b')]=_[_0x8e55('0x3f')](_0x28d10a[_0x8e55('0x3b')],{'$or':_[_0x8e55('0x31')](_0x6023ea,function(_0x5bb5b1){if(_0x5bb5b1[_0x8e55('0x2e')]!==_0x8e55('0x40')){var _0x380997={};_0x380997[_0x5bb5b1[_0x8e55('0x29')]]={'$like':'%'+_0x2a8ccb[_0x8e55('0x32')][_0x8e55('0x3e')]+'%'};return _0x380997;}})});}_0x28d10a=_[_0x8e55('0x3f')]({},_0x28d10a,_0x2a8ccb['options']);var _0x4b7183={'where':_0x28d10a[_0x8e55('0x3b')]};return db[_0x8e55('0x2c')][_0x8e55('0x1f')](_0x4b7183)[_0x8e55('0x25')](function(_0x31f096){_0x41bd2f[_0x8e55('0x1f')]=_0x31f096;if(_0x2a8ccb['query'][_0x8e55('0x41')]){_0x28d10a[_0x8e55('0x42')]=[{'all':!![]}];}return db[_0x8e55('0x2c')][_0x8e55('0x43')](_0x28d10a);})[_0x8e55('0x25')](function(_0x508219){_0x41bd2f[_0x8e55('0x44')]=_0x508219;return _0x41bd2f;})['then'](respondWithFilteredResult(_0x583def,_0x28d10a))[_0x8e55('0x45')](handleError(_0x583def,null));};exports[_0x8e55('0x46')]=function(_0x5846e2,_0x1d47ab){var _0xa96fa9={'raw':!![],'where':{'id':_0x5846e2['params']['id']}},_0x57b688={};_0x57b688[_0x8e55('0x30')]=_[_0x8e55('0x33')](db[_0x8e55('0x2c')][_0x8e55('0x2d')]);_0x57b688[_0x8e55('0x32')]=_[_0x8e55('0x33')](_0x5846e2[_0x8e55('0x32')]);_0x57b688[_0x8e55('0x3c')]=_[_0x8e55('0x35')](_0x57b688[_0x8e55('0x30')],_0x57b688['query']);_0xa96fa9[_0x8e55('0x34')]=_[_0x8e55('0x35')](_0x57b688['model'],qs[_0x8e55('0x36')](_0x5846e2[_0x8e55('0x32')][_0x8e55('0x36')]));_0xa96fa9[_0x8e55('0x34')]=_0xa96fa9[_0x8e55('0x34')]['length']?_0xa96fa9['attributes']:_0x57b688[_0x8e55('0x30')];if(_0x5846e2[_0x8e55('0x32')][_0x8e55('0x41')]){_0xa96fa9['include']=[{'all':!![]}];}_0xa96fa9=_[_0x8e55('0x3f')]({},_0xa96fa9,_0x5846e2['options']);return db['ChatQueueReport'][_0x8e55('0x47')](_0xa96fa9)[_0x8e55('0x25')](handleEntityNotFound(_0x1d47ab,null))[_0x8e55('0x25')](respondWithResult(_0x1d47ab,null))[_0x8e55('0x45')](handleError(_0x1d47ab,null));};exports[_0x8e55('0x48')]=function(_0x1db072,_0x34fa48){return db[_0x8e55('0x2c')]['create'](_0x1db072[_0x8e55('0x49')],{})['then'](respondWithResult(_0x34fa48,0xc9))['catch'](handleError(_0x34fa48,null));};exports[_0x8e55('0x24')]=function(_0x3d9038,_0x415f75){if(_0x3d9038[_0x8e55('0x49')]['id']){delete _0x3d9038[_0x8e55('0x49')]['id'];}return db[_0x8e55('0x2c')][_0x8e55('0x47')]({'where':{'id':_0x3d9038[_0x8e55('0x4a')]['id']}})[_0x8e55('0x25')](handleEntityNotFound(_0x415f75,null))[_0x8e55('0x25')](saveUpdates(_0x3d9038[_0x8e55('0x49')],null))[_0x8e55('0x25')](respondWithResult(_0x415f75,null))[_0x8e55('0x45')](handleError(_0x415f75,null));};exports['destroy']=function(_0x49fab0,_0x35cf46){return db[_0x8e55('0x2c')][_0x8e55('0x47')]({'where':{'id':_0x49fab0['params']['id']}})[_0x8e55('0x25')](handleEntityNotFound(_0x35cf46,null))[_0x8e55('0x25')](removeEntity(_0x35cf46,null))[_0x8e55('0x45')](handleError(_0x35cf46,null));};exports[_0x8e55('0x4b')]=function(_0x36e180,_0x37b308){return db[_0x8e55('0x2c')][_0x8e55('0x4b')]()[_0x8e55('0x25')](respondWithResult(_0x37b308,null))['catch'](handleError(_0x37b308,null));}; \ No newline at end of file +var _0xd48e=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','error','name','index','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','ChatQueueReport','count','includeAll','include','rows','catch','show','params','keys','find'];(function(_0x564aa8,_0x4a5555){var _0x50a6ca=function(_0x319001){while(--_0x319001){_0x564aa8['push'](_0x564aa8['shift']());}};_0x50a6ca(++_0x4a5555);}(_0xd48e,0x93));var _0xed48=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xd48e[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed48('0x0'));var zipdir=require(_0xed48('0x1'));var jsonpatch=require(_0xed48('0x2'));var rp=require(_0xed48('0x3'));var moment=require(_0xed48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed48('0x5'));var util=require(_0xed48('0x6'));var path=require(_0xed48('0x7'));var sox=require('sox');var csv=require(_0xed48('0x8'));var ejs=require(_0xed48('0x9'));var fs=require('fs');var fs_extra=require(_0xed48('0xa'));var _=require('lodash');var squel=require(_0xed48('0xb'));var crypto=require(_0xed48('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed48('0xd'));var Papa=require(_0xed48('0xe'));var Redis=require(_0xed48('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed48('0x10'));var hardwareService=require(_0xed48('0x11'));var logger=require(_0xed48('0x12'))('api');var utils=require(_0xed48('0x13'));var config=require(_0xed48('0x14'));var licenseUtil=require(_0xed48('0x15'));var db=require(_0xed48('0x16'))['db'];function respondWithStatusCode(_0x7ee238,_0xaf4b6d){_0xaf4b6d=_0xaf4b6d||0xcc;return function(_0x30bb80){if(_0x30bb80){return _0x7ee238[_0xed48('0x17')](_0xaf4b6d);}return _0x7ee238[_0xed48('0x18')](_0xaf4b6d)[_0xed48('0x19')]();};}function respondWithResult(_0x408ce8,_0x24e67c){_0x24e67c=_0x24e67c||0xc8;return function(_0x429024){if(_0x429024){return _0x408ce8['status'](_0x24e67c)[_0xed48('0x1a')](_0x429024);}};}function respondWithFilteredResult(_0x4a0296,_0x3bf0b7){return function(_0x4d23d9){if(_0x4d23d9){var _0x4d896f=typeof _0x3bf0b7[_0xed48('0x1b')]===_0xed48('0x1c')&&typeof _0x3bf0b7[_0xed48('0x1d')]===_0xed48('0x1c');var _0x1d0d94=_0x4d23d9['count'];var _0x355224=_0x4d896f?0x0:_0x3bf0b7['offset'];var _0x10c4a8=_0x4d896f?_0x4d23d9['count']:_0x3bf0b7[_0xed48('0x1b')]+_0x3bf0b7[_0xed48('0x1d')];var _0x122bf1;if(_0x10c4a8>=_0x1d0d94){_0x10c4a8=_0x1d0d94;_0x122bf1=0xc8;}else{_0x122bf1=0xce;}_0x4a0296['status'](_0x122bf1);return _0x4a0296['set'](_0xed48('0x1e'),_0x355224+'-'+_0x10c4a8+'/'+_0x1d0d94)[_0xed48('0x1a')](_0x4d23d9);}return null;};}function patchUpdates(_0x225d0f){return function(_0x54288f){try{jsonpatch[_0xed48('0x1f')](_0x54288f,_0x225d0f,!![]);}catch(_0x35f451){return BPromise[_0xed48('0x20')](_0x35f451);}return _0x54288f['save']();};}function saveUpdates(_0x277efb,_0x1bda45){return function(_0x13cb25){if(_0x13cb25){return _0x13cb25[_0xed48('0x21')](_0x277efb)[_0xed48('0x22')](function(_0x17a39b){return _0x17a39b;});}return null;};}function removeEntity(_0x4a6d93,_0x2683e4){return function(_0x4b829b){if(_0x4b829b){return _0x4b829b[_0xed48('0x23')]()[_0xed48('0x22')](function(){_0x4a6d93[_0xed48('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b460f,_0x51f67f){return function(_0x350c3c){if(!_0x350c3c){_0x4b460f[_0xed48('0x17')](0x194);}return _0x350c3c;};}function handleError(_0x277ef8,_0x26bff5){_0x26bff5=_0x26bff5||0x1f4;return function(_0x28dbf6){logger[_0xed48('0x24')](_0x28dbf6['stack']);if(_0x28dbf6[_0xed48('0x25')]){delete _0x28dbf6[_0xed48('0x25')];}_0x277ef8[_0xed48('0x18')](_0x26bff5)['send'](_0x28dbf6);};}exports[_0xed48('0x26')]=function(_0x2352a4,_0x5c66e4){var _0x2baff3={},_0x5ed24d={},_0x52a315={'count':0x0,'rows':[]};var _0x391e46=_['map'](db['ChatQueueReport'][_0xed48('0x27')],function(_0x982fdd){return{'name':_0x982fdd[_0xed48('0x28')],'type':_0x982fdd['type'][_0xed48('0x29')]};});_0x5ed24d[_0xed48('0x2a')]=_[_0xed48('0x2b')](_0x391e46,_0xed48('0x25'));_0x5ed24d['query']=_['keys'](_0x2352a4[_0xed48('0x2c')]);_0x5ed24d['filters']=_[_0xed48('0x2d')](_0x5ed24d[_0xed48('0x2a')],_0x5ed24d[_0xed48('0x2c')]);_0x2baff3[_0xed48('0x2e')]=_['intersection'](_0x5ed24d['model'],qs[_0xed48('0x2f')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x2f')]));_0x2baff3[_0xed48('0x2e')]=_0x2baff3[_0xed48('0x2e')][_0xed48('0x30')]?_0x2baff3[_0xed48('0x2e')]:_0x5ed24d[_0xed48('0x2a')];if(!_0x2352a4[_0xed48('0x2c')][_0xed48('0x31')](_0xed48('0x32'))){_0x2baff3[_0xed48('0x1d')]=qs['limit'](_0x2352a4[_0xed48('0x2c')][_0xed48('0x1d')]);_0x2baff3[_0xed48('0x1b')]=qs[_0xed48('0x1b')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x1b')]);}_0x2baff3[_0xed48('0x33')]=qs[_0xed48('0x34')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x34')]);_0x2baff3['where']=qs[_0xed48('0x35')](_[_0xed48('0x36')](_0x2352a4[_0xed48('0x2c')],_0x5ed24d[_0xed48('0x35')]),_0x391e46);if(_0x2352a4['query'][_0xed48('0x37')]){_0x2baff3[_0xed48('0x38')]=_['merge'](_0x2baff3[_0xed48('0x38')],{'$or':_[_0xed48('0x2b')](_0x391e46,function(_0x104f65){if(_0x104f65['type']!=='VIRTUAL'){var _0x3281c2={};_0x3281c2[_0x104f65['name']]={'$like':'%'+_0x2352a4[_0xed48('0x2c')][_0xed48('0x37')]+'%'};return _0x3281c2;}})});}_0x2baff3=_[_0xed48('0x39')]({},_0x2baff3,_0x2352a4[_0xed48('0x3a')]);var _0x2a3bfc={'where':_0x2baff3[_0xed48('0x38')]};return db[_0xed48('0x3b')][_0xed48('0x3c')](_0x2a3bfc)[_0xed48('0x22')](function(_0x5b1b8c){_0x52a315[_0xed48('0x3c')]=_0x5b1b8c;if(_0x2352a4[_0xed48('0x2c')][_0xed48('0x3d')]){_0x2baff3[_0xed48('0x3e')]=[{'all':!![]}];}return db[_0xed48('0x3b')]['findAll'](_0x2baff3);})[_0xed48('0x22')](function(_0x1af81d){_0x52a315[_0xed48('0x3f')]=_0x1af81d;return _0x52a315;})[_0xed48('0x22')](respondWithFilteredResult(_0x5c66e4,_0x2baff3))[_0xed48('0x40')](handleError(_0x5c66e4,null));};exports[_0xed48('0x41')]=function(_0x13d84b,_0x1af430){var _0x1d4d1d={'raw':!![],'where':{'id':_0x13d84b[_0xed48('0x42')]['id']}},_0x28014f={};_0x28014f[_0xed48('0x2a')]=_[_0xed48('0x43')](db[_0xed48('0x3b')][_0xed48('0x27')]);_0x28014f[_0xed48('0x2c')]=_[_0xed48('0x43')](_0x13d84b[_0xed48('0x2c')]);_0x28014f['filters']=_[_0xed48('0x2d')](_0x28014f[_0xed48('0x2a')],_0x28014f[_0xed48('0x2c')]);_0x1d4d1d[_0xed48('0x2e')]=_[_0xed48('0x2d')](_0x28014f[_0xed48('0x2a')],qs['fields'](_0x13d84b[_0xed48('0x2c')]['fields']));_0x1d4d1d[_0xed48('0x2e')]=_0x1d4d1d[_0xed48('0x2e')]['length']?_0x1d4d1d['attributes']:_0x28014f[_0xed48('0x2a')];if(_0x13d84b['query'][_0xed48('0x3d')]){_0x1d4d1d['include']=[{'all':!![]}];}_0x1d4d1d=_['merge']({},_0x1d4d1d,_0x13d84b['options']);return db[_0xed48('0x3b')][_0xed48('0x44')](_0x1d4d1d)[_0xed48('0x22')](handleEntityNotFound(_0x1af430,null))[_0xed48('0x22')](respondWithResult(_0x1af430,null))[_0xed48('0x40')](handleError(_0x1af430,null));};exports[_0xed48('0x45')]=function(_0x5b02a0,_0x51d9d6){return db[_0xed48('0x3b')][_0xed48('0x45')](_0x5b02a0[_0xed48('0x46')],{})[_0xed48('0x22')](respondWithResult(_0x51d9d6,0xc9))[_0xed48('0x40')](handleError(_0x51d9d6,null));};exports[_0xed48('0x21')]=function(_0x505ef9,_0x25fee5){if(_0x505ef9['body']['id']){delete _0x505ef9['body']['id'];}return db['ChatQueueReport'][_0xed48('0x44')]({'where':{'id':_0x505ef9[_0xed48('0x42')]['id']}})[_0xed48('0x22')](handleEntityNotFound(_0x25fee5,null))[_0xed48('0x22')](saveUpdates(_0x505ef9[_0xed48('0x46')],null))[_0xed48('0x22')](respondWithResult(_0x25fee5,null))[_0xed48('0x40')](handleError(_0x25fee5,null));};exports[_0xed48('0x23')]=function(_0x16b21e,_0x3d62a2){return db[_0xed48('0x3b')][_0xed48('0x44')]({'where':{'id':_0x16b21e['params']['id']}})[_0xed48('0x22')](handleEntityNotFound(_0x3d62a2,null))[_0xed48('0x22')](removeEntity(_0x3d62a2,null))[_0xed48('0x40')](handleError(_0x3d62a2,null));};exports[_0xed48('0x47')]=function(_0x1f30ec,_0x143920){return db[_0xed48('0x3b')][_0xed48('0x47')]()[_0xed48('0x22')](respondWithResult(_0x143920,null))[_0xed48('0x40')](handleError(_0x143920,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e724514..7a3ac95 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1d1f18,_0x40ad29){var _0x36d78b=function(_0xf49bdc){while(--_0xf49bdc){_0x1d1f18['push'](_0x1d1f18['shift']());}};_0x36d78b(++_0x40ad29);}(_0x757a,0xde));var _0xa757=function(_0x4f209d,_0xa832f6){_0x4f209d=_0x4f209d-0x0;var _0x48133a=_0x757a[_0x4f209d];return _0x48133a;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4077c1,_0x8e99bf){var _0x37a8f1=function(_0x2bf4aa){while(--_0x2bf4aa){_0x4077c1['push'](_0x4077c1['shift']());}};_0x37a8f1(++_0x8e99bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0xcb91[_0x204ad4];return _0x50675f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 57b19b5..c53855a 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 _0x5c22=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','then','UpdateChatQueueReport','update','raw','attributes'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x5c22,0x196));var _0x25c2=function(_0x1bc70c,_0x3421fd){_0x1bc70c=_0x1bc70c-0x0;var _0x111591=_0x5c22[_0x1bc70c];return _0x111591;};'use strict';var _=require(_0x25c2('0x0'));var util=require(_0x25c2('0x1'));var moment=require(_0x25c2('0x2'));var BPromise=require(_0x25c2('0x3'));var rs=require(_0x25c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25c2('0x5'))['db'];var utils=require(_0x25c2('0x6'));var logger=require('../../config/logger')(_0x25c2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25c2('0x8')][_0x25c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d8ba9,_0x4450a0,_0xa6809b){return new BPromise(function(_0x2aafe3,_0x2f1600){return client[_0x25c2('0xa')](_0x4d8ba9,_0xa6809b)['then'](function(_0x22f278){logger['info'](_0x25c2('0xb'),_0x4450a0,_0x25c2('0xc'));logger[_0x25c2('0xd')](_0x25c2('0xe'),_0x4450a0,'request\x20sent',JSON[_0x25c2('0xf')](_0x22f278));if(_0x22f278[_0x25c2('0x10')]){if(_0x22f278[_0x25c2('0x10')]['code']===0x1f4){logger['error'](_0x25c2('0xb'),_0x4450a0,_0x22f278[_0x25c2('0x10')][_0x25c2('0x11')]);return _0x2f1600(_0x22f278[_0x25c2('0x10')]['message']);}logger[_0x25c2('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x4450a0,_0x22f278[_0x25c2('0x10')][_0x25c2('0x11')]);return _0x2aafe3(_0x22f278[_0x25c2('0x10')][_0x25c2('0x11')]);}else{logger[_0x25c2('0x12')](_0x25c2('0xb'),_0x4450a0,_0x25c2('0xc'));_0x2aafe3(_0x22f278['result'][_0x25c2('0x11')]);}})[_0x25c2('0x13')](function(_0x536d5f){logger[_0x25c2('0x10')](_0x25c2('0xb'),_0x4450a0,_0x536d5f);_0x2f1600(_0x536d5f);});});}exports[_0x25c2('0x14')]=function(_0x1968aa){var _0x14cefb=this;return new Promise(function(_0xf6e32f,_0x532ca7){return db[_0x25c2('0x15')][_0x25c2('0x16')](_0x1968aa['body'],{'raw':_0x1968aa['options']?_0x1968aa[_0x25c2('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x25c2('0x18')](function(_0x52eabf){logger['info'](_0x25c2('0x14'),_0x1968aa);logger['debug'](_0x25c2('0x14'),_0x1968aa,JSON[_0x25c2('0xf')](_0x52eabf));_0xf6e32f(_0x52eabf);})[_0x25c2('0x13')](function(_0x5a5786){logger[_0x25c2('0x10')](_0x25c2('0x14'),_0x5a5786[_0x25c2('0x11')],_0x1968aa);_0x532ca7(_0x14cefb[_0x25c2('0x10')](0x1f4,_0x5a5786[_0x25c2('0x11')]));});});};exports[_0x25c2('0x19')]=function(_0x5cee8f){var _0x1d9649=this;return new Promise(function(_0x48868a,_0x17d89b){return db[_0x25c2('0x15')][_0x25c2('0x1a')](_0x5cee8f['body'],{'raw':_0x5cee8f[_0x25c2('0x17')]?_0x5cee8f[_0x25c2('0x17')][_0x25c2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cee8f[_0x25c2('0x17')]?_0x5cee8f['options']['where']||null:null,'attributes':_0x5cee8f['options']?_0x5cee8f[_0x25c2('0x17')][_0x25c2('0x1c')]||null:null,'limit':_0x5cee8f['options']?_0x5cee8f[_0x25c2('0x17')]['limit']||null:null})[_0x25c2('0x18')](function(_0x42c0ea){logger['info'](_0x25c2('0x19'),_0x5cee8f);logger[_0x25c2('0xd')](_0x25c2('0x19'),_0x5cee8f,JSON['stringify'](_0x42c0ea));_0x48868a(_0x42c0ea);})[_0x25c2('0x13')](function(_0xf77100){logger[_0x25c2('0x10')]('UpdateChatQueueReport',_0xf77100['message'],_0x5cee8f);_0x17d89b(_0x1d9649[_0x25c2('0x10')](0x1f4,_0xf77100[_0x25c2('0x11')]));});});}; \ No newline at end of file +var _0x31a3=['error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x5aa9a9,_0x5ac877){var _0x277581=function(_0x2d5f1d){while(--_0x2d5f1d){_0x5aa9a9['push'](_0x5aa9a9['shift']());}};_0x277581(++_0x5ac877);}(_0x31a3,0x183));var _0x331a=function(_0xb9c2da,_0x5e481a){_0xb9c2da=_0xb9c2da-0x0;var _0x195d1d=_0x31a3[_0xb9c2da];return _0x195d1d;};'use strict';var _=require(_0x331a('0x0'));var util=require(_0x331a('0x1'));var moment=require(_0x331a('0x2'));var BPromise=require(_0x331a('0x3'));var rs=require(_0x331a('0x4'));var fs=require('fs');var Redis=require(_0x331a('0x5'));var db=require(_0x331a('0x6'))['db'];var utils=require(_0x331a('0x7'));var logger=require(_0x331a('0x8'))(_0x331a('0x9'));var config=require(_0x331a('0xa'));var jayson=require(_0x331a('0xb'));var client=jayson[_0x331a('0xc')][_0x331a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x435bbd,_0x27a66f,_0x30de49){return new BPromise(function(_0x300633,_0x51aad5){return client['request'](_0x435bbd,_0x30de49)[_0x331a('0xe')](function(_0x27b061){logger[_0x331a('0xf')](_0x331a('0x10'),_0x27a66f,_0x331a('0x11'));logger[_0x331a('0x12')](_0x331a('0x13'),_0x27a66f,_0x331a('0x11'),JSON['stringify'](_0x27b061));if(_0x27b061[_0x331a('0x14')]){if(_0x27b061[_0x331a('0x14')][_0x331a('0x15')]===0x1f4){logger[_0x331a('0x14')](_0x331a('0x10'),_0x27a66f,_0x27b061[_0x331a('0x14')][_0x331a('0x16')]);return _0x51aad5(_0x27b061[_0x331a('0x14')][_0x331a('0x16')]);}logger[_0x331a('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x27a66f,_0x27b061[_0x331a('0x14')][_0x331a('0x16')]);return _0x300633(_0x27b061['error'][_0x331a('0x16')]);}else{logger['info'](_0x331a('0x10'),_0x27a66f,_0x331a('0x11'));_0x300633(_0x27b061[_0x331a('0x17')][_0x331a('0x16')]);}})[_0x331a('0x18')](function(_0x56e04e){logger[_0x331a('0x14')](_0x331a('0x10'),_0x27a66f,_0x56e04e);_0x51aad5(_0x56e04e);});});}exports[_0x331a('0x19')]=function(_0x12e44f){var _0x50c44d=this;return new Promise(function(_0x471e66,_0x3d134c){return db[_0x331a('0x1a')][_0x331a('0x1b')](_0x12e44f[_0x331a('0x1c')],{'raw':_0x12e44f['options']?_0x12e44f[_0x331a('0x1d')][_0x331a('0x1e')]===undefined?!![]:![]:!![]})[_0x331a('0xe')](function(_0x1a60ce){logger[_0x331a('0xf')](_0x331a('0x19'),_0x12e44f);logger[_0x331a('0x12')](_0x331a('0x19'),_0x12e44f,JSON[_0x331a('0x1f')](_0x1a60ce));_0x471e66(_0x1a60ce);})[_0x331a('0x18')](function(_0x194114){logger[_0x331a('0x14')](_0x331a('0x19'),_0x194114[_0x331a('0x16')],_0x12e44f);_0x3d134c(_0x50c44d[_0x331a('0x14')](0x1f4,_0x194114[_0x331a('0x16')]));});});};exports[_0x331a('0x20')]=function(_0x651d19){var _0x1714ab=this;return new Promise(function(_0x23a8de,_0xde0c39){return db[_0x331a('0x1a')][_0x331a('0x21')](_0x651d19[_0x331a('0x1c')],{'raw':_0x651d19[_0x331a('0x1d')]?_0x651d19[_0x331a('0x1d')][_0x331a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x651d19[_0x331a('0x1d')]?_0x651d19[_0x331a('0x1d')][_0x331a('0x22')]||null:null,'attributes':_0x651d19['options']?_0x651d19[_0x331a('0x1d')][_0x331a('0x23')]||null:null,'limit':_0x651d19[_0x331a('0x1d')]?_0x651d19[_0x331a('0x1d')][_0x331a('0x24')]||null:null})[_0x331a('0xe')](function(_0x53869f){logger[_0x331a('0xf')](_0x331a('0x20'),_0x651d19);logger[_0x331a('0x12')](_0x331a('0x20'),_0x651d19,JSON[_0x331a('0x1f')](_0x53869f));_0x23a8de(_0x53869f);})[_0x331a('0x18')](function(_0x1e3a84){logger['error'](_0x331a('0x20'),_0x1e3a84[_0x331a('0x16')],_0x651d19);_0xde0c39(_0x1714ab['error'](0x1f4,_0x1e3a84[_0x331a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 82a56dd..ba3f7a8 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 _0xf887=['../../components/interaction/service','../../config/environment','get','index','/describe','/:id','isAuthenticated','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra'];(function(_0x540157,_0x41a0a3){var _0x4e70dc=function(_0x37b6d5){while(--_0x37b6d5){_0x540157['push'](_0x540157['shift']());}};_0x4e70dc(++_0x41a0a3);}(_0xf887,0x10c));var _0x7f88=function(_0x192793,_0x32900d){_0x192793=_0x192793-0x0;var _0x46fee6=_0xf887[_0x192793];return _0x46fee6;};'use strict';var multer=require('multer');var util=require(_0x7f88('0x0'));var path=require('path');var timeout=require(_0x7f88('0x1'));var express=require('express');var router=express[_0x7f88('0x2')]();var fs_extra=require(_0x7f88('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7f88('0x4'));var config=require(_0x7f88('0x5'));var controller=require('./chatQueueReport.controller');router[_0x7f88('0x6')]('/',auth['isAuthenticated'](),controller[_0x7f88('0x7')]);router[_0x7f88('0x6')](_0x7f88('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7f88('0x9'),auth[_0x7f88('0xa')](),controller['show']);router[_0x7f88('0xb')]('/',auth[_0x7f88('0xa')](),controller[_0x7f88('0xc')]);router[_0x7f88('0xd')](_0x7f88('0x9'),auth[_0x7f88('0xa')](),controller[_0x7f88('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7f88('0xf')]);module[_0x7f88('0x10')]=router; \ No newline at end of file +var _0x18ac=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x245cbf,_0x4ff281){var _0x1f3c4b=function(_0x29b237){while(--_0x29b237){_0x245cbf['push'](_0x245cbf['shift']());}};_0x1f3c4b(++_0x4ff281);}(_0x18ac,0xa3));var _0xc18a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x18ac[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xc18a('0x0'));var util=require(_0xc18a('0x1'));var path=require(_0xc18a('0x2'));var timeout=require(_0xc18a('0x3'));var express=require(_0xc18a('0x4'));var router=express[_0xc18a('0x5')]();var fs_extra=require(_0xc18a('0x6'));var auth=require(_0xc18a('0x7'));var interaction=require(_0xc18a('0x8'));var config=require(_0xc18a('0x9'));var controller=require('./chatQueueReport.controller');router[_0xc18a('0xa')]('/',auth[_0xc18a('0xb')](),controller[_0xc18a('0xc')]);router[_0xc18a('0xa')](_0xc18a('0xd'),auth['isAuthenticated'](),controller[_0xc18a('0xe')]);router[_0xc18a('0xa')](_0xc18a('0xf'),auth[_0xc18a('0xb')](),controller['show']);router[_0xc18a('0x10')]('/',auth[_0xc18a('0xb')](),controller['create']);router[_0xc18a('0x11')](_0xc18a('0xf'),auth['isAuthenticated'](),controller[_0xc18a('0x12')]);router[_0xc18a('0x13')](_0xc18a('0xf'),auth['isAuthenticated'](),controller[_0xc18a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b4dcbed..ae16080 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x920ae3,_0x4652ef){var _0x19ea79=function(_0x4ce49f){while(--_0x4ce49f){_0x920ae3['push'](_0x920ae3['shift']());}};_0x19ea79(++_0x4652ef);}(_0x34e8,0x12c));var _0x834e=function(_0x2f7115,_0x1e00a8){_0x2f7115=_0x2f7115-0x0;var _0x59395d=_0x34e8[_0x2f7115];return _0x59395d;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x1812a0,_0x10afb1){var _0x52783a=function(_0x49d34e){while(--_0x49d34e){_0x1812a0['push'](_0x1812a0['shift']());}};_0x52783a(++_0x10afb1);}(_0xe706,0xa3));var _0x6e70=function(_0x40c402,_0x42ee7d){_0x40c402=_0x40c402-0x0;var _0x4e7680=_0xe706[_0x40c402];return _0x4e7680;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7df1d22..7ce8566 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 _0x55ea=['catch','params','rawAttributes','attributes','fields','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows'];(function(_0x13cdd0,_0x3a3ca7){var _0x2fcc49=function(_0x4682f1){while(--_0x4682f1){_0x13cdd0['push'](_0x13cdd0['shift']());}};_0x2fcc49(++_0x3a3ca7);}(_0x55ea,0xe2));var _0xa55e=function(_0x574fb0,_0x2e899e){_0x574fb0=_0x574fb0-0x0;var _0x10cef1=_0x55ea[_0x574fb0];return _0x10cef1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa55e('0x0'));var zipdir=require(_0xa55e('0x1'));var jsonpatch=require(_0xa55e('0x2'));var rp=require('request-promise');var moment=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var Mustache=require(_0xa55e('0x5'));var util=require(_0xa55e('0x6'));var path=require(_0xa55e('0x7'));var sox=require(_0xa55e('0x8'));var csv=require(_0xa55e('0x9'));var ejs=require(_0xa55e('0xa'));var fs=require('fs');var fs_extra=require(_0xa55e('0xb'));var _=require(_0xa55e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa55e('0xd'));var deskjs=require(_0xa55e('0xe'));var toCsv=require(_0xa55e('0x9'));var querystring=require(_0xa55e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa55e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa55e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa55e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c3bee,_0x56b7a6){_0x56b7a6=_0x56b7a6||0xcc;return function(_0x267ea7){if(_0x267ea7){return _0x1c3bee['sendStatus'](_0x56b7a6);}return _0x1c3bee[_0xa55e('0x14')](_0x56b7a6)[_0xa55e('0x15')]();};}function respondWithResult(_0x134961,_0x569d4b){_0x569d4b=_0x569d4b||0xc8;return function(_0x300a44){if(_0x300a44){return _0x134961[_0xa55e('0x14')](_0x569d4b)[_0xa55e('0x16')](_0x300a44);}};}function respondWithFilteredResult(_0x312032,_0xa12196){return function(_0x437c68){if(_0x437c68){var _0x5dc245=typeof _0xa12196[_0xa55e('0x17')]===_0xa55e('0x18')&&typeof _0xa12196[_0xa55e('0x19')]===_0xa55e('0x18');var _0x23d8c4=_0x437c68[_0xa55e('0x1a')];var _0x335e3e=_0x5dc245?0x0:_0xa12196[_0xa55e('0x17')];var _0x2e1cbd=_0x5dc245?_0x437c68[_0xa55e('0x1a')]:_0xa12196['offset']+_0xa12196['limit'];var _0x2e3f7a;if(_0x2e1cbd>=_0x23d8c4){_0x2e1cbd=_0x23d8c4;_0x2e3f7a=0xc8;}else{_0x2e3f7a=0xce;}_0x312032[_0xa55e('0x14')](_0x2e3f7a);return _0x312032[_0xa55e('0x1b')]('Content-Range',_0x335e3e+'-'+_0x2e1cbd+'/'+_0x23d8c4)[_0xa55e('0x16')](_0x437c68);}return null;};}function patchUpdates(_0x3d821c){return function(_0x2ca8b4){try{jsonpatch[_0xa55e('0x1c')](_0x2ca8b4,_0x3d821c,!![]);}catch(_0x2b1164){return BPromise['reject'](_0x2b1164);}return _0x2ca8b4[_0xa55e('0x1d')]();};}function saveUpdates(_0x7b29db,_0x300092){return function(_0x58c2ec){if(_0x58c2ec){return _0x58c2ec[_0xa55e('0x1e')](_0x7b29db)[_0xa55e('0x1f')](function(_0x503d4d){return _0x503d4d;});}return null;};}function removeEntity(_0x3a8130,_0x3e35e2){return function(_0x553808){if(_0x553808){return _0x553808[_0xa55e('0x20')]()[_0xa55e('0x1f')](function(){_0x3a8130[_0xa55e('0x14')](0xcc)[_0xa55e('0x15')]();});}};}function handleEntityNotFound(_0x8b4154,_0xd973df){return function(_0x2b326d){if(!_0x2b326d){_0x8b4154[_0xa55e('0x21')](0x194);}return _0x2b326d;};}function handleError(_0x505ec3,_0x5be330){_0x5be330=_0x5be330||0x1f4;return function(_0x503908){logger[_0xa55e('0x22')](_0x503908[_0xa55e('0x23')]);if(_0x503908[_0xa55e('0x24')]){delete _0x503908['name'];}_0x505ec3[_0xa55e('0x14')](_0x5be330)[_0xa55e('0x25')](_0x503908);};}exports[_0xa55e('0x26')]=function(_0x18cde2,_0x2dc325){var _0x2cc8c9={},_0x3b574e={},_0x3f6bbb={'count':0x0,'rows':[]};var _0x3898a6=_[_0xa55e('0x27')](db[_0xa55e('0x28')]['rawAttributes'],function(_0x2d3c17){return{'name':_0x2d3c17[_0xa55e('0x29')],'type':_0x2d3c17[_0xa55e('0x2a')][_0xa55e('0x2b')]};});_0x3b574e[_0xa55e('0x2c')]=_[_0xa55e('0x27')](_0x3898a6,'name');_0x3b574e[_0xa55e('0x2d')]=_[_0xa55e('0x2e')](_0x18cde2[_0xa55e('0x2d')]);_0x3b574e[_0xa55e('0x2f')]=_[_0xa55e('0x30')](_0x3b574e['model'],_0x3b574e['query']);_0x2cc8c9['attributes']=_['intersection'](_0x3b574e['model'],qs['fields'](_0x18cde2['query']['fields']));_0x2cc8c9['attributes']=_0x2cc8c9['attributes'][_0xa55e('0x31')]?_0x2cc8c9['attributes']:_0x3b574e[_0xa55e('0x2c')];if(!_0x18cde2['query'][_0xa55e('0x32')](_0xa55e('0x33'))){_0x2cc8c9[_0xa55e('0x19')]=qs[_0xa55e('0x19')](_0x18cde2[_0xa55e('0x2d')][_0xa55e('0x19')]);_0x2cc8c9[_0xa55e('0x17')]=qs[_0xa55e('0x17')](_0x18cde2['query'][_0xa55e('0x17')]);}_0x2cc8c9[_0xa55e('0x34')]=qs[_0xa55e('0x35')](_0x18cde2[_0xa55e('0x2d')]['sort']);_0x2cc8c9[_0xa55e('0x36')]=qs['filters'](_[_0xa55e('0x37')](_0x18cde2[_0xa55e('0x2d')],_0x3b574e[_0xa55e('0x2f')]),_0x3898a6);if(_0x18cde2[_0xa55e('0x2d')][_0xa55e('0x38')]){_0x2cc8c9['where']=_[_0xa55e('0x39')](_0x2cc8c9['where'],{'$or':_[_0xa55e('0x27')](_0x3898a6,function(_0x52abec){if(_0x52abec[_0xa55e('0x2a')]!==_0xa55e('0x3a')){var _0x5ab877={};_0x5ab877[_0x52abec[_0xa55e('0x24')]]={'$like':'%'+_0x18cde2[_0xa55e('0x2d')][_0xa55e('0x38')]+'%'};return _0x5ab877;}})});}_0x2cc8c9=_[_0xa55e('0x39')]({},_0x2cc8c9,_0x18cde2[_0xa55e('0x3b')]);var _0x11db91={'where':_0x2cc8c9[_0xa55e('0x36')]};return db[_0xa55e('0x28')]['count'](_0x11db91)[_0xa55e('0x1f')](function(_0x49e2ac){_0x3f6bbb[_0xa55e('0x1a')]=_0x49e2ac;if(_0x18cde2[_0xa55e('0x2d')]['includeAll']){_0x2cc8c9[_0xa55e('0x3c')]=[{'all':!![]}];}return db[_0xa55e('0x28')]['findAll'](_0x2cc8c9);})[_0xa55e('0x1f')](function(_0x5169dc){_0x3f6bbb[_0xa55e('0x3d')]=_0x5169dc;return _0x3f6bbb;})[_0xa55e('0x1f')](respondWithFilteredResult(_0x2dc325,_0x2cc8c9))[_0xa55e('0x3e')](handleError(_0x2dc325,null));};exports['show']=function(_0x4000b5,_0x228ae4){var _0x883030={'raw':!![],'where':{'id':_0x4000b5[_0xa55e('0x3f')]['id']}},_0x12d35b={};_0x12d35b[_0xa55e('0x2c')]=_[_0xa55e('0x2e')](db[_0xa55e('0x28')][_0xa55e('0x40')]);_0x12d35b[_0xa55e('0x2d')]=_['keys'](_0x4000b5[_0xa55e('0x2d')]);_0x12d35b[_0xa55e('0x2f')]=_[_0xa55e('0x30')](_0x12d35b['model'],_0x12d35b['query']);_0x883030[_0xa55e('0x41')]=_[_0xa55e('0x30')](_0x12d35b['model'],qs[_0xa55e('0x42')](_0x4000b5[_0xa55e('0x2d')][_0xa55e('0x42')]));_0x883030[_0xa55e('0x41')]=_0x883030[_0xa55e('0x41')]['length']?_0x883030[_0xa55e('0x41')]:_0x12d35b[_0xa55e('0x2c')];if(_0x4000b5[_0xa55e('0x2d')][_0xa55e('0x43')]){_0x883030[_0xa55e('0x3c')]=[{'all':!![]}];}_0x883030=_['merge']({},_0x883030,_0x4000b5[_0xa55e('0x3b')]);return db['ChatTransferReport'][_0xa55e('0x44')](_0x883030)[_0xa55e('0x1f')](handleEntityNotFound(_0x228ae4,null))[_0xa55e('0x1f')](respondWithResult(_0x228ae4,null))[_0xa55e('0x3e')](handleError(_0x228ae4,null));};exports[_0xa55e('0x45')]=function(_0x1155a9,_0x1b3c94){return db[_0xa55e('0x28')][_0xa55e('0x45')](_0x1155a9[_0xa55e('0x46')],{})[_0xa55e('0x1f')](respondWithResult(_0x1b3c94,0xc9))[_0xa55e('0x3e')](handleError(_0x1b3c94,null));};exports[_0xa55e('0x1e')]=function(_0xf321a8,_0x2e0fd8){if(_0xf321a8[_0xa55e('0x46')]['id']){delete _0xf321a8[_0xa55e('0x46')]['id'];}return db[_0xa55e('0x28')][_0xa55e('0x44')]({'where':{'id':_0xf321a8[_0xa55e('0x3f')]['id']}})[_0xa55e('0x1f')](handleEntityNotFound(_0x2e0fd8,null))[_0xa55e('0x1f')](saveUpdates(_0xf321a8[_0xa55e('0x46')],null))[_0xa55e('0x1f')](respondWithResult(_0x2e0fd8,null))[_0xa55e('0x3e')](handleError(_0x2e0fd8,null));};exports[_0xa55e('0x20')]=function(_0x39520f,_0x2ba2eb){return db[_0xa55e('0x28')]['find']({'where':{'id':_0x39520f[_0xa55e('0x3f')]['id']}})[_0xa55e('0x1f')](handleEntityNotFound(_0x2ba2eb,null))[_0xa55e('0x1f')](removeEntity(_0x2ba2eb,null))[_0xa55e('0x3e')](handleError(_0x2ba2eb,null));};exports[_0xa55e('0x47')]=function(_0x4d8ff0,_0x20e410){return db[_0xa55e('0x28')][_0xa55e('0x47')]()[_0xa55e('0x1f')](respondWithResult(_0x20e410,null))[_0xa55e('0x3e')](handleError(_0x20e410,null));}; \ No newline at end of file +var _0xe741=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x22816e,_0x4651e){var _0x86babe=function(_0x47cd1c){while(--_0x47cd1c){_0x22816e['push'](_0x22816e['shift']());}};_0x86babe(++_0x4651e);}(_0xe741,0x7c));var _0x1e74=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xe741[_0x26462c];return _0x509a42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e74('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e74('0x1'));var rp=require(_0x1e74('0x2'));var moment=require(_0x1e74('0x3'));var BPromise=require(_0x1e74('0x4'));var Mustache=require(_0x1e74('0x5'));var util=require(_0x1e74('0x6'));var path=require(_0x1e74('0x7'));var sox=require('sox');var csv=require(_0x1e74('0x8'));var ejs=require(_0x1e74('0x9'));var fs=require('fs');var fs_extra=require(_0x1e74('0xa'));var _=require(_0x1e74('0xb'));var squel=require('squel');var crypto=require(_0x1e74('0xc'));var jsforce=require(_0x1e74('0xd'));var deskjs=require(_0x1e74('0xe'));var toCsv=require(_0x1e74('0x8'));var querystring=require(_0x1e74('0xf'));var Papa=require('papaparse');var Redis=require(_0x1e74('0x10'));var authService=require(_0x1e74('0x11'));var qs=require(_0x1e74('0x12'));var as=require(_0x1e74('0x13'));var hardwareService=require(_0x1e74('0x14'));var logger=require('../../config/logger')(_0x1e74('0x15'));var utils=require('../../config/utils');var config=require(_0x1e74('0x16'));var licenseUtil=require(_0x1e74('0x17'));var db=require(_0x1e74('0x18'))['db'];function respondWithStatusCode(_0x121aa2,_0x4a7ad3){_0x4a7ad3=_0x4a7ad3||0xcc;return function(_0x329490){if(_0x329490){return _0x121aa2[_0x1e74('0x19')](_0x4a7ad3);}return _0x121aa2[_0x1e74('0x1a')](_0x4a7ad3)[_0x1e74('0x1b')]();};}function respondWithResult(_0x1b8031,_0x86733f){_0x86733f=_0x86733f||0xc8;return function(_0x465fc6){if(_0x465fc6){return _0x1b8031[_0x1e74('0x1a')](_0x86733f)[_0x1e74('0x1c')](_0x465fc6);}};}function respondWithFilteredResult(_0x300b05,_0x35f983){return function(_0x360aab){if(_0x360aab){var _0x55daf6=typeof _0x35f983['offset']==='undefined'&&typeof _0x35f983[_0x1e74('0x1d')]===_0x1e74('0x1e');var _0x5e264e=_0x360aab[_0x1e74('0x1f')];var _0x3872a0=_0x55daf6?0x0:_0x35f983[_0x1e74('0x20')];var _0x131091=_0x55daf6?_0x360aab[_0x1e74('0x1f')]:_0x35f983['offset']+_0x35f983[_0x1e74('0x1d')];var _0x14e403;if(_0x131091>=_0x5e264e){_0x131091=_0x5e264e;_0x14e403=0xc8;}else{_0x14e403=0xce;}_0x300b05[_0x1e74('0x1a')](_0x14e403);return _0x300b05['set']('Content-Range',_0x3872a0+'-'+_0x131091+'/'+_0x5e264e)['json'](_0x360aab);}return null;};}function patchUpdates(_0x50f19a){return function(_0x2ebabf){try{jsonpatch[_0x1e74('0x21')](_0x2ebabf,_0x50f19a,!![]);}catch(_0x4dbc18){return BPromise[_0x1e74('0x22')](_0x4dbc18);}return _0x2ebabf['save']();};}function saveUpdates(_0x11bafa,_0x11c4c8){return function(_0x1813cc){if(_0x1813cc){return _0x1813cc[_0x1e74('0x23')](_0x11bafa)[_0x1e74('0x24')](function(_0x33c8c3){return _0x33c8c3;});}return null;};}function removeEntity(_0x294e97,_0x20d086){return function(_0x2cecdc){if(_0x2cecdc){return _0x2cecdc[_0x1e74('0x25')]()[_0x1e74('0x24')](function(){_0x294e97[_0x1e74('0x1a')](0xcc)[_0x1e74('0x1b')]();});}};}function handleEntityNotFound(_0x585afa,_0x300258){return function(_0x49bd26){if(!_0x49bd26){_0x585afa['sendStatus'](0x194);}return _0x49bd26;};}function handleError(_0x2b1692,_0x56c4b4){_0x56c4b4=_0x56c4b4||0x1f4;return function(_0x278b2c){logger[_0x1e74('0x26')](_0x278b2c[_0x1e74('0x27')]);if(_0x278b2c[_0x1e74('0x28')]){delete _0x278b2c[_0x1e74('0x28')];}_0x2b1692[_0x1e74('0x1a')](_0x56c4b4)[_0x1e74('0x29')](_0x278b2c);};}exports[_0x1e74('0x2a')]=function(_0x47213e,_0x2b20b2){var _0x200e1a={},_0x2c6f4b={},_0x32da80={'count':0x0,'rows':[]};var _0x2d7381=_[_0x1e74('0x2b')](db[_0x1e74('0x2c')]['rawAttributes'],function(_0x59d415){return{'name':_0x59d415['fieldName'],'type':_0x59d415[_0x1e74('0x2d')][_0x1e74('0x2e')]};});_0x2c6f4b[_0x1e74('0x2f')]=_[_0x1e74('0x2b')](_0x2d7381,_0x1e74('0x28'));_0x2c6f4b['query']=_[_0x1e74('0x30')](_0x47213e[_0x1e74('0x31')]);_0x2c6f4b[_0x1e74('0x32')]=_[_0x1e74('0x33')](_0x2c6f4b['model'],_0x2c6f4b['query']);_0x200e1a[_0x1e74('0x34')]=_[_0x1e74('0x33')](_0x2c6f4b[_0x1e74('0x2f')],qs[_0x1e74('0x35')](_0x47213e[_0x1e74('0x31')][_0x1e74('0x35')]));_0x200e1a[_0x1e74('0x34')]=_0x200e1a[_0x1e74('0x34')][_0x1e74('0x36')]?_0x200e1a['attributes']:_0x2c6f4b[_0x1e74('0x2f')];if(!_0x47213e[_0x1e74('0x31')][_0x1e74('0x37')]('nolimit')){_0x200e1a[_0x1e74('0x1d')]=qs[_0x1e74('0x1d')](_0x47213e[_0x1e74('0x31')][_0x1e74('0x1d')]);_0x200e1a['offset']=qs[_0x1e74('0x20')](_0x47213e[_0x1e74('0x31')][_0x1e74('0x20')]);}_0x200e1a[_0x1e74('0x38')]=qs[_0x1e74('0x39')](_0x47213e[_0x1e74('0x31')]['sort']);_0x200e1a[_0x1e74('0x3a')]=qs[_0x1e74('0x32')](_[_0x1e74('0x3b')](_0x47213e[_0x1e74('0x31')],_0x2c6f4b[_0x1e74('0x32')]),_0x2d7381);if(_0x47213e[_0x1e74('0x31')]['filter']){_0x200e1a[_0x1e74('0x3a')]=_[_0x1e74('0x3c')](_0x200e1a['where'],{'$or':_[_0x1e74('0x2b')](_0x2d7381,function(_0x4a4d1d){if(_0x4a4d1d[_0x1e74('0x2d')]!==_0x1e74('0x3d')){var _0x3bfb3e={};_0x3bfb3e[_0x4a4d1d[_0x1e74('0x28')]]={'$like':'%'+_0x47213e[_0x1e74('0x31')]['filter']+'%'};return _0x3bfb3e;}})});}_0x200e1a=_[_0x1e74('0x3c')]({},_0x200e1a,_0x47213e['options']);var _0x5afa22={'where':_0x200e1a['where']};return db['ChatTransferReport'][_0x1e74('0x1f')](_0x5afa22)[_0x1e74('0x24')](function(_0x44ce35){_0x32da80['count']=_0x44ce35;if(_0x47213e[_0x1e74('0x31')][_0x1e74('0x3e')]){_0x200e1a[_0x1e74('0x3f')]=[{'all':!![]}];}return db[_0x1e74('0x2c')][_0x1e74('0x40')](_0x200e1a);})[_0x1e74('0x24')](function(_0x43a84c){_0x32da80[_0x1e74('0x41')]=_0x43a84c;return _0x32da80;})[_0x1e74('0x24')](respondWithFilteredResult(_0x2b20b2,_0x200e1a))[_0x1e74('0x42')](handleError(_0x2b20b2,null));};exports['show']=function(_0x4f7b7b,_0x59d190){var _0x536812={'raw':!![],'where':{'id':_0x4f7b7b[_0x1e74('0x43')]['id']}},_0x5775d0={};_0x5775d0[_0x1e74('0x2f')]=_[_0x1e74('0x30')](db[_0x1e74('0x2c')]['rawAttributes']);_0x5775d0[_0x1e74('0x31')]=_[_0x1e74('0x30')](_0x4f7b7b[_0x1e74('0x31')]);_0x5775d0['filters']=_[_0x1e74('0x33')](_0x5775d0[_0x1e74('0x2f')],_0x5775d0[_0x1e74('0x31')]);_0x536812[_0x1e74('0x34')]=_[_0x1e74('0x33')](_0x5775d0[_0x1e74('0x2f')],qs[_0x1e74('0x35')](_0x4f7b7b['query'][_0x1e74('0x35')]));_0x536812['attributes']=_0x536812[_0x1e74('0x34')]['length']?_0x536812[_0x1e74('0x34')]:_0x5775d0[_0x1e74('0x2f')];if(_0x4f7b7b[_0x1e74('0x31')][_0x1e74('0x3e')]){_0x536812[_0x1e74('0x3f')]=[{'all':!![]}];}_0x536812=_['merge']({},_0x536812,_0x4f7b7b['options']);return db[_0x1e74('0x2c')]['find'](_0x536812)[_0x1e74('0x24')](handleEntityNotFound(_0x59d190,null))[_0x1e74('0x24')](respondWithResult(_0x59d190,null))['catch'](handleError(_0x59d190,null));};exports[_0x1e74('0x44')]=function(_0x2ee30a,_0x4d3a11){return db[_0x1e74('0x2c')][_0x1e74('0x44')](_0x2ee30a[_0x1e74('0x45')],{})[_0x1e74('0x24')](respondWithResult(_0x4d3a11,0xc9))[_0x1e74('0x42')](handleError(_0x4d3a11,null));};exports['update']=function(_0x1feedd,_0x2d6a87){if(_0x1feedd[_0x1e74('0x45')]['id']){delete _0x1feedd[_0x1e74('0x45')]['id'];}return db[_0x1e74('0x2c')][_0x1e74('0x46')]({'where':{'id':_0x1feedd[_0x1e74('0x43')]['id']}})[_0x1e74('0x24')](handleEntityNotFound(_0x2d6a87,null))['then'](saveUpdates(_0x1feedd[_0x1e74('0x45')],null))[_0x1e74('0x24')](respondWithResult(_0x2d6a87,null))[_0x1e74('0x42')](handleError(_0x2d6a87,null));};exports[_0x1e74('0x25')]=function(_0x286c32,_0x4aa5f4){return db[_0x1e74('0x2c')]['find']({'where':{'id':_0x286c32[_0x1e74('0x43')]['id']}})[_0x1e74('0x24')](handleEntityNotFound(_0x4aa5f4,null))['then'](removeEntity(_0x4aa5f4,null))[_0x1e74('0x42')](handleError(_0x4aa5f4,null));};exports['describe']=function(_0x3996c8,_0x2d7dca){return db['ChatTransferReport'][_0x1e74('0x47')]()[_0x1e74('0x24')](respondWithResult(_0x2d7dca,null))[_0x1e74('0x42')](handleError(_0x2d7dca,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f16ca50..d7f305e 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 _0x7d0a=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatTransferReport','report_chat_transfer'];(function(_0x25c069,_0x26f281){var _0x21d15d=function(_0x311f0f){while(--_0x311f0f){_0x25c069['push'](_0x25c069['shift']());}};_0x21d15d(++_0x26f281);}(_0x7d0a,0x175));var _0xa7d0=function(_0xbdf091,_0x35a06c){_0xbdf091=_0xbdf091-0x0;var _0x129fd5=_0x7d0a[_0xbdf091];return _0x129fd5;};'use strict';var _=require('lodash');var util=require(_0xa7d0('0x0'));var logger=require(_0xa7d0('0x1'))(_0xa7d0('0x2'));var moment=require(_0xa7d0('0x3'));var BPromise=require(_0xa7d0('0x4'));var rp=require(_0xa7d0('0x5'));var fs=require('fs');var path=require(_0xa7d0('0x6'));var rimraf=require(_0xa7d0('0x7'));var config=require(_0xa7d0('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0xc67996,_0x57a4b5){return _0xc67996['define'](_0xa7d0('0x9'),attributes,{'tableName':_0xa7d0('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa7d0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdc9=['../../config/environment','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','path'];(function(_0x188dbb,_0x1d7d93){var _0x5d6e30=function(_0x4748e2){while(--_0x4748e2){_0x188dbb['push'](_0x188dbb['shift']());}};_0x5d6e30(++_0x1d7d93);}(_0xcdc9,0x19f));var _0x9cdc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcdc9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x9cdc('0x0'));var util=require(_0x9cdc('0x1'));var logger=require(_0x9cdc('0x2'))('api');var moment=require(_0x9cdc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cdc('0x4'));var rimraf=require('rimraf');var config=require(_0x9cdc('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0x9cdc('0x6')]=function(_0x57a088,_0x2331d8){return _0x57a088[_0x9cdc('0x7')]('ChatTransferReport',attributes,{'tableName':_0x9cdc('0x8'),'paranoid':![],'indexes':[{'name':_0x9cdc('0x9'),'fields':[_0x9cdc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 1f52c55..a85cfe6 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 _0x9ee9=['ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x4bdd63,_0x4aa65f){var _0x1b95e0=function(_0x765891){while(--_0x765891){_0x4bdd63['push'](_0x4bdd63['shift']());}};_0x1b95e0(++_0x4aa65f);}(_0x9ee9,0xcc));var _0x99ee=function(_0x3e7a8e,_0x124c3d){_0x3e7a8e=_0x3e7a8e-0x0;var _0x39552d=_0x9ee9[_0x3e7a8e];return _0x39552d;};'use strict';var _=require(_0x99ee('0x0'));var util=require(_0x99ee('0x1'));var moment=require('moment');var BPromise=require(_0x99ee('0x2'));var rs=require(_0x99ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x99ee('0x5'))(_0x99ee('0x6'));var config=require(_0x99ee('0x7'));var jayson=require(_0x99ee('0x8'));var client=jayson['client'][_0x99ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50dff8,_0x21fb65,_0x5c8329){return new BPromise(function(_0x24d2c7,_0x204158){return client['request'](_0x50dff8,_0x5c8329)['then'](function(_0x13bedd){logger[_0x99ee('0xa')](_0x99ee('0xb'),_0x21fb65,'request\x20sent');logger['debug'](_0x99ee('0xc'),_0x21fb65,_0x99ee('0xd'),JSON[_0x99ee('0xe')](_0x13bedd));if(_0x13bedd[_0x99ee('0xf')]){if(_0x13bedd[_0x99ee('0xf')]['code']===0x1f4){logger[_0x99ee('0xf')](_0x99ee('0xb'),_0x21fb65,_0x13bedd[_0x99ee('0xf')][_0x99ee('0x10')]);return _0x204158(_0x13bedd['error'][_0x99ee('0x10')]);}logger[_0x99ee('0xf')](_0x99ee('0xb'),_0x21fb65,_0x13bedd[_0x99ee('0xf')]['message']);return _0x24d2c7(_0x13bedd[_0x99ee('0xf')]['message']);}else{logger[_0x99ee('0xa')](_0x99ee('0xb'),_0x21fb65,_0x99ee('0xd'));_0x24d2c7(_0x13bedd['result'][_0x99ee('0x10')]);}})[_0x99ee('0x11')](function(_0x3d4919){logger['error'](_0x99ee('0xb'),_0x21fb65,_0x3d4919);_0x204158(_0x3d4919);});});} \ No newline at end of file +var _0x4e3b=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4cf8ff,_0x48eafe){var _0x13fa12=function(_0x270923){while(--_0x270923){_0x4cf8ff['push'](_0x4cf8ff['shift']());}};_0x13fa12(++_0x48eafe);}(_0x4e3b,0x15c));var _0xb4e3=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x4e3b[_0x29632e];return _0x426e04;};'use strict';var _=require(_0xb4e3('0x0'));var util=require(_0xb4e3('0x1'));var moment=require(_0xb4e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb4e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4e3('0x4'))['db'];var utils=require(_0xb4e3('0x5'));var logger=require('../../config/logger')(_0xb4e3('0x6'));var config=require(_0xb4e3('0x7'));var jayson=require(_0xb4e3('0x8'));var client=jayson['client'][_0xb4e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16ee9a,_0x25cd72,_0x5e91df){return new BPromise(function(_0x4dd862,_0x48d9b3){return client[_0xb4e3('0xa')](_0x16ee9a,_0x5e91df)[_0xb4e3('0xb')](function(_0x3784bb){logger[_0xb4e3('0xc')](_0xb4e3('0xd'),_0x25cd72,_0xb4e3('0xe'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x25cd72,'request\x20sent',JSON[_0xb4e3('0xf')](_0x3784bb));if(_0x3784bb[_0xb4e3('0x10')]){if(_0x3784bb[_0xb4e3('0x10')]['code']===0x1f4){logger[_0xb4e3('0x10')](_0xb4e3('0xd'),_0x25cd72,_0x3784bb['error']['message']);return _0x48d9b3(_0x3784bb[_0xb4e3('0x10')][_0xb4e3('0x11')]);}logger[_0xb4e3('0x10')](_0xb4e3('0xd'),_0x25cd72,_0x3784bb[_0xb4e3('0x10')][_0xb4e3('0x11')]);return _0x4dd862(_0x3784bb['error'][_0xb4e3('0x11')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x25cd72,'request\x20sent');_0x4dd862(_0x3784bb[_0xb4e3('0x12')][_0xb4e3('0x11')]);}})[_0xb4e3('0x13')](function(_0x464628){logger[_0xb4e3('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x25cd72,_0x464628);_0x48d9b3(_0x464628);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index cfc9dd8..4fcb91e 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 _0x2832=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','exports','multer','util'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x2832,0x82));var _0x2283=function(_0x3c9798,_0x2866ef){_0x3c9798=_0x3c9798-0x0;var _0x375415=_0x2832[_0x3c9798];return _0x375415;};'use strict';var multer=require(_0x2283('0x0'));var util=require(_0x2283('0x1'));var path=require(_0x2283('0x2'));var timeout=require(_0x2283('0x3'));var express=require(_0x2283('0x4'));var router=express[_0x2283('0x5')]();var fs_extra=require(_0x2283('0x6'));var auth=require(_0x2283('0x7'));var interaction=require(_0x2283('0x8'));var config=require(_0x2283('0x9'));var controller=require(_0x2283('0xa'));router[_0x2283('0xb')]('/',auth[_0x2283('0xc')](),controller[_0x2283('0xd')]);router[_0x2283('0xb')](_0x2283('0xe'),auth[_0x2283('0xc')](),controller[_0x2283('0xf')]);router[_0x2283('0xb')](_0x2283('0x10'),auth[_0x2283('0xc')](),controller['show']);router[_0x2283('0x11')]('/',auth[_0x2283('0xc')](),controller[_0x2283('0x12')]);router[_0x2283('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2283('0x14')]);router['delete'](_0x2283('0x10'),auth[_0x2283('0xc')](),controller['destroy']);module[_0x2283('0x15')]=router; \ No newline at end of file +var _0xd0be=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','delete','destroy'];(function(_0x572bc3,_0xc1b9e1){var _0x1d6401=function(_0x5bfb49){while(--_0x5bfb49){_0x572bc3['push'](_0x572bc3['shift']());}};_0x1d6401(++_0xc1b9e1);}(_0xd0be,0x155));var _0xed0b=function(_0x164d16,_0x2f39a9){_0x164d16=_0x164d16-0x0;var _0x2cff6b=_0xd0be[_0x164d16];return _0x2cff6b;};'use strict';var multer=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var path=require(_0xed0b('0x2'));var timeout=require(_0xed0b('0x3'));var express=require(_0xed0b('0x4'));var router=express[_0xed0b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xed0b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed0b('0x7'));var controller=require(_0xed0b('0x8'));router[_0xed0b('0x9')]('/',auth['isAuthenticated'](),controller[_0xed0b('0xa')]);router[_0xed0b('0x9')]('/describe',auth[_0xed0b('0xb')](),controller[_0xed0b('0xc')]);router['get'](_0xed0b('0xd'),auth[_0xed0b('0xb')](),controller[_0xed0b('0xe')]);router[_0xed0b('0xf')]('/',auth[_0xed0b('0xb')](),controller['create']);router['put'](_0xed0b('0xd'),auth[_0xed0b('0xb')](),controller[_0xed0b('0x10')]);router[_0xed0b('0x11')](_0xed0b('0xd'),auth['isAuthenticated'](),controller[_0xed0b('0x12')]);module[_0xed0b('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index dd1fa90..589e130 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 _0xf43d=['STRING','address','email','#011F6A','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xf43d,0x166));var _0xdf43=function(_0x5e91b4,_0x54bd36){_0x5e91b4=_0x5e91b4-0x0;var _0xdf243=_0xf43d[_0x5e91b4];return _0xdf243;};'use strict';var Sequelize=require(_0xdf43('0x0'));var rs=require(_0xdf43('0x1'));module['exports']={'name':{'type':Sequelize[_0xdf43('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xdf43('0x2')],'allowNull':![],'unique':_0xdf43('0x3')},'description':{'type':Sequelize[_0xdf43('0x2')]},'mapKey':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xdf43('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdf43('0x2')],'allowNull':![],'defaultValue':_0xdf43('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdf43('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdf43('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdf43('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdf43('0x6')](_0xdf43('0x7'),'squared'),'defaultValue':_0xdf43('0x7')},'header_online':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x8')},'start_chat_button':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x9')},'offline_chat_button':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0xa')},'header_offline':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0xb')},'download_transcript':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdf43('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdf43('0xe')]},'closingQuestion':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x11')},'noteTitle':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x12')},'closingMessage':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0xa')},'skipMessageButton':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x13')},'ratingType':{'type':Sequelize['ENUM'](_0xdf43('0x14'),_0xdf43('0x15')),'defaultValue':_0xdf43('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdf43('0xe')],'defaultValue':function(){return JSON[_0xdf43('0x16')]({'items':[{'type':_0xdf43('0x17'),'variable':null,'config':{'placeholder':_0xdf43('0x18'),'type':'text','required':!![]},'props':{'title':_0xdf43('0x18'),'helpText':''}},{'type':'input','props':{'title':_0xdf43('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xdf43('0x4'),'type':_0xdf43('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdf43('0x19')](_0xdf43('0x1a'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x29dcdb){return this[_0xdf43('0x1b')](_0xdf43('0x1a'),JSON[_0xdf43('0x16')](_0x29dcdb));}},'offlineForm':{'type':Sequelize[_0xdf43('0xe')],'defaultValue':function(){return JSON[_0xdf43('0x16')]({'items':[{'type':_0xdf43('0x17'),'props':{'title':_0xdf43('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xdf43('0x1c'),'helpText':_0xdf43('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0xdf43('0x19')](_0xdf43('0x1e'))?JSON[_0xdf43('0x1f')](this[_0xdf43('0x19')](_0xdf43('0x1e'))):{};},'set':function(_0x42a68a){return this['setDataValue']('offlineForm',JSON['stringify'](_0x42a68a));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdf43('0x2')]},'forwardOffline':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdf43('0x2')]},'waitingTitle':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x20')},'waitingMessage':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x22')},'offlineMessageBody':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x24')},'skipUnmanaged':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x25')},'sendUnmanaged':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdf43('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdf43('0x2')]},'notificationTemplate':{'type':Sequelize[_0xdf43('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':_0xdf43('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0xdf43('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xdf43('0x27')},'defaultTitle':{'type':Sequelize[_0xdf43('0x2')]},'customerAvatar':{'type':Sequelize[_0xdf43('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdf43('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdf43('0x2')],'allowNull':![],'defaultValue':_0xdf43('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf43('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xdf43('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf43('0xd')],'comment':_0xdf43('0x29')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x13f356){if(!_0x13f356)this[_0xdf43('0x1b')]('mandatoryDispositionPauseId',null);this[_0xdf43('0x1b')](_0xdf43('0x2a'),_0x13f356);}},'vidaooEscalation':{'type':Sequelize[_0xdf43('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdf43('0x2b')},'vidaooNote':{'type':Sequelize[_0xdf43('0x2')],'defaultValue':function(){return _0xdf43('0x2c');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xdf43('0xe')]}}; \ No newline at end of file +var _0xf93e=['STRING','address','email','#011F6A','#ffffff','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','BOOLEAN','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','exports'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0xf93e,0x94));var _0xef93=function(_0xa58627,_0x55cd20){_0xa58627=_0xa58627-0x0;var _0x581f40=_0xf93e[_0xa58627];return _0x581f40;};'use strict';var Sequelize=require(_0xef93('0x0'));var rs=require('randomstring');module[_0xef93('0x1')]={'name':{'type':Sequelize[_0xef93('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xef93('0x2')],'allowNull':![],'unique':_0xef93('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0x4')},'mapKeyOffline':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x4')},'key':{'type':Sequelize[_0xef93('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xef93('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xef93('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xef93('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xef93('0x2')],'allowNull':![],'defaultValue':_0xef93('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xef93('0x2')],'allowNull':![],'defaultValue':_0xef93('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xef93('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xef93('0x7')]('rounded',_0xef93('0x8')),'defaultValue':_0xef93('0x9')},'header_online':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0xb')},'offline_chat_button':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xef93('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xef93('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0x14')},'placeholderMessage':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x15')},'closingMessage':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x16')},'closingMessageButton':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0xc')},'skipMessageButton':{'type':Sequelize[_0xef93('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x18')},'ratingType':{'type':Sequelize[_0xef93('0x7')](_0xef93('0x19'),_0xef93('0x1a')),'defaultValue':_0xef93('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xef93('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xef93('0x10')],'defaultValue':function(){return JSON[_0xef93('0x1b')]({'items':[{'type':_0xef93('0x1c'),'variable':null,'config':{'placeholder':_0xef93('0x1d'),'type':_0xef93('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xef93('0x1c'),'props':{'title':_0xef93('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xef93('0x4'),'type':_0xef93('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xef93('0x1f')](_0xef93('0x20'))?JSON[_0xef93('0x21')](this[_0xef93('0x1f')](_0xef93('0x20'))):{};},'set':function(_0x4f93fe){return this['setDataValue']('onlineForm',JSON[_0xef93('0x1b')](_0x4f93fe));}},'offlineForm':{'type':Sequelize[_0xef93('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xef93('0x1c'),'props':{'title':_0xef93('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xef93('0x4'),'type':_0xef93('0x4')},'variable':null},{'type':_0xef93('0x22'),'config':{'placeholder':_0xef93('0x23')},'props':{'title':'Comments','helpText':_0xef93('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xef93('0x1f')](_0xef93('0x25'))?JSON[_0xef93('0x21')](this['getDataValue']('offlineForm')):{};},'set':function(_0x549b5e){return this[_0xef93('0x26')](_0xef93('0x25'),JSON['stringify'](_0x549b5e));}},'token':{'type':Sequelize[_0xef93('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xef93('0x17')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xef93('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xef93('0x2')]},'waitingTitle':{'type':Sequelize[_0xef93('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0x28')},'offlineMessageBody':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xef93('0x17')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xef93('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xef93('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xef93('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xef93('0x2')]},'notificationTemplate':{'type':Sequelize[_0xef93('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xef93('0x17')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xef93('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xef93('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xef93('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xef93('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xef93('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xef93('0x2')],'defaultValue':_0xef93('0x2c')},'systemAvatar':{'type':Sequelize[_0xef93('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef93('0xe')],'comment':_0xef93('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xef93('0x2e'),'set':function(_0x29c470){if(!_0x29c470)this['setDataValue'](_0xef93('0x2f'),null);this[_0xef93('0x26')](_0xef93('0x30'),_0x29c470);}},'vidaooEscalation':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xef93('0x2')]},'vidaooTopic':{'type':Sequelize[_0xef93('0x2')],'allowNull':![],'defaultValue':_0xef93('0x31')},'vidaooNote':{'type':Sequelize[_0xef93('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xef93('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xef93('0x17')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xef93('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 23ee8c3..e6a038b 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 _0xb8ce=['describe','addDisposition','Disposition','findOne','nolimit','order','findAll','removeDispositions','getAnswers','ChatWebsiteId','CannedAnswer','removeAnswers','ids','addLogo','sitepic','filename','agentAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','orderBy','asc','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','contact','messageId','created','autoclose','push','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','originalname','attachments','openNewInteraction','transaction','Attachment','bulkCreate','Smtp','forwardOffline','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','server','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','indexOf','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','virtual','custom','License','increment','all','some','server/files/chat/iframe.ejs','connection','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','sequelize','ChatApplication','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xb8ce,0x1f2));var _0xeb8c=function(_0x3eebdd,_0x48b868){_0x3eebdd=_0x3eebdd-0x0;var _0x1fed01=_0xb8ce[_0x3eebdd];return _0x1fed01;};'use strict';var emlformat=require(_0xeb8c('0x0'));var rimraf=require(_0xeb8c('0x1'));var zipdir=require(_0xeb8c('0x2'));var jsonpatch=require(_0xeb8c('0x3'));var rp=require(_0xeb8c('0x4'));var moment=require(_0xeb8c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb8c('0x6'));var path=require(_0xeb8c('0x7'));var sox=require(_0xeb8c('0x8'));var csv=require('to-csv');var ejs=require(_0xeb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xeb8c('0xa'));var _=require(_0xeb8c('0xb'));var squel=require(_0xeb8c('0xc'));var crypto=require(_0xeb8c('0xd'));var jsforce=require(_0xeb8c('0xe'));var deskjs=require(_0xeb8c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeb8c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb8c('0x11'))(_0xeb8c('0x12'));var utils=require(_0xeb8c('0x13'));var config=require(_0xeb8c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb8c('0x15'))['db'];config[_0xeb8c('0x16')]=_[_0xeb8c('0x17')](config[_0xeb8c('0x16')],{'host':_0xeb8c('0x18'),'port':0x18eb});var socket=require(_0xeb8c('0x19'))(new Redis(config[_0xeb8c('0x16')]));require(_0xeb8c('0x1a'))[_0xeb8c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xeb8c('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xeb8c('0x1c')]['http']({'port':0x232a});var client9003=jayson[_0xeb8c('0x1c')][_0xeb8c('0x1d')]({'port':0x232b});var client9001=jayson[_0xeb8c('0x1c')][_0xeb8c('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x9813dd,_0xc1b661,_0x2d3d2c,_0x2abd2c){return new BPromise(function(_0x1c00ae,_0x20aef7){var _0x4cc7aa=_0x2abd2c||client;return _0x4cc7aa['request'](_0x9813dd,_0x2d3d2c)['then'](function(_0x3f71fb){logger['info'](_0xeb8c('0x1e'),_0xc1b661,_0xeb8c('0x1f'));logger['debug'](_0xeb8c('0x20'),_0xc1b661,_0xeb8c('0x1f'),JSON[_0xeb8c('0x21')](_0x3f71fb));if(_0x3f71fb[_0xeb8c('0x22')]){if(_0x3f71fb[_0xeb8c('0x22')][_0xeb8c('0x23')]===0x1f4){logger[_0xeb8c('0x22')](_0xeb8c('0x1e'),_0xc1b661,_0x3f71fb[_0xeb8c('0x22')]['message']);return _0x20aef7(_0x3f71fb[_0xeb8c('0x22')][_0xeb8c('0x24')]);}logger[_0xeb8c('0x22')](_0xeb8c('0x1e'),_0xc1b661,_0x3f71fb['error'][_0xeb8c('0x24')]);return _0x1c00ae(_0x3f71fb[_0xeb8c('0x22')]['message']);}else{logger[_0xeb8c('0x25')]('ChatWebsite,\x20%s,\x20%s',_0xc1b661,_0xeb8c('0x1f'));_0x1c00ae(_0x3f71fb[_0xeb8c('0x26')][_0xeb8c('0x24')]);}})[_0xeb8c('0x27')](function(_0x426f66){logger[_0xeb8c('0x22')]('ChatWebsite,\x20%s,\x20%s',_0xc1b661,_0x426f66);_0x20aef7(_0x426f66);});});}function respondWithStatusCode(_0x54082e,_0x3f7204){_0x3f7204=_0x3f7204||0xcc;return function(_0x560e8e){if(_0x560e8e){return _0x54082e[_0xeb8c('0x28')](_0x3f7204);}return _0x54082e[_0xeb8c('0x29')](_0x3f7204)['end']();};}function respondWithResult(_0x4567e3,_0x182488){_0x182488=_0x182488||0xc8;return function(_0x468879){if(_0x468879){return _0x4567e3[_0xeb8c('0x29')](_0x182488)[_0xeb8c('0x2a')](_0x468879);}};}function respondWithFilteredResult(_0x15af40,_0x76dbe6){return function(_0x3c2138){if(_0x3c2138){var _0x1499d3=typeof _0x76dbe6[_0xeb8c('0x2b')]===_0xeb8c('0x2c')&&typeof _0x76dbe6['limit']===_0xeb8c('0x2c');var _0x294b99=_0x3c2138['count'];var _0x273f21=_0x1499d3?0x0:_0x76dbe6[_0xeb8c('0x2b')];var _0x20c049=_0x1499d3?_0x3c2138[_0xeb8c('0x2d')]:_0x76dbe6['offset']+_0x76dbe6[_0xeb8c('0x2e')];var _0x35564e;if(_0x20c049>=_0x294b99){_0x20c049=_0x294b99;_0x35564e=0xc8;}else{_0x35564e=0xce;}_0x15af40[_0xeb8c('0x29')](_0x35564e);return _0x15af40[_0xeb8c('0x2f')](_0xeb8c('0x30'),_0x273f21+'-'+_0x20c049+'/'+_0x294b99)[_0xeb8c('0x2a')](_0x3c2138);}return null;};}function patchUpdates(_0x4ae656){return function(_0x38aa1c){try{jsonpatch[_0xeb8c('0x31')](_0x38aa1c,_0x4ae656,!![]);}catch(_0xca619){return BPromise[_0xeb8c('0x32')](_0xca619);}return _0x38aa1c[_0xeb8c('0x33')]();};}function saveUpdates(_0x480c7a,_0x314fff){return function(_0x3f37e2){if(_0x3f37e2){return _0x3f37e2[_0xeb8c('0x34')](_0x480c7a)[_0xeb8c('0x35')](function(_0x230232){return _0x230232;});}return null;};}function removeEntity(_0x32173f,_0x11b6f3){return function(_0x321195){if(_0x321195){return _0x321195[_0xeb8c('0x36')]()[_0xeb8c('0x35')](function(){var _0x5bc000=_0x321195[_0xeb8c('0x37')]({'plain':!![]});var _0x4d595d='ChatWebsites';return db[_0xeb8c('0x38')][_0xeb8c('0x36')]({'where':{'type':_0x4d595d,'resourceId':_0x5bc000['id']}})[_0xeb8c('0x35')](function(){return _0x321195;});})['then'](function(){_0x32173f[_0xeb8c('0x29')](0xcc)[_0xeb8c('0x39')]();});}};}function handleEntityNotFound(_0x132ff7,_0x3d795c){return function(_0x38e847){if(!_0x38e847){_0x132ff7[_0xeb8c('0x28')](0x194);}return _0x38e847;};}function handleError(_0x19e8ad,_0x1b1be8){_0x1b1be8=_0x1b1be8||0x1f4;return function(_0x5b9455){logger['error'](_0x5b9455[_0xeb8c('0x3a')]);if(_0x5b9455[_0xeb8c('0x3b')]){delete _0x5b9455[_0xeb8c('0x3b')];}_0x19e8ad['status'](_0x1b1be8)[_0xeb8c('0x3c')](_0x5b9455);};}exports['index']=function(_0x15e4a3,_0x3e0d46){var _0x3e2f31={'include':[{'model':db[_0xeb8c('0x3d')],'as':_0xeb8c('0x3e')}]},_0x253e9b={},_0x124218={'count':0x0,'rows':[]};var _0x1900a9=_[_0xeb8c('0x3f')](db[_0xeb8c('0x40')]['rawAttributes'],function(_0x351a8b){return{'name':_0x351a8b[_0xeb8c('0x41')],'type':_0x351a8b[_0xeb8c('0x42')][_0xeb8c('0x43')]};});_0x253e9b['model']=_[_0xeb8c('0x3f')](_0x1900a9,'name');_0x253e9b['query']=_[_0xeb8c('0x44')](_0x15e4a3[_0xeb8c('0x45')]);_0x253e9b[_0xeb8c('0x46')]=_[_0xeb8c('0x47')](_0x253e9b[_0xeb8c('0x48')],_0x253e9b['query']);_0x3e2f31[_0xeb8c('0x49')]=_[_0xeb8c('0x47')](_0x253e9b[_0xeb8c('0x48')],qs[_0xeb8c('0x4a')](_0x15e4a3['query'][_0xeb8c('0x4a')]));_0x3e2f31[_0xeb8c('0x49')]=_0x3e2f31[_0xeb8c('0x49')][_0xeb8c('0x4b')]?_0x3e2f31['attributes']:_0x253e9b[_0xeb8c('0x48')];if(!_0x15e4a3[_0xeb8c('0x45')][_0xeb8c('0x4c')]('nolimit')){_0x3e2f31[_0xeb8c('0x2e')]=qs[_0xeb8c('0x2e')](_0x15e4a3[_0xeb8c('0x45')][_0xeb8c('0x2e')]);_0x3e2f31[_0xeb8c('0x2b')]=qs[_0xeb8c('0x2b')](_0x15e4a3[_0xeb8c('0x45')][_0xeb8c('0x2b')]);}_0x3e2f31['order']=qs[_0xeb8c('0x4d')](_0x15e4a3[_0xeb8c('0x45')][_0xeb8c('0x4d')]);_0x3e2f31['where']=qs['filters'](_[_0xeb8c('0x4e')](_0x15e4a3[_0xeb8c('0x45')],_0x253e9b[_0xeb8c('0x46')]),_0x1900a9);if(_0x15e4a3[_0xeb8c('0x45')]['filter']){_0x3e2f31['where']=_['merge'](_0x3e2f31[_0xeb8c('0x4f')],{'$or':_['map'](_0x1900a9,function(_0x41e004){if(_0x41e004[_0xeb8c('0x42')]!==_0xeb8c('0x50')){var _0x2fecb9={};_0x2fecb9[_0x41e004['name']]={'$like':'%'+_0x15e4a3[_0xeb8c('0x45')][_0xeb8c('0x51')]+'%'};return _0x2fecb9;}})});}_0x3e2f31=_[_0xeb8c('0x52')]({},_0x3e2f31,_0x15e4a3[_0xeb8c('0x53')]);var _0x4a02dd={'where':_0x3e2f31[_0xeb8c('0x4f')]};return db[_0xeb8c('0x40')]['count'](_0x4a02dd)[_0xeb8c('0x35')](function(_0x5d560b){_0x124218['count']=_0x5d560b;if(_0x15e4a3[_0xeb8c('0x45')][_0xeb8c('0x54')]){_0x3e2f31[_0xeb8c('0x55')]=[{'all':!![]}];}return db[_0xeb8c('0x40')]['findAll'](_0x3e2f31);})[_0xeb8c('0x35')](function(_0x308079){_0x124218[_0xeb8c('0x56')]=_0x308079;return _0x124218;})['then'](respondWithFilteredResult(_0x3e0d46,_0x3e2f31))[_0xeb8c('0x27')](handleError(_0x3e0d46,null));};exports[_0xeb8c('0x57')]=function(_0x1b4bd9,_0x54999d){var _0xebccf0={'raw':![],'where':{'id':_0x1b4bd9[_0xeb8c('0x58')]['id']},'include':[{'model':db[_0xeb8c('0x3d')],'as':_0xeb8c('0x3e')}]},_0x58445f={};_0x58445f['model']=_[_0xeb8c('0x44')](db[_0xeb8c('0x40')][_0xeb8c('0x59')]);_0x58445f[_0xeb8c('0x45')]=_[_0xeb8c('0x44')](_0x1b4bd9[_0xeb8c('0x45')]);_0x58445f[_0xeb8c('0x46')]=_[_0xeb8c('0x47')](_0x58445f[_0xeb8c('0x48')],_0x58445f['query']);_0xebccf0[_0xeb8c('0x49')]=_['intersection'](_0x58445f['model'],qs[_0xeb8c('0x4a')](_0x1b4bd9[_0xeb8c('0x45')][_0xeb8c('0x4a')]));_0xebccf0[_0xeb8c('0x49')]=_0xebccf0[_0xeb8c('0x49')][_0xeb8c('0x4b')]?_0xebccf0[_0xeb8c('0x49')]:_0x58445f[_0xeb8c('0x48')];if(_0x1b4bd9[_0xeb8c('0x45')][_0xeb8c('0x54')]){_0xebccf0[_0xeb8c('0x55')]=[{'all':!![]}];}_0xebccf0=_[_0xeb8c('0x52')]({},_0xebccf0,_0x1b4bd9[_0xeb8c('0x53')]);return db[_0xeb8c('0x40')][_0xeb8c('0x5a')](_0xebccf0)[_0xeb8c('0x35')](handleEntityNotFound(_0x54999d,null))[_0xeb8c('0x35')](respondWithResult(_0x54999d,null))[_0xeb8c('0x27')](handleError(_0x54999d,null));};exports[_0xeb8c('0x5b')]=function(_0x592e6c,_0x59cec3){return db['ChatWebsite'][_0xeb8c('0x5b')](_0x592e6c[_0xeb8c('0x5c')],{})['then'](function(_0x33ff40){var _0x703428=_0x592e6c[_0xeb8c('0x5d')][_0xeb8c('0x37')]({'plain':!![]});if(!_0x703428)throw new Error(_0xeb8c('0x5e'));if(_0x703428[_0xeb8c('0x5f')]===_0xeb8c('0x5d')){var _0x5ac52f=_0x33ff40[_0xeb8c('0x37')]({'plain':!![]});var _0x2be56f=_0xeb8c('0x60');return db['UserProfileSection'][_0xeb8c('0x5a')]({'where':{'name':_0x2be56f,'userProfileId':_0x703428[_0xeb8c('0x61')]},'raw':!![]})[_0xeb8c('0x35')](function(_0x1bee44){if(_0x1bee44&&_0x1bee44[_0xeb8c('0x62')]===0x0){return db['UserProfileResource'][_0xeb8c('0x5b')]({'name':_0x5ac52f['name'],'resourceId':_0x5ac52f['id'],'type':_0x1bee44[_0xeb8c('0x3b')],'sectionId':_0x1bee44['id']},{})[_0xeb8c('0x35')](function(){return _0x33ff40;});}else{return _0x33ff40;}})[_0xeb8c('0x27')](function(_0x58b704){logger[_0xeb8c('0x22')](_0xeb8c('0x63'),_0x58b704);throw _0x58b704;});}return _0x33ff40;})['then'](respondWithResult(_0x59cec3,0xc9))['catch'](handleError(_0x59cec3,null));};exports[_0xeb8c('0x34')]=function(_0x3f791b,_0x3925a9){if(_0x3f791b[_0xeb8c('0x5c')]['id']){delete _0x3f791b[_0xeb8c('0x5c')]['id'];}return db['ChatWebsite'][_0xeb8c('0x5a')]({'where':{'id':_0x3f791b[_0xeb8c('0x58')]['id']},'include':[{'model':db[_0xeb8c('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xeb8c('0x35')](handleEntityNotFound(_0x3925a9,null))[_0xeb8c('0x35')](saveUpdates(_0x3f791b[_0xeb8c('0x5c')],null))[_0xeb8c('0x35')](respondWithResult(_0x3925a9,null))['catch'](handleError(_0x3925a9,null));};exports[_0xeb8c('0x36')]=function(_0x35a7ae,_0x217521){return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x35a7ae[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x217521,null))['then'](removeEntity(_0x217521,null))[_0xeb8c('0x27')](handleError(_0x217521,null));};exports[_0xeb8c('0x64')]=function(_0x1204fc,_0x10bafc){return db[_0xeb8c('0x40')][_0xeb8c('0x64')]()[_0xeb8c('0x35')](respondWithResult(_0x10bafc,null))[_0xeb8c('0x27')](handleError(_0x10bafc,null));};exports[_0xeb8c('0x65')]=function(_0x12a544,_0x120c41,_0x2db1ef){if(_0x12a544[_0xeb8c('0x5c')]['id']){delete _0x12a544[_0xeb8c('0x5c')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x12a544[_0xeb8c('0x58')]['id']}})['then'](handleEntityNotFound(_0x120c41,null))['then'](function(_0x3dc909){if(_0x3dc909){_0x12a544[_0xeb8c('0x5c')]['ChatWebsiteId']=_0x3dc909['id'];return db[_0xeb8c('0x66')]['create'](_0x12a544['body']);}})[_0xeb8c('0x35')](respondWithResult(_0x120c41,null))[_0xeb8c('0x27')](handleError(_0x120c41,null));};exports['getDispositions']=function(_0x1c09ff,_0x575bc9,_0x43c90f){var _0x5f2a1d={'raw':![],'where':{}};var _0x4985b4={};var _0x2180c7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xeb8c('0x67')]({'where':{'id':_0x1c09ff['params']['id']}})['then'](handleEntityNotFound(_0x575bc9,null))[_0xeb8c('0x35')](function(_0x3d2b87){if(_0x3d2b87){_0x4985b4['model']=_[_0xeb8c('0x44')](db[_0xeb8c('0x66')]['rawAttributes']);_0x4985b4[_0xeb8c('0x45')]=_[_0xeb8c('0x44')](_0x1c09ff[_0xeb8c('0x45')]);_0x4985b4['filters']=_[_0xeb8c('0x47')](_0x4985b4[_0xeb8c('0x48')],_0x4985b4[_0xeb8c('0x45')]);_0x5f2a1d['attributes']=_[_0xeb8c('0x47')](_0x4985b4[_0xeb8c('0x48')],qs['fields'](_0x1c09ff['query'][_0xeb8c('0x4a')]));_0x5f2a1d['attributes']=_0x5f2a1d[_0xeb8c('0x49')][_0xeb8c('0x4b')]?_0x5f2a1d[_0xeb8c('0x49')]:_0x4985b4[_0xeb8c('0x48')];if(!_0x1c09ff['query']['hasOwnProperty'](_0xeb8c('0x68'))){_0x5f2a1d[_0xeb8c('0x2e')]=qs[_0xeb8c('0x2e')](_0x1c09ff[_0xeb8c('0x45')]['limit']);_0x5f2a1d['offset']=qs[_0xeb8c('0x2b')](_0x1c09ff[_0xeb8c('0x45')][_0xeb8c('0x2b')]);}_0x5f2a1d[_0xeb8c('0x69')]=qs[_0xeb8c('0x4d')](_0x1c09ff['query'][_0xeb8c('0x4d')]);_0x5f2a1d[_0xeb8c('0x4f')]=qs[_0xeb8c('0x46')](_['pick'](_0x1c09ff[_0xeb8c('0x45')],_0x4985b4[_0xeb8c('0x46')]));_0x5f2a1d[_0xeb8c('0x4f')]['ChatWebsiteId']=_0x3d2b87['id'];if(_0x1c09ff[_0xeb8c('0x45')][_0xeb8c('0x51')]){_0x5f2a1d['where']=_[_0xeb8c('0x52')](_0x5f2a1d[_0xeb8c('0x4f')],{'$or':_[_0xeb8c('0x3f')](_0x5f2a1d[_0xeb8c('0x49')],function(_0x2623a7){var _0x321d9e={};_0x321d9e[_0x2623a7]={'$like':'%'+_0x1c09ff[_0xeb8c('0x45')]['filter']+'%'};return _0x321d9e;})});}_0x5f2a1d=_[_0xeb8c('0x52')]({},_0x5f2a1d,_0x1c09ff[_0xeb8c('0x53')]);return db[_0xeb8c('0x66')][_0xeb8c('0x2d')]({'where':_0x5f2a1d['where']})[_0xeb8c('0x35')](function(_0x4bb849){_0x2180c7[_0xeb8c('0x2d')]=_0x4bb849;if(_0x1c09ff[_0xeb8c('0x45')][_0xeb8c('0x54')]){_0x5f2a1d[_0xeb8c('0x55')]=[{'all':!![]}];}return db[_0xeb8c('0x66')][_0xeb8c('0x6a')](_0x5f2a1d);})[_0xeb8c('0x35')](function(_0x271aa5){_0x2180c7['rows']=_0x271aa5;return _0x2180c7;});}})[_0xeb8c('0x35')](respondWithFilteredResult(_0x575bc9,_0x5f2a1d))[_0xeb8c('0x27')](handleError(_0x575bc9,null));};exports[_0xeb8c('0x6b')]=function(_0x1c8a25,_0x411f60,_0x5180bd){return db['ChatWebsite']['find']({'where':{'id':_0x1c8a25[_0xeb8c('0x58')]['id']}})['then'](handleEntityNotFound(_0x411f60,null))[_0xeb8c('0x35')](function(_0x42b15f){if(_0x42b15f){return _0x42b15f['removeDispositions'](_0x1c8a25[_0xeb8c('0x45')]['ids']);}})[_0xeb8c('0x35')](respondWithStatusCode(_0x411f60,null))[_0xeb8c('0x27')](handleError(_0x411f60,null));};exports['addAnswer']=function(_0x4e38b5,_0x1879a7,_0x200912){if(_0x4e38b5['body']['id']){delete _0x4e38b5[_0xeb8c('0x5c')]['id'];}return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x4e38b5[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x1879a7,null))[_0xeb8c('0x35')](function(_0x23763b){if(_0x23763b){_0x4e38b5[_0xeb8c('0x5c')]['ChatWebsiteId']=_0x23763b['id'];return db['CannedAnswer']['create'](_0x4e38b5['body']);}})[_0xeb8c('0x35')](respondWithResult(_0x1879a7,null))[_0xeb8c('0x27')](handleError(_0x1879a7,null));};exports[_0xeb8c('0x6c')]=function(_0x1938e4,_0x553408,_0x3ee29d){var _0x6ba964={'raw':![],'where':{}};var _0x106e95={};var _0x2676d1={'count':0x0,'rows':[]};return db[_0xeb8c('0x40')][_0xeb8c('0x67')]({'where':{'id':_0x1938e4[_0xeb8c('0x58')]['id']}})['then'](handleEntityNotFound(_0x553408,null))['then'](function(_0x377f61){if(_0x377f61){_0x106e95[_0xeb8c('0x48')]=_[_0xeb8c('0x44')](db['CannedAnswer'][_0xeb8c('0x59')]);_0x106e95[_0xeb8c('0x45')]=_['keys'](_0x1938e4['query']);_0x106e95[_0xeb8c('0x46')]=_[_0xeb8c('0x47')](_0x106e95[_0xeb8c('0x48')],_0x106e95[_0xeb8c('0x45')]);_0x6ba964[_0xeb8c('0x49')]=_[_0xeb8c('0x47')](_0x106e95[_0xeb8c('0x48')],qs[_0xeb8c('0x4a')](_0x1938e4[_0xeb8c('0x45')]['fields']));_0x6ba964[_0xeb8c('0x49')]=_0x6ba964[_0xeb8c('0x49')][_0xeb8c('0x4b')]?_0x6ba964[_0xeb8c('0x49')]:_0x106e95[_0xeb8c('0x48')];if(!_0x1938e4['query'][_0xeb8c('0x4c')]('nolimit')){_0x6ba964[_0xeb8c('0x2e')]=qs[_0xeb8c('0x2e')](_0x1938e4['query'][_0xeb8c('0x2e')]);_0x6ba964[_0xeb8c('0x2b')]=qs[_0xeb8c('0x2b')](_0x1938e4[_0xeb8c('0x45')][_0xeb8c('0x2b')]);}_0x6ba964['order']=qs[_0xeb8c('0x4d')](_0x1938e4[_0xeb8c('0x45')][_0xeb8c('0x4d')]);_0x6ba964[_0xeb8c('0x4f')]=qs[_0xeb8c('0x46')](_[_0xeb8c('0x4e')](_0x1938e4[_0xeb8c('0x45')],_0x106e95[_0xeb8c('0x46')]));_0x6ba964[_0xeb8c('0x4f')][_0xeb8c('0x6d')]=_0x377f61['id'];if(_0x1938e4[_0xeb8c('0x45')][_0xeb8c('0x51')]){_0x6ba964[_0xeb8c('0x4f')]=_[_0xeb8c('0x52')](_0x6ba964[_0xeb8c('0x4f')],{'$or':_[_0xeb8c('0x3f')](_0x6ba964[_0xeb8c('0x49')],function(_0x344a1e){var _0x3bc0e2={};_0x3bc0e2[_0x344a1e]={'$like':'%'+_0x1938e4['query'][_0xeb8c('0x51')]+'%'};return _0x3bc0e2;})});}_0x6ba964=_[_0xeb8c('0x52')]({},_0x6ba964,_0x1938e4[_0xeb8c('0x53')]);return db[_0xeb8c('0x6e')][_0xeb8c('0x2d')]({'where':_0x6ba964['where']})[_0xeb8c('0x35')](function(_0x1d6085){_0x2676d1[_0xeb8c('0x2d')]=_0x1d6085;if(_0x1938e4[_0xeb8c('0x45')][_0xeb8c('0x54')]){_0x6ba964['include']=[{'all':!![]}];}return db[_0xeb8c('0x6e')]['findAll'](_0x6ba964);})[_0xeb8c('0x35')](function(_0x22f765){_0x2676d1[_0xeb8c('0x56')]=_0x22f765;return _0x2676d1;});}})['then'](respondWithFilteredResult(_0x553408,_0x6ba964))[_0xeb8c('0x27')](handleError(_0x553408,null));};exports['removeAnswers']=function(_0x299e3f,_0x5e0f97,_0xc3a3c8){return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x299e3f[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x5e0f97,null))[_0xeb8c('0x35')](function(_0x69e9c2){if(_0x69e9c2){return _0x69e9c2[_0xeb8c('0x6f')](_0x299e3f[_0xeb8c('0x45')][_0xeb8c('0x70')]);}})[_0xeb8c('0x35')](respondWithStatusCode(_0x5e0f97,null))[_0xeb8c('0x27')](handleError(_0x5e0f97,null));};exports[_0xeb8c('0x71')]=function(_0x2bbd6c,_0x464057,_0x3968c5){_0x2bbd6c[_0xeb8c('0x5c')][_0xeb8c('0x72')]=_0x2bbd6c['file'][_0xeb8c('0x73')];return db['ChatWebsite']['find']({'where':{'id':_0x2bbd6c[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x464057,null))['then'](saveUpdates(_0x2bbd6c['body'],null))[_0xeb8c('0x35')](respondWithResult(_0x464057,null))['catch'](handleError(_0x464057,null));};exports['addAvatar']=function(_0x1a3527,_0xb4f469,_0x28cdb6){_0x1a3527[_0xeb8c('0x5c')][_0xeb8c('0x74')]=_0x1a3527['file'][_0xeb8c('0x73')];return db[_0xeb8c('0x40')]['find']({'where':{'id':_0x1a3527[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0xb4f469,null))['then'](saveUpdates(_0x1a3527[_0xeb8c('0x5c')],null))['then'](respondWithResult(_0xb4f469,null))[_0xeb8c('0x27')](handleError(_0xb4f469,null));};exports['addCustomerAvatar']=function(_0x32314a,_0x18dc46,_0x2882a5){_0x32314a[_0xeb8c('0x5c')]['customerAvatar']=_0x32314a['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x32314a['params']['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x18dc46,null))[_0xeb8c('0x35')](saveUpdates(_0x32314a[_0xeb8c('0x5c')],null))[_0xeb8c('0x35')](respondWithResult(_0x18dc46,null))[_0xeb8c('0x27')](handleError(_0x18dc46,null));};exports[_0xeb8c('0x75')]=function(_0x13fa2f,_0x5230de,_0x1525d3){_0x13fa2f['body'][_0xeb8c('0x76')]=_0x13fa2f['file'][_0xeb8c('0x73')];return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x13fa2f['params']['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x5230de,null))[_0xeb8c('0x35')](saveUpdates(_0x13fa2f[_0xeb8c('0x5c')],null))[_0xeb8c('0x35')](respondWithResult(_0x5230de,null))[_0xeb8c('0x27')](handleError(_0x5230de,null));};exports[_0xeb8c('0x77')]=function(_0x294549,_0x3f9bad,_0x4f71d3){var _0x3b52f7=path['join'](config[_0xeb8c('0x78')],_0xeb8c('0x79'));var _0x487a06={'where':{'id':_0x294549[_0xeb8c('0x58')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x8fff24=![];return require(_0xeb8c('0x7a'))[_0xeb8c('0x7b')]()[_0xeb8c('0x35')](function(_0x54206d){if(_0x54206d){_0x8fff24=_0x54206d['custom'];}})['then'](function(){return db[_0xeb8c('0x40')]['find'](_0x487a06);})['then'](handleEntityNotFound(_0x3f9bad,null))[_0xeb8c('0x35')](function(_0x689ea7){if(_0x689ea7){if(!_[_0xeb8c('0x7c')](_0x689ea7[_0xeb8c('0x72')])){if(fs[_0xeb8c('0x7d')](path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],_0xeb8c('0x7f'),_0x689ea7[_0xeb8c('0x72')]))&&_0x8fff24){_0x3b52f7=path['join'](config[_0xeb8c('0x78')],_0xeb8c('0x7f'),_0x689ea7[_0xeb8c('0x72')]);}}return _0x3f9bad['download'](_0x3b52f7);}})['catch'](handleError(_0x3f9bad,null));};exports[_0xeb8c('0x80')]=function(_0x35388b,_0x285a59,_0x465728){var _0x452e18=path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],'server/files/images/avatars/default_avatar.png');var _0xf67adb={'where':{'id':_0x35388b[_0xeb8c('0x58')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xeb8c('0x5a')](_0xf67adb)[_0xeb8c('0x35')](handleEntityNotFound(_0x285a59,null))['then'](function(_0x2ca266){if(_0x2ca266){if(!_[_0xeb8c('0x7c')](_0x2ca266[_0xeb8c('0x74')])){if(fs[_0xeb8c('0x7d')](path['join'](config[_0xeb8c('0x78')],_0xeb8c('0x81'),_0x2ca266[_0xeb8c('0x74')]))){_0x452e18=path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],_0xeb8c('0x81'),_0x2ca266[_0xeb8c('0x74')]);}}return _0x285a59[_0xeb8c('0x82')](_0x452e18);}})[_0xeb8c('0x27')](handleError(_0x285a59,null));};exports[_0xeb8c('0x83')]=function(_0x111365,_0x5d77a1,_0x41d258){var _0x4e159c=path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],_0xeb8c('0x84'));var _0x5d68e2={'where':{'id':_0x111365[_0xeb8c('0x58')]['id']},'attributes':['id',_0xeb8c('0x85'),'showCustomerAvatar'],'raw':!![]};return db[_0xeb8c('0x40')]['find'](_0x5d68e2)['then'](handleEntityNotFound(_0x5d77a1,null))['then'](function(_0x36a05e){if(_0x36a05e){if(!_['isNil'](_0x36a05e[_0xeb8c('0x85')])){if(fs[_0xeb8c('0x7d')](path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],_0xeb8c('0x81'),_0x36a05e[_0xeb8c('0x85')]))&&_0x36a05e[_0xeb8c('0x86')]){_0x4e159c=path['join'](config['root'],'server/files/images/avatars/',_0x36a05e[_0xeb8c('0x85')]);}}return _0x5d77a1[_0xeb8c('0x82')](_0x4e159c);}})['catch'](handleError(_0x5d77a1,null));};exports[_0xeb8c('0x87')]=function(_0x25480b,_0x1bac88,_0x2ca861){var _0x39a303=path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],'server/files/images/avatars/system_avatar.png');var _0x475267={'where':{'id':_0x25480b[_0xeb8c('0x58')]['id']},'attributes':['id',_0xeb8c('0x76')],'raw':!![]};return db[_0xeb8c('0x40')][_0xeb8c('0x5a')](_0x475267)[_0xeb8c('0x35')](handleEntityNotFound(_0x1bac88,null))[_0xeb8c('0x35')](function(_0x860c8){if(_0x860c8){if(!_[_0xeb8c('0x7c')](_0x860c8['systemAvatar'])){if(fs[_0xeb8c('0x7d')](path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],_0xeb8c('0x81'),_0x860c8[_0xeb8c('0x76')]))){_0x39a303=path['join'](config[_0xeb8c('0x78')],'server/files/images/avatars/',_0x860c8['systemAvatar']);}}return _0x1bac88[_0xeb8c('0x82')](_0x39a303);}})[_0xeb8c('0x27')](handleError(_0x1bac88,null));};exports[_0xeb8c('0x88')]=function(_0x5b9d55,_0xd08f9f,_0x41f45c){var _0x519a31=require(_0xeb8c('0x89'));var _0x363642=new _0x519a31();var _0x4946a0=_0x363642['setUA'](_0x5b9d55[_0xeb8c('0x8a')][_0xeb8c('0x8b')])[_0xeb8c('0x8c')]();var _0x583d27={'body':_0x5b9d55[_0xeb8c('0x5c')],'channel':_0xeb8c('0x8d')};var _0x5af29d=[];var _0x340ff9=[];var _0x3c1596={};var _0x287d61=![];return db[_0xeb8c('0x8e')][_0xeb8c('0x64')]()['then'](function(_0x125f2f){if(!_0x125f2f){throw new db[(_0xeb8c('0x8f'))][(_0xeb8c('0x90'))](_0xeb8c('0x91'));}_0x5af29d=_[_0xeb8c('0x92')](_[_0xeb8c('0x44')](_0x125f2f),[_0xeb8c('0x93'),_0xeb8c('0x94')]);_0x340ff9=_['difference'](_[_0xeb8c('0x44')](_0x125f2f),[_0xeb8c('0x93'),'updatedAt','CompanyId',_0xeb8c('0x95')]);if(_0x5b9d55[_0xeb8c('0x5c')]['id']){delete _0x5b9d55[_0xeb8c('0x5c')]['id'];}if(_[_0xeb8c('0x7c')](_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0x96')])){throw new db[(_0xeb8c('0x8f'))][(_0xeb8c('0x90'))]('from\x20is\x20mandatory');}if(_[_0xeb8c('0x7c')](_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0x5c')])||_0x5b9d55['body'][_0xeb8c('0x5c')]===''){throw new db[(_0xeb8c('0x8f'))][(_0xeb8c('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeb8c('0x7c')](_0x5b9d55[_0xeb8c('0x5c')]['mapKey'])){throw new db[(_0xeb8c('0x8f'))][(_0xeb8c('0x90'))](_0xeb8c('0x97')+_0x340ff9);}if(!_[_0xeb8c('0x98')](_0x340ff9,_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0x99')])){throw new db['Sequelize'][(_0xeb8c('0x90'))](_0xeb8c('0x9a')+_0x340ff9);}_0x3c1596[_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0x99')]]=_0x5b9d55['body']['from'];})['then'](function(){return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x5b9d55[_0xeb8c('0x58')]['id']},'include':[{'model':db[_0xeb8c('0x9b')],'as':_0xeb8c('0x9c'),'include':[{'model':db[_0xeb8c('0x8e')],'as':_0xeb8c('0x9d'),'where':_0x3c1596,'limit':0x1,'order':[[_0xeb8c('0x94'),_0xeb8c('0x9e')]]}]},{'model':db['ChatApplication'],'as':_0xeb8c('0x9f')}]});})[_0xeb8c('0x35')](handleEntityNotFound(_0xd08f9f,null))[_0xeb8c('0x35')](function(_0x49bc7c){if(_0x49bc7c&&_0x49bc7c[_0xeb8c('0x9c')]){_0x583d27[_0xeb8c('0xa0')]=_0x49bc7c;_0x583d27[_0xeb8c('0xa1')]=_0x49bc7c[_0xeb8c('0x9f')];_0x583d27['list']=_0x49bc7c[_0xeb8c('0x9c')];_0x583d27[_0xeb8c('0xa1')]=_[_0xeb8c('0xa2')](_0x583d27[_0xeb8c('0xa1')],['priority'],[_0xeb8c('0xa3')]);if(_0x583d27[_0xeb8c('0xa0')][_0xeb8c('0x9f')]){delete _0x583d27[_0xeb8c('0xa0')]['Applications'];}if(_0x583d27[_0xeb8c('0xa0')]['List']&&_0x583d27['account']['List'][_0xeb8c('0x9d')][_0xeb8c('0x4b')]){return _0x583d27[_0xeb8c('0xa0')]['List'][_0xeb8c('0x9d')][0x0];}var _0xa302c=_['defaults'](_0x5b9d55['body'],{'firstName':_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0x96')],'ListId':_0x49bc7c[_0xeb8c('0x95')]});_0xa302c[_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0x99')]]=_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0x96')];return db['CmContact']['create'](_0xa302c,{'fields':_0x5af29d,'raw':!![]});}})[_0xeb8c('0x35')](handleEntityNotFound(_0xd08f9f,null))['then'](function(_0x39caff){_0x583d27['contact']=_0x39caff;var _0x587d46=_0x5b9d55[_0xeb8c('0x5c')]['customerIp'];if(_0x5b9d55[_0xeb8c('0x8a')][_0xeb8c('0xa4')]){_0x587d46=_0x5b9d55[_0xeb8c('0x8a')][_0xeb8c('0xa4')];}else if(_0x5b9d55[_0xeb8c('0x8a')][_0xeb8c('0xa5')]){_0x587d46=_[_0xeb8c('0xa6')](_0x5b9d55[_0xeb8c('0x8a')]['x-forwarded-for'][_0xeb8c('0xa7')](','));}if(_0x39caff){var _0x12b216={'ContactId':_0x39caff['id'],'ChatWebsiteId':_0x5b9d55[_0xeb8c('0x58')]['id'],'from':(_0x39caff[_0xeb8c('0xa8')]||'')+'\x20'+(_0x39caff[_0xeb8c('0xa9')]||''),'customerIp':_0x587d46,'customerPort':_0x5b9d55[_0xeb8c('0x8a')][_0xeb8c('0xaa')]?_0x5b9d55[_0xeb8c('0x8a')][_0xeb8c('0xaa')]:null,'referer':_0x5b9d55['body']['referer'],'browserName':_0x4946a0[_0xeb8c('0xab')][_0xeb8c('0x3b')]&&_0x4946a0[_0xeb8c('0xab')][_0xeb8c('0xac')]?util[_0xeb8c('0xad')](_0xeb8c('0xae'),_0x4946a0[_0xeb8c('0xab')]['name'],_0x4946a0['browser'][_0xeb8c('0xac')]):_0xeb8c('0xaf'),'browserVersion':_0x4946a0['browser'][_0xeb8c('0xac')]||_0xeb8c('0xaf'),'osName':util[_0xeb8c('0xad')](_0xeb8c('0xae'),_0x4946a0['os'][_0xeb8c('0x3b')],_0x4946a0['os'][_0xeb8c('0xac')]),'osVersion':_0x4946a0['os']['version'],'deviceModel':_0x4946a0[_0xeb8c('0xb0')][_0xeb8c('0x48')]&&_0x4946a0[_0xeb8c('0xb0')][_0xeb8c('0xb1')]?util[_0xeb8c('0xad')]('%s\x20%s\x20%s',_0x4946a0[_0xeb8c('0xb0')][_0xeb8c('0x48')],_0x4946a0[_0xeb8c('0xb0')]['vendor'],_0x4946a0[_0xeb8c('0xb0')][_0xeb8c('0x42')]):null,'deviceVendor':_0x4946a0[_0xeb8c('0xb0')]['vendor'],'deviceType':_0x4946a0[_0xeb8c('0xb0')][_0xeb8c('0x42')],'formData':JSON[_0xeb8c('0x21')](_0x5b9d55['body'])};var _0x1d8966={'ChatWebsiteId':_0x5b9d55[_0xeb8c('0x58')]['id'],'closed':![]};if(_0x5b9d55['body']['threadId']){_0x1d8966[_0xeb8c('0xb2')]=_0x5b9d55['body']['threadId'];return db[_0xeb8c('0xb3')][_0xeb8c('0x5a')]({'where':_0x1d8966})[_0xeb8c('0x35')](function(_0x8ca24){if(_0x8ca24){return[_0x8ca24,![]];}_0x12b216['threadId']=_0x5b9d55['body']['threadId'];_0x12b216[_0xeb8c('0xb4')]=_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0xb4')];return db[_0xeb8c('0xb3')][_0xeb8c('0x5b')](_0x12b216)[_0xeb8c('0x35')](function(_0x313212){return[_0x313212,!![]];});});}_0x1d8966['ContactId']=_0x39caff['id'];if(_0x5b9d55[_0xeb8c('0x5c')]['interaction']&&_0x5b9d55['body'][_0xeb8c('0xb5')]['id']){_0x1d8966['id']=_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0xb5')]['id'];return db[_0xeb8c('0xb3')][_0xeb8c('0x5a')]({'where':_0x1d8966})[_0xeb8c('0x35')](function(_0xede34a){if(_0xede34a){return[_0xede34a,![]];}return db['ChatInteraction']['create'](_0x12b216)[_0xeb8c('0x35')](function(_0x35377c){return[_0x35377c,!![]];});});}return db[_0xeb8c('0xb3')]['create'](_0x12b216)[_0xeb8c('0x35')](function(_0x28db9e){return[_0x28db9e,!![]];});}})[_0xeb8c('0xb6')](function(_0x58b956,_0x2cf8ac){if(_0x58b956){_0x287d61=_0x2cf8ac;if(!_0x2cf8ac){var _0x46ff93={'from':(_0x583d27[_0xeb8c('0xb7')]['firstName']||'')+'\x20'+(_0x583d27[_0xeb8c('0xb7')][_0xeb8c('0xa9')]||'')};if(_0x5b9d55['body']['threadId']&&_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0xb8')]&&_0x5b9d55[_0xeb8c('0x5c')][_0xeb8c('0xb2')]!=_0x5b9d55['body']['messageId']){_0x46ff93[_0xeb8c('0xb2')]=_0x5b9d55['body'][_0xeb8c('0xb8')];}return _0x58b956[_0xeb8c('0x34')](_0x46ff93);}else{return _0x58b956;}}})[_0xeb8c('0x35')](function(_0x18a27a){_0x583d27['interaction']=_0x18a27a[_0xeb8c('0x37')]({'plain':!![]});_0x583d27[_0xeb8c('0xb5')][_0xeb8c('0xb9')]=_0x287d61;if(_0x583d27[_0xeb8c('0xb5')]['created']){if(_0x583d27['account'][_0xeb8c('0xba')]){_0x583d27[_0xeb8c('0xa1')][_0xeb8c('0xbb')]({'id':0x0,'priority':_0x583d27['applications'][_0xeb8c('0x4b')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xeb8c('0xbc')});}}return db[_0xeb8c('0xbd')][_0xeb8c('0x5b')]({'body':_0x5b9d55[_0xeb8c('0x5c')]['body'],'ChatWebsiteId':_0x5b9d55[_0xeb8c('0x58')]['id'],'ChatInteractionId':_0x18a27a['id'],'direction':'in','ContactId':_0x583d27[_0xeb8c('0xb7')]['id'],'AttachmentId':_0x5b9d55[_0xeb8c('0x5c')]['AttachmentId']});})['then'](function(_0x2d92de){_0x583d27[_0xeb8c('0x24')]=_0x2d92de;if(_0x583d27[_0xeb8c('0xb5')][_0xeb8c('0xbe')]){return db[_0xeb8c('0xbf')]['find']({'attributes':['id','name'],'where':{'id':_0x583d27['interaction'][_0xeb8c('0xbe')]}})[_0xeb8c('0x35')](function(_0x162966){if(_0x162966){_0x583d27[_0xeb8c('0xa1')][_0xeb8c('0xc0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x162966[_0xeb8c('0x3b')]+','+(_0x583d27[_0xeb8c('0xa0')][_0xeb8c('0xc1')]||0xa),'interval':_0xeb8c('0xbc')});_0x583d27[_0xeb8c('0xc2')]=!![];}return respondWithRpcPromise(_0xeb8c('0xc3'),_0xeb8c('0xc4'),_0x583d27);});}return respondWithRpcPromise('Start',_0xeb8c('0xc4'),_0x583d27);})[_0xeb8c('0x35')](function(_0x4dcd10){respondWithRpcPromise(_0xeb8c('0xc5'),_0xeb8c('0xc5'),{'event':_0xeb8c('0x88'),'message':_0x4dcd10},client9002);return _0x4dcd10;})[_0xeb8c('0x35')](respondWithResult(_0xd08f9f,null))[_0xeb8c('0x27')](handleError(_0xd08f9f,null));};exports[_0xeb8c('0xc6')]=function(_0x22fede,_0x1c504c,_0xf2b7b5){var _0x1db147,_0x470719,_0xc4d317;var _0x45b3bc=[];var _0x56e08d=[];var _0x29206c={};var _0x23dc02=_0x22fede[_0xeb8c('0xc7')]||[];var _0x4fd95e=[];var _0xdaea3d;return db[_0xeb8c('0x8e')][_0xeb8c('0x64')]()['then'](function(_0x5ed452){if(!_0x5ed452){throw new db[(_0xeb8c('0x8f'))]['ValidationError'](_0xeb8c('0x91'));}_0x56e08d=_[_0xeb8c('0x92')](_[_0xeb8c('0x44')](_0x5ed452),['createdAt',_0xeb8c('0x94')]);_0x45b3bc=_[_0xeb8c('0x92')](_[_0xeb8c('0x44')](_0x5ed452),[_0xeb8c('0x93'),_0xeb8c('0x94'),_0xeb8c('0xc8'),'ListId']);if(_0x22fede[_0xeb8c('0x5c')]['id']){delete _0x22fede['body']['id'];}if(_['isNil'](_0x22fede['body'][_0xeb8c('0x96')])){throw _0x1c504c[_0xeb8c('0x29')](0x1f4)[_0xeb8c('0x3c')](new db[(_0xeb8c('0x8f'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x22fede[_0xeb8c('0x5c')][_0xeb8c('0x5c')])||_0x22fede['body'][_0xeb8c('0x5c')]===''){throw _0x1c504c[_0xeb8c('0x29')](0x1f4)[_0xeb8c('0x3c')](new db[(_0xeb8c('0x8f'))][(_0xeb8c('0x90'))](_0xeb8c('0xc9')));}if(_['isNil'](_0x22fede['body']['mapKeyOffline'])){throw _0x1c504c['status'](0x1f4)[_0xeb8c('0x3c')](new db[(_0xeb8c('0x8f'))]['ValidationError'](_0xeb8c('0xca')+_0x45b3bc));}if(!_['includes'](_0x45b3bc,_0x22fede['body']['mapKeyOffline'])){throw _0x1c504c[_0xeb8c('0x29')](0x1f4)[_0xeb8c('0x3c')](new db[(_0xeb8c('0x8f'))]['ValidationError'](_0xeb8c('0xcb')+_0x45b3bc));}_0x29206c[_0x22fede[_0xeb8c('0x5c')][_0xeb8c('0xcc')]]=_0x22fede[_0xeb8c('0x5c')]['from'];})[_0xeb8c('0x35')](function(){return db[_0xeb8c('0x40')]['find']({'where':{'id':_0x22fede[_0xeb8c('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xeb8c('0x9c')},{'model':db[_0xeb8c('0xcd')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x1c504c,null))['then'](function(_0x415fa5){if(_0x415fa5&&_0x415fa5['List']){_0x470719=_0x415fa5;var _0x82f18f=_['defaults'](_0x22fede[_0xeb8c('0x5c')],{'firstName':_0x22fede[_0xeb8c('0x5c')][_0xeb8c('0x96')],'phone':_0x22fede['body']['from'],'ListId':_0x415fa5[_0xeb8c('0x95')]});_0x82f18f[_0x22fede[_0xeb8c('0x5c')]['mapKeyOffline']]=_0x22fede[_0xeb8c('0x5c')][_0xeb8c('0x96')];return db[_0xeb8c('0x8e')][_0xeb8c('0xce')]({'where':_0x29206c,'defaults':_0x82f18f});}})[_0xeb8c('0xb6')](function(_0x562f73){if(_0x562f73){_0xc4d317=_0x562f73;var _0x254fc3=fs[_0xeb8c('0xcf')](path[_0xeb8c('0x7e')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xeb8c('0xd0'));var _0x5c8780=ejs[_0xeb8c('0xd1')](_0x254fc3,{'body':_[_0xeb8c('0xd2')](_0x22fede[_0xeb8c('0x5c')]['body']),'bodyTitle':_0x470719[_0xeb8c('0xd3')]});return db['ChatOfflineMessage'][_0xeb8c('0x5b')]({'body':_0x5c8780,'ContactId':_0x562f73['id'],'ChatWebsiteId':_0x470719['id']});}})[_0xeb8c('0x35')](function(_0x596865){_0xdaea3d=_0x596865;if(_0x23dc02[_0xeb8c('0x4b')]){var _0x10d993=_0x23dc02['map'](function(_0x21c8d3){return{'name':_0x21c8d3[_0xeb8c('0xd4')],'basename':_0x21c8d3[_0xeb8c('0x73')],'type':_0x21c8d3['mimetype'],'ChatOfflineMessageId':_0x596865['id']};});_0x4fd95e=_0x10d993[_0xeb8c('0x3f')](_0x37ce95=>{var _0x3a8f03={'filename':_0x37ce95['name'],'path':path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],'server',_0xeb8c('0xc7'),_0xeb8c('0xd5'),'offline-chat',_0x37ce95['basename'])};return _0x3a8f03;});if(!_0x470719[_0xeb8c('0xd6')]){return db['sequelize'][_0xeb8c('0xd7')](function(_0x3c8c77){return db[_0xeb8c('0xd8')][_0xeb8c('0xd9')](_0x10d993,{'transaction':_0x3c8c77});});}}})['then'](function(){if(_0xdaea3d){_0x1db147=_0xdaea3d;return db[_0xeb8c('0xcd')]['findOne']({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xeb8c('0xda'),'raw':!![]}]});}})[_0xeb8c('0x35')](function(_0x204718){if(_0x204718&&_0x204718[_0xeb8c('0xda')]&&_0x470719[_0xeb8c('0xdb')]&&_0x470719['forwardOfflineAddress']){var _0x440f74={'tls':{'rejectUnauthorized':![]}};if(_0x204718['Smtp'][_0xeb8c('0xdc')]){_0x440f74[_0xeb8c('0xdc')]=_0x204718[_0xeb8c('0xda')]['service'];}else{_0x440f74[_0xeb8c('0xdd')]=_0x204718[_0xeb8c('0xda')][_0xeb8c('0xdd')];_0x440f74['port']=_0x204718[_0xeb8c('0xda')][_0xeb8c('0xde')];_0x440f74[_0xeb8c('0xdf')]=_0x204718['Smtp']['secure'];}if(_0x204718[_0xeb8c('0xda')][_0xeb8c('0xe0')]){_0x440f74[_0xeb8c('0xe1')]={'user':_0x204718['Smtp'][_0xeb8c('0x5d')],'pass':_0x204718['Smtp'][_0xeb8c('0xe2')]};}return respondWithRpcPromise(_0xeb8c('0xe3'),_0xeb8c('0xe4'),{'account':_0x440f74,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x204718[_0xeb8c('0x3b')],_0x204718[_0xeb8c('0xe5')]||_0x204718[_0xeb8c('0xda')][_0xeb8c('0x5d')]),'to':_0x470719[_0xeb8c('0xe6')],'subject':_0x470719[_0xeb8c('0xe7')],'html':_0x1db147[_0xeb8c('0x5c')],'attachments':_0x4fd95e}},client9003)[_0xeb8c('0x35')](function(){return _0x1db147;})[_0xeb8c('0x27')](function(_0x18a3f3){console['error'](_0x18a3f3);});}})[_0xeb8c('0x35')](function(){if(_0x470719&&_0x470719[_0xeb8c('0xd6')]&&_0x470719[_0xeb8c('0xe8')]){var _0x6657d9=[];if(_0x23dc02[_0xeb8c('0x4b')]){_0x6657d9=_0x23dc02[_0xeb8c('0x3f')](function(_0x4648e1){return{'name':_0x4648e1['originalname'],'basename':_0x4648e1[_0xeb8c('0x73')],'type':_0x4648e1[_0xeb8c('0xe9')],'ChatOfflineMessageId':_0xdaea3d['id']};});}var _0x1f7c82;if(!_[_0xeb8c('0x7c')](_0x470719[_0xeb8c('0xea')])){var _0x5b1186=_[_0xeb8c('0x3f')](_0x22fede['body'],function(_0x40bd68){return _0x40bd68;});var _0xe2a319=_['toPairsIn'](_0x5b1186)[0x0];var _0x42821c=_[_0xeb8c('0xeb')](_0xe2a319,function(_0x1857c2){return _0x1857c2;});_0x1f7c82=_0x42821c[0x1][_0x470719[_0xeb8c('0xea')]];}var _0x75f0d2={'from':_0xc4d317['email'],'firstName':_0xc4d317[_0xeb8c('0xa8')],'lastName':_0xc4d317[_0xeb8c('0xa9')],'mapKey':_0xeb8c('0xe5'),'message':{'from':_0xc4d317[_0xeb8c('0xe5')],'to':_0x470719[_0xeb8c('0xcd')][_0xeb8c('0xe5')],'cc':'','subject':_[_0xeb8c('0x7c')](_0x1f7c82)?_0x470719['offlineMessageSubject']:_0x1f7c82,'messageId':'','sentAt':new Date(),'attach':_0x6657d9[_0xeb8c('0x4b')],'attachments':_0x6657d9,'originChannel':_0xeb8c('0xec'),'ChatWebsiteId':_0x470719['id'],'ChatOfflineMessageId':_0x1db147['id'],'originTo':_0x470719[_0xeb8c('0xcd')]['email']},'body':_0x1db147[_0xeb8c('0x5c')]};var _0x4f85e1={'account':{'id':_0x470719[_0xeb8c('0xe8')]},'body':_0x75f0d2,'log':_0xeb8c('0xed')};return respondWithRpcPromise(_0xeb8c('0xed'),_0xeb8c('0xee'),_0x4f85e1,client9001)[_0xeb8c('0x35')](function(){return _0x1db147;})[_0xeb8c('0x27')](function(_0x426a76){console['error'](_0x426a76);});}return;})['then'](function(){if(_0x1db147){return _0x1db147;}})[_0xeb8c('0x35')](respondWithResult(_0x1c504c,null))[_0xeb8c('0x27')](function(_0x1a7c84){console[_0xeb8c('0x22')](_0xeb8c('0x27'),_0x1a7c84);for(var _0x3b231d of _0x23dc02){var _0x563887=path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],_0xeb8c('0xef'),_0xeb8c('0xc7'),'attachments',_0xeb8c('0xf0'),_0x3b231d[_0xeb8c('0x73')]);fs_extra[_0xeb8c('0xf1')](_0x563887)[_0xeb8c('0x27')](function(_0x2ec4de){console[_0xeb8c('0x22')](_0xeb8c('0xf2'),_0x563887,_0x2ec4de);});}});};exports[_0xeb8c('0xf3')]=function(_0xf33c4,_0x4e8d11,_0x15c1e2){return db[_0xeb8c('0xb3')][_0xeb8c('0x5a')]({'where':{'id':_0xf33c4['params']['id']}})['then'](handleEntityNotFound(_0x4e8d11,null))[_0xeb8c('0x35')](function(_0x47d53f){if(_0x47d53f){return _0x47d53f[_0xeb8c('0xf3')](_0xf33c4['body'][_0xeb8c('0x70')],_[_0xeb8c('0xf4')](_0xf33c4[_0xeb8c('0x5c')],[_0xeb8c('0x70'),'id'])||{});}})[_0xeb8c('0x35')](respondWithResult(_0x4e8d11,null))[_0xeb8c('0x27')](handleError(_0x4e8d11,null));};exports[_0xeb8c('0xf5')]=function(_0x5dc1cb,_0xb8d1e2,_0x52bbc2){var _0x38b09a={'raw':![],'where':{}};var _0x3c05f2={};var _0x20627a={'count':0x0,'rows':[]};return db[_0xeb8c('0x40')][_0xeb8c('0x67')]({'where':{'id':_0x5dc1cb[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0xb8d1e2,null))['then'](function(_0x3e0201){if(_0x3e0201){_0x3c05f2[_0xeb8c('0x48')]=_['keys'](db[_0xeb8c('0xb3')]['rawAttributes']);_0x3c05f2[_0xeb8c('0x45')]=_[_0xeb8c('0x44')](_0x5dc1cb[_0xeb8c('0x45')]);_0x3c05f2['filters']=_['intersection'](_0x3c05f2[_0xeb8c('0x48')],_0x3c05f2[_0xeb8c('0x45')]);_0x38b09a['attributes']=_[_0xeb8c('0x47')](_0x3c05f2['model'],qs['fields'](_0x5dc1cb[_0xeb8c('0x45')]['fields']));_0x38b09a[_0xeb8c('0x49')]=_0x38b09a['attributes'][_0xeb8c('0x4b')]?_0x38b09a[_0xeb8c('0x49')]:_0x3c05f2['model'];if(!_0x5dc1cb[_0xeb8c('0x45')]['hasOwnProperty'](_0xeb8c('0x68'))){_0x38b09a[_0xeb8c('0x2e')]=qs['limit'](_0x5dc1cb[_0xeb8c('0x45')][_0xeb8c('0x2e')]);_0x38b09a['offset']=qs[_0xeb8c('0x2b')](_0x5dc1cb[_0xeb8c('0x45')]['offset']);}_0x38b09a[_0xeb8c('0x69')]=qs[_0xeb8c('0x4d')](_0x5dc1cb[_0xeb8c('0x45')][_0xeb8c('0x4d')]);_0x38b09a['where']=qs[_0xeb8c('0x46')](_[_0xeb8c('0x4e')](_0x5dc1cb['query'],_0x3c05f2[_0xeb8c('0x46')]));_0x38b09a[_0xeb8c('0x4f')][_0xeb8c('0x6d')]=_0x3e0201['id'];if(_0x5dc1cb[_0xeb8c('0x45')][_0xeb8c('0x51')]){_0x38b09a[_0xeb8c('0x4f')]=_['merge'](_0x38b09a['where'],{'$or':_[_0xeb8c('0x3f')](_0x38b09a[_0xeb8c('0x49')],function(_0x2e3c36){var _0x214e50={};_0x214e50[_0x2e3c36]={'$like':'%'+_0x5dc1cb[_0xeb8c('0x45')][_0xeb8c('0x51')]+'%'};return _0x214e50;})});}_0x38b09a=_[_0xeb8c('0x52')]({},_0x38b09a,_0x5dc1cb[_0xeb8c('0x53')]);return db[_0xeb8c('0xb3')][_0xeb8c('0x2d')]({'where':_0x38b09a[_0xeb8c('0x4f')]})[_0xeb8c('0x35')](function(_0x228d6d){_0x20627a[_0xeb8c('0x2d')]=_0x228d6d;if(_0x5dc1cb[_0xeb8c('0x45')]['includeAll']){_0x38b09a[_0xeb8c('0x55')]=[{'model':db['CmContact'],'as':_0xeb8c('0xf6'),'required':![]},{'model':db[_0xeb8c('0xbf')],'as':_0xeb8c('0xf7'),'attributes':[_0xeb8c('0x3b'),_0xeb8c('0xf8'),_0xeb8c('0xf9')],'required':![]},{'model':db[_0xeb8c('0xfa')],'as':_0xeb8c('0xfb'),'attributes':['id',_0xeb8c('0x3b'),_0xeb8c('0xfc')],'where':_0x5dc1cb[_0xeb8c('0x45')][_0xeb8c('0xfd')]?{'id':_0x5dc1cb[_0xeb8c('0x45')]['tag']}:undefined,'required':_0x5dc1cb['query'][_0xeb8c('0xfd')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x38b09a);})[_0xeb8c('0x35')](function(_0x227f0a){_0x20627a[_0xeb8c('0x56')]=_0x227f0a;return _0x20627a;});}})['then'](respondWithFilteredResult(_0xb8d1e2,_0x38b09a))[_0xeb8c('0x27')](handleError(_0xb8d1e2,null));};function iftimePromise(_0x2e6dcd,_0x439c49){return respondWithRpcPromise('Command',_0xeb8c('0xfe'),{'command':_0x439c49[_0xeb8c('0xff')]?util[_0xeb8c('0xad')]('iftime\x20%s,%s',_0x2e6dcd[_0xeb8c('0x100')],_0x439c49[_0xeb8c('0xff')]):util['format']('iftime\x20%s',_0x2e6dcd[_0xeb8c('0x100')])},client9002)[_0xeb8c('0x35')](function(_0x41d378){var _0xb5f736=_0x41d378&&_0x41d378[_0xeb8c('0x101')]('true')>=0x0?!![]:![];logger[_0xeb8c('0x25')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x439c49['id'],_0x2e6dcd['id'],_0x2e6dcd[_0xeb8c('0x100')],_0xb5f736?_0xeb8c('0x102'):_0xeb8c('0x103'),_0x439c49[_0xeb8c('0xff')]?_0x439c49['timezone']:'No\x20timezone');return _0xb5f736;})[_0xeb8c('0x27')](function(_0x59cc2c){logger[_0xeb8c('0x22')](_0xeb8c('0x104'),_0x439c49['id'],_0x2e6dcd['id'],_0x2e6dcd[_0xeb8c('0x100')],util[_0xeb8c('0x105')](_0x59cc2c,{'showHidden':![],'depth':null}),_0x439c49['timezone']?_0x439c49[_0xeb8c('0xff')]:_0xeb8c('0x106'));return![];});}exports[_0xeb8c('0xfe')]=function(_0x49ecf3,_0x192248,_0x2fbae1){var _0x59a288=0x0;var _0x363bad=0x0;var _0x4b94ef=![];var _0x536c48;var _0x390f57;return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x49ecf3[_0xeb8c('0x58')]['id']},'include':[{'model':db['Interval'],'as':_0xeb8c('0x107'),'include':[{'model':db[_0xeb8c('0x107')],'as':_0xeb8c('0x108'),'attributes':['id',_0xeb8c('0x100')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x192248,null))[_0xeb8c('0x35')](function(_0x2599e1){if(_0x2599e1){_0x536c48=_0x2599e1;return _0x2599e1['getProactiveActions']({'raw':!![]});}})['then'](function(_0x25c163){if(_0x536c48){if(_0x25c163){_0x390f57=_0x25c163;}}return require(_0xeb8c('0x7a'))[_0xeb8c('0x7b')]();})[_0xeb8c('0x35')](function(_0x469881){if(_0x469881){_0x363bad=_0x469881[_0xeb8c('0x109')];_0x4b94ef=_0x469881[_0xeb8c('0x10a')];}})[_0xeb8c('0x35')](function(){return db['ChatInteraction'][_0xeb8c('0x2d')]({'where':{'closed':![]}});})[_0xeb8c('0x35')](function(_0x5a43ca){_0x59a288=_0x5a43ca;if(_0x363bad&&_0x5a43ca>_0x363bad){return db[_0xeb8c('0x10b')][_0xeb8c('0x67')]({'where':{'id':0x1}})[_0xeb8c('0x35')](function(_0x5b303d){if(_0x5b303d){_0x5b303d[_0xeb8c('0x10c')]('chatLicenseExceeded');}});}})[_0xeb8c('0x35')](function(){if(_0x536c48[_0xeb8c('0x107')]&&_0x536c48[_0xeb8c('0x107')][_0xeb8c('0x108')]){var _0x579d33=[];for(var _0x57e1bf=0x0;_0x57e1bf<_0x536c48[_0xeb8c('0x107')][_0xeb8c('0x108')][_0xeb8c('0x4b')];_0x57e1bf++){var _0x57cce5=_0x536c48['Interval'][_0xeb8c('0x108')][_0x57e1bf]['get']({'plain':!![]});_0x579d33[_0xeb8c('0xbb')](iftimePromise(_0x57cce5,_0x536c48));}return BPromise[_0xeb8c('0x10d')](_0x579d33)[_0xeb8c('0x35')](function(_0x30b16d){return _[_0xeb8c('0x10e')](_0x30b16d);});}else{return!![];}})[_0xeb8c('0x35')](function(_0x3ed06e){var _0x17981e=fs['readFileSync'](path[_0xeb8c('0x7e')](config[_0xeb8c('0x78')],_0xeb8c('0x10f')),_0xeb8c('0xd0'));var _0x2f3ef0={'remote':_0x536c48['remote'],'query':querystring[_0xeb8c('0x21')](_[_0xeb8c('0x52')](_0x536c48[_0xeb8c('0x37')]({'plain':!![]}),{'customerIp':_0x49ecf3[_0xeb8c('0x8a')][_0xeb8c('0xa5')]||_0x49ecf3[_0xeb8c('0x8a')]['x-real-ip']||_0x49ecf3[_0xeb8c('0x110')]['remoteAddress']||_0x49ecf3['ip'],'referer':_0x49ecf3['headers']['referer'],'openedInteractions':_0x59a288,'maxInteractions':_0x363bad,'virtual':_0x4b94ef[_0xeb8c('0x109')],'online':_0x3ed06e,'custom':_0x4b94ef}))[_0xeb8c('0x111')](/'/g,'\x5c\x27')};_0x192248[_0xeb8c('0x3c')](ejs[_0xeb8c('0xd1')](Mustache[_0xeb8c('0xd1')](_0x17981e,_0x2f3ef0),{'proactiveActions':_0x390f57,'alignment':_0x536c48[_0xeb8c('0x112')],'verticalAlignment':_0x536c48[_0xeb8c('0x113')],'div_color':_0x536c48[_0xeb8c('0xfc')],'text_color':_0x536c48[_0xeb8c('0x114')],'button_color':_0x536c48[_0xeb8c('0x115')],'background_color':_0x536c48[_0xeb8c('0x116')]}));})['catch'](handleError(_0x192248,null));};exports[_0xeb8c('0x117')]=function(_0x213aba,_0x2fc9df,_0x47c6a6){return db[_0xeb8c('0x40')][_0xeb8c('0x67')]({'where':{'id':_0x213aba[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x2fc9df,null))[_0xeb8c('0x35')](function(_0x132ca0){if(_0x132ca0){return db[_0xeb8c('0x118')][_0xeb8c('0xd7')](function(_0x2fc078){return db['ChatApplication'][_0xeb8c('0x36')]({'where':{'ChatWebsiteId':_0x213aba[_0xeb8c('0x58')]['id']},'transaction':_0x2fc078})[_0xeb8c('0x35')](function(_0x32ef85){var _0x3d48a7=_[_0xeb8c('0x3f')](_0x213aba['body'],function(_0x58a6fa){_0x58a6fa['ChatWebsiteId']=_0x213aba['params']['id'];return _0x58a6fa;});return db[_0xeb8c('0x119')][_0xeb8c('0xd9')](_0x3d48a7,{'transaction':_0x2fc078});});})['then'](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x213aba['params']['id']},'order':'priority'});});}})[_0xeb8c('0x35')](respondWithResult(_0x2fc9df,null))[_0xeb8c('0x27')](handleError(_0x2fc9df,null));};exports[_0xeb8c('0x11a')]=function(_0x464be9,_0x262595,_0xa86215){var _0x4992f0={};var _0x4fa499={};var _0x4255a3;var _0x22d0c5;return db[_0xeb8c('0x40')][_0xeb8c('0x67')]({'where':{'id':_0x464be9[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x262595,null))[_0xeb8c('0x35')](function(_0x60fba7){if(_0x60fba7){_0x4255a3=_0x60fba7;_0x4fa499['model']=_['keys'](db['ChatApplication'][_0xeb8c('0x59')]);_0x4fa499[_0xeb8c('0x45')]=_[_0xeb8c('0x44')](_0x464be9[_0xeb8c('0x45')]);_0x4fa499['filters']=_['intersection'](_0x4fa499[_0xeb8c('0x48')],_0x4fa499[_0xeb8c('0x45')]);_0x4992f0[_0xeb8c('0x49')]=_['intersection'](_0x4fa499[_0xeb8c('0x48')],qs[_0xeb8c('0x4a')](_0x464be9['query']['fields']));_0x4992f0[_0xeb8c('0x49')]=_0x4992f0[_0xeb8c('0x49')][_0xeb8c('0x4b')]?_0x4992f0[_0xeb8c('0x49')]:_0x4fa499[_0xeb8c('0x48')];_0x4992f0['order']=qs[_0xeb8c('0x4d')](_0x464be9['query']['sort']);_0x4992f0[_0xeb8c('0x4f')]=qs[_0xeb8c('0x46')](_[_0xeb8c('0x4e')](_0x464be9[_0xeb8c('0x45')],_0x4fa499[_0xeb8c('0x46')]));if(_0x464be9['query'][_0xeb8c('0x51')]){_0x4992f0[_0xeb8c('0x4f')]=_[_0xeb8c('0x52')](_0x4992f0[_0xeb8c('0x4f')],{'$or':_['map'](_0x4992f0['attributes'],function(_0x437655){var _0x4a864e={};_0x4a864e[_0x437655]={'$like':'%'+_0x464be9[_0xeb8c('0x45')][_0xeb8c('0x51')]+'%'};return _0x4a864e;})});}_0x4992f0=_[_0xeb8c('0x52')]({},_0x4992f0,_0x464be9[_0xeb8c('0x53')]);return _0x4255a3['getApplications'](_0x4992f0);}})[_0xeb8c('0x35')](function(_0x45b905){if(_0x45b905){_0x22d0c5=_0x45b905[_0xeb8c('0x4b')];if(!_0x464be9['query'][_0xeb8c('0x4c')](_0xeb8c('0x68'))){_0x4992f0['limit']=qs[_0xeb8c('0x2e')](_0x464be9[_0xeb8c('0x45')][_0xeb8c('0x2e')]);_0x4992f0[_0xeb8c('0x2b')]=qs['offset'](_0x464be9[_0xeb8c('0x45')][_0xeb8c('0x2b')]);}return _0x4255a3[_0xeb8c('0x11a')](_0x4992f0);}})[_0xeb8c('0x35')](function(_0x4b8279){if(_0x4b8279){return _0x4b8279?{'count':_0x22d0c5,'rows':_0x4b8279}:null;}})[_0xeb8c('0x35')](respondWithResult(_0x262595,null))[_0xeb8c('0x27')](handleError(_0x262595,null));};exports[_0xeb8c('0x11b')]=function(_0x1c6fc9,_0x50c3fe,_0x331ce2){return db[_0xeb8c('0x11c')][_0xeb8c('0x5a')]({'where':{'id':_0x1c6fc9[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x50c3fe,null))[_0xeb8c('0x35')](function(_0x4f6ce5){if(_0x4f6ce5){return _0x4f6ce5[_0xeb8c('0x11b')](_0x1c6fc9[_0xeb8c('0x5c')][_0xeb8c('0x70')],_[_0xeb8c('0xf4')](_0x1c6fc9[_0xeb8c('0x5c')],[_0xeb8c('0x70'),'id'])||{});}})[_0xeb8c('0x35')](respondWithResult(_0x50c3fe,null))[_0xeb8c('0x27')](handleError(_0x50c3fe,null));};exports[_0xeb8c('0x11d')]=function(_0x3c3ac7,_0x385635,_0x39ec73){var _0x35527b={};var _0x4d8c49={};var _0xecbd81;var _0x4426f2;return db[_0xeb8c('0x40')][_0xeb8c('0x67')]({'where':{'id':_0x3c3ac7[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x385635,null))['then'](function(_0x5cec6a){if(_0x5cec6a){_0xecbd81=_0x5cec6a;_0x4d8c49['model']=_[_0xeb8c('0x44')](db['ChatProactiveAction'][_0xeb8c('0x59')]);_0x4d8c49[_0xeb8c('0x45')]=_[_0xeb8c('0x44')](_0x3c3ac7[_0xeb8c('0x45')]);_0x4d8c49[_0xeb8c('0x46')]=_[_0xeb8c('0x47')](_0x4d8c49[_0xeb8c('0x48')],_0x4d8c49[_0xeb8c('0x45')]);_0x35527b[_0xeb8c('0x49')]=_[_0xeb8c('0x47')](_0x4d8c49['model'],qs[_0xeb8c('0x4a')](_0x3c3ac7[_0xeb8c('0x45')][_0xeb8c('0x4a')]));_0x35527b['attributes']=_0x35527b[_0xeb8c('0x49')][_0xeb8c('0x4b')]?_0x35527b[_0xeb8c('0x49')]:_0x4d8c49[_0xeb8c('0x48')];_0x35527b[_0xeb8c('0x69')]=qs['sort'](_0x3c3ac7[_0xeb8c('0x45')][_0xeb8c('0x4d')]);_0x35527b[_0xeb8c('0x4f')]=qs[_0xeb8c('0x46')](_[_0xeb8c('0x4e')](_0x3c3ac7[_0xeb8c('0x45')],_0x4d8c49[_0xeb8c('0x46')]));if(_0x3c3ac7['query'][_0xeb8c('0x51')]){_0x35527b['where']=_['merge'](_0x35527b['where'],{'$or':_[_0xeb8c('0x3f')](_0x35527b[_0xeb8c('0x49')],function(_0xd725fd){var _0x890c17={};_0x890c17[_0xd725fd]={'$like':'%'+_0x3c3ac7[_0xeb8c('0x45')][_0xeb8c('0x51')]+'%'};return _0x890c17;})});}_0x35527b=_[_0xeb8c('0x52')]({},_0x35527b,_0x3c3ac7['options']);return _0xecbd81[_0xeb8c('0x11d')](_0x35527b);}})[_0xeb8c('0x35')](function(_0x40918b){if(_0x40918b){_0x4426f2=_0x40918b[_0xeb8c('0x4b')];if(!_0x3c3ac7['query']['hasOwnProperty'](_0xeb8c('0x68'))){_0x35527b[_0xeb8c('0x2e')]=qs[_0xeb8c('0x2e')](_0x3c3ac7['query'][_0xeb8c('0x2e')]);_0x35527b[_0xeb8c('0x2b')]=qs[_0xeb8c('0x2b')](_0x3c3ac7[_0xeb8c('0x45')][_0xeb8c('0x2b')]);}return _0xecbd81[_0xeb8c('0x11d')](_0x35527b);}})[_0xeb8c('0x35')](function(_0x57cc04){if(_0x57cc04){return _0x57cc04?{'count':_0x4426f2,'rows':_0x57cc04}:null;}})[_0xeb8c('0x35')](respondWithResult(_0x385635,null))[_0xeb8c('0x27')](handleError(_0x385635,null));};exports[_0xeb8c('0x11e')]=function(_0x15cc7c,_0x5cb50f,_0x53b3f6){var _0x5b5d0d=_0x15cc7c['query']['online']===_0xeb8c('0x11f')?_0xeb8c('0x120'):'onlineForm';return db['ChatWebsite'][_0xeb8c('0x5a')]({'attributes':['id',_0x5b5d0d],'where':{'id':_0x15cc7c[_0xeb8c('0x58')]['id']}})['then'](handleEntityNotFound(_0x5cb50f,null))[_0xeb8c('0x35')](function(_0x4fa5ef){if(_0x4fa5ef){var _0xfa36a8=_0x4fa5ef[_0x5b5d0d];var _0xcbf670=_0xfa36a8&&_0xfa36a8[_0xeb8c('0x121')]?_0xfa36a8[_0xeb8c('0x121')]:[];_0x5cb50f[_0xeb8c('0x3c')]({'fromKey':_[_0xeb8c('0x7c')](_0xfa36a8[_0xeb8c('0x122')])?undefined:_0xfa36a8['fromKey'],'count':_0xcbf670['length'],'rows':_0xcbf670});}})[_0xeb8c('0x27')](handleError(_0x5cb50f,null));};exports[_0xeb8c('0x123')]=function(_0x7112c4,_0x23192c,_0x35392b){var _0x310ff1={'raw':![],'where':{}};var _0x2af593={};var _0x1ef128={'count':0x0,'rows':[]};return db[_0xeb8c('0x40')][_0xeb8c('0x67')]({'where':{'id':_0x7112c4['params']['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x23192c,null))[_0xeb8c('0x35')](function(_0x50b11a){if(_0x50b11a){_0x2af593['model']=_[_0xeb8c('0x44')](db['ChatOfflineMessage'][_0xeb8c('0x59')]);_0x2af593[_0xeb8c('0x45')]=_[_0xeb8c('0x44')](_0x7112c4[_0xeb8c('0x45')]);_0x2af593[_0xeb8c('0x46')]=_[_0xeb8c('0x47')](_0x2af593['model'],_0x2af593[_0xeb8c('0x45')]);_0x310ff1['attributes']=_['intersection'](_0x2af593['model'],qs['fields'](_0x7112c4['query']['fields']));_0x310ff1[_0xeb8c('0x49')]=_0x310ff1[_0xeb8c('0x49')]['length']?_0x310ff1[_0xeb8c('0x49')]:_0x2af593['model'];if(!_0x7112c4[_0xeb8c('0x45')]['hasOwnProperty'](_0xeb8c('0x68'))){_0x310ff1[_0xeb8c('0x2e')]=qs[_0xeb8c('0x2e')](_0x7112c4[_0xeb8c('0x45')][_0xeb8c('0x2e')]);_0x310ff1[_0xeb8c('0x2b')]=qs['offset'](_0x7112c4[_0xeb8c('0x45')][_0xeb8c('0x2b')]);}_0x310ff1[_0xeb8c('0x69')]=qs[_0xeb8c('0x4d')](_0x7112c4[_0xeb8c('0x45')][_0xeb8c('0x4d')]);_0x310ff1[_0xeb8c('0x4f')]=qs[_0xeb8c('0x46')](_[_0xeb8c('0x4e')](_0x7112c4[_0xeb8c('0x45')],_0x2af593[_0xeb8c('0x46')]));_0x310ff1['where'][_0xeb8c('0x6d')]=_0x50b11a['id'];if(_0x7112c4[_0xeb8c('0x45')][_0xeb8c('0x51')]){_0x310ff1[_0xeb8c('0x4f')]=_['merge'](_0x310ff1[_0xeb8c('0x4f')],{'$or':_[_0xeb8c('0x3f')](_0x310ff1[_0xeb8c('0x49')],function(_0x32115f){var _0xfb9049={};_0xfb9049[_0x32115f]={'$like':'%'+_0x7112c4[_0xeb8c('0x45')][_0xeb8c('0x51')]+'%'};return _0xfb9049;})});}_0x310ff1=_['merge']({},_0x310ff1,_0x7112c4[_0xeb8c('0x53')]);return db['ChatOfflineMessage'][_0xeb8c('0x2d')]({'where':_0x310ff1[_0xeb8c('0x4f')]})[_0xeb8c('0x35')](function(_0x2a624a){_0x1ef128[_0xeb8c('0x2d')]=_0x2a624a;if(_0x7112c4['query']['includeAll']){_0x310ff1[_0xeb8c('0x55')]=[{'all':!![]}];}else{_0x310ff1[_0xeb8c('0x55')]=[{'model':db[_0xeb8c('0x8e')],'as':_0xeb8c('0xf6'),'required':![]},{'model':db[_0xeb8c('0xd8')],'as':_0xeb8c('0x124'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x310ff1);})[_0xeb8c('0x35')](function(_0x22452c){_0x1ef128['rows']=_0x22452c;return _0x1ef128;});}})['then'](respondWithFilteredResult(_0x23192c,_0x310ff1))['catch'](handleError(_0x23192c,null));};exports[_0xeb8c('0x125')]=function(_0x5aeec7,_0x10b36a,_0x497a73){return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x5aeec7[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x10b36a,null))[_0xeb8c('0x35')](function(_0xd97844){if(_0xd97844){return _0xd97844[_0xeb8c('0x125')](_0x5aeec7['body'][_0xeb8c('0x70')],_[_0xeb8c('0xf4')](_0x5aeec7[_0xeb8c('0x5c')],[_0xeb8c('0x70'),'id'])||{})[_0xeb8c('0xb6')](function(_0x3ad9b2){for(var _0x10aeb7=0x0;_0x10aeb7<_0x5aeec7[_0xeb8c('0x5c')][_0xeb8c('0x70')][_0xeb8c('0x4b')];_0x10aeb7+=0x1){socket[_0xeb8c('0x126')](_0xeb8c('0x127'),{'UserId':Number(_0x5aeec7['body'][_0xeb8c('0x70')][_0x10aeb7]),'ChatWebsiteId':Number(_0x5aeec7['params']['id'])});}return _0x3ad9b2;});}})[_0xeb8c('0x35')](respondWithResult(_0x10b36a,null))[_0xeb8c('0x27')](handleError(_0x10b36a,null));};exports[_0xeb8c('0x128')]=function(_0x1e967d,_0x351119,_0x1bfd4b){return db[_0xeb8c('0x40')][_0xeb8c('0x5a')]({'where':{'id':_0x1e967d[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x351119,null))[_0xeb8c('0x35')](function(_0x2e0fc6){if(_0x2e0fc6){return _0x2e0fc6['removeAgents'](_0x1e967d[_0xeb8c('0x45')][_0xeb8c('0x70')])[_0xeb8c('0x35')](function(){if(_['isArray'](_0x1e967d[_0xeb8c('0x45')][_0xeb8c('0x70')])){for(var _0xbac7d8=0x0;_0xbac7d8<_0x1e967d[_0xeb8c('0x45')][_0xeb8c('0x70')][_0xeb8c('0x4b')];_0xbac7d8+=0x1){socket[_0xeb8c('0x126')](_0xeb8c('0x129'),{'UserId':Number(_0x1e967d['query'][_0xeb8c('0x70')][_0xbac7d8]),'ChatWebsiteId':Number(_0x1e967d[_0xeb8c('0x58')]['id'])});}}else{socket[_0xeb8c('0x126')](_0xeb8c('0x129'),{'UserId':Number(_0x1e967d['query'][_0xeb8c('0x70')]),'ChatWebsiteId':Number(_0x1e967d[_0xeb8c('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x351119,null))[_0xeb8c('0x27')](handleError(_0x351119,null));};exports['getAgents']=function(_0x3eec96,_0x210e1f,_0x3ea603){var _0x2deb75={};var _0x42cd4b={};var _0x3ac56c;var _0x40b1f5;return db[_0xeb8c('0x40')][_0xeb8c('0x67')]({'where':{'id':_0x3eec96[_0xeb8c('0x58')]['id']}})[_0xeb8c('0x35')](handleEntityNotFound(_0x210e1f,null))[_0xeb8c('0x35')](function(_0x285e20){if(_0x285e20){_0x3ac56c=_0x285e20;_0x42cd4b['model']=_['keys'](db['User'][_0xeb8c('0x59')]);_0x42cd4b[_0xeb8c('0x45')]=_[_0xeb8c('0x44')](_0x3eec96[_0xeb8c('0x45')]);_0x42cd4b[_0xeb8c('0x46')]=_[_0xeb8c('0x47')](_0x42cd4b[_0xeb8c('0x48')],_0x42cd4b[_0xeb8c('0x45')]);_0x2deb75[_0xeb8c('0x49')]=_[_0xeb8c('0x47')](_0x42cd4b[_0xeb8c('0x48')],qs[_0xeb8c('0x4a')](_0x3eec96[_0xeb8c('0x45')][_0xeb8c('0x4a')]));_0x2deb75[_0xeb8c('0x49')]=_0x2deb75[_0xeb8c('0x49')][_0xeb8c('0x4b')]?_0x2deb75['attributes']:_0x42cd4b[_0xeb8c('0x48')];_0x2deb75[_0xeb8c('0x69')]=qs[_0xeb8c('0x4d')](_0x3eec96[_0xeb8c('0x45')][_0xeb8c('0x4d')]);_0x2deb75['where']=qs['filters'](_[_0xeb8c('0x4e')](_0x3eec96['query'],_0x42cd4b[_0xeb8c('0x46')]));if(_0x3eec96[_0xeb8c('0x45')]['filter']){_0x2deb75['where']=_[_0xeb8c('0x52')](_0x2deb75['where'],{'$or':_[_0xeb8c('0x3f')](_0x2deb75['attributes'],function(_0x564b63){var _0x2b6f82={};_0x2b6f82[_0x564b63]={'$like':'%'+_0x3eec96['query'][_0xeb8c('0x51')]+'%'};return _0x2b6f82;})});}_0x2deb75=_[_0xeb8c('0x52')]({},_0x2deb75,_0x3eec96[_0xeb8c('0x53')]);return _0x3ac56c[_0xeb8c('0x12a')](_0x2deb75);}})[_0xeb8c('0x35')](function(_0x521d68){if(_0x521d68){_0x40b1f5=_0x521d68[_0xeb8c('0x4b')];if(!_0x3eec96['query'][_0xeb8c('0x4c')](_0xeb8c('0x68'))){_0x2deb75[_0xeb8c('0x2e')]=qs[_0xeb8c('0x2e')](_0x3eec96[_0xeb8c('0x45')][_0xeb8c('0x2e')]);_0x2deb75[_0xeb8c('0x2b')]=qs[_0xeb8c('0x2b')](_0x3eec96[_0xeb8c('0x45')]['offset']);}return _0x3ac56c[_0xeb8c('0x12a')](_0x2deb75);}})['then'](function(_0x14e4b1){if(_0x14e4b1){return _0x14e4b1?{'count':_0x40b1f5,'rows':_0x14e4b1}:null;}})[_0xeb8c('0x35')](respondWithResult(_0x210e1f,null))[_0xeb8c('0x27')](handleError(_0x210e1f,null));}; \ No newline at end of file +var _0xf43e=['Applications','account','applications','list','orderBy','customerIp','headers','cf-connecting-ip','firstName','lastName','x-real-port','browser','version','format','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','contact','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','MailAccountId','subjectOffline','toPairsIn','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-forwarded-for','connection','remoteAddress','replace','render','alignment','color','textColor','color_button','backgroundColor','addApplications','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','spread','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','ChatWebsites','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','systemAvatar','user-agent-parser','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication'];(function(_0x338b26,_0x45d064){var _0x21d9da=function(_0x10c8bb){while(--_0x10c8bb){_0x338b26['push'](_0x338b26['shift']());}};_0x21d9da(++_0x45d064);}(_0xf43e,0x1c7));var _0xef43=function(_0x3c980f,_0x7c2386){_0x3c980f=_0x3c980f-0x0;var _0x10733f=_0xf43e[_0x3c980f];return _0x10733f;};'use strict';var emlformat=require(_0xef43('0x0'));var rimraf=require(_0xef43('0x1'));var zipdir=require(_0xef43('0x2'));var jsonpatch=require(_0xef43('0x3'));var rp=require(_0xef43('0x4'));var moment=require(_0xef43('0x5'));var BPromise=require(_0xef43('0x6'));var Mustache=require(_0xef43('0x7'));var util=require('util');var path=require(_0xef43('0x8'));var sox=require(_0xef43('0x9'));var csv=require(_0xef43('0xa'));var ejs=require(_0xef43('0xb'));var fs=require('fs');var fs_extra=require(_0xef43('0xc'));var _=require('lodash');var squel=require(_0xef43('0xd'));var crypto=require('crypto');var jsforce=require(_0xef43('0xe'));var deskjs=require(_0xef43('0xf'));var toCsv=require(_0xef43('0xa'));var querystring=require(_0xef43('0x10'));var Papa=require(_0xef43('0x11'));var Redis=require(_0xef43('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xef43('0x13'));var hardwareService=require(_0xef43('0x14'));var logger=require(_0xef43('0x15'))(_0xef43('0x16'));var utils=require(_0xef43('0x17'));var config=require(_0xef43('0x18'));var licenseUtil=require(_0xef43('0x19'));var db=require(_0xef43('0x1a'))['db'];config[_0xef43('0x1b')]=_[_0xef43('0x1c')](config[_0xef43('0x1b')],{'host':_0xef43('0x1d'),'port':0x18eb});var socket=require(_0xef43('0x1e'))(new Redis(config[_0xef43('0x1b')]));require(_0xef43('0x1f'))[_0xef43('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xef43('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0xef43('0x22')]({'port':0x232a});var client9003=jayson[_0xef43('0x21')]['http']({'port':0x232b});var client9001=jayson[_0xef43('0x21')][_0xef43('0x22')]({'port':0x2329});function respondWithRpcPromise(_0xacc112,_0x1f4c3,_0x5b30a6,_0x1b1bc3){return new BPromise(function(_0x2157ca,_0x260c75){var _0x565c81=_0x1b1bc3||client;return _0x565c81['request'](_0xacc112,_0x5b30a6)[_0xef43('0x23')](function(_0x5646f7){logger[_0xef43('0x24')](_0xef43('0x25'),_0x1f4c3,_0xef43('0x26'));logger['debug'](_0xef43('0x27'),_0x1f4c3,'request\x20sent',JSON[_0xef43('0x28')](_0x5646f7));if(_0x5646f7[_0xef43('0x29')]){if(_0x5646f7[_0xef43('0x29')][_0xef43('0x2a')]===0x1f4){logger[_0xef43('0x29')](_0xef43('0x25'),_0x1f4c3,_0x5646f7[_0xef43('0x29')]['message']);return _0x260c75(_0x5646f7[_0xef43('0x29')][_0xef43('0x2b')]);}logger['error'](_0xef43('0x25'),_0x1f4c3,_0x5646f7[_0xef43('0x29')][_0xef43('0x2b')]);return _0x2157ca(_0x5646f7[_0xef43('0x29')]['message']);}else{logger[_0xef43('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x1f4c3,_0xef43('0x26'));_0x2157ca(_0x5646f7[_0xef43('0x2c')][_0xef43('0x2b')]);}})[_0xef43('0x2d')](function(_0x200aaf){logger['error'](_0xef43('0x25'),_0x1f4c3,_0x200aaf);_0x260c75(_0x200aaf);});});}function respondWithStatusCode(_0x2f9979,_0x3eff93){_0x3eff93=_0x3eff93||0xcc;return function(_0xfb9cab){if(_0xfb9cab){return _0x2f9979[_0xef43('0x2e')](_0x3eff93);}return _0x2f9979[_0xef43('0x2f')](_0x3eff93)[_0xef43('0x30')]();};}function respondWithResult(_0x49f132,_0x27a1d9){_0x27a1d9=_0x27a1d9||0xc8;return function(_0x1b0ed9){if(_0x1b0ed9){return _0x49f132['status'](_0x27a1d9)[_0xef43('0x31')](_0x1b0ed9);}};}function respondWithFilteredResult(_0x158e7b,_0x23575c){return function(_0x5b5918){if(_0x5b5918){var _0x36c018=typeof _0x23575c['offset']===_0xef43('0x32')&&typeof _0x23575c[_0xef43('0x33')]===_0xef43('0x32');var _0xefd7f9=_0x5b5918['count'];var _0x370807=_0x36c018?0x0:_0x23575c[_0xef43('0x34')];var _0x3bbda0=_0x36c018?_0x5b5918[_0xef43('0x35')]:_0x23575c[_0xef43('0x34')]+_0x23575c['limit'];var _0x228a4f;if(_0x3bbda0>=_0xefd7f9){_0x3bbda0=_0xefd7f9;_0x228a4f=0xc8;}else{_0x228a4f=0xce;}_0x158e7b['status'](_0x228a4f);return _0x158e7b[_0xef43('0x36')]('Content-Range',_0x370807+'-'+_0x3bbda0+'/'+_0xefd7f9)['json'](_0x5b5918);}return null;};}function patchUpdates(_0xd558a0){return function(_0x30ee25){try{jsonpatch[_0xef43('0x37')](_0x30ee25,_0xd558a0,!![]);}catch(_0x26bac4){return BPromise[_0xef43('0x38')](_0x26bac4);}return _0x30ee25[_0xef43('0x39')]();};}function saveUpdates(_0x274c91,_0x49117c){return function(_0x2bc110){if(_0x2bc110){return _0x2bc110[_0xef43('0x3a')](_0x274c91)[_0xef43('0x23')](function(_0x177f47){return _0x177f47;});}return null;};}function removeEntity(_0x2d9d9a,_0x20f7a){return function(_0x47b6af){if(_0x47b6af){return _0x47b6af[_0xef43('0x3b')]()['then'](function(){var _0x17162f=_0x47b6af['get']({'plain':!![]});var _0x323442=_0xef43('0x3c');return db[_0xef43('0x3d')]['destroy']({'where':{'type':_0x323442,'resourceId':_0x17162f['id']}})[_0xef43('0x23')](function(){return _0x47b6af;});})[_0xef43('0x23')](function(){_0x2d9d9a[_0xef43('0x2f')](0xcc)[_0xef43('0x30')]();});}};}function handleEntityNotFound(_0x4585b9,_0x58fde9){return function(_0x226e2f){if(!_0x226e2f){_0x4585b9['sendStatus'](0x194);}return _0x226e2f;};}function handleError(_0x29f89f,_0x13904c){_0x13904c=_0x13904c||0x1f4;return function(_0x15ba4a){logger['error'](_0x15ba4a['stack']);if(_0x15ba4a[_0xef43('0x3e')]){delete _0x15ba4a[_0xef43('0x3e')];}_0x29f89f['status'](_0x13904c)[_0xef43('0x3f')](_0x15ba4a);};}exports[_0xef43('0x40')]=function(_0x1d7374,_0x280632){var _0x47e894={'include':[{'model':db[_0xef43('0x41')],'as':_0xef43('0x42')}]},_0x5bd1ff={},_0x34dd4f={'count':0x0,'rows':[]};var _0x4c0a84=_[_0xef43('0x43')](db[_0xef43('0x44')][_0xef43('0x45')],function(_0x5000cd){return{'name':_0x5000cd[_0xef43('0x46')],'type':_0x5000cd[_0xef43('0x47')][_0xef43('0x48')]};});_0x5bd1ff[_0xef43('0x49')]=_[_0xef43('0x43')](_0x4c0a84,_0xef43('0x3e'));_0x5bd1ff['query']=_['keys'](_0x1d7374[_0xef43('0x4a')]);_0x5bd1ff[_0xef43('0x4b')]=_[_0xef43('0x4c')](_0x5bd1ff[_0xef43('0x49')],_0x5bd1ff['query']);_0x47e894[_0xef43('0x4d')]=_['intersection'](_0x5bd1ff['model'],qs[_0xef43('0x4e')](_0x1d7374['query']['fields']));_0x47e894[_0xef43('0x4d')]=_0x47e894['attributes'][_0xef43('0x4f')]?_0x47e894[_0xef43('0x4d')]:_0x5bd1ff['model'];if(!_0x1d7374[_0xef43('0x4a')]['hasOwnProperty'](_0xef43('0x50'))){_0x47e894[_0xef43('0x33')]=qs[_0xef43('0x33')](_0x1d7374[_0xef43('0x4a')]['limit']);_0x47e894[_0xef43('0x34')]=qs[_0xef43('0x34')](_0x1d7374[_0xef43('0x4a')]['offset']);}_0x47e894[_0xef43('0x51')]=qs[_0xef43('0x52')](_0x1d7374['query'][_0xef43('0x52')]);_0x47e894['where']=qs['filters'](_[_0xef43('0x53')](_0x1d7374[_0xef43('0x4a')],_0x5bd1ff[_0xef43('0x4b')]),_0x4c0a84);if(_0x1d7374[_0xef43('0x4a')][_0xef43('0x54')]){_0x47e894[_0xef43('0x55')]=_['merge'](_0x47e894[_0xef43('0x55')],{'$or':_['map'](_0x4c0a84,function(_0x35f00f){if(_0x35f00f[_0xef43('0x47')]!=='VIRTUAL'){var _0x3e9a05={};_0x3e9a05[_0x35f00f['name']]={'$like':'%'+_0x1d7374[_0xef43('0x4a')][_0xef43('0x54')]+'%'};return _0x3e9a05;}})});}_0x47e894=_[_0xef43('0x56')]({},_0x47e894,_0x1d7374[_0xef43('0x57')]);var _0x3d6731={'where':_0x47e894[_0xef43('0x55')]};return db[_0xef43('0x44')]['count'](_0x3d6731)[_0xef43('0x23')](function(_0xa929c2){_0x34dd4f[_0xef43('0x35')]=_0xa929c2;if(_0x1d7374[_0xef43('0x4a')][_0xef43('0x58')]){_0x47e894[_0xef43('0x59')]=[{'all':!![]}];}return db[_0xef43('0x44')]['findAll'](_0x47e894);})[_0xef43('0x23')](function(_0x406d21){_0x34dd4f[_0xef43('0x5a')]=_0x406d21;return _0x34dd4f;})['then'](respondWithFilteredResult(_0x280632,_0x47e894))[_0xef43('0x2d')](handleError(_0x280632,null));};exports['show']=function(_0x36cfe0,_0x2b59bb){var _0x542428={'raw':![],'where':{'id':_0x36cfe0[_0xef43('0x5b')]['id']},'include':[{'model':db[_0xef43('0x41')],'as':_0xef43('0x42')}]},_0xf5cce9={};_0xf5cce9[_0xef43('0x49')]=_[_0xef43('0x5c')](db[_0xef43('0x44')][_0xef43('0x45')]);_0xf5cce9[_0xef43('0x4a')]=_[_0xef43('0x5c')](_0x36cfe0[_0xef43('0x4a')]);_0xf5cce9['filters']=_['intersection'](_0xf5cce9[_0xef43('0x49')],_0xf5cce9[_0xef43('0x4a')]);_0x542428[_0xef43('0x4d')]=_[_0xef43('0x4c')](_0xf5cce9['model'],qs['fields'](_0x36cfe0['query'][_0xef43('0x4e')]));_0x542428[_0xef43('0x4d')]=_0x542428[_0xef43('0x4d')][_0xef43('0x4f')]?_0x542428[_0xef43('0x4d')]:_0xf5cce9[_0xef43('0x49')];if(_0x36cfe0[_0xef43('0x4a')]['includeAll']){_0x542428['include']=[{'all':!![]}];}_0x542428=_['merge']({},_0x542428,_0x36cfe0['options']);return db[_0xef43('0x44')]['find'](_0x542428)[_0xef43('0x23')](handleEntityNotFound(_0x2b59bb,null))[_0xef43('0x23')](respondWithResult(_0x2b59bb,null))[_0xef43('0x2d')](handleError(_0x2b59bb,null));};exports[_0xef43('0x5d')]=function(_0x48fc9d,_0x2e0c60){return db['ChatWebsite'][_0xef43('0x5d')](_0x48fc9d[_0xef43('0x5e')],{})[_0xef43('0x23')](function(_0x4fca79){var _0x373910=_0x48fc9d[_0xef43('0x5f')][_0xef43('0x60')]({'plain':!![]});if(!_0x373910)throw new Error(_0xef43('0x61'));if(_0x373910[_0xef43('0x62')]===_0xef43('0x5f')){var _0x5b77ee=_0x4fca79[_0xef43('0x60')]({'plain':!![]});var _0x39ae9e=_0xef43('0x3c');return db[_0xef43('0x63')][_0xef43('0x64')]({'where':{'name':_0x39ae9e,'userProfileId':_0x373910[_0xef43('0x65')]},'raw':!![]})[_0xef43('0x23')](function(_0x4bd50b){if(_0x4bd50b&&_0x4bd50b[_0xef43('0x66')]===0x0){return db[_0xef43('0x3d')][_0xef43('0x5d')]({'name':_0x5b77ee[_0xef43('0x3e')],'resourceId':_0x5b77ee['id'],'type':_0x4bd50b[_0xef43('0x3e')],'sectionId':_0x4bd50b['id']},{})[_0xef43('0x23')](function(){return _0x4fca79;});}else{return _0x4fca79;}})[_0xef43('0x2d')](function(_0x1b8248){logger[_0xef43('0x29')](_0xef43('0x67'),_0x1b8248);throw _0x1b8248;});}return _0x4fca79;})[_0xef43('0x23')](respondWithResult(_0x2e0c60,0xc9))[_0xef43('0x2d')](handleError(_0x2e0c60,null));};exports['update']=function(_0x3485a5,_0x2752ac){if(_0x3485a5[_0xef43('0x5e')]['id']){delete _0x3485a5[_0xef43('0x5e')]['id'];}return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x3485a5[_0xef43('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2752ac,null))['then'](saveUpdates(_0x3485a5[_0xef43('0x5e')],null))[_0xef43('0x23')](respondWithResult(_0x2752ac,null))['catch'](handleError(_0x2752ac,null));};exports['destroy']=function(_0x18af37,_0x3995d7){return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x18af37[_0xef43('0x5b')]['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x3995d7,null))[_0xef43('0x23')](removeEntity(_0x3995d7,null))[_0xef43('0x2d')](handleError(_0x3995d7,null));};exports[_0xef43('0x68')]=function(_0x348735,_0x32814f){return db[_0xef43('0x44')][_0xef43('0x68')]()[_0xef43('0x23')](respondWithResult(_0x32814f,null))[_0xef43('0x2d')](handleError(_0x32814f,null));};exports['addDisposition']=function(_0xaa160f,_0x4f8e75,_0x3c4e15){if(_0xaa160f[_0xef43('0x5e')]['id']){delete _0xaa160f[_0xef43('0x5e')]['id'];}return db[_0xef43('0x44')]['find']({'where':{'id':_0xaa160f['params']['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x4f8e75,null))['then'](function(_0x28fe29){if(_0x28fe29){_0xaa160f[_0xef43('0x5e')][_0xef43('0x69')]=_0x28fe29['id'];return db[_0xef43('0x6a')][_0xef43('0x5d')](_0xaa160f[_0xef43('0x5e')]);}})[_0xef43('0x23')](respondWithResult(_0x4f8e75,null))[_0xef43('0x2d')](handleError(_0x4f8e75,null));};exports['getDispositions']=function(_0x268949,_0x16fb58,_0x292f1f){var _0x4d3f87={'raw':![],'where':{}};var _0x14e9ad={};var _0x1a1a65={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xef43('0x6b')]({'where':{'id':_0x268949[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x16fb58,null))['then'](function(_0x29c304){if(_0x29c304){_0x14e9ad[_0xef43('0x49')]=_[_0xef43('0x5c')](db[_0xef43('0x6a')][_0xef43('0x45')]);_0x14e9ad[_0xef43('0x4a')]=_[_0xef43('0x5c')](_0x268949[_0xef43('0x4a')]);_0x14e9ad[_0xef43('0x4b')]=_[_0xef43('0x4c')](_0x14e9ad[_0xef43('0x49')],_0x14e9ad[_0xef43('0x4a')]);_0x4d3f87['attributes']=_['intersection'](_0x14e9ad['model'],qs[_0xef43('0x4e')](_0x268949[_0xef43('0x4a')][_0xef43('0x4e')]));_0x4d3f87[_0xef43('0x4d')]=_0x4d3f87['attributes'][_0xef43('0x4f')]?_0x4d3f87['attributes']:_0x14e9ad['model'];if(!_0x268949[_0xef43('0x4a')][_0xef43('0x6c')](_0xef43('0x50'))){_0x4d3f87[_0xef43('0x33')]=qs[_0xef43('0x33')](_0x268949[_0xef43('0x4a')]['limit']);_0x4d3f87[_0xef43('0x34')]=qs['offset'](_0x268949[_0xef43('0x4a')][_0xef43('0x34')]);}_0x4d3f87[_0xef43('0x51')]=qs[_0xef43('0x52')](_0x268949[_0xef43('0x4a')][_0xef43('0x52')]);_0x4d3f87[_0xef43('0x55')]=qs[_0xef43('0x4b')](_[_0xef43('0x53')](_0x268949[_0xef43('0x4a')],_0x14e9ad[_0xef43('0x4b')]));_0x4d3f87[_0xef43('0x55')][_0xef43('0x69')]=_0x29c304['id'];if(_0x268949['query']['filter']){_0x4d3f87[_0xef43('0x55')]=_[_0xef43('0x56')](_0x4d3f87['where'],{'$or':_[_0xef43('0x43')](_0x4d3f87[_0xef43('0x4d')],function(_0x39d243){var _0x31fe79={};_0x31fe79[_0x39d243]={'$like':'%'+_0x268949[_0xef43('0x4a')][_0xef43('0x54')]+'%'};return _0x31fe79;})});}_0x4d3f87=_[_0xef43('0x56')]({},_0x4d3f87,_0x268949[_0xef43('0x57')]);return db['Disposition']['count']({'where':_0x4d3f87[_0xef43('0x55')]})[_0xef43('0x23')](function(_0x34c9ac){_0x1a1a65['count']=_0x34c9ac;if(_0x268949[_0xef43('0x4a')][_0xef43('0x58')]){_0x4d3f87[_0xef43('0x59')]=[{'all':!![]}];}return db[_0xef43('0x6a')][_0xef43('0x6d')](_0x4d3f87);})[_0xef43('0x23')](function(_0x11f004){_0x1a1a65[_0xef43('0x5a')]=_0x11f004;return _0x1a1a65;});}})[_0xef43('0x23')](respondWithFilteredResult(_0x16fb58,_0x4d3f87))['catch'](handleError(_0x16fb58,null));};exports['removeDispositions']=function(_0x5727c6,_0x622dba,_0x5067d9){return db['ChatWebsite']['find']({'where':{'id':_0x5727c6[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x622dba,null))[_0xef43('0x23')](function(_0xd23b94){if(_0xd23b94){return _0xd23b94[_0xef43('0x6e')](_0x5727c6[_0xef43('0x4a')][_0xef43('0x6f')]);}})[_0xef43('0x23')](respondWithStatusCode(_0x622dba,null))[_0xef43('0x2d')](handleError(_0x622dba,null));};exports[_0xef43('0x70')]=function(_0x4fe2b7,_0x26e360,_0x3ed7bf){if(_0x4fe2b7[_0xef43('0x5e')]['id']){delete _0x4fe2b7[_0xef43('0x5e')]['id'];}return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x4fe2b7['params']['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x26e360,null))['then'](function(_0x24710f){if(_0x24710f){_0x4fe2b7[_0xef43('0x5e')][_0xef43('0x69')]=_0x24710f['id'];return db['CannedAnswer']['create'](_0x4fe2b7[_0xef43('0x5e')]);}})['then'](respondWithResult(_0x26e360,null))[_0xef43('0x2d')](handleError(_0x26e360,null));};exports[_0xef43('0x71')]=function(_0x275a44,_0x886a70,_0xb2af9){var _0x29034b={'raw':![],'where':{}};var _0x64b2b4={};var _0x4e3342={'count':0x0,'rows':[]};return db[_0xef43('0x44')][_0xef43('0x6b')]({'where':{'id':_0x275a44[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x886a70,null))[_0xef43('0x23')](function(_0x26988a){if(_0x26988a){_0x64b2b4[_0xef43('0x49')]=_[_0xef43('0x5c')](db[_0xef43('0x72')][_0xef43('0x45')]);_0x64b2b4[_0xef43('0x4a')]=_[_0xef43('0x5c')](_0x275a44[_0xef43('0x4a')]);_0x64b2b4[_0xef43('0x4b')]=_['intersection'](_0x64b2b4[_0xef43('0x49')],_0x64b2b4[_0xef43('0x4a')]);_0x29034b[_0xef43('0x4d')]=_[_0xef43('0x4c')](_0x64b2b4[_0xef43('0x49')],qs[_0xef43('0x4e')](_0x275a44[_0xef43('0x4a')][_0xef43('0x4e')]));_0x29034b[_0xef43('0x4d')]=_0x29034b['attributes']['length']?_0x29034b[_0xef43('0x4d')]:_0x64b2b4[_0xef43('0x49')];if(!_0x275a44[_0xef43('0x4a')][_0xef43('0x6c')](_0xef43('0x50'))){_0x29034b['limit']=qs[_0xef43('0x33')](_0x275a44[_0xef43('0x4a')][_0xef43('0x33')]);_0x29034b[_0xef43('0x34')]=qs['offset'](_0x275a44[_0xef43('0x4a')][_0xef43('0x34')]);}_0x29034b[_0xef43('0x51')]=qs[_0xef43('0x52')](_0x275a44['query'][_0xef43('0x52')]);_0x29034b[_0xef43('0x55')]=qs['filters'](_['pick'](_0x275a44[_0xef43('0x4a')],_0x64b2b4[_0xef43('0x4b')]));_0x29034b[_0xef43('0x55')][_0xef43('0x69')]=_0x26988a['id'];if(_0x275a44['query'][_0xef43('0x54')]){_0x29034b['where']=_['merge'](_0x29034b[_0xef43('0x55')],{'$or':_['map'](_0x29034b['attributes'],function(_0x204686){var _0x13d5e8={};_0x13d5e8[_0x204686]={'$like':'%'+_0x275a44[_0xef43('0x4a')][_0xef43('0x54')]+'%'};return _0x13d5e8;})});}_0x29034b=_[_0xef43('0x56')]({},_0x29034b,_0x275a44[_0xef43('0x57')]);return db['CannedAnswer']['count']({'where':_0x29034b[_0xef43('0x55')]})[_0xef43('0x23')](function(_0x221382){_0x4e3342['count']=_0x221382;if(_0x275a44[_0xef43('0x4a')][_0xef43('0x58')]){_0x29034b[_0xef43('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xef43('0x6d')](_0x29034b);})['then'](function(_0x4ed227){_0x4e3342[_0xef43('0x5a')]=_0x4ed227;return _0x4e3342;});}})['then'](respondWithFilteredResult(_0x886a70,_0x29034b))[_0xef43('0x2d')](handleError(_0x886a70,null));};exports[_0xef43('0x73')]=function(_0x2532b2,_0x2dbde3,_0x38b70d){return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x2532b2[_0xef43('0x5b')]['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x2dbde3,null))['then'](function(_0xf72e20){if(_0xf72e20){return _0xf72e20[_0xef43('0x73')](_0x2532b2[_0xef43('0x4a')]['ids']);}})[_0xef43('0x23')](respondWithStatusCode(_0x2dbde3,null))['catch'](handleError(_0x2dbde3,null));};exports['addLogo']=function(_0x52fec6,_0x49c602,_0x4d80f9){_0x52fec6[_0xef43('0x5e')][_0xef43('0x74')]=_0x52fec6[_0xef43('0x75')][_0xef43('0x76')];return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x52fec6[_0xef43('0x5b')]['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x49c602,null))[_0xef43('0x23')](saveUpdates(_0x52fec6[_0xef43('0x5e')],null))[_0xef43('0x23')](respondWithResult(_0x49c602,null))[_0xef43('0x2d')](handleError(_0x49c602,null));};exports[_0xef43('0x77')]=function(_0x36fe72,_0x16aebf,_0x15a268){_0x36fe72[_0xef43('0x5e')][_0xef43('0x78')]=_0x36fe72[_0xef43('0x75')][_0xef43('0x76')];return db['ChatWebsite']['find']({'where':{'id':_0x36fe72[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x16aebf,null))['then'](saveUpdates(_0x36fe72[_0xef43('0x5e')],null))['then'](respondWithResult(_0x16aebf,null))[_0xef43('0x2d')](handleError(_0x16aebf,null));};exports[_0xef43('0x79')]=function(_0x40babe,_0x3dd709,_0x4ea999){_0x40babe[_0xef43('0x5e')][_0xef43('0x7a')]=_0x40babe['file'][_0xef43('0x76')];return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x40babe[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3dd709,null))['then'](saveUpdates(_0x40babe[_0xef43('0x5e')],null))['then'](respondWithResult(_0x3dd709,null))[_0xef43('0x2d')](handleError(_0x3dd709,null));};exports[_0xef43('0x7b')]=function(_0x86ea3c,_0x55bb4f,_0x2ca233){_0x86ea3c[_0xef43('0x5e')]['systemAvatar']=_0x86ea3c['file'][_0xef43('0x76')];return db[_0xef43('0x44')]['find']({'where':{'id':_0x86ea3c[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x55bb4f,null))[_0xef43('0x23')](saveUpdates(_0x86ea3c[_0xef43('0x5e')],null))[_0xef43('0x23')](respondWithResult(_0x55bb4f,null))[_0xef43('0x2d')](handleError(_0x55bb4f,null));};exports[_0xef43('0x7c')]=function(_0xe4139f,_0x315b5d,_0x57b1cc){var _0x2f026c=path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0x7f'));var _0x4b1ec2={'where':{'id':_0xe4139f[_0xef43('0x5b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x46f5ba=![];return require(_0xef43('0x19'))[_0xef43('0x80')]()['then'](function(_0x27d269){if(_0x27d269){_0x46f5ba=_0x27d269[_0xef43('0x81')];}})['then'](function(){return db['ChatWebsite'][_0xef43('0x64')](_0x4b1ec2);})['then'](handleEntityNotFound(_0x315b5d,null))['then'](function(_0x297e07){if(_0x297e07){if(!_[_0xef43('0x82')](_0x297e07[_0xef43('0x74')])){if(fs[_0xef43('0x83')](path[_0xef43('0x7d')](config['root'],'server/files/images/logos/',_0x297e07[_0xef43('0x74')]))&&_0x46f5ba){_0x2f026c=path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0x84'),_0x297e07[_0xef43('0x74')]);}}return _0x315b5d[_0xef43('0x85')](_0x2f026c);}})[_0xef43('0x2d')](handleError(_0x315b5d,null));};exports[_0xef43('0x86')]=function(_0x1de6ff,_0x2c99ea,_0x4e9c3a){var _0x3ec9ae=path['join'](config[_0xef43('0x7e')],'server/files/images/avatars/default_avatar.png');var _0x2ea535={'where':{'id':_0x1de6ff[_0xef43('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xef43('0x44')][_0xef43('0x64')](_0x2ea535)[_0xef43('0x23')](handleEntityNotFound(_0x2c99ea,null))[_0xef43('0x23')](function(_0x5b3637){if(_0x5b3637){if(!_[_0xef43('0x82')](_0x5b3637[_0xef43('0x78')])){if(fs['existsSync'](path['join'](config[_0xef43('0x7e')],_0xef43('0x87'),_0x5b3637[_0xef43('0x78')]))){_0x3ec9ae=path[_0xef43('0x7d')](config['root'],_0xef43('0x87'),_0x5b3637[_0xef43('0x78')]);}}return _0x2c99ea[_0xef43('0x85')](_0x3ec9ae);}})[_0xef43('0x2d')](handleError(_0x2c99ea,null));};exports[_0xef43('0x88')]=function(_0x169c11,_0x10c19d,_0x3c911f){var _0x48807f=path['join'](config[_0xef43('0x7e')],_0xef43('0x89'));var _0x3fea5c={'where':{'id':_0x169c11[_0xef43('0x5b')]['id']},'attributes':['id',_0xef43('0x7a'),_0xef43('0x8a')],'raw':!![]};return db[_0xef43('0x44')][_0xef43('0x64')](_0x3fea5c)['then'](handleEntityNotFound(_0x10c19d,null))[_0xef43('0x23')](function(_0x41a641){if(_0x41a641){if(!_[_0xef43('0x82')](_0x41a641['customerAvatar'])){if(fs[_0xef43('0x83')](path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0x87'),_0x41a641[_0xef43('0x7a')]))&&_0x41a641[_0xef43('0x8a')]){_0x48807f=path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0x87'),_0x41a641[_0xef43('0x7a')]);}}return _0x10c19d[_0xef43('0x85')](_0x48807f);}})[_0xef43('0x2d')](handleError(_0x10c19d,null));};exports['getSystemAvatar']=function(_0x1a8add,_0x39bbef,_0x18c8c3){var _0x1bc8d7=path[_0xef43('0x7d')](config[_0xef43('0x7e')],'server/files/images/avatars/system_avatar.png');var _0x329a85={'where':{'id':_0x1a8add[_0xef43('0x5b')]['id']},'attributes':['id',_0xef43('0x8b')],'raw':!![]};return db[_0xef43('0x44')][_0xef43('0x64')](_0x329a85)[_0xef43('0x23')](handleEntityNotFound(_0x39bbef,null))['then'](function(_0x32b1dd){if(_0x32b1dd){if(!_[_0xef43('0x82')](_0x32b1dd[_0xef43('0x8b')])){if(fs[_0xef43('0x83')](path['join'](config[_0xef43('0x7e')],_0xef43('0x87'),_0x32b1dd[_0xef43('0x8b')]))){_0x1bc8d7=path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0x87'),_0x32b1dd['systemAvatar']);}}return _0x39bbef[_0xef43('0x85')](_0x1bc8d7);}})[_0xef43('0x2d')](handleError(_0x39bbef,null));};exports['notify']=function(_0x1dd6ef,_0x277fc1,_0xa08434){var _0x44665b=require(_0xef43('0x8c'));var _0x130336=new _0x44665b();var _0x46fe9c=_0x130336['setUA'](_0x1dd6ef['headers']['user-agent'])[_0xef43('0x8d')]();var _0x5cd84f={'body':_0x1dd6ef['body'],'channel':_0xef43('0x8e')};var _0x400cd0=[];var _0x27f67b=[];var _0x4b1635={};var _0x36dbae=![];return db[_0xef43('0x8f')][_0xef43('0x68')]()[_0xef43('0x23')](function(_0x2633dd){if(!_0x2633dd){throw new db[(_0xef43('0x90'))][(_0xef43('0x91'))](_0xef43('0x92'));}_0x400cd0=_[_0xef43('0x93')](_['keys'](_0x2633dd),['createdAt',_0xef43('0x94')]);_0x27f67b=_['difference'](_[_0xef43('0x5c')](_0x2633dd),[_0xef43('0x95'),_0xef43('0x94'),_0xef43('0x96'),_0xef43('0x97')]);if(_0x1dd6ef[_0xef43('0x5e')]['id']){delete _0x1dd6ef['body']['id'];}if(_[_0xef43('0x82')](_0x1dd6ef['body'][_0xef43('0x98')])){throw new db[(_0xef43('0x90'))][(_0xef43('0x91'))](_0xef43('0x99'));}if(_[_0xef43('0x82')](_0x1dd6ef[_0xef43('0x5e')]['body'])||_0x1dd6ef['body'][_0xef43('0x5e')]===''){throw new db[(_0xef43('0x90'))][(_0xef43('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xef43('0x82')](_0x1dd6ef[_0xef43('0x5e')][_0xef43('0x9a')])){throw new db[(_0xef43('0x90'))]['ValidationError'](_0xef43('0x9b')+_0x27f67b);}if(!_[_0xef43('0x9c')](_0x27f67b,_0x1dd6ef[_0xef43('0x5e')]['mapKey'])){throw new db['Sequelize'][(_0xef43('0x91'))](_0xef43('0x9d')+_0x27f67b);}_0x4b1635[_0x1dd6ef[_0xef43('0x5e')][_0xef43('0x9a')]]=_0x1dd6ef[_0xef43('0x5e')][_0xef43('0x98')];})[_0xef43('0x23')](function(){return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x1dd6ef[_0xef43('0x5b')]['id']},'include':[{'model':db[_0xef43('0x9e')],'as':_0xef43('0x9f'),'include':[{'model':db[_0xef43('0x8f')],'as':_0xef43('0xa0'),'where':_0x4b1635,'limit':0x1,'order':[[_0xef43('0x94'),_0xef43('0xa1')]]}]},{'model':db[_0xef43('0xa2')],'as':_0xef43('0xa3')}]});})[_0xef43('0x23')](handleEntityNotFound(_0x277fc1,null))[_0xef43('0x23')](function(_0x4de32e){if(_0x4de32e&&_0x4de32e['List']){_0x5cd84f[_0xef43('0xa4')]=_0x4de32e;_0x5cd84f[_0xef43('0xa5')]=_0x4de32e[_0xef43('0xa3')];_0x5cd84f[_0xef43('0xa6')]=_0x4de32e[_0xef43('0x9f')];_0x5cd84f[_0xef43('0xa5')]=_[_0xef43('0xa7')](_0x5cd84f['applications'],['priority'],['asc']);if(_0x5cd84f[_0xef43('0xa4')][_0xef43('0xa3')]){delete _0x5cd84f[_0xef43('0xa4')][_0xef43('0xa3')];}if(_0x5cd84f[_0xef43('0xa4')][_0xef43('0x9f')]&&_0x5cd84f[_0xef43('0xa4')][_0xef43('0x9f')][_0xef43('0xa0')][_0xef43('0x4f')]){return _0x5cd84f[_0xef43('0xa4')][_0xef43('0x9f')]['Contacts'][0x0];}var _0xf7c850=_[_0xef43('0x1c')](_0x1dd6ef[_0xef43('0x5e')],{'firstName':_0x1dd6ef[_0xef43('0x5e')]['from'],'ListId':_0x4de32e[_0xef43('0x97')]});_0xf7c850[_0x1dd6ef['body'][_0xef43('0x9a')]]=_0x1dd6ef['body'][_0xef43('0x98')];return db[_0xef43('0x8f')][_0xef43('0x5d')](_0xf7c850,{'fields':_0x400cd0,'raw':!![]});}})[_0xef43('0x23')](handleEntityNotFound(_0x277fc1,null))[_0xef43('0x23')](function(_0x5b6cd5){_0x5cd84f['contact']=_0x5b6cd5;var _0x17f862=_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xa8')];if(_0x1dd6ef[_0xef43('0xa9')][_0xef43('0xaa')]){_0x17f862=_0x1dd6ef[_0xef43('0xa9')][_0xef43('0xaa')];}else if(_0x1dd6ef[_0xef43('0xa9')]['x-forwarded-for']){_0x17f862=_['first'](_0x1dd6ef[_0xef43('0xa9')]['x-forwarded-for']['split'](','));}if(_0x5b6cd5){var _0x9e8494={'ContactId':_0x5b6cd5['id'],'ChatWebsiteId':_0x1dd6ef[_0xef43('0x5b')]['id'],'from':(_0x5b6cd5[_0xef43('0xab')]||'')+'\x20'+(_0x5b6cd5[_0xef43('0xac')]||''),'customerIp':_0x17f862,'customerPort':_0x1dd6ef[_0xef43('0xa9')][_0xef43('0xad')]?_0x1dd6ef[_0xef43('0xa9')][_0xef43('0xad')]:null,'referer':_0x1dd6ef[_0xef43('0x5e')]['referer'],'browserName':_0x46fe9c[_0xef43('0xae')][_0xef43('0x3e')]&&_0x46fe9c[_0xef43('0xae')][_0xef43('0xaf')]?util[_0xef43('0xb0')]('%s\x20%s',_0x46fe9c[_0xef43('0xae')][_0xef43('0x3e')],_0x46fe9c[_0xef43('0xae')][_0xef43('0xaf')]):_0xef43('0xb1'),'browserVersion':_0x46fe9c['browser']['version']||_0xef43('0xb1'),'osName':util[_0xef43('0xb0')](_0xef43('0xb2'),_0x46fe9c['os'][_0xef43('0x3e')],_0x46fe9c['os'][_0xef43('0xaf')]),'osVersion':_0x46fe9c['os'][_0xef43('0xaf')],'deviceModel':_0x46fe9c['device'][_0xef43('0x49')]&&_0x46fe9c[_0xef43('0xb3')]['vendor']?util[_0xef43('0xb0')](_0xef43('0xb4'),_0x46fe9c[_0xef43('0xb3')][_0xef43('0x49')],_0x46fe9c['device'][_0xef43('0xb5')],_0x46fe9c['device'][_0xef43('0x47')]):null,'deviceVendor':_0x46fe9c[_0xef43('0xb3')][_0xef43('0xb5')],'deviceType':_0x46fe9c[_0xef43('0xb3')][_0xef43('0x47')],'formData':JSON[_0xef43('0x28')](_0x1dd6ef[_0xef43('0x5e')])};var _0x27d1a={'ChatWebsiteId':_0x1dd6ef[_0xef43('0x5b')]['id'],'closed':![]};if(_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xb6')]){_0x27d1a[_0xef43('0xb6')]=_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xb6')];return db['ChatInteraction'][_0xef43('0x64')]({'where':_0x27d1a})[_0xef43('0x23')](function(_0xbb04de){if(_0xbb04de){return[_0xbb04de,![]];}_0x9e8494[_0xef43('0xb6')]=_0x1dd6ef['body'][_0xef43('0xb6')];_0x9e8494[_0xef43('0xb7')]=_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xb7')];return db[_0xef43('0xb8')]['create'](_0x9e8494)[_0xef43('0x23')](function(_0x3760b8){return[_0x3760b8,!![]];});});}_0x27d1a[_0xef43('0xb9')]=_0x5b6cd5['id'];if(_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xba')]&&_0x1dd6ef[_0xef43('0x5e')]['interaction']['id']){_0x27d1a['id']=_0x1dd6ef[_0xef43('0x5e')]['interaction']['id'];return db[_0xef43('0xb8')][_0xef43('0x64')]({'where':_0x27d1a})[_0xef43('0x23')](function(_0x1261d6){if(_0x1261d6){return[_0x1261d6,![]];}return db[_0xef43('0xb8')]['create'](_0x9e8494)[_0xef43('0x23')](function(_0x158dc8){return[_0x158dc8,!![]];});});}return db[_0xef43('0xb8')][_0xef43('0x5d')](_0x9e8494)['then'](function(_0x3db783){return[_0x3db783,!![]];});}})['spread'](function(_0x238de5,_0x185d6a){if(_0x238de5){_0x36dbae=_0x185d6a;if(!_0x185d6a){var _0x314a68={'from':(_0x5cd84f[_0xef43('0xbb')][_0xef43('0xab')]||'')+'\x20'+(_0x5cd84f[_0xef43('0xbb')][_0xef43('0xac')]||'')};if(_0x1dd6ef[_0xef43('0x5e')]['threadId']&&_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xbc')]&&_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xb6')]!=_0x1dd6ef[_0xef43('0x5e')][_0xef43('0xbc')]){_0x314a68[_0xef43('0xb6')]=_0x1dd6ef[_0xef43('0x5e')]['messageId'];}return _0x238de5[_0xef43('0x3a')](_0x314a68);}else{return _0x238de5;}}})[_0xef43('0x23')](function(_0x2b0425){_0x5cd84f[_0xef43('0xba')]=_0x2b0425[_0xef43('0x60')]({'plain':!![]});_0x5cd84f[_0xef43('0xba')][_0xef43('0xbd')]=_0x36dbae;if(_0x5cd84f[_0xef43('0xba')][_0xef43('0xbd')]){if(_0x5cd84f[_0xef43('0xa4')]['autoclose']){_0x5cd84f[_0xef43('0xa5')]['push']({'id':0x0,'priority':_0x5cd84f[_0xef43('0xa5')][_0xef43('0x4f')]+0x1,'app':_0xef43('0xbe'),'appdata':_0xef43('0xbf'),'interval':_0xef43('0xc0')});}}return db[_0xef43('0xc1')]['create']({'body':_0x1dd6ef[_0xef43('0x5e')]['body'],'ChatWebsiteId':_0x1dd6ef[_0xef43('0x5b')]['id'],'ChatInteractionId':_0x2b0425['id'],'direction':'in','ContactId':_0x5cd84f[_0xef43('0xbb')]['id'],'AttachmentId':_0x1dd6ef[_0xef43('0x5e')]['AttachmentId']});})[_0xef43('0x23')](function(_0x1d6c6e){_0x5cd84f['message']=_0x1d6c6e;if(_0x5cd84f['interaction'][_0xef43('0xc2')]){return db['User'][_0xef43('0x64')]({'attributes':['id',_0xef43('0x3e')],'where':{'id':_0x5cd84f[_0xef43('0xba')][_0xef43('0xc2')]}})[_0xef43('0x23')](function(_0x179ba8){if(_0x179ba8){_0x5cd84f[_0xef43('0xa5')][_0xef43('0xc3')]({'id':0x0,'priority':0x0,'app':_0xef43('0xc4'),'appdata':_0x179ba8[_0xef43('0x3e')]+','+(_0x5cd84f[_0xef43('0xa4')][_0xef43('0xc5')]||0xa),'interval':_0xef43('0xc0')});_0x5cd84f[_0xef43('0xc6')]=!![];}return respondWithRpcPromise(_0xef43('0xc7'),_0xef43('0xc8'),_0x5cd84f);});}return respondWithRpcPromise(_0xef43('0xc7'),_0xef43('0xc8'),_0x5cd84f);})[_0xef43('0x23')](function(_0x34f43c){respondWithRpcPromise(_0xef43('0xc9'),_0xef43('0xc9'),{'event':_0xef43('0xca'),'message':_0x34f43c},client9002);return _0x34f43c;})['then'](respondWithResult(_0x277fc1,null))[_0xef43('0x2d')](handleError(_0x277fc1,null));};exports[_0xef43('0xcb')]=function(_0xbb5bbb,_0x18d960,_0x599797){var _0x11d576,_0x4bc60d,_0x46f8ae;var _0x1a9c63=[];var _0x329fdb=[];var _0x559c54={};var _0x2f282b=_0xbb5bbb[_0xef43('0xcc')]||[];var _0x48b23d=[];var _0x18d6ac;return db[_0xef43('0x8f')][_0xef43('0x68')]()[_0xef43('0x23')](function(_0x171007){if(!_0x171007){throw new db['Sequelize'][(_0xef43('0x91'))]('no\x20available\x20attributes');}_0x329fdb=_[_0xef43('0x93')](_[_0xef43('0x5c')](_0x171007),['createdAt',_0xef43('0x94')]);_0x1a9c63=_[_0xef43('0x93')](_[_0xef43('0x5c')](_0x171007),['createdAt','updatedAt','CompanyId',_0xef43('0x97')]);if(_0xbb5bbb['body']['id']){delete _0xbb5bbb[_0xef43('0x5e')]['id'];}if(_[_0xef43('0x82')](_0xbb5bbb[_0xef43('0x5e')][_0xef43('0x98')])){throw _0x18d960[_0xef43('0x2f')](0x1f4)[_0xef43('0x3f')](new db[(_0xef43('0x90'))][(_0xef43('0x91'))](_0xef43('0x99')));}if(_['isNil'](_0xbb5bbb[_0xef43('0x5e')][_0xef43('0x5e')])||_0xbb5bbb[_0xef43('0x5e')][_0xef43('0x5e')]===''){throw _0x18d960[_0xef43('0x2f')](0x1f4)['send'](new db[(_0xef43('0x90'))][(_0xef43('0x91'))](_0xef43('0xcd')));}if(_[_0xef43('0x82')](_0xbb5bbb['body']['mapKeyOffline'])){throw _0x18d960[_0xef43('0x2f')](0x1f4)[_0xef43('0x3f')](new db['Sequelize'][(_0xef43('0x91'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1a9c63));}if(!_['includes'](_0x1a9c63,_0xbb5bbb['body'][_0xef43('0xce')])){throw _0x18d960['status'](0x1f4)[_0xef43('0x3f')](new db['Sequelize'][(_0xef43('0x91'))](_0xef43('0xcf')+_0x1a9c63));}_0x559c54[_0xbb5bbb[_0xef43('0x5e')][_0xef43('0xce')]]=_0xbb5bbb['body'][_0xef43('0x98')];})[_0xef43('0x23')](function(){return db[_0xef43('0x44')]['find']({'where':{'id':_0xbb5bbb[_0xef43('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xef43('0x9f')},{'model':db[_0xef43('0xd0')],'as':_0xef43('0xd0')}]});})[_0xef43('0x23')](handleEntityNotFound(_0x18d960,null))[_0xef43('0x23')](function(_0x16a801){if(_0x16a801&&_0x16a801[_0xef43('0x9f')]){_0x4bc60d=_0x16a801;var _0x47dd00=_[_0xef43('0x1c')](_0xbb5bbb[_0xef43('0x5e')],{'firstName':_0xbb5bbb['body']['from'],'phone':_0xbb5bbb[_0xef43('0x5e')][_0xef43('0x98')],'ListId':_0x16a801[_0xef43('0x97')]});_0x47dd00[_0xbb5bbb[_0xef43('0x5e')]['mapKeyOffline']]=_0xbb5bbb[_0xef43('0x5e')]['from'];return db[_0xef43('0x8f')][_0xef43('0xd1')]({'where':_0x559c54,'defaults':_0x47dd00});}})['spread'](function(_0x40a5b3){if(_0x40a5b3){_0x46f8ae=_0x40a5b3;var _0x50a555=fs['readFileSync'](path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0xd2')),_0xef43('0xd3'));var _0x42155d=ejs['render'](_0x50a555,{'body':_['toPairs'](_0xbb5bbb[_0xef43('0x5e')]['body']),'bodyTitle':_0x4bc60d[_0xef43('0xd4')]});return db[_0xef43('0xd5')][_0xef43('0x5d')]({'body':_0x42155d,'ContactId':_0x40a5b3['id'],'ChatWebsiteId':_0x4bc60d['id']});}})['then'](function(_0x3259fb){_0x18d6ac=_0x3259fb;if(_0x2f282b['length']){var _0x41bec6=_0x2f282b[_0xef43('0x43')](function(_0x577cc2){return{'name':_0x577cc2[_0xef43('0xd6')],'basename':_0x577cc2['filename'],'type':_0x577cc2[_0xef43('0xd7')],'ChatOfflineMessageId':_0x3259fb['id']};});_0x48b23d=_0x41bec6[_0xef43('0x43')](_0x3e2e9a=>{var _0x51f683={'filename':_0x3e2e9a[_0xef43('0x3e')],'path':path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0xd8'),'files',_0xef43('0xd9'),'offline-chat',_0x3e2e9a[_0xef43('0xda')])};return _0x51f683;});if(!_0x4bc60d[_0xef43('0xdb')]){return db[_0xef43('0xdc')][_0xef43('0xdd')](function(_0x9968e4){return db[_0xef43('0xde')][_0xef43('0xdf')](_0x41bec6,{'transaction':_0x9968e4});});}}})[_0xef43('0x23')](function(){if(_0x18d6ac){_0x11d576=_0x18d6ac;return db[_0xef43('0xd0')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xef43('0xe0')],'as':_0xef43('0xe1'),'raw':!![]}]});}})[_0xef43('0x23')](function(_0x3c7fa0){if(_0x3c7fa0&&_0x3c7fa0[_0xef43('0xe1')]&&_0x4bc60d[_0xef43('0xe2')]&&_0x4bc60d[_0xef43('0xe3')]){var _0x2e8a1b={'tls':{'rejectUnauthorized':![]}};if(_0x3c7fa0[_0xef43('0xe1')][_0xef43('0xe4')]){_0x2e8a1b[_0xef43('0xe4')]=_0x3c7fa0[_0xef43('0xe1')][_0xef43('0xe4')];}else{_0x2e8a1b[_0xef43('0xe5')]=_0x3c7fa0[_0xef43('0xe1')][_0xef43('0xe5')];_0x2e8a1b[_0xef43('0xe6')]=_0x3c7fa0[_0xef43('0xe1')][_0xef43('0xe6')];_0x2e8a1b['secure']=_0x3c7fa0[_0xef43('0xe1')][_0xef43('0xe7')];}if(_0x3c7fa0[_0xef43('0xe1')][_0xef43('0xe8')]){_0x2e8a1b[_0xef43('0xe9')]={'user':_0x3c7fa0[_0xef43('0xe1')]['user'],'pass':_0x3c7fa0[_0xef43('0xe1')][_0xef43('0xea')]};}return respondWithRpcPromise(_0xef43('0xeb'),_0xef43('0xec'),{'account':_0x2e8a1b,'message':{'from':util[_0xef43('0xb0')]('\x22%s\x22\x20<%s>',_0x3c7fa0[_0xef43('0x3e')],_0x3c7fa0[_0xef43('0xed')]||_0x3c7fa0[_0xef43('0xe1')][_0xef43('0x5f')]),'to':_0x4bc60d[_0xef43('0xe3')],'subject':_0x4bc60d['offlineMessageSubject'],'html':_0x11d576[_0xef43('0x5e')],'attachments':_0x48b23d}},client9003)[_0xef43('0x23')](function(){return _0x11d576;})[_0xef43('0x2d')](function(_0x5cc67f){console[_0xef43('0x29')](_0x5cc67f);});}})[_0xef43('0x23')](function(){if(_0x4bc60d&&_0x4bc60d[_0xef43('0xdb')]&&_0x4bc60d[_0xef43('0xee')]){var _0xfb52d7=[];if(_0x2f282b[_0xef43('0x4f')]){_0xfb52d7=_0x2f282b['map'](function(_0x127984){return{'name':_0x127984[_0xef43('0xd6')],'basename':_0x127984['filename'],'type':_0x127984['mimetype'],'ChatOfflineMessageId':_0x18d6ac['id']};});}var _0x468ff7;if(!_[_0xef43('0x82')](_0x4bc60d[_0xef43('0xef')])){var _0x58cb90=_['map'](_0xbb5bbb[_0xef43('0x5e')],function(_0x1fc5df){return _0x1fc5df;});var _0x2b960c=_[_0xef43('0xf0')](_0x58cb90)[0x0];var _0x41795e=_['mapValues'](_0x2b960c,function(_0x2c273e){return _0x2c273e;});_0x468ff7=_0x41795e[0x1][_0x4bc60d['subjectOffline']];}var _0x5d7919={'from':_0x46f8ae[_0xef43('0xed')],'firstName':_0x46f8ae[_0xef43('0xab')],'lastName':_0x46f8ae['lastName'],'mapKey':_0xef43('0xed'),'message':{'from':_0x46f8ae[_0xef43('0xed')],'to':_0x4bc60d[_0xef43('0xd0')][_0xef43('0xed')],'cc':'','subject':_['isNil'](_0x468ff7)?_0x4bc60d[_0xef43('0xf1')]:_0x468ff7,'messageId':'','sentAt':new Date(),'attach':_0xfb52d7[_0xef43('0x4f')],'attachments':_0xfb52d7,'originChannel':_0xef43('0xf2'),'ChatWebsiteId':_0x4bc60d['id'],'ChatOfflineMessageId':_0x11d576['id'],'originTo':_0x4bc60d[_0xef43('0xd0')][_0xef43('0xed')]},'body':_0x11d576[_0xef43('0x5e')]};var _0x5bb369={'account':{'id':_0x4bc60d[_0xef43('0xee')]},'body':_0x5d7919,'log':_0xef43('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0xef43('0xf4'),_0x5bb369,client9001)[_0xef43('0x23')](function(){return _0x11d576;})['catch'](function(_0x573525){console[_0xef43('0x29')](_0x573525);});}return;})[_0xef43('0x23')](function(){if(_0x11d576){return _0x11d576;}})[_0xef43('0x23')](respondWithResult(_0x18d960,null))[_0xef43('0x2d')](function(_0x3c0b3c){console[_0xef43('0x29')](_0xef43('0x2d'),_0x3c0b3c);for(var _0x2bc0ab of _0x2f282b){var _0x336d2b=path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0xd8'),_0xef43('0xcc'),_0xef43('0xd9'),'offline-chat',_0x2bc0ab[_0xef43('0x76')]);fs_extra[_0xef43('0xf5')](_0x336d2b)[_0xef43('0x2d')](function(_0x2fdc13){console[_0xef43('0x29')](_0xef43('0xf6'),_0x336d2b,_0x2fdc13);});}});};exports[_0xef43('0xf7')]=function(_0x301758,_0x4cd5aa,_0x35e1fe){return db[_0xef43('0xb8')]['find']({'where':{'id':_0x301758['params']['id']}})['then'](handleEntityNotFound(_0x4cd5aa,null))[_0xef43('0x23')](function(_0x103277){if(_0x103277){return _0x103277[_0xef43('0xf7')](_0x301758[_0xef43('0x5e')][_0xef43('0x6f')],_[_0xef43('0xf8')](_0x301758[_0xef43('0x5e')],[_0xef43('0x6f'),'id'])||{});}})[_0xef43('0x23')](respondWithResult(_0x4cd5aa,null))[_0xef43('0x2d')](handleError(_0x4cd5aa,null));};exports[_0xef43('0xf9')]=function(_0xf1449b,_0x23605a,_0x1f4680){var _0x18c3cf={'raw':![],'where':{}};var _0x1f392f={};var _0x9cbf76={'count':0x0,'rows':[]};return db[_0xef43('0x44')][_0xef43('0x6b')]({'where':{'id':_0xf1449b[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x23605a,null))[_0xef43('0x23')](function(_0x2ec982){if(_0x2ec982){_0x1f392f[_0xef43('0x49')]=_[_0xef43('0x5c')](db[_0xef43('0xb8')][_0xef43('0x45')]);_0x1f392f[_0xef43('0x4a')]=_[_0xef43('0x5c')](_0xf1449b['query']);_0x1f392f[_0xef43('0x4b')]=_[_0xef43('0x4c')](_0x1f392f['model'],_0x1f392f[_0xef43('0x4a')]);_0x18c3cf[_0xef43('0x4d')]=_[_0xef43('0x4c')](_0x1f392f[_0xef43('0x49')],qs[_0xef43('0x4e')](_0xf1449b['query']['fields']));_0x18c3cf[_0xef43('0x4d')]=_0x18c3cf[_0xef43('0x4d')][_0xef43('0x4f')]?_0x18c3cf[_0xef43('0x4d')]:_0x1f392f[_0xef43('0x49')];if(!_0xf1449b[_0xef43('0x4a')][_0xef43('0x6c')](_0xef43('0x50'))){_0x18c3cf['limit']=qs[_0xef43('0x33')](_0xf1449b[_0xef43('0x4a')][_0xef43('0x33')]);_0x18c3cf['offset']=qs['offset'](_0xf1449b['query'][_0xef43('0x34')]);}_0x18c3cf[_0xef43('0x51')]=qs[_0xef43('0x52')](_0xf1449b[_0xef43('0x4a')][_0xef43('0x52')]);_0x18c3cf[_0xef43('0x55')]=qs[_0xef43('0x4b')](_[_0xef43('0x53')](_0xf1449b[_0xef43('0x4a')],_0x1f392f[_0xef43('0x4b')]));_0x18c3cf[_0xef43('0x55')][_0xef43('0x69')]=_0x2ec982['id'];if(_0xf1449b['query'][_0xef43('0x54')]){_0x18c3cf[_0xef43('0x55')]=_[_0xef43('0x56')](_0x18c3cf[_0xef43('0x55')],{'$or':_[_0xef43('0x43')](_0x18c3cf['attributes'],function(_0x3faa30){var _0x332eea={};_0x332eea[_0x3faa30]={'$like':'%'+_0xf1449b[_0xef43('0x4a')][_0xef43('0x54')]+'%'};return _0x332eea;})});}_0x18c3cf=_[_0xef43('0x56')]({},_0x18c3cf,_0xf1449b[_0xef43('0x57')]);return db[_0xef43('0xb8')][_0xef43('0x35')]({'where':_0x18c3cf['where']})[_0xef43('0x23')](function(_0x160991){_0x9cbf76[_0xef43('0x35')]=_0x160991;if(_0xf1449b['query']['includeAll']){_0x18c3cf[_0xef43('0x59')]=[{'model':db[_0xef43('0x8f')],'as':_0xef43('0xfa'),'required':![]},{'model':db['User'],'as':_0xef43('0xfb'),'attributes':[_0xef43('0x3e'),_0xef43('0xfc'),_0xef43('0xfd')],'required':![]},{'model':db[_0xef43('0xfe')],'as':_0xef43('0xff'),'attributes':['id','name','color'],'where':_0xf1449b['query'][_0xef43('0x100')]?{'id':_0xf1449b[_0xef43('0x4a')][_0xef43('0x100')]}:undefined,'required':_0xf1449b[_0xef43('0x4a')][_0xef43('0x100')]?!![]:![]}];}return db['ChatInteraction'][_0xef43('0x6d')](_0x18c3cf);})[_0xef43('0x23')](function(_0x3d0662){_0x9cbf76[_0xef43('0x5a')]=_0x3d0662;return _0x9cbf76;});}})[_0xef43('0x23')](respondWithFilteredResult(_0x23605a,_0x18c3cf))['catch'](handleError(_0x23605a,null));};function iftimePromise(_0x52ce76,_0x2d4e17){return respondWithRpcPromise(_0xef43('0x101'),_0xef43('0x102'),{'command':_0x2d4e17[_0xef43('0x103')]?util['format'](_0xef43('0x104'),_0x52ce76[_0xef43('0x105')],_0x2d4e17[_0xef43('0x103')]):util[_0xef43('0xb0')](_0xef43('0x106'),_0x52ce76[_0xef43('0x105')])},client9002)[_0xef43('0x23')](function(_0x4835b5){var _0x22a933=_0x4835b5&&_0x4835b5[_0xef43('0x107')]('true')>=0x0?!![]:![];logger[_0xef43('0x24')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2d4e17['id'],_0x52ce76['id'],_0x52ce76[_0xef43('0x105')],_0x22a933?_0xef43('0x108'):_0xef43('0x109'),_0x2d4e17[_0xef43('0x103')]?_0x2d4e17[_0xef43('0x103')]:_0xef43('0x10a'));return _0x22a933;})[_0xef43('0x2d')](function(_0x1aa895){logger[_0xef43('0x29')](_0xef43('0x10b'),_0x2d4e17['id'],_0x52ce76['id'],_0x52ce76[_0xef43('0x105')],util['inspect'](_0x1aa895,{'showHidden':![],'depth':null}),_0x2d4e17['timezone']?_0x2d4e17[_0xef43('0x103')]:_0xef43('0x10a'));return![];});}exports[_0xef43('0x102')]=function(_0x24649a,_0xecfe2b,_0xe35f95){var _0x160853=0x0;var _0x37dee9=0x0;var _0x2eb6d1=![];var _0x3c34a3;var _0x40f07d;return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x24649a['params']['id']},'include':[{'model':db[_0xef43('0x10c')],'as':_0xef43('0x10c'),'include':[{'model':db[_0xef43('0x10c')],'as':_0xef43('0x10d'),'attributes':['id',_0xef43('0x105')],'raw':!![]}]}]})[_0xef43('0x23')](handleEntityNotFound(_0xecfe2b,null))[_0xef43('0x23')](function(_0x14c96c){if(_0x14c96c){_0x3c34a3=_0x14c96c;return _0x14c96c[_0xef43('0x10e')]({'raw':!![]});}})[_0xef43('0x23')](function(_0x3c680e){if(_0x3c34a3){if(_0x3c680e){_0x40f07d=_0x3c680e;}}return require(_0xef43('0x19'))['getLicense']();})[_0xef43('0x23')](function(_0x294169){if(_0x294169){_0x37dee9=_0x294169[_0xef43('0x10f')];_0x2eb6d1=_0x294169[_0xef43('0x81')];}})[_0xef43('0x23')](function(){return db[_0xef43('0xb8')][_0xef43('0x35')]({'where':{'closed':![]}});})[_0xef43('0x23')](function(_0x393691){_0x160853=_0x393691;if(_0x37dee9&&_0x393691>_0x37dee9){return db[_0xef43('0x110')][_0xef43('0x6b')]({'where':{'id':0x1}})[_0xef43('0x23')](function(_0x51a13a){if(_0x51a13a){_0x51a13a['increment'](_0xef43('0x111'));}});}})['then'](function(){if(_0x3c34a3[_0xef43('0x10c')]&&_0x3c34a3[_0xef43('0x10c')][_0xef43('0x10d')]){var _0x46aa09=[];for(var _0x952e87=0x0;_0x952e87<_0x3c34a3[_0xef43('0x10c')]['Intervals'][_0xef43('0x4f')];_0x952e87++){var _0x2d2229=_0x3c34a3[_0xef43('0x10c')][_0xef43('0x10d')][_0x952e87][_0xef43('0x60')]({'plain':!![]});_0x46aa09['push'](iftimePromise(_0x2d2229,_0x3c34a3));}return BPromise[_0xef43('0x112')](_0x46aa09)[_0xef43('0x23')](function(_0x521314){return _[_0xef43('0x113')](_0x521314);});}else{return!![];}})['then'](function(_0x4530b8){var _0x51796c=fs[_0xef43('0x114')](path[_0xef43('0x7d')](config[_0xef43('0x7e')],_0xef43('0x115')),'utf8');var _0x3072f6={'remote':_0x3c34a3[_0xef43('0x116')],'query':querystring[_0xef43('0x28')](_[_0xef43('0x56')](_0x3c34a3['get']({'plain':!![]}),{'customerIp':_0x24649a[_0xef43('0xa9')][_0xef43('0x117')]||_0x24649a[_0xef43('0xa9')]['x-real-ip']||_0x24649a[_0xef43('0x118')][_0xef43('0x119')]||_0x24649a['ip'],'referer':_0x24649a[_0xef43('0xa9')]['referer'],'openedInteractions':_0x160853,'maxInteractions':_0x37dee9,'virtual':_0x2eb6d1[_0xef43('0x10f')],'online':_0x4530b8,'custom':_0x2eb6d1}))[_0xef43('0x11a')](/'/g,'\x5c\x27')};_0xecfe2b[_0xef43('0x3f')](ejs[_0xef43('0x11b')](Mustache[_0xef43('0x11b')](_0x51796c,_0x3072f6),{'proactiveActions':_0x40f07d,'alignment':_0x3c34a3[_0xef43('0x11c')],'verticalAlignment':_0x3c34a3['verticalAlignment'],'div_color':_0x3c34a3[_0xef43('0x11d')],'text_color':_0x3c34a3[_0xef43('0x11e')],'button_color':_0x3c34a3[_0xef43('0x11f')],'background_color':_0x3c34a3[_0xef43('0x120')]}));})['catch'](handleError(_0xecfe2b,null));};exports[_0xef43('0x121')]=function(_0x1d1fca,_0x246354,_0x5617a7){return db[_0xef43('0x44')][_0xef43('0x6b')]({'where':{'id':_0x1d1fca['params']['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x246354,null))[_0xef43('0x23')](function(_0x88a076){if(_0x88a076){return db['sequelize'][_0xef43('0xdd')](function(_0x28031b){return db[_0xef43('0xa2')][_0xef43('0x3b')]({'where':{'ChatWebsiteId':_0x1d1fca['params']['id']},'transaction':_0x28031b})[_0xef43('0x23')](function(_0x323aee){var _0x54dcec=_['map'](_0x1d1fca[_0xef43('0x5e')],function(_0x339349){_0x339349[_0xef43('0x69')]=_0x1d1fca[_0xef43('0x5b')]['id'];return _0x339349;});return db[_0xef43('0xa2')][_0xef43('0xdf')](_0x54dcec,{'transaction':_0x28031b});});})[_0xef43('0x23')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x1d1fca[_0xef43('0x5b')]['id']},'order':_0xef43('0x122')});});}})[_0xef43('0x23')](respondWithResult(_0x246354,null))[_0xef43('0x2d')](handleError(_0x246354,null));};exports['getApplications']=function(_0x33435f,_0x406308,_0x540380){var _0x551961={};var _0x59cd56={};var _0x3079c0;var _0x69f270;return db['ChatWebsite'][_0xef43('0x6b')]({'where':{'id':_0x33435f[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x406308,null))[_0xef43('0x23')](function(_0xb8c45d){if(_0xb8c45d){_0x3079c0=_0xb8c45d;_0x59cd56[_0xef43('0x49')]=_['keys'](db[_0xef43('0xa2')][_0xef43('0x45')]);_0x59cd56[_0xef43('0x4a')]=_['keys'](_0x33435f[_0xef43('0x4a')]);_0x59cd56[_0xef43('0x4b')]=_[_0xef43('0x4c')](_0x59cd56[_0xef43('0x49')],_0x59cd56[_0xef43('0x4a')]);_0x551961['attributes']=_[_0xef43('0x4c')](_0x59cd56[_0xef43('0x49')],qs['fields'](_0x33435f['query'][_0xef43('0x4e')]));_0x551961[_0xef43('0x4d')]=_0x551961['attributes'][_0xef43('0x4f')]?_0x551961[_0xef43('0x4d')]:_0x59cd56[_0xef43('0x49')];_0x551961['order']=qs['sort'](_0x33435f[_0xef43('0x4a')]['sort']);_0x551961['where']=qs[_0xef43('0x4b')](_[_0xef43('0x53')](_0x33435f[_0xef43('0x4a')],_0x59cd56['filters']));if(_0x33435f['query']['filter']){_0x551961[_0xef43('0x55')]=_['merge'](_0x551961[_0xef43('0x55')],{'$or':_[_0xef43('0x43')](_0x551961[_0xef43('0x4d')],function(_0x3449b8){var _0x5e0fad={};_0x5e0fad[_0x3449b8]={'$like':'%'+_0x33435f[_0xef43('0x4a')][_0xef43('0x54')]+'%'};return _0x5e0fad;})});}_0x551961=_[_0xef43('0x56')]({},_0x551961,_0x33435f['options']);return _0x3079c0[_0xef43('0x123')](_0x551961);}})[_0xef43('0x23')](function(_0x295b00){if(_0x295b00){_0x69f270=_0x295b00['length'];if(!_0x33435f['query'][_0xef43('0x6c')]('nolimit')){_0x551961[_0xef43('0x33')]=qs[_0xef43('0x33')](_0x33435f[_0xef43('0x4a')]['limit']);_0x551961[_0xef43('0x34')]=qs[_0xef43('0x34')](_0x33435f[_0xef43('0x4a')][_0xef43('0x34')]);}return _0x3079c0[_0xef43('0x123')](_0x551961);}})['then'](function(_0x147aef){if(_0x147aef){return _0x147aef?{'count':_0x69f270,'rows':_0x147aef}:null;}})['then'](respondWithResult(_0x406308,null))[_0xef43('0x2d')](handleError(_0x406308,null));};exports[_0xef43('0x124')]=function(_0x4734e7,_0x26e821,_0x25cae3){return db['chatProactiveAction'][_0xef43('0x64')]({'where':{'id':_0x4734e7[_0xef43('0x5b')]['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x26e821,null))[_0xef43('0x23')](function(_0x2d11fa){if(_0x2d11fa){return _0x2d11fa[_0xef43('0x124')](_0x4734e7[_0xef43('0x5e')][_0xef43('0x6f')],_['omit'](_0x4734e7[_0xef43('0x5e')],[_0xef43('0x6f'),'id'])||{});}})[_0xef43('0x23')](respondWithResult(_0x26e821,null))[_0xef43('0x2d')](handleError(_0x26e821,null));};exports[_0xef43('0x10e')]=function(_0x571f84,_0x489123,_0x2aaa14){var _0x41dab1={};var _0x4de597={};var _0x11b5f0;var _0x409157;return db[_0xef43('0x44')][_0xef43('0x6b')]({'where':{'id':_0x571f84[_0xef43('0x5b')]['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x489123,null))['then'](function(_0x540c83){if(_0x540c83){_0x11b5f0=_0x540c83;_0x4de597['model']=_['keys'](db[_0xef43('0x125')][_0xef43('0x45')]);_0x4de597[_0xef43('0x4a')]=_['keys'](_0x571f84[_0xef43('0x4a')]);_0x4de597['filters']=_[_0xef43('0x4c')](_0x4de597['model'],_0x4de597[_0xef43('0x4a')]);_0x41dab1[_0xef43('0x4d')]=_[_0xef43('0x4c')](_0x4de597[_0xef43('0x49')],qs['fields'](_0x571f84[_0xef43('0x4a')][_0xef43('0x4e')]));_0x41dab1[_0xef43('0x4d')]=_0x41dab1[_0xef43('0x4d')][_0xef43('0x4f')]?_0x41dab1[_0xef43('0x4d')]:_0x4de597[_0xef43('0x49')];_0x41dab1[_0xef43('0x51')]=qs[_0xef43('0x52')](_0x571f84[_0xef43('0x4a')]['sort']);_0x41dab1[_0xef43('0x55')]=qs[_0xef43('0x4b')](_[_0xef43('0x53')](_0x571f84[_0xef43('0x4a')],_0x4de597[_0xef43('0x4b')]));if(_0x571f84['query'][_0xef43('0x54')]){_0x41dab1[_0xef43('0x55')]=_[_0xef43('0x56')](_0x41dab1['where'],{'$or':_[_0xef43('0x43')](_0x41dab1[_0xef43('0x4d')],function(_0x2fec3f){var _0x49362c={};_0x49362c[_0x2fec3f]={'$like':'%'+_0x571f84['query']['filter']+'%'};return _0x49362c;})});}_0x41dab1=_[_0xef43('0x56')]({},_0x41dab1,_0x571f84['options']);return _0x11b5f0[_0xef43('0x10e')](_0x41dab1);}})[_0xef43('0x23')](function(_0x406571){if(_0x406571){_0x409157=_0x406571[_0xef43('0x4f')];if(!_0x571f84[_0xef43('0x4a')][_0xef43('0x6c')](_0xef43('0x50'))){_0x41dab1[_0xef43('0x33')]=qs[_0xef43('0x33')](_0x571f84[_0xef43('0x4a')][_0xef43('0x33')]);_0x41dab1[_0xef43('0x34')]=qs[_0xef43('0x34')](_0x571f84['query']['offset']);}return _0x11b5f0[_0xef43('0x10e')](_0x41dab1);}})[_0xef43('0x23')](function(_0x2ec050){if(_0x2ec050){return _0x2ec050?{'count':_0x409157,'rows':_0x2ec050}:null;}})[_0xef43('0x23')](respondWithResult(_0x489123,null))[_0xef43('0x2d')](handleError(_0x489123,null));};exports[_0xef43('0x126')]=function(_0x1a44cd,_0x9a97c,_0x596e27){var _0x2089b8=_0x1a44cd['query'][_0xef43('0x127')]==='false'?_0xef43('0x128'):_0xef43('0x129');return db[_0xef43('0x44')][_0xef43('0x64')]({'attributes':['id',_0x2089b8],'where':{'id':_0x1a44cd[_0xef43('0x5b')]['id']}})['then'](handleEntityNotFound(_0x9a97c,null))[_0xef43('0x23')](function(_0x47d53f){if(_0x47d53f){var _0x5e1a6e=_0x47d53f[_0x2089b8];var _0x126ea5=_0x5e1a6e&&_0x5e1a6e[_0xef43('0x12a')]?_0x5e1a6e[_0xef43('0x12a')]:[];_0x9a97c[_0xef43('0x3f')]({'fromKey':_[_0xef43('0x82')](_0x5e1a6e[_0xef43('0x12b')])?undefined:_0x5e1a6e['fromKey'],'count':_0x126ea5['length'],'rows':_0x126ea5});}})['catch'](handleError(_0x9a97c,null));};exports[_0xef43('0x12c')]=function(_0x56614e,_0x57834a,_0x535f5d){var _0x3c9407={'raw':![],'where':{}};var _0x3d9a5c={};var _0x2ad057={'count':0x0,'rows':[]};return db[_0xef43('0x44')][_0xef43('0x6b')]({'where':{'id':_0x56614e['params']['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x57834a,null))['then'](function(_0x27e951){if(_0x27e951){_0x3d9a5c['model']=_['keys'](db['ChatOfflineMessage'][_0xef43('0x45')]);_0x3d9a5c['query']=_['keys'](_0x56614e[_0xef43('0x4a')]);_0x3d9a5c[_0xef43('0x4b')]=_[_0xef43('0x4c')](_0x3d9a5c[_0xef43('0x49')],_0x3d9a5c[_0xef43('0x4a')]);_0x3c9407[_0xef43('0x4d')]=_[_0xef43('0x4c')](_0x3d9a5c[_0xef43('0x49')],qs[_0xef43('0x4e')](_0x56614e[_0xef43('0x4a')][_0xef43('0x4e')]));_0x3c9407[_0xef43('0x4d')]=_0x3c9407['attributes'][_0xef43('0x4f')]?_0x3c9407['attributes']:_0x3d9a5c[_0xef43('0x49')];if(!_0x56614e[_0xef43('0x4a')]['hasOwnProperty'](_0xef43('0x50'))){_0x3c9407[_0xef43('0x33')]=qs[_0xef43('0x33')](_0x56614e[_0xef43('0x4a')][_0xef43('0x33')]);_0x3c9407[_0xef43('0x34')]=qs[_0xef43('0x34')](_0x56614e['query'][_0xef43('0x34')]);}_0x3c9407['order']=qs[_0xef43('0x52')](_0x56614e[_0xef43('0x4a')]['sort']);_0x3c9407[_0xef43('0x55')]=qs['filters'](_[_0xef43('0x53')](_0x56614e[_0xef43('0x4a')],_0x3d9a5c[_0xef43('0x4b')]));_0x3c9407[_0xef43('0x55')][_0xef43('0x69')]=_0x27e951['id'];if(_0x56614e[_0xef43('0x4a')][_0xef43('0x54')]){_0x3c9407['where']=_[_0xef43('0x56')](_0x3c9407[_0xef43('0x55')],{'$or':_[_0xef43('0x43')](_0x3c9407['attributes'],function(_0x23deec){var _0x198197={};_0x198197[_0x23deec]={'$like':'%'+_0x56614e[_0xef43('0x4a')][_0xef43('0x54')]+'%'};return _0x198197;})});}_0x3c9407=_[_0xef43('0x56')]({},_0x3c9407,_0x56614e[_0xef43('0x57')]);return db[_0xef43('0xd5')][_0xef43('0x35')]({'where':_0x3c9407['where']})[_0xef43('0x23')](function(_0x55f789){_0x2ad057['count']=_0x55f789;if(_0x56614e[_0xef43('0x4a')]['includeAll']){_0x3c9407['include']=[{'all':!![]}];}else{_0x3c9407[_0xef43('0x59')]=[{'model':db[_0xef43('0x8f')],'as':_0xef43('0xfa'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xef43('0xd5')]['findAll'](_0x3c9407);})[_0xef43('0x23')](function(_0xd5eb1a){_0x2ad057['rows']=_0xd5eb1a;return _0x2ad057;});}})[_0xef43('0x23')](respondWithFilteredResult(_0x57834a,_0x3c9407))[_0xef43('0x2d')](handleError(_0x57834a,null));};exports[_0xef43('0x12d')]=function(_0x38fd26,_0x1553ba,_0x2394f0){return db[_0xef43('0x44')][_0xef43('0x64')]({'where':{'id':_0x38fd26['params']['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x1553ba,null))[_0xef43('0x23')](function(_0x83e63c){if(_0x83e63c){return _0x83e63c[_0xef43('0x12d')](_0x38fd26[_0xef43('0x5e')][_0xef43('0x6f')],_['omit'](_0x38fd26[_0xef43('0x5e')],[_0xef43('0x6f'),'id'])||{})[_0xef43('0x12e')](function(_0x3fd086){for(var _0x4eb7e6=0x0;_0x4eb7e6<_0x38fd26['body']['ids'][_0xef43('0x4f')];_0x4eb7e6+=0x1){socket[_0xef43('0x12f')](_0xef43('0x130'),{'UserId':Number(_0x38fd26['body']['ids'][_0x4eb7e6]),'ChatWebsiteId':Number(_0x38fd26['params']['id'])});}return _0x3fd086;});}})[_0xef43('0x23')](respondWithResult(_0x1553ba,null))[_0xef43('0x2d')](handleError(_0x1553ba,null));};exports['removeAgents']=function(_0x23cf0e,_0x48040d,_0x17c674){return db[_0xef43('0x44')]['find']({'where':{'id':_0x23cf0e['params']['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x48040d,null))['then'](function(_0x26c87a){if(_0x26c87a){return _0x26c87a['removeAgents'](_0x23cf0e[_0xef43('0x4a')][_0xef43('0x6f')])[_0xef43('0x23')](function(){if(_[_0xef43('0x131')](_0x23cf0e[_0xef43('0x4a')][_0xef43('0x6f')])){for(var _0x5a9f34=0x0;_0x5a9f34<_0x23cf0e[_0xef43('0x4a')][_0xef43('0x6f')]['length'];_0x5a9f34+=0x1){socket[_0xef43('0x12f')]('userChatWebsite:remove',{'UserId':Number(_0x23cf0e[_0xef43('0x4a')][_0xef43('0x6f')][_0x5a9f34]),'ChatWebsiteId':Number(_0x23cf0e[_0xef43('0x5b')]['id'])});}}else{socket[_0xef43('0x12f')](_0xef43('0x132'),{'UserId':Number(_0x23cf0e[_0xef43('0x4a')][_0xef43('0x6f')]),'ChatWebsiteId':Number(_0x23cf0e['params']['id'])});}});}})[_0xef43('0x23')](respondWithStatusCode(_0x48040d,null))['catch'](handleError(_0x48040d,null));};exports[_0xef43('0x133')]=function(_0x92122e,_0x126454,_0x439a42){var _0x53cbd3={};var _0x57527d={};var _0x2542c3;var _0x4a04df;return db[_0xef43('0x44')][_0xef43('0x6b')]({'where':{'id':_0x92122e[_0xef43('0x5b')]['id']}})[_0xef43('0x23')](handleEntityNotFound(_0x126454,null))['then'](function(_0xe169ca){if(_0xe169ca){_0x2542c3=_0xe169ca;_0x57527d[_0xef43('0x49')]=_[_0xef43('0x5c')](db[_0xef43('0x134')]['rawAttributes']);_0x57527d[_0xef43('0x4a')]=_['keys'](_0x92122e['query']);_0x57527d[_0xef43('0x4b')]=_[_0xef43('0x4c')](_0x57527d['model'],_0x57527d[_0xef43('0x4a')]);_0x53cbd3[_0xef43('0x4d')]=_[_0xef43('0x4c')](_0x57527d[_0xef43('0x49')],qs[_0xef43('0x4e')](_0x92122e[_0xef43('0x4a')][_0xef43('0x4e')]));_0x53cbd3['attributes']=_0x53cbd3[_0xef43('0x4d')][_0xef43('0x4f')]?_0x53cbd3[_0xef43('0x4d')]:_0x57527d[_0xef43('0x49')];_0x53cbd3['order']=qs['sort'](_0x92122e[_0xef43('0x4a')]['sort']);_0x53cbd3[_0xef43('0x55')]=qs[_0xef43('0x4b')](_['pick'](_0x92122e[_0xef43('0x4a')],_0x57527d[_0xef43('0x4b')]));if(_0x92122e[_0xef43('0x4a')][_0xef43('0x54')]){_0x53cbd3['where']=_['merge'](_0x53cbd3[_0xef43('0x55')],{'$or':_[_0xef43('0x43')](_0x53cbd3[_0xef43('0x4d')],function(_0x1d5d1a){var _0x320068={};_0x320068[_0x1d5d1a]={'$like':'%'+_0x92122e['query']['filter']+'%'};return _0x320068;})});}_0x53cbd3=_[_0xef43('0x56')]({},_0x53cbd3,_0x92122e['options']);return _0x2542c3['getAgents'](_0x53cbd3);}})[_0xef43('0x23')](function(_0x568eb7){if(_0x568eb7){_0x4a04df=_0x568eb7[_0xef43('0x4f')];if(!_0x92122e[_0xef43('0x4a')][_0xef43('0x6c')](_0xef43('0x50'))){_0x53cbd3['limit']=qs[_0xef43('0x33')](_0x92122e[_0xef43('0x4a')]['limit']);_0x53cbd3[_0xef43('0x34')]=qs[_0xef43('0x34')](_0x92122e['query'][_0xef43('0x34')]);}return _0x2542c3[_0xef43('0x133')](_0x53cbd3);}})['then'](function(_0x1c5693){if(_0x1c5693){return _0x1c5693?{'count':_0x4a04df,'rows':_0x1c5693}:null;}})[_0xef43('0x23')](respondWithResult(_0x126454,null))[_0xef43('0x2d')](handleError(_0x126454,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index df8461d..fc97dbc 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 _0xe14f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x199110,_0xcfa5af){var _0x3a254e=function(_0x156a48){while(--_0x156a48){_0x199110['push'](_0x199110['shift']());}};_0x3a254e(++_0xcfa5af);}(_0xe14f,0xea));var _0xfe14=function(_0x46cb40,_0x329375){_0x46cb40=_0x46cb40-0x0;var _0x160e85=_0xe14f[_0x46cb40];return _0x160e85;};'use strict';var EventEmitter=require(_0xfe14('0x0'));var ChatWebsite=require(_0xfe14('0x1'))['db'][_0xfe14('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xfe14('0x3')](0x0);var events={'afterCreate':_0xfe14('0x4'),'afterUpdate':_0xfe14('0x5'),'afterDestroy':_0xfe14('0x6')};function emitEvent(_0x3afd97){return function(_0x2b7784,_0x4b7546,_0x576d90){ChatWebsiteEvents[_0xfe14('0x7')](_0x3afd97+':'+_0x2b7784['id'],_0x2b7784);ChatWebsiteEvents['emit'](_0x3afd97,_0x2b7784);_0x576d90(null);};}for(var e in events){if(events[_0xfe14('0x8')](e)){var event=events[e];ChatWebsite[_0xfe14('0x9')](e,emitEvent(event));}}module[_0xfe14('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x35d0=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x35d0,0xf9));var _0x035d=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0x35d0[_0x330723];return _0x60c546;};'use strict';var EventEmitter=require(_0x035d('0x0'));var ChatWebsite=require(_0x035d('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x035d('0x2')](0x0);var events={'afterCreate':_0x035d('0x3'),'afterUpdate':_0x035d('0x4'),'afterDestroy':_0x035d('0x5')};function emitEvent(_0x12fb05){return function(_0x16388a,_0x51fe09,_0x2a4bb2){ChatWebsiteEvents[_0x035d('0x6')](_0x12fb05+':'+_0x16388a['id'],_0x16388a);ChatWebsiteEvents[_0x035d('0x6')](_0x12fb05,_0x16388a);_0x2a4bb2(null);};}for(var e in events){if(events[_0x035d('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x035d('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index eeebbe3..d044126 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 _0x0837=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x0837,0x18c));var _0x7083=function(_0x5d573d,_0x5e9cbb){_0x5d573d=_0x5d573d-0x0;var _0x898de1=_0x0837[_0x5d573d];return _0x898de1;};'use strict';var _=require(_0x7083('0x0'));var util=require('util');var logger=require(_0x7083('0x1'))(_0x7083('0x2'));var moment=require(_0x7083('0x3'));var BPromise=require(_0x7083('0x4'));var rp=require(_0x7083('0x5'));var fs=require('fs');var path=require(_0x7083('0x6'));var rimraf=require(_0x7083('0x7'));var config=require(_0x7083('0x8'));var attributes=require(_0x7083('0x9'));module[_0x7083('0xa')]=function(_0x1f7d05,_0x565904){return _0x1f7d05['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7825=['define','ChatWebsite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x4f2dd0,_0x4cb95c){var _0x440de5=function(_0x977a8e){while(--_0x977a8e){_0x4f2dd0['push'](_0x4f2dd0['shift']());}};_0x440de5(++_0x4cb95c);}(_0x7825,0x122));var _0x5782=function(_0x54597a,_0x4ea42f){_0x54597a=_0x54597a-0x0;var _0x5a764f=_0x7825[_0x54597a];return _0x5a764f;};'use strict';var _=require(_0x5782('0x0'));var util=require(_0x5782('0x1'));var logger=require(_0x5782('0x2'))('api');var moment=require(_0x5782('0x3'));var BPromise=require(_0x5782('0x4'));var rp=require(_0x5782('0x5'));var fs=require('fs');var path=require(_0x5782('0x6'));var rimraf=require('rimraf');var config=require(_0x5782('0x7'));var attributes=require(_0x5782('0x8'));module[_0x5782('0x9')]=function(_0x5035ee,_0x59e4f6){return _0x5035ee[_0x5782('0xa')](_0x5782('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 1a01612..231137e 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 _0xbe93=['stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0xbe93,0x17b));var _0x3be9=function(_0x2acc0c,_0x5dd918){_0x2acc0c=_0x2acc0c-0x0;var _0x5ac3d2=_0xbe93[_0x2acc0c];return _0x5ac3d2;};'use strict';var _=require('lodash');var util=require(_0x3be9('0x0'));var moment=require(_0x3be9('0x1'));var BPromise=require(_0x3be9('0x2'));var rs=require(_0x3be9('0x3'));var fs=require('fs');var Redis=require(_0x3be9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3be9('0x5'))(_0x3be9('0x6'));var config=require(_0x3be9('0x7'));var jayson=require(_0x3be9('0x8'));var client=jayson[_0x3be9('0x9')][_0x3be9('0xa')]({'port':0x232a});config[_0x3be9('0xb')]=_[_0x3be9('0xc')](config[_0x3be9('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3be9('0xb')]));require(_0x3be9('0xd'))[_0x3be9('0xe')](socket);function respondWithRpcPromise(_0x15101a,_0x45effb,_0xcc9d06){return new BPromise(function(_0x4c9d1e,_0xb18674){return client['request'](_0x15101a,_0xcc9d06)[_0x3be9('0xf')](function(_0x162bd5){logger[_0x3be9('0x10')](_0x3be9('0x11'),_0x45effb,_0x3be9('0x12'));logger[_0x3be9('0x13')](_0x3be9('0x14'),_0x45effb,_0x3be9('0x12'),JSON[_0x3be9('0x15')](_0x162bd5));if(_0x162bd5['error']){if(_0x162bd5[_0x3be9('0x16')]['code']===0x1f4){logger[_0x3be9('0x16')](_0x3be9('0x11'),_0x45effb,_0x162bd5[_0x3be9('0x16')][_0x3be9('0x17')]);return _0xb18674(_0x162bd5[_0x3be9('0x16')][_0x3be9('0x17')]);}logger[_0x3be9('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x45effb,_0x162bd5[_0x3be9('0x16')]['message']);return _0x4c9d1e(_0x162bd5[_0x3be9('0x16')][_0x3be9('0x17')]);}else{logger[_0x3be9('0x10')](_0x3be9('0x11'),_0x45effb,_0x3be9('0x12'));_0x4c9d1e(_0x162bd5['result'][_0x3be9('0x17')]);}})[_0x3be9('0x18')](function(_0x13be96){logger[_0x3be9('0x16')](_0x3be9('0x11'),_0x45effb,_0x13be96);_0xb18674(_0x13be96);});});} \ No newline at end of file +var _0x5a1c=['error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4ca90b,_0x21164d){var _0x55ab04=function(_0x36fe20){while(--_0x36fe20){_0x4ca90b['push'](_0x4ca90b['shift']());}};_0x55ab04(++_0x21164d);}(_0x5a1c,0xd6));var _0xc5a1=function(_0x74658d,_0x2e04ca){_0x74658d=_0x74658d-0x0;var _0x2c5d24=_0x5a1c[_0x74658d];return _0x2c5d24;};'use strict';var _=require('lodash');var util=require(_0xc5a1('0x0'));var moment=require('moment');var BPromise=require(_0xc5a1('0x1'));var rs=require(_0xc5a1('0x2'));var fs=require('fs');var Redis=require(_0xc5a1('0x3'));var db=require(_0xc5a1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5a1('0x5'))(_0xc5a1('0x6'));var config=require('../../config/environment');var jayson=require(_0xc5a1('0x7'));var client=jayson[_0xc5a1('0x8')][_0xc5a1('0x9')]({'port':0x232a});config[_0xc5a1('0xa')]=_[_0xc5a1('0xb')](config[_0xc5a1('0xa')],{'host':_0xc5a1('0xc'),'port':0x18eb});var socket=require(_0xc5a1('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xc5a1('0xe')](socket);function respondWithRpcPromise(_0x1e3032,_0x2afd71,_0x3421bc){return new BPromise(function(_0x57c2ee,_0xb6d372){return client[_0xc5a1('0xf')](_0x1e3032,_0x3421bc)[_0xc5a1('0x10')](function(_0x459e09){logger[_0xc5a1('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x2afd71,'request\x20sent');logger['debug'](_0xc5a1('0x12'),_0x2afd71,_0xc5a1('0x13'),JSON['stringify'](_0x459e09));if(_0x459e09['error']){if(_0x459e09[_0xc5a1('0x14')][_0xc5a1('0x15')]===0x1f4){logger[_0xc5a1('0x14')](_0xc5a1('0x16'),_0x2afd71,_0x459e09[_0xc5a1('0x14')]['message']);return _0xb6d372(_0x459e09['error'][_0xc5a1('0x17')]);}logger[_0xc5a1('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2afd71,_0x459e09[_0xc5a1('0x14')][_0xc5a1('0x17')]);return _0x57c2ee(_0x459e09[_0xc5a1('0x14')][_0xc5a1('0x17')]);}else{logger[_0xc5a1('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x2afd71,'request\x20sent');_0x57c2ee(_0x459e09[_0xc5a1('0x18')][_0xc5a1('0x17')]);}})[_0xc5a1('0x19')](function(_0x1a017c){logger[_0xc5a1('0x14')](_0xc5a1('0x16'),_0x2afd71,_0x1a017c);_0xb6d372(_0x1a017c);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 75d69b8..a719c67 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 _0xfa77=['./chatWebsite.events','emit','removeListener','register','chatWebsite:'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xfa77,0xb9));var _0x7fa7=function(_0x201a15,_0x1aa2da){_0x201a15=_0x201a15-0x0;var _0xfa36d6=_0xfa77[_0x201a15];return _0xfa36d6;};'use strict';var ChatWebsiteEvents=require(_0x7fa7('0x0'));var events=['save','remove','update'];function createListener(_0x3e92b0,_0x46fec5){return function(_0x2b4908){_0x46fec5[_0x7fa7('0x1')](_0x3e92b0,_0x2b4908);};}function removeListener(_0x20f0a4,_0x4132fd){return function(){ChatWebsiteEvents[_0x7fa7('0x2')](_0x20f0a4,_0x4132fd);};}exports[_0x7fa7('0x3')]=function(_0x3b637f){for(var _0x16bbd8=0x0,_0x326c4d=events['length'];_0x16bbd8<_0x326c4d;_0x16bbd8++){var _0x1d2790=events[_0x16bbd8];var _0x4d6a99=createListener(_0x7fa7('0x4')+_0x1d2790,_0x3b637f);ChatWebsiteEvents['on'](_0x1d2790,_0x4d6a99);}}; \ No newline at end of file +var _0xe6a8=['removeListener','register','length','chatWebsite:','./chatWebsite.events','emit'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xe6a8,0x1c6));var _0x8e6a=function(_0x24378d,_0x253b49){_0x24378d=_0x24378d-0x0;var _0x56c4e0=_0xe6a8[_0x24378d];return _0x56c4e0;};'use strict';var ChatWebsiteEvents=require(_0x8e6a('0x0'));var events=['save','remove','update'];function createListener(_0x51fbb5,_0x1c1ff0){return function(_0x4fbe7d){_0x1c1ff0[_0x8e6a('0x1')](_0x51fbb5,_0x4fbe7d);};}function removeListener(_0x631e69,_0x32661d){return function(){ChatWebsiteEvents[_0x8e6a('0x2')](_0x631e69,_0x32661d);};}exports[_0x8e6a('0x3')]=function(_0x4a30f3){for(var _0x41d48b=0x0,_0x367889=events[_0x8e6a('0x4')];_0x41d48b<_0x367889;_0x41d48b++){var _0x403bfd=events[_0x41d48b];var _0x207977=createListener(_0x8e6a('0x5')+_0x403bfd,_0x4a30f3);ChatWebsiteEvents['on'](_0x403bfd,_0x207977);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7e6a768..ce3f9ba 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 _0xca18=['addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','/:id/interactions','addInteraction','addApplications','put','delete','destroy','/:id/dispositions','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','root','server/files/images/avatars/','format','now','addAvatar','/:id/customer_avatar'];(function(_0x2317af,_0x1332d3){var _0x3cb58d=function(_0x4e75a0){while(--_0x4e75a0){_0x2317af['push'](_0x2317af['shift']());}};_0x3cb58d(++_0x1332d3);}(_0xca18,0x183));var _0x8ca1=function(_0x54a28a,_0x1ba1fe){_0x54a28a=_0x54a28a-0x0;var _0x3da1f1=_0xca18[_0x54a28a];return _0x3da1f1;};'use strict';var multer=require(_0x8ca1('0x0'));var util=require(_0x8ca1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ca1('0x2'));var auth=require(_0x8ca1('0x3'));var interaction=require(_0x8ca1('0x4'));var config=require(_0x8ca1('0x5'));var controller=require(_0x8ca1('0x6'));router[_0x8ca1('0x7')]('/',auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x9')]);router[_0x8ca1('0x7')](_0x8ca1('0xa'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0xb')]);router[_0x8ca1('0x7')](_0x8ca1('0xc'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0xd')]);router[_0x8ca1('0x7')]('/:id/dispositions',auth[_0x8ca1('0x8')](),controller[_0x8ca1('0xe')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8ca1('0xf')]);router[_0x8ca1('0x7')](_0x8ca1('0x10'),controller['getLogo']);router['get'](_0x8ca1('0x11'),controller[_0x8ca1('0x12')]);router[_0x8ca1('0x7')]('/:id/customer_avatar',controller[_0x8ca1('0x13')]);router[_0x8ca1('0x7')](_0x8ca1('0x14'),controller[_0x8ca1('0x15')]);router[_0x8ca1('0x7')]('/:id/interactions',auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x16')]);router[_0x8ca1('0x7')](_0x8ca1('0x17'),controller[_0x8ca1('0x18')]);router['get'](_0x8ca1('0x19'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x1a')]);router[_0x8ca1('0x7')](_0x8ca1('0x1b'),auth[_0x8ca1('0x8')](),controller['getProactiveActions']);router['get'](_0x8ca1('0x1c'),controller[_0x8ca1('0x1d')]);router[_0x8ca1('0x7')](_0x8ca1('0x1e'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x1f')]);router[_0x8ca1('0x7')](_0x8ca1('0x20'),auth[_0x8ca1('0x8')](),controller['getAgents']);router[_0x8ca1('0x21')]('/',auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x22')]);router[_0x8ca1('0x21')]('/:id/dispositions',auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x23')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8ca1('0x24')]);var upload=multer({'storage':multer[_0x8ca1('0x25')]({'destination':function(_0x5ee40f,_0x5dc16b,_0x3afeeb){_0x3afeeb(null,path[_0x8ca1('0x26')](config['root'],_0x8ca1('0x27')));},'filename':function(_0x3b39c4,_0x585cb5,_0x365eec){_0x365eec(null,util['format'](_0x8ca1('0x28'),Date['now'](),_0x585cb5[_0x8ca1('0x29')]));}})});router[_0x8ca1('0x21')]('/:id/logo',upload[_0x8ca1('0x2a')](_0x8ca1('0x2b')),controller[_0x8ca1('0x2c')]);var upload=multer({'storage':multer[_0x8ca1('0x25')]({'destination':function(_0x23b2d7,_0x3742bb,_0x338f8a){_0x338f8a(null,path[_0x8ca1('0x26')](config[_0x8ca1('0x2d')],_0x8ca1('0x2e')));},'filename':function(_0x20a7f7,_0x57cb74,_0x40dce6){_0x40dce6(null,util[_0x8ca1('0x2f')](_0x8ca1('0x28'),Date[_0x8ca1('0x30')](),_0x57cb74[_0x8ca1('0x29')]));}})});router[_0x8ca1('0x21')](_0x8ca1('0x11'),upload[_0x8ca1('0x2a')](_0x8ca1('0x2b')),controller[_0x8ca1('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5637dc,_0x2ba706,_0x10ed75){_0x10ed75(null,path['join'](config[_0x8ca1('0x2d')],_0x8ca1('0x2e')));},'filename':function(_0x2bc07a,_0x7db84c,_0x3ea77e){_0x3ea77e(null,util['format'](_0x8ca1('0x28'),Date[_0x8ca1('0x30')](),_0x7db84c[_0x8ca1('0x29')]));}})});router[_0x8ca1('0x21')](_0x8ca1('0x32'),upload[_0x8ca1('0x2a')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x8ca1('0x25')]({'destination':function(_0x258f19,_0x4c96c7,_0x3ed449){_0x3ed449(null,path[_0x8ca1('0x26')](config[_0x8ca1('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x177c49,_0x13376b,_0x5e9e07){_0x5e9e07(null,util[_0x8ca1('0x2f')]('%s-%s',Date[_0x8ca1('0x30')](),_0x13376b[_0x8ca1('0x29')]));}})});router['post'](_0x8ca1('0x14'),upload[_0x8ca1('0x2a')]('file'),controller[_0x8ca1('0x33')]);router[_0x8ca1('0x21')](_0x8ca1('0x34'),controller[_0x8ca1('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x8ca1('0x25')]({'destination':function(_0x1401d6,_0x32929e,_0x2adaa5){const _0x20b7e9=path['join'](config[_0x8ca1('0x2d')],'server/files',_0x8ca1('0x36'),_0x8ca1('0x37'));fs_extra[_0x8ca1('0x38')](_0x20b7e9,function(){_0x2adaa5(null,_0x20b7e9);});},'filename':function(_0x540965,_0x51de62,_0x3a1bb0){const _0x3135f4=_0x51de62['originalname'][_0x8ca1('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x18e696=path[_0x8ca1('0x3a')](_0x3135f4);const _0x4922ec=Date['now']()+'-'+_0x3135f4[_0x8ca1('0x39')](_0x18e696,'')+_0x18e696;_0x3a1bb0(null,_0x4922ec);}})});router[_0x8ca1('0x21')](_0x8ca1('0x3b'),offlineUploadMulter[_0x8ca1('0x3c')](),controller['offline']);router[_0x8ca1('0x21')](_0x8ca1('0x3d'),auth['isAuthenticated'](),controller[_0x8ca1('0x3e')]);router[_0x8ca1('0x21')](_0x8ca1('0x19'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x3f')]);router['post'](_0x8ca1('0x1b'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x8ca1('0x21')](_0x8ca1('0x20'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8ca1('0x40')](_0x8ca1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8ca1('0x41')](_0x8ca1('0xc'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x42')]);router[_0x8ca1('0x41')](_0x8ca1('0x43'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x44')]);router[_0x8ca1('0x41')](_0x8ca1('0x45'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x46')]);router[_0x8ca1('0x41')](_0x8ca1('0x20'),auth[_0x8ca1('0x8')](),controller[_0x8ca1('0x47')]);module[_0x8ca1('0x48')]=router; \ No newline at end of file +var _0xa6e5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','format','addAvatar','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','exports','multer','util','connect-timeout'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xa6e5,0x1a7));var _0x5a6e=function(_0xb5f5b3,_0x97d715){_0xb5f5b3=_0xb5f5b3-0x0;var _0x38d5b0=_0xa6e5[_0xb5f5b3];return _0x38d5b0;};'use strict';var multer=require(_0x5a6e('0x0'));var util=require(_0x5a6e('0x1'));var path=require('path');var timeout=require(_0x5a6e('0x2'));var express=require('express');var router=express[_0x5a6e('0x3')]();var fs_extra=require(_0x5a6e('0x4'));var auth=require(_0x5a6e('0x5'));var interaction=require(_0x5a6e('0x6'));var config=require(_0x5a6e('0x7'));var controller=require(_0x5a6e('0x8'));router[_0x5a6e('0x9')]('/',auth['isAuthenticated'](),controller[_0x5a6e('0xa')]);router[_0x5a6e('0x9')]('/describe',auth[_0x5a6e('0xb')](),controller[_0x5a6e('0xc')]);router['get'](_0x5a6e('0xd'),auth[_0x5a6e('0xb')](),controller[_0x5a6e('0xe')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5a6e('0xf')]);router['get'](_0x5a6e('0x10'),auth[_0x5a6e('0xb')](),controller['getAnswers']);router[_0x5a6e('0x9')](_0x5a6e('0x11'),controller[_0x5a6e('0x12')]);router[_0x5a6e('0x9')](_0x5a6e('0x13'),controller[_0x5a6e('0x14')]);router[_0x5a6e('0x9')](_0x5a6e('0x15'),controller[_0x5a6e('0x16')]);router[_0x5a6e('0x9')](_0x5a6e('0x17'),controller['getSystemAvatar']);router[_0x5a6e('0x9')]('/:id/interactions',auth[_0x5a6e('0xb')](),controller['getInteractions']);router['get'](_0x5a6e('0x18'),controller[_0x5a6e('0x19')]);router[_0x5a6e('0x9')](_0x5a6e('0x1a'),auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x1b')]);router['get'](_0x5a6e('0x1c'),auth['isAuthenticated'](),controller[_0x5a6e('0x1d')]);router[_0x5a6e('0x9')]('/:id/fields',controller[_0x5a6e('0x1e')]);router[_0x5a6e('0x9')]('/:id/offline_messages',auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x1f')]);router[_0x5a6e('0x9')](_0x5a6e('0x20'),auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x21')]);router[_0x5a6e('0x22')]('/',auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x23')]);router[_0x5a6e('0x22')](_0x5a6e('0x24'),auth['isAuthenticated'](),controller[_0x5a6e('0x25')]);router['post'](_0x5a6e('0x10'),auth['isAuthenticated'](),controller[_0x5a6e('0x26')]);var upload=multer({'storage':multer[_0x5a6e('0x27')]({'destination':function(_0x3f4d5e,_0x59c536,_0x6f700f){_0x6f700f(null,path[_0x5a6e('0x28')](config[_0x5a6e('0x29')],'server/files/images/logos/'));},'filename':function(_0x7e65a4,_0x3fb317,_0x5d94b6){_0x5d94b6(null,util['format'](_0x5a6e('0x2a'),Date[_0x5a6e('0x2b')](),_0x3fb317[_0x5a6e('0x2c')]));}})});router[_0x5a6e('0x22')](_0x5a6e('0x11'),upload[_0x5a6e('0x2d')](_0x5a6e('0x2e')),controller[_0x5a6e('0x2f')]);var upload=multer({'storage':multer[_0x5a6e('0x27')]({'destination':function(_0x5d7cc5,_0x1590ed,_0x4d5a64){_0x4d5a64(null,path[_0x5a6e('0x28')](config[_0x5a6e('0x29')],_0x5a6e('0x30')));},'filename':function(_0xef61e9,_0x4c4c9f,_0x16a52a){_0x16a52a(null,util[_0x5a6e('0x31')](_0x5a6e('0x2a'),Date[_0x5a6e('0x2b')](),_0x4c4c9f['originalname']));}})});router['post']('/:id/avatar',upload['single'](_0x5a6e('0x2e')),controller[_0x5a6e('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12904e,_0x475b76,_0x1b0965){_0x1b0965(null,path[_0x5a6e('0x28')](config[_0x5a6e('0x29')],_0x5a6e('0x30')));},'filename':function(_0x419fa0,_0x2668ac,_0x46646e){_0x46646e(null,util[_0x5a6e('0x31')](_0x5a6e('0x2a'),Date[_0x5a6e('0x2b')](),_0x2668ac[_0x5a6e('0x2c')]));}})});router[_0x5a6e('0x22')]('/:id/customer_avatar',upload[_0x5a6e('0x2d')](_0x5a6e('0x2e')),controller[_0x5a6e('0x33')]);var upload=multer({'storage':multer[_0x5a6e('0x27')]({'destination':function(_0x431b70,_0x21a147,_0x103987){_0x103987(null,path['join'](config[_0x5a6e('0x29')],_0x5a6e('0x30')));},'filename':function(_0x120af2,_0x16da75,_0xdfdee7){_0xdfdee7(null,util[_0x5a6e('0x31')](_0x5a6e('0x2a'),Date['now'](),_0x16da75[_0x5a6e('0x2c')]));}})});router['post'](_0x5a6e('0x17'),upload[_0x5a6e('0x2d')](_0x5a6e('0x2e')),controller[_0x5a6e('0x34')]);router[_0x5a6e('0x22')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x5a6e('0x27')]({'destination':function(_0x321d3f,_0x1bda36,_0x5dbecb){const _0x49a0a7=path[_0x5a6e('0x28')](config[_0x5a6e('0x29')],_0x5a6e('0x35'),_0x5a6e('0x36'),_0x5a6e('0x37'));fs_extra[_0x5a6e('0x38')](_0x49a0a7,function(){_0x5dbecb(null,_0x49a0a7);});},'filename':function(_0x3a8cfc,_0x1c0184,_0x5e9685){const _0x4dbcc7=_0x1c0184['originalname'][_0x5a6e('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2fb44e=path[_0x5a6e('0x3a')](_0x4dbcc7);const _0x1106df=Date[_0x5a6e('0x2b')]()+'-'+_0x4dbcc7[_0x5a6e('0x39')](_0x2fb44e,'')+_0x2fb44e;_0x5e9685(null,_0x1106df);}})});router[_0x5a6e('0x22')]('/:id/offline',offlineUploadMulter[_0x5a6e('0x3b')](),controller[_0x5a6e('0x3c')]);router['post'](_0x5a6e('0x3d'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x5a6e('0x22')](_0x5a6e('0x1a'),auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x3e')]);router[_0x5a6e('0x22')](_0x5a6e('0x1c'),auth['isAuthenticated'](),controller[_0x5a6e('0x3f')]);router[_0x5a6e('0x22')]('/:id/users',auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x40')]);router[_0x5a6e('0x41')](_0x5a6e('0xd'),auth['isAuthenticated'](),controller[_0x5a6e('0x42')]);router[_0x5a6e('0x43')](_0x5a6e('0xd'),auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x44')]);router['delete'](_0x5a6e('0x24'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5a6e('0x43')](_0x5a6e('0x10'),auth[_0x5a6e('0xb')](),controller[_0x5a6e('0x45')]);router[_0x5a6e('0x43')]('/:id/users',auth[_0x5a6e('0xb')](),controller['removeAgents']);module[_0x5a6e('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5bad3f9..aa87988 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 _0x3974=['sequelize','exports','STRING','Google'];(function(_0x13b8a8,_0x114cb9){var _0x4f2876=function(_0x58ec9b){while(--_0x58ec9b){_0x13b8a8['push'](_0x13b8a8['shift']());}};_0x4f2876(++_0x114cb9);}(_0x3974,0xbc));var _0x4397=function(_0x20bf18,_0x5c7e03){_0x20bf18=_0x20bf18-0x0;var _0x260bd7=_0x3974[_0x20bf18];return _0x260bd7;};'use strict';var Sequelize=require(_0x4397('0x0'));module[_0x4397('0x1')]={'name':{'type':Sequelize[_0x4397('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x4397('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x4397('0x2')]},'data2':{'type':Sequelize[_0x4397('0x2')]}}; \ No newline at end of file +var _0x7d10=['AmazonAWS','Google','exports','STRING'];(function(_0x53a020,_0x5d8f62){var _0x26b9d5=function(_0x3c28aa){while(--_0x3c28aa){_0x53a020['push'](_0x53a020['shift']());}};_0x26b9d5(++_0x5d8f62);}(_0x7d10,0x1ce));var _0x07d1=function(_0x326aef,_0x57184f){_0x326aef=_0x326aef-0x0;var _0x41536e=_0x7d10[_0x326aef];return _0x41536e;};'use strict';var Sequelize=require('sequelize');module[_0x07d1('0x0')]={'name':{'type':Sequelize[_0x07d1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x07d1('0x2'),_0x07d1('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x07d1('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 470133f..c9f472e 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x6ff3a9,_0x13b9c2){var _0x249066=function(_0x47f270){while(--_0x47f270){_0x6ff3a9['push'](_0x6ff3a9['shift']());}};_0x249066(++_0x13b9c2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x0b0e[_0x28edda];return _0x21f4a4;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CloudProvider','fieldName','type','key'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xadb5,0xad));var _0x5adb=function(_0x2abf5c,_0x4fecaf){_0x2abf5c=_0x2abf5c-0x0;var _0x3677eb=_0xadb5[_0x2abf5c];return _0x3677eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CloudProvider']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index de64761..977ef4d 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 _0xde96=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x214353,_0x3ec4df){var _0x4ae560=function(_0x32bd1f){while(--_0x32bd1f){_0x214353['push'](_0x214353['shift']());}};_0x4ae560(++_0x3ec4df);}(_0xde96,0x1d4));var _0x6de9=function(_0x40a12a,_0x3340ef){_0x40a12a=_0x40a12a-0x0;var _0x41ed92=_0xde96[_0x40a12a];return _0x41ed92;};'use strict';var _=require(_0x6de9('0x0'));var util=require('util');var logger=require(_0x6de9('0x1'))(_0x6de9('0x2'));var moment=require(_0x6de9('0x3'));var BPromise=require(_0x6de9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6de9('0x5'));var rimraf=require('rimraf');var config=require(_0x6de9('0x6'));var attributes=require(_0x6de9('0x7'));module[_0x6de9('0x8')]=function(_0x1dc053,_0x2d1f06){return _0x1dc053['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a60=['cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5a60,0x1f0));var _0x05a6=function(_0x325b0c,_0x33747f){_0x325b0c=_0x325b0c-0x0;var _0x8e3945=_0x5a60[_0x325b0c];return _0x8e3945;};'use strict';var _=require('lodash');var util=require(_0x05a6('0x0'));var logger=require(_0x05a6('0x1'))(_0x05a6('0x2'));var moment=require(_0x05a6('0x3'));var BPromise=require(_0x05a6('0x4'));var rp=require(_0x05a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05a6('0x6'));var config=require(_0x05a6('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x05a6('0x8')]=function(_0xd8dd87,_0xe35541){return _0xd8dd87[_0x05a6('0x9')]('CloudProvider',attributes,{'tableName':_0x05a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 7f80a12..2ed6ff0 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 _0x9458=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x9458,0x1b8));var _0x8945=function(_0x51800b,_0x30849c){_0x51800b=_0x51800b-0x0;var _0x385f4a=_0x9458[_0x51800b];return _0x385f4a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8945('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8945('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8945('0x2'));var logger=require(_0x8945('0x3'))(_0x8945('0x4'));var config=require(_0x8945('0x5'));var jayson=require(_0x8945('0x6'));var client=jayson[_0x8945('0x7')][_0x8945('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12187d,_0x928802,_0x1a2b8f){return new BPromise(function(_0x4aec0b,_0x29eaed){return client[_0x8945('0x9')](_0x12187d,_0x1a2b8f)[_0x8945('0xa')](function(_0x307b9e){logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,'request\x20sent');logger[_0x8945('0xd')](_0x8945('0xe'),_0x928802,'request\x20sent',JSON['stringify'](_0x307b9e));if(_0x307b9e[_0x8945('0xf')]){if(_0x307b9e['error'][_0x8945('0x10')]===0x1f4){logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);return _0x29eaed(_0x307b9e[_0x8945('0xf')]['message']);}logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e['error'][_0x8945('0x11')]);return _0x4aec0b(_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);}else{logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,_0x8945('0x12'));_0x4aec0b(_0x307b9e['result']['message']);}})[_0x8945('0x13')](function(_0x4c0b8f){logger['error'](_0x8945('0xc'),_0x928802,_0x4c0b8f);_0x29eaed(_0x4c0b8f);});});} \ No newline at end of file +var _0xcf3d=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x15dc42,_0x345727){var _0x7bb3b5=function(_0x25c7d7){while(--_0x25c7d7){_0x15dc42['push'](_0x15dc42['shift']());}};_0x7bb3b5(++_0x345727);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x19f8e6,_0xaf2ce1){_0x19f8e6=_0x19f8e6-0x0;var _0x2f76d9=_0xcf3d[_0x19f8e6];return _0x2f76d9;};'use strict';var _=require(_0xdcf3('0x0'));var util=require(_0xdcf3('0x1'));var moment=require(_0xdcf3('0x2'));var BPromise=require(_0xdcf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdcf3('0x5'));var logger=require(_0xdcf3('0x6'))(_0xdcf3('0x7'));var config=require(_0xdcf3('0x8'));var jayson=require(_0xdcf3('0x9'));var client=jayson[_0xdcf3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43f8d5,_0x47dde8,_0x2cd0af){return new BPromise(function(_0x45c5bd,_0x55fe3a){return client['request'](_0x43f8d5,_0x2cd0af)['then'](function(_0x4515a2){logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));logger[_0xdcf3('0xe')](_0xdcf3('0xf'),_0x47dde8,_0xdcf3('0xd'),JSON[_0xdcf3('0x10')](_0x4515a2));if(_0x4515a2[_0xdcf3('0x11')]){if(_0x4515a2['error'][_0xdcf3('0x12')]===0x1f4){logger[_0xdcf3('0x11')]('CloudProvider,\x20%s,\x20%s',_0x47dde8,_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);return _0x55fe3a(_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);}logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x4515a2[_0xdcf3('0x11')]['message']);return _0x45c5bd(_0x4515a2[_0xdcf3('0x11')]['message']);}else{logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));_0x45c5bd(_0x4515a2[_0xdcf3('0x14')]['message']);}})[_0xdcf3('0x15')](function(_0x24cce5){logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x24cce5);_0x55fe3a(_0x24cce5);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a061ee3..0b0f788 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 _0x4230=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x52638d,_0x54e663){var _0x158910=function(_0x319efe){while(--_0x319efe){_0x52638d['push'](_0x52638d['shift']());}};_0x158910(++_0x54e663);}(_0x4230,0xed));var _0x0423=function(_0x48b83a,_0x304bc1){_0x48b83a=_0x48b83a-0x0;var _0x54c547=_0x4230[_0x48b83a];return _0x54c547;};'use strict';var multer=require(_0x0423('0x0'));var util=require(_0x0423('0x1'));var path=require(_0x0423('0x2'));var timeout=require('connect-timeout');var express=require(_0x0423('0x3'));var router=express['Router']();var fs_extra=require(_0x0423('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0423('0x5'));var config=require(_0x0423('0x6'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0x0423('0x7')](),controller['index']);router[_0x0423('0x8')](_0x0423('0x9'),auth[_0x0423('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0423('0xa')]);router[_0x0423('0xb')](_0x0423('0x9'),auth[_0x0423('0x7')](),controller[_0x0423('0xc')]);router[_0x0423('0xd')](_0x0423('0x9'),auth[_0x0423('0x7')](),controller[_0x0423('0xe')]);module[_0x0423('0xf')]=router; \ No newline at end of file +var _0x41ca=['../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','fs-extra'];(function(_0x308f6d,_0x9277bc){var _0xb3921e=function(_0x1b4e22){while(--_0x1b4e22){_0x308f6d['push'](_0x308f6d['shift']());}};_0xb3921e(++_0x9277bc);}(_0x41ca,0x195));var _0xa41c=function(_0x152c88,_0x5949dd){_0x152c88=_0x152c88-0x0;var _0x3fa8b6=_0x41ca[_0x152c88];return _0x3fa8b6;};'use strict';var multer=require(_0xa41c('0x0'));var util=require(_0xa41c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa41c('0x2'));var auth=require(_0xa41c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa41c('0x4'));router[_0xa41c('0x5')]('/',auth[_0xa41c('0x6')](),controller[_0xa41c('0x7')]);router['get'](_0xa41c('0x8'),auth['isAuthenticated'](),controller[_0xa41c('0x9')]);router[_0xa41c('0xa')]('/',auth[_0xa41c('0x6')](),controller[_0xa41c('0xb')]);router[_0xa41c('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xa41c('0xd')]);router[_0xa41c('0xe')](_0xa41c('0x8'),auth[_0xa41c('0x6')](),controller[_0xa41c('0xf')]);module[_0xa41c('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 3778586..8fbbdf2 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 _0xbd50=['STRING','sequelize','exports'];(function(_0x3f3016,_0x4a1c1e){var _0x2e5d77=function(_0x499f20){while(--_0x499f20){_0x3f3016['push'](_0x3f3016['shift']());}};_0x2e5d77(++_0x4a1c1e);}(_0xbd50,0x196));var _0x0bd5=function(_0x2cb111,_0x3c5f83){_0x2cb111=_0x2cb111-0x0;var _0x52d31d=_0xbd50[_0x2cb111];return _0x52d31d;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0bd5('0x2')]},'companyId':{'type':Sequelize[_0x0bd5('0x2')]},'website':{'type':Sequelize[_0x0bd5('0x2')]},'phone':{'type':Sequelize[_0x0bd5('0x2')]},'fax':{'type':Sequelize[_0x0bd5('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x0bd5('0x2')]},'country':{'type':Sequelize[_0x0bd5('0x2')]},'email':{'type':Sequelize[_0x0bd5('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0bd5('0x2')]},'sStreet':{'type':Sequelize[_0x0bd5('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0bd5('0x2')]},'description':{'type':Sequelize[_0x0bd5('0x2')]}}; \ No newline at end of file +var _0xe68d=['name','sequelize','STRING'];(function(_0x3fcfb6,_0x515024){var _0x3b99a7=function(_0x10ddfd){while(--_0x10ddfd){_0x3fcfb6['push'](_0x3fcfb6['shift']());}};_0x3b99a7(++_0x515024);}(_0xe68d,0xcd));var _0xde68=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0xe68d[_0x8e8ca7];return _0x561381;};'use strict';var Sequelize=require(_0xde68('0x0'));module['exports']={'name':{'type':Sequelize[_0xde68('0x1')],'unique':_0xde68('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xde68('0x1')]},'website':{'type':Sequelize[_0xde68('0x1')]},'phone':{'type':Sequelize[_0xde68('0x1')]},'fax':{'type':Sequelize[_0xde68('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xde68('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xde68('0x1')]},'email':{'type':Sequelize[_0xde68('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xde68('0x1')]},'sStreet':{'type':Sequelize[_0xde68('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xde68('0x1')]},'sCountry':{'type':Sequelize[_0xde68('0x1')]},'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 351db7c..6bfc426 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 _0x712b=['include','findAll','rows','catch','show','params','rawAttributes','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','addContacts','CmContact','ids','getContacts','findOne','filter','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Companies','error','stack','name','send','index','CmCompany','describe','keys','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','options','includeAll'];(function(_0x4e7e79,_0x1f193b){var _0x40f890=function(_0x2661eb){while(--_0x2661eb){_0x4e7e79['push'](_0x4e7e79['shift']());}};_0x40f890(++_0x1f193b);}(_0x712b,0xd3));var _0xb712=function(_0x49259e,_0x5a110e){_0x49259e=_0x49259e-0x0;var _0x3f08d4=_0x712b[_0x49259e];return _0x3f08d4;};'use strict';var emlformat=require(_0xb712('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb712('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb712('0x2'));var moment=require(_0xb712('0x3'));var BPromise=require(_0xb712('0x4'));var Mustache=require(_0xb712('0x5'));var util=require(_0xb712('0x6'));var path=require(_0xb712('0x7'));var sox=require(_0xb712('0x8'));var csv=require(_0xb712('0x9'));var ejs=require(_0xb712('0xa'));var fs=require('fs');var fs_extra=require(_0xb712('0xb'));var _=require(_0xb712('0xc'));var squel=require(_0xb712('0xd'));var crypto=require(_0xb712('0xe'));var jsforce=require(_0xb712('0xf'));var deskjs=require(_0xb712('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb712('0x11'));var Papa=require(_0xb712('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb712('0x13'));var as=require(_0xb712('0x14'));var hardwareService=require(_0xb712('0x15'));var logger=require(_0xb712('0x16'))(_0xb712('0x17'));var utils=require(_0xb712('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb712('0x19'));var db=require(_0xb712('0x1a'))['db'];function respondWithStatusCode(_0x51f495,_0x28b192){_0x28b192=_0x28b192||0xcc;return function(_0xf7f615){if(_0xf7f615){return _0x51f495[_0xb712('0x1b')](_0x28b192);}return _0x51f495['status'](_0x28b192)[_0xb712('0x1c')]();};}function respondWithResult(_0x2f0909,_0x2abb68){_0x2abb68=_0x2abb68||0xc8;return function(_0x1eefe8){if(_0x1eefe8){return _0x2f0909[_0xb712('0x1d')](_0x2abb68)[_0xb712('0x1e')](_0x1eefe8);}};}function respondWithFilteredResult(_0x1b93f7,_0xd16ab3){return function(_0x380e4d){if(_0x380e4d){var _0x58a18d=typeof _0xd16ab3['offset']==='undefined'&&typeof _0xd16ab3['limit']==='undefined';var _0x1b4c5f=_0x380e4d[_0xb712('0x1f')];var _0x3f326c=_0x58a18d?0x0:_0xd16ab3['offset'];var _0x4b85ce=_0x58a18d?_0x380e4d[_0xb712('0x1f')]:_0xd16ab3[_0xb712('0x20')]+_0xd16ab3[_0xb712('0x21')];var _0x3c4149;if(_0x4b85ce>=_0x1b4c5f){_0x4b85ce=_0x1b4c5f;_0x3c4149=0xc8;}else{_0x3c4149=0xce;}_0x1b93f7[_0xb712('0x1d')](_0x3c4149);return _0x1b93f7[_0xb712('0x22')](_0xb712('0x23'),_0x3f326c+'-'+_0x4b85ce+'/'+_0x1b4c5f)[_0xb712('0x1e')](_0x380e4d);}return null;};}function patchUpdates(_0x63d833){return function(_0x496b4e){try{jsonpatch[_0xb712('0x24')](_0x496b4e,_0x63d833,!![]);}catch(_0x5ae49e){return BPromise[_0xb712('0x25')](_0x5ae49e);}return _0x496b4e[_0xb712('0x26')]();};}function saveUpdates(_0x10fa59,_0x43df90){return function(_0x42bfbf){if(_0x42bfbf){return _0x42bfbf['update'](_0x10fa59)[_0xb712('0x27')](function(_0x884361){return _0x884361;});}return null;};}function removeEntity(_0x2d7bf7,_0x26fd44){return function(_0x2e10f0){if(_0x2e10f0){return _0x2e10f0[_0xb712('0x28')]()[_0xb712('0x27')](function(){var _0x488b1f=_0x2e10f0['get']({'plain':!![]});var _0x56a09c=_0xb712('0x29');return db['UserProfileResource'][_0xb712('0x28')]({'where':{'type':_0x56a09c,'resourceId':_0x488b1f['id']}})['then'](function(){return _0x2e10f0;});})['then'](function(){_0x2d7bf7[_0xb712('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3ae9,_0x36aa5b){return function(_0x4feb1b){if(!_0x4feb1b){_0x1c3ae9[_0xb712('0x1b')](0x194);}return _0x4feb1b;};}function handleError(_0xdd79f5,_0x8bd91c){_0x8bd91c=_0x8bd91c||0x1f4;return function(_0x363d3a){logger[_0xb712('0x2a')](_0x363d3a[_0xb712('0x2b')]);if(_0x363d3a[_0xb712('0x2c')]){delete _0x363d3a['name'];}_0xdd79f5[_0xb712('0x1d')](_0x8bd91c)[_0xb712('0x2d')](_0x363d3a);};}exports[_0xb712('0x2e')]=function(_0x29ba0a,_0x1754e6){var _0x2525c9={},_0x278508={},_0x37ef1c={'count':0x0,'rows':[]};return db[_0xb712('0x2f')][_0xb712('0x30')]()[_0xb712('0x27')](function(_0x2a579b){_0x278508['model']=_[_0xb712('0x31')](_0x2a579b);_0x278508['query']=_[_0xb712('0x31')](_0x29ba0a[_0xb712('0x32')]);_0x278508['filters']=_[_0xb712('0x33')](_0x278508[_0xb712('0x34')],_0x278508[_0xb712('0x32')]);_0x2525c9[_0xb712('0x35')]=_[_0xb712('0x33')](_0x278508[_0xb712('0x34')],qs['fields'](_0x29ba0a[_0xb712('0x32')]['fields']));_0x2525c9[_0xb712('0x35')]=_0x2525c9[_0xb712('0x35')]['length']?_0x2525c9[_0xb712('0x35')]:_0x278508[_0xb712('0x34')];if(!_0x29ba0a[_0xb712('0x32')][_0xb712('0x36')](_0xb712('0x37'))){_0x2525c9['limit']=qs[_0xb712('0x21')](_0x29ba0a[_0xb712('0x32')][_0xb712('0x21')]);_0x2525c9['offset']=qs[_0xb712('0x20')](_0x29ba0a[_0xb712('0x32')][_0xb712('0x20')]);}_0x2525c9[_0xb712('0x38')]=qs[_0xb712('0x39')](_0x29ba0a['query']['sort']);_0x2525c9[_0xb712('0x3a')]=qs[_0xb712('0x3b')](_[_0xb712('0x3c')](_0x29ba0a[_0xb712('0x32')],_0x278508[_0xb712('0x3b')]),_0x2a579b);if(_0x29ba0a['query']['filter']){_0x2525c9[_0xb712('0x3a')]=_[_0xb712('0x3d')](_0x2525c9[_0xb712('0x3a')],{'$or':_[_0xb712('0x3e')](_0x2525c9['attributes'],function(_0x574573){var _0x2f9c03={};_0x2f9c03[_0x574573]={'$like':'%'+_0x29ba0a[_0xb712('0x32')]['filter']+'%'};return _0x2f9c03;})});}_0x2525c9=_[_0xb712('0x3d')]({},_0x2525c9,_0x29ba0a[_0xb712('0x3f')]);var _0x22c082={'where':_0x2525c9[_0xb712('0x3a')]};return db[_0xb712('0x2f')][_0xb712('0x1f')](_0x22c082)[_0xb712('0x27')](function(_0x2495df){_0x37ef1c[_0xb712('0x1f')]=_0x2495df;if(_0x29ba0a['query'][_0xb712('0x40')]){_0x2525c9[_0xb712('0x41')]=[{'all':!![]}];}return db[_0xb712('0x2f')][_0xb712('0x42')](_0x2525c9);})[_0xb712('0x27')](function(_0x19f0c3){_0x37ef1c[_0xb712('0x43')]=_0x19f0c3;return _0x37ef1c;})[_0xb712('0x27')](respondWithFilteredResult(_0x1754e6,_0x2525c9))[_0xb712('0x44')](handleError(_0x1754e6,null));})[_0xb712('0x44')](handleError(_0x1754e6,null));};exports[_0xb712('0x45')]=function(_0x2c2a02,_0x5733fd){var _0x366672={'raw':![],'where':{'id':_0x2c2a02[_0xb712('0x46')]['id']}},_0x2cfb22={};_0x2cfb22[_0xb712('0x34')]=_[_0xb712('0x31')](db[_0xb712('0x2f')][_0xb712('0x47')]);_0x2cfb22[_0xb712('0x32')]=_[_0xb712('0x31')](_0x2c2a02['query']);_0x2cfb22[_0xb712('0x3b')]=_[_0xb712('0x33')](_0x2cfb22['model'],_0x2cfb22[_0xb712('0x32')]);_0x366672[_0xb712('0x35')]=_['intersection'](_0x2cfb22[_0xb712('0x34')],qs[_0xb712('0x48')](_0x2c2a02[_0xb712('0x32')][_0xb712('0x48')]));_0x366672[_0xb712('0x35')]=_0x366672[_0xb712('0x35')][_0xb712('0x49')]?_0x366672[_0xb712('0x35')]:_0x2cfb22[_0xb712('0x34')];if(_0x2c2a02[_0xb712('0x32')][_0xb712('0x40')]){_0x366672[_0xb712('0x41')]=[{'all':!![]}];}_0x366672=_[_0xb712('0x3d')]({},_0x366672,_0x2c2a02[_0xb712('0x3f')]);return db[_0xb712('0x2f')][_0xb712('0x4a')](_0x366672)[_0xb712('0x27')](handleEntityNotFound(_0x5733fd,null))['then'](respondWithResult(_0x5733fd,null))[_0xb712('0x44')](handleError(_0x5733fd,null));};exports[_0xb712('0x4b')]=function(_0x274080,_0x5bc8b6){return db[_0xb712('0x2f')][_0xb712('0x4b')](_0x274080[_0xb712('0x4c')],{})[_0xb712('0x27')](function(_0x67625f){var _0x444920=_0x274080[_0xb712('0x4d')][_0xb712('0x4e')]({'plain':!![]});if(!_0x444920)throw new Error(_0xb712('0x4f'));if(_0x444920[_0xb712('0x50')]===_0xb712('0x4d')){var _0x3ae621=_0x67625f[_0xb712('0x4e')]({'plain':!![]});var _0x3d049c='Companies';return db[_0xb712('0x51')][_0xb712('0x4a')]({'where':{'name':_0x3d049c,'userProfileId':_0x444920[_0xb712('0x52')]},'raw':!![]})[_0xb712('0x27')](function(_0x5cc378){if(_0x5cc378&&_0x5cc378[_0xb712('0x53')]===0x0){return db[_0xb712('0x54')][_0xb712('0x4b')]({'name':_0x3ae621[_0xb712('0x2c')],'resourceId':_0x3ae621['id'],'type':_0x5cc378[_0xb712('0x2c')],'sectionId':_0x5cc378['id']},{})['then'](function(){return _0x67625f;});}else{return _0x67625f;}})[_0xb712('0x44')](function(_0x5dbf4c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dbf4c);throw _0x5dbf4c;});}return _0x67625f;})[_0xb712('0x27')](respondWithResult(_0x5bc8b6,0xc9))['catch'](handleError(_0x5bc8b6,null));};exports[_0xb712('0x55')]=function(_0x4195f2,_0x1c55d2){if(_0x4195f2[_0xb712('0x4c')]['id']){delete _0x4195f2[_0xb712('0x4c')]['id'];}return db['CmCompany'][_0xb712('0x4a')]({'where':{'id':_0x4195f2['params']['id']}})['then'](handleEntityNotFound(_0x1c55d2,null))['then'](saveUpdates(_0x4195f2[_0xb712('0x4c')],null))[_0xb712('0x27')](respondWithResult(_0x1c55d2,null))['catch'](handleError(_0x1c55d2,null));};exports[_0xb712('0x28')]=function(_0x478c9e,_0x3bb1ed){return db[_0xb712('0x2f')][_0xb712('0x4a')]({'where':{'id':_0x478c9e['params']['id']}})[_0xb712('0x27')](handleEntityNotFound(_0x3bb1ed,null))[_0xb712('0x27')](removeEntity(_0x3bb1ed,null))[_0xb712('0x44')](handleError(_0x3bb1ed,null));};exports[_0xb712('0x30')]=function(_0x1aed82,_0x7566ba){return db[_0xb712('0x2f')][_0xb712('0x30')]()[_0xb712('0x27')](respondWithResult(_0x7566ba,null))['catch'](handleError(_0x7566ba,null));};exports[_0xb712('0x56')]=function(_0x561e0b,_0x1e7c9c,_0x3ec498){return db[_0xb712('0x57')][_0xb712('0x4a')]({'where':{'id':_0x561e0b[_0xb712('0x46')]['id']}})[_0xb712('0x27')](handleEntityNotFound(_0x1e7c9c,null))[_0xb712('0x27')](function(_0x3b2c74){if(_0x3b2c74){return _0x3b2c74[_0xb712('0x56')](_0x561e0b['body'][_0xb712('0x58')],_['omit'](_0x561e0b[_0xb712('0x4c')],[_0xb712('0x58'),'id'])||{});}})[_0xb712('0x27')](respondWithResult(_0x1e7c9c,null))['catch'](handleError(_0x1e7c9c,null));};exports[_0xb712('0x59')]=function(_0x17748a,_0x42df4f,_0x149f83){var _0x3d7511={};var _0x33afbc={};var _0x549f3c;var _0x36907a;return db[_0xb712('0x2f')][_0xb712('0x5a')]({'where':{'id':_0x17748a[_0xb712('0x46')]['id']}})[_0xb712('0x27')](handleEntityNotFound(_0x42df4f,null))['then'](function(_0x38e5e4){if(_0x38e5e4){_0x549f3c=_0x38e5e4;_0x33afbc[_0xb712('0x34')]=_[_0xb712('0x31')](db[_0xb712('0x57')][_0xb712('0x47')]);_0x33afbc['query']=_[_0xb712('0x31')](_0x17748a[_0xb712('0x32')]);_0x33afbc[_0xb712('0x3b')]=_['intersection'](_0x33afbc[_0xb712('0x34')],_0x33afbc[_0xb712('0x32')]);_0x3d7511['attributes']=_[_0xb712('0x33')](_0x33afbc[_0xb712('0x34')],qs['fields'](_0x17748a[_0xb712('0x32')][_0xb712('0x48')]));_0x3d7511[_0xb712('0x35')]=_0x3d7511[_0xb712('0x35')][_0xb712('0x49')]?_0x3d7511[_0xb712('0x35')]:_0x33afbc['model'];_0x3d7511[_0xb712('0x38')]=qs[_0xb712('0x39')](_0x17748a[_0xb712('0x32')][_0xb712('0x39')]);_0x3d7511[_0xb712('0x3a')]=qs['filters'](_[_0xb712('0x3c')](_0x17748a[_0xb712('0x32')],_0x33afbc[_0xb712('0x3b')]));if(_0x17748a[_0xb712('0x32')][_0xb712('0x5b')]){_0x3d7511[_0xb712('0x3a')]=_[_0xb712('0x3d')](_0x3d7511[_0xb712('0x3a')],{'$or':_[_0xb712('0x3e')](_0x3d7511[_0xb712('0x35')],function(_0x586aaa){var _0x1f3367={};_0x1f3367[_0x586aaa]={'$like':'%'+_0x17748a['query'][_0xb712('0x5b')]+'%'};return _0x1f3367;})});}_0x3d7511=_[_0xb712('0x3d')]({},_0x3d7511,_0x17748a['options']);return _0x549f3c[_0xb712('0x59')](_0x3d7511);}})[_0xb712('0x27')](function(_0x4df4f5){if(_0x4df4f5){_0x36907a=_0x4df4f5['length'];if(!_0x17748a[_0xb712('0x32')][_0xb712('0x36')](_0xb712('0x37'))){_0x3d7511['limit']=qs[_0xb712('0x21')](_0x17748a[_0xb712('0x32')][_0xb712('0x21')]);_0x3d7511[_0xb712('0x20')]=qs['offset'](_0x17748a['query'][_0xb712('0x20')]);}return _0x549f3c[_0xb712('0x59')](_0x3d7511);}})[_0xb712('0x27')](function(_0x417558){if(_0x417558){return _0x417558?{'count':_0x36907a,'rows':_0x417558}:null;}})[_0xb712('0x27')](respondWithResult(_0x42df4f,null))[_0xb712('0x44')](handleError(_0x42df4f,null));}; \ No newline at end of file +var _0x6abf=['apply','update','then','destroy','get','Companies','error','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','omit','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x4a42f0,_0x2da65d){var _0x3dc532=function(_0xb60cdf){while(--_0xb60cdf){_0x4a42f0['push'](_0x4a42f0['shift']());}};_0x3dc532(++_0x2da65d);}(_0x6abf,0x90));var _0xf6ab=function(_0x23270f,_0x5a8ffb){_0x23270f=_0x23270f-0x0;var _0x6a062b=_0x6abf[_0x23270f];return _0x6a062b;};'use strict';var emlformat=require(_0xf6ab('0x0'));var rimraf=require(_0xf6ab('0x1'));var zipdir=require(_0xf6ab('0x2'));var jsonpatch=require(_0xf6ab('0x3'));var rp=require(_0xf6ab('0x4'));var moment=require(_0xf6ab('0x5'));var BPromise=require(_0xf6ab('0x6'));var Mustache=require(_0xf6ab('0x7'));var util=require(_0xf6ab('0x8'));var path=require('path');var sox=require(_0xf6ab('0x9'));var csv=require(_0xf6ab('0xa'));var ejs=require(_0xf6ab('0xb'));var fs=require('fs');var fs_extra=require(_0xf6ab('0xc'));var _=require(_0xf6ab('0xd'));var squel=require(_0xf6ab('0xe'));var crypto=require(_0xf6ab('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf6ab('0x10'));var toCsv=require(_0xf6ab('0xa'));var querystring=require(_0xf6ab('0x11'));var Papa=require('papaparse');var Redis=require(_0xf6ab('0x12'));var authService=require(_0xf6ab('0x13'));var qs=require(_0xf6ab('0x14'));var as=require(_0xf6ab('0x15'));var hardwareService=require(_0xf6ab('0x16'));var logger=require(_0xf6ab('0x17'))(_0xf6ab('0x18'));var utils=require(_0xf6ab('0x19'));var config=require(_0xf6ab('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf6ab('0x1b'))['db'];function respondWithStatusCode(_0x2cf7b5,_0x20beb8){_0x20beb8=_0x20beb8||0xcc;return function(_0x12dd75){if(_0x12dd75){return _0x2cf7b5[_0xf6ab('0x1c')](_0x20beb8);}return _0x2cf7b5['status'](_0x20beb8)[_0xf6ab('0x1d')]();};}function respondWithResult(_0x17149a,_0x3e51ad){_0x3e51ad=_0x3e51ad||0xc8;return function(_0x4c3992){if(_0x4c3992){return _0x17149a[_0xf6ab('0x1e')](_0x3e51ad)[_0xf6ab('0x1f')](_0x4c3992);}};}function respondWithFilteredResult(_0x23e839,_0x56e36f){return function(_0x25ff20){if(_0x25ff20){var _0x3979d5=typeof _0x56e36f['offset']===_0xf6ab('0x20')&&typeof _0x56e36f[_0xf6ab('0x21')]===_0xf6ab('0x20');var _0x170bd2=_0x25ff20[_0xf6ab('0x22')];var _0x25b157=_0x3979d5?0x0:_0x56e36f['offset'];var _0x302a15=_0x3979d5?_0x25ff20[_0xf6ab('0x22')]:_0x56e36f[_0xf6ab('0x23')]+_0x56e36f[_0xf6ab('0x21')];var _0x464d34;if(_0x302a15>=_0x170bd2){_0x302a15=_0x170bd2;_0x464d34=0xc8;}else{_0x464d34=0xce;}_0x23e839[_0xf6ab('0x1e')](_0x464d34);return _0x23e839[_0xf6ab('0x24')](_0xf6ab('0x25'),_0x25b157+'-'+_0x302a15+'/'+_0x170bd2)['json'](_0x25ff20);}return null;};}function patchUpdates(_0xcba4da){return function(_0x3066da){try{jsonpatch[_0xf6ab('0x26')](_0x3066da,_0xcba4da,!![]);}catch(_0xb6b24a){return BPromise['reject'](_0xb6b24a);}return _0x3066da['save']();};}function saveUpdates(_0x5be73d,_0x2a9bfd){return function(_0x3f77b4){if(_0x3f77b4){return _0x3f77b4[_0xf6ab('0x27')](_0x5be73d)[_0xf6ab('0x28')](function(_0x1bb3d9){return _0x1bb3d9;});}return null;};}function removeEntity(_0xcf3532,_0x269a27){return function(_0x54f75e){if(_0x54f75e){return _0x54f75e[_0xf6ab('0x29')]()[_0xf6ab('0x28')](function(){var _0x28734d=_0x54f75e[_0xf6ab('0x2a')]({'plain':!![]});var _0x556076=_0xf6ab('0x2b');return db['UserProfileResource'][_0xf6ab('0x29')]({'where':{'type':_0x556076,'resourceId':_0x28734d['id']}})['then'](function(){return _0x54f75e;});})[_0xf6ab('0x28')](function(){_0xcf3532[_0xf6ab('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x404493,_0x360c80){return function(_0x118391){if(!_0x118391){_0x404493[_0xf6ab('0x1c')](0x194);}return _0x118391;};}function handleError(_0xc4ab96,_0xcf814c){_0xcf814c=_0xcf814c||0x1f4;return function(_0x2b2ad2){logger[_0xf6ab('0x2c')](_0x2b2ad2[_0xf6ab('0x2d')]);if(_0x2b2ad2[_0xf6ab('0x2e')]){delete _0x2b2ad2[_0xf6ab('0x2e')];}_0xc4ab96[_0xf6ab('0x1e')](_0xcf814c)[_0xf6ab('0x2f')](_0x2b2ad2);};}exports[_0xf6ab('0x30')]=function(_0x3ab182,_0x480ee5){var _0x3501c5={},_0x4940d5={},_0x335dd5={'count':0x0,'rows':[]};return db[_0xf6ab('0x31')][_0xf6ab('0x32')]()['then'](function(_0x374a7c){_0x4940d5['model']=_[_0xf6ab('0x33')](_0x374a7c);_0x4940d5[_0xf6ab('0x34')]=_[_0xf6ab('0x33')](_0x3ab182[_0xf6ab('0x34')]);_0x4940d5[_0xf6ab('0x35')]=_[_0xf6ab('0x36')](_0x4940d5[_0xf6ab('0x37')],_0x4940d5[_0xf6ab('0x34')]);_0x3501c5[_0xf6ab('0x38')]=_[_0xf6ab('0x36')](_0x4940d5[_0xf6ab('0x37')],qs['fields'](_0x3ab182[_0xf6ab('0x34')]['fields']));_0x3501c5[_0xf6ab('0x38')]=_0x3501c5[_0xf6ab('0x38')][_0xf6ab('0x39')]?_0x3501c5['attributes']:_0x4940d5[_0xf6ab('0x37')];if(!_0x3ab182[_0xf6ab('0x34')][_0xf6ab('0x3a')](_0xf6ab('0x3b'))){_0x3501c5[_0xf6ab('0x21')]=qs[_0xf6ab('0x21')](_0x3ab182[_0xf6ab('0x34')][_0xf6ab('0x21')]);_0x3501c5[_0xf6ab('0x23')]=qs[_0xf6ab('0x23')](_0x3ab182['query'][_0xf6ab('0x23')]);}_0x3501c5[_0xf6ab('0x3c')]=qs[_0xf6ab('0x3d')](_0x3ab182[_0xf6ab('0x34')][_0xf6ab('0x3d')]);_0x3501c5[_0xf6ab('0x3e')]=qs[_0xf6ab('0x35')](_['pick'](_0x3ab182[_0xf6ab('0x34')],_0x4940d5[_0xf6ab('0x35')]),_0x374a7c);if(_0x3ab182['query'][_0xf6ab('0x3f')]){_0x3501c5['where']=_[_0xf6ab('0x40')](_0x3501c5[_0xf6ab('0x3e')],{'$or':_[_0xf6ab('0x41')](_0x3501c5[_0xf6ab('0x38')],function(_0x3eb7e3){var _0xdcb9d1={};_0xdcb9d1[_0x3eb7e3]={'$like':'%'+_0x3ab182['query'][_0xf6ab('0x3f')]+'%'};return _0xdcb9d1;})});}_0x3501c5=_['merge']({},_0x3501c5,_0x3ab182[_0xf6ab('0x42')]);var _0x428c8b={'where':_0x3501c5[_0xf6ab('0x3e')]};return db['CmCompany']['count'](_0x428c8b)[_0xf6ab('0x28')](function(_0x315087){_0x335dd5[_0xf6ab('0x22')]=_0x315087;if(_0x3ab182[_0xf6ab('0x34')][_0xf6ab('0x43')]){_0x3501c5['include']=[{'all':!![]}];}return db[_0xf6ab('0x31')][_0xf6ab('0x44')](_0x3501c5);})['then'](function(_0x192151){_0x335dd5[_0xf6ab('0x45')]=_0x192151;return _0x335dd5;})[_0xf6ab('0x28')](respondWithFilteredResult(_0x480ee5,_0x3501c5))['catch'](handleError(_0x480ee5,null));})[_0xf6ab('0x46')](handleError(_0x480ee5,null));};exports[_0xf6ab('0x47')]=function(_0x14de97,_0x357fb1){var _0xff7cc4={'raw':![],'where':{'id':_0x14de97[_0xf6ab('0x48')]['id']}},_0x17247e={};_0x17247e[_0xf6ab('0x37')]=_['keys'](db[_0xf6ab('0x31')][_0xf6ab('0x49')]);_0x17247e[_0xf6ab('0x34')]=_[_0xf6ab('0x33')](_0x14de97['query']);_0x17247e[_0xf6ab('0x35')]=_[_0xf6ab('0x36')](_0x17247e[_0xf6ab('0x37')],_0x17247e['query']);_0xff7cc4[_0xf6ab('0x38')]=_[_0xf6ab('0x36')](_0x17247e['model'],qs[_0xf6ab('0x4a')](_0x14de97[_0xf6ab('0x34')][_0xf6ab('0x4a')]));_0xff7cc4[_0xf6ab('0x38')]=_0xff7cc4[_0xf6ab('0x38')][_0xf6ab('0x39')]?_0xff7cc4['attributes']:_0x17247e['model'];if(_0x14de97['query'][_0xf6ab('0x43')]){_0xff7cc4[_0xf6ab('0x4b')]=[{'all':!![]}];}_0xff7cc4=_[_0xf6ab('0x40')]({},_0xff7cc4,_0x14de97['options']);return db[_0xf6ab('0x31')][_0xf6ab('0x4c')](_0xff7cc4)[_0xf6ab('0x28')](handleEntityNotFound(_0x357fb1,null))[_0xf6ab('0x28')](respondWithResult(_0x357fb1,null))[_0xf6ab('0x46')](handleError(_0x357fb1,null));};exports[_0xf6ab('0x4d')]=function(_0x208e1,_0xf67702){return db[_0xf6ab('0x31')]['create'](_0x208e1['body'],{})[_0xf6ab('0x28')](function(_0x4ffe9a){var _0x597cf0=_0x208e1[_0xf6ab('0x4e')][_0xf6ab('0x2a')]({'plain':!![]});if(!_0x597cf0)throw new Error(_0xf6ab('0x4f'));if(_0x597cf0[_0xf6ab('0x50')]===_0xf6ab('0x4e')){var _0x35b005=_0x4ffe9a['get']({'plain':!![]});var _0x17addb=_0xf6ab('0x2b');return db['UserProfileSection'][_0xf6ab('0x4c')]({'where':{'name':_0x17addb,'userProfileId':_0x597cf0[_0xf6ab('0x51')]},'raw':!![]})[_0xf6ab('0x28')](function(_0x11fb8d){if(_0x11fb8d&&_0x11fb8d[_0xf6ab('0x52')]===0x0){return db['UserProfileResource'][_0xf6ab('0x4d')]({'name':_0x35b005[_0xf6ab('0x2e')],'resourceId':_0x35b005['id'],'type':_0x11fb8d[_0xf6ab('0x2e')],'sectionId':_0x11fb8d['id']},{})[_0xf6ab('0x28')](function(){return _0x4ffe9a;});}else{return _0x4ffe9a;}})['catch'](function(_0x362a2c){logger[_0xf6ab('0x2c')](_0xf6ab('0x53'),_0x362a2c);throw _0x362a2c;});}return _0x4ffe9a;})['then'](respondWithResult(_0xf67702,0xc9))[_0xf6ab('0x46')](handleError(_0xf67702,null));};exports[_0xf6ab('0x27')]=function(_0x1dde52,_0x1231de){if(_0x1dde52[_0xf6ab('0x54')]['id']){delete _0x1dde52[_0xf6ab('0x54')]['id'];}return db[_0xf6ab('0x31')][_0xf6ab('0x4c')]({'where':{'id':_0x1dde52[_0xf6ab('0x48')]['id']}})[_0xf6ab('0x28')](handleEntityNotFound(_0x1231de,null))[_0xf6ab('0x28')](saveUpdates(_0x1dde52[_0xf6ab('0x54')],null))['then'](respondWithResult(_0x1231de,null))[_0xf6ab('0x46')](handleError(_0x1231de,null));};exports[_0xf6ab('0x29')]=function(_0x6d7349,_0x1e9903){return db['CmCompany']['find']({'where':{'id':_0x6d7349['params']['id']}})['then'](handleEntityNotFound(_0x1e9903,null))[_0xf6ab('0x28')](removeEntity(_0x1e9903,null))[_0xf6ab('0x46')](handleError(_0x1e9903,null));};exports[_0xf6ab('0x32')]=function(_0x48faa1,_0x380c3f){return db[_0xf6ab('0x31')][_0xf6ab('0x32')]()['then'](respondWithResult(_0x380c3f,null))[_0xf6ab('0x46')](handleError(_0x380c3f,null));};exports[_0xf6ab('0x55')]=function(_0x1001a1,_0x35d68c,_0x52fd77){return db[_0xf6ab('0x56')]['find']({'where':{'id':_0x1001a1[_0xf6ab('0x48')]['id']}})[_0xf6ab('0x28')](handleEntityNotFound(_0x35d68c,null))['then'](function(_0x103b16){if(_0x103b16){return _0x103b16[_0xf6ab('0x55')](_0x1001a1['body']['ids'],_[_0xf6ab('0x57')](_0x1001a1['body'],[_0xf6ab('0x58'),'id'])||{});}})[_0xf6ab('0x28')](respondWithResult(_0x35d68c,null))['catch'](handleError(_0x35d68c,null));};exports[_0xf6ab('0x59')]=function(_0x55f95c,_0x440692,_0x2af1bc){var _0x1165fb={};var _0x560fb2={};var _0x29dd16;var _0x576870;return db[_0xf6ab('0x31')][_0xf6ab('0x5a')]({'where':{'id':_0x55f95c[_0xf6ab('0x48')]['id']}})['then'](handleEntityNotFound(_0x440692,null))[_0xf6ab('0x28')](function(_0x148cca){if(_0x148cca){_0x29dd16=_0x148cca;_0x560fb2['model']=_[_0xf6ab('0x33')](db[_0xf6ab('0x56')]['rawAttributes']);_0x560fb2['query']=_['keys'](_0x55f95c[_0xf6ab('0x34')]);_0x560fb2[_0xf6ab('0x35')]=_[_0xf6ab('0x36')](_0x560fb2[_0xf6ab('0x37')],_0x560fb2[_0xf6ab('0x34')]);_0x1165fb[_0xf6ab('0x38')]=_['intersection'](_0x560fb2[_0xf6ab('0x37')],qs['fields'](_0x55f95c[_0xf6ab('0x34')]['fields']));_0x1165fb[_0xf6ab('0x38')]=_0x1165fb[_0xf6ab('0x38')][_0xf6ab('0x39')]?_0x1165fb['attributes']:_0x560fb2['model'];_0x1165fb['order']=qs[_0xf6ab('0x3d')](_0x55f95c[_0xf6ab('0x34')][_0xf6ab('0x3d')]);_0x1165fb[_0xf6ab('0x3e')]=qs['filters'](_['pick'](_0x55f95c['query'],_0x560fb2[_0xf6ab('0x35')]));if(_0x55f95c[_0xf6ab('0x34')][_0xf6ab('0x3f')]){_0x1165fb[_0xf6ab('0x3e')]=_[_0xf6ab('0x40')](_0x1165fb['where'],{'$or':_[_0xf6ab('0x41')](_0x1165fb[_0xf6ab('0x38')],function(_0x36f68b){var _0x43f377={};_0x43f377[_0x36f68b]={'$like':'%'+_0x55f95c['query'][_0xf6ab('0x3f')]+'%'};return _0x43f377;})});}_0x1165fb=_['merge']({},_0x1165fb,_0x55f95c[_0xf6ab('0x42')]);return _0x29dd16[_0xf6ab('0x59')](_0x1165fb);}})[_0xf6ab('0x28')](function(_0x1c4fc7){if(_0x1c4fc7){_0x576870=_0x1c4fc7[_0xf6ab('0x39')];if(!_0x55f95c['query'][_0xf6ab('0x3a')](_0xf6ab('0x3b'))){_0x1165fb[_0xf6ab('0x21')]=qs[_0xf6ab('0x21')](_0x55f95c[_0xf6ab('0x34')][_0xf6ab('0x21')]);_0x1165fb[_0xf6ab('0x23')]=qs[_0xf6ab('0x23')](_0x55f95c[_0xf6ab('0x34')][_0xf6ab('0x23')]);}return _0x29dd16[_0xf6ab('0x59')](_0x1165fb);}})[_0xf6ab('0x28')](function(_0x48a197){if(_0x48a197){return _0x48a197?{'count':_0x576870,'rows':_0x48a197}:null;}})[_0xf6ab('0x28')](respondWithResult(_0x440692,null))['catch'](handleError(_0x440692,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 521a27d..731420d 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 _0x1229=['rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','api','moment','request-promise','path'];(function(_0x480fc2,_0x482fba){var _0x540a95=function(_0x4b5a56){while(--_0x4b5a56){_0x480fc2['push'](_0x480fc2['shift']());}};_0x540a95(++_0x482fba);}(_0x1229,0x66));var _0x9122=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x1229[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x9122('0x0'));var util=require(_0x9122('0x1'));var logger=require('../../config/logger')(_0x9122('0x2'));var moment=require(_0x9122('0x3'));var BPromise=require('bluebird');var rp=require(_0x9122('0x4'));var fs=require('fs');var path=require(_0x9122('0x5'));var rimraf=require(_0x9122('0x6'));var config=require(_0x9122('0x7'));var attributes=require(_0x9122('0x8'));module[_0x9122('0x9')]=function(_0x201253,_0x104196){return _0x201253['define'](_0x9122('0xa'),attributes,{'tableName':_0x9122('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x641e=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_companies','lodash'];(function(_0xaa66b4,_0x5bad46){var _0x1a7e0a=function(_0x134dc8){while(--_0x134dc8){_0xaa66b4['push'](_0xaa66b4['shift']());}};_0x1a7e0a(++_0x5bad46);}(_0x641e,0x78));var _0xe641=function(_0x13ce69,_0x4fea29){_0x13ce69=_0x13ce69-0x0;var _0x312d53=_0x641e[_0x13ce69];return _0x312d53;};'use strict';var _=require(_0xe641('0x0'));var util=require(_0xe641('0x1'));var logger=require(_0xe641('0x2'))('api');var moment=require(_0xe641('0x3'));var BPromise=require(_0xe641('0x4'));var rp=require(_0xe641('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe641('0x6'));var config=require(_0xe641('0x7'));var attributes=require('./cmCompany.attributes');module[_0xe641('0x8')]=function(_0x6b819c,_0x4c5d03){return _0x6b819c[_0xe641('0x9')]('CmCompany',attributes,{'tableName':_0xe641('0xa'),'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 c886385..8da7fa7 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 _0x8031=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x3ccb28,_0x510f67){var _0xa59442=function(_0x46718b){while(--_0x46718b){_0x3ccb28['push'](_0x3ccb28['shift']());}};_0xa59442(++_0x510f67);}(_0x8031,0xb5));var _0x1803=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x8031[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x1803('0x0'));var util=require(_0x1803('0x1'));var moment=require('moment');var BPromise=require(_0x1803('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1803('0x3'));var db=require(_0x1803('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1803('0x5'))(_0x1803('0x6'));var config=require('../../config/environment');var jayson=require(_0x1803('0x7'));var client=jayson[_0x1803('0x8')][_0x1803('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100b2d,_0x42a016,_0x1fc99a){return new BPromise(function(_0x3332b9,_0x21872f){return client[_0x1803('0xa')](_0x100b2d,_0x1fc99a)[_0x1803('0xb')](function(_0x318998){logger[_0x1803('0xc')](_0x1803('0xd'),_0x42a016,_0x1803('0xe'));logger[_0x1803('0xf')](_0x1803('0x10'),_0x42a016,_0x1803('0xe'),JSON[_0x1803('0x11')](_0x318998));if(_0x318998['error']){if(_0x318998[_0x1803('0x12')][_0x1803('0x13')]===0x1f4){logger['error'](_0x1803('0xd'),_0x42a016,_0x318998[_0x1803('0x12')][_0x1803('0x14')]);return _0x21872f(_0x318998[_0x1803('0x12')][_0x1803('0x14')]);}logger['error'](_0x1803('0xd'),_0x42a016,_0x318998[_0x1803('0x12')][_0x1803('0x14')]);return _0x3332b9(_0x318998[_0x1803('0x12')][_0x1803('0x14')]);}else{logger[_0x1803('0xc')]('CmCompany,\x20%s,\x20%s',_0x42a016,_0x1803('0xe'));_0x3332b9(_0x318998[_0x1803('0x15')]['message']);}})[_0x1803('0x16')](function(_0x8d4101){logger['error'](_0x1803('0xd'),_0x42a016,_0x8d4101);_0x21872f(_0x8d4101);});});} \ No newline at end of file +var _0xb902=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x2f81ef,_0x33953a){var _0x1ca14d=function(_0x35a783){while(--_0x35a783){_0x2f81ef['push'](_0x2f81ef['shift']());}};_0x1ca14d(++_0x33953a);}(_0xb902,0xcd));var _0x2b90=function(_0x232853,_0x33464a){_0x232853=_0x232853-0x0;var _0x3d5434=_0xb902[_0x232853];return _0x3d5434;};'use strict';var _=require(_0x2b90('0x0'));var util=require(_0x2b90('0x1'));var moment=require(_0x2b90('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b90('0x3'));var db=require(_0x2b90('0x4'))['db'];var utils=require(_0x2b90('0x5'));var logger=require(_0x2b90('0x6'))(_0x2b90('0x7'));var config=require(_0x2b90('0x8'));var jayson=require(_0x2b90('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9123,_0x1131f9,_0x507e7a){return new BPromise(function(_0x2deea8,_0x2406c7){return client[_0x2b90('0xa')](_0x1d9123,_0x507e7a)[_0x2b90('0xb')](function(_0x33ed32){logger[_0x2b90('0xc')](_0x2b90('0xd'),_0x1131f9,_0x2b90('0xe'));logger[_0x2b90('0xf')](_0x2b90('0x10'),_0x1131f9,_0x2b90('0xe'),JSON[_0x2b90('0x11')](_0x33ed32));if(_0x33ed32[_0x2b90('0x12')]){if(_0x33ed32[_0x2b90('0x12')][_0x2b90('0x13')]===0x1f4){logger[_0x2b90('0x12')]('CmCompany,\x20%s,\x20%s',_0x1131f9,_0x33ed32['error'][_0x2b90('0x14')]);return _0x2406c7(_0x33ed32[_0x2b90('0x12')][_0x2b90('0x14')]);}logger[_0x2b90('0x12')](_0x2b90('0xd'),_0x1131f9,_0x33ed32[_0x2b90('0x12')][_0x2b90('0x14')]);return _0x2deea8(_0x33ed32['error'][_0x2b90('0x14')]);}else{logger[_0x2b90('0xc')]('CmCompany,\x20%s,\x20%s',_0x1131f9,_0x2b90('0xe'));_0x2deea8(_0x33ed32[_0x2b90('0x15')][_0x2b90('0x14')]);}})['catch'](function(_0x20425a){logger[_0x2b90('0x12')](_0x2b90('0xd'),_0x1131f9,_0x20425a);_0x2406c7(_0x20425a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1b7fe4d..9ee0319 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 _0x2278=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller'];(function(_0x5012b4,_0x2d25d0){var _0x2f2c9f=function(_0x2d8e30){while(--_0x2d8e30){_0x5012b4['push'](_0x5012b4['shift']());}};_0x2f2c9f(++_0x2d25d0);}(_0x2278,0x17e));var _0x8227=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2278[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8227('0x0'));var util=require(_0x8227('0x1'));var path=require(_0x8227('0x2'));var timeout=require('connect-timeout');var express=require(_0x8227('0x3'));var router=express[_0x8227('0x4')]();var fs_extra=require(_0x8227('0x5'));var auth=require(_0x8227('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8227('0x7'));var controller=require(_0x8227('0x8'));router[_0x8227('0x9')]('/',auth[_0x8227('0xa')](),controller[_0x8227('0xb')]);router[_0x8227('0x9')](_0x8227('0xc'),auth[_0x8227('0xa')](),controller[_0x8227('0xd')]);router[_0x8227('0x9')](_0x8227('0xe'),auth[_0x8227('0xa')](),controller[_0x8227('0xf')]);router['get'](_0x8227('0x10'),auth['isAuthenticated'](),controller[_0x8227('0x11')]);router[_0x8227('0x12')]('/',auth[_0x8227('0xa')](),controller[_0x8227('0x13')]);router['post']('/:id/contacts',auth[_0x8227('0xa')](),controller['addContacts']);router[_0x8227('0x14')]('/:id',auth[_0x8227('0xa')](),controller['update']);router[_0x8227('0x15')](_0x8227('0xe'),auth[_0x8227('0xa')](),controller['destroy']);module[_0x8227('0x16')]=router; \ No newline at end of file +var _0x3a20=['addContacts','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/contacts','post'];(function(_0x19b805,_0x22c6f0){var _0x16b28e=function(_0x1fd3ed){while(--_0x1fd3ed){_0x19b805['push'](_0x19b805['shift']());}};_0x16b28e(++_0x22c6f0);}(_0x3a20,0x1a9));var _0x03a2=function(_0x56a20e,_0x231ac3){_0x56a20e=_0x56a20e-0x0;var _0x254a55=_0x3a20[_0x56a20e];return _0x254a55;};'use strict';var multer=require(_0x03a2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x03a2('0x1'));var express=require(_0x03a2('0x2'));var router=express[_0x03a2('0x3')]();var fs_extra=require(_0x03a2('0x4'));var auth=require(_0x03a2('0x5'));var interaction=require(_0x03a2('0x6'));var config=require(_0x03a2('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x03a2('0x8')](_0x03a2('0x9'),auth['isAuthenticated'](),controller[_0x03a2('0xa')]);router[_0x03a2('0x8')](_0x03a2('0xb'),auth[_0x03a2('0xc')](),controller[_0x03a2('0xd')]);router[_0x03a2('0x8')](_0x03a2('0xe'),auth[_0x03a2('0xc')](),controller['getContacts']);router[_0x03a2('0xf')]('/',auth[_0x03a2('0xc')](),controller['create']);router[_0x03a2('0xf')](_0x03a2('0xe'),auth['isAuthenticated'](),controller[_0x03a2('0x10')]);router[_0x03a2('0x11')]('/:id',auth[_0x03a2('0xc')](),controller['update']);router[_0x03a2('0x12')]('/:id',auth[_0x03a2('0xc')](),controller[_0x03a2('0x13')]);module[_0x03a2('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 1d72e1b..50d1c32 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 _0x54d2=['STRING','TEXT','UNSIGNED','NOW','lodash','sequelize','exports'];(function(_0x50428b,_0x49b399){var _0x3a2705=function(_0x5a2ef6){while(--_0x5a2ef6){_0x50428b['push'](_0x50428b['shift']());}};_0x3a2705(++_0x49b399);}(_0x54d2,0x1d9));var _0x254d=function(_0x5006f0,_0x64541e){_0x5006f0=_0x5006f0-0x0;var _0x528f6e=_0x54d2[_0x5006f0];return _0x528f6e;};'use strict';var _=require(_0x254d('0x0'));var Sequelize=require(_0x254d('0x1'));module[_0x254d('0x2')]={'firstName':{'type':Sequelize[_0x254d('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x254d('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x254d('0x3')]},'city':{'type':Sequelize[_0x254d('0x3')]},'country':{'type':Sequelize[_0x254d('0x3')]},'dateOfBirth':{'type':Sequelize[_0x254d('0x3')]},'description':{'type':Sequelize[_0x254d('0x4')]},'phone':{'type':Sequelize[_0x254d('0x3')]},'mobile':{'type':Sequelize[_0x254d('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x254d('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x254d('0x3')]},'fb_data':{'type':Sequelize[_0x254d('0x3')]},'twitter':{'type':Sequelize[_0x254d('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x254d('0x3')]},'line':{'type':Sequelize[_0x254d('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x254d('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x254d('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x254d('0x6')]}}; \ No newline at end of file +var _0x5c95=['STRING','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x570091,_0x37a273){var _0x5638d6=function(_0x280662){while(--_0x280662){_0x570091['push'](_0x570091['shift']());}};_0x5638d6(++_0x37a273);}(_0x5c95,0x1a8));var _0x55c9=function(_0x3214d1,_0x3c61ad){_0x3214d1=_0x3214d1-0x0;var _0x520948=_0x5c95[_0x3214d1];return _0x520948;};'use strict';var _=require(_0x55c9('0x0'));var Sequelize=require(_0x55c9('0x1'));module[_0x55c9('0x2')]={'firstName':{'type':Sequelize[_0x55c9('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x55c9('0x3')]},'street':{'type':Sequelize[_0x55c9('0x3')]},'postalCode':{'type':Sequelize[_0x55c9('0x3')]},'city':{'type':Sequelize[_0x55c9('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x55c9('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x55c9('0x3')]},'mobile':{'type':Sequelize[_0x55c9('0x3')]},'fax':{'type':Sequelize[_0x55c9('0x3')]},'email':{'type':Sequelize[_0x55c9('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x55c9('0x3')]},'fb_data':{'type':Sequelize[_0x55c9('0x3')]},'twitter':{'type':Sequelize[_0x55c9('0x3')]},'skype':{'type':Sequelize[_0x55c9('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x55c9('0x3')]},'line':{'type':Sequelize[_0x55c9('0x3')]},'wechat':{'type':Sequelize[_0x55c9('0x3')]},'telegram':{'type':Sequelize[_0x55c9('0x3')]},'UserId':{'type':Sequelize[_0x55c9('0x4')]},'priority':{'type':Sequelize[_0x55c9('0x4')](0x2)[_0x55c9('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x55c9('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index feeab67..a53b45b 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 _0xdacf=['bulkCreate','each','duplicates','$or','findOrCreate','spread','show','params','ListId','$and','omit','format','cf_%d','table','setFields','id\x20=\x20?','toParam','values','findOne','options','getTags','setTags','getHoppers','CmHopper','rawAttributes','includeAll','include','getHopperHistories','ContactId','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','upload','createReadStream','meta','phone','binding','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','includes','channel','Invalid\x20channel','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','source','destination','callerid','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','fullname','range','findAndCountAll','startCase','Website','Account','closedAt','secondDisposition','thirdDisposition','UserId','Owner','browserName','customerPort','deviceModel','osName','ratingType','ratingValue','subject','substatus','Interaction','all','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','localhost','./cmContact.socket','register','status','json','undefined','limit','count','set','Content-Range','then','end','sendStatus','stack','name','send','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','trimStart','length','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','field','color','from','tools_tags','select','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','datetime','castTo','text','start','filter','isNil','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','QueryTypes','SELECT','clone','DESC','isEmpty','having','t.id\x20IN\x20?','user','agent','some','conditions','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','destroy','find','catch','tags','displayName','analytics','columnName','alias','custom','body','findAll','get','mergeWith','isArray','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','join'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0xdacf,0x72));var _0xfdac=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdacf[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0xfdac('0x0'));var BPromise=require(_0xfdac('0x1'));var util=require(_0xfdac('0x2'));var path=require(_0xfdac('0x3'));var fs=require('fs');var _=require(_0xfdac('0x4'));var squel=require(_0xfdac('0x5'));var Papa=require(_0xfdac('0x6'));var Redis=require(_0xfdac('0x7'));var qs=require(_0xfdac('0x8'));var as=require(_0xfdac('0x9'));var logger=require('../../config/logger')(_0xfdac('0xa'));var config=require(_0xfdac('0xb'));var db=require(_0xfdac('0xc'))['db'];config[_0xfdac('0xd')]=_['defaults'](config['redis'],{'host':_0xfdac('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdac('0xd')]));require(_0xfdac('0xf'))[_0xfdac('0x10')](socket);function respondWithResult(_0x1cd73b,_0x4919f7){_0x4919f7=_0x4919f7||0xc8;return function(_0x252427){if(_0x252427){return _0x1cd73b[_0xfdac('0x11')](_0x4919f7)[_0xfdac('0x12')](_0x252427);}};}function respondWithFilteredResult(_0x398433,_0x28487b){return function(_0x1481be){if(_0x1481be){var _0x2f57c3=typeof _0x28487b['offset']===_0xfdac('0x13')&&typeof _0x28487b[_0xfdac('0x14')]===_0xfdac('0x13');var _0x9eb257=_0x1481be[_0xfdac('0x15')];var _0x2ed8e3=_0x2f57c3?0x0:_0x28487b['offset'];var _0x325e56=_0x2f57c3?_0x1481be['count']:_0x28487b['offset']+_0x28487b[_0xfdac('0x14')];var _0x54452e;if(_0x325e56>=_0x9eb257){_0x325e56=_0x9eb257;_0x54452e=0xc8;}else{_0x54452e=0xce;}_0x398433[_0xfdac('0x11')](_0x54452e);return _0x398433[_0xfdac('0x16')](_0xfdac('0x17'),_0x2ed8e3+'-'+_0x325e56+'/'+_0x9eb257)[_0xfdac('0x12')](_0x1481be);}return null;};}function saveUpdates(_0x38d225){return function(_0x2b78aa){if(_0x2b78aa){return _0x2b78aa['update'](_0x38d225)[_0xfdac('0x18')](function(_0x94ba14){return _0x94ba14;});}return null;};}function removeEntity(_0x20f52d){return function(_0x3aaefe){if(_0x3aaefe){return _0x3aaefe['destroy']()[_0xfdac('0x18')](function(){_0x20f52d['status'](0xcc)[_0xfdac('0x19')]();});}};}function handleEntityNotFound(_0xbbbd70){return function(_0x3e62e5){if(!_0x3e62e5){_0xbbbd70[_0xfdac('0x1a')](0x194);}return _0x3e62e5;};}function handleError(_0x59c2ba,_0x17e30d){_0x17e30d=_0x17e30d||0x1f4;return function(_0x3bf9f5){logger['error'](_0x3bf9f5[_0xfdac('0x1b')]);if(_0x3bf9f5[_0xfdac('0x1c')]){delete _0x3bf9f5['name'];}_0x59c2ba[_0xfdac('0x11')](_0x17e30d)[_0xfdac('0x1d')](_0x3bf9f5);};}exports['index']=function(_0x402c86,_0xbcc9c0){var _0x3b26d5={},_0x328c38={},_0x36c3e5={'count':0x0,'rows':[]};return db[_0xfdac('0x1e')][_0xfdac('0x1f')]()[_0xfdac('0x18')](function(_0x226331){var _0x252cf4=[];for(var _0x4aa954=0x0;_0x4aa9540x1){_0x402fd1['or'](_0xfdac('0x5b'),qs['getFullTextValue'](_0x2983c3),null);}else{if(qs[_0xfdac('0x5c')](_0x2983c3)){_0x402fd1['or'](_0xfdac('0x5d'),_0x2983c3+'%');_0x402fd1['or'](_0xfdac('0x5e'),_0x2983c3+'%');_0x402fd1['or']('c.mobile\x20LIKE\x20?',_0x2983c3+'%');_0x402fd1['or'](_0xfdac('0x5f'),_0x2983c3+'%');}else if(qs[_0xfdac('0x60')](_0x2983c3)){_0x402fd1['or'](_0xfdac('0x61'),_0x2983c3+'%');}else{_0x402fd1['or'](_0xfdac('0x62'),'%'+_0x2983c3+'%');_0x402fd1['or'](_0xfdac('0x63'),'%'+_0x2983c3+'%');_0x402fd1['or'](_0xfdac('0x61'),'%'+_0x2983c3+'%');}}}}_0x477923[_0xfdac('0x34')](_0x402fd1);_0x477923[_0xfdac('0x64')]('c.id');var _0x140ae4={'type':db['Sequelize'][_0xfdac('0x65')][_0xfdac('0x66')],'raw':!![]};var _0x29e3f2=_0x477923[_0xfdac('0x67')]()[_0xfdac('0x36')]('c.id');if(_0x3b26d5[_0xfdac('0x32')]){_0x3b26d5[_0xfdac('0x32')]['forEach'](function(_0x5b76f9){_0x477923[_0xfdac('0x32')]('c.'+_0x5b76f9[0x0],_0x5b76f9[0x1]===_0xfdac('0x68')?![]:!![]);});}if(!_[_0xfdac('0x69')](_0x494bea)){_0x477923[_0xfdac('0x6a')](_0xf3a8d8);_0x29e3f2[_0xfdac('0x34')](_0xfdac('0x6b'),_0x494bea);}BPromise['resolve']()[_0xfdac('0x18')](function(){if(!_0x1c7015)return;if(_0x402c86[_0xfdac('0x6c')]['role']!==_0xfdac('0x6d'))return;if(!_[_0xfdac('0x6e')](_0x1c7015[_0xfdac('0x6f')],[_0xfdac('0x36'),_0xfdac('0x4c')])){return _0x402c86[_0xfdac('0x6c')][_0xfdac('0x70')]({'attributes':['id'],'raw':!![]})[_0xfdac('0x18')](function(_0x2ba06a){if(_[_0xfdac('0x69')](_0x2ba06a)){_0x29e3f2[_0xfdac('0x34')]('c.ListId\x20IS\x20NULL');_0x477923[_0xfdac('0x34')](_0xfdac('0x71'));}else{_0x29e3f2[_0xfdac('0x34')](_0xfdac('0x56'),_['map'](_0x2ba06a,'id'));_0x477923[_0xfdac('0x34')](_0xfdac('0x56'),_[_0xfdac('0x48')](_0x2ba06a,'id'));}});}})[_0xfdac('0x18')](function(){if(_0x402c86['user'][_0xfdac('0x72')]===_0xfdac('0x6d')&&!_0x1c7015&&!_0x402c86[_0xfdac('0x2a')]['ListId'])return[];return db[_0xfdac('0x73')][_0xfdac('0x2a')](_0x29e3f2[_0xfdac('0x74')](),_0x140ae4);})[_0xfdac('0x18')](function(_0x545617){_0x36c3e5['count']=_0x545617[_0xfdac('0x26')];if(_0x36c3e5[_0xfdac('0x15')]===0x0)return[];return db['sequelize']['query'](_0x1217ef['toString'](),_0x140ae4)[_0xfdac('0x18')](function(_0x2bead7){_0x228f58=_[_0xfdac('0x75')](_0x2bead7,'id');_0x140ae4=_[_0xfdac('0x76')](_0x140ae4,{'model':db[_0xfdac('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x402c86['query'][_0xfdac('0x2e')]){_0x3b26d5[_0xfdac('0x2d')]['forEach'](function(_0x35e340){_0x477923[_0xfdac('0x36')]('c.'+_0x35e340);});}else{_0x477923[_0xfdac('0x36')]('c.id');_0x477923[_0xfdac('0x36')](_0xfdac('0x77'));_0x477923[_0xfdac('0x36')](_0xfdac('0x78'));_0x477923[_0xfdac('0x36')](_0xfdac('0x79'));_0x477923[_0xfdac('0x36')](_0xfdac('0x7a'));_0x477923[_0xfdac('0x36')]('c.fax');_0x477923['field'](_0xfdac('0x7b'));_0x477923[_0xfdac('0x36')](_0xfdac('0x7c'));_0x477923[_0xfdac('0x36')](_0xfdac('0x7d'));_0x477923['field']('c.deletedAt');_0x477923[_0xfdac('0x36')](_0xfdac('0x7e'));_0x477923[_0xfdac('0x36')](_0xfdac('0x7f'),_0xfdac('0x80'));}if(_0x3b26d5[_0xfdac('0x14')])_0x477923[_0xfdac('0x14')](_0x3b26d5['limit']);if(_0x3b26d5[_0xfdac('0x31')])_0x477923['offset'](_0x3b26d5[_0xfdac('0x31')]);return db[_0xfdac('0x73')][_0xfdac('0x2a')](_0x477923[_0xfdac('0x74')](),_0x140ae4);});})[_0xfdac('0x18')](function(_0x7c5eb8){_0x7c5eb8[_0xfdac('0x49')](function(_0x3dbc9c){if(_0x3dbc9c[_0xfdac('0x80')]){_0x3dbc9c[_0xfdac('0x81')]=[];_0x3dbc9c[_0xfdac('0x80')][_0xfdac('0x47')](',')['forEach'](function(_0x585f23){_0x3dbc9c['Tags'][_0xfdac('0x23')](_0x228f58[_0x585f23]);});}delete _0x3dbc9c[_0xfdac('0x80')];});_0x36c3e5[_0xfdac('0x82')]=_0x7c5eb8;return _0x36c3e5;})[_0xfdac('0x18')](respondWithFilteredResult(_0xbcc9c0,_0x3b26d5));})['catch'](handleError(_0xbcc9c0,null));};exports[_0xfdac('0x83')]=function(_0x17b990,_0x48adb6){return db['CmContact'][_0xfdac('0x84')]({'where':{'id':_0x17b990['params']['id']}})[_0xfdac('0x18')](handleEntityNotFound(_0x48adb6,null))[_0xfdac('0x18')](removeEntity(_0x48adb6,null))[_0xfdac('0x85')](handleError(_0x48adb6,null));};exports[_0xfdac('0x1f')]=function(_0xa69641,_0x375650){return db[_0xfdac('0x1e')]['describe']()[_0xfdac('0x18')](function(_0x2ee2e5){delete _0x2ee2e5[_0xfdac('0x86')];for(var _0xa08927=0x0;_0xa08927=_0x29d9c0){_0x316770=_0x29d9c0;_0x1b1ed3=0xc8;}else{_0x1b1ed3=0xce;}_0x535258[_0xfd81('0x11')](_0x1b1ed3);return _0x535258[_0xfd81('0x16')](_0xfd81('0x17'),_0x4abc75+'-'+_0x316770+'/'+_0x29d9c0)[_0xfd81('0x12')](_0x463dee);}return null;};}function saveUpdates(_0x587dfe){return function(_0x572af4){if(_0x572af4){return _0x572af4[_0xfd81('0x18')](_0x587dfe)['then'](function(_0x23d264){return _0x23d264;});}return null;};}function removeEntity(_0x214283){return function(_0x1e6902){if(_0x1e6902){return _0x1e6902[_0xfd81('0x19')]()['then'](function(){_0x214283['status'](0xcc)[_0xfd81('0x1a')]();});}};}function handleEntityNotFound(_0xd22cd4){return function(_0x3ee099){if(!_0x3ee099){_0xd22cd4['sendStatus'](0x194);}return _0x3ee099;};}function handleError(_0x4fa85d,_0x3cf000){_0x3cf000=_0x3cf000||0x1f4;return function(_0x19d54e){logger['error'](_0x19d54e[_0xfd81('0x1b')]);if(_0x19d54e['name']){delete _0x19d54e[_0xfd81('0x1c')];}_0x4fa85d[_0xfd81('0x11')](_0x3cf000)[_0xfd81('0x1d')](_0x19d54e);};}exports[_0xfd81('0x1e')]=function(_0x53795e,_0xb0b8b6){var _0x1dc5b7={},_0x8b81ab={},_0x23148f={'count':0x0,'rows':[]};return db['CmContact'][_0xfd81('0x1f')]()['then'](function(_0x205b1b){var _0x1cc324=[];for(var _0x301998=0x0;_0x3019980x1){_0x3d6aba['or'](_0xfd81('0x61'),qs[_0xfd81('0x62')](_0x5241b7),null);}else{if(qs['isNumeric'](_0x5241b7)){_0x3d6aba['or'](_0xfd81('0x63'),_0x5241b7+'%');_0x3d6aba['or'](_0xfd81('0x64'),_0x5241b7+'%');_0x3d6aba['or']('c.mobile\x20LIKE\x20?',_0x5241b7+'%');_0x3d6aba['or'](_0xfd81('0x65'),_0x5241b7+'%');}else if(qs[_0xfd81('0x66')](_0x5241b7)){_0x3d6aba['or']('c.email\x20LIKE\x20?',_0x5241b7+'%');}else{_0x3d6aba['or'](_0xfd81('0x67'),'%'+_0x5241b7+'%');_0x3d6aba['or'](_0xfd81('0x68'),'%'+_0x5241b7+'%');_0x3d6aba['or']('c.email\x20LIKE\x20?','%'+_0x5241b7+'%');}}}}_0x30f564[_0xfd81('0x34')](_0x3d6aba);_0x30f564[_0xfd81('0x69')](_0xfd81('0x6a'));var _0x252531={'type':db['Sequelize']['QueryTypes'][_0xfd81('0x6b')],'raw':!![]};var _0x57ab29=_0x30f564[_0xfd81('0x6c')]()['field']('c.id');if(_0x1dc5b7[_0xfd81('0x32')]){_0x1dc5b7[_0xfd81('0x32')][_0xfd81('0x4b')](function(_0x24c9b8){_0x30f564['order']('c.'+_0x24c9b8[0x0],_0x24c9b8[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfd81('0x59')](_0x19435b)){_0x30f564['having'](_0xc3858c);_0x57ab29[_0xfd81('0x34')](_0xfd81('0x6d'),_0x19435b);}BPromise['resolve']()[_0xfd81('0x28')](function(){if(!_0x36ab74)return;if(_0x53795e[_0xfd81('0x6e')][_0xfd81('0x6f')]!==_0xfd81('0x70'))return;if(!_['some'](_0x36ab74[_0xfd81('0x46')],['field',_0xfd81('0x71')])){return _0x53795e[_0xfd81('0x6e')]['getLists']({'attributes':['id'],'raw':!![]})[_0xfd81('0x28')](function(_0x31a3f1){if(_[_0xfd81('0x59')](_0x31a3f1)){_0x57ab29[_0xfd81('0x34')]('c.ListId\x20IS\x20NULL');_0x30f564[_0xfd81('0x34')]('c.ListId\x20IS\x20NULL');}else{_0x57ab29[_0xfd81('0x34')](_0xfd81('0x72'),_[_0xfd81('0x4a')](_0x31a3f1,'id'));_0x30f564[_0xfd81('0x34')]('c.ListId\x20IN\x20?',_[_0xfd81('0x4a')](_0x31a3f1,'id'));}});}})[_0xfd81('0x28')](function(){if(_0x53795e[_0xfd81('0x6e')][_0xfd81('0x6f')]===_0xfd81('0x70')&&!_0x36ab74&&!_0x53795e[_0xfd81('0x2c')][_0xfd81('0x5a')])return[];return db[_0xfd81('0x73')][_0xfd81('0x2c')](_0x57ab29[_0xfd81('0x74')](),_0x252531);})[_0xfd81('0x28')](function(_0x2fa2e7){_0x23148f[_0xfd81('0x15')]=_0x2fa2e7[_0xfd81('0x21')];if(_0x23148f[_0xfd81('0x15')]===0x0)return[];return db[_0xfd81('0x73')][_0xfd81('0x2c')](_0x2d12d8[_0xfd81('0x74')](),_0x252531)[_0xfd81('0x28')](function(_0x384c2a){_0x22d664=_['keyBy'](_0x384c2a,'id');_0x252531=_['merge'](_0x252531,{'model':db[_0xfd81('0x75')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53795e[_0xfd81('0x2c')]['fields']){_0x1dc5b7['attributes'][_0xfd81('0x4b')](function(_0x3144e1){_0x30f564[_0xfd81('0x38')]('c.'+_0x3144e1);});}else{_0x30f564[_0xfd81('0x38')]('c.id');_0x30f564[_0xfd81('0x38')]('c.firstName');_0x30f564['field']('c.lastName');_0x30f564['field'](_0xfd81('0x76'));_0x30f564[_0xfd81('0x38')]('c.mobile');_0x30f564[_0xfd81('0x38')]('c.fax');_0x30f564['field'](_0xfd81('0x77'));_0x30f564[_0xfd81('0x38')]('c.ListId');_0x30f564[_0xfd81('0x38')](_0xfd81('0x78'));_0x30f564['field'](_0xfd81('0x79'));_0x30f564['field'](_0xfd81('0x7a'));_0x30f564[_0xfd81('0x38')](_0xfd81('0x7b'),_0xfd81('0x7c'));}if(_0x1dc5b7[_0xfd81('0x31')])_0x30f564['limit'](_0x1dc5b7[_0xfd81('0x31')]);if(_0x1dc5b7[_0xfd81('0x13')])_0x30f564[_0xfd81('0x13')](_0x1dc5b7[_0xfd81('0x13')]);return db[_0xfd81('0x73')][_0xfd81('0x2c')](_0x30f564[_0xfd81('0x74')](),_0x252531);});})[_0xfd81('0x28')](function(_0x148722){_0x148722['forEach'](function(_0x29d1d5){if(_0x29d1d5[_0xfd81('0x7c')]){_0x29d1d5[_0xfd81('0x7d')]=[];_0x29d1d5[_0xfd81('0x7c')][_0xfd81('0x49')](',')[_0xfd81('0x4b')](function(_0x201e95){_0x29d1d5[_0xfd81('0x7d')][_0xfd81('0x24')](_0x22d664[_0x201e95]);});}delete _0x29d1d5['TagIds'];});_0x23148f[_0xfd81('0x7e')]=_0x148722;return _0x23148f;})[_0xfd81('0x28')](respondWithFilteredResult(_0xb0b8b6,_0x1dc5b7));})['catch'](handleError(_0xb0b8b6,null));};exports[_0xfd81('0x19')]=function(_0x1aa17c,_0x59a506){return db['CmContact'][_0xfd81('0x47')]({'where':{'id':_0x1aa17c[_0xfd81('0x7f')]['id']}})[_0xfd81('0x28')](handleEntityNotFound(_0x59a506,null))['then'](removeEntity(_0x59a506,null))[_0xfd81('0x80')](handleError(_0x59a506,null));};exports[_0xfd81('0x1f')]=function(_0x4db276,_0x11d326){return db[_0xfd81('0x75')][_0xfd81('0x1f')]()[_0xfd81('0x28')](function(_0x4d8e03){delete _0x4d8e03[_0xfd81('0x81')];for(var _0x57844b=0x0;_0x57844b{}\s\\|]/g,'-');_0x412c58(null,util[_0xf395('0x22')](_0xf395('0x23'),path['basename'](_0x11c76e['originalname'],path['extname'](_0x11c76e[_0xf395('0x20')])),Date[_0xf395('0x24')](),path[_0xf395('0x25')](_0x11c76e[_0xf395('0x20')])));}})});router[_0xf395('0x16')](_0xf395('0x26'),upload[_0xf395('0x27')]('file'),controller[_0xf395('0x28')]);var upload=multer({'storage':multer[_0xf395('0x1d')]({'destination':function(_0x48200a,_0x5ab14d,_0x3cab9f){_0x3cab9f(null,path['join'](config[_0xf395('0x29')],_0xf395('0x1f')));},'filename':function(_0x1edf19,_0x21f88f,_0x547f0c){_0x21f88f[_0xf395('0x20')]=_0x21f88f[_0xf395('0x20')][_0xf395('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x547f0c(null,util[_0xf395('0x22')](_0xf395('0x23'),path[_0xf395('0x2a')](_0x21f88f[_0xf395('0x20')],path[_0xf395('0x25')](_0x21f88f[_0xf395('0x20')])),Date[_0xf395('0x24')](),path[_0xf395('0x25')](_0x21f88f[_0xf395('0x20')])));}})});router[_0xf395('0x16')](_0xf395('0x2b'),upload[_0xf395('0x27')](_0xf395('0x2c')),controller['upload']);router['post'](_0xf395('0x2d'),auth['isAuthenticated'](),controller[_0xf395('0x2e')]);router[_0xf395('0x2f')](_0xf395('0xd'),auth[_0xf395('0x8')](),controller[_0xf395('0x30')]);router[_0xf395('0x31')](_0xf395('0xd'),auth[_0xf395('0x8')](),controller[_0xf395('0x32')]);module[_0xf395('0x33')]=router; \ No newline at end of file +var _0x69a2=['/upload/:id','import','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','isAuthenticated','describe','/:id','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','/upload','upload'];(function(_0x356ec6,_0x10d890){var _0x239c8f=function(_0x156f9e){while(--_0x156f9e){_0x356ec6['push'](_0x356ec6['shift']());}};_0x239c8f(++_0x10d890);}(_0x69a2,0x106));var _0x269a=function(_0x1d48e1,_0x12f17b){_0x1d48e1=_0x1d48e1-0x0;var _0x5c396d=_0x69a2[_0x1d48e1];return _0x5c396d;};'use strict';var multer=require(_0x269a('0x0'));var util=require('util');var path=require(_0x269a('0x1'));var timeout=require('connect-timeout');var express=require(_0x269a('0x2'));var router=express[_0x269a('0x3')]();var fs_extra=require(_0x269a('0x4'));var auth=require(_0x269a('0x5'));var interaction=require(_0x269a('0x6'));var config=require(_0x269a('0x7'));var controller=require(_0x269a('0x8'));router[_0x269a('0x9')]('/',auth['isAuthenticated'](),controller[_0x269a('0xa')]);router[_0x269a('0x9')]('/describe',auth[_0x269a('0xb')](),controller[_0x269a('0xc')]);router[_0x269a('0x9')](_0x269a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x269a('0x9')](_0x269a('0xe'),auth['isAuthenticated'](),controller[_0x269a('0xf')]);router[_0x269a('0x9')](_0x269a('0x10'),auth[_0x269a('0xb')](),controller[_0x269a('0x11')]);router[_0x269a('0x9')](_0x269a('0x12'),auth[_0x269a('0xb')](),controller[_0x269a('0x13')]);router['get']('/:id/hopper_finals',auth[_0x269a('0xb')](),controller[_0x269a('0x14')]);router[_0x269a('0x9')]('/:id/jscripty_sessions',auth[_0x269a('0xb')](),controller[_0x269a('0x15')]);router['get'](_0x269a('0x16'),auth[_0x269a('0xb')](),controller[_0x269a('0x17')]);router[_0x269a('0x18')](_0x269a('0x19'),auth[_0x269a('0xb')](),controller['merge']);router[_0x269a('0x18')]('/',auth[_0x269a('0xb')](),controller['create']);router[_0x269a('0x18')]('/create_many',auth[_0x269a('0xb')](),controller['bulkCreate']);router[_0x269a('0x18')](_0x269a('0xe'),auth[_0x269a('0xb')](),controller[_0x269a('0x1a')]);var upload=multer({'storage':multer[_0x269a('0x1b')]({'destination':function(_0x39fa3e,_0x5a91df,_0x4fd01b){_0x4fd01b(null,path[_0x269a('0x1c')](config[_0x269a('0x1d')],_0x269a('0x1e')));},'filename':function(_0x5b6b48,_0x15923b,_0x6ddf65){_0x15923b[_0x269a('0x1f')]=_0x15923b[_0x269a('0x1f')][_0x269a('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6ddf65(null,util[_0x269a('0x21')]('%s-%s%s',path[_0x269a('0x22')](_0x15923b[_0x269a('0x1f')],path[_0x269a('0x23')](_0x15923b[_0x269a('0x1f')])),Date[_0x269a('0x24')](),path[_0x269a('0x23')](_0x15923b[_0x269a('0x1f')])));}})});router['post'](_0x269a('0x25'),upload[_0x269a('0x26')](_0x269a('0x27')),controller[_0x269a('0x28')]);var upload=multer({'storage':multer[_0x269a('0x1b')]({'destination':function(_0x2c6f20,_0x119304,_0x151e2c){_0x151e2c(null,path[_0x269a('0x1c')](config[_0x269a('0x1d')],_0x269a('0x1e')));},'filename':function(_0x45a550,_0x3617c8,_0x17e8b5){_0x3617c8[_0x269a('0x1f')]=_0x3617c8[_0x269a('0x1f')][_0x269a('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17e8b5(null,util[_0x269a('0x21')](_0x269a('0x29'),path[_0x269a('0x22')](_0x3617c8[_0x269a('0x1f')],path[_0x269a('0x23')](_0x3617c8[_0x269a('0x1f')])),Date[_0x269a('0x24')](),path[_0x269a('0x23')](_0x3617c8['originalname'])));}})});router[_0x269a('0x18')](_0x269a('0x2a'),upload[_0x269a('0x26')](_0x269a('0x27')),controller[_0x269a('0x2b')]);router[_0x269a('0x18')](_0x269a('0x2c'),auth['isAuthenticated'](),controller[_0x269a('0x2d')]);router[_0x269a('0x2e')](_0x269a('0xd'),auth[_0x269a('0xb')](),controller[_0x269a('0x2f')]);router[_0x269a('0x30')](_0x269a('0xd'),auth[_0x269a('0xb')](),controller[_0x269a('0x31')]);module[_0x269a('0x32')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index bd79d97..ee514a2 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 _0xea45=['ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','STRING','TEXT','long','parse','values','isArray','BOOLEAN'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xea45,0x1b5));var _0x5ea4=function(_0x3b46d6,_0x1438c7){_0x3b46d6=_0x3b46d6-0x0;var _0x141de1=_0xea45[_0x3b46d6];return _0x141de1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x5ea4('0x0'));module[_0x5ea4('0x1')]={'name':{'type':Sequelize[_0x5ea4('0x2')],'get':function(_0x19fb27){return this[_0x5ea4('0x3')](_0x5ea4('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xdd6c32){this[_0x5ea4('0x5')](_0x5ea4('0x4'),_0xdd6c32?_0xdd6c32:this[_0x5ea4('0x3')]('name'));}},'type':{'type':Sequelize[_0x5ea4('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x5ea4('0x7')](_0x5ea4('0x8')),'get':function(){if(this[_0x5ea4('0x3')]('type')==='select'){return JSON[_0x5ea4('0x9')](this['getDataValue'](_0x5ea4('0xa')));}else{return this[_0x5ea4('0x3')](_0x5ea4('0xa'));}},'set':function(_0x25e382){if(Array[_0x5ea4('0xb')](_0x25e382)){this[_0x5ea4('0x5')]('values',JSON['stringify'](_0x25e382));}else{this[_0x5ea4('0x5')](_0x5ea4('0xa'),_0x25e382);}}},'required':{'type':Sequelize[_0x5ea4('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5ea4('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5ea4('0xd')](_0x5ea4('0xe'))}}; \ No newline at end of file +var _0x01cc=['isArray','values','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','TEXT','long','getDataValue','type','select','parse'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x01cc,0x19c));var _0xc01c=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x01cc[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0xc01c('0x0'));var _=require(_0xc01c('0x1'));module[_0xc01c('0x2')]={'name':{'type':Sequelize[_0xc01c('0x3')],'get':function(_0x162f0e){return this['getDataValue'](_0xc01c('0x4'));}},'alias':{'type':Sequelize[_0xc01c('0x5')],'allowNull':![],'set':function(_0x10f11d){this[_0xc01c('0x6')](_0xc01c('0x4'),_0x10f11d?_0x10f11d:this['getDataValue']('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xc01c('0x7')](_0xc01c('0x8')),'get':function(){if(this[_0xc01c('0x9')](_0xc01c('0xa'))===_0xc01c('0xb')){return JSON[_0xc01c('0xc')](this[_0xc01c('0x9')]('values'));}else{return this[_0xc01c('0x9')]('values');}},'set':function(_0x3a6976){if(Array[_0xc01c('0xd')](_0x3a6976)){this[_0xc01c('0x6')]('values',JSON['stringify'](_0x3a6976));}else{this[_0xc01c('0x6')](_0xc01c('0xe'),_0x3a6976);}}},'required':{'type':Sequelize[_0xc01c('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc01c('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xc01c('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index dd5a668..62ecc8a 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 _0xb53a=['count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','fields','include','find','body','create','sequelize','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x796cba,_0x32df0a){var _0x57fed1=function(_0x2a0d7d){while(--_0x2a0d7d){_0x796cba['push'](_0x796cba['shift']());}};_0x57fed1(++_0x32df0a);}(_0xb53a,0x8d));var _0xab53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb53a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xab53('0x0'));var rimraf=require(_0xab53('0x1'));var zipdir=require(_0xab53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab53('0x3'));var moment=require(_0xab53('0x4'));var BPromise=require(_0xab53('0x5'));var Mustache=require('mustache');var util=require(_0xab53('0x6'));var path=require(_0xab53('0x7'));var sox=require('sox');var csv=require(_0xab53('0x8'));var ejs=require(_0xab53('0x9'));var fs=require('fs');var fs_extra=require(_0xab53('0xa'));var _=require(_0xab53('0xb'));var squel=require(_0xab53('0xc'));var crypto=require('crypto');var jsforce=require(_0xab53('0xd'));var deskjs=require(_0xab53('0xe'));var toCsv=require('to-csv');var querystring=require(_0xab53('0xf'));var Papa=require('papaparse');var Redis=require(_0xab53('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xab53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab53('0x12'));var logger=require(_0xab53('0x13'))(_0xab53('0x14'));var utils=require(_0xab53('0x15'));var config=require(_0xab53('0x16'));var licenseUtil=require(_0xab53('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x386616,_0x546878){_0x546878=_0x546878||0xcc;return function(_0x1c20f5){if(_0x1c20f5){return _0x386616[_0xab53('0x18')](_0x546878);}return _0x386616['status'](_0x546878)['end']();};}function respondWithResult(_0x268efd,_0x359681){_0x359681=_0x359681||0xc8;return function(_0xd799e5){if(_0xd799e5){return _0x268efd[_0xab53('0x19')](_0x359681)[_0xab53('0x1a')](_0xd799e5);}};}function respondWithFilteredResult(_0x472cde,_0x5882e4){return function(_0x47f2fb){if(_0x47f2fb){var _0x2492eb=typeof _0x5882e4[_0xab53('0x1b')]===_0xab53('0x1c')&&typeof _0x5882e4['limit']===_0xab53('0x1c');var _0x3574bb=_0x47f2fb[_0xab53('0x1d')];var _0x552e17=_0x2492eb?0x0:_0x5882e4[_0xab53('0x1b')];var _0x269eda=_0x2492eb?_0x47f2fb[_0xab53('0x1d')]:_0x5882e4[_0xab53('0x1b')]+_0x5882e4[_0xab53('0x1e')];var _0x5b042e;if(_0x269eda>=_0x3574bb){_0x269eda=_0x3574bb;_0x5b042e=0xc8;}else{_0x5b042e=0xce;}_0x472cde[_0xab53('0x19')](_0x5b042e);return _0x472cde[_0xab53('0x1f')](_0xab53('0x20'),_0x552e17+'-'+_0x269eda+'/'+_0x3574bb)[_0xab53('0x1a')](_0x47f2fb);}return null;};}function patchUpdates(_0x44431f){return function(_0x5e606e){try{jsonpatch[_0xab53('0x21')](_0x5e606e,_0x44431f,!![]);}catch(_0x3b1d67){return BPromise[_0xab53('0x22')](_0x3b1d67);}return _0x5e606e['save']();};}function saveUpdates(_0x475946,_0x4fb1fe){return function(_0x4c357c){if(_0x4c357c){return _0x4c357c[_0xab53('0x23')](_0x475946)[_0xab53('0x24')](function(_0x481cc8){return _0x481cc8;});}return null;};}function removeEntity(_0x5b58a2,_0x2cd0a1){return function(_0x521f20){if(_0x521f20){return _0x521f20[_0xab53('0x25')]()[_0xab53('0x24')](function(){_0x5b58a2['status'](0xcc)[_0xab53('0x26')]();});}};}function handleEntityNotFound(_0x5c94b0,_0x2088a4){return function(_0x47634d){if(!_0x47634d){_0x5c94b0['sendStatus'](0x194);}return _0x47634d;};}function handleError(_0x448915,_0x11fba1){_0x11fba1=_0x11fba1||0x1f4;return function(_0x46f5ba){logger[_0xab53('0x27')](_0x46f5ba[_0xab53('0x28')]);if(_0x46f5ba[_0xab53('0x29')]){delete _0x46f5ba[_0xab53('0x29')];}_0x448915[_0xab53('0x19')](_0x11fba1)[_0xab53('0x2a')](_0x46f5ba);};}exports[_0xab53('0x2b')]=function(_0x3683d2,_0x19882a){var _0xbeba1d={},_0x286fb1={},_0x77287b={'count':0x0,'rows':[]};var _0x4c70db=_[_0xab53('0x2c')](db[_0xab53('0x2d')][_0xab53('0x2e')],function(_0x5089a1){return{'name':_0x5089a1['fieldName'],'type':_0x5089a1[_0xab53('0x2f')][_0xab53('0x30')]};});_0x286fb1[_0xab53('0x31')]=_[_0xab53('0x32')](_[_0xab53('0x2c')](_0x4c70db,_0xab53('0x29')),[_0xab53('0x29')]);_0x286fb1[_0xab53('0x33')]=_['keys'](_0x3683d2[_0xab53('0x33')]);_0x286fb1[_0xab53('0x34')]=_[_0xab53('0x35')](_0x286fb1[_0xab53('0x31')],_0x286fb1[_0xab53('0x33')]);_0xbeba1d[_0xab53('0x36')]=_[_0xab53('0x35')](_0x286fb1[_0xab53('0x31')],qs['fields'](_0x3683d2[_0xab53('0x33')]['fields']));_0xbeba1d[_0xab53('0x36')]=_0xbeba1d['attributes'][_0xab53('0x37')]?_0xbeba1d[_0xab53('0x36')]:_0x286fb1[_0xab53('0x31')];if(!_0x3683d2[_0xab53('0x33')][_0xab53('0x38')]('nolimit')){_0xbeba1d[_0xab53('0x1e')]=qs[_0xab53('0x1e')](_0x3683d2['query']['limit']);_0xbeba1d[_0xab53('0x1b')]=qs['offset'](_0x3683d2[_0xab53('0x33')]['offset']);}_0xbeba1d[_0xab53('0x39')]=qs[_0xab53('0x3a')](_0x3683d2[_0xab53('0x33')]['sort']);_0xbeba1d[_0xab53('0x3b')]=qs[_0xab53('0x34')](_['pick'](_0x3683d2[_0xab53('0x33')],_0x286fb1['filters']),_0x4c70db);if(_0x3683d2[_0xab53('0x33')][_0xab53('0x3c')]){_0xbeba1d[_0xab53('0x3b')]=_[_0xab53('0x3d')](_0xbeba1d[_0xab53('0x3b')],{'$or':_[_0xab53('0x2c')](_0x4c70db,function(_0x34bb16){if(_0x34bb16[_0xab53('0x2f')]!==_0xab53('0x3e')){var _0x1045aa={};_0x1045aa[_0x34bb16[_0xab53('0x29')]]={'$like':'%'+_0x3683d2[_0xab53('0x33')]['filter']+'%'};return _0x1045aa;}})});}_0xbeba1d=_['merge']({},_0xbeba1d,_0x3683d2[_0xab53('0x3f')]);var _0x49c821={'where':_0xbeba1d[_0xab53('0x3b')]};return db['CmCustomField'][_0xab53('0x1d')](_0x49c821)[_0xab53('0x24')](function(_0xfa02a7){_0x77287b[_0xab53('0x1d')]=_0xfa02a7;if(_0x3683d2[_0xab53('0x33')][_0xab53('0x40')]){_0xbeba1d['include']=[{'all':!![]}];}return db[_0xab53('0x2d')][_0xab53('0x41')](_0xbeba1d);})[_0xab53('0x24')](function(_0x5779e4){_0x77287b['rows']=_0x5779e4;return _0x77287b;})[_0xab53('0x24')](respondWithFilteredResult(_0x19882a,_0xbeba1d))[_0xab53('0x42')](handleError(_0x19882a,null));};exports[_0xab53('0x43')]=function(_0x209079,_0x503827){var _0x5692a8={'raw':!![],'where':{'id':_0x209079[_0xab53('0x44')]['id']}},_0x1d1485={};_0x1d1485[_0xab53('0x31')]=_[_0xab53('0x45')](db[_0xab53('0x2d')]['rawAttributes']);_0x1d1485[_0xab53('0x33')]=_['keys'](_0x209079[_0xab53('0x33')]);_0x1d1485['filters']=_[_0xab53('0x35')](_0x1d1485[_0xab53('0x31')],_0x1d1485['query']);_0x5692a8['attributes']=_[_0xab53('0x35')](_0x1d1485['model'],qs[_0xab53('0x46')](_0x209079[_0xab53('0x33')][_0xab53('0x46')]));_0x5692a8[_0xab53('0x36')]=_0x5692a8[_0xab53('0x36')]['length']?_0x5692a8['attributes']:_0x1d1485[_0xab53('0x31')];if(_0x209079['query'][_0xab53('0x40')]){_0x5692a8[_0xab53('0x47')]=[{'all':!![]}];}_0x5692a8=_[_0xab53('0x3d')]({},_0x5692a8,_0x209079[_0xab53('0x3f')]);return db['CmCustomField'][_0xab53('0x48')](_0x5692a8)[_0xab53('0x24')](handleEntityNotFound(_0x503827,null))[_0xab53('0x24')](respondWithResult(_0x503827,null))[_0xab53('0x42')](handleError(_0x503827,null));};exports[_0xab53('0x23')]=function(_0x207c6f,_0x39f53d){if(_0x207c6f[_0xab53('0x49')]['id']){delete _0x207c6f[_0xab53('0x49')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x207c6f[_0xab53('0x44')]['id']}})[_0xab53('0x24')](handleEntityNotFound(_0x39f53d,null))['then'](saveUpdates(_0x207c6f[_0xab53('0x49')],null))[_0xab53('0x24')](respondWithResult(_0x39f53d,null))[_0xab53('0x42')](handleError(_0x39f53d,null));};exports['destroy']=function(_0x2b660d,_0x5e32c4){return db[_0xab53('0x2d')]['find']({'where':{'id':_0x2b660d[_0xab53('0x44')]['id']}})[_0xab53('0x24')](handleEntityNotFound(_0x5e32c4,null))[_0xab53('0x24')](removeEntity(_0x5e32c4,null))['catch'](handleError(_0x5e32c4,null));};exports[_0xab53('0x4a')]=function(_0x2f50bc,_0x23fb63){var _0x9b03a7;return db[_0xab53('0x4b')]['transaction'](function(_0x5d4328){return db['CmCustomField']['create'](_0x2f50bc[_0xab53('0x49')],{'transaction':_0x5d4328})['then'](function(_0x37d0ec){_0x9b03a7=_0x37d0ec;var _0x4a82e8={'type':db[_0xab53('0x4c')][_0xab53('0x4d')],'transaction':_0x5d4328};switch(_0x2f50bc[_0xab53('0x49')][_0xab53('0x2f')]){case _0xab53('0x4e'):_0x4a82e8[_0xab53('0x2f')]=db[_0xab53('0x4c')]['TEXT'];break;case _0xab53('0x4f'):_0x4a82e8[_0xab53('0x2f')]=db['Sequelize']['INTEGER'];break;case _0xab53('0x50'):_0x4a82e8['type']=db[_0xab53('0x4c')][_0xab53('0x51')];_0x4a82e8[_0xab53('0x52')]=![];break;default:}return db[_0xab53('0x4b')][_0xab53('0x53')][_0xab53('0x54')]('cm_contacts',util['format']('cf_%d',_0x9b03a7['id']),_0x4a82e8);})[_0xab53('0x24')](function(){return _0x9b03a7;});})[_0xab53('0x24')](respondWithResult(_0x23fb63,0xc9))[_0xab53('0x42')](handleError(_0x23fb63,null));}; \ No newline at end of file +var _0x5460=['Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','find','body','create','sequelize','transaction'];(function(_0x415260,_0x135fcb){var _0x490f21=function(_0x28d91c){while(--_0x28d91c){_0x415260['push'](_0x415260['shift']());}};_0x490f21(++_0x135fcb);}(_0x5460,0x177));var _0x0546=function(_0x2ba3ee,_0x34a4a1){_0x2ba3ee=_0x2ba3ee-0x0;var _0x572417=_0x5460[_0x2ba3ee];return _0x572417;};'use strict';var emlformat=require(_0x0546('0x0'));var rimraf=require(_0x0546('0x1'));var zipdir=require(_0x0546('0x2'));var jsonpatch=require(_0x0546('0x3'));var rp=require(_0x0546('0x4'));var moment=require(_0x0546('0x5'));var BPromise=require(_0x0546('0x6'));var Mustache=require(_0x0546('0x7'));var util=require(_0x0546('0x8'));var path=require(_0x0546('0x9'));var sox=require(_0x0546('0xa'));var csv=require('to-csv');var ejs=require(_0x0546('0xb'));var fs=require('fs');var fs_extra=require(_0x0546('0xc'));var _=require(_0x0546('0xd'));var squel=require(_0x0546('0xe'));var crypto=require(_0x0546('0xf'));var jsforce=require(_0x0546('0x10'));var deskjs=require(_0x0546('0x11'));var toCsv=require(_0x0546('0x12'));var querystring=require(_0x0546('0x13'));var Papa=require(_0x0546('0x14'));var Redis=require(_0x0546('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0546('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x0546('0x17'));var config=require(_0x0546('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0546('0x19'))['db'];function respondWithStatusCode(_0x16be76,_0x4d6199){_0x4d6199=_0x4d6199||0xcc;return function(_0x20bd5c){if(_0x20bd5c){return _0x16be76['sendStatus'](_0x4d6199);}return _0x16be76['status'](_0x4d6199)['end']();};}function respondWithResult(_0x113fab,_0x8f3a){_0x8f3a=_0x8f3a||0xc8;return function(_0x141ad6){if(_0x141ad6){return _0x113fab['status'](_0x8f3a)[_0x0546('0x1a')](_0x141ad6);}};}function respondWithFilteredResult(_0x526eae,_0x1b9f48){return function(_0x69da8f){if(_0x69da8f){var _0xd852e9=typeof _0x1b9f48[_0x0546('0x1b')]===_0x0546('0x1c')&&typeof _0x1b9f48[_0x0546('0x1d')]===_0x0546('0x1c');var _0x3bd7e7=_0x69da8f[_0x0546('0x1e')];var _0x41bce3=_0xd852e9?0x0:_0x1b9f48[_0x0546('0x1b')];var _0x1b56c6=_0xd852e9?_0x69da8f[_0x0546('0x1e')]:_0x1b9f48[_0x0546('0x1b')]+_0x1b9f48[_0x0546('0x1d')];var _0x449980;if(_0x1b56c6>=_0x3bd7e7){_0x1b56c6=_0x3bd7e7;_0x449980=0xc8;}else{_0x449980=0xce;}_0x526eae[_0x0546('0x1f')](_0x449980);return _0x526eae[_0x0546('0x20')](_0x0546('0x21'),_0x41bce3+'-'+_0x1b56c6+'/'+_0x3bd7e7)[_0x0546('0x1a')](_0x69da8f);}return null;};}function patchUpdates(_0x4f6ecd){return function(_0x9c1b1d){try{jsonpatch[_0x0546('0x22')](_0x9c1b1d,_0x4f6ecd,!![]);}catch(_0x3c30cf){return BPromise[_0x0546('0x23')](_0x3c30cf);}return _0x9c1b1d['save']();};}function saveUpdates(_0x472714,_0xf96907){return function(_0x35186c){if(_0x35186c){return _0x35186c[_0x0546('0x24')](_0x472714)[_0x0546('0x25')](function(_0x59acf1){return _0x59acf1;});}return null;};}function removeEntity(_0x1f01e2,_0x45a4c0){return function(_0xc86eaf){if(_0xc86eaf){return _0xc86eaf[_0x0546('0x26')]()[_0x0546('0x25')](function(){_0x1f01e2['status'](0xcc)[_0x0546('0x27')]();});}};}function handleEntityNotFound(_0x5aeec0,_0x5ca9e2){return function(_0x30b9fe){if(!_0x30b9fe){_0x5aeec0[_0x0546('0x28')](0x194);}return _0x30b9fe;};}function handleError(_0x58e6a7,_0xcd578d){_0xcd578d=_0xcd578d||0x1f4;return function(_0x18bb9a){logger[_0x0546('0x29')](_0x18bb9a[_0x0546('0x2a')]);if(_0x18bb9a[_0x0546('0x2b')]){delete _0x18bb9a[_0x0546('0x2b')];}_0x58e6a7['status'](_0xcd578d)[_0x0546('0x2c')](_0x18bb9a);};}exports[_0x0546('0x2d')]=function(_0x5834e5,_0x347b08){var _0x3ca12a={},_0x1e2861={},_0x24957e={'count':0x0,'rows':[]};var _0x1eb702=_[_0x0546('0x2e')](db[_0x0546('0x2f')][_0x0546('0x30')],function(_0x2e3ca8){return{'name':_0x2e3ca8[_0x0546('0x31')],'type':_0x2e3ca8[_0x0546('0x32')][_0x0546('0x33')]};});_0x1e2861[_0x0546('0x34')]=_[_0x0546('0x35')](_[_0x0546('0x2e')](_0x1eb702,_0x0546('0x2b')),[_0x0546('0x2b')]);_0x1e2861[_0x0546('0x36')]=_[_0x0546('0x37')](_0x5834e5['query']);_0x1e2861[_0x0546('0x38')]=_[_0x0546('0x39')](_0x1e2861['model'],_0x1e2861[_0x0546('0x36')]);_0x3ca12a[_0x0546('0x3a')]=_[_0x0546('0x39')](_0x1e2861['model'],qs[_0x0546('0x3b')](_0x5834e5[_0x0546('0x36')][_0x0546('0x3b')]));_0x3ca12a['attributes']=_0x3ca12a[_0x0546('0x3a')][_0x0546('0x3c')]?_0x3ca12a[_0x0546('0x3a')]:_0x1e2861[_0x0546('0x34')];if(!_0x5834e5[_0x0546('0x36')]['hasOwnProperty'](_0x0546('0x3d'))){_0x3ca12a['limit']=qs[_0x0546('0x1d')](_0x5834e5[_0x0546('0x36')]['limit']);_0x3ca12a[_0x0546('0x1b')]=qs['offset'](_0x5834e5[_0x0546('0x36')]['offset']);}_0x3ca12a[_0x0546('0x3e')]=qs[_0x0546('0x3f')](_0x5834e5['query'][_0x0546('0x3f')]);_0x3ca12a[_0x0546('0x40')]=qs[_0x0546('0x38')](_[_0x0546('0x41')](_0x5834e5[_0x0546('0x36')],_0x1e2861[_0x0546('0x38')]),_0x1eb702);if(_0x5834e5[_0x0546('0x36')]['filter']){_0x3ca12a[_0x0546('0x40')]=_[_0x0546('0x42')](_0x3ca12a[_0x0546('0x40')],{'$or':_[_0x0546('0x2e')](_0x1eb702,function(_0x5cc97f){if(_0x5cc97f['type']!=='VIRTUAL'){var _0x1b7ede={};_0x1b7ede[_0x5cc97f[_0x0546('0x2b')]]={'$like':'%'+_0x5834e5['query'][_0x0546('0x43')]+'%'};return _0x1b7ede;}})});}_0x3ca12a=_[_0x0546('0x42')]({},_0x3ca12a,_0x5834e5[_0x0546('0x44')]);var _0x4bfae0={'where':_0x3ca12a[_0x0546('0x40')]};return db[_0x0546('0x2f')][_0x0546('0x1e')](_0x4bfae0)[_0x0546('0x25')](function(_0x53b606){_0x24957e[_0x0546('0x1e')]=_0x53b606;if(_0x5834e5[_0x0546('0x36')][_0x0546('0x45')]){_0x3ca12a[_0x0546('0x46')]=[{'all':!![]}];}return db[_0x0546('0x2f')][_0x0546('0x47')](_0x3ca12a);})[_0x0546('0x25')](function(_0x275882){_0x24957e['rows']=_0x275882;return _0x24957e;})[_0x0546('0x25')](respondWithFilteredResult(_0x347b08,_0x3ca12a))[_0x0546('0x48')](handleError(_0x347b08,null));};exports[_0x0546('0x49')]=function(_0x61fb69,_0x434b1f){var _0x3171ec={'raw':!![],'where':{'id':_0x61fb69[_0x0546('0x4a')]['id']}},_0x54ad30={};_0x54ad30['model']=_['keys'](db[_0x0546('0x2f')][_0x0546('0x30')]);_0x54ad30['query']=_[_0x0546('0x37')](_0x61fb69[_0x0546('0x36')]);_0x54ad30[_0x0546('0x38')]=_['intersection'](_0x54ad30[_0x0546('0x34')],_0x54ad30['query']);_0x3171ec[_0x0546('0x3a')]=_[_0x0546('0x39')](_0x54ad30['model'],qs[_0x0546('0x3b')](_0x61fb69[_0x0546('0x36')]['fields']));_0x3171ec[_0x0546('0x3a')]=_0x3171ec['attributes'][_0x0546('0x3c')]?_0x3171ec[_0x0546('0x3a')]:_0x54ad30[_0x0546('0x34')];if(_0x61fb69[_0x0546('0x36')][_0x0546('0x45')]){_0x3171ec[_0x0546('0x46')]=[{'all':!![]}];}_0x3171ec=_[_0x0546('0x42')]({},_0x3171ec,_0x61fb69['options']);return db[_0x0546('0x2f')][_0x0546('0x4b')](_0x3171ec)[_0x0546('0x25')](handleEntityNotFound(_0x434b1f,null))['then'](respondWithResult(_0x434b1f,null))[_0x0546('0x48')](handleError(_0x434b1f,null));};exports['update']=function(_0x5f3fe6,_0x54a56d){if(_0x5f3fe6[_0x0546('0x4c')]['id']){delete _0x5f3fe6['body']['id'];}return db[_0x0546('0x2f')][_0x0546('0x4b')]({'where':{'id':_0x5f3fe6[_0x0546('0x4a')]['id']}})[_0x0546('0x25')](handleEntityNotFound(_0x54a56d,null))[_0x0546('0x25')](saveUpdates(_0x5f3fe6[_0x0546('0x4c')],null))[_0x0546('0x25')](respondWithResult(_0x54a56d,null))[_0x0546('0x48')](handleError(_0x54a56d,null));};exports['destroy']=function(_0x555fb0,_0x15cef2){return db[_0x0546('0x2f')]['find']({'where':{'id':_0x555fb0[_0x0546('0x4a')]['id']}})[_0x0546('0x25')](handleEntityNotFound(_0x15cef2,null))[_0x0546('0x25')](removeEntity(_0x15cef2,null))[_0x0546('0x48')](handleError(_0x15cef2,null));};exports[_0x0546('0x4d')]=function(_0x3edd57,_0x95668c){var _0x34da68;return db[_0x0546('0x4e')][_0x0546('0x4f')](function(_0x1f5945){return db[_0x0546('0x2f')][_0x0546('0x4d')](_0x3edd57[_0x0546('0x4c')],{'transaction':_0x1f5945})[_0x0546('0x25')](function(_0x467a20){_0x34da68=_0x467a20;var _0x386eec={'type':db[_0x0546('0x50')][_0x0546('0x51')],'transaction':_0x1f5945};switch(_0x3edd57[_0x0546('0x4c')][_0x0546('0x32')]){case _0x0546('0x52'):_0x386eec[_0x0546('0x32')]=db[_0x0546('0x50')]['TEXT'];break;case _0x0546('0x53'):_0x386eec['type']=db[_0x0546('0x50')][_0x0546('0x54')];break;case _0x0546('0x55'):_0x386eec[_0x0546('0x32')]=db[_0x0546('0x50')][_0x0546('0x56')];_0x386eec[_0x0546('0x57')]=![];break;default:}return db['sequelize']['queryInterface'][_0x0546('0x58')](_0x0546('0x59'),util[_0x0546('0x5a')]('cf_%d',_0x34da68['id']),_0x386eec);})[_0x0546('0x25')](function(){return _0x34da68;});})[_0x0546('0x25')](respondWithResult(_0x95668c,0xc9))[_0x0546('0x48')](handleError(_0x95668c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3fefd4b..0af3ec0 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 _0xafe7=['../../config/environment','./cmCustomField.attributes','define','CmCustomField','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4aa51f,_0x33e730){var _0x233451=function(_0x3c548f){while(--_0x3c548f){_0x4aa51f['push'](_0x4aa51f['shift']());}};_0x233451(++_0x33e730);}(_0xafe7,0x7d));var _0x7afe=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xafe7[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x7afe('0x0'));var util=require(_0x7afe('0x1'));var logger=require(_0x7afe('0x2'))(_0x7afe('0x3'));var moment=require(_0x7afe('0x4'));var BPromise=require(_0x7afe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7afe('0x6'));var rimraf=require('rimraf');var config=require(_0x7afe('0x7'));var attributes=require(_0x7afe('0x8'));module['exports']=function(_0x11bbe3,_0x5c108d){return _0x11bbe3[_0x7afe('0x9')](_0x7afe('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdab8=['CmCustomField','cm_custom_fields','lodash','../../config/logger','api','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x10127f,_0x55f92f){var _0x164d1c=function(_0x443b32){while(--_0x443b32){_0x10127f['push'](_0x10127f['shift']());}};_0x164d1c(++_0x55f92f);}(_0xdab8,0xd2));var _0x8dab=function(_0x237468,_0x2640f1){_0x237468=_0x237468-0x0;var _0x24aae1=_0xdab8[_0x237468];return _0x24aae1;};'use strict';var _=require(_0x8dab('0x0'));var util=require('util');var logger=require(_0x8dab('0x1'))(_0x8dab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8dab('0x3'));var attributes=require(_0x8dab('0x4'));module[_0x8dab('0x5')]=function(_0x281690,_0x973090){return _0x281690['define'](_0x8dab('0x6'),attributes,{'tableName':_0x8dab('0x7'),'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 8838a50..96b1b6e 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 _0xf3dd=['rpc','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x537dd1,_0x37e917){var _0x1caf6c=function(_0x52aec5){while(--_0x52aec5){_0x537dd1['push'](_0x537dd1['shift']());}};_0x1caf6c(++_0x37e917);}(_0xf3dd,0x92));var _0xdf3d=function(_0x35d120,_0x2ca28c){_0x35d120=_0x35d120-0x0;var _0x69e008=_0xf3dd[_0x35d120];return _0x69e008;};'use strict';var _=require(_0xdf3d('0x0'));var util=require(_0xdf3d('0x1'));var moment=require(_0xdf3d('0x2'));var BPromise=require(_0xdf3d('0x3'));var rs=require(_0xdf3d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf3d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf3d('0x6'));var config=require(_0xdf3d('0x7'));var jayson=require(_0xdf3d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1070ec,_0x5026a0,_0x183192){return new BPromise(function(_0x1fc27b,_0x43cd94){return client[_0xdf3d('0x9')](_0x1070ec,_0x183192)[_0xdf3d('0xa')](function(_0x18d8b3){logger[_0xdf3d('0xb')](_0xdf3d('0xc'),_0x5026a0,_0xdf3d('0xd'));logger['debug'](_0xdf3d('0xe'),_0x5026a0,'request\x20sent',JSON[_0xdf3d('0xf')](_0x18d8b3));if(_0x18d8b3['error']){if(_0x18d8b3[_0xdf3d('0x10')][_0xdf3d('0x11')]===0x1f4){logger[_0xdf3d('0x10')](_0xdf3d('0xc'),_0x5026a0,_0x18d8b3['error']['message']);return _0x43cd94(_0x18d8b3[_0xdf3d('0x10')][_0xdf3d('0x12')]);}logger[_0xdf3d('0x10')](_0xdf3d('0xc'),_0x5026a0,_0x18d8b3[_0xdf3d('0x10')][_0xdf3d('0x12')]);return _0x1fc27b(_0x18d8b3[_0xdf3d('0x10')]['message']);}else{logger[_0xdf3d('0xb')](_0xdf3d('0xc'),_0x5026a0,_0xdf3d('0xd'));_0x1fc27b(_0x18d8b3['result']['message']);}})['catch'](function(_0x2fc0ec){logger[_0xdf3d('0x10')](_0xdf3d('0xc'),_0x5026a0,_0x2fc0ec);_0x43cd94(_0x2fc0ec);});});} \ No newline at end of file +var _0xc9a7=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x30abdf,_0x2fe412){var _0x5b9f63=function(_0x3e76d9){while(--_0x3e76d9){_0x30abdf['push'](_0x30abdf['shift']());}};_0x5b9f63(++_0x2fe412);}(_0xc9a7,0x1ca));var _0x7c9a=function(_0x5853be,_0x181484){_0x5853be=_0x5853be-0x0;var _0x2d0586=_0xc9a7[_0x5853be];return _0x2d0586;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c9a('0x0'));var BPromise=require(_0x7c9a('0x1'));var rs=require(_0x7c9a('0x2'));var fs=require('fs');var Redis=require(_0x7c9a('0x3'));var db=require(_0x7c9a('0x4'))['db'];var utils=require(_0x7c9a('0x5'));var logger=require(_0x7c9a('0x6'))(_0x7c9a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c9a('0x8')][_0x7c9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ce2b1,_0x560194,_0x237953){return new BPromise(function(_0x4d73e7,_0x2c8b95){return client['request'](_0x3ce2b1,_0x237953)[_0x7c9a('0xa')](function(_0x153ec5){logger[_0x7c9a('0xb')](_0x7c9a('0xc'),_0x560194,_0x7c9a('0xd'));logger[_0x7c9a('0xe')](_0x7c9a('0xf'),_0x560194,_0x7c9a('0xd'),JSON[_0x7c9a('0x10')](_0x153ec5));if(_0x153ec5[_0x7c9a('0x11')]){if(_0x153ec5[_0x7c9a('0x11')][_0x7c9a('0x12')]===0x1f4){logger['error'](_0x7c9a('0xc'),_0x560194,_0x153ec5[_0x7c9a('0x11')]['message']);return _0x2c8b95(_0x153ec5[_0x7c9a('0x11')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x560194,_0x153ec5[_0x7c9a('0x11')][_0x7c9a('0x13')]);return _0x4d73e7(_0x153ec5['error']['message']);}else{logger[_0x7c9a('0xb')](_0x7c9a('0xc'),_0x560194,_0x7c9a('0xd'));_0x4d73e7(_0x153ec5[_0x7c9a('0x14')][_0x7c9a('0x13')]);}})[_0x7c9a('0x15')](function(_0x56ab33){logger[_0x7c9a('0x11')](_0x7c9a('0xc'),_0x560194,_0x56ab33);_0x2c8b95(_0x56ab33);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 375ede3..699f5b5 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 _0x3d1f=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','show','create','/:id','destroy','exports','multer'];(function(_0x302aef,_0x123aac){var _0x16f906=function(_0x2f456e){while(--_0x2f456e){_0x302aef['push'](_0x302aef['shift']());}};_0x16f906(++_0x123aac);}(_0x3d1f,0xfb));var _0xf3d1=function(_0x5eea0a,_0x598f06){_0x5eea0a=_0x5eea0a-0x0;var _0x23bfb6=_0x3d1f[_0x5eea0a];return _0x23bfb6;};'use strict';var multer=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var path=require(_0xf3d1('0x2'));var timeout=require(_0xf3d1('0x3'));var express=require('express');var router=express[_0xf3d1('0x4')]();var fs_extra=require(_0xf3d1('0x5'));var auth=require(_0xf3d1('0x6'));var interaction=require(_0xf3d1('0x7'));var config=require(_0xf3d1('0x8'));var controller=require(_0xf3d1('0x9'));router[_0xf3d1('0xa')]('/',auth['isAuthenticated'](),controller[_0xf3d1('0xb')]);router[_0xf3d1('0xa')]('/:id',auth[_0xf3d1('0xc')](),controller[_0xf3d1('0xd')]);router['post']('/',auth[_0xf3d1('0xc')](),controller[_0xf3d1('0xe')]);router['put'](_0xf3d1('0xf'),auth[_0xf3d1('0xc')](),controller['update']);router['delete'](_0xf3d1('0xf'),auth[_0xf3d1('0xc')](),controller[_0xf3d1('0x10')]);module[_0xf3d1('0x11')]=router; \ No newline at end of file +var _0x5577=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x378142,_0x1d6104){var _0x2ab91e=function(_0x15cca4){while(--_0x15cca4){_0x378142['push'](_0x378142['shift']());}};_0x2ab91e(++_0x1d6104);}(_0x5577,0x1b4));var _0x7557=function(_0x3a82a4,_0x184279){_0x3a82a4=_0x3a82a4-0x0;var _0x2c656b=_0x5577[_0x3a82a4];return _0x2c656b;};'use strict';var multer=require(_0x7557('0x0'));var util=require('util');var path=require(_0x7557('0x1'));var timeout=require(_0x7557('0x2'));var express=require('express');var router=express[_0x7557('0x3')]();var fs_extra=require(_0x7557('0x4'));var auth=require(_0x7557('0x5'));var interaction=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var controller=require(_0x7557('0x8'));router['get']('/',auth[_0x7557('0x9')](),controller[_0x7557('0xa')]);router[_0x7557('0xb')](_0x7557('0xc'),auth[_0x7557('0x9')](),controller[_0x7557('0xd')]);router[_0x7557('0xe')]('/',auth[_0x7557('0x9')](),controller[_0x7557('0xf')]);router[_0x7557('0x10')](_0x7557('0xc'),auth[_0x7557('0x9')](),controller[_0x7557('0x11')]);router[_0x7557('0x12')](_0x7557('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7557('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index aab44b9..b3fbd7b 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 _0xa7ae=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0xa7ae,0xde));var _0xea7a=function(_0x270241,_0x397d58){_0x270241=_0x270241-0x0;var _0x1203db=_0xa7ae[_0x270241];return _0x1203db;};'use strict';var moment=require(_0xea7a('0x0'));var Sequelize=require(_0xea7a('0x1'));module[_0xea7a('0x2')]={'phone':{'type':Sequelize[_0xea7a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xea7a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea7a('0x5')],'defaultValue':moment()[_0xea7a('0x6')](_0xea7a('0x7'))},'countbusyretry':{'type':Sequelize[_0xea7a('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea7a('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea7a('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xea7a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea7a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xea7a('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xea7a('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xea7a('0xa')},'ListId':{'type':Sequelize[_0xea7a('0x8')],'unique':_0xea7a('0xa')},'UserId':{'type':Sequelize[_0xea7a('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xea7a('0xa')},'CampaignId':{'type':Sequelize[_0xea7a('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0xea7a('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea7a('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea7a('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea7a('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0340=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','exports','STRING'];(function(_0x16a199,_0x206bf2){var _0x2166fd=function(_0x4c0b03){while(--_0x4c0b03){_0x16a199['push'](_0x16a199['shift']());}};_0x2166fd(++_0x206bf2);}(_0x0340,0x8e));var _0x0034=function(_0x3c9471,_0x1ad7cf){_0x3c9471=_0x3c9471-0x0;var _0x1c3c48=_0x0340[_0x3c9471];return _0x1c3c48;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0034('0x0')]={'phone':{'type':Sequelize[_0x0034('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0034('0x2')],'defaultValue':moment()[_0x0034('0x3')](_0x0034('0x4'))},'countbusyretry':{'type':Sequelize[_0x0034('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0034('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0034('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0034('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0034('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0034('0x2')]},'priority':{'type':Sequelize[_0x0034('0x5')](0x2)[_0x0034('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0034('0x5')],'unique':_0x0034('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0034('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x0034('0x8')},'CampaignId':{'type':Sequelize[_0x0034('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0034('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0034('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0034('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 2f8da45..f2f3ff0 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 _0x7208=['prev','isEmpty','hopperIds','scheduledAt','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','LOCK','CmCompany','Company','CmList','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','end','error','stack','name','index','map','CmHopper','key','keys','query','filters','intersection','model','concat','$or','$gte','$lt','$ne','$eq','$not','$between','$notIn','$like','$notLike','$overlap','$any','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','fields','include','create','update','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0x7208,0x1bd));var _0x8720=function(_0x5e7356,_0x414e70){_0x5e7356=_0x5e7356-0x0;var _0x65f0e8=_0x7208[_0x5e7356];return _0x65f0e8;};'use strict';var emlformat=require(_0x8720('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8720('0x1'));var jsonpatch=require(_0x8720('0x2'));var rp=require(_0x8720('0x3'));var moment=require('moment');var BPromise=require(_0x8720('0x4'));var Mustache=require(_0x8720('0x5'));var util=require(_0x8720('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8720('0x7'));var ejs=require(_0x8720('0x8'));var fs=require('fs');var fs_extra=require(_0x8720('0x9'));var _=require(_0x8720('0xa'));var squel=require(_0x8720('0xb'));var crypto=require(_0x8720('0xc'));var jsforce=require(_0x8720('0xd'));var deskjs=require(_0x8720('0xe'));var toCsv=require(_0x8720('0x7'));var querystring=require(_0x8720('0xf'));var Papa=require(_0x8720('0x10'));var Redis=require('ioredis');var authService=require(_0x8720('0x11'));var qs=require(_0x8720('0x12'));var as=require(_0x8720('0x13'));var hardwareService=require(_0x8720('0x14'));var logger=require(_0x8720('0x15'))(_0x8720('0x16'));var utils=require('../../config/utils');var config=require(_0x8720('0x17'));var licenseUtil=require(_0x8720('0x18'));var db=require(_0x8720('0x19'))['db'];function respondWithStatusCode(_0x15dd10,_0x5a3aee){_0x5a3aee=_0x5a3aee||0xcc;return function(_0x51d53c){if(_0x51d53c){return _0x15dd10[_0x8720('0x1a')](_0x5a3aee);}return _0x15dd10[_0x8720('0x1b')](_0x5a3aee)['end']();};}function respondWithResult(_0x3c7986,_0x44bc63){_0x44bc63=_0x44bc63||0xc8;return function(_0x257a60){if(_0x257a60){return _0x3c7986[_0x8720('0x1b')](_0x44bc63)[_0x8720('0x1c')](_0x257a60);}};}function respondWithFilteredResult(_0x4900f7,_0x4d5ff1){return function(_0x19e252){if(_0x19e252){var _0x50164e=typeof _0x4d5ff1[_0x8720('0x1d')]===_0x8720('0x1e')&&typeof _0x4d5ff1[_0x8720('0x1f')]==='undefined';var _0x933332=_0x19e252['count'];var _0x3c158b=_0x50164e?0x0:_0x4d5ff1[_0x8720('0x1d')];var _0x19afa9=_0x50164e?_0x19e252[_0x8720('0x20')]:_0x4d5ff1[_0x8720('0x1d')]+_0x4d5ff1[_0x8720('0x1f')];var _0x21231d;if(_0x19afa9>=_0x933332){_0x19afa9=_0x933332;_0x21231d=0xc8;}else{_0x21231d=0xce;}_0x4900f7['status'](_0x21231d);return _0x4900f7[_0x8720('0x21')]('Content-Range',_0x3c158b+'-'+_0x19afa9+'/'+_0x933332)[_0x8720('0x1c')](_0x19e252);}return null;};}function patchUpdates(_0x268d28){return function(_0x208a84){try{jsonpatch['apply'](_0x208a84,_0x268d28,!![]);}catch(_0x37b754){return BPromise[_0x8720('0x22')](_0x37b754);}return _0x208a84[_0x8720('0x23')]();};}function saveUpdates(_0x2fe1ba,_0x4c4f9d){return function(_0x741b52){if(_0x741b52){return _0x741b52['update'](_0x2fe1ba)['then'](function(_0x5402fb){return _0x5402fb;});}return null;};}function removeEntity(_0x42e43b,_0x38f905){return function(_0x22df4e){if(_0x22df4e){return _0x22df4e['destroy']()[_0x8720('0x24')](function(){_0x42e43b[_0x8720('0x1b')](0xcc)[_0x8720('0x25')]();});}};}function handleEntityNotFound(_0x2c8305,_0x225436){return function(_0x4144a6){if(!_0x4144a6){_0x2c8305[_0x8720('0x1a')](0x194);}return _0x4144a6;};}function handleError(_0x17cda6,_0x1b2b5f){_0x1b2b5f=_0x1b2b5f||0x1f4;return function(_0x263986){logger[_0x8720('0x26')](_0x263986[_0x8720('0x27')]);if(_0x263986[_0x8720('0x28')]){delete _0x263986[_0x8720('0x28')];}_0x17cda6[_0x8720('0x1b')](_0x1b2b5f)['send'](_0x263986);};}exports[_0x8720('0x29')]=function(_0x1a6c48,_0x4e1a4f){var _0x10b1e7={},_0x54bd75={},_0xfe68a9={'count':0x0,'rows':[]};var _0x226a74=_[_0x8720('0x2a')](db[_0x8720('0x2b')]['rawAttributes'],function(_0x417d60){return{'name':_0x417d60['fieldName'],'type':_0x417d60['type'][_0x8720('0x2c')]};});_0x54bd75['model']=_[_0x8720('0x2a')](_0x226a74,'name');_0x54bd75['query']=_[_0x8720('0x2d')](_0x1a6c48[_0x8720('0x2e')]);_0x54bd75[_0x8720('0x2f')]=_[_0x8720('0x30')](_0x54bd75[_0x8720('0x31')],_0x54bd75[_0x8720('0x2e')]);_0x54bd75['filters']=_[_0x8720('0x32')](_0x54bd75['filters'],['$and',_0x8720('0x33'),'$gt',_0x8720('0x34'),_0x8720('0x35'),'$lte',_0x8720('0x36'),_0x8720('0x37'),_0x8720('0x38'),_0x8720('0x39'),'$notBetween','$in',_0x8720('0x3a'),_0x8720('0x3b'),_0x8720('0x3c'),'$iLike','$notILike','$like',_0x8720('0x3d'),'$contains','$contained',_0x8720('0x3e')]);_0x10b1e7[_0x8720('0x3f')]=_[_0x8720('0x30')](_0x54bd75[_0x8720('0x31')],qs['fields'](_0x1a6c48[_0x8720('0x2e')]['fields']));_0x10b1e7[_0x8720('0x3f')]=_0x10b1e7[_0x8720('0x3f')][_0x8720('0x40')]?_0x10b1e7[_0x8720('0x3f')]:_0x54bd75[_0x8720('0x31')];if(!_0x1a6c48[_0x8720('0x2e')][_0x8720('0x41')]('nolimit')){_0x10b1e7[_0x8720('0x1f')]=qs[_0x8720('0x1f')](_0x1a6c48[_0x8720('0x2e')][_0x8720('0x1f')]);_0x10b1e7[_0x8720('0x1d')]=qs[_0x8720('0x1d')](_0x1a6c48['query'][_0x8720('0x1d')]);}_0x10b1e7[_0x8720('0x42')]=qs[_0x8720('0x43')](_0x1a6c48[_0x8720('0x2e')][_0x8720('0x43')]);_0x10b1e7[_0x8720('0x44')]=qs[_0x8720('0x2f')](_[_0x8720('0x45')](_0x1a6c48[_0x8720('0x2e')],_0x54bd75[_0x8720('0x2f')]),_0x226a74);if(_0x1a6c48[_0x8720('0x2e')][_0x8720('0x46')]){_0x10b1e7[_0x8720('0x44')]=_[_0x8720('0x47')](_0x10b1e7[_0x8720('0x44')],{'$or':_[_0x8720('0x2a')](_0x226a74,function(_0xa52bf){if(_0xa52bf[_0x8720('0x48')]!==_0x8720('0x49')){var _0x526070={};_0x526070[_0xa52bf[_0x8720('0x28')]]={'$like':'%'+_0x1a6c48[_0x8720('0x2e')][_0x8720('0x46')]+'%'};return _0x526070;}})});}_0x10b1e7=_[_0x8720('0x47')]({},_0x10b1e7,_0x1a6c48[_0x8720('0x4a')]);var _0x33cb74={'where':_0x10b1e7[_0x8720('0x44')]};return db['CmHopper']['count'](_0x33cb74)[_0x8720('0x24')](function(_0x40279a){_0xfe68a9[_0x8720('0x20')]=_0x40279a;if(_0x1a6c48[_0x8720('0x2e')][_0x8720('0x4b')]){_0x10b1e7['include']=[{'all':!![]}];}return db[_0x8720('0x2b')][_0x8720('0x4c')](_0x10b1e7);})[_0x8720('0x24')](function(_0x227a35){_0xfe68a9['rows']=_0x227a35;return _0xfe68a9;})['then'](respondWithFilteredResult(_0x4e1a4f,_0x10b1e7))[_0x8720('0x4d')](handleError(_0x4e1a4f,null));};exports[_0x8720('0x4e')]=function(_0x4871e9,_0x56f96c){var _0x55d083={'raw':!![],'where':{'id':_0x4871e9[_0x8720('0x4f')]['id']}},_0x31afd3={};_0x31afd3[_0x8720('0x31')]=_[_0x8720('0x2d')](db[_0x8720('0x2b')][_0x8720('0x50')]);_0x31afd3[_0x8720('0x2e')]=_[_0x8720('0x2d')](_0x4871e9[_0x8720('0x2e')]);_0x31afd3[_0x8720('0x2f')]=_[_0x8720('0x30')](_0x31afd3[_0x8720('0x31')],_0x31afd3[_0x8720('0x2e')]);_0x55d083['attributes']=_[_0x8720('0x30')](_0x31afd3['model'],qs[_0x8720('0x51')](_0x4871e9['query'][_0x8720('0x51')]));_0x55d083[_0x8720('0x3f')]=_0x55d083[_0x8720('0x3f')][_0x8720('0x40')]?_0x55d083[_0x8720('0x3f')]:_0x31afd3[_0x8720('0x31')];if(_0x4871e9[_0x8720('0x2e')][_0x8720('0x4b')]){_0x55d083[_0x8720('0x52')]=[{'all':!![]}];}_0x55d083=_[_0x8720('0x47')]({},_0x55d083,_0x4871e9[_0x8720('0x4a')]);return db[_0x8720('0x2b')]['find'](_0x55d083)['then'](handleEntityNotFound(_0x56f96c,null))['then'](respondWithResult(_0x56f96c,null))['catch'](handleError(_0x56f96c,null));};exports[_0x8720('0x53')]=function(_0x47ace0,_0x3a8a89){return db[_0x8720('0x2b')][_0x8720('0x53')](_0x47ace0['body'],{})[_0x8720('0x24')](respondWithResult(_0x3a8a89,0xc9))[_0x8720('0x4d')](handleError(_0x3a8a89,null));};exports[_0x8720('0x54')]=function(_0x302423,_0x3b6757){if(_0x302423['body']['id']){delete _0x302423[_0x8720('0x55')]['id'];}return db['CmHopper'][_0x8720('0x56')]({'where':{'id':_0x302423[_0x8720('0x4f')]['id']}})[_0x8720('0x24')](handleEntityNotFound(_0x3b6757,null))[_0x8720('0x24')](saveUpdates(_0x302423[_0x8720('0x55')],null))['then'](respondWithResult(_0x3b6757,null))[_0x8720('0x4d')](handleError(_0x3b6757,null));};exports[_0x8720('0x57')]=function(_0x1cf947,_0x4529ce){return db[_0x8720('0x2b')][_0x8720('0x57')]()[_0x8720('0x24')](respondWithResult(_0x4529ce,null))[_0x8720('0x4d')](handleError(_0x4529ce,null));};exports[_0x8720('0x58')]=function(_0x2c7021,_0x11fff1){var _0x35a852;return db['CmHopper'][_0x8720('0x56')]({'where':{'id':_0x2c7021[_0x8720('0x4f')]['id']}})[_0x8720('0x24')](handleEntityNotFound(_0x11fff1,null))[_0x8720('0x24')](function(_0x4416e9){if(_0x4416e9){return _0x4416e9[_0x8720('0x58')]()[_0x8720('0x24')](function(_0x5f2662){return _0x5f2662;});}})['then'](function(_0x4f0ea8){_0x35a852=_0x4f0ea8;if(_0x4f0ea8){if(_0x4f0ea8[_0x8720('0x59')]||_0x4f0ea8[_0x8720('0x5a')]){return db[_0x4f0ea8[_0x8720('0x59')]?_0x8720('0x5b'):'Campaign']['find']({'where':{'id':_0x4f0ea8[_0x8720('0x59')]?_0x4f0ea8['VoiceQueueId']:_0x4f0ea8['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x8720('0x24')](function(_0x337465){var _0x493f62={};if(_0x337465){_[_0x8720('0x47')](_0x493f62,_['omit'](_0x35a852[_0x8720('0x5c')],[_0x8720('0x5d'),_0x8720('0x5e'),'id']));_0x493f62[_0x8720('0x5f')]=0x15;_0x493f62[_0x8720('0x60')]='deleted';_0x493f62[_0x8720('0x61')]=_0x337465[_0x8720('0x28')];_0x493f62[_0x8720('0x62')]=_0x2c7021[_0x8720('0x63')][_0x8720('0x28')];_0x493f62[_0x8720('0x64')]=_0x2c7021[_0x8720('0x63')]['id'];_0x493f62[_0x8720('0x65')]=!![];_0x493f62[_0x8720('0x66')]=moment()[_0x8720('0x67')](_0x8720('0x68'));_0x493f62[_0x8720('0x69')]=_0x35a852[_0x8720('0x6a')];_0x493f62[_0x8720('0x6b')]=_0x35a852[_0x8720('0x59')]?_0x8720('0x6c'):_0x8720('0x6d');return db[_0x8720('0x6e')][_0x8720('0x56')]({'where':{'id':_0x493f62[_0x8720('0x6f')]},'attributes':[_0x8720('0x70'),_0x8720('0x71')]})[_0x8720('0x24')](function(_0x4583f5){if(!_[_0x8720('0x72')](_0x11fff1)&&!_[_0x8720('0x72')](_0x4583f5[_0x8720('0x70')])){_0x493f62[_0x8720('0x73')]=_0x4583f5[_0x8720('0x70')];if(!_[_0x8720('0x72')](_0x4583f5[_0x8720('0x71')])){_0x493f62[_0x8720('0x73')]+='\x20'+_0x4583f5[_0x8720('0x71')];}}})['finally'](function(){return db['CmHopperFinal'][_0x8720('0x53')](_0x493f62);});}})[_0x8720('0x24')](function(){return _0x11fff1[_0x8720('0x1b')](0xcc)[_0x8720('0x25')]();})[_0x8720('0x4d')](handleError(_0x11fff1,null));};exports[_0x8720('0x74')]=function(_0x19eec3,_0x39b3ae,_0x11e4ae){var _0x2290d6=[];return db['CmContact'][_0x8720('0x57')]()[_0x8720('0x24')](function(_0x1ebab2){_0x2290d6=_[_0x8720('0x2d')](_0x1ebab2);return _0x19eec3[_0x8720('0x63')][_0x8720('0x75')]({'where':{'type':_0x8720('0x76'),'dialActive':!![],'dialMethod':_0x8720('0x77')},'attributes':['id',_0x8720('0x78')],'raw':!![]});})[_0x8720('0x24')](function(_0x12d30f){if(_0x12d30f&&_0x12d30f['length']){return db[_0x8720('0x79')]['transaction'](function(_0x275241){var _0x16c225={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8720('0x67')](_0x8720('0x68'))},'VoiceQueueId':{'$in':_[_0x8720('0x2a')](_0x12d30f,'id')},'$or':[{'UserId':null},{'UserId':_0x19eec3['user']['id']}]};var _0x191bca=[];if(_0x19eec3['body'][_0x8720('0x7a')]&&_0x19eec3[_0x8720('0x55')]['direction']===_0x8720('0x7b')){if(!_[_0x8720('0x7c')](_0x19eec3[_0x8720('0x55')]['hopperIds'])){_0x16c225['id']={'$in':_0x19eec3[_0x8720('0x55')][_0x8720('0x7d')]};}_0x191bca=[['priority','ASC'],[_0x8720('0x7e'),_0x12d30f[0x0][_0x8720('0x78')]==='ASC'?_0x8720('0x7f'):_0x8720('0x80')],db[_0x8720('0x79')][_0x8720('0x81')](_0x8720('0x82')),['id','DESC']];}else{if(!_['isEmpty'](_0x19eec3[_0x8720('0x55')][_0x8720('0x7d')])){_0x16c225['id']={'$notIn':_0x19eec3[_0x8720('0x55')]['hopperIds']};}_0x191bca=[['priority',_0x8720('0x7f')],[_0x8720('0x7e'),_0x12d30f[0x0][_0x8720('0x78')]],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x8720('0x80')]];}return db[_0x8720('0x2b')][_0x8720('0x83')]({'attributes':['id',_0x8720('0x84')],'where':_0x16c225,'order':_0x191bca,'transaction':_0x275241,'lock':_0x275241[_0x8720('0x85')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x2290d6,'include':[{'model':db[_0x8720('0x86')],'as':_0x8720('0x87'),'attributes':['id',_0x8720('0x28')]}]},{'model':db[_0x8720('0x88')],'as':'List','attributes':['id','name']},{'model':db[_0x8720('0x5b')],'as':'Queue','attributes':['id',_0x8720('0x28'),_0x8720('0x89')]}]})[_0x8720('0x24')](function(_0xd6db74){if(_0xd6db74){return _0xd6db74[_0x8720('0x54')]({'UserId':_0x19eec3['user']['id']},{'transaction':_0x275241});}});});}})[_0x8720('0x24')](handleEntityNotFound(_0x39b3ae,null))[_0x8720('0x24')](respondWithResult(_0x39b3ae,null))['catch'](handleError(_0x39b3ae,null));};exports[_0x8720('0x8a')]=function(_0x1aa68f,_0x3fe869,_0x371191){return _0x1aa68f[_0x8720('0x63')][_0x8720('0x75')]({'where':{'type':_0x8720('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x8720('0x24')](function(_0x69164c){if(_0x69164c&&_0x69164c[_0x8720('0x40')]){return db['CmHopper'][_0x8720('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8720('0x68'))},'VoiceQueueId':{'$in':_[_0x8720('0x2a')](_0x69164c,'id')},'$or':[{'UserId':null},{'UserId':_0x1aa68f['user']['id']}]}});}return 0x0;})[_0x8720('0x24')](function(_0x51939a){if(!_['isNil'](_0x51939a)&&_[_0x8720('0x8b')](_0x51939a)){return _0x3fe869['status'](0xc8)['json']({'contacts':_0x51939a});}else{logger[_0x8720('0x26')](_0x8720('0x8c'),_0x8720('0x8a'),0x194,_0x8720('0x8d'));_0x3fe869[_0x8720('0x1a')](0x194);}})[_0x8720('0x4d')](handleError(_0x3fe869,null));}; \ No newline at end of file +var _0x569a=['preview','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','isEmpty','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','Company','CmList','List','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','update','then','destroy','name','send','index','rawAttributes','type','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$any','attributes','fields','length','order','sort','where','pick','filter','merge','map','options','CmHopper','includeAll','include','findAll','catch','show','params','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound'];(function(_0x3d1742,_0x22b62c){var _0x24b61f=function(_0x15ea9c){while(--_0x15ea9c){_0x3d1742['push'](_0x3d1742['shift']());}};_0x24b61f(++_0x22b62c);}(_0x569a,0xa9));var _0xa569=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x569a[_0xa3463d];return _0x50fd67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa569('0x0'));var zipdir=require(_0xa569('0x1'));var jsonpatch=require(_0xa569('0x2'));var rp=require(_0xa569('0x3'));var moment=require('moment');var BPromise=require(_0xa569('0x4'));var Mustache=require(_0xa569('0x5'));var util=require(_0xa569('0x6'));var path=require(_0xa569('0x7'));var sox=require(_0xa569('0x8'));var csv=require(_0xa569('0x9'));var ejs=require(_0xa569('0xa'));var fs=require('fs');var fs_extra=require(_0xa569('0xb'));var _=require(_0xa569('0xc'));var squel=require(_0xa569('0xd'));var crypto=require(_0xa569('0xe'));var jsforce=require(_0xa569('0xf'));var deskjs=require(_0xa569('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa569('0x11'));var Papa=require(_0xa569('0x12'));var Redis=require(_0xa569('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa569('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa569('0x15'));var logger=require(_0xa569('0x16'))(_0xa569('0x17'));var utils=require('../../config/utils');var config=require(_0xa569('0x18'));var licenseUtil=require(_0xa569('0x19'));var db=require(_0xa569('0x1a'))['db'];function respondWithStatusCode(_0x138a60,_0x478a91){_0x478a91=_0x478a91||0xcc;return function(_0x3f42f8){if(_0x3f42f8){return _0x138a60[_0xa569('0x1b')](_0x478a91);}return _0x138a60[_0xa569('0x1c')](_0x478a91)[_0xa569('0x1d')]();};}function respondWithResult(_0xf17b7b,_0x4ff67b){_0x4ff67b=_0x4ff67b||0xc8;return function(_0xb09f37){if(_0xb09f37){return _0xf17b7b[_0xa569('0x1c')](_0x4ff67b)[_0xa569('0x1e')](_0xb09f37);}};}function respondWithFilteredResult(_0x2bb227,_0x42fbb3){return function(_0x2e784c){if(_0x2e784c){var _0x48f604=typeof _0x42fbb3[_0xa569('0x1f')]===_0xa569('0x20')&&typeof _0x42fbb3[_0xa569('0x21')]==='undefined';var _0x48a9ac=_0x2e784c[_0xa569('0x22')];var _0x555089=_0x48f604?0x0:_0x42fbb3[_0xa569('0x1f')];var _0x33eb2a=_0x48f604?_0x2e784c['count']:_0x42fbb3['offset']+_0x42fbb3[_0xa569('0x21')];var _0x4fab5d;if(_0x33eb2a>=_0x48a9ac){_0x33eb2a=_0x48a9ac;_0x4fab5d=0xc8;}else{_0x4fab5d=0xce;}_0x2bb227[_0xa569('0x1c')](_0x4fab5d);return _0x2bb227[_0xa569('0x23')](_0xa569('0x24'),_0x555089+'-'+_0x33eb2a+'/'+_0x48a9ac)[_0xa569('0x1e')](_0x2e784c);}return null;};}function patchUpdates(_0x4635af){return function(_0x5eee9f){try{jsonpatch[_0xa569('0x25')](_0x5eee9f,_0x4635af,!![]);}catch(_0x56cdfc){return BPromise['reject'](_0x56cdfc);}return _0x5eee9f['save']();};}function saveUpdates(_0x5427db,_0x7348e6){return function(_0x5c2261){if(_0x5c2261){return _0x5c2261[_0xa569('0x26')](_0x5427db)[_0xa569('0x27')](function(_0x53e14e){return _0x53e14e;});}return null;};}function removeEntity(_0x450ff4,_0x2c42e0){return function(_0x527c83){if(_0x527c83){return _0x527c83[_0xa569('0x28')]()[_0xa569('0x27')](function(){_0x450ff4['status'](0xcc)[_0xa569('0x1d')]();});}};}function handleEntityNotFound(_0x3c5e6e,_0x280dc9){return function(_0x195cd5){if(!_0x195cd5){_0x3c5e6e[_0xa569('0x1b')](0x194);}return _0x195cd5;};}function handleError(_0x4a24cd,_0x1db582){_0x1db582=_0x1db582||0x1f4;return function(_0x2aaad0){logger['error'](_0x2aaad0['stack']);if(_0x2aaad0[_0xa569('0x29')]){delete _0x2aaad0[_0xa569('0x29')];}_0x4a24cd[_0xa569('0x1c')](_0x1db582)[_0xa569('0x2a')](_0x2aaad0);};}exports[_0xa569('0x2b')]=function(_0x158f31,_0x1459d6){var _0x3b5a37={},_0x4615c6={},_0x529613={'count':0x0,'rows':[]};var _0x30e3f7=_['map'](db['CmHopper'][_0xa569('0x2c')],function(_0x38df0b){return{'name':_0x38df0b['fieldName'],'type':_0x38df0b[_0xa569('0x2d')]['key']};});_0x4615c6[_0xa569('0x2e')]=_['map'](_0x30e3f7,'name');_0x4615c6[_0xa569('0x2f')]=_[_0xa569('0x30')](_0x158f31[_0xa569('0x2f')]);_0x4615c6[_0xa569('0x31')]=_[_0xa569('0x32')](_0x4615c6[_0xa569('0x2e')],_0x4615c6['query']);_0x4615c6[_0xa569('0x31')]=_['concat'](_0x4615c6['filters'],[_0xa569('0x33'),_0xa569('0x34'),_0xa569('0x35'),_0xa569('0x36'),'$lt',_0xa569('0x37'),_0xa569('0x38'),_0xa569('0x39'),_0xa569('0x3a'),_0xa569('0x3b'),_0xa569('0x3c'),'$in',_0xa569('0x3d'),_0xa569('0x3e'),_0xa569('0x3f'),'$iLike',_0xa569('0x40'),_0xa569('0x3e'),'$overlap',_0xa569('0x41'),'$contained',_0xa569('0x42')]);_0x3b5a37[_0xa569('0x43')]=_[_0xa569('0x32')](_0x4615c6[_0xa569('0x2e')],qs[_0xa569('0x44')](_0x158f31[_0xa569('0x2f')]['fields']));_0x3b5a37[_0xa569('0x43')]=_0x3b5a37[_0xa569('0x43')][_0xa569('0x45')]?_0x3b5a37['attributes']:_0x4615c6['model'];if(!_0x158f31['query']['hasOwnProperty']('nolimit')){_0x3b5a37[_0xa569('0x21')]=qs[_0xa569('0x21')](_0x158f31['query'][_0xa569('0x21')]);_0x3b5a37['offset']=qs[_0xa569('0x1f')](_0x158f31[_0xa569('0x2f')][_0xa569('0x1f')]);}_0x3b5a37[_0xa569('0x46')]=qs['sort'](_0x158f31['query'][_0xa569('0x47')]);_0x3b5a37[_0xa569('0x48')]=qs['filters'](_[_0xa569('0x49')](_0x158f31[_0xa569('0x2f')],_0x4615c6[_0xa569('0x31')]),_0x30e3f7);if(_0x158f31['query'][_0xa569('0x4a')]){_0x3b5a37[_0xa569('0x48')]=_[_0xa569('0x4b')](_0x3b5a37[_0xa569('0x48')],{'$or':_[_0xa569('0x4c')](_0x30e3f7,function(_0x165f1d){if(_0x165f1d[_0xa569('0x2d')]!=='VIRTUAL'){var _0x17c924={};_0x17c924[_0x165f1d[_0xa569('0x29')]]={'$like':'%'+_0x158f31[_0xa569('0x2f')][_0xa569('0x4a')]+'%'};return _0x17c924;}})});}_0x3b5a37=_[_0xa569('0x4b')]({},_0x3b5a37,_0x158f31[_0xa569('0x4d')]);var _0x3f389a={'where':_0x3b5a37[_0xa569('0x48')]};return db[_0xa569('0x4e')][_0xa569('0x22')](_0x3f389a)['then'](function(_0x3a40ac){_0x529613[_0xa569('0x22')]=_0x3a40ac;if(_0x158f31[_0xa569('0x2f')][_0xa569('0x4f')]){_0x3b5a37[_0xa569('0x50')]=[{'all':!![]}];}return db[_0xa569('0x4e')][_0xa569('0x51')](_0x3b5a37);})['then'](function(_0x349036){_0x529613['rows']=_0x349036;return _0x529613;})[_0xa569('0x27')](respondWithFilteredResult(_0x1459d6,_0x3b5a37))[_0xa569('0x52')](handleError(_0x1459d6,null));};exports[_0xa569('0x53')]=function(_0x377581,_0x3c67d1){var _0x37e89e={'raw':!![],'where':{'id':_0x377581[_0xa569('0x54')]['id']}},_0x2cc9cc={};_0x2cc9cc[_0xa569('0x2e')]=_[_0xa569('0x30')](db[_0xa569('0x4e')]['rawAttributes']);_0x2cc9cc[_0xa569('0x2f')]=_[_0xa569('0x30')](_0x377581[_0xa569('0x2f')]);_0x2cc9cc[_0xa569('0x31')]=_[_0xa569('0x32')](_0x2cc9cc['model'],_0x2cc9cc['query']);_0x37e89e['attributes']=_[_0xa569('0x32')](_0x2cc9cc[_0xa569('0x2e')],qs[_0xa569('0x44')](_0x377581[_0xa569('0x2f')][_0xa569('0x44')]));_0x37e89e[_0xa569('0x43')]=_0x37e89e[_0xa569('0x43')][_0xa569('0x45')]?_0x37e89e[_0xa569('0x43')]:_0x2cc9cc['model'];if(_0x377581[_0xa569('0x2f')]['includeAll']){_0x37e89e[_0xa569('0x50')]=[{'all':!![]}];}_0x37e89e=_[_0xa569('0x4b')]({},_0x37e89e,_0x377581['options']);return db[_0xa569('0x4e')][_0xa569('0x55')](_0x37e89e)[_0xa569('0x27')](handleEntityNotFound(_0x3c67d1,null))['then'](respondWithResult(_0x3c67d1,null))[_0xa569('0x52')](handleError(_0x3c67d1,null));};exports[_0xa569('0x56')]=function(_0x173f47,_0x2c97d8){return db[_0xa569('0x4e')][_0xa569('0x56')](_0x173f47['body'],{})[_0xa569('0x27')](respondWithResult(_0x2c97d8,0xc9))[_0xa569('0x52')](handleError(_0x2c97d8,null));};exports['update']=function(_0x2a2513,_0x374cb1){if(_0x2a2513[_0xa569('0x57')]['id']){delete _0x2a2513[_0xa569('0x57')]['id'];}return db[_0xa569('0x4e')]['find']({'where':{'id':_0x2a2513[_0xa569('0x54')]['id']}})[_0xa569('0x27')](handleEntityNotFound(_0x374cb1,null))['then'](saveUpdates(_0x2a2513[_0xa569('0x57')],null))[_0xa569('0x27')](respondWithResult(_0x374cb1,null))[_0xa569('0x52')](handleError(_0x374cb1,null));};exports['describe']=function(_0x49d42a,_0x45da5f){return db[_0xa569('0x4e')][_0xa569('0x58')]()['then'](respondWithResult(_0x45da5f,null))[_0xa569('0x52')](handleError(_0x45da5f,null));};exports['destroy']=function(_0x559522,_0x22669a){var _0x1ed157;return db[_0xa569('0x4e')][_0xa569('0x55')]({'where':{'id':_0x559522[_0xa569('0x54')]['id']}})[_0xa569('0x27')](handleEntityNotFound(_0x22669a,null))['then'](function(_0x54c07e){if(_0x54c07e){return _0x54c07e[_0xa569('0x28')]()[_0xa569('0x27')](function(_0x4955a3){return _0x4955a3;});}})[_0xa569('0x27')](function(_0x5e73aa){_0x1ed157=_0x5e73aa;if(_0x5e73aa){if(_0x5e73aa[_0xa569('0x59')]||_0x5e73aa['CampaignId']){return db[_0x5e73aa['VoiceQueueId']?_0xa569('0x5a'):_0xa569('0x5b')][_0xa569('0x55')]({'where':{'id':_0x5e73aa['VoiceQueueId']?_0x5e73aa[_0xa569('0x59')]:_0x5e73aa[_0xa569('0x5c')]},'attributes':['id',_0xa569('0x29')],'raw':!![]});}}})[_0xa569('0x27')](function(_0x5da818){var _0x4c59a5={};if(_0x5da818){_[_0xa569('0x4b')](_0x4c59a5,_[_0xa569('0x5d')](_0x1ed157[_0xa569('0x5e')],[_0xa569('0x5f'),_0xa569('0x60'),'id']));_0x4c59a5['state']=0x15;_0x4c59a5['statedesc']=_0xa569('0x61');_0x4c59a5[_0xa569('0x62')]=_0x5da818[_0xa569('0x29')];_0x4c59a5[_0xa569('0x63')]=_0x559522[_0xa569('0x64')][_0xa569('0x29')];_0x4c59a5[_0xa569('0x65')]=_0x559522[_0xa569('0x64')]['id'];_0x4c59a5[_0xa569('0x61')]=!![];_0x4c59a5[_0xa569('0x66')]=moment()[_0xa569('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c59a5[_0xa569('0x68')]=_0x1ed157[_0xa569('0x69')];_0x4c59a5[_0xa569('0x6a')]=_0x1ed157[_0xa569('0x59')]?'queue':_0xa569('0x6b');return db['CmContact'][_0xa569('0x55')]({'where':{'id':_0x4c59a5[_0xa569('0x6c')]},'attributes':[_0xa569('0x6d'),_0xa569('0x6e')]})[_0xa569('0x27')](function(_0x22e490){if(!_[_0xa569('0x6f')](_0x22669a)&&!_[_0xa569('0x6f')](_0x22e490['firstName'])){_0x4c59a5[_0xa569('0x70')]=_0x22e490[_0xa569('0x6d')];if(!_[_0xa569('0x6f')](_0x22e490[_0xa569('0x6e')])){_0x4c59a5[_0xa569('0x70')]+='\x20'+_0x22e490[_0xa569('0x6e')];}}})['finally'](function(){return db[_0xa569('0x71')]['create'](_0x4c59a5);});}})['then'](function(){return _0x22669a[_0xa569('0x1c')](0xcc)[_0xa569('0x1d')]();})['catch'](handleError(_0x22669a,null));};exports[_0xa569('0x72')]=function(_0x15f17d,_0x26f7fa,_0x3a5e7c){var _0x219489=[];return db['CmContact'][_0xa569('0x58')]()[_0xa569('0x27')](function(_0x289bbc){_0x219489=_['keys'](_0x289bbc);return _0x15f17d['user'][_0xa569('0x73')]({'where':{'type':_0xa569('0x74'),'dialActive':!![],'dialMethod':_0xa569('0x75')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0xa569('0x27')](function(_0x1ec7dc){if(_0x1ec7dc&&_0x1ec7dc[_0xa569('0x45')]){return db[_0xa569('0x76')][_0xa569('0x77')](function(_0x2f8d94){var _0x412c03={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa569('0x67')](_0xa569('0x78'))},'VoiceQueueId':{'$in':_['map'](_0x1ec7dc,'id')},'$or':[{'UserId':null},{'UserId':_0x15f17d['user']['id']}]};var _0x349748=[];if(_0x15f17d[_0xa569('0x57')][_0xa569('0x79')]&&_0x15f17d[_0xa569('0x57')][_0xa569('0x79')]===_0xa569('0x7a')){if(!_['isEmpty'](_0x15f17d[_0xa569('0x57')][_0xa569('0x7b')])){_0x412c03['id']={'$in':_0x15f17d[_0xa569('0x57')][_0xa569('0x7b')]};}_0x349748=[[_0xa569('0x7c'),_0xa569('0x7d')],[_0xa569('0x7e'),_0x1ec7dc[0x0]['dialOrderByScheduledAt']===_0xa569('0x7d')?_0xa569('0x7f'):_0xa569('0x7d')],db[_0xa569('0x76')][_0xa569('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa569('0x7f')]];}else{if(!_[_0xa569('0x81')](_0x15f17d[_0xa569('0x57')][_0xa569('0x7b')])){_0x412c03['id']={'$notIn':_0x15f17d[_0xa569('0x57')][_0xa569('0x7b')]};}_0x349748=[['priority','DESC'],['scheduledAt',_0x1ec7dc[0x0][_0xa569('0x82')]],db['sequelize'][_0xa569('0x80')](_0xa569('0x83')),['id',_0xa569('0x7d')]];}return db[_0xa569('0x4e')][_0xa569('0x84')]({'attributes':['id',_0xa569('0x85')],'where':_0x412c03,'order':_0x349748,'transaction':_0x2f8d94,'lock':_0x2f8d94[_0xa569('0x86')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa569('0x87'),'attributes':_0x219489,'include':[{'model':db['CmCompany'],'as':_0xa569('0x88'),'attributes':['id',_0xa569('0x29')]}]},{'model':db[_0xa569('0x89')],'as':_0xa569('0x8a'),'attributes':['id',_0xa569('0x29')]},{'model':db[_0xa569('0x5a')],'as':'Queue','attributes':['id','name',_0xa569('0x8b')]}]})[_0xa569('0x27')](function(_0x51dbd8){if(_0x51dbd8){return _0x51dbd8[_0xa569('0x26')]({'UserId':_0x15f17d[_0xa569('0x64')]['id']},{'transaction':_0x2f8d94});}});});}})[_0xa569('0x27')](handleEntityNotFound(_0x26f7fa,null))[_0xa569('0x27')](respondWithResult(_0x26f7fa,null))['catch'](handleError(_0x26f7fa,null));};exports[_0xa569('0x8c')]=function(_0x517804,_0x18b2c4,_0x278d93){return _0x517804['user'][_0xa569('0x73')]({'where':{'type':_0xa569('0x74'),'dialActive':!![],'dialMethod':_0xa569('0x75')},'attributes':['id'],'raw':!![]})[_0xa569('0x27')](function(_0x3a347c){if(_0x3a347c&&_0x3a347c[_0xa569('0x45')]){return db[_0xa569('0x4e')][_0xa569('0x22')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa569('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x3a347c,'id')},'$or':[{'UserId':null},{'UserId':_0x517804[_0xa569('0x64')]['id']}]}});}return 0x0;})[_0xa569('0x27')](function(_0x4a8c4c){if(!_[_0xa569('0x6f')](_0x4a8c4c)&&_[_0xa569('0x8d')](_0x4a8c4c)){return _0x18b2c4['status'](0xc8)[_0xa569('0x1e')]({'contacts':_0x4a8c4c});}else{logger['error'](_0xa569('0x8e'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x18b2c4[_0xa569('0x1b')](0x194);}})[_0xa569('0x52')](handleError(_0x18b2c4,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 294c47a..3f8dd9f 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 _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x31fc5c,_0x146ee8){var _0x37f43d=function(_0x10c9c1){while(--_0x10c9c1){_0x31fc5c['push'](_0x31fc5c['shift']());}};_0x37f43d(++_0x146ee8);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x15085d,_0x429781){_0x15085d=_0x15085d-0x0;var _0x2c8366=_0xc1c6[_0x15085d];return _0x2c8366;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9536,0x179));var _0x6953=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x9536[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['scheduledat']},{'name':_0x6953('0xe'),'fields':[_0x6953('0xe')]},{'name':_0x6953('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 25f2e2d..8cfa7dd 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 _0xcd3e=['limit','include','map','model','ShowCmHopper','find','catch','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','order','CmContact','Contact','User','name','voicePause','length','UserId','push','includes','all','MoveContactManagedDialer','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','LOCK','GetContactRecallMe','GetCmHopperPreview','keys','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','debug','stringify','error','message','GetCmHopper','CmHopper','findAll','options','raw','where','attributes'];(function(_0x5550e7,_0x295a48){var _0x25aa53=function(_0x309491){while(--_0x309491){_0x5550e7['push'](_0x5550e7['shift']());}};_0x25aa53(++_0x295a48);}(_0xcd3e,0x6f));var _0xecd3=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xcd3e[_0x1e9424];return _0x1bd96c;};'use strict';var _=require(_0xecd3('0x0'));var util=require(_0xecd3('0x1'));var moment=require(_0xecd3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecd3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xecd3('0x4'));var logger=require(_0xecd3('0x5'))(_0xecd3('0x6'));var config=require(_0xecd3('0x7'));var jayson=require(_0xecd3('0x8'));var client=jayson[_0xecd3('0x9')][_0xecd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff819,_0x477dfc,_0x4c3834){return new BPromise(function(_0x288fbf,_0xd40a04){return client['request'](_0x1ff819,_0x4c3834)[_0xecd3('0xb')](function(_0x417de4){logger[_0xecd3('0xc')](_0xecd3('0xd'),_0x477dfc,'request\x20sent');logger[_0xecd3('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x477dfc,'request\x20sent',JSON[_0xecd3('0xf')](_0x417de4));if(_0x417de4[_0xecd3('0x10')]){if(_0x417de4['error']['code']===0x1f4){logger[_0xecd3('0x10')](_0xecd3('0xd'),_0x477dfc,_0x417de4[_0xecd3('0x10')]['message']);return _0xd40a04(_0x417de4[_0xecd3('0x10')][_0xecd3('0x11')]);}logger[_0xecd3('0x10')](_0xecd3('0xd'),_0x477dfc,_0x417de4['error'][_0xecd3('0x11')]);return _0x288fbf(_0x417de4['error'][_0xecd3('0x11')]);}else{logger[_0xecd3('0xc')](_0xecd3('0xd'),_0x477dfc,'request\x20sent');_0x288fbf(_0x417de4['result'][_0xecd3('0x11')]);}})['catch'](function(_0x3b80bb){logger[_0xecd3('0x10')](_0xecd3('0xd'),_0x477dfc,_0x3b80bb);_0xd40a04(_0x3b80bb);});});}exports[_0xecd3('0x12')]=function(_0x59826e){var _0x4c515b=this;return new Promise(function(_0x49c6bf,_0x2efaa2){return db[_0xecd3('0x13')][_0xecd3('0x14')]({'raw':_0x59826e['options']?_0x59826e[_0xecd3('0x15')][_0xecd3('0x16')]===undefined?!![]:![]:!![],'where':_0x59826e[_0xecd3('0x15')]?_0x59826e[_0xecd3('0x15')][_0xecd3('0x17')]||null:null,'attributes':_0x59826e[_0xecd3('0x15')]?_0x59826e[_0xecd3('0x15')][_0xecd3('0x18')]||null:null,'limit':_0x59826e['options']?_0x59826e[_0xecd3('0x15')][_0xecd3('0x19')]||null:null,'include':_0x59826e[_0xecd3('0x15')]?_0x59826e[_0xecd3('0x15')][_0xecd3('0x1a')]?_[_0xecd3('0x1b')](_0x59826e['options']['include'],function(_0x316c66){return{'model':db[_0x316c66[_0xecd3('0x1c')]],'as':_0x316c66['as'],'attributes':_0x316c66[_0xecd3('0x18')],'include':_0x316c66[_0xecd3('0x1a')]?_[_0xecd3('0x1b')](_0x316c66[_0xecd3('0x1a')],function(_0x6e7d34){return{'model':db[_0x6e7d34['model']],'as':_0x6e7d34['as'],'attributes':_0x6e7d34[_0xecd3('0x18')],'include':_0x6e7d34[_0xecd3('0x1a')]?_['map'](_0x6e7d34[_0xecd3('0x1a')],function(_0x4f3a51){return{'model':db[_0x4f3a51[_0xecd3('0x1c')]],'as':_0x4f3a51['as'],'attributes':_0x4f3a51[_0xecd3('0x18')]};}):[]};}):[]};}):[]:[]})[_0xecd3('0xb')](function(_0xd1e08){logger['info'](_0xecd3('0x12'),_0x59826e);logger[_0xecd3('0xe')](_0xecd3('0x12'),_0x59826e,JSON['stringify'](_0xd1e08));_0x49c6bf(_0xd1e08);})['catch'](function(_0x5669a5){logger[_0xecd3('0x10')](_0xecd3('0x12'),_0x5669a5[_0xecd3('0x11')],_0x59826e);_0x2efaa2(_0x4c515b[_0xecd3('0x10')](0x1f4,_0x5669a5[_0xecd3('0x11')]));});});};exports[_0xecd3('0x1d')]=function(_0x2c3555){var _0x4c4442=this;return new Promise(function(_0x1a0c95,_0x56c644){return db[_0xecd3('0x13')][_0xecd3('0x1e')]({'raw':_0x2c3555[_0xecd3('0x15')]?_0x2c3555[_0xecd3('0x15')][_0xecd3('0x16')]===undefined?!![]:![]:!![],'where':_0x2c3555[_0xecd3('0x15')]?_0x2c3555[_0xecd3('0x15')][_0xecd3('0x17')]||null:null,'attributes':_0x2c3555[_0xecd3('0x15')]?_0x2c3555['options']['attributes']||null:null,'include':_0x2c3555[_0xecd3('0x15')]?_0x2c3555[_0xecd3('0x15')][_0xecd3('0x1a')]?_[_0xecd3('0x1b')](_0x2c3555['options'][_0xecd3('0x1a')],function(_0x28abd0){return{'model':db[_0x28abd0[_0xecd3('0x1c')]],'as':_0x28abd0['as'],'attributes':_0x28abd0[_0xecd3('0x18')],'include':_0x28abd0[_0xecd3('0x1a')]?_[_0xecd3('0x1b')](_0x28abd0['include'],function(_0x1d06d4){return{'model':db[_0x1d06d4[_0xecd3('0x1c')]],'as':_0x1d06d4['as'],'attributes':_0x1d06d4[_0xecd3('0x18')],'include':_0x1d06d4[_0xecd3('0x1a')]?_['map'](_0x1d06d4['include'],function(_0x291212){return{'model':db[_0x291212[_0xecd3('0x1c')]],'as':_0x291212['as'],'attributes':_0x291212[_0xecd3('0x18')]};}):[]};}):[]};}):[]:[]})[_0xecd3('0xb')](function(_0x58e78c){logger[_0xecd3('0xc')](_0xecd3('0x1d'),_0x2c3555);logger[_0xecd3('0xe')](_0xecd3('0x1d'),_0x2c3555,JSON[_0xecd3('0xf')](_0x58e78c));_0x1a0c95(_0x58e78c);})[_0xecd3('0x1f')](function(_0x4cbc01){logger[_0xecd3('0x10')](_0xecd3('0x1d'),_0x4cbc01[_0xecd3('0x11')],_0x2c3555);_0x56c644(_0x4c4442[_0xecd3('0x10')](0x1f4,_0x4cbc01[_0xecd3('0x11')]));});});};exports[_0xecd3('0x20')]=function(_0x36e9c0){var _0x1bd61e=this;return new Promise(function(_0x35bcd7,_0xd3aa47){return db['CmHopper'][_0xecd3('0x21')](_0x36e9c0[_0xecd3('0x22')],{'raw':_0x36e9c0[_0xecd3('0x15')]?_0x36e9c0[_0xecd3('0x15')][_0xecd3('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x13e3f6){logger[_0xecd3('0xc')]('CreateCmHopper',_0x36e9c0);logger['debug'](_0xecd3('0x20'),_0x36e9c0,JSON['stringify'](_0x13e3f6));_0x35bcd7(_0x13e3f6);})['catch'](function(_0x418633){logger[_0xecd3('0x10')](_0xecd3('0x20'),_0x418633[_0xecd3('0x11')],_0x36e9c0);_0xd3aa47(_0x1bd61e[_0xecd3('0x10')](0x1f4,_0x418633[_0xecd3('0x11')]));});});};exports[_0xecd3('0x23')]=function(_0x4f14a9){var _0x1a3c08=this;return new Promise(function(_0x36f5b0,_0x2326ca){return db['CmHopper'][_0xecd3('0x24')](_0x4f14a9[_0xecd3('0x22')],{'raw':_0x4f14a9['options']?_0x4f14a9[_0xecd3('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f14a9['options']?_0x4f14a9['options'][_0xecd3('0x17')]||null:null,'attributes':_0x4f14a9[_0xecd3('0x15')]?_0x4f14a9[_0xecd3('0x15')]['attributes']||null:null,'limit':_0x4f14a9[_0xecd3('0x15')]?_0x4f14a9[_0xecd3('0x15')][_0xecd3('0x19')]||null:null})[_0xecd3('0xb')](function(_0x4df274){logger['info'](_0xecd3('0x23'),_0x4f14a9);logger[_0xecd3('0xe')](_0xecd3('0x23'),_0x4f14a9,JSON['stringify'](_0x4df274));_0x36f5b0(_0x4df274);})['catch'](function(_0x262345){logger['error'](_0xecd3('0x23'),_0x262345[_0xecd3('0x11')],_0x4f14a9);_0x2326ca(_0x1a3c08['error'](0x1f4,_0x262345['message']));});});};exports[_0xecd3('0x25')]=function(_0x34ff4d){var _0x25e3a3=this;return new Promise(function(_0x330b58,_0x4caf4d){return db[_0xecd3('0x13')]['destroy']({'where':_0x34ff4d[_0xecd3('0x15')]?_0x34ff4d[_0xecd3('0x15')][_0xecd3('0x17')]||null:null})[_0xecd3('0xb')](function(_0x5c95ab){logger[_0xecd3('0xc')]('DestroyCmHopper',_0x34ff4d);logger[_0xecd3('0xe')](_0xecd3('0x25'),_0x34ff4d,JSON[_0xecd3('0xf')](_0x5c95ab));_0x330b58(_0x5c95ab);})[_0xecd3('0x1f')](function(_0x5794e6){logger[_0xecd3('0x10')](_0xecd3('0x25'),_0x5794e6[_0xecd3('0x11')],_0x34ff4d);_0x4caf4d(_0x25e3a3[_0xecd3('0x10')](0x1f4,_0x5794e6['message']));});});};exports[_0xecd3('0x26')]=function(_0x453d71){var _0x715a8c=this;return new Promise(function(_0xa1055f,_0x56d1df){return db['CmContact'][_0xecd3('0x27')]()[_0xecd3('0xb')](function(_0x5382c4){return db[_0xecd3('0x28')][_0xecd3('0x29')](function(_0x5f3e30){return db[_0xecd3('0x13')][_0xecd3('0x14')]({'where':_0x453d71[_0xecd3('0x15')]?_0x453d71['options'][_0xecd3('0x17')]||null:null,'attributes':_0x453d71[_0xecd3('0x15')]?_0x453d71[_0xecd3('0x15')][_0xecd3('0x18')]||null:null,'limit':_0x453d71[_0xecd3('0x15')]?_0x453d71[_0xecd3('0x15')][_0xecd3('0x19')]||null:null,'order':_0x453d71['options']?_0x453d71['options'][_0xecd3('0x2a')]||null:null,'transaction':_0x5f3e30,'lock':_0x5f3e30['LOCK']['UPDATE'],'include':[{'model':db[_0xecd3('0x2b')],'as':_0xecd3('0x2c'),'attributes':_['keys'](_0x5382c4)},{'model':db[_0xecd3('0x2d')],'as':'Agent','attributes':['id',_0xecd3('0x2e'),_0xecd3('0x2f')]}]})[_0xecd3('0xb')](function(_0x991179){var _0x4b2bc2=[];var _0x26095f=[];for(var _0x251881=0x0;_0x251881<_0x991179[_0xecd3('0x30')];_0x251881+=0x1){var _0x2f94cf=_0x991179[_0x251881][_0xecd3('0x31')];if(_0x2f94cf===null){_0x4b2bc2[_0xecd3('0x32')](_0x991179[_0x251881][_0xecd3('0x24')](_0x453d71[_0xecd3('0x22')],{'transaction':_0x5f3e30}));}else if(!_0x26095f[_0xecd3('0x33')](_0x2f94cf)){_0x26095f['push'](_0x2f94cf);_0x4b2bc2[_0xecd3('0x32')](_0x991179[_0x251881][_0xecd3('0x24')](_0x453d71[_0xecd3('0x22')],{'transaction':_0x5f3e30}));}}return BPromise[_0xecd3('0x34')](_0x4b2bc2);});})[_0xecd3('0xb')](function(_0x74787c){logger[_0xecd3('0xc')](_0xecd3('0x26'),_0x453d71);logger[_0xecd3('0xe')](_0xecd3('0x26'),_0x453d71,JSON[_0xecd3('0xf')](_0x74787c));_0xa1055f(_0x74787c);})[_0xecd3('0x1f')](function(_0x50d416){logger[_0xecd3('0x10')](_0xecd3('0x26'),_0x50d416[_0xecd3('0x11')],_0x453d71);_0x56d1df(_0x715a8c[_0xecd3('0x10')](0x1f4,_0x50d416['message']));});});});};exports[_0xecd3('0x35')]=function(_0x2925a8){var _0x158896=this;return new Promise(function(_0x199377,_0x228da8){return db[_0xecd3('0x28')][_0xecd3('0x29')](function(_0x37bd5b){return db['CmHopperFinal'][_0xecd3('0x21')](_0x2925a8[_0xecd3('0x22')],{'raw':_0x2925a8[_0xecd3('0x15')]?_0x2925a8['options'][_0xecd3('0x16')]===undefined?!![]:![]:!![],'transaction':_0x37bd5b})[_0xecd3('0xb')](function(){return db['CmHopper'][_0xecd3('0x36')]({'where':_0x2925a8[_0xecd3('0x15')]?_0x2925a8[_0xecd3('0x15')]['where']||null:null,'transaction':_0x37bd5b});});})['then'](function(_0x10f048){logger[_0xecd3('0xc')](_0xecd3('0x35'),_0x2925a8);logger[_0xecd3('0xe')](_0xecd3('0x35'),_0x2925a8,JSON[_0xecd3('0xf')](_0x10f048));_0x199377(_0x10f048);})[_0xecd3('0x1f')](function(_0x533ad9){logger['error'](_0xecd3('0x35'),_0x533ad9[_0xecd3('0x11')],_0x2925a8);_0x228da8(_0x158896[_0xecd3('0x10')](0x1f4,_0x533ad9[_0xecd3('0x11')]));});});};exports[_0xecd3('0x37')]=function(_0x4039a8){var _0x1b5bca=this;return new Promise(function(_0x3170bc,_0x24432b){return db[_0xecd3('0x13')]['findAll']({'raw':_0x4039a8[_0xecd3('0x15')]?_0x4039a8[_0xecd3('0x15')][_0xecd3('0x16')]===undefined?!![]:![]:!![],'where':_0x4039a8['options']?_0x4039a8['options'][_0xecd3('0x17')]||null:null,'attributes':[[db[_0xecd3('0x28')]['fn'](_0xecd3('0x38'),db[_0xecd3('0x28')]['fn']('IF',db[_0xecd3('0x28')][_0xecd3('0x39')](_0xecd3('0x3a')+util[_0xecd3('0x3b')](_0xecd3('0x3c'),moment()[_0xecd3('0x3b')](_0xecd3('0x3d')))+_0xecd3('0x3e')))),_0xecd3('0x3f')]]})[_0xecd3('0xb')](function(_0x370c72){logger[_0xecd3('0xc')]('CountReScheduled',_0x4039a8);logger[_0xecd3('0xe')]('CountReScheduled',_0x4039a8,JSON[_0xecd3('0xf')](_0x370c72));_0x3170bc(_0x370c72);})[_0xecd3('0x1f')](function(_0x2f6c3e){logger[_0xecd3('0x10')]('CountReScheduled',_0x2f6c3e[_0xecd3('0x11')],_0x4039a8);_0x24432b(_0x1b5bca[_0xecd3('0x10')](0x1f4,_0x2f6c3e[_0xecd3('0x11')]));});});};exports['GetContactRecallMe']=function(_0x2bc4ab){var _0x518397=this;return new Promise(function(_0x345ce8,_0x4d9870){return db['CmContact'][_0xecd3('0x27')]()[_0xecd3('0xb')](function(_0x9e650b){return db[_0xecd3('0x28')][_0xecd3('0x29')](function(_0x328a5a){return db[_0xecd3('0x13')][_0xecd3('0x14')]({'where':_0x2bc4ab[_0xecd3('0x15')]?_0x2bc4ab['options']['where']||null:null,'attributes':_0x2bc4ab['options']?_0x2bc4ab[_0xecd3('0x15')][_0xecd3('0x18')]||null:null,'limit':0x1,'order':_0x2bc4ab['options']?_0x2bc4ab['options'][_0xecd3('0x2a')]||null:null,'group':db[_0xecd3('0x13')][_0xecd3('0x31')],'transaction':_0x328a5a,'lock':_0x328a5a[_0xecd3('0x40')]['UPDATE'],'include':_0x2bc4ab[_0xecd3('0x15')]?_0x2bc4ab['options']['include']?_[_0xecd3('0x1b')](_0x2bc4ab[_0xecd3('0x15')]['include'],function(_0x49df6b){return{'model':db[_0x49df6b[_0xecd3('0x1c')]],'as':_0x49df6b['as'],'attributes':_0x49df6b[_0xecd3('0x18')],'include':_0x49df6b[_0xecd3('0x1a')]?_[_0xecd3('0x1b')](_0x49df6b['include'],function(_0x5cf46e){return{'model':db[_0x5cf46e[_0xecd3('0x1c')]],'as':_0x5cf46e['as'],'attributes':_0x5cf46e['attributes'],'include':_0x5cf46e[_0xecd3('0x1a')]?_['map'](_0x5cf46e['include'],function(_0xb6d1ac){return{'model':db[_0xb6d1ac[_0xecd3('0x1c')]],'as':_0xb6d1ac['as'],'attributes':_0xb6d1ac[_0xecd3('0x18')]};}):[]};}):[]};}):[]:[]})[_0xecd3('0xb')](function(_0x3ae024){var _0x530d04=[];for(var _0x358918=0x0;_0x358918<_0x3ae024['length'];_0x358918+=0x1){_0x530d04['push'](_0x3ae024[_0x358918][_0xecd3('0x24')](_0x2bc4ab[_0xecd3('0x22')],{'transaction':_0x328a5a}));}return BPromise[_0xecd3('0x34')](_0x530d04);});})['then'](function(_0xe7a6e8){logger['info']('GetContactRecallMe',_0x2bc4ab);logger[_0xecd3('0xe')](_0xecd3('0x41'),_0x2bc4ab,JSON[_0xecd3('0xf')](_0xe7a6e8));_0x345ce8(_0xe7a6e8);})['catch'](function(_0x53ccc7){logger[_0xecd3('0x10')]('GetContactRecallMe',_0x53ccc7[_0xecd3('0x11')],_0x2bc4ab);_0x4d9870(_0x518397['error'](0x1f4,_0x53ccc7[_0xecd3('0x11')]));});});});};exports[_0xecd3('0x42')]=function(_0x5efa31){var _0x2678ce=this;return new Promise(function(_0x312bce,_0x41099f){db[_0xecd3('0x2b')][_0xecd3('0x27')]()['then'](function(_0x250319){return db[_0xecd3('0x13')][_0xecd3('0x14')]({'raw':_0x5efa31[_0xecd3('0x15')]?_0x5efa31[_0xecd3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5efa31[_0xecd3('0x15')]?_0x5efa31['options'][_0xecd3('0x17')]||null:null,'attributes':_0x5efa31[_0xecd3('0x15')]?_0x5efa31[_0xecd3('0x15')]['attributes']||null:null,'limit':_0x5efa31[_0xecd3('0x15')]?_0x5efa31[_0xecd3('0x15')]['limit']||null:null,'include':_0x5efa31['options']?_0x5efa31[_0xecd3('0x15')]['include']?_[_0xecd3('0x1b')](_0x5efa31[_0xecd3('0x15')]['include'],function(_0x20335b){return{'model':db[_0x20335b[_0xecd3('0x1c')]],'as':_0x20335b['as'],'attributes':_0x20335b['as']===_0xecd3('0x2c')?_[_0xecd3('0x43')](_0x250319):_0x20335b[_0xecd3('0x18')],'include':_0x20335b[_0xecd3('0x1a')]?_[_0xecd3('0x1b')](_0x20335b[_0xecd3('0x1a')],function(_0x2a3933){return{'model':db[_0x2a3933[_0xecd3('0x1c')]],'as':_0x2a3933['as'],'attributes':_0x2a3933[_0xecd3('0x18')],'include':_0x2a3933['include']?_[_0xecd3('0x1b')](_0x2a3933[_0xecd3('0x1a')],function(_0x2c2d61){return{'model':db[_0x2c2d61[_0xecd3('0x1c')]],'as':_0x2c2d61['as'],'attributes':_0x2c2d61[_0xecd3('0x18')]};}):[]};}):[]};}):[]:[]})[_0xecd3('0xb')](function(_0x1fb15a){logger[_0xecd3('0xc')](_0xecd3('0x12'),_0x5efa31);logger[_0xecd3('0xe')](_0xecd3('0x12'),_0x5efa31,JSON['stringify'](_0x1fb15a));_0x312bce(_0x1fb15a);})[_0xecd3('0x1f')](function(_0x5d3bbd){logger[_0xecd3('0x10')]('GetCmHopper',_0x5d3bbd[_0xecd3('0x11')],_0x5efa31);_0x41099f(_0x2678ce[_0xecd3('0x10')](0x1f4,_0x5d3bbd[_0xecd3('0x11')]));});});});}; \ No newline at end of file +var _0x39bf=['CmHopper','findAll','options','where','limit','map','include','model','attributes','ShowCmHopper','find','body','raw','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','order','Contact','keys','User','Agent','name','includes','push','MoveContactManagedDialer','transaction','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','describe','UserId','LOCK','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetCmHopper'];(function(_0x53c4d4,_0x13b531){var _0x82443=function(_0x64b8af){while(--_0x64b8af){_0x53c4d4['push'](_0x53c4d4['shift']());}};_0x82443(++_0x13b531);}(_0x39bf,0x13f));var _0xf39b=function(_0x2a7497,_0x425bcb){_0x2a7497=_0x2a7497-0x0;var _0x46cf6d=_0x39bf[_0x2a7497];return _0x46cf6d;};'use strict';var _=require(_0xf39b('0x0'));var util=require(_0xf39b('0x1'));var moment=require(_0xf39b('0x2'));var BPromise=require(_0xf39b('0x3'));var rs=require(_0xf39b('0x4'));var fs=require('fs');var Redis=require(_0xf39b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf39b('0x6'));var logger=require(_0xf39b('0x7'))(_0xf39b('0x8'));var config=require(_0xf39b('0x9'));var jayson=require(_0xf39b('0xa'));var client=jayson[_0xf39b('0xb')][_0xf39b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41431f,_0x9e33d5,_0x201ad2){return new BPromise(function(_0x3109ec,_0x33136b){return client[_0xf39b('0xd')](_0x41431f,_0x201ad2)[_0xf39b('0xe')](function(_0x4cbcd0){logger['info'](_0xf39b('0xf'),_0x9e33d5,_0xf39b('0x10'));logger[_0xf39b('0x11')](_0xf39b('0x12'),_0x9e33d5,'request\x20sent',JSON[_0xf39b('0x13')](_0x4cbcd0));if(_0x4cbcd0[_0xf39b('0x14')]){if(_0x4cbcd0[_0xf39b('0x14')][_0xf39b('0x15')]===0x1f4){logger[_0xf39b('0x14')]('CmHopper,\x20%s,\x20%s',_0x9e33d5,_0x4cbcd0['error'][_0xf39b('0x16')]);return _0x33136b(_0x4cbcd0[_0xf39b('0x14')]['message']);}logger[_0xf39b('0x14')](_0xf39b('0xf'),_0x9e33d5,_0x4cbcd0['error'][_0xf39b('0x16')]);return _0x3109ec(_0x4cbcd0['error']['message']);}else{logger[_0xf39b('0x17')](_0xf39b('0xf'),_0x9e33d5,_0xf39b('0x10'));_0x3109ec(_0x4cbcd0['result']['message']);}})[_0xf39b('0x18')](function(_0x82f554){logger[_0xf39b('0x14')](_0xf39b('0xf'),_0x9e33d5,_0x82f554);_0x33136b(_0x82f554);});});}exports[_0xf39b('0x19')]=function(_0xe46f78){var _0x5cb0c8=this;return new Promise(function(_0x47a1ea,_0x53fa03){return db[_0xf39b('0x1a')][_0xf39b('0x1b')]({'raw':_0xe46f78[_0xf39b('0x1c')]?_0xe46f78['options']['raw']===undefined?!![]:![]:!![],'where':_0xe46f78['options']?_0xe46f78[_0xf39b('0x1c')][_0xf39b('0x1d')]||null:null,'attributes':_0xe46f78['options']?_0xe46f78[_0xf39b('0x1c')]['attributes']||null:null,'limit':_0xe46f78['options']?_0xe46f78[_0xf39b('0x1c')][_0xf39b('0x1e')]||null:null,'include':_0xe46f78['options']?_0xe46f78[_0xf39b('0x1c')]['include']?_[_0xf39b('0x1f')](_0xe46f78[_0xf39b('0x1c')][_0xf39b('0x20')],function(_0x7db2ef){return{'model':db[_0x7db2ef[_0xf39b('0x21')]],'as':_0x7db2ef['as'],'attributes':_0x7db2ef[_0xf39b('0x22')],'include':_0x7db2ef['include']?_['map'](_0x7db2ef['include'],function(_0x3faa57){return{'model':db[_0x3faa57[_0xf39b('0x21')]],'as':_0x3faa57['as'],'attributes':_0x3faa57[_0xf39b('0x22')],'include':_0x3faa57[_0xf39b('0x20')]?_[_0xf39b('0x1f')](_0x3faa57[_0xf39b('0x20')],function(_0x40a5d9){return{'model':db[_0x40a5d9[_0xf39b('0x21')]],'as':_0x40a5d9['as'],'attributes':_0x40a5d9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x486184){logger['info'](_0xf39b('0x19'),_0xe46f78);logger['debug'](_0xf39b('0x19'),_0xe46f78,JSON[_0xf39b('0x13')](_0x486184));_0x47a1ea(_0x486184);})[_0xf39b('0x18')](function(_0x4876ec){logger[_0xf39b('0x14')](_0xf39b('0x19'),_0x4876ec[_0xf39b('0x16')],_0xe46f78);_0x53fa03(_0x5cb0c8[_0xf39b('0x14')](0x1f4,_0x4876ec[_0xf39b('0x16')]));});});};exports[_0xf39b('0x23')]=function(_0x5155c7){var _0x185796=this;return new Promise(function(_0x188098,_0x1b76ef){return db['CmHopper'][_0xf39b('0x24')]({'raw':_0x5155c7[_0xf39b('0x1c')]?_0x5155c7[_0xf39b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5155c7['options']?_0x5155c7['options'][_0xf39b('0x1d')]||null:null,'attributes':_0x5155c7['options']?_0x5155c7[_0xf39b('0x1c')][_0xf39b('0x22')]||null:null,'include':_0x5155c7['options']?_0x5155c7[_0xf39b('0x1c')][_0xf39b('0x20')]?_[_0xf39b('0x1f')](_0x5155c7[_0xf39b('0x1c')]['include'],function(_0xba3eba){return{'model':db[_0xba3eba[_0xf39b('0x21')]],'as':_0xba3eba['as'],'attributes':_0xba3eba[_0xf39b('0x22')],'include':_0xba3eba[_0xf39b('0x20')]?_['map'](_0xba3eba[_0xf39b('0x20')],function(_0x10b336){return{'model':db[_0x10b336[_0xf39b('0x21')]],'as':_0x10b336['as'],'attributes':_0x10b336[_0xf39b('0x22')],'include':_0x10b336[_0xf39b('0x20')]?_[_0xf39b('0x1f')](_0x10b336['include'],function(_0x2b70a9){return{'model':db[_0x2b70a9[_0xf39b('0x21')]],'as':_0x2b70a9['as'],'attributes':_0x2b70a9['attributes']};}):[]};}):[]};}):[]:[]})[_0xf39b('0xe')](function(_0x585504){logger[_0xf39b('0x17')](_0xf39b('0x23'),_0x5155c7);logger[_0xf39b('0x11')]('ShowCmHopper',_0x5155c7,JSON[_0xf39b('0x13')](_0x585504));_0x188098(_0x585504);})[_0xf39b('0x18')](function(_0x134098){logger[_0xf39b('0x14')](_0xf39b('0x23'),_0x134098[_0xf39b('0x16')],_0x5155c7);_0x1b76ef(_0x185796[_0xf39b('0x14')](0x1f4,_0x134098[_0xf39b('0x16')]));});});};exports['CreateCmHopper']=function(_0x3ec8bd){var _0x44c7a5=this;return new Promise(function(_0x50bdc8,_0x25dc91){return db['CmHopper']['create'](_0x3ec8bd[_0xf39b('0x25')],{'raw':_0x3ec8bd[_0xf39b('0x1c')]?_0x3ec8bd[_0xf39b('0x1c')][_0xf39b('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x23a7c8){logger[_0xf39b('0x17')](_0xf39b('0x27'),_0x3ec8bd);logger['debug'](_0xf39b('0x27'),_0x3ec8bd,JSON[_0xf39b('0x13')](_0x23a7c8));_0x50bdc8(_0x23a7c8);})[_0xf39b('0x18')](function(_0x48e1ff){logger['error'](_0xf39b('0x27'),_0x48e1ff[_0xf39b('0x16')],_0x3ec8bd);_0x25dc91(_0x44c7a5[_0xf39b('0x14')](0x1f4,_0x48e1ff[_0xf39b('0x16')]));});});};exports[_0xf39b('0x28')]=function(_0x5462fb){var _0x5713c0=this;return new Promise(function(_0x1db352,_0x4e5dbb){return db['CmHopper'][_0xf39b('0x29')](_0x5462fb[_0xf39b('0x25')],{'raw':_0x5462fb['options']?_0x5462fb[_0xf39b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5462fb[_0xf39b('0x1c')]?_0x5462fb[_0xf39b('0x1c')][_0xf39b('0x1d')]||null:null,'attributes':_0x5462fb[_0xf39b('0x1c')]?_0x5462fb['options'][_0xf39b('0x22')]||null:null,'limit':_0x5462fb[_0xf39b('0x1c')]?_0x5462fb[_0xf39b('0x1c')][_0xf39b('0x1e')]||null:null})[_0xf39b('0xe')](function(_0x44226d){logger[_0xf39b('0x17')](_0xf39b('0x28'),_0x5462fb);logger[_0xf39b('0x11')]('UpdateCmHopper',_0x5462fb,JSON['stringify'](_0x44226d));_0x1db352(_0x44226d);})['catch'](function(_0xa569b6){logger[_0xf39b('0x14')](_0xf39b('0x28'),_0xa569b6[_0xf39b('0x16')],_0x5462fb);_0x4e5dbb(_0x5713c0[_0xf39b('0x14')](0x1f4,_0xa569b6[_0xf39b('0x16')]));});});};exports[_0xf39b('0x2a')]=function(_0x4b1d16){var _0x4a5755=this;return new Promise(function(_0x15e87d,_0x56fce7){return db[_0xf39b('0x1a')][_0xf39b('0x2b')]({'where':_0x4b1d16[_0xf39b('0x1c')]?_0x4b1d16[_0xf39b('0x1c')][_0xf39b('0x1d')]||null:null})[_0xf39b('0xe')](function(_0x8a44b0){logger[_0xf39b('0x17')](_0xf39b('0x2a'),_0x4b1d16);logger['debug'](_0xf39b('0x2a'),_0x4b1d16,JSON[_0xf39b('0x13')](_0x8a44b0));_0x15e87d(_0x8a44b0);})['catch'](function(_0x59be5f){logger['error']('DestroyCmHopper',_0x59be5f[_0xf39b('0x16')],_0x4b1d16);_0x56fce7(_0x4a5755[_0xf39b('0x14')](0x1f4,_0x59be5f['message']));});});};exports[_0xf39b('0x2c')]=function(_0x56e6fc){var _0x520dbc=this;return new Promise(function(_0x12fc2a,_0x161ca7){return db[_0xf39b('0x2d')]['describe']()['then'](function(_0x550221){return db[_0xf39b('0x2e')]['transaction'](function(_0xa3d52f){return db[_0xf39b('0x1a')][_0xf39b('0x1b')]({'where':_0x56e6fc[_0xf39b('0x1c')]?_0x56e6fc[_0xf39b('0x1c')]['where']||null:null,'attributes':_0x56e6fc[_0xf39b('0x1c')]?_0x56e6fc[_0xf39b('0x1c')][_0xf39b('0x22')]||null:null,'limit':_0x56e6fc[_0xf39b('0x1c')]?_0x56e6fc[_0xf39b('0x1c')]['limit']||null:null,'order':_0x56e6fc[_0xf39b('0x1c')]?_0x56e6fc[_0xf39b('0x1c')][_0xf39b('0x2f')]||null:null,'transaction':_0xa3d52f,'lock':_0xa3d52f['LOCK']['UPDATE'],'include':[{'model':db[_0xf39b('0x2d')],'as':_0xf39b('0x30'),'attributes':_[_0xf39b('0x31')](_0x550221)},{'model':db[_0xf39b('0x32')],'as':_0xf39b('0x33'),'attributes':['id',_0xf39b('0x34'),'voicePause']}]})[_0xf39b('0xe')](function(_0x13ae58){var _0x34b5ca=[];var _0x55877a=[];for(var _0x1b951b=0x0;_0x1b951b<_0x13ae58['length'];_0x1b951b+=0x1){var _0x214be5=_0x13ae58[_0x1b951b]['UserId'];if(_0x214be5===null){_0x34b5ca['push'](_0x13ae58[_0x1b951b][_0xf39b('0x29')](_0x56e6fc[_0xf39b('0x25')],{'transaction':_0xa3d52f}));}else if(!_0x55877a[_0xf39b('0x35')](_0x214be5)){_0x55877a[_0xf39b('0x36')](_0x214be5);_0x34b5ca[_0xf39b('0x36')](_0x13ae58[_0x1b951b][_0xf39b('0x29')](_0x56e6fc[_0xf39b('0x25')],{'transaction':_0xa3d52f}));}}return BPromise['all'](_0x34b5ca);});})['then'](function(_0x120f4a){logger['info'](_0xf39b('0x2c'),_0x56e6fc);logger[_0xf39b('0x11')]('GetContactDialer',_0x56e6fc,JSON[_0xf39b('0x13')](_0x120f4a));_0x12fc2a(_0x120f4a);})[_0xf39b('0x18')](function(_0x73d1c4){logger['error'](_0xf39b('0x2c'),_0x73d1c4[_0xf39b('0x16')],_0x56e6fc);_0x161ca7(_0x520dbc['error'](0x1f4,_0x73d1c4[_0xf39b('0x16')]));});});});};exports[_0xf39b('0x37')]=function(_0x53c881){var _0x2be589=this;return new Promise(function(_0x8cd772,_0x34e8ad){return db[_0xf39b('0x2e')][_0xf39b('0x38')](function(_0x22c4fa){return db['CmHopperFinal']['create'](_0x53c881['body'],{'raw':_0x53c881[_0xf39b('0x1c')]?_0x53c881['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x22c4fa})[_0xf39b('0xe')](function(){return db[_0xf39b('0x1a')][_0xf39b('0x2b')]({'where':_0x53c881[_0xf39b('0x1c')]?_0x53c881[_0xf39b('0x1c')]['where']||null:null,'transaction':_0x22c4fa});});})['then'](function(_0x31eb12){logger[_0xf39b('0x17')](_0xf39b('0x37'),_0x53c881);logger[_0xf39b('0x11')](_0xf39b('0x37'),_0x53c881,JSON[_0xf39b('0x13')](_0x31eb12));_0x8cd772(_0x31eb12);})[_0xf39b('0x18')](function(_0x3ef2c4){logger['error'](_0xf39b('0x37'),_0x3ef2c4[_0xf39b('0x16')],_0x53c881);_0x34e8ad(_0x2be589['error'](0x1f4,_0x3ef2c4[_0xf39b('0x16')]));});});};exports['CountReScheduled']=function(_0x4d82c3){var _0x33f67b=this;return new Promise(function(_0x4ca691,_0x22aef7){return db[_0xf39b('0x1a')]['findAll']({'raw':_0x4d82c3['options']?_0x4d82c3['options'][_0xf39b('0x26')]===undefined?!![]:![]:!![],'where':_0x4d82c3['options']?_0x4d82c3['options'][_0xf39b('0x1d')]||null:null,'attributes':[[db[_0xf39b('0x2e')]['fn'](_0xf39b('0x39'),db[_0xf39b('0x2e')]['fn']('IF',db[_0xf39b('0x2e')]['literal'](_0xf39b('0x3a')+util[_0xf39b('0x3b')](_0xf39b('0x3c'),moment()[_0xf39b('0x3b')](_0xf39b('0x3d')))+_0xf39b('0x3e')))),'contactsRescheduled']]})[_0xf39b('0xe')](function(_0x2a73a7){logger[_0xf39b('0x17')](_0xf39b('0x3f'),_0x4d82c3);logger[_0xf39b('0x11')](_0xf39b('0x3f'),_0x4d82c3,JSON[_0xf39b('0x13')](_0x2a73a7));_0x4ca691(_0x2a73a7);})[_0xf39b('0x18')](function(_0x3ba72f){logger[_0xf39b('0x14')](_0xf39b('0x3f'),_0x3ba72f[_0xf39b('0x16')],_0x4d82c3);_0x22aef7(_0x33f67b[_0xf39b('0x14')](0x1f4,_0x3ba72f[_0xf39b('0x16')]));});});};exports[_0xf39b('0x40')]=function(_0x1d3bad){var _0xce0deb=this;return new Promise(function(_0x4b6fa1,_0x215fec){return db[_0xf39b('0x2d')][_0xf39b('0x41')]()[_0xf39b('0xe')](function(_0xfd7ede){return db[_0xf39b('0x2e')][_0xf39b('0x38')](function(_0x80267c){return db['CmHopper']['findAll']({'where':_0x1d3bad['options']?_0x1d3bad['options'][_0xf39b('0x1d')]||null:null,'attributes':_0x1d3bad['options']?_0x1d3bad[_0xf39b('0x1c')][_0xf39b('0x22')]||null:null,'limit':0x1,'order':_0x1d3bad[_0xf39b('0x1c')]?_0x1d3bad[_0xf39b('0x1c')][_0xf39b('0x2f')]||null:null,'group':db['CmHopper'][_0xf39b('0x42')],'transaction':_0x80267c,'lock':_0x80267c[_0xf39b('0x43')]['UPDATE'],'include':_0x1d3bad['options']?_0x1d3bad[_0xf39b('0x1c')][_0xf39b('0x20')]?_[_0xf39b('0x1f')](_0x1d3bad[_0xf39b('0x1c')][_0xf39b('0x20')],function(_0x3ea547){return{'model':db[_0x3ea547['model']],'as':_0x3ea547['as'],'attributes':_0x3ea547['attributes'],'include':_0x3ea547[_0xf39b('0x20')]?_[_0xf39b('0x1f')](_0x3ea547[_0xf39b('0x20')],function(_0x371fb8){return{'model':db[_0x371fb8[_0xf39b('0x21')]],'as':_0x371fb8['as'],'attributes':_0x371fb8['attributes'],'include':_0x371fb8['include']?_[_0xf39b('0x1f')](_0x371fb8[_0xf39b('0x20')],function(_0x2681b0){return{'model':db[_0x2681b0['model']],'as':_0x2681b0['as'],'attributes':_0x2681b0[_0xf39b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf39b('0xe')](function(_0x25430c){var _0x4a3598=[];for(var _0xc0647a=0x0;_0xc0647a<_0x25430c['length'];_0xc0647a+=0x1){_0x4a3598[_0xf39b('0x36')](_0x25430c[_0xc0647a][_0xf39b('0x29')](_0x1d3bad[_0xf39b('0x25')],{'transaction':_0x80267c}));}return BPromise['all'](_0x4a3598);});})[_0xf39b('0xe')](function(_0x3bc573){logger['info'](_0xf39b('0x40'),_0x1d3bad);logger[_0xf39b('0x11')](_0xf39b('0x40'),_0x1d3bad,JSON[_0xf39b('0x13')](_0x3bc573));_0x4b6fa1(_0x3bc573);})[_0xf39b('0x18')](function(_0x407526){logger[_0xf39b('0x14')](_0xf39b('0x40'),_0x407526[_0xf39b('0x16')],_0x1d3bad);_0x215fec(_0xce0deb[_0xf39b('0x14')](0x1f4,_0x407526[_0xf39b('0x16')]));});});});};exports[_0xf39b('0x44')]=function(_0x25abdb){var _0x12bfce=this;return new Promise(function(_0x2a08fa,_0xddb7c6){db[_0xf39b('0x2d')][_0xf39b('0x41')]()[_0xf39b('0xe')](function(_0x263028){return db['CmHopper'][_0xf39b('0x1b')]({'raw':_0x25abdb[_0xf39b('0x1c')]?_0x25abdb[_0xf39b('0x1c')][_0xf39b('0x26')]===undefined?!![]:![]:!![],'where':_0x25abdb[_0xf39b('0x1c')]?_0x25abdb[_0xf39b('0x1c')][_0xf39b('0x1d')]||null:null,'attributes':_0x25abdb[_0xf39b('0x1c')]?_0x25abdb['options'][_0xf39b('0x22')]||null:null,'limit':_0x25abdb[_0xf39b('0x1c')]?_0x25abdb[_0xf39b('0x1c')]['limit']||null:null,'include':_0x25abdb[_0xf39b('0x1c')]?_0x25abdb[_0xf39b('0x1c')]['include']?_['map'](_0x25abdb['options']['include'],function(_0x5d8076){return{'model':db[_0x5d8076[_0xf39b('0x21')]],'as':_0x5d8076['as'],'attributes':_0x5d8076['as']==='Contact'?_['keys'](_0x263028):_0x5d8076[_0xf39b('0x22')],'include':_0x5d8076['include']?_[_0xf39b('0x1f')](_0x5d8076['include'],function(_0x1cb295){return{'model':db[_0x1cb295[_0xf39b('0x21')]],'as':_0x1cb295['as'],'attributes':_0x1cb295['attributes'],'include':_0x1cb295['include']?_[_0xf39b('0x1f')](_0x1cb295[_0xf39b('0x20')],function(_0x38063a){return{'model':db[_0x38063a[_0xf39b('0x21')]],'as':_0x38063a['as'],'attributes':_0x38063a[_0xf39b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24d876){logger[_0xf39b('0x17')](_0xf39b('0x19'),_0x25abdb);logger[_0xf39b('0x11')](_0xf39b('0x19'),_0x25abdb,JSON[_0xf39b('0x13')](_0x24d876));_0x2a08fa(_0x24d876);})[_0xf39b('0x18')](function(_0x48e71e){logger[_0xf39b('0x14')]('GetCmHopper',_0x48e71e[_0xf39b('0x16')],_0x25abdb);_0xddb7c6(_0x12bfce[_0xf39b('0x14')](0x1f4,_0x48e71e['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 8a1030e..4d8c786 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 _0x7a04=['/opencontacts','getOpenContacts','/:id','show','create','post','/preview','getPreview','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x5dbdcd,_0x55c3c7){var _0x45fb7f=function(_0x575141){while(--_0x575141){_0x5dbdcd['push'](_0x5dbdcd['shift']());}};_0x45fb7f(++_0x55c3c7);}(_0x7a04,0x1cc));var _0x47a0=function(_0x520bcf,_0x37e2d0){_0x520bcf=_0x520bcf-0x0;var _0x2cfc01=_0x7a04[_0x520bcf];return _0x2cfc01;};'use strict';var multer=require(_0x47a0('0x0'));var util=require(_0x47a0('0x1'));var path=require(_0x47a0('0x2'));var timeout=require(_0x47a0('0x3'));var express=require(_0x47a0('0x4'));var router=express[_0x47a0('0x5')]();var fs_extra=require(_0x47a0('0x6'));var auth=require(_0x47a0('0x7'));var interaction=require(_0x47a0('0x8'));var config=require(_0x47a0('0x9'));var controller=require('./cmHopper.controller');router[_0x47a0('0xa')]('/',auth[_0x47a0('0xb')](),controller[_0x47a0('0xc')]);router[_0x47a0('0xa')](_0x47a0('0xd'),auth['isAuthenticated'](),controller[_0x47a0('0xe')]);router[_0x47a0('0xa')](_0x47a0('0xf'),auth[_0x47a0('0xb')](),controller[_0x47a0('0x10')]);router[_0x47a0('0xa')](_0x47a0('0x11'),auth[_0x47a0('0xb')](),controller[_0x47a0('0x12')]);router['post']('/',auth[_0x47a0('0xb')](),controller[_0x47a0('0x13')]);router[_0x47a0('0x14')](_0x47a0('0x15'),auth[_0x47a0('0xb')](),controller[_0x47a0('0x16')]);router[_0x47a0('0x17')](_0x47a0('0x11'),auth[_0x47a0('0xb')](),controller['update']);router[_0x47a0('0x18')](_0x47a0('0x11'),auth[_0x47a0('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9f59=['show','post','/preview','getPreview','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getOpenContacts','/:id'];(function(_0x3772a4,_0x194faf){var _0x51fd75=function(_0x202f16){while(--_0x202f16){_0x3772a4['push'](_0x3772a4['shift']());}};_0x51fd75(++_0x194faf);}(_0x9f59,0x69));var _0x99f5=function(_0x5d607e,_0x21c2d1){_0x5d607e=_0x5d607e-0x0;var _0x9c5852=_0x9f59[_0x5d607e];return _0x9c5852;};'use strict';var multer=require('multer');var util=require(_0x99f5('0x0'));var path=require(_0x99f5('0x1'));var timeout=require(_0x99f5('0x2'));var express=require(_0x99f5('0x3'));var router=express[_0x99f5('0x4')]();var fs_extra=require(_0x99f5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x99f5('0x6'));var config=require(_0x99f5('0x7'));var controller=require('./cmHopper.controller');router[_0x99f5('0x8')]('/',auth[_0x99f5('0x9')](),controller[_0x99f5('0xa')]);router[_0x99f5('0x8')](_0x99f5('0xb'),auth[_0x99f5('0x9')](),controller[_0x99f5('0xc')]);router[_0x99f5('0x8')]('/opencontacts',auth['isAuthenticated'](),controller[_0x99f5('0xd')]);router[_0x99f5('0x8')](_0x99f5('0xe'),auth[_0x99f5('0x9')](),controller[_0x99f5('0xf')]);router['post']('/',auth[_0x99f5('0x9')](),controller['create']);router[_0x99f5('0x10')](_0x99f5('0x11'),auth['isAuthenticated'](),controller[_0x99f5('0x12')]);router[_0x99f5('0x13')](_0x99f5('0xe'),auth[_0x99f5('0x9')](),controller[_0x99f5('0x14')]);router[_0x99f5('0x15')](_0x99f5('0xe'),auth[_0x99f5('0x9')](),controller[_0x99f5('0x16')]);module[_0x99f5('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index cce2dd9..1ea4038 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 _0x7c09=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x18ace1,_0x57bde5){var _0x1ad194=function(_0x5bbac2){while(--_0x5bbac2){_0x18ace1['push'](_0x18ace1['shift']());}};_0x1ad194(++_0x57bde5);}(_0x7c09,0x102));var _0x97c0=function(_0x12756b,_0x58b2a7){_0x12756b=_0x12756b-0x0;var _0x46b949=_0x7c09[_0x12756b];return _0x46b949;};'use strict';var moment=require('moment');var Sequelize=require(_0x97c0('0x0'));module[_0x97c0('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x97c0('0x2')],'unique':_0x97c0('0x3')},'ListId':{'type':Sequelize[_0x97c0('0x2')],'unique':_0x97c0('0x3')},'VoiceQueueId':{'type':Sequelize[_0x97c0('0x2')],'unique':_0x97c0('0x3')}}; \ No newline at end of file +var _0x1f22=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x2ce226,_0x18ecc5){var _0x7e34b3=function(_0x2c4794){while(--_0x2c4794){_0x2ce226['push'](_0x2ce226['shift']());}};_0x7e34b3(++_0x18ecc5);}(_0x1f22,0x136));var _0x21f2=function(_0x44c508,_0x2bc708){_0x44c508=_0x44c508-0x0;var _0x10f167=_0x1f22[_0x44c508];return _0x10f167;};'use strict';var moment=require(_0x21f2('0x0'));var Sequelize=require(_0x21f2('0x1'));module[_0x21f2('0x2')]={'phone':{'type':Sequelize[_0x21f2('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x21f2('0x4')],'unique':_0x21f2('0x5')},'ListId':{'type':Sequelize[_0x21f2('0x4')],'unique':_0x21f2('0x5')},'VoiceQueueId':{'type':Sequelize[_0x21f2('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 79ff991..e436134 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 _0x9e4a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','keys','includeAll','find','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x50c4c1,_0x5a684b){var _0x193c1e=function(_0x3fbbac){while(--_0x3fbbac){_0x50c4c1['push'](_0x50c4c1['shift']());}};_0x193c1e(++_0x5a684b);}(_0x9e4a,0x124));var _0xa9e4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9e4a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xa9e4('0x0'));var rimraf=require(_0xa9e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9e4('0x2'));var rp=require(_0xa9e4('0x3'));var moment=require(_0xa9e4('0x4'));var BPromise=require(_0xa9e4('0x5'));var Mustache=require(_0xa9e4('0x6'));var util=require('util');var path=require(_0xa9e4('0x7'));var sox=require(_0xa9e4('0x8'));var csv=require(_0xa9e4('0x9'));var ejs=require(_0xa9e4('0xa'));var fs=require('fs');var fs_extra=require(_0xa9e4('0xb'));var _=require(_0xa9e4('0xc'));var squel=require(_0xa9e4('0xd'));var crypto=require(_0xa9e4('0xe'));var jsforce=require(_0xa9e4('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa9e4('0x10'));var Papa=require(_0xa9e4('0x11'));var Redis=require(_0xa9e4('0x12'));var authService=require(_0xa9e4('0x13'));var qs=require(_0xa9e4('0x14'));var as=require(_0xa9e4('0x15'));var hardwareService=require(_0xa9e4('0x16'));var logger=require('../../config/logger')(_0xa9e4('0x17'));var utils=require(_0xa9e4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa9e4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e2771,_0x30f643){_0x30f643=_0x30f643||0xcc;return function(_0x4d58ba){if(_0x4d58ba){return _0x4e2771[_0xa9e4('0x1a')](_0x30f643);}return _0x4e2771[_0xa9e4('0x1b')](_0x30f643)[_0xa9e4('0x1c')]();};}function respondWithResult(_0x25fb16,_0x28ce5f){_0x28ce5f=_0x28ce5f||0xc8;return function(_0x4f3030){if(_0x4f3030){return _0x25fb16[_0xa9e4('0x1b')](_0x28ce5f)[_0xa9e4('0x1d')](_0x4f3030);}};}function respondWithFilteredResult(_0x356ce1,_0x31d8b1){return function(_0x3918fa){if(_0x3918fa){var _0x156561=typeof _0x31d8b1[_0xa9e4('0x1e')]===_0xa9e4('0x1f')&&typeof _0x31d8b1['limit']===_0xa9e4('0x1f');var _0x198c12=_0x3918fa[_0xa9e4('0x20')];var _0x516700=_0x156561?0x0:_0x31d8b1[_0xa9e4('0x1e')];var _0x4c067b=_0x156561?_0x3918fa[_0xa9e4('0x20')]:_0x31d8b1[_0xa9e4('0x1e')]+_0x31d8b1[_0xa9e4('0x21')];var _0x2bd37f;if(_0x4c067b>=_0x198c12){_0x4c067b=_0x198c12;_0x2bd37f=0xc8;}else{_0x2bd37f=0xce;}_0x356ce1[_0xa9e4('0x1b')](_0x2bd37f);return _0x356ce1[_0xa9e4('0x22')](_0xa9e4('0x23'),_0x516700+'-'+_0x4c067b+'/'+_0x198c12)[_0xa9e4('0x1d')](_0x3918fa);}return null;};}function patchUpdates(_0x3aa05a){return function(_0x746bc){try{jsonpatch[_0xa9e4('0x24')](_0x746bc,_0x3aa05a,!![]);}catch(_0x1de027){return BPromise[_0xa9e4('0x25')](_0x1de027);}return _0x746bc[_0xa9e4('0x26')]();};}function saveUpdates(_0xb8dc64,_0x5ca69f){return function(_0x41484f){if(_0x41484f){return _0x41484f[_0xa9e4('0x27')](_0xb8dc64)[_0xa9e4('0x28')](function(_0x39db5e){return _0x39db5e;});}return null;};}function removeEntity(_0x29c1b5,_0x27044f){return function(_0x5ad897){if(_0x5ad897){return _0x5ad897[_0xa9e4('0x29')]()[_0xa9e4('0x28')](function(){_0x29c1b5[_0xa9e4('0x1b')](0xcc)[_0xa9e4('0x1c')]();});}};}function handleEntityNotFound(_0x10fbbe,_0x30216b){return function(_0x84bd94){if(!_0x84bd94){_0x10fbbe['sendStatus'](0x194);}return _0x84bd94;};}function handleError(_0x395527,_0xab04e){_0xab04e=_0xab04e||0x1f4;return function(_0x39384b){logger[_0xa9e4('0x2a')](_0x39384b[_0xa9e4('0x2b')]);if(_0x39384b[_0xa9e4('0x2c')]){delete _0x39384b['name'];}_0x395527[_0xa9e4('0x1b')](_0xab04e)[_0xa9e4('0x2d')](_0x39384b);};}exports[_0xa9e4('0x2e')]=function(_0x2dce70,_0x43e476){var _0x54a5ef={},_0x526b35={},_0x182d98={'count':0x0,'rows':[]};var _0x2785d9=_['map'](db[_0xa9e4('0x2f')][_0xa9e4('0x30')],function(_0x295ec4){return{'name':_0x295ec4[_0xa9e4('0x31')],'type':_0x295ec4[_0xa9e4('0x32')][_0xa9e4('0x33')]};});_0x526b35[_0xa9e4('0x34')]=_[_0xa9e4('0x35')](_0x2785d9,_0xa9e4('0x2c'));_0x526b35[_0xa9e4('0x36')]=_['keys'](_0x2dce70[_0xa9e4('0x36')]);_0x526b35[_0xa9e4('0x37')]=_[_0xa9e4('0x38')](_0x526b35[_0xa9e4('0x34')],_0x526b35[_0xa9e4('0x36')]);_0x54a5ef['attributes']=_['intersection'](_0x526b35[_0xa9e4('0x34')],qs[_0xa9e4('0x39')](_0x2dce70['query'][_0xa9e4('0x39')]));_0x54a5ef[_0xa9e4('0x3a')]=_0x54a5ef[_0xa9e4('0x3a')][_0xa9e4('0x3b')]?_0x54a5ef[_0xa9e4('0x3a')]:_0x526b35[_0xa9e4('0x34')];if(!_0x2dce70[_0xa9e4('0x36')][_0xa9e4('0x3c')](_0xa9e4('0x3d'))){_0x54a5ef[_0xa9e4('0x21')]=qs[_0xa9e4('0x21')](_0x2dce70['query'][_0xa9e4('0x21')]);_0x54a5ef[_0xa9e4('0x1e')]=qs['offset'](_0x2dce70[_0xa9e4('0x36')][_0xa9e4('0x1e')]);}_0x54a5ef[_0xa9e4('0x3e')]=qs[_0xa9e4('0x3f')](_0x2dce70[_0xa9e4('0x36')][_0xa9e4('0x3f')]);_0x54a5ef[_0xa9e4('0x40')]=qs[_0xa9e4('0x37')](_['pick'](_0x2dce70[_0xa9e4('0x36')],_0x526b35['filters']),_0x2785d9);if(_0x2dce70[_0xa9e4('0x36')][_0xa9e4('0x41')]){_0x54a5ef[_0xa9e4('0x40')]=_[_0xa9e4('0x42')](_0x54a5ef['where'],{'$or':_[_0xa9e4('0x35')](_0x2785d9,function(_0x564622){if(_0x564622['type']!==_0xa9e4('0x43')){var _0xe5561f={};_0xe5561f[_0x564622[_0xa9e4('0x2c')]]={'$like':'%'+_0x2dce70['query'][_0xa9e4('0x41')]+'%'};return _0xe5561f;}})});}_0x54a5ef=_[_0xa9e4('0x42')]({},_0x54a5ef,_0x2dce70[_0xa9e4('0x44')]);var _0x2cbf43={'where':_0x54a5ef[_0xa9e4('0x40')]};return db[_0xa9e4('0x2f')][_0xa9e4('0x20')](_0x2cbf43)[_0xa9e4('0x28')](function(_0x5c33f4){_0x182d98[_0xa9e4('0x20')]=_0x5c33f4;if(_0x2dce70[_0xa9e4('0x36')]['includeAll']){_0x54a5ef[_0xa9e4('0x45')]=[{'all':!![]}];}return db[_0xa9e4('0x2f')]['findAll'](_0x54a5ef);})['then'](function(_0x41d923){_0x182d98[_0xa9e4('0x46')]=_0x41d923;return _0x182d98;})[_0xa9e4('0x28')](respondWithFilteredResult(_0x43e476,_0x54a5ef))[_0xa9e4('0x47')](handleError(_0x43e476,null));};exports['show']=function(_0x53318f,_0x353125){var _0x2268b7={'raw':!![],'where':{'id':_0x53318f['params']['id']}},_0x59f3b4={};_0x59f3b4[_0xa9e4('0x34')]=_[_0xa9e4('0x48')](db[_0xa9e4('0x2f')][_0xa9e4('0x30')]);_0x59f3b4[_0xa9e4('0x36')]=_['keys'](_0x53318f['query']);_0x59f3b4[_0xa9e4('0x37')]=_['intersection'](_0x59f3b4['model'],_0x59f3b4[_0xa9e4('0x36')]);_0x2268b7[_0xa9e4('0x3a')]=_[_0xa9e4('0x38')](_0x59f3b4['model'],qs[_0xa9e4('0x39')](_0x53318f['query'][_0xa9e4('0x39')]));_0x2268b7[_0xa9e4('0x3a')]=_0x2268b7[_0xa9e4('0x3a')]['length']?_0x2268b7['attributes']:_0x59f3b4[_0xa9e4('0x34')];if(_0x53318f['query'][_0xa9e4('0x49')]){_0x2268b7[_0xa9e4('0x45')]=[{'all':!![]}];}_0x2268b7=_['merge']({},_0x2268b7,_0x53318f[_0xa9e4('0x44')]);return db['CmHopperBlack'][_0xa9e4('0x4a')](_0x2268b7)[_0xa9e4('0x28')](handleEntityNotFound(_0x353125,null))[_0xa9e4('0x28')](respondWithResult(_0x353125,null))[_0xa9e4('0x47')](handleError(_0x353125,null));};exports[_0xa9e4('0x27')]=function(_0x4066ab,_0x1074c6){if(_0x4066ab[_0xa9e4('0x4b')]['id']){delete _0x4066ab[_0xa9e4('0x4b')]['id'];}return db[_0xa9e4('0x2f')]['find']({'where':{'id':_0x4066ab[_0xa9e4('0x4c')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x1074c6,null))['then'](saveUpdates(_0x4066ab[_0xa9e4('0x4b')],null))[_0xa9e4('0x28')](respondWithResult(_0x1074c6,null))[_0xa9e4('0x47')](handleError(_0x1074c6,null));};exports[_0xa9e4('0x29')]=function(_0x10bb2a,_0x2de6aa){return db[_0xa9e4('0x2f')][_0xa9e4('0x4a')]({'where':{'id':_0x10bb2a['params']['id']}})['then'](handleEntityNotFound(_0x2de6aa,null))[_0xa9e4('0x28')](removeEntity(_0x2de6aa,null))[_0xa9e4('0x47')](handleError(_0x2de6aa,null));};exports[_0xa9e4('0x4d')]=function(_0x16128a,_0x4075ba){return db[_0xa9e4('0x2f')]['describe']()['then'](respondWithResult(_0x4075ba,null))[_0xa9e4('0x47')](handleError(_0x4075ba,null));}; \ No newline at end of file +var _0x7c7a=['order','sort','where','pick','filter','merge','type','options','include','findAll','catch','show','keys','rawAttributes','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','stack','name','index','map','CmHopperBlack','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xe7b356,_0x2054c0){var _0x1dcc59=function(_0x79c370){while(--_0x79c370){_0xe7b356['push'](_0xe7b356['shift']());}};_0x1dcc59(++_0x2054c0);}(_0x7c7a,0x1d4));var _0xa7c7=function(_0x550000,_0x21050c){_0x550000=_0x550000-0x0;var _0x43fa29=_0x7c7a[_0x550000];return _0x43fa29;};'use strict';var emlformat=require(_0xa7c7('0x0'));var rimraf=require(_0xa7c7('0x1'));var zipdir=require(_0xa7c7('0x2'));var jsonpatch=require(_0xa7c7('0x3'));var rp=require(_0xa7c7('0x4'));var moment=require(_0xa7c7('0x5'));var BPromise=require(_0xa7c7('0x6'));var Mustache=require(_0xa7c7('0x7'));var util=require(_0xa7c7('0x8'));var path=require('path');var sox=require(_0xa7c7('0x9'));var csv=require(_0xa7c7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa7c7('0xb'));var crypto=require(_0xa7c7('0xc'));var jsforce=require(_0xa7c7('0xd'));var deskjs=require(_0xa7c7('0xe'));var toCsv=require(_0xa7c7('0xa'));var querystring=require(_0xa7c7('0xf'));var Papa=require(_0xa7c7('0x10'));var Redis=require(_0xa7c7('0x11'));var authService=require(_0xa7c7('0x12'));var qs=require(_0xa7c7('0x13'));var as=require(_0xa7c7('0x14'));var hardwareService=require(_0xa7c7('0x15'));var logger=require(_0xa7c7('0x16'))(_0xa7c7('0x17'));var utils=require(_0xa7c7('0x18'));var config=require(_0xa7c7('0x19'));var licenseUtil=require(_0xa7c7('0x1a'));var db=require(_0xa7c7('0x1b'))['db'];function respondWithStatusCode(_0x3a2734,_0x19d009){_0x19d009=_0x19d009||0xcc;return function(_0x2a78de){if(_0x2a78de){return _0x3a2734[_0xa7c7('0x1c')](_0x19d009);}return _0x3a2734[_0xa7c7('0x1d')](_0x19d009)[_0xa7c7('0x1e')]();};}function respondWithResult(_0x5153b1,_0x10d3af){_0x10d3af=_0x10d3af||0xc8;return function(_0x357f26){if(_0x357f26){return _0x5153b1[_0xa7c7('0x1d')](_0x10d3af)['json'](_0x357f26);}};}function respondWithFilteredResult(_0x372804,_0x40cfbb){return function(_0x29cb3a){if(_0x29cb3a){var _0x40edba=typeof _0x40cfbb[_0xa7c7('0x1f')]==='undefined'&&typeof _0x40cfbb['limit']===_0xa7c7('0x20');var _0x4566c6=_0x29cb3a[_0xa7c7('0x21')];var _0x244e2d=_0x40edba?0x0:_0x40cfbb[_0xa7c7('0x1f')];var _0x5e21a4=_0x40edba?_0x29cb3a[_0xa7c7('0x21')]:_0x40cfbb[_0xa7c7('0x1f')]+_0x40cfbb[_0xa7c7('0x22')];var _0x4ac36a;if(_0x5e21a4>=_0x4566c6){_0x5e21a4=_0x4566c6;_0x4ac36a=0xc8;}else{_0x4ac36a=0xce;}_0x372804['status'](_0x4ac36a);return _0x372804['set'](_0xa7c7('0x23'),_0x244e2d+'-'+_0x5e21a4+'/'+_0x4566c6)['json'](_0x29cb3a);}return null;};}function patchUpdates(_0x224937){return function(_0x4f7a6e){try{jsonpatch[_0xa7c7('0x24')](_0x4f7a6e,_0x224937,!![]);}catch(_0x35fa9c){return BPromise['reject'](_0x35fa9c);}return _0x4f7a6e[_0xa7c7('0x25')]();};}function saveUpdates(_0xfde5ef,_0x3ab4bc){return function(_0x51a92a){if(_0x51a92a){return _0x51a92a[_0xa7c7('0x26')](_0xfde5ef)['then'](function(_0x23999f){return _0x23999f;});}return null;};}function removeEntity(_0xbb5243,_0xb925c6){return function(_0x2c906b){if(_0x2c906b){return _0x2c906b[_0xa7c7('0x27')]()[_0xa7c7('0x28')](function(){_0xbb5243[_0xa7c7('0x1d')](0xcc)[_0xa7c7('0x1e')]();});}};}function handleEntityNotFound(_0x2582e7,_0x4e79cb){return function(_0x2814ca){if(!_0x2814ca){_0x2582e7['sendStatus'](0x194);}return _0x2814ca;};}function handleError(_0x452f42,_0xbb86af){_0xbb86af=_0xbb86af||0x1f4;return function(_0x3634eb){logger['error'](_0x3634eb[_0xa7c7('0x29')]);if(_0x3634eb[_0xa7c7('0x2a')]){delete _0x3634eb['name'];}_0x452f42[_0xa7c7('0x1d')](_0xbb86af)['send'](_0x3634eb);};}exports[_0xa7c7('0x2b')]=function(_0x5f4df8,_0x3a6003){var _0x526d2f={},_0x44efc9={},_0x2cc831={'count':0x0,'rows':[]};var _0x23b66a=_[_0xa7c7('0x2c')](db[_0xa7c7('0x2d')]['rawAttributes'],function(_0x491487){return{'name':_0x491487[_0xa7c7('0x2e')],'type':_0x491487['type'][_0xa7c7('0x2f')]};});_0x44efc9[_0xa7c7('0x30')]=_[_0xa7c7('0x2c')](_0x23b66a,_0xa7c7('0x2a'));_0x44efc9[_0xa7c7('0x31')]=_['keys'](_0x5f4df8['query']);_0x44efc9[_0xa7c7('0x32')]=_[_0xa7c7('0x33')](_0x44efc9['model'],_0x44efc9[_0xa7c7('0x31')]);_0x526d2f[_0xa7c7('0x34')]=_[_0xa7c7('0x33')](_0x44efc9[_0xa7c7('0x30')],qs[_0xa7c7('0x35')](_0x5f4df8[_0xa7c7('0x31')][_0xa7c7('0x35')]));_0x526d2f['attributes']=_0x526d2f[_0xa7c7('0x34')][_0xa7c7('0x36')]?_0x526d2f[_0xa7c7('0x34')]:_0x44efc9[_0xa7c7('0x30')];if(!_0x5f4df8[_0xa7c7('0x31')][_0xa7c7('0x37')](_0xa7c7('0x38'))){_0x526d2f[_0xa7c7('0x22')]=qs['limit'](_0x5f4df8[_0xa7c7('0x31')][_0xa7c7('0x22')]);_0x526d2f[_0xa7c7('0x1f')]=qs[_0xa7c7('0x1f')](_0x5f4df8[_0xa7c7('0x31')][_0xa7c7('0x1f')]);}_0x526d2f[_0xa7c7('0x39')]=qs[_0xa7c7('0x3a')](_0x5f4df8[_0xa7c7('0x31')][_0xa7c7('0x3a')]);_0x526d2f[_0xa7c7('0x3b')]=qs[_0xa7c7('0x32')](_[_0xa7c7('0x3c')](_0x5f4df8['query'],_0x44efc9['filters']),_0x23b66a);if(_0x5f4df8['query'][_0xa7c7('0x3d')]){_0x526d2f[_0xa7c7('0x3b')]=_[_0xa7c7('0x3e')](_0x526d2f[_0xa7c7('0x3b')],{'$or':_['map'](_0x23b66a,function(_0x40e9c){if(_0x40e9c[_0xa7c7('0x3f')]!=='VIRTUAL'){var _0x12f974={};_0x12f974[_0x40e9c['name']]={'$like':'%'+_0x5f4df8[_0xa7c7('0x31')]['filter']+'%'};return _0x12f974;}})});}_0x526d2f=_[_0xa7c7('0x3e')]({},_0x526d2f,_0x5f4df8[_0xa7c7('0x40')]);var _0x39ad6d={'where':_0x526d2f[_0xa7c7('0x3b')]};return db['CmHopperBlack'][_0xa7c7('0x21')](_0x39ad6d)[_0xa7c7('0x28')](function(_0x31678b){_0x2cc831[_0xa7c7('0x21')]=_0x31678b;if(_0x5f4df8[_0xa7c7('0x31')]['includeAll']){_0x526d2f[_0xa7c7('0x41')]=[{'all':!![]}];}return db[_0xa7c7('0x2d')][_0xa7c7('0x42')](_0x526d2f);})[_0xa7c7('0x28')](function(_0x3c4c26){_0x2cc831['rows']=_0x3c4c26;return _0x2cc831;})[_0xa7c7('0x28')](respondWithFilteredResult(_0x3a6003,_0x526d2f))[_0xa7c7('0x43')](handleError(_0x3a6003,null));};exports[_0xa7c7('0x44')]=function(_0x1c760a,_0x26c43d){var _0x2868ff={'raw':!![],'where':{'id':_0x1c760a['params']['id']}},_0x46d2e6={};_0x46d2e6['model']=_[_0xa7c7('0x45')](db['CmHopperBlack'][_0xa7c7('0x46')]);_0x46d2e6[_0xa7c7('0x31')]=_[_0xa7c7('0x45')](_0x1c760a[_0xa7c7('0x31')]);_0x46d2e6[_0xa7c7('0x32')]=_[_0xa7c7('0x33')](_0x46d2e6[_0xa7c7('0x30')],_0x46d2e6[_0xa7c7('0x31')]);_0x2868ff[_0xa7c7('0x34')]=_[_0xa7c7('0x33')](_0x46d2e6['model'],qs[_0xa7c7('0x35')](_0x1c760a['query'][_0xa7c7('0x35')]));_0x2868ff[_0xa7c7('0x34')]=_0x2868ff[_0xa7c7('0x34')][_0xa7c7('0x36')]?_0x2868ff[_0xa7c7('0x34')]:_0x46d2e6['model'];if(_0x1c760a['query']['includeAll']){_0x2868ff[_0xa7c7('0x41')]=[{'all':!![]}];}_0x2868ff=_[_0xa7c7('0x3e')]({},_0x2868ff,_0x1c760a[_0xa7c7('0x40')]);return db[_0xa7c7('0x2d')][_0xa7c7('0x47')](_0x2868ff)[_0xa7c7('0x28')](handleEntityNotFound(_0x26c43d,null))['then'](respondWithResult(_0x26c43d,null))[_0xa7c7('0x43')](handleError(_0x26c43d,null));};exports[_0xa7c7('0x26')]=function(_0x3d6d5b,_0x541105){if(_0x3d6d5b[_0xa7c7('0x48')]['id']){delete _0x3d6d5b[_0xa7c7('0x48')]['id'];}return db[_0xa7c7('0x2d')][_0xa7c7('0x47')]({'where':{'id':_0x3d6d5b['params']['id']}})['then'](handleEntityNotFound(_0x541105,null))[_0xa7c7('0x28')](saveUpdates(_0x3d6d5b[_0xa7c7('0x48')],null))[_0xa7c7('0x28')](respondWithResult(_0x541105,null))[_0xa7c7('0x43')](handleError(_0x541105,null));};exports[_0xa7c7('0x27')]=function(_0x48d739,_0x4736aa){return db['CmHopperBlack'][_0xa7c7('0x47')]({'where':{'id':_0x48d739[_0xa7c7('0x49')]['id']}})['then'](handleEntityNotFound(_0x4736aa,null))['then'](removeEntity(_0x4736aa,null))[_0xa7c7('0x43')](handleError(_0x4736aa,null));};exports[_0xa7c7('0x4a')]=function(_0xd220f8,_0x507c96){return db[_0xa7c7('0x2d')][_0xa7c7('0x4a')]()[_0xa7c7('0x28')](respondWithResult(_0x507c96,null))[_0xa7c7('0x43')](handleError(_0x507c96,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f459a08..42b8e1d 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 _0xa269=['path','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x56dc8a,_0x1d40d0){var _0x1fe94a=function(_0x1e20cd){while(--_0x1e20cd){_0x56dc8a['push'](_0x56dc8a['shift']());}};_0x1fe94a(++_0x1d40d0);}(_0xa269,0x73));var _0x9a26=function(_0x5d7791,_0x439bb7){_0x5d7791=_0x5d7791-0x0;var _0x198304=_0xa269[_0x5d7791];return _0x198304;};'use strict';var _=require(_0x9a26('0x0'));var util=require('util');var logger=require(_0x9a26('0x1'))(_0x9a26('0x2'));var moment=require(_0x9a26('0x3'));var BPromise=require(_0x9a26('0x4'));var rp=require(_0x9a26('0x5'));var fs=require('fs');var path=require(_0x9a26('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9a26('0x7'));module[_0x9a26('0x8')]=function(_0x4b43d2,_0x241161){return _0x4b43d2[_0x9a26('0x9')](_0x9a26('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb5=['CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define'];(function(_0xbb4d87,_0x2b5f49){var _0x250d61=function(_0x4a3bd6){while(--_0x4a3bd6){_0xbb4d87['push'](_0xbb4d87['shift']());}};_0x250d61(++_0x2b5f49);}(_0xbbb5,0x92));var _0x5bbb=function(_0xb98dca,_0x4621b5){_0xb98dca=_0xb98dca-0x0;var _0xc3f08d=_0xbbb5[_0xb98dca];return _0xc3f08d;};'use strict';var _=require(_0x5bbb('0x0'));var util=require(_0x5bbb('0x1'));var logger=require(_0x5bbb('0x2'))('api');var moment=require(_0x5bbb('0x3'));var BPromise=require('bluebird');var rp=require(_0x5bbb('0x4'));var fs=require('fs');var path=require(_0x5bbb('0x5'));var rimraf=require(_0x5bbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x5bbb('0x7'));module[_0x5bbb('0x8')]=function(_0x33ae04,_0x17c7d3){return _0x33ae04[_0x5bbb('0x9')](_0x5bbb('0xa'),attributes,{'tableName':_0x5bbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index d434f53..63d1655 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 _0xa2b2=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','map','include','model','catch','UpdateCmHopperBlack','update','body','debug','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x1ea4e3,_0x57ad7e){var _0x51030d=function(_0x423390){while(--_0x423390){_0x1ea4e3['push'](_0x1ea4e3['shift']());}};_0x51030d(++_0x57ad7e);}(_0xa2b2,0xe1));var _0x2a2b=function(_0x200c9a,_0x1d3c0a){_0x200c9a=_0x200c9a-0x0;var _0x1f3a03=_0xa2b2[_0x200c9a];return _0x1f3a03;};'use strict';var _=require(_0x2a2b('0x0'));var util=require(_0x2a2b('0x1'));var moment=require(_0x2a2b('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a2b('0x3'));var fs=require('fs');var Redis=require(_0x2a2b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a2b('0x5'));var logger=require(_0x2a2b('0x6'))(_0x2a2b('0x7'));var config=require(_0x2a2b('0x8'));var jayson=require(_0x2a2b('0x9'));var client=jayson[_0x2a2b('0xa')][_0x2a2b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34713b,_0xbe57c2,_0x17e27f){return new BPromise(function(_0x4ac2a3,_0x4216f0){return client['request'](_0x34713b,_0x17e27f)[_0x2a2b('0xc')](function(_0x3b6f83){logger['info'](_0x2a2b('0xd'),_0xbe57c2,_0x2a2b('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xbe57c2,_0x2a2b('0xe'),JSON[_0x2a2b('0xf')](_0x3b6f83));if(_0x3b6f83[_0x2a2b('0x10')]){if(_0x3b6f83['error']['code']===0x1f4){logger[_0x2a2b('0x10')](_0x2a2b('0xd'),_0xbe57c2,_0x3b6f83['error'][_0x2a2b('0x11')]);return _0x4216f0(_0x3b6f83['error'][_0x2a2b('0x11')]);}logger[_0x2a2b('0x10')](_0x2a2b('0xd'),_0xbe57c2,_0x3b6f83[_0x2a2b('0x10')]['message']);return _0x4ac2a3(_0x3b6f83[_0x2a2b('0x10')][_0x2a2b('0x11')]);}else{logger[_0x2a2b('0x12')](_0x2a2b('0xd'),_0xbe57c2,_0x2a2b('0xe'));_0x4ac2a3(_0x3b6f83[_0x2a2b('0x13')][_0x2a2b('0x11')]);}})['catch'](function(_0x584f06){logger[_0x2a2b('0x10')](_0x2a2b('0xd'),_0xbe57c2,_0x584f06);_0x4216f0(_0x584f06);});});}exports[_0x2a2b('0x14')]=function(_0x6068c0){var _0x1fc38e=this;return new Promise(function(_0x5df45a,_0x526ee4){return db[_0x2a2b('0x15')][_0x2a2b('0x16')]({'raw':_0x6068c0[_0x2a2b('0x17')]?_0x6068c0[_0x2a2b('0x17')][_0x2a2b('0x18')]===undefined?!![]:![]:!![],'where':_0x6068c0[_0x2a2b('0x17')]?_0x6068c0[_0x2a2b('0x17')][_0x2a2b('0x19')]||null:null,'attributes':_0x6068c0[_0x2a2b('0x17')]?_0x6068c0[_0x2a2b('0x17')][_0x2a2b('0x1a')]||null:null,'limit':_0x6068c0[_0x2a2b('0x17')]?_0x6068c0[_0x2a2b('0x17')][_0x2a2b('0x1b')]||null:null,'include':_0x6068c0['options']?_0x6068c0[_0x2a2b('0x17')]['include']?_[_0x2a2b('0x1c')](_0x6068c0[_0x2a2b('0x17')][_0x2a2b('0x1d')],function(_0x256cb4){return{'model':db[_0x256cb4[_0x2a2b('0x1e')]],'as':_0x256cb4['as'],'attributes':_0x256cb4[_0x2a2b('0x1a')],'include':_0x256cb4[_0x2a2b('0x1d')]?_[_0x2a2b('0x1c')](_0x256cb4[_0x2a2b('0x1d')],function(_0x3a1e2b){return{'model':db[_0x3a1e2b[_0x2a2b('0x1e')]],'as':_0x3a1e2b['as'],'attributes':_0x3a1e2b[_0x2a2b('0x1a')],'include':_0x3a1e2b['include']?_[_0x2a2b('0x1c')](_0x3a1e2b[_0x2a2b('0x1d')],function(_0x49e3e2){return{'model':db[_0x49e3e2[_0x2a2b('0x1e')]],'as':_0x49e3e2['as'],'attributes':_0x49e3e2[_0x2a2b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2a2b('0xc')](function(_0x1b7442){logger[_0x2a2b('0x12')]('GetCmHopperBlack',_0x6068c0);logger['debug'](_0x2a2b('0x14'),_0x6068c0,JSON[_0x2a2b('0xf')](_0x1b7442));_0x5df45a(_0x1b7442);})[_0x2a2b('0x1f')](function(_0x34de74){logger[_0x2a2b('0x10')](_0x2a2b('0x14'),_0x34de74[_0x2a2b('0x11')],_0x6068c0);_0x526ee4(_0x1fc38e['error'](0x1f4,_0x34de74['message']));});});};exports[_0x2a2b('0x20')]=function(_0x1a5dcd){var _0x50a44e=this;return new Promise(function(_0x4c37c0,_0x1bc158){return db['CmHopperBlack'][_0x2a2b('0x21')](_0x1a5dcd[_0x2a2b('0x22')],{'raw':_0x1a5dcd['options']?_0x1a5dcd['options'][_0x2a2b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a5dcd['options']?_0x1a5dcd[_0x2a2b('0x17')][_0x2a2b('0x19')]||null:null,'attributes':_0x1a5dcd[_0x2a2b('0x17')]?_0x1a5dcd[_0x2a2b('0x17')][_0x2a2b('0x1a')]||null:null,'limit':_0x1a5dcd[_0x2a2b('0x17')]?_0x1a5dcd[_0x2a2b('0x17')]['limit']||null:null})[_0x2a2b('0xc')](function(_0x196e3f){logger[_0x2a2b('0x12')](_0x2a2b('0x20'),_0x1a5dcd);logger[_0x2a2b('0x23')](_0x2a2b('0x20'),_0x1a5dcd,JSON[_0x2a2b('0xf')](_0x196e3f));_0x4c37c0(_0x196e3f);})[_0x2a2b('0x1f')](function(_0x3771ae){logger['error'](_0x2a2b('0x20'),_0x3771ae[_0x2a2b('0x11')],_0x1a5dcd);_0x1bc158(_0x50a44e[_0x2a2b('0x10')](0x1f4,_0x3771ae[_0x2a2b('0x11')]));});});};exports[_0x2a2b('0x24')]=function(_0x55a6f6){var _0x1fcbe4=this;return new Promise(function(_0x4c9f3b,_0x275b94){return db['CmHopperBlack'][_0x2a2b('0x25')]({'where':_0x55a6f6[_0x2a2b('0x17')]?_0x55a6f6['options']['where']||null:null})['then'](function(_0x1e3df8){logger['info']('DestroyCmHopperBlack',_0x55a6f6);logger[_0x2a2b('0x23')]('DestroyCmHopperBlack',_0x55a6f6,JSON[_0x2a2b('0xf')](_0x1e3df8));_0x4c9f3b(_0x1e3df8);})[_0x2a2b('0x1f')](function(_0x589119){logger[_0x2a2b('0x10')](_0x2a2b('0x24'),_0x589119[_0x2a2b('0x11')],_0x55a6f6);_0x275b94(_0x1fcbe4[_0x2a2b('0x10')](0x1f4,_0x589119[_0x2a2b('0x11')]));});});}; \ No newline at end of file +var _0xba71=['options','raw','where','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','body','stringify','DestroyCmHopperBlack','CmHopperBlack','destroy','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetCmHopperBlack'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0xba71,0x15c));var _0x1ba7=function(_0x5dcce2,_0x420f67){_0x5dcce2=_0x5dcce2-0x0;var _0x3744c6=_0xba71[_0x5dcce2];return _0x3744c6;};'use strict';var _=require('lodash');var util=require(_0x1ba7('0x0'));var moment=require(_0x1ba7('0x1'));var BPromise=require(_0x1ba7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ba7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ba7('0x4'));var logger=require(_0x1ba7('0x5'))(_0x1ba7('0x6'));var config=require('../../config/environment');var jayson=require(_0x1ba7('0x7'));var client=jayson[_0x1ba7('0x8')][_0x1ba7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x402348,_0x2799e5,_0x4bb049){return new BPromise(function(_0x58a1b1,_0x34d3c1){return client[_0x1ba7('0xa')](_0x402348,_0x4bb049)[_0x1ba7('0xb')](function(_0x27f5ca){logger['info'](_0x1ba7('0xc'),_0x2799e5,_0x1ba7('0xd'));logger['debug'](_0x1ba7('0xe'),_0x2799e5,'request\x20sent',JSON['stringify'](_0x27f5ca));if(_0x27f5ca[_0x1ba7('0xf')]){if(_0x27f5ca['error'][_0x1ba7('0x10')]===0x1f4){logger[_0x1ba7('0xf')](_0x1ba7('0xc'),_0x2799e5,_0x27f5ca[_0x1ba7('0xf')][_0x1ba7('0x11')]);return _0x34d3c1(_0x27f5ca[_0x1ba7('0xf')][_0x1ba7('0x11')]);}logger[_0x1ba7('0xf')](_0x1ba7('0xc'),_0x2799e5,_0x27f5ca['error'][_0x1ba7('0x11')]);return _0x58a1b1(_0x27f5ca[_0x1ba7('0xf')][_0x1ba7('0x11')]);}else{logger[_0x1ba7('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2799e5,'request\x20sent');_0x58a1b1(_0x27f5ca[_0x1ba7('0x13')][_0x1ba7('0x11')]);}})[_0x1ba7('0x14')](function(_0x3a5280){logger[_0x1ba7('0xf')](_0x1ba7('0xc'),_0x2799e5,_0x3a5280);_0x34d3c1(_0x3a5280);});});}exports[_0x1ba7('0x15')]=function(_0x42a3d3){var _0x1f6e22=this;return new Promise(function(_0x2e378c,_0x4f9157){return db['CmHopperBlack']['findAll']({'raw':_0x42a3d3['options']?_0x42a3d3[_0x1ba7('0x16')][_0x1ba7('0x17')]===undefined?!![]:![]:!![],'where':_0x42a3d3[_0x1ba7('0x16')]?_0x42a3d3[_0x1ba7('0x16')][_0x1ba7('0x18')]||null:null,'attributes':_0x42a3d3[_0x1ba7('0x16')]?_0x42a3d3['options'][_0x1ba7('0x19')]||null:null,'limit':_0x42a3d3[_0x1ba7('0x16')]?_0x42a3d3[_0x1ba7('0x16')][_0x1ba7('0x1a')]||null:null,'include':_0x42a3d3['options']?_0x42a3d3[_0x1ba7('0x16')][_0x1ba7('0x1b')]?_['map'](_0x42a3d3[_0x1ba7('0x16')][_0x1ba7('0x1b')],function(_0x360b2a){return{'model':db[_0x360b2a['model']],'as':_0x360b2a['as'],'attributes':_0x360b2a['attributes'],'include':_0x360b2a[_0x1ba7('0x1b')]?_[_0x1ba7('0x1c')](_0x360b2a[_0x1ba7('0x1b')],function(_0x314ffe){return{'model':db[_0x314ffe[_0x1ba7('0x1d')]],'as':_0x314ffe['as'],'attributes':_0x314ffe[_0x1ba7('0x19')],'include':_0x314ffe['include']?_[_0x1ba7('0x1c')](_0x314ffe[_0x1ba7('0x1b')],function(_0x7a5265){return{'model':db[_0x7a5265[_0x1ba7('0x1d')]],'as':_0x7a5265['as'],'attributes':_0x7a5265[_0x1ba7('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9fa86a){logger['info']('GetCmHopperBlack',_0x42a3d3);logger[_0x1ba7('0x1e')]('GetCmHopperBlack',_0x42a3d3,JSON['stringify'](_0x9fa86a));_0x2e378c(_0x9fa86a);})['catch'](function(_0x44c688){logger['error'](_0x1ba7('0x15'),_0x44c688[_0x1ba7('0x11')],_0x42a3d3);_0x4f9157(_0x1f6e22['error'](0x1f4,_0x44c688['message']));});});};exports[_0x1ba7('0x1f')]=function(_0x33693e){var _0x4bbcef=this;return new Promise(function(_0xf55404,_0x3b4a52){return db['CmHopperBlack']['update'](_0x33693e[_0x1ba7('0x20')],{'raw':_0x33693e[_0x1ba7('0x16')]?_0x33693e[_0x1ba7('0x16')][_0x1ba7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33693e[_0x1ba7('0x16')]?_0x33693e[_0x1ba7('0x16')][_0x1ba7('0x18')]||null:null,'attributes':_0x33693e[_0x1ba7('0x16')]?_0x33693e[_0x1ba7('0x16')][_0x1ba7('0x19')]||null:null,'limit':_0x33693e['options']?_0x33693e[_0x1ba7('0x16')][_0x1ba7('0x1a')]||null:null})[_0x1ba7('0xb')](function(_0x494751){logger[_0x1ba7('0x12')](_0x1ba7('0x1f'),_0x33693e);logger[_0x1ba7('0x1e')](_0x1ba7('0x1f'),_0x33693e,JSON[_0x1ba7('0x21')](_0x494751));_0xf55404(_0x494751);})[_0x1ba7('0x14')](function(_0x5db2fb){logger['error'](_0x1ba7('0x1f'),_0x5db2fb[_0x1ba7('0x11')],_0x33693e);_0x3b4a52(_0x4bbcef['error'](0x1f4,_0x5db2fb['message']));});});};exports[_0x1ba7('0x22')]=function(_0x2e7081){var _0x5836c5=this;return new Promise(function(_0x4722e2,_0x52571a){return db[_0x1ba7('0x23')][_0x1ba7('0x24')]({'where':_0x2e7081[_0x1ba7('0x16')]?_0x2e7081[_0x1ba7('0x16')][_0x1ba7('0x18')]||null:null})[_0x1ba7('0xb')](function(_0xfb0b6d){logger[_0x1ba7('0x12')]('DestroyCmHopperBlack',_0x2e7081);logger['debug']('DestroyCmHopperBlack',_0x2e7081,JSON['stringify'](_0xfb0b6d));_0x4722e2(_0xfb0b6d);})[_0x1ba7('0x14')](function(_0x4541c6){logger[_0x1ba7('0xf')](_0x1ba7('0x22'),_0x4541c6[_0x1ba7('0x11')],_0x2e7081);_0x52571a(_0x5836c5[_0x1ba7('0xf')](0x1f4,_0x4541c6[_0x1ba7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 56e3b52..2f072f8 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 _0x4bd3=['put','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x4bd3,0x174));var _0x34bd=function(_0x24692b,_0x24e6f3){_0x24692b=_0x24692b-0x0;var _0x3ce3bf=_0x4bd3[_0x24692b];return _0x3ce3bf;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34bd('0x3'));var interaction=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var controller=require('./cmHopperBlack.controller');router[_0x34bd('0x6')]('/',auth[_0x34bd('0x7')](),controller['index']);router[_0x34bd('0x6')](_0x34bd('0x8'),auth['isAuthenticated'](),controller[_0x34bd('0x9')]);router[_0x34bd('0x6')](_0x34bd('0xa'),auth[_0x34bd('0x7')](),controller[_0x34bd('0xb')]);router[_0x34bd('0xc')]('/:id',auth[_0x34bd('0x7')](),controller[_0x34bd('0xd')]);router[_0x34bd('0xe')](_0x34bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x34bd('0xf')]=router; \ No newline at end of file +var _0xed1c=['describe','/:id','show','put','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x3afc5a,_0x46f71a){var _0x1a8a60=function(_0x3cfb55){while(--_0x3cfb55){_0x3afc5a['push'](_0x3afc5a['shift']());}};_0x1a8a60(++_0x46f71a);}(_0xed1c,0xe4));var _0xced1=function(_0x551acc,_0x2e7f27){_0x551acc=_0x551acc-0x0;var _0x8219cc=_0xed1c[_0x551acc];return _0x8219cc;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/:id',auth[_0xced1('0x7')](),controller['update']);router[_0xced1('0xe')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 335bdad..240ef74 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 _0x9232=['BOOLEAN','sequelize','moment','exports','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat'];(function(_0x1eb14d,_0x406ddc){var _0x23b10f=function(_0x1b50cf){while(--_0x1b50cf){_0x1eb14d['push'](_0x1eb14d['shift']());}};_0x23b10f(++_0x406ddc);}(_0x9232,0x1d5));var _0x2923=function(_0x45ab48,_0x13c0ea){_0x45ab48=_0x45ab48-0x0;var _0x263fb6=_0x9232[_0x45ab48];return _0x263fb6;};'use strict';var Sequelize=require(_0x2923('0x0'));var moment=require(_0x2923('0x1'));module[_0x2923('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2923('0x3')]},'countbusyretry':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2923('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2923('0x5')]},'starttime':{'type':Sequelize[_0x2923('0x3')]},'responsetime':{'type':Sequelize[_0x2923('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x2923('0x3')]},'endtime':{'type':Sequelize[_0x2923('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2923('0x5')]},'campaigntype':{'type':Sequelize[_0x2923('0x5')]},'membername':{'type':Sequelize[_0x2923('0x5')]},'reason':{'type':Sequelize[_0x2923('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2923('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2923('0x5')]},'dispositionat':{'type':Sequelize[_0x2923('0x3')],'set':function(_0x26adf6){var _0xdcf984=this[_0x2923('0x6')](_0x2923('0x7'));if(_0xdcf984&&_0x26adf6){this[_0x2923('0x8')](_0x2923('0x9'),moment(_0x26adf6)[_0x2923('0xa')](moment(_0xdcf984),'seconds'));}return this[_0x2923('0x8')](_0x2923('0xb'),_0x26adf6);}},'amd':{'type':Sequelize[_0x2923('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2923('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2923('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x2923('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2923('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2923('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2923('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2923('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2923('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d0f=['sequelize','moment','exports','INTEGER','STRING','DATE','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9d0f,0x104));var _0xf9d0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9d0f[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xf9d0('0x0'));var moment=require(_0xf9d0('0x1'));module[_0xf9d0('0x2')]={'state':{'type':Sequelize[_0xf9d0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xf9d0('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf9d0('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xf9d0('0x4')]},'originatecalleridname':{'type':Sequelize[_0xf9d0('0x4')]},'calleridnum':{'type':Sequelize[_0xf9d0('0x4')]},'calleridname':{'type':Sequelize[_0xf9d0('0x4')]},'starttime':{'type':Sequelize[_0xf9d0('0x5')]},'responsetime':{'type':Sequelize[_0xf9d0('0x5')]},'answertime':{'type':Sequelize[_0xf9d0('0x5')]},'droptime':{'type':Sequelize[_0xf9d0('0x5')]},'endtime':{'type':Sequelize[_0xf9d0('0x5')]},'ringtime':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf9d0('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf9d0('0x4')]},'membername':{'type':Sequelize[_0xf9d0('0x4')]},'reason':{'type':Sequelize[_0xf9d0('0x4')]},'disposition':{'type':Sequelize[_0xf9d0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0xc305bf){var _0x476442=this['getDataValue'](_0xf9d0('0x6'));if(_0x476442&&_0xc305bf){this[_0xf9d0('0x7')](_0xf9d0('0x8'),moment(_0xc305bf)[_0xf9d0('0x9')](moment(_0x476442),_0xf9d0('0xa')));}return this[_0xf9d0('0x7')](_0xf9d0('0xb'),_0xc305bf);}},'amd':{'type':Sequelize[_0xf9d0('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf9d0('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf9d0('0x5')]},'callback':{'type':Sequelize[_0xf9d0('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf9d0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf9d0('0x5')]},'deleted':{'type':Sequelize[_0xf9d0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf9d0('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf9d0('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index e686b6e..a4800ce 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 _0x7c09=['sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4e638d,_0x5e0443){var _0xd6eb9f=function(_0x52a6a1){while(--_0x52a6a1){_0x4e638d['push'](_0x4e638d['shift']());}};_0xd6eb9f(++_0x5e0443);}(_0x7c09,0x102));var _0x97c0=function(_0x1cbb79,_0x24d40c){_0x1cbb79=_0x1cbb79-0x0;var _0x38be48=_0x7c09[_0x1cbb79];return _0x38be48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['CmHopperFinal'][_0x97c0('0x48')]()[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,null))[_0x97c0('0x43')](handleError(_0x4ff0a5,null));};exports['update']=function(_0x3e09d5,_0xac56ac){if(_0x3e09d5[_0x97c0('0x49')][_0x97c0('0x4a')]){delete _0x3e09d5[_0x97c0('0x49')]['uniqueid'];}return db[_0x97c0('0x2b')][_0x97c0('0x47')]({'where':{'uniqueid':_0x3e09d5[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xac56ac,null))['then'](saveUpdates(_0x3e09d5[_0x97c0('0x49')],null))['then'](respondWithResult(_0xac56ac,null))['catch'](handleError(_0xac56ac,null));};exports[_0x97c0('0x4b')]=function(_0x20e2a5,_0x23c7ad,_0x53a255){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x20e2a5[_0x97c0('0x45')]['id']},'attributes':[[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x4f')))),'noSuchContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x50')))),'noAnswerContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x53')))),_0x97c0('0x54')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x55')))),_0x97c0('0x56')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x59')))),'reCallContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x97c0('0x5a')]]})[_0x97c0('0x24')](handleEntityNotFound(_0x23c7ad,null))[_0x97c0('0x24')](respondWithResult(_0x23c7ad,null))[_0x97c0('0x43')](handleError(_0x23c7ad,null));};exports[_0x97c0('0x5b')]=function(_0x2bb5d3,_0x52643e,_0x3349df){return db[_0x97c0('0x2b')][_0x97c0('0x41')]({'raw':![],'where':{'CampaignId':_0x2bb5d3[_0x97c0('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x200,\x201,\x20null'))),_0x97c0('0x5c')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x50')))),_0x97c0('0x5d')],[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x97c0('0x54')],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x55')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x59')))),_0x97c0('0x5e')],[db[_0x97c0('0x4c')]['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x5f')))),_0x97c0('0x5a')]]})['then'](handleEntityNotFound(_0x52643e,null))[_0x97c0('0x24')](respondWithResult(_0x52643e,null))[_0x97c0('0x43')](handleError(_0x52643e,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4116c9,_0x30ffa8,_0x1cfe22){return db['VoiceQueue'][_0x97c0('0x47')]({'where':{'id':_0x4116c9[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x30ffa8,null))[_0x97c0('0x24')](function(_0x4d40cd){var _0x4ee6a2;if(_0x4d40cd){_0x4ee6a2=squel['insert']()[_0x97c0('0x60')](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),_0x97c0('0x66'),_0x97c0('0x67'),'createdAt','updatedAt'],squel[_0x97c0('0x68')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x64'))[_0x97c0('0x69')](_0x97c0('0x6b'),'ContactId')['field'](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x6d'),'VoiceQueueId')[_0x97c0('0x69')]('NOW()',_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x74'),_0x4116c9['body']['state'][_0x97c0('0x73')]())[_0x97c0('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x97c0('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x97c0('0x68')]()[_0x97c0('0x69')]('phone')[_0x97c0('0x70')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]()))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9['params']['id'][_0x97c0('0x73')]())['where']('state\x20=\x204'))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')]['query'](_0x4ee6a2);}return[];})[_0x97c0('0x24')](respondWithResult(_0x30ffa8,null))[_0x97c0('0x43')](handleError(_0x30ffa8,null));};exports[_0x97c0('0x78')]=function(_0x5bb9de,_0x388ba1,_0x550a68){return db[_0x97c0('0x79')][_0x97c0('0x47')]({'where':{'id':_0x5bb9de[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x388ba1,null))[_0x97c0('0x24')](function(_0x44f6bc){var _0x37cdb3;if(_0x44f6bc){_0x37cdb3=squel[_0x97c0('0x7a')]()['into'](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),'ListId',_0x97c0('0x7b'),_0x97c0('0x6e'),'updatedAt'],squel['select']()[_0x97c0('0x69')](_0x97c0('0x7c'),_0x97c0('0x63'))['field']('NOW()',_0x97c0('0x64'))['field'](_0x97c0('0x6b'),_0x97c0('0x65'))[_0x97c0('0x69')](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x7d'),'CampaignId')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x74'),_0x5bb9de['body'][_0x97c0('0x7f')][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x80'))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x63'))[_0x97c0('0x70')](_0x97c0('0x61'))[_0x97c0('0x39')]('CampaignId\x20=\x20?',_0x5bb9de[_0x97c0('0x45')]['id']['toString']()))[_0x97c0('0x39')](_0x97c0('0x75'),squel[_0x97c0('0x68')]()['field'](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de['params']['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x81')))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')][_0x97c0('0x2f')](_0x37cdb3);}return[];})[_0x97c0('0x24')](respondWithResult(_0x388ba1,null))[_0x97c0('0x43')](handleError(_0x388ba1,null));};exports[_0x97c0('0x82')]=function(_0x3ebd11,_0x44b374,_0x493e62){return db[_0x97c0('0x83')][_0x97c0('0x84')]({'where':{'VoiceQueueId':_0x3ebd11[_0x97c0('0x49')]['VoiceQueueId'],'CampaignId':_0x3ebd11['body'][_0x97c0('0x7b')],'ContactId':_0x3ebd11[_0x97c0('0x49')][_0x97c0('0x65')]}})[_0x97c0('0x24')](handleEntityNotFound(_0x44b374,null))[_0x97c0('0x24')](function(_0x120d78){if(_0x120d78){return _0x120d78;}return null;})[_0x97c0('0x24')](respondWithResult(_0x44b374,null))[_0x97c0('0x43')](handleError(_0x44b374,null));}; \ No newline at end of file +var _0x5fab=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','describe','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','Campaign','insert','CampaignId','createdAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x174b6a,_0x4b67a3){var _0x43a659=function(_0x2959e9){while(--_0x2959e9){_0x174b6a['push'](_0x174b6a['shift']());}};_0x43a659(++_0x4b67a3);}(_0x5fab,0x177));var _0xb5fa=function(_0x123df5,_0x5a535b){_0x123df5=_0x123df5-0x0;var _0x115fc5=_0x5fab[_0x123df5];return _0x115fc5;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['CmHopperFinal'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':!![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')]()[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x42a359,_0x3a39f2){if(_0x42a359['body']['uniqueid']){delete _0x42a359[_0xb5fa('0x4d')]['uniqueid'];}return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')]({'where':{'uniqueid':_0x42a359['params']['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x3a39f2,null))[_0xb5fa('0x43')](saveUpdates(_0x42a359[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x3a39f2,null))[_0xb5fa('0x4b')](handleError(_0x3a39f2,null));};exports[_0xb5fa('0x4e')]=function(_0x51d5f7,_0x27a651,_0x4fd5bf){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x51d5f7[_0xb5fa('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x58')))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5a')))),'dropContacts'],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),_0xb5fa('0x5f')]]})[_0xb5fa('0x43')](handleEntityNotFound(_0x27a651,null))[_0xb5fa('0x43')](respondWithResult(_0x27a651,null))[_0xb5fa('0x4b')](handleError(_0x27a651,null));};exports[_0xb5fa('0x60')]=function(_0x18cde9,_0x40d7d5,_0xd2ba4e){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'CampaignId':_0x18cde9[_0xb5fa('0x46')]['id']},'attributes':[[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db['sequelize']['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x208,\x201,\x20null'))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb5fa('0x61')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x62')))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),'answeringMachine']]})[_0xb5fa('0x43')](handleEntityNotFound(_0x40d7d5,null))[_0xb5fa('0x43')](respondWithResult(_0x40d7d5,null))[_0xb5fa('0x4b')](handleError(_0x40d7d5,null));};exports[_0xb5fa('0x63')]=function(_0x339dfb,_0x56e6b0,_0x1585cd){return db['VoiceQueue'][_0xb5fa('0x4a')]({'where':{'id':_0x339dfb[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x56e6b0,null))[_0xb5fa('0x43')](function(_0x5e44d8){var _0x4d1117;if(_0x5e44d8){_0x4d1117=squel['insert']()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')]([_0xb5fa('0x67'),_0xb5fa('0x68'),_0xb5fa('0x69'),'ListId',_0xb5fa('0x6a'),'createdAt','updatedAt'],squel[_0xb5fa('0x6b')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))['field'](_0xb5fa('0x70'),_0xb5fa('0x6a'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'createdAt')[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x72'))[_0xb5fa('0x73')](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb['params']['id'][_0xb5fa('0x76')]())['where'](_0xb5fa('0x77'),_0x339dfb[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))['from'](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb[_0xb5fa('0x46')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')](_0xb5fa('0x74'))['where']('VoiceQueueId\x20=\x20?',_0x339dfb[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db[_0xb5fa('0x50')]['query'](_0x4d1117);}return[];})[_0xb5fa('0x43')](respondWithResult(_0x56e6b0,null))[_0xb5fa('0x4b')](handleError(_0x56e6b0,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5e6852,_0x391412,_0x3150ac){return db[_0xb5fa('0x7d')][_0xb5fa('0x4a')]({'where':{'id':_0x5e6852[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x391412,null))[_0xb5fa('0x43')](function(_0x25b278){var _0x1a0255;if(_0x25b278){_0x1a0255=squel[_0xb5fa('0x7e')]()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')](['phone','scheduledAt',_0xb5fa('0x69'),'ListId',_0xb5fa('0x7f'),_0xb5fa('0x80'),'updatedAt'],squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')]('ANY_VALUE(calleridnum)',_0xb5fa('0x67'))[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))[_0xb5fa('0x6c')](_0xb5fa('0x81'),_0xb5fa('0x7f'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x80'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'updatedAt')['from'](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x77'),_0x5e6852[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))[_0xb5fa('0x73')](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]()))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')]('cm_hopper_final')[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db['sequelize'][_0xb5fa('0x33')](_0x1a0255);}return[];})['then'](respondWithResult(_0x391412,null))['catch'](handleError(_0x391412,null));};exports[_0xb5fa('0x83')]=function(_0x27dbe8,_0x2faf23,_0x4d607d){return db[_0xb5fa('0x84')][_0xb5fa('0x85')]({'where':{'VoiceQueueId':_0x27dbe8[_0xb5fa('0x4d')]['VoiceQueueId'],'CampaignId':_0x27dbe8[_0xb5fa('0x4d')][_0xb5fa('0x7f')],'ContactId':_0x27dbe8['body'][_0xb5fa('0x69')]}})[_0xb5fa('0x43')](handleEntityNotFound(_0x2faf23,null))[_0xb5fa('0x43')](function(_0xf15d5c){if(_0xf15d5c){return _0xf15d5c;}return null;})[_0xb5fa('0x43')](respondWithResult(_0x2faf23,null))[_0xb5fa('0x4b')](handleError(_0x2faf23,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 60de825..e1a56fc 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 _0x56c5=['define','CmHopperFinal','calleridnum','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x50b4b6,_0x4931fd){var _0x2d50b4=function(_0x104ca7){while(--_0x104ca7){_0x50b4b6['push'](_0x50b4b6['shift']());}};_0x2d50b4(++_0x4931fd);}(_0x56c5,0x90));var _0x556c=function(_0x454556,_0xdf6d69){_0x454556=_0x454556-0x0;var _0x3e8a7c=_0x56c5[_0x454556];return _0x3e8a7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x556c('0x0'))(_0x556c('0x1'));var moment=require(_0x556c('0x2'));var BPromise=require(_0x556c('0x3'));var rp=require(_0x556c('0x4'));var fs=require('fs');var path=require(_0x556c('0x5'));var rimraf=require(_0x556c('0x6'));var config=require(_0x556c('0x7'));var attributes=require(_0x556c('0x8'));module[_0x556c('0x9')]=function(_0x5d1d9a,_0x303e73){return _0x5d1d9a[_0x556c('0xa')](_0x556c('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x556c('0xc'),'fields':[_0x556c('0xc')]},{'name':_0x556c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5125=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api'];(function(_0xe5f9e6,_0x3bd6c6){var _0x3699aa=function(_0x22f29b){while(--_0x22f29b){_0xe5f9e6['push'](_0xe5f9e6['shift']());}};_0x3699aa(++_0x3bd6c6);}(_0x5125,0x15b));var _0x5512=function(_0x16b543,_0x489c8c){_0x16b543=_0x16b543-0x0;var _0x2b058c=_0x5125[_0x16b543];return _0x2b058c;};'use strict';var _=require(_0x5512('0x0'));var util=require(_0x5512('0x1'));var logger=require('../../config/logger')(_0x5512('0x2'));var moment=require(_0x5512('0x3'));var BPromise=require(_0x5512('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5512('0x5'));var rimraf=require(_0x5512('0x6'));var config=require(_0x5512('0x7'));var attributes=require(_0x5512('0x8'));module['exports']=function(_0x106aa2,_0xff0ca6){return _0x106aa2[_0x5512('0x9')](_0x5512('0xa'),attributes,{'tableName':_0x5512('0xb'),'paranoid':![],'indexes':[{'name':_0x5512('0xc'),'fields':[_0x5512('0xc')]},{'name':_0x5512('0xd'),'fields':[_0x5512('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0086929..21f85f2 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x1158a5,_0x1e1703){var _0x50a397=function(_0x25a925){while(--_0x25a925){_0x1158a5['push'](_0x1158a5['shift']());}};_0x50a397(++_0x1e1703);}(_0xb10b,0x12a));var _0xbb10=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xb10b[_0x903228];return _0xcec81d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5eec26,_0x66763d){var _0x43855e=function(_0x178fd8){while(--_0x178fd8){_0x5eec26['push'](_0x5eec26['shift']());}};_0x43855e(++_0x66763d);}(_0xb10b,0x12a));var _0xbb10=function(_0x768458,_0x3d0933){_0x768458=_0x768458-0x0;var _0x31385c=_0xb10b[_0x768458];return _0x31385c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 94f5134..b76b404 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 _0x627d=['countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','/:id','show','/voice/queue/countAttributes/:id','isAuthenticated','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x513adc,_0x28370f){var _0x1f0d25=function(_0x14f00a){while(--_0x14f00a){_0x513adc['push'](_0x513adc['shift']());}};_0x1f0d25(++_0x28370f);}(_0x627d,0xc6));var _0xd627=function(_0x190be4,_0x4a52df){_0x190be4=_0x190be4-0x0;var _0x1e35f8=_0x627d[_0x190be4];return _0x1e35f8;};'use strict';var multer=require('multer');var util=require(_0xd627('0x0'));var path=require(_0xd627('0x1'));var timeout=require('connect-timeout');var express=require(_0xd627('0x2'));var router=express[_0xd627('0x3')]();var fs_extra=require(_0xd627('0x4'));var auth=require(_0xd627('0x5'));var interaction=require(_0xd627('0x6'));var config=require(_0xd627('0x7'));var controller=require(_0xd627('0x8'));router[_0xd627('0x9')]('/',auth['isAuthenticated'](),controller[_0xd627('0xa')]);router[_0xd627('0x9')](_0xd627('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd627('0x9')](_0xd627('0xc'),auth['isAuthenticated'](),controller[_0xd627('0xd')]);router[_0xd627('0x9')](_0xd627('0xe'),auth[_0xd627('0xf')](),controller[_0xd627('0x10')]);router[_0xd627('0x9')](_0xd627('0x11'),auth[_0xd627('0xf')](),controller[_0xd627('0x12')]);router[_0xd627('0x13')]('/voice/queue/moveContacts/:id',auth[_0xd627('0xf')](),controller[_0xd627('0x14')]);router[_0xd627('0x13')](_0xd627('0x15'),auth[_0xd627('0xf')](),controller[_0xd627('0x16')]);router[_0xd627('0x13')](_0xd627('0x17'),auth['isAuthenticated'](),controller[_0xd627('0x18')]);router[_0xd627('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xd627('0x1a')]=router; \ No newline at end of file +var _0x7af9=['util','path','connect-timeout','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','get','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x7af9,0x7c));var _0x97af=function(_0x26ede8,_0x217956){_0x26ede8=_0x26ede8-0x0;var _0x20dc58=_0x7af9[_0x26ede8];return _0x20dc58;};'use strict';var multer=require(_0x97af('0x0'));var util=require(_0x97af('0x1'));var path=require(_0x97af('0x2'));var timeout=require(_0x97af('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x97af('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x97af('0x5'));var config=require('../../config/environment');var controller=require(_0x97af('0x6'));router['get']('/',auth[_0x97af('0x7')](),controller[_0x97af('0x8')]);router['get'](_0x97af('0x9'),auth[_0x97af('0x7')](),controller[_0x97af('0xa')]);router[_0x97af('0xb')](_0x97af('0xc'),auth['isAuthenticated'](),controller[_0x97af('0xd')]);router[_0x97af('0xb')]('/voice/queue/countAttributes/:id',auth[_0x97af('0x7')](),controller[_0x97af('0xe')]);router['get'](_0x97af('0xf'),auth[_0x97af('0x7')](),controller[_0x97af('0x10')]);router[_0x97af('0x11')]('/voice/queue/moveContacts/:id',auth[_0x97af('0x7')](),controller[_0x97af('0x12')]);router[_0x97af('0x11')](_0x97af('0x13'),auth[_0x97af('0x7')](),controller[_0x97af('0x14')]);router[_0x97af('0x11')]('/checkContactHopper',auth[_0x97af('0x7')](),controller[_0x97af('0x15')]);router[_0x97af('0x16')]('/:id',auth[_0x97af('0x7')](),controller[_0x97af('0x17')]);module[_0x97af('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 46a8e6c..162041b 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 _0x406e=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x406e,0x1b8));var _0xe406=function(_0xa37f49,_0x5bf9e3){_0xa37f49=_0xa37f49-0x0;var _0x436cfe=_0x406e[_0xa37f49];return _0x436cfe;};'use strict';var Sequelize=require('sequelize');module[_0xe406('0x0')]={'state':{'type':Sequelize[_0xe406('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe406('0x2')]},'scheduledat':{'type':Sequelize[_0xe406('0x3')]},'countbusyretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe406('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xe406('0x2')]},'calleridnum':{'type':Sequelize[_0xe406('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe406('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe406('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe406('0x2')]},'campaign':{'type':Sequelize[_0xe406('0x2')]},'campaigntype':{'type':Sequelize[_0xe406('0x2')]},'membername':{'type':Sequelize[_0xe406('0x2')]},'reason':{'type':Sequelize[_0xe406('0x2')]},'amd':{'type':Sequelize[_0xe406('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xe406('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe406('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe406('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe406('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd86b=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2d4a77,_0x867c75){var _0x1c6908=function(_0x5f17f9){while(--_0x5f17f9){_0x2d4a77['push'](_0x2d4a77['shift']());}};_0x1c6908(++_0x867c75);}(_0xd86b,0xe5));var _0xbd86=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0xd86b[_0x2652ef];return _0x2db578;};'use strict';var Sequelize=require(_0xbd86('0x0'));module[_0xbd86('0x1')]={'state':{'type':Sequelize[_0xbd86('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbd86('0x3')]},'scheduledat':{'type':Sequelize[_0xbd86('0x4')]},'countbusyretry':{'type':Sequelize[_0xbd86('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbd86('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xbd86('0x3')]},'originatecalleridname':{'type':Sequelize[_0xbd86('0x3')]},'calleridnum':{'type':Sequelize[_0xbd86('0x3')]},'calleridname':{'type':Sequelize[_0xbd86('0x3')]},'starttime':{'type':Sequelize[_0xbd86('0x4')]},'responsetime':{'type':Sequelize[_0xbd86('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbd86('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbd86('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbd86('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbd86('0x3')]},'membername':{'type':Sequelize[_0xbd86('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbd86('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbd86('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbd86('0x4')]},'edited':{'type':Sequelize[_0xbd86('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbd86('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbd86('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbd86('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbd86('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 7ee6d1d..148bd02 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 _0x5f55=['key','model','query','filters','intersection','fields','attributes','length','nolimit','order','filter','merge','where','includeAll','findAll','rows','params','keys','rawAttributes','include','find','catch','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','CmHopperHistory','type'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0x5f55,0x1dc));var _0x55f5=function(_0x245307,_0x12cbb9){_0x245307=_0x245307-0x0;var _0x4cf712=_0x5f55[_0x245307];return _0x4cf712;};'use strict';var emlformat=require(_0x55f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x55f5('0x1'));var jsonpatch=require(_0x55f5('0x2'));var rp=require(_0x55f5('0x3'));var moment=require('moment');var BPromise=require(_0x55f5('0x4'));var Mustache=require(_0x55f5('0x5'));var util=require(_0x55f5('0x6'));var path=require(_0x55f5('0x7'));var sox=require('sox');var csv=require(_0x55f5('0x8'));var ejs=require(_0x55f5('0x9'));var fs=require('fs');var fs_extra=require(_0x55f5('0xa'));var _=require(_0x55f5('0xb'));var squel=require(_0x55f5('0xc'));var crypto=require(_0x55f5('0xd'));var jsforce=require(_0x55f5('0xe'));var deskjs=require(_0x55f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x55f5('0x10'));var Redis=require(_0x55f5('0x11'));var authService=require(_0x55f5('0x12'));var qs=require(_0x55f5('0x13'));var as=require(_0x55f5('0x14'));var hardwareService=require(_0x55f5('0x15'));var logger=require(_0x55f5('0x16'))(_0x55f5('0x17'));var utils=require(_0x55f5('0x18'));var config=require(_0x55f5('0x19'));var licenseUtil=require(_0x55f5('0x1a'));var db=require(_0x55f5('0x1b'))['db'];function respondWithStatusCode(_0x16bea3,_0x324e53){_0x324e53=_0x324e53||0xcc;return function(_0x1f4008){if(_0x1f4008){return _0x16bea3[_0x55f5('0x1c')](_0x324e53);}return _0x16bea3['status'](_0x324e53)[_0x55f5('0x1d')]();};}function respondWithResult(_0xb78d2c,_0x544af1){_0x544af1=_0x544af1||0xc8;return function(_0x5dc5c7){if(_0x5dc5c7){return _0xb78d2c[_0x55f5('0x1e')](_0x544af1)['json'](_0x5dc5c7);}};}function respondWithFilteredResult(_0x43e31e,_0x46389a){return function(_0x4398e8){if(_0x4398e8){var _0x752da1=typeof _0x46389a[_0x55f5('0x1f')]===_0x55f5('0x20')&&typeof _0x46389a[_0x55f5('0x21')]===_0x55f5('0x20');var _0x18ad8c=_0x4398e8[_0x55f5('0x22')];var _0xabdec6=_0x752da1?0x0:_0x46389a[_0x55f5('0x1f')];var _0x2c6977=_0x752da1?_0x4398e8[_0x55f5('0x22')]:_0x46389a[_0x55f5('0x1f')]+_0x46389a[_0x55f5('0x21')];var _0x3533e6;if(_0x2c6977>=_0x18ad8c){_0x2c6977=_0x18ad8c;_0x3533e6=0xc8;}else{_0x3533e6=0xce;}_0x43e31e[_0x55f5('0x1e')](_0x3533e6);return _0x43e31e[_0x55f5('0x23')](_0x55f5('0x24'),_0xabdec6+'-'+_0x2c6977+'/'+_0x18ad8c)[_0x55f5('0x25')](_0x4398e8);}return null;};}function patchUpdates(_0x39b03d){return function(_0x4aebe2){try{jsonpatch[_0x55f5('0x26')](_0x4aebe2,_0x39b03d,!![]);}catch(_0x7ee08e){return BPromise[_0x55f5('0x27')](_0x7ee08e);}return _0x4aebe2[_0x55f5('0x28')]();};}function saveUpdates(_0x3ba60c,_0x49fffe){return function(_0xa0eb2c){if(_0xa0eb2c){return _0xa0eb2c[_0x55f5('0x29')](_0x3ba60c)[_0x55f5('0x2a')](function(_0x4318bf){return _0x4318bf;});}return null;};}function removeEntity(_0xf65fcf,_0x3b148e){return function(_0x5cb088){if(_0x5cb088){return _0x5cb088[_0x55f5('0x2b')]()[_0x55f5('0x2a')](function(){_0xf65fcf[_0x55f5('0x1e')](0xcc)[_0x55f5('0x1d')]();});}};}function handleEntityNotFound(_0x3ce611,_0x173e13){return function(_0xbff3a7){if(!_0xbff3a7){_0x3ce611[_0x55f5('0x1c')](0x194);}return _0xbff3a7;};}function handleError(_0x29b86e,_0x268c76){_0x268c76=_0x268c76||0x1f4;return function(_0x27467e){logger[_0x55f5('0x2c')](_0x27467e['stack']);if(_0x27467e[_0x55f5('0x2d')]){delete _0x27467e[_0x55f5('0x2d')];}_0x29b86e['status'](_0x268c76)['send'](_0x27467e);};}exports['index']=function(_0x3ed5ac,_0x22d46f){var _0x598810={},_0x5619ad={},_0x3c8b34={'count':0x0,'rows':[]};var _0x3bb872=_[_0x55f5('0x2e')](db[_0x55f5('0x2f')]['rawAttributes'],function(_0x2c42c3){return{'name':_0x2c42c3['fieldName'],'type':_0x2c42c3[_0x55f5('0x30')][_0x55f5('0x31')]};});_0x5619ad[_0x55f5('0x32')]=_[_0x55f5('0x2e')](_0x3bb872,'name');_0x5619ad[_0x55f5('0x33')]=_['keys'](_0x3ed5ac[_0x55f5('0x33')]);_0x5619ad[_0x55f5('0x34')]=_[_0x55f5('0x35')](_0x5619ad[_0x55f5('0x32')],_0x5619ad[_0x55f5('0x33')]);_0x598810['attributes']=_[_0x55f5('0x35')](_0x5619ad[_0x55f5('0x32')],qs[_0x55f5('0x36')](_0x3ed5ac[_0x55f5('0x33')][_0x55f5('0x36')]));_0x598810['attributes']=_0x598810[_0x55f5('0x37')][_0x55f5('0x38')]?_0x598810[_0x55f5('0x37')]:_0x5619ad[_0x55f5('0x32')];if(!_0x3ed5ac[_0x55f5('0x33')]['hasOwnProperty'](_0x55f5('0x39'))){_0x598810[_0x55f5('0x21')]=qs['limit'](_0x3ed5ac['query'][_0x55f5('0x21')]);_0x598810[_0x55f5('0x1f')]=qs[_0x55f5('0x1f')](_0x3ed5ac[_0x55f5('0x33')]['offset']);}_0x598810[_0x55f5('0x3a')]=qs['sort'](_0x3ed5ac[_0x55f5('0x33')]['sort']);_0x598810['where']=qs[_0x55f5('0x34')](_['pick'](_0x3ed5ac[_0x55f5('0x33')],_0x5619ad['filters']),_0x3bb872);if(_0x3ed5ac['query'][_0x55f5('0x3b')]){_0x598810['where']=_[_0x55f5('0x3c')](_0x598810[_0x55f5('0x3d')],{'$or':_[_0x55f5('0x2e')](_0x3bb872,function(_0x6ad62d){if(_0x6ad62d[_0x55f5('0x30')]!=='VIRTUAL'){var _0x52ba32={};_0x52ba32[_0x6ad62d[_0x55f5('0x2d')]]={'$like':'%'+_0x3ed5ac[_0x55f5('0x33')][_0x55f5('0x3b')]+'%'};return _0x52ba32;}})});}_0x598810=_[_0x55f5('0x3c')]({},_0x598810,_0x3ed5ac['options']);var _0x40bf2f={'where':_0x598810[_0x55f5('0x3d')]};return db['CmHopperHistory']['count'](_0x40bf2f)[_0x55f5('0x2a')](function(_0x26b2c2){_0x3c8b34[_0x55f5('0x22')]=_0x26b2c2;if(_0x3ed5ac[_0x55f5('0x33')][_0x55f5('0x3e')]){_0x598810['include']=[{'all':!![]}];}return db[_0x55f5('0x2f')][_0x55f5('0x3f')](_0x598810);})[_0x55f5('0x2a')](function(_0x2a3c36){_0x3c8b34[_0x55f5('0x40')]=_0x2a3c36;return _0x3c8b34;})[_0x55f5('0x2a')](respondWithFilteredResult(_0x22d46f,_0x598810))['catch'](handleError(_0x22d46f,null));};exports['show']=function(_0x5bf306,_0x158e84){var _0x52a97e={'raw':!![],'where':{'id':_0x5bf306[_0x55f5('0x41')]['id']}},_0x1166e9={};_0x1166e9[_0x55f5('0x32')]=_[_0x55f5('0x42')](db[_0x55f5('0x2f')][_0x55f5('0x43')]);_0x1166e9[_0x55f5('0x33')]=_[_0x55f5('0x42')](_0x5bf306[_0x55f5('0x33')]);_0x1166e9[_0x55f5('0x34')]=_[_0x55f5('0x35')](_0x1166e9[_0x55f5('0x32')],_0x1166e9[_0x55f5('0x33')]);_0x52a97e[_0x55f5('0x37')]=_[_0x55f5('0x35')](_0x1166e9[_0x55f5('0x32')],qs[_0x55f5('0x36')](_0x5bf306[_0x55f5('0x33')][_0x55f5('0x36')]));_0x52a97e[_0x55f5('0x37')]=_0x52a97e[_0x55f5('0x37')][_0x55f5('0x38')]?_0x52a97e[_0x55f5('0x37')]:_0x1166e9[_0x55f5('0x32')];if(_0x5bf306[_0x55f5('0x33')][_0x55f5('0x3e')]){_0x52a97e[_0x55f5('0x44')]=[{'all':!![]}];}_0x52a97e=_[_0x55f5('0x3c')]({},_0x52a97e,_0x5bf306['options']);return db[_0x55f5('0x2f')][_0x55f5('0x45')](_0x52a97e)['then'](handleEntityNotFound(_0x158e84,null))['then'](respondWithResult(_0x158e84,null))[_0x55f5('0x46')](handleError(_0x158e84,null));};exports[_0x55f5('0x47')]=function(_0x2cda30,_0x47b688){return db[_0x55f5('0x2f')][_0x55f5('0x47')](_0x2cda30[_0x55f5('0x48')],{})[_0x55f5('0x2a')](respondWithResult(_0x47b688,0xc9))[_0x55f5('0x46')](handleError(_0x47b688,null));};exports[_0x55f5('0x49')]=function(_0x4d43d5,_0x55bcf2){return db[_0x55f5('0x2f')]['describe']()[_0x55f5('0x2a')](respondWithResult(_0x55bcf2,null))[_0x55f5('0x46')](handleError(_0x55bcf2,null));};exports[_0x55f5('0x29')]=function(_0x541b06,_0x1012be){if(_0x541b06[_0x55f5('0x48')]['uniqueid']){delete _0x541b06[_0x55f5('0x48')][_0x55f5('0x4a')];}return db[_0x55f5('0x2f')][_0x55f5('0x45')]({'where':{'uniqueid':_0x541b06[_0x55f5('0x41')]['id']}})[_0x55f5('0x2a')](handleEntityNotFound(_0x1012be,null))[_0x55f5('0x2a')](saveUpdates(_0x541b06[_0x55f5('0x48')],null))[_0x55f5('0x2a')](respondWithResult(_0x1012be,null))[_0x55f5('0x46')](handleError(_0x1012be,null));}; \ No newline at end of file +var _0x8447=['find','create','body','describe','update','uniqueid','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','CmHopperHistory','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes'];(function(_0x1e85a8,_0x3f8d0e){var _0x34a8ea=function(_0x12d2ea){while(--_0x12d2ea){_0x1e85a8['push'](_0x1e85a8['shift']());}};_0x34a8ea(++_0x3f8d0e);}(_0x8447,0x1ce));var _0x7844=function(_0x123c2e,_0x310018){_0x123c2e=_0x123c2e-0x0;var _0xf929a8=_0x8447[_0x123c2e];return _0xf929a8;};'use strict';var emlformat=require(_0x7844('0x0'));var rimraf=require(_0x7844('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7844('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7844('0x3'));var util=require(_0x7844('0x4'));var path=require(_0x7844('0x5'));var sox=require(_0x7844('0x6'));var csv=require(_0x7844('0x7'));var ejs=require(_0x7844('0x8'));var fs=require('fs');var fs_extra=require(_0x7844('0x9'));var _=require('lodash');var squel=require(_0x7844('0xa'));var crypto=require(_0x7844('0xb'));var jsforce=require(_0x7844('0xc'));var deskjs=require(_0x7844('0xd'));var toCsv=require(_0x7844('0x7'));var querystring=require('querystring');var Papa=require(_0x7844('0xe'));var Redis=require(_0x7844('0xf'));var authService=require(_0x7844('0x10'));var qs=require(_0x7844('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7844('0x12'));var logger=require('../../config/logger')(_0x7844('0x13'));var utils=require(_0x7844('0x14'));var config=require(_0x7844('0x15'));var licenseUtil=require(_0x7844('0x16'));var db=require(_0x7844('0x17'))['db'];function respondWithStatusCode(_0xb38ccd,_0x17a6db){_0x17a6db=_0x17a6db||0xcc;return function(_0x332222){if(_0x332222){return _0xb38ccd['sendStatus'](_0x17a6db);}return _0xb38ccd['status'](_0x17a6db)[_0x7844('0x18')]();};}function respondWithResult(_0x3f2c30,_0x21815a){_0x21815a=_0x21815a||0xc8;return function(_0x430e31){if(_0x430e31){return _0x3f2c30['status'](_0x21815a)['json'](_0x430e31);}};}function respondWithFilteredResult(_0xeef8d,_0x5092ac){return function(_0xe013b5){if(_0xe013b5){var _0x3a00ec=typeof _0x5092ac[_0x7844('0x19')]==='undefined'&&typeof _0x5092ac[_0x7844('0x1a')]===_0x7844('0x1b');var _0x18f859=_0xe013b5[_0x7844('0x1c')];var _0x5b3253=_0x3a00ec?0x0:_0x5092ac[_0x7844('0x19')];var _0x176217=_0x3a00ec?_0xe013b5[_0x7844('0x1c')]:_0x5092ac[_0x7844('0x19')]+_0x5092ac[_0x7844('0x1a')];var _0x2d193e;if(_0x176217>=_0x18f859){_0x176217=_0x18f859;_0x2d193e=0xc8;}else{_0x2d193e=0xce;}_0xeef8d[_0x7844('0x1d')](_0x2d193e);return _0xeef8d[_0x7844('0x1e')](_0x7844('0x1f'),_0x5b3253+'-'+_0x176217+'/'+_0x18f859)[_0x7844('0x20')](_0xe013b5);}return null;};}function patchUpdates(_0x4955e1){return function(_0x5eceb7){try{jsonpatch[_0x7844('0x21')](_0x5eceb7,_0x4955e1,!![]);}catch(_0x529661){return BPromise[_0x7844('0x22')](_0x529661);}return _0x5eceb7['save']();};}function saveUpdates(_0x55fdc9,_0x1f9da2){return function(_0xf6b8d3){if(_0xf6b8d3){return _0xf6b8d3['update'](_0x55fdc9)[_0x7844('0x23')](function(_0xa78ef1){return _0xa78ef1;});}return null;};}function removeEntity(_0x58bd68,_0x447c55){return function(_0x318d03){if(_0x318d03){return _0x318d03[_0x7844('0x24')]()[_0x7844('0x23')](function(){_0x58bd68[_0x7844('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7f2d,_0x34c3f1){return function(_0x5124f5){if(!_0x5124f5){_0x2f7f2d[_0x7844('0x25')](0x194);}return _0x5124f5;};}function handleError(_0x363996,_0x4c48e4){_0x4c48e4=_0x4c48e4||0x1f4;return function(_0x4b2d02){logger['error'](_0x4b2d02[_0x7844('0x26')]);if(_0x4b2d02[_0x7844('0x27')]){delete _0x4b2d02[_0x7844('0x27')];}_0x363996[_0x7844('0x1d')](_0x4c48e4)[_0x7844('0x28')](_0x4b2d02);};}exports[_0x7844('0x29')]=function(_0x345317,_0x1632cc){var _0x415524={},_0x3a9f13={},_0x1f5186={'count':0x0,'rows':[]};var _0x548a86=_[_0x7844('0x2a')](db[_0x7844('0x2b')]['rawAttributes'],function(_0x340c51){return{'name':_0x340c51[_0x7844('0x2c')],'type':_0x340c51['type']['key']};});_0x3a9f13[_0x7844('0x2d')]=_[_0x7844('0x2a')](_0x548a86,_0x7844('0x27'));_0x3a9f13[_0x7844('0x2e')]=_['keys'](_0x345317[_0x7844('0x2e')]);_0x3a9f13[_0x7844('0x2f')]=_[_0x7844('0x30')](_0x3a9f13[_0x7844('0x2d')],_0x3a9f13['query']);_0x415524[_0x7844('0x31')]=_[_0x7844('0x30')](_0x3a9f13[_0x7844('0x2d')],qs[_0x7844('0x32')](_0x345317['query'][_0x7844('0x32')]));_0x415524[_0x7844('0x31')]=_0x415524[_0x7844('0x31')]['length']?_0x415524['attributes']:_0x3a9f13[_0x7844('0x2d')];if(!_0x345317[_0x7844('0x2e')][_0x7844('0x33')](_0x7844('0x34'))){_0x415524[_0x7844('0x1a')]=qs[_0x7844('0x1a')](_0x345317[_0x7844('0x2e')][_0x7844('0x1a')]);_0x415524[_0x7844('0x19')]=qs[_0x7844('0x19')](_0x345317['query'][_0x7844('0x19')]);}_0x415524[_0x7844('0x35')]=qs[_0x7844('0x36')](_0x345317[_0x7844('0x2e')][_0x7844('0x36')]);_0x415524['where']=qs['filters'](_[_0x7844('0x37')](_0x345317[_0x7844('0x2e')],_0x3a9f13[_0x7844('0x2f')]),_0x548a86);if(_0x345317['query'][_0x7844('0x38')]){_0x415524[_0x7844('0x39')]=_['merge'](_0x415524['where'],{'$or':_[_0x7844('0x2a')](_0x548a86,function(_0x5140f1){if(_0x5140f1[_0x7844('0x3a')]!==_0x7844('0x3b')){var _0x59d334={};_0x59d334[_0x5140f1[_0x7844('0x27')]]={'$like':'%'+_0x345317[_0x7844('0x2e')][_0x7844('0x38')]+'%'};return _0x59d334;}})});}_0x415524=_[_0x7844('0x3c')]({},_0x415524,_0x345317['options']);var _0x41279e={'where':_0x415524[_0x7844('0x39')]};return db['CmHopperHistory'][_0x7844('0x1c')](_0x41279e)[_0x7844('0x23')](function(_0x5ce2e7){_0x1f5186[_0x7844('0x1c')]=_0x5ce2e7;if(_0x345317[_0x7844('0x2e')][_0x7844('0x3d')]){_0x415524[_0x7844('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7844('0x3f')](_0x415524);})[_0x7844('0x23')](function(_0x42defc){_0x1f5186[_0x7844('0x40')]=_0x42defc;return _0x1f5186;})[_0x7844('0x23')](respondWithFilteredResult(_0x1632cc,_0x415524))[_0x7844('0x41')](handleError(_0x1632cc,null));};exports[_0x7844('0x42')]=function(_0x4563c2,_0x5e5db2){var _0xec975e={'raw':!![],'where':{'id':_0x4563c2[_0x7844('0x43')]['id']}},_0x205400={};_0x205400[_0x7844('0x2d')]=_[_0x7844('0x44')](db[_0x7844('0x2b')][_0x7844('0x45')]);_0x205400[_0x7844('0x2e')]=_['keys'](_0x4563c2[_0x7844('0x2e')]);_0x205400[_0x7844('0x2f')]=_[_0x7844('0x30')](_0x205400['model'],_0x205400[_0x7844('0x2e')]);_0xec975e[_0x7844('0x31')]=_['intersection'](_0x205400['model'],qs[_0x7844('0x32')](_0x4563c2[_0x7844('0x2e')][_0x7844('0x32')]));_0xec975e[_0x7844('0x31')]=_0xec975e[_0x7844('0x31')]['length']?_0xec975e[_0x7844('0x31')]:_0x205400[_0x7844('0x2d')];if(_0x4563c2['query'][_0x7844('0x3d')]){_0xec975e[_0x7844('0x3e')]=[{'all':!![]}];}_0xec975e=_[_0x7844('0x3c')]({},_0xec975e,_0x4563c2['options']);return db[_0x7844('0x2b')][_0x7844('0x46')](_0xec975e)[_0x7844('0x23')](handleEntityNotFound(_0x5e5db2,null))['then'](respondWithResult(_0x5e5db2,null))['catch'](handleError(_0x5e5db2,null));};exports[_0x7844('0x47')]=function(_0x1b7816,_0x162031){return db['CmHopperHistory']['create'](_0x1b7816[_0x7844('0x48')],{})[_0x7844('0x23')](respondWithResult(_0x162031,0xc9))[_0x7844('0x41')](handleError(_0x162031,null));};exports[_0x7844('0x49')]=function(_0x47ebda,_0x477c7f){return db[_0x7844('0x2b')][_0x7844('0x49')]()[_0x7844('0x23')](respondWithResult(_0x477c7f,null))[_0x7844('0x41')](handleError(_0x477c7f,null));};exports[_0x7844('0x4a')]=function(_0x40c90e,_0x5e612b){if(_0x40c90e[_0x7844('0x48')]['uniqueid']){delete _0x40c90e[_0x7844('0x48')][_0x7844('0x4b')];}return db[_0x7844('0x2b')][_0x7844('0x46')]({'where':{'uniqueid':_0x40c90e[_0x7844('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e612b,null))['then'](saveUpdates(_0x40c90e[_0x7844('0x48')],null))[_0x7844('0x23')](respondWithResult(_0x5e612b,null))[_0x7844('0x41')](handleError(_0x5e612b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 6754127..feede67 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 _0xa1cc=['bluebird','request-promise','rimraf','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','lodash','util','../../config/logger','moment'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0xa1cc,0x10f));var _0xca1c=function(_0x157be6,_0x579f5d){_0x157be6=_0x157be6-0x0;var _0xe0559c=_0xa1cc[_0x157be6];return _0xe0559c;};'use strict';var _=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var logger=require(_0xca1c('0x2'))('api');var moment=require(_0xca1c('0x3'));var BPromise=require(_0xca1c('0x4'));var rp=require(_0xca1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca1c('0x6'));var config=require('../../config/environment');var attributes=require(_0xca1c('0x7'));module[_0xca1c('0x8')]=function(_0x375837,_0x98dd5f){return _0x375837['define']('CmHopperHistory',attributes,{'tableName':_0xca1c('0x9'),'paranoid':![],'indexes':[{'name':_0xca1c('0xa'),'fields':[_0xca1c('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c91=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash'];(function(_0x184525,_0x4527ca){var _0x1f4e19=function(_0x49c638){while(--_0x49c638){_0x184525['push'](_0x184525['shift']());}};_0x1f4e19(++_0x4527ca);}(_0x2c91,0x158));var _0x12c9=function(_0x444d99,_0x2bccc8){_0x444d99=_0x444d99-0x0;var _0x5ba3a2=_0x2c91[_0x444d99];return _0x5ba3a2;};'use strict';var _=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var logger=require(_0x12c9('0x2'))(_0x12c9('0x3'));var moment=require(_0x12c9('0x4'));var BPromise=require(_0x12c9('0x5'));var rp=require(_0x12c9('0x6'));var fs=require('fs');var path=require(_0x12c9('0x7'));var rimraf=require('rimraf');var config=require(_0x12c9('0x8'));var attributes=require(_0x12c9('0x9'));module[_0x12c9('0xa')]=function(_0x38bd43,_0x14c359){return _0x38bd43[_0x12c9('0xb')](_0x12c9('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x12c9('0xd'),'fields':[_0x12c9('0xd')]},{'name':'uniqueid','fields':[_0x12c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 5d7f66b..2cb9cce 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 _0x9219=['where','col','COUNT','sequelize','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0x9219,0xc0));var _0x9921=function(_0x1e65cc,_0x57caf1){_0x1e65cc=_0x1e65cc-0x0;var _0x40fc32=_0x9219[_0x1e65cc];return _0x40fc32;};'use strict';var _=require(_0x9921('0x0'));var util=require(_0x9921('0x1'));var moment=require(_0x9921('0x2'));var BPromise=require(_0x9921('0x3'));var rs=require(_0x9921('0x4'));var fs=require('fs');var Redis=require(_0x9921('0x5'));var db=require(_0x9921('0x6'))['db'];var utils=require(_0x9921('0x7'));var logger=require(_0x9921('0x8'))('rpc');var config=require(_0x9921('0x9'));var jayson=require(_0x9921('0xa'));var client=jayson[_0x9921('0xb')][_0x9921('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aaa6,_0x1f959d,_0x3bb89a){return new BPromise(function(_0x160efa,_0x5b5cb4){return client[_0x9921('0xd')](_0x59aaa6,_0x3bb89a)[_0x9921('0xe')](function(_0x127a0c){logger[_0x9921('0xf')](_0x9921('0x10'),_0x1f959d,'request\x20sent');logger[_0x9921('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1f959d,_0x9921('0x12'),JSON[_0x9921('0x13')](_0x127a0c));if(_0x127a0c[_0x9921('0x14')]){if(_0x127a0c[_0x9921('0x14')][_0x9921('0x15')]===0x1f4){logger[_0x9921('0x14')](_0x9921('0x10'),_0x1f959d,_0x127a0c[_0x9921('0x14')][_0x9921('0x16')]);return _0x5b5cb4(_0x127a0c[_0x9921('0x14')][_0x9921('0x16')]);}logger['error'](_0x9921('0x10'),_0x1f959d,_0x127a0c['error'][_0x9921('0x16')]);return _0x160efa(_0x127a0c['error'][_0x9921('0x16')]);}else{logger[_0x9921('0xf')](_0x9921('0x10'),_0x1f959d,'request\x20sent');_0x160efa(_0x127a0c[_0x9921('0x17')][_0x9921('0x16')]);}})[_0x9921('0x18')](function(_0x5da894){logger[_0x9921('0x14')](_0x9921('0x10'),_0x1f959d,_0x5da894);_0x5b5cb4(_0x5da894);});});}exports[_0x9921('0x19')]=function(_0x238770){var _0x191117=this;return new Promise(function(_0x122bda,_0x1673da){return db[_0x9921('0x1a')][_0x9921('0x1b')](_0x238770['body'],{'raw':_0x238770[_0x9921('0x1c')]?_0x238770['options'][_0x9921('0x1d')]===undefined?!![]:![]:!![]})[_0x9921('0xe')](function(_0x574009){logger['info']('CreateCmHopperHistory',_0x238770);logger[_0x9921('0x11')](_0x9921('0x19'),_0x238770,JSON[_0x9921('0x13')](_0x574009));_0x122bda(_0x574009);})[_0x9921('0x18')](function(_0x4c6c88){logger[_0x9921('0x14')](_0x9921('0x19'),_0x4c6c88[_0x9921('0x16')],_0x238770);_0x1673da(_0x191117[_0x9921('0x14')](0x1f4,_0x4c6c88[_0x9921('0x16')]));});});};exports['AvgHandleTime']=function(_0x43845b){var _0x4f2ad7=this;return new Promise(function(_0x3f88f1,_0x6ceb43){return db[_0x9921('0x1a')]['findAll']({'raw':_0x43845b['options']?_0x43845b[_0x9921('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x43845b['options']?_0x43845b[_0x9921('0x1c')][_0x9921('0x1e')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x9921('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')]['literal'](_0x9921('0x22')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db['sequelize'][_0x9921('0x23')](_0x9921('0x24')))),_0x9921('0x25')],[db[_0x9921('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x26')))),_0x9921('0x27')],[db[_0x9921('0x21')]['fn'](_0x9921('0x28'),db[_0x9921('0x21')]['fn']('IF',db['sequelize'][_0x9921('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x9921('0x29')],[db[_0x9921('0x21')]['fn'](_0x9921('0x28'),db['sequelize']['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x2a')))),_0x9921('0x2b')]]})[_0x9921('0xe')](function(_0x39b09e){logger[_0x9921('0xf')](_0x9921('0x2c'),_0x43845b);logger['debug'](_0x9921('0x2c'),_0x43845b,JSON[_0x9921('0x13')](_0x39b09e));_0x3f88f1(_0x39b09e);})[_0x9921('0x18')](function(_0x8f2aca){logger[_0x9921('0x14')]('AvgHandleTime',_0x8f2aca['message'],_0x43845b);_0x6ceb43(_0x4f2ad7[_0x9921('0x14')](0x1f4,_0x8f2aca[_0x9921('0x16')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x477ebf){var _0x349cfc=this;return new Promise(function(_0x2d87c6,_0x45762a){return db['CmHopperHistory'][_0x9921('0x2d')]({'raw':_0x477ebf[_0x9921('0x1c')]?_0x477ebf[_0x9921('0x1c')][_0x9921('0x1d')]===undefined?!![]:![]:!![],'where':_0x477ebf[_0x9921('0x1c')]?_0x477ebf[_0x9921('0x1c')][_0x9921('0x1e')]||null:null,'attributes':[[_0x9921('0x2e'),_0x9921('0x2f')],[db[_0x9921('0x21')]['fn']('COUNT',db[_0x9921('0x21')]['fn']('IF',db['sequelize'][_0x9921('0x23')](_0x9921('0x30')))),_0x9921('0x31')],[db[_0x9921('0x21')]['fn']('COUNT',db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x9921('0x32')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db['sequelize'][_0x9921('0x23')](_0x9921('0x22')))),_0x9921('0x33')],[db[_0x9921('0x21')]['fn']('COUNT',db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x34')))),'outboundBusyCallsDay'],[db[_0x9921('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x35')))),_0x9921('0x36')],[db['sequelize']['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x37')))),_0x9921('0x38')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x39')))),_0x9921('0x3a')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db['sequelize']['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x3b')))),_0x9921('0x3c')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')]['literal'](_0x9921('0x3d')))),_0x9921('0x3e')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x3f')))),_0x9921('0x40')],[db['sequelize']['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db['sequelize'][_0x9921('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0x9921('0x41')],[db[_0x9921('0x21')]['fn']('COUNT',db[_0x9921('0x21')]['fn']('IF',db['sequelize']['literal'](_0x9921('0x42')))),_0x9921('0x43')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x44')))),_0x9921('0x41')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db['sequelize']['literal'](_0x9921('0x45')))),'outboundReCallsDay']],'group':[_0x9921('0x2e')]})['then'](function(_0x24b8f4){logger[_0x9921('0xf')]('GetVoiceQueueHopperHistory',_0x477ebf);logger[_0x9921('0x11')]('GetVoiceQueueHopperHistory',_0x477ebf,JSON[_0x9921('0x13')](_0x24b8f4));_0x2d87c6(_0x24b8f4);})[_0x9921('0x18')](function(_0x5f66e){logger[_0x9921('0x14')](_0x9921('0x46'),_0x5f66e[_0x9921('0x16')],_0x477ebf);_0x45762a(_0x349cfc[_0x9921('0x14')](0x1f4,_0x5f66e[_0x9921('0x16')]));});});};exports[_0x9921('0x47')]=function(_0x3201fc){var _0x1f7327=this;return new Promise(function(_0x4fd740,_0x3178a6){return db[_0x9921('0x1a')]['findAll']({'raw':_0x3201fc[_0x9921('0x1c')]?_0x3201fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x3201fc[_0x9921('0x1c')]?_0x3201fc[_0x9921('0x1c')][_0x9921('0x1e')]||null:null,'attributes':[[_0x9921('0x2e'),_0x9921('0x2f')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db['sequelize'][_0x9921('0x1f')]('id')),_0x9921('0x48')],[db[_0x9921('0x21')]['fn'](_0x9921('0x20'),db[_0x9921('0x21')]['fn']('IF',db[_0x9921('0x21')][_0x9921('0x23')](_0x9921('0x22')))),_0x9921('0x49')]],'group':[_0x9921('0x2e')]})[_0x9921('0xe')](function(_0x232d8c){logger['info']('GetCampaignHopperHistory',_0x3201fc);logger[_0x9921('0x11')]('GetCampaignHopperHistory',_0x3201fc,JSON[_0x9921('0x13')](_0x232d8c));_0x4fd740(_0x232d8c);})['catch'](function(_0x9b06d1){logger[_0x9921('0x14')](_0x9921('0x47'),_0x9b06d1['message'],_0x3201fc);_0x3178a6(_0x1f7327[_0x9921('0x14')](0x1f4,_0x9b06d1[_0x9921('0x16')]));});});}; \ No newline at end of file +var _0x1752=['col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundReCallsDay','debug','stringify','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','sequelize','COUNT'];(function(_0x1f3c43,_0x287665){var _0x2d316d=function(_0x12ea21){while(--_0x12ea21){_0x1f3c43['push'](_0x1f3c43['shift']());}};_0x2d316d(++_0x287665);}(_0x1752,0xa5));var _0x2175=function(_0x16a050,_0x3d246c){_0x16a050=_0x16a050-0x0;var _0x5c1b85=_0x1752[_0x16a050];return _0x5c1b85;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ca87,_0x1bd937,_0x339e4d){return new BPromise(function(_0x672ff1,_0x516ccc){return client[_0x2175('0xc')](_0x19ca87,_0x339e4d)[_0x2175('0xd')](function(_0x407a71){logger[_0x2175('0xe')](_0x2175('0xf'),_0x1bd937,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1bd937,_0x2175('0x10'),JSON['stringify'](_0x407a71));if(_0x407a71['error']){if(_0x407a71['error']['code']===0x1f4){logger[_0x2175('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x516ccc(_0x407a71['error'][_0x2175('0x12')]);}logger[_0x2175('0x11')](_0x2175('0xf'),_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x672ff1(_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);}else{logger[_0x2175('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x1bd937,'request\x20sent');_0x672ff1(_0x407a71[_0x2175('0x13')][_0x2175('0x12')]);}})[_0x2175('0x14')](function(_0x4e7cf1){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1bd937,_0x4e7cf1);_0x516ccc(_0x4e7cf1);});});}exports[_0x2175('0x15')]=function(_0x377586){var _0x4cb089=this;return new Promise(function(_0x53576c,_0x405fb1){return db[_0x2175('0x16')][_0x2175('0x17')](_0x377586['body'],{'raw':_0x377586[_0x2175('0x18')]?_0x377586['options'][_0x2175('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x37818a){logger['info']('CreateCmHopperHistory',_0x377586);logger['debug'](_0x2175('0x15'),_0x377586,JSON['stringify'](_0x37818a));_0x53576c(_0x37818a);})[_0x2175('0x14')](function(_0x46ea57){logger[_0x2175('0x11')](_0x2175('0x15'),_0x46ea57[_0x2175('0x12')],_0x377586);_0x405fb1(_0x4cb089[_0x2175('0x11')](0x1f4,_0x46ea57['message']));});});};exports[_0x2175('0x1a')]=function(_0x3d849e){var _0xa6ef48=this;return new Promise(function(_0x140032,_0x495887){return db['CmHopperHistory'][_0x2175('0x1b')]({'raw':_0x3d849e[_0x2175('0x18')]?_0x3d849e[_0x2175('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3d849e[_0x2175('0x18')]?_0x3d849e['options']['where']||null:null,'attributes':[[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')][_0x2175('0x1e')]('id')),_0x2175('0x1f')],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')](_0x2175('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x2175('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0x2175('0x22')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')](_0x2175('0x23')))),_0x2175('0x24')],[db['sequelize']['fn'](_0x2175('0x25'),db[_0x2175('0x1c')]['fn']('IF',db['sequelize'][_0x2175('0x20')](_0x2175('0x26')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')](_0x2175('0x27')))),_0x2175('0x28')]]})[_0x2175('0xd')](function(_0x25cce5){logger[_0x2175('0xe')](_0x2175('0x1a'),_0x3d849e);logger['debug']('AvgHandleTime',_0x3d849e,JSON['stringify'](_0x25cce5));_0x140032(_0x25cce5);})['catch'](function(_0x536dd1){logger[_0x2175('0x11')](_0x2175('0x1a'),_0x536dd1['message'],_0x3d849e);_0x495887(_0xa6ef48[_0x2175('0x11')](0x1f4,_0x536dd1[_0x2175('0x12')]));});});};exports[_0x2175('0x29')]=function(_0x1843d9){var _0x8c78fb=this;return new Promise(function(_0x162042,_0x5af516){return db[_0x2175('0x16')][_0x2175('0x1b')]({'raw':_0x1843d9[_0x2175('0x18')]?_0x1843d9[_0x2175('0x18')][_0x2175('0x19')]===undefined?!![]:![]:!![],'where':_0x1843d9[_0x2175('0x18')]?_0x1843d9[_0x2175('0x18')][_0x2175('0x2a')]||null:null,'attributes':[[_0x2175('0x2b'),_0x2175('0x2c')],[db[_0x2175('0x1c')]['fn']('COUNT',db[_0x2175('0x1c')]['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x2175('0x1c')]['fn']('COUNT',db[_0x2175('0x1c')]['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x2175('0x20')](_0x2175('0x21')))),_0x2175('0x2d')],[db['sequelize']['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db[_0x2175('0x1c')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x2175('0x2e')],[db['sequelize']['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x2175('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x2175('0x1c')]['fn']('IF',db['sequelize'][_0x2175('0x20')](_0x2175('0x30')))),_0x2175('0x31')],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db['sequelize'][_0x2175('0x20')](_0x2175('0x32')))),_0x2175('0x33')],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db['sequelize'][_0x2175('0x20')](_0x2175('0x34')))),_0x2175('0x35')],[db['sequelize']['fn'](_0x2175('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x2175('0x20')](_0x2175('0x36')))),_0x2175('0x37')],[db['sequelize']['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')](_0x2175('0x38')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')](_0x2175('0x39')))),'outboundRejectCallsDay'],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x2175('0x3a')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2175('0x1c')][_0x2175('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x2175('0x1c')]['fn']('IF',db[_0x2175('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x2175('0x3b')]],'group':[_0x2175('0x2b')]})[_0x2175('0xd')](function(_0xce807c){logger[_0x2175('0xe')]('GetVoiceQueueHopperHistory',_0x1843d9);logger[_0x2175('0x3c')]('GetVoiceQueueHopperHistory',_0x1843d9,JSON[_0x2175('0x3d')](_0xce807c));_0x162042(_0xce807c);})[_0x2175('0x14')](function(_0x265dc7){logger[_0x2175('0x11')](_0x2175('0x29'),_0x265dc7[_0x2175('0x12')],_0x1843d9);_0x5af516(_0x8c78fb[_0x2175('0x11')](0x1f4,_0x265dc7[_0x2175('0x12')]));});});};exports[_0x2175('0x3e')]=function(_0x470dde){var _0x1f967d=this;return new Promise(function(_0x172844,_0x29e926){return db[_0x2175('0x16')][_0x2175('0x1b')]({'raw':_0x470dde['options']?_0x470dde[_0x2175('0x18')][_0x2175('0x19')]===undefined?!![]:![]:!![],'where':_0x470dde[_0x2175('0x18')]?_0x470dde[_0x2175('0x18')]['where']||null:null,'attributes':[[_0x2175('0x2b'),'name'],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')][_0x2175('0x1e')]('id')),_0x2175('0x3f')],[db[_0x2175('0x1c')]['fn'](_0x2175('0x1d'),db[_0x2175('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x2175('0x21')))),_0x2175('0x40')]],'group':['campaign']})['then'](function(_0x3e9e8d){logger[_0x2175('0xe')](_0x2175('0x3e'),_0x470dde);logger[_0x2175('0x3c')]('GetCampaignHopperHistory',_0x470dde,JSON[_0x2175('0x3d')](_0x3e9e8d));_0x172844(_0x3e9e8d);})['catch'](function(_0x4136eb){logger[_0x2175('0x11')]('GetCampaignHopperHistory',_0x4136eb[_0x2175('0x12')],_0x470dde);_0x29e926(_0x1f967d[_0x2175('0x11')](0x1f4,_0x4136eb[_0x2175('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ba2d0d9..9bd2d23 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 _0x5bef=['index','/describe','describe','/:id','show','create','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x31dafd,_0x520518){var _0x1c89d4=function(_0xc18c11){while(--_0xc18c11){_0x31dafd['push'](_0x31dafd['shift']());}};_0x1c89d4(++_0x520518);}(_0x5bef,0x68));var _0xf5be=function(_0x3e0cf0,_0x461991){_0x3e0cf0=_0x3e0cf0-0x0;var _0x501892=_0x5bef[_0x3e0cf0];return _0x501892;};'use strict';var multer=require(_0xf5be('0x0'));var util=require(_0xf5be('0x1'));var path=require('path');var timeout=require(_0xf5be('0x2'));var express=require(_0xf5be('0x3'));var router=express['Router']();var fs_extra=require(_0xf5be('0x4'));var auth=require(_0xf5be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf5be('0x6'));var controller=require(_0xf5be('0x7'));router[_0xf5be('0x8')]('/',auth[_0xf5be('0x9')](),controller[_0xf5be('0xa')]);router[_0xf5be('0x8')](_0xf5be('0xb'),auth['isAuthenticated'](),controller[_0xf5be('0xc')]);router[_0xf5be('0x8')](_0xf5be('0xd'),auth[_0xf5be('0x9')](),controller[_0xf5be('0xe')]);router['post']('/',auth[_0xf5be('0x9')](),controller[_0xf5be('0xf')]);router[_0xf5be('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf5be('0x11')]);module[_0xf5be('0x12')]=router; \ No newline at end of file +var _0x0297=['get','/:id','post','update','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','/describe','isAuthenticated'];(function(_0x18da0b,_0x4daedb){var _0xbe65c7=function(_0x6ee25c){while(--_0x6ee25c){_0x18da0b['push'](_0x18da0b['shift']());}};_0xbe65c7(++_0x4daedb);}(_0x0297,0x170));var _0x7029=function(_0x2a2fdb,_0x5b5d57){_0x2a2fdb=_0x2a2fdb-0x0;var _0x34fbbf=_0x0297[_0x2a2fdb];return _0x34fbbf;};'use strict';var multer=require(_0x7029('0x0'));var util=require(_0x7029('0x1'));var path=require('path');var timeout=require(_0x7029('0x2'));var express=require('express');var router=express[_0x7029('0x3')]();var fs_extra=require(_0x7029('0x4'));var auth=require(_0x7029('0x5'));var interaction=require(_0x7029('0x6'));var config=require('../../config/environment');var controller=require(_0x7029('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7029('0x8'),auth[_0x7029('0x9')](),controller['describe']);router[_0x7029('0xa')](_0x7029('0xb'),auth[_0x7029('0x9')](),controller['show']);router[_0x7029('0xc')]('/',auth[_0x7029('0x9')](),controller['create']);router['put'](_0x7029('0xb'),auth[_0x7029('0x9')](),controller[_0x7029('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4db3be9..f8b06e8 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 _0x291c=['exports','STRING','name','sequelize'];(function(_0x55a8a0,_0x11d668){var _0x40a451=function(_0x5d411d){while(--_0x5d411d){_0x55a8a0['push'](_0x55a8a0['shift']());}};_0x40a451(++_0x11d668);}(_0x291c,0x137));var _0xc291=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x291c[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xc291('0x0'));module[_0xc291('0x1')]={'name':{'type':Sequelize[_0xc291('0x2')],'unique':_0xc291('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc291('0x2')]},'dialPrefix':{'type':Sequelize[_0xc291('0x2')]}}; \ No newline at end of file +var _0xdab2=['sequelize','exports','name','STRING'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dab('0x0'));module[_0x2dab('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2dab('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2dab('0x3')]},'dialPrefix':{'type':Sequelize[_0x2dab('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e6f8f95..0a698e0 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 _0x4a28=['offset','set','apply','reject','save','update','then','destroy','Lists','end','error','name','send','index','map','CmList','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','removeDispositions','ids','addContacts','isArray','tags','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','CmContact','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','findOne','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','limit','undefined','count'];(function(_0x109ce0,_0x1161a5){var _0x24b27d=function(_0x5152b9){while(--_0x5152b9){_0x109ce0['push'](_0x109ce0['shift']());}};_0x24b27d(++_0x1161a5);}(_0x4a28,0x71));var _0x84a2=function(_0xb2645a,_0x1ed9ab){_0xb2645a=_0xb2645a-0x0;var _0xbe67c9=_0x4a28[_0xb2645a];return _0xbe67c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84a2('0x0'));var zipdir=require(_0x84a2('0x1'));var jsonpatch=require(_0x84a2('0x2'));var rp=require(_0x84a2('0x3'));var moment=require(_0x84a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x84a2('0x5'));var util=require(_0x84a2('0x6'));var path=require(_0x84a2('0x7'));var sox=require(_0x84a2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84a2('0x9'));var squel=require('squel');var crypto=require(_0x84a2('0xa'));var jsforce=require(_0x84a2('0xb'));var deskjs=require(_0x84a2('0xc'));var toCsv=require(_0x84a2('0xd'));var querystring=require(_0x84a2('0xe'));var Papa=require(_0x84a2('0xf'));var Redis=require(_0x84a2('0x10'));var authService=require(_0x84a2('0x11'));var qs=require(_0x84a2('0x12'));var as=require(_0x84a2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84a2('0x14'))(_0x84a2('0x15'));var utils=require(_0x84a2('0x16'));var config=require(_0x84a2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x84a2('0x18')](config[_0x84a2('0x19')],{'host':_0x84a2('0x1a'),'port':0x18eb});var socket=require(_0x84a2('0x1b'))(new Redis(config['redis']));require(_0x84a2('0x1c'))[_0x84a2('0x1d')](socket);function respondWithStatusCode(_0x45da78,_0x18729e){_0x18729e=_0x18729e||0xcc;return function(_0x5aa668){if(_0x5aa668){return _0x45da78[_0x84a2('0x1e')](_0x18729e);}return _0x45da78['status'](_0x18729e)['end']();};}function respondWithResult(_0x27696c,_0x55f488){_0x55f488=_0x55f488||0xc8;return function(_0x24b948){if(_0x24b948){return _0x27696c[_0x84a2('0x1f')](_0x55f488)[_0x84a2('0x20')](_0x24b948);}};}function respondWithFilteredResult(_0x190088,_0xe379b2){return function(_0x485565){if(_0x485565){var _0x35a46a=typeof _0xe379b2['offset']==='undefined'&&typeof _0xe379b2[_0x84a2('0x21')]===_0x84a2('0x22');var _0x199013=_0x485565[_0x84a2('0x23')];var _0x4b10b6=_0x35a46a?0x0:_0xe379b2[_0x84a2('0x24')];var _0x275936=_0x35a46a?_0x485565[_0x84a2('0x23')]:_0xe379b2['offset']+_0xe379b2[_0x84a2('0x21')];var _0x358fc9;if(_0x275936>=_0x199013){_0x275936=_0x199013;_0x358fc9=0xc8;}else{_0x358fc9=0xce;}_0x190088[_0x84a2('0x1f')](_0x358fc9);return _0x190088[_0x84a2('0x25')]('Content-Range',_0x4b10b6+'-'+_0x275936+'/'+_0x199013)[_0x84a2('0x20')](_0x485565);}return null;};}function patchUpdates(_0x2c5b72){return function(_0x4599e5){try{jsonpatch[_0x84a2('0x26')](_0x4599e5,_0x2c5b72,!![]);}catch(_0xb8ee57){return BPromise[_0x84a2('0x27')](_0xb8ee57);}return _0x4599e5[_0x84a2('0x28')]();};}function saveUpdates(_0x259f39,_0x2ba583){return function(_0x53f9fd){if(_0x53f9fd){return _0x53f9fd[_0x84a2('0x29')](_0x259f39)[_0x84a2('0x2a')](function(_0x24c46d){return _0x24c46d;});}return null;};}function removeEntity(_0x34a2f9,_0x39591f){return function(_0x40c8a8){if(_0x40c8a8){return _0x40c8a8[_0x84a2('0x2b')]()['then'](function(){var _0x40636a=_0x40c8a8['get']({'plain':!![]});var _0x5e56d6=_0x84a2('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e56d6,'resourceId':_0x40636a['id']}})['then'](function(){return _0x40c8a8;});})['then'](function(){_0x34a2f9[_0x84a2('0x1f')](0xcc)[_0x84a2('0x2d')]();});}};}function handleEntityNotFound(_0x411bdb,_0xb226d5){return function(_0x242122){if(!_0x242122){_0x411bdb[_0x84a2('0x1e')](0x194);}return _0x242122;};}function handleError(_0x55a2fb,_0x111bc4){_0x111bc4=_0x111bc4||0x1f4;return function(_0x3b21e6){logger[_0x84a2('0x2e')](_0x3b21e6['stack']);if(_0x3b21e6[_0x84a2('0x2f')]){delete _0x3b21e6[_0x84a2('0x2f')];}_0x55a2fb[_0x84a2('0x1f')](_0x111bc4)[_0x84a2('0x30')](_0x3b21e6);};}exports[_0x84a2('0x31')]=function(_0x1e6334,_0x4d0dc6){var _0x564199={},_0x235d99={},_0x1242c5={'count':0x0,'rows':[]};var _0x4ecd54=_[_0x84a2('0x32')](db[_0x84a2('0x33')][_0x84a2('0x34')],function(_0x16155e){return{'name':_0x16155e['fieldName'],'type':_0x16155e['type']['key']};});_0x235d99['model']=_[_0x84a2('0x32')](_0x4ecd54,_0x84a2('0x2f'));_0x235d99[_0x84a2('0x35')]=_[_0x84a2('0x36')](_0x1e6334['query']);_0x235d99[_0x84a2('0x37')]=_[_0x84a2('0x38')](_0x235d99['model'],_0x235d99[_0x84a2('0x35')]);_0x564199[_0x84a2('0x39')]=_[_0x84a2('0x38')](_0x235d99[_0x84a2('0x3a')],qs[_0x84a2('0x3b')](_0x1e6334[_0x84a2('0x35')]['fields']));_0x564199[_0x84a2('0x39')]=_0x564199[_0x84a2('0x39')][_0x84a2('0x3c')]?_0x564199[_0x84a2('0x39')]:_0x235d99[_0x84a2('0x3a')];if(!_0x1e6334[_0x84a2('0x35')][_0x84a2('0x3d')]('nolimit')){_0x564199[_0x84a2('0x21')]=qs[_0x84a2('0x21')](_0x1e6334[_0x84a2('0x35')][_0x84a2('0x21')]);_0x564199[_0x84a2('0x24')]=qs[_0x84a2('0x24')](_0x1e6334[_0x84a2('0x35')][_0x84a2('0x24')]);}_0x564199[_0x84a2('0x3e')]=qs[_0x84a2('0x3f')](_0x1e6334[_0x84a2('0x35')][_0x84a2('0x3f')]);_0x564199[_0x84a2('0x40')]=qs[_0x84a2('0x37')](_[_0x84a2('0x41')](_0x1e6334['query'],_0x235d99['filters']),_0x4ecd54);if(_0x1e6334['query'][_0x84a2('0x42')]){_0x564199[_0x84a2('0x40')]=_[_0x84a2('0x43')](_0x564199[_0x84a2('0x40')],{'$or':_[_0x84a2('0x32')](_0x4ecd54,function(_0x311a90){if(_0x311a90[_0x84a2('0x44')]!==_0x84a2('0x45')){var _0x1f30b8={};_0x1f30b8[_0x311a90[_0x84a2('0x2f')]]={'$like':'%'+_0x1e6334[_0x84a2('0x35')][_0x84a2('0x42')]+'%'};return _0x1f30b8;}})});}_0x564199=_[_0x84a2('0x43')]({},_0x564199,_0x1e6334[_0x84a2('0x46')]);var _0x5d54d9={'where':_0x564199[_0x84a2('0x40')]};return db[_0x84a2('0x33')]['count'](_0x5d54d9)[_0x84a2('0x2a')](function(_0x2feca2){_0x1242c5[_0x84a2('0x23')]=_0x2feca2;if(_0x1e6334[_0x84a2('0x35')][_0x84a2('0x47')]){_0x564199[_0x84a2('0x48')]=[{'all':!![]}];}return db[_0x84a2('0x33')][_0x84a2('0x49')](_0x564199);})[_0x84a2('0x2a')](function(_0x2dd8cd){_0x1242c5[_0x84a2('0x4a')]=_0x2dd8cd;return _0x1242c5;})[_0x84a2('0x2a')](respondWithFilteredResult(_0x4d0dc6,_0x564199))['catch'](handleError(_0x4d0dc6,null));};exports[_0x84a2('0x4b')]=function(_0x341b84,_0x2ddb02){var _0x475df7={'raw':![],'where':{'id':_0x341b84[_0x84a2('0x4c')]['id']}},_0x2cdda0={};_0x2cdda0[_0x84a2('0x3a')]=_[_0x84a2('0x36')](db[_0x84a2('0x33')]['rawAttributes']);_0x2cdda0['query']=_[_0x84a2('0x36')](_0x341b84['query']);_0x2cdda0[_0x84a2('0x37')]=_[_0x84a2('0x38')](_0x2cdda0[_0x84a2('0x3a')],_0x2cdda0['query']);_0x475df7[_0x84a2('0x39')]=_['intersection'](_0x2cdda0[_0x84a2('0x3a')],qs['fields'](_0x341b84[_0x84a2('0x35')]['fields']));_0x475df7[_0x84a2('0x39')]=_0x475df7['attributes'][_0x84a2('0x3c')]?_0x475df7[_0x84a2('0x39')]:_0x2cdda0[_0x84a2('0x3a')];if(_0x341b84[_0x84a2('0x35')][_0x84a2('0x47')]){_0x475df7[_0x84a2('0x48')]=[{'all':!![]}];}_0x475df7=_[_0x84a2('0x43')]({},_0x475df7,_0x341b84['options']);return db[_0x84a2('0x33')][_0x84a2('0x4d')](_0x475df7)['then'](handleEntityNotFound(_0x2ddb02,null))[_0x84a2('0x2a')](respondWithResult(_0x2ddb02,null))[_0x84a2('0x4e')](handleError(_0x2ddb02,null));};exports[_0x84a2('0x4f')]=function(_0x3dfb68,_0x18ef68){return db[_0x84a2('0x33')][_0x84a2('0x4f')](_0x3dfb68[_0x84a2('0x50')],{})[_0x84a2('0x2a')](function(_0x3e4c50){var _0x4cee78=_0x3dfb68[_0x84a2('0x51')]['get']({'plain':!![]});if(!_0x4cee78)throw new Error(_0x84a2('0x52'));if(_0x4cee78['role']===_0x84a2('0x51')){var _0x330d54=_0x3e4c50[_0x84a2('0x53')]({'plain':!![]});var _0x2193e7=_0x84a2('0x2c');return db[_0x84a2('0x54')][_0x84a2('0x4d')]({'where':{'name':_0x2193e7,'userProfileId':_0x4cee78['userProfileId']},'raw':!![]})['then'](function(_0x36f516){if(_0x36f516&&_0x36f516[_0x84a2('0x55')]===0x0){return db[_0x84a2('0x56')][_0x84a2('0x4f')]({'name':_0x330d54['name'],'resourceId':_0x330d54['id'],'type':_0x36f516[_0x84a2('0x2f')],'sectionId':_0x36f516['id']},{})[_0x84a2('0x2a')](function(){return _0x3e4c50;});}else{return _0x3e4c50;}})[_0x84a2('0x4e')](function(_0x5395c8){logger['error'](_0x84a2('0x57'),_0x5395c8);throw _0x5395c8;});}return _0x3e4c50;})['then'](respondWithResult(_0x18ef68,0xc9))[_0x84a2('0x4e')](handleError(_0x18ef68,null));};exports['update']=function(_0x4eaeff,_0x440037){if(_0x4eaeff[_0x84a2('0x50')]['id']){delete _0x4eaeff[_0x84a2('0x50')]['id'];}return db[_0x84a2('0x33')][_0x84a2('0x4d')]({'where':{'id':_0x4eaeff[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x440037,null))[_0x84a2('0x2a')](saveUpdates(_0x4eaeff[_0x84a2('0x50')],null))[_0x84a2('0x2a')](respondWithResult(_0x440037,null))['catch'](handleError(_0x440037,null));};exports[_0x84a2('0x2b')]=function(_0x47f27,_0x2ad66f){return db[_0x84a2('0x33')]['find']({'where':{'id':_0x47f27['params']['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x2ad66f,null))[_0x84a2('0x2a')](removeEntity(_0x2ad66f,null))['catch'](handleError(_0x2ad66f,null));};exports['describe']=function(_0x3463df,_0x22ca89){return db['CmList'][_0x84a2('0x58')]()[_0x84a2('0x2a')](respondWithResult(_0x22ca89,null))[_0x84a2('0x4e')](handleError(_0x22ca89,null));};exports[_0x84a2('0x59')]=function(_0x477155,_0x1351ac,_0xf60d3b){if(_0x477155[_0x84a2('0x50')]['id']){delete _0x477155[_0x84a2('0x50')]['id'];}return db[_0x84a2('0x33')][_0x84a2('0x4d')]({'where':{'id':_0x477155[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x1351ac,null))[_0x84a2('0x2a')](function(_0x29dec2){if(_0x29dec2){_0x477155[_0x84a2('0x50')][_0x84a2('0x5a')]=_0x29dec2['id'];return db[_0x84a2('0x5b')][_0x84a2('0x4f')](_0x477155['body']);}})[_0x84a2('0x2a')](respondWithResult(_0x1351ac,null))[_0x84a2('0x4e')](handleError(_0x1351ac,null));};exports[_0x84a2('0x5c')]=function(_0x12835a,_0x4f6298,_0xdd9479){var _0x3df54b={'raw':![],'where':{}};var _0x1913a9={};var _0x12298e={'count':0x0,'rows':[]};return db[_0x84a2('0x33')]['findOne']({'where':{'id':_0x12835a[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x4f6298,null))[_0x84a2('0x2a')](function(_0x25e3f2){if(_0x25e3f2){_0x1913a9['model']=_[_0x84a2('0x36')](db[_0x84a2('0x5b')]['rawAttributes']);_0x1913a9['query']=_[_0x84a2('0x36')](_0x12835a[_0x84a2('0x35')]);_0x1913a9[_0x84a2('0x37')]=_[_0x84a2('0x38')](_0x1913a9['model'],_0x1913a9[_0x84a2('0x35')]);_0x3df54b[_0x84a2('0x39')]=_['intersection'](_0x1913a9['model'],qs[_0x84a2('0x3b')](_0x12835a['query'][_0x84a2('0x3b')]));_0x3df54b[_0x84a2('0x39')]=_0x3df54b[_0x84a2('0x39')][_0x84a2('0x3c')]?_0x3df54b[_0x84a2('0x39')]:_0x1913a9[_0x84a2('0x3a')];if(!_0x12835a[_0x84a2('0x35')][_0x84a2('0x3d')]('nolimit')){_0x3df54b[_0x84a2('0x21')]=qs[_0x84a2('0x21')](_0x12835a[_0x84a2('0x35')][_0x84a2('0x21')]);_0x3df54b[_0x84a2('0x24')]=qs[_0x84a2('0x24')](_0x12835a[_0x84a2('0x35')]['offset']);}_0x3df54b[_0x84a2('0x3e')]=qs['sort'](_0x12835a['query'][_0x84a2('0x3f')]);_0x3df54b['where']=qs[_0x84a2('0x37')](_[_0x84a2('0x41')](_0x12835a[_0x84a2('0x35')],_0x1913a9[_0x84a2('0x37')]));_0x3df54b['where'][_0x84a2('0x5a')]=_0x25e3f2['id'];if(_0x12835a[_0x84a2('0x35')][_0x84a2('0x42')]){_0x3df54b[_0x84a2('0x40')]=_[_0x84a2('0x43')](_0x3df54b[_0x84a2('0x40')],{'$or':_[_0x84a2('0x32')](_0x3df54b['attributes'],function(_0x32c4da){var _0x358fe6={};_0x358fe6[_0x32c4da]={'$like':'%'+_0x12835a[_0x84a2('0x35')][_0x84a2('0x42')]+'%'};return _0x358fe6;})});}_0x3df54b=_['merge']({},_0x3df54b,_0x12835a[_0x84a2('0x46')]);return db[_0x84a2('0x5b')]['count']({'where':_0x3df54b[_0x84a2('0x40')]})[_0x84a2('0x2a')](function(_0x53e086){_0x12298e[_0x84a2('0x23')]=_0x53e086;if(_0x12835a['query']['includeAll']){_0x3df54b['include']=[{'all':!![]}];}return db[_0x84a2('0x5b')][_0x84a2('0x49')](_0x3df54b);})[_0x84a2('0x2a')](function(_0x13c5a5){_0x12298e[_0x84a2('0x4a')]=_0x13c5a5;return _0x12298e;});}})[_0x84a2('0x2a')](respondWithFilteredResult(_0x4f6298,_0x3df54b))[_0x84a2('0x4e')](handleError(_0x4f6298,null));};exports[_0x84a2('0x5d')]=function(_0x235cf3,_0x2d18b2,_0x5aa306){return db[_0x84a2('0x33')][_0x84a2('0x4d')]({'where':{'id':_0x235cf3[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x2d18b2,null))[_0x84a2('0x2a')](function(_0x1ad9b3){if(_0x1ad9b3){return _0x1ad9b3['removeDispositions'](_0x235cf3[_0x84a2('0x35')][_0x84a2('0x5e')]);}})[_0x84a2('0x2a')](respondWithStatusCode(_0x2d18b2,null))[_0x84a2('0x4e')](handleError(_0x2d18b2,null));};exports[_0x84a2('0x5f')]=function(_0x588e2a,_0x257dc7,_0x4e3343){return db['CmList'][_0x84a2('0x4d')]({'where':{'id':_0x588e2a['params']['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x257dc7,null))['then'](function(_0x5ba3e0){if(_0x5ba3e0){var _0x9bc017=[];var _0x4eaf47={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x84a2('0x2a')](function(_0x4d3314){if(_0x588e2a[_0x84a2('0x50')]['tags']&&_[_0x84a2('0x60')](_0x588e2a[_0x84a2('0x50')][_0x84a2('0x61')])){if(_0x588e2a[_0x84a2('0x50')][_0x84a2('0x61')][_0x84a2('0x3c')]){_0x588e2a[_0x84a2('0x50')]['tags']=_0x588e2a['body'][_0x84a2('0x61')][_0x84a2('0x62')](';')+';';}else{_0x588e2a['body']['tags']=null;}}else{_0x588e2a[_0x84a2('0x50')][_0x84a2('0x61')]=null;}if(_0x588e2a[_0x84a2('0x50')]&&_[_0x84a2('0x60')](_0x588e2a[_0x84a2('0x50')])){for(var _0x54bef2=0x0;_0x54bef2<_0x588e2a[_0x84a2('0x50')][_0x84a2('0x3c')];_0x54bef2+=0x1){_0x588e2a[_0x84a2('0x50')][_0x54bef2][_0x84a2('0x5a')]=_0x588e2a[_0x84a2('0x4c')]['id'];_0x9bc017[_0x84a2('0x63')](_0x588e2a[_0x84a2('0x50')][_0x54bef2]);}return BPromise[_0x84a2('0x64')](_0x9bc017,function(_0xb8fc94){return db['CmContact'][_0x84a2('0x4f')](_[_0x84a2('0x65')](_0xb8fc94,[_0x84a2('0x5e'),'id'])||{},{'fields':_['keys'](_0x4d3314),'raw':!![]})[_0x84a2('0x2a')](function(_0x2d96fd){_0x4eaf47[_0x84a2('0x66')][_0x84a2('0x63')](_0x2d96fd[_0x84a2('0x67')]);})[_0x84a2('0x4e')](function(_0x13343b){_0x4eaf47[_0x84a2('0x68')]['push']({'data':_0xb8fc94,'error':_0x13343b['message']});});})[_0x84a2('0x2a')](function(_0x1301ed){return _0x4eaf47;})[_0x84a2('0x4e')](function(_0x5edc73){return _0x5edc73;});}else{_0x257dc7[_0x84a2('0x1f')](0x190)['json']({'message':_0x84a2('0x69')});}});}})['then'](respondWithResult(_0x257dc7,null))[_0x84a2('0x4e')](handleError(_0x257dc7,null));};exports[_0x84a2('0x6a')]=function(_0x55926a,_0x364091,_0x12a81d){var _0x4ccc88;return db['CmList'][_0x84a2('0x4d')]({'where':{'id':_0x55926a['params']['id']},'include':[{'model':db[_0x84a2('0x6b')],'as':_0x84a2('0x6c')}]})[_0x84a2('0x2a')](handleEntityNotFound(_0x364091,null))['then'](function(_0x1fb2d6){if(_0x1fb2d6){_0x4ccc88=_0x1fb2d6;return db[_0x84a2('0x6d')][_0x84a2('0x34')];}})[_0x84a2('0x2a')](function(_0xe3fee0){if(_0xe3fee0){var _0x2e8b80={};var _0x40efc7={};_0x40efc7[_0x84a2('0x3a')]=_[_0x84a2('0x6e')](_[_0x84a2('0x36')](_0xe3fee0),_['map'](_0x4ccc88['CustomFields'],function(_0x3fc650){return util[_0x84a2('0x6f')](_0x84a2('0x70'),_0x3fc650['id']);}));_0x40efc7[_0x84a2('0x35')]=_[_0x84a2('0x36')](_0x55926a[_0x84a2('0x35')]);_0x40efc7[_0x84a2('0x37')]=_[_0x84a2('0x38')](_0x40efc7[_0x84a2('0x3a')],_0x40efc7[_0x84a2('0x35')]);_0x2e8b80[_0x84a2('0x39')]=_[_0x84a2('0x38')](_0x40efc7[_0x84a2('0x3a')],qs[_0x84a2('0x3b')](_0x55926a[_0x84a2('0x35')]['fields']));_0x2e8b80['attributes']=_0x2e8b80['attributes'][_0x84a2('0x3c')]?_0x2e8b80[_0x84a2('0x39')]:_0x40efc7[_0x84a2('0x3a')];if(!_0x55926a[_0x84a2('0x35')][_0x84a2('0x3d')]('nolimit')){_0x2e8b80[_0x84a2('0x21')]=qs[_0x84a2('0x21')](_0x55926a[_0x84a2('0x35')][_0x84a2('0x21')]);_0x2e8b80[_0x84a2('0x24')]=qs['offset'](_0x55926a[_0x84a2('0x35')][_0x84a2('0x24')]);}_0x2e8b80['order']=qs[_0x84a2('0x3f')](_0x55926a[_0x84a2('0x35')][_0x84a2('0x3f')]);_0x2e8b80['where']=qs[_0x84a2('0x37')](_[_0x84a2('0x41')](_0x55926a[_0x84a2('0x35')],_0x40efc7[_0x84a2('0x37')]));_0x2e8b80[_0x84a2('0x71')]=!![];if(_0x55926a[_0x84a2('0x35')][_0x84a2('0x42')]){_0x2e8b80[_0x84a2('0x40')]=_[_0x84a2('0x43')](_0x2e8b80[_0x84a2('0x40')],{'$or':_[_0x84a2('0x32')](_0x2e8b80[_0x84a2('0x39')],function(_0x10b72e){var _0x4b9776={};_0x4b9776[_0x10b72e]={'$like':'%'+_0x55926a[_0x84a2('0x35')][_0x84a2('0x42')]+'%'};return _0x4b9776;})});}_0x2e8b80=_[_0x84a2('0x43')]({},_0x2e8b80,_0x55926a[_0x84a2('0x46')]);return _0x4ccc88[_0x84a2('0x6a')](_0x2e8b80);}})[_0x84a2('0x2a')](respondWithResult(_0x364091,null))['catch'](handleError(_0x364091,null));};exports[_0x84a2('0x72')]=function(_0x2967d0,_0xb23fa4,_0x4b3508){var _0x121171;return db['CmList'][_0x84a2('0x4d')]({'where':{'id':_0x2967d0[_0x84a2('0x4c')]['id']},'include':[{'model':db[_0x84a2('0x6b')],'as':_0x84a2('0x6c')}]})[_0x84a2('0x2a')](handleEntityNotFound(_0xb23fa4,null))[_0x84a2('0x2a')](function(_0x363cd2){if(_0x363cd2){_0x121171=_0x363cd2;return db[_0x84a2('0x6d')][_0x84a2('0x34')];}})[_0x84a2('0x2a')](function(_0x228bbe){if(_0x228bbe){var _0x3ad98a={};var _0x21127c={};_0x21127c[_0x84a2('0x3a')]=_[_0x84a2('0x6e')](_[_0x84a2('0x36')](_0x228bbe),_[_0x84a2('0x32')](_0x121171[_0x84a2('0x6c')],function(_0x26005a){return util[_0x84a2('0x6f')](_0x84a2('0x70'),_0x26005a['id']);}));_0x21127c[_0x84a2('0x35')]=_['keys'](_0x2967d0[_0x84a2('0x35')]);_0x21127c[_0x84a2('0x37')]=_[_0x84a2('0x38')](_0x21127c[_0x84a2('0x3a')],_0x21127c[_0x84a2('0x35')]);_0x3ad98a[_0x84a2('0x39')]=_[_0x84a2('0x38')](_0x21127c[_0x84a2('0x3a')],qs['fields'](_0x2967d0['query'][_0x84a2('0x3b')]));_0x3ad98a['attributes']=_0x3ad98a[_0x84a2('0x39')][_0x84a2('0x3c')]?_0x3ad98a[_0x84a2('0x39')]:_0x21127c[_0x84a2('0x3a')];if(!_0x2967d0[_0x84a2('0x35')][_0x84a2('0x3d')]('nolimit')){_0x3ad98a[_0x84a2('0x21')]=qs['limit'](_0x2967d0[_0x84a2('0x35')][_0x84a2('0x21')]);_0x3ad98a['offset']=qs['offset'](_0x2967d0[_0x84a2('0x35')][_0x84a2('0x24')]);}_0x3ad98a['order']=qs[_0x84a2('0x3f')](_0x2967d0['query']['sort']);_0x3ad98a[_0x84a2('0x40')]=qs[_0x84a2('0x37')](_['pick'](_0x2967d0['query'],_0x21127c['filters']));_0x3ad98a[_0x84a2('0x71')]=!![];if(_0x2967d0['query'][_0x84a2('0x42')]){_0x3ad98a['where']=_[_0x84a2('0x43')](_0x3ad98a[_0x84a2('0x40')],{'$or':_['map'](_0x3ad98a[_0x84a2('0x39')],function(_0xe18a67){var _0x574cd9={};_0x574cd9[_0xe18a67]={'$like':'%'+_0x2967d0[_0x84a2('0x35')][_0x84a2('0x42')]+'%'};return _0x574cd9;})});}_0x3ad98a=_[_0x84a2('0x43')]({},_0x3ad98a,_0x2967d0[_0x84a2('0x46')]);return _0x121171[_0x84a2('0x6a')](_0x3ad98a);}})[_0x84a2('0x2a')](function(_0x481e1d){if(!_[_0x84a2('0x73')](_0x481e1d)){var _0x339867=toCsv(_0x481e1d);var _0x1a4d90=Date[_0x84a2('0x74')]();fs[_0x84a2('0x75')](util[_0x84a2('0x6f')](_0x84a2('0x76'),_0x121171['id'],_0x1a4d90),_0x339867);_0xb23fa4[_0x84a2('0x77')](_0x84a2('0x78'),_0x84a2('0x79')+util[_0x84a2('0x6f')]('list_%d_%s.csv',_0x121171['id'],_0x1a4d90));_0xb23fa4[_0x84a2('0x77')](_0x84a2('0x7a'),_0x84a2('0x7b'));return _0xb23fa4[_0x84a2('0x7c')](util['format']('/tmp/list_%d_%s.csv',_0x121171['id'],_0x1a4d90));}else{return _0xb23fa4['sendStatus'](0xcc);}})[_0x84a2('0x4e')](handleError(_0xb23fa4,null));};exports[_0x84a2('0x7d')]=function(_0x3b337b,_0x4d1e52,_0x1c4fa9){var _0x1b79e3;delete _0x3b337b[_0x84a2('0x50')]['id'];return db['CmList']['findOne']({'where':{'id':_0x3b337b[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x4d1e52,null))['then'](function(_0x268aa5){if(_0x268aa5){return db[_0x84a2('0x7e')][_0x84a2('0x7f')](function(_0x327d92){return db[_0x84a2('0x6b')]['create'](_0x3b337b[_0x84a2('0x50')],{'transaction':_0x327d92})['then'](function(_0x5419a7){_0x1b79e3=_0x5419a7;return _0x268aa5[_0x84a2('0x80')](_0x5419a7,{'transaction':_0x327d92});})[_0x84a2('0x2a')](function(){var _0x222460={'type':db[_0x84a2('0x81')][_0x84a2('0x82')],'transaction':_0x327d92};switch(_0x3b337b['body']['type']){case _0x84a2('0x83'):_0x222460['type']=db[_0x84a2('0x81')][_0x84a2('0x82')];break;case'number':_0x222460[_0x84a2('0x44')]=db[_0x84a2('0x81')][_0x84a2('0x84')];break;case _0x84a2('0x85'):_0x222460[_0x84a2('0x44')]=db[_0x84a2('0x81')][_0x84a2('0x86')];_0x222460[_0x84a2('0x87')]=![];break;default:}return db[_0x84a2('0x7e')]['queryInterface'][_0x84a2('0x88')](_0x84a2('0x89'),util[_0x84a2('0x6f')](_0x84a2('0x8a'),_0x1b79e3['id']),_0x222460);})[_0x84a2('0x2a')](function(){return _0x1b79e3;});});}})[_0x84a2('0x2a')](respondWithResult(_0x4d1e52,null))[_0x84a2('0x4e')](handleError(_0x4d1e52,null));};exports['getCustomFields']=function(_0x4bd127,_0x45f9e2,_0x324084){var _0x195c91={};var _0x37a259={};var _0x1361a1;var _0x41eb77;return db[_0x84a2('0x33')][_0x84a2('0x8b')]({'where':{'id':_0x4bd127['params']['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x45f9e2,null))[_0x84a2('0x2a')](function(_0x1d4d53){if(_0x1d4d53){_0x1361a1=_0x1d4d53;_0x37a259[_0x84a2('0x3a')]=_[_0x84a2('0x36')](db[_0x84a2('0x6b')][_0x84a2('0x34')]);_0x37a259[_0x84a2('0x35')]=_[_0x84a2('0x36')](_0x4bd127[_0x84a2('0x35')]);_0x37a259[_0x84a2('0x37')]=_[_0x84a2('0x38')](_0x37a259['model'],_0x37a259['query']);_0x195c91['attributes']=_[_0x84a2('0x38')](_0x37a259['model'],qs[_0x84a2('0x3b')](_0x4bd127[_0x84a2('0x35')]['fields']));_0x195c91[_0x84a2('0x39')]=_0x195c91[_0x84a2('0x39')]['length']?_0x195c91[_0x84a2('0x39')]:_0x37a259['model'];_0x195c91[_0x84a2('0x3e')]=qs[_0x84a2('0x3f')](_0x4bd127['query'][_0x84a2('0x3f')]);_0x195c91[_0x84a2('0x40')]=qs['filters'](_[_0x84a2('0x41')](_0x4bd127[_0x84a2('0x35')],_0x37a259['filters']));_0x195c91['where']=_[_0x84a2('0x43')](_0x195c91[_0x84a2('0x40')],{'$or':[{'ListId':_0x1d4d53['id']},{'ListId':null}]});if(_0x4bd127['query'][_0x84a2('0x42')]){_0x195c91[_0x84a2('0x40')]=_[_0x84a2('0x43')](_0x195c91['where'],{'$or':_[_0x84a2('0x32')](_0x195c91['attributes'],function(_0xd5119d){var _0x48a6be={};_0x48a6be[_0xd5119d]={'$like':'%'+_0x4bd127['query']['filter']+'%'};return _0x48a6be;})});}_0x195c91=_['merge']({},_0x195c91,_0x4bd127[_0x84a2('0x46')]);return db[_0x84a2('0x6b')][_0x84a2('0x8c')](_0x195c91);}})[_0x84a2('0x2a')](respondWithResult(_0x45f9e2,null))[_0x84a2('0x4e')](handleError(_0x45f9e2,null));};exports[_0x84a2('0x8d')]=function(_0x3fb3f0,_0x267546,_0x28d564){return db[_0x84a2('0x33')][_0x84a2('0x4d')]({'where':{'id':_0x3fb3f0[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x267546,null))[_0x84a2('0x2a')](function(_0x23e093){if(_0x23e093){return _0x23e093[_0x84a2('0x8d')](_0x3fb3f0[_0x84a2('0x50')][_0x84a2('0x5e')],_['omit'](_0x3fb3f0['body'],[_0x84a2('0x5e'),'id'])||{})[_0x84a2('0x8e')](function(_0x273f22){for(var _0x46522a=0x0;_0x46522a<_0x3fb3f0['body'][_0x84a2('0x5e')][_0x84a2('0x3c')];_0x46522a+=0x1){socket['emit'](_0x84a2('0x8f'),{'UserId':Number(_0x3fb3f0[_0x84a2('0x50')][_0x84a2('0x5e')][_0x46522a]),'CmListId':Number(_0x3fb3f0[_0x84a2('0x4c')]['id'])});}return _0x273f22;});}})[_0x84a2('0x2a')](respondWithResult(_0x267546,null))[_0x84a2('0x4e')](handleError(_0x267546,null));};exports[_0x84a2('0x90')]=function(_0x1bd5d2,_0x3cf6e8,_0x2510b7){return db[_0x84a2('0x33')]['find']({'where':{'id':_0x1bd5d2[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x3cf6e8,null))['then'](function(_0xd4b174){if(_0xd4b174){return _0xd4b174[_0x84a2('0x90')](_0x1bd5d2[_0x84a2('0x35')]['ids'])[_0x84a2('0x2a')](function(){if(_[_0x84a2('0x60')](_0x1bd5d2[_0x84a2('0x35')][_0x84a2('0x5e')])){for(var _0x1ed236=0x0;_0x1ed236<_0x1bd5d2[_0x84a2('0x35')][_0x84a2('0x5e')][_0x84a2('0x3c')];_0x1ed236+=0x1){socket[_0x84a2('0x91')](_0x84a2('0x92'),{'UserId':Number(_0x1bd5d2[_0x84a2('0x35')][_0x84a2('0x5e')][_0x1ed236]),'CmListId':Number(_0x1bd5d2[_0x84a2('0x4c')]['id'])});}}else{socket[_0x84a2('0x91')](_0x84a2('0x92'),{'UserId':Number(_0x1bd5d2[_0x84a2('0x35')][_0x84a2('0x5e')]),'CmListId':Number(_0x1bd5d2[_0x84a2('0x4c')]['id'])});}});}})[_0x84a2('0x2a')](respondWithStatusCode(_0x3cf6e8,null))[_0x84a2('0x4e')](handleError(_0x3cf6e8,null));};exports[_0x84a2('0x93')]=function(_0x2b2123,_0x536c5f,_0x2e277e){var _0x370e72={};var _0x2663ec={};var _0x1da1ec;var _0x448d2b;return db['CmList'][_0x84a2('0x8b')]({'where':{'id':_0x2b2123[_0x84a2('0x4c')]['id']}})[_0x84a2('0x2a')](handleEntityNotFound(_0x536c5f,null))[_0x84a2('0x2a')](function(_0x2aa421){if(_0x2aa421){_0x1da1ec=_0x2aa421;_0x2663ec[_0x84a2('0x3a')]=_[_0x84a2('0x36')](db['User'][_0x84a2('0x34')]);_0x2663ec['query']=_[_0x84a2('0x36')](_0x2b2123[_0x84a2('0x35')]);_0x2663ec[_0x84a2('0x37')]=_[_0x84a2('0x38')](_0x2663ec[_0x84a2('0x3a')],_0x2663ec['query']);_0x370e72[_0x84a2('0x39')]=_[_0x84a2('0x38')](_0x2663ec[_0x84a2('0x3a')],qs[_0x84a2('0x3b')](_0x2b2123['query']['fields']));_0x370e72[_0x84a2('0x39')]=_0x370e72[_0x84a2('0x39')]['length']?_0x370e72['attributes']:_0x2663ec[_0x84a2('0x3a')];_0x370e72['order']=qs[_0x84a2('0x3f')](_0x2b2123['query'][_0x84a2('0x3f')]);_0x370e72[_0x84a2('0x40')]=qs[_0x84a2('0x37')](_[_0x84a2('0x41')](_0x2b2123[_0x84a2('0x35')],_0x2663ec[_0x84a2('0x37')]));if(_0x2b2123['query'][_0x84a2('0x42')]){_0x370e72[_0x84a2('0x40')]=_[_0x84a2('0x43')](_0x370e72[_0x84a2('0x40')],{'$or':_['map'](_0x370e72[_0x84a2('0x39')],function(_0x3edcf5){var _0x205d57={};_0x205d57[_0x3edcf5]={'$like':'%'+_0x2b2123['query']['filter']+'%'};return _0x205d57;})});}_0x370e72=_[_0x84a2('0x43')]({},_0x370e72,_0x2b2123['options']);return _0x1da1ec['getAgents'](_0x370e72);}})[_0x84a2('0x2a')](function(_0x1292a0){if(_0x1292a0){_0x448d2b=_0x1292a0[_0x84a2('0x3c')];if(!_0x2b2123[_0x84a2('0x35')][_0x84a2('0x3d')](_0x84a2('0x94'))){_0x370e72[_0x84a2('0x21')]=qs[_0x84a2('0x21')](_0x2b2123['query'][_0x84a2('0x21')]);_0x370e72[_0x84a2('0x24')]=qs[_0x84a2('0x24')](_0x2b2123[_0x84a2('0x35')]['offset']);}return _0x1da1ec[_0x84a2('0x93')](_0x370e72);}})['then'](function(_0x5aabd8){if(_0x5aabd8){return _0x5aabd8?{'count':_0x448d2b,'rows':_0x5aabd8}:null;}})[_0x84a2('0x2a')](respondWithResult(_0x536c5f,null))[_0x84a2('0x4e')](handleError(_0x536c5f,null));}; \ No newline at end of file +var _0xfbb8=['findOne','ListId','merge','removeDispositions','addContacts','CmContact','tags','isArray','push','success','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','ids','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','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','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','findAll','rows','catch','show','params','keys','length','includeAll','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0xfbb8,0x160));var _0x8fbb=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0xfbb8[_0xf4129c];return _0x426611;};'use strict';var emlformat=require(_0x8fbb('0x0'));var rimraf=require(_0x8fbb('0x1'));var zipdir=require(_0x8fbb('0x2'));var jsonpatch=require(_0x8fbb('0x3'));var rp=require('request-promise');var moment=require(_0x8fbb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8fbb('0x5'));var util=require(_0x8fbb('0x6'));var path=require('path');var sox=require(_0x8fbb('0x7'));var csv=require('to-csv');var ejs=require(_0x8fbb('0x8'));var fs=require('fs');var fs_extra=require(_0x8fbb('0x9'));var _=require('lodash');var squel=require(_0x8fbb('0xa'));var crypto=require('crypto');var jsforce=require(_0x8fbb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8fbb('0xc'));var querystring=require(_0x8fbb('0xd'));var Papa=require(_0x8fbb('0xe'));var Redis=require(_0x8fbb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8fbb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fbb('0x11'));var logger=require(_0x8fbb('0x12'))(_0x8fbb('0x13'));var utils=require(_0x8fbb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8fbb('0x15'));var db=require(_0x8fbb('0x16'))['db'];config[_0x8fbb('0x17')]=_[_0x8fbb('0x18')](config[_0x8fbb('0x17')],{'host':_0x8fbb('0x19'),'port':0x18eb});var socket=require(_0x8fbb('0x1a'))(new Redis(config[_0x8fbb('0x17')]));require(_0x8fbb('0x1b'))[_0x8fbb('0x1c')](socket);function respondWithStatusCode(_0x2b449f,_0x295f5a){_0x295f5a=_0x295f5a||0xcc;return function(_0x463192){if(_0x463192){return _0x2b449f[_0x8fbb('0x1d')](_0x295f5a);}return _0x2b449f[_0x8fbb('0x1e')](_0x295f5a)[_0x8fbb('0x1f')]();};}function respondWithResult(_0x2e8dbb,_0x425cd2){_0x425cd2=_0x425cd2||0xc8;return function(_0x3c2ded){if(_0x3c2ded){return _0x2e8dbb['status'](_0x425cd2)[_0x8fbb('0x20')](_0x3c2ded);}};}function respondWithFilteredResult(_0x58a769,_0x387ed5){return function(_0x4f5f65){if(_0x4f5f65){var _0x198eac=typeof _0x387ed5[_0x8fbb('0x21')]===_0x8fbb('0x22')&&typeof _0x387ed5[_0x8fbb('0x23')]===_0x8fbb('0x22');var _0x3503f7=_0x4f5f65[_0x8fbb('0x24')];var _0x1293e6=_0x198eac?0x0:_0x387ed5[_0x8fbb('0x21')];var _0x40a88c=_0x198eac?_0x4f5f65[_0x8fbb('0x24')]:_0x387ed5[_0x8fbb('0x21')]+_0x387ed5[_0x8fbb('0x23')];var _0x3432a5;if(_0x40a88c>=_0x3503f7){_0x40a88c=_0x3503f7;_0x3432a5=0xc8;}else{_0x3432a5=0xce;}_0x58a769[_0x8fbb('0x1e')](_0x3432a5);return _0x58a769[_0x8fbb('0x25')](_0x8fbb('0x26'),_0x1293e6+'-'+_0x40a88c+'/'+_0x3503f7)[_0x8fbb('0x20')](_0x4f5f65);}return null;};}function patchUpdates(_0x22891e){return function(_0x1c0f22){try{jsonpatch['apply'](_0x1c0f22,_0x22891e,!![]);}catch(_0x388588){return BPromise[_0x8fbb('0x27')](_0x388588);}return _0x1c0f22[_0x8fbb('0x28')]();};}function saveUpdates(_0x1ef2c2,_0x446b7f){return function(_0x4580d6){if(_0x4580d6){return _0x4580d6[_0x8fbb('0x29')](_0x1ef2c2)[_0x8fbb('0x2a')](function(_0x5246db){return _0x5246db;});}return null;};}function removeEntity(_0x2c411f,_0x1ae994){return function(_0x101214){if(_0x101214){return _0x101214[_0x8fbb('0x2b')]()['then'](function(){var _0x2d03c3=_0x101214[_0x8fbb('0x2c')]({'plain':!![]});var _0x4607ae=_0x8fbb('0x2d');return db[_0x8fbb('0x2e')]['destroy']({'where':{'type':_0x4607ae,'resourceId':_0x2d03c3['id']}})['then'](function(){return _0x101214;});})[_0x8fbb('0x2a')](function(){_0x2c411f['status'](0xcc)[_0x8fbb('0x1f')]();});}};}function handleEntityNotFound(_0x68943f,_0x58081b){return function(_0x258404){if(!_0x258404){_0x68943f[_0x8fbb('0x1d')](0x194);}return _0x258404;};}function handleError(_0xc1b0c5,_0x461cdd){_0x461cdd=_0x461cdd||0x1f4;return function(_0x535017){logger[_0x8fbb('0x2f')](_0x535017[_0x8fbb('0x30')]);if(_0x535017['name']){delete _0x535017[_0x8fbb('0x31')];}_0xc1b0c5[_0x8fbb('0x1e')](_0x461cdd)[_0x8fbb('0x32')](_0x535017);};}exports[_0x8fbb('0x33')]=function(_0x320fe8,_0x18b782){var _0x37386a={},_0x3ede53={},_0x3297d6={'count':0x0,'rows':[]};var _0x4421d0=_[_0x8fbb('0x34')](db[_0x8fbb('0x35')][_0x8fbb('0x36')],function(_0x2b69ae){return{'name':_0x2b69ae[_0x8fbb('0x37')],'type':_0x2b69ae[_0x8fbb('0x38')]['key']};});_0x3ede53[_0x8fbb('0x39')]=_[_0x8fbb('0x34')](_0x4421d0,_0x8fbb('0x31'));_0x3ede53[_0x8fbb('0x3a')]=_['keys'](_0x320fe8[_0x8fbb('0x3a')]);_0x3ede53[_0x8fbb('0x3b')]=_[_0x8fbb('0x3c')](_0x3ede53[_0x8fbb('0x39')],_0x3ede53[_0x8fbb('0x3a')]);_0x37386a['attributes']=_[_0x8fbb('0x3c')](_0x3ede53[_0x8fbb('0x39')],qs[_0x8fbb('0x3d')](_0x320fe8[_0x8fbb('0x3a')][_0x8fbb('0x3d')]));_0x37386a['attributes']=_0x37386a[_0x8fbb('0x3e')]['length']?_0x37386a[_0x8fbb('0x3e')]:_0x3ede53[_0x8fbb('0x39')];if(!_0x320fe8['query'][_0x8fbb('0x3f')](_0x8fbb('0x40'))){_0x37386a[_0x8fbb('0x23')]=qs[_0x8fbb('0x23')](_0x320fe8[_0x8fbb('0x3a')][_0x8fbb('0x23')]);_0x37386a[_0x8fbb('0x21')]=qs[_0x8fbb('0x21')](_0x320fe8[_0x8fbb('0x3a')]['offset']);}_0x37386a[_0x8fbb('0x41')]=qs[_0x8fbb('0x42')](_0x320fe8[_0x8fbb('0x3a')]['sort']);_0x37386a[_0x8fbb('0x43')]=qs[_0x8fbb('0x3b')](_[_0x8fbb('0x44')](_0x320fe8[_0x8fbb('0x3a')],_0x3ede53[_0x8fbb('0x3b')]),_0x4421d0);if(_0x320fe8[_0x8fbb('0x3a')][_0x8fbb('0x45')]){_0x37386a[_0x8fbb('0x43')]=_['merge'](_0x37386a[_0x8fbb('0x43')],{'$or':_[_0x8fbb('0x34')](_0x4421d0,function(_0x30905e){if(_0x30905e[_0x8fbb('0x38')]!==_0x8fbb('0x46')){var _0x48ceee={};_0x48ceee[_0x30905e[_0x8fbb('0x31')]]={'$like':'%'+_0x320fe8['query']['filter']+'%'};return _0x48ceee;}})});}_0x37386a=_['merge']({},_0x37386a,_0x320fe8['options']);var _0x18f7e2={'where':_0x37386a['where']};return db[_0x8fbb('0x35')][_0x8fbb('0x24')](_0x18f7e2)[_0x8fbb('0x2a')](function(_0x1fb458){_0x3297d6[_0x8fbb('0x24')]=_0x1fb458;if(_0x320fe8['query']['includeAll']){_0x37386a['include']=[{'all':!![]}];}return db[_0x8fbb('0x35')][_0x8fbb('0x47')](_0x37386a);})[_0x8fbb('0x2a')](function(_0x849ce8){_0x3297d6[_0x8fbb('0x48')]=_0x849ce8;return _0x3297d6;})[_0x8fbb('0x2a')](respondWithFilteredResult(_0x18b782,_0x37386a))[_0x8fbb('0x49')](handleError(_0x18b782,null));};exports[_0x8fbb('0x4a')]=function(_0x304f32,_0x1456e3){var _0x587408={'raw':![],'where':{'id':_0x304f32[_0x8fbb('0x4b')]['id']}},_0x1fb3d2={};_0x1fb3d2['model']=_[_0x8fbb('0x4c')](db['CmList']['rawAttributes']);_0x1fb3d2['query']=_['keys'](_0x304f32[_0x8fbb('0x3a')]);_0x1fb3d2['filters']=_[_0x8fbb('0x3c')](_0x1fb3d2[_0x8fbb('0x39')],_0x1fb3d2[_0x8fbb('0x3a')]);_0x587408[_0x8fbb('0x3e')]=_['intersection'](_0x1fb3d2[_0x8fbb('0x39')],qs[_0x8fbb('0x3d')](_0x304f32['query']['fields']));_0x587408[_0x8fbb('0x3e')]=_0x587408[_0x8fbb('0x3e')][_0x8fbb('0x4d')]?_0x587408['attributes']:_0x1fb3d2[_0x8fbb('0x39')];if(_0x304f32['query'][_0x8fbb('0x4e')]){_0x587408[_0x8fbb('0x4f')]=[{'all':!![]}];}_0x587408=_['merge']({},_0x587408,_0x304f32[_0x8fbb('0x50')]);return db[_0x8fbb('0x35')]['find'](_0x587408)['then'](handleEntityNotFound(_0x1456e3,null))[_0x8fbb('0x2a')](respondWithResult(_0x1456e3,null))[_0x8fbb('0x49')](handleError(_0x1456e3,null));};exports[_0x8fbb('0x51')]=function(_0x2f2006,_0xe55599){return db[_0x8fbb('0x35')][_0x8fbb('0x51')](_0x2f2006['body'],{})[_0x8fbb('0x2a')](function(_0x43aadf){var _0x5c76f9=_0x2f2006[_0x8fbb('0x52')][_0x8fbb('0x2c')]({'plain':!![]});if(!_0x5c76f9)throw new Error(_0x8fbb('0x53'));if(_0x5c76f9['role']==='user'){var _0xc3979a=_0x43aadf['get']({'plain':!![]});var _0x937dd8=_0x8fbb('0x2d');return db[_0x8fbb('0x54')][_0x8fbb('0x55')]({'where':{'name':_0x937dd8,'userProfileId':_0x5c76f9[_0x8fbb('0x56')]},'raw':!![]})[_0x8fbb('0x2a')](function(_0x49831b){if(_0x49831b&&_0x49831b['autoAssociation']===0x0){return db[_0x8fbb('0x2e')][_0x8fbb('0x51')]({'name':_0xc3979a[_0x8fbb('0x31')],'resourceId':_0xc3979a['id'],'type':_0x49831b['name'],'sectionId':_0x49831b['id']},{})[_0x8fbb('0x2a')](function(){return _0x43aadf;});}else{return _0x43aadf;}})[_0x8fbb('0x49')](function(_0x37d858){logger[_0x8fbb('0x2f')](_0x8fbb('0x57'),_0x37d858);throw _0x37d858;});}return _0x43aadf;})['then'](respondWithResult(_0xe55599,0xc9))[_0x8fbb('0x49')](handleError(_0xe55599,null));};exports[_0x8fbb('0x29')]=function(_0x1fb2e9,_0x5cef7f){if(_0x1fb2e9[_0x8fbb('0x58')]['id']){delete _0x1fb2e9['body']['id'];}return db['CmList'][_0x8fbb('0x55')]({'where':{'id':_0x1fb2e9[_0x8fbb('0x4b')]['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x5cef7f,null))[_0x8fbb('0x2a')](saveUpdates(_0x1fb2e9['body'],null))[_0x8fbb('0x2a')](respondWithResult(_0x5cef7f,null))['catch'](handleError(_0x5cef7f,null));};exports[_0x8fbb('0x2b')]=function(_0xee24c7,_0x248014){return db[_0x8fbb('0x35')][_0x8fbb('0x55')]({'where':{'id':_0xee24c7['params']['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x248014,null))['then'](removeEntity(_0x248014,null))[_0x8fbb('0x49')](handleError(_0x248014,null));};exports[_0x8fbb('0x59')]=function(_0x31aae4,_0x5e3888){return db[_0x8fbb('0x35')][_0x8fbb('0x59')]()[_0x8fbb('0x2a')](respondWithResult(_0x5e3888,null))[_0x8fbb('0x49')](handleError(_0x5e3888,null));};exports[_0x8fbb('0x5a')]=function(_0x1ee8a4,_0x5582c8,_0x30468b){if(_0x1ee8a4[_0x8fbb('0x58')]['id']){delete _0x1ee8a4[_0x8fbb('0x58')]['id'];}return db[_0x8fbb('0x35')][_0x8fbb('0x55')]({'where':{'id':_0x1ee8a4[_0x8fbb('0x4b')]['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x5582c8,null))[_0x8fbb('0x2a')](function(_0x3fcd78){if(_0x3fcd78){_0x1ee8a4[_0x8fbb('0x58')]['ListId']=_0x3fcd78['id'];return db[_0x8fbb('0x5b')][_0x8fbb('0x51')](_0x1ee8a4[_0x8fbb('0x58')]);}})[_0x8fbb('0x2a')](respondWithResult(_0x5582c8,null))[_0x8fbb('0x49')](handleError(_0x5582c8,null));};exports['getDispositions']=function(_0x1d172e,_0x478cb2,_0x59d985){var _0xcef8a7={'raw':![],'where':{}};var _0x32cf71={};var _0x4b7cc7={'count':0x0,'rows':[]};return db[_0x8fbb('0x35')][_0x8fbb('0x5c')]({'where':{'id':_0x1d172e['params']['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x478cb2,null))[_0x8fbb('0x2a')](function(_0x33e86){if(_0x33e86){_0x32cf71[_0x8fbb('0x39')]=_[_0x8fbb('0x4c')](db[_0x8fbb('0x5b')][_0x8fbb('0x36')]);_0x32cf71[_0x8fbb('0x3a')]=_['keys'](_0x1d172e[_0x8fbb('0x3a')]);_0x32cf71['filters']=_[_0x8fbb('0x3c')](_0x32cf71[_0x8fbb('0x39')],_0x32cf71[_0x8fbb('0x3a')]);_0xcef8a7['attributes']=_[_0x8fbb('0x3c')](_0x32cf71[_0x8fbb('0x39')],qs[_0x8fbb('0x3d')](_0x1d172e[_0x8fbb('0x3a')][_0x8fbb('0x3d')]));_0xcef8a7['attributes']=_0xcef8a7[_0x8fbb('0x3e')][_0x8fbb('0x4d')]?_0xcef8a7[_0x8fbb('0x3e')]:_0x32cf71['model'];if(!_0x1d172e[_0x8fbb('0x3a')][_0x8fbb('0x3f')]('nolimit')){_0xcef8a7['limit']=qs[_0x8fbb('0x23')](_0x1d172e['query'][_0x8fbb('0x23')]);_0xcef8a7['offset']=qs['offset'](_0x1d172e[_0x8fbb('0x3a')][_0x8fbb('0x21')]);}_0xcef8a7[_0x8fbb('0x41')]=qs[_0x8fbb('0x42')](_0x1d172e[_0x8fbb('0x3a')]['sort']);_0xcef8a7[_0x8fbb('0x43')]=qs['filters'](_['pick'](_0x1d172e[_0x8fbb('0x3a')],_0x32cf71['filters']));_0xcef8a7[_0x8fbb('0x43')][_0x8fbb('0x5d')]=_0x33e86['id'];if(_0x1d172e['query'][_0x8fbb('0x45')]){_0xcef8a7[_0x8fbb('0x43')]=_[_0x8fbb('0x5e')](_0xcef8a7['where'],{'$or':_[_0x8fbb('0x34')](_0xcef8a7[_0x8fbb('0x3e')],function(_0x2c7009){var _0x282543={};_0x282543[_0x2c7009]={'$like':'%'+_0x1d172e['query']['filter']+'%'};return _0x282543;})});}_0xcef8a7=_['merge']({},_0xcef8a7,_0x1d172e[_0x8fbb('0x50')]);return db[_0x8fbb('0x5b')][_0x8fbb('0x24')]({'where':_0xcef8a7['where']})[_0x8fbb('0x2a')](function(_0x25877b){_0x4b7cc7[_0x8fbb('0x24')]=_0x25877b;if(_0x1d172e['query'][_0x8fbb('0x4e')]){_0xcef8a7['include']=[{'all':!![]}];}return db[_0x8fbb('0x5b')][_0x8fbb('0x47')](_0xcef8a7);})[_0x8fbb('0x2a')](function(_0x554440){_0x4b7cc7['rows']=_0x554440;return _0x4b7cc7;});}})[_0x8fbb('0x2a')](respondWithFilteredResult(_0x478cb2,_0xcef8a7))[_0x8fbb('0x49')](handleError(_0x478cb2,null));};exports[_0x8fbb('0x5f')]=function(_0x37d832,_0x1079b4,_0x30c502){return db[_0x8fbb('0x35')]['find']({'where':{'id':_0x37d832['params']['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x1079b4,null))[_0x8fbb('0x2a')](function(_0x2c9777){if(_0x2c9777){return _0x2c9777[_0x8fbb('0x5f')](_0x37d832[_0x8fbb('0x3a')]['ids']);}})[_0x8fbb('0x2a')](respondWithStatusCode(_0x1079b4,null))[_0x8fbb('0x49')](handleError(_0x1079b4,null));};exports[_0x8fbb('0x60')]=function(_0x198263,_0xac9b86,_0x25111a){return db['CmList'][_0x8fbb('0x55')]({'where':{'id':_0x198263[_0x8fbb('0x4b')]['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0xac9b86,null))[_0x8fbb('0x2a')](function(_0x2ab985){if(_0x2ab985){var _0x47d7dd=[];var _0x501f58={'success':[],'errors':[]};return db[_0x8fbb('0x61')][_0x8fbb('0x59')]()[_0x8fbb('0x2a')](function(_0x5656b1){if(_0x198263[_0x8fbb('0x58')][_0x8fbb('0x62')]&&_[_0x8fbb('0x63')](_0x198263[_0x8fbb('0x58')]['tags'])){if(_0x198263[_0x8fbb('0x58')][_0x8fbb('0x62')][_0x8fbb('0x4d')]){_0x198263[_0x8fbb('0x58')][_0x8fbb('0x62')]=_0x198263[_0x8fbb('0x58')]['tags']['join'](';')+';';}else{_0x198263[_0x8fbb('0x58')][_0x8fbb('0x62')]=null;}}else{_0x198263[_0x8fbb('0x58')][_0x8fbb('0x62')]=null;}if(_0x198263[_0x8fbb('0x58')]&&_['isArray'](_0x198263['body'])){for(var _0x183a29=0x0;_0x183a29<_0x198263['body'][_0x8fbb('0x4d')];_0x183a29+=0x1){_0x198263[_0x8fbb('0x58')][_0x183a29]['ListId']=_0x198263[_0x8fbb('0x4b')]['id'];_0x47d7dd[_0x8fbb('0x64')](_0x198263[_0x8fbb('0x58')][_0x183a29]);}return BPromise['each'](_0x47d7dd,function(_0x35b6c0){return db[_0x8fbb('0x61')][_0x8fbb('0x51')](_['omit'](_0x35b6c0,['ids','id'])||{},{'fields':_[_0x8fbb('0x4c')](_0x5656b1),'raw':!![]})[_0x8fbb('0x2a')](function(_0x58d1e2){_0x501f58[_0x8fbb('0x65')][_0x8fbb('0x64')](_0x58d1e2['dataValues']);})[_0x8fbb('0x49')](function(_0x4c0573){_0x501f58[_0x8fbb('0x66')][_0x8fbb('0x64')]({'data':_0x35b6c0,'error':_0x4c0573['message']});});})[_0x8fbb('0x2a')](function(_0x1ad6be){return _0x501f58;})[_0x8fbb('0x49')](function(_0x4e2dfe){return _0x4e2dfe;});}else{_0xac9b86[_0x8fbb('0x1e')](0x190)[_0x8fbb('0x20')]({'message':_0x8fbb('0x67')});}});}})['then'](respondWithResult(_0xac9b86,null))[_0x8fbb('0x49')](handleError(_0xac9b86,null));};exports[_0x8fbb('0x68')]=function(_0x185826,_0x214f18,_0x4255c7){var _0x1af251;return db[_0x8fbb('0x35')]['find']({'where':{'id':_0x185826[_0x8fbb('0x4b')]['id']},'include':[{'model':db[_0x8fbb('0x69')],'as':_0x8fbb('0x6a')}]})['then'](handleEntityNotFound(_0x214f18,null))['then'](function(_0x5adfee){if(_0x5adfee){_0x1af251=_0x5adfee;return db[_0x8fbb('0x61')]['rawAttributes'];}})[_0x8fbb('0x2a')](function(_0x225b39){if(_0x225b39){var _0xae1825={};var _0xd85a8a={};_0xd85a8a[_0x8fbb('0x39')]=_[_0x8fbb('0x6b')](_['keys'](_0x225b39),_[_0x8fbb('0x34')](_0x1af251[_0x8fbb('0x6a')],function(_0x69f7a){return util['format'](_0x8fbb('0x6c'),_0x69f7a['id']);}));_0xd85a8a[_0x8fbb('0x3a')]=_[_0x8fbb('0x4c')](_0x185826['query']);_0xd85a8a[_0x8fbb('0x3b')]=_['intersection'](_0xd85a8a[_0x8fbb('0x39')],_0xd85a8a[_0x8fbb('0x3a')]);_0xae1825[_0x8fbb('0x3e')]=_[_0x8fbb('0x3c')](_0xd85a8a['model'],qs[_0x8fbb('0x3d')](_0x185826['query']['fields']));_0xae1825['attributes']=_0xae1825[_0x8fbb('0x3e')][_0x8fbb('0x4d')]?_0xae1825[_0x8fbb('0x3e')]:_0xd85a8a['model'];if(!_0x185826[_0x8fbb('0x3a')][_0x8fbb('0x3f')](_0x8fbb('0x40'))){_0xae1825[_0x8fbb('0x23')]=qs[_0x8fbb('0x23')](_0x185826[_0x8fbb('0x3a')][_0x8fbb('0x23')]);_0xae1825[_0x8fbb('0x21')]=qs[_0x8fbb('0x21')](_0x185826['query']['offset']);}_0xae1825[_0x8fbb('0x41')]=qs[_0x8fbb('0x42')](_0x185826[_0x8fbb('0x3a')]['sort']);_0xae1825[_0x8fbb('0x43')]=qs[_0x8fbb('0x3b')](_[_0x8fbb('0x44')](_0x185826[_0x8fbb('0x3a')],_0xd85a8a['filters']));_0xae1825[_0x8fbb('0x6d')]=!![];if(_0x185826['query'][_0x8fbb('0x45')]){_0xae1825[_0x8fbb('0x43')]=_['merge'](_0xae1825[_0x8fbb('0x43')],{'$or':_['map'](_0xae1825['attributes'],function(_0x14ca98){var _0x43c975={};_0x43c975[_0x14ca98]={'$like':'%'+_0x185826[_0x8fbb('0x3a')][_0x8fbb('0x45')]+'%'};return _0x43c975;})});}_0xae1825=_[_0x8fbb('0x5e')]({},_0xae1825,_0x185826['options']);return _0x1af251['getContacts'](_0xae1825);}})[_0x8fbb('0x2a')](respondWithResult(_0x214f18,null))[_0x8fbb('0x49')](handleError(_0x214f18,null));};exports[_0x8fbb('0x6e')]=function(_0x50f924,_0x22ad17,_0x9d05c4){var _0x5a32e8;return db[_0x8fbb('0x35')][_0x8fbb('0x55')]({'where':{'id':_0x50f924['params']['id']},'include':[{'model':db[_0x8fbb('0x69')],'as':_0x8fbb('0x6a')}]})[_0x8fbb('0x2a')](handleEntityNotFound(_0x22ad17,null))[_0x8fbb('0x2a')](function(_0x41bbd1){if(_0x41bbd1){_0x5a32e8=_0x41bbd1;return db[_0x8fbb('0x61')][_0x8fbb('0x36')];}})[_0x8fbb('0x2a')](function(_0x257910){if(_0x257910){var _0x3d352e={};var _0x2356ea={};_0x2356ea[_0x8fbb('0x39')]=_['concat'](_['keys'](_0x257910),_[_0x8fbb('0x34')](_0x5a32e8[_0x8fbb('0x6a')],function(_0xcf0f7a){return util[_0x8fbb('0x6f')](_0x8fbb('0x6c'),_0xcf0f7a['id']);}));_0x2356ea[_0x8fbb('0x3a')]=_[_0x8fbb('0x4c')](_0x50f924[_0x8fbb('0x3a')]);_0x2356ea['filters']=_[_0x8fbb('0x3c')](_0x2356ea['model'],_0x2356ea[_0x8fbb('0x3a')]);_0x3d352e['attributes']=_[_0x8fbb('0x3c')](_0x2356ea['model'],qs[_0x8fbb('0x3d')](_0x50f924[_0x8fbb('0x3a')][_0x8fbb('0x3d')]));_0x3d352e[_0x8fbb('0x3e')]=_0x3d352e[_0x8fbb('0x3e')]['length']?_0x3d352e[_0x8fbb('0x3e')]:_0x2356ea[_0x8fbb('0x39')];if(!_0x50f924[_0x8fbb('0x3a')][_0x8fbb('0x3f')](_0x8fbb('0x40'))){_0x3d352e[_0x8fbb('0x23')]=qs[_0x8fbb('0x23')](_0x50f924[_0x8fbb('0x3a')][_0x8fbb('0x23')]);_0x3d352e[_0x8fbb('0x21')]=qs['offset'](_0x50f924['query'][_0x8fbb('0x21')]);}_0x3d352e[_0x8fbb('0x41')]=qs[_0x8fbb('0x42')](_0x50f924['query'][_0x8fbb('0x42')]);_0x3d352e[_0x8fbb('0x43')]=qs[_0x8fbb('0x3b')](_[_0x8fbb('0x44')](_0x50f924[_0x8fbb('0x3a')],_0x2356ea[_0x8fbb('0x3b')]));_0x3d352e['raw']=!![];if(_0x50f924[_0x8fbb('0x3a')][_0x8fbb('0x45')]){_0x3d352e[_0x8fbb('0x43')]=_[_0x8fbb('0x5e')](_0x3d352e[_0x8fbb('0x43')],{'$or':_['map'](_0x3d352e['attributes'],function(_0x22d0be){var _0x1bf5a7={};_0x1bf5a7[_0x22d0be]={'$like':'%'+_0x50f924[_0x8fbb('0x3a')][_0x8fbb('0x45')]+'%'};return _0x1bf5a7;})});}_0x3d352e=_['merge']({},_0x3d352e,_0x50f924['options']);return _0x5a32e8[_0x8fbb('0x68')](_0x3d352e);}})[_0x8fbb('0x2a')](function(_0xefe5b5){if(!_[_0x8fbb('0x70')](_0xefe5b5)){var _0x147fe7=toCsv(_0xefe5b5);var _0x4e72f1=Date[_0x8fbb('0x71')]();fs[_0x8fbb('0x72')](util[_0x8fbb('0x6f')](_0x8fbb('0x73'),_0x5a32e8['id'],_0x4e72f1),_0x147fe7);_0x22ad17['setHeader'](_0x8fbb('0x74'),_0x8fbb('0x75')+util[_0x8fbb('0x6f')](_0x8fbb('0x76'),_0x5a32e8['id'],_0x4e72f1));_0x22ad17[_0x8fbb('0x77')](_0x8fbb('0x78'),_0x8fbb('0x79'));return _0x22ad17[_0x8fbb('0x7a')](util[_0x8fbb('0x6f')](_0x8fbb('0x73'),_0x5a32e8['id'],_0x4e72f1));}else{return _0x22ad17[_0x8fbb('0x1d')](0xcc);}})[_0x8fbb('0x49')](handleError(_0x22ad17,null));};exports[_0x8fbb('0x7b')]=function(_0x4009c5,_0x30b4ec,_0x273717){var _0x4a47b2;delete _0x4009c5[_0x8fbb('0x58')]['id'];return db[_0x8fbb('0x35')][_0x8fbb('0x5c')]({'where':{'id':_0x4009c5[_0x8fbb('0x4b')]['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x30b4ec,null))[_0x8fbb('0x2a')](function(_0x2b8280){if(_0x2b8280){return db[_0x8fbb('0x7c')][_0x8fbb('0x7d')](function(_0x306ed3){return db[_0x8fbb('0x69')][_0x8fbb('0x51')](_0x4009c5[_0x8fbb('0x58')],{'transaction':_0x306ed3})[_0x8fbb('0x2a')](function(_0x4538ea){_0x4a47b2=_0x4538ea;return _0x2b8280[_0x8fbb('0x7e')](_0x4538ea,{'transaction':_0x306ed3});})['then'](function(){var _0x12c0f0={'type':db[_0x8fbb('0x7f')][_0x8fbb('0x80')],'transaction':_0x306ed3};switch(_0x4009c5[_0x8fbb('0x58')]['type']){case _0x8fbb('0x81'):_0x12c0f0[_0x8fbb('0x38')]=db[_0x8fbb('0x7f')][_0x8fbb('0x80')];break;case _0x8fbb('0x82'):_0x12c0f0[_0x8fbb('0x38')]=db[_0x8fbb('0x7f')][_0x8fbb('0x83')];break;case _0x8fbb('0x84'):_0x12c0f0[_0x8fbb('0x38')]=db[_0x8fbb('0x7f')][_0x8fbb('0x85')];_0x12c0f0[_0x8fbb('0x86')]=![];break;default:}return db[_0x8fbb('0x7c')][_0x8fbb('0x87')][_0x8fbb('0x88')](_0x8fbb('0x89'),util[_0x8fbb('0x6f')](_0x8fbb('0x8a'),_0x4a47b2['id']),_0x12c0f0);})[_0x8fbb('0x2a')](function(){return _0x4a47b2;});});}})[_0x8fbb('0x2a')](respondWithResult(_0x30b4ec,null))[_0x8fbb('0x49')](handleError(_0x30b4ec,null));};exports[_0x8fbb('0x8b')]=function(_0x4530fc,_0x421b6e,_0x6aa813){var _0x199f7a={};var _0x433b8f={};var _0x38c49e;var _0x4c9716;return db[_0x8fbb('0x35')]['findOne']({'where':{'id':_0x4530fc[_0x8fbb('0x4b')]['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x421b6e,null))[_0x8fbb('0x2a')](function(_0x3c0af6){if(_0x3c0af6){_0x38c49e=_0x3c0af6;_0x433b8f[_0x8fbb('0x39')]=_[_0x8fbb('0x4c')](db[_0x8fbb('0x69')][_0x8fbb('0x36')]);_0x433b8f[_0x8fbb('0x3a')]=_[_0x8fbb('0x4c')](_0x4530fc[_0x8fbb('0x3a')]);_0x433b8f[_0x8fbb('0x3b')]=_[_0x8fbb('0x3c')](_0x433b8f[_0x8fbb('0x39')],_0x433b8f[_0x8fbb('0x3a')]);_0x199f7a[_0x8fbb('0x3e')]=_['intersection'](_0x433b8f[_0x8fbb('0x39')],qs[_0x8fbb('0x3d')](_0x4530fc[_0x8fbb('0x3a')]['fields']));_0x199f7a[_0x8fbb('0x3e')]=_0x199f7a[_0x8fbb('0x3e')][_0x8fbb('0x4d')]?_0x199f7a[_0x8fbb('0x3e')]:_0x433b8f[_0x8fbb('0x39')];_0x199f7a[_0x8fbb('0x41')]=qs['sort'](_0x4530fc['query'][_0x8fbb('0x42')]);_0x199f7a['where']=qs[_0x8fbb('0x3b')](_[_0x8fbb('0x44')](_0x4530fc[_0x8fbb('0x3a')],_0x433b8f[_0x8fbb('0x3b')]));_0x199f7a[_0x8fbb('0x43')]=_[_0x8fbb('0x5e')](_0x199f7a[_0x8fbb('0x43')],{'$or':[{'ListId':_0x3c0af6['id']},{'ListId':null}]});if(_0x4530fc[_0x8fbb('0x3a')][_0x8fbb('0x45')]){_0x199f7a[_0x8fbb('0x43')]=_['merge'](_0x199f7a[_0x8fbb('0x43')],{'$or':_[_0x8fbb('0x34')](_0x199f7a[_0x8fbb('0x3e')],function(_0xdcebb1){var _0x61cb53={};_0x61cb53[_0xdcebb1]={'$like':'%'+_0x4530fc['query'][_0x8fbb('0x45')]+'%'};return _0x61cb53;})});}_0x199f7a=_[_0x8fbb('0x5e')]({},_0x199f7a,_0x4530fc[_0x8fbb('0x50')]);return db[_0x8fbb('0x69')][_0x8fbb('0x8c')](_0x199f7a);}})[_0x8fbb('0x2a')](respondWithResult(_0x421b6e,null))['catch'](handleError(_0x421b6e,null));};exports['addAgents']=function(_0x91e19e,_0x4e42e1,_0x2dfdb4){return db[_0x8fbb('0x35')][_0x8fbb('0x55')]({'where':{'id':_0x91e19e['params']['id']}})[_0x8fbb('0x2a')](handleEntityNotFound(_0x4e42e1,null))['then'](function(_0x2e1e95){if(_0x2e1e95){return _0x2e1e95['addAgents'](_0x91e19e[_0x8fbb('0x58')][_0x8fbb('0x8d')],_['omit'](_0x91e19e[_0x8fbb('0x58')],[_0x8fbb('0x8d'),'id'])||{})['spread'](function(_0x3f4c6f){for(var _0x654c8f=0x0;_0x654c8f<_0x91e19e[_0x8fbb('0x58')][_0x8fbb('0x8d')][_0x8fbb('0x4d')];_0x654c8f+=0x1){socket[_0x8fbb('0x8e')](_0x8fbb('0x8f'),{'UserId':Number(_0x91e19e['body']['ids'][_0x654c8f]),'CmListId':Number(_0x91e19e[_0x8fbb('0x4b')]['id'])});}return _0x3f4c6f;});}})[_0x8fbb('0x2a')](respondWithResult(_0x4e42e1,null))['catch'](handleError(_0x4e42e1,null));};exports[_0x8fbb('0x90')]=function(_0x435e11,_0x3d3e8a,_0x71875b){return db[_0x8fbb('0x35')]['find']({'where':{'id':_0x435e11[_0x8fbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d3e8a,null))[_0x8fbb('0x2a')](function(_0x35d246){if(_0x35d246){return _0x35d246['removeAgents'](_0x435e11['query'][_0x8fbb('0x8d')])[_0x8fbb('0x2a')](function(){if(_[_0x8fbb('0x63')](_0x435e11[_0x8fbb('0x3a')][_0x8fbb('0x8d')])){for(var _0x565206=0x0;_0x565206<_0x435e11[_0x8fbb('0x3a')]['ids'][_0x8fbb('0x4d')];_0x565206+=0x1){socket[_0x8fbb('0x8e')](_0x8fbb('0x91'),{'UserId':Number(_0x435e11[_0x8fbb('0x3a')][_0x8fbb('0x8d')][_0x565206]),'CmListId':Number(_0x435e11['params']['id'])});}}else{socket[_0x8fbb('0x8e')](_0x8fbb('0x91'),{'UserId':Number(_0x435e11[_0x8fbb('0x3a')][_0x8fbb('0x8d')]),'CmListId':Number(_0x435e11[_0x8fbb('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d3e8a,null))['catch'](handleError(_0x3d3e8a,null));};exports[_0x8fbb('0x92')]=function(_0x55d685,_0x2de859,_0x55f12b){var _0x2873a7={};var _0x81eaab={};var _0x2119b0;var _0x2887d0;return db[_0x8fbb('0x35')][_0x8fbb('0x5c')]({'where':{'id':_0x55d685[_0x8fbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2de859,null))[_0x8fbb('0x2a')](function(_0x5c321c){if(_0x5c321c){_0x2119b0=_0x5c321c;_0x81eaab[_0x8fbb('0x39')]=_['keys'](db[_0x8fbb('0x93')][_0x8fbb('0x36')]);_0x81eaab[_0x8fbb('0x3a')]=_[_0x8fbb('0x4c')](_0x55d685['query']);_0x81eaab[_0x8fbb('0x3b')]=_['intersection'](_0x81eaab['model'],_0x81eaab['query']);_0x2873a7[_0x8fbb('0x3e')]=_[_0x8fbb('0x3c')](_0x81eaab[_0x8fbb('0x39')],qs[_0x8fbb('0x3d')](_0x55d685[_0x8fbb('0x3a')][_0x8fbb('0x3d')]));_0x2873a7[_0x8fbb('0x3e')]=_0x2873a7[_0x8fbb('0x3e')][_0x8fbb('0x4d')]?_0x2873a7['attributes']:_0x81eaab[_0x8fbb('0x39')];_0x2873a7[_0x8fbb('0x41')]=qs[_0x8fbb('0x42')](_0x55d685[_0x8fbb('0x3a')]['sort']);_0x2873a7[_0x8fbb('0x43')]=qs[_0x8fbb('0x3b')](_['pick'](_0x55d685[_0x8fbb('0x3a')],_0x81eaab[_0x8fbb('0x3b')]));if(_0x55d685[_0x8fbb('0x3a')][_0x8fbb('0x45')]){_0x2873a7[_0x8fbb('0x43')]=_['merge'](_0x2873a7[_0x8fbb('0x43')],{'$or':_[_0x8fbb('0x34')](_0x2873a7[_0x8fbb('0x3e')],function(_0x1e4730){var _0x49c115={};_0x49c115[_0x1e4730]={'$like':'%'+_0x55d685[_0x8fbb('0x3a')][_0x8fbb('0x45')]+'%'};return _0x49c115;})});}_0x2873a7=_[_0x8fbb('0x5e')]({},_0x2873a7,_0x55d685[_0x8fbb('0x50')]);return _0x2119b0[_0x8fbb('0x92')](_0x2873a7);}})[_0x8fbb('0x2a')](function(_0x321aa1){if(_0x321aa1){_0x2887d0=_0x321aa1['length'];if(!_0x55d685[_0x8fbb('0x3a')][_0x8fbb('0x3f')](_0x8fbb('0x40'))){_0x2873a7[_0x8fbb('0x23')]=qs[_0x8fbb('0x23')](_0x55d685[_0x8fbb('0x3a')]['limit']);_0x2873a7[_0x8fbb('0x21')]=qs[_0x8fbb('0x21')](_0x55d685[_0x8fbb('0x3a')][_0x8fbb('0x21')]);}return _0x2119b0[_0x8fbb('0x92')](_0x2873a7);}})[_0x8fbb('0x2a')](function(_0x1b7efc){if(_0x1b7efc){return _0x1b7efc?{'count':_0x2887d0,'rows':_0x1b7efc}:null;}})[_0x8fbb('0x2a')](respondWithResult(_0x2de859,null))[_0x8fbb('0x49')](handleError(_0x2de859,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 517c242..f4f965c 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x36717d,_0x38659b){_0x36717d=_0x36717d-0x0;var _0x43a18f=_0x3e74[_0x36717d];return _0x43a18f;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x55ca,0x126));var _0xa55c=function(_0x621bee,_0x58f8c0){_0x621bee=_0x621bee-0x0;var _0x3076c8=_0x55ca[_0x621bee];return _0x3076c8;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 8da5048..d57b889 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 _0x9c44=['request-promise','path','./cmList.attributes','define','CmList','cm_lists','../../config/logger','api','moment','bluebird'];(function(_0x666470,_0x5ad579){var _0x289b77=function(_0x4eff28){while(--_0x4eff28){_0x666470['push'](_0x666470['shift']());}};_0x289b77(++_0x5ad579);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x14c3c7,_0x203dac){var _0x24303a=function(_0x19c07b){while(--_0x19c07b){_0x14c3c7['push'](_0x14c3c7['shift']());}};_0x24303a(++_0x203dac);}(_0x702d,0x147));var _0xd702=function(_0x141ee7,_0x3dad7b){_0x141ee7=_0x141ee7-0x0;var _0x15094b=_0x702d[_0x141ee7];return _0x15094b;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','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 ae944f8..3928ff1 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 _0x844b=['client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0xf714cf,_0x584b1b){var _0x4570d6=function(_0xd1eb1){while(--_0xd1eb1){_0xf714cf['push'](_0xf714cf['shift']());}};_0x4570d6(++_0x584b1b);}(_0x844b,0x1b2));var _0xb844=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0x844b[_0x3ef4f1];return _0x69953c;};'use strict';var _=require(_0xb844('0x0'));var util=require(_0xb844('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb844('0x2'));var fs=require('fs');var Redis=require(_0xb844('0x3'));var db=require(_0xb844('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb844('0x5'))('rpc');var config=require(_0xb844('0x6'));var jayson=require(_0xb844('0x7'));var client=jayson[_0xb844('0x8')][_0xb844('0x9')]({'port':0x232a});config[_0xb844('0xa')]=_[_0xb844('0xb')](config[_0xb844('0xa')],{'host':_0xb844('0xc'),'port':0x18eb});var socket=require(_0xb844('0xd'))(new Redis(config[_0xb844('0xa')]));require(_0xb844('0xe'))[_0xb844('0xf')](socket);function respondWithRpcPromise(_0x1ac7b0,_0x670a44,_0x516ce9){return new BPromise(function(_0x21e5ca,_0x2999ea){return client['request'](_0x1ac7b0,_0x516ce9)[_0xb844('0x10')](function(_0x2224c3){logger[_0xb844('0x11')](_0xb844('0x12'),_0x670a44,_0xb844('0x13'));logger[_0xb844('0x14')](_0xb844('0x15'),_0x670a44,'request\x20sent',JSON['stringify'](_0x2224c3));if(_0x2224c3[_0xb844('0x16')]){if(_0x2224c3[_0xb844('0x16')][_0xb844('0x17')]===0x1f4){logger[_0xb844('0x16')](_0xb844('0x12'),_0x670a44,_0x2224c3['error'][_0xb844('0x18')]);return _0x2999ea(_0x2224c3[_0xb844('0x16')][_0xb844('0x18')]);}logger[_0xb844('0x16')]('CmList,\x20%s,\x20%s',_0x670a44,_0x2224c3[_0xb844('0x16')][_0xb844('0x18')]);return _0x21e5ca(_0x2224c3[_0xb844('0x16')][_0xb844('0x18')]);}else{logger[_0xb844('0x11')](_0xb844('0x12'),_0x670a44,_0xb844('0x13'));_0x21e5ca(_0x2224c3['result'][_0xb844('0x18')]);}})[_0xb844('0x19')](function(_0x472fed){logger[_0xb844('0x16')](_0xb844('0x12'),_0x670a44,_0x472fed);_0x2999ea(_0x472fed);});});} \ No newline at end of file +var _0x1b9b=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x506204,_0x4b1e27){var _0x54dbfb=function(_0x43f3ea){while(--_0x43f3ea){_0x506204['push'](_0x506204['shift']());}};_0x54dbfb(++_0x4b1e27);}(_0x1b9b,0x1a1));var _0xb1b9=function(_0x18d5b4,_0x40d3c5){_0x18d5b4=_0x18d5b4-0x0;var _0x1ad906=_0x1b9b[_0x18d5b4];return _0x1ad906;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb1b9('0x0'));var BPromise=require(_0xb1b9('0x1'));var rs=require(_0xb1b9('0x2'));var fs=require('fs');var Redis=require(_0xb1b9('0x3'));var db=require(_0xb1b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1b9('0x5'))(_0xb1b9('0x6'));var config=require(_0xb1b9('0x7'));var jayson=require(_0xb1b9('0x8'));var client=jayson[_0xb1b9('0x9')][_0xb1b9('0xa')]({'port':0x232a});config[_0xb1b9('0xb')]=_['defaults'](config[_0xb1b9('0xb')],{'host':_0xb1b9('0xc'),'port':0x18eb});var socket=require(_0xb1b9('0xd'))(new Redis(config[_0xb1b9('0xb')]));require('./cmList.socket')[_0xb1b9('0xe')](socket);function respondWithRpcPromise(_0x298c74,_0x1f515a,_0x5a3c84){return new BPromise(function(_0x3de380,_0x54eedd){return client[_0xb1b9('0xf')](_0x298c74,_0x5a3c84)[_0xb1b9('0x10')](function(_0x42878d){logger[_0xb1b9('0x11')](_0xb1b9('0x12'),_0x1f515a,_0xb1b9('0x13'));logger[_0xb1b9('0x14')](_0xb1b9('0x15'),_0x1f515a,_0xb1b9('0x13'),JSON[_0xb1b9('0x16')](_0x42878d));if(_0x42878d[_0xb1b9('0x17')]){if(_0x42878d['error'][_0xb1b9('0x18')]===0x1f4){logger[_0xb1b9('0x17')](_0xb1b9('0x12'),_0x1f515a,_0x42878d[_0xb1b9('0x17')][_0xb1b9('0x19')]);return _0x54eedd(_0x42878d[_0xb1b9('0x17')][_0xb1b9('0x19')]);}logger[_0xb1b9('0x17')](_0xb1b9('0x12'),_0x1f515a,_0x42878d[_0xb1b9('0x17')][_0xb1b9('0x19')]);return _0x3de380(_0x42878d[_0xb1b9('0x17')][_0xb1b9('0x19')]);}else{logger[_0xb1b9('0x11')](_0xb1b9('0x12'),_0x1f515a,'request\x20sent');_0x3de380(_0x42878d[_0xb1b9('0x1a')][_0xb1b9('0x19')]);}})[_0xb1b9('0x1b')](function(_0x46a482){logger[_0xb1b9('0x17')](_0xb1b9('0x12'),_0x1f515a,_0x46a482);_0x54eedd(_0x46a482);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6ab81ae..1b773a5 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 _0x73ba=['removeListener','register','cmList:','./cmList.events'];(function(_0x55a64c,_0x9b33d9){var _0x55ac77=function(_0xaee788){while(--_0xaee788){_0x55a64c['push'](_0x55a64c['shift']());}};_0x55ac77(++_0x9b33d9);}(_0x73ba,0x193));var _0xa73b=function(_0x48a7af,_0x3e4ef2){_0x48a7af=_0x48a7af-0x0;var _0x475116=_0x73ba[_0x48a7af];return _0x475116;};'use strict';var CmListEvents=require(_0xa73b('0x0'));var events=['save','remove','update'];function createListener(_0x41e632,_0x58810f){return function(_0x10696c){_0x58810f['emit'](_0x41e632,_0x10696c);};}function removeListener(_0x1c788c,_0x229b58){return function(){CmListEvents[_0xa73b('0x1')](_0x1c788c,_0x229b58);};}exports[_0xa73b('0x2')]=function(_0x531b97){for(var _0x2cc9a9=0x0,_0x3565ce=events['length'];_0x2cc9a9<_0x3565ce;_0x2cc9a9++){var _0x5ee433=events[_0x2cc9a9];var _0x8e3ca9=createListener(_0xa73b('0x3')+_0x5ee433,_0x531b97);CmListEvents['on'](_0x5ee433,_0x8e3ca9);}}; \ No newline at end of file +var _0x6d34=['cmList:','./cmList.events','save','update','register'];(function(_0x3d640c,_0x1e456a){var _0x472772=function(_0x5f2155){while(--_0x5f2155){_0x3d640c['push'](_0x3d640c['shift']());}};_0x472772(++_0x1e456a);}(_0x6d34,0xa6));var _0x46d3=function(_0x28f64e,_0x4bb70f){_0x28f64e=_0x28f64e-0x0;var _0x44311c=_0x6d34[_0x28f64e];return _0x44311c;};'use strict';var CmListEvents=require(_0x46d3('0x0'));var events=[_0x46d3('0x1'),'remove',_0x46d3('0x2')];function createListener(_0x23b0cd,_0x36d299){return function(_0x3e9ac2){_0x36d299['emit'](_0x23b0cd,_0x3e9ac2);};}function removeListener(_0x3a0ab,_0x54fbc8){return function(){CmListEvents['removeListener'](_0x3a0ab,_0x54fbc8);};}exports[_0x46d3('0x3')]=function(_0x1bd16e){for(var _0x52cbb7=0x0,_0x2788db=events['length'];_0x52cbb7<_0x2788db;_0x52cbb7++){var _0x4f1176=events[_0x52cbb7];var _0x51a149=createListener(_0x46d3('0x4')+_0x4f1176,_0x1bd16e);CmListEvents['on'](_0x4f1176,_0x51a149);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a8590cf..db373fb 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 _0xe44e=['put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','addContacts','addAgents'];(function(_0x3cc08b,_0x57bb4f){var _0x1e1d6f=function(_0x426bc1){while(--_0x426bc1){_0x3cc08b['push'](_0x3cc08b['shift']());}};_0x1e1d6f(++_0x57bb4f);}(_0xe44e,0xbb));var _0xee44=function(_0x3c3aaf,_0x5c7e04){_0x3c3aaf=_0x3c3aaf-0x0;var _0x36d520=_0xe44e[_0x3c3aaf];return _0x36d520;};'use strict';var multer=require(_0xee44('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee44('0x1'));var express=require('express');var router=express[_0xee44('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee44('0x3'));var interaction=require(_0xee44('0x4'));var config=require(_0xee44('0x5'));var controller=require(_0xee44('0x6'));router[_0xee44('0x7')]('/',auth[_0xee44('0x8')](),controller[_0xee44('0x9')]);router[_0xee44('0x7')](_0xee44('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xee44('0xb'),auth[_0xee44('0x8')](),controller[_0xee44('0xc')]);router[_0xee44('0x7')](_0xee44('0xd'),auth[_0xee44('0x8')](),controller['getDispositions']);router['get'](_0xee44('0xe'),auth[_0xee44('0x8')](),controller['getContacts']);router[_0xee44('0x7')](_0xee44('0xf'),auth[_0xee44('0x8')](),controller[_0xee44('0x10')]);router[_0xee44('0x7')](_0xee44('0x11'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0xee44('0x7')](_0xee44('0x12'),auth[_0xee44('0x8')](),controller[_0xee44('0x13')]);router[_0xee44('0x14')]('/',auth[_0xee44('0x8')](),controller['create']);router[_0xee44('0x14')](_0xee44('0xd'),auth[_0xee44('0x8')](),controller['addDisposition']);router['post'](_0xee44('0xe'),auth[_0xee44('0x8')](),controller[_0xee44('0x15')]);router[_0xee44('0x14')](_0xee44('0x11'),auth[_0xee44('0x8')](),controller['addCustomField']);router[_0xee44('0x14')](_0xee44('0x12'),auth['isAuthenticated'](),controller[_0xee44('0x16')]);router[_0xee44('0x17')](_0xee44('0xb'),auth['isAuthenticated'](),controller[_0xee44('0x18')]);router[_0xee44('0x19')](_0xee44('0xb'),auth[_0xee44('0x8')](),controller[_0xee44('0x1a')]);router[_0xee44('0x19')](_0xee44('0xd'),auth[_0xee44('0x8')](),controller[_0xee44('0x1b')]);router[_0xee44('0x19')](_0xee44('0x12'),auth[_0xee44('0x8')](),controller[_0xee44('0x1c')]);module[_0xee44('0x1d')]=router; \ No newline at end of file +var _0xe248=['/:id/fields','getCustomFields','/:id/users','getAgents','addDisposition','post','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv'];(function(_0x29318f,_0x1e1f1b){var _0xdff758=function(_0x5b01ee){while(--_0x5b01ee){_0x29318f['push'](_0x29318f['shift']());}};_0xdff758(++_0x1e1f1b);}(_0xe248,0x149));var _0x8e24=function(_0x37e3d1,_0x168a19){_0x37e3d1=_0x37e3d1-0x0;var _0x482fcf=_0xe248[_0x37e3d1];return _0x482fcf;};'use strict';var multer=require(_0x8e24('0x0'));var util=require(_0x8e24('0x1'));var path=require(_0x8e24('0x2'));var timeout=require(_0x8e24('0x3'));var express=require(_0x8e24('0x4'));var router=express['Router']();var fs_extra=require(_0x8e24('0x5'));var auth=require(_0x8e24('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e24('0x7'));var controller=require(_0x8e24('0x8'));router[_0x8e24('0x9')]('/',auth['isAuthenticated'](),controller[_0x8e24('0xa')]);router[_0x8e24('0x9')](_0x8e24('0xb'),auth['isAuthenticated'](),controller[_0x8e24('0xc')]);router[_0x8e24('0x9')](_0x8e24('0xd'),auth[_0x8e24('0xe')](),controller[_0x8e24('0xf')]);router['get'](_0x8e24('0x10'),auth[_0x8e24('0xe')](),controller[_0x8e24('0x11')]);router['get'](_0x8e24('0x12'),auth[_0x8e24('0xe')](),controller[_0x8e24('0x13')]);router[_0x8e24('0x9')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x8e24('0x14')]);router[_0x8e24('0x9')](_0x8e24('0x15'),auth['isAuthenticated'](),controller[_0x8e24('0x16')]);router['get'](_0x8e24('0x17'),auth[_0x8e24('0xe')](),controller[_0x8e24('0x18')]);router['post']('/',auth[_0x8e24('0xe')](),controller['create']);router['post'](_0x8e24('0x10'),auth[_0x8e24('0xe')](),controller[_0x8e24('0x19')]);router[_0x8e24('0x1a')](_0x8e24('0x12'),auth[_0x8e24('0xe')](),controller['addContacts']);router[_0x8e24('0x1a')](_0x8e24('0x15'),auth[_0x8e24('0xe')](),controller[_0x8e24('0x1b')]);router[_0x8e24('0x1a')](_0x8e24('0x17'),auth[_0x8e24('0xe')](),controller[_0x8e24('0x1c')]);router[_0x8e24('0x1d')](_0x8e24('0xd'),auth[_0x8e24('0xe')](),controller[_0x8e24('0x1e')]);router[_0x8e24('0x1f')]('/:id',auth[_0x8e24('0xe')](),controller['destroy']);router[_0x8e24('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8e24('0x20')]);router[_0x8e24('0x1f')](_0x8e24('0x17'),auth['isAuthenticated'](),controller[_0x8e24('0x21')]);module[_0x8e24('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 f583aaa..e8524a0 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 _0x2f28=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x2f28,0xff));var _0x82f2=function(_0x484813,_0xfd47d2){_0x484813=_0x484813-0x0;var _0x12602b=_0x2f28[_0x484813];return _0x12602b;};'use strict';var Sequelize=require(_0x82f2('0x0'));module[_0x82f2('0x1')]={'name':{'type':Sequelize[_0x82f2('0x2')],'get':function(_0x338011){return this[_0x82f2('0x3')](_0x82f2('0x4'));}},'field':{'type':Sequelize[_0x82f2('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x82f2('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x9d23=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x222d38,_0x5793e8){var _0x5de24b=function(_0x3ffd91){while(--_0x3ffd91){_0x222d38['push'](_0x222d38['shift']());}};_0x5de24b(++_0x5793e8);}(_0x9d23,0x8b));var _0x39d2=function(_0x72e4be,_0x51edeb){_0x72e4be=_0x72e4be-0x0;var _0x19e939=_0x9d23[_0x72e4be];return _0x19e939;};'use strict';var Sequelize=require(_0x39d2('0x0'));module[_0x39d2('0x1')]={'name':{'type':Sequelize[_0x39d2('0x2')],'get':function(_0x5eebb7){return this[_0x39d2('0x3')](_0x39d2('0x4'));}},'field':{'type':Sequelize[_0x39d2('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x39d2('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x39d2('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 50849c5..00cca09 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x69dae5,_0xf0ad28){var _0x4a45ac=function(_0x223f68){while(--_0x223f68){_0x69dae5['push'](_0x69dae5['shift']());}};_0x4a45ac(++_0xf0ad28);}(_0x7a54,0x106));var _0x47a5=function(_0x1609ad,_0x4d4986){_0x1609ad=_0x1609ad-0x0;var _0x36a829=_0x7a54[_0x1609ad];return _0x36a829;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x12409d,_0x4c9b4b){var _0x457072=function(_0x2d3c53){while(--_0x2d3c53){_0x12409d['push'](_0x12409d['shift']());}};_0x457072(++_0x4c9b4b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 3ead31d..b5d913b 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 _0x17d0=['request-promise','path','../../config/environment','exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5785a6,_0xec2557){var _0x2aadbc=function(_0x2c03db){while(--_0x2c03db){_0x5785a6['push'](_0x5785a6['shift']());}};_0x2aadbc(++_0xec2557);}(_0x17d0,0x1ce));var _0x017d=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x17d0[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x017d('0x0'));var util=require(_0x017d('0x1'));var logger=require(_0x017d('0x2'))(_0x017d('0x3'));var moment=require(_0x017d('0x4'));var BPromise=require(_0x017d('0x5'));var rp=require(_0x017d('0x6'));var fs=require('fs');var path=require(_0x017d('0x7'));var rimraf=require('rimraf');var config=require(_0x017d('0x8'));var attributes=require('./condition.attributes');module[_0x017d('0x9')]=function(_0x24522c,_0x11299d){return _0x24522c['define'](_0x017d('0xa'),attributes,{'tableName':_0x017d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f5a=['bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0xb98e6e,_0xe56cbc){var _0x26751c=function(_0x123ccc){while(--_0x123ccc){_0xb98e6e['push'](_0xb98e6e['shift']());}};_0x26751c(++_0xe56cbc);}(_0x6f5a,0x127));var _0xa6f5=function(_0x48cf17,_0x29534c){_0x48cf17=_0x48cf17-0x0;var _0x3b8b26=_0x6f5a[_0x48cf17];return _0x3b8b26;};'use strict';var _=require(_0xa6f5('0x0'));var util=require(_0xa6f5('0x1'));var logger=require(_0xa6f5('0x2'))(_0xa6f5('0x3'));var moment=require(_0xa6f5('0x4'));var BPromise=require(_0xa6f5('0x5'));var rp=require(_0xa6f5('0x6'));var fs=require('fs');var path=require(_0xa6f5('0x7'));var rimraf=require(_0xa6f5('0x8'));var config=require(_0xa6f5('0x9'));var attributes=require(_0xa6f5('0xa'));module[_0xa6f5('0xb')]=function(_0xc07a3c,_0xeae153){return _0xc07a3c[_0xa6f5('0xc')](_0xa6f5('0xd'),attributes,{'tableName':_0xa6f5('0xe'),'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 b83240e..c8f7197 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 _0xc3fc=['Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x205171,_0x4848a7){var _0x1fd8ce=function(_0x3d60a8){while(--_0x3d60a8){_0x205171['push'](_0x205171['shift']());}};_0x1fd8ce(++_0x4848a7);}(_0xc3fc,0xd1));var _0xcc3f=function(_0x5c2dfa,_0x22dfec){_0x5c2dfa=_0x5c2dfa-0x0;var _0x2cbb02=_0xc3fc[_0x5c2dfa];return _0x2cbb02;};'use strict';var _=require(_0xcc3f('0x0'));var util=require('util');var moment=require(_0xcc3f('0x1'));var BPromise=require(_0xcc3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc3f('0x3'))['db'];var utils=require(_0xcc3f('0x4'));var logger=require(_0xcc3f('0x5'))('rpc');var config=require(_0xcc3f('0x6'));var jayson=require(_0xcc3f('0x7'));var client=jayson[_0xcc3f('0x8')][_0xcc3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503988,_0x7391af,_0x163f0d){return new BPromise(function(_0x13273f,_0x1ac1cc){return client['request'](_0x503988,_0x163f0d)[_0xcc3f('0xa')](function(_0x55d4f1){logger['info'](_0xcc3f('0xb'),_0x7391af,_0xcc3f('0xc'));logger[_0xcc3f('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x7391af,_0xcc3f('0xc'),JSON[_0xcc3f('0xe')](_0x55d4f1));if(_0x55d4f1[_0xcc3f('0xf')]){if(_0x55d4f1[_0xcc3f('0xf')][_0xcc3f('0x10')]===0x1f4){logger[_0xcc3f('0xf')](_0xcc3f('0xb'),_0x7391af,_0x55d4f1[_0xcc3f('0xf')][_0xcc3f('0x11')]);return _0x1ac1cc(_0x55d4f1['error'][_0xcc3f('0x11')]);}logger['error'](_0xcc3f('0xb'),_0x7391af,_0x55d4f1['error'][_0xcc3f('0x11')]);return _0x13273f(_0x55d4f1[_0xcc3f('0xf')][_0xcc3f('0x11')]);}else{logger[_0xcc3f('0x12')](_0xcc3f('0xb'),_0x7391af,_0xcc3f('0xc'));_0x13273f(_0x55d4f1[_0xcc3f('0x13')][_0xcc3f('0x11')]);}})['catch'](function(_0x4cb764){logger['error'](_0xcc3f('0xb'),_0x7391af,_0x4cb764);_0x1ac1cc(_0x4cb764);});});} \ No newline at end of file +var _0x20c6=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x2d079c,_0x36e234){var _0x511159=function(_0x1dbcb8){while(--_0x1dbcb8){_0x2d079c['push'](_0x2d079c['shift']());}};_0x511159(++_0x36e234);}(_0x20c6,0x147));var _0x620c=function(_0x28821e,_0x43d56c){_0x28821e=_0x28821e-0x0;var _0x29d248=_0x20c6[_0x28821e];return _0x29d248;};'use strict';var _=require(_0x620c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x620c('0x1'));var db=require(_0x620c('0x2'))['db'];var utils=require(_0x620c('0x3'));var logger=require(_0x620c('0x4'))(_0x620c('0x5'));var config=require(_0x620c('0x6'));var jayson=require(_0x620c('0x7'));var client=jayson[_0x620c('0x8')][_0x620c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x574935,_0x3737e0,_0x210fd7){return new BPromise(function(_0x46e162,_0x649b0f){return client['request'](_0x574935,_0x210fd7)[_0x620c('0xa')](function(_0x57f946){logger['info'](_0x620c('0xb'),_0x3737e0,_0x620c('0xc'));logger['debug'](_0x620c('0xd'),_0x3737e0,_0x620c('0xc'),JSON[_0x620c('0xe')](_0x57f946));if(_0x57f946[_0x620c('0xf')]){if(_0x57f946[_0x620c('0xf')][_0x620c('0x10')]===0x1f4){logger[_0x620c('0xf')](_0x620c('0xb'),_0x3737e0,_0x57f946[_0x620c('0xf')]['message']);return _0x649b0f(_0x57f946[_0x620c('0xf')][_0x620c('0x11')]);}logger[_0x620c('0xf')](_0x620c('0xb'),_0x3737e0,_0x57f946[_0x620c('0xf')][_0x620c('0x11')]);return _0x46e162(_0x57f946[_0x620c('0xf')][_0x620c('0x11')]);}else{logger[_0x620c('0x12')](_0x620c('0xb'),_0x3737e0,_0x620c('0xc'));_0x46e162(_0x57f946[_0x620c('0x13')][_0x620c('0x11')]);}})['catch'](function(_0x5df1bd){logger[_0x620c('0xf')](_0x620c('0xb'),_0x3737e0,_0x5df1bd);_0x649b0f(_0x5df1bd);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 216963f..1e2f403 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 _0x91f3=['put','/:id','isAuthenticated','update','delete','exports','util','express','Router','fs-extra','../../components/interaction/service','./condition.controller'];(function(_0x3fea85,_0x27dddb){var _0x14b7ec=function(_0x26af0e){while(--_0x26af0e){_0x3fea85['push'](_0x3fea85['shift']());}};_0x14b7ec(++_0x27dddb);}(_0x91f3,0x1f2));var _0x391f=function(_0x3386ba,_0x572947){_0x3386ba=_0x3386ba-0x0;var _0x1763b0=_0x91f3[_0x3386ba];return _0x1763b0;};'use strict';var multer=require('multer');var util=require(_0x391f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x391f('0x1'));var router=express[_0x391f('0x2')]();var fs_extra=require(_0x391f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x391f('0x4'));var config=require('../../config/environment');var controller=require(_0x391f('0x5'));router[_0x391f('0x6')](_0x391f('0x7'),auth[_0x391f('0x8')](),controller[_0x391f('0x9')]);router[_0x391f('0xa')]('/:id',auth[_0x391f('0x8')](),controller['destroy']);module[_0x391f('0xb')]=router; \ No newline at end of file +var _0xd75b=['../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xd75b,0x69));var _0xbd75=function(_0x2b37bb,_0x51eb92){_0x2b37bb=_0x2b37bb-0x0;var _0x5cf003=_0xd75b[_0x2b37bb];return _0x5cf003;};'use strict';var multer=require(_0xbd75('0x0'));var util=require(_0xbd75('0x1'));var path=require(_0xbd75('0x2'));var timeout=require(_0xbd75('0x3'));var express=require(_0xbd75('0x4'));var router=express[_0xbd75('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd75('0x6'));var interaction=require(_0xbd75('0x7'));var config=require(_0xbd75('0x8'));var controller=require(_0xbd75('0x9'));router[_0xbd75('0xa')]('/:id',auth[_0xbd75('0xb')](),controller[_0xbd75('0xc')]);router['delete'](_0xbd75('0xd'),auth[_0xbd75('0xb')](),controller[_0xbd75('0xe')]);module[_0xbd75('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b2f7db6..b12e84f 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(_0x570f12,_0x3471a0){var _0x1d5872=function(_0x25036e){while(--_0x25036e){_0x570f12['push'](_0x570f12['shift']());}};_0x1d5872(++_0x3471a0);}(_0x2032,0xd9));var _0x2203=function(_0x2bcd8d,_0x3be245){_0x2bcd8d=_0x2bcd8d-0x0;var _0x15edcf=_0x2032[_0x2bcd8d];return _0x15edcf;};'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(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe706,0xa3));var _0x6e70=function(_0x228d7c,_0xf01e7d){_0x228d7c=_0x228d7c-0x0;var _0x1ffa97=_0xe706[_0x228d7c];return _0x1ffa97;};'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 e0f133d..5569986 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 _0xa318=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','options','omit','createdAt','updatedAt','body','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems','findOne','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0xa318,0x6d));var _0x8a31=function(_0x37b56a,_0x289865){_0x37b56a=_0x37b56a-0x0;var _0x5d2e99=_0xa318[_0x37b56a];return _0x5d2e99;};'use strict';var emlformat=require(_0x8a31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a31('0x1'));var rp=require(_0x8a31('0x2'));var moment=require(_0x8a31('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8a31('0x4'));var path=require(_0x8a31('0x5'));var sox=require('sox');var csv=require(_0x8a31('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a31('0x7'));var _=require(_0x8a31('0x8'));var squel=require(_0x8a31('0x9'));var crypto=require('crypto');var jsforce=require(_0x8a31('0xa'));var deskjs=require(_0x8a31('0xb'));var toCsv=require(_0x8a31('0x6'));var querystring=require(_0x8a31('0xc'));var Papa=require(_0x8a31('0xd'));var Redis=require(_0x8a31('0xe'));var authService=require(_0x8a31('0xf'));var qs=require(_0x8a31('0x10'));var as=require(_0x8a31('0x11'));var hardwareService=require(_0x8a31('0x12'));var logger=require(_0x8a31('0x13'))('api');var utils=require(_0x8a31('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a31('0x15'))['db'];config[_0x8a31('0x16')]=_['defaults'](config[_0x8a31('0x16')],{'host':_0x8a31('0x17'),'port':0x18eb});var socket=require(_0x8a31('0x18'))(new Redis(config['redis']));require(_0x8a31('0x19'))['register'](socket);function respondWithStatusCode(_0x598771,_0x4767ee){_0x4767ee=_0x4767ee||0xcc;return function(_0x341680){if(_0x341680){return _0x598771[_0x8a31('0x1a')](_0x4767ee);}return _0x598771['status'](_0x4767ee)[_0x8a31('0x1b')]();};}function respondWithResult(_0x3148d7,_0x57ac32){_0x57ac32=_0x57ac32||0xc8;return function(_0x349439){if(_0x349439){return _0x3148d7[_0x8a31('0x1c')](_0x57ac32)[_0x8a31('0x1d')](_0x349439);}};}function respondWithFilteredResult(_0x4f7db6,_0x51c53f){return function(_0x4249b7){if(_0x4249b7){var _0x54ee68=typeof _0x51c53f['offset']===_0x8a31('0x1e')&&typeof _0x51c53f[_0x8a31('0x1f')]==='undefined';var _0x356c8c=_0x4249b7[_0x8a31('0x20')];var _0x1c3fb3=_0x54ee68?0x0:_0x51c53f[_0x8a31('0x21')];var _0x537d64=_0x54ee68?_0x4249b7[_0x8a31('0x20')]:_0x51c53f[_0x8a31('0x21')]+_0x51c53f[_0x8a31('0x1f')];var _0x580849;if(_0x537d64>=_0x356c8c){_0x537d64=_0x356c8c;_0x580849=0xc8;}else{_0x580849=0xce;}_0x4f7db6[_0x8a31('0x1c')](_0x580849);return _0x4f7db6['set']('Content-Range',_0x1c3fb3+'-'+_0x537d64+'/'+_0x356c8c)['json'](_0x4249b7);}return null;};}function patchUpdates(_0x46a87f){return function(_0x169bfd){try{jsonpatch[_0x8a31('0x22')](_0x169bfd,_0x46a87f,!![]);}catch(_0x5da136){return BPromise[_0x8a31('0x23')](_0x5da136);}return _0x169bfd[_0x8a31('0x24')]();};}function saveUpdates(_0x146544,_0x3834a7){return function(_0x5189a3){if(_0x5189a3){return _0x5189a3[_0x8a31('0x25')](_0x146544)[_0x8a31('0x26')](function(_0x3410d7){return _0x3410d7;});}return null;};}function removeEntity(_0x35f15c,_0x50a94d){return function(_0x516fb5){if(_0x516fb5){return _0x516fb5['destroy']()['then'](function(){var _0xcf4927=_0x516fb5[_0x8a31('0x27')]({'plain':!![]});var _0x322234=_0x8a31('0x28');return db[_0x8a31('0x29')][_0x8a31('0x2a')]({'where':{'type':_0x322234,'resourceId':_0xcf4927['id']}})[_0x8a31('0x26')](function(){return _0x516fb5;});})[_0x8a31('0x26')](function(){_0x35f15c['status'](0xcc)[_0x8a31('0x1b')]();});}};}function handleEntityNotFound(_0x2b8c08,_0x1be46e){return function(_0x33e0f9){if(!_0x33e0f9){_0x2b8c08['sendStatus'](0x194);}return _0x33e0f9;};}function handleError(_0x3dd7c4,_0x2262a9){_0x2262a9=_0x2262a9||0x1f4;return function(_0x4898b9){logger[_0x8a31('0x2b')](_0x4898b9[_0x8a31('0x2c')]);if(_0x4898b9[_0x8a31('0x2d')]){delete _0x4898b9[_0x8a31('0x2d')];}_0x3dd7c4[_0x8a31('0x1c')](_0x2262a9)[_0x8a31('0x2e')](_0x4898b9);};}exports[_0x8a31('0x2f')]=function(_0x330629,_0x5a9f73){var _0xcac25f={},_0x3f1126={},_0x3c358d={'count':0x0,'rows':[]};var _0x3656eb=_[_0x8a31('0x30')](db[_0x8a31('0x31')][_0x8a31('0x32')],function(_0x492926){return{'name':_0x492926['fieldName'],'type':_0x492926['type'][_0x8a31('0x33')]};});_0x3f1126['model']=_[_0x8a31('0x30')](_0x3656eb,_0x8a31('0x2d'));_0x3f1126[_0x8a31('0x34')]=_[_0x8a31('0x35')](_0x330629['query']);_0x3f1126[_0x8a31('0x36')]=_[_0x8a31('0x37')](_0x3f1126[_0x8a31('0x38')],_0x3f1126['query']);_0xcac25f[_0x8a31('0x39')]=_[_0x8a31('0x37')](_0x3f1126[_0x8a31('0x38')],qs['fields'](_0x330629[_0x8a31('0x34')]['fields']));_0xcac25f[_0x8a31('0x39')]=_0xcac25f[_0x8a31('0x39')][_0x8a31('0x3a')]?_0xcac25f['attributes']:_0x3f1126[_0x8a31('0x38')];if(!_0x330629[_0x8a31('0x34')][_0x8a31('0x3b')](_0x8a31('0x3c'))){_0xcac25f[_0x8a31('0x1f')]=qs[_0x8a31('0x1f')](_0x330629[_0x8a31('0x34')][_0x8a31('0x1f')]);_0xcac25f[_0x8a31('0x21')]=qs[_0x8a31('0x21')](_0x330629[_0x8a31('0x34')][_0x8a31('0x21')]);}_0xcac25f[_0x8a31('0x3d')]=qs[_0x8a31('0x3e')](_0x330629[_0x8a31('0x34')]['sort']);_0xcac25f['where']=qs['filters'](_[_0x8a31('0x3f')](_0x330629[_0x8a31('0x34')],_0x3f1126[_0x8a31('0x36')]),_0x3656eb);if(_0x330629[_0x8a31('0x34')][_0x8a31('0x40')]){_0xcac25f[_0x8a31('0x41')]=_[_0x8a31('0x42')](_0xcac25f[_0x8a31('0x41')],{'$or':_[_0x8a31('0x30')](_0x3656eb,function(_0x14cb9a){if(_0x14cb9a[_0x8a31('0x43')]!==_0x8a31('0x44')){var _0x14a532={};_0x14a532[_0x14cb9a[_0x8a31('0x2d')]]={'$like':'%'+_0x330629[_0x8a31('0x34')][_0x8a31('0x40')]+'%'};return _0x14a532;}})});}_0xcac25f=_[_0x8a31('0x42')]({},_0xcac25f,_0x330629['options']);var _0x5fac59={'where':_0xcac25f[_0x8a31('0x41')]};return db['Dashboard'][_0x8a31('0x20')](_0x5fac59)[_0x8a31('0x26')](function(_0x189b1d){_0x3c358d[_0x8a31('0x20')]=_0x189b1d;if(_0x330629[_0x8a31('0x34')][_0x8a31('0x45')]){_0xcac25f['include']=[{'all':!![]}];}return db[_0x8a31('0x31')][_0x8a31('0x46')](_0xcac25f);})[_0x8a31('0x26')](function(_0x452284){_0x3c358d[_0x8a31('0x47')]=_0x452284;return _0x3c358d;})[_0x8a31('0x26')](respondWithFilteredResult(_0x5a9f73,_0xcac25f))[_0x8a31('0x48')](handleError(_0x5a9f73,null));};exports[_0x8a31('0x49')]=function(_0x15d622,_0x5b4f10){var _0x3cb030={'raw':![],'where':{'id':_0x15d622['params']['id']}},_0xe1bd06={};_0xe1bd06[_0x8a31('0x38')]=_[_0x8a31('0x35')](db[_0x8a31('0x31')][_0x8a31('0x32')]);_0xe1bd06[_0x8a31('0x34')]=_[_0x8a31('0x35')](_0x15d622['query']);_0xe1bd06[_0x8a31('0x36')]=_[_0x8a31('0x37')](_0xe1bd06[_0x8a31('0x38')],_0xe1bd06[_0x8a31('0x34')]);_0x3cb030['attributes']=_['intersection'](_0xe1bd06['model'],qs['fields'](_0x15d622[_0x8a31('0x34')][_0x8a31('0x4a')]));_0x3cb030[_0x8a31('0x39')]=_0x3cb030[_0x8a31('0x39')][_0x8a31('0x3a')]?_0x3cb030['attributes']:_0xe1bd06[_0x8a31('0x38')];if(_0x15d622[_0x8a31('0x34')][_0x8a31('0x45')]){_0x3cb030[_0x8a31('0x4b')]=[{'all':!![]}];}_0x3cb030=_['merge']({},_0x3cb030,_0x15d622['options']);return db[_0x8a31('0x31')][_0x8a31('0x4c')](_0x3cb030)[_0x8a31('0x26')](handleEntityNotFound(_0x5b4f10,null))[_0x8a31('0x26')](respondWithResult(_0x5b4f10,null))[_0x8a31('0x48')](handleError(_0x5b4f10,null));};exports[_0x8a31('0x4d')]=function(_0x2c9c6e,_0x53ea93){return db[_0x8a31('0x31')][_0x8a31('0x4d')](_0x2c9c6e['body'],{})[_0x8a31('0x26')](function(_0x1c1b55){var _0x348426=_0x2c9c6e[_0x8a31('0x4e')][_0x8a31('0x27')]({'plain':!![]});if(!_0x348426)throw new Error(_0x8a31('0x4f'));if(_0x348426[_0x8a31('0x50')]===_0x8a31('0x4e')){var _0x275a1b=_0x1c1b55[_0x8a31('0x27')]({'plain':!![]});var _0x33d483=_0x8a31('0x28');return db[_0x8a31('0x51')][_0x8a31('0x4c')]({'where':{'name':_0x33d483,'userProfileId':_0x348426[_0x8a31('0x52')]},'raw':!![]})[_0x8a31('0x26')](function(_0x1e3372){if(_0x1e3372&&_0x1e3372[_0x8a31('0x53')]===0x0){return db[_0x8a31('0x29')]['create']({'name':_0x275a1b[_0x8a31('0x2d')],'resourceId':_0x275a1b['id'],'type':_0x1e3372[_0x8a31('0x2d')],'sectionId':_0x1e3372['id']},{})[_0x8a31('0x26')](function(){return _0x1c1b55;});}else{return _0x1c1b55;}})[_0x8a31('0x48')](function(_0x17fac1){logger[_0x8a31('0x2b')](_0x8a31('0x54'),_0x17fac1);throw _0x17fac1;});}return _0x1c1b55;})[_0x8a31('0x26')](respondWithResult(_0x53ea93,0xc9))[_0x8a31('0x48')](handleError(_0x53ea93,null));};exports[_0x8a31('0x55')]=function(_0xd759ec,_0x1c9c94){var _0x4a3c69={'where':{'id':_0xd759ec[_0x8a31('0x56')]['id']}},_0x315551={};_0x315551['model']=_[_0x8a31('0x35')](db[_0x8a31('0x31')][_0x8a31('0x32')]);_0x4a3c69[_0x8a31('0x39')]=_[_0x8a31('0x37')](_0x315551[_0x8a31('0x38')],qs['fields'](_0xd759ec[_0x8a31('0x34')]['fields']));_0x4a3c69[_0x8a31('0x39')]=_0x4a3c69['attributes']['length']?_0x4a3c69['attributes']:_0x315551['model'];if(_0xd759ec[_0x8a31('0x34')][_0x8a31('0x45')]){_0x4a3c69[_0x8a31('0x4b')]=[{'all':!![]}];}_0x4a3c69=_[_0x8a31('0x42')]({},_0x4a3c69,_0xd759ec[_0x8a31('0x57')]);return db[_0x8a31('0x31')][_0x8a31('0x4c')](_0x4a3c69)[_0x8a31('0x26')](handleEntityNotFound(_0x1c9c94,null))[_0x8a31('0x26')](function(_0x1d0505){if(_0x1d0505){var _0x29bf0f=_0x1d0505[_0x8a31('0x27')]({'plain':!![]});_0x29bf0f=qs[_0x8a31('0x58')](_0x29bf0f,['id',_0x8a31('0x59'),_0x8a31('0x5a')]);_0xd759ec[_0x8a31('0x5b')]=_[_0x8a31('0x58')](_0xd759ec[_0x8a31('0x5b')],['id',_0x8a31('0x59'),_0x8a31('0x5a')]);return db[_0x8a31('0x31')][_0x8a31('0x4d')](_[_0x8a31('0x42')](_0x29bf0f,_0xd759ec[_0x8a31('0x5b')]),{'include':_0xd759ec[_0x8a31('0x34')][_0x8a31('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x542cfa){var _0x5a9205=_0xd759ec[_0x8a31('0x4e')][_0x8a31('0x27')]({'plain':!![]});if(!_0x5a9205)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a9205[_0x8a31('0x50')]===_0x8a31('0x4e')){var _0x52a179=_0x542cfa[_0x8a31('0x27')]({'plain':!![]});var _0x5870df=_0x8a31('0x28');return db[_0x8a31('0x51')][_0x8a31('0x4c')]({'where':{'name':_0x5870df,'userProfileId':_0x5a9205['userProfileId']},'raw':!![]})['then'](function(_0x2a63f8){if(_0x2a63f8&&_0x2a63f8[_0x8a31('0x53')]===0x0){return db[_0x8a31('0x29')][_0x8a31('0x4d')]({'name':_0x52a179['name'],'resourceId':_0x52a179['id'],'type':_0x2a63f8[_0x8a31('0x2d')],'sectionId':_0x2a63f8['id']},{})[_0x8a31('0x26')](function(){return _0x542cfa;});}else{return _0x542cfa;}})[_0x8a31('0x48')](function(_0x209f8a){logger[_0x8a31('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x209f8a);throw _0x209f8a;});}return _0x542cfa;});}})[_0x8a31('0x26')](respondWithResult(_0x1c9c94,0xc9))[_0x8a31('0x48')](handleError(_0x1c9c94,null));};exports[_0x8a31('0x25')]=function(_0x3ee4f6,_0x566ff4){if(_0x3ee4f6[_0x8a31('0x5b')]['id']){delete _0x3ee4f6[_0x8a31('0x5b')]['id'];}return db[_0x8a31('0x31')][_0x8a31('0x4c')]({'where':{'id':_0x3ee4f6['params']['id']}})['then'](handleEntityNotFound(_0x566ff4,null))[_0x8a31('0x26')](saveUpdates(_0x3ee4f6[_0x8a31('0x5b')],null))[_0x8a31('0x26')](respondWithResult(_0x566ff4,null))[_0x8a31('0x48')](handleError(_0x566ff4,null));};exports[_0x8a31('0x2a')]=function(_0x5d2f83,_0x319737){return db[_0x8a31('0x31')][_0x8a31('0x4c')]({'where':{'id':_0x5d2f83[_0x8a31('0x56')]['id']}})[_0x8a31('0x26')](handleEntityNotFound(_0x319737,null))[_0x8a31('0x26')](removeEntity(_0x319737,null))[_0x8a31('0x48')](handleError(_0x319737,null));};function widgetAttributes(_0x1a9d76){try{switch(_0x1a9d76[_0x8a31('0x43')]){case'iframe':return[{'name':_0x8a31('0x5c'),'value':_0x1a9d76['attrUrl']||(_0x1a9d76['attrs']&&_0x1a9d76['attrs'][0x0]?_0x1a9d76[_0x8a31('0x5d')][0x0][_0x8a31('0x5e')]:undefined)||_0x8a31('0x5f')}];case'custom':return[{'name':_0x8a31('0x60'),'value':_0x1a9d76[_0x8a31('0x60')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76['attrs'][0x0]?_0x1a9d76[_0x8a31('0x5d')][0x0][_0x8a31('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x8a31('0x61'),'value':_0x1a9d76[_0x8a31('0x61')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x0]?_0x1a9d76['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x8a31('0x62'),'value':_0x1a9d76['attrTimezone']||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76['attrs'][0x1]?_0x1a9d76['attrs'][0x1][_0x8a31('0x5e')]:undefined)||'0.00'},{'name':_0x8a31('0x63'),'value':_0x1a9d76[_0x8a31('0x63')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x2]?_0x1a9d76[_0x8a31('0x5d')][0x2]['value']:undefined)||0xc}];case _0x8a31('0x64'):return[{'name':_0x8a31('0x65'),'value':_0x1a9d76[_0x8a31('0x65')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x0]?_0x1a9d76['attrs'][0x0][_0x8a31('0x5e')]:undefined)||_0x8a31('0x66')},{'name':_0x8a31('0x67'),'value':_0x1a9d76[_0x8a31('0x67')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x1]?_0x1a9d76['attrs'][0x1]['value']:undefined)||[]},{'name':_0x8a31('0x63'),'value':_0x1a9d76[_0x8a31('0x63')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x2]?_0x1a9d76[_0x8a31('0x5d')][0x2][_0x8a31('0x5e')]:undefined)||0x14}];case _0x8a31('0x68'):case _0x8a31('0x69'):return[{'name':_0x8a31('0x6a'),'value':_0x1a9d76[_0x8a31('0x6a')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x0]?_0x1a9d76['attrs'][0x0][_0x8a31('0x5e')]:undefined)||_0x8a31('0x66')},{'name':_0x8a31('0x6b'),'value':_0x1a9d76[_0x8a31('0x6b')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x1]?_0x1a9d76[_0x8a31('0x5d')][0x1][_0x8a31('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x1a9d76[_0x8a31('0x6c')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x2]?_0x1a9d76[_0x8a31('0x5d')][0x2][_0x8a31('0x5e')]:undefined)||null},{'name':_0x8a31('0x67'),'value':_0x1a9d76[_0x8a31('0x67')]||(_0x1a9d76['attrs']&&_0x1a9d76[_0x8a31('0x5d')][0x3]?_0x1a9d76[_0x8a31('0x5d')][0x3][_0x8a31('0x5e')]:undefined)||[]}];case _0x8a31('0x6d'):return[{'name':'attrReport','type':_0x1a9d76[_0x8a31('0x6e')]||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x0]?_0x1a9d76[_0x8a31('0x5d')][0x0][_0x8a31('0x43')]:undefined)||null,'value':_0x1a9d76['attrReport']||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x0]?_0x1a9d76[_0x8a31('0x5d')][0x0]['value']:undefined)||null},{'name':_0x8a31('0x6f'),'value':_0x1a9d76['attrRefresh']||(_0x1a9d76[_0x8a31('0x5d')]&&_0x1a9d76[_0x8a31('0x5d')][0x1]?_0x1a9d76[_0x8a31('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x47405a){logger[_0x8a31('0x2b')](_0x8a31('0x70'),JSON[_0x8a31('0x71')](_0x47405a));return[];}}exports[_0x8a31('0x72')]=function(_0x46d0dc,_0x411342,_0x22d476){if(_0x46d0dc[_0x8a31('0x5b')]['id']){delete _0x46d0dc[_0x8a31('0x5b')]['id'];}return db[_0x8a31('0x31')][_0x8a31('0x4c')]({'where':{'id':_0x46d0dc['params']['id']}})['then'](handleEntityNotFound(_0x411342,null))[_0x8a31('0x26')](function(_0x5c4f5b){if(_0x5c4f5b){_0x46d0dc['body']['DashboardId']=_0x5c4f5b['id'];_0x46d0dc[_0x8a31('0x5b')][_0x8a31('0x5d')]=widgetAttributes(_0x46d0dc[_0x8a31('0x5b')]);return db['DashboardItem']['create'](_0x46d0dc[_0x8a31('0x5b')]);}})[_0x8a31('0x26')](respondWithResult(_0x411342,null))[_0x8a31('0x48')](handleError(_0x411342,null));};exports[_0x8a31('0x73')]=function(_0x112c57,_0x38e094,_0x4604c2){var _0x1fb68f={};var _0x4d3261={};var _0x34e385;var _0x4cb15b;return db[_0x8a31('0x31')][_0x8a31('0x74')]({'where':{'id':_0x112c57[_0x8a31('0x56')]['id']}})[_0x8a31('0x26')](handleEntityNotFound(_0x38e094,null))[_0x8a31('0x26')](function(_0x34157b){if(_0x34157b){_0x34e385=_0x34157b;_0x4d3261[_0x8a31('0x38')]=_['keys'](db['DashboardItem'][_0x8a31('0x32')]);_0x4d3261['query']=_[_0x8a31('0x35')](_0x112c57[_0x8a31('0x34')]);_0x4d3261[_0x8a31('0x36')]=_[_0x8a31('0x37')](_0x4d3261[_0x8a31('0x38')],_0x4d3261[_0x8a31('0x34')]);_0x1fb68f[_0x8a31('0x39')]=_[_0x8a31('0x37')](_0x4d3261[_0x8a31('0x38')],qs['fields'](_0x112c57[_0x8a31('0x34')][_0x8a31('0x4a')]));_0x1fb68f['attributes']=_0x1fb68f['attributes'][_0x8a31('0x3a')]?_0x1fb68f[_0x8a31('0x39')]:_0x4d3261[_0x8a31('0x38')];_0x1fb68f[_0x8a31('0x3d')]=qs[_0x8a31('0x3e')](_0x112c57['query'][_0x8a31('0x3e')]);_0x1fb68f[_0x8a31('0x41')]=qs[_0x8a31('0x36')](_[_0x8a31('0x3f')](_0x112c57['query'],_0x4d3261[_0x8a31('0x36')]));if(_0x112c57[_0x8a31('0x34')][_0x8a31('0x40')]){_0x1fb68f[_0x8a31('0x41')]=_[_0x8a31('0x42')](_0x1fb68f[_0x8a31('0x41')],{'$or':_[_0x8a31('0x30')](_0x1fb68f['attributes'],function(_0x4f504d){var _0x3c5a50={};_0x3c5a50[_0x4f504d]={'$like':'%'+_0x112c57[_0x8a31('0x34')][_0x8a31('0x40')]+'%'};return _0x3c5a50;})});}_0x1fb68f=_['merge']({},_0x1fb68f,_0x112c57[_0x8a31('0x57')]);return _0x34e385[_0x8a31('0x73')](_0x1fb68f);}})[_0x8a31('0x26')](function(_0x75cfd9){if(_0x75cfd9){_0x4cb15b=_0x75cfd9[_0x8a31('0x3a')];if(!_0x112c57[_0x8a31('0x34')]['hasOwnProperty'](_0x8a31('0x3c'))){_0x1fb68f[_0x8a31('0x1f')]=qs['limit'](_0x112c57[_0x8a31('0x34')][_0x8a31('0x1f')]);_0x1fb68f[_0x8a31('0x21')]=qs['offset'](_0x112c57['query']['offset']);}return _0x34e385[_0x8a31('0x73')](_0x1fb68f);}})[_0x8a31('0x26')](function(_0x91040b){if(_0x91040b){return _0x91040b?{'count':_0x4cb15b,'rows':_0x91040b}:null;}})[_0x8a31('0x26')](respondWithResult(_0x38e094,null))[_0x8a31('0x48')](handleError(_0x38e094,null));}; \ No newline at end of file +var _0xe308=['custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','web-report','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','sendStatus','end','status','offset','undefined','count','limit','json','apply','reject','update','destroy','get','CustomDashboards','stack','name','index','map','Dashboard','fieldName','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','create','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','iframe','attrUrl','attrs','value','https://'];(function(_0x5439b,_0x56595f){var _0x188f50=function(_0x8643eb){while(--_0x8643eb){_0x5439b['push'](_0x5439b['shift']());}};_0x188f50(++_0x56595f);}(_0xe308,0xff));var _0x8e30=function(_0x362258,_0x324d23){_0x362258=_0x362258-0x0;var _0x550079=_0xe308[_0x362258];return _0x550079;};'use strict';var emlformat=require(_0x8e30('0x0'));var rimraf=require(_0x8e30('0x1'));var zipdir=require(_0x8e30('0x2'));var jsonpatch=require(_0x8e30('0x3'));var rp=require('request-promise');var moment=require(_0x8e30('0x4'));var BPromise=require(_0x8e30('0x5'));var Mustache=require('mustache');var util=require(_0x8e30('0x6'));var path=require(_0x8e30('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e30('0x8'));var fs=require('fs');var fs_extra=require(_0x8e30('0x9'));var _=require(_0x8e30('0xa'));var squel=require('squel');var crypto=require(_0x8e30('0xb'));var jsforce=require(_0x8e30('0xc'));var deskjs=require(_0x8e30('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e30('0xe'));var Papa=require(_0x8e30('0xf'));var Redis=require(_0x8e30('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e30('0x11'));var hardwareService=require(_0x8e30('0x12'));var logger=require(_0x8e30('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8e30('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e30('0x15'))['db'];config['redis']=_['defaults'](config[_0x8e30('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e30('0x16')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x2502f0,_0x15369f){_0x15369f=_0x15369f||0xcc;return function(_0x4227fd){if(_0x4227fd){return _0x2502f0[_0x8e30('0x17')](_0x15369f);}return _0x2502f0['status'](_0x15369f)[_0x8e30('0x18')]();};}function respondWithResult(_0x46ce94,_0x2eb006){_0x2eb006=_0x2eb006||0xc8;return function(_0x546ed7){if(_0x546ed7){return _0x46ce94[_0x8e30('0x19')](_0x2eb006)['json'](_0x546ed7);}};}function respondWithFilteredResult(_0x23f0cb,_0x2fab3e){return function(_0x39b420){if(_0x39b420){var _0x1927f3=typeof _0x2fab3e[_0x8e30('0x1a')]===_0x8e30('0x1b')&&typeof _0x2fab3e['limit']==='undefined';var _0x120a88=_0x39b420[_0x8e30('0x1c')];var _0x246749=_0x1927f3?0x0:_0x2fab3e[_0x8e30('0x1a')];var _0x6204=_0x1927f3?_0x39b420[_0x8e30('0x1c')]:_0x2fab3e['offset']+_0x2fab3e[_0x8e30('0x1d')];var _0x48da33;if(_0x6204>=_0x120a88){_0x6204=_0x120a88;_0x48da33=0xc8;}else{_0x48da33=0xce;}_0x23f0cb[_0x8e30('0x19')](_0x48da33);return _0x23f0cb['set']('Content-Range',_0x246749+'-'+_0x6204+'/'+_0x120a88)[_0x8e30('0x1e')](_0x39b420);}return null;};}function patchUpdates(_0x523bbb){return function(_0xfc000b){try{jsonpatch[_0x8e30('0x1f')](_0xfc000b,_0x523bbb,!![]);}catch(_0x163c70){return BPromise[_0x8e30('0x20')](_0x163c70);}return _0xfc000b['save']();};}function saveUpdates(_0xb3e7a6,_0x5a15e1){return function(_0x2a8306){if(_0x2a8306){return _0x2a8306[_0x8e30('0x21')](_0xb3e7a6)['then'](function(_0xb56562){return _0xb56562;});}return null;};}function removeEntity(_0x36a6fc,_0x5626cf){return function(_0x4d9f54){if(_0x4d9f54){return _0x4d9f54[_0x8e30('0x22')]()['then'](function(){var _0x5f418d=_0x4d9f54[_0x8e30('0x23')]({'plain':!![]});var _0xb1167=_0x8e30('0x24');return db['UserProfileResource'][_0x8e30('0x22')]({'where':{'type':_0xb1167,'resourceId':_0x5f418d['id']}})['then'](function(){return _0x4d9f54;});})['then'](function(){_0x36a6fc[_0x8e30('0x19')](0xcc)[_0x8e30('0x18')]();});}};}function handleEntityNotFound(_0x1d2938,_0x18c8b8){return function(_0x57636d){if(!_0x57636d){_0x1d2938[_0x8e30('0x17')](0x194);}return _0x57636d;};}function handleError(_0x35fd8b,_0x7fa695){_0x7fa695=_0x7fa695||0x1f4;return function(_0x3b27f9){logger['error'](_0x3b27f9[_0x8e30('0x25')]);if(_0x3b27f9[_0x8e30('0x26')]){delete _0x3b27f9['name'];}_0x35fd8b[_0x8e30('0x19')](_0x7fa695)['send'](_0x3b27f9);};}exports[_0x8e30('0x27')]=function(_0x26e2d3,_0x4aa833){var _0x11f86b={},_0x53ebb9={},_0x97c5f5={'count':0x0,'rows':[]};var _0xf352ef=_[_0x8e30('0x28')](db[_0x8e30('0x29')]['rawAttributes'],function(_0x499679){return{'name':_0x499679[_0x8e30('0x2a')],'type':_0x499679[_0x8e30('0x2b')][_0x8e30('0x2c')]};});_0x53ebb9[_0x8e30('0x2d')]=_[_0x8e30('0x28')](_0xf352ef,_0x8e30('0x26'));_0x53ebb9['query']=_['keys'](_0x26e2d3['query']);_0x53ebb9[_0x8e30('0x2e')]=_[_0x8e30('0x2f')](_0x53ebb9['model'],_0x53ebb9[_0x8e30('0x30')]);_0x11f86b[_0x8e30('0x31')]=_[_0x8e30('0x2f')](_0x53ebb9[_0x8e30('0x2d')],qs[_0x8e30('0x32')](_0x26e2d3['query'][_0x8e30('0x32')]));_0x11f86b['attributes']=_0x11f86b[_0x8e30('0x31')]['length']?_0x11f86b['attributes']:_0x53ebb9[_0x8e30('0x2d')];if(!_0x26e2d3['query'][_0x8e30('0x33')](_0x8e30('0x34'))){_0x11f86b[_0x8e30('0x1d')]=qs[_0x8e30('0x1d')](_0x26e2d3[_0x8e30('0x30')][_0x8e30('0x1d')]);_0x11f86b[_0x8e30('0x1a')]=qs[_0x8e30('0x1a')](_0x26e2d3[_0x8e30('0x30')][_0x8e30('0x1a')]);}_0x11f86b[_0x8e30('0x35')]=qs[_0x8e30('0x36')](_0x26e2d3[_0x8e30('0x30')][_0x8e30('0x36')]);_0x11f86b[_0x8e30('0x37')]=qs[_0x8e30('0x2e')](_[_0x8e30('0x38')](_0x26e2d3[_0x8e30('0x30')],_0x53ebb9[_0x8e30('0x2e')]),_0xf352ef);if(_0x26e2d3[_0x8e30('0x30')][_0x8e30('0x39')]){_0x11f86b[_0x8e30('0x37')]=_[_0x8e30('0x3a')](_0x11f86b[_0x8e30('0x37')],{'$or':_['map'](_0xf352ef,function(_0x474294){if(_0x474294[_0x8e30('0x2b')]!==_0x8e30('0x3b')){var _0x29a890={};_0x29a890[_0x474294[_0x8e30('0x26')]]={'$like':'%'+_0x26e2d3['query'][_0x8e30('0x39')]+'%'};return _0x29a890;}})});}_0x11f86b=_[_0x8e30('0x3a')]({},_0x11f86b,_0x26e2d3[_0x8e30('0x3c')]);var _0x4ecb72={'where':_0x11f86b['where']};return db[_0x8e30('0x29')][_0x8e30('0x1c')](_0x4ecb72)[_0x8e30('0x3d')](function(_0x5a70fa){_0x97c5f5[_0x8e30('0x1c')]=_0x5a70fa;if(_0x26e2d3['query'][_0x8e30('0x3e')]){_0x11f86b[_0x8e30('0x3f')]=[{'all':!![]}];}return db[_0x8e30('0x29')][_0x8e30('0x40')](_0x11f86b);})['then'](function(_0x34d3cd){_0x97c5f5[_0x8e30('0x41')]=_0x34d3cd;return _0x97c5f5;})['then'](respondWithFilteredResult(_0x4aa833,_0x11f86b))[_0x8e30('0x42')](handleError(_0x4aa833,null));};exports[_0x8e30('0x43')]=function(_0x326321,_0x3fc78b){var _0x2230ed={'raw':![],'where':{'id':_0x326321[_0x8e30('0x44')]['id']}},_0x3957a9={};_0x3957a9[_0x8e30('0x2d')]=_['keys'](db['Dashboard'][_0x8e30('0x45')]);_0x3957a9[_0x8e30('0x30')]=_[_0x8e30('0x46')](_0x326321[_0x8e30('0x30')]);_0x3957a9[_0x8e30('0x2e')]=_[_0x8e30('0x2f')](_0x3957a9[_0x8e30('0x2d')],_0x3957a9[_0x8e30('0x30')]);_0x2230ed['attributes']=_[_0x8e30('0x2f')](_0x3957a9[_0x8e30('0x2d')],qs[_0x8e30('0x32')](_0x326321['query'][_0x8e30('0x32')]));_0x2230ed[_0x8e30('0x31')]=_0x2230ed[_0x8e30('0x31')][_0x8e30('0x47')]?_0x2230ed[_0x8e30('0x31')]:_0x3957a9[_0x8e30('0x2d')];if(_0x326321['query'][_0x8e30('0x3e')]){_0x2230ed[_0x8e30('0x3f')]=[{'all':!![]}];}_0x2230ed=_[_0x8e30('0x3a')]({},_0x2230ed,_0x326321['options']);return db[_0x8e30('0x29')]['find'](_0x2230ed)[_0x8e30('0x3d')](handleEntityNotFound(_0x3fc78b,null))[_0x8e30('0x3d')](respondWithResult(_0x3fc78b,null))[_0x8e30('0x42')](handleError(_0x3fc78b,null));};exports[_0x8e30('0x48')]=function(_0x8319bf,_0x13d5c7){return db[_0x8e30('0x29')][_0x8e30('0x48')](_0x8319bf['body'],{})[_0x8e30('0x3d')](function(_0x383421){var _0x19e318=_0x8319bf['user'][_0x8e30('0x23')]({'plain':!![]});if(!_0x19e318)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19e318['role']==='user'){var _0x928146=_0x383421[_0x8e30('0x23')]({'plain':!![]});var _0x52dbd9='CustomDashboards';return db[_0x8e30('0x49')][_0x8e30('0x4a')]({'where':{'name':_0x52dbd9,'userProfileId':_0x19e318[_0x8e30('0x4b')]},'raw':!![]})['then'](function(_0x5daf13){if(_0x5daf13&&_0x5daf13['autoAssociation']===0x0){return db[_0x8e30('0x4c')]['create']({'name':_0x928146[_0x8e30('0x26')],'resourceId':_0x928146['id'],'type':_0x5daf13[_0x8e30('0x26')],'sectionId':_0x5daf13['id']},{})['then'](function(){return _0x383421;});}else{return _0x383421;}})[_0x8e30('0x42')](function(_0x5dde96){logger[_0x8e30('0x4d')](_0x8e30('0x4e'),_0x5dde96);throw _0x5dde96;});}return _0x383421;})[_0x8e30('0x3d')](respondWithResult(_0x13d5c7,0xc9))[_0x8e30('0x42')](handleError(_0x13d5c7,null));};exports[_0x8e30('0x4f')]=function(_0x412baf,_0x1609a5){var _0x1bfd4d={'where':{'id':_0x412baf[_0x8e30('0x44')]['id']}},_0x399504={};_0x399504[_0x8e30('0x2d')]=_['keys'](db[_0x8e30('0x29')]['rawAttributes']);_0x1bfd4d['attributes']=_[_0x8e30('0x2f')](_0x399504[_0x8e30('0x2d')],qs[_0x8e30('0x32')](_0x412baf[_0x8e30('0x30')][_0x8e30('0x32')]));_0x1bfd4d[_0x8e30('0x31')]=_0x1bfd4d[_0x8e30('0x31')]['length']?_0x1bfd4d[_0x8e30('0x31')]:_0x399504['model'];if(_0x412baf[_0x8e30('0x30')]['includeAll']){_0x1bfd4d[_0x8e30('0x3f')]=[{'all':!![]}];}_0x1bfd4d=_[_0x8e30('0x3a')]({},_0x1bfd4d,_0x412baf[_0x8e30('0x3c')]);return db['Dashboard'][_0x8e30('0x4a')](_0x1bfd4d)['then'](handleEntityNotFound(_0x1609a5,null))[_0x8e30('0x3d')](function(_0x434920){if(_0x434920){var _0x1f6783=_0x434920[_0x8e30('0x23')]({'plain':!![]});_0x1f6783=qs[_0x8e30('0x50')](_0x1f6783,['id',_0x8e30('0x51'),'updatedAt']);_0x412baf[_0x8e30('0x52')]=_[_0x8e30('0x50')](_0x412baf[_0x8e30('0x52')],['id','createdAt',_0x8e30('0x53')]);return db[_0x8e30('0x29')][_0x8e30('0x48')](_['merge'](_0x1f6783,_0x412baf[_0x8e30('0x52')]),{'include':_0x412baf[_0x8e30('0x30')][_0x8e30('0x3e')]?[{'all':!![]}]:undefined})[_0x8e30('0x3d')](function(_0x2680bc){var _0x308c5a=_0x412baf[_0x8e30('0x54')][_0x8e30('0x23')]({'plain':!![]});if(!_0x308c5a)throw new Error(_0x8e30('0x55'));if(_0x308c5a[_0x8e30('0x56')]===_0x8e30('0x54')){var _0x2fa9ac=_0x2680bc[_0x8e30('0x23')]({'plain':!![]});var _0x11ecaa='CustomDashboards';return db[_0x8e30('0x49')][_0x8e30('0x4a')]({'where':{'name':_0x11ecaa,'userProfileId':_0x308c5a[_0x8e30('0x4b')]},'raw':!![]})[_0x8e30('0x3d')](function(_0xa85116){if(_0xa85116&&_0xa85116[_0x8e30('0x57')]===0x0){return db['UserProfileResource'][_0x8e30('0x48')]({'name':_0x2fa9ac[_0x8e30('0x26')],'resourceId':_0x2fa9ac['id'],'type':_0xa85116[_0x8e30('0x26')],'sectionId':_0xa85116['id']},{})[_0x8e30('0x3d')](function(){return _0x2680bc;});}else{return _0x2680bc;}})[_0x8e30('0x42')](function(_0x5c3e1e){logger[_0x8e30('0x4d')](_0x8e30('0x4e'),_0x5c3e1e);throw _0x5c3e1e;});}return _0x2680bc;});}})[_0x8e30('0x3d')](respondWithResult(_0x1609a5,0xc9))[_0x8e30('0x42')](handleError(_0x1609a5,null));};exports[_0x8e30('0x21')]=function(_0x1834fc,_0x5a10b5){if(_0x1834fc[_0x8e30('0x52')]['id']){delete _0x1834fc[_0x8e30('0x52')]['id'];}return db[_0x8e30('0x29')]['find']({'where':{'id':_0x1834fc[_0x8e30('0x44')]['id']}})[_0x8e30('0x3d')](handleEntityNotFound(_0x5a10b5,null))[_0x8e30('0x3d')](saveUpdates(_0x1834fc[_0x8e30('0x52')],null))[_0x8e30('0x3d')](respondWithResult(_0x5a10b5,null))['catch'](handleError(_0x5a10b5,null));};exports[_0x8e30('0x22')]=function(_0x28959e,_0x41fc23){return db[_0x8e30('0x29')][_0x8e30('0x4a')]({'where':{'id':_0x28959e[_0x8e30('0x44')]['id']}})[_0x8e30('0x3d')](handleEntityNotFound(_0x41fc23,null))['then'](removeEntity(_0x41fc23,null))[_0x8e30('0x42')](handleError(_0x41fc23,null));};function widgetAttributes(_0x428eb0){try{switch(_0x428eb0['type']){case _0x8e30('0x58'):return[{'name':'attrUrl','value':_0x428eb0[_0x8e30('0x59')]||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0['attrs'][0x0]?_0x428eb0[_0x8e30('0x5a')][0x0][_0x8e30('0x5b')]:undefined)||_0x8e30('0x5c')}];case _0x8e30('0x5d'):return[{'name':_0x8e30('0x5e'),'value':_0x428eb0['attrPath']||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x0]?_0x428eb0['attrs'][0x0]['value']:undefined)||''}];case _0x8e30('0x5f'):return[{'name':_0x8e30('0x60'),'value':_0x428eb0[_0x8e30('0x60')]||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x0]?_0x428eb0[_0x8e30('0x5a')][0x0][_0x8e30('0x5b')]:undefined)||_0x8e30('0x61')},{'name':_0x8e30('0x62'),'value':_0x428eb0[_0x8e30('0x62')]||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x1]?_0x428eb0['attrs'][0x1]['value']:undefined)||_0x8e30('0x63')},{'name':_0x8e30('0x64'),'value':_0x428eb0[_0x8e30('0x64')]||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x2]?_0x428eb0['attrs'][0x2][_0x8e30('0x5b')]:undefined)||0xc}];case _0x8e30('0x65'):return[{'name':_0x8e30('0x66'),'value':_0x428eb0[_0x8e30('0x66')]||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x0]?_0x428eb0[_0x8e30('0x5a')][0x0][_0x8e30('0x5b')]:undefined)||_0x8e30('0x67')},{'name':_0x8e30('0x68'),'value':_0x428eb0[_0x8e30('0x68')]||(_0x428eb0['attrs']&&_0x428eb0[_0x8e30('0x5a')][0x1]?_0x428eb0[_0x8e30('0x5a')][0x1][_0x8e30('0x5b')]:undefined)||[]},{'name':_0x8e30('0x64'),'value':_0x428eb0[_0x8e30('0x64')]||(_0x428eb0['attrs']&&_0x428eb0[_0x8e30('0x5a')][0x2]?_0x428eb0[_0x8e30('0x5a')][0x2][_0x8e30('0x5b')]:undefined)||0x14}];case _0x8e30('0x69'):case'pie-chart':return[{'name':_0x8e30('0x6a'),'value':_0x428eb0['attrSerie1']||(_0x428eb0['attrs']&&_0x428eb0[_0x8e30('0x5a')][0x0]?_0x428eb0[_0x8e30('0x5a')][0x0][_0x8e30('0x5b')]:undefined)||_0x8e30('0x67')},{'name':_0x8e30('0x6b'),'value':_0x428eb0['attrSerie2']||(_0x428eb0['attrs']&&_0x428eb0['attrs'][0x1]?_0x428eb0['attrs'][0x1][_0x8e30('0x5b')]:undefined)||null},{'name':'attrSerie3','value':_0x428eb0['attrSerie3']||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x2]?_0x428eb0[_0x8e30('0x5a')][0x2]['value']:undefined)||null},{'name':_0x8e30('0x68'),'value':_0x428eb0[_0x8e30('0x68')]||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x3]?_0x428eb0[_0x8e30('0x5a')][0x3][_0x8e30('0x5b')]:undefined)||[]}];case _0x8e30('0x6c'):return[{'name':'attrReport','type':_0x428eb0['reportType']||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x0]?_0x428eb0[_0x8e30('0x5a')][0x0][_0x8e30('0x2b')]:undefined)||null,'value':_0x428eb0['attrReport']||(_0x428eb0['attrs']&&_0x428eb0['attrs'][0x0]?_0x428eb0[_0x8e30('0x5a')][0x0][_0x8e30('0x5b')]:undefined)||null},{'name':_0x8e30('0x6d'),'value':_0x428eb0['attrRefresh']||(_0x428eb0[_0x8e30('0x5a')]&&_0x428eb0[_0x8e30('0x5a')][0x1]?_0x428eb0[_0x8e30('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x25dc0b){logger['error'](_0x8e30('0x6e'),JSON['stringify'](_0x25dc0b));return[];}}exports[_0x8e30('0x6f')]=function(_0x1905cc,_0xc42cb6,_0x79dee9){if(_0x1905cc['body']['id']){delete _0x1905cc[_0x8e30('0x52')]['id'];}return db[_0x8e30('0x29')]['find']({'where':{'id':_0x1905cc['params']['id']}})[_0x8e30('0x3d')](handleEntityNotFound(_0xc42cb6,null))[_0x8e30('0x3d')](function(_0x5d5e8f){if(_0x5d5e8f){_0x1905cc[_0x8e30('0x52')][_0x8e30('0x70')]=_0x5d5e8f['id'];_0x1905cc[_0x8e30('0x52')]['attrs']=widgetAttributes(_0x1905cc[_0x8e30('0x52')]);return db[_0x8e30('0x71')]['create'](_0x1905cc[_0x8e30('0x52')]);}})[_0x8e30('0x3d')](respondWithResult(_0xc42cb6,null))[_0x8e30('0x42')](handleError(_0xc42cb6,null));};exports[_0x8e30('0x72')]=function(_0x3546e7,_0x23f3be,_0x14d1b7){var _0x431816={};var _0x4b70d4={};var _0x49b35c;var _0x38727b;return db['Dashboard'][_0x8e30('0x73')]({'where':{'id':_0x3546e7['params']['id']}})['then'](handleEntityNotFound(_0x23f3be,null))[_0x8e30('0x3d')](function(_0x3d073e){if(_0x3d073e){_0x49b35c=_0x3d073e;_0x4b70d4[_0x8e30('0x2d')]=_[_0x8e30('0x46')](db[_0x8e30('0x71')][_0x8e30('0x45')]);_0x4b70d4[_0x8e30('0x30')]=_[_0x8e30('0x46')](_0x3546e7['query']);_0x4b70d4[_0x8e30('0x2e')]=_[_0x8e30('0x2f')](_0x4b70d4['model'],_0x4b70d4['query']);_0x431816[_0x8e30('0x31')]=_[_0x8e30('0x2f')](_0x4b70d4[_0x8e30('0x2d')],qs[_0x8e30('0x32')](_0x3546e7['query'][_0x8e30('0x32')]));_0x431816[_0x8e30('0x31')]=_0x431816[_0x8e30('0x31')]['length']?_0x431816[_0x8e30('0x31')]:_0x4b70d4[_0x8e30('0x2d')];_0x431816[_0x8e30('0x35')]=qs[_0x8e30('0x36')](_0x3546e7[_0x8e30('0x30')][_0x8e30('0x36')]);_0x431816[_0x8e30('0x37')]=qs['filters'](_[_0x8e30('0x38')](_0x3546e7[_0x8e30('0x30')],_0x4b70d4['filters']));if(_0x3546e7['query']['filter']){_0x431816[_0x8e30('0x37')]=_[_0x8e30('0x3a')](_0x431816[_0x8e30('0x37')],{'$or':_[_0x8e30('0x28')](_0x431816['attributes'],function(_0x248ffd){var _0x10f46b={};_0x10f46b[_0x248ffd]={'$like':'%'+_0x3546e7[_0x8e30('0x30')][_0x8e30('0x39')]+'%'};return _0x10f46b;})});}_0x431816=_[_0x8e30('0x3a')]({},_0x431816,_0x3546e7[_0x8e30('0x3c')]);return _0x49b35c[_0x8e30('0x72')](_0x431816);}})[_0x8e30('0x3d')](function(_0x1ebef4){if(_0x1ebef4){_0x38727b=_0x1ebef4[_0x8e30('0x47')];if(!_0x3546e7[_0x8e30('0x30')]['hasOwnProperty'](_0x8e30('0x34'))){_0x431816[_0x8e30('0x1d')]=qs[_0x8e30('0x1d')](_0x3546e7[_0x8e30('0x30')][_0x8e30('0x1d')]);_0x431816[_0x8e30('0x1a')]=qs['offset'](_0x3546e7[_0x8e30('0x30')][_0x8e30('0x1a')]);}return _0x49b35c[_0x8e30('0x72')](_0x431816);}})['then'](function(_0xbe3a7b){if(_0xbe3a7b){return _0xbe3a7b?{'count':_0x38727b,'rows':_0xbe3a7b}:null;}})[_0x8e30('0x3d')](respondWithResult(_0x23f3be,null))[_0x8e30('0x42')](handleError(_0x23f3be,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 646b2bd..2404246 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 _0xde81=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x2b40b9,_0x51bb4a){var _0x28471a=function(_0x25abed){while(--_0x25abed){_0x2b40b9['push'](_0x2b40b9['shift']());}};_0x28471a(++_0x51bb4a);}(_0xde81,0x109));var _0x1de8=function(_0x193fe6,_0x57d2c2){_0x193fe6=_0x193fe6-0x0;var _0x3afc4f=_0xde81[_0x193fe6];return _0x3afc4f;};'use strict';var EventEmitter=require(_0x1de8('0x0'));var Dashboard=require(_0x1de8('0x1'))['db'][_0x1de8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1de8('0x3')](0x0);var events={'afterCreate':_0x1de8('0x4'),'afterUpdate':_0x1de8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x547821){return function(_0xebfcf9,_0x5953a6,_0x1421ce){DashboardEvents[_0x1de8('0x6')](_0x547821+':'+_0xebfcf9['id'],_0xebfcf9);DashboardEvents[_0x1de8('0x6')](_0x547821,_0xebfcf9);_0x1421ce(null);};}for(var e in events){if(events[_0x1de8('0x7')](e)){var event=events[e];Dashboard[_0x1de8('0x8')](e,emitEvent(event));}}module[_0x1de8('0x9')]=DashboardEvents; \ No newline at end of file +var _0x8598=['Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x47ae52,_0x4d1100){var _0x4aaf91=function(_0x2f21fb){while(--_0x2f21fb){_0x47ae52['push'](_0x47ae52['shift']());}};_0x4aaf91(++_0x4d1100);}(_0x8598,0x17f));var _0x8859=function(_0x5ad820,_0x955136){_0x5ad820=_0x5ad820-0x0;var _0x1969d3=_0x8598[_0x5ad820];return _0x1969d3;};'use strict';var EventEmitter=require(_0x8859('0x0'));var Dashboard=require(_0x8859('0x1'))['db'][_0x8859('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8859('0x3')](0x0);var events={'afterCreate':_0x8859('0x4'),'afterUpdate':_0x8859('0x5'),'afterDestroy':_0x8859('0x6')};function emitEvent(_0x4a9b9e){return function(_0x478c09,_0x2afb9b,_0x103c87){DashboardEvents['emit'](_0x4a9b9e+':'+_0x478c09['id'],_0x478c09);DashboardEvents[_0x8859('0x7')](_0x4a9b9e,_0x478c09);_0x103c87(null);};}for(var e in events){if(events[_0x8859('0x8')](e)){var event=events[e];Dashboard[_0x8859('0x9')](e,emitEvent(event));}}module[_0x8859('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 9ff207b..488e018 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 _0x53d0=['moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','util','../../config/logger'];(function(_0xc84096,_0x138565){var _0x3dfc04=function(_0x1cffe5){while(--_0x1cffe5){_0xc84096['push'](_0xc84096['shift']());}};_0x3dfc04(++_0x138565);}(_0x53d0,0x6c));var _0x053d=function(_0x49becf,_0x11a998){_0x49becf=_0x49becf-0x0;var _0x5364e5=_0x53d0[_0x49becf];return _0x5364e5;};'use strict';var _=require('lodash');var util=require(_0x053d('0x0'));var logger=require(_0x053d('0x1'))('api');var moment=require(_0x053d('0x2'));var BPromise=require('bluebird');var rp=require(_0x053d('0x3'));var fs=require('fs');var path=require(_0x053d('0x4'));var rimraf=require(_0x053d('0x5'));var config=require(_0x053d('0x6'));var attributes=require(_0x053d('0x7'));module[_0x053d('0x8')]=function(_0x5406cd,_0x4ee5b6){return _0x5406cd[_0x053d('0x9')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3560=['Dashboard','dashboards','lodash','util','../../config/logger','bluebird','path','../../config/environment','define'];(function(_0x6ffca4,_0x187a3b){var _0xb6b153=function(_0x170538){while(--_0x170538){_0x6ffca4['push'](_0x6ffca4['shift']());}};_0xb6b153(++_0x187a3b);}(_0x3560,0x1a9));var _0x0356=function(_0x21233e,_0x2d39c1){_0x21233e=_0x21233e-0x0;var _0x3752c9=_0x3560[_0x21233e];return _0x3752c9;};'use strict';var _=require(_0x0356('0x0'));var util=require(_0x0356('0x1'));var logger=require(_0x0356('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0356('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0356('0x4'));var rimraf=require('rimraf');var config=require(_0x0356('0x5'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x34a1d8,_0xa2373f){return _0x34a1d8[_0x0356('0x6')](_0x0356('0x7'),attributes,{'tableName':_0x0356('0x8'),'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 22de59e..05d0a24 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 _0x12f6=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xdc1475,_0x57e348){var _0x4f1be2=function(_0x7eb912){while(--_0x7eb912){_0xdc1475['push'](_0xdc1475['shift']());}};_0x4f1be2(++_0x57e348);}(_0x12f6,0x100));var _0x612f=function(_0x335e51,_0x3c63fb){_0x335e51=_0x335e51-0x0;var _0x11637f=_0x12f6[_0x335e51];return _0x11637f;};'use strict';var _=require(_0x612f('0x0'));var util=require(_0x612f('0x1'));var moment=require(_0x612f('0x2'));var BPromise=require(_0x612f('0x3'));var rs=require(_0x612f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x612f('0x5'))['db'];var utils=require(_0x612f('0x6'));var logger=require(_0x612f('0x7'))(_0x612f('0x8'));var config=require(_0x612f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x612f('0xa')][_0x612f('0xb')]({'port':0x232a});config[_0x612f('0xc')]=_[_0x612f('0xd')](config[_0x612f('0xc')],{'host':_0x612f('0xe'),'port':0x18eb});var socket=require(_0x612f('0xf'))(new Redis(config[_0x612f('0xc')]));require('./dashboard.socket')[_0x612f('0x10')](socket);function respondWithRpcPromise(_0x805d29,_0x4c6978,_0xb8fb82){return new BPromise(function(_0x235a70,_0x27be82){return client[_0x612f('0x11')](_0x805d29,_0xb8fb82)[_0x612f('0x12')](function(_0x3154c0){logger[_0x612f('0x13')](_0x612f('0x14'),_0x4c6978,_0x612f('0x15'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x4c6978,_0x612f('0x15'),JSON[_0x612f('0x16')](_0x3154c0));if(_0x3154c0[_0x612f('0x17')]){if(_0x3154c0['error'][_0x612f('0x18')]===0x1f4){logger[_0x612f('0x17')](_0x612f('0x14'),_0x4c6978,_0x3154c0[_0x612f('0x17')][_0x612f('0x19')]);return _0x27be82(_0x3154c0[_0x612f('0x17')][_0x612f('0x19')]);}logger[_0x612f('0x17')](_0x612f('0x14'),_0x4c6978,_0x3154c0[_0x612f('0x17')]['message']);return _0x235a70(_0x3154c0[_0x612f('0x17')]['message']);}else{logger[_0x612f('0x13')](_0x612f('0x14'),_0x4c6978,_0x612f('0x15'));_0x235a70(_0x3154c0[_0x612f('0x1a')][_0x612f('0x19')]);}})[_0x612f('0x1b')](function(_0x11aa83){logger[_0x612f('0x17')](_0x612f('0x14'),_0x4c6978,_0x11aa83);_0x27be82(_0x11aa83);});});} \ No newline at end of file +var _0x31dc=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x1d9c5c,_0x2bb599){var _0x354a16=function(_0x2d22ba){while(--_0x2d22ba){_0x1d9c5c['push'](_0x1d9c5c['shift']());}};_0x354a16(++_0x2bb599);}(_0x31dc,0xeb));var _0xc31d=function(_0x43ec83,_0x15c436){_0x43ec83=_0x43ec83-0x0;var _0x3ae207=_0x31dc[_0x43ec83];return _0x3ae207;};'use strict';var _=require('lodash');var util=require(_0xc31d('0x0'));var moment=require(_0xc31d('0x1'));var BPromise=require(_0xc31d('0x2'));var rs=require(_0xc31d('0x3'));var fs=require('fs');var Redis=require(_0xc31d('0x4'));var db=require(_0xc31d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc31d('0x6'))(_0xc31d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc31d('0x8')][_0xc31d('0x9')]({'port':0x232a});config[_0xc31d('0xa')]=_['defaults'](config[_0xc31d('0xa')],{'host':_0xc31d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0xc31d('0xc')](socket);function respondWithRpcPromise(_0x2b344a,_0x39f1b8,_0x33749b){return new BPromise(function(_0x5e161e,_0x126789){return client[_0xc31d('0xd')](_0x2b344a,_0x33749b)['then'](function(_0x16efa9){logger[_0xc31d('0xe')](_0xc31d('0xf'),_0x39f1b8,_0xc31d('0x10'));logger['debug'](_0xc31d('0x11'),_0x39f1b8,_0xc31d('0x10'),JSON[_0xc31d('0x12')](_0x16efa9));if(_0x16efa9[_0xc31d('0x13')]){if(_0x16efa9[_0xc31d('0x13')]['code']===0x1f4){logger[_0xc31d('0x13')](_0xc31d('0xf'),_0x39f1b8,_0x16efa9[_0xc31d('0x13')][_0xc31d('0x14')]);return _0x126789(_0x16efa9[_0xc31d('0x13')][_0xc31d('0x14')]);}logger[_0xc31d('0x13')]('Dashboard,\x20%s,\x20%s',_0x39f1b8,_0x16efa9[_0xc31d('0x13')][_0xc31d('0x14')]);return _0x5e161e(_0x16efa9[_0xc31d('0x13')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x39f1b8,_0xc31d('0x10'));_0x5e161e(_0x16efa9[_0xc31d('0x15')]['message']);}})[_0xc31d('0x16')](function(_0x47f2de){logger[_0xc31d('0x13')](_0xc31d('0xf'),_0x39f1b8,_0x47f2de);_0x126789(_0x47f2de);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1c29d3b..1cf4da7 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 _0x8ca5=['removeListener','length','dashboard:','save','remove','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8ca5,0xa5));var _0x58ca=function(_0x194bb9,_0x47c509){_0x194bb9=_0x194bb9-0x0;var _0x4bf881=_0x8ca5[_0x194bb9];return _0x4bf881;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x58ca('0x0'),_0x58ca('0x1'),'update'];function createListener(_0xc5999f,_0x4d884b){return function(_0x491b69){_0x4d884b[_0x58ca('0x2')](_0xc5999f,_0x491b69);};}function removeListener(_0x41235a,_0x2deb68){return function(){DashboardEvents[_0x58ca('0x3')](_0x41235a,_0x2deb68);};}exports['register']=function(_0x13553a){for(var _0x13100e=0x0,_0x401650=events[_0x58ca('0x4')];_0x13100e<_0x401650;_0x13100e++){var _0x314d14=events[_0x13100e];var _0x53c5ff=createListener(_0x58ca('0x5')+_0x314d14,_0x13553a);DashboardEvents['on'](_0x314d14,_0x53c5ff);}}; \ No newline at end of file +var _0xec0a=['register','length','dashboard:','save','remove','update','emit','removeListener'];(function(_0x5524e2,_0x23c52f){var _0x801bcb=function(_0x63436a){while(--_0x63436a){_0x5524e2['push'](_0x5524e2['shift']());}};_0x801bcb(++_0x23c52f);}(_0xec0a,0x9b));var _0xaec0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xec0a[_0x432682];return _0x463d05;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xaec0('0x0'),_0xaec0('0x1'),_0xaec0('0x2')];function createListener(_0x4c6f2b,_0x1cc84b){return function(_0xcb9360){_0x1cc84b[_0xaec0('0x3')](_0x4c6f2b,_0xcb9360);};}function removeListener(_0x251eac,_0x5bfad8){return function(){DashboardEvents[_0xaec0('0x4')](_0x251eac,_0x5bfad8);};}exports[_0xaec0('0x5')]=function(_0x33c3ef){for(var _0x222300=0x0,_0x11a5e9=events[_0xaec0('0x6')];_0x222300<_0x11a5e9;_0x222300++){var _0x2d8e09=events[_0x222300];var _0x3a1b08=createListener(_0xaec0('0x7')+_0x2d8e09,_0x33c3ef);DashboardEvents['on'](_0x2d8e09,_0x3a1b08);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 047da1a..d396bea 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 _0x2e78=['get','index','/:id','isAuthenticated','getItems','post','/:id/items','addItem','put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x573896,_0x44e988){var _0x2548c1=function(_0x2cbcef){while(--_0x2cbcef){_0x573896['push'](_0x573896['shift']());}};_0x2548c1(++_0x44e988);}(_0x2e78,0x13d));var _0x82e7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2e78[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0x82e7('0x0'));var path=require('path');var timeout=require(_0x82e7('0x1'));var express=require('express');var router=express[_0x82e7('0x2')]();var fs_extra=require(_0x82e7('0x3'));var auth=require(_0x82e7('0x4'));var interaction=require(_0x82e7('0x5'));var config=require(_0x82e7('0x6'));var controller=require('./dashboard.controller');router[_0x82e7('0x7')]('/',auth['isAuthenticated'](),controller[_0x82e7('0x8')]);router[_0x82e7('0x7')](_0x82e7('0x9'),auth[_0x82e7('0xa')](),controller['show']);router[_0x82e7('0x7')]('/:id/items',auth[_0x82e7('0xa')](),controller[_0x82e7('0xb')]);router[_0x82e7('0xc')]('/',auth[_0x82e7('0xa')](),controller['create']);router['post']('/:id/clone',auth[_0x82e7('0xa')](),controller['clone']);router[_0x82e7('0xc')](_0x82e7('0xd'),auth[_0x82e7('0xa')](),controller[_0x82e7('0xe')]);router[_0x82e7('0xf')]('/:id',auth[_0x82e7('0xa')](),controller['update']);router[_0x82e7('0x10')](_0x82e7('0x9'),auth[_0x82e7('0xa')](),controller['destroy']);module[_0x82e7('0x11')]=router; \ No newline at end of file +var _0x417c=['/:id','isAuthenticated','show','getItems','create','post','/:id/clone','clone','/:id/items','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get'];(function(_0x415999,_0x2e0e6e){var _0x3ae498=function(_0x21329c){while(--_0x21329c){_0x415999['push'](_0x415999['shift']());}};_0x3ae498(++_0x2e0e6e);}(_0x417c,0x77));var _0xc417=function(_0x1a030b,_0x454eb7){_0x1a030b=_0x1a030b-0x0;var _0x376820=_0x417c[_0x1a030b];return _0x376820;};'use strict';var multer=require(_0xc417('0x0'));var util=require(_0xc417('0x1'));var path=require(_0xc417('0x2'));var timeout=require(_0xc417('0x3'));var express=require(_0xc417('0x4'));var router=express[_0xc417('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc417('0x6'));var interaction=require(_0xc417('0x7'));var config=require(_0xc417('0x8'));var controller=require(_0xc417('0x9'));router[_0xc417('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc417('0xa')](_0xc417('0xb'),auth[_0xc417('0xc')](),controller[_0xc417('0xd')]);router[_0xc417('0xa')]('/:id/items',auth[_0xc417('0xc')](),controller[_0xc417('0xe')]);router['post']('/',auth[_0xc417('0xc')](),controller[_0xc417('0xf')]);router[_0xc417('0x10')](_0xc417('0x11'),auth[_0xc417('0xc')](),controller[_0xc417('0x12')]);router[_0xc417('0x10')](_0xc417('0x13'),auth[_0xc417('0xc')](),controller[_0xc417('0x14')]);router[_0xc417('0x15')](_0xc417('0xb'),auth[_0xc417('0xc')](),controller[_0xc417('0x16')]);router[_0xc417('0x17')](_0xc417('0xb'),auth[_0xc417('0xc')](),controller[_0xc417('0x18')]);module[_0xc417('0x19')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 5f80d6b..68313f1 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 _0xadb5=['long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','exports','STRING'];(function(_0x5b5231,_0x4bb3ac){var _0x4d86c5=function(_0xcb3d73){while(--_0xcb3d73){_0x5b5231['push'](_0x5b5231['shift']());}};_0x4d86c5(++_0x4bb3ac);}(_0xadb5,0xad));var _0x5adb=function(_0xf71eca,_0x1e284d){_0xf71eca=_0xf71eca-0x0;var _0x5ed00e=_0xadb5[_0xf71eca];return _0x5ed00e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5adb('0x0'));var _=require('lodash');module[_0x5adb('0x1')]={'title':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5adb('0x3')),'get':function(){try{return JSON[_0x5adb('0x4')](this[_0x5adb('0x5')]('attrs'));}catch(_0x35a5d3){return[];}},'set':function(_0x168d89){try{this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')](_0x168d89));}catch(_0x353885){this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5adb('0x9')]},'col':{'type':Sequelize[_0x5adb('0x9')]},'background':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5adb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5adb('0x2')]},'titleFontSize':{'type':Sequelize[_0x5adb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x814b=['lodash','exports','STRING','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel'];(function(_0x3d78b5,_0x4936ed){var _0x380d7b=function(_0x1b7bf8){while(--_0x1b7bf8){_0x3d78b5['push'](_0x3d78b5['shift']());}};_0x380d7b(++_0x4936ed);}(_0x814b,0x1a2));var _0xb814=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x814b[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0xb814('0x0'));var squel=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));module[_0xb814('0x3')]={'title':{'type':Sequelize[_0xb814('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xb814('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xb814('0x5')),'get':function(){try{return JSON[_0xb814('0x6')](this[_0xb814('0x7')](_0xb814('0x8')));}catch(_0x44931c){return[];}},'set':function(_0x322a70){try{this['setDataValue'](_0xb814('0x8'),JSON[_0xb814('0x9')](_0x322a70));}catch(_0x5c8539){this[_0xb814('0xa')](_0xb814('0x8'),JSON[_0xb814('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb814('0xb')]},'col':{'type':Sequelize[_0xb814('0xb')]},'background':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xb814('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index e4c30d1..78465d0 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 _0xe2de=['lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','stringify','create','body','eml-format','rimraf','moment','bluebird','util','sox','ejs'];(function(_0x20c78e,_0x39f8f1){var _0x2c456a=function(_0x5902fc){while(--_0x5902fc){_0x20c78e['push'](_0x20c78e['shift']());}};_0x2c456a(++_0x39f8f1);}(_0xe2de,0x101));var _0xee2d=function(_0x4b554e,_0x2d8a54){_0x4b554e=_0x4b554e-0x0;var _0xd2c592=_0xe2de[_0x4b554e];return _0xd2c592;};'use strict';var emlformat=require(_0xee2d('0x0'));var rimraf=require(_0xee2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee2d('0x2'));var BPromise=require(_0xee2d('0x3'));var Mustache=require('mustache');var util=require(_0xee2d('0x4'));var path=require('path');var sox=require(_0xee2d('0x5'));var csv=require('to-csv');var ejs=require(_0xee2d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2d('0x7'));var squel=require(_0xee2d('0x8'));var crypto=require(_0xee2d('0x9'));var jsforce=require(_0xee2d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xee2d('0xb'));var querystring=require(_0xee2d('0xc'));var Papa=require(_0xee2d('0xd'));var Redis=require('ioredis');var authService=require(_0xee2d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xee2d('0xf'));var hardwareService=require(_0xee2d('0x10'));var logger=require(_0xee2d('0x11'))(_0xee2d('0x12'));var utils=require(_0xee2d('0x13'));var config=require(_0xee2d('0x14'));var licenseUtil=require(_0xee2d('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xee2d('0x16')](config[_0xee2d('0x17')],{'host':_0xee2d('0x18'),'port':0x18eb});var socket=require(_0xee2d('0x19'))(new Redis(config[_0xee2d('0x17')]));require(_0xee2d('0x1a'))[_0xee2d('0x1b')](socket);function respondWithStatusCode(_0x29c7c5,_0x198922){_0x198922=_0x198922||0xcc;return function(_0x3b6b78){if(_0x3b6b78){return _0x29c7c5[_0xee2d('0x1c')](_0x198922);}return _0x29c7c5[_0xee2d('0x1d')](_0x198922)['end']();};}function respondWithResult(_0x5eb6b8,_0x48b8e4){_0x48b8e4=_0x48b8e4||0xc8;return function(_0x7a603b){if(_0x7a603b){return _0x5eb6b8[_0xee2d('0x1d')](_0x48b8e4)[_0xee2d('0x1e')](_0x7a603b);}};}function respondWithFilteredResult(_0x2ff669,_0x3d9bd7){return function(_0x2fa320){if(_0x2fa320){var _0x158390=typeof _0x3d9bd7[_0xee2d('0x1f')]===_0xee2d('0x20')&&typeof _0x3d9bd7['limit']===_0xee2d('0x20');var _0x5ccf73=_0x2fa320[_0xee2d('0x21')];var _0x4ebba4=_0x158390?0x0:_0x3d9bd7[_0xee2d('0x1f')];var _0x5a1ce5=_0x158390?_0x2fa320[_0xee2d('0x21')]:_0x3d9bd7[_0xee2d('0x1f')]+_0x3d9bd7['limit'];var _0x26cc2a;if(_0x5a1ce5>=_0x5ccf73){_0x5a1ce5=_0x5ccf73;_0x26cc2a=0xc8;}else{_0x26cc2a=0xce;}_0x2ff669[_0xee2d('0x1d')](_0x26cc2a);return _0x2ff669[_0xee2d('0x22')](_0xee2d('0x23'),_0x4ebba4+'-'+_0x5a1ce5+'/'+_0x5ccf73)[_0xee2d('0x1e')](_0x2fa320);}return null;};}function patchUpdates(_0x1f386b){return function(_0x4b2157){try{jsonpatch[_0xee2d('0x24')](_0x4b2157,_0x1f386b,!![]);}catch(_0x9f9792){return BPromise[_0xee2d('0x25')](_0x9f9792);}return _0x4b2157[_0xee2d('0x26')]();};}function saveUpdates(_0xf8fc59,_0x16f994){return function(_0x4b51b8){if(_0x4b51b8){return _0x4b51b8[_0xee2d('0x27')](_0xf8fc59)[_0xee2d('0x28')](function(_0x206920){return _0x206920;});}return null;};}function removeEntity(_0x1d63d8,_0x7879c4){return function(_0xa8557e){if(_0xa8557e){return _0xa8557e[_0xee2d('0x29')]()[_0xee2d('0x28')](function(){_0x1d63d8['status'](0xcc)[_0xee2d('0x2a')]();});}};}function handleEntityNotFound(_0x1173f3,_0x44ec39){return function(_0xfa130a){if(!_0xfa130a){_0x1173f3[_0xee2d('0x1c')](0x194);}return _0xfa130a;};}function handleError(_0x525f3b,_0xcfe654){_0xcfe654=_0xcfe654||0x1f4;return function(_0x566b0a){logger[_0xee2d('0x2b')](_0x566b0a['stack']);if(_0x566b0a[_0xee2d('0x2c')]){delete _0x566b0a['name'];}_0x525f3b[_0xee2d('0x1d')](_0xcfe654)[_0xee2d('0x2d')](_0x566b0a);};}exports[_0xee2d('0x2e')]=function(_0x2f4698,_0xb4b3ce){var _0x1d8a93={'raw':![],'where':{'id':_0x2f4698[_0xee2d('0x2f')]['id']}},_0x11a457={};_0x11a457[_0xee2d('0x30')]=_[_0xee2d('0x31')](db[_0xee2d('0x32')]['rawAttributes']);_0x11a457[_0xee2d('0x33')]=_[_0xee2d('0x31')](_0x2f4698['query']);_0x11a457[_0xee2d('0x34')]=_[_0xee2d('0x35')](_0x11a457[_0xee2d('0x30')],_0x11a457['query']);_0x1d8a93[_0xee2d('0x36')]=_['intersection'](_0x11a457[_0xee2d('0x30')],qs[_0xee2d('0x37')](_0x2f4698['query'][_0xee2d('0x37')]));_0x1d8a93[_0xee2d('0x36')]=_0x1d8a93['attributes'][_0xee2d('0x38')]?_0x1d8a93['attributes']:_0x11a457['model'];if(_0x2f4698['query'][_0xee2d('0x39')]){_0x1d8a93['include']=[{'all':!![]}];}_0x1d8a93=_[_0xee2d('0x3a')]({},_0x1d8a93,_0x2f4698[_0xee2d('0x3b')]);return db['DashboardItem'][_0xee2d('0x3c')](_0x1d8a93)['then'](handleEntityNotFound(_0xb4b3ce,null))[_0xee2d('0x28')](respondWithResult(_0xb4b3ce,null))[_0xee2d('0x3d')](handleError(_0xb4b3ce,null));};exports[_0xee2d('0x29')]=function(_0x284b20,_0x1e3f5b){return db['DashboardItem'][_0xee2d('0x3c')]({'where':{'id':_0x284b20['params']['id']}})[_0xee2d('0x28')](handleEntityNotFound(_0x1e3f5b,null))['then'](removeEntity(_0x1e3f5b,null))[_0xee2d('0x3d')](handleError(_0x1e3f5b,null));};function widgetAttributes(_0x39452c){try{switch(_0x39452c['type']){case _0xee2d('0x3e'):return[{'name':'attrUrl','value':_0x39452c[_0xee2d('0x3f')]||(_0x39452c['attrs']&&_0x39452c[_0xee2d('0x40')][0x0]?_0x39452c['attrs'][0x0][_0xee2d('0x41')]:undefined)||_0xee2d('0x42')}];case'custom':return[{'name':_0xee2d('0x43'),'value':_0x39452c['attrPath']||(_0x39452c[_0xee2d('0x40')]&&_0x39452c['attrs'][0x0]?_0x39452c[_0xee2d('0x40')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xee2d('0x44'),'value':_0x39452c['attrHourFormat']||(_0x39452c['attrs']&&_0x39452c[_0xee2d('0x40')][0x0]?_0x39452c[_0xee2d('0x40')][0x0][_0xee2d('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xee2d('0x45'),'value':_0x39452c[_0xee2d('0x45')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x1]?_0x39452c[_0xee2d('0x40')][0x1][_0xee2d('0x41')]:undefined)||_0xee2d('0x46')},{'name':_0xee2d('0x47'),'value':_0x39452c[_0xee2d('0x47')]||(_0x39452c['attrs']&&_0x39452c['attrs'][0x2]?_0x39452c[_0xee2d('0x40')][0x2][_0xee2d('0x41')]:undefined)||0xc}];case _0xee2d('0x48'):return[{'name':'attrMetric','value':_0x39452c[_0xee2d('0x49')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x0]?_0x39452c[_0xee2d('0x40')][0x0][_0xee2d('0x41')]:undefined)||_0xee2d('0x4a')},{'name':_0xee2d('0x4b'),'value':_0x39452c[_0xee2d('0x4b')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x1]?_0x39452c['attrs'][0x1][_0xee2d('0x41')]:undefined)||[]},{'name':_0xee2d('0x47'),'value':_0x39452c[_0xee2d('0x47')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x2]?_0x39452c[_0xee2d('0x40')][0x2][_0xee2d('0x41')]:undefined)||0x14}];case'multibar-chart':case _0xee2d('0x4c'):return[{'name':'attrSerie1','value':_0x39452c[_0xee2d('0x4d')]||(_0x39452c['attrs']&&_0x39452c[_0xee2d('0x40')][0x0]?_0x39452c['attrs'][0x0]['value']:undefined)||_0xee2d('0x4a')},{'name':'attrSerie2','value':_0x39452c[_0xee2d('0x4e')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x1]?_0x39452c[_0xee2d('0x40')][0x1][_0xee2d('0x41')]:undefined)||null},{'name':_0xee2d('0x4f'),'value':_0x39452c['attrSerie3']||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x2]?_0x39452c[_0xee2d('0x40')][0x2]['value']:undefined)||null},{'name':_0xee2d('0x4b'),'value':_0x39452c['attrVoiceQueues']||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x3]?_0x39452c[_0xee2d('0x40')][0x3]['value']:undefined)||[]}];case _0xee2d('0x50'):return[{'name':'attrReport','type':_0x39452c[_0xee2d('0x51')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x0]?_0x39452c[_0xee2d('0x40')][0x0][_0xee2d('0x52')]:undefined)||null,'value':_0x39452c[_0xee2d('0x53')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x0]?_0x39452c['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x39452c[_0xee2d('0x54')]||(_0x39452c[_0xee2d('0x40')]&&_0x39452c[_0xee2d('0x40')][0x1]?_0x39452c[_0xee2d('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x33343e){logger[_0xee2d('0x2b')]('widgetAttributes:\x20%s',JSON[_0xee2d('0x55')](_0x33343e));return[];}}exports[_0xee2d('0x56')]=function(_0x55cd63,_0x361bc5){if(_0x55cd63[_0xee2d('0x57')]){_0x55cd63['body'][_0xee2d('0x40')]=widgetAttributes(_0x55cd63[_0xee2d('0x57')]);}return db[_0xee2d('0x32')][_0xee2d('0x56')](_0x55cd63[_0xee2d('0x57')],{})[_0xee2d('0x28')](respondWithResult(_0x361bc5,0xc9))[_0xee2d('0x3d')](handleError(_0x361bc5,null));};exports['update']=function(_0x1b6c51,_0x257070){if(_0x1b6c51[_0xee2d('0x57')]['id']){delete _0x1b6c51[_0xee2d('0x57')]['id'];}_0x1b6c51[_0xee2d('0x57')][_0xee2d('0x40')]=widgetAttributes(_0x1b6c51['body']);return db[_0xee2d('0x32')]['find']({'where':{'id':_0x1b6c51[_0xee2d('0x2f')]['id']}})[_0xee2d('0x28')](handleEntityNotFound(_0x257070,null))[_0xee2d('0x28')](saveUpdates(_0x1b6c51[_0xee2d('0x57')],null))[_0xee2d('0x28')](respondWithResult(_0x257070,null))['catch'](handleError(_0x257070,null));}; \ No newline at end of file +var _0x4ac5=['set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','keys','query','intersection','attributes','fields','length','include','merge','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','undefined','limit','offset'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x4ac5,0x1ed));var _0x54ac=function(_0x3f3a47,_0x28f84b){_0x3f3a47=_0x3f3a47-0x0;var _0x57a682=_0x4ac5[_0x3f3a47];return _0x57a682;};'use strict';var emlformat=require(_0x54ac('0x0'));var rimraf=require(_0x54ac('0x1'));var zipdir=require(_0x54ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x54ac('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x54ac('0x4'));var sox=require(_0x54ac('0x5'));var csv=require(_0x54ac('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54ac('0x7'));var squel=require('squel');var crypto=require(_0x54ac('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x54ac('0x9'));var toCsv=require('to-csv');var querystring=require(_0x54ac('0xa'));var Papa=require(_0x54ac('0xb'));var Redis=require(_0x54ac('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54ac('0xd'));var logger=require(_0x54ac('0xe'))(_0x54ac('0xf'));var utils=require(_0x54ac('0x10'));var config=require(_0x54ac('0x11'));var licenseUtil=require(_0x54ac('0x12'));var db=require(_0x54ac('0x13'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x54ac('0x14'))(new Redis(config[_0x54ac('0x15')]));require(_0x54ac('0x16'))[_0x54ac('0x17')](socket);function respondWithStatusCode(_0x4f2d5b,_0x184821){_0x184821=_0x184821||0xcc;return function(_0x3eee6d){if(_0x3eee6d){return _0x4f2d5b[_0x54ac('0x18')](_0x184821);}return _0x4f2d5b[_0x54ac('0x19')](_0x184821)['end']();};}function respondWithResult(_0x5dc85c,_0x400c12){_0x400c12=_0x400c12||0xc8;return function(_0x51a14d){if(_0x51a14d){return _0x5dc85c[_0x54ac('0x19')](_0x400c12)['json'](_0x51a14d);}};}function respondWithFilteredResult(_0x3c8195,_0x5d8e3c){return function(_0x535433){if(_0x535433){var _0x4bdb27=typeof _0x5d8e3c['offset']===_0x54ac('0x1a')&&typeof _0x5d8e3c[_0x54ac('0x1b')]===_0x54ac('0x1a');var _0x389194=_0x535433['count'];var _0xa41bcf=_0x4bdb27?0x0:_0x5d8e3c[_0x54ac('0x1c')];var _0x356565=_0x4bdb27?_0x535433['count']:_0x5d8e3c['offset']+_0x5d8e3c[_0x54ac('0x1b')];var _0x3bddce;if(_0x356565>=_0x389194){_0x356565=_0x389194;_0x3bddce=0xc8;}else{_0x3bddce=0xce;}_0x3c8195[_0x54ac('0x19')](_0x3bddce);return _0x3c8195[_0x54ac('0x1d')](_0x54ac('0x1e'),_0xa41bcf+'-'+_0x356565+'/'+_0x389194)[_0x54ac('0x1f')](_0x535433);}return null;};}function patchUpdates(_0x1b0185){return function(_0x4dcf3b){try{jsonpatch[_0x54ac('0x20')](_0x4dcf3b,_0x1b0185,!![]);}catch(_0x180e80){return BPromise[_0x54ac('0x21')](_0x180e80);}return _0x4dcf3b[_0x54ac('0x22')]();};}function saveUpdates(_0x324d16,_0x511926){return function(_0x58f31f){if(_0x58f31f){return _0x58f31f[_0x54ac('0x23')](_0x324d16)['then'](function(_0x2b1bf0){return _0x2b1bf0;});}return null;};}function removeEntity(_0x44e063,_0x2ec379){return function(_0x4a6232){if(_0x4a6232){return _0x4a6232[_0x54ac('0x24')]()[_0x54ac('0x25')](function(){_0x44e063[_0x54ac('0x19')](0xcc)[_0x54ac('0x26')]();});}};}function handleEntityNotFound(_0x241647,_0x81e8b0){return function(_0x2f5db6){if(!_0x2f5db6){_0x241647[_0x54ac('0x18')](0x194);}return _0x2f5db6;};}function handleError(_0x29b5e9,_0x2e6726){_0x2e6726=_0x2e6726||0x1f4;return function(_0x354054){logger[_0x54ac('0x27')](_0x354054[_0x54ac('0x28')]);if(_0x354054[_0x54ac('0x29')]){delete _0x354054[_0x54ac('0x29')];}_0x29b5e9['status'](_0x2e6726)[_0x54ac('0x2a')](_0x354054);};}exports[_0x54ac('0x2b')]=function(_0x166b5c,_0x3b10ab){var _0x25331e={'raw':![],'where':{'id':_0x166b5c[_0x54ac('0x2c')]['id']}},_0x2f7607={};_0x2f7607[_0x54ac('0x2d')]=_['keys'](db[_0x54ac('0x2e')][_0x54ac('0x2f')]);_0x2f7607['query']=_[_0x54ac('0x30')](_0x166b5c[_0x54ac('0x31')]);_0x2f7607['filters']=_[_0x54ac('0x32')](_0x2f7607[_0x54ac('0x2d')],_0x2f7607[_0x54ac('0x31')]);_0x25331e[_0x54ac('0x33')]=_[_0x54ac('0x32')](_0x2f7607[_0x54ac('0x2d')],qs[_0x54ac('0x34')](_0x166b5c[_0x54ac('0x31')][_0x54ac('0x34')]));_0x25331e['attributes']=_0x25331e[_0x54ac('0x33')][_0x54ac('0x35')]?_0x25331e[_0x54ac('0x33')]:_0x2f7607[_0x54ac('0x2d')];if(_0x166b5c[_0x54ac('0x31')]['includeAll']){_0x25331e[_0x54ac('0x36')]=[{'all':!![]}];}_0x25331e=_[_0x54ac('0x37')]({},_0x25331e,_0x166b5c['options']);return db[_0x54ac('0x2e')][_0x54ac('0x38')](_0x25331e)[_0x54ac('0x25')](handleEntityNotFound(_0x3b10ab,null))[_0x54ac('0x25')](respondWithResult(_0x3b10ab,null))[_0x54ac('0x39')](handleError(_0x3b10ab,null));};exports[_0x54ac('0x24')]=function(_0x1b77b1,_0x17b80e){return db[_0x54ac('0x2e')][_0x54ac('0x38')]({'where':{'id':_0x1b77b1[_0x54ac('0x2c')]['id']}})[_0x54ac('0x25')](handleEntityNotFound(_0x17b80e,null))[_0x54ac('0x25')](removeEntity(_0x17b80e,null))[_0x54ac('0x39')](handleError(_0x17b80e,null));};function widgetAttributes(_0x1eb2e9){try{switch(_0x1eb2e9['type']){case _0x54ac('0x3a'):return[{'name':_0x54ac('0x3b'),'value':_0x1eb2e9[_0x54ac('0x3b')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9['attrs'][0x0]?_0x1eb2e9['attrs'][0x0][_0x54ac('0x3d')]:undefined)||_0x54ac('0x3e')}];case _0x54ac('0x3f'):return[{'name':'attrPath','value':_0x1eb2e9[_0x54ac('0x40')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9[_0x54ac('0x3c')][0x0]?_0x1eb2e9[_0x54ac('0x3c')][0x0][_0x54ac('0x3d')]:undefined)||''}];case _0x54ac('0x41'):return[{'name':_0x54ac('0x42'),'value':_0x1eb2e9['attrHourFormat']||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9[_0x54ac('0x3c')][0x0]?_0x1eb2e9[_0x54ac('0x3c')][0x0]['value']:undefined)||_0x54ac('0x43')},{'name':_0x54ac('0x44'),'value':_0x1eb2e9[_0x54ac('0x44')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9['attrs'][0x1]?_0x1eb2e9[_0x54ac('0x3c')][0x1][_0x54ac('0x3d')]:undefined)||'0.00'},{'name':_0x54ac('0x45'),'value':_0x1eb2e9[_0x54ac('0x45')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9[_0x54ac('0x3c')][0x2]?_0x1eb2e9['attrs'][0x2][_0x54ac('0x3d')]:undefined)||0xc}];case _0x54ac('0x46'):return[{'name':_0x54ac('0x47'),'value':_0x1eb2e9[_0x54ac('0x47')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9['attrs'][0x0]?_0x1eb2e9[_0x54ac('0x3c')][0x0]['value']:undefined)||_0x54ac('0x48')},{'name':_0x54ac('0x49'),'value':_0x1eb2e9[_0x54ac('0x49')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9[_0x54ac('0x3c')][0x1]?_0x1eb2e9[_0x54ac('0x3c')][0x1][_0x54ac('0x3d')]:undefined)||[]},{'name':_0x54ac('0x45'),'value':_0x1eb2e9[_0x54ac('0x45')]||(_0x1eb2e9['attrs']&&_0x1eb2e9[_0x54ac('0x3c')][0x2]?_0x1eb2e9[_0x54ac('0x3c')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x54ac('0x4a'):return[{'name':'attrSerie1','value':_0x1eb2e9[_0x54ac('0x4b')]||(_0x1eb2e9['attrs']&&_0x1eb2e9['attrs'][0x0]?_0x1eb2e9[_0x54ac('0x3c')][0x0]['value']:undefined)||_0x54ac('0x48')},{'name':_0x54ac('0x4c'),'value':_0x1eb2e9[_0x54ac('0x4c')]||(_0x1eb2e9['attrs']&&_0x1eb2e9[_0x54ac('0x3c')][0x1]?_0x1eb2e9[_0x54ac('0x3c')][0x1][_0x54ac('0x3d')]:undefined)||null},{'name':'attrSerie3','value':_0x1eb2e9[_0x54ac('0x4d')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9[_0x54ac('0x3c')][0x2]?_0x1eb2e9['attrs'][0x2][_0x54ac('0x3d')]:undefined)||null},{'name':_0x54ac('0x49'),'value':_0x1eb2e9[_0x54ac('0x49')]||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9[_0x54ac('0x3c')][0x3]?_0x1eb2e9[_0x54ac('0x3c')][0x3][_0x54ac('0x3d')]:undefined)||[]}];case _0x54ac('0x4e'):return[{'name':_0x54ac('0x4f'),'type':_0x1eb2e9[_0x54ac('0x50')]||(_0x1eb2e9['attrs']&&_0x1eb2e9[_0x54ac('0x3c')][0x0]?_0x1eb2e9['attrs'][0x0][_0x54ac('0x51')]:undefined)||null,'value':_0x1eb2e9[_0x54ac('0x4f')]||(_0x1eb2e9['attrs']&&_0x1eb2e9[_0x54ac('0x3c')][0x0]?_0x1eb2e9['attrs'][0x0][_0x54ac('0x3d')]:undefined)||null},{'name':_0x54ac('0x52'),'value':_0x1eb2e9['attrRefresh']||(_0x1eb2e9[_0x54ac('0x3c')]&&_0x1eb2e9[_0x54ac('0x3c')][0x1]?_0x1eb2e9[_0x54ac('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x437893){logger[_0x54ac('0x27')](_0x54ac('0x53'),JSON[_0x54ac('0x54')](_0x437893));return[];}}exports['create']=function(_0x2a647f,_0x19709e){if(_0x2a647f['body']){_0x2a647f['body'][_0x54ac('0x3c')]=widgetAttributes(_0x2a647f['body']);}return db[_0x54ac('0x2e')][_0x54ac('0x55')](_0x2a647f[_0x54ac('0x56')],{})[_0x54ac('0x25')](respondWithResult(_0x19709e,0xc9))[_0x54ac('0x39')](handleError(_0x19709e,null));};exports[_0x54ac('0x23')]=function(_0x4a1987,_0x520a34){if(_0x4a1987[_0x54ac('0x56')]['id']){delete _0x4a1987['body']['id'];}_0x4a1987[_0x54ac('0x56')][_0x54ac('0x3c')]=widgetAttributes(_0x4a1987['body']);return db[_0x54ac('0x2e')]['find']({'where':{'id':_0x4a1987[_0x54ac('0x2c')]['id']}})[_0x54ac('0x25')](handleEntityNotFound(_0x520a34,null))[_0x54ac('0x25')](saveUpdates(_0x4a1987[_0x54ac('0x56')],null))[_0x54ac('0x25')](respondWithResult(_0x520a34,null))[_0x54ac('0x39')](handleError(_0x520a34,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d13586e..f3ecdd4 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 _0x04d0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x04d0,0x12a));var _0x004d=function(_0x398fcd,_0x35207f){_0x398fcd=_0x398fcd-0x0;var _0x24043c=_0x04d0[_0x398fcd];return _0x24043c;};'use strict';var EventEmitter=require(_0x004d('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x004d('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x004d('0x2')](0x0);var events={'afterCreate':_0x004d('0x3'),'afterUpdate':_0x004d('0x4'),'afterDestroy':_0x004d('0x5')};function emitEvent(_0x2d73b8){return function(_0x1d224a,_0x7f8a31,_0x5a6ca8){DashboardItemEvents[_0x004d('0x6')](_0x2d73b8+':'+_0x1d224a['id'],_0x1d224a);DashboardItemEvents[_0x004d('0x6')](_0x2d73b8,_0x1d224a);_0x5a6ca8(null);};}for(var e in events){if(events[_0x004d('0x7')](e)){var event=events[e];DashboardItem[_0x004d('0x8')](e,emitEvent(event));}}module[_0x004d('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x531a=['exports','events','DashboardItem','setMaxListeners','save','update','emit','hook'];(function(_0x8079e,_0x550d94){var _0x582fd3=function(_0xf21ebc){while(--_0xf21ebc){_0x8079e['push'](_0x8079e['shift']());}};_0x582fd3(++_0x550d94);}(_0x531a,0x79));var _0xa531=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x531a[_0x160c73];return _0xd9302;};'use strict';var EventEmitter=require(_0xa531('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xa531('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa531('0x2')](0x0);var events={'afterCreate':_0xa531('0x3'),'afterUpdate':_0xa531('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5144c8){return function(_0x3807b8,_0x2f2b7a,_0x34dc3c){DashboardItemEvents[_0xa531('0x5')](_0x5144c8+':'+_0x3807b8['id'],_0x3807b8);DashboardItemEvents['emit'](_0x5144c8,_0x3807b8);_0x34dc3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xa531('0x6')](e,emitEvent(event));}}module[_0xa531('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 389fdc3..0e35079 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 _0xdf67=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x5d585d,_0x22a67b){var _0x5f3217=function(_0x3b2ebc){while(--_0x3b2ebc){_0x5d585d['push'](_0x5d585d['shift']());}};_0x5f3217(++_0x22a67b);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7df6('0x0'));var util=require(_0x7df6('0x1'));var logger=require(_0x7df6('0x2'))(_0x7df6('0x3'));var moment=require('moment');var BPromise=require(_0x7df6('0x4'));var rp=require(_0x7df6('0x5'));var fs=require('fs');var path=require(_0x7df6('0x6'));var rimraf=require(_0x7df6('0x7'));var config=require(_0x7df6('0x8'));var attributes=require(_0x7df6('0x9'));module[_0x7df6('0xa')]=function(_0x679475,_0x50cf74){return _0x679475[_0x7df6('0xb')](_0x7df6('0xc'),attributes,{'tableName':_0x7df6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5745=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x587071,_0x172c7b){var _0x43cb3d=function(_0x1b0e22){while(--_0x1b0e22){_0x587071['push'](_0x587071['shift']());}};_0x43cb3d(++_0x172c7b);}(_0x5745,0x1bf));var _0x5574=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5745[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x5574('0x0'));var util=require(_0x5574('0x1'));var logger=require(_0x5574('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5574('0x3'));var rp=require(_0x5574('0x4'));var fs=require('fs');var path=require(_0x5574('0x5'));var rimraf=require(_0x5574('0x6'));var config=require(_0x5574('0x7'));var attributes=require(_0x5574('0x8'));module['exports']=function(_0x208cf3,_0x352a74){return _0x208cf3[_0x5574('0x9')](_0x5574('0xa'),attributes,{'tableName':_0x5574('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index fb7b763..ffa0bfd 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 _0x2f1a=['util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f1a,0xc6));var _0xa2f1=function(_0x91c9d6,_0x4bfa45){_0x91c9d6=_0x91c9d6-0x0;var _0x13de68=_0x2f1a[_0x91c9d6];return _0x13de68;};'use strict';var _=require('lodash');var util=require(_0xa2f1('0x0'));var moment=require('moment');var BPromise=require(_0xa2f1('0x1'));var rs=require(_0xa2f1('0x2'));var fs=require('fs');var Redis=require(_0xa2f1('0x3'));var db=require(_0xa2f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa2f1('0x5'));var config=require(_0xa2f1('0x6'));var jayson=require(_0xa2f1('0x7'));var client=jayson[_0xa2f1('0x8')]['http']({'port':0x232a});config[_0xa2f1('0x9')]=_['defaults'](config[_0xa2f1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2f1('0xa'))(new Redis(config[_0xa2f1('0x9')]));require(_0xa2f1('0xb'))[_0xa2f1('0xc')](socket);function respondWithRpcPromise(_0x4067c7,_0x4aa91c,_0x5f26fb){return new BPromise(function(_0x1b43d7,_0x238483){return client['request'](_0x4067c7,_0x5f26fb)[_0xa2f1('0xd')](function(_0x3662a2){logger[_0xa2f1('0xe')](_0xa2f1('0xf'),_0x4aa91c,_0xa2f1('0x10'));logger[_0xa2f1('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4aa91c,'request\x20sent',JSON['stringify'](_0x3662a2));if(_0x3662a2[_0xa2f1('0x12')]){if(_0x3662a2[_0xa2f1('0x12')]['code']===0x1f4){logger[_0xa2f1('0x12')](_0xa2f1('0xf'),_0x4aa91c,_0x3662a2['error'][_0xa2f1('0x13')]);return _0x238483(_0x3662a2[_0xa2f1('0x12')][_0xa2f1('0x13')]);}logger[_0xa2f1('0x12')](_0xa2f1('0xf'),_0x4aa91c,_0x3662a2[_0xa2f1('0x12')]['message']);return _0x1b43d7(_0x3662a2['error'][_0xa2f1('0x13')]);}else{logger[_0xa2f1('0xe')]('DashboardItem,\x20%s,\x20%s',_0x4aa91c,_0xa2f1('0x10'));_0x1b43d7(_0x3662a2[_0xa2f1('0x14')][_0xa2f1('0x13')]);}})[_0xa2f1('0x15')](function(_0x270119){logger[_0xa2f1('0x12')](_0xa2f1('0xf'),_0x4aa91c,_0x270119);_0x238483(_0x270119);});});} \ No newline at end of file +var _0x6808=['message','info','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x10aa0d,_0x499c14){var _0x242ed2=function(_0x4ece6f){while(--_0x4ece6f){_0x10aa0d['push'](_0x10aa0d['shift']());}};_0x242ed2(++_0x499c14);}(_0x6808,0x1a3));var _0x8680=function(_0x2e4675,_0x1f4807){_0x2e4675=_0x2e4675-0x0;var _0x17671e=_0x6808[_0x2e4675];return _0x17671e;};'use strict';var _=require(_0x8680('0x0'));var util=require(_0x8680('0x1'));var moment=require('moment');var BPromise=require(_0x8680('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8680('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8680('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8680('0x5'));var jayson=require(_0x8680('0x6'));var client=jayson[_0x8680('0x7')][_0x8680('0x8')]({'port':0x232a});config[_0x8680('0x9')]=_[_0x8680('0xa')](config[_0x8680('0x9')],{'host':_0x8680('0xb'),'port':0x18eb});var socket=require(_0x8680('0xc'))(new Redis(config[_0x8680('0x9')]));require(_0x8680('0xd'))[_0x8680('0xe')](socket);function respondWithRpcPromise(_0x265f0e,_0x4ce4a5,_0x9c8317){return new BPromise(function(_0x431c05,_0x555f1f){return client[_0x8680('0xf')](_0x265f0e,_0x9c8317)[_0x8680('0x10')](function(_0x13480e){logger['info'](_0x8680('0x11'),_0x4ce4a5,_0x8680('0x12'));logger[_0x8680('0x13')](_0x8680('0x14'),_0x4ce4a5,_0x8680('0x12'),JSON[_0x8680('0x15')](_0x13480e));if(_0x13480e[_0x8680('0x16')]){if(_0x13480e[_0x8680('0x16')]['code']===0x1f4){logger['error'](_0x8680('0x11'),_0x4ce4a5,_0x13480e[_0x8680('0x16')]['message']);return _0x555f1f(_0x13480e[_0x8680('0x16')][_0x8680('0x17')]);}logger['error'](_0x8680('0x11'),_0x4ce4a5,_0x13480e['error'][_0x8680('0x17')]);return _0x431c05(_0x13480e['error']['message']);}else{logger[_0x8680('0x18')]('DashboardItem,\x20%s,\x20%s',_0x4ce4a5,_0x8680('0x12'));_0x431c05(_0x13480e['result'][_0x8680('0x17')]);}})[_0x8680('0x19')](function(_0x611625){logger['error'](_0x8680('0x11'),_0x4ce4a5,_0x611625);_0x555f1f(_0x611625);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3421ad5..3964524 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 _0xb305=['emit','removeListener','register','dashboardItem:','save','remove','update'];(function(_0x23f1a3,_0x483074){var _0x52bf1d=function(_0x351a76){while(--_0x351a76){_0x23f1a3['push'](_0x23f1a3['shift']());}};_0x52bf1d(++_0x483074);}(_0xb305,0xf2));var _0x5b30=function(_0x473155,_0x2f4730){_0x473155=_0x473155-0x0;var _0x57525a=_0xb305[_0x473155];return _0x57525a;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x5b30('0x0'),_0x5b30('0x1'),_0x5b30('0x2')];function createListener(_0x60a2ba,_0x30faa0){return function(_0x1de754){_0x30faa0[_0x5b30('0x3')](_0x60a2ba,_0x1de754);};}function removeListener(_0x518f5e,_0x38d82c){return function(){DashboardItemEvents[_0x5b30('0x4')](_0x518f5e,_0x38d82c);};}exports[_0x5b30('0x5')]=function(_0x123b09){for(var _0x37e648=0x0,_0x1aa40e=events['length'];_0x37e648<_0x1aa40e;_0x37e648++){var _0x122fde=events[_0x37e648];var _0x3b5f72=createListener(_0x5b30('0x6')+_0x122fde,_0x123b09);DashboardItemEvents['on'](_0x122fde,_0x3b5f72);}}; \ No newline at end of file +var _0xf179=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x8c08a2,_0x2e2248){var _0x1ef942=function(_0x353626){while(--_0x353626){_0x8c08a2['push'](_0x8c08a2['shift']());}};_0x1ef942(++_0x2e2248);}(_0xf179,0x161));var _0x9f17=function(_0x25810f,_0x2c24a5){_0x25810f=_0x25810f-0x0;var _0x583da2=_0xf179[_0x25810f];return _0x583da2;};'use strict';var DashboardItemEvents=require(_0x9f17('0x0'));var events=[_0x9f17('0x1'),_0x9f17('0x2'),_0x9f17('0x3')];function createListener(_0x54ed92,_0x72b0b4){return function(_0x29c872){_0x72b0b4[_0x9f17('0x4')](_0x54ed92,_0x29c872);};}function removeListener(_0x1e1a12,_0x484088){return function(){DashboardItemEvents[_0x9f17('0x5')](_0x1e1a12,_0x484088);};}exports[_0x9f17('0x6')]=function(_0x1361f2){for(var _0x2f8257=0x0,_0x472a12=events['length'];_0x2f8257<_0x472a12;_0x2f8257++){var _0x2e0dd0=events[_0x2f8257];var _0x7eadde=createListener(_0x9f17('0x7')+_0x2e0dd0,_0x1361f2);DashboardItemEvents['on'](_0x2e0dd0,_0x7eadde);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 91defd7..620b3b3 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 _0x7812=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','post','isAuthenticated','create','put','/:id'];(function(_0x101991,_0x1b6f9b){var _0x4f88d9=function(_0x1b13a1){while(--_0x1b13a1){_0x101991['push'](_0x101991['shift']());}};_0x4f88d9(++_0x1b6f9b);}(_0x7812,0x1ba));var _0x2781=function(_0x1ec620,_0x4c3cac){_0x1ec620=_0x1ec620-0x0;var _0x4a8711=_0x7812[_0x1ec620];return _0x4a8711;};'use strict';var multer=require(_0x2781('0x0'));var util=require(_0x2781('0x1'));var path=require(_0x2781('0x2'));var timeout=require(_0x2781('0x3'));var express=require(_0x2781('0x4'));var router=express[_0x2781('0x5')]();var fs_extra=require(_0x2781('0x6'));var auth=require(_0x2781('0x7'));var interaction=require(_0x2781('0x8'));var config=require(_0x2781('0x9'));var controller=require(_0x2781('0xa'));router[_0x2781('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2781('0xc')]);router[_0x2781('0xd')]('/',auth[_0x2781('0xe')](),controller[_0x2781('0xf')]);router[_0x2781('0x10')](_0x2781('0x11'),auth[_0x2781('0xe')](),controller['update']);router['delete'](_0x2781('0x11'),auth['isAuthenticated'](),controller[_0x2781('0x12')]);module[_0x2781('0x13')]=router; \ No newline at end of file +var _0xd197=['./dashboardItem.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xd197,0x14d));var _0x7d19=function(_0x463341,_0xd2ab83){_0x463341=_0x463341-0x0;var _0x1e9e40=_0xd197[_0x463341];return _0x1e9e40;};'use strict';var multer=require(_0x7d19('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7d19('0x1'));var express=require(_0x7d19('0x2'));var router=express[_0x7d19('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7d19('0x4'));var interaction=require(_0x7d19('0x5'));var config=require(_0x7d19('0x6'));var controller=require(_0x7d19('0x7'));router[_0x7d19('0x8')]('/:id',auth[_0x7d19('0x9')](),controller['show']);router[_0x7d19('0xa')]('/',auth[_0x7d19('0x9')](),controller['create']);router[_0x7d19('0xb')](_0x7d19('0xc'),auth[_0x7d19('0x9')](),controller[_0x7d19('0xd')]);router[_0x7d19('0xe')](_0x7d19('0xc'),auth[_0x7d19('0x9')](),controller[_0x7d19('0xf')]);module[_0x7d19('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2eb59aa..77f696e 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 _0xbccd=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x27fafb,_0x1c21f7){var _0x2adeaf=function(_0x713137){while(--_0x713137){_0x27fafb['push'](_0x27fafb['shift']());}};_0x2adeaf(++_0x1c21f7);}(_0xbccd,0x193));var _0xdbcc=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xbccd[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xdbcc('0x0'));module[_0xdbcc('0x1')]={'name':{'type':Sequelize[_0xdbcc('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xdbcc('0x3')](_0xdbcc('0x4'),_0xdbcc('0x5'),_0xdbcc('0x6')),'allowNull':![],'defaultValue':_0xdbcc('0x4')},'description':{'type':Sequelize[_0xdbcc('0x2')]}}; \ No newline at end of file +var _0x7035=['sequelize','STRING','ENUM','first','second','third'];(function(_0x59b04c,_0x10d5e2){var _0x5e1acd=function(_0x14fc63){while(--_0x14fc63){_0x59b04c['push'](_0x59b04c['shift']());}};_0x5e1acd(++_0x10d5e2);}(_0x7035,0x156));var _0x5703=function(_0x204258,_0x32b542){_0x204258=_0x204258-0x0;var _0x46ceaf=_0x7035[_0x204258];return _0x46ceaf;};'use strict';var Sequelize=require(_0x5703('0x0'));module['exports']={'name':{'type':Sequelize[_0x5703('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x5703('0x2')](_0x5703('0x3'),_0x5703('0x4'),_0x5703('0x5')),'allowNull':![],'defaultValue':_0x5703('0x3')},'description':{'type':Sequelize[_0x5703('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 81bd961..ae7c582 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 _0xa8bf=['query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','then','get','Dispositions','UserProfileResource','end','sendStatus','stack','name','send','index','map','Disposition','type','key','model'];(function(_0x2a3b3a,_0x97a664){var _0xaab42b=function(_0x57ef61){while(--_0x57ef61){_0x2a3b3a['push'](_0x2a3b3a['shift']());}};_0xaab42b(++_0x97a664);}(_0xa8bf,0x1c2));var _0xfa8b=function(_0x1820f1,_0x1403e7){_0x1820f1=_0x1820f1-0x0;var _0x167aed=_0xa8bf[_0x1820f1];return _0x167aed;};'use strict';var emlformat=require(_0xfa8b('0x0'));var rimraf=require(_0xfa8b('0x1'));var zipdir=require(_0xfa8b('0x2'));var jsonpatch=require(_0xfa8b('0x3'));var rp=require(_0xfa8b('0x4'));var moment=require('moment');var BPromise=require(_0xfa8b('0x5'));var Mustache=require('mustache');var util=require(_0xfa8b('0x6'));var path=require(_0xfa8b('0x7'));var sox=require('sox');var csv=require(_0xfa8b('0x8'));var ejs=require(_0xfa8b('0x9'));var fs=require('fs');var fs_extra=require(_0xfa8b('0xa'));var _=require(_0xfa8b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa8b('0xc'));var deskjs=require(_0xfa8b('0xd'));var toCsv=require(_0xfa8b('0x8'));var querystring=require(_0xfa8b('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa8b('0xf'));var authService=require(_0xfa8b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfa8b('0x11'));var hardwareService=require(_0xfa8b('0x12'));var logger=require(_0xfa8b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfa8b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa8b('0x15'))['db'];function respondWithStatusCode(_0x5934b6,_0x2f891f){_0x2f891f=_0x2f891f||0xcc;return function(_0x5f4142){if(_0x5f4142){return _0x5934b6['sendStatus'](_0x2f891f);}return _0x5934b6[_0xfa8b('0x16')](_0x2f891f)['end']();};}function respondWithResult(_0x12e0dd,_0x1febd1){_0x1febd1=_0x1febd1||0xc8;return function(_0x4afd00){if(_0x4afd00){return _0x12e0dd[_0xfa8b('0x16')](_0x1febd1)[_0xfa8b('0x17')](_0x4afd00);}};}function respondWithFilteredResult(_0x5a5fa1,_0x4e7b8f){return function(_0x50cb12){if(_0x50cb12){var _0x3ed057=typeof _0x4e7b8f[_0xfa8b('0x18')]===_0xfa8b('0x19')&&typeof _0x4e7b8f['limit']===_0xfa8b('0x19');var _0x3e0882=_0x50cb12[_0xfa8b('0x1a')];var _0x3c4397=_0x3ed057?0x0:_0x4e7b8f[_0xfa8b('0x18')];var _0x4db6f6=_0x3ed057?_0x50cb12[_0xfa8b('0x1a')]:_0x4e7b8f[_0xfa8b('0x18')]+_0x4e7b8f[_0xfa8b('0x1b')];var _0x2628ef;if(_0x4db6f6>=_0x3e0882){_0x4db6f6=_0x3e0882;_0x2628ef=0xc8;}else{_0x2628ef=0xce;}_0x5a5fa1[_0xfa8b('0x16')](_0x2628ef);return _0x5a5fa1['set'](_0xfa8b('0x1c'),_0x3c4397+'-'+_0x4db6f6+'/'+_0x3e0882)[_0xfa8b('0x17')](_0x50cb12);}return null;};}function patchUpdates(_0x34d284){return function(_0x4b1af0){try{jsonpatch[_0xfa8b('0x1d')](_0x4b1af0,_0x34d284,!![]);}catch(_0x4641a7){return BPromise[_0xfa8b('0x1e')](_0x4641a7);}return _0x4b1af0['save']();};}function saveUpdates(_0x320f60,_0x307499){return function(_0x955222){if(_0x955222){return _0x955222[_0xfa8b('0x1f')](_0x320f60)['then'](function(_0x35cf5b){return _0x35cf5b;});}return null;};}function removeEntity(_0x1a2b32,_0x346797){return function(_0x4936aa){if(_0x4936aa){return _0x4936aa[_0xfa8b('0x20')]()[_0xfa8b('0x21')](function(){var _0x370cae=_0x4936aa[_0xfa8b('0x22')]({'plain':!![]});var _0x162ff9=_0xfa8b('0x23');return db[_0xfa8b('0x24')][_0xfa8b('0x20')]({'where':{'type':_0x162ff9,'resourceId':_0x370cae['id']}})[_0xfa8b('0x21')](function(){return _0x4936aa;});})[_0xfa8b('0x21')](function(){_0x1a2b32['status'](0xcc)[_0xfa8b('0x25')]();});}};}function handleEntityNotFound(_0x3e12c4,_0x2b60da){return function(_0xa5c3a8){if(!_0xa5c3a8){_0x3e12c4[_0xfa8b('0x26')](0x194);}return _0xa5c3a8;};}function handleError(_0x55b3e3,_0x1659fa){_0x1659fa=_0x1659fa||0x1f4;return function(_0x1e08c9){logger['error'](_0x1e08c9[_0xfa8b('0x27')]);if(_0x1e08c9[_0xfa8b('0x28')]){delete _0x1e08c9['name'];}_0x55b3e3[_0xfa8b('0x16')](_0x1659fa)[_0xfa8b('0x29')](_0x1e08c9);};}exports[_0xfa8b('0x2a')]=function(_0x69834e,_0x2e3cc0){var _0x697f1b={},_0x118336={},_0x26d4d9={'count':0x0,'rows':[]};var _0x299f98=_[_0xfa8b('0x2b')](db[_0xfa8b('0x2c')]['rawAttributes'],function(_0x5e6462){return{'name':_0x5e6462['fieldName'],'type':_0x5e6462[_0xfa8b('0x2d')][_0xfa8b('0x2e')]};});_0x118336[_0xfa8b('0x2f')]=_[_0xfa8b('0x2b')](_0x299f98,_0xfa8b('0x28'));_0x118336[_0xfa8b('0x30')]=_['keys'](_0x69834e[_0xfa8b('0x30')]);_0x118336['filters']=_['intersection'](_0x118336[_0xfa8b('0x2f')],_0x118336[_0xfa8b('0x30')]);_0x697f1b['attributes']=_['intersection'](_0x118336[_0xfa8b('0x2f')],qs[_0xfa8b('0x31')](_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x31')]));_0x697f1b[_0xfa8b('0x32')]=_0x697f1b['attributes'][_0xfa8b('0x33')]?_0x697f1b[_0xfa8b('0x32')]:_0x118336[_0xfa8b('0x2f')];if(!_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x34')](_0xfa8b('0x35'))){_0x697f1b[_0xfa8b('0x1b')]=qs[_0xfa8b('0x1b')](_0x69834e[_0xfa8b('0x30')]['limit']);_0x697f1b[_0xfa8b('0x18')]=qs[_0xfa8b('0x18')](_0x69834e['query'][_0xfa8b('0x18')]);}_0x697f1b[_0xfa8b('0x36')]=qs['sort'](_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x37')]);_0x697f1b[_0xfa8b('0x38')]=qs[_0xfa8b('0x39')](_[_0xfa8b('0x3a')](_0x69834e['query'],_0x118336[_0xfa8b('0x39')]),_0x299f98);if(_0x69834e[_0xfa8b('0x30')]['filter']){_0x697f1b[_0xfa8b('0x38')]=_['merge'](_0x697f1b[_0xfa8b('0x38')],{'$or':_['map'](_0x299f98,function(_0x57c839){if(_0x57c839['type']!==_0xfa8b('0x3b')){var _0x3ee7a8={};_0x3ee7a8[_0x57c839[_0xfa8b('0x28')]]={'$like':'%'+_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x3c')]+'%'};return _0x3ee7a8;}})});}_0x697f1b=_[_0xfa8b('0x3d')]({},_0x697f1b,_0x69834e[_0xfa8b('0x3e')]);var _0x25c84a={'where':_0x697f1b['where']};return db[_0xfa8b('0x2c')][_0xfa8b('0x1a')](_0x25c84a)[_0xfa8b('0x21')](function(_0x54a8e1){_0x26d4d9[_0xfa8b('0x1a')]=_0x54a8e1;if(_0x69834e['query'][_0xfa8b('0x3f')]){_0x697f1b['include']=[{'all':!![]}];}return db[_0xfa8b('0x2c')][_0xfa8b('0x40')](_0x697f1b);})[_0xfa8b('0x21')](function(_0x5bc97e){_0x26d4d9[_0xfa8b('0x41')]=_0x5bc97e;return _0x26d4d9;})[_0xfa8b('0x21')](respondWithFilteredResult(_0x2e3cc0,_0x697f1b))[_0xfa8b('0x42')](handleError(_0x2e3cc0,null));};exports[_0xfa8b('0x43')]=function(_0x2edce2,_0x1421ee){var _0x399c2b={'raw':!![],'where':{'id':_0x2edce2[_0xfa8b('0x44')]['id']}},_0x5d9a7e={};_0x5d9a7e[_0xfa8b('0x2f')]=_['keys'](db[_0xfa8b('0x2c')][_0xfa8b('0x45')]);_0x5d9a7e['query']=_[_0xfa8b('0x46')](_0x2edce2[_0xfa8b('0x30')]);_0x5d9a7e[_0xfa8b('0x39')]=_[_0xfa8b('0x47')](_0x5d9a7e[_0xfa8b('0x2f')],_0x5d9a7e[_0xfa8b('0x30')]);_0x399c2b[_0xfa8b('0x32')]=_[_0xfa8b('0x47')](_0x5d9a7e[_0xfa8b('0x2f')],qs[_0xfa8b('0x31')](_0x2edce2[_0xfa8b('0x30')][_0xfa8b('0x31')]));_0x399c2b['attributes']=_0x399c2b[_0xfa8b('0x32')][_0xfa8b('0x33')]?_0x399c2b['attributes']:_0x5d9a7e[_0xfa8b('0x2f')];if(_0x2edce2[_0xfa8b('0x30')][_0xfa8b('0x3f')]){_0x399c2b[_0xfa8b('0x48')]=[{'all':!![]}];}_0x399c2b=_[_0xfa8b('0x3d')]({},_0x399c2b,_0x2edce2[_0xfa8b('0x3e')]);return db[_0xfa8b('0x2c')][_0xfa8b('0x49')](_0x399c2b)[_0xfa8b('0x21')](handleEntityNotFound(_0x1421ee,null))['then'](respondWithResult(_0x1421ee,null))[_0xfa8b('0x42')](handleError(_0x1421ee,null));};exports[_0xfa8b('0x4a')]=function(_0x45bedd,_0x53796f){return db[_0xfa8b('0x2c')][_0xfa8b('0x4a')](_0x45bedd[_0xfa8b('0x4b')],{})[_0xfa8b('0x21')](function(_0x39751b){var _0x4ac480=_0x45bedd[_0xfa8b('0x4c')][_0xfa8b('0x22')]({'plain':!![]});if(!_0x4ac480)throw new Error(_0xfa8b('0x4d'));if(_0x4ac480[_0xfa8b('0x4e')]===_0xfa8b('0x4c')){var _0x35305f=_0x39751b['get']({'plain':!![]});var _0x5e0ebb=_0xfa8b('0x23');return db['UserProfileSection'][_0xfa8b('0x49')]({'where':{'name':_0x5e0ebb,'userProfileId':_0x4ac480[_0xfa8b('0x4f')]},'raw':!![]})['then'](function(_0x396a14){if(_0x396a14&&_0x396a14[_0xfa8b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x35305f[_0xfa8b('0x28')],'resourceId':_0x35305f['id'],'type':_0x396a14[_0xfa8b('0x28')],'sectionId':_0x396a14['id']},{})['then'](function(){return _0x39751b;});}else{return _0x39751b;}})[_0xfa8b('0x42')](function(_0x5abe7f){logger[_0xfa8b('0x51')](_0xfa8b('0x52'),_0x5abe7f);throw _0x5abe7f;});}return _0x39751b;})[_0xfa8b('0x21')](respondWithResult(_0x53796f,0xc9))['catch'](handleError(_0x53796f,null));};exports[_0xfa8b('0x1f')]=function(_0x539b62,_0x1691b7){if(_0x539b62['body']['id']){delete _0x539b62['body']['id'];}return db[_0xfa8b('0x2c')]['find']({'where':{'id':_0x539b62['params']['id']}})[_0xfa8b('0x21')](handleEntityNotFound(_0x1691b7,null))[_0xfa8b('0x21')](saveUpdates(_0x539b62[_0xfa8b('0x4b')],null))['then'](respondWithResult(_0x1691b7,null))[_0xfa8b('0x42')](handleError(_0x1691b7,null));};exports['destroy']=function(_0x5a25d0,_0x1b54d7){return db['Disposition'][_0xfa8b('0x49')]({'where':{'id':_0x5a25d0[_0xfa8b('0x44')]['id']}})[_0xfa8b('0x21')](handleEntityNotFound(_0x1b54d7,null))[_0xfa8b('0x21')](removeEntity(_0x1b54d7,null))[_0xfa8b('0x42')](handleError(_0x1b54d7,null));}; \ No newline at end of file +var _0xbc5d=['userProfileId','autoAssociation','error','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','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','Disposition','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','find'];(function(_0x17cb62,_0x448fc0){var _0x15ccff=function(_0x751e44){while(--_0x751e44){_0x17cb62['push'](_0x17cb62['shift']());}};_0x15ccff(++_0x448fc0);}(_0xbc5d,0x19e));var _0xdbc5=function(_0x2ea619,_0x357f04){_0x2ea619=_0x2ea619-0x0;var _0x482187=_0xbc5d[_0x2ea619];return _0x482187;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbc5('0x0'));var zipdir=require(_0xdbc5('0x1'));var jsonpatch=require(_0xdbc5('0x2'));var rp=require(_0xdbc5('0x3'));var moment=require(_0xdbc5('0x4'));var BPromise=require(_0xdbc5('0x5'));var Mustache=require(_0xdbc5('0x6'));var util=require(_0xdbc5('0x7'));var path=require(_0xdbc5('0x8'));var sox=require(_0xdbc5('0x9'));var csv=require('to-csv');var ejs=require(_0xdbc5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbc5('0xb'));var squel=require(_0xdbc5('0xc'));var crypto=require(_0xdbc5('0xd'));var jsforce=require(_0xdbc5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdbc5('0xf'));var authService=require(_0xdbc5('0x10'));var qs=require(_0xdbc5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbc5('0x12'));var logger=require(_0xdbc5('0x13'))(_0xdbc5('0x14'));var utils=require('../../config/utils');var config=require(_0xdbc5('0x15'));var licenseUtil=require(_0xdbc5('0x16'));var db=require(_0xdbc5('0x17'))['db'];function respondWithStatusCode(_0x101cc2,_0xee31ad){_0xee31ad=_0xee31ad||0xcc;return function(_0x4cbd22){if(_0x4cbd22){return _0x101cc2[_0xdbc5('0x18')](_0xee31ad);}return _0x101cc2[_0xdbc5('0x19')](_0xee31ad)[_0xdbc5('0x1a')]();};}function respondWithResult(_0x3d273b,_0x1cce30){_0x1cce30=_0x1cce30||0xc8;return function(_0x1ef662){if(_0x1ef662){return _0x3d273b[_0xdbc5('0x19')](_0x1cce30)['json'](_0x1ef662);}};}function respondWithFilteredResult(_0x517f4c,_0x576591){return function(_0x2b3553){if(_0x2b3553){var _0x52285c=typeof _0x576591['offset']===_0xdbc5('0x1b')&&typeof _0x576591[_0xdbc5('0x1c')]===_0xdbc5('0x1b');var _0x142477=_0x2b3553[_0xdbc5('0x1d')];var _0x41a8c4=_0x52285c?0x0:_0x576591['offset'];var _0x4d793d=_0x52285c?_0x2b3553['count']:_0x576591[_0xdbc5('0x1e')]+_0x576591[_0xdbc5('0x1c')];var _0x44e01a;if(_0x4d793d>=_0x142477){_0x4d793d=_0x142477;_0x44e01a=0xc8;}else{_0x44e01a=0xce;}_0x517f4c['status'](_0x44e01a);return _0x517f4c['set'](_0xdbc5('0x1f'),_0x41a8c4+'-'+_0x4d793d+'/'+_0x142477)[_0xdbc5('0x20')](_0x2b3553);}return null;};}function patchUpdates(_0x4758d2){return function(_0x4fbad3){try{jsonpatch[_0xdbc5('0x21')](_0x4fbad3,_0x4758d2,!![]);}catch(_0x80ace){return BPromise[_0xdbc5('0x22')](_0x80ace);}return _0x4fbad3[_0xdbc5('0x23')]();};}function saveUpdates(_0x43fc97,_0x43d1e2){return function(_0xf7ea79){if(_0xf7ea79){return _0xf7ea79[_0xdbc5('0x24')](_0x43fc97)[_0xdbc5('0x25')](function(_0x225d75){return _0x225d75;});}return null;};}function removeEntity(_0xb8b87c,_0x20f611){return function(_0x36a5da){if(_0x36a5da){return _0x36a5da[_0xdbc5('0x26')]()[_0xdbc5('0x25')](function(){var _0x337d5e=_0x36a5da[_0xdbc5('0x27')]({'plain':!![]});var _0x864959='Dispositions';return db[_0xdbc5('0x28')][_0xdbc5('0x26')]({'where':{'type':_0x864959,'resourceId':_0x337d5e['id']}})[_0xdbc5('0x25')](function(){return _0x36a5da;});})[_0xdbc5('0x25')](function(){_0xb8b87c[_0xdbc5('0x19')](0xcc)[_0xdbc5('0x1a')]();});}};}function handleEntityNotFound(_0x4b82e4,_0x5d5d11){return function(_0x2601aa){if(!_0x2601aa){_0x4b82e4[_0xdbc5('0x18')](0x194);}return _0x2601aa;};}function handleError(_0x24d2d5,_0x447cff){_0x447cff=_0x447cff||0x1f4;return function(_0x2940ec){logger['error'](_0x2940ec['stack']);if(_0x2940ec[_0xdbc5('0x29')]){delete _0x2940ec['name'];}_0x24d2d5[_0xdbc5('0x19')](_0x447cff)[_0xdbc5('0x2a')](_0x2940ec);};}exports[_0xdbc5('0x2b')]=function(_0x19a486,_0x2847da){var _0x4262b9={},_0x5c3b5a={},_0x215303={'count':0x0,'rows':[]};var _0x44d1a8=_['map'](db[_0xdbc5('0x2c')][_0xdbc5('0x2d')],function(_0x1a0605){return{'name':_0x1a0605[_0xdbc5('0x2e')],'type':_0x1a0605[_0xdbc5('0x2f')]['key']};});_0x5c3b5a[_0xdbc5('0x30')]=_['map'](_0x44d1a8,'name');_0x5c3b5a['query']=_[_0xdbc5('0x31')](_0x19a486[_0xdbc5('0x32')]);_0x5c3b5a[_0xdbc5('0x33')]=_[_0xdbc5('0x34')](_0x5c3b5a[_0xdbc5('0x30')],_0x5c3b5a[_0xdbc5('0x32')]);_0x4262b9[_0xdbc5('0x35')]=_['intersection'](_0x5c3b5a['model'],qs[_0xdbc5('0x36')](_0x19a486[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0x4262b9[_0xdbc5('0x35')]=_0x4262b9[_0xdbc5('0x35')]['length']?_0x4262b9[_0xdbc5('0x35')]:_0x5c3b5a['model'];if(!_0x19a486[_0xdbc5('0x32')]['hasOwnProperty'](_0xdbc5('0x37'))){_0x4262b9['limit']=qs[_0xdbc5('0x1c')](_0x19a486[_0xdbc5('0x32')]['limit']);_0x4262b9[_0xdbc5('0x1e')]=qs['offset'](_0x19a486['query'][_0xdbc5('0x1e')]);}_0x4262b9[_0xdbc5('0x38')]=qs[_0xdbc5('0x39')](_0x19a486[_0xdbc5('0x32')][_0xdbc5('0x39')]);_0x4262b9[_0xdbc5('0x3a')]=qs[_0xdbc5('0x33')](_[_0xdbc5('0x3b')](_0x19a486[_0xdbc5('0x32')],_0x5c3b5a[_0xdbc5('0x33')]),_0x44d1a8);if(_0x19a486[_0xdbc5('0x32')][_0xdbc5('0x3c')]){_0x4262b9[_0xdbc5('0x3a')]=_[_0xdbc5('0x3d')](_0x4262b9[_0xdbc5('0x3a')],{'$or':_['map'](_0x44d1a8,function(_0x23647c){if(_0x23647c[_0xdbc5('0x2f')]!==_0xdbc5('0x3e')){var _0x6a3794={};_0x6a3794[_0x23647c[_0xdbc5('0x29')]]={'$like':'%'+_0x19a486[_0xdbc5('0x32')]['filter']+'%'};return _0x6a3794;}})});}_0x4262b9=_[_0xdbc5('0x3d')]({},_0x4262b9,_0x19a486['options']);var _0x47b318={'where':_0x4262b9[_0xdbc5('0x3a')]};return db['Disposition']['count'](_0x47b318)[_0xdbc5('0x25')](function(_0x96e832){_0x215303['count']=_0x96e832;if(_0x19a486[_0xdbc5('0x32')][_0xdbc5('0x3f')]){_0x4262b9[_0xdbc5('0x40')]=[{'all':!![]}];}return db[_0xdbc5('0x2c')]['findAll'](_0x4262b9);})['then'](function(_0x1a7155){_0x215303[_0xdbc5('0x41')]=_0x1a7155;return _0x215303;})['then'](respondWithFilteredResult(_0x2847da,_0x4262b9))[_0xdbc5('0x42')](handleError(_0x2847da,null));};exports[_0xdbc5('0x43')]=function(_0x27e299,_0x5799de){var _0x199455={'raw':!![],'where':{'id':_0x27e299[_0xdbc5('0x44')]['id']}},_0x5d9d89={};_0x5d9d89[_0xdbc5('0x30')]=_['keys'](db[_0xdbc5('0x2c')][_0xdbc5('0x2d')]);_0x5d9d89['query']=_['keys'](_0x27e299['query']);_0x5d9d89[_0xdbc5('0x33')]=_[_0xdbc5('0x34')](_0x5d9d89[_0xdbc5('0x30')],_0x5d9d89[_0xdbc5('0x32')]);_0x199455['attributes']=_[_0xdbc5('0x34')](_0x5d9d89[_0xdbc5('0x30')],qs[_0xdbc5('0x36')](_0x27e299[_0xdbc5('0x32')]['fields']));_0x199455['attributes']=_0x199455[_0xdbc5('0x35')]['length']?_0x199455[_0xdbc5('0x35')]:_0x5d9d89[_0xdbc5('0x30')];if(_0x27e299[_0xdbc5('0x32')]['includeAll']){_0x199455[_0xdbc5('0x40')]=[{'all':!![]}];}_0x199455=_['merge']({},_0x199455,_0x27e299[_0xdbc5('0x45')]);return db[_0xdbc5('0x2c')]['find'](_0x199455)[_0xdbc5('0x25')](handleEntityNotFound(_0x5799de,null))['then'](respondWithResult(_0x5799de,null))[_0xdbc5('0x42')](handleError(_0x5799de,null));};exports[_0xdbc5('0x46')]=function(_0x5662be,_0x4eb179){return db[_0xdbc5('0x2c')]['create'](_0x5662be[_0xdbc5('0x47')],{})[_0xdbc5('0x25')](function(_0x3f0c06){var _0x1e237e=_0x5662be[_0xdbc5('0x48')]['get']({'plain':!![]});if(!_0x1e237e)throw new Error(_0xdbc5('0x49'));if(_0x1e237e[_0xdbc5('0x4a')]===_0xdbc5('0x48')){var _0x33741b=_0x3f0c06[_0xdbc5('0x27')]({'plain':!![]});var _0x39562c=_0xdbc5('0x4b');return db[_0xdbc5('0x4c')][_0xdbc5('0x4d')]({'where':{'name':_0x39562c,'userProfileId':_0x1e237e[_0xdbc5('0x4e')]},'raw':!![]})[_0xdbc5('0x25')](function(_0x54f299){if(_0x54f299&&_0x54f299[_0xdbc5('0x4f')]===0x0){return db[_0xdbc5('0x28')][_0xdbc5('0x46')]({'name':_0x33741b[_0xdbc5('0x29')],'resourceId':_0x33741b['id'],'type':_0x54f299[_0xdbc5('0x29')],'sectionId':_0x54f299['id']},{})[_0xdbc5('0x25')](function(){return _0x3f0c06;});}else{return _0x3f0c06;}})[_0xdbc5('0x42')](function(_0x511643){logger[_0xdbc5('0x50')](_0xdbc5('0x51'),_0x511643);throw _0x511643;});}return _0x3f0c06;})[_0xdbc5('0x25')](respondWithResult(_0x4eb179,0xc9))[_0xdbc5('0x42')](handleError(_0x4eb179,null));};exports['update']=function(_0xfac033,_0x549cea){if(_0xfac033[_0xdbc5('0x47')]['id']){delete _0xfac033[_0xdbc5('0x47')]['id'];}return db[_0xdbc5('0x2c')]['find']({'where':{'id':_0xfac033['params']['id']}})[_0xdbc5('0x25')](handleEntityNotFound(_0x549cea,null))[_0xdbc5('0x25')](saveUpdates(_0xfac033['body'],null))[_0xdbc5('0x25')](respondWithResult(_0x549cea,null))[_0xdbc5('0x42')](handleError(_0x549cea,null));};exports[_0xdbc5('0x26')]=function(_0x2fb5dd,_0x2b6422){return db['Disposition'][_0xdbc5('0x4d')]({'where':{'id':_0x2fb5dd['params']['id']}})[_0xdbc5('0x25')](handleEntityNotFound(_0x2b6422,null))[_0xdbc5('0x25')](removeEntity(_0x2b6422,null))['catch'](handleError(_0x2b6422,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c9e2550..fe365d2 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 _0x662f=['ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','lodash','api','moment','bluebird','request-promise','path','rimraf','exports','Disposition','tools_dispositions','name_voice','name','name_chat'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x662f,0x16d));var _0xf662=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x662f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf662('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf662('0x1'));var moment=require(_0xf662('0x2'));var BPromise=require(_0xf662('0x3'));var rp=require(_0xf662('0x4'));var fs=require('fs');var path=require(_0xf662('0x5'));var rimraf=require(_0xf662('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xf662('0x7')]=function(_0x2f7f2b,_0x360533){return _0x2f7f2b['define'](_0xf662('0x8'),attributes,{'tableName':_0xf662('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf662('0xa'),'fields':[_0xf662('0xb'),'ListId']},{'unique':!![],'name':_0xf662('0xc'),'fields':[_0xf662('0xb'),_0xf662('0xd')]},{'unique':!![],'name':_0xf662('0xe'),'fields':[_0xf662('0xb'),_0xf662('0xf')]},{'unique':!![],'name':_0xf662('0x10'),'fields':[_0xf662('0xb'),_0xf662('0x11')]},{'unique':!![],'name':_0xf662('0x12'),'fields':[_0xf662('0xb'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name',_0xf662('0x13')]},{'unique':!![],'name':_0xf662('0x14'),'fields':[_0xf662('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc893=['util','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','define','Disposition','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc893,0x1da));var _0x3c89=function(_0x3ee26b,_0x5d73bd){_0x3ee26b=_0x3ee26b-0x0;var _0x4376a3=_0xc893[_0x3ee26b];return _0x4376a3;};'use strict';var _=require(_0x3c89('0x0'));var util=require(_0x3c89('0x1'));var logger=require('../../config/logger')(_0x3c89('0x2'));var moment=require(_0x3c89('0x3'));var BPromise=require(_0x3c89('0x4'));var rp=require(_0x3c89('0x5'));var fs=require('fs');var path=require(_0x3c89('0x6'));var rimraf=require(_0x3c89('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c89('0x8'));module['exports']=function(_0x74109f,_0x27b112){return _0x74109f[_0x3c89('0x9')](_0x3c89('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x3c89('0xb'),'fields':['name',_0x3c89('0xc')]},{'unique':!![],'name':_0x3c89('0xd'),'fields':[_0x3c89('0xe'),_0x3c89('0xf')]},{'unique':!![],'name':_0x3c89('0x10'),'fields':[_0x3c89('0xe'),_0x3c89('0x11')]},{'unique':!![],'name':_0x3c89('0x12'),'fields':['name',_0x3c89('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0x3c89('0xe'),_0x3c89('0x14')]},{'unique':!![],'name':_0x3c89('0x15'),'fields':[_0x3c89('0xe'),_0x3c89('0x16')]},{'unique':!![],'name':_0x3c89('0x17'),'fields':[_0x3c89('0xe'),_0x3c89('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0e2414c..8f11792 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(_0x473780,_0x3fcdc0){var _0x5bdcf8=function(_0x301db8){while(--_0x301db8){_0x473780['push'](_0x473780['shift']());}};_0x5bdcf8(++_0x3fcdc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x40eaa7,_0x3830b3){var _0x2054ee=function(_0x4d58be){while(--_0x4d58be){_0x40eaa7['push'](_0x40eaa7['shift']());}};_0x2054ee(++_0x3830b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ba234fa..dc81ac8 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 _0x0eb1=['create','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x14b078,_0x3766f9){var _0x18a324=function(_0x5df20a){while(--_0x5df20a){_0x14b078['push'](_0x14b078['shift']());}};_0x18a324(++_0x3766f9);}(_0x0eb1,0x124));var _0x10eb=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0x0eb1[_0x2a1465];return _0x128933;};'use strict';var multer=require(_0x10eb('0x0'));var util=require(_0x10eb('0x1'));var path=require(_0x10eb('0x2'));var timeout=require('connect-timeout');var express=require(_0x10eb('0x3'));var router=express[_0x10eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x10eb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x10eb('0x6'));router[_0x10eb('0x7')]('/',auth[_0x10eb('0x8')](),controller[_0x10eb('0x9')]);router[_0x10eb('0x7')](_0x10eb('0xa'),auth[_0x10eb('0x8')](),controller[_0x10eb('0xb')]);router['post']('/',auth[_0x10eb('0x8')](),controller[_0x10eb('0xc')]);router['put'](_0x10eb('0xa'),auth[_0x10eb('0x8')](),controller[_0x10eb('0xd')]);router['delete'](_0x10eb('0xa'),auth[_0x10eb('0x8')](),controller[_0x10eb('0xe')]);module[_0x10eb('0xf')]=router; \ No newline at end of file +var _0x2d34=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x2d34,0x136));var _0x42d3=function(_0x110a14,_0x2704c9){_0x110a14=_0x110a14-0x0;var _0x4fb223=_0x2d34[_0x110a14];return _0x4fb223;};'use strict';var multer=require(_0x42d3('0x0'));var util=require(_0x42d3('0x1'));var path=require(_0x42d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x42d3('0x3'));var router=express[_0x42d3('0x4')]();var fs_extra=require(_0x42d3('0x5'));var auth=require(_0x42d3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x42d3('0x7'));var controller=require(_0x42d3('0x8'));router[_0x42d3('0x9')]('/',auth[_0x42d3('0xa')](),controller[_0x42d3('0xb')]);router['get']('/:id',auth[_0x42d3('0xa')](),controller[_0x42d3('0xc')]);router[_0x42d3('0xd')]('/',auth['isAuthenticated'](),controller[_0x42d3('0xe')]);router[_0x42d3('0xf')](_0x42d3('0x10'),auth[_0x42d3('0xa')](),controller[_0x42d3('0x11')]);router[_0x42d3('0x12')](_0x42d3('0x10'),auth['isAuthenticated'](),controller[_0x42d3('0x13')]);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 4fa1756..2d1cdb4 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 _0xc4e4=['KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','7200','9600','12000','14400','IAX','DADHI'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xc4e4,0x7d));var _0x4c4e=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xc4e4[_0x28aea5];return _0x6a55f9;};'use strict';var Sequelize=require(_0x4c4e('0x0'));module[_0x4c4e('0x1')]={'name':{'type':Sequelize[_0x4c4e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4c4e('0x2')]},'ecm':{'type':Sequelize[_0x4c4e('0x3')](_0x4c4e('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x4c4e('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x4c4e('0x3')](_0x4c4e('0x5'),_0x4c4e('0x6'),_0x4c4e('0x7'),_0x4c4e('0x8'),_0x4c4e('0x9'),_0x4c4e('0xa')),'defaultValue':_0x4c4e('0x6')},'maxrate':{'type':Sequelize[_0x4c4e('0x3')](_0x4c4e('0x5'),_0x4c4e('0x6'),_0x4c4e('0x7'),_0x4c4e('0x8'),_0x4c4e('0x9'),_0x4c4e('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x4c4e('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x4c4e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4c4e('0x3')]('SIP',_0x4c4e('0xb'),_0x4c4e('0xc'),_0x4c4e('0xd')),'defaultValue':_0x4c4e('0xe')},'key':{'type':Sequelize[_0x4c4e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4c4e('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4c4e('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4c4e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4c4e('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c4e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c4e('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c4e('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x4c4e('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x4c4e('0x10')],'defaultValue':![],'comment':_0x4c4e('0x13'),'set':function(_0x4c818b){if(!_0x4c818b)this['setDataValue'](_0x4c4e('0x14'),null);this[_0x4c4e('0x15')](_0x4c4e('0x16'),_0x4c818b);}}}; \ No newline at end of file +var _0x6444=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','SIP','DADHI','TEXT'];(function(_0x2ea1c6,_0x2eea21){var _0xfd90cf=function(_0x5cd98b){while(--_0x5cd98b){_0x2ea1c6['push'](_0x2ea1c6['shift']());}};_0xfd90cf(++_0x2eea21);}(_0x6444,0x97));var _0x4644=function(_0x3363a6,_0x231ca1){_0x3363a6=_0x3363a6-0x0;var _0x2881c9=_0x6444[_0x3363a6];return _0x2881c9;};'use strict';var Sequelize=require(_0x4644('0x0'));module[_0x4644('0x1')]={'name':{'type':Sequelize[_0x4644('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4644('0x2')]},'ecm':{'type':Sequelize[_0x4644('0x3')](_0x4644('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x4644('0x2')],'defaultValue':_0x4644('0x5')},'localstationid':{'type':Sequelize[_0x4644('0x2')],'unique':_0x4644('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0x4644('0x7'),_0x4644('0x8'),_0x4644('0x9'),_0x4644('0xa'),_0x4644('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x4644('0x3')](_0x4644('0xc'),_0x4644('0x7'),_0x4644('0x8'),_0x4644('0x9'),_0x4644('0xa'),_0x4644('0xb')),'defaultValue':_0x4644('0xb')},'modem':{'type':Sequelize[_0x4644('0x2')],'defaultValue':_0x4644('0xd')},'gateway':{'type':Sequelize[_0x4644('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4644('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4644('0x3')](_0x4644('0xe'),'IAX',_0x4644('0xf'),'KHOMP'),'defaultValue':_0x4644('0xe')},'key':{'type':Sequelize[_0x4644('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4644('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4644('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4644('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4644('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4644('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4644('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4644('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x4644('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4644('0x14'),'set':function(_0x92f27a){if(!_0x92f27a)this[_0x4644('0x15')](_0x4644('0x16'),null);this[_0x4644('0x15')](_0x4644('0x17'),_0x92f27a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 30d4cca..f1038f8 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 _0xdbb6=['show','params','Pause','fields','find','create','body','user','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','includeAll','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','ListId','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','userFaxAccount:save','isArray','emit','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','client','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','FaxAccounts','end','sendStatus','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbb6,0x129));var _0x6dbb=function(_0x2d7bf3,_0x68fbe7){_0x2d7bf3=_0x2d7bf3-0x0;var _0x3b0675=_0xdbb6[_0x2d7bf3];return _0x3b0675;};'use strict';var emlformat=require(_0x6dbb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6dbb('0x1'));var jsonpatch=require(_0x6dbb('0x2'));var rp=require(_0x6dbb('0x3'));var moment=require(_0x6dbb('0x4'));var BPromise=require(_0x6dbb('0x5'));var Mustache=require(_0x6dbb('0x6'));var util=require(_0x6dbb('0x7'));var path=require(_0x6dbb('0x8'));var sox=require(_0x6dbb('0x9'));var csv=require('to-csv');var ejs=require(_0x6dbb('0xa'));var fs=require('fs');var fs_extra=require(_0x6dbb('0xb'));var _=require('lodash');var squel=require(_0x6dbb('0xc'));var crypto=require(_0x6dbb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6dbb('0xe'));var querystring=require(_0x6dbb('0xf'));var Papa=require(_0x6dbb('0x10'));var Redis=require('ioredis');var authService=require(_0x6dbb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6dbb('0x12'));var hardwareService=require(_0x6dbb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6dbb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6dbb('0x15'));var db=require(_0x6dbb('0x16'))['db'];config[_0x6dbb('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6dbb('0x18'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x6dbb('0x19')](socket);var jayson=require(_0x6dbb('0x1a'));var client=jayson['client'][_0x6dbb('0x1b')]({'port':0x232c});var client9002=jayson[_0x6dbb('0x1c')][_0x6dbb('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5e7ae9,_0x3ced45,_0x1f3d89,_0x1b48c2){return new BPromise(function(_0x3148a4,_0x549c3c){var _0x23d969=_0x1b48c2||client;return _0x23d969[_0x6dbb('0x1d')](_0x5e7ae9,_0x1f3d89)[_0x6dbb('0x1e')](function(_0xe061f2){logger['info'](_0x6dbb('0x1f'),_0x3ced45,_0x6dbb('0x20'));logger[_0x6dbb('0x21')](_0x6dbb('0x22'),_0x3ced45,_0x6dbb('0x20'),JSON[_0x6dbb('0x23')](_0xe061f2));if(_0xe061f2[_0x6dbb('0x24')]){if(_0xe061f2[_0x6dbb('0x24')]['code']===0x1f4){logger[_0x6dbb('0x24')](_0x6dbb('0x1f'),_0x3ced45,_0xe061f2[_0x6dbb('0x24')][_0x6dbb('0x25')]);return _0x549c3c(_0xe061f2[_0x6dbb('0x24')]['message']);}logger[_0x6dbb('0x24')](_0x6dbb('0x1f'),_0x3ced45,_0xe061f2['error'][_0x6dbb('0x25')]);return _0x3148a4(_0xe061f2[_0x6dbb('0x24')]['message']);}else{logger[_0x6dbb('0x26')]('FaxAccount,\x20%s,\x20%s',_0x3ced45,_0x6dbb('0x20'));_0x3148a4(_0xe061f2[_0x6dbb('0x27')][_0x6dbb('0x25')]);}})['catch'](function(_0x3d2b07){logger['error'](_0x6dbb('0x1f'),_0x3ced45,_0x3d2b07);_0x549c3c(_0x3d2b07);});});}function respondWithStatusCode(_0x51216c,_0x494d68){_0x494d68=_0x494d68||0xcc;return function(_0x83b2c7){if(_0x83b2c7){return _0x51216c['sendStatus'](_0x494d68);}return _0x51216c[_0x6dbb('0x28')](_0x494d68)['end']();};}function respondWithResult(_0x446673,_0x156393){_0x156393=_0x156393||0xc8;return function(_0x2a5285){if(_0x2a5285){return _0x446673[_0x6dbb('0x28')](_0x156393)[_0x6dbb('0x29')](_0x2a5285);}};}function respondWithFilteredResult(_0x411cde,_0x244a93){return function(_0x2c1b54){if(_0x2c1b54){var _0x2fc102=typeof _0x244a93[_0x6dbb('0x2a')]===_0x6dbb('0x2b')&&typeof _0x244a93['limit']===_0x6dbb('0x2b');var _0x4842ad=_0x2c1b54[_0x6dbb('0x2c')];var _0x3088ad=_0x2fc102?0x0:_0x244a93[_0x6dbb('0x2a')];var _0x1e86ac=_0x2fc102?_0x2c1b54[_0x6dbb('0x2c')]:_0x244a93[_0x6dbb('0x2a')]+_0x244a93[_0x6dbb('0x2d')];var _0x293769;if(_0x1e86ac>=_0x4842ad){_0x1e86ac=_0x4842ad;_0x293769=0xc8;}else{_0x293769=0xce;}_0x411cde[_0x6dbb('0x28')](_0x293769);return _0x411cde['set'](_0x6dbb('0x2e'),_0x3088ad+'-'+_0x1e86ac+'/'+_0x4842ad)[_0x6dbb('0x29')](_0x2c1b54);}return null;};}function patchUpdates(_0x402c07){return function(_0x562203){try{jsonpatch[_0x6dbb('0x2f')](_0x562203,_0x402c07,!![]);}catch(_0x4b7689){return BPromise['reject'](_0x4b7689);}return _0x562203[_0x6dbb('0x30')]();};}function saveUpdates(_0x4ba30e,_0x36ac27){return function(_0x4c49c5){if(_0x4c49c5){return _0x4c49c5[_0x6dbb('0x31')](_0x4ba30e)['then'](function(_0x42b8a9){return _0x42b8a9;});}return null;};}function removeEntity(_0x3bd2ab,_0x4ecadc){return function(_0x439131){if(_0x439131){return _0x439131[_0x6dbb('0x32')]()[_0x6dbb('0x1e')](function(){var _0x735f72=_0x439131[_0x6dbb('0x33')]({'plain':!![]});var _0x99ddf7=_0x6dbb('0x34');return db['UserProfileResource'][_0x6dbb('0x32')]({'where':{'type':_0x99ddf7,'resourceId':_0x735f72['id']}})[_0x6dbb('0x1e')](function(){return _0x439131;});})[_0x6dbb('0x1e')](function(){_0x3bd2ab[_0x6dbb('0x28')](0xcc)[_0x6dbb('0x35')]();});}};}function handleEntityNotFound(_0x3e88ab,_0x446cde){return function(_0x13ed07){if(!_0x13ed07){_0x3e88ab[_0x6dbb('0x36')](0x194);}return _0x13ed07;};}function handleError(_0x4d2dbd,_0x4cdc56){_0x4cdc56=_0x4cdc56||0x1f4;return function(_0x2c24f8){logger[_0x6dbb('0x24')](_0x2c24f8['stack']);if(_0x2c24f8[_0x6dbb('0x37')]){delete _0x2c24f8[_0x6dbb('0x37')];}_0x4d2dbd['status'](_0x4cdc56)[_0x6dbb('0x38')](_0x2c24f8);};}exports[_0x6dbb('0x39')]=function(_0x4a0242,_0x4f2ed2){var _0x56c7d3={'include':[{'model':db['Pause'],'as':_0x6dbb('0x3a')}]},_0x30d72b={},_0x2c8a90={'count':0x0,'rows':[]};var _0xb75a7=_['map'](db[_0x6dbb('0x3b')][_0x6dbb('0x3c')],function(_0x5cfba0){return{'name':_0x5cfba0[_0x6dbb('0x3d')],'type':_0x5cfba0[_0x6dbb('0x3e')][_0x6dbb('0x3f')]};});_0x30d72b[_0x6dbb('0x40')]=_[_0x6dbb('0x41')](_0xb75a7,_0x6dbb('0x37'));_0x30d72b[_0x6dbb('0x42')]=_[_0x6dbb('0x43')](_0x4a0242[_0x6dbb('0x42')]);_0x30d72b[_0x6dbb('0x44')]=_[_0x6dbb('0x45')](_0x30d72b[_0x6dbb('0x40')],_0x30d72b[_0x6dbb('0x42')]);_0x56c7d3[_0x6dbb('0x46')]=_[_0x6dbb('0x45')](_0x30d72b[_0x6dbb('0x40')],qs['fields'](_0x4a0242[_0x6dbb('0x42')]['fields']));_0x56c7d3[_0x6dbb('0x46')]=_0x56c7d3['attributes'][_0x6dbb('0x47')]?_0x56c7d3[_0x6dbb('0x46')]:_0x30d72b[_0x6dbb('0x40')];if(!_0x4a0242['query'][_0x6dbb('0x48')](_0x6dbb('0x49'))){_0x56c7d3[_0x6dbb('0x2d')]=qs[_0x6dbb('0x2d')](_0x4a0242['query'][_0x6dbb('0x2d')]);_0x56c7d3[_0x6dbb('0x2a')]=qs['offset'](_0x4a0242[_0x6dbb('0x42')][_0x6dbb('0x2a')]);}_0x56c7d3['order']=qs[_0x6dbb('0x4a')](_0x4a0242[_0x6dbb('0x42')][_0x6dbb('0x4a')]);_0x56c7d3[_0x6dbb('0x4b')]=qs[_0x6dbb('0x44')](_[_0x6dbb('0x4c')](_0x4a0242['query'],_0x30d72b[_0x6dbb('0x44')]),_0xb75a7);if(_0x4a0242['query']['filter']){_0x56c7d3[_0x6dbb('0x4b')]=_[_0x6dbb('0x4d')](_0x56c7d3[_0x6dbb('0x4b')],{'$or':_[_0x6dbb('0x41')](_0xb75a7,function(_0x55c1ad){if(_0x55c1ad[_0x6dbb('0x3e')]!==_0x6dbb('0x4e')){var _0xb16905={};_0xb16905[_0x55c1ad[_0x6dbb('0x37')]]={'$like':'%'+_0x4a0242[_0x6dbb('0x42')][_0x6dbb('0x4f')]+'%'};return _0xb16905;}})});}_0x56c7d3=_[_0x6dbb('0x4d')]({},_0x56c7d3,_0x4a0242[_0x6dbb('0x50')]);var _0xca9d2a={'where':_0x56c7d3[_0x6dbb('0x4b')]};return db['FaxAccount'][_0x6dbb('0x2c')](_0xca9d2a)[_0x6dbb('0x1e')](function(_0x36e625){_0x2c8a90[_0x6dbb('0x2c')]=_0x36e625;if(_0x4a0242['query']['includeAll']){_0x56c7d3[_0x6dbb('0x51')]=[{'all':!![]}];}return db[_0x6dbb('0x3b')][_0x6dbb('0x52')](_0x56c7d3);})[_0x6dbb('0x1e')](function(_0xf96a25){_0x2c8a90[_0x6dbb('0x53')]=_0xf96a25;return _0x2c8a90;})[_0x6dbb('0x1e')](respondWithFilteredResult(_0x4f2ed2,_0x56c7d3))[_0x6dbb('0x54')](handleError(_0x4f2ed2,null));};exports[_0x6dbb('0x55')]=function(_0xf4f06b,_0x2889b1){var _0x2a3245={'raw':![],'where':{'id':_0xf4f06b[_0x6dbb('0x56')]['id']},'include':[{'model':db[_0x6dbb('0x57')],'as':_0x6dbb('0x3a')}]},_0x53bc79={};_0x53bc79['model']=_[_0x6dbb('0x43')](db[_0x6dbb('0x3b')][_0x6dbb('0x3c')]);_0x53bc79[_0x6dbb('0x42')]=_[_0x6dbb('0x43')](_0xf4f06b[_0x6dbb('0x42')]);_0x53bc79[_0x6dbb('0x44')]=_[_0x6dbb('0x45')](_0x53bc79[_0x6dbb('0x40')],_0x53bc79[_0x6dbb('0x42')]);_0x2a3245[_0x6dbb('0x46')]=_['intersection'](_0x53bc79[_0x6dbb('0x40')],qs[_0x6dbb('0x58')](_0xf4f06b['query'][_0x6dbb('0x58')]));_0x2a3245['attributes']=_0x2a3245['attributes'][_0x6dbb('0x47')]?_0x2a3245['attributes']:_0x53bc79[_0x6dbb('0x40')];if(_0xf4f06b[_0x6dbb('0x42')]['includeAll']){_0x2a3245[_0x6dbb('0x51')]=[{'all':!![]}];}_0x2a3245=_[_0x6dbb('0x4d')]({},_0x2a3245,_0xf4f06b[_0x6dbb('0x50')]);return db[_0x6dbb('0x3b')][_0x6dbb('0x59')](_0x2a3245)[_0x6dbb('0x1e')](handleEntityNotFound(_0x2889b1,null))[_0x6dbb('0x1e')](respondWithResult(_0x2889b1,null))[_0x6dbb('0x54')](handleError(_0x2889b1,null));};exports[_0x6dbb('0x5a')]=function(_0x295938,_0x233e3e){return db[_0x6dbb('0x3b')][_0x6dbb('0x5a')](_0x295938[_0x6dbb('0x5b')],{})[_0x6dbb('0x1e')](function(_0x29814e){var _0x334091=_0x295938[_0x6dbb('0x5c')][_0x6dbb('0x33')]({'plain':!![]});if(!_0x334091)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x334091['role']===_0x6dbb('0x5c')){var _0x1634a9=_0x29814e[_0x6dbb('0x33')]({'plain':!![]});var _0x1af68b=_0x6dbb('0x34');return db['UserProfileSection'][_0x6dbb('0x59')]({'where':{'name':_0x1af68b,'userProfileId':_0x334091[_0x6dbb('0x5d')]},'raw':!![]})['then'](function(_0x1b3a8e){if(_0x1b3a8e&&_0x1b3a8e[_0x6dbb('0x5e')]===0x0){return db[_0x6dbb('0x5f')]['create']({'name':_0x1634a9['name'],'resourceId':_0x1634a9['id'],'type':_0x1b3a8e[_0x6dbb('0x37')],'sectionId':_0x1b3a8e['id']},{})[_0x6dbb('0x1e')](function(){return _0x29814e;});}else{return _0x29814e;}})[_0x6dbb('0x54')](function(_0xb7c85){logger[_0x6dbb('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c85);throw _0xb7c85;});}return _0x29814e;})['then'](respondWithResult(_0x233e3e,0xc9))['catch'](handleError(_0x233e3e,null));};exports[_0x6dbb('0x31')]=function(_0x568833,_0x2e87bd){if(_0x568833['body']['id']){delete _0x568833[_0x6dbb('0x5b')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x568833[_0x6dbb('0x56')]['id']},'include':[{'model':db[_0x6dbb('0x57')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2e87bd,null))[_0x6dbb('0x1e')](saveUpdates(_0x568833['body'],null))[_0x6dbb('0x1e')](respondWithResult(_0x2e87bd,null))[_0x6dbb('0x54')](handleError(_0x2e87bd,null));};exports[_0x6dbb('0x32')]=function(_0x2abeac,_0x771359){return db[_0x6dbb('0x3b')][_0x6dbb('0x59')]({'where':{'id':_0x2abeac['params']['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x771359,null))[_0x6dbb('0x1e')](removeEntity(_0x771359,null))[_0x6dbb('0x54')](handleError(_0x771359,null));};exports[_0x6dbb('0x60')]=function(_0x2f25b4,_0x2e7adc){return db[_0x6dbb('0x3b')][_0x6dbb('0x60')]()[_0x6dbb('0x1e')](respondWithResult(_0x2e7adc,null))[_0x6dbb('0x54')](handleError(_0x2e7adc,null));};exports[_0x6dbb('0x61')]=function(_0x1a62e7,_0x564816,_0x19ebe){if(_0x1a62e7[_0x6dbb('0x5b')]['id']){delete _0x1a62e7[_0x6dbb('0x5b')]['id'];}return db[_0x6dbb('0x3b')]['find']({'where':{'id':_0x1a62e7['params']['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x564816,null))[_0x6dbb('0x1e')](function(_0x13bcd6){if(_0x13bcd6){_0x1a62e7['body'][_0x6dbb('0x62')]=_0x13bcd6['id'];return db[_0x6dbb('0x63')][_0x6dbb('0x5a')](_0x1a62e7['body']);}})[_0x6dbb('0x1e')](respondWithResult(_0x564816,null))[_0x6dbb('0x54')](handleError(_0x564816,null));};exports[_0x6dbb('0x64')]=function(_0x3f0c75,_0x66562f,_0x5eb0de){var _0x586e6e={'raw':![],'where':{}};var _0x69c3bd={};var _0x41b94d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3f0c75['params']['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x66562f,null))[_0x6dbb('0x1e')](function(_0x47d548){if(_0x47d548){_0x69c3bd['model']=_['keys'](db[_0x6dbb('0x63')][_0x6dbb('0x3c')]);_0x69c3bd[_0x6dbb('0x42')]=_[_0x6dbb('0x43')](_0x3f0c75[_0x6dbb('0x42')]);_0x69c3bd['filters']=_['intersection'](_0x69c3bd[_0x6dbb('0x40')],_0x69c3bd[_0x6dbb('0x42')]);_0x586e6e[_0x6dbb('0x46')]=_['intersection'](_0x69c3bd[_0x6dbb('0x40')],qs[_0x6dbb('0x58')](_0x3f0c75[_0x6dbb('0x42')][_0x6dbb('0x58')]));_0x586e6e[_0x6dbb('0x46')]=_0x586e6e[_0x6dbb('0x46')][_0x6dbb('0x47')]?_0x586e6e[_0x6dbb('0x46')]:_0x69c3bd[_0x6dbb('0x40')];if(!_0x3f0c75[_0x6dbb('0x42')][_0x6dbb('0x48')]('nolimit')){_0x586e6e[_0x6dbb('0x2d')]=qs['limit'](_0x3f0c75[_0x6dbb('0x42')][_0x6dbb('0x2d')]);_0x586e6e['offset']=qs[_0x6dbb('0x2a')](_0x3f0c75['query'][_0x6dbb('0x2a')]);}_0x586e6e['order']=qs[_0x6dbb('0x4a')](_0x3f0c75['query'][_0x6dbb('0x4a')]);_0x586e6e[_0x6dbb('0x4b')]=qs[_0x6dbb('0x44')](_['pick'](_0x3f0c75[_0x6dbb('0x42')],_0x69c3bd['filters']));_0x586e6e['where'][_0x6dbb('0x62')]=_0x47d548['id'];if(_0x3f0c75[_0x6dbb('0x42')]['filter']){_0x586e6e[_0x6dbb('0x4b')]=_[_0x6dbb('0x4d')](_0x586e6e['where'],{'$or':_[_0x6dbb('0x41')](_0x586e6e[_0x6dbb('0x46')],function(_0x16819c){var _0x5619aa={};_0x5619aa[_0x16819c]={'$like':'%'+_0x3f0c75[_0x6dbb('0x42')][_0x6dbb('0x4f')]+'%'};return _0x5619aa;})});}_0x586e6e=_['merge']({},_0x586e6e,_0x3f0c75['options']);return db[_0x6dbb('0x63')][_0x6dbb('0x2c')]({'where':_0x586e6e['where']})['then'](function(_0x1507a1){_0x41b94d[_0x6dbb('0x2c')]=_0x1507a1;if(_0x3f0c75[_0x6dbb('0x42')]['includeAll']){_0x586e6e['include']=[{'all':!![]}];}return db['Disposition'][_0x6dbb('0x52')](_0x586e6e);})[_0x6dbb('0x1e')](function(_0x5d46e8){_0x41b94d['rows']=_0x5d46e8;return _0x41b94d;});}})[_0x6dbb('0x1e')](respondWithFilteredResult(_0x66562f,_0x586e6e))['catch'](handleError(_0x66562f,null));};exports[_0x6dbb('0x65')]=function(_0x430e47,_0x2ee0fd,_0x6e201){return db[_0x6dbb('0x3b')][_0x6dbb('0x59')]({'where':{'id':_0x430e47[_0x6dbb('0x56')]['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x2ee0fd,null))[_0x6dbb('0x1e')](function(_0x22562b){if(_0x22562b){return _0x22562b[_0x6dbb('0x65')](_0x430e47[_0x6dbb('0x42')][_0x6dbb('0x66')]);}})[_0x6dbb('0x1e')](respondWithStatusCode(_0x2ee0fd,null))[_0x6dbb('0x54')](handleError(_0x2ee0fd,null));};exports[_0x6dbb('0x67')]=function(_0x53cd76,_0x2511be,_0x2ff6da){if(_0x53cd76['body']['id']){delete _0x53cd76[_0x6dbb('0x5b')]['id'];}return db[_0x6dbb('0x3b')][_0x6dbb('0x59')]({'where':{'id':_0x53cd76[_0x6dbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2511be,null))['then'](function(_0x273d88){if(_0x273d88){_0x53cd76['body'][_0x6dbb('0x62')]=_0x273d88['id'];return db[_0x6dbb('0x68')][_0x6dbb('0x5a')](_0x53cd76['body']);}})[_0x6dbb('0x1e')](respondWithResult(_0x2511be,null))['catch'](handleError(_0x2511be,null));};exports[_0x6dbb('0x69')]=function(_0x549d5d,_0x1f2f4a,_0x264a64){var _0x491517={'raw':![],'where':{}};var _0x49ca7e={};var _0x1181f3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6dbb('0x6a')]({'where':{'id':_0x549d5d['params']['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x1f2f4a,null))[_0x6dbb('0x1e')](function(_0x7d5d91){if(_0x7d5d91){_0x49ca7e['model']=_[_0x6dbb('0x43')](db[_0x6dbb('0x68')][_0x6dbb('0x3c')]);_0x49ca7e['query']=_[_0x6dbb('0x43')](_0x549d5d[_0x6dbb('0x42')]);_0x49ca7e[_0x6dbb('0x44')]=_[_0x6dbb('0x45')](_0x49ca7e[_0x6dbb('0x40')],_0x49ca7e[_0x6dbb('0x42')]);_0x491517[_0x6dbb('0x46')]=_['intersection'](_0x49ca7e[_0x6dbb('0x40')],qs[_0x6dbb('0x58')](_0x549d5d[_0x6dbb('0x42')]['fields']));_0x491517[_0x6dbb('0x46')]=_0x491517[_0x6dbb('0x46')][_0x6dbb('0x47')]?_0x491517[_0x6dbb('0x46')]:_0x49ca7e[_0x6dbb('0x40')];if(!_0x549d5d['query'][_0x6dbb('0x48')]('nolimit')){_0x491517['limit']=qs['limit'](_0x549d5d['query'][_0x6dbb('0x2d')]);_0x491517[_0x6dbb('0x2a')]=qs[_0x6dbb('0x2a')](_0x549d5d[_0x6dbb('0x42')][_0x6dbb('0x2a')]);}_0x491517[_0x6dbb('0x6b')]=qs[_0x6dbb('0x4a')](_0x549d5d['query'][_0x6dbb('0x4a')]);_0x491517[_0x6dbb('0x4b')]=qs['filters'](_[_0x6dbb('0x4c')](_0x549d5d['query'],_0x49ca7e[_0x6dbb('0x44')]));_0x491517[_0x6dbb('0x4b')]['FaxAccountId']=_0x7d5d91['id'];if(_0x549d5d[_0x6dbb('0x42')][_0x6dbb('0x4f')]){_0x491517[_0x6dbb('0x4b')]=_['merge'](_0x491517[_0x6dbb('0x4b')],{'$or':_['map'](_0x491517['attributes'],function(_0x53f71d){var _0x1d2a42={};_0x1d2a42[_0x53f71d]={'$like':'%'+_0x549d5d[_0x6dbb('0x42')][_0x6dbb('0x4f')]+'%'};return _0x1d2a42;})});}_0x491517=_['merge']({},_0x491517,_0x549d5d['options']);return db[_0x6dbb('0x68')][_0x6dbb('0x2c')]({'where':_0x491517[_0x6dbb('0x4b')]})[_0x6dbb('0x1e')](function(_0x3434b1){_0x1181f3[_0x6dbb('0x2c')]=_0x3434b1;if(_0x549d5d[_0x6dbb('0x42')][_0x6dbb('0x6c')]){_0x491517['include']=[{'all':!![]}];}return db[_0x6dbb('0x68')][_0x6dbb('0x52')](_0x491517);})['then'](function(_0x56b264){_0x1181f3['rows']=_0x56b264;return _0x1181f3;});}})[_0x6dbb('0x1e')](respondWithFilteredResult(_0x1f2f4a,_0x491517))['catch'](handleError(_0x1f2f4a,null));};exports[_0x6dbb('0x6d')]=function(_0x4aeb1b,_0x34bb78,_0x37fda4){return db[_0x6dbb('0x3b')]['find']({'where':{'id':_0x4aeb1b[_0x6dbb('0x56')]['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x34bb78,null))[_0x6dbb('0x1e')](function(_0x5def26){if(_0x5def26){return _0x5def26['removeAnswers'](_0x4aeb1b[_0x6dbb('0x42')]['ids']);}})[_0x6dbb('0x1e')](respondWithStatusCode(_0x34bb78,null))['catch'](handleError(_0x34bb78,null));};exports[_0x6dbb('0x6e')]=function(_0x4d5841,_0x2c54ce,_0x102b81){return db['FaxInteraction'][_0x6dbb('0x59')]({'where':{'id':_0x4d5841[_0x6dbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c54ce,null))[_0x6dbb('0x1e')](function(_0x1e6c72){if(_0x1e6c72){return _0x1e6c72[_0x6dbb('0x6e')](_0x4d5841['body']['ids'],_[_0x6dbb('0x6f')](_0x4d5841[_0x6dbb('0x5b')],[_0x6dbb('0x66'),'id'])||{});}})['then'](respondWithResult(_0x2c54ce,null))['catch'](handleError(_0x2c54ce,null));};exports[_0x6dbb('0x70')]=function(_0x4f25bf,_0x141db0,_0xce0362){var _0x327fd3={'raw':![],'where':{}};var _0x3a6429={};var _0x5f1edd={'count':0x0,'rows':[]};return db[_0x6dbb('0x3b')][_0x6dbb('0x6a')]({'where':{'id':_0x4f25bf[_0x6dbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x141db0,null))[_0x6dbb('0x1e')](function(_0x3b56fa){if(_0x3b56fa){_0x3a6429[_0x6dbb('0x40')]=_[_0x6dbb('0x43')](db[_0x6dbb('0x71')]['rawAttributes']);_0x3a6429[_0x6dbb('0x42')]=_[_0x6dbb('0x43')](_0x4f25bf[_0x6dbb('0x42')]);_0x3a6429['filters']=_[_0x6dbb('0x45')](_0x3a6429['model'],_0x3a6429[_0x6dbb('0x42')]);_0x327fd3[_0x6dbb('0x46')]=_[_0x6dbb('0x45')](_0x3a6429['model'],qs[_0x6dbb('0x58')](_0x4f25bf['query'][_0x6dbb('0x58')]));_0x327fd3['attributes']=_0x327fd3[_0x6dbb('0x46')]['length']?_0x327fd3[_0x6dbb('0x46')]:_0x3a6429['model'];if(!_0x4f25bf['query'][_0x6dbb('0x48')](_0x6dbb('0x49'))){_0x327fd3['limit']=qs[_0x6dbb('0x2d')](_0x4f25bf[_0x6dbb('0x42')][_0x6dbb('0x2d')]);_0x327fd3[_0x6dbb('0x2a')]=qs['offset'](_0x4f25bf[_0x6dbb('0x42')][_0x6dbb('0x2a')]);}_0x327fd3['order']=qs[_0x6dbb('0x4a')](_0x4f25bf['query'][_0x6dbb('0x4a')]);_0x327fd3['where']=qs[_0x6dbb('0x44')](_[_0x6dbb('0x4c')](_0x4f25bf[_0x6dbb('0x42')],_0x3a6429[_0x6dbb('0x44')]));_0x327fd3[_0x6dbb('0x4b')][_0x6dbb('0x62')]=_0x3b56fa['id'];if(_0x4f25bf[_0x6dbb('0x42')]['filter']){_0x327fd3[_0x6dbb('0x4b')]=_[_0x6dbb('0x4d')](_0x327fd3[_0x6dbb('0x4b')],{'$or':_[_0x6dbb('0x41')](_0x327fd3['attributes'],function(_0x38a37c){var _0x2bc201={};_0x2bc201[_0x38a37c]={'$like':'%'+_0x4f25bf[_0x6dbb('0x42')][_0x6dbb('0x4f')]+'%'};return _0x2bc201;})});}_0x327fd3=_[_0x6dbb('0x4d')]({},_0x327fd3,_0x4f25bf[_0x6dbb('0x50')]);return db[_0x6dbb('0x71')]['count']({'where':_0x327fd3[_0x6dbb('0x4b')]})[_0x6dbb('0x1e')](function(_0x22fa53){_0x5f1edd['count']=_0x22fa53;if(_0x4f25bf['query']['includeAll']){_0x327fd3['include']=[{'model':db[_0x6dbb('0x72')],'as':_0x6dbb('0x73'),'required':![]},{'model':db[_0x6dbb('0x74')],'as':_0x6dbb('0x75'),'attributes':[_0x6dbb('0x37'),_0x6dbb('0x76'),_0x6dbb('0x77')],'required':![]},{'model':db[_0x6dbb('0x78')],'as':_0x6dbb('0x79'),'attributes':['id','name',_0x6dbb('0x7a')],'where':_0x4f25bf[_0x6dbb('0x42')][_0x6dbb('0x7b')]?{'id':_0x4f25bf['query'][_0x6dbb('0x7b')]}:undefined,'required':_0x4f25bf[_0x6dbb('0x42')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x6dbb('0x52')](_0x327fd3);})[_0x6dbb('0x1e')](function(_0x3d04d0){_0x5f1edd[_0x6dbb('0x53')]=_0x3d04d0;return _0x5f1edd;});}})[_0x6dbb('0x1e')](respondWithFilteredResult(_0x141db0,_0x327fd3))[_0x6dbb('0x54')](handleError(_0x141db0,null));};exports[_0x6dbb('0x7c')]=function(_0x273b05,_0x26c2fc,_0x524d53){return db[_0x6dbb('0x3b')]['findOne']({'where':{'id':_0x273b05[_0x6dbb('0x56')]['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x26c2fc,null))[_0x6dbb('0x1e')](function(_0x1fa6d8){if(_0x1fa6d8){return db[_0x6dbb('0x7d')][_0x6dbb('0x7e')](function(_0x259e9d){return db[_0x6dbb('0x7f')][_0x6dbb('0x32')]({'where':{'FaxAccountId':_0x273b05[_0x6dbb('0x56')]['id']},'transaction':_0x259e9d})[_0x6dbb('0x1e')](function(_0x3bdc49){var _0x3b3364=_[_0x6dbb('0x41')](_0x273b05[_0x6dbb('0x5b')],function(_0x3ce8ff){_0x3ce8ff[_0x6dbb('0x62')]=_0x273b05['params']['id'];return _0x3ce8ff;});return db[_0x6dbb('0x7f')][_0x6dbb('0x80')](_0x3b3364,{'transaction':_0x259e9d});});})[_0x6dbb('0x1e')](function(){return db[_0x6dbb('0x7f')][_0x6dbb('0x81')]({'where':{'FaxAccountId':_0x273b05['params']['id']},'order':_0x6dbb('0x82')});});}})[_0x6dbb('0x1e')](respondWithResult(_0x26c2fc,null))[_0x6dbb('0x54')](handleError(_0x26c2fc,null));};exports[_0x6dbb('0x83')]=function(_0x48ff4c,_0x280160,_0x34ac6a){var _0x5ecaef={};var _0x46d9e8={};var _0x723504;var _0x37f59c;return db[_0x6dbb('0x3b')][_0x6dbb('0x6a')]({'where':{'id':_0x48ff4c[_0x6dbb('0x56')]['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x280160,null))[_0x6dbb('0x1e')](function(_0x1b076d){if(_0x1b076d){_0x723504=_0x1b076d;_0x46d9e8[_0x6dbb('0x40')]=_[_0x6dbb('0x43')](db[_0x6dbb('0x7f')][_0x6dbb('0x3c')]);_0x46d9e8[_0x6dbb('0x42')]=_[_0x6dbb('0x43')](_0x48ff4c[_0x6dbb('0x42')]);_0x46d9e8['filters']=_[_0x6dbb('0x45')](_0x46d9e8[_0x6dbb('0x40')],_0x46d9e8['query']);_0x5ecaef[_0x6dbb('0x46')]=_[_0x6dbb('0x45')](_0x46d9e8[_0x6dbb('0x40')],qs[_0x6dbb('0x58')](_0x48ff4c['query'][_0x6dbb('0x58')]));_0x5ecaef['attributes']=_0x5ecaef['attributes'][_0x6dbb('0x47')]?_0x5ecaef['attributes']:_0x46d9e8['model'];_0x5ecaef[_0x6dbb('0x6b')]=qs[_0x6dbb('0x4a')](_0x48ff4c[_0x6dbb('0x42')][_0x6dbb('0x4a')]);_0x5ecaef[_0x6dbb('0x4b')]=qs['filters'](_[_0x6dbb('0x4c')](_0x48ff4c[_0x6dbb('0x42')],_0x46d9e8[_0x6dbb('0x44')]));if(_0x48ff4c[_0x6dbb('0x42')]['filter']){_0x5ecaef[_0x6dbb('0x4b')]=_['merge'](_0x5ecaef[_0x6dbb('0x4b')],{'$or':_['map'](_0x5ecaef['attributes'],function(_0x8387b7){var _0x8684f8={};_0x8684f8[_0x8387b7]={'$like':'%'+_0x48ff4c['query']['filter']+'%'};return _0x8684f8;})});}_0x5ecaef=_[_0x6dbb('0x4d')]({},_0x5ecaef,_0x48ff4c[_0x6dbb('0x50')]);return _0x723504[_0x6dbb('0x83')](_0x5ecaef);}})[_0x6dbb('0x1e')](function(_0x406804){if(_0x406804){_0x37f59c=_0x406804['length'];if(!_0x48ff4c[_0x6dbb('0x42')][_0x6dbb('0x48')](_0x6dbb('0x49'))){_0x5ecaef[_0x6dbb('0x2d')]=qs['limit'](_0x48ff4c[_0x6dbb('0x42')]['limit']);_0x5ecaef[_0x6dbb('0x2a')]=qs['offset'](_0x48ff4c[_0x6dbb('0x42')][_0x6dbb('0x2a')]);}return _0x723504[_0x6dbb('0x83')](_0x5ecaef);}})[_0x6dbb('0x1e')](function(_0x4c244e){if(_0x4c244e){return _0x4c244e?{'count':_0x37f59c,'rows':_0x4c244e}:null;}})[_0x6dbb('0x1e')](respondWithResult(_0x280160,null))[_0x6dbb('0x54')](handleError(_0x280160,null));};function Extension(_0x1d836d,_0x3ae627,_0x270bbc,_0x3eb230){this['context']=_0x6dbb('0x84');this[_0x6dbb('0x85')]=_0x1d836d[_0x6dbb('0x86')];this[_0x6dbb('0x87')]=_0x3eb230;this[_0x6dbb('0x3e')]=_0x6dbb('0x88');this['description']=_0x6dbb('0x89');this[_0x6dbb('0x62')]=_0x1d836d['id'];this[_0x6dbb('0x82')]=_0x3ae627;this[_0x6dbb('0x8a')]=_0x270bbc;}function createExtensionsReciveFax(_0x23324a){var _0x42d1a9=0x1;var _0x248e94=[];_0x248e94['push'](new Extension(_0x23324a,_0x42d1a9,'',_0x6dbb('0x8b')));_0x42d1a9+=0x1;_0x248e94[_0x6dbb('0x8c')](new Extension(_0x23324a,_0x42d1a9,_0x6dbb('0x8d'),_0x6dbb('0x8e')));_0x42d1a9+=0x1;for(var _0x20478b in _0x23324a){if(_0x23324a['hasOwnProperty'](_0x20478b)&&(_0x20478b===_0x6dbb('0x8f')||_0x20478b===_0x6dbb('0x86')||_0x20478b===_0x6dbb('0x90')||_0x20478b===_0x6dbb('0x91')||_0x20478b==='headerinfo'||_0x20478b===_0x6dbb('0x92')||_0x20478b===_0x6dbb('0x93')||_0x20478b==='modem'||_0x20478b===_0x6dbb('0x94'))){_0x248e94[_0x6dbb('0x8c')](new Extension(_0x23324a,_0x42d1a9,_0x6dbb('0x95')+_0x20478b+')='+_0x23324a[_0x20478b],_0x6dbb('0x8e')));_0x42d1a9+=0x1;}}_0x248e94['push'](new Extension(_0x23324a,_0x42d1a9,'6','Wait'));_0x42d1a9+=0x1;_0x248e94[_0x6dbb('0x8c')](new Extension(_0x23324a,_0x42d1a9,_0x6dbb('0x96'),_0x6dbb('0x97')));_0x42d1a9=0x0;return _0x248e94;}exports['addAccountApplications']=function(_0x575e09,_0xe6f6d5,_0xa7910a){var _0x229b9a;return db[_0x6dbb('0x7d')][_0x6dbb('0x7e')](function(_0x19ae29){return db[_0x6dbb('0x3b')][_0x6dbb('0x5a')](_0x575e09[_0x6dbb('0x5b')],{'transaction':_0x19ae29})['then'](function(_0x4dadfe){_0x229b9a=_0x4dadfe['get']({'plain':!![]});return db['VoiceExtension'][_0x6dbb('0x80')](createExtensionsReciveFax(_0x229b9a),{'transaction':_0x19ae29});});})[_0x6dbb('0x1e')](function(){return _0x229b9a;})[_0x6dbb('0x1e')](respondWithResult(_0xe6f6d5,null))['catch'](handleError(_0xe6f6d5,null));};exports[_0x6dbb('0x98')]=function(_0x15b54a,_0x551d92,_0x26e4e9){var _0x49d6c4;return db[_0x6dbb('0x7d')]['transaction'](function(_0x278119){return db['FaxAccount']['update'](_0x15b54a['body'],{'where':{'id':_0x15b54a[_0x6dbb('0x5b')]['id']},'transaction':_0x278119})['then'](function(_0x13b0c5){return db[_0x6dbb('0x99')][_0x6dbb('0x32')]({'where':{'FaxAccountId':_0x15b54a[_0x6dbb('0x5b')]['id']},'transaction':_0x278119})['then'](function(_0x55ec02){return db[_0x6dbb('0x99')]['bulkCreate'](createExtensionsReciveFax(_[_0x6dbb('0x6f')](_0x15b54a[_0x6dbb('0x5b')],[_0x6dbb('0x9a'),_0x6dbb('0x3f'),_0x6dbb('0x9b'),_0x6dbb('0x9c'),_0x6dbb('0x9d'),'ListId'])),{'transaction':_0x278119});});});})[_0x6dbb('0x1e')](function(){return db[_0x6dbb('0x3b')][_0x6dbb('0x9e')](_0x15b54a['body']['id']);})[_0x6dbb('0x1e')](respondWithResult(_0x551d92,null))[_0x6dbb('0x54')](handleError(_0x551d92,null));};exports[_0x6dbb('0x9f')]=function(_0x50d79d,_0x5aae93,_0x47020e){var _0x5c708a={'raw':!![],'where':{}};var _0x3b25c0={};var _0x20a184={'count':0x0,'rows':[]};return db[_0x6dbb('0x3b')][_0x6dbb('0x6a')]({'where':{'id':_0x50d79d[_0x6dbb('0x56')]['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x5aae93,null))[_0x6dbb('0x1e')](function(_0x3b8f87){if(_0x3b8f87){_0x3b25c0[_0x6dbb('0x40')]=_['keys'](db[_0x6dbb('0xa0')][_0x6dbb('0x3c')]);_0x3b25c0[_0x6dbb('0x42')]=_['keys'](_0x50d79d[_0x6dbb('0x42')]);_0x3b25c0['filters']=_['intersection'](_0x3b25c0['model'],_0x3b25c0['query']);_0x5c708a['attributes']=_['intersection'](_0x3b25c0[_0x6dbb('0x40')],qs[_0x6dbb('0x58')](_0x50d79d[_0x6dbb('0x42')][_0x6dbb('0x58')]));_0x5c708a[_0x6dbb('0x46')]=_0x5c708a['attributes'][_0x6dbb('0x47')]?_0x5c708a[_0x6dbb('0x46')]:_0x3b25c0['model'];if(!_0x50d79d['query'][_0x6dbb('0x48')](_0x6dbb('0x49'))){_0x5c708a[_0x6dbb('0x2d')]=qs[_0x6dbb('0x2d')](_0x50d79d[_0x6dbb('0x42')][_0x6dbb('0x2d')]);_0x5c708a[_0x6dbb('0x2a')]=qs['offset'](_0x50d79d[_0x6dbb('0x42')]['offset']);}_0x5c708a[_0x6dbb('0x6b')]=qs['sort'](_0x50d79d[_0x6dbb('0x42')][_0x6dbb('0x4a')]);_0x5c708a[_0x6dbb('0x4b')]=qs[_0x6dbb('0x44')](_['pick'](_0x50d79d[_0x6dbb('0x42')],_0x3b25c0[_0x6dbb('0x44')]));_0x5c708a[_0x6dbb('0x4b')][_0x6dbb('0x62')]=_0x3b8f87['id'];if(_0x50d79d[_0x6dbb('0x42')]['filter']){_0x5c708a[_0x6dbb('0x4b')]=_[_0x6dbb('0x4d')](_0x5c708a[_0x6dbb('0x4b')],{'$or':_[_0x6dbb('0x41')](_0x5c708a[_0x6dbb('0x46')],function(_0x4f96e6){var _0x249409={};_0x249409[_0x4f96e6]={'$like':'%'+_0x50d79d[_0x6dbb('0x42')]['filter']+'%'};return _0x249409;})});}if(_0x50d79d[_0x6dbb('0x42')]['$gte']){var _0x225ce8=_0x50d79d[_0x6dbb('0x42')][_0x6dbb('0xa1')]['split'](',');var _0x14ffb5={};_0x14ffb5[_0x225ce8[0x0]]={'$gte':moment(_0x225ce8[0x1])[_0x6dbb('0xa2')](_0x6dbb('0xa3'))};_0x5c708a['where']=_[_0x6dbb('0x4d')](_0x5c708a['where'],_0x14ffb5);}_0x5c708a=_[_0x6dbb('0x4d')]({},_0x5c708a,_0x50d79d[_0x6dbb('0x50')]);return db['FaxMessage'][_0x6dbb('0x2c')]({'where':_0x5c708a[_0x6dbb('0x4b')]})[_0x6dbb('0x1e')](function(_0x345a39){_0x20a184[_0x6dbb('0x2c')]=_0x345a39;if(_0x50d79d[_0x6dbb('0x42')]['includeAll']){_0x5c708a[_0x6dbb('0x51')]=[{'all':!![]}];}return db[_0x6dbb('0xa0')][_0x6dbb('0x52')](_0x5c708a);})['then'](function(_0x411fcd){_0x20a184[_0x6dbb('0x53')]=_0x411fcd;return _0x20a184;});}})['then'](respondWithFilteredResult(_0x5aae93,_0x5c708a))[_0x6dbb('0x54')](handleError(_0x5aae93,null));};exports[_0x6dbb('0x38')]=function(_0x47f4f2,_0x23a206,_0x4b703a){var _0x29e358,_0x2cdd6b={},_0x271d41;if(_0x47f4f2['body']['to']){_0x271d41=_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x47f4f2[_0x6dbb('0x56')]['id']},'include':[{'model':db[_0x6dbb('0xa4')],'as':_0x6dbb('0xa5'),'include':[{'model':db[_0x6dbb('0x72')],'as':'Contacts','where':{'fax':_0x271d41},'limit':0x1,'order':[[_0x6dbb('0x9c'),'DESC']]}]}]})[_0x6dbb('0x1e')](handleEntityNotFound(_0x23a206,null))[_0x6dbb('0x1e')](function(_0x1e5225){_0x29e358=_0x1e5225;if(_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')]&&_0x47f4f2[_0x6dbb('0x5b')]['attachments'][_0x6dbb('0x47')]){for(var _0x202ec3=0x0;_0x202ec3<_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][_0x6dbb('0x47')];_0x202ec3+=0x1){_0x47f4f2['body'][_0x6dbb('0xa6')][_0x202ec3]={'filename':_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][_0x202ec3][_0x6dbb('0x37')],'id':_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][_0x202ec3]['id'],'path':path['join'](config[_0x6dbb('0xa7')],_0x6dbb('0xa8'),_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][_0x202ec3][_0x6dbb('0xa9')])};}}return respondWithRpcPromise(_0x6dbb('0xaa'),_0x6dbb('0xaa'),{'FaxAccountId':_[_0x6dbb('0xab')](_0x47f4f2[_0x6dbb('0x56')]['id'])?undefined:_0x47f4f2['params']['id'],'path':_[_0x6dbb('0xab')](_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][0x0]['path'])?undefined:_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][0x0][_0x6dbb('0x8')],'fax':_['isNil'](_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0])?undefined:_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0]},client9002);})[_0x6dbb('0x1e')](function(){if(_0x29e358){if(_[_0x6dbb('0xab')](_0x47f4f2['body'][_0x6dbb('0xac')])){_0x47f4f2[_0x6dbb('0x5b')]['from']=util['format'](_0x6dbb('0xad'),_0x29e358['name'],_0x29e358[_0x6dbb('0xae')]);}if(_0x29e358[_0x6dbb('0xa5')]){if(_0x29e358[_0x6dbb('0xa5')][_0x6dbb('0xaf')][_0x6dbb('0x47')]){return _0x29e358[_0x6dbb('0xa5')][_0x6dbb('0xaf')][0x0];}else{return db[_0x6dbb('0x72')]['create'](_[_0x6dbb('0xb0')](_0x47f4f2[_0x6dbb('0x5b')],{'firstName':_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0],'phone':_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0],'fax':_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0],'ListId':_0x29e358[_0x6dbb('0xb1')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x6dbb('0xb2'));}})[_0x6dbb('0x1e')](function(_0x35e770){if(_0x35e770){return db[_0x6dbb('0x71')][_0x6dbb('0x59')]({'where':{'ContactId':_0x35e770['id'],'closed':![],'FaxAccountId':_0x29e358['id']}})[_0x6dbb('0x1e')](function(_0x17d1f2){if(_0x17d1f2){return[_0x17d1f2,![]];}return db[_0x6dbb('0x71')][_0x6dbb('0x5a')]({'UserId':_0x47f4f2[_0x6dbb('0x5c')]['id'],'ContactId':_0x35e770['id'],'FaxAccountId':_0x29e358['id'],'fax':_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0],'firstMsgDirection':_0x6dbb('0xb3'),'Messages':[_[_0x6dbb('0x4d')](_0x47f4f2['body'],{'read':![],'body':_0x47f4f2['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x29e358['id'],'UserId':_0x47f4f2[_0x6dbb('0x5c')]['id'],'ContactId':_0x35e770['id'],'AttachmentId':_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x6dbb('0xa0')],'as':_0x6dbb('0xb4')}]})[_0x6dbb('0x1e')](function(_0x18eb00){return[_0x18eb00,!![]];});});}else{throw new Error(_0x6dbb('0xb5'));}})[_0x6dbb('0xb6')](function(_0x35b101,_0x5a2882){if(_0x5a2882){return _0x35b101;}return db[_0x6dbb('0xa0')][_0x6dbb('0x5a')]({'direction':_0x6dbb('0xb3'),'read':![],'body':_0x47f4f2['body'][_0x6dbb('0xa6')][0x0]['filename'],'FaxAccountId':_0x29e358['id'],'FaxInteractionId':_0x35b101['id'],'UserId':_0x47f4f2['user']['id'],'ContactId':_0x35b101['ContactId'],'AttachmentId':_0x47f4f2[_0x6dbb('0x5b')]['attachments'][0x0]['id']})[_0x6dbb('0x1e')](function(_0x1b6813){_0x35b101[_0x6dbb('0xb7')][_0x6dbb('0xb4')]=[];_0x35b101[_0x6dbb('0xb7')][_0x6dbb('0xb4')][_0x6dbb('0x8c')](_0x1b6813[_0x6dbb('0xb7')]);return _0x35b101;});})[_0x6dbb('0x1e')](function(_0x2bfeb1){respondWithRpcPromise('SendFax',_0x6dbb('0xb8'),{'FaxAccountId':_[_0x6dbb('0xab')](_0x47f4f2['params']['id'])?undefined:_0x47f4f2[_0x6dbb('0x56')]['id'],'path':_['isNil'](_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][0x0]['path'])?undefined:_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][0x0][_0x6dbb('0x8')],'fax':_[_0x6dbb('0xab')](_0x47f4f2['body']['to'][0x0])?undefined:_0x47f4f2[_0x6dbb('0x5b')]['to'][0x0],'AttachmentId':_0x47f4f2[_0x6dbb('0x5b')][_0x6dbb('0xa6')][0x0]['id']},client9002)['then'](function(_0x3dfaf3){logger[_0x6dbb('0x26')]('SendFaxRpc,\x20%s',_0x3dfaf3);})[_0x6dbb('0x54')](function(_0x3cccfe){logger['info'](_0x6dbb('0xb9'),_0x3cccfe);});return _0x2bfeb1;})['then'](respondWithResult(_0x23a206,null))['catch'](handleError(_0x23a206,null));};exports['addAgents']=function(_0x1fe456,_0x272cc2,_0x51c4df){return db[_0x6dbb('0x3b')][_0x6dbb('0x59')]({'where':{'id':_0x1fe456[_0x6dbb('0x56')]['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x272cc2,null))['then'](function(_0x469f9e){if(_0x469f9e){return _0x469f9e['addAgents'](_0x1fe456[_0x6dbb('0x5b')][_0x6dbb('0x66')],_['omit'](_0x1fe456['body'],[_0x6dbb('0x66'),'id'])||{})[_0x6dbb('0xb6')](function(_0xce3b16){for(var _0x4904df=0x0;_0x4904df<_0x1fe456[_0x6dbb('0x5b')][_0x6dbb('0x66')][_0x6dbb('0x47')];_0x4904df+=0x1){socket['emit'](_0x6dbb('0xba'),{'UserId':Number(_0x1fe456['body'][_0x6dbb('0x66')][_0x4904df]),'FaxAccountId':Number(_0x1fe456[_0x6dbb('0x56')]['id'])});}return _0xce3b16;});}})['then'](respondWithResult(_0x272cc2,null))[_0x6dbb('0x54')](handleError(_0x272cc2,null));};exports['removeAgents']=function(_0x2f9e15,_0x57209a,_0x2d2128){return db['FaxAccount']['find']({'where':{'id':_0x2f9e15[_0x6dbb('0x56')]['id']}})[_0x6dbb('0x1e')](handleEntityNotFound(_0x57209a,null))[_0x6dbb('0x1e')](function(_0x3039da){if(_0x3039da){return _0x3039da['removeAgents'](_0x2f9e15[_0x6dbb('0x42')][_0x6dbb('0x66')])[_0x6dbb('0x1e')](function(){if(_[_0x6dbb('0xbb')](_0x2f9e15[_0x6dbb('0x42')]['ids'])){for(var _0x580dac=0x0;_0x580dac<_0x2f9e15[_0x6dbb('0x42')]['ids'][_0x6dbb('0x47')];_0x580dac+=0x1){socket[_0x6dbb('0xbc')](_0x6dbb('0xbd'),{'UserId':Number(_0x2f9e15[_0x6dbb('0x42')][_0x6dbb('0x66')][_0x580dac]),'FaxAccountId':Number(_0x2f9e15['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2f9e15[_0x6dbb('0x42')]['ids']),'FaxAccountId':Number(_0x2f9e15[_0x6dbb('0x56')]['id'])});}});}})[_0x6dbb('0x1e')](respondWithStatusCode(_0x57209a,null))[_0x6dbb('0x54')](handleError(_0x57209a,null));};exports[_0x6dbb('0xbe')]=function(_0xdfc2b8,_0x42f9fb,_0x2cbeda){var _0x55d0cd={};var _0x509005={};var _0x12937c;var _0x183bb3;return db[_0x6dbb('0x3b')][_0x6dbb('0x6a')]({'where':{'id':_0xdfc2b8[_0x6dbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x42f9fb,null))[_0x6dbb('0x1e')](function(_0x4ff5b7){if(_0x4ff5b7){_0x12937c=_0x4ff5b7;_0x509005[_0x6dbb('0x40')]=_[_0x6dbb('0x43')](db[_0x6dbb('0x74')]['rawAttributes']);_0x509005[_0x6dbb('0x42')]=_[_0x6dbb('0x43')](_0xdfc2b8['query']);_0x509005[_0x6dbb('0x44')]=_['intersection'](_0x509005[_0x6dbb('0x40')],_0x509005[_0x6dbb('0x42')]);_0x55d0cd[_0x6dbb('0x46')]=_['intersection'](_0x509005[_0x6dbb('0x40')],qs[_0x6dbb('0x58')](_0xdfc2b8[_0x6dbb('0x42')][_0x6dbb('0x58')]));_0x55d0cd[_0x6dbb('0x46')]=_0x55d0cd['attributes'][_0x6dbb('0x47')]?_0x55d0cd[_0x6dbb('0x46')]:_0x509005[_0x6dbb('0x40')];_0x55d0cd[_0x6dbb('0x6b')]=qs[_0x6dbb('0x4a')](_0xdfc2b8[_0x6dbb('0x42')][_0x6dbb('0x4a')]);_0x55d0cd[_0x6dbb('0x4b')]=qs[_0x6dbb('0x44')](_[_0x6dbb('0x4c')](_0xdfc2b8[_0x6dbb('0x42')],_0x509005[_0x6dbb('0x44')]));if(_0xdfc2b8['query'][_0x6dbb('0x4f')]){_0x55d0cd[_0x6dbb('0x4b')]=_[_0x6dbb('0x4d')](_0x55d0cd[_0x6dbb('0x4b')],{'$or':_['map'](_0x55d0cd[_0x6dbb('0x46')],function(_0x31674c){var _0x248f5e={};_0x248f5e[_0x31674c]={'$like':'%'+_0xdfc2b8['query'][_0x6dbb('0x4f')]+'%'};return _0x248f5e;})});}_0x55d0cd=_['merge']({},_0x55d0cd,_0xdfc2b8['options']);return _0x12937c[_0x6dbb('0xbe')](_0x55d0cd);}})[_0x6dbb('0x1e')](function(_0x25fbca){if(_0x25fbca){_0x183bb3=_0x25fbca[_0x6dbb('0x47')];if(!_0xdfc2b8[_0x6dbb('0x42')][_0x6dbb('0x48')](_0x6dbb('0x49'))){_0x55d0cd[_0x6dbb('0x2d')]=qs[_0x6dbb('0x2d')](_0xdfc2b8[_0x6dbb('0x42')]['limit']);_0x55d0cd[_0x6dbb('0x2a')]=qs['offset'](_0xdfc2b8[_0x6dbb('0x42')][_0x6dbb('0x2a')]);}return _0x12937c[_0x6dbb('0xbe')](_0x55d0cd);}})['then'](function(_0xa2052d){if(_0xa2052d){return _0xa2052d?{'count':_0x183bb3,'rows':_0xa2052d}:null;}})[_0x6dbb('0x1e')](respondWithResult(_0x42f9fb,null))[_0x6dbb('0x54')](handleError(_0x42f9fb,null));}; \ No newline at end of file +var _0xb3f9=['UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','description','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','findById','FaxMessage','split','CmList','List','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','Contacts','ListId','List\x20not\x20found','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','offset','count','set','json','destroy','get','FaxAccounts'];(function(_0x6105e8,_0x85369c){var _0x36328e=function(_0x517179){while(--_0x517179){_0x6105e8['push'](_0x6105e8['shift']());}};_0x36328e(++_0x85369c);}(_0xb3f9,0x148));var _0x9b3f=function(_0x1aabb3,_0x4ce0a4){_0x1aabb3=_0x1aabb3-0x0;var _0x3e8da9=_0xb3f9[_0x1aabb3];return _0x3e8da9;};'use strict';var emlformat=require(_0x9b3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b3f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b3f('0x2'));var moment=require(_0x9b3f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9b3f('0x4'));var util=require(_0x9b3f('0x5'));var path=require(_0x9b3f('0x6'));var sox=require(_0x9b3f('0x7'));var csv=require(_0x9b3f('0x8'));var ejs=require(_0x9b3f('0x9'));var fs=require('fs');var fs_extra=require(_0x9b3f('0xa'));var _=require(_0x9b3f('0xb'));var squel=require('squel');var crypto=require(_0x9b3f('0xc'));var jsforce=require(_0x9b3f('0xd'));var deskjs=require(_0x9b3f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9b3f('0xf'));var Papa=require(_0x9b3f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9b3f('0x11'));var as=require(_0x9b3f('0x12'));var hardwareService=require(_0x9b3f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9b3f('0x14'));var config=require(_0x9b3f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b3f('0x16'))['db'];config['redis']=_[_0x9b3f('0x17')](config[_0x9b3f('0x18')],{'host':_0x9b3f('0x19'),'port':0x18eb});var socket=require(_0x9b3f('0x1a'))(new Redis(config[_0x9b3f('0x18')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x9b3f('0x1b'));var client=jayson[_0x9b3f('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x9b3f('0x1c')][_0x9b3f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1af23c,_0x576dcb,_0x38a299,_0x5337ab){return new BPromise(function(_0x225ebd,_0x350e59){var _0x2f00b5=_0x5337ab||client;return _0x2f00b5['request'](_0x1af23c,_0x38a299)[_0x9b3f('0x1e')](function(_0x16f499){logger[_0x9b3f('0x1f')](_0x9b3f('0x20'),_0x576dcb,_0x9b3f('0x21'));logger['debug'](_0x9b3f('0x22'),_0x576dcb,_0x9b3f('0x21'),JSON['stringify'](_0x16f499));if(_0x16f499[_0x9b3f('0x23')]){if(_0x16f499[_0x9b3f('0x23')][_0x9b3f('0x24')]===0x1f4){logger[_0x9b3f('0x23')]('FaxAccount,\x20%s,\x20%s',_0x576dcb,_0x16f499[_0x9b3f('0x23')][_0x9b3f('0x25')]);return _0x350e59(_0x16f499[_0x9b3f('0x23')]['message']);}logger[_0x9b3f('0x23')]('FaxAccount,\x20%s,\x20%s',_0x576dcb,_0x16f499[_0x9b3f('0x23')][_0x9b3f('0x25')]);return _0x225ebd(_0x16f499[_0x9b3f('0x23')][_0x9b3f('0x25')]);}else{logger[_0x9b3f('0x1f')](_0x9b3f('0x20'),_0x576dcb,_0x9b3f('0x21'));_0x225ebd(_0x16f499[_0x9b3f('0x26')][_0x9b3f('0x25')]);}})['catch'](function(_0xc0926a){logger[_0x9b3f('0x23')](_0x9b3f('0x20'),_0x576dcb,_0xc0926a);_0x350e59(_0xc0926a);});});}function respondWithStatusCode(_0x3f719c,_0x2b887f){_0x2b887f=_0x2b887f||0xcc;return function(_0x3878b7){if(_0x3878b7){return _0x3f719c[_0x9b3f('0x27')](_0x2b887f);}return _0x3f719c[_0x9b3f('0x28')](_0x2b887f)['end']();};}function respondWithResult(_0xc39b49,_0x34e91a){_0x34e91a=_0x34e91a||0xc8;return function(_0x2df63e){if(_0x2df63e){return _0xc39b49[_0x9b3f('0x28')](_0x34e91a)['json'](_0x2df63e);}};}function respondWithFilteredResult(_0x4a89d6,_0x4a02f9){return function(_0x422670){if(_0x422670){var _0x44d43c=typeof _0x4a02f9[_0x9b3f('0x29')]==='undefined'&&typeof _0x4a02f9['limit']==='undefined';var _0x5a0839=_0x422670[_0x9b3f('0x2a')];var _0x48f6be=_0x44d43c?0x0:_0x4a02f9[_0x9b3f('0x29')];var _0x305aac=_0x44d43c?_0x422670[_0x9b3f('0x2a')]:_0x4a02f9[_0x9b3f('0x29')]+_0x4a02f9['limit'];var _0x22f102;if(_0x305aac>=_0x5a0839){_0x305aac=_0x5a0839;_0x22f102=0xc8;}else{_0x22f102=0xce;}_0x4a89d6[_0x9b3f('0x28')](_0x22f102);return _0x4a89d6[_0x9b3f('0x2b')]('Content-Range',_0x48f6be+'-'+_0x305aac+'/'+_0x5a0839)[_0x9b3f('0x2c')](_0x422670);}return null;};}function patchUpdates(_0x4ba21e){return function(_0x1a1316){try{jsonpatch['apply'](_0x1a1316,_0x4ba21e,!![]);}catch(_0x46e314){return BPromise['reject'](_0x46e314);}return _0x1a1316['save']();};}function saveUpdates(_0x4e9865,_0x2974b2){return function(_0x2b7315){if(_0x2b7315){return _0x2b7315['update'](_0x4e9865)['then'](function(_0x3249d3){return _0x3249d3;});}return null;};}function removeEntity(_0x1cade9,_0xf6a0c7){return function(_0x9fc4e7){if(_0x9fc4e7){return _0x9fc4e7[_0x9b3f('0x2d')]()['then'](function(){var _0x5f2ef9=_0x9fc4e7[_0x9b3f('0x2e')]({'plain':!![]});var _0x44fd98=_0x9b3f('0x2f');return db[_0x9b3f('0x30')]['destroy']({'where':{'type':_0x44fd98,'resourceId':_0x5f2ef9['id']}})['then'](function(){return _0x9fc4e7;});})[_0x9b3f('0x1e')](function(){_0x1cade9[_0x9b3f('0x28')](0xcc)[_0x9b3f('0x31')]();});}};}function handleEntityNotFound(_0x440ca1,_0x702eb5){return function(_0x28d5f8){if(!_0x28d5f8){_0x440ca1[_0x9b3f('0x27')](0x194);}return _0x28d5f8;};}function handleError(_0x5e2378,_0x5911c9){_0x5911c9=_0x5911c9||0x1f4;return function(_0xa02a7b){logger[_0x9b3f('0x23')](_0xa02a7b[_0x9b3f('0x32')]);if(_0xa02a7b['name']){delete _0xa02a7b[_0x9b3f('0x33')];}_0x5e2378[_0x9b3f('0x28')](_0x5911c9)[_0x9b3f('0x34')](_0xa02a7b);};}exports[_0x9b3f('0x35')]=function(_0x5de8e6,_0x113b2c){var _0x383aa6={'include':[{'model':db[_0x9b3f('0x36')],'as':_0x9b3f('0x37')}]},_0x3cca3d={},_0x2ff342={'count':0x0,'rows':[]};var _0x3fa86c=_['map'](db[_0x9b3f('0x38')][_0x9b3f('0x39')],function(_0x81341){return{'name':_0x81341[_0x9b3f('0x3a')],'type':_0x81341[_0x9b3f('0x3b')][_0x9b3f('0x3c')]};});_0x3cca3d['model']=_[_0x9b3f('0x3d')](_0x3fa86c,_0x9b3f('0x33'));_0x3cca3d[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x5de8e6['query']);_0x3cca3d['filters']=_[_0x9b3f('0x40')](_0x3cca3d[_0x9b3f('0x41')],_0x3cca3d[_0x9b3f('0x3e')]);_0x383aa6['attributes']=_[_0x9b3f('0x40')](_0x3cca3d[_0x9b3f('0x41')],qs[_0x9b3f('0x42')](_0x5de8e6[_0x9b3f('0x3e')][_0x9b3f('0x42')]));_0x383aa6[_0x9b3f('0x43')]=_0x383aa6['attributes'][_0x9b3f('0x44')]?_0x383aa6[_0x9b3f('0x43')]:_0x3cca3d['model'];if(!_0x5de8e6['query'][_0x9b3f('0x45')](_0x9b3f('0x46'))){_0x383aa6['limit']=qs[_0x9b3f('0x47')](_0x5de8e6[_0x9b3f('0x3e')][_0x9b3f('0x47')]);_0x383aa6[_0x9b3f('0x29')]=qs[_0x9b3f('0x29')](_0x5de8e6[_0x9b3f('0x3e')]['offset']);}_0x383aa6[_0x9b3f('0x48')]=qs[_0x9b3f('0x49')](_0x5de8e6[_0x9b3f('0x3e')][_0x9b3f('0x49')]);_0x383aa6[_0x9b3f('0x4a')]=qs[_0x9b3f('0x4b')](_[_0x9b3f('0x4c')](_0x5de8e6[_0x9b3f('0x3e')],_0x3cca3d['filters']),_0x3fa86c);if(_0x5de8e6[_0x9b3f('0x3e')]['filter']){_0x383aa6[_0x9b3f('0x4a')]=_[_0x9b3f('0x4d')](_0x383aa6[_0x9b3f('0x4a')],{'$or':_['map'](_0x3fa86c,function(_0x3aea69){if(_0x3aea69['type']!==_0x9b3f('0x4e')){var _0x2e1dda={};_0x2e1dda[_0x3aea69[_0x9b3f('0x33')]]={'$like':'%'+_0x5de8e6[_0x9b3f('0x3e')][_0x9b3f('0x4f')]+'%'};return _0x2e1dda;}})});}_0x383aa6=_['merge']({},_0x383aa6,_0x5de8e6[_0x9b3f('0x50')]);var _0x15a55e={'where':_0x383aa6['where']};return db[_0x9b3f('0x38')]['count'](_0x15a55e)[_0x9b3f('0x1e')](function(_0x5a02c6){_0x2ff342['count']=_0x5a02c6;if(_0x5de8e6['query'][_0x9b3f('0x51')]){_0x383aa6[_0x9b3f('0x52')]=[{'all':!![]}];}return db[_0x9b3f('0x38')][_0x9b3f('0x53')](_0x383aa6);})[_0x9b3f('0x1e')](function(_0x1818bd){_0x2ff342[_0x9b3f('0x54')]=_0x1818bd;return _0x2ff342;})[_0x9b3f('0x1e')](respondWithFilteredResult(_0x113b2c,_0x383aa6))[_0x9b3f('0x55')](handleError(_0x113b2c,null));};exports[_0x9b3f('0x56')]=function(_0x1f9f3d,_0x34e52f){var _0x42b77e={'raw':![],'where':{'id':_0x1f9f3d[_0x9b3f('0x57')]['id']},'include':[{'model':db[_0x9b3f('0x36')],'as':'mandatoryDispositionPause'}]},_0x3bad2b={};_0x3bad2b[_0x9b3f('0x41')]=_[_0x9b3f('0x3f')](db[_0x9b3f('0x38')][_0x9b3f('0x39')]);_0x3bad2b['query']=_[_0x9b3f('0x3f')](_0x1f9f3d[_0x9b3f('0x3e')]);_0x3bad2b[_0x9b3f('0x4b')]=_['intersection'](_0x3bad2b[_0x9b3f('0x41')],_0x3bad2b[_0x9b3f('0x3e')]);_0x42b77e['attributes']=_[_0x9b3f('0x40')](_0x3bad2b[_0x9b3f('0x41')],qs[_0x9b3f('0x42')](_0x1f9f3d[_0x9b3f('0x3e')][_0x9b3f('0x42')]));_0x42b77e[_0x9b3f('0x43')]=_0x42b77e['attributes']['length']?_0x42b77e[_0x9b3f('0x43')]:_0x3bad2b[_0x9b3f('0x41')];if(_0x1f9f3d[_0x9b3f('0x3e')]['includeAll']){_0x42b77e[_0x9b3f('0x52')]=[{'all':!![]}];}_0x42b77e=_[_0x9b3f('0x4d')]({},_0x42b77e,_0x1f9f3d[_0x9b3f('0x50')]);return db[_0x9b3f('0x38')][_0x9b3f('0x58')](_0x42b77e)['then'](handleEntityNotFound(_0x34e52f,null))[_0x9b3f('0x1e')](respondWithResult(_0x34e52f,null))[_0x9b3f('0x55')](handleError(_0x34e52f,null));};exports[_0x9b3f('0x59')]=function(_0x195ce7,_0x26d34a){return db['FaxAccount'][_0x9b3f('0x59')](_0x195ce7['body'],{})['then'](function(_0x2d1fd4){var _0x1b53c4=_0x195ce7['user'][_0x9b3f('0x2e')]({'plain':!![]});if(!_0x1b53c4)throw new Error(_0x9b3f('0x5a'));if(_0x1b53c4['role']===_0x9b3f('0x5b')){var _0x4fd820=_0x2d1fd4['get']({'plain':!![]});var _0x48bbbe=_0x9b3f('0x2f');return db[_0x9b3f('0x5c')][_0x9b3f('0x58')]({'where':{'name':_0x48bbbe,'userProfileId':_0x1b53c4[_0x9b3f('0x5d')]},'raw':!![]})[_0x9b3f('0x1e')](function(_0x467fb6){if(_0x467fb6&&_0x467fb6[_0x9b3f('0x5e')]===0x0){return db[_0x9b3f('0x30')][_0x9b3f('0x59')]({'name':_0x4fd820[_0x9b3f('0x33')],'resourceId':_0x4fd820['id'],'type':_0x467fb6['name'],'sectionId':_0x467fb6['id']},{})[_0x9b3f('0x1e')](function(){return _0x2d1fd4;});}else{return _0x2d1fd4;}})['catch'](function(_0x2a28e0){logger['error'](_0x9b3f('0x5f'),_0x2a28e0);throw _0x2a28e0;});}return _0x2d1fd4;})['then'](respondWithResult(_0x26d34a,0xc9))[_0x9b3f('0x55')](handleError(_0x26d34a,null));};exports['update']=function(_0x15ffce,_0x3212be){if(_0x15ffce[_0x9b3f('0x60')]['id']){delete _0x15ffce[_0x9b3f('0x60')]['id'];}return db['FaxAccount'][_0x9b3f('0x58')]({'where':{'id':_0x15ffce['params']['id']},'include':[{'model':db[_0x9b3f('0x36')],'as':'mandatoryDispositionPause'}]})[_0x9b3f('0x1e')](handleEntityNotFound(_0x3212be,null))[_0x9b3f('0x1e')](saveUpdates(_0x15ffce[_0x9b3f('0x60')],null))['then'](respondWithResult(_0x3212be,null))[_0x9b3f('0x55')](handleError(_0x3212be,null));};exports[_0x9b3f('0x2d')]=function(_0x1bf088,_0x5495c6){return db['FaxAccount'][_0x9b3f('0x58')]({'where':{'id':_0x1bf088[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x5495c6,null))['then'](removeEntity(_0x5495c6,null))[_0x9b3f('0x55')](handleError(_0x5495c6,null));};exports['describe']=function(_0x220d68,_0x180db9){return db[_0x9b3f('0x38')][_0x9b3f('0x61')]()[_0x9b3f('0x1e')](respondWithResult(_0x180db9,null))[_0x9b3f('0x55')](handleError(_0x180db9,null));};exports[_0x9b3f('0x62')]=function(_0xd230fb,_0x2940e7,_0x4fe23b){if(_0xd230fb[_0x9b3f('0x60')]['id']){delete _0xd230fb[_0x9b3f('0x60')]['id'];}return db[_0x9b3f('0x38')]['find']({'where':{'id':_0xd230fb[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x2940e7,null))[_0x9b3f('0x1e')](function(_0x59ba72){if(_0x59ba72){_0xd230fb[_0x9b3f('0x60')][_0x9b3f('0x63')]=_0x59ba72['id'];return db[_0x9b3f('0x64')]['create'](_0xd230fb[_0x9b3f('0x60')]);}})[_0x9b3f('0x1e')](respondWithResult(_0x2940e7,null))[_0x9b3f('0x55')](handleError(_0x2940e7,null));};exports[_0x9b3f('0x65')]=function(_0x4c7ddb,_0x393911,_0x5c0764){var _0x3cc0b3={'raw':![],'where':{}};var _0x4ff1a7={};var _0x38ea7f={'count':0x0,'rows':[]};return db[_0x9b3f('0x38')][_0x9b3f('0x66')]({'where':{'id':_0x4c7ddb['params']['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x393911,null))[_0x9b3f('0x1e')](function(_0x3186e3){if(_0x3186e3){_0x4ff1a7[_0x9b3f('0x41')]=_[_0x9b3f('0x3f')](db['Disposition'][_0x9b3f('0x39')]);_0x4ff1a7['query']=_[_0x9b3f('0x3f')](_0x4c7ddb[_0x9b3f('0x3e')]);_0x4ff1a7[_0x9b3f('0x4b')]=_['intersection'](_0x4ff1a7[_0x9b3f('0x41')],_0x4ff1a7[_0x9b3f('0x3e')]);_0x3cc0b3[_0x9b3f('0x43')]=_['intersection'](_0x4ff1a7[_0x9b3f('0x41')],qs['fields'](_0x4c7ddb['query']['fields']));_0x3cc0b3[_0x9b3f('0x43')]=_0x3cc0b3['attributes'][_0x9b3f('0x44')]?_0x3cc0b3['attributes']:_0x4ff1a7[_0x9b3f('0x41')];if(!_0x4c7ddb[_0x9b3f('0x3e')][_0x9b3f('0x45')](_0x9b3f('0x46'))){_0x3cc0b3[_0x9b3f('0x47')]=qs[_0x9b3f('0x47')](_0x4c7ddb[_0x9b3f('0x3e')][_0x9b3f('0x47')]);_0x3cc0b3['offset']=qs[_0x9b3f('0x29')](_0x4c7ddb[_0x9b3f('0x3e')][_0x9b3f('0x29')]);}_0x3cc0b3['order']=qs['sort'](_0x4c7ddb[_0x9b3f('0x3e')][_0x9b3f('0x49')]);_0x3cc0b3[_0x9b3f('0x4a')]=qs['filters'](_[_0x9b3f('0x4c')](_0x4c7ddb[_0x9b3f('0x3e')],_0x4ff1a7[_0x9b3f('0x4b')]));_0x3cc0b3[_0x9b3f('0x4a')]['FaxAccountId']=_0x3186e3['id'];if(_0x4c7ddb[_0x9b3f('0x3e')][_0x9b3f('0x4f')]){_0x3cc0b3['where']=_[_0x9b3f('0x4d')](_0x3cc0b3[_0x9b3f('0x4a')],{'$or':_[_0x9b3f('0x3d')](_0x3cc0b3[_0x9b3f('0x43')],function(_0x2d44da){var _0x2bb56c={};_0x2bb56c[_0x2d44da]={'$like':'%'+_0x4c7ddb[_0x9b3f('0x3e')]['filter']+'%'};return _0x2bb56c;})});}_0x3cc0b3=_[_0x9b3f('0x4d')]({},_0x3cc0b3,_0x4c7ddb[_0x9b3f('0x50')]);return db[_0x9b3f('0x64')][_0x9b3f('0x2a')]({'where':_0x3cc0b3[_0x9b3f('0x4a')]})['then'](function(_0x313d01){_0x38ea7f[_0x9b3f('0x2a')]=_0x313d01;if(_0x4c7ddb[_0x9b3f('0x3e')][_0x9b3f('0x51')]){_0x3cc0b3[_0x9b3f('0x52')]=[{'all':!![]}];}return db[_0x9b3f('0x64')][_0x9b3f('0x53')](_0x3cc0b3);})[_0x9b3f('0x1e')](function(_0x376d67){_0x38ea7f['rows']=_0x376d67;return _0x38ea7f;});}})['then'](respondWithFilteredResult(_0x393911,_0x3cc0b3))['catch'](handleError(_0x393911,null));};exports[_0x9b3f('0x67')]=function(_0x2abecc,_0x1d4732,_0x4ff537){return db['FaxAccount'][_0x9b3f('0x58')]({'where':{'id':_0x2abecc['params']['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x1d4732,null))[_0x9b3f('0x1e')](function(_0x565d42){if(_0x565d42){return _0x565d42['removeDispositions'](_0x2abecc[_0x9b3f('0x3e')]['ids']);}})[_0x9b3f('0x1e')](respondWithStatusCode(_0x1d4732,null))[_0x9b3f('0x55')](handleError(_0x1d4732,null));};exports['addAnswer']=function(_0x174758,_0x3e1f7d,_0x40ff2b){if(_0x174758[_0x9b3f('0x60')]['id']){delete _0x174758['body']['id'];}return db['FaxAccount'][_0x9b3f('0x58')]({'where':{'id':_0x174758[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x3e1f7d,null))['then'](function(_0x40e0dd){if(_0x40e0dd){_0x174758[_0x9b3f('0x60')][_0x9b3f('0x63')]=_0x40e0dd['id'];return db[_0x9b3f('0x68')][_0x9b3f('0x59')](_0x174758[_0x9b3f('0x60')]);}})[_0x9b3f('0x1e')](respondWithResult(_0x3e1f7d,null))[_0x9b3f('0x55')](handleError(_0x3e1f7d,null));};exports[_0x9b3f('0x69')]=function(_0x561219,_0x314e48,_0x143857){var _0x4dc63f={'raw':![],'where':{}};var _0x5f5c5e={};var _0x570310={'count':0x0,'rows':[]};return db[_0x9b3f('0x38')][_0x9b3f('0x66')]({'where':{'id':_0x561219[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x314e48,null))['then'](function(_0x396109){if(_0x396109){_0x5f5c5e['model']=_[_0x9b3f('0x3f')](db[_0x9b3f('0x68')][_0x9b3f('0x39')]);_0x5f5c5e[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x561219[_0x9b3f('0x3e')]);_0x5f5c5e[_0x9b3f('0x4b')]=_[_0x9b3f('0x40')](_0x5f5c5e[_0x9b3f('0x41')],_0x5f5c5e[_0x9b3f('0x3e')]);_0x4dc63f[_0x9b3f('0x43')]=_[_0x9b3f('0x40')](_0x5f5c5e[_0x9b3f('0x41')],qs['fields'](_0x561219[_0x9b3f('0x3e')][_0x9b3f('0x42')]));_0x4dc63f[_0x9b3f('0x43')]=_0x4dc63f[_0x9b3f('0x43')][_0x9b3f('0x44')]?_0x4dc63f[_0x9b3f('0x43')]:_0x5f5c5e[_0x9b3f('0x41')];if(!_0x561219[_0x9b3f('0x3e')][_0x9b3f('0x45')](_0x9b3f('0x46'))){_0x4dc63f[_0x9b3f('0x47')]=qs['limit'](_0x561219[_0x9b3f('0x3e')]['limit']);_0x4dc63f[_0x9b3f('0x29')]=qs[_0x9b3f('0x29')](_0x561219['query'][_0x9b3f('0x29')]);}_0x4dc63f[_0x9b3f('0x48')]=qs[_0x9b3f('0x49')](_0x561219[_0x9b3f('0x3e')][_0x9b3f('0x49')]);_0x4dc63f[_0x9b3f('0x4a')]=qs[_0x9b3f('0x4b')](_[_0x9b3f('0x4c')](_0x561219['query'],_0x5f5c5e[_0x9b3f('0x4b')]));_0x4dc63f['where']['FaxAccountId']=_0x396109['id'];if(_0x561219[_0x9b3f('0x3e')][_0x9b3f('0x4f')]){_0x4dc63f['where']=_['merge'](_0x4dc63f[_0x9b3f('0x4a')],{'$or':_['map'](_0x4dc63f['attributes'],function(_0x5c5452){var _0x5752bc={};_0x5752bc[_0x5c5452]={'$like':'%'+_0x561219['query'][_0x9b3f('0x4f')]+'%'};return _0x5752bc;})});}_0x4dc63f=_[_0x9b3f('0x4d')]({},_0x4dc63f,_0x561219[_0x9b3f('0x50')]);return db[_0x9b3f('0x68')][_0x9b3f('0x2a')]({'where':_0x4dc63f['where']})[_0x9b3f('0x1e')](function(_0xd1e1d3){_0x570310[_0x9b3f('0x2a')]=_0xd1e1d3;if(_0x561219[_0x9b3f('0x3e')][_0x9b3f('0x51')]){_0x4dc63f[_0x9b3f('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9b3f('0x53')](_0x4dc63f);})[_0x9b3f('0x1e')](function(_0x2967a3){_0x570310[_0x9b3f('0x54')]=_0x2967a3;return _0x570310;});}})[_0x9b3f('0x1e')](respondWithFilteredResult(_0x314e48,_0x4dc63f))[_0x9b3f('0x55')](handleError(_0x314e48,null));};exports[_0x9b3f('0x6a')]=function(_0x109fad,_0x6927b4,_0x3ddc24){return db['FaxAccount'][_0x9b3f('0x58')]({'where':{'id':_0x109fad[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x6927b4,null))[_0x9b3f('0x1e')](function(_0x4f2371){if(_0x4f2371){return _0x4f2371[_0x9b3f('0x6a')](_0x109fad[_0x9b3f('0x3e')][_0x9b3f('0x6b')]);}})[_0x9b3f('0x1e')](respondWithStatusCode(_0x6927b4,null))[_0x9b3f('0x55')](handleError(_0x6927b4,null));};exports['addInteraction']=function(_0x130234,_0xc1ac80,_0x47a5a4){return db[_0x9b3f('0x6c')][_0x9b3f('0x58')]({'where':{'id':_0x130234[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0xc1ac80,null))[_0x9b3f('0x1e')](function(_0x563485){if(_0x563485){return _0x563485[_0x9b3f('0x6d')](_0x130234['body'][_0x9b3f('0x6b')],_['omit'](_0x130234[_0x9b3f('0x60')],['ids','id'])||{});}})[_0x9b3f('0x1e')](respondWithResult(_0xc1ac80,null))[_0x9b3f('0x55')](handleError(_0xc1ac80,null));};exports[_0x9b3f('0x6e')]=function(_0x58f544,_0x70f05f,_0x3bb508){var _0x530e49={'raw':![],'where':{}};var _0x102f34={};var _0xeed4ec={'count':0x0,'rows':[]};return db[_0x9b3f('0x38')][_0x9b3f('0x66')]({'where':{'id':_0x58f544[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x70f05f,null))[_0x9b3f('0x1e')](function(_0x11a55a){if(_0x11a55a){_0x102f34[_0x9b3f('0x41')]=_[_0x9b3f('0x3f')](db[_0x9b3f('0x6c')][_0x9b3f('0x39')]);_0x102f34[_0x9b3f('0x3e')]=_['keys'](_0x58f544[_0x9b3f('0x3e')]);_0x102f34[_0x9b3f('0x4b')]=_[_0x9b3f('0x40')](_0x102f34['model'],_0x102f34['query']);_0x530e49[_0x9b3f('0x43')]=_[_0x9b3f('0x40')](_0x102f34[_0x9b3f('0x41')],qs[_0x9b3f('0x42')](_0x58f544[_0x9b3f('0x3e')]['fields']));_0x530e49[_0x9b3f('0x43')]=_0x530e49['attributes'][_0x9b3f('0x44')]?_0x530e49[_0x9b3f('0x43')]:_0x102f34[_0x9b3f('0x41')];if(!_0x58f544['query'][_0x9b3f('0x45')](_0x9b3f('0x46'))){_0x530e49[_0x9b3f('0x47')]=qs[_0x9b3f('0x47')](_0x58f544[_0x9b3f('0x3e')]['limit']);_0x530e49[_0x9b3f('0x29')]=qs[_0x9b3f('0x29')](_0x58f544[_0x9b3f('0x3e')][_0x9b3f('0x29')]);}_0x530e49['order']=qs[_0x9b3f('0x49')](_0x58f544[_0x9b3f('0x3e')][_0x9b3f('0x49')]);_0x530e49['where']=qs[_0x9b3f('0x4b')](_[_0x9b3f('0x4c')](_0x58f544[_0x9b3f('0x3e')],_0x102f34[_0x9b3f('0x4b')]));_0x530e49[_0x9b3f('0x4a')][_0x9b3f('0x63')]=_0x11a55a['id'];if(_0x58f544[_0x9b3f('0x3e')]['filter']){_0x530e49[_0x9b3f('0x4a')]=_[_0x9b3f('0x4d')](_0x530e49[_0x9b3f('0x4a')],{'$or':_[_0x9b3f('0x3d')](_0x530e49[_0x9b3f('0x43')],function(_0x5c6fa3){var _0x554313={};_0x554313[_0x5c6fa3]={'$like':'%'+_0x58f544['query'][_0x9b3f('0x4f')]+'%'};return _0x554313;})});}_0x530e49=_[_0x9b3f('0x4d')]({},_0x530e49,_0x58f544['options']);return db[_0x9b3f('0x6c')][_0x9b3f('0x2a')]({'where':_0x530e49[_0x9b3f('0x4a')]})[_0x9b3f('0x1e')](function(_0x1935e1){_0xeed4ec[_0x9b3f('0x2a')]=_0x1935e1;if(_0x58f544['query'][_0x9b3f('0x51')]){_0x530e49[_0x9b3f('0x52')]=[{'model':db[_0x9b3f('0x6f')],'as':_0x9b3f('0x70'),'required':![]},{'model':db[_0x9b3f('0x71')],'as':_0x9b3f('0x72'),'attributes':[_0x9b3f('0x33'),_0x9b3f('0x73'),_0x9b3f('0x74')],'required':![]},{'model':db[_0x9b3f('0x75')],'as':'Tags','attributes':['id',_0x9b3f('0x33'),_0x9b3f('0x76')],'where':_0x58f544['query']['tag']?{'id':_0x58f544['query'][_0x9b3f('0x77')]}:undefined,'required':_0x58f544[_0x9b3f('0x3e')]['tag']?!![]:![]}];}return db[_0x9b3f('0x6c')]['findAll'](_0x530e49);})[_0x9b3f('0x1e')](function(_0xcc0318){_0xeed4ec['rows']=_0xcc0318;return _0xeed4ec;});}})[_0x9b3f('0x1e')](respondWithFilteredResult(_0x70f05f,_0x530e49))[_0x9b3f('0x55')](handleError(_0x70f05f,null));};exports['addApplications']=function(_0x254f79,_0x1809e5,_0x272fb6){return db[_0x9b3f('0x38')][_0x9b3f('0x66')]({'where':{'id':_0x254f79['params']['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x1809e5,null))[_0x9b3f('0x1e')](function(_0x8362ae){if(_0x8362ae){return db['sequelize'][_0x9b3f('0x78')](function(_0x13e409){return db[_0x9b3f('0x79')][_0x9b3f('0x2d')]({'where':{'FaxAccountId':_0x254f79[_0x9b3f('0x57')]['id']},'transaction':_0x13e409})[_0x9b3f('0x1e')](function(_0x254ad2){var _0x11793d=_[_0x9b3f('0x3d')](_0x254f79[_0x9b3f('0x60')],function(_0x37d197){_0x37d197['FaxAccountId']=_0x254f79[_0x9b3f('0x57')]['id'];return _0x37d197;});return db[_0x9b3f('0x79')][_0x9b3f('0x7a')](_0x11793d,{'transaction':_0x13e409});});})[_0x9b3f('0x1e')](function(){return db[_0x9b3f('0x79')][_0x9b3f('0x7b')]({'where':{'FaxAccountId':_0x254f79[_0x9b3f('0x57')]['id']},'order':_0x9b3f('0x7c')});});}})[_0x9b3f('0x1e')](respondWithResult(_0x1809e5,null))[_0x9b3f('0x55')](handleError(_0x1809e5,null));};exports['getApplications']=function(_0x184385,_0xea92fc,_0x20132b){var _0x30b43d={};var _0x26bfd8={};var _0xf41841;var _0x363673;return db['FaxAccount'][_0x9b3f('0x66')]({'where':{'id':_0x184385[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0xea92fc,null))[_0x9b3f('0x1e')](function(_0x13cc9d){if(_0x13cc9d){_0xf41841=_0x13cc9d;_0x26bfd8['model']=_[_0x9b3f('0x3f')](db[_0x9b3f('0x79')]['rawAttributes']);_0x26bfd8[_0x9b3f('0x3e')]=_['keys'](_0x184385[_0x9b3f('0x3e')]);_0x26bfd8[_0x9b3f('0x4b')]=_[_0x9b3f('0x40')](_0x26bfd8[_0x9b3f('0x41')],_0x26bfd8[_0x9b3f('0x3e')]);_0x30b43d[_0x9b3f('0x43')]=_[_0x9b3f('0x40')](_0x26bfd8[_0x9b3f('0x41')],qs[_0x9b3f('0x42')](_0x184385[_0x9b3f('0x3e')][_0x9b3f('0x42')]));_0x30b43d[_0x9b3f('0x43')]=_0x30b43d[_0x9b3f('0x43')][_0x9b3f('0x44')]?_0x30b43d[_0x9b3f('0x43')]:_0x26bfd8[_0x9b3f('0x41')];_0x30b43d[_0x9b3f('0x48')]=qs[_0x9b3f('0x49')](_0x184385[_0x9b3f('0x3e')][_0x9b3f('0x49')]);_0x30b43d[_0x9b3f('0x4a')]=qs['filters'](_[_0x9b3f('0x4c')](_0x184385[_0x9b3f('0x3e')],_0x26bfd8[_0x9b3f('0x4b')]));if(_0x184385[_0x9b3f('0x3e')][_0x9b3f('0x4f')]){_0x30b43d['where']=_['merge'](_0x30b43d[_0x9b3f('0x4a')],{'$or':_['map'](_0x30b43d[_0x9b3f('0x43')],function(_0x43d652){var _0x28c3fa={};_0x28c3fa[_0x43d652]={'$like':'%'+_0x184385[_0x9b3f('0x3e')]['filter']+'%'};return _0x28c3fa;})});}_0x30b43d=_['merge']({},_0x30b43d,_0x184385[_0x9b3f('0x50')]);return _0xf41841[_0x9b3f('0x7d')](_0x30b43d);}})['then'](function(_0x47ec7d){if(_0x47ec7d){_0x363673=_0x47ec7d[_0x9b3f('0x44')];if(!_0x184385[_0x9b3f('0x3e')][_0x9b3f('0x45')]('nolimit')){_0x30b43d[_0x9b3f('0x47')]=qs[_0x9b3f('0x47')](_0x184385[_0x9b3f('0x3e')]['limit']);_0x30b43d['offset']=qs[_0x9b3f('0x29')](_0x184385[_0x9b3f('0x3e')][_0x9b3f('0x29')]);}return _0xf41841[_0x9b3f('0x7d')](_0x30b43d);}})[_0x9b3f('0x1e')](function(_0x4c8d6b){if(_0x4c8d6b){return _0x4c8d6b?{'count':_0x363673,'rows':_0x4c8d6b}:null;}})['then'](respondWithResult(_0xea92fc,null))['catch'](handleError(_0xea92fc,null));};function Extension(_0xf46ebe,_0x3e4a65,_0x264804,_0x5287b6){this[_0x9b3f('0x7e')]=_0x9b3f('0x7f');this[_0x9b3f('0x80')]=_0xf46ebe[_0x9b3f('0x81')];this[_0x9b3f('0x82')]=_0x5287b6;this[_0x9b3f('0x3b')]='system';this[_0x9b3f('0x83')]='Fax\x20Extension';this[_0x9b3f('0x63')]=_0xf46ebe['id'];this[_0x9b3f('0x7c')]=_0x3e4a65;this['appdata']=_0x264804;}function createExtensionsReciveFax(_0x565f29){var _0x2e8dd4=0x1;var _0x40d029=[];_0x40d029[_0x9b3f('0x84')](new Extension(_0x565f29,_0x2e8dd4,'',_0x9b3f('0x85')));_0x2e8dd4+=0x1;_0x40d029[_0x9b3f('0x84')](new Extension(_0x565f29,_0x2e8dd4,_0x9b3f('0x86'),_0x9b3f('0x87')));_0x2e8dd4+=0x1;for(var _0x4e1c38 in _0x565f29){if(_0x565f29['hasOwnProperty'](_0x4e1c38)&&(_0x4e1c38===_0x9b3f('0x88')||_0x4e1c38==='localstationid'||_0x4e1c38==='gateway'||_0x4e1c38===_0x9b3f('0x89')||_0x4e1c38==='headerinfo'||_0x4e1c38===_0x9b3f('0x8a')||_0x4e1c38===_0x9b3f('0x8b')||_0x4e1c38===_0x9b3f('0x8c')||_0x4e1c38===_0x9b3f('0x8d'))){_0x40d029[_0x9b3f('0x84')](new Extension(_0x565f29,_0x2e8dd4,_0x9b3f('0x8e')+_0x4e1c38+')='+_0x565f29[_0x4e1c38],'Set'));_0x2e8dd4+=0x1;}}_0x40d029[_0x9b3f('0x84')](new Extension(_0x565f29,_0x2e8dd4,'6',_0x9b3f('0x8f')));_0x2e8dd4+=0x1;_0x40d029[_0x9b3f('0x84')](new Extension(_0x565f29,_0x2e8dd4,_0x9b3f('0x90'),_0x9b3f('0x91')));_0x2e8dd4=0x0;return _0x40d029;}exports[_0x9b3f('0x92')]=function(_0x5861b1,_0x53324f,_0x5ee5c9){var _0x191d8b;return db[_0x9b3f('0x93')]['transaction'](function(_0x4b974b){return db['FaxAccount']['create'](_0x5861b1[_0x9b3f('0x60')],{'transaction':_0x4b974b})[_0x9b3f('0x1e')](function(_0x30b077){_0x191d8b=_0x30b077[_0x9b3f('0x2e')]({'plain':!![]});return db[_0x9b3f('0x94')][_0x9b3f('0x7a')](createExtensionsReciveFax(_0x191d8b),{'transaction':_0x4b974b});});})[_0x9b3f('0x1e')](function(){return _0x191d8b;})[_0x9b3f('0x1e')](respondWithResult(_0x53324f,null))['catch'](handleError(_0x53324f,null));};exports[_0x9b3f('0x95')]=function(_0x28398d,_0x2eaa1b,_0x294da0){var _0x5f2099;return db[_0x9b3f('0x93')]['transaction'](function(_0x4b4132){return db['FaxAccount']['update'](_0x28398d[_0x9b3f('0x60')],{'where':{'id':_0x28398d[_0x9b3f('0x60')]['id']},'transaction':_0x4b4132})[_0x9b3f('0x1e')](function(_0xa22def){return db[_0x9b3f('0x94')][_0x9b3f('0x2d')]({'where':{'FaxAccountId':_0x28398d['body']['id']},'transaction':_0x4b4132})['then'](function(_0x188449){return db[_0x9b3f('0x94')]['bulkCreate'](createExtensionsReciveFax(_[_0x9b3f('0x96')](_0x28398d['body'],[_0x9b3f('0x97'),_0x9b3f('0x3c'),_0x9b3f('0x98'),_0x9b3f('0x99'),'TrunkId','ListId'])),{'transaction':_0x4b4132});});});})[_0x9b3f('0x1e')](function(){return db['FaxAccount'][_0x9b3f('0x9a')](_0x28398d[_0x9b3f('0x60')]['id']);})[_0x9b3f('0x1e')](respondWithResult(_0x2eaa1b,null))[_0x9b3f('0x55')](handleError(_0x2eaa1b,null));};exports['getMessages']=function(_0x865e4a,_0x2c1b19,_0x2ee66e){var _0x2e91c0={'raw':!![],'where':{}};var _0x5dbdc8={};var _0x5b4a39={'count':0x0,'rows':[]};return db[_0x9b3f('0x38')][_0x9b3f('0x66')]({'where':{'id':_0x865e4a['params']['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x2c1b19,null))[_0x9b3f('0x1e')](function(_0x467324){if(_0x467324){_0x5dbdc8['model']=_[_0x9b3f('0x3f')](db[_0x9b3f('0x9b')][_0x9b3f('0x39')]);_0x5dbdc8[_0x9b3f('0x3e')]=_['keys'](_0x865e4a['query']);_0x5dbdc8[_0x9b3f('0x4b')]=_[_0x9b3f('0x40')](_0x5dbdc8['model'],_0x5dbdc8[_0x9b3f('0x3e')]);_0x2e91c0[_0x9b3f('0x43')]=_['intersection'](_0x5dbdc8[_0x9b3f('0x41')],qs[_0x9b3f('0x42')](_0x865e4a['query'][_0x9b3f('0x42')]));_0x2e91c0['attributes']=_0x2e91c0[_0x9b3f('0x43')][_0x9b3f('0x44')]?_0x2e91c0[_0x9b3f('0x43')]:_0x5dbdc8[_0x9b3f('0x41')];if(!_0x865e4a[_0x9b3f('0x3e')][_0x9b3f('0x45')]('nolimit')){_0x2e91c0['limit']=qs[_0x9b3f('0x47')](_0x865e4a[_0x9b3f('0x3e')][_0x9b3f('0x47')]);_0x2e91c0[_0x9b3f('0x29')]=qs[_0x9b3f('0x29')](_0x865e4a[_0x9b3f('0x3e')][_0x9b3f('0x29')]);}_0x2e91c0['order']=qs[_0x9b3f('0x49')](_0x865e4a['query'][_0x9b3f('0x49')]);_0x2e91c0[_0x9b3f('0x4a')]=qs[_0x9b3f('0x4b')](_[_0x9b3f('0x4c')](_0x865e4a['query'],_0x5dbdc8[_0x9b3f('0x4b')]));_0x2e91c0[_0x9b3f('0x4a')][_0x9b3f('0x63')]=_0x467324['id'];if(_0x865e4a[_0x9b3f('0x3e')][_0x9b3f('0x4f')]){_0x2e91c0[_0x9b3f('0x4a')]=_['merge'](_0x2e91c0[_0x9b3f('0x4a')],{'$or':_[_0x9b3f('0x3d')](_0x2e91c0['attributes'],function(_0x233e76){var _0x3f74c3={};_0x3f74c3[_0x233e76]={'$like':'%'+_0x865e4a[_0x9b3f('0x3e')][_0x9b3f('0x4f')]+'%'};return _0x3f74c3;})});}if(_0x865e4a[_0x9b3f('0x3e')]['$gte']){var _0x4ecdc8=_0x865e4a[_0x9b3f('0x3e')]['$gte'][_0x9b3f('0x9c')](',');var _0x30adee={};_0x30adee[_0x4ecdc8[0x0]]={'$gte':moment(_0x4ecdc8[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2e91c0['where']=_[_0x9b3f('0x4d')](_0x2e91c0[_0x9b3f('0x4a')],_0x30adee);}_0x2e91c0=_[_0x9b3f('0x4d')]({},_0x2e91c0,_0x865e4a['options']);return db[_0x9b3f('0x9b')]['count']({'where':_0x2e91c0['where']})[_0x9b3f('0x1e')](function(_0x4a0e26){_0x5b4a39[_0x9b3f('0x2a')]=_0x4a0e26;if(_0x865e4a['query'][_0x9b3f('0x51')]){_0x2e91c0[_0x9b3f('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2e91c0);})[_0x9b3f('0x1e')](function(_0x1f78bb){_0x5b4a39[_0x9b3f('0x54')]=_0x1f78bb;return _0x5b4a39;});}})[_0x9b3f('0x1e')](respondWithFilteredResult(_0x2c1b19,_0x2e91c0))[_0x9b3f('0x55')](handleError(_0x2c1b19,null));};exports[_0x9b3f('0x34')]=function(_0x48d1b8,_0x2811a2,_0x6144d6){var _0x75f636,_0x12ef6f={},_0x224d2a;if(_0x48d1b8[_0x9b3f('0x60')]['to']){_0x224d2a=_0x48d1b8['body']['to'][0x0];}return db[_0x9b3f('0x38')][_0x9b3f('0x58')]({'where':{'id':_0x48d1b8[_0x9b3f('0x57')]['id']},'include':[{'model':db[_0x9b3f('0x9d')],'as':_0x9b3f('0x9e'),'include':[{'model':db[_0x9b3f('0x6f')],'as':'Contacts','where':{'fax':_0x224d2a},'limit':0x1,'order':[[_0x9b3f('0x99'),_0x9b3f('0x9f')]]}]}]})[_0x9b3f('0x1e')](handleEntityNotFound(_0x2811a2,null))['then'](function(_0x510a99){_0x75f636=_0x510a99;if(_0x48d1b8[_0x9b3f('0x60')]['attachments']&&_0x48d1b8[_0x9b3f('0x60')]['attachments']['length']){for(var _0x5b81db=0x0;_0x5b81db<_0x48d1b8[_0x9b3f('0x60')]['attachments'][_0x9b3f('0x44')];_0x5b81db+=0x1){_0x48d1b8[_0x9b3f('0x60')][_0x9b3f('0xa0')][_0x5b81db]={'filename':_0x48d1b8[_0x9b3f('0x60')][_0x9b3f('0xa0')][_0x5b81db][_0x9b3f('0x33')],'id':_0x48d1b8['body'][_0x9b3f('0xa0')][_0x5b81db]['id'],'path':path[_0x9b3f('0xa1')](config['root'],_0x9b3f('0xa2'),_0x48d1b8[_0x9b3f('0x60')]['attachments'][_0x5b81db][_0x9b3f('0xa3')])};}}return respondWithRpcPromise('CheckAfterSend',_0x9b3f('0xa4'),{'FaxAccountId':_[_0x9b3f('0xa5')](_0x48d1b8['params']['id'])?undefined:_0x48d1b8['params']['id'],'path':_['isNil'](_0x48d1b8[_0x9b3f('0x60')][_0x9b3f('0xa0')][0x0]['path'])?undefined:_0x48d1b8[_0x9b3f('0x60')][_0x9b3f('0xa0')][0x0]['path'],'fax':_['isNil'](_0x48d1b8[_0x9b3f('0x60')]['to'][0x0])?undefined:_0x48d1b8[_0x9b3f('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x75f636){if(_[_0x9b3f('0xa5')](_0x48d1b8['body'][_0x9b3f('0xa6')])){_0x48d1b8[_0x9b3f('0x60')][_0x9b3f('0xa6')]=util[_0x9b3f('0xa7')](_0x9b3f('0xa8'),_0x75f636[_0x9b3f('0x33')],_0x75f636['fax']);}if(_0x75f636[_0x9b3f('0x9e')]){if(_0x75f636[_0x9b3f('0x9e')][_0x9b3f('0xa9')][_0x9b3f('0x44')]){return _0x75f636[_0x9b3f('0x9e')][_0x9b3f('0xa9')][0x0];}else{return db[_0x9b3f('0x6f')][_0x9b3f('0x59')](_['defaults'](_0x48d1b8['body'],{'firstName':_0x48d1b8[_0x9b3f('0x60')]['to'][0x0],'phone':_0x48d1b8['body']['to'][0x0],'fax':_0x48d1b8['body']['to'][0x0],'ListId':_0x75f636[_0x9b3f('0xaa')]}));}}else{throw new Error(_0x9b3f('0xab'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x9b3f('0x1e')](function(_0x1fd2c6){if(_0x1fd2c6){return db[_0x9b3f('0x6c')][_0x9b3f('0x58')]({'where':{'ContactId':_0x1fd2c6['id'],'closed':![],'FaxAccountId':_0x75f636['id']}})['then'](function(_0x3e2592){if(_0x3e2592){return[_0x3e2592,![]];}return db[_0x9b3f('0x6c')][_0x9b3f('0x59')]({'UserId':_0x48d1b8[_0x9b3f('0x5b')]['id'],'ContactId':_0x1fd2c6['id'],'FaxAccountId':_0x75f636['id'],'fax':_0x48d1b8[_0x9b3f('0x60')]['to'][0x0],'firstMsgDirection':_0x9b3f('0xac'),'Messages':[_[_0x9b3f('0x4d')](_0x48d1b8[_0x9b3f('0x60')],{'read':![],'body':_0x48d1b8[_0x9b3f('0x60')][_0x9b3f('0xa0')][0x0][_0x9b3f('0xad')],'FaxAccountId':_0x75f636['id'],'UserId':_0x48d1b8[_0x9b3f('0x5b')]['id'],'ContactId':_0x1fd2c6['id'],'AttachmentId':_0x48d1b8[_0x9b3f('0x60')][_0x9b3f('0xa0')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x9b3f('0x1e')](function(_0x5743ee){return[_0x5743ee,!![]];});});}else{throw new Error(_0x9b3f('0xae'));}})[_0x9b3f('0xaf')](function(_0x4f4f92,_0x140985){if(_0x140985){return _0x4f4f92;}return db[_0x9b3f('0x9b')][_0x9b3f('0x59')]({'direction':_0x9b3f('0xac'),'read':![],'body':_0x48d1b8['body'][_0x9b3f('0xa0')][0x0]['filename'],'FaxAccountId':_0x75f636['id'],'FaxInteractionId':_0x4f4f92['id'],'UserId':_0x48d1b8[_0x9b3f('0x5b')]['id'],'ContactId':_0x4f4f92[_0x9b3f('0xb0')],'AttachmentId':_0x48d1b8['body']['attachments'][0x0]['id']})['then'](function(_0x113bc5){_0x4f4f92[_0x9b3f('0xb1')][_0x9b3f('0xb2')]=[];_0x4f4f92['dataValues'][_0x9b3f('0xb2')][_0x9b3f('0x84')](_0x113bc5[_0x9b3f('0xb1')]);return _0x4f4f92;});})['then'](function(_0x2d8f61){respondWithRpcPromise(_0x9b3f('0xb3'),'SendFax',{'FaxAccountId':_[_0x9b3f('0xa5')](_0x48d1b8['params']['id'])?undefined:_0x48d1b8[_0x9b3f('0x57')]['id'],'path':_['isNil'](_0x48d1b8[_0x9b3f('0x60')]['attachments'][0x0][_0x9b3f('0x6')])?undefined:_0x48d1b8[_0x9b3f('0x60')]['attachments'][0x0][_0x9b3f('0x6')],'fax':_[_0x9b3f('0xa5')](_0x48d1b8[_0x9b3f('0x60')]['to'][0x0])?undefined:_0x48d1b8[_0x9b3f('0x60')]['to'][0x0],'AttachmentId':_0x48d1b8[_0x9b3f('0x60')]['attachments'][0x0]['id']},client9002)['then'](function(_0x13ec7d){logger[_0x9b3f('0x1f')]('SendFaxRpc,\x20%s',_0x13ec7d);})[_0x9b3f('0x55')](function(_0x4f9016){logger[_0x9b3f('0x1f')](_0x9b3f('0xb4'),_0x4f9016);});return _0x2d8f61;})['then'](respondWithResult(_0x2811a2,null))[_0x9b3f('0x55')](handleError(_0x2811a2,null));};exports[_0x9b3f('0xb5')]=function(_0x8362,_0x5a62e1,_0x2c1dc4){return db[_0x9b3f('0x38')][_0x9b3f('0x58')]({'where':{'id':_0x8362[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a62e1,null))[_0x9b3f('0x1e')](function(_0x59a40f){if(_0x59a40f){return _0x59a40f[_0x9b3f('0xb5')](_0x8362[_0x9b3f('0x60')]['ids'],_[_0x9b3f('0x96')](_0x8362[_0x9b3f('0x60')],[_0x9b3f('0x6b'),'id'])||{})[_0x9b3f('0xaf')](function(_0x42e2f4){for(var _0x5d13fa=0x0;_0x5d13fa<_0x8362[_0x9b3f('0x60')][_0x9b3f('0x6b')][_0x9b3f('0x44')];_0x5d13fa+=0x1){socket[_0x9b3f('0xb6')](_0x9b3f('0xb7'),{'UserId':Number(_0x8362[_0x9b3f('0x60')]['ids'][_0x5d13fa]),'FaxAccountId':Number(_0x8362[_0x9b3f('0x57')]['id'])});}return _0x42e2f4;});}})['then'](respondWithResult(_0x5a62e1,null))[_0x9b3f('0x55')](handleError(_0x5a62e1,null));};exports[_0x9b3f('0xb8')]=function(_0x4a7a2a,_0x3f9b2a,_0x21aada){return db[_0x9b3f('0x38')][_0x9b3f('0x58')]({'where':{'id':_0x4a7a2a[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x3f9b2a,null))[_0x9b3f('0x1e')](function(_0x203e24){if(_0x203e24){return _0x203e24[_0x9b3f('0xb8')](_0x4a7a2a[_0x9b3f('0x3e')][_0x9b3f('0x6b')])['then'](function(){if(_[_0x9b3f('0xb9')](_0x4a7a2a[_0x9b3f('0x3e')][_0x9b3f('0x6b')])){for(var _0x25c7af=0x0;_0x25c7af<_0x4a7a2a[_0x9b3f('0x3e')]['ids'][_0x9b3f('0x44')];_0x25c7af+=0x1){socket[_0x9b3f('0xb6')](_0x9b3f('0xba'),{'UserId':Number(_0x4a7a2a['query']['ids'][_0x25c7af]),'FaxAccountId':Number(_0x4a7a2a[_0x9b3f('0x57')]['id'])});}}else{socket[_0x9b3f('0xb6')](_0x9b3f('0xba'),{'UserId':Number(_0x4a7a2a[_0x9b3f('0x3e')][_0x9b3f('0x6b')]),'FaxAccountId':Number(_0x4a7a2a[_0x9b3f('0x57')]['id'])});}});}})[_0x9b3f('0x1e')](respondWithStatusCode(_0x3f9b2a,null))[_0x9b3f('0x55')](handleError(_0x3f9b2a,null));};exports[_0x9b3f('0xbb')]=function(_0xa3a27,_0x187b6b,_0x57b63e){var _0x23917c={};var _0x54d679={};var _0x16bcc7;var _0x1d7462;return db[_0x9b3f('0x38')][_0x9b3f('0x66')]({'where':{'id':_0xa3a27[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x187b6b,null))['then'](function(_0x3ec8c8){if(_0x3ec8c8){_0x16bcc7=_0x3ec8c8;_0x54d679[_0x9b3f('0x41')]=_[_0x9b3f('0x3f')](db[_0x9b3f('0x71')][_0x9b3f('0x39')]);_0x54d679['query']=_['keys'](_0xa3a27[_0x9b3f('0x3e')]);_0x54d679['filters']=_[_0x9b3f('0x40')](_0x54d679[_0x9b3f('0x41')],_0x54d679['query']);_0x23917c['attributes']=_[_0x9b3f('0x40')](_0x54d679[_0x9b3f('0x41')],qs['fields'](_0xa3a27['query'][_0x9b3f('0x42')]));_0x23917c[_0x9b3f('0x43')]=_0x23917c[_0x9b3f('0x43')][_0x9b3f('0x44')]?_0x23917c[_0x9b3f('0x43')]:_0x54d679[_0x9b3f('0x41')];_0x23917c[_0x9b3f('0x48')]=qs[_0x9b3f('0x49')](_0xa3a27[_0x9b3f('0x3e')][_0x9b3f('0x49')]);_0x23917c['where']=qs[_0x9b3f('0x4b')](_['pick'](_0xa3a27[_0x9b3f('0x3e')],_0x54d679[_0x9b3f('0x4b')]));if(_0xa3a27[_0x9b3f('0x3e')][_0x9b3f('0x4f')]){_0x23917c[_0x9b3f('0x4a')]=_['merge'](_0x23917c[_0x9b3f('0x4a')],{'$or':_['map'](_0x23917c['attributes'],function(_0xfc4eb4){var _0x172fb8={};_0x172fb8[_0xfc4eb4]={'$like':'%'+_0xa3a27[_0x9b3f('0x3e')][_0x9b3f('0x4f')]+'%'};return _0x172fb8;})});}_0x23917c=_[_0x9b3f('0x4d')]({},_0x23917c,_0xa3a27[_0x9b3f('0x50')]);return _0x16bcc7[_0x9b3f('0xbb')](_0x23917c);}})['then'](function(_0x3c3005){if(_0x3c3005){_0x1d7462=_0x3c3005[_0x9b3f('0x44')];if(!_0xa3a27[_0x9b3f('0x3e')]['hasOwnProperty']('nolimit')){_0x23917c[_0x9b3f('0x47')]=qs['limit'](_0xa3a27['query'][_0x9b3f('0x47')]);_0x23917c[_0x9b3f('0x29')]=qs[_0x9b3f('0x29')](_0xa3a27['query'][_0x9b3f('0x29')]);}return _0x16bcc7['getAgents'](_0x23917c);}})[_0x9b3f('0x1e')](function(_0x4158cd){if(_0x4158cd){return _0x4158cd?{'count':_0x1d7462,'rows':_0x4158cd}:null;}})['then'](respondWithResult(_0x187b6b,null))[_0x9b3f('0x55')](handleError(_0x187b6b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8418afe..3db5e2d 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 _0xbd89=['emit','hasOwnProperty','hook','exports','setMaxListeners','update','remove'];(function(_0x115b45,_0x3c5bcd){var _0x4a9a7a=function(_0x3e9b2a){while(--_0x3e9b2a){_0x115b45['push'](_0x115b45['shift']());}};_0x4a9a7a(++_0x3c5bcd);}(_0xbd89,0x9e));var _0x9bd8=function(_0x7f31fc,_0x333582){_0x7f31fc=_0x7f31fc-0x0;var _0x41e3fc=_0xbd89[_0x7f31fc];return _0x41e3fc;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9bd8('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9bd8('0x1'),'afterDestroy':_0x9bd8('0x2')};function emitEvent(_0x21a172){return function(_0x3f8ee3,_0x34e2e5,_0x51d20d){FaxAccountEvents[_0x9bd8('0x3')](_0x21a172+':'+_0x3f8ee3['id'],_0x3f8ee3);FaxAccountEvents[_0x9bd8('0x3')](_0x21a172,_0x3f8ee3);_0x51d20d(null);};}for(var e in events){if(events[_0x9bd8('0x4')](e)){var event=events[e];FaxAccount[_0x9bd8('0x5')](e,emitEvent(event));}}module[_0x9bd8('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xc4bf=['../../mysqldb','setMaxListeners','update','remove','emit','hook'];(function(_0x44345d,_0x4ed973){var _0x4f6ceb=function(_0x57ec04){while(--_0x57ec04){_0x44345d['push'](_0x44345d['shift']());}};_0x4f6ceb(++_0x4ed973);}(_0xc4bf,0x1c8));var _0xfc4b=function(_0x57171b,_0xfe67c6){_0x57171b=_0x57171b-0x0;var _0x33a2c8=_0xc4bf[_0x57171b];return _0x33a2c8;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xfc4b('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xfc4b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfc4b('0x2'),'afterDestroy':_0xfc4b('0x3')};function emitEvent(_0x153a77){return function(_0x287dc0,_0x3f5c95,_0x1b1365){FaxAccountEvents[_0xfc4b('0x4')](_0x153a77+':'+_0x287dc0['id'],_0x287dc0);FaxAccountEvents['emit'](_0x153a77,_0x287dc0);_0x1b1365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xfc4b('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 dd24120..344322d 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 _0x4d34=['define','fax_accounts','util','api','moment','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports'];(function(_0x5c3ce3,_0x4ce9b5){var _0x461b67=function(_0x12d395){while(--_0x12d395){_0x5c3ce3['push'](_0x5c3ce3['shift']());}};_0x461b67(++_0x4ce9b5);}(_0x4d34,0x142));var _0x44d3=function(_0x5f1dd7,_0x4ef79f){_0x5f1dd7=_0x5f1dd7-0x0;var _0x16663c=_0x4d34[_0x5f1dd7];return _0x16663c;};'use strict';var _=require('lodash');var util=require(_0x44d3('0x0'));var logger=require('../../config/logger')(_0x44d3('0x1'));var moment=require(_0x44d3('0x2'));var BPromise=require(_0x44d3('0x3'));var rp=require(_0x44d3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44d3('0x5'));var attributes=require(_0x44d3('0x6'));module[_0x44d3('0x7')]=function(_0x58bc83,_0x232ffd){return _0x58bc83[_0x44d3('0x8')]('FaxAccount',attributes,{'tableName':_0x44d3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9694=['FaxAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x32fa53,_0x1c95f4){var _0x14faf8=function(_0x59b878){while(--_0x59b878){_0x32fa53['push'](_0x32fa53['shift']());}};_0x14faf8(++_0x1c95f4);}(_0x9694,0x79));var _0x4969=function(_0x210b24,_0x11eea6){_0x210b24=_0x210b24-0x0;var _0x267fad=_0x9694[_0x210b24];return _0x267fad;};'use strict';var _=require(_0x4969('0x0'));var util=require(_0x4969('0x1'));var logger=require(_0x4969('0x2'))(_0x4969('0x3'));var moment=require(_0x4969('0x4'));var BPromise=require('bluebird');var rp=require(_0x4969('0x5'));var fs=require('fs');var path=require(_0x4969('0x6'));var rimraf=require(_0x4969('0x7'));var config=require(_0x4969('0x8'));var attributes=require(_0x4969('0x9'));module[_0x4969('0xa')]=function(_0x5c691a,_0x3ac606){return _0x5c691a['define'](_0x4969('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 1a1570c..9b1bfa9 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 _0xb33b=['defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','error','code','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','findAll','options','raw','where','attributes','limit','map','include','model','GetFaxAccount','debug','stringify','catch','NotifyFaxAccount','fax','CmContact','Sequelize','ValidationError','keys','difference','createdAt','CompanyId','ListId','body','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','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','asc','length','create','contact','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x114381,_0x56b02f){var _0x2d618b=function(_0x47104c){while(--_0x47104c){_0x114381['push'](_0x114381['shift']());}};_0x2d618b(++_0x56b02f);}(_0xb33b,0x10d));var _0xbb33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb33b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb33('0x0'));var util=require('util');var moment=require(_0xbb33('0x1'));var BPromise=require(_0xbb33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb33('0x3'));var db=require(_0xbb33('0x4'))['db'];var utils=require(_0xbb33('0x5'));var logger=require(_0xbb33('0x6'))(_0xbb33('0x7'));var config=require(_0xbb33('0x8'));var jayson=require(_0xbb33('0x9'));var client=jayson[_0xbb33('0xa')][_0xbb33('0xb')]({'port':0x232c});config[_0xbb33('0xc')]=_[_0xbb33('0xd')](config['redis'],{'host':_0xbb33('0xe'),'port':0x18eb});var socket=require(_0xbb33('0xf'))(new Redis(config[_0xbb33('0xc')]));require(_0xbb33('0x10'))[_0xbb33('0x11')](socket);function respondWithRpcPromise(_0x597f26,_0x362fbe,_0x11b1d4){return new BPromise(function(_0x67eb66,_0xe577d9){return client[_0xbb33('0x12')](_0x597f26,_0x11b1d4)[_0xbb33('0x13')](function(_0x3825f8){logger[_0xbb33('0x14')]('FaxAccount,\x20%s,\x20%s',_0x362fbe,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x362fbe,'request\x20sent',JSON['stringify'](_0x3825f8));if(_0x3825f8[_0xbb33('0x15')]){if(_0x3825f8[_0xbb33('0x15')][_0xbb33('0x16')]===0x1f4){logger[_0xbb33('0x15')](_0xbb33('0x17'),_0x362fbe,_0x3825f8[_0xbb33('0x15')][_0xbb33('0x18')]);return _0xe577d9(_0x3825f8['error'][_0xbb33('0x18')]);}logger['error'](_0xbb33('0x17'),_0x362fbe,_0x3825f8[_0xbb33('0x15')][_0xbb33('0x18')]);return _0x67eb66(_0x3825f8['error']['message']);}else{logger[_0xbb33('0x14')]('FaxAccount,\x20%s,\x20%s',_0x362fbe,_0xbb33('0x19'));_0x67eb66(_0x3825f8[_0xbb33('0x1a')][_0xbb33('0x18')]);}})['catch'](function(_0x1c780e){logger['error']('FaxAccount,\x20%s,\x20%s',_0x362fbe,_0x1c780e);_0xe577d9(_0x1c780e);});});}exports['GetFaxAccount']=function(_0x24eb87){var _0x107e93=this;return new Promise(function(_0x12ad34,_0x5a5e89){return db['FaxAccount'][_0xbb33('0x1b')]({'raw':_0x24eb87[_0xbb33('0x1c')]?_0x24eb87[_0xbb33('0x1c')][_0xbb33('0x1d')]===undefined?!![]:![]:!![],'where':_0x24eb87[_0xbb33('0x1c')]?_0x24eb87[_0xbb33('0x1c')][_0xbb33('0x1e')]||null:null,'attributes':_0x24eb87[_0xbb33('0x1c')]?_0x24eb87['options'][_0xbb33('0x1f')]||null:null,'limit':_0x24eb87['options']?_0x24eb87[_0xbb33('0x1c')][_0xbb33('0x20')]||null:null,'include':_0x24eb87[_0xbb33('0x1c')]?_0x24eb87[_0xbb33('0x1c')]['include']?_[_0xbb33('0x21')](_0x24eb87[_0xbb33('0x1c')][_0xbb33('0x22')],function(_0x714895){return{'model':db[_0x714895[_0xbb33('0x23')]],'as':_0x714895['as'],'attributes':_0x714895[_0xbb33('0x1f')],'include':_0x714895[_0xbb33('0x22')]?_[_0xbb33('0x21')](_0x714895[_0xbb33('0x22')],function(_0x4154f9){return{'model':db[_0x4154f9[_0xbb33('0x23')]],'as':_0x4154f9['as'],'attributes':_0x4154f9[_0xbb33('0x1f')],'include':_0x4154f9['include']?_[_0xbb33('0x21')](_0x4154f9['include'],function(_0x29c25d){return{'model':db[_0x29c25d[_0xbb33('0x23')]],'as':_0x29c25d['as'],'attributes':_0x29c25d[_0xbb33('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbb33('0x13')](function(_0x108edb){logger[_0xbb33('0x14')](_0xbb33('0x24'),_0x24eb87);logger[_0xbb33('0x25')](_0xbb33('0x24'),_0x24eb87,JSON[_0xbb33('0x26')](_0x108edb));_0x12ad34(_0x108edb);})[_0xbb33('0x27')](function(_0x3e024b){logger[_0xbb33('0x15')](_0xbb33('0x24'),_0x3e024b['message'],_0x24eb87);_0x5a5e89(_0x107e93[_0xbb33('0x15')](0x1f4,_0x3e024b[_0xbb33('0x18')]));});});};exports[_0xbb33('0x28')]=function(_0x9caeda,_0x202a6d,_0x498466){var _0x14fee0=this;return new Promise(function(_0x22ecb1,_0x3f0de5){var _0x4d1db4={'body':_0x9caeda['body'],'channel':_0xbb33('0x29')};var _0x49d014=[];var _0x953434=[];var _0x520e2d={};return db[_0xbb33('0x2a')]['describe']()[_0xbb33('0x13')](function(_0x92f07f){if(!_0x92f07f){throw new db[(_0xbb33('0x2b'))][(_0xbb33('0x2c'))]('no\x20available\x20attributes');}_0x49d014=_['difference'](_[_0xbb33('0x2d')](_0x92f07f),['createdAt','updatedAt']);_0x953434=_[_0xbb33('0x2e')](_[_0xbb33('0x2d')](_0x92f07f),[_0xbb33('0x2f'),'updatedAt',_0xbb33('0x30'),_0xbb33('0x31')]);if(_0x9caeda[_0xbb33('0x32')]['id']){delete _0x9caeda[_0xbb33('0x32')]['id'];}if(_[_0xbb33('0x33')](_0x9caeda[_0xbb33('0x32')][_0xbb33('0x34')])){throw new db[(_0xbb33('0x2b'))][(_0xbb33('0x2c'))](_0xbb33('0x35'));}if(_['isNil'](_0x9caeda['body'][_0xbb33('0x32')])||_0x9caeda[_0xbb33('0x32')][_0xbb33('0x32')]===''){throw new db['Sequelize'][(_0xbb33('0x2c'))](_0xbb33('0x36'));}if(_[_0xbb33('0x33')](_0x9caeda[_0xbb33('0x32')]['mapKey'])){throw new db['Sequelize'][(_0xbb33('0x2c'))](_0xbb33('0x37')+_0x953434);}if(!_[_0xbb33('0x38')](_0x953434,_0x9caeda[_0xbb33('0x32')][_0xbb33('0x39')])){throw new db[(_0xbb33('0x2b'))][(_0xbb33('0x2c'))](_0xbb33('0x3a')+_0x953434);}_0x520e2d[_0x9caeda[_0xbb33('0x32')][_0xbb33('0x39')]]=_0x9caeda[_0xbb33('0x32')][_0xbb33('0x34')];})[_0xbb33('0x13')](function(){return db[_0xbb33('0x3b')][_0xbb33('0x3c')]({'where':{'id':_0x9caeda[_0xbb33('0x3d')]['id']},'include':[{'model':db[_0xbb33('0x3e')],'as':_0xbb33('0x3f'),'include':[{'model':db[_0xbb33('0x2a')],'as':_0xbb33('0x40'),'where':_0x520e2d,'limit':0x1,'order':[['updatedAt',_0xbb33('0x41')]]}]},{'model':db[_0xbb33('0x42')],'as':_0xbb33('0x43')}]});})[_0xbb33('0x13')](function(_0x1fdcbc){if(_0x1fdcbc&&_0x1fdcbc[_0xbb33('0x3f')]){var _0x14f3f7=_0x1fdcbc[_0xbb33('0x44')]({'plain':!![]});_0x4d1db4[_0xbb33('0x3d')]=_0x14f3f7;_0x4d1db4['applications']=_0x14f3f7[_0xbb33('0x43')];_0x4d1db4[_0xbb33('0x45')]=_0x14f3f7[_0xbb33('0x3f')];_0x4d1db4[_0xbb33('0x46')]=_[_0xbb33('0x47')](_0x4d1db4[_0xbb33('0x46')],[_0xbb33('0x48')],[_0xbb33('0x49')]);if(_0x4d1db4[_0xbb33('0x3d')][_0xbb33('0x43')]){delete _0x4d1db4[_0xbb33('0x3d')][_0xbb33('0x43')];}if(_0x4d1db4[_0xbb33('0x3d')][_0xbb33('0x3f')]&&_0x4d1db4[_0xbb33('0x3d')][_0xbb33('0x3f')][_0xbb33('0x40')][_0xbb33('0x4a')]){return _0x4d1db4[_0xbb33('0x3d')]['List']['Contacts'][0x0];}var _0x56d5cb=_[_0xbb33('0xd')](_0x9caeda['body'],{'firstName':_0x9caeda[_0xbb33('0x32')][_0xbb33('0x34')],'ListId':_0x14f3f7[_0xbb33('0x31')]});_0x56d5cb[_0x9caeda['body'][_0xbb33('0x39')]]=_0x9caeda['body']['from'];return db[_0xbb33('0x2a')][_0xbb33('0x4b')](_0x56d5cb,{'fields':_0x49d014,'raw':!![]});}})[_0xbb33('0x13')](function(_0x327612){_0x4d1db4[_0xbb33('0x4c')]=_0x327612;if(_0x327612){var _0x2daa07={'ContactId':_0x327612['id'],'FaxAccountId':_0x9caeda[_0xbb33('0x3d')]['id'],'fax':_0x327612['fax']};return db['FaxInteraction'][_0xbb33('0x3c')]({'where':{'ContactId':_0x327612['id'],'closed':![],'FaxAccountId':_0x9caeda[_0xbb33('0x3d')]['id']}})[_0xbb33('0x13')](function(_0x86bbcb){if(_0x86bbcb){return[_0x86bbcb,![]];}return db['FaxInteraction'][_0xbb33('0x4b')](_0x2daa07)[_0xbb33('0x13')](function(_0x1a1cf2){return[_0x1a1cf2,!![]];});});}else{throw new Error(_0xbb33('0x4d'));}})[_0xbb33('0x4e')](function(_0x55203a,_0x12d83b){var _0x9b782b=_0x55203a[_0xbb33('0x44')]({'plain':!![]});if(_0x12d83b){if(_0x4d1db4[_0xbb33('0x3d')]['autoclose']){_0x4d1db4[_0xbb33('0x46')][_0xbb33('0x4f')]({'id':0x0,'priority':_0x4d1db4['applications'][_0xbb33('0x4a')]+0x1,'app':_0xbb33('0x50'),'appdata':_0xbb33('0x51'),'interval':_0xbb33('0x52')});}_0x9b782b[_0xbb33('0x53')]=!![];}else{_0x9b782b[_0xbb33('0x53')]=![];}_0x4d1db4[_0xbb33('0x54')]=_0x9b782b;return db['FaxMessage'][_0xbb33('0x4b')]({'body':_0x9caeda['body'][_0xbb33('0x32')],'FaxAccountId':_0x9caeda[_0xbb33('0x3d')]['id'],'FaxInteractionId':_0x55203a['id'],'direction':'in','ContactId':_0x55203a[_0xbb33('0x55')],'AttachmentId':_0x9caeda[_0xbb33('0x32')][_0xbb33('0x56')]});})[_0xbb33('0x13')](function(_0x5ac581){_0x4d1db4[_0xbb33('0x18')]=_0x5ac581;if(_0x4d1db4['interaction'][_0xbb33('0x57')]){return db[_0xbb33('0x58')]['find']({'attributes':['id',_0xbb33('0x59')],'where':{'id':_0x4d1db4[_0xbb33('0x54')]['UserId']}})[_0xbb33('0x13')](function(_0x153d10){if(_0x153d10){_0x4d1db4['applications'][_0xbb33('0x5a')]({'id':0x0,'priority':0x0,'app':_0xbb33('0x5b'),'appdata':_0x153d10['name']+','+(_0x4d1db4[_0xbb33('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0xbb33('0x52')});}return respondWithRpcPromise(_0xbb33('0x5c'),_0xbb33('0x5d'),_0x4d1db4);});}return respondWithRpcPromise(_0xbb33('0x5c'),_0xbb33('0x5d'),_0x4d1db4);})['then'](function(_0x3bb395){_0x22ecb1(_0x3bb395);})[_0xbb33('0x27')](function(_0x10b567){_0x3f0de5(_0x14fee0[_0xbb33('0x15')](0x1f4,_0x10b567[_0xbb33('0x18')]));});});}; \ No newline at end of file +var _0xd5cc=['client','http','defaults','localhost','redis','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','create','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd5cc,0x101));var _0xcd5c=function(_0x452136,_0x311b4a){_0x452136=_0x452136-0x0;var _0x128128=_0xd5cc[_0x452136];return _0x128128;};'use strict';var _=require(_0xcd5c('0x0'));var util=require(_0xcd5c('0x1'));var moment=require(_0xcd5c('0x2'));var BPromise=require(_0xcd5c('0x3'));var rs=require(_0xcd5c('0x4'));var fs=require('fs');var Redis=require(_0xcd5c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd5c('0x6'))(_0xcd5c('0x7'));var config=require(_0xcd5c('0x8'));var jayson=require(_0xcd5c('0x9'));var client=jayson[_0xcd5c('0xa')][_0xcd5c('0xb')]({'port':0x232c});config['redis']=_[_0xcd5c('0xc')](config['redis'],{'host':_0xcd5c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd5c('0xe')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x28c691,_0x215ef3,_0x240452){return new BPromise(function(_0x21779b,_0x4fe440){return client['request'](_0x28c691,_0x240452)[_0xcd5c('0xf')](function(_0x1fc508){logger[_0xcd5c('0x10')](_0xcd5c('0x11'),_0x215ef3,_0xcd5c('0x12'));logger[_0xcd5c('0x13')](_0xcd5c('0x14'),_0x215ef3,_0xcd5c('0x12'),JSON['stringify'](_0x1fc508));if(_0x1fc508['error']){if(_0x1fc508[_0xcd5c('0x15')][_0xcd5c('0x16')]===0x1f4){logger[_0xcd5c('0x15')](_0xcd5c('0x11'),_0x215ef3,_0x1fc508['error'][_0xcd5c('0x17')]);return _0x4fe440(_0x1fc508[_0xcd5c('0x15')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x215ef3,_0x1fc508[_0xcd5c('0x15')][_0xcd5c('0x17')]);return _0x21779b(_0x1fc508[_0xcd5c('0x15')][_0xcd5c('0x17')]);}else{logger[_0xcd5c('0x10')](_0xcd5c('0x11'),_0x215ef3,'request\x20sent');_0x21779b(_0x1fc508[_0xcd5c('0x18')][_0xcd5c('0x17')]);}})[_0xcd5c('0x19')](function(_0x342c60){logger['error']('FaxAccount,\x20%s,\x20%s',_0x215ef3,_0x342c60);_0x4fe440(_0x342c60);});});}exports['GetFaxAccount']=function(_0x37e4c6){var _0x1320fc=this;return new Promise(function(_0x259f89,_0xb3b670){return db['FaxAccount'][_0xcd5c('0x1a')]({'raw':_0x37e4c6[_0xcd5c('0x1b')]?_0x37e4c6['options'][_0xcd5c('0x1c')]===undefined?!![]:![]:!![],'where':_0x37e4c6[_0xcd5c('0x1b')]?_0x37e4c6[_0xcd5c('0x1b')][_0xcd5c('0x1d')]||null:null,'attributes':_0x37e4c6['options']?_0x37e4c6[_0xcd5c('0x1b')][_0xcd5c('0x1e')]||null:null,'limit':_0x37e4c6[_0xcd5c('0x1b')]?_0x37e4c6[_0xcd5c('0x1b')][_0xcd5c('0x1f')]||null:null,'include':_0x37e4c6[_0xcd5c('0x1b')]?_0x37e4c6[_0xcd5c('0x1b')][_0xcd5c('0x20')]?_[_0xcd5c('0x21')](_0x37e4c6['options'][_0xcd5c('0x20')],function(_0x42a2ed){return{'model':db[_0x42a2ed['model']],'as':_0x42a2ed['as'],'attributes':_0x42a2ed['attributes'],'include':_0x42a2ed['include']?_[_0xcd5c('0x21')](_0x42a2ed[_0xcd5c('0x20')],function(_0x111146){return{'model':db[_0x111146[_0xcd5c('0x22')]],'as':_0x111146['as'],'attributes':_0x111146[_0xcd5c('0x1e')],'include':_0x111146[_0xcd5c('0x20')]?_[_0xcd5c('0x21')](_0x111146[_0xcd5c('0x20')],function(_0x26ac3a){return{'model':db[_0x26ac3a[_0xcd5c('0x22')]],'as':_0x26ac3a['as'],'attributes':_0x26ac3a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4db2e4){logger[_0xcd5c('0x10')](_0xcd5c('0x23'),_0x37e4c6);logger[_0xcd5c('0x13')](_0xcd5c('0x23'),_0x37e4c6,JSON[_0xcd5c('0x24')](_0x4db2e4));_0x259f89(_0x4db2e4);})[_0xcd5c('0x19')](function(_0x3f0870){logger[_0xcd5c('0x15')](_0xcd5c('0x23'),_0x3f0870['message'],_0x37e4c6);_0xb3b670(_0x1320fc['error'](0x1f4,_0x3f0870[_0xcd5c('0x17')]));});});};exports[_0xcd5c('0x25')]=function(_0x39f08e,_0x59de37,_0x1a3e4e){var _0x2d90fe=this;return new Promise(function(_0x19f0be,_0x256ca3){var _0x34386d={'body':_0x39f08e[_0xcd5c('0x26')],'channel':_0xcd5c('0x27')};var _0x4ed50b=[];var _0x11ae2f=[];var _0x14a0b7={};return db[_0xcd5c('0x28')]['describe']()[_0xcd5c('0xf')](function(_0xd269b2){if(!_0xd269b2){throw new db[(_0xcd5c('0x29'))][(_0xcd5c('0x2a'))]('no\x20available\x20attributes');}_0x4ed50b=_[_0xcd5c('0x2b')](_[_0xcd5c('0x2c')](_0xd269b2),[_0xcd5c('0x2d'),_0xcd5c('0x2e')]);_0x11ae2f=_[_0xcd5c('0x2b')](_[_0xcd5c('0x2c')](_0xd269b2),[_0xcd5c('0x2d'),_0xcd5c('0x2e'),'CompanyId',_0xcd5c('0x2f')]);if(_0x39f08e['body']['id']){delete _0x39f08e['body']['id'];}if(_[_0xcd5c('0x30')](_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x31')])){throw new db[(_0xcd5c('0x29'))][(_0xcd5c('0x2a'))](_0xcd5c('0x32'));}if(_[_0xcd5c('0x30')](_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x26')])||_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x26')]===''){throw new db[(_0xcd5c('0x29'))][(_0xcd5c('0x2a'))](_0xcd5c('0x33'));}if(_[_0xcd5c('0x30')](_0x39f08e['body'][_0xcd5c('0x34')])){throw new db[(_0xcd5c('0x29'))][(_0xcd5c('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11ae2f);}if(!_[_0xcd5c('0x35')](_0x11ae2f,_0x39f08e['body'][_0xcd5c('0x34')])){throw new db[(_0xcd5c('0x29'))][(_0xcd5c('0x2a'))](_0xcd5c('0x36')+_0x11ae2f);}_0x14a0b7[_0x39f08e[_0xcd5c('0x26')]['mapKey']]=_0x39f08e['body'][_0xcd5c('0x31')];})[_0xcd5c('0xf')](function(){return db[_0xcd5c('0x37')][_0xcd5c('0x38')]({'where':{'id':_0x39f08e[_0xcd5c('0x39')]['id']},'include':[{'model':db[_0xcd5c('0x3a')],'as':_0xcd5c('0x3b'),'include':[{'model':db[_0xcd5c('0x28')],'as':_0xcd5c('0x3c'),'where':_0x14a0b7,'limit':0x1,'order':[[_0xcd5c('0x2e'),_0xcd5c('0x3d')]]}]},{'model':db[_0xcd5c('0x3e')],'as':_0xcd5c('0x3f')}]});})[_0xcd5c('0xf')](function(_0x5b7ef7){if(_0x5b7ef7&&_0x5b7ef7[_0xcd5c('0x3b')]){var _0x2a2303=_0x5b7ef7[_0xcd5c('0x40')]({'plain':!![]});_0x34386d[_0xcd5c('0x39')]=_0x2a2303;_0x34386d[_0xcd5c('0x41')]=_0x2a2303[_0xcd5c('0x3f')];_0x34386d[_0xcd5c('0x42')]=_0x2a2303[_0xcd5c('0x3b')];_0x34386d[_0xcd5c('0x41')]=_[_0xcd5c('0x43')](_0x34386d[_0xcd5c('0x41')],[_0xcd5c('0x44')],['asc']);if(_0x34386d['account'][_0xcd5c('0x3f')]){delete _0x34386d[_0xcd5c('0x39')][_0xcd5c('0x3f')];}if(_0x34386d[_0xcd5c('0x39')]['List']&&_0x34386d[_0xcd5c('0x39')]['List'][_0xcd5c('0x3c')][_0xcd5c('0x45')]){return _0x34386d['account'][_0xcd5c('0x3b')][_0xcd5c('0x3c')][0x0];}var _0x4a0584=_[_0xcd5c('0xc')](_0x39f08e[_0xcd5c('0x26')],{'firstName':_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x31')],'ListId':_0x2a2303['ListId']});_0x4a0584[_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x34')]]=_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x31')];return db[_0xcd5c('0x28')][_0xcd5c('0x46')](_0x4a0584,{'fields':_0x4ed50b,'raw':!![]});}})['then'](function(_0x232e8b){_0x34386d['contact']=_0x232e8b;if(_0x232e8b){var _0x34e707={'ContactId':_0x232e8b['id'],'FaxAccountId':_0x39f08e[_0xcd5c('0x39')]['id'],'fax':_0x232e8b[_0xcd5c('0x27')]};return db[_0xcd5c('0x47')][_0xcd5c('0x38')]({'where':{'ContactId':_0x232e8b['id'],'closed':![],'FaxAccountId':_0x39f08e[_0xcd5c('0x39')]['id']}})[_0xcd5c('0xf')](function(_0x454a59){if(_0x454a59){return[_0x454a59,![]];}return db[_0xcd5c('0x47')]['create'](_0x34e707)[_0xcd5c('0xf')](function(_0x34c018){return[_0x34c018,!![]];});});}else{throw new Error(_0xcd5c('0x48'));}})['spread'](function(_0x20b38c,_0x5454a9){var _0x3001b4=_0x20b38c['get']({'plain':!![]});if(_0x5454a9){if(_0x34386d[_0xcd5c('0x39')][_0xcd5c('0x49')]){_0x34386d[_0xcd5c('0x41')][_0xcd5c('0x4a')]({'id':0x0,'priority':_0x34386d['applications'][_0xcd5c('0x45')]+0x1,'app':_0xcd5c('0x4b'),'appdata':_0xcd5c('0x4c'),'interval':_0xcd5c('0x4d')});}_0x3001b4[_0xcd5c('0x4e')]=!![];}else{_0x3001b4['created']=![];}_0x34386d[_0xcd5c('0x4f')]=_0x3001b4;return db['FaxMessage']['create']({'body':_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x26')],'FaxAccountId':_0x39f08e[_0xcd5c('0x39')]['id'],'FaxInteractionId':_0x20b38c['id'],'direction':'in','ContactId':_0x20b38c[_0xcd5c('0x50')],'AttachmentId':_0x39f08e[_0xcd5c('0x26')][_0xcd5c('0x51')]});})[_0xcd5c('0xf')](function(_0x31dcec){_0x34386d[_0xcd5c('0x17')]=_0x31dcec;if(_0x34386d['interaction'][_0xcd5c('0x52')]){return db[_0xcd5c('0x53')][_0xcd5c('0x38')]({'attributes':['id',_0xcd5c('0x54')],'where':{'id':_0x34386d['interaction'][_0xcd5c('0x52')]}})[_0xcd5c('0xf')](function(_0x51b36c){if(_0x51b36c){_0x34386d[_0xcd5c('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcd5c('0x55'),'appdata':_0x51b36c[_0xcd5c('0x54')]+','+(_0x34386d['account'][_0xcd5c('0x56')]||0xa),'interval':_0xcd5c('0x4d')});}return respondWithRpcPromise('Start','startRouting',_0x34386d);});}return respondWithRpcPromise(_0xcd5c('0x57'),_0xcd5c('0x58'),_0x34386d);})['then'](function(_0x4696d9){_0x19f0be(_0x4696d9);})[_0xcd5c('0x19')](function(_0x337895){_0x256ca3(_0x2d90fe[_0xcd5c('0x15')](0x1f4,_0x337895['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 61e6524..67e1dd8 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 _0xa4b3=['removeListener','register','length','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4b3,0xcf));var _0x3a4b=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0xa4b3[_0x143cfd];return _0x2cb5f5;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x3a4b('0x0'),'remove','update'];function createListener(_0x2ca51d,_0x136adb){return function(_0x3e9e9e){_0x136adb['emit'](_0x2ca51d,_0x3e9e9e);};}function removeListener(_0x276019,_0xb2757a){return function(){FaxAccountEvents[_0x3a4b('0x1')](_0x276019,_0xb2757a);};}exports[_0x3a4b('0x2')]=function(_0x17a39c){for(var _0x48b4bd=0x0,_0x22830e=events[_0x3a4b('0x3')];_0x48b4bd<_0x22830e;_0x48b4bd++){var _0x26dc62=events[_0x48b4bd];var _0x551159=createListener('faxAccount:'+_0x26dc62,_0x17a39c);FaxAccountEvents['on'](_0x26dc62,_0x551159);}}; \ No newline at end of file +var _0xbf28=['emit','removeListener','register','length','faxAccount:','./faxAccount.events','remove','update'];(function(_0x40c30a,_0x69c038){var _0x35d6d9=function(_0x1b2ca2){while(--_0x1b2ca2){_0x40c30a['push'](_0x40c30a['shift']());}};_0x35d6d9(++_0x69c038);}(_0xbf28,0x14d));var _0x8bf2=function(_0x4133b7,_0x2e3bd7){_0x4133b7=_0x4133b7-0x0;var _0x107cdc=_0xbf28[_0x4133b7];return _0x107cdc;};'use strict';var FaxAccountEvents=require(_0x8bf2('0x0'));var events=['save',_0x8bf2('0x1'),_0x8bf2('0x2')];function createListener(_0x3cf8ad,_0x1cc7f9){return function(_0x51e3b1){_0x1cc7f9[_0x8bf2('0x3')](_0x3cf8ad,_0x51e3b1);};}function removeListener(_0x5044bb,_0x4d501d){return function(){FaxAccountEvents[_0x8bf2('0x4')](_0x5044bb,_0x4d501d);};}exports[_0x8bf2('0x5')]=function(_0x2155fe){for(var _0x102aef=0x0,_0x2b50ce=events[_0x8bf2('0x6')];_0x102aef<_0x2b50ce;_0x102aef++){var _0x43b110=events[_0x102aef];var _0x4389b6=createListener(_0x8bf2('0x7')+_0x43b110,_0x2155fe);FaxAccountEvents['on'](_0x43b110,_0x4389b6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9819c5b..2f75c81 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(_0x3c1df5,_0x1bc574){var _0x15b848=function(_0xcdaf10){while(--_0xcdaf10){_0x3c1df5['push'](_0x3c1df5['shift']());}};_0x15b848(++_0x1bc574);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x2c09e2,_0x100b38){var _0x2a1416=function(_0x46b7e2){while(--_0x46b7e2){_0x2c09e2['push'](_0x2c09e2['shift']());}};_0x2a1416(++_0x100b38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 39165f6..950b45a 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 _0x3c92=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x1d191b,_0x4a3700){var _0x29d027=function(_0x3f1f0b){while(--_0x3f1f0b){_0x1d191b['push'](_0x1d191b['shift']());}};_0x29d027(++_0x4a3700);}(_0x3c92,0x1d3));var _0x23c9=function(_0x2d18b5,_0x4f9494){_0x2d18b5=_0x2d18b5-0x0;var _0x304f2a=_0x3c92[_0x2d18b5];return _0x304f2a;};'use strict';var Sequelize=require(_0x23c9('0x0'));module[_0x23c9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x23c9('0x2')],'allowNull':![],'defaultValue':_0x23c9('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x23c9('0x2')],'defaultValue':_0x23c9('0x4')}}; \ No newline at end of file +var _0x88b3=['sequelize','exports','STRING','TEXT','*,*,*,*'];(function(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0x88b3,0x82));var _0x388b=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x88b3[_0x622035];return _0x326cf2;};'use strict';var Sequelize=require(_0x388b('0x0'));module[_0x388b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x388b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x388b('0x3')]()},'description':{'type':Sequelize[_0x388b('0x2')]},'interval':{'type':Sequelize[_0x388b('0x2')],'defaultValue':_0x388b('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ab96972..b811f1e 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 _0xd3e5=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','keys','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','find','create','body','update','params'];(function(_0x51e51e,_0x1d852d){var _0x5ce929=function(_0x1b804e){while(--_0x1b804e){_0x51e51e['push'](_0x51e51e['shift']());}};_0x5ce929(++_0x1d852d);}(_0xd3e5,0x1e6));var _0x5d3e=function(_0x1c9bbf,_0x5bb335){_0x1c9bbf=_0x1c9bbf-0x0;var _0x18b57f=_0xd3e5[_0x1c9bbf];return _0x18b57f;};'use strict';var emlformat=require(_0x5d3e('0x0'));var rimraf=require(_0x5d3e('0x1'));var zipdir=require(_0x5d3e('0x2'));var jsonpatch=require(_0x5d3e('0x3'));var rp=require(_0x5d3e('0x4'));var moment=require(_0x5d3e('0x5'));var BPromise=require(_0x5d3e('0x6'));var Mustache=require('mustache');var util=require(_0x5d3e('0x7'));var path=require(_0x5d3e('0x8'));var sox=require(_0x5d3e('0x9'));var csv=require(_0x5d3e('0xa'));var ejs=require(_0x5d3e('0xb'));var fs=require('fs');var fs_extra=require(_0x5d3e('0xc'));var _=require(_0x5d3e('0xd'));var squel=require(_0x5d3e('0xe'));var crypto=require(_0x5d3e('0xf'));var jsforce=require(_0x5d3e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5d3e('0x11'));var Papa=require(_0x5d3e('0x12'));var Redis=require(_0x5d3e('0x13'));var authService=require(_0x5d3e('0x14'));var qs=require(_0x5d3e('0x15'));var as=require(_0x5d3e('0x16'));var hardwareService=require(_0x5d3e('0x17'));var logger=require(_0x5d3e('0x18'))(_0x5d3e('0x19'));var utils=require(_0x5d3e('0x1a'));var config=require(_0x5d3e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d3e('0x1c'))['db'];function respondWithStatusCode(_0x25aa64,_0x486981){_0x486981=_0x486981||0xcc;return function(_0xd50eb5){if(_0xd50eb5){return _0x25aa64[_0x5d3e('0x1d')](_0x486981);}return _0x25aa64['status'](_0x486981)['end']();};}function respondWithResult(_0x3a4658,_0x1f9db8){_0x1f9db8=_0x1f9db8||0xc8;return function(_0x440336){if(_0x440336){return _0x3a4658[_0x5d3e('0x1e')](_0x1f9db8)[_0x5d3e('0x1f')](_0x440336);}};}function respondWithFilteredResult(_0x599d4d,_0xbf9c45){return function(_0x2a318e){if(_0x2a318e){var _0x1e042f=typeof _0xbf9c45[_0x5d3e('0x20')]===_0x5d3e('0x21')&&typeof _0xbf9c45[_0x5d3e('0x22')]===_0x5d3e('0x21');var _0x195187=_0x2a318e['count'];var _0x400dd3=_0x1e042f?0x0:_0xbf9c45[_0x5d3e('0x20')];var _0x547c43=_0x1e042f?_0x2a318e[_0x5d3e('0x23')]:_0xbf9c45['offset']+_0xbf9c45[_0x5d3e('0x22')];var _0x6dd58b;if(_0x547c43>=_0x195187){_0x547c43=_0x195187;_0x6dd58b=0xc8;}else{_0x6dd58b=0xce;}_0x599d4d['status'](_0x6dd58b);return _0x599d4d[_0x5d3e('0x24')](_0x5d3e('0x25'),_0x400dd3+'-'+_0x547c43+'/'+_0x195187)['json'](_0x2a318e);}return null;};}function patchUpdates(_0x17c889){return function(_0x365bc6){try{jsonpatch[_0x5d3e('0x26')](_0x365bc6,_0x17c889,!![]);}catch(_0x5bce05){return BPromise[_0x5d3e('0x27')](_0x5bce05);}return _0x365bc6[_0x5d3e('0x28')]();};}function saveUpdates(_0x597328,_0x5e4661){return function(_0x142134){if(_0x142134){return _0x142134['update'](_0x597328)[_0x5d3e('0x29')](function(_0x3c51d9){return _0x3c51d9;});}return null;};}function removeEntity(_0x547012,_0x3f9123){return function(_0xa4487){if(_0xa4487){return _0xa4487[_0x5d3e('0x2a')]()[_0x5d3e('0x29')](function(){_0x547012[_0x5d3e('0x1e')](0xcc)[_0x5d3e('0x2b')]();});}};}function handleEntityNotFound(_0x159f44,_0x1c2312){return function(_0x1704c4){if(!_0x1704c4){_0x159f44[_0x5d3e('0x1d')](0x194);}return _0x1704c4;};}function handleError(_0x5246e1,_0x223496){_0x223496=_0x223496||0x1f4;return function(_0x1989e7){logger[_0x5d3e('0x2c')](_0x1989e7[_0x5d3e('0x2d')]);if(_0x1989e7['name']){delete _0x1989e7[_0x5d3e('0x2e')];}_0x5246e1[_0x5d3e('0x1e')](_0x223496)[_0x5d3e('0x2f')](_0x1989e7);};}exports[_0x5d3e('0x30')]=function(_0x28853e,_0x23227e){var _0x580698={},_0x392c87={},_0x21aff3={'count':0x0,'rows':[]};var _0x16076d=_['map'](db[_0x5d3e('0x31')][_0x5d3e('0x32')],function(_0x358c0b){return{'name':_0x358c0b[_0x5d3e('0x33')],'type':_0x358c0b[_0x5d3e('0x34')][_0x5d3e('0x35')]};});_0x392c87[_0x5d3e('0x36')]=_[_0x5d3e('0x37')](_0x16076d,_0x5d3e('0x2e'));_0x392c87['query']=_[_0x5d3e('0x38')](_0x28853e['query']);_0x392c87['filters']=_[_0x5d3e('0x39')](_0x392c87[_0x5d3e('0x36')],_0x392c87['query']);_0x580698[_0x5d3e('0x3a')]=_[_0x5d3e('0x39')](_0x392c87[_0x5d3e('0x36')],qs['fields'](_0x28853e[_0x5d3e('0x3b')][_0x5d3e('0x3c')]));_0x580698[_0x5d3e('0x3a')]=_0x580698[_0x5d3e('0x3a')][_0x5d3e('0x3d')]?_0x580698[_0x5d3e('0x3a')]:_0x392c87[_0x5d3e('0x36')];if(!_0x28853e['query'][_0x5d3e('0x3e')](_0x5d3e('0x3f'))){_0x580698[_0x5d3e('0x22')]=qs['limit'](_0x28853e['query'][_0x5d3e('0x22')]);_0x580698[_0x5d3e('0x20')]=qs[_0x5d3e('0x20')](_0x28853e['query'][_0x5d3e('0x20')]);}_0x580698[_0x5d3e('0x40')]=qs['sort'](_0x28853e[_0x5d3e('0x3b')][_0x5d3e('0x41')]);_0x580698[_0x5d3e('0x42')]=qs[_0x5d3e('0x43')](_[_0x5d3e('0x44')](_0x28853e[_0x5d3e('0x3b')],_0x392c87[_0x5d3e('0x43')]),_0x16076d);if(_0x28853e[_0x5d3e('0x3b')][_0x5d3e('0x45')]){_0x580698[_0x5d3e('0x42')]=_[_0x5d3e('0x46')](_0x580698[_0x5d3e('0x42')],{'$or':_[_0x5d3e('0x37')](_0x16076d,function(_0x1242ed){if(_0x1242ed['type']!==_0x5d3e('0x47')){var _0x426a00={};_0x426a00[_0x1242ed['name']]={'$like':'%'+_0x28853e['query'][_0x5d3e('0x45')]+'%'};return _0x426a00;}})});}_0x580698=_[_0x5d3e('0x46')]({},_0x580698,_0x28853e[_0x5d3e('0x48')]);var _0x3f9bf2={'where':_0x580698[_0x5d3e('0x42')]};return db[_0x5d3e('0x31')][_0x5d3e('0x23')](_0x3f9bf2)[_0x5d3e('0x29')](function(_0x394052){_0x21aff3[_0x5d3e('0x23')]=_0x394052;if(_0x28853e[_0x5d3e('0x3b')][_0x5d3e('0x49')]){_0x580698['include']=[{'all':!![]}];}return db[_0x5d3e('0x31')]['findAll'](_0x580698);})['then'](function(_0x4b5af8){_0x21aff3['rows']=_0x4b5af8;return _0x21aff3;})[_0x5d3e('0x29')](respondWithFilteredResult(_0x23227e,_0x580698))[_0x5d3e('0x4a')](handleError(_0x23227e,null));};exports[_0x5d3e('0x4b')]=function(_0x235086,_0x5c16e1){var _0x38f85d={'raw':!![],'where':{'id':_0x235086['params']['id']}},_0x540b79={};_0x540b79['model']=_[_0x5d3e('0x38')](db['FaxApplication'][_0x5d3e('0x32')]);_0x540b79[_0x5d3e('0x3b')]=_['keys'](_0x235086[_0x5d3e('0x3b')]);_0x540b79[_0x5d3e('0x43')]=_[_0x5d3e('0x39')](_0x540b79[_0x5d3e('0x36')],_0x540b79['query']);_0x38f85d['attributes']=_['intersection'](_0x540b79[_0x5d3e('0x36')],qs['fields'](_0x235086[_0x5d3e('0x3b')][_0x5d3e('0x3c')]));_0x38f85d[_0x5d3e('0x3a')]=_0x38f85d[_0x5d3e('0x3a')][_0x5d3e('0x3d')]?_0x38f85d[_0x5d3e('0x3a')]:_0x540b79[_0x5d3e('0x36')];if(_0x235086[_0x5d3e('0x3b')][_0x5d3e('0x49')]){_0x38f85d['include']=[{'all':!![]}];}_0x38f85d=_[_0x5d3e('0x46')]({},_0x38f85d,_0x235086[_0x5d3e('0x48')]);return db[_0x5d3e('0x31')][_0x5d3e('0x4c')](_0x38f85d)['then'](handleEntityNotFound(_0x5c16e1,null))[_0x5d3e('0x29')](respondWithResult(_0x5c16e1,null))['catch'](handleError(_0x5c16e1,null));};exports[_0x5d3e('0x4d')]=function(_0x34e902,_0x37d8ce){return db['FaxApplication']['create'](_0x34e902[_0x5d3e('0x4e')],{})[_0x5d3e('0x29')](respondWithResult(_0x37d8ce,0xc9))[_0x5d3e('0x4a')](handleError(_0x37d8ce,null));};exports[_0x5d3e('0x4f')]=function(_0x4ebe88,_0x64de5d){if(_0x4ebe88['body']['id']){delete _0x4ebe88[_0x5d3e('0x4e')]['id'];}return db['FaxApplication'][_0x5d3e('0x4c')]({'where':{'id':_0x4ebe88[_0x5d3e('0x50')]['id']}})['then'](handleEntityNotFound(_0x64de5d,null))[_0x5d3e('0x29')](saveUpdates(_0x4ebe88[_0x5d3e('0x4e')],null))[_0x5d3e('0x29')](respondWithResult(_0x64de5d,null))[_0x5d3e('0x4a')](handleError(_0x64de5d,null));};exports[_0x5d3e('0x2a')]=function(_0x40ccfe,_0x6ee73f){return db['FaxApplication']['find']({'where':{'id':_0x40ccfe[_0x5d3e('0x50')]['id']}})['then'](handleEntityNotFound(_0x6ee73f,null))['then'](removeEntity(_0x6ee73f,null))['catch'](handleError(_0x6ee73f,null));}; \ No newline at end of file +var _0xbcf4=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys'];(function(_0x22bef2,_0x54f207){var _0xe33934=function(_0x20fd53){while(--_0x20fd53){_0x22bef2['push'](_0x22bef2['shift']());}};_0xe33934(++_0x54f207);}(_0xbcf4,0x17f));var _0x4bcf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcf4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4bcf('0x0'));var rimraf=require(_0x4bcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4bcf('0x2'));var moment=require('moment');var BPromise=require(_0x4bcf('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4bcf('0x4'));var csv=require(_0x4bcf('0x5'));var ejs=require(_0x4bcf('0x6'));var fs=require('fs');var fs_extra=require(_0x4bcf('0x7'));var _=require(_0x4bcf('0x8'));var squel=require(_0x4bcf('0x9'));var crypto=require(_0x4bcf('0xa'));var jsforce=require(_0x4bcf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4bcf('0x5'));var querystring=require(_0x4bcf('0xc'));var Papa=require('papaparse');var Redis=require(_0x4bcf('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4bcf('0xe'));var as=require(_0x4bcf('0xf'));var hardwareService=require(_0x4bcf('0x10'));var logger=require(_0x4bcf('0x11'))(_0x4bcf('0x12'));var utils=require('../../config/utils');var config=require(_0x4bcf('0x13'));var licenseUtil=require(_0x4bcf('0x14'));var db=require(_0x4bcf('0x15'))['db'];function respondWithStatusCode(_0x4e024a,_0xef8816){_0xef8816=_0xef8816||0xcc;return function(_0x4fb08f){if(_0x4fb08f){return _0x4e024a['sendStatus'](_0xef8816);}return _0x4e024a['status'](_0xef8816)[_0x4bcf('0x16')]();};}function respondWithResult(_0xbefcde,_0x2ac469){_0x2ac469=_0x2ac469||0xc8;return function(_0x31cb9d){if(_0x31cb9d){return _0xbefcde[_0x4bcf('0x17')](_0x2ac469)['json'](_0x31cb9d);}};}function respondWithFilteredResult(_0x4c817c,_0x343991){return function(_0x28f533){if(_0x28f533){var _0x1490ea=typeof _0x343991['offset']===_0x4bcf('0x18')&&typeof _0x343991['limit']===_0x4bcf('0x18');var _0x37e7a3=_0x28f533[_0x4bcf('0x19')];var _0x29e34c=_0x1490ea?0x0:_0x343991[_0x4bcf('0x1a')];var _0x62c10=_0x1490ea?_0x28f533[_0x4bcf('0x19')]:_0x343991['offset']+_0x343991[_0x4bcf('0x1b')];var _0x5d5f87;if(_0x62c10>=_0x37e7a3){_0x62c10=_0x37e7a3;_0x5d5f87=0xc8;}else{_0x5d5f87=0xce;}_0x4c817c['status'](_0x5d5f87);return _0x4c817c[_0x4bcf('0x1c')](_0x4bcf('0x1d'),_0x29e34c+'-'+_0x62c10+'/'+_0x37e7a3)[_0x4bcf('0x1e')](_0x28f533);}return null;};}function patchUpdates(_0x3c79a6){return function(_0x3713cd){try{jsonpatch[_0x4bcf('0x1f')](_0x3713cd,_0x3c79a6,!![]);}catch(_0x44ced4){return BPromise['reject'](_0x44ced4);}return _0x3713cd[_0x4bcf('0x20')]();};}function saveUpdates(_0x7bc84c,_0x32e11f){return function(_0x1a2b9e){if(_0x1a2b9e){return _0x1a2b9e['update'](_0x7bc84c)['then'](function(_0x466452){return _0x466452;});}return null;};}function removeEntity(_0x5a05dc,_0x163a8d){return function(_0x540d9e){if(_0x540d9e){return _0x540d9e[_0x4bcf('0x21')]()[_0x4bcf('0x22')](function(){_0x5a05dc[_0x4bcf('0x17')](0xcc)[_0x4bcf('0x16')]();});}};}function handleEntityNotFound(_0x5b7d05,_0x3f860f){return function(_0x26987c){if(!_0x26987c){_0x5b7d05[_0x4bcf('0x23')](0x194);}return _0x26987c;};}function handleError(_0x35692c,_0x58dbdb){_0x58dbdb=_0x58dbdb||0x1f4;return function(_0x5e1dae){logger[_0x4bcf('0x24')](_0x5e1dae[_0x4bcf('0x25')]);if(_0x5e1dae[_0x4bcf('0x26')]){delete _0x5e1dae[_0x4bcf('0x26')];}_0x35692c[_0x4bcf('0x17')](_0x58dbdb)[_0x4bcf('0x27')](_0x5e1dae);};}exports[_0x4bcf('0x28')]=function(_0x3dff9b,_0x4d3244){var _0x21f7fa={},_0x51d5e2={},_0xfd5683={'count':0x0,'rows':[]};var _0x4800cc=_[_0x4bcf('0x29')](db[_0x4bcf('0x2a')][_0x4bcf('0x2b')],function(_0x2e1390){return{'name':_0x2e1390[_0x4bcf('0x2c')],'type':_0x2e1390['type'][_0x4bcf('0x2d')]};});_0x51d5e2[_0x4bcf('0x2e')]=_[_0x4bcf('0x29')](_0x4800cc,'name');_0x51d5e2[_0x4bcf('0x2f')]=_[_0x4bcf('0x30')](_0x3dff9b[_0x4bcf('0x2f')]);_0x51d5e2[_0x4bcf('0x31')]=_['intersection'](_0x51d5e2['model'],_0x51d5e2[_0x4bcf('0x2f')]);_0x21f7fa[_0x4bcf('0x32')]=_[_0x4bcf('0x33')](_0x51d5e2[_0x4bcf('0x2e')],qs['fields'](_0x3dff9b[_0x4bcf('0x2f')][_0x4bcf('0x34')]));_0x21f7fa[_0x4bcf('0x32')]=_0x21f7fa[_0x4bcf('0x32')][_0x4bcf('0x35')]?_0x21f7fa[_0x4bcf('0x32')]:_0x51d5e2[_0x4bcf('0x2e')];if(!_0x3dff9b['query'][_0x4bcf('0x36')]('nolimit')){_0x21f7fa['limit']=qs[_0x4bcf('0x1b')](_0x3dff9b[_0x4bcf('0x2f')][_0x4bcf('0x1b')]);_0x21f7fa[_0x4bcf('0x1a')]=qs[_0x4bcf('0x1a')](_0x3dff9b['query']['offset']);}_0x21f7fa[_0x4bcf('0x37')]=qs[_0x4bcf('0x38')](_0x3dff9b[_0x4bcf('0x2f')][_0x4bcf('0x38')]);_0x21f7fa[_0x4bcf('0x39')]=qs['filters'](_[_0x4bcf('0x3a')](_0x3dff9b[_0x4bcf('0x2f')],_0x51d5e2[_0x4bcf('0x31')]),_0x4800cc);if(_0x3dff9b[_0x4bcf('0x2f')][_0x4bcf('0x3b')]){_0x21f7fa[_0x4bcf('0x39')]=_['merge'](_0x21f7fa[_0x4bcf('0x39')],{'$or':_[_0x4bcf('0x29')](_0x4800cc,function(_0x566133){if(_0x566133['type']!==_0x4bcf('0x3c')){var _0x51fddc={};_0x51fddc[_0x566133[_0x4bcf('0x26')]]={'$like':'%'+_0x3dff9b['query'][_0x4bcf('0x3b')]+'%'};return _0x51fddc;}})});}_0x21f7fa=_['merge']({},_0x21f7fa,_0x3dff9b[_0x4bcf('0x3d')]);var _0xab5216={'where':_0x21f7fa[_0x4bcf('0x39')]};return db['FaxApplication'][_0x4bcf('0x19')](_0xab5216)[_0x4bcf('0x22')](function(_0x17448f){_0xfd5683['count']=_0x17448f;if(_0x3dff9b['query'][_0x4bcf('0x3e')]){_0x21f7fa[_0x4bcf('0x3f')]=[{'all':!![]}];}return db[_0x4bcf('0x2a')][_0x4bcf('0x40')](_0x21f7fa);})[_0x4bcf('0x22')](function(_0x4b596b){_0xfd5683[_0x4bcf('0x41')]=_0x4b596b;return _0xfd5683;})[_0x4bcf('0x22')](respondWithFilteredResult(_0x4d3244,_0x21f7fa))[_0x4bcf('0x42')](handleError(_0x4d3244,null));};exports[_0x4bcf('0x43')]=function(_0x53eb20,_0x2822dc){var _0x1152f6={'raw':!![],'where':{'id':_0x53eb20['params']['id']}},_0x48c2e7={};_0x48c2e7['model']=_['keys'](db[_0x4bcf('0x2a')][_0x4bcf('0x2b')]);_0x48c2e7[_0x4bcf('0x2f')]=_['keys'](_0x53eb20['query']);_0x48c2e7[_0x4bcf('0x31')]=_[_0x4bcf('0x33')](_0x48c2e7[_0x4bcf('0x2e')],_0x48c2e7['query']);_0x1152f6['attributes']=_['intersection'](_0x48c2e7[_0x4bcf('0x2e')],qs[_0x4bcf('0x34')](_0x53eb20['query'][_0x4bcf('0x34')]));_0x1152f6[_0x4bcf('0x32')]=_0x1152f6['attributes'][_0x4bcf('0x35')]?_0x1152f6['attributes']:_0x48c2e7['model'];if(_0x53eb20[_0x4bcf('0x2f')]['includeAll']){_0x1152f6[_0x4bcf('0x3f')]=[{'all':!![]}];}_0x1152f6=_['merge']({},_0x1152f6,_0x53eb20[_0x4bcf('0x3d')]);return db[_0x4bcf('0x2a')]['find'](_0x1152f6)[_0x4bcf('0x22')](handleEntityNotFound(_0x2822dc,null))[_0x4bcf('0x22')](respondWithResult(_0x2822dc,null))[_0x4bcf('0x42')](handleError(_0x2822dc,null));};exports[_0x4bcf('0x44')]=function(_0x135729,_0xfaae2e){return db[_0x4bcf('0x2a')][_0x4bcf('0x44')](_0x135729['body'],{})[_0x4bcf('0x22')](respondWithResult(_0xfaae2e,0xc9))[_0x4bcf('0x42')](handleError(_0xfaae2e,null));};exports['update']=function(_0x988bff,_0x2b06cf){if(_0x988bff['body']['id']){delete _0x988bff[_0x4bcf('0x45')]['id'];}return db[_0x4bcf('0x2a')][_0x4bcf('0x46')]({'where':{'id':_0x988bff[_0x4bcf('0x47')]['id']}})[_0x4bcf('0x22')](handleEntityNotFound(_0x2b06cf,null))[_0x4bcf('0x22')](saveUpdates(_0x988bff[_0x4bcf('0x45')],null))[_0x4bcf('0x22')](respondWithResult(_0x2b06cf,null))['catch'](handleError(_0x2b06cf,null));};exports[_0x4bcf('0x21')]=function(_0xb634e9,_0x5020eb){return db[_0x4bcf('0x2a')]['find']({'where':{'id':_0xb634e9[_0x4bcf('0x47')]['id']}})[_0x4bcf('0x22')](handleEntityNotFound(_0x5020eb,null))[_0x4bcf('0x22')](removeEntity(_0x5020eb,null))['catch'](handleError(_0x5020eb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e521ecc..988a38d 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 _0xab79=['../../config/environment','exports','define','FaxApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xab79,0x101));var _0x9ab7=function(_0x47251b,_0x1118ed){_0x47251b=_0x47251b-0x0;var _0x2ee588=_0xab79[_0x47251b];return _0x2ee588;};'use strict';var _=require(_0x9ab7('0x0'));var util=require(_0x9ab7('0x1'));var logger=require(_0x9ab7('0x2'))(_0x9ab7('0x3'));var moment=require(_0x9ab7('0x4'));var BPromise=require(_0x9ab7('0x5'));var rp=require(_0x9ab7('0x6'));var fs=require('fs');var path=require(_0x9ab7('0x7'));var rimraf=require(_0x9ab7('0x8'));var config=require(_0x9ab7('0x9'));var attributes=require('./faxApplication.attributes');module[_0x9ab7('0xa')]=function(_0x4ba1c7,_0x11cc97){return _0x4ba1c7[_0x9ab7('0xb')](_0x9ab7('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ab7('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x394c=['./faxApplication.attributes','exports','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x24dc71,_0x17b0cd){var _0x4ad0bf=function(_0x29e5cf){while(--_0x29e5cf){_0x24dc71['push'](_0x24dc71['shift']());}};_0x4ad0bf(++_0x17b0cd);}(_0x394c,0x109));var _0xc394=function(_0x315b7c,_0x19ff8e){_0x315b7c=_0x315b7c-0x0;var _0x3a99eb=_0x394c[_0x315b7c];return _0x3a99eb;};'use strict';var _=require(_0xc394('0x0'));var util=require(_0xc394('0x1'));var logger=require(_0xc394('0x2'))('api');var moment=require(_0xc394('0x3'));var BPromise=require(_0xc394('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc394('0x5'));var rimraf=require(_0xc394('0x6'));var config=require(_0xc394('0x7'));var attributes=require(_0xc394('0x8'));module[_0xc394('0x9')]=function(_0x4023fd,_0x2c05aa){return _0x4023fd['define']('FaxApplication',attributes,{'tableName':_0xc394('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc394('0xb'),'collate':_0xc394('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0b991ae..7c56835 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 _0xfd8f=['../../config/logger','rpc','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateFaxApplication','FaxApplication','update','options','raw','attributes','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfd8f,0xae));var _0xffd8=function(_0x22f6f1,_0x1690df){_0x22f6f1=_0x22f6f1-0x0;var _0x3ec7f4=_0xfd8f[_0x22f6f1];return _0x3ec7f4;};'use strict';var _=require(_0xffd8('0x0'));var util=require(_0xffd8('0x1'));var moment=require('moment');var BPromise=require(_0xffd8('0x2'));var rs=require(_0xffd8('0x3'));var fs=require('fs');var Redis=require(_0xffd8('0x4'));var db=require(_0xffd8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xffd8('0x6'))(_0xffd8('0x7'));var config=require('../../config/environment');var jayson=require(_0xffd8('0x8'));var client=jayson[_0xffd8('0x9')][_0xffd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1785ea,_0x3245ab,_0x254e4f){return new BPromise(function(_0x519e5d,_0x1fb036){return client[_0xffd8('0xb')](_0x1785ea,_0x254e4f)[_0xffd8('0xc')](function(_0x1275c5){logger['info'](_0xffd8('0xd'),_0x3245ab,_0xffd8('0xe'));logger[_0xffd8('0xf')](_0xffd8('0x10'),_0x3245ab,_0xffd8('0xe'),JSON[_0xffd8('0x11')](_0x1275c5));if(_0x1275c5[_0xffd8('0x12')]){if(_0x1275c5[_0xffd8('0x12')][_0xffd8('0x13')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x3245ab,_0x1275c5['error'][_0xffd8('0x14')]);return _0x1fb036(_0x1275c5[_0xffd8('0x12')][_0xffd8('0x14')]);}logger[_0xffd8('0x12')](_0xffd8('0xd'),_0x3245ab,_0x1275c5['error'][_0xffd8('0x14')]);return _0x519e5d(_0x1275c5[_0xffd8('0x12')][_0xffd8('0x14')]);}else{logger[_0xffd8('0x15')](_0xffd8('0xd'),_0x3245ab,'request\x20sent');_0x519e5d(_0x1275c5[_0xffd8('0x16')][_0xffd8('0x14')]);}})['catch'](function(_0x86251f){logger[_0xffd8('0x12')](_0xffd8('0xd'),_0x3245ab,_0x86251f);_0x1fb036(_0x86251f);});});}exports[_0xffd8('0x17')]=function(_0x421e9a){var _0x391cc7=this;return new Promise(function(_0x4db92a,_0x352192){return db[_0xffd8('0x18')][_0xffd8('0x19')](_0x421e9a['body'],{'raw':_0x421e9a['options']?_0x421e9a[_0xffd8('0x1a')][_0xffd8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x421e9a[_0xffd8('0x1a')]?_0x421e9a['options']['where']||null:null,'attributes':_0x421e9a['options']?_0x421e9a[_0xffd8('0x1a')][_0xffd8('0x1c')]||null:null,'limit':_0x421e9a[_0xffd8('0x1a')]?_0x421e9a[_0xffd8('0x1a')]['limit']||null:null})[_0xffd8('0xc')](function(_0x257672){logger[_0xffd8('0x15')](_0xffd8('0x17'),_0x421e9a);logger['debug'](_0xffd8('0x17'),_0x421e9a,JSON[_0xffd8('0x11')](_0x257672));_0x4db92a(_0x257672);})[_0xffd8('0x1d')](function(_0x5412c3){logger[_0xffd8('0x12')](_0xffd8('0x17'),_0x5412c3['message'],_0x421e9a);_0x352192(_0x391cc7[_0xffd8('0x12')](0x1f4,_0x5412c3[_0xffd8('0x14')]));});});}; \ No newline at end of file +var _0x83fe=['ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateFaxApplication','FaxApplication','body','options','raw','where','limit','debug','lodash','util','moment'];(function(_0x176683,_0x168eb1){var _0x41ab61=function(_0x30b18e){while(--_0x30b18e){_0x176683['push'](_0x176683['shift']());}};_0x41ab61(++_0x168eb1);}(_0x83fe,0xc5));var _0xe83f=function(_0x58494f,_0x5e3a89){_0x58494f=_0x58494f-0x0;var _0x2f0783=_0x83fe[_0x58494f];return _0x2f0783;};'use strict';var _=require(_0xe83f('0x0'));var util=require(_0xe83f('0x1'));var moment=require(_0xe83f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe83f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe83f('0x4'));var logger=require(_0xe83f('0x5'))('rpc');var config=require(_0xe83f('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3fc2,_0x6a6412,_0x2b53fb){return new BPromise(function(_0x2f34a9,_0x1dab19){return client[_0xe83f('0x7')](_0x4a3fc2,_0x2b53fb)[_0xe83f('0x8')](function(_0xcc017c){logger['info'](_0xe83f('0x9'),_0x6a6412,_0xe83f('0xa'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x6a6412,'request\x20sent',JSON[_0xe83f('0xb')](_0xcc017c));if(_0xcc017c[_0xe83f('0xc')]){if(_0xcc017c['error'][_0xe83f('0xd')]===0x1f4){logger[_0xe83f('0xc')](_0xe83f('0x9'),_0x6a6412,_0xcc017c['error'][_0xe83f('0xe')]);return _0x1dab19(_0xcc017c[_0xe83f('0xc')][_0xe83f('0xe')]);}logger[_0xe83f('0xc')](_0xe83f('0x9'),_0x6a6412,_0xcc017c['error'][_0xe83f('0xe')]);return _0x2f34a9(_0xcc017c['error'][_0xe83f('0xe')]);}else{logger[_0xe83f('0xf')](_0xe83f('0x9'),_0x6a6412,_0xe83f('0xa'));_0x2f34a9(_0xcc017c[_0xe83f('0x10')][_0xe83f('0xe')]);}})['catch'](function(_0xb74a25){logger[_0xe83f('0xc')]('FaxApplication,\x20%s,\x20%s',_0x6a6412,_0xb74a25);_0x1dab19(_0xb74a25);});});}exports[_0xe83f('0x11')]=function(_0x2a2a48){var _0x48ae40=this;return new Promise(function(_0x23900c,_0x445455){return db[_0xe83f('0x12')]['update'](_0x2a2a48[_0xe83f('0x13')],{'raw':_0x2a2a48[_0xe83f('0x14')]?_0x2a2a48[_0xe83f('0x14')][_0xe83f('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2a48[_0xe83f('0x14')]?_0x2a2a48[_0xe83f('0x14')][_0xe83f('0x16')]||null:null,'attributes':_0x2a2a48[_0xe83f('0x14')]?_0x2a2a48['options']['attributes']||null:null,'limit':_0x2a2a48['options']?_0x2a2a48[_0xe83f('0x14')][_0xe83f('0x17')]||null:null})[_0xe83f('0x8')](function(_0x5eefcc){logger['info']('UpdateFaxApplication',_0x2a2a48);logger[_0xe83f('0x18')]('UpdateFaxApplication',_0x2a2a48,JSON[_0xe83f('0xb')](_0x5eefcc));_0x23900c(_0x5eefcc);})['catch'](function(_0x22c623){logger[_0xe83f('0xc')](_0xe83f('0x11'),_0x22c623['message'],_0x2a2a48);_0x445455(_0x48ae40[_0xe83f('0xc')](0x1f4,_0x22c623[_0xe83f('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b722d58..aaee8bb 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x525d1c,_0x58b3ce){var _0x53fe61=function(_0x5a9a13){while(--_0x5a9a13){_0x525d1c['push'](_0x525d1c['shift']());}};_0x53fe61(++_0x58b3ce);}(_0xac4a,0x13f));var _0xaac4=function(_0x5affa1,_0x4332f6){_0x5affa1=_0x5affa1-0x0;var _0x4ac0bb=_0xac4a[_0x5affa1];return _0x4ac0bb;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0x4213=['post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0xd15ad3,_0x303230){var _0x28dfe3=function(_0x135098){while(--_0x135098){_0xd15ad3['push'](_0xd15ad3['shift']());}};_0x28dfe3(++_0x303230);}(_0x4213,0x77));var _0x3421=function(_0x507c0d,_0x1b2648){_0x507c0d=_0x507c0d-0x0;var _0x468de6=_0x4213[_0x507c0d];return _0x468de6;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0xe')]('/',auth[_0x3421('0xa')](),controller['create']);router[_0x3421('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3421('0x10')]);router['delete'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);module[_0x3421('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 8e86bb2..0dbbb71 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 _0x013b=['sequelize','STRING','DATE','out','ENUM'];(function(_0x25171a,_0x17dbba){var _0x149349=function(_0x1eca89){while(--_0x1eca89){_0x25171a['push'](_0x25171a['shift']());}};_0x149349(++_0x17dbba);}(_0x013b,0xb9));var _0xb013=function(_0x312634,_0x165c8e){_0x312634=_0x312634-0x0;var _0x34a887=_0x013b[_0x312634];return _0x34a887;};'use strict';var Sequelize=require(_0xb013('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb013('0x1')]},'secondDisposition':{'type':Sequelize[_0xb013('0x1')]},'thirdDisposition':{'type':Sequelize[_0xb013('0x1')]},'note':{'type':Sequelize[_0xb013('0x1')]},'read1stAt':{'type':Sequelize[_0xb013('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb013('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb013('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb013('0x4')]('in',_0xb013('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6dbe=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x2f1629,_0x42e29e){var _0x15d647=function(_0x161338){while(--_0x161338){_0x2f1629['push'](_0x2f1629['shift']());}};_0x15d647(++_0x42e29e);}(_0x6dbe,0x1b0));var _0xe6db=function(_0x1e9031,_0x25d9a6){_0x1e9031=_0x1e9031-0x0;var _0x5b75fc=_0x6dbe[_0x1e9031];return _0x5b75fc;};'use strict';var Sequelize=require(_0xe6db('0x0'));module[_0xe6db('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe6db('0x2')]},'disposition':{'type':Sequelize[_0xe6db('0x3')]},'secondDisposition':{'type':Sequelize[_0xe6db('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xe6db('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe6db('0x4')]('in',_0xe6db('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe6db('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe6db('0x4')]('in',_0xe6db('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 e9fea51..9df3edf 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 _0x6a44=['Messages','get','basename','existsSync','createReadStream','createWriteStream','download','err','unlinkSync','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','Users','TagIds','Tags','forEach','push','index','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','color','tools_tags','u.id','ui.FaxInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','catch','show','includeAll','include','options','create','params','describe','addMessage','omit','ids','getMessages','FaxMessage','nolimit','pick','format','addTags','spread','emit','faxInteractionTags:save','removeTags','unix','root','server','tmp','join','files','attachments','Attachment'];(function(_0x122be8,_0xd03cc1){var _0x151c90=function(_0x33948e){while(--_0x33948e){_0x122be8['push'](_0x122be8['shift']());}};_0x151c90(++_0xd03cc1);}(_0x6a44,0xdd));var _0x46a4=function(_0x4b1821,_0x24dbb4){_0x4b1821=_0x4b1821-0x0;var _0x510508=_0x6a44[_0x4b1821];return _0x510508;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x46a4('0x0'));var rp=require(_0x46a4('0x1'));var moment=require(_0x46a4('0x2'));var BPromise=require(_0x46a4('0x3'));var Mustache=require(_0x46a4('0x4'));var util=require('util');var path=require(_0x46a4('0x5'));var sox=require(_0x46a4('0x6'));var csv=require(_0x46a4('0x7'));var ejs=require(_0x46a4('0x8'));var fs=require('fs');var fs_extra=require(_0x46a4('0x9'));var _=require('lodash');var squel=require(_0x46a4('0xa'));var crypto=require(_0x46a4('0xb'));var jsforce=require(_0x46a4('0xc'));var deskjs=require(_0x46a4('0xd'));var toCsv=require(_0x46a4('0x7'));var querystring=require(_0x46a4('0xe'));var Papa=require('papaparse');var Redis=require(_0x46a4('0xf'));var authService=require(_0x46a4('0x10'));var qs=require(_0x46a4('0x11'));var as=require(_0x46a4('0x12'));var hardwareService=require(_0x46a4('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x46a4('0x14'));var config=require(_0x46a4('0x15'));var licenseUtil=require(_0x46a4('0x16'));var db=require(_0x46a4('0x17'))['db'];config[_0x46a4('0x18')]=_['defaults'](config[_0x46a4('0x18')],{'host':_0x46a4('0x19'),'port':0x18eb});var socket=require(_0x46a4('0x1a'))(new Redis(config[_0x46a4('0x18')]));require(_0x46a4('0x1b'))[_0x46a4('0x1c')](socket);function respondWithStatusCode(_0x469cc9,_0x2d49d8){_0x2d49d8=_0x2d49d8||0xcc;return function(_0x3672df){if(_0x3672df){return _0x469cc9[_0x46a4('0x1d')](_0x2d49d8);}return _0x469cc9[_0x46a4('0x1e')](_0x2d49d8)['end']();};}function respondWithResult(_0x230375,_0xc713cf){_0xc713cf=_0xc713cf||0xc8;return function(_0x5cc0ca){if(_0x5cc0ca){return _0x230375[_0x46a4('0x1e')](_0xc713cf)[_0x46a4('0x1f')](_0x5cc0ca);}};}function respondWithFilteredResult(_0xc4b4f3,_0x2463bc){return function(_0x9204f3){if(_0x9204f3){var _0x538e6d=typeof _0x2463bc[_0x46a4('0x20')]===_0x46a4('0x21')&&typeof _0x2463bc[_0x46a4('0x22')]===_0x46a4('0x21');var _0x3dd51b=_0x9204f3['count'];var _0x1db90e=_0x538e6d?0x0:_0x2463bc[_0x46a4('0x20')];var _0x10d8fb=_0x538e6d?_0x9204f3[_0x46a4('0x23')]:_0x2463bc[_0x46a4('0x20')]+_0x2463bc[_0x46a4('0x22')];var _0x3347d7;if(_0x10d8fb>=_0x3dd51b){_0x10d8fb=_0x3dd51b;_0x3347d7=0xc8;}else{_0x3347d7=0xce;}_0xc4b4f3['status'](_0x3347d7);return _0xc4b4f3[_0x46a4('0x24')](_0x46a4('0x25'),_0x1db90e+'-'+_0x10d8fb+'/'+_0x3dd51b)[_0x46a4('0x1f')](_0x9204f3);}return null;};}function patchUpdates(_0x5d60f0){return function(_0x1d1c60){try{jsonpatch[_0x46a4('0x26')](_0x1d1c60,_0x5d60f0,!![]);}catch(_0x2131b4){return BPromise[_0x46a4('0x27')](_0x2131b4);}return _0x1d1c60[_0x46a4('0x28')]();};}function saveUpdates(_0x14ffc9,_0x19138c){return function(_0x59a6d3){if(_0x59a6d3){return _0x59a6d3[_0x46a4('0x29')](_0x14ffc9)[_0x46a4('0x2a')](function(_0x5320d0){return _0x5320d0;});}return null;};}function removeEntity(_0x521256,_0x3c97f4){return function(_0x703891){if(_0x703891){return _0x703891[_0x46a4('0x2b')]()[_0x46a4('0x2a')](function(){_0x521256['status'](0xcc)[_0x46a4('0x2c')]();});}};}function handleEntityNotFound(_0x460edd,_0x13fe65){return function(_0x5b49f6){if(!_0x5b49f6){_0x460edd['sendStatus'](0x194);}return _0x5b49f6;};}function handleError(_0x3d90ac,_0x420455){_0x420455=_0x420455||0x1f4;return function(_0x599c6d){logger['error'](_0x599c6d[_0x46a4('0x2d')]);if(_0x599c6d[_0x46a4('0x2e')]){delete _0x599c6d[_0x46a4('0x2e')];}_0x3d90ac[_0x46a4('0x1e')](_0x420455)['send'](_0x599c6d);};}function getInteractionUsers(_0xc28a47,_0x169eab){return new BPromise(function(_0x32e370,_0x379a45){try{if(_0x169eab[_0xc28a47['id']]){_0xc28a47[_0x46a4('0x2f')]=_['map'](_0x169eab[_0xc28a47['id']],function(_0x856fa0){return{'id':_0x856fa0['id'],'fullname':_0x856fa0['fullname']};});}}catch(_0x41f59d){_0x379a45(_0x41f59d);}_0x32e370(_0xc28a47);});}function getInteractionTags(_0x25a740,_0x1af09d){return new BPromise(function(_0xe66936,_0x1259e4){try{if(_0x25a740[_0x46a4('0x30')]){_0x25a740[_0x46a4('0x31')]=[];_0x25a740[_0x46a4('0x30')]['split'](',')[_0x46a4('0x32')](function(_0x576207){_0x25a740['Tags'][_0x46a4('0x33')](_0x1af09d[_0x576207]);});}delete _0x25a740[_0x46a4('0x30')];}catch(_0x4bfdea){_0x1259e4(_0x4bfdea);}_0xe66936(_0x25a740);});}function updateFaxInteraction(_0x1b2c36,_0x18529d,_0x4e52fc){return new BPromise(function(_0x19c6cd,_0x20d13d){return getInteractionUsers(_0x1b2c36,_0x4e52fc)[_0x46a4('0x2a')](function(_0x72c85f){return getInteractionTags(_0x72c85f,_0x18529d);})[_0x46a4('0x2a')](function(_0x695b53){_0x19c6cd(_0x695b53);})['catch'](function(_0x931d56){_0x20d13d(_0x931d56);});});}exports[_0x46a4('0x34')]=function(_0x39eae1,_0x3482a4){var _0x5cd382={},_0x54ef30={},_0x100f8c={'count':0x0,'rows':[]};var _0x3df98a=_['map'](db['FaxInteraction'][_0x46a4('0x35')],function(_0x3570c3){return{'name':_0x3570c3[_0x46a4('0x36')],'type':_0x3570c3[_0x46a4('0x37')]['key']};});_0x54ef30['model']=_['map'](_0x3df98a,_0x46a4('0x2e'));_0x54ef30[_0x46a4('0x38')]=_[_0x46a4('0x39')](_0x39eae1[_0x46a4('0x38')]);_0x54ef30[_0x46a4('0x3a')]=_[_0x46a4('0x3b')](_0x54ef30[_0x46a4('0x3c')],_0x54ef30[_0x46a4('0x38')]);_0x5cd382[_0x46a4('0x3d')]=_[_0x46a4('0x3b')](_0x54ef30[_0x46a4('0x3c')],qs[_0x46a4('0x3e')](_0x39eae1[_0x46a4('0x38')][_0x46a4('0x3e')]));_0x5cd382['attributes']=_0x5cd382[_0x46a4('0x3d')][_0x46a4('0x3f')]?_0x5cd382[_0x46a4('0x3d')]:_0x54ef30[_0x46a4('0x3c')];if(!_0x39eae1['query'][_0x46a4('0x40')]('nolimit')){_0x5cd382[_0x46a4('0x22')]=qs['limit'](_0x39eae1[_0x46a4('0x38')][_0x46a4('0x22')]);_0x5cd382[_0x46a4('0x20')]=qs[_0x46a4('0x20')](_0x39eae1['query'][_0x46a4('0x20')]);}_0x5cd382[_0x46a4('0x41')]=qs[_0x46a4('0x42')](_0x39eae1[_0x46a4('0x38')][_0x46a4('0x42')]);_0x5cd382[_0x46a4('0x43')]=qs['filters'](_['pick'](_0x39eae1[_0x46a4('0x38')],_0x54ef30[_0x46a4('0x3a')]),_0x3df98a);var _0x532f08=[];var _0x1896fa=squel[_0x46a4('0x44')]()[_0x46a4('0x45')]('id')[_0x46a4('0x45')](_0x46a4('0x2e'))[_0x46a4('0x45')](_0x46a4('0x46'))['from'](_0x46a4('0x47'));var _0x5ee5ef=squel[_0x46a4('0x44')]()[_0x46a4('0x45')](_0x46a4('0x48'))[_0x46a4('0x45')]('u.fullname')[_0x46a4('0x45')](_0x46a4('0x49'))[_0x46a4('0x4a')]('user_has_fax_interactions','ui')[_0x46a4('0x4b')](_0x46a4('0x4c'),'u',_0x46a4('0x4d'));var _0x4529e9=squel['select']()[_0x46a4('0x4a')](_0x46a4('0x4e'),'i')[_0x46a4('0x4b')](_0x46a4('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x46a4('0x4b')]('users','o',_0x46a4('0x50'))[_0x46a4('0x4b')]('fax_accounts','a',_0x46a4('0x51'))[_0x46a4('0x4b')](_0x46a4('0x52'),'me',_0x46a4('0x53'))['left_join'](_0x46a4('0x54'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x46a4('0x4b')](_0x46a4('0x47'),'t',_0x46a4('0x55'));var _0x411e73=squel[_0x46a4('0x56')]();var _0x568526=[];var _0x4297c6=squel[_0x46a4('0x56')]();var _0x2b215f;if(_0x39eae1[_0x46a4('0x38')][_0x46a4('0x57')]){_0x2b215f=as[_0x46a4('0x58')](_0x39eae1[_0x46a4('0x38')][_0x46a4('0x57')]);var _0x3f4c04=_0x2b215f[_0x46a4('0x59')];for(var _0x4b092e=0x0;_0x4b092e<_0x2b215f[_0x46a4('0x5a')][_0x46a4('0x3f')];_0x4b092e++){var _0x555689=_0x2b215f['conditions'][_0x4b092e];var _0x5abde4='i';var _0x5e421d=_[_0x46a4('0x5b')](_0x3df98a,['name',_0x555689[_0x46a4('0x45')]]);if(!_0x5e421d){switch(_0x555689[_0x46a4('0x45')]){case _0x46a4('0x5c'):if(_0x555689[_0x46a4('0x5d')]==0x1){_0x4529e9[_0x46a4('0x5e')]('`'+_0x555689['field']+_0x46a4('0x5f'));}else{_0x4529e9['having']('`'+_0x555689['field']+'`\x20>\x200');}break;case _0x46a4('0x60'):if(_0x555689[_0x46a4('0x61')]===_0x46a4('0x62')){if(_0x555689[_0x46a4('0x5d')][_0x46a4('0x63')]('\x20')[_0x46a4('0x3f')]>0x1){_0x411e73[_0x3f4c04](_0x46a4('0x64'),qs[_0x46a4('0x65')](_0x555689[_0x46a4('0x5d')]),null);}else{var _0x3ae0f1='%'+_0x555689[_0x46a4('0x5d')]+'%';_0x411e73[_0x3f4c04](_0x46a4('0x66'),_0x3ae0f1,_0x3ae0f1,_0x3ae0f1);}}else{_0x5e421d=_[_0x46a4('0x5b')](_0x3df98a,[_0x46a4('0x2e'),'ContactId']);_0x555689[_0x46a4('0x45')]=_0x46a4('0x67');_0xa1dc2a=as['buildExpression'](_0x5abde4,_0x5e421d[_0x46a4('0x37')],_0x555689);_0x411e73[_0x3f4c04](_0xa1dc2a[_0x46a4('0x68')],_0xa1dc2a[_0x46a4('0x5d')][_0x46a4('0x69')],_0xa1dc2a[_0x46a4('0x5d')][_0x46a4('0x2c')]);}break;case _0x46a4('0x6a'):var _0x3f2d69=_0x555689[_0x46a4('0x5d')][_0x46a4('0x63')](',')[_0x46a4('0x6b')](function(_0x294af9){return Number(_0x294af9);});_0x3f2d69['forEach'](function(_0x2cfe2e){_0x4297c6['or'](_0x46a4('0x6c'),'%,'+_0x2cfe2e+',%');});_0x568526=_['union'](_0x568526,_0x3f2d69);break;case _0x46a4('0x6d'):if(_0x555689['operator']===_0x46a4('0x62')){_0x411e73[_0x3f4c04](_0x46a4('0x6e'),'%'+_0x555689[_0x46a4('0x5d')]+'%',null);}else{_0x5e421d=_[_0x46a4('0x5b')](_0x3df98a,['name',_0x46a4('0x6f')]);_0x555689['field']=_0x46a4('0x6f');_0xa1dc2a=as[_0x46a4('0x70')](_0x5abde4,_0x5e421d[_0x46a4('0x37')],_0x555689);_0x411e73[_0x3f4c04](_0xa1dc2a['text'],_0xa1dc2a[_0x46a4('0x5d')]['start'],_0xa1dc2a[_0x46a4('0x5d')][_0x46a4('0x2c')]);}break;case _0x46a4('0x71'):_0xa1dc2a=as[_0x46a4('0x70')]('me',null,_0x555689);_0x411e73[_0x3f4c04](_0xa1dc2a[_0x46a4('0x68')],_0xa1dc2a[_0x46a4('0x5d')]['start'],_0xa1dc2a[_0x46a4('0x5d')][_0x46a4('0x2c')]);break;}}else{var _0xa1dc2a=as[_0x46a4('0x70')](_0x5abde4,_0x5e421d[_0x46a4('0x37')],_0x555689);_0x411e73[_0x3f4c04](_0xa1dc2a[_0x46a4('0x68')],_0xa1dc2a['value'][_0x46a4('0x69')],_0xa1dc2a[_0x46a4('0x5d')][_0x46a4('0x2c')]);}}}else{var _0x32928c=_(_0x39eae1[_0x46a4('0x38')])['keys']()['map'](function(_0x1382c8){return _[_0x46a4('0x72')](_0x3df98a,[_0x46a4('0x2e'),_0x1382c8])?_0x1382c8:undefined;})[_0x46a4('0x73')]()[_0x46a4('0x5d')]();if(!_[_0x46a4('0x74')](_0x32928c)){_0x32928c['forEach'](function(_0x4df9b4){if(_0x4df9b4===_0x46a4('0x75')){_0x4529e9[_0x46a4('0x43')](_0x46a4('0x76'),[][_0x46a4('0x77')](_0x39eae1[_0x46a4('0x38')][_0x4df9b4]));}else if(_0x4df9b4===_0x46a4('0x78')){var _0x1dda18=JSON[_0x46a4('0x79')](_0x39eae1[_0x46a4('0x38')][_0x4df9b4])[_0x46a4('0x7a')];var _0x21a183=JSON[_0x46a4('0x79')](_0x39eae1[_0x46a4('0x38')][_0x4df9b4])['$lte'];_0x4529e9[_0x46a4('0x43')](_0x46a4('0x7b'),_0x1dda18,_0x21a183);}else{if(_0x39eae1[_0x46a4('0x38')][_0x4df9b4]==='null'){_0x4529e9[_0x46a4('0x43')]('i.'+_0x4df9b4+_0x46a4('0x7c'));}else{_0x4529e9[_0x46a4('0x43')]('i.'+_0x4df9b4+'\x20=\x20?',_0x39eae1[_0x46a4('0x38')][_0x4df9b4]);}}});}if(_0x39eae1[_0x46a4('0x38')][_0x46a4('0x7d')]){if(_0x39eae1[_0x46a4('0x38')]['read']==0x1){_0x4529e9[_0x46a4('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x4529e9['having']('`unreadMessages`\x20>\x200');}}if(_0x39eae1['query'][_0x46a4('0x7e')]){_0x568526=_[_0x46a4('0x7f')](_0x39eae1['query'][_0x46a4('0x7e')])?_0x39eae1[_0x46a4('0x38')][_0x46a4('0x7e')]:new Array(_0x39eae1['query']['tag']);_0x568526['forEach'](function(_0x4ef3a1){_0x4297c6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4ef3a1+',%');});}if(_0x39eae1[_0x46a4('0x38')][_0x46a4('0x80')]){var _0x42784a=_0x39eae1[_0x46a4('0x38')][_0x46a4('0x80')][_0x46a4('0x81')]('\x5c','\x5c\x5c')[_0x46a4('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x42784a)){_0x411e73['or'](_0x46a4('0x82'),_0x42784a+'%')['or'](_0x46a4('0x83'),_0x42784a+'%');}_0x411e73['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x42784a+'%');}}_0x4529e9['where'](_0x411e73);_0x4529e9[_0x46a4('0x84')](_0x46a4('0x85'));var _0x487066={'type':db[_0x46a4('0x86')]['QueryTypes'][_0x46a4('0x87')],'raw':!![]};var _0x57f310=_0x4529e9[_0x46a4('0x88')]();_0x57f310[_0x46a4('0x45')](_0x46a4('0x85'));_0x57f310[_0x46a4('0x45')](_0x46a4('0x89'),_0x46a4('0x5c'));if(_0x5cd382[_0x46a4('0x41')]){_0x5cd382[_0x46a4('0x41')]['forEach'](function(_0x56629e){var _0x4afd6f=_0x56629e[0x0]===_0x46a4('0x8a')?_0x56629e[0x0]:'i.'+_0x56629e[0x0];_0x4529e9[_0x46a4('0x41')](_0x4afd6f,_0x56629e[0x1]===_0x46a4('0x8b')?![]:!![]);});}if(!_[_0x46a4('0x74')](_0x568526)){_0x4529e9[_0x46a4('0x5e')](_0x4297c6);_0x57f310['where'](_0x46a4('0x8c'),_0x568526);}BPromise[_0x46a4('0x8d')]()[_0x46a4('0x2a')](function(){if(!_0x2b215f){if(_0x39eae1['query'][_0x46a4('0x75')])return;_0x57f310[_0x46a4('0x43')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x4529e9[_0x46a4('0x43')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x39eae1[_0x46a4('0x8e')][_0x46a4('0x8f')]!==_0x46a4('0x90'))return;return _0x39eae1['user'][_0x46a4('0x91')]({'attributes':['id'],'raw':!![]})[_0x46a4('0x2a')](function(_0x17d1a7){if(_[_0x46a4('0x74')](_0x17d1a7)){_0x57f310['where'](_0x46a4('0x92'));_0x4529e9[_0x46a4('0x43')](_0x46a4('0x92'));}else{_0x57f310[_0x46a4('0x43')]('i.FaxAccountId\x20IN\x20?',_[_0x46a4('0x6b')](_0x17d1a7,'id'));_0x4529e9[_0x46a4('0x43')](_0x46a4('0x76'),_[_0x46a4('0x6b')](_0x17d1a7,'id'));}});})['then'](function(){if(_0x39eae1['user'][_0x46a4('0x8f')]===_0x46a4('0x90')&&!_0x2b215f&&!_0x39eae1[_0x46a4('0x38')][_0x46a4('0x75')])return[];return db[_0x46a4('0x93')][_0x46a4('0x38')](_0x57f310[_0x46a4('0x94')](),_0x487066);})[_0x46a4('0x2a')](function(_0x19df57){_0x100f8c[_0x46a4('0x23')]=_0x19df57[_0x46a4('0x3f')];if(_0x100f8c[_0x46a4('0x23')]===0x0)return[];return db[_0x46a4('0x93')][_0x46a4('0x38')](_0x1896fa['toString'](),_0x487066)[_0x46a4('0x2a')](function(_0x44b9a0){_0x532f08=_[_0x46a4('0x95')](_0x44b9a0,'id');_0x487066=_[_0x46a4('0x96')](_0x487066,{'model':db[_0x46a4('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39eae1[_0x46a4('0x38')]['fields']){_0x5cd382['attributes'][_0x46a4('0x32')](function(_0x19f916){_0x4529e9[_0x46a4('0x45')]('i.'+_0x19f916);});}else{_0x4529e9[_0x46a4('0x45')](_0x46a4('0x89'),_0x46a4('0x5c'));_0x4529e9[_0x46a4('0x45')](_0x46a4('0x98'),_0x46a4('0x99'));_0x4529e9[_0x46a4('0x45')](_0x46a4('0x9a'),'Account.mandatoryDisposition');_0x4529e9['field'](_0x46a4('0x9b'),'contactName');_0x4529e9[_0x46a4('0x45')]('i.*');_0x4529e9['field'](_0x46a4('0x9c'),_0x46a4('0x9d'));_0x4529e9[_0x46a4('0x45')](_0x46a4('0x9e'),_0x46a4('0x9f'));_0x4529e9[_0x46a4('0x45')](_0x46a4('0xa0'),_0x46a4('0xa1'));_0x4529e9[_0x46a4('0x45')](_0x46a4('0xa2'),_0x46a4('0xa3'));_0x4529e9[_0x46a4('0x45')](_0x46a4('0xa4'),_0x46a4('0xa5'));_0x4529e9[_0x46a4('0x45')]('c.fax',_0x46a4('0xa6'));_0x4529e9[_0x46a4('0x45')]('o.fullname',_0x46a4('0xa7'));_0x4529e9[_0x46a4('0x45')]('o.internal',_0x46a4('0xa8'));_0x4529e9[_0x46a4('0x45')](_0x46a4('0xa9'),_0x46a4('0x30'));}if(_0x5cd382[_0x46a4('0x22')])_0x4529e9['limit'](_0x5cd382[_0x46a4('0x22')]);if(_0x5cd382[_0x46a4('0x20')])_0x4529e9[_0x46a4('0x20')](_0x5cd382[_0x46a4('0x20')]);return db['sequelize'][_0x46a4('0x38')](_0x4529e9[_0x46a4('0x94')](),_0x487066);})[_0x46a4('0x2a')](function(_0x5dae9e){if(_0x5dae9e[_0x46a4('0x3f')]>0x0)_0x5ee5ef[_0x46a4('0x43')](_0x46a4('0xaa'),_[_0x46a4('0x6b')](_0x5dae9e,'id'));return db[_0x46a4('0x93')]['query'](_0x5ee5ef[_0x46a4('0x94')](),_0x487066)[_0x46a4('0x2a')](function(_0x492eb0){var _0x24cbf8=_[_0x46a4('0xab')](_0x492eb0,_0x46a4('0xac'));var _0xeb8df5=[];_0x5dae9e['forEach'](function(_0x15c427){_0xeb8df5[_0x46a4('0x33')](updateFaxInteraction(_0x15c427,_0x532f08,_0x24cbf8));});return BPromise[_0x46a4('0xad')](_0xeb8df5);});});})[_0x46a4('0x2a')](function(_0x1b3d00){_0x100f8c['rows']=_0x1b3d00;return _0x100f8c;})[_0x46a4('0x2a')](respondWithFilteredResult(_0x3482a4,_0x5cd382))[_0x46a4('0xae')](handleError(_0x3482a4,null));};exports[_0x46a4('0xaf')]=function(_0x1b7e30,_0x2b3b80){var _0xe7e551={'raw':![],'where':{'id':_0x1b7e30['params']['id']}},_0x50c63c={};_0x50c63c['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0x50c63c[_0x46a4('0x38')]=_['keys'](_0x1b7e30[_0x46a4('0x38')]);_0x50c63c[_0x46a4('0x3a')]=_[_0x46a4('0x3b')](_0x50c63c[_0x46a4('0x3c')],_0x50c63c[_0x46a4('0x38')]);_0xe7e551[_0x46a4('0x3d')]=_['intersection'](_0x50c63c[_0x46a4('0x3c')],qs[_0x46a4('0x3e')](_0x1b7e30['query']['fields']));_0xe7e551[_0x46a4('0x3d')]=_0xe7e551[_0x46a4('0x3d')][_0x46a4('0x3f')]?_0xe7e551[_0x46a4('0x3d')]:_0x50c63c['model'];if(_0x1b7e30['query'][_0x46a4('0xb0')]){_0xe7e551[_0x46a4('0xb1')]=[{'all':!![]}];}_0xe7e551=_['merge']({},_0xe7e551,_0x1b7e30[_0x46a4('0xb2')]);return db[_0x46a4('0x97')][_0x46a4('0x5b')](_0xe7e551)[_0x46a4('0x2a')](handleEntityNotFound(_0x2b3b80,null))[_0x46a4('0x2a')](respondWithResult(_0x2b3b80,null))['catch'](handleError(_0x2b3b80,null));};exports[_0x46a4('0xb3')]=function(_0x39ebec,_0x212cc9){return db[_0x46a4('0x97')][_0x46a4('0xb3')](_0x39ebec['body'],{})['then'](respondWithResult(_0x212cc9,0xc9))['catch'](handleError(_0x212cc9,null));};exports[_0x46a4('0x29')]=function(_0x330e5b,_0x41b9e0){if(_0x330e5b[_0x46a4('0x71')]['id']){delete _0x330e5b[_0x46a4('0x71')]['id'];}return db[_0x46a4('0x97')][_0x46a4('0x5b')]({'where':{'id':_0x330e5b[_0x46a4('0xb4')]['id']}})[_0x46a4('0x2a')](handleEntityNotFound(_0x41b9e0,null))['then'](saveUpdates(_0x330e5b[_0x46a4('0x71')],null))[_0x46a4('0x2a')](respondWithResult(_0x41b9e0,null))[_0x46a4('0xae')](handleError(_0x41b9e0,null));};exports['destroy']=function(_0x4c6b11,_0x1bbace){return db['FaxInteraction'][_0x46a4('0x5b')]({'where':{'id':_0x4c6b11[_0x46a4('0xb4')]['id']}})[_0x46a4('0x2a')](handleEntityNotFound(_0x1bbace,null))['then'](removeEntity(_0x1bbace,null))[_0x46a4('0xae')](handleError(_0x1bbace,null));};exports[_0x46a4('0xb5')]=function(_0x22ea7a,_0x5cdf76){return db[_0x46a4('0x97')][_0x46a4('0xb5')]()[_0x46a4('0x2a')](respondWithResult(_0x5cdf76,null))['catch'](handleError(_0x5cdf76,null));};exports[_0x46a4('0xb6')]=function(_0x302c20,_0x8b5e62,_0x49a99d){return db['FaxMessage'][_0x46a4('0x5b')]({'where':{'id':_0x302c20[_0x46a4('0xb4')]['id']}})[_0x46a4('0x2a')](handleEntityNotFound(_0x8b5e62,null))[_0x46a4('0x2a')](function(_0x43efd5){if(_0x43efd5){return _0x43efd5[_0x46a4('0xb6')](_0x302c20[_0x46a4('0x71')]['ids'],_[_0x46a4('0xb7')](_0x302c20[_0x46a4('0x71')],[_0x46a4('0xb8'),'id'])||{});}})[_0x46a4('0x2a')](respondWithResult(_0x8b5e62,null))['catch'](handleError(_0x8b5e62,null));};exports[_0x46a4('0xb9')]=function(_0x4b58d3,_0x450284,_0x35a470){var _0x57c897={'raw':![],'where':{}};var _0x16d7f1={};var _0x3167ee={'count':0x0,'rows':[]};return db[_0x46a4('0x97')]['findOne']({'where':{'id':_0x4b58d3[_0x46a4('0xb4')]['id']}})[_0x46a4('0x2a')](handleEntityNotFound(_0x450284,null))[_0x46a4('0x2a')](function(_0x46f83e){if(_0x46f83e){_0x16d7f1[_0x46a4('0x3c')]=_['keys'](db[_0x46a4('0xba')][_0x46a4('0x35')]);_0x16d7f1[_0x46a4('0x38')]=_[_0x46a4('0x39')](_0x4b58d3[_0x46a4('0x38')]);_0x16d7f1[_0x46a4('0x3a')]=_['intersection'](_0x16d7f1[_0x46a4('0x3c')],_0x16d7f1['query']);_0x57c897[_0x46a4('0x3d')]=_[_0x46a4('0x3b')](_0x16d7f1[_0x46a4('0x3c')],qs[_0x46a4('0x3e')](_0x4b58d3[_0x46a4('0x38')]['fields']));_0x57c897[_0x46a4('0x3d')]=_0x57c897[_0x46a4('0x3d')][_0x46a4('0x3f')]?_0x57c897['attributes']:_0x16d7f1[_0x46a4('0x3c')];if(!_0x4b58d3[_0x46a4('0x38')][_0x46a4('0x40')](_0x46a4('0xbb'))){_0x57c897['limit']=qs[_0x46a4('0x22')](_0x4b58d3['query'][_0x46a4('0x22')]);_0x57c897[_0x46a4('0x20')]=qs[_0x46a4('0x20')](_0x4b58d3[_0x46a4('0x38')][_0x46a4('0x20')]);}_0x57c897[_0x46a4('0x41')]=qs[_0x46a4('0x42')](_0x4b58d3['query'][_0x46a4('0x42')]);_0x57c897[_0x46a4('0x43')]=qs[_0x46a4('0x3a')](_[_0x46a4('0xbc')](_0x4b58d3['query'],_0x16d7f1[_0x46a4('0x3a')]));_0x57c897['where'][_0x46a4('0xac')]=_0x46f83e['id'];if(_0x4b58d3[_0x46a4('0x38')]['filter']){_0x57c897['where']=_[_0x46a4('0x96')](_0x57c897[_0x46a4('0x43')],{'$or':_[_0x46a4('0x6b')](_0x57c897['attributes'],function(_0x50c2ef){var _0x1b4dee={};_0x1b4dee[_0x50c2ef]={'$like':'%'+_0x4b58d3['query'][_0x46a4('0x80')]+'%'};return _0x1b4dee;})});}if(_0x4b58d3['query'][_0x46a4('0x7a')]){var _0x3f3f64=_0x4b58d3[_0x46a4('0x38')][_0x46a4('0x7a')][_0x46a4('0x63')](',');var _0x99fd87={};_0x99fd87[_0x3f3f64[0x0]]={'$gte':moment(_0x3f3f64[0x1])[_0x46a4('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x57c897['where']=_[_0x46a4('0x96')](_0x57c897[_0x46a4('0x43')],_0x99fd87);}_0x57c897=_[_0x46a4('0x96')]({},_0x57c897,_0x4b58d3['options']);return db[_0x46a4('0xba')][_0x46a4('0x23')]({'where':_0x57c897[_0x46a4('0x43')]})[_0x46a4('0x2a')](function(_0x1ced07){_0x3167ee['count']=_0x1ced07;if(_0x4b58d3[_0x46a4('0x38')][_0x46a4('0xb0')]){_0x57c897[_0x46a4('0xb1')]=[{'all':!![]}];}return db[_0x46a4('0xba')]['findAll'](_0x57c897);})[_0x46a4('0x2a')](function(_0x223535){_0x3167ee['rows']=_0x223535;return _0x3167ee;});}})[_0x46a4('0x2a')](respondWithFilteredResult(_0x450284,_0x57c897))[_0x46a4('0xae')](handleError(_0x450284,null));};exports[_0x46a4('0xbe')]=function(_0x37c879,_0x4c68fa,_0x54240c){return db['FaxInteraction'][_0x46a4('0x5b')]({'where':{'id':_0x37c879[_0x46a4('0xb4')]['id']}})[_0x46a4('0x2a')](handleEntityNotFound(_0x4c68fa,null))['then'](function(_0x4ef988){if(_0x4ef988){return _0x4ef988['setTags'](_0x37c879[_0x46a4('0x71')]['ids'],_[_0x46a4('0xb7')](_0x37c879[_0x46a4('0x71')],[_0x46a4('0xb8'),'id'])||{})[_0x46a4('0xbf')](function(){return db[_0x46a4('0x6a')]['findAll']({'attributes':['id',_0x46a4('0x2e'),_0x46a4('0x46')],'where':{'id':_0x37c879[_0x46a4('0x71')][_0x46a4('0xb8')]}});})[_0x46a4('0x2a')](function(_0xa72638){socket[_0x46a4('0xc0')](_0x46a4('0xc1'),{'id':Number(_0x37c879['params']['id']),'tags':_0xa72638||[]});return{'id':Number(_0x37c879['params']['id']),'tags':_0xa72638||[]};});}})[_0x46a4('0x2a')](respondWithResult(_0x4c68fa,null))['catch'](handleError(_0x4c68fa,null));};exports[_0x46a4('0xc2')]=function(_0x7fa4a2,_0x5bab4e,_0x3fec6e){return db['FaxInteraction']['find']({'where':{'id':_0x7fa4a2['params']['id']}})['then'](handleEntityNotFound(_0x5bab4e,null))[_0x46a4('0x2a')](function(_0x43c6cd){if(_0x43c6cd){return _0x43c6cd['removeTags'](_0x7fa4a2[_0x46a4('0x38')]['ids']);}})[_0x46a4('0x2a')](respondWithStatusCode(_0x5bab4e,null))[_0x46a4('0xae')](handleError(_0x5bab4e,null));};exports['download']=function(_0x595480,_0x435b02){var _0x132606=moment()[_0x46a4('0xc3')]()[_0x46a4('0x94')]();var _0x192e01=path['join'](config[_0x46a4('0xc4')],_0x46a4('0xc5'),'files',_0x46a4('0xc6'));var _0x96c68=path[_0x46a4('0xc7')](config[_0x46a4('0xc4')],_0x46a4('0xc5'),_0x46a4('0xc8'),_0x46a4('0xc9'));var _0x12dbf1=path[_0x46a4('0xc7')](_0x192e01,_0x132606);var _0x2473f1=util['format']('transcript-%d-%s.zip',_0x595480[_0x46a4('0xb4')]['id'],_0x132606);var _0x390738=path['join'](_0x192e01,_0x2473f1);var _0x4d9498=[];_0x4d9498['push']({'model':db['Attachment'],'as':_0x46a4('0xca'),'raw':!![]});var _0x5634a1=[{'model':db['FaxMessage'],'as':_0x46a4('0xcb'),'attributes':['id',_0x46a4('0x71'),_0x46a4('0x78')],'include':_0x4d9498}];return db[_0x46a4('0x97')][_0x46a4('0x5b')]({'where':{'id':_0x595480[_0x46a4('0xb4')]['id']},'include':_0x5634a1})[_0x46a4('0x2a')](handleEntityNotFound(_0x435b02,null))[_0x46a4('0x2a')](function(_0x119f13){if(_0x119f13&&_0x119f13[_0x46a4('0xcb')]){var _0x2fc36b=_0x119f13[_0x46a4('0xcc')]({'plain':!![]});fs['mkdirSync'](_0x12dbf1);for(var _0x62e4dc=0x0;_0x62e4dc<_0x2fc36b[_0x46a4('0xcb')][_0x46a4('0x3f')];_0x62e4dc++){var _0x53266f=_0x2fc36b['Messages'][_0x62e4dc][_0x46a4('0xca')];if(_0x53266f){var _0x158bb1=path[_0x46a4('0xc7')](_0x96c68,_0x53266f[_0x46a4('0xcd')]);if(fs[_0x46a4('0xce')](_0x158bb1)){fs[_0x46a4('0xcf')](_0x158bb1)['pipe'](fs[_0x46a4('0xd0')](path[_0x46a4('0xc7')](_0x12dbf1,_0x53266f['basename'])));}}}return BPromise[_0x46a4('0x8d')]()['then'](function(){return new BPromise(function(_0xaf74d,_0x249479){zipdir(_0x12dbf1,{'saveTo':_0x390738},function(_0x305a51,_0x4aaeeb){if(_0x305a51)return _0x249479(_0x305a51);return _0xaf74d(_0x4aaeeb);});})[_0x46a4('0x2a')](function(){return new BPromise(function(_0x4ba764,_0x377c18){rimraf(_0x12dbf1,function(_0x334b3e){if(_0x334b3e)_0x377c18(_0x334b3e);return _0x4ba764();});});})[_0x46a4('0x2a')](function(){return _0x435b02[_0x46a4('0xd1')](_0x390738,_0x2473f1,function(_0x40cdc0){if(_0x40cdc0){console['log'](_0x46a4('0xd2'),_0x40cdc0);}else{fs[_0x46a4('0xd3')](_0x390738);}});});});}else{return _0x435b02[_0x46a4('0x1d')](0xc8);}})['catch'](handleError(_0x435b02,null));}; \ No newline at end of file +var _0x07ce=['hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','emit','faxInteractionTags:save','removeTags','unix','root','server','files','tmp','join','Attachment','Messages','mkdirSync','basename','createReadStream','createWriteStream','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','FaxInteraction','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','o.id\x20=\x20i.UserId','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','conditions','find','unreadMessages','value','`\x20=\x200','having','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','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','start','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','merge','a.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','c.firstName','Contact.firstName','c.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','push','all','show','params','rawAttributes','includeAll','include','options','create','destroy','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x07ce,0xf1));var _0xe07c=function(_0x3f5ceb,_0x12fdd8){_0x3f5ceb=_0x3f5ceb-0x0;var _0x59f5dd=_0x07ce[_0x3f5ceb];return _0x59f5dd;};'use strict';var emlformat=require(_0xe07c('0x0'));var rimraf=require(_0xe07c('0x1'));var zipdir=require(_0xe07c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe07c('0x3'));var moment=require(_0xe07c('0x4'));var BPromise=require(_0xe07c('0x5'));var Mustache=require(_0xe07c('0x6'));var util=require(_0xe07c('0x7'));var path=require(_0xe07c('0x8'));var sox=require(_0xe07c('0x9'));var csv=require(_0xe07c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe07c('0xb'));var _=require(_0xe07c('0xc'));var squel=require(_0xe07c('0xd'));var crypto=require('crypto');var jsforce=require(_0xe07c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe07c('0xa'));var querystring=require(_0xe07c('0xf'));var Papa=require(_0xe07c('0x10'));var Redis=require(_0xe07c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe07c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe07c('0x13'));var logger=require(_0xe07c('0x14'))(_0xe07c('0x15'));var utils=require('../../config/utils');var config=require(_0xe07c('0x16'));var licenseUtil=require(_0xe07c('0x17'));var db=require(_0xe07c('0x18'))['db'];config[_0xe07c('0x19')]=_[_0xe07c('0x1a')](config[_0xe07c('0x19')],{'host':_0xe07c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe07c('0x19')]));require(_0xe07c('0x1c'))['register'](socket);function respondWithStatusCode(_0x401f6a,_0x1e5544){_0x1e5544=_0x1e5544||0xcc;return function(_0xa5ca19){if(_0xa5ca19){return _0x401f6a[_0xe07c('0x1d')](_0x1e5544);}return _0x401f6a[_0xe07c('0x1e')](_0x1e5544)[_0xe07c('0x1f')]();};}function respondWithResult(_0x82df85,_0x426751){_0x426751=_0x426751||0xc8;return function(_0x2a829f){if(_0x2a829f){return _0x82df85[_0xe07c('0x1e')](_0x426751)[_0xe07c('0x20')](_0x2a829f);}};}function respondWithFilteredResult(_0x590189,_0x320b67){return function(_0x49e124){if(_0x49e124){var _0x5f23fb=typeof _0x320b67['offset']===_0xe07c('0x21')&&typeof _0x320b67[_0xe07c('0x22')]===_0xe07c('0x21');var _0x27d3b8=_0x49e124['count'];var _0x18b82f=_0x5f23fb?0x0:_0x320b67['offset'];var _0xfd6e10=_0x5f23fb?_0x49e124[_0xe07c('0x23')]:_0x320b67[_0xe07c('0x24')]+_0x320b67[_0xe07c('0x22')];var _0x52e78d;if(_0xfd6e10>=_0x27d3b8){_0xfd6e10=_0x27d3b8;_0x52e78d=0xc8;}else{_0x52e78d=0xce;}_0x590189[_0xe07c('0x1e')](_0x52e78d);return _0x590189[_0xe07c('0x25')](_0xe07c('0x26'),_0x18b82f+'-'+_0xfd6e10+'/'+_0x27d3b8)['json'](_0x49e124);}return null;};}function patchUpdates(_0x44526c){return function(_0x9ac074){try{jsonpatch[_0xe07c('0x27')](_0x9ac074,_0x44526c,!![]);}catch(_0x1e2a87){return BPromise[_0xe07c('0x28')](_0x1e2a87);}return _0x9ac074['save']();};}function saveUpdates(_0x311809,_0x138ed0){return function(_0x28d9a9){if(_0x28d9a9){return _0x28d9a9[_0xe07c('0x29')](_0x311809)[_0xe07c('0x2a')](function(_0x369664){return _0x369664;});}return null;};}function removeEntity(_0x5f3705,_0x1881f1){return function(_0x16f7ac){if(_0x16f7ac){return _0x16f7ac['destroy']()[_0xe07c('0x2a')](function(){_0x5f3705['status'](0xcc)[_0xe07c('0x1f')]();});}};}function handleEntityNotFound(_0x3f29c3,_0x56b5fe){return function(_0x2cbb62){if(!_0x2cbb62){_0x3f29c3[_0xe07c('0x1d')](0x194);}return _0x2cbb62;};}function handleError(_0x16d168,_0xf80062){_0xf80062=_0xf80062||0x1f4;return function(_0x49783f){logger[_0xe07c('0x2b')](_0x49783f[_0xe07c('0x2c')]);if(_0x49783f[_0xe07c('0x2d')]){delete _0x49783f[_0xe07c('0x2d')];}_0x16d168[_0xe07c('0x1e')](_0xf80062)['send'](_0x49783f);};}function getInteractionUsers(_0x48c9fe,_0x3a419e){return new BPromise(function(_0x5e0bb5,_0x4a2b13){try{if(_0x3a419e[_0x48c9fe['id']]){_0x48c9fe[_0xe07c('0x2e')]=_['map'](_0x3a419e[_0x48c9fe['id']],function(_0x2f1f6d){return{'id':_0x2f1f6d['id'],'fullname':_0x2f1f6d[_0xe07c('0x2f')]};});}}catch(_0xa3de3a){_0x4a2b13(_0xa3de3a);}_0x5e0bb5(_0x48c9fe);});}function getInteractionTags(_0x4566cd,_0x25ffc4){return new BPromise(function(_0x2a4543,_0x6f09fc){try{if(_0x4566cd[_0xe07c('0x30')]){_0x4566cd[_0xe07c('0x31')]=[];_0x4566cd[_0xe07c('0x30')][_0xe07c('0x32')](',')[_0xe07c('0x33')](function(_0x37d64a){_0x4566cd[_0xe07c('0x31')]['push'](_0x25ffc4[_0x37d64a]);});}delete _0x4566cd[_0xe07c('0x30')];}catch(_0x5bbe12){_0x6f09fc(_0x5bbe12);}_0x2a4543(_0x4566cd);});}function updateFaxInteraction(_0x3fc324,_0x37f6ec,_0x726b4e){return new BPromise(function(_0x428fc2,_0x4932a0){return getInteractionUsers(_0x3fc324,_0x726b4e)[_0xe07c('0x2a')](function(_0x4945b4){return getInteractionTags(_0x4945b4,_0x37f6ec);})[_0xe07c('0x2a')](function(_0x1eeb61){_0x428fc2(_0x1eeb61);})[_0xe07c('0x34')](function(_0x207838){_0x4932a0(_0x207838);});});}exports[_0xe07c('0x35')]=function(_0xa5eb26,_0x12c8e4){var _0x6c23e4={},_0x342687={},_0x380320={'count':0x0,'rows':[]};var _0x3780da=_[_0xe07c('0x36')](db[_0xe07c('0x37')]['rawAttributes'],function(_0x45bcab){return{'name':_0x45bcab[_0xe07c('0x38')],'type':_0x45bcab[_0xe07c('0x39')]['key']};});_0x342687[_0xe07c('0x3a')]=_['map'](_0x3780da,_0xe07c('0x2d'));_0x342687[_0xe07c('0x3b')]=_[_0xe07c('0x3c')](_0xa5eb26[_0xe07c('0x3b')]);_0x342687[_0xe07c('0x3d')]=_[_0xe07c('0x3e')](_0x342687[_0xe07c('0x3a')],_0x342687['query']);_0x6c23e4['attributes']=_[_0xe07c('0x3e')](_0x342687[_0xe07c('0x3a')],qs[_0xe07c('0x3f')](_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x3f')]));_0x6c23e4[_0xe07c('0x40')]=_0x6c23e4[_0xe07c('0x40')][_0xe07c('0x41')]?_0x6c23e4[_0xe07c('0x40')]:_0x342687['model'];if(!_0xa5eb26[_0xe07c('0x3b')]['hasOwnProperty'](_0xe07c('0x42'))){_0x6c23e4[_0xe07c('0x22')]=qs[_0xe07c('0x22')](_0xa5eb26[_0xe07c('0x3b')]['limit']);_0x6c23e4[_0xe07c('0x24')]=qs[_0xe07c('0x24')](_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x24')]);}_0x6c23e4[_0xe07c('0x43')]=qs['sort'](_0xa5eb26['query'][_0xe07c('0x44')]);_0x6c23e4[_0xe07c('0x45')]=qs[_0xe07c('0x3d')](_[_0xe07c('0x46')](_0xa5eb26[_0xe07c('0x3b')],_0x342687[_0xe07c('0x3d')]),_0x3780da);var _0x5e50cd=[];var _0x16ebca=squel[_0xe07c('0x47')]()[_0xe07c('0x48')]('id')[_0xe07c('0x48')]('name')[_0xe07c('0x48')](_0xe07c('0x49'))['from'](_0xe07c('0x4a'));var _0x36c5c0=squel[_0xe07c('0x47')]()['field'](_0xe07c('0x4b'))[_0xe07c('0x48')](_0xe07c('0x4c'))[_0xe07c('0x48')](_0xe07c('0x4d'))[_0xe07c('0x4e')](_0xe07c('0x4f'),'ui')['left_join'](_0xe07c('0x50'),'u',_0xe07c('0x51'));var _0x5d89cf=squel[_0xe07c('0x47')]()[_0xe07c('0x4e')](_0xe07c('0x52'),'i')[_0xe07c('0x53')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe07c('0x53')](_0xe07c('0x50'),'o',_0xe07c('0x54'))['left_join'](_0xe07c('0x55'),'a',_0xe07c('0x56'))['left_join'](_0xe07c('0x57'),'me',_0xe07c('0x58'))[_0xe07c('0x53')](_0xe07c('0x59'),'it',_0xe07c('0x5a'))[_0xe07c('0x53')]('tools_tags','t',_0xe07c('0x5b'));var _0x521491=squel[_0xe07c('0x5c')]();var _0xcbfc87=[];var _0x7a473f=squel['expr']();var _0x3cb7f9;if(_0xa5eb26['query'][_0xe07c('0x5d')]){_0x3cb7f9=as[_0xe07c('0x5e')](_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x5d')]);var _0x32132f=_0x3cb7f9[_0xe07c('0x5f')];for(var _0x14c64e=0x0;_0x14c64e<_0x3cb7f9[_0xe07c('0x60')]['length'];_0x14c64e++){var _0x598251=_0x3cb7f9[_0xe07c('0x60')][_0x14c64e];var _0x395ad7='i';var _0xfe38a3=_[_0xe07c('0x61')](_0x3780da,[_0xe07c('0x2d'),_0x598251[_0xe07c('0x48')]]);if(!_0xfe38a3){switch(_0x598251['field']){case _0xe07c('0x62'):if(_0x598251[_0xe07c('0x63')]==0x1){_0x5d89cf['having']('`'+_0x598251['field']+_0xe07c('0x64'));}else{_0x5d89cf[_0xe07c('0x65')]('`'+_0x598251[_0xe07c('0x48')]+'`\x20>\x200');}break;case _0xe07c('0x66'):if(_0x598251[_0xe07c('0x67')]===_0xe07c('0x68')){if(_0x598251[_0xe07c('0x63')][_0xe07c('0x32')]('\x20')[_0xe07c('0x41')]>0x1){_0x521491[_0x32132f](_0xe07c('0x69'),qs[_0xe07c('0x6a')](_0x598251[_0xe07c('0x63')]),null);}else{var _0x3f2783='%'+_0x598251[_0xe07c('0x63')]+'%';_0x521491[_0x32132f](_0xe07c('0x6b'),_0x3f2783,_0x3f2783,_0x3f2783);}}else{_0xfe38a3=_['find'](_0x3780da,[_0xe07c('0x2d'),'ContactId']);_0x598251[_0xe07c('0x48')]=_0xe07c('0x6c');_0x2c71a6=as['buildExpression'](_0x395ad7,_0xfe38a3[_0xe07c('0x39')],_0x598251);_0x521491[_0x32132f](_0x2c71a6[_0xe07c('0x6d')],_0x2c71a6[_0xe07c('0x63')]['start'],_0x2c71a6['value'][_0xe07c('0x1f')]);}break;case _0xe07c('0x6e'):var _0x454c2e=_0x598251[_0xe07c('0x63')]['split'](',')[_0xe07c('0x36')](function(_0x224554){return Number(_0x224554);});_0x454c2e[_0xe07c('0x33')](function(_0x157c6a){_0x7a473f['or'](_0xe07c('0x6f'),'%,'+_0x157c6a+',%');});_0xcbfc87=_[_0xe07c('0x70')](_0xcbfc87,_0x454c2e);break;case _0xe07c('0x71'):if(_0x598251[_0xe07c('0x67')]==='$substring'){_0x521491[_0x32132f](_0xe07c('0x72'),'%'+_0x598251[_0xe07c('0x63')]+'%',null);}else{_0xfe38a3=_['find'](_0x3780da,[_0xe07c('0x2d'),_0xe07c('0x73')]);_0x598251[_0xe07c('0x48')]=_0xe07c('0x73');_0x2c71a6=as[_0xe07c('0x74')](_0x395ad7,_0xfe38a3[_0xe07c('0x39')],_0x598251);_0x521491[_0x32132f](_0x2c71a6['text'],_0x2c71a6[_0xe07c('0x63')]['start'],_0x2c71a6[_0xe07c('0x63')][_0xe07c('0x1f')]);}break;case _0xe07c('0x75'):_0x2c71a6=as[_0xe07c('0x74')]('me',null,_0x598251);_0x521491[_0x32132f](_0x2c71a6[_0xe07c('0x6d')],_0x2c71a6[_0xe07c('0x63')][_0xe07c('0x76')],_0x2c71a6[_0xe07c('0x63')][_0xe07c('0x1f')]);break;}}else{var _0x2c71a6=as[_0xe07c('0x74')](_0x395ad7,_0xfe38a3[_0xe07c('0x39')],_0x598251);_0x521491[_0x32132f](_0x2c71a6['text'],_0x2c71a6[_0xe07c('0x63')][_0xe07c('0x76')],_0x2c71a6[_0xe07c('0x63')]['end']);}}}else{var _0x2edd68=_(_0xa5eb26['query'])[_0xe07c('0x3c')]()['map'](function(_0x3e94d8){return _[_0xe07c('0x77')](_0x3780da,[_0xe07c('0x2d'),_0x3e94d8])?_0x3e94d8:undefined;})[_0xe07c('0x78')]()['value']();if(!_[_0xe07c('0x79')](_0x2edd68)){_0x2edd68[_0xe07c('0x33')](function(_0x47bcd7){if(_0x47bcd7===_0xe07c('0x7a')){_0x5d89cf[_0xe07c('0x45')](_0xe07c('0x7b'),[][_0xe07c('0x7c')](_0xa5eb26[_0xe07c('0x3b')][_0x47bcd7]));}else if(_0x47bcd7===_0xe07c('0x7d')){var _0x278809=JSON[_0xe07c('0x7e')](_0xa5eb26[_0xe07c('0x3b')][_0x47bcd7])[_0xe07c('0x7f')];var _0x16530f=JSON['parse'](_0xa5eb26[_0xe07c('0x3b')][_0x47bcd7])[_0xe07c('0x80')];_0x5d89cf[_0xe07c('0x45')](_0xe07c('0x81'),_0x278809,_0x16530f);}else{if(_0xa5eb26[_0xe07c('0x3b')][_0x47bcd7]===_0xe07c('0x82')){_0x5d89cf[_0xe07c('0x45')]('i.'+_0x47bcd7+_0xe07c('0x83'));}else{_0x5d89cf[_0xe07c('0x45')]('i.'+_0x47bcd7+_0xe07c('0x84'),_0xa5eb26[_0xe07c('0x3b')][_0x47bcd7]);}}});}if(_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x85')]){if(_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x85')]==0x1){_0x5d89cf[_0xe07c('0x65')](_0xe07c('0x86'));}else{_0x5d89cf[_0xe07c('0x65')]('`unreadMessages`\x20>\x200');}}if(_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x87')]){_0xcbfc87=_[_0xe07c('0x88')](_0xa5eb26[_0xe07c('0x3b')]['tag'])?_0xa5eb26['query']['tag']:new Array(_0xa5eb26[_0xe07c('0x3b')]['tag']);_0xcbfc87[_0xe07c('0x33')](function(_0x48f6a9){_0x7a473f['or'](_0xe07c('0x6f'),'%,'+_0x48f6a9+',%');});}if(_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x89')]){var _0x3e24ff=_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x89')]['replace']('\x5c','\x5c\x5c')[_0xe07c('0x8a')](/'/g,'\x27\x27');if(qs[_0xe07c('0x8b')](_0x3e24ff)){_0x521491['or'](_0xe07c('0x8c'),_0x3e24ff+'%')['or'](_0xe07c('0x8d'),_0x3e24ff+'%');}_0x521491['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3e24ff+'%');}}_0x5d89cf[_0xe07c('0x45')](_0x521491);_0x5d89cf['group']('i.id');var _0x22411a={'type':db[_0xe07c('0x8e')][_0xe07c('0x8f')][_0xe07c('0x90')],'raw':!![]};var _0x78880=_0x5d89cf[_0xe07c('0x91')]();_0x78880[_0xe07c('0x48')](_0xe07c('0x92'));_0x78880['field'](_0xe07c('0x93'),_0xe07c('0x62'));if(_0x6c23e4['order']){_0x6c23e4[_0xe07c('0x43')][_0xe07c('0x33')](function(_0x665f59){var _0x5cacfe=_0x665f59[0x0]===_0xe07c('0x94')?_0x665f59[0x0]:'i.'+_0x665f59[0x0];_0x5d89cf[_0xe07c('0x43')](_0x5cacfe,_0x665f59[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe07c('0x79')](_0xcbfc87)){_0x5d89cf['having'](_0x7a473f);_0x78880['where'](_0xe07c('0x95'),_0xcbfc87);}BPromise[_0xe07c('0x96')]()[_0xe07c('0x2a')](function(){if(!_0x3cb7f9){if(_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x7a')])return;_0x78880[_0xe07c('0x45')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x5d89cf[_0xe07c('0x45')](_0xe07c('0x97'));return;}if(_0xa5eb26[_0xe07c('0x98')]['role']!==_0xe07c('0x99'))return;return _0xa5eb26[_0xe07c('0x98')][_0xe07c('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1e5e00){if(_[_0xe07c('0x79')](_0x1e5e00)){_0x78880[_0xe07c('0x45')](_0xe07c('0x9b'));_0x5d89cf[_0xe07c('0x45')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x78880['where'](_0xe07c('0x7b'),_[_0xe07c('0x36')](_0x1e5e00,'id'));_0x5d89cf['where'](_0xe07c('0x7b'),_[_0xe07c('0x36')](_0x1e5e00,'id'));}});})[_0xe07c('0x2a')](function(){if(_0xa5eb26[_0xe07c('0x98')][_0xe07c('0x9c')]===_0xe07c('0x99')&&!_0x3cb7f9&&!_0xa5eb26['query'][_0xe07c('0x7a')])return[];return db[_0xe07c('0x9d')][_0xe07c('0x3b')](_0x78880[_0xe07c('0x9e')](),_0x22411a);})[_0xe07c('0x2a')](function(_0x50dbc8){_0x380320[_0xe07c('0x23')]=_0x50dbc8[_0xe07c('0x41')];if(_0x380320[_0xe07c('0x23')]===0x0)return[];return db[_0xe07c('0x9d')][_0xe07c('0x3b')](_0x16ebca[_0xe07c('0x9e')](),_0x22411a)['then'](function(_0x57d921){_0x5e50cd=_['keyBy'](_0x57d921,'id');_0x22411a=_[_0xe07c('0x9f')](_0x22411a,{'model':db[_0xe07c('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa5eb26[_0xe07c('0x3b')][_0xe07c('0x3f')]){_0x6c23e4[_0xe07c('0x40')][_0xe07c('0x33')](function(_0x5f2cc7){_0x5d89cf[_0xe07c('0x48')]('i.'+_0x5f2cc7);});}else{_0x5d89cf[_0xe07c('0x48')](_0xe07c('0x93'),'unreadMessages');_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xa0'),'Account.key');_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xa1'),'Account.mandatoryDisposition');_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xa2'),'contactName');_0x5d89cf[_0xe07c('0x48')]('i.*');_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xa3'),_0xe07c('0xa4'));_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xa5'),'Contact.lastName');_0x5d89cf[_0xe07c('0x48')]('c.email','Contact.email');_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xa6'),_0xe07c('0xa7'));_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xa8'),_0xe07c('0xa9'));_0x5d89cf[_0xe07c('0x48')]('c.fax','Contact.fax');_0x5d89cf['field'](_0xe07c('0xaa'),_0xe07c('0xab'));_0x5d89cf['field'](_0xe07c('0xac'),'Owner.internal');_0x5d89cf[_0xe07c('0x48')](_0xe07c('0xad'),_0xe07c('0x30'));}if(_0x6c23e4[_0xe07c('0x22')])_0x5d89cf[_0xe07c('0x22')](_0x6c23e4[_0xe07c('0x22')]);if(_0x6c23e4[_0xe07c('0x24')])_0x5d89cf[_0xe07c('0x24')](_0x6c23e4[_0xe07c('0x24')]);return db[_0xe07c('0x9d')][_0xe07c('0x3b')](_0x5d89cf[_0xe07c('0x9e')](),_0x22411a);})[_0xe07c('0x2a')](function(_0x55c440){if(_0x55c440[_0xe07c('0x41')]>0x0)_0x36c5c0['where'](_0xe07c('0xae'),_[_0xe07c('0x36')](_0x55c440,'id'));return db[_0xe07c('0x9d')][_0xe07c('0x3b')](_0x36c5c0[_0xe07c('0x9e')](),_0x22411a)[_0xe07c('0x2a')](function(_0x1de115){var _0x37fc11=_[_0xe07c('0xaf')](_0x1de115,'FaxInteractionId');var _0x5a2c8a=[];_0x55c440[_0xe07c('0x33')](function(_0x57a65f){_0x5a2c8a[_0xe07c('0xb0')](updateFaxInteraction(_0x57a65f,_0x5e50cd,_0x37fc11));});return BPromise[_0xe07c('0xb1')](_0x5a2c8a);});});})[_0xe07c('0x2a')](function(_0x2a2923){_0x380320['rows']=_0x2a2923;return _0x380320;})[_0xe07c('0x2a')](respondWithFilteredResult(_0x12c8e4,_0x6c23e4))['catch'](handleError(_0x12c8e4,null));};exports[_0xe07c('0xb2')]=function(_0x449fcc,_0x4fafca){var _0x2ac8ed={'raw':![],'where':{'id':_0x449fcc[_0xe07c('0xb3')]['id']}},_0xa4732={};_0xa4732[_0xe07c('0x3a')]=_[_0xe07c('0x3c')](db['FaxInteraction'][_0xe07c('0xb4')]);_0xa4732[_0xe07c('0x3b')]=_[_0xe07c('0x3c')](_0x449fcc[_0xe07c('0x3b')]);_0xa4732['filters']=_['intersection'](_0xa4732[_0xe07c('0x3a')],_0xa4732[_0xe07c('0x3b')]);_0x2ac8ed['attributes']=_[_0xe07c('0x3e')](_0xa4732[_0xe07c('0x3a')],qs['fields'](_0x449fcc[_0xe07c('0x3b')][_0xe07c('0x3f')]));_0x2ac8ed['attributes']=_0x2ac8ed[_0xe07c('0x40')][_0xe07c('0x41')]?_0x2ac8ed['attributes']:_0xa4732['model'];if(_0x449fcc['query'][_0xe07c('0xb5')]){_0x2ac8ed[_0xe07c('0xb6')]=[{'all':!![]}];}_0x2ac8ed=_[_0xe07c('0x9f')]({},_0x2ac8ed,_0x449fcc[_0xe07c('0xb7')]);return db[_0xe07c('0x37')][_0xe07c('0x61')](_0x2ac8ed)[_0xe07c('0x2a')](handleEntityNotFound(_0x4fafca,null))[_0xe07c('0x2a')](respondWithResult(_0x4fafca,null))[_0xe07c('0x34')](handleError(_0x4fafca,null));};exports[_0xe07c('0xb8')]=function(_0x30011c,_0x43c4b6){return db[_0xe07c('0x37')][_0xe07c('0xb8')](_0x30011c[_0xe07c('0x75')],{})[_0xe07c('0x2a')](respondWithResult(_0x43c4b6,0xc9))[_0xe07c('0x34')](handleError(_0x43c4b6,null));};exports[_0xe07c('0x29')]=function(_0x2cc5a1,_0x56d51a){if(_0x2cc5a1[_0xe07c('0x75')]['id']){delete _0x2cc5a1[_0xe07c('0x75')]['id'];}return db[_0xe07c('0x37')][_0xe07c('0x61')]({'where':{'id':_0x2cc5a1[_0xe07c('0xb3')]['id']}})['then'](handleEntityNotFound(_0x56d51a,null))[_0xe07c('0x2a')](saveUpdates(_0x2cc5a1['body'],null))[_0xe07c('0x2a')](respondWithResult(_0x56d51a,null))['catch'](handleError(_0x56d51a,null));};exports[_0xe07c('0xb9')]=function(_0x4c5286,_0x380643){return db[_0xe07c('0x37')][_0xe07c('0x61')]({'where':{'id':_0x4c5286['params']['id']}})[_0xe07c('0x2a')](handleEntityNotFound(_0x380643,null))[_0xe07c('0x2a')](removeEntity(_0x380643,null))[_0xe07c('0x34')](handleError(_0x380643,null));};exports[_0xe07c('0xba')]=function(_0x50a1ab,_0x5327e9){return db[_0xe07c('0x37')][_0xe07c('0xba')]()[_0xe07c('0x2a')](respondWithResult(_0x5327e9,null))[_0xe07c('0x34')](handleError(_0x5327e9,null));};exports[_0xe07c('0xbb')]=function(_0x485021,_0x291312,_0x5763d4){return db[_0xe07c('0xbc')][_0xe07c('0x61')]({'where':{'id':_0x485021[_0xe07c('0xb3')]['id']}})[_0xe07c('0x2a')](handleEntityNotFound(_0x291312,null))[_0xe07c('0x2a')](function(_0x587ec0){if(_0x587ec0){return _0x587ec0[_0xe07c('0xbb')](_0x485021['body']['ids'],_[_0xe07c('0xbd')](_0x485021['body'],[_0xe07c('0xbe'),'id'])||{});}})[_0xe07c('0x2a')](respondWithResult(_0x291312,null))[_0xe07c('0x34')](handleError(_0x291312,null));};exports[_0xe07c('0xbf')]=function(_0x4fb54a,_0xa6664e,_0x50a9d1){var _0x34faa7={'raw':![],'where':{}};var _0x1b0e33={};var _0x1b573b={'count':0x0,'rows':[]};return db[_0xe07c('0x37')][_0xe07c('0xc0')]({'where':{'id':_0x4fb54a[_0xe07c('0xb3')]['id']}})[_0xe07c('0x2a')](handleEntityNotFound(_0xa6664e,null))[_0xe07c('0x2a')](function(_0x4d5589){if(_0x4d5589){_0x1b0e33[_0xe07c('0x3a')]=_[_0xe07c('0x3c')](db[_0xe07c('0xbc')][_0xe07c('0xb4')]);_0x1b0e33['query']=_[_0xe07c('0x3c')](_0x4fb54a['query']);_0x1b0e33[_0xe07c('0x3d')]=_[_0xe07c('0x3e')](_0x1b0e33['model'],_0x1b0e33[_0xe07c('0x3b')]);_0x34faa7[_0xe07c('0x40')]=_[_0xe07c('0x3e')](_0x1b0e33[_0xe07c('0x3a')],qs[_0xe07c('0x3f')](_0x4fb54a[_0xe07c('0x3b')]['fields']));_0x34faa7[_0xe07c('0x40')]=_0x34faa7['attributes']['length']?_0x34faa7['attributes']:_0x1b0e33[_0xe07c('0x3a')];if(!_0x4fb54a[_0xe07c('0x3b')][_0xe07c('0xc1')](_0xe07c('0x42'))){_0x34faa7[_0xe07c('0x22')]=qs['limit'](_0x4fb54a['query'][_0xe07c('0x22')]);_0x34faa7[_0xe07c('0x24')]=qs[_0xe07c('0x24')](_0x4fb54a[_0xe07c('0x3b')][_0xe07c('0x24')]);}_0x34faa7[_0xe07c('0x43')]=qs[_0xe07c('0x44')](_0x4fb54a[_0xe07c('0x3b')][_0xe07c('0x44')]);_0x34faa7[_0xe07c('0x45')]=qs[_0xe07c('0x3d')](_[_0xe07c('0x46')](_0x4fb54a[_0xe07c('0x3b')],_0x1b0e33[_0xe07c('0x3d')]));_0x34faa7[_0xe07c('0x45')]['FaxInteractionId']=_0x4d5589['id'];if(_0x4fb54a['query']['filter']){_0x34faa7['where']=_['merge'](_0x34faa7[_0xe07c('0x45')],{'$or':_['map'](_0x34faa7[_0xe07c('0x40')],function(_0x50523c){var _0x2e5acc={};_0x2e5acc[_0x50523c]={'$like':'%'+_0x4fb54a[_0xe07c('0x3b')][_0xe07c('0x89')]+'%'};return _0x2e5acc;})});}if(_0x4fb54a[_0xe07c('0x3b')][_0xe07c('0x7f')]){var _0x3da2a7=_0x4fb54a[_0xe07c('0x3b')][_0xe07c('0x7f')]['split'](',');var _0x575032={};_0x575032[_0x3da2a7[0x0]]={'$gte':moment(_0x3da2a7[0x1])[_0xe07c('0xc2')](_0xe07c('0xc3'))};_0x34faa7[_0xe07c('0x45')]=_[_0xe07c('0x9f')](_0x34faa7[_0xe07c('0x45')],_0x575032);}_0x34faa7=_['merge']({},_0x34faa7,_0x4fb54a[_0xe07c('0xb7')]);return db['FaxMessage']['count']({'where':_0x34faa7['where']})[_0xe07c('0x2a')](function(_0x579cb0){_0x1b573b[_0xe07c('0x23')]=_0x579cb0;if(_0x4fb54a[_0xe07c('0x3b')]['includeAll']){_0x34faa7[_0xe07c('0xb6')]=[{'all':!![]}];}return db['FaxMessage'][_0xe07c('0xc4')](_0x34faa7);})[_0xe07c('0x2a')](function(_0x3a5405){_0x1b573b[_0xe07c('0xc5')]=_0x3a5405;return _0x1b573b;});}})[_0xe07c('0x2a')](respondWithFilteredResult(_0xa6664e,_0x34faa7))[_0xe07c('0x34')](handleError(_0xa6664e,null));};exports[_0xe07c('0xc6')]=function(_0x565fb4,_0x2305bd,_0x16c990){return db['FaxInteraction']['find']({'where':{'id':_0x565fb4[_0xe07c('0xb3')]['id']}})[_0xe07c('0x2a')](handleEntityNotFound(_0x2305bd,null))[_0xe07c('0x2a')](function(_0xa67645){if(_0xa67645){return _0xa67645['setTags'](_0x565fb4[_0xe07c('0x75')]['ids'],_['omit'](_0x565fb4['body'],[_0xe07c('0xbe'),'id'])||{})[_0xe07c('0xc7')](function(){return db[_0xe07c('0x6e')]['findAll']({'attributes':['id',_0xe07c('0x2d'),_0xe07c('0x49')],'where':{'id':_0x565fb4[_0xe07c('0x75')][_0xe07c('0xbe')]}});})['then'](function(_0x207927){socket[_0xe07c('0xc8')](_0xe07c('0xc9'),{'id':Number(_0x565fb4['params']['id']),'tags':_0x207927||[]});return{'id':Number(_0x565fb4[_0xe07c('0xb3')]['id']),'tags':_0x207927||[]};});}})['then'](respondWithResult(_0x2305bd,null))[_0xe07c('0x34')](handleError(_0x2305bd,null));};exports[_0xe07c('0xca')]=function(_0x2c2e5b,_0x19213a,_0x4b369c){return db[_0xe07c('0x37')][_0xe07c('0x61')]({'where':{'id':_0x2c2e5b[_0xe07c('0xb3')]['id']}})['then'](handleEntityNotFound(_0x19213a,null))['then'](function(_0x31d2f2){if(_0x31d2f2){return _0x31d2f2[_0xe07c('0xca')](_0x2c2e5b[_0xe07c('0x3b')]['ids']);}})[_0xe07c('0x2a')](respondWithStatusCode(_0x19213a,null))[_0xe07c('0x34')](handleError(_0x19213a,null));};exports['download']=function(_0x464bb8,_0x153256){var _0x1b434f=moment()[_0xe07c('0xcb')]()['toString']();var _0x5bf0e5=path['join'](config[_0xe07c('0xcc')],_0xe07c('0xcd'),_0xe07c('0xce'),_0xe07c('0xcf'));var _0x1a578f=path[_0xe07c('0xd0')](config['root'],_0xe07c('0xcd'),_0xe07c('0xce'),'attachments');var _0x3ab29e=path[_0xe07c('0xd0')](_0x5bf0e5,_0x1b434f);var _0x1e3761=util[_0xe07c('0xc2')]('transcript-%d-%s.zip',_0x464bb8[_0xe07c('0xb3')]['id'],_0x1b434f);var _0x22245c=path[_0xe07c('0xd0')](_0x5bf0e5,_0x1e3761);var _0x4e51c9=[];_0x4e51c9[_0xe07c('0xb0')]({'model':db['Attachment'],'as':_0xe07c('0xd1'),'raw':!![]});var _0x2aaef5=[{'model':db[_0xe07c('0xbc')],'as':_0xe07c('0xd2'),'attributes':['id',_0xe07c('0x75'),'createdAt'],'include':_0x4e51c9}];return db[_0xe07c('0x37')][_0xe07c('0x61')]({'where':{'id':_0x464bb8[_0xe07c('0xb3')]['id']},'include':_0x2aaef5})[_0xe07c('0x2a')](handleEntityNotFound(_0x153256,null))[_0xe07c('0x2a')](function(_0x1d16fa){if(_0x1d16fa&&_0x1d16fa[_0xe07c('0xd2')]){var _0x5be032=_0x1d16fa['get']({'plain':!![]});fs[_0xe07c('0xd3')](_0x3ab29e);for(var _0x5e734a=0x0;_0x5e734a<_0x5be032[_0xe07c('0xd2')][_0xe07c('0x41')];_0x5e734a++){var _0x310714=_0x5be032[_0xe07c('0xd2')][_0x5e734a][_0xe07c('0xd1')];if(_0x310714){var _0x3c4604=path[_0xe07c('0xd0')](_0x1a578f,_0x310714[_0xe07c('0xd4')]);if(fs['existsSync'](_0x3c4604)){fs[_0xe07c('0xd5')](_0x3c4604)['pipe'](fs[_0xe07c('0xd6')](path[_0xe07c('0xd0')](_0x3ab29e,_0x310714[_0xe07c('0xd4')])));}}}return BPromise[_0xe07c('0x96')]()[_0xe07c('0x2a')](function(){return new BPromise(function(_0x31f458,_0x4b8264){zipdir(_0x3ab29e,{'saveTo':_0x22245c},function(_0x205f41,_0x40e772){if(_0x205f41)return _0x4b8264(_0x205f41);return _0x31f458(_0x40e772);});})[_0xe07c('0x2a')](function(){return new BPromise(function(_0x1f9b59,_0x550fe4){rimraf(_0x3ab29e,function(_0x1f4f65){if(_0x1f4f65)_0x550fe4(_0x1f4f65);return _0x1f9b59();});});})[_0xe07c('0x2a')](function(){return _0x153256['download'](_0x22245c,_0x1e3761,function(_0x434da7){if(_0x434da7){console[_0xe07c('0xd7')]('err',_0x434da7);}else{fs[_0xe07c('0xd8')](_0x22245c);}});});});}else{return _0x153256[_0xe07c('0x1d')](0xc8);}})[_0xe07c('0x34')](handleError(_0x153256,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3878194..c08f673 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 _0x01b8=['setDataValue','Users','findAll','then','unreadMessages','length','emit','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','getUsers'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x01b8,0x1bb));var _0x801b=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x01b8[_0xc77819];return _0x1c9434;};'use strict';var EventEmitter=require(_0x801b('0x0'));var FaxInteraction=require(_0x801b('0x1'))['db'][_0x801b('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x801b('0x3')](0x0);var events={'afterCreate':_0x801b('0x4'),'afterUpdate':_0x801b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3eac58){return function(_0x5e1915,_0x4402cd,_0x259e7a){_0x5e1915[_0x801b('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x430a5e){_0x5e1915[_0x801b('0x7')](_0x801b('0x8'),_0x430a5e['map'](function(_0xa42c11){return{'id':_0xa42c11['id']};}));return FaxMessage[_0x801b('0x9')]({'where':{'FaxInteractionId':_0x5e1915['id'],'direction':'in','read':![]},'raw':!![]});})[_0x801b('0xa')](function(_0x15cfa6){_0x5e1915[_0x801b('0x7')](_0x801b('0xb'),_0x15cfa6[_0x801b('0xc')]);FaxInteractionEvents[_0x801b('0xd')](_0x3eac58+':'+_0x5e1915['id'],_0x5e1915);FaxInteractionEvents['emit'](_0x3eac58,_0x5e1915);_0x259e7a(null);})['catch'](_0x259e7a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x801b('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x61fe=['setMaxListeners','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x61fe,0xce));var _0xe61f=function(_0x1e258f,_0x4dee7f){_0x1e258f=_0x1e258f-0x0;var _0x2cb83b=_0x61fe[_0x1e258f];return _0x2cb83b;};'use strict';var EventEmitter=require(_0xe61f('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xe61f('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe61f('0x2')](0x0);var events={'afterCreate':_0xe61f('0x3'),'afterUpdate':_0xe61f('0x4'),'afterDestroy':_0xe61f('0x5')};function emitEvent(_0x416d5b){return function(_0x46a848,_0x7dda15,_0x4593d5){_0x46a848['getUsers']({'attributes':['id'],'raw':!![]})[_0xe61f('0x6')](function(_0x12225a){_0x46a848['setDataValue']('Users',_0x12225a[_0xe61f('0x7')](function(_0x126c7a){return{'id':_0x126c7a['id']};}));return FaxMessage[_0xe61f('0x8')]({'where':{'FaxInteractionId':_0x46a848['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe61f('0x6')](function(_0x3ca3d8){_0x46a848[_0xe61f('0x9')](_0xe61f('0xa'),_0x3ca3d8[_0xe61f('0xb')]);FaxInteractionEvents[_0xe61f('0xc')](_0x416d5b+':'+_0x46a848['id'],_0x46a848);FaxInteractionEvents['emit'](_0x416d5b,_0x46a848);_0x4593d5(null);})['catch'](_0x4593d5(null));};}for(var e in events){if(events[_0xe61f('0xd')](e)){var event=events[e];FaxInteraction[_0xe61f('0xe')](e,emitEvent(event));}}module[_0xe61f('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 10e0f43..7330634 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 _0x2f5e=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x2f5e,0x124));var _0xe2f5=function(_0x2b4737,_0x17077e){_0x2b4737=_0x2b4737-0x0;var _0x2ead4a=_0x2f5e[_0x2b4737];return _0x2ead4a;};'use strict';var _=require(_0xe2f5('0x0'));var util=require(_0xe2f5('0x1'));var logger=require('../../config/logger')(_0xe2f5('0x2'));var moment=require(_0xe2f5('0x3'));var BPromise=require(_0xe2f5('0x4'));var rp=require(_0xe2f5('0x5'));var fs=require('fs');var path=require(_0xe2f5('0x6'));var rimraf=require('rimraf');var config=require(_0xe2f5('0x7'));var attributes=require(_0xe2f5('0x8'));module[_0xe2f5('0x9')]=function(_0x1766ee,_0x1d24d9){return _0x1766ee[_0xe2f5('0xa')](_0xe2f5('0xb'),attributes,{'tableName':_0xe2f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3294d4,_0x3917c7,_0x378189){if(_0x3294d4['changed'](_0xe2f5('0xd'))){_0x3294d4[_0xe2f5('0xe')]=moment()[_0xe2f5('0xf')](_0xe2f5('0x10'));}_0x378189(null,_0x3294d4);}}});}; \ No newline at end of file +var _0x96d4=['api','moment','request-promise','path','rimraf','../../config/environment','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x36513d,_0x21c4b2){var _0x519f13=function(_0x52a708){while(--_0x52a708){_0x36513d['push'](_0x36513d['shift']());}};_0x519f13(++_0x21c4b2);}(_0x96d4,0x18d));var _0x496d=function(_0x262eb0,_0x5a84a7){_0x262eb0=_0x262eb0-0x0;var _0x37cf9f=_0x96d4[_0x262eb0];return _0x37cf9f;};'use strict';var _=require(_0x496d('0x0'));var util=require(_0x496d('0x1'));var logger=require(_0x496d('0x2'))(_0x496d('0x3'));var moment=require(_0x496d('0x4'));var BPromise=require('bluebird');var rp=require(_0x496d('0x5'));var fs=require('fs');var path=require(_0x496d('0x6'));var rimraf=require(_0x496d('0x7'));var config=require(_0x496d('0x8'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x21fd55,_0x5ab625){return _0x21fd55[_0x496d('0x9')](_0x496d('0xa'),attributes,{'tableName':_0x496d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42f126,_0x141d1c,_0x17ff9f){if(_0x42f126[_0x496d('0xc')](_0x496d('0xd'))){_0x42f126[_0x496d('0xe')]=moment()[_0x496d('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x17ff9f(null,_0x42f126);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9da4e7e..f2de227 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 _0x4dcf=['ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxInteraction','update','body','options','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4dcf,0x106));var _0xf4dc=function(_0x6aa0d0,_0x22ac2b){_0x6aa0d0=_0x6aa0d0-0x0;var _0x175470=_0x4dcf[_0x6aa0d0];return _0x175470;};'use strict';var _=require(_0xf4dc('0x0'));var util=require(_0xf4dc('0x1'));var moment=require(_0xf4dc('0x2'));var BPromise=require(_0xf4dc('0x3'));var rs=require(_0xf4dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4dc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4dc('0x7')][_0xf4dc('0x8')]({'port':0x232a});config['redis']=_[_0xf4dc('0x9')](config[_0xf4dc('0xa')],{'host':_0xf4dc('0xb'),'port':0x18eb});var socket=require(_0xf4dc('0xc'))(new Redis(config[_0xf4dc('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1a3d88,_0x5e1c3e,_0x3ef036){return new BPromise(function(_0x257328,_0x64fd8){return client[_0xf4dc('0xd')](_0x1a3d88,_0x3ef036)[_0xf4dc('0xe')](function(_0x57ab7e){logger[_0xf4dc('0xf')](_0xf4dc('0x10'),_0x5e1c3e,'request\x20sent');logger[_0xf4dc('0x11')](_0xf4dc('0x12'),_0x5e1c3e,_0xf4dc('0x13'),JSON[_0xf4dc('0x14')](_0x57ab7e));if(_0x57ab7e['error']){if(_0x57ab7e[_0xf4dc('0x15')]['code']===0x1f4){logger[_0xf4dc('0x15')](_0xf4dc('0x10'),_0x5e1c3e,_0x57ab7e[_0xf4dc('0x15')][_0xf4dc('0x16')]);return _0x64fd8(_0x57ab7e[_0xf4dc('0x15')]['message']);}logger[_0xf4dc('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x5e1c3e,_0x57ab7e[_0xf4dc('0x15')]['message']);return _0x257328(_0x57ab7e['error'][_0xf4dc('0x16')]);}else{logger[_0xf4dc('0xf')](_0xf4dc('0x10'),_0x5e1c3e,_0xf4dc('0x13'));_0x257328(_0x57ab7e[_0xf4dc('0x17')]['message']);}})[_0xf4dc('0x18')](function(_0xcce034){logger['error'](_0xf4dc('0x10'),_0x5e1c3e,_0xcce034);_0x64fd8(_0xcce034);});});}exports['UpdateFaxInteraction']=function(_0x4671cd){var _0x5a3717=this;return new Promise(function(_0x40fe2d,_0x5c8249){return db[_0xf4dc('0x19')][_0xf4dc('0x1a')](_0x4671cd[_0xf4dc('0x1b')],{'raw':_0x4671cd['options']?_0x4671cd[_0xf4dc('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4671cd[_0xf4dc('0x1c')]?_0x4671cd[_0xf4dc('0x1c')][_0xf4dc('0x1d')]||null:null,'attributes':_0x4671cd[_0xf4dc('0x1c')]?_0x4671cd[_0xf4dc('0x1c')][_0xf4dc('0x1e')]||null:null,'limit':_0x4671cd[_0xf4dc('0x1c')]?_0x4671cd[_0xf4dc('0x1c')][_0xf4dc('0x1f')]||null:null})[_0xf4dc('0xe')](function(_0x594d9f){logger[_0xf4dc('0xf')]('UpdateFaxInteraction',_0x4671cd);logger[_0xf4dc('0x11')](_0xf4dc('0x20'),_0x4671cd,JSON['stringify'](_0x594d9f));_0x40fe2d(_0x594d9f);})['catch'](function(_0x536355){logger[_0xf4dc('0x15')]('UpdateFaxInteraction',_0x536355[_0xf4dc('0x16')],_0x4671cd);_0x5c8249(_0x5a3717[_0xf4dc('0x15')](0x1f4,_0x536355[_0xf4dc('0x16')]));});});};exports[_0xf4dc('0x21')]=function(_0x3ab07d){return new Promise(function(_0x260b03,_0x1a4f0a){return db[_0xf4dc('0x19')]['find']({'where':_0x3ab07d[_0xf4dc('0x1c')]?_0x3ab07d[_0xf4dc('0x1c')][_0xf4dc('0x1d')]||null:null})['then'](function(_0x42d8db){if(_0x42d8db){return _0x42d8db['addTags'](_0x3ab07d[_0xf4dc('0x1b')][_0xf4dc('0x22')],_[_0xf4dc('0x23')](_0x3ab07d[_0xf4dc('0x1b')],['ids','id'])||{});}})['spread'](function(_0x3eb3d6){logger['info'](_0xf4dc('0x24'),_0x3ab07d);logger['debug'](_0xf4dc('0x24'),_0x3ab07d,JSON[_0xf4dc('0x14')](_0x3eb3d6));_0x260b03(_0x3eb3d6);})[_0xf4dc('0x18')](function(_0x188717){logger['error'](_0xf4dc('0x24'),_0x188717['message'],_0x3ab07d);_0x1a4f0a(_this['error'](0x1f4,_0x188717[_0xf4dc('0x16')]));});});}; \ No newline at end of file +var _0x022b=['attributes','limit','catch','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','body','options','raw','where'];(function(_0x6f6f18,_0x406aee){var _0x57c18c=function(_0x289369){while(--_0x289369){_0x6f6f18['push'](_0x6f6f18['shift']());}};_0x57c18c(++_0x406aee);}(_0x022b,0x127));var _0xb022=function(_0x449761,_0x4e521c){_0x449761=_0x449761-0x0;var _0x39730a=_0x022b[_0x449761];return _0x39730a;};'use strict';var _=require(_0xb022('0x0'));var util=require(_0xb022('0x1'));var moment=require(_0xb022('0x2'));var BPromise=require(_0xb022('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb022('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb022('0x5'));var logger=require('../../config/logger')(_0xb022('0x6'));var config=require(_0xb022('0x7'));var jayson=require(_0xb022('0x8'));var client=jayson[_0xb022('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb022('0xa'),'port':0x18eb});var socket=require(_0xb022('0xb'))(new Redis(config[_0xb022('0xc')]));require(_0xb022('0xd'))[_0xb022('0xe')](socket);function respondWithRpcPromise(_0x3179c9,_0x3acb05,_0x4da426){return new BPromise(function(_0x485e3b,_0x566c39){return client[_0xb022('0xf')](_0x3179c9,_0x4da426)[_0xb022('0x10')](function(_0x34881d){logger[_0xb022('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x3acb05,_0xb022('0x12'));logger[_0xb022('0x13')](_0xb022('0x14'),_0x3acb05,_0xb022('0x12'),JSON[_0xb022('0x15')](_0x34881d));if(_0x34881d['error']){if(_0x34881d[_0xb022('0x16')][_0xb022('0x17')]===0x1f4){logger[_0xb022('0x16')](_0xb022('0x18'),_0x3acb05,_0x34881d['error'][_0xb022('0x19')]);return _0x566c39(_0x34881d[_0xb022('0x16')][_0xb022('0x19')]);}logger[_0xb022('0x16')](_0xb022('0x18'),_0x3acb05,_0x34881d[_0xb022('0x16')][_0xb022('0x19')]);return _0x485e3b(_0x34881d['error'][_0xb022('0x19')]);}else{logger[_0xb022('0x11')](_0xb022('0x18'),_0x3acb05,_0xb022('0x12'));_0x485e3b(_0x34881d[_0xb022('0x1a')][_0xb022('0x19')]);}})['catch'](function(_0x35189b){logger[_0xb022('0x16')](_0xb022('0x18'),_0x3acb05,_0x35189b);_0x566c39(_0x35189b);});});}exports[_0xb022('0x1b')]=function(_0x414f87){var _0x361674=this;return new Promise(function(_0x229ff9,_0x5ed0cd){return db[_0xb022('0x1c')]['update'](_0x414f87[_0xb022('0x1d')],{'raw':_0x414f87[_0xb022('0x1e')]?_0x414f87[_0xb022('0x1e')][_0xb022('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x414f87[_0xb022('0x1e')]?_0x414f87[_0xb022('0x1e')][_0xb022('0x20')]||null:null,'attributes':_0x414f87[_0xb022('0x1e')]?_0x414f87[_0xb022('0x1e')][_0xb022('0x21')]||null:null,'limit':_0x414f87[_0xb022('0x1e')]?_0x414f87[_0xb022('0x1e')][_0xb022('0x22')]||null:null})[_0xb022('0x10')](function(_0x3dbf10){logger[_0xb022('0x11')](_0xb022('0x1b'),_0x414f87);logger[_0xb022('0x13')](_0xb022('0x1b'),_0x414f87,JSON[_0xb022('0x15')](_0x3dbf10));_0x229ff9(_0x3dbf10);})[_0xb022('0x23')](function(_0x42bef3){logger[_0xb022('0x16')](_0xb022('0x1b'),_0x42bef3['message'],_0x414f87);_0x5ed0cd(_0x361674['error'](0x1f4,_0x42bef3[_0xb022('0x19')]));});});};exports[_0xb022('0x24')]=function(_0x2a6e92){return new Promise(function(_0x5b4387,_0xce6e6c){return db[_0xb022('0x1c')]['find']({'where':_0x2a6e92['options']?_0x2a6e92[_0xb022('0x1e')][_0xb022('0x20')]||null:null})['then'](function(_0x4f6e48){if(_0x4f6e48){return _0x4f6e48[_0xb022('0x25')](_0x2a6e92['body'][_0xb022('0x26')],_[_0xb022('0x27')](_0x2a6e92[_0xb022('0x1d')],[_0xb022('0x26'),'id'])||{});}})['spread'](function(_0x4e7f38){logger['info']('AddTags',_0x2a6e92);logger[_0xb022('0x13')](_0xb022('0x28'),_0x2a6e92,JSON['stringify'](_0x4e7f38));_0x5b4387(_0x4e7f38);})[_0xb022('0x23')](function(_0x3d1c0c){logger[_0xb022('0x16')](_0xb022('0x28'),_0x3d1c0c[_0xb022('0x19')],_0x2a6e92);_0xce6e6c(_this['error'](0x1f4,_0x3d1c0c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5348ac3..2dace27 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 _0xfeb1=['update','emit','register','length','./faxInteraction.events'];(function(_0x58c5e3,_0x5a3c36){var _0x1029f9=function(_0x4712ac){while(--_0x4712ac){_0x58c5e3['push'](_0x58c5e3['shift']());}};_0x1029f9(++_0x5a3c36);}(_0xfeb1,0x6d));var _0x1feb=function(_0xcf935c,_0x26b1ab){_0xcf935c=_0xcf935c-0x0;var _0x37aeea=_0xfeb1[_0xcf935c];return _0x37aeea;};'use strict';var FaxInteractionEvents=require(_0x1feb('0x0'));var events=['save','remove',_0x1feb('0x1')];function createListener(_0x492ea4,_0x5613b4){return function(_0x524d39){_0x5613b4[_0x1feb('0x2')](_0x492ea4,_0x524d39);};}function removeListener(_0x3c2804,_0x2ecfae){return function(){FaxInteractionEvents['removeListener'](_0x3c2804,_0x2ecfae);};}exports[_0x1feb('0x3')]=function(_0x27a254){for(var _0x203626=0x0,_0x4005d2=events[_0x1feb('0x4')];_0x203626<_0x4005d2;_0x203626++){var _0x232270=events[_0x203626];var _0x2dc474=createListener('faxInteraction:'+_0x232270,_0x27a254);FaxInteractionEvents['on'](_0x232270,_0x2dc474);}}; \ No newline at end of file +var _0x5715=['register','faxInteraction:','remove','emit','removeListener'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x5715,0x1c9));var _0x5571=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x5715[_0x3792e6];return _0x441e44;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x5571('0x0'),'update'];function createListener(_0x4dcb4c,_0x4c2d1f){return function(_0x4c692e){_0x4c2d1f[_0x5571('0x1')](_0x4dcb4c,_0x4c692e);};}function removeListener(_0x4e02fc,_0x491e02){return function(){FaxInteractionEvents[_0x5571('0x2')](_0x4e02fc,_0x491e02);};}exports[_0x5571('0x3')]=function(_0x1ac5be){for(var _0x2a3536=0x0,_0x24ff56=events['length'];_0x2a3536<_0x24ff56;_0x2a3536++){var _0x5c4235=events[_0x2a3536];var _0x4d842f=createListener(_0x5571('0x4')+_0x5c4235,_0x1ac5be);FaxInteractionEvents['on'](_0x5c4235,_0x4d842f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ee0c229..0f97613 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 _0x8d61=['delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','faxinteraction:update','update'];(function(_0x1fee99,_0x5afa47){var _0x30a31b=function(_0x1ccc1){while(--_0x1ccc1){_0x1fee99['push'](_0x1fee99['shift']());}};_0x30a31b(++_0x5afa47);}(_0x8d61,0x1b3));var _0x18d6=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x8d61[_0x44bcb0];return _0xfaf881;};'use strict';var multer=require(_0x18d6('0x0'));var util=require(_0x18d6('0x1'));var path=require(_0x18d6('0x2'));var timeout=require(_0x18d6('0x3'));var express=require(_0x18d6('0x4'));var router=express[_0x18d6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x18d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x18d6('0x7'));var controller=require('./faxInteraction.controller');router[_0x18d6('0x8')]('/',auth[_0x18d6('0x9')](),controller[_0x18d6('0xa')]);router[_0x18d6('0x8')](_0x18d6('0xb'),auth[_0x18d6('0x9')](),controller['describe']);router[_0x18d6('0x8')](_0x18d6('0xc'),auth[_0x18d6('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0x18d6('0x9')](),controller[_0x18d6('0xd')]);router[_0x18d6('0x8')](_0x18d6('0xe'),auth[_0x18d6('0x9')](),controller[_0x18d6('0xf')]);router[_0x18d6('0x10')]('/',auth['isAuthenticated'](),controller[_0x18d6('0x11')]);router[_0x18d6('0x10')](_0x18d6('0x12'),auth[_0x18d6('0x9')](),controller[_0x18d6('0x13')]);router[_0x18d6('0x10')](_0x18d6('0x14'),auth[_0x18d6('0x9')](),interaction[_0x18d6('0x15')]('fax',_0x18d6('0x16')),controller[_0x18d6('0x17')]);router[_0x18d6('0x18')]('/:id',auth[_0x18d6('0x9')](),interaction['tracked']('fax',_0x18d6('0x19')),controller[_0x18d6('0x1a')]);router[_0x18d6('0x1b')](_0x18d6('0xc'),auth['isAuthenticated'](),interaction[_0x18d6('0x15')](_0x18d6('0x1c'),_0x18d6('0x1d')),controller[_0x18d6('0x1e')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x18d6('0x1f')]);module[_0x18d6('0x20')]=router; \ No newline at end of file +var _0xa4c3=['addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags'];(function(_0x2aec3d,_0x325aea){var _0x2b7984=function(_0x1e4e40){while(--_0x1e4e40){_0x2aec3d['push'](_0x2aec3d['shift']());}};_0x2b7984(++_0x325aea);}(_0xa4c3,0xb4));var _0x3a4c=function(_0x4a50ad,_0x3df8da){_0x4a50ad=_0x4a50ad-0x0;var _0x3f601e=_0xa4c3[_0x4a50ad];return _0x3f601e;};'use strict';var multer=require(_0x3a4c('0x0'));var util=require(_0x3a4c('0x1'));var path=require(_0x3a4c('0x2'));var timeout=require(_0x3a4c('0x3'));var express=require(_0x3a4c('0x4'));var router=express['Router']();var fs_extra=require(_0x3a4c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3a4c('0x6'));var config=require(_0x3a4c('0x7'));var controller=require(_0x3a4c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3a4c('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3a4c('0xa')](_0x3a4c('0xb'),auth[_0x3a4c('0xc')](),controller[_0x3a4c('0xd')]);router[_0x3a4c('0xa')](_0x3a4c('0xe'),auth[_0x3a4c('0xc')](),controller[_0x3a4c('0xf')]);router[_0x3a4c('0xa')](_0x3a4c('0x10'),auth['isAuthenticated'](),controller[_0x3a4c('0x11')]);router[_0x3a4c('0x12')]('/',auth[_0x3a4c('0xc')](),controller[_0x3a4c('0x13')]);router[_0x3a4c('0x12')](_0x3a4c('0xe'),auth['isAuthenticated'](),controller[_0x3a4c('0x14')]);router[_0x3a4c('0x12')](_0x3a4c('0x15'),auth[_0x3a4c('0xc')](),interaction['tracked'](_0x3a4c('0x16'),_0x3a4c('0x17')),controller[_0x3a4c('0x18')]);router[_0x3a4c('0x19')]('/:id',auth[_0x3a4c('0xc')](),interaction[_0x3a4c('0x1a')](_0x3a4c('0x16'),_0x3a4c('0x1b')),controller[_0x3a4c('0x1c')]);router[_0x3a4c('0x1d')](_0x3a4c('0xb'),auth['isAuthenticated'](),interaction[_0x3a4c('0x1a')]('fax',_0x3a4c('0x1e')),controller[_0x3a4c('0x1f')]);router['delete']('/:id/tags',auth[_0x3a4c('0xc')](),controller[_0x3a4c('0x20')]);module[_0x3a4c('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 86bd6d1..2f2db2b 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 _0x028d=['ENUM','out','DATE','exports','TEXT','BOOLEAN'];(function(_0x376bdd,_0x57d115){var _0x3a16cf=function(_0x4ae5f7){while(--_0x4ae5f7){_0x376bdd['push'](_0x376bdd['shift']());}};_0x3a16cf(++_0x57d115);}(_0x028d,0xff));var _0xd028=function(_0x10ab77,_0x325530){_0x10ab77=_0x10ab77-0x0;var _0x3def8b=_0x028d[_0x10ab77];return _0x3def8b;};'use strict';var Sequelize=require('sequelize');module[_0xd028('0x0')]={'body':{'type':Sequelize[_0xd028('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd028('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd028('0x3')]('in',_0xd028('0x4')),'defaultValue':_0xd028('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd028('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd028('0x5')]}}; \ No newline at end of file +var _0x826a=['TEXT','exports','medium','ENUM','out'];(function(_0x55db36,_0x1d583f){var _0x48b18e=function(_0xc7db7a){while(--_0xc7db7a){_0x55db36['push'](_0x55db36['shift']());}};_0x48b18e(++_0x1d583f);}(_0x826a,0x1aa));var _0xa826=function(_0x5be914,_0x623e4e){_0x5be914=_0x5be914-0x0;var _0x4c62a1=_0x826a[_0x5be914];return _0x4c62a1;};'use strict';var Sequelize=require('sequelize');module[_0xa826('0x0')]={'body':{'type':Sequelize['TEXT'](_0xa826('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa826('0x2')]('in',_0xa826('0x3')),'defaultValue':_0xa826('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa826('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 15df78a..cd16402 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 _0xc283=['redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','stack','name','map','FaxMessage','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','intersection','find','body','describe','fax-interactions','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','fax','rejectMessage','motionChannel','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0xc283,0x103));var _0x3c28=function(_0x47b598,_0x3aefef){_0x47b598=_0x47b598-0x0;var _0x59c939=_0xc283[_0x47b598];return _0x59c939;};'use strict';var emlformat=require(_0x3c28('0x0'));var rimraf=require(_0x3c28('0x1'));var zipdir=require(_0x3c28('0x2'));var jsonpatch=require(_0x3c28('0x3'));var rp=require('request-promise');var moment=require(_0x3c28('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c28('0x5'));var util=require(_0x3c28('0x6'));var path=require(_0x3c28('0x7'));var sox=require(_0x3c28('0x8'));var csv=require('to-csv');var ejs=require(_0x3c28('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c28('0xa'));var squel=require('squel');var crypto=require(_0x3c28('0xb'));var jsforce=require(_0x3c28('0xc'));var deskjs=require(_0x3c28('0xd'));var toCsv=require(_0x3c28('0xe'));var querystring=require('querystring');var Papa=require(_0x3c28('0xf'));var Redis=require(_0x3c28('0x10'));var authService=require(_0x3c28('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c28('0x12'));var hardwareService=require(_0x3c28('0x13'));var logger=require(_0x3c28('0x14'))(_0x3c28('0x15'));var utils=require(_0x3c28('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3c28('0x17'));var db=require(_0x3c28('0x18'))['db'];config[_0x3c28('0x19')]=_[_0x3c28('0x1a')](config[_0x3c28('0x19')],{'host':_0x3c28('0x1b'),'port':0x18eb});var socket=require(_0x3c28('0x1c'))(new Redis(config['redis']));require(_0x3c28('0x1d'))[_0x3c28('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3c28('0x1f')][_0x3c28('0x20')]({'port':0x232c});var client9002=jayson[_0x3c28('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0875,_0x5ac816,_0x1c043d,_0x1b6fd2){return new BPromise(function(_0x4f4f6d,_0x401ddb){var _0x3e0ba8=_0x1b6fd2||client;return _0x3e0ba8[_0x3c28('0x21')](_0x5e0875,_0x1c043d)[_0x3c28('0x22')](function(_0x5cd9ba){logger['info'](_0x3c28('0x23'),_0x5ac816,_0x3c28('0x24'));logger['debug'](_0x3c28('0x25'),_0x5ac816,_0x3c28('0x24'),JSON[_0x3c28('0x26')](_0x5cd9ba));if(_0x5cd9ba[_0x3c28('0x27')]){if(_0x5cd9ba[_0x3c28('0x27')][_0x3c28('0x28')]===0x1f4){logger[_0x3c28('0x27')]('FaxMessage,\x20%s,\x20%s',_0x5ac816,_0x5cd9ba[_0x3c28('0x27')]['message']);return _0x401ddb(_0x5cd9ba['error'][_0x3c28('0x29')]);}logger[_0x3c28('0x27')](_0x3c28('0x23'),_0x5ac816,_0x5cd9ba[_0x3c28('0x27')][_0x3c28('0x29')]);return _0x4f4f6d(_0x5cd9ba['error']['message']);}else{logger[_0x3c28('0x2a')](_0x3c28('0x23'),_0x5ac816,_0x3c28('0x24'));_0x4f4f6d(_0x5cd9ba[_0x3c28('0x2b')]['message']);}})[_0x3c28('0x2c')](function(_0x5b3725){logger[_0x3c28('0x27')](_0x3c28('0x23'),_0x5ac816,_0x5b3725);_0x401ddb(_0x5b3725);});});}function respondWithStatusCode(_0x4dfaaf,_0x4e46d5){_0x4e46d5=_0x4e46d5||0xcc;return function(_0x2a2d52){if(_0x2a2d52){return _0x4dfaaf[_0x3c28('0x2d')](_0x4e46d5);}return _0x4dfaaf[_0x3c28('0x2e')](_0x4e46d5)[_0x3c28('0x2f')]();};}function respondWithResult(_0x219419,_0x310196){_0x310196=_0x310196||0xc8;return function(_0x44f0bb){if(_0x44f0bb){return _0x219419['status'](_0x310196)[_0x3c28('0x30')](_0x44f0bb);}};}function respondWithFilteredResult(_0x33ce8c,_0x374e56){return function(_0x542690){if(_0x542690){var _0x419e25=typeof _0x374e56[_0x3c28('0x31')]==='undefined'&&typeof _0x374e56['limit']===_0x3c28('0x32');var _0x478c5c=_0x542690[_0x3c28('0x33')];var _0x4b0791=_0x419e25?0x0:_0x374e56[_0x3c28('0x31')];var _0x15a264=_0x419e25?_0x542690[_0x3c28('0x33')]:_0x374e56[_0x3c28('0x31')]+_0x374e56[_0x3c28('0x34')];var _0x3ba6c6;if(_0x15a264>=_0x478c5c){_0x15a264=_0x478c5c;_0x3ba6c6=0xc8;}else{_0x3ba6c6=0xce;}_0x33ce8c[_0x3c28('0x2e')](_0x3ba6c6);return _0x33ce8c['set'](_0x3c28('0x35'),_0x4b0791+'-'+_0x15a264+'/'+_0x478c5c)[_0x3c28('0x30')](_0x542690);}return null;};}function patchUpdates(_0x10ed01){return function(_0x27cb82){try{jsonpatch['apply'](_0x27cb82,_0x10ed01,!![]);}catch(_0x29f4a0){return BPromise[_0x3c28('0x36')](_0x29f4a0);}return _0x27cb82[_0x3c28('0x37')]();};}function saveUpdates(_0x9ebb1e,_0x9ec326){return function(_0x45fd2e){if(_0x45fd2e){return _0x45fd2e[_0x3c28('0x38')](_0x9ebb1e)[_0x3c28('0x22')](function(_0x52e15b){return _0x52e15b;});}return null;};}function removeEntity(_0x3675e9,_0x3c301d){return function(_0xd781f0){if(_0xd781f0){return _0xd781f0[_0x3c28('0x39')]()['then'](function(){_0x3675e9[_0x3c28('0x2e')](0xcc)[_0x3c28('0x2f')]();});}};}function handleEntityNotFound(_0x592231,_0x2bc5ce){return function(_0x3df73b){if(!_0x3df73b){_0x592231[_0x3c28('0x2d')](0x194);}return _0x3df73b;};}function handleError(_0x55f62a,_0x3f7d41){_0x3f7d41=_0x3f7d41||0x1f4;return function(_0x42dea3){logger['error'](_0x42dea3[_0x3c28('0x3a')]);if(_0x42dea3[_0x3c28('0x3b')]){delete _0x42dea3[_0x3c28('0x3b')];}_0x55f62a[_0x3c28('0x2e')](_0x3f7d41)['send'](_0x42dea3);};}exports['index']=function(_0x147f96,_0x1658a3){var _0x57842b={},_0x1de290={},_0x47ad7b={'count':0x0,'rows':[]};var _0x1a95ac=_[_0x3c28('0x3c')](db[_0x3c28('0x3d')][_0x3c28('0x3e')],function(_0x3311f3){return{'name':_0x3311f3[_0x3c28('0x3f')],'type':_0x3311f3[_0x3c28('0x40')]['key']};});_0x1de290['model']=_[_0x3c28('0x3c')](_0x1a95ac,_0x3c28('0x3b'));_0x1de290[_0x3c28('0x41')]=_[_0x3c28('0x42')](_0x147f96['query']);_0x1de290[_0x3c28('0x43')]=_['intersection'](_0x1de290[_0x3c28('0x44')],_0x1de290[_0x3c28('0x41')]);_0x57842b[_0x3c28('0x45')]=_['intersection'](_0x1de290[_0x3c28('0x44')],qs['fields'](_0x147f96['query'][_0x3c28('0x46')]));_0x57842b[_0x3c28('0x45')]=_0x57842b[_0x3c28('0x45')][_0x3c28('0x47')]?_0x57842b[_0x3c28('0x45')]:_0x1de290[_0x3c28('0x44')];if(!_0x147f96[_0x3c28('0x41')][_0x3c28('0x48')](_0x3c28('0x49'))){_0x57842b[_0x3c28('0x34')]=qs[_0x3c28('0x34')](_0x147f96[_0x3c28('0x41')][_0x3c28('0x34')]);_0x57842b[_0x3c28('0x31')]=qs[_0x3c28('0x31')](_0x147f96[_0x3c28('0x41')]['offset']);}_0x57842b[_0x3c28('0x4a')]=qs[_0x3c28('0x4b')](_0x147f96[_0x3c28('0x41')][_0x3c28('0x4b')]);_0x57842b[_0x3c28('0x4c')]=qs['filters'](_['pick'](_0x147f96[_0x3c28('0x41')],_0x1de290[_0x3c28('0x43')]),_0x1a95ac);if(_0x147f96[_0x3c28('0x41')][_0x3c28('0x4d')]){_0x57842b['where']=_['merge'](_0x57842b['where'],{'$or':_['map'](_0x1a95ac,function(_0x25897c){if(_0x25897c[_0x3c28('0x40')]!==_0x3c28('0x4e')){var _0x991331={};_0x991331[_0x25897c['name']]={'$like':'%'+_0x147f96['query']['filter']+'%'};return _0x991331;}})});}_0x57842b=_[_0x3c28('0x4f')]({},_0x57842b,_0x147f96[_0x3c28('0x50')]);var _0x5d9bb6={'where':_0x57842b[_0x3c28('0x4c')]};return db['FaxMessage'][_0x3c28('0x33')](_0x5d9bb6)[_0x3c28('0x22')](function(_0x369035){_0x47ad7b['count']=_0x369035;if(_0x147f96[_0x3c28('0x41')][_0x3c28('0x51')]){_0x57842b[_0x3c28('0x52')]=[{'all':!![]}];}return db[_0x3c28('0x3d')][_0x3c28('0x53')](_0x57842b);})[_0x3c28('0x22')](function(_0x4c883a){_0x47ad7b[_0x3c28('0x54')]=_0x4c883a;return _0x47ad7b;})[_0x3c28('0x22')](respondWithFilteredResult(_0x1658a3,_0x57842b))['catch'](handleError(_0x1658a3,null));};exports[_0x3c28('0x55')]=function(_0x243cc2,_0x431a82){var _0x265e36={'raw':!![],'where':{'id':_0x243cc2[_0x3c28('0x56')]['id']}},_0x10c6ae={};_0x10c6ae[_0x3c28('0x44')]=_['keys'](db[_0x3c28('0x3d')][_0x3c28('0x3e')]);_0x10c6ae[_0x3c28('0x41')]=_[_0x3c28('0x42')](_0x243cc2[_0x3c28('0x41')]);_0x10c6ae[_0x3c28('0x43')]=_[_0x3c28('0x57')](_0x10c6ae[_0x3c28('0x44')],_0x10c6ae['query']);_0x265e36[_0x3c28('0x45')]=_['intersection'](_0x10c6ae['model'],qs['fields'](_0x243cc2[_0x3c28('0x41')]['fields']));_0x265e36[_0x3c28('0x45')]=_0x265e36[_0x3c28('0x45')]['length']?_0x265e36[_0x3c28('0x45')]:_0x10c6ae[_0x3c28('0x44')];if(_0x243cc2[_0x3c28('0x41')]['includeAll']){_0x265e36[_0x3c28('0x52')]=[{'all':!![]}];}_0x265e36=_['merge']({},_0x265e36,_0x243cc2[_0x3c28('0x50')]);return db['FaxMessage'][_0x3c28('0x58')](_0x265e36)['then'](handleEntityNotFound(_0x431a82,null))[_0x3c28('0x22')](respondWithResult(_0x431a82,null))[_0x3c28('0x2c')](handleError(_0x431a82,null));};exports[_0x3c28('0x38')]=function(_0xcad2a9,_0x449ac8){if(_0xcad2a9[_0x3c28('0x59')]['id']){delete _0xcad2a9[_0x3c28('0x59')]['id'];}return db[_0x3c28('0x3d')][_0x3c28('0x58')]({'where':{'id':_0xcad2a9[_0x3c28('0x56')]['id']}})['then'](handleEntityNotFound(_0x449ac8,null))[_0x3c28('0x22')](saveUpdates(_0xcad2a9['body'],null))['then'](respondWithResult(_0x449ac8,null))['catch'](handleError(_0x449ac8,null));};exports['destroy']=function(_0x3d87fd,_0x48c8a1){return db['FaxMessage'][_0x3c28('0x58')]({'where':{'id':_0x3d87fd[_0x3c28('0x56')]['id']}})['then'](handleEntityNotFound(_0x48c8a1,null))['then'](removeEntity(_0x48c8a1,null))['catch'](handleError(_0x48c8a1,null));};exports[_0x3c28('0x5a')]=function(_0x137c49,_0x1b6e77){return db[_0x3c28('0x3d')]['describe']()['then'](respondWithResult(_0x1b6e77,null))[_0x3c28('0x2c')](handleError(_0x1b6e77,null));};var interaction_log=require(_0x3c28('0x14'))(_0x3c28('0x5b'));exports['accept']=function(_0x4542eb,_0x134d01,_0x2fb1fb){var _0x439a9d={'agent':{},'channel':'fax'};if(_0x4542eb[_0x3c28('0x59')]['id']){delete _0x4542eb[_0x3c28('0x59')]['id'];}_0x4542eb[_0x3c28('0x59')][_0x3c28('0x5c')]=!![];_0x4542eb[_0x3c28('0x59')]['readAt']=moment()['format'](_0x3c28('0x5d'));_0x4542eb[_0x3c28('0x59')]['UserId']=_0x4542eb[_0x3c28('0x59')][_0x3c28('0x5e')]||_0x4542eb['user']['id'];_0x439a9d[_0x3c28('0x5f')]['id']=_0x4542eb['body']['UserId'];return db[_0x3c28('0x3d')]['find']({'where':{'id':_0x4542eb[_0x3c28('0x56')]['id'],'UserId':null}})[_0x3c28('0x22')](handleEntityNotFound(_0x134d01,null))[_0x3c28('0x22')](saveUpdates(_0x4542eb[_0x3c28('0x59')],null))[_0x3c28('0x22')](function(_0x270a30){if(_0x270a30){_0x439a9d[_0x3c28('0x29')]=_0x270a30[_0x3c28('0x60')]({'plain':!![]});return db[_0x3c28('0x61')][_0x3c28('0x58')]({'where':{'id':_0x270a30[_0x3c28('0x62')]}});}return null;})[_0x3c28('0x22')](handleEntityNotFound(_0x134d01,null))[_0x3c28('0x22')](function(_0x4385e2){if(_0x4385e2){return _0x4385e2[_0x3c28('0x38')]({'UserId':_0x4542eb[_0x3c28('0x59')][_0x3c28('0x5e')],'read1stAt':_[_0x3c28('0x63')](_0x4385e2['read1stAt'])?moment()[_0x3c28('0x64')](_0x3c28('0x5d')):undefined});}return null;})[_0x3c28('0x22')](function(_0x2fe7a4){if(_0x2fe7a4){_0x439a9d[_0x3c28('0x65')]=_0x2fe7a4[_0x3c28('0x60')]({'plain':!![]});interaction_log[_0x3c28('0x2a')](_0x3c28('0x66'),_0x4542eb['user']['id'],_0x4542eb['user']['name'],_0x4542eb[_0x3c28('0x67')][_0x3c28('0x68')],_0x439a9d[_0x3c28('0x65')]['id'],_0x4542eb[_0x3c28('0x59')]?JSON['stringify'](_0x4542eb[_0x3c28('0x59')]):_0x3c28('0x69'));return respondWithRpcPromise(_0x3c28('0x6a'),_0x3c28('0x6b'),_0x439a9d);}return null;})[_0x3c28('0x22')](function(_0x41a57b){var _0x5c263a=_0x3c28('0x6c')+_0x41a57b[_0x3c28('0x29')][_0x3c28('0x6d')];return db[_0x3c28('0x6e')][_0x3c28('0x41')](_0x5c263a,{'type':db[_0x3c28('0x6f')][_0x3c28('0x70')]['SELECT'],'raw':!![]})[_0x3c28('0x22')](function(_0x17f048){return _0x17f048;});})[_0x3c28('0x22')](function(_0x1dbd5b){if(_0x1dbd5b){_0x439a9d['message'][_0x3c28('0x71')]=_0x1dbd5b[0x0];if(!_0x4542eb[_0x3c28('0x59')][_0x3c28('0x5e')])return;return db[_0x3c28('0x72')][_0x3c28('0x58')]({'where':{'id':_0x4542eb[_0x3c28('0x59')][_0x3c28('0x5e')],'role':'agent'},'attributes':['id',_0x3c28('0x3b'),_0x3c28('0x73'),_0x3c28('0x74'),_0x3c28('0x75')],'raw':!![]});}return null;})['then'](function(_0x59f2a9){if(!_0x59f2a9)return null;_0x439a9d['message']['agent']=_0x59f2a9;return _0x439a9d;})[_0x3c28('0x22')](function(_0x55f12e){if(_0x55f12e){if(_0x4542eb[_0x3c28('0x59')][_0x3c28('0x76')]){_0x439a9d[_0x3c28('0x29')][_0x3c28('0x77')]=util[_0x3c28('0x64')](_0x3c28('0x78'),_0x4542eb[_0x3c28('0x67')][_0x3c28('0x3b')]);_0x439a9d['message'][_0x3c28('0x79')]=_0x439a9d[_0x3c28('0x79')];_0x439a9d['message']['motionChannel']=_0x439a9d[_0x3c28('0x79')];_0x439a9d['message'][_0x3c28('0x7a')]=_0x3c28('0x7b');return respondWithRpcPromise(_0x3c28('0x7c'),_0x3c28('0x7c'),{'event':'acceptmessage','message':_0x439a9d[_0x3c28('0x29')]},client9002)[_0x3c28('0x22')](function(){return _0x439a9d;});}return _0x439a9d;}return null;})['then'](respondWithResult(_0x134d01,null))['catch'](handleError(_0x134d01,null));};var interaction_log=require(_0x3c28('0x14'))(_0x3c28('0x5b'));exports[_0x3c28('0x36')]=function(_0x37b737,_0x5a6314,_0x1ca1fc){var _0x517de0={'agent':{},'channel':_0x3c28('0x7d')};if(_0x37b737[_0x3c28('0x59')]['id']){delete _0x37b737[_0x3c28('0x59')]['id'];}_0x37b737[_0x3c28('0x59')][_0x3c28('0x5e')]=_0x37b737[_0x3c28('0x59')]['UserId']||_0x37b737[_0x3c28('0x67')]['id'];_0x517de0['agent']['id']=_0x37b737['body']['UserId'];return db[_0x3c28('0x3d')]['find']({'where':{'id':_0x37b737[_0x3c28('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a6314,null))[_0x3c28('0x22')](function(_0x1729a4){if(_0x1729a4){_0x517de0[_0x3c28('0x29')]=_0x1729a4[_0x3c28('0x60')]({'plain':!![]});return db[_0x3c28('0x61')][_0x3c28('0x58')]({'where':{'id':_0x1729a4[_0x3c28('0x62')]}});}return null;})[_0x3c28('0x22')](handleEntityNotFound(_0x5a6314,null))['then'](function(_0x2ec892){if(_0x2ec892){_0x517de0[_0x3c28('0x65')]=_0x2ec892[_0x3c28('0x60')]({'plain':!![]});interaction_log[_0x3c28('0x2a')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37b737[_0x3c28('0x67')]['id'],_0x37b737[_0x3c28('0x67')][_0x3c28('0x3b')],_0x37b737[_0x3c28('0x67')]['role'],_0x517de0[_0x3c28('0x65')]['id'],_0x37b737[_0x3c28('0x59')]?JSON['stringify'](_0x37b737[_0x3c28('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0x3c28('0x7e'),_0x517de0);}return null;})[_0x3c28('0x22')](function(_0x8d90b6){var _0x1fca47=_0x3c28('0x6c')+_0x8d90b6[_0x3c28('0x29')][_0x3c28('0x6d')];return db['sequelize'][_0x3c28('0x41')](_0x1fca47,{'type':db['Sequelize'][_0x3c28('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x29542a){return _0x29542a;});})[_0x3c28('0x22')](function(_0x2d6bbe){if(_0x2d6bbe){_0x517de0[_0x3c28('0x29')]['contact']=_0x2d6bbe[0x0];if(!_0x37b737[_0x3c28('0x59')][_0x3c28('0x5e')])return;return db[_0x3c28('0x72')][_0x3c28('0x58')]({'where':{'id':_0x37b737['body'][_0x3c28('0x5e')],'role':_0x3c28('0x5f')},'attributes':['id','name',_0x3c28('0x73'),_0x3c28('0x74'),'internal'],'raw':!![]});}return null;})[_0x3c28('0x22')](function(_0x3011ec){if(!_0x3011ec)return null;_0x517de0[_0x3c28('0x29')][_0x3c28('0x5f')]=_0x3011ec;return _0x517de0;})[_0x3c28('0x22')](function(_0x180494){if(_0x180494){_0x180494[_0x3c28('0x29')][_0x3c28('0x77')]=util[_0x3c28('0x64')](_0x3c28('0x78'),_0x37b737[_0x3c28('0x67')][_0x3c28('0x3b')]);_0x180494[_0x3c28('0x29')][_0x3c28('0x79')]=_0x517de0[_0x3c28('0x79')];_0x180494[_0x3c28('0x29')][_0x3c28('0x7f')]=_0x517de0[_0x3c28('0x79')];_0x180494[_0x3c28('0x29')]['event']='reject';respondWithRpcPromise(_0x3c28('0x7c'),_0x3c28('0x7c'),{'event':_0x3c28('0x80'),'message':_0x180494[_0x3c28('0x29')]},client9002);return _0x517de0;}return null;})[_0x3c28('0x22')](respondWithResult(_0x5a6314,null))[_0x3c28('0x2c')](handleError(_0x5a6314,null));};exports[_0x3c28('0x81')]=function(_0x373f67,_0x5269ec){var _0x5d7c0d;return db['FaxMessage'][_0x3c28('0x81')](_0x373f67[_0x3c28('0x59')],{})['then'](function(_0x2066c7){_0x5d7c0d=_0x2066c7;return db['CmContact']['findOne']({'where':{'id':_0x5d7c0d[_0x3c28('0x6d')]}});})[_0x3c28('0x22')](function(_0x1c930f){if(_['isNil'](_0x1c930f)){return;}else{_0x5d7c0d[_0x3c28('0x7d')]=_0x1c930f[_0x3c28('0x7d')];return db[_0x3c28('0x82')][_0x3c28('0x83')]({'where':{'id':_0x5d7c0d[_0x3c28('0x84')]}});}})[_0x3c28('0x22')](function(_0x30d49e){return respondWithRpcPromise('SendFax',_0x3c28('0x85'),{'FaxAccountId':_[_0x3c28('0x63')](_0x373f67[_0x3c28('0x59')])?undefined:_0x373f67[_0x3c28('0x59')][_0x3c28('0x86')],'path':_['isNil'](_0x30d49e)?undefined:util[_0x3c28('0x64')](_0x3c28('0x87'),_0x30d49e[_0x3c28('0x88')]),'fax':_[_0x3c28('0x63')](_0x5d7c0d[_0x3c28('0x7d')])?undefined:_0x5d7c0d[_0x3c28('0x7d')],'AttachmentId':_0x5d7c0d[_0x3c28('0x84')]},client9002);})[_0x3c28('0x22')](respondWithResult(_0x5269ec,0xc9))['catch'](handleError(_0x5269ec,null));};exports[_0x3c28('0x89')]=function(_0x45f29d,_0x599b22){var _0x5d4589=path[_0x3c28('0x8a')](config['root'],_0x3c28('0x8b'),_0x3c28('0x8c'),_0x3c28('0x8d'));return db[_0x3c28('0x3d')]['find']({'where':{'id':_0x45f29d[_0x3c28('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0x3c28('0x82')}]})[_0x3c28('0x22')](handleEntityNotFound(_0x599b22,null))['then'](function(_0x20b5d1){if(_0x20b5d1){return _0x599b22[_0x3c28('0x89')](path[_0x3c28('0x8a')](_0x5d4589,_0x20b5d1[_0x3c28('0x82')][_0x3c28('0x88')]));}})[_0x3c28('0x2c')](handleError(_0x599b22,null));}; \ No newline at end of file +var _0x1846=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','interface','format','SIP/%s','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','sequelize','Sequelize','fullname','email','internal','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','basename','download','join','server','attachments','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','map','FaxMessage','rawAttributes','fieldName','type','key'];(function(_0x376511,_0x2eea33){var _0x248448=function(_0x165a8a){while(--_0x165a8a){_0x376511['push'](_0x376511['shift']());}};_0x248448(++_0x2eea33);}(_0x1846,0x1eb));var _0x6184=function(_0x1af2ef,_0x292578){_0x1af2ef=_0x1af2ef-0x0;var _0x55fbc2=_0x1846[_0x1af2ef];return _0x55fbc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6184('0x0'));var zipdir=require(_0x6184('0x1'));var jsonpatch=require(_0x6184('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6184('0x3'));var Mustache=require(_0x6184('0x4'));var util=require(_0x6184('0x5'));var path=require(_0x6184('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6184('0x7'));var fs=require('fs');var fs_extra=require(_0x6184('0x8'));var _=require(_0x6184('0x9'));var squel=require(_0x6184('0xa'));var crypto=require(_0x6184('0xb'));var jsforce=require(_0x6184('0xc'));var deskjs=require(_0x6184('0xd'));var toCsv=require(_0x6184('0xe'));var querystring=require(_0x6184('0xf'));var Papa=require(_0x6184('0x10'));var Redis=require(_0x6184('0x11'));var authService=require(_0x6184('0x12'));var qs=require(_0x6184('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6184('0x14'));var logger=require('../../config/logger')(_0x6184('0x15'));var utils=require(_0x6184('0x16'));var config=require(_0x6184('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6184('0x18'))['db'];config[_0x6184('0x19')]=_[_0x6184('0x1a')](config[_0x6184('0x19')],{'host':_0x6184('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6184('0x19')]));require(_0x6184('0x1c'))['register'](socket);var jayson=require(_0x6184('0x1d'));var client=jayson[_0x6184('0x1e')][_0x6184('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x6184('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xc0c626,_0x55c5cb,_0x2c47d2,_0x35db75){return new BPromise(function(_0x40303b,_0x12c589){var _0x45d734=_0x35db75||client;return _0x45d734[_0x6184('0x20')](_0xc0c626,_0x2c47d2)[_0x6184('0x21')](function(_0xac2809){logger[_0x6184('0x22')](_0x6184('0x23'),_0x55c5cb,'request\x20sent');logger[_0x6184('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x55c5cb,_0x6184('0x25'),JSON['stringify'](_0xac2809));if(_0xac2809[_0x6184('0x26')]){if(_0xac2809[_0x6184('0x26')][_0x6184('0x27')]===0x1f4){logger[_0x6184('0x26')](_0x6184('0x23'),_0x55c5cb,_0xac2809['error'][_0x6184('0x28')]);return _0x12c589(_0xac2809['error']['message']);}logger[_0x6184('0x26')](_0x6184('0x23'),_0x55c5cb,_0xac2809[_0x6184('0x26')]['message']);return _0x40303b(_0xac2809[_0x6184('0x26')][_0x6184('0x28')]);}else{logger[_0x6184('0x22')](_0x6184('0x23'),_0x55c5cb,_0x6184('0x25'));_0x40303b(_0xac2809['result']['message']);}})[_0x6184('0x29')](function(_0x567678){logger['error'](_0x6184('0x23'),_0x55c5cb,_0x567678);_0x12c589(_0x567678);});});}function respondWithStatusCode(_0x38073a,_0x19a25a){_0x19a25a=_0x19a25a||0xcc;return function(_0x269d80){if(_0x269d80){return _0x38073a[_0x6184('0x2a')](_0x19a25a);}return _0x38073a[_0x6184('0x2b')](_0x19a25a)[_0x6184('0x2c')]();};}function respondWithResult(_0x2945f2,_0x2ebe93){_0x2ebe93=_0x2ebe93||0xc8;return function(_0x3d3b4c){if(_0x3d3b4c){return _0x2945f2[_0x6184('0x2b')](_0x2ebe93)[_0x6184('0x2d')](_0x3d3b4c);}};}function respondWithFilteredResult(_0x15ad62,_0x2128e4){return function(_0x2c7908){if(_0x2c7908){var _0x340488=typeof _0x2128e4[_0x6184('0x2e')]===_0x6184('0x2f')&&typeof _0x2128e4[_0x6184('0x30')]==='undefined';var _0x9db3ac=_0x2c7908[_0x6184('0x31')];var _0x132e7b=_0x340488?0x0:_0x2128e4['offset'];var _0x480503=_0x340488?_0x2c7908[_0x6184('0x31')]:_0x2128e4[_0x6184('0x2e')]+_0x2128e4[_0x6184('0x30')];var _0xfa56c3;if(_0x480503>=_0x9db3ac){_0x480503=_0x9db3ac;_0xfa56c3=0xc8;}else{_0xfa56c3=0xce;}_0x15ad62[_0x6184('0x2b')](_0xfa56c3);return _0x15ad62[_0x6184('0x32')](_0x6184('0x33'),_0x132e7b+'-'+_0x480503+'/'+_0x9db3ac)[_0x6184('0x2d')](_0x2c7908);}return null;};}function patchUpdates(_0x491d97){return function(_0x2244f4){try{jsonpatch[_0x6184('0x34')](_0x2244f4,_0x491d97,!![]);}catch(_0x2a67ec){return BPromise[_0x6184('0x35')](_0x2a67ec);}return _0x2244f4[_0x6184('0x36')]();};}function saveUpdates(_0x51ba51,_0x13f32f){return function(_0x4dd328){if(_0x4dd328){return _0x4dd328[_0x6184('0x37')](_0x51ba51)[_0x6184('0x21')](function(_0x1e1287){return _0x1e1287;});}return null;};}function removeEntity(_0x2f608e,_0x301743){return function(_0x14613c){if(_0x14613c){return _0x14613c[_0x6184('0x38')]()[_0x6184('0x21')](function(){_0x2f608e[_0x6184('0x2b')](0xcc)[_0x6184('0x2c')]();});}};}function handleEntityNotFound(_0x3d4978,_0x487e74){return function(_0x29ec19){if(!_0x29ec19){_0x3d4978[_0x6184('0x2a')](0x194);}return _0x29ec19;};}function handleError(_0xc3cd82,_0x375aa3){_0x375aa3=_0x375aa3||0x1f4;return function(_0x5c5d5b){logger[_0x6184('0x26')](_0x5c5d5b['stack']);if(_0x5c5d5b[_0x6184('0x39')]){delete _0x5c5d5b[_0x6184('0x39')];}_0xc3cd82['status'](_0x375aa3)[_0x6184('0x3a')](_0x5c5d5b);};}exports['index']=function(_0x589bc0,_0x1cc9c2){var _0x49f882={},_0x16272e={},_0x112631={'count':0x0,'rows':[]};var _0x15266f=_[_0x6184('0x3b')](db[_0x6184('0x3c')][_0x6184('0x3d')],function(_0x451ead){return{'name':_0x451ead[_0x6184('0x3e')],'type':_0x451ead[_0x6184('0x3f')][_0x6184('0x40')]};});_0x16272e[_0x6184('0x41')]=_[_0x6184('0x3b')](_0x15266f,_0x6184('0x39'));_0x16272e[_0x6184('0x42')]=_[_0x6184('0x43')](_0x589bc0[_0x6184('0x42')]);_0x16272e[_0x6184('0x44')]=_[_0x6184('0x45')](_0x16272e[_0x6184('0x41')],_0x16272e[_0x6184('0x42')]);_0x49f882[_0x6184('0x46')]=_['intersection'](_0x16272e[_0x6184('0x41')],qs[_0x6184('0x47')](_0x589bc0[_0x6184('0x42')][_0x6184('0x47')]));_0x49f882[_0x6184('0x46')]=_0x49f882[_0x6184('0x46')][_0x6184('0x48')]?_0x49f882['attributes']:_0x16272e[_0x6184('0x41')];if(!_0x589bc0[_0x6184('0x42')][_0x6184('0x49')]('nolimit')){_0x49f882['limit']=qs[_0x6184('0x30')](_0x589bc0[_0x6184('0x42')][_0x6184('0x30')]);_0x49f882[_0x6184('0x2e')]=qs[_0x6184('0x2e')](_0x589bc0[_0x6184('0x42')][_0x6184('0x2e')]);}_0x49f882['order']=qs[_0x6184('0x4a')](_0x589bc0['query'][_0x6184('0x4a')]);_0x49f882[_0x6184('0x4b')]=qs[_0x6184('0x44')](_['pick'](_0x589bc0[_0x6184('0x42')],_0x16272e[_0x6184('0x44')]),_0x15266f);if(_0x589bc0[_0x6184('0x42')]['filter']){_0x49f882[_0x6184('0x4b')]=_['merge'](_0x49f882[_0x6184('0x4b')],{'$or':_[_0x6184('0x3b')](_0x15266f,function(_0x4327f5){if(_0x4327f5[_0x6184('0x3f')]!==_0x6184('0x4c')){var _0x236dc6={};_0x236dc6[_0x4327f5[_0x6184('0x39')]]={'$like':'%'+_0x589bc0['query'][_0x6184('0x4d')]+'%'};return _0x236dc6;}})});}_0x49f882=_[_0x6184('0x4e')]({},_0x49f882,_0x589bc0[_0x6184('0x4f')]);var _0x706502={'where':_0x49f882[_0x6184('0x4b')]};return db['FaxMessage']['count'](_0x706502)[_0x6184('0x21')](function(_0x5b0ecb){_0x112631['count']=_0x5b0ecb;if(_0x589bc0[_0x6184('0x42')][_0x6184('0x50')]){_0x49f882[_0x6184('0x51')]=[{'all':!![]}];}return db[_0x6184('0x3c')][_0x6184('0x52')](_0x49f882);})['then'](function(_0x39db16){_0x112631['rows']=_0x39db16;return _0x112631;})[_0x6184('0x21')](respondWithFilteredResult(_0x1cc9c2,_0x49f882))['catch'](handleError(_0x1cc9c2,null));};exports[_0x6184('0x53')]=function(_0x28e6ea,_0x29763c){var _0x68a9f6={'raw':!![],'where':{'id':_0x28e6ea[_0x6184('0x54')]['id']}},_0x5e26a4={};_0x5e26a4[_0x6184('0x41')]=_[_0x6184('0x43')](db[_0x6184('0x3c')]['rawAttributes']);_0x5e26a4[_0x6184('0x42')]=_[_0x6184('0x43')](_0x28e6ea['query']);_0x5e26a4[_0x6184('0x44')]=_[_0x6184('0x45')](_0x5e26a4['model'],_0x5e26a4[_0x6184('0x42')]);_0x68a9f6['attributes']=_['intersection'](_0x5e26a4[_0x6184('0x41')],qs[_0x6184('0x47')](_0x28e6ea[_0x6184('0x42')][_0x6184('0x47')]));_0x68a9f6[_0x6184('0x46')]=_0x68a9f6[_0x6184('0x46')]['length']?_0x68a9f6['attributes']:_0x5e26a4[_0x6184('0x41')];if(_0x28e6ea[_0x6184('0x42')][_0x6184('0x50')]){_0x68a9f6[_0x6184('0x51')]=[{'all':!![]}];}_0x68a9f6=_[_0x6184('0x4e')]({},_0x68a9f6,_0x28e6ea[_0x6184('0x4f')]);return db[_0x6184('0x3c')][_0x6184('0x55')](_0x68a9f6)[_0x6184('0x21')](handleEntityNotFound(_0x29763c,null))['then'](respondWithResult(_0x29763c,null))[_0x6184('0x29')](handleError(_0x29763c,null));};exports['update']=function(_0x3889d6,_0x33331c){if(_0x3889d6['body']['id']){delete _0x3889d6['body']['id'];}return db['FaxMessage'][_0x6184('0x55')]({'where':{'id':_0x3889d6[_0x6184('0x54')]['id']}})[_0x6184('0x21')](handleEntityNotFound(_0x33331c,null))[_0x6184('0x21')](saveUpdates(_0x3889d6[_0x6184('0x56')],null))['then'](respondWithResult(_0x33331c,null))[_0x6184('0x29')](handleError(_0x33331c,null));};exports[_0x6184('0x38')]=function(_0x5c3a06,_0x2cdde6){return db[_0x6184('0x3c')][_0x6184('0x55')]({'where':{'id':_0x5c3a06[_0x6184('0x54')]['id']}})[_0x6184('0x21')](handleEntityNotFound(_0x2cdde6,null))['then'](removeEntity(_0x2cdde6,null))[_0x6184('0x29')](handleError(_0x2cdde6,null));};exports[_0x6184('0x57')]=function(_0x405898,_0x52e624){return db[_0x6184('0x3c')][_0x6184('0x57')]()['then'](respondWithResult(_0x52e624,null))['catch'](handleError(_0x52e624,null));};var interaction_log=require(_0x6184('0x58'))(_0x6184('0x59'));exports[_0x6184('0x5a')]=function(_0x2db24e,_0x4afc83,_0x2250ba){var _0x31e4b7={'agent':{},'channel':_0x6184('0x5b')};if(_0x2db24e[_0x6184('0x56')]['id']){delete _0x2db24e['body']['id'];}_0x2db24e['body'][_0x6184('0x5c')]=!![];_0x2db24e[_0x6184('0x56')][_0x6184('0x5d')]=moment()['format'](_0x6184('0x5e'));_0x2db24e[_0x6184('0x56')]['UserId']=_0x2db24e[_0x6184('0x56')][_0x6184('0x5f')]||_0x2db24e[_0x6184('0x60')]['id'];_0x31e4b7[_0x6184('0x61')]['id']=_0x2db24e[_0x6184('0x56')]['UserId'];return db[_0x6184('0x3c')]['find']({'where':{'id':_0x2db24e[_0x6184('0x54')]['id'],'UserId':null}})[_0x6184('0x21')](handleEntityNotFound(_0x4afc83,null))['then'](saveUpdates(_0x2db24e[_0x6184('0x56')],null))[_0x6184('0x21')](function(_0x1599c2){if(_0x1599c2){_0x31e4b7['message']=_0x1599c2['get']({'plain':!![]});return db[_0x6184('0x62')][_0x6184('0x55')]({'where':{'id':_0x1599c2[_0x6184('0x63')]}});}return null;})[_0x6184('0x21')](handleEntityNotFound(_0x4afc83,null))[_0x6184('0x21')](function(_0x3513f4){if(_0x3513f4){return _0x3513f4[_0x6184('0x37')]({'UserId':_0x2db24e[_0x6184('0x56')]['UserId'],'read1stAt':_[_0x6184('0x64')](_0x3513f4[_0x6184('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6184('0x21')](function(_0x49dd09){if(_0x49dd09){_0x31e4b7[_0x6184('0x66')]=_0x49dd09[_0x6184('0x67')]({'plain':!![]});interaction_log[_0x6184('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2db24e[_0x6184('0x60')]['id'],_0x2db24e[_0x6184('0x60')]['name'],_0x2db24e[_0x6184('0x60')]['role'],_0x31e4b7[_0x6184('0x66')]['id'],_0x2db24e[_0x6184('0x56')]?JSON[_0x6184('0x68')](_0x2db24e['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x6184('0x69'),_0x31e4b7);}return null;})['then'](function(_0x5ef199){var _0x102d2b=_0x6184('0x6a')+_0x5ef199[_0x6184('0x28')][_0x6184('0x6b')];return db['sequelize'][_0x6184('0x42')](_0x102d2b,{'type':db['Sequelize'][_0x6184('0x6c')][_0x6184('0x6d')],'raw':!![]})['then'](function(_0x52d9a2){return _0x52d9a2;});})['then'](function(_0x2c92f3){if(_0x2c92f3){_0x31e4b7[_0x6184('0x28')][_0x6184('0x6e')]=_0x2c92f3[0x0];if(!_0x2db24e[_0x6184('0x56')][_0x6184('0x5f')])return;return db[_0x6184('0x6f')][_0x6184('0x55')]({'where':{'id':_0x2db24e[_0x6184('0x56')][_0x6184('0x5f')],'role':_0x6184('0x61')},'attributes':['id',_0x6184('0x39'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x6184('0x21')](function(_0x59705a){if(!_0x59705a)return null;_0x31e4b7['message'][_0x6184('0x61')]=_0x59705a;return _0x31e4b7;})[_0x6184('0x21')](function(_0x5945d3){if(_0x5945d3){if(_0x2db24e[_0x6184('0x56')]['manual']){_0x31e4b7[_0x6184('0x28')][_0x6184('0x70')]=util[_0x6184('0x71')](_0x6184('0x72'),_0x2db24e[_0x6184('0x60')][_0x6184('0x39')]);_0x31e4b7['message'][_0x6184('0x73')]=_0x31e4b7[_0x6184('0x73')];_0x31e4b7[_0x6184('0x28')][_0x6184('0x74')]=_0x31e4b7[_0x6184('0x73')];_0x31e4b7[_0x6184('0x28')][_0x6184('0x75')]=_0x6184('0x5a');return respondWithRpcPromise(_0x6184('0x76'),_0x6184('0x76'),{'event':'acceptmessage','message':_0x31e4b7[_0x6184('0x28')]},client9002)[_0x6184('0x21')](function(){return _0x31e4b7;});}return _0x31e4b7;}return null;})['then'](respondWithResult(_0x4afc83,null))[_0x6184('0x29')](handleError(_0x4afc83,null));};var interaction_log=require(_0x6184('0x58'))(_0x6184('0x59'));exports['reject']=function(_0x51a4cf,_0x35e19d,_0x5a8e2f){var _0x353b66={'agent':{},'channel':_0x6184('0x5b')};if(_0x51a4cf[_0x6184('0x56')]['id']){delete _0x51a4cf[_0x6184('0x56')]['id'];}_0x51a4cf['body'][_0x6184('0x5f')]=_0x51a4cf[_0x6184('0x56')][_0x6184('0x5f')]||_0x51a4cf[_0x6184('0x60')]['id'];_0x353b66[_0x6184('0x61')]['id']=_0x51a4cf[_0x6184('0x56')][_0x6184('0x5f')];return db['FaxMessage'][_0x6184('0x55')]({'where':{'id':_0x51a4cf[_0x6184('0x54')]['id'],'UserId':null}})[_0x6184('0x21')](handleEntityNotFound(_0x35e19d,null))[_0x6184('0x21')](function(_0x511d5c){if(_0x511d5c){_0x353b66[_0x6184('0x28')]=_0x511d5c[_0x6184('0x67')]({'plain':!![]});return db['FaxInteraction'][_0x6184('0x55')]({'where':{'id':_0x511d5c[_0x6184('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x35e19d,null))[_0x6184('0x21')](function(_0x268b62){if(_0x268b62){_0x353b66[_0x6184('0x66')]=_0x268b62['get']({'plain':!![]});interaction_log[_0x6184('0x22')](_0x6184('0x77'),_0x51a4cf['user']['id'],_0x51a4cf[_0x6184('0x60')]['name'],_0x51a4cf[_0x6184('0x60')][_0x6184('0x78')],_0x353b66[_0x6184('0x66')]['id'],_0x51a4cf[_0x6184('0x56')]?JSON['stringify'](_0x51a4cf[_0x6184('0x56')]):'null');return respondWithRpcPromise(_0x6184('0x79'),'rejectMessage',_0x353b66);}return null;})['then'](function(_0x369847){var _0x5612ab=_0x6184('0x6a')+_0x369847[_0x6184('0x28')][_0x6184('0x6b')];return db[_0x6184('0x7a')][_0x6184('0x42')](_0x5612ab,{'type':db[_0x6184('0x7b')][_0x6184('0x6c')][_0x6184('0x6d')],'raw':!![]})['then'](function(_0x203e94){return _0x203e94;});})[_0x6184('0x21')](function(_0x472ee2){if(_0x472ee2){_0x353b66['message']['contact']=_0x472ee2[0x0];if(!_0x51a4cf[_0x6184('0x56')][_0x6184('0x5f')])return;return db[_0x6184('0x6f')]['find']({'where':{'id':_0x51a4cf[_0x6184('0x56')][_0x6184('0x5f')],'role':_0x6184('0x61')},'attributes':['id','name',_0x6184('0x7c'),_0x6184('0x7d'),_0x6184('0x7e')],'raw':!![]});}return null;})[_0x6184('0x21')](function(_0x2d35af){if(!_0x2d35af)return null;_0x353b66[_0x6184('0x28')][_0x6184('0x61')]=_0x2d35af;return _0x353b66;})[_0x6184('0x21')](function(_0x2a2a4d){if(_0x2a2a4d){_0x2a2a4d[_0x6184('0x28')][_0x6184('0x70')]=util[_0x6184('0x71')](_0x6184('0x72'),_0x51a4cf[_0x6184('0x60')]['name']);_0x2a2a4d[_0x6184('0x28')][_0x6184('0x73')]=_0x353b66[_0x6184('0x73')];_0x2a2a4d[_0x6184('0x28')][_0x6184('0x74')]=_0x353b66[_0x6184('0x73')];_0x2a2a4d[_0x6184('0x28')][_0x6184('0x75')]='reject';respondWithRpcPromise(_0x6184('0x76'),_0x6184('0x76'),{'event':_0x6184('0x7f'),'message':_0x2a2a4d['message']},client9002);return _0x353b66;}return null;})['then'](respondWithResult(_0x35e19d,null))[_0x6184('0x29')](handleError(_0x35e19d,null));};exports[_0x6184('0x80')]=function(_0x3f6c80,_0x529967){var _0x41cbaf;return db[_0x6184('0x3c')][_0x6184('0x80')](_0x3f6c80[_0x6184('0x56')],{})[_0x6184('0x21')](function(_0x5e333a){_0x41cbaf=_0x5e333a;return db[_0x6184('0x81')]['findOne']({'where':{'id':_0x41cbaf[_0x6184('0x6b')]}});})[_0x6184('0x21')](function(_0x4b2748){if(_[_0x6184('0x64')](_0x4b2748)){return;}else{_0x41cbaf[_0x6184('0x5b')]=_0x4b2748[_0x6184('0x5b')];return db[_0x6184('0x82')][_0x6184('0x83')]({'where':{'id':_0x41cbaf[_0x6184('0x84')]}});}})[_0x6184('0x21')](function(_0xf6e41d){return respondWithRpcPromise(_0x6184('0x85'),'SendFax',{'FaxAccountId':_[_0x6184('0x64')](_0x3f6c80[_0x6184('0x56')])?undefined:_0x3f6c80[_0x6184('0x56')]['FaxAccountId'],'path':_[_0x6184('0x64')](_0xf6e41d)?undefined:util[_0x6184('0x71')]('/var/opt/motion2/server/files/attachments/%s',_0xf6e41d[_0x6184('0x86')]),'fax':_[_0x6184('0x64')](_0x41cbaf[_0x6184('0x5b')])?undefined:_0x41cbaf[_0x6184('0x5b')],'AttachmentId':_0x41cbaf['AttachmentId']},client9002);})[_0x6184('0x21')](respondWithResult(_0x529967,0xc9))[_0x6184('0x29')](handleError(_0x529967,null));};exports[_0x6184('0x87')]=function(_0x157076,_0xb83e74){var _0x2cc5f0=path[_0x6184('0x88')](config['root'],_0x6184('0x89'),'files',_0x6184('0x8a'));return db[_0x6184('0x3c')][_0x6184('0x55')]({'where':{'id':_0x157076['params']['id']},'include':[{'model':db[_0x6184('0x82')],'as':_0x6184('0x82')}]})[_0x6184('0x21')](handleEntityNotFound(_0xb83e74,null))[_0x6184('0x21')](function(_0x32051e){if(_0x32051e){return _0xb83e74[_0x6184('0x87')](path[_0x6184('0x88')](_0x2cc5f0,_0x32051e[_0x6184('0x82')][_0x6184('0x86')]));}})[_0x6184('0x29')](handleError(_0xb83e74,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 02a9579..91d91a2 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 _0xdbcd=['save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x2f0aeb,_0x352ed3){var _0x3183b4=function(_0x99b937){while(--_0x99b937){_0x2f0aeb['push'](_0x2f0aeb['shift']());}};_0x3183b4(++_0x352ed3);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x581871,_0x3d80f0){_0x581871=_0x581871-0x0;var _0x2e0a79=_0xdbcd[_0x581871];return _0x2e0a79;};'use strict';var EventEmitter=require(_0xddbc('0x0'));var FaxMessage=require(_0xddbc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xddbc('0x2'),'afterUpdate':_0xddbc('0x3'),'afterDestroy':_0xddbc('0x4')};function emitEvent(_0x59c52a){return function(_0x1ce7da,_0x11a04e,_0x4816af){FaxMessageEvents['emit'](_0x59c52a+':'+_0x1ce7da['id'],_0x1ce7da);FaxMessageEvents['emit'](_0x59c52a,_0x1ce7da);_0x4816af(null);};}for(var e in events){if(events[_0xddbc('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xed5c=['remove','emit','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x494f7f,_0x34a09b){var _0x18ebe4=function(_0x178e2e){while(--_0x178e2e){_0x494f7f['push'](_0x494f7f['shift']());}};_0x18ebe4(++_0x34a09b);}(_0xed5c,0x81));var _0xced5=function(_0x128257,_0x2f233a){_0x128257=_0x128257-0x0;var _0x525231=_0xed5c[_0x128257];return _0x525231;};'use strict';var EventEmitter=require(_0xced5('0x0'));var FaxMessage=require(_0xced5('0x1'))['db'][_0xced5('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xced5('0x3')](0x0);var events={'afterCreate':_0xced5('0x4'),'afterUpdate':_0xced5('0x5'),'afterDestroy':_0xced5('0x6')};function emitEvent(_0x395c27){return function(_0x2b8184,_0x2ec4f9,_0x583a62){FaxMessageEvents[_0xced5('0x7')](_0x395c27+':'+_0x2b8184['id'],_0x2b8184);FaxMessageEvents[_0xced5('0x7')](_0x395c27,_0x2b8184);_0x583a62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xced5('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d616ed7..c404d1b 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 _0x053b=['define','fax_messages','FULLTEXT','get','toLowerCase','out','secret','isNil','UserId','FaxInteraction','then','createdAt','direction','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x053b,0xf0));var _0xb053=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x053b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb053('0x0'));var util=require(_0xb053('0x1'));var logger=require(_0xb053('0x2'))('api');var moment=require(_0xb053('0x3'));var BPromise=require(_0xb053('0x4'));var rp=require(_0xb053('0x5'));var fs=require('fs');var path=require(_0xb053('0x6'));var rimraf=require(_0xb053('0x7'));var config=require(_0xb053('0x8'));var attributes=require(_0xb053('0x9'));module['exports']=function(_0x110ecc,_0x2ce58b){return _0x110ecc[_0xb053('0xa')]('FaxMessage',attributes,{'tableName':_0xb053('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xb053('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fe92b,_0x3eff7d,_0x1a0b90){var _0x148ece=_0x110ecc['models'];var _0x508543=_0x1fe92b[_0xb053('0xd')]({'plain':!![]});if(_0x508543['direction'][_0xb053('0xe')]()==='in'||_0x508543['direction']['toLowerCase']()===_0xb053('0xf')&&!_0x508543[_0xb053('0x10')]&&!_[_0xb053('0x11')](_0x508543[_0xb053('0x12')])){_0x148ece[_0xb053('0x13')]['findOne']({'where':{'id':_0x508543['FaxInteractionId']}})[_0xb053('0x14')](function(_0x1344e4){if(_0x1344e4){_0x1344e4['update']({'lastMsgAt':_0x508543[_0xb053('0x15')],'lastMsgDirection':_0x508543[_0xb053('0x16')]['toLowerCase']()});}})[_0xb053('0x17')](function(_0x44aacd){console['error'](_0x44aacd);});}_0x1a0b90();}},'charset':'utf8mb4','collate':_0xb053('0x18')});}; \ No newline at end of file +var _0x674d=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error'];(function(_0x4dbacd,_0x1c409f){var _0x107d1b=function(_0x2043bf){while(--_0x2043bf){_0x4dbacd['push'](_0x4dbacd['shift']());}};_0x107d1b(++_0x1c409f);}(_0x674d,0x1b1));var _0xd674=function(_0x4d1ce8,_0x1a778e){_0x4d1ce8=_0x4d1ce8-0x0;var _0x129384=_0x674d[_0x4d1ce8];return _0x129384;};'use strict';var _=require(_0xd674('0x0'));var util=require(_0xd674('0x1'));var logger=require(_0xd674('0x2'))(_0xd674('0x3'));var moment=require('moment');var BPromise=require(_0xd674('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(_0xd674('0x5'));module[_0xd674('0x6')]=function(_0x5165fd,_0x4b5d43){return _0x5165fd[_0xd674('0x7')]('FaxMessage',attributes,{'tableName':_0xd674('0x8'),'paranoid':![],'indexes':[{'name':_0xd674('0x9'),'fields':['body'],'type':_0xd674('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5dd34e,_0x319e01,_0x2041d9){var _0x543ee7=_0x5165fd['models'];var _0x44f316=_0x5dd34e[_0xd674('0xb')]({'plain':!![]});if(_0x44f316[_0xd674('0xc')]['toLowerCase']()==='in'||_0x44f316['direction'][_0xd674('0xd')]()===_0xd674('0xe')&&!_0x44f316['secret']&&!_['isNil'](_0x44f316['UserId'])){_0x543ee7[_0xd674('0xf')][_0xd674('0x10')]({'where':{'id':_0x44f316[_0xd674('0x11')]}})[_0xd674('0x12')](function(_0x4d5a00){if(_0x4d5a00){_0x4d5a00[_0xd674('0x13')]({'lastMsgAt':_0x44f316[_0xd674('0x14')],'lastMsgDirection':_0x44f316[_0xd674('0xc')]['toLowerCase']()});}})[_0xd674('0x15')](function(_0x484b0b){console[_0xd674('0x16')](_0x484b0b);});}_0x2041d9();}},'charset':'utf8mb4','collate':_0xd674('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f80d448..f5f927b 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 _0x4ea3=['message','result','catch','body','options','CreateFaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x29f476,_0x2db883){var _0x18ded1=function(_0x221cc6){while(--_0x221cc6){_0x29f476['push'](_0x29f476['shift']());}};_0x18ded1(++_0x2db883);}(_0x4ea3,0x70));var _0x34ea=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4ea3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});config[_0x34ea('0xa')]=_[_0x34ea('0xb')](config[_0x34ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x34ea('0xc'))(new Redis(config[_0x34ea('0xa')]));require(_0x34ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x301b98,_0xea1be2,_0x5126de){return new BPromise(function(_0x4a76b1,_0x5bd8b6){return client[_0x34ea('0xe')](_0x301b98,_0x5126de)[_0x34ea('0xf')](function(_0x58bb0d){logger[_0x34ea('0x10')](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));logger[_0x34ea('0x13')](_0x34ea('0x14'),_0xea1be2,_0x34ea('0x12'),JSON[_0x34ea('0x15')](_0x58bb0d));if(_0x58bb0d[_0x34ea('0x16')]){if(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x17')]===0x1f4){logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x5bd8b6(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x4a76b1(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}else{logger['info'](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));_0x4a76b1(_0x58bb0d[_0x34ea('0x19')]['message']);}})[_0x34ea('0x1a')](function(_0x1353de){logger[_0x34ea('0x16')](_0x34ea('0x11'),_0xea1be2,_0x1353de);_0x5bd8b6(_0x1353de);});});}exports['CreateFaxMessage']=function(_0x2eea57){var _0x35328c=this;return new Promise(function(_0x287aaa,_0x247ee7){return db['FaxMessage']['create'](_0x2eea57[_0x34ea('0x1b')],{'raw':_0x2eea57[_0x34ea('0x1c')]?_0x2eea57[_0x34ea('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2eafc6){logger[_0x34ea('0x10')](_0x34ea('0x1d'),_0x2eea57);logger[_0x34ea('0x13')](_0x34ea('0x1d'),_0x2eea57,JSON[_0x34ea('0x15')](_0x2eafc6));_0x287aaa(_0x2eafc6);})['catch'](function(_0xf24962){logger[_0x34ea('0x16')](_0x34ea('0x1d'),_0xf24962[_0x34ea('0x18')],_0x2eea57);_0x247ee7(_0x35328c['error'](0x1f4,_0xf24962['message']));});});};exports['UpdateFaxMessage']=function(_0x142709){var _0x187306=this;return new Promise(function(_0x37c214,_0x4204d7){return db['FaxMessage'][_0x34ea('0x1e')](_0x142709[_0x34ea('0x1b')],{'raw':_0x142709[_0x34ea('0x1c')]?_0x142709['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142709['options']?_0x142709['options'][_0x34ea('0x1f')]||null:null,'attributes':_0x142709[_0x34ea('0x1c')]?_0x142709[_0x34ea('0x1c')][_0x34ea('0x20')]||null:null,'limit':_0x142709['options']?_0x142709[_0x34ea('0x1c')]['limit']||null:null})[_0x34ea('0xf')](function(_0x4f2b77){logger[_0x34ea('0x10')](_0x34ea('0x21'),_0x142709);logger[_0x34ea('0x13')]('UpdateFaxMessage',_0x142709,JSON[_0x34ea('0x15')](_0x4f2b77));_0x37c214(_0x4f2b77);})[_0x34ea('0x1a')](function(_0x55c8ba){logger[_0x34ea('0x16')]('UpdateFaxMessage',_0x55c8ba[_0x34ea('0x18')],_0x142709);_0x4204d7(_0x187306[_0x34ea('0x16')](0x1f4,_0x55c8ba[_0x34ea('0x18')]));});});}; \ No newline at end of file +var _0xbd50=['request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','options','raw','then','UpdateFaxMessage','FaxMessage','update','body','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','./faxMessage.socket','register'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xbd50,0x196));var _0x0bd5=function(_0x1d0c7a,_0x39d7a8){_0x1d0c7a=_0x1d0c7a-0x0;var _0x3edec4=_0xbd50[_0x1d0c7a];return _0x3edec4;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});config[_0x0bd5('0xa')]=_[_0x0bd5('0xb')](config[_0x0bd5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd5('0xa')]));require(_0x0bd5('0xc'))[_0x0bd5('0xd')](socket);function respondWithRpcPromise(_0x5f5a0c,_0xa98f54,_0x2fa7d1){return new BPromise(function(_0x519bc6,_0x210f45){return client[_0x0bd5('0xe')](_0x5f5a0c,_0x2fa7d1)['then'](function(_0x1ce7dd){logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,'request\x20sent');logger[_0x0bd5('0x11')](_0x0bd5('0x12'),_0xa98f54,_0x0bd5('0x13'),JSON[_0x0bd5('0x14')](_0x1ce7dd));if(_0x1ce7dd[_0x0bd5('0x15')]){if(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x16')]===0x1f4){logger[_0x0bd5('0x15')]('FaxMessage,\x20%s,\x20%s',_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);return _0x210f45(_0x1ce7dd['error'][_0x0bd5('0x17')]);}logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')]['message']);return _0x519bc6(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);}else{logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,_0x0bd5('0x13'));_0x519bc6(_0x1ce7dd[_0x0bd5('0x18')][_0x0bd5('0x17')]);}})[_0x0bd5('0x19')](function(_0x29fa4c){logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x29fa4c);_0x210f45(_0x29fa4c);});});}exports[_0x0bd5('0x1a')]=function(_0x4008bd){var _0x2dc1e5=this;return new Promise(function(_0x527c37,_0x5ba943){return db['FaxMessage']['create'](_0x4008bd['body'],{'raw':_0x4008bd[_0x0bd5('0x1b')]?_0x4008bd[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![]})[_0x0bd5('0x1d')](function(_0x6ee1a8){logger['info'](_0x0bd5('0x1a'),_0x4008bd);logger[_0x0bd5('0x11')](_0x0bd5('0x1a'),_0x4008bd,JSON['stringify'](_0x6ee1a8));_0x527c37(_0x6ee1a8);})[_0x0bd5('0x19')](function(_0x4a8787){logger['error'](_0x0bd5('0x1a'),_0x4a8787[_0x0bd5('0x17')],_0x4008bd);_0x5ba943(_0x2dc1e5[_0x0bd5('0x15')](0x1f4,_0x4a8787['message']));});});};exports[_0x0bd5('0x1e')]=function(_0x5eab3e){var _0x456e87=this;return new Promise(function(_0x3ffb08,_0x18cec3){return db[_0x0bd5('0x1f')][_0x0bd5('0x20')](_0x5eab3e[_0x0bd5('0x21')],{'raw':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x22')]||null:null,'attributes':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['attributes']||null:null,'limit':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['limit']||null:null})[_0x0bd5('0x1d')](function(_0x8eccc9){logger['info'](_0x0bd5('0x1e'),_0x5eab3e);logger[_0x0bd5('0x11')](_0x0bd5('0x1e'),_0x5eab3e,JSON[_0x0bd5('0x14')](_0x8eccc9));_0x3ffb08(_0x8eccc9);})['catch'](function(_0x440e69){logger[_0x0bd5('0x15')](_0x0bd5('0x1e'),_0x440e69[_0x0bd5('0x17')],_0x5eab3e);_0x18cec3(_0x456e87[_0x0bd5('0x15')](0x1f4,_0x440e69[_0x0bd5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index aba51ae..d04da5b 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 _0x0ec2=['./faxMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x23d8e7,_0x498fec){var _0x212547=function(_0x5a3a6f){while(--_0x5a3a6f){_0x23d8e7['push'](_0x23d8e7['shift']());}};_0x212547(++_0x498fec);}(_0x0ec2,0x1c0));var _0x20ec=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x0ec2[_0xed5f9c];return _0x3a1c43;};'use strict';var FaxMessageEvents=require(_0x20ec('0x0'));var events=[_0x20ec('0x1'),_0x20ec('0x2'),_0x20ec('0x3')];function createListener(_0x48fee9,_0x3f00f4){return function(_0x100013){_0x3f00f4[_0x20ec('0x4')](_0x48fee9,_0x100013);};}function removeListener(_0x1cff5f,_0x83517c){return function(){FaxMessageEvents[_0x20ec('0x5')](_0x1cff5f,_0x83517c);};}exports[_0x20ec('0x6')]=function(_0x1926e8){for(var _0x22f432=0x0,_0x1dbac6=events[_0x20ec('0x7')];_0x22f432<_0x1dbac6;_0x22f432++){var _0x917cec=events[_0x22f432];var _0x317ad6=createListener('faxMessage:'+_0x917cec,_0x1926e8);FaxMessageEvents['on'](_0x917cec,_0x317ad6);}}; \ No newline at end of file +var _0x4146=['removeListener','length','faxMessage:','./faxMessage.events','update','emit'];(function(_0x243119,_0xfb6070){var _0x16749b=function(_0x376cea){while(--_0x376cea){_0x243119['push'](_0x243119['shift']());}};_0x16749b(++_0xfb6070);}(_0x4146,0x1e3));var _0x6414=function(_0x52efad,_0x567969){_0x52efad=_0x52efad-0x0;var _0x7681be=_0x4146[_0x52efad];return _0x7681be;};'use strict';var FaxMessageEvents=require(_0x6414('0x0'));var events=['save','remove',_0x6414('0x1')];function createListener(_0x4324c1,_0xa9e9b1){return function(_0xa4f0b4){_0xa9e9b1[_0x6414('0x2')](_0x4324c1,_0xa4f0b4);};}function removeListener(_0x581b35,_0x446d4c){return function(){FaxMessageEvents[_0x6414('0x3')](_0x581b35,_0x446d4c);};}exports['register']=function(_0x57805a){for(var _0x126fa6=0x0,_0x388899=events[_0x6414('0x4')];_0x126fa6<_0x388899;_0x126fa6++){var _0x4b1efe=events[_0x126fa6];var _0x931ca3=createListener(_0x6414('0x5')+_0x4b1efe,_0x57805a);FaxMessageEvents['on'](_0x4b1efe,_0x931ca3);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d939b78..b40cc4a 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0xbe05c8,_0x26be13){var _0xbd60ca=function(_0x202473){while(--_0x202473){_0xbe05c8['push'](_0xbe05c8['shift']());}};_0xbd60ca(++_0x26be13);}(_0xcea2,0x15a));var _0x2cea=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcea2[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file +var _0x878f=['update','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','/:id','/:id/download','isAuthenticated','post','fax','create','put'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0x878f,0x173));var _0xf878=function(_0x3fca2a,_0x1c4daa){_0x3fca2a=_0x3fca2a-0x0;var _0x45fe88=_0x878f[_0x3fca2a];return _0x45fe88;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['download']);router[_0xf878('0xf')]('/',auth[_0xf878('0xe')](),interaction['tracked'](_0xf878('0x10'),'faxmessage:create'),controller[_0xf878('0x11')]);router[_0xf878('0x12')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x13')]);router[_0xf878('0x12')](_0xf878('0x14'),auth['isAuthenticated'](),controller[_0xf878('0x15')]);router[_0xf878('0x12')](_0xf878('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xf878('0x17')](_0xf878('0xc'),auth[_0xf878('0xe')](),controller[_0xf878('0x18')]);module[_0xf878('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2c9d31b..0be5f96 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 _0xa280=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1b31c0,_0x1db673){var _0x576d21=function(_0x5c95cc){while(--_0x5c95cc){_0x1b31c0['push'](_0x1b31c0['shift']());}};_0x576d21(++_0x1db673);}(_0xa280,0xc4));var _0x0a28=function(_0x498577,_0x4b8af0){_0x498577=_0x498577-0x0;var _0x56f79a=_0xa280[_0x498577];return _0x56f79a;};'use strict';var Sequelize=require(_0x0a28('0x0'));module[_0x0a28('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0a28('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0a28('0x3')]},'timeout':{'type':Sequelize[_0x0a28('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0a28('0x5')](_0x0a28('0x6'),_0x0a28('0x7'),_0x0a28('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0a28('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc376=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5250e2,_0xc8ab54){var _0xcbde45=function(_0x326996){while(--_0x326996){_0x5250e2['push'](_0x5250e2['shift']());}};_0xcbde45(++_0xc8ab54);}(_0xc376,0x14b));var _0x6c37=function(_0x4a2183,_0x53e74d){_0x4a2183=_0x4a2183-0x0;var _0xc7c01d=_0xc376[_0x4a2183];return _0xc7c01d;};'use strict';var Sequelize=require('sequelize');module[_0x6c37('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c37('0x1')]},'timeout':{'type':Sequelize[_0x6c37('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6c37('0x3')](_0x6c37('0x4'),'beepall',_0x6c37('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index a05dd3c..9c3952f 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 _0x16c8=['order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','body','describe','getMembers','findOne','UserFaxQueue','User','findAndCountAll','UserId','faxPause','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','Team','online','interface','flatMap','Agents','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','TeamId','all','union','compact','value','ids','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x20e39c,_0x203d1){var _0x5f519c=function(_0x4756d6){while(--_0x4756d6){_0x20e39c['push'](_0x20e39c['shift']());}};_0x5f519c(++_0x203d1);}(_0x16c8,0x1eb));var _0x816c=function(_0x52af99,_0x1f3026){_0x52af99=_0x52af99-0x0;var _0x5d4689=_0x16c8[_0x52af99];return _0x5d4689;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x816c('0x0'));var zipdir=require(_0x816c('0x1'));var jsonpatch=require(_0x816c('0x2'));var rp=require(_0x816c('0x3'));var moment=require(_0x816c('0x4'));var BPromise=require(_0x816c('0x5'));var Mustache=require(_0x816c('0x6'));var util=require(_0x816c('0x7'));var path=require(_0x816c('0x8'));var sox=require(_0x816c('0x9'));var csv=require(_0x816c('0xa'));var ejs=require(_0x816c('0xb'));var fs=require('fs');var fs_extra=require(_0x816c('0xc'));var _=require('lodash');var squel=require(_0x816c('0xd'));var crypto=require(_0x816c('0xe'));var jsforce=require(_0x816c('0xf'));var deskjs=require(_0x816c('0x10'));var toCsv=require(_0x816c('0xa'));var querystring=require(_0x816c('0x11'));var Papa=require(_0x816c('0x12'));var Redis=require(_0x816c('0x13'));var authService=require(_0x816c('0x14'));var qs=require(_0x816c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x816c('0x16'));var logger=require(_0x816c('0x17'))(_0x816c('0x18'));var utils=require(_0x816c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x816c('0x1a'));var db=require(_0x816c('0x1b'))['db'];config[_0x816c('0x1c')]=_[_0x816c('0x1d')](config[_0x816c('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x816c('0x1c')]));require(_0x816c('0x1e'))['register'](socket);function respondWithStatusCode(_0x5e1897,_0x4f8d03){_0x4f8d03=_0x4f8d03||0xcc;return function(_0x1171bb){if(_0x1171bb){return _0x5e1897[_0x816c('0x1f')](_0x4f8d03);}return _0x5e1897[_0x816c('0x20')](_0x4f8d03)[_0x816c('0x21')]();};}function respondWithResult(_0x2fc40c,_0x12eebb){_0x12eebb=_0x12eebb||0xc8;return function(_0x555d9e){if(_0x555d9e){return _0x2fc40c['status'](_0x12eebb)[_0x816c('0x22')](_0x555d9e);}};}function respondWithFilteredResult(_0x2dfcbb,_0x1a6476){return function(_0x31fbf6){if(_0x31fbf6){var _0x5584ec=typeof _0x1a6476[_0x816c('0x23')]===_0x816c('0x24')&&typeof _0x1a6476[_0x816c('0x25')]===_0x816c('0x24');var _0x5b262e=_0x31fbf6[_0x816c('0x26')];var _0xf3fcdb=_0x5584ec?0x0:_0x1a6476[_0x816c('0x23')];var _0x580889=_0x5584ec?_0x31fbf6['count']:_0x1a6476[_0x816c('0x23')]+_0x1a6476['limit'];var _0x28047e;if(_0x580889>=_0x5b262e){_0x580889=_0x5b262e;_0x28047e=0xc8;}else{_0x28047e=0xce;}_0x2dfcbb['status'](_0x28047e);return _0x2dfcbb[_0x816c('0x27')](_0x816c('0x28'),_0xf3fcdb+'-'+_0x580889+'/'+_0x5b262e)[_0x816c('0x22')](_0x31fbf6);}return null;};}function patchUpdates(_0x2321fe){return function(_0x26893c){try{jsonpatch[_0x816c('0x29')](_0x26893c,_0x2321fe,!![]);}catch(_0x18a51e){return BPromise['reject'](_0x18a51e);}return _0x26893c[_0x816c('0x2a')]();};}function saveUpdates(_0x5d5d5d,_0x33f3d2){return function(_0x5d4414){if(_0x5d4414){return _0x5d4414['update'](_0x5d5d5d)[_0x816c('0x2b')](function(_0x46d4aa){return _0x46d4aa;});}return null;};}function removeEntity(_0x44ab15,_0x10320e){return function(_0x1e3866){if(_0x1e3866){return _0x1e3866[_0x816c('0x2c')]()['then'](function(){var _0x21031d=_0x1e3866[_0x816c('0x2d')]({'plain':!![]});var _0x5ab80d=_0x816c('0x2e');return db[_0x816c('0x2f')]['destroy']({'where':{'type':_0x5ab80d,'resourceId':_0x21031d['id']}})['then'](function(){return _0x1e3866;});})[_0x816c('0x2b')](function(){_0x44ab15[_0x816c('0x20')](0xcc)[_0x816c('0x21')]();});}};}function handleEntityNotFound(_0x5f45de,_0x2fbf13){return function(_0x3637cf){if(!_0x3637cf){_0x5f45de[_0x816c('0x1f')](0x194);}return _0x3637cf;};}function handleError(_0x27bdf5,_0x718c0c){_0x718c0c=_0x718c0c||0x1f4;return function(_0x2754f2){logger[_0x816c('0x30')](_0x2754f2[_0x816c('0x31')]);if(_0x2754f2[_0x816c('0x32')]){delete _0x2754f2[_0x816c('0x32')];}_0x27bdf5[_0x816c('0x20')](_0x718c0c)['send'](_0x2754f2);};}exports['index']=function(_0x32f396,_0x440408){var _0x3131f0={},_0x3f3332={},_0x316cdd={'count':0x0,'rows':[]};var _0x20b1dd=_[_0x816c('0x33')](db[_0x816c('0x34')][_0x816c('0x35')],function(_0x37de1c){return{'name':_0x37de1c[_0x816c('0x36')],'type':_0x37de1c[_0x816c('0x37')][_0x816c('0x38')]};});_0x3f3332[_0x816c('0x39')]=_[_0x816c('0x33')](_0x20b1dd,_0x816c('0x32'));_0x3f3332[_0x816c('0x3a')]=_['keys'](_0x32f396[_0x816c('0x3a')]);_0x3f3332[_0x816c('0x3b')]=_[_0x816c('0x3c')](_0x3f3332['model'],_0x3f3332[_0x816c('0x3a')]);_0x3131f0[_0x816c('0x3d')]=_['intersection'](_0x3f3332[_0x816c('0x39')],qs[_0x816c('0x3e')](_0x32f396[_0x816c('0x3a')][_0x816c('0x3e')]));_0x3131f0[_0x816c('0x3d')]=_0x3131f0['attributes'][_0x816c('0x3f')]?_0x3131f0[_0x816c('0x3d')]:_0x3f3332[_0x816c('0x39')];if(!_0x32f396[_0x816c('0x3a')][_0x816c('0x40')]('nolimit')){_0x3131f0['limit']=qs[_0x816c('0x25')](_0x32f396['query'][_0x816c('0x25')]);_0x3131f0['offset']=qs[_0x816c('0x23')](_0x32f396[_0x816c('0x3a')]['offset']);}_0x3131f0[_0x816c('0x41')]=qs[_0x816c('0x42')](_0x32f396['query'][_0x816c('0x42')]);_0x3131f0[_0x816c('0x43')]=qs[_0x816c('0x3b')](_[_0x816c('0x44')](_0x32f396[_0x816c('0x3a')],_0x3f3332[_0x816c('0x3b')]),_0x20b1dd);if(_0x32f396[_0x816c('0x3a')][_0x816c('0x45')]){_0x3131f0[_0x816c('0x43')]=_[_0x816c('0x46')](_0x3131f0[_0x816c('0x43')],{'$or':_['map'](_0x20b1dd,function(_0x4831ce){if(_0x4831ce[_0x816c('0x37')]!=='VIRTUAL'){var _0x289b5f={};_0x289b5f[_0x4831ce['name']]={'$like':'%'+_0x32f396[_0x816c('0x3a')][_0x816c('0x45')]+'%'};return _0x289b5f;}})});}_0x3131f0=_[_0x816c('0x46')]({},_0x3131f0,_0x32f396['options']);var _0x550882={'where':_0x3131f0['where']};return db['FaxQueue']['count'](_0x550882)[_0x816c('0x2b')](function(_0x589d82){_0x316cdd[_0x816c('0x26')]=_0x589d82;if(_0x32f396['query'][_0x816c('0x47')]){_0x3131f0[_0x816c('0x48')]=[{'all':!![]}];}return db[_0x816c('0x34')][_0x816c('0x49')](_0x3131f0);})[_0x816c('0x2b')](function(_0x42ee9d){_0x316cdd['rows']=_0x42ee9d;return _0x316cdd;})[_0x816c('0x2b')](respondWithFilteredResult(_0x440408,_0x3131f0))[_0x816c('0x4a')](handleError(_0x440408,null));};exports[_0x816c('0x4b')]=function(_0x288e82,_0x2bb375){var _0x372feb={'raw':!![],'where':{'id':_0x288e82[_0x816c('0x4c')]['id']}},_0x26723d={};_0x26723d[_0x816c('0x39')]=_[_0x816c('0x4d')](db[_0x816c('0x34')]['rawAttributes']);_0x26723d['query']=_['keys'](_0x288e82[_0x816c('0x3a')]);_0x26723d[_0x816c('0x3b')]=_[_0x816c('0x3c')](_0x26723d[_0x816c('0x39')],_0x26723d[_0x816c('0x3a')]);_0x372feb[_0x816c('0x3d')]=_[_0x816c('0x3c')](_0x26723d[_0x816c('0x39')],qs[_0x816c('0x3e')](_0x288e82['query'][_0x816c('0x3e')]));_0x372feb[_0x816c('0x3d')]=_0x372feb[_0x816c('0x3d')][_0x816c('0x3f')]?_0x372feb[_0x816c('0x3d')]:_0x26723d[_0x816c('0x39')];if(_0x288e82[_0x816c('0x3a')][_0x816c('0x47')]){_0x372feb[_0x816c('0x48')]=[{'all':!![]}];}_0x372feb=_['merge']({},_0x372feb,_0x288e82[_0x816c('0x4e')]);return db['FaxQueue'][_0x816c('0x4f')](_0x372feb)[_0x816c('0x2b')](handleEntityNotFound(_0x2bb375,null))[_0x816c('0x2b')](respondWithResult(_0x2bb375,null))[_0x816c('0x4a')](handleError(_0x2bb375,null));};exports['create']=function(_0x46ae91,_0x489e96){return db[_0x816c('0x34')][_0x816c('0x50')](_0x46ae91['body'],{})[_0x816c('0x2b')](function(_0x1be73f){var _0x40635d=_0x46ae91[_0x816c('0x51')][_0x816c('0x2d')]({'plain':!![]});if(!_0x40635d)throw new Error(_0x816c('0x52'));if(_0x40635d[_0x816c('0x53')]===_0x816c('0x51')){var _0x26218d=_0x1be73f[_0x816c('0x2d')]({'plain':!![]});var _0x203af9=_0x816c('0x2e');return db['UserProfileSection'][_0x816c('0x4f')]({'where':{'name':_0x203af9,'userProfileId':_0x40635d['userProfileId']},'raw':!![]})[_0x816c('0x2b')](function(_0x542184){if(_0x542184&&_0x542184[_0x816c('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x26218d[_0x816c('0x32')],'resourceId':_0x26218d['id'],'type':_0x542184[_0x816c('0x32')],'sectionId':_0x542184['id']},{})[_0x816c('0x2b')](function(){return _0x1be73f;});}else{return _0x1be73f;}})['catch'](function(_0x337512){logger[_0x816c('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x337512);throw _0x337512;});}return _0x1be73f;})['then'](respondWithResult(_0x489e96,0xc9))['catch'](handleError(_0x489e96,null));};exports[_0x816c('0x55')]=function(_0x1334e3,_0x2dcf5c){if(_0x1334e3[_0x816c('0x56')]['id']){delete _0x1334e3[_0x816c('0x56')]['id'];}return db[_0x816c('0x34')]['find']({'where':{'id':_0x1334e3[_0x816c('0x4c')]['id']}})[_0x816c('0x2b')](handleEntityNotFound(_0x2dcf5c,null))['then'](saveUpdates(_0x1334e3[_0x816c('0x56')],null))[_0x816c('0x2b')](respondWithResult(_0x2dcf5c,null))['catch'](handleError(_0x2dcf5c,null));};exports[_0x816c('0x2c')]=function(_0xde1fe8,_0x1b8a69){return db[_0x816c('0x34')][_0x816c('0x4f')]({'where':{'id':_0xde1fe8[_0x816c('0x4c')]['id']}})[_0x816c('0x2b')](handleEntityNotFound(_0x1b8a69,null))[_0x816c('0x2b')](removeEntity(_0x1b8a69,null))[_0x816c('0x4a')](handleError(_0x1b8a69,null));};exports['describe']=function(_0x150296,_0x4caa26){return db[_0x816c('0x34')][_0x816c('0x57')]()[_0x816c('0x2b')](respondWithResult(_0x4caa26,null))[_0x816c('0x4a')](handleError(_0x4caa26,null));};exports[_0x816c('0x58')]=function(_0x277db2,_0x5476bd,_0x358da2){var _0x14f874={'raw':!![],'where':{}},_0x2d473d={},_0x5f0bd5;return db[_0x816c('0x34')][_0x816c('0x59')]({'where':{'id':_0x277db2[_0x816c('0x4c')]['id']}})[_0x816c('0x2b')](handleEntityNotFound(_0x5476bd,null))[_0x816c('0x2b')](function(_0x4f0418){if(_0x4f0418){_0x5f0bd5=_0x4f0418[_0x816c('0x2d')]({'plain':!![]});_0x2d473d[_0x816c('0x39')]=_[_0x816c('0x4d')](db[_0x816c('0x5a')]['rawAttributes']);_0x2d473d['query']=_[_0x816c('0x4d')](_0x277db2[_0x816c('0x3a')]);_0x2d473d[_0x816c('0x3b')]=_[_0x816c('0x3c')](_0x2d473d[_0x816c('0x39')],_0x2d473d[_0x816c('0x3a')]);_0x14f874['attributes']=_['intersection'](_0x2d473d[_0x816c('0x39')],qs[_0x816c('0x3e')](_0x277db2[_0x816c('0x3a')]['fields']));_0x14f874[_0x816c('0x3d')]=_0x14f874['attributes']['length']?_0x14f874[_0x816c('0x3d')]:_0x2d473d[_0x816c('0x39')];if(!_0x277db2[_0x816c('0x3a')]['hasOwnProperty']('nolimit')){_0x14f874[_0x816c('0x25')]=qs[_0x816c('0x25')](_0x277db2['query'][_0x816c('0x25')]);_0x14f874[_0x816c('0x23')]=qs[_0x816c('0x23')](_0x277db2[_0x816c('0x3a')][_0x816c('0x23')]);}_0x14f874[_0x816c('0x41')]=qs[_0x816c('0x42')](_0x277db2[_0x816c('0x3a')][_0x816c('0x42')]);_0x14f874['where']=qs[_0x816c('0x3b')](_[_0x816c('0x44')](_0x277db2[_0x816c('0x3a')],_0x2d473d[_0x816c('0x3b')]));_0x14f874[_0x816c('0x43')]['FaxQueueId']=_0x4f0418['id'];if(_0x277db2['query'][_0x816c('0x45')]){_0x14f874[_0x816c('0x43')]=_['merge'](_0x14f874[_0x816c('0x43')],{'$or':_[_0x816c('0x33')](_0x14f874[_0x816c('0x3d')],function(_0x2e3955){var _0x22b437={};_0x22b437[_0x2e3955]={'$like':'%'+_0x277db2[_0x816c('0x3a')][_0x816c('0x45')]+'%'};return _0x22b437;})});}_0x14f874=_[_0x816c('0x46')]({},_0x14f874,_0x277db2[_0x816c('0x4e')]);return db[_0x816c('0x5a')][_0x816c('0x49')](_0x14f874);}})[_0x816c('0x2b')](function(_0x3c9721){if(_0x3c9721){return db[_0x816c('0x5b')][_0x816c('0x5c')]({'where':{'id':_[_0x816c('0x33')](_0x3c9721,_0x816c('0x5d')),'role':'agent'},'attributes':['id','name',_0x816c('0x5e'),'updatedAt',_0x816c('0x5f')]});}})['then'](function(_0x17c610){if(_0x17c610){return{'count':_0x17c610[_0x816c('0x26')],'rows':_[_0x816c('0x33')](_0x17c610[_0x816c('0x60')],function(_0x527bc0){return{'membername':_0x527bc0['name'],'UserId':_0x527bc0['id'],'queue_name':_0x5f0bd5[_0x816c('0x32')],'FaxQueueId':_0x5f0bd5['id'],'interface':util[_0x816c('0x61')](_0x816c('0x62'),_0x816c('0x63'),_0x527bc0[_0x816c('0x32')]),'penalty':0x0,'paused':_0x527bc0[_0x816c('0x5e')],'createdAt':_0x527bc0[_0x816c('0x5f')],'updatedAt':_0x527bc0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5476bd,_0x14f874))[_0x816c('0x4a')](handleError(_0x5476bd,null));};exports[_0x816c('0x64')]=function(_0x30f199,_0xa45174,_0x115e1d){var _0x2f8918={};var _0x32e582={};var _0x2089a4;var _0xfd3f6e;return db[_0x816c('0x34')][_0x816c('0x59')]({'where':{'id':_0x30f199[_0x816c('0x4c')]['id']}})[_0x816c('0x2b')](handleEntityNotFound(_0xa45174,null))[_0x816c('0x2b')](function(_0xa81871){if(_0xa81871){_0x2089a4=_0xa81871;_0x32e582[_0x816c('0x39')]=_[_0x816c('0x4d')](db['Team'][_0x816c('0x35')]);_0x32e582[_0x816c('0x3a')]=_[_0x816c('0x4d')](_0x30f199[_0x816c('0x3a')]);_0x32e582[_0x816c('0x3b')]=_['intersection'](_0x32e582[_0x816c('0x39')],_0x32e582[_0x816c('0x3a')]);_0x2f8918[_0x816c('0x3d')]=_[_0x816c('0x3c')](_0x32e582[_0x816c('0x39')],qs['fields'](_0x30f199[_0x816c('0x3a')][_0x816c('0x3e')]));_0x2f8918[_0x816c('0x3d')]=_0x2f8918[_0x816c('0x3d')]['length']?_0x2f8918[_0x816c('0x3d')]:_0x32e582[_0x816c('0x39')];_0x2f8918[_0x816c('0x41')]=qs[_0x816c('0x42')](_0x30f199[_0x816c('0x3a')]['sort']);_0x2f8918[_0x816c('0x43')]=qs[_0x816c('0x3b')](_[_0x816c('0x44')](_0x30f199['query'],_0x32e582[_0x816c('0x3b')]));if(_0x30f199['query']['filter']){_0x2f8918[_0x816c('0x43')]=_[_0x816c('0x46')](_0x2f8918[_0x816c('0x43')],{'$or':_[_0x816c('0x33')](_0x2f8918['attributes'],function(_0x5ebfff){var _0x2a42a9={};_0x2a42a9[_0x5ebfff]={'$like':'%'+_0x30f199[_0x816c('0x3a')][_0x816c('0x45')]+'%'};return _0x2a42a9;})});}_0x2f8918=_[_0x816c('0x46')]({},_0x2f8918,_0x30f199['options']);return _0x2089a4[_0x816c('0x64')](_0x2f8918);}})[_0x816c('0x2b')](function(_0x497ea6){if(_0x497ea6){_0xfd3f6e=_0x497ea6[_0x816c('0x3f')];if(!_0x30f199[_0x816c('0x3a')][_0x816c('0x40')]('nolimit')){_0x2f8918[_0x816c('0x25')]=qs['limit'](_0x30f199['query'][_0x816c('0x25')]);_0x2f8918['offset']=qs['offset'](_0x30f199[_0x816c('0x3a')][_0x816c('0x23')]);}return _0x2089a4[_0x816c('0x64')](_0x2f8918);}})[_0x816c('0x2b')](function(_0x2ff811){if(_0x2ff811){return _0x2ff811?{'count':_0xfd3f6e,'rows':_0x2ff811}:null;}})['then'](respondWithResult(_0xa45174,null))[_0x816c('0x4a')](handleError(_0xa45174,null));};exports[_0x816c('0x65')]=function(_0xaec460,_0x1c1eb8,_0x215432){var _0x357b9b=_0xaec460[_0x816c('0x56')]['ids'];return db[_0x816c('0x66')][_0x816c('0x49')]({'where':{'id':_0x357b9b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x816c('0x32'),_0x816c('0x67'),'voicePause',_0x816c('0x68')],'raw':!![]}]})[_0x816c('0x2b')](function(_0x2851c3){if(_0x2851c3){var _0x34d7cf=_[_0x816c('0x69')](_0x2851c3,function(_0xa82873){var _0x1dc923=_0xa82873['get']({'plain':!![]});return _0x1dc923[_0x816c('0x6a')];});return db[_0x816c('0x34')][_0x816c('0x4f')]({'where':{'id':_0xaec460['params']['id']}})[_0x816c('0x2b')](function(_0x3678b9){return db['sequelize'][_0x816c('0x6b')](function(_0x444cbb){return _0x3678b9[_0x816c('0x65')](_0x357b9b,{'transaction':_0x444cbb})[_0x816c('0x2b')](function(){return BPromise['each'](_0x34d7cf,function(_0x47bcee){return db[_0x816c('0x5a')][_0x816c('0x6c')]({'where':{'UserId':_0x47bcee['id'],'FaxQueueId':_0xaec460[_0x816c('0x4c')]['id']},'transaction':_0x444cbb});});})['then'](function(){_0x34d7cf[_0x816c('0x6d')](function(_0x410960){socket[_0x816c('0x6e')](_0x816c('0x6f'),{'UserId':_0x410960['id'],'FaxQueueId':_0x3678b9['id']});});});});});}})[_0x816c('0x2b')](respondWithStatusCode(_0x1c1eb8,null))[_0x816c('0x4a')](handleError(_0x1c1eb8,null));};exports[_0x816c('0x70')]=function(_0x75cd79,_0x3e414e,_0x2e5934){return db[_0x816c('0x66')]['findAll']({'where':{'id':_0x75cd79[_0x816c('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x816c('0x5b')],'as':_0x816c('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x816c('0x2b')](handleEntityNotFound(_0x3e414e,null))[_0x816c('0x2b')](function(_0x35acc1){var _0x5aa612=_[_0x816c('0x33')](_0x35acc1,'id');var _0x278260=[];var _0x3344e1=[];var _0x570fec=squel[_0x816c('0x71')]();_0x570fec['field'](_0x816c('0x72'))[_0x816c('0x73')](_0x816c('0x74'),'tq')['join'](_0x816c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x816c('0x76'),_0x75cd79[_0x816c('0x4c')]['id']);for(var _0x39bc4d=0x0;_0x39bc4d<_0x35acc1[_0x816c('0x3f')];_0x39bc4d+=0x1){let _0x3d75be=_0x35acc1[_0x39bc4d];for(var _0x2d917a=0x0;_0x2d917a<_0x3d75be['Agents']['length'];_0x2d917a+=0x1){let _0x111d15=_0x3d75be[_0x816c('0x6a')][_0x2d917a];var _0x381372=_0x570fec[_0x816c('0x77')]();_0x381372[_0x816c('0x43')](_0x816c('0x78'),_0x111d15['id']);_0x3344e1['push'](db[_0x816c('0x79')]['query'](_0x381372['toString'](),{'type':db['sequelize'][_0x816c('0x7a')][_0x816c('0x7b')]})['then'](function(_0x329dce){if(_0x329dce[_0x816c('0x3f')]===0x1){return _0x111d15['id'];}else{var _0x255024=_['every'](_[_0x816c('0x33')](_0x329dce,_0x816c('0x7c')),function(_0x52e3b5){return _['includes'](_0x5aa612,_0x52e3b5);});if(_0x255024){return _0x111d15['id'];}}}));}}return BPromise[_0x816c('0x7d')](_0x3344e1)[_0x816c('0x2b')](function(_0xfeacbf){_0x278260=_(_0x278260)[_0x816c('0x7e')](_0xfeacbf)[_0x816c('0x7f')]()[_0x816c('0x80')]();return db[_0x816c('0x34')][_0x816c('0x4f')]({'where':{'id':_0x75cd79[_0x816c('0x4c')]['id']}})[_0x816c('0x2b')](function(_0x1a7691){return db[_0x816c('0x79')][_0x816c('0x6b')](function(_0x1a22b3){return _0x1a7691[_0x816c('0x70')](_0x75cd79[_0x816c('0x3a')][_0x816c('0x81')],{'transaction':_0x1a22b3})['then'](function(){if(!_[_0x816c('0x82')](_0x278260)){return _0x1a7691['removeAgents'](_0x278260,{'transaction':_0x1a22b3});}})['then'](function(){_0x278260[_0x816c('0x6d')](function(_0x1fb2ff){socket['emit'](_0x816c('0x83'),{'UserId':_0x1fb2ff,'FaxQueueId':_0x1a7691['id']});});});});});});})[_0x816c('0x2b')](respondWithStatusCode(_0x3e414e,null))[_0x816c('0x4a')](handleError(_0x3e414e,null));};exports[_0x816c('0x84')]=function(_0x16b6b8,_0x5a1bf5,_0x1593e1){return db[_0x816c('0x34')]['find']({'where':{'id':_0x16b6b8['params']['id']}})[_0x816c('0x2b')](handleEntityNotFound(_0x5a1bf5,null))[_0x816c('0x2b')](function(_0x2524ca){if(_0x2524ca){return _0x2524ca[_0x816c('0x84')](_0x16b6b8[_0x816c('0x56')]['ids'],_[_0x816c('0x85')](_0x16b6b8[_0x816c('0x56')],[_0x816c('0x81'),'id'])||{})[_0x816c('0x86')](function(_0x54c48b){for(var _0x5f4a48=0x0;_0x5f4a48<_0x16b6b8[_0x816c('0x56')][_0x816c('0x81')][_0x816c('0x3f')];_0x5f4a48+=0x1){socket[_0x816c('0x6e')]('userFaxQueue:save',{'UserId':Number(_0x16b6b8[_0x816c('0x56')][_0x816c('0x81')][_0x5f4a48]),'FaxQueueId':Number(_0x16b6b8[_0x816c('0x4c')]['id'])});}return _0x54c48b;});}})[_0x816c('0x2b')](respondWithResult(_0x5a1bf5,null))[_0x816c('0x4a')](handleError(_0x5a1bf5,null));};exports[_0x816c('0x87')]=function(_0x14dd8a,_0x4fc8cf,_0x2c0224){return db['FaxQueue'][_0x816c('0x4f')]({'where':{'id':_0x14dd8a[_0x816c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4fc8cf,null))[_0x816c('0x2b')](function(_0x1cc5be){if(_0x1cc5be){return _0x1cc5be[_0x816c('0x87')](_0x14dd8a[_0x816c('0x3a')]['ids'])['then'](function(){if(_[_0x816c('0x88')](_0x14dd8a[_0x816c('0x3a')][_0x816c('0x81')])){for(var _0x36220d=0x0;_0x36220d<_0x14dd8a[_0x816c('0x3a')][_0x816c('0x81')][_0x816c('0x3f')];_0x36220d+=0x1){socket[_0x816c('0x6e')](_0x816c('0x83'),{'UserId':Number(_0x14dd8a[_0x816c('0x3a')][_0x816c('0x81')][_0x36220d]),'FaxQueueId':Number(_0x14dd8a[_0x816c('0x4c')]['id'])});}}else{socket[_0x816c('0x6e')](_0x816c('0x83'),{'UserId':Number(_0x14dd8a[_0x816c('0x3a')]['ids']),'FaxQueueId':Number(_0x14dd8a['params']['id'])});}});}})[_0x816c('0x2b')](respondWithStatusCode(_0x4fc8cf,null))['catch'](handleError(_0x4fc8cf,null));};exports['getAgents']=function(_0x11e97e,_0x20e13e,_0x6578af){var _0x4e9b37={};var _0x2908e1={};var _0x4de417;var _0x4b8083;return db[_0x816c('0x34')][_0x816c('0x59')]({'where':{'id':_0x11e97e['params']['id']}})[_0x816c('0x2b')](handleEntityNotFound(_0x20e13e,null))[_0x816c('0x2b')](function(_0x3ce989){if(_0x3ce989){_0x4de417=_0x3ce989;_0x2908e1[_0x816c('0x39')]=_[_0x816c('0x4d')](db[_0x816c('0x5b')][_0x816c('0x35')]);_0x2908e1['query']=_[_0x816c('0x4d')](_0x11e97e[_0x816c('0x3a')]);_0x2908e1['filters']=_[_0x816c('0x3c')](_0x2908e1[_0x816c('0x39')],_0x2908e1[_0x816c('0x3a')]);_0x4e9b37[_0x816c('0x3d')]=_['intersection'](_0x2908e1[_0x816c('0x39')],qs[_0x816c('0x3e')](_0x11e97e[_0x816c('0x3a')][_0x816c('0x3e')]));_0x4e9b37[_0x816c('0x3d')]=_0x4e9b37['attributes'][_0x816c('0x3f')]?_0x4e9b37[_0x816c('0x3d')]:_0x2908e1['model'];_0x4e9b37['order']=qs['sort'](_0x11e97e[_0x816c('0x3a')]['sort']);_0x4e9b37[_0x816c('0x43')]=qs[_0x816c('0x3b')](_['pick'](_0x11e97e[_0x816c('0x3a')],_0x2908e1[_0x816c('0x3b')]));if(_0x11e97e[_0x816c('0x3a')][_0x816c('0x45')]){_0x4e9b37[_0x816c('0x43')]=_[_0x816c('0x46')](_0x4e9b37[_0x816c('0x43')],{'$or':_[_0x816c('0x33')](_0x4e9b37[_0x816c('0x3d')],function(_0x27999c){var _0x217868={};_0x217868[_0x27999c]={'$like':'%'+_0x11e97e[_0x816c('0x3a')][_0x816c('0x45')]+'%'};return _0x217868;})});}_0x4e9b37=_[_0x816c('0x46')]({},_0x4e9b37,_0x11e97e[_0x816c('0x4e')]);return _0x4de417[_0x816c('0x89')](_0x4e9b37);}})[_0x816c('0x2b')](function(_0x275f61){if(_0x275f61){_0x4b8083=_0x275f61[_0x816c('0x3f')];if(!_0x11e97e[_0x816c('0x3a')][_0x816c('0x40')](_0x816c('0x8a'))){_0x4e9b37[_0x816c('0x25')]=qs[_0x816c('0x25')](_0x11e97e[_0x816c('0x3a')][_0x816c('0x25')]);_0x4e9b37['offset']=qs[_0x816c('0x23')](_0x11e97e[_0x816c('0x3a')]['offset']);}return _0x4de417[_0x816c('0x89')](_0x4e9b37);}})['then'](function(_0x48bb72){if(_0x48bb72){return _0x48bb72?{'count':_0x4b8083,'rows':_0x48bb72}:null;}})[_0x816c('0x2b')](respondWithResult(_0x20e13e,null))[_0x816c('0x4a')](handleError(_0x20e13e,null));}; \ No newline at end of file +var _0x0fab=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','options','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','addAgents','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','reject','save','update','then','FaxQueues','UserProfileResource','destroy','stack','name','send','index','map','FaxQueue','type','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0fab,0x1d0));var _0xb0fa=function(_0x589082,_0x422c84){_0x589082=_0x589082-0x0;var _0x3d4a59=_0x0fab[_0x589082];return _0x3d4a59;};'use strict';var emlformat=require(_0xb0fa('0x0'));var rimraf=require(_0xb0fa('0x1'));var zipdir=require(_0xb0fa('0x2'));var jsonpatch=require(_0xb0fa('0x3'));var rp=require(_0xb0fa('0x4'));var moment=require(_0xb0fa('0x5'));var BPromise=require(_0xb0fa('0x6'));var Mustache=require(_0xb0fa('0x7'));var util=require('util');var path=require(_0xb0fa('0x8'));var sox=require('sox');var csv=require(_0xb0fa('0x9'));var ejs=require(_0xb0fa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb0fa('0xb'));var jsforce=require(_0xb0fa('0xc'));var deskjs=require(_0xb0fa('0xd'));var toCsv=require(_0xb0fa('0x9'));var querystring=require(_0xb0fa('0xe'));var Papa=require(_0xb0fa('0xf'));var Redis=require(_0xb0fa('0x10'));var authService=require(_0xb0fa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb0fa('0x12'));var hardwareService=require(_0xb0fa('0x13'));var logger=require(_0xb0fa('0x14'))(_0xb0fa('0x15'));var utils=require(_0xb0fa('0x16'));var config=require(_0xb0fa('0x17'));var licenseUtil=require(_0xb0fa('0x18'));var db=require('../../mysqldb')['db'];config[_0xb0fa('0x19')]=_[_0xb0fa('0x1a')](config[_0xb0fa('0x19')],{'host':_0xb0fa('0x1b'),'port':0x18eb});var socket=require(_0xb0fa('0x1c'))(new Redis(config['redis']));require(_0xb0fa('0x1d'))[_0xb0fa('0x1e')](socket);function respondWithStatusCode(_0x219a1c,_0x4240e0){_0x4240e0=_0x4240e0||0xcc;return function(_0x3e2233){if(_0x3e2233){return _0x219a1c[_0xb0fa('0x1f')](_0x4240e0);}return _0x219a1c[_0xb0fa('0x20')](_0x4240e0)['end']();};}function respondWithResult(_0x438d3d,_0x15b9e5){_0x15b9e5=_0x15b9e5||0xc8;return function(_0x1bb36a){if(_0x1bb36a){return _0x438d3d[_0xb0fa('0x20')](_0x15b9e5)['json'](_0x1bb36a);}};}function respondWithFilteredResult(_0x3f8d08,_0x133791){return function(_0x4d2d8c){if(_0x4d2d8c){var _0x310ad0=typeof _0x133791[_0xb0fa('0x21')]===_0xb0fa('0x22')&&typeof _0x133791[_0xb0fa('0x23')]==='undefined';var _0x362cc1=_0x4d2d8c[_0xb0fa('0x24')];var _0x2ee6b3=_0x310ad0?0x0:_0x133791[_0xb0fa('0x21')];var _0x471c4a=_0x310ad0?_0x4d2d8c[_0xb0fa('0x24')]:_0x133791[_0xb0fa('0x21')]+_0x133791[_0xb0fa('0x23')];var _0x38ed49;if(_0x471c4a>=_0x362cc1){_0x471c4a=_0x362cc1;_0x38ed49=0xc8;}else{_0x38ed49=0xce;}_0x3f8d08[_0xb0fa('0x20')](_0x38ed49);return _0x3f8d08['set'](_0xb0fa('0x25'),_0x2ee6b3+'-'+_0x471c4a+'/'+_0x362cc1)['json'](_0x4d2d8c);}return null;};}function patchUpdates(_0x44f5e2){return function(_0x18fed3){try{jsonpatch['apply'](_0x18fed3,_0x44f5e2,!![]);}catch(_0x5e4933){return BPromise[_0xb0fa('0x26')](_0x5e4933);}return _0x18fed3[_0xb0fa('0x27')]();};}function saveUpdates(_0x19b7be,_0x3619f8){return function(_0x14b165){if(_0x14b165){return _0x14b165[_0xb0fa('0x28')](_0x19b7be)[_0xb0fa('0x29')](function(_0x479de1){return _0x479de1;});}return null;};}function removeEntity(_0x3a5764,_0x3205b6){return function(_0x55bee7){if(_0x55bee7){return _0x55bee7['destroy']()[_0xb0fa('0x29')](function(){var _0x285edd=_0x55bee7['get']({'plain':!![]});var _0x4eee2b=_0xb0fa('0x2a');return db[_0xb0fa('0x2b')][_0xb0fa('0x2c')]({'where':{'type':_0x4eee2b,'resourceId':_0x285edd['id']}})['then'](function(){return _0x55bee7;});})[_0xb0fa('0x29')](function(){_0x3a5764[_0xb0fa('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5321,_0x3033d3){return function(_0x3fc9c7){if(!_0x3fc9c7){_0x1a5321[_0xb0fa('0x1f')](0x194);}return _0x3fc9c7;};}function handleError(_0x26e2f0,_0x2012fc){_0x2012fc=_0x2012fc||0x1f4;return function(_0x4d001e){logger['error'](_0x4d001e[_0xb0fa('0x2d')]);if(_0x4d001e[_0xb0fa('0x2e')]){delete _0x4d001e[_0xb0fa('0x2e')];}_0x26e2f0[_0xb0fa('0x20')](_0x2012fc)[_0xb0fa('0x2f')](_0x4d001e);};}exports[_0xb0fa('0x30')]=function(_0x246059,_0x4c3f91){var _0x58ad70={},_0x3c4d55={},_0x5c4cd1={'count':0x0,'rows':[]};var _0x1be0a1=_[_0xb0fa('0x31')](db[_0xb0fa('0x32')]['rawAttributes'],function(_0xccaada){return{'name':_0xccaada['fieldName'],'type':_0xccaada[_0xb0fa('0x33')]['key']};});_0x3c4d55[_0xb0fa('0x34')]=_[_0xb0fa('0x31')](_0x1be0a1,_0xb0fa('0x2e'));_0x3c4d55[_0xb0fa('0x35')]=_[_0xb0fa('0x36')](_0x246059['query']);_0x3c4d55[_0xb0fa('0x37')]=_['intersection'](_0x3c4d55[_0xb0fa('0x34')],_0x3c4d55[_0xb0fa('0x35')]);_0x58ad70['attributes']=_[_0xb0fa('0x38')](_0x3c4d55['model'],qs[_0xb0fa('0x39')](_0x246059[_0xb0fa('0x35')][_0xb0fa('0x39')]));_0x58ad70['attributes']=_0x58ad70['attributes'][_0xb0fa('0x3a')]?_0x58ad70[_0xb0fa('0x3b')]:_0x3c4d55['model'];if(!_0x246059[_0xb0fa('0x35')]['hasOwnProperty'](_0xb0fa('0x3c'))){_0x58ad70[_0xb0fa('0x23')]=qs[_0xb0fa('0x23')](_0x246059[_0xb0fa('0x35')][_0xb0fa('0x23')]);_0x58ad70[_0xb0fa('0x21')]=qs[_0xb0fa('0x21')](_0x246059[_0xb0fa('0x35')][_0xb0fa('0x21')]);}_0x58ad70[_0xb0fa('0x3d')]=qs[_0xb0fa('0x3e')](_0x246059[_0xb0fa('0x35')][_0xb0fa('0x3e')]);_0x58ad70[_0xb0fa('0x3f')]=qs['filters'](_[_0xb0fa('0x40')](_0x246059[_0xb0fa('0x35')],_0x3c4d55['filters']),_0x1be0a1);if(_0x246059[_0xb0fa('0x35')][_0xb0fa('0x41')]){_0x58ad70[_0xb0fa('0x3f')]=_[_0xb0fa('0x42')](_0x58ad70['where'],{'$or':_['map'](_0x1be0a1,function(_0x5a359f){if(_0x5a359f[_0xb0fa('0x33')]!=='VIRTUAL'){var _0x35bad4={};_0x35bad4[_0x5a359f['name']]={'$like':'%'+_0x246059['query'][_0xb0fa('0x41')]+'%'};return _0x35bad4;}})});}_0x58ad70=_['merge']({},_0x58ad70,_0x246059['options']);var _0x4916f1={'where':_0x58ad70[_0xb0fa('0x3f')]};return db['FaxQueue'][_0xb0fa('0x24')](_0x4916f1)[_0xb0fa('0x29')](function(_0x237f88){_0x5c4cd1[_0xb0fa('0x24')]=_0x237f88;if(_0x246059[_0xb0fa('0x35')][_0xb0fa('0x43')]){_0x58ad70[_0xb0fa('0x44')]=[{'all':!![]}];}return db[_0xb0fa('0x32')][_0xb0fa('0x45')](_0x58ad70);})[_0xb0fa('0x29')](function(_0x11ed31){_0x5c4cd1['rows']=_0x11ed31;return _0x5c4cd1;})[_0xb0fa('0x29')](respondWithFilteredResult(_0x4c3f91,_0x58ad70))['catch'](handleError(_0x4c3f91,null));};exports['show']=function(_0x2dd0bb,_0x43d384){var _0x465435={'raw':!![],'where':{'id':_0x2dd0bb['params']['id']}},_0x402f5e={};_0x402f5e[_0xb0fa('0x34')]=_[_0xb0fa('0x36')](db[_0xb0fa('0x32')][_0xb0fa('0x46')]);_0x402f5e['query']=_[_0xb0fa('0x36')](_0x2dd0bb['query']);_0x402f5e[_0xb0fa('0x37')]=_['intersection'](_0x402f5e[_0xb0fa('0x34')],_0x402f5e[_0xb0fa('0x35')]);_0x465435['attributes']=_[_0xb0fa('0x38')](_0x402f5e[_0xb0fa('0x34')],qs[_0xb0fa('0x39')](_0x2dd0bb[_0xb0fa('0x35')][_0xb0fa('0x39')]));_0x465435[_0xb0fa('0x3b')]=_0x465435[_0xb0fa('0x3b')][_0xb0fa('0x3a')]?_0x465435[_0xb0fa('0x3b')]:_0x402f5e[_0xb0fa('0x34')];if(_0x2dd0bb[_0xb0fa('0x35')]['includeAll']){_0x465435['include']=[{'all':!![]}];}_0x465435=_['merge']({},_0x465435,_0x2dd0bb['options']);return db['FaxQueue'][_0xb0fa('0x47')](_0x465435)[_0xb0fa('0x29')](handleEntityNotFound(_0x43d384,null))[_0xb0fa('0x29')](respondWithResult(_0x43d384,null))[_0xb0fa('0x48')](handleError(_0x43d384,null));};exports[_0xb0fa('0x49')]=function(_0x1a4302,_0x42dcf2){return db[_0xb0fa('0x32')][_0xb0fa('0x49')](_0x1a4302[_0xb0fa('0x4a')],{})['then'](function(_0xaf68cf){var _0x2ecd12=_0x1a4302[_0xb0fa('0x4b')][_0xb0fa('0x4c')]({'plain':!![]});if(!_0x2ecd12)throw new Error(_0xb0fa('0x4d'));if(_0x2ecd12[_0xb0fa('0x4e')]==='user'){var _0xf8f6d0=_0xaf68cf[_0xb0fa('0x4c')]({'plain':!![]});var _0xe53254=_0xb0fa('0x2a');return db[_0xb0fa('0x4f')][_0xb0fa('0x47')]({'where':{'name':_0xe53254,'userProfileId':_0x2ecd12['userProfileId']},'raw':!![]})[_0xb0fa('0x29')](function(_0x50bec5){if(_0x50bec5&&_0x50bec5['autoAssociation']===0x0){return db[_0xb0fa('0x2b')][_0xb0fa('0x49')]({'name':_0xf8f6d0[_0xb0fa('0x2e')],'resourceId':_0xf8f6d0['id'],'type':_0x50bec5[_0xb0fa('0x2e')],'sectionId':_0x50bec5['id']},{})[_0xb0fa('0x29')](function(){return _0xaf68cf;});}else{return _0xaf68cf;}})[_0xb0fa('0x48')](function(_0x2bb695){logger['error'](_0xb0fa('0x50'),_0x2bb695);throw _0x2bb695;});}return _0xaf68cf;})[_0xb0fa('0x29')](respondWithResult(_0x42dcf2,0xc9))['catch'](handleError(_0x42dcf2,null));};exports[_0xb0fa('0x28')]=function(_0x3999a6,_0x29fd0f){if(_0x3999a6[_0xb0fa('0x4a')]['id']){delete _0x3999a6[_0xb0fa('0x4a')]['id'];}return db[_0xb0fa('0x32')]['find']({'where':{'id':_0x3999a6[_0xb0fa('0x51')]['id']}})['then'](handleEntityNotFound(_0x29fd0f,null))[_0xb0fa('0x29')](saveUpdates(_0x3999a6[_0xb0fa('0x4a')],null))[_0xb0fa('0x29')](respondWithResult(_0x29fd0f,null))[_0xb0fa('0x48')](handleError(_0x29fd0f,null));};exports['destroy']=function(_0x423518,_0xff5f8a){return db['FaxQueue'][_0xb0fa('0x47')]({'where':{'id':_0x423518['params']['id']}})[_0xb0fa('0x29')](handleEntityNotFound(_0xff5f8a,null))['then'](removeEntity(_0xff5f8a,null))['catch'](handleError(_0xff5f8a,null));};exports[_0xb0fa('0x52')]=function(_0x531ea2,_0x4d9120){return db[_0xb0fa('0x32')][_0xb0fa('0x52')]()['then'](respondWithResult(_0x4d9120,null))[_0xb0fa('0x48')](handleError(_0x4d9120,null));};exports['getMembers']=function(_0xb02cee,_0x3b905d,_0x1fec6a){var _0x3932b6={'raw':!![],'where':{}},_0x1c9355={},_0x31e62d;return db[_0xb0fa('0x32')][_0xb0fa('0x53')]({'where':{'id':_0xb02cee[_0xb0fa('0x51')]['id']}})[_0xb0fa('0x29')](handleEntityNotFound(_0x3b905d,null))[_0xb0fa('0x29')](function(_0x3ddbc7){if(_0x3ddbc7){_0x31e62d=_0x3ddbc7[_0xb0fa('0x4c')]({'plain':!![]});_0x1c9355['model']=_[_0xb0fa('0x36')](db[_0xb0fa('0x54')][_0xb0fa('0x46')]);_0x1c9355['query']=_[_0xb0fa('0x36')](_0xb02cee[_0xb0fa('0x35')]);_0x1c9355[_0xb0fa('0x37')]=_[_0xb0fa('0x38')](_0x1c9355[_0xb0fa('0x34')],_0x1c9355[_0xb0fa('0x35')]);_0x3932b6[_0xb0fa('0x3b')]=_['intersection'](_0x1c9355[_0xb0fa('0x34')],qs[_0xb0fa('0x39')](_0xb02cee[_0xb0fa('0x35')][_0xb0fa('0x39')]));_0x3932b6[_0xb0fa('0x3b')]=_0x3932b6[_0xb0fa('0x3b')]['length']?_0x3932b6[_0xb0fa('0x3b')]:_0x1c9355[_0xb0fa('0x34')];if(!_0xb02cee[_0xb0fa('0x35')][_0xb0fa('0x55')](_0xb0fa('0x3c'))){_0x3932b6['limit']=qs[_0xb0fa('0x23')](_0xb02cee[_0xb0fa('0x35')][_0xb0fa('0x23')]);_0x3932b6['offset']=qs[_0xb0fa('0x21')](_0xb02cee[_0xb0fa('0x35')][_0xb0fa('0x21')]);}_0x3932b6[_0xb0fa('0x3d')]=qs[_0xb0fa('0x3e')](_0xb02cee[_0xb0fa('0x35')]['sort']);_0x3932b6['where']=qs[_0xb0fa('0x37')](_['pick'](_0xb02cee[_0xb0fa('0x35')],_0x1c9355[_0xb0fa('0x37')]));_0x3932b6[_0xb0fa('0x3f')][_0xb0fa('0x56')]=_0x3ddbc7['id'];if(_0xb02cee['query'][_0xb0fa('0x41')]){_0x3932b6[_0xb0fa('0x3f')]=_[_0xb0fa('0x42')](_0x3932b6[_0xb0fa('0x3f')],{'$or':_[_0xb0fa('0x31')](_0x3932b6['attributes'],function(_0x29969d){var _0x100153={};_0x100153[_0x29969d]={'$like':'%'+_0xb02cee['query'][_0xb0fa('0x41')]+'%'};return _0x100153;})});}_0x3932b6=_[_0xb0fa('0x42')]({},_0x3932b6,_0xb02cee[_0xb0fa('0x57')]);return db[_0xb0fa('0x54')][_0xb0fa('0x45')](_0x3932b6);}})[_0xb0fa('0x29')](function(_0x530c9e){if(_0x530c9e){return db[_0xb0fa('0x58')][_0xb0fa('0x59')]({'where':{'id':_[_0xb0fa('0x31')](_0x530c9e,_0xb0fa('0x5a')),'role':_0xb0fa('0x5b')},'attributes':['id',_0xb0fa('0x2e'),_0xb0fa('0x5c'),_0xb0fa('0x5d'),_0xb0fa('0x5e')]});}})[_0xb0fa('0x29')](function(_0x5c63fe){if(_0x5c63fe){return{'count':_0x5c63fe[_0xb0fa('0x24')],'rows':_[_0xb0fa('0x31')](_0x5c63fe[_0xb0fa('0x5f')],function(_0x3e7234){return{'membername':_0x3e7234[_0xb0fa('0x2e')],'UserId':_0x3e7234['id'],'queue_name':_0x31e62d[_0xb0fa('0x2e')],'FaxQueueId':_0x31e62d['id'],'interface':util[_0xb0fa('0x60')](_0xb0fa('0x61'),_0xb0fa('0x62'),_0x3e7234[_0xb0fa('0x2e')]),'penalty':0x0,'paused':_0x3e7234['faxPause'],'createdAt':_0x3e7234[_0xb0fa('0x5e')],'updatedAt':_0x3e7234[_0xb0fa('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb0fa('0x29')](respondWithFilteredResult(_0x3b905d,_0x3932b6))[_0xb0fa('0x48')](handleError(_0x3b905d,null));};exports[_0xb0fa('0x63')]=function(_0x34838f,_0x3cc28e,_0x2d6569){var _0x2f6cc7={};var _0xd44c39={};var _0x13e0f3;var _0x2c25e8;return db[_0xb0fa('0x32')][_0xb0fa('0x53')]({'where':{'id':_0x34838f['params']['id']}})['then'](handleEntityNotFound(_0x3cc28e,null))['then'](function(_0x1a857b){if(_0x1a857b){_0x13e0f3=_0x1a857b;_0xd44c39[_0xb0fa('0x34')]=_[_0xb0fa('0x36')](db[_0xb0fa('0x64')]['rawAttributes']);_0xd44c39[_0xb0fa('0x35')]=_[_0xb0fa('0x36')](_0x34838f[_0xb0fa('0x35')]);_0xd44c39[_0xb0fa('0x37')]=_[_0xb0fa('0x38')](_0xd44c39[_0xb0fa('0x34')],_0xd44c39['query']);_0x2f6cc7[_0xb0fa('0x3b')]=_['intersection'](_0xd44c39[_0xb0fa('0x34')],qs[_0xb0fa('0x39')](_0x34838f[_0xb0fa('0x35')][_0xb0fa('0x39')]));_0x2f6cc7[_0xb0fa('0x3b')]=_0x2f6cc7[_0xb0fa('0x3b')][_0xb0fa('0x3a')]?_0x2f6cc7[_0xb0fa('0x3b')]:_0xd44c39['model'];_0x2f6cc7['order']=qs[_0xb0fa('0x3e')](_0x34838f[_0xb0fa('0x35')][_0xb0fa('0x3e')]);_0x2f6cc7['where']=qs[_0xb0fa('0x37')](_['pick'](_0x34838f[_0xb0fa('0x35')],_0xd44c39[_0xb0fa('0x37')]));if(_0x34838f[_0xb0fa('0x35')][_0xb0fa('0x41')]){_0x2f6cc7['where']=_['merge'](_0x2f6cc7['where'],{'$or':_['map'](_0x2f6cc7[_0xb0fa('0x3b')],function(_0x31a043){var _0x28a8bc={};_0x28a8bc[_0x31a043]={'$like':'%'+_0x34838f[_0xb0fa('0x35')][_0xb0fa('0x41')]+'%'};return _0x28a8bc;})});}_0x2f6cc7=_['merge']({},_0x2f6cc7,_0x34838f[_0xb0fa('0x57')]);return _0x13e0f3['getTeams'](_0x2f6cc7);}})['then'](function(_0x3fbec3){if(_0x3fbec3){_0x2c25e8=_0x3fbec3['length'];if(!_0x34838f[_0xb0fa('0x35')][_0xb0fa('0x55')](_0xb0fa('0x3c'))){_0x2f6cc7[_0xb0fa('0x23')]=qs[_0xb0fa('0x23')](_0x34838f['query'][_0xb0fa('0x23')]);_0x2f6cc7[_0xb0fa('0x21')]=qs[_0xb0fa('0x21')](_0x34838f[_0xb0fa('0x35')][_0xb0fa('0x21')]);}return _0x13e0f3[_0xb0fa('0x63')](_0x2f6cc7);}})[_0xb0fa('0x29')](function(_0x2dec31){if(_0x2dec31){return _0x2dec31?{'count':_0x2c25e8,'rows':_0x2dec31}:null;}})[_0xb0fa('0x29')](respondWithResult(_0x3cc28e,null))[_0xb0fa('0x48')](handleError(_0x3cc28e,null));};exports[_0xb0fa('0x65')]=function(_0x2147c8,_0xb6ee68,_0x40bd61){var _0x276303=_0x2147c8['body'][_0xb0fa('0x66')];return db[_0xb0fa('0x64')]['findAll']({'where':{'id':_0x276303},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb0fa('0x2e'),_0xb0fa('0x67'),_0xb0fa('0x68'),'interface'],'raw':!![]}]})[_0xb0fa('0x29')](function(_0x5dcad6){if(_0x5dcad6){var _0x4b1ff0=_[_0xb0fa('0x69')](_0x5dcad6,function(_0xa64cc){var _0x5a4b85=_0xa64cc[_0xb0fa('0x4c')]({'plain':!![]});return _0x5a4b85[_0xb0fa('0x6a')];});return db[_0xb0fa('0x32')]['find']({'where':{'id':_0x2147c8[_0xb0fa('0x51')]['id']}})['then'](function(_0x225a8a){return db[_0xb0fa('0x6b')][_0xb0fa('0x6c')](function(_0x40cc80){return _0x225a8a['addTeams'](_0x276303,{'transaction':_0x40cc80})['then'](function(){return BPromise['each'](_0x4b1ff0,function(_0x44fd65){return db[_0xb0fa('0x54')][_0xb0fa('0x6d')]({'where':{'UserId':_0x44fd65['id'],'FaxQueueId':_0x2147c8[_0xb0fa('0x51')]['id']},'transaction':_0x40cc80});});})['then'](function(){_0x4b1ff0[_0xb0fa('0x6e')](function(_0x6bc765){socket[_0xb0fa('0x6f')]('userFaxQueue:save',{'UserId':_0x6bc765['id'],'FaxQueueId':_0x225a8a['id']});});});});});}})[_0xb0fa('0x29')](respondWithStatusCode(_0xb6ee68,null))[_0xb0fa('0x48')](handleError(_0xb6ee68,null));};exports[_0xb0fa('0x70')]=function(_0x55c8b8,_0x58497d,_0x3e42d4){return db[_0xb0fa('0x64')][_0xb0fa('0x45')]({'where':{'id':_0x55c8b8['query'][_0xb0fa('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb0fa('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58497d,null))[_0xb0fa('0x29')](function(_0x284bbb){var _0x59b7aa=_[_0xb0fa('0x31')](_0x284bbb,'id');var _0x469596=[];var _0x31d926=[];var _0xc91e07=squel[_0xb0fa('0x71')]();_0xc91e07[_0xb0fa('0x72')]('tq.TeamId')[_0xb0fa('0x73')]('team_has_fax_queues','tq')['join'](_0xb0fa('0x74'),'ut',_0xb0fa('0x75'))['where']('FaxQueueId\x20=\x20?',_0x55c8b8[_0xb0fa('0x51')]['id']);for(var _0x3a2a9d=0x0;_0x3a2a9d<_0x284bbb['length'];_0x3a2a9d+=0x1){let _0x2972d0=_0x284bbb[_0x3a2a9d];for(var _0x4fdafe=0x0;_0x4fdafe<_0x2972d0[_0xb0fa('0x6a')][_0xb0fa('0x3a')];_0x4fdafe+=0x1){let _0x458996=_0x2972d0[_0xb0fa('0x6a')][_0x4fdafe];var _0x17e47e=_0xc91e07[_0xb0fa('0x76')]();_0x17e47e[_0xb0fa('0x3f')](_0xb0fa('0x77'),_0x458996['id']);_0x31d926['push'](db['sequelize'][_0xb0fa('0x35')](_0x17e47e['toString'](),{'type':db['sequelize'][_0xb0fa('0x78')][_0xb0fa('0x79')]})[_0xb0fa('0x29')](function(_0x4708b0){if(_0x4708b0[_0xb0fa('0x3a')]===0x1){return _0x458996['id'];}else{var _0xed7b25=_[_0xb0fa('0x7a')](_[_0xb0fa('0x31')](_0x4708b0,_0xb0fa('0x7b')),function(_0x144860){return _[_0xb0fa('0x7c')](_0x59b7aa,_0x144860);});if(_0xed7b25){return _0x458996['id'];}}}));}}return BPromise[_0xb0fa('0x7d')](_0x31d926)[_0xb0fa('0x29')](function(_0x5b37c0){_0x469596=_(_0x469596)['union'](_0x5b37c0)[_0xb0fa('0x7e')]()[_0xb0fa('0x7f')]();return db['FaxQueue']['find']({'where':{'id':_0x55c8b8['params']['id']}})[_0xb0fa('0x29')](function(_0x3d56f6){return db['sequelize'][_0xb0fa('0x6c')](function(_0x1b899d){return _0x3d56f6[_0xb0fa('0x70')](_0x55c8b8[_0xb0fa('0x35')][_0xb0fa('0x66')],{'transaction':_0x1b899d})[_0xb0fa('0x29')](function(){if(!_[_0xb0fa('0x80')](_0x469596)){return _0x3d56f6[_0xb0fa('0x81')](_0x469596,{'transaction':_0x1b899d});}})[_0xb0fa('0x29')](function(){_0x469596[_0xb0fa('0x6e')](function(_0x52a5b3){socket[_0xb0fa('0x6f')]('userFaxQueue:remove',{'UserId':_0x52a5b3,'FaxQueueId':_0x3d56f6['id']});});});});});});})[_0xb0fa('0x29')](respondWithStatusCode(_0x58497d,null))[_0xb0fa('0x48')](handleError(_0x58497d,null));};exports[_0xb0fa('0x82')]=function(_0x3a8cf6,_0x18627c,_0x4ce28a){return db[_0xb0fa('0x32')][_0xb0fa('0x47')]({'where':{'id':_0x3a8cf6['params']['id']}})[_0xb0fa('0x29')](handleEntityNotFound(_0x18627c,null))['then'](function(_0x2c72f2){if(_0x2c72f2){return _0x2c72f2[_0xb0fa('0x82')](_0x3a8cf6[_0xb0fa('0x4a')][_0xb0fa('0x66')],_['omit'](_0x3a8cf6['body'],[_0xb0fa('0x66'),'id'])||{})[_0xb0fa('0x83')](function(_0xe966cd){for(var _0x370c34=0x0;_0x370c34<_0x3a8cf6[_0xb0fa('0x4a')][_0xb0fa('0x66')][_0xb0fa('0x3a')];_0x370c34+=0x1){socket[_0xb0fa('0x6f')](_0xb0fa('0x84'),{'UserId':Number(_0x3a8cf6[_0xb0fa('0x4a')]['ids'][_0x370c34]),'FaxQueueId':Number(_0x3a8cf6[_0xb0fa('0x51')]['id'])});}return _0xe966cd;});}})['then'](respondWithResult(_0x18627c,null))[_0xb0fa('0x48')](handleError(_0x18627c,null));};exports[_0xb0fa('0x81')]=function(_0x1452ca,_0x16935c,_0x353c69){return db[_0xb0fa('0x32')][_0xb0fa('0x47')]({'where':{'id':_0x1452ca[_0xb0fa('0x51')]['id']}})[_0xb0fa('0x29')](handleEntityNotFound(_0x16935c,null))[_0xb0fa('0x29')](function(_0x2db365){if(_0x2db365){return _0x2db365[_0xb0fa('0x81')](_0x1452ca[_0xb0fa('0x35')][_0xb0fa('0x66')])[_0xb0fa('0x29')](function(){if(_[_0xb0fa('0x85')](_0x1452ca[_0xb0fa('0x35')][_0xb0fa('0x66')])){for(var _0x181d81=0x0;_0x181d81<_0x1452ca[_0xb0fa('0x35')][_0xb0fa('0x66')][_0xb0fa('0x3a')];_0x181d81+=0x1){socket[_0xb0fa('0x6f')](_0xb0fa('0x86'),{'UserId':Number(_0x1452ca[_0xb0fa('0x35')][_0xb0fa('0x66')][_0x181d81]),'FaxQueueId':Number(_0x1452ca[_0xb0fa('0x51')]['id'])});}}else{socket[_0xb0fa('0x6f')](_0xb0fa('0x86'),{'UserId':Number(_0x1452ca[_0xb0fa('0x35')][_0xb0fa('0x66')]),'FaxQueueId':Number(_0x1452ca[_0xb0fa('0x51')]['id'])});}});}})[_0xb0fa('0x29')](respondWithStatusCode(_0x16935c,null))['catch'](handleError(_0x16935c,null));};exports[_0xb0fa('0x87')]=function(_0x5b07c5,_0x537ea3,_0x266e79){var _0x50227d={};var _0x1386b0={};var _0x2fe54d;var _0x459fe2;return db[_0xb0fa('0x32')][_0xb0fa('0x53')]({'where':{'id':_0x5b07c5['params']['id']}})[_0xb0fa('0x29')](handleEntityNotFound(_0x537ea3,null))['then'](function(_0x4dbcce){if(_0x4dbcce){_0x2fe54d=_0x4dbcce;_0x1386b0[_0xb0fa('0x34')]=_[_0xb0fa('0x36')](db['User'][_0xb0fa('0x46')]);_0x1386b0[_0xb0fa('0x35')]=_[_0xb0fa('0x36')](_0x5b07c5['query']);_0x1386b0[_0xb0fa('0x37')]=_['intersection'](_0x1386b0[_0xb0fa('0x34')],_0x1386b0[_0xb0fa('0x35')]);_0x50227d[_0xb0fa('0x3b')]=_[_0xb0fa('0x38')](_0x1386b0[_0xb0fa('0x34')],qs['fields'](_0x5b07c5[_0xb0fa('0x35')][_0xb0fa('0x39')]));_0x50227d['attributes']=_0x50227d[_0xb0fa('0x3b')][_0xb0fa('0x3a')]?_0x50227d['attributes']:_0x1386b0[_0xb0fa('0x34')];_0x50227d['order']=qs[_0xb0fa('0x3e')](_0x5b07c5[_0xb0fa('0x35')]['sort']);_0x50227d[_0xb0fa('0x3f')]=qs[_0xb0fa('0x37')](_[_0xb0fa('0x40')](_0x5b07c5[_0xb0fa('0x35')],_0x1386b0['filters']));if(_0x5b07c5[_0xb0fa('0x35')][_0xb0fa('0x41')]){_0x50227d[_0xb0fa('0x3f')]=_[_0xb0fa('0x42')](_0x50227d[_0xb0fa('0x3f')],{'$or':_['map'](_0x50227d['attributes'],function(_0x20d3d7){var _0x1287ae={};_0x1287ae[_0x20d3d7]={'$like':'%'+_0x5b07c5[_0xb0fa('0x35')][_0xb0fa('0x41')]+'%'};return _0x1287ae;})});}_0x50227d=_[_0xb0fa('0x42')]({},_0x50227d,_0x5b07c5[_0xb0fa('0x57')]);return _0x2fe54d[_0xb0fa('0x87')](_0x50227d);}})['then'](function(_0x14f1dd){if(_0x14f1dd){_0x459fe2=_0x14f1dd[_0xb0fa('0x3a')];if(!_0x5b07c5[_0xb0fa('0x35')]['hasOwnProperty'](_0xb0fa('0x3c'))){_0x50227d[_0xb0fa('0x23')]=qs[_0xb0fa('0x23')](_0x5b07c5[_0xb0fa('0x35')][_0xb0fa('0x23')]);_0x50227d['offset']=qs['offset'](_0x5b07c5['query'][_0xb0fa('0x21')]);}return _0x2fe54d['getAgents'](_0x50227d);}})[_0xb0fa('0x29')](function(_0x1c5556){if(_0x1c5556){return _0x1c5556?{'count':_0x459fe2,'rows':_0x1c5556}:null;}})['then'](respondWithResult(_0x537ea3,null))[_0xb0fa('0x48')](handleError(_0x537ea3,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ebfdeb7..3d3a0c2 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 _0x671b=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x671b,0xda));var _0xb671=function(_0x2216fe,_0x53a04e){_0x2216fe=_0x2216fe-0x0;var _0x35510b=_0x671b[_0x2216fe];return _0x35510b;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xb671('0x0'))['db'][_0xb671('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb671('0x2')](0x0);var events={'afterCreate':_0xb671('0x3'),'afterUpdate':'update','afterDestroy':_0xb671('0x4')};function emitEvent(_0x177208){return function(_0x1aae43,_0x4563ed,_0x35d8f0){FaxQueueEvents[_0xb671('0x5')](_0x177208+':'+_0x1aae43['id'],_0x1aae43);FaxQueueEvents[_0xb671('0x5')](_0x177208,_0x1aae43);_0x35d8f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xb671('0x6')](e,emitEvent(event));}}module[_0xb671('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xc5d9=['events','../../mysqldb','save','update','remove','emit','hook'];(function(_0x52417a,_0x536ff6){var _0x48bbcc=function(_0x19930e){while(--_0x19930e){_0x52417a['push'](_0x52417a['shift']());}};_0x48bbcc(++_0x536ff6);}(_0xc5d9,0x118));var _0x9c5d=function(_0x5ea41f,_0x19a5c3){_0x5ea41f=_0x5ea41f-0x0;var _0x41162b=_0xc5d9[_0x5ea41f];return _0x41162b;};'use strict';var EventEmitter=require(_0x9c5d('0x0'));var FaxQueue=require(_0x9c5d('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c5d('0x2'),'afterUpdate':_0x9c5d('0x3'),'afterDestroy':_0x9c5d('0x4')};function emitEvent(_0x2a8347){return function(_0xaa4361,_0x45d7e8,_0x106b26){FaxQueueEvents[_0x9c5d('0x5')](_0x2a8347+':'+_0xaa4361['id'],_0xaa4361);FaxQueueEvents['emit'](_0x2a8347,_0xaa4361);_0x106b26(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x9c5d('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c7afb13..551fb17 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 _0xc952=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueue'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0xc952,0x134));var _0x2c95=function(_0x4a31e2,_0x2ae36c){_0x4a31e2=_0x4a31e2-0x0;var _0x41070d=_0xc952[_0x4a31e2];return _0x41070d;};'use strict';var _=require('lodash');var util=require(_0x2c95('0x0'));var logger=require('../../config/logger')(_0x2c95('0x1'));var moment=require(_0x2c95('0x2'));var BPromise=require(_0x2c95('0x3'));var rp=require(_0x2c95('0x4'));var fs=require('fs');var path=require(_0x2c95('0x5'));var rimraf=require(_0x2c95('0x6'));var config=require(_0x2c95('0x7'));var attributes=require('./faxQueue.attributes');module[_0x2c95('0x8')]=function(_0x582d0f,_0x223a8c){return _0x582d0f[_0x2c95('0x9')](_0x2c95('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1ab=['api','bluebird','request-promise','rimraf','exports','FaxQueue','fax_queues','lodash','util'];(function(_0x5f9444,_0x4b1435){var _0xe454a=function(_0x11955b){while(--_0x11955b){_0x5f9444['push'](_0x5f9444['shift']());}};_0xe454a(++_0x4b1435);}(_0xa1ab,0xc4));var _0xba1a=function(_0x11d21a,_0x5d02f7){_0x11d21a=_0x11d21a-0x0;var _0x19cb54=_0xa1ab[_0x11d21a];return _0x19cb54;};'use strict';var _=require(_0xba1a('0x0'));var util=require(_0xba1a('0x1'));var logger=require('../../config/logger')(_0xba1a('0x2'));var moment=require('moment');var BPromise=require(_0xba1a('0x3'));var rp=require(_0xba1a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba1a('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xba1a('0x6')]=function(_0x2e9c28,_0x47fe47){return _0x2e9c28['define'](_0xba1a('0x7'),attributes,{'tableName':_0xba1a('0x8'),'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 6d64753..cf1e943 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 _0x44f2=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','FaxQueue','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x44f2,0x188));var _0x244f=function(_0x3d5769,_0x10d297){_0x3d5769=_0x3d5769-0x0;var _0x46e7c4=_0x44f2[_0x3d5769];return _0x46e7c4;};'use strict';var _=require(_0x244f('0x0'));var util=require(_0x244f('0x1'));var moment=require(_0x244f('0x2'));var BPromise=require(_0x244f('0x3'));var rs=require(_0x244f('0x4'));var fs=require('fs');var Redis=require(_0x244f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x244f('0x6'));var logger=require(_0x244f('0x7'))(_0x244f('0x8'));var config=require(_0x244f('0x9'));var jayson=require(_0x244f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x244f('0xb')]=_[_0x244f('0xc')](config[_0x244f('0xb')],{'host':_0x244f('0xd'),'port':0x18eb});var socket=require(_0x244f('0xe'))(new Redis(config[_0x244f('0xb')]));require(_0x244f('0xf'))[_0x244f('0x10')](socket);function respondWithRpcPromise(_0x2e84f,_0x28efda,_0x5209cd){return new BPromise(function(_0x55c617,_0x3eb431){return client['request'](_0x2e84f,_0x5209cd)[_0x244f('0x11')](function(_0x30d170){logger['info'](_0x244f('0x12'),_0x28efda,_0x244f('0x13'));logger[_0x244f('0x14')](_0x244f('0x15'),_0x28efda,_0x244f('0x13'),JSON['stringify'](_0x30d170));if(_0x30d170[_0x244f('0x16')]){if(_0x30d170[_0x244f('0x16')][_0x244f('0x17')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x28efda,_0x30d170[_0x244f('0x16')]['message']);return _0x3eb431(_0x30d170[_0x244f('0x16')][_0x244f('0x18')]);}logger[_0x244f('0x16')](_0x244f('0x12'),_0x28efda,_0x30d170['error']['message']);return _0x55c617(_0x30d170[_0x244f('0x16')][_0x244f('0x18')]);}else{logger[_0x244f('0x19')](_0x244f('0x12'),_0x28efda,'request\x20sent');_0x55c617(_0x30d170[_0x244f('0x1a')][_0x244f('0x18')]);}})[_0x244f('0x1b')](function(_0x1fa1b8){logger[_0x244f('0x16')](_0x244f('0x12'),_0x28efda,_0x1fa1b8);_0x3eb431(_0x1fa1b8);});});}exports[_0x244f('0x1c')]=function(_0x2d59e1){var _0x3b6c4f=this;return new Promise(function(_0x5316ef,_0x42c3ab){return db['FaxQueue'][_0x244f('0x1d')]({'raw':_0x2d59e1[_0x244f('0x1e')]?_0x2d59e1[_0x244f('0x1e')][_0x244f('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d59e1[_0x244f('0x1e')]?_0x2d59e1[_0x244f('0x1e')][_0x244f('0x20')]||null:null,'attributes':_0x2d59e1['options']?_0x2d59e1[_0x244f('0x1e')][_0x244f('0x21')]||null:null,'limit':_0x2d59e1['options']?_0x2d59e1[_0x244f('0x1e')][_0x244f('0x22')]||null:null,'include':_0x2d59e1[_0x244f('0x1e')]?_0x2d59e1[_0x244f('0x1e')][_0x244f('0x23')]?_[_0x244f('0x24')](_0x2d59e1['options'][_0x244f('0x23')],function(_0x4f69bf){return{'model':db[_0x4f69bf[_0x244f('0x25')]],'as':_0x4f69bf['as'],'attributes':_0x4f69bf[_0x244f('0x21')],'include':_0x4f69bf[_0x244f('0x23')]?_[_0x244f('0x24')](_0x4f69bf[_0x244f('0x23')],function(_0x438d2b){return{'model':db[_0x438d2b[_0x244f('0x25')]],'as':_0x438d2b['as'],'attributes':_0x438d2b[_0x244f('0x21')],'include':_0x438d2b[_0x244f('0x23')]?_[_0x244f('0x24')](_0x438d2b['include'],function(_0x112afc){return{'model':db[_0x112afc[_0x244f('0x25')]],'as':_0x112afc['as'],'attributes':_0x112afc[_0x244f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x244f('0x11')](function(_0x59eec3){logger[_0x244f('0x19')](_0x244f('0x1c'),_0x2d59e1);logger['debug']('GetFaxQueue',_0x2d59e1,JSON[_0x244f('0x26')](_0x59eec3));_0x5316ef(_0x59eec3);})[_0x244f('0x1b')](function(_0x928f1b){logger[_0x244f('0x16')](_0x244f('0x1c'),_0x928f1b[_0x244f('0x18')],_0x2d59e1);_0x42c3ab(_0x3b6c4f[_0x244f('0x16')](0x1f4,_0x928f1b[_0x244f('0x18')]));});});};exports['ShowFaxQueue']=function(_0x4e2a40){var _0x2269ef=this;return new Promise(function(_0x3b63ae,_0x5499a1){return db[_0x244f('0x27')]['find']({'raw':_0x4e2a40[_0x244f('0x1e')]?_0x4e2a40[_0x244f('0x1e')][_0x244f('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e2a40[_0x244f('0x1e')]?_0x4e2a40['options'][_0x244f('0x20')]||null:null,'attributes':_0x4e2a40[_0x244f('0x1e')]?_0x4e2a40[_0x244f('0x1e')][_0x244f('0x21')]||null:null,'include':_0x4e2a40['options']?_0x4e2a40['options'][_0x244f('0x23')]?_[_0x244f('0x24')](_0x4e2a40[_0x244f('0x1e')][_0x244f('0x23')],function(_0x4c8302){return{'model':db[_0x4c8302[_0x244f('0x25')]],'as':_0x4c8302['as'],'attributes':_0x4c8302[_0x244f('0x21')],'include':_0x4c8302[_0x244f('0x23')]?_[_0x244f('0x24')](_0x4c8302[_0x244f('0x23')],function(_0x4613ee){return{'model':db[_0x4613ee['model']],'as':_0x4613ee['as'],'attributes':_0x4613ee[_0x244f('0x21')],'include':_0x4613ee[_0x244f('0x23')]?_[_0x244f('0x24')](_0x4613ee['include'],function(_0x3c4ced){return{'model':db[_0x3c4ced['model']],'as':_0x3c4ced['as'],'attributes':_0x3c4ced['attributes']};}):[]};}):[]};}):[]:[]})[_0x244f('0x11')](function(_0x5b19f6){logger[_0x244f('0x19')](_0x244f('0x28'),_0x4e2a40);logger[_0x244f('0x14')](_0x244f('0x28'),_0x4e2a40,JSON[_0x244f('0x26')](_0x5b19f6));_0x3b63ae(_0x5b19f6);})[_0x244f('0x1b')](function(_0xa81060){logger[_0x244f('0x16')](_0x244f('0x28'),_0xa81060[_0x244f('0x18')],_0x4e2a40);_0x5499a1(_0x2269ef[_0x244f('0x16')](0x1f4,_0xa81060[_0x244f('0x18')]));});});}; \ No newline at end of file +var _0xd545=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetFaxQueue','catch','ShowFaxQueue','find','then','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xd545,0x161));var _0x5d54=function(_0x326732,_0x363cb7){_0x326732=_0x326732-0x0;var _0x1be7e4=_0xd545[_0x326732];return _0x1be7e4;};'use strict';var _=require(_0x5d54('0x0'));var util=require('util');var moment=require(_0x5d54('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d54('0x2'));var fs=require('fs');var Redis=require(_0x5d54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d54('0x4'));var logger=require(_0x5d54('0x5'))(_0x5d54('0x6'));var config=require(_0x5d54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d54('0x8')]['http']({'port':0x232a});config[_0x5d54('0x9')]=_[_0x5d54('0xa')](config['redis'],{'host':_0x5d54('0xb'),'port':0x18eb});var socket=require(_0x5d54('0xc'))(new Redis(config[_0x5d54('0x9')]));require(_0x5d54('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d1bad,_0x4b1e0b,_0x361f1f){return new BPromise(function(_0x419333,_0x477032){return client[_0x5d54('0xe')](_0x5d1bad,_0x361f1f)['then'](function(_0x581920){logger[_0x5d54('0xf')](_0x5d54('0x10'),_0x4b1e0b,'request\x20sent');logger[_0x5d54('0x11')](_0x5d54('0x12'),_0x4b1e0b,'request\x20sent',JSON[_0x5d54('0x13')](_0x581920));if(_0x581920[_0x5d54('0x14')]){if(_0x581920[_0x5d54('0x14')][_0x5d54('0x15')]===0x1f4){logger['error'](_0x5d54('0x10'),_0x4b1e0b,_0x581920[_0x5d54('0x14')][_0x5d54('0x16')]);return _0x477032(_0x581920[_0x5d54('0x14')][_0x5d54('0x16')]);}logger['error'](_0x5d54('0x10'),_0x4b1e0b,_0x581920[_0x5d54('0x14')][_0x5d54('0x16')]);return _0x419333(_0x581920[_0x5d54('0x14')][_0x5d54('0x16')]);}else{logger[_0x5d54('0xf')]('FaxQueue,\x20%s,\x20%s',_0x4b1e0b,_0x5d54('0x17'));_0x419333(_0x581920[_0x5d54('0x18')][_0x5d54('0x16')]);}})['catch'](function(_0x291b8d){logger['error'](_0x5d54('0x10'),_0x4b1e0b,_0x291b8d);_0x477032(_0x291b8d);});});}exports['GetFaxQueue']=function(_0x289cc4){var _0xb18f88=this;return new Promise(function(_0x328438,_0x818023){return db[_0x5d54('0x19')][_0x5d54('0x1a')]({'raw':_0x289cc4[_0x5d54('0x1b')]?_0x289cc4[_0x5d54('0x1b')][_0x5d54('0x1c')]===undefined?!![]:![]:!![],'where':_0x289cc4[_0x5d54('0x1b')]?_0x289cc4['options'][_0x5d54('0x1d')]||null:null,'attributes':_0x289cc4[_0x5d54('0x1b')]?_0x289cc4[_0x5d54('0x1b')][_0x5d54('0x1e')]||null:null,'limit':_0x289cc4[_0x5d54('0x1b')]?_0x289cc4[_0x5d54('0x1b')][_0x5d54('0x1f')]||null:null,'include':_0x289cc4['options']?_0x289cc4['options']['include']?_[_0x5d54('0x20')](_0x289cc4[_0x5d54('0x1b')][_0x5d54('0x21')],function(_0x4521a7){return{'model':db[_0x4521a7[_0x5d54('0x22')]],'as':_0x4521a7['as'],'attributes':_0x4521a7[_0x5d54('0x1e')],'include':_0x4521a7[_0x5d54('0x21')]?_['map'](_0x4521a7['include'],function(_0x50c6e5){return{'model':db[_0x50c6e5[_0x5d54('0x22')]],'as':_0x50c6e5['as'],'attributes':_0x50c6e5[_0x5d54('0x1e')],'include':_0x50c6e5['include']?_[_0x5d54('0x20')](_0x50c6e5[_0x5d54('0x21')],function(_0x3bb2cc){return{'model':db[_0x3bb2cc[_0x5d54('0x22')]],'as':_0x3bb2cc['as'],'attributes':_0x3bb2cc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c64ec){logger['info']('GetFaxQueue',_0x289cc4);logger[_0x5d54('0x11')](_0x5d54('0x23'),_0x289cc4,JSON[_0x5d54('0x13')](_0x2c64ec));_0x328438(_0x2c64ec);})[_0x5d54('0x24')](function(_0x4a9df2){logger['error'](_0x5d54('0x23'),_0x4a9df2['message'],_0x289cc4);_0x818023(_0xb18f88['error'](0x1f4,_0x4a9df2[_0x5d54('0x16')]));});});};exports[_0x5d54('0x25')]=function(_0x420191){var _0x2fe683=this;return new Promise(function(_0x495d38,_0x236539){return db['FaxQueue'][_0x5d54('0x26')]({'raw':_0x420191['options']?_0x420191[_0x5d54('0x1b')][_0x5d54('0x1c')]===undefined?!![]:![]:!![],'where':_0x420191[_0x5d54('0x1b')]?_0x420191['options'][_0x5d54('0x1d')]||null:null,'attributes':_0x420191[_0x5d54('0x1b')]?_0x420191[_0x5d54('0x1b')][_0x5d54('0x1e')]||null:null,'include':_0x420191['options']?_0x420191['options']['include']?_['map'](_0x420191[_0x5d54('0x1b')]['include'],function(_0x3cf249){return{'model':db[_0x3cf249[_0x5d54('0x22')]],'as':_0x3cf249['as'],'attributes':_0x3cf249[_0x5d54('0x1e')],'include':_0x3cf249[_0x5d54('0x21')]?_['map'](_0x3cf249[_0x5d54('0x21')],function(_0x2c0fdd){return{'model':db[_0x2c0fdd[_0x5d54('0x22')]],'as':_0x2c0fdd['as'],'attributes':_0x2c0fdd[_0x5d54('0x1e')],'include':_0x2c0fdd['include']?_[_0x5d54('0x20')](_0x2c0fdd[_0x5d54('0x21')],function(_0x481954){return{'model':db[_0x481954[_0x5d54('0x22')]],'as':_0x481954['as'],'attributes':_0x481954[_0x5d54('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5d54('0x27')](function(_0x57eca9){logger[_0x5d54('0xf')](_0x5d54('0x25'),_0x420191);logger[_0x5d54('0x11')]('ShowFaxQueue',_0x420191,JSON['stringify'](_0x57eca9));_0x495d38(_0x57eca9);})[_0x5d54('0x24')](function(_0x9efd8a){logger[_0x5d54('0x14')](_0x5d54('0x25'),_0x9efd8a['message'],_0x420191);_0x236539(_0x2fe683[_0x5d54('0x14')](0x1f4,_0x9efd8a[_0x5d54('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e756c26..298a9f9 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 _0x2884=['./faxQueue.events','save','remove','emit','removeListener','register'];(function(_0x2beaec,_0x290581){var _0x65bf16=function(_0x71ae1b){while(--_0x71ae1b){_0x2beaec['push'](_0x2beaec['shift']());}};_0x65bf16(++_0x290581);}(_0x2884,0x11a));var _0x4288=function(_0x5922f7,_0x23885e){_0x5922f7=_0x5922f7-0x0;var _0x145529=_0x2884[_0x5922f7];return _0x145529;};'use strict';var FaxQueueEvents=require(_0x4288('0x0'));var events=[_0x4288('0x1'),_0x4288('0x2'),'update'];function createListener(_0x21d118,_0x7add2a){return function(_0x573f83){_0x7add2a[_0x4288('0x3')](_0x21d118,_0x573f83);};}function removeListener(_0x3e64f9,_0x4aa33a){return function(){FaxQueueEvents[_0x4288('0x4')](_0x3e64f9,_0x4aa33a);};}exports[_0x4288('0x5')]=function(_0x3d161b){for(var _0x25a198=0x0,_0x18e69a=events['length'];_0x25a198<_0x18e69a;_0x25a198++){var _0x341f80=events[_0x25a198];var _0x43150a=createListener('faxQueue:'+_0x341f80,_0x3d161b);FaxQueueEvents['on'](_0x341f80,_0x43150a);}}; \ No newline at end of file +var _0xc12c=['emit','removeListener','length','faxQueue:','./faxQueue.events','remove','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc12c,0xb3));var _0xcc12=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xc12c[_0x134c2e];return _0x2825db;};'use strict';var FaxQueueEvents=require(_0xcc12('0x0'));var events=['save',_0xcc12('0x1'),_0xcc12('0x2')];function createListener(_0x16eee4,_0x468301){return function(_0x2a97b9){_0x468301[_0xcc12('0x3')](_0x16eee4,_0x2a97b9);};}function removeListener(_0x2062cd,_0xcaba74){return function(){FaxQueueEvents[_0xcc12('0x4')](_0x2062cd,_0xcaba74);};}exports['register']=function(_0x19a2bc){for(var _0x2f59e3=0x0,_0x32f4ce=events[_0xcc12('0x5')];_0x2f59e3<_0x32f4ce;_0x2f59e3++){var _0x21cf30=events[_0x2f59e3];var _0x1c12f5=createListener(_0xcc12('0x6')+_0x21cf30,_0x19a2bc);FaxQueueEvents['on'](_0x21cf30,_0x1c12f5);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e24e2a2..7412ace 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 _0xde46=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x35a2bd,_0x264521){var _0x460c48=function(_0xcc2529){while(--_0xcc2529){_0x35a2bd['push'](_0x35a2bd['shift']());}};_0x460c48(++_0x264521);}(_0xde46,0x14e));var _0x6de4=function(_0x279572,_0xb56759){_0x279572=_0x279572-0x0;var _0x4bc1a8=_0xde46[_0x279572];return _0x4bc1a8;};'use strict';var multer=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var path=require(_0x6de4('0x2'));var timeout=require(_0x6de4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6de4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var controller=require(_0x6de4('0x7'));router[_0x6de4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6de4('0x8')]('/describe',auth[_0x6de4('0x9')](),controller[_0x6de4('0xa')]);router['get'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xc')]);router[_0x6de4('0x8')](_0x6de4('0xd'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xe')]);router[_0x6de4('0x8')](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x10')]);router['get'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x12')]);router[_0x6de4('0x13')]('/',auth[_0x6de4('0x9')](),controller[_0x6de4('0x14')]);router[_0x6de4('0x13')](_0x6de4('0xf'),auth['isAuthenticated'](),controller[_0x6de4('0x15')]);router['post'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x16')]);router['put'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x17')]);router[_0x6de4('0x18')]('/:id',auth[_0x6de4('0x9')](),controller['destroy']);router['delete'](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x19')]);router[_0x6de4('0x18')](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x1a')]);module[_0x6de4('0x1b')]=router; \ No newline at end of file +var _0x8f9d=['getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['get']('/:id/members',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0xb')](_0xd8f9('0x10'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);router[_0xd8f9('0xb')]('/:id/users',auth[_0xd8f9('0x9')](),controller['getAgents']);router[_0xd8f9('0x12')]('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x13')]);router['post'](_0xd8f9('0x10'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x14')]);router[_0xd8f9('0x12')]('/:id/users',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x15')]);router[_0xd8f9('0x16')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x17')]);router[_0xd8f9('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd8f9('0x19')]);router[_0xd8f9('0x18')]('/:id/teams',auth[_0xd8f9('0x9')](),controller['removeTeams']);router[_0xd8f9('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xd8f9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0eab2bf..bfb6a6c 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 _0x5e35=['sequelize','exports','STRING','DATE','moment'];(function(_0x4f027d,_0x3f9587){var _0xc46890=function(_0x27d06c){while(--_0x27d06c){_0x4f027d['push'](_0x4f027d['shift']());}};_0xc46890(++_0x3f9587);}(_0x5e35,0xdb));var _0x55e3=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x5e35[_0x1b2ff7];return _0x31656a;};'use strict';var moment=require(_0x55e3('0x0'));var Sequelize=require(_0x55e3('0x1'));module[_0x55e3('0x2')]={'uniqueid':{'type':Sequelize[_0x55e3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x55e3('0x3')]},'joinAt':{'type':Sequelize[_0x55e3('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x55e3('0x4')]},'exitAt':{'type':Sequelize[_0x55e3('0x4')]},'reason':{'type':Sequelize[_0x55e3('0x3')]}}; \ No newline at end of file +var _0x2303=['STRING','moment','sequelize','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2303,0x75));var _0x3230=function(_0x3e39ca,_0x5c3e07){_0x3e39ca=_0x3e39ca-0x0;var _0x291d0f=_0x2303[_0x3e39ca];return _0x291d0f;};'use strict';var moment=require(_0x3230('0x0'));var Sequelize=require(_0x3230('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3230('0x2')]},'acceptAt':{'type':Sequelize[_0x3230('0x2')]},'exitAt':{'type':Sequelize[_0x3230('0x2')]},'reason':{'type':Sequelize[_0x3230('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e9a37d6..1f0875b 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 _0x22a4=['fields','length','nolimit','order','sort','where','pick','merge','type','options','include','FaxQueueReport','findAll','catch','params','keys','rawAttributes','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','key','model','query','filters','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22a4,0x1cb));var _0x422a=function(_0x4c5232,_0x270c3e){_0x4c5232=_0x4c5232-0x0;var _0x47ade2=_0x22a4[_0x4c5232];return _0x47ade2;};'use strict';var emlformat=require(_0x422a('0x0'));var rimraf=require(_0x422a('0x1'));var zipdir=require(_0x422a('0x2'));var jsonpatch=require(_0x422a('0x3'));var rp=require(_0x422a('0x4'));var moment=require(_0x422a('0x5'));var BPromise=require(_0x422a('0x6'));var Mustache=require(_0x422a('0x7'));var util=require('util');var path=require(_0x422a('0x8'));var sox=require(_0x422a('0x9'));var csv=require(_0x422a('0xa'));var ejs=require(_0x422a('0xb'));var fs=require('fs');var fs_extra=require(_0x422a('0xc'));var _=require('lodash');var squel=require(_0x422a('0xd'));var crypto=require(_0x422a('0xe'));var jsforce=require(_0x422a('0xf'));var deskjs=require(_0x422a('0x10'));var toCsv=require(_0x422a('0xa'));var querystring=require(_0x422a('0x11'));var Papa=require(_0x422a('0x12'));var Redis=require(_0x422a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x422a('0x14'));var hardwareService=require(_0x422a('0x15'));var logger=require(_0x422a('0x16'))(_0x422a('0x17'));var utils=require(_0x422a('0x18'));var config=require(_0x422a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xebe70d,_0x4dbed1){_0x4dbed1=_0x4dbed1||0xcc;return function(_0x5a0c59){if(_0x5a0c59){return _0xebe70d['sendStatus'](_0x4dbed1);}return _0xebe70d[_0x422a('0x1a')](_0x4dbed1)[_0x422a('0x1b')]();};}function respondWithResult(_0x11af1f,_0x2dc9b2){_0x2dc9b2=_0x2dc9b2||0xc8;return function(_0x147af5){if(_0x147af5){return _0x11af1f[_0x422a('0x1a')](_0x2dc9b2)[_0x422a('0x1c')](_0x147af5);}};}function respondWithFilteredResult(_0x3504bb,_0xf9fcf7){return function(_0x2ba53b){if(_0x2ba53b){var _0x30b6e9=typeof _0xf9fcf7[_0x422a('0x1d')]===_0x422a('0x1e')&&typeof _0xf9fcf7[_0x422a('0x1f')]===_0x422a('0x1e');var _0x2e8163=_0x2ba53b[_0x422a('0x20')];var _0x5e2507=_0x30b6e9?0x0:_0xf9fcf7[_0x422a('0x1d')];var _0x3c5d86=_0x30b6e9?_0x2ba53b['count']:_0xf9fcf7[_0x422a('0x1d')]+_0xf9fcf7['limit'];var _0x552048;if(_0x3c5d86>=_0x2e8163){_0x3c5d86=_0x2e8163;_0x552048=0xc8;}else{_0x552048=0xce;}_0x3504bb[_0x422a('0x1a')](_0x552048);return _0x3504bb[_0x422a('0x21')](_0x422a('0x22'),_0x5e2507+'-'+_0x3c5d86+'/'+_0x2e8163)[_0x422a('0x1c')](_0x2ba53b);}return null;};}function patchUpdates(_0x194c25){return function(_0x5f9720){try{jsonpatch[_0x422a('0x23')](_0x5f9720,_0x194c25,!![]);}catch(_0x26922a){return BPromise['reject'](_0x26922a);}return _0x5f9720[_0x422a('0x24')]();};}function saveUpdates(_0x3284ed,_0x211d93){return function(_0x3d3213){if(_0x3d3213){return _0x3d3213[_0x422a('0x25')](_0x3284ed)['then'](function(_0x837c81){return _0x837c81;});}return null;};}function removeEntity(_0x33bc88,_0x6e209d){return function(_0x5e3138){if(_0x5e3138){return _0x5e3138[_0x422a('0x26')]()[_0x422a('0x27')](function(){_0x33bc88[_0x422a('0x1a')](0xcc)[_0x422a('0x1b')]();});}};}function handleEntityNotFound(_0xfc8699,_0xa7e1dd){return function(_0xca7e3c){if(!_0xca7e3c){_0xfc8699[_0x422a('0x28')](0x194);}return _0xca7e3c;};}function handleError(_0x535888,_0x911cc9){_0x911cc9=_0x911cc9||0x1f4;return function(_0x15d2ab){logger['error'](_0x15d2ab[_0x422a('0x29')]);if(_0x15d2ab['name']){delete _0x15d2ab[_0x422a('0x2a')];}_0x535888[_0x422a('0x1a')](_0x911cc9)[_0x422a('0x2b')](_0x15d2ab);};}exports[_0x422a('0x2c')]=function(_0x4badf8,_0x3cb362){var _0x2f833e={},_0x50cc29={},_0x5826ac={'count':0x0,'rows':[]};var _0x3414ad=_[_0x422a('0x2d')](db['FaxQueueReport']['rawAttributes'],function(_0x4903d1){return{'name':_0x4903d1['fieldName'],'type':_0x4903d1['type'][_0x422a('0x2e')]};});_0x50cc29[_0x422a('0x2f')]=_[_0x422a('0x2d')](_0x3414ad,_0x422a('0x2a'));_0x50cc29[_0x422a('0x30')]=_['keys'](_0x4badf8[_0x422a('0x30')]);_0x50cc29[_0x422a('0x31')]=_[_0x422a('0x32')](_0x50cc29[_0x422a('0x2f')],_0x50cc29[_0x422a('0x30')]);_0x2f833e[_0x422a('0x33')]=_[_0x422a('0x32')](_0x50cc29['model'],qs[_0x422a('0x34')](_0x4badf8[_0x422a('0x30')][_0x422a('0x34')]));_0x2f833e[_0x422a('0x33')]=_0x2f833e['attributes'][_0x422a('0x35')]?_0x2f833e['attributes']:_0x50cc29[_0x422a('0x2f')];if(!_0x4badf8[_0x422a('0x30')]['hasOwnProperty'](_0x422a('0x36'))){_0x2f833e[_0x422a('0x1f')]=qs['limit'](_0x4badf8[_0x422a('0x30')][_0x422a('0x1f')]);_0x2f833e[_0x422a('0x1d')]=qs[_0x422a('0x1d')](_0x4badf8[_0x422a('0x30')][_0x422a('0x1d')]);}_0x2f833e[_0x422a('0x37')]=qs[_0x422a('0x38')](_0x4badf8['query']['sort']);_0x2f833e[_0x422a('0x39')]=qs[_0x422a('0x31')](_[_0x422a('0x3a')](_0x4badf8['query'],_0x50cc29[_0x422a('0x31')]),_0x3414ad);if(_0x4badf8[_0x422a('0x30')]['filter']){_0x2f833e['where']=_[_0x422a('0x3b')](_0x2f833e['where'],{'$or':_[_0x422a('0x2d')](_0x3414ad,function(_0x311fa7){if(_0x311fa7[_0x422a('0x3c')]!=='VIRTUAL'){var _0x36661b={};_0x36661b[_0x311fa7[_0x422a('0x2a')]]={'$like':'%'+_0x4badf8[_0x422a('0x30')]['filter']+'%'};return _0x36661b;}})});}_0x2f833e=_['merge']({},_0x2f833e,_0x4badf8[_0x422a('0x3d')]);var _0x424716={'where':_0x2f833e[_0x422a('0x39')]};return db['FaxQueueReport'][_0x422a('0x20')](_0x424716)[_0x422a('0x27')](function(_0x254f3f){_0x5826ac[_0x422a('0x20')]=_0x254f3f;if(_0x4badf8[_0x422a('0x30')]['includeAll']){_0x2f833e[_0x422a('0x3e')]=[{'all':!![]}];}return db[_0x422a('0x3f')][_0x422a('0x40')](_0x2f833e);})[_0x422a('0x27')](function(_0xfd39fa){_0x5826ac['rows']=_0xfd39fa;return _0x5826ac;})['then'](respondWithFilteredResult(_0x3cb362,_0x2f833e))[_0x422a('0x41')](handleError(_0x3cb362,null));};exports['show']=function(_0x4c2e63,_0x42bbc1){var _0x7a59f8={'raw':!![],'where':{'id':_0x4c2e63[_0x422a('0x42')]['id']}},_0x10302c={};_0x10302c[_0x422a('0x2f')]=_[_0x422a('0x43')](db['FaxQueueReport'][_0x422a('0x44')]);_0x10302c[_0x422a('0x30')]=_[_0x422a('0x43')](_0x4c2e63[_0x422a('0x30')]);_0x10302c[_0x422a('0x31')]=_[_0x422a('0x32')](_0x10302c[_0x422a('0x2f')],_0x10302c['query']);_0x7a59f8[_0x422a('0x33')]=_[_0x422a('0x32')](_0x10302c['model'],qs[_0x422a('0x34')](_0x4c2e63[_0x422a('0x30')][_0x422a('0x34')]));_0x7a59f8[_0x422a('0x33')]=_0x7a59f8[_0x422a('0x33')][_0x422a('0x35')]?_0x7a59f8[_0x422a('0x33')]:_0x10302c['model'];if(_0x4c2e63[_0x422a('0x30')][_0x422a('0x45')]){_0x7a59f8[_0x422a('0x3e')]=[{'all':!![]}];}_0x7a59f8=_[_0x422a('0x3b')]({},_0x7a59f8,_0x4c2e63[_0x422a('0x3d')]);return db[_0x422a('0x3f')][_0x422a('0x46')](_0x7a59f8)[_0x422a('0x27')](handleEntityNotFound(_0x42bbc1,null))[_0x422a('0x27')](respondWithResult(_0x42bbc1,null))[_0x422a('0x41')](handleError(_0x42bbc1,null));};exports['create']=function(_0x48917f,_0x3fd514){return db[_0x422a('0x3f')]['create'](_0x48917f[_0x422a('0x47')],{})[_0x422a('0x27')](respondWithResult(_0x3fd514,0xc9))[_0x422a('0x41')](handleError(_0x3fd514,null));};exports[_0x422a('0x25')]=function(_0x706497,_0x792783){if(_0x706497[_0x422a('0x47')]['id']){delete _0x706497[_0x422a('0x47')]['id'];}return db[_0x422a('0x3f')][_0x422a('0x46')]({'where':{'id':_0x706497['params']['id']}})['then'](handleEntityNotFound(_0x792783,null))[_0x422a('0x27')](saveUpdates(_0x706497[_0x422a('0x47')],null))['then'](respondWithResult(_0x792783,null))[_0x422a('0x41')](handleError(_0x792783,null));};exports[_0x422a('0x26')]=function(_0x20b4d3,_0x10de41){return db[_0x422a('0x3f')][_0x422a('0x46')]({'where':{'id':_0x20b4d3[_0x422a('0x42')]['id']}})['then'](handleEntityNotFound(_0x10de41,null))[_0x422a('0x27')](removeEntity(_0x10de41,null))[_0x422a('0x41')](handleError(_0x10de41,null));};exports[_0x422a('0x48')]=function(_0x41deb3,_0x139d54){return db[_0x422a('0x3f')]['describe']()['then'](respondWithResult(_0x139d54,null))[_0x422a('0x41')](handleError(_0x139d54,null));}; \ No newline at end of file +var _0xbe45=['pick','filter','where','VIRTUAL','merge','options','FaxQueueReport','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort'];(function(_0x25cdbc,_0x1000f2){var _0x13b5fd=function(_0x4f8259){while(--_0x4f8259){_0x25cdbc['push'](_0x25cdbc['shift']());}};_0x13b5fd(++_0x1000f2);}(_0xbe45,0xf0));var _0x5be4=function(_0x232db8,_0x47e4a5){_0x232db8=_0x232db8-0x0;var _0x171cdd=_0xbe45[_0x232db8];return _0x171cdd;};'use strict';var emlformat=require(_0x5be4('0x0'));var rimraf=require(_0x5be4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5be4('0x2'));var rp=require(_0x5be4('0x3'));var moment=require(_0x5be4('0x4'));var BPromise=require(_0x5be4('0x5'));var Mustache=require(_0x5be4('0x6'));var util=require(_0x5be4('0x7'));var path=require('path');var sox=require(_0x5be4('0x8'));var csv=require(_0x5be4('0x9'));var ejs=require(_0x5be4('0xa'));var fs=require('fs');var fs_extra=require(_0x5be4('0xb'));var _=require(_0x5be4('0xc'));var squel=require(_0x5be4('0xd'));var crypto=require(_0x5be4('0xe'));var jsforce=require(_0x5be4('0xf'));var deskjs=require(_0x5be4('0x10'));var toCsv=require(_0x5be4('0x9'));var querystring=require(_0x5be4('0x11'));var Papa=require(_0x5be4('0x12'));var Redis=require(_0x5be4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5be4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5be4('0x15'))('api');var utils=require(_0x5be4('0x16'));var config=require(_0x5be4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5be4('0x18'))['db'];function respondWithStatusCode(_0x43a60f,_0x1d7960){_0x1d7960=_0x1d7960||0xcc;return function(_0x5c6615){if(_0x5c6615){return _0x43a60f[_0x5be4('0x19')](_0x1d7960);}return _0x43a60f['status'](_0x1d7960)[_0x5be4('0x1a')]();};}function respondWithResult(_0x2afee8,_0x2dd93e){_0x2dd93e=_0x2dd93e||0xc8;return function(_0x335842){if(_0x335842){return _0x2afee8[_0x5be4('0x1b')](_0x2dd93e)[_0x5be4('0x1c')](_0x335842);}};}function respondWithFilteredResult(_0x3980fc,_0x5ebe65){return function(_0x3e830e){if(_0x3e830e){var _0x8466a7=typeof _0x5ebe65[_0x5be4('0x1d')]===_0x5be4('0x1e')&&typeof _0x5ebe65[_0x5be4('0x1f')]===_0x5be4('0x1e');var _0x94f434=_0x3e830e[_0x5be4('0x20')];var _0x51662a=_0x8466a7?0x0:_0x5ebe65[_0x5be4('0x1d')];var _0x50b970=_0x8466a7?_0x3e830e['count']:_0x5ebe65[_0x5be4('0x1d')]+_0x5ebe65[_0x5be4('0x1f')];var _0x4cce93;if(_0x50b970>=_0x94f434){_0x50b970=_0x94f434;_0x4cce93=0xc8;}else{_0x4cce93=0xce;}_0x3980fc[_0x5be4('0x1b')](_0x4cce93);return _0x3980fc[_0x5be4('0x21')]('Content-Range',_0x51662a+'-'+_0x50b970+'/'+_0x94f434)['json'](_0x3e830e);}return null;};}function patchUpdates(_0x2690be){return function(_0x207948){try{jsonpatch['apply'](_0x207948,_0x2690be,!![]);}catch(_0x553f59){return BPromise[_0x5be4('0x22')](_0x553f59);}return _0x207948[_0x5be4('0x23')]();};}function saveUpdates(_0x2843e3,_0x3ccd67){return function(_0xa20552){if(_0xa20552){return _0xa20552['update'](_0x2843e3)[_0x5be4('0x24')](function(_0x51d7a7){return _0x51d7a7;});}return null;};}function removeEntity(_0x242005,_0x12b9cd){return function(_0x4d6eff){if(_0x4d6eff){return _0x4d6eff[_0x5be4('0x25')]()[_0x5be4('0x24')](function(){_0x242005['status'](0xcc)[_0x5be4('0x1a')]();});}};}function handleEntityNotFound(_0x2b2e2c,_0x353a65){return function(_0x39cf54){if(!_0x39cf54){_0x2b2e2c[_0x5be4('0x19')](0x194);}return _0x39cf54;};}function handleError(_0x13779f,_0x112728){_0x112728=_0x112728||0x1f4;return function(_0x5b49ea){logger['error'](_0x5b49ea[_0x5be4('0x26')]);if(_0x5b49ea[_0x5be4('0x27')]){delete _0x5b49ea[_0x5be4('0x27')];}_0x13779f['status'](_0x112728)[_0x5be4('0x28')](_0x5b49ea);};}exports[_0x5be4('0x29')]=function(_0x3bd842,_0x412ef6){var _0x16f3bf={},_0x1e0485={},_0x4b9029={'count':0x0,'rows':[]};var _0x1661c2=_[_0x5be4('0x2a')](db['FaxQueueReport'][_0x5be4('0x2b')],function(_0x49780a){return{'name':_0x49780a[_0x5be4('0x2c')],'type':_0x49780a[_0x5be4('0x2d')]['key']};});_0x1e0485[_0x5be4('0x2e')]=_['map'](_0x1661c2,'name');_0x1e0485[_0x5be4('0x2f')]=_[_0x5be4('0x30')](_0x3bd842[_0x5be4('0x2f')]);_0x1e0485[_0x5be4('0x31')]=_[_0x5be4('0x32')](_0x1e0485[_0x5be4('0x2e')],_0x1e0485[_0x5be4('0x2f')]);_0x16f3bf[_0x5be4('0x33')]=_[_0x5be4('0x32')](_0x1e0485[_0x5be4('0x2e')],qs[_0x5be4('0x34')](_0x3bd842[_0x5be4('0x2f')]['fields']));_0x16f3bf['attributes']=_0x16f3bf[_0x5be4('0x33')][_0x5be4('0x35')]?_0x16f3bf[_0x5be4('0x33')]:_0x1e0485[_0x5be4('0x2e')];if(!_0x3bd842['query'][_0x5be4('0x36')]('nolimit')){_0x16f3bf[_0x5be4('0x1f')]=qs['limit'](_0x3bd842[_0x5be4('0x2f')][_0x5be4('0x1f')]);_0x16f3bf['offset']=qs['offset'](_0x3bd842[_0x5be4('0x2f')]['offset']);}_0x16f3bf['order']=qs[_0x5be4('0x37')](_0x3bd842[_0x5be4('0x2f')][_0x5be4('0x37')]);_0x16f3bf['where']=qs[_0x5be4('0x31')](_[_0x5be4('0x38')](_0x3bd842['query'],_0x1e0485[_0x5be4('0x31')]),_0x1661c2);if(_0x3bd842[_0x5be4('0x2f')][_0x5be4('0x39')]){_0x16f3bf[_0x5be4('0x3a')]=_['merge'](_0x16f3bf[_0x5be4('0x3a')],{'$or':_[_0x5be4('0x2a')](_0x1661c2,function(_0x178500){if(_0x178500[_0x5be4('0x2d')]!==_0x5be4('0x3b')){var _0x3ddba4={};_0x3ddba4[_0x178500[_0x5be4('0x27')]]={'$like':'%'+_0x3bd842[_0x5be4('0x2f')]['filter']+'%'};return _0x3ddba4;}})});}_0x16f3bf=_[_0x5be4('0x3c')]({},_0x16f3bf,_0x3bd842[_0x5be4('0x3d')]);var _0x348c30={'where':_0x16f3bf[_0x5be4('0x3a')]};return db[_0x5be4('0x3e')]['count'](_0x348c30)[_0x5be4('0x24')](function(_0x344411){_0x4b9029['count']=_0x344411;if(_0x3bd842[_0x5be4('0x2f')][_0x5be4('0x3f')]){_0x16f3bf['include']=[{'all':!![]}];}return db[_0x5be4('0x3e')][_0x5be4('0x40')](_0x16f3bf);})[_0x5be4('0x24')](function(_0x1d480c){_0x4b9029[_0x5be4('0x41')]=_0x1d480c;return _0x4b9029;})[_0x5be4('0x24')](respondWithFilteredResult(_0x412ef6,_0x16f3bf))[_0x5be4('0x42')](handleError(_0x412ef6,null));};exports[_0x5be4('0x43')]=function(_0x2313d6,_0x53974f){var _0x1add45={'raw':!![],'where':{'id':_0x2313d6[_0x5be4('0x44')]['id']}},_0x536473={};_0x536473[_0x5be4('0x2e')]=_['keys'](db[_0x5be4('0x3e')]['rawAttributes']);_0x536473['query']=_[_0x5be4('0x30')](_0x2313d6[_0x5be4('0x2f')]);_0x536473[_0x5be4('0x31')]=_[_0x5be4('0x32')](_0x536473[_0x5be4('0x2e')],_0x536473[_0x5be4('0x2f')]);_0x1add45[_0x5be4('0x33')]=_['intersection'](_0x536473[_0x5be4('0x2e')],qs['fields'](_0x2313d6[_0x5be4('0x2f')]['fields']));_0x1add45[_0x5be4('0x33')]=_0x1add45[_0x5be4('0x33')]['length']?_0x1add45[_0x5be4('0x33')]:_0x536473[_0x5be4('0x2e')];if(_0x2313d6[_0x5be4('0x2f')]['includeAll']){_0x1add45[_0x5be4('0x45')]=[{'all':!![]}];}_0x1add45=_[_0x5be4('0x3c')]({},_0x1add45,_0x2313d6['options']);return db[_0x5be4('0x3e')]['find'](_0x1add45)['then'](handleEntityNotFound(_0x53974f,null))[_0x5be4('0x24')](respondWithResult(_0x53974f,null))[_0x5be4('0x42')](handleError(_0x53974f,null));};exports['create']=function(_0x47734f,_0x57f25d){return db['FaxQueueReport'][_0x5be4('0x46')](_0x47734f[_0x5be4('0x47')],{})[_0x5be4('0x24')](respondWithResult(_0x57f25d,0xc9))['catch'](handleError(_0x57f25d,null));};exports['update']=function(_0x378ae7,_0x2fb7cd){if(_0x378ae7[_0x5be4('0x47')]['id']){delete _0x378ae7[_0x5be4('0x47')]['id'];}return db['FaxQueueReport'][_0x5be4('0x48')]({'where':{'id':_0x378ae7[_0x5be4('0x44')]['id']}})['then'](handleEntityNotFound(_0x2fb7cd,null))[_0x5be4('0x24')](saveUpdates(_0x378ae7[_0x5be4('0x47')],null))[_0x5be4('0x24')](respondWithResult(_0x2fb7cd,null))['catch'](handleError(_0x2fb7cd,null));};exports[_0x5be4('0x25')]=function(_0x3481c9,_0xc9ca2f){return db[_0x5be4('0x3e')][_0x5be4('0x48')]({'where':{'id':_0x3481c9[_0x5be4('0x44')]['id']}})[_0x5be4('0x24')](handleEntityNotFound(_0xc9ca2f,null))[_0x5be4('0x24')](removeEntity(_0xc9ca2f,null))[_0x5be4('0x42')](handleError(_0xc9ca2f,null));};exports[_0x5be4('0x49')]=function(_0x5f0999,_0x2caec3){return db['FaxQueueReport'][_0x5be4('0x49')]()[_0x5be4('0x24')](respondWithResult(_0x2caec3,null))[_0x5be4('0x42')](handleError(_0x2caec3,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3461a94..e0ee2a8 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x57397e,_0x56fab7){var _0x7aa5ab=function(_0x475ba7){while(--_0x475ba7){_0x57397e['push'](_0x57397e['shift']());}};_0x7aa5ab(++_0x56fab7);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x1cb9,0x14e));var _0x91cb=function(_0x14658e,_0x3cfaae){_0x14658e=_0x14658e-0x0;var _0x37a465=_0x1cb9[_0x14658e];return _0x37a465;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'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 a6aa5b0..2646e3f 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 _0x6cee=['raw','limit','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateFaxQueueReport','create','body','options','stringify','FaxQueueReport'];(function(_0x1ec836,_0x1ce2d6){var _0x4baf71=function(_0x5b640e){while(--_0x5b640e){_0x1ec836['push'](_0x1ec836['shift']());}};_0x4baf71(++_0x1ce2d6);}(_0x6cee,0xbd));var _0xe6ce=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6cee[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xe6ce('0x0'));var util=require('util');var moment=require(_0xe6ce('0x1'));var BPromise=require(_0xe6ce('0x2'));var rs=require(_0xe6ce('0x3'));var fs=require('fs');var Redis=require(_0xe6ce('0x4'));var db=require(_0xe6ce('0x5'))['db'];var utils=require(_0xe6ce('0x6'));var logger=require(_0xe6ce('0x7'))(_0xe6ce('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe6ce('0x9')][_0xe6ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1663ea,_0x237d58,_0x3011a5){return new BPromise(function(_0x59906a,_0x104bf3){return client[_0xe6ce('0xb')](_0x1663ea,_0x3011a5)[_0xe6ce('0xc')](function(_0x3a0f90){logger['info'](_0xe6ce('0xd'),_0x237d58,_0xe6ce('0xe'));logger[_0xe6ce('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x237d58,_0xe6ce('0xe'),JSON['stringify'](_0x3a0f90));if(_0x3a0f90[_0xe6ce('0x10')]){if(_0x3a0f90[_0xe6ce('0x10')][_0xe6ce('0x11')]===0x1f4){logger[_0xe6ce('0x10')](_0xe6ce('0xd'),_0x237d58,_0x3a0f90[_0xe6ce('0x10')][_0xe6ce('0x12')]);return _0x104bf3(_0x3a0f90['error'][_0xe6ce('0x12')]);}logger[_0xe6ce('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x237d58,_0x3a0f90[_0xe6ce('0x10')][_0xe6ce('0x12')]);return _0x59906a(_0x3a0f90['error'][_0xe6ce('0x12')]);}else{logger[_0xe6ce('0x13')](_0xe6ce('0xd'),_0x237d58,_0xe6ce('0xe'));_0x59906a(_0x3a0f90[_0xe6ce('0x14')][_0xe6ce('0x12')]);}})[_0xe6ce('0x15')](function(_0x512e09){logger[_0xe6ce('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x237d58,_0x512e09);_0x104bf3(_0x512e09);});});}exports[_0xe6ce('0x16')]=function(_0x1d9c71){var _0x3ae980=this;return new Promise(function(_0x1f818a,_0x102482){return db['FaxQueueReport'][_0xe6ce('0x17')](_0x1d9c71[_0xe6ce('0x18')],{'raw':_0x1d9c71[_0xe6ce('0x19')]?_0x1d9c71[_0xe6ce('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe6ce('0xc')](function(_0x5127d1){logger[_0xe6ce('0x13')]('CreateFaxQueueReport',_0x1d9c71);logger['debug'](_0xe6ce('0x16'),_0x1d9c71,JSON[_0xe6ce('0x1a')](_0x5127d1));_0x1f818a(_0x5127d1);})[_0xe6ce('0x15')](function(_0x4f3e97){logger[_0xe6ce('0x10')](_0xe6ce('0x16'),_0x4f3e97[_0xe6ce('0x12')],_0x1d9c71);_0x102482(_0x3ae980[_0xe6ce('0x10')](0x1f4,_0x4f3e97[_0xe6ce('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x119f64){var _0x2c053f=this;return new Promise(function(_0x46f0ee,_0x3bf4ef){return db[_0xe6ce('0x1b')]['update'](_0x119f64[_0xe6ce('0x18')],{'raw':_0x119f64['options']?_0x119f64[_0xe6ce('0x19')][_0xe6ce('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x119f64[_0xe6ce('0x19')]?_0x119f64[_0xe6ce('0x19')]['where']||null:null,'attributes':_0x119f64['options']?_0x119f64[_0xe6ce('0x19')]['attributes']||null:null,'limit':_0x119f64[_0xe6ce('0x19')]?_0x119f64[_0xe6ce('0x19')][_0xe6ce('0x1d')]||null:null})['then'](function(_0x16f926){logger[_0xe6ce('0x13')](_0xe6ce('0x1e'),_0x119f64);logger[_0xe6ce('0xf')](_0xe6ce('0x1e'),_0x119f64,JSON['stringify'](_0x16f926));_0x46f0ee(_0x16f926);})[_0xe6ce('0x15')](function(_0x439a81){logger['error'](_0xe6ce('0x1e'),_0x439a81[_0xe6ce('0x12')],_0x119f64);_0x3bf4ef(_0x2c053f[_0xe6ce('0x10')](0x1f4,_0x439a81[_0xe6ce('0x12')]));});});}; \ No newline at end of file +var _0x53b5=['limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueueReport','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x53b5,0x64));var _0x553b=function(_0x2f361e,_0x5321c4){_0x2f361e=_0x2f361e-0x0;var _0x1d60a4=_0x53b5[_0x2f361e];return _0x1d60a4;};'use strict';var _=require(_0x553b('0x0'));var util=require(_0x553b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x553b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x553b('0x3'))['db'];var utils=require(_0x553b('0x4'));var logger=require(_0x553b('0x5'))(_0x553b('0x6'));var config=require(_0x553b('0x7'));var jayson=require(_0x553b('0x8'));var client=jayson[_0x553b('0x9')][_0x553b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x113a72,_0x5f3c19,_0x31c39f){return new BPromise(function(_0x4b1130,_0x206b48){return client[_0x553b('0xb')](_0x113a72,_0x31c39f)[_0x553b('0xc')](function(_0x3abdbb){logger[_0x553b('0xd')](_0x553b('0xe'),_0x5f3c19,_0x553b('0xf'));logger[_0x553b('0x10')](_0x553b('0x11'),_0x5f3c19,_0x553b('0xf'),JSON[_0x553b('0x12')](_0x3abdbb));if(_0x3abdbb[_0x553b('0x13')]){if(_0x3abdbb['error']['code']===0x1f4){logger['error'](_0x553b('0xe'),_0x5f3c19,_0x3abdbb[_0x553b('0x13')][_0x553b('0x14')]);return _0x206b48(_0x3abdbb[_0x553b('0x13')][_0x553b('0x14')]);}logger[_0x553b('0x13')](_0x553b('0xe'),_0x5f3c19,_0x3abdbb[_0x553b('0x13')][_0x553b('0x14')]);return _0x4b1130(_0x3abdbb[_0x553b('0x13')][_0x553b('0x14')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x5f3c19,_0x553b('0xf'));_0x4b1130(_0x3abdbb[_0x553b('0x15')][_0x553b('0x14')]);}})[_0x553b('0x16')](function(_0x106f17){logger[_0x553b('0x13')](_0x553b('0xe'),_0x5f3c19,_0x106f17);_0x206b48(_0x106f17);});});}exports['CreateFaxQueueReport']=function(_0xf55993){var _0x5ade80=this;return new Promise(function(_0x2ab0e9,_0x21ec1c){return db[_0x553b('0x17')]['create'](_0xf55993[_0x553b('0x18')],{'raw':_0xf55993['options']?_0xf55993[_0x553b('0x19')][_0x553b('0x1a')]===undefined?!![]:![]:!![]})[_0x553b('0xc')](function(_0x13af17){logger[_0x553b('0xd')](_0x553b('0x1b'),_0xf55993);logger[_0x553b('0x10')](_0x553b('0x1b'),_0xf55993,JSON[_0x553b('0x12')](_0x13af17));_0x2ab0e9(_0x13af17);})['catch'](function(_0x288382){logger[_0x553b('0x13')](_0x553b('0x1b'),_0x288382['message'],_0xf55993);_0x21ec1c(_0x5ade80['error'](0x1f4,_0x288382[_0x553b('0x14')]));});});};exports[_0x553b('0x1c')]=function(_0xf82171){var _0x392f4e=this;return new Promise(function(_0x88f510,_0x39bcf6){return db[_0x553b('0x17')][_0x553b('0x1d')](_0xf82171['body'],{'raw':_0xf82171[_0x553b('0x19')]?_0xf82171['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf82171[_0x553b('0x19')]?_0xf82171[_0x553b('0x19')][_0x553b('0x1e')]||null:null,'attributes':_0xf82171[_0x553b('0x19')]?_0xf82171[_0x553b('0x19')][_0x553b('0x1f')]||null:null,'limit':_0xf82171[_0x553b('0x19')]?_0xf82171['options'][_0x553b('0x20')]||null:null})['then'](function(_0x14fbcb){logger[_0x553b('0xd')](_0x553b('0x1c'),_0xf82171);logger['debug']('UpdateFaxQueueReport',_0xf82171,JSON['stringify'](_0x14fbcb));_0x88f510(_0x14fbcb);})[_0x553b('0x16')](function(_0x309186){logger[_0x553b('0x13')](_0x553b('0x1c'),_0x309186['message'],_0xf82171);_0x39bcf6(_0x392f4e[_0x553b('0x13')](0x1f4,_0x309186[_0x553b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 6dbaf08..55cd20a 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 _0x8357=['isAuthenticated','/describe','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','get'];(function(_0xe5fed3,_0x150a3b){var _0x1b4344=function(_0x54cf8e){while(--_0x54cf8e){_0xe5fed3['push'](_0xe5fed3['shift']());}};_0x1b4344(++_0x150a3b);}(_0x8357,0x1ef));var _0x7835=function(_0x26a672,_0x59f5be){_0x26a672=_0x26a672-0x0;var _0x348f43=_0x8357[_0x26a672];return _0x348f43;};'use strict';var multer=require(_0x7835('0x0'));var util=require('util');var path=require(_0x7835('0x1'));var timeout=require(_0x7835('0x2'));var express=require(_0x7835('0x3'));var router=express[_0x7835('0x4')]();var fs_extra=require(_0x7835('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7835('0x6'));var controller=require(_0x7835('0x7'));router[_0x7835('0x8')]('/',auth[_0x7835('0x9')](),controller['index']);router[_0x7835('0x8')](_0x7835('0xa'),auth[_0x7835('0x9')](),controller['describe']);router[_0x7835('0x8')](_0x7835('0xb'),auth[_0x7835('0x9')](),controller['show']);router[_0x7835('0xc')]('/',auth[_0x7835('0x9')](),controller['create']);router[_0x7835('0xd')]('/:id',auth[_0x7835('0x9')](),controller[_0x7835('0xe')]);router[_0x7835('0xf')](_0x7835('0xb'),auth[_0x7835('0x9')](),controller[_0x7835('0x10')]);module[_0x7835('0x11')]=router; \ No newline at end of file +var _0x37c4=['express','fs-extra','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util'];(function(_0x17ffed,_0xf982ce){var _0x21b9ef=function(_0x54b644){while(--_0x54b644){_0x17ffed['push'](_0x17ffed['shift']());}};_0x21b9ef(++_0xf982ce);}(_0x37c4,0x178));var _0x437c=function(_0x560f5c,_0x2c63f1){_0x560f5c=_0x560f5c-0x0;var _0xf88353=_0x37c4[_0x560f5c];return _0xf88353;};'use strict';var multer=require(_0x437c('0x0'));var util=require(_0x437c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x437c('0x2'));var router=express['Router']();var fs_extra=require(_0x437c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x437c('0x4'));var controller=require(_0x437c('0x5'));router[_0x437c('0x6')]('/',auth[_0x437c('0x7')](),controller[_0x437c('0x8')]);router[_0x437c('0x6')](_0x437c('0x9'),auth[_0x437c('0x7')](),controller[_0x437c('0xa')]);router[_0x437c('0x6')](_0x437c('0xb'),auth['isAuthenticated'](),controller[_0x437c('0xc')]);router[_0x437c('0xd')]('/',auth['isAuthenticated'](),controller[_0x437c('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x437c('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x437c('0x10')]);module[_0x437c('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 64ca583..28101a4 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4ab61f,_0x535d7d){var _0x1d4469=function(_0x38172c){while(--_0x38172c){_0x4ab61f['push'](_0x4ab61f['shift']());}};_0x1d4469(++_0x535d7d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x4b84[_0x3f0b30];return _0x2748a5;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3175cc,_0x2aed1c){var _0x232482=function(_0x1a3e39){while(--_0x1a3e39){_0x3175cc['push'](_0x3175cc['shift']());}};_0x232482(++_0x2aed1c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x230822,_0x53f4b7){_0x230822=_0x230822-0x0;var _0x2c42e0=_0xf4eb[_0x230822];return _0x2c42e0;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d92a894..fd4aaec 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 _0xfbbf=['sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xfbbf,0x94));var _0xffbb=function(_0x1aec4a,_0x498e93){_0x1aec4a=_0x1aec4a-0x0;var _0x117ddb=_0xfbbf[_0x1aec4a];return _0x117ddb;};'use strict';var emlformat=require(_0xffbb('0x0'));var rimraf=require(_0xffbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffbb('0x2'));var rp=require(_0xffbb('0x3'));var moment=require('moment');var BPromise=require(_0xffbb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xffbb('0x5'));var sox=require(_0xffbb('0x6'));var csv=require(_0xffbb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffbb('0x8'));var _=require('lodash');var squel=require(_0xffbb('0x9'));var crypto=require(_0xffbb('0xa'));var jsforce=require(_0xffbb('0xb'));var deskjs=require(_0xffbb('0xc'));var toCsv=require(_0xffbb('0x7'));var querystring=require(_0xffbb('0xd'));var Papa=require(_0xffbb('0xe'));var Redis=require(_0xffbb('0xf'));var authService=require(_0xffbb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xffbb('0x11'));var hardwareService=require(_0xffbb('0x12'));var logger=require(_0xffbb('0x13'))(_0xffbb('0x14'));var utils=require(_0xffbb('0x15'));var config=require(_0xffbb('0x16'));var licenseUtil=require(_0xffbb('0x17'));var db=require(_0xffbb('0x18'))['db'];function respondWithStatusCode(_0x2c39ed,_0x308d84){_0x308d84=_0x308d84||0xcc;return function(_0x1c665f){if(_0x1c665f){return _0x2c39ed[_0xffbb('0x19')](_0x308d84);}return _0x2c39ed[_0xffbb('0x1a')](_0x308d84)[_0xffbb('0x1b')]();};}function respondWithResult(_0x49a45a,_0x57d075){_0x57d075=_0x57d075||0xc8;return function(_0x979cbd){if(_0x979cbd){return _0x49a45a[_0xffbb('0x1a')](_0x57d075)[_0xffbb('0x1c')](_0x979cbd);}};}function respondWithFilteredResult(_0x17553f,_0x16debc){return function(_0x5cc028){if(_0x5cc028){var _0x6bb70e=typeof _0x16debc[_0xffbb('0x1d')]===_0xffbb('0x1e')&&typeof _0x16debc[_0xffbb('0x1f')]===_0xffbb('0x1e');var _0x2d187f=_0x5cc028[_0xffbb('0x20')];var _0x297e8d=_0x6bb70e?0x0:_0x16debc[_0xffbb('0x1d')];var _0x3272c1=_0x6bb70e?_0x5cc028[_0xffbb('0x20')]:_0x16debc['offset']+_0x16debc[_0xffbb('0x1f')];var _0x2010d8;if(_0x3272c1>=_0x2d187f){_0x3272c1=_0x2d187f;_0x2010d8=0xc8;}else{_0x2010d8=0xce;}_0x17553f[_0xffbb('0x1a')](_0x2010d8);return _0x17553f[_0xffbb('0x21')](_0xffbb('0x22'),_0x297e8d+'-'+_0x3272c1+'/'+_0x2d187f)[_0xffbb('0x1c')](_0x5cc028);}return null;};}function patchUpdates(_0x46c56c){return function(_0x1c5efc){try{jsonpatch[_0xffbb('0x23')](_0x1c5efc,_0x46c56c,!![]);}catch(_0x41aad9){return BPromise[_0xffbb('0x24')](_0x41aad9);}return _0x1c5efc[_0xffbb('0x25')]();};}function saveUpdates(_0x21447a,_0x5a8a76){return function(_0x1d62bf){if(_0x1d62bf){return _0x1d62bf[_0xffbb('0x26')](_0x21447a)[_0xffbb('0x27')](function(_0x14bd97){return _0x14bd97;});}return null;};}function removeEntity(_0x59aada,_0x54a0a7){return function(_0x161dcb){if(_0x161dcb){return _0x161dcb['destroy']()['then'](function(){_0x59aada['status'](0xcc)[_0xffbb('0x1b')]();});}};}function handleEntityNotFound(_0x4a94bf,_0x44c331){return function(_0x4d8d7d){if(!_0x4d8d7d){_0x4a94bf['sendStatus'](0x194);}return _0x4d8d7d;};}function handleError(_0x1451c3,_0xc32ab2){_0xc32ab2=_0xc32ab2||0x1f4;return function(_0x3cff43){logger[_0xffbb('0x28')](_0x3cff43[_0xffbb('0x29')]);if(_0x3cff43[_0xffbb('0x2a')]){delete _0x3cff43['name'];}_0x1451c3[_0xffbb('0x1a')](_0xc32ab2)[_0xffbb('0x2b')](_0x3cff43);};}exports['index']=function(_0xa69ae,_0x3be910){var _0xb106f0={},_0x205857={},_0x1c97bb={'count':0x0,'rows':[]};var _0x5c0daa=_[_0xffbb('0x2c')](db[_0xffbb('0x2d')][_0xffbb('0x2e')],function(_0x303201){return{'name':_0x303201[_0xffbb('0x2f')],'type':_0x303201['type']['key']};});_0x205857[_0xffbb('0x30')]=_[_0xffbb('0x2c')](_0x5c0daa,'name');_0x205857[_0xffbb('0x31')]=_[_0xffbb('0x32')](_0xa69ae['query']);_0x205857[_0xffbb('0x33')]=_['intersection'](_0x205857[_0xffbb('0x30')],_0x205857[_0xffbb('0x31')]);_0xb106f0[_0xffbb('0x34')]=_[_0xffbb('0x35')](_0x205857['model'],qs[_0xffbb('0x36')](_0xa69ae['query'][_0xffbb('0x36')]));_0xb106f0['attributes']=_0xb106f0[_0xffbb('0x34')][_0xffbb('0x37')]?_0xb106f0['attributes']:_0x205857['model'];if(!_0xa69ae[_0xffbb('0x31')][_0xffbb('0x38')](_0xffbb('0x39'))){_0xb106f0[_0xffbb('0x1f')]=qs[_0xffbb('0x1f')](_0xa69ae[_0xffbb('0x31')][_0xffbb('0x1f')]);_0xb106f0[_0xffbb('0x1d')]=qs[_0xffbb('0x1d')](_0xa69ae[_0xffbb('0x31')][_0xffbb('0x1d')]);}_0xb106f0[_0xffbb('0x3a')]=qs[_0xffbb('0x3b')](_0xa69ae[_0xffbb('0x31')][_0xffbb('0x3b')]);_0xb106f0[_0xffbb('0x3c')]=qs[_0xffbb('0x33')](_[_0xffbb('0x3d')](_0xa69ae[_0xffbb('0x31')],_0x205857[_0xffbb('0x33')]),_0x5c0daa);if(_0xa69ae[_0xffbb('0x31')][_0xffbb('0x3e')]){_0xb106f0[_0xffbb('0x3c')]=_[_0xffbb('0x3f')](_0xb106f0['where'],{'$or':_[_0xffbb('0x2c')](_0x5c0daa,function(_0x344d7d){if(_0x344d7d[_0xffbb('0x40')]!==_0xffbb('0x41')){var _0x5801d8={};_0x5801d8[_0x344d7d[_0xffbb('0x2a')]]={'$like':'%'+_0xa69ae[_0xffbb('0x31')][_0xffbb('0x3e')]+'%'};return _0x5801d8;}})});}_0xb106f0=_['merge']({},_0xb106f0,_0xa69ae[_0xffbb('0x42')]);var _0x53f93d={'where':_0xb106f0[_0xffbb('0x3c')]};return db[_0xffbb('0x2d')]['count'](_0x53f93d)[_0xffbb('0x27')](function(_0x79dccc){_0x1c97bb[_0xffbb('0x20')]=_0x79dccc;if(_0xa69ae[_0xffbb('0x31')][_0xffbb('0x43')]){_0xb106f0[_0xffbb('0x44')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0xb106f0);})[_0xffbb('0x27')](function(_0x1a13da){_0x1c97bb[_0xffbb('0x45')]=_0x1a13da;return _0x1c97bb;})[_0xffbb('0x27')](respondWithFilteredResult(_0x3be910,_0xb106f0))['catch'](handleError(_0x3be910,null));};exports[_0xffbb('0x46')]=function(_0x3dcfd2,_0xd977ba){var _0xa3673d={'raw':!![],'where':{'id':_0x3dcfd2['params']['id']}},_0x558d59={};_0x558d59[_0xffbb('0x30')]=_[_0xffbb('0x32')](db['FaxTransferReport'][_0xffbb('0x2e')]);_0x558d59['query']=_[_0xffbb('0x32')](_0x3dcfd2[_0xffbb('0x31')]);_0x558d59[_0xffbb('0x33')]=_['intersection'](_0x558d59[_0xffbb('0x30')],_0x558d59[_0xffbb('0x31')]);_0xa3673d[_0xffbb('0x34')]=_['intersection'](_0x558d59[_0xffbb('0x30')],qs[_0xffbb('0x36')](_0x3dcfd2['query']['fields']));_0xa3673d[_0xffbb('0x34')]=_0xa3673d[_0xffbb('0x34')][_0xffbb('0x37')]?_0xa3673d[_0xffbb('0x34')]:_0x558d59[_0xffbb('0x30')];if(_0x3dcfd2['query'][_0xffbb('0x43')]){_0xa3673d[_0xffbb('0x44')]=[{'all':!![]}];}_0xa3673d=_[_0xffbb('0x3f')]({},_0xa3673d,_0x3dcfd2[_0xffbb('0x42')]);return db[_0xffbb('0x2d')][_0xffbb('0x47')](_0xa3673d)[_0xffbb('0x27')](handleEntityNotFound(_0xd977ba,null))[_0xffbb('0x27')](respondWithResult(_0xd977ba,null))[_0xffbb('0x48')](handleError(_0xd977ba,null));};exports[_0xffbb('0x49')]=function(_0x96b619,_0x223559){return db[_0xffbb('0x2d')][_0xffbb('0x49')](_0x96b619[_0xffbb('0x4a')],{})[_0xffbb('0x27')](respondWithResult(_0x223559,0xc9))[_0xffbb('0x48')](handleError(_0x223559,null));};exports[_0xffbb('0x26')]=function(_0x3de429,_0x399993){if(_0x3de429[_0xffbb('0x4a')]['id']){delete _0x3de429['body']['id'];}return db[_0xffbb('0x2d')][_0xffbb('0x47')]({'where':{'id':_0x3de429[_0xffbb('0x4b')]['id']}})[_0xffbb('0x27')](handleEntityNotFound(_0x399993,null))[_0xffbb('0x27')](saveUpdates(_0x3de429['body'],null))[_0xffbb('0x27')](respondWithResult(_0x399993,null))[_0xffbb('0x48')](handleError(_0x399993,null));};exports['destroy']=function(_0x1182df,_0x793f4b){return db[_0xffbb('0x2d')][_0xffbb('0x47')]({'where':{'id':_0x1182df[_0xffbb('0x4b')]['id']}})[_0xffbb('0x27')](handleEntityNotFound(_0x793f4b,null))[_0xffbb('0x27')](removeEntity(_0x793f4b,null))[_0xffbb('0x48')](handleError(_0x793f4b,null));};exports[_0xffbb('0x4c')]=function(_0x8cc16c,_0x438bfc){return db[_0xffbb('0x2d')][_0xffbb('0x4c')]()[_0xffbb('0x27')](respondWithResult(_0x438bfc,null))[_0xffbb('0x48')](handleError(_0x438bfc,null));}; \ No newline at end of file +var _0x69d8=['filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x69d8,0x1ea));var _0x869d=function(_0x3222ad,_0x2df6b3){_0x3222ad=_0x3222ad-0x0;var _0x69314b=_0x69d8[_0x3222ad];return _0x69314b;};'use strict';var emlformat=require(_0x869d('0x0'));var rimraf=require(_0x869d('0x1'));var zipdir=require(_0x869d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x869d('0x3'));var moment=require(_0x869d('0x4'));var BPromise=require(_0x869d('0x5'));var Mustache=require(_0x869d('0x6'));var util=require('util');var path=require(_0x869d('0x7'));var sox=require('sox');var csv=require(_0x869d('0x8'));var ejs=require(_0x869d('0x9'));var fs=require('fs');var fs_extra=require(_0x869d('0xa'));var _=require('lodash');var squel=require(_0x869d('0xb'));var crypto=require('crypto');var jsforce=require(_0x869d('0xc'));var deskjs=require(_0x869d('0xd'));var toCsv=require(_0x869d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x869d('0xe'));var qs=require(_0x869d('0xf'));var as=require(_0x869d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x869d('0x11'))('api');var utils=require(_0x869d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x869d('0x13'))['db'];function respondWithStatusCode(_0x5119a9,_0x513c13){_0x513c13=_0x513c13||0xcc;return function(_0x430358){if(_0x430358){return _0x5119a9[_0x869d('0x14')](_0x513c13);}return _0x5119a9['status'](_0x513c13)[_0x869d('0x15')]();};}function respondWithResult(_0x23ad9c,_0x3b62ef){_0x3b62ef=_0x3b62ef||0xc8;return function(_0x5cef09){if(_0x5cef09){return _0x23ad9c[_0x869d('0x16')](_0x3b62ef)[_0x869d('0x17')](_0x5cef09);}};}function respondWithFilteredResult(_0x3053c9,_0x3f191e){return function(_0xe1ea94){if(_0xe1ea94){var _0x19ae17=typeof _0x3f191e[_0x869d('0x18')]===_0x869d('0x19')&&typeof _0x3f191e[_0x869d('0x1a')]===_0x869d('0x19');var _0x10129e=_0xe1ea94[_0x869d('0x1b')];var _0x56f5e2=_0x19ae17?0x0:_0x3f191e[_0x869d('0x18')];var _0x40cfbc=_0x19ae17?_0xe1ea94['count']:_0x3f191e[_0x869d('0x18')]+_0x3f191e[_0x869d('0x1a')];var _0x3ad8b8;if(_0x40cfbc>=_0x10129e){_0x40cfbc=_0x10129e;_0x3ad8b8=0xc8;}else{_0x3ad8b8=0xce;}_0x3053c9[_0x869d('0x16')](_0x3ad8b8);return _0x3053c9['set'](_0x869d('0x1c'),_0x56f5e2+'-'+_0x40cfbc+'/'+_0x10129e)[_0x869d('0x17')](_0xe1ea94);}return null;};}function patchUpdates(_0xfd175){return function(_0x203b6f){try{jsonpatch['apply'](_0x203b6f,_0xfd175,!![]);}catch(_0x2a4635){return BPromise[_0x869d('0x1d')](_0x2a4635);}return _0x203b6f[_0x869d('0x1e')]();};}function saveUpdates(_0x55f7c2,_0x415a00){return function(_0x153497){if(_0x153497){return _0x153497[_0x869d('0x1f')](_0x55f7c2)[_0x869d('0x20')](function(_0xc85b87){return _0xc85b87;});}return null;};}function removeEntity(_0x46b444,_0x497f63){return function(_0x1cd45c){if(_0x1cd45c){return _0x1cd45c['destroy']()['then'](function(){_0x46b444[_0x869d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525d27,_0x16f1ac){return function(_0x475e59){if(!_0x475e59){_0x525d27[_0x869d('0x14')](0x194);}return _0x475e59;};}function handleError(_0x2f16e9,_0x20b1ff){_0x20b1ff=_0x20b1ff||0x1f4;return function(_0x384fdb){logger[_0x869d('0x21')](_0x384fdb['stack']);if(_0x384fdb['name']){delete _0x384fdb[_0x869d('0x22')];}_0x2f16e9[_0x869d('0x16')](_0x20b1ff)[_0x869d('0x23')](_0x384fdb);};}exports['index']=function(_0x1ebb18,_0x3d666a){var _0x129704={},_0x17c714={},_0x51996e={'count':0x0,'rows':[]};var _0x51ae25=_[_0x869d('0x24')](db[_0x869d('0x25')][_0x869d('0x26')],function(_0x3770bd){return{'name':_0x3770bd[_0x869d('0x27')],'type':_0x3770bd[_0x869d('0x28')]['key']};});_0x17c714[_0x869d('0x29')]=_[_0x869d('0x24')](_0x51ae25,'name');_0x17c714[_0x869d('0x2a')]=_[_0x869d('0x2b')](_0x1ebb18[_0x869d('0x2a')]);_0x17c714['filters']=_[_0x869d('0x2c')](_0x17c714[_0x869d('0x29')],_0x17c714[_0x869d('0x2a')]);_0x129704[_0x869d('0x2d')]=_['intersection'](_0x17c714[_0x869d('0x29')],qs[_0x869d('0x2e')](_0x1ebb18[_0x869d('0x2a')]['fields']));_0x129704[_0x869d('0x2d')]=_0x129704['attributes'][_0x869d('0x2f')]?_0x129704[_0x869d('0x2d')]:_0x17c714[_0x869d('0x29')];if(!_0x1ebb18[_0x869d('0x2a')]['hasOwnProperty']('nolimit')){_0x129704[_0x869d('0x1a')]=qs['limit'](_0x1ebb18[_0x869d('0x2a')]['limit']);_0x129704['offset']=qs['offset'](_0x1ebb18['query'][_0x869d('0x18')]);}_0x129704[_0x869d('0x30')]=qs[_0x869d('0x31')](_0x1ebb18[_0x869d('0x2a')][_0x869d('0x31')]);_0x129704[_0x869d('0x32')]=qs[_0x869d('0x33')](_[_0x869d('0x34')](_0x1ebb18['query'],_0x17c714[_0x869d('0x33')]),_0x51ae25);if(_0x1ebb18[_0x869d('0x2a')]['filter']){_0x129704['where']=_[_0x869d('0x35')](_0x129704[_0x869d('0x32')],{'$or':_['map'](_0x51ae25,function(_0x4e70ff){if(_0x4e70ff[_0x869d('0x28')]!=='VIRTUAL'){var _0x19ab0e={};_0x19ab0e[_0x4e70ff[_0x869d('0x22')]]={'$like':'%'+_0x1ebb18[_0x869d('0x2a')][_0x869d('0x36')]+'%'};return _0x19ab0e;}})});}_0x129704=_['merge']({},_0x129704,_0x1ebb18[_0x869d('0x37')]);var _0xf58d73={'where':_0x129704[_0x869d('0x32')]};return db[_0x869d('0x25')]['count'](_0xf58d73)['then'](function(_0x5663e1){_0x51996e['count']=_0x5663e1;if(_0x1ebb18[_0x869d('0x2a')][_0x869d('0x38')]){_0x129704['include']=[{'all':!![]}];}return db[_0x869d('0x25')][_0x869d('0x39')](_0x129704);})[_0x869d('0x20')](function(_0x21dfef){_0x51996e[_0x869d('0x3a')]=_0x21dfef;return _0x51996e;})[_0x869d('0x20')](respondWithFilteredResult(_0x3d666a,_0x129704))[_0x869d('0x3b')](handleError(_0x3d666a,null));};exports[_0x869d('0x3c')]=function(_0x22ccc9,_0x612555){var _0x96fbfd={'raw':!![],'where':{'id':_0x22ccc9[_0x869d('0x3d')]['id']}},_0x43886a={};_0x43886a[_0x869d('0x29')]=_[_0x869d('0x2b')](db[_0x869d('0x25')]['rawAttributes']);_0x43886a[_0x869d('0x2a')]=_[_0x869d('0x2b')](_0x22ccc9[_0x869d('0x2a')]);_0x43886a['filters']=_['intersection'](_0x43886a['model'],_0x43886a[_0x869d('0x2a')]);_0x96fbfd['attributes']=_[_0x869d('0x2c')](_0x43886a[_0x869d('0x29')],qs['fields'](_0x22ccc9[_0x869d('0x2a')][_0x869d('0x2e')]));_0x96fbfd[_0x869d('0x2d')]=_0x96fbfd[_0x869d('0x2d')][_0x869d('0x2f')]?_0x96fbfd[_0x869d('0x2d')]:_0x43886a['model'];if(_0x22ccc9[_0x869d('0x2a')][_0x869d('0x38')]){_0x96fbfd[_0x869d('0x3e')]=[{'all':!![]}];}_0x96fbfd=_[_0x869d('0x35')]({},_0x96fbfd,_0x22ccc9[_0x869d('0x37')]);return db[_0x869d('0x25')][_0x869d('0x3f')](_0x96fbfd)[_0x869d('0x20')](handleEntityNotFound(_0x612555,null))['then'](respondWithResult(_0x612555,null))[_0x869d('0x3b')](handleError(_0x612555,null));};exports['create']=function(_0x222bf5,_0x166d92){return db['FaxTransferReport'][_0x869d('0x40')](_0x222bf5['body'],{})[_0x869d('0x20')](respondWithResult(_0x166d92,0xc9))['catch'](handleError(_0x166d92,null));};exports['update']=function(_0x3b8dc1,_0x10a859){if(_0x3b8dc1[_0x869d('0x41')]['id']){delete _0x3b8dc1['body']['id'];}return db[_0x869d('0x25')]['find']({'where':{'id':_0x3b8dc1[_0x869d('0x3d')]['id']}})[_0x869d('0x20')](handleEntityNotFound(_0x10a859,null))[_0x869d('0x20')](saveUpdates(_0x3b8dc1['body'],null))[_0x869d('0x20')](respondWithResult(_0x10a859,null))[_0x869d('0x3b')](handleError(_0x10a859,null));};exports[_0x869d('0x42')]=function(_0x229f51,_0x51c850){return db[_0x869d('0x25')]['find']({'where':{'id':_0x229f51[_0x869d('0x3d')]['id']}})[_0x869d('0x20')](handleEntityNotFound(_0x51c850,null))[_0x869d('0x20')](removeEntity(_0x51c850,null))[_0x869d('0x3b')](handleError(_0x51c850,null));};exports[_0x869d('0x43')]=function(_0x3d49e1,_0x441969){return db[_0x869d('0x25')]['describe']()[_0x869d('0x20')](respondWithResult(_0x441969,null))[_0x869d('0x3b')](handleError(_0x441969,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 6958401..690a6ab 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 _0xf41a=['path','exports','define','FaxTransferReport','lodash','util','../../config/logger','request-promise'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xf41a,0x1d4));var _0xaf41=function(_0x102402,_0x4eaaf8){_0x102402=_0x102402-0x0;var _0x321b44=_0xf41a[_0x102402];return _0x321b44;};'use strict';var _=require(_0xaf41('0x0'));var util=require(_0xaf41('0x1'));var logger=require(_0xaf41('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaf41('0x3'));var fs=require('fs');var path=require(_0xaf41('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xaf41('0x5')]=function(_0x4a9510,_0x2a8776){return _0x4a9510[_0xaf41('0x6')](_0xaf41('0x7'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0276=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger'];(function(_0x584e87,_0x693b2d){var _0x298e6e=function(_0x1f9a89){while(--_0x1f9a89){_0x584e87['push'](_0x584e87['shift']());}};_0x298e6e(++_0x693b2d);}(_0x0276,0x15c));var _0x6027=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x0276[_0x545a3a];return _0x5a5493;};'use strict';var _=require(_0x6027('0x0'));var util=require('util');var logger=require(_0x6027('0x1'))(_0x6027('0x2'));var moment=require(_0x6027('0x3'));var BPromise=require(_0x6027('0x4'));var rp=require(_0x6027('0x5'));var fs=require('fs');var path=require(_0x6027('0x6'));var rimraf=require(_0x6027('0x7'));var config=require(_0x6027('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x6027('0x9')]=function(_0x5b0bff,_0x329802){return _0x5b0bff[_0x6027('0xa')](_0x6027('0xb'),attributes,{'tableName':_0x6027('0xc'),'paranoid':![],'indexes':[{'name':_0x6027('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 86f63b2..58096d0 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 _0xda12=['debug','stringify','error','code','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0xda12,0x181));var _0x2da1=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xda12[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x2da1('0x0'));var util=require(_0x2da1('0x1'));var moment=require(_0x2da1('0x2'));var BPromise=require('bluebird');var rs=require(_0x2da1('0x3'));var fs=require('fs');var Redis=require(_0x2da1('0x4'));var db=require(_0x2da1('0x5'))['db'];var utils=require(_0x2da1('0x6'));var logger=require('../../config/logger')(_0x2da1('0x7'));var config=require(_0x2da1('0x8'));var jayson=require(_0x2da1('0x9'));var client=jayson['client'][_0x2da1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c31aa,_0x482ef6,_0x441d66){return new BPromise(function(_0x253eb1,_0x53f5e3){return client[_0x2da1('0xb')](_0x1c31aa,_0x441d66)['then'](function(_0x317019){logger[_0x2da1('0xc')](_0x2da1('0xd'),_0x482ef6,'request\x20sent');logger[_0x2da1('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x482ef6,'request\x20sent',JSON[_0x2da1('0xf')](_0x317019));if(_0x317019['error']){if(_0x317019[_0x2da1('0x10')][_0x2da1('0x11')]===0x1f4){logger[_0x2da1('0x10')](_0x2da1('0xd'),_0x482ef6,_0x317019[_0x2da1('0x10')][_0x2da1('0x12')]);return _0x53f5e3(_0x317019[_0x2da1('0x10')]['message']);}logger['error'](_0x2da1('0xd'),_0x482ef6,_0x317019[_0x2da1('0x10')][_0x2da1('0x12')]);return _0x253eb1(_0x317019['error']['message']);}else{logger[_0x2da1('0xc')](_0x2da1('0xd'),_0x482ef6,_0x2da1('0x13'));_0x253eb1(_0x317019[_0x2da1('0x14')][_0x2da1('0x12')]);}})['catch'](function(_0x4c1d62){logger[_0x2da1('0x10')](_0x2da1('0xd'),_0x482ef6,_0x4c1d62);_0x53f5e3(_0x4c1d62);});});} \ No newline at end of file +var _0x51d9=['then','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x329808,_0x343255){var _0x1bbad0=function(_0x458c5b){while(--_0x458c5b){_0x329808['push'](_0x329808['shift']());}};_0x1bbad0(++_0x343255);}(_0x51d9,0x113));var _0x951d=function(_0x5c7a4b,_0x4237b0){_0x5c7a4b=_0x5c7a4b-0x0;var _0x3b1115=_0x51d9[_0x5c7a4b];return _0x3b1115;};'use strict';var _=require(_0x951d('0x0'));var util=require(_0x951d('0x1'));var moment=require(_0x951d('0x2'));var BPromise=require('bluebird');var rs=require(_0x951d('0x3'));var fs=require('fs');var Redis=require(_0x951d('0x4'));var db=require(_0x951d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x951d('0x6'))(_0x951d('0x7'));var config=require(_0x951d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x951d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d217f,_0x49f575,_0x4d9ca3){return new BPromise(function(_0x5d59fd,_0xdcdcdd){return client['request'](_0x2d217f,_0x4d9ca3)[_0x951d('0xa')](function(_0x1ee3dc){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x49f575,_0x951d('0xb'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x49f575,_0x951d('0xb'),JSON[_0x951d('0xc')](_0x1ee3dc));if(_0x1ee3dc[_0x951d('0xd')]){if(_0x1ee3dc['error'][_0x951d('0xe')]===0x1f4){logger[_0x951d('0xd')](_0x951d('0xf'),_0x49f575,_0x1ee3dc[_0x951d('0xd')]['message']);return _0xdcdcdd(_0x1ee3dc[_0x951d('0xd')][_0x951d('0x10')]);}logger[_0x951d('0xd')](_0x951d('0xf'),_0x49f575,_0x1ee3dc[_0x951d('0xd')][_0x951d('0x10')]);return _0x5d59fd(_0x1ee3dc[_0x951d('0xd')]['message']);}else{logger['info'](_0x951d('0xf'),_0x49f575,'request\x20sent');_0x5d59fd(_0x1ee3dc[_0x951d('0x11')][_0x951d('0x10')]);}})[_0x951d('0x12')](function(_0x4c8cf6){logger['error'](_0x951d('0xf'),_0x49f575,_0x4c8cf6);_0xdcdcdd(_0x4c8cf6);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 51b4157..440223e 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 _0x3b13=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x13851b,_0x17f043){var _0x5effec=function(_0x107a09){while(--_0x107a09){_0x13851b['push'](_0x13851b['shift']());}};_0x5effec(++_0x17f043);}(_0x3b13,0x72));var _0x33b1=function(_0x61b4c7,_0xf6eafa){_0x61b4c7=_0x61b4c7-0x0;var _0x5f57a1=_0x3b13[_0x61b4c7];return _0x5f57a1;};'use strict';var multer=require(_0x33b1('0x0'));var util=require(_0x33b1('0x1'));var path=require(_0x33b1('0x2'));var timeout=require(_0x33b1('0x3'));var express=require(_0x33b1('0x4'));var router=express['Router']();var fs_extra=require(_0x33b1('0x5'));var auth=require(_0x33b1('0x6'));var interaction=require(_0x33b1('0x7'));var config=require(_0x33b1('0x8'));var controller=require(_0x33b1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x33b1('0xa')]);router[_0x33b1('0xb')](_0x33b1('0xc'),auth['isAuthenticated'](),controller[_0x33b1('0xd')]);router[_0x33b1('0xb')](_0x33b1('0xe'),auth[_0x33b1('0xf')](),controller[_0x33b1('0x10')]);router[_0x33b1('0x11')]('/',auth[_0x33b1('0xf')](),controller[_0x33b1('0x12')]);router[_0x33b1('0x13')](_0x33b1('0xe'),auth[_0x33b1('0xf')](),controller[_0x33b1('0x14')]);router[_0x33b1('0x15')](_0x33b1('0xe'),auth['isAuthenticated'](),controller[_0x33b1('0x16')]);module[_0x33b1('0x17')]=router; \ No newline at end of file +var _0x57e6=['./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4cea15,_0x50df10){var _0x3e8c3d=function(_0x4d912f){while(--_0x4d912f){_0x4cea15['push'](_0x4cea15['shift']());}};_0x3e8c3d(++_0x50df10);}(_0x57e6,0x76));var _0x657e=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x57e6[_0x3cf053];return _0x3b55a0;};'use strict';var multer=require(_0x657e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x657e('0x1'));var express=require(_0x657e('0x2'));var router=express[_0x657e('0x3')]();var fs_extra=require(_0x657e('0x4'));var auth=require(_0x657e('0x5'));var interaction=require(_0x657e('0x6'));var config=require(_0x657e('0x7'));var controller=require(_0x657e('0x8'));router[_0x657e('0x9')]('/',auth[_0x657e('0xa')](),controller[_0x657e('0xb')]);router[_0x657e('0x9')](_0x657e('0xc'),auth[_0x657e('0xa')](),controller[_0x657e('0xd')]);router[_0x657e('0x9')](_0x657e('0xe'),auth[_0x657e('0xa')](),controller[_0x657e('0xf')]);router[_0x657e('0x10')]('/',auth['isAuthenticated'](),controller[_0x657e('0x11')]);router[_0x657e('0x12')](_0x657e('0xe'),auth['isAuthenticated'](),controller[_0x657e('0x13')]);router['delete'](_0x657e('0xe'),auth[_0x657e('0xa')](),controller['destroy']);module[_0x657e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d67e5f1..723117f 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 _0x4711=['express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update','delete','destroy','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4711,0x10f));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1471('0x0'));var util=require(_0x1471('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1471('0x2'));var router=express['Router']();var fs_extra=require(_0x1471('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1471('0x4'));var config=require(_0x1471('0x5'));var controller=require(_0x1471('0x6'));router[_0x1471('0x7')]('/',auth[_0x1471('0x8')](),controller[_0x1471('0x9')]);router[_0x1471('0x7')]('/:id',auth[_0x1471('0x8')](),controller[_0x1471('0xa')]);router[_0x1471('0x7')](_0x1471('0xb'),auth[_0x1471('0x8')](),controller[_0x1471('0xc')]);router[_0x1471('0x7')](_0x1471('0xd'),auth[_0x1471('0x8')](),controller[_0x1471('0xe')]);router[_0x1471('0xf')]('/',auth[_0x1471('0x8')](),controller['create']);router[_0x1471('0xf')](_0x1471('0xb'),auth[_0x1471('0x8')](),controller[_0x1471('0x10')]);router['put'](_0x1471('0x11'),auth[_0x1471('0x8')](),controller[_0x1471('0x12')]);router[_0x1471('0x13')](_0x1471('0x11'),auth[_0x1471('0x8')](),controller[_0x1471('0x14')]);module['exports']=router; \ No newline at end of file +var _0x472c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x39f73b,_0x46435d){var _0x17fb32=function(_0x386012){while(--_0x386012){_0x39f73b['push'](_0x39f73b['shift']());}};_0x17fb32(++_0x46435d);}(_0x472c,0xd9));var _0xc472=function(_0x2ba3d9,_0xf3bb5){_0x2ba3d9=_0x2ba3d9-0x0;var _0x50ba16=_0x472c[_0x2ba3d9];return _0x50ba16;};'use strict';var multer=require(_0xc472('0x0'));var util=require(_0xc472('0x1'));var path=require('path');var timeout=require(_0xc472('0x2'));var express=require(_0xc472('0x3'));var router=express['Router']();var fs_extra=require(_0xc472('0x4'));var auth=require(_0xc472('0x5'));var interaction=require(_0xc472('0x6'));var config=require(_0xc472('0x7'));var controller=require(_0xc472('0x8'));router[_0xc472('0x9')]('/',auth[_0xc472('0xa')](),controller['index']);router['get'](_0xc472('0xb'),auth[_0xc472('0xa')](),controller['show']);router['get'](_0xc472('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc472('0x9')](_0xc472('0xd'),auth[_0xc472('0xa')](),controller[_0xc472('0xe')]);router[_0xc472('0xf')]('/',auth[_0xc472('0xa')](),controller[_0xc472('0x10')]);router[_0xc472('0xf')]('/:id/configurations',auth[_0xc472('0xa')](),controller[_0xc472('0x11')]);router[_0xc472('0x12')](_0xc472('0xb'),auth['isAuthenticated'](),controller[_0xc472('0x13')]);router[_0xc472('0x14')](_0xc472('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xc472('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index cad0f07..f07ab4d 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 _0x7eef=['ENUM','newTab','sequelize','exports','STRING','basic'];(function(_0x361d56,_0x184599){var _0x2a16c6=function(_0x70982f){while(--_0x70982f){_0x361d56['push'](_0x361d56['shift']());}};_0x2a16c6(++_0x184599);}(_0x7eef,0xf8));var _0xf7ee=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0x7eef[_0x49f67f];return _0x4779a1;};'use strict';var Sequelize=require(_0xf7ee('0x0'));module[_0xf7ee('0x1')]={'name':{'type':Sequelize[_0xf7ee('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf7ee('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xf7ee('0x3')),'defaultValue':_0xf7ee('0x3')},'password':{'type':Sequelize[_0xf7ee('0x2')]},'consumerKey':{'type':Sequelize[_0xf7ee('0x2')]},'consumerSecret':{'type':Sequelize[_0xf7ee('0x2')]},'token':{'type':Sequelize[_0xf7ee('0x2')]},'tokenSecret':{'type':Sequelize[_0xf7ee('0x2')]},'serverUrl':{'type':Sequelize[_0xf7ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf7ee('0x4')]('integrationTab',_0xf7ee('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x1b1b=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x5b71a2,_0x541cee){var _0x22e1b6=function(_0x415448){while(--_0x415448){_0x5b71a2['push'](_0x5b71a2['shift']());}};_0x22e1b6(++_0x541cee);}(_0x1b1b,0xe6));var _0xb1b1=function(_0x28ea86,_0x7402c6){_0x28ea86=_0x28ea86-0x0;var _0x25a519=_0x1b1b[_0x28ea86];return _0x25a519;};'use strict';var Sequelize=require('sequelize');module[_0xb1b1('0x0')]={'name':{'type':Sequelize[_0xb1b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb1b1('0x1')]},'remoteUri':{'type':Sequelize[_0xb1b1('0x1')]},'authType':{'type':Sequelize[_0xb1b1('0x2')]('basic'),'defaultValue':_0xb1b1('0x3')},'password':{'type':Sequelize[_0xb1b1('0x1')]},'consumerKey':{'type':Sequelize[_0xb1b1('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xb1b1('0x1')]},'serverUrl':{'type':Sequelize[_0xb1b1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb1b1('0x2')](_0xb1b1('0x4'),_0xb1b1('0x5')),'defaultValue':_0xb1b1('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1b87222..3c6636f 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 _0x41e0=['getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','toString','concat','_embedded','active','label','test','stringify','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','send','map','DeskAccount','type','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','rawAttributes','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x41e0,0xf7));var _0x041e=function(_0x210d96,_0x271805){_0x210d96=_0x210d96-0x0;var _0x3f3a42=_0x41e0[_0x210d96];return _0x3f3a42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x041e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x041e('0x1'));var rp=require(_0x041e('0x2'));var moment=require('moment');var BPromise=require(_0x041e('0x3'));var Mustache=require(_0x041e('0x4'));var util=require('util');var path=require(_0x041e('0x5'));var sox=require(_0x041e('0x6'));var csv=require(_0x041e('0x7'));var ejs=require(_0x041e('0x8'));var fs=require('fs');var fs_extra=require(_0x041e('0x9'));var _=require(_0x041e('0xa'));var squel=require(_0x041e('0xb'));var crypto=require(_0x041e('0xc'));var jsforce=require(_0x041e('0xd'));var deskjs=require(_0x041e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x041e('0xf'));var Papa=require('papaparse');var Redis=require(_0x041e('0x10'));var authService=require(_0x041e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x041e('0x12'));var hardwareService=require(_0x041e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x041e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x041e('0x15'));var db=require(_0x041e('0x16'))['db'];var integrations=require(_0x041e('0x17'));function respondWithStatusCode(_0x246284,_0x31e024){_0x31e024=_0x31e024||0xcc;return function(_0xfd52fe){if(_0xfd52fe){return _0x246284[_0x041e('0x18')](_0x31e024);}return _0x246284[_0x041e('0x19')](_0x31e024)['end']();};}function respondWithResult(_0x325089,_0x5cbdf8){_0x5cbdf8=_0x5cbdf8||0xc8;return function(_0xce5910){if(_0xce5910){return _0x325089[_0x041e('0x19')](_0x5cbdf8)['json'](_0xce5910);}};}function respondWithFilteredResult(_0x726832,_0xb40423){return function(_0x8066d9){if(_0x8066d9){var _0x142cd6=typeof _0xb40423[_0x041e('0x1a')]===_0x041e('0x1b')&&typeof _0xb40423[_0x041e('0x1c')]===_0x041e('0x1b');var _0x3063a9=_0x8066d9[_0x041e('0x1d')];var _0x20dbbb=_0x142cd6?0x0:_0xb40423[_0x041e('0x1a')];var _0xb7298d=_0x142cd6?_0x8066d9[_0x041e('0x1d')]:_0xb40423['offset']+_0xb40423[_0x041e('0x1c')];var _0x33b6e5;if(_0xb7298d>=_0x3063a9){_0xb7298d=_0x3063a9;_0x33b6e5=0xc8;}else{_0x33b6e5=0xce;}_0x726832[_0x041e('0x19')](_0x33b6e5);return _0x726832[_0x041e('0x1e')](_0x041e('0x1f'),_0x20dbbb+'-'+_0xb7298d+'/'+_0x3063a9)[_0x041e('0x20')](_0x8066d9);}return null;};}function patchUpdates(_0x2bcbe0){return function(_0x223ff1){try{jsonpatch[_0x041e('0x21')](_0x223ff1,_0x2bcbe0,!![]);}catch(_0x326d27){return BPromise[_0x041e('0x22')](_0x326d27);}return _0x223ff1[_0x041e('0x23')]();};}function saveUpdates(_0x10b215,_0x12cc9d){return function(_0x23b22b){if(_0x23b22b){return _0x23b22b[_0x041e('0x24')](_0x10b215)[_0x041e('0x25')](function(_0x24085c){return _0x24085c;});}return null;};}function removeEntity(_0x586a63,_0x22bd5b){return function(_0x3d1a38){if(_0x3d1a38){return _0x3d1a38['destroy']()[_0x041e('0x25')](function(){_0x586a63[_0x041e('0x19')](0xcc)[_0x041e('0x26')]();});}};}function handleEntityNotFound(_0x437afa,_0x3082d8){return function(_0xc2e661){if(!_0xc2e661){_0x437afa[_0x041e('0x18')](0x194);}return _0xc2e661;};}function handleError(_0x1cb15f,_0xe7b397){_0xe7b397=_0xe7b397||0x1f4;return function(_0x33560){logger[_0x041e('0x27')](_0x33560[_0x041e('0x28')]);if(_0x33560['name']){delete _0x33560['name'];}_0x1cb15f[_0x041e('0x19')](_0xe7b397)[_0x041e('0x29')](_0x33560);};}exports['index']=function(_0x38d486,_0x115327){var _0x4bfac6={},_0x276219={},_0x5e1fb7={'count':0x0,'rows':[]};var _0x2b79de=_[_0x041e('0x2a')](db[_0x041e('0x2b')]['rawAttributes'],function(_0x11ced5){return{'name':_0x11ced5['fieldName'],'type':_0x11ced5[_0x041e('0x2c')][_0x041e('0x2d')]};});_0x276219[_0x041e('0x2e')]=_[_0x041e('0x2a')](_0x2b79de,_0x041e('0x2f'));_0x276219[_0x041e('0x30')]=_[_0x041e('0x31')](_0x38d486[_0x041e('0x30')]);_0x276219['filters']=_['intersection'](_0x276219[_0x041e('0x2e')],_0x276219[_0x041e('0x30')]);_0x4bfac6[_0x041e('0x32')]=_[_0x041e('0x33')](_0x276219[_0x041e('0x2e')],qs[_0x041e('0x34')](_0x38d486[_0x041e('0x30')][_0x041e('0x34')]));_0x4bfac6['attributes']=_0x4bfac6[_0x041e('0x32')][_0x041e('0x35')]?_0x4bfac6[_0x041e('0x32')]:_0x276219[_0x041e('0x2e')];if(!_0x38d486[_0x041e('0x30')][_0x041e('0x36')]('nolimit')){_0x4bfac6[_0x041e('0x1c')]=qs['limit'](_0x38d486[_0x041e('0x30')]['limit']);_0x4bfac6[_0x041e('0x1a')]=qs['offset'](_0x38d486['query'][_0x041e('0x1a')]);}_0x4bfac6[_0x041e('0x37')]=qs[_0x041e('0x38')](_0x38d486[_0x041e('0x30')][_0x041e('0x38')]);_0x4bfac6[_0x041e('0x39')]=qs[_0x041e('0x3a')](_[_0x041e('0x3b')](_0x38d486[_0x041e('0x30')],_0x276219[_0x041e('0x3a')]),_0x2b79de);if(_0x38d486['query'][_0x041e('0x3c')]){_0x4bfac6['where']=_[_0x041e('0x3d')](_0x4bfac6[_0x041e('0x39')],{'$or':_[_0x041e('0x2a')](_0x2b79de,function(_0x5d41d3){if(_0x5d41d3[_0x041e('0x2c')]!=='VIRTUAL'){var _0x4f24fe={};_0x4f24fe[_0x5d41d3[_0x041e('0x2f')]]={'$like':'%'+_0x38d486[_0x041e('0x30')][_0x041e('0x3c')]+'%'};return _0x4f24fe;}})});}_0x4bfac6=_[_0x041e('0x3d')]({},_0x4bfac6,_0x38d486[_0x041e('0x3e')]);var _0xbe3b57={'where':_0x4bfac6[_0x041e('0x39')]};return db[_0x041e('0x2b')][_0x041e('0x1d')](_0xbe3b57)[_0x041e('0x25')](function(_0x30e49a){_0x5e1fb7[_0x041e('0x1d')]=_0x30e49a;if(_0x38d486[_0x041e('0x30')][_0x041e('0x3f')]){_0x4bfac6[_0x041e('0x40')]=[{'all':!![]}];}return db[_0x041e('0x2b')]['findAll'](_0x4bfac6);})[_0x041e('0x25')](function(_0x2c0568){_0x5e1fb7[_0x041e('0x41')]=_0x2c0568;return _0x5e1fb7;})[_0x041e('0x25')](respondWithFilteredResult(_0x115327,_0x4bfac6))[_0x041e('0x42')](handleError(_0x115327,null));};exports[_0x041e('0x43')]=function(_0x10ad73,_0x1e1a10){var _0x313e5d={'raw':![],'where':{'id':_0x10ad73[_0x041e('0x44')]['id']}},_0x3acabb={};_0x3acabb[_0x041e('0x2e')]=_[_0x041e('0x31')](db[_0x041e('0x2b')]['rawAttributes']);_0x3acabb[_0x041e('0x30')]=_[_0x041e('0x31')](_0x10ad73[_0x041e('0x30')]);_0x3acabb[_0x041e('0x3a')]=_[_0x041e('0x33')](_0x3acabb['model'],_0x3acabb['query']);_0x313e5d[_0x041e('0x32')]=_[_0x041e('0x33')](_0x3acabb['model'],qs[_0x041e('0x34')](_0x10ad73[_0x041e('0x30')][_0x041e('0x34')]));_0x313e5d[_0x041e('0x32')]=_0x313e5d[_0x041e('0x32')][_0x041e('0x35')]?_0x313e5d[_0x041e('0x32')]:_0x3acabb['model'];if(_0x10ad73['query'][_0x041e('0x3f')]){_0x313e5d[_0x041e('0x40')]=[{'all':!![]}];}_0x313e5d=_[_0x041e('0x3d')]({},_0x313e5d,_0x10ad73['options']);return db[_0x041e('0x2b')][_0x041e('0x45')](_0x313e5d)['then'](handleEntityNotFound(_0x1e1a10,null))[_0x041e('0x25')](respondWithResult(_0x1e1a10,null))['catch'](handleError(_0x1e1a10,null));};exports['create']=function(_0x137680,_0x4ca720){return db[_0x041e('0x2b')][_0x041e('0x46')](_0x137680[_0x041e('0x47')],{})[_0x041e('0x25')](respondWithResult(_0x4ca720,0xc9))[_0x041e('0x42')](handleError(_0x4ca720,null));};exports[_0x041e('0x24')]=function(_0x55e2ee,_0x4d3301){if(_0x55e2ee['body']['id']){delete _0x55e2ee[_0x041e('0x47')]['id'];}return db[_0x041e('0x2b')][_0x041e('0x45')]({'where':{'id':_0x55e2ee['params']['id']}})[_0x041e('0x25')](handleEntityNotFound(_0x4d3301,null))[_0x041e('0x25')](saveUpdates(_0x55e2ee[_0x041e('0x47')],null))['then'](respondWithResult(_0x4d3301,null))[_0x041e('0x42')](handleError(_0x4d3301,null));};exports[_0x041e('0x48')]=function(_0x13155b,_0x59c43c){return db['DeskAccount']['find']({'where':{'id':_0x13155b[_0x041e('0x44')]['id']}})[_0x041e('0x25')](handleEntityNotFound(_0x59c43c,null))['then'](removeEntity(_0x59c43c,null))[_0x041e('0x42')](handleError(_0x59c43c,null));};exports[_0x041e('0x49')]=function(_0x16fad8,_0x1cb7df,_0x2455e2){var _0x233bbc={};var _0xbea3e9={};var _0x5c5141;var _0x57b73c;return db['DeskAccount'][_0x041e('0x4a')]({'where':{'id':_0x16fad8['params']['id']}})['then'](handleEntityNotFound(_0x1cb7df,null))['then'](function(_0x2904b2){if(_0x2904b2){_0x5c5141=_0x2904b2;_0xbea3e9[_0x041e('0x2e')]=_['keys'](db[_0x041e('0x4b')][_0x041e('0x4c')]);_0xbea3e9['query']=_[_0x041e('0x31')](_0x16fad8[_0x041e('0x30')]);_0xbea3e9[_0x041e('0x3a')]=_[_0x041e('0x33')](_0xbea3e9[_0x041e('0x2e')],_0xbea3e9['query']);_0x233bbc[_0x041e('0x32')]=_['intersection'](_0xbea3e9[_0x041e('0x2e')],qs[_0x041e('0x34')](_0x16fad8[_0x041e('0x30')]['fields']));_0x233bbc['attributes']=_0x233bbc['attributes'][_0x041e('0x35')]?_0x233bbc[_0x041e('0x32')]:_0xbea3e9[_0x041e('0x2e')];_0x233bbc[_0x041e('0x37')]=qs[_0x041e('0x38')](_0x16fad8[_0x041e('0x30')][_0x041e('0x38')]);_0x233bbc[_0x041e('0x39')]=qs[_0x041e('0x3a')](_[_0x041e('0x3b')](_0x16fad8['query'],_0xbea3e9['filters']));if(_0x16fad8[_0x041e('0x30')][_0x041e('0x3c')]){_0x233bbc[_0x041e('0x39')]=_[_0x041e('0x3d')](_0x233bbc[_0x041e('0x39')],{'$or':_['map'](_0x233bbc[_0x041e('0x32')],function(_0xf9af38){var _0x58be70={};_0x58be70[_0xf9af38]={'$like':'%'+_0x16fad8['query'][_0x041e('0x3c')]+'%'};return _0x58be70;})});}_0x233bbc=_['merge']({},_0x233bbc,_0x16fad8['options']);return _0x5c5141['getConfigurations'](_0x233bbc);}})['then'](function(_0x3b0fca){if(_0x3b0fca){_0x57b73c=_0x3b0fca[_0x041e('0x35')];if(!_0x16fad8[_0x041e('0x30')][_0x041e('0x36')](_0x041e('0x4d'))){_0x233bbc[_0x041e('0x1c')]=qs[_0x041e('0x1c')](_0x16fad8[_0x041e('0x30')][_0x041e('0x1c')]);_0x233bbc[_0x041e('0x1a')]=qs[_0x041e('0x1a')](_0x16fad8[_0x041e('0x30')][_0x041e('0x1a')]);}return _0x5c5141['getConfigurations'](_0x233bbc);}})[_0x041e('0x25')](function(_0x1ca15f){if(_0x1ca15f){return _0x1ca15f?{'count':_0x57b73c,'rows':_0x1ca15f}:null;}})[_0x041e('0x25')](respondWithResult(_0x1cb7df,null))[_0x041e('0x42')](handleError(_0x1cb7df,null));};exports['addConfiguration']=function(_0x381e89,_0x53f47c,_0x45d7f7){if(_0x381e89[_0x041e('0x47')]['id']){delete _0x381e89['body']['id'];}return db[_0x041e('0x2b')][_0x041e('0x4a')]({'where':{'id':_0x381e89[_0x041e('0x44')]['id']}})['then'](handleEntityNotFound(_0x53f47c,null))['then'](function(_0x2d70b9){if(_0x2d70b9){_0x381e89[_0x041e('0x47')][_0x041e('0x4e')]=_0x2d70b9['id'];_0x381e89[_0x041e('0x47')][_0x041e('0x4f')]=integrations[_0x041e('0x50')](_0x381e89[_0x041e('0x47')][_0x041e('0x51')],_0x381e89[_0x041e('0x47')][_0x041e('0x2c')]);_0x381e89[_0x041e('0x47')][_0x041e('0x52')]=integrations[_0x041e('0x53')](_0x381e89[_0x041e('0x47')][_0x041e('0x51')],_0x381e89['body'][_0x041e('0x2c')]);return db['DeskConfiguration']['create'](_0x381e89[_0x041e('0x47')],{'include':[{'model':db[_0x041e('0x54')],'as':'Subjects'},{'model':db[_0x041e('0x54')],'as':_0x041e('0x52')}]});}return null;})[_0x041e('0x25')](respondWithResult(_0x53f47c,null))[_0x041e('0x42')](handleError(_0x53f47c,null));};exports[_0x041e('0x55')]=function(_0x55ad2f,_0x33b1e7,_0x1619f4){var _0x5d565c=[{'name':_0x041e('0x56'),'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 _0x3c0014='';return db[_0x041e('0x2b')]['findOne']({'where':{'id':_0x55ad2f[_0x041e('0x44')]['id']},'attributes':['id',_0x041e('0x57'),_0x041e('0x58'),_0x041e('0x59'),_0x041e('0x5a'),_0x041e('0x5b'),_0x041e('0x5c'),_0x041e('0x5d'),_0x041e('0x5e')]})[_0x041e('0x25')](handleEntityNotFound(_0x33b1e7,null))[_0x041e('0x25')](function(_0x2aa6e3){if(_0x2aa6e3){_0x3c0014=_0x2aa6e3[_0x041e('0x57')];var _0x2be8f3=_0x3c0014['slice'](-0x1);if(_0x2be8f3==='/'){_0x3c0014=_0x3c0014[_0x041e('0x5f')](0x0,_0x3c0014['lastIndexOf'](_0x2be8f3));}var _0x250f14={'method':_0x041e('0x60'),'uri':util[_0x041e('0x61')](_0x041e('0x62'),_0x3c0014),'headers':{'Content-Type':'application/json','Accept':_0x041e('0x63')},'json':!![]};if(_0x2aa6e3[_0x041e('0x58')]==='basic'){_0x250f14[_0x041e('0x64')][_0x041e('0x65')]=util[_0x041e('0x61')]('Basic\x20%s',new Buffer(util[_0x041e('0x61')](_0x041e('0x66'),_0x2aa6e3['username'],_0x2aa6e3[_0x041e('0x5a')]))[_0x041e('0x67')]('base64'));}return rp(_0x250f14)[_0x041e('0x25')](function(_0x36b7c3){return _0x5d565c[_0x041e('0x68')](_['map'](_0x36b7c3[_0x041e('0x69')]['entries'],function(_0x446b87){return{'id':_0x446b87[_0x041e('0x2f')],'name':_0x446b87[_0x041e('0x2f')],'type':_0x446b87[_0x041e('0x2c')],'active':_0x446b87[_0x041e('0x6a')],'label':_0x446b87[_0x041e('0x6b')],'custom':!![]};}));});}})[_0x041e('0x25')](function(_0x6d37b0){return{'count':_0x6d37b0[_0x041e('0x35')],'rows':_0x6d37b0};})['then'](respondWithResult(_0x33b1e7,null))['catch'](function(_0x59bdbc){var _0x19dfd3=_0x55ad2f['query'][_0x041e('0x6c')]?0x1f4:_0x59bdbc['statusCode']||0x1f4;logger[_0x041e('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x041e('0x55'),_0x19dfd3,JSON[_0x041e('0x6d')](_0x59bdbc));delete _0x59bdbc['name'];if(_0x19dfd3===0x191){_0x19dfd3=0x190;}_0x33b1e7[_0x041e('0x19')](_0x19dfd3)[_0x041e('0x29')](_0x55ad2f[_0x041e('0x30')][_0x041e('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x59bdbc['statusCode']}:_0x59bdbc);});}; \ No newline at end of file +var _0xbfef=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../components/integrations/configuration','status','offset','undefined','count','json','apply','reject','save','then','destroy','end','name','send','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','getConfigurations','DeskConfiguration','nolimit','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','priority','remoteUri','username','consumerKey','consumerSecret','tokenSecret','slice','lastIndexOf','GET','%s/custom_fields','application/json','authType','headers','Authorization','Basic\x20%s','format','password','toString','base64','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir'];(function(_0x4b3ef1,_0x1dad38){var _0x34d3b4=function(_0x1da4fe){while(--_0x1da4fe){_0x4b3ef1['push'](_0x4b3ef1['shift']());}};_0x34d3b4(++_0x1dad38);}(_0xbfef,0x13e));var _0xfbfe=function(_0x281b7c,_0xc5f6db){_0x281b7c=_0x281b7c-0x0;var _0x3e0577=_0xbfef[_0x281b7c];return _0x3e0577;};'use strict';var emlformat=require(_0xfbfe('0x0'));var rimraf=require(_0xfbfe('0x1'));var zipdir=require(_0xfbfe('0x2'));var jsonpatch=require(_0xfbfe('0x3'));var rp=require(_0xfbfe('0x4'));var moment=require(_0xfbfe('0x5'));var BPromise=require(_0xfbfe('0x6'));var Mustache=require(_0xfbfe('0x7'));var util=require(_0xfbfe('0x8'));var path=require(_0xfbfe('0x9'));var sox=require(_0xfbfe('0xa'));var csv=require(_0xfbfe('0xb'));var ejs=require(_0xfbfe('0xc'));var fs=require('fs');var fs_extra=require(_0xfbfe('0xd'));var _=require(_0xfbfe('0xe'));var squel=require('squel');var crypto=require(_0xfbfe('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfbfe('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfbfe('0x10'));var authService=require(_0xfbfe('0x11'));var qs=require(_0xfbfe('0x12'));var as=require(_0xfbfe('0x13'));var hardwareService=require(_0xfbfe('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfbfe('0x15'));var config=require(_0xfbfe('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xfbfe('0x17'));function respondWithStatusCode(_0x329592,_0x9ca99){_0x9ca99=_0x9ca99||0xcc;return function(_0xc9b4af){if(_0xc9b4af){return _0x329592['sendStatus'](_0x9ca99);}return _0x329592[_0xfbfe('0x18')](_0x9ca99)['end']();};}function respondWithResult(_0x607266,_0xe90397){_0xe90397=_0xe90397||0xc8;return function(_0x4a8907){if(_0x4a8907){return _0x607266['status'](_0xe90397)['json'](_0x4a8907);}};}function respondWithFilteredResult(_0x304c6d,_0x5851f0){return function(_0x61455f){if(_0x61455f){var _0x480db6=typeof _0x5851f0[_0xfbfe('0x19')]==='undefined'&&typeof _0x5851f0['limit']===_0xfbfe('0x1a');var _0x5e67fc=_0x61455f[_0xfbfe('0x1b')];var _0x5a77d3=_0x480db6?0x0:_0x5851f0['offset'];var _0x2cad1a=_0x480db6?_0x61455f[_0xfbfe('0x1b')]:_0x5851f0['offset']+_0x5851f0['limit'];var _0x163dc3;if(_0x2cad1a>=_0x5e67fc){_0x2cad1a=_0x5e67fc;_0x163dc3=0xc8;}else{_0x163dc3=0xce;}_0x304c6d[_0xfbfe('0x18')](_0x163dc3);return _0x304c6d['set']('Content-Range',_0x5a77d3+'-'+_0x2cad1a+'/'+_0x5e67fc)[_0xfbfe('0x1c')](_0x61455f);}return null;};}function patchUpdates(_0x4f3510){return function(_0x3717b1){try{jsonpatch[_0xfbfe('0x1d')](_0x3717b1,_0x4f3510,!![]);}catch(_0x2cc593){return BPromise[_0xfbfe('0x1e')](_0x2cc593);}return _0x3717b1[_0xfbfe('0x1f')]();};}function saveUpdates(_0x158a3e,_0x2b564a){return function(_0x2d64fb){if(_0x2d64fb){return _0x2d64fb['update'](_0x158a3e)[_0xfbfe('0x20')](function(_0x5c53e3){return _0x5c53e3;});}return null;};}function removeEntity(_0x6abdd8,_0x533027){return function(_0x4a1ce0){if(_0x4a1ce0){return _0x4a1ce0[_0xfbfe('0x21')]()['then'](function(){_0x6abdd8[_0xfbfe('0x18')](0xcc)[_0xfbfe('0x22')]();});}};}function handleEntityNotFound(_0x5af887,_0x2d5d63){return function(_0x4af8d9){if(!_0x4af8d9){_0x5af887['sendStatus'](0x194);}return _0x4af8d9;};}function handleError(_0x2ca4ff,_0x55bf34){_0x55bf34=_0x55bf34||0x1f4;return function(_0x6b7e7){logger['error'](_0x6b7e7['stack']);if(_0x6b7e7[_0xfbfe('0x23')]){delete _0x6b7e7[_0xfbfe('0x23')];}_0x2ca4ff[_0xfbfe('0x18')](_0x55bf34)[_0xfbfe('0x24')](_0x6b7e7);};}exports['index']=function(_0x20bd9c,_0x4728f0){var _0x4f1a36={},_0x1ab11f={},_0xd1442={'count':0x0,'rows':[]};var _0x56c920=_['map'](db[_0xfbfe('0x25')][_0xfbfe('0x26')],function(_0x233ae3){return{'name':_0x233ae3[_0xfbfe('0x27')],'type':_0x233ae3[_0xfbfe('0x28')][_0xfbfe('0x29')]};});_0x1ab11f[_0xfbfe('0x2a')]=_[_0xfbfe('0x2b')](_0x56c920,_0xfbfe('0x23'));_0x1ab11f[_0xfbfe('0x2c')]=_[_0xfbfe('0x2d')](_0x20bd9c[_0xfbfe('0x2c')]);_0x1ab11f[_0xfbfe('0x2e')]=_['intersection'](_0x1ab11f[_0xfbfe('0x2a')],_0x1ab11f['query']);_0x4f1a36[_0xfbfe('0x2f')]=_[_0xfbfe('0x30')](_0x1ab11f['model'],qs[_0xfbfe('0x31')](_0x20bd9c[_0xfbfe('0x2c')][_0xfbfe('0x31')]));_0x4f1a36[_0xfbfe('0x2f')]=_0x4f1a36[_0xfbfe('0x2f')][_0xfbfe('0x32')]?_0x4f1a36[_0xfbfe('0x2f')]:_0x1ab11f[_0xfbfe('0x2a')];if(!_0x20bd9c[_0xfbfe('0x2c')][_0xfbfe('0x33')]('nolimit')){_0x4f1a36[_0xfbfe('0x34')]=qs['limit'](_0x20bd9c['query'][_0xfbfe('0x34')]);_0x4f1a36[_0xfbfe('0x19')]=qs[_0xfbfe('0x19')](_0x20bd9c[_0xfbfe('0x2c')][_0xfbfe('0x19')]);}_0x4f1a36[_0xfbfe('0x35')]=qs[_0xfbfe('0x36')](_0x20bd9c[_0xfbfe('0x2c')][_0xfbfe('0x36')]);_0x4f1a36[_0xfbfe('0x37')]=qs[_0xfbfe('0x2e')](_[_0xfbfe('0x38')](_0x20bd9c[_0xfbfe('0x2c')],_0x1ab11f['filters']),_0x56c920);if(_0x20bd9c[_0xfbfe('0x2c')][_0xfbfe('0x39')]){_0x4f1a36[_0xfbfe('0x37')]=_['merge'](_0x4f1a36['where'],{'$or':_[_0xfbfe('0x2b')](_0x56c920,function(_0x44aeb9){if(_0x44aeb9[_0xfbfe('0x28')]!=='VIRTUAL'){var _0x44b907={};_0x44b907[_0x44aeb9[_0xfbfe('0x23')]]={'$like':'%'+_0x20bd9c[_0xfbfe('0x2c')]['filter']+'%'};return _0x44b907;}})});}_0x4f1a36=_[_0xfbfe('0x3a')]({},_0x4f1a36,_0x20bd9c['options']);var _0x12a9b4={'where':_0x4f1a36['where']};return db[_0xfbfe('0x25')][_0xfbfe('0x1b')](_0x12a9b4)[_0xfbfe('0x20')](function(_0x3a38f4){_0xd1442[_0xfbfe('0x1b')]=_0x3a38f4;if(_0x20bd9c['query'][_0xfbfe('0x3b')]){_0x4f1a36[_0xfbfe('0x3c')]=[{'all':!![]}];}return db[_0xfbfe('0x25')][_0xfbfe('0x3d')](_0x4f1a36);})[_0xfbfe('0x20')](function(_0x254b8b){_0xd1442[_0xfbfe('0x3e')]=_0x254b8b;return _0xd1442;})[_0xfbfe('0x20')](respondWithFilteredResult(_0x4728f0,_0x4f1a36))[_0xfbfe('0x3f')](handleError(_0x4728f0,null));};exports[_0xfbfe('0x40')]=function(_0x1fa7d5,_0x349369){var _0x2d9f2f={'raw':![],'where':{'id':_0x1fa7d5[_0xfbfe('0x41')]['id']}},_0x4ff965={};_0x4ff965[_0xfbfe('0x2a')]=_[_0xfbfe('0x2d')](db['DeskAccount']['rawAttributes']);_0x4ff965[_0xfbfe('0x2c')]=_[_0xfbfe('0x2d')](_0x1fa7d5[_0xfbfe('0x2c')]);_0x4ff965[_0xfbfe('0x2e')]=_[_0xfbfe('0x30')](_0x4ff965[_0xfbfe('0x2a')],_0x4ff965[_0xfbfe('0x2c')]);_0x2d9f2f[_0xfbfe('0x2f')]=_[_0xfbfe('0x30')](_0x4ff965[_0xfbfe('0x2a')],qs[_0xfbfe('0x31')](_0x1fa7d5['query']['fields']));_0x2d9f2f[_0xfbfe('0x2f')]=_0x2d9f2f['attributes'][_0xfbfe('0x32')]?_0x2d9f2f[_0xfbfe('0x2f')]:_0x4ff965[_0xfbfe('0x2a')];if(_0x1fa7d5[_0xfbfe('0x2c')][_0xfbfe('0x3b')]){_0x2d9f2f[_0xfbfe('0x3c')]=[{'all':!![]}];}_0x2d9f2f=_[_0xfbfe('0x3a')]({},_0x2d9f2f,_0x1fa7d5[_0xfbfe('0x42')]);return db[_0xfbfe('0x25')][_0xfbfe('0x43')](_0x2d9f2f)[_0xfbfe('0x20')](handleEntityNotFound(_0x349369,null))['then'](respondWithResult(_0x349369,null))['catch'](handleError(_0x349369,null));};exports[_0xfbfe('0x44')]=function(_0x668f1b,_0x4fa77d){return db[_0xfbfe('0x25')]['create'](_0x668f1b[_0xfbfe('0x45')],{})[_0xfbfe('0x20')](respondWithResult(_0x4fa77d,0xc9))[_0xfbfe('0x3f')](handleError(_0x4fa77d,null));};exports[_0xfbfe('0x46')]=function(_0x165351,_0x3a1472){if(_0x165351[_0xfbfe('0x45')]['id']){delete _0x165351[_0xfbfe('0x45')]['id'];}return db[_0xfbfe('0x25')][_0xfbfe('0x43')]({'where':{'id':_0x165351[_0xfbfe('0x41')]['id']}})[_0xfbfe('0x20')](handleEntityNotFound(_0x3a1472,null))[_0xfbfe('0x20')](saveUpdates(_0x165351[_0xfbfe('0x45')],null))[_0xfbfe('0x20')](respondWithResult(_0x3a1472,null))[_0xfbfe('0x3f')](handleError(_0x3a1472,null));};exports[_0xfbfe('0x21')]=function(_0x3b608a,_0x2c1ebb){return db[_0xfbfe('0x25')][_0xfbfe('0x43')]({'where':{'id':_0x3b608a[_0xfbfe('0x41')]['id']}})[_0xfbfe('0x20')](handleEntityNotFound(_0x2c1ebb,null))[_0xfbfe('0x20')](removeEntity(_0x2c1ebb,null))[_0xfbfe('0x3f')](handleError(_0x2c1ebb,null));};exports[_0xfbfe('0x47')]=function(_0x124133,_0x261c9f,_0x223378){var _0x3f3416={};var _0x6651ef={};var _0x4b8cdc;var _0x56793b;return db[_0xfbfe('0x25')]['findOne']({'where':{'id':_0x124133[_0xfbfe('0x41')]['id']}})[_0xfbfe('0x20')](handleEntityNotFound(_0x261c9f,null))[_0xfbfe('0x20')](function(_0x3870b1){if(_0x3870b1){_0x4b8cdc=_0x3870b1;_0x6651ef[_0xfbfe('0x2a')]=_[_0xfbfe('0x2d')](db[_0xfbfe('0x48')]['rawAttributes']);_0x6651ef['query']=_[_0xfbfe('0x2d')](_0x124133[_0xfbfe('0x2c')]);_0x6651ef[_0xfbfe('0x2e')]=_[_0xfbfe('0x30')](_0x6651ef[_0xfbfe('0x2a')],_0x6651ef['query']);_0x3f3416[_0xfbfe('0x2f')]=_[_0xfbfe('0x30')](_0x6651ef[_0xfbfe('0x2a')],qs[_0xfbfe('0x31')](_0x124133[_0xfbfe('0x2c')]['fields']));_0x3f3416[_0xfbfe('0x2f')]=_0x3f3416[_0xfbfe('0x2f')][_0xfbfe('0x32')]?_0x3f3416['attributes']:_0x6651ef[_0xfbfe('0x2a')];_0x3f3416[_0xfbfe('0x35')]=qs[_0xfbfe('0x36')](_0x124133[_0xfbfe('0x2c')]['sort']);_0x3f3416['where']=qs[_0xfbfe('0x2e')](_[_0xfbfe('0x38')](_0x124133[_0xfbfe('0x2c')],_0x6651ef[_0xfbfe('0x2e')]));if(_0x124133['query']['filter']){_0x3f3416[_0xfbfe('0x37')]=_[_0xfbfe('0x3a')](_0x3f3416['where'],{'$or':_[_0xfbfe('0x2b')](_0x3f3416[_0xfbfe('0x2f')],function(_0x131969){var _0x4c7add={};_0x4c7add[_0x131969]={'$like':'%'+_0x124133[_0xfbfe('0x2c')][_0xfbfe('0x39')]+'%'};return _0x4c7add;})});}_0x3f3416=_[_0xfbfe('0x3a')]({},_0x3f3416,_0x124133[_0xfbfe('0x42')]);return _0x4b8cdc[_0xfbfe('0x47')](_0x3f3416);}})[_0xfbfe('0x20')](function(_0x29e261){if(_0x29e261){_0x56793b=_0x29e261[_0xfbfe('0x32')];if(!_0x124133[_0xfbfe('0x2c')][_0xfbfe('0x33')](_0xfbfe('0x49'))){_0x3f3416[_0xfbfe('0x34')]=qs['limit'](_0x124133['query'][_0xfbfe('0x34')]);_0x3f3416['offset']=qs[_0xfbfe('0x19')](_0x124133[_0xfbfe('0x2c')]['offset']);}return _0x4b8cdc['getConfigurations'](_0x3f3416);}})[_0xfbfe('0x20')](function(_0x42de5c){if(_0x42de5c){return _0x42de5c?{'count':_0x56793b,'rows':_0x42de5c}:null;}})['then'](respondWithResult(_0x261c9f,null))[_0xfbfe('0x3f')](handleError(_0x261c9f,null));};exports['addConfiguration']=function(_0x3bbe25,_0x427656,_0x3ae2d0){if(_0x3bbe25[_0xfbfe('0x45')]['id']){delete _0x3bbe25[_0xfbfe('0x45')]['id'];}return db[_0xfbfe('0x25')][_0xfbfe('0x4a')]({'where':{'id':_0x3bbe25[_0xfbfe('0x41')]['id']}})[_0xfbfe('0x20')](handleEntityNotFound(_0x427656,null))[_0xfbfe('0x20')](function(_0x348a8a){if(_0x348a8a){_0x3bbe25[_0xfbfe('0x45')][_0xfbfe('0x4b')]=_0x348a8a['id'];_0x3bbe25[_0xfbfe('0x45')][_0xfbfe('0x4c')]=integrations[_0xfbfe('0x4d')](_0x3bbe25[_0xfbfe('0x45')][_0xfbfe('0x4e')],_0x3bbe25['body']['type']);_0x3bbe25[_0xfbfe('0x45')]['Descriptions']=integrations[_0xfbfe('0x4f')](_0x3bbe25[_0xfbfe('0x45')][_0xfbfe('0x4e')],_0x3bbe25[_0xfbfe('0x45')][_0xfbfe('0x28')]);return db['DeskConfiguration'][_0xfbfe('0x44')](_0x3bbe25['body'],{'include':[{'model':db[_0xfbfe('0x50')],'as':_0xfbfe('0x4c')},{'model':db[_0xfbfe('0x50')],'as':_0xfbfe('0x51')}]});}return null;})[_0xfbfe('0x20')](respondWithResult(_0x427656,null))[_0xfbfe('0x3f')](handleError(_0x427656,null));};exports['getFields']=function(_0x3dfc0a,_0x3d09b2,_0x13a9fd){var _0x594a9a=[{'name':_0xfbfe('0x52'),'label':_0xfbfe('0x52'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2cffa8='';return db[_0xfbfe('0x25')]['findOne']({'where':{'id':_0x3dfc0a[_0xfbfe('0x41')]['id']},'attributes':['id',_0xfbfe('0x53'),'authType',_0xfbfe('0x54'),'password',_0xfbfe('0x55'),_0xfbfe('0x56'),'token',_0xfbfe('0x57')]})[_0xfbfe('0x20')](handleEntityNotFound(_0x3d09b2,null))[_0xfbfe('0x20')](function(_0x3dc128){if(_0x3dc128){_0x2cffa8=_0x3dc128[_0xfbfe('0x53')];var _0x2d314f=_0x2cffa8[_0xfbfe('0x58')](-0x1);if(_0x2d314f==='/'){_0x2cffa8=_0x2cffa8['substring'](0x0,_0x2cffa8[_0xfbfe('0x59')](_0x2d314f));}var _0x46560a={'method':_0xfbfe('0x5a'),'uri':util['format'](_0xfbfe('0x5b'),_0x2cffa8),'headers':{'Content-Type':_0xfbfe('0x5c'),'Accept':_0xfbfe('0x5c')},'json':!![]};if(_0x3dc128[_0xfbfe('0x5d')]==='basic'){_0x46560a[_0xfbfe('0x5e')][_0xfbfe('0x5f')]=util['format'](_0xfbfe('0x60'),new Buffer(util[_0xfbfe('0x61')]('%s:%s',_0x3dc128[_0xfbfe('0x54')],_0x3dc128[_0xfbfe('0x62')]))[_0xfbfe('0x63')](_0xfbfe('0x64')));}return rp(_0x46560a)[_0xfbfe('0x20')](function(_0x12d2c5){return _0x594a9a['concat'](_[_0xfbfe('0x2b')](_0x12d2c5['_embedded']['entries'],function(_0x2c1ed1){return{'id':_0x2c1ed1['name'],'name':_0x2c1ed1[_0xfbfe('0x23')],'type':_0x2c1ed1[_0xfbfe('0x28')],'active':_0x2c1ed1['active'],'label':_0x2c1ed1[_0xfbfe('0x65')],'custom':!![]};}));});}})[_0xfbfe('0x20')](function(_0x344f91){return{'count':_0x344f91[_0xfbfe('0x32')],'rows':_0x344f91};})[_0xfbfe('0x20')](respondWithResult(_0x3d09b2,null))[_0xfbfe('0x3f')](function(_0x26383a){var _0x188661=_0x3dfc0a[_0xfbfe('0x2c')][_0xfbfe('0x66')]?0x1f4:_0x26383a[_0xfbfe('0x67')]||0x1f4;logger[_0xfbfe('0x68')](_0xfbfe('0x69'),'getFields',_0x188661,JSON[_0xfbfe('0x6a')](_0x26383a));delete _0x26383a[_0xfbfe('0x23')];if(_0x188661===0x191){_0x188661=0x190;}_0x3d09b2['status'](_0x188661)['send'](_0x3dfc0a[_0xfbfe('0x2c')][_0xfbfe('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x26383a[_0xfbfe('0x67')]}:_0x26383a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index eeb2f05..c542eb0 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 _0xb72b=['path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','bluebird','request-promise'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xb72b,0x126));var _0xbb72=function(_0x2cfedd,_0x4537b4){_0x2cfedd=_0x2cfedd-0x0;var _0x246997=_0xb72b[_0x2cfedd];return _0x246997;};'use strict';var _=require(_0xbb72('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbb72('0x1'));var rp=require(_0xbb72('0x2'));var fs=require('fs');var path=require(_0xbb72('0x3'));var rimraf=require(_0xbb72('0x4'));var config=require(_0xbb72('0x5'));var attributes=require(_0xbb72('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xbb72('0x7')]=function(_0x1aa5b7,_0x48a127){return _0x1aa5b7[_0xbb72('0x8')](_0xbb72('0x9'),attributes,{'tableName':_0xbb72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90dc=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util'];(function(_0x2cfd6f,_0xa7a373){var _0x2b1e12=function(_0x47b4dd){while(--_0x47b4dd){_0x2cfd6f['push'](_0x2cfd6f['shift']());}};_0x2b1e12(++_0xa7a373);}(_0x90dc,0xb4));var _0xc90d=function(_0x1e6c05,_0x2a098f){_0x1e6c05=_0x1e6c05-0x0;var _0x478840=_0x90dc[_0x1e6c05];return _0x478840;};'use strict';var _=require(_0xc90d('0x0'));var util=require(_0xc90d('0x1'));var logger=require(_0xc90d('0x2'))('api');var moment=require(_0xc90d('0x3'));var BPromise=require(_0xc90d('0x4'));var rp=require(_0xc90d('0x5'));var fs=require('fs');var path=require(_0xc90d('0x6'));var rimraf=require('rimraf');var config=require(_0xc90d('0x7'));var attributes=require(_0xc90d('0x8'));var integrations=require(_0xc90d('0x9'));module[_0xc90d('0xa')]=function(_0x3f25c1,_0x501fc5){return _0x3f25c1[_0xc90d('0xb')]('DeskAccount',attributes,{'tableName':_0xc90d('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 b68a125..d5eba57 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 _0xe702=['limit','include','map','model','ShowDeskAccount','DeskAccount','where','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','options','raw','attributes'];(function(_0x45cb26,_0x56a738){var _0x17f5dc=function(_0x11206d){while(--_0x11206d){_0x45cb26['push'](_0x45cb26['shift']());}};_0x17f5dc(++_0x56a738);}(_0xe702,0xf6));var _0x2e70=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe702[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2e70('0x0'));var BPromise=require(_0x2e70('0x1'));var rs=require(_0x2e70('0x2'));var fs=require('fs');var Redis=require(_0x2e70('0x3'));var db=require(_0x2e70('0x4'))['db'];var utils=require(_0x2e70('0x5'));var logger=require(_0x2e70('0x6'))(_0x2e70('0x7'));var config=require(_0x2e70('0x8'));var jayson=require(_0x2e70('0x9'));var client=jayson['client'][_0x2e70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa5f2b,_0xf9808a,_0x3f238a){return new BPromise(function(_0x23eed1,_0x113697){return client[_0x2e70('0xb')](_0xfa5f2b,_0x3f238a)[_0x2e70('0xc')](function(_0x913939){logger[_0x2e70('0xd')]('DeskAccount,\x20%s,\x20%s',_0xf9808a,_0x2e70('0xe'));logger['debug'](_0x2e70('0xf'),_0xf9808a,_0x2e70('0xe'),JSON[_0x2e70('0x10')](_0x913939));if(_0x913939[_0x2e70('0x11')]){if(_0x913939[_0x2e70('0x11')][_0x2e70('0x12')]===0x1f4){logger['error'](_0x2e70('0x13'),_0xf9808a,_0x913939[_0x2e70('0x11')][_0x2e70('0x14')]);return _0x113697(_0x913939[_0x2e70('0x11')]['message']);}logger[_0x2e70('0x11')]('DeskAccount,\x20%s,\x20%s',_0xf9808a,_0x913939[_0x2e70('0x11')][_0x2e70('0x14')]);return _0x23eed1(_0x913939['error'][_0x2e70('0x14')]);}else{logger[_0x2e70('0xd')](_0x2e70('0x13'),_0xf9808a,_0x2e70('0xe'));_0x23eed1(_0x913939['result'][_0x2e70('0x14')]);}})[_0x2e70('0x15')](function(_0x455997){logger[_0x2e70('0x11')](_0x2e70('0x13'),_0xf9808a,_0x455997);_0x113697(_0x455997);});});}exports[_0x2e70('0x16')]=function(_0x50f9e5){var _0x3a9693=this;return new Promise(function(_0x942980,_0x28848a){return db['DeskAccount']['findAll']({'raw':_0x50f9e5[_0x2e70('0x17')]?_0x50f9e5[_0x2e70('0x17')][_0x2e70('0x18')]===undefined?!![]:![]:!![],'where':_0x50f9e5[_0x2e70('0x17')]?_0x50f9e5['options']['where']||null:null,'attributes':_0x50f9e5[_0x2e70('0x17')]?_0x50f9e5[_0x2e70('0x17')][_0x2e70('0x19')]||null:null,'limit':_0x50f9e5[_0x2e70('0x17')]?_0x50f9e5['options'][_0x2e70('0x1a')]||null:null,'include':_0x50f9e5[_0x2e70('0x17')]?_0x50f9e5[_0x2e70('0x17')][_0x2e70('0x1b')]?_[_0x2e70('0x1c')](_0x50f9e5[_0x2e70('0x17')][_0x2e70('0x1b')],function(_0xeea6f4){return{'model':db[_0xeea6f4['model']],'as':_0xeea6f4['as'],'attributes':_0xeea6f4[_0x2e70('0x19')],'include':_0xeea6f4[_0x2e70('0x1b')]?_['map'](_0xeea6f4[_0x2e70('0x1b')],function(_0x2f96a5){return{'model':db[_0x2f96a5[_0x2e70('0x1d')]],'as':_0x2f96a5['as'],'attributes':_0x2f96a5[_0x2e70('0x19')],'include':_0x2f96a5[_0x2e70('0x1b')]?_[_0x2e70('0x1c')](_0x2f96a5[_0x2e70('0x1b')],function(_0x3f0d53){return{'model':db[_0x3f0d53[_0x2e70('0x1d')]],'as':_0x3f0d53['as'],'attributes':_0x3f0d53[_0x2e70('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2e70('0xc')](function(_0x2f5177){logger[_0x2e70('0xd')]('GetDeskAccount',_0x50f9e5);logger['debug'](_0x2e70('0x16'),_0x50f9e5,JSON[_0x2e70('0x10')](_0x2f5177));_0x942980(_0x2f5177);})[_0x2e70('0x15')](function(_0x2f2a33){logger[_0x2e70('0x11')]('GetDeskAccount',_0x2f2a33[_0x2e70('0x14')],_0x50f9e5);_0x28848a(_0x3a9693[_0x2e70('0x11')](0x1f4,_0x2f2a33[_0x2e70('0x14')]));});});};exports[_0x2e70('0x1e')]=function(_0x2d1bd3){var _0x34f1d7=this;return new Promise(function(_0x5645c7,_0x1ae4b9){return db[_0x2e70('0x1f')]['find']({'raw':_0x2d1bd3[_0x2e70('0x17')]?_0x2d1bd3[_0x2e70('0x17')][_0x2e70('0x18')]===undefined?!![]:![]:!![],'where':_0x2d1bd3[_0x2e70('0x17')]?_0x2d1bd3[_0x2e70('0x17')][_0x2e70('0x20')]||null:null,'attributes':_0x2d1bd3['options']?_0x2d1bd3[_0x2e70('0x17')]['attributes']||null:null,'include':_0x2d1bd3[_0x2e70('0x17')]?_0x2d1bd3[_0x2e70('0x17')][_0x2e70('0x1b')]?_[_0x2e70('0x1c')](_0x2d1bd3['options'][_0x2e70('0x1b')],function(_0x8f9020){return{'model':db[_0x8f9020['model']],'as':_0x8f9020['as'],'attributes':_0x8f9020[_0x2e70('0x19')],'include':_0x8f9020[_0x2e70('0x1b')]?_[_0x2e70('0x1c')](_0x8f9020[_0x2e70('0x1b')],function(_0x4089e6){return{'model':db[_0x4089e6[_0x2e70('0x1d')]],'as':_0x4089e6['as'],'attributes':_0x4089e6[_0x2e70('0x19')],'include':_0x4089e6[_0x2e70('0x1b')]?_[_0x2e70('0x1c')](_0x4089e6['include'],function(_0x513c61){return{'model':db[_0x513c61[_0x2e70('0x1d')]],'as':_0x513c61['as'],'attributes':_0x513c61[_0x2e70('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2e70('0xc')](function(_0x5210ea){logger[_0x2e70('0xd')](_0x2e70('0x1e'),_0x2d1bd3);logger[_0x2e70('0x21')](_0x2e70('0x1e'),_0x2d1bd3,JSON[_0x2e70('0x10')](_0x5210ea));_0x5645c7(_0x5210ea);})[_0x2e70('0x15')](function(_0x174936){logger['error']('ShowDeskAccount',_0x174936[_0x2e70('0x14')],_0x2d1bd3);_0x1ae4b9(_0x34f1d7[_0x2e70('0x11')](0x1f4,_0x174936[_0x2e70('0x14')]));});});}; \ No newline at end of file +var _0x69fb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','DeskAccount,\x20%s,\x20%s','GetDeskAccount','raw','options','attributes','map','model','include','catch','ShowDeskAccount','DeskAccount','find','lodash','util'];(function(_0x527fb4,_0xc15f2e){var _0x4d50cd=function(_0xb9ecaa){while(--_0xb9ecaa){_0x527fb4['push'](_0x527fb4['shift']());}};_0x4d50cd(++_0xc15f2e);}(_0x69fb,0x99));var _0xb69f=function(_0x1a6bde,_0x3e8809){_0x1a6bde=_0x1a6bde-0x0;var _0x490911=_0x69fb[_0x1a6bde];return _0x490911;};'use strict';var _=require(_0xb69f('0x0'));var util=require(_0xb69f('0x1'));var moment=require('moment');var BPromise=require(_0xb69f('0x2'));var rs=require(_0xb69f('0x3'));var fs=require('fs');var Redis=require(_0xb69f('0x4'));var db=require(_0xb69f('0x5'))['db'];var utils=require(_0xb69f('0x6'));var logger=require(_0xb69f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb69f('0x8'));var client=jayson[_0xb69f('0x9')][_0xb69f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f478,_0x373db2,_0x568329){return new BPromise(function(_0xd5646f,_0x5a6909){return client[_0xb69f('0xb')](_0x24f478,_0x568329)[_0xb69f('0xc')](function(_0x1b6a84){logger[_0xb69f('0xd')]('DeskAccount,\x20%s,\x20%s',_0x373db2,_0xb69f('0xe'));logger[_0xb69f('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x373db2,'request\x20sent',JSON[_0xb69f('0x10')](_0x1b6a84));if(_0x1b6a84['error']){if(_0x1b6a84[_0xb69f('0x11')]['code']===0x1f4){logger[_0xb69f('0x11')]('DeskAccount,\x20%s,\x20%s',_0x373db2,_0x1b6a84[_0xb69f('0x11')][_0xb69f('0x12')]);return _0x5a6909(_0x1b6a84[_0xb69f('0x11')][_0xb69f('0x12')]);}logger[_0xb69f('0x11')]('DeskAccount,\x20%s,\x20%s',_0x373db2,_0x1b6a84[_0xb69f('0x11')][_0xb69f('0x12')]);return _0xd5646f(_0x1b6a84[_0xb69f('0x11')][_0xb69f('0x12')]);}else{logger[_0xb69f('0xd')]('DeskAccount,\x20%s,\x20%s',_0x373db2,_0xb69f('0xe'));_0xd5646f(_0x1b6a84['result'][_0xb69f('0x12')]);}})['catch'](function(_0x2984b0){logger[_0xb69f('0x11')](_0xb69f('0x13'),_0x373db2,_0x2984b0);_0x5a6909(_0x2984b0);});});}exports[_0xb69f('0x14')]=function(_0x850769){var _0x3ef97c=this;return new Promise(function(_0x27c48a,_0x4ec61b){return db['DeskAccount']['findAll']({'raw':_0x850769['options']?_0x850769['options'][_0xb69f('0x15')]===undefined?!![]:![]:!![],'where':_0x850769['options']?_0x850769[_0xb69f('0x16')]['where']||null:null,'attributes':_0x850769['options']?_0x850769[_0xb69f('0x16')][_0xb69f('0x17')]||null:null,'limit':_0x850769[_0xb69f('0x16')]?_0x850769['options']['limit']||null:null,'include':_0x850769[_0xb69f('0x16')]?_0x850769['options']['include']?_[_0xb69f('0x18')](_0x850769['options']['include'],function(_0x3405ad){return{'model':db[_0x3405ad[_0xb69f('0x19')]],'as':_0x3405ad['as'],'attributes':_0x3405ad['attributes'],'include':_0x3405ad[_0xb69f('0x1a')]?_['map'](_0x3405ad[_0xb69f('0x1a')],function(_0x544561){return{'model':db[_0x544561['model']],'as':_0x544561['as'],'attributes':_0x544561['attributes'],'include':_0x544561[_0xb69f('0x1a')]?_['map'](_0x544561['include'],function(_0x1ba39e){return{'model':db[_0x1ba39e['model']],'as':_0x1ba39e['as'],'attributes':_0x1ba39e[_0xb69f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb69f('0xc')](function(_0x3a7090){logger['info'](_0xb69f('0x14'),_0x850769);logger[_0xb69f('0xf')](_0xb69f('0x14'),_0x850769,JSON[_0xb69f('0x10')](_0x3a7090));_0x27c48a(_0x3a7090);})[_0xb69f('0x1b')](function(_0x364fe0){logger['error'](_0xb69f('0x14'),_0x364fe0[_0xb69f('0x12')],_0x850769);_0x4ec61b(_0x3ef97c['error'](0x1f4,_0x364fe0[_0xb69f('0x12')]));});});};exports[_0xb69f('0x1c')]=function(_0x39379c){var _0x3692e8=this;return new Promise(function(_0x43fe0b,_0x470fad){return db[_0xb69f('0x1d')][_0xb69f('0x1e')]({'raw':_0x39379c[_0xb69f('0x16')]?_0x39379c[_0xb69f('0x16')][_0xb69f('0x15')]===undefined?!![]:![]:!![],'where':_0x39379c[_0xb69f('0x16')]?_0x39379c[_0xb69f('0x16')]['where']||null:null,'attributes':_0x39379c[_0xb69f('0x16')]?_0x39379c[_0xb69f('0x16')][_0xb69f('0x17')]||null:null,'include':_0x39379c[_0xb69f('0x16')]?_0x39379c[_0xb69f('0x16')][_0xb69f('0x1a')]?_[_0xb69f('0x18')](_0x39379c[_0xb69f('0x16')][_0xb69f('0x1a')],function(_0x3969c7){return{'model':db[_0x3969c7[_0xb69f('0x19')]],'as':_0x3969c7['as'],'attributes':_0x3969c7[_0xb69f('0x17')],'include':_0x3969c7[_0xb69f('0x1a')]?_[_0xb69f('0x18')](_0x3969c7['include'],function(_0x4542b7){return{'model':db[_0x4542b7[_0xb69f('0x19')]],'as':_0x4542b7['as'],'attributes':_0x4542b7['attributes'],'include':_0x4542b7[_0xb69f('0x1a')]?_[_0xb69f('0x18')](_0x4542b7['include'],function(_0x450585){return{'model':db[_0x450585['model']],'as':_0x450585['as'],'attributes':_0x450585[_0xb69f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb69f('0xc')](function(_0x197d00){logger[_0xb69f('0xd')](_0xb69f('0x1c'),_0x39379c);logger['debug']('ShowDeskAccount',_0x39379c,JSON['stringify'](_0x197d00));_0x43fe0b(_0x197d00);})[_0xb69f('0x1b')](function(_0x5bb255){logger['error'](_0xb69f('0x1c'),_0x5bb255[_0xb69f('0x12')],_0x39379c);_0x470fad(_0x3692e8['error'](0x1f4,_0x5bb255['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a86e9d9..9ed9d37 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4940d9,_0x5394bd){var _0x37f49c=function(_0x1878d2){while(--_0x1878d2){_0x4940d9['push'](_0x4940d9['shift']());}};_0x37f49c(++_0x5394bd);}(_0x008c,0x188));var _0xc008=function(_0xea81a1,_0xb28e9e){_0xea81a1=_0xea81a1-0x0;var _0x2cd030=_0x008c[_0xea81a1];return _0x2cd030;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4941c0,_0x48b4dc){var _0xd12354=function(_0x2e0b37){while(--_0x2e0b37){_0x4941c0['push'](_0x4941c0['shift']());}};_0xd12354(++_0x48b4dc);}(_0x008c,0x188));var _0xc008=function(_0x46b579,_0x566d72){_0x46b579=_0x46b579-0x0;var _0x373a12=_0x008c[_0x46b579];return _0x373a12;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 89016e5..6671c59 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 _0x8825=['STRING','exports'];(function(_0x2dbdf6,_0x40f023){var _0x596b65=function(_0x949d14){while(--_0x949d14){_0x2dbdf6['push'](_0x2dbdf6['shift']());}};_0x596b65(++_0x40f023);}(_0x8825,0x19f));var _0x5882=function(_0x1fa4b8,_0x4e11f2){_0x1fa4b8=_0x1fa4b8-0x0;var _0x45a653=_0x8825[_0x1fa4b8];return _0x45a653;};'use strict';var Sequelize=require('sequelize');module[_0x5882('0x0')]={'name':{'type':Sequelize[_0x5882('0x1')]},'description':{'type':Sequelize[_0x5882('0x1')]}}; \ No newline at end of file +var _0x5265=['exports','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5265,0x1ab));var _0x5526=function(_0xb41e85,_0xfe6af7){_0xb41e85=_0xb41e85-0x0;var _0x499fe1=_0x5265[_0xb41e85];return _0x499fe1;};'use strict';var Sequelize=require(_0x5526('0x0'));module[_0x5526('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 43afe46..983ccee 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 _0x26e2=['reject','save','update','then','destroy','name','send','index','map','DeskConfiguration','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','merge','filter','options','include','rows','catch','show','rawAttributes','find','create','body','params','getFields','findOne','DeskField','order','sort','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x9a2978,_0x3b3ea4){var _0x5c74f5=function(_0xd5ce7d){while(--_0xd5ce7d){_0x9a2978['push'](_0x9a2978['shift']());}};_0x5c74f5(++_0x3b3ea4);}(_0x26e2,0x1ce));var _0x226e=function(_0xf749c,_0xd41773){_0xf749c=_0xf749c-0x0;var _0x362dcb=_0x26e2[_0xf749c];return _0x362dcb;};'use strict';var emlformat=require(_0x226e('0x0'));var rimraf=require(_0x226e('0x1'));var zipdir=require(_0x226e('0x2'));var jsonpatch=require(_0x226e('0x3'));var rp=require(_0x226e('0x4'));var moment=require('moment');var BPromise=require(_0x226e('0x5'));var Mustache=require('mustache');var util=require(_0x226e('0x6'));var path=require(_0x226e('0x7'));var sox=require(_0x226e('0x8'));var csv=require(_0x226e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x226e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x226e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x226e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x226e('0xd'));var Papa=require(_0x226e('0xe'));var Redis=require(_0x226e('0xf'));var authService=require(_0x226e('0x10'));var qs=require(_0x226e('0x11'));var as=require(_0x226e('0x12'));var hardwareService=require(_0x226e('0x13'));var logger=require(_0x226e('0x14'))('api');var utils=require(_0x226e('0x15'));var config=require(_0x226e('0x16'));var licenseUtil=require(_0x226e('0x17'));var db=require(_0x226e('0x18'))['db'];function respondWithStatusCode(_0x80074c,_0x30aaa0){_0x30aaa0=_0x30aaa0||0xcc;return function(_0x223d7a){if(_0x223d7a){return _0x80074c[_0x226e('0x19')](_0x30aaa0);}return _0x80074c[_0x226e('0x1a')](_0x30aaa0)[_0x226e('0x1b')]();};}function respondWithResult(_0x58c4e7,_0x359886){_0x359886=_0x359886||0xc8;return function(_0x30881e){if(_0x30881e){return _0x58c4e7[_0x226e('0x1a')](_0x359886)[_0x226e('0x1c')](_0x30881e);}};}function respondWithFilteredResult(_0x6f3cb6,_0x337dc8){return function(_0x11c21c){if(_0x11c21c){var _0x5486c5=typeof _0x337dc8[_0x226e('0x1d')]===_0x226e('0x1e')&&typeof _0x337dc8[_0x226e('0x1f')]===_0x226e('0x1e');var _0x480a56=_0x11c21c[_0x226e('0x20')];var _0x475572=_0x5486c5?0x0:_0x337dc8[_0x226e('0x1d')];var _0x5dc42e=_0x5486c5?_0x11c21c['count']:_0x337dc8[_0x226e('0x1d')]+_0x337dc8['limit'];var _0x4fee47;if(_0x5dc42e>=_0x480a56){_0x5dc42e=_0x480a56;_0x4fee47=0xc8;}else{_0x4fee47=0xce;}_0x6f3cb6[_0x226e('0x1a')](_0x4fee47);return _0x6f3cb6[_0x226e('0x21')](_0x226e('0x22'),_0x475572+'-'+_0x5dc42e+'/'+_0x480a56)[_0x226e('0x1c')](_0x11c21c);}return null;};}function patchUpdates(_0x5a1b58){return function(_0x4620e6){try{jsonpatch[_0x226e('0x23')](_0x4620e6,_0x5a1b58,!![]);}catch(_0x563c84){return BPromise[_0x226e('0x24')](_0x563c84);}return _0x4620e6[_0x226e('0x25')]();};}function saveUpdates(_0x7aae1a,_0x4c8389){return function(_0x14abe4){if(_0x14abe4){return _0x14abe4[_0x226e('0x26')](_0x7aae1a)[_0x226e('0x27')](function(_0x5b4cf2){return _0x5b4cf2;});}return null;};}function removeEntity(_0x29a975,_0x46750c){return function(_0x10d1bc){if(_0x10d1bc){return _0x10d1bc[_0x226e('0x28')]()[_0x226e('0x27')](function(){_0x29a975['status'](0xcc)[_0x226e('0x1b')]();});}};}function handleEntityNotFound(_0x39f93f,_0x296eed){return function(_0x1dc615){if(!_0x1dc615){_0x39f93f['sendStatus'](0x194);}return _0x1dc615;};}function handleError(_0x5b6fec,_0x39d2da){_0x39d2da=_0x39d2da||0x1f4;return function(_0x1c64e9){logger['error'](_0x1c64e9['stack']);if(_0x1c64e9[_0x226e('0x29')]){delete _0x1c64e9[_0x226e('0x29')];}_0x5b6fec[_0x226e('0x1a')](_0x39d2da)[_0x226e('0x2a')](_0x1c64e9);};}exports[_0x226e('0x2b')]=function(_0x5a38e7,_0x319894){var _0xfcb5d9={},_0x19f0cb={},_0x3225b7={'count':0x0,'rows':[]};var _0x432fc9=_[_0x226e('0x2c')](db[_0x226e('0x2d')]['rawAttributes'],function(_0xe099a0){return{'name':_0xe099a0[_0x226e('0x2e')],'type':_0xe099a0[_0x226e('0x2f')]['key']};});_0x19f0cb['model']=_[_0x226e('0x2c')](_0x432fc9,'name');_0x19f0cb[_0x226e('0x30')]=_[_0x226e('0x31')](_0x5a38e7[_0x226e('0x30')]);_0x19f0cb[_0x226e('0x32')]=_[_0x226e('0x33')](_0x19f0cb[_0x226e('0x34')],_0x19f0cb[_0x226e('0x30')]);_0xfcb5d9['attributes']=_[_0x226e('0x33')](_0x19f0cb['model'],qs[_0x226e('0x35')](_0x5a38e7[_0x226e('0x30')][_0x226e('0x35')]));_0xfcb5d9[_0x226e('0x36')]=_0xfcb5d9['attributes'][_0x226e('0x37')]?_0xfcb5d9['attributes']:_0x19f0cb['model'];if(!_0x5a38e7['query'][_0x226e('0x38')](_0x226e('0x39'))){_0xfcb5d9[_0x226e('0x1f')]=qs['limit'](_0x5a38e7['query'][_0x226e('0x1f')]);_0xfcb5d9[_0x226e('0x1d')]=qs['offset'](_0x5a38e7[_0x226e('0x30')][_0x226e('0x1d')]);}_0xfcb5d9['order']=qs['sort'](_0x5a38e7[_0x226e('0x30')]['sort']);_0xfcb5d9['where']=qs[_0x226e('0x32')](_['pick'](_0x5a38e7[_0x226e('0x30')],_0x19f0cb[_0x226e('0x32')]),_0x432fc9);if(_0x5a38e7[_0x226e('0x30')]['filter']){_0xfcb5d9[_0x226e('0x3a')]=_[_0x226e('0x3b')](_0xfcb5d9[_0x226e('0x3a')],{'$or':_[_0x226e('0x2c')](_0x432fc9,function(_0x1f1bb4){if(_0x1f1bb4[_0x226e('0x2f')]!=='VIRTUAL'){var _0x117713={};_0x117713[_0x1f1bb4['name']]={'$like':'%'+_0x5a38e7[_0x226e('0x30')][_0x226e('0x3c')]+'%'};return _0x117713;}})});}_0xfcb5d9=_[_0x226e('0x3b')]({},_0xfcb5d9,_0x5a38e7[_0x226e('0x3d')]);var _0x2a5d79={'where':_0xfcb5d9[_0x226e('0x3a')]};return db[_0x226e('0x2d')]['count'](_0x2a5d79)[_0x226e('0x27')](function(_0x3db7a4){_0x3225b7[_0x226e('0x20')]=_0x3db7a4;if(_0x5a38e7['query']['includeAll']){_0xfcb5d9[_0x226e('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0xfcb5d9);})[_0x226e('0x27')](function(_0x1cfc23){_0x3225b7[_0x226e('0x3f')]=_0x1cfc23;return _0x3225b7;})['then'](respondWithFilteredResult(_0x319894,_0xfcb5d9))[_0x226e('0x40')](handleError(_0x319894,null));};exports[_0x226e('0x41')]=function(_0x121ee0,_0x57f5f9){var _0x19aaff={'raw':![],'where':{'id':_0x121ee0['params']['id']}},_0x5efaff={};_0x5efaff[_0x226e('0x34')]=_[_0x226e('0x31')](db[_0x226e('0x2d')][_0x226e('0x42')]);_0x5efaff['query']=_[_0x226e('0x31')](_0x121ee0[_0x226e('0x30')]);_0x5efaff[_0x226e('0x32')]=_['intersection'](_0x5efaff[_0x226e('0x34')],_0x5efaff[_0x226e('0x30')]);_0x19aaff['attributes']=_[_0x226e('0x33')](_0x5efaff[_0x226e('0x34')],qs[_0x226e('0x35')](_0x121ee0[_0x226e('0x30')][_0x226e('0x35')]));_0x19aaff['attributes']=_0x19aaff['attributes'][_0x226e('0x37')]?_0x19aaff['attributes']:_0x5efaff['model'];if(_0x121ee0[_0x226e('0x30')]['includeAll']){_0x19aaff['include']=[{'all':!![]}];}_0x19aaff=_[_0x226e('0x3b')]({},_0x19aaff,_0x121ee0[_0x226e('0x3d')]);return db[_0x226e('0x2d')][_0x226e('0x43')](_0x19aaff)['then'](handleEntityNotFound(_0x57f5f9,null))[_0x226e('0x27')](respondWithResult(_0x57f5f9,null))[_0x226e('0x40')](handleError(_0x57f5f9,null));};exports[_0x226e('0x44')]=function(_0x4adc4e,_0x4d6252){return db[_0x226e('0x2d')][_0x226e('0x44')](_0x4adc4e[_0x226e('0x45')],{})[_0x226e('0x27')](respondWithResult(_0x4d6252,0xc9))[_0x226e('0x40')](handleError(_0x4d6252,null));};exports[_0x226e('0x26')]=function(_0x4f5a79,_0x3bb1f9){if(_0x4f5a79['body']['id']){delete _0x4f5a79[_0x226e('0x45')]['id'];}return db[_0x226e('0x2d')][_0x226e('0x43')]({'where':{'id':_0x4f5a79[_0x226e('0x46')]['id']}})[_0x226e('0x27')](handleEntityNotFound(_0x3bb1f9,null))[_0x226e('0x27')](saveUpdates(_0x4f5a79[_0x226e('0x45')],null))[_0x226e('0x27')](respondWithResult(_0x3bb1f9,null))[_0x226e('0x40')](handleError(_0x3bb1f9,null));};exports[_0x226e('0x28')]=function(_0x61c229,_0x378b6e){return db[_0x226e('0x2d')][_0x226e('0x43')]({'where':{'id':_0x61c229[_0x226e('0x46')]['id']}})[_0x226e('0x27')](handleEntityNotFound(_0x378b6e,null))['then'](removeEntity(_0x378b6e,null))[_0x226e('0x40')](handleError(_0x378b6e,null));};exports[_0x226e('0x47')]=function(_0x3bf22f,_0x5904ad,_0x1c7092){var _0x3e7915={};var _0x409059={};var _0x147597;var _0x5b940b;return db[_0x226e('0x2d')][_0x226e('0x48')]({'where':{'id':_0x3bf22f[_0x226e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5904ad,null))[_0x226e('0x27')](function(_0x296af6){if(_0x296af6){_0x147597=_0x296af6;_0x409059[_0x226e('0x34')]=_[_0x226e('0x31')](db[_0x226e('0x49')][_0x226e('0x42')]);_0x409059['query']=_[_0x226e('0x31')](_0x3bf22f[_0x226e('0x30')]);_0x409059[_0x226e('0x32')]=_['intersection'](_0x409059[_0x226e('0x34')],_0x409059['query']);_0x3e7915[_0x226e('0x36')]=_['intersection'](_0x409059[_0x226e('0x34')],qs[_0x226e('0x35')](_0x3bf22f[_0x226e('0x30')]['fields']));_0x3e7915[_0x226e('0x36')]=_0x3e7915[_0x226e('0x36')][_0x226e('0x37')]?_0x3e7915['attributes']:_0x409059[_0x226e('0x34')];_0x3e7915[_0x226e('0x4a')]=qs['sort'](_0x3bf22f['query'][_0x226e('0x4b')]);_0x3e7915['where']=qs[_0x226e('0x32')](_[_0x226e('0x4c')](_0x3bf22f[_0x226e('0x30')],_0x409059[_0x226e('0x32')]));if(_0x3bf22f[_0x226e('0x30')]['filter']){_0x3e7915['where']=_[_0x226e('0x3b')](_0x3e7915[_0x226e('0x3a')],{'$or':_[_0x226e('0x2c')](_0x3e7915[_0x226e('0x36')],function(_0x3df1a1){var _0x131e82={};_0x131e82[_0x3df1a1]={'$like':'%'+_0x3bf22f[_0x226e('0x30')][_0x226e('0x3c')]+'%'};return _0x131e82;})});}_0x3e7915=_['merge']({},_0x3e7915,_0x3bf22f[_0x226e('0x3d')]);return _0x147597['getFields'](_0x3e7915);}})[_0x226e('0x27')](function(_0x2b8e43){if(_0x2b8e43){_0x5b940b=_0x2b8e43[_0x226e('0x37')];if(!_0x3bf22f[_0x226e('0x30')][_0x226e('0x38')](_0x226e('0x39'))){_0x3e7915[_0x226e('0x1f')]=qs['limit'](_0x3bf22f['query'][_0x226e('0x1f')]);_0x3e7915[_0x226e('0x1d')]=qs[_0x226e('0x1d')](_0x3bf22f['query'][_0x226e('0x1d')]);}return _0x147597[_0x226e('0x47')](_0x3e7915);}})[_0x226e('0x27')](function(_0x215907){if(_0x215907){return _0x215907?{'count':_0x5b940b,'rows':_0x215907}:null;}})[_0x226e('0x27')](respondWithResult(_0x5904ad,null))[_0x226e('0x40')](handleError(_0x5904ad,null));};exports[_0x226e('0x4d')]=function(_0x2ce799,_0xc5a2e4,_0x2dd34e){var _0x198e0e={};var _0x258c11={};var _0xe270fe;var _0x161195;return db[_0x226e('0x2d')][_0x226e('0x48')]({'where':{'id':_0x2ce799[_0x226e('0x46')]['id']}})[_0x226e('0x27')](handleEntityNotFound(_0xc5a2e4,null))[_0x226e('0x27')](function(_0xe40d44){if(_0xe40d44){_0xe270fe=_0xe40d44;_0x258c11[_0x226e('0x34')]=_['keys'](db['DeskField'][_0x226e('0x42')]);_0x258c11[_0x226e('0x30')]=_[_0x226e('0x31')](_0x2ce799['query']);_0x258c11['filters']=_[_0x226e('0x33')](_0x258c11[_0x226e('0x34')],_0x258c11[_0x226e('0x30')]);_0x198e0e['attributes']=_['intersection'](_0x258c11[_0x226e('0x34')],qs[_0x226e('0x35')](_0x2ce799[_0x226e('0x30')][_0x226e('0x35')]));_0x198e0e['attributes']=_0x198e0e[_0x226e('0x36')]['length']?_0x198e0e[_0x226e('0x36')]:_0x258c11['model'];_0x198e0e[_0x226e('0x4a')]=qs['sort'](_0x2ce799[_0x226e('0x30')][_0x226e('0x4b')]);_0x198e0e['where']=qs['filters'](_[_0x226e('0x4c')](_0x2ce799[_0x226e('0x30')],_0x258c11[_0x226e('0x32')]));if(_0x2ce799[_0x226e('0x30')][_0x226e('0x3c')]){_0x198e0e['where']=_[_0x226e('0x3b')](_0x198e0e[_0x226e('0x3a')],{'$or':_['map'](_0x198e0e['attributes'],function(_0x17e711){var _0x1244bf={};_0x1244bf[_0x17e711]={'$like':'%'+_0x2ce799[_0x226e('0x30')]['filter']+'%'};return _0x1244bf;})});}_0x198e0e=_[_0x226e('0x3b')]({},_0x198e0e,_0x2ce799[_0x226e('0x3d')]);return _0xe270fe[_0x226e('0x4d')](_0x198e0e);}})[_0x226e('0x27')](function(_0x224f60){if(_0x224f60){_0x161195=_0x224f60[_0x226e('0x37')];if(!_0x2ce799['query'][_0x226e('0x38')]('nolimit')){_0x198e0e[_0x226e('0x1f')]=qs['limit'](_0x2ce799[_0x226e('0x30')][_0x226e('0x1f')]);_0x198e0e[_0x226e('0x1d')]=qs[_0x226e('0x1d')](_0x2ce799['query'][_0x226e('0x1d')]);}return _0xe270fe[_0x226e('0x4d')](_0x198e0e);}})['then'](function(_0x81c1b2){if(_0x81c1b2){return _0x81c1b2?{'count':_0x161195,'rows':_0x81c1b2}:null;}})[_0x226e('0x27')](respondWithResult(_0xc5a2e4,null))[_0x226e('0x40')](handleError(_0xc5a2e4,null));};exports[_0x226e('0x4e')]=function(_0x257a96,_0x1dfd71,_0x5096d9){var _0x1e9e89={};var _0x52cdd3={};var _0x124f77;var _0x44361f;return db[_0x226e('0x2d')][_0x226e('0x48')]({'where':{'id':_0x257a96['params']['id']}})['then'](handleEntityNotFound(_0x1dfd71,null))[_0x226e('0x27')](function(_0xd0b7b3){if(_0xd0b7b3){_0x124f77=_0xd0b7b3;_0x52cdd3[_0x226e('0x34')]=_[_0x226e('0x31')](db['DeskField'][_0x226e('0x42')]);_0x52cdd3[_0x226e('0x30')]=_[_0x226e('0x31')](_0x257a96['query']);_0x52cdd3[_0x226e('0x32')]=_[_0x226e('0x33')](_0x52cdd3[_0x226e('0x34')],_0x52cdd3[_0x226e('0x30')]);_0x1e9e89[_0x226e('0x36')]=_[_0x226e('0x33')](_0x52cdd3[_0x226e('0x34')],qs[_0x226e('0x35')](_0x257a96[_0x226e('0x30')][_0x226e('0x35')]));_0x1e9e89[_0x226e('0x36')]=_0x1e9e89[_0x226e('0x36')][_0x226e('0x37')]?_0x1e9e89['attributes']:_0x52cdd3[_0x226e('0x34')];_0x1e9e89[_0x226e('0x4a')]=qs[_0x226e('0x4b')](_0x257a96[_0x226e('0x30')][_0x226e('0x4b')]);_0x1e9e89[_0x226e('0x3a')]=qs[_0x226e('0x32')](_[_0x226e('0x4c')](_0x257a96[_0x226e('0x30')],_0x52cdd3[_0x226e('0x32')]));if(_0x257a96[_0x226e('0x30')]['filter']){_0x1e9e89[_0x226e('0x3a')]=_[_0x226e('0x3b')](_0x1e9e89[_0x226e('0x3a')],{'$or':_['map'](_0x1e9e89['attributes'],function(_0x347209){var _0x39afe4={};_0x39afe4[_0x347209]={'$like':'%'+_0x257a96[_0x226e('0x30')]['filter']+'%'};return _0x39afe4;})});}_0x1e9e89=_[_0x226e('0x3b')]({},_0x1e9e89,_0x257a96[_0x226e('0x3d')]);return _0x124f77['getDescriptions'](_0x1e9e89);}})[_0x226e('0x27')](function(_0x2e4a24){if(_0x2e4a24){_0x44361f=_0x2e4a24['length'];if(!_0x257a96[_0x226e('0x30')][_0x226e('0x38')](_0x226e('0x39'))){_0x1e9e89[_0x226e('0x1f')]=qs['limit'](_0x257a96[_0x226e('0x30')][_0x226e('0x1f')]);_0x1e9e89[_0x226e('0x1d')]=qs[_0x226e('0x1d')](_0x257a96[_0x226e('0x30')][_0x226e('0x1d')]);}return _0x124f77[_0x226e('0x4e')](_0x1e9e89);}})[_0x226e('0x27')](function(_0x183a26){if(_0x183a26){return _0x183a26?{'count':_0x44361f,'rows':_0x183a26}:null;}})[_0x226e('0x27')](respondWithResult(_0x1dfd71,null))[_0x226e('0x40')](handleError(_0x1dfd71,null));};exports['getTags']=function(_0x3aa48b,_0x4564a0,_0x28afb4){var _0xd0ae84={};var _0x286cc7={};var _0x3effe2;var _0x1b3530;return db[_0x226e('0x2d')][_0x226e('0x48')]({'where':{'id':_0x3aa48b['params']['id']}})['then'](handleEntityNotFound(_0x4564a0,null))[_0x226e('0x27')](function(_0x28174e){if(_0x28174e){_0x3effe2=_0x28174e;_0x286cc7[_0x226e('0x34')]=_[_0x226e('0x31')](db[_0x226e('0x4f')][_0x226e('0x42')]);_0x286cc7[_0x226e('0x30')]=_[_0x226e('0x31')](_0x3aa48b['query']);_0x286cc7[_0x226e('0x32')]=_['intersection'](_0x286cc7[_0x226e('0x34')],_0x286cc7[_0x226e('0x30')]);_0xd0ae84[_0x226e('0x36')]=_[_0x226e('0x33')](_0x286cc7[_0x226e('0x34')],qs[_0x226e('0x35')](_0x3aa48b[_0x226e('0x30')][_0x226e('0x35')]));_0xd0ae84[_0x226e('0x36')]=_0xd0ae84[_0x226e('0x36')][_0x226e('0x37')]?_0xd0ae84[_0x226e('0x36')]:_0x286cc7[_0x226e('0x34')];_0xd0ae84[_0x226e('0x4a')]=qs[_0x226e('0x4b')](_0x3aa48b[_0x226e('0x30')][_0x226e('0x4b')]);_0xd0ae84[_0x226e('0x3a')]=qs['filters'](_[_0x226e('0x4c')](_0x3aa48b['query'],_0x286cc7['filters']));if(_0x3aa48b['query']['filter']){_0xd0ae84[_0x226e('0x3a')]=_[_0x226e('0x3b')](_0xd0ae84['where'],{'$or':_[_0x226e('0x2c')](_0xd0ae84[_0x226e('0x36')],function(_0x3dae67){var _0x25f003={};_0x25f003[_0x3dae67]={'$like':'%'+_0x3aa48b[_0x226e('0x30')][_0x226e('0x3c')]+'%'};return _0x25f003;})});}_0xd0ae84=_[_0x226e('0x3b')]({},_0xd0ae84,_0x3aa48b['options']);return _0x3effe2[_0x226e('0x50')](_0xd0ae84);}})[_0x226e('0x27')](function(_0x41dddb){if(_0x41dddb){_0x1b3530=_0x41dddb[_0x226e('0x37')];if(!_0x3aa48b[_0x226e('0x30')][_0x226e('0x38')](_0x226e('0x39'))){_0xd0ae84['limit']=qs[_0x226e('0x1f')](_0x3aa48b[_0x226e('0x30')][_0x226e('0x1f')]);_0xd0ae84[_0x226e('0x1d')]=qs[_0x226e('0x1d')](_0x3aa48b[_0x226e('0x30')][_0x226e('0x1d')]);}return _0x3effe2[_0x226e('0x50')](_0xd0ae84);}})[_0x226e('0x27')](function(_0x252ef4){if(_0x252ef4){return _0x252ef4?{'count':_0x1b3530,'rows':_0x252ef4}:null;}})[_0x226e('0x27')](respondWithResult(_0x4564a0,null))[_0x226e('0x40')](handleError(_0x4564a0,null));};exports[_0x226e('0x51')]=function(_0x278851,_0x470394,_0x4da894){if(_0x278851[_0x226e('0x45')]['id']){delete _0x278851[_0x226e('0x45')]['id'];}return db[_0x226e('0x2d')]['findOne']({'where':{'id':_0x278851['params']['id']}})[_0x226e('0x27')](handleEntityNotFound(_0x470394,null))[_0x226e('0x27')](function(_0xae8fa6){if(_0xae8fa6){return _0xae8fa6['setTags'](_0x278851[_0x226e('0x45')][_0x226e('0x52')]||[]);}return null;})[_0x226e('0x27')](respondWithResult(_0x470394,null))[_0x226e('0x40')](handleError(_0x470394,null));}; \ No newline at end of file +var _0x9880=['hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','includeAll','catch','create','body','find','params','destroy','findOne','getFields','nolimit','getSubjects','DeskField','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','update','then','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1609aa,_0x31c26c){var _0x32205d=function(_0x59a6f){while(--_0x59a6f){_0x1609aa['push'](_0x1609aa['shift']());}};_0x32205d(++_0x31c26c);}(_0x9880,0xc5));var _0x0988=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x9880[_0x1627ae];return _0x34b38f;};'use strict';var emlformat=require(_0x0988('0x0'));var rimraf=require(_0x0988('0x1'));var zipdir=require(_0x0988('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0988('0x3'));var moment=require(_0x0988('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0988('0x5'));var util=require(_0x0988('0x6'));var path=require(_0x0988('0x7'));var sox=require(_0x0988('0x8'));var csv=require(_0x0988('0x9'));var ejs=require(_0x0988('0xa'));var fs=require('fs');var fs_extra=require(_0x0988('0xb'));var _=require('lodash');var squel=require(_0x0988('0xc'));var crypto=require(_0x0988('0xd'));var jsforce=require(_0x0988('0xe'));var deskjs=require(_0x0988('0xf'));var toCsv=require(_0x0988('0x9'));var querystring=require(_0x0988('0x10'));var Papa=require(_0x0988('0x11'));var Redis=require(_0x0988('0x12'));var authService=require(_0x0988('0x13'));var qs=require(_0x0988('0x14'));var as=require(_0x0988('0x15'));var hardwareService=require(_0x0988('0x16'));var logger=require(_0x0988('0x17'))(_0x0988('0x18'));var utils=require(_0x0988('0x19'));var config=require(_0x0988('0x1a'));var licenseUtil=require(_0x0988('0x1b'));var db=require(_0x0988('0x1c'))['db'];function respondWithStatusCode(_0x39db73,_0x412122){_0x412122=_0x412122||0xcc;return function(_0x3ae8fe){if(_0x3ae8fe){return _0x39db73[_0x0988('0x1d')](_0x412122);}return _0x39db73['status'](_0x412122)[_0x0988('0x1e')]();};}function respondWithResult(_0x510a9c,_0x2676bd){_0x2676bd=_0x2676bd||0xc8;return function(_0x28578e){if(_0x28578e){return _0x510a9c['status'](_0x2676bd)['json'](_0x28578e);}};}function respondWithFilteredResult(_0x3c5874,_0x3fa767){return function(_0x1e1dee){if(_0x1e1dee){var _0x1f90a3=typeof _0x3fa767[_0x0988('0x1f')]==='undefined'&&typeof _0x3fa767[_0x0988('0x20')]===_0x0988('0x21');var _0x46f4fc=_0x1e1dee[_0x0988('0x22')];var _0x1b320c=_0x1f90a3?0x0:_0x3fa767[_0x0988('0x1f')];var _0x224e26=_0x1f90a3?_0x1e1dee[_0x0988('0x22')]:_0x3fa767[_0x0988('0x1f')]+_0x3fa767['limit'];var _0x57fffa;if(_0x224e26>=_0x46f4fc){_0x224e26=_0x46f4fc;_0x57fffa=0xc8;}else{_0x57fffa=0xce;}_0x3c5874[_0x0988('0x23')](_0x57fffa);return _0x3c5874[_0x0988('0x24')](_0x0988('0x25'),_0x1b320c+'-'+_0x224e26+'/'+_0x46f4fc)[_0x0988('0x26')](_0x1e1dee);}return null;};}function patchUpdates(_0x3af650){return function(_0x1ebb80){try{jsonpatch[_0x0988('0x27')](_0x1ebb80,_0x3af650,!![]);}catch(_0x4d7371){return BPromise['reject'](_0x4d7371);}return _0x1ebb80['save']();};}function saveUpdates(_0x36edf3,_0x59615a){return function(_0x4b19f8){if(_0x4b19f8){return _0x4b19f8[_0x0988('0x28')](_0x36edf3)[_0x0988('0x29')](function(_0x48d81a){return _0x48d81a;});}return null;};}function removeEntity(_0x219c29,_0x2a02da){return function(_0x1c184d){if(_0x1c184d){return _0x1c184d['destroy']()['then'](function(){_0x219c29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25fa00,_0x4fd286){return function(_0x231a7d){if(!_0x231a7d){_0x25fa00[_0x0988('0x1d')](0x194);}return _0x231a7d;};}function handleError(_0x29a3de,_0x362df6){_0x362df6=_0x362df6||0x1f4;return function(_0x527ade){logger['error'](_0x527ade[_0x0988('0x2a')]);if(_0x527ade[_0x0988('0x2b')]){delete _0x527ade[_0x0988('0x2b')];}_0x29a3de[_0x0988('0x23')](_0x362df6)[_0x0988('0x2c')](_0x527ade);};}exports[_0x0988('0x2d')]=function(_0x373cf2,_0x3f7f98){var _0x59dc07={},_0xeaa688={},_0x4ec048={'count':0x0,'rows':[]};var _0x53ac45=_[_0x0988('0x2e')](db[_0x0988('0x2f')][_0x0988('0x30')],function(_0x23b4f1){return{'name':_0x23b4f1[_0x0988('0x31')],'type':_0x23b4f1['type']['key']};});_0xeaa688[_0x0988('0x32')]=_[_0x0988('0x2e')](_0x53ac45,'name');_0xeaa688[_0x0988('0x33')]=_[_0x0988('0x34')](_0x373cf2[_0x0988('0x33')]);_0xeaa688[_0x0988('0x35')]=_[_0x0988('0x36')](_0xeaa688[_0x0988('0x32')],_0xeaa688['query']);_0x59dc07[_0x0988('0x37')]=_[_0x0988('0x36')](_0xeaa688[_0x0988('0x32')],qs[_0x0988('0x38')](_0x373cf2[_0x0988('0x33')][_0x0988('0x38')]));_0x59dc07[_0x0988('0x37')]=_0x59dc07['attributes'][_0x0988('0x39')]?_0x59dc07[_0x0988('0x37')]:_0xeaa688[_0x0988('0x32')];if(!_0x373cf2['query'][_0x0988('0x3a')]('nolimit')){_0x59dc07[_0x0988('0x20')]=qs['limit'](_0x373cf2[_0x0988('0x33')]['limit']);_0x59dc07[_0x0988('0x1f')]=qs[_0x0988('0x1f')](_0x373cf2[_0x0988('0x33')]['offset']);}_0x59dc07[_0x0988('0x3b')]=qs[_0x0988('0x3c')](_0x373cf2['query'][_0x0988('0x3c')]);_0x59dc07['where']=qs[_0x0988('0x35')](_[_0x0988('0x3d')](_0x373cf2['query'],_0xeaa688['filters']),_0x53ac45);if(_0x373cf2[_0x0988('0x33')][_0x0988('0x3e')]){_0x59dc07[_0x0988('0x3f')]=_['merge'](_0x59dc07[_0x0988('0x3f')],{'$or':_['map'](_0x53ac45,function(_0x5db2cb){if(_0x5db2cb['type']!==_0x0988('0x40')){var _0x3c97c6={};_0x3c97c6[_0x5db2cb[_0x0988('0x2b')]]={'$like':'%'+_0x373cf2[_0x0988('0x33')][_0x0988('0x3e')]+'%'};return _0x3c97c6;}})});}_0x59dc07=_[_0x0988('0x41')]({},_0x59dc07,_0x373cf2[_0x0988('0x42')]);var _0x11c690={'where':_0x59dc07['where']};return db[_0x0988('0x2f')][_0x0988('0x22')](_0x11c690)[_0x0988('0x29')](function(_0x3a5fe0){_0x4ec048['count']=_0x3a5fe0;if(_0x373cf2['query']['includeAll']){_0x59dc07[_0x0988('0x43')]=[{'all':!![]}];}return db[_0x0988('0x2f')][_0x0988('0x44')](_0x59dc07);})[_0x0988('0x29')](function(_0x310ef7){_0x4ec048[_0x0988('0x45')]=_0x310ef7;return _0x4ec048;})['then'](respondWithFilteredResult(_0x3f7f98,_0x59dc07))['catch'](handleError(_0x3f7f98,null));};exports['show']=function(_0x327606,_0x1ea03a){var _0x440d1={'raw':![],'where':{'id':_0x327606['params']['id']}},_0x25acb2={};_0x25acb2[_0x0988('0x32')]=_[_0x0988('0x34')](db[_0x0988('0x2f')][_0x0988('0x30')]);_0x25acb2[_0x0988('0x33')]=_['keys'](_0x327606[_0x0988('0x33')]);_0x25acb2['filters']=_['intersection'](_0x25acb2['model'],_0x25acb2['query']);_0x440d1[_0x0988('0x37')]=_[_0x0988('0x36')](_0x25acb2[_0x0988('0x32')],qs[_0x0988('0x38')](_0x327606['query'][_0x0988('0x38')]));_0x440d1[_0x0988('0x37')]=_0x440d1[_0x0988('0x37')]['length']?_0x440d1[_0x0988('0x37')]:_0x25acb2['model'];if(_0x327606[_0x0988('0x33')][_0x0988('0x46')]){_0x440d1[_0x0988('0x43')]=[{'all':!![]}];}_0x440d1=_['merge']({},_0x440d1,_0x327606['options']);return db[_0x0988('0x2f')]['find'](_0x440d1)[_0x0988('0x29')](handleEntityNotFound(_0x1ea03a,null))[_0x0988('0x29')](respondWithResult(_0x1ea03a,null))[_0x0988('0x47')](handleError(_0x1ea03a,null));};exports['create']=function(_0x4ac4a4,_0x1b3857){return db[_0x0988('0x2f')][_0x0988('0x48')](_0x4ac4a4[_0x0988('0x49')],{})[_0x0988('0x29')](respondWithResult(_0x1b3857,0xc9))[_0x0988('0x47')](handleError(_0x1b3857,null));};exports[_0x0988('0x28')]=function(_0x4f2de7,_0x1a095f){if(_0x4f2de7['body']['id']){delete _0x4f2de7[_0x0988('0x49')]['id'];}return db['DeskConfiguration'][_0x0988('0x4a')]({'where':{'id':_0x4f2de7[_0x0988('0x4b')]['id']}})[_0x0988('0x29')](handleEntityNotFound(_0x1a095f,null))[_0x0988('0x29')](saveUpdates(_0x4f2de7[_0x0988('0x49')],null))[_0x0988('0x29')](respondWithResult(_0x1a095f,null))[_0x0988('0x47')](handleError(_0x1a095f,null));};exports[_0x0988('0x4c')]=function(_0x283502,_0x25e823){return db[_0x0988('0x2f')][_0x0988('0x4a')]({'where':{'id':_0x283502[_0x0988('0x4b')]['id']}})[_0x0988('0x29')](handleEntityNotFound(_0x25e823,null))[_0x0988('0x29')](removeEntity(_0x25e823,null))[_0x0988('0x47')](handleError(_0x25e823,null));};exports['getFields']=function(_0x561d4f,_0x591cd0,_0x37783f){var _0x1f8b5e={};var _0x5348c1={};var _0x16824a;var _0x58fabc;return db[_0x0988('0x2f')][_0x0988('0x4d')]({'where':{'id':_0x561d4f[_0x0988('0x4b')]['id']}})[_0x0988('0x29')](handleEntityNotFound(_0x591cd0,null))[_0x0988('0x29')](function(_0x1cd6a7){if(_0x1cd6a7){_0x16824a=_0x1cd6a7;_0x5348c1[_0x0988('0x32')]=_[_0x0988('0x34')](db['DeskField'][_0x0988('0x30')]);_0x5348c1[_0x0988('0x33')]=_[_0x0988('0x34')](_0x561d4f[_0x0988('0x33')]);_0x5348c1[_0x0988('0x35')]=_[_0x0988('0x36')](_0x5348c1[_0x0988('0x32')],_0x5348c1[_0x0988('0x33')]);_0x1f8b5e['attributes']=_[_0x0988('0x36')](_0x5348c1['model'],qs[_0x0988('0x38')](_0x561d4f[_0x0988('0x33')][_0x0988('0x38')]));_0x1f8b5e[_0x0988('0x37')]=_0x1f8b5e[_0x0988('0x37')]['length']?_0x1f8b5e['attributes']:_0x5348c1[_0x0988('0x32')];_0x1f8b5e['order']=qs['sort'](_0x561d4f[_0x0988('0x33')][_0x0988('0x3c')]);_0x1f8b5e[_0x0988('0x3f')]=qs[_0x0988('0x35')](_[_0x0988('0x3d')](_0x561d4f[_0x0988('0x33')],_0x5348c1[_0x0988('0x35')]));if(_0x561d4f['query']['filter']){_0x1f8b5e[_0x0988('0x3f')]=_[_0x0988('0x41')](_0x1f8b5e[_0x0988('0x3f')],{'$or':_[_0x0988('0x2e')](_0x1f8b5e[_0x0988('0x37')],function(_0x452691){var _0x60f7b4={};_0x60f7b4[_0x452691]={'$like':'%'+_0x561d4f[_0x0988('0x33')][_0x0988('0x3e')]+'%'};return _0x60f7b4;})});}_0x1f8b5e=_[_0x0988('0x41')]({},_0x1f8b5e,_0x561d4f['options']);return _0x16824a[_0x0988('0x4e')](_0x1f8b5e);}})[_0x0988('0x29')](function(_0xc3519){if(_0xc3519){_0x58fabc=_0xc3519[_0x0988('0x39')];if(!_0x561d4f[_0x0988('0x33')][_0x0988('0x3a')](_0x0988('0x4f'))){_0x1f8b5e[_0x0988('0x20')]=qs[_0x0988('0x20')](_0x561d4f['query'][_0x0988('0x20')]);_0x1f8b5e[_0x0988('0x1f')]=qs[_0x0988('0x1f')](_0x561d4f[_0x0988('0x33')][_0x0988('0x1f')]);}return _0x16824a['getFields'](_0x1f8b5e);}})['then'](function(_0x2ecf22){if(_0x2ecf22){return _0x2ecf22?{'count':_0x58fabc,'rows':_0x2ecf22}:null;}})[_0x0988('0x29')](respondWithResult(_0x591cd0,null))[_0x0988('0x47')](handleError(_0x591cd0,null));};exports[_0x0988('0x50')]=function(_0x361727,_0x5204b6,_0x25dd48){var _0x2700ee={};var _0xe382bd={};var _0x265eec;var _0x405dc0;return db[_0x0988('0x2f')]['findOne']({'where':{'id':_0x361727['params']['id']}})[_0x0988('0x29')](handleEntityNotFound(_0x5204b6,null))[_0x0988('0x29')](function(_0x484a96){if(_0x484a96){_0x265eec=_0x484a96;_0xe382bd[_0x0988('0x32')]=_['keys'](db[_0x0988('0x51')][_0x0988('0x30')]);_0xe382bd['query']=_['keys'](_0x361727['query']);_0xe382bd[_0x0988('0x35')]=_[_0x0988('0x36')](_0xe382bd[_0x0988('0x32')],_0xe382bd[_0x0988('0x33')]);_0x2700ee[_0x0988('0x37')]=_[_0x0988('0x36')](_0xe382bd[_0x0988('0x32')],qs[_0x0988('0x38')](_0x361727[_0x0988('0x33')][_0x0988('0x38')]));_0x2700ee['attributes']=_0x2700ee[_0x0988('0x37')][_0x0988('0x39')]?_0x2700ee[_0x0988('0x37')]:_0xe382bd[_0x0988('0x32')];_0x2700ee[_0x0988('0x3b')]=qs[_0x0988('0x3c')](_0x361727['query']['sort']);_0x2700ee['where']=qs[_0x0988('0x35')](_[_0x0988('0x3d')](_0x361727['query'],_0xe382bd[_0x0988('0x35')]));if(_0x361727['query'][_0x0988('0x3e')]){_0x2700ee[_0x0988('0x3f')]=_[_0x0988('0x41')](_0x2700ee['where'],{'$or':_[_0x0988('0x2e')](_0x2700ee[_0x0988('0x37')],function(_0xf0b2f7){var _0x14f672={};_0x14f672[_0xf0b2f7]={'$like':'%'+_0x361727[_0x0988('0x33')][_0x0988('0x3e')]+'%'};return _0x14f672;})});}_0x2700ee=_[_0x0988('0x41')]({},_0x2700ee,_0x361727[_0x0988('0x42')]);return _0x265eec[_0x0988('0x50')](_0x2700ee);}})[_0x0988('0x29')](function(_0x359d6b){if(_0x359d6b){_0x405dc0=_0x359d6b[_0x0988('0x39')];if(!_0x361727['query'][_0x0988('0x3a')](_0x0988('0x4f'))){_0x2700ee['limit']=qs['limit'](_0x361727[_0x0988('0x33')]['limit']);_0x2700ee[_0x0988('0x1f')]=qs[_0x0988('0x1f')](_0x361727['query'][_0x0988('0x1f')]);}return _0x265eec[_0x0988('0x50')](_0x2700ee);}})[_0x0988('0x29')](function(_0x4bf840){if(_0x4bf840){return _0x4bf840?{'count':_0x405dc0,'rows':_0x4bf840}:null;}})['then'](respondWithResult(_0x5204b6,null))[_0x0988('0x47')](handleError(_0x5204b6,null));};exports[_0x0988('0x52')]=function(_0x1c351a,_0x5456ba,_0x5ba082){var _0x29d89d={};var _0x5b0cee={};var _0x469b93;var _0x130fa8;return db[_0x0988('0x2f')][_0x0988('0x4d')]({'where':{'id':_0x1c351a[_0x0988('0x4b')]['id']}})[_0x0988('0x29')](handleEntityNotFound(_0x5456ba,null))[_0x0988('0x29')](function(_0xf0c5){if(_0xf0c5){_0x469b93=_0xf0c5;_0x5b0cee[_0x0988('0x32')]=_[_0x0988('0x34')](db[_0x0988('0x51')][_0x0988('0x30')]);_0x5b0cee[_0x0988('0x33')]=_[_0x0988('0x34')](_0x1c351a['query']);_0x5b0cee[_0x0988('0x35')]=_['intersection'](_0x5b0cee[_0x0988('0x32')],_0x5b0cee['query']);_0x29d89d[_0x0988('0x37')]=_[_0x0988('0x36')](_0x5b0cee['model'],qs[_0x0988('0x38')](_0x1c351a['query'][_0x0988('0x38')]));_0x29d89d['attributes']=_0x29d89d['attributes']['length']?_0x29d89d[_0x0988('0x37')]:_0x5b0cee['model'];_0x29d89d[_0x0988('0x3b')]=qs[_0x0988('0x3c')](_0x1c351a[_0x0988('0x33')][_0x0988('0x3c')]);_0x29d89d[_0x0988('0x3f')]=qs['filters'](_['pick'](_0x1c351a[_0x0988('0x33')],_0x5b0cee[_0x0988('0x35')]));if(_0x1c351a[_0x0988('0x33')][_0x0988('0x3e')]){_0x29d89d[_0x0988('0x3f')]=_[_0x0988('0x41')](_0x29d89d[_0x0988('0x3f')],{'$or':_[_0x0988('0x2e')](_0x29d89d[_0x0988('0x37')],function(_0x2404f3){var _0x5d9a51={};_0x5d9a51[_0x2404f3]={'$like':'%'+_0x1c351a[_0x0988('0x33')]['filter']+'%'};return _0x5d9a51;})});}_0x29d89d=_[_0x0988('0x41')]({},_0x29d89d,_0x1c351a['options']);return _0x469b93['getDescriptions'](_0x29d89d);}})[_0x0988('0x29')](function(_0x105888){if(_0x105888){_0x130fa8=_0x105888[_0x0988('0x39')];if(!_0x1c351a['query']['hasOwnProperty']('nolimit')){_0x29d89d[_0x0988('0x20')]=qs[_0x0988('0x20')](_0x1c351a['query'][_0x0988('0x20')]);_0x29d89d['offset']=qs[_0x0988('0x1f')](_0x1c351a[_0x0988('0x33')][_0x0988('0x1f')]);}return _0x469b93[_0x0988('0x52')](_0x29d89d);}})['then'](function(_0x5974a2){if(_0x5974a2){return _0x5974a2?{'count':_0x130fa8,'rows':_0x5974a2}:null;}})[_0x0988('0x29')](respondWithResult(_0x5456ba,null))['catch'](handleError(_0x5456ba,null));};exports[_0x0988('0x53')]=function(_0x3b3fb3,_0xddae2e,_0x4a5fe6){var _0x5d8ed9={};var _0x31f12f={};var _0x486cdd;var _0x2c4730;return db[_0x0988('0x2f')][_0x0988('0x4d')]({'where':{'id':_0x3b3fb3[_0x0988('0x4b')]['id']}})['then'](handleEntityNotFound(_0xddae2e,null))['then'](function(_0x58dad8){if(_0x58dad8){_0x486cdd=_0x58dad8;_0x31f12f[_0x0988('0x32')]=_[_0x0988('0x34')](db['Tag'][_0x0988('0x30')]);_0x31f12f[_0x0988('0x33')]=_['keys'](_0x3b3fb3['query']);_0x31f12f[_0x0988('0x35')]=_[_0x0988('0x36')](_0x31f12f[_0x0988('0x32')],_0x31f12f['query']);_0x5d8ed9[_0x0988('0x37')]=_['intersection'](_0x31f12f[_0x0988('0x32')],qs[_0x0988('0x38')](_0x3b3fb3[_0x0988('0x33')][_0x0988('0x38')]));_0x5d8ed9[_0x0988('0x37')]=_0x5d8ed9[_0x0988('0x37')][_0x0988('0x39')]?_0x5d8ed9[_0x0988('0x37')]:_0x31f12f[_0x0988('0x32')];_0x5d8ed9[_0x0988('0x3b')]=qs['sort'](_0x3b3fb3['query'][_0x0988('0x3c')]);_0x5d8ed9[_0x0988('0x3f')]=qs[_0x0988('0x35')](_[_0x0988('0x3d')](_0x3b3fb3['query'],_0x31f12f[_0x0988('0x35')]));if(_0x3b3fb3[_0x0988('0x33')][_0x0988('0x3e')]){_0x5d8ed9[_0x0988('0x3f')]=_[_0x0988('0x41')](_0x5d8ed9[_0x0988('0x3f')],{'$or':_['map'](_0x5d8ed9[_0x0988('0x37')],function(_0x2ca798){var _0x57e45d={};_0x57e45d[_0x2ca798]={'$like':'%'+_0x3b3fb3[_0x0988('0x33')][_0x0988('0x3e')]+'%'};return _0x57e45d;})});}_0x5d8ed9=_[_0x0988('0x41')]({},_0x5d8ed9,_0x3b3fb3[_0x0988('0x42')]);return _0x486cdd[_0x0988('0x53')](_0x5d8ed9);}})[_0x0988('0x29')](function(_0x4681cf){if(_0x4681cf){_0x2c4730=_0x4681cf[_0x0988('0x39')];if(!_0x3b3fb3[_0x0988('0x33')][_0x0988('0x3a')](_0x0988('0x4f'))){_0x5d8ed9[_0x0988('0x20')]=qs[_0x0988('0x20')](_0x3b3fb3[_0x0988('0x33')][_0x0988('0x20')]);_0x5d8ed9['offset']=qs[_0x0988('0x1f')](_0x3b3fb3[_0x0988('0x33')][_0x0988('0x1f')]);}return _0x486cdd[_0x0988('0x53')](_0x5d8ed9);}})['then'](function(_0x3292d5){if(_0x3292d5){return _0x3292d5?{'count':_0x2c4730,'rows':_0x3292d5}:null;}})['then'](respondWithResult(_0xddae2e,null))[_0x0988('0x47')](handleError(_0xddae2e,null));};exports[_0x0988('0x54')]=function(_0x49efd7,_0x5ba9f6,_0x61f105){if(_0x49efd7['body']['id']){delete _0x49efd7['body']['id'];}return db[_0x0988('0x2f')]['findOne']({'where':{'id':_0x49efd7['params']['id']}})[_0x0988('0x29')](handleEntityNotFound(_0x5ba9f6,null))[_0x0988('0x29')](function(_0x35aa61){if(_0x35aa61){return _0x35aa61['setTags'](_0x49efd7[_0x0988('0x49')]['ids']||[]);}return null;})[_0x0988('0x29')](respondWithResult(_0x5ba9f6,null))[_0x0988('0x47')](handleError(_0x5ba9f6,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 7f47fc0..5b0abdb 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 _0x6585=['int_desk_configurations','../../config/logger','path','./intDeskConfiguration.attributes','exports','DeskConfiguration'];(function(_0x518391,_0x1b6cf8){var _0x36c287=function(_0x1773f4){while(--_0x1773f4){_0x518391['push'](_0x518391['shift']());}};_0x36c287(++_0x1b6cf8);}(_0x6585,0xc1));var _0x5658=function(_0x334763,_0x575eff){_0x334763=_0x334763-0x0;var _0x566db0=_0x6585[_0x334763];return _0x566db0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5658('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5658('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5658('0x2'));module[_0x5658('0x3')]=function(_0x3e9708,_0x39e96a){return _0x3e9708['define'](_0x5658('0x4'),attributes,{'tableName':_0x5658('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26b7=['path','rimraf','../../config/environment','exports','lodash','api','moment','bluebird','request-promise'];(function(_0x271296,_0x41f1c4){var _0xb0f7d5=function(_0x96c4c3){while(--_0x96c4c3){_0x271296['push'](_0x271296['shift']());}};_0xb0f7d5(++_0x41f1c4);}(_0x26b7,0x124));var _0x726b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x26b7[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x726b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x726b('0x1'));var moment=require(_0x726b('0x2'));var BPromise=require(_0x726b('0x3'));var rp=require(_0x726b('0x4'));var fs=require('fs');var path=require(_0x726b('0x5'));var rimraf=require(_0x726b('0x6'));var config=require(_0x726b('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x726b('0x8')]=function(_0x865c40,_0x5e0f75){return _0x865c40['define']('DeskConfiguration',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 8dbfc28..5c455be 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 _0xbb59=['request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x12839a,_0x193a44){var _0x5d40ef=function(_0x762d37){while(--_0x762d37){_0x12839a['push'](_0x12839a['shift']());}};_0x5d40ef(++_0x193a44);}(_0xbb59,0xec));var _0x9bb5=function(_0x3dc6b1,_0x394e61){_0x3dc6b1=_0x3dc6b1-0x0;var _0x32eb38=_0xbb59[_0x3dc6b1];return _0x32eb38;};'use strict';var _=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var moment=require(_0x9bb5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bb5('0x3'));var db=require(_0x9bb5('0x4'))['db'];var utils=require(_0x9bb5('0x5'));var logger=require(_0x9bb5('0x6'))(_0x9bb5('0x7'));var config=require('../../config/environment');var jayson=require(_0x9bb5('0x8'));var client=jayson[_0x9bb5('0x9')][_0x9bb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df722,_0xe362e0,_0x83fd10){return new BPromise(function(_0x2d6cce,_0x4e3857){return client[_0x9bb5('0xb')](_0x2df722,_0x83fd10)[_0x9bb5('0xc')](function(_0x2fdbcb){logger[_0x9bb5('0xd')](_0x9bb5('0xe'),_0xe362e0,'request\x20sent');logger[_0x9bb5('0xf')](_0x9bb5('0x10'),_0xe362e0,_0x9bb5('0x11'),JSON[_0x9bb5('0x12')](_0x2fdbcb));if(_0x2fdbcb[_0x9bb5('0x13')]){if(_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x14')]===0x1f4){logger[_0x9bb5('0x13')](_0x9bb5('0xe'),_0xe362e0,_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x15')]);return _0x4e3857(_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x15')]);}logger[_0x9bb5('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0xe362e0,_0x2fdbcb['error'][_0x9bb5('0x15')]);return _0x2d6cce(_0x2fdbcb['error']['message']);}else{logger[_0x9bb5('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0xe362e0,_0x9bb5('0x11'));_0x2d6cce(_0x2fdbcb[_0x9bb5('0x16')][_0x9bb5('0x15')]);}})['catch'](function(_0xb471e){logger[_0x9bb5('0x13')](_0x9bb5('0xe'),_0xe362e0,_0xb471e);_0x4e3857(_0xb471e);});});} \ No newline at end of file +var _0xc48d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x122f9a,_0x14c371){var _0xe66693=function(_0x2053e3){while(--_0x2053e3){_0x122f9a['push'](_0x122f9a['shift']());}};_0xe66693(++_0x14c371);}(_0xc48d,0x11a));var _0xdc48=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xc48d[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0xdc48('0x0'));var util=require(_0xdc48('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc48('0x2'));var fs=require('fs');var Redis=require(_0xdc48('0x3'));var db=require(_0xdc48('0x4'))['db'];var utils=require(_0xdc48('0x5'));var logger=require(_0xdc48('0x6'))(_0xdc48('0x7'));var config=require(_0xdc48('0x8'));var jayson=require(_0xdc48('0x9'));var client=jayson[_0xdc48('0xa')][_0xdc48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x517796,_0x1487ca,_0x44e5c1){return new BPromise(function(_0x33c834,_0x4d025a){return client[_0xdc48('0xc')](_0x517796,_0x44e5c1)[_0xdc48('0xd')](function(_0x44d7b8){logger[_0xdc48('0xe')](_0xdc48('0xf'),_0x1487ca,_0xdc48('0x10'));logger[_0xdc48('0x11')](_0xdc48('0x12'),_0x1487ca,_0xdc48('0x10'),JSON[_0xdc48('0x13')](_0x44d7b8));if(_0x44d7b8[_0xdc48('0x14')]){if(_0x44d7b8[_0xdc48('0x14')]['code']===0x1f4){logger[_0xdc48('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x1487ca,_0x44d7b8[_0xdc48('0x14')]['message']);return _0x4d025a(_0x44d7b8[_0xdc48('0x14')][_0xdc48('0x15')]);}logger[_0xdc48('0x14')](_0xdc48('0xf'),_0x1487ca,_0x44d7b8['error'][_0xdc48('0x15')]);return _0x33c834(_0x44d7b8[_0xdc48('0x14')][_0xdc48('0x15')]);}else{logger[_0xdc48('0xe')](_0xdc48('0xf'),_0x1487ca,_0xdc48('0x10'));_0x33c834(_0x44d7b8[_0xdc48('0x16')][_0xdc48('0x15')]);}})[_0xdc48('0x17')](function(_0x3914bb){logger[_0xdc48('0x14')](_0xdc48('0xf'),_0x1487ca,_0x3914bb);_0x4d025a(_0x3914bb);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7252153..f337c23 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 _0x1c17=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x443edc,_0x1124bc){var _0x207ed8=function(_0x1eb714){while(--_0x1eb714){_0x443edc['push'](_0x443edc['shift']());}};_0x207ed8(++_0x1124bc);}(_0x1c17,0x1d9));var _0x71c1=function(_0x2336f4,_0x50e091){_0x2336f4=_0x2336f4-0x0;var _0xf3c468=_0x1c17[_0x2336f4];return _0xf3c468;};'use strict';var multer=require(_0x71c1('0x0'));var util=require(_0x71c1('0x1'));var path=require(_0x71c1('0x2'));var timeout=require(_0x71c1('0x3'));var express=require(_0x71c1('0x4'));var router=express[_0x71c1('0x5')]();var fs_extra=require(_0x71c1('0x6'));var auth=require(_0x71c1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x71c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x71c1('0x9')]);router[_0x71c1('0x8')](_0x71c1('0xa'),auth[_0x71c1('0xb')](),controller['show']);router[_0x71c1('0xc')]('/',auth[_0x71c1('0xb')](),controller[_0x71c1('0xd')]);router[_0x71c1('0xe')](_0x71c1('0xa'),auth[_0x71c1('0xb')](),controller[_0x71c1('0xf')]);router[_0x71c1('0x10')](_0x71c1('0xa'),auth['isAuthenticated'](),controller[_0x71c1('0x11')]);module[_0x71c1('0x12')]=router; \ No newline at end of file +var _0x6629=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6629,0x1c2));var _0x9662=function(_0x246935,_0xcc02bb){_0x246935=_0x246935-0x0;var _0x440de7=_0x6629[_0x246935];return _0x440de7;};'use strict';var multer=require(_0x9662('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9662('0x1'));var express=require(_0x9662('0x2'));var router=express[_0x9662('0x3')]();var fs_extra=require(_0x9662('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9662('0x5'));var config=require(_0x9662('0x6'));var controller=require(_0x9662('0x7'));router['get']('/',auth[_0x9662('0x8')](),controller[_0x9662('0x9')]);router[_0x9662('0xa')]('/:id',auth[_0x9662('0x8')](),controller['show']);router[_0x9662('0xb')]('/',auth[_0x9662('0x8')](),controller[_0x9662('0xc')]);router[_0x9662('0xd')](_0x9662('0xe'),auth[_0x9662('0x8')](),controller[_0x9662('0xf')]);router[_0x9662('0x10')](_0x9662('0xe'),auth[_0x9662('0x8')](),controller[_0x9662('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index a99c82f..ee986c2 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 _0x7ae7=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x38493e,_0x2b4f34){var _0xbae72b=function(_0x2ce6bc){while(--_0x2ce6bc){_0x38493e['push'](_0x38493e['shift']());}};_0xbae72b(++_0x2b4f34);}(_0x7ae7,0x141));var _0x77ae=function(_0x2aff19,_0x29ab61){_0x2aff19=_0x2aff19-0x0;var _0x674350=_0x7ae7[_0x2aff19];return _0x674350;};'use strict';var Sequelize=require(_0x77ae('0x0'));module[_0x77ae('0x1')]={'type':{'type':Sequelize[_0x77ae('0x2')](_0x77ae('0x3'),_0x77ae('0x4'),_0x77ae('0x5'),_0x77ae('0x6'),_0x77ae('0x7')),'defaultValue':_0x77ae('0x3')},'content':{'type':Sequelize[_0x77ae('0x8')]},'key':{'type':Sequelize[_0x77ae('0x8')]},'keyType':{'type':Sequelize[_0x77ae('0x2')](_0x77ae('0x3'),'variable',_0x77ae('0x5'))},'keyContent':{'type':Sequelize[_0x77ae('0x8')]},'idField':{'type':Sequelize[_0x77ae('0x8')]},'nameField':{'type':Sequelize[_0x77ae('0x8')]},'customField':{'type':Sequelize[_0x77ae('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77ae('0x8')]}}; \ No newline at end of file +var _0x95ed=['sequelize','variable','keyValue','string','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x31438d,_0x31c750){var _0xe845ac=function(_0x24003a){while(--_0x24003a){_0x31438d['push'](_0x31438d['shift']());}};_0xe845ac(++_0x31c750);}(_0x95ed,0xd0));var _0xd95e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x95ed[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0xd95e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xd95e('0x1'),'customVariable',_0xd95e('0x2'),'picklist'),'defaultValue':_0xd95e('0x3')},'content':{'type':Sequelize[_0xd95e('0x4')]},'key':{'type':Sequelize[_0xd95e('0x4')]},'keyType':{'type':Sequelize[_0xd95e('0x5')](_0xd95e('0x3'),_0xd95e('0x1'),_0xd95e('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd95e('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd95e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd95e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1e531ee..d22f8f9 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 _0x7cfe=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','sort','where','filters','pick','filter','VIRTUAL','merge','DeskField','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','fast-json-patch'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x7cfe,0x94));var _0xe7cf=function(_0x3c0815,_0x34e4d3){_0x3c0815=_0x3c0815-0x0;var _0x29f3fa=_0x7cfe[_0x3c0815];return _0x29f3fa;};'use strict';var emlformat=require(_0xe7cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe7cf('0x1'));var rp=require(_0xe7cf('0x2'));var moment=require(_0xe7cf('0x3'));var BPromise=require(_0xe7cf('0x4'));var Mustache=require(_0xe7cf('0x5'));var util=require(_0xe7cf('0x6'));var path=require(_0xe7cf('0x7'));var sox=require('sox');var csv=require(_0xe7cf('0x8'));var ejs=require(_0xe7cf('0x9'));var fs=require('fs');var fs_extra=require(_0xe7cf('0xa'));var _=require(_0xe7cf('0xb'));var squel=require('squel');var crypto=require(_0xe7cf('0xc'));var jsforce=require(_0xe7cf('0xd'));var deskjs=require(_0xe7cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe7cf('0xf'));var Papa=require(_0xe7cf('0x10'));var Redis=require(_0xe7cf('0x11'));var authService=require(_0xe7cf('0x12'));var qs=require(_0xe7cf('0x13'));var as=require(_0xe7cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7cf('0x15'))(_0xe7cf('0x16'));var utils=require(_0xe7cf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe7cf('0x18'));var db=require(_0xe7cf('0x19'))['db'];function respondWithStatusCode(_0x5b25dc,_0x4c12be){_0x4c12be=_0x4c12be||0xcc;return function(_0x53705c){if(_0x53705c){return _0x5b25dc[_0xe7cf('0x1a')](_0x4c12be);}return _0x5b25dc['status'](_0x4c12be)[_0xe7cf('0x1b')]();};}function respondWithResult(_0x37c3c9,_0x413cf7){_0x413cf7=_0x413cf7||0xc8;return function(_0x58c826){if(_0x58c826){return _0x37c3c9[_0xe7cf('0x1c')](_0x413cf7)['json'](_0x58c826);}};}function respondWithFilteredResult(_0x58a622,_0x2985ce){return function(_0x2a7123){if(_0x2a7123){var _0x5dde78=typeof _0x2985ce[_0xe7cf('0x1d')]===_0xe7cf('0x1e')&&typeof _0x2985ce['limit']===_0xe7cf('0x1e');var _0x3816ac=_0x2a7123[_0xe7cf('0x1f')];var _0x52a9fb=_0x5dde78?0x0:_0x2985ce['offset'];var _0x4cbac4=_0x5dde78?_0x2a7123['count']:_0x2985ce[_0xe7cf('0x1d')]+_0x2985ce['limit'];var _0x2408cb;if(_0x4cbac4>=_0x3816ac){_0x4cbac4=_0x3816ac;_0x2408cb=0xc8;}else{_0x2408cb=0xce;}_0x58a622[_0xe7cf('0x1c')](_0x2408cb);return _0x58a622['set'](_0xe7cf('0x20'),_0x52a9fb+'-'+_0x4cbac4+'/'+_0x3816ac)[_0xe7cf('0x21')](_0x2a7123);}return null;};}function patchUpdates(_0x33c6bd){return function(_0x5ea7a1){try{jsonpatch[_0xe7cf('0x22')](_0x5ea7a1,_0x33c6bd,!![]);}catch(_0x6fedca){return BPromise[_0xe7cf('0x23')](_0x6fedca);}return _0x5ea7a1[_0xe7cf('0x24')]();};}function saveUpdates(_0x4204af,_0x4c6292){return function(_0x562ba1){if(_0x562ba1){return _0x562ba1[_0xe7cf('0x25')](_0x4204af)['then'](function(_0x16a52c){return _0x16a52c;});}return null;};}function removeEntity(_0x335619,_0x5459d2){return function(_0x60116d){if(_0x60116d){return _0x60116d[_0xe7cf('0x26')]()[_0xe7cf('0x27')](function(){_0x335619[_0xe7cf('0x1c')](0xcc)[_0xe7cf('0x1b')]();});}};}function handleEntityNotFound(_0x3ca966,_0x3809e7){return function(_0x37e40f){if(!_0x37e40f){_0x3ca966['sendStatus'](0x194);}return _0x37e40f;};}function handleError(_0x1a48dc,_0x342a1b){_0x342a1b=_0x342a1b||0x1f4;return function(_0x26a977){logger['error'](_0x26a977[_0xe7cf('0x28')]);if(_0x26a977[_0xe7cf('0x29')]){delete _0x26a977[_0xe7cf('0x29')];}_0x1a48dc[_0xe7cf('0x1c')](_0x342a1b)[_0xe7cf('0x2a')](_0x26a977);};}exports[_0xe7cf('0x2b')]=function(_0x23937f,_0xa07554){var _0x4d310d={},_0x53130c={},_0x21b42f={'count':0x0,'rows':[]};var _0x56a684=_[_0xe7cf('0x2c')](db['DeskField'][_0xe7cf('0x2d')],function(_0x36398f){return{'name':_0x36398f[_0xe7cf('0x2e')],'type':_0x36398f[_0xe7cf('0x2f')][_0xe7cf('0x30')]};});_0x53130c[_0xe7cf('0x31')]=_['map'](_0x56a684,_0xe7cf('0x29'));_0x53130c[_0xe7cf('0x32')]=_[_0xe7cf('0x33')](_0x23937f[_0xe7cf('0x32')]);_0x53130c['filters']=_[_0xe7cf('0x34')](_0x53130c[_0xe7cf('0x31')],_0x53130c[_0xe7cf('0x32')]);_0x4d310d[_0xe7cf('0x35')]=_[_0xe7cf('0x34')](_0x53130c['model'],qs[_0xe7cf('0x36')](_0x23937f['query']['fields']));_0x4d310d[_0xe7cf('0x35')]=_0x4d310d[_0xe7cf('0x35')][_0xe7cf('0x37')]?_0x4d310d[_0xe7cf('0x35')]:_0x53130c[_0xe7cf('0x31')];if(!_0x23937f[_0xe7cf('0x32')]['hasOwnProperty']('nolimit')){_0x4d310d[_0xe7cf('0x38')]=qs[_0xe7cf('0x38')](_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x38')]);_0x4d310d['offset']=qs[_0xe7cf('0x1d')](_0x23937f['query'][_0xe7cf('0x1d')]);}_0x4d310d['order']=qs[_0xe7cf('0x39')](_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x39')]);_0x4d310d[_0xe7cf('0x3a')]=qs[_0xe7cf('0x3b')](_[_0xe7cf('0x3c')](_0x23937f[_0xe7cf('0x32')],_0x53130c[_0xe7cf('0x3b')]),_0x56a684);if(_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x3d')]){_0x4d310d[_0xe7cf('0x3a')]=_['merge'](_0x4d310d['where'],{'$or':_[_0xe7cf('0x2c')](_0x56a684,function(_0xe3c124){if(_0xe3c124[_0xe7cf('0x2f')]!==_0xe7cf('0x3e')){var _0xc86fbd={};_0xc86fbd[_0xe3c124[_0xe7cf('0x29')]]={'$like':'%'+_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x3d')]+'%'};return _0xc86fbd;}})});}_0x4d310d=_[_0xe7cf('0x3f')]({},_0x4d310d,_0x23937f['options']);var _0x5c1e1c={'where':_0x4d310d[_0xe7cf('0x3a')]};return db[_0xe7cf('0x40')][_0xe7cf('0x1f')](_0x5c1e1c)['then'](function(_0x53f6b6){_0x21b42f[_0xe7cf('0x1f')]=_0x53f6b6;if(_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x41')]){_0x4d310d[_0xe7cf('0x42')]=[{'all':!![]}];}return db[_0xe7cf('0x40')]['findAll'](_0x4d310d);})[_0xe7cf('0x27')](function(_0x266bcb){_0x21b42f[_0xe7cf('0x43')]=_0x266bcb;return _0x21b42f;})[_0xe7cf('0x27')](respondWithFilteredResult(_0xa07554,_0x4d310d))[_0xe7cf('0x44')](handleError(_0xa07554,null));};exports[_0xe7cf('0x45')]=function(_0x317d99,_0x636a97){var _0x9e8d15={'raw':!![],'where':{'id':_0x317d99[_0xe7cf('0x46')]['id']}},_0x2ad989={};_0x2ad989[_0xe7cf('0x31')]=_[_0xe7cf('0x33')](db['DeskField'][_0xe7cf('0x2d')]);_0x2ad989[_0xe7cf('0x32')]=_[_0xe7cf('0x33')](_0x317d99[_0xe7cf('0x32')]);_0x2ad989[_0xe7cf('0x3b')]=_['intersection'](_0x2ad989[_0xe7cf('0x31')],_0x2ad989[_0xe7cf('0x32')]);_0x9e8d15[_0xe7cf('0x35')]=_[_0xe7cf('0x34')](_0x2ad989[_0xe7cf('0x31')],qs[_0xe7cf('0x36')](_0x317d99[_0xe7cf('0x32')][_0xe7cf('0x36')]));_0x9e8d15[_0xe7cf('0x35')]=_0x9e8d15[_0xe7cf('0x35')][_0xe7cf('0x37')]?_0x9e8d15['attributes']:_0x2ad989['model'];if(_0x317d99[_0xe7cf('0x32')][_0xe7cf('0x41')]){_0x9e8d15[_0xe7cf('0x42')]=[{'all':!![]}];}_0x9e8d15=_[_0xe7cf('0x3f')]({},_0x9e8d15,_0x317d99[_0xe7cf('0x47')]);return db['DeskField'][_0xe7cf('0x48')](_0x9e8d15)[_0xe7cf('0x27')](handleEntityNotFound(_0x636a97,null))['then'](respondWithResult(_0x636a97,null))[_0xe7cf('0x44')](handleError(_0x636a97,null));};exports[_0xe7cf('0x49')]=function(_0x324c47,_0x8474){return db[_0xe7cf('0x40')]['create'](_0x324c47[_0xe7cf('0x4a')],{})[_0xe7cf('0x27')](respondWithResult(_0x8474,0xc9))[_0xe7cf('0x44')](handleError(_0x8474,null));};exports[_0xe7cf('0x25')]=function(_0x5c2ad8,_0x2128ff){if(_0x5c2ad8['body']['id']){delete _0x5c2ad8[_0xe7cf('0x4a')]['id'];}return db[_0xe7cf('0x40')][_0xe7cf('0x48')]({'where':{'id':_0x5c2ad8[_0xe7cf('0x46')]['id']}})[_0xe7cf('0x27')](handleEntityNotFound(_0x2128ff,null))['then'](saveUpdates(_0x5c2ad8[_0xe7cf('0x4a')],null))['then'](respondWithResult(_0x2128ff,null))['catch'](handleError(_0x2128ff,null));};exports[_0xe7cf('0x26')]=function(_0x4052e2,_0x267d60){return db['DeskField'][_0xe7cf('0x48')]({'where':{'id':_0x4052e2['params']['id']}})['then'](handleEntityNotFound(_0x267d60,null))[_0xe7cf('0x27')](removeEntity(_0x267d60,null))[_0xe7cf('0x44')](handleError(_0x267d60,null));}; \ No newline at end of file +var _0xcbd3=['error','stack','name','send','index','DeskField','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','keys','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x3c76c8,_0x490269){_0x3c76c8=_0x3c76c8-0x0;var _0x5dcc43=_0xcbd3[_0x3c76c8];return _0x5dcc43;};'use strict';var emlformat=require(_0x3cbd('0x0'));var rimraf=require(_0x3cbd('0x1'));var zipdir=require(_0x3cbd('0x2'));var jsonpatch=require(_0x3cbd('0x3'));var rp=require(_0x3cbd('0x4'));var moment=require(_0x3cbd('0x5'));var BPromise=require(_0x3cbd('0x6'));var Mustache=require(_0x3cbd('0x7'));var util=require(_0x3cbd('0x8'));var path=require(_0x3cbd('0x9'));var sox=require('sox');var csv=require(_0x3cbd('0xa'));var ejs=require(_0x3cbd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3cbd('0xc'));var squel=require('squel');var crypto=require(_0x3cbd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3cbd('0xe'));var toCsv=require(_0x3cbd('0xa'));var querystring=require(_0x3cbd('0xf'));var Papa=require(_0x3cbd('0x10'));var Redis=require(_0x3cbd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3cbd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cbd('0x13'));var logger=require(_0x3cbd('0x14'))(_0x3cbd('0x15'));var utils=require('../../config/utils');var config=require(_0x3cbd('0x16'));var licenseUtil=require(_0x3cbd('0x17'));var db=require(_0x3cbd('0x18'))['db'];function respondWithStatusCode(_0x1addbc,_0x5e74a3){_0x5e74a3=_0x5e74a3||0xcc;return function(_0x5f4395){if(_0x5f4395){return _0x1addbc[_0x3cbd('0x19')](_0x5e74a3);}return _0x1addbc[_0x3cbd('0x1a')](_0x5e74a3)['end']();};}function respondWithResult(_0x4d3465,_0x50315c){_0x50315c=_0x50315c||0xc8;return function(_0x1fa41c){if(_0x1fa41c){return _0x4d3465['status'](_0x50315c)['json'](_0x1fa41c);}};}function respondWithFilteredResult(_0x301038,_0x282446){return function(_0x3509cd){if(_0x3509cd){var _0x396411=typeof _0x282446[_0x3cbd('0x1b')]===_0x3cbd('0x1c')&&typeof _0x282446['limit']===_0x3cbd('0x1c');var _0xc54a96=_0x3509cd[_0x3cbd('0x1d')];var _0x53774e=_0x396411?0x0:_0x282446['offset'];var _0x1727dd=_0x396411?_0x3509cd['count']:_0x282446[_0x3cbd('0x1b')]+_0x282446[_0x3cbd('0x1e')];var _0x4badba;if(_0x1727dd>=_0xc54a96){_0x1727dd=_0xc54a96;_0x4badba=0xc8;}else{_0x4badba=0xce;}_0x301038['status'](_0x4badba);return _0x301038[_0x3cbd('0x1f')](_0x3cbd('0x20'),_0x53774e+'-'+_0x1727dd+'/'+_0xc54a96)[_0x3cbd('0x21')](_0x3509cd);}return null;};}function patchUpdates(_0x226050){return function(_0x22de64){try{jsonpatch[_0x3cbd('0x22')](_0x22de64,_0x226050,!![]);}catch(_0x2bfd5f){return BPromise[_0x3cbd('0x23')](_0x2bfd5f);}return _0x22de64[_0x3cbd('0x24')]();};}function saveUpdates(_0x4ce3de,_0x543b51){return function(_0x375f0d){if(_0x375f0d){return _0x375f0d[_0x3cbd('0x25')](_0x4ce3de)[_0x3cbd('0x26')](function(_0x196afd){return _0x196afd;});}return null;};}function removeEntity(_0x269d4a,_0x57b408){return function(_0x420c46){if(_0x420c46){return _0x420c46[_0x3cbd('0x27')]()[_0x3cbd('0x26')](function(){_0x269d4a[_0x3cbd('0x1a')](0xcc)[_0x3cbd('0x28')]();});}};}function handleEntityNotFound(_0x3828aa,_0x4696af){return function(_0x1debc2){if(!_0x1debc2){_0x3828aa[_0x3cbd('0x19')](0x194);}return _0x1debc2;};}function handleError(_0x41efa1,_0x3009f3){_0x3009f3=_0x3009f3||0x1f4;return function(_0x1b3ec1){logger[_0x3cbd('0x29')](_0x1b3ec1[_0x3cbd('0x2a')]);if(_0x1b3ec1[_0x3cbd('0x2b')]){delete _0x1b3ec1[_0x3cbd('0x2b')];}_0x41efa1[_0x3cbd('0x1a')](_0x3009f3)[_0x3cbd('0x2c')](_0x1b3ec1);};}exports[_0x3cbd('0x2d')]=function(_0x517338,_0x298241){var _0x473731={},_0xb101c7={},_0x4b06e4={'count':0x0,'rows':[]};var _0x25a1da=_['map'](db[_0x3cbd('0x2e')][_0x3cbd('0x2f')],function(_0x3d2aaa){return{'name':_0x3d2aaa[_0x3cbd('0x30')],'type':_0x3d2aaa['type'][_0x3cbd('0x31')]};});_0xb101c7[_0x3cbd('0x32')]=_[_0x3cbd('0x33')](_0x25a1da,_0x3cbd('0x2b'));_0xb101c7[_0x3cbd('0x34')]=_['keys'](_0x517338['query']);_0xb101c7[_0x3cbd('0x35')]=_['intersection'](_0xb101c7[_0x3cbd('0x32')],_0xb101c7[_0x3cbd('0x34')]);_0x473731['attributes']=_[_0x3cbd('0x36')](_0xb101c7[_0x3cbd('0x32')],qs[_0x3cbd('0x37')](_0x517338[_0x3cbd('0x34')][_0x3cbd('0x37')]));_0x473731[_0x3cbd('0x38')]=_0x473731[_0x3cbd('0x38')][_0x3cbd('0x39')]?_0x473731[_0x3cbd('0x38')]:_0xb101c7[_0x3cbd('0x32')];if(!_0x517338[_0x3cbd('0x34')][_0x3cbd('0x3a')](_0x3cbd('0x3b'))){_0x473731['limit']=qs[_0x3cbd('0x1e')](_0x517338['query'][_0x3cbd('0x1e')]);_0x473731[_0x3cbd('0x1b')]=qs[_0x3cbd('0x1b')](_0x517338['query'][_0x3cbd('0x1b')]);}_0x473731['order']=qs[_0x3cbd('0x3c')](_0x517338['query'][_0x3cbd('0x3c')]);_0x473731[_0x3cbd('0x3d')]=qs[_0x3cbd('0x35')](_[_0x3cbd('0x3e')](_0x517338[_0x3cbd('0x34')],_0xb101c7[_0x3cbd('0x35')]),_0x25a1da);if(_0x517338[_0x3cbd('0x34')][_0x3cbd('0x3f')]){_0x473731[_0x3cbd('0x3d')]=_[_0x3cbd('0x40')](_0x473731['where'],{'$or':_[_0x3cbd('0x33')](_0x25a1da,function(_0x4afa57){if(_0x4afa57[_0x3cbd('0x41')]!=='VIRTUAL'){var _0x108244={};_0x108244[_0x4afa57[_0x3cbd('0x2b')]]={'$like':'%'+_0x517338[_0x3cbd('0x34')][_0x3cbd('0x3f')]+'%'};return _0x108244;}})});}_0x473731=_[_0x3cbd('0x40')]({},_0x473731,_0x517338[_0x3cbd('0x42')]);var _0x172de0={'where':_0x473731[_0x3cbd('0x3d')]};return db[_0x3cbd('0x2e')]['count'](_0x172de0)['then'](function(_0x2972e0){_0x4b06e4['count']=_0x2972e0;if(_0x517338[_0x3cbd('0x34')][_0x3cbd('0x43')]){_0x473731[_0x3cbd('0x44')]=[{'all':!![]}];}return db[_0x3cbd('0x2e')][_0x3cbd('0x45')](_0x473731);})[_0x3cbd('0x26')](function(_0x465aca){_0x4b06e4[_0x3cbd('0x46')]=_0x465aca;return _0x4b06e4;})[_0x3cbd('0x26')](respondWithFilteredResult(_0x298241,_0x473731))['catch'](handleError(_0x298241,null));};exports['show']=function(_0x563919,_0x1bf6cf){var _0x32d260={'raw':!![],'where':{'id':_0x563919[_0x3cbd('0x47')]['id']}},_0x2903f0={};_0x2903f0[_0x3cbd('0x32')]=_[_0x3cbd('0x48')](db[_0x3cbd('0x2e')]['rawAttributes']);_0x2903f0['query']=_[_0x3cbd('0x48')](_0x563919['query']);_0x2903f0[_0x3cbd('0x35')]=_[_0x3cbd('0x36')](_0x2903f0[_0x3cbd('0x32')],_0x2903f0[_0x3cbd('0x34')]);_0x32d260['attributes']=_['intersection'](_0x2903f0[_0x3cbd('0x32')],qs['fields'](_0x563919[_0x3cbd('0x34')][_0x3cbd('0x37')]));_0x32d260[_0x3cbd('0x38')]=_0x32d260[_0x3cbd('0x38')][_0x3cbd('0x39')]?_0x32d260['attributes']:_0x2903f0[_0x3cbd('0x32')];if(_0x563919[_0x3cbd('0x34')]['includeAll']){_0x32d260[_0x3cbd('0x44')]=[{'all':!![]}];}_0x32d260=_[_0x3cbd('0x40')]({},_0x32d260,_0x563919[_0x3cbd('0x42')]);return db['DeskField']['find'](_0x32d260)[_0x3cbd('0x26')](handleEntityNotFound(_0x1bf6cf,null))[_0x3cbd('0x26')](respondWithResult(_0x1bf6cf,null))[_0x3cbd('0x49')](handleError(_0x1bf6cf,null));};exports['create']=function(_0x21b43b,_0x3dd330){return db['DeskField']['create'](_0x21b43b['body'],{})[_0x3cbd('0x26')](respondWithResult(_0x3dd330,0xc9))[_0x3cbd('0x49')](handleError(_0x3dd330,null));};exports[_0x3cbd('0x25')]=function(_0x333da7,_0x238e05){if(_0x333da7[_0x3cbd('0x4a')]['id']){delete _0x333da7[_0x3cbd('0x4a')]['id'];}return db[_0x3cbd('0x2e')]['find']({'where':{'id':_0x333da7[_0x3cbd('0x47')]['id']}})[_0x3cbd('0x26')](handleEntityNotFound(_0x238e05,null))[_0x3cbd('0x26')](saveUpdates(_0x333da7[_0x3cbd('0x4a')],null))[_0x3cbd('0x26')](respondWithResult(_0x238e05,null))[_0x3cbd('0x49')](handleError(_0x238e05,null));};exports['destroy']=function(_0x5a3191,_0x18c450){return db[_0x3cbd('0x2e')][_0x3cbd('0x4b')]({'where':{'id':_0x5a3191[_0x3cbd('0x47')]['id']}})[_0x3cbd('0x26')](handleEntityNotFound(_0x18c450,null))[_0x3cbd('0x26')](removeEntity(_0x18c450,null))[_0x3cbd('0x49')](handleError(_0x18c450,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a1cdbfc..6c7203e 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 _0x1f9c=['exports','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x1f9c,0xb9));var _0xc1f9=function(_0x222e08,_0x14fd15){_0x222e08=_0x222e08-0x0;var _0xed1b85=_0x1f9c[_0x222e08];return _0xed1b85;};'use strict';var _=require(_0xc1f9('0x0'));var util=require(_0xc1f9('0x1'));var logger=require(_0xc1f9('0x2'))('api');var moment=require(_0xc1f9('0x3'));var BPromise=require(_0xc1f9('0x4'));var rp=require(_0xc1f9('0x5'));var fs=require('fs');var path=require(_0xc1f9('0x6'));var rimraf=require(_0xc1f9('0x7'));var config=require(_0xc1f9('0x8'));var attributes=require(_0xc1f9('0x9'));module[_0xc1f9('0xa')]=function(_0xfd747,_0x284166){return _0xfd747['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xc1f9('0xb'),'fields':['idField',_0xc1f9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f3e=['int_desk_fields','desk_unique_index','idField','lodash','../../config/logger','api','bluebird','request-promise','path','./intDeskField.attributes','exports','DeskField'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x3f3e,0xcf));var _0xe3f3=function(_0x5e1b5f,_0x4e3253){_0x5e1b5f=_0x5e1b5f-0x0;var _0x551ae5=_0x3f3e[_0x5e1b5f];return _0x551ae5;};'use strict';var _=require(_0xe3f3('0x0'));var util=require('util');var logger=require(_0xe3f3('0x1'))(_0xe3f3('0x2'));var moment=require('moment');var BPromise=require(_0xe3f3('0x3'));var rp=require(_0xe3f3('0x4'));var fs=require('fs');var path=require(_0xe3f3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3f3('0x6'));module[_0xe3f3('0x7')]=function(_0x233727,_0x178a80){return _0x233727['define'](_0xe3f3('0x8'),attributes,{'tableName':_0xe3f3('0x9'),'paranoid':![],'indexes':[{'name':_0xe3f3('0xa'),'fields':[_0xe3f3('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index f69683b..7bf22d7 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 _0x8d53=['info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8d53,0x95));var _0x38d5=function(_0x14664d,_0x3163e6){_0x14664d=_0x14664d-0x0;var _0x1ad12c=_0x8d53[_0x14664d];return _0x1ad12c;};'use strict';var _=require(_0x38d5('0x0'));var util=require(_0x38d5('0x1'));var moment=require(_0x38d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x38d5('0x3'));var fs=require('fs');var Redis=require(_0x38d5('0x4'));var db=require(_0x38d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38d5('0x6'))(_0x38d5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x38d5('0x8')][_0x38d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x426732,_0xc31c07,_0x2c94e0){return new BPromise(function(_0x36eea5,_0x48c71c){return client[_0x38d5('0xa')](_0x426732,_0x2c94e0)['then'](function(_0x181cc9){logger[_0x38d5('0xb')](_0x38d5('0xc'),_0xc31c07,_0x38d5('0xd'));logger[_0x38d5('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0xc31c07,_0x38d5('0xd'),JSON[_0x38d5('0xf')](_0x181cc9));if(_0x181cc9[_0x38d5('0x10')]){if(_0x181cc9[_0x38d5('0x10')]['code']===0x1f4){logger['error'](_0x38d5('0xc'),_0xc31c07,_0x181cc9[_0x38d5('0x10')][_0x38d5('0x11')]);return _0x48c71c(_0x181cc9[_0x38d5('0x10')][_0x38d5('0x11')]);}logger[_0x38d5('0x10')](_0x38d5('0xc'),_0xc31c07,_0x181cc9[_0x38d5('0x10')][_0x38d5('0x11')]);return _0x36eea5(_0x181cc9[_0x38d5('0x10')][_0x38d5('0x11')]);}else{logger[_0x38d5('0xb')]('DeskField,\x20%s,\x20%s',_0xc31c07,_0x38d5('0xd'));_0x36eea5(_0x181cc9[_0x38d5('0x12')][_0x38d5('0x11')]);}})[_0x38d5('0x13')](function(_0x42c8b7){logger['error'](_0x38d5('0xc'),_0xc31c07,_0x42c8b7);_0x48c71c(_0x42c8b7);});});} \ No newline at end of file +var _0x81f4=['info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x13ed18,_0x53a5a9){var _0x31dd07=function(_0x5625a0){while(--_0x5625a0){_0x13ed18['push'](_0x13ed18['shift']());}};_0x31dd07(++_0x53a5a9);}(_0x81f4,0x1c1));var _0x481f=function(_0x3b6fa6,_0x36d745){_0x3b6fa6=_0x3b6fa6-0x0;var _0x510a40=_0x81f4[_0x3b6fa6];return _0x510a40;};'use strict';var _=require('lodash');var util=require(_0x481f('0x0'));var moment=require(_0x481f('0x1'));var BPromise=require(_0x481f('0x2'));var rs=require(_0x481f('0x3'));var fs=require('fs');var Redis=require(_0x481f('0x4'));var db=require(_0x481f('0x5'))['db'];var utils=require(_0x481f('0x6'));var logger=require('../../config/logger')(_0x481f('0x7'));var config=require(_0x481f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x481f('0x9')][_0x481f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1299b8,_0x3500eb,_0x281b02){return new BPromise(function(_0xda624d,_0x48015b){return client[_0x481f('0xb')](_0x1299b8,_0x281b02)[_0x481f('0xc')](function(_0x113cc6){logger[_0x481f('0xd')](_0x481f('0xe'),_0x3500eb,_0x481f('0xf'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x3500eb,'request\x20sent',JSON[_0x481f('0x10')](_0x113cc6));if(_0x113cc6[_0x481f('0x11')]){if(_0x113cc6['error'][_0x481f('0x12')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x3500eb,_0x113cc6[_0x481f('0x11')]['message']);return _0x48015b(_0x113cc6[_0x481f('0x11')][_0x481f('0x13')]);}logger[_0x481f('0x11')](_0x481f('0xe'),_0x3500eb,_0x113cc6['error'][_0x481f('0x13')]);return _0xda624d(_0x113cc6[_0x481f('0x11')]['message']);}else{logger[_0x481f('0xd')](_0x481f('0xe'),_0x3500eb,_0x481f('0xf'));_0xda624d(_0x113cc6[_0x481f('0x14')][_0x481f('0x13')]);}})['catch'](function(_0x3ec49a){logger[_0x481f('0x11')](_0x481f('0xe'),_0x3500eb,_0x3ec49a);_0x48015b(_0x3ec49a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 5ef2fd6..6865c55 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 _0x38e0=['post','addConfiguration','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x2c519f,_0x5f21a0){var _0x39fc49=function(_0x4849d4){while(--_0x4849d4){_0x2c519f['push'](_0x2c519f['shift']());}};_0x39fc49(++_0x5f21a0);}(_0x38e0,0x89));var _0x038e=function(_0x380a86,_0xef3cd4){_0x380a86=_0x380a86-0x0;var _0x4d472a=_0x38e0[_0x380a86];return _0x4d472a;};'use strict';var multer=require(_0x038e('0x0'));var util=require(_0x038e('0x1'));var path=require('path');var timeout=require(_0x038e('0x2'));var express=require(_0x038e('0x3'));var router=express[_0x038e('0x4')]();var fs_extra=require(_0x038e('0x5'));var auth=require(_0x038e('0x6'));var interaction=require(_0x038e('0x7'));var config=require(_0x038e('0x8'));var controller=require('./intDynamics365Account.controller');router[_0x038e('0x9')]('/',auth[_0x038e('0xa')](),controller[_0x038e('0xb')]);router['get'](_0x038e('0xc'),auth[_0x038e('0xa')](),controller['show']);router[_0x038e('0x9')](_0x038e('0xd'),auth['isAuthenticated'](),controller[_0x038e('0xe')]);router[_0x038e('0x9')](_0x038e('0xf'),auth[_0x038e('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x038e('0x10')]);router[_0x038e('0x11')]('/:id/configurations',auth[_0x038e('0xa')](),controller[_0x038e('0x12')]);router['put'](_0x038e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x038e('0x13')](_0x038e('0xc'),auth[_0x038e('0xa')](),controller[_0x038e('0x14')]);module[_0x038e('0x15')]=router; \ No newline at end of file +var _0xddcf=['get','isAuthenticated','index','/:id','show','getConfigurations','post','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./intDynamics365Account.controller'];(function(_0x76b208,_0x1ff1a3){var _0xa22a7b=function(_0x43ecce){while(--_0x43ecce){_0x76b208['push'](_0x76b208['shift']());}};_0xa22a7b(++_0x1ff1a3);}(_0xddcf,0x14f));var _0xfddc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xddcf[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xfddc('0x0'));var util=require(_0xfddc('0x1'));var path=require(_0xfddc('0x2'));var timeout=require('connect-timeout');var express=require(_0xfddc('0x3'));var router=express['Router']();var fs_extra=require(_0xfddc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfddc('0x5'));var config=require('../../config/environment');var controller=require(_0xfddc('0x6'));router[_0xfddc('0x7')]('/',auth[_0xfddc('0x8')](),controller[_0xfddc('0x9')]);router['get'](_0xfddc('0xa'),auth[_0xfddc('0x8')](),controller[_0xfddc('0xb')]);router[_0xfddc('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xfddc('0xc')]);router[_0xfddc('0x7')]('/:id/fields',auth[_0xfddc('0x8')](),controller['getFields']);router[_0xfddc('0xd')]('/',auth[_0xfddc('0x8')](),controller[_0xfddc('0xe')]);router['post']('/:id/configurations',auth[_0xfddc('0x8')](),controller['addConfiguration']);router[_0xfddc('0xf')](_0xfddc('0xa'),auth[_0xfddc('0x8')](),controller[_0xfddc('0x10')]);router['delete'](_0xfddc('0xa'),auth[_0xfddc('0x8')](),controller[_0xfddc('0x11')]);module[_0xfddc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6626979..e947eac 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 _0xc344=['STRING','sequelize'];(function(_0x34b245,_0xfe65b4){var _0x3a8984=function(_0x12c6a8){while(--_0x12c6a8){_0x34b245['push'](_0x34b245['shift']());}};_0x3a8984(++_0xfe65b4);}(_0xc344,0x1bd));var _0x4c34=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xc344[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x4c34('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4c34('0x1')]},'password':{'type':Sequelize[_0x4c34('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x4c34('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x4c34('0x1')]},'serverUrl':{'type':Sequelize[_0x4c34('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5edb=['STRING','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5edb,0x187));var _0xb5ed=function(_0x55ebd7,_0x1a3892){_0x55ebd7=_0x55ebd7-0x0;var _0x2eed03=_0x5edb[_0x55ebd7];return _0x2eed03;};'use strict';var Sequelize=require(_0xb5ed('0x0'));module[_0xb5ed('0x1')]={'name':{'type':Sequelize[_0xb5ed('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb5ed('0x2')]},'remoteUri':{'type':Sequelize[_0xb5ed('0x2')]},'tenantId':{'type':Sequelize[_0xb5ed('0x2')]},'clientId':{'type':Sequelize[_0xb5ed('0x2')]},'clientSecret':{'type':Sequelize[_0xb5ed('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 371ed7c..0343f3c 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 _0x0faf=['body','params','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','firstresponsebykpiidname','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','username','password','clientId','clientSecret','remoteUri','slice','substring','format','tenantId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','Attributes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','stack','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','forEach','UserLocalizedLabel','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','4.0','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','intersection','merge','find','create'];(function(_0x33dbf1,_0x128ef4){var _0x16a130=function(_0x2dabea){while(--_0x2dabea){_0x33dbf1['push'](_0x33dbf1['shift']());}};_0x16a130(++_0x128ef4);}(_0x0faf,0x132));var _0xf0fa=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0x0faf[_0x513254];return _0x384c92;};'use strict';var emlformat=require(_0xf0fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0fa('0x1'));var jsonpatch=require(_0xf0fa('0x2'));var rp=require(_0xf0fa('0x3'));var moment=require(_0xf0fa('0x4'));var BPromise=require(_0xf0fa('0x5'));var Mustache=require(_0xf0fa('0x6'));var util=require(_0xf0fa('0x7'));var path=require(_0xf0fa('0x8'));var sox=require(_0xf0fa('0x9'));var csv=require('to-csv');var ejs=require(_0xf0fa('0xa'));var fs=require('fs');var fs_extra=require(_0xf0fa('0xb'));var _=require(_0xf0fa('0xc'));var squel=require(_0xf0fa('0xd'));var crypto=require(_0xf0fa('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf0fa('0xf'));var toCsv=require(_0xf0fa('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf0fa('0x11'));var authService=require(_0xf0fa('0x12'));var qs=require(_0xf0fa('0x13'));var as=require(_0xf0fa('0x14'));var hardwareService=require(_0xf0fa('0x15'));var logger=require(_0xf0fa('0x16'))(_0xf0fa('0x17'));var utils=require(_0xf0fa('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf0fa('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf0fa('0x1a'));function respondWithStatusCode(_0x521034,_0x39ae2b){_0x39ae2b=_0x39ae2b||0xcc;return function(_0x17326f){if(_0x17326f){return _0x521034[_0xf0fa('0x1b')](_0x39ae2b);}return _0x521034['status'](_0x39ae2b)['end']();};}function respondWithResult(_0x42591b,_0x540a04){_0x540a04=_0x540a04||0xc8;return function(_0x1f7159){if(_0x1f7159){return _0x42591b[_0xf0fa('0x1c')](_0x540a04)[_0xf0fa('0x1d')](_0x1f7159);}};}function respondWithFilteredResult(_0x3203ce,_0x467d5f){return function(_0x33df80){if(_0x33df80){var _0x28bab8=typeof _0x467d5f[_0xf0fa('0x1e')]==='undefined'&&typeof _0x467d5f[_0xf0fa('0x1f')]===_0xf0fa('0x20');var _0x30ce17=_0x33df80[_0xf0fa('0x21')];var _0x2bdf82=_0x28bab8?0x0:_0x467d5f[_0xf0fa('0x1e')];var _0x5ba2eb=_0x28bab8?_0x33df80['count']:_0x467d5f[_0xf0fa('0x1e')]+_0x467d5f[_0xf0fa('0x1f')];var _0x151d09;if(_0x5ba2eb>=_0x30ce17){_0x5ba2eb=_0x30ce17;_0x151d09=0xc8;}else{_0x151d09=0xce;}_0x3203ce[_0xf0fa('0x1c')](_0x151d09);return _0x3203ce[_0xf0fa('0x22')](_0xf0fa('0x23'),_0x2bdf82+'-'+_0x5ba2eb+'/'+_0x30ce17)[_0xf0fa('0x1d')](_0x33df80);}return null;};}function patchUpdates(_0x3de639){return function(_0x3b87a2){try{jsonpatch[_0xf0fa('0x24')](_0x3b87a2,_0x3de639,!![]);}catch(_0x1878c4){return BPromise['reject'](_0x1878c4);}return _0x3b87a2[_0xf0fa('0x25')]();};}function saveUpdates(_0x306f3e,_0x39e82d){return function(_0x3300d2){if(_0x3300d2){return _0x3300d2[_0xf0fa('0x26')](_0x306f3e)[_0xf0fa('0x27')](function(_0x3901aa){return _0x3901aa;});}return null;};}function removeEntity(_0x1f0eaf,_0x3feb0c){return function(_0x4a897f){if(_0x4a897f){return _0x4a897f[_0xf0fa('0x28')]()[_0xf0fa('0x27')](function(){_0x1f0eaf['status'](0xcc)[_0xf0fa('0x29')]();});}};}function handleEntityNotFound(_0x3703b5,_0x2efe88){return function(_0x59e007){if(!_0x59e007){_0x3703b5[_0xf0fa('0x1b')](0x194);}return _0x59e007;};}function handleError(_0x284499,_0x3d10fb){_0x3d10fb=_0x3d10fb||0x1f4;return function(_0xf631f6){logger['error'](_0xf631f6['stack']);if(_0xf631f6[_0xf0fa('0x2a')]){delete _0xf631f6[_0xf0fa('0x2a')];}_0x284499[_0xf0fa('0x1c')](_0x3d10fb)[_0xf0fa('0x2b')](_0xf631f6);};}exports['index']=function(_0x4058d6,_0x409a8c){var _0x1279cf={},_0x5a4fd3={},_0x9ad0e3={'count':0x0,'rows':[]};var _0x593697=_[_0xf0fa('0x2c')](db[_0xf0fa('0x2d')][_0xf0fa('0x2e')],function(_0x519661){return{'name':_0x519661[_0xf0fa('0x2f')],'type':_0x519661[_0xf0fa('0x30')][_0xf0fa('0x31')]};});_0x5a4fd3[_0xf0fa('0x32')]=_[_0xf0fa('0x2c')](_0x593697,_0xf0fa('0x2a'));_0x5a4fd3['query']=_['keys'](_0x4058d6[_0xf0fa('0x33')]);_0x5a4fd3[_0xf0fa('0x34')]=_['intersection'](_0x5a4fd3[_0xf0fa('0x32')],_0x5a4fd3['query']);_0x1279cf['attributes']=_['intersection'](_0x5a4fd3[_0xf0fa('0x32')],qs['fields'](_0x4058d6[_0xf0fa('0x33')][_0xf0fa('0x35')]));_0x1279cf[_0xf0fa('0x36')]=_0x1279cf[_0xf0fa('0x36')][_0xf0fa('0x37')]?_0x1279cf[_0xf0fa('0x36')]:_0x5a4fd3[_0xf0fa('0x32')];if(!_0x4058d6[_0xf0fa('0x33')]['hasOwnProperty'](_0xf0fa('0x38'))){_0x1279cf[_0xf0fa('0x1f')]=qs[_0xf0fa('0x1f')](_0x4058d6['query'][_0xf0fa('0x1f')]);_0x1279cf[_0xf0fa('0x1e')]=qs[_0xf0fa('0x1e')](_0x4058d6[_0xf0fa('0x33')]['offset']);}_0x1279cf['order']=qs[_0xf0fa('0x39')](_0x4058d6[_0xf0fa('0x33')][_0xf0fa('0x39')]);_0x1279cf[_0xf0fa('0x3a')]=qs[_0xf0fa('0x34')](_['pick'](_0x4058d6['query'],_0x5a4fd3['filters']),_0x593697);if(_0x4058d6['query'][_0xf0fa('0x3b')]){_0x1279cf[_0xf0fa('0x3a')]=_['merge'](_0x1279cf['where'],{'$or':_[_0xf0fa('0x2c')](_0x593697,function(_0x1b8fb8){if(_0x1b8fb8[_0xf0fa('0x30')]!==_0xf0fa('0x3c')){var _0x2202de={};_0x2202de[_0x1b8fb8[_0xf0fa('0x2a')]]={'$like':'%'+_0x4058d6[_0xf0fa('0x33')]['filter']+'%'};return _0x2202de;}})});}_0x1279cf=_['merge']({},_0x1279cf,_0x4058d6[_0xf0fa('0x3d')]);var _0x1d4830={'where':_0x1279cf[_0xf0fa('0x3a')]};return db[_0xf0fa('0x2d')][_0xf0fa('0x21')](_0x1d4830)[_0xf0fa('0x27')](function(_0x5acfa4){_0x9ad0e3[_0xf0fa('0x21')]=_0x5acfa4;if(_0x4058d6['query'][_0xf0fa('0x3e')]){_0x1279cf[_0xf0fa('0x3f')]=[{'all':!![]}];}return db[_0xf0fa('0x2d')][_0xf0fa('0x40')](_0x1279cf);})[_0xf0fa('0x27')](function(_0x8cce53){_0x9ad0e3[_0xf0fa('0x41')]=_0x8cce53;return _0x9ad0e3;})[_0xf0fa('0x27')](respondWithFilteredResult(_0x409a8c,_0x1279cf))[_0xf0fa('0x42')](handleError(_0x409a8c,null));};exports['show']=function(_0x51ea79,_0x52221a){var _0x304bae={'raw':![],'where':{'id':_0x51ea79['params']['id']}},_0x34be72={};_0x34be72[_0xf0fa('0x32')]=_[_0xf0fa('0x43')](db[_0xf0fa('0x2d')][_0xf0fa('0x2e')]);_0x34be72['query']=_[_0xf0fa('0x43')](_0x51ea79[_0xf0fa('0x33')]);_0x34be72[_0xf0fa('0x34')]=_[_0xf0fa('0x44')](_0x34be72[_0xf0fa('0x32')],_0x34be72[_0xf0fa('0x33')]);_0x304bae[_0xf0fa('0x36')]=_[_0xf0fa('0x44')](_0x34be72[_0xf0fa('0x32')],qs['fields'](_0x51ea79[_0xf0fa('0x33')][_0xf0fa('0x35')]));_0x304bae[_0xf0fa('0x36')]=_0x304bae[_0xf0fa('0x36')][_0xf0fa('0x37')]?_0x304bae[_0xf0fa('0x36')]:_0x34be72['model'];if(_0x51ea79[_0xf0fa('0x33')][_0xf0fa('0x3e')]){_0x304bae['include']=[{'all':!![]}];}_0x304bae=_[_0xf0fa('0x45')]({},_0x304bae,_0x51ea79[_0xf0fa('0x3d')]);return db[_0xf0fa('0x2d')][_0xf0fa('0x46')](_0x304bae)[_0xf0fa('0x27')](handleEntityNotFound(_0x52221a,null))[_0xf0fa('0x27')](respondWithResult(_0x52221a,null))[_0xf0fa('0x42')](handleError(_0x52221a,null));};exports[_0xf0fa('0x47')]=function(_0x35272e,_0x4cd85e){return db[_0xf0fa('0x2d')]['create'](_0x35272e[_0xf0fa('0x48')],{})[_0xf0fa('0x27')](respondWithResult(_0x4cd85e,0xc9))[_0xf0fa('0x42')](handleError(_0x4cd85e,null));};exports['update']=function(_0x324765,_0x20ea09){if(_0x324765[_0xf0fa('0x48')]['id']){delete _0x324765[_0xf0fa('0x48')]['id'];}return db[_0xf0fa('0x2d')]['find']({'where':{'id':_0x324765[_0xf0fa('0x49')]['id']}})['then'](handleEntityNotFound(_0x20ea09,null))[_0xf0fa('0x27')](saveUpdates(_0x324765[_0xf0fa('0x48')],null))[_0xf0fa('0x27')](respondWithResult(_0x20ea09,null))[_0xf0fa('0x42')](handleError(_0x20ea09,null));};exports[_0xf0fa('0x28')]=function(_0x5dd098,_0x368f0c){return db[_0xf0fa('0x2d')][_0xf0fa('0x46')]({'where':{'id':_0x5dd098[_0xf0fa('0x49')]['id']}})[_0xf0fa('0x27')](handleEntityNotFound(_0x368f0c,null))[_0xf0fa('0x27')](removeEntity(_0x368f0c,null))['catch'](handleError(_0x368f0c,null));};exports[_0xf0fa('0x4a')]=function(_0x5e1e8e,_0x4fcc8d,_0x52e970){var _0x31a192={};var _0x31b4b0={};var _0xa256ee;var _0x63ef16;return db[_0xf0fa('0x2d')][_0xf0fa('0x4b')]({'where':{'id':_0x5e1e8e[_0xf0fa('0x49')]['id']}})[_0xf0fa('0x27')](handleEntityNotFound(_0x4fcc8d,null))[_0xf0fa('0x27')](function(_0x506b2f){if(_0x506b2f){_0xa256ee=_0x506b2f;_0x31b4b0[_0xf0fa('0x32')]=_['keys'](db[_0xf0fa('0x4c')][_0xf0fa('0x2e')]);_0x31b4b0[_0xf0fa('0x33')]=_[_0xf0fa('0x43')](_0x5e1e8e['query']);_0x31b4b0[_0xf0fa('0x34')]=_['intersection'](_0x31b4b0[_0xf0fa('0x32')],_0x31b4b0[_0xf0fa('0x33')]);_0x31a192[_0xf0fa('0x36')]=_[_0xf0fa('0x44')](_0x31b4b0[_0xf0fa('0x32')],qs[_0xf0fa('0x35')](_0x5e1e8e['query'][_0xf0fa('0x35')]));_0x31a192[_0xf0fa('0x36')]=_0x31a192['attributes'][_0xf0fa('0x37')]?_0x31a192[_0xf0fa('0x36')]:_0x31b4b0['model'];_0x31a192[_0xf0fa('0x4d')]=qs[_0xf0fa('0x39')](_0x5e1e8e['query'][_0xf0fa('0x39')]);_0x31a192[_0xf0fa('0x3a')]=qs[_0xf0fa('0x34')](_['pick'](_0x5e1e8e[_0xf0fa('0x33')],_0x31b4b0[_0xf0fa('0x34')]));if(_0x5e1e8e['query'][_0xf0fa('0x3b')]){_0x31a192[_0xf0fa('0x3a')]=_[_0xf0fa('0x45')](_0x31a192['where'],{'$or':_[_0xf0fa('0x2c')](_0x31a192[_0xf0fa('0x36')],function(_0x5c6dde){var _0x31535f={};_0x31535f[_0x5c6dde]={'$like':'%'+_0x5e1e8e[_0xf0fa('0x33')][_0xf0fa('0x3b')]+'%'};return _0x31535f;})});}_0x31a192=_[_0xf0fa('0x45')]({},_0x31a192,_0x5e1e8e[_0xf0fa('0x3d')]);return _0xa256ee[_0xf0fa('0x4a')](_0x31a192);}})[_0xf0fa('0x27')](function(_0x337640){if(_0x337640){_0x63ef16=_0x337640[_0xf0fa('0x37')];if(!_0x5e1e8e[_0xf0fa('0x33')]['hasOwnProperty'](_0xf0fa('0x38'))){_0x31a192[_0xf0fa('0x1f')]=qs[_0xf0fa('0x1f')](_0x5e1e8e[_0xf0fa('0x33')][_0xf0fa('0x1f')]);_0x31a192[_0xf0fa('0x1e')]=qs[_0xf0fa('0x1e')](_0x5e1e8e['query'][_0xf0fa('0x1e')]);}return _0xa256ee[_0xf0fa('0x4a')](_0x31a192);}})[_0xf0fa('0x27')](function(_0x28fdf5){if(_0x28fdf5){return _0x28fdf5?{'count':_0x63ef16,'rows':_0x28fdf5}:null;}})[_0xf0fa('0x27')](respondWithResult(_0x4fcc8d,null))[_0xf0fa('0x42')](handleError(_0x4fcc8d,null));};exports[_0xf0fa('0x4e')]=function(_0x543a2c,_0x5638e6,_0x150076){if(_0x543a2c[_0xf0fa('0x48')]['id']){delete _0x543a2c[_0xf0fa('0x48')]['id'];}return db[_0xf0fa('0x2d')]['findOne']({'where':{'id':_0x543a2c['params']['id']}})['then'](handleEntityNotFound(_0x5638e6,null))[_0xf0fa('0x27')](function(_0x29c996){if(_0x29c996){_0x543a2c[_0xf0fa('0x48')][_0xf0fa('0x4f')]=_0x29c996['id'];_0x543a2c['body']['Subjects']=integrations[_0xf0fa('0x50')](_0x543a2c['body'][_0xf0fa('0x51')],_0x543a2c[_0xf0fa('0x48')][_0xf0fa('0x30')]);_0x543a2c[_0xf0fa('0x48')][_0xf0fa('0x52')]=integrations['getDescriptions'](_0x543a2c[_0xf0fa('0x48')][_0xf0fa('0x51')],_0x543a2c[_0xf0fa('0x48')][_0xf0fa('0x30')]);return db[_0xf0fa('0x4c')][_0xf0fa('0x47')](_0x543a2c[_0xf0fa('0x48')],{'include':[{'model':db[_0xf0fa('0x53')],'as':_0xf0fa('0x54')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xf0fa('0x27')](respondWithResult(_0x5638e6,null))['catch'](handleError(_0x5638e6,null));};exports[_0xf0fa('0x55')]=function(_0x583a0b,_0x4b3cb6,_0x4a851b){var _0x3d1354=_0x583a0b[_0xf0fa('0x33')][_0xf0fa('0x56')];var _0xb31dcf=_0x3d1354===_0xf0fa('0x57')?_0xf0fa('0x58'):_0xf0fa('0x59');var _0x2b7965='';var _0x2a5a11='';var _0x1cd67c='';var _0x5b4a09='';var _0x21ee48='';var _0x5de588='';var _0x448851='';var _0x56c701='';var _0x3d2f00=['title',_0xf0fa('0x5a'),'customerid',_0xf0fa('0x5b'),_0xf0fa('0x5c'),_0xf0fa('0x5d'),_0xf0fa('0x5e'),_0xf0fa('0x5f'),'directioncode','phonecall_activity_parties'];var _0x4224ce=[_0xf0fa('0x60'),'accountidyominame','actualserviceunits',_0xf0fa('0x61'),_0xf0fa('0x62'),_0xf0fa('0x63'),_0xf0fa('0x64'),_0xf0fa('0x65'),'createdbyexternalpartyname',_0xf0fa('0x66'),_0xf0fa('0x67'),_0xf0fa('0x68'),'createdon','createdonbehalfbyname',_0xf0fa('0x69'),_0xf0fa('0x6a'),'customeridtype','customeridyominame',_0xf0fa('0x6b'),_0xf0fa('0x6c'),_0xf0fa('0x6d'),'entityimage_url','escalatedon','exchangerate',_0xf0fa('0x6e'),'followupby','importsequencenumber',_0xf0fa('0x6f'),_0xf0fa('0x70'),_0xf0fa('0x71'),_0xf0fa('0x72'),_0xf0fa('0x73'),_0xf0fa('0x74'),'modifiedbyname',_0xf0fa('0x75'),_0xf0fa('0x76'),_0xf0fa('0x77'),'modifiedonbehalfbyyominame',_0xf0fa('0x78'),'msdyn_iotalertname','numberofchildincidents',_0xf0fa('0x79'),'overriddencreatedon','owneridname',_0xf0fa('0x7a'),_0xf0fa('0x7b'),_0xf0fa('0x7c'),'primarycontactidname',_0xf0fa('0x7d'),_0xf0fa('0x7e'),'productidname',_0xf0fa('0x7f'),_0xf0fa('0x80'),_0xf0fa('0x81'),_0xf0fa('0x82'),_0xf0fa('0x83'),_0xf0fa('0x84'),'sentimentvalue',_0xf0fa('0x85'),'slaname',_0xf0fa('0x86'),_0xf0fa('0x87'),_0xf0fa('0x88'),_0xf0fa('0x89'),_0xf0fa('0x8a'),_0xf0fa('0x8b'),_0xf0fa('0x8c'),'traversedpath','utcconversiontimezonecode',_0xf0fa('0x8d')];var _0xe18641=_0x3d2f00['concat'](_0x4224ce);return db[_0xf0fa('0x2d')]['findOne']({'where':{'id':_0x583a0b['params']['id']},'attributes':['id',_0xf0fa('0x8e'),_0xf0fa('0x8f'),'remoteUri','tenantId',_0xf0fa('0x90'),_0xf0fa('0x91')]})[_0xf0fa('0x27')](handleEntityNotFound(_0x4b3cb6,null))[_0xf0fa('0x27')](function(_0x33a285){if(_0x33a285){_0x56c701=_0x33a285[_0xf0fa('0x92')];var _0x52eb20=_0x56c701[_0xf0fa('0x93')](-0x1);if(_0x52eb20==='/'){_0x56c701=_0x56c701[_0xf0fa('0x94')](0x0,_0x56c701['lastIndexOf'](_0x52eb20));}_0x448851=util[_0xf0fa('0x95')]('%s/api/data/v9.0/',_0x56c701);var _0x2fea8a={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x33a285[_0xf0fa('0x96')]+'/oauth2/token','form':{'client_id':_0x33a285['clientId'],'resource':_0x56c701,'username':_0x33a285['username'],'password':_0x33a285['password'],'grant_type':_0xf0fa('0x8f'),'client_secret':_0x33a285['clientSecret']},'json':!![]};return rp(_0x2fea8a);}})[_0xf0fa('0x27')](function(_0x2f7aa5){_0x5de588=_0x2f7aa5['access_token'];var _0x462917={'method':_0xf0fa('0x97'),'uri':encodeURI(_0x448851+_0xf0fa('0x98')+_0xb31dcf+'\x27'),'headers':{'Authorization':_0xf0fa('0x99')+_0x5de588,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x462917);})[_0xf0fa('0x27')](function(_0x5d5adb){var _0x12ee3b=_0x5d5adb['value'][0x0];var _0x1cb2e8=_0x12ee3b[_0xf0fa('0x9a')];var _0x3dd036={'method':_0xf0fa('0x97'),'uri':_0x448851+'EntityDefinitions('+_0x1cb2e8+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf0fa('0x99')+_0x5de588,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3dd036);})[_0xf0fa('0x27')](function(_0x29d857){_0x2b7965=_0x29d857;_0x2a5a11=_0x2b7965[_0xf0fa('0x9b')];_0x2a5a11=_['remove'](_0x2a5a11,function(_0x142f4f){return!_0xe18641['includes'](_0x142f4f[_0xf0fa('0x9c')]);});var _0x2d4e61=[];var _0x13f9d5=[];_0x2a5a11['forEach'](function(_0x227fda){if(_0x227fda['@odata.type']){var _0xb03a62=_0x227fda[_0xf0fa('0x9d')]['substring'](_0x227fda[_0xf0fa('0x9d')][_0xf0fa('0x9e')]('.')+0x1);if(_0xb03a62===_0xf0fa('0x9f')){_0x2d4e61[_0xf0fa('0xa0')](getSelectList(_0x448851,_0x3d1354,_0x13f9d5,_0x2b7965['MetadataId'],_0x227fda[_0xf0fa('0x9a')],_0x5de588));}}});return Promise['all'](_0x2d4e61);})['then'](function(_0x2ea054){_0x1cd67c=_0x2ea054[0x0];var _0x381b50=[];var _0x559954=[];_0x2a5a11['forEach'](function(_0x2a5db2){if(!_[_0xf0fa('0xa1')](_0x2a5db2['@odata.type'])){var _0x36c44c=_0x2a5db2['@odata.type'][_0xf0fa('0x94')](_0x2a5db2[_0xf0fa('0x9d')]['lastIndexOf']('.')+0x1);if(_0x36c44c==='BooleanAttributeMetadata'){_0x381b50[_0xf0fa('0xa0')](getBooleanList(_0x448851,_0x3d1354,_0x559954,_0x2b7965['MetadataId'],_0x2a5db2[_0xf0fa('0x9a')],_0x5de588));}}});return Promise[_0xf0fa('0xa2')](_0x381b50);})[_0xf0fa('0x27')](function(_0x530b41){_0x5b4a09=_0x530b41[0x0];var _0x577ea1=[];var _0x174737=[];_0x2a5a11['forEach'](function(_0x24b4d7){if(_0x24b4d7[_0xf0fa('0x9d')]){var _0x56b686=_0x24b4d7[_0xf0fa('0x9d')]['substring'](_0x24b4d7[_0xf0fa('0x9d')][_0xf0fa('0x9e')]('.')+0x1);if(_0x56b686===_0xf0fa('0xa3')||_0x56b686===_0xf0fa('0xa4')||_0x56b686==='BigIntAttributeMetadata'||_0x56b686==='IntegerAttributeMetadata'||_0x56b686===_0xf0fa('0xa5')||_0x56b686==='DateTimeAttributeMetadata'||_0x56b686===_0xf0fa('0xa6')||_0x56b686==='EntityNameAttributeMetadata'||_0x56b686==='StateAttributeMetadata'||_0x56b686===_0xf0fa('0xa7')){_0x577ea1['push'](getInputList(_0x448851,_0x3d1354,_0x56b686,_0x174737,_0x2b7965['MetadataId'],_0x24b4d7[_0xf0fa('0x9a')],_0x5de588));}}});return Promise['all'](_0x577ea1);})['then'](function(_0x365cd7){_0x21ee48=_0x365cd7[0x0];var _0x317403=_0x1cd67c['concat'](_0x5b4a09)[_0xf0fa('0xa8')](_0x21ee48);var _0x4e6958={'count':_0x317403['length'],'rows':_0x317403};return _0x4e6958;})[_0xf0fa('0x27')](respondWithResult(_0x4b3cb6,null))['catch'](function(_0x585899){var _0x3fa423=_0x583a0b['query'][_0xf0fa('0xa9')]?0x1f4:_0x585899[_0xf0fa('0xaa')]||0x1f4;logger['error'](_0x585899[_0xf0fa('0xab')]);delete _0x585899[_0xf0fa('0x2a')];if(_0x3fa423===0x191){_0x3fa423=0x190;}_0x4b3cb6[_0xf0fa('0x1c')](_0x3fa423)['send'](_0x583a0b[_0xf0fa('0x33')][_0xf0fa('0xa9')]?{'message':'Wrong\x20credentials','statusCode':_0x585899['statusCode']}:_0x585899);});};function getSelectList(_0x4498c8,_0x4c9960,_0x527506,_0xca1bd,_0x4a3f82,_0x4ac6d6){var _0xfb1d14={'method':'GET','uri':_0x4498c8+_0xf0fa('0xac')+_0xca1bd+_0xf0fa('0xad')+_0x4a3f82+_0xf0fa('0xae')+_0xf0fa('0xaf'),'headers':{'Authorization':_0xf0fa('0x99')+_0x4ac6d6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xfb1d14)[_0xf0fa('0x27')](function(_0x2bd061){var _0x1416b8=[];var _0x390a37=_0x2bd061[_0xf0fa('0xb0')][_0xf0fa('0xb1')];_0x390a37[_0xf0fa('0xb2')](function(_0x41bd6b){_0x1416b8['push']({'name':_0x41bd6b['Label'][_0xf0fa('0xb3')]['Label'],'value':String(_0x41bd6b['Value'])});});var _0x1d9cc0={'id':_0x4c9960+'_'+_0x2bd061[_0xf0fa('0x9c')],'name':_0x2bd061[_0xf0fa('0xb4')][_0xf0fa('0xb3')][_0xf0fa('0xb5')],'custom':![],'options':_0x1416b8};_0x527506[_0xf0fa('0xa0')](_0x1d9cc0);return _0x527506;});}function getBooleanList(_0x193fa8,_0x11b75c,_0x5e6fa9,_0x5c1b64,_0x5461cc,_0x50735f){var _0x1b0e3f={'method':_0xf0fa('0x97'),'uri':_0x193fa8+'EntityDefinitions('+_0x5c1b64+_0xf0fa('0xad')+_0x5461cc+_0xf0fa('0xb6'),'headers':{'Authorization':_0xf0fa('0x99')+_0x50735f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b0e3f)['then'](function(_0x893912){var _0x91cdd5=[];_0x91cdd5[_0xf0fa('0xa0')]({'name':_0x893912[_0xf0fa('0xb0')][_0xf0fa('0xb7')][_0xf0fa('0xb5')]['UserLocalizedLabel']['Label'],'value':_0xf0fa('0xb8')},{'name':_0x893912['OptionSet'][_0xf0fa('0xb9')][_0xf0fa('0xb5')][_0xf0fa('0xb3')][_0xf0fa('0xb5')],'value':_0xf0fa('0xba')});var _0x151ead={'id':_0x11b75c+'_'+_0x893912[_0xf0fa('0x9c')],'name':_0x893912[_0xf0fa('0xb4')][_0xf0fa('0xb3')]['Label'],'custom':![],'options':_0x91cdd5};_0x5e6fa9[_0xf0fa('0xa0')](_0x151ead);return _0x5e6fa9;});}function getInputList(_0x51c0b7,_0x57d3d5,_0x236fa3,_0x372be5,_0x5d67a8,_0x244987,_0x70f9ac){var _0x56fb5b={'method':_0xf0fa('0x97'),'uri':_0x51c0b7+_0xf0fa('0xac')+_0x5d67a8+_0xf0fa('0xad')+_0x244987+')/Microsoft.Dynamics.CRM.'+_0x236fa3+_0xf0fa('0xbb'),'headers':{'Authorization':_0xf0fa('0x99')+_0x70f9ac,'If-None-Match':null,'OData-Version':_0xf0fa('0xbc')},'json':!![]};return rp(_0x56fb5b)['then'](function(_0xc64a9c){var _0xafb2c6={'id':_0x57d3d5+'_'+_0xc64a9c[_0xf0fa('0x9c')],'name':_0xc64a9c[_0xf0fa('0xb4')][_0xf0fa('0xb3')]?_0xc64a9c[_0xf0fa('0xb4')][_0xf0fa('0xb3')][_0xf0fa('0xb5')]:_0xc64a9c[_0xf0fa('0x9c')],'custom':![],'options':[]};_0x372be5[_0xf0fa('0xa0')](_0xafb2c6);return _0x372be5;});} \ No newline at end of file +var _0x425d=['subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','substring','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','Attributes','remove','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','error','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','catch','show','include','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname'];(function(_0x4185d8,_0x221f3f){var _0x7b878c=function(_0x25e199){while(--_0x25e199){_0x4185d8['push'](_0x4185d8['shift']());}};_0x7b878c(++_0x221f3f);}(_0x425d,0x1e0));var _0xd425=function(_0x37aed4,_0x254b7d){_0x37aed4=_0x37aed4-0x0;var _0x1ec4f3=_0x425d[_0x37aed4];return _0x1ec4f3;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var integrations=require(_0xd425('0x1d'));function respondWithStatusCode(_0x3cacf7,_0x3b5de8){_0x3b5de8=_0x3b5de8||0xcc;return function(_0x18eafb){if(_0x18eafb){return _0x3cacf7['sendStatus'](_0x3b5de8);}return _0x3cacf7[_0xd425('0x1e')](_0x3b5de8)[_0xd425('0x1f')]();};}function respondWithResult(_0x336dc3,_0x5d3d60){_0x5d3d60=_0x5d3d60||0xc8;return function(_0x309263){if(_0x309263){return _0x336dc3[_0xd425('0x1e')](_0x5d3d60)[_0xd425('0x20')](_0x309263);}};}function respondWithFilteredResult(_0x41f34d,_0x1fc822){return function(_0x538a0a){if(_0x538a0a){var _0x278626=typeof _0x1fc822[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x1fc822[_0xd425('0x23')]==='undefined';var _0x19d7d4=_0x538a0a[_0xd425('0x24')];var _0x467a6c=_0x278626?0x0:_0x1fc822[_0xd425('0x21')];var _0x4e88fa=_0x278626?_0x538a0a['count']:_0x1fc822['offset']+_0x1fc822['limit'];var _0x427304;if(_0x4e88fa>=_0x19d7d4){_0x4e88fa=_0x19d7d4;_0x427304=0xc8;}else{_0x427304=0xce;}_0x41f34d[_0xd425('0x1e')](_0x427304);return _0x41f34d[_0xd425('0x25')]('Content-Range',_0x467a6c+'-'+_0x4e88fa+'/'+_0x19d7d4)[_0xd425('0x20')](_0x538a0a);}return null;};}function patchUpdates(_0x7e982e){return function(_0x5f1e7e){try{jsonpatch[_0xd425('0x26')](_0x5f1e7e,_0x7e982e,!![]);}catch(_0xf2d0ce){return BPromise[_0xd425('0x27')](_0xf2d0ce);}return _0x5f1e7e[_0xd425('0x28')]();};}function saveUpdates(_0x3e93db,_0xb240c4){return function(_0x2480a0){if(_0x2480a0){return _0x2480a0[_0xd425('0x29')](_0x3e93db)[_0xd425('0x2a')](function(_0x2b030b){return _0x2b030b;});}return null;};}function removeEntity(_0x151ad9,_0x40e84b){return function(_0x47f44a){if(_0x47f44a){return _0x47f44a[_0xd425('0x2b')]()[_0xd425('0x2a')](function(){_0x151ad9[_0xd425('0x1e')](0xcc)[_0xd425('0x1f')]();});}};}function handleEntityNotFound(_0x2afcdb,_0x400dd7){return function(_0x3c3402){if(!_0x3c3402){_0x2afcdb['sendStatus'](0x194);}return _0x3c3402;};}function handleError(_0x12f951,_0x177de2){_0x177de2=_0x177de2||0x1f4;return function(_0x1d8861){logger['error'](_0x1d8861[_0xd425('0x2c')]);if(_0x1d8861[_0xd425('0x2d')]){delete _0x1d8861[_0xd425('0x2d')];}_0x12f951[_0xd425('0x1e')](_0x177de2)[_0xd425('0x2e')](_0x1d8861);};}exports[_0xd425('0x2f')]=function(_0x2fd17a,_0x37b63c){var _0x24da23={},_0x1cac61={},_0x482ba6={'count':0x0,'rows':[]};var _0x471e3e=_[_0xd425('0x30')](db[_0xd425('0x31')][_0xd425('0x32')],function(_0x3275b1){return{'name':_0x3275b1[_0xd425('0x33')],'type':_0x3275b1[_0xd425('0x34')][_0xd425('0x35')]};});_0x1cac61[_0xd425('0x36')]=_[_0xd425('0x30')](_0x471e3e,_0xd425('0x2d'));_0x1cac61['query']=_[_0xd425('0x37')](_0x2fd17a[_0xd425('0x38')]);_0x1cac61[_0xd425('0x39')]=_[_0xd425('0x3a')](_0x1cac61[_0xd425('0x36')],_0x1cac61['query']);_0x24da23[_0xd425('0x3b')]=_[_0xd425('0x3a')](_0x1cac61['model'],qs['fields'](_0x2fd17a['query'][_0xd425('0x3c')]));_0x24da23[_0xd425('0x3b')]=_0x24da23[_0xd425('0x3b')][_0xd425('0x3d')]?_0x24da23['attributes']:_0x1cac61[_0xd425('0x36')];if(!_0x2fd17a[_0xd425('0x38')][_0xd425('0x3e')](_0xd425('0x3f'))){_0x24da23[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x2fd17a[_0xd425('0x38')]['limit']);_0x24da23[_0xd425('0x21')]=qs['offset'](_0x2fd17a[_0xd425('0x38')][_0xd425('0x21')]);}_0x24da23[_0xd425('0x40')]=qs['sort'](_0x2fd17a[_0xd425('0x38')][_0xd425('0x41')]);_0x24da23[_0xd425('0x42')]=qs[_0xd425('0x39')](_['pick'](_0x2fd17a[_0xd425('0x38')],_0x1cac61[_0xd425('0x39')]),_0x471e3e);if(_0x2fd17a['query']['filter']){_0x24da23['where']=_[_0xd425('0x43')](_0x24da23[_0xd425('0x42')],{'$or':_[_0xd425('0x30')](_0x471e3e,function(_0x588688){if(_0x588688['type']!=='VIRTUAL'){var _0x2fcfb9={};_0x2fcfb9[_0x588688[_0xd425('0x2d')]]={'$like':'%'+_0x2fd17a[_0xd425('0x38')][_0xd425('0x44')]+'%'};return _0x2fcfb9;}})});}_0x24da23=_[_0xd425('0x43')]({},_0x24da23,_0x2fd17a[_0xd425('0x45')]);var _0xeda414={'where':_0x24da23['where']};return db[_0xd425('0x31')][_0xd425('0x24')](_0xeda414)[_0xd425('0x2a')](function(_0x552fd0){_0x482ba6[_0xd425('0x24')]=_0x552fd0;if(_0x2fd17a[_0xd425('0x38')][_0xd425('0x46')]){_0x24da23['include']=[{'all':!![]}];}return db[_0xd425('0x31')][_0xd425('0x47')](_0x24da23);})[_0xd425('0x2a')](function(_0x2d7a2f){_0x482ba6['rows']=_0x2d7a2f;return _0x482ba6;})[_0xd425('0x2a')](respondWithFilteredResult(_0x37b63c,_0x24da23))[_0xd425('0x48')](handleError(_0x37b63c,null));};exports[_0xd425('0x49')]=function(_0x41b25e,_0x3f24fb){var _0x2f6bf7={'raw':![],'where':{'id':_0x41b25e['params']['id']}},_0x2d799b={};_0x2d799b[_0xd425('0x36')]=_[_0xd425('0x37')](db['Dynamics365Account'][_0xd425('0x32')]);_0x2d799b['query']=_['keys'](_0x41b25e[_0xd425('0x38')]);_0x2d799b['filters']=_[_0xd425('0x3a')](_0x2d799b['model'],_0x2d799b[_0xd425('0x38')]);_0x2f6bf7[_0xd425('0x3b')]=_[_0xd425('0x3a')](_0x2d799b[_0xd425('0x36')],qs[_0xd425('0x3c')](_0x41b25e['query'][_0xd425('0x3c')]));_0x2f6bf7['attributes']=_0x2f6bf7[_0xd425('0x3b')]['length']?_0x2f6bf7[_0xd425('0x3b')]:_0x2d799b[_0xd425('0x36')];if(_0x41b25e[_0xd425('0x38')][_0xd425('0x46')]){_0x2f6bf7[_0xd425('0x4a')]=[{'all':!![]}];}_0x2f6bf7=_['merge']({},_0x2f6bf7,_0x41b25e[_0xd425('0x45')]);return db[_0xd425('0x31')][_0xd425('0x4b')](_0x2f6bf7)[_0xd425('0x2a')](handleEntityNotFound(_0x3f24fb,null))[_0xd425('0x2a')](respondWithResult(_0x3f24fb,null))['catch'](handleError(_0x3f24fb,null));};exports[_0xd425('0x4c')]=function(_0x177704,_0x1450f2){return db[_0xd425('0x31')][_0xd425('0x4c')](_0x177704[_0xd425('0x4d')],{})['then'](respondWithResult(_0x1450f2,0xc9))[_0xd425('0x48')](handleError(_0x1450f2,null));};exports[_0xd425('0x29')]=function(_0x5bfac6,_0x3f305){if(_0x5bfac6[_0xd425('0x4d')]['id']){delete _0x5bfac6[_0xd425('0x4d')]['id'];}return db[_0xd425('0x31')]['find']({'where':{'id':_0x5bfac6[_0xd425('0x4e')]['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x3f305,null))[_0xd425('0x2a')](saveUpdates(_0x5bfac6[_0xd425('0x4d')],null))[_0xd425('0x2a')](respondWithResult(_0x3f305,null))['catch'](handleError(_0x3f305,null));};exports['destroy']=function(_0x381bdb,_0x5496d8){return db[_0xd425('0x31')][_0xd425('0x4b')]({'where':{'id':_0x381bdb['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5496d8,null))['then'](removeEntity(_0x5496d8,null))['catch'](handleError(_0x5496d8,null));};exports[_0xd425('0x4f')]=function(_0x111905,_0xe6451f,_0x1bcd39){var _0x3981e6={};var _0x1eb482={};var _0xeb3586;var _0x4118fe;return db['Dynamics365Account'][_0xd425('0x50')]({'where':{'id':_0x111905[_0xd425('0x4e')]['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0xe6451f,null))[_0xd425('0x2a')](function(_0x7b1080){if(_0x7b1080){_0xeb3586=_0x7b1080;_0x1eb482[_0xd425('0x36')]=_[_0xd425('0x37')](db[_0xd425('0x51')]['rawAttributes']);_0x1eb482['query']=_['keys'](_0x111905[_0xd425('0x38')]);_0x1eb482[_0xd425('0x39')]=_[_0xd425('0x3a')](_0x1eb482[_0xd425('0x36')],_0x1eb482['query']);_0x3981e6['attributes']=_['intersection'](_0x1eb482['model'],qs[_0xd425('0x3c')](_0x111905[_0xd425('0x38')]['fields']));_0x3981e6[_0xd425('0x3b')]=_0x3981e6[_0xd425('0x3b')][_0xd425('0x3d')]?_0x3981e6['attributes']:_0x1eb482['model'];_0x3981e6[_0xd425('0x40')]=qs['sort'](_0x111905['query']['sort']);_0x3981e6[_0xd425('0x42')]=qs[_0xd425('0x39')](_[_0xd425('0x52')](_0x111905['query'],_0x1eb482[_0xd425('0x39')]));if(_0x111905['query'][_0xd425('0x44')]){_0x3981e6[_0xd425('0x42')]=_[_0xd425('0x43')](_0x3981e6[_0xd425('0x42')],{'$or':_[_0xd425('0x30')](_0x3981e6[_0xd425('0x3b')],function(_0xa21f7c){var _0x3ca6a6={};_0x3ca6a6[_0xa21f7c]={'$like':'%'+_0x111905[_0xd425('0x38')]['filter']+'%'};return _0x3ca6a6;})});}_0x3981e6=_[_0xd425('0x43')]({},_0x3981e6,_0x111905[_0xd425('0x45')]);return _0xeb3586[_0xd425('0x4f')](_0x3981e6);}})[_0xd425('0x2a')](function(_0x5c4df8){if(_0x5c4df8){_0x4118fe=_0x5c4df8['length'];if(!_0x111905[_0xd425('0x38')][_0xd425('0x3e')](_0xd425('0x3f'))){_0x3981e6[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x111905[_0xd425('0x38')][_0xd425('0x23')]);_0x3981e6[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x111905[_0xd425('0x38')][_0xd425('0x21')]);}return _0xeb3586[_0xd425('0x4f')](_0x3981e6);}})[_0xd425('0x2a')](function(_0x28979e){if(_0x28979e){return _0x28979e?{'count':_0x4118fe,'rows':_0x28979e}:null;}})['then'](respondWithResult(_0xe6451f,null))[_0xd425('0x48')](handleError(_0xe6451f,null));};exports[_0xd425('0x53')]=function(_0xd2f2e8,_0x4fd793,_0x5aff3c){if(_0xd2f2e8['body']['id']){delete _0xd2f2e8[_0xd425('0x4d')]['id'];}return db[_0xd425('0x31')][_0xd425('0x50')]({'where':{'id':_0xd2f2e8['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x4fd793,null))['then'](function(_0x2811a4){if(_0x2811a4){_0xd2f2e8[_0xd425('0x4d')][_0xd425('0x54')]=_0x2811a4['id'];_0xd2f2e8['body'][_0xd425('0x55')]=integrations[_0xd425('0x56')](_0xd2f2e8[_0xd425('0x4d')][_0xd425('0x57')],_0xd2f2e8[_0xd425('0x4d')][_0xd425('0x34')]);_0xd2f2e8[_0xd425('0x4d')][_0xd425('0x58')]=integrations[_0xd425('0x59')](_0xd2f2e8[_0xd425('0x4d')][_0xd425('0x57')],_0xd2f2e8[_0xd425('0x4d')][_0xd425('0x34')]);return db[_0xd425('0x51')][_0xd425('0x4c')](_0xd2f2e8[_0xd425('0x4d')],{'include':[{'model':db[_0xd425('0x5a')],'as':_0xd425('0x55')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xd425('0x2a')](respondWithResult(_0x4fd793,null))['catch'](handleError(_0x4fd793,null));};exports[_0xd425('0x5b')]=function(_0x1e1a3f,_0xb407bb,_0x1ae1e3){var _0x4c7000=_0x1e1a3f[_0xd425('0x38')][_0xd425('0x5c')];var _0x50b81c=_0x4c7000===_0xd425('0x5d')?_0xd425('0x5e'):_0xd425('0x5f');var _0x4c9d96='';var _0x4c8d7f='';var _0x3ccffe='';var _0x5b1104='';var _0x5e76f5='';var _0x174081='';var _0x4a9215='';var _0x20f6ec='';var _0x46fd93=[_0xd425('0x60'),_0xd425('0x61'),_0xd425('0x62'),_0xd425('0x63'),_0xd425('0x64'),'subject',_0xd425('0x65'),_0xd425('0x66'),_0xd425('0x67'),_0xd425('0x68')];var _0xfcba08=['accountidname',_0xd425('0x69'),_0xd425('0x6a'),'billedserviceunits',_0xd425('0x6b'),_0xd425('0x6c'),'contractdetailidname',_0xd425('0x6d'),_0xd425('0x6e'),_0xd425('0x6f'),_0xd425('0x70'),_0xd425('0x71'),'createdon',_0xd425('0x72'),'createdonbehalfbyyominame',_0xd425('0x73'),_0xd425('0x74'),'customeridyominame',_0xd425('0x75'),_0xd425('0x76'),_0xd425('0x77'),_0xd425('0x78'),'escalatedon','exchangerate',_0xd425('0x79'),_0xd425('0x7a'),_0xd425('0x7b'),'influencescore',_0xd425('0x7c'),_0xd425('0x7d'),'masteridname',_0xd425('0x7e'),'modifiedbyexternalpartyyominame',_0xd425('0x7f'),_0xd425('0x80'),_0xd425('0x81'),_0xd425('0x82'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xd425('0x83'),_0xd425('0x84'),'onholdtime',_0xd425('0x85'),_0xd425('0x86'),'owneridtype',_0xd425('0x87'),_0xd425('0x88'),_0xd425('0x89'),_0xd425('0x8a'),_0xd425('0x8b'),_0xd425('0x8c'),_0xd425('0x8d'),'resolveby','resolvebykpiidname',_0xd425('0x8e'),'responsiblecontactidname',_0xd425('0x8f'),_0xd425('0x90'),'slainvokedidname',_0xd425('0x91'),_0xd425('0x92'),'statecode','statuscode',_0xd425('0x93'),_0xd425('0x94'),_0xd425('0x95'),_0xd425('0x96'),_0xd425('0x97'),_0xd425('0x98'),_0xd425('0x99')];var _0x4425a5=_0x46fd93['concat'](_0xfcba08);return db[_0xd425('0x31')][_0xd425('0x50')]({'where':{'id':_0x1e1a3f['params']['id']},'attributes':['id',_0xd425('0x9a'),_0xd425('0x9b'),_0xd425('0x9c'),_0xd425('0x9d'),_0xd425('0x9e'),_0xd425('0x9f')]})[_0xd425('0x2a')](handleEntityNotFound(_0xb407bb,null))[_0xd425('0x2a')](function(_0x334062){if(_0x334062){_0x20f6ec=_0x334062[_0xd425('0x9c')];var _0x14cebc=_0x20f6ec['slice'](-0x1);if(_0x14cebc==='/'){_0x20f6ec=_0x20f6ec[_0xd425('0xa0')](0x0,_0x20f6ec['lastIndexOf'](_0x14cebc));}_0x4a9215=util['format'](_0xd425('0xa1'),_0x20f6ec);var _0x533bf1={'method':_0xd425('0xa2'),'uri':_0xd425('0xa3')+_0x334062[_0xd425('0x9d')]+_0xd425('0xa4'),'form':{'client_id':_0x334062[_0xd425('0x9e')],'resource':_0x20f6ec,'username':_0x334062[_0xd425('0x9a')],'password':_0x334062[_0xd425('0x9b')],'grant_type':'password','client_secret':_0x334062[_0xd425('0x9f')]},'json':!![]};return rp(_0x533bf1);}})[_0xd425('0x2a')](function(_0x2ef6dc){_0x174081=_0x2ef6dc[_0xd425('0xa5')];var _0x3c40bd={'method':'GET','uri':encodeURI(_0x4a9215+_0xd425('0xa6')+_0x50b81c+'\x27'),'headers':{'Authorization':_0xd425('0xa7')+_0x174081,'If-None-Match':null,'OData-Version':_0xd425('0xa8')},'json':!![]};return rp(_0x3c40bd);})[_0xd425('0x2a')](function(_0x1a5f86){var _0x35d401=_0x1a5f86[_0xd425('0xa9')][0x0];var _0x4147eb=_0x35d401[_0xd425('0xaa')];var _0x334226={'method':_0xd425('0xab'),'uri':_0x4a9215+_0xd425('0xac')+_0x4147eb+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xd425('0xa7')+_0x174081,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x334226);})[_0xd425('0x2a')](function(_0x18576e){_0x4c9d96=_0x18576e;_0x4c8d7f=_0x4c9d96[_0xd425('0xad')];_0x4c8d7f=_[_0xd425('0xae')](_0x4c8d7f,function(_0xf06395){return!_0x4425a5['includes'](_0xf06395[_0xd425('0xaf')]);});var _0x23fce6=[];var _0x28d433=[];_0x4c8d7f[_0xd425('0xb0')](function(_0x1ea134){if(_0x1ea134[_0xd425('0xb1')]){var _0x5451a1=_0x1ea134['@odata.type'][_0xd425('0xa0')](_0x1ea134['@odata.type'][_0xd425('0xb2')]('.')+0x1);if(_0x5451a1===_0xd425('0xb3')){_0x23fce6['push'](getSelectList(_0x4a9215,_0x4c7000,_0x28d433,_0x4c9d96[_0xd425('0xaa')],_0x1ea134[_0xd425('0xaa')],_0x174081));}}});return Promise['all'](_0x23fce6);})[_0xd425('0x2a')](function(_0x8c2e48){_0x3ccffe=_0x8c2e48[0x0];var _0xca2955=[];var _0x2dcf7b=[];_0x4c8d7f[_0xd425('0xb0')](function(_0x218f79){if(!_['isNil'](_0x218f79[_0xd425('0xb1')])){var _0x52d700=_0x218f79[_0xd425('0xb1')]['substring'](_0x218f79[_0xd425('0xb1')][_0xd425('0xb2')]('.')+0x1);if(_0x52d700===_0xd425('0xb4')){_0xca2955[_0xd425('0xb5')](getBooleanList(_0x4a9215,_0x4c7000,_0x2dcf7b,_0x4c9d96['MetadataId'],_0x218f79['MetadataId'],_0x174081));}}});return Promise['all'](_0xca2955);})['then'](function(_0x2bbad4){_0x5b1104=_0x2bbad4[0x0];var _0x54649c=[];var _0x48b98c=[];_0x4c8d7f[_0xd425('0xb0')](function(_0x3ed4c2){if(_0x3ed4c2[_0xd425('0xb1')]){var _0x284f4b=_0x3ed4c2[_0xd425('0xb1')]['substring'](_0x3ed4c2[_0xd425('0xb1')][_0xd425('0xb2')]('.')+0x1);if(_0x284f4b===_0xd425('0xb6')||_0x284f4b===_0xd425('0xb7')||_0x284f4b===_0xd425('0xb8')||_0x284f4b==='IntegerAttributeMetadata'||_0x284f4b===_0xd425('0xb9')||_0x284f4b===_0xd425('0xba')||_0x284f4b===_0xd425('0xbb')||_0x284f4b==='EntityNameAttributeMetadata'||_0x284f4b===_0xd425('0xbc')||_0x284f4b===_0xd425('0xbd')){_0x54649c[_0xd425('0xb5')](getInputList(_0x4a9215,_0x4c7000,_0x284f4b,_0x48b98c,_0x4c9d96[_0xd425('0xaa')],_0x3ed4c2[_0xd425('0xaa')],_0x174081));}}});return Promise['all'](_0x54649c);})[_0xd425('0x2a')](function(_0x52016e){_0x5e76f5=_0x52016e[0x0];var _0xd086f1=_0x3ccffe[_0xd425('0xbe')](_0x5b1104)['concat'](_0x5e76f5);var _0x4de1d0={'count':_0xd086f1[_0xd425('0x3d')],'rows':_0xd086f1};return _0x4de1d0;})['then'](respondWithResult(_0xb407bb,null))[_0xd425('0x48')](function(_0x224eba){var _0x3308e1=_0x1e1a3f[_0xd425('0x38')]['test']?0x1f4:_0x224eba[_0xd425('0xbf')]||0x1f4;logger[_0xd425('0xc0')](_0x224eba[_0xd425('0x2c')]);delete _0x224eba[_0xd425('0x2d')];if(_0x3308e1===0x191){_0x3308e1=0x190;}_0xb407bb[_0xd425('0x1e')](_0x3308e1)[_0xd425('0x2e')](_0x1e1a3f['query'][_0xd425('0xc1')]?{'message':_0xd425('0xc2'),'statusCode':_0x224eba[_0xd425('0xbf')]}:_0x224eba);});};function getSelectList(_0x45dcba,_0x1c6f22,_0x1594e0,_0x5a6b44,_0x289aad,_0x2fd014){var _0x5bd5f0={'method':_0xd425('0xab'),'uri':_0x45dcba+_0xd425('0xac')+_0x5a6b44+')/Attributes('+_0x289aad+_0xd425('0xc3')+_0xd425('0xc4'),'headers':{'Authorization':_0xd425('0xa7')+_0x2fd014,'If-None-Match':null,'OData-Version':_0xd425('0xa8')},'json':!![]};return rp(_0x5bd5f0)['then'](function(_0x437aff){var _0x364b1c=[];var _0x587247=_0x437aff[_0xd425('0xc5')][_0xd425('0xc6')];_0x587247[_0xd425('0xb0')](function(_0x19af43){_0x364b1c[_0xd425('0xb5')]({'name':_0x19af43[_0xd425('0xc7')][_0xd425('0xc8')]['Label'],'value':String(_0x19af43[_0xd425('0xc9')])});});var _0x55d9d2={'id':_0x1c6f22+'_'+_0x437aff[_0xd425('0xaf')],'name':_0x437aff[_0xd425('0xca')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x364b1c};_0x1594e0[_0xd425('0xb5')](_0x55d9d2);return _0x1594e0;});}function getBooleanList(_0x166633,_0x26612e,_0x4de528,_0x30fb5d,_0x53a7f9,_0x55f08b){var _0xb8acb9={'method':_0xd425('0xab'),'uri':_0x166633+_0xd425('0xac')+_0x30fb5d+_0xd425('0xcb')+_0x53a7f9+_0xd425('0xcc'),'headers':{'Authorization':'Bearer\x20'+_0x55f08b,'If-None-Match':null,'OData-Version':_0xd425('0xa8')},'json':!![]};return rp(_0xb8acb9)[_0xd425('0x2a')](function(_0x19d488){var _0x542e6b=[];_0x542e6b[_0xd425('0xb5')]({'name':_0x19d488[_0xd425('0xc5')][_0xd425('0xcd')][_0xd425('0xc7')][_0xd425('0xc8')][_0xd425('0xc7')],'value':'true'},{'name':_0x19d488['OptionSet']['FalseOption'][_0xd425('0xc7')]['UserLocalizedLabel'][_0xd425('0xc7')],'value':_0xd425('0xce')});var _0x310085={'id':_0x26612e+'_'+_0x19d488[_0xd425('0xaf')],'name':_0x19d488[_0xd425('0xca')][_0xd425('0xc8')][_0xd425('0xc7')],'custom':![],'options':_0x542e6b};_0x4de528[_0xd425('0xb5')](_0x310085);return _0x4de528;});}function getInputList(_0x30defc,_0x465015,_0x234a9e,_0x4abc48,_0x381d0b,_0x2956ea,_0x112433){var _0x6e6f55={'method':_0xd425('0xab'),'uri':_0x30defc+_0xd425('0xac')+_0x381d0b+')/Attributes('+_0x2956ea+_0xd425('0xcf')+_0x234a9e+_0xd425('0xd0'),'headers':{'Authorization':_0xd425('0xa7')+_0x112433,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x6e6f55)[_0xd425('0x2a')](function(_0x45b627){var _0x47d918={'id':_0x465015+'_'+_0x45b627[_0xd425('0xaf')],'name':_0x45b627[_0xd425('0xca')]['UserLocalizedLabel']?_0x45b627[_0xd425('0xca')][_0xd425('0xc8')]['Label']:_0x45b627[_0xd425('0xaf')],'custom':![],'options':[]};_0x4abc48[_0xd425('0xb5')](_0x47d918);return _0x4abc48;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6cde6d9..e5790d4 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1739b0,_0x40a6ef){var _0x1094d1=function(_0x1b5ab3){while(--_0x1b5ab3){_0x1739b0['push'](_0x1739b0['shift']());}};_0x1094d1(++_0x40a6ef);}(_0x757a,0xde));var _0xa757=function(_0xa535cf,_0x25211b){_0xa535cf=_0xa535cf-0x0;var _0x330fc1=_0x757a[_0xa535cf];return _0x330fc1;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x508754,_0x790cff){var _0x14367d=function(_0x3cce38){while(--_0x3cce38){_0x508754['push'](_0x508754['shift']());}};_0x14367d(++_0x790cff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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 4e35b42..8ed3964 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 _0x710c=['client','http','request','info','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','map','include','model','then','debug','stringify','ShowDynamics365Account','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x41c911,_0x464097){var _0xdeb77b=function(_0x3b17a4){while(--_0x3b17a4){_0x41c911['push'](_0x41c911['shift']());}};_0xdeb77b(++_0x464097);}(_0x710c,0x1d4));var _0xc710=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x710c[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xc710('0x0'));var util=require('util');var moment=require(_0xc710('0x1'));var BPromise=require(_0xc710('0x2'));var rs=require(_0xc710('0x3'));var fs=require('fs');var Redis=require(_0xc710('0x4'));var db=require(_0xc710('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc710('0x6'));var config=require(_0xc710('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc710('0x8')][_0xc710('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11be43,_0x3e5f4e,_0x1e4ac9){return new BPromise(function(_0x576965,_0x4e9ccb){return client[_0xc710('0xa')](_0x11be43,_0x1e4ac9)['then'](function(_0x3e0f31){logger[_0xc710('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x3e5f4e,'request\x20sent');logger['debug'](_0xc710('0xc'),_0x3e5f4e,_0xc710('0xd'),JSON['stringify'](_0x3e0f31));if(_0x3e0f31['error']){if(_0x3e0f31[_0xc710('0xe')][_0xc710('0xf')]===0x1f4){logger[_0xc710('0xe')](_0xc710('0x10'),_0x3e5f4e,_0x3e0f31[_0xc710('0xe')][_0xc710('0x11')]);return _0x4e9ccb(_0x3e0f31[_0xc710('0xe')][_0xc710('0x11')]);}logger['error'](_0xc710('0x10'),_0x3e5f4e,_0x3e0f31[_0xc710('0xe')][_0xc710('0x11')]);return _0x576965(_0x3e0f31[_0xc710('0xe')][_0xc710('0x11')]);}else{logger[_0xc710('0xb')](_0xc710('0x10'),_0x3e5f4e,_0xc710('0xd'));_0x576965(_0x3e0f31[_0xc710('0x12')]['message']);}})[_0xc710('0x13')](function(_0x5cdbf7){logger[_0xc710('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x3e5f4e,_0x5cdbf7);_0x4e9ccb(_0x5cdbf7);});});}exports[_0xc710('0x14')]=function(_0x323902){var _0x202161=this;return new Promise(function(_0x529aa8,_0x2e5a76){return db[_0xc710('0x15')][_0xc710('0x16')]({'raw':_0x323902['options']?_0x323902[_0xc710('0x17')][_0xc710('0x18')]===undefined?!![]:![]:!![],'where':_0x323902[_0xc710('0x17')]?_0x323902[_0xc710('0x17')][_0xc710('0x19')]||null:null,'attributes':_0x323902['options']?_0x323902['options'][_0xc710('0x1a')]||null:null,'limit':_0x323902[_0xc710('0x17')]?_0x323902[_0xc710('0x17')]['limit']||null:null,'include':_0x323902['options']?_0x323902['options']['include']?_[_0xc710('0x1b')](_0x323902['options'][_0xc710('0x1c')],function(_0x17a817){return{'model':db[_0x17a817[_0xc710('0x1d')]],'as':_0x17a817['as'],'attributes':_0x17a817[_0xc710('0x1a')],'include':_0x17a817['include']?_['map'](_0x17a817[_0xc710('0x1c')],function(_0x44126d){return{'model':db[_0x44126d[_0xc710('0x1d')]],'as':_0x44126d['as'],'attributes':_0x44126d[_0xc710('0x1a')],'include':_0x44126d[_0xc710('0x1c')]?_[_0xc710('0x1b')](_0x44126d[_0xc710('0x1c')],function(_0x2209c1){return{'model':db[_0x2209c1[_0xc710('0x1d')]],'as':_0x2209c1['as'],'attributes':_0x2209c1[_0xc710('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc710('0x1e')](function(_0x2cbdeb){logger[_0xc710('0xb')]('GetDynamics365Account',_0x323902);logger[_0xc710('0x1f')](_0xc710('0x14'),_0x323902,JSON[_0xc710('0x20')](_0x2cbdeb));_0x529aa8(_0x2cbdeb);})[_0xc710('0x13')](function(_0x36e0b8){logger[_0xc710('0xe')]('GetDynamics365Account',_0x36e0b8[_0xc710('0x11')],_0x323902);_0x2e5a76(_0x202161['error'](0x1f4,_0x36e0b8['message']));});});};exports[_0xc710('0x21')]=function(_0x19badf){var _0x4f15f2=this;return new Promise(function(_0x1371aa,_0x396223){return db['Dynamics365Account']['find']({'raw':_0x19badf[_0xc710('0x17')]?_0x19badf[_0xc710('0x17')][_0xc710('0x18')]===undefined?!![]:![]:!![],'where':_0x19badf[_0xc710('0x17')]?_0x19badf[_0xc710('0x17')][_0xc710('0x19')]||null:null,'attributes':_0x19badf[_0xc710('0x17')]?_0x19badf[_0xc710('0x17')][_0xc710('0x1a')]||null:null,'include':_0x19badf['options']?_0x19badf[_0xc710('0x17')]['include']?_[_0xc710('0x1b')](_0x19badf['options'][_0xc710('0x1c')],function(_0x1fdc6f){return{'model':db[_0x1fdc6f['model']],'as':_0x1fdc6f['as'],'attributes':_0x1fdc6f[_0xc710('0x1a')],'include':_0x1fdc6f[_0xc710('0x1c')]?_[_0xc710('0x1b')](_0x1fdc6f[_0xc710('0x1c')],function(_0x42feae){return{'model':db[_0x42feae[_0xc710('0x1d')]],'as':_0x42feae['as'],'attributes':_0x42feae['attributes'],'include':_0x42feae[_0xc710('0x1c')]?_[_0xc710('0x1b')](_0x42feae['include'],function(_0x2796d3){return{'model':db[_0x2796d3[_0xc710('0x1d')]],'as':_0x2796d3['as'],'attributes':_0x2796d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x445daf){logger[_0xc710('0xb')](_0xc710('0x21'),_0x19badf);logger['debug'](_0xc710('0x21'),_0x19badf,JSON[_0xc710('0x20')](_0x445daf));_0x1371aa(_0x445daf);})[_0xc710('0x13')](function(_0x33938e){logger['error'](_0xc710('0x21'),_0x33938e[_0xc710('0x11')],_0x19badf);_0x396223(_0x4f15f2[_0xc710('0xe')](0x1f4,_0x33938e[_0xc710('0x11')]));});});}; \ No newline at end of file +var _0x1be9=['GetDynamics365Account','stringify','ShowDynamics365Account','model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account','findAll','raw','options','where','include','map','attributes'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1be9,0x1e4));var _0x91be=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1be9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x91be('0x0'));var util=require(_0x91be('0x1'));var moment=require('moment');var BPromise=require(_0x91be('0x2'));var rs=require(_0x91be('0x3'));var fs=require('fs');var Redis=require(_0x91be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91be('0x5'));var logger=require('../../config/logger')(_0x91be('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x91be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5820da,_0x20f46c,_0xd033e0){return new BPromise(function(_0x306b7c,_0x35606d){return client[_0x91be('0x8')](_0x5820da,_0xd033e0)[_0x91be('0x9')](function(_0x187db0){logger[_0x91be('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x20f46c,_0x91be('0xb'));logger[_0x91be('0xc')](_0x91be('0xd'),_0x20f46c,'request\x20sent',JSON['stringify'](_0x187db0));if(_0x187db0[_0x91be('0xe')]){if(_0x187db0['error'][_0x91be('0xf')]===0x1f4){logger[_0x91be('0xe')](_0x91be('0x10'),_0x20f46c,_0x187db0[_0x91be('0xe')][_0x91be('0x11')]);return _0x35606d(_0x187db0['error']['message']);}logger['error'](_0x91be('0x10'),_0x20f46c,_0x187db0[_0x91be('0xe')][_0x91be('0x11')]);return _0x306b7c(_0x187db0['error'][_0x91be('0x11')]);}else{logger['info'](_0x91be('0x10'),_0x20f46c,_0x91be('0xb'));_0x306b7c(_0x187db0[_0x91be('0x12')][_0x91be('0x11')]);}})[_0x91be('0x13')](function(_0xbd0544){logger['error'](_0x91be('0x10'),_0x20f46c,_0xbd0544);_0x35606d(_0xbd0544);});});}exports['GetDynamics365Account']=function(_0x4ee624){var _0x1066e9=this;return new Promise(function(_0x35f28f,_0x543612){return db[_0x91be('0x14')][_0x91be('0x15')]({'raw':_0x4ee624['options']?_0x4ee624['options'][_0x91be('0x16')]===undefined?!![]:![]:!![],'where':_0x4ee624['options']?_0x4ee624[_0x91be('0x17')][_0x91be('0x18')]||null:null,'attributes':_0x4ee624[_0x91be('0x17')]?_0x4ee624['options']['attributes']||null:null,'limit':_0x4ee624[_0x91be('0x17')]?_0x4ee624[_0x91be('0x17')]['limit']||null:null,'include':_0x4ee624[_0x91be('0x17')]?_0x4ee624['options'][_0x91be('0x19')]?_[_0x91be('0x1a')](_0x4ee624[_0x91be('0x17')][_0x91be('0x19')],function(_0x1fa3e2){return{'model':db[_0x1fa3e2['model']],'as':_0x1fa3e2['as'],'attributes':_0x1fa3e2[_0x91be('0x1b')],'include':_0x1fa3e2[_0x91be('0x19')]?_[_0x91be('0x1a')](_0x1fa3e2[_0x91be('0x19')],function(_0x566609){return{'model':db[_0x566609['model']],'as':_0x566609['as'],'attributes':_0x566609[_0x91be('0x1b')],'include':_0x566609[_0x91be('0x19')]?_['map'](_0x566609[_0x91be('0x19')],function(_0x54aea9){return{'model':db[_0x54aea9['model']],'as':_0x54aea9['as'],'attributes':_0x54aea9[_0x91be('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x91be('0x9')](function(_0x31b678){logger[_0x91be('0xa')](_0x91be('0x1c'),_0x4ee624);logger[_0x91be('0xc')](_0x91be('0x1c'),_0x4ee624,JSON[_0x91be('0x1d')](_0x31b678));_0x35f28f(_0x31b678);})[_0x91be('0x13')](function(_0x117f68){logger['error'](_0x91be('0x1c'),_0x117f68[_0x91be('0x11')],_0x4ee624);_0x543612(_0x1066e9[_0x91be('0xe')](0x1f4,_0x117f68[_0x91be('0x11')]));});});};exports[_0x91be('0x1e')]=function(_0x32d4e2){var _0x2d2bcd=this;return new Promise(function(_0x7ecb99,_0x1ec3eb){return db[_0x91be('0x14')]['find']({'raw':_0x32d4e2[_0x91be('0x17')]?_0x32d4e2[_0x91be('0x17')][_0x91be('0x16')]===undefined?!![]:![]:!![],'where':_0x32d4e2['options']?_0x32d4e2['options'][_0x91be('0x18')]||null:null,'attributes':_0x32d4e2[_0x91be('0x17')]?_0x32d4e2[_0x91be('0x17')]['attributes']||null:null,'include':_0x32d4e2['options']?_0x32d4e2[_0x91be('0x17')][_0x91be('0x19')]?_[_0x91be('0x1a')](_0x32d4e2[_0x91be('0x17')][_0x91be('0x19')],function(_0x44652e){return{'model':db[_0x44652e[_0x91be('0x1f')]],'as':_0x44652e['as'],'attributes':_0x44652e[_0x91be('0x1b')],'include':_0x44652e[_0x91be('0x19')]?_[_0x91be('0x1a')](_0x44652e[_0x91be('0x19')],function(_0x3d68d3){return{'model':db[_0x3d68d3[_0x91be('0x1f')]],'as':_0x3d68d3['as'],'attributes':_0x3d68d3[_0x91be('0x1b')],'include':_0x3d68d3[_0x91be('0x19')]?_[_0x91be('0x1a')](_0x3d68d3[_0x91be('0x19')],function(_0x13b450){return{'model':db[_0x13b450[_0x91be('0x1f')]],'as':_0x13b450['as'],'attributes':_0x13b450['attributes']};}):[]};}):[]};}):[]:[]})[_0x91be('0x9')](function(_0x133e90){logger[_0x91be('0xa')](_0x91be('0x1e'),_0x32d4e2);logger[_0x91be('0xc')](_0x91be('0x1e'),_0x32d4e2,JSON[_0x91be('0x1d')](_0x133e90));_0x7ecb99(_0x133e90);})[_0x91be('0x13')](function(_0x1d73f1){logger[_0x91be('0xe')](_0x91be('0x1e'),_0x1d73f1['message'],_0x32d4e2);_0x1ec3eb(_0x2d2bcd[_0x91be('0xe')](0x1f4,_0x1d73f1[_0x91be('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3e3f408..ef97459 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 _0x5255=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5255,0xd1));var _0x5525=function(_0x5db2bf,_0x40cf3d){_0x5db2bf=_0x5db2bf-0x0;var _0x45bb29=_0x5255[_0x5db2bf];return _0x45bb29;};'use strict';var multer=require(_0x5525('0x0'));var util=require('util');var path=require(_0x5525('0x1'));var timeout=require('connect-timeout');var express=require(_0x5525('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5525('0x3'));var config=require(_0x5525('0x4'));var controller=require(_0x5525('0x5'));router[_0x5525('0x6')]('/',auth[_0x5525('0x7')](),controller[_0x5525('0x8')]);router[_0x5525('0x6')](_0x5525('0x9'),auth[_0x5525('0x7')](),controller[_0x5525('0xa')]);router['get'](_0x5525('0xb'),auth[_0x5525('0x7')](),controller['getFields']);router['get'](_0x5525('0xc'),auth[_0x5525('0x7')](),controller[_0x5525('0xd')]);router[_0x5525('0x6')](_0x5525('0xe'),auth[_0x5525('0x7')](),controller[_0x5525('0xf')]);router[_0x5525('0x10')]('/',auth[_0x5525('0x7')](),controller[_0x5525('0x11')]);router[_0x5525('0x12')](_0x5525('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5525('0x13')](_0x5525('0x9'),auth['isAuthenticated'](),controller[_0x5525('0x14')]);module[_0x5525('0x15')]=router; \ No newline at end of file +var _0x8de9=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','path'];(function(_0x523f1b,_0x38dbf0){var _0x88d700=function(_0x5a241c){while(--_0x5a241c){_0x523f1b['push'](_0x523f1b['shift']());}};_0x88d700(++_0x38dbf0);}(_0x8de9,0x1e2));var _0x98de=function(_0x337438,_0x157dec){_0x337438=_0x337438-0x0;var _0xfcffc2=_0x8de9[_0x337438];return _0xfcffc2;};'use strict';var multer=require('multer');var util=require(_0x98de('0x0'));var path=require(_0x98de('0x1'));var timeout=require(_0x98de('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x98de('0x3'));var auth=require(_0x98de('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x98de('0x5'));var controller=require(_0x98de('0x6'));router[_0x98de('0x7')]('/',auth[_0x98de('0x8')](),controller[_0x98de('0x9')]);router[_0x98de('0x7')](_0x98de('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x98de('0x7')](_0x98de('0xb'),auth[_0x98de('0x8')](),controller['getFields']);router[_0x98de('0x7')](_0x98de('0xc'),auth[_0x98de('0x8')](),controller[_0x98de('0xd')]);router['get'](_0x98de('0xe'),auth[_0x98de('0x8')](),controller[_0x98de('0xf')]);router[_0x98de('0x10')]('/',auth['isAuthenticated'](),controller[_0x98de('0x11')]);router[_0x98de('0x12')]('/:id',auth[_0x98de('0x8')](),controller[_0x98de('0x13')]);router[_0x98de('0x14')](_0x98de('0xa'),auth[_0x98de('0x8')](),controller[_0x98de('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f905e01..89946e0 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 _0x3976=['incident','sequelize','exports','STRING','ENUM','phonecall'];(function(_0xad04e,_0x3dd6b1){var _0x44330f=function(_0x594e41){while(--_0x594e41){_0xad04e['push'](_0xad04e['shift']());}};_0x44330f(++_0x3dd6b1);}(_0x3976,0x187));var _0x6397=function(_0x3da2cd,_0x59aa26){_0x3da2cd=_0x3da2cd-0x0;var _0x160082=_0x3976[_0x3da2cd];return _0x160082;};'use strict';var Sequelize=require(_0x6397('0x0'));module[_0x6397('0x1')]={'name':{'type':Sequelize[_0x6397('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x6397('0x3')]('incident',_0x6397('0x4')),'defaultValue':_0x6397('0x5')}}; \ No newline at end of file +var _0x003b=['STRING','ENUM','incident','exports'];(function(_0x441515,_0x46b126){var _0xa7a8c8=function(_0x298007){while(--_0x298007){_0x441515['push'](_0x441515['shift']());}};_0xa7a8c8(++_0x46b126);}(_0x003b,0x197));var _0xb003=function(_0x268458,_0x545e1e){_0x268458=_0x268458-0x0;var _0x3e6df7=_0x003b[_0x268458];return _0x3e6df7;};'use strict';var Sequelize=require('sequelize');module[_0xb003('0x0')]={'name':{'type':Sequelize[_0xb003('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xb003('0x2')](_0xb003('0x3'),'phonecall'),'defaultValue':_0xb003('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 428a052..1040587 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 _0xb521=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','fieldName','type','key','model','map','keys','filters','query','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','rows','catch','params','rawAttributes','include','create','body','find','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x314918,_0x4fb2b5){var _0x1b9fc1=function(_0x592680){while(--_0x592680){_0x314918['push'](_0x314918['shift']());}};_0x1b9fc1(++_0x4fb2b5);}(_0xb521,0xd3));var _0x1b52=function(_0x1ae6b0,_0x3e96fe){_0x1ae6b0=_0x1ae6b0-0x0;var _0x28f52c=_0xb521[_0x1ae6b0];return _0x28f52c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b52('0x0'));var jsonpatch=require(_0x1b52('0x1'));var rp=require(_0x1b52('0x2'));var moment=require(_0x1b52('0x3'));var BPromise=require(_0x1b52('0x4'));var Mustache=require(_0x1b52('0x5'));var util=require(_0x1b52('0x6'));var path=require(_0x1b52('0x7'));var sox=require('sox');var csv=require(_0x1b52('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b52('0x9'));var _=require(_0x1b52('0xa'));var squel=require(_0x1b52('0xb'));var crypto=require(_0x1b52('0xc'));var jsforce=require(_0x1b52('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b52('0xe'));var Papa=require('papaparse');var Redis=require(_0x1b52('0xf'));var authService=require(_0x1b52('0x10'));var qs=require(_0x1b52('0x11'));var as=require(_0x1b52('0x12'));var hardwareService=require(_0x1b52('0x13'));var logger=require(_0x1b52('0x14'))(_0x1b52('0x15'));var utils=require('../../config/utils');var config=require(_0x1b52('0x16'));var licenseUtil=require(_0x1b52('0x17'));var db=require(_0x1b52('0x18'))['db'];function respondWithStatusCode(_0x58f091,_0x3ab0cd){_0x3ab0cd=_0x3ab0cd||0xcc;return function(_0x1a139c){if(_0x1a139c){return _0x58f091[_0x1b52('0x19')](_0x3ab0cd);}return _0x58f091['status'](_0x3ab0cd)[_0x1b52('0x1a')]();};}function respondWithResult(_0x44627f,_0x425525){_0x425525=_0x425525||0xc8;return function(_0x3e4777){if(_0x3e4777){return _0x44627f[_0x1b52('0x1b')](_0x425525)[_0x1b52('0x1c')](_0x3e4777);}};}function respondWithFilteredResult(_0x488d24,_0x3ea3c7){return function(_0x184fd3){if(_0x184fd3){var _0x4273c7=typeof _0x3ea3c7[_0x1b52('0x1d')]===_0x1b52('0x1e')&&typeof _0x3ea3c7[_0x1b52('0x1f')]===_0x1b52('0x1e');var _0x1c59e3=_0x184fd3[_0x1b52('0x20')];var _0xab1fc2=_0x4273c7?0x0:_0x3ea3c7[_0x1b52('0x1d')];var _0x9a1402=_0x4273c7?_0x184fd3[_0x1b52('0x20')]:_0x3ea3c7[_0x1b52('0x1d')]+_0x3ea3c7[_0x1b52('0x1f')];var _0xeb2854;if(_0x9a1402>=_0x1c59e3){_0x9a1402=_0x1c59e3;_0xeb2854=0xc8;}else{_0xeb2854=0xce;}_0x488d24[_0x1b52('0x1b')](_0xeb2854);return _0x488d24['set'](_0x1b52('0x21'),_0xab1fc2+'-'+_0x9a1402+'/'+_0x1c59e3)[_0x1b52('0x1c')](_0x184fd3);}return null;};}function patchUpdates(_0x2cf749){return function(_0x5de922){try{jsonpatch['apply'](_0x5de922,_0x2cf749,!![]);}catch(_0x4bce3f){return BPromise[_0x1b52('0x22')](_0x4bce3f);}return _0x5de922[_0x1b52('0x23')]();};}function saveUpdates(_0x1fd7c3,_0xceec51){return function(_0x4e94b9){if(_0x4e94b9){return _0x4e94b9[_0x1b52('0x24')](_0x1fd7c3)[_0x1b52('0x25')](function(_0x478398){return _0x478398;});}return null;};}function removeEntity(_0x3add45,_0x46e5ed){return function(_0x54ed13){if(_0x54ed13){return _0x54ed13[_0x1b52('0x26')]()[_0x1b52('0x25')](function(){_0x3add45['status'](0xcc)[_0x1b52('0x1a')]();});}};}function handleEntityNotFound(_0x5dfde3,_0x31aa25){return function(_0x14d646){if(!_0x14d646){_0x5dfde3[_0x1b52('0x19')](0x194);}return _0x14d646;};}function handleError(_0x421670,_0x4e5c4f){_0x4e5c4f=_0x4e5c4f||0x1f4;return function(_0x8c4ab8){logger['error'](_0x8c4ab8[_0x1b52('0x27')]);if(_0x8c4ab8[_0x1b52('0x28')]){delete _0x8c4ab8[_0x1b52('0x28')];}_0x421670[_0x1b52('0x1b')](_0x4e5c4f)[_0x1b52('0x29')](_0x8c4ab8);};}exports['index']=function(_0x4e5a5d,_0x1f7f41){var _0x1e1f2c={},_0x42f574={},_0x4063f5={'count':0x0,'rows':[]};var _0x2cdc4f=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0x4ca3df){return{'name':_0x4ca3df[_0x1b52('0x2a')],'type':_0x4ca3df[_0x1b52('0x2b')][_0x1b52('0x2c')]};});_0x42f574[_0x1b52('0x2d')]=_[_0x1b52('0x2e')](_0x2cdc4f,_0x1b52('0x28'));_0x42f574['query']=_[_0x1b52('0x2f')](_0x4e5a5d['query']);_0x42f574[_0x1b52('0x30')]=_['intersection'](_0x42f574[_0x1b52('0x2d')],_0x42f574[_0x1b52('0x31')]);_0x1e1f2c['attributes']=_[_0x1b52('0x32')](_0x42f574[_0x1b52('0x2d')],qs[_0x1b52('0x33')](_0x4e5a5d[_0x1b52('0x31')][_0x1b52('0x33')]));_0x1e1f2c[_0x1b52('0x34')]=_0x1e1f2c[_0x1b52('0x34')][_0x1b52('0x35')]?_0x1e1f2c['attributes']:_0x42f574[_0x1b52('0x2d')];if(!_0x4e5a5d['query']['hasOwnProperty'](_0x1b52('0x36'))){_0x1e1f2c[_0x1b52('0x1f')]=qs[_0x1b52('0x1f')](_0x4e5a5d[_0x1b52('0x31')][_0x1b52('0x1f')]);_0x1e1f2c[_0x1b52('0x1d')]=qs[_0x1b52('0x1d')](_0x4e5a5d['query'][_0x1b52('0x1d')]);}_0x1e1f2c[_0x1b52('0x37')]=qs[_0x1b52('0x38')](_0x4e5a5d[_0x1b52('0x31')][_0x1b52('0x38')]);_0x1e1f2c['where']=qs[_0x1b52('0x30')](_['pick'](_0x4e5a5d[_0x1b52('0x31')],_0x42f574['filters']),_0x2cdc4f);if(_0x4e5a5d[_0x1b52('0x31')][_0x1b52('0x39')]){_0x1e1f2c[_0x1b52('0x3a')]=_[_0x1b52('0x3b')](_0x1e1f2c[_0x1b52('0x3a')],{'$or':_[_0x1b52('0x2e')](_0x2cdc4f,function(_0xcdc8e4){if(_0xcdc8e4['type']!==_0x1b52('0x3c')){var _0x677d58={};_0x677d58[_0xcdc8e4[_0x1b52('0x28')]]={'$like':'%'+_0x4e5a5d[_0x1b52('0x31')][_0x1b52('0x39')]+'%'};return _0x677d58;}})});}_0x1e1f2c=_[_0x1b52('0x3b')]({},_0x1e1f2c,_0x4e5a5d[_0x1b52('0x3d')]);var _0x219495={'where':_0x1e1f2c[_0x1b52('0x3a')]};return db[_0x1b52('0x3e')][_0x1b52('0x20')](_0x219495)[_0x1b52('0x25')](function(_0x57e3ed){_0x4063f5[_0x1b52('0x20')]=_0x57e3ed;if(_0x4e5a5d[_0x1b52('0x31')][_0x1b52('0x3f')]){_0x1e1f2c['include']=[{'all':!![]}];}return db[_0x1b52('0x3e')]['findAll'](_0x1e1f2c);})['then'](function(_0x2fd6af){_0x4063f5[_0x1b52('0x40')]=_0x2fd6af;return _0x4063f5;})['then'](respondWithFilteredResult(_0x1f7f41,_0x1e1f2c))[_0x1b52('0x41')](handleError(_0x1f7f41,null));};exports['show']=function(_0x429d5d,_0x269133){var _0x110659={'raw':![],'where':{'id':_0x429d5d[_0x1b52('0x42')]['id']}},_0x20c513={};_0x20c513['model']=_[_0x1b52('0x2f')](db[_0x1b52('0x3e')][_0x1b52('0x43')]);_0x20c513[_0x1b52('0x31')]=_[_0x1b52('0x2f')](_0x429d5d[_0x1b52('0x31')]);_0x20c513[_0x1b52('0x30')]=_[_0x1b52('0x32')](_0x20c513[_0x1b52('0x2d')],_0x20c513[_0x1b52('0x31')]);_0x110659[_0x1b52('0x34')]=_[_0x1b52('0x32')](_0x20c513[_0x1b52('0x2d')],qs[_0x1b52('0x33')](_0x429d5d[_0x1b52('0x31')][_0x1b52('0x33')]));_0x110659[_0x1b52('0x34')]=_0x110659[_0x1b52('0x34')]['length']?_0x110659['attributes']:_0x20c513['model'];if(_0x429d5d[_0x1b52('0x31')]['includeAll']){_0x110659[_0x1b52('0x44')]=[{'all':!![]}];}_0x110659=_[_0x1b52('0x3b')]({},_0x110659,_0x429d5d[_0x1b52('0x3d')]);return db[_0x1b52('0x3e')]['find'](_0x110659)[_0x1b52('0x25')](handleEntityNotFound(_0x269133,null))[_0x1b52('0x25')](respondWithResult(_0x269133,null))[_0x1b52('0x41')](handleError(_0x269133,null));};exports['create']=function(_0x18f81c,_0x43903d){return db['Dynamics365Configuration'][_0x1b52('0x45')](_0x18f81c[_0x1b52('0x46')],{})[_0x1b52('0x25')](respondWithResult(_0x43903d,0xc9))[_0x1b52('0x41')](handleError(_0x43903d,null));};exports[_0x1b52('0x24')]=function(_0x4ff653,_0x52df4a){if(_0x4ff653[_0x1b52('0x46')]['id']){delete _0x4ff653[_0x1b52('0x46')]['id'];}return db[_0x1b52('0x3e')][_0x1b52('0x47')]({'where':{'id':_0x4ff653[_0x1b52('0x42')]['id']}})[_0x1b52('0x25')](handleEntityNotFound(_0x52df4a,null))[_0x1b52('0x25')](saveUpdates(_0x4ff653[_0x1b52('0x46')],null))['then'](respondWithResult(_0x52df4a,null))[_0x1b52('0x41')](handleError(_0x52df4a,null));};exports[_0x1b52('0x26')]=function(_0x582eb3,_0xbd69fd){return db[_0x1b52('0x3e')]['find']({'where':{'id':_0x582eb3[_0x1b52('0x42')]['id']}})['then'](handleEntityNotFound(_0xbd69fd,null))[_0x1b52('0x25')](removeEntity(_0xbd69fd,null))['catch'](handleError(_0xbd69fd,null));};exports[_0x1b52('0x48')]=function(_0xbeb4f2,_0xc444b4,_0x96a1c6){var _0xd97e35={};var _0x198af5={};var _0x316693;var _0x5c09ac;return db[_0x1b52('0x3e')][_0x1b52('0x49')]({'where':{'id':_0xbeb4f2[_0x1b52('0x42')]['id']}})[_0x1b52('0x25')](handleEntityNotFound(_0xc444b4,null))[_0x1b52('0x25')](function(_0x23d292){if(_0x23d292){_0x316693=_0x23d292;_0x198af5[_0x1b52('0x2d')]=_[_0x1b52('0x2f')](db[_0x1b52('0x4a')][_0x1b52('0x43')]);_0x198af5[_0x1b52('0x31')]=_[_0x1b52('0x2f')](_0xbeb4f2['query']);_0x198af5[_0x1b52('0x30')]=_[_0x1b52('0x32')](_0x198af5['model'],_0x198af5[_0x1b52('0x31')]);_0xd97e35[_0x1b52('0x34')]=_[_0x1b52('0x32')](_0x198af5[_0x1b52('0x2d')],qs['fields'](_0xbeb4f2[_0x1b52('0x31')]['fields']));_0xd97e35[_0x1b52('0x34')]=_0xd97e35[_0x1b52('0x34')][_0x1b52('0x35')]?_0xd97e35['attributes']:_0x198af5[_0x1b52('0x2d')];_0xd97e35[_0x1b52('0x37')]=qs[_0x1b52('0x38')](_0xbeb4f2[_0x1b52('0x31')]['sort']);_0xd97e35[_0x1b52('0x3a')]=qs[_0x1b52('0x30')](_[_0x1b52('0x4b')](_0xbeb4f2['query'],_0x198af5[_0x1b52('0x30')]));if(_0xbeb4f2[_0x1b52('0x31')][_0x1b52('0x39')]){_0xd97e35[_0x1b52('0x3a')]=_['merge'](_0xd97e35[_0x1b52('0x3a')],{'$or':_[_0x1b52('0x2e')](_0xd97e35['attributes'],function(_0x31cc89){var _0x26f6e6={};_0x26f6e6[_0x31cc89]={'$like':'%'+_0xbeb4f2[_0x1b52('0x31')][_0x1b52('0x39')]+'%'};return _0x26f6e6;})});}_0xd97e35=_['merge']({},_0xd97e35,_0xbeb4f2[_0x1b52('0x3d')]);return _0x316693[_0x1b52('0x48')](_0xd97e35);}})[_0x1b52('0x25')](function(_0x2bc090){if(_0x2bc090){_0x5c09ac=_0x2bc090['length'];if(!_0xbeb4f2[_0x1b52('0x31')]['hasOwnProperty'](_0x1b52('0x36'))){_0xd97e35['limit']=qs[_0x1b52('0x1f')](_0xbeb4f2['query']['limit']);_0xd97e35[_0x1b52('0x1d')]=qs[_0x1b52('0x1d')](_0xbeb4f2[_0x1b52('0x31')][_0x1b52('0x1d')]);}return _0x316693[_0x1b52('0x48')](_0xd97e35);}})[_0x1b52('0x25')](function(_0x26f69a){if(_0x26f69a){return _0x26f69a?{'count':_0x5c09ac,'rows':_0x26f69a}:null;}})[_0x1b52('0x25')](respondWithResult(_0xc444b4,null))['catch'](handleError(_0xc444b4,null));};exports[_0x1b52('0x4c')]=function(_0x1ed27d,_0xd1624,_0x4fbc26){var _0x57bb33={};var _0xe9b693={};var _0x37d8eb;var _0xa259fb;return db[_0x1b52('0x3e')][_0x1b52('0x49')]({'where':{'id':_0x1ed27d[_0x1b52('0x42')]['id']}})[_0x1b52('0x25')](handleEntityNotFound(_0xd1624,null))['then'](function(_0x48ba13){if(_0x48ba13){_0x37d8eb=_0x48ba13;_0xe9b693[_0x1b52('0x2d')]=_[_0x1b52('0x2f')](db[_0x1b52('0x4a')]['rawAttributes']);_0xe9b693[_0x1b52('0x31')]=_[_0x1b52('0x2f')](_0x1ed27d[_0x1b52('0x31')]);_0xe9b693[_0x1b52('0x30')]=_['intersection'](_0xe9b693['model'],_0xe9b693['query']);_0x57bb33[_0x1b52('0x34')]=_[_0x1b52('0x32')](_0xe9b693[_0x1b52('0x2d')],qs[_0x1b52('0x33')](_0x1ed27d[_0x1b52('0x31')]['fields']));_0x57bb33[_0x1b52('0x34')]=_0x57bb33[_0x1b52('0x34')]['length']?_0x57bb33[_0x1b52('0x34')]:_0xe9b693[_0x1b52('0x2d')];_0x57bb33[_0x1b52('0x37')]=qs[_0x1b52('0x38')](_0x1ed27d['query'][_0x1b52('0x38')]);_0x57bb33[_0x1b52('0x3a')]=qs['filters'](_[_0x1b52('0x4b')](_0x1ed27d[_0x1b52('0x31')],_0xe9b693['filters']));if(_0x1ed27d[_0x1b52('0x31')]['filter']){_0x57bb33[_0x1b52('0x3a')]=_[_0x1b52('0x3b')](_0x57bb33['where'],{'$or':_[_0x1b52('0x2e')](_0x57bb33[_0x1b52('0x34')],function(_0x1582a3){var _0x446409={};_0x446409[_0x1582a3]={'$like':'%'+_0x1ed27d[_0x1b52('0x31')][_0x1b52('0x39')]+'%'};return _0x446409;})});}_0x57bb33=_[_0x1b52('0x3b')]({},_0x57bb33,_0x1ed27d['options']);return _0x37d8eb[_0x1b52('0x4c')](_0x57bb33);}})[_0x1b52('0x25')](function(_0x4cb8fe){if(_0x4cb8fe){_0xa259fb=_0x4cb8fe['length'];if(!_0x1ed27d[_0x1b52('0x31')]['hasOwnProperty'](_0x1b52('0x36'))){_0x57bb33[_0x1b52('0x1f')]=qs[_0x1b52('0x1f')](_0x1ed27d['query'][_0x1b52('0x1f')]);_0x57bb33['offset']=qs['offset'](_0x1ed27d[_0x1b52('0x31')][_0x1b52('0x1d')]);}return _0x37d8eb['getSubjects'](_0x57bb33);}})[_0x1b52('0x25')](function(_0x2ce9a9){if(_0x2ce9a9){return _0x2ce9a9?{'count':_0xa259fb,'rows':_0x2ce9a9}:null;}})[_0x1b52('0x25')](respondWithResult(_0xd1624,null))['catch'](handleError(_0xd1624,null));};exports[_0x1b52('0x4d')]=function(_0x14f824,_0x3edd0c,_0x174251){var _0x1a6aec={};var _0x377555={};var _0x451c40;var _0x45cd7a;return db[_0x1b52('0x3e')][_0x1b52('0x49')]({'where':{'id':_0x14f824[_0x1b52('0x42')]['id']}})[_0x1b52('0x25')](handleEntityNotFound(_0x3edd0c,null))[_0x1b52('0x25')](function(_0x29beb0){if(_0x29beb0){_0x451c40=_0x29beb0;_0x377555['model']=_[_0x1b52('0x2f')](db[_0x1b52('0x4a')][_0x1b52('0x43')]);_0x377555[_0x1b52('0x31')]=_[_0x1b52('0x2f')](_0x14f824[_0x1b52('0x31')]);_0x377555[_0x1b52('0x30')]=_[_0x1b52('0x32')](_0x377555[_0x1b52('0x2d')],_0x377555['query']);_0x1a6aec[_0x1b52('0x34')]=_[_0x1b52('0x32')](_0x377555[_0x1b52('0x2d')],qs[_0x1b52('0x33')](_0x14f824[_0x1b52('0x31')][_0x1b52('0x33')]));_0x1a6aec[_0x1b52('0x34')]=_0x1a6aec[_0x1b52('0x34')][_0x1b52('0x35')]?_0x1a6aec[_0x1b52('0x34')]:_0x377555[_0x1b52('0x2d')];_0x1a6aec[_0x1b52('0x37')]=qs[_0x1b52('0x38')](_0x14f824['query'][_0x1b52('0x38')]);_0x1a6aec['where']=qs[_0x1b52('0x30')](_['pick'](_0x14f824[_0x1b52('0x31')],_0x377555[_0x1b52('0x30')]));if(_0x14f824[_0x1b52('0x31')][_0x1b52('0x39')]){_0x1a6aec[_0x1b52('0x3a')]=_['merge'](_0x1a6aec[_0x1b52('0x3a')],{'$or':_['map'](_0x1a6aec[_0x1b52('0x34')],function(_0x54227b){var _0x6d6433={};_0x6d6433[_0x54227b]={'$like':'%'+_0x14f824[_0x1b52('0x31')][_0x1b52('0x39')]+'%'};return _0x6d6433;})});}_0x1a6aec=_[_0x1b52('0x3b')]({},_0x1a6aec,_0x14f824[_0x1b52('0x3d')]);return _0x451c40[_0x1b52('0x4d')](_0x1a6aec);}})[_0x1b52('0x25')](function(_0x3b299d){if(_0x3b299d){_0x45cd7a=_0x3b299d[_0x1b52('0x35')];if(!_0x14f824['query']['hasOwnProperty'](_0x1b52('0x36'))){_0x1a6aec[_0x1b52('0x1f')]=qs['limit'](_0x14f824[_0x1b52('0x31')][_0x1b52('0x1f')]);_0x1a6aec[_0x1b52('0x1d')]=qs[_0x1b52('0x1d')](_0x14f824[_0x1b52('0x31')]['offset']);}return _0x451c40['getDescriptions'](_0x1a6aec);}})['then'](function(_0x477ef1){if(_0x477ef1){return _0x477ef1?{'count':_0x45cd7a,'rows':_0x477ef1}:null;}})[_0x1b52('0x25')](respondWithResult(_0x3edd0c,null))[_0x1b52('0x41')](handleError(_0x3edd0c,null));}; \ No newline at end of file +var _0xdf76=['options','create','body','find','Dynamics365Field','order','pick','getFields','getSubjects','findOne','getDescriptions','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','catch','show','params','length'];(function(_0x2ebd15,_0x392b05){var _0x273716=function(_0x40d1a6){while(--_0x40d1a6){_0x2ebd15['push'](_0x2ebd15['shift']());}};_0x273716(++_0x392b05);}(_0xdf76,0xef));var _0x6df7=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0xdf76[_0x35181c];return _0xe14bf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6df7('0x0'));var zipdir=require(_0x6df7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6df7('0x2'));var BPromise=require(_0x6df7('0x3'));var Mustache=require('mustache');var util=require(_0x6df7('0x4'));var path=require(_0x6df7('0x5'));var sox=require(_0x6df7('0x6'));var csv=require(_0x6df7('0x7'));var ejs=require(_0x6df7('0x8'));var fs=require('fs');var fs_extra=require(_0x6df7('0x9'));var _=require(_0x6df7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6df7('0xb'));var deskjs=require(_0x6df7('0xc'));var toCsv=require(_0x6df7('0x7'));var querystring=require(_0x6df7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6df7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6df7('0xf'));var logger=require(_0x6df7('0x10'))(_0x6df7('0x11'));var utils=require(_0x6df7('0x12'));var config=require(_0x6df7('0x13'));var licenseUtil=require(_0x6df7('0x14'));var db=require(_0x6df7('0x15'))['db'];function respondWithStatusCode(_0x415add,_0x32870f){_0x32870f=_0x32870f||0xcc;return function(_0x50ebe8){if(_0x50ebe8){return _0x415add['sendStatus'](_0x32870f);}return _0x415add['status'](_0x32870f)[_0x6df7('0x16')]();};}function respondWithResult(_0x2a7335,_0x5c9e4f){_0x5c9e4f=_0x5c9e4f||0xc8;return function(_0x17174f){if(_0x17174f){return _0x2a7335[_0x6df7('0x17')](_0x5c9e4f)[_0x6df7('0x18')](_0x17174f);}};}function respondWithFilteredResult(_0x31b312,_0x9ff69d){return function(_0xcd519a){if(_0xcd519a){var _0x22fc10=typeof _0x9ff69d['offset']===_0x6df7('0x19')&&typeof _0x9ff69d[_0x6df7('0x1a')]===_0x6df7('0x19');var _0x44b95d=_0xcd519a[_0x6df7('0x1b')];var _0x4c7acb=_0x22fc10?0x0:_0x9ff69d[_0x6df7('0x1c')];var _0x379b6a=_0x22fc10?_0xcd519a[_0x6df7('0x1b')]:_0x9ff69d[_0x6df7('0x1c')]+_0x9ff69d[_0x6df7('0x1a')];var _0x25fa86;if(_0x379b6a>=_0x44b95d){_0x379b6a=_0x44b95d;_0x25fa86=0xc8;}else{_0x25fa86=0xce;}_0x31b312['status'](_0x25fa86);return _0x31b312['set'](_0x6df7('0x1d'),_0x4c7acb+'-'+_0x379b6a+'/'+_0x44b95d)[_0x6df7('0x18')](_0xcd519a);}return null;};}function patchUpdates(_0x54805b){return function(_0x885eb8){try{jsonpatch['apply'](_0x885eb8,_0x54805b,!![]);}catch(_0x7c72fa){return BPromise[_0x6df7('0x1e')](_0x7c72fa);}return _0x885eb8[_0x6df7('0x1f')]();};}function saveUpdates(_0x22e10d,_0x3be821){return function(_0x418af2){if(_0x418af2){return _0x418af2[_0x6df7('0x20')](_0x22e10d)[_0x6df7('0x21')](function(_0x4adee0){return _0x4adee0;});}return null;};}function removeEntity(_0x363a71,_0x33b268){return function(_0xb2434b){if(_0xb2434b){return _0xb2434b['destroy']()[_0x6df7('0x21')](function(){_0x363a71[_0x6df7('0x17')](0xcc)[_0x6df7('0x16')]();});}};}function handleEntityNotFound(_0x3a6b2b,_0x23c095){return function(_0x4aede2){if(!_0x4aede2){_0x3a6b2b[_0x6df7('0x22')](0x194);}return _0x4aede2;};}function handleError(_0x4bd3cd,_0x3ce4b8){_0x3ce4b8=_0x3ce4b8||0x1f4;return function(_0x4f7a25){logger[_0x6df7('0x23')](_0x4f7a25[_0x6df7('0x24')]);if(_0x4f7a25[_0x6df7('0x25')]){delete _0x4f7a25[_0x6df7('0x25')];}_0x4bd3cd[_0x6df7('0x17')](_0x3ce4b8)[_0x6df7('0x26')](_0x4f7a25);};}exports['index']=function(_0x3951f9,_0x1e6f66){var _0x31a1cb={},_0x1c7159={},_0x551765={'count':0x0,'rows':[]};var _0x1d5c5e=_['map'](db[_0x6df7('0x27')][_0x6df7('0x28')],function(_0x4321c8){return{'name':_0x4321c8[_0x6df7('0x29')],'type':_0x4321c8[_0x6df7('0x2a')]['key']};});_0x1c7159['model']=_[_0x6df7('0x2b')](_0x1d5c5e,_0x6df7('0x25'));_0x1c7159[_0x6df7('0x2c')]=_[_0x6df7('0x2d')](_0x3951f9[_0x6df7('0x2c')]);_0x1c7159[_0x6df7('0x2e')]=_[_0x6df7('0x2f')](_0x1c7159['model'],_0x1c7159[_0x6df7('0x2c')]);_0x31a1cb[_0x6df7('0x30')]=_['intersection'](_0x1c7159[_0x6df7('0x31')],qs[_0x6df7('0x32')](_0x3951f9[_0x6df7('0x2c')][_0x6df7('0x32')]));_0x31a1cb[_0x6df7('0x30')]=_0x31a1cb[_0x6df7('0x30')]['length']?_0x31a1cb['attributes']:_0x1c7159[_0x6df7('0x31')];if(!_0x3951f9[_0x6df7('0x2c')][_0x6df7('0x33')](_0x6df7('0x34'))){_0x31a1cb[_0x6df7('0x1a')]=qs[_0x6df7('0x1a')](_0x3951f9['query'][_0x6df7('0x1a')]);_0x31a1cb[_0x6df7('0x1c')]=qs[_0x6df7('0x1c')](_0x3951f9[_0x6df7('0x2c')][_0x6df7('0x1c')]);}_0x31a1cb['order']=qs[_0x6df7('0x35')](_0x3951f9[_0x6df7('0x2c')][_0x6df7('0x35')]);_0x31a1cb['where']=qs['filters'](_['pick'](_0x3951f9[_0x6df7('0x2c')],_0x1c7159[_0x6df7('0x2e')]),_0x1d5c5e);if(_0x3951f9['query'][_0x6df7('0x36')]){_0x31a1cb['where']=_[_0x6df7('0x37')](_0x31a1cb[_0x6df7('0x38')],{'$or':_[_0x6df7('0x2b')](_0x1d5c5e,function(_0x2f27af){if(_0x2f27af[_0x6df7('0x2a')]!==_0x6df7('0x39')){var _0x13a1d1={};_0x13a1d1[_0x2f27af['name']]={'$like':'%'+_0x3951f9[_0x6df7('0x2c')]['filter']+'%'};return _0x13a1d1;}})});}_0x31a1cb=_[_0x6df7('0x37')]({},_0x31a1cb,_0x3951f9['options']);var _0x2d7fe3={'where':_0x31a1cb['where']};return db[_0x6df7('0x27')]['count'](_0x2d7fe3)[_0x6df7('0x21')](function(_0x3f1009){_0x551765[_0x6df7('0x1b')]=_0x3f1009;if(_0x3951f9[_0x6df7('0x2c')][_0x6df7('0x3a')]){_0x31a1cb[_0x6df7('0x3b')]=[{'all':!![]}];}return db[_0x6df7('0x27')][_0x6df7('0x3c')](_0x31a1cb);})['then'](function(_0x51be79){_0x551765['rows']=_0x51be79;return _0x551765;})[_0x6df7('0x21')](respondWithFilteredResult(_0x1e6f66,_0x31a1cb))[_0x6df7('0x3d')](handleError(_0x1e6f66,null));};exports[_0x6df7('0x3e')]=function(_0x5b7214,_0x481d70){var _0x204561={'raw':![],'where':{'id':_0x5b7214[_0x6df7('0x3f')]['id']}},_0x350df9={};_0x350df9[_0x6df7('0x31')]=_[_0x6df7('0x2d')](db['Dynamics365Configuration'][_0x6df7('0x28')]);_0x350df9[_0x6df7('0x2c')]=_[_0x6df7('0x2d')](_0x5b7214[_0x6df7('0x2c')]);_0x350df9[_0x6df7('0x2e')]=_[_0x6df7('0x2f')](_0x350df9['model'],_0x350df9[_0x6df7('0x2c')]);_0x204561[_0x6df7('0x30')]=_['intersection'](_0x350df9[_0x6df7('0x31')],qs[_0x6df7('0x32')](_0x5b7214[_0x6df7('0x2c')]['fields']));_0x204561['attributes']=_0x204561[_0x6df7('0x30')][_0x6df7('0x40')]?_0x204561[_0x6df7('0x30')]:_0x350df9[_0x6df7('0x31')];if(_0x5b7214[_0x6df7('0x2c')][_0x6df7('0x3a')]){_0x204561[_0x6df7('0x3b')]=[{'all':!![]}];}_0x204561=_[_0x6df7('0x37')]({},_0x204561,_0x5b7214[_0x6df7('0x41')]);return db[_0x6df7('0x27')]['find'](_0x204561)[_0x6df7('0x21')](handleEntityNotFound(_0x481d70,null))['then'](respondWithResult(_0x481d70,null))['catch'](handleError(_0x481d70,null));};exports[_0x6df7('0x42')]=function(_0x3c5f5b,_0x296119){return db[_0x6df7('0x27')][_0x6df7('0x42')](_0x3c5f5b[_0x6df7('0x43')],{})[_0x6df7('0x21')](respondWithResult(_0x296119,0xc9))[_0x6df7('0x3d')](handleError(_0x296119,null));};exports['update']=function(_0x2fc618,_0x418410){if(_0x2fc618[_0x6df7('0x43')]['id']){delete _0x2fc618[_0x6df7('0x43')]['id'];}return db[_0x6df7('0x27')][_0x6df7('0x44')]({'where':{'id':_0x2fc618[_0x6df7('0x3f')]['id']}})[_0x6df7('0x21')](handleEntityNotFound(_0x418410,null))['then'](saveUpdates(_0x2fc618[_0x6df7('0x43')],null))[_0x6df7('0x21')](respondWithResult(_0x418410,null))[_0x6df7('0x3d')](handleError(_0x418410,null));};exports['destroy']=function(_0x21b97d,_0x12b891){return db[_0x6df7('0x27')][_0x6df7('0x44')]({'where':{'id':_0x21b97d[_0x6df7('0x3f')]['id']}})[_0x6df7('0x21')](handleEntityNotFound(_0x12b891,null))[_0x6df7('0x21')](removeEntity(_0x12b891,null))['catch'](handleError(_0x12b891,null));};exports['getFields']=function(_0x586383,_0x230d4e,_0x4eeff1){var _0x343075={};var _0x267759={};var _0x1abe26;var _0x31fb0a;return db[_0x6df7('0x27')]['findOne']({'where':{'id':_0x586383[_0x6df7('0x3f')]['id']}})[_0x6df7('0x21')](handleEntityNotFound(_0x230d4e,null))['then'](function(_0x37e551){if(_0x37e551){_0x1abe26=_0x37e551;_0x267759[_0x6df7('0x31')]=_[_0x6df7('0x2d')](db[_0x6df7('0x45')]['rawAttributes']);_0x267759['query']=_['keys'](_0x586383[_0x6df7('0x2c')]);_0x267759['filters']=_[_0x6df7('0x2f')](_0x267759[_0x6df7('0x31')],_0x267759[_0x6df7('0x2c')]);_0x343075[_0x6df7('0x30')]=_[_0x6df7('0x2f')](_0x267759[_0x6df7('0x31')],qs['fields'](_0x586383[_0x6df7('0x2c')][_0x6df7('0x32')]));_0x343075[_0x6df7('0x30')]=_0x343075['attributes']['length']?_0x343075[_0x6df7('0x30')]:_0x267759[_0x6df7('0x31')];_0x343075[_0x6df7('0x46')]=qs[_0x6df7('0x35')](_0x586383[_0x6df7('0x2c')][_0x6df7('0x35')]);_0x343075[_0x6df7('0x38')]=qs['filters'](_[_0x6df7('0x47')](_0x586383[_0x6df7('0x2c')],_0x267759['filters']));if(_0x586383[_0x6df7('0x2c')][_0x6df7('0x36')]){_0x343075[_0x6df7('0x38')]=_[_0x6df7('0x37')](_0x343075[_0x6df7('0x38')],{'$or':_[_0x6df7('0x2b')](_0x343075[_0x6df7('0x30')],function(_0x24646e){var _0x37f5d6={};_0x37f5d6[_0x24646e]={'$like':'%'+_0x586383['query'][_0x6df7('0x36')]+'%'};return _0x37f5d6;})});}_0x343075=_[_0x6df7('0x37')]({},_0x343075,_0x586383[_0x6df7('0x41')]);return _0x1abe26[_0x6df7('0x48')](_0x343075);}})[_0x6df7('0x21')](function(_0x32b51c){if(_0x32b51c){_0x31fb0a=_0x32b51c['length'];if(!_0x586383[_0x6df7('0x2c')][_0x6df7('0x33')](_0x6df7('0x34'))){_0x343075[_0x6df7('0x1a')]=qs[_0x6df7('0x1a')](_0x586383[_0x6df7('0x2c')][_0x6df7('0x1a')]);_0x343075[_0x6df7('0x1c')]=qs[_0x6df7('0x1c')](_0x586383[_0x6df7('0x2c')]['offset']);}return _0x1abe26[_0x6df7('0x48')](_0x343075);}})[_0x6df7('0x21')](function(_0x41c55b){if(_0x41c55b){return _0x41c55b?{'count':_0x31fb0a,'rows':_0x41c55b}:null;}})[_0x6df7('0x21')](respondWithResult(_0x230d4e,null))['catch'](handleError(_0x230d4e,null));};exports[_0x6df7('0x49')]=function(_0x30c47e,_0xae6f14,_0x5af113){var _0x1681f0={};var _0x2fc8de={};var _0x3f09a8;var _0x3d3c4f;return db[_0x6df7('0x27')][_0x6df7('0x4a')]({'where':{'id':_0x30c47e[_0x6df7('0x3f')]['id']}})[_0x6df7('0x21')](handleEntityNotFound(_0xae6f14,null))['then'](function(_0x528bef){if(_0x528bef){_0x3f09a8=_0x528bef;_0x2fc8de['model']=_[_0x6df7('0x2d')](db[_0x6df7('0x45')]['rawAttributes']);_0x2fc8de[_0x6df7('0x2c')]=_[_0x6df7('0x2d')](_0x30c47e[_0x6df7('0x2c')]);_0x2fc8de['filters']=_['intersection'](_0x2fc8de['model'],_0x2fc8de[_0x6df7('0x2c')]);_0x1681f0[_0x6df7('0x30')]=_['intersection'](_0x2fc8de[_0x6df7('0x31')],qs['fields'](_0x30c47e[_0x6df7('0x2c')][_0x6df7('0x32')]));_0x1681f0[_0x6df7('0x30')]=_0x1681f0[_0x6df7('0x30')]['length']?_0x1681f0['attributes']:_0x2fc8de[_0x6df7('0x31')];_0x1681f0['order']=qs['sort'](_0x30c47e[_0x6df7('0x2c')][_0x6df7('0x35')]);_0x1681f0[_0x6df7('0x38')]=qs[_0x6df7('0x2e')](_[_0x6df7('0x47')](_0x30c47e[_0x6df7('0x2c')],_0x2fc8de[_0x6df7('0x2e')]));if(_0x30c47e[_0x6df7('0x2c')][_0x6df7('0x36')]){_0x1681f0[_0x6df7('0x38')]=_['merge'](_0x1681f0['where'],{'$or':_[_0x6df7('0x2b')](_0x1681f0[_0x6df7('0x30')],function(_0x5956da){var _0x1a52c2={};_0x1a52c2[_0x5956da]={'$like':'%'+_0x30c47e[_0x6df7('0x2c')][_0x6df7('0x36')]+'%'};return _0x1a52c2;})});}_0x1681f0=_[_0x6df7('0x37')]({},_0x1681f0,_0x30c47e['options']);return _0x3f09a8['getSubjects'](_0x1681f0);}})[_0x6df7('0x21')](function(_0x25c0b2){if(_0x25c0b2){_0x3d3c4f=_0x25c0b2[_0x6df7('0x40')];if(!_0x30c47e[_0x6df7('0x2c')]['hasOwnProperty'](_0x6df7('0x34'))){_0x1681f0['limit']=qs[_0x6df7('0x1a')](_0x30c47e[_0x6df7('0x2c')][_0x6df7('0x1a')]);_0x1681f0[_0x6df7('0x1c')]=qs[_0x6df7('0x1c')](_0x30c47e[_0x6df7('0x2c')][_0x6df7('0x1c')]);}return _0x3f09a8['getSubjects'](_0x1681f0);}})[_0x6df7('0x21')](function(_0x408887){if(_0x408887){return _0x408887?{'count':_0x3d3c4f,'rows':_0x408887}:null;}})[_0x6df7('0x21')](respondWithResult(_0xae6f14,null))['catch'](handleError(_0xae6f14,null));};exports[_0x6df7('0x4b')]=function(_0x156130,_0x5a484c,_0x558a2d){var _0x3b285a={};var _0x361c8f={};var _0x36d617;var _0x36dec5;return db['Dynamics365Configuration'][_0x6df7('0x4a')]({'where':{'id':_0x156130[_0x6df7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5a484c,null))['then'](function(_0x26ef7e){if(_0x26ef7e){_0x36d617=_0x26ef7e;_0x361c8f[_0x6df7('0x31')]=_[_0x6df7('0x2d')](db[_0x6df7('0x45')][_0x6df7('0x28')]);_0x361c8f[_0x6df7('0x2c')]=_[_0x6df7('0x2d')](_0x156130['query']);_0x361c8f[_0x6df7('0x2e')]=_[_0x6df7('0x2f')](_0x361c8f[_0x6df7('0x31')],_0x361c8f['query']);_0x3b285a[_0x6df7('0x30')]=_[_0x6df7('0x2f')](_0x361c8f[_0x6df7('0x31')],qs[_0x6df7('0x32')](_0x156130[_0x6df7('0x2c')][_0x6df7('0x32')]));_0x3b285a[_0x6df7('0x30')]=_0x3b285a['attributes'][_0x6df7('0x40')]?_0x3b285a[_0x6df7('0x30')]:_0x361c8f[_0x6df7('0x31')];_0x3b285a[_0x6df7('0x46')]=qs[_0x6df7('0x35')](_0x156130['query']['sort']);_0x3b285a[_0x6df7('0x38')]=qs['filters'](_[_0x6df7('0x47')](_0x156130[_0x6df7('0x2c')],_0x361c8f['filters']));if(_0x156130[_0x6df7('0x2c')][_0x6df7('0x36')]){_0x3b285a[_0x6df7('0x38')]=_[_0x6df7('0x37')](_0x3b285a['where'],{'$or':_[_0x6df7('0x2b')](_0x3b285a[_0x6df7('0x30')],function(_0x3fa1b2){var _0x1dbb42={};_0x1dbb42[_0x3fa1b2]={'$like':'%'+_0x156130['query']['filter']+'%'};return _0x1dbb42;})});}_0x3b285a=_[_0x6df7('0x37')]({},_0x3b285a,_0x156130[_0x6df7('0x41')]);return _0x36d617[_0x6df7('0x4b')](_0x3b285a);}})[_0x6df7('0x21')](function(_0x5a8549){if(_0x5a8549){_0x36dec5=_0x5a8549['length'];if(!_0x156130[_0x6df7('0x2c')][_0x6df7('0x33')](_0x6df7('0x34'))){_0x3b285a[_0x6df7('0x1a')]=qs[_0x6df7('0x1a')](_0x156130[_0x6df7('0x2c')][_0x6df7('0x1a')]);_0x3b285a[_0x6df7('0x1c')]=qs[_0x6df7('0x1c')](_0x156130[_0x6df7('0x2c')][_0x6df7('0x1c')]);}return _0x36d617[_0x6df7('0x4b')](_0x3b285a);}})[_0x6df7('0x21')](function(_0x3a912b){if(_0x3a912b){return _0x3a912b?{'count':_0x36dec5,'rows':_0x3a912b}:null;}})['then'](respondWithResult(_0x5a484c,null))['catch'](handleError(_0x5a484c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0bfaad6..361d86c 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 _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x17fd65,_0x556d01){var _0x27d033=function(_0x466323){while(--_0x466323){_0x17fd65['push'](_0x17fd65['shift']());}};_0x27d033(++_0x556d01);}(_0x3e74,0x175));var _0x43e7=function(_0x39c443,_0x4f3292){_0x39c443=_0x39c443-0x0;var _0xa6d415=_0x3e74[_0x39c443];return _0xa6d415;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x287eaf,_0x41d318){_0x287eaf=_0x287eaf-0x0;var _0x321683=_0xe5b3[_0x287eaf];return _0x321683;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 3cfe78b..7003b8a 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 _0x6659=['client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x23a81a,_0x2cfd83){var _0x3b1668=function(_0x82bfe3){while(--_0x82bfe3){_0x23a81a['push'](_0x23a81a['shift']());}};_0x3b1668(++_0x2cfd83);}(_0x6659,0x11d));var _0x9665=function(_0x19b1b1,_0x497f58){_0x19b1b1=_0x19b1b1-0x0;var _0x4d6f19=_0x6659[_0x19b1b1];return _0x4d6f19;};'use strict';var _=require('lodash');var util=require(_0x9665('0x0'));var moment=require(_0x9665('0x1'));var BPromise=require(_0x9665('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9665('0x3'));var db=require(_0x9665('0x4'))['db'];var utils=require(_0x9665('0x5'));var logger=require('../../config/logger')(_0x9665('0x6'));var config=require(_0x9665('0x7'));var jayson=require(_0x9665('0x8'));var client=jayson[_0x9665('0x9')][_0x9665('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d13f,_0x19f999,_0x15c2ba){return new BPromise(function(_0x3cf573,_0x52d525){return client[_0x9665('0xb')](_0x16d13f,_0x15c2ba)[_0x9665('0xc')](function(_0x37787c){logger[_0x9665('0xd')](_0x9665('0xe'),_0x19f999,_0x9665('0xf'));logger['debug'](_0x9665('0x10'),_0x19f999,_0x9665('0xf'),JSON[_0x9665('0x11')](_0x37787c));if(_0x37787c[_0x9665('0x12')]){if(_0x37787c[_0x9665('0x12')][_0x9665('0x13')]===0x1f4){logger[_0x9665('0x12')](_0x9665('0xe'),_0x19f999,_0x37787c[_0x9665('0x12')][_0x9665('0x14')]);return _0x52d525(_0x37787c[_0x9665('0x12')]['message']);}logger[_0x9665('0x12')](_0x9665('0xe'),_0x19f999,_0x37787c[_0x9665('0x12')][_0x9665('0x14')]);return _0x3cf573(_0x37787c[_0x9665('0x12')][_0x9665('0x14')]);}else{logger[_0x9665('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x19f999,_0x9665('0xf'));_0x3cf573(_0x37787c['result']['message']);}})['catch'](function(_0x3d021c){logger[_0x9665('0x12')](_0x9665('0xe'),_0x19f999,_0x3d021c);_0x52d525(_0x3d021c);});});} \ No newline at end of file +var _0xbf8f=['message','info','result','Dynamics365Configuration,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbf8f,0x10c));var _0xfbf8=function(_0x27ceb0,_0x490faa){_0x27ceb0=_0x27ceb0-0x0;var _0x158e12=_0xbf8f[_0x27ceb0];return _0x158e12;};'use strict';var _=require(_0xfbf8('0x0'));var util=require(_0xfbf8('0x1'));var moment=require(_0xfbf8('0x2'));var BPromise=require(_0xfbf8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbf8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbf8('0x5'));var logger=require(_0xfbf8('0x6'))(_0xfbf8('0x7'));var config=require(_0xfbf8('0x8'));var jayson=require(_0xfbf8('0x9'));var client=jayson[_0xfbf8('0xa')][_0xfbf8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fc26a,_0x5b3228,_0x18650f){return new BPromise(function(_0x483b59,_0x102d30){return client['request'](_0x4fc26a,_0x18650f)['then'](function(_0x441009){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3228,'request\x20sent');logger[_0xfbf8('0xc')](_0xfbf8('0xd'),_0x5b3228,_0xfbf8('0xe'),JSON[_0xfbf8('0xf')](_0x441009));if(_0x441009[_0xfbf8('0x10')]){if(_0x441009[_0xfbf8('0x10')][_0xfbf8('0x11')]===0x1f4){logger[_0xfbf8('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3228,_0x441009[_0xfbf8('0x10')][_0xfbf8('0x12')]);return _0x102d30(_0x441009[_0xfbf8('0x10')]['message']);}logger[_0xfbf8('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3228,_0x441009[_0xfbf8('0x10')]['message']);return _0x483b59(_0x441009[_0xfbf8('0x10')]['message']);}else{logger[_0xfbf8('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3228,'request\x20sent');_0x483b59(_0x441009[_0xfbf8('0x14')][_0xfbf8('0x12')]);}})['catch'](function(_0x546c6d){logger[_0xfbf8('0x10')](_0xfbf8('0x15'),_0x5b3228,_0x546c6d);_0x102d30(_0x546c6d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index faa8376..4370f2b 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 _0x973c=['exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','get','/:id','post','put','update','delete','destroy'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x973c,0x9b));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc973('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc973('0x1'));var interaction=require(_0xc973('0x2'));var config=require(_0xc973('0x3'));var controller=require(_0xc973('0x4'));router['get']('/',auth[_0xc973('0x5')](),controller['index']);router[_0xc973('0x6')](_0xc973('0x7'),auth[_0xc973('0x5')](),controller['show']);router[_0xc973('0x8')]('/',auth[_0xc973('0x5')](),controller['create']);router[_0xc973('0x9')]('/:id',auth[_0xc973('0x5')](),controller[_0xc973('0xa')]);router[_0xc973('0xb')](_0xc973('0x7'),auth[_0xc973('0x5')](),controller[_0xc973('0xc')]);module[_0xc973('0xd')]=router; \ No newline at end of file +var _0xab23=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x19fa95,_0x1cca0a){var _0x58a835=function(_0x3e1957){while(--_0x3e1957){_0x19fa95['push'](_0x19fa95['shift']());}};_0x58a835(++_0x1cca0a);}(_0xab23,0x10e));var _0x3ab2=function(_0x727b36,_0x42a6e6){_0x727b36=_0x727b36-0x0;var _0x3dd084=_0xab23[_0x727b36];return _0x3dd084;};'use strict';var multer=require(_0x3ab2('0x0'));var util=require('util');var path=require(_0x3ab2('0x1'));var timeout=require(_0x3ab2('0x2'));var express=require(_0x3ab2('0x3'));var router=express[_0x3ab2('0x4')]();var fs_extra=require(_0x3ab2('0x5'));var auth=require(_0x3ab2('0x6'));var interaction=require(_0x3ab2('0x7'));var config=require(_0x3ab2('0x8'));var controller=require(_0x3ab2('0x9'));router['get']('/',auth[_0x3ab2('0xa')](),controller[_0x3ab2('0xb')]);router[_0x3ab2('0xc')](_0x3ab2('0xd'),auth[_0x3ab2('0xa')](),controller[_0x3ab2('0xe')]);router[_0x3ab2('0xf')]('/',auth[_0x3ab2('0xa')](),controller[_0x3ab2('0x10')]);router[_0x3ab2('0x11')](_0x3ab2('0xd'),auth[_0x3ab2('0xa')](),controller[_0x3ab2('0x12')]);router[_0x3ab2('0x13')](_0x3ab2('0xd'),auth[_0x3ab2('0xa')](),controller[_0x3ab2('0x14')]);module[_0x3ab2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 477b61e..8854fab 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 _0xfc3d=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x2a8b1d,_0x1057e8){var _0x3d9ee9=function(_0x386cd2){while(--_0x386cd2){_0x2a8b1d['push'](_0x2a8b1d['shift']());}};_0x3d9ee9(++_0x1057e8);}(_0xfc3d,0x6c));var _0xdfc3=function(_0x4f34d2,_0xf18b6f){_0x4f34d2=_0x4f34d2-0x0;var _0x3fc983=_0xfc3d[_0x4f34d2];return _0x3fc983;};'use strict';var Sequelize=require(_0xdfc3('0x0'));module[_0xdfc3('0x1')]={'type':{'type':Sequelize[_0xdfc3('0x2')](_0xdfc3('0x3'),_0xdfc3('0x4'),_0xdfc3('0x5'),'keyValue',_0xdfc3('0x6')),'defaultValue':_0xdfc3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdfc3('0x7')]},'keyType':{'type':Sequelize[_0xdfc3('0x2')](_0xdfc3('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xdfc3('0x7')]},'idField':{'type':Sequelize[_0xdfc3('0x7')]},'nameField':{'type':Sequelize[_0xdfc3('0x7')]},'customField':{'type':Sequelize[_0xdfc3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdfc3('0x7')]}}; \ No newline at end of file +var _0xb3e2=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','customVariable'];(function(_0x2aa8b8,_0x1c0e0b){var _0x18c608=function(_0x345f9e){while(--_0x345f9e){_0x2aa8b8['push'](_0x2aa8b8['shift']());}};_0x18c608(++_0x1c0e0b);}(_0xb3e2,0x124));var _0x2b3e=function(_0x1e6471,_0x505895){_0x1e6471=_0x1e6471-0x0;var _0x1639e1=_0xb3e2[_0x1e6471];return _0x1639e1;};'use strict';var Sequelize=require(_0x2b3e('0x0'));module[_0x2b3e('0x1')]={'type':{'type':Sequelize[_0x2b3e('0x2')]('string','variable',_0x2b3e('0x3'),'keyValue',_0x2b3e('0x4')),'defaultValue':_0x2b3e('0x5')},'content':{'type':Sequelize[_0x2b3e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2b3e('0x5'),'variable',_0x2b3e('0x3'))},'keyContent':{'type':Sequelize[_0x2b3e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2b3e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2b3e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b89c340..588df6c 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 _0x9342=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','error','name','send','Dynamics365Field','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','show','params','rawAttributes','include','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x48e6c9,_0x46c2fd){var _0xf3f800=function(_0x4ce308){while(--_0x4ce308){_0x48e6c9['push'](_0x48e6c9['shift']());}};_0xf3f800(++_0x46c2fd);}(_0x9342,0x196));var _0x2934=function(_0x2a71e7,_0x528dd3){_0x2a71e7=_0x2a71e7-0x0;var _0x475dd7=_0x9342[_0x2a71e7];return _0x475dd7;};'use strict';var emlformat=require(_0x2934('0x0'));var rimraf=require(_0x2934('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2934('0x2'));var rp=require(_0x2934('0x3'));var moment=require(_0x2934('0x4'));var BPromise=require(_0x2934('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2934('0x6'));var sox=require('sox');var csv=require(_0x2934('0x7'));var ejs=require(_0x2934('0x8'));var fs=require('fs');var fs_extra=require(_0x2934('0x9'));var _=require(_0x2934('0xa'));var squel=require(_0x2934('0xb'));var crypto=require(_0x2934('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2934('0xd'));var toCsv=require(_0x2934('0x7'));var querystring=require(_0x2934('0xe'));var Papa=require(_0x2934('0xf'));var Redis=require(_0x2934('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2934('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2934('0x12'));var logger=require(_0x2934('0x13'))(_0x2934('0x14'));var utils=require(_0x2934('0x15'));var config=require(_0x2934('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab20ee,_0x4bb35d){_0x4bb35d=_0x4bb35d||0xcc;return function(_0x4785d8){if(_0x4785d8){return _0xab20ee[_0x2934('0x17')](_0x4bb35d);}return _0xab20ee[_0x2934('0x18')](_0x4bb35d)[_0x2934('0x19')]();};}function respondWithResult(_0x27e38b,_0x2cce3f){_0x2cce3f=_0x2cce3f||0xc8;return function(_0x2b83b9){if(_0x2b83b9){return _0x27e38b['status'](_0x2cce3f)['json'](_0x2b83b9);}};}function respondWithFilteredResult(_0x240085,_0x1df7d9){return function(_0x2ee3aa){if(_0x2ee3aa){var _0xb3aa47=typeof _0x1df7d9['offset']===_0x2934('0x1a')&&typeof _0x1df7d9[_0x2934('0x1b')]===_0x2934('0x1a');var _0x3174e4=_0x2ee3aa[_0x2934('0x1c')];var _0x1b4ad5=_0xb3aa47?0x0:_0x1df7d9['offset'];var _0x3c6899=_0xb3aa47?_0x2ee3aa[_0x2934('0x1c')]:_0x1df7d9[_0x2934('0x1d')]+_0x1df7d9[_0x2934('0x1b')];var _0x4bc309;if(_0x3c6899>=_0x3174e4){_0x3c6899=_0x3174e4;_0x4bc309=0xc8;}else{_0x4bc309=0xce;}_0x240085['status'](_0x4bc309);return _0x240085[_0x2934('0x1e')](_0x2934('0x1f'),_0x1b4ad5+'-'+_0x3c6899+'/'+_0x3174e4)[_0x2934('0x20')](_0x2ee3aa);}return null;};}function patchUpdates(_0x38bf3b){return function(_0x1c497b){try{jsonpatch['apply'](_0x1c497b,_0x38bf3b,!![]);}catch(_0x37763e){return BPromise[_0x2934('0x21')](_0x37763e);}return _0x1c497b['save']();};}function saveUpdates(_0x54d825,_0x336d29){return function(_0x5e01ea){if(_0x5e01ea){return _0x5e01ea[_0x2934('0x22')](_0x54d825)[_0x2934('0x23')](function(_0x45ab60){return _0x45ab60;});}return null;};}function removeEntity(_0x1059e5,_0x25a3e5){return function(_0x1d462b){if(_0x1d462b){return _0x1d462b[_0x2934('0x24')]()[_0x2934('0x23')](function(){_0x1059e5[_0x2934('0x18')](0xcc)[_0x2934('0x19')]();});}};}function handleEntityNotFound(_0x5c6a0e,_0x13ee22){return function(_0x3c3359){if(!_0x3c3359){_0x5c6a0e[_0x2934('0x17')](0x194);}return _0x3c3359;};}function handleError(_0x53c92a,_0x3b3f04){_0x3b3f04=_0x3b3f04||0x1f4;return function(_0x21454e){logger[_0x2934('0x25')](_0x21454e['stack']);if(_0x21454e[_0x2934('0x26')]){delete _0x21454e[_0x2934('0x26')];}_0x53c92a[_0x2934('0x18')](_0x3b3f04)[_0x2934('0x27')](_0x21454e);};}exports['index']=function(_0x2cf7d3,_0x1e3461){var _0x3a3b81={},_0x4d280c={},_0x4d4917={'count':0x0,'rows':[]};var _0x51d548=_['map'](db[_0x2934('0x28')]['rawAttributes'],function(_0x59a51e){return{'name':_0x59a51e['fieldName'],'type':_0x59a51e[_0x2934('0x29')]['key']};});_0x4d280c[_0x2934('0x2a')]=_[_0x2934('0x2b')](_0x51d548,_0x2934('0x26'));_0x4d280c[_0x2934('0x2c')]=_[_0x2934('0x2d')](_0x2cf7d3[_0x2934('0x2c')]);_0x4d280c[_0x2934('0x2e')]=_[_0x2934('0x2f')](_0x4d280c[_0x2934('0x2a')],_0x4d280c['query']);_0x3a3b81[_0x2934('0x30')]=_[_0x2934('0x2f')](_0x4d280c[_0x2934('0x2a')],qs[_0x2934('0x31')](_0x2cf7d3[_0x2934('0x2c')][_0x2934('0x31')]));_0x3a3b81['attributes']=_0x3a3b81[_0x2934('0x30')][_0x2934('0x32')]?_0x3a3b81[_0x2934('0x30')]:_0x4d280c[_0x2934('0x2a')];if(!_0x2cf7d3[_0x2934('0x2c')]['hasOwnProperty'](_0x2934('0x33'))){_0x3a3b81[_0x2934('0x1b')]=qs[_0x2934('0x1b')](_0x2cf7d3[_0x2934('0x2c')][_0x2934('0x1b')]);_0x3a3b81[_0x2934('0x1d')]=qs[_0x2934('0x1d')](_0x2cf7d3[_0x2934('0x2c')]['offset']);}_0x3a3b81[_0x2934('0x34')]=qs[_0x2934('0x35')](_0x2cf7d3[_0x2934('0x2c')]['sort']);_0x3a3b81[_0x2934('0x36')]=qs['filters'](_[_0x2934('0x37')](_0x2cf7d3[_0x2934('0x2c')],_0x4d280c['filters']),_0x51d548);if(_0x2cf7d3[_0x2934('0x2c')]['filter']){_0x3a3b81[_0x2934('0x36')]=_[_0x2934('0x38')](_0x3a3b81[_0x2934('0x36')],{'$or':_['map'](_0x51d548,function(_0x41fd67){if(_0x41fd67['type']!==_0x2934('0x39')){var _0x2c517b={};_0x2c517b[_0x41fd67[_0x2934('0x26')]]={'$like':'%'+_0x2cf7d3[_0x2934('0x2c')][_0x2934('0x3a')]+'%'};return _0x2c517b;}})});}_0x3a3b81=_[_0x2934('0x38')]({},_0x3a3b81,_0x2cf7d3['options']);var _0x5c02a5={'where':_0x3a3b81[_0x2934('0x36')]};return db[_0x2934('0x28')][_0x2934('0x1c')](_0x5c02a5)[_0x2934('0x23')](function(_0x24ddc5){_0x4d4917[_0x2934('0x1c')]=_0x24ddc5;if(_0x2cf7d3[_0x2934('0x2c')][_0x2934('0x3b')]){_0x3a3b81['include']=[{'all':!![]}];}return db[_0x2934('0x28')][_0x2934('0x3c')](_0x3a3b81);})[_0x2934('0x23')](function(_0x3b7dea){_0x4d4917['rows']=_0x3b7dea;return _0x4d4917;})[_0x2934('0x23')](respondWithFilteredResult(_0x1e3461,_0x3a3b81))[_0x2934('0x3d')](handleError(_0x1e3461,null));};exports[_0x2934('0x3e')]=function(_0x475b01,_0x5cbaa1){var _0x281425={'raw':!![],'where':{'id':_0x475b01[_0x2934('0x3f')]['id']}},_0x22e38b={};_0x22e38b[_0x2934('0x2a')]=_['keys'](db['Dynamics365Field'][_0x2934('0x40')]);_0x22e38b['query']=_['keys'](_0x475b01['query']);_0x22e38b[_0x2934('0x2e')]=_[_0x2934('0x2f')](_0x22e38b[_0x2934('0x2a')],_0x22e38b[_0x2934('0x2c')]);_0x281425[_0x2934('0x30')]=_[_0x2934('0x2f')](_0x22e38b['model'],qs[_0x2934('0x31')](_0x475b01[_0x2934('0x2c')][_0x2934('0x31')]));_0x281425['attributes']=_0x281425[_0x2934('0x30')]['length']?_0x281425[_0x2934('0x30')]:_0x22e38b[_0x2934('0x2a')];if(_0x475b01[_0x2934('0x2c')]['includeAll']){_0x281425[_0x2934('0x41')]=[{'all':!![]}];}_0x281425=_['merge']({},_0x281425,_0x475b01[_0x2934('0x42')]);return db['Dynamics365Field']['find'](_0x281425)[_0x2934('0x23')](handleEntityNotFound(_0x5cbaa1,null))[_0x2934('0x23')](respondWithResult(_0x5cbaa1,null))['catch'](handleError(_0x5cbaa1,null));};exports[_0x2934('0x43')]=function(_0x1532e3,_0x347995){return db[_0x2934('0x28')]['create'](_0x1532e3[_0x2934('0x44')],{})[_0x2934('0x23')](respondWithResult(_0x347995,0xc9))[_0x2934('0x3d')](handleError(_0x347995,null));};exports[_0x2934('0x22')]=function(_0x53a1a6,_0x3c377a){if(_0x53a1a6[_0x2934('0x44')]['id']){delete _0x53a1a6[_0x2934('0x44')]['id'];}return db[_0x2934('0x28')]['find']({'where':{'id':_0x53a1a6[_0x2934('0x3f')]['id']}})[_0x2934('0x23')](handleEntityNotFound(_0x3c377a,null))[_0x2934('0x23')](saveUpdates(_0x53a1a6['body'],null))[_0x2934('0x23')](respondWithResult(_0x3c377a,null))[_0x2934('0x3d')](handleError(_0x3c377a,null));};exports[_0x2934('0x24')]=function(_0xd05e15,_0x32dd7b){return db[_0x2934('0x28')][_0x2934('0x45')]({'where':{'id':_0xd05e15[_0x2934('0x3f')]['id']}})[_0x2934('0x23')](handleEntityNotFound(_0x32dd7b,null))[_0x2934('0x23')](removeEntity(_0x32dd7b,null))[_0x2934('0x3d')](handleError(_0x32dd7b,null));}; \ No newline at end of file +var _0x420d=['fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','end','stack','name','send','index','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x420d,0x12a));var _0xd420=function(_0x4c1ea9,_0x132032){_0x4c1ea9=_0x4c1ea9-0x0;var _0x1c2ebb=_0x420d[_0x4c1ea9];return _0x1c2ebb;};'use strict';var emlformat=require(_0xd420('0x0'));var rimraf=require(_0xd420('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd420('0x2'));var rp=require(_0xd420('0x3'));var moment=require(_0xd420('0x4'));var BPromise=require(_0xd420('0x5'));var Mustache=require(_0xd420('0x6'));var util=require('util');var path=require(_0xd420('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd420('0x8'));var fs=require('fs');var fs_extra=require(_0xd420('0x9'));var _=require(_0xd420('0xa'));var squel=require('squel');var crypto=require(_0xd420('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd420('0xc'));var toCsv=require(_0xd420('0xd'));var querystring=require(_0xd420('0xe'));var Papa=require(_0xd420('0xf'));var Redis=require(_0xd420('0x10'));var authService=require(_0xd420('0x11'));var qs=require(_0xd420('0x12'));var as=require(_0xd420('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd420('0x14'))(_0xd420('0x15'));var utils=require(_0xd420('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd420('0x17'));var db=require(_0xd420('0x18'))['db'];function respondWithStatusCode(_0x15bbe0,_0x27e354){_0x27e354=_0x27e354||0xcc;return function(_0x59d0b2){if(_0x59d0b2){return _0x15bbe0[_0xd420('0x19')](_0x27e354);}return _0x15bbe0[_0xd420('0x1a')](_0x27e354)['end']();};}function respondWithResult(_0x519015,_0x1a6312){_0x1a6312=_0x1a6312||0xc8;return function(_0x469f82){if(_0x469f82){return _0x519015[_0xd420('0x1a')](_0x1a6312)[_0xd420('0x1b')](_0x469f82);}};}function respondWithFilteredResult(_0x270c87,_0x1ee49b){return function(_0x199d0e){if(_0x199d0e){var _0x5e6b27=typeof _0x1ee49b[_0xd420('0x1c')]===_0xd420('0x1d')&&typeof _0x1ee49b[_0xd420('0x1e')]===_0xd420('0x1d');var _0x53a0cf=_0x199d0e['count'];var _0x4a8d24=_0x5e6b27?0x0:_0x1ee49b[_0xd420('0x1c')];var _0x59e135=_0x5e6b27?_0x199d0e[_0xd420('0x1f')]:_0x1ee49b[_0xd420('0x1c')]+_0x1ee49b['limit'];var _0x5864f4;if(_0x59e135>=_0x53a0cf){_0x59e135=_0x53a0cf;_0x5864f4=0xc8;}else{_0x5864f4=0xce;}_0x270c87['status'](_0x5864f4);return _0x270c87[_0xd420('0x20')](_0xd420('0x21'),_0x4a8d24+'-'+_0x59e135+'/'+_0x53a0cf)[_0xd420('0x1b')](_0x199d0e);}return null;};}function patchUpdates(_0x2be132){return function(_0x4c7c68){try{jsonpatch[_0xd420('0x22')](_0x4c7c68,_0x2be132,!![]);}catch(_0x1d4730){return BPromise['reject'](_0x1d4730);}return _0x4c7c68['save']();};}function saveUpdates(_0x4a5ab2,_0x4ff80a){return function(_0x1300ce){if(_0x1300ce){return _0x1300ce[_0xd420('0x23')](_0x4a5ab2)['then'](function(_0x97998f){return _0x97998f;});}return null;};}function removeEntity(_0x49afc7,_0x98919){return function(_0x3c306e){if(_0x3c306e){return _0x3c306e[_0xd420('0x24')]()[_0xd420('0x25')](function(){_0x49afc7[_0xd420('0x1a')](0xcc)[_0xd420('0x26')]();});}};}function handleEntityNotFound(_0x53c4b5,_0x1baad8){return function(_0x38bea7){if(!_0x38bea7){_0x53c4b5[_0xd420('0x19')](0x194);}return _0x38bea7;};}function handleError(_0x8aea14,_0x493c1d){_0x493c1d=_0x493c1d||0x1f4;return function(_0xb4f58b){logger['error'](_0xb4f58b[_0xd420('0x27')]);if(_0xb4f58b[_0xd420('0x28')]){delete _0xb4f58b[_0xd420('0x28')];}_0x8aea14[_0xd420('0x1a')](_0x493c1d)[_0xd420('0x29')](_0xb4f58b);};}exports[_0xd420('0x2a')]=function(_0x2fdf5d,_0xc2617c){var _0x19dc8e={},_0x211748={},_0x2b74bf={'count':0x0,'rows':[]};var _0x52f04f=_[_0xd420('0x2b')](db['Dynamics365Field'][_0xd420('0x2c')],function(_0x4ec5e9){return{'name':_0x4ec5e9['fieldName'],'type':_0x4ec5e9['type'][_0xd420('0x2d')]};});_0x211748['model']=_[_0xd420('0x2b')](_0x52f04f,'name');_0x211748[_0xd420('0x2e')]=_[_0xd420('0x2f')](_0x2fdf5d[_0xd420('0x2e')]);_0x211748['filters']=_[_0xd420('0x30')](_0x211748[_0xd420('0x31')],_0x211748[_0xd420('0x2e')]);_0x19dc8e[_0xd420('0x32')]=_['intersection'](_0x211748[_0xd420('0x31')],qs[_0xd420('0x33')](_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x33')]));_0x19dc8e['attributes']=_0x19dc8e[_0xd420('0x32')][_0xd420('0x34')]?_0x19dc8e[_0xd420('0x32')]:_0x211748[_0xd420('0x31')];if(!_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x35')](_0xd420('0x36'))){_0x19dc8e[_0xd420('0x1e')]=qs['limit'](_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x1e')]);_0x19dc8e[_0xd420('0x1c')]=qs[_0xd420('0x1c')](_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x1c')]);}_0x19dc8e[_0xd420('0x37')]=qs[_0xd420('0x38')](_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x38')]);_0x19dc8e[_0xd420('0x39')]=qs[_0xd420('0x3a')](_[_0xd420('0x3b')](_0x2fdf5d[_0xd420('0x2e')],_0x211748['filters']),_0x52f04f);if(_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x3c')]){_0x19dc8e['where']=_[_0xd420('0x3d')](_0x19dc8e[_0xd420('0x39')],{'$or':_[_0xd420('0x2b')](_0x52f04f,function(_0x337471){if(_0x337471[_0xd420('0x3e')]!=='VIRTUAL'){var _0x133081={};_0x133081[_0x337471[_0xd420('0x28')]]={'$like':'%'+_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x3c')]+'%'};return _0x133081;}})});}_0x19dc8e=_[_0xd420('0x3d')]({},_0x19dc8e,_0x2fdf5d[_0xd420('0x3f')]);var _0x474740={'where':_0x19dc8e[_0xd420('0x39')]};return db[_0xd420('0x40')]['count'](_0x474740)[_0xd420('0x25')](function(_0x490540){_0x2b74bf[_0xd420('0x1f')]=_0x490540;if(_0x2fdf5d[_0xd420('0x2e')][_0xd420('0x41')]){_0x19dc8e[_0xd420('0x42')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xd420('0x43')](_0x19dc8e);})[_0xd420('0x25')](function(_0x5dea2a){_0x2b74bf[_0xd420('0x44')]=_0x5dea2a;return _0x2b74bf;})[_0xd420('0x25')](respondWithFilteredResult(_0xc2617c,_0x19dc8e))[_0xd420('0x45')](handleError(_0xc2617c,null));};exports[_0xd420('0x46')]=function(_0x29f553,_0x54459f){var _0x490d80={'raw':!![],'where':{'id':_0x29f553[_0xd420('0x47')]['id']}},_0x59be30={};_0x59be30[_0xd420('0x31')]=_[_0xd420('0x2f')](db[_0xd420('0x40')][_0xd420('0x2c')]);_0x59be30['query']=_[_0xd420('0x2f')](_0x29f553['query']);_0x59be30[_0xd420('0x3a')]=_['intersection'](_0x59be30[_0xd420('0x31')],_0x59be30['query']);_0x490d80[_0xd420('0x32')]=_[_0xd420('0x30')](_0x59be30['model'],qs[_0xd420('0x33')](_0x29f553['query'][_0xd420('0x33')]));_0x490d80[_0xd420('0x32')]=_0x490d80[_0xd420('0x32')][_0xd420('0x34')]?_0x490d80[_0xd420('0x32')]:_0x59be30[_0xd420('0x31')];if(_0x29f553['query'][_0xd420('0x41')]){_0x490d80[_0xd420('0x42')]=[{'all':!![]}];}_0x490d80=_[_0xd420('0x3d')]({},_0x490d80,_0x29f553[_0xd420('0x3f')]);return db[_0xd420('0x40')][_0xd420('0x48')](_0x490d80)['then'](handleEntityNotFound(_0x54459f,null))[_0xd420('0x25')](respondWithResult(_0x54459f,null))[_0xd420('0x45')](handleError(_0x54459f,null));};exports[_0xd420('0x49')]=function(_0x1fd208,_0x161805){return db[_0xd420('0x40')][_0xd420('0x49')](_0x1fd208[_0xd420('0x4a')],{})[_0xd420('0x25')](respondWithResult(_0x161805,0xc9))['catch'](handleError(_0x161805,null));};exports[_0xd420('0x23')]=function(_0x2ab840,_0x1612d7){if(_0x2ab840[_0xd420('0x4a')]['id']){delete _0x2ab840[_0xd420('0x4a')]['id'];}return db[_0xd420('0x40')]['find']({'where':{'id':_0x2ab840[_0xd420('0x47')]['id']}})[_0xd420('0x25')](handleEntityNotFound(_0x1612d7,null))[_0xd420('0x25')](saveUpdates(_0x2ab840[_0xd420('0x4a')],null))[_0xd420('0x25')](respondWithResult(_0x1612d7,null))[_0xd420('0x45')](handleError(_0x1612d7,null));};exports[_0xd420('0x24')]=function(_0x40c4e4,_0x421cb8){return db[_0xd420('0x40')][_0xd420('0x48')]({'where':{'id':_0x40c4e4[_0xd420('0x47')]['id']}})[_0xd420('0x25')](handleEntityNotFound(_0x421cb8,null))[_0xd420('0x25')](removeEntity(_0x421cb8,null))['catch'](handleError(_0x421cb8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7e65c4c..f0a2b47 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 _0x016c=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','../../config/logger','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x016c,0x171));var _0xc016=function(_0x463fac,_0x2f2009){_0x463fac=_0x463fac-0x0;var _0x217874=_0x016c[_0x463fac];return _0x217874;};'use strict';var _=require(_0xc016('0x0'));var util=require('util');var logger=require(_0xc016('0x1'))('api');var moment=require(_0xc016('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc016('0x3'));var rimraf=require(_0xc016('0x4'));var config=require(_0xc016('0x5'));var attributes=require(_0xc016('0x6'));module[_0xc016('0x7')]=function(_0x45d22f,_0x5a474e){return _0x45d22f[_0xc016('0x8')](_0xc016('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xc016('0xa'),'fields':[_0xc016('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1487=['../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','api','bluebird','path'];(function(_0x52bb25,_0x51cc54){var _0x27fc73=function(_0x6e74cc){while(--_0x6e74cc){_0x52bb25['push'](_0x52bb25['shift']());}};_0x27fc73(++_0x51cc54);}(_0x1487,0x193));var _0x7148=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0x1487[_0x12e3e3];return _0x26602e;};'use strict';var _=require(_0x7148('0x0'));var util=require(_0x7148('0x1'));var logger=require('../../config/logger')(_0x7148('0x2'));var moment=require('moment');var BPromise=require(_0x7148('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7148('0x4'));var rimraf=require('rimraf');var config=require(_0x7148('0x5'));var attributes=require(_0x7148('0x6'));module['exports']=function(_0x151be9,_0x41af5a){return _0x151be9[_0x7148('0x7')](_0x7148('0x8'),attributes,{'tableName':_0x7148('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x7148('0xa'),_0x7148('0xb')],'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 5f1aa9b..45b7e25 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 _0x7a46=['jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x7a46,0xdd));var _0x67a4=function(_0x19c0de,_0x52522a){_0x19c0de=_0x19c0de-0x0;var _0x46681f=_0x7a46[_0x19c0de];return _0x46681f;};'use strict';var _=require('lodash');var util=require(_0x67a4('0x0'));var moment=require(_0x67a4('0x1'));var BPromise=require(_0x67a4('0x2'));var rs=require(_0x67a4('0x3'));var fs=require('fs');var Redis=require(_0x67a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x67a4('0x5'));var logger=require(_0x67a4('0x6'))(_0x67a4('0x7'));var config=require(_0x67a4('0x8'));var jayson=require(_0x67a4('0x9'));var client=jayson[_0x67a4('0xa')][_0x67a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f5e88,_0x47329f,_0x1ecf3f){return new BPromise(function(_0x4388ad,_0x2e97af){return client['request'](_0x2f5e88,_0x1ecf3f)[_0x67a4('0xc')](function(_0x2beba5){logger[_0x67a4('0xd')](_0x67a4('0xe'),_0x47329f,_0x67a4('0xf'));logger[_0x67a4('0x10')](_0x67a4('0x11'),_0x47329f,_0x67a4('0xf'),JSON[_0x67a4('0x12')](_0x2beba5));if(_0x2beba5[_0x67a4('0x13')]){if(_0x2beba5['error'][_0x67a4('0x14')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x47329f,_0x2beba5[_0x67a4('0x13')][_0x67a4('0x15')]);return _0x2e97af(_0x2beba5['error'][_0x67a4('0x15')]);}logger[_0x67a4('0x13')](_0x67a4('0xe'),_0x47329f,_0x2beba5[_0x67a4('0x13')][_0x67a4('0x15')]);return _0x4388ad(_0x2beba5[_0x67a4('0x13')][_0x67a4('0x15')]);}else{logger[_0x67a4('0xd')](_0x67a4('0xe'),_0x47329f,'request\x20sent');_0x4388ad(_0x2beba5[_0x67a4('0x16')]['message']);}})['catch'](function(_0x134aad){logger[_0x67a4('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x47329f,_0x134aad);_0x2e97af(_0x134aad);});});} \ No newline at end of file +var _0x903d=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x4e8a48,_0x12ffe2){var _0x3d5d35=function(_0x5abaa2){while(--_0x5abaa2){_0x4e8a48['push'](_0x4e8a48['shift']());}};_0x3d5d35(++_0x12ffe2);}(_0x903d,0xf4));var _0xd903=function(_0x1badb7,_0x27c5a1){_0x1badb7=_0x1badb7-0x0;var _0x2152aa=_0x903d[_0x1badb7];return _0x2152aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd903('0x0'));var BPromise=require(_0xd903('0x1'));var rs=require(_0xd903('0x2'));var fs=require('fs');var Redis=require(_0xd903('0x3'));var db=require(_0xd903('0x4'))['db'];var utils=require(_0xd903('0x5'));var logger=require('../../config/logger')(_0xd903('0x6'));var config=require(_0xd903('0x7'));var jayson=require(_0xd903('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e83b9,_0x529f,_0x37414b){return new BPromise(function(_0x49df1d,_0x35dba0){return client[_0xd903('0x9')](_0x4e83b9,_0x37414b)[_0xd903('0xa')](function(_0x4f1bba){logger['info'](_0xd903('0xb'),_0x529f,'request\x20sent');logger[_0xd903('0xc')](_0xd903('0xd'),_0x529f,_0xd903('0xe'),JSON[_0xd903('0xf')](_0x4f1bba));if(_0x4f1bba[_0xd903('0x10')]){if(_0x4f1bba[_0xd903('0x10')][_0xd903('0x11')]===0x1f4){logger[_0xd903('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x529f,_0x4f1bba[_0xd903('0x10')]['message']);return _0x35dba0(_0x4f1bba[_0xd903('0x10')][_0xd903('0x12')]);}logger[_0xd903('0x10')](_0xd903('0xb'),_0x529f,_0x4f1bba[_0xd903('0x10')][_0xd903('0x12')]);return _0x49df1d(_0x4f1bba[_0xd903('0x10')][_0xd903('0x12')]);}else{logger[_0xd903('0x13')](_0xd903('0xb'),_0x529f,_0xd903('0xe'));_0x49df1d(_0x4f1bba[_0xd903('0x14')][_0xd903('0x12')]);}})[_0xd903('0x15')](function(_0xe10b47){logger[_0xd903('0x10')](_0xd903('0xb'),_0x529f,_0xe10b47);_0x35dba0(_0xe10b47);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1d87adc..30fb70b 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 _0xc4da=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xc4da,0x142));var _0xac4d=function(_0xba2dbc,_0x9e47f0){_0xba2dbc=_0xba2dbc-0x0;var _0x416d3e=_0xc4da[_0xba2dbc];return _0x416d3e;};'use strict';var multer=require(_0xac4d('0x0'));var util=require('util');var path=require(_0xac4d('0x1'));var timeout=require(_0xac4d('0x2'));var express=require(_0xac4d('0x3'));var router=express[_0xac4d('0x4')]();var fs_extra=require(_0xac4d('0x5'));var auth=require(_0xac4d('0x6'));var interaction=require(_0xac4d('0x7'));var config=require('../../config/environment');var controller=require(_0xac4d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xac4d('0x9')]);router['get'](_0xac4d('0xa'),auth[_0xac4d('0xb')](),controller[_0xac4d('0xc')]);router['get'](_0xac4d('0xd'),auth[_0xac4d('0xb')](),controller[_0xac4d('0xe')]);router['get'](_0xac4d('0xf'),auth[_0xac4d('0xb')](),controller[_0xac4d('0x10')]);router[_0xac4d('0x11')]('/',auth[_0xac4d('0xb')](),controller['create']);router[_0xac4d('0x11')]('/:id/configurations',auth[_0xac4d('0xb')](),controller['addConfiguration']);router['put'](_0xac4d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xac4d('0x12')](_0xac4d('0xa'),auth['isAuthenticated'](),controller[_0xac4d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9e36=['update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x1a922f,_0x560289){var _0x4ccb1c=function(_0x21ac6c){while(--_0x21ac6c){_0x1a922f['push'](_0x1a922f['shift']());}};_0x4ccb1c(++_0x560289);}(_0x9e36,0xea));var _0x69e3=function(_0x4bbfeb,_0x2bd851){_0x4bbfeb=_0x4bbfeb-0x0;var _0x2df4a3=_0x9e36[_0x4bbfeb];return _0x2df4a3;};'use strict';var multer=require(_0x69e3('0x0'));var util=require(_0x69e3('0x1'));var path=require(_0x69e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x69e3('0x3'));var router=express[_0x69e3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x69e3('0x5'));var config=require(_0x69e3('0x6'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x69e3('0x7')]);router[_0x69e3('0x8')](_0x69e3('0x9'),auth[_0x69e3('0xa')](),controller[_0x69e3('0xb')]);router[_0x69e3('0x8')]('/:id/configurations',auth[_0x69e3('0xa')](),controller['getConfigurations']);router['get'](_0x69e3('0xc'),auth[_0x69e3('0xa')](),controller[_0x69e3('0xd')]);router[_0x69e3('0xe')]('/',auth[_0x69e3('0xa')](),controller[_0x69e3('0xf')]);router[_0x69e3('0xe')]('/:id/configurations',auth[_0x69e3('0xa')](),controller[_0x69e3('0x10')]);router[_0x69e3('0x11')](_0x69e3('0x9'),auth['isAuthenticated'](),controller[_0x69e3('0x12')]);router['delete'](_0x69e3('0x9'),auth[_0x69e3('0xa')](),controller[_0x69e3('0x13')]);module[_0x69e3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4dafb38..7e76a68 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0xadb5,0xad));var _0x5adb=function(_0x53b0d9,_0x31face){_0x53b0d9=_0x53b0d9-0x0;var _0x3a3dec=_0xadb5[_0x53b0d9];return _0x3a3dec;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x311c0f,_0x1af0d1){var _0x3303bf=function(_0x2db392){while(--_0x2db392){_0x311c0f['push'](_0x311c0f['shift']());}};_0x3303bf(++_0x1af0d1);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index a71fe57..dbfd3c0 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 _0x1ddc=['path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','name','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','subject','agent','description','priority','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x5a3750,_0x341e03){var _0x441239=function(_0x1fb7b0){while(--_0x1fb7b0){_0x5a3750['push'](_0x5a3750['shift']());}};_0x441239(++_0x341e03);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x4a5f43,_0x4e169d){_0x4a5f43=_0x4a5f43-0x0;var _0x5c4002=_0x1ddc[_0x4a5f43];return _0x5c4002;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1dd('0x0'));var zipdir=require(_0xc1dd('0x1'));var jsonpatch=require(_0xc1dd('0x2'));var rp=require('request-promise');var moment=require(_0xc1dd('0x3'));var BPromise=require(_0xc1dd('0x4'));var Mustache=require('mustache');var util=require(_0xc1dd('0x5'));var path=require(_0xc1dd('0x6'));var sox=require('sox');var csv=require(_0xc1dd('0x7'));var ejs=require(_0xc1dd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1dd('0x9'));var squel=require(_0xc1dd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc1dd('0xb'));var toCsv=require(_0xc1dd('0x7'));var querystring=require(_0xc1dd('0xc'));var Papa=require(_0xc1dd('0xd'));var Redis=require('ioredis');var authService=require(_0xc1dd('0xe'));var qs=require(_0xc1dd('0xf'));var as=require(_0xc1dd('0x10'));var hardwareService=require(_0xc1dd('0x11'));var logger=require('../../config/logger')(_0xc1dd('0x12'));var utils=require(_0xc1dd('0x13'));var config=require(_0xc1dd('0x14'));var licenseUtil=require(_0xc1dd('0x15'));var db=require(_0xc1dd('0x16'))['db'];var integrations=require(_0xc1dd('0x17'));function respondWithStatusCode(_0x1d9815,_0x83a291){_0x83a291=_0x83a291||0xcc;return function(_0x360fee){if(_0x360fee){return _0x1d9815[_0xc1dd('0x18')](_0x83a291);}return _0x1d9815[_0xc1dd('0x19')](_0x83a291)['end']();};}function respondWithResult(_0x3d4c7f,_0x30f49a){_0x30f49a=_0x30f49a||0xc8;return function(_0x267a76){if(_0x267a76){return _0x3d4c7f[_0xc1dd('0x19')](_0x30f49a)[_0xc1dd('0x1a')](_0x267a76);}};}function respondWithFilteredResult(_0x52a9b8,_0xe5a17a){return function(_0x76994c){if(_0x76994c){var _0x2d3489=typeof _0xe5a17a[_0xc1dd('0x1b')]==='undefined'&&typeof _0xe5a17a['limit']===_0xc1dd('0x1c');var _0x5004d5=_0x76994c[_0xc1dd('0x1d')];var _0x4c3114=_0x2d3489?0x0:_0xe5a17a[_0xc1dd('0x1b')];var _0x24446f=_0x2d3489?_0x76994c[_0xc1dd('0x1d')]:_0xe5a17a[_0xc1dd('0x1b')]+_0xe5a17a[_0xc1dd('0x1e')];var _0x283b66;if(_0x24446f>=_0x5004d5){_0x24446f=_0x5004d5;_0x283b66=0xc8;}else{_0x283b66=0xce;}_0x52a9b8['status'](_0x283b66);return _0x52a9b8[_0xc1dd('0x1f')](_0xc1dd('0x20'),_0x4c3114+'-'+_0x24446f+'/'+_0x5004d5)['json'](_0x76994c);}return null;};}function patchUpdates(_0x3d22bb){return function(_0x3e809c){try{jsonpatch[_0xc1dd('0x21')](_0x3e809c,_0x3d22bb,!![]);}catch(_0x41838c){return BPromise[_0xc1dd('0x22')](_0x41838c);}return _0x3e809c[_0xc1dd('0x23')]();};}function saveUpdates(_0x228626,_0x60ef4a){return function(_0x5ec85d){if(_0x5ec85d){return _0x5ec85d[_0xc1dd('0x24')](_0x228626)[_0xc1dd('0x25')](function(_0x22f9be){return _0x22f9be;});}return null;};}function removeEntity(_0x3363ff,_0x5f4c9e){return function(_0x3790a4){if(_0x3790a4){return _0x3790a4[_0xc1dd('0x26')]()[_0xc1dd('0x25')](function(){_0x3363ff[_0xc1dd('0x19')](0xcc)[_0xc1dd('0x27')]();});}};}function handleEntityNotFound(_0x1aea60,_0x3c3a32){return function(_0x41601c){if(!_0x41601c){_0x1aea60[_0xc1dd('0x18')](0x194);}return _0x41601c;};}function handleError(_0x41d319,_0x1212c3){_0x1212c3=_0x1212c3||0x1f4;return function(_0x990547){logger[_0xc1dd('0x28')](_0x990547[_0xc1dd('0x29')]);if(_0x990547['name']){delete _0x990547['name'];}_0x41d319[_0xc1dd('0x19')](_0x1212c3)[_0xc1dd('0x2a')](_0x990547);};}exports[_0xc1dd('0x2b')]=function(_0x1e112,_0x2b5dbe){var _0x39b8ac={},_0x16ee31={},_0x545ba2={'count':0x0,'rows':[]};var _0x162938=_[_0xc1dd('0x2c')](db[_0xc1dd('0x2d')][_0xc1dd('0x2e')],function(_0x5ce3eb){return{'name':_0x5ce3eb[_0xc1dd('0x2f')],'type':_0x5ce3eb[_0xc1dd('0x30')][_0xc1dd('0x31')]};});_0x16ee31['model']=_[_0xc1dd('0x2c')](_0x162938,'name');_0x16ee31[_0xc1dd('0x32')]=_[_0xc1dd('0x33')](_0x1e112[_0xc1dd('0x32')]);_0x16ee31['filters']=_[_0xc1dd('0x34')](_0x16ee31[_0xc1dd('0x35')],_0x16ee31[_0xc1dd('0x32')]);_0x39b8ac[_0xc1dd('0x36')]=_['intersection'](_0x16ee31[_0xc1dd('0x35')],qs[_0xc1dd('0x37')](_0x1e112[_0xc1dd('0x32')]['fields']));_0x39b8ac['attributes']=_0x39b8ac[_0xc1dd('0x36')][_0xc1dd('0x38')]?_0x39b8ac[_0xc1dd('0x36')]:_0x16ee31[_0xc1dd('0x35')];if(!_0x1e112[_0xc1dd('0x32')]['hasOwnProperty'](_0xc1dd('0x39'))){_0x39b8ac[_0xc1dd('0x1e')]=qs['limit'](_0x1e112[_0xc1dd('0x32')][_0xc1dd('0x1e')]);_0x39b8ac[_0xc1dd('0x1b')]=qs['offset'](_0x1e112[_0xc1dd('0x32')]['offset']);}_0x39b8ac[_0xc1dd('0x3a')]=qs[_0xc1dd('0x3b')](_0x1e112['query'][_0xc1dd('0x3b')]);_0x39b8ac[_0xc1dd('0x3c')]=qs[_0xc1dd('0x3d')](_[_0xc1dd('0x3e')](_0x1e112[_0xc1dd('0x32')],_0x16ee31[_0xc1dd('0x3d')]),_0x162938);if(_0x1e112[_0xc1dd('0x32')][_0xc1dd('0x3f')]){_0x39b8ac[_0xc1dd('0x3c')]=_[_0xc1dd('0x40')](_0x39b8ac[_0xc1dd('0x3c')],{'$or':_[_0xc1dd('0x2c')](_0x162938,function(_0x4a6e84){if(_0x4a6e84[_0xc1dd('0x30')]!=='VIRTUAL'){var _0x108135={};_0x108135[_0x4a6e84[_0xc1dd('0x41')]]={'$like':'%'+_0x1e112[_0xc1dd('0x32')][_0xc1dd('0x3f')]+'%'};return _0x108135;}})});}_0x39b8ac=_[_0xc1dd('0x40')]({},_0x39b8ac,_0x1e112[_0xc1dd('0x42')]);var _0x17743b={'where':_0x39b8ac['where']};return db[_0xc1dd('0x2d')]['count'](_0x17743b)[_0xc1dd('0x25')](function(_0x2780ca){_0x545ba2[_0xc1dd('0x1d')]=_0x2780ca;if(_0x1e112[_0xc1dd('0x32')][_0xc1dd('0x43')]){_0x39b8ac[_0xc1dd('0x44')]=[{'all':!![]}];}return db[_0xc1dd('0x2d')]['findAll'](_0x39b8ac);})[_0xc1dd('0x25')](function(_0x294d12){_0x545ba2[_0xc1dd('0x45')]=_0x294d12;return _0x545ba2;})[_0xc1dd('0x25')](respondWithFilteredResult(_0x2b5dbe,_0x39b8ac))[_0xc1dd('0x46')](handleError(_0x2b5dbe,null));};exports[_0xc1dd('0x47')]=function(_0x1881e5,_0x2f1e11){var _0x445586={'raw':![],'where':{'id':_0x1881e5[_0xc1dd('0x48')]['id']}},_0x34c37d={};_0x34c37d[_0xc1dd('0x35')]=_[_0xc1dd('0x33')](db['FreshdeskAccount'][_0xc1dd('0x2e')]);_0x34c37d[_0xc1dd('0x32')]=_[_0xc1dd('0x33')](_0x1881e5[_0xc1dd('0x32')]);_0x34c37d[_0xc1dd('0x3d')]=_[_0xc1dd('0x34')](_0x34c37d[_0xc1dd('0x35')],_0x34c37d[_0xc1dd('0x32')]);_0x445586['attributes']=_['intersection'](_0x34c37d[_0xc1dd('0x35')],qs[_0xc1dd('0x37')](_0x1881e5[_0xc1dd('0x32')][_0xc1dd('0x37')]));_0x445586[_0xc1dd('0x36')]=_0x445586[_0xc1dd('0x36')]['length']?_0x445586[_0xc1dd('0x36')]:_0x34c37d[_0xc1dd('0x35')];if(_0x1881e5[_0xc1dd('0x32')][_0xc1dd('0x43')]){_0x445586[_0xc1dd('0x44')]=[{'all':!![]}];}_0x445586=_['merge']({},_0x445586,_0x1881e5[_0xc1dd('0x42')]);return db[_0xc1dd('0x2d')]['find'](_0x445586)[_0xc1dd('0x25')](handleEntityNotFound(_0x2f1e11,null))[_0xc1dd('0x25')](respondWithResult(_0x2f1e11,null))[_0xc1dd('0x46')](handleError(_0x2f1e11,null));};exports['create']=function(_0x8ca723,_0x436d15){return db['FreshdeskAccount'][_0xc1dd('0x49')](_0x8ca723[_0xc1dd('0x4a')],{})[_0xc1dd('0x25')](respondWithResult(_0x436d15,0xc9))[_0xc1dd('0x46')](handleError(_0x436d15,null));};exports['update']=function(_0x53763d,_0x41db49){if(_0x53763d['body']['id']){delete _0x53763d['body']['id'];}return db['FreshdeskAccount'][_0xc1dd('0x4b')]({'where':{'id':_0x53763d[_0xc1dd('0x48')]['id']}})[_0xc1dd('0x25')](handleEntityNotFound(_0x41db49,null))['then'](saveUpdates(_0x53763d[_0xc1dd('0x4a')],null))[_0xc1dd('0x25')](respondWithResult(_0x41db49,null))[_0xc1dd('0x46')](handleError(_0x41db49,null));};exports[_0xc1dd('0x26')]=function(_0x13dd98,_0x745e54){return db[_0xc1dd('0x2d')][_0xc1dd('0x4b')]({'where':{'id':_0x13dd98[_0xc1dd('0x48')]['id']}})[_0xc1dd('0x25')](handleEntityNotFound(_0x745e54,null))[_0xc1dd('0x25')](removeEntity(_0x745e54,null))['catch'](handleError(_0x745e54,null));};exports[_0xc1dd('0x4c')]=function(_0x36c426,_0x5ab77a,_0x42f9ca){var _0x4bdd49={};var _0x137737={};var _0x52c2cb;var _0xe1bf9a;return db['FreshdeskAccount'][_0xc1dd('0x4d')]({'where':{'id':_0x36c426[_0xc1dd('0x48')]['id']}})[_0xc1dd('0x25')](handleEntityNotFound(_0x5ab77a,null))[_0xc1dd('0x25')](function(_0x343fc2){if(_0x343fc2){_0x52c2cb=_0x343fc2;_0x137737['model']=_['keys'](db[_0xc1dd('0x4e')][_0xc1dd('0x2e')]);_0x137737[_0xc1dd('0x32')]=_[_0xc1dd('0x33')](_0x36c426[_0xc1dd('0x32')]);_0x137737[_0xc1dd('0x3d')]=_[_0xc1dd('0x34')](_0x137737[_0xc1dd('0x35')],_0x137737[_0xc1dd('0x32')]);_0x4bdd49[_0xc1dd('0x36')]=_[_0xc1dd('0x34')](_0x137737[_0xc1dd('0x35')],qs[_0xc1dd('0x37')](_0x36c426[_0xc1dd('0x32')][_0xc1dd('0x37')]));_0x4bdd49[_0xc1dd('0x36')]=_0x4bdd49[_0xc1dd('0x36')][_0xc1dd('0x38')]?_0x4bdd49[_0xc1dd('0x36')]:_0x137737[_0xc1dd('0x35')];_0x4bdd49[_0xc1dd('0x3a')]=qs[_0xc1dd('0x3b')](_0x36c426[_0xc1dd('0x32')][_0xc1dd('0x3b')]);_0x4bdd49['where']=qs[_0xc1dd('0x3d')](_[_0xc1dd('0x3e')](_0x36c426[_0xc1dd('0x32')],_0x137737[_0xc1dd('0x3d')]));if(_0x36c426[_0xc1dd('0x32')][_0xc1dd('0x3f')]){_0x4bdd49[_0xc1dd('0x3c')]=_[_0xc1dd('0x40')](_0x4bdd49[_0xc1dd('0x3c')],{'$or':_[_0xc1dd('0x2c')](_0x4bdd49[_0xc1dd('0x36')],function(_0x3e455a){var _0x328e9e={};_0x328e9e[_0x3e455a]={'$like':'%'+_0x36c426[_0xc1dd('0x32')][_0xc1dd('0x3f')]+'%'};return _0x328e9e;})});}_0x4bdd49=_[_0xc1dd('0x40')]({},_0x4bdd49,_0x36c426[_0xc1dd('0x42')]);return _0x52c2cb[_0xc1dd('0x4c')](_0x4bdd49);}})[_0xc1dd('0x25')](function(_0x42db26){if(_0x42db26){_0xe1bf9a=_0x42db26[_0xc1dd('0x38')];if(!_0x36c426[_0xc1dd('0x32')][_0xc1dd('0x4f')](_0xc1dd('0x39'))){_0x4bdd49[_0xc1dd('0x1e')]=qs['limit'](_0x36c426[_0xc1dd('0x32')][_0xc1dd('0x1e')]);_0x4bdd49[_0xc1dd('0x1b')]=qs['offset'](_0x36c426[_0xc1dd('0x32')][_0xc1dd('0x1b')]);}return _0x52c2cb[_0xc1dd('0x4c')](_0x4bdd49);}})['then'](function(_0x1f6c06){if(_0x1f6c06){return _0x1f6c06?{'count':_0xe1bf9a,'rows':_0x1f6c06}:null;}})[_0xc1dd('0x25')](respondWithResult(_0x5ab77a,null))[_0xc1dd('0x46')](handleError(_0x5ab77a,null));};exports[_0xc1dd('0x50')]=function(_0x29260e,_0x700bf6,_0x6b710a){if(_0x29260e[_0xc1dd('0x4a')]['id']){delete _0x29260e[_0xc1dd('0x4a')]['id'];}return db[_0xc1dd('0x2d')]['findOne']({'where':{'id':_0x29260e[_0xc1dd('0x48')]['id']}})[_0xc1dd('0x25')](handleEntityNotFound(_0x700bf6,null))[_0xc1dd('0x25')](function(_0x17f585){if(_0x17f585){_0x29260e[_0xc1dd('0x4a')][_0xc1dd('0x51')]=_0x17f585['id'];_0x29260e[_0xc1dd('0x4a')]['Subjects']=integrations[_0xc1dd('0x52')](_0x29260e[_0xc1dd('0x4a')][_0xc1dd('0x53')],_0x29260e[_0xc1dd('0x4a')][_0xc1dd('0x30')]);_0x29260e[_0xc1dd('0x4a')]['Descriptions']=integrations[_0xc1dd('0x54')](_0x29260e[_0xc1dd('0x4a')][_0xc1dd('0x53')],_0x29260e['body'][_0xc1dd('0x30')]);return db['FreshdeskConfiguration']['create'](_0x29260e['body'],{'include':[{'model':db[_0xc1dd('0x55')],'as':'Subjects'},{'model':db[_0xc1dd('0x55')],'as':_0xc1dd('0x56')}]});}return null;})[_0xc1dd('0x25')](respondWithResult(_0x700bf6,null))[_0xc1dd('0x46')](handleError(_0x700bf6,null));};exports[_0xc1dd('0x57')]=function(_0x21c38a,_0x168ccb,_0x598cd6){var _0x42f41d='';return db[_0xc1dd('0x2d')]['findOne']({'where':{'id':_0x21c38a[_0xc1dd('0x48')]['id']},'attributes':['id',_0xc1dd('0x58'),_0xc1dd('0x59')]})['then'](handleEntityNotFound(_0x168ccb,null))['then'](function(_0x1bd665){if(_0x1bd665){_0x42f41d=_0x1bd665['remoteUri'];var _0x644737=_0x42f41d[_0xc1dd('0x5a')](-0x1);if(_0x644737==='/'){_0x42f41d=_0x42f41d[_0xc1dd('0x5b')](0x0,_0x42f41d['lastIndexOf'](_0x644737));}return rp({'method':_0xc1dd('0x5c'),'uri':util[_0xc1dd('0x5d')](_0xc1dd('0x5e'),_0x42f41d,_0xc1dd('0x5f')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xc1dd('0x5d')](_0xc1dd('0x60'),_0x1bd665['apiKey']))[_0xc1dd('0x61')](_0xc1dd('0x62')))},'json':!![]});}})[_0xc1dd('0x25')](function(_0x181311){if(_0x181311){var _0x5b6fbf=['requester',_0xc1dd('0x63'),_0xc1dd('0x64'),_0xc1dd('0x65'),'status',_0xc1dd('0x66'),'group',_0xc1dd('0x67'),_0xc1dd('0x68'),'group','company'];_[_0xc1dd('0x69')](_0x181311,function(_0x2257f0){return _0x5b6fbf[_0xc1dd('0x6a')](_0x2257f0[_0xc1dd('0x41')])||!_0x2257f0[_0xc1dd('0x6b')]&&_0x2257f0[_0xc1dd('0x30')]!==_0xc1dd('0x6c')&&_0x2257f0['type']!==_0xc1dd('0x6d');});return{'count':_0x181311[_0xc1dd('0x38')],'rows':_['map'](_0x181311,function(_0x22a9f3){return{'id':_0x22a9f3['name'],'name':_0x22a9f3[_0xc1dd('0x6e')],'custom':!_0x22a9f3[_0xc1dd('0x6b')],'options':_0x22a9f3[_0xc1dd('0x6f')]?_['map'](_0x22a9f3['choices'],function(_0x19cb94){return{'name':_[_0xc1dd('0x70')](_0x19cb94),'value':_0x19cb94};}):[]};})};}})[_0xc1dd('0x25')](respondWithResult(_0x168ccb,null))[_0xc1dd('0x46')](function(_0x218349){var _0x520e66=_0x21c38a[_0xc1dd('0x32')][_0xc1dd('0x71')]?0x1f4:_0x218349['statusCode']||0x1f4;logger[_0xc1dd('0x28')](_0xc1dd('0x72'),'getFields',_0x520e66,JSON['stringify'](_0x218349));delete _0x218349[_0xc1dd('0x41')];if(_0x520e66===0x191){_0x520e66=0x190;}_0x168ccb[_0xc1dd('0x19')](_0x520e66)[_0xc1dd('0x2a')](_0x21c38a[_0xc1dd('0x32')][_0xc1dd('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x218349[_0xc1dd('0x73')]}:_0x218349);});}; \ No newline at end of file +var _0x780f=['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','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','send','index','map','FreshdeskAccount','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','%s:X','toString','base64','requester','agent','description','priority','group','ticket_type','company','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1432c3,_0x46036f){var _0x4e71bd=function(_0x3678be){while(--_0x3678be){_0x1432c3['push'](_0x1432c3['shift']());}};_0x4e71bd(++_0x46036f);}(_0x780f,0x6c));var _0xf780=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x780f[_0x57db49];return _0xd0636f;};'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'];var integrations=require(_0xf780('0x1a'));function respondWithStatusCode(_0x5f04e1,_0x24aa4f){_0x24aa4f=_0x24aa4f||0xcc;return function(_0xcf2da6){if(_0xcf2da6){return _0x5f04e1[_0xf780('0x1b')](_0x24aa4f);}return _0x5f04e1[_0xf780('0x1c')](_0x24aa4f)['end']();};}function respondWithResult(_0x5a64bc,_0x4be599){_0x4be599=_0x4be599||0xc8;return function(_0x2a19fb){if(_0x2a19fb){return _0x5a64bc[_0xf780('0x1c')](_0x4be599)[_0xf780('0x1d')](_0x2a19fb);}};}function respondWithFilteredResult(_0x187b6d,_0x206d34){return function(_0x335ba6){if(_0x335ba6){var _0x422ef4=typeof _0x206d34['offset']===_0xf780('0x1e')&&typeof _0x206d34[_0xf780('0x1f')]===_0xf780('0x1e');var _0x113834=_0x335ba6[_0xf780('0x20')];var _0x188554=_0x422ef4?0x0:_0x206d34['offset'];var _0x3ede41=_0x422ef4?_0x335ba6[_0xf780('0x20')]:_0x206d34['offset']+_0x206d34[_0xf780('0x1f')];var _0x3fe0a7;if(_0x3ede41>=_0x113834){_0x3ede41=_0x113834;_0x3fe0a7=0xc8;}else{_0x3fe0a7=0xce;}_0x187b6d['status'](_0x3fe0a7);return _0x187b6d[_0xf780('0x21')](_0xf780('0x22'),_0x188554+'-'+_0x3ede41+'/'+_0x113834)[_0xf780('0x1d')](_0x335ba6);}return null;};}function patchUpdates(_0x4065bb){return function(_0x352cf1){try{jsonpatch[_0xf780('0x23')](_0x352cf1,_0x4065bb,!![]);}catch(_0x504f6f){return BPromise[_0xf780('0x24')](_0x504f6f);}return _0x352cf1['save']();};}function saveUpdates(_0x5853ea,_0x45d80e){return function(_0x51b921){if(_0x51b921){return _0x51b921[_0xf780('0x25')](_0x5853ea)['then'](function(_0x2fcb2d){return _0x2fcb2d;});}return null;};}function removeEntity(_0x373dce,_0x4f59b1){return function(_0x3a8327){if(_0x3a8327){return _0x3a8327['destroy']()[_0xf780('0x26')](function(){_0x373dce[_0xf780('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589208,_0x3710bb){return function(_0x1ef4f1){if(!_0x1ef4f1){_0x589208[_0xf780('0x1b')](0x194);}return _0x1ef4f1;};}function handleError(_0x40d9c9,_0x458c76){_0x458c76=_0x458c76||0x1f4;return function(_0x2bd6cf){logger[_0xf780('0x27')](_0x2bd6cf['stack']);if(_0x2bd6cf['name']){delete _0x2bd6cf['name'];}_0x40d9c9[_0xf780('0x1c')](_0x458c76)[_0xf780('0x28')](_0x2bd6cf);};}exports[_0xf780('0x29')]=function(_0x4ef8c3,_0x4ed256){var _0x36bc63={},_0x149190={},_0x2b832d={'count':0x0,'rows':[]};var _0x5e6b25=_[_0xf780('0x2a')](db[_0xf780('0x2b')][_0xf780('0x2c')],function(_0x302594){return{'name':_0x302594['fieldName'],'type':_0x302594[_0xf780('0x2d')]['key']};});_0x149190[_0xf780('0x2e')]=_[_0xf780('0x2a')](_0x5e6b25,_0xf780('0x2f'));_0x149190[_0xf780('0x30')]=_[_0xf780('0x31')](_0x4ef8c3[_0xf780('0x30')]);_0x149190[_0xf780('0x32')]=_[_0xf780('0x33')](_0x149190['model'],_0x149190[_0xf780('0x30')]);_0x36bc63[_0xf780('0x34')]=_[_0xf780('0x33')](_0x149190[_0xf780('0x2e')],qs[_0xf780('0x35')](_0x4ef8c3['query'][_0xf780('0x35')]));_0x36bc63['attributes']=_0x36bc63[_0xf780('0x34')][_0xf780('0x36')]?_0x36bc63[_0xf780('0x34')]:_0x149190['model'];if(!_0x4ef8c3[_0xf780('0x30')][_0xf780('0x37')](_0xf780('0x38'))){_0x36bc63[_0xf780('0x1f')]=qs['limit'](_0x4ef8c3[_0xf780('0x30')]['limit']);_0x36bc63[_0xf780('0x39')]=qs['offset'](_0x4ef8c3['query'][_0xf780('0x39')]);}_0x36bc63['order']=qs[_0xf780('0x3a')](_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3a')]);_0x36bc63[_0xf780('0x3b')]=qs['filters'](_[_0xf780('0x3c')](_0x4ef8c3[_0xf780('0x30')],_0x149190[_0xf780('0x32')]),_0x5e6b25);if(_0x4ef8c3[_0xf780('0x30')]['filter']){_0x36bc63[_0xf780('0x3b')]=_[_0xf780('0x3d')](_0x36bc63[_0xf780('0x3b')],{'$or':_[_0xf780('0x2a')](_0x5e6b25,function(_0x1a5ebf){if(_0x1a5ebf['type']!=='VIRTUAL'){var _0x3297c9={};_0x3297c9[_0x1a5ebf[_0xf780('0x2f')]]={'$like':'%'+_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3e')]+'%'};return _0x3297c9;}})});}_0x36bc63=_[_0xf780('0x3d')]({},_0x36bc63,_0x4ef8c3['options']);var _0x1c8eb3={'where':_0x36bc63['where']};return db[_0xf780('0x2b')][_0xf780('0x20')](_0x1c8eb3)[_0xf780('0x26')](function(_0x120465){_0x2b832d['count']=_0x120465;if(_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3f')]){_0x36bc63[_0xf780('0x40')]=[{'all':!![]}];}return db[_0xf780('0x2b')][_0xf780('0x41')](_0x36bc63);})[_0xf780('0x26')](function(_0x2109dc){_0x2b832d[_0xf780('0x42')]=_0x2109dc;return _0x2b832d;})[_0xf780('0x26')](respondWithFilteredResult(_0x4ed256,_0x36bc63))[_0xf780('0x43')](handleError(_0x4ed256,null));};exports[_0xf780('0x44')]=function(_0x30a036,_0x406a9e){var _0x42a710={'raw':![],'where':{'id':_0x30a036[_0xf780('0x45')]['id']}},_0x558b9a={};_0x558b9a['model']=_[_0xf780('0x31')](db[_0xf780('0x2b')]['rawAttributes']);_0x558b9a['query']=_['keys'](_0x30a036['query']);_0x558b9a[_0xf780('0x32')]=_['intersection'](_0x558b9a[_0xf780('0x2e')],_0x558b9a[_0xf780('0x30')]);_0x42a710[_0xf780('0x34')]=_[_0xf780('0x33')](_0x558b9a[_0xf780('0x2e')],qs['fields'](_0x30a036['query']['fields']));_0x42a710['attributes']=_0x42a710[_0xf780('0x34')][_0xf780('0x36')]?_0x42a710[_0xf780('0x34')]:_0x558b9a[_0xf780('0x2e')];if(_0x30a036[_0xf780('0x30')][_0xf780('0x3f')]){_0x42a710['include']=[{'all':!![]}];}_0x42a710=_[_0xf780('0x3d')]({},_0x42a710,_0x30a036[_0xf780('0x46')]);return db[_0xf780('0x2b')][_0xf780('0x47')](_0x42a710)[_0xf780('0x26')](handleEntityNotFound(_0x406a9e,null))[_0xf780('0x26')](respondWithResult(_0x406a9e,null))['catch'](handleError(_0x406a9e,null));};exports[_0xf780('0x48')]=function(_0x5c4170,_0x2f08f3){return db['FreshdeskAccount'][_0xf780('0x48')](_0x5c4170['body'],{})['then'](respondWithResult(_0x2f08f3,0xc9))[_0xf780('0x43')](handleError(_0x2f08f3,null));};exports[_0xf780('0x25')]=function(_0x189717,_0x2946a1){if(_0x189717['body']['id']){delete _0x189717[_0xf780('0x49')]['id'];}return db[_0xf780('0x2b')][_0xf780('0x47')]({'where':{'id':_0x189717[_0xf780('0x45')]['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x2946a1,null))['then'](saveUpdates(_0x189717[_0xf780('0x49')],null))['then'](respondWithResult(_0x2946a1,null))[_0xf780('0x43')](handleError(_0x2946a1,null));};exports[_0xf780('0x4a')]=function(_0x22c52d,_0x45ae96){return db[_0xf780('0x2b')]['find']({'where':{'id':_0x22c52d['params']['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x45ae96,null))[_0xf780('0x26')](removeEntity(_0x45ae96,null))[_0xf780('0x43')](handleError(_0x45ae96,null));};exports[_0xf780('0x4b')]=function(_0x4eebe5,_0x4094d5,_0x476354){var _0x180507={};var _0x3f71d2={};var _0x42bcc6;var _0x3b98c7;return db['FreshdeskAccount'][_0xf780('0x4c')]({'where':{'id':_0x4eebe5[_0xf780('0x45')]['id']}})['then'](handleEntityNotFound(_0x4094d5,null))[_0xf780('0x26')](function(_0x1f1907){if(_0x1f1907){_0x42bcc6=_0x1f1907;_0x3f71d2[_0xf780('0x2e')]=_[_0xf780('0x31')](db[_0xf780('0x4d')][_0xf780('0x2c')]);_0x3f71d2[_0xf780('0x30')]=_[_0xf780('0x31')](_0x4eebe5[_0xf780('0x30')]);_0x3f71d2[_0xf780('0x32')]=_[_0xf780('0x33')](_0x3f71d2[_0xf780('0x2e')],_0x3f71d2['query']);_0x180507[_0xf780('0x34')]=_['intersection'](_0x3f71d2[_0xf780('0x2e')],qs[_0xf780('0x35')](_0x4eebe5['query']['fields']));_0x180507['attributes']=_0x180507[_0xf780('0x34')][_0xf780('0x36')]?_0x180507[_0xf780('0x34')]:_0x3f71d2['model'];_0x180507['order']=qs['sort'](_0x4eebe5[_0xf780('0x30')]['sort']);_0x180507[_0xf780('0x3b')]=qs[_0xf780('0x32')](_[_0xf780('0x3c')](_0x4eebe5['query'],_0x3f71d2[_0xf780('0x32')]));if(_0x4eebe5['query'][_0xf780('0x3e')]){_0x180507[_0xf780('0x3b')]=_['merge'](_0x180507[_0xf780('0x3b')],{'$or':_[_0xf780('0x2a')](_0x180507[_0xf780('0x34')],function(_0x1c6799){var _0x2abf0e={};_0x2abf0e[_0x1c6799]={'$like':'%'+_0x4eebe5[_0xf780('0x30')][_0xf780('0x3e')]+'%'};return _0x2abf0e;})});}_0x180507=_['merge']({},_0x180507,_0x4eebe5['options']);return _0x42bcc6[_0xf780('0x4b')](_0x180507);}})[_0xf780('0x26')](function(_0x586545){if(_0x586545){_0x3b98c7=_0x586545[_0xf780('0x36')];if(!_0x4eebe5[_0xf780('0x30')][_0xf780('0x37')](_0xf780('0x38'))){_0x180507[_0xf780('0x1f')]=qs['limit'](_0x4eebe5['query'][_0xf780('0x1f')]);_0x180507['offset']=qs[_0xf780('0x39')](_0x4eebe5['query'][_0xf780('0x39')]);}return _0x42bcc6[_0xf780('0x4b')](_0x180507);}})[_0xf780('0x26')](function(_0x42ec59){if(_0x42ec59){return _0x42ec59?{'count':_0x3b98c7,'rows':_0x42ec59}:null;}})[_0xf780('0x26')](respondWithResult(_0x4094d5,null))['catch'](handleError(_0x4094d5,null));};exports[_0xf780('0x4e')]=function(_0x20dc15,_0x2a9180,_0x4a420f){if(_0x20dc15['body']['id']){delete _0x20dc15[_0xf780('0x49')]['id'];}return db[_0xf780('0x2b')][_0xf780('0x4c')]({'where':{'id':_0x20dc15['params']['id']}})['then'](handleEntityNotFound(_0x2a9180,null))[_0xf780('0x26')](function(_0x24bdcb){if(_0x24bdcb){_0x20dc15[_0xf780('0x49')][_0xf780('0x4f')]=_0x24bdcb['id'];_0x20dc15[_0xf780('0x49')][_0xf780('0x50')]=integrations['getSubjects'](_0x20dc15[_0xf780('0x49')][_0xf780('0x51')],_0x20dc15[_0xf780('0x49')]['type']);_0x20dc15['body'][_0xf780('0x52')]=integrations['getDescriptions'](_0x20dc15[_0xf780('0x49')][_0xf780('0x51')],_0x20dc15[_0xf780('0x49')][_0xf780('0x2d')]);return db[_0xf780('0x4d')][_0xf780('0x48')](_0x20dc15[_0xf780('0x49')],{'include':[{'model':db[_0xf780('0x53')],'as':_0xf780('0x50')},{'model':db[_0xf780('0x53')],'as':_0xf780('0x52')}]});}return null;})[_0xf780('0x26')](respondWithResult(_0x2a9180,null))[_0xf780('0x43')](handleError(_0x2a9180,null));};exports[_0xf780('0x54')]=function(_0x4110fb,_0x2ee4ae,_0x5a64aa){var _0x70e8ad='';return db['FreshdeskAccount'][_0xf780('0x4c')]({'where':{'id':_0x4110fb[_0xf780('0x45')]['id']},'attributes':['id',_0xf780('0x55'),'apiKey']})[_0xf780('0x26')](handleEntityNotFound(_0x2ee4ae,null))[_0xf780('0x26')](function(_0x1aad32){if(_0x1aad32){_0x70e8ad=_0x1aad32[_0xf780('0x55')];var _0x3371f7=_0x70e8ad[_0xf780('0x56')](-0x1);if(_0x3371f7==='/'){_0x70e8ad=_0x70e8ad[_0xf780('0x57')](0x0,_0x70e8ad[_0xf780('0x58')](_0x3371f7));}return rp({'method':_0xf780('0x59'),'uri':util[_0xf780('0x5a')](_0xf780('0x5b'),_0x70e8ad,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xf780('0x5a')]('Basic\x20%s',new Buffer(util['format'](_0xf780('0x5c'),_0x1aad32['apiKey']))[_0xf780('0x5d')](_0xf780('0x5e')))},'json':!![]});}})['then'](function(_0x46636a){if(_0x46636a){var _0x380601=[_0xf780('0x5f'),'subject',_0xf780('0x60'),_0xf780('0x61'),_0xf780('0x1c'),_0xf780('0x62'),_0xf780('0x63'),'source',_0xf780('0x64'),_0xf780('0x63'),_0xf780('0x65')];_['remove'](_0x46636a,function(_0x297052){return _0x380601['includes'](_0x297052[_0xf780('0x2f')])||!_0x297052[_0xf780('0x66')]&&_0x297052[_0xf780('0x2d')]!==_0xf780('0x67')&&_0x297052[_0xf780('0x2d')]!==_0xf780('0x68');});return{'count':_0x46636a[_0xf780('0x36')],'rows':_['map'](_0x46636a,function(_0x439082){return{'id':_0x439082[_0xf780('0x2f')],'name':_0x439082[_0xf780('0x69')],'custom':!_0x439082['default'],'options':_0x439082[_0xf780('0x6a')]?_[_0xf780('0x2a')](_0x439082[_0xf780('0x6a')],function(_0x5a8e82){return{'name':_[_0xf780('0x6b')](_0x5a8e82),'value':_0x5a8e82};}):[]};})};}})[_0xf780('0x26')](respondWithResult(_0x2ee4ae,null))[_0xf780('0x43')](function(_0x3d6dfb){var _0x4c527e=_0x4110fb[_0xf780('0x30')][_0xf780('0x6c')]?0x1f4:_0x3d6dfb[_0xf780('0x6d')]||0x1f4;logger[_0xf780('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xf780('0x54'),_0x4c527e,JSON[_0xf780('0x6e')](_0x3d6dfb));delete _0x3d6dfb[_0xf780('0x2f')];if(_0x4c527e===0x191){_0x4c527e=0x190;}_0x2ee4ae[_0xf780('0x1c')](_0x4c527e)['send'](_0x4110fb[_0xf780('0x30')]['test']?{'message':_0xf780('0x6f'),'statusCode':_0x3d6dfb[_0xf780('0x6d')]}:_0x3d6dfb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 980553e..1586452 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 _0xeaab=['../../config/logger','api','moment','bluebird','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x27afec,_0x2b548b){var _0x57c888=function(_0x28dcec){while(--_0x28dcec){_0x27afec['push'](_0x27afec['shift']());}};_0x57c888(++_0x2b548b);}(_0xeaab,0xce));var _0xbeaa=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeaab[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xbeaa('0x0'));var util=require(_0xbeaa('0x1'));var logger=require(_0xbeaa('0x2'))(_0xbeaa('0x3'));var moment=require(_0xbeaa('0x4'));var BPromise=require(_0xbeaa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbeaa('0x6'));var attributes=require(_0xbeaa('0x7'));var integrations=require(_0xbeaa('0x8'));module[_0xbeaa('0x9')]=function(_0x4f78df,_0x42817d){return _0x4f78df[_0xbeaa('0xa')](_0xbeaa('0xb'),attributes,{'tableName':_0xbeaa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x2e96db,_0x30e7bf){var _0x2922fe=function(_0x20de6f){while(--_0x20de6f){_0x2e96db['push'](_0x2e96db['shift']());}};_0x2922fe(++_0x30e7bf);}(_0xfff6,0x1cf));var _0x6fff=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfff6[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6fff('0x0'));var util=require(_0x6fff('0x1'));var logger=require(_0x6fff('0x2'))(_0x6fff('0x3'));var moment=require(_0x6fff('0x4'));var BPromise=require(_0x6fff('0x5'));var rp=require(_0x6fff('0x6'));var fs=require('fs');var path=require(_0x6fff('0x7'));var rimraf=require(_0x6fff('0x8'));var config=require('../../config/environment');var attributes=require(_0x6fff('0x9'));var integrations=require(_0x6fff('0xa'));module[_0x6fff('0xb')]=function(_0x4bb8e0,_0xda11d1){return _0x4bb8e0[_0x6fff('0xc')](_0x6fff('0xd'),attributes,{'tableName':_0x6fff('0xe'),'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 ba25c97..0443a3c 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 _0xe4e0=['ShowFreshdeskAccount','find','where','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','limit','map','include','model','attributes'];(function(_0x330921,_0x47bd88){var _0x58dc35=function(_0x47c8d4){while(--_0x47c8d4){_0x330921['push'](_0x330921['shift']());}};_0x58dc35(++_0x47bd88);}(_0xe4e0,0x6c));var _0x0e4e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe4e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0e4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0e4e('0x1'));var rs=require(_0x0e4e('0x2'));var fs=require('fs');var Redis=require(_0x0e4e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e4e('0x4'))(_0x0e4e('0x5'));var config=require(_0x0e4e('0x6'));var jayson=require(_0x0e4e('0x7'));var client=jayson[_0x0e4e('0x8')][_0x0e4e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bf33f,_0xfdfaa6,_0x3b8067){return new BPromise(function(_0x499576,_0x3d47d8){return client['request'](_0x4bf33f,_0x3b8067)[_0x0e4e('0xa')](function(_0x4bbb7d){logger[_0x0e4e('0xb')](_0x0e4e('0xc'),_0xfdfaa6,_0x0e4e('0xd'));logger[_0x0e4e('0xe')](_0x0e4e('0xf'),_0xfdfaa6,_0x0e4e('0xd'),JSON[_0x0e4e('0x10')](_0x4bbb7d));if(_0x4bbb7d['error']){if(_0x4bbb7d['error'][_0x0e4e('0x11')]===0x1f4){logger['error'](_0x0e4e('0xc'),_0xfdfaa6,_0x4bbb7d[_0x0e4e('0x12')][_0x0e4e('0x13')]);return _0x3d47d8(_0x4bbb7d[_0x0e4e('0x12')][_0x0e4e('0x13')]);}logger[_0x0e4e('0x12')](_0x0e4e('0xc'),_0xfdfaa6,_0x4bbb7d[_0x0e4e('0x12')][_0x0e4e('0x13')]);return _0x499576(_0x4bbb7d['error'][_0x0e4e('0x13')]);}else{logger[_0x0e4e('0xb')](_0x0e4e('0xc'),_0xfdfaa6,_0x0e4e('0xd'));_0x499576(_0x4bbb7d[_0x0e4e('0x14')][_0x0e4e('0x13')]);}})[_0x0e4e('0x15')](function(_0x236086){logger[_0x0e4e('0x12')](_0x0e4e('0xc'),_0xfdfaa6,_0x236086);_0x3d47d8(_0x236086);});});}exports[_0x0e4e('0x16')]=function(_0x1f5acc){var _0x13edc8=this;return new Promise(function(_0x13555f,_0x147ed4){return db[_0x0e4e('0x17')][_0x0e4e('0x18')]({'raw':_0x1f5acc[_0x0e4e('0x19')]?_0x1f5acc['options'][_0x0e4e('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f5acc[_0x0e4e('0x19')]?_0x1f5acc[_0x0e4e('0x19')]['where']||null:null,'attributes':_0x1f5acc['options']?_0x1f5acc['options']['attributes']||null:null,'limit':_0x1f5acc['options']?_0x1f5acc[_0x0e4e('0x19')][_0x0e4e('0x1b')]||null:null,'include':_0x1f5acc[_0x0e4e('0x19')]?_0x1f5acc[_0x0e4e('0x19')]['include']?_[_0x0e4e('0x1c')](_0x1f5acc[_0x0e4e('0x19')]['include'],function(_0x5957fa){return{'model':db[_0x5957fa['model']],'as':_0x5957fa['as'],'attributes':_0x5957fa['attributes'],'include':_0x5957fa[_0x0e4e('0x1d')]?_[_0x0e4e('0x1c')](_0x5957fa[_0x0e4e('0x1d')],function(_0x28b105){return{'model':db[_0x28b105[_0x0e4e('0x1e')]],'as':_0x28b105['as'],'attributes':_0x28b105['attributes'],'include':_0x28b105[_0x0e4e('0x1d')]?_['map'](_0x28b105['include'],function(_0x51af70){return{'model':db[_0x51af70[_0x0e4e('0x1e')]],'as':_0x51af70['as'],'attributes':_0x51af70[_0x0e4e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0e4e('0xa')](function(_0x409495){logger[_0x0e4e('0xb')](_0x0e4e('0x16'),_0x1f5acc);logger[_0x0e4e('0xe')](_0x0e4e('0x16'),_0x1f5acc,JSON['stringify'](_0x409495));_0x13555f(_0x409495);})[_0x0e4e('0x15')](function(_0xff3592){logger[_0x0e4e('0x12')](_0x0e4e('0x16'),_0xff3592[_0x0e4e('0x13')],_0x1f5acc);_0x147ed4(_0x13edc8[_0x0e4e('0x12')](0x1f4,_0xff3592[_0x0e4e('0x13')]));});});};exports[_0x0e4e('0x20')]=function(_0x301d3a){var _0x4a3dad=this;return new Promise(function(_0x572194,_0x2bddae){return db['FreshdeskAccount'][_0x0e4e('0x21')]({'raw':_0x301d3a[_0x0e4e('0x19')]?_0x301d3a[_0x0e4e('0x19')][_0x0e4e('0x1a')]===undefined?!![]:![]:!![],'where':_0x301d3a[_0x0e4e('0x19')]?_0x301d3a[_0x0e4e('0x19')][_0x0e4e('0x22')]||null:null,'attributes':_0x301d3a[_0x0e4e('0x19')]?_0x301d3a[_0x0e4e('0x19')]['attributes']||null:null,'include':_0x301d3a[_0x0e4e('0x19')]?_0x301d3a[_0x0e4e('0x19')][_0x0e4e('0x1d')]?_[_0x0e4e('0x1c')](_0x301d3a[_0x0e4e('0x19')][_0x0e4e('0x1d')],function(_0x459ed3){return{'model':db[_0x459ed3[_0x0e4e('0x1e')]],'as':_0x459ed3['as'],'attributes':_0x459ed3[_0x0e4e('0x1f')],'include':_0x459ed3[_0x0e4e('0x1d')]?_['map'](_0x459ed3[_0x0e4e('0x1d')],function(_0x5e4427){return{'model':db[_0x5e4427[_0x0e4e('0x1e')]],'as':_0x5e4427['as'],'attributes':_0x5e4427['attributes'],'include':_0x5e4427[_0x0e4e('0x1d')]?_[_0x0e4e('0x1c')](_0x5e4427[_0x0e4e('0x1d')],function(_0x493396){return{'model':db[_0x493396[_0x0e4e('0x1e')]],'as':_0x493396['as'],'attributes':_0x493396[_0x0e4e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0e4e('0xa')](function(_0x2af7ee){logger['info'](_0x0e4e('0x20'),_0x301d3a);logger[_0x0e4e('0xe')](_0x0e4e('0x20'),_0x301d3a,JSON[_0x0e4e('0x10')](_0x2af7ee));_0x572194(_0x2af7ee);})[_0x0e4e('0x15')](function(_0x52a541){logger['error']('ShowFreshdeskAccount',_0x52a541[_0x0e4e('0x13')],_0x301d3a);_0x2bddae(_0x4a3dad[_0x0e4e('0x12')](0x1f4,_0x52a541[_0x0e4e('0x13')]));});});}; \ No newline at end of file +var _0x68de=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x27b917,_0x3cdedb){var _0x404989=function(_0x19a3f8){while(--_0x19a3f8){_0x27b917['push'](_0x27b917['shift']());}};_0x404989(++_0x3cdedb);}(_0x68de,0xfa));var _0xe68d=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x68de[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0xe68d('0x0'));var util=require(_0xe68d('0x1'));var moment=require(_0xe68d('0x2'));var BPromise=require('bluebird');var rs=require(_0xe68d('0x3'));var fs=require('fs');var Redis=require(_0xe68d('0x4'));var db=require(_0xe68d('0x5'))['db'];var utils=require(_0xe68d('0x6'));var logger=require('../../config/logger')(_0xe68d('0x7'));var config=require(_0xe68d('0x8'));var jayson=require(_0xe68d('0x9'));var client=jayson[_0xe68d('0xa')][_0xe68d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cd0b5,_0x2d750e,_0x4e46f3){return new BPromise(function(_0x2cf142,_0x243771){return client[_0xe68d('0xc')](_0x5cd0b5,_0x4e46f3)[_0xe68d('0xd')](function(_0x16fe37){logger[_0xe68d('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x2d750e,_0xe68d('0xf'));logger[_0xe68d('0x10')](_0xe68d('0x11'),_0x2d750e,'request\x20sent',JSON[_0xe68d('0x12')](_0x16fe37));if(_0x16fe37['error']){if(_0x16fe37['error'][_0xe68d('0x13')]===0x1f4){logger[_0xe68d('0x14')](_0xe68d('0x15'),_0x2d750e,_0x16fe37['error'][_0xe68d('0x16')]);return _0x243771(_0x16fe37['error'][_0xe68d('0x16')]);}logger[_0xe68d('0x14')](_0xe68d('0x15'),_0x2d750e,_0x16fe37[_0xe68d('0x14')]['message']);return _0x2cf142(_0x16fe37['error'][_0xe68d('0x16')]);}else{logger[_0xe68d('0xe')](_0xe68d('0x15'),_0x2d750e,_0xe68d('0xf'));_0x2cf142(_0x16fe37[_0xe68d('0x17')][_0xe68d('0x16')]);}})[_0xe68d('0x18')](function(_0x1e3e24){logger[_0xe68d('0x14')](_0xe68d('0x15'),_0x2d750e,_0x1e3e24);_0x243771(_0x1e3e24);});});}exports[_0xe68d('0x19')]=function(_0x3c877c){var _0x16cd23=this;return new Promise(function(_0x1a0780,_0x263ba9){return db['FreshdeskAccount'][_0xe68d('0x1a')]({'raw':_0x3c877c[_0xe68d('0x1b')]?_0x3c877c[_0xe68d('0x1b')][_0xe68d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c877c[_0xe68d('0x1b')]?_0x3c877c[_0xe68d('0x1b')][_0xe68d('0x1d')]||null:null,'attributes':_0x3c877c[_0xe68d('0x1b')]?_0x3c877c[_0xe68d('0x1b')][_0xe68d('0x1e')]||null:null,'limit':_0x3c877c[_0xe68d('0x1b')]?_0x3c877c[_0xe68d('0x1b')][_0xe68d('0x1f')]||null:null,'include':_0x3c877c['options']?_0x3c877c[_0xe68d('0x1b')]['include']?_[_0xe68d('0x20')](_0x3c877c['options']['include'],function(_0x24fe19){return{'model':db[_0x24fe19[_0xe68d('0x21')]],'as':_0x24fe19['as'],'attributes':_0x24fe19[_0xe68d('0x1e')],'include':_0x24fe19[_0xe68d('0x22')]?_['map'](_0x24fe19['include'],function(_0x53b957){return{'model':db[_0x53b957['model']],'as':_0x53b957['as'],'attributes':_0x53b957[_0xe68d('0x1e')],'include':_0x53b957[_0xe68d('0x22')]?_[_0xe68d('0x20')](_0x53b957[_0xe68d('0x22')],function(_0x9ae1f4){return{'model':db[_0x9ae1f4[_0xe68d('0x21')]],'as':_0x9ae1f4['as'],'attributes':_0x9ae1f4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe68d('0xd')](function(_0x5203fb){logger['info'](_0xe68d('0x19'),_0x3c877c);logger['debug'](_0xe68d('0x19'),_0x3c877c,JSON[_0xe68d('0x12')](_0x5203fb));_0x1a0780(_0x5203fb);})['catch'](function(_0x497a43){logger[_0xe68d('0x14')](_0xe68d('0x19'),_0x497a43[_0xe68d('0x16')],_0x3c877c);_0x263ba9(_0x16cd23[_0xe68d('0x14')](0x1f4,_0x497a43[_0xe68d('0x16')]));});});};exports[_0xe68d('0x23')]=function(_0x4167da){var _0x53bc4d=this;return new Promise(function(_0x2eb3b6,_0x1fc4f2){return db[_0xe68d('0x24')][_0xe68d('0x25')]({'raw':_0x4167da[_0xe68d('0x1b')]?_0x4167da[_0xe68d('0x1b')][_0xe68d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4167da[_0xe68d('0x1b')]?_0x4167da[_0xe68d('0x1b')][_0xe68d('0x1d')]||null:null,'attributes':_0x4167da[_0xe68d('0x1b')]?_0x4167da['options']['attributes']||null:null,'include':_0x4167da[_0xe68d('0x1b')]?_0x4167da[_0xe68d('0x1b')][_0xe68d('0x22')]?_[_0xe68d('0x20')](_0x4167da['options'][_0xe68d('0x22')],function(_0x2d5414){return{'model':db[_0x2d5414['model']],'as':_0x2d5414['as'],'attributes':_0x2d5414['attributes'],'include':_0x2d5414[_0xe68d('0x22')]?_[_0xe68d('0x20')](_0x2d5414[_0xe68d('0x22')],function(_0x43402e){return{'model':db[_0x43402e[_0xe68d('0x21')]],'as':_0x43402e['as'],'attributes':_0x43402e[_0xe68d('0x1e')],'include':_0x43402e[_0xe68d('0x22')]?_[_0xe68d('0x20')](_0x43402e['include'],function(_0x3fd3f0){return{'model':db[_0x3fd3f0[_0xe68d('0x21')]],'as':_0x3fd3f0['as'],'attributes':_0x3fd3f0[_0xe68d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x599dcc){logger[_0xe68d('0xe')]('ShowFreshdeskAccount',_0x4167da);logger['debug'](_0xe68d('0x23'),_0x4167da,JSON[_0xe68d('0x12')](_0x599dcc));_0x2eb3b6(_0x599dcc);})[_0xe68d('0x18')](function(_0x379b17){logger[_0xe68d('0x14')](_0xe68d('0x23'),_0x379b17[_0xe68d('0x16')],_0x4167da);_0x1fc4f2(_0x53bc4d['error'](0x1f4,_0x379b17[_0xe68d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 5b6f335..893506c 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 _0xe24a=['isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/tags','getTags','create','post','put','update','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/:id'];(function(_0x3cbb0c,_0x4bd648){var _0x22be5c=function(_0x2b0266){while(--_0x2b0266){_0x3cbb0c['push'](_0x3cbb0c['shift']());}};_0x22be5c(++_0x4bd648);}(_0xe24a,0x83));var _0xae24=function(_0xa7c4fb,_0x4ae9a9){_0xa7c4fb=_0xa7c4fb-0x0;var _0x5b4e13=_0xe24a[_0xa7c4fb];return _0x5b4e13;};'use strict';var multer=require('multer');var util=require(_0xae24('0x0'));var path=require(_0xae24('0x1'));var timeout=require(_0xae24('0x2'));var express=require(_0xae24('0x3'));var router=express['Router']();var fs_extra=require(_0xae24('0x4'));var auth=require(_0xae24('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xae24('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xae24('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae24('0x7')](_0xae24('0x8'),auth[_0xae24('0x9')](),controller['show']);router['get'](_0xae24('0xa'),auth[_0xae24('0x9')](),controller[_0xae24('0xb')]);router[_0xae24('0x7')](_0xae24('0xc'),auth[_0xae24('0x9')](),controller['getSubjects']);router[_0xae24('0x7')]('/:id/descriptions',auth[_0xae24('0x9')](),controller['getDescriptions']);router[_0xae24('0x7')](_0xae24('0xd'),auth[_0xae24('0x9')](),controller[_0xae24('0xe')]);router['post']('/',auth[_0xae24('0x9')](),controller[_0xae24('0xf')]);router[_0xae24('0x10')]('/:id/tags',auth[_0xae24('0x9')](),controller['setTags']);router[_0xae24('0x11')](_0xae24('0x8'),auth[_0xae24('0x9')](),controller[_0xae24('0x12')]);router['delete']('/:id',auth[_0xae24('0x9')](),controller[_0xae24('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf1b0=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0xd6f5a1,_0x11d4c2){var _0x3305ac=function(_0x349e96){while(--_0x349e96){_0xd6f5a1['push'](_0xd6f5a1['shift']());}};_0x3305ac(++_0x11d4c2);}(_0xf1b0,0x1bd));var _0x0f1b=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0xf1b0[_0x3b87f4];return _0x63d16e;};'use strict';var multer=require('multer');var util=require(_0x0f1b('0x0'));var path=require(_0x0f1b('0x1'));var timeout=require(_0x0f1b('0x2'));var express=require(_0x0f1b('0x3'));var router=express[_0x0f1b('0x4')]();var fs_extra=require(_0x0f1b('0x5'));var auth=require(_0x0f1b('0x6'));var interaction=require(_0x0f1b('0x7'));var config=require(_0x0f1b('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x0f1b('0x9')](),controller[_0x0f1b('0xa')]);router[_0x0f1b('0xb')](_0x0f1b('0xc'),auth[_0x0f1b('0x9')](),controller[_0x0f1b('0xd')]);router[_0x0f1b('0xb')](_0x0f1b('0xe'),auth['isAuthenticated'](),controller[_0x0f1b('0xf')]);router[_0x0f1b('0xb')](_0x0f1b('0x10'),auth[_0x0f1b('0x9')](),controller[_0x0f1b('0x11')]);router[_0x0f1b('0xb')](_0x0f1b('0x12'),auth['isAuthenticated'](),controller[_0x0f1b('0x13')]);router[_0x0f1b('0xb')]('/:id/tags',auth[_0x0f1b('0x9')](),controller['getTags']);router[_0x0f1b('0x14')]('/',auth[_0x0f1b('0x9')](),controller[_0x0f1b('0x15')]);router[_0x0f1b('0x14')](_0x0f1b('0x16'),auth[_0x0f1b('0x9')](),controller[_0x0f1b('0x17')]);router[_0x0f1b('0x18')](_0x0f1b('0xc'),auth[_0x0f1b('0x9')](),controller[_0x0f1b('0x19')]);router[_0x0f1b('0x1a')](_0x0f1b('0xc'),auth[_0x0f1b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index bfd1f39..8fcadcf 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 _0x399b=['sequelize','exports','STRING'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x399b,0xf3));var _0xb399=function(_0x15df69,_0x5a0e9f){_0x15df69=_0x15df69-0x0;var _0xf064d4=_0x399b[_0x15df69];return _0xf064d4;};'use strict';var Sequelize=require(_0xb399('0x0'));module[_0xb399('0x1')]={'name':{'type':Sequelize[_0xb399('0x2')]},'description':{'type':Sequelize[_0xb399('0x2')]}}; \ No newline at end of file +var _0xd0e8=['exports','STRING','sequelize'];(function(_0x29bb65,_0x186c34){var _0x377289=function(_0x18e1ff){while(--_0x18e1ff){_0x29bb65['push'](_0x29bb65['shift']());}};_0x377289(++_0x186c34);}(_0xd0e8,0x1a3));var _0x8d0e=function(_0x44e4dd,_0x4779aa){_0x44e4dd=_0x44e4dd-0x0;var _0x42c267=_0xd0e8[_0x44e4dd];return _0x42c267;};'use strict';var Sequelize=require(_0x8d0e('0x0'));module[_0x8d0e('0x1')]={'name':{'type':Sequelize[_0x8d0e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7067bbb..1a8bbc7 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 _0x0412=['apply','reject','save','then','error','stack','index','FreshdeskConfiguration','rawAttributes','fieldName','model','name','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','create','body','update','destroy','find','params','findOne','FreshdeskField','getFields','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x0412,0x86));var _0x2041=function(_0x38af1a,_0x1c1965){_0x38af1a=_0x38af1a-0x0;var _0x3807fb=_0x0412[_0x38af1a];return _0x3807fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2041('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2041('0x1'));var rp=require(_0x2041('0x2'));var moment=require(_0x2041('0x3'));var BPromise=require(_0x2041('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2041('0x5'));var sox=require(_0x2041('0x6'));var csv=require(_0x2041('0x7'));var ejs=require(_0x2041('0x8'));var fs=require('fs');var fs_extra=require(_0x2041('0x9'));var _=require(_0x2041('0xa'));var squel=require('squel');var crypto=require(_0x2041('0xb'));var jsforce=require(_0x2041('0xc'));var deskjs=require(_0x2041('0xd'));var toCsv=require(_0x2041('0x7'));var querystring=require(_0x2041('0xe'));var Papa=require(_0x2041('0xf'));var Redis=require(_0x2041('0x10'));var authService=require(_0x2041('0x11'));var qs=require(_0x2041('0x12'));var as=require(_0x2041('0x13'));var hardwareService=require(_0x2041('0x14'));var logger=require('../../config/logger')(_0x2041('0x15'));var utils=require(_0x2041('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2041('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d87d2,_0x5ddf2a){_0x5ddf2a=_0x5ddf2a||0xcc;return function(_0x5b5c87){if(_0x5b5c87){return _0x5d87d2[_0x2041('0x18')](_0x5ddf2a);}return _0x5d87d2[_0x2041('0x19')](_0x5ddf2a)[_0x2041('0x1a')]();};}function respondWithResult(_0x2ee48a,_0x500a7a){_0x500a7a=_0x500a7a||0xc8;return function(_0x39a518){if(_0x39a518){return _0x2ee48a[_0x2041('0x19')](_0x500a7a)['json'](_0x39a518);}};}function respondWithFilteredResult(_0x43a200,_0x312aa8){return function(_0x4ce0be){if(_0x4ce0be){var _0x258524=typeof _0x312aa8[_0x2041('0x1b')]===_0x2041('0x1c')&&typeof _0x312aa8['limit']==='undefined';var _0xb45275=_0x4ce0be[_0x2041('0x1d')];var _0x28fe69=_0x258524?0x0:_0x312aa8[_0x2041('0x1b')];var _0x571a93=_0x258524?_0x4ce0be[_0x2041('0x1d')]:_0x312aa8[_0x2041('0x1b')]+_0x312aa8[_0x2041('0x1e')];var _0x4a2d1f;if(_0x571a93>=_0xb45275){_0x571a93=_0xb45275;_0x4a2d1f=0xc8;}else{_0x4a2d1f=0xce;}_0x43a200[_0x2041('0x19')](_0x4a2d1f);return _0x43a200[_0x2041('0x1f')](_0x2041('0x20'),_0x28fe69+'-'+_0x571a93+'/'+_0xb45275)[_0x2041('0x21')](_0x4ce0be);}return null;};}function patchUpdates(_0x529fd3){return function(_0x34e764){try{jsonpatch[_0x2041('0x22')](_0x34e764,_0x529fd3,!![]);}catch(_0x100e98){return BPromise[_0x2041('0x23')](_0x100e98);}return _0x34e764[_0x2041('0x24')]();};}function saveUpdates(_0x5c9b25,_0x5909da){return function(_0x39192f){if(_0x39192f){return _0x39192f['update'](_0x5c9b25)[_0x2041('0x25')](function(_0x536c58){return _0x536c58;});}return null;};}function removeEntity(_0x3163fd,_0xd9876b){return function(_0x5e477a){if(_0x5e477a){return _0x5e477a['destroy']()['then'](function(){_0x3163fd[_0x2041('0x19')](0xcc)[_0x2041('0x1a')]();});}};}function handleEntityNotFound(_0x4aa83a,_0x585244){return function(_0x4e0ea7){if(!_0x4e0ea7){_0x4aa83a['sendStatus'](0x194);}return _0x4e0ea7;};}function handleError(_0x26ded1,_0x3724f9){_0x3724f9=_0x3724f9||0x1f4;return function(_0x379746){logger[_0x2041('0x26')](_0x379746[_0x2041('0x27')]);if(_0x379746['name']){delete _0x379746['name'];}_0x26ded1[_0x2041('0x19')](_0x3724f9)['send'](_0x379746);};}exports[_0x2041('0x28')]=function(_0x1719e4,_0x579685){var _0x43a05c={},_0x375609={},_0x1694f8={'count':0x0,'rows':[]};var _0xb6d2bc=_['map'](db[_0x2041('0x29')][_0x2041('0x2a')],function(_0x25089d){return{'name':_0x25089d[_0x2041('0x2b')],'type':_0x25089d['type']['key']};});_0x375609[_0x2041('0x2c')]=_['map'](_0xb6d2bc,_0x2041('0x2d'));_0x375609[_0x2041('0x2e')]=_['keys'](_0x1719e4['query']);_0x375609['filters']=_[_0x2041('0x2f')](_0x375609[_0x2041('0x2c')],_0x375609[_0x2041('0x2e')]);_0x43a05c['attributes']=_[_0x2041('0x2f')](_0x375609[_0x2041('0x2c')],qs[_0x2041('0x30')](_0x1719e4['query']['fields']));_0x43a05c['attributes']=_0x43a05c[_0x2041('0x31')][_0x2041('0x32')]?_0x43a05c[_0x2041('0x31')]:_0x375609[_0x2041('0x2c')];if(!_0x1719e4['query']['hasOwnProperty'](_0x2041('0x33'))){_0x43a05c[_0x2041('0x1e')]=qs[_0x2041('0x1e')](_0x1719e4[_0x2041('0x2e')][_0x2041('0x1e')]);_0x43a05c[_0x2041('0x1b')]=qs[_0x2041('0x1b')](_0x1719e4['query']['offset']);}_0x43a05c[_0x2041('0x34')]=qs[_0x2041('0x35')](_0x1719e4[_0x2041('0x2e')][_0x2041('0x35')]);_0x43a05c['where']=qs[_0x2041('0x36')](_[_0x2041('0x37')](_0x1719e4['query'],_0x375609['filters']),_0xb6d2bc);if(_0x1719e4[_0x2041('0x2e')][_0x2041('0x38')]){_0x43a05c[_0x2041('0x39')]=_[_0x2041('0x3a')](_0x43a05c[_0x2041('0x39')],{'$or':_[_0x2041('0x3b')](_0xb6d2bc,function(_0x1e21a2){if(_0x1e21a2[_0x2041('0x3c')]!==_0x2041('0x3d')){var _0x1c2129={};_0x1c2129[_0x1e21a2[_0x2041('0x2d')]]={'$like':'%'+_0x1719e4[_0x2041('0x2e')][_0x2041('0x38')]+'%'};return _0x1c2129;}})});}_0x43a05c=_[_0x2041('0x3a')]({},_0x43a05c,_0x1719e4[_0x2041('0x3e')]);var _0x5dd4e4={'where':_0x43a05c[_0x2041('0x39')]};return db['FreshdeskConfiguration'][_0x2041('0x1d')](_0x5dd4e4)['then'](function(_0x2bd9a2){_0x1694f8[_0x2041('0x1d')]=_0x2bd9a2;if(_0x1719e4[_0x2041('0x2e')][_0x2041('0x3f')]){_0x43a05c[_0x2041('0x40')]=[{'all':!![]}];}return db[_0x2041('0x29')][_0x2041('0x41')](_0x43a05c);})['then'](function(_0x5477a3){_0x1694f8['rows']=_0x5477a3;return _0x1694f8;})[_0x2041('0x25')](respondWithFilteredResult(_0x579685,_0x43a05c))[_0x2041('0x42')](handleError(_0x579685,null));};exports[_0x2041('0x43')]=function(_0x43ccc5,_0x19b00f){var _0x247960={'raw':![],'where':{'id':_0x43ccc5['params']['id']}},_0x37a701={};_0x37a701[_0x2041('0x2c')]=_[_0x2041('0x44')](db[_0x2041('0x29')][_0x2041('0x2a')]);_0x37a701[_0x2041('0x2e')]=_[_0x2041('0x44')](_0x43ccc5[_0x2041('0x2e')]);_0x37a701[_0x2041('0x36')]=_[_0x2041('0x2f')](_0x37a701[_0x2041('0x2c')],_0x37a701['query']);_0x247960[_0x2041('0x31')]=_[_0x2041('0x2f')](_0x37a701[_0x2041('0x2c')],qs[_0x2041('0x30')](_0x43ccc5['query']['fields']));_0x247960[_0x2041('0x31')]=_0x247960[_0x2041('0x31')][_0x2041('0x32')]?_0x247960[_0x2041('0x31')]:_0x37a701[_0x2041('0x2c')];if(_0x43ccc5[_0x2041('0x2e')][_0x2041('0x3f')]){_0x247960['include']=[{'all':!![]}];}_0x247960=_[_0x2041('0x3a')]({},_0x247960,_0x43ccc5[_0x2041('0x3e')]);return db[_0x2041('0x29')]['find'](_0x247960)[_0x2041('0x25')](handleEntityNotFound(_0x19b00f,null))[_0x2041('0x25')](respondWithResult(_0x19b00f,null))['catch'](handleError(_0x19b00f,null));};exports[_0x2041('0x45')]=function(_0x587abb,_0x3e2680){return db[_0x2041('0x29')][_0x2041('0x45')](_0x587abb[_0x2041('0x46')],{})[_0x2041('0x25')](respondWithResult(_0x3e2680,0xc9))[_0x2041('0x42')](handleError(_0x3e2680,null));};exports[_0x2041('0x47')]=function(_0x212160,_0x5025ce){if(_0x212160[_0x2041('0x46')]['id']){delete _0x212160[_0x2041('0x46')]['id'];}return db[_0x2041('0x29')]['find']({'where':{'id':_0x212160['params']['id']}})[_0x2041('0x25')](handleEntityNotFound(_0x5025ce,null))['then'](saveUpdates(_0x212160[_0x2041('0x46')],null))[_0x2041('0x25')](respondWithResult(_0x5025ce,null))[_0x2041('0x42')](handleError(_0x5025ce,null));};exports[_0x2041('0x48')]=function(_0x2ed20c,_0x1f309f){return db[_0x2041('0x29')][_0x2041('0x49')]({'where':{'id':_0x2ed20c[_0x2041('0x4a')]['id']}})[_0x2041('0x25')](handleEntityNotFound(_0x1f309f,null))[_0x2041('0x25')](removeEntity(_0x1f309f,null))[_0x2041('0x42')](handleError(_0x1f309f,null));};exports['getFields']=function(_0x178c71,_0x3c7a30,_0x54d042){var _0x15674b={};var _0x391402={};var _0x106b45;var _0x3c87f3;return db[_0x2041('0x29')][_0x2041('0x4b')]({'where':{'id':_0x178c71['params']['id']}})[_0x2041('0x25')](handleEntityNotFound(_0x3c7a30,null))[_0x2041('0x25')](function(_0x4c25e5){if(_0x4c25e5){_0x106b45=_0x4c25e5;_0x391402[_0x2041('0x2c')]=_[_0x2041('0x44')](db[_0x2041('0x4c')][_0x2041('0x2a')]);_0x391402['query']=_['keys'](_0x178c71[_0x2041('0x2e')]);_0x391402['filters']=_[_0x2041('0x2f')](_0x391402['model'],_0x391402[_0x2041('0x2e')]);_0x15674b[_0x2041('0x31')]=_[_0x2041('0x2f')](_0x391402[_0x2041('0x2c')],qs[_0x2041('0x30')](_0x178c71[_0x2041('0x2e')]['fields']));_0x15674b[_0x2041('0x31')]=_0x15674b[_0x2041('0x31')][_0x2041('0x32')]?_0x15674b[_0x2041('0x31')]:_0x391402['model'];_0x15674b[_0x2041('0x34')]=qs[_0x2041('0x35')](_0x178c71[_0x2041('0x2e')][_0x2041('0x35')]);_0x15674b['where']=qs[_0x2041('0x36')](_[_0x2041('0x37')](_0x178c71[_0x2041('0x2e')],_0x391402[_0x2041('0x36')]));if(_0x178c71[_0x2041('0x2e')]['filter']){_0x15674b[_0x2041('0x39')]=_[_0x2041('0x3a')](_0x15674b['where'],{'$or':_[_0x2041('0x3b')](_0x15674b['attributes'],function(_0x318b6e){var _0x58d9e7={};_0x58d9e7[_0x318b6e]={'$like':'%'+_0x178c71[_0x2041('0x2e')][_0x2041('0x38')]+'%'};return _0x58d9e7;})});}_0x15674b=_[_0x2041('0x3a')]({},_0x15674b,_0x178c71[_0x2041('0x3e')]);return _0x106b45[_0x2041('0x4d')](_0x15674b);}})[_0x2041('0x25')](function(_0x5ec65d){if(_0x5ec65d){_0x3c87f3=_0x5ec65d['length'];if(!_0x178c71[_0x2041('0x2e')]['hasOwnProperty']('nolimit')){_0x15674b['limit']=qs[_0x2041('0x1e')](_0x178c71[_0x2041('0x2e')]['limit']);_0x15674b['offset']=qs[_0x2041('0x1b')](_0x178c71['query'][_0x2041('0x1b')]);}return _0x106b45[_0x2041('0x4d')](_0x15674b);}})[_0x2041('0x25')](function(_0x1795cd){if(_0x1795cd){return _0x1795cd?{'count':_0x3c87f3,'rows':_0x1795cd}:null;}})[_0x2041('0x25')](respondWithResult(_0x3c7a30,null))[_0x2041('0x42')](handleError(_0x3c7a30,null));};exports[_0x2041('0x4e')]=function(_0xd6d21f,_0x5e74f2,_0x4a6b7a){var _0x1942eb={};var _0x49f4cc={};var _0x324958;var _0x99d358;return db[_0x2041('0x29')]['findOne']({'where':{'id':_0xd6d21f[_0x2041('0x4a')]['id']}})[_0x2041('0x25')](handleEntityNotFound(_0x5e74f2,null))[_0x2041('0x25')](function(_0x3eddc8){if(_0x3eddc8){_0x324958=_0x3eddc8;_0x49f4cc[_0x2041('0x2c')]=_['keys'](db['FreshdeskField'][_0x2041('0x2a')]);_0x49f4cc[_0x2041('0x2e')]=_['keys'](_0xd6d21f[_0x2041('0x2e')]);_0x49f4cc[_0x2041('0x36')]=_['intersection'](_0x49f4cc[_0x2041('0x2c')],_0x49f4cc[_0x2041('0x2e')]);_0x1942eb[_0x2041('0x31')]=_[_0x2041('0x2f')](_0x49f4cc['model'],qs[_0x2041('0x30')](_0xd6d21f[_0x2041('0x2e')][_0x2041('0x30')]));_0x1942eb[_0x2041('0x31')]=_0x1942eb[_0x2041('0x31')][_0x2041('0x32')]?_0x1942eb['attributes']:_0x49f4cc[_0x2041('0x2c')];_0x1942eb[_0x2041('0x34')]=qs[_0x2041('0x35')](_0xd6d21f[_0x2041('0x2e')][_0x2041('0x35')]);_0x1942eb[_0x2041('0x39')]=qs[_0x2041('0x36')](_['pick'](_0xd6d21f['query'],_0x49f4cc['filters']));if(_0xd6d21f[_0x2041('0x2e')][_0x2041('0x38')]){_0x1942eb[_0x2041('0x39')]=_[_0x2041('0x3a')](_0x1942eb['where'],{'$or':_[_0x2041('0x3b')](_0x1942eb['attributes'],function(_0x354281){var _0x2dd11e={};_0x2dd11e[_0x354281]={'$like':'%'+_0xd6d21f[_0x2041('0x2e')]['filter']+'%'};return _0x2dd11e;})});}_0x1942eb=_['merge']({},_0x1942eb,_0xd6d21f['options']);return _0x324958[_0x2041('0x4e')](_0x1942eb);}})['then'](function(_0x5e02a4){if(_0x5e02a4){_0x99d358=_0x5e02a4[_0x2041('0x32')];if(!_0xd6d21f[_0x2041('0x2e')][_0x2041('0x4f')](_0x2041('0x33'))){_0x1942eb[_0x2041('0x1e')]=qs[_0x2041('0x1e')](_0xd6d21f[_0x2041('0x2e')][_0x2041('0x1e')]);_0x1942eb[_0x2041('0x1b')]=qs[_0x2041('0x1b')](_0xd6d21f[_0x2041('0x2e')]['offset']);}return _0x324958[_0x2041('0x4e')](_0x1942eb);}})[_0x2041('0x25')](function(_0x5129ff){if(_0x5129ff){return _0x5129ff?{'count':_0x99d358,'rows':_0x5129ff}:null;}})['then'](respondWithResult(_0x5e74f2,null))[_0x2041('0x42')](handleError(_0x5e74f2,null));};exports[_0x2041('0x50')]=function(_0x23487a,_0x27fbdf,_0x3ec950){var _0x437505={};var _0x41944b={};var _0x4967c0;var _0x34d0bf;return db[_0x2041('0x29')]['findOne']({'where':{'id':_0x23487a['params']['id']}})[_0x2041('0x25')](handleEntityNotFound(_0x27fbdf,null))[_0x2041('0x25')](function(_0x27016d){if(_0x27016d){_0x4967c0=_0x27016d;_0x41944b[_0x2041('0x2c')]=_[_0x2041('0x44')](db[_0x2041('0x4c')][_0x2041('0x2a')]);_0x41944b[_0x2041('0x2e')]=_[_0x2041('0x44')](_0x23487a[_0x2041('0x2e')]);_0x41944b[_0x2041('0x36')]=_[_0x2041('0x2f')](_0x41944b[_0x2041('0x2c')],_0x41944b[_0x2041('0x2e')]);_0x437505[_0x2041('0x31')]=_[_0x2041('0x2f')](_0x41944b['model'],qs['fields'](_0x23487a[_0x2041('0x2e')][_0x2041('0x30')]));_0x437505['attributes']=_0x437505[_0x2041('0x31')][_0x2041('0x32')]?_0x437505[_0x2041('0x31')]:_0x41944b[_0x2041('0x2c')];_0x437505[_0x2041('0x34')]=qs[_0x2041('0x35')](_0x23487a[_0x2041('0x2e')][_0x2041('0x35')]);_0x437505['where']=qs[_0x2041('0x36')](_['pick'](_0x23487a[_0x2041('0x2e')],_0x41944b[_0x2041('0x36')]));if(_0x23487a['query']['filter']){_0x437505[_0x2041('0x39')]=_[_0x2041('0x3a')](_0x437505[_0x2041('0x39')],{'$or':_[_0x2041('0x3b')](_0x437505[_0x2041('0x31')],function(_0xf12065){var _0x3d1da5={};_0x3d1da5[_0xf12065]={'$like':'%'+_0x23487a['query'][_0x2041('0x38')]+'%'};return _0x3d1da5;})});}_0x437505=_[_0x2041('0x3a')]({},_0x437505,_0x23487a['options']);return _0x4967c0['getDescriptions'](_0x437505);}})[_0x2041('0x25')](function(_0x52a2e5){if(_0x52a2e5){_0x34d0bf=_0x52a2e5[_0x2041('0x32')];if(!_0x23487a['query'][_0x2041('0x4f')](_0x2041('0x33'))){_0x437505[_0x2041('0x1e')]=qs[_0x2041('0x1e')](_0x23487a[_0x2041('0x2e')][_0x2041('0x1e')]);_0x437505['offset']=qs[_0x2041('0x1b')](_0x23487a[_0x2041('0x2e')]['offset']);}return _0x4967c0[_0x2041('0x50')](_0x437505);}})[_0x2041('0x25')](function(_0x3a77c7){if(_0x3a77c7){return _0x3a77c7?{'count':_0x34d0bf,'rows':_0x3a77c7}:null;}})['then'](respondWithResult(_0x27fbdf,null))['catch'](handleError(_0x27fbdf,null));};exports[_0x2041('0x51')]=function(_0x12daa8,_0x1793ee,_0x37a746){var _0xda6b68={};var _0x5bedde={};var _0x259fc3;var _0x8c14be;return db[_0x2041('0x29')]['findOne']({'where':{'id':_0x12daa8[_0x2041('0x4a')]['id']}})[_0x2041('0x25')](handleEntityNotFound(_0x1793ee,null))[_0x2041('0x25')](function(_0x4095fa){if(_0x4095fa){_0x259fc3=_0x4095fa;_0x5bedde['model']=_[_0x2041('0x44')](db[_0x2041('0x52')][_0x2041('0x2a')]);_0x5bedde[_0x2041('0x2e')]=_[_0x2041('0x44')](_0x12daa8[_0x2041('0x2e')]);_0x5bedde[_0x2041('0x36')]=_[_0x2041('0x2f')](_0x5bedde[_0x2041('0x2c')],_0x5bedde[_0x2041('0x2e')]);_0xda6b68[_0x2041('0x31')]=_['intersection'](_0x5bedde[_0x2041('0x2c')],qs[_0x2041('0x30')](_0x12daa8[_0x2041('0x2e')][_0x2041('0x30')]));_0xda6b68[_0x2041('0x31')]=_0xda6b68[_0x2041('0x31')][_0x2041('0x32')]?_0xda6b68[_0x2041('0x31')]:_0x5bedde[_0x2041('0x2c')];_0xda6b68[_0x2041('0x34')]=qs[_0x2041('0x35')](_0x12daa8['query'][_0x2041('0x35')]);_0xda6b68[_0x2041('0x39')]=qs[_0x2041('0x36')](_[_0x2041('0x37')](_0x12daa8[_0x2041('0x2e')],_0x5bedde[_0x2041('0x36')]));if(_0x12daa8[_0x2041('0x2e')][_0x2041('0x38')]){_0xda6b68[_0x2041('0x39')]=_[_0x2041('0x3a')](_0xda6b68[_0x2041('0x39')],{'$or':_[_0x2041('0x3b')](_0xda6b68[_0x2041('0x31')],function(_0x5d7a5e){var _0x21c9fb={};_0x21c9fb[_0x5d7a5e]={'$like':'%'+_0x12daa8[_0x2041('0x2e')][_0x2041('0x38')]+'%'};return _0x21c9fb;})});}_0xda6b68=_[_0x2041('0x3a')]({},_0xda6b68,_0x12daa8['options']);return _0x259fc3['getTags'](_0xda6b68);}})[_0x2041('0x25')](function(_0x20b5d3){if(_0x20b5d3){_0x8c14be=_0x20b5d3[_0x2041('0x32')];if(!_0x12daa8[_0x2041('0x2e')]['hasOwnProperty']('nolimit')){_0xda6b68['limit']=qs[_0x2041('0x1e')](_0x12daa8[_0x2041('0x2e')][_0x2041('0x1e')]);_0xda6b68[_0x2041('0x1b')]=qs[_0x2041('0x1b')](_0x12daa8[_0x2041('0x2e')][_0x2041('0x1b')]);}return _0x259fc3['getTags'](_0xda6b68);}})['then'](function(_0x3a034a){if(_0x3a034a){return _0x3a034a?{'count':_0x8c14be,'rows':_0x3a034a}:null;}})[_0x2041('0x25')](respondWithResult(_0x1793ee,null))[_0x2041('0x42')](handleError(_0x1793ee,null));};exports[_0x2041('0x53')]=function(_0x21b010,_0x24c21a,_0x5b8bb3){if(_0x21b010[_0x2041('0x46')]['id']){delete _0x21b010[_0x2041('0x46')]['id'];}return db[_0x2041('0x29')][_0x2041('0x4b')]({'where':{'id':_0x21b010[_0x2041('0x4a')]['id']}})[_0x2041('0x25')](handleEntityNotFound(_0x24c21a,null))[_0x2041('0x25')](function(_0x24035b){if(_0x24035b){return _0x24035b[_0x2041('0x53')](_0x21b010[_0x2041('0x46')]['ids']||[]);}return null;})['then'](respondWithResult(_0x24c21a,null))[_0x2041('0x42')](handleError(_0x24c21a,null));}; \ No newline at end of file +var _0x60ad=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','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','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','name','index','FreshdeskConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','show','params','intersection','includeAll','find','catch','create','update','body','FreshdeskField','order','pick','findOne','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xedd155,_0x2f2571){var _0x51d28b=function(_0xfc0dcf){while(--_0xfc0dcf){_0xedd155['push'](_0xedd155['shift']());}};_0x51d28b(++_0x2f2571);}(_0x60ad,0x1ee));var _0xd60a=function(_0x5c4a08,_0x496991){_0x5c4a08=_0x5c4a08-0x0;var _0x20ba74=_0x60ad[_0x5c4a08];return _0x20ba74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd60a('0x0'));var zipdir=require(_0xd60a('0x1'));var jsonpatch=require(_0xd60a('0x2'));var rp=require(_0xd60a('0x3'));var moment=require('moment');var BPromise=require(_0xd60a('0x4'));var Mustache=require(_0xd60a('0x5'));var util=require(_0xd60a('0x6'));var path=require(_0xd60a('0x7'));var sox=require(_0xd60a('0x8'));var csv=require(_0xd60a('0x9'));var ejs=require(_0xd60a('0xa'));var fs=require('fs');var fs_extra=require(_0xd60a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd60a('0xc'));var jsforce=require(_0xd60a('0xd'));var deskjs=require(_0xd60a('0xe'));var toCsv=require(_0xd60a('0x9'));var querystring=require('querystring');var Papa=require(_0xd60a('0xf'));var Redis=require(_0xd60a('0x10'));var authService=require(_0xd60a('0x11'));var qs=require(_0xd60a('0x12'));var as=require(_0xd60a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd60a('0x14'))(_0xd60a('0x15'));var utils=require(_0xd60a('0x16'));var config=require(_0xd60a('0x17'));var licenseUtil=require(_0xd60a('0x18'));var db=require(_0xd60a('0x19'))['db'];function respondWithStatusCode(_0x5d67d0,_0xf0becc){_0xf0becc=_0xf0becc||0xcc;return function(_0x25b873){if(_0x25b873){return _0x5d67d0['sendStatus'](_0xf0becc);}return _0x5d67d0[_0xd60a('0x1a')](_0xf0becc)[_0xd60a('0x1b')]();};}function respondWithResult(_0x37b278,_0x5a86d0){_0x5a86d0=_0x5a86d0||0xc8;return function(_0x4fea1a){if(_0x4fea1a){return _0x37b278[_0xd60a('0x1a')](_0x5a86d0)[_0xd60a('0x1c')](_0x4fea1a);}};}function respondWithFilteredResult(_0x388068,_0x3b17a9){return function(_0x54a2fc){if(_0x54a2fc){var _0x3035ad=typeof _0x3b17a9[_0xd60a('0x1d')]===_0xd60a('0x1e')&&typeof _0x3b17a9[_0xd60a('0x1f')]==='undefined';var _0x24b09e=_0x54a2fc[_0xd60a('0x20')];var _0x3ad6a7=_0x3035ad?0x0:_0x3b17a9['offset'];var _0x1dc36d=_0x3035ad?_0x54a2fc[_0xd60a('0x20')]:_0x3b17a9[_0xd60a('0x1d')]+_0x3b17a9[_0xd60a('0x1f')];var _0xd377c5;if(_0x1dc36d>=_0x24b09e){_0x1dc36d=_0x24b09e;_0xd377c5=0xc8;}else{_0xd377c5=0xce;}_0x388068[_0xd60a('0x1a')](_0xd377c5);return _0x388068['set'](_0xd60a('0x21'),_0x3ad6a7+'-'+_0x1dc36d+'/'+_0x24b09e)[_0xd60a('0x1c')](_0x54a2fc);}return null;};}function patchUpdates(_0x9f9cb2){return function(_0x315a13){try{jsonpatch[_0xd60a('0x22')](_0x315a13,_0x9f9cb2,!![]);}catch(_0x1b0c4f){return BPromise[_0xd60a('0x23')](_0x1b0c4f);}return _0x315a13[_0xd60a('0x24')]();};}function saveUpdates(_0x562c72,_0x32818a){return function(_0x470d93){if(_0x470d93){return _0x470d93['update'](_0x562c72)[_0xd60a('0x25')](function(_0x3fc5d7){return _0x3fc5d7;});}return null;};}function removeEntity(_0x504db1,_0x1bf35a){return function(_0x3ffe12){if(_0x3ffe12){return _0x3ffe12[_0xd60a('0x26')]()[_0xd60a('0x25')](function(){_0x504db1[_0xd60a('0x1a')](0xcc)[_0xd60a('0x1b')]();});}};}function handleEntityNotFound(_0x375d10,_0x3b5457){return function(_0x3e5108){if(!_0x3e5108){_0x375d10[_0xd60a('0x27')](0x194);}return _0x3e5108;};}function handleError(_0x1c25fa,_0x539f9d){_0x539f9d=_0x539f9d||0x1f4;return function(_0x52d4af){logger['error'](_0x52d4af['stack']);if(_0x52d4af[_0xd60a('0x28')]){delete _0x52d4af[_0xd60a('0x28')];}_0x1c25fa[_0xd60a('0x1a')](_0x539f9d)['send'](_0x52d4af);};}exports[_0xd60a('0x29')]=function(_0x36dce6,_0x1777b1){var _0x38e8b3={},_0x317f6f={},_0x431702={'count':0x0,'rows':[]};var _0x3c39ab=_['map'](db[_0xd60a('0x2a')][_0xd60a('0x2b')],function(_0xe198af){return{'name':_0xe198af[_0xd60a('0x2c')],'type':_0xe198af['type'][_0xd60a('0x2d')]};});_0x317f6f[_0xd60a('0x2e')]=_[_0xd60a('0x2f')](_0x3c39ab,_0xd60a('0x28'));_0x317f6f['query']=_[_0xd60a('0x30')](_0x36dce6[_0xd60a('0x31')]);_0x317f6f[_0xd60a('0x32')]=_['intersection'](_0x317f6f[_0xd60a('0x2e')],_0x317f6f[_0xd60a('0x31')]);_0x38e8b3['attributes']=_['intersection'](_0x317f6f[_0xd60a('0x2e')],qs[_0xd60a('0x33')](_0x36dce6['query'][_0xd60a('0x33')]));_0x38e8b3[_0xd60a('0x34')]=_0x38e8b3['attributes'][_0xd60a('0x35')]?_0x38e8b3[_0xd60a('0x34')]:_0x317f6f['model'];if(!_0x36dce6[_0xd60a('0x31')][_0xd60a('0x36')](_0xd60a('0x37'))){_0x38e8b3[_0xd60a('0x1f')]=qs[_0xd60a('0x1f')](_0x36dce6['query'][_0xd60a('0x1f')]);_0x38e8b3[_0xd60a('0x1d')]=qs[_0xd60a('0x1d')](_0x36dce6['query']['offset']);}_0x38e8b3['order']=qs[_0xd60a('0x38')](_0x36dce6[_0xd60a('0x31')][_0xd60a('0x38')]);_0x38e8b3[_0xd60a('0x39')]=qs['filters'](_['pick'](_0x36dce6[_0xd60a('0x31')],_0x317f6f[_0xd60a('0x32')]),_0x3c39ab);if(_0x36dce6[_0xd60a('0x31')][_0xd60a('0x3a')]){_0x38e8b3[_0xd60a('0x39')]=_[_0xd60a('0x3b')](_0x38e8b3[_0xd60a('0x39')],{'$or':_[_0xd60a('0x2f')](_0x3c39ab,function(_0x5826b8){if(_0x5826b8[_0xd60a('0x3c')]!==_0xd60a('0x3d')){var _0xdabcd2={};_0xdabcd2[_0x5826b8['name']]={'$like':'%'+_0x36dce6[_0xd60a('0x31')][_0xd60a('0x3a')]+'%'};return _0xdabcd2;}})});}_0x38e8b3=_['merge']({},_0x38e8b3,_0x36dce6[_0xd60a('0x3e')]);var _0x2c53bf={'where':_0x38e8b3['where']};return db[_0xd60a('0x2a')][_0xd60a('0x20')](_0x2c53bf)['then'](function(_0x42fce2){_0x431702['count']=_0x42fce2;if(_0x36dce6[_0xd60a('0x31')]['includeAll']){_0x38e8b3[_0xd60a('0x3f')]=[{'all':!![]}];}return db[_0xd60a('0x2a')][_0xd60a('0x40')](_0x38e8b3);})[_0xd60a('0x25')](function(_0x5ea004){_0x431702['rows']=_0x5ea004;return _0x431702;})[_0xd60a('0x25')](respondWithFilteredResult(_0x1777b1,_0x38e8b3))['catch'](handleError(_0x1777b1,null));};exports[_0xd60a('0x41')]=function(_0x4a5ff3,_0x2d3888){var _0x334a86={'raw':![],'where':{'id':_0x4a5ff3[_0xd60a('0x42')]['id']}},_0x1e8de0={};_0x1e8de0[_0xd60a('0x2e')]=_['keys'](db[_0xd60a('0x2a')][_0xd60a('0x2b')]);_0x1e8de0['query']=_[_0xd60a('0x30')](_0x4a5ff3[_0xd60a('0x31')]);_0x1e8de0[_0xd60a('0x32')]=_[_0xd60a('0x43')](_0x1e8de0[_0xd60a('0x2e')],_0x1e8de0[_0xd60a('0x31')]);_0x334a86[_0xd60a('0x34')]=_[_0xd60a('0x43')](_0x1e8de0[_0xd60a('0x2e')],qs[_0xd60a('0x33')](_0x4a5ff3[_0xd60a('0x31')][_0xd60a('0x33')]));_0x334a86[_0xd60a('0x34')]=_0x334a86[_0xd60a('0x34')][_0xd60a('0x35')]?_0x334a86[_0xd60a('0x34')]:_0x1e8de0[_0xd60a('0x2e')];if(_0x4a5ff3['query'][_0xd60a('0x44')]){_0x334a86[_0xd60a('0x3f')]=[{'all':!![]}];}_0x334a86=_['merge']({},_0x334a86,_0x4a5ff3[_0xd60a('0x3e')]);return db[_0xd60a('0x2a')][_0xd60a('0x45')](_0x334a86)[_0xd60a('0x25')](handleEntityNotFound(_0x2d3888,null))[_0xd60a('0x25')](respondWithResult(_0x2d3888,null))[_0xd60a('0x46')](handleError(_0x2d3888,null));};exports[_0xd60a('0x47')]=function(_0x41cc47,_0x3654c1){return db[_0xd60a('0x2a')][_0xd60a('0x47')](_0x41cc47['body'],{})['then'](respondWithResult(_0x3654c1,0xc9))['catch'](handleError(_0x3654c1,null));};exports[_0xd60a('0x48')]=function(_0x34f4d7,_0x5886bb){if(_0x34f4d7[_0xd60a('0x49')]['id']){delete _0x34f4d7[_0xd60a('0x49')]['id'];}return db[_0xd60a('0x2a')][_0xd60a('0x45')]({'where':{'id':_0x34f4d7['params']['id']}})[_0xd60a('0x25')](handleEntityNotFound(_0x5886bb,null))[_0xd60a('0x25')](saveUpdates(_0x34f4d7[_0xd60a('0x49')],null))[_0xd60a('0x25')](respondWithResult(_0x5886bb,null))[_0xd60a('0x46')](handleError(_0x5886bb,null));};exports[_0xd60a('0x26')]=function(_0x3f16b8,_0x3dbaf0){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x3f16b8[_0xd60a('0x42')]['id']}})[_0xd60a('0x25')](handleEntityNotFound(_0x3dbaf0,null))['then'](removeEntity(_0x3dbaf0,null))['catch'](handleError(_0x3dbaf0,null));};exports['getFields']=function(_0x2566eb,_0x330bf7,_0x4785eb){var _0x448b91={};var _0x1d9e57={};var _0x7ec49;var _0x585559;return db[_0xd60a('0x2a')]['findOne']({'where':{'id':_0x2566eb['params']['id']}})[_0xd60a('0x25')](handleEntityNotFound(_0x330bf7,null))['then'](function(_0x193d95){if(_0x193d95){_0x7ec49=_0x193d95;_0x1d9e57['model']=_[_0xd60a('0x30')](db[_0xd60a('0x4a')]['rawAttributes']);_0x1d9e57[_0xd60a('0x31')]=_['keys'](_0x2566eb['query']);_0x1d9e57[_0xd60a('0x32')]=_[_0xd60a('0x43')](_0x1d9e57[_0xd60a('0x2e')],_0x1d9e57[_0xd60a('0x31')]);_0x448b91[_0xd60a('0x34')]=_[_0xd60a('0x43')](_0x1d9e57[_0xd60a('0x2e')],qs[_0xd60a('0x33')](_0x2566eb[_0xd60a('0x31')][_0xd60a('0x33')]));_0x448b91[_0xd60a('0x34')]=_0x448b91['attributes']['length']?_0x448b91[_0xd60a('0x34')]:_0x1d9e57[_0xd60a('0x2e')];_0x448b91[_0xd60a('0x4b')]=qs[_0xd60a('0x38')](_0x2566eb['query'][_0xd60a('0x38')]);_0x448b91[_0xd60a('0x39')]=qs[_0xd60a('0x32')](_[_0xd60a('0x4c')](_0x2566eb[_0xd60a('0x31')],_0x1d9e57['filters']));if(_0x2566eb['query']['filter']){_0x448b91[_0xd60a('0x39')]=_[_0xd60a('0x3b')](_0x448b91[_0xd60a('0x39')],{'$or':_['map'](_0x448b91['attributes'],function(_0xbf027c){var _0x4d1bf0={};_0x4d1bf0[_0xbf027c]={'$like':'%'+_0x2566eb[_0xd60a('0x31')][_0xd60a('0x3a')]+'%'};return _0x4d1bf0;})});}_0x448b91=_[_0xd60a('0x3b')]({},_0x448b91,_0x2566eb[_0xd60a('0x3e')]);return _0x7ec49['getFields'](_0x448b91);}})[_0xd60a('0x25')](function(_0x519956){if(_0x519956){_0x585559=_0x519956[_0xd60a('0x35')];if(!_0x2566eb[_0xd60a('0x31')]['hasOwnProperty']('nolimit')){_0x448b91['limit']=qs[_0xd60a('0x1f')](_0x2566eb[_0xd60a('0x31')][_0xd60a('0x1f')]);_0x448b91[_0xd60a('0x1d')]=qs[_0xd60a('0x1d')](_0x2566eb[_0xd60a('0x31')][_0xd60a('0x1d')]);}return _0x7ec49['getFields'](_0x448b91);}})[_0xd60a('0x25')](function(_0x4f48fc){if(_0x4f48fc){return _0x4f48fc?{'count':_0x585559,'rows':_0x4f48fc}:null;}})[_0xd60a('0x25')](respondWithResult(_0x330bf7,null))[_0xd60a('0x46')](handleError(_0x330bf7,null));};exports['getSubjects']=function(_0x4a3568,_0x5aab7c,_0x4c4092){var _0xbd1b4={};var _0x29b8ff={};var _0x2c7b87;var _0x2cee51;return db[_0xd60a('0x2a')][_0xd60a('0x4d')]({'where':{'id':_0x4a3568['params']['id']}})[_0xd60a('0x25')](handleEntityNotFound(_0x5aab7c,null))[_0xd60a('0x25')](function(_0x5c48a0){if(_0x5c48a0){_0x2c7b87=_0x5c48a0;_0x29b8ff[_0xd60a('0x2e')]=_[_0xd60a('0x30')](db[_0xd60a('0x4a')]['rawAttributes']);_0x29b8ff[_0xd60a('0x31')]=_[_0xd60a('0x30')](_0x4a3568[_0xd60a('0x31')]);_0x29b8ff[_0xd60a('0x32')]=_[_0xd60a('0x43')](_0x29b8ff[_0xd60a('0x2e')],_0x29b8ff[_0xd60a('0x31')]);_0xbd1b4['attributes']=_[_0xd60a('0x43')](_0x29b8ff['model'],qs['fields'](_0x4a3568[_0xd60a('0x31')]['fields']));_0xbd1b4[_0xd60a('0x34')]=_0xbd1b4['attributes'][_0xd60a('0x35')]?_0xbd1b4[_0xd60a('0x34')]:_0x29b8ff[_0xd60a('0x2e')];_0xbd1b4[_0xd60a('0x4b')]=qs[_0xd60a('0x38')](_0x4a3568[_0xd60a('0x31')][_0xd60a('0x38')]);_0xbd1b4[_0xd60a('0x39')]=qs[_0xd60a('0x32')](_[_0xd60a('0x4c')](_0x4a3568['query'],_0x29b8ff[_0xd60a('0x32')]));if(_0x4a3568[_0xd60a('0x31')][_0xd60a('0x3a')]){_0xbd1b4['where']=_[_0xd60a('0x3b')](_0xbd1b4[_0xd60a('0x39')],{'$or':_[_0xd60a('0x2f')](_0xbd1b4[_0xd60a('0x34')],function(_0x50bef4){var _0x71f8da={};_0x71f8da[_0x50bef4]={'$like':'%'+_0x4a3568[_0xd60a('0x31')][_0xd60a('0x3a')]+'%'};return _0x71f8da;})});}_0xbd1b4=_[_0xd60a('0x3b')]({},_0xbd1b4,_0x4a3568[_0xd60a('0x3e')]);return _0x2c7b87['getSubjects'](_0xbd1b4);}})[_0xd60a('0x25')](function(_0x262660){if(_0x262660){_0x2cee51=_0x262660[_0xd60a('0x35')];if(!_0x4a3568[_0xd60a('0x31')]['hasOwnProperty'](_0xd60a('0x37'))){_0xbd1b4['limit']=qs[_0xd60a('0x1f')](_0x4a3568['query']['limit']);_0xbd1b4['offset']=qs[_0xd60a('0x1d')](_0x4a3568[_0xd60a('0x31')]['offset']);}return _0x2c7b87[_0xd60a('0x4e')](_0xbd1b4);}})[_0xd60a('0x25')](function(_0x2f2e1a){if(_0x2f2e1a){return _0x2f2e1a?{'count':_0x2cee51,'rows':_0x2f2e1a}:null;}})[_0xd60a('0x25')](respondWithResult(_0x5aab7c,null))[_0xd60a('0x46')](handleError(_0x5aab7c,null));};exports[_0xd60a('0x4f')]=function(_0xc1f00c,_0x14412f,_0x42a8ce){var _0x273778={};var _0x40889e={};var _0x1adaee;var _0x100b3d;return db[_0xd60a('0x2a')][_0xd60a('0x4d')]({'where':{'id':_0xc1f00c[_0xd60a('0x42')]['id']}})[_0xd60a('0x25')](handleEntityNotFound(_0x14412f,null))[_0xd60a('0x25')](function(_0x10d19b){if(_0x10d19b){_0x1adaee=_0x10d19b;_0x40889e[_0xd60a('0x2e')]=_[_0xd60a('0x30')](db[_0xd60a('0x4a')]['rawAttributes']);_0x40889e[_0xd60a('0x31')]=_[_0xd60a('0x30')](_0xc1f00c[_0xd60a('0x31')]);_0x40889e[_0xd60a('0x32')]=_[_0xd60a('0x43')](_0x40889e[_0xd60a('0x2e')],_0x40889e[_0xd60a('0x31')]);_0x273778['attributes']=_['intersection'](_0x40889e[_0xd60a('0x2e')],qs[_0xd60a('0x33')](_0xc1f00c[_0xd60a('0x31')][_0xd60a('0x33')]));_0x273778[_0xd60a('0x34')]=_0x273778[_0xd60a('0x34')][_0xd60a('0x35')]?_0x273778['attributes']:_0x40889e[_0xd60a('0x2e')];_0x273778[_0xd60a('0x4b')]=qs[_0xd60a('0x38')](_0xc1f00c[_0xd60a('0x31')]['sort']);_0x273778[_0xd60a('0x39')]=qs[_0xd60a('0x32')](_['pick'](_0xc1f00c[_0xd60a('0x31')],_0x40889e[_0xd60a('0x32')]));if(_0xc1f00c[_0xd60a('0x31')][_0xd60a('0x3a')]){_0x273778[_0xd60a('0x39')]=_[_0xd60a('0x3b')](_0x273778['where'],{'$or':_[_0xd60a('0x2f')](_0x273778[_0xd60a('0x34')],function(_0x2adb0d){var _0x14720b={};_0x14720b[_0x2adb0d]={'$like':'%'+_0xc1f00c[_0xd60a('0x31')][_0xd60a('0x3a')]+'%'};return _0x14720b;})});}_0x273778=_[_0xd60a('0x3b')]({},_0x273778,_0xc1f00c[_0xd60a('0x3e')]);return _0x1adaee['getDescriptions'](_0x273778);}})[_0xd60a('0x25')](function(_0x5876e4){if(_0x5876e4){_0x100b3d=_0x5876e4[_0xd60a('0x35')];if(!_0xc1f00c[_0xd60a('0x31')][_0xd60a('0x36')](_0xd60a('0x37'))){_0x273778[_0xd60a('0x1f')]=qs['limit'](_0xc1f00c[_0xd60a('0x31')][_0xd60a('0x1f')]);_0x273778[_0xd60a('0x1d')]=qs[_0xd60a('0x1d')](_0xc1f00c[_0xd60a('0x31')][_0xd60a('0x1d')]);}return _0x1adaee[_0xd60a('0x4f')](_0x273778);}})[_0xd60a('0x25')](function(_0x2ee900){if(_0x2ee900){return _0x2ee900?{'count':_0x100b3d,'rows':_0x2ee900}:null;}})[_0xd60a('0x25')](respondWithResult(_0x14412f,null))[_0xd60a('0x46')](handleError(_0x14412f,null));};exports[_0xd60a('0x50')]=function(_0x172531,_0xe05745,_0x3b7fa4){var _0x40ceba={};var _0x5fdbc6={};var _0xf3520e;var _0x2a8f92;return db[_0xd60a('0x2a')]['findOne']({'where':{'id':_0x172531[_0xd60a('0x42')]['id']}})[_0xd60a('0x25')](handleEntityNotFound(_0xe05745,null))[_0xd60a('0x25')](function(_0x4f6e0e){if(_0x4f6e0e){_0xf3520e=_0x4f6e0e;_0x5fdbc6[_0xd60a('0x2e')]=_['keys'](db['Tag'][_0xd60a('0x2b')]);_0x5fdbc6[_0xd60a('0x31')]=_[_0xd60a('0x30')](_0x172531[_0xd60a('0x31')]);_0x5fdbc6[_0xd60a('0x32')]=_[_0xd60a('0x43')](_0x5fdbc6[_0xd60a('0x2e')],_0x5fdbc6['query']);_0x40ceba[_0xd60a('0x34')]=_[_0xd60a('0x43')](_0x5fdbc6[_0xd60a('0x2e')],qs[_0xd60a('0x33')](_0x172531[_0xd60a('0x31')][_0xd60a('0x33')]));_0x40ceba[_0xd60a('0x34')]=_0x40ceba['attributes'][_0xd60a('0x35')]?_0x40ceba[_0xd60a('0x34')]:_0x5fdbc6[_0xd60a('0x2e')];_0x40ceba[_0xd60a('0x4b')]=qs[_0xd60a('0x38')](_0x172531[_0xd60a('0x31')]['sort']);_0x40ceba[_0xd60a('0x39')]=qs[_0xd60a('0x32')](_[_0xd60a('0x4c')](_0x172531[_0xd60a('0x31')],_0x5fdbc6[_0xd60a('0x32')]));if(_0x172531[_0xd60a('0x31')][_0xd60a('0x3a')]){_0x40ceba[_0xd60a('0x39')]=_['merge'](_0x40ceba[_0xd60a('0x39')],{'$or':_[_0xd60a('0x2f')](_0x40ceba[_0xd60a('0x34')],function(_0x4f77e0){var _0x4036d6={};_0x4036d6[_0x4f77e0]={'$like':'%'+_0x172531[_0xd60a('0x31')][_0xd60a('0x3a')]+'%'};return _0x4036d6;})});}_0x40ceba=_['merge']({},_0x40ceba,_0x172531[_0xd60a('0x3e')]);return _0xf3520e[_0xd60a('0x50')](_0x40ceba);}})[_0xd60a('0x25')](function(_0x311e77){if(_0x311e77){_0x2a8f92=_0x311e77['length'];if(!_0x172531[_0xd60a('0x31')][_0xd60a('0x36')](_0xd60a('0x37'))){_0x40ceba[_0xd60a('0x1f')]=qs[_0xd60a('0x1f')](_0x172531['query'][_0xd60a('0x1f')]);_0x40ceba[_0xd60a('0x1d')]=qs['offset'](_0x172531['query']['offset']);}return _0xf3520e['getTags'](_0x40ceba);}})[_0xd60a('0x25')](function(_0x185047){if(_0x185047){return _0x185047?{'count':_0x2a8f92,'rows':_0x185047}:null;}})[_0xd60a('0x25')](respondWithResult(_0xe05745,null))['catch'](handleError(_0xe05745,null));};exports[_0xd60a('0x51')]=function(_0x249b3c,_0x5a2773,_0x37708e){if(_0x249b3c[_0xd60a('0x49')]['id']){delete _0x249b3c['body']['id'];}return db[_0xd60a('0x2a')]['findOne']({'where':{'id':_0x249b3c[_0xd60a('0x42')]['id']}})[_0xd60a('0x25')](handleEntityNotFound(_0x5a2773,null))[_0xd60a('0x25')](function(_0x341513){if(_0x341513){return _0x341513[_0xd60a('0x51')](_0x249b3c[_0xd60a('0x49')][_0xd60a('0x52')]||[]);}return null;})[_0xd60a('0x25')](respondWithResult(_0x5a2773,null))[_0xd60a('0x46')](handleError(_0x5a2773,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e2c5010..2f6d209 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 _0x427b=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api','moment','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x5a203e,_0x3b421b){var _0x3a8eb0=function(_0x6f325c){while(--_0x6f325c){_0x5a203e['push'](_0x5a203e['shift']());}};_0x3a8eb0(++_0x3b421b);}(_0x427b,0x7b));var _0xb427=function(_0xca5b33,_0x58c01a){_0xca5b33=_0xca5b33-0x0;var _0x31de30=_0x427b[_0xca5b33];return _0x31de30;};'use strict';var _=require(_0xb427('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb427('0x1'));var moment=require(_0xb427('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb427('0x3'));var rimraf=require('rimraf');var config=require(_0xb427('0x4'));var attributes=require(_0xb427('0x5'));module[_0xb427('0x6')]=function(_0x290085,_0x26d174){return _0x290085[_0xb427('0x7')](_0xb427('0x8'),attributes,{'tableName':_0xb427('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc363=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x54e5fd,_0x10232e){var _0x39f2c8=function(_0xf636c6){while(--_0xf636c6){_0x54e5fd['push'](_0x54e5fd['shift']());}};_0x39f2c8(++_0x10232e);}(_0xc363,0x140));var _0x3c36=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0xc363[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x3c36('0x0'));var util=require(_0x3c36('0x1'));var logger=require('../../config/logger')(_0x3c36('0x2'));var moment=require(_0x3c36('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c36('0x4'));var fs=require('fs');var path=require(_0x3c36('0x5'));var rimraf=require(_0x3c36('0x6'));var config=require(_0x3c36('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x3c36('0x8')]=function(_0x674bf1,_0xffdb21){return _0x674bf1[_0x3c36('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 1e7be6b..5fe78f0 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 _0x4449=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xf8b795,_0x42822f){var _0x3f6145=function(_0x18b59b){while(--_0x18b59b){_0xf8b795['push'](_0xf8b795['shift']());}};_0x3f6145(++_0x42822f);}(_0x4449,0x17d));var _0x9444=function(_0x4bb0a3,_0x567b8f){_0x4bb0a3=_0x4bb0a3-0x0;var _0x187b1d=_0x4449[_0x4bb0a3];return _0x187b1d;};'use strict';var _=require(_0x9444('0x0'));var util=require(_0x9444('0x1'));var moment=require(_0x9444('0x2'));var BPromise=require(_0x9444('0x3'));var rs=require(_0x9444('0x4'));var fs=require('fs');var Redis=require(_0x9444('0x5'));var db=require(_0x9444('0x6'))['db'];var utils=require(_0x9444('0x7'));var logger=require(_0x9444('0x8'))(_0x9444('0x9'));var config=require(_0x9444('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9444('0xb')][_0x9444('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x254300,_0x5d8b48,_0x184030){return new BPromise(function(_0x4a882b,_0xaff19c){return client[_0x9444('0xd')](_0x254300,_0x184030)[_0x9444('0xe')](function(_0x2aa03b){logger['info'](_0x9444('0xf'),_0x5d8b48,_0x9444('0x10'));logger[_0x9444('0x11')](_0x9444('0x12'),_0x5d8b48,_0x9444('0x10'),JSON[_0x9444('0x13')](_0x2aa03b));if(_0x2aa03b[_0x9444('0x14')]){if(_0x2aa03b[_0x9444('0x14')][_0x9444('0x15')]===0x1f4){logger[_0x9444('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5d8b48,_0x2aa03b[_0x9444('0x14')][_0x9444('0x16')]);return _0xaff19c(_0x2aa03b['error'][_0x9444('0x16')]);}logger[_0x9444('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5d8b48,_0x2aa03b[_0x9444('0x14')][_0x9444('0x16')]);return _0x4a882b(_0x2aa03b['error'][_0x9444('0x16')]);}else{logger['info'](_0x9444('0xf'),_0x5d8b48,_0x9444('0x10'));_0x4a882b(_0x2aa03b['result'][_0x9444('0x16')]);}})[_0x9444('0x17')](function(_0x23a25b){logger[_0x9444('0x14')](_0x9444('0xf'),_0x5d8b48,_0x23a25b);_0xaff19c(_0x23a25b);});});} \ No newline at end of file +var _0xb2cf=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0xb2cf,0xd3));var _0xfb2c=function(_0x8b8707,_0x2520db){_0x8b8707=_0x8b8707-0x0;var _0x3e2d7d=_0xb2cf[_0x8b8707];return _0x3e2d7d;};'use strict';var _=require(_0xfb2c('0x0'));var util=require(_0xfb2c('0x1'));var moment=require(_0xfb2c('0x2'));var BPromise=require(_0xfb2c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb2c('0x5'));var logger=require(_0xfb2c('0x6'))(_0xfb2c('0x7'));var config=require(_0xfb2c('0x8'));var jayson=require(_0xfb2c('0x9'));var client=jayson[_0xfb2c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf7da5f,_0x1da968,_0x189ed0){return new BPromise(function(_0x2a3357,_0x434ff1){return client['request'](_0xf7da5f,_0x189ed0)[_0xfb2c('0xb')](function(_0x8573df){logger['info'](_0xfb2c('0xc'),_0x1da968,_0xfb2c('0xd'));logger['debug'](_0xfb2c('0xe'),_0x1da968,_0xfb2c('0xd'),JSON[_0xfb2c('0xf')](_0x8573df));if(_0x8573df[_0xfb2c('0x10')]){if(_0x8573df[_0xfb2c('0x10')]['code']===0x1f4){logger[_0xfb2c('0x10')](_0xfb2c('0xc'),_0x1da968,_0x8573df['error'][_0xfb2c('0x11')]);return _0x434ff1(_0x8573df[_0xfb2c('0x10')][_0xfb2c('0x11')]);}logger['error'](_0xfb2c('0xc'),_0x1da968,_0x8573df[_0xfb2c('0x10')]['message']);return _0x2a3357(_0x8573df['error'][_0xfb2c('0x11')]);}else{logger[_0xfb2c('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1da968,_0xfb2c('0xd'));_0x2a3357(_0x8573df[_0xfb2c('0x13')][_0xfb2c('0x11')]);}})[_0xfb2c('0x14')](function(_0x2886a2){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1da968,_0x2886a2);_0x434ff1(_0x2886a2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f346ac6..d4f58f8 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 _0x3f23=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f23,0x11b));var _0x33f2=function(_0x2e1329,_0x419262){_0x2e1329=_0x2e1329-0x0;var _0x2b2de4=_0x3f23[_0x2e1329];return _0x2b2de4;};'use strict';var multer=require(_0x33f2('0x0'));var util=require(_0x33f2('0x1'));var path=require('path');var timeout=require(_0x33f2('0x2'));var express=require(_0x33f2('0x3'));var router=express[_0x33f2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x33f2('0x5'));var config=require(_0x33f2('0x6'));var controller=require(_0x33f2('0x7'));router[_0x33f2('0x8')]('/',auth['isAuthenticated'](),controller[_0x33f2('0x9')]);router[_0x33f2('0x8')](_0x33f2('0xa'),auth[_0x33f2('0xb')](),controller[_0x33f2('0xc')]);router[_0x33f2('0xd')]('/',auth[_0x33f2('0xb')](),controller[_0x33f2('0xe')]);router[_0x33f2('0xf')]('/:id',auth[_0x33f2('0xb')](),controller[_0x33f2('0x10')]);router['delete'](_0x33f2('0xa'),auth[_0x33f2('0xb')](),controller[_0x33f2('0x11')]);module[_0x33f2('0x12')]=router; \ No newline at end of file +var _0x66c8=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports','multer','path'];(function(_0x1b5ed1,_0x1899f4){var _0xfb3953=function(_0xc8e2eb){while(--_0xc8e2eb){_0x1b5ed1['push'](_0x1b5ed1['shift']());}};_0xfb3953(++_0x1899f4);}(_0x66c8,0x1c9));var _0x866c=function(_0x444315,_0x46ce81){_0x444315=_0x444315-0x0;var _0x4985c2=_0x66c8[_0x444315];return _0x4985c2;};'use strict';var multer=require(_0x866c('0x0'));var util=require('util');var path=require(_0x866c('0x1'));var timeout=require('connect-timeout');var express=require(_0x866c('0x2'));var router=express['Router']();var fs_extra=require(_0x866c('0x3'));var auth=require(_0x866c('0x4'));var interaction=require(_0x866c('0x5'));var config=require(_0x866c('0x6'));var controller=require(_0x866c('0x7'));router[_0x866c('0x8')]('/',auth[_0x866c('0x9')](),controller[_0x866c('0xa')]);router[_0x866c('0x8')](_0x866c('0xb'),auth['isAuthenticated'](),controller[_0x866c('0xc')]);router['post']('/',auth[_0x866c('0x9')](),controller[_0x866c('0xd')]);router[_0x866c('0xe')](_0x866c('0xb'),auth[_0x866c('0x9')](),controller[_0x866c('0xf')]);router['delete'](_0x866c('0xb'),auth[_0x866c('0x9')](),controller['destroy']);module[_0x866c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a92ae6e..78c9b11 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 _0x25c7=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x10067f,_0x1963e5){var _0x253cf2=function(_0x1fc7a3){while(--_0x1fc7a3){_0x10067f['push'](_0x10067f['shift']());}};_0x253cf2(++_0x1963e5);}(_0x25c7,0x186));var _0x725c=function(_0x46b052,_0x4651ae){_0x46b052=_0x46b052-0x0;var _0x45389b=_0x25c7[_0x46b052];return _0x45389b;};'use strict';var Sequelize=require(_0x725c('0x0'));module[_0x725c('0x1')]={'type':{'type':Sequelize[_0x725c('0x2')](_0x725c('0x3'),_0x725c('0x4'),_0x725c('0x5'),_0x725c('0x6'),_0x725c('0x7')),'defaultValue':_0x725c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x725c('0x2')](_0x725c('0x3'),_0x725c('0x4'),_0x725c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x725c('0x8')]},'nameField':{'type':Sequelize[_0x725c('0x8')]},'customField':{'type':Sequelize[_0x725c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x725c('0x8')]}}; \ No newline at end of file +var _0x6a6f=['STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist'];(function(_0x18474f,_0x51e0f9){var _0xab5297=function(_0x4b2327){while(--_0x4b2327){_0x18474f['push'](_0x18474f['shift']());}};_0xab5297(++_0x51e0f9);}(_0x6a6f,0xfe));var _0xf6a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf6a6('0x0'));module[_0xf6a6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf6a6('0x2'),'variable',_0xf6a6('0x3'),_0xf6a6('0x4'),_0xf6a6('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf6a6('0x6')]},'key':{'type':Sequelize[_0xf6a6('0x6')]},'keyType':{'type':Sequelize[_0xf6a6('0x7')](_0xf6a6('0x2'),_0xf6a6('0x8'),_0xf6a6('0x3'))},'keyContent':{'type':Sequelize[_0xf6a6('0x6')]},'idField':{'type':Sequelize[_0xf6a6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf6a6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6a6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b7d3675..f7c6095 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 _0x2f3a=['status','end','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','name','index','FreshdeskField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x4d200e,_0x4295b9){_0x4d200e=_0x4d200e-0x0;var _0x4ef85f=_0x2f3a[_0x4d200e];return _0x4ef85f;};'use strict';var emlformat=require(_0xa2f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa2f3('0x1'));var rp=require(_0xa2f3('0x2'));var moment=require(_0xa2f3('0x3'));var BPromise=require(_0xa2f3('0x4'));var Mustache=require(_0xa2f3('0x5'));var util=require(_0xa2f3('0x6'));var path=require('path');var sox=require(_0xa2f3('0x7'));var csv=require('to-csv');var ejs=require(_0xa2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xa2f3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2f3('0xa'));var jsforce=require(_0xa2f3('0xb'));var deskjs=require(_0xa2f3('0xc'));var toCsv=require(_0xa2f3('0xd'));var querystring=require('querystring');var Papa=require(_0xa2f3('0xe'));var Redis=require(_0xa2f3('0xf'));var authService=require(_0xa2f3('0x10'));var qs=require(_0xa2f3('0x11'));var as=require(_0xa2f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2f3('0x13'))(_0xa2f3('0x14'));var utils=require('../../config/utils');var config=require(_0xa2f3('0x15'));var licenseUtil=require(_0xa2f3('0x16'));var db=require(_0xa2f3('0x17'))['db'];function respondWithStatusCode(_0x58f6df,_0x6aa8f2){_0x6aa8f2=_0x6aa8f2||0xcc;return function(_0x194281){if(_0x194281){return _0x58f6df[_0xa2f3('0x18')](_0x6aa8f2);}return _0x58f6df[_0xa2f3('0x19')](_0x6aa8f2)[_0xa2f3('0x1a')]();};}function respondWithResult(_0xd4f9db,_0x3907fe){_0x3907fe=_0x3907fe||0xc8;return function(_0x4544d4){if(_0x4544d4){return _0xd4f9db[_0xa2f3('0x19')](_0x3907fe)['json'](_0x4544d4);}};}function respondWithFilteredResult(_0xdc3967,_0x33bf10){return function(_0x74fb58){if(_0x74fb58){var _0x51d297=typeof _0x33bf10[_0xa2f3('0x1b')]===_0xa2f3('0x1c')&&typeof _0x33bf10['limit']==='undefined';var _0xb1fe06=_0x74fb58[_0xa2f3('0x1d')];var _0x2db0d2=_0x51d297?0x0:_0x33bf10[_0xa2f3('0x1b')];var _0x205578=_0x51d297?_0x74fb58[_0xa2f3('0x1d')]:_0x33bf10[_0xa2f3('0x1b')]+_0x33bf10[_0xa2f3('0x1e')];var _0x550d68;if(_0x205578>=_0xb1fe06){_0x205578=_0xb1fe06;_0x550d68=0xc8;}else{_0x550d68=0xce;}_0xdc3967[_0xa2f3('0x19')](_0x550d68);return _0xdc3967[_0xa2f3('0x1f')]('Content-Range',_0x2db0d2+'-'+_0x205578+'/'+_0xb1fe06)['json'](_0x74fb58);}return null;};}function patchUpdates(_0x2f74a0){return function(_0x53af81){try{jsonpatch[_0xa2f3('0x20')](_0x53af81,_0x2f74a0,!![]);}catch(_0x147fb7){return BPromise['reject'](_0x147fb7);}return _0x53af81[_0xa2f3('0x21')]();};}function saveUpdates(_0x3e055d,_0x14d989){return function(_0x2685bb){if(_0x2685bb){return _0x2685bb[_0xa2f3('0x22')](_0x3e055d)[_0xa2f3('0x23')](function(_0x37f8c2){return _0x37f8c2;});}return null;};}function removeEntity(_0xa02908,_0x49a589){return function(_0x81af9b){if(_0x81af9b){return _0x81af9b[_0xa2f3('0x24')]()[_0xa2f3('0x23')](function(){_0xa02908[_0xa2f3('0x19')](0xcc)[_0xa2f3('0x1a')]();});}};}function handleEntityNotFound(_0x2e6332,_0x1be0c1){return function(_0x5347de){if(!_0x5347de){_0x2e6332['sendStatus'](0x194);}return _0x5347de;};}function handleError(_0x2f4248,_0x4319f3){_0x4319f3=_0x4319f3||0x1f4;return function(_0x1dd4ec){logger[_0xa2f3('0x25')](_0x1dd4ec['stack']);if(_0x1dd4ec[_0xa2f3('0x26')]){delete _0x1dd4ec[_0xa2f3('0x26')];}_0x2f4248[_0xa2f3('0x19')](_0x4319f3)['send'](_0x1dd4ec);};}exports[_0xa2f3('0x27')]=function(_0x4ec4ab,_0x1ceea4){var _0x5b868c={},_0x452142={},_0x52f211={'count':0x0,'rows':[]};var _0x46f5c4=_['map'](db[_0xa2f3('0x28')][_0xa2f3('0x29')],function(_0x2e8291){return{'name':_0x2e8291[_0xa2f3('0x2a')],'type':_0x2e8291[_0xa2f3('0x2b')]['key']};});_0x452142[_0xa2f3('0x2c')]=_[_0xa2f3('0x2d')](_0x46f5c4,_0xa2f3('0x26'));_0x452142[_0xa2f3('0x2e')]=_[_0xa2f3('0x2f')](_0x4ec4ab[_0xa2f3('0x2e')]);_0x452142[_0xa2f3('0x30')]=_[_0xa2f3('0x31')](_0x452142[_0xa2f3('0x2c')],_0x452142['query']);_0x5b868c[_0xa2f3('0x32')]=_[_0xa2f3('0x31')](_0x452142[_0xa2f3('0x2c')],qs[_0xa2f3('0x33')](_0x4ec4ab[_0xa2f3('0x2e')]['fields']));_0x5b868c[_0xa2f3('0x32')]=_0x5b868c['attributes']['length']?_0x5b868c[_0xa2f3('0x32')]:_0x452142[_0xa2f3('0x2c')];if(!_0x4ec4ab['query'][_0xa2f3('0x34')](_0xa2f3('0x35'))){_0x5b868c['limit']=qs[_0xa2f3('0x1e')](_0x4ec4ab[_0xa2f3('0x2e')]['limit']);_0x5b868c['offset']=qs[_0xa2f3('0x1b')](_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x1b')]);}_0x5b868c[_0xa2f3('0x36')]=qs['sort'](_0x4ec4ab[_0xa2f3('0x2e')]['sort']);_0x5b868c[_0xa2f3('0x37')]=qs['filters'](_['pick'](_0x4ec4ab[_0xa2f3('0x2e')],_0x452142[_0xa2f3('0x30')]),_0x46f5c4);if(_0x4ec4ab['query'][_0xa2f3('0x38')]){_0x5b868c['where']=_[_0xa2f3('0x39')](_0x5b868c[_0xa2f3('0x37')],{'$or':_[_0xa2f3('0x2d')](_0x46f5c4,function(_0x11dade){if(_0x11dade[_0xa2f3('0x2b')]!==_0xa2f3('0x3a')){var _0x55d45f={};_0x55d45f[_0x11dade[_0xa2f3('0x26')]]={'$like':'%'+_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x38')]+'%'};return _0x55d45f;}})});}_0x5b868c=_[_0xa2f3('0x39')]({},_0x5b868c,_0x4ec4ab[_0xa2f3('0x3b')]);var _0x3a7010={'where':_0x5b868c[_0xa2f3('0x37')]};return db[_0xa2f3('0x28')]['count'](_0x3a7010)[_0xa2f3('0x23')](function(_0x1ce533){_0x52f211[_0xa2f3('0x1d')]=_0x1ce533;if(_0x4ec4ab[_0xa2f3('0x2e')][_0xa2f3('0x3c')]){_0x5b868c['include']=[{'all':!![]}];}return db[_0xa2f3('0x28')][_0xa2f3('0x3d')](_0x5b868c);})['then'](function(_0x3c5b86){_0x52f211[_0xa2f3('0x3e')]=_0x3c5b86;return _0x52f211;})[_0xa2f3('0x23')](respondWithFilteredResult(_0x1ceea4,_0x5b868c))[_0xa2f3('0x3f')](handleError(_0x1ceea4,null));};exports['show']=function(_0x3d3458,_0x266a68){var _0x10e6e0={'raw':!![],'where':{'id':_0x3d3458[_0xa2f3('0x40')]['id']}},_0x2edc0b={};_0x2edc0b[_0xa2f3('0x2c')]=_[_0xa2f3('0x2f')](db[_0xa2f3('0x28')][_0xa2f3('0x29')]);_0x2edc0b[_0xa2f3('0x2e')]=_[_0xa2f3('0x2f')](_0x3d3458[_0xa2f3('0x2e')]);_0x2edc0b['filters']=_[_0xa2f3('0x31')](_0x2edc0b['model'],_0x2edc0b[_0xa2f3('0x2e')]);_0x10e6e0[_0xa2f3('0x32')]=_[_0xa2f3('0x31')](_0x2edc0b[_0xa2f3('0x2c')],qs['fields'](_0x3d3458[_0xa2f3('0x2e')][_0xa2f3('0x33')]));_0x10e6e0['attributes']=_0x10e6e0['attributes'][_0xa2f3('0x41')]?_0x10e6e0[_0xa2f3('0x32')]:_0x2edc0b[_0xa2f3('0x2c')];if(_0x3d3458[_0xa2f3('0x2e')][_0xa2f3('0x3c')]){_0x10e6e0['include']=[{'all':!![]}];}_0x10e6e0=_['merge']({},_0x10e6e0,_0x3d3458['options']);return db[_0xa2f3('0x28')][_0xa2f3('0x42')](_0x10e6e0)[_0xa2f3('0x23')](handleEntityNotFound(_0x266a68,null))[_0xa2f3('0x23')](respondWithResult(_0x266a68,null))['catch'](handleError(_0x266a68,null));};exports[_0xa2f3('0x43')]=function(_0x4d5ed0,_0x2c275a){return db[_0xa2f3('0x28')]['create'](_0x4d5ed0['body'],{})[_0xa2f3('0x23')](respondWithResult(_0x2c275a,0xc9))[_0xa2f3('0x3f')](handleError(_0x2c275a,null));};exports[_0xa2f3('0x22')]=function(_0x5b8403,_0xe2ad3){if(_0x5b8403['body']['id']){delete _0x5b8403[_0xa2f3('0x44')]['id'];}return db['FreshdeskField'][_0xa2f3('0x42')]({'where':{'id':_0x5b8403[_0xa2f3('0x40')]['id']}})[_0xa2f3('0x23')](handleEntityNotFound(_0xe2ad3,null))[_0xa2f3('0x23')](saveUpdates(_0x5b8403[_0xa2f3('0x44')],null))[_0xa2f3('0x23')](respondWithResult(_0xe2ad3,null))[_0xa2f3('0x3f')](handleError(_0xe2ad3,null));};exports['destroy']=function(_0x5c634c,_0x11b2e4){return db[_0xa2f3('0x28')][_0xa2f3('0x42')]({'where':{'id':_0x5c634c[_0xa2f3('0x40')]['id']}})[_0xa2f3('0x23')](handleEntityNotFound(_0x11b2e4,null))[_0xa2f3('0x23')](removeEntity(_0x11b2e4,null))['catch'](handleError(_0x11b2e4,null));}; \ No newline at end of file +var _0x1b32=['lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','findAll','rows','show','params','fields','length','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1f5d35,_0x13db91){var _0x27355a=function(_0x1a3932){while(--_0x1a3932){_0x1f5d35['push'](_0x1f5d35['shift']());}};_0x27355a(++_0x13db91);}(_0x1b32,0x85));var _0x21b3=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x1b32[_0x220f3f];return _0x1f170e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b3('0x0'));var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var BPromise=require(_0x21b3('0x5'));var Mustache=require(_0x21b3('0x6'));var util=require(_0x21b3('0x7'));var path=require(_0x21b3('0x8'));var sox=require(_0x21b3('0x9'));var csv=require(_0x21b3('0xa'));var ejs=require(_0x21b3('0xb'));var fs=require('fs');var fs_extra=require(_0x21b3('0xc'));var _=require(_0x21b3('0xd'));var squel=require(_0x21b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21b3('0x10'));var Redis=require(_0x21b3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21b3('0x12'));var hardwareService=require(_0x21b3('0x13'));var logger=require(_0x21b3('0x14'))('api');var utils=require(_0x21b3('0x15'));var config=require(_0x21b3('0x16'));var licenseUtil=require(_0x21b3('0x17'));var db=require(_0x21b3('0x18'))['db'];function respondWithStatusCode(_0x40cc5a,_0x2c7abb){_0x2c7abb=_0x2c7abb||0xcc;return function(_0x3bff49){if(_0x3bff49){return _0x40cc5a[_0x21b3('0x19')](_0x2c7abb);}return _0x40cc5a[_0x21b3('0x1a')](_0x2c7abb)['end']();};}function respondWithResult(_0xa537ad,_0x810f46){_0x810f46=_0x810f46||0xc8;return function(_0x43bede){if(_0x43bede){return _0xa537ad['status'](_0x810f46)[_0x21b3('0x1b')](_0x43bede);}};}function respondWithFilteredResult(_0x4c931d,_0x3f7b4a){return function(_0x579a37){if(_0x579a37){var _0x15662a=typeof _0x3f7b4a[_0x21b3('0x1c')]===_0x21b3('0x1d')&&typeof _0x3f7b4a[_0x21b3('0x1e')]==='undefined';var _0x3f7e7a=_0x579a37['count'];var _0x408c17=_0x15662a?0x0:_0x3f7b4a[_0x21b3('0x1c')];var _0xaf1eba=_0x15662a?_0x579a37[_0x21b3('0x1f')]:_0x3f7b4a['offset']+_0x3f7b4a[_0x21b3('0x1e')];var _0x1e31bb;if(_0xaf1eba>=_0x3f7e7a){_0xaf1eba=_0x3f7e7a;_0x1e31bb=0xc8;}else{_0x1e31bb=0xce;}_0x4c931d[_0x21b3('0x1a')](_0x1e31bb);return _0x4c931d['set'](_0x21b3('0x20'),_0x408c17+'-'+_0xaf1eba+'/'+_0x3f7e7a)[_0x21b3('0x1b')](_0x579a37);}return null;};}function patchUpdates(_0x2f996d){return function(_0x3fe141){try{jsonpatch[_0x21b3('0x21')](_0x3fe141,_0x2f996d,!![]);}catch(_0x1be234){return BPromise[_0x21b3('0x22')](_0x1be234);}return _0x3fe141['save']();};}function saveUpdates(_0xbb78f3,_0x54695b){return function(_0x139672){if(_0x139672){return _0x139672[_0x21b3('0x23')](_0xbb78f3)[_0x21b3('0x24')](function(_0x4fcb87){return _0x4fcb87;});}return null;};}function removeEntity(_0x19ba2c,_0x5bda6e){return function(_0x3ee234){if(_0x3ee234){return _0x3ee234[_0x21b3('0x25')]()[_0x21b3('0x24')](function(){_0x19ba2c[_0x21b3('0x1a')](0xcc)[_0x21b3('0x26')]();});}};}function handleEntityNotFound(_0x2e3221,_0x58822d){return function(_0x5b752c){if(!_0x5b752c){_0x2e3221['sendStatus'](0x194);}return _0x5b752c;};}function handleError(_0x3ca89d,_0x2e3758){_0x2e3758=_0x2e3758||0x1f4;return function(_0x3c1a3b){logger[_0x21b3('0x27')](_0x3c1a3b[_0x21b3('0x28')]);if(_0x3c1a3b['name']){delete _0x3c1a3b[_0x21b3('0x29')];}_0x3ca89d['status'](_0x2e3758)[_0x21b3('0x2a')](_0x3c1a3b);};}exports['index']=function(_0x469e42,_0xf48fc7){var _0x81ee7e={},_0x4f6432={},_0x291e52={'count':0x0,'rows':[]};var _0x300977=_[_0x21b3('0x2b')](db[_0x21b3('0x2c')][_0x21b3('0x2d')],function(_0x210c49){return{'name':_0x210c49[_0x21b3('0x2e')],'type':_0x210c49['type']['key']};});_0x4f6432[_0x21b3('0x2f')]=_[_0x21b3('0x2b')](_0x300977,'name');_0x4f6432[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x469e42[_0x21b3('0x30')]);_0x4f6432[_0x21b3('0x32')]=_[_0x21b3('0x33')](_0x4f6432[_0x21b3('0x2f')],_0x4f6432[_0x21b3('0x30')]);_0x81ee7e[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x4f6432['model'],qs['fields'](_0x469e42[_0x21b3('0x30')]['fields']));_0x81ee7e[_0x21b3('0x34')]=_0x81ee7e[_0x21b3('0x34')]['length']?_0x81ee7e[_0x21b3('0x34')]:_0x4f6432[_0x21b3('0x2f')];if(!_0x469e42[_0x21b3('0x30')][_0x21b3('0x35')]('nolimit')){_0x81ee7e[_0x21b3('0x1e')]=qs[_0x21b3('0x1e')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x1e')]);_0x81ee7e['offset']=qs[_0x21b3('0x1c')](_0x469e42['query'][_0x21b3('0x1c')]);}_0x81ee7e[_0x21b3('0x36')]=qs[_0x21b3('0x37')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x37')]);_0x81ee7e[_0x21b3('0x38')]=qs[_0x21b3('0x32')](_['pick'](_0x469e42['query'],_0x4f6432[_0x21b3('0x32')]),_0x300977);if(_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]){_0x81ee7e[_0x21b3('0x38')]=_['merge'](_0x81ee7e[_0x21b3('0x38')],{'$or':_[_0x21b3('0x2b')](_0x300977,function(_0x128564){if(_0x128564[_0x21b3('0x3a')]!==_0x21b3('0x3b')){var _0xb028ca={};_0xb028ca[_0x128564[_0x21b3('0x29')]]={'$like':'%'+_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]+'%'};return _0xb028ca;}})});}_0x81ee7e=_[_0x21b3('0x3c')]({},_0x81ee7e,_0x469e42[_0x21b3('0x3d')]);var _0x4facfc={'where':_0x81ee7e[_0x21b3('0x38')]};return db[_0x21b3('0x2c')]['count'](_0x4facfc)[_0x21b3('0x24')](function(_0x5f2623){_0x291e52[_0x21b3('0x1f')]=_0x5f2623;if(_0x469e42[_0x21b3('0x30')]['includeAll']){_0x81ee7e['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x21b3('0x3e')](_0x81ee7e);})[_0x21b3('0x24')](function(_0x3e6501){_0x291e52[_0x21b3('0x3f')]=_0x3e6501;return _0x291e52;})['then'](respondWithFilteredResult(_0xf48fc7,_0x81ee7e))['catch'](handleError(_0xf48fc7,null));};exports[_0x21b3('0x40')]=function(_0x492eaf,_0x1c97e7){var _0x28adbc={'raw':!![],'where':{'id':_0x492eaf[_0x21b3('0x41')]['id']}},_0x306bf2={};_0x306bf2[_0x21b3('0x2f')]=_['keys'](db[_0x21b3('0x2c')][_0x21b3('0x2d')]);_0x306bf2[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x492eaf[_0x21b3('0x30')]);_0x306bf2[_0x21b3('0x32')]=_['intersection'](_0x306bf2['model'],_0x306bf2[_0x21b3('0x30')]);_0x28adbc[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x306bf2['model'],qs[_0x21b3('0x42')](_0x492eaf[_0x21b3('0x30')][_0x21b3('0x42')]));_0x28adbc[_0x21b3('0x34')]=_0x28adbc[_0x21b3('0x34')][_0x21b3('0x43')]?_0x28adbc['attributes']:_0x306bf2[_0x21b3('0x2f')];if(_0x492eaf[_0x21b3('0x30')][_0x21b3('0x44')]){_0x28adbc['include']=[{'all':!![]}];}_0x28adbc=_['merge']({},_0x28adbc,_0x492eaf['options']);return db[_0x21b3('0x2c')][_0x21b3('0x45')](_0x28adbc)[_0x21b3('0x24')](handleEntityNotFound(_0x1c97e7,null))[_0x21b3('0x24')](respondWithResult(_0x1c97e7,null))[_0x21b3('0x46')](handleError(_0x1c97e7,null));};exports[_0x21b3('0x47')]=function(_0xc51c1d,_0x30d48b){return db[_0x21b3('0x2c')]['create'](_0xc51c1d['body'],{})['then'](respondWithResult(_0x30d48b,0xc9))[_0x21b3('0x46')](handleError(_0x30d48b,null));};exports[_0x21b3('0x23')]=function(_0x4046cd,_0x2e4add){if(_0x4046cd[_0x21b3('0x48')]['id']){delete _0x4046cd[_0x21b3('0x48')]['id'];}return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x4046cd[_0x21b3('0x41')]['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0x2e4add,null))['then'](saveUpdates(_0x4046cd[_0x21b3('0x48')],null))[_0x21b3('0x24')](respondWithResult(_0x2e4add,null))[_0x21b3('0x46')](handleError(_0x2e4add,null));};exports[_0x21b3('0x25')]=function(_0x34509e,_0x2c7019){return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x34509e[_0x21b3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c7019,null))[_0x21b3('0x24')](removeEntity(_0x2c7019,null))[_0x21b3('0x46')](handleError(_0x2c7019,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index cafdc28..4d416b9 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 _0xd4d1=['rimraf','./intFreshdeskField.attributes','define','int_freshdesk_fields','idField','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2bc31c,_0x311c59){var _0x20aa04=function(_0x1c57ce){while(--_0x1c57ce){_0x2bc31c['push'](_0x2bc31c['shift']());}};_0x20aa04(++_0x311c59);}(_0xd4d1,0x123));var _0x1d4d=function(_0x4cf536,_0x6fb149){_0x4cf536=_0x4cf536-0x0;var _0x3168f0=_0xd4d1[_0x4cf536];return _0x3168f0;};'use strict';var _=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var logger=require(_0x1d4d('0x2'))(_0x1d4d('0x3'));var moment=require(_0x1d4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d4d('0x7'));module['exports']=function(_0x2bc295,_0x184978){return _0x2bc295[_0x1d4d('0x8')]('FreshdeskField',attributes,{'tableName':_0x1d4d('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x1d4d('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc511=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','rimraf','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x54bdc2,_0x14453d){var _0x53d749=function(_0x39e7bd){while(--_0x39e7bd){_0x54bdc2['push'](_0x54bdc2['shift']());}};_0x53d749(++_0x14453d);}(_0xc511,0x10a));var _0x1c51=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0xc511[_0x506172];return _0x2723c0;};'use strict';var _=require(_0x1c51('0x0'));var util=require('util');var logger=require(_0x1c51('0x1'))(_0x1c51('0x2'));var moment=require(_0x1c51('0x3'));var BPromise=require(_0x1c51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c51('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x167aac,_0x2f2f97){return _0x167aac[_0x1c51('0x6')](_0x1c51('0x7'),attributes,{'tableName':_0x1c51('0x8'),'paranoid':![],'indexes':[{'name':_0x1c51('0x9'),'fields':[_0x1c51('0xa'),_0x1c51('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 1779cd7..28f2916 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 _0xc1ec=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4c82e4,_0x46e9c1){var _0x270ab8=function(_0x3835ad){while(--_0x3835ad){_0x4c82e4['push'](_0x4c82e4['shift']());}};_0x270ab8(++_0x46e9c1);}(_0xc1ec,0x117));var _0xcc1e=function(_0x122cf9,_0x380cdd){_0x122cf9=_0x122cf9-0x0;var _0x29f2dc=_0xc1ec[_0x122cf9];return _0x29f2dc;};'use strict';var _=require(_0xcc1e('0x0'));var util=require(_0xcc1e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc1e('0x2'));var fs=require('fs');var Redis=require(_0xcc1e('0x3'));var db=require(_0xcc1e('0x4'))['db'];var utils=require(_0xcc1e('0x5'));var logger=require(_0xcc1e('0x6'))(_0xcc1e('0x7'));var config=require(_0xcc1e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc1e('0x9')][_0xcc1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xff7bd6,_0x211a4a,_0x4448e1){return new BPromise(function(_0x286814,_0x217727){return client[_0xcc1e('0xb')](_0xff7bd6,_0x4448e1)[_0xcc1e('0xc')](function(_0x544f51){logger[_0xcc1e('0xd')](_0xcc1e('0xe'),_0x211a4a,_0xcc1e('0xf'));logger[_0xcc1e('0x10')](_0xcc1e('0x11'),_0x211a4a,_0xcc1e('0xf'),JSON['stringify'](_0x544f51));if(_0x544f51[_0xcc1e('0x12')]){if(_0x544f51['error'][_0xcc1e('0x13')]===0x1f4){logger['error'](_0xcc1e('0xe'),_0x211a4a,_0x544f51['error'][_0xcc1e('0x14')]);return _0x217727(_0x544f51[_0xcc1e('0x12')][_0xcc1e('0x14')]);}logger['error'](_0xcc1e('0xe'),_0x211a4a,_0x544f51[_0xcc1e('0x12')][_0xcc1e('0x14')]);return _0x286814(_0x544f51[_0xcc1e('0x12')]['message']);}else{logger['info'](_0xcc1e('0xe'),_0x211a4a,_0xcc1e('0xf'));_0x286814(_0x544f51[_0xcc1e('0x15')][_0xcc1e('0x14')]);}})[_0xcc1e('0x16')](function(_0x3e743d){logger['error'](_0xcc1e('0xe'),_0x211a4a,_0x3e743d);_0x217727(_0x3e743d);});});} \ No newline at end of file +var _0xb1a2=['http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x5b9dd9,_0x3098bf){var _0x38cf3c=function(_0x610f27){while(--_0x610f27){_0x5b9dd9['push'](_0x5b9dd9['shift']());}};_0x38cf3c(++_0x3098bf);}(_0xb1a2,0xdc));var _0x2b1a=function(_0xcbb179,_0x5d9cd5){_0xcbb179=_0xcbb179-0x0;var _0x153f14=_0xb1a2[_0xcbb179];return _0x153f14;};'use strict';var _=require(_0x2b1a('0x0'));var util=require(_0x2b1a('0x1'));var moment=require('moment');var BPromise=require(_0x2b1a('0x2'));var rs=require(_0x2b1a('0x3'));var fs=require('fs');var Redis=require(_0x2b1a('0x4'));var db=require(_0x2b1a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b1a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2b1a('0x7')][_0x2b1a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x176e0f,_0x52ec5f,_0x438447){return new BPromise(function(_0x13e55a,_0x47cd1e){return client[_0x2b1a('0x9')](_0x176e0f,_0x438447)[_0x2b1a('0xa')](function(_0x44ebc2){logger['info'](_0x2b1a('0xb'),_0x52ec5f,_0x2b1a('0xc'));logger['debug'](_0x2b1a('0xd'),_0x52ec5f,_0x2b1a('0xc'),JSON['stringify'](_0x44ebc2));if(_0x44ebc2[_0x2b1a('0xe')]){if(_0x44ebc2[_0x2b1a('0xe')][_0x2b1a('0xf')]===0x1f4){logger[_0x2b1a('0xe')](_0x2b1a('0xb'),_0x52ec5f,_0x44ebc2[_0x2b1a('0xe')][_0x2b1a('0x10')]);return _0x47cd1e(_0x44ebc2['error'][_0x2b1a('0x10')]);}logger[_0x2b1a('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x52ec5f,_0x44ebc2[_0x2b1a('0xe')][_0x2b1a('0x10')]);return _0x13e55a(_0x44ebc2[_0x2b1a('0xe')][_0x2b1a('0x10')]);}else{logger[_0x2b1a('0x11')](_0x2b1a('0xb'),_0x52ec5f,'request\x20sent');_0x13e55a(_0x44ebc2[_0x2b1a('0x12')][_0x2b1a('0x10')]);}})['catch'](function(_0xbe3e06){logger[_0x2b1a('0xe')](_0x2b1a('0xb'),_0x52ec5f,_0xbe3e06);_0x47cd1e(_0xbe3e06);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index c6a75f4..5be4293 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 _0xb58b=['Router','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x1a2f5d,_0x4cd6e9){var _0x6b497c=function(_0x1821d4){while(--_0x1821d4){_0x1a2f5d['push'](_0x1a2f5d['shift']());}};_0x6b497c(++_0x4cd6e9);}(_0xb58b,0x1f1));var _0xbb58=function(_0x30b7d7,_0x3e8e68){_0x30b7d7=_0x30b7d7-0x0;var _0x30f234=_0xb58b[_0x30b7d7];return _0x30f234;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0x7')](_0xbb58('0xd'),auth[_0xbb58('0x8')](),controller['getFields']);router[_0xbb58('0xe')]('/',auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0xe')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['addConfiguration']);router[_0xbb58('0x10')](_0xbb58('0x9'),auth['isAuthenticated'](),controller[_0xbb58('0x11')]);router[_0xbb58('0x12')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0x13')]);module['exports']=router; \ No newline at end of file +var _0x593e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update'];(function(_0x44c37d,_0x19119f){var _0x29e087=function(_0x327fca){while(--_0x327fca){_0x44c37d['push'](_0x44c37d['shift']());}};_0x29e087(++_0x19119f);}(_0x593e,0xcb));var _0xe593=function(_0x230ad4,_0x3ae909){_0x230ad4=_0x230ad4-0x0;var _0x385c73=_0x593e[_0x230ad4];return _0x385c73;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id/configurations',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),controller['create']);router[_0xe593('0x11')](_0xe593('0x12'),auth[_0xe593('0xb')](),controller[_0xe593('0x13')]);router[_0xe593('0x14')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0x15')]);router[_0xe593('0x16')](_0xe593('0xd'),auth['isAuthenticated'](),controller[_0xe593('0x17')]);module[_0xe593('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 59e6894..61336f3 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 _0x8f4c=['sequelize','exports','STRING','username','remoteUri'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2857f5,_0x181da1){_0x2857f5=_0x2857f5-0x0;var _0xb5aed6=_0x8f4c[_0x2857f5];return _0xb5aed6;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')]},'description':{'type':Sequelize[_0xc8f4('0x2')]},'username':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x4')},'serverUrl':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9f0e=['STRING','remoteUri','sequelize','exports'];(function(_0x505df1,_0x5819ec){var _0x45f68f=function(_0x380f75){while(--_0x380f75){_0x505df1['push'](_0x505df1['shift']());}};_0x45f68f(++_0x5819ec);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3b86a5,_0x52360c){_0x3b86a5=_0x3b86a5-0x0;var _0x517165=_0x9f0e[_0x3b86a5];return _0x517165;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'serverUrl':{'type':Sequelize[_0xe9f0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index cf82c5d..e1b0664 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 _0x4d4d=['/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','FreshsalesAccount','findAll','rows','catch','params','include','options','create','body','update','destroy','find','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s'];(function(_0x208327,_0x26b904){var _0x3127bd=function(_0x424aa6){while(--_0x424aa6){_0x208327['push'](_0x208327['shift']());}};_0x3127bd(++_0x26b904);}(_0x4d4d,0x6a));var _0xd4d4=function(_0x58fc93,_0x2c4eb7){_0x58fc93=_0x58fc93-0x0;var _0x18fb0f=_0x4d4d[_0x58fc93];return _0x18fb0f;};'use strict';var emlformat=require(_0xd4d4('0x0'));var rimraf=require(_0xd4d4('0x1'));var zipdir=require(_0xd4d4('0x2'));var jsonpatch=require(_0xd4d4('0x3'));var rp=require('request-promise');var moment=require(_0xd4d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd4d4('0x5'));var util=require(_0xd4d4('0x6'));var path=require(_0xd4d4('0x7'));var sox=require(_0xd4d4('0x8'));var csv=require('to-csv');var ejs=require(_0xd4d4('0x9'));var fs=require('fs');var fs_extra=require(_0xd4d4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd4d4('0xb'));var jsforce=require(_0xd4d4('0xc'));var deskjs=require(_0xd4d4('0xd'));var toCsv=require(_0xd4d4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4d4('0xf'));var authService=require(_0xd4d4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4d4('0x11'));var logger=require(_0xd4d4('0x12'))(_0xd4d4('0x13'));var utils=require('../../config/utils');var config=require(_0xd4d4('0x14'));var licenseUtil=require(_0xd4d4('0x15'));var db=require(_0xd4d4('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a4f6e,_0x460272){_0x460272=_0x460272||0xcc;return function(_0x56a60d){if(_0x56a60d){return _0x5a4f6e[_0xd4d4('0x17')](_0x460272);}return _0x5a4f6e[_0xd4d4('0x18')](_0x460272)[_0xd4d4('0x19')]();};}function respondWithResult(_0x9a76ca,_0x41aec1){_0x41aec1=_0x41aec1||0xc8;return function(_0x2baab5){if(_0x2baab5){return _0x9a76ca[_0xd4d4('0x18')](_0x41aec1)[_0xd4d4('0x1a')](_0x2baab5);}};}function respondWithFilteredResult(_0x3f702f,_0x14a007){return function(_0x219be5){if(_0x219be5){var _0x4752b0=typeof _0x14a007[_0xd4d4('0x1b')]===_0xd4d4('0x1c')&&typeof _0x14a007[_0xd4d4('0x1d')]===_0xd4d4('0x1c');var _0x198511=_0x219be5[_0xd4d4('0x1e')];var _0x23cd28=_0x4752b0?0x0:_0x14a007['offset'];var _0x176001=_0x4752b0?_0x219be5[_0xd4d4('0x1e')]:_0x14a007[_0xd4d4('0x1b')]+_0x14a007[_0xd4d4('0x1d')];var _0x419e75;if(_0x176001>=_0x198511){_0x176001=_0x198511;_0x419e75=0xc8;}else{_0x419e75=0xce;}_0x3f702f['status'](_0x419e75);return _0x3f702f[_0xd4d4('0x1f')](_0xd4d4('0x20'),_0x23cd28+'-'+_0x176001+'/'+_0x198511)[_0xd4d4('0x1a')](_0x219be5);}return null;};}function patchUpdates(_0x18bc4d){return function(_0x6c5bf4){try{jsonpatch[_0xd4d4('0x21')](_0x6c5bf4,_0x18bc4d,!![]);}catch(_0x1b50ef){return BPromise['reject'](_0x1b50ef);}return _0x6c5bf4[_0xd4d4('0x22')]();};}function saveUpdates(_0x3717da,_0x55ab17){return function(_0x624936){if(_0x624936){return _0x624936['update'](_0x3717da)[_0xd4d4('0x23')](function(_0x2d3ff7){return _0x2d3ff7;});}return null;};}function removeEntity(_0x44ad21,_0x295d66){return function(_0x34f315){if(_0x34f315){return _0x34f315['destroy']()['then'](function(){_0x44ad21[_0xd4d4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5195,_0x2dac94){return function(_0x1c19e5){if(!_0x1c19e5){_0x4e5195[_0xd4d4('0x17')](0x194);}return _0x1c19e5;};}function handleError(_0x187bbb,_0x44e802){_0x44e802=_0x44e802||0x1f4;return function(_0x44ffd2){logger[_0xd4d4('0x24')](_0x44ffd2[_0xd4d4('0x25')]);if(_0x44ffd2[_0xd4d4('0x26')]){delete _0x44ffd2['name'];}_0x187bbb['status'](_0x44e802)[_0xd4d4('0x27')](_0x44ffd2);};}exports[_0xd4d4('0x28')]=function(_0x1b089e,_0x5ae7f8){var _0x3bfa3d={},_0x17211b={},_0x4088f={'count':0x0,'rows':[]};var _0x5e4543=_[_0xd4d4('0x29')](db['FreshsalesAccount'][_0xd4d4('0x2a')],function(_0x293acd){return{'name':_0x293acd['fieldName'],'type':_0x293acd['type'][_0xd4d4('0x2b')]};});_0x17211b[_0xd4d4('0x2c')]=_[_0xd4d4('0x29')](_0x5e4543,_0xd4d4('0x26'));_0x17211b[_0xd4d4('0x2d')]=_[_0xd4d4('0x2e')](_0x1b089e[_0xd4d4('0x2d')]);_0x17211b[_0xd4d4('0x2f')]=_[_0xd4d4('0x30')](_0x17211b[_0xd4d4('0x2c')],_0x17211b[_0xd4d4('0x2d')]);_0x3bfa3d[_0xd4d4('0x31')]=_['intersection'](_0x17211b[_0xd4d4('0x2c')],qs[_0xd4d4('0x32')](_0x1b089e[_0xd4d4('0x2d')]['fields']));_0x3bfa3d['attributes']=_0x3bfa3d[_0xd4d4('0x31')][_0xd4d4('0x33')]?_0x3bfa3d['attributes']:_0x17211b['model'];if(!_0x1b089e[_0xd4d4('0x2d')][_0xd4d4('0x34')](_0xd4d4('0x35'))){_0x3bfa3d[_0xd4d4('0x1d')]=qs['limit'](_0x1b089e[_0xd4d4('0x2d')][_0xd4d4('0x1d')]);_0x3bfa3d['offset']=qs[_0xd4d4('0x1b')](_0x1b089e[_0xd4d4('0x2d')][_0xd4d4('0x1b')]);}_0x3bfa3d[_0xd4d4('0x36')]=qs[_0xd4d4('0x37')](_0x1b089e[_0xd4d4('0x2d')]['sort']);_0x3bfa3d[_0xd4d4('0x38')]=qs['filters'](_[_0xd4d4('0x39')](_0x1b089e['query'],_0x17211b[_0xd4d4('0x2f')]),_0x5e4543);if(_0x1b089e[_0xd4d4('0x2d')][_0xd4d4('0x3a')]){_0x3bfa3d[_0xd4d4('0x38')]=_['merge'](_0x3bfa3d['where'],{'$or':_[_0xd4d4('0x29')](_0x5e4543,function(_0x5afdea){if(_0x5afdea[_0xd4d4('0x3b')]!==_0xd4d4('0x3c')){var _0x26d1ef={};_0x26d1ef[_0x5afdea[_0xd4d4('0x26')]]={'$like':'%'+_0x1b089e[_0xd4d4('0x2d')][_0xd4d4('0x3a')]+'%'};return _0x26d1ef;}})});}_0x3bfa3d=_[_0xd4d4('0x3d')]({},_0x3bfa3d,_0x1b089e['options']);var _0x1e7ca5={'where':_0x3bfa3d[_0xd4d4('0x38')]};return db['FreshsalesAccount'][_0xd4d4('0x1e')](_0x1e7ca5)[_0xd4d4('0x23')](function(_0x3ded6d){_0x4088f[_0xd4d4('0x1e')]=_0x3ded6d;if(_0x1b089e[_0xd4d4('0x2d')]['includeAll']){_0x3bfa3d['include']=[{'all':!![]}];}return db[_0xd4d4('0x3e')][_0xd4d4('0x3f')](_0x3bfa3d);})[_0xd4d4('0x23')](function(_0xff6146){_0x4088f[_0xd4d4('0x40')]=_0xff6146;return _0x4088f;})[_0xd4d4('0x23')](respondWithFilteredResult(_0x5ae7f8,_0x3bfa3d))[_0xd4d4('0x41')](handleError(_0x5ae7f8,null));};exports['show']=function(_0x1756f6,_0xfaa9a5){var _0x5486d3={'raw':![],'where':{'id':_0x1756f6[_0xd4d4('0x42')]['id']}},_0x3d7acc={};_0x3d7acc[_0xd4d4('0x2c')]=_[_0xd4d4('0x2e')](db['FreshsalesAccount'][_0xd4d4('0x2a')]);_0x3d7acc[_0xd4d4('0x2d')]=_[_0xd4d4('0x2e')](_0x1756f6[_0xd4d4('0x2d')]);_0x3d7acc[_0xd4d4('0x2f')]=_['intersection'](_0x3d7acc['model'],_0x3d7acc[_0xd4d4('0x2d')]);_0x5486d3[_0xd4d4('0x31')]=_['intersection'](_0x3d7acc['model'],qs['fields'](_0x1756f6[_0xd4d4('0x2d')][_0xd4d4('0x32')]));_0x5486d3[_0xd4d4('0x31')]=_0x5486d3[_0xd4d4('0x31')]['length']?_0x5486d3['attributes']:_0x3d7acc[_0xd4d4('0x2c')];if(_0x1756f6[_0xd4d4('0x2d')]['includeAll']){_0x5486d3[_0xd4d4('0x43')]=[{'all':!![]}];}_0x5486d3=_['merge']({},_0x5486d3,_0x1756f6[_0xd4d4('0x44')]);return db[_0xd4d4('0x3e')]['find'](_0x5486d3)[_0xd4d4('0x23')](handleEntityNotFound(_0xfaa9a5,null))[_0xd4d4('0x23')](respondWithResult(_0xfaa9a5,null))[_0xd4d4('0x41')](handleError(_0xfaa9a5,null));};exports[_0xd4d4('0x45')]=function(_0x1d05ba,_0x17f922){return db[_0xd4d4('0x3e')][_0xd4d4('0x45')](_0x1d05ba[_0xd4d4('0x46')],{})[_0xd4d4('0x23')](respondWithResult(_0x17f922,0xc9))[_0xd4d4('0x41')](handleError(_0x17f922,null));};exports[_0xd4d4('0x47')]=function(_0x1c6bee,_0x3733a1){if(_0x1c6bee[_0xd4d4('0x46')]['id']){delete _0x1c6bee[_0xd4d4('0x46')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x1c6bee[_0xd4d4('0x42')]['id']}})[_0xd4d4('0x23')](handleEntityNotFound(_0x3733a1,null))[_0xd4d4('0x23')](saveUpdates(_0x1c6bee[_0xd4d4('0x46')],null))[_0xd4d4('0x23')](respondWithResult(_0x3733a1,null))[_0xd4d4('0x41')](handleError(_0x3733a1,null));};exports[_0xd4d4('0x48')]=function(_0x5da461,_0x20518b){return db[_0xd4d4('0x3e')][_0xd4d4('0x49')]({'where':{'id':_0x5da461[_0xd4d4('0x42')]['id']}})['then'](handleEntityNotFound(_0x20518b,null))['then'](removeEntity(_0x20518b,null))[_0xd4d4('0x41')](handleError(_0x20518b,null));};exports[_0xd4d4('0x4a')]=function(_0x4a7351,_0x275616,_0x2ddbd7){var _0x563a36={};var _0x9cfb6c={};var _0x3a13b9;var _0x292aa6;return db[_0xd4d4('0x3e')][_0xd4d4('0x4b')]({'where':{'id':_0x4a7351[_0xd4d4('0x42')]['id']}})[_0xd4d4('0x23')](handleEntityNotFound(_0x275616,null))['then'](function(_0x44a676){if(_0x44a676){_0x3a13b9=_0x44a676;_0x9cfb6c[_0xd4d4('0x2c')]=_[_0xd4d4('0x2e')](db['FreshsalesConfiguration'][_0xd4d4('0x2a')]);_0x9cfb6c['query']=_['keys'](_0x4a7351[_0xd4d4('0x2d')]);_0x9cfb6c[_0xd4d4('0x2f')]=_['intersection'](_0x9cfb6c[_0xd4d4('0x2c')],_0x9cfb6c[_0xd4d4('0x2d')]);_0x563a36['attributes']=_[_0xd4d4('0x30')](_0x9cfb6c['model'],qs[_0xd4d4('0x32')](_0x4a7351['query']['fields']));_0x563a36['attributes']=_0x563a36[_0xd4d4('0x31')]['length']?_0x563a36[_0xd4d4('0x31')]:_0x9cfb6c[_0xd4d4('0x2c')];_0x563a36['order']=qs[_0xd4d4('0x37')](_0x4a7351[_0xd4d4('0x2d')]['sort']);_0x563a36[_0xd4d4('0x38')]=qs['filters'](_[_0xd4d4('0x39')](_0x4a7351[_0xd4d4('0x2d')],_0x9cfb6c[_0xd4d4('0x2f')]));if(_0x4a7351[_0xd4d4('0x2d')][_0xd4d4('0x3a')]){_0x563a36[_0xd4d4('0x38')]=_[_0xd4d4('0x3d')](_0x563a36[_0xd4d4('0x38')],{'$or':_['map'](_0x563a36[_0xd4d4('0x31')],function(_0x2a7d89){var _0x3be411={};_0x3be411[_0x2a7d89]={'$like':'%'+_0x4a7351[_0xd4d4('0x2d')][_0xd4d4('0x3a')]+'%'};return _0x3be411;})});}_0x563a36=_[_0xd4d4('0x3d')]({},_0x563a36,_0x4a7351[_0xd4d4('0x44')]);return _0x3a13b9[_0xd4d4('0x4a')](_0x563a36);}})['then'](function(_0x5dd339){if(_0x5dd339){_0x292aa6=_0x5dd339[_0xd4d4('0x33')];if(!_0x4a7351['query'][_0xd4d4('0x34')]('nolimit')){_0x563a36[_0xd4d4('0x1d')]=qs['limit'](_0x4a7351[_0xd4d4('0x2d')]['limit']);_0x563a36[_0xd4d4('0x1b')]=qs[_0xd4d4('0x1b')](_0x4a7351[_0xd4d4('0x2d')][_0xd4d4('0x1b')]);}return _0x3a13b9['getConfigurations'](_0x563a36);}})[_0xd4d4('0x23')](function(_0x28926e){if(_0x28926e){return _0x28926e?{'count':_0x292aa6,'rows':_0x28926e}:null;}})[_0xd4d4('0x23')](respondWithResult(_0x275616,null))['catch'](handleError(_0x275616,null));};exports['addConfiguration']=function(_0x284231,_0x1fdead,_0x38dbf1){if(_0x284231[_0xd4d4('0x46')]['id']){delete _0x284231['body']['id'];}return db['FreshsalesAccount'][_0xd4d4('0x4b')]({'where':{'id':_0x284231[_0xd4d4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fdead,null))[_0xd4d4('0x23')](function(_0xa572b3){if(_0xa572b3){_0x284231[_0xd4d4('0x46')][_0xd4d4('0x4c')]=_0xa572b3['id'];_0x284231['body']['Subjects']=integrations[_0xd4d4('0x4d')](_0x284231[_0xd4d4('0x46')][_0xd4d4('0x4e')],_0x284231[_0xd4d4('0x46')]['type']);_0x284231[_0xd4d4('0x46')][_0xd4d4('0x4f')]=integrations['getDescriptions'](_0x284231[_0xd4d4('0x46')]['channel'],_0x284231[_0xd4d4('0x46')][_0xd4d4('0x3b')]);return db[_0xd4d4('0x50')][_0xd4d4('0x45')](_0x284231[_0xd4d4('0x46')],{'include':[{'model':db[_0xd4d4('0x51')],'as':_0xd4d4('0x52')},{'model':db[_0xd4d4('0x51')],'as':_0xd4d4('0x4f')}]});}return null;})[_0xd4d4('0x23')](respondWithResult(_0x1fdead,null))[_0xd4d4('0x41')](handleError(_0x1fdead,null));};exports[_0xd4d4('0x53')]=function(_0x46942c,_0x5ab5e5,_0x3713e0){var _0x189418='';var _0x1229fc='';return db[_0xd4d4('0x3e')][_0xd4d4('0x4b')]({'where':{'id':_0x46942c[_0xd4d4('0x42')]['id']},'attributes':['id',_0xd4d4('0x54'),_0xd4d4('0x55'),_0xd4d4('0x56')]})[_0xd4d4('0x23')](handleEntityNotFound(_0x5ab5e5,null))['then'](function(_0x10bd24){if(_0x10bd24){_0x1229fc=_0x10bd24[_0xd4d4('0x54')];_0x189418=_0x10bd24[_0xd4d4('0x55')];var _0x769f27=_0x10bd24[_0xd4d4('0x55')]['slice'](-0x1);if(_0x769f27==='/'){_0x189418=_0x189418[_0xd4d4('0x57')](0x0,_0x189418[_0xd4d4('0x58')](_0x769f27));}return rp({'method':_0xd4d4('0x59'),'uri':util[_0xd4d4('0x5a')](_0xd4d4('0x5b'),_0x189418,_0xd4d4('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x10bd24[_0xd4d4('0x56')]},'json':!![]});}})[_0xd4d4('0x23')](function(_0x20423f){if(_0x20423f){var _0x38b73a=_0x20423f[_0xd4d4('0x5d')];var _0x37695d=![];var _0x47e8df=null;for(_0x47e8df=0x0;_0x47e8df<_0x38b73a[_0xd4d4('0x33')];_0x47e8df++){if(_0x38b73a[_0x47e8df][_0xd4d4('0x5e')]===_0x1229fc){_0x37695d=!![];}}if(_0x37695d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd4d4('0x5f')});}}})[_0xd4d4('0x23')](respondWithResult(_0x5ab5e5,null))[_0xd4d4('0x41')](function(_0x56897c){var _0x2fd5e2=_0x46942c[_0xd4d4('0x2d')]['test']?0x1f4:_0x56897c[_0xd4d4('0x60')]||0x1f4;logger[_0xd4d4('0x24')](_0xd4d4('0x61'),_0xd4d4('0x53'),_0x2fd5e2,JSON['stringify'](_0x56897c));delete _0x56897c[_0xd4d4('0x26')];if(_0x2fd5e2===0x191){_0x2fd5e2=0x190;}_0x5ab5e5[_0xd4d4('0x18')](_0x2fd5e2)[_0xd4d4('0x27')](_0x46942c[_0xd4d4('0x2d')][_0xd4d4('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x56897c[_0xd4d4('0x60')]}:_0x56897c);});}; \ No newline at end of file +var _0xb5cd=['FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','length','sort','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xb5cd,0x7b));var _0xdb5c=function(_0x403491,_0x303dc0){_0x403491=_0x403491-0x0;var _0x587e2f=_0xb5cd[_0x403491];return _0x587e2f;};'use strict';var emlformat=require(_0xdb5c('0x0'));var rimraf=require(_0xdb5c('0x1'));var zipdir=require(_0xdb5c('0x2'));var jsonpatch=require(_0xdb5c('0x3'));var rp=require('request-promise');var moment=require(_0xdb5c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb5c('0x5'));var util=require('util');var path=require(_0xdb5c('0x6'));var sox=require('sox');var csv=require(_0xdb5c('0x7'));var ejs=require(_0xdb5c('0x8'));var fs=require('fs');var fs_extra=require(_0xdb5c('0x9'));var _=require('lodash');var squel=require(_0xdb5c('0xa'));var crypto=require(_0xdb5c('0xb'));var jsforce=require(_0xdb5c('0xc'));var deskjs=require(_0xdb5c('0xd'));var toCsv=require(_0xdb5c('0x7'));var querystring=require(_0xdb5c('0xe'));var Papa=require('papaparse');var Redis=require(_0xdb5c('0xf'));var authService=require(_0xdb5c('0x10'));var qs=require(_0xdb5c('0x11'));var as=require(_0xdb5c('0x12'));var hardwareService=require(_0xdb5c('0x13'));var logger=require('../../config/logger')(_0xdb5c('0x14'));var utils=require('../../config/utils');var config=require(_0xdb5c('0x15'));var licenseUtil=require(_0xdb5c('0x16'));var db=require(_0xdb5c('0x17'))['db'];var integrations=require(_0xdb5c('0x18'));function respondWithStatusCode(_0x12c8e8,_0x5b6f53){_0x5b6f53=_0x5b6f53||0xcc;return function(_0x26ad4d){if(_0x26ad4d){return _0x12c8e8['sendStatus'](_0x5b6f53);}return _0x12c8e8[_0xdb5c('0x19')](_0x5b6f53)[_0xdb5c('0x1a')]();};}function respondWithResult(_0x41bd4d,_0x48b654){_0x48b654=_0x48b654||0xc8;return function(_0x1803b7){if(_0x1803b7){return _0x41bd4d['status'](_0x48b654)[_0xdb5c('0x1b')](_0x1803b7);}};}function respondWithFilteredResult(_0xb6e6e1,_0x5ec9fb){return function(_0x493c32){if(_0x493c32){var _0x2c9b7a=typeof _0x5ec9fb[_0xdb5c('0x1c')]===_0xdb5c('0x1d')&&typeof _0x5ec9fb[_0xdb5c('0x1e')]===_0xdb5c('0x1d');var _0x4277ad=_0x493c32[_0xdb5c('0x1f')];var _0x445c01=_0x2c9b7a?0x0:_0x5ec9fb['offset'];var _0x1ef18b=_0x2c9b7a?_0x493c32[_0xdb5c('0x1f')]:_0x5ec9fb[_0xdb5c('0x1c')]+_0x5ec9fb['limit'];var _0x5b6fe7;if(_0x1ef18b>=_0x4277ad){_0x1ef18b=_0x4277ad;_0x5b6fe7=0xc8;}else{_0x5b6fe7=0xce;}_0xb6e6e1[_0xdb5c('0x19')](_0x5b6fe7);return _0xb6e6e1[_0xdb5c('0x20')]('Content-Range',_0x445c01+'-'+_0x1ef18b+'/'+_0x4277ad)[_0xdb5c('0x1b')](_0x493c32);}return null;};}function patchUpdates(_0x308eee){return function(_0x2aa1f7){try{jsonpatch['apply'](_0x2aa1f7,_0x308eee,!![]);}catch(_0x409af8){return BPromise[_0xdb5c('0x21')](_0x409af8);}return _0x2aa1f7[_0xdb5c('0x22')]();};}function saveUpdates(_0x311cd8,_0x35ba10){return function(_0x5d481c){if(_0x5d481c){return _0x5d481c[_0xdb5c('0x23')](_0x311cd8)[_0xdb5c('0x24')](function(_0x115c3e){return _0x115c3e;});}return null;};}function removeEntity(_0x1d79f0,_0x552290){return function(_0xc2f497){if(_0xc2f497){return _0xc2f497[_0xdb5c('0x25')]()[_0xdb5c('0x24')](function(){_0x1d79f0[_0xdb5c('0x19')](0xcc)[_0xdb5c('0x1a')]();});}};}function handleEntityNotFound(_0x18e542,_0xd67dd6){return function(_0x289419){if(!_0x289419){_0x18e542[_0xdb5c('0x26')](0x194);}return _0x289419;};}function handleError(_0x243982,_0x543c71){_0x543c71=_0x543c71||0x1f4;return function(_0x33f76f){logger[_0xdb5c('0x27')](_0x33f76f[_0xdb5c('0x28')]);if(_0x33f76f[_0xdb5c('0x29')]){delete _0x33f76f[_0xdb5c('0x29')];}_0x243982[_0xdb5c('0x19')](_0x543c71)[_0xdb5c('0x2a')](_0x33f76f);};}exports[_0xdb5c('0x2b')]=function(_0x134463,_0x40c3aa){var _0x81126f={},_0x2a8f64={},_0x57d896={'count':0x0,'rows':[]};var _0x47f236=_[_0xdb5c('0x2c')](db[_0xdb5c('0x2d')][_0xdb5c('0x2e')],function(_0xcbd07c){return{'name':_0xcbd07c[_0xdb5c('0x2f')],'type':_0xcbd07c[_0xdb5c('0x30')][_0xdb5c('0x31')]};});_0x2a8f64[_0xdb5c('0x32')]=_[_0xdb5c('0x2c')](_0x47f236,'name');_0x2a8f64[_0xdb5c('0x33')]=_[_0xdb5c('0x34')](_0x134463['query']);_0x2a8f64[_0xdb5c('0x35')]=_[_0xdb5c('0x36')](_0x2a8f64[_0xdb5c('0x32')],_0x2a8f64[_0xdb5c('0x33')]);_0x81126f['attributes']=_[_0xdb5c('0x36')](_0x2a8f64[_0xdb5c('0x32')],qs[_0xdb5c('0x37')](_0x134463['query'][_0xdb5c('0x37')]));_0x81126f[_0xdb5c('0x38')]=_0x81126f['attributes']['length']?_0x81126f[_0xdb5c('0x38')]:_0x2a8f64[_0xdb5c('0x32')];if(!_0x134463[_0xdb5c('0x33')][_0xdb5c('0x39')](_0xdb5c('0x3a'))){_0x81126f['limit']=qs[_0xdb5c('0x1e')](_0x134463[_0xdb5c('0x33')][_0xdb5c('0x1e')]);_0x81126f['offset']=qs[_0xdb5c('0x1c')](_0x134463[_0xdb5c('0x33')][_0xdb5c('0x1c')]);}_0x81126f[_0xdb5c('0x3b')]=qs['sort'](_0x134463[_0xdb5c('0x33')]['sort']);_0x81126f[_0xdb5c('0x3c')]=qs[_0xdb5c('0x35')](_[_0xdb5c('0x3d')](_0x134463[_0xdb5c('0x33')],_0x2a8f64[_0xdb5c('0x35')]),_0x47f236);if(_0x134463[_0xdb5c('0x33')]['filter']){_0x81126f['where']=_[_0xdb5c('0x3e')](_0x81126f[_0xdb5c('0x3c')],{'$or':_[_0xdb5c('0x2c')](_0x47f236,function(_0x395355){if(_0x395355[_0xdb5c('0x30')]!==_0xdb5c('0x3f')){var _0x91967d={};_0x91967d[_0x395355[_0xdb5c('0x29')]]={'$like':'%'+_0x134463[_0xdb5c('0x33')][_0xdb5c('0x40')]+'%'};return _0x91967d;}})});}_0x81126f=_[_0xdb5c('0x3e')]({},_0x81126f,_0x134463[_0xdb5c('0x41')]);var _0x42caae={'where':_0x81126f[_0xdb5c('0x3c')]};return db[_0xdb5c('0x2d')][_0xdb5c('0x1f')](_0x42caae)[_0xdb5c('0x24')](function(_0x3078b5){_0x57d896[_0xdb5c('0x1f')]=_0x3078b5;if(_0x134463['query'][_0xdb5c('0x42')]){_0x81126f['include']=[{'all':!![]}];}return db[_0xdb5c('0x2d')]['findAll'](_0x81126f);})['then'](function(_0x4f9616){_0x57d896[_0xdb5c('0x43')]=_0x4f9616;return _0x57d896;})['then'](respondWithFilteredResult(_0x40c3aa,_0x81126f))[_0xdb5c('0x44')](handleError(_0x40c3aa,null));};exports[_0xdb5c('0x45')]=function(_0x54f379,_0x328afe){var _0x37c098={'raw':![],'where':{'id':_0x54f379[_0xdb5c('0x46')]['id']}},_0x4297d4={};_0x4297d4[_0xdb5c('0x32')]=_[_0xdb5c('0x34')](db[_0xdb5c('0x2d')][_0xdb5c('0x2e')]);_0x4297d4[_0xdb5c('0x33')]=_[_0xdb5c('0x34')](_0x54f379[_0xdb5c('0x33')]);_0x4297d4[_0xdb5c('0x35')]=_['intersection'](_0x4297d4[_0xdb5c('0x32')],_0x4297d4[_0xdb5c('0x33')]);_0x37c098[_0xdb5c('0x38')]=_[_0xdb5c('0x36')](_0x4297d4[_0xdb5c('0x32')],qs[_0xdb5c('0x37')](_0x54f379[_0xdb5c('0x33')][_0xdb5c('0x37')]));_0x37c098[_0xdb5c('0x38')]=_0x37c098[_0xdb5c('0x38')]['length']?_0x37c098[_0xdb5c('0x38')]:_0x4297d4[_0xdb5c('0x32')];if(_0x54f379['query']['includeAll']){_0x37c098[_0xdb5c('0x47')]=[{'all':!![]}];}_0x37c098=_['merge']({},_0x37c098,_0x54f379[_0xdb5c('0x41')]);return db[_0xdb5c('0x2d')][_0xdb5c('0x48')](_0x37c098)[_0xdb5c('0x24')](handleEntityNotFound(_0x328afe,null))[_0xdb5c('0x24')](respondWithResult(_0x328afe,null))['catch'](handleError(_0x328afe,null));};exports[_0xdb5c('0x49')]=function(_0x41fdcd,_0x2b7de8){return db[_0xdb5c('0x2d')][_0xdb5c('0x49')](_0x41fdcd[_0xdb5c('0x4a')],{})['then'](respondWithResult(_0x2b7de8,0xc9))[_0xdb5c('0x44')](handleError(_0x2b7de8,null));};exports[_0xdb5c('0x23')]=function(_0x425ecf,_0xd6329f){if(_0x425ecf[_0xdb5c('0x4a')]['id']){delete _0x425ecf[_0xdb5c('0x4a')]['id'];}return db[_0xdb5c('0x2d')][_0xdb5c('0x48')]({'where':{'id':_0x425ecf['params']['id']}})[_0xdb5c('0x24')](handleEntityNotFound(_0xd6329f,null))[_0xdb5c('0x24')](saveUpdates(_0x425ecf[_0xdb5c('0x4a')],null))[_0xdb5c('0x24')](respondWithResult(_0xd6329f,null))[_0xdb5c('0x44')](handleError(_0xd6329f,null));};exports['destroy']=function(_0x3e52ff,_0x9f3876){return db[_0xdb5c('0x2d')][_0xdb5c('0x48')]({'where':{'id':_0x3e52ff[_0xdb5c('0x46')]['id']}})['then'](handleEntityNotFound(_0x9f3876,null))[_0xdb5c('0x24')](removeEntity(_0x9f3876,null))[_0xdb5c('0x44')](handleError(_0x9f3876,null));};exports[_0xdb5c('0x4b')]=function(_0x334d61,_0x19da88,_0x51247a){var _0x18655e={};var _0x432500={};var _0x2608ab;var _0x21ee7b;return db['FreshsalesAccount'][_0xdb5c('0x4c')]({'where':{'id':_0x334d61['params']['id']}})[_0xdb5c('0x24')](handleEntityNotFound(_0x19da88,null))[_0xdb5c('0x24')](function(_0x10543e){if(_0x10543e){_0x2608ab=_0x10543e;_0x432500[_0xdb5c('0x32')]=_[_0xdb5c('0x34')](db['FreshsalesConfiguration'][_0xdb5c('0x2e')]);_0x432500['query']=_[_0xdb5c('0x34')](_0x334d61[_0xdb5c('0x33')]);_0x432500[_0xdb5c('0x35')]=_[_0xdb5c('0x36')](_0x432500[_0xdb5c('0x32')],_0x432500['query']);_0x18655e['attributes']=_['intersection'](_0x432500[_0xdb5c('0x32')],qs[_0xdb5c('0x37')](_0x334d61[_0xdb5c('0x33')][_0xdb5c('0x37')]));_0x18655e[_0xdb5c('0x38')]=_0x18655e[_0xdb5c('0x38')][_0xdb5c('0x4d')]?_0x18655e[_0xdb5c('0x38')]:_0x432500[_0xdb5c('0x32')];_0x18655e[_0xdb5c('0x3b')]=qs[_0xdb5c('0x4e')](_0x334d61[_0xdb5c('0x33')][_0xdb5c('0x4e')]);_0x18655e['where']=qs['filters'](_['pick'](_0x334d61[_0xdb5c('0x33')],_0x432500[_0xdb5c('0x35')]));if(_0x334d61[_0xdb5c('0x33')]['filter']){_0x18655e[_0xdb5c('0x3c')]=_[_0xdb5c('0x3e')](_0x18655e[_0xdb5c('0x3c')],{'$or':_[_0xdb5c('0x2c')](_0x18655e[_0xdb5c('0x38')],function(_0x464ab9){var _0x5b9e58={};_0x5b9e58[_0x464ab9]={'$like':'%'+_0x334d61[_0xdb5c('0x33')][_0xdb5c('0x40')]+'%'};return _0x5b9e58;})});}_0x18655e=_['merge']({},_0x18655e,_0x334d61[_0xdb5c('0x41')]);return _0x2608ab[_0xdb5c('0x4b')](_0x18655e);}})[_0xdb5c('0x24')](function(_0x3d4ef0){if(_0x3d4ef0){_0x21ee7b=_0x3d4ef0[_0xdb5c('0x4d')];if(!_0x334d61['query'][_0xdb5c('0x39')](_0xdb5c('0x3a'))){_0x18655e[_0xdb5c('0x1e')]=qs[_0xdb5c('0x1e')](_0x334d61[_0xdb5c('0x33')][_0xdb5c('0x1e')]);_0x18655e['offset']=qs['offset'](_0x334d61['query'][_0xdb5c('0x1c')]);}return _0x2608ab['getConfigurations'](_0x18655e);}})[_0xdb5c('0x24')](function(_0x14a22f){if(_0x14a22f){return _0x14a22f?{'count':_0x21ee7b,'rows':_0x14a22f}:null;}})[_0xdb5c('0x24')](respondWithResult(_0x19da88,null))[_0xdb5c('0x44')](handleError(_0x19da88,null));};exports[_0xdb5c('0x4f')]=function(_0x3d0d45,_0x42aac9,_0x5b17d6){if(_0x3d0d45[_0xdb5c('0x4a')]['id']){delete _0x3d0d45[_0xdb5c('0x4a')]['id'];}return db[_0xdb5c('0x2d')][_0xdb5c('0x4c')]({'where':{'id':_0x3d0d45[_0xdb5c('0x46')]['id']}})[_0xdb5c('0x24')](handleEntityNotFound(_0x42aac9,null))['then'](function(_0x5538c7){if(_0x5538c7){_0x3d0d45[_0xdb5c('0x4a')]['AccountId']=_0x5538c7['id'];_0x3d0d45[_0xdb5c('0x4a')][_0xdb5c('0x50')]=integrations[_0xdb5c('0x51')](_0x3d0d45[_0xdb5c('0x4a')][_0xdb5c('0x52')],_0x3d0d45[_0xdb5c('0x4a')][_0xdb5c('0x30')]);_0x3d0d45[_0xdb5c('0x4a')][_0xdb5c('0x53')]=integrations['getDescriptions'](_0x3d0d45[_0xdb5c('0x4a')][_0xdb5c('0x52')],_0x3d0d45[_0xdb5c('0x4a')]['type']);return db[_0xdb5c('0x54')]['create'](_0x3d0d45[_0xdb5c('0x4a')],{'include':[{'model':db[_0xdb5c('0x55')],'as':_0xdb5c('0x50')},{'model':db[_0xdb5c('0x55')],'as':'Descriptions'}]});}return null;})[_0xdb5c('0x24')](respondWithResult(_0x42aac9,null))[_0xdb5c('0x44')](handleError(_0x42aac9,null));};exports[_0xdb5c('0x56')]=function(_0x2a2023,_0x2e261e,_0x1c8ac6){var _0x4720ce='';var _0x2134af='';return db[_0xdb5c('0x2d')][_0xdb5c('0x4c')]({'where':{'id':_0x2a2023['params']['id']},'attributes':['id',_0xdb5c('0x57'),'remoteUri','apiKey']})[_0xdb5c('0x24')](handleEntityNotFound(_0x2e261e,null))[_0xdb5c('0x24')](function(_0xc5d2a){if(_0xc5d2a){_0x2134af=_0xc5d2a[_0xdb5c('0x57')];_0x4720ce=_0xc5d2a[_0xdb5c('0x58')];var _0x339d5a=_0xc5d2a[_0xdb5c('0x58')][_0xdb5c('0x59')](-0x1);if(_0x339d5a==='/'){_0x4720ce=_0x4720ce[_0xdb5c('0x5a')](0x0,_0x4720ce[_0xdb5c('0x5b')](_0x339d5a));}return rp({'method':_0xdb5c('0x5c'),'uri':util[_0xdb5c('0x5d')](_0xdb5c('0x5e'),_0x4720ce,_0xdb5c('0x5f')),'headers':{'Authorization':_0xdb5c('0x60')+_0xc5d2a[_0xdb5c('0x61')]},'json':!![]});}})[_0xdb5c('0x24')](function(_0x1e3707){if(_0x1e3707){var _0x551242=_0x1e3707['users'];var _0x3f89e2=![];var _0x341df9=null;for(_0x341df9=0x0;_0x341df9<_0x551242['length'];_0x341df9++){if(_0x551242[_0x341df9][_0xdb5c('0x62')]===_0x2134af){_0x3f89e2=!![];}}if(_0x3f89e2){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x2e261e,null))[_0xdb5c('0x44')](function(_0x294857){var _0x276fae=_0x2a2023['query'][_0xdb5c('0x63')]?0x1f4:_0x294857[_0xdb5c('0x64')]||0x1f4;logger[_0xdb5c('0x27')](_0xdb5c('0x65'),'getFields',_0x276fae,JSON[_0xdb5c('0x66')](_0x294857));delete _0x294857['name'];if(_0x276fae===0x191){_0x276fae=0x190;}_0x2e261e[_0xdb5c('0x19')](_0x276fae)[_0xdb5c('0x2a')](_0x2a2023[_0xdb5c('0x33')][_0xdb5c('0x63')]?{'message':_0xdb5c('0x67'),'statusCode':_0x294857['statusCode']}:_0x294857);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 760a568..d5802d3 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 _0x33af=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x33af,0xec));var _0xf33a=function(_0x915908,_0x333bc8){_0x915908=_0x915908-0x0;var _0x26a3ea=_0x33af[_0x915908];return _0x26a3ea;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));var integrations=require(_0xf33a('0x8'));module['exports']=function(_0xc0dd13,_0x384b14){return _0xc0dd13[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d11=['../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','moment','request-promise','path','./intFreshsalesAccount.attributes'];(function(_0x159773,_0x554466){var _0x29ff07=function(_0x4b128d){while(--_0x4b128d){_0x159773['push'](_0x159773['shift']());}};_0x29ff07(++_0x554466);}(_0x6d11,0xbf));var _0x16d1=function(_0x25752d,_0x30517d){_0x25752d=_0x25752d-0x0;var _0x2cdea5=_0x6d11[_0x25752d];return _0x2cdea5;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));var integrations=require(_0x16d1('0x7'));module[_0x16d1('0x8')]=function(_0x38626d,_0x1009dc){return _0x38626d[_0x16d1('0x9')](_0x16d1('0xa'),attributes,{'tableName':'int_freshsales_accounts','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 e0664a4..f48a882 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 _0xadb5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','raw','options','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','FreshsalesAccount','find','util','bluebird'];(function(_0x2eb2cd,_0x51ff37){var _0x56fb04=function(_0x1d25bd){while(--_0x1d25bd){_0x2eb2cd['push'](_0x2eb2cd['shift']());}};_0x56fb04(++_0x51ff37);}(_0xadb5,0xad));var _0x5adb=function(_0x2f87e4,_0x471dcc){_0x2f87e4=_0x2f87e4-0x0;var _0x63dae3=_0xadb5[_0x2f87e4];return _0x63dae3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['FreshsalesAccount'][_0x5adb('0x16')]({'raw':_0x529b65['options']?_0x529b65['options'][_0x5adb('0x17')]===undefined?!![]:![]:!![],'where':_0x529b65[_0x5adb('0x18')]?_0x529b65[_0x5adb('0x18')][_0x5adb('0x19')]||null:null,'attributes':_0x529b65[_0x5adb('0x18')]?_0x529b65['options'][_0x5adb('0x1a')]||null:null,'limit':_0x529b65['options']?_0x529b65['options'][_0x5adb('0x1b')]||null:null,'include':_0x529b65[_0x5adb('0x18')]?_0x529b65[_0x5adb('0x18')][_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x529b65[_0x5adb('0x18')][_0x5adb('0x1c')],function(_0x4ca150){return{'model':db[_0x4ca150[_0x5adb('0x1e')]],'as':_0x4ca150['as'],'attributes':_0x4ca150[_0x5adb('0x1a')],'include':_0x4ca150[_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x4ca150[_0x5adb('0x1c')],function(_0x49f203){return{'model':db[_0x49f203[_0x5adb('0x1e')]],'as':_0x49f203['as'],'attributes':_0x49f203[_0x5adb('0x1a')],'include':_0x49f203['include']?_[_0x5adb('0x1d')](_0x49f203[_0x5adb('0x1c')],function(_0x1a0acd){return{'model':db[_0x1a0acd['model']],'as':_0x1a0acd['as'],'attributes':_0x1a0acd[_0x5adb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5adb('0xb')](function(_0x3a4fca){logger[_0x5adb('0xc')](_0x5adb('0x15'),_0x529b65);logger[_0x5adb('0x1f')]('GetFreshsalesAccount',_0x529b65,JSON['stringify'](_0x3a4fca));_0x5de028(_0x3a4fca);})['catch'](function(_0x39bddd){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x39bddd[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x39bddd['message']));});});};exports[_0x5adb('0x20')]=function(_0x34b793){var _0x372da1=this;return new Promise(function(_0x3b1fed,_0x450169){return db[_0x5adb('0x21')][_0x5adb('0x22')]({'raw':_0x34b793[_0x5adb('0x18')]?_0x34b793[_0x5adb('0x18')][_0x5adb('0x17')]===undefined?!![]:![]:!![],'where':_0x34b793['options']?_0x34b793[_0x5adb('0x18')]['where']||null:null,'attributes':_0x34b793[_0x5adb('0x18')]?_0x34b793[_0x5adb('0x18')]['attributes']||null:null,'include':_0x34b793[_0x5adb('0x18')]?_0x34b793[_0x5adb('0x18')][_0x5adb('0x1c')]?_['map'](_0x34b793[_0x5adb('0x18')][_0x5adb('0x1c')],function(_0x4b5887){return{'model':db[_0x4b5887['model']],'as':_0x4b5887['as'],'attributes':_0x4b5887[_0x5adb('0x1a')],'include':_0x4b5887['include']?_[_0x5adb('0x1d')](_0x4b5887[_0x5adb('0x1c')],function(_0x3c2b07){return{'model':db[_0x3c2b07[_0x5adb('0x1e')]],'as':_0x3c2b07['as'],'attributes':_0x3c2b07[_0x5adb('0x1a')],'include':_0x3c2b07['include']?_[_0x5adb('0x1d')](_0x3c2b07[_0x5adb('0x1c')],function(_0x1c3a5c){return{'model':db[_0x1c3a5c['model']],'as':_0x1c3a5c['as'],'attributes':_0x1c3a5c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5adb('0xb')](function(_0x5d1baa){logger['info'](_0x5adb('0x20'),_0x34b793);logger['debug'](_0x5adb('0x20'),_0x34b793,JSON['stringify'](_0x5d1baa));_0x3b1fed(_0x5d1baa);})[_0x5adb('0x14')](function(_0x4d052f){logger[_0x5adb('0x10')](_0x5adb('0x20'),_0x4d052f['message'],_0x34b793);_0x450169(_0x372da1[_0x5adb('0x10')](0x1f4,_0x4d052f['message']));});});}; \ No newline at end of file +var _0x4325=['stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x130d45,_0x97593a){var _0x1ee8d8=function(_0x2654e){while(--_0x2654e){_0x130d45['push'](_0x130d45['shift']());}};_0x1ee8d8(++_0x97593a);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')]({'raw':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options'][_0x5432('0x1c')]||null:null,'attributes':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'limit':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options']['limit']||null:null,'include':_0x32fe60['options']?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x32fe60[_0x5432('0x1a')]['include'],function(_0x4af5f4){return{'model':db[_0x4af5f4[_0x5432('0x20')]],'as':_0x4af5f4['as'],'attributes':_0x4af5f4[_0x5432('0x1d')],'include':_0x4af5f4['include']?_[_0x5432('0x1f')](_0x4af5f4[_0x5432('0x1e')],function(_0x637582){return{'model':db[_0x637582['model']],'as':_0x637582['as'],'attributes':_0x637582[_0x5432('0x1d')],'include':_0x637582[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x637582['include'],function(_0x4ab09d){return{'model':db[_0x4ab09d[_0x5432('0x20')]],'as':_0x4ab09d['as'],'attributes':_0x4ab09d[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1abe73){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug'](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x1abe73));_0x5f011f(_0x1abe73);})['catch'](function(_0x6fc7f5){logger['error'](_0x5432('0x17'),_0x6fc7f5['message'],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x6fc7f5[_0x5432('0x13')]));});});};exports[_0x5432('0x21')]=function(_0x345b51){var _0x4e92d5=this;return new Promise(function(_0x31490c,_0x1d436c){return db[_0x5432('0x18')][_0x5432('0x22')]({'raw':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')]['where']||null:null,'attributes':_0x345b51['options']?_0x345b51[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'include':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1e')]?_['map'](_0x345b51[_0x5432('0x1a')]['include'],function(_0x2955e0){return{'model':db[_0x2955e0[_0x5432('0x20')]],'as':_0x2955e0['as'],'attributes':_0x2955e0[_0x5432('0x1d')],'include':_0x2955e0[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x2955e0[_0x5432('0x1e')],function(_0x5c3c77){return{'model':db[_0x5c3c77[_0x5432('0x20')]],'as':_0x5c3c77['as'],'attributes':_0x5c3c77[_0x5432('0x1d')],'include':_0x5c3c77[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x5c3c77['include'],function(_0xe01f4b){return{'model':db[_0xe01f4b[_0x5432('0x20')]],'as':_0xe01f4b['as'],'attributes':_0xe01f4b[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5432('0xb')](function(_0x3fb586){logger[_0x5432('0x14')](_0x5432('0x21'),_0x345b51);logger[_0x5432('0xd')](_0x5432('0x21'),_0x345b51,JSON[_0x5432('0x10')](_0x3fb586));_0x31490c(_0x3fb586);})[_0x5432('0x16')](function(_0x1f4679){logger[_0x5432('0x12')](_0x5432('0x21'),_0x1f4679['message'],_0x345b51);_0x1d436c(_0x4e92d5[_0x5432('0x12')](0x1f4,_0x1f4679['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 63dd104..78af6d8 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 _0xd301=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/fields','getFields','post'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd301,0xde));var _0x1d30=function(_0x25b9a1,_0x3e141b){_0x25b9a1=_0x25b9a1-0x0;var _0x2dff67=_0xd301[_0x25b9a1];return _0x2dff67;};'use strict';var multer=require(_0x1d30('0x0'));var util=require(_0x1d30('0x1'));var path=require('path');var timeout=require(_0x1d30('0x2'));var express=require(_0x1d30('0x3'));var router=express[_0x1d30('0x4')]();var fs_extra=require(_0x1d30('0x5'));var auth=require(_0x1d30('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d30('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x1d30('0x8')]('/',auth[_0x1d30('0x9')](),controller[_0x1d30('0xa')]);router['get'](_0x1d30('0xb'),auth[_0x1d30('0x9')](),controller[_0x1d30('0xc')]);router[_0x1d30('0x8')](_0x1d30('0xd'),auth[_0x1d30('0x9')](),controller[_0x1d30('0xe')]);router[_0x1d30('0x8')]('/:id/descriptions',auth[_0x1d30('0x9')](),controller['getDescriptions']);router[_0x1d30('0x8')](_0x1d30('0xf'),auth[_0x1d30('0x9')](),controller[_0x1d30('0x10')]);router[_0x1d30('0x11')]('/',auth['isAuthenticated'](),controller[_0x1d30('0x12')]);router[_0x1d30('0x13')]('/:id',auth[_0x1d30('0x9')](),controller[_0x1d30('0x14')]);router[_0x1d30('0x15')](_0x1d30('0xb'),auth[_0x1d30('0x9')](),controller[_0x1d30('0x16')]);module[_0x1d30('0x17')]=router; \ No newline at end of file +var _0xf8f5=['/:id','isAuthenticated','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0xdba908,_0x3e2dca){var _0x4e6751=function(_0x31609e){while(--_0x31609e){_0xdba908['push'](_0xdba908['shift']());}};_0x4e6751(++_0x3e2dca);}(_0xf8f5,0x1af));var _0x5f8f=function(_0x50b51e,_0x5845fb){_0x50b51e=_0x50b51e-0x0;var _0x614454=_0xf8f5[_0x50b51e];return _0x614454;};'use strict';var multer=require(_0x5f8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f8f('0x1'));var express=require(_0x5f8f('0x2'));var router=express[_0x5f8f('0x3')]();var fs_extra=require(_0x5f8f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5f8f('0x5'));var config=require(_0x5f8f('0x6'));var controller=require(_0x5f8f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5f8f('0x8')](_0x5f8f('0x9'),auth[_0x5f8f('0xa')](),controller[_0x5f8f('0xb')]);router[_0x5f8f('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x5f8f('0x8')](_0x5f8f('0xc'),auth[_0x5f8f('0xa')](),controller[_0x5f8f('0xd')]);router['get'](_0x5f8f('0xe'),auth['isAuthenticated'](),controller[_0x5f8f('0xf')]);router[_0x5f8f('0x10')]('/',auth[_0x5f8f('0xa')](),controller[_0x5f8f('0x11')]);router['put'](_0x5f8f('0x9'),auth[_0x5f8f('0xa')](),controller[_0x5f8f('0x12')]);router[_0x5f8f('0x13')](_0x5f8f('0x9'),auth[_0x5f8f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a90c423..4686d7a 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 _0x3d5a=['STRING','sequelize','exports'];(function(_0x1f92fd,_0x39ef20){var _0x2fd769=function(_0x5c9223){while(--_0x5c9223){_0x1f92fd['push'](_0x1f92fd['shift']());}};_0x2fd769(++_0x39ef20);}(_0x3d5a,0x130));var _0xa3d5=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x3d5a[_0x121886];return _0x20ca01;};'use strict';var Sequelize=require(_0xa3d5('0x0'));module[_0xa3d5('0x1')]={'name':{'type':Sequelize[_0xa3d5('0x2')]},'description':{'type':Sequelize[_0xa3d5('0x2')]}}; \ No newline at end of file +var _0xf0fe=['sequelize','STRING'];(function(_0x537fff,_0x4a9362){var _0x3c9874=function(_0x10b37d){while(--_0x10b37d){_0x537fff['push'](_0x537fff['shift']());}};_0x3c9874(++_0x4a9362);}(_0xf0fe,0x6a));var _0xef0f=function(_0x30e74b,_0x1a1f59){_0x30e74b=_0x30e74b-0x0;var _0x3b8e4d=_0xf0fe[_0x30e74b];return _0x3b8e4d;};'use strict';var Sequelize=require(_0xef0f('0x0'));module['exports']={'name':{'type':Sequelize[_0xef0f('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 64bf37c..58eb8d3 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 _0x3ee1=['limit','order','sort','where','pick','filter','merge','FreshsalesConfiguration','includeAll','include','findAll','catch','params','options','find','create','body','findOne','FreshsalesField','getSubjects','length','getDescriptions','map','getFields','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5c56ea,_0x2b20bf){var _0xb4d267=function(_0x206a2d){while(--_0x206a2d){_0x5c56ea['push'](_0x5c56ea['shift']());}};_0xb4d267(++_0x2b20bf);}(_0x3ee1,0x1b2));var _0x13ee=function(_0x285316,_0x5184a0){_0x285316=_0x285316-0x0;var _0x4df7f0=_0x3ee1[_0x285316];return _0x4df7f0;};'use strict';var emlformat=require(_0x13ee('0x0'));var rimraf=require(_0x13ee('0x1'));var zipdir=require(_0x13ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x13ee('0x3'));var BPromise=require(_0x13ee('0x4'));var Mustache=require(_0x13ee('0x5'));var util=require('util');var path=require('path');var sox=require(_0x13ee('0x6'));var csv=require('to-csv');var ejs=require(_0x13ee('0x7'));var fs=require('fs');var fs_extra=require(_0x13ee('0x8'));var _=require(_0x13ee('0x9'));var squel=require(_0x13ee('0xa'));var crypto=require(_0x13ee('0xb'));var jsforce=require(_0x13ee('0xc'));var deskjs=require(_0x13ee('0xd'));var toCsv=require(_0x13ee('0xe'));var querystring=require(_0x13ee('0xf'));var Papa=require(_0x13ee('0x10'));var Redis=require(_0x13ee('0x11'));var authService=require(_0x13ee('0x12'));var qs=require(_0x13ee('0x13'));var as=require(_0x13ee('0x14'));var hardwareService=require(_0x13ee('0x15'));var logger=require(_0x13ee('0x16'))(_0x13ee('0x17'));var utils=require(_0x13ee('0x18'));var config=require(_0x13ee('0x19'));var licenseUtil=require(_0x13ee('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1543cf,_0xc98b55){_0xc98b55=_0xc98b55||0xcc;return function(_0x2d862e){if(_0x2d862e){return _0x1543cf[_0x13ee('0x1b')](_0xc98b55);}return _0x1543cf['status'](_0xc98b55)[_0x13ee('0x1c')]();};}function respondWithResult(_0x15b400,_0x5ca4e9){_0x5ca4e9=_0x5ca4e9||0xc8;return function(_0x331c0a){if(_0x331c0a){return _0x15b400['status'](_0x5ca4e9)['json'](_0x331c0a);}};}function respondWithFilteredResult(_0x35c3f3,_0x3a77a3){return function(_0x55768e){if(_0x55768e){var _0x356a91=typeof _0x3a77a3[_0x13ee('0x1d')]===_0x13ee('0x1e')&&typeof _0x3a77a3['limit']===_0x13ee('0x1e');var _0x323433=_0x55768e[_0x13ee('0x1f')];var _0x2d1e2a=_0x356a91?0x0:_0x3a77a3[_0x13ee('0x1d')];var _0x5e1036=_0x356a91?_0x55768e[_0x13ee('0x1f')]:_0x3a77a3[_0x13ee('0x1d')]+_0x3a77a3['limit'];var _0x48596e;if(_0x5e1036>=_0x323433){_0x5e1036=_0x323433;_0x48596e=0xc8;}else{_0x48596e=0xce;}_0x35c3f3[_0x13ee('0x20')](_0x48596e);return _0x35c3f3[_0x13ee('0x21')](_0x13ee('0x22'),_0x2d1e2a+'-'+_0x5e1036+'/'+_0x323433)[_0x13ee('0x23')](_0x55768e);}return null;};}function patchUpdates(_0x48a76f){return function(_0x1b6ae9){try{jsonpatch[_0x13ee('0x24')](_0x1b6ae9,_0x48a76f,!![]);}catch(_0x3b236b){return BPromise[_0x13ee('0x25')](_0x3b236b);}return _0x1b6ae9[_0x13ee('0x26')]();};}function saveUpdates(_0x387ce6,_0x1779eb){return function(_0x40a54d){if(_0x40a54d){return _0x40a54d[_0x13ee('0x27')](_0x387ce6)[_0x13ee('0x28')](function(_0x23aae3){return _0x23aae3;});}return null;};}function removeEntity(_0xa5a408,_0x4727d6){return function(_0xd5ed2a){if(_0xd5ed2a){return _0xd5ed2a[_0x13ee('0x29')]()[_0x13ee('0x28')](function(){_0xa5a408[_0x13ee('0x20')](0xcc)[_0x13ee('0x1c')]();});}};}function handleEntityNotFound(_0x2ddb25,_0x12e2f9){return function(_0x2ba1b8){if(!_0x2ba1b8){_0x2ddb25[_0x13ee('0x1b')](0x194);}return _0x2ba1b8;};}function handleError(_0x4c4fad,_0x4b2238){_0x4b2238=_0x4b2238||0x1f4;return function(_0x13d242){logger[_0x13ee('0x2a')](_0x13d242[_0x13ee('0x2b')]);if(_0x13d242['name']){delete _0x13d242[_0x13ee('0x2c')];}_0x4c4fad['status'](_0x4b2238)['send'](_0x13d242);};}exports[_0x13ee('0x2d')]=function(_0x38d849,_0x52e044){var _0x4d882f={},_0x387db3={},_0x196578={'count':0x0,'rows':[]};var _0x20303e=_['map'](db['FreshsalesConfiguration'][_0x13ee('0x2e')],function(_0x1cf7d1){return{'name':_0x1cf7d1[_0x13ee('0x2f')],'type':_0x1cf7d1[_0x13ee('0x30')]['key']};});_0x387db3[_0x13ee('0x31')]=_['map'](_0x20303e,_0x13ee('0x2c'));_0x387db3[_0x13ee('0x32')]=_[_0x13ee('0x33')](_0x38d849[_0x13ee('0x32')]);_0x387db3[_0x13ee('0x34')]=_[_0x13ee('0x35')](_0x387db3[_0x13ee('0x31')],_0x387db3[_0x13ee('0x32')]);_0x4d882f[_0x13ee('0x36')]=_[_0x13ee('0x35')](_0x387db3[_0x13ee('0x31')],qs[_0x13ee('0x37')](_0x38d849[_0x13ee('0x32')][_0x13ee('0x37')]));_0x4d882f['attributes']=_0x4d882f[_0x13ee('0x36')]['length']?_0x4d882f[_0x13ee('0x36')]:_0x387db3[_0x13ee('0x31')];if(!_0x38d849[_0x13ee('0x32')][_0x13ee('0x38')](_0x13ee('0x39'))){_0x4d882f[_0x13ee('0x3a')]=qs[_0x13ee('0x3a')](_0x38d849[_0x13ee('0x32')]['limit']);_0x4d882f['offset']=qs['offset'](_0x38d849[_0x13ee('0x32')][_0x13ee('0x1d')]);}_0x4d882f[_0x13ee('0x3b')]=qs[_0x13ee('0x3c')](_0x38d849[_0x13ee('0x32')][_0x13ee('0x3c')]);_0x4d882f[_0x13ee('0x3d')]=qs[_0x13ee('0x34')](_[_0x13ee('0x3e')](_0x38d849[_0x13ee('0x32')],_0x387db3['filters']),_0x20303e);if(_0x38d849[_0x13ee('0x32')][_0x13ee('0x3f')]){_0x4d882f[_0x13ee('0x3d')]=_[_0x13ee('0x40')](_0x4d882f[_0x13ee('0x3d')],{'$or':_['map'](_0x20303e,function(_0x30237b){if(_0x30237b[_0x13ee('0x30')]!=='VIRTUAL'){var _0x45a45d={};_0x45a45d[_0x30237b['name']]={'$like':'%'+_0x38d849[_0x13ee('0x32')]['filter']+'%'};return _0x45a45d;}})});}_0x4d882f=_[_0x13ee('0x40')]({},_0x4d882f,_0x38d849['options']);var _0x57580b={'where':_0x4d882f[_0x13ee('0x3d')]};return db[_0x13ee('0x41')][_0x13ee('0x1f')](_0x57580b)[_0x13ee('0x28')](function(_0x33d93f){_0x196578[_0x13ee('0x1f')]=_0x33d93f;if(_0x38d849['query'][_0x13ee('0x42')]){_0x4d882f[_0x13ee('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x13ee('0x44')](_0x4d882f);})[_0x13ee('0x28')](function(_0x104c5f){_0x196578['rows']=_0x104c5f;return _0x196578;})['then'](respondWithFilteredResult(_0x52e044,_0x4d882f))[_0x13ee('0x45')](handleError(_0x52e044,null));};exports['show']=function(_0xcdccd8,_0x1bc642){var _0x2377ab={'raw':![],'where':{'id':_0xcdccd8[_0x13ee('0x46')]['id']}},_0x44ed8c={};_0x44ed8c['model']=_[_0x13ee('0x33')](db['FreshsalesConfiguration'][_0x13ee('0x2e')]);_0x44ed8c['query']=_[_0x13ee('0x33')](_0xcdccd8[_0x13ee('0x32')]);_0x44ed8c['filters']=_['intersection'](_0x44ed8c['model'],_0x44ed8c[_0x13ee('0x32')]);_0x2377ab[_0x13ee('0x36')]=_['intersection'](_0x44ed8c['model'],qs[_0x13ee('0x37')](_0xcdccd8['query'][_0x13ee('0x37')]));_0x2377ab[_0x13ee('0x36')]=_0x2377ab[_0x13ee('0x36')]['length']?_0x2377ab['attributes']:_0x44ed8c[_0x13ee('0x31')];if(_0xcdccd8[_0x13ee('0x32')][_0x13ee('0x42')]){_0x2377ab[_0x13ee('0x43')]=[{'all':!![]}];}_0x2377ab=_[_0x13ee('0x40')]({},_0x2377ab,_0xcdccd8[_0x13ee('0x47')]);return db[_0x13ee('0x41')][_0x13ee('0x48')](_0x2377ab)[_0x13ee('0x28')](handleEntityNotFound(_0x1bc642,null))[_0x13ee('0x28')](respondWithResult(_0x1bc642,null))[_0x13ee('0x45')](handleError(_0x1bc642,null));};exports[_0x13ee('0x49')]=function(_0x8d93db,_0x26fc4b){return db[_0x13ee('0x41')][_0x13ee('0x49')](_0x8d93db[_0x13ee('0x4a')],{})[_0x13ee('0x28')](respondWithResult(_0x26fc4b,0xc9))[_0x13ee('0x45')](handleError(_0x26fc4b,null));};exports[_0x13ee('0x27')]=function(_0x2528e3,_0x14170f){if(_0x2528e3[_0x13ee('0x4a')]['id']){delete _0x2528e3['body']['id'];}return db[_0x13ee('0x41')][_0x13ee('0x48')]({'where':{'id':_0x2528e3[_0x13ee('0x46')]['id']}})[_0x13ee('0x28')](handleEntityNotFound(_0x14170f,null))[_0x13ee('0x28')](saveUpdates(_0x2528e3['body'],null))[_0x13ee('0x28')](respondWithResult(_0x14170f,null))[_0x13ee('0x45')](handleError(_0x14170f,null));};exports[_0x13ee('0x29')]=function(_0x5a4ae6,_0x4d6e80){return db[_0x13ee('0x41')][_0x13ee('0x48')]({'where':{'id':_0x5a4ae6[_0x13ee('0x46')]['id']}})[_0x13ee('0x28')](handleEntityNotFound(_0x4d6e80,null))[_0x13ee('0x28')](removeEntity(_0x4d6e80,null))[_0x13ee('0x45')](handleError(_0x4d6e80,null));};exports['getSubjects']=function(_0x2bff0e,_0x58b1fc,_0x1e294c){var _0xab24f5={};var _0x3374fd={};var _0x2901d3;var _0x4906cf;return db[_0x13ee('0x41')][_0x13ee('0x4b')]({'where':{'id':_0x2bff0e[_0x13ee('0x46')]['id']}})[_0x13ee('0x28')](handleEntityNotFound(_0x58b1fc,null))['then'](function(_0x4f5c38){if(_0x4f5c38){_0x2901d3=_0x4f5c38;_0x3374fd[_0x13ee('0x31')]=_['keys'](db[_0x13ee('0x4c')][_0x13ee('0x2e')]);_0x3374fd[_0x13ee('0x32')]=_['keys'](_0x2bff0e[_0x13ee('0x32')]);_0x3374fd['filters']=_['intersection'](_0x3374fd['model'],_0x3374fd[_0x13ee('0x32')]);_0xab24f5[_0x13ee('0x36')]=_['intersection'](_0x3374fd[_0x13ee('0x31')],qs[_0x13ee('0x37')](_0x2bff0e[_0x13ee('0x32')][_0x13ee('0x37')]));_0xab24f5[_0x13ee('0x36')]=_0xab24f5['attributes']['length']?_0xab24f5['attributes']:_0x3374fd[_0x13ee('0x31')];_0xab24f5[_0x13ee('0x3b')]=qs[_0x13ee('0x3c')](_0x2bff0e['query'][_0x13ee('0x3c')]);_0xab24f5[_0x13ee('0x3d')]=qs['filters'](_[_0x13ee('0x3e')](_0x2bff0e[_0x13ee('0x32')],_0x3374fd[_0x13ee('0x34')]));if(_0x2bff0e['query'][_0x13ee('0x3f')]){_0xab24f5[_0x13ee('0x3d')]=_[_0x13ee('0x40')](_0xab24f5[_0x13ee('0x3d')],{'$or':_['map'](_0xab24f5[_0x13ee('0x36')],function(_0x2d5b37){var _0x3e26dd={};_0x3e26dd[_0x2d5b37]={'$like':'%'+_0x2bff0e[_0x13ee('0x32')][_0x13ee('0x3f')]+'%'};return _0x3e26dd;})});}_0xab24f5=_[_0x13ee('0x40')]({},_0xab24f5,_0x2bff0e[_0x13ee('0x47')]);return _0x2901d3[_0x13ee('0x4d')](_0xab24f5);}})['then'](function(_0x1b7fd4){if(_0x1b7fd4){_0x4906cf=_0x1b7fd4[_0x13ee('0x4e')];if(!_0x2bff0e[_0x13ee('0x32')][_0x13ee('0x38')](_0x13ee('0x39'))){_0xab24f5[_0x13ee('0x3a')]=qs[_0x13ee('0x3a')](_0x2bff0e['query'][_0x13ee('0x3a')]);_0xab24f5[_0x13ee('0x1d')]=qs[_0x13ee('0x1d')](_0x2bff0e[_0x13ee('0x32')]['offset']);}return _0x2901d3['getSubjects'](_0xab24f5);}})[_0x13ee('0x28')](function(_0x44e393){if(_0x44e393){return _0x44e393?{'count':_0x4906cf,'rows':_0x44e393}:null;}})[_0x13ee('0x28')](respondWithResult(_0x58b1fc,null))[_0x13ee('0x45')](handleError(_0x58b1fc,null));};exports[_0x13ee('0x4f')]=function(_0x45d7e9,_0x34fa1e,_0x374b74){var _0x4ec769={};var _0x220529={};var _0x479d88;var _0x55d3ed;return db[_0x13ee('0x41')][_0x13ee('0x4b')]({'where':{'id':_0x45d7e9[_0x13ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x34fa1e,null))[_0x13ee('0x28')](function(_0x54a4d5){if(_0x54a4d5){_0x479d88=_0x54a4d5;_0x220529[_0x13ee('0x31')]=_[_0x13ee('0x33')](db[_0x13ee('0x4c')][_0x13ee('0x2e')]);_0x220529[_0x13ee('0x32')]=_[_0x13ee('0x33')](_0x45d7e9[_0x13ee('0x32')]);_0x220529[_0x13ee('0x34')]=_['intersection'](_0x220529[_0x13ee('0x31')],_0x220529['query']);_0x4ec769[_0x13ee('0x36')]=_[_0x13ee('0x35')](_0x220529[_0x13ee('0x31')],qs['fields'](_0x45d7e9[_0x13ee('0x32')][_0x13ee('0x37')]));_0x4ec769[_0x13ee('0x36')]=_0x4ec769[_0x13ee('0x36')][_0x13ee('0x4e')]?_0x4ec769[_0x13ee('0x36')]:_0x220529['model'];_0x4ec769['order']=qs[_0x13ee('0x3c')](_0x45d7e9['query'][_0x13ee('0x3c')]);_0x4ec769[_0x13ee('0x3d')]=qs[_0x13ee('0x34')](_[_0x13ee('0x3e')](_0x45d7e9['query'],_0x220529[_0x13ee('0x34')]));if(_0x45d7e9[_0x13ee('0x32')][_0x13ee('0x3f')]){_0x4ec769[_0x13ee('0x3d')]=_[_0x13ee('0x40')](_0x4ec769[_0x13ee('0x3d')],{'$or':_[_0x13ee('0x50')](_0x4ec769[_0x13ee('0x36')],function(_0xc2d2a7){var _0x42f084={};_0x42f084[_0xc2d2a7]={'$like':'%'+_0x45d7e9[_0x13ee('0x32')][_0x13ee('0x3f')]+'%'};return _0x42f084;})});}_0x4ec769=_[_0x13ee('0x40')]({},_0x4ec769,_0x45d7e9[_0x13ee('0x47')]);return _0x479d88[_0x13ee('0x4f')](_0x4ec769);}})[_0x13ee('0x28')](function(_0xf4a78b){if(_0xf4a78b){_0x55d3ed=_0xf4a78b[_0x13ee('0x4e')];if(!_0x45d7e9['query'][_0x13ee('0x38')](_0x13ee('0x39'))){_0x4ec769['limit']=qs[_0x13ee('0x3a')](_0x45d7e9[_0x13ee('0x32')][_0x13ee('0x3a')]);_0x4ec769[_0x13ee('0x1d')]=qs[_0x13ee('0x1d')](_0x45d7e9[_0x13ee('0x32')][_0x13ee('0x1d')]);}return _0x479d88[_0x13ee('0x4f')](_0x4ec769);}})[_0x13ee('0x28')](function(_0x323e15){if(_0x323e15){return _0x323e15?{'count':_0x55d3ed,'rows':_0x323e15}:null;}})[_0x13ee('0x28')](respondWithResult(_0x34fa1e,null))[_0x13ee('0x45')](handleError(_0x34fa1e,null));};exports[_0x13ee('0x51')]=function(_0x5f50ad,_0xb1c831,_0x4b5e79){var _0x55e248={};var _0xe83729={};var _0x56b310;var _0x135bc3;return db['FreshsalesConfiguration'][_0x13ee('0x4b')]({'where':{'id':_0x5f50ad[_0x13ee('0x46')]['id']}})['then'](handleEntityNotFound(_0xb1c831,null))[_0x13ee('0x28')](function(_0x29eca8){if(_0x29eca8){_0x56b310=_0x29eca8;_0xe83729[_0x13ee('0x31')]=_[_0x13ee('0x33')](db[_0x13ee('0x4c')][_0x13ee('0x2e')]);_0xe83729['query']=_[_0x13ee('0x33')](_0x5f50ad['query']);_0xe83729[_0x13ee('0x34')]=_[_0x13ee('0x35')](_0xe83729['model'],_0xe83729['query']);_0x55e248[_0x13ee('0x36')]=_[_0x13ee('0x35')](_0xe83729[_0x13ee('0x31')],qs[_0x13ee('0x37')](_0x5f50ad[_0x13ee('0x32')][_0x13ee('0x37')]));_0x55e248[_0x13ee('0x36')]=_0x55e248[_0x13ee('0x36')][_0x13ee('0x4e')]?_0x55e248[_0x13ee('0x36')]:_0xe83729[_0x13ee('0x31')];_0x55e248[_0x13ee('0x3b')]=qs[_0x13ee('0x3c')](_0x5f50ad[_0x13ee('0x32')]['sort']);_0x55e248[_0x13ee('0x3d')]=qs[_0x13ee('0x34')](_['pick'](_0x5f50ad[_0x13ee('0x32')],_0xe83729[_0x13ee('0x34')]));if(_0x5f50ad[_0x13ee('0x32')][_0x13ee('0x3f')]){_0x55e248[_0x13ee('0x3d')]=_['merge'](_0x55e248['where'],{'$or':_[_0x13ee('0x50')](_0x55e248[_0x13ee('0x36')],function(_0x5a5b7b){var _0x2dbd5b={};_0x2dbd5b[_0x5a5b7b]={'$like':'%'+_0x5f50ad[_0x13ee('0x32')][_0x13ee('0x3f')]+'%'};return _0x2dbd5b;})});}_0x55e248=_[_0x13ee('0x40')]({},_0x55e248,_0x5f50ad[_0x13ee('0x47')]);return _0x56b310['getFields'](_0x55e248);}})['then'](function(_0x55edef){if(_0x55edef){_0x135bc3=_0x55edef[_0x13ee('0x4e')];if(!_0x5f50ad[_0x13ee('0x32')]['hasOwnProperty'](_0x13ee('0x39'))){_0x55e248[_0x13ee('0x3a')]=qs[_0x13ee('0x3a')](_0x5f50ad['query'][_0x13ee('0x3a')]);_0x55e248[_0x13ee('0x1d')]=qs[_0x13ee('0x1d')](_0x5f50ad[_0x13ee('0x32')][_0x13ee('0x1d')]);}return _0x56b310[_0x13ee('0x51')](_0x55e248);}})[_0x13ee('0x28')](function(_0x31ab0d){if(_0x31ab0d){return _0x31ab0d?{'count':_0x135bc3,'rows':_0x31ab0d}:null;}})['then'](respondWithResult(_0xb1c831,null))[_0x13ee('0x45')](handleError(_0xb1c831,null));}; \ No newline at end of file +var _0xc349=['filter','merge','where','VIRTUAL','options','include','FreshsalesConfiguration','findAll','rows','show','params','includeAll','create','body','catch','find','getSubjects','nolimit','findOne','FreshsalesField','hasOwnProperty','getFields','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick'];(function(_0x2f22b3,_0x40c65a){var _0x292f93=function(_0x138e52){while(--_0x138e52){_0x2f22b3['push'](_0x2f22b3['shift']());}};_0x292f93(++_0x40c65a);}(_0xc349,0x1ab));var _0x9c34=function(_0x4a3890,_0x1699a6){_0x4a3890=_0x4a3890-0x0;var _0x3f1e55=_0xc349[_0x4a3890];return _0x3f1e55;};'use strict';var emlformat=require(_0x9c34('0x0'));var rimraf=require(_0x9c34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c34('0x2'));var moment=require(_0x9c34('0x3'));var BPromise=require(_0x9c34('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c34('0x5'));var sox=require(_0x9c34('0x6'));var csv=require(_0x9c34('0x7'));var ejs=require(_0x9c34('0x8'));var fs=require('fs');var fs_extra=require(_0x9c34('0x9'));var _=require(_0x9c34('0xa'));var squel=require(_0x9c34('0xb'));var crypto=require(_0x9c34('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9c34('0xd'));var toCsv=require(_0x9c34('0x7'));var querystring=require(_0x9c34('0xe'));var Papa=require(_0x9c34('0xf'));var Redis=require(_0x9c34('0x10'));var authService=require(_0x9c34('0x11'));var qs=require(_0x9c34('0x12'));var as=require(_0x9c34('0x13'));var hardwareService=require(_0x9c34('0x14'));var logger=require(_0x9c34('0x15'))(_0x9c34('0x16'));var utils=require(_0x9c34('0x17'));var config=require(_0x9c34('0x18'));var licenseUtil=require(_0x9c34('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a79e3,_0x184c00){_0x184c00=_0x184c00||0xcc;return function(_0x498097){if(_0x498097){return _0x1a79e3[_0x9c34('0x1a')](_0x184c00);}return _0x1a79e3[_0x9c34('0x1b')](_0x184c00)[_0x9c34('0x1c')]();};}function respondWithResult(_0x3eeaca,_0x46f42d){_0x46f42d=_0x46f42d||0xc8;return function(_0x5a24c7){if(_0x5a24c7){return _0x3eeaca[_0x9c34('0x1b')](_0x46f42d)[_0x9c34('0x1d')](_0x5a24c7);}};}function respondWithFilteredResult(_0x22ee7a,_0x56c4d6){return function(_0x5b2721){if(_0x5b2721){var _0x5bd3db=typeof _0x56c4d6[_0x9c34('0x1e')]===_0x9c34('0x1f')&&typeof _0x56c4d6['limit']===_0x9c34('0x1f');var _0x8b2601=_0x5b2721['count'];var _0x522de2=_0x5bd3db?0x0:_0x56c4d6[_0x9c34('0x1e')];var _0x4dcc42=_0x5bd3db?_0x5b2721[_0x9c34('0x20')]:_0x56c4d6['offset']+_0x56c4d6[_0x9c34('0x21')];var _0x197b13;if(_0x4dcc42>=_0x8b2601){_0x4dcc42=_0x8b2601;_0x197b13=0xc8;}else{_0x197b13=0xce;}_0x22ee7a[_0x9c34('0x1b')](_0x197b13);return _0x22ee7a['set'](_0x9c34('0x22'),_0x522de2+'-'+_0x4dcc42+'/'+_0x8b2601)[_0x9c34('0x1d')](_0x5b2721);}return null;};}function patchUpdates(_0x3afbda){return function(_0x339492){try{jsonpatch[_0x9c34('0x23')](_0x339492,_0x3afbda,!![]);}catch(_0x1ebd03){return BPromise[_0x9c34('0x24')](_0x1ebd03);}return _0x339492[_0x9c34('0x25')]();};}function saveUpdates(_0xf01ee4,_0x1b17f8){return function(_0x422298){if(_0x422298){return _0x422298[_0x9c34('0x26')](_0xf01ee4)[_0x9c34('0x27')](function(_0x256a5f){return _0x256a5f;});}return null;};}function removeEntity(_0x3926af,_0x44d56b){return function(_0x12a611){if(_0x12a611){return _0x12a611['destroy']()[_0x9c34('0x27')](function(){_0x3926af['status'](0xcc)[_0x9c34('0x1c')]();});}};}function handleEntityNotFound(_0x4704e8,_0x518ded){return function(_0x4120a4){if(!_0x4120a4){_0x4704e8[_0x9c34('0x1a')](0x194);}return _0x4120a4;};}function handleError(_0x4d084b,_0x282636){_0x282636=_0x282636||0x1f4;return function(_0x3efa65){logger[_0x9c34('0x28')](_0x3efa65[_0x9c34('0x29')]);if(_0x3efa65['name']){delete _0x3efa65[_0x9c34('0x2a')];}_0x4d084b[_0x9c34('0x1b')](_0x282636)[_0x9c34('0x2b')](_0x3efa65);};}exports[_0x9c34('0x2c')]=function(_0x8d8994,_0x2cbc9c){var _0xfebff8={},_0x3b0b72={},_0x504b5d={'count':0x0,'rows':[]};var _0x2c50cb=_[_0x9c34('0x2d')](db['FreshsalesConfiguration'][_0x9c34('0x2e')],function(_0xd901d7){return{'name':_0xd901d7['fieldName'],'type':_0xd901d7[_0x9c34('0x2f')]['key']};});_0x3b0b72[_0x9c34('0x30')]=_[_0x9c34('0x2d')](_0x2c50cb,_0x9c34('0x2a'));_0x3b0b72[_0x9c34('0x31')]=_[_0x9c34('0x32')](_0x8d8994['query']);_0x3b0b72[_0x9c34('0x33')]=_[_0x9c34('0x34')](_0x3b0b72[_0x9c34('0x30')],_0x3b0b72[_0x9c34('0x31')]);_0xfebff8[_0x9c34('0x35')]=_[_0x9c34('0x34')](_0x3b0b72[_0x9c34('0x30')],qs[_0x9c34('0x36')](_0x8d8994[_0x9c34('0x31')]['fields']));_0xfebff8['attributes']=_0xfebff8[_0x9c34('0x35')][_0x9c34('0x37')]?_0xfebff8[_0x9c34('0x35')]:_0x3b0b72[_0x9c34('0x30')];if(!_0x8d8994[_0x9c34('0x31')]['hasOwnProperty']('nolimit')){_0xfebff8[_0x9c34('0x21')]=qs[_0x9c34('0x21')](_0x8d8994[_0x9c34('0x31')][_0x9c34('0x21')]);_0xfebff8[_0x9c34('0x1e')]=qs[_0x9c34('0x1e')](_0x8d8994[_0x9c34('0x31')]['offset']);}_0xfebff8[_0x9c34('0x38')]=qs['sort'](_0x8d8994[_0x9c34('0x31')][_0x9c34('0x39')]);_0xfebff8['where']=qs[_0x9c34('0x33')](_[_0x9c34('0x3a')](_0x8d8994[_0x9c34('0x31')],_0x3b0b72[_0x9c34('0x33')]),_0x2c50cb);if(_0x8d8994[_0x9c34('0x31')][_0x9c34('0x3b')]){_0xfebff8['where']=_[_0x9c34('0x3c')](_0xfebff8[_0x9c34('0x3d')],{'$or':_[_0x9c34('0x2d')](_0x2c50cb,function(_0xe63f1f){if(_0xe63f1f[_0x9c34('0x2f')]!==_0x9c34('0x3e')){var _0x2944eb={};_0x2944eb[_0xe63f1f[_0x9c34('0x2a')]]={'$like':'%'+_0x8d8994['query'][_0x9c34('0x3b')]+'%'};return _0x2944eb;}})});}_0xfebff8=_[_0x9c34('0x3c')]({},_0xfebff8,_0x8d8994[_0x9c34('0x3f')]);var _0x359c4e={'where':_0xfebff8[_0x9c34('0x3d')]};return db['FreshsalesConfiguration'][_0x9c34('0x20')](_0x359c4e)[_0x9c34('0x27')](function(_0xf2d857){_0x504b5d[_0x9c34('0x20')]=_0xf2d857;if(_0x8d8994[_0x9c34('0x31')]['includeAll']){_0xfebff8[_0x9c34('0x40')]=[{'all':!![]}];}return db[_0x9c34('0x41')][_0x9c34('0x42')](_0xfebff8);})[_0x9c34('0x27')](function(_0x15131e){_0x504b5d[_0x9c34('0x43')]=_0x15131e;return _0x504b5d;})[_0x9c34('0x27')](respondWithFilteredResult(_0x2cbc9c,_0xfebff8))['catch'](handleError(_0x2cbc9c,null));};exports[_0x9c34('0x44')]=function(_0x34dd04,_0x179334){var _0x4388c9={'raw':![],'where':{'id':_0x34dd04[_0x9c34('0x45')]['id']}},_0x490cbf={};_0x490cbf[_0x9c34('0x30')]=_['keys'](db[_0x9c34('0x41')][_0x9c34('0x2e')]);_0x490cbf[_0x9c34('0x31')]=_['keys'](_0x34dd04[_0x9c34('0x31')]);_0x490cbf[_0x9c34('0x33')]=_['intersection'](_0x490cbf[_0x9c34('0x30')],_0x490cbf[_0x9c34('0x31')]);_0x4388c9[_0x9c34('0x35')]=_['intersection'](_0x490cbf[_0x9c34('0x30')],qs[_0x9c34('0x36')](_0x34dd04[_0x9c34('0x31')][_0x9c34('0x36')]));_0x4388c9[_0x9c34('0x35')]=_0x4388c9[_0x9c34('0x35')]['length']?_0x4388c9['attributes']:_0x490cbf[_0x9c34('0x30')];if(_0x34dd04[_0x9c34('0x31')][_0x9c34('0x46')]){_0x4388c9[_0x9c34('0x40')]=[{'all':!![]}];}_0x4388c9=_['merge']({},_0x4388c9,_0x34dd04['options']);return db[_0x9c34('0x41')]['find'](_0x4388c9)[_0x9c34('0x27')](handleEntityNotFound(_0x179334,null))['then'](respondWithResult(_0x179334,null))['catch'](handleError(_0x179334,null));};exports[_0x9c34('0x47')]=function(_0x53771b,_0x2ecca1){return db['FreshsalesConfiguration'][_0x9c34('0x47')](_0x53771b[_0x9c34('0x48')],{})[_0x9c34('0x27')](respondWithResult(_0x2ecca1,0xc9))[_0x9c34('0x49')](handleError(_0x2ecca1,null));};exports[_0x9c34('0x26')]=function(_0x4f66c3,_0x124178){if(_0x4f66c3['body']['id']){delete _0x4f66c3[_0x9c34('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x9c34('0x4a')]({'where':{'id':_0x4f66c3[_0x9c34('0x45')]['id']}})[_0x9c34('0x27')](handleEntityNotFound(_0x124178,null))[_0x9c34('0x27')](saveUpdates(_0x4f66c3[_0x9c34('0x48')],null))[_0x9c34('0x27')](respondWithResult(_0x124178,null))['catch'](handleError(_0x124178,null));};exports['destroy']=function(_0x4ccb37,_0x19d72a){return db[_0x9c34('0x41')][_0x9c34('0x4a')]({'where':{'id':_0x4ccb37[_0x9c34('0x45')]['id']}})[_0x9c34('0x27')](handleEntityNotFound(_0x19d72a,null))[_0x9c34('0x27')](removeEntity(_0x19d72a,null))[_0x9c34('0x49')](handleError(_0x19d72a,null));};exports[_0x9c34('0x4b')]=function(_0x2ce4fa,_0x463d2b,_0x3d8e56){var _0x5239e1={};var _0x3d295d={};var _0x45b40b;var _0x36ad83;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x2ce4fa[_0x9c34('0x45')]['id']}})[_0x9c34('0x27')](handleEntityNotFound(_0x463d2b,null))[_0x9c34('0x27')](function(_0x35bf47){if(_0x35bf47){_0x45b40b=_0x35bf47;_0x3d295d[_0x9c34('0x30')]=_[_0x9c34('0x32')](db['FreshsalesField'][_0x9c34('0x2e')]);_0x3d295d[_0x9c34('0x31')]=_[_0x9c34('0x32')](_0x2ce4fa[_0x9c34('0x31')]);_0x3d295d['filters']=_[_0x9c34('0x34')](_0x3d295d[_0x9c34('0x30')],_0x3d295d[_0x9c34('0x31')]);_0x5239e1[_0x9c34('0x35')]=_[_0x9c34('0x34')](_0x3d295d[_0x9c34('0x30')],qs['fields'](_0x2ce4fa[_0x9c34('0x31')][_0x9c34('0x36')]));_0x5239e1[_0x9c34('0x35')]=_0x5239e1[_0x9c34('0x35')][_0x9c34('0x37')]?_0x5239e1['attributes']:_0x3d295d['model'];_0x5239e1[_0x9c34('0x38')]=qs[_0x9c34('0x39')](_0x2ce4fa['query'][_0x9c34('0x39')]);_0x5239e1[_0x9c34('0x3d')]=qs[_0x9c34('0x33')](_[_0x9c34('0x3a')](_0x2ce4fa[_0x9c34('0x31')],_0x3d295d['filters']));if(_0x2ce4fa[_0x9c34('0x31')]['filter']){_0x5239e1['where']=_[_0x9c34('0x3c')](_0x5239e1[_0x9c34('0x3d')],{'$or':_[_0x9c34('0x2d')](_0x5239e1[_0x9c34('0x35')],function(_0x4fe65b){var _0x48fe47={};_0x48fe47[_0x4fe65b]={'$like':'%'+_0x2ce4fa['query']['filter']+'%'};return _0x48fe47;})});}_0x5239e1=_[_0x9c34('0x3c')]({},_0x5239e1,_0x2ce4fa[_0x9c34('0x3f')]);return _0x45b40b[_0x9c34('0x4b')](_0x5239e1);}})[_0x9c34('0x27')](function(_0xfe73e7){if(_0xfe73e7){_0x36ad83=_0xfe73e7[_0x9c34('0x37')];if(!_0x2ce4fa['query']['hasOwnProperty'](_0x9c34('0x4c'))){_0x5239e1[_0x9c34('0x21')]=qs['limit'](_0x2ce4fa[_0x9c34('0x31')][_0x9c34('0x21')]);_0x5239e1[_0x9c34('0x1e')]=qs['offset'](_0x2ce4fa[_0x9c34('0x31')]['offset']);}return _0x45b40b['getSubjects'](_0x5239e1);}})[_0x9c34('0x27')](function(_0x5ae402){if(_0x5ae402){return _0x5ae402?{'count':_0x36ad83,'rows':_0x5ae402}:null;}})[_0x9c34('0x27')](respondWithResult(_0x463d2b,null))[_0x9c34('0x49')](handleError(_0x463d2b,null));};exports['getDescriptions']=function(_0x381bcf,_0x1272de,_0x336715){var _0x15a85b={};var _0x4158b2={};var _0xabc60b;var _0x16585b;return db[_0x9c34('0x41')][_0x9c34('0x4d')]({'where':{'id':_0x381bcf[_0x9c34('0x45')]['id']}})[_0x9c34('0x27')](handleEntityNotFound(_0x1272de,null))['then'](function(_0x36a2d9){if(_0x36a2d9){_0xabc60b=_0x36a2d9;_0x4158b2[_0x9c34('0x30')]=_[_0x9c34('0x32')](db[_0x9c34('0x4e')][_0x9c34('0x2e')]);_0x4158b2[_0x9c34('0x31')]=_[_0x9c34('0x32')](_0x381bcf[_0x9c34('0x31')]);_0x4158b2[_0x9c34('0x33')]=_[_0x9c34('0x34')](_0x4158b2[_0x9c34('0x30')],_0x4158b2[_0x9c34('0x31')]);_0x15a85b['attributes']=_[_0x9c34('0x34')](_0x4158b2[_0x9c34('0x30')],qs[_0x9c34('0x36')](_0x381bcf[_0x9c34('0x31')][_0x9c34('0x36')]));_0x15a85b[_0x9c34('0x35')]=_0x15a85b[_0x9c34('0x35')][_0x9c34('0x37')]?_0x15a85b[_0x9c34('0x35')]:_0x4158b2['model'];_0x15a85b[_0x9c34('0x38')]=qs[_0x9c34('0x39')](_0x381bcf['query'][_0x9c34('0x39')]);_0x15a85b[_0x9c34('0x3d')]=qs[_0x9c34('0x33')](_[_0x9c34('0x3a')](_0x381bcf[_0x9c34('0x31')],_0x4158b2[_0x9c34('0x33')]));if(_0x381bcf[_0x9c34('0x31')]['filter']){_0x15a85b['where']=_[_0x9c34('0x3c')](_0x15a85b[_0x9c34('0x3d')],{'$or':_[_0x9c34('0x2d')](_0x15a85b[_0x9c34('0x35')],function(_0xf9d46e){var _0x5363fe={};_0x5363fe[_0xf9d46e]={'$like':'%'+_0x381bcf[_0x9c34('0x31')][_0x9c34('0x3b')]+'%'};return _0x5363fe;})});}_0x15a85b=_[_0x9c34('0x3c')]({},_0x15a85b,_0x381bcf[_0x9c34('0x3f')]);return _0xabc60b['getDescriptions'](_0x15a85b);}})[_0x9c34('0x27')](function(_0x51d97e){if(_0x51d97e){_0x16585b=_0x51d97e[_0x9c34('0x37')];if(!_0x381bcf['query'][_0x9c34('0x4f')]('nolimit')){_0x15a85b['limit']=qs[_0x9c34('0x21')](_0x381bcf[_0x9c34('0x31')][_0x9c34('0x21')]);_0x15a85b['offset']=qs[_0x9c34('0x1e')](_0x381bcf['query'][_0x9c34('0x1e')]);}return _0xabc60b['getDescriptions'](_0x15a85b);}})[_0x9c34('0x27')](function(_0x984ab5){if(_0x984ab5){return _0x984ab5?{'count':_0x16585b,'rows':_0x984ab5}:null;}})['then'](respondWithResult(_0x1272de,null))['catch'](handleError(_0x1272de,null));};exports[_0x9c34('0x50')]=function(_0x378fdc,_0x4ad2ea,_0x416d52){var _0x249eea={};var _0xb35fd6={};var _0x440575;var _0x39b0ca;return db[_0x9c34('0x41')][_0x9c34('0x4d')]({'where':{'id':_0x378fdc[_0x9c34('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ad2ea,null))[_0x9c34('0x27')](function(_0xb26502){if(_0xb26502){_0x440575=_0xb26502;_0xb35fd6[_0x9c34('0x30')]=_['keys'](db['FreshsalesField'][_0x9c34('0x2e')]);_0xb35fd6[_0x9c34('0x31')]=_[_0x9c34('0x32')](_0x378fdc[_0x9c34('0x31')]);_0xb35fd6[_0x9c34('0x33')]=_['intersection'](_0xb35fd6[_0x9c34('0x30')],_0xb35fd6['query']);_0x249eea[_0x9c34('0x35')]=_['intersection'](_0xb35fd6[_0x9c34('0x30')],qs[_0x9c34('0x36')](_0x378fdc[_0x9c34('0x31')][_0x9c34('0x36')]));_0x249eea['attributes']=_0x249eea[_0x9c34('0x35')][_0x9c34('0x37')]?_0x249eea['attributes']:_0xb35fd6[_0x9c34('0x30')];_0x249eea[_0x9c34('0x38')]=qs[_0x9c34('0x39')](_0x378fdc[_0x9c34('0x31')][_0x9c34('0x39')]);_0x249eea[_0x9c34('0x3d')]=qs['filters'](_[_0x9c34('0x3a')](_0x378fdc[_0x9c34('0x31')],_0xb35fd6[_0x9c34('0x33')]));if(_0x378fdc['query'][_0x9c34('0x3b')]){_0x249eea[_0x9c34('0x3d')]=_[_0x9c34('0x3c')](_0x249eea[_0x9c34('0x3d')],{'$or':_['map'](_0x249eea[_0x9c34('0x35')],function(_0x6256fb){var _0x221c37={};_0x221c37[_0x6256fb]={'$like':'%'+_0x378fdc[_0x9c34('0x31')][_0x9c34('0x3b')]+'%'};return _0x221c37;})});}_0x249eea=_[_0x9c34('0x3c')]({},_0x249eea,_0x378fdc[_0x9c34('0x3f')]);return _0x440575[_0x9c34('0x50')](_0x249eea);}})[_0x9c34('0x27')](function(_0x44f7ef){if(_0x44f7ef){_0x39b0ca=_0x44f7ef[_0x9c34('0x37')];if(!_0x378fdc[_0x9c34('0x31')]['hasOwnProperty'](_0x9c34('0x4c'))){_0x249eea[_0x9c34('0x21')]=qs['limit'](_0x378fdc['query']['limit']);_0x249eea[_0x9c34('0x1e')]=qs[_0x9c34('0x1e')](_0x378fdc[_0x9c34('0x31')]['offset']);}return _0x440575[_0x9c34('0x50')](_0x249eea);}})[_0x9c34('0x27')](function(_0x1c85d4){if(_0x1c85d4){return _0x1c85d4?{'count':_0x39b0ca,'rows':_0x1c85d4}:null;}})[_0x9c34('0x27')](respondWithResult(_0x4ad2ea,null))[_0x9c34('0x49')](handleError(_0x4ad2ea,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4fa2111..1848947 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 _0xe5f2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','lodash','util'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0xe5f2,0x8d));var _0x2e5f=function(_0x229dcf,_0x508ecd){_0x229dcf=_0x229dcf-0x0;var _0x468513=_0xe5f2[_0x229dcf];return _0x468513;};'use strict';var _=require(_0x2e5f('0x0'));var util=require(_0x2e5f('0x1'));var logger=require(_0x2e5f('0x2'))(_0x2e5f('0x3'));var moment=require(_0x2e5f('0x4'));var BPromise=require(_0x2e5f('0x5'));var rp=require(_0x2e5f('0x6'));var fs=require('fs');var path=require(_0x2e5f('0x7'));var rimraf=require(_0x2e5f('0x8'));var config=require(_0x2e5f('0x9'));var attributes=require(_0x2e5f('0xa'));module[_0x2e5f('0xb')]=function(_0x2c8b87,_0x514f90){return _0x2c8b87[_0x2e5f('0xc')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf469=['int_freshsales_configurations','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xf469,0xb5));var _0x9f46=function(_0x54304c,_0x1d57d2){_0x54304c=_0x54304c-0x0;var _0x5f32e6=_0xf469[_0x54304c];return _0x5f32e6;};'use strict';var _=require('lodash');var util=require(_0x9f46('0x0'));var logger=require('../../config/logger')(_0x9f46('0x1'));var moment=require(_0x9f46('0x2'));var BPromise=require(_0x9f46('0x3'));var rp=require(_0x9f46('0x4'));var fs=require('fs');var path=require(_0x9f46('0x5'));var rimraf=require('rimraf');var config=require(_0x9f46('0x6'));var attributes=require(_0x9f46('0x7'));module[_0x9f46('0x8')]=function(_0x1e0e14,_0x539805){return _0x1e0e14[_0x9f46('0x9')](_0x9f46('0xa'),attributes,{'tableName':_0x9f46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index d9ef6f9..c64b44d 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 _0xac6d=['catch','lodash','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3a0952,_0x51bb32){var _0xb10b03=function(_0x3fd353){while(--_0x3fd353){_0x3a0952['push'](_0x3a0952['shift']());}};_0xb10b03(++_0x51bb32);}(_0xac6d,0x190));var _0xdac6=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xac6d[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xdac6('0x0'));var util=require('util');var moment=require(_0xdac6('0x1'));var BPromise=require(_0xdac6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdac6('0x3'));var logger=require(_0xdac6('0x4'))('rpc');var config=require(_0xdac6('0x5'));var jayson=require(_0xdac6('0x6'));var client=jayson[_0xdac6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e8f0b,_0x3cea24,_0x1fc2e6){return new BPromise(function(_0x47c70a,_0x31df2f){return client['request'](_0x2e8f0b,_0x1fc2e6)[_0xdac6('0x8')](function(_0x5c4360){logger[_0xdac6('0x9')](_0xdac6('0xa'),_0x3cea24,_0xdac6('0xb'));logger[_0xdac6('0xc')](_0xdac6('0xd'),_0x3cea24,_0xdac6('0xb'),JSON[_0xdac6('0xe')](_0x5c4360));if(_0x5c4360['error']){if(_0x5c4360['error']['code']===0x1f4){logger[_0xdac6('0xf')](_0xdac6('0xa'),_0x3cea24,_0x5c4360['error']['message']);return _0x31df2f(_0x5c4360[_0xdac6('0xf')][_0xdac6('0x10')]);}logger[_0xdac6('0xf')](_0xdac6('0xa'),_0x3cea24,_0x5c4360[_0xdac6('0xf')][_0xdac6('0x10')]);return _0x47c70a(_0x5c4360[_0xdac6('0xf')][_0xdac6('0x10')]);}else{logger['info'](_0xdac6('0xa'),_0x3cea24,'request\x20sent');_0x47c70a(_0x5c4360[_0xdac6('0x11')][_0xdac6('0x10')]);}})[_0xdac6('0x12')](function(_0x34a90){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3cea24,_0x34a90);_0x31df2f(_0x34a90);});});} \ No newline at end of file +var _0x8898=['then','debug','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x222077,_0x180f7c){var _0x59bf61=function(_0x1f4703){while(--_0x1f4703){_0x222077['push'](_0x222077['shift']());}};_0x59bf61(++_0x180f7c);}(_0x8898,0x6b));var _0x8889=function(_0x45388d,_0x35416e){_0x45388d=_0x45388d-0x0;var _0x1cb043=_0x8898[_0x45388d];return _0x1cb043;};'use strict';var _=require(_0x8889('0x0'));var util=require(_0x8889('0x1'));var moment=require(_0x8889('0x2'));var BPromise=require(_0x8889('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8889('0x4'));var db=require(_0x8889('0x5'))['db'];var utils=require(_0x8889('0x6'));var logger=require(_0x8889('0x7'))('rpc');var config=require(_0x8889('0x8'));var jayson=require(_0x8889('0x9'));var client=jayson[_0x8889('0xa')][_0x8889('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3698fd,_0x3c84f8,_0x43ca83){return new BPromise(function(_0x5f9bae,_0x1722a1){return client[_0x8889('0xc')](_0x3698fd,_0x43ca83)[_0x8889('0xd')](function(_0x3af231){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c84f8,'request\x20sent');logger[_0x8889('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3c84f8,'request\x20sent',JSON[_0x8889('0xf')](_0x3af231));if(_0x3af231['error']){if(_0x3af231[_0x8889('0x10')][_0x8889('0x11')]===0x1f4){logger[_0x8889('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c84f8,_0x3af231['error'][_0x8889('0x12')]);return _0x1722a1(_0x3af231[_0x8889('0x10')][_0x8889('0x12')]);}logger[_0x8889('0x10')](_0x8889('0x13'),_0x3c84f8,_0x3af231[_0x8889('0x10')][_0x8889('0x12')]);return _0x5f9bae(_0x3af231[_0x8889('0x10')][_0x8889('0x12')]);}else{logger[_0x8889('0x14')](_0x8889('0x13'),_0x3c84f8,_0x8889('0x15'));_0x5f9bae(_0x3af231[_0x8889('0x16')][_0x8889('0x12')]);}})[_0x8889('0x17')](function(_0x3a900b){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c84f8,_0x3a900b);_0x1722a1(_0x3a900b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f26c753..a2ee5cd 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 _0x44f8=['path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','put','update','exports','multer','util'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x44f8,0x1de));var _0x844f=function(_0x302717,_0x19ecdb){_0x302717=_0x302717-0x0;var _0x10e596=_0x44f8[_0x302717];return _0x10e596;};'use strict';var multer=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var path=require(_0x844f('0x2'));var timeout=require(_0x844f('0x3'));var express=require(_0x844f('0x4'));var router=express[_0x844f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x844f('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x844f('0x7')](),controller[_0x844f('0x8')]);router[_0x844f('0x9')](_0x844f('0xa'),auth[_0x844f('0x7')](),controller[_0x844f('0xb')]);router[_0x844f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x844f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x844f('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x844f('0xf')]=router; \ No newline at end of file +var _0x3036=['get','show','post','create','put','/:id','update','destroy','exports','path','connect-timeout','express','fs-extra','./intFreshsalesField.controller','isAuthenticated','index'];(function(_0x272f1f,_0x393f59){var _0x487711=function(_0xa8235c){while(--_0xa8235c){_0x272f1f['push'](_0x272f1f['shift']());}};_0x487711(++_0x393f59);}(_0x3036,0x1a9));var _0x6303=function(_0x500261,_0x481c7c){_0x500261=_0x500261-0x0;var _0x5ae675=_0x3036[_0x500261];return _0x5ae675;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6303('0x0'));var timeout=require(_0x6303('0x1'));var express=require(_0x6303('0x2'));var router=express['Router']();var fs_extra=require(_0x6303('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6303('0x4'));router['get']('/',auth[_0x6303('0x5')](),controller[_0x6303('0x6')]);router[_0x6303('0x7')]('/:id',auth[_0x6303('0x5')](),controller[_0x6303('0x8')]);router[_0x6303('0x9')]('/',auth[_0x6303('0x5')](),controller[_0x6303('0xa')]);router[_0x6303('0xb')](_0x6303('0xc'),auth[_0x6303('0x5')](),controller[_0x6303('0xd')]);router['delete'](_0x6303('0xc'),auth[_0x6303('0x5')](),controller[_0x6303('0xe')]);module[_0x6303('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f7312ae..23240fc 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 _0xc01d=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2226d3,_0x2e0b8b){var _0x179323=function(_0x4bc5ec){while(--_0x4bc5ec){_0x2226d3['push'](_0x2226d3['shift']());}};_0x179323(++_0x2e0b8b);}(_0xc01d,0x180));var _0xdc01=function(_0x54273e,_0x4eec9f){_0x54273e=_0x54273e-0x0;var _0x35b567=_0xc01d[_0x54273e];return _0x35b567;};'use strict';var Sequelize=require(_0xdc01('0x0'));module[_0xdc01('0x1')]={'type':{'type':Sequelize[_0xdc01('0x2')]('string',_0xdc01('0x3'),_0xdc01('0x4'),_0xdc01('0x5'),_0xdc01('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdc01('0x7')]},'keyType':{'type':Sequelize[_0xdc01('0x2')]('string',_0xdc01('0x3'),_0xdc01('0x4'))},'keyContent':{'type':Sequelize[_0xdc01('0x7')]},'idField':{'type':Sequelize[_0xdc01('0x7')]},'nameField':{'type':Sequelize[_0xdc01('0x7')]},'customField':{'type':Sequelize[_0xdc01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdc01('0x7')]}}; \ No newline at end of file +var _0x4032=['string','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x4032,0x1c6));var _0x2403=function(_0x2437ea,_0x10ff81){_0x2437ea=_0x2437ea-0x0;var _0x4572ac=_0x4032[_0x2437ea];return _0x4572ac;};'use strict';var Sequelize=require('sequelize');module[_0x2403('0x0')]={'type':{'type':Sequelize[_0x2403('0x1')](_0x2403('0x2'),'variable','customVariable',_0x2403('0x3'),_0x2403('0x4')),'defaultValue':_0x2403('0x2')},'content':{'type':Sequelize[_0x2403('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2403('0x1')](_0x2403('0x2'),_0x2403('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x2403('0x5')]},'idField':{'type':Sequelize[_0x2403('0x5')]},'nameField':{'type':Sequelize[_0x2403('0x5')]},'customField':{'type':Sequelize[_0x2403('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2403('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e0f72cb..f2693c1 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 _0xe9fb=['util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','then','error','name','send','index','map','FreshsalesField','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','update','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3758b0,_0x22692e){var _0x306820=function(_0x53ccca){while(--_0x53ccca){_0x3758b0['push'](_0x3758b0['shift']());}};_0x306820(++_0x22692e);}(_0xe9fb,0x16c));var _0xbe9f=function(_0x59cc50,_0xb118a){_0x59cc50=_0x59cc50-0x0;var _0x1ca61a=_0xe9fb[_0x59cc50];return _0x1ca61a;};'use strict';var emlformat=require(_0xbe9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe9f('0x1'));var jsonpatch=require(_0xbe9f('0x2'));var rp=require(_0xbe9f('0x3'));var moment=require(_0xbe9f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe9f('0x5'));var util=require(_0xbe9f('0x6'));var path=require(_0xbe9f('0x7'));var sox=require(_0xbe9f('0x8'));var csv=require('to-csv');var ejs=require(_0xbe9f('0x9'));var fs=require('fs');var fs_extra=require(_0xbe9f('0xa'));var _=require(_0xbe9f('0xb'));var squel=require(_0xbe9f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbe9f('0xd'));var toCsv=require(_0xbe9f('0xe'));var querystring=require(_0xbe9f('0xf'));var Papa=require(_0xbe9f('0x10'));var Redis=require(_0xbe9f('0x11'));var authService=require(_0xbe9f('0x12'));var qs=require(_0xbe9f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe9f('0x14'));var logger=require(_0xbe9f('0x15'))('api');var utils=require(_0xbe9f('0x16'));var config=require(_0xbe9f('0x17'));var licenseUtil=require(_0xbe9f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d7841,_0x1c362c){_0x1c362c=_0x1c362c||0xcc;return function(_0x58d4b6){if(_0x58d4b6){return _0x4d7841[_0xbe9f('0x19')](_0x1c362c);}return _0x4d7841[_0xbe9f('0x1a')](_0x1c362c)[_0xbe9f('0x1b')]();};}function respondWithResult(_0x3d5d9a,_0x348530){_0x348530=_0x348530||0xc8;return function(_0x757179){if(_0x757179){return _0x3d5d9a[_0xbe9f('0x1a')](_0x348530)['json'](_0x757179);}};}function respondWithFilteredResult(_0x1eb8a2,_0x49df96){return function(_0x1f91f2){if(_0x1f91f2){var _0x3d5f59=typeof _0x49df96[_0xbe9f('0x1c')]===_0xbe9f('0x1d')&&typeof _0x49df96[_0xbe9f('0x1e')]===_0xbe9f('0x1d');var _0xc09d66=_0x1f91f2[_0xbe9f('0x1f')];var _0x3f4993=_0x3d5f59?0x0:_0x49df96[_0xbe9f('0x1c')];var _0x34e476=_0x3d5f59?_0x1f91f2['count']:_0x49df96[_0xbe9f('0x1c')]+_0x49df96[_0xbe9f('0x1e')];var _0x58d1ea;if(_0x34e476>=_0xc09d66){_0x34e476=_0xc09d66;_0x58d1ea=0xc8;}else{_0x58d1ea=0xce;}_0x1eb8a2[_0xbe9f('0x1a')](_0x58d1ea);return _0x1eb8a2['set']('Content-Range',_0x3f4993+'-'+_0x34e476+'/'+_0xc09d66)[_0xbe9f('0x20')](_0x1f91f2);}return null;};}function patchUpdates(_0x21adba){return function(_0x12669b){try{jsonpatch[_0xbe9f('0x21')](_0x12669b,_0x21adba,!![]);}catch(_0xf1ada8){return BPromise[_0xbe9f('0x22')](_0xf1ada8);}return _0x12669b[_0xbe9f('0x23')]();};}function saveUpdates(_0x14f993,_0x45511c){return function(_0x4d6344){if(_0x4d6344){return _0x4d6344['update'](_0x14f993)['then'](function(_0x182c17){return _0x182c17;});}return null;};}function removeEntity(_0x38dc55,_0x1b5f09){return function(_0x4ecd09){if(_0x4ecd09){return _0x4ecd09['destroy']()[_0xbe9f('0x24')](function(){_0x38dc55[_0xbe9f('0x1a')](0xcc)[_0xbe9f('0x1b')]();});}};}function handleEntityNotFound(_0x1f14e0,_0x26863e){return function(_0x1ec626){if(!_0x1ec626){_0x1f14e0[_0xbe9f('0x19')](0x194);}return _0x1ec626;};}function handleError(_0x1f408a,_0x13aa16){_0x13aa16=_0x13aa16||0x1f4;return function(_0x44ceee){logger[_0xbe9f('0x25')](_0x44ceee['stack']);if(_0x44ceee[_0xbe9f('0x26')]){delete _0x44ceee[_0xbe9f('0x26')];}_0x1f408a[_0xbe9f('0x1a')](_0x13aa16)[_0xbe9f('0x27')](_0x44ceee);};}exports[_0xbe9f('0x28')]=function(_0x16d39a,_0xd322bd){var _0x54ae23={},_0x26928b={},_0x137a30={'count':0x0,'rows':[]};var _0x58240e=_[_0xbe9f('0x29')](db[_0xbe9f('0x2a')]['rawAttributes'],function(_0x45b8c1){return{'name':_0x45b8c1[_0xbe9f('0x2b')],'type':_0x45b8c1[_0xbe9f('0x2c')]['key']};});_0x26928b[_0xbe9f('0x2d')]=_[_0xbe9f('0x29')](_0x58240e,_0xbe9f('0x26'));_0x26928b['query']=_[_0xbe9f('0x2e')](_0x16d39a[_0xbe9f('0x2f')]);_0x26928b['filters']=_[_0xbe9f('0x30')](_0x26928b['model'],_0x26928b[_0xbe9f('0x2f')]);_0x54ae23['attributes']=_[_0xbe9f('0x30')](_0x26928b['model'],qs[_0xbe9f('0x31')](_0x16d39a['query'][_0xbe9f('0x31')]));_0x54ae23[_0xbe9f('0x32')]=_0x54ae23[_0xbe9f('0x32')][_0xbe9f('0x33')]?_0x54ae23[_0xbe9f('0x32')]:_0x26928b['model'];if(!_0x16d39a[_0xbe9f('0x2f')][_0xbe9f('0x34')](_0xbe9f('0x35'))){_0x54ae23[_0xbe9f('0x1e')]=qs['limit'](_0x16d39a[_0xbe9f('0x2f')][_0xbe9f('0x1e')]);_0x54ae23['offset']=qs[_0xbe9f('0x1c')](_0x16d39a[_0xbe9f('0x2f')]['offset']);}_0x54ae23[_0xbe9f('0x36')]=qs[_0xbe9f('0x37')](_0x16d39a[_0xbe9f('0x2f')][_0xbe9f('0x37')]);_0x54ae23[_0xbe9f('0x38')]=qs['filters'](_[_0xbe9f('0x39')](_0x16d39a[_0xbe9f('0x2f')],_0x26928b[_0xbe9f('0x3a')]),_0x58240e);if(_0x16d39a[_0xbe9f('0x2f')]['filter']){_0x54ae23[_0xbe9f('0x38')]=_[_0xbe9f('0x3b')](_0x54ae23[_0xbe9f('0x38')],{'$or':_[_0xbe9f('0x29')](_0x58240e,function(_0x3ee57b){if(_0x3ee57b[_0xbe9f('0x2c')]!==_0xbe9f('0x3c')){var _0x5c3d63={};_0x5c3d63[_0x3ee57b[_0xbe9f('0x26')]]={'$like':'%'+_0x16d39a[_0xbe9f('0x2f')][_0xbe9f('0x3d')]+'%'};return _0x5c3d63;}})});}_0x54ae23=_[_0xbe9f('0x3b')]({},_0x54ae23,_0x16d39a['options']);var _0x3eb1e0={'where':_0x54ae23['where']};return db['FreshsalesField'][_0xbe9f('0x1f')](_0x3eb1e0)[_0xbe9f('0x24')](function(_0x93b202){_0x137a30[_0xbe9f('0x1f')]=_0x93b202;if(_0x16d39a[_0xbe9f('0x2f')][_0xbe9f('0x3e')]){_0x54ae23[_0xbe9f('0x3f')]=[{'all':!![]}];}return db[_0xbe9f('0x2a')][_0xbe9f('0x40')](_0x54ae23);})[_0xbe9f('0x24')](function(_0x145888){_0x137a30[_0xbe9f('0x41')]=_0x145888;return _0x137a30;})[_0xbe9f('0x24')](respondWithFilteredResult(_0xd322bd,_0x54ae23))[_0xbe9f('0x42')](handleError(_0xd322bd,null));};exports['show']=function(_0x5d4c7e,_0x6a52d0){var _0x4de466={'raw':!![],'where':{'id':_0x5d4c7e['params']['id']}},_0x5c7115={};_0x5c7115['model']=_[_0xbe9f('0x2e')](db[_0xbe9f('0x2a')][_0xbe9f('0x43')]);_0x5c7115['query']=_[_0xbe9f('0x2e')](_0x5d4c7e[_0xbe9f('0x2f')]);_0x5c7115[_0xbe9f('0x3a')]=_[_0xbe9f('0x30')](_0x5c7115[_0xbe9f('0x2d')],_0x5c7115[_0xbe9f('0x2f')]);_0x4de466[_0xbe9f('0x32')]=_['intersection'](_0x5c7115[_0xbe9f('0x2d')],qs[_0xbe9f('0x31')](_0x5d4c7e[_0xbe9f('0x2f')][_0xbe9f('0x31')]));_0x4de466[_0xbe9f('0x32')]=_0x4de466[_0xbe9f('0x32')][_0xbe9f('0x33')]?_0x4de466[_0xbe9f('0x32')]:_0x5c7115[_0xbe9f('0x2d')];if(_0x5d4c7e[_0xbe9f('0x2f')]['includeAll']){_0x4de466[_0xbe9f('0x3f')]=[{'all':!![]}];}_0x4de466=_[_0xbe9f('0x3b')]({},_0x4de466,_0x5d4c7e['options']);return db[_0xbe9f('0x2a')][_0xbe9f('0x44')](_0x4de466)['then'](handleEntityNotFound(_0x6a52d0,null))[_0xbe9f('0x24')](respondWithResult(_0x6a52d0,null))[_0xbe9f('0x42')](handleError(_0x6a52d0,null));};exports['create']=function(_0x572bb1,_0x1fe697){return db[_0xbe9f('0x2a')][_0xbe9f('0x45')](_0x572bb1[_0xbe9f('0x46')],{})[_0xbe9f('0x24')](respondWithResult(_0x1fe697,0xc9))[_0xbe9f('0x42')](handleError(_0x1fe697,null));};exports[_0xbe9f('0x47')]=function(_0x1fdfa0,_0x401105){if(_0x1fdfa0['body']['id']){delete _0x1fdfa0[_0xbe9f('0x46')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x1fdfa0[_0xbe9f('0x48')]['id']}})[_0xbe9f('0x24')](handleEntityNotFound(_0x401105,null))[_0xbe9f('0x24')](saveUpdates(_0x1fdfa0['body'],null))['then'](respondWithResult(_0x401105,null))[_0xbe9f('0x42')](handleError(_0x401105,null));};exports[_0xbe9f('0x49')]=function(_0x2764f2,_0x2acfb5){return db[_0xbe9f('0x2a')][_0xbe9f('0x44')]({'where':{'id':_0x2764f2['params']['id']}})['then'](handleEntityNotFound(_0x2acfb5,null))[_0xbe9f('0x24')](removeEntity(_0x2acfb5,null))[_0xbe9f('0x42')](handleError(_0x2acfb5,null));}; \ No newline at end of file +var _0x2185=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','request-promise','mustache','sox','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','FreshsalesField','rawAttributes','fieldName','type','key','model','query'];(function(_0x49f30d,_0x50300a){var _0x2c75fa=function(_0x3a880a){while(--_0x3a880a){_0x49f30d['push'](_0x49f30d['shift']());}};_0x2c75fa(++_0x50300a);}(_0x2185,0x1db));var _0x5218=function(_0x33de06,_0x9fc633){_0x33de06=_0x33de06-0x0;var _0x3d28f9=_0x2185[_0x33de06];return _0x3d28f9;};'use strict';var emlformat=require(_0x5218('0x0'));var rimraf=require(_0x5218('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5218('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5218('0x3'));var util=require('util');var path=require('path');var sox=require(_0x5218('0x4'));var csv=require('to-csv');var ejs=require(_0x5218('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5218('0x6'));var squel=require(_0x5218('0x7'));var crypto=require(_0x5218('0x8'));var jsforce=require(_0x5218('0x9'));var deskjs=require(_0x5218('0xa'));var toCsv=require(_0x5218('0xb'));var querystring=require(_0x5218('0xc'));var Papa=require(_0x5218('0xd'));var Redis=require(_0x5218('0xe'));var authService=require(_0x5218('0xf'));var qs=require(_0x5218('0x10'));var as=require(_0x5218('0x11'));var hardwareService=require(_0x5218('0x12'));var logger=require(_0x5218('0x13'))(_0x5218('0x14'));var utils=require(_0x5218('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5218('0x16'));var db=require(_0x5218('0x17'))['db'];function respondWithStatusCode(_0x3dc97e,_0x1d265d){_0x1d265d=_0x1d265d||0xcc;return function(_0x4bd437){if(_0x4bd437){return _0x3dc97e[_0x5218('0x18')](_0x1d265d);}return _0x3dc97e[_0x5218('0x19')](_0x1d265d)[_0x5218('0x1a')]();};}function respondWithResult(_0x1275b7,_0x89a7d1){_0x89a7d1=_0x89a7d1||0xc8;return function(_0x234a47){if(_0x234a47){return _0x1275b7[_0x5218('0x19')](_0x89a7d1)[_0x5218('0x1b')](_0x234a47);}};}function respondWithFilteredResult(_0x4853a0,_0x212980){return function(_0x9d2528){if(_0x9d2528){var _0x551532=typeof _0x212980[_0x5218('0x1c')]===_0x5218('0x1d')&&typeof _0x212980[_0x5218('0x1e')]===_0x5218('0x1d');var _0x4a7231=_0x9d2528[_0x5218('0x1f')];var _0x1fa610=_0x551532?0x0:_0x212980[_0x5218('0x1c')];var _0x206870=_0x551532?_0x9d2528[_0x5218('0x1f')]:_0x212980['offset']+_0x212980[_0x5218('0x1e')];var _0x11314c;if(_0x206870>=_0x4a7231){_0x206870=_0x4a7231;_0x11314c=0xc8;}else{_0x11314c=0xce;}_0x4853a0[_0x5218('0x19')](_0x11314c);return _0x4853a0[_0x5218('0x20')](_0x5218('0x21'),_0x1fa610+'-'+_0x206870+'/'+_0x4a7231)[_0x5218('0x1b')](_0x9d2528);}return null;};}function patchUpdates(_0xd72ce5){return function(_0x20f65f){try{jsonpatch[_0x5218('0x22')](_0x20f65f,_0xd72ce5,!![]);}catch(_0x40c460){return BPromise[_0x5218('0x23')](_0x40c460);}return _0x20f65f[_0x5218('0x24')]();};}function saveUpdates(_0x36a69b,_0x1f6715){return function(_0x21ee59){if(_0x21ee59){return _0x21ee59[_0x5218('0x25')](_0x36a69b)['then'](function(_0x3c5586){return _0x3c5586;});}return null;};}function removeEntity(_0x29a290,_0x188ac9){return function(_0x5a9062){if(_0x5a9062){return _0x5a9062[_0x5218('0x26')]()[_0x5218('0x27')](function(){_0x29a290['status'](0xcc)[_0x5218('0x1a')]();});}};}function handleEntityNotFound(_0x1929a2,_0x2ad913){return function(_0x494269){if(!_0x494269){_0x1929a2[_0x5218('0x18')](0x194);}return _0x494269;};}function handleError(_0xa2badd,_0x3cb1e3){_0x3cb1e3=_0x3cb1e3||0x1f4;return function(_0x131d5e){logger[_0x5218('0x28')](_0x131d5e['stack']);if(_0x131d5e[_0x5218('0x29')]){delete _0x131d5e['name'];}_0xa2badd['status'](_0x3cb1e3)[_0x5218('0x2a')](_0x131d5e);};}exports['index']=function(_0x1350e8,_0x3cc526){var _0x9f53b5={},_0xdf18d5={},_0x5eda6b={'count':0x0,'rows':[]};var _0x459595=_['map'](db[_0x5218('0x2b')][_0x5218('0x2c')],function(_0x17c120){return{'name':_0x17c120[_0x5218('0x2d')],'type':_0x17c120[_0x5218('0x2e')][_0x5218('0x2f')]};});_0xdf18d5[_0x5218('0x30')]=_['map'](_0x459595,_0x5218('0x29'));_0xdf18d5[_0x5218('0x31')]=_[_0x5218('0x32')](_0x1350e8[_0x5218('0x31')]);_0xdf18d5[_0x5218('0x33')]=_[_0x5218('0x34')](_0xdf18d5[_0x5218('0x30')],_0xdf18d5['query']);_0x9f53b5['attributes']=_['intersection'](_0xdf18d5[_0x5218('0x30')],qs[_0x5218('0x35')](_0x1350e8['query'][_0x5218('0x35')]));_0x9f53b5[_0x5218('0x36')]=_0x9f53b5[_0x5218('0x36')][_0x5218('0x37')]?_0x9f53b5['attributes']:_0xdf18d5[_0x5218('0x30')];if(!_0x1350e8[_0x5218('0x31')][_0x5218('0x38')](_0x5218('0x39'))){_0x9f53b5[_0x5218('0x1e')]=qs[_0x5218('0x1e')](_0x1350e8[_0x5218('0x31')][_0x5218('0x1e')]);_0x9f53b5[_0x5218('0x1c')]=qs['offset'](_0x1350e8[_0x5218('0x31')][_0x5218('0x1c')]);}_0x9f53b5['order']=qs[_0x5218('0x3a')](_0x1350e8[_0x5218('0x31')][_0x5218('0x3a')]);_0x9f53b5[_0x5218('0x3b')]=qs[_0x5218('0x33')](_[_0x5218('0x3c')](_0x1350e8[_0x5218('0x31')],_0xdf18d5[_0x5218('0x33')]),_0x459595);if(_0x1350e8[_0x5218('0x31')]['filter']){_0x9f53b5[_0x5218('0x3b')]=_[_0x5218('0x3d')](_0x9f53b5['where'],{'$or':_[_0x5218('0x3e')](_0x459595,function(_0x330440){if(_0x330440[_0x5218('0x2e')]!==_0x5218('0x3f')){var _0x3968b2={};_0x3968b2[_0x330440[_0x5218('0x29')]]={'$like':'%'+_0x1350e8['query'][_0x5218('0x40')]+'%'};return _0x3968b2;}})});}_0x9f53b5=_['merge']({},_0x9f53b5,_0x1350e8['options']);var _0x4fadb1={'where':_0x9f53b5['where']};return db[_0x5218('0x2b')][_0x5218('0x1f')](_0x4fadb1)[_0x5218('0x27')](function(_0x4471e7){_0x5eda6b[_0x5218('0x1f')]=_0x4471e7;if(_0x1350e8[_0x5218('0x31')][_0x5218('0x41')]){_0x9f53b5[_0x5218('0x42')]=[{'all':!![]}];}return db['FreshsalesField'][_0x5218('0x43')](_0x9f53b5);})[_0x5218('0x27')](function(_0x37cbc){_0x5eda6b['rows']=_0x37cbc;return _0x5eda6b;})[_0x5218('0x27')](respondWithFilteredResult(_0x3cc526,_0x9f53b5))[_0x5218('0x44')](handleError(_0x3cc526,null));};exports[_0x5218('0x45')]=function(_0x38463c,_0x18e600){var _0x22ea0d={'raw':!![],'where':{'id':_0x38463c[_0x5218('0x46')]['id']}},_0x1d6d20={};_0x1d6d20[_0x5218('0x30')]=_[_0x5218('0x32')](db[_0x5218('0x2b')][_0x5218('0x2c')]);_0x1d6d20[_0x5218('0x31')]=_['keys'](_0x38463c['query']);_0x1d6d20['filters']=_[_0x5218('0x34')](_0x1d6d20[_0x5218('0x30')],_0x1d6d20[_0x5218('0x31')]);_0x22ea0d['attributes']=_['intersection'](_0x1d6d20['model'],qs[_0x5218('0x35')](_0x38463c[_0x5218('0x31')][_0x5218('0x35')]));_0x22ea0d[_0x5218('0x36')]=_0x22ea0d[_0x5218('0x36')][_0x5218('0x37')]?_0x22ea0d[_0x5218('0x36')]:_0x1d6d20[_0x5218('0x30')];if(_0x38463c[_0x5218('0x31')][_0x5218('0x41')]){_0x22ea0d[_0x5218('0x42')]=[{'all':!![]}];}_0x22ea0d=_[_0x5218('0x3d')]({},_0x22ea0d,_0x38463c[_0x5218('0x47')]);return db[_0x5218('0x2b')]['find'](_0x22ea0d)['then'](handleEntityNotFound(_0x18e600,null))['then'](respondWithResult(_0x18e600,null))[_0x5218('0x44')](handleError(_0x18e600,null));};exports[_0x5218('0x48')]=function(_0x3744c8,_0x7b6c31){return db['FreshsalesField']['create'](_0x3744c8[_0x5218('0x49')],{})[_0x5218('0x27')](respondWithResult(_0x7b6c31,0xc9))[_0x5218('0x44')](handleError(_0x7b6c31,null));};exports[_0x5218('0x25')]=function(_0x3930eb,_0x26acd9){if(_0x3930eb[_0x5218('0x49')]['id']){delete _0x3930eb['body']['id'];}return db['FreshsalesField'][_0x5218('0x4a')]({'where':{'id':_0x3930eb['params']['id']}})[_0x5218('0x27')](handleEntityNotFound(_0x26acd9,null))[_0x5218('0x27')](saveUpdates(_0x3930eb[_0x5218('0x49')],null))[_0x5218('0x27')](respondWithResult(_0x26acd9,null))[_0x5218('0x44')](handleError(_0x26acd9,null));};exports['destroy']=function(_0x45446d,_0x1fb189){return db[_0x5218('0x2b')]['find']({'where':{'id':_0x45446d[_0x5218('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fb189,null))[_0x5218('0x27')](removeEntity(_0x1fb189,null))[_0x5218('0x44')](handleError(_0x1fb189,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0b32cf8..f08ceb1 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 _0x2c91=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','lodash'];(function(_0x4d6c4b,_0x5b4be5){var _0x4191d3=function(_0x558495){while(--_0x558495){_0x4d6c4b['push'](_0x4d6c4b['shift']());}};_0x4191d3(++_0x5b4be5);}(_0x2c91,0x158));var _0x12c9=function(_0x5d317e,_0x254bfc){_0x5d317e=_0x5d317e-0x0;var _0x4f9c90=_0x2c91[_0x5d317e];return _0x4f9c90;};'use strict';var _=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var logger=require(_0x12c9('0x2'))(_0x12c9('0x3'));var moment=require(_0x12c9('0x4'));var BPromise=require(_0x12c9('0x5'));var rp=require(_0x12c9('0x6'));var fs=require('fs');var path=require(_0x12c9('0x7'));var rimraf=require('rimraf');var config=require(_0x12c9('0x8'));var attributes=require(_0x12c9('0x9'));module[_0x12c9('0xa')]=function(_0x38bd43,_0x14c359){return _0x38bd43[_0x12c9('0xb')](_0x12c9('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x12c9('0xd'),'fields':[_0x12c9('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e22=['util','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0x5430e7,_0x5051c5){var _0x5dfd45=function(_0x182942){while(--_0x182942){_0x5430e7['push'](_0x5430e7['shift']());}};_0x5dfd45(++_0x5051c5);}(_0x3e22,0xa8));var _0x23e2=function(_0x2c0c28,_0x394236){_0x2c0c28=_0x2c0c28-0x0;var _0x2e7a1d=_0x3e22[_0x2c0c28];return _0x2e7a1d;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var logger=require('../../config/logger')(_0x23e2('0x1'));var moment=require(_0x23e2('0x2'));var BPromise=require(_0x23e2('0x3'));var rp=require(_0x23e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23e2('0x5'));var attributes=require(_0x23e2('0x6'));module['exports']=function(_0x287f8f,_0x433a85){return _0x287f8f[_0x23e2('0x7')](_0x23e2('0x8'),attributes,{'tableName':_0x23e2('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x23e2('0xa'),_0x23e2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 14a18ed..dfb9ada 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 _0xd8fb=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x42639d,_0x2d1f80){var _0x390dff=function(_0x1c742f){while(--_0x1c742f){_0x42639d['push'](_0x42639d['shift']());}};_0x390dff(++_0x2d1f80);}(_0xd8fb,0x99));var _0xbd8f=function(_0x14a0d6,_0x5f0d1d){_0x14a0d6=_0x14a0d6-0x0;var _0x53c73e=_0xd8fb[_0x14a0d6];return _0x53c73e;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});} \ No newline at end of file +var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x39fee5,_0x33f715){_0x39fee5=_0x39fee5-0x0;var _0x43c19d=_0x3f8a[_0x39fee5];return _0x43c19d;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3b6c017..89232f4 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x25407c,_0x17240e){var _0x122428=function(_0x558894){while(--_0x558894){_0x25407c['push'](_0x25407c['shift']());}};_0x122428(++_0x17240e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x36156b,_0x25cc26){var _0x5db905=function(_0x14206f){while(--_0x14206f){_0x36156b['push'](_0x36156b['shift']());}};_0x5db905(++_0x25cc26);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e8eba26..f05a8f8 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 _0x4473=['ENUM','integrationTab','newTab','username','STRING'];(function(_0x48cbe9,_0x3e51be){var _0x3391bd=function(_0x9df1a6){while(--_0x9df1a6){_0x48cbe9['push'](_0x48cbe9['shift']());}};_0x3391bd(++_0x3e51be);}(_0x4473,0x15c));var _0x3447=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4473[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x3447('0x0')},'remoteUri':{'type':Sequelize[_0x3447('0x1')]},'password':{'type':Sequelize[_0x3447('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x3447('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3447('0x2')](_0x3447('0x3'),_0x3447('0x4')),'defaultValue':_0x3447('0x3')}}; \ No newline at end of file +var _0x5d0a=['exports','username','STRING','ENUM','newTab','sequelize'];(function(_0x281a7d,_0x4d57d9){var _0x33f01a=function(_0x3d59fd){while(--_0x3d59fd){_0x281a7d['push'](_0x281a7d['shift']());}};_0x33f01a(++_0x4d57d9);}(_0x5d0a,0x173));var _0xa5d0=function(_0xd46eb6,_0x108309){_0xd46eb6=_0xd46eb6-0x0;var _0x3c31c1=_0x5d0a[_0xd46eb6];return _0x3c31c1;};'use strict';var Sequelize=require(_0xa5d0('0x0'));module[_0xa5d0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xa5d0('0x2')},'remoteUri':{'type':Sequelize[_0xa5d0('0x3')]},'password':{'type':Sequelize[_0xa5d0('0x3')]},'clientId':{'type':Sequelize[_0xa5d0('0x3')]},'clientSecret':{'type':Sequelize[_0xa5d0('0x3')]},'securityToken':{'type':Sequelize[_0xa5d0('0x3')]},'serverUrl':{'type':Sequelize[_0xa5d0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa5d0('0x4')]('integrationTab',_0xa5d0('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 033cd60..f265ace 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 _0xd70c=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','SalesforceAccount','find','create','body','getConfigurations','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','findOne','remoteUri','clientId','username','password','securityToken','substring','lastIndexOf','clientSecret','login','concat','isNil','ticketType','sobject','IsReminderSet','IsRecurrence','Description','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd70c,0x75));var _0xcd70=function(_0x40834b,_0x395fe8){_0x40834b=_0x40834b-0x0;var _0x1a10ed=_0xd70c[_0x40834b];return _0x1a10ed;};'use strict';var emlformat=require(_0xcd70('0x0'));var rimraf=require(_0xcd70('0x1'));var zipdir=require(_0xcd70('0x2'));var jsonpatch=require(_0xcd70('0x3'));var rp=require(_0xcd70('0x4'));var moment=require('moment');var BPromise=require(_0xcd70('0x5'));var Mustache=require(_0xcd70('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcd70('0x7'));var csv=require('to-csv');var ejs=require(_0xcd70('0x8'));var fs=require('fs');var fs_extra=require(_0xcd70('0x9'));var _=require(_0xcd70('0xa'));var squel=require(_0xcd70('0xb'));var crypto=require(_0xcd70('0xc'));var jsforce=require(_0xcd70('0xd'));var deskjs=require(_0xcd70('0xe'));var toCsv=require(_0xcd70('0xf'));var querystring=require(_0xcd70('0x10'));var Papa=require(_0xcd70('0x11'));var Redis=require('ioredis');var authService=require(_0xcd70('0x12'));var qs=require(_0xcd70('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd70('0x14'));var logger=require('../../config/logger')(_0xcd70('0x15'));var utils=require(_0xcd70('0x16'));var config=require(_0xcd70('0x17'));var licenseUtil=require(_0xcd70('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcd70('0x19'));function respondWithStatusCode(_0x17f5f3,_0xfeffcf){_0xfeffcf=_0xfeffcf||0xcc;return function(_0x39b509){if(_0x39b509){return _0x17f5f3[_0xcd70('0x1a')](_0xfeffcf);}return _0x17f5f3[_0xcd70('0x1b')](_0xfeffcf)['end']();};}function respondWithResult(_0x1efbde,_0x203efc){_0x203efc=_0x203efc||0xc8;return function(_0x37f3f1){if(_0x37f3f1){return _0x1efbde[_0xcd70('0x1b')](_0x203efc)[_0xcd70('0x1c')](_0x37f3f1);}};}function respondWithFilteredResult(_0x2d3d7b,_0x54f75c){return function(_0x20ed23){if(_0x20ed23){var _0xe9330a=typeof _0x54f75c[_0xcd70('0x1d')]==='undefined'&&typeof _0x54f75c[_0xcd70('0x1e')]==='undefined';var _0x1c94f9=_0x20ed23['count'];var _0x42974f=_0xe9330a?0x0:_0x54f75c['offset'];var _0x58c89b=_0xe9330a?_0x20ed23[_0xcd70('0x1f')]:_0x54f75c['offset']+_0x54f75c[_0xcd70('0x1e')];var _0x477b2c;if(_0x58c89b>=_0x1c94f9){_0x58c89b=_0x1c94f9;_0x477b2c=0xc8;}else{_0x477b2c=0xce;}_0x2d3d7b[_0xcd70('0x1b')](_0x477b2c);return _0x2d3d7b[_0xcd70('0x20')](_0xcd70('0x21'),_0x42974f+'-'+_0x58c89b+'/'+_0x1c94f9)[_0xcd70('0x1c')](_0x20ed23);}return null;};}function patchUpdates(_0x92a4a9){return function(_0x1470fb){try{jsonpatch[_0xcd70('0x22')](_0x1470fb,_0x92a4a9,!![]);}catch(_0x20d05b){return BPromise['reject'](_0x20d05b);}return _0x1470fb[_0xcd70('0x23')]();};}function saveUpdates(_0x2e0270,_0x506f73){return function(_0xf54f17){if(_0xf54f17){return _0xf54f17[_0xcd70('0x24')](_0x2e0270)[_0xcd70('0x25')](function(_0x433847){return _0x433847;});}return null;};}function removeEntity(_0x470870,_0x40dd15){return function(_0x7205c){if(_0x7205c){return _0x7205c[_0xcd70('0x26')]()['then'](function(){_0x470870[_0xcd70('0x1b')](0xcc)[_0xcd70('0x27')]();});}};}function handleEntityNotFound(_0x41e931,_0x513a70){return function(_0x5f491d){if(!_0x5f491d){_0x41e931['sendStatus'](0x194);}return _0x5f491d;};}function handleError(_0x1f0b61,_0x28079c){_0x28079c=_0x28079c||0x1f4;return function(_0x40d25c){logger[_0xcd70('0x28')](_0x40d25c[_0xcd70('0x29')]);if(_0x40d25c['name']){delete _0x40d25c[_0xcd70('0x2a')];}_0x1f0b61[_0xcd70('0x1b')](_0x28079c)['send'](_0x40d25c);};}exports[_0xcd70('0x2b')]=function(_0x30de4d,_0x386d87){var _0x1aab39={},_0x369133={},_0x4c9a0d={'count':0x0,'rows':[]};var _0x431cee=_[_0xcd70('0x2c')](db['SalesforceAccount'][_0xcd70('0x2d')],function(_0x35ad67){return{'name':_0x35ad67[_0xcd70('0x2e')],'type':_0x35ad67['type'][_0xcd70('0x2f')]};});_0x369133['model']=_[_0xcd70('0x2c')](_0x431cee,'name');_0x369133[_0xcd70('0x30')]=_[_0xcd70('0x31')](_0x30de4d[_0xcd70('0x30')]);_0x369133[_0xcd70('0x32')]=_[_0xcd70('0x33')](_0x369133[_0xcd70('0x34')],_0x369133['query']);_0x1aab39['attributes']=_['intersection'](_0x369133[_0xcd70('0x34')],qs[_0xcd70('0x35')](_0x30de4d[_0xcd70('0x30')][_0xcd70('0x35')]));_0x1aab39[_0xcd70('0x36')]=_0x1aab39[_0xcd70('0x36')][_0xcd70('0x37')]?_0x1aab39[_0xcd70('0x36')]:_0x369133[_0xcd70('0x34')];if(!_0x30de4d[_0xcd70('0x30')][_0xcd70('0x38')](_0xcd70('0x39'))){_0x1aab39[_0xcd70('0x1e')]=qs[_0xcd70('0x1e')](_0x30de4d[_0xcd70('0x30')][_0xcd70('0x1e')]);_0x1aab39[_0xcd70('0x1d')]=qs[_0xcd70('0x1d')](_0x30de4d[_0xcd70('0x30')]['offset']);}_0x1aab39[_0xcd70('0x3a')]=qs[_0xcd70('0x3b')](_0x30de4d['query']['sort']);_0x1aab39[_0xcd70('0x3c')]=qs[_0xcd70('0x32')](_[_0xcd70('0x3d')](_0x30de4d[_0xcd70('0x30')],_0x369133[_0xcd70('0x32')]),_0x431cee);if(_0x30de4d[_0xcd70('0x30')][_0xcd70('0x3e')]){_0x1aab39[_0xcd70('0x3c')]=_['merge'](_0x1aab39['where'],{'$or':_[_0xcd70('0x2c')](_0x431cee,function(_0x554af7){if(_0x554af7[_0xcd70('0x3f')]!==_0xcd70('0x40')){var _0x189a18={};_0x189a18[_0x554af7[_0xcd70('0x2a')]]={'$like':'%'+_0x30de4d[_0xcd70('0x30')]['filter']+'%'};return _0x189a18;}})});}_0x1aab39=_[_0xcd70('0x41')]({},_0x1aab39,_0x30de4d[_0xcd70('0x42')]);var _0x467911={'where':_0x1aab39[_0xcd70('0x3c')]};return db['SalesforceAccount'][_0xcd70('0x1f')](_0x467911)[_0xcd70('0x25')](function(_0x459678){_0x4c9a0d['count']=_0x459678;if(_0x30de4d[_0xcd70('0x30')][_0xcd70('0x43')]){_0x1aab39[_0xcd70('0x44')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xcd70('0x45')](_0x1aab39);})['then'](function(_0x53b2f0){_0x4c9a0d[_0xcd70('0x46')]=_0x53b2f0;return _0x4c9a0d;})[_0xcd70('0x25')](respondWithFilteredResult(_0x386d87,_0x1aab39))[_0xcd70('0x47')](handleError(_0x386d87,null));};exports['show']=function(_0x343732,_0x1aa944){var _0x3f7cdb={'raw':![],'where':{'id':_0x343732[_0xcd70('0x48')]['id']}},_0x39afed={};_0x39afed[_0xcd70('0x34')]=_[_0xcd70('0x31')](db['SalesforceAccount'][_0xcd70('0x2d')]);_0x39afed[_0xcd70('0x30')]=_[_0xcd70('0x31')](_0x343732[_0xcd70('0x30')]);_0x39afed[_0xcd70('0x32')]=_[_0xcd70('0x33')](_0x39afed['model'],_0x39afed[_0xcd70('0x30')]);_0x3f7cdb[_0xcd70('0x36')]=_[_0xcd70('0x33')](_0x39afed['model'],qs[_0xcd70('0x35')](_0x343732[_0xcd70('0x30')][_0xcd70('0x35')]));_0x3f7cdb['attributes']=_0x3f7cdb[_0xcd70('0x36')]['length']?_0x3f7cdb[_0xcd70('0x36')]:_0x39afed[_0xcd70('0x34')];if(_0x343732['query']['includeAll']){_0x3f7cdb[_0xcd70('0x44')]=[{'all':!![]}];}_0x3f7cdb=_[_0xcd70('0x41')]({},_0x3f7cdb,_0x343732[_0xcd70('0x42')]);return db[_0xcd70('0x49')][_0xcd70('0x4a')](_0x3f7cdb)[_0xcd70('0x25')](handleEntityNotFound(_0x1aa944,null))[_0xcd70('0x25')](respondWithResult(_0x1aa944,null))[_0xcd70('0x47')](handleError(_0x1aa944,null));};exports[_0xcd70('0x4b')]=function(_0x62ca04,_0x447454){return db[_0xcd70('0x49')][_0xcd70('0x4b')](_0x62ca04['body'],{})['then'](respondWithResult(_0x447454,0xc9))['catch'](handleError(_0x447454,null));};exports[_0xcd70('0x24')]=function(_0x52e73b,_0x478eb3){if(_0x52e73b['body']['id']){delete _0x52e73b[_0xcd70('0x4c')]['id'];}return db[_0xcd70('0x49')][_0xcd70('0x4a')]({'where':{'id':_0x52e73b[_0xcd70('0x48')]['id']}})[_0xcd70('0x25')](handleEntityNotFound(_0x478eb3,null))['then'](saveUpdates(_0x52e73b[_0xcd70('0x4c')],null))[_0xcd70('0x25')](respondWithResult(_0x478eb3,null))['catch'](handleError(_0x478eb3,null));};exports[_0xcd70('0x26')]=function(_0x4a9086,_0x3ff104){return db['SalesforceAccount'][_0xcd70('0x4a')]({'where':{'id':_0x4a9086[_0xcd70('0x48')]['id']}})[_0xcd70('0x25')](handleEntityNotFound(_0x3ff104,null))[_0xcd70('0x25')](removeEntity(_0x3ff104,null))['catch'](handleError(_0x3ff104,null));};exports[_0xcd70('0x4d')]=function(_0x117b62,_0x1acab6,_0x3fd30e){var _0x59f6c0={};var _0x21810f={};var _0x1604f1;var _0x2be70c;return db[_0xcd70('0x49')]['findOne']({'where':{'id':_0x117b62[_0xcd70('0x48')]['id']}})[_0xcd70('0x25')](handleEntityNotFound(_0x1acab6,null))[_0xcd70('0x25')](function(_0x3592d9){if(_0x3592d9){_0x1604f1=_0x3592d9;_0x21810f[_0xcd70('0x34')]=_[_0xcd70('0x31')](db[_0xcd70('0x4e')]['rawAttributes']);_0x21810f['query']=_[_0xcd70('0x31')](_0x117b62[_0xcd70('0x30')]);_0x21810f[_0xcd70('0x32')]=_['intersection'](_0x21810f[_0xcd70('0x34')],_0x21810f[_0xcd70('0x30')]);_0x59f6c0[_0xcd70('0x36')]=_[_0xcd70('0x33')](_0x21810f[_0xcd70('0x34')],qs[_0xcd70('0x35')](_0x117b62[_0xcd70('0x30')][_0xcd70('0x35')]));_0x59f6c0[_0xcd70('0x36')]=_0x59f6c0[_0xcd70('0x36')][_0xcd70('0x37')]?_0x59f6c0['attributes']:_0x21810f[_0xcd70('0x34')];_0x59f6c0['order']=qs[_0xcd70('0x3b')](_0x117b62['query'][_0xcd70('0x3b')]);_0x59f6c0[_0xcd70('0x3c')]=qs[_0xcd70('0x32')](_['pick'](_0x117b62['query'],_0x21810f['filters']));if(_0x117b62['query'][_0xcd70('0x3e')]){_0x59f6c0['where']=_['merge'](_0x59f6c0[_0xcd70('0x3c')],{'$or':_[_0xcd70('0x2c')](_0x59f6c0[_0xcd70('0x36')],function(_0x21037d){var _0x3707b6={};_0x3707b6[_0x21037d]={'$like':'%'+_0x117b62[_0xcd70('0x30')][_0xcd70('0x3e')]+'%'};return _0x3707b6;})});}_0x59f6c0=_[_0xcd70('0x41')]({},_0x59f6c0,_0x117b62[_0xcd70('0x42')]);return _0x1604f1[_0xcd70('0x4d')](_0x59f6c0);}})[_0xcd70('0x25')](function(_0x3eb599){if(_0x3eb599){_0x2be70c=_0x3eb599[_0xcd70('0x37')];if(!_0x117b62[_0xcd70('0x30')][_0xcd70('0x38')](_0xcd70('0x39'))){_0x59f6c0[_0xcd70('0x1e')]=qs[_0xcd70('0x1e')](_0x117b62[_0xcd70('0x30')][_0xcd70('0x1e')]);_0x59f6c0[_0xcd70('0x1d')]=qs[_0xcd70('0x1d')](_0x117b62['query'][_0xcd70('0x1d')]);}return _0x1604f1[_0xcd70('0x4d')](_0x59f6c0);}})[_0xcd70('0x25')](function(_0x450488){if(_0x450488){return _0x450488?{'count':_0x2be70c,'rows':_0x450488}:null;}})['then'](respondWithResult(_0x1acab6,null))[_0xcd70('0x47')](handleError(_0x1acab6,null));};exports[_0xcd70('0x4f')]=function(_0x100afd,_0x33615a,_0xeae1a7){if(_0x100afd[_0xcd70('0x4c')]['id']){delete _0x100afd['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x100afd[_0xcd70('0x48')]['id']}})[_0xcd70('0x25')](handleEntityNotFound(_0x33615a,null))[_0xcd70('0x25')](function(_0x54e04c){if(_0x54e04c){_0x100afd['body'][_0xcd70('0x50')]=_0x54e04c['id'];_0x100afd[_0xcd70('0x4c')][_0xcd70('0x51')]=integrations[_0xcd70('0x52')](_0x100afd[_0xcd70('0x4c')][_0xcd70('0x53')],_0x100afd[_0xcd70('0x4c')][_0xcd70('0x3f')]);_0x100afd[_0xcd70('0x4c')][_0xcd70('0x54')]=integrations[_0xcd70('0x55')](_0x100afd[_0xcd70('0x4c')][_0xcd70('0x53')],_0x100afd['body'][_0xcd70('0x3f')]);return db['SalesforceConfiguration']['create'](_0x100afd[_0xcd70('0x4c')],{'include':[{'model':db[_0xcd70('0x56')],'as':_0xcd70('0x51')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xcd70('0x25')](respondWithResult(_0x33615a,null))['catch'](handleError(_0x33615a,null));};exports[_0xcd70('0x57')]=function(_0x2753e2,_0x1628ca,_0xed4e43){var _0xbc73c3;var _0x1cdcde='';var _0x557f4c=_0xcd70('0x58');return db[_0xcd70('0x49')][_0xcd70('0x59')]({'where':{'id':_0x2753e2[_0xcd70('0x48')]['id']},'attributes':['id',_0xcd70('0x5a'),_0xcd70('0x5b'),'clientSecret',_0xcd70('0x5c'),_0xcd70('0x5d'),_0xcd70('0x5e')]})[_0xcd70('0x25')](handleEntityNotFound(_0x1628ca,null))[_0xcd70('0x25')](function(_0x2fa548){if(_0x2fa548){_0x1cdcde=_0x2fa548[_0xcd70('0x5a')];var _0x13375b=_0x1cdcde['slice'](-0x1);if(_0x13375b==='/'){_0x1cdcde=_0x1cdcde[_0xcd70('0x5f')](0x0,_0x1cdcde[_0xcd70('0x60')](_0x13375b));}_0xbc73c3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1cdcde,'clientId':_0x2fa548[_0xcd70('0x5b')],'clientSecret':_0x2fa548[_0xcd70('0x61')]}});return _0xbc73c3[_0xcd70('0x62')](_0x2fa548[_0xcd70('0x5c')],_0x2fa548[_0xcd70('0x5d')][_0xcd70('0x63')](_0x2fa548[_0xcd70('0x5e')]));}})['then'](function(_0x3243bf){if(_0x3243bf){if(!_[_0xcd70('0x64')](_0x2753e2[_0xcd70('0x30')][_0xcd70('0x65')])){_0x557f4c=_0x2753e2[_0xcd70('0x30')][_0xcd70('0x65')];}return _0xbc73c3[_0xcd70('0x66')](_0x557f4c)['describe']();}})[_0xcd70('0x25')](function(_0x2fbf83){var _0x65b82b=['OwnerId','ActivityDate',_0xcd70('0x67'),_0xcd70('0x68'),'Subject',_0xcd70('0x69')];var _0x2eb58a=['string',_0xcd70('0x6a'),_0xcd70('0x6b'),_0xcd70('0x6c'),_0xcd70('0x6d'),_0xcd70('0x6e'),_0xcd70('0x6f')];if(_0x2fbf83){_['remove'](_0x2fbf83[_0xcd70('0x35')],function(_0x40752f){return _0x65b82b[_0xcd70('0x70')](_0x40752f[_0xcd70('0x2a')])||!_0x2eb58a[_0xcd70('0x70')](_0x40752f[_0xcd70('0x3f')]);});return{'count':_0x2fbf83[_0xcd70('0x35')][_0xcd70('0x37')],'rows':_[_0xcd70('0x2c')](_0x2fbf83[_0xcd70('0x35')],function(_0x3bda55){return{'id':_0x3bda55['name'],'name':_0x3bda55[_0xcd70('0x71')],'custom':_0x3bda55[_0xcd70('0x72')],'options':_0x3bda55['picklistValues'][_0xcd70('0x37')]>0x0?_[_0xcd70('0x2c')](_0x3bda55[_0xcd70('0x73')],function(_0x1c3c7e){return{'name':_0x1c3c7e[_0xcd70('0x71')],'value':_0x1c3c7e[_0xcd70('0x74')]};}):_0x3bda55[_0xcd70('0x3f')]=='boolean'?[{'name':_0xcd70('0x75'),'value':_0xcd70('0x76')},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x1628ca,null))[_0xcd70('0x47')](function(_0x5a7281){var _0x45f380=_0x2753e2[_0xcd70('0x30')][_0xcd70('0x77')]?0x1f4:_0x5a7281[_0xcd70('0x78')]||0x1f4;logger[_0xcd70('0x28')](_0xcd70('0x79'),_0xcd70('0x57'),_0x45f380,JSON[_0xcd70('0x7a')](_0x5a7281));delete _0x5a7281[_0xcd70('0x2a')];if(_0x45f380===0x191){_0x45f380=0x190;}_0x1628ca[_0xcd70('0x1b')](_0x45f380)[_0xcd70('0x7b')](_0x2753e2[_0xcd70('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5a7281['statusCode']}:_0x5a7281);});}; \ No newline at end of file +var _0xe3c0=['fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','includeAll','find','catch','create','body','params','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','username','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x3964fc,_0x383c2b){var _0x69b65=function(_0x509781){while(--_0x509781){_0x3964fc['push'](_0x3964fc['shift']());}};_0x69b65(++_0x383c2b);}(_0xe3c0,0x170));var _0x0e3c=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xe3c0[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require(_0x0e3c('0x0'));var rimraf=require(_0x0e3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e3c('0x2'));var rp=require(_0x0e3c('0x3'));var moment=require(_0x0e3c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e3c('0x5'));var path=require(_0x0e3c('0x6'));var sox=require(_0x0e3c('0x7'));var csv=require(_0x0e3c('0x8'));var ejs=require(_0x0e3c('0x9'));var fs=require('fs');var fs_extra=require(_0x0e3c('0xa'));var _=require(_0x0e3c('0xb'));var squel=require('squel');var crypto=require(_0x0e3c('0xc'));var jsforce=require(_0x0e3c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0e3c('0x8'));var querystring=require('querystring');var Papa=require(_0x0e3c('0xe'));var Redis=require(_0x0e3c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e3c('0x10'));var logger=require(_0x0e3c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x0e3c('0x12'));var licenseUtil=require(_0x0e3c('0x13'));var db=require(_0x0e3c('0x14'))['db'];var integrations=require(_0x0e3c('0x15'));function respondWithStatusCode(_0x30bb69,_0xa87af8){_0xa87af8=_0xa87af8||0xcc;return function(_0xd707b4){if(_0xd707b4){return _0x30bb69[_0x0e3c('0x16')](_0xa87af8);}return _0x30bb69[_0x0e3c('0x17')](_0xa87af8)[_0x0e3c('0x18')]();};}function respondWithResult(_0xca83c,_0x395b48){_0x395b48=_0x395b48||0xc8;return function(_0x5a509d){if(_0x5a509d){return _0xca83c[_0x0e3c('0x17')](_0x395b48)[_0x0e3c('0x19')](_0x5a509d);}};}function respondWithFilteredResult(_0x1ca40a,_0x1b0951){return function(_0x5b69e4){if(_0x5b69e4){var _0x5230cb=typeof _0x1b0951['offset']==='undefined'&&typeof _0x1b0951['limit']===_0x0e3c('0x1a');var _0x2e30ef=_0x5b69e4[_0x0e3c('0x1b')];var _0x4f3a43=_0x5230cb?0x0:_0x1b0951['offset'];var _0x105add=_0x5230cb?_0x5b69e4[_0x0e3c('0x1b')]:_0x1b0951['offset']+_0x1b0951[_0x0e3c('0x1c')];var _0xf3a0f9;if(_0x105add>=_0x2e30ef){_0x105add=_0x2e30ef;_0xf3a0f9=0xc8;}else{_0xf3a0f9=0xce;}_0x1ca40a[_0x0e3c('0x17')](_0xf3a0f9);return _0x1ca40a[_0x0e3c('0x1d')](_0x0e3c('0x1e'),_0x4f3a43+'-'+_0x105add+'/'+_0x2e30ef)[_0x0e3c('0x19')](_0x5b69e4);}return null;};}function patchUpdates(_0x218a67){return function(_0x45b201){try{jsonpatch[_0x0e3c('0x1f')](_0x45b201,_0x218a67,!![]);}catch(_0x2d3600){return BPromise[_0x0e3c('0x20')](_0x2d3600);}return _0x45b201[_0x0e3c('0x21')]();};}function saveUpdates(_0xa4ae3,_0x1ba7b4){return function(_0x296dcd){if(_0x296dcd){return _0x296dcd[_0x0e3c('0x22')](_0xa4ae3)['then'](function(_0x2dc8a3){return _0x2dc8a3;});}return null;};}function removeEntity(_0x5b7000,_0x3b93c8){return function(_0xd4a4f9){if(_0xd4a4f9){return _0xd4a4f9[_0x0e3c('0x23')]()[_0x0e3c('0x24')](function(){_0x5b7000['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1923,_0x37aa63){return function(_0x485954){if(!_0x485954){_0x4d1923['sendStatus'](0x194);}return _0x485954;};}function handleError(_0x45d074,_0x5b9e70){_0x5b9e70=_0x5b9e70||0x1f4;return function(_0x5dbc74){logger[_0x0e3c('0x25')](_0x5dbc74[_0x0e3c('0x26')]);if(_0x5dbc74[_0x0e3c('0x27')]){delete _0x5dbc74[_0x0e3c('0x27')];}_0x45d074['status'](_0x5b9e70)['send'](_0x5dbc74);};}exports['index']=function(_0x5532d6,_0x540038){var _0x10748c={},_0x530b81={},_0x3e74f3={'count':0x0,'rows':[]};var _0x107ade=_[_0x0e3c('0x28')](db[_0x0e3c('0x29')][_0x0e3c('0x2a')],function(_0x52e289){return{'name':_0x52e289[_0x0e3c('0x2b')],'type':_0x52e289[_0x0e3c('0x2c')][_0x0e3c('0x2d')]};});_0x530b81[_0x0e3c('0x2e')]=_[_0x0e3c('0x28')](_0x107ade,'name');_0x530b81[_0x0e3c('0x2f')]=_[_0x0e3c('0x30')](_0x5532d6['query']);_0x530b81['filters']=_[_0x0e3c('0x31')](_0x530b81[_0x0e3c('0x2e')],_0x530b81[_0x0e3c('0x2f')]);_0x10748c[_0x0e3c('0x32')]=_[_0x0e3c('0x31')](_0x530b81[_0x0e3c('0x2e')],qs[_0x0e3c('0x33')](_0x5532d6[_0x0e3c('0x2f')][_0x0e3c('0x33')]));_0x10748c['attributes']=_0x10748c[_0x0e3c('0x32')][_0x0e3c('0x34')]?_0x10748c[_0x0e3c('0x32')]:_0x530b81[_0x0e3c('0x2e')];if(!_0x5532d6[_0x0e3c('0x2f')][_0x0e3c('0x35')](_0x0e3c('0x36'))){_0x10748c[_0x0e3c('0x1c')]=qs[_0x0e3c('0x1c')](_0x5532d6['query'][_0x0e3c('0x1c')]);_0x10748c[_0x0e3c('0x37')]=qs[_0x0e3c('0x37')](_0x5532d6[_0x0e3c('0x2f')]['offset']);}_0x10748c[_0x0e3c('0x38')]=qs[_0x0e3c('0x39')](_0x5532d6[_0x0e3c('0x2f')]['sort']);_0x10748c['where']=qs[_0x0e3c('0x3a')](_[_0x0e3c('0x3b')](_0x5532d6[_0x0e3c('0x2f')],_0x530b81[_0x0e3c('0x3a')]),_0x107ade);if(_0x5532d6[_0x0e3c('0x2f')][_0x0e3c('0x3c')]){_0x10748c[_0x0e3c('0x3d')]=_[_0x0e3c('0x3e')](_0x10748c[_0x0e3c('0x3d')],{'$or':_[_0x0e3c('0x28')](_0x107ade,function(_0x43b43c){if(_0x43b43c[_0x0e3c('0x2c')]!==_0x0e3c('0x3f')){var _0x40a5f1={};_0x40a5f1[_0x43b43c[_0x0e3c('0x27')]]={'$like':'%'+_0x5532d6[_0x0e3c('0x2f')][_0x0e3c('0x3c')]+'%'};return _0x40a5f1;}})});}_0x10748c=_[_0x0e3c('0x3e')]({},_0x10748c,_0x5532d6[_0x0e3c('0x40')]);var _0x2cc55d={'where':_0x10748c[_0x0e3c('0x3d')]};return db[_0x0e3c('0x29')][_0x0e3c('0x1b')](_0x2cc55d)['then'](function(_0x1e7d66){_0x3e74f3[_0x0e3c('0x1b')]=_0x1e7d66;if(_0x5532d6[_0x0e3c('0x2f')]['includeAll']){_0x10748c[_0x0e3c('0x41')]=[{'all':!![]}];}return db[_0x0e3c('0x29')][_0x0e3c('0x42')](_0x10748c);})[_0x0e3c('0x24')](function(_0xf0a43c){_0x3e74f3[_0x0e3c('0x43')]=_0xf0a43c;return _0x3e74f3;})[_0x0e3c('0x24')](respondWithFilteredResult(_0x540038,_0x10748c))['catch'](handleError(_0x540038,null));};exports['show']=function(_0x614276,_0x397c99){var _0x5c22a5={'raw':![],'where':{'id':_0x614276['params']['id']}},_0x125754={};_0x125754[_0x0e3c('0x2e')]=_[_0x0e3c('0x30')](db['SalesforceAccount'][_0x0e3c('0x2a')]);_0x125754[_0x0e3c('0x2f')]=_[_0x0e3c('0x30')](_0x614276[_0x0e3c('0x2f')]);_0x125754[_0x0e3c('0x3a')]=_['intersection'](_0x125754[_0x0e3c('0x2e')],_0x125754['query']);_0x5c22a5['attributes']=_[_0x0e3c('0x31')](_0x125754['model'],qs['fields'](_0x614276[_0x0e3c('0x2f')][_0x0e3c('0x33')]));_0x5c22a5[_0x0e3c('0x32')]=_0x5c22a5['attributes']['length']?_0x5c22a5[_0x0e3c('0x32')]:_0x125754[_0x0e3c('0x2e')];if(_0x614276[_0x0e3c('0x2f')][_0x0e3c('0x44')]){_0x5c22a5[_0x0e3c('0x41')]=[{'all':!![]}];}_0x5c22a5=_['merge']({},_0x5c22a5,_0x614276['options']);return db[_0x0e3c('0x29')][_0x0e3c('0x45')](_0x5c22a5)[_0x0e3c('0x24')](handleEntityNotFound(_0x397c99,null))[_0x0e3c('0x24')](respondWithResult(_0x397c99,null))[_0x0e3c('0x46')](handleError(_0x397c99,null));};exports[_0x0e3c('0x47')]=function(_0x48e9d2,_0x2c22e7){return db[_0x0e3c('0x29')][_0x0e3c('0x47')](_0x48e9d2[_0x0e3c('0x48')],{})[_0x0e3c('0x24')](respondWithResult(_0x2c22e7,0xc9))[_0x0e3c('0x46')](handleError(_0x2c22e7,null));};exports[_0x0e3c('0x22')]=function(_0x3901f8,_0x16235c){if(_0x3901f8['body']['id']){delete _0x3901f8[_0x0e3c('0x48')]['id'];}return db[_0x0e3c('0x29')][_0x0e3c('0x45')]({'where':{'id':_0x3901f8[_0x0e3c('0x49')]['id']}})[_0x0e3c('0x24')](handleEntityNotFound(_0x16235c,null))[_0x0e3c('0x24')](saveUpdates(_0x3901f8['body'],null))[_0x0e3c('0x24')](respondWithResult(_0x16235c,null))[_0x0e3c('0x46')](handleError(_0x16235c,null));};exports[_0x0e3c('0x23')]=function(_0x33b148,_0x247bff){return db[_0x0e3c('0x29')][_0x0e3c('0x45')]({'where':{'id':_0x33b148['params']['id']}})[_0x0e3c('0x24')](handleEntityNotFound(_0x247bff,null))[_0x0e3c('0x24')](removeEntity(_0x247bff,null))['catch'](handleError(_0x247bff,null));};exports['getConfigurations']=function(_0xad300a,_0x584b25,_0x2d086e){var _0x123dda={};var _0x51699f={};var _0x2402fc;var _0x13afe3;return db[_0x0e3c('0x29')][_0x0e3c('0x4a')]({'where':{'id':_0xad300a[_0x0e3c('0x49')]['id']}})[_0x0e3c('0x24')](handleEntityNotFound(_0x584b25,null))[_0x0e3c('0x24')](function(_0x5e6139){if(_0x5e6139){_0x2402fc=_0x5e6139;_0x51699f[_0x0e3c('0x2e')]=_[_0x0e3c('0x30')](db[_0x0e3c('0x4b')][_0x0e3c('0x2a')]);_0x51699f[_0x0e3c('0x2f')]=_[_0x0e3c('0x30')](_0xad300a['query']);_0x51699f[_0x0e3c('0x3a')]=_[_0x0e3c('0x31')](_0x51699f[_0x0e3c('0x2e')],_0x51699f[_0x0e3c('0x2f')]);_0x123dda['attributes']=_[_0x0e3c('0x31')](_0x51699f[_0x0e3c('0x2e')],qs[_0x0e3c('0x33')](_0xad300a[_0x0e3c('0x2f')][_0x0e3c('0x33')]));_0x123dda[_0x0e3c('0x32')]=_0x123dda[_0x0e3c('0x32')]['length']?_0x123dda[_0x0e3c('0x32')]:_0x51699f[_0x0e3c('0x2e')];_0x123dda[_0x0e3c('0x38')]=qs[_0x0e3c('0x39')](_0xad300a[_0x0e3c('0x2f')][_0x0e3c('0x39')]);_0x123dda[_0x0e3c('0x3d')]=qs[_0x0e3c('0x3a')](_['pick'](_0xad300a[_0x0e3c('0x2f')],_0x51699f['filters']));if(_0xad300a[_0x0e3c('0x2f')][_0x0e3c('0x3c')]){_0x123dda[_0x0e3c('0x3d')]=_[_0x0e3c('0x3e')](_0x123dda[_0x0e3c('0x3d')],{'$or':_[_0x0e3c('0x28')](_0x123dda['attributes'],function(_0x2ed99c){var _0x3c222e={};_0x3c222e[_0x2ed99c]={'$like':'%'+_0xad300a['query'][_0x0e3c('0x3c')]+'%'};return _0x3c222e;})});}_0x123dda=_[_0x0e3c('0x3e')]({},_0x123dda,_0xad300a[_0x0e3c('0x40')]);return _0x2402fc[_0x0e3c('0x4c')](_0x123dda);}})[_0x0e3c('0x24')](function(_0x50fe0c){if(_0x50fe0c){_0x13afe3=_0x50fe0c[_0x0e3c('0x34')];if(!_0xad300a[_0x0e3c('0x2f')][_0x0e3c('0x35')](_0x0e3c('0x36'))){_0x123dda[_0x0e3c('0x1c')]=qs[_0x0e3c('0x1c')](_0xad300a['query'][_0x0e3c('0x1c')]);_0x123dda[_0x0e3c('0x37')]=qs[_0x0e3c('0x37')](_0xad300a[_0x0e3c('0x2f')][_0x0e3c('0x37')]);}return _0x2402fc[_0x0e3c('0x4c')](_0x123dda);}})[_0x0e3c('0x24')](function(_0x53b363){if(_0x53b363){return _0x53b363?{'count':_0x13afe3,'rows':_0x53b363}:null;}})[_0x0e3c('0x24')](respondWithResult(_0x584b25,null))[_0x0e3c('0x46')](handleError(_0x584b25,null));};exports[_0x0e3c('0x4d')]=function(_0x56293e,_0x33aee8,_0x3a3172){if(_0x56293e[_0x0e3c('0x48')]['id']){delete _0x56293e['body']['id'];}return db[_0x0e3c('0x29')][_0x0e3c('0x4a')]({'where':{'id':_0x56293e[_0x0e3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x33aee8,null))[_0x0e3c('0x24')](function(_0x750bf1){if(_0x750bf1){_0x56293e['body'][_0x0e3c('0x4e')]=_0x750bf1['id'];_0x56293e[_0x0e3c('0x48')]['Subjects']=integrations[_0x0e3c('0x4f')](_0x56293e[_0x0e3c('0x48')][_0x0e3c('0x50')],_0x56293e[_0x0e3c('0x48')]['type']);_0x56293e[_0x0e3c('0x48')][_0x0e3c('0x51')]=integrations['getDescriptions'](_0x56293e[_0x0e3c('0x48')]['channel'],_0x56293e['body'][_0x0e3c('0x2c')]);return db[_0x0e3c('0x4b')]['create'](_0x56293e[_0x0e3c('0x48')],{'include':[{'model':db[_0x0e3c('0x52')],'as':_0x0e3c('0x53')},{'model':db['SalesforceField'],'as':_0x0e3c('0x51')}]});}return null;})['then'](respondWithResult(_0x33aee8,null))[_0x0e3c('0x46')](handleError(_0x33aee8,null));};exports[_0x0e3c('0x54')]=function(_0x5a3d43,_0x48cf7f,_0x528d4c){var _0x556d22;var _0x14ba34='';var _0x199c6a=_0x0e3c('0x55');return db[_0x0e3c('0x29')][_0x0e3c('0x4a')]({'where':{'id':_0x5a3d43[_0x0e3c('0x49')]['id']},'attributes':['id',_0x0e3c('0x56'),_0x0e3c('0x57'),_0x0e3c('0x58'),'username',_0x0e3c('0x59'),_0x0e3c('0x5a')]})['then'](handleEntityNotFound(_0x48cf7f,null))[_0x0e3c('0x24')](function(_0x5a778e){if(_0x5a778e){_0x14ba34=_0x5a778e['remoteUri'];var _0xc6be10=_0x14ba34[_0x0e3c('0x5b')](-0x1);if(_0xc6be10==='/'){_0x14ba34=_0x14ba34[_0x0e3c('0x5c')](0x0,_0x14ba34[_0x0e3c('0x5d')](_0xc6be10));}_0x556d22=new jsforce[(_0x0e3c('0x5e'))]({'oauth2':{'loginUrl':_0x14ba34,'clientId':_0x5a778e[_0x0e3c('0x57')],'clientSecret':_0x5a778e[_0x0e3c('0x58')]}});return _0x556d22[_0x0e3c('0x5f')](_0x5a778e[_0x0e3c('0x60')],_0x5a778e[_0x0e3c('0x59')][_0x0e3c('0x61')](_0x5a778e[_0x0e3c('0x5a')]));}})['then'](function(_0x3321b7){if(_0x3321b7){if(!_[_0x0e3c('0x62')](_0x5a3d43[_0x0e3c('0x2f')][_0x0e3c('0x63')])){_0x199c6a=_0x5a3d43[_0x0e3c('0x2f')]['ticketType'];}return _0x556d22['sobject'](_0x199c6a)[_0x0e3c('0x64')]();}})[_0x0e3c('0x24')](function(_0x2b76c2){var _0x1c34bf=[_0x0e3c('0x65'),_0x0e3c('0x66'),_0x0e3c('0x67'),_0x0e3c('0x68'),_0x0e3c('0x69'),'Description'];var _0x3e40a1=[_0x0e3c('0x6a'),'int',_0x0e3c('0x6b'),_0x0e3c('0x6c'),_0x0e3c('0x6d'),_0x0e3c('0x6e'),_0x0e3c('0x6f')];if(_0x2b76c2){_[_0x0e3c('0x70')](_0x2b76c2[_0x0e3c('0x33')],function(_0x38a444){return _0x1c34bf[_0x0e3c('0x71')](_0x38a444[_0x0e3c('0x27')])||!_0x3e40a1[_0x0e3c('0x71')](_0x38a444[_0x0e3c('0x2c')]);});return{'count':_0x2b76c2['fields'][_0x0e3c('0x34')],'rows':_['map'](_0x2b76c2[_0x0e3c('0x33')],function(_0x15410e){return{'id':_0x15410e[_0x0e3c('0x27')],'name':_0x15410e[_0x0e3c('0x72')],'custom':_0x15410e[_0x0e3c('0x73')],'options':_0x15410e['picklistValues'][_0x0e3c('0x34')]>0x0?_[_0x0e3c('0x28')](_0x15410e[_0x0e3c('0x74')],function(_0x52b557){return{'name':_0x52b557[_0x0e3c('0x72')],'value':_0x52b557['value']};}):_0x15410e[_0x0e3c('0x2c')]==_0x0e3c('0x6c')?[{'name':_0x0e3c('0x75'),'value':_0x0e3c('0x76')},{'name':_0x0e3c('0x77'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x48cf7f,null))[_0x0e3c('0x46')](function(_0x39a915){var _0x46a623=_0x5a3d43[_0x0e3c('0x2f')][_0x0e3c('0x78')]?0x1f4:_0x39a915[_0x0e3c('0x79')]||0x1f4;logger[_0x0e3c('0x25')](_0x0e3c('0x7a'),_0x0e3c('0x54'),_0x46a623,JSON[_0x0e3c('0x7b')](_0x39a915));delete _0x39a915[_0x0e3c('0x27')];if(_0x46a623===0x191){_0x46a623=0x190;}_0x48cf7f[_0x0e3c('0x17')](_0x46a623)[_0x0e3c('0x7c')](_0x5a3d43[_0x0e3c('0x2f')][_0x0e3c('0x78')]?{'message':_0x0e3c('0x7d'),'statusCode':_0x39a915[_0x0e3c('0x79')]}:_0x39a915);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 268ed85..d94f410 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 _0x6a11=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment'];(function(_0x25fc74,_0x443abc){var _0x56e715=function(_0x5d8544){while(--_0x5d8544){_0x25fc74['push'](_0x25fc74['shift']());}};_0x56e715(++_0x443abc);}(_0x6a11,0xc0));var _0x16a1=function(_0x475f88,_0x3ddea3){_0x475f88=_0x475f88-0x0;var _0x42d635=_0x6a11[_0x475f88];return _0x42d635;};'use strict';var _=require(_0x16a1('0x0'));var util=require('util');var logger=require(_0x16a1('0x1'))(_0x16a1('0x2'));var moment=require(_0x16a1('0x3'));var BPromise=require(_0x16a1('0x4'));var rp=require(_0x16a1('0x5'));var fs=require('fs');var path=require(_0x16a1('0x6'));var rimraf=require(_0x16a1('0x7'));var config=require(_0x16a1('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x16a1('0x9'));module[_0x16a1('0xa')]=function(_0x5b4373,_0x2037b7){return _0x5b4373[_0x16a1('0xb')](_0x16a1('0xc'),attributes,{'tableName':_0x16a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5912=['int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x51950d,_0x23f4ca){var _0xe2441=function(_0x2a2839){while(--_0x2a2839){_0x51950d['push'](_0x51950d['shift']());}};_0xe2441(++_0x23f4ca);}(_0x5912,0x1cf));var _0x2591=function(_0x56c06e,_0x43a567){_0x56c06e=_0x56c06e-0x0;var _0x46471f=_0x5912[_0x56c06e];return _0x46471f;};'use strict';var _=require(_0x2591('0x0'));var util=require('util');var logger=require(_0x2591('0x1'))(_0x2591('0x2'));var moment=require(_0x2591('0x3'));var BPromise=require(_0x2591('0x4'));var rp=require(_0x2591('0x5'));var fs=require('fs');var path=require(_0x2591('0x6'));var rimraf=require(_0x2591('0x7'));var config=require('../../config/environment');var attributes=require(_0x2591('0x8'));var integrations=require(_0x2591('0x9'));module[_0x2591('0xa')]=function(_0x4c3d3e,_0x41598e){return _0x4c3d3e[_0x2591('0xb')](_0x2591('0xc'),attributes,{'tableName':_0x2591('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index d204431..7c65e70 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 _0xe941=['request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','include','map','model','stringify','find','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s'];(function(_0x3171d7,_0x4a8a42){var _0x546be4=function(_0x2611e9){while(--_0x2611e9){_0x3171d7['push'](_0x3171d7['shift']());}};_0x546be4(++_0x4a8a42);}(_0xe941,0xc4));var _0x1e94=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xe941[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x1e94('0x0'));var moment=require(_0x1e94('0x1'));var BPromise=require(_0x1e94('0x2'));var rs=require(_0x1e94('0x3'));var fs=require('fs');var Redis=require(_0x1e94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e94('0x5'));var logger=require(_0x1e94('0x6'))(_0x1e94('0x7'));var config=require(_0x1e94('0x8'));var jayson=require(_0x1e94('0x9'));var client=jayson[_0x1e94('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355731,_0x42487b,_0x5a52f0){return new BPromise(function(_0x275185,_0x230cb2){return client['request'](_0x355731,_0x5a52f0)[_0x1e94('0xb')](function(_0x5199b0){logger[_0x1e94('0xc')](_0x1e94('0xd'),_0x42487b,_0x1e94('0xe'));logger[_0x1e94('0xf')](_0x1e94('0x10'),_0x42487b,_0x1e94('0xe'),JSON['stringify'](_0x5199b0));if(_0x5199b0[_0x1e94('0x11')]){if(_0x5199b0[_0x1e94('0x11')][_0x1e94('0x12')]===0x1f4){logger[_0x1e94('0x11')](_0x1e94('0xd'),_0x42487b,_0x5199b0['error']['message']);return _0x230cb2(_0x5199b0[_0x1e94('0x11')][_0x1e94('0x13')]);}logger['error'](_0x1e94('0xd'),_0x42487b,_0x5199b0[_0x1e94('0x11')]['message']);return _0x275185(_0x5199b0[_0x1e94('0x11')]['message']);}else{logger[_0x1e94('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x42487b,'request\x20sent');_0x275185(_0x5199b0[_0x1e94('0x14')][_0x1e94('0x13')]);}})[_0x1e94('0x15')](function(_0x445f1b){logger[_0x1e94('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x42487b,_0x445f1b);_0x230cb2(_0x445f1b);});});}exports[_0x1e94('0x16')]=function(_0x428e34){var _0x651cbc=this;return new Promise(function(_0x45fa5b,_0x314eb2){return db[_0x1e94('0x17')][_0x1e94('0x18')]({'raw':_0x428e34[_0x1e94('0x19')]?_0x428e34[_0x1e94('0x19')][_0x1e94('0x1a')]===undefined?!![]:![]:!![],'where':_0x428e34[_0x1e94('0x19')]?_0x428e34['options'][_0x1e94('0x1b')]||null:null,'attributes':_0x428e34[_0x1e94('0x19')]?_0x428e34[_0x1e94('0x19')][_0x1e94('0x1c')]||null:null,'limit':_0x428e34[_0x1e94('0x19')]?_0x428e34[_0x1e94('0x19')]['limit']||null:null,'include':_0x428e34[_0x1e94('0x19')]?_0x428e34[_0x1e94('0x19')][_0x1e94('0x1d')]?_[_0x1e94('0x1e')](_0x428e34['options'][_0x1e94('0x1d')],function(_0x741ff2){return{'model':db[_0x741ff2[_0x1e94('0x1f')]],'as':_0x741ff2['as'],'attributes':_0x741ff2['attributes'],'include':_0x741ff2[_0x1e94('0x1d')]?_[_0x1e94('0x1e')](_0x741ff2[_0x1e94('0x1d')],function(_0x2cb1e6){return{'model':db[_0x2cb1e6['model']],'as':_0x2cb1e6['as'],'attributes':_0x2cb1e6[_0x1e94('0x1c')],'include':_0x2cb1e6['include']?_['map'](_0x2cb1e6[_0x1e94('0x1d')],function(_0x3c1c7f){return{'model':db[_0x3c1c7f['model']],'as':_0x3c1c7f['as'],'attributes':_0x3c1c7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e94('0xb')](function(_0x9b1e4c){logger['info']('GetSalesforceAccount',_0x428e34);logger[_0x1e94('0xf')](_0x1e94('0x16'),_0x428e34,JSON[_0x1e94('0x20')](_0x9b1e4c));_0x45fa5b(_0x9b1e4c);})[_0x1e94('0x15')](function(_0x26d32a){logger[_0x1e94('0x11')](_0x1e94('0x16'),_0x26d32a[_0x1e94('0x13')],_0x428e34);_0x314eb2(_0x651cbc[_0x1e94('0x11')](0x1f4,_0x26d32a[_0x1e94('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x1b989a){var _0x3e05ca=this;return new Promise(function(_0x27f4a2,_0x38d7ec){return db[_0x1e94('0x17')][_0x1e94('0x21')]({'raw':_0x1b989a[_0x1e94('0x19')]?_0x1b989a[_0x1e94('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1b989a[_0x1e94('0x19')]?_0x1b989a[_0x1e94('0x19')][_0x1e94('0x1b')]||null:null,'attributes':_0x1b989a[_0x1e94('0x19')]?_0x1b989a['options']['attributes']||null:null,'include':_0x1b989a[_0x1e94('0x19')]?_0x1b989a[_0x1e94('0x19')]['include']?_[_0x1e94('0x1e')](_0x1b989a[_0x1e94('0x19')][_0x1e94('0x1d')],function(_0xb81485){return{'model':db[_0xb81485[_0x1e94('0x1f')]],'as':_0xb81485['as'],'attributes':_0xb81485[_0x1e94('0x1c')],'include':_0xb81485[_0x1e94('0x1d')]?_[_0x1e94('0x1e')](_0xb81485[_0x1e94('0x1d')],function(_0x4688d8){return{'model':db[_0x4688d8[_0x1e94('0x1f')]],'as':_0x4688d8['as'],'attributes':_0x4688d8[_0x1e94('0x1c')],'include':_0x4688d8[_0x1e94('0x1d')]?_[_0x1e94('0x1e')](_0x4688d8['include'],function(_0x1fbb07){return{'model':db[_0x1fbb07[_0x1e94('0x1f')]],'as':_0x1fbb07['as'],'attributes':_0x1fbb07[_0x1e94('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1e94('0xb')](function(_0x557fdc){logger[_0x1e94('0xc')](_0x1e94('0x22'),_0x1b989a);logger['debug'](_0x1e94('0x22'),_0x1b989a,JSON['stringify'](_0x557fdc));_0x27f4a2(_0x557fdc);})[_0x1e94('0x15')](function(_0x566d41){logger['error'](_0x1e94('0x22'),_0x566d41[_0x1e94('0x13')],_0x1b989a);_0x38d7ec(_0x3e05ca[_0x1e94('0x11')](0x1f4,_0x566d41['message']));});});}; \ No newline at end of file +var _0x84cd=['limit','map','include','model','GetSalesforceAccount','catch','find','ShowSalesforceAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','findAll','options','where','attributes'];(function(_0x3a7fe5,_0x371426){var _0x18ed66=function(_0x4f6a16){while(--_0x4f6a16){_0x3a7fe5['push'](_0x3a7fe5['shift']());}};_0x18ed66(++_0x371426);}(_0x84cd,0xb2));var _0xd84c=function(_0x2a539c,_0x345db4){_0x2a539c=_0x2a539c-0x0;var _0x5ed013=_0x84cd[_0x2a539c];return _0x5ed013;};'use strict';var _=require(_0xd84c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd84c('0x1'));var rs=require(_0xd84c('0x2'));var fs=require('fs');var Redis=require(_0xd84c('0x3'));var db=require(_0xd84c('0x4'))['db'];var utils=require(_0xd84c('0x5'));var logger=require(_0xd84c('0x6'))(_0xd84c('0x7'));var config=require(_0xd84c('0x8'));var jayson=require(_0xd84c('0x9'));var client=jayson['client'][_0xd84c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b06c7,_0x21d7a9,_0x17337a){return new BPromise(function(_0x5b9c59,_0x5bacf7){return client[_0xd84c('0xb')](_0x1b06c7,_0x17337a)[_0xd84c('0xc')](function(_0x5e2e0b){logger['info'](_0xd84c('0xd'),_0x21d7a9,_0xd84c('0xe'));logger[_0xd84c('0xf')](_0xd84c('0x10'),_0x21d7a9,_0xd84c('0xe'),JSON[_0xd84c('0x11')](_0x5e2e0b));if(_0x5e2e0b[_0xd84c('0x12')]){if(_0x5e2e0b['error']['code']===0x1f4){logger[_0xd84c('0x12')](_0xd84c('0xd'),_0x21d7a9,_0x5e2e0b['error'][_0xd84c('0x13')]);return _0x5bacf7(_0x5e2e0b['error'][_0xd84c('0x13')]);}logger[_0xd84c('0x12')](_0xd84c('0xd'),_0x21d7a9,_0x5e2e0b['error'][_0xd84c('0x13')]);return _0x5b9c59(_0x5e2e0b[_0xd84c('0x12')][_0xd84c('0x13')]);}else{logger[_0xd84c('0x14')](_0xd84c('0xd'),_0x21d7a9,'request\x20sent');_0x5b9c59(_0x5e2e0b[_0xd84c('0x15')][_0xd84c('0x13')]);}})['catch'](function(_0x4a48bf){logger['error'](_0xd84c('0xd'),_0x21d7a9,_0x4a48bf);_0x5bacf7(_0x4a48bf);});});}exports['GetSalesforceAccount']=function(_0x3d8eda){var _0x4e1b15=this;return new Promise(function(_0x5c82c3,_0x3e7995){return db['SalesforceAccount'][_0xd84c('0x16')]({'raw':_0x3d8eda[_0xd84c('0x17')]?_0x3d8eda[_0xd84c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3d8eda['options']?_0x3d8eda[_0xd84c('0x17')][_0xd84c('0x18')]||null:null,'attributes':_0x3d8eda[_0xd84c('0x17')]?_0x3d8eda[_0xd84c('0x17')][_0xd84c('0x19')]||null:null,'limit':_0x3d8eda[_0xd84c('0x17')]?_0x3d8eda[_0xd84c('0x17')][_0xd84c('0x1a')]||null:null,'include':_0x3d8eda['options']?_0x3d8eda['options']['include']?_[_0xd84c('0x1b')](_0x3d8eda['options'][_0xd84c('0x1c')],function(_0x4c3204){return{'model':db[_0x4c3204['model']],'as':_0x4c3204['as'],'attributes':_0x4c3204[_0xd84c('0x19')],'include':_0x4c3204[_0xd84c('0x1c')]?_[_0xd84c('0x1b')](_0x4c3204[_0xd84c('0x1c')],function(_0x8e8c66){return{'model':db[_0x8e8c66['model']],'as':_0x8e8c66['as'],'attributes':_0x8e8c66[_0xd84c('0x19')],'include':_0x8e8c66[_0xd84c('0x1c')]?_['map'](_0x8e8c66[_0xd84c('0x1c')],function(_0x3c9f75){return{'model':db[_0x3c9f75[_0xd84c('0x1d')]],'as':_0x3c9f75['as'],'attributes':_0x3c9f75[_0xd84c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd84c('0xc')](function(_0x33245d){logger[_0xd84c('0x14')](_0xd84c('0x1e'),_0x3d8eda);logger[_0xd84c('0xf')](_0xd84c('0x1e'),_0x3d8eda,JSON[_0xd84c('0x11')](_0x33245d));_0x5c82c3(_0x33245d);})[_0xd84c('0x1f')](function(_0x3d5f19){logger['error']('GetSalesforceAccount',_0x3d5f19[_0xd84c('0x13')],_0x3d8eda);_0x3e7995(_0x4e1b15[_0xd84c('0x12')](0x1f4,_0x3d5f19[_0xd84c('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x58d730){var _0x5706a0=this;return new Promise(function(_0x9a3bba,_0x1ea6e4){return db['SalesforceAccount'][_0xd84c('0x20')]({'raw':_0x58d730[_0xd84c('0x17')]?_0x58d730['options']['raw']===undefined?!![]:![]:!![],'where':_0x58d730[_0xd84c('0x17')]?_0x58d730[_0xd84c('0x17')][_0xd84c('0x18')]||null:null,'attributes':_0x58d730[_0xd84c('0x17')]?_0x58d730['options'][_0xd84c('0x19')]||null:null,'include':_0x58d730[_0xd84c('0x17')]?_0x58d730[_0xd84c('0x17')][_0xd84c('0x1c')]?_[_0xd84c('0x1b')](_0x58d730[_0xd84c('0x17')]['include'],function(_0x395afc){return{'model':db[_0x395afc[_0xd84c('0x1d')]],'as':_0x395afc['as'],'attributes':_0x395afc[_0xd84c('0x19')],'include':_0x395afc['include']?_[_0xd84c('0x1b')](_0x395afc[_0xd84c('0x1c')],function(_0x548e89){return{'model':db[_0x548e89[_0xd84c('0x1d')]],'as':_0x548e89['as'],'attributes':_0x548e89[_0xd84c('0x19')],'include':_0x548e89[_0xd84c('0x1c')]?_[_0xd84c('0x1b')](_0x548e89['include'],function(_0x33ff96){return{'model':db[_0x33ff96[_0xd84c('0x1d')]],'as':_0x33ff96['as'],'attributes':_0x33ff96['attributes']};}):[]};}):[]};}):[]:[]})[_0xd84c('0xc')](function(_0x3c5b61){logger['info']('ShowSalesforceAccount',_0x58d730);logger[_0xd84c('0xf')]('ShowSalesforceAccount',_0x58d730,JSON[_0xd84c('0x11')](_0x3c5b61));_0x9a3bba(_0x3c5b61);})['catch'](function(_0x1cb2c9){logger[_0xd84c('0x12')](_0xd84c('0x21'),_0x1cb2c9[_0xd84c('0x13')],_0x58d730);_0x1ea6e4(_0x5706a0[_0xd84c('0x12')](0x1f4,_0x1cb2c9[_0xd84c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f8a4346..cf2d2a0 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(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2eb35d,_0x4a7a45){_0x2eb35d=_0x2eb35d-0x0;var _0x1f9854=_0x0b0e[_0x2eb35d];return _0x1f9854;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x104a95,_0xe173a7){var _0x5455a0=function(_0x121cbc){while(--_0x121cbc){_0x104a95['push'](_0x104a95['shift']());}};_0x5455a0(++_0xe173a7);}(_0xadb5,0xad));var _0x5adb=function(_0x164e43,_0x59e14f){_0x164e43=_0x164e43-0x0;var _0x1f4502=_0xadb5[_0x164e43];return _0x1f4502;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3944fdc..82d6c3d 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 _0xf017=['account','contact','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','lead','account_contact_lead'];(function(_0x58628c,_0x1ab776){var _0x5d7f71=function(_0x524d07){while(--_0x524d07){_0x58628c['push'](_0x58628c['shift']());}};_0x5d7f71(++_0x1ab776);}(_0xf017,0x162));var _0x7f01=function(_0x430069,_0x15553f){_0x430069=_0x430069-0x0;var _0x1294df=_0xf017[_0x430069];return _0x1294df;};'use strict';var Sequelize=require(_0x7f01('0x0'));module[_0x7f01('0x1')]={'name':{'type':Sequelize[_0x7f01('0x2')]},'description':{'type':Sequelize[_0x7f01('0x2')]},'ticketType':{'type':Sequelize[_0x7f01('0x3')](_0x7f01('0x4'),_0x7f01('0x5')),'defaultValue':_0x7f01('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x7f01('0x6'),'contact',_0x7f01('0x7'),_0x7f01('0x8'),_0x7f01('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x7f01('0x3')]('nothing',_0x7f01('0xa'),'lead',_0x7f01('0x9')),'defaultValue':_0x7f01('0x7')},'leadId':{'type':Sequelize[_0x7f01('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x7f01('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x7f01('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x7f01('0x2')]}}; \ No newline at end of file +var _0x87cb=['ENUM','contact_lead','contact','lead','account','nothing','sequelize','STRING','Task'];(function(_0x55afb8,_0x1c17d2){var _0x4528d3=function(_0xe380ec){while(--_0xe380ec){_0x55afb8['push'](_0x55afb8['shift']());}};_0x4528d3(++_0x1c17d2);}(_0x87cb,0xc3));var _0xb87c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x87cb[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xb87c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb87c('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xb87c('0x2'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xb87c('0x3')](_0xb87c('0x4'),_0xb87c('0x5'),_0xb87c('0x6'),'account_contact_lead',_0xb87c('0x7')),'defaultValue':_0xb87c('0x4')},'moduleCreate':{'type':Sequelize[_0xb87c('0x3')](_0xb87c('0x8'),'contact','lead','account'),'defaultValue':_0xb87c('0x6')},'leadId':{'type':Sequelize[_0xb87c('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xb87c('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xb87c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ac9afc2..fd4567b 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 _0x5dd9=['order','sort','where','filter','type','merge','SalesforceConfiguration','includeAll','include','rows','catch','show','params','options','find','create','body','getFields','findOne','SalesforceField','pick','hasOwnProperty','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x2b9c8e,_0x494c68){var _0xf5492=function(_0x545ba3){while(--_0x545ba3){_0x2b9c8e['push'](_0x2b9c8e['shift']());}};_0xf5492(++_0x494c68);}(_0x5dd9,0x1e6));var _0x95dd=function(_0x1300ec,_0x3ff267){_0x1300ec=_0x1300ec-0x0;var _0x2c13c9=_0x5dd9[_0x1300ec];return _0x2c13c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95dd('0x1'));var rp=require(_0x95dd('0x2'));var moment=require(_0x95dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x95dd('0x4'));var util=require(_0x95dd('0x5'));var path=require('path');var sox=require(_0x95dd('0x6'));var csv=require(_0x95dd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95dd('0x8'));var _=require('lodash');var squel=require(_0x95dd('0x9'));var crypto=require('crypto');var jsforce=require(_0x95dd('0xa'));var deskjs=require(_0x95dd('0xb'));var toCsv=require(_0x95dd('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x95dd('0xc'));var authService=require(_0x95dd('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x95dd('0xe'));var hardwareService=require(_0x95dd('0xf'));var logger=require(_0x95dd('0x10'))(_0x95dd('0x11'));var utils=require('../../config/utils');var config=require(_0x95dd('0x12'));var licenseUtil=require(_0x95dd('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357899,_0x1b317c){_0x1b317c=_0x1b317c||0xcc;return function(_0x1d7b2a){if(_0x1d7b2a){return _0x357899[_0x95dd('0x14')](_0x1b317c);}return _0x357899[_0x95dd('0x15')](_0x1b317c)[_0x95dd('0x16')]();};}function respondWithResult(_0x5c5c1e,_0x200394){_0x200394=_0x200394||0xc8;return function(_0xdfeb2e){if(_0xdfeb2e){return _0x5c5c1e[_0x95dd('0x15')](_0x200394)[_0x95dd('0x17')](_0xdfeb2e);}};}function respondWithFilteredResult(_0x5270df,_0x3c1558){return function(_0x3381a5){if(_0x3381a5){var _0x271591=typeof _0x3c1558[_0x95dd('0x18')]===_0x95dd('0x19')&&typeof _0x3c1558[_0x95dd('0x1a')]===_0x95dd('0x19');var _0x3d6bcb=_0x3381a5['count'];var _0x3f12eb=_0x271591?0x0:_0x3c1558[_0x95dd('0x18')];var _0x47e172=_0x271591?_0x3381a5[_0x95dd('0x1b')]:_0x3c1558['offset']+_0x3c1558[_0x95dd('0x1a')];var _0x40a07a;if(_0x47e172>=_0x3d6bcb){_0x47e172=_0x3d6bcb;_0x40a07a=0xc8;}else{_0x40a07a=0xce;}_0x5270df['status'](_0x40a07a);return _0x5270df[_0x95dd('0x1c')]('Content-Range',_0x3f12eb+'-'+_0x47e172+'/'+_0x3d6bcb)[_0x95dd('0x17')](_0x3381a5);}return null;};}function patchUpdates(_0x213c1f){return function(_0xc496ed){try{jsonpatch[_0x95dd('0x1d')](_0xc496ed,_0x213c1f,!![]);}catch(_0x491dd4){return BPromise[_0x95dd('0x1e')](_0x491dd4);}return _0xc496ed[_0x95dd('0x1f')]();};}function saveUpdates(_0x7f331f,_0x3ae0b3){return function(_0x32968e){if(_0x32968e){return _0x32968e[_0x95dd('0x20')](_0x7f331f)[_0x95dd('0x21')](function(_0x3f522f){return _0x3f522f;});}return null;};}function removeEntity(_0x39f076,_0x5b8736){return function(_0x5f3ad3){if(_0x5f3ad3){return _0x5f3ad3[_0x95dd('0x22')]()[_0x95dd('0x21')](function(){_0x39f076['status'](0xcc)[_0x95dd('0x16')]();});}};}function handleEntityNotFound(_0x1cf9cc,_0x5b47e5){return function(_0x40fdcf){if(!_0x40fdcf){_0x1cf9cc[_0x95dd('0x14')](0x194);}return _0x40fdcf;};}function handleError(_0xa9f98d,_0x39fe1c){_0x39fe1c=_0x39fe1c||0x1f4;return function(_0x32c274){logger[_0x95dd('0x23')](_0x32c274[_0x95dd('0x24')]);if(_0x32c274[_0x95dd('0x25')]){delete _0x32c274['name'];}_0xa9f98d[_0x95dd('0x15')](_0x39fe1c)[_0x95dd('0x26')](_0x32c274);};}exports[_0x95dd('0x27')]=function(_0x23ad24,_0x3959d4){var _0x5b733b={},_0x87d67a={},_0x4b9b46={'count':0x0,'rows':[]};var _0x780449=_[_0x95dd('0x28')](db['SalesforceConfiguration'][_0x95dd('0x29')],function(_0x3a7c70){return{'name':_0x3a7c70[_0x95dd('0x2a')],'type':_0x3a7c70['type'][_0x95dd('0x2b')]};});_0x87d67a[_0x95dd('0x2c')]=_[_0x95dd('0x28')](_0x780449,'name');_0x87d67a[_0x95dd('0x2d')]=_[_0x95dd('0x2e')](_0x23ad24[_0x95dd('0x2d')]);_0x87d67a[_0x95dd('0x2f')]=_[_0x95dd('0x30')](_0x87d67a[_0x95dd('0x2c')],_0x87d67a['query']);_0x5b733b[_0x95dd('0x31')]=_[_0x95dd('0x30')](_0x87d67a['model'],qs[_0x95dd('0x32')](_0x23ad24[_0x95dd('0x2d')][_0x95dd('0x32')]));_0x5b733b[_0x95dd('0x31')]=_0x5b733b[_0x95dd('0x31')][_0x95dd('0x33')]?_0x5b733b[_0x95dd('0x31')]:_0x87d67a[_0x95dd('0x2c')];if(!_0x23ad24[_0x95dd('0x2d')]['hasOwnProperty'](_0x95dd('0x34'))){_0x5b733b[_0x95dd('0x1a')]=qs[_0x95dd('0x1a')](_0x23ad24[_0x95dd('0x2d')]['limit']);_0x5b733b[_0x95dd('0x18')]=qs[_0x95dd('0x18')](_0x23ad24['query'][_0x95dd('0x18')]);}_0x5b733b[_0x95dd('0x35')]=qs[_0x95dd('0x36')](_0x23ad24[_0x95dd('0x2d')][_0x95dd('0x36')]);_0x5b733b[_0x95dd('0x37')]=qs['filters'](_['pick'](_0x23ad24[_0x95dd('0x2d')],_0x87d67a[_0x95dd('0x2f')]),_0x780449);if(_0x23ad24[_0x95dd('0x2d')][_0x95dd('0x38')]){_0x5b733b[_0x95dd('0x37')]=_['merge'](_0x5b733b['where'],{'$or':_['map'](_0x780449,function(_0x48e324){if(_0x48e324[_0x95dd('0x39')]!=='VIRTUAL'){var _0x300785={};_0x300785[_0x48e324[_0x95dd('0x25')]]={'$like':'%'+_0x23ad24['query'][_0x95dd('0x38')]+'%'};return _0x300785;}})});}_0x5b733b=_[_0x95dd('0x3a')]({},_0x5b733b,_0x23ad24['options']);var _0x216133={'where':_0x5b733b['where']};return db[_0x95dd('0x3b')][_0x95dd('0x1b')](_0x216133)[_0x95dd('0x21')](function(_0x31d433){_0x4b9b46[_0x95dd('0x1b')]=_0x31d433;if(_0x23ad24[_0x95dd('0x2d')][_0x95dd('0x3c')]){_0x5b733b[_0x95dd('0x3d')]=[{'all':!![]}];}return db[_0x95dd('0x3b')]['findAll'](_0x5b733b);})[_0x95dd('0x21')](function(_0x357771){_0x4b9b46[_0x95dd('0x3e')]=_0x357771;return _0x4b9b46;})[_0x95dd('0x21')](respondWithFilteredResult(_0x3959d4,_0x5b733b))[_0x95dd('0x3f')](handleError(_0x3959d4,null));};exports[_0x95dd('0x40')]=function(_0x1bb19e,_0x304aed){var _0x90009={'raw':![],'where':{'id':_0x1bb19e[_0x95dd('0x41')]['id']}},_0x5e6cbe={};_0x5e6cbe[_0x95dd('0x2c')]=_[_0x95dd('0x2e')](db[_0x95dd('0x3b')][_0x95dd('0x29')]);_0x5e6cbe[_0x95dd('0x2d')]=_['keys'](_0x1bb19e[_0x95dd('0x2d')]);_0x5e6cbe[_0x95dd('0x2f')]=_['intersection'](_0x5e6cbe[_0x95dd('0x2c')],_0x5e6cbe[_0x95dd('0x2d')]);_0x90009['attributes']=_[_0x95dd('0x30')](_0x5e6cbe[_0x95dd('0x2c')],qs[_0x95dd('0x32')](_0x1bb19e[_0x95dd('0x2d')][_0x95dd('0x32')]));_0x90009[_0x95dd('0x31')]=_0x90009['attributes']['length']?_0x90009[_0x95dd('0x31')]:_0x5e6cbe[_0x95dd('0x2c')];if(_0x1bb19e[_0x95dd('0x2d')][_0x95dd('0x3c')]){_0x90009[_0x95dd('0x3d')]=[{'all':!![]}];}_0x90009=_['merge']({},_0x90009,_0x1bb19e[_0x95dd('0x42')]);return db['SalesforceConfiguration'][_0x95dd('0x43')](_0x90009)[_0x95dd('0x21')](handleEntityNotFound(_0x304aed,null))[_0x95dd('0x21')](respondWithResult(_0x304aed,null))[_0x95dd('0x3f')](handleError(_0x304aed,null));};exports['create']=function(_0x56b620,_0x10718b){return db[_0x95dd('0x3b')][_0x95dd('0x44')](_0x56b620[_0x95dd('0x45')],{})[_0x95dd('0x21')](respondWithResult(_0x10718b,0xc9))['catch'](handleError(_0x10718b,null));};exports[_0x95dd('0x20')]=function(_0xeb4fa1,_0x1acda2){if(_0xeb4fa1[_0x95dd('0x45')]['id']){delete _0xeb4fa1['body']['id'];}return db[_0x95dd('0x3b')][_0x95dd('0x43')]({'where':{'id':_0xeb4fa1[_0x95dd('0x41')]['id']}})[_0x95dd('0x21')](handleEntityNotFound(_0x1acda2,null))['then'](saveUpdates(_0xeb4fa1[_0x95dd('0x45')],null))[_0x95dd('0x21')](respondWithResult(_0x1acda2,null))['catch'](handleError(_0x1acda2,null));};exports['destroy']=function(_0x23c385,_0x4493d3){return db[_0x95dd('0x3b')][_0x95dd('0x43')]({'where':{'id':_0x23c385[_0x95dd('0x41')]['id']}})[_0x95dd('0x21')](handleEntityNotFound(_0x4493d3,null))[_0x95dd('0x21')](removeEntity(_0x4493d3,null))[_0x95dd('0x3f')](handleError(_0x4493d3,null));};exports[_0x95dd('0x46')]=function(_0x2aee88,_0x5f011c,_0x331680){var _0x4fde00={};var _0x29433f={};var _0x5d183e;var _0x4cc4ce;return db[_0x95dd('0x3b')][_0x95dd('0x47')]({'where':{'id':_0x2aee88[_0x95dd('0x41')]['id']}})[_0x95dd('0x21')](handleEntityNotFound(_0x5f011c,null))[_0x95dd('0x21')](function(_0x4b6b3d){if(_0x4b6b3d){_0x5d183e=_0x4b6b3d;_0x29433f[_0x95dd('0x2c')]=_[_0x95dd('0x2e')](db[_0x95dd('0x48')][_0x95dd('0x29')]);_0x29433f[_0x95dd('0x2d')]=_['keys'](_0x2aee88[_0x95dd('0x2d')]);_0x29433f[_0x95dd('0x2f')]=_[_0x95dd('0x30')](_0x29433f['model'],_0x29433f[_0x95dd('0x2d')]);_0x4fde00[_0x95dd('0x31')]=_[_0x95dd('0x30')](_0x29433f[_0x95dd('0x2c')],qs[_0x95dd('0x32')](_0x2aee88[_0x95dd('0x2d')][_0x95dd('0x32')]));_0x4fde00['attributes']=_0x4fde00[_0x95dd('0x31')][_0x95dd('0x33')]?_0x4fde00[_0x95dd('0x31')]:_0x29433f['model'];_0x4fde00[_0x95dd('0x35')]=qs[_0x95dd('0x36')](_0x2aee88[_0x95dd('0x2d')][_0x95dd('0x36')]);_0x4fde00['where']=qs[_0x95dd('0x2f')](_[_0x95dd('0x49')](_0x2aee88[_0x95dd('0x2d')],_0x29433f[_0x95dd('0x2f')]));if(_0x2aee88[_0x95dd('0x2d')][_0x95dd('0x38')]){_0x4fde00[_0x95dd('0x37')]=_['merge'](_0x4fde00[_0x95dd('0x37')],{'$or':_['map'](_0x4fde00[_0x95dd('0x31')],function(_0x2ca10c){var _0x263e94={};_0x263e94[_0x2ca10c]={'$like':'%'+_0x2aee88['query'][_0x95dd('0x38')]+'%'};return _0x263e94;})});}_0x4fde00=_[_0x95dd('0x3a')]({},_0x4fde00,_0x2aee88[_0x95dd('0x42')]);return _0x5d183e[_0x95dd('0x46')](_0x4fde00);}})[_0x95dd('0x21')](function(_0xca519a){if(_0xca519a){_0x4cc4ce=_0xca519a[_0x95dd('0x33')];if(!_0x2aee88['query'][_0x95dd('0x4a')](_0x95dd('0x34'))){_0x4fde00[_0x95dd('0x1a')]=qs[_0x95dd('0x1a')](_0x2aee88[_0x95dd('0x2d')][_0x95dd('0x1a')]);_0x4fde00[_0x95dd('0x18')]=qs[_0x95dd('0x18')](_0x2aee88[_0x95dd('0x2d')]['offset']);}return _0x5d183e[_0x95dd('0x46')](_0x4fde00);}})[_0x95dd('0x21')](function(_0x381df3){if(_0x381df3){return _0x381df3?{'count':_0x4cc4ce,'rows':_0x381df3}:null;}})[_0x95dd('0x21')](respondWithResult(_0x5f011c,null))[_0x95dd('0x3f')](handleError(_0x5f011c,null));};exports['getSubjects']=function(_0x13f955,_0x51fa39,_0x1d4a10){var _0x475251={};var _0x45612b={};var _0x538b41;var _0xa5b72a;return db[_0x95dd('0x3b')][_0x95dd('0x47')]({'where':{'id':_0x13f955[_0x95dd('0x41')]['id']}})[_0x95dd('0x21')](handleEntityNotFound(_0x51fa39,null))[_0x95dd('0x21')](function(_0x115fce){if(_0x115fce){_0x538b41=_0x115fce;_0x45612b[_0x95dd('0x2c')]=_['keys'](db[_0x95dd('0x48')][_0x95dd('0x29')]);_0x45612b[_0x95dd('0x2d')]=_[_0x95dd('0x2e')](_0x13f955[_0x95dd('0x2d')]);_0x45612b[_0x95dd('0x2f')]=_[_0x95dd('0x30')](_0x45612b['model'],_0x45612b[_0x95dd('0x2d')]);_0x475251['attributes']=_[_0x95dd('0x30')](_0x45612b['model'],qs[_0x95dd('0x32')](_0x13f955[_0x95dd('0x2d')][_0x95dd('0x32')]));_0x475251[_0x95dd('0x31')]=_0x475251[_0x95dd('0x31')][_0x95dd('0x33')]?_0x475251[_0x95dd('0x31')]:_0x45612b[_0x95dd('0x2c')];_0x475251[_0x95dd('0x35')]=qs['sort'](_0x13f955[_0x95dd('0x2d')]['sort']);_0x475251[_0x95dd('0x37')]=qs[_0x95dd('0x2f')](_[_0x95dd('0x49')](_0x13f955['query'],_0x45612b[_0x95dd('0x2f')]));if(_0x13f955['query']['filter']){_0x475251[_0x95dd('0x37')]=_[_0x95dd('0x3a')](_0x475251[_0x95dd('0x37')],{'$or':_[_0x95dd('0x28')](_0x475251[_0x95dd('0x31')],function(_0x10008f){var _0x289257={};_0x289257[_0x10008f]={'$like':'%'+_0x13f955[_0x95dd('0x2d')][_0x95dd('0x38')]+'%'};return _0x289257;})});}_0x475251=_[_0x95dd('0x3a')]({},_0x475251,_0x13f955['options']);return _0x538b41[_0x95dd('0x4b')](_0x475251);}})[_0x95dd('0x21')](function(_0x11ed22){if(_0x11ed22){_0xa5b72a=_0x11ed22[_0x95dd('0x33')];if(!_0x13f955['query']['hasOwnProperty'](_0x95dd('0x34'))){_0x475251['limit']=qs[_0x95dd('0x1a')](_0x13f955[_0x95dd('0x2d')][_0x95dd('0x1a')]);_0x475251[_0x95dd('0x18')]=qs[_0x95dd('0x18')](_0x13f955[_0x95dd('0x2d')][_0x95dd('0x18')]);}return _0x538b41['getSubjects'](_0x475251);}})['then'](function(_0x4780c6){if(_0x4780c6){return _0x4780c6?{'count':_0xa5b72a,'rows':_0x4780c6}:null;}})[_0x95dd('0x21')](respondWithResult(_0x51fa39,null))['catch'](handleError(_0x51fa39,null));};exports[_0x95dd('0x4c')]=function(_0x33567b,_0xab56ab,_0x50f2f6){var _0xdc15={};var _0x2d6830={};var _0xc8b7e9;var _0xb67485;return db[_0x95dd('0x3b')]['findOne']({'where':{'id':_0x33567b[_0x95dd('0x41')]['id']}})['then'](handleEntityNotFound(_0xab56ab,null))[_0x95dd('0x21')](function(_0x1c1e25){if(_0x1c1e25){_0xc8b7e9=_0x1c1e25;_0x2d6830[_0x95dd('0x2c')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x2d6830[_0x95dd('0x2d')]=_[_0x95dd('0x2e')](_0x33567b[_0x95dd('0x2d')]);_0x2d6830['filters']=_[_0x95dd('0x30')](_0x2d6830[_0x95dd('0x2c')],_0x2d6830['query']);_0xdc15['attributes']=_[_0x95dd('0x30')](_0x2d6830[_0x95dd('0x2c')],qs['fields'](_0x33567b[_0x95dd('0x2d')][_0x95dd('0x32')]));_0xdc15[_0x95dd('0x31')]=_0xdc15['attributes'][_0x95dd('0x33')]?_0xdc15['attributes']:_0x2d6830[_0x95dd('0x2c')];_0xdc15[_0x95dd('0x35')]=qs[_0x95dd('0x36')](_0x33567b['query'][_0x95dd('0x36')]);_0xdc15['where']=qs['filters'](_[_0x95dd('0x49')](_0x33567b['query'],_0x2d6830['filters']));if(_0x33567b[_0x95dd('0x2d')][_0x95dd('0x38')]){_0xdc15[_0x95dd('0x37')]=_['merge'](_0xdc15[_0x95dd('0x37')],{'$or':_['map'](_0xdc15[_0x95dd('0x31')],function(_0x32503b){var _0x5b063a={};_0x5b063a[_0x32503b]={'$like':'%'+_0x33567b[_0x95dd('0x2d')][_0x95dd('0x38')]+'%'};return _0x5b063a;})});}_0xdc15=_['merge']({},_0xdc15,_0x33567b['options']);return _0xc8b7e9[_0x95dd('0x4c')](_0xdc15);}})[_0x95dd('0x21')](function(_0x4ad278){if(_0x4ad278){_0xb67485=_0x4ad278[_0x95dd('0x33')];if(!_0x33567b[_0x95dd('0x2d')][_0x95dd('0x4a')](_0x95dd('0x34'))){_0xdc15[_0x95dd('0x1a')]=qs[_0x95dd('0x1a')](_0x33567b['query']['limit']);_0xdc15[_0x95dd('0x18')]=qs['offset'](_0x33567b[_0x95dd('0x2d')][_0x95dd('0x18')]);}return _0xc8b7e9[_0x95dd('0x4c')](_0xdc15);}})[_0x95dd('0x21')](function(_0x2a3f4b){if(_0x2a3f4b){return _0x2a3f4b?{'count':_0xb67485,'rows':_0x2a3f4b}:null;}})[_0x95dd('0x21')](respondWithResult(_0xab56ab,null))[_0x95dd('0x3f')](handleError(_0xab56ab,null));}; \ No newline at end of file +var _0xfd25=['index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','create','body','find','destroy','params','getFields','length','order','getSubjects','findOne','pick','getDescriptions','SalesforceField','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','stack','name','send'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfd25,0x169));var _0x5fd2=function(_0x34b81b,_0x266cb8){_0x34b81b=_0x34b81b-0x0;var _0x38cf88=_0xfd25[_0x34b81b];return _0x38cf88;};'use strict';var emlformat=require(_0x5fd2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5fd2('0x1'));var rp=require(_0x5fd2('0x2'));var moment=require(_0x5fd2('0x3'));var BPromise=require(_0x5fd2('0x4'));var Mustache=require(_0x5fd2('0x5'));var util=require(_0x5fd2('0x6'));var path=require('path');var sox=require(_0x5fd2('0x7'));var csv=require(_0x5fd2('0x8'));var ejs=require(_0x5fd2('0x9'));var fs=require('fs');var fs_extra=require(_0x5fd2('0xa'));var _=require(_0x5fd2('0xb'));var squel=require('squel');var crypto=require(_0x5fd2('0xc'));var jsforce=require(_0x5fd2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5fd2('0x8'));var querystring=require(_0x5fd2('0xe'));var Papa=require(_0x5fd2('0xf'));var Redis=require(_0x5fd2('0x10'));var authService=require(_0x5fd2('0x11'));var qs=require(_0x5fd2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fd2('0x13'))(_0x5fd2('0x14'));var utils=require('../../config/utils');var config=require(_0x5fd2('0x15'));var licenseUtil=require(_0x5fd2('0x16'));var db=require(_0x5fd2('0x17'))['db'];function respondWithStatusCode(_0x3aa4b5,_0x2b8bcc){_0x2b8bcc=_0x2b8bcc||0xcc;return function(_0x21e26d){if(_0x21e26d){return _0x3aa4b5[_0x5fd2('0x18')](_0x2b8bcc);}return _0x3aa4b5[_0x5fd2('0x19')](_0x2b8bcc)['end']();};}function respondWithResult(_0x1f3475,_0x411f65){_0x411f65=_0x411f65||0xc8;return function(_0x2228b2){if(_0x2228b2){return _0x1f3475[_0x5fd2('0x19')](_0x411f65)[_0x5fd2('0x1a')](_0x2228b2);}};}function respondWithFilteredResult(_0x34abb6,_0x200534){return function(_0x477e44){if(_0x477e44){var _0x55e5a9=typeof _0x200534['offset']===_0x5fd2('0x1b')&&typeof _0x200534[_0x5fd2('0x1c')]===_0x5fd2('0x1b');var _0x1f7d40=_0x477e44['count'];var _0x14170b=_0x55e5a9?0x0:_0x200534[_0x5fd2('0x1d')];var _0x5353f8=_0x55e5a9?_0x477e44['count']:_0x200534['offset']+_0x200534[_0x5fd2('0x1c')];var _0x4e46d1;if(_0x5353f8>=_0x1f7d40){_0x5353f8=_0x1f7d40;_0x4e46d1=0xc8;}else{_0x4e46d1=0xce;}_0x34abb6['status'](_0x4e46d1);return _0x34abb6[_0x5fd2('0x1e')](_0x5fd2('0x1f'),_0x14170b+'-'+_0x5353f8+'/'+_0x1f7d40)['json'](_0x477e44);}return null;};}function patchUpdates(_0x2b36bf){return function(_0x5bfe32){try{jsonpatch['apply'](_0x5bfe32,_0x2b36bf,!![]);}catch(_0x2908b9){return BPromise[_0x5fd2('0x20')](_0x2908b9);}return _0x5bfe32[_0x5fd2('0x21')]();};}function saveUpdates(_0x308be5,_0x490398){return function(_0x32889c){if(_0x32889c){return _0x32889c[_0x5fd2('0x22')](_0x308be5)[_0x5fd2('0x23')](function(_0x314bba){return _0x314bba;});}return null;};}function removeEntity(_0x23fe9b,_0x258b68){return function(_0x80e69a){if(_0x80e69a){return _0x80e69a['destroy']()['then'](function(){_0x23fe9b[_0x5fd2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f9e4,_0x377434){return function(_0x48cb79){if(!_0x48cb79){_0x18f9e4[_0x5fd2('0x18')](0x194);}return _0x48cb79;};}function handleError(_0x14b29f,_0x1862ec){_0x1862ec=_0x1862ec||0x1f4;return function(_0x10cfa7){logger['error'](_0x10cfa7[_0x5fd2('0x24')]);if(_0x10cfa7[_0x5fd2('0x25')]){delete _0x10cfa7[_0x5fd2('0x25')];}_0x14b29f[_0x5fd2('0x19')](_0x1862ec)[_0x5fd2('0x26')](_0x10cfa7);};}exports[_0x5fd2('0x27')]=function(_0x3988cb,_0x40d2d7){var _0x3fbf27={},_0x76278f={},_0x449257={'count':0x0,'rows':[]};var _0x2dd0e4=_[_0x5fd2('0x28')](db[_0x5fd2('0x29')][_0x5fd2('0x2a')],function(_0x3f7f4f){return{'name':_0x3f7f4f[_0x5fd2('0x2b')],'type':_0x3f7f4f[_0x5fd2('0x2c')]['key']};});_0x76278f[_0x5fd2('0x2d')]=_['map'](_0x2dd0e4,'name');_0x76278f[_0x5fd2('0x2e')]=_[_0x5fd2('0x2f')](_0x3988cb['query']);_0x76278f[_0x5fd2('0x30')]=_[_0x5fd2('0x31')](_0x76278f['model'],_0x76278f[_0x5fd2('0x2e')]);_0x3fbf27[_0x5fd2('0x32')]=_['intersection'](_0x76278f[_0x5fd2('0x2d')],qs[_0x5fd2('0x33')](_0x3988cb[_0x5fd2('0x2e')]['fields']));_0x3fbf27[_0x5fd2('0x32')]=_0x3fbf27[_0x5fd2('0x32')]['length']?_0x3fbf27[_0x5fd2('0x32')]:_0x76278f[_0x5fd2('0x2d')];if(!_0x3988cb[_0x5fd2('0x2e')][_0x5fd2('0x34')](_0x5fd2('0x35'))){_0x3fbf27['limit']=qs['limit'](_0x3988cb[_0x5fd2('0x2e')]['limit']);_0x3fbf27[_0x5fd2('0x1d')]=qs[_0x5fd2('0x1d')](_0x3988cb[_0x5fd2('0x2e')][_0x5fd2('0x1d')]);}_0x3fbf27['order']=qs[_0x5fd2('0x36')](_0x3988cb[_0x5fd2('0x2e')][_0x5fd2('0x36')]);_0x3fbf27[_0x5fd2('0x37')]=qs['filters'](_['pick'](_0x3988cb[_0x5fd2('0x2e')],_0x76278f[_0x5fd2('0x30')]),_0x2dd0e4);if(_0x3988cb[_0x5fd2('0x2e')][_0x5fd2('0x38')]){_0x3fbf27[_0x5fd2('0x37')]=_[_0x5fd2('0x39')](_0x3fbf27[_0x5fd2('0x37')],{'$or':_[_0x5fd2('0x28')](_0x2dd0e4,function(_0x9560ce){if(_0x9560ce[_0x5fd2('0x2c')]!==_0x5fd2('0x3a')){var _0x52106e={};_0x52106e[_0x9560ce[_0x5fd2('0x25')]]={'$like':'%'+_0x3988cb[_0x5fd2('0x2e')][_0x5fd2('0x38')]+'%'};return _0x52106e;}})});}_0x3fbf27=_[_0x5fd2('0x39')]({},_0x3fbf27,_0x3988cb[_0x5fd2('0x3b')]);var _0x5a0fec={'where':_0x3fbf27[_0x5fd2('0x37')]};return db[_0x5fd2('0x29')][_0x5fd2('0x3c')](_0x5a0fec)['then'](function(_0x3b39e1){_0x449257[_0x5fd2('0x3c')]=_0x3b39e1;if(_0x3988cb[_0x5fd2('0x2e')]['includeAll']){_0x3fbf27[_0x5fd2('0x3d')]=[{'all':!![]}];}return db[_0x5fd2('0x29')][_0x5fd2('0x3e')](_0x3fbf27);})['then'](function(_0xc4236c){_0x449257[_0x5fd2('0x3f')]=_0xc4236c;return _0x449257;})[_0x5fd2('0x23')](respondWithFilteredResult(_0x40d2d7,_0x3fbf27))[_0x5fd2('0x40')](handleError(_0x40d2d7,null));};exports[_0x5fd2('0x41')]=function(_0x5ae7c4,_0x4fa53a){var _0x57ae07={'raw':![],'where':{'id':_0x5ae7c4['params']['id']}},_0x426619={};_0x426619[_0x5fd2('0x2d')]=_[_0x5fd2('0x2f')](db['SalesforceConfiguration'][_0x5fd2('0x2a')]);_0x426619['query']=_['keys'](_0x5ae7c4[_0x5fd2('0x2e')]);_0x426619[_0x5fd2('0x30')]=_[_0x5fd2('0x31')](_0x426619['model'],_0x426619[_0x5fd2('0x2e')]);_0x57ae07['attributes']=_[_0x5fd2('0x31')](_0x426619['model'],qs[_0x5fd2('0x33')](_0x5ae7c4[_0x5fd2('0x2e')]['fields']));_0x57ae07['attributes']=_0x57ae07[_0x5fd2('0x32')]['length']?_0x57ae07[_0x5fd2('0x32')]:_0x426619[_0x5fd2('0x2d')];if(_0x5ae7c4['query'][_0x5fd2('0x42')]){_0x57ae07[_0x5fd2('0x3d')]=[{'all':!![]}];}_0x57ae07=_[_0x5fd2('0x39')]({},_0x57ae07,_0x5ae7c4[_0x5fd2('0x3b')]);return db[_0x5fd2('0x29')]['find'](_0x57ae07)[_0x5fd2('0x23')](handleEntityNotFound(_0x4fa53a,null))[_0x5fd2('0x23')](respondWithResult(_0x4fa53a,null))[_0x5fd2('0x40')](handleError(_0x4fa53a,null));};exports[_0x5fd2('0x43')]=function(_0x5320f4,_0x5e3d06){return db[_0x5fd2('0x29')][_0x5fd2('0x43')](_0x5320f4[_0x5fd2('0x44')],{})[_0x5fd2('0x23')](respondWithResult(_0x5e3d06,0xc9))[_0x5fd2('0x40')](handleError(_0x5e3d06,null));};exports[_0x5fd2('0x22')]=function(_0x1ff56d,_0x69d0b2){if(_0x1ff56d[_0x5fd2('0x44')]['id']){delete _0x1ff56d[_0x5fd2('0x44')]['id'];}return db['SalesforceConfiguration'][_0x5fd2('0x45')]({'where':{'id':_0x1ff56d['params']['id']}})['then'](handleEntityNotFound(_0x69d0b2,null))[_0x5fd2('0x23')](saveUpdates(_0x1ff56d[_0x5fd2('0x44')],null))['then'](respondWithResult(_0x69d0b2,null))[_0x5fd2('0x40')](handleError(_0x69d0b2,null));};exports[_0x5fd2('0x46')]=function(_0x268772,_0x1f5a8f){return db[_0x5fd2('0x29')]['find']({'where':{'id':_0x268772[_0x5fd2('0x47')]['id']}})[_0x5fd2('0x23')](handleEntityNotFound(_0x1f5a8f,null))[_0x5fd2('0x23')](removeEntity(_0x1f5a8f,null))['catch'](handleError(_0x1f5a8f,null));};exports[_0x5fd2('0x48')]=function(_0x5489b7,_0x5e331e,_0x2ed760){var _0x24853b={};var _0x574c11={};var _0x4ecfac;var _0x3cf3ec;return db[_0x5fd2('0x29')]['findOne']({'where':{'id':_0x5489b7[_0x5fd2('0x47')]['id']}})[_0x5fd2('0x23')](handleEntityNotFound(_0x5e331e,null))['then'](function(_0xb5fca2){if(_0xb5fca2){_0x4ecfac=_0xb5fca2;_0x574c11[_0x5fd2('0x2d')]=_[_0x5fd2('0x2f')](db['SalesforceField'][_0x5fd2('0x2a')]);_0x574c11[_0x5fd2('0x2e')]=_[_0x5fd2('0x2f')](_0x5489b7[_0x5fd2('0x2e')]);_0x574c11[_0x5fd2('0x30')]=_[_0x5fd2('0x31')](_0x574c11[_0x5fd2('0x2d')],_0x574c11[_0x5fd2('0x2e')]);_0x24853b[_0x5fd2('0x32')]=_['intersection'](_0x574c11[_0x5fd2('0x2d')],qs['fields'](_0x5489b7[_0x5fd2('0x2e')]['fields']));_0x24853b[_0x5fd2('0x32')]=_0x24853b[_0x5fd2('0x32')][_0x5fd2('0x49')]?_0x24853b['attributes']:_0x574c11[_0x5fd2('0x2d')];_0x24853b[_0x5fd2('0x4a')]=qs[_0x5fd2('0x36')](_0x5489b7[_0x5fd2('0x2e')][_0x5fd2('0x36')]);_0x24853b[_0x5fd2('0x37')]=qs[_0x5fd2('0x30')](_['pick'](_0x5489b7[_0x5fd2('0x2e')],_0x574c11[_0x5fd2('0x30')]));if(_0x5489b7[_0x5fd2('0x2e')][_0x5fd2('0x38')]){_0x24853b[_0x5fd2('0x37')]=_['merge'](_0x24853b['where'],{'$or':_['map'](_0x24853b[_0x5fd2('0x32')],function(_0x36d3ab){var _0x5bb801={};_0x5bb801[_0x36d3ab]={'$like':'%'+_0x5489b7['query'][_0x5fd2('0x38')]+'%'};return _0x5bb801;})});}_0x24853b=_[_0x5fd2('0x39')]({},_0x24853b,_0x5489b7[_0x5fd2('0x3b')]);return _0x4ecfac[_0x5fd2('0x48')](_0x24853b);}})[_0x5fd2('0x23')](function(_0x2d080c){if(_0x2d080c){_0x3cf3ec=_0x2d080c[_0x5fd2('0x49')];if(!_0x5489b7[_0x5fd2('0x2e')][_0x5fd2('0x34')](_0x5fd2('0x35'))){_0x24853b[_0x5fd2('0x1c')]=qs[_0x5fd2('0x1c')](_0x5489b7[_0x5fd2('0x2e')][_0x5fd2('0x1c')]);_0x24853b['offset']=qs[_0x5fd2('0x1d')](_0x5489b7[_0x5fd2('0x2e')][_0x5fd2('0x1d')]);}return _0x4ecfac[_0x5fd2('0x48')](_0x24853b);}})['then'](function(_0x594d97){if(_0x594d97){return _0x594d97?{'count':_0x3cf3ec,'rows':_0x594d97}:null;}})[_0x5fd2('0x23')](respondWithResult(_0x5e331e,null))['catch'](handleError(_0x5e331e,null));};exports[_0x5fd2('0x4b')]=function(_0x39ee75,_0x992e71,_0x867728){var _0x4f6252={};var _0x469023={};var _0x2d0333;var _0x2b73ab;return db[_0x5fd2('0x29')][_0x5fd2('0x4c')]({'where':{'id':_0x39ee75[_0x5fd2('0x47')]['id']}})[_0x5fd2('0x23')](handleEntityNotFound(_0x992e71,null))[_0x5fd2('0x23')](function(_0x5c98fd){if(_0x5c98fd){_0x2d0333=_0x5c98fd;_0x469023[_0x5fd2('0x2d')]=_[_0x5fd2('0x2f')](db['SalesforceField'][_0x5fd2('0x2a')]);_0x469023[_0x5fd2('0x2e')]=_[_0x5fd2('0x2f')](_0x39ee75[_0x5fd2('0x2e')]);_0x469023[_0x5fd2('0x30')]=_[_0x5fd2('0x31')](_0x469023[_0x5fd2('0x2d')],_0x469023[_0x5fd2('0x2e')]);_0x4f6252[_0x5fd2('0x32')]=_['intersection'](_0x469023[_0x5fd2('0x2d')],qs[_0x5fd2('0x33')](_0x39ee75[_0x5fd2('0x2e')][_0x5fd2('0x33')]));_0x4f6252[_0x5fd2('0x32')]=_0x4f6252[_0x5fd2('0x32')][_0x5fd2('0x49')]?_0x4f6252['attributes']:_0x469023['model'];_0x4f6252[_0x5fd2('0x4a')]=qs['sort'](_0x39ee75[_0x5fd2('0x2e')][_0x5fd2('0x36')]);_0x4f6252[_0x5fd2('0x37')]=qs[_0x5fd2('0x30')](_[_0x5fd2('0x4d')](_0x39ee75['query'],_0x469023[_0x5fd2('0x30')]));if(_0x39ee75['query'][_0x5fd2('0x38')]){_0x4f6252[_0x5fd2('0x37')]=_[_0x5fd2('0x39')](_0x4f6252['where'],{'$or':_[_0x5fd2('0x28')](_0x4f6252[_0x5fd2('0x32')],function(_0x35c21f){var _0x68f1d3={};_0x68f1d3[_0x35c21f]={'$like':'%'+_0x39ee75[_0x5fd2('0x2e')][_0x5fd2('0x38')]+'%'};return _0x68f1d3;})});}_0x4f6252=_[_0x5fd2('0x39')]({},_0x4f6252,_0x39ee75['options']);return _0x2d0333[_0x5fd2('0x4b')](_0x4f6252);}})[_0x5fd2('0x23')](function(_0x1c6823){if(_0x1c6823){_0x2b73ab=_0x1c6823[_0x5fd2('0x49')];if(!_0x39ee75[_0x5fd2('0x2e')][_0x5fd2('0x34')](_0x5fd2('0x35'))){_0x4f6252[_0x5fd2('0x1c')]=qs[_0x5fd2('0x1c')](_0x39ee75[_0x5fd2('0x2e')]['limit']);_0x4f6252[_0x5fd2('0x1d')]=qs['offset'](_0x39ee75[_0x5fd2('0x2e')][_0x5fd2('0x1d')]);}return _0x2d0333['getSubjects'](_0x4f6252);}})[_0x5fd2('0x23')](function(_0x421c1b){if(_0x421c1b){return _0x421c1b?{'count':_0x2b73ab,'rows':_0x421c1b}:null;}})[_0x5fd2('0x23')](respondWithResult(_0x992e71,null))[_0x5fd2('0x40')](handleError(_0x992e71,null));};exports[_0x5fd2('0x4e')]=function(_0x32e564,_0x27352b,_0x1c4401){var _0x50b46a={};var _0x369cd7={};var _0x2d4b0a;var _0x4fd632;return db[_0x5fd2('0x29')]['findOne']({'where':{'id':_0x32e564[_0x5fd2('0x47')]['id']}})[_0x5fd2('0x23')](handleEntityNotFound(_0x27352b,null))['then'](function(_0x3d5599){if(_0x3d5599){_0x2d4b0a=_0x3d5599;_0x369cd7[_0x5fd2('0x2d')]=_[_0x5fd2('0x2f')](db[_0x5fd2('0x4f')][_0x5fd2('0x2a')]);_0x369cd7[_0x5fd2('0x2e')]=_[_0x5fd2('0x2f')](_0x32e564[_0x5fd2('0x2e')]);_0x369cd7[_0x5fd2('0x30')]=_[_0x5fd2('0x31')](_0x369cd7['model'],_0x369cd7[_0x5fd2('0x2e')]);_0x50b46a[_0x5fd2('0x32')]=_[_0x5fd2('0x31')](_0x369cd7[_0x5fd2('0x2d')],qs[_0x5fd2('0x33')](_0x32e564[_0x5fd2('0x2e')][_0x5fd2('0x33')]));_0x50b46a[_0x5fd2('0x32')]=_0x50b46a[_0x5fd2('0x32')][_0x5fd2('0x49')]?_0x50b46a[_0x5fd2('0x32')]:_0x369cd7[_0x5fd2('0x2d')];_0x50b46a[_0x5fd2('0x4a')]=qs[_0x5fd2('0x36')](_0x32e564[_0x5fd2('0x2e')][_0x5fd2('0x36')]);_0x50b46a['where']=qs['filters'](_['pick'](_0x32e564['query'],_0x369cd7['filters']));if(_0x32e564[_0x5fd2('0x2e')]['filter']){_0x50b46a[_0x5fd2('0x37')]=_[_0x5fd2('0x39')](_0x50b46a[_0x5fd2('0x37')],{'$or':_[_0x5fd2('0x28')](_0x50b46a[_0x5fd2('0x32')],function(_0x2f6d5c){var _0x208674={};_0x208674[_0x2f6d5c]={'$like':'%'+_0x32e564[_0x5fd2('0x2e')][_0x5fd2('0x38')]+'%'};return _0x208674;})});}_0x50b46a=_[_0x5fd2('0x39')]({},_0x50b46a,_0x32e564['options']);return _0x2d4b0a[_0x5fd2('0x4e')](_0x50b46a);}})['then'](function(_0x32bf99){if(_0x32bf99){_0x4fd632=_0x32bf99[_0x5fd2('0x49')];if(!_0x32e564['query']['hasOwnProperty'](_0x5fd2('0x35'))){_0x50b46a[_0x5fd2('0x1c')]=qs[_0x5fd2('0x1c')](_0x32e564[_0x5fd2('0x2e')][_0x5fd2('0x1c')]);_0x50b46a[_0x5fd2('0x1d')]=qs['offset'](_0x32e564[_0x5fd2('0x2e')]['offset']);}return _0x2d4b0a['getDescriptions'](_0x50b46a);}})['then'](function(_0x2b461b){if(_0x2b461b){return _0x2b461b?{'count':_0x4fd632,'rows':_0x2b461b}:null;}})[_0x5fd2('0x23')](respondWithResult(_0x27352b,null))['catch'](handleError(_0x27352b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 971ee45..61f98c2 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 _0xb050=['SalesforceConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define'];(function(_0x18b503,_0x29d87b){var _0x37a9c7=function(_0x1c914a){while(--_0x1c914a){_0x18b503['push'](_0x18b503['shift']());}};_0x37a9c7(++_0x29d87b);}(_0xb050,0xfd));var _0x0b05=function(_0x2dc549,_0x6d8f87){_0x2dc549=_0x2dc549-0x0;var _0x91762b=_0xb050[_0x2dc549];return _0x91762b;};'use strict';var _=require(_0x0b05('0x0'));var util=require(_0x0b05('0x1'));var logger=require(_0x0b05('0x2'))(_0x0b05('0x3'));var moment=require('moment');var BPromise=require(_0x0b05('0x4'));var rp=require(_0x0b05('0x5'));var fs=require('fs');var path=require(_0x0b05('0x6'));var rimraf=require(_0x0b05('0x7'));var config=require(_0x0b05('0x8'));var attributes=require(_0x0b05('0x9'));module['exports']=function(_0xa5d206,_0x10c043){return _0xa5d206[_0x0b05('0xa')](_0x0b05('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb90b=['exports','util','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes'];(function(_0x216b50,_0x1d935f){var _0x4a17fa=function(_0x226c6d){while(--_0x226c6d){_0x216b50['push'](_0x216b50['shift']());}};_0x4a17fa(++_0x1d935f);}(_0xb90b,0xac));var _0xbb90=function(_0x2e5c3c,_0x1dcc68){_0x2e5c3c=_0x2e5c3c-0x0;var _0x25b5da=_0xb90b[_0x2e5c3c];return _0x25b5da;};'use strict';var _=require('lodash');var util=require(_0xbb90('0x0'));var logger=require('../../config/logger')(_0xbb90('0x1'));var moment=require(_0xbb90('0x2'));var BPromise=require(_0xbb90('0x3'));var rp=require(_0xbb90('0x4'));var fs=require('fs');var path=require(_0xbb90('0x5'));var rimraf=require(_0xbb90('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb90('0x7'));module[_0xbb90('0x8')]=function(_0xabeaed,_0x519137){return _0xabeaed['define']('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 13a7613..14a6ad8 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 _0x9bc1=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x47fb25,_0x3e7cff){var _0x2d63fc=function(_0x4618e6){while(--_0x4618e6){_0x47fb25['push'](_0x47fb25['shift']());}};_0x2d63fc(++_0x3e7cff);}(_0x9bc1,0xc1));var _0x19bc=function(_0x5a91d9,_0x47cedb){_0x5a91d9=_0x5a91d9-0x0;var _0x5275e2=_0x9bc1[_0x5a91d9];return _0x5275e2;};'use strict';var _=require(_0x19bc('0x0'));var util=require('util');var moment=require(_0x19bc('0x1'));var BPromise=require(_0x19bc('0x2'));var rs=require(_0x19bc('0x3'));var fs=require('fs');var Redis=require(_0x19bc('0x4'));var db=require(_0x19bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19bc('0x6'))(_0x19bc('0x7'));var config=require(_0x19bc('0x8'));var jayson=require(_0x19bc('0x9'));var client=jayson[_0x19bc('0xa')][_0x19bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa43327,_0x1ceb16,_0x20fdfb){return new BPromise(function(_0x148cfb,_0x28476f){return client['request'](_0xa43327,_0x20fdfb)[_0x19bc('0xc')](function(_0x39c755){logger[_0x19bc('0xd')](_0x19bc('0xe'),_0x1ceb16,_0x19bc('0xf'));logger[_0x19bc('0x10')](_0x19bc('0x11'),_0x1ceb16,'request\x20sent',JSON[_0x19bc('0x12')](_0x39c755));if(_0x39c755['error']){if(_0x39c755[_0x19bc('0x13')][_0x19bc('0x14')]===0x1f4){logger[_0x19bc('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1ceb16,_0x39c755['error'][_0x19bc('0x15')]);return _0x28476f(_0x39c755[_0x19bc('0x13')][_0x19bc('0x15')]);}logger['error'](_0x19bc('0xe'),_0x1ceb16,_0x39c755[_0x19bc('0x13')][_0x19bc('0x15')]);return _0x148cfb(_0x39c755[_0x19bc('0x13')][_0x19bc('0x15')]);}else{logger[_0x19bc('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1ceb16,_0x19bc('0xf'));_0x148cfb(_0x39c755[_0x19bc('0x16')][_0x19bc('0x15')]);}})[_0x19bc('0x17')](function(_0x139d77){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1ceb16,_0x139d77);_0x28476f(_0x139d77);});});} \ No newline at end of file +var _0xf817=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4dabc5,_0x56682){var _0x4f47b5=function(_0x2face1){while(--_0x2face1){_0x4dabc5['push'](_0x4dabc5['shift']());}};_0x4f47b5(++_0x56682);}(_0xf817,0x15f));var _0x7f81=function(_0x689a76,_0x2b5ce9){_0x689a76=_0x689a76-0x0;var _0x473e8e=_0xf817[_0x689a76];return _0x473e8e;};'use strict';var _=require(_0x7f81('0x0'));var util=require('util');var moment=require(_0x7f81('0x1'));var BPromise=require(_0x7f81('0x2'));var rs=require(_0x7f81('0x3'));var fs=require('fs');var Redis=require(_0x7f81('0x4'));var db=require(_0x7f81('0x5'))['db'];var utils=require(_0x7f81('0x6'));var logger=require(_0x7f81('0x7'))(_0x7f81('0x8'));var config=require(_0x7f81('0x9'));var jayson=require(_0x7f81('0xa'));var client=jayson[_0x7f81('0xb')][_0x7f81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21530c,_0x4a43ad,_0x46f655){return new BPromise(function(_0x1c863d,_0x6ec037){return client[_0x7f81('0xd')](_0x21530c,_0x46f655)['then'](function(_0x11d8a6){logger['info'](_0x7f81('0xe'),_0x4a43ad,_0x7f81('0xf'));logger[_0x7f81('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4a43ad,_0x7f81('0xf'),JSON['stringify'](_0x11d8a6));if(_0x11d8a6[_0x7f81('0x11')]){if(_0x11d8a6[_0x7f81('0x11')]['code']===0x1f4){logger[_0x7f81('0x11')](_0x7f81('0xe'),_0x4a43ad,_0x11d8a6['error']['message']);return _0x6ec037(_0x11d8a6[_0x7f81('0x11')]['message']);}logger[_0x7f81('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4a43ad,_0x11d8a6[_0x7f81('0x11')][_0x7f81('0x12')]);return _0x1c863d(_0x11d8a6[_0x7f81('0x11')][_0x7f81('0x12')]);}else{logger[_0x7f81('0x13')](_0x7f81('0xe'),_0x4a43ad,_0x7f81('0xf'));_0x1c863d(_0x11d8a6['result']['message']);}})[_0x7f81('0x14')](function(_0x22cb8a){logger['error'](_0x7f81('0xe'),_0x4a43ad,_0x22cb8a);_0x6ec037(_0x22cb8a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d5d7ec7..bb12ee4 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 _0x7ea0=['show','post','create','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x509004,_0x555592){var _0x335abe=function(_0x3ab792){while(--_0x3ab792){_0x509004['push'](_0x509004['shift']());}};_0x335abe(++_0x555592);}(_0x7ea0,0x14a));var _0x07ea=function(_0x53da2f,_0x5c356a){_0x53da2f=_0x53da2f-0x0;var _0x2d6c12=_0x7ea0[_0x53da2f];return _0x2d6c12;};'use strict';var multer=require('multer');var util=require(_0x07ea('0x0'));var path=require(_0x07ea('0x1'));var timeout=require(_0x07ea('0x2'));var express=require(_0x07ea('0x3'));var router=express[_0x07ea('0x4')]();var fs_extra=require(_0x07ea('0x5'));var auth=require(_0x07ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x07ea('0x7'));var controller=require(_0x07ea('0x8'));router[_0x07ea('0x9')]('/',auth[_0x07ea('0xa')](),controller[_0x07ea('0xb')]);router[_0x07ea('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x07ea('0xc')]);router[_0x07ea('0xd')]('/',auth[_0x07ea('0xa')](),controller[_0x07ea('0xe')]);router['put']('/:id',auth[_0x07ea('0xa')](),controller[_0x07ea('0xf')]);router[_0x07ea('0x10')](_0x07ea('0x11'),auth[_0x07ea('0xa')](),controller['destroy']);module[_0x07ea('0x12')]=router; \ No newline at end of file +var _0xd72b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer'];(function(_0x5f4b52,_0x180a0e){var _0x53e624=function(_0x4df67a){while(--_0x4df67a){_0x5f4b52['push'](_0x5f4b52['shift']());}};_0x53e624(++_0x180a0e);}(_0xd72b,0x18e));var _0xbd72=function(_0x3924c6,_0x37c75f){_0x3924c6=_0x3924c6-0x0;var _0x29a465=_0xd72b[_0x3924c6];return _0x29a465;};'use strict';var multer=require(_0xbd72('0x0'));var util=require(_0xbd72('0x1'));var path=require(_0xbd72('0x2'));var timeout=require(_0xbd72('0x3'));var express=require(_0xbd72('0x4'));var router=express[_0xbd72('0x5')]();var fs_extra=require(_0xbd72('0x6'));var auth=require(_0xbd72('0x7'));var interaction=require(_0xbd72('0x8'));var config=require(_0xbd72('0x9'));var controller=require(_0xbd72('0xa'));router[_0xbd72('0xb')]('/',auth[_0xbd72('0xc')](),controller[_0xbd72('0xd')]);router['get'](_0xbd72('0xe'),auth['isAuthenticated'](),controller[_0xbd72('0xf')]);router[_0xbd72('0x10')]('/',auth[_0xbd72('0xc')](),controller[_0xbd72('0x11')]);router[_0xbd72('0x12')]('/:id',auth[_0xbd72('0xc')](),controller[_0xbd72('0x13')]);router['delete'](_0xbd72('0xe'),auth[_0xbd72('0xc')](),controller['destroy']);module[_0xbd72('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 2cd95f5..585b67d 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 _0x20d1=['variable','customVariable','keyValue','STRING','sequelize','ENUM','string'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x20d1,0x107));var _0x120d=function(_0x2254f3,_0x36ed5c){_0x2254f3=_0x2254f3-0x0;var _0x2e3ec5=_0x20d1[_0x2254f3];return _0x2e3ec5;};'use strict';var Sequelize=require(_0x120d('0x0'));module['exports']={'type':{'type':Sequelize[_0x120d('0x1')](_0x120d('0x2'),_0x120d('0x3'),_0x120d('0x4'),_0x120d('0x5'),'picklist'),'defaultValue':_0x120d('0x2')},'content':{'type':Sequelize[_0x120d('0x6')]},'key':{'type':Sequelize[_0x120d('0x6')]},'keyType':{'type':Sequelize[_0x120d('0x1')]('string','variable',_0x120d('0x4'))},'keyContent':{'type':Sequelize[_0x120d('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0728=['keyValue','picklist','string','STRING','sequelize','customVariable'];(function(_0x353d70,_0x139687){var _0x3ac2cd=function(_0x14f9ab){while(--_0x14f9ab){_0x353d70['push'](_0x353d70['shift']());}};_0x3ac2cd(++_0x139687);}(_0x0728,0x8e));var _0x8072=function(_0x5af35f,_0x223462){_0x5af35f=_0x5af35f-0x0;var _0x4a8be8=_0x0728[_0x5af35f];return _0x4a8be8;};'use strict';var Sequelize=require(_0x8072('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x8072('0x1'),_0x8072('0x2'),_0x8072('0x3')),'defaultValue':_0x8072('0x4')},'content':{'type':Sequelize[_0x8072('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8072('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x8072('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x8072('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index cc07523..b38f724 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 _0xbac3=['attributes','fields','nolimit','sort','pick','where','VIRTUAL','filter','options','then','includeAll','findAll','catch','show','keys','length','include','merge','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection'];(function(_0x4d81b2,_0x2d8647){var _0x9da74a=function(_0x47748a){while(--_0x47748a){_0x4d81b2['push'](_0x4d81b2['shift']());}};_0x9da74a(++_0x2d8647);}(_0xbac3,0x17e));var _0x3bac=function(_0x3a8ce2,_0x552ad5){_0x3a8ce2=_0x3a8ce2-0x0;var _0x2e5a45=_0xbac3[_0x3a8ce2];return _0x2e5a45;};'use strict';var emlformat=require(_0x3bac('0x0'));var rimraf=require(_0x3bac('0x1'));var zipdir=require(_0x3bac('0x2'));var jsonpatch=require(_0x3bac('0x3'));var rp=require(_0x3bac('0x4'));var moment=require(_0x3bac('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3bac('0x6'));var util=require('util');var path=require(_0x3bac('0x7'));var sox=require(_0x3bac('0x8'));var csv=require(_0x3bac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3bac('0xa'));var crypto=require(_0x3bac('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3bac('0xc'));var toCsv=require(_0x3bac('0x9'));var querystring=require(_0x3bac('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3bac('0xe'));var as=require(_0x3bac('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3bac('0x10'));var utils=require(_0x3bac('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3bac('0x12'));var db=require(_0x3bac('0x13'))['db'];function respondWithStatusCode(_0x2825d5,_0xe21159){_0xe21159=_0xe21159||0xcc;return function(_0x23bc87){if(_0x23bc87){return _0x2825d5[_0x3bac('0x14')](_0xe21159);}return _0x2825d5[_0x3bac('0x15')](_0xe21159)[_0x3bac('0x16')]();};}function respondWithResult(_0x527cbe,_0x5b632d){_0x5b632d=_0x5b632d||0xc8;return function(_0x1ff599){if(_0x1ff599){return _0x527cbe[_0x3bac('0x15')](_0x5b632d)[_0x3bac('0x17')](_0x1ff599);}};}function respondWithFilteredResult(_0x20a110,_0x5e134e){return function(_0x10ef96){if(_0x10ef96){var _0x4daf5b=typeof _0x5e134e['offset']===_0x3bac('0x18')&&typeof _0x5e134e['limit']==='undefined';var _0x499d3e=_0x10ef96[_0x3bac('0x19')];var _0x143a21=_0x4daf5b?0x0:_0x5e134e[_0x3bac('0x1a')];var _0xbb20e8=_0x4daf5b?_0x10ef96[_0x3bac('0x19')]:_0x5e134e[_0x3bac('0x1a')]+_0x5e134e[_0x3bac('0x1b')];var _0x35d64a;if(_0xbb20e8>=_0x499d3e){_0xbb20e8=_0x499d3e;_0x35d64a=0xc8;}else{_0x35d64a=0xce;}_0x20a110[_0x3bac('0x15')](_0x35d64a);return _0x20a110[_0x3bac('0x1c')](_0x3bac('0x1d'),_0x143a21+'-'+_0xbb20e8+'/'+_0x499d3e)[_0x3bac('0x17')](_0x10ef96);}return null;};}function patchUpdates(_0x4ba30e){return function(_0x2cd54d){try{jsonpatch[_0x3bac('0x1e')](_0x2cd54d,_0x4ba30e,!![]);}catch(_0x4c2e7c){return BPromise[_0x3bac('0x1f')](_0x4c2e7c);}return _0x2cd54d[_0x3bac('0x20')]();};}function saveUpdates(_0x43c92a,_0x29df33){return function(_0x41d906){if(_0x41d906){return _0x41d906[_0x3bac('0x21')](_0x43c92a)['then'](function(_0x5f576c){return _0x5f576c;});}return null;};}function removeEntity(_0x4690de,_0x2bdbc7){return function(_0x56448b){if(_0x56448b){return _0x56448b[_0x3bac('0x22')]()['then'](function(){_0x4690de['status'](0xcc)[_0x3bac('0x16')]();});}};}function handleEntityNotFound(_0x20e1ad,_0x5e4c08){return function(_0x19daa9){if(!_0x19daa9){_0x20e1ad[_0x3bac('0x14')](0x194);}return _0x19daa9;};}function handleError(_0x5354fd,_0x473bd2){_0x473bd2=_0x473bd2||0x1f4;return function(_0x1cd828){logger[_0x3bac('0x23')](_0x1cd828[_0x3bac('0x24')]);if(_0x1cd828[_0x3bac('0x25')]){delete _0x1cd828[_0x3bac('0x25')];}_0x5354fd[_0x3bac('0x15')](_0x473bd2)[_0x3bac('0x26')](_0x1cd828);};}exports[_0x3bac('0x27')]=function(_0x3bfc3a,_0x5574ac){var _0x28f8a7={},_0x5d9614={},_0x48fabf={'count':0x0,'rows':[]};var _0x284446=_['map'](db[_0x3bac('0x28')][_0x3bac('0x29')],function(_0x83d2b4){return{'name':_0x83d2b4[_0x3bac('0x2a')],'type':_0x83d2b4[_0x3bac('0x2b')][_0x3bac('0x2c')]};});_0x5d9614[_0x3bac('0x2d')]=_[_0x3bac('0x2e')](_0x284446,_0x3bac('0x25'));_0x5d9614[_0x3bac('0x2f')]=_['keys'](_0x3bfc3a[_0x3bac('0x2f')]);_0x5d9614[_0x3bac('0x30')]=_[_0x3bac('0x31')](_0x5d9614[_0x3bac('0x2d')],_0x5d9614[_0x3bac('0x2f')]);_0x28f8a7[_0x3bac('0x32')]=_[_0x3bac('0x31')](_0x5d9614['model'],qs[_0x3bac('0x33')](_0x3bfc3a['query']['fields']));_0x28f8a7['attributes']=_0x28f8a7[_0x3bac('0x32')]['length']?_0x28f8a7[_0x3bac('0x32')]:_0x5d9614['model'];if(!_0x3bfc3a[_0x3bac('0x2f')]['hasOwnProperty'](_0x3bac('0x34'))){_0x28f8a7['limit']=qs[_0x3bac('0x1b')](_0x3bfc3a[_0x3bac('0x2f')][_0x3bac('0x1b')]);_0x28f8a7[_0x3bac('0x1a')]=qs['offset'](_0x3bfc3a[_0x3bac('0x2f')][_0x3bac('0x1a')]);}_0x28f8a7['order']=qs[_0x3bac('0x35')](_0x3bfc3a[_0x3bac('0x2f')][_0x3bac('0x35')]);_0x28f8a7['where']=qs[_0x3bac('0x30')](_[_0x3bac('0x36')](_0x3bfc3a[_0x3bac('0x2f')],_0x5d9614[_0x3bac('0x30')]),_0x284446);if(_0x3bfc3a[_0x3bac('0x2f')]['filter']){_0x28f8a7[_0x3bac('0x37')]=_['merge'](_0x28f8a7[_0x3bac('0x37')],{'$or':_[_0x3bac('0x2e')](_0x284446,function(_0x38d37f){if(_0x38d37f[_0x3bac('0x2b')]!==_0x3bac('0x38')){var _0x2dd8c2={};_0x2dd8c2[_0x38d37f['name']]={'$like':'%'+_0x3bfc3a[_0x3bac('0x2f')][_0x3bac('0x39')]+'%'};return _0x2dd8c2;}})});}_0x28f8a7=_['merge']({},_0x28f8a7,_0x3bfc3a[_0x3bac('0x3a')]);var _0x594a1a={'where':_0x28f8a7[_0x3bac('0x37')]};return db[_0x3bac('0x28')][_0x3bac('0x19')](_0x594a1a)[_0x3bac('0x3b')](function(_0x255e35){_0x48fabf[_0x3bac('0x19')]=_0x255e35;if(_0x3bfc3a[_0x3bac('0x2f')][_0x3bac('0x3c')]){_0x28f8a7['include']=[{'all':!![]}];}return db[_0x3bac('0x28')][_0x3bac('0x3d')](_0x28f8a7);})[_0x3bac('0x3b')](function(_0x32ccc2){_0x48fabf['rows']=_0x32ccc2;return _0x48fabf;})['then'](respondWithFilteredResult(_0x5574ac,_0x28f8a7))[_0x3bac('0x3e')](handleError(_0x5574ac,null));};exports[_0x3bac('0x3f')]=function(_0x37b8d7,_0xf7b01e){var _0x5841cc={'raw':!![],'where':{'id':_0x37b8d7['params']['id']}},_0x2731ae={};_0x2731ae[_0x3bac('0x2d')]=_[_0x3bac('0x40')](db[_0x3bac('0x28')][_0x3bac('0x29')]);_0x2731ae[_0x3bac('0x2f')]=_['keys'](_0x37b8d7[_0x3bac('0x2f')]);_0x2731ae['filters']=_['intersection'](_0x2731ae[_0x3bac('0x2d')],_0x2731ae[_0x3bac('0x2f')]);_0x5841cc[_0x3bac('0x32')]=_[_0x3bac('0x31')](_0x2731ae['model'],qs[_0x3bac('0x33')](_0x37b8d7['query'][_0x3bac('0x33')]));_0x5841cc[_0x3bac('0x32')]=_0x5841cc[_0x3bac('0x32')][_0x3bac('0x41')]?_0x5841cc['attributes']:_0x2731ae[_0x3bac('0x2d')];if(_0x37b8d7[_0x3bac('0x2f')][_0x3bac('0x3c')]){_0x5841cc[_0x3bac('0x42')]=[{'all':!![]}];}_0x5841cc=_[_0x3bac('0x43')]({},_0x5841cc,_0x37b8d7['options']);return db[_0x3bac('0x28')][_0x3bac('0x44')](_0x5841cc)[_0x3bac('0x3b')](handleEntityNotFound(_0xf7b01e,null))['then'](respondWithResult(_0xf7b01e,null))['catch'](handleError(_0xf7b01e,null));};exports['create']=function(_0x1054fe,_0x2d41d2){return db[_0x3bac('0x28')][_0x3bac('0x45')](_0x1054fe[_0x3bac('0x46')],{})[_0x3bac('0x3b')](respondWithResult(_0x2d41d2,0xc9))[_0x3bac('0x3e')](handleError(_0x2d41d2,null));};exports[_0x3bac('0x21')]=function(_0x1d49d9,_0x5351fa){if(_0x1d49d9[_0x3bac('0x46')]['id']){delete _0x1d49d9[_0x3bac('0x46')]['id'];}return db[_0x3bac('0x28')][_0x3bac('0x44')]({'where':{'id':_0x1d49d9[_0x3bac('0x47')]['id']}})['then'](handleEntityNotFound(_0x5351fa,null))['then'](saveUpdates(_0x1d49d9[_0x3bac('0x46')],null))[_0x3bac('0x3b')](respondWithResult(_0x5351fa,null))[_0x3bac('0x3e')](handleError(_0x5351fa,null));};exports[_0x3bac('0x22')]=function(_0x937304,_0x409999){return db[_0x3bac('0x28')]['find']({'where':{'id':_0x937304[_0x3bac('0x47')]['id']}})[_0x3bac('0x3b')](handleEntityNotFound(_0x409999,null))[_0x3bac('0x3b')](removeEntity(_0x409999,null))['catch'](handleError(_0x409999,null));}; \ No newline at end of file +var _0x12c7=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x12c7,0x130));var _0x712c=function(_0x1f1177,_0x1314ea){_0x1f1177=_0x1f1177-0x0;var _0x2b614d=_0x12c7[_0x1f1177];return _0x2b614d;};'use strict';var emlformat=require(_0x712c('0x0'));var rimraf=require(_0x712c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x712c('0x2'));var rp=require(_0x712c('0x3'));var moment=require(_0x712c('0x4'));var BPromise=require(_0x712c('0x5'));var Mustache=require(_0x712c('0x6'));var util=require(_0x712c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x712c('0x8'));var ejs=require(_0x712c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x712c('0xa'));var squel=require(_0x712c('0xb'));var crypto=require(_0x712c('0xc'));var jsforce=require(_0x712c('0xd'));var deskjs=require(_0x712c('0xe'));var toCsv=require(_0x712c('0x8'));var querystring=require(_0x712c('0xf'));var Papa=require(_0x712c('0x10'));var Redis=require(_0x712c('0x11'));var authService=require(_0x712c('0x12'));var qs=require(_0x712c('0x13'));var as=require(_0x712c('0x14'));var hardwareService=require(_0x712c('0x15'));var logger=require(_0x712c('0x16'))('api');var utils=require(_0x712c('0x17'));var config=require(_0x712c('0x18'));var licenseUtil=require(_0x712c('0x19'));var db=require(_0x712c('0x1a'))['db'];function respondWithStatusCode(_0x11200b,_0x119c94){_0x119c94=_0x119c94||0xcc;return function(_0x4a4cb8){if(_0x4a4cb8){return _0x11200b[_0x712c('0x1b')](_0x119c94);}return _0x11200b[_0x712c('0x1c')](_0x119c94)[_0x712c('0x1d')]();};}function respondWithResult(_0x4f2308,_0xbe0848){_0xbe0848=_0xbe0848||0xc8;return function(_0x3086ed){if(_0x3086ed){return _0x4f2308[_0x712c('0x1c')](_0xbe0848)['json'](_0x3086ed);}};}function respondWithFilteredResult(_0x3677fc,_0xceef66){return function(_0x264d36){if(_0x264d36){var _0x5344b9=typeof _0xceef66[_0x712c('0x1e')]===_0x712c('0x1f')&&typeof _0xceef66[_0x712c('0x20')]===_0x712c('0x1f');var _0x1c3b8b=_0x264d36['count'];var _0x4f9f2a=_0x5344b9?0x0:_0xceef66['offset'];var _0x3e9cdc=_0x5344b9?_0x264d36[_0x712c('0x21')]:_0xceef66['offset']+_0xceef66[_0x712c('0x20')];var _0x28aa2a;if(_0x3e9cdc>=_0x1c3b8b){_0x3e9cdc=_0x1c3b8b;_0x28aa2a=0xc8;}else{_0x28aa2a=0xce;}_0x3677fc['status'](_0x28aa2a);return _0x3677fc[_0x712c('0x22')](_0x712c('0x23'),_0x4f9f2a+'-'+_0x3e9cdc+'/'+_0x1c3b8b)[_0x712c('0x24')](_0x264d36);}return null;};}function patchUpdates(_0x3e0949){return function(_0x2c4c73){try{jsonpatch[_0x712c('0x25')](_0x2c4c73,_0x3e0949,!![]);}catch(_0x3431d1){return BPromise[_0x712c('0x26')](_0x3431d1);}return _0x2c4c73['save']();};}function saveUpdates(_0x2ab4c8,_0x4d1af9){return function(_0x297ad3){if(_0x297ad3){return _0x297ad3['update'](_0x2ab4c8)[_0x712c('0x27')](function(_0x3be940){return _0x3be940;});}return null;};}function removeEntity(_0x47a759,_0x3183d0){return function(_0x4b4a80){if(_0x4b4a80){return _0x4b4a80[_0x712c('0x28')]()['then'](function(){_0x47a759[_0x712c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59cc7a,_0x36754b){return function(_0x2326c8){if(!_0x2326c8){_0x59cc7a['sendStatus'](0x194);}return _0x2326c8;};}function handleError(_0x2775b6,_0x30b651){_0x30b651=_0x30b651||0x1f4;return function(_0x3dddc9){logger[_0x712c('0x29')](_0x3dddc9[_0x712c('0x2a')]);if(_0x3dddc9[_0x712c('0x2b')]){delete _0x3dddc9[_0x712c('0x2b')];}_0x2775b6['status'](_0x30b651)[_0x712c('0x2c')](_0x3dddc9);};}exports[_0x712c('0x2d')]=function(_0x4177f3,_0xe3ba1){var _0x436ef7={},_0x309d73={},_0x44c842={'count':0x0,'rows':[]};var _0x3a8443=_[_0x712c('0x2e')](db[_0x712c('0x2f')][_0x712c('0x30')],function(_0x451bb5){return{'name':_0x451bb5[_0x712c('0x31')],'type':_0x451bb5[_0x712c('0x32')][_0x712c('0x33')]};});_0x309d73[_0x712c('0x34')]=_[_0x712c('0x2e')](_0x3a8443,_0x712c('0x2b'));_0x309d73[_0x712c('0x35')]=_[_0x712c('0x36')](_0x4177f3[_0x712c('0x35')]);_0x309d73['filters']=_[_0x712c('0x37')](_0x309d73[_0x712c('0x34')],_0x309d73[_0x712c('0x35')]);_0x436ef7[_0x712c('0x38')]=_[_0x712c('0x37')](_0x309d73[_0x712c('0x34')],qs[_0x712c('0x39')](_0x4177f3[_0x712c('0x35')][_0x712c('0x39')]));_0x436ef7[_0x712c('0x38')]=_0x436ef7[_0x712c('0x38')][_0x712c('0x3a')]?_0x436ef7[_0x712c('0x38')]:_0x309d73['model'];if(!_0x4177f3[_0x712c('0x35')][_0x712c('0x3b')](_0x712c('0x3c'))){_0x436ef7[_0x712c('0x20')]=qs[_0x712c('0x20')](_0x4177f3[_0x712c('0x35')][_0x712c('0x20')]);_0x436ef7[_0x712c('0x1e')]=qs[_0x712c('0x1e')](_0x4177f3[_0x712c('0x35')][_0x712c('0x1e')]);}_0x436ef7[_0x712c('0x3d')]=qs[_0x712c('0x3e')](_0x4177f3['query'][_0x712c('0x3e')]);_0x436ef7[_0x712c('0x3f')]=qs['filters'](_[_0x712c('0x40')](_0x4177f3['query'],_0x309d73[_0x712c('0x41')]),_0x3a8443);if(_0x4177f3[_0x712c('0x35')][_0x712c('0x42')]){_0x436ef7[_0x712c('0x3f')]=_[_0x712c('0x43')](_0x436ef7[_0x712c('0x3f')],{'$or':_[_0x712c('0x2e')](_0x3a8443,function(_0x5bfdc0){if(_0x5bfdc0[_0x712c('0x32')]!==_0x712c('0x44')){var _0x2b7c6e={};_0x2b7c6e[_0x5bfdc0[_0x712c('0x2b')]]={'$like':'%'+_0x4177f3['query'][_0x712c('0x42')]+'%'};return _0x2b7c6e;}})});}_0x436ef7=_[_0x712c('0x43')]({},_0x436ef7,_0x4177f3[_0x712c('0x45')]);var _0x475554={'where':_0x436ef7[_0x712c('0x3f')]};return db['SalesforceField'][_0x712c('0x21')](_0x475554)[_0x712c('0x27')](function(_0x1bc365){_0x44c842['count']=_0x1bc365;if(_0x4177f3[_0x712c('0x35')]['includeAll']){_0x436ef7['include']=[{'all':!![]}];}return db['SalesforceField'][_0x712c('0x46')](_0x436ef7);})[_0x712c('0x27')](function(_0x461c96){_0x44c842[_0x712c('0x47')]=_0x461c96;return _0x44c842;})['then'](respondWithFilteredResult(_0xe3ba1,_0x436ef7))[_0x712c('0x48')](handleError(_0xe3ba1,null));};exports[_0x712c('0x49')]=function(_0xcf24a4,_0x3b7555){var _0x3f42b6={'raw':!![],'where':{'id':_0xcf24a4[_0x712c('0x4a')]['id']}},_0x398564={};_0x398564['model']=_['keys'](db[_0x712c('0x2f')][_0x712c('0x30')]);_0x398564[_0x712c('0x35')]=_[_0x712c('0x36')](_0xcf24a4[_0x712c('0x35')]);_0x398564[_0x712c('0x41')]=_['intersection'](_0x398564[_0x712c('0x34')],_0x398564[_0x712c('0x35')]);_0x3f42b6[_0x712c('0x38')]=_['intersection'](_0x398564[_0x712c('0x34')],qs['fields'](_0xcf24a4[_0x712c('0x35')][_0x712c('0x39')]));_0x3f42b6[_0x712c('0x38')]=_0x3f42b6['attributes'][_0x712c('0x3a')]?_0x3f42b6[_0x712c('0x38')]:_0x398564['model'];if(_0xcf24a4[_0x712c('0x35')]['includeAll']){_0x3f42b6['include']=[{'all':!![]}];}_0x3f42b6=_[_0x712c('0x43')]({},_0x3f42b6,_0xcf24a4[_0x712c('0x45')]);return db[_0x712c('0x2f')][_0x712c('0x4b')](_0x3f42b6)['then'](handleEntityNotFound(_0x3b7555,null))[_0x712c('0x27')](respondWithResult(_0x3b7555,null))[_0x712c('0x48')](handleError(_0x3b7555,null));};exports['create']=function(_0x76988f,_0x158edd){return db['SalesforceField'][_0x712c('0x4c')](_0x76988f['body'],{})[_0x712c('0x27')](respondWithResult(_0x158edd,0xc9))[_0x712c('0x48')](handleError(_0x158edd,null));};exports[_0x712c('0x4d')]=function(_0x17044a,_0x43a153){if(_0x17044a[_0x712c('0x4e')]['id']){delete _0x17044a[_0x712c('0x4e')]['id'];}return db[_0x712c('0x2f')][_0x712c('0x4b')]({'where':{'id':_0x17044a[_0x712c('0x4a')]['id']}})[_0x712c('0x27')](handleEntityNotFound(_0x43a153,null))[_0x712c('0x27')](saveUpdates(_0x17044a[_0x712c('0x4e')],null))[_0x712c('0x27')](respondWithResult(_0x43a153,null))[_0x712c('0x48')](handleError(_0x43a153,null));};exports[_0x712c('0x28')]=function(_0x1f60cd,_0x3e9e04){return db[_0x712c('0x2f')][_0x712c('0x4b')]({'where':{'id':_0x1f60cd['params']['id']}})[_0x712c('0x27')](handleEntityNotFound(_0x3e9e04,null))[_0x712c('0x27')](removeEntity(_0x3e9e04,null))['catch'](handleError(_0x3e9e04,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 3443bcc..85277cf 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 _0x73ca=['path','rimraf','../../config/environment','exports','define','SalesforceField','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x540e6c,_0x255edd){var _0x562787=function(_0x1c050b){while(--_0x1c050b){_0x540e6c['push'](_0x540e6c['shift']());}};_0x562787(++_0x255edd);}(_0x73ca,0x174));var _0xa73c=function(_0x136aa6,_0x136ece){_0x136aa6=_0x136aa6-0x0;var _0xba7d36=_0x73ca[_0x136aa6];return _0xba7d36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa73c('0x0'))(_0xa73c('0x1'));var moment=require(_0xa73c('0x2'));var BPromise=require(_0xa73c('0x3'));var rp=require(_0xa73c('0x4'));var fs=require('fs');var path=require(_0xa73c('0x5'));var rimraf=require(_0xa73c('0x6'));var config=require(_0xa73c('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0xa73c('0x8')]=function(_0x212191,_0x407a86){return _0x212191[_0xa73c('0x9')](_0xa73c('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xa73c('0xb'),_0xa73c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2593=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','int_salesforce_fields','salesforce_unique_index','lodash','util','api'];(function(_0x56278e,_0x5083c5){var _0x46d37e=function(_0x274725){while(--_0x274725){_0x56278e['push'](_0x56278e['shift']());}};_0x46d37e(++_0x5083c5);}(_0x2593,0xe1));var _0x3259=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x2593[_0x1b745b];return _0x120a9d;};'use strict';var _=require(_0x3259('0x0'));var util=require(_0x3259('0x1'));var logger=require('../../config/logger')(_0x3259('0x2'));var moment=require(_0x3259('0x3'));var BPromise=require(_0x3259('0x4'));var rp=require(_0x3259('0x5'));var fs=require('fs');var path=require(_0x3259('0x6'));var rimraf=require(_0x3259('0x7'));var config=require(_0x3259('0x8'));var attributes=require(_0x3259('0x9'));module['exports']=function(_0x51ef1f,_0x2c9ebc){return _0x51ef1f['define']('SalesforceField',attributes,{'tableName':_0x3259('0xa'),'paranoid':![],'indexes':[{'name':_0x3259('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index a313d0c..18f1e9d 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 _0x07d3=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45dd8b,_0x162174){var _0x4d473e=function(_0x809e45){while(--_0x809e45){_0x45dd8b['push'](_0x45dd8b['shift']());}};_0x4d473e(++_0x162174);}(_0x07d3,0x1a5));var _0x307d=function(_0x3bcf55,_0x4a861a){_0x3bcf55=_0x3bcf55-0x0;var _0x55f393=_0x07d3[_0x3bcf55];return _0x55f393;};'use strict';var _=require('lodash');var util=require(_0x307d('0x0'));var moment=require(_0x307d('0x1'));var BPromise=require('bluebird');var rs=require(_0x307d('0x2'));var fs=require('fs');var Redis=require(_0x307d('0x3'));var db=require(_0x307d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x307d('0x5'))(_0x307d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x307d('0x7')][_0x307d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x174905,_0x5910c3,_0x480603){return new BPromise(function(_0x128181,_0x42c71f){return client[_0x307d('0x9')](_0x174905,_0x480603)[_0x307d('0xa')](function(_0x1c7b03){logger[_0x307d('0xb')](_0x307d('0xc'),_0x5910c3,_0x307d('0xd'));logger[_0x307d('0xe')](_0x307d('0xf'),_0x5910c3,_0x307d('0xd'),JSON[_0x307d('0x10')](_0x1c7b03));if(_0x1c7b03[_0x307d('0x11')]){if(_0x1c7b03[_0x307d('0x11')][_0x307d('0x12')]===0x1f4){logger[_0x307d('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5910c3,_0x1c7b03[_0x307d('0x11')][_0x307d('0x13')]);return _0x42c71f(_0x1c7b03[_0x307d('0x11')]['message']);}logger['error'](_0x307d('0xc'),_0x5910c3,_0x1c7b03[_0x307d('0x11')]['message']);return _0x128181(_0x1c7b03[_0x307d('0x11')]['message']);}else{logger['info'](_0x307d('0xc'),_0x5910c3,_0x307d('0xd'));_0x128181(_0x1c7b03[_0x307d('0x14')]['message']);}})[_0x307d('0x15')](function(_0x14678e){logger[_0x307d('0x11')](_0x307d('0xc'),_0x5910c3,_0x14678e);_0x42c71f(_0x14678e);});});} \ No newline at end of file +var _0xf86a=['http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xf86a,0x1da));var _0xaf86=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf86a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf86('0x0'));var util=require(_0xaf86('0x1'));var moment=require(_0xaf86('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf86('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf86('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf86('0x5'))(_0xaf86('0x6'));var config=require(_0xaf86('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaf86('0x8')][_0xaf86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ac0e6,_0x5130f4,_0x2d553a){return new BPromise(function(_0x3fe836,_0x603add){return client[_0xaf86('0xa')](_0x4ac0e6,_0x2d553a)[_0xaf86('0xb')](function(_0x2289fd){logger['info'](_0xaf86('0xc'),_0x5130f4,_0xaf86('0xd'));logger[_0xaf86('0xe')](_0xaf86('0xf'),_0x5130f4,_0xaf86('0xd'),JSON['stringify'](_0x2289fd));if(_0x2289fd[_0xaf86('0x10')]){if(_0x2289fd['error']['code']===0x1f4){logger[_0xaf86('0x10')](_0xaf86('0xc'),_0x5130f4,_0x2289fd[_0xaf86('0x10')][_0xaf86('0x11')]);return _0x603add(_0x2289fd['error'][_0xaf86('0x11')]);}logger[_0xaf86('0x10')](_0xaf86('0xc'),_0x5130f4,_0x2289fd[_0xaf86('0x10')][_0xaf86('0x11')]);return _0x3fe836(_0x2289fd[_0xaf86('0x10')][_0xaf86('0x11')]);}else{logger[_0xaf86('0x12')](_0xaf86('0xc'),_0x5130f4,'request\x20sent');_0x3fe836(_0x2289fd[_0xaf86('0x13')][_0xaf86('0x11')]);}})[_0xaf86('0x14')](function(_0xbe890){logger[_0xaf86('0x10')](_0xaf86('0xc'),_0x5130f4,_0xbe890);_0x603add(_0xbe890);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index bb81895..32efdc0 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 _0xbe99=['addConfiguration','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x4a2011,_0x3ec9a1){var _0x1c556d=function(_0x353220){while(--_0x353220){_0x4a2011['push'](_0x4a2011['shift']());}};_0x1c556d(++_0x3ec9a1);}(_0xbe99,0x196));var _0x9be9=function(_0x2d3fa8,_0x4b7655){_0x2d3fa8=_0x2d3fa8-0x0;var _0x25b2c9=_0xbe99[_0x2d3fa8];return _0x25b2c9;};'use strict';var multer=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var path=require(_0x9be9('0x2'));var timeout=require(_0x9be9('0x3'));var express=require(_0x9be9('0x4'));var router=express['Router']();var fs_extra=require(_0x9be9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9be9('0x6'));var config=require(_0x9be9('0x7'));var controller=require(_0x9be9('0x8'));router[_0x9be9('0x9')]('/',auth['isAuthenticated'](),controller[_0x9be9('0xa')]);router[_0x9be9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9be9('0xb')]);router[_0x9be9('0x9')](_0x9be9('0xc'),auth[_0x9be9('0xd')](),controller[_0x9be9('0xe')]);router[_0x9be9('0x9')](_0x9be9('0xf'),auth[_0x9be9('0xd')](),controller[_0x9be9('0x10')]);router[_0x9be9('0x11')]('/',auth[_0x9be9('0xd')](),controller[_0x9be9('0x12')]);router[_0x9be9('0x11')](_0x9be9('0xc'),auth[_0x9be9('0xd')](),controller[_0x9be9('0x13')]);router[_0x9be9('0x14')]('/:id',auth[_0x9be9('0xd')](),controller[_0x9be9('0x15')]);router[_0x9be9('0x16')](_0x9be9('0x17'),auth[_0x9be9('0xd')](),controller['destroy']);module[_0x9be9('0x18')]=router; \ No newline at end of file +var _0x9314=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put'];(function(_0x5b2f8b,_0x416a09){var _0x4409fd=function(_0x4174d3){while(--_0x4174d3){_0x5b2f8b['push'](_0x5b2f8b['shift']());}};_0x4409fd(++_0x416a09);}(_0x9314,0xb2));var _0x4931=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9314[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x4931('0x0'));var util=require('util');var path=require(_0x4931('0x1'));var timeout=require(_0x4931('0x2'));var express=require(_0x4931('0x3'));var router=express[_0x4931('0x4')]();var fs_extra=require(_0x4931('0x5'));var auth=require(_0x4931('0x6'));var interaction=require(_0x4931('0x7'));var config=require(_0x4931('0x8'));var controller=require(_0x4931('0x9'));router[_0x4931('0xa')]('/',auth['isAuthenticated'](),controller[_0x4931('0xb')]);router[_0x4931('0xa')](_0x4931('0xc'),auth[_0x4931('0xd')](),controller[_0x4931('0xe')]);router[_0x4931('0xa')](_0x4931('0xf'),auth[_0x4931('0xd')](),controller[_0x4931('0x10')]);router[_0x4931('0xa')](_0x4931('0x11'),auth['isAuthenticated'](),controller[_0x4931('0x12')]);router['post']('/',auth[_0x4931('0xd')](),controller[_0x4931('0x13')]);router['post'](_0x4931('0xf'),auth[_0x4931('0xd')](),controller[_0x4931('0x14')]);router[_0x4931('0x15')](_0x4931('0xc'),auth[_0x4931('0xd')](),controller[_0x4931('0x16')]);router[_0x4931('0x17')](_0x4931('0xc'),auth[_0x4931('0xd')](),controller[_0x4931('0x18')]);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 78da1e4..aec34f6 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 _0x9114=['STRING','username','exports'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x9114,0x10d));var _0x4911=function(_0x13c26c,_0x5e64b2){_0x13c26c=_0x13c26c-0x0;var _0xb70cdc=_0x9114[_0x13c26c];return _0xb70cdc;};'use strict';var Sequelize=require('sequelize');module[_0x4911('0x0')]={'name':{'type':Sequelize[_0x4911('0x1')]},'description':{'type':Sequelize[_0x4911('0x1')]},'username':{'type':Sequelize[_0x4911('0x1')],'unique':_0x4911('0x2')},'password':{'type':Sequelize[_0x4911('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4911('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x03a7=['STRING','username','exports'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x03a7,0x1ac));var _0x703a=function(_0x3b9379,_0x5a8ba1){_0x3b9379=_0x3b9379-0x0;var _0x3bae2d=_0x03a7[_0x3b9379];return _0x3bae2d;};'use strict';var Sequelize=require('sequelize');module[_0x703a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x703a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x703a('0x2')},'password':{'type':Sequelize[_0x703a('0x1')]},'email':{'type':Sequelize[_0x703a('0x1')]},'remoteUri':{'type':Sequelize[_0x703a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5de2092..28f2934 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 _0xc08d=['%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','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/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','correlation_display','delivery_task','work_start','additional_assignee_list','calendar_duration','sys_class_name','closed_by','follow_up','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','sla_due','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','slice','substring','lastIndexOf','format'];(function(_0x26d610,_0x3f2ab2){var _0x66d7f=function(_0x20533d){while(--_0x20533d){_0x26d610['push'](_0x26d610['shift']());}};_0x66d7f(++_0x3f2ab2);}(_0xc08d,0x18e));var _0xdc08=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xc08d[_0xbb9dbf];return _0x30223c;};'use strict';var emlformat=require(_0xdc08('0x0'));var rimraf=require(_0xdc08('0x1'));var zipdir=require(_0xdc08('0x2'));var jsonpatch=require(_0xdc08('0x3'));var rp=require(_0xdc08('0x4'));var moment=require(_0xdc08('0x5'));var BPromise=require(_0xdc08('0x6'));var Mustache=require(_0xdc08('0x7'));var util=require(_0xdc08('0x8'));var path=require(_0xdc08('0x9'));var sox=require(_0xdc08('0xa'));var csv=require(_0xdc08('0xb'));var ejs=require(_0xdc08('0xc'));var fs=require('fs');var fs_extra=require(_0xdc08('0xd'));var _=require(_0xdc08('0xe'));var squel=require(_0xdc08('0xf'));var crypto=require(_0xdc08('0x10'));var jsforce=require(_0xdc08('0x11'));var deskjs=require(_0xdc08('0x12'));var toCsv=require(_0xdc08('0xb'));var querystring=require(_0xdc08('0x13'));var Papa=require(_0xdc08('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc08('0x15'));var hardwareService=require(_0xdc08('0x16'));var logger=require('../../config/logger')(_0xdc08('0x17'));var utils=require('../../config/utils');var config=require(_0xdc08('0x18'));var licenseUtil=require(_0xdc08('0x19'));var db=require(_0xdc08('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c0d57,_0x4262aa){_0x4262aa=_0x4262aa||0xcc;return function(_0x1b8623){if(_0x1b8623){return _0x1c0d57[_0xdc08('0x1b')](_0x4262aa);}return _0x1c0d57[_0xdc08('0x1c')](_0x4262aa)[_0xdc08('0x1d')]();};}function respondWithResult(_0xea5979,_0x2a749b){_0x2a749b=_0x2a749b||0xc8;return function(_0x2a1b53){if(_0x2a1b53){return _0xea5979['status'](_0x2a749b)['json'](_0x2a1b53);}};}function respondWithFilteredResult(_0x56972d,_0x228237){return function(_0xe55d84){if(_0xe55d84){var _0x8cd15c=typeof _0x228237[_0xdc08('0x1e')]===_0xdc08('0x1f')&&typeof _0x228237[_0xdc08('0x20')]===_0xdc08('0x1f');var _0x175802=_0xe55d84['count'];var _0x10ae03=_0x8cd15c?0x0:_0x228237['offset'];var _0x422de6=_0x8cd15c?_0xe55d84[_0xdc08('0x21')]:_0x228237[_0xdc08('0x1e')]+_0x228237[_0xdc08('0x20')];var _0x2e2498;if(_0x422de6>=_0x175802){_0x422de6=_0x175802;_0x2e2498=0xc8;}else{_0x2e2498=0xce;}_0x56972d['status'](_0x2e2498);return _0x56972d[_0xdc08('0x22')]('Content-Range',_0x10ae03+'-'+_0x422de6+'/'+_0x175802)[_0xdc08('0x23')](_0xe55d84);}return null;};}function patchUpdates(_0x4b4876){return function(_0x1912b2){try{jsonpatch[_0xdc08('0x24')](_0x1912b2,_0x4b4876,!![]);}catch(_0x5d298f){return BPromise[_0xdc08('0x25')](_0x5d298f);}return _0x1912b2[_0xdc08('0x26')]();};}function saveUpdates(_0x37320e,_0x12ecb8){return function(_0x539933){if(_0x539933){return _0x539933[_0xdc08('0x27')](_0x37320e)[_0xdc08('0x28')](function(_0x18e417){return _0x18e417;});}return null;};}function removeEntity(_0xb58b04,_0x151c82){return function(_0x3f6ea6){if(_0x3f6ea6){return _0x3f6ea6[_0xdc08('0x29')]()[_0xdc08('0x28')](function(){_0xb58b04['status'](0xcc)[_0xdc08('0x1d')]();});}};}function handleEntityNotFound(_0x12ac5e,_0x28839a){return function(_0xfa8fff){if(!_0xfa8fff){_0x12ac5e[_0xdc08('0x1b')](0x194);}return _0xfa8fff;};}function handleError(_0x7c9ed2,_0x444c66){_0x444c66=_0x444c66||0x1f4;return function(_0x2dc858){logger[_0xdc08('0x2a')](_0x2dc858[_0xdc08('0x2b')]);if(_0x2dc858[_0xdc08('0x2c')]){delete _0x2dc858[_0xdc08('0x2c')];}_0x7c9ed2['status'](_0x444c66)[_0xdc08('0x2d')](_0x2dc858);};}exports[_0xdc08('0x2e')]=function(_0x5752a7,_0x42fef2){var _0x499756={},_0x5b000e={},_0x4d82b8={'count':0x0,'rows':[]};var _0x5d7b6c=_[_0xdc08('0x2f')](db[_0xdc08('0x30')][_0xdc08('0x31')],function(_0x199985){return{'name':_0x199985[_0xdc08('0x32')],'type':_0x199985[_0xdc08('0x33')][_0xdc08('0x34')]};});_0x5b000e[_0xdc08('0x35')]=_['map'](_0x5d7b6c,_0xdc08('0x2c'));_0x5b000e[_0xdc08('0x36')]=_[_0xdc08('0x37')](_0x5752a7[_0xdc08('0x36')]);_0x5b000e[_0xdc08('0x38')]=_[_0xdc08('0x39')](_0x5b000e[_0xdc08('0x35')],_0x5b000e[_0xdc08('0x36')]);_0x499756['attributes']=_['intersection'](_0x5b000e[_0xdc08('0x35')],qs[_0xdc08('0x3a')](_0x5752a7[_0xdc08('0x36')]['fields']));_0x499756[_0xdc08('0x3b')]=_0x499756[_0xdc08('0x3b')]['length']?_0x499756[_0xdc08('0x3b')]:_0x5b000e['model'];if(!_0x5752a7[_0xdc08('0x36')][_0xdc08('0x3c')](_0xdc08('0x3d'))){_0x499756[_0xdc08('0x20')]=qs['limit'](_0x5752a7[_0xdc08('0x36')]['limit']);_0x499756[_0xdc08('0x1e')]=qs[_0xdc08('0x1e')](_0x5752a7['query'][_0xdc08('0x1e')]);}_0x499756['order']=qs['sort'](_0x5752a7[_0xdc08('0x36')][_0xdc08('0x3e')]);_0x499756[_0xdc08('0x3f')]=qs[_0xdc08('0x38')](_['pick'](_0x5752a7[_0xdc08('0x36')],_0x5b000e[_0xdc08('0x38')]),_0x5d7b6c);if(_0x5752a7[_0xdc08('0x36')][_0xdc08('0x40')]){_0x499756[_0xdc08('0x3f')]=_[_0xdc08('0x41')](_0x499756[_0xdc08('0x3f')],{'$or':_[_0xdc08('0x2f')](_0x5d7b6c,function(_0x11aa3e){if(_0x11aa3e[_0xdc08('0x33')]!==_0xdc08('0x42')){var _0x10238d={};_0x10238d[_0x11aa3e['name']]={'$like':'%'+_0x5752a7[_0xdc08('0x36')]['filter']+'%'};return _0x10238d;}})});}_0x499756=_[_0xdc08('0x41')]({},_0x499756,_0x5752a7[_0xdc08('0x43')]);var _0x583d96={'where':_0x499756['where']};return db[_0xdc08('0x30')][_0xdc08('0x21')](_0x583d96)[_0xdc08('0x28')](function(_0x1c68f4){_0x4d82b8[_0xdc08('0x21')]=_0x1c68f4;if(_0x5752a7[_0xdc08('0x36')][_0xdc08('0x44')]){_0x499756[_0xdc08('0x45')]=[{'all':!![]}];}return db[_0xdc08('0x30')][_0xdc08('0x46')](_0x499756);})[_0xdc08('0x28')](function(_0x38231f){_0x4d82b8['rows']=_0x38231f;return _0x4d82b8;})['then'](respondWithFilteredResult(_0x42fef2,_0x499756))[_0xdc08('0x47')](handleError(_0x42fef2,null));};exports[_0xdc08('0x48')]=function(_0x23b8c7,_0x24bf87){var _0x27bf7a={'raw':![],'where':{'id':_0x23b8c7['params']['id']}},_0x1a462f={};_0x1a462f[_0xdc08('0x35')]=_[_0xdc08('0x37')](db[_0xdc08('0x30')][_0xdc08('0x31')]);_0x1a462f[_0xdc08('0x36')]=_[_0xdc08('0x37')](_0x23b8c7[_0xdc08('0x36')]);_0x1a462f[_0xdc08('0x38')]=_['intersection'](_0x1a462f[_0xdc08('0x35')],_0x1a462f[_0xdc08('0x36')]);_0x27bf7a[_0xdc08('0x3b')]=_[_0xdc08('0x39')](_0x1a462f[_0xdc08('0x35')],qs['fields'](_0x23b8c7[_0xdc08('0x36')][_0xdc08('0x3a')]));_0x27bf7a[_0xdc08('0x3b')]=_0x27bf7a[_0xdc08('0x3b')][_0xdc08('0x49')]?_0x27bf7a[_0xdc08('0x3b')]:_0x1a462f[_0xdc08('0x35')];if(_0x23b8c7[_0xdc08('0x36')][_0xdc08('0x44')]){_0x27bf7a[_0xdc08('0x45')]=[{'all':!![]}];}_0x27bf7a=_[_0xdc08('0x41')]({},_0x27bf7a,_0x23b8c7[_0xdc08('0x43')]);return db[_0xdc08('0x30')][_0xdc08('0x4a')](_0x27bf7a)[_0xdc08('0x28')](handleEntityNotFound(_0x24bf87,null))[_0xdc08('0x28')](respondWithResult(_0x24bf87,null))[_0xdc08('0x47')](handleError(_0x24bf87,null));};exports[_0xdc08('0x4b')]=function(_0x1d967c,_0x422557){return db[_0xdc08('0x30')][_0xdc08('0x4b')](_0x1d967c[_0xdc08('0x4c')],{})[_0xdc08('0x28')](respondWithResult(_0x422557,0xc9))[_0xdc08('0x47')](handleError(_0x422557,null));};exports[_0xdc08('0x27')]=function(_0x1110a9,_0x5b6512){if(_0x1110a9[_0xdc08('0x4c')]['id']){delete _0x1110a9[_0xdc08('0x4c')]['id'];}return db[_0xdc08('0x30')][_0xdc08('0x4a')]({'where':{'id':_0x1110a9[_0xdc08('0x4d')]['id']}})[_0xdc08('0x28')](handleEntityNotFound(_0x5b6512,null))[_0xdc08('0x28')](saveUpdates(_0x1110a9[_0xdc08('0x4c')],null))[_0xdc08('0x28')](respondWithResult(_0x5b6512,null))[_0xdc08('0x47')](handleError(_0x5b6512,null));};exports[_0xdc08('0x29')]=function(_0x400dc0,_0x19b5b8){return db[_0xdc08('0x30')][_0xdc08('0x4a')]({'where':{'id':_0x400dc0[_0xdc08('0x4d')]['id']}})[_0xdc08('0x28')](handleEntityNotFound(_0x19b5b8,null))[_0xdc08('0x28')](removeEntity(_0x19b5b8,null))['catch'](handleError(_0x19b5b8,null));};exports[_0xdc08('0x4e')]=function(_0x20b25e,_0x2c2568,_0x260684){var _0x1640ee={};var _0x56bb01={};var _0x4a71f3;var _0x3d2e32;return db[_0xdc08('0x30')][_0xdc08('0x4f')]({'where':{'id':_0x20b25e[_0xdc08('0x4d')]['id']}})[_0xdc08('0x28')](handleEntityNotFound(_0x2c2568,null))[_0xdc08('0x28')](function(_0x2dd6d){if(_0x2dd6d){_0x4a71f3=_0x2dd6d;_0x56bb01[_0xdc08('0x35')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x56bb01['query']=_['keys'](_0x20b25e[_0xdc08('0x36')]);_0x56bb01[_0xdc08('0x38')]=_[_0xdc08('0x39')](_0x56bb01[_0xdc08('0x35')],_0x56bb01[_0xdc08('0x36')]);_0x1640ee['attributes']=_[_0xdc08('0x39')](_0x56bb01[_0xdc08('0x35')],qs[_0xdc08('0x3a')](_0x20b25e['query']['fields']));_0x1640ee[_0xdc08('0x3b')]=_0x1640ee[_0xdc08('0x3b')][_0xdc08('0x49')]?_0x1640ee['attributes']:_0x56bb01[_0xdc08('0x35')];_0x1640ee[_0xdc08('0x50')]=qs['sort'](_0x20b25e['query'][_0xdc08('0x3e')]);_0x1640ee[_0xdc08('0x3f')]=qs[_0xdc08('0x38')](_[_0xdc08('0x51')](_0x20b25e[_0xdc08('0x36')],_0x56bb01['filters']));if(_0x20b25e[_0xdc08('0x36')]['filter']){_0x1640ee[_0xdc08('0x3f')]=_[_0xdc08('0x41')](_0x1640ee[_0xdc08('0x3f')],{'$or':_[_0xdc08('0x2f')](_0x1640ee[_0xdc08('0x3b')],function(_0x30c8e6){var _0x1522db={};_0x1522db[_0x30c8e6]={'$like':'%'+_0x20b25e['query'][_0xdc08('0x40')]+'%'};return _0x1522db;})});}_0x1640ee=_['merge']({},_0x1640ee,_0x20b25e['options']);return _0x4a71f3[_0xdc08('0x4e')](_0x1640ee);}})[_0xdc08('0x28')](function(_0x4f32ba){if(_0x4f32ba){_0x3d2e32=_0x4f32ba[_0xdc08('0x49')];if(!_0x20b25e['query'][_0xdc08('0x3c')](_0xdc08('0x3d'))){_0x1640ee['limit']=qs[_0xdc08('0x20')](_0x20b25e[_0xdc08('0x36')]['limit']);_0x1640ee[_0xdc08('0x1e')]=qs['offset'](_0x20b25e[_0xdc08('0x36')]['offset']);}return _0x4a71f3[_0xdc08('0x4e')](_0x1640ee);}})[_0xdc08('0x28')](function(_0x4cee78){if(_0x4cee78){return _0x4cee78?{'count':_0x3d2e32,'rows':_0x4cee78}:null;}})[_0xdc08('0x28')](respondWithResult(_0x2c2568,null))[_0xdc08('0x47')](handleError(_0x2c2568,null));};exports[_0xdc08('0x52')]=function(_0x5a4874,_0x27e184,_0x30e31d){if(_0x5a4874[_0xdc08('0x4c')]['id']){delete _0x5a4874[_0xdc08('0x4c')]['id'];}return db[_0xdc08('0x30')]['findOne']({'where':{'id':_0x5a4874['params']['id']}})[_0xdc08('0x28')](handleEntityNotFound(_0x27e184,null))[_0xdc08('0x28')](function(_0x2fc38f){if(_0x2fc38f){_0x5a4874['body']['AccountId']=_0x2fc38f['id'];_0x5a4874['body'][_0xdc08('0x53')]=integrations[_0xdc08('0x54')](_0x5a4874[_0xdc08('0x4c')][_0xdc08('0x55')],_0x5a4874[_0xdc08('0x4c')]['type']);_0x5a4874[_0xdc08('0x4c')][_0xdc08('0x56')]=integrations[_0xdc08('0x57')](_0x5a4874[_0xdc08('0x4c')][_0xdc08('0x55')],_0x5a4874[_0xdc08('0x4c')][_0xdc08('0x33')]);return db[_0xdc08('0x58')][_0xdc08('0x4b')](_0x5a4874['body'],{'include':[{'model':db[_0xdc08('0x59')],'as':'Subjects'},{'model':db[_0xdc08('0x59')],'as':_0xdc08('0x56')}]});}return null;})[_0xdc08('0x28')](respondWithResult(_0x27e184,null))[_0xdc08('0x47')](handleError(_0x27e184,null));};exports[_0xdc08('0x5a')]=function(_0x1ee8cc,_0x28cee3,_0x2bdd37){var _0x4c400e=[_0xdc08('0x5b'),_0xdc08('0x5c'),_0xdc08('0x5d'),'subcategory',_0xdc08('0x5e'),_0xdc08('0x5f'),_0xdc08('0x60'),'severity',_0xdc08('0x61')];var _0x4808a0=[_0xdc08('0x62'),'made_sla',_0xdc08('0x63'),'watch_list',_0xdc08('0x64'),_0xdc08('0x65'),_0xdc08('0x66'),_0xdc08('0x5c'),_0xdc08('0x67'),'number','resolved_by',_0xdc08('0x68'),'opened_by',_0xdc08('0x69'),_0xdc08('0x6a'),_0xdc08('0x6b'),_0xdc08('0x6c'),_0xdc08('0x6d'),'knowledge','order','calendar_stc',_0xdc08('0x6e'),_0xdc08('0x6f'),_0xdc08('0x70'),_0xdc08('0x71'),_0xdc08('0x72'),_0xdc08('0x73'),_0xdc08('0x74'),_0xdc08('0x75'),'sys_domain_path',_0xdc08('0x76'),_0xdc08('0x77'),'expected_start','opened_at',_0xdc08('0x78'),'group_list',_0xdc08('0x79'),_0xdc08('0x7a'),_0xdc08('0x7b'),_0xdc08('0x7c'),_0xdc08('0x7d'),_0xdc08('0x7e'),'work_notes','short_description',_0xdc08('0x5e'),_0xdc08('0x7f'),_0xdc08('0x80'),_0xdc08('0x81'),'assignment_group','business_stc',_0xdc08('0x82'),'description',_0xdc08('0x83'),_0xdc08('0x5f'),_0xdc08('0x84'),'close_notes',_0xdc08('0x85'),_0xdc08('0x86'),'parent_incident','sys_id',_0xdc08('0x87'),_0xdc08('0x88'),_0xdc08('0x60'),_0xdc08('0x89'),_0xdc08('0x8a'),_0xdc08('0x8b'),_0xdc08('0x8c'),_0xdc08('0x8d'),_0xdc08('0x8e'),_0xdc08('0x8f'),'comments',_0xdc08('0x90'),'approval',_0xdc08('0x91'),_0xdc08('0x92'),'sys_mod_count','reopen_count',_0xdc08('0x93'),_0xdc08('0x94'),_0xdc08('0x95'),_0xdc08('0x96'),_0xdc08('0x97'),'category'];var _0x16f3cd='';var _0x1909f4='';var _0x5be091=[];var _0x16ca47='';var _0x55c0c2='';var _0x52d0d6=[];var _0x363dd7='';var _0xe725f0='';var _0xd161a={};var _0x3c1efc='';return db[_0xdc08('0x30')]['findOne']({'where':{'id':_0x1ee8cc[_0xdc08('0x4d')]['id']},'attributes':['id',_0xdc08('0x98'),_0xdc08('0x99'),_0xdc08('0x9a'),'remoteUri',_0xdc08('0x9b')]})[_0xdc08('0x28')](handleEntityNotFound(_0x28cee3,null))[_0xdc08('0x28')](function(_0x3667c1){if(_0x3667c1){_0x3c1efc=_0x3667c1['remoteUri'];var _0x4311d9=_0x3c1efc[_0xdc08('0x9c')](-0x1);if(_0x4311d9==='/'){_0x3c1efc=_0x3c1efc[_0xdc08('0x9d')](0x0,_0x3c1efc[_0xdc08('0x9e')](_0x4311d9));}_0xe725f0=util[_0xdc08('0x9f')](_0xdc08('0xa0'),_0x3c1efc);_0x363dd7=util['format'](_0xdc08('0xa1'),_0x3c1efc);_0xd161a={'user':_0x3667c1[_0xdc08('0x98')],'pass':_0x3667c1[_0xdc08('0x99')]};var _0x2e4c6b={'method':_0xdc08('0xa2'),'uri':_0xe725f0+'incident?sysparm_display_value=all','auth':_0xd161a,'json':!![]};return rp(_0x2e4c6b);}})[_0xdc08('0x28')](function(_0x137d75){if(_0x137d75[_0xdc08('0xa3')][_0xdc08('0x49')]>0x0){_0x16f3cd=_0x137d75[_0xdc08('0xa3')];}console[_0xdc08('0xa4')](_0xdc08('0xa5'),_0x16f3cd);_0x52d0d6=[];_0x1909f4=Object[_0xdc08('0xa6')]([],_0x16f3cd);_[_0xdc08('0xa7')](_0x1909f4,function(_0x517c7a){return!_0x4c400e[_0xdc08('0xa8')](_0x517c7a[_0xdc08('0x2c')]);});_0x1909f4[_0xdc08('0xa9')](function(_0x35cffb){var _0x4cf4c8=createFieldObject(_0x363dd7,_0xd161a,_0x35cffb[_0xdc08('0xaa')],_0x35cffb[_0xdc08('0x2c')],_0x35cffb['label'],![]);_0x52d0d6['push'](_0x4cf4c8);});return Promise['all'](_0x52d0d6);})[_0xdc08('0x28')](function(_0x37b838){_0x5be091=_0x37b838;_0x16ca47=Object[_0xdc08('0xa6')]([],_0x16f3cd);console['log']('TCL:\x20_object',_0x16f3cd);_['remove'](_0x16ca47,function(_0x78560e){return _0x4808a0[_0xdc08('0xa8')](_0x78560e['name']);});console[_0xdc08('0xa4')](_0xdc08('0xab'),_0x16ca47);_0x52d0d6=[];_0x16ca47[_0xdc08('0xa9')](function(_0x524b06){var _0x2e0e88=createFieldObject(_0x363dd7,_0xd161a,_0x524b06['internalType'],_0x524b06[_0xdc08('0x2c')],_0x524b06['label'],!![]);_0x52d0d6['push'](_0x2e0e88);});return Promise[_0xdc08('0xac')](_0x52d0d6);})[_0xdc08('0x28')](function(_0x22f09e){_0x55c0c2=_0x22f09e;var _0xca7bd2=_0x5be091[_0xdc08('0xad')](_0x55c0c2);return{'count':_0xca7bd2['length'],'rows':_0xca7bd2};})['then'](respondWithResult(_0x28cee3,null))[_0xdc08('0x47')](function(_0x49d344){console[_0xdc08('0xa4')](_0xdc08('0xae')+_0x49d344);var _0xe33d7a=_0x1ee8cc[_0xdc08('0x36')][_0xdc08('0xaf')]?0x1f4:_0x49d344[_0xdc08('0xb0')]||0x1f4;logger[_0xdc08('0x2a')](_0x49d344[_0xdc08('0x2b')]);delete _0x49d344['name'];if(_0xe33d7a===0x191){_0xe33d7a=0x190;}_0x28cee3[_0xdc08('0x1c')](_0xe33d7a)['send'](_0x1ee8cc[_0xdc08('0x36')][_0xdc08('0xaf')]?{'message':_0xdc08('0xb1'),'statusCode':_0x49d344['statusCode']}:_0x49d344);});};function createFieldObject(_0x38b049,_0x5bbf02,_0x23a797,_0x100a5a,_0x5e0e3e,_0x754de0){return new Promise(function(_0x4bceb8,_0x497eb2){var _0x4a3ded={'id':_0x100a5a,'name':_0x5e0e3e,'custom':_0x754de0};if(_0x23a797===_0xdc08('0xb2')){_0x4a3ded[_0xdc08('0x43')]=[{'name':_0xdc08('0xb3'),'value':'true'},{'name':_0xdc08('0xb4'),'value':_0xdc08('0xb5')}];_0x4bceb8(_0x4a3ded);}else{var _0x570069={'method':_0xdc08('0xa2'),'uri':_0x38b049+_0xdc08('0xb6')+_0x100a5a,'auth':_0x5bbf02,'json':!![]};return rp(_0x570069)[_0xdc08('0x28')](function(_0x1c9d22){var _0x25ac3b=[];if(_0x1c9d22[_0xdc08('0xa3')][_0xdc08('0x49')]>0x0){_0x1c9d22[_0xdc08('0xa3')][_0xdc08('0xa9')](function(_0x1541a2){if(_0x1541a2[_0xdc08('0xb7')]==='false'){var _0x523aa8={'name':_0x1541a2['label'],'value':_0x1541a2[_0xdc08('0xb8')]};_0x25ac3b[_0xdc08('0xb9')](_0x523aa8);}});}_0x4a3ded[_0xdc08('0x43')]=_0x25ac3b;if(_0x4a3ded[_0xdc08('0x43')]['length']>0x0){_0x4bceb8(_0x4a3ded);}else{if(_0x754de0==![]){_0x4bceb8();}else{_0x4bceb8(_0x4a3ded);}}});}});} \ No newline at end of file +var _0xfc83=['attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','length','merge','create','body','find','catch','findOne','ServicenowConfiguration','getConfigurations','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','category','parent','caused_by','watch_list','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','priority','sys_domain_path','time_worked','expected_start','opened_at','group_list','work_end','caller_id','approval_set','work_notes','close_code','delivery_task','work_start','business_stc','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','problem_id','company','reassignment_count','activity_due','severity','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','username','password','email','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','test','statusCode','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','query','keys','filters','intersection'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfc83,0x79));var _0x3fc8=function(_0x4ab1fa,_0x4ab5b5){_0x4ab1fa=_0x4ab1fa-0x0;var _0x314e9b=_0xfc83[_0x4ab1fa];return _0x314e9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fc8('0x1'));var rp=require(_0x3fc8('0x2'));var moment=require('moment');var BPromise=require(_0x3fc8('0x3'));var Mustache=require(_0x3fc8('0x4'));var util=require(_0x3fc8('0x5'));var path=require(_0x3fc8('0x6'));var sox=require(_0x3fc8('0x7'));var csv=require('to-csv');var ejs=require(_0x3fc8('0x8'));var fs=require('fs');var fs_extra=require(_0x3fc8('0x9'));var _=require(_0x3fc8('0xa'));var squel=require(_0x3fc8('0xb'));var crypto=require(_0x3fc8('0xc'));var jsforce=require(_0x3fc8('0xd'));var deskjs=require(_0x3fc8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3fc8('0xf'));var Papa=require(_0x3fc8('0x10'));var Redis=require(_0x3fc8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3fc8('0x12'));var as=require(_0x3fc8('0x13'));var hardwareService=require(_0x3fc8('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3fc8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fc8('0x16'))['db'];var integrations=require(_0x3fc8('0x17'));function respondWithStatusCode(_0x21ea9f,_0x23d298){_0x23d298=_0x23d298||0xcc;return function(_0x4a0d50){if(_0x4a0d50){return _0x21ea9f[_0x3fc8('0x18')](_0x23d298);}return _0x21ea9f[_0x3fc8('0x19')](_0x23d298)[_0x3fc8('0x1a')]();};}function respondWithResult(_0x526e5d,_0x513e6c){_0x513e6c=_0x513e6c||0xc8;return function(_0x2d69b3){if(_0x2d69b3){return _0x526e5d[_0x3fc8('0x19')](_0x513e6c)['json'](_0x2d69b3);}};}function respondWithFilteredResult(_0x5e3c82,_0x3ce91f){return function(_0x355e4f){if(_0x355e4f){var _0x6061d3=typeof _0x3ce91f[_0x3fc8('0x1b')]==='undefined'&&typeof _0x3ce91f[_0x3fc8('0x1c')]===_0x3fc8('0x1d');var _0x5000f4=_0x355e4f[_0x3fc8('0x1e')];var _0xf8afe8=_0x6061d3?0x0:_0x3ce91f[_0x3fc8('0x1b')];var _0x38d008=_0x6061d3?_0x355e4f['count']:_0x3ce91f['offset']+_0x3ce91f[_0x3fc8('0x1c')];var _0x17fd8c;if(_0x38d008>=_0x5000f4){_0x38d008=_0x5000f4;_0x17fd8c=0xc8;}else{_0x17fd8c=0xce;}_0x5e3c82[_0x3fc8('0x19')](_0x17fd8c);return _0x5e3c82['set'](_0x3fc8('0x1f'),_0xf8afe8+'-'+_0x38d008+'/'+_0x5000f4)[_0x3fc8('0x20')](_0x355e4f);}return null;};}function patchUpdates(_0x22be9a){return function(_0x21dcf9){try{jsonpatch[_0x3fc8('0x21')](_0x21dcf9,_0x22be9a,!![]);}catch(_0x506f8e){return BPromise[_0x3fc8('0x22')](_0x506f8e);}return _0x21dcf9[_0x3fc8('0x23')]();};}function saveUpdates(_0x2b996b,_0x22a78a){return function(_0x4390e4){if(_0x4390e4){return _0x4390e4[_0x3fc8('0x24')](_0x2b996b)[_0x3fc8('0x25')](function(_0x4d39af){return _0x4d39af;});}return null;};}function removeEntity(_0x16ca6c,_0x4e43f3){return function(_0x26d812){if(_0x26d812){return _0x26d812[_0x3fc8('0x26')]()[_0x3fc8('0x25')](function(){_0x16ca6c[_0x3fc8('0x19')](0xcc)[_0x3fc8('0x1a')]();});}};}function handleEntityNotFound(_0x4aad2d,_0x2e1ee7){return function(_0x36218a){if(!_0x36218a){_0x4aad2d[_0x3fc8('0x18')](0x194);}return _0x36218a;};}function handleError(_0x5989da,_0x20c84e){_0x20c84e=_0x20c84e||0x1f4;return function(_0x361a11){logger[_0x3fc8('0x27')](_0x361a11[_0x3fc8('0x28')]);if(_0x361a11[_0x3fc8('0x29')]){delete _0x361a11[_0x3fc8('0x29')];}_0x5989da[_0x3fc8('0x19')](_0x20c84e)[_0x3fc8('0x2a')](_0x361a11);};}exports[_0x3fc8('0x2b')]=function(_0x3ad73e,_0x29732e){var _0x5be139={},_0x41c1eb={},_0x2980c0={'count':0x0,'rows':[]};var _0x428352=_[_0x3fc8('0x2c')](db[_0x3fc8('0x2d')][_0x3fc8('0x2e')],function(_0x41d5d5){return{'name':_0x41d5d5[_0x3fc8('0x2f')],'type':_0x41d5d5[_0x3fc8('0x30')]['key']};});_0x41c1eb['model']=_[_0x3fc8('0x2c')](_0x428352,_0x3fc8('0x29'));_0x41c1eb[_0x3fc8('0x31')]=_[_0x3fc8('0x32')](_0x3ad73e[_0x3fc8('0x31')]);_0x41c1eb[_0x3fc8('0x33')]=_[_0x3fc8('0x34')](_0x41c1eb['model'],_0x41c1eb[_0x3fc8('0x31')]);_0x5be139[_0x3fc8('0x35')]=_[_0x3fc8('0x34')](_0x41c1eb['model'],qs['fields'](_0x3ad73e[_0x3fc8('0x31')][_0x3fc8('0x36')]));_0x5be139['attributes']=_0x5be139['attributes']['length']?_0x5be139[_0x3fc8('0x35')]:_0x41c1eb[_0x3fc8('0x37')];if(!_0x3ad73e[_0x3fc8('0x31')][_0x3fc8('0x38')](_0x3fc8('0x39'))){_0x5be139[_0x3fc8('0x1c')]=qs['limit'](_0x3ad73e['query'][_0x3fc8('0x1c')]);_0x5be139[_0x3fc8('0x1b')]=qs[_0x3fc8('0x1b')](_0x3ad73e[_0x3fc8('0x31')][_0x3fc8('0x1b')]);}_0x5be139[_0x3fc8('0x3a')]=qs[_0x3fc8('0x3b')](_0x3ad73e[_0x3fc8('0x31')][_0x3fc8('0x3b')]);_0x5be139[_0x3fc8('0x3c')]=qs['filters'](_[_0x3fc8('0x3d')](_0x3ad73e[_0x3fc8('0x31')],_0x41c1eb[_0x3fc8('0x33')]),_0x428352);if(_0x3ad73e[_0x3fc8('0x31')]['filter']){_0x5be139[_0x3fc8('0x3c')]=_['merge'](_0x5be139[_0x3fc8('0x3c')],{'$or':_[_0x3fc8('0x2c')](_0x428352,function(_0x445ecd){if(_0x445ecd[_0x3fc8('0x30')]!=='VIRTUAL'){var _0x23fdb1={};_0x23fdb1[_0x445ecd[_0x3fc8('0x29')]]={'$like':'%'+_0x3ad73e['query'][_0x3fc8('0x3e')]+'%'};return _0x23fdb1;}})});}_0x5be139=_['merge']({},_0x5be139,_0x3ad73e[_0x3fc8('0x3f')]);var _0x3559e8={'where':_0x5be139[_0x3fc8('0x3c')]};return db[_0x3fc8('0x2d')][_0x3fc8('0x1e')](_0x3559e8)[_0x3fc8('0x25')](function(_0x12f249){_0x2980c0[_0x3fc8('0x1e')]=_0x12f249;if(_0x3ad73e[_0x3fc8('0x31')][_0x3fc8('0x40')]){_0x5be139[_0x3fc8('0x41')]=[{'all':!![]}];}return db[_0x3fc8('0x2d')][_0x3fc8('0x42')](_0x5be139);})[_0x3fc8('0x25')](function(_0x2ae62c){_0x2980c0[_0x3fc8('0x43')]=_0x2ae62c;return _0x2980c0;})['then'](respondWithFilteredResult(_0x29732e,_0x5be139))['catch'](handleError(_0x29732e,null));};exports[_0x3fc8('0x44')]=function(_0xbf72aa,_0x46a983){var _0x432f7f={'raw':![],'where':{'id':_0xbf72aa[_0x3fc8('0x45')]['id']}},_0x187048={};_0x187048[_0x3fc8('0x37')]=_['keys'](db['ServicenowAccount'][_0x3fc8('0x2e')]);_0x187048[_0x3fc8('0x31')]=_[_0x3fc8('0x32')](_0xbf72aa['query']);_0x187048[_0x3fc8('0x33')]=_[_0x3fc8('0x34')](_0x187048[_0x3fc8('0x37')],_0x187048[_0x3fc8('0x31')]);_0x432f7f[_0x3fc8('0x35')]=_[_0x3fc8('0x34')](_0x187048['model'],qs[_0x3fc8('0x36')](_0xbf72aa['query'][_0x3fc8('0x36')]));_0x432f7f['attributes']=_0x432f7f[_0x3fc8('0x35')][_0x3fc8('0x46')]?_0x432f7f[_0x3fc8('0x35')]:_0x187048[_0x3fc8('0x37')];if(_0xbf72aa[_0x3fc8('0x31')][_0x3fc8('0x40')]){_0x432f7f[_0x3fc8('0x41')]=[{'all':!![]}];}_0x432f7f=_[_0x3fc8('0x47')]({},_0x432f7f,_0xbf72aa[_0x3fc8('0x3f')]);return db[_0x3fc8('0x2d')]['find'](_0x432f7f)[_0x3fc8('0x25')](handleEntityNotFound(_0x46a983,null))[_0x3fc8('0x25')](respondWithResult(_0x46a983,null))['catch'](handleError(_0x46a983,null));};exports[_0x3fc8('0x48')]=function(_0x281893,_0x3c2a3a){return db[_0x3fc8('0x2d')]['create'](_0x281893[_0x3fc8('0x49')],{})[_0x3fc8('0x25')](respondWithResult(_0x3c2a3a,0xc9))['catch'](handleError(_0x3c2a3a,null));};exports[_0x3fc8('0x24')]=function(_0x43fa89,_0x5a02d9){if(_0x43fa89[_0x3fc8('0x49')]['id']){delete _0x43fa89[_0x3fc8('0x49')]['id'];}return db[_0x3fc8('0x2d')][_0x3fc8('0x4a')]({'where':{'id':_0x43fa89['params']['id']}})[_0x3fc8('0x25')](handleEntityNotFound(_0x5a02d9,null))[_0x3fc8('0x25')](saveUpdates(_0x43fa89['body'],null))['then'](respondWithResult(_0x5a02d9,null))[_0x3fc8('0x4b')](handleError(_0x5a02d9,null));};exports[_0x3fc8('0x26')]=function(_0x4eb111,_0x32059e){return db[_0x3fc8('0x2d')][_0x3fc8('0x4a')]({'where':{'id':_0x4eb111[_0x3fc8('0x45')]['id']}})[_0x3fc8('0x25')](handleEntityNotFound(_0x32059e,null))[_0x3fc8('0x25')](removeEntity(_0x32059e,null))[_0x3fc8('0x4b')](handleError(_0x32059e,null));};exports['getConfigurations']=function(_0x32030e,_0x4798e2,_0x75c4dc){var _0x417462={};var _0x390f4a={};var _0x57cf99;var _0x12cf14;return db[_0x3fc8('0x2d')][_0x3fc8('0x4c')]({'where':{'id':_0x32030e[_0x3fc8('0x45')]['id']}})['then'](handleEntityNotFound(_0x4798e2,null))[_0x3fc8('0x25')](function(_0x53d7a0){if(_0x53d7a0){_0x57cf99=_0x53d7a0;_0x390f4a[_0x3fc8('0x37')]=_['keys'](db[_0x3fc8('0x4d')]['rawAttributes']);_0x390f4a[_0x3fc8('0x31')]=_[_0x3fc8('0x32')](_0x32030e[_0x3fc8('0x31')]);_0x390f4a[_0x3fc8('0x33')]=_['intersection'](_0x390f4a['model'],_0x390f4a['query']);_0x417462['attributes']=_['intersection'](_0x390f4a[_0x3fc8('0x37')],qs[_0x3fc8('0x36')](_0x32030e[_0x3fc8('0x31')][_0x3fc8('0x36')]));_0x417462['attributes']=_0x417462[_0x3fc8('0x35')][_0x3fc8('0x46')]?_0x417462[_0x3fc8('0x35')]:_0x390f4a[_0x3fc8('0x37')];_0x417462[_0x3fc8('0x3a')]=qs[_0x3fc8('0x3b')](_0x32030e[_0x3fc8('0x31')][_0x3fc8('0x3b')]);_0x417462['where']=qs[_0x3fc8('0x33')](_[_0x3fc8('0x3d')](_0x32030e['query'],_0x390f4a[_0x3fc8('0x33')]));if(_0x32030e[_0x3fc8('0x31')]['filter']){_0x417462['where']=_[_0x3fc8('0x47')](_0x417462[_0x3fc8('0x3c')],{'$or':_['map'](_0x417462[_0x3fc8('0x35')],function(_0x514692){var _0x3d901d={};_0x3d901d[_0x514692]={'$like':'%'+_0x32030e[_0x3fc8('0x31')]['filter']+'%'};return _0x3d901d;})});}_0x417462=_[_0x3fc8('0x47')]({},_0x417462,_0x32030e[_0x3fc8('0x3f')]);return _0x57cf99[_0x3fc8('0x4e')](_0x417462);}})[_0x3fc8('0x25')](function(_0x175fea){if(_0x175fea){_0x12cf14=_0x175fea['length'];if(!_0x32030e[_0x3fc8('0x31')][_0x3fc8('0x38')](_0x3fc8('0x39'))){_0x417462[_0x3fc8('0x1c')]=qs[_0x3fc8('0x1c')](_0x32030e[_0x3fc8('0x31')]['limit']);_0x417462[_0x3fc8('0x1b')]=qs['offset'](_0x32030e[_0x3fc8('0x31')][_0x3fc8('0x1b')]);}return _0x57cf99[_0x3fc8('0x4e')](_0x417462);}})[_0x3fc8('0x25')](function(_0x51f927){if(_0x51f927){return _0x51f927?{'count':_0x12cf14,'rows':_0x51f927}:null;}})['then'](respondWithResult(_0x4798e2,null))[_0x3fc8('0x4b')](handleError(_0x4798e2,null));};exports['addConfiguration']=function(_0x29d118,_0x488e7f,_0xd8ed14){if(_0x29d118[_0x3fc8('0x49')]['id']){delete _0x29d118[_0x3fc8('0x49')]['id'];}return db[_0x3fc8('0x2d')][_0x3fc8('0x4c')]({'where':{'id':_0x29d118['params']['id']}})[_0x3fc8('0x25')](handleEntityNotFound(_0x488e7f,null))[_0x3fc8('0x25')](function(_0xf9bd7f){if(_0xf9bd7f){_0x29d118['body'][_0x3fc8('0x4f')]=_0xf9bd7f['id'];_0x29d118[_0x3fc8('0x49')][_0x3fc8('0x50')]=integrations['getSubjects'](_0x29d118[_0x3fc8('0x49')]['channel'],_0x29d118[_0x3fc8('0x49')]['type']);_0x29d118[_0x3fc8('0x49')][_0x3fc8('0x51')]=integrations[_0x3fc8('0x52')](_0x29d118[_0x3fc8('0x49')][_0x3fc8('0x53')],_0x29d118[_0x3fc8('0x49')]['type']);return db[_0x3fc8('0x4d')][_0x3fc8('0x48')](_0x29d118['body'],{'include':[{'model':db[_0x3fc8('0x54')],'as':_0x3fc8('0x50')},{'model':db['ServicenowField'],'as':_0x3fc8('0x51')}]});}return null;})['then'](respondWithResult(_0x488e7f,null))[_0x3fc8('0x4b')](handleError(_0x488e7f,null));};exports[_0x3fc8('0x55')]=function(_0x51db31,_0xb8d661,_0x9f7db7){var _0x589a12=[_0x3fc8('0x56'),_0x3fc8('0x57'),_0x3fc8('0x58'),_0x3fc8('0x59'),'close_code',_0x3fc8('0x5a'),_0x3fc8('0x5b'),'severity',_0x3fc8('0x5c')];var _0x4711cb=[_0x3fc8('0x5d'),_0x3fc8('0x56'),_0x3fc8('0x5e'),_0x3fc8('0x5f'),'upon_reject',_0x3fc8('0x60'),'child_incidents','hold_reason',_0x3fc8('0x61'),_0x3fc8('0x62'),_0x3fc8('0x63'),_0x3fc8('0x64'),_0x3fc8('0x65'),'user_input',_0x3fc8('0x66'),_0x3fc8('0x67'),'state',_0x3fc8('0x68'),'knowledge',_0x3fc8('0x3a'),_0x3fc8('0x69'),_0x3fc8('0x6a'),_0x3fc8('0x6b'),'delivery_plan',_0x3fc8('0x6c'),_0x3fc8('0x6d'),'work_notes_list','business_service',_0x3fc8('0x6e'),_0x3fc8('0x6f'),'rfc',_0x3fc8('0x70'),_0x3fc8('0x71'),_0x3fc8('0x72'),'business_duration',_0x3fc8('0x73'),_0x3fc8('0x74'),'reopened_time','resolved_at',_0x3fc8('0x75'),_0x3fc8('0x76'),_0x3fc8('0x59'),_0x3fc8('0x77'),'short_description',_0x3fc8('0x78'),'correlation_display',_0x3fc8('0x79'),_0x3fc8('0x7a'),'assignment_group',_0x3fc8('0x7b'),'additional_assignee_list','description',_0x3fc8('0x7c'),_0x3fc8('0x5a'),_0x3fc8('0x7d'),'close_notes',_0x3fc8('0x7e'),_0x3fc8('0x7f'),_0x3fc8('0x80'),'sys_id','contact_type','reopened_by',_0x3fc8('0x5b'),'urgency',_0x3fc8('0x81'),_0x3fc8('0x82'),_0x3fc8('0x83'),_0x3fc8('0x84'),'assigned_to',_0x3fc8('0x85'),'comments',_0x3fc8('0x86'),'approval',_0x3fc8('0x87'),_0x3fc8('0x88'),_0x3fc8('0x89'),_0x3fc8('0x8a'),_0x3fc8('0x8b'),_0x3fc8('0x8c'),_0x3fc8('0x8d'),'correlation_id','location',_0x3fc8('0x5c')];var _0x359c9e='';var _0x1cb21e='';var _0x2a708c=[];var _0x13a847='';var _0x3e7743='';var _0xb35c10=[];var _0x3e8cee='';var _0x2124a3='';var _0x353b3c={};var _0x2b922d='';return db[_0x3fc8('0x2d')][_0x3fc8('0x4c')]({'where':{'id':_0x51db31[_0x3fc8('0x45')]['id']},'attributes':['id',_0x3fc8('0x8e'),_0x3fc8('0x8f'),_0x3fc8('0x90'),'remoteUri','serverUrl']})[_0x3fc8('0x25')](handleEntityNotFound(_0xb8d661,null))['then'](function(_0x2b7a82){if(_0x2b7a82){_0x2b922d=_0x2b7a82['remoteUri'];var _0x35828e=_0x2b922d['slice'](-0x1);if(_0x35828e==='/'){_0x2b922d=_0x2b922d[_0x3fc8('0x91')](0x0,_0x2b922d[_0x3fc8('0x92')](_0x35828e));}_0x2124a3=util['format'](_0x3fc8('0x93'),_0x2b922d);_0x3e8cee=util[_0x3fc8('0x94')](_0x3fc8('0x95'),_0x2b922d);_0x353b3c={'user':_0x2b7a82[_0x3fc8('0x8e')],'pass':_0x2b7a82[_0x3fc8('0x8f')]};var _0x41b31f={'method':_0x3fc8('0x96'),'uri':_0x2124a3+_0x3fc8('0x97'),'auth':_0x353b3c,'json':!![]};return rp(_0x41b31f);}})['then'](function(_0x1eb3d1){if(_0x1eb3d1['result'][_0x3fc8('0x46')]>0x0){_0x359c9e=_0x1eb3d1[_0x3fc8('0x98')];}console[_0x3fc8('0x99')](_0x3fc8('0x9a'),_0x359c9e);_0xb35c10=[];_0x1cb21e=Object[_0x3fc8('0x9b')]([],_0x359c9e);_[_0x3fc8('0x9c')](_0x1cb21e,function(_0x2ea8cc){return!_0x589a12[_0x3fc8('0x9d')](_0x2ea8cc[_0x3fc8('0x29')]);});_0x1cb21e[_0x3fc8('0x9e')](function(_0x289801){var _0x20d527=createFieldObject(_0x3e8cee,_0x353b3c,_0x289801[_0x3fc8('0x9f')],_0x289801[_0x3fc8('0x29')],_0x289801['label'],![]);_0xb35c10[_0x3fc8('0xa0')](_0x20d527);});return Promise[_0x3fc8('0xa1')](_0xb35c10);})[_0x3fc8('0x25')](function(_0x223314){_0x2a708c=_0x223314;_0x13a847=Object[_0x3fc8('0x9b')]([],_0x359c9e);console[_0x3fc8('0x99')](_0x3fc8('0xa2'),_0x359c9e);_[_0x3fc8('0x9c')](_0x13a847,function(_0x132fc1){return _0x4711cb['includes'](_0x132fc1[_0x3fc8('0x29')]);});console[_0x3fc8('0x99')](_0x3fc8('0xa3'),_0x13a847);_0xb35c10=[];_0x13a847['forEach'](function(_0x439926){var _0x161a3c=createFieldObject(_0x3e8cee,_0x353b3c,_0x439926['internalType'],_0x439926['name'],_0x439926[_0x3fc8('0xa4')],!![]);_0xb35c10[_0x3fc8('0xa0')](_0x161a3c);});return Promise[_0x3fc8('0xa1')](_0xb35c10);})[_0x3fc8('0x25')](function(_0xfa9c8a){_0x3e7743=_0xfa9c8a;var _0x4c2906=_0x2a708c[_0x3fc8('0xa5')](_0x3e7743);return{'count':_0x4c2906[_0x3fc8('0x46')],'rows':_0x4c2906};})[_0x3fc8('0x25')](respondWithResult(_0xb8d661,null))[_0x3fc8('0x4b')](function(_0x482308){console[_0x3fc8('0x99')]('ServiceNow\x20error:\x20'+_0x482308);var _0x1c093b=_0x51db31[_0x3fc8('0x31')]['test']?0x1f4:_0x482308['statusCode']||0x1f4;logger[_0x3fc8('0x27')](_0x482308['stack']);delete _0x482308[_0x3fc8('0x29')];if(_0x1c093b===0x191){_0x1c093b=0x190;}_0xb8d661[_0x3fc8('0x19')](_0x1c093b)[_0x3fc8('0x2a')](_0x51db31[_0x3fc8('0x31')][_0x3fc8('0xa6')]?{'message':'Wrong\x20credentials','statusCode':_0x482308[_0x3fc8('0xa7')]}:_0x482308);});};function createFieldObject(_0x47fce7,_0x1f0ef9,_0x257a58,_0x48fd12,_0x3c0e25,_0x58b432){return new Promise(function(_0x2e55d7,_0x6879c5){var _0x6a3a64={'id':_0x48fd12,'name':_0x3c0e25,'custom':_0x58b432};if(_0x257a58===_0x3fc8('0xa8')){_0x6a3a64['options']=[{'name':_0x3fc8('0xa9'),'value':_0x3fc8('0xaa')},{'name':'False','value':_0x3fc8('0xab')}];_0x2e55d7(_0x6a3a64);}else{var _0x49b70e={'method':_0x3fc8('0x96'),'uri':_0x47fce7+_0x3fc8('0xac')+_0x48fd12,'auth':_0x1f0ef9,'json':!![]};return rp(_0x49b70e)[_0x3fc8('0x25')](function(_0x2a2a0a){var _0x3d47ab=[];if(_0x2a2a0a['result']['length']>0x0){_0x2a2a0a['result'][_0x3fc8('0x9e')](function(_0x25ad78){if(_0x25ad78['inactive']==='false'){var _0x495ec9={'name':_0x25ad78[_0x3fc8('0xa4')],'value':_0x25ad78[_0x3fc8('0xad')]};_0x3d47ab[_0x3fc8('0xa0')](_0x495ec9);}});}_0x6a3a64[_0x3fc8('0x3f')]=_0x3d47ab;if(_0x6a3a64[_0x3fc8('0x3f')][_0x3fc8('0x46')]>0x0){_0x2e55d7(_0x6a3a64);}else{if(_0x58b432==![]){_0x2e55d7();}else{_0x2e55d7(_0x6a3a64);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 69c2e55..2a0ef85 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 _0x2675=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','moment','bluebird'];(function(_0x5365a9,_0x34eee4){var _0x43b00c=function(_0x42de41){while(--_0x42de41){_0x5365a9['push'](_0x5365a9['shift']());}};_0x43b00c(++_0x34eee4);}(_0x2675,0x75));var _0x5267=function(_0xb9ffe0,_0x1e41f2){_0xb9ffe0=_0xb9ffe0-0x0;var _0x418fb2=_0x2675[_0xb9ffe0];return _0x418fb2;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));var integrations=require(_0x5267('0x6'));module[_0x5267('0x7')]=function(_0x10f92c,_0x20f065){return _0x10f92c[_0x5267('0x8')]('ServicenowAccount',attributes,{'tableName':_0x5267('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x5496,0x175));var _0x6549=function(_0x1d1ecf,_0x708c08){_0x1d1ecf=_0x1d1ecf-0x0;var _0x1da0e7=_0x5496[_0x1d1ecf];return _0x1da0e7;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('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 79d87d5..0162e6b 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 _0x2bdf=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowServicenowAccount','then'];(function(_0xf0f7ba,_0x48be70){var _0x44382c=function(_0x5b746c){while(--_0x5b746c){_0xf0f7ba['push'](_0xf0f7ba['shift']());}};_0x44382c(++_0x48be70);}(_0x2bdf,0x1ee));var _0xf2bd=function(_0x316c,_0x278657){_0x316c=_0x316c-0x0;var _0x43e4cc=_0x2bdf[_0x316c];return _0x43e4cc;};'use strict';var _=require('lodash');var util=require(_0xf2bd('0x0'));var moment=require(_0xf2bd('0x1'));var BPromise=require(_0xf2bd('0x2'));var rs=require(_0xf2bd('0x3'));var fs=require('fs');var Redis=require(_0xf2bd('0x4'));var db=require(_0xf2bd('0x5'))['db'];var utils=require(_0xf2bd('0x6'));var logger=require(_0xf2bd('0x7'))(_0xf2bd('0x8'));var config=require(_0xf2bd('0x9'));var jayson=require(_0xf2bd('0xa'));var client=jayson[_0xf2bd('0xb')][_0xf2bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x590c91,_0x9f4a50,_0x2655bb){return new BPromise(function(_0x26e740,_0x33e099){return client[_0xf2bd('0xd')](_0x590c91,_0x2655bb)['then'](function(_0x576070){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x9f4a50,_0xf2bd('0xe'));logger[_0xf2bd('0xf')](_0xf2bd('0x10'),_0x9f4a50,_0xf2bd('0xe'),JSON[_0xf2bd('0x11')](_0x576070));if(_0x576070[_0xf2bd('0x12')]){if(_0x576070['error'][_0xf2bd('0x13')]===0x1f4){logger[_0xf2bd('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x9f4a50,_0x576070[_0xf2bd('0x12')]['message']);return _0x33e099(_0x576070[_0xf2bd('0x12')]['message']);}logger[_0xf2bd('0x12')](_0xf2bd('0x14'),_0x9f4a50,_0x576070['error']['message']);return _0x26e740(_0x576070[_0xf2bd('0x12')][_0xf2bd('0x15')]);}else{logger[_0xf2bd('0x16')](_0xf2bd('0x14'),_0x9f4a50,'request\x20sent');_0x26e740(_0x576070[_0xf2bd('0x17')][_0xf2bd('0x15')]);}})['catch'](function(_0x57b33e){logger[_0xf2bd('0x12')](_0xf2bd('0x14'),_0x9f4a50,_0x57b33e);_0x33e099(_0x57b33e);});});}exports[_0xf2bd('0x18')]=function(_0x251ad7){var _0x1c2e5e=this;return new Promise(function(_0xd7899d,_0x15ec2f){return db[_0xf2bd('0x19')][_0xf2bd('0x1a')]({'raw':_0x251ad7[_0xf2bd('0x1b')]?_0x251ad7['options'][_0xf2bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x251ad7[_0xf2bd('0x1b')]?_0x251ad7[_0xf2bd('0x1b')][_0xf2bd('0x1d')]||null:null,'attributes':_0x251ad7[_0xf2bd('0x1b')]?_0x251ad7[_0xf2bd('0x1b')][_0xf2bd('0x1e')]||null:null,'limit':_0x251ad7[_0xf2bd('0x1b')]?_0x251ad7[_0xf2bd('0x1b')][_0xf2bd('0x1f')]||null:null,'include':_0x251ad7[_0xf2bd('0x1b')]?_0x251ad7['options'][_0xf2bd('0x20')]?_[_0xf2bd('0x21')](_0x251ad7[_0xf2bd('0x1b')][_0xf2bd('0x20')],function(_0x1ce305){return{'model':db[_0x1ce305['model']],'as':_0x1ce305['as'],'attributes':_0x1ce305[_0xf2bd('0x1e')],'include':_0x1ce305[_0xf2bd('0x20')]?_['map'](_0x1ce305[_0xf2bd('0x20')],function(_0x3f141e){return{'model':db[_0x3f141e[_0xf2bd('0x22')]],'as':_0x3f141e['as'],'attributes':_0x3f141e['attributes'],'include':_0x3f141e['include']?_[_0xf2bd('0x21')](_0x3f141e[_0xf2bd('0x20')],function(_0x207810){return{'model':db[_0x207810[_0xf2bd('0x22')]],'as':_0x207810['as'],'attributes':_0x207810[_0xf2bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50e395){logger[_0xf2bd('0x16')]('GetServicenowAccount',_0x251ad7);logger[_0xf2bd('0xf')](_0xf2bd('0x18'),_0x251ad7,JSON['stringify'](_0x50e395));_0xd7899d(_0x50e395);})[_0xf2bd('0x23')](function(_0x2a8504){logger[_0xf2bd('0x12')]('GetServicenowAccount',_0x2a8504[_0xf2bd('0x15')],_0x251ad7);_0x15ec2f(_0x1c2e5e[_0xf2bd('0x12')](0x1f4,_0x2a8504[_0xf2bd('0x15')]));});});};exports[_0xf2bd('0x24')]=function(_0x5e2d85){var _0x4d9ee5=this;return new Promise(function(_0x27ecd4,_0x1540c3){return db['ServicenowAccount']['find']({'raw':_0x5e2d85[_0xf2bd('0x1b')]?_0x5e2d85[_0xf2bd('0x1b')][_0xf2bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e2d85[_0xf2bd('0x1b')]?_0x5e2d85[_0xf2bd('0x1b')][_0xf2bd('0x1d')]||null:null,'attributes':_0x5e2d85[_0xf2bd('0x1b')]?_0x5e2d85[_0xf2bd('0x1b')][_0xf2bd('0x1e')]||null:null,'include':_0x5e2d85[_0xf2bd('0x1b')]?_0x5e2d85[_0xf2bd('0x1b')][_0xf2bd('0x20')]?_[_0xf2bd('0x21')](_0x5e2d85[_0xf2bd('0x1b')]['include'],function(_0xc1a025){return{'model':db[_0xc1a025[_0xf2bd('0x22')]],'as':_0xc1a025['as'],'attributes':_0xc1a025['attributes'],'include':_0xc1a025[_0xf2bd('0x20')]?_[_0xf2bd('0x21')](_0xc1a025[_0xf2bd('0x20')],function(_0x3e00e1){return{'model':db[_0x3e00e1[_0xf2bd('0x22')]],'as':_0x3e00e1['as'],'attributes':_0x3e00e1[_0xf2bd('0x1e')],'include':_0x3e00e1[_0xf2bd('0x20')]?_['map'](_0x3e00e1[_0xf2bd('0x20')],function(_0x1f8045){return{'model':db[_0x1f8045[_0xf2bd('0x22')]],'as':_0x1f8045['as'],'attributes':_0x1f8045[_0xf2bd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf2bd('0x25')](function(_0x68152e){logger['info'](_0xf2bd('0x24'),_0x5e2d85);logger[_0xf2bd('0xf')](_0xf2bd('0x24'),_0x5e2d85,JSON[_0xf2bd('0x11')](_0x68152e));_0x27ecd4(_0x68152e);})[_0xf2bd('0x23')](function(_0x561a7b){logger[_0xf2bd('0x12')]('ShowServicenowAccount',_0x561a7b[_0xf2bd('0x15')],_0x5e2d85);_0x1540c3(_0x4d9ee5[_0xf2bd('0x12')](0x1f4,_0x561a7b[_0xf2bd('0x15')]));});});}; \ No newline at end of file +var _0x9adf=['code','message','result','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','catch','util','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','stringify','error'];(function(_0x4c4cbf,_0x1e6e6){var _0xa65774=function(_0x7827f4){while(--_0x7827f4){_0x4c4cbf['push'](_0x4c4cbf['shift']());}};_0xa65774(++_0x1e6e6);}(_0x9adf,0x1cc));var _0xf9ad=function(_0xc6ce5b,_0x13352b){_0xc6ce5b=_0xc6ce5b-0x0;var _0x14f90d=_0x9adf[_0xc6ce5b];return _0x14f90d;};'use strict';var _=require('lodash');var util=require(_0xf9ad('0x0'));var moment=require(_0xf9ad('0x1'));var BPromise=require(_0xf9ad('0x2'));var rs=require(_0xf9ad('0x3'));var fs=require('fs');var Redis=require(_0xf9ad('0x4'));var db=require(_0xf9ad('0x5'))['db'];var utils=require(_0xf9ad('0x6'));var logger=require(_0xf9ad('0x7'))(_0xf9ad('0x8'));var config=require(_0xf9ad('0x9'));var jayson=require(_0xf9ad('0xa'));var client=jayson[_0xf9ad('0xb')][_0xf9ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x142e4f,_0x3b4b68,_0x3a3e64){return new BPromise(function(_0x50b872,_0x266479){return client['request'](_0x142e4f,_0x3a3e64)[_0xf9ad('0xd')](function(_0x21b715){logger[_0xf9ad('0xe')](_0xf9ad('0xf'),_0x3b4b68,_0xf9ad('0x10'));logger[_0xf9ad('0x11')](_0xf9ad('0x12'),_0x3b4b68,_0xf9ad('0x10'),JSON[_0xf9ad('0x13')](_0x21b715));if(_0x21b715[_0xf9ad('0x14')]){if(_0x21b715[_0xf9ad('0x14')][_0xf9ad('0x15')]===0x1f4){logger[_0xf9ad('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x3b4b68,_0x21b715['error'][_0xf9ad('0x16')]);return _0x266479(_0x21b715[_0xf9ad('0x14')][_0xf9ad('0x16')]);}logger['error'](_0xf9ad('0xf'),_0x3b4b68,_0x21b715[_0xf9ad('0x14')]['message']);return _0x50b872(_0x21b715['error'][_0xf9ad('0x16')]);}else{logger[_0xf9ad('0xe')](_0xf9ad('0xf'),_0x3b4b68,_0xf9ad('0x10'));_0x50b872(_0x21b715[_0xf9ad('0x17')][_0xf9ad('0x16')]);}})['catch'](function(_0x297455){logger[_0xf9ad('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x3b4b68,_0x297455);_0x266479(_0x297455);});});}exports['GetServicenowAccount']=function(_0x2fd0be){var _0x18a186=this;return new Promise(function(_0x27b998,_0x470d83){return db[_0xf9ad('0x18')][_0xf9ad('0x19')]({'raw':_0x2fd0be[_0xf9ad('0x1a')]?_0x2fd0be[_0xf9ad('0x1a')][_0xf9ad('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fd0be[_0xf9ad('0x1a')]?_0x2fd0be[_0xf9ad('0x1a')]['where']||null:null,'attributes':_0x2fd0be[_0xf9ad('0x1a')]?_0x2fd0be['options'][_0xf9ad('0x1c')]||null:null,'limit':_0x2fd0be[_0xf9ad('0x1a')]?_0x2fd0be['options'][_0xf9ad('0x1d')]||null:null,'include':_0x2fd0be['options']?_0x2fd0be[_0xf9ad('0x1a')][_0xf9ad('0x1e')]?_[_0xf9ad('0x1f')](_0x2fd0be[_0xf9ad('0x1a')][_0xf9ad('0x1e')],function(_0x4937af){return{'model':db[_0x4937af[_0xf9ad('0x20')]],'as':_0x4937af['as'],'attributes':_0x4937af['attributes'],'include':_0x4937af['include']?_[_0xf9ad('0x1f')](_0x4937af['include'],function(_0x530e50){return{'model':db[_0x530e50[_0xf9ad('0x20')]],'as':_0x530e50['as'],'attributes':_0x530e50[_0xf9ad('0x1c')],'include':_0x530e50[_0xf9ad('0x1e')]?_[_0xf9ad('0x1f')](_0x530e50[_0xf9ad('0x1e')],function(_0x1a8666){return{'model':db[_0x1a8666['model']],'as':_0x1a8666['as'],'attributes':_0x1a8666[_0xf9ad('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf9ad('0xd')](function(_0x44bcc9){logger[_0xf9ad('0xe')](_0xf9ad('0x21'),_0x2fd0be);logger[_0xf9ad('0x11')](_0xf9ad('0x21'),_0x2fd0be,JSON[_0xf9ad('0x13')](_0x44bcc9));_0x27b998(_0x44bcc9);})['catch'](function(_0x53dacd){logger[_0xf9ad('0x14')](_0xf9ad('0x21'),_0x53dacd[_0xf9ad('0x16')],_0x2fd0be);_0x470d83(_0x18a186[_0xf9ad('0x14')](0x1f4,_0x53dacd[_0xf9ad('0x16')]));});});};exports[_0xf9ad('0x22')]=function(_0x196120){var _0x11963c=this;return new Promise(function(_0x237ce2,_0x38258d){return db[_0xf9ad('0x18')][_0xf9ad('0x23')]({'raw':_0x196120[_0xf9ad('0x1a')]?_0x196120[_0xf9ad('0x1a')][_0xf9ad('0x1b')]===undefined?!![]:![]:!![],'where':_0x196120['options']?_0x196120['options']['where']||null:null,'attributes':_0x196120[_0xf9ad('0x1a')]?_0x196120[_0xf9ad('0x1a')][_0xf9ad('0x1c')]||null:null,'include':_0x196120[_0xf9ad('0x1a')]?_0x196120[_0xf9ad('0x1a')][_0xf9ad('0x1e')]?_['map'](_0x196120['options']['include'],function(_0x10fd43){return{'model':db[_0x10fd43['model']],'as':_0x10fd43['as'],'attributes':_0x10fd43[_0xf9ad('0x1c')],'include':_0x10fd43['include']?_[_0xf9ad('0x1f')](_0x10fd43[_0xf9ad('0x1e')],function(_0x3f64c7){return{'model':db[_0x3f64c7['model']],'as':_0x3f64c7['as'],'attributes':_0x3f64c7[_0xf9ad('0x1c')],'include':_0x3f64c7[_0xf9ad('0x1e')]?_[_0xf9ad('0x1f')](_0x3f64c7[_0xf9ad('0x1e')],function(_0x5b0728){return{'model':db[_0x5b0728[_0xf9ad('0x20')]],'as':_0x5b0728['as'],'attributes':_0x5b0728[_0xf9ad('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf9ad('0xd')](function(_0x1e8abf){logger[_0xf9ad('0xe')](_0xf9ad('0x22'),_0x196120);logger[_0xf9ad('0x11')]('ShowServicenowAccount',_0x196120,JSON[_0xf9ad('0x13')](_0x1e8abf));_0x237ce2(_0x1e8abf);})[_0xf9ad('0x24')](function(_0x572dbb){logger[_0xf9ad('0x14')](_0xf9ad('0x22'),_0x572dbb['message'],_0x196120);_0x38258d(_0x11963c[_0xf9ad('0x14')](0x1f4,_0x572dbb[_0xf9ad('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0178b52..99ff930 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 _0x20bc=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x20bc,0x7e));var _0xc20b=function(_0x132edb,_0x54e052){_0x132edb=_0x132edb-0x0;var _0x294aab=_0x20bc[_0x132edb];return _0x294aab;};'use strict';var multer=require(_0xc20b('0x0'));var util=require(_0xc20b('0x1'));var path=require(_0xc20b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc20b('0x3')]();var fs_extra=require(_0xc20b('0x4'));var auth=require(_0xc20b('0x5'));var interaction=require(_0xc20b('0x6'));var config=require(_0xc20b('0x7'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc20b('0x8')]);router[_0xc20b('0x9')](_0xc20b('0xa'),auth[_0xc20b('0xb')](),controller[_0xc20b('0xc')]);router[_0xc20b('0x9')](_0xc20b('0xd'),auth['isAuthenticated'](),controller[_0xc20b('0xe')]);router[_0xc20b('0x9')](_0xc20b('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xc20b('0x9')]('/:id/descriptions',auth[_0xc20b('0xb')](),controller[_0xc20b('0x10')]);router[_0xc20b('0x11')]('/',auth['isAuthenticated'](),controller[_0xc20b('0x12')]);router[_0xc20b('0x13')](_0xc20b('0xa'),auth[_0xc20b('0xb')](),controller['update']);router['delete'](_0xc20b('0xa'),auth[_0xc20b('0xb')](),controller[_0xc20b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb6db=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy'];(function(_0x2fb625,_0x355f8d){var _0x3b1743=function(_0x475126){while(--_0x475126){_0x2fb625['push'](_0x2fb625['shift']());}};_0x3b1743(++_0x355f8d);}(_0xb6db,0x165));var _0xbb6d=function(_0x5dc0e3,_0x1d2f57){_0x5dc0e3=_0x5dc0e3-0x0;var _0x1b92cd=_0xb6db[_0x5dc0e3];return _0x1b92cd;};'use strict';var multer=require(_0xbb6d('0x0'));var util=require(_0xbb6d('0x1'));var path=require(_0xbb6d('0x2'));var timeout=require(_0xbb6d('0x3'));var express=require('express');var router=express[_0xbb6d('0x4')]();var fs_extra=require(_0xbb6d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbb6d('0x6'));var config=require('../../config/environment');var controller=require(_0xbb6d('0x7'));router['get']('/',auth[_0xbb6d('0x8')](),controller['index']);router[_0xbb6d('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbb6d('0x9')](_0xbb6d('0xa'),auth[_0xbb6d('0x8')](),controller[_0xbb6d('0xb')]);router[_0xbb6d('0x9')](_0xbb6d('0xc'),auth[_0xbb6d('0x8')](),controller[_0xbb6d('0xd')]);router[_0xbb6d('0x9')](_0xbb6d('0xe'),auth[_0xbb6d('0x8')](),controller[_0xbb6d('0xf')]);router[_0xbb6d('0x10')]('/',auth[_0xbb6d('0x8')](),controller[_0xbb6d('0x11')]);router[_0xbb6d('0x12')](_0xbb6d('0x13'),auth[_0xbb6d('0x8')](),controller['update']);router['delete'](_0xbb6d('0x13'),auth['isAuthenticated'](),controller[_0xbb6d('0x14')]);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 63488db..6cf7501 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 _0x9282=['STRING','sequelize','exports'];(function(_0x31503e,_0x33ef85){var _0x533b36=function(_0x22f2f4){while(--_0x22f2f4){_0x31503e['push'](_0x31503e['shift']());}};_0x533b36(++_0x33ef85);}(_0x9282,0xdc));var _0x2928=function(_0xf37b8d,_0x42ce54){_0xf37b8d=_0xf37b8d-0x0;var _0x3b0b62=_0x9282[_0xf37b8d];return _0x3b0b62;};'use strict';var Sequelize=require(_0x2928('0x0'));module[_0x2928('0x1')]={'name':{'type':Sequelize[_0x2928('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd27e=['sequelize','exports'];(function(_0xa26e2c,_0x1ffb98){var _0x524b0e=function(_0x224591){while(--_0x224591){_0xa26e2c['push'](_0xa26e2c['shift']());}};_0x524b0e(++_0x1ffb98);}(_0xd27e,0x1b8));var _0xed27=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd27e[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xed27('0x0'));module[_0xed27('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 27ef7d8..36023ca 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 _0x734e=['pick','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','error','stack','name','index','map','ServicenowConfiguration','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getFields','findOne','ServicenowField'];(function(_0x74f146,_0x301a4f){var _0x400a98=function(_0x2c0044){while(--_0x2c0044){_0x74f146['push'](_0x74f146['shift']());}};_0x400a98(++_0x301a4f);}(_0x734e,0x18f));var _0xe734=function(_0x2fab67,_0x510e24){_0x2fab67=_0x2fab67-0x0;var _0x3b0237=_0x734e[_0x2fab67];return _0x3b0237;};'use strict';var emlformat=require(_0xe734('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe734('0x1'));var jsonpatch=require(_0xe734('0x2'));var rp=require(_0xe734('0x3'));var moment=require(_0xe734('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe734('0x5'));var sox=require(_0xe734('0x6'));var csv=require('to-csv');var ejs=require(_0xe734('0x7'));var fs=require('fs');var fs_extra=require(_0xe734('0x8'));var _=require(_0xe734('0x9'));var squel=require(_0xe734('0xa'));var crypto=require(_0xe734('0xb'));var jsforce=require(_0xe734('0xc'));var deskjs=require(_0xe734('0xd'));var toCsv=require(_0xe734('0xe'));var querystring=require(_0xe734('0xf'));var Papa=require(_0xe734('0x10'));var Redis=require('ioredis');var authService=require(_0xe734('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe734('0x12'));var hardwareService=require(_0xe734('0x13'));var logger=require(_0xe734('0x14'))(_0xe734('0x15'));var utils=require('../../config/utils');var config=require(_0xe734('0x16'));var licenseUtil=require(_0xe734('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e7c75,_0x1c342e){_0x1c342e=_0x1c342e||0xcc;return function(_0x36c518){if(_0x36c518){return _0x5e7c75[_0xe734('0x18')](_0x1c342e);}return _0x5e7c75[_0xe734('0x19')](_0x1c342e)[_0xe734('0x1a')]();};}function respondWithResult(_0x21e3a5,_0x1178b5){_0x1178b5=_0x1178b5||0xc8;return function(_0x2631f4){if(_0x2631f4){return _0x21e3a5[_0xe734('0x19')](_0x1178b5)[_0xe734('0x1b')](_0x2631f4);}};}function respondWithFilteredResult(_0x428671,_0x5be318){return function(_0x4d2690){if(_0x4d2690){var _0xa73ccd=typeof _0x5be318['offset']===_0xe734('0x1c')&&typeof _0x5be318[_0xe734('0x1d')]===_0xe734('0x1c');var _0x507d2a=_0x4d2690['count'];var _0xaf4f95=_0xa73ccd?0x0:_0x5be318['offset'];var _0x4291ab=_0xa73ccd?_0x4d2690[_0xe734('0x1e')]:_0x5be318[_0xe734('0x1f')]+_0x5be318[_0xe734('0x1d')];var _0x29930c;if(_0x4291ab>=_0x507d2a){_0x4291ab=_0x507d2a;_0x29930c=0xc8;}else{_0x29930c=0xce;}_0x428671[_0xe734('0x19')](_0x29930c);return _0x428671[_0xe734('0x20')](_0xe734('0x21'),_0xaf4f95+'-'+_0x4291ab+'/'+_0x507d2a)[_0xe734('0x1b')](_0x4d2690);}return null;};}function patchUpdates(_0x5191c8){return function(_0x507dc0){try{jsonpatch['apply'](_0x507dc0,_0x5191c8,!![]);}catch(_0x2dd95f){return BPromise[_0xe734('0x22')](_0x2dd95f);}return _0x507dc0[_0xe734('0x23')]();};}function saveUpdates(_0x30c315,_0xc2b02){return function(_0x2b8721){if(_0x2b8721){return _0x2b8721['update'](_0x30c315)['then'](function(_0x5be503){return _0x5be503;});}return null;};}function removeEntity(_0x52d408,_0x110c50){return function(_0xeae0b3){if(_0xeae0b3){return _0xeae0b3['destroy']()[_0xe734('0x24')](function(){_0x52d408[_0xe734('0x19')](0xcc)[_0xe734('0x1a')]();});}};}function handleEntityNotFound(_0x4857d9,_0x15ee02){return function(_0x1fb0eb){if(!_0x1fb0eb){_0x4857d9['sendStatus'](0x194);}return _0x1fb0eb;};}function handleError(_0x4d1d96,_0x165250){_0x165250=_0x165250||0x1f4;return function(_0x1a6a3a){logger[_0xe734('0x25')](_0x1a6a3a[_0xe734('0x26')]);if(_0x1a6a3a[_0xe734('0x27')]){delete _0x1a6a3a[_0xe734('0x27')];}_0x4d1d96[_0xe734('0x19')](_0x165250)['send'](_0x1a6a3a);};}exports[_0xe734('0x28')]=function(_0x57dec1,_0xabe4e2){var _0x2b2b4d={},_0x365e06={},_0x1f28d9={'count':0x0,'rows':[]};var _0x47a71a=_[_0xe734('0x29')](db[_0xe734('0x2a')]['rawAttributes'],function(_0x81949b){return{'name':_0x81949b['fieldName'],'type':_0x81949b[_0xe734('0x2b')]['key']};});_0x365e06[_0xe734('0x2c')]=_['map'](_0x47a71a,'name');_0x365e06[_0xe734('0x2d')]=_[_0xe734('0x2e')](_0x57dec1[_0xe734('0x2d')]);_0x365e06[_0xe734('0x2f')]=_['intersection'](_0x365e06['model'],_0x365e06[_0xe734('0x2d')]);_0x2b2b4d[_0xe734('0x30')]=_[_0xe734('0x31')](_0x365e06[_0xe734('0x2c')],qs[_0xe734('0x32')](_0x57dec1['query'][_0xe734('0x32')]));_0x2b2b4d[_0xe734('0x30')]=_0x2b2b4d['attributes'][_0xe734('0x33')]?_0x2b2b4d[_0xe734('0x30')]:_0x365e06[_0xe734('0x2c')];if(!_0x57dec1[_0xe734('0x2d')][_0xe734('0x34')]('nolimit')){_0x2b2b4d[_0xe734('0x1d')]=qs['limit'](_0x57dec1[_0xe734('0x2d')][_0xe734('0x1d')]);_0x2b2b4d[_0xe734('0x1f')]=qs['offset'](_0x57dec1[_0xe734('0x2d')][_0xe734('0x1f')]);}_0x2b2b4d[_0xe734('0x35')]=qs[_0xe734('0x36')](_0x57dec1[_0xe734('0x2d')][_0xe734('0x36')]);_0x2b2b4d[_0xe734('0x37')]=qs[_0xe734('0x2f')](_['pick'](_0x57dec1[_0xe734('0x2d')],_0x365e06[_0xe734('0x2f')]),_0x47a71a);if(_0x57dec1[_0xe734('0x2d')][_0xe734('0x38')]){_0x2b2b4d[_0xe734('0x37')]=_[_0xe734('0x39')](_0x2b2b4d['where'],{'$or':_[_0xe734('0x29')](_0x47a71a,function(_0x3cb9ac){if(_0x3cb9ac[_0xe734('0x2b')]!==_0xe734('0x3a')){var _0x3203a8={};_0x3203a8[_0x3cb9ac[_0xe734('0x27')]]={'$like':'%'+_0x57dec1[_0xe734('0x2d')][_0xe734('0x38')]+'%'};return _0x3203a8;}})});}_0x2b2b4d=_[_0xe734('0x39')]({},_0x2b2b4d,_0x57dec1[_0xe734('0x3b')]);var _0x554dbb={'where':_0x2b2b4d[_0xe734('0x37')]};return db[_0xe734('0x2a')][_0xe734('0x1e')](_0x554dbb)['then'](function(_0x5f487a){_0x1f28d9['count']=_0x5f487a;if(_0x57dec1[_0xe734('0x2d')][_0xe734('0x3c')]){_0x2b2b4d[_0xe734('0x3d')]=[{'all':!![]}];}return db[_0xe734('0x2a')][_0xe734('0x3e')](_0x2b2b4d);})[_0xe734('0x24')](function(_0x528580){_0x1f28d9[_0xe734('0x3f')]=_0x528580;return _0x1f28d9;})['then'](respondWithFilteredResult(_0xabe4e2,_0x2b2b4d))[_0xe734('0x40')](handleError(_0xabe4e2,null));};exports[_0xe734('0x41')]=function(_0x5c5ca4,_0x47e3df){var _0x2d8ee4={'raw':![],'where':{'id':_0x5c5ca4[_0xe734('0x42')]['id']}},_0x5b0b7e={};_0x5b0b7e[_0xe734('0x2c')]=_[_0xe734('0x2e')](db[_0xe734('0x2a')][_0xe734('0x43')]);_0x5b0b7e[_0xe734('0x2d')]=_['keys'](_0x5c5ca4[_0xe734('0x2d')]);_0x5b0b7e['filters']=_[_0xe734('0x31')](_0x5b0b7e['model'],_0x5b0b7e[_0xe734('0x2d')]);_0x2d8ee4['attributes']=_[_0xe734('0x31')](_0x5b0b7e[_0xe734('0x2c')],qs[_0xe734('0x32')](_0x5c5ca4['query'][_0xe734('0x32')]));_0x2d8ee4[_0xe734('0x30')]=_0x2d8ee4[_0xe734('0x30')][_0xe734('0x33')]?_0x2d8ee4['attributes']:_0x5b0b7e['model'];if(_0x5c5ca4[_0xe734('0x2d')][_0xe734('0x3c')]){_0x2d8ee4[_0xe734('0x3d')]=[{'all':!![]}];}_0x2d8ee4=_[_0xe734('0x39')]({},_0x2d8ee4,_0x5c5ca4['options']);return db[_0xe734('0x2a')][_0xe734('0x44')](_0x2d8ee4)[_0xe734('0x24')](handleEntityNotFound(_0x47e3df,null))[_0xe734('0x24')](respondWithResult(_0x47e3df,null))[_0xe734('0x40')](handleError(_0x47e3df,null));};exports[_0xe734('0x45')]=function(_0x4f00b4,_0x481ef7){return db[_0xe734('0x2a')]['create'](_0x4f00b4['body'],{})[_0xe734('0x24')](respondWithResult(_0x481ef7,0xc9))[_0xe734('0x40')](handleError(_0x481ef7,null));};exports[_0xe734('0x46')]=function(_0x58e972,_0x3b0255){if(_0x58e972[_0xe734('0x47')]['id']){delete _0x58e972['body']['id'];}return db[_0xe734('0x2a')][_0xe734('0x44')]({'where':{'id':_0x58e972[_0xe734('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b0255,null))[_0xe734('0x24')](saveUpdates(_0x58e972['body'],null))[_0xe734('0x24')](respondWithResult(_0x3b0255,null))[_0xe734('0x40')](handleError(_0x3b0255,null));};exports['destroy']=function(_0x3626b6,_0x9cc973){return db['ServicenowConfiguration'][_0xe734('0x44')]({'where':{'id':_0x3626b6['params']['id']}})['then'](handleEntityNotFound(_0x9cc973,null))[_0xe734('0x24')](removeEntity(_0x9cc973,null))[_0xe734('0x40')](handleError(_0x9cc973,null));};exports[_0xe734('0x48')]=function(_0x37f5ed,_0x41813c,_0x15fd52){var _0x25d4e1={};var _0x5e2aba={};var _0x23c16c;var _0x350301;return db['ServicenowConfiguration'][_0xe734('0x49')]({'where':{'id':_0x37f5ed[_0xe734('0x42')]['id']}})[_0xe734('0x24')](handleEntityNotFound(_0x41813c,null))[_0xe734('0x24')](function(_0x1d3f10){if(_0x1d3f10){_0x23c16c=_0x1d3f10;_0x5e2aba[_0xe734('0x2c')]=_[_0xe734('0x2e')](db[_0xe734('0x4a')][_0xe734('0x43')]);_0x5e2aba[_0xe734('0x2d')]=_['keys'](_0x37f5ed['query']);_0x5e2aba[_0xe734('0x2f')]=_['intersection'](_0x5e2aba['model'],_0x5e2aba[_0xe734('0x2d')]);_0x25d4e1['attributes']=_[_0xe734('0x31')](_0x5e2aba[_0xe734('0x2c')],qs[_0xe734('0x32')](_0x37f5ed[_0xe734('0x2d')]['fields']));_0x25d4e1[_0xe734('0x30')]=_0x25d4e1['attributes'][_0xe734('0x33')]?_0x25d4e1[_0xe734('0x30')]:_0x5e2aba['model'];_0x25d4e1[_0xe734('0x35')]=qs[_0xe734('0x36')](_0x37f5ed[_0xe734('0x2d')][_0xe734('0x36')]);_0x25d4e1[_0xe734('0x37')]=qs['filters'](_[_0xe734('0x4b')](_0x37f5ed['query'],_0x5e2aba['filters']));if(_0x37f5ed[_0xe734('0x2d')]['filter']){_0x25d4e1[_0xe734('0x37')]=_[_0xe734('0x39')](_0x25d4e1[_0xe734('0x37')],{'$or':_[_0xe734('0x29')](_0x25d4e1[_0xe734('0x30')],function(_0x39425d){var _0x453862={};_0x453862[_0x39425d]={'$like':'%'+_0x37f5ed[_0xe734('0x2d')][_0xe734('0x38')]+'%'};return _0x453862;})});}_0x25d4e1=_[_0xe734('0x39')]({},_0x25d4e1,_0x37f5ed['options']);return _0x23c16c['getFields'](_0x25d4e1);}})[_0xe734('0x24')](function(_0x46652c){if(_0x46652c){_0x350301=_0x46652c[_0xe734('0x33')];if(!_0x37f5ed[_0xe734('0x2d')][_0xe734('0x34')](_0xe734('0x4c'))){_0x25d4e1[_0xe734('0x1d')]=qs[_0xe734('0x1d')](_0x37f5ed['query'][_0xe734('0x1d')]);_0x25d4e1[_0xe734('0x1f')]=qs[_0xe734('0x1f')](_0x37f5ed[_0xe734('0x2d')][_0xe734('0x1f')]);}return _0x23c16c[_0xe734('0x48')](_0x25d4e1);}})[_0xe734('0x24')](function(_0x21538e){if(_0x21538e){return _0x21538e?{'count':_0x350301,'rows':_0x21538e}:null;}})[_0xe734('0x24')](respondWithResult(_0x41813c,null))[_0xe734('0x40')](handleError(_0x41813c,null));};exports[_0xe734('0x4d')]=function(_0x377478,_0xf8990f,_0x28b200){var _0x2da4bf={};var _0x259908={};var _0xf48b6d;var _0x358318;return db[_0xe734('0x2a')][_0xe734('0x49')]({'where':{'id':_0x377478['params']['id']}})['then'](handleEntityNotFound(_0xf8990f,null))[_0xe734('0x24')](function(_0x1b4e17){if(_0x1b4e17){_0xf48b6d=_0x1b4e17;_0x259908[_0xe734('0x2c')]=_[_0xe734('0x2e')](db[_0xe734('0x4a')]['rawAttributes']);_0x259908[_0xe734('0x2d')]=_[_0xe734('0x2e')](_0x377478[_0xe734('0x2d')]);_0x259908['filters']=_['intersection'](_0x259908['model'],_0x259908['query']);_0x2da4bf[_0xe734('0x30')]=_[_0xe734('0x31')](_0x259908[_0xe734('0x2c')],qs[_0xe734('0x32')](_0x377478[_0xe734('0x2d')][_0xe734('0x32')]));_0x2da4bf[_0xe734('0x30')]=_0x2da4bf[_0xe734('0x30')][_0xe734('0x33')]?_0x2da4bf[_0xe734('0x30')]:_0x259908['model'];_0x2da4bf[_0xe734('0x35')]=qs[_0xe734('0x36')](_0x377478[_0xe734('0x2d')][_0xe734('0x36')]);_0x2da4bf[_0xe734('0x37')]=qs['filters'](_['pick'](_0x377478[_0xe734('0x2d')],_0x259908[_0xe734('0x2f')]));if(_0x377478[_0xe734('0x2d')][_0xe734('0x38')]){_0x2da4bf[_0xe734('0x37')]=_[_0xe734('0x39')](_0x2da4bf[_0xe734('0x37')],{'$or':_[_0xe734('0x29')](_0x2da4bf['attributes'],function(_0x4e2dce){var _0x32b5d4={};_0x32b5d4[_0x4e2dce]={'$like':'%'+_0x377478[_0xe734('0x2d')]['filter']+'%'};return _0x32b5d4;})});}_0x2da4bf=_[_0xe734('0x39')]({},_0x2da4bf,_0x377478[_0xe734('0x3b')]);return _0xf48b6d[_0xe734('0x4d')](_0x2da4bf);}})[_0xe734('0x24')](function(_0x529dc7){if(_0x529dc7){_0x358318=_0x529dc7[_0xe734('0x33')];if(!_0x377478[_0xe734('0x2d')][_0xe734('0x34')](_0xe734('0x4c'))){_0x2da4bf[_0xe734('0x1d')]=qs[_0xe734('0x1d')](_0x377478[_0xe734('0x2d')][_0xe734('0x1d')]);_0x2da4bf[_0xe734('0x1f')]=qs['offset'](_0x377478[_0xe734('0x2d')][_0xe734('0x1f')]);}return _0xf48b6d[_0xe734('0x4d')](_0x2da4bf);}})[_0xe734('0x24')](function(_0x3ef09e){if(_0x3ef09e){return _0x3ef09e?{'count':_0x358318,'rows':_0x3ef09e}:null;}})[_0xe734('0x24')](respondWithResult(_0xf8990f,null))[_0xe734('0x40')](handleError(_0xf8990f,null));};exports[_0xe734('0x4e')]=function(_0x44e937,_0x306020,_0x77393b){var _0x345eb2={};var _0x504f84={};var _0x507dbf;var _0x466353;return db['ServicenowConfiguration'][_0xe734('0x49')]({'where':{'id':_0x44e937[_0xe734('0x42')]['id']}})[_0xe734('0x24')](handleEntityNotFound(_0x306020,null))[_0xe734('0x24')](function(_0x491c0a){if(_0x491c0a){_0x507dbf=_0x491c0a;_0x504f84[_0xe734('0x2c')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x504f84['query']=_[_0xe734('0x2e')](_0x44e937[_0xe734('0x2d')]);_0x504f84[_0xe734('0x2f')]=_['intersection'](_0x504f84[_0xe734('0x2c')],_0x504f84[_0xe734('0x2d')]);_0x345eb2[_0xe734('0x30')]=_[_0xe734('0x31')](_0x504f84[_0xe734('0x2c')],qs[_0xe734('0x32')](_0x44e937[_0xe734('0x2d')][_0xe734('0x32')]));_0x345eb2['attributes']=_0x345eb2[_0xe734('0x30')][_0xe734('0x33')]?_0x345eb2[_0xe734('0x30')]:_0x504f84[_0xe734('0x2c')];_0x345eb2[_0xe734('0x35')]=qs[_0xe734('0x36')](_0x44e937[_0xe734('0x2d')][_0xe734('0x36')]);_0x345eb2['where']=qs[_0xe734('0x2f')](_['pick'](_0x44e937['query'],_0x504f84[_0xe734('0x2f')]));if(_0x44e937[_0xe734('0x2d')]['filter']){_0x345eb2[_0xe734('0x37')]=_[_0xe734('0x39')](_0x345eb2[_0xe734('0x37')],{'$or':_[_0xe734('0x29')](_0x345eb2['attributes'],function(_0x2811c0){var _0x37c8ab={};_0x37c8ab[_0x2811c0]={'$like':'%'+_0x44e937[_0xe734('0x2d')][_0xe734('0x38')]+'%'};return _0x37c8ab;})});}_0x345eb2=_[_0xe734('0x39')]({},_0x345eb2,_0x44e937[_0xe734('0x3b')]);return _0x507dbf[_0xe734('0x4e')](_0x345eb2);}})[_0xe734('0x24')](function(_0x2c6cae){if(_0x2c6cae){_0x466353=_0x2c6cae[_0xe734('0x33')];if(!_0x44e937[_0xe734('0x2d')]['hasOwnProperty'](_0xe734('0x4c'))){_0x345eb2[_0xe734('0x1d')]=qs['limit'](_0x44e937[_0xe734('0x2d')][_0xe734('0x1d')]);_0x345eb2['offset']=qs['offset'](_0x44e937[_0xe734('0x2d')][_0xe734('0x1f')]);}return _0x507dbf['getDescriptions'](_0x345eb2);}})[_0xe734('0x24')](function(_0x17245a){if(_0x17245a){return _0x17245a?{'count':_0x466353,'rows':_0x17245a}:null;}})[_0xe734('0x24')](respondWithResult(_0x306020,null))[_0xe734('0x40')](handleError(_0x306020,null));}; \ No newline at end of file +var _0xd495=['apply','reject','save','update','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','then','includeAll','include','findAll','catch','show','keys','find','create','body','params','destroy','getFields','getSubjects','findOne','ServicenowField','getDescriptions','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xd495,0x7f));var _0x5d49=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0xd495[_0x5df61d];return _0x24cc4c;};'use strict';var emlformat=require(_0x5d49('0x0'));var rimraf=require(_0x5d49('0x1'));var zipdir=require(_0x5d49('0x2'));var jsonpatch=require(_0x5d49('0x3'));var rp=require(_0x5d49('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d49('0x5'));var util=require(_0x5d49('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5d49('0x7'));var fs=require('fs');var fs_extra=require(_0x5d49('0x8'));var _=require(_0x5d49('0x9'));var squel=require(_0x5d49('0xa'));var crypto=require(_0x5d49('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5d49('0xc'));var toCsv=require(_0x5d49('0xd'));var querystring=require(_0x5d49('0xe'));var Papa=require(_0x5d49('0xf'));var Redis=require(_0x5d49('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d49('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d49('0x12'))('api');var utils=require(_0x5d49('0x13'));var config=require(_0x5d49('0x14'));var licenseUtil=require(_0x5d49('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1da3c0,_0x51b60a){_0x51b60a=_0x51b60a||0xcc;return function(_0xb60bba){if(_0xb60bba){return _0x1da3c0[_0x5d49('0x16')](_0x51b60a);}return _0x1da3c0['status'](_0x51b60a)[_0x5d49('0x17')]();};}function respondWithResult(_0x179f0f,_0x61dee8){_0x61dee8=_0x61dee8||0xc8;return function(_0x371f59){if(_0x371f59){return _0x179f0f[_0x5d49('0x18')](_0x61dee8)[_0x5d49('0x19')](_0x371f59);}};}function respondWithFilteredResult(_0x22787b,_0x3ebf43){return function(_0x1e2eed){if(_0x1e2eed){var _0x128ddf=typeof _0x3ebf43[_0x5d49('0x1a')]===_0x5d49('0x1b')&&typeof _0x3ebf43[_0x5d49('0x1c')]===_0x5d49('0x1b');var _0x2b45c1=_0x1e2eed[_0x5d49('0x1d')];var _0x361d76=_0x128ddf?0x0:_0x3ebf43[_0x5d49('0x1a')];var _0x3fb8ab=_0x128ddf?_0x1e2eed[_0x5d49('0x1d')]:_0x3ebf43[_0x5d49('0x1a')]+_0x3ebf43['limit'];var _0x5a8e1f;if(_0x3fb8ab>=_0x2b45c1){_0x3fb8ab=_0x2b45c1;_0x5a8e1f=0xc8;}else{_0x5a8e1f=0xce;}_0x22787b[_0x5d49('0x18')](_0x5a8e1f);return _0x22787b[_0x5d49('0x1e')]('Content-Range',_0x361d76+'-'+_0x3fb8ab+'/'+_0x2b45c1)[_0x5d49('0x19')](_0x1e2eed);}return null;};}function patchUpdates(_0xcb5907){return function(_0xffc08c){try{jsonpatch[_0x5d49('0x1f')](_0xffc08c,_0xcb5907,!![]);}catch(_0xd96494){return BPromise[_0x5d49('0x20')](_0xd96494);}return _0xffc08c[_0x5d49('0x21')]();};}function saveUpdates(_0x20d3ce,_0x1a279e){return function(_0x160a65){if(_0x160a65){return _0x160a65[_0x5d49('0x22')](_0x20d3ce)['then'](function(_0x40c61e){return _0x40c61e;});}return null;};}function removeEntity(_0x219292,_0x3e5194){return function(_0x25f870){if(_0x25f870){return _0x25f870['destroy']()['then'](function(){_0x219292[_0x5d49('0x18')](0xcc)[_0x5d49('0x17')]();});}};}function handleEntityNotFound(_0x4dc78b,_0x3d203c){return function(_0x550bfa){if(!_0x550bfa){_0x4dc78b[_0x5d49('0x16')](0x194);}return _0x550bfa;};}function handleError(_0x3f8c10,_0x1d7389){_0x1d7389=_0x1d7389||0x1f4;return function(_0x349741){logger[_0x5d49('0x23')](_0x349741[_0x5d49('0x24')]);if(_0x349741['name']){delete _0x349741[_0x5d49('0x25')];}_0x3f8c10[_0x5d49('0x18')](_0x1d7389)[_0x5d49('0x26')](_0x349741);};}exports[_0x5d49('0x27')]=function(_0x4a6a3a,_0x46d9fb){var _0x30c9ec={},_0x336de3={},_0x4b3ac5={'count':0x0,'rows':[]};var _0x25dc7c=_[_0x5d49('0x28')](db[_0x5d49('0x29')][_0x5d49('0x2a')],function(_0x2b6a4b){return{'name':_0x2b6a4b[_0x5d49('0x2b')],'type':_0x2b6a4b[_0x5d49('0x2c')][_0x5d49('0x2d')]};});_0x336de3[_0x5d49('0x2e')]=_[_0x5d49('0x28')](_0x25dc7c,_0x5d49('0x25'));_0x336de3[_0x5d49('0x2f')]=_['keys'](_0x4a6a3a[_0x5d49('0x2f')]);_0x336de3['filters']=_[_0x5d49('0x30')](_0x336de3[_0x5d49('0x2e')],_0x336de3[_0x5d49('0x2f')]);_0x30c9ec['attributes']=_[_0x5d49('0x30')](_0x336de3[_0x5d49('0x2e')],qs[_0x5d49('0x31')](_0x4a6a3a[_0x5d49('0x2f')]['fields']));_0x30c9ec[_0x5d49('0x32')]=_0x30c9ec[_0x5d49('0x32')][_0x5d49('0x33')]?_0x30c9ec[_0x5d49('0x32')]:_0x336de3[_0x5d49('0x2e')];if(!_0x4a6a3a[_0x5d49('0x2f')][_0x5d49('0x34')](_0x5d49('0x35'))){_0x30c9ec[_0x5d49('0x1c')]=qs[_0x5d49('0x1c')](_0x4a6a3a['query'][_0x5d49('0x1c')]);_0x30c9ec['offset']=qs['offset'](_0x4a6a3a[_0x5d49('0x2f')][_0x5d49('0x1a')]);}_0x30c9ec[_0x5d49('0x36')]=qs['sort'](_0x4a6a3a[_0x5d49('0x2f')][_0x5d49('0x37')]);_0x30c9ec[_0x5d49('0x38')]=qs[_0x5d49('0x39')](_['pick'](_0x4a6a3a['query'],_0x336de3[_0x5d49('0x39')]),_0x25dc7c);if(_0x4a6a3a[_0x5d49('0x2f')][_0x5d49('0x3a')]){_0x30c9ec[_0x5d49('0x38')]=_[_0x5d49('0x3b')](_0x30c9ec[_0x5d49('0x38')],{'$or':_[_0x5d49('0x28')](_0x25dc7c,function(_0x314095){if(_0x314095['type']!=='VIRTUAL'){var _0x208fb7={};_0x208fb7[_0x314095[_0x5d49('0x25')]]={'$like':'%'+_0x4a6a3a[_0x5d49('0x2f')]['filter']+'%'};return _0x208fb7;}})});}_0x30c9ec=_[_0x5d49('0x3b')]({},_0x30c9ec,_0x4a6a3a[_0x5d49('0x3c')]);var _0x4cd907={'where':_0x30c9ec[_0x5d49('0x38')]};return db['ServicenowConfiguration'][_0x5d49('0x1d')](_0x4cd907)[_0x5d49('0x3d')](function(_0x10e8b8){_0x4b3ac5[_0x5d49('0x1d')]=_0x10e8b8;if(_0x4a6a3a['query'][_0x5d49('0x3e')]){_0x30c9ec[_0x5d49('0x3f')]=[{'all':!![]}];}return db[_0x5d49('0x29')][_0x5d49('0x40')](_0x30c9ec);})[_0x5d49('0x3d')](function(_0x1c6770){_0x4b3ac5['rows']=_0x1c6770;return _0x4b3ac5;})[_0x5d49('0x3d')](respondWithFilteredResult(_0x46d9fb,_0x30c9ec))[_0x5d49('0x41')](handleError(_0x46d9fb,null));};exports[_0x5d49('0x42')]=function(_0x47aad3,_0x15a95e){var _0x260fd9={'raw':![],'where':{'id':_0x47aad3['params']['id']}},_0x57a132={};_0x57a132[_0x5d49('0x2e')]=_[_0x5d49('0x43')](db['ServicenowConfiguration'][_0x5d49('0x2a')]);_0x57a132[_0x5d49('0x2f')]=_[_0x5d49('0x43')](_0x47aad3[_0x5d49('0x2f')]);_0x57a132[_0x5d49('0x39')]=_[_0x5d49('0x30')](_0x57a132[_0x5d49('0x2e')],_0x57a132[_0x5d49('0x2f')]);_0x260fd9['attributes']=_['intersection'](_0x57a132[_0x5d49('0x2e')],qs[_0x5d49('0x31')](_0x47aad3[_0x5d49('0x2f')]['fields']));_0x260fd9[_0x5d49('0x32')]=_0x260fd9[_0x5d49('0x32')][_0x5d49('0x33')]?_0x260fd9[_0x5d49('0x32')]:_0x57a132[_0x5d49('0x2e')];if(_0x47aad3['query'][_0x5d49('0x3e')]){_0x260fd9[_0x5d49('0x3f')]=[{'all':!![]}];}_0x260fd9=_[_0x5d49('0x3b')]({},_0x260fd9,_0x47aad3['options']);return db[_0x5d49('0x29')][_0x5d49('0x44')](_0x260fd9)[_0x5d49('0x3d')](handleEntityNotFound(_0x15a95e,null))['then'](respondWithResult(_0x15a95e,null))[_0x5d49('0x41')](handleError(_0x15a95e,null));};exports[_0x5d49('0x45')]=function(_0x4f1df9,_0x491ca1){return db['ServicenowConfiguration'][_0x5d49('0x45')](_0x4f1df9[_0x5d49('0x46')],{})[_0x5d49('0x3d')](respondWithResult(_0x491ca1,0xc9))[_0x5d49('0x41')](handleError(_0x491ca1,null));};exports['update']=function(_0x53bc16,_0x317446){if(_0x53bc16['body']['id']){delete _0x53bc16['body']['id'];}return db[_0x5d49('0x29')][_0x5d49('0x44')]({'where':{'id':_0x53bc16[_0x5d49('0x47')]['id']}})['then'](handleEntityNotFound(_0x317446,null))['then'](saveUpdates(_0x53bc16[_0x5d49('0x46')],null))[_0x5d49('0x3d')](respondWithResult(_0x317446,null))['catch'](handleError(_0x317446,null));};exports[_0x5d49('0x48')]=function(_0x492fb7,_0x2caa1c){return db[_0x5d49('0x29')][_0x5d49('0x44')]({'where':{'id':_0x492fb7[_0x5d49('0x47')]['id']}})[_0x5d49('0x3d')](handleEntityNotFound(_0x2caa1c,null))[_0x5d49('0x3d')](removeEntity(_0x2caa1c,null))[_0x5d49('0x41')](handleError(_0x2caa1c,null));};exports[_0x5d49('0x49')]=function(_0xb459bc,_0x4df8b1,_0xfa1198){var _0x37f5d1={};var _0x591f58={};var _0x170abd;var _0x1ac432;return db[_0x5d49('0x29')]['findOne']({'where':{'id':_0xb459bc[_0x5d49('0x47')]['id']}})['then'](handleEntityNotFound(_0x4df8b1,null))['then'](function(_0x5e2ad6){if(_0x5e2ad6){_0x170abd=_0x5e2ad6;_0x591f58['model']=_[_0x5d49('0x43')](db['ServicenowField'][_0x5d49('0x2a')]);_0x591f58['query']=_[_0x5d49('0x43')](_0xb459bc[_0x5d49('0x2f')]);_0x591f58[_0x5d49('0x39')]=_[_0x5d49('0x30')](_0x591f58['model'],_0x591f58['query']);_0x37f5d1[_0x5d49('0x32')]=_[_0x5d49('0x30')](_0x591f58[_0x5d49('0x2e')],qs[_0x5d49('0x31')](_0xb459bc[_0x5d49('0x2f')][_0x5d49('0x31')]));_0x37f5d1[_0x5d49('0x32')]=_0x37f5d1[_0x5d49('0x32')][_0x5d49('0x33')]?_0x37f5d1[_0x5d49('0x32')]:_0x591f58[_0x5d49('0x2e')];_0x37f5d1['order']=qs['sort'](_0xb459bc[_0x5d49('0x2f')][_0x5d49('0x37')]);_0x37f5d1[_0x5d49('0x38')]=qs[_0x5d49('0x39')](_['pick'](_0xb459bc['query'],_0x591f58[_0x5d49('0x39')]));if(_0xb459bc['query'][_0x5d49('0x3a')]){_0x37f5d1[_0x5d49('0x38')]=_[_0x5d49('0x3b')](_0x37f5d1[_0x5d49('0x38')],{'$or':_[_0x5d49('0x28')](_0x37f5d1[_0x5d49('0x32')],function(_0x1d4b68){var _0x34a1e6={};_0x34a1e6[_0x1d4b68]={'$like':'%'+_0xb459bc[_0x5d49('0x2f')][_0x5d49('0x3a')]+'%'};return _0x34a1e6;})});}_0x37f5d1=_['merge']({},_0x37f5d1,_0xb459bc[_0x5d49('0x3c')]);return _0x170abd[_0x5d49('0x49')](_0x37f5d1);}})['then'](function(_0x1d4bb5){if(_0x1d4bb5){_0x1ac432=_0x1d4bb5['length'];if(!_0xb459bc[_0x5d49('0x2f')][_0x5d49('0x34')](_0x5d49('0x35'))){_0x37f5d1['limit']=qs[_0x5d49('0x1c')](_0xb459bc[_0x5d49('0x2f')][_0x5d49('0x1c')]);_0x37f5d1['offset']=qs[_0x5d49('0x1a')](_0xb459bc[_0x5d49('0x2f')][_0x5d49('0x1a')]);}return _0x170abd[_0x5d49('0x49')](_0x37f5d1);}})['then'](function(_0x4e2075){if(_0x4e2075){return _0x4e2075?{'count':_0x1ac432,'rows':_0x4e2075}:null;}})[_0x5d49('0x3d')](respondWithResult(_0x4df8b1,null))['catch'](handleError(_0x4df8b1,null));};exports[_0x5d49('0x4a')]=function(_0x7ccfce,_0x5ee13a,_0x4f6ef2){var _0xcd0fed={};var _0x176caf={};var _0x473ebc;var _0x22ac24;return db[_0x5d49('0x29')][_0x5d49('0x4b')]({'where':{'id':_0x7ccfce[_0x5d49('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ee13a,null))[_0x5d49('0x3d')](function(_0x27c201){if(_0x27c201){_0x473ebc=_0x27c201;_0x176caf[_0x5d49('0x2e')]=_[_0x5d49('0x43')](db[_0x5d49('0x4c')][_0x5d49('0x2a')]);_0x176caf[_0x5d49('0x2f')]=_[_0x5d49('0x43')](_0x7ccfce[_0x5d49('0x2f')]);_0x176caf['filters']=_[_0x5d49('0x30')](_0x176caf[_0x5d49('0x2e')],_0x176caf[_0x5d49('0x2f')]);_0xcd0fed[_0x5d49('0x32')]=_['intersection'](_0x176caf['model'],qs[_0x5d49('0x31')](_0x7ccfce[_0x5d49('0x2f')][_0x5d49('0x31')]));_0xcd0fed['attributes']=_0xcd0fed[_0x5d49('0x32')]['length']?_0xcd0fed['attributes']:_0x176caf[_0x5d49('0x2e')];_0xcd0fed['order']=qs[_0x5d49('0x37')](_0x7ccfce[_0x5d49('0x2f')][_0x5d49('0x37')]);_0xcd0fed[_0x5d49('0x38')]=qs[_0x5d49('0x39')](_['pick'](_0x7ccfce['query'],_0x176caf[_0x5d49('0x39')]));if(_0x7ccfce['query'][_0x5d49('0x3a')]){_0xcd0fed[_0x5d49('0x38')]=_[_0x5d49('0x3b')](_0xcd0fed['where'],{'$or':_[_0x5d49('0x28')](_0xcd0fed[_0x5d49('0x32')],function(_0x4b5e54){var _0x139998={};_0x139998[_0x4b5e54]={'$like':'%'+_0x7ccfce[_0x5d49('0x2f')][_0x5d49('0x3a')]+'%'};return _0x139998;})});}_0xcd0fed=_[_0x5d49('0x3b')]({},_0xcd0fed,_0x7ccfce[_0x5d49('0x3c')]);return _0x473ebc[_0x5d49('0x4a')](_0xcd0fed);}})[_0x5d49('0x3d')](function(_0xb5ef85){if(_0xb5ef85){_0x22ac24=_0xb5ef85[_0x5d49('0x33')];if(!_0x7ccfce[_0x5d49('0x2f')][_0x5d49('0x34')]('nolimit')){_0xcd0fed[_0x5d49('0x1c')]=qs['limit'](_0x7ccfce[_0x5d49('0x2f')][_0x5d49('0x1c')]);_0xcd0fed[_0x5d49('0x1a')]=qs[_0x5d49('0x1a')](_0x7ccfce[_0x5d49('0x2f')][_0x5d49('0x1a')]);}return _0x473ebc['getSubjects'](_0xcd0fed);}})['then'](function(_0x88c7da){if(_0x88c7da){return _0x88c7da?{'count':_0x22ac24,'rows':_0x88c7da}:null;}})[_0x5d49('0x3d')](respondWithResult(_0x5ee13a,null))[_0x5d49('0x41')](handleError(_0x5ee13a,null));};exports[_0x5d49('0x4d')]=function(_0x21ad30,_0x2e4992,_0x42b7e6){var _0x55adda={};var _0x1c5e28={};var _0x3b8065;var _0x4ca092;return db[_0x5d49('0x29')][_0x5d49('0x4b')]({'where':{'id':_0x21ad30[_0x5d49('0x47')]['id']}})[_0x5d49('0x3d')](handleEntityNotFound(_0x2e4992,null))[_0x5d49('0x3d')](function(_0x4143c6){if(_0x4143c6){_0x3b8065=_0x4143c6;_0x1c5e28[_0x5d49('0x2e')]=_[_0x5d49('0x43')](db['ServicenowField'][_0x5d49('0x2a')]);_0x1c5e28[_0x5d49('0x2f')]=_[_0x5d49('0x43')](_0x21ad30['query']);_0x1c5e28['filters']=_[_0x5d49('0x30')](_0x1c5e28[_0x5d49('0x2e')],_0x1c5e28['query']);_0x55adda['attributes']=_[_0x5d49('0x30')](_0x1c5e28[_0x5d49('0x2e')],qs[_0x5d49('0x31')](_0x21ad30['query'][_0x5d49('0x31')]));_0x55adda['attributes']=_0x55adda[_0x5d49('0x32')][_0x5d49('0x33')]?_0x55adda['attributes']:_0x1c5e28[_0x5d49('0x2e')];_0x55adda['order']=qs[_0x5d49('0x37')](_0x21ad30[_0x5d49('0x2f')][_0x5d49('0x37')]);_0x55adda['where']=qs['filters'](_[_0x5d49('0x4e')](_0x21ad30[_0x5d49('0x2f')],_0x1c5e28[_0x5d49('0x39')]));if(_0x21ad30[_0x5d49('0x2f')][_0x5d49('0x3a')]){_0x55adda[_0x5d49('0x38')]=_[_0x5d49('0x3b')](_0x55adda[_0x5d49('0x38')],{'$or':_['map'](_0x55adda[_0x5d49('0x32')],function(_0x94dfe9){var _0x5cba04={};_0x5cba04[_0x94dfe9]={'$like':'%'+_0x21ad30[_0x5d49('0x2f')]['filter']+'%'};return _0x5cba04;})});}_0x55adda=_[_0x5d49('0x3b')]({},_0x55adda,_0x21ad30[_0x5d49('0x3c')]);return _0x3b8065[_0x5d49('0x4d')](_0x55adda);}})[_0x5d49('0x3d')](function(_0x45c773){if(_0x45c773){_0x4ca092=_0x45c773['length'];if(!_0x21ad30[_0x5d49('0x2f')][_0x5d49('0x34')]('nolimit')){_0x55adda[_0x5d49('0x1c')]=qs[_0x5d49('0x1c')](_0x21ad30[_0x5d49('0x2f')][_0x5d49('0x1c')]);_0x55adda[_0x5d49('0x1a')]=qs[_0x5d49('0x1a')](_0x21ad30['query']['offset']);}return _0x3b8065[_0x5d49('0x4d')](_0x55adda);}})['then'](function(_0x50b75f){if(_0x50b75f){return _0x50b75f?{'count':_0x4ca092,'rows':_0x50b75f}:null;}})[_0x5d49('0x3d')](respondWithResult(_0x2e4992,null))[_0x5d49('0x41')](handleError(_0x2e4992,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2b81f63..38eefe5 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 _0xcf66=['exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x401a8e,_0x5b425c){var _0x1e34bd=function(_0x215552){while(--_0x215552){_0x401a8e['push'](_0x401a8e['shift']());}};_0x1e34bd(++_0x5b425c);}(_0xcf66,0x71));var _0x6cf6=function(_0x268230,_0x27471e){_0x268230=_0x268230-0x0;var _0x90f1f7=_0xcf66[_0x268230];return _0x90f1f7;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e1c=['ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var rp=require(_0xc6e1('0x4'));var fs=require('fs');var path=require(_0xc6e1('0x5'));var rimraf=require(_0xc6e1('0x6'));var config=require(_0xc6e1('0x7'));var attributes=require(_0xc6e1('0x8'));module[_0xc6e1('0x9')]=function(_0x3e2d6c,_0x468a80){return _0x3e2d6c['define'](_0xc6e1('0xa'),attributes,{'tableName':_0xc6e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 438ffc8..a7e62ae 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 _0x1d8a=['client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4371cb,_0x8bafe9){var _0x4da4b2=function(_0x28acea){while(--_0x28acea){_0x4371cb['push'](_0x4371cb['shift']());}};_0x4da4b2(++_0x8bafe9);}(_0x1d8a,0x1f1));var _0xa1d8=function(_0x3f5706,_0x27f482){_0x3f5706=_0x3f5706-0x0;var _0x41d11b=_0x1d8a[_0x3f5706];return _0x41d11b;};'use strict';var _=require('lodash');var util=require(_0xa1d8('0x0'));var moment=require(_0xa1d8('0x1'));var BPromise=require(_0xa1d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1d8('0x3'));var db=require(_0xa1d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1d8('0x5'))(_0xa1d8('0x6'));var config=require(_0xa1d8('0x7'));var jayson=require(_0xa1d8('0x8'));var client=jayson[_0xa1d8('0x9')][_0xa1d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37c2c5,_0x5b4502,_0x278fbb){return new BPromise(function(_0x2f3873,_0x29619d){return client[_0xa1d8('0xb')](_0x37c2c5,_0x278fbb)['then'](function(_0x1d50fe){logger[_0xa1d8('0xc')](_0xa1d8('0xd'),_0x5b4502,_0xa1d8('0xe'));logger[_0xa1d8('0xf')](_0xa1d8('0x10'),_0x5b4502,_0xa1d8('0xe'),JSON[_0xa1d8('0x11')](_0x1d50fe));if(_0x1d50fe[_0xa1d8('0x12')]){if(_0x1d50fe[_0xa1d8('0x12')]['code']===0x1f4){logger[_0xa1d8('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b4502,_0x1d50fe['error'][_0xa1d8('0x13')]);return _0x29619d(_0x1d50fe['error'][_0xa1d8('0x13')]);}logger['error'](_0xa1d8('0xd'),_0x5b4502,_0x1d50fe[_0xa1d8('0x12')][_0xa1d8('0x13')]);return _0x2f3873(_0x1d50fe[_0xa1d8('0x12')][_0xa1d8('0x13')]);}else{logger[_0xa1d8('0xc')](_0xa1d8('0xd'),_0x5b4502,_0xa1d8('0xe'));_0x2f3873(_0x1d50fe[_0xa1d8('0x14')][_0xa1d8('0x13')]);}})[_0xa1d8('0x15')](function(_0x46db9a){logger[_0xa1d8('0x12')](_0xa1d8('0xd'),_0x5b4502,_0x46db9a);_0x29619d(_0x46db9a);});});} \ No newline at end of file +var _0x04f2=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x04f2,0x8f));var _0x204f=function(_0x3d23df,_0x2f1ce0){_0x3d23df=_0x3d23df-0x0;var _0x13f824=_0x04f2[_0x3d23df];return _0x13f824;};'use strict';var _=require(_0x204f('0x0'));var util=require('util');var moment=require(_0x204f('0x1'));var BPromise=require(_0x204f('0x2'));var rs=require(_0x204f('0x3'));var fs=require('fs');var Redis=require(_0x204f('0x4'));var db=require(_0x204f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x204f('0x6'))(_0x204f('0x7'));var config=require(_0x204f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x204f('0x9')][_0x204f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43399a,_0x33c57c,_0x330607){return new BPromise(function(_0x19fd98,_0x15699c){return client['request'](_0x43399a,_0x330607)[_0x204f('0xb')](function(_0x4cca13){logger[_0x204f('0xc')](_0x204f('0xd'),_0x33c57c,_0x204f('0xe'));logger[_0x204f('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x33c57c,_0x204f('0xe'),JSON[_0x204f('0x10')](_0x4cca13));if(_0x4cca13[_0x204f('0x11')]){if(_0x4cca13[_0x204f('0x11')][_0x204f('0x12')]===0x1f4){logger[_0x204f('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x33c57c,_0x4cca13['error'][_0x204f('0x13')]);return _0x15699c(_0x4cca13['error']['message']);}logger[_0x204f('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x33c57c,_0x4cca13[_0x204f('0x11')][_0x204f('0x13')]);return _0x19fd98(_0x4cca13['error'][_0x204f('0x13')]);}else{logger['info'](_0x204f('0xd'),_0x33c57c,'request\x20sent');_0x19fd98(_0x4cca13[_0x204f('0x14')][_0x204f('0x13')]);}})[_0x204f('0x15')](function(_0x5066d4){logger['error'](_0x204f('0xd'),_0x33c57c,_0x5066d4);_0x15699c(_0x5066d4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7fc9355..c04c444 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 _0x71b4=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x1d3ae2,_0x2d29b0){var _0xddfee5=function(_0x1714dd){while(--_0x1714dd){_0x1d3ae2['push'](_0x1d3ae2['shift']());}};_0xddfee5(++_0x2d29b0);}(_0x71b4,0x15e));var _0x471b=function(_0xc3aae7,_0x3bfa91){_0xc3aae7=_0xc3aae7-0x0;var _0x1f365a=_0x71b4[_0xc3aae7];return _0x1f365a;};'use strict';var multer=require('multer');var util=require(_0x471b('0x0'));var path=require(_0x471b('0x1'));var timeout=require(_0x471b('0x2'));var express=require(_0x471b('0x3'));var router=express[_0x471b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x471b('0x5'));var interaction=require(_0x471b('0x6'));var config=require(_0x471b('0x7'));var controller=require(_0x471b('0x8'));router[_0x471b('0x9')]('/',auth[_0x471b('0xa')](),controller[_0x471b('0xb')]);router[_0x471b('0x9')](_0x471b('0xc'),auth[_0x471b('0xa')](),controller[_0x471b('0xd')]);router[_0x471b('0xe')]('/',auth[_0x471b('0xa')](),controller[_0x471b('0xf')]);router[_0x471b('0x10')](_0x471b('0xc'),auth[_0x471b('0xa')](),controller['update']);router[_0x471b('0x11')](_0x471b('0xc'),auth['isAuthenticated'](),controller[_0x471b('0x12')]);module[_0x471b('0x13')]=router; \ No newline at end of file +var _0xcca0=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','delete','destroy','exports'];(function(_0x497948,_0x4ca60c){var _0x39bb36=function(_0x2ec88e){while(--_0x2ec88e){_0x497948['push'](_0x497948['shift']());}};_0x39bb36(++_0x4ca60c);}(_0xcca0,0x1cb));var _0x0cca=function(_0x33a17b,_0x4e04ff){_0x33a17b=_0x33a17b-0x0;var _0x57e182=_0xcca0[_0x33a17b];return _0x57e182;};'use strict';var multer=require(_0x0cca('0x0'));var util=require(_0x0cca('0x1'));var path=require('path');var timeout=require(_0x0cca('0x2'));var express=require(_0x0cca('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0cca('0x4'));var interaction=require(_0x0cca('0x5'));var config=require(_0x0cca('0x6'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x0cca('0x7')](),controller[_0x0cca('0x8')]);router[_0x0cca('0x9')](_0x0cca('0xa'),auth[_0x0cca('0x7')](),controller[_0x0cca('0xb')]);router[_0x0cca('0xc')]('/',auth[_0x0cca('0x7')](),controller['create']);router[_0x0cca('0xd')]('/:id',auth[_0x0cca('0x7')](),controller['update']);router[_0x0cca('0xe')](_0x0cca('0xa'),auth[_0x0cca('0x7')](),controller[_0x0cca('0xf')]);module[_0x0cca('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2d8d885..cfc4bfc 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 _0xe99e=['picklist','STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0xe99e,0x1e0));var _0xee99=function(_0x21edb7,_0x360928){_0x21edb7=_0x21edb7-0x0;var _0x20eabc=_0xe99e[_0x21edb7];return _0x20eabc;};'use strict';var Sequelize=require(_0xee99('0x0'));module[_0xee99('0x1')]={'type':{'type':Sequelize['ENUM'](_0xee99('0x2'),_0xee99('0x3'),_0xee99('0x4'),_0xee99('0x5'),_0xee99('0x6')),'defaultValue':_0xee99('0x2')},'content':{'type':Sequelize[_0xee99('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xee99('0x8')](_0xee99('0x2'),_0xee99('0x3'),_0xee99('0x4'))},'keyContent':{'type':Sequelize[_0xee99('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xee99('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee99('0x7')]}}; \ No newline at end of file +var _0xe7f6=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x4cdc72,_0x475299){var _0x327e37=function(_0x1ec22c){while(--_0x1ec22c){_0x4cdc72['push'](_0x4cdc72['shift']());}};_0x327e37(++_0x475299);}(_0xe7f6,0x12a));var _0x6e7f=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xe7f6[_0x4191bc];return _0x1ffd4e;};'use strict';var Sequelize=require(_0x6e7f('0x0'));module[_0x6e7f('0x1')]={'type':{'type':Sequelize[_0x6e7f('0x2')](_0x6e7f('0x3'),_0x6e7f('0x4'),'customVariable',_0x6e7f('0x5'),_0x6e7f('0x6')),'defaultValue':_0x6e7f('0x3')},'content':{'type':Sequelize[_0x6e7f('0x7')]},'key':{'type':Sequelize[_0x6e7f('0x7')]},'keyType':{'type':Sequelize[_0x6e7f('0x2')]('string',_0x6e7f('0x4'),_0x6e7f('0x8'))},'keyContent':{'type':Sequelize[_0x6e7f('0x7')]},'idField':{'type':Sequelize[_0x6e7f('0x7')]},'nameField':{'type':Sequelize[_0x6e7f('0x7')]},'customField':{'type':Sequelize[_0x6e7f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e7f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a4029ae..fa2e562 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 _0x992d=['count','offset','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x44caf2,_0x8ffb16){var _0x25978d=function(_0x1a2e61){while(--_0x1a2e61){_0x44caf2['push'](_0x44caf2['shift']());}};_0x25978d(++_0x8ffb16);}(_0x992d,0x155));var _0xd992=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x992d[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd992('0x0'));var zipdir=require(_0xd992('0x1'));var jsonpatch=require(_0xd992('0x2'));var rp=require(_0xd992('0x3'));var moment=require(_0xd992('0x4'));var BPromise=require(_0xd992('0x5'));var Mustache=require('mustache');var util=require(_0xd992('0x6'));var path=require(_0xd992('0x7'));var sox=require(_0xd992('0x8'));var csv=require(_0xd992('0x9'));var ejs=require(_0xd992('0xa'));var fs=require('fs');var fs_extra=require(_0xd992('0xb'));var _=require('lodash');var squel=require(_0xd992('0xc'));var crypto=require(_0xd992('0xd'));var jsforce=require(_0xd992('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd992('0x9'));var querystring=require('querystring');var Papa=require(_0xd992('0xf'));var Redis=require(_0xd992('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd992('0x11'));var as=require(_0xd992('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd992('0x13'));var config=require(_0xd992('0x14'));var licenseUtil=require(_0xd992('0x15'));var db=require(_0xd992('0x16'))['db'];function respondWithStatusCode(_0x12cf35,_0x57e4a7){_0x57e4a7=_0x57e4a7||0xcc;return function(_0x479f7b){if(_0x479f7b){return _0x12cf35[_0xd992('0x17')](_0x57e4a7);}return _0x12cf35[_0xd992('0x18')](_0x57e4a7)[_0xd992('0x19')]();};}function respondWithResult(_0x356d6a,_0x3d5ce2){_0x3d5ce2=_0x3d5ce2||0xc8;return function(_0x35d635){if(_0x35d635){return _0x356d6a['status'](_0x3d5ce2)[_0xd992('0x1a')](_0x35d635);}};}function respondWithFilteredResult(_0x38d0b1,_0x110536){return function(_0x3d47be){if(_0x3d47be){var _0x3ce8bf=typeof _0x110536['offset']===_0xd992('0x1b')&&typeof _0x110536[_0xd992('0x1c')]===_0xd992('0x1b');var _0xb1a89e=_0x3d47be[_0xd992('0x1d')];var _0x66d813=_0x3ce8bf?0x0:_0x110536['offset'];var _0x13b204=_0x3ce8bf?_0x3d47be['count']:_0x110536[_0xd992('0x1e')]+_0x110536[_0xd992('0x1c')];var _0x24bc10;if(_0x13b204>=_0xb1a89e){_0x13b204=_0xb1a89e;_0x24bc10=0xc8;}else{_0x24bc10=0xce;}_0x38d0b1[_0xd992('0x18')](_0x24bc10);return _0x38d0b1['set']('Content-Range',_0x66d813+'-'+_0x13b204+'/'+_0xb1a89e)[_0xd992('0x1a')](_0x3d47be);}return null;};}function patchUpdates(_0x16990e){return function(_0x566fd0){try{jsonpatch[_0xd992('0x1f')](_0x566fd0,_0x16990e,!![]);}catch(_0x4b5012){return BPromise[_0xd992('0x20')](_0x4b5012);}return _0x566fd0[_0xd992('0x21')]();};}function saveUpdates(_0x402c8d,_0x3402a2){return function(_0x1b93e3){if(_0x1b93e3){return _0x1b93e3[_0xd992('0x22')](_0x402c8d)[_0xd992('0x23')](function(_0x5d1b58){return _0x5d1b58;});}return null;};}function removeEntity(_0x206472,_0x2e2c87){return function(_0x13f132){if(_0x13f132){return _0x13f132[_0xd992('0x24')]()[_0xd992('0x23')](function(){_0x206472[_0xd992('0x18')](0xcc)[_0xd992('0x19')]();});}};}function handleEntityNotFound(_0x367d10,_0x2af40c){return function(_0x10bb22){if(!_0x10bb22){_0x367d10['sendStatus'](0x194);}return _0x10bb22;};}function handleError(_0x20a4ac,_0x59977b){_0x59977b=_0x59977b||0x1f4;return function(_0x55783d){logger[_0xd992('0x25')](_0x55783d[_0xd992('0x26')]);if(_0x55783d['name']){delete _0x55783d[_0xd992('0x27')];}_0x20a4ac[_0xd992('0x18')](_0x59977b)['send'](_0x55783d);};}exports[_0xd992('0x28')]=function(_0x13d174,_0x38ac06){var _0x167ed0={},_0xbaaadd={},_0x56219d={'count':0x0,'rows':[]};var _0x4be83a=_[_0xd992('0x29')](db['ServicenowField'][_0xd992('0x2a')],function(_0x2c7936){return{'name':_0x2c7936[_0xd992('0x2b')],'type':_0x2c7936['type']['key']};});_0xbaaadd[_0xd992('0x2c')]=_['map'](_0x4be83a,_0xd992('0x27'));_0xbaaadd['query']=_['keys'](_0x13d174['query']);_0xbaaadd['filters']=_[_0xd992('0x2d')](_0xbaaadd[_0xd992('0x2c')],_0xbaaadd[_0xd992('0x2e')]);_0x167ed0['attributes']=_[_0xd992('0x2d')](_0xbaaadd['model'],qs[_0xd992('0x2f')](_0x13d174[_0xd992('0x2e')][_0xd992('0x2f')]));_0x167ed0[_0xd992('0x30')]=_0x167ed0[_0xd992('0x30')][_0xd992('0x31')]?_0x167ed0[_0xd992('0x30')]:_0xbaaadd['model'];if(!_0x13d174[_0xd992('0x2e')][_0xd992('0x32')](_0xd992('0x33'))){_0x167ed0[_0xd992('0x1c')]=qs[_0xd992('0x1c')](_0x13d174[_0xd992('0x2e')][_0xd992('0x1c')]);_0x167ed0[_0xd992('0x1e')]=qs[_0xd992('0x1e')](_0x13d174[_0xd992('0x2e')][_0xd992('0x1e')]);}_0x167ed0[_0xd992('0x34')]=qs[_0xd992('0x35')](_0x13d174['query'][_0xd992('0x35')]);_0x167ed0[_0xd992('0x36')]=qs[_0xd992('0x37')](_[_0xd992('0x38')](_0x13d174['query'],_0xbaaadd[_0xd992('0x37')]),_0x4be83a);if(_0x13d174['query'][_0xd992('0x39')]){_0x167ed0[_0xd992('0x36')]=_[_0xd992('0x3a')](_0x167ed0['where'],{'$or':_[_0xd992('0x29')](_0x4be83a,function(_0x1b918f){if(_0x1b918f[_0xd992('0x3b')]!==_0xd992('0x3c')){var _0x30417f={};_0x30417f[_0x1b918f[_0xd992('0x27')]]={'$like':'%'+_0x13d174[_0xd992('0x2e')]['filter']+'%'};return _0x30417f;}})});}_0x167ed0=_[_0xd992('0x3a')]({},_0x167ed0,_0x13d174[_0xd992('0x3d')]);var _0x48549a={'where':_0x167ed0[_0xd992('0x36')]};return db[_0xd992('0x3e')][_0xd992('0x1d')](_0x48549a)['then'](function(_0xfd5187){_0x56219d['count']=_0xfd5187;if(_0x13d174[_0xd992('0x2e')][_0xd992('0x3f')]){_0x167ed0[_0xd992('0x40')]=[{'all':!![]}];}return db[_0xd992('0x3e')][_0xd992('0x41')](_0x167ed0);})[_0xd992('0x23')](function(_0x292186){_0x56219d[_0xd992('0x42')]=_0x292186;return _0x56219d;})['then'](respondWithFilteredResult(_0x38ac06,_0x167ed0))['catch'](handleError(_0x38ac06,null));};exports[_0xd992('0x43')]=function(_0x13d906,_0x3c01fc){var _0x9b7319={'raw':!![],'where':{'id':_0x13d906['params']['id']}},_0x19dc6a={};_0x19dc6a[_0xd992('0x2c')]=_['keys'](db[_0xd992('0x3e')]['rawAttributes']);_0x19dc6a[_0xd992('0x2e')]=_[_0xd992('0x44')](_0x13d906[_0xd992('0x2e')]);_0x19dc6a[_0xd992('0x37')]=_[_0xd992('0x2d')](_0x19dc6a[_0xd992('0x2c')],_0x19dc6a['query']);_0x9b7319['attributes']=_[_0xd992('0x2d')](_0x19dc6a[_0xd992('0x2c')],qs[_0xd992('0x2f')](_0x13d906['query']['fields']));_0x9b7319[_0xd992('0x30')]=_0x9b7319[_0xd992('0x30')][_0xd992('0x31')]?_0x9b7319[_0xd992('0x30')]:_0x19dc6a[_0xd992('0x2c')];if(_0x13d906[_0xd992('0x2e')][_0xd992('0x3f')]){_0x9b7319[_0xd992('0x40')]=[{'all':!![]}];}_0x9b7319=_[_0xd992('0x3a')]({},_0x9b7319,_0x13d906[_0xd992('0x3d')]);return db['ServicenowField'][_0xd992('0x45')](_0x9b7319)['then'](handleEntityNotFound(_0x3c01fc,null))[_0xd992('0x23')](respondWithResult(_0x3c01fc,null))[_0xd992('0x46')](handleError(_0x3c01fc,null));};exports[_0xd992('0x47')]=function(_0x570a6b,_0x3a42ed){return db[_0xd992('0x3e')][_0xd992('0x47')](_0x570a6b[_0xd992('0x48')],{})[_0xd992('0x23')](respondWithResult(_0x3a42ed,0xc9))['catch'](handleError(_0x3a42ed,null));};exports[_0xd992('0x22')]=function(_0x5ad7de,_0xaca4de){if(_0x5ad7de['body']['id']){delete _0x5ad7de[_0xd992('0x48')]['id'];}return db['ServicenowField'][_0xd992('0x45')]({'where':{'id':_0x5ad7de[_0xd992('0x49')]['id']}})['then'](handleEntityNotFound(_0xaca4de,null))[_0xd992('0x23')](saveUpdates(_0x5ad7de[_0xd992('0x48')],null))[_0xd992('0x23')](respondWithResult(_0xaca4de,null))[_0xd992('0x46')](handleError(_0xaca4de,null));};exports[_0xd992('0x24')]=function(_0x250c9b,_0x14e533){return db['ServicenowField'][_0xd992('0x45')]({'where':{'id':_0x250c9b[_0xd992('0x49')]['id']}})[_0xd992('0x23')](handleEntityNotFound(_0x14e533,null))['then'](removeEntity(_0x14e533,null))[_0xd992('0x46')](handleError(_0x14e533,null));}; \ No newline at end of file +var _0x6107=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','includeAll','rows','catch','params','ServicenowField','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv'];(function(_0x3b9183,_0x9b8497){var _0xc5820d=function(_0x4a5fe9){while(--_0x4a5fe9){_0x3b9183['push'](_0x3b9183['shift']());}};_0xc5820d(++_0x9b8497);}(_0x6107,0xc6));var _0x7610=function(_0x388132,_0x8be4e){_0x388132=_0x388132-0x0;var _0x1518f2=_0x6107[_0x388132];return _0x1518f2;};'use strict';var emlformat=require(_0x7610('0x0'));var rimraf=require(_0x7610('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7610('0x2'));var rp=require(_0x7610('0x3'));var moment=require(_0x7610('0x4'));var BPromise=require(_0x7610('0x5'));var Mustache=require(_0x7610('0x6'));var util=require('util');var path=require(_0x7610('0x7'));var sox=require(_0x7610('0x8'));var csv=require('to-csv');var ejs=require(_0x7610('0x9'));var fs=require('fs');var fs_extra=require(_0x7610('0xa'));var _=require(_0x7610('0xb'));var squel=require(_0x7610('0xc'));var crypto=require(_0x7610('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7610('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7610('0xf'));var authService=require(_0x7610('0x10'));var qs=require(_0x7610('0x11'));var as=require(_0x7610('0x12'));var hardwareService=require(_0x7610('0x13'));var logger=require(_0x7610('0x14'))(_0x7610('0x15'));var utils=require(_0x7610('0x16'));var config=require(_0x7610('0x17'));var licenseUtil=require(_0x7610('0x18'));var db=require(_0x7610('0x19'))['db'];function respondWithStatusCode(_0x579775,_0x413f01){_0x413f01=_0x413f01||0xcc;return function(_0xb5bad2){if(_0xb5bad2){return _0x579775['sendStatus'](_0x413f01);}return _0x579775[_0x7610('0x1a')](_0x413f01)[_0x7610('0x1b')]();};}function respondWithResult(_0x5873a5,_0x56e574){_0x56e574=_0x56e574||0xc8;return function(_0x501226){if(_0x501226){return _0x5873a5['status'](_0x56e574)[_0x7610('0x1c')](_0x501226);}};}function respondWithFilteredResult(_0x393f9b,_0x5a82cf){return function(_0x58b95f){if(_0x58b95f){var _0x1d4c23=typeof _0x5a82cf['offset']===_0x7610('0x1d')&&typeof _0x5a82cf[_0x7610('0x1e')]==='undefined';var _0x13c53c=_0x58b95f[_0x7610('0x1f')];var _0x507df4=_0x1d4c23?0x0:_0x5a82cf[_0x7610('0x20')];var _0x2353f5=_0x1d4c23?_0x58b95f['count']:_0x5a82cf[_0x7610('0x20')]+_0x5a82cf[_0x7610('0x1e')];var _0x1e77ec;if(_0x2353f5>=_0x13c53c){_0x2353f5=_0x13c53c;_0x1e77ec=0xc8;}else{_0x1e77ec=0xce;}_0x393f9b[_0x7610('0x1a')](_0x1e77ec);return _0x393f9b[_0x7610('0x21')](_0x7610('0x22'),_0x507df4+'-'+_0x2353f5+'/'+_0x13c53c)[_0x7610('0x1c')](_0x58b95f);}return null;};}function patchUpdates(_0x53c7c0){return function(_0x4feee0){try{jsonpatch[_0x7610('0x23')](_0x4feee0,_0x53c7c0,!![]);}catch(_0x260f73){return BPromise['reject'](_0x260f73);}return _0x4feee0['save']();};}function saveUpdates(_0x1d8e8b,_0x26f225){return function(_0x1fcc8b){if(_0x1fcc8b){return _0x1fcc8b[_0x7610('0x24')](_0x1d8e8b)[_0x7610('0x25')](function(_0x268c8d){return _0x268c8d;});}return null;};}function removeEntity(_0x469b31,_0xd57606){return function(_0x3ddf02){if(_0x3ddf02){return _0x3ddf02[_0x7610('0x26')]()[_0x7610('0x25')](function(){_0x469b31[_0x7610('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5daa3d,_0x21e4f2){return function(_0x3e1610){if(!_0x3e1610){_0x5daa3d[_0x7610('0x27')](0x194);}return _0x3e1610;};}function handleError(_0x3b0af0,_0x20d92c){_0x20d92c=_0x20d92c||0x1f4;return function(_0x53ac9d){logger[_0x7610('0x28')](_0x53ac9d[_0x7610('0x29')]);if(_0x53ac9d[_0x7610('0x2a')]){delete _0x53ac9d[_0x7610('0x2a')];}_0x3b0af0[_0x7610('0x1a')](_0x20d92c)['send'](_0x53ac9d);};}exports[_0x7610('0x2b')]=function(_0x4f5373,_0x2ae22e){var _0x1994ed={},_0x3bd69d={},_0x599817={'count':0x0,'rows':[]};var _0x345046=_['map'](db['ServicenowField'][_0x7610('0x2c')],function(_0xd9f866){return{'name':_0xd9f866[_0x7610('0x2d')],'type':_0xd9f866[_0x7610('0x2e')][_0x7610('0x2f')]};});_0x3bd69d[_0x7610('0x30')]=_['map'](_0x345046,_0x7610('0x2a'));_0x3bd69d[_0x7610('0x31')]=_[_0x7610('0x32')](_0x4f5373[_0x7610('0x31')]);_0x3bd69d[_0x7610('0x33')]=_[_0x7610('0x34')](_0x3bd69d[_0x7610('0x30')],_0x3bd69d[_0x7610('0x31')]);_0x1994ed[_0x7610('0x35')]=_[_0x7610('0x34')](_0x3bd69d[_0x7610('0x30')],qs[_0x7610('0x36')](_0x4f5373[_0x7610('0x31')]['fields']));_0x1994ed[_0x7610('0x35')]=_0x1994ed[_0x7610('0x35')][_0x7610('0x37')]?_0x1994ed[_0x7610('0x35')]:_0x3bd69d['model'];if(!_0x4f5373[_0x7610('0x31')][_0x7610('0x38')]('nolimit')){_0x1994ed[_0x7610('0x1e')]=qs['limit'](_0x4f5373[_0x7610('0x31')][_0x7610('0x1e')]);_0x1994ed[_0x7610('0x20')]=qs[_0x7610('0x20')](_0x4f5373[_0x7610('0x31')][_0x7610('0x20')]);}_0x1994ed[_0x7610('0x39')]=qs[_0x7610('0x3a')](_0x4f5373[_0x7610('0x31')][_0x7610('0x3a')]);_0x1994ed[_0x7610('0x3b')]=qs['filters'](_[_0x7610('0x3c')](_0x4f5373[_0x7610('0x31')],_0x3bd69d['filters']),_0x345046);if(_0x4f5373[_0x7610('0x31')]['filter']){_0x1994ed[_0x7610('0x3b')]=_[_0x7610('0x3d')](_0x1994ed[_0x7610('0x3b')],{'$or':_['map'](_0x345046,function(_0x54d4f4){if(_0x54d4f4[_0x7610('0x2e')]!=='VIRTUAL'){var _0x4eec97={};_0x4eec97[_0x54d4f4[_0x7610('0x2a')]]={'$like':'%'+_0x4f5373[_0x7610('0x31')]['filter']+'%'};return _0x4eec97;}})});}_0x1994ed=_['merge']({},_0x1994ed,_0x4f5373['options']);var _0x1df66f={'where':_0x1994ed[_0x7610('0x3b')]};return db['ServicenowField'][_0x7610('0x1f')](_0x1df66f)['then'](function(_0x339d4f){_0x599817[_0x7610('0x1f')]=_0x339d4f;if(_0x4f5373[_0x7610('0x31')][_0x7610('0x3e')]){_0x1994ed['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x1994ed);})[_0x7610('0x25')](function(_0x23b237){_0x599817[_0x7610('0x3f')]=_0x23b237;return _0x599817;})[_0x7610('0x25')](respondWithFilteredResult(_0x2ae22e,_0x1994ed))[_0x7610('0x40')](handleError(_0x2ae22e,null));};exports['show']=function(_0x3e43c1,_0x4419a9){var _0xcc876b={'raw':!![],'where':{'id':_0x3e43c1[_0x7610('0x41')]['id']}},_0x4de55f={};_0x4de55f['model']=_['keys'](db[_0x7610('0x42')]['rawAttributes']);_0x4de55f[_0x7610('0x31')]=_['keys'](_0x3e43c1[_0x7610('0x31')]);_0x4de55f[_0x7610('0x33')]=_[_0x7610('0x34')](_0x4de55f[_0x7610('0x30')],_0x4de55f[_0x7610('0x31')]);_0xcc876b['attributes']=_['intersection'](_0x4de55f[_0x7610('0x30')],qs['fields'](_0x3e43c1[_0x7610('0x31')][_0x7610('0x36')]));_0xcc876b[_0x7610('0x35')]=_0xcc876b[_0x7610('0x35')][_0x7610('0x37')]?_0xcc876b['attributes']:_0x4de55f[_0x7610('0x30')];if(_0x3e43c1[_0x7610('0x31')][_0x7610('0x3e')]){_0xcc876b['include']=[{'all':!![]}];}_0xcc876b=_[_0x7610('0x3d')]({},_0xcc876b,_0x3e43c1[_0x7610('0x43')]);return db['ServicenowField'][_0x7610('0x44')](_0xcc876b)['then'](handleEntityNotFound(_0x4419a9,null))[_0x7610('0x25')](respondWithResult(_0x4419a9,null))[_0x7610('0x40')](handleError(_0x4419a9,null));};exports[_0x7610('0x45')]=function(_0x56c54b,_0x3253c7){return db[_0x7610('0x42')]['create'](_0x56c54b[_0x7610('0x46')],{})['then'](respondWithResult(_0x3253c7,0xc9))['catch'](handleError(_0x3253c7,null));};exports[_0x7610('0x24')]=function(_0x2ab67e,_0x3593f3){if(_0x2ab67e[_0x7610('0x46')]['id']){delete _0x2ab67e[_0x7610('0x46')]['id'];}return db[_0x7610('0x42')][_0x7610('0x44')]({'where':{'id':_0x2ab67e['params']['id']}})[_0x7610('0x25')](handleEntityNotFound(_0x3593f3,null))[_0x7610('0x25')](saveUpdates(_0x2ab67e[_0x7610('0x46')],null))[_0x7610('0x25')](respondWithResult(_0x3593f3,null))['catch'](handleError(_0x3593f3,null));};exports[_0x7610('0x26')]=function(_0x38e755,_0x19e5dc){return db[_0x7610('0x42')][_0x7610('0x44')]({'where':{'id':_0x38e755[_0x7610('0x41')]['id']}})[_0x7610('0x25')](handleEntityNotFound(_0x19e5dc,null))[_0x7610('0x25')](removeEntity(_0x19e5dc,null))[_0x7610('0x40')](handleError(_0x19e5dc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index e04d40d..32dab88 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 _0x1ecf=['rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c06d8,_0x12804f){var _0x8be0ab=function(_0x149571){while(--_0x149571){_0x4c06d8['push'](_0x4c06d8['shift']());}};_0x8be0ab(++_0x12804f);}(_0x1ecf,0x78));var _0xf1ec=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x1ecf[_0x3f25b2];return _0xd8caeb;};'use strict';var _=require(_0xf1ec('0x0'));var util=require(_0xf1ec('0x1'));var logger=require(_0xf1ec('0x2'))(_0xf1ec('0x3'));var moment=require(_0xf1ec('0x4'));var BPromise=require(_0xf1ec('0x5'));var rp=require(_0xf1ec('0x6'));var fs=require('fs');var path=require(_0xf1ec('0x7'));var rimraf=require(_0xf1ec('0x8'));var config=require(_0xf1ec('0x9'));var attributes=require(_0xf1ec('0xa'));module[_0xf1ec('0xb')]=function(_0x41ce5f,_0x2ae6a0){return _0x41ce5f[_0xf1ec('0xc')](_0xf1ec('0xd'),attributes,{'tableName':_0xf1ec('0xe'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xf1ec('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8490=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','define','ServicenowField','servicenow_unique_index','idField'];(function(_0xcac346,_0x1a401d){var _0x4609c7=function(_0x51b5cd){while(--_0x51b5cd){_0xcac346['push'](_0xcac346['shift']());}};_0x4609c7(++_0x1a401d);}(_0x8490,0x6a));var _0x0849=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x8490[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x0849('0x0'));var util=require(_0x0849('0x1'));var logger=require(_0x0849('0x2'))(_0x0849('0x3'));var moment=require(_0x0849('0x4'));var BPromise=require(_0x0849('0x5'));var rp=require(_0x0849('0x6'));var fs=require('fs');var path=require(_0x0849('0x7'));var rimraf=require('rimraf');var config=require(_0x0849('0x8'));var attributes=require(_0x0849('0x9'));module['exports']=function(_0x36b782,_0x5c8fc8){return _0x36b782[_0x0849('0xa')](_0x0849('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x0849('0xc'),'fields':[_0x0849('0xd'),_0x0849('0xe')],'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 7ef7e5c..d4ae260 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x4461e8,_0x46f528){var _0x52eab1=function(_0x31d5a9){while(--_0x31d5a9){_0x4461e8['push'](_0x4461e8['shift']());}};_0x52eab1(++_0x46f528);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4558e69..a15e07e 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(_0x57fc89,_0x2445da){var _0x32df73=function(_0x348dda){while(--_0x348dda){_0x57fc89['push'](_0x57fc89['shift']());}};_0x32df73(++_0x2445da);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x339c0e,_0xdf07e7){var _0x119768=function(_0x5bae1c){while(--_0x5bae1c){_0x339c0e['push'](_0x339c0e['shift']());}};_0x119768(++_0xdf07e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 711f42c..7779f77 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(_0x505aa9,_0x581853){var _0x2908bf=function(_0x40d1a2){while(--_0x40d1a2){_0x505aa9['push'](_0x505aa9['shift']());}};_0x2908bf(++_0x581853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x4394d9,_0x5cd6a5){var _0x47489f=function(_0x21e1d8){while(--_0x21e1d8){_0x4394d9['push'](_0x4394d9['shift']());}};_0x47489f(++_0x5cd6a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 438e303..e52e6e6 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 _0x5294=['%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','Calls','values','remove','includes','label','value','statusCode','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','Content-Range','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SugarcrmAccount','findAll','rows','catch','params','find','body','update','getConfigurations','findOne','SugarcrmConfiguration','fields','Subjects','getSubjects','channel','getDescriptions','create','SugarcrmField','Descriptions','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','direction','remoteUri','slice','substring'];(function(_0x3e9558,_0xfa94a){var _0xe5ede1=function(_0x2f438b){while(--_0x2f438b){_0x3e9558['push'](_0x3e9558['shift']());}};_0xe5ede1(++_0xfa94a);}(_0x5294,0x1e4));var _0x4529=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5294[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4529('0x0'));var zipdir=require(_0x4529('0x1'));var jsonpatch=require(_0x4529('0x2'));var rp=require(_0x4529('0x3'));var moment=require(_0x4529('0x4'));var BPromise=require(_0x4529('0x5'));var Mustache=require(_0x4529('0x6'));var util=require(_0x4529('0x7'));var path=require(_0x4529('0x8'));var sox=require('sox');var csv=require(_0x4529('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4529('0xa'));var squel=require(_0x4529('0xb'));var crypto=require(_0x4529('0xc'));var jsforce=require(_0x4529('0xd'));var deskjs=require(_0x4529('0xe'));var toCsv=require(_0x4529('0x9'));var querystring=require(_0x4529('0xf'));var Papa=require(_0x4529('0x10'));var Redis=require(_0x4529('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4529('0x12'));var as=require(_0x4529('0x13'));var hardwareService=require(_0x4529('0x14'));var logger=require(_0x4529('0x15'))('api');var utils=require(_0x4529('0x16'));var config=require(_0x4529('0x17'));var licenseUtil=require(_0x4529('0x18'));var db=require(_0x4529('0x19'))['db'];var integrations=require(_0x4529('0x1a'));function respondWithStatusCode(_0x5ddbfe,_0x343dcc){_0x343dcc=_0x343dcc||0xcc;return function(_0x2f5acf){if(_0x2f5acf){return _0x5ddbfe['sendStatus'](_0x343dcc);}return _0x5ddbfe[_0x4529('0x1b')](_0x343dcc)[_0x4529('0x1c')]();};}function respondWithResult(_0x1d0b4f,_0x330bf8){_0x330bf8=_0x330bf8||0xc8;return function(_0x1958ea){if(_0x1958ea){return _0x1d0b4f[_0x4529('0x1b')](_0x330bf8)[_0x4529('0x1d')](_0x1958ea);}};}function respondWithFilteredResult(_0x19ff24,_0xbd706e){return function(_0x47a8b9){if(_0x47a8b9){var _0x45a29a=typeof _0xbd706e['offset']===_0x4529('0x1e')&&typeof _0xbd706e[_0x4529('0x1f')]==='undefined';var _0xbc8747=_0x47a8b9[_0x4529('0x20')];var _0x4607eb=_0x45a29a?0x0:_0xbd706e['offset'];var _0x392716=_0x45a29a?_0x47a8b9[_0x4529('0x20')]:_0xbd706e[_0x4529('0x21')]+_0xbd706e[_0x4529('0x1f')];var _0x364172;if(_0x392716>=_0xbc8747){_0x392716=_0xbc8747;_0x364172=0xc8;}else{_0x364172=0xce;}_0x19ff24[_0x4529('0x1b')](_0x364172);return _0x19ff24['set'](_0x4529('0x22'),_0x4607eb+'-'+_0x392716+'/'+_0xbc8747)[_0x4529('0x1d')](_0x47a8b9);}return null;};}function patchUpdates(_0x1bb5d7){return function(_0x2a8a23){try{jsonpatch['apply'](_0x2a8a23,_0x1bb5d7,!![]);}catch(_0x503ad3){return BPromise[_0x4529('0x23')](_0x503ad3);}return _0x2a8a23['save']();};}function saveUpdates(_0x2e2d9d,_0x1605ab){return function(_0xaad4fe){if(_0xaad4fe){return _0xaad4fe['update'](_0x2e2d9d)[_0x4529('0x24')](function(_0x4622cf){return _0x4622cf;});}return null;};}function removeEntity(_0x26e63f,_0x2c4a64){return function(_0xd614fa){if(_0xd614fa){return _0xd614fa[_0x4529('0x25')]()['then'](function(){_0x26e63f['status'](0xcc)[_0x4529('0x1c')]();});}};}function handleEntityNotFound(_0x2103d2,_0x4175d2){return function(_0x241177){if(!_0x241177){_0x2103d2['sendStatus'](0x194);}return _0x241177;};}function handleError(_0x223670,_0x2a193e){_0x2a193e=_0x2a193e||0x1f4;return function(_0x5c97e3){logger[_0x4529('0x26')](_0x5c97e3[_0x4529('0x27')]);if(_0x5c97e3[_0x4529('0x28')]){delete _0x5c97e3['name'];}_0x223670[_0x4529('0x1b')](_0x2a193e)[_0x4529('0x29')](_0x5c97e3);};}exports[_0x4529('0x2a')]=function(_0x252019,_0x2b8bba){var _0x533d31={},_0x175982={},_0x5d19a2={'count':0x0,'rows':[]};var _0x110a4e=_[_0x4529('0x2b')](db['SugarcrmAccount'][_0x4529('0x2c')],function(_0x215401){return{'name':_0x215401[_0x4529('0x2d')],'type':_0x215401[_0x4529('0x2e')][_0x4529('0x2f')]};});_0x175982[_0x4529('0x30')]=_[_0x4529('0x2b')](_0x110a4e,_0x4529('0x28'));_0x175982['query']=_[_0x4529('0x31')](_0x252019[_0x4529('0x32')]);_0x175982[_0x4529('0x33')]=_[_0x4529('0x34')](_0x175982[_0x4529('0x30')],_0x175982['query']);_0x533d31[_0x4529('0x35')]=_[_0x4529('0x34')](_0x175982[_0x4529('0x30')],qs['fields'](_0x252019[_0x4529('0x32')]['fields']));_0x533d31['attributes']=_0x533d31['attributes'][_0x4529('0x36')]?_0x533d31[_0x4529('0x35')]:_0x175982[_0x4529('0x30')];if(!_0x252019['query'][_0x4529('0x37')](_0x4529('0x38'))){_0x533d31[_0x4529('0x1f')]=qs['limit'](_0x252019[_0x4529('0x32')][_0x4529('0x1f')]);_0x533d31[_0x4529('0x21')]=qs[_0x4529('0x21')](_0x252019[_0x4529('0x32')][_0x4529('0x21')]);}_0x533d31[_0x4529('0x39')]=qs['sort'](_0x252019['query'][_0x4529('0x3a')]);_0x533d31[_0x4529('0x3b')]=qs[_0x4529('0x33')](_[_0x4529('0x3c')](_0x252019[_0x4529('0x32')],_0x175982[_0x4529('0x33')]),_0x110a4e);if(_0x252019[_0x4529('0x32')][_0x4529('0x3d')]){_0x533d31[_0x4529('0x3b')]=_[_0x4529('0x3e')](_0x533d31['where'],{'$or':_[_0x4529('0x2b')](_0x110a4e,function(_0x33fbcd){if(_0x33fbcd[_0x4529('0x2e')]!==_0x4529('0x3f')){var _0x3b9fa8={};_0x3b9fa8[_0x33fbcd[_0x4529('0x28')]]={'$like':'%'+_0x252019[_0x4529('0x32')][_0x4529('0x3d')]+'%'};return _0x3b9fa8;}})});}_0x533d31=_[_0x4529('0x3e')]({},_0x533d31,_0x252019[_0x4529('0x40')]);var _0x3f94ec={'where':_0x533d31[_0x4529('0x3b')]};return db['SugarcrmAccount']['count'](_0x3f94ec)[_0x4529('0x24')](function(_0x336493){_0x5d19a2[_0x4529('0x20')]=_0x336493;if(_0x252019[_0x4529('0x32')][_0x4529('0x41')]){_0x533d31[_0x4529('0x42')]=[{'all':!![]}];}return db[_0x4529('0x43')][_0x4529('0x44')](_0x533d31);})['then'](function(_0x58aa90){_0x5d19a2[_0x4529('0x45')]=_0x58aa90;return _0x5d19a2;})[_0x4529('0x24')](respondWithFilteredResult(_0x2b8bba,_0x533d31))[_0x4529('0x46')](handleError(_0x2b8bba,null));};exports['show']=function(_0x545ab9,_0xf17bc3){var _0x29fde8={'raw':![],'where':{'id':_0x545ab9[_0x4529('0x47')]['id']}},_0x4fd4e8={};_0x4fd4e8[_0x4529('0x30')]=_[_0x4529('0x31')](db[_0x4529('0x43')][_0x4529('0x2c')]);_0x4fd4e8['query']=_[_0x4529('0x31')](_0x545ab9[_0x4529('0x32')]);_0x4fd4e8[_0x4529('0x33')]=_[_0x4529('0x34')](_0x4fd4e8[_0x4529('0x30')],_0x4fd4e8[_0x4529('0x32')]);_0x29fde8[_0x4529('0x35')]=_[_0x4529('0x34')](_0x4fd4e8['model'],qs['fields'](_0x545ab9[_0x4529('0x32')]['fields']));_0x29fde8['attributes']=_0x29fde8[_0x4529('0x35')][_0x4529('0x36')]?_0x29fde8['attributes']:_0x4fd4e8[_0x4529('0x30')];if(_0x545ab9[_0x4529('0x32')]['includeAll']){_0x29fde8[_0x4529('0x42')]=[{'all':!![]}];}_0x29fde8=_[_0x4529('0x3e')]({},_0x29fde8,_0x545ab9[_0x4529('0x40')]);return db['SugarcrmAccount'][_0x4529('0x48')](_0x29fde8)['then'](handleEntityNotFound(_0xf17bc3,null))[_0x4529('0x24')](respondWithResult(_0xf17bc3,null))[_0x4529('0x46')](handleError(_0xf17bc3,null));};exports['create']=function(_0x261dc0,_0x407943){return db['SugarcrmAccount']['create'](_0x261dc0[_0x4529('0x49')],{})[_0x4529('0x24')](respondWithResult(_0x407943,0xc9))[_0x4529('0x46')](handleError(_0x407943,null));};exports[_0x4529('0x4a')]=function(_0x4cabbe,_0x3b5812){if(_0x4cabbe['body']['id']){delete _0x4cabbe[_0x4529('0x49')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x4cabbe[_0x4529('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b5812,null))[_0x4529('0x24')](saveUpdates(_0x4cabbe[_0x4529('0x49')],null))[_0x4529('0x24')](respondWithResult(_0x3b5812,null))[_0x4529('0x46')](handleError(_0x3b5812,null));};exports[_0x4529('0x25')]=function(_0x1b7ee8,_0x5bbb0b){return db[_0x4529('0x43')]['find']({'where':{'id':_0x1b7ee8[_0x4529('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bbb0b,null))['then'](removeEntity(_0x5bbb0b,null))[_0x4529('0x46')](handleError(_0x5bbb0b,null));};exports[_0x4529('0x4b')]=function(_0x41b61a,_0x398c01,_0x377e1d){var _0x18b84d={};var _0x2b44fe={};var _0xeea5;var _0x3b423f;return db[_0x4529('0x43')][_0x4529('0x4c')]({'where':{'id':_0x41b61a['params']['id']}})[_0x4529('0x24')](handleEntityNotFound(_0x398c01,null))[_0x4529('0x24')](function(_0x228ba1){if(_0x228ba1){_0xeea5=_0x228ba1;_0x2b44fe[_0x4529('0x30')]=_[_0x4529('0x31')](db[_0x4529('0x4d')]['rawAttributes']);_0x2b44fe[_0x4529('0x32')]=_[_0x4529('0x31')](_0x41b61a[_0x4529('0x32')]);_0x2b44fe[_0x4529('0x33')]=_['intersection'](_0x2b44fe[_0x4529('0x30')],_0x2b44fe[_0x4529('0x32')]);_0x18b84d[_0x4529('0x35')]=_[_0x4529('0x34')](_0x2b44fe[_0x4529('0x30')],qs['fields'](_0x41b61a[_0x4529('0x32')][_0x4529('0x4e')]));_0x18b84d['attributes']=_0x18b84d[_0x4529('0x35')]['length']?_0x18b84d[_0x4529('0x35')]:_0x2b44fe[_0x4529('0x30')];_0x18b84d[_0x4529('0x39')]=qs[_0x4529('0x3a')](_0x41b61a[_0x4529('0x32')][_0x4529('0x3a')]);_0x18b84d['where']=qs['filters'](_[_0x4529('0x3c')](_0x41b61a[_0x4529('0x32')],_0x2b44fe[_0x4529('0x33')]));if(_0x41b61a['query']['filter']){_0x18b84d[_0x4529('0x3b')]=_[_0x4529('0x3e')](_0x18b84d[_0x4529('0x3b')],{'$or':_[_0x4529('0x2b')](_0x18b84d[_0x4529('0x35')],function(_0x124a97){var _0x4cc6d3={};_0x4cc6d3[_0x124a97]={'$like':'%'+_0x41b61a[_0x4529('0x32')][_0x4529('0x3d')]+'%'};return _0x4cc6d3;})});}_0x18b84d=_[_0x4529('0x3e')]({},_0x18b84d,_0x41b61a['options']);return _0xeea5[_0x4529('0x4b')](_0x18b84d);}})[_0x4529('0x24')](function(_0x15b1ac){if(_0x15b1ac){_0x3b423f=_0x15b1ac[_0x4529('0x36')];if(!_0x41b61a[_0x4529('0x32')]['hasOwnProperty'](_0x4529('0x38'))){_0x18b84d[_0x4529('0x1f')]=qs['limit'](_0x41b61a[_0x4529('0x32')]['limit']);_0x18b84d[_0x4529('0x21')]=qs['offset'](_0x41b61a[_0x4529('0x32')][_0x4529('0x21')]);}return _0xeea5[_0x4529('0x4b')](_0x18b84d);}})['then'](function(_0x19bf6a){if(_0x19bf6a){return _0x19bf6a?{'count':_0x3b423f,'rows':_0x19bf6a}:null;}})[_0x4529('0x24')](respondWithResult(_0x398c01,null))[_0x4529('0x46')](handleError(_0x398c01,null));};exports['addConfiguration']=function(_0x52042c,_0x55c120,_0x352c69){if(_0x52042c[_0x4529('0x49')]['id']){delete _0x52042c[_0x4529('0x49')]['id'];}return db['SugarcrmAccount'][_0x4529('0x4c')]({'where':{'id':_0x52042c[_0x4529('0x47')]['id']}})[_0x4529('0x24')](handleEntityNotFound(_0x55c120,null))[_0x4529('0x24')](function(_0x4defc4){if(_0x4defc4){_0x52042c[_0x4529('0x49')]['AccountId']=_0x4defc4['id'];_0x52042c[_0x4529('0x49')][_0x4529('0x4f')]=integrations[_0x4529('0x50')](_0x52042c[_0x4529('0x49')][_0x4529('0x51')],_0x52042c['body']['type']);_0x52042c['body']['Descriptions']=integrations[_0x4529('0x52')](_0x52042c[_0x4529('0x49')][_0x4529('0x51')],_0x52042c[_0x4529('0x49')][_0x4529('0x2e')]);return db[_0x4529('0x4d')][_0x4529('0x53')](_0x52042c['body'],{'include':[{'model':db[_0x4529('0x54')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x4529('0x55')}]});}return null;})[_0x4529('0x24')](respondWithResult(_0x55c120,null))[_0x4529('0x46')](handleError(_0x55c120,null));};exports['getFields']=function(_0x47dd4f,_0x7fcdd3,_0x4b45a8){var _0x3d959d='';var _0x3901bb=['id',_0x4529('0x28'),_0x4529('0x56'),_0x4529('0x57'),_0x4529('0x58'),_0x4529('0x59'),'duration_hours',_0x4529('0x5a'),_0x4529('0x5b'),'parent_type','parent_name',_0x4529('0x5c')];return db[_0x4529('0x43')][_0x4529('0x4c')]({'where':{'id':_0x47dd4f[_0x4529('0x47')]['id']},'attributes':['id','username','password',_0x4529('0x5d')]})[_0x4529('0x24')](handleEntityNotFound(_0x7fcdd3,null))['then'](function(_0x5c7aa5){if(_0x5c7aa5){_0x3d959d=_0x5c7aa5[_0x4529('0x5d')];var _0x528fac=_0x3d959d[_0x4529('0x5e')](-0x1);if(_0x528fac==='/'){_0x3d959d=_0x3d959d[_0x4529('0x5f')](0x0,_0x3d959d['lastIndexOf'](_0x528fac));}return rp({'method':'POST','uri':util['format'](_0x4529('0x60'),_0x3d959d,_0x4529('0x61')),'json':!![],'form':{'method':_0x4529('0x62'),'input_type':_0x4529('0x63'),'response_type':_0x4529('0x63'),'rest_data':JSON[_0x4529('0x64')]({'user_auth':{'user_name':_0x5c7aa5[_0x4529('0x65')],'password':_0x5c7aa5[_0x4529('0x66')],'encryption':'PLAIN'},'application':_0x4529('0x67')})}});}})[_0x4529('0x24')](function(_0x3e2215){if(_0x3e2215&&_0x3e2215[_0x4529('0x28')]!==_0x4529('0x68')&&_0x3e2215['name']!==_0x4529('0x69')){return rp({'method':'POST','uri':util[_0x4529('0x6a')](_0x4529('0x60'),_0x3d959d,_0x4529('0x61')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x4529('0x63'),'rest_data':JSON[_0x4529('0x64')]({'session':_0x3e2215['id'],'module_name':_0x4529('0x6b')})}})[_0x4529('0x24')](function(_0x1f4327){if(_0x1f4327){var _0x46d17f=_[_0x4529('0x6c')](_0x1f4327['module_fields']);_[_0x4529('0x6d')](_0x46d17f,function(_0x2594af){return _0x3901bb[_0x4529('0x6e')](_0x2594af[_0x4529('0x28')]);});return{'count':_0x46d17f[_0x4529('0x36')],'rows':_[_0x4529('0x2b')](_0x46d17f,function(_0x2ad7af){return{'id':_0x2ad7af[_0x4529('0x28')],'name':_0x2ad7af[_0x4529('0x6f')],'custom':_['endsWith'](_0x2ad7af['name'],'_c')?!![]:![],'options':_0x2ad7af[_0x4529('0x40')]?_['map'](_[_0x4529('0x6c')](_0x2ad7af[_0x4529('0x40')]),function(_0x501c94){return{'name':_0x501c94[_0x4529('0x70')],'value':_0x501c94[_0x4529('0x28')]};}):[]};})};}})['then'](respondWithResult(_0x7fcdd3,null))[_0x4529('0x46')](function(_0x37eb0c){var _0xa0b96e=_0x47dd4f['query']['test']?0x1f4:_0x37eb0c[_0x4529('0x71')]||0x1f4;logger[_0x4529('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x4529('0x72'),_0xa0b96e,JSON[_0x4529('0x64')](_0x37eb0c));delete _0x37eb0c[_0x4529('0x28')];if(_0xa0b96e===0x191){_0xa0b96e=0x190;}_0x7fcdd3['status'](_0xa0b96e)[_0x4529('0x29')](_0x47dd4f[_0x4529('0x32')]['test']?{'message':_0x4529('0x73'),'statusCode':_0x37eb0c[_0x4529('0x71')]}:_0x37eb0c);});}else{var _0x1f6a9f=0x1f4;_0x7fcdd3[_0x4529('0x1b')](_0x1f6a9f)[_0x4529('0x29')]({'message':_0x4529('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9304=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','update','body','params','getConfigurations','findOne','SugarcrmConfiguration','filters','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','request-promise','moment','mustache','path','sox','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName'];(function(_0x41d042,_0x3062a5){var _0xb63ca=function(_0x4f63fa){while(--_0x4f63fa){_0x41d042['push'](_0x41d042['shift']());}};_0xb63ca(++_0x3062a5);}(_0x9304,0x1b5));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4930('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4930('0x1'));var moment=require(_0x4930('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4930('0x3'));var util=require('util');var path=require(_0x4930('0x4'));var sox=require(_0x4930('0x5'));var csv=require('to-csv');var ejs=require(_0x4930('0x6'));var fs=require('fs');var fs_extra=require(_0x4930('0x7'));var _=require('lodash');var squel=require(_0x4930('0x8'));var crypto=require('crypto');var jsforce=require(_0x4930('0x9'));var deskjs=require(_0x4930('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4930('0xb'));var Papa=require('papaparse');var Redis=require(_0x4930('0xc'));var authService=require(_0x4930('0xd'));var qs=require(_0x4930('0xe'));var as=require(_0x4930('0xf'));var hardwareService=require(_0x4930('0x10'));var logger=require(_0x4930('0x11'))(_0x4930('0x12'));var utils=require('../../config/utils');var config=require(_0x4930('0x13'));var licenseUtil=require(_0x4930('0x14'));var db=require(_0x4930('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4999f0,_0x2c80d0){_0x2c80d0=_0x2c80d0||0xcc;return function(_0xcd4fc4){if(_0xcd4fc4){return _0x4999f0['sendStatus'](_0x2c80d0);}return _0x4999f0[_0x4930('0x16')](_0x2c80d0)[_0x4930('0x17')]();};}function respondWithResult(_0x1df175,_0x485dc9){_0x485dc9=_0x485dc9||0xc8;return function(_0x4c427b){if(_0x4c427b){return _0x1df175['status'](_0x485dc9)[_0x4930('0x18')](_0x4c427b);}};}function respondWithFilteredResult(_0x32c4da,_0x2869d5){return function(_0x1d68bf){if(_0x1d68bf){var _0x5b134b=typeof _0x2869d5[_0x4930('0x19')]==='undefined'&&typeof _0x2869d5['limit']===_0x4930('0x1a');var _0x3dc18f=_0x1d68bf[_0x4930('0x1b')];var _0x2b00d8=_0x5b134b?0x0:_0x2869d5[_0x4930('0x19')];var _0x34e755=_0x5b134b?_0x1d68bf['count']:_0x2869d5[_0x4930('0x19')]+_0x2869d5['limit'];var _0x1c540d;if(_0x34e755>=_0x3dc18f){_0x34e755=_0x3dc18f;_0x1c540d=0xc8;}else{_0x1c540d=0xce;}_0x32c4da[_0x4930('0x16')](_0x1c540d);return _0x32c4da['set']('Content-Range',_0x2b00d8+'-'+_0x34e755+'/'+_0x3dc18f)['json'](_0x1d68bf);}return null;};}function patchUpdates(_0x21ed9d){return function(_0x8c708){try{jsonpatch[_0x4930('0x1c')](_0x8c708,_0x21ed9d,!![]);}catch(_0x56828b){return BPromise[_0x4930('0x1d')](_0x56828b);}return _0x8c708[_0x4930('0x1e')]();};}function saveUpdates(_0x1ddb8c,_0x117f6f){return function(_0x2fdf48){if(_0x2fdf48){return _0x2fdf48['update'](_0x1ddb8c)['then'](function(_0x385a1b){return _0x385a1b;});}return null;};}function removeEntity(_0x1f5074,_0x42a153){return function(_0x205b20){if(_0x205b20){return _0x205b20[_0x4930('0x1f')]()[_0x4930('0x20')](function(){_0x1f5074['status'](0xcc)[_0x4930('0x17')]();});}};}function handleEntityNotFound(_0x499ac3,_0x46686c){return function(_0x1238a8){if(!_0x1238a8){_0x499ac3[_0x4930('0x21')](0x194);}return _0x1238a8;};}function handleError(_0x317fea,_0xdfd466){_0xdfd466=_0xdfd466||0x1f4;return function(_0x3e5261){logger[_0x4930('0x22')](_0x3e5261[_0x4930('0x23')]);if(_0x3e5261['name']){delete _0x3e5261[_0x4930('0x24')];}_0x317fea[_0x4930('0x16')](_0xdfd466)[_0x4930('0x25')](_0x3e5261);};}exports[_0x4930('0x26')]=function(_0x932e31,_0x13f30b){var _0x23d4dd={},_0x27381b={},_0x9bd9dd={'count':0x0,'rows':[]};var _0xa555c2=_[_0x4930('0x27')](db[_0x4930('0x28')][_0x4930('0x29')],function(_0x22ad32){return{'name':_0x22ad32[_0x4930('0x2a')],'type':_0x22ad32['type']['key']};});_0x27381b[_0x4930('0x2b')]=_[_0x4930('0x27')](_0xa555c2,_0x4930('0x24'));_0x27381b[_0x4930('0x2c')]=_[_0x4930('0x2d')](_0x932e31[_0x4930('0x2c')]);_0x27381b['filters']=_[_0x4930('0x2e')](_0x27381b[_0x4930('0x2b')],_0x27381b['query']);_0x23d4dd[_0x4930('0x2f')]=_['intersection'](_0x27381b['model'],qs['fields'](_0x932e31['query'][_0x4930('0x30')]));_0x23d4dd[_0x4930('0x2f')]=_0x23d4dd[_0x4930('0x2f')][_0x4930('0x31')]?_0x23d4dd['attributes']:_0x27381b['model'];if(!_0x932e31[_0x4930('0x2c')][_0x4930('0x32')](_0x4930('0x33'))){_0x23d4dd[_0x4930('0x34')]=qs[_0x4930('0x34')](_0x932e31[_0x4930('0x2c')][_0x4930('0x34')]);_0x23d4dd[_0x4930('0x19')]=qs[_0x4930('0x19')](_0x932e31[_0x4930('0x2c')][_0x4930('0x19')]);}_0x23d4dd[_0x4930('0x35')]=qs['sort'](_0x932e31[_0x4930('0x2c')][_0x4930('0x36')]);_0x23d4dd['where']=qs['filters'](_['pick'](_0x932e31[_0x4930('0x2c')],_0x27381b['filters']),_0xa555c2);if(_0x932e31[_0x4930('0x2c')][_0x4930('0x37')]){_0x23d4dd[_0x4930('0x38')]=_[_0x4930('0x39')](_0x23d4dd[_0x4930('0x38')],{'$or':_['map'](_0xa555c2,function(_0x40916f){if(_0x40916f[_0x4930('0x3a')]!==_0x4930('0x3b')){var _0x33746d={};_0x33746d[_0x40916f[_0x4930('0x24')]]={'$like':'%'+_0x932e31[_0x4930('0x2c')]['filter']+'%'};return _0x33746d;}})});}_0x23d4dd=_['merge']({},_0x23d4dd,_0x932e31[_0x4930('0x3c')]);var _0x213a81={'where':_0x23d4dd['where']};return db[_0x4930('0x28')][_0x4930('0x1b')](_0x213a81)['then'](function(_0xcfe641){_0x9bd9dd[_0x4930('0x1b')]=_0xcfe641;if(_0x932e31[_0x4930('0x2c')][_0x4930('0x3d')]){_0x23d4dd[_0x4930('0x3e')]=[{'all':!![]}];}return db[_0x4930('0x28')][_0x4930('0x3f')](_0x23d4dd);})[_0x4930('0x20')](function(_0x250248){_0x9bd9dd['rows']=_0x250248;return _0x9bd9dd;})[_0x4930('0x20')](respondWithFilteredResult(_0x13f30b,_0x23d4dd))[_0x4930('0x40')](handleError(_0x13f30b,null));};exports[_0x4930('0x41')]=function(_0x497f9c,_0x339c1b){var _0x4cb078={'raw':![],'where':{'id':_0x497f9c['params']['id']}},_0x4b59fd={};_0x4b59fd[_0x4930('0x2b')]=_[_0x4930('0x2d')](db[_0x4930('0x28')][_0x4930('0x29')]);_0x4b59fd['query']=_['keys'](_0x497f9c[_0x4930('0x2c')]);_0x4b59fd['filters']=_[_0x4930('0x2e')](_0x4b59fd[_0x4930('0x2b')],_0x4b59fd['query']);_0x4cb078['attributes']=_['intersection'](_0x4b59fd[_0x4930('0x2b')],qs[_0x4930('0x30')](_0x497f9c['query']['fields']));_0x4cb078[_0x4930('0x2f')]=_0x4cb078['attributes'][_0x4930('0x31')]?_0x4cb078['attributes']:_0x4b59fd['model'];if(_0x497f9c[_0x4930('0x2c')][_0x4930('0x3d')]){_0x4cb078[_0x4930('0x3e')]=[{'all':!![]}];}_0x4cb078=_[_0x4930('0x39')]({},_0x4cb078,_0x497f9c['options']);return db['SugarcrmAccount'][_0x4930('0x42')](_0x4cb078)[_0x4930('0x20')](handleEntityNotFound(_0x339c1b,null))[_0x4930('0x20')](respondWithResult(_0x339c1b,null))[_0x4930('0x40')](handleError(_0x339c1b,null));};exports[_0x4930('0x43')]=function(_0x254890,_0x47af55){return db[_0x4930('0x28')]['create'](_0x254890['body'],{})[_0x4930('0x20')](respondWithResult(_0x47af55,0xc9))[_0x4930('0x40')](handleError(_0x47af55,null));};exports[_0x4930('0x44')]=function(_0x456bfe,_0x590c7b){if(_0x456bfe[_0x4930('0x45')]['id']){delete _0x456bfe[_0x4930('0x45')]['id'];}return db[_0x4930('0x28')][_0x4930('0x42')]({'where':{'id':_0x456bfe['params']['id']}})['then'](handleEntityNotFound(_0x590c7b,null))[_0x4930('0x20')](saveUpdates(_0x456bfe[_0x4930('0x45')],null))[_0x4930('0x20')](respondWithResult(_0x590c7b,null))[_0x4930('0x40')](handleError(_0x590c7b,null));};exports[_0x4930('0x1f')]=function(_0x255a68,_0x6163e3){return db[_0x4930('0x28')]['find']({'where':{'id':_0x255a68[_0x4930('0x46')]['id']}})[_0x4930('0x20')](handleEntityNotFound(_0x6163e3,null))[_0x4930('0x20')](removeEntity(_0x6163e3,null))[_0x4930('0x40')](handleError(_0x6163e3,null));};exports[_0x4930('0x47')]=function(_0x5a6ed3,_0xfbf523,_0x491915){var _0x1d0a90={};var _0x42d5c6={};var _0x19cb5d;var _0x1206f9;return db[_0x4930('0x28')][_0x4930('0x48')]({'where':{'id':_0x5a6ed3['params']['id']}})['then'](handleEntityNotFound(_0xfbf523,null))[_0x4930('0x20')](function(_0x11521b){if(_0x11521b){_0x19cb5d=_0x11521b;_0x42d5c6[_0x4930('0x2b')]=_[_0x4930('0x2d')](db[_0x4930('0x49')][_0x4930('0x29')]);_0x42d5c6[_0x4930('0x2c')]=_['keys'](_0x5a6ed3[_0x4930('0x2c')]);_0x42d5c6[_0x4930('0x4a')]=_['intersection'](_0x42d5c6[_0x4930('0x2b')],_0x42d5c6[_0x4930('0x2c')]);_0x1d0a90[_0x4930('0x2f')]=_[_0x4930('0x2e')](_0x42d5c6[_0x4930('0x2b')],qs[_0x4930('0x30')](_0x5a6ed3['query'][_0x4930('0x30')]));_0x1d0a90[_0x4930('0x2f')]=_0x1d0a90[_0x4930('0x2f')][_0x4930('0x31')]?_0x1d0a90[_0x4930('0x2f')]:_0x42d5c6[_0x4930('0x2b')];_0x1d0a90[_0x4930('0x35')]=qs[_0x4930('0x36')](_0x5a6ed3[_0x4930('0x2c')][_0x4930('0x36')]);_0x1d0a90[_0x4930('0x38')]=qs[_0x4930('0x4a')](_[_0x4930('0x4b')](_0x5a6ed3[_0x4930('0x2c')],_0x42d5c6[_0x4930('0x4a')]));if(_0x5a6ed3['query'][_0x4930('0x37')]){_0x1d0a90['where']=_[_0x4930('0x39')](_0x1d0a90[_0x4930('0x38')],{'$or':_[_0x4930('0x27')](_0x1d0a90[_0x4930('0x2f')],function(_0x125d05){var _0x57a057={};_0x57a057[_0x125d05]={'$like':'%'+_0x5a6ed3['query']['filter']+'%'};return _0x57a057;})});}_0x1d0a90=_[_0x4930('0x39')]({},_0x1d0a90,_0x5a6ed3['options']);return _0x19cb5d[_0x4930('0x47')](_0x1d0a90);}})[_0x4930('0x20')](function(_0x1aa1aa){if(_0x1aa1aa){_0x1206f9=_0x1aa1aa[_0x4930('0x31')];if(!_0x5a6ed3[_0x4930('0x2c')][_0x4930('0x32')](_0x4930('0x33'))){_0x1d0a90[_0x4930('0x34')]=qs[_0x4930('0x34')](_0x5a6ed3[_0x4930('0x2c')][_0x4930('0x34')]);_0x1d0a90[_0x4930('0x19')]=qs[_0x4930('0x19')](_0x5a6ed3[_0x4930('0x2c')][_0x4930('0x19')]);}return _0x19cb5d[_0x4930('0x47')](_0x1d0a90);}})[_0x4930('0x20')](function(_0x57b4d7){if(_0x57b4d7){return _0x57b4d7?{'count':_0x1206f9,'rows':_0x57b4d7}:null;}})[_0x4930('0x20')](respondWithResult(_0xfbf523,null))[_0x4930('0x40')](handleError(_0xfbf523,null));};exports[_0x4930('0x4c')]=function(_0x179744,_0x110bd6,_0xe988f9){if(_0x179744[_0x4930('0x45')]['id']){delete _0x179744[_0x4930('0x45')]['id'];}return db[_0x4930('0x28')][_0x4930('0x48')]({'where':{'id':_0x179744[_0x4930('0x46')]['id']}})[_0x4930('0x20')](handleEntityNotFound(_0x110bd6,null))[_0x4930('0x20')](function(_0x1ccdf6){if(_0x1ccdf6){_0x179744[_0x4930('0x45')][_0x4930('0x4d')]=_0x1ccdf6['id'];_0x179744[_0x4930('0x45')][_0x4930('0x4e')]=integrations[_0x4930('0x4f')](_0x179744[_0x4930('0x45')][_0x4930('0x50')],_0x179744[_0x4930('0x45')][_0x4930('0x3a')]);_0x179744[_0x4930('0x45')][_0x4930('0x51')]=integrations[_0x4930('0x52')](_0x179744[_0x4930('0x45')]['channel'],_0x179744['body'][_0x4930('0x3a')]);return db[_0x4930('0x49')][_0x4930('0x43')](_0x179744[_0x4930('0x45')],{'include':[{'model':db[_0x4930('0x53')],'as':_0x4930('0x4e')},{'model':db[_0x4930('0x53')],'as':'Descriptions'}]});}return null;})[_0x4930('0x20')](respondWithResult(_0x110bd6,null))[_0x4930('0x40')](handleError(_0x110bd6,null));};exports[_0x4930('0x54')]=function(_0x1cfe4f,_0x55553b,_0x1dd659){var _0xf49da9='';var _0x1284cb=['id',_0x4930('0x24'),_0x4930('0x55'),'created_by',_0x4930('0x56'),_0x4930('0x57'),_0x4930('0x58'),_0x4930('0x59'),_0x4930('0x5a'),_0x4930('0x5b'),'parent_name','direction'];return db[_0x4930('0x28')][_0x4930('0x48')]({'where':{'id':_0x1cfe4f[_0x4930('0x46')]['id']},'attributes':['id','username','password','remoteUri']})[_0x4930('0x20')](handleEntityNotFound(_0x55553b,null))['then'](function(_0x5ce686){if(_0x5ce686){_0xf49da9=_0x5ce686[_0x4930('0x5c')];var _0x8cd396=_0xf49da9[_0x4930('0x5d')](-0x1);if(_0x8cd396==='/'){_0xf49da9=_0xf49da9[_0x4930('0x5e')](0x0,_0xf49da9[_0x4930('0x5f')](_0x8cd396));}return rp({'method':_0x4930('0x60'),'uri':util[_0x4930('0x61')](_0x4930('0x62'),_0xf49da9,_0x4930('0x63')),'json':!![],'form':{'method':_0x4930('0x64'),'input_type':_0x4930('0x65'),'response_type':_0x4930('0x65'),'rest_data':JSON[_0x4930('0x66')]({'user_auth':{'user_name':_0x5ce686[_0x4930('0x67')],'password':_0x5ce686[_0x4930('0x68')],'encryption':_0x4930('0x69')},'application':_0x4930('0x6a')})}});}})['then'](function(_0x15b788){if(_0x15b788&&_0x15b788[_0x4930('0x24')]!==_0x4930('0x6b')&&_0x15b788[_0x4930('0x24')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x4930('0x61')](_0x4930('0x62'),_0xf49da9,_0x4930('0x63')),'json':!![],'form':{'method':_0x4930('0x6c'),'input_type':_0x4930('0x65'),'response_type':_0x4930('0x65'),'rest_data':JSON['stringify']({'session':_0x15b788['id'],'module_name':_0x4930('0x6d')})}})[_0x4930('0x20')](function(_0x56888a){if(_0x56888a){var _0x305992=_[_0x4930('0x6e')](_0x56888a[_0x4930('0x6f')]);_['remove'](_0x305992,function(_0x3a3ff2){return _0x1284cb[_0x4930('0x70')](_0x3a3ff2['name']);});return{'count':_0x305992['length'],'rows':_[_0x4930('0x27')](_0x305992,function(_0x5b52bd){return{'id':_0x5b52bd[_0x4930('0x24')],'name':_0x5b52bd[_0x4930('0x71')],'custom':_[_0x4930('0x72')](_0x5b52bd[_0x4930('0x24')],'_c')?!![]:![],'options':_0x5b52bd[_0x4930('0x3c')]?_[_0x4930('0x27')](_[_0x4930('0x6e')](_0x5b52bd[_0x4930('0x3c')]),function(_0x43078d){return{'name':_0x43078d[_0x4930('0x73')],'value':_0x43078d[_0x4930('0x24')]};}):[]};})};}})[_0x4930('0x20')](respondWithResult(_0x55553b,null))[_0x4930('0x40')](function(_0x86060d){var _0x5208ab=_0x1cfe4f['query'][_0x4930('0x74')]?0x1f4:_0x86060d[_0x4930('0x75')]||0x1f4;logger['error'](_0x4930('0x76'),_0x4930('0x54'),_0x5208ab,JSON['stringify'](_0x86060d));delete _0x86060d[_0x4930('0x24')];if(_0x5208ab===0x191){_0x5208ab=0x190;}_0x55553b['status'](_0x5208ab)['send'](_0x1cfe4f[_0x4930('0x2c')][_0x4930('0x74')]?{'message':_0x4930('0x77'),'statusCode':_0x86060d[_0x4930('0x75')]}:_0x86060d);});}else{var _0x73d245=0x1f4;_0x55553b[_0x4930('0x16')](_0x73d245)[_0x4930('0x25')]({'message':'Wrong\x20credentials','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 1100068..4fc34f0 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 _0x21a8=['api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21a8,0xed));var _0x821a=function(_0x29a469,_0x7dc8bc){_0x29a469=_0x29a469-0x0;var _0x3b6784=_0x21a8[_0x29a469];return _0x3b6784;};'use strict';var _=require(_0x821a('0x0'));var util=require(_0x821a('0x1'));var logger=require(_0x821a('0x2'))(_0x821a('0x3'));var moment=require(_0x821a('0x4'));var BPromise=require(_0x821a('0x5'));var rp=require(_0x821a('0x6'));var fs=require('fs');var path=require(_0x821a('0x7'));var rimraf=require(_0x821a('0x8'));var config=require('../../config/environment');var attributes=require(_0x821a('0x9'));var integrations=require(_0x821a('0xa'));module[_0x821a('0xb')]=function(_0x1d82f0,_0xcae829){return _0x1d82f0[_0x821a('0xc')](_0x821a('0xd'),attributes,{'tableName':_0x821a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab75=['int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x5520a0,_0x143ac0){var _0x4ed976=function(_0x5ae266){while(--_0x5ae266){_0x5520a0['push'](_0x5520a0['shift']());}};_0x4ed976(++_0x143ac0);}(_0xab75,0x11f));var _0x5ab7=function(_0x309e80,_0x13a6cd){_0x309e80=_0x309e80-0x0;var _0x2325b1=_0xab75[_0x309e80];return _0x2325b1;};'use strict';var _=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var logger=require(_0x5ab7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ab7('0x3'));var rp=require(_0x5ab7('0x4'));var fs=require('fs');var path=require(_0x5ab7('0x5'));var rimraf=require('rimraf');var config=require(_0x5ab7('0x6'));var attributes=require(_0x5ab7('0x7'));var integrations=require(_0x5ab7('0x8'));module[_0x5ab7('0x9')]=function(_0x406ca2,_0x32b338){return _0x406ca2[_0x5ab7('0xa')](_0x5ab7('0xb'),attributes,{'tableName':_0x5ab7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 10dcf2e..160e9c0 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 _0xf0e5=['attributes','include','model','map','ShowSugarcrmAccount','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','findAll','options','raw','where'];(function(_0x3f99e9,_0x5c7d5c){var _0x564c55=function(_0xb502f5){while(--_0xb502f5){_0x3f99e9['push'](_0x3f99e9['shift']());}};_0x564c55(++_0x5c7d5c);}(_0xf0e5,0x1c5));var _0x5f0e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf0e5[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x5f0e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f0e('0x1'));var db=require(_0x5f0e('0x2'))['db'];var utils=require(_0x5f0e('0x3'));var logger=require(_0x5f0e('0x4'))(_0x5f0e('0x5'));var config=require(_0x5f0e('0x6'));var jayson=require(_0x5f0e('0x7'));var client=jayson[_0x5f0e('0x8')][_0x5f0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e6052,_0x39db73,_0x5dad75){return new BPromise(function(_0x4f861b,_0x2c3073){return client[_0x5f0e('0xa')](_0x1e6052,_0x5dad75)[_0x5f0e('0xb')](function(_0x5cfd20){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x39db73,_0x5f0e('0xc'));logger[_0x5f0e('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x39db73,'request\x20sent',JSON[_0x5f0e('0xe')](_0x5cfd20));if(_0x5cfd20[_0x5f0e('0xf')]){if(_0x5cfd20['error'][_0x5f0e('0x10')]===0x1f4){logger[_0x5f0e('0xf')](_0x5f0e('0x11'),_0x39db73,_0x5cfd20[_0x5f0e('0xf')]['message']);return _0x2c3073(_0x5cfd20['error']['message']);}logger['error'](_0x5f0e('0x11'),_0x39db73,_0x5cfd20[_0x5f0e('0xf')][_0x5f0e('0x12')]);return _0x4f861b(_0x5cfd20['error']['message']);}else{logger[_0x5f0e('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x39db73,_0x5f0e('0xc'));_0x4f861b(_0x5cfd20[_0x5f0e('0x14')][_0x5f0e('0x12')]);}})[_0x5f0e('0x15')](function(_0x3c1f62){logger[_0x5f0e('0xf')](_0x5f0e('0x11'),_0x39db73,_0x3c1f62);_0x2c3073(_0x3c1f62);});});}exports[_0x5f0e('0x16')]=function(_0x264475){var _0x144619=this;return new Promise(function(_0x26f536,_0x4f186f){return db['SugarcrmAccount'][_0x5f0e('0x17')]({'raw':_0x264475[_0x5f0e('0x18')]?_0x264475['options'][_0x5f0e('0x19')]===undefined?!![]:![]:!![],'where':_0x264475['options']?_0x264475[_0x5f0e('0x18')][_0x5f0e('0x1a')]||null:null,'attributes':_0x264475['options']?_0x264475[_0x5f0e('0x18')][_0x5f0e('0x1b')]||null:null,'limit':_0x264475['options']?_0x264475[_0x5f0e('0x18')]['limit']||null:null,'include':_0x264475['options']?_0x264475['options'][_0x5f0e('0x1c')]?_['map'](_0x264475['options'][_0x5f0e('0x1c')],function(_0x446d58){return{'model':db[_0x446d58[_0x5f0e('0x1d')]],'as':_0x446d58['as'],'attributes':_0x446d58[_0x5f0e('0x1b')],'include':_0x446d58[_0x5f0e('0x1c')]?_['map'](_0x446d58[_0x5f0e('0x1c')],function(_0x856b47){return{'model':db[_0x856b47[_0x5f0e('0x1d')]],'as':_0x856b47['as'],'attributes':_0x856b47['attributes'],'include':_0x856b47[_0x5f0e('0x1c')]?_['map'](_0x856b47[_0x5f0e('0x1c')],function(_0x11eead){return{'model':db[_0x11eead[_0x5f0e('0x1d')]],'as':_0x11eead['as'],'attributes':_0x11eead['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f0e('0xb')](function(_0x3d2d82){logger[_0x5f0e('0x13')](_0x5f0e('0x16'),_0x264475);logger[_0x5f0e('0xd')](_0x5f0e('0x16'),_0x264475,JSON[_0x5f0e('0xe')](_0x3d2d82));_0x26f536(_0x3d2d82);})[_0x5f0e('0x15')](function(_0x340c56){logger[_0x5f0e('0xf')](_0x5f0e('0x16'),_0x340c56[_0x5f0e('0x12')],_0x264475);_0x4f186f(_0x144619[_0x5f0e('0xf')](0x1f4,_0x340c56[_0x5f0e('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x4378dc){var _0x160804=this;return new Promise(function(_0x3ba0c6,_0x142e96){return db['SugarcrmAccount']['find']({'raw':_0x4378dc['options']?_0x4378dc[_0x5f0e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4378dc[_0x5f0e('0x18')]?_0x4378dc['options'][_0x5f0e('0x1a')]||null:null,'attributes':_0x4378dc[_0x5f0e('0x18')]?_0x4378dc[_0x5f0e('0x18')][_0x5f0e('0x1b')]||null:null,'include':_0x4378dc[_0x5f0e('0x18')]?_0x4378dc[_0x5f0e('0x18')]['include']?_[_0x5f0e('0x1e')](_0x4378dc[_0x5f0e('0x18')][_0x5f0e('0x1c')],function(_0x2e46cd){return{'model':db[_0x2e46cd[_0x5f0e('0x1d')]],'as':_0x2e46cd['as'],'attributes':_0x2e46cd[_0x5f0e('0x1b')],'include':_0x2e46cd[_0x5f0e('0x1c')]?_['map'](_0x2e46cd[_0x5f0e('0x1c')],function(_0x1a5f40){return{'model':db[_0x1a5f40['model']],'as':_0x1a5f40['as'],'attributes':_0x1a5f40[_0x5f0e('0x1b')],'include':_0x1a5f40[_0x5f0e('0x1c')]?_[_0x5f0e('0x1e')](_0x1a5f40['include'],function(_0x2be239){return{'model':db[_0x2be239['model']],'as':_0x2be239['as'],'attributes':_0x2be239[_0x5f0e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5f0e('0xb')](function(_0xb06c7b){logger[_0x5f0e('0x13')]('ShowSugarcrmAccount',_0x4378dc);logger[_0x5f0e('0xd')](_0x5f0e('0x1f'),_0x4378dc,JSON['stringify'](_0xb06c7b));_0x3ba0c6(_0xb06c7b);})[_0x5f0e('0x15')](function(_0x3f1c00){logger[_0x5f0e('0xf')]('ShowSugarcrmAccount',_0x3f1c00['message'],_0x4378dc);_0x142e96(_0x160804['error'](0x1f4,_0x3f1c00[_0x5f0e('0x12')]));});});}; \ No newline at end of file +var _0x81ae=['include','map','model','attributes','then','stringify','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit'];(function(_0x5e14af,_0x530c51){var _0x7f41af=function(_0x41e21){while(--_0x41e21){_0x5e14af['push'](_0x5e14af['shift']());}};_0x7f41af(++_0x530c51);}(_0x81ae,0xfd));var _0xe81a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x81ae[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe81a('0x0'));var util=require('util');var moment=require(_0xe81a('0x1'));var BPromise=require(_0xe81a('0x2'));var rs=require(_0xe81a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe81a('0x4'))(_0xe81a('0x5'));var config=require(_0xe81a('0x6'));var jayson=require(_0xe81a('0x7'));var client=jayson[_0xe81a('0x8')][_0xe81a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7421cf,_0x9f0b49,_0x126fc7){return new BPromise(function(_0x230649,_0x57be35){return client[_0xe81a('0xa')](_0x7421cf,_0x126fc7)['then'](function(_0x51743a){logger[_0xe81a('0xb')](_0xe81a('0xc'),_0x9f0b49,_0xe81a('0xd'));logger[_0xe81a('0xe')](_0xe81a('0xf'),_0x9f0b49,'request\x20sent',JSON['stringify'](_0x51743a));if(_0x51743a[_0xe81a('0x10')]){if(_0x51743a[_0xe81a('0x10')]['code']===0x1f4){logger[_0xe81a('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x9f0b49,_0x51743a[_0xe81a('0x10')]['message']);return _0x57be35(_0x51743a[_0xe81a('0x10')][_0xe81a('0x11')]);}logger[_0xe81a('0x10')](_0xe81a('0xc'),_0x9f0b49,_0x51743a[_0xe81a('0x10')][_0xe81a('0x11')]);return _0x230649(_0x51743a['error'][_0xe81a('0x11')]);}else{logger[_0xe81a('0xb')](_0xe81a('0xc'),_0x9f0b49,'request\x20sent');_0x230649(_0x51743a[_0xe81a('0x12')][_0xe81a('0x11')]);}})[_0xe81a('0x13')](function(_0x12665c){logger[_0xe81a('0x10')](_0xe81a('0xc'),_0x9f0b49,_0x12665c);_0x57be35(_0x12665c);});});}exports[_0xe81a('0x14')]=function(_0x250036){var _0x4167c2=this;return new Promise(function(_0x375a8c,_0x44bc35){return db[_0xe81a('0x15')][_0xe81a('0x16')]({'raw':_0x250036[_0xe81a('0x17')]?_0x250036['options'][_0xe81a('0x18')]===undefined?!![]:![]:!![],'where':_0x250036[_0xe81a('0x17')]?_0x250036[_0xe81a('0x17')][_0xe81a('0x19')]||null:null,'attributes':_0x250036[_0xe81a('0x17')]?_0x250036[_0xe81a('0x17')]['attributes']||null:null,'limit':_0x250036[_0xe81a('0x17')]?_0x250036[_0xe81a('0x17')][_0xe81a('0x1a')]||null:null,'include':_0x250036[_0xe81a('0x17')]?_0x250036[_0xe81a('0x17')][_0xe81a('0x1b')]?_[_0xe81a('0x1c')](_0x250036[_0xe81a('0x17')]['include'],function(_0x499e62){return{'model':db[_0x499e62[_0xe81a('0x1d')]],'as':_0x499e62['as'],'attributes':_0x499e62[_0xe81a('0x1e')],'include':_0x499e62[_0xe81a('0x1b')]?_[_0xe81a('0x1c')](_0x499e62['include'],function(_0x71d3e8){return{'model':db[_0x71d3e8[_0xe81a('0x1d')]],'as':_0x71d3e8['as'],'attributes':_0x71d3e8['attributes'],'include':_0x71d3e8[_0xe81a('0x1b')]?_[_0xe81a('0x1c')](_0x71d3e8[_0xe81a('0x1b')],function(_0x2b3fe0){return{'model':db[_0x2b3fe0[_0xe81a('0x1d')]],'as':_0x2b3fe0['as'],'attributes':_0x2b3fe0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe81a('0x1f')](function(_0x466798){logger['info'](_0xe81a('0x14'),_0x250036);logger[_0xe81a('0xe')]('GetSugarcrmAccount',_0x250036,JSON[_0xe81a('0x20')](_0x466798));_0x375a8c(_0x466798);})['catch'](function(_0x2a9bbb){logger[_0xe81a('0x10')](_0xe81a('0x14'),_0x2a9bbb['message'],_0x250036);_0x44bc35(_0x4167c2['error'](0x1f4,_0x2a9bbb[_0xe81a('0x11')]));});});};exports[_0xe81a('0x21')]=function(_0x454c00){var _0x2c6ef5=this;return new Promise(function(_0x572188,_0x148cc2){return db['SugarcrmAccount'][_0xe81a('0x22')]({'raw':_0x454c00[_0xe81a('0x17')]?_0x454c00[_0xe81a('0x17')][_0xe81a('0x18')]===undefined?!![]:![]:!![],'where':_0x454c00[_0xe81a('0x17')]?_0x454c00[_0xe81a('0x17')][_0xe81a('0x19')]||null:null,'attributes':_0x454c00[_0xe81a('0x17')]?_0x454c00[_0xe81a('0x17')][_0xe81a('0x1e')]||null:null,'include':_0x454c00['options']?_0x454c00[_0xe81a('0x17')][_0xe81a('0x1b')]?_['map'](_0x454c00['options'][_0xe81a('0x1b')],function(_0x1d7570){return{'model':db[_0x1d7570[_0xe81a('0x1d')]],'as':_0x1d7570['as'],'attributes':_0x1d7570['attributes'],'include':_0x1d7570[_0xe81a('0x1b')]?_[_0xe81a('0x1c')](_0x1d7570[_0xe81a('0x1b')],function(_0x2c8657){return{'model':db[_0x2c8657[_0xe81a('0x1d')]],'as':_0x2c8657['as'],'attributes':_0x2c8657['attributes'],'include':_0x2c8657[_0xe81a('0x1b')]?_[_0xe81a('0x1c')](_0x2c8657[_0xe81a('0x1b')],function(_0x801d7e){return{'model':db[_0x801d7e['model']],'as':_0x801d7e['as'],'attributes':_0x801d7e[_0xe81a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe81a('0x1f')](function(_0x5ef93a){logger[_0xe81a('0xb')](_0xe81a('0x21'),_0x454c00);logger['debug'](_0xe81a('0x21'),_0x454c00,JSON['stringify'](_0x5ef93a));_0x572188(_0x5ef93a);})['catch'](function(_0xe26ec2){logger['error'](_0xe81a('0x21'),_0xe26ec2[_0xe81a('0x11')],_0x454c00);_0x148cc2(_0x2c6ef5[_0xe81a('0x10')](0x1f4,_0xe26ec2[_0xe81a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2c69676..9864217 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 _0xa724=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','exports','multer','util','connect-timeout'];(function(_0x588521,_0x11e715){var _0x314ebc=function(_0x510e39){while(--_0x510e39){_0x588521['push'](_0x588521['shift']());}};_0x314ebc(++_0x11e715);}(_0xa724,0x13d));var _0x4a72=function(_0x182721,_0x47f1b5){_0x182721=_0x182721-0x0;var _0x1cfb11=_0xa724[_0x182721];return _0x1cfb11;};'use strict';var multer=require(_0x4a72('0x0'));var util=require(_0x4a72('0x1'));var path=require('path');var timeout=require(_0x4a72('0x2'));var express=require(_0x4a72('0x3'));var router=express[_0x4a72('0x4')]();var fs_extra=require(_0x4a72('0x5'));var auth=require(_0x4a72('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4a72('0x7'));var controller=require(_0x4a72('0x8'));router[_0x4a72('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4a72('0x9')](_0x4a72('0xa'),auth[_0x4a72('0xb')](),controller[_0x4a72('0xc')]);router[_0x4a72('0x9')](_0x4a72('0xd'),auth[_0x4a72('0xb')](),controller[_0x4a72('0xe')]);router[_0x4a72('0x9')](_0x4a72('0xf'),auth[_0x4a72('0xb')](),controller['getSubjects']);router[_0x4a72('0x9')](_0x4a72('0x10'),auth[_0x4a72('0xb')](),controller[_0x4a72('0x11')]);router['post']('/',auth[_0x4a72('0xb')](),controller[_0x4a72('0x12')]);router['put'](_0x4a72('0xa'),auth[_0x4a72('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4a72('0x13')]=router; \ No newline at end of file +var _0x8936=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x8936,0x191));var _0x6893=function(_0x2b6482,_0x95e8a8){_0x2b6482=_0x2b6482-0x0;var _0x53e68f=_0x8936[_0x2b6482];return _0x53e68f;};'use strict';var multer=require(_0x6893('0x0'));var util=require(_0x6893('0x1'));var path=require(_0x6893('0x2'));var timeout=require('connect-timeout');var express=require(_0x6893('0x3'));var router=express[_0x6893('0x4')]();var fs_extra=require(_0x6893('0x5'));var auth=require(_0x6893('0x6'));var interaction=require(_0x6893('0x7'));var config=require('../../config/environment');var controller=require(_0x6893('0x8'));router[_0x6893('0x9')]('/',auth[_0x6893('0xa')](),controller[_0x6893('0xb')]);router['get'](_0x6893('0xc'),auth[_0x6893('0xa')](),controller[_0x6893('0xd')]);router['get']('/:id/fields',auth[_0x6893('0xa')](),controller[_0x6893('0xe')]);router[_0x6893('0x9')](_0x6893('0xf'),auth[_0x6893('0xa')](),controller['getSubjects']);router['get'](_0x6893('0x10'),auth[_0x6893('0xa')](),controller['getDescriptions']);router[_0x6893('0x11')]('/',auth['isAuthenticated'](),controller[_0x6893('0x12')]);router[_0x6893('0x13')](_0x6893('0xc'),auth[_0x6893('0xa')](),controller[_0x6893('0x14')]);router[_0x6893('0x15')](_0x6893('0xc'),auth[_0x6893('0xa')](),controller[_0x6893('0x16')]);module[_0x6893('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index d518bf5..b21ae15 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 _0x5b5d=['sequelize','exports','STRING'];(function(_0x3b3718,_0x5e1cbc){var _0x1253bf=function(_0x158c3b){while(--_0x158c3b){_0x3b3718['push'](_0x3b3718['shift']());}};_0x1253bf(++_0x5e1cbc);}(_0x5b5d,0x168));var _0xd5b5=function(_0x24a291,_0x4d03f7){_0x24a291=_0x24a291-0x0;var _0x5c3ea3=_0x5b5d[_0x24a291];return _0x5c3ea3;};'use strict';var Sequelize=require(_0xd5b5('0x0'));module[_0xd5b5('0x1')]={'name':{'type':Sequelize[_0xd5b5('0x2')]},'description':{'type':Sequelize[_0xd5b5('0x2')]}}; \ No newline at end of file +var _0x6e40=['sequelize','exports','STRING'];(function(_0x322257,_0xd267a7){var _0x40aa7e=function(_0x482f39){while(--_0x482f39){_0x322257['push'](_0x322257['shift']());}};_0x40aa7e(++_0xd267a7);}(_0x6e40,0x147));var _0x06e4=function(_0x515b67,_0x36d509){_0x515b67=_0x515b67-0x0;var _0x4ca7e9=_0x6e40[_0x515b67];return _0x4ca7e9;};'use strict';var Sequelize=require(_0x06e4('0x0'));module[_0x06e4('0x1')]={'name':{'type':Sequelize[_0x06e4('0x2')]},'description':{'type':Sequelize[_0x06e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 74f194d..431d2d0 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 _0xc0ce=['merge','VIRTUAL','includeAll','findAll','catch','params','include','options','find','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','hasOwnProperty','getDescriptions','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','end','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','filters','filter'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc0ce,0x1ce));var _0xec0c=function(_0x383ddd,_0x1c44b7){_0x383ddd=_0x383ddd-0x0;var _0x2ca133=_0xc0ce[_0x383ddd];return _0x2ca133;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec0c('0x0'));var jsonpatch=require(_0xec0c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec0c('0x2'));var Mustache=require(_0xec0c('0x3'));var util=require(_0xec0c('0x4'));var path=require('path');var sox=require(_0xec0c('0x5'));var csv=require('to-csv');var ejs=require(_0xec0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec0c('0x7'));var squel=require(_0xec0c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xec0c('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xec0c('0xa'));var Redis=require(_0xec0c('0xb'));var authService=require(_0xec0c('0xc'));var qs=require(_0xec0c('0xd'));var as=require(_0xec0c('0xe'));var hardwareService=require(_0xec0c('0xf'));var logger=require('../../config/logger')(_0xec0c('0x10'));var utils=require(_0xec0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xec0c('0x12'));var db=require(_0xec0c('0x13'))['db'];function respondWithStatusCode(_0x3fce44,_0x61a711){_0x61a711=_0x61a711||0xcc;return function(_0x549b56){if(_0x549b56){return _0x3fce44[_0xec0c('0x14')](_0x61a711);}return _0x3fce44[_0xec0c('0x15')](_0x61a711)['end']();};}function respondWithResult(_0x5f392a,_0x161cab){_0x161cab=_0x161cab||0xc8;return function(_0x1464a4){if(_0x1464a4){return _0x5f392a['status'](_0x161cab)[_0xec0c('0x16')](_0x1464a4);}};}function respondWithFilteredResult(_0x156218,_0x3e73ab){return function(_0x168de){if(_0x168de){var _0x1fe23a=typeof _0x3e73ab[_0xec0c('0x17')]==='undefined'&&typeof _0x3e73ab[_0xec0c('0x18')]===_0xec0c('0x19');var _0x40ed9b=_0x168de['count'];var _0x12741d=_0x1fe23a?0x0:_0x3e73ab[_0xec0c('0x17')];var _0x376a59=_0x1fe23a?_0x168de[_0xec0c('0x1a')]:_0x3e73ab[_0xec0c('0x17')]+_0x3e73ab[_0xec0c('0x18')];var _0xd69e47;if(_0x376a59>=_0x40ed9b){_0x376a59=_0x40ed9b;_0xd69e47=0xc8;}else{_0xd69e47=0xce;}_0x156218[_0xec0c('0x15')](_0xd69e47);return _0x156218[_0xec0c('0x1b')]('Content-Range',_0x12741d+'-'+_0x376a59+'/'+_0x40ed9b)[_0xec0c('0x16')](_0x168de);}return null;};}function patchUpdates(_0x9033a4){return function(_0x1527f0){try{jsonpatch['apply'](_0x1527f0,_0x9033a4,!![]);}catch(_0xfadf){return BPromise[_0xec0c('0x1c')](_0xfadf);}return _0x1527f0[_0xec0c('0x1d')]();};}function saveUpdates(_0x2e0345,_0x473537){return function(_0x5c5b70){if(_0x5c5b70){return _0x5c5b70['update'](_0x2e0345)[_0xec0c('0x1e')](function(_0x3a19d6){return _0x3a19d6;});}return null;};}function removeEntity(_0x366cd0,_0x30b732){return function(_0x2ea5f3){if(_0x2ea5f3){return _0x2ea5f3[_0xec0c('0x1f')]()[_0xec0c('0x1e')](function(){_0x366cd0[_0xec0c('0x15')](0xcc)[_0xec0c('0x20')]();});}};}function handleEntityNotFound(_0x10e380,_0x49afd1){return function(_0xcadff2){if(!_0xcadff2){_0x10e380[_0xec0c('0x14')](0x194);}return _0xcadff2;};}function handleError(_0x472e88,_0x1d15c){_0x1d15c=_0x1d15c||0x1f4;return function(_0x525e0d){logger[_0xec0c('0x21')](_0x525e0d[_0xec0c('0x22')]);if(_0x525e0d['name']){delete _0x525e0d[_0xec0c('0x23')];}_0x472e88[_0xec0c('0x15')](_0x1d15c)['send'](_0x525e0d);};}exports[_0xec0c('0x24')]=function(_0x3496d9,_0x1d5043){var _0x3c413d={},_0x316b9b={},_0x52f299={'count':0x0,'rows':[]};var _0x1ff0a4=_[_0xec0c('0x25')](db[_0xec0c('0x26')][_0xec0c('0x27')],function(_0x48552a){return{'name':_0x48552a[_0xec0c('0x28')],'type':_0x48552a[_0xec0c('0x29')][_0xec0c('0x2a')]};});_0x316b9b['model']=_[_0xec0c('0x25')](_0x1ff0a4,_0xec0c('0x23'));_0x316b9b['query']=_[_0xec0c('0x2b')](_0x3496d9['query']);_0x316b9b['filters']=_[_0xec0c('0x2c')](_0x316b9b[_0xec0c('0x2d')],_0x316b9b[_0xec0c('0x2e')]);_0x3c413d[_0xec0c('0x2f')]=_['intersection'](_0x316b9b[_0xec0c('0x2d')],qs[_0xec0c('0x30')](_0x3496d9[_0xec0c('0x2e')][_0xec0c('0x30')]));_0x3c413d[_0xec0c('0x2f')]=_0x3c413d[_0xec0c('0x2f')][_0xec0c('0x31')]?_0x3c413d[_0xec0c('0x2f')]:_0x316b9b['model'];if(!_0x3496d9[_0xec0c('0x2e')]['hasOwnProperty'](_0xec0c('0x32'))){_0x3c413d[_0xec0c('0x18')]=qs[_0xec0c('0x18')](_0x3496d9[_0xec0c('0x2e')][_0xec0c('0x18')]);_0x3c413d[_0xec0c('0x17')]=qs[_0xec0c('0x17')](_0x3496d9[_0xec0c('0x2e')][_0xec0c('0x17')]);}_0x3c413d[_0xec0c('0x33')]=qs[_0xec0c('0x34')](_0x3496d9[_0xec0c('0x2e')][_0xec0c('0x34')]);_0x3c413d[_0xec0c('0x35')]=qs['filters'](_['pick'](_0x3496d9[_0xec0c('0x2e')],_0x316b9b[_0xec0c('0x36')]),_0x1ff0a4);if(_0x3496d9[_0xec0c('0x2e')][_0xec0c('0x37')]){_0x3c413d['where']=_[_0xec0c('0x38')](_0x3c413d['where'],{'$or':_[_0xec0c('0x25')](_0x1ff0a4,function(_0x203c1c){if(_0x203c1c[_0xec0c('0x29')]!==_0xec0c('0x39')){var _0x595bfd={};_0x595bfd[_0x203c1c[_0xec0c('0x23')]]={'$like':'%'+_0x3496d9[_0xec0c('0x2e')][_0xec0c('0x37')]+'%'};return _0x595bfd;}})});}_0x3c413d=_[_0xec0c('0x38')]({},_0x3c413d,_0x3496d9['options']);var _0x42bb95={'where':_0x3c413d[_0xec0c('0x35')]};return db[_0xec0c('0x26')]['count'](_0x42bb95)['then'](function(_0x1c335d){_0x52f299[_0xec0c('0x1a')]=_0x1c335d;if(_0x3496d9[_0xec0c('0x2e')][_0xec0c('0x3a')]){_0x3c413d['include']=[{'all':!![]}];}return db[_0xec0c('0x26')][_0xec0c('0x3b')](_0x3c413d);})['then'](function(_0x5cde19){_0x52f299['rows']=_0x5cde19;return _0x52f299;})[_0xec0c('0x1e')](respondWithFilteredResult(_0x1d5043,_0x3c413d))[_0xec0c('0x3c')](handleError(_0x1d5043,null));};exports['show']=function(_0x104297,_0x34396b){var _0x49e43f={'raw':![],'where':{'id':_0x104297[_0xec0c('0x3d')]['id']}},_0x5d1e19={};_0x5d1e19[_0xec0c('0x2d')]=_[_0xec0c('0x2b')](db[_0xec0c('0x26')][_0xec0c('0x27')]);_0x5d1e19['query']=_['keys'](_0x104297['query']);_0x5d1e19[_0xec0c('0x36')]=_[_0xec0c('0x2c')](_0x5d1e19[_0xec0c('0x2d')],_0x5d1e19[_0xec0c('0x2e')]);_0x49e43f[_0xec0c('0x2f')]=_['intersection'](_0x5d1e19[_0xec0c('0x2d')],qs['fields'](_0x104297[_0xec0c('0x2e')][_0xec0c('0x30')]));_0x49e43f['attributes']=_0x49e43f[_0xec0c('0x2f')][_0xec0c('0x31')]?_0x49e43f[_0xec0c('0x2f')]:_0x5d1e19[_0xec0c('0x2d')];if(_0x104297['query'][_0xec0c('0x3a')]){_0x49e43f[_0xec0c('0x3e')]=[{'all':!![]}];}_0x49e43f=_[_0xec0c('0x38')]({},_0x49e43f,_0x104297[_0xec0c('0x3f')]);return db['SugarcrmConfiguration'][_0xec0c('0x40')](_0x49e43f)[_0xec0c('0x1e')](handleEntityNotFound(_0x34396b,null))['then'](respondWithResult(_0x34396b,null))[_0xec0c('0x3c')](handleError(_0x34396b,null));};exports[_0xec0c('0x41')]=function(_0x181168,_0x12a2e6){return db['SugarcrmConfiguration'][_0xec0c('0x41')](_0x181168[_0xec0c('0x42')],{})[_0xec0c('0x1e')](respondWithResult(_0x12a2e6,0xc9))[_0xec0c('0x3c')](handleError(_0x12a2e6,null));};exports['update']=function(_0x30dc55,_0xadc1ed){if(_0x30dc55[_0xec0c('0x42')]['id']){delete _0x30dc55[_0xec0c('0x42')]['id'];}return db[_0xec0c('0x26')][_0xec0c('0x40')]({'where':{'id':_0x30dc55[_0xec0c('0x3d')]['id']}})[_0xec0c('0x1e')](handleEntityNotFound(_0xadc1ed,null))[_0xec0c('0x1e')](saveUpdates(_0x30dc55[_0xec0c('0x42')],null))[_0xec0c('0x1e')](respondWithResult(_0xadc1ed,null))[_0xec0c('0x3c')](handleError(_0xadc1ed,null));};exports['destroy']=function(_0x48c3a8,_0x361de4){return db[_0xec0c('0x26')][_0xec0c('0x40')]({'where':{'id':_0x48c3a8['params']['id']}})[_0xec0c('0x1e')](handleEntityNotFound(_0x361de4,null))[_0xec0c('0x1e')](removeEntity(_0x361de4,null))[_0xec0c('0x3c')](handleError(_0x361de4,null));};exports[_0xec0c('0x43')]=function(_0x317b30,_0x253857,_0x46c2ab){var _0x36053e={};var _0x315ff8={};var _0x52039b;var _0x562708;return db[_0xec0c('0x26')][_0xec0c('0x44')]({'where':{'id':_0x317b30[_0xec0c('0x3d')]['id']}})[_0xec0c('0x1e')](handleEntityNotFound(_0x253857,null))[_0xec0c('0x1e')](function(_0x6a8920){if(_0x6a8920){_0x52039b=_0x6a8920;_0x315ff8[_0xec0c('0x2d')]=_[_0xec0c('0x2b')](db[_0xec0c('0x45')]['rawAttributes']);_0x315ff8['query']=_[_0xec0c('0x2b')](_0x317b30[_0xec0c('0x2e')]);_0x315ff8[_0xec0c('0x36')]=_['intersection'](_0x315ff8['model'],_0x315ff8[_0xec0c('0x2e')]);_0x36053e['attributes']=_[_0xec0c('0x2c')](_0x315ff8[_0xec0c('0x2d')],qs[_0xec0c('0x30')](_0x317b30[_0xec0c('0x2e')]['fields']));_0x36053e[_0xec0c('0x2f')]=_0x36053e[_0xec0c('0x2f')][_0xec0c('0x31')]?_0x36053e[_0xec0c('0x2f')]:_0x315ff8[_0xec0c('0x2d')];_0x36053e['order']=qs[_0xec0c('0x34')](_0x317b30[_0xec0c('0x2e')]['sort']);_0x36053e['where']=qs['filters'](_[_0xec0c('0x46')](_0x317b30[_0xec0c('0x2e')],_0x315ff8[_0xec0c('0x36')]));if(_0x317b30[_0xec0c('0x2e')][_0xec0c('0x37')]){_0x36053e[_0xec0c('0x35')]=_['merge'](_0x36053e[_0xec0c('0x35')],{'$or':_['map'](_0x36053e[_0xec0c('0x2f')],function(_0x535bce){var _0x28d7d9={};_0x28d7d9[_0x535bce]={'$like':'%'+_0x317b30[_0xec0c('0x2e')][_0xec0c('0x37')]+'%'};return _0x28d7d9;})});}_0x36053e=_[_0xec0c('0x38')]({},_0x36053e,_0x317b30[_0xec0c('0x3f')]);return _0x52039b[_0xec0c('0x43')](_0x36053e);}})['then'](function(_0x1990cf){if(_0x1990cf){_0x562708=_0x1990cf[_0xec0c('0x31')];if(!_0x317b30[_0xec0c('0x2e')]['hasOwnProperty'](_0xec0c('0x32'))){_0x36053e['limit']=qs[_0xec0c('0x18')](_0x317b30[_0xec0c('0x2e')][_0xec0c('0x18')]);_0x36053e[_0xec0c('0x17')]=qs['offset'](_0x317b30[_0xec0c('0x2e')]['offset']);}return _0x52039b[_0xec0c('0x43')](_0x36053e);}})[_0xec0c('0x1e')](function(_0x1f71f0){if(_0x1f71f0){return _0x1f71f0?{'count':_0x562708,'rows':_0x1f71f0}:null;}})[_0xec0c('0x1e')](respondWithResult(_0x253857,null))[_0xec0c('0x3c')](handleError(_0x253857,null));};exports[_0xec0c('0x47')]=function(_0x502960,_0x458624,_0x41512e){var _0x327d22={};var _0x5d646c={};var _0x35b30e;var _0x40853c;return db['SugarcrmConfiguration'][_0xec0c('0x44')]({'where':{'id':_0x502960[_0xec0c('0x3d')]['id']}})[_0xec0c('0x1e')](handleEntityNotFound(_0x458624,null))['then'](function(_0x3f596a){if(_0x3f596a){_0x35b30e=_0x3f596a;_0x5d646c[_0xec0c('0x2d')]=_['keys'](db[_0xec0c('0x45')][_0xec0c('0x27')]);_0x5d646c[_0xec0c('0x2e')]=_[_0xec0c('0x2b')](_0x502960[_0xec0c('0x2e')]);_0x5d646c[_0xec0c('0x36')]=_[_0xec0c('0x2c')](_0x5d646c[_0xec0c('0x2d')],_0x5d646c['query']);_0x327d22[_0xec0c('0x2f')]=_['intersection'](_0x5d646c[_0xec0c('0x2d')],qs[_0xec0c('0x30')](_0x502960[_0xec0c('0x2e')]['fields']));_0x327d22[_0xec0c('0x2f')]=_0x327d22[_0xec0c('0x2f')]['length']?_0x327d22[_0xec0c('0x2f')]:_0x5d646c['model'];_0x327d22['order']=qs['sort'](_0x502960[_0xec0c('0x2e')]['sort']);_0x327d22[_0xec0c('0x35')]=qs[_0xec0c('0x36')](_[_0xec0c('0x46')](_0x502960['query'],_0x5d646c['filters']));if(_0x502960[_0xec0c('0x2e')][_0xec0c('0x37')]){_0x327d22['where']=_['merge'](_0x327d22['where'],{'$or':_['map'](_0x327d22[_0xec0c('0x2f')],function(_0x6eb06b){var _0x1c541e={};_0x1c541e[_0x6eb06b]={'$like':'%'+_0x502960['query'][_0xec0c('0x37')]+'%'};return _0x1c541e;})});}_0x327d22=_[_0xec0c('0x38')]({},_0x327d22,_0x502960['options']);return _0x35b30e[_0xec0c('0x47')](_0x327d22);}})[_0xec0c('0x1e')](function(_0x5a87ac){if(_0x5a87ac){_0x40853c=_0x5a87ac[_0xec0c('0x31')];if(!_0x502960['query'][_0xec0c('0x48')](_0xec0c('0x32'))){_0x327d22['limit']=qs[_0xec0c('0x18')](_0x502960[_0xec0c('0x2e')]['limit']);_0x327d22[_0xec0c('0x17')]=qs[_0xec0c('0x17')](_0x502960[_0xec0c('0x2e')]['offset']);}return _0x35b30e[_0xec0c('0x47')](_0x327d22);}})['then'](function(_0x50be4b){if(_0x50be4b){return _0x50be4b?{'count':_0x40853c,'rows':_0x50be4b}:null;}})['then'](respondWithResult(_0x458624,null))[_0xec0c('0x3c')](handleError(_0x458624,null));};exports[_0xec0c('0x49')]=function(_0x3c0b6e,_0x1f4ce6,_0x176b92){var _0x16a375={};var _0x4eee72={};var _0x386888;var _0x38f731;return db[_0xec0c('0x26')][_0xec0c('0x44')]({'where':{'id':_0x3c0b6e[_0xec0c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1f4ce6,null))['then'](function(_0x549602){if(_0x549602){_0x386888=_0x549602;_0x4eee72[_0xec0c('0x2d')]=_[_0xec0c('0x2b')](db[_0xec0c('0x45')][_0xec0c('0x27')]);_0x4eee72[_0xec0c('0x2e')]=_[_0xec0c('0x2b')](_0x3c0b6e[_0xec0c('0x2e')]);_0x4eee72['filters']=_['intersection'](_0x4eee72[_0xec0c('0x2d')],_0x4eee72[_0xec0c('0x2e')]);_0x16a375[_0xec0c('0x2f')]=_[_0xec0c('0x2c')](_0x4eee72[_0xec0c('0x2d')],qs[_0xec0c('0x30')](_0x3c0b6e['query'][_0xec0c('0x30')]));_0x16a375[_0xec0c('0x2f')]=_0x16a375[_0xec0c('0x2f')]['length']?_0x16a375[_0xec0c('0x2f')]:_0x4eee72[_0xec0c('0x2d')];_0x16a375[_0xec0c('0x33')]=qs[_0xec0c('0x34')](_0x3c0b6e[_0xec0c('0x2e')]['sort']);_0x16a375[_0xec0c('0x35')]=qs[_0xec0c('0x36')](_[_0xec0c('0x46')](_0x3c0b6e[_0xec0c('0x2e')],_0x4eee72[_0xec0c('0x36')]));if(_0x3c0b6e[_0xec0c('0x2e')][_0xec0c('0x37')]){_0x16a375[_0xec0c('0x35')]=_['merge'](_0x16a375['where'],{'$or':_['map'](_0x16a375[_0xec0c('0x2f')],function(_0x4413ef){var _0x258748={};_0x258748[_0x4413ef]={'$like':'%'+_0x3c0b6e[_0xec0c('0x2e')][_0xec0c('0x37')]+'%'};return _0x258748;})});}_0x16a375=_[_0xec0c('0x38')]({},_0x16a375,_0x3c0b6e['options']);return _0x386888[_0xec0c('0x49')](_0x16a375);}})[_0xec0c('0x1e')](function(_0x56c547){if(_0x56c547){_0x38f731=_0x56c547[_0xec0c('0x31')];if(!_0x3c0b6e['query'][_0xec0c('0x48')](_0xec0c('0x32'))){_0x16a375[_0xec0c('0x18')]=qs[_0xec0c('0x18')](_0x3c0b6e[_0xec0c('0x2e')][_0xec0c('0x18')]);_0x16a375['offset']=qs[_0xec0c('0x17')](_0x3c0b6e[_0xec0c('0x2e')]['offset']);}return _0x386888[_0xec0c('0x49')](_0x16a375);}})[_0xec0c('0x1e')](function(_0x5f4351){if(_0x5f4351){return _0x5f4351?{'count':_0x38f731,'rows':_0x5f4351}:null;}})[_0xec0c('0x1e')](respondWithResult(_0x1f4ce6,null))[_0xec0c('0x3c')](handleError(_0x1f4ce6,null));}; \ No newline at end of file +var _0x0f4e=['map','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','params','getFields','keys','SugarcrmField','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','SugarcrmConfiguration','fieldName','key','model'];(function(_0x3b58d9,_0x27e4d0){var _0x142b81=function(_0x2753d6){while(--_0x2753d6){_0x3b58d9['push'](_0x3b58d9['shift']());}};_0x142b81(++_0x27e4d0);}(_0x0f4e,0x1d0));var _0xe0f4=function(_0x3497b5,_0x5775b8){_0x3497b5=_0x3497b5-0x0;var _0x9c5460=_0x0f4e[_0x3497b5];return _0x9c5460;};'use strict';var emlformat=require(_0xe0f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0f4('0x1'));var jsonpatch=require(_0xe0f4('0x2'));var rp=require('request-promise');var moment=require(_0xe0f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe0f4('0x4'));var util=require(_0xe0f4('0x5'));var path=require(_0xe0f4('0x6'));var sox=require(_0xe0f4('0x7'));var csv=require(_0xe0f4('0x8'));var ejs=require(_0xe0f4('0x9'));var fs=require('fs');var fs_extra=require(_0xe0f4('0xa'));var _=require(_0xe0f4('0xb'));var squel=require(_0xe0f4('0xc'));var crypto=require(_0xe0f4('0xd'));var jsforce=require(_0xe0f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe0f4('0x8'));var querystring=require(_0xe0f4('0xf'));var Papa=require(_0xe0f4('0x10'));var Redis=require(_0xe0f4('0x11'));var authService=require(_0xe0f4('0x12'));var qs=require(_0xe0f4('0x13'));var as=require(_0xe0f4('0x14'));var hardwareService=require(_0xe0f4('0x15'));var logger=require(_0xe0f4('0x16'))(_0xe0f4('0x17'));var utils=require(_0xe0f4('0x18'));var config=require(_0xe0f4('0x19'));var licenseUtil=require(_0xe0f4('0x1a'));var db=require(_0xe0f4('0x1b'))['db'];function respondWithStatusCode(_0x2ef71c,_0x117e6b){_0x117e6b=_0x117e6b||0xcc;return function(_0x1e7b88){if(_0x1e7b88){return _0x2ef71c[_0xe0f4('0x1c')](_0x117e6b);}return _0x2ef71c[_0xe0f4('0x1d')](_0x117e6b)[_0xe0f4('0x1e')]();};}function respondWithResult(_0x4fc38e,_0x12fd01){_0x12fd01=_0x12fd01||0xc8;return function(_0x37dd06){if(_0x37dd06){return _0x4fc38e['status'](_0x12fd01)[_0xe0f4('0x1f')](_0x37dd06);}};}function respondWithFilteredResult(_0x468e41,_0xa5dfc5){return function(_0x136e8f){if(_0x136e8f){var _0x3540e4=typeof _0xa5dfc5[_0xe0f4('0x20')]==='undefined'&&typeof _0xa5dfc5[_0xe0f4('0x21')]===_0xe0f4('0x22');var _0xa9bfa7=_0x136e8f[_0xe0f4('0x23')];var _0x21ecca=_0x3540e4?0x0:_0xa5dfc5[_0xe0f4('0x20')];var _0x471135=_0x3540e4?_0x136e8f[_0xe0f4('0x23')]:_0xa5dfc5[_0xe0f4('0x20')]+_0xa5dfc5[_0xe0f4('0x21')];var _0x2c547b;if(_0x471135>=_0xa9bfa7){_0x471135=_0xa9bfa7;_0x2c547b=0xc8;}else{_0x2c547b=0xce;}_0x468e41['status'](_0x2c547b);return _0x468e41[_0xe0f4('0x24')](_0xe0f4('0x25'),_0x21ecca+'-'+_0x471135+'/'+_0xa9bfa7)[_0xe0f4('0x1f')](_0x136e8f);}return null;};}function patchUpdates(_0x34f617){return function(_0x5dff68){try{jsonpatch[_0xe0f4('0x26')](_0x5dff68,_0x34f617,!![]);}catch(_0x570a36){return BPromise[_0xe0f4('0x27')](_0x570a36);}return _0x5dff68[_0xe0f4('0x28')]();};}function saveUpdates(_0x4b7c72,_0x365e48){return function(_0x7c9a02){if(_0x7c9a02){return _0x7c9a02[_0xe0f4('0x29')](_0x4b7c72)['then'](function(_0x28b244){return _0x28b244;});}return null;};}function removeEntity(_0x21c39c,_0x3f9bb9){return function(_0x5c1949){if(_0x5c1949){return _0x5c1949[_0xe0f4('0x2a')]()[_0xe0f4('0x2b')](function(){_0x21c39c[_0xe0f4('0x1d')](0xcc)[_0xe0f4('0x1e')]();});}};}function handleEntityNotFound(_0x40ee9f,_0x1a8dae){return function(_0x185756){if(!_0x185756){_0x40ee9f[_0xe0f4('0x1c')](0x194);}return _0x185756;};}function handleError(_0x4e0c3c,_0x3832a2){_0x3832a2=_0x3832a2||0x1f4;return function(_0x141107){logger['error'](_0x141107[_0xe0f4('0x2c')]);if(_0x141107[_0xe0f4('0x2d')]){delete _0x141107[_0xe0f4('0x2d')];}_0x4e0c3c['status'](_0x3832a2)[_0xe0f4('0x2e')](_0x141107);};}exports[_0xe0f4('0x2f')]=function(_0x133a86,_0x11af67){var _0x2a21dd={},_0x687070={},_0x4bf85b={'count':0x0,'rows':[]};var _0x4ef2cf=_['map'](db[_0xe0f4('0x30')]['rawAttributes'],function(_0x46b6ad){return{'name':_0x46b6ad[_0xe0f4('0x31')],'type':_0x46b6ad['type'][_0xe0f4('0x32')]};});_0x687070[_0xe0f4('0x33')]=_[_0xe0f4('0x34')](_0x4ef2cf,_0xe0f4('0x2d'));_0x687070['query']=_['keys'](_0x133a86['query']);_0x687070[_0xe0f4('0x35')]=_[_0xe0f4('0x36')](_0x687070[_0xe0f4('0x33')],_0x687070[_0xe0f4('0x37')]);_0x2a21dd['attributes']=_[_0xe0f4('0x36')](_0x687070[_0xe0f4('0x33')],qs['fields'](_0x133a86[_0xe0f4('0x37')][_0xe0f4('0x38')]));_0x2a21dd[_0xe0f4('0x39')]=_0x2a21dd['attributes'][_0xe0f4('0x3a')]?_0x2a21dd[_0xe0f4('0x39')]:_0x687070[_0xe0f4('0x33')];if(!_0x133a86[_0xe0f4('0x37')][_0xe0f4('0x3b')](_0xe0f4('0x3c'))){_0x2a21dd['limit']=qs[_0xe0f4('0x21')](_0x133a86[_0xe0f4('0x37')][_0xe0f4('0x21')]);_0x2a21dd[_0xe0f4('0x20')]=qs['offset'](_0x133a86[_0xe0f4('0x37')][_0xe0f4('0x20')]);}_0x2a21dd[_0xe0f4('0x3d')]=qs['sort'](_0x133a86['query'][_0xe0f4('0x3e')]);_0x2a21dd[_0xe0f4('0x3f')]=qs[_0xe0f4('0x35')](_[_0xe0f4('0x40')](_0x133a86[_0xe0f4('0x37')],_0x687070[_0xe0f4('0x35')]),_0x4ef2cf);if(_0x133a86[_0xe0f4('0x37')][_0xe0f4('0x41')]){_0x2a21dd[_0xe0f4('0x3f')]=_[_0xe0f4('0x42')](_0x2a21dd[_0xe0f4('0x3f')],{'$or':_[_0xe0f4('0x34')](_0x4ef2cf,function(_0x5d8f35){if(_0x5d8f35[_0xe0f4('0x43')]!=='VIRTUAL'){var _0x322e59={};_0x322e59[_0x5d8f35[_0xe0f4('0x2d')]]={'$like':'%'+_0x133a86['query'][_0xe0f4('0x41')]+'%'};return _0x322e59;}})});}_0x2a21dd=_[_0xe0f4('0x42')]({},_0x2a21dd,_0x133a86[_0xe0f4('0x44')]);var _0x52b152={'where':_0x2a21dd[_0xe0f4('0x3f')]};return db[_0xe0f4('0x30')][_0xe0f4('0x23')](_0x52b152)['then'](function(_0x13a553){_0x4bf85b[_0xe0f4('0x23')]=_0x13a553;if(_0x133a86[_0xe0f4('0x37')]['includeAll']){_0x2a21dd['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xe0f4('0x45')](_0x2a21dd);})[_0xe0f4('0x2b')](function(_0x1ff8c7){_0x4bf85b[_0xe0f4('0x46')]=_0x1ff8c7;return _0x4bf85b;})['then'](respondWithFilteredResult(_0x11af67,_0x2a21dd))[_0xe0f4('0x47')](handleError(_0x11af67,null));};exports[_0xe0f4('0x48')]=function(_0x50ffa4,_0x9541fb){var _0x4345b2={'raw':![],'where':{'id':_0x50ffa4['params']['id']}},_0x68f42a={};_0x68f42a[_0xe0f4('0x33')]=_['keys'](db[_0xe0f4('0x30')][_0xe0f4('0x49')]);_0x68f42a[_0xe0f4('0x37')]=_['keys'](_0x50ffa4['query']);_0x68f42a[_0xe0f4('0x35')]=_[_0xe0f4('0x36')](_0x68f42a['model'],_0x68f42a[_0xe0f4('0x37')]);_0x4345b2[_0xe0f4('0x39')]=_['intersection'](_0x68f42a[_0xe0f4('0x33')],qs[_0xe0f4('0x38')](_0x50ffa4[_0xe0f4('0x37')][_0xe0f4('0x38')]));_0x4345b2[_0xe0f4('0x39')]=_0x4345b2[_0xe0f4('0x39')][_0xe0f4('0x3a')]?_0x4345b2['attributes']:_0x68f42a[_0xe0f4('0x33')];if(_0x50ffa4[_0xe0f4('0x37')][_0xe0f4('0x4a')]){_0x4345b2[_0xe0f4('0x4b')]=[{'all':!![]}];}_0x4345b2=_[_0xe0f4('0x42')]({},_0x4345b2,_0x50ffa4[_0xe0f4('0x44')]);return db[_0xe0f4('0x30')][_0xe0f4('0x4c')](_0x4345b2)[_0xe0f4('0x2b')](handleEntityNotFound(_0x9541fb,null))[_0xe0f4('0x2b')](respondWithResult(_0x9541fb,null))[_0xe0f4('0x47')](handleError(_0x9541fb,null));};exports[_0xe0f4('0x4d')]=function(_0xf12d4d,_0x2911a4){return db[_0xe0f4('0x30')]['create'](_0xf12d4d['body'],{})[_0xe0f4('0x2b')](respondWithResult(_0x2911a4,0xc9))['catch'](handleError(_0x2911a4,null));};exports['update']=function(_0x177e72,_0x104494){if(_0x177e72[_0xe0f4('0x4e')]['id']){delete _0x177e72['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x177e72[_0xe0f4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x104494,null))[_0xe0f4('0x2b')](saveUpdates(_0x177e72['body'],null))[_0xe0f4('0x2b')](respondWithResult(_0x104494,null))[_0xe0f4('0x47')](handleError(_0x104494,null));};exports[_0xe0f4('0x2a')]=function(_0x2dcda7,_0x26c604){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2dcda7[_0xe0f4('0x4f')]['id']}})[_0xe0f4('0x2b')](handleEntityNotFound(_0x26c604,null))[_0xe0f4('0x2b')](removeEntity(_0x26c604,null))[_0xe0f4('0x47')](handleError(_0x26c604,null));};exports[_0xe0f4('0x50')]=function(_0x364aea,_0x608f6e,_0x92c1ea){var _0x38f220={};var _0x16c3e5={};var _0x4a3af5;var _0x5d5814;return db[_0xe0f4('0x30')]['findOne']({'where':{'id':_0x364aea[_0xe0f4('0x4f')]['id']}})[_0xe0f4('0x2b')](handleEntityNotFound(_0x608f6e,null))['then'](function(_0x1959dc){if(_0x1959dc){_0x4a3af5=_0x1959dc;_0x16c3e5[_0xe0f4('0x33')]=_[_0xe0f4('0x51')](db[_0xe0f4('0x52')][_0xe0f4('0x49')]);_0x16c3e5['query']=_[_0xe0f4('0x51')](_0x364aea['query']);_0x16c3e5['filters']=_[_0xe0f4('0x36')](_0x16c3e5[_0xe0f4('0x33')],_0x16c3e5['query']);_0x38f220['attributes']=_['intersection'](_0x16c3e5[_0xe0f4('0x33')],qs['fields'](_0x364aea[_0xe0f4('0x37')][_0xe0f4('0x38')]));_0x38f220[_0xe0f4('0x39')]=_0x38f220['attributes'][_0xe0f4('0x3a')]?_0x38f220['attributes']:_0x16c3e5[_0xe0f4('0x33')];_0x38f220[_0xe0f4('0x3d')]=qs[_0xe0f4('0x3e')](_0x364aea[_0xe0f4('0x37')][_0xe0f4('0x3e')]);_0x38f220['where']=qs[_0xe0f4('0x35')](_[_0xe0f4('0x40')](_0x364aea[_0xe0f4('0x37')],_0x16c3e5[_0xe0f4('0x35')]));if(_0x364aea[_0xe0f4('0x37')][_0xe0f4('0x41')]){_0x38f220[_0xe0f4('0x3f')]=_[_0xe0f4('0x42')](_0x38f220['where'],{'$or':_[_0xe0f4('0x34')](_0x38f220[_0xe0f4('0x39')],function(_0x214523){var _0x3b41fb={};_0x3b41fb[_0x214523]={'$like':'%'+_0x364aea['query'][_0xe0f4('0x41')]+'%'};return _0x3b41fb;})});}_0x38f220=_['merge']({},_0x38f220,_0x364aea[_0xe0f4('0x44')]);return _0x4a3af5[_0xe0f4('0x50')](_0x38f220);}})[_0xe0f4('0x2b')](function(_0x2da6bf){if(_0x2da6bf){_0x5d5814=_0x2da6bf[_0xe0f4('0x3a')];if(!_0x364aea['query'][_0xe0f4('0x3b')](_0xe0f4('0x3c'))){_0x38f220[_0xe0f4('0x21')]=qs[_0xe0f4('0x21')](_0x364aea[_0xe0f4('0x37')]['limit']);_0x38f220[_0xe0f4('0x20')]=qs[_0xe0f4('0x20')](_0x364aea[_0xe0f4('0x37')]['offset']);}return _0x4a3af5[_0xe0f4('0x50')](_0x38f220);}})['then'](function(_0x523f79){if(_0x523f79){return _0x523f79?{'count':_0x5d5814,'rows':_0x523f79}:null;}})[_0xe0f4('0x2b')](respondWithResult(_0x608f6e,null))[_0xe0f4('0x47')](handleError(_0x608f6e,null));};exports[_0xe0f4('0x53')]=function(_0x14383d,_0x5d263c,_0x10824d){var _0x13d44a={};var _0x5f2491={};var _0x272b63;var _0x662130;return db[_0xe0f4('0x30')]['findOne']({'where':{'id':_0x14383d[_0xe0f4('0x4f')]['id']}})[_0xe0f4('0x2b')](handleEntityNotFound(_0x5d263c,null))[_0xe0f4('0x2b')](function(_0x187580){if(_0x187580){_0x272b63=_0x187580;_0x5f2491[_0xe0f4('0x33')]=_[_0xe0f4('0x51')](db['SugarcrmField'][_0xe0f4('0x49')]);_0x5f2491[_0xe0f4('0x37')]=_[_0xe0f4('0x51')](_0x14383d[_0xe0f4('0x37')]);_0x5f2491[_0xe0f4('0x35')]=_[_0xe0f4('0x36')](_0x5f2491['model'],_0x5f2491[_0xe0f4('0x37')]);_0x13d44a['attributes']=_[_0xe0f4('0x36')](_0x5f2491[_0xe0f4('0x33')],qs['fields'](_0x14383d[_0xe0f4('0x37')][_0xe0f4('0x38')]));_0x13d44a['attributes']=_0x13d44a[_0xe0f4('0x39')]['length']?_0x13d44a['attributes']:_0x5f2491['model'];_0x13d44a['order']=qs[_0xe0f4('0x3e')](_0x14383d[_0xe0f4('0x37')][_0xe0f4('0x3e')]);_0x13d44a[_0xe0f4('0x3f')]=qs[_0xe0f4('0x35')](_[_0xe0f4('0x40')](_0x14383d[_0xe0f4('0x37')],_0x5f2491['filters']));if(_0x14383d['query']['filter']){_0x13d44a[_0xe0f4('0x3f')]=_[_0xe0f4('0x42')](_0x13d44a[_0xe0f4('0x3f')],{'$or':_[_0xe0f4('0x34')](_0x13d44a[_0xe0f4('0x39')],function(_0x3bb91e){var _0x1b2990={};_0x1b2990[_0x3bb91e]={'$like':'%'+_0x14383d[_0xe0f4('0x37')][_0xe0f4('0x41')]+'%'};return _0x1b2990;})});}_0x13d44a=_[_0xe0f4('0x42')]({},_0x13d44a,_0x14383d[_0xe0f4('0x44')]);return _0x272b63['getSubjects'](_0x13d44a);}})[_0xe0f4('0x2b')](function(_0x252f93){if(_0x252f93){_0x662130=_0x252f93[_0xe0f4('0x3a')];if(!_0x14383d['query']['hasOwnProperty'](_0xe0f4('0x3c'))){_0x13d44a[_0xe0f4('0x21')]=qs[_0xe0f4('0x21')](_0x14383d[_0xe0f4('0x37')]['limit']);_0x13d44a[_0xe0f4('0x20')]=qs[_0xe0f4('0x20')](_0x14383d[_0xe0f4('0x37')]['offset']);}return _0x272b63[_0xe0f4('0x53')](_0x13d44a);}})['then'](function(_0x514bb8){if(_0x514bb8){return _0x514bb8?{'count':_0x662130,'rows':_0x514bb8}:null;}})[_0xe0f4('0x2b')](respondWithResult(_0x5d263c,null))[_0xe0f4('0x47')](handleError(_0x5d263c,null));};exports[_0xe0f4('0x54')]=function(_0x2e6f25,_0x4fb466,_0x170cff){var _0x31429d={};var _0x3e4a01={};var _0x42a281;var _0x43ebc7;return db['SugarcrmConfiguration'][_0xe0f4('0x55')]({'where':{'id':_0x2e6f25[_0xe0f4('0x4f')]['id']}})[_0xe0f4('0x2b')](handleEntityNotFound(_0x4fb466,null))['then'](function(_0x38bcda){if(_0x38bcda){_0x42a281=_0x38bcda;_0x3e4a01[_0xe0f4('0x33')]=_['keys'](db[_0xe0f4('0x52')][_0xe0f4('0x49')]);_0x3e4a01[_0xe0f4('0x37')]=_[_0xe0f4('0x51')](_0x2e6f25['query']);_0x3e4a01[_0xe0f4('0x35')]=_['intersection'](_0x3e4a01[_0xe0f4('0x33')],_0x3e4a01[_0xe0f4('0x37')]);_0x31429d[_0xe0f4('0x39')]=_[_0xe0f4('0x36')](_0x3e4a01['model'],qs[_0xe0f4('0x38')](_0x2e6f25[_0xe0f4('0x37')][_0xe0f4('0x38')]));_0x31429d[_0xe0f4('0x39')]=_0x31429d[_0xe0f4('0x39')]['length']?_0x31429d[_0xe0f4('0x39')]:_0x3e4a01[_0xe0f4('0x33')];_0x31429d[_0xe0f4('0x3d')]=qs[_0xe0f4('0x3e')](_0x2e6f25[_0xe0f4('0x37')][_0xe0f4('0x3e')]);_0x31429d[_0xe0f4('0x3f')]=qs[_0xe0f4('0x35')](_[_0xe0f4('0x40')](_0x2e6f25[_0xe0f4('0x37')],_0x3e4a01['filters']));if(_0x2e6f25[_0xe0f4('0x37')][_0xe0f4('0x41')]){_0x31429d[_0xe0f4('0x3f')]=_[_0xe0f4('0x42')](_0x31429d['where'],{'$or':_[_0xe0f4('0x34')](_0x31429d[_0xe0f4('0x39')],function(_0x156506){var _0x540684={};_0x540684[_0x156506]={'$like':'%'+_0x2e6f25[_0xe0f4('0x37')][_0xe0f4('0x41')]+'%'};return _0x540684;})});}_0x31429d=_[_0xe0f4('0x42')]({},_0x31429d,_0x2e6f25[_0xe0f4('0x44')]);return _0x42a281['getDescriptions'](_0x31429d);}})[_0xe0f4('0x2b')](function(_0x4ecc6c){if(_0x4ecc6c){_0x43ebc7=_0x4ecc6c['length'];if(!_0x2e6f25[_0xe0f4('0x37')][_0xe0f4('0x3b')]('nolimit')){_0x31429d[_0xe0f4('0x21')]=qs[_0xe0f4('0x21')](_0x2e6f25[_0xe0f4('0x37')][_0xe0f4('0x21')]);_0x31429d[_0xe0f4('0x20')]=qs[_0xe0f4('0x20')](_0x2e6f25[_0xe0f4('0x37')][_0xe0f4('0x20')]);}return _0x42a281['getDescriptions'](_0x31429d);}})[_0xe0f4('0x2b')](function(_0xd2132f){if(_0xd2132f){return _0xd2132f?{'count':_0x43ebc7,'rows':_0xd2132f}:null;}})[_0xe0f4('0x2b')](respondWithResult(_0x4fb466,null))['catch'](handleError(_0x4fb466,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f6fdd84..10d055b 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 _0xc35b=['int_sugarcrm_configurations','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration'];(function(_0x481de7,_0x214a51){var _0x231d2e=function(_0x18ec1e){while(--_0x18ec1e){_0x481de7['push'](_0x481de7['shift']());}};_0x231d2e(++_0x214a51);}(_0xc35b,0xb5));var _0xbc35=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xc35b[_0x59c301];return _0x3866b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc35('0x0'))(_0xbc35('0x1'));var moment=require(_0xbc35('0x2'));var BPromise=require(_0xbc35('0x3'));var rp=require(_0xbc35('0x4'));var fs=require('fs');var path=require(_0xbc35('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbc35('0x6'));module['exports']=function(_0x388193,_0xe72df2){return _0x388193[_0xbc35('0x7')](_0xbc35('0x8'),attributes,{'tableName':_0xbc35('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3d8=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','../../config/logger'];(function(_0x466ec5,_0x198d73){var _0xddc4bd=function(_0xf6fa32){while(--_0xf6fa32){_0x466ec5['push'](_0x466ec5['shift']());}};_0xddc4bd(++_0x198d73);}(_0xc3d8,0x76));var _0x8c3d=function(_0x58cf05,_0x4608b7){_0x58cf05=_0x58cf05-0x0;var _0x4abad5=_0xc3d8[_0x58cf05];return _0x4abad5;};'use strict';var _=require(_0x8c3d('0x0'));var util=require(_0x8c3d('0x1'));var logger=require(_0x8c3d('0x2'))('api');var moment=require(_0x8c3d('0x3'));var BPromise=require(_0x8c3d('0x4'));var rp=require(_0x8c3d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c3d('0x6'));var config=require(_0x8c3d('0x7'));var attributes=require(_0x8c3d('0x8'));module[_0x8c3d('0x9')]=function(_0x2b102d,_0x239606){return _0x2b102d['define'](_0x8c3d('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index d6797b9..28560f7 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 _0xa761=['error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','stringify'];(function(_0xc3552c,_0x5aa37f){var _0x45e02c=function(_0x2a00be){while(--_0x2a00be){_0xc3552c['push'](_0xc3552c['shift']());}};_0x45e02c(++_0x5aa37f);}(_0xa761,0x125));var _0x1a76=function(_0x3699bd,_0x1a53b4){_0x3699bd=_0x3699bd-0x0;var _0x2628cc=_0xa761[_0x3699bd];return _0x2628cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a76('0x0'));var BPromise=require(_0x1a76('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a76('0x2'));var db=require(_0x1a76('0x3'))['db'];var utils=require(_0x1a76('0x4'));var logger=require('../../config/logger')(_0x1a76('0x5'));var config=require(_0x1a76('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1a76('0x7')][_0x1a76('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x160f5e,_0x2c58c5,_0x348d06){return new BPromise(function(_0x4c86ac,_0x4d8109){return client[_0x1a76('0x9')](_0x160f5e,_0x348d06)[_0x1a76('0xa')](function(_0x26159d){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c58c5,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2c58c5,_0x1a76('0xb'),JSON[_0x1a76('0xc')](_0x26159d));if(_0x26159d['error']){if(_0x26159d[_0x1a76('0xd')][_0x1a76('0xe')]===0x1f4){logger[_0x1a76('0xd')](_0x1a76('0xf'),_0x2c58c5,_0x26159d['error'][_0x1a76('0x10')]);return _0x4d8109(_0x26159d[_0x1a76('0xd')][_0x1a76('0x10')]);}logger[_0x1a76('0xd')](_0x1a76('0xf'),_0x2c58c5,_0x26159d[_0x1a76('0xd')]['message']);return _0x4c86ac(_0x26159d[_0x1a76('0xd')][_0x1a76('0x10')]);}else{logger[_0x1a76('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c58c5,_0x1a76('0xb'));_0x4c86ac(_0x26159d['result']['message']);}})['catch'](function(_0x38beec){logger[_0x1a76('0xd')](_0x1a76('0xf'),_0x2c58c5,_0x38beec);_0x4d8109(_0x38beec);});});} \ No newline at end of file +var _0x0006=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird'];(function(_0x46eada,_0x299a09){var _0x5f2e42=function(_0xa6d94e){while(--_0xa6d94e){_0x46eada['push'](_0x46eada['shift']());}};_0x5f2e42(++_0x299a09);}(_0x0006,0x131));var _0x6000=function(_0x81256c,_0x270bc5){_0x81256c=_0x81256c-0x0;var _0x2905f4=_0x0006[_0x81256c];return _0x2905f4;};'use strict';var _=require('lodash');var util=require(_0x6000('0x0'));var moment=require(_0x6000('0x1'));var BPromise=require(_0x6000('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6000('0x3'));var db=require(_0x6000('0x4'))['db'];var utils=require(_0x6000('0x5'));var logger=require(_0x6000('0x6'))(_0x6000('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6000('0x8')][_0x6000('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe061f4,_0x2c4f76,_0x5bb62c){return new BPromise(function(_0x5cf4f6,_0x4f64c8){return client[_0x6000('0xa')](_0xe061f4,_0x5bb62c)[_0x6000('0xb')](function(_0x534a09){logger[_0x6000('0xc')](_0x6000('0xd'),_0x2c4f76,_0x6000('0xe'));logger[_0x6000('0xf')](_0x6000('0x10'),_0x2c4f76,'request\x20sent',JSON['stringify'](_0x534a09));if(_0x534a09[_0x6000('0x11')]){if(_0x534a09[_0x6000('0x11')][_0x6000('0x12')]===0x1f4){logger[_0x6000('0x11')](_0x6000('0xd'),_0x2c4f76,_0x534a09[_0x6000('0x11')]['message']);return _0x4f64c8(_0x534a09[_0x6000('0x11')]['message']);}logger[_0x6000('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c4f76,_0x534a09['error'][_0x6000('0x13')]);return _0x5cf4f6(_0x534a09[_0x6000('0x11')][_0x6000('0x13')]);}else{logger[_0x6000('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c4f76,_0x6000('0xe'));_0x5cf4f6(_0x534a09[_0x6000('0x14')][_0x6000('0x13')]);}})[_0x6000('0x15')](function(_0x353bfe){logger[_0x6000('0x11')](_0x6000('0xd'),_0x2c4f76,_0x353bfe);_0x4f64c8(_0x353bfe);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 89cddc7..0c5640a 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 _0xd1e4=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2e1b20,_0x323396){var _0x4c3e1d=function(_0x23c69c){while(--_0x23c69c){_0x2e1b20['push'](_0x2e1b20['shift']());}};_0x4c3e1d(++_0x323396);}(_0xd1e4,0xc5));var _0x4d1e=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xd1e4[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x4d1e('0x0'));var util=require('util');var path=require(_0x4d1e('0x1'));var timeout=require(_0x4d1e('0x2'));var express=require(_0x4d1e('0x3'));var router=express[_0x4d1e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d1e('0x5'));var config=require(_0x4d1e('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x4d1e('0x7')]('/',auth[_0x4d1e('0x8')](),controller[_0x4d1e('0x9')]);router[_0x4d1e('0x7')](_0x4d1e('0xa'),auth[_0x4d1e('0x8')](),controller[_0x4d1e('0xb')]);router[_0x4d1e('0xc')]('/',auth[_0x4d1e('0x8')](),controller['create']);router[_0x4d1e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4d1e('0xe')]);router[_0x4d1e('0xf')](_0x4d1e('0xa'),auth[_0x4d1e('0x8')](),controller[_0x4d1e('0x10')]);module[_0x4d1e('0x11')]=router; \ No newline at end of file +var _0xffda=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4fcdcf,_0x8e28c7){var _0x2f82ca=function(_0x5c0bd0){while(--_0x5c0bd0){_0x4fcdcf['push'](_0x4fcdcf['shift']());}};_0x2f82ca(++_0x8e28c7);}(_0xffda,0x12e));var _0xaffd=function(_0x2cce64,_0x102e84){_0x2cce64=_0x2cce64-0x0;var _0x547158=_0xffda[_0x2cce64];return _0x547158;};'use strict';var multer=require(_0xaffd('0x0'));var util=require(_0xaffd('0x1'));var path=require(_0xaffd('0x2'));var timeout=require(_0xaffd('0x3'));var express=require('express');var router=express[_0xaffd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaffd('0x5'));var interaction=require(_0xaffd('0x6'));var config=require(_0xaffd('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xaffd('0x8')]('/',auth[_0xaffd('0x9')](),controller[_0xaffd('0xa')]);router[_0xaffd('0x8')](_0xaffd('0xb'),auth[_0xaffd('0x9')](),controller[_0xaffd('0xc')]);router[_0xaffd('0xd')]('/',auth[_0xaffd('0x9')](),controller['create']);router[_0xaffd('0xe')](_0xaffd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xaffd('0xf')](_0xaffd('0xb'),auth['isAuthenticated'](),controller[_0xaffd('0x10')]);module[_0xaffd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5119785..a68fdf6 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 _0x771d=['keyValue','STRING','variable','sequelize','exports','string','customVariable'];(function(_0x23c9da,_0x31bd69){var _0x12eacc=function(_0x54de03){while(--_0x54de03){_0x23c9da['push'](_0x23c9da['shift']());}};_0x12eacc(++_0x31bd69);}(_0x771d,0x13e));var _0xd771=function(_0x568cf2,_0x6ec4f4){_0x568cf2=_0x568cf2-0x0;var _0x32e883=_0x771d[_0x568cf2];return _0x32e883;};'use strict';var Sequelize=require(_0xd771('0x0'));module[_0xd771('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd771('0x2'),'variable',_0xd771('0x3'),_0xd771('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd771('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xd771('0x2'),_0xd771('0x6'),_0xd771('0x3'))},'keyContent':{'type':Sequelize[_0xd771('0x5')]},'idField':{'type':Sequelize[_0xd771('0x5')]},'nameField':{'type':Sequelize[_0xd771('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6994=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x4fc658,_0x293456){var _0x10c168=function(_0x20093f){while(--_0x20093f){_0x4fc658['push'](_0x4fc658['shift']());}};_0x10c168(++_0x293456);}(_0x6994,0x1c0));var _0x4699=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x6994[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require(_0x4699('0x0'));module[_0x4699('0x1')]={'type':{'type':Sequelize[_0x4699('0x2')](_0x4699('0x3'),_0x4699('0x4'),_0x4699('0x5'),_0x4699('0x6'),_0x4699('0x7')),'defaultValue':_0x4699('0x3')},'content':{'type':Sequelize[_0x4699('0x8')]},'key':{'type':Sequelize[_0x4699('0x8')]},'keyType':{'type':Sequelize[_0x4699('0x2')](_0x4699('0x3'),_0x4699('0x4'),_0x4699('0x5'))},'keyContent':{'type':Sequelize[_0x4699('0x8')]},'idField':{'type':Sequelize[_0x4699('0x8')]},'nameField':{'type':Sequelize[_0x4699('0x8')]},'customField':{'type':Sequelize[_0x4699('0x9')],'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 1cf88f8..7876afd 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 _0x2de2=['sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','update','body','params','eml-format','fast-json-patch','bluebird','mustache','util'];(function(_0x1a37e9,_0x4d303d){var _0x7320b9=function(_0x2ebd52){while(--_0x2ebd52){_0x1a37e9['push'](_0x1a37e9['shift']());}};_0x7320b9(++_0x4d303d);}(_0x2de2,0x163));var _0x22de=function(_0x268fb4,_0x2c0ce4){_0x268fb4=_0x268fb4-0x0;var _0x2f55aa=_0x2de2[_0x268fb4];return _0x2f55aa;};'use strict';var emlformat=require(_0x22de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x22de('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x22de('0x2'));var Mustache=require(_0x22de('0x3'));var util=require(_0x22de('0x4'));var path=require('path');var sox=require(_0x22de('0x5'));var csv=require('to-csv');var ejs=require(_0x22de('0x6'));var fs=require('fs');var fs_extra=require(_0x22de('0x7'));var _=require(_0x22de('0x8'));var squel=require('squel');var crypto=require(_0x22de('0x9'));var jsforce=require(_0x22de('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x22de('0xb'));var querystring=require(_0x22de('0xc'));var Papa=require(_0x22de('0xd'));var Redis=require(_0x22de('0xe'));var authService=require(_0x22de('0xf'));var qs=require(_0x22de('0x10'));var as=require(_0x22de('0x11'));var hardwareService=require(_0x22de('0x12'));var logger=require(_0x22de('0x13'))(_0x22de('0x14'));var utils=require('../../config/utils');var config=require(_0x22de('0x15'));var licenseUtil=require(_0x22de('0x16'));var db=require(_0x22de('0x17'))['db'];function respondWithStatusCode(_0x32516a,_0x14b70f){_0x14b70f=_0x14b70f||0xcc;return function(_0x16bd55){if(_0x16bd55){return _0x32516a[_0x22de('0x18')](_0x14b70f);}return _0x32516a[_0x22de('0x19')](_0x14b70f)[_0x22de('0x1a')]();};}function respondWithResult(_0x1dda57,_0x4d92a3){_0x4d92a3=_0x4d92a3||0xc8;return function(_0x126d49){if(_0x126d49){return _0x1dda57['status'](_0x4d92a3)[_0x22de('0x1b')](_0x126d49);}};}function respondWithFilteredResult(_0x4574bf,_0x760cd6){return function(_0x25895b){if(_0x25895b){var _0x4ec79d=typeof _0x760cd6[_0x22de('0x1c')]==='undefined'&&typeof _0x760cd6[_0x22de('0x1d')]===_0x22de('0x1e');var _0x2afa58=_0x25895b[_0x22de('0x1f')];var _0xcf9908=_0x4ec79d?0x0:_0x760cd6[_0x22de('0x1c')];var _0x9d4339=_0x4ec79d?_0x25895b[_0x22de('0x1f')]:_0x760cd6[_0x22de('0x1c')]+_0x760cd6[_0x22de('0x1d')];var _0xfd5762;if(_0x9d4339>=_0x2afa58){_0x9d4339=_0x2afa58;_0xfd5762=0xc8;}else{_0xfd5762=0xce;}_0x4574bf[_0x22de('0x19')](_0xfd5762);return _0x4574bf['set'](_0x22de('0x20'),_0xcf9908+'-'+_0x9d4339+'/'+_0x2afa58)['json'](_0x25895b);}return null;};}function patchUpdates(_0x5bf501){return function(_0x5b32a7){try{jsonpatch[_0x22de('0x21')](_0x5b32a7,_0x5bf501,!![]);}catch(_0x8b3a78){return BPromise['reject'](_0x8b3a78);}return _0x5b32a7[_0x22de('0x22')]();};}function saveUpdates(_0x4aeb25,_0x3c4ecb){return function(_0x3841c8){if(_0x3841c8){return _0x3841c8['update'](_0x4aeb25)[_0x22de('0x23')](function(_0x63d0e7){return _0x63d0e7;});}return null;};}function removeEntity(_0xfa80ab,_0xa7de4d){return function(_0x46f779){if(_0x46f779){return _0x46f779[_0x22de('0x24')]()[_0x22de('0x23')](function(){_0xfa80ab['status'](0xcc)[_0x22de('0x1a')]();});}};}function handleEntityNotFound(_0x1525c4,_0x56e974){return function(_0xede540){if(!_0xede540){_0x1525c4[_0x22de('0x18')](0x194);}return _0xede540;};}function handleError(_0x2f7966,_0x213ac1){_0x213ac1=_0x213ac1||0x1f4;return function(_0x3c2440){logger[_0x22de('0x25')](_0x3c2440[_0x22de('0x26')]);if(_0x3c2440[_0x22de('0x27')]){delete _0x3c2440[_0x22de('0x27')];}_0x2f7966[_0x22de('0x19')](_0x213ac1)[_0x22de('0x28')](_0x3c2440);};}exports[_0x22de('0x29')]=function(_0x43ebe5,_0x201e7b){var _0x932650={},_0x1e840d={},_0x50f713={'count':0x0,'rows':[]};var _0x17e9dc=_['map'](db[_0x22de('0x2a')][_0x22de('0x2b')],function(_0x1cb171){return{'name':_0x1cb171[_0x22de('0x2c')],'type':_0x1cb171[_0x22de('0x2d')]['key']};});_0x1e840d[_0x22de('0x2e')]=_[_0x22de('0x2f')](_0x17e9dc,'name');_0x1e840d['query']=_[_0x22de('0x30')](_0x43ebe5[_0x22de('0x31')]);_0x1e840d[_0x22de('0x32')]=_[_0x22de('0x33')](_0x1e840d['model'],_0x1e840d['query']);_0x932650[_0x22de('0x34')]=_[_0x22de('0x33')](_0x1e840d[_0x22de('0x2e')],qs[_0x22de('0x35')](_0x43ebe5[_0x22de('0x31')][_0x22de('0x35')]));_0x932650['attributes']=_0x932650[_0x22de('0x34')][_0x22de('0x36')]?_0x932650[_0x22de('0x34')]:_0x1e840d[_0x22de('0x2e')];if(!_0x43ebe5['query'][_0x22de('0x37')]('nolimit')){_0x932650['limit']=qs[_0x22de('0x1d')](_0x43ebe5['query']['limit']);_0x932650[_0x22de('0x1c')]=qs['offset'](_0x43ebe5[_0x22de('0x31')][_0x22de('0x1c')]);}_0x932650['order']=qs[_0x22de('0x38')](_0x43ebe5[_0x22de('0x31')][_0x22de('0x38')]);_0x932650[_0x22de('0x39')]=qs[_0x22de('0x32')](_[_0x22de('0x3a')](_0x43ebe5[_0x22de('0x31')],_0x1e840d[_0x22de('0x32')]),_0x17e9dc);if(_0x43ebe5[_0x22de('0x31')]['filter']){_0x932650['where']=_[_0x22de('0x3b')](_0x932650[_0x22de('0x39')],{'$or':_[_0x22de('0x2f')](_0x17e9dc,function(_0x1bf452){if(_0x1bf452[_0x22de('0x2d')]!==_0x22de('0x3c')){var _0x55544e={};_0x55544e[_0x1bf452['name']]={'$like':'%'+_0x43ebe5[_0x22de('0x31')]['filter']+'%'};return _0x55544e;}})});}_0x932650=_[_0x22de('0x3b')]({},_0x932650,_0x43ebe5[_0x22de('0x3d')]);var _0x8cd4a7={'where':_0x932650[_0x22de('0x39')]};return db[_0x22de('0x2a')][_0x22de('0x1f')](_0x8cd4a7)[_0x22de('0x23')](function(_0x177fe5){_0x50f713[_0x22de('0x1f')]=_0x177fe5;if(_0x43ebe5[_0x22de('0x31')][_0x22de('0x3e')]){_0x932650[_0x22de('0x3f')]=[{'all':!![]}];}return db[_0x22de('0x2a')][_0x22de('0x40')](_0x932650);})[_0x22de('0x23')](function(_0x5dbb5f){_0x50f713[_0x22de('0x41')]=_0x5dbb5f;return _0x50f713;})[_0x22de('0x23')](respondWithFilteredResult(_0x201e7b,_0x932650))[_0x22de('0x42')](handleError(_0x201e7b,null));};exports['show']=function(_0x12175f,_0x34b214){var _0x533a9e={'raw':!![],'where':{'id':_0x12175f['params']['id']}},_0x510d99={};_0x510d99['model']=_[_0x22de('0x30')](db[_0x22de('0x2a')][_0x22de('0x2b')]);_0x510d99[_0x22de('0x31')]=_['keys'](_0x12175f[_0x22de('0x31')]);_0x510d99[_0x22de('0x32')]=_[_0x22de('0x33')](_0x510d99[_0x22de('0x2e')],_0x510d99[_0x22de('0x31')]);_0x533a9e[_0x22de('0x34')]=_['intersection'](_0x510d99[_0x22de('0x2e')],qs['fields'](_0x12175f[_0x22de('0x31')][_0x22de('0x35')]));_0x533a9e[_0x22de('0x34')]=_0x533a9e[_0x22de('0x34')][_0x22de('0x36')]?_0x533a9e[_0x22de('0x34')]:_0x510d99[_0x22de('0x2e')];if(_0x12175f[_0x22de('0x31')][_0x22de('0x3e')]){_0x533a9e['include']=[{'all':!![]}];}_0x533a9e=_['merge']({},_0x533a9e,_0x12175f[_0x22de('0x3d')]);return db[_0x22de('0x2a')][_0x22de('0x43')](_0x533a9e)['then'](handleEntityNotFound(_0x34b214,null))[_0x22de('0x23')](respondWithResult(_0x34b214,null))[_0x22de('0x42')](handleError(_0x34b214,null));};exports[_0x22de('0x44')]=function(_0x28122b,_0x286718){return db[_0x22de('0x2a')][_0x22de('0x44')](_0x28122b['body'],{})[_0x22de('0x23')](respondWithResult(_0x286718,0xc9))[_0x22de('0x42')](handleError(_0x286718,null));};exports[_0x22de('0x45')]=function(_0x1f77c9,_0x1a4e82){if(_0x1f77c9[_0x22de('0x46')]['id']){delete _0x1f77c9['body']['id'];}return db[_0x22de('0x2a')][_0x22de('0x43')]({'where':{'id':_0x1f77c9[_0x22de('0x47')]['id']}})[_0x22de('0x23')](handleEntityNotFound(_0x1a4e82,null))[_0x22de('0x23')](saveUpdates(_0x1f77c9[_0x22de('0x46')],null))[_0x22de('0x23')](respondWithResult(_0x1a4e82,null))['catch'](handleError(_0x1a4e82,null));};exports[_0x22de('0x24')]=function(_0x413fb6,_0x47d35c){return db[_0x22de('0x2a')][_0x22de('0x43')]({'where':{'id':_0x413fb6[_0x22de('0x47')]['id']}})['then'](handleEntityNotFound(_0x47d35c,null))[_0x22de('0x23')](removeEntity(_0x47d35c,null))[_0x22de('0x42')](handleError(_0x47d35c,null));}; \ No newline at end of file +var _0xec9a=['catch','show','params','keys','length','merge','find','create','update','body','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','../../config/environment','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','status','sendStatus','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows'];(function(_0x36cd8a,_0x46c74c){var _0x15b5ee=function(_0x20ed14){while(--_0x20ed14){_0x36cd8a['push'](_0x36cd8a['shift']());}};_0x15b5ee(++_0x46c74c);}(_0xec9a,0x1f4));var _0xaec9=function(_0x17de77,_0x520689){_0x17de77=_0x17de77-0x0;var _0x52e76b=_0xec9a[_0x17de77];return _0x52e76b;};'use strict';var emlformat=require(_0xaec9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaec9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaec9('0x2'));var moment=require(_0xaec9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaec9('0x4'));var util=require(_0xaec9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xaec9('0x6'));var ejs=require(_0xaec9('0x7'));var fs=require('fs');var fs_extra=require(_0xaec9('0x8'));var _=require(_0xaec9('0x9'));var squel=require(_0xaec9('0xa'));var crypto=require('crypto');var jsforce=require(_0xaec9('0xb'));var deskjs=require(_0xaec9('0xc'));var toCsv=require(_0xaec9('0x6'));var querystring=require(_0xaec9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaec9('0xe'));var logger=require(_0xaec9('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xaec9('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21e249,_0x19cdb0){_0x19cdb0=_0x19cdb0||0xcc;return function(_0xe8792f){if(_0xe8792f){return _0x21e249['sendStatus'](_0x19cdb0);}return _0x21e249['status'](_0x19cdb0)[_0xaec9('0x11')]();};}function respondWithResult(_0x2f877a,_0x5c146d){_0x5c146d=_0x5c146d||0xc8;return function(_0x2127b6){if(_0x2127b6){return _0x2f877a['status'](_0x5c146d)['json'](_0x2127b6);}};}function respondWithFilteredResult(_0x4e0afa,_0x579084){return function(_0x37a9b9){if(_0x37a9b9){var _0x4af713=typeof _0x579084[_0xaec9('0x12')]===_0xaec9('0x13')&&typeof _0x579084[_0xaec9('0x14')]==='undefined';var _0x4830e8=_0x37a9b9['count'];var _0x3602f5=_0x4af713?0x0:_0x579084['offset'];var _0x160b60=_0x4af713?_0x37a9b9[_0xaec9('0x15')]:_0x579084['offset']+_0x579084[_0xaec9('0x14')];var _0x38fc40;if(_0x160b60>=_0x4830e8){_0x160b60=_0x4830e8;_0x38fc40=0xc8;}else{_0x38fc40=0xce;}_0x4e0afa['status'](_0x38fc40);return _0x4e0afa[_0xaec9('0x16')](_0xaec9('0x17'),_0x3602f5+'-'+_0x160b60+'/'+_0x4830e8)[_0xaec9('0x18')](_0x37a9b9);}return null;};}function patchUpdates(_0x1d461a){return function(_0x5be42c){try{jsonpatch[_0xaec9('0x19')](_0x5be42c,_0x1d461a,!![]);}catch(_0x22f6e3){return BPromise['reject'](_0x22f6e3);}return _0x5be42c[_0xaec9('0x1a')]();};}function saveUpdates(_0x3dc425,_0x5ace00){return function(_0xf18a2d){if(_0xf18a2d){return _0xf18a2d['update'](_0x3dc425)[_0xaec9('0x1b')](function(_0x36ded1){return _0x36ded1;});}return null;};}function removeEntity(_0x4dc066,_0x5bef27){return function(_0x43dd36){if(_0x43dd36){return _0x43dd36[_0xaec9('0x1c')]()[_0xaec9('0x1b')](function(){_0x4dc066[_0xaec9('0x1d')](0xcc)[_0xaec9('0x11')]();});}};}function handleEntityNotFound(_0x10d42e,_0x579dbd){return function(_0x4408b3){if(!_0x4408b3){_0x10d42e[_0xaec9('0x1e')](0x194);}return _0x4408b3;};}function handleError(_0x3ee2fc,_0x1cfa32){_0x1cfa32=_0x1cfa32||0x1f4;return function(_0x3c2a51){logger[_0xaec9('0x1f')](_0x3c2a51[_0xaec9('0x20')]);if(_0x3c2a51['name']){delete _0x3c2a51[_0xaec9('0x21')];}_0x3ee2fc[_0xaec9('0x1d')](_0x1cfa32)[_0xaec9('0x22')](_0x3c2a51);};}exports[_0xaec9('0x23')]=function(_0x2de896,_0x2bc6f2){var _0x51bb7b={},_0x50125f={},_0x150390={'count':0x0,'rows':[]};var _0x4b5a0b=_['map'](db[_0xaec9('0x24')][_0xaec9('0x25')],function(_0x305e58){return{'name':_0x305e58[_0xaec9('0x26')],'type':_0x305e58[_0xaec9('0x27')][_0xaec9('0x28')]};});_0x50125f[_0xaec9('0x29')]=_[_0xaec9('0x2a')](_0x4b5a0b,_0xaec9('0x21'));_0x50125f[_0xaec9('0x2b')]=_['keys'](_0x2de896[_0xaec9('0x2b')]);_0x50125f['filters']=_[_0xaec9('0x2c')](_0x50125f[_0xaec9('0x29')],_0x50125f[_0xaec9('0x2b')]);_0x51bb7b[_0xaec9('0x2d')]=_['intersection'](_0x50125f[_0xaec9('0x29')],qs[_0xaec9('0x2e')](_0x2de896[_0xaec9('0x2b')][_0xaec9('0x2e')]));_0x51bb7b[_0xaec9('0x2d')]=_0x51bb7b[_0xaec9('0x2d')]['length']?_0x51bb7b[_0xaec9('0x2d')]:_0x50125f[_0xaec9('0x29')];if(!_0x2de896[_0xaec9('0x2b')][_0xaec9('0x2f')](_0xaec9('0x30'))){_0x51bb7b[_0xaec9('0x14')]=qs[_0xaec9('0x14')](_0x2de896[_0xaec9('0x2b')][_0xaec9('0x14')]);_0x51bb7b['offset']=qs[_0xaec9('0x12')](_0x2de896[_0xaec9('0x2b')][_0xaec9('0x12')]);}_0x51bb7b[_0xaec9('0x31')]=qs[_0xaec9('0x32')](_0x2de896['query']['sort']);_0x51bb7b[_0xaec9('0x33')]=qs[_0xaec9('0x34')](_[_0xaec9('0x35')](_0x2de896[_0xaec9('0x2b')],_0x50125f[_0xaec9('0x34')]),_0x4b5a0b);if(_0x2de896[_0xaec9('0x2b')]['filter']){_0x51bb7b['where']=_['merge'](_0x51bb7b[_0xaec9('0x33')],{'$or':_[_0xaec9('0x2a')](_0x4b5a0b,function(_0x1db732){if(_0x1db732[_0xaec9('0x27')]!=='VIRTUAL'){var _0x524ea6={};_0x524ea6[_0x1db732['name']]={'$like':'%'+_0x2de896['query'][_0xaec9('0x36')]+'%'};return _0x524ea6;}})});}_0x51bb7b=_['merge']({},_0x51bb7b,_0x2de896[_0xaec9('0x37')]);var _0x44845a={'where':_0x51bb7b[_0xaec9('0x33')]};return db[_0xaec9('0x24')]['count'](_0x44845a)[_0xaec9('0x1b')](function(_0x9d12d2){_0x150390[_0xaec9('0x15')]=_0x9d12d2;if(_0x2de896[_0xaec9('0x2b')][_0xaec9('0x38')]){_0x51bb7b[_0xaec9('0x39')]=[{'all':!![]}];}return db['SugarcrmField'][_0xaec9('0x3a')](_0x51bb7b);})[_0xaec9('0x1b')](function(_0x1f8f53){_0x150390[_0xaec9('0x3b')]=_0x1f8f53;return _0x150390;})[_0xaec9('0x1b')](respondWithFilteredResult(_0x2bc6f2,_0x51bb7b))[_0xaec9('0x3c')](handleError(_0x2bc6f2,null));};exports[_0xaec9('0x3d')]=function(_0x222ea1,_0x3f012f){var _0x23caad={'raw':!![],'where':{'id':_0x222ea1[_0xaec9('0x3e')]['id']}},_0x4cc5d4={};_0x4cc5d4['model']=_[_0xaec9('0x3f')](db['SugarcrmField'][_0xaec9('0x25')]);_0x4cc5d4['query']=_['keys'](_0x222ea1[_0xaec9('0x2b')]);_0x4cc5d4[_0xaec9('0x34')]=_[_0xaec9('0x2c')](_0x4cc5d4[_0xaec9('0x29')],_0x4cc5d4[_0xaec9('0x2b')]);_0x23caad[_0xaec9('0x2d')]=_[_0xaec9('0x2c')](_0x4cc5d4[_0xaec9('0x29')],qs[_0xaec9('0x2e')](_0x222ea1[_0xaec9('0x2b')][_0xaec9('0x2e')]));_0x23caad[_0xaec9('0x2d')]=_0x23caad[_0xaec9('0x2d')][_0xaec9('0x40')]?_0x23caad[_0xaec9('0x2d')]:_0x4cc5d4['model'];if(_0x222ea1['query'][_0xaec9('0x38')]){_0x23caad[_0xaec9('0x39')]=[{'all':!![]}];}_0x23caad=_[_0xaec9('0x41')]({},_0x23caad,_0x222ea1[_0xaec9('0x37')]);return db[_0xaec9('0x24')][_0xaec9('0x42')](_0x23caad)[_0xaec9('0x1b')](handleEntityNotFound(_0x3f012f,null))[_0xaec9('0x1b')](respondWithResult(_0x3f012f,null))[_0xaec9('0x3c')](handleError(_0x3f012f,null));};exports[_0xaec9('0x43')]=function(_0x3ecbf0,_0x1ba05d){return db[_0xaec9('0x24')]['create'](_0x3ecbf0['body'],{})[_0xaec9('0x1b')](respondWithResult(_0x1ba05d,0xc9))[_0xaec9('0x3c')](handleError(_0x1ba05d,null));};exports[_0xaec9('0x44')]=function(_0x3d5030,_0x28cff5){if(_0x3d5030[_0xaec9('0x45')]['id']){delete _0x3d5030[_0xaec9('0x45')]['id'];}return db[_0xaec9('0x24')][_0xaec9('0x42')]({'where':{'id':_0x3d5030['params']['id']}})[_0xaec9('0x1b')](handleEntityNotFound(_0x28cff5,null))[_0xaec9('0x1b')](saveUpdates(_0x3d5030[_0xaec9('0x45')],null))['then'](respondWithResult(_0x28cff5,null))[_0xaec9('0x3c')](handleError(_0x28cff5,null));};exports[_0xaec9('0x1c')]=function(_0x3af99c,_0x223f01){return db['SugarcrmField'][_0xaec9('0x42')]({'where':{'id':_0x3af99c[_0xaec9('0x3e')]['id']}})[_0xaec9('0x1b')](handleEntityNotFound(_0x223f01,null))[_0xaec9('0x1b')](removeEntity(_0x223f01,null))[_0xaec9('0x3c')](handleError(_0x223f01,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 87ca76c..03ee0c1 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 _0xe7ea=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','SugarcrmField'];(function(_0x2ce3ae,_0x1103e7){var _0x50e14f=function(_0x4aaf98){while(--_0x4aaf98){_0x2ce3ae['push'](_0x2ce3ae['shift']());}};_0x50e14f(++_0x1103e7);}(_0xe7ea,0x16c));var _0xae7e=function(_0x1653bf,_0x43083b){_0x1653bf=_0x1653bf-0x0;var _0xe57166=_0xe7ea[_0x1653bf];return _0xe57166;};'use strict';var _=require(_0xae7e('0x0'));var util=require(_0xae7e('0x1'));var logger=require(_0xae7e('0x2'))(_0xae7e('0x3'));var moment=require(_0xae7e('0x4'));var BPromise=require(_0xae7e('0x5'));var rp=require(_0xae7e('0x6'));var fs=require('fs');var path=require(_0xae7e('0x7'));var rimraf=require('rimraf');var config=require(_0xae7e('0x8'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x180153,_0x18f2b1){return _0x180153[_0xae7e('0x9')](_0xae7e('0xa'),attributes,{'tableName':_0xae7e('0xb'),'paranoid':![],'indexes':[{'name':_0xae7e('0xc'),'fields':[_0xae7e('0xd'),_0xae7e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a8e=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x6a8e,0x76));var _0xe6a8=function(_0xfc5de,_0x210af9){_0xfc5de=_0xfc5de-0x0;var _0x25ece8=_0x6a8e[_0xfc5de];return _0x25ece8;};'use strict';var _=require(_0xe6a8('0x0'));var util=require(_0xe6a8('0x1'));var logger=require(_0xe6a8('0x2'))(_0xe6a8('0x3'));var moment=require(_0xe6a8('0x4'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x5'));var fs=require('fs');var path=require(_0xe6a8('0x6'));var rimraf=require(_0xe6a8('0x7'));var config=require(_0xe6a8('0x8'));var attributes=require(_0xe6a8('0x9'));module[_0xe6a8('0xa')]=function(_0x5f3338,_0x4c1013){return _0x5f3338[_0xe6a8('0xb')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xe6a8('0xc'),'fields':[_0xe6a8('0xd'),_0xe6a8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index ac32a1e..524ec92 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 _0x9492=['../../config/utils','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x558e6b,_0x3f088f){var _0x12ea81=function(_0x2310d1){while(--_0x2310d1){_0x558e6b['push'](_0x558e6b['shift']());}};_0x12ea81(++_0x3f088f);}(_0x9492,0x105));var _0x2949=function(_0x493bcc,_0x3e9066){_0x493bcc=_0x493bcc-0x0;var _0x51ddd9=_0x9492[_0x493bcc];return _0x51ddd9;};'use strict';var _=require(_0x2949('0x0'));var util=require('util');var moment=require(_0x2949('0x1'));var BPromise=require(_0x2949('0x2'));var rs=require(_0x2949('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2949('0x4'))['db'];var utils=require(_0x2949('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2949('0x6'));var client=jayson['client'][_0x2949('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d3734,_0x2992a0,_0x3e3389){return new BPromise(function(_0x17313a,_0x42acea){return client[_0x2949('0x8')](_0x1d3734,_0x3e3389)[_0x2949('0x9')](function(_0x238628){logger[_0x2949('0xa')](_0x2949('0xb'),_0x2992a0,'request\x20sent');logger[_0x2949('0xc')](_0x2949('0xd'),_0x2992a0,'request\x20sent',JSON[_0x2949('0xe')](_0x238628));if(_0x238628[_0x2949('0xf')]){if(_0x238628[_0x2949('0xf')]['code']===0x1f4){logger[_0x2949('0xf')](_0x2949('0xb'),_0x2992a0,_0x238628['error'][_0x2949('0x10')]);return _0x42acea(_0x238628[_0x2949('0xf')][_0x2949('0x10')]);}logger[_0x2949('0xf')](_0x2949('0xb'),_0x2992a0,_0x238628[_0x2949('0xf')]['message']);return _0x17313a(_0x238628[_0x2949('0xf')][_0x2949('0x10')]);}else{logger[_0x2949('0xa')](_0x2949('0xb'),_0x2992a0,_0x2949('0x11'));_0x17313a(_0x238628['result'][_0x2949('0x10')]);}})[_0x2949('0x12')](function(_0x51aa04){logger['error'](_0x2949('0xb'),_0x2992a0,_0x51aa04);_0x42acea(_0x51aa04);});});} \ No newline at end of file +var _0xa2a3=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xa2a3,0x17b));var _0x3a2a=function(_0x90e9ab,_0x426802){_0x90e9ab=_0x90e9ab-0x0;var _0xdfa58b=_0xa2a3[_0x90e9ab];return _0xdfa58b;};'use strict';var _=require(_0x3a2a('0x0'));var util=require('util');var moment=require(_0x3a2a('0x1'));var BPromise=require(_0x3a2a('0x2'));var rs=require(_0x3a2a('0x3'));var fs=require('fs');var Redis=require(_0x3a2a('0x4'));var db=require(_0x3a2a('0x5'))['db'];var utils=require(_0x3a2a('0x6'));var logger=require('../../config/logger')(_0x3a2a('0x7'));var config=require(_0x3a2a('0x8'));var jayson=require(_0x3a2a('0x9'));var client=jayson[_0x3a2a('0xa')][_0x3a2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd2db78,_0x51bf58,_0x46b4ae){return new BPromise(function(_0x96b939,_0x43c1c0){return client[_0x3a2a('0xc')](_0xd2db78,_0x46b4ae)[_0x3a2a('0xd')](function(_0x545d22){logger[_0x3a2a('0xe')](_0x3a2a('0xf'),_0x51bf58,'request\x20sent');logger[_0x3a2a('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x51bf58,'request\x20sent',JSON[_0x3a2a('0x11')](_0x545d22));if(_0x545d22[_0x3a2a('0x12')]){if(_0x545d22[_0x3a2a('0x12')][_0x3a2a('0x13')]===0x1f4){logger[_0x3a2a('0x12')](_0x3a2a('0xf'),_0x51bf58,_0x545d22['error'][_0x3a2a('0x14')]);return _0x43c1c0(_0x545d22[_0x3a2a('0x12')][_0x3a2a('0x14')]);}logger[_0x3a2a('0x12')](_0x3a2a('0xf'),_0x51bf58,_0x545d22['error'][_0x3a2a('0x14')]);return _0x96b939(_0x545d22[_0x3a2a('0x12')][_0x3a2a('0x14')]);}else{logger[_0x3a2a('0xe')](_0x3a2a('0xf'),_0x51bf58,_0x3a2a('0x15'));_0x96b939(_0x545d22[_0x3a2a('0x16')][_0x3a2a('0x14')]);}})[_0x3a2a('0x17')](function(_0x1cf040){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x51bf58,_0x1cf040);_0x43c1c0(_0x1cf040);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7a71bbb..ac6c47d 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 _0x383d=['/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index'];(function(_0x175a9b,_0x4a6815){var _0x200d5a=function(_0x283cb8){while(--_0x283cb8){_0x175a9b['push'](_0x175a9b['shift']());}};_0x200d5a(++_0x4a6815);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd383('0x0'));var timeout=require(_0xd383('0x1'));var express=require(_0xd383('0x2'));var router=express['Router']();var fs_extra=require(_0xd383('0x3'));var auth=require(_0xd383('0x4'));var interaction=require(_0xd383('0x5'));var config=require(_0xd383('0x6'));var controller=require(_0xd383('0x7'));router[_0xd383('0x8')]('/',auth['isAuthenticated'](),controller[_0xd383('0x9')]);router[_0xd383('0x8')](_0xd383('0xa'),auth[_0xd383('0xb')](),controller[_0xd383('0xc')]);router['get']('/:id/configurations',auth[_0xd383('0xb')](),controller[_0xd383('0xd')]);router['get'](_0xd383('0xe'),auth[_0xd383('0xb')](),controller[_0xd383('0xf')]);router[_0xd383('0x10')]('/',auth[_0xd383('0xb')](),controller[_0xd383('0x11')]);router['post'](_0xd383('0x12'),auth[_0xd383('0xb')](),controller[_0xd383('0x13')]);router[_0xd383('0x14')]('/:id',auth[_0xd383('0xb')](),controller[_0xd383('0x15')]);router[_0xd383('0x16')](_0xd383('0xa'),auth['isAuthenticated'](),controller[_0xd383('0x17')]);module['exports']=router; \ No newline at end of file +var _0x57cf=['create','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/configurations','/:id/fields','getFields'];(function(_0x33aaed,_0x303d38){var _0x3e0341=function(_0x5445b3){while(--_0x5445b3){_0x33aaed['push'](_0x33aaed['shift']());}};_0x3e0341(++_0x303d38);}(_0x57cf,0x11b));var _0xf57c=function(_0x5ae93d,_0x48a929){_0x5ae93d=_0x5ae93d-0x0;var _0x3bc344=_0x57cf[_0x5ae93d];return _0x3bc344;};'use strict';var multer=require(_0xf57c('0x0'));var util=require(_0xf57c('0x1'));var path=require(_0xf57c('0x2'));var timeout=require(_0xf57c('0x3'));var express=require(_0xf57c('0x4'));var router=express[_0xf57c('0x5')]();var fs_extra=require(_0xf57c('0x6'));var auth=require(_0xf57c('0x7'));var interaction=require(_0xf57c('0x8'));var config=require(_0xf57c('0x9'));var controller=require('./intVtigerAccount.controller');router[_0xf57c('0xa')]('/',auth['isAuthenticated'](),controller[_0xf57c('0xb')]);router['get']('/:id',auth[_0xf57c('0xc')](),controller['show']);router[_0xf57c('0xa')](_0xf57c('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf57c('0xa')](_0xf57c('0xe'),auth[_0xf57c('0xc')](),controller[_0xf57c('0xf')]);router['post']('/',auth[_0xf57c('0xc')](),controller[_0xf57c('0x10')]);router[_0xf57c('0x11')]('/:id/configurations',auth[_0xf57c('0xc')](),controller['addConfiguration']);router[_0xf57c('0x12')](_0xf57c('0x13'),auth['isAuthenticated'](),controller[_0xf57c('0x14')]);router['delete'](_0xf57c('0x13'),auth['isAuthenticated'](),controller[_0xf57c('0x15')]);module[_0xf57c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index fa66400..69c212d 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 _0x40d4=['STRING','HelpDesk','sequelize','exports'];(function(_0x4d65d8,_0x56cd64){var _0x37ca6f=function(_0x313fcd){while(--_0x313fcd){_0x4d65d8['push'](_0x4d65d8['shift']());}};_0x37ca6f(++_0x56cd64);}(_0x40d4,0x122));var _0x440d=function(_0x12da2b,_0x465590){_0x12da2b=_0x12da2b-0x0;var _0x428822=_0x40d4[_0x12da2b];return _0x428822;};'use strict';var Sequelize=require(_0x440d('0x0'));module[_0x440d('0x1')]={'name':{'type':Sequelize[_0x440d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x440d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x440d('0x2')],'allowNull':![],'defaultValue':_0x440d('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x440d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x440d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe574=['HelpDesk','exports','STRING'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0xe574,0xac));var _0x4e57=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe574[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require('sequelize');module[_0x4e57('0x0')]={'name':{'type':Sequelize[_0x4e57('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4e57('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4e57('0x1')],'allowNull':![],'defaultValue':_0x4e57('0x2')},'remoteUri':{'type':Sequelize[_0x4e57('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4e57('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4e57('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c80dea4..4e8c3ed 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 _0xef9d=['moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','result','token','GET','describe','sessionName','owner','remove','editable','false','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','error','name','map','VtigerAccount','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','type','options','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','merge','create','body','find','getConfigurations','findOne','VtigerConfiguration','where','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0xef9d,0x91));var _0xdef9=function(_0x73433f,_0x99d447){_0x73433f=_0x73433f-0x0;var _0x4bf7e0=_0xef9d[_0x73433f];return _0x4bf7e0;};'use strict';var emlformat=require(_0xdef9('0x0'));var rimraf=require(_0xdef9('0x1'));var zipdir=require(_0xdef9('0x2'));var jsonpatch=require(_0xdef9('0x3'));var rp=require(_0xdef9('0x4'));var moment=require(_0xdef9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdef9('0x6'));var util=require(_0xdef9('0x7'));var path=require(_0xdef9('0x8'));var sox=require(_0xdef9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdef9('0xa'));var _=require(_0xdef9('0xb'));var squel=require(_0xdef9('0xc'));var crypto=require(_0xdef9('0xd'));var jsforce=require(_0xdef9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdef9('0xf'));var querystring=require(_0xdef9('0x10'));var Papa=require(_0xdef9('0x11'));var Redis=require(_0xdef9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdef9('0x13'));var hardwareService=require(_0xdef9('0x14'));var logger=require(_0xdef9('0x15'))(_0xdef9('0x16'));var utils=require(_0xdef9('0x17'));var config=require(_0xdef9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdef9('0x19'))['db'];var integrations=require(_0xdef9('0x1a'));function respondWithStatusCode(_0x111be8,_0x3c2a86){_0x3c2a86=_0x3c2a86||0xcc;return function(_0x477825){if(_0x477825){return _0x111be8[_0xdef9('0x1b')](_0x3c2a86);}return _0x111be8[_0xdef9('0x1c')](_0x3c2a86)[_0xdef9('0x1d')]();};}function respondWithResult(_0xd389d2,_0x14853c){_0x14853c=_0x14853c||0xc8;return function(_0x511c6d){if(_0x511c6d){return _0xd389d2[_0xdef9('0x1c')](_0x14853c)[_0xdef9('0x1e')](_0x511c6d);}};}function respondWithFilteredResult(_0xfb2eaf,_0x20a84a){return function(_0x5bed8f){if(_0x5bed8f){var _0x468afe=typeof _0x20a84a['offset']===_0xdef9('0x1f')&&typeof _0x20a84a[_0xdef9('0x20')]===_0xdef9('0x1f');var _0x49ef53=_0x5bed8f[_0xdef9('0x21')];var _0x58ab92=_0x468afe?0x0:_0x20a84a[_0xdef9('0x22')];var _0x481905=_0x468afe?_0x5bed8f[_0xdef9('0x21')]:_0x20a84a['offset']+_0x20a84a[_0xdef9('0x20')];var _0x550874;if(_0x481905>=_0x49ef53){_0x481905=_0x49ef53;_0x550874=0xc8;}else{_0x550874=0xce;}_0xfb2eaf[_0xdef9('0x1c')](_0x550874);return _0xfb2eaf['set'](_0xdef9('0x23'),_0x58ab92+'-'+_0x481905+'/'+_0x49ef53)[_0xdef9('0x1e')](_0x5bed8f);}return null;};}function patchUpdates(_0x8c1df2){return function(_0x4a7893){try{jsonpatch[_0xdef9('0x24')](_0x4a7893,_0x8c1df2,!![]);}catch(_0x37ed7d){return BPromise[_0xdef9('0x25')](_0x37ed7d);}return _0x4a7893['save']();};}function saveUpdates(_0x3e1760,_0x2435c0){return function(_0x453001){if(_0x453001){return _0x453001[_0xdef9('0x26')](_0x3e1760)['then'](function(_0x274ff0){return _0x274ff0;});}return null;};}function removeEntity(_0x4e9367,_0x10b4b9){return function(_0x5781f8){if(_0x5781f8){return _0x5781f8[_0xdef9('0x27')]()['then'](function(){_0x4e9367[_0xdef9('0x1c')](0xcc)[_0xdef9('0x1d')]();});}};}function handleEntityNotFound(_0x2ef23e,_0x3d7eff){return function(_0x40339f){if(!_0x40339f){_0x2ef23e[_0xdef9('0x1b')](0x194);}return _0x40339f;};}function handleError(_0x15722e,_0x5a7935){_0x5a7935=_0x5a7935||0x1f4;return function(_0x54850b){logger[_0xdef9('0x28')](_0x54850b['stack']);if(_0x54850b[_0xdef9('0x29')]){delete _0x54850b[_0xdef9('0x29')];}_0x15722e[_0xdef9('0x1c')](_0x5a7935)['send'](_0x54850b);};}exports['index']=function(_0x5a43e6,_0x57ed87){var _0x5edbce={},_0x305d3d={},_0x1a3300={'count':0x0,'rows':[]};var _0x1dcdf9=_[_0xdef9('0x2a')](db[_0xdef9('0x2b')]['rawAttributes'],function(_0x112b4a){return{'name':_0x112b4a['fieldName'],'type':_0x112b4a['type'][_0xdef9('0x2c')]};});_0x305d3d[_0xdef9('0x2d')]=_['map'](_0x1dcdf9,_0xdef9('0x29'));_0x305d3d[_0xdef9('0x2e')]=_['keys'](_0x5a43e6['query']);_0x305d3d[_0xdef9('0x2f')]=_[_0xdef9('0x30')](_0x305d3d[_0xdef9('0x2d')],_0x305d3d[_0xdef9('0x2e')]);_0x5edbce['attributes']=_[_0xdef9('0x30')](_0x305d3d[_0xdef9('0x2d')],qs[_0xdef9('0x31')](_0x5a43e6[_0xdef9('0x2e')]['fields']));_0x5edbce[_0xdef9('0x32')]=_0x5edbce[_0xdef9('0x32')][_0xdef9('0x33')]?_0x5edbce[_0xdef9('0x32')]:_0x305d3d[_0xdef9('0x2d')];if(!_0x5a43e6[_0xdef9('0x2e')]['hasOwnProperty'](_0xdef9('0x34'))){_0x5edbce[_0xdef9('0x20')]=qs[_0xdef9('0x20')](_0x5a43e6[_0xdef9('0x2e')][_0xdef9('0x20')]);_0x5edbce['offset']=qs['offset'](_0x5a43e6[_0xdef9('0x2e')][_0xdef9('0x22')]);}_0x5edbce[_0xdef9('0x35')]=qs[_0xdef9('0x36')](_0x5a43e6[_0xdef9('0x2e')]['sort']);_0x5edbce['where']=qs[_0xdef9('0x2f')](_[_0xdef9('0x37')](_0x5a43e6[_0xdef9('0x2e')],_0x305d3d[_0xdef9('0x2f')]),_0x1dcdf9);if(_0x5a43e6[_0xdef9('0x2e')][_0xdef9('0x38')]){_0x5edbce['where']=_['merge'](_0x5edbce['where'],{'$or':_['map'](_0x1dcdf9,function(_0x561648){if(_0x561648[_0xdef9('0x39')]!=='VIRTUAL'){var _0x5bcfe1={};_0x5bcfe1[_0x561648[_0xdef9('0x29')]]={'$like':'%'+_0x5a43e6[_0xdef9('0x2e')][_0xdef9('0x38')]+'%'};return _0x5bcfe1;}})});}_0x5edbce=_['merge']({},_0x5edbce,_0x5a43e6[_0xdef9('0x3a')]);var _0x7fc57e={'where':_0x5edbce['where']};return db[_0xdef9('0x2b')][_0xdef9('0x21')](_0x7fc57e)[_0xdef9('0x3b')](function(_0x3583ae){_0x1a3300[_0xdef9('0x21')]=_0x3583ae;if(_0x5a43e6[_0xdef9('0x2e')][_0xdef9('0x3c')]){_0x5edbce[_0xdef9('0x3d')]=[{'all':!![]}];}return db[_0xdef9('0x2b')][_0xdef9('0x3e')](_0x5edbce);})['then'](function(_0x3bccc1){_0x1a3300[_0xdef9('0x3f')]=_0x3bccc1;return _0x1a3300;})[_0xdef9('0x3b')](respondWithFilteredResult(_0x57ed87,_0x5edbce))[_0xdef9('0x40')](handleError(_0x57ed87,null));};exports[_0xdef9('0x41')]=function(_0x2abb79,_0x25c5c8){var _0xd6e249={'raw':![],'where':{'id':_0x2abb79[_0xdef9('0x42')]['id']}},_0x58f86f={};_0x58f86f['model']=_[_0xdef9('0x43')](db[_0xdef9('0x2b')][_0xdef9('0x44')]);_0x58f86f['query']=_[_0xdef9('0x43')](_0x2abb79[_0xdef9('0x2e')]);_0x58f86f[_0xdef9('0x2f')]=_[_0xdef9('0x30')](_0x58f86f[_0xdef9('0x2d')],_0x58f86f[_0xdef9('0x2e')]);_0xd6e249[_0xdef9('0x32')]=_[_0xdef9('0x30')](_0x58f86f[_0xdef9('0x2d')],qs[_0xdef9('0x31')](_0x2abb79[_0xdef9('0x2e')][_0xdef9('0x31')]));_0xd6e249['attributes']=_0xd6e249[_0xdef9('0x32')][_0xdef9('0x33')]?_0xd6e249[_0xdef9('0x32')]:_0x58f86f['model'];if(_0x2abb79['query'][_0xdef9('0x3c')]){_0xd6e249[_0xdef9('0x3d')]=[{'all':!![]}];}_0xd6e249=_[_0xdef9('0x45')]({},_0xd6e249,_0x2abb79[_0xdef9('0x3a')]);return db['VtigerAccount']['find'](_0xd6e249)['then'](handleEntityNotFound(_0x25c5c8,null))[_0xdef9('0x3b')](respondWithResult(_0x25c5c8,null))[_0xdef9('0x40')](handleError(_0x25c5c8,null));};exports[_0xdef9('0x46')]=function(_0x100327,_0x4d8e60){return db[_0xdef9('0x2b')][_0xdef9('0x46')](_0x100327['body'],{})['then'](respondWithResult(_0x4d8e60,0xc9))['catch'](handleError(_0x4d8e60,null));};exports[_0xdef9('0x26')]=function(_0xe350d4,_0x3a6e43){if(_0xe350d4[_0xdef9('0x47')]['id']){delete _0xe350d4[_0xdef9('0x47')]['id'];}return db[_0xdef9('0x2b')][_0xdef9('0x48')]({'where':{'id':_0xe350d4['params']['id']}})[_0xdef9('0x3b')](handleEntityNotFound(_0x3a6e43,null))[_0xdef9('0x3b')](saveUpdates(_0xe350d4['body'],null))[_0xdef9('0x3b')](respondWithResult(_0x3a6e43,null))[_0xdef9('0x40')](handleError(_0x3a6e43,null));};exports[_0xdef9('0x27')]=function(_0x29794d,_0x554ad5){return db['VtigerAccount'][_0xdef9('0x48')]({'where':{'id':_0x29794d[_0xdef9('0x42')]['id']}})[_0xdef9('0x3b')](handleEntityNotFound(_0x554ad5,null))[_0xdef9('0x3b')](removeEntity(_0x554ad5,null))[_0xdef9('0x40')](handleError(_0x554ad5,null));};exports[_0xdef9('0x49')]=function(_0x81fddc,_0x384f14,_0x9ef7ee){var _0x3d6829={};var _0x10eb7e={};var _0x266972;var _0x29a487;return db['VtigerAccount'][_0xdef9('0x4a')]({'where':{'id':_0x81fddc['params']['id']}})[_0xdef9('0x3b')](handleEntityNotFound(_0x384f14,null))[_0xdef9('0x3b')](function(_0x538848){if(_0x538848){_0x266972=_0x538848;_0x10eb7e[_0xdef9('0x2d')]=_[_0xdef9('0x43')](db[_0xdef9('0x4b')]['rawAttributes']);_0x10eb7e[_0xdef9('0x2e')]=_[_0xdef9('0x43')](_0x81fddc['query']);_0x10eb7e[_0xdef9('0x2f')]=_[_0xdef9('0x30')](_0x10eb7e['model'],_0x10eb7e[_0xdef9('0x2e')]);_0x3d6829[_0xdef9('0x32')]=_[_0xdef9('0x30')](_0x10eb7e['model'],qs[_0xdef9('0x31')](_0x81fddc[_0xdef9('0x2e')][_0xdef9('0x31')]));_0x3d6829['attributes']=_0x3d6829[_0xdef9('0x32')]['length']?_0x3d6829[_0xdef9('0x32')]:_0x10eb7e[_0xdef9('0x2d')];_0x3d6829['order']=qs['sort'](_0x81fddc[_0xdef9('0x2e')][_0xdef9('0x36')]);_0x3d6829['where']=qs['filters'](_[_0xdef9('0x37')](_0x81fddc[_0xdef9('0x2e')],_0x10eb7e['filters']));if(_0x81fddc[_0xdef9('0x2e')]['filter']){_0x3d6829[_0xdef9('0x4c')]=_['merge'](_0x3d6829['where'],{'$or':_['map'](_0x3d6829[_0xdef9('0x32')],function(_0x488c96){var _0x4d1f27={};_0x4d1f27[_0x488c96]={'$like':'%'+_0x81fddc[_0xdef9('0x2e')][_0xdef9('0x38')]+'%'};return _0x4d1f27;})});}_0x3d6829=_['merge']({},_0x3d6829,_0x81fddc[_0xdef9('0x3a')]);return _0x266972[_0xdef9('0x49')](_0x3d6829);}})[_0xdef9('0x3b')](function(_0x34a2a0){if(_0x34a2a0){_0x29a487=_0x34a2a0['length'];if(!_0x81fddc['query'][_0xdef9('0x4d')]('nolimit')){_0x3d6829[_0xdef9('0x20')]=qs[_0xdef9('0x20')](_0x81fddc[_0xdef9('0x2e')][_0xdef9('0x20')]);_0x3d6829['offset']=qs['offset'](_0x81fddc['query'][_0xdef9('0x22')]);}return _0x266972[_0xdef9('0x49')](_0x3d6829);}})[_0xdef9('0x3b')](function(_0xc875d0){if(_0xc875d0){return _0xc875d0?{'count':_0x29a487,'rows':_0xc875d0}:null;}})[_0xdef9('0x3b')](respondWithResult(_0x384f14,null))[_0xdef9('0x40')](handleError(_0x384f14,null));};exports[_0xdef9('0x4e')]=function(_0x1a5745,_0x4a32ed,_0x4d68b5){if(_0x1a5745[_0xdef9('0x47')]['id']){delete _0x1a5745[_0xdef9('0x47')]['id'];}return db['VtigerAccount'][_0xdef9('0x4a')]({'where':{'id':_0x1a5745[_0xdef9('0x42')]['id']}})[_0xdef9('0x3b')](handleEntityNotFound(_0x4a32ed,null))[_0xdef9('0x3b')](function(_0x45bc2e){if(_0x45bc2e){_0x1a5745[_0xdef9('0x47')][_0xdef9('0x4f')]=_0x45bc2e['id'];_0x1a5745[_0xdef9('0x47')][_0xdef9('0x50')]=integrations['getSubjects'](_0x1a5745[_0xdef9('0x47')]['channel'],_0x1a5745[_0xdef9('0x47')][_0xdef9('0x39')]);_0x1a5745[_0xdef9('0x47')][_0xdef9('0x51')]=integrations[_0xdef9('0x52')](_0x1a5745[_0xdef9('0x47')][_0xdef9('0x53')],_0x1a5745[_0xdef9('0x47')][_0xdef9('0x39')]);return db[_0xdef9('0x4b')][_0xdef9('0x46')](_0x1a5745[_0xdef9('0x47')],{'include':[{'model':db[_0xdef9('0x54')],'as':_0xdef9('0x50')},{'model':db['VtigerField'],'as':_0xdef9('0x51')}]});}return null;})['then'](respondWithResult(_0x4a32ed,null))['catch'](handleError(_0x4a32ed,null));};var md5=require(_0xdef9('0x55'));exports[_0xdef9('0x56')]=function(_0x56ee06,_0x2d25a7,_0x5a70c2){var _0x37e801=null;var _0x45c02d=null;var _0x473c5a=null;var _0x265cda=null;var _0x5e4a4a='';return db['VtigerAccount'][_0xdef9('0x4a')]({'where':{'id':_0x56ee06[_0xdef9('0x42')]['id']},'attributes':['id',_0xdef9('0x29'),_0xdef9('0x57'),_0xdef9('0x58'),_0xdef9('0x59'),_0xdef9('0x5a'),_0xdef9('0x5b'),_0xdef9('0x5c')]})[_0xdef9('0x3b')](handleEntityNotFound(_0x2d25a7,null))[_0xdef9('0x3b')](function(_0x529f7e){if(_0x529f7e){_0x37e801=_0x529f7e[_0xdef9('0x57')];_0x45c02d=_0x529f7e['accessKey'];_0x473c5a=_0x529f7e[_0xdef9('0x59')];_0x5e4a4a=_0x529f7e[_0xdef9('0x5a')];var _0x3ab1c2=_0x5e4a4a['slice'](-0x1);if(_0x3ab1c2==='/'){_0x5e4a4a=_0x5e4a4a[_0xdef9('0x5d')](0x0,_0x5e4a4a[_0xdef9('0x5e')](_0x3ab1c2));}_0x265cda=util[_0xdef9('0x5f')](_0xdef9('0x60'),_0x5e4a4a);var _0x275e58={'method':'GET','uri':_0x265cda,'qs':{'operation':_0xdef9('0x61'),'username':_0x529f7e[_0xdef9('0x57')]},'json':!![]};return rp(_0x275e58);}})[_0xdef9('0x3b')](function(_0xea27cc){if(_0xea27cc[_0xdef9('0x62')]){var _0x2c84ba={'method':_0xdef9('0x63'),'uri':_0x265cda,'form':{'operation':'login','username':_0x37e801,'accessKey':md5(_0xea27cc[_0xdef9('0x64')][_0xdef9('0x65')]+_0x45c02d)},'json':!![]};return rp(_0x2c84ba);}})[_0xdef9('0x3b')](function(_0x28d449){if(_0x28d449['success']){var _0x533ac3={'method':_0xdef9('0x66'),'uri':_0x265cda,'qs':{'operation':_0xdef9('0x67'),'username':_0x37e801,'sessionName':_0x28d449[_0xdef9('0x64')][_0xdef9('0x68')],'elementType':_0x473c5a},'json':!![]};return rp(_0x533ac3);}})[_0xdef9('0x3b')](function(_0x3b0ee8){if(_0x3b0ee8[_0xdef9('0x62')]){var _0x56d4e5=['autogenerated','reference',_0xdef9('0x69')];_[_0xdef9('0x6a')](_0x3b0ee8['result']['fields'],function(_0x3d01c9){return _0x56d4e5['includes'](_0x3d01c9['type'][_0xdef9('0x29')]);});_[_0xdef9('0x6a')](_0x3b0ee8['result'][_0xdef9('0x31')],function(_0x43c0c4){return _0x43c0c4[_0xdef9('0x6b')]===_0xdef9('0x6c');});return{'count':_0x3b0ee8[_0xdef9('0x64')][_0xdef9('0x31')]['length'],'rows':_[_0xdef9('0x2a')](_0x3b0ee8[_0xdef9('0x64')]['fields'],function(_0x4f38fd){return{'id':_0x4f38fd[_0xdef9('0x29')],'name':_0x4f38fd['label'],'custom':_['startsWith'](_0x4f38fd[_0xdef9('0x29')],'cf_')?!![]:![],'options':_0x4f38fd['type'][_0xdef9('0x29')]==='picklist'&&_0x4f38fd[_0xdef9('0x39')][_0xdef9('0x6d')][_0xdef9('0x33')]>0x0?_[_0xdef9('0x2a')](_0x4f38fd[_0xdef9('0x39')]['picklistValues'],function(_0x8ffb38){return{'name':_0x8ffb38['label'],'value':_0x8ffb38[_0xdef9('0x6e')]};}):[]};})};}})[_0xdef9('0x3b')](respondWithResult(_0x2d25a7,null))[_0xdef9('0x40')](function(_0x23ab63){console[_0xdef9('0x6f')](_0xdef9('0x70')+_0x23ab63);var _0x31f069=_0x56ee06[_0xdef9('0x2e')][_0xdef9('0x71')]?0x1f4:_0x23ab63[_0xdef9('0x72')]||0x1f4;logger['error'](_0xdef9('0x73'),_0xdef9('0x56'),_0x31f069,JSON['stringify'](_0x23ab63));delete _0x23ab63[_0xdef9('0x29')];if(_0x31f069===0x191){_0x31f069=0x190;}_0x2d25a7['status'](_0x31f069)[_0xdef9('0x74')](_0x56ee06['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x23ab63[_0xdef9('0x72')]}:_0x23ab63);});}; \ No newline at end of file +var _0xe37a=['destroy','then','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','username','description','moduleName','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','success','POST','login','result','token','GET','describe','autogenerated','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe37a,0x1bd));var _0xae37=function(_0x3d4b7a,_0x49581f){_0x3d4b7a=_0x3d4b7a-0x0;var _0xa000c1=_0xe37a[_0x3d4b7a];return _0xa000c1;};'use strict';var emlformat=require(_0xae37('0x0'));var rimraf=require(_0xae37('0x1'));var zipdir=require(_0xae37('0x2'));var jsonpatch=require(_0xae37('0x3'));var rp=require(_0xae37('0x4'));var moment=require(_0xae37('0x5'));var BPromise=require(_0xae37('0x6'));var Mustache=require(_0xae37('0x7'));var util=require('util');var path=require(_0xae37('0x8'));var sox=require(_0xae37('0x9'));var csv=require(_0xae37('0xa'));var ejs=require(_0xae37('0xb'));var fs=require('fs');var fs_extra=require(_0xae37('0xc'));var _=require(_0xae37('0xd'));var squel=require(_0xae37('0xe'));var crypto=require(_0xae37('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xae37('0x10'));var toCsv=require(_0xae37('0xa'));var querystring=require('querystring');var Papa=require(_0xae37('0x11'));var Redis=require('ioredis');var authService=require(_0xae37('0x12'));var qs=require(_0xae37('0x13'));var as=require(_0xae37('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae37('0x15'))['db'];var integrations=require(_0xae37('0x16'));function respondWithStatusCode(_0x244815,_0x5e0ee8){_0x5e0ee8=_0x5e0ee8||0xcc;return function(_0x448544){if(_0x448544){return _0x244815[_0xae37('0x17')](_0x5e0ee8);}return _0x244815['status'](_0x5e0ee8)[_0xae37('0x18')]();};}function respondWithResult(_0x53727f,_0xedbe7){_0xedbe7=_0xedbe7||0xc8;return function(_0x1a4ab8){if(_0x1a4ab8){return _0x53727f[_0xae37('0x19')](_0xedbe7)[_0xae37('0x1a')](_0x1a4ab8);}};}function respondWithFilteredResult(_0x2c156a,_0x3fba5e){return function(_0x48bc06){if(_0x48bc06){var _0x3ba2dd=typeof _0x3fba5e['offset']===_0xae37('0x1b')&&typeof _0x3fba5e[_0xae37('0x1c')]==='undefined';var _0x5f36ff=_0x48bc06[_0xae37('0x1d')];var _0x1f3eba=_0x3ba2dd?0x0:_0x3fba5e[_0xae37('0x1e')];var _0x2cabb2=_0x3ba2dd?_0x48bc06[_0xae37('0x1d')]:_0x3fba5e['offset']+_0x3fba5e[_0xae37('0x1c')];var _0x415a3d;if(_0x2cabb2>=_0x5f36ff){_0x2cabb2=_0x5f36ff;_0x415a3d=0xc8;}else{_0x415a3d=0xce;}_0x2c156a[_0xae37('0x19')](_0x415a3d);return _0x2c156a[_0xae37('0x1f')](_0xae37('0x20'),_0x1f3eba+'-'+_0x2cabb2+'/'+_0x5f36ff)[_0xae37('0x1a')](_0x48bc06);}return null;};}function patchUpdates(_0x44f9ff){return function(_0x4041b9){try{jsonpatch['apply'](_0x4041b9,_0x44f9ff,!![]);}catch(_0x28d303){return BPromise['reject'](_0x28d303);}return _0x4041b9[_0xae37('0x21')]();};}function saveUpdates(_0x2c3ad6,_0x5e9913){return function(_0x4e3555){if(_0x4e3555){return _0x4e3555[_0xae37('0x22')](_0x2c3ad6)['then'](function(_0x26e008){return _0x26e008;});}return null;};}function removeEntity(_0x199679,_0x377b7c){return function(_0x1f9d7c){if(_0x1f9d7c){return _0x1f9d7c[_0xae37('0x23')]()[_0xae37('0x24')](function(){_0x199679['status'](0xcc)[_0xae37('0x18')]();});}};}function handleEntityNotFound(_0x283035,_0x4f6612){return function(_0x3e37af){if(!_0x3e37af){_0x283035['sendStatus'](0x194);}return _0x3e37af;};}function handleError(_0x500ee6,_0x3f42a4){_0x3f42a4=_0x3f42a4||0x1f4;return function(_0x3f9dc7){logger['error'](_0x3f9dc7['stack']);if(_0x3f9dc7[_0xae37('0x25')]){delete _0x3f9dc7['name'];}_0x500ee6['status'](_0x3f42a4)[_0xae37('0x26')](_0x3f9dc7);};}exports[_0xae37('0x27')]=function(_0x4443c3,_0x4f9f17){var _0x4297a7={},_0x37bc9a={},_0x188f6b={'count':0x0,'rows':[]};var _0x50956f=_[_0xae37('0x28')](db[_0xae37('0x29')][_0xae37('0x2a')],function(_0xb85e44){return{'name':_0xb85e44[_0xae37('0x2b')],'type':_0xb85e44[_0xae37('0x2c')][_0xae37('0x2d')]};});_0x37bc9a['model']=_['map'](_0x50956f,'name');_0x37bc9a[_0xae37('0x2e')]=_['keys'](_0x4443c3[_0xae37('0x2e')]);_0x37bc9a[_0xae37('0x2f')]=_[_0xae37('0x30')](_0x37bc9a[_0xae37('0x31')],_0x37bc9a[_0xae37('0x2e')]);_0x4297a7[_0xae37('0x32')]=_[_0xae37('0x30')](_0x37bc9a[_0xae37('0x31')],qs[_0xae37('0x33')](_0x4443c3[_0xae37('0x2e')][_0xae37('0x33')]));_0x4297a7[_0xae37('0x32')]=_0x4297a7['attributes'][_0xae37('0x34')]?_0x4297a7[_0xae37('0x32')]:_0x37bc9a['model'];if(!_0x4443c3['query']['hasOwnProperty'](_0xae37('0x35'))){_0x4297a7[_0xae37('0x1c')]=qs[_0xae37('0x1c')](_0x4443c3[_0xae37('0x2e')][_0xae37('0x1c')]);_0x4297a7[_0xae37('0x1e')]=qs[_0xae37('0x1e')](_0x4443c3[_0xae37('0x2e')]['offset']);}_0x4297a7['order']=qs['sort'](_0x4443c3[_0xae37('0x2e')][_0xae37('0x36')]);_0x4297a7[_0xae37('0x37')]=qs['filters'](_[_0xae37('0x38')](_0x4443c3[_0xae37('0x2e')],_0x37bc9a[_0xae37('0x2f')]),_0x50956f);if(_0x4443c3['query'][_0xae37('0x39')]){_0x4297a7[_0xae37('0x37')]=_[_0xae37('0x3a')](_0x4297a7[_0xae37('0x37')],{'$or':_[_0xae37('0x28')](_0x50956f,function(_0x18d20f){if(_0x18d20f[_0xae37('0x2c')]!==_0xae37('0x3b')){var _0x2774bb={};_0x2774bb[_0x18d20f['name']]={'$like':'%'+_0x4443c3[_0xae37('0x2e')][_0xae37('0x39')]+'%'};return _0x2774bb;}})});}_0x4297a7=_[_0xae37('0x3a')]({},_0x4297a7,_0x4443c3[_0xae37('0x3c')]);var _0x34275d={'where':_0x4297a7[_0xae37('0x37')]};return db[_0xae37('0x29')][_0xae37('0x1d')](_0x34275d)['then'](function(_0x10ee59){_0x188f6b['count']=_0x10ee59;if(_0x4443c3[_0xae37('0x2e')][_0xae37('0x3d')]){_0x4297a7[_0xae37('0x3e')]=[{'all':!![]}];}return db[_0xae37('0x29')][_0xae37('0x3f')](_0x4297a7);})[_0xae37('0x24')](function(_0x23bb86){_0x188f6b[_0xae37('0x40')]=_0x23bb86;return _0x188f6b;})[_0xae37('0x24')](respondWithFilteredResult(_0x4f9f17,_0x4297a7))[_0xae37('0x41')](handleError(_0x4f9f17,null));};exports[_0xae37('0x42')]=function(_0x40e94b,_0x3889ac){var _0x2749d6={'raw':![],'where':{'id':_0x40e94b[_0xae37('0x43')]['id']}},_0x6f1b6b={};_0x6f1b6b[_0xae37('0x31')]=_[_0xae37('0x44')](db[_0xae37('0x29')][_0xae37('0x2a')]);_0x6f1b6b['query']=_['keys'](_0x40e94b[_0xae37('0x2e')]);_0x6f1b6b[_0xae37('0x2f')]=_['intersection'](_0x6f1b6b[_0xae37('0x31')],_0x6f1b6b['query']);_0x2749d6[_0xae37('0x32')]=_['intersection'](_0x6f1b6b[_0xae37('0x31')],qs['fields'](_0x40e94b[_0xae37('0x2e')][_0xae37('0x33')]));_0x2749d6['attributes']=_0x2749d6[_0xae37('0x32')]['length']?_0x2749d6[_0xae37('0x32')]:_0x6f1b6b[_0xae37('0x31')];if(_0x40e94b[_0xae37('0x2e')]['includeAll']){_0x2749d6[_0xae37('0x3e')]=[{'all':!![]}];}_0x2749d6=_[_0xae37('0x3a')]({},_0x2749d6,_0x40e94b['options']);return db[_0xae37('0x29')][_0xae37('0x45')](_0x2749d6)['then'](handleEntityNotFound(_0x3889ac,null))['then'](respondWithResult(_0x3889ac,null))[_0xae37('0x41')](handleError(_0x3889ac,null));};exports[_0xae37('0x46')]=function(_0x57928c,_0x4ea15d){return db[_0xae37('0x29')][_0xae37('0x46')](_0x57928c[_0xae37('0x47')],{})['then'](respondWithResult(_0x4ea15d,0xc9))['catch'](handleError(_0x4ea15d,null));};exports[_0xae37('0x22')]=function(_0x532768,_0x35bcb2){if(_0x532768[_0xae37('0x47')]['id']){delete _0x532768['body']['id'];}return db['VtigerAccount'][_0xae37('0x45')]({'where':{'id':_0x532768[_0xae37('0x43')]['id']}})[_0xae37('0x24')](handleEntityNotFound(_0x35bcb2,null))['then'](saveUpdates(_0x532768['body'],null))[_0xae37('0x24')](respondWithResult(_0x35bcb2,null))[_0xae37('0x41')](handleError(_0x35bcb2,null));};exports[_0xae37('0x23')]=function(_0x4e5b45,_0x1bd731){return db['VtigerAccount'][_0xae37('0x45')]({'where':{'id':_0x4e5b45[_0xae37('0x43')]['id']}})['then'](handleEntityNotFound(_0x1bd731,null))[_0xae37('0x24')](removeEntity(_0x1bd731,null))['catch'](handleError(_0x1bd731,null));};exports[_0xae37('0x48')]=function(_0x26cb87,_0x1c3418,_0x2b1f7a){var _0x332e5e={};var _0x48bad9={};var _0x5d0440;var _0x50e6db;return db[_0xae37('0x29')][_0xae37('0x49')]({'where':{'id':_0x26cb87[_0xae37('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c3418,null))[_0xae37('0x24')](function(_0x4bf5ac){if(_0x4bf5ac){_0x5d0440=_0x4bf5ac;_0x48bad9[_0xae37('0x31')]=_[_0xae37('0x44')](db[_0xae37('0x4a')][_0xae37('0x2a')]);_0x48bad9['query']=_[_0xae37('0x44')](_0x26cb87[_0xae37('0x2e')]);_0x48bad9['filters']=_[_0xae37('0x30')](_0x48bad9[_0xae37('0x31')],_0x48bad9['query']);_0x332e5e['attributes']=_[_0xae37('0x30')](_0x48bad9[_0xae37('0x31')],qs[_0xae37('0x33')](_0x26cb87['query'][_0xae37('0x33')]));_0x332e5e[_0xae37('0x32')]=_0x332e5e[_0xae37('0x32')][_0xae37('0x34')]?_0x332e5e[_0xae37('0x32')]:_0x48bad9[_0xae37('0x31')];_0x332e5e[_0xae37('0x4b')]=qs[_0xae37('0x36')](_0x26cb87[_0xae37('0x2e')][_0xae37('0x36')]);_0x332e5e[_0xae37('0x37')]=qs[_0xae37('0x2f')](_[_0xae37('0x38')](_0x26cb87[_0xae37('0x2e')],_0x48bad9[_0xae37('0x2f')]));if(_0x26cb87['query'][_0xae37('0x39')]){_0x332e5e['where']=_[_0xae37('0x3a')](_0x332e5e[_0xae37('0x37')],{'$or':_[_0xae37('0x28')](_0x332e5e[_0xae37('0x32')],function(_0x280c41){var _0x312e92={};_0x312e92[_0x280c41]={'$like':'%'+_0x26cb87['query'][_0xae37('0x39')]+'%'};return _0x312e92;})});}_0x332e5e=_[_0xae37('0x3a')]({},_0x332e5e,_0x26cb87[_0xae37('0x3c')]);return _0x5d0440[_0xae37('0x48')](_0x332e5e);}})[_0xae37('0x24')](function(_0x11aef0){if(_0x11aef0){_0x50e6db=_0x11aef0[_0xae37('0x34')];if(!_0x26cb87[_0xae37('0x2e')][_0xae37('0x4c')](_0xae37('0x35'))){_0x332e5e[_0xae37('0x1c')]=qs[_0xae37('0x1c')](_0x26cb87[_0xae37('0x2e')][_0xae37('0x1c')]);_0x332e5e[_0xae37('0x1e')]=qs[_0xae37('0x1e')](_0x26cb87[_0xae37('0x2e')][_0xae37('0x1e')]);}return _0x5d0440[_0xae37('0x48')](_0x332e5e);}})[_0xae37('0x24')](function(_0xd378d5){if(_0xd378d5){return _0xd378d5?{'count':_0x50e6db,'rows':_0xd378d5}:null;}})['then'](respondWithResult(_0x1c3418,null))[_0xae37('0x41')](handleError(_0x1c3418,null));};exports[_0xae37('0x4d')]=function(_0x3cf6ea,_0x5e5c9b,_0x137cb7){if(_0x3cf6ea[_0xae37('0x47')]['id']){delete _0x3cf6ea['body']['id'];}return db[_0xae37('0x29')][_0xae37('0x49')]({'where':{'id':_0x3cf6ea[_0xae37('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e5c9b,null))[_0xae37('0x24')](function(_0x3aa2e3){if(_0x3aa2e3){_0x3cf6ea['body'][_0xae37('0x4e')]=_0x3aa2e3['id'];_0x3cf6ea[_0xae37('0x47')][_0xae37('0x4f')]=integrations[_0xae37('0x50')](_0x3cf6ea['body'][_0xae37('0x51')],_0x3cf6ea[_0xae37('0x47')]['type']);_0x3cf6ea['body'][_0xae37('0x52')]=integrations[_0xae37('0x53')](_0x3cf6ea[_0xae37('0x47')][_0xae37('0x51')],_0x3cf6ea[_0xae37('0x47')]['type']);return db[_0xae37('0x4a')][_0xae37('0x46')](_0x3cf6ea[_0xae37('0x47')],{'include':[{'model':db[_0xae37('0x54')],'as':_0xae37('0x4f')},{'model':db['VtigerField'],'as':_0xae37('0x52')}]});}return null;})[_0xae37('0x24')](respondWithResult(_0x5e5c9b,null))[_0xae37('0x41')](handleError(_0x5e5c9b,null));};var md5=require('md5');exports['getFields']=function(_0x477c42,_0x4b6e56,_0x4a104b){var _0x20bd9d=null;var _0x2ea61b=null;var _0x453e6b=null;var _0x1b10a4=null;var _0x31ec3c='';return db['VtigerAccount'][_0xae37('0x49')]({'where':{'id':_0x477c42['params']['id']},'attributes':['id','name',_0xae37('0x55'),_0xae37('0x56'),_0xae37('0x57'),'remoteUri','serverUrl',_0xae37('0x58')]})[_0xae37('0x24')](handleEntityNotFound(_0x4b6e56,null))[_0xae37('0x24')](function(_0x5ac7ca){if(_0x5ac7ca){_0x20bd9d=_0x5ac7ca[_0xae37('0x55')];_0x2ea61b=_0x5ac7ca['accessKey'];_0x453e6b=_0x5ac7ca['moduleName'];_0x31ec3c=_0x5ac7ca['remoteUri'];var _0x3f14ec=_0x31ec3c[_0xae37('0x59')](-0x1);if(_0x3f14ec==='/'){_0x31ec3c=_0x31ec3c[_0xae37('0x5a')](0x0,_0x31ec3c[_0xae37('0x5b')](_0x3f14ec));}_0x1b10a4=util[_0xae37('0x5c')](_0xae37('0x5d'),_0x31ec3c);var _0x370975={'method':'GET','uri':_0x1b10a4,'qs':{'operation':'getchallenge','username':_0x5ac7ca[_0xae37('0x55')]},'json':!![]};return rp(_0x370975);}})[_0xae37('0x24')](function(_0x5a1bdc){if(_0x5a1bdc[_0xae37('0x5e')]){var _0x500202={'method':_0xae37('0x5f'),'uri':_0x1b10a4,'form':{'operation':_0xae37('0x60'),'username':_0x20bd9d,'accessKey':md5(_0x5a1bdc[_0xae37('0x61')][_0xae37('0x62')]+_0x2ea61b)},'json':!![]};return rp(_0x500202);}})['then'](function(_0x3f1d08){if(_0x3f1d08[_0xae37('0x5e')]){var _0x571c25={'method':_0xae37('0x63'),'uri':_0x1b10a4,'qs':{'operation':_0xae37('0x64'),'username':_0x20bd9d,'sessionName':_0x3f1d08[_0xae37('0x61')]['sessionName'],'elementType':_0x453e6b},'json':!![]};return rp(_0x571c25);}})[_0xae37('0x24')](function(_0xcd2388){if(_0xcd2388[_0xae37('0x5e')]){var _0x1c76e2=[_0xae37('0x65'),_0xae37('0x66'),'owner'];_[_0xae37('0x67')](_0xcd2388[_0xae37('0x61')][_0xae37('0x33')],function(_0x4087b4){return _0x1c76e2[_0xae37('0x68')](_0x4087b4[_0xae37('0x2c')][_0xae37('0x25')]);});_[_0xae37('0x67')](_0xcd2388[_0xae37('0x61')][_0xae37('0x33')],function(_0x5a606d){return _0x5a606d[_0xae37('0x69')]===_0xae37('0x6a');});return{'count':_0xcd2388['result']['fields'][_0xae37('0x34')],'rows':_[_0xae37('0x28')](_0xcd2388[_0xae37('0x61')][_0xae37('0x33')],function(_0xc2887b){return{'id':_0xc2887b['name'],'name':_0xc2887b[_0xae37('0x6b')],'custom':_[_0xae37('0x6c')](_0xc2887b[_0xae37('0x25')],_0xae37('0x6d'))?!![]:![],'options':_0xc2887b[_0xae37('0x2c')][_0xae37('0x25')]===_0xae37('0x6e')&&_0xc2887b['type'][_0xae37('0x6f')][_0xae37('0x34')]>0x0?_[_0xae37('0x28')](_0xc2887b['type'][_0xae37('0x6f')],function(_0x5049c0){return{'name':_0x5049c0[_0xae37('0x6b')],'value':_0x5049c0[_0xae37('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x4b6e56,null))[_0xae37('0x41')](function(_0x5d2482){console[_0xae37('0x71')](_0xae37('0x72')+_0x5d2482);var _0x30c1b9=_0x477c42[_0xae37('0x2e')][_0xae37('0x73')]?0x1f4:_0x5d2482['statusCode']||0x1f4;logger[_0xae37('0x74')](_0xae37('0x75'),'getFields',_0x30c1b9,JSON[_0xae37('0x76')](_0x5d2482));delete _0x5d2482['name'];if(_0x30c1b9===0x191){_0x30c1b9=0x190;}_0x4b6e56[_0xae37('0x19')](_0x30c1b9)[_0xae37('0x26')](_0x477c42[_0xae37('0x2e')][_0xae37('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x5d2482[_0xae37('0x77')]}:_0x5d2482);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 36c733f..f7f5f2c 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 _0x2d79=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x2badc4,_0x350bfc){var _0x1e84bc=function(_0x472896){while(--_0x472896){_0x2badc4['push'](_0x2badc4['shift']());}};_0x1e84bc(++_0x350bfc);}(_0x2d79,0x19f));var _0x92d7=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2d79[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x92d7('0x0'));var util=require(_0x92d7('0x1'));var logger=require(_0x92d7('0x2'))(_0x92d7('0x3'));var moment=require(_0x92d7('0x4'));var BPromise=require(_0x92d7('0x5'));var rp=require(_0x92d7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92d7('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x92d7('0x8'));module[_0x92d7('0x9')]=function(_0x31d336,_0x3b9fe9){return _0x31d336[_0x92d7('0xa')](_0x92d7('0xb'),attributes,{'tableName':_0x92d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81de=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1f2422,_0x125fd2){var _0x4fb420=function(_0x1b8cc6){while(--_0x1b8cc6){_0x1f2422['push'](_0x1f2422['shift']());}};_0x4fb420(++_0x125fd2);}(_0x81de,0x70));var _0xe81d=function(_0x3b4fbe,_0x476304){_0x3b4fbe=_0x3b4fbe-0x0;var _0x5336ec=_0x81de[_0x3b4fbe];return _0x5336ec;};'use strict';var _=require(_0xe81d('0x0'));var util=require('util');var logger=require(_0xe81d('0x1'))(_0xe81d('0x2'));var moment=require(_0xe81d('0x3'));var BPromise=require(_0xe81d('0x4'));var rp=require(_0xe81d('0x5'));var fs=require('fs');var path=require(_0xe81d('0x6'));var rimraf=require(_0xe81d('0x7'));var config=require(_0xe81d('0x8'));var attributes=require(_0xe81d('0x9'));var integrations=require(_0xe81d('0xa'));module[_0xe81d('0xb')]=function(_0x1c9095,_0x5f2d9b){return _0x1c9095[_0xe81d('0xc')](_0xe81d('0xd'),attributes,{'tableName':_0xe81d('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 dca8644..091a77a 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 _0x8f59=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','ShowVtigerAccount','stringify','lodash','util','moment'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0x8f59,0x11d));var _0x98f5=function(_0x41601d,_0x36ad17){_0x41601d=_0x41601d-0x0;var _0x1d5fb2=_0x8f59[_0x41601d];return _0x1d5fb2;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')]({'raw':_0x51a567[_0x98f5('0x17')]?_0x51a567['options'][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x19')]||null:null,'attributes':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'limit':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1b')]||null:null,'include':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')]['include']?_[_0x98f5('0x1c')](_0x51a567['options'][_0x98f5('0x1d')],function(_0x495889){return{'model':db[_0x495889[_0x98f5('0x1e')]],'as':_0x495889['as'],'attributes':_0x495889[_0x98f5('0x1a')],'include':_0x495889[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x495889[_0x98f5('0x1d')],function(_0x18052d){return{'model':db[_0x18052d[_0x98f5('0x1e')]],'as':_0x18052d['as'],'attributes':_0x18052d['attributes'],'include':_0x18052d[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x18052d['include'],function(_0x1a1c55){return{'model':db[_0x1a1c55[_0x98f5('0x1e')]],'as':_0x1a1c55['as'],'attributes':_0x1a1c55[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x230d1b){logger[_0x98f5('0xd')](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x20')]('GetVtigerAccount',_0x51a567,JSON['stringify'](_0x230d1b));_0x9e42dd(_0x230d1b);})[_0x98f5('0x21')](function(_0x71661e){logger[_0x98f5('0x11')](_0x98f5('0x14'),_0x71661e[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c[_0x98f5('0x11')](0x1f4,_0x71661e['message']));});});};exports[_0x98f5('0x22')]=function(_0x6d7418){var _0x7a922b=this;return new Promise(function(_0xd20823,_0x1e7138){return db[_0x98f5('0x15')]['find']({'raw':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x6d7418[_0x98f5('0x17')]?_0x6d7418['options'][_0x98f5('0x19')]||null:null,'attributes':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'include':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')],function(_0x12d874){return{'model':db[_0x12d874[_0x98f5('0x1e')]],'as':_0x12d874['as'],'attributes':_0x12d874[_0x98f5('0x1a')],'include':_0x12d874[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x12d874[_0x98f5('0x1d')],function(_0x2227f1){return{'model':db[_0x2227f1[_0x98f5('0x1e')]],'as':_0x2227f1['as'],'attributes':_0x2227f1[_0x98f5('0x1a')],'include':_0x2227f1[_0x98f5('0x1d')]?_['map'](_0x2227f1[_0x98f5('0x1d')],function(_0x4aba7a){return{'model':db[_0x4aba7a['model']],'as':_0x4aba7a['as'],'attributes':_0x4aba7a[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x65c03b){logger[_0x98f5('0xd')]('ShowVtigerAccount',_0x6d7418);logger[_0x98f5('0x20')](_0x98f5('0x22'),_0x6d7418,JSON[_0x98f5('0x23')](_0x65c03b));_0xd20823(_0x65c03b);})['catch'](function(_0x17bfe2){logger[_0x98f5('0x11')]('ShowVtigerAccount',_0x17bfe2[_0x98f5('0x12')],_0x6d7418);_0x1e7138(_0x7a922b[_0x98f5('0x11')](0x1f4,_0x17bfe2[_0x98f5('0x12')]));});});}; \ No newline at end of file +var _0x1339=['stringify','error','code','message','result','catch','VtigerAccount','findAll','options','attributes','map','include','model','GetVtigerAccount','debug','raw','ShowVtigerAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3ed4d7,_0x3783e0){var _0x2be1a4=function(_0x5d492f){while(--_0x5d492f){_0x3ed4d7['push'](_0x3ed4d7['shift']());}};_0x2be1a4(++_0x3783e0);}(_0x1339,0x1ed));var _0x9133=function(_0x2306f5,_0x5981c8){_0x2306f5=_0x2306f5-0x0;var _0x3f13e7=_0x1339[_0x2306f5];return _0x3f13e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});}exports['GetVtigerAccount']=function(_0x1f3484){var _0x573998=this;return new Promise(function(_0x3c48ef,_0x5d4a77){return db[_0x9133('0x17')][_0x9133('0x18')]({'raw':_0x1f3484['options']?_0x1f3484[_0x9133('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options']['where']||null:null,'attributes':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options'][_0x9133('0x1a')]||null:null,'limit':_0x1f3484['options']?_0x1f3484['options']['limit']||null:null,'include':_0x1f3484[_0x9133('0x19')]?_0x1f3484[_0x9133('0x19')]['include']?_[_0x9133('0x1b')](_0x1f3484[_0x9133('0x19')][_0x9133('0x1c')],function(_0x26190c){return{'model':db[_0x26190c['model']],'as':_0x26190c['as'],'attributes':_0x26190c[_0x9133('0x1a')],'include':_0x26190c['include']?_[_0x9133('0x1b')](_0x26190c[_0x9133('0x1c')],function(_0x3f278d){return{'model':db[_0x3f278d[_0x9133('0x1d')]],'as':_0x3f278d['as'],'attributes':_0x3f278d[_0x9133('0x1a')],'include':_0x3f278d[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x3f278d[_0x9133('0x1c')],function(_0x1b6b3e){return{'model':db[_0x1b6b3e[_0x9133('0x1d')]],'as':_0x1b6b3e['as'],'attributes':_0x1b6b3e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x477bf1){logger[_0x9133('0xd')](_0x9133('0x1e'),_0x1f3484);logger[_0x9133('0x1f')]('GetVtigerAccount',_0x1f3484,JSON['stringify'](_0x477bf1));_0x3c48ef(_0x477bf1);})[_0x9133('0x16')](function(_0x45966d){logger[_0x9133('0x12')](_0x9133('0x1e'),_0x45966d[_0x9133('0x14')],_0x1f3484);_0x5d4a77(_0x573998[_0x9133('0x12')](0x1f4,_0x45966d['message']));});});};exports['ShowVtigerAccount']=function(_0x5a27c1){var _0x1ad222=this;return new Promise(function(_0x4a4a8e,_0x43b5f3){return db[_0x9133('0x17')]['find']({'raw':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1['options'][_0x9133('0x20')]===undefined?!![]:![]:!![],'where':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')]['where']||null:null,'attributes':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1a')]||null:null,'include':_0x5a27c1['options']?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x5a27c1['options'][_0x9133('0x1c')],function(_0x20da68){return{'model':db[_0x20da68[_0x9133('0x1d')]],'as':_0x20da68['as'],'attributes':_0x20da68[_0x9133('0x1a')],'include':_0x20da68['include']?_[_0x9133('0x1b')](_0x20da68[_0x9133('0x1c')],function(_0x56719e){return{'model':db[_0x56719e[_0x9133('0x1d')]],'as':_0x56719e['as'],'attributes':_0x56719e[_0x9133('0x1a')],'include':_0x56719e[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x56719e[_0x9133('0x1c')],function(_0x2db377){return{'model':db[_0x2db377[_0x9133('0x1d')]],'as':_0x2db377['as'],'attributes':_0x2db377[_0x9133('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9133('0xc')](function(_0x335217){logger[_0x9133('0xd')]('ShowVtigerAccount',_0x5a27c1);logger[_0x9133('0x1f')](_0x9133('0x21'),_0x5a27c1,JSON['stringify'](_0x335217));_0x4a4a8e(_0x335217);})[_0x9133('0x16')](function(_0x3a2d1f){logger[_0x9133('0x12')](_0x9133('0x21'),_0x3a2d1f[_0x9133('0x14')],_0x5a27c1);_0x43b5f3(_0x1ad222[_0x9133('0x12')](0x1f4,_0x3a2d1f['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 760c4c7..b274efb 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 _0x8507=['/:id','getFields','getSubjects','/:id/descriptions','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get'];(function(_0x2ad77d,_0x1fc36c){var _0x427bb7=function(_0xf13b19){while(--_0xf13b19){_0x2ad77d['push'](_0x2ad77d['shift']());}};_0x427bb7(++_0x1fc36c);}(_0x8507,0x137));var _0x7850=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8507[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7850('0x0'));var util=require('util');var path=require(_0x7850('0x1'));var timeout=require(_0x7850('0x2'));var express=require(_0x7850('0x3'));var router=express['Router']();var fs_extra=require(_0x7850('0x4'));var auth=require(_0x7850('0x5'));var interaction=require(_0x7850('0x6'));var config=require('../../config/environment');var controller=require(_0x7850('0x7'));router[_0x7850('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7850('0x8')](_0x7850('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x7850('0xa')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x7850('0xb')]);router[_0x7850('0x8')](_0x7850('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x7850('0xd')]('/',auth[_0x7850('0xe')](),controller[_0x7850('0xf')]);router['put'](_0x7850('0x9'),auth[_0x7850('0xe')](),controller[_0x7850('0x10')]);router[_0x7850('0x11')](_0x7850('0x9'),auth[_0x7850('0xe')](),controller[_0x7850('0x12')]);module[_0x7850('0x13')]=router; \ No newline at end of file +var _0x5eed=['isAuthenticated','getDescriptions','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','/:id/fields'];(function(_0x21f9b6,_0x5c1d3f){var _0x3dba48=function(_0x561a34){while(--_0x561a34){_0x21f9b6['push'](_0x21f9b6['shift']());}};_0x3dba48(++_0x5c1d3f);}(_0x5eed,0x15b));var _0xd5ee=function(_0x3a9787,_0x4e7085){_0x3a9787=_0x3a9787-0x0;var _0xd0bf99=_0x5eed[_0x3a9787];return _0xd0bf99;};'use strict';var multer=require(_0xd5ee('0x0'));var util=require(_0xd5ee('0x1'));var path=require('path');var timeout=require(_0xd5ee('0x2'));var express=require(_0xd5ee('0x3'));var router=express[_0xd5ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5ee('0x5'));var interaction=require(_0xd5ee('0x6'));var config=require(_0xd5ee('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd5ee('0x8')]);router[_0xd5ee('0x9')](_0xd5ee('0xa'),auth['isAuthenticated'](),controller[_0xd5ee('0xb')]);router[_0xd5ee('0x9')](_0xd5ee('0xc'),auth[_0xd5ee('0xd')](),controller['getFields']);router[_0xd5ee('0x9')]('/:id/subjects',auth[_0xd5ee('0xd')](),controller['getSubjects']);router[_0xd5ee('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xd5ee('0xe')]);router[_0xd5ee('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd5ee('0x10')](_0xd5ee('0xa'),auth['isAuthenticated'](),controller[_0xd5ee('0x11')]);router[_0xd5ee('0x12')](_0xd5ee('0xa'),auth[_0xd5ee('0xd')](),controller[_0xd5ee('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e7dac9c..ceaf910 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 _0x1447=['sequelize','STRING'];(function(_0x54a77c,_0x4e2293){var _0x559947=function(_0xd4bef6){while(--_0xd4bef6){_0x54a77c['push'](_0x54a77c['shift']());}};_0x559947(++_0x4e2293);}(_0x1447,0x1b0));var _0x7144=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x1447[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x7144('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7144('0x1')]}}; \ No newline at end of file +var _0xb54c=['STRING','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb54c,0x14d));var _0xcb54=function(_0x3cb4e4,_0x41b1d2){_0x3cb4e4=_0x3cb4e4-0x0;var _0x34e13c=_0xb54c[_0x3cb4e4];return _0x34e13c;};'use strict';var Sequelize=require('sequelize');module[_0xcb54('0x0')]={'name':{'type':Sequelize[_0xcb54('0x1')]},'description':{'type':Sequelize[_0xcb54('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6375191..bc7fea3 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 _0x2fc2=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','destroy','getFields','VtigerField','order','getSubjects','findOne','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1d074b,_0x3264c3){var _0x28f1b9=function(_0x59307c){while(--_0x59307c){_0x1d074b['push'](_0x1d074b['shift']());}};_0x28f1b9(++_0x3264c3);}(_0x2fc2,0x193));var _0x22fc=function(_0x4d3f2f,_0x3b03c9){_0x4d3f2f=_0x4d3f2f-0x0;var _0x346b82=_0x2fc2[_0x4d3f2f];return _0x346b82;};'use strict';var emlformat=require(_0x22fc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x22fc('0x1'));var rp=require(_0x22fc('0x2'));var moment=require(_0x22fc('0x3'));var BPromise=require(_0x22fc('0x4'));var Mustache=require(_0x22fc('0x5'));var util=require(_0x22fc('0x6'));var path=require(_0x22fc('0x7'));var sox=require(_0x22fc('0x8'));var csv=require(_0x22fc('0x9'));var ejs=require(_0x22fc('0xa'));var fs=require('fs');var fs_extra=require(_0x22fc('0xb'));var _=require(_0x22fc('0xc'));var squel=require(_0x22fc('0xd'));var crypto=require(_0x22fc('0xe'));var jsforce=require(_0x22fc('0xf'));var deskjs=require(_0x22fc('0x10'));var toCsv=require(_0x22fc('0x9'));var querystring=require('querystring');var Papa=require(_0x22fc('0x11'));var Redis=require(_0x22fc('0x12'));var authService=require(_0x22fc('0x13'));var qs=require(_0x22fc('0x14'));var as=require(_0x22fc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22fc('0x16'))(_0x22fc('0x17'));var utils=require('../../config/utils');var config=require(_0x22fc('0x18'));var licenseUtil=require(_0x22fc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45de5,_0x461dd9){_0x461dd9=_0x461dd9||0xcc;return function(_0x276429){if(_0x276429){return _0x45de5['sendStatus'](_0x461dd9);}return _0x45de5[_0x22fc('0x1a')](_0x461dd9)[_0x22fc('0x1b')]();};}function respondWithResult(_0x25d693,_0x4b2796){_0x4b2796=_0x4b2796||0xc8;return function(_0x163de9){if(_0x163de9){return _0x25d693[_0x22fc('0x1a')](_0x4b2796)[_0x22fc('0x1c')](_0x163de9);}};}function respondWithFilteredResult(_0x1516e7,_0x399cdd){return function(_0x14115f){if(_0x14115f){var _0x517797=typeof _0x399cdd[_0x22fc('0x1d')]==='undefined'&&typeof _0x399cdd[_0x22fc('0x1e')]===_0x22fc('0x1f');var _0x46ccb9=_0x14115f[_0x22fc('0x20')];var _0x4b2872=_0x517797?0x0:_0x399cdd[_0x22fc('0x1d')];var _0x5dd580=_0x517797?_0x14115f['count']:_0x399cdd['offset']+_0x399cdd[_0x22fc('0x1e')];var _0x549792;if(_0x5dd580>=_0x46ccb9){_0x5dd580=_0x46ccb9;_0x549792=0xc8;}else{_0x549792=0xce;}_0x1516e7[_0x22fc('0x1a')](_0x549792);return _0x1516e7[_0x22fc('0x21')](_0x22fc('0x22'),_0x4b2872+'-'+_0x5dd580+'/'+_0x46ccb9)[_0x22fc('0x1c')](_0x14115f);}return null;};}function patchUpdates(_0x52fe71){return function(_0x1e05f2){try{jsonpatch['apply'](_0x1e05f2,_0x52fe71,!![]);}catch(_0x11d458){return BPromise[_0x22fc('0x23')](_0x11d458);}return _0x1e05f2[_0x22fc('0x24')]();};}function saveUpdates(_0x4bbc42,_0x3448f6){return function(_0x554cd0){if(_0x554cd0){return _0x554cd0[_0x22fc('0x25')](_0x4bbc42)[_0x22fc('0x26')](function(_0x1ea003){return _0x1ea003;});}return null;};}function removeEntity(_0x4f7380,_0xa79664){return function(_0x2b9be1){if(_0x2b9be1){return _0x2b9be1['destroy']()[_0x22fc('0x26')](function(){_0x4f7380[_0x22fc('0x1a')](0xcc)[_0x22fc('0x1b')]();});}};}function handleEntityNotFound(_0x16bd7b,_0x1ce397){return function(_0x42a00e){if(!_0x42a00e){_0x16bd7b[_0x22fc('0x27')](0x194);}return _0x42a00e;};}function handleError(_0x37d3c4,_0xd4bb21){_0xd4bb21=_0xd4bb21||0x1f4;return function(_0x382d19){logger['error'](_0x382d19[_0x22fc('0x28')]);if(_0x382d19[_0x22fc('0x29')]){delete _0x382d19['name'];}_0x37d3c4['status'](_0xd4bb21)[_0x22fc('0x2a')](_0x382d19);};}exports[_0x22fc('0x2b')]=function(_0x328615,_0x2bfc75){var _0x33e0d1={},_0x481bc1={},_0x17e2d4={'count':0x0,'rows':[]};var _0x1c5045=_[_0x22fc('0x2c')](db[_0x22fc('0x2d')][_0x22fc('0x2e')],function(_0x2b84d1){return{'name':_0x2b84d1[_0x22fc('0x2f')],'type':_0x2b84d1[_0x22fc('0x30')][_0x22fc('0x31')]};});_0x481bc1['model']=_[_0x22fc('0x2c')](_0x1c5045,_0x22fc('0x29'));_0x481bc1[_0x22fc('0x32')]=_[_0x22fc('0x33')](_0x328615[_0x22fc('0x32')]);_0x481bc1[_0x22fc('0x34')]=_[_0x22fc('0x35')](_0x481bc1['model'],_0x481bc1['query']);_0x33e0d1[_0x22fc('0x36')]=_['intersection'](_0x481bc1[_0x22fc('0x37')],qs[_0x22fc('0x38')](_0x328615[_0x22fc('0x32')][_0x22fc('0x38')]));_0x33e0d1[_0x22fc('0x36')]=_0x33e0d1[_0x22fc('0x36')][_0x22fc('0x39')]?_0x33e0d1[_0x22fc('0x36')]:_0x481bc1[_0x22fc('0x37')];if(!_0x328615[_0x22fc('0x32')][_0x22fc('0x3a')](_0x22fc('0x3b'))){_0x33e0d1[_0x22fc('0x1e')]=qs['limit'](_0x328615[_0x22fc('0x32')]['limit']);_0x33e0d1[_0x22fc('0x1d')]=qs[_0x22fc('0x1d')](_0x328615['query'][_0x22fc('0x1d')]);}_0x33e0d1['order']=qs['sort'](_0x328615[_0x22fc('0x32')][_0x22fc('0x3c')]);_0x33e0d1[_0x22fc('0x3d')]=qs[_0x22fc('0x34')](_[_0x22fc('0x3e')](_0x328615[_0x22fc('0x32')],_0x481bc1[_0x22fc('0x34')]),_0x1c5045);if(_0x328615[_0x22fc('0x32')][_0x22fc('0x3f')]){_0x33e0d1['where']=_[_0x22fc('0x40')](_0x33e0d1[_0x22fc('0x3d')],{'$or':_[_0x22fc('0x2c')](_0x1c5045,function(_0x1b832c){if(_0x1b832c[_0x22fc('0x30')]!==_0x22fc('0x41')){var _0xc7b8ea={};_0xc7b8ea[_0x1b832c[_0x22fc('0x29')]]={'$like':'%'+_0x328615[_0x22fc('0x32')]['filter']+'%'};return _0xc7b8ea;}})});}_0x33e0d1=_[_0x22fc('0x40')]({},_0x33e0d1,_0x328615[_0x22fc('0x42')]);var _0x210226={'where':_0x33e0d1[_0x22fc('0x3d')]};return db[_0x22fc('0x2d')][_0x22fc('0x20')](_0x210226)['then'](function(_0x2cb287){_0x17e2d4[_0x22fc('0x20')]=_0x2cb287;if(_0x328615[_0x22fc('0x32')]['includeAll']){_0x33e0d1['include']=[{'all':!![]}];}return db[_0x22fc('0x2d')][_0x22fc('0x43')](_0x33e0d1);})[_0x22fc('0x26')](function(_0x28d807){_0x17e2d4[_0x22fc('0x44')]=_0x28d807;return _0x17e2d4;})[_0x22fc('0x26')](respondWithFilteredResult(_0x2bfc75,_0x33e0d1))[_0x22fc('0x45')](handleError(_0x2bfc75,null));};exports['show']=function(_0x16c368,_0x15cc68){var _0x5cd66e={'raw':![],'where':{'id':_0x16c368[_0x22fc('0x46')]['id']}},_0xcbc2dd={};_0xcbc2dd[_0x22fc('0x37')]=_[_0x22fc('0x33')](db['VtigerConfiguration']['rawAttributes']);_0xcbc2dd[_0x22fc('0x32')]=_[_0x22fc('0x33')](_0x16c368['query']);_0xcbc2dd['filters']=_['intersection'](_0xcbc2dd[_0x22fc('0x37')],_0xcbc2dd[_0x22fc('0x32')]);_0x5cd66e[_0x22fc('0x36')]=_[_0x22fc('0x35')](_0xcbc2dd[_0x22fc('0x37')],qs[_0x22fc('0x38')](_0x16c368['query'][_0x22fc('0x38')]));_0x5cd66e[_0x22fc('0x36')]=_0x5cd66e['attributes']['length']?_0x5cd66e[_0x22fc('0x36')]:_0xcbc2dd['model'];if(_0x16c368[_0x22fc('0x32')][_0x22fc('0x47')]){_0x5cd66e[_0x22fc('0x48')]=[{'all':!![]}];}_0x5cd66e=_[_0x22fc('0x40')]({},_0x5cd66e,_0x16c368[_0x22fc('0x42')]);return db[_0x22fc('0x2d')][_0x22fc('0x49')](_0x5cd66e)[_0x22fc('0x26')](handleEntityNotFound(_0x15cc68,null))[_0x22fc('0x26')](respondWithResult(_0x15cc68,null))[_0x22fc('0x45')](handleError(_0x15cc68,null));};exports[_0x22fc('0x4a')]=function(_0x1b9b26,_0x200975){return db[_0x22fc('0x2d')][_0x22fc('0x4a')](_0x1b9b26[_0x22fc('0x4b')],{})[_0x22fc('0x26')](respondWithResult(_0x200975,0xc9))['catch'](handleError(_0x200975,null));};exports[_0x22fc('0x25')]=function(_0x3c3899,_0x1340b0){if(_0x3c3899['body']['id']){delete _0x3c3899[_0x22fc('0x4b')]['id'];}return db[_0x22fc('0x2d')][_0x22fc('0x49')]({'where':{'id':_0x3c3899[_0x22fc('0x46')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x1340b0,null))[_0x22fc('0x26')](saveUpdates(_0x3c3899['body'],null))['then'](respondWithResult(_0x1340b0,null))[_0x22fc('0x45')](handleError(_0x1340b0,null));};exports[_0x22fc('0x4c')]=function(_0x528c4a,_0x462262){return db[_0x22fc('0x2d')][_0x22fc('0x49')]({'where':{'id':_0x528c4a[_0x22fc('0x46')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x462262,null))['then'](removeEntity(_0x462262,null))[_0x22fc('0x45')](handleError(_0x462262,null));};exports[_0x22fc('0x4d')]=function(_0x5577fd,_0x2301c2,_0x345100){var _0x29221b={};var _0x43e02d={};var _0x94339d;var _0x37a17c;return db[_0x22fc('0x2d')]['findOne']({'where':{'id':_0x5577fd['params']['id']}})['then'](handleEntityNotFound(_0x2301c2,null))['then'](function(_0x450366){if(_0x450366){_0x94339d=_0x450366;_0x43e02d[_0x22fc('0x37')]=_[_0x22fc('0x33')](db[_0x22fc('0x4e')]['rawAttributes']);_0x43e02d[_0x22fc('0x32')]=_['keys'](_0x5577fd[_0x22fc('0x32')]);_0x43e02d[_0x22fc('0x34')]=_['intersection'](_0x43e02d[_0x22fc('0x37')],_0x43e02d[_0x22fc('0x32')]);_0x29221b[_0x22fc('0x36')]=_[_0x22fc('0x35')](_0x43e02d[_0x22fc('0x37')],qs[_0x22fc('0x38')](_0x5577fd[_0x22fc('0x32')]['fields']));_0x29221b['attributes']=_0x29221b[_0x22fc('0x36')][_0x22fc('0x39')]?_0x29221b[_0x22fc('0x36')]:_0x43e02d[_0x22fc('0x37')];_0x29221b[_0x22fc('0x4f')]=qs['sort'](_0x5577fd[_0x22fc('0x32')][_0x22fc('0x3c')]);_0x29221b['where']=qs['filters'](_[_0x22fc('0x3e')](_0x5577fd['query'],_0x43e02d[_0x22fc('0x34')]));if(_0x5577fd[_0x22fc('0x32')][_0x22fc('0x3f')]){_0x29221b[_0x22fc('0x3d')]=_['merge'](_0x29221b[_0x22fc('0x3d')],{'$or':_['map'](_0x29221b['attributes'],function(_0x5d8879){var _0x5f1523={};_0x5f1523[_0x5d8879]={'$like':'%'+_0x5577fd['query'][_0x22fc('0x3f')]+'%'};return _0x5f1523;})});}_0x29221b=_['merge']({},_0x29221b,_0x5577fd['options']);return _0x94339d[_0x22fc('0x4d')](_0x29221b);}})[_0x22fc('0x26')](function(_0x518b5e){if(_0x518b5e){_0x37a17c=_0x518b5e[_0x22fc('0x39')];if(!_0x5577fd[_0x22fc('0x32')][_0x22fc('0x3a')](_0x22fc('0x3b'))){_0x29221b[_0x22fc('0x1e')]=qs[_0x22fc('0x1e')](_0x5577fd['query']['limit']);_0x29221b[_0x22fc('0x1d')]=qs[_0x22fc('0x1d')](_0x5577fd[_0x22fc('0x32')][_0x22fc('0x1d')]);}return _0x94339d[_0x22fc('0x4d')](_0x29221b);}})[_0x22fc('0x26')](function(_0x465104){if(_0x465104){return _0x465104?{'count':_0x37a17c,'rows':_0x465104}:null;}})[_0x22fc('0x26')](respondWithResult(_0x2301c2,null))[_0x22fc('0x45')](handleError(_0x2301c2,null));};exports[_0x22fc('0x50')]=function(_0x45e6f7,_0x3802a4,_0x3b15e1){var _0x263591={};var _0x56c902={};var _0x3883e3;var _0x103714;return db['VtigerConfiguration'][_0x22fc('0x51')]({'where':{'id':_0x45e6f7[_0x22fc('0x46')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x3802a4,null))[_0x22fc('0x26')](function(_0x28fec8){if(_0x28fec8){_0x3883e3=_0x28fec8;_0x56c902[_0x22fc('0x37')]=_[_0x22fc('0x33')](db['VtigerField'][_0x22fc('0x2e')]);_0x56c902[_0x22fc('0x32')]=_[_0x22fc('0x33')](_0x45e6f7[_0x22fc('0x32')]);_0x56c902[_0x22fc('0x34')]=_[_0x22fc('0x35')](_0x56c902[_0x22fc('0x37')],_0x56c902[_0x22fc('0x32')]);_0x263591[_0x22fc('0x36')]=_[_0x22fc('0x35')](_0x56c902[_0x22fc('0x37')],qs[_0x22fc('0x38')](_0x45e6f7[_0x22fc('0x32')][_0x22fc('0x38')]));_0x263591['attributes']=_0x263591[_0x22fc('0x36')][_0x22fc('0x39')]?_0x263591[_0x22fc('0x36')]:_0x56c902[_0x22fc('0x37')];_0x263591[_0x22fc('0x4f')]=qs[_0x22fc('0x3c')](_0x45e6f7[_0x22fc('0x32')]['sort']);_0x263591[_0x22fc('0x3d')]=qs[_0x22fc('0x34')](_[_0x22fc('0x3e')](_0x45e6f7[_0x22fc('0x32')],_0x56c902['filters']));if(_0x45e6f7[_0x22fc('0x32')][_0x22fc('0x3f')]){_0x263591[_0x22fc('0x3d')]=_['merge'](_0x263591[_0x22fc('0x3d')],{'$or':_[_0x22fc('0x2c')](_0x263591['attributes'],function(_0x52d3c6){var _0x5dad70={};_0x5dad70[_0x52d3c6]={'$like':'%'+_0x45e6f7[_0x22fc('0x32')][_0x22fc('0x3f')]+'%'};return _0x5dad70;})});}_0x263591=_['merge']({},_0x263591,_0x45e6f7[_0x22fc('0x42')]);return _0x3883e3[_0x22fc('0x50')](_0x263591);}})['then'](function(_0xf20e04){if(_0xf20e04){_0x103714=_0xf20e04[_0x22fc('0x39')];if(!_0x45e6f7[_0x22fc('0x32')][_0x22fc('0x3a')](_0x22fc('0x3b'))){_0x263591[_0x22fc('0x1e')]=qs['limit'](_0x45e6f7[_0x22fc('0x32')][_0x22fc('0x1e')]);_0x263591[_0x22fc('0x1d')]=qs[_0x22fc('0x1d')](_0x45e6f7[_0x22fc('0x32')]['offset']);}return _0x3883e3[_0x22fc('0x50')](_0x263591);}})[_0x22fc('0x26')](function(_0x4624af){if(_0x4624af){return _0x4624af?{'count':_0x103714,'rows':_0x4624af}:null;}})[_0x22fc('0x26')](respondWithResult(_0x3802a4,null))['catch'](handleError(_0x3802a4,null));};exports[_0x22fc('0x52')]=function(_0x55c47e,_0x28b1d0,_0xe8248d){var _0x266533={};var _0x1ec4a6={};var _0x2b692e;var _0x4ac908;return db[_0x22fc('0x2d')][_0x22fc('0x51')]({'where':{'id':_0x55c47e[_0x22fc('0x46')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x28b1d0,null))['then'](function(_0x317ab3){if(_0x317ab3){_0x2b692e=_0x317ab3;_0x1ec4a6['model']=_[_0x22fc('0x33')](db['VtigerField'][_0x22fc('0x2e')]);_0x1ec4a6[_0x22fc('0x32')]=_[_0x22fc('0x33')](_0x55c47e[_0x22fc('0x32')]);_0x1ec4a6[_0x22fc('0x34')]=_[_0x22fc('0x35')](_0x1ec4a6['model'],_0x1ec4a6[_0x22fc('0x32')]);_0x266533[_0x22fc('0x36')]=_[_0x22fc('0x35')](_0x1ec4a6[_0x22fc('0x37')],qs[_0x22fc('0x38')](_0x55c47e[_0x22fc('0x32')]['fields']));_0x266533[_0x22fc('0x36')]=_0x266533[_0x22fc('0x36')][_0x22fc('0x39')]?_0x266533[_0x22fc('0x36')]:_0x1ec4a6['model'];_0x266533[_0x22fc('0x4f')]=qs[_0x22fc('0x3c')](_0x55c47e[_0x22fc('0x32')][_0x22fc('0x3c')]);_0x266533['where']=qs['filters'](_[_0x22fc('0x3e')](_0x55c47e[_0x22fc('0x32')],_0x1ec4a6[_0x22fc('0x34')]));if(_0x55c47e[_0x22fc('0x32')]['filter']){_0x266533[_0x22fc('0x3d')]=_['merge'](_0x266533[_0x22fc('0x3d')],{'$or':_[_0x22fc('0x2c')](_0x266533[_0x22fc('0x36')],function(_0x572f02){var _0x16d8ac={};_0x16d8ac[_0x572f02]={'$like':'%'+_0x55c47e[_0x22fc('0x32')][_0x22fc('0x3f')]+'%'};return _0x16d8ac;})});}_0x266533=_[_0x22fc('0x40')]({},_0x266533,_0x55c47e[_0x22fc('0x42')]);return _0x2b692e[_0x22fc('0x52')](_0x266533);}})[_0x22fc('0x26')](function(_0x269388){if(_0x269388){_0x4ac908=_0x269388[_0x22fc('0x39')];if(!_0x55c47e[_0x22fc('0x32')][_0x22fc('0x3a')]('nolimit')){_0x266533[_0x22fc('0x1e')]=qs[_0x22fc('0x1e')](_0x55c47e[_0x22fc('0x32')]['limit']);_0x266533[_0x22fc('0x1d')]=qs[_0x22fc('0x1d')](_0x55c47e[_0x22fc('0x32')][_0x22fc('0x1d')]);}return _0x2b692e[_0x22fc('0x52')](_0x266533);}})[_0x22fc('0x26')](function(_0x2799ad){if(_0x2799ad){return _0x2799ad?{'count':_0x4ac908,'rows':_0x2799ad}:null;}})['then'](respondWithResult(_0x28b1d0,null))['catch'](handleError(_0x28b1d0,null));}; \ No newline at end of file +var _0x780c=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VtigerConfiguration','include','findAll','show','params','includeAll','find','create','body','catch','findOne','VtigerField','options','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x2d9da8,_0x521e7c){var _0x34ca6f=function(_0x426f77){while(--_0x426f77){_0x2d9da8['push'](_0x2d9da8['shift']());}};_0x34ca6f(++_0x521e7c);}(_0x780c,0x72));var _0xc780=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x780c[_0x235f49];return _0x551139;};'use strict';var emlformat=require(_0xc780('0x0'));var rimraf=require(_0xc780('0x1'));var zipdir=require(_0xc780('0x2'));var jsonpatch=require(_0xc780('0x3'));var rp=require(_0xc780('0x4'));var moment=require('moment');var BPromise=require(_0xc780('0x5'));var Mustache=require(_0xc780('0x6'));var util=require(_0xc780('0x7'));var path=require(_0xc780('0x8'));var sox=require(_0xc780('0x9'));var csv=require(_0xc780('0xa'));var ejs=require(_0xc780('0xb'));var fs=require('fs');var fs_extra=require(_0xc780('0xc'));var _=require(_0xc780('0xd'));var squel=require(_0xc780('0xe'));var crypto=require('crypto');var jsforce=require(_0xc780('0xf'));var deskjs=require(_0xc780('0x10'));var toCsv=require(_0xc780('0xa'));var querystring=require(_0xc780('0x11'));var Papa=require(_0xc780('0x12'));var Redis=require(_0xc780('0x13'));var authService=require(_0xc780('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc780('0x15'));var logger=require(_0xc780('0x16'))(_0xc780('0x17'));var utils=require('../../config/utils');var config=require(_0xc780('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc780('0x19'))['db'];function respondWithStatusCode(_0x3fd7e6,_0x46222e){_0x46222e=_0x46222e||0xcc;return function(_0x123fbd){if(_0x123fbd){return _0x3fd7e6[_0xc780('0x1a')](_0x46222e);}return _0x3fd7e6['status'](_0x46222e)[_0xc780('0x1b')]();};}function respondWithResult(_0x429ae4,_0xfbe616){_0xfbe616=_0xfbe616||0xc8;return function(_0x340d4c){if(_0x340d4c){return _0x429ae4[_0xc780('0x1c')](_0xfbe616)[_0xc780('0x1d')](_0x340d4c);}};}function respondWithFilteredResult(_0x228738,_0x181e38){return function(_0x4c75ba){if(_0x4c75ba){var _0x5211f4=typeof _0x181e38[_0xc780('0x1e')]==='undefined'&&typeof _0x181e38[_0xc780('0x1f')]==='undefined';var _0x3f7885=_0x4c75ba[_0xc780('0x20')];var _0x48bc11=_0x5211f4?0x0:_0x181e38[_0xc780('0x1e')];var _0x57277f=_0x5211f4?_0x4c75ba['count']:_0x181e38['offset']+_0x181e38[_0xc780('0x1f')];var _0xf2fad9;if(_0x57277f>=_0x3f7885){_0x57277f=_0x3f7885;_0xf2fad9=0xc8;}else{_0xf2fad9=0xce;}_0x228738['status'](_0xf2fad9);return _0x228738[_0xc780('0x21')](_0xc780('0x22'),_0x48bc11+'-'+_0x57277f+'/'+_0x3f7885)[_0xc780('0x1d')](_0x4c75ba);}return null;};}function patchUpdates(_0x2650fd){return function(_0x5260a3){try{jsonpatch[_0xc780('0x23')](_0x5260a3,_0x2650fd,!![]);}catch(_0x207de9){return BPromise[_0xc780('0x24')](_0x207de9);}return _0x5260a3['save']();};}function saveUpdates(_0x3c105d,_0x909032){return function(_0x5bd5b2){if(_0x5bd5b2){return _0x5bd5b2[_0xc780('0x25')](_0x3c105d)['then'](function(_0xdf793f){return _0xdf793f;});}return null;};}function removeEntity(_0x4ba992,_0x5b1541){return function(_0x3a78ed){if(_0x3a78ed){return _0x3a78ed[_0xc780('0x26')]()[_0xc780('0x27')](function(){_0x4ba992[_0xc780('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee9d73,_0x1c41ca){return function(_0x836413){if(!_0x836413){_0xee9d73[_0xc780('0x1a')](0x194);}return _0x836413;};}function handleError(_0x3ab33b,_0x1ad72f){_0x1ad72f=_0x1ad72f||0x1f4;return function(_0x5e6afa){logger[_0xc780('0x28')](_0x5e6afa[_0xc780('0x29')]);if(_0x5e6afa[_0xc780('0x2a')]){delete _0x5e6afa[_0xc780('0x2a')];}_0x3ab33b['status'](_0x1ad72f)[_0xc780('0x2b')](_0x5e6afa);};}exports[_0xc780('0x2c')]=function(_0x150e1e,_0x493e3e){var _0x4d93c0={},_0x59549b={},_0x10d61f={'count':0x0,'rows':[]};var _0x1398e1=_[_0xc780('0x2d')](db['VtigerConfiguration'][_0xc780('0x2e')],function(_0x2ecce9){return{'name':_0x2ecce9[_0xc780('0x2f')],'type':_0x2ecce9[_0xc780('0x30')][_0xc780('0x31')]};});_0x59549b[_0xc780('0x32')]=_[_0xc780('0x2d')](_0x1398e1,_0xc780('0x2a'));_0x59549b[_0xc780('0x33')]=_[_0xc780('0x34')](_0x150e1e[_0xc780('0x33')]);_0x59549b[_0xc780('0x35')]=_[_0xc780('0x36')](_0x59549b['model'],_0x59549b[_0xc780('0x33')]);_0x4d93c0[_0xc780('0x37')]=_[_0xc780('0x36')](_0x59549b[_0xc780('0x32')],qs[_0xc780('0x38')](_0x150e1e[_0xc780('0x33')]['fields']));_0x4d93c0[_0xc780('0x37')]=_0x4d93c0[_0xc780('0x37')][_0xc780('0x39')]?_0x4d93c0[_0xc780('0x37')]:_0x59549b[_0xc780('0x32')];if(!_0x150e1e[_0xc780('0x33')][_0xc780('0x3a')](_0xc780('0x3b'))){_0x4d93c0[_0xc780('0x1f')]=qs[_0xc780('0x1f')](_0x150e1e[_0xc780('0x33')][_0xc780('0x1f')]);_0x4d93c0[_0xc780('0x1e')]=qs[_0xc780('0x1e')](_0x150e1e[_0xc780('0x33')][_0xc780('0x1e')]);}_0x4d93c0[_0xc780('0x3c')]=qs['sort'](_0x150e1e['query'][_0xc780('0x3d')]);_0x4d93c0['where']=qs[_0xc780('0x35')](_[_0xc780('0x3e')](_0x150e1e[_0xc780('0x33')],_0x59549b[_0xc780('0x35')]),_0x1398e1);if(_0x150e1e['query'][_0xc780('0x3f')]){_0x4d93c0[_0xc780('0x40')]=_[_0xc780('0x41')](_0x4d93c0[_0xc780('0x40')],{'$or':_[_0xc780('0x2d')](_0x1398e1,function(_0x5ffc17){if(_0x5ffc17[_0xc780('0x30')]!=='VIRTUAL'){var _0x4cbd37={};_0x4cbd37[_0x5ffc17['name']]={'$like':'%'+_0x150e1e[_0xc780('0x33')][_0xc780('0x3f')]+'%'};return _0x4cbd37;}})});}_0x4d93c0=_[_0xc780('0x41')]({},_0x4d93c0,_0x150e1e['options']);var _0x2eb637={'where':_0x4d93c0[_0xc780('0x40')]};return db[_0xc780('0x42')][_0xc780('0x20')](_0x2eb637)['then'](function(_0x40c1cc){_0x10d61f[_0xc780('0x20')]=_0x40c1cc;if(_0x150e1e[_0xc780('0x33')]['includeAll']){_0x4d93c0[_0xc780('0x43')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xc780('0x44')](_0x4d93c0);})['then'](function(_0x1b592){_0x10d61f['rows']=_0x1b592;return _0x10d61f;})[_0xc780('0x27')](respondWithFilteredResult(_0x493e3e,_0x4d93c0))['catch'](handleError(_0x493e3e,null));};exports[_0xc780('0x45')]=function(_0x4815a0,_0x2154ed){var _0x276a54={'raw':![],'where':{'id':_0x4815a0[_0xc780('0x46')]['id']}},_0x5a623b={};_0x5a623b['model']=_[_0xc780('0x34')](db[_0xc780('0x42')][_0xc780('0x2e')]);_0x5a623b[_0xc780('0x33')]=_['keys'](_0x4815a0[_0xc780('0x33')]);_0x5a623b[_0xc780('0x35')]=_[_0xc780('0x36')](_0x5a623b[_0xc780('0x32')],_0x5a623b['query']);_0x276a54[_0xc780('0x37')]=_[_0xc780('0x36')](_0x5a623b[_0xc780('0x32')],qs[_0xc780('0x38')](_0x4815a0[_0xc780('0x33')][_0xc780('0x38')]));_0x276a54['attributes']=_0x276a54['attributes'][_0xc780('0x39')]?_0x276a54['attributes']:_0x5a623b[_0xc780('0x32')];if(_0x4815a0[_0xc780('0x33')][_0xc780('0x47')]){_0x276a54[_0xc780('0x43')]=[{'all':!![]}];}_0x276a54=_[_0xc780('0x41')]({},_0x276a54,_0x4815a0['options']);return db[_0xc780('0x42')][_0xc780('0x48')](_0x276a54)[_0xc780('0x27')](handleEntityNotFound(_0x2154ed,null))[_0xc780('0x27')](respondWithResult(_0x2154ed,null))['catch'](handleError(_0x2154ed,null));};exports[_0xc780('0x49')]=function(_0xedaaa2,_0x51059d){return db['VtigerConfiguration'][_0xc780('0x49')](_0xedaaa2[_0xc780('0x4a')],{})[_0xc780('0x27')](respondWithResult(_0x51059d,0xc9))[_0xc780('0x4b')](handleError(_0x51059d,null));};exports[_0xc780('0x25')]=function(_0x13358a,_0x36c135){if(_0x13358a[_0xc780('0x4a')]['id']){delete _0x13358a[_0xc780('0x4a')]['id'];}return db[_0xc780('0x42')][_0xc780('0x48')]({'where':{'id':_0x13358a[_0xc780('0x46')]['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x36c135,null))['then'](saveUpdates(_0x13358a[_0xc780('0x4a')],null))['then'](respondWithResult(_0x36c135,null))[_0xc780('0x4b')](handleError(_0x36c135,null));};exports[_0xc780('0x26')]=function(_0x39ce06,_0x315f68){return db['VtigerConfiguration'][_0xc780('0x48')]({'where':{'id':_0x39ce06['params']['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x315f68,null))[_0xc780('0x27')](removeEntity(_0x315f68,null))[_0xc780('0x4b')](handleError(_0x315f68,null));};exports['getFields']=function(_0xc6a2e0,_0xff2d57,_0x33b6ec){var _0x113ef8={};var _0xfce35a={};var _0x2e8f99;var _0x79c90e;return db[_0xc780('0x42')][_0xc780('0x4c')]({'where':{'id':_0xc6a2e0[_0xc780('0x46')]['id']}})[_0xc780('0x27')](handleEntityNotFound(_0xff2d57,null))[_0xc780('0x27')](function(_0x323db8){if(_0x323db8){_0x2e8f99=_0x323db8;_0xfce35a[_0xc780('0x32')]=_[_0xc780('0x34')](db[_0xc780('0x4d')][_0xc780('0x2e')]);_0xfce35a[_0xc780('0x33')]=_[_0xc780('0x34')](_0xc6a2e0['query']);_0xfce35a[_0xc780('0x35')]=_[_0xc780('0x36')](_0xfce35a[_0xc780('0x32')],_0xfce35a[_0xc780('0x33')]);_0x113ef8[_0xc780('0x37')]=_[_0xc780('0x36')](_0xfce35a[_0xc780('0x32')],qs[_0xc780('0x38')](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x38')]));_0x113ef8['attributes']=_0x113ef8[_0xc780('0x37')]['length']?_0x113ef8['attributes']:_0xfce35a[_0xc780('0x32')];_0x113ef8['order']=qs[_0xc780('0x3d')](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x3d')]);_0x113ef8[_0xc780('0x40')]=qs['filters'](_['pick'](_0xc6a2e0['query'],_0xfce35a[_0xc780('0x35')]));if(_0xc6a2e0[_0xc780('0x33')]['filter']){_0x113ef8[_0xc780('0x40')]=_[_0xc780('0x41')](_0x113ef8[_0xc780('0x40')],{'$or':_[_0xc780('0x2d')](_0x113ef8[_0xc780('0x37')],function(_0x277f4b){var _0x3c2b61={};_0x3c2b61[_0x277f4b]={'$like':'%'+_0xc6a2e0[_0xc780('0x33')][_0xc780('0x3f')]+'%'};return _0x3c2b61;})});}_0x113ef8=_['merge']({},_0x113ef8,_0xc6a2e0[_0xc780('0x4e')]);return _0x2e8f99[_0xc780('0x4f')](_0x113ef8);}})['then'](function(_0x21c545){if(_0x21c545){_0x79c90e=_0x21c545['length'];if(!_0xc6a2e0['query'][_0xc780('0x3a')](_0xc780('0x3b'))){_0x113ef8[_0xc780('0x1f')]=qs['limit'](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x1f')]);_0x113ef8['offset']=qs['offset'](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x1e')]);}return _0x2e8f99[_0xc780('0x4f')](_0x113ef8);}})[_0xc780('0x27')](function(_0x4bde06){if(_0x4bde06){return _0x4bde06?{'count':_0x79c90e,'rows':_0x4bde06}:null;}})[_0xc780('0x27')](respondWithResult(_0xff2d57,null))[_0xc780('0x4b')](handleError(_0xff2d57,null));};exports[_0xc780('0x50')]=function(_0x528c94,_0x46f036,_0x40826a){var _0x3b3305={};var _0x2af0e3={};var _0x1cfd91;var _0x19d93d;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x528c94['params']['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x46f036,null))[_0xc780('0x27')](function(_0x34eeac){if(_0x34eeac){_0x1cfd91=_0x34eeac;_0x2af0e3[_0xc780('0x32')]=_[_0xc780('0x34')](db[_0xc780('0x4d')][_0xc780('0x2e')]);_0x2af0e3[_0xc780('0x33')]=_[_0xc780('0x34')](_0x528c94[_0xc780('0x33')]);_0x2af0e3['filters']=_[_0xc780('0x36')](_0x2af0e3[_0xc780('0x32')],_0x2af0e3['query']);_0x3b3305[_0xc780('0x37')]=_['intersection'](_0x2af0e3[_0xc780('0x32')],qs['fields'](_0x528c94['query']['fields']));_0x3b3305[_0xc780('0x37')]=_0x3b3305[_0xc780('0x37')]['length']?_0x3b3305[_0xc780('0x37')]:_0x2af0e3[_0xc780('0x32')];_0x3b3305[_0xc780('0x3c')]=qs['sort'](_0x528c94[_0xc780('0x33')][_0xc780('0x3d')]);_0x3b3305[_0xc780('0x40')]=qs['filters'](_[_0xc780('0x3e')](_0x528c94[_0xc780('0x33')],_0x2af0e3[_0xc780('0x35')]));if(_0x528c94[_0xc780('0x33')][_0xc780('0x3f')]){_0x3b3305['where']=_[_0xc780('0x41')](_0x3b3305[_0xc780('0x40')],{'$or':_['map'](_0x3b3305['attributes'],function(_0x4e2950){var _0xad45aa={};_0xad45aa[_0x4e2950]={'$like':'%'+_0x528c94['query'][_0xc780('0x3f')]+'%'};return _0xad45aa;})});}_0x3b3305=_[_0xc780('0x41')]({},_0x3b3305,_0x528c94[_0xc780('0x4e')]);return _0x1cfd91[_0xc780('0x50')](_0x3b3305);}})['then'](function(_0x588ef8){if(_0x588ef8){_0x19d93d=_0x588ef8['length'];if(!_0x528c94[_0xc780('0x33')][_0xc780('0x3a')](_0xc780('0x3b'))){_0x3b3305['limit']=qs[_0xc780('0x1f')](_0x528c94[_0xc780('0x33')][_0xc780('0x1f')]);_0x3b3305[_0xc780('0x1e')]=qs[_0xc780('0x1e')](_0x528c94[_0xc780('0x33')]['offset']);}return _0x1cfd91['getSubjects'](_0x3b3305);}})[_0xc780('0x27')](function(_0x247aa1){if(_0x247aa1){return _0x247aa1?{'count':_0x19d93d,'rows':_0x247aa1}:null;}})[_0xc780('0x27')](respondWithResult(_0x46f036,null))[_0xc780('0x4b')](handleError(_0x46f036,null));};exports['getDescriptions']=function(_0x1143c9,_0x3de771,_0x2ae7a5){var _0x40421b={};var _0x3f8ab8={};var _0x5867bf;var _0x5244a3;return db[_0xc780('0x42')][_0xc780('0x4c')]({'where':{'id':_0x1143c9['params']['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x3de771,null))['then'](function(_0x473dca){if(_0x473dca){_0x5867bf=_0x473dca;_0x3f8ab8[_0xc780('0x32')]=_[_0xc780('0x34')](db[_0xc780('0x4d')][_0xc780('0x2e')]);_0x3f8ab8[_0xc780('0x33')]=_['keys'](_0x1143c9[_0xc780('0x33')]);_0x3f8ab8[_0xc780('0x35')]=_[_0xc780('0x36')](_0x3f8ab8[_0xc780('0x32')],_0x3f8ab8[_0xc780('0x33')]);_0x40421b['attributes']=_['intersection'](_0x3f8ab8[_0xc780('0x32')],qs[_0xc780('0x38')](_0x1143c9[_0xc780('0x33')][_0xc780('0x38')]));_0x40421b[_0xc780('0x37')]=_0x40421b['attributes']['length']?_0x40421b[_0xc780('0x37')]:_0x3f8ab8[_0xc780('0x32')];_0x40421b['order']=qs['sort'](_0x1143c9['query'][_0xc780('0x3d')]);_0x40421b['where']=qs['filters'](_[_0xc780('0x3e')](_0x1143c9['query'],_0x3f8ab8[_0xc780('0x35')]));if(_0x1143c9['query'][_0xc780('0x3f')]){_0x40421b[_0xc780('0x40')]=_[_0xc780('0x41')](_0x40421b[_0xc780('0x40')],{'$or':_[_0xc780('0x2d')](_0x40421b['attributes'],function(_0xfcc9e0){var _0x29969d={};_0x29969d[_0xfcc9e0]={'$like':'%'+_0x1143c9[_0xc780('0x33')][_0xc780('0x3f')]+'%'};return _0x29969d;})});}_0x40421b=_[_0xc780('0x41')]({},_0x40421b,_0x1143c9[_0xc780('0x4e')]);return _0x5867bf[_0xc780('0x51')](_0x40421b);}})[_0xc780('0x27')](function(_0x3e4afd){if(_0x3e4afd){_0x5244a3=_0x3e4afd[_0xc780('0x39')];if(!_0x1143c9[_0xc780('0x33')][_0xc780('0x3a')]('nolimit')){_0x40421b[_0xc780('0x1f')]=qs[_0xc780('0x1f')](_0x1143c9[_0xc780('0x33')][_0xc780('0x1f')]);_0x40421b[_0xc780('0x1e')]=qs['offset'](_0x1143c9[_0xc780('0x33')][_0xc780('0x1e')]);}return _0x5867bf['getDescriptions'](_0x40421b);}})[_0xc780('0x27')](function(_0x4617a9){if(_0x4617a9){return _0x4617a9?{'count':_0x5244a3,'rows':_0x4617a9}:null;}})['then'](respondWithResult(_0x3de771,null))[_0xc780('0x4b')](handleError(_0x3de771,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4f83af5..1a91ef3 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 _0xdce1=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','int_vtiger_configurations','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdce1,0x127));var _0x1dce=function(_0x29567c,_0x2516ef){_0x29567c=_0x29567c-0x0;var _0x5b7ccf=_0xdce1[_0x29567c];return _0x5b7ccf;};'use strict';var _=require('lodash');var util=require(_0x1dce('0x0'));var logger=require(_0x1dce('0x1'))(_0x1dce('0x2'));var moment=require(_0x1dce('0x3'));var BPromise=require('bluebird');var rp=require(_0x1dce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1dce('0x5'));var config=require(_0x1dce('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x1144af,_0x5379fa){return _0x1144af['define']('VtigerConfiguration',attributes,{'tableName':_0x1dce('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46d1=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2bf15c,_0x142553){var _0x4afe96=function(_0x17c5f9){while(--_0x17c5f9){_0x2bf15c['push'](_0x2bf15c['shift']());}};_0x4afe96(++_0x142553);}(_0x46d1,0x157));var _0x146d=function(_0x599a4f,_0x328f44){_0x599a4f=_0x599a4f-0x0;var _0x1190b2=_0x46d1[_0x599a4f];return _0x1190b2;};'use strict';var _=require(_0x146d('0x0'));var util=require(_0x146d('0x1'));var logger=require(_0x146d('0x2'))(_0x146d('0x3'));var moment=require('moment');var BPromise=require(_0x146d('0x4'));var rp=require(_0x146d('0x5'));var fs=require('fs');var path=require(_0x146d('0x6'));var rimraf=require(_0x146d('0x7'));var config=require(_0x146d('0x8'));var attributes=require(_0x146d('0x9'));module[_0x146d('0xa')]=function(_0xd90134,_0x30654d){return _0xd90134[_0x146d('0xb')](_0x146d('0xc'),attributes,{'tableName':_0x146d('0xd'),'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 6ffaba6..4e02cff 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 _0x04dc=['then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x2b9e55,_0x5a9679){var _0x35a9f5=function(_0x168790){while(--_0x168790){_0x2b9e55['push'](_0x2b9e55['shift']());}};_0x35a9f5(++_0x5a9679);}(_0x04dc,0xf1));var _0xc04d=function(_0x5716d3,_0x1f3d89){_0x5716d3=_0x5716d3-0x0;var _0x492869=_0x04dc[_0x5716d3];return _0x492869;};'use strict';var _=require(_0xc04d('0x0'));var util=require('util');var moment=require(_0xc04d('0x1'));var BPromise=require(_0xc04d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc04d('0x3'));var db=require(_0xc04d('0x4'))['db'];var utils=require(_0xc04d('0x5'));var logger=require(_0xc04d('0x6'))('rpc');var config=require(_0xc04d('0x7'));var jayson=require(_0xc04d('0x8'));var client=jayson[_0xc04d('0x9')][_0xc04d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f271e,_0x43e3bc,_0x338e65){return new BPromise(function(_0x45a0f9,_0x327488){return client[_0xc04d('0xb')](_0x5f271e,_0x338e65)[_0xc04d('0xc')](function(_0x5f0898){logger['info'](_0xc04d('0xd'),_0x43e3bc,'request\x20sent');logger[_0xc04d('0xe')](_0xc04d('0xf'),_0x43e3bc,'request\x20sent',JSON[_0xc04d('0x10')](_0x5f0898));if(_0x5f0898[_0xc04d('0x11')]){if(_0x5f0898[_0xc04d('0x11')][_0xc04d('0x12')]===0x1f4){logger['error'](_0xc04d('0xd'),_0x43e3bc,_0x5f0898[_0xc04d('0x11')]['message']);return _0x327488(_0x5f0898['error']['message']);}logger['error'](_0xc04d('0xd'),_0x43e3bc,_0x5f0898[_0xc04d('0x11')][_0xc04d('0x13')]);return _0x45a0f9(_0x5f0898[_0xc04d('0x11')][_0xc04d('0x13')]);}else{logger[_0xc04d('0x14')](_0xc04d('0xd'),_0x43e3bc,_0xc04d('0x15'));_0x45a0f9(_0x5f0898['result']['message']);}})[_0xc04d('0x16')](function(_0x46521f){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x43e3bc,_0x46521f);_0x327488(_0x46521f);});});} \ No newline at end of file +var _0x9675=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','info','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x2513fb,_0x2d2ae7){var _0x59f9d9=function(_0x5e5ac1){while(--_0x5e5ac1){_0x2513fb['push'](_0x2513fb['shift']());}};_0x59f9d9(++_0x2d2ae7);}(_0x9675,0xd1));var _0x5967=function(_0x59a6e7,_0x91a92d){_0x59a6e7=_0x59a6e7-0x0;var _0x2d2757=_0x9675[_0x59a6e7];return _0x2d2757;};'use strict';var _=require(_0x5967('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5967('0x1'));var fs=require('fs');var Redis=require(_0x5967('0x2'));var db=require(_0x5967('0x3'))['db'];var utils=require(_0x5967('0x4'));var logger=require(_0x5967('0x5'))(_0x5967('0x6'));var config=require('../../config/environment');var jayson=require(_0x5967('0x7'));var client=jayson['client'][_0x5967('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd02bb7,_0x460c8f,_0x219c4c){return new BPromise(function(_0x3bdd4a,_0x45d313){return client[_0x5967('0x9')](_0xd02bb7,_0x219c4c)[_0x5967('0xa')](function(_0x46ee39){logger['info'](_0x5967('0xb'),_0x460c8f,_0x5967('0xc'));logger[_0x5967('0xd')](_0x5967('0xe'),_0x460c8f,_0x5967('0xc'),JSON['stringify'](_0x46ee39));if(_0x46ee39['error']){if(_0x46ee39['error'][_0x5967('0xf')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x460c8f,_0x46ee39[_0x5967('0x10')][_0x5967('0x11')]);return _0x45d313(_0x46ee39[_0x5967('0x10')]['message']);}logger[_0x5967('0x10')](_0x5967('0xb'),_0x460c8f,_0x46ee39[_0x5967('0x10')][_0x5967('0x11')]);return _0x3bdd4a(_0x46ee39['error'][_0x5967('0x11')]);}else{logger[_0x5967('0x12')](_0x5967('0xb'),_0x460c8f,_0x5967('0xc'));_0x3bdd4a(_0x46ee39[_0x5967('0x13')][_0x5967('0x11')]);}})['catch'](function(_0x1314d4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x460c8f,_0x1314d4);_0x45d313(_0x1314d4);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 8abf26c..2aaa0a7 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 _0x7abf=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller'];(function(_0x28c6c9,_0x49b60c){var _0xbd8cf3=function(_0xe39819){while(--_0xe39819){_0x28c6c9['push'](_0x28c6c9['shift']());}};_0xbd8cf3(++_0x49b60c);}(_0x7abf,0x16a));var _0xf7ab=function(_0x1a3e2b,_0xa75584){_0x1a3e2b=_0x1a3e2b-0x0;var _0x23969f=_0x7abf[_0x1a3e2b];return _0x23969f;};'use strict';var multer=require('multer');var util=require(_0xf7ab('0x0'));var path=require('path');var timeout=require(_0xf7ab('0x1'));var express=require('express');var router=express[_0xf7ab('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf7ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf7ab('0x4'));var controller=require(_0xf7ab('0x5'));router[_0xf7ab('0x6')]('/',auth[_0xf7ab('0x7')](),controller[_0xf7ab('0x8')]);router['get'](_0xf7ab('0x9'),auth[_0xf7ab('0x7')](),controller['show']);router[_0xf7ab('0xa')]('/',auth[_0xf7ab('0x7')](),controller[_0xf7ab('0xb')]);router[_0xf7ab('0xc')](_0xf7ab('0x9'),auth['isAuthenticated'](),controller[_0xf7ab('0xd')]);router[_0xf7ab('0xe')](_0xf7ab('0x9'),auth[_0xf7ab('0x7')](),controller[_0xf7ab('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfa91=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xfa91,0x123));var _0x1fa9=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xfa91[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0x1fa9('0x0'));var util=require(_0x1fa9('0x1'));var path=require(_0x1fa9('0x2'));var timeout=require(_0x1fa9('0x3'));var express=require(_0x1fa9('0x4'));var router=express[_0x1fa9('0x5')]();var fs_extra=require(_0x1fa9('0x6'));var auth=require(_0x1fa9('0x7'));var interaction=require(_0x1fa9('0x8'));var config=require('../../config/environment');var controller=require(_0x1fa9('0x9'));router[_0x1fa9('0xa')]('/',auth[_0x1fa9('0xb')](),controller[_0x1fa9('0xc')]);router['get'](_0x1fa9('0xd'),auth['isAuthenticated'](),controller[_0x1fa9('0xe')]);router[_0x1fa9('0xf')]('/',auth[_0x1fa9('0xb')](),controller[_0x1fa9('0x10')]);router[_0x1fa9('0x11')](_0x1fa9('0xd'),auth['isAuthenticated'](),controller[_0x1fa9('0x12')]);router[_0x1fa9('0x13')](_0x1fa9('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1fa9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index dc08b1a..a22fe66 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 _0x52a1=['BOOLEAN','exports','string','variable','picklist','STRING','ENUM','customVariable'];(function(_0x51eb77,_0x436673){var _0x4b26fe=function(_0x4db9dc){while(--_0x4db9dc){_0x51eb77['push'](_0x51eb77['shift']());}};_0x4b26fe(++_0x436673);}(_0x52a1,0xc9));var _0x152a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x52a1[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0x152a('0x0')]={'type':{'type':Sequelize['ENUM'](_0x152a('0x1'),_0x152a('0x2'),'customVariable','keyValue',_0x152a('0x3')),'defaultValue':_0x152a('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x152a('0x4')]},'keyType':{'type':Sequelize[_0x152a('0x5')](_0x152a('0x1'),'variable',_0x152a('0x6'))},'keyContent':{'type':Sequelize[_0x152a('0x4')]},'idField':{'type':Sequelize[_0x152a('0x4')]},'nameField':{'type':Sequelize[_0x152a('0x4')]},'customField':{'type':Sequelize[_0x152a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x152a('0x4')]}}; \ No newline at end of file +var _0xed84=['STRING','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','variable'];(function(_0x4d2866,_0x51116c){var _0x521ff6=function(_0x4304be){while(--_0x4304be){_0x4d2866['push'](_0x4d2866['shift']());}};_0x521ff6(++_0x51116c);}(_0xed84,0x196));var _0x4ed8=function(_0x4eb427,_0xea690b){_0x4eb427=_0x4eb427-0x0;var _0x175954=_0xed84[_0x4eb427];return _0x175954;};'use strict';var Sequelize=require(_0x4ed8('0x0'));module[_0x4ed8('0x1')]={'type':{'type':Sequelize[_0x4ed8('0x2')](_0x4ed8('0x3'),'variable',_0x4ed8('0x4'),_0x4ed8('0x5'),_0x4ed8('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4ed8('0x2')](_0x4ed8('0x3'),_0x4ed8('0x7'),_0x4ed8('0x4'))},'keyContent':{'type':Sequelize[_0x4ed8('0x8')]},'idField':{'type':Sequelize[_0x4ed8('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4ed8('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index fc97e94..fddb7f9 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 _0xe3a7=['api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerField','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x50e1da,_0x24e001){var _0x5a2e0a=function(_0x2db95b){while(--_0x2db95b){_0x50e1da['push'](_0x50e1da['shift']());}};_0x5a2e0a(++_0x24e001);}(_0xe3a7,0x151));var _0x7e3a=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xe3a7[_0x5317b5];return _0x3b7ce2;};'use strict';var emlformat=require(_0x7e3a('0x0'));var rimraf=require(_0x7e3a('0x1'));var zipdir=require(_0x7e3a('0x2'));var jsonpatch=require(_0x7e3a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e3a('0x4'));var util=require(_0x7e3a('0x5'));var path=require(_0x7e3a('0x6'));var sox=require('sox');var csv=require(_0x7e3a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e3a('0x8'));var _=require(_0x7e3a('0x9'));var squel=require(_0x7e3a('0xa'));var crypto=require(_0x7e3a('0xb'));var jsforce=require(_0x7e3a('0xc'));var deskjs=require(_0x7e3a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7e3a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e3a('0xf'));var qs=require(_0x7e3a('0x10'));var as=require(_0x7e3a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7e3a('0x12'));var utils=require('../../config/utils');var config=require(_0x7e3a('0x13'));var licenseUtil=require(_0x7e3a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52d5cc,_0x11f674){_0x11f674=_0x11f674||0xcc;return function(_0x38e9dc){if(_0x38e9dc){return _0x52d5cc[_0x7e3a('0x15')](_0x11f674);}return _0x52d5cc[_0x7e3a('0x16')](_0x11f674)[_0x7e3a('0x17')]();};}function respondWithResult(_0x291333,_0x31bee5){_0x31bee5=_0x31bee5||0xc8;return function(_0x28c1c2){if(_0x28c1c2){return _0x291333[_0x7e3a('0x16')](_0x31bee5)[_0x7e3a('0x18')](_0x28c1c2);}};}function respondWithFilteredResult(_0x33fec2,_0x522ccd){return function(_0x17f75f){if(_0x17f75f){var _0x309a4e=typeof _0x522ccd[_0x7e3a('0x19')]===_0x7e3a('0x1a')&&typeof _0x522ccd[_0x7e3a('0x1b')]==='undefined';var _0x89a3d4=_0x17f75f[_0x7e3a('0x1c')];var _0x494e3c=_0x309a4e?0x0:_0x522ccd[_0x7e3a('0x19')];var _0x157e6b=_0x309a4e?_0x17f75f[_0x7e3a('0x1c')]:_0x522ccd[_0x7e3a('0x19')]+_0x522ccd[_0x7e3a('0x1b')];var _0xba2a4d;if(_0x157e6b>=_0x89a3d4){_0x157e6b=_0x89a3d4;_0xba2a4d=0xc8;}else{_0xba2a4d=0xce;}_0x33fec2['status'](_0xba2a4d);return _0x33fec2['set'](_0x7e3a('0x1d'),_0x494e3c+'-'+_0x157e6b+'/'+_0x89a3d4)[_0x7e3a('0x18')](_0x17f75f);}return null;};}function patchUpdates(_0x1afb5f){return function(_0x4ddc71){try{jsonpatch[_0x7e3a('0x1e')](_0x4ddc71,_0x1afb5f,!![]);}catch(_0xc62aff){return BPromise[_0x7e3a('0x1f')](_0xc62aff);}return _0x4ddc71[_0x7e3a('0x20')]();};}function saveUpdates(_0x57dd07,_0xf99328){return function(_0x3cd5c3){if(_0x3cd5c3){return _0x3cd5c3[_0x7e3a('0x21')](_0x57dd07)[_0x7e3a('0x22')](function(_0x208ff1){return _0x208ff1;});}return null;};}function removeEntity(_0x156f61,_0x3231c7){return function(_0x34a62c){if(_0x34a62c){return _0x34a62c[_0x7e3a('0x23')]()[_0x7e3a('0x22')](function(){_0x156f61[_0x7e3a('0x16')](0xcc)[_0x7e3a('0x17')]();});}};}function handleEntityNotFound(_0x25c53a,_0x5c7467){return function(_0x240609){if(!_0x240609){_0x25c53a['sendStatus'](0x194);}return _0x240609;};}function handleError(_0x52c346,_0x1a552e){_0x1a552e=_0x1a552e||0x1f4;return function(_0x29dac4){logger['error'](_0x29dac4[_0x7e3a('0x24')]);if(_0x29dac4[_0x7e3a('0x25')]){delete _0x29dac4[_0x7e3a('0x25')];}_0x52c346[_0x7e3a('0x16')](_0x1a552e)[_0x7e3a('0x26')](_0x29dac4);};}exports[_0x7e3a('0x27')]=function(_0x106f12,_0x3c4c90){var _0x19b021={},_0x1f84f8={},_0x1114d6={'count':0x0,'rows':[]};var _0x44414a=_[_0x7e3a('0x28')](db[_0x7e3a('0x29')]['rawAttributes'],function(_0x30f16e){return{'name':_0x30f16e['fieldName'],'type':_0x30f16e[_0x7e3a('0x2a')][_0x7e3a('0x2b')]};});_0x1f84f8[_0x7e3a('0x2c')]=_['map'](_0x44414a,'name');_0x1f84f8[_0x7e3a('0x2d')]=_[_0x7e3a('0x2e')](_0x106f12[_0x7e3a('0x2d')]);_0x1f84f8[_0x7e3a('0x2f')]=_[_0x7e3a('0x30')](_0x1f84f8[_0x7e3a('0x2c')],_0x1f84f8['query']);_0x19b021['attributes']=_[_0x7e3a('0x30')](_0x1f84f8[_0x7e3a('0x2c')],qs[_0x7e3a('0x31')](_0x106f12[_0x7e3a('0x2d')][_0x7e3a('0x31')]));_0x19b021[_0x7e3a('0x32')]=_0x19b021[_0x7e3a('0x32')]['length']?_0x19b021['attributes']:_0x1f84f8[_0x7e3a('0x2c')];if(!_0x106f12[_0x7e3a('0x2d')][_0x7e3a('0x33')](_0x7e3a('0x34'))){_0x19b021['limit']=qs['limit'](_0x106f12[_0x7e3a('0x2d')]['limit']);_0x19b021[_0x7e3a('0x19')]=qs[_0x7e3a('0x19')](_0x106f12[_0x7e3a('0x2d')][_0x7e3a('0x19')]);}_0x19b021['order']=qs[_0x7e3a('0x35')](_0x106f12[_0x7e3a('0x2d')][_0x7e3a('0x35')]);_0x19b021[_0x7e3a('0x36')]=qs[_0x7e3a('0x2f')](_[_0x7e3a('0x37')](_0x106f12[_0x7e3a('0x2d')],_0x1f84f8[_0x7e3a('0x2f')]),_0x44414a);if(_0x106f12[_0x7e3a('0x2d')][_0x7e3a('0x38')]){_0x19b021[_0x7e3a('0x36')]=_['merge'](_0x19b021[_0x7e3a('0x36')],{'$or':_[_0x7e3a('0x28')](_0x44414a,function(_0x1530af){if(_0x1530af[_0x7e3a('0x2a')]!==_0x7e3a('0x39')){var _0x3ae731={};_0x3ae731[_0x1530af['name']]={'$like':'%'+_0x106f12[_0x7e3a('0x2d')][_0x7e3a('0x38')]+'%'};return _0x3ae731;}})});}_0x19b021=_[_0x7e3a('0x3a')]({},_0x19b021,_0x106f12[_0x7e3a('0x3b')]);var _0x1a9c66={'where':_0x19b021[_0x7e3a('0x36')]};return db[_0x7e3a('0x29')][_0x7e3a('0x1c')](_0x1a9c66)['then'](function(_0x4926db){_0x1114d6[_0x7e3a('0x1c')]=_0x4926db;if(_0x106f12[_0x7e3a('0x2d')][_0x7e3a('0x3c')]){_0x19b021[_0x7e3a('0x3d')]=[{'all':!![]}];}return db[_0x7e3a('0x29')][_0x7e3a('0x3e')](_0x19b021);})[_0x7e3a('0x22')](function(_0x159dc3){_0x1114d6['rows']=_0x159dc3;return _0x1114d6;})['then'](respondWithFilteredResult(_0x3c4c90,_0x19b021))['catch'](handleError(_0x3c4c90,null));};exports[_0x7e3a('0x3f')]=function(_0x59c7b5,_0xad3998){var _0x208006={'raw':!![],'where':{'id':_0x59c7b5[_0x7e3a('0x40')]['id']}},_0x5590fb={};_0x5590fb[_0x7e3a('0x2c')]=_[_0x7e3a('0x2e')](db[_0x7e3a('0x29')][_0x7e3a('0x41')]);_0x5590fb[_0x7e3a('0x2d')]=_[_0x7e3a('0x2e')](_0x59c7b5[_0x7e3a('0x2d')]);_0x5590fb[_0x7e3a('0x2f')]=_[_0x7e3a('0x30')](_0x5590fb[_0x7e3a('0x2c')],_0x5590fb[_0x7e3a('0x2d')]);_0x208006[_0x7e3a('0x32')]=_[_0x7e3a('0x30')](_0x5590fb[_0x7e3a('0x2c')],qs['fields'](_0x59c7b5[_0x7e3a('0x2d')][_0x7e3a('0x31')]));_0x208006['attributes']=_0x208006[_0x7e3a('0x32')][_0x7e3a('0x42')]?_0x208006[_0x7e3a('0x32')]:_0x5590fb[_0x7e3a('0x2c')];if(_0x59c7b5[_0x7e3a('0x2d')][_0x7e3a('0x3c')]){_0x208006[_0x7e3a('0x3d')]=[{'all':!![]}];}_0x208006=_['merge']({},_0x208006,_0x59c7b5[_0x7e3a('0x3b')]);return db[_0x7e3a('0x29')][_0x7e3a('0x43')](_0x208006)[_0x7e3a('0x22')](handleEntityNotFound(_0xad3998,null))[_0x7e3a('0x22')](respondWithResult(_0xad3998,null))[_0x7e3a('0x44')](handleError(_0xad3998,null));};exports[_0x7e3a('0x45')]=function(_0x245d61,_0x5b9442){return db[_0x7e3a('0x29')][_0x7e3a('0x45')](_0x245d61['body'],{})[_0x7e3a('0x22')](respondWithResult(_0x5b9442,0xc9))[_0x7e3a('0x44')](handleError(_0x5b9442,null));};exports['update']=function(_0x3a9386,_0xa1c794){if(_0x3a9386[_0x7e3a('0x46')]['id']){delete _0x3a9386[_0x7e3a('0x46')]['id'];}return db[_0x7e3a('0x29')][_0x7e3a('0x43')]({'where':{'id':_0x3a9386['params']['id']}})[_0x7e3a('0x22')](handleEntityNotFound(_0xa1c794,null))[_0x7e3a('0x22')](saveUpdates(_0x3a9386['body'],null))[_0x7e3a('0x22')](respondWithResult(_0xa1c794,null))[_0x7e3a('0x44')](handleError(_0xa1c794,null));};exports[_0x7e3a('0x23')]=function(_0x93fd9f,_0x293132){return db[_0x7e3a('0x29')]['find']({'where':{'id':_0x93fd9f['params']['id']}})[_0x7e3a('0x22')](handleEntityNotFound(_0x293132,null))[_0x7e3a('0x22')](removeEntity(_0x293132,null))[_0x7e3a('0x44')](handleError(_0x293132,null));}; \ No newline at end of file +var _0x5540=['includeAll','findAll','rows','show','length','include','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','order','pick','where','VIRTUAL','merge','options'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x5540,0x92));var _0x0554=function(_0x31f14e,_0x45a3d2){_0x31f14e=_0x31f14e-0x0;var _0x2488e9=_0x5540[_0x31f14e];return _0x2488e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0554('0x0'));var zipdir=require(_0x0554('0x1'));var jsonpatch=require(_0x0554('0x2'));var rp=require(_0x0554('0x3'));var moment=require(_0x0554('0x4'));var BPromise=require(_0x0554('0x5'));var Mustache=require('mustache');var util=require(_0x0554('0x6'));var path=require(_0x0554('0x7'));var sox=require(_0x0554('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0554('0x9'));var _=require(_0x0554('0xa'));var squel=require(_0x0554('0xb'));var crypto=require('crypto');var jsforce=require(_0x0554('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0554('0xd'));var querystring=require(_0x0554('0xe'));var Papa=require(_0x0554('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0554('0x10'));var as=require(_0x0554('0x11'));var hardwareService=require(_0x0554('0x12'));var logger=require(_0x0554('0x13'))(_0x0554('0x14'));var utils=require(_0x0554('0x15'));var config=require(_0x0554('0x16'));var licenseUtil=require(_0x0554('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6c85b5,_0x4fa0bb){_0x4fa0bb=_0x4fa0bb||0xcc;return function(_0x54525c){if(_0x54525c){return _0x6c85b5[_0x0554('0x18')](_0x4fa0bb);}return _0x6c85b5[_0x0554('0x19')](_0x4fa0bb)['end']();};}function respondWithResult(_0x8408b5,_0xf29e18){_0xf29e18=_0xf29e18||0xc8;return function(_0x33b76d){if(_0x33b76d){return _0x8408b5[_0x0554('0x19')](_0xf29e18)['json'](_0x33b76d);}};}function respondWithFilteredResult(_0x3ca2b8,_0x578517){return function(_0x532e6f){if(_0x532e6f){var _0x5d319d=typeof _0x578517[_0x0554('0x1a')]===_0x0554('0x1b')&&typeof _0x578517[_0x0554('0x1c')]===_0x0554('0x1b');var _0x41c092=_0x532e6f['count'];var _0x3ab7de=_0x5d319d?0x0:_0x578517[_0x0554('0x1a')];var _0xe60901=_0x5d319d?_0x532e6f[_0x0554('0x1d')]:_0x578517[_0x0554('0x1a')]+_0x578517[_0x0554('0x1c')];var _0x52995d;if(_0xe60901>=_0x41c092){_0xe60901=_0x41c092;_0x52995d=0xc8;}else{_0x52995d=0xce;}_0x3ca2b8[_0x0554('0x19')](_0x52995d);return _0x3ca2b8[_0x0554('0x1e')](_0x0554('0x1f'),_0x3ab7de+'-'+_0xe60901+'/'+_0x41c092)[_0x0554('0x20')](_0x532e6f);}return null;};}function patchUpdates(_0x3737ec){return function(_0x10803a){try{jsonpatch['apply'](_0x10803a,_0x3737ec,!![]);}catch(_0x3093ee){return BPromise['reject'](_0x3093ee);}return _0x10803a[_0x0554('0x21')]();};}function saveUpdates(_0xb85cd,_0x178745){return function(_0x3f61f6){if(_0x3f61f6){return _0x3f61f6[_0x0554('0x22')](_0xb85cd)[_0x0554('0x23')](function(_0x427784){return _0x427784;});}return null;};}function removeEntity(_0x3f980c,_0x180012){return function(_0xa192ea){if(_0xa192ea){return _0xa192ea[_0x0554('0x24')]()['then'](function(){_0x3f980c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6a0c28,_0x55b037){return function(_0x3ebf4a){if(!_0x3ebf4a){_0x6a0c28['sendStatus'](0x194);}return _0x3ebf4a;};}function handleError(_0x19c927,_0x5087a8){_0x5087a8=_0x5087a8||0x1f4;return function(_0x55c162){logger['error'](_0x55c162[_0x0554('0x25')]);if(_0x55c162['name']){delete _0x55c162[_0x0554('0x26')];}_0x19c927[_0x0554('0x19')](_0x5087a8)[_0x0554('0x27')](_0x55c162);};}exports['index']=function(_0x5c5e82,_0x11452b){var _0x2e1082={},_0x344a30={},_0x37a6be={'count':0x0,'rows':[]};var _0x1b15e6=_[_0x0554('0x28')](db[_0x0554('0x29')][_0x0554('0x2a')],function(_0x286a8c){return{'name':_0x286a8c[_0x0554('0x2b')],'type':_0x286a8c[_0x0554('0x2c')]['key']};});_0x344a30['model']=_['map'](_0x1b15e6,_0x0554('0x26'));_0x344a30['query']=_['keys'](_0x5c5e82[_0x0554('0x2d')]);_0x344a30[_0x0554('0x2e')]=_[_0x0554('0x2f')](_0x344a30[_0x0554('0x30')],_0x344a30[_0x0554('0x2d')]);_0x2e1082[_0x0554('0x31')]=_[_0x0554('0x2f')](_0x344a30['model'],qs[_0x0554('0x32')](_0x5c5e82[_0x0554('0x2d')][_0x0554('0x32')]));_0x2e1082[_0x0554('0x31')]=_0x2e1082['attributes']['length']?_0x2e1082[_0x0554('0x31')]:_0x344a30[_0x0554('0x30')];if(!_0x5c5e82['query']['hasOwnProperty'](_0x0554('0x33'))){_0x2e1082[_0x0554('0x1c')]=qs[_0x0554('0x1c')](_0x5c5e82[_0x0554('0x2d')][_0x0554('0x1c')]);_0x2e1082[_0x0554('0x1a')]=qs['offset'](_0x5c5e82[_0x0554('0x2d')][_0x0554('0x1a')]);}_0x2e1082[_0x0554('0x34')]=qs['sort'](_0x5c5e82[_0x0554('0x2d')]['sort']);_0x2e1082['where']=qs[_0x0554('0x2e')](_[_0x0554('0x35')](_0x5c5e82[_0x0554('0x2d')],_0x344a30['filters']),_0x1b15e6);if(_0x5c5e82[_0x0554('0x2d')]['filter']){_0x2e1082[_0x0554('0x36')]=_['merge'](_0x2e1082[_0x0554('0x36')],{'$or':_[_0x0554('0x28')](_0x1b15e6,function(_0xbef367){if(_0xbef367[_0x0554('0x2c')]!==_0x0554('0x37')){var _0x5b39af={};_0x5b39af[_0xbef367['name']]={'$like':'%'+_0x5c5e82[_0x0554('0x2d')]['filter']+'%'};return _0x5b39af;}})});}_0x2e1082=_[_0x0554('0x38')]({},_0x2e1082,_0x5c5e82[_0x0554('0x39')]);var _0x29e333={'where':_0x2e1082[_0x0554('0x36')]};return db['VtigerField'][_0x0554('0x1d')](_0x29e333)[_0x0554('0x23')](function(_0xb9e319){_0x37a6be[_0x0554('0x1d')]=_0xb9e319;if(_0x5c5e82[_0x0554('0x2d')][_0x0554('0x3a')]){_0x2e1082['include']=[{'all':!![]}];}return db[_0x0554('0x29')][_0x0554('0x3b')](_0x2e1082);})['then'](function(_0x548de4){_0x37a6be[_0x0554('0x3c')]=_0x548de4;return _0x37a6be;})[_0x0554('0x23')](respondWithFilteredResult(_0x11452b,_0x2e1082))['catch'](handleError(_0x11452b,null));};exports[_0x0554('0x3d')]=function(_0x17cade,_0x1e4037){var _0x5234ed={'raw':!![],'where':{'id':_0x17cade['params']['id']}},_0x351fb0={};_0x351fb0['model']=_['keys'](db[_0x0554('0x29')][_0x0554('0x2a')]);_0x351fb0[_0x0554('0x2d')]=_['keys'](_0x17cade[_0x0554('0x2d')]);_0x351fb0[_0x0554('0x2e')]=_[_0x0554('0x2f')](_0x351fb0[_0x0554('0x30')],_0x351fb0[_0x0554('0x2d')]);_0x5234ed[_0x0554('0x31')]=_[_0x0554('0x2f')](_0x351fb0[_0x0554('0x30')],qs[_0x0554('0x32')](_0x17cade[_0x0554('0x2d')][_0x0554('0x32')]));_0x5234ed['attributes']=_0x5234ed[_0x0554('0x31')][_0x0554('0x3e')]?_0x5234ed[_0x0554('0x31')]:_0x351fb0['model'];if(_0x17cade[_0x0554('0x2d')][_0x0554('0x3a')]){_0x5234ed[_0x0554('0x3f')]=[{'all':!![]}];}_0x5234ed=_[_0x0554('0x38')]({},_0x5234ed,_0x17cade[_0x0554('0x39')]);return db['VtigerField']['find'](_0x5234ed)[_0x0554('0x23')](handleEntityNotFound(_0x1e4037,null))['then'](respondWithResult(_0x1e4037,null))[_0x0554('0x40')](handleError(_0x1e4037,null));};exports[_0x0554('0x41')]=function(_0x426865,_0x30488b){return db[_0x0554('0x29')][_0x0554('0x41')](_0x426865['body'],{})[_0x0554('0x23')](respondWithResult(_0x30488b,0xc9))['catch'](handleError(_0x30488b,null));};exports['update']=function(_0x684270,_0x50aa24){if(_0x684270[_0x0554('0x42')]['id']){delete _0x684270[_0x0554('0x42')]['id'];}return db['VtigerField'][_0x0554('0x43')]({'where':{'id':_0x684270['params']['id']}})['then'](handleEntityNotFound(_0x50aa24,null))[_0x0554('0x23')](saveUpdates(_0x684270['body'],null))[_0x0554('0x23')](respondWithResult(_0x50aa24,null))['catch'](handleError(_0x50aa24,null));};exports[_0x0554('0x24')]=function(_0x1da29b,_0x2ed38b){return db[_0x0554('0x29')]['find']({'where':{'id':_0x1da29b['params']['id']}})['then'](handleEntityNotFound(_0x2ed38b,null))[_0x0554('0x23')](removeEntity(_0x2ed38b,null))[_0x0554('0x40')](handleError(_0x2ed38b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0538032..804242b 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 _0xa85b=['VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./intVtigerField.attributes','exports'];(function(_0x45f315,_0x3ddc1c){var _0x511656=function(_0x5b9440){while(--_0x5b9440){_0x45f315['push'](_0x45f315['shift']());}};_0x511656(++_0x3ddc1c);}(_0xa85b,0xfb));var _0xba85=function(_0x905674,_0x4329f9){_0x905674=_0x905674-0x0;var _0x49d74b=_0xa85b[_0x905674];return _0x49d74b;};'use strict';var _=require(_0xba85('0x0'));var util=require(_0xba85('0x1'));var logger=require(_0xba85('0x2'))('api');var moment=require(_0xba85('0x3'));var BPromise=require(_0xba85('0x4'));var rp=require(_0xba85('0x5'));var fs=require('fs');var path=require(_0xba85('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba85('0x7'));module[_0xba85('0x8')]=function(_0x276851,_0x2f1962){return _0x276851['define'](_0xba85('0x9'),attributes,{'tableName':_0xba85('0xa'),'paranoid':![],'indexes':[{'name':_0xba85('0xb'),'fields':['idField',_0xba85('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8370=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','FieldId','util','api','moment','bluebird','request-promise'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x8370,0xcb));var _0x0837=function(_0xb267b9,_0xef18eb){_0xb267b9=_0xb267b9-0x0;var _0x2d2033=_0x8370[_0xb267b9];return _0x2d2033;};'use strict';var _=require('lodash');var util=require(_0x0837('0x0'));var logger=require('../../config/logger')(_0x0837('0x1'));var moment=require(_0x0837('0x2'));var BPromise=require(_0x0837('0x3'));var rp=require(_0x0837('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0837('0x5'));var config=require(_0x0837('0x6'));var attributes=require(_0x0837('0x7'));module[_0x0837('0x8')]=function(_0x5eb0d2,_0x542d95){return _0x5eb0d2[_0x0837('0x9')](_0x0837('0xa'),attributes,{'tableName':_0x0837('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x0837('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 2d3bef9..20316a2 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 _0x2c2a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x33fbe8,_0x130678){var _0x5a9976=function(_0x512486){while(--_0x512486){_0x33fbe8['push'](_0x33fbe8['shift']());}};_0x5a9976(++_0x130678);}(_0x2c2a,0x73));var _0xa2c2=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x2c2a[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xa2c2('0x0'));var util=require('util');var moment=require(_0xa2c2('0x1'));var BPromise=require(_0xa2c2('0x2'));var rs=require(_0xa2c2('0x3'));var fs=require('fs');var Redis=require(_0xa2c2('0x4'));var db=require(_0xa2c2('0x5'))['db'];var utils=require(_0xa2c2('0x6'));var logger=require(_0xa2c2('0x7'))('rpc');var config=require(_0xa2c2('0x8'));var jayson=require(_0xa2c2('0x9'));var client=jayson[_0xa2c2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x392a43,_0x15ba05,_0x530574){return new BPromise(function(_0x564c2e,_0x298c60){return client[_0xa2c2('0xb')](_0x392a43,_0x530574)['then'](function(_0x522792){logger[_0xa2c2('0xc')](_0xa2c2('0xd'),_0x15ba05,_0xa2c2('0xe'));logger['debug'](_0xa2c2('0xf'),_0x15ba05,_0xa2c2('0xe'),JSON['stringify'](_0x522792));if(_0x522792[_0xa2c2('0x10')]){if(_0x522792[_0xa2c2('0x10')][_0xa2c2('0x11')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x15ba05,_0x522792[_0xa2c2('0x10')]['message']);return _0x298c60(_0x522792['error'][_0xa2c2('0x12')]);}logger[_0xa2c2('0x10')](_0xa2c2('0xd'),_0x15ba05,_0x522792[_0xa2c2('0x10')]['message']);return _0x564c2e(_0x522792[_0xa2c2('0x10')][_0xa2c2('0x12')]);}else{logger['info'](_0xa2c2('0xd'),_0x15ba05,'request\x20sent');_0x564c2e(_0x522792['result'][_0xa2c2('0x12')]);}})[_0xa2c2('0x13')](function(_0x42dd98){logger[_0xa2c2('0x10')](_0xa2c2('0xd'),_0x15ba05,_0x42dd98);_0x298c60(_0x42dd98);});});} \ No newline at end of file +var _0x213f=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x213f,0xdf));var _0xf213=function(_0x3827a7,_0xff4762){_0x3827a7=_0x3827a7-0x0;var _0x3fbb20=_0x213f[_0x3827a7];return _0x3fbb20;};'use strict';var _=require(_0xf213('0x0'));var util=require('util');var moment=require(_0xf213('0x1'));var BPromise=require(_0xf213('0x2'));var rs=require(_0xf213('0x3'));var fs=require('fs');var Redis=require(_0xf213('0x4'));var db=require(_0xf213('0x5'))['db'];var utils=require(_0xf213('0x6'));var logger=require(_0xf213('0x7'))('rpc');var config=require(_0xf213('0x8'));var jayson=require(_0xf213('0x9'));var client=jayson[_0xf213('0xa')][_0xf213('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51958c,_0x43792b,_0x8ef7ca){return new BPromise(function(_0x45a751,_0x3577f9){return client[_0xf213('0xc')](_0x51958c,_0x8ef7ca)['then'](function(_0x4f0cd8){logger[_0xf213('0xd')](_0xf213('0xe'),_0x43792b,'request\x20sent');logger[_0xf213('0xf')](_0xf213('0x10'),_0x43792b,_0xf213('0x11'),JSON[_0xf213('0x12')](_0x4f0cd8));if(_0x4f0cd8[_0xf213('0x13')]){if(_0x4f0cd8[_0xf213('0x13')][_0xf213('0x14')]===0x1f4){logger['error'](_0xf213('0xe'),_0x43792b,_0x4f0cd8['error'][_0xf213('0x15')]);return _0x3577f9(_0x4f0cd8[_0xf213('0x13')][_0xf213('0x15')]);}logger[_0xf213('0x13')](_0xf213('0xe'),_0x43792b,_0x4f0cd8[_0xf213('0x13')][_0xf213('0x15')]);return _0x45a751(_0x4f0cd8['error'][_0xf213('0x15')]);}else{logger['info'](_0xf213('0xe'),_0x43792b,_0xf213('0x11'));_0x45a751(_0x4f0cd8[_0xf213('0x16')]['message']);}})[_0xf213('0x17')](function(_0xd25e71){logger[_0xf213('0x13')]('VtigerField,\x20%s,\x20%s',_0x43792b,_0xd25e71);_0x3577f9(_0xd25e71);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f911e16..c04858c 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 _0xf91a=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x13bab6,_0x3bd22b){var _0x1a8d99=function(_0x446c2d){while(--_0x446c2d){_0x13bab6['push'](_0x13bab6['shift']());}};_0x1a8d99(++_0x3bd22b);}(_0xf91a,0x1b5));var _0xaf91=function(_0x14cb0e,_0x197f3c){_0x14cb0e=_0x14cb0e-0x0;var _0x5dc4f5=_0xf91a[_0x14cb0e];return _0x5dc4f5;};'use strict';var multer=require(_0xaf91('0x0'));var util=require(_0xaf91('0x1'));var path=require(_0xaf91('0x2'));var timeout=require(_0xaf91('0x3'));var express=require(_0xaf91('0x4'));var router=express[_0xaf91('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaf91('0x6'));var interaction=require(_0xaf91('0x7'));var config=require(_0xaf91('0x8'));var controller=require(_0xaf91('0x9'));router[_0xaf91('0xa')]('/',auth[_0xaf91('0xb')](),controller['index']);router[_0xaf91('0xa')](_0xaf91('0xc'),auth[_0xaf91('0xb')](),controller[_0xaf91('0xd')]);router[_0xaf91('0xa')](_0xaf91('0xe'),auth['isAuthenticated'](),controller[_0xaf91('0xf')]);router[_0xaf91('0xa')]('/:id/fields',auth[_0xaf91('0xb')](),controller[_0xaf91('0x10')]);router[_0xaf91('0x11')]('/',auth[_0xaf91('0xb')](),controller[_0xaf91('0x12')]);router[_0xaf91('0x11')](_0xaf91('0xe'),auth['isAuthenticated'](),controller[_0xaf91('0x13')]);router[_0xaf91('0x14')](_0xaf91('0xc'),auth['isAuthenticated'](),controller[_0xaf91('0x15')]);router[_0xaf91('0x16')](_0xaf91('0xc'),auth[_0xaf91('0xb')](),controller[_0xaf91('0x17')]);module[_0xaf91('0x18')]=router; \ No newline at end of file +var _0x0fe0=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x0fe0,0x6f));var _0x00fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fe0[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x00fe('0x0'));var util=require(_0x00fe('0x1'));var path=require(_0x00fe('0x2'));var timeout=require(_0x00fe('0x3'));var express=require(_0x00fe('0x4'));var router=express[_0x00fe('0x5')]();var fs_extra=require(_0x00fe('0x6'));var auth=require(_0x00fe('0x7'));var interaction=require(_0x00fe('0x8'));var config=require(_0x00fe('0x9'));var controller=require(_0x00fe('0xa'));router[_0x00fe('0xb')]('/',auth[_0x00fe('0xc')](),controller[_0x00fe('0xd')]);router[_0x00fe('0xb')](_0x00fe('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x00fe('0xc')](),controller[_0x00fe('0xf')]);router[_0x00fe('0xb')](_0x00fe('0x10'),auth['isAuthenticated'](),controller[_0x00fe('0x11')]);router['post']('/',auth[_0x00fe('0xc')](),controller[_0x00fe('0x12')]);router[_0x00fe('0x13')](_0x00fe('0x14'),auth[_0x00fe('0xc')](),controller[_0x00fe('0x15')]);router[_0x00fe('0x16')](_0x00fe('0xe'),auth[_0x00fe('0xc')](),controller[_0x00fe('0x17')]);router[_0x00fe('0x18')](_0x00fe('0xe'),auth[_0x00fe('0xc')](),controller[_0x00fe('0x19')]);module[_0x00fe('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 0e0e243..c97f12e 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 _0xb016=['newTab','sequelize','exports','STRING','remoteUri','password','token','integrationTab'];(function(_0x11fc8b,_0x4ee51d){var _0x4ea86e=function(_0x50e5bf){while(--_0x50e5bf){_0x11fc8b['push'](_0x11fc8b['shift']());}};_0x4ea86e(++_0x4ee51d);}(_0xb016,0x159));var _0x6b01=function(_0x2190ff,_0x92ba81){_0x2190ff=_0x2190ff-0x0;var _0xb9f0ec=_0xb016[_0x2190ff];return _0xb9f0ec;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6b01('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x6b01('0x2')]},'token':{'type':Sequelize[_0x6b01('0x2')]},'remoteUri':{'type':Sequelize[_0x6b01('0x2')],'unique':_0x6b01('0x3')},'authType':{'type':Sequelize['ENUM'](_0x6b01('0x4'),_0x6b01('0x5')),'defaultValue':_0x6b01('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6b01('0x6'),_0x6b01('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xa899=['exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','sequelize'];(function(_0x113d52,_0x4a16e8){var _0x9c5450=function(_0x10d537){while(--_0x10d537){_0x113d52['push'](_0x113d52['shift']());}};_0x9c5450(++_0x4a16e8);}(_0xa899,0x155));var _0x9a89=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xa899[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0x9a89('0x0'));module[_0x9a89('0x1')]={'name':{'type':Sequelize[_0x9a89('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9a89('0x2')],'unique':_0x9a89('0x3')},'password':{'type':Sequelize[_0x9a89('0x2')]},'token':{'type':Sequelize[_0x9a89('0x2')]},'remoteUri':{'type':Sequelize[_0x9a89('0x2')],'unique':_0x9a89('0x4')},'authType':{'type':Sequelize[_0x9a89('0x5')](_0x9a89('0x6'),_0x9a89('0x7')),'defaultValue':_0x9a89('0x6')},'serverUrl':{'type':Sequelize[_0x9a89('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a89('0x5')](_0x9a89('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index dfe954a..8a0db0d 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 _0x44a3=['save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getConfigurations','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x44a3,0x1a9));var _0x344a=function(_0x3bb7df,_0x1b5d3a){_0x3bb7df=_0x3bb7df-0x0;var _0xb10d46=_0x44a3[_0x3bb7df];return _0xb10d46;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a69ea,_0x304b70){_0x304b70=_0x304b70||0xcc;return function(_0x2ad7eb){if(_0x2ad7eb){return _0x4a69ea[_0x344a('0x17')](_0x304b70);}return _0x4a69ea[_0x344a('0x18')](_0x304b70)[_0x344a('0x19')]();};}function respondWithResult(_0x133ad4,_0x4ee562){_0x4ee562=_0x4ee562||0xc8;return function(_0x4032d7){if(_0x4032d7){return _0x133ad4[_0x344a('0x18')](_0x4ee562)[_0x344a('0x1a')](_0x4032d7);}};}function respondWithFilteredResult(_0x6e1639,_0x58c8cd){return function(_0x54a643){if(_0x54a643){var _0x3609ce=typeof _0x58c8cd[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x58c8cd[_0x344a('0x1d')]==='undefined';var _0x397de6=_0x54a643[_0x344a('0x1e')];var _0x49b55f=_0x3609ce?0x0:_0x58c8cd[_0x344a('0x1b')];var _0x274016=_0x3609ce?_0x54a643[_0x344a('0x1e')]:_0x58c8cd[_0x344a('0x1b')]+_0x58c8cd[_0x344a('0x1d')];var _0x43fa0f;if(_0x274016>=_0x397de6){_0x274016=_0x397de6;_0x43fa0f=0xc8;}else{_0x43fa0f=0xce;}_0x6e1639[_0x344a('0x18')](_0x43fa0f);return _0x6e1639[_0x344a('0x1f')](_0x344a('0x20'),_0x49b55f+'-'+_0x274016+'/'+_0x397de6)[_0x344a('0x1a')](_0x54a643);}return null;};}function patchUpdates(_0x4b3552){return function(_0x16c0fe){try{jsonpatch[_0x344a('0x21')](_0x16c0fe,_0x4b3552,!![]);}catch(_0xe0bdd4){return BPromise[_0x344a('0x22')](_0xe0bdd4);}return _0x16c0fe[_0x344a('0x23')]();};}function saveUpdates(_0x80ae12,_0x185303){return function(_0x976bcf){if(_0x976bcf){return _0x976bcf[_0x344a('0x24')](_0x80ae12)[_0x344a('0x25')](function(_0x90070c){return _0x90070c;});}return null;};}function removeEntity(_0x3b2ab9,_0x5ce9da){return function(_0x266fce){if(_0x266fce){return _0x266fce['destroy']()[_0x344a('0x25')](function(){_0x3b2ab9['status'](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x484f97,_0x36c920){return function(_0x8bf0b0){if(!_0x8bf0b0){_0x484f97[_0x344a('0x17')](0x194);}return _0x8bf0b0;};}function handleError(_0x16d404,_0x26f059){_0x26f059=_0x26f059||0x1f4;return function(_0x28749b){logger[_0x344a('0x26')](_0x28749b[_0x344a('0x27')]);if(_0x28749b['name']){delete _0x28749b[_0x344a('0x28')];}_0x16d404[_0x344a('0x18')](_0x26f059)[_0x344a('0x29')](_0x28749b);};}exports[_0x344a('0x2a')]=function(_0x14bd54,_0x2d72c9){var _0x5b877d={},_0x3d25fe={},_0x49bbf8={'count':0x0,'rows':[]};var _0x593cf6=_[_0x344a('0x2b')](db[_0x344a('0x2c')][_0x344a('0x2d')],function(_0x4803db){return{'name':_0x4803db['fieldName'],'type':_0x4803db['type'][_0x344a('0x2e')]};});_0x3d25fe[_0x344a('0x2f')]=_[_0x344a('0x2b')](_0x593cf6,'name');_0x3d25fe[_0x344a('0x30')]=_[_0x344a('0x31')](_0x14bd54[_0x344a('0x30')]);_0x3d25fe[_0x344a('0x32')]=_[_0x344a('0x33')](_0x3d25fe[_0x344a('0x2f')],_0x3d25fe[_0x344a('0x30')]);_0x5b877d['attributes']=_[_0x344a('0x33')](_0x3d25fe['model'],qs['fields'](_0x14bd54['query'][_0x344a('0x34')]));_0x5b877d[_0x344a('0x35')]=_0x5b877d[_0x344a('0x35')][_0x344a('0x36')]?_0x5b877d[_0x344a('0x35')]:_0x3d25fe[_0x344a('0x2f')];if(!_0x14bd54['query'][_0x344a('0x37')](_0x344a('0x38'))){_0x5b877d[_0x344a('0x1d')]=qs['limit'](_0x14bd54[_0x344a('0x30')][_0x344a('0x1d')]);_0x5b877d[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14bd54[_0x344a('0x30')]['offset']);}_0x5b877d[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14bd54[_0x344a('0x30')][_0x344a('0x3a')]);_0x5b877d[_0x344a('0x3b')]=qs['filters'](_[_0x344a('0x3c')](_0x14bd54[_0x344a('0x30')],_0x3d25fe[_0x344a('0x32')]),_0x593cf6);if(_0x14bd54[_0x344a('0x30')][_0x344a('0x3d')]){_0x5b877d['where']=_[_0x344a('0x3e')](_0x5b877d[_0x344a('0x3b')],{'$or':_[_0x344a('0x2b')](_0x593cf6,function(_0x3356fb){if(_0x3356fb[_0x344a('0x3f')]!==_0x344a('0x40')){var _0x335a0a={};_0x335a0a[_0x3356fb[_0x344a('0x28')]]={'$like':'%'+_0x14bd54['query'][_0x344a('0x3d')]+'%'};return _0x335a0a;}})});}_0x5b877d=_[_0x344a('0x3e')]({},_0x5b877d,_0x14bd54[_0x344a('0x41')]);var _0x28bad9={'where':_0x5b877d[_0x344a('0x3b')]};return db['ZendeskAccount'][_0x344a('0x1e')](_0x28bad9)[_0x344a('0x25')](function(_0x7a33d7){_0x49bbf8[_0x344a('0x1e')]=_0x7a33d7;if(_0x14bd54[_0x344a('0x30')][_0x344a('0x42')]){_0x5b877d[_0x344a('0x43')]=[{'all':!![]}];}return db[_0x344a('0x2c')][_0x344a('0x44')](_0x5b877d);})['then'](function(_0x115a9c){_0x49bbf8[_0x344a('0x45')]=_0x115a9c;return _0x49bbf8;})[_0x344a('0x25')](respondWithFilteredResult(_0x2d72c9,_0x5b877d))[_0x344a('0x46')](handleError(_0x2d72c9,null));};exports['show']=function(_0x32bfa6,_0x3069ca){var _0x2b0ee9={'raw':![],'where':{'id':_0x32bfa6[_0x344a('0x47')]['id']}},_0x41f25b={};_0x41f25b[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x2c')][_0x344a('0x2d')]);_0x41f25b[_0x344a('0x30')]=_[_0x344a('0x31')](_0x32bfa6['query']);_0x41f25b[_0x344a('0x32')]=_[_0x344a('0x33')](_0x41f25b['model'],_0x41f25b[_0x344a('0x30')]);_0x2b0ee9[_0x344a('0x35')]=_['intersection'](_0x41f25b[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x32bfa6['query'][_0x344a('0x34')]));_0x2b0ee9[_0x344a('0x35')]=_0x2b0ee9[_0x344a('0x35')]['length']?_0x2b0ee9[_0x344a('0x35')]:_0x41f25b['model'];if(_0x32bfa6[_0x344a('0x30')][_0x344a('0x42')]){_0x2b0ee9[_0x344a('0x43')]=[{'all':!![]}];}_0x2b0ee9=_[_0x344a('0x3e')]({},_0x2b0ee9,_0x32bfa6['options']);return db['ZendeskAccount'][_0x344a('0x48')](_0x2b0ee9)[_0x344a('0x25')](handleEntityNotFound(_0x3069ca,null))[_0x344a('0x25')](respondWithResult(_0x3069ca,null))[_0x344a('0x46')](handleError(_0x3069ca,null));};exports[_0x344a('0x49')]=function(_0xa3c8f0,_0x44962b){return db[_0x344a('0x2c')][_0x344a('0x49')](_0xa3c8f0[_0x344a('0x4a')],{})['then'](respondWithResult(_0x44962b,0xc9))[_0x344a('0x46')](handleError(_0x44962b,null));};exports[_0x344a('0x24')]=function(_0x6fad37,_0xbad7ca){if(_0x6fad37['body']['id']){delete _0x6fad37[_0x344a('0x4a')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x6fad37[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0xbad7ca,null))['then'](saveUpdates(_0x6fad37[_0x344a('0x4a')],null))[_0x344a('0x25')](respondWithResult(_0xbad7ca,null))[_0x344a('0x46')](handleError(_0xbad7ca,null));};exports[_0x344a('0x4b')]=function(_0x51e411,_0x225fce){return db[_0x344a('0x2c')][_0x344a('0x48')]({'where':{'id':_0x51e411[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x225fce,null))[_0x344a('0x25')](removeEntity(_0x225fce,null))[_0x344a('0x46')](handleError(_0x225fce,null));};exports[_0x344a('0x4c')]=function(_0x292357,_0x1911d0,_0x5e0885){var _0x15928a={};var _0x47ce9c={};var _0x1b7f6c;var _0xb744c6;return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x292357[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1911d0,null))[_0x344a('0x25')](function(_0x14921e){if(_0x14921e){_0x1b7f6c=_0x14921e;_0x47ce9c[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x4d')][_0x344a('0x2d')]);_0x47ce9c[_0x344a('0x30')]=_['keys'](_0x292357[_0x344a('0x30')]);_0x47ce9c[_0x344a('0x32')]=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],_0x47ce9c[_0x344a('0x30')]);_0x15928a['attributes']=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x292357[_0x344a('0x30')]['fields']));_0x15928a[_0x344a('0x35')]=_0x15928a[_0x344a('0x35')]['length']?_0x15928a[_0x344a('0x35')]:_0x47ce9c[_0x344a('0x2f')];_0x15928a[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x292357[_0x344a('0x30')][_0x344a('0x3a')]);_0x15928a[_0x344a('0x3b')]=qs['filters'](_['pick'](_0x292357['query'],_0x47ce9c[_0x344a('0x32')]));if(_0x292357[_0x344a('0x30')][_0x344a('0x3d')]){_0x15928a[_0x344a('0x3b')]=_['merge'](_0x15928a[_0x344a('0x3b')],{'$or':_['map'](_0x15928a['attributes'],function(_0x57241e){var _0x56b562={};_0x56b562[_0x57241e]={'$like':'%'+_0x292357[_0x344a('0x30')][_0x344a('0x3d')]+'%'};return _0x56b562;})});}_0x15928a=_[_0x344a('0x3e')]({},_0x15928a,_0x292357[_0x344a('0x41')]);return _0x1b7f6c['getConfigurations'](_0x15928a);}})['then'](function(_0x56e76e){if(_0x56e76e){_0xb744c6=_0x56e76e[_0x344a('0x36')];if(!_0x292357[_0x344a('0x30')][_0x344a('0x37')](_0x344a('0x38'))){_0x15928a[_0x344a('0x1d')]=qs['limit'](_0x292357[_0x344a('0x30')][_0x344a('0x1d')]);_0x15928a[_0x344a('0x1b')]=qs['offset'](_0x292357[_0x344a('0x30')]['offset']);}return _0x1b7f6c['getConfigurations'](_0x15928a);}})[_0x344a('0x25')](function(_0x532bcf){if(_0x532bcf){return _0x532bcf?{'count':_0xb744c6,'rows':_0x532bcf}:null;}})['then'](respondWithResult(_0x1911d0,null))[_0x344a('0x46')](handleError(_0x1911d0,null));};exports[_0x344a('0x4e')]=function(_0x4f2e35,_0x1bf894,_0x5808f2){if(_0x4f2e35[_0x344a('0x4a')]['id']){delete _0x4f2e35[_0x344a('0x4a')]['id'];}return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x4f2e35['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1bf894,null))[_0x344a('0x25')](function(_0xb4ddd7){if(_0xb4ddd7){_0x4f2e35[_0x344a('0x4a')]['AccountId']=_0xb4ddd7['id'];_0x4f2e35['body'][_0x344a('0x4f')]=integrations[_0x344a('0x50')](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35[_0x344a('0x4a')][_0x344a('0x3f')]);_0x4f2e35['body'][_0x344a('0x51')]=integrations['getDescriptions'](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35['body']['type']);return db[_0x344a('0x4d')][_0x344a('0x49')](_0x4f2e35[_0x344a('0x4a')],{'include':[{'model':db[_0x344a('0x52')],'as':_0x344a('0x4f')},{'model':db[_0x344a('0x52')],'as':'Descriptions'}]});}return null;})[_0x344a('0x25')](respondWithResult(_0x1bf894,null))[_0x344a('0x46')](handleError(_0x1bf894,null));};exports[_0x344a('0x53')]=function(_0x1c4284,_0x26688e,_0x523774){var _0x23a761='';return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x1c4284[_0x344a('0x47')]['id']},'attributes':['id',_0x344a('0x54'),_0x344a('0x55'),_0x344a('0x56'),'authType',_0x344a('0x57')]})[_0x344a('0x25')](handleEntityNotFound(_0x26688e,null))[_0x344a('0x25')](function(_0x42e1c0){if(_0x42e1c0){_0x23a761=_0x42e1c0[_0x344a('0x57')];var _0x421a09=_0x23a761[_0x344a('0x58')](-0x1);if(_0x421a09==='/'){_0x23a761=_0x23a761[_0x344a('0x59')](0x0,_0x23a761['lastIndexOf'](_0x421a09));}var _0x33113e={'method':_0x344a('0x5a'),'uri':util[_0x344a('0x5b')](_0x344a('0x5c'),_0x23a761,_0x344a('0x5d')),'json':!![]};switch(_0x42e1c0[_0x344a('0x5e')]){case _0x344a('0x55'):_0x33113e[_0x344a('0x5f')]={'Authorization':util['format'](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x61'),_0x42e1c0[_0x344a('0x54')],_0x42e1c0['password']))[_0x344a('0x62')](_0x344a('0x63')))};break;case _0x344a('0x56'):_0x33113e[_0x344a('0x5f')]={'Authorization':util[_0x344a('0x5b')](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x64'),_0x42e1c0['username'],_0x42e1c0[_0x344a('0x56')]))[_0x344a('0x62')](_0x344a('0x63')))};break;default:throw new db[(_0x344a('0x65'))]['ValidationError'](_0x344a('0x66'));}return rp(_0x33113e);}})[_0x344a('0x25')](function(_0x1d0025){if(_0x1d0025){var _0x2ff11d=[_0x344a('0x67'),_0x344a('0x68'),'group',_0x344a('0x69')];_[_0x344a('0x6a')](_0x1d0025[_0x344a('0x5d')],function(_0x5584d5){return _0x2ff11d[_0x344a('0x6b')](_0x5584d5[_0x344a('0x3f')]);});return{'count':_0x1d0025[_0x344a('0x5d')][_0x344a('0x36')],'rows':_[_0x344a('0x2b')](_0x1d0025['ticket_fields'],function(_0x15aadb){return{'id':_0x15aadb['id'],'name':_0x15aadb[_0x344a('0x6c')]>0x7?_0x15aadb[_0x344a('0x6d')]:_0x15aadb['type'],'custom':_0x15aadb[_0x344a('0x6c')]>0x7?!![]:![],'options':_0x15aadb['system_field_options']?_0x15aadb['system_field_options']:_0x15aadb[_0x344a('0x6e')]?_0x15aadb[_0x344a('0x6e')]:[]};})};}})[_0x344a('0x25')](respondWithResult(_0x26688e,null))[_0x344a('0x46')](function(_0x375c34){var _0x5e8df4=_0x1c4284[_0x344a('0x30')][_0x344a('0x6f')]?0x1f4:_0x375c34['statusCode']||0x1f4;logger[_0x344a('0x26')](_0x344a('0x70'),'getFields',_0x5e8df4,JSON['stringify'](_0x375c34));delete _0x375c34[_0x344a('0x28')];if(_0x5e8df4===0x191){_0x5e8df4=0x190;}_0x26688e[_0x344a('0x18')](_0x5e8df4)[_0x344a('0x29')](_0x1c4284[_0x344a('0x30')]['test']?{'message':_0x344a('0x71'),'statusCode':_0x375c34[_0x344a('0x72')]}:_0x375c34);});}; \ No newline at end of file +var _0x9348=['authType','remoteUri','substring','lastIndexOf','%s/%s','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../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','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','username','token'];(function(_0x2f8df1,_0x176beb){var _0x2dffb3=function(_0x1b068f){while(--_0x1b068f){_0x2f8df1['push'](_0x2f8df1['shift']());}};_0x2dffb3(++_0x176beb);}(_0x9348,0x10d));var _0x8934=function(_0xa5806c,_0x3b4007){_0xa5806c=_0xa5806c-0x0;var _0x374da9=_0x9348[_0xa5806c];return _0x374da9;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x68427d,_0x108eab){_0x108eab=_0x108eab||0xcc;return function(_0x46bca5){if(_0x46bca5){return _0x68427d[_0x8934('0x19')](_0x108eab);}return _0x68427d[_0x8934('0x1a')](_0x108eab)[_0x8934('0x1b')]();};}function respondWithResult(_0x5b560f,_0x254720){_0x254720=_0x254720||0xc8;return function(_0x38230a){if(_0x38230a){return _0x5b560f[_0x8934('0x1a')](_0x254720)[_0x8934('0x1c')](_0x38230a);}};}function respondWithFilteredResult(_0x34d4dc,_0x41e6a9){return function(_0x2a5b04){if(_0x2a5b04){var _0x357cf8=typeof _0x41e6a9['offset']===_0x8934('0x1d')&&typeof _0x41e6a9[_0x8934('0x1e')]===_0x8934('0x1d');var _0x5de8f0=_0x2a5b04['count'];var _0x597eed=_0x357cf8?0x0:_0x41e6a9[_0x8934('0x1f')];var _0x51f9ed=_0x357cf8?_0x2a5b04[_0x8934('0x20')]:_0x41e6a9[_0x8934('0x1f')]+_0x41e6a9[_0x8934('0x1e')];var _0x36c3b9;if(_0x51f9ed>=_0x5de8f0){_0x51f9ed=_0x5de8f0;_0x36c3b9=0xc8;}else{_0x36c3b9=0xce;}_0x34d4dc[_0x8934('0x1a')](_0x36c3b9);return _0x34d4dc['set'](_0x8934('0x21'),_0x597eed+'-'+_0x51f9ed+'/'+_0x5de8f0)['json'](_0x2a5b04);}return null;};}function patchUpdates(_0x476c6c){return function(_0x34f4e7){try{jsonpatch[_0x8934('0x22')](_0x34f4e7,_0x476c6c,!![]);}catch(_0x379445){return BPromise[_0x8934('0x23')](_0x379445);}return _0x34f4e7[_0x8934('0x24')]();};}function saveUpdates(_0x36fe20,_0x4f4a9b){return function(_0xe763c6){if(_0xe763c6){return _0xe763c6[_0x8934('0x25')](_0x36fe20)[_0x8934('0x26')](function(_0x343e09){return _0x343e09;});}return null;};}function removeEntity(_0x43b89a,_0x5e593b){return function(_0x3cf295){if(_0x3cf295){return _0x3cf295[_0x8934('0x27')]()[_0x8934('0x26')](function(){_0x43b89a['status'](0xcc)[_0x8934('0x1b')]();});}};}function handleEntityNotFound(_0x561df2,_0x14c5f0){return function(_0x1783ce){if(!_0x1783ce){_0x561df2[_0x8934('0x19')](0x194);}return _0x1783ce;};}function handleError(_0x5ef0ed,_0x1fd5eb){_0x1fd5eb=_0x1fd5eb||0x1f4;return function(_0x15910b){logger[_0x8934('0x28')](_0x15910b[_0x8934('0x29')]);if(_0x15910b['name']){delete _0x15910b[_0x8934('0x2a')];}_0x5ef0ed[_0x8934('0x1a')](_0x1fd5eb)[_0x8934('0x2b')](_0x15910b);};}exports[_0x8934('0x2c')]=function(_0x44972b,_0x20d448){var _0x3f328a={},_0x457634={},_0x9c6a71={'count':0x0,'rows':[]};var _0x18938a=_['map'](db[_0x8934('0x2d')][_0x8934('0x2e')],function(_0x54d28d){return{'name':_0x54d28d[_0x8934('0x2f')],'type':_0x54d28d[_0x8934('0x30')][_0x8934('0x31')]};});_0x457634[_0x8934('0x32')]=_['map'](_0x18938a,_0x8934('0x2a'));_0x457634[_0x8934('0x33')]=_[_0x8934('0x34')](_0x44972b[_0x8934('0x33')]);_0x457634[_0x8934('0x35')]=_['intersection'](_0x457634[_0x8934('0x32')],_0x457634['query']);_0x3f328a['attributes']=_[_0x8934('0x36')](_0x457634[_0x8934('0x32')],qs[_0x8934('0x37')](_0x44972b[_0x8934('0x33')]['fields']));_0x3f328a[_0x8934('0x38')]=_0x3f328a[_0x8934('0x38')][_0x8934('0x39')]?_0x3f328a[_0x8934('0x38')]:_0x457634[_0x8934('0x32')];if(!_0x44972b['query'][_0x8934('0x3a')](_0x8934('0x3b'))){_0x3f328a['limit']=qs['limit'](_0x44972b[_0x8934('0x33')][_0x8934('0x1e')]);_0x3f328a['offset']=qs['offset'](_0x44972b[_0x8934('0x33')][_0x8934('0x1f')]);}_0x3f328a[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x44972b[_0x8934('0x33')][_0x8934('0x3d')]);_0x3f328a[_0x8934('0x3e')]=qs[_0x8934('0x35')](_[_0x8934('0x3f')](_0x44972b[_0x8934('0x33')],_0x457634[_0x8934('0x35')]),_0x18938a);if(_0x44972b['query'][_0x8934('0x40')]){_0x3f328a[_0x8934('0x3e')]=_['merge'](_0x3f328a[_0x8934('0x3e')],{'$or':_[_0x8934('0x41')](_0x18938a,function(_0x414091){if(_0x414091[_0x8934('0x30')]!==_0x8934('0x42')){var _0x5b0307={};_0x5b0307[_0x414091['name']]={'$like':'%'+_0x44972b['query'][_0x8934('0x40')]+'%'};return _0x5b0307;}})});}_0x3f328a=_[_0x8934('0x43')]({},_0x3f328a,_0x44972b[_0x8934('0x44')]);var _0x53581b={'where':_0x3f328a[_0x8934('0x3e')]};return db['ZendeskAccount']['count'](_0x53581b)[_0x8934('0x26')](function(_0x1f36d0){_0x9c6a71['count']=_0x1f36d0;if(_0x44972b['query'][_0x8934('0x45')]){_0x3f328a[_0x8934('0x46')]=[{'all':!![]}];}return db[_0x8934('0x2d')]['findAll'](_0x3f328a);})[_0x8934('0x26')](function(_0x5e543c){_0x9c6a71[_0x8934('0x47')]=_0x5e543c;return _0x9c6a71;})['then'](respondWithFilteredResult(_0x20d448,_0x3f328a))[_0x8934('0x48')](handleError(_0x20d448,null));};exports[_0x8934('0x49')]=function(_0x83be9e,_0x566d67){var _0xefdfab={'raw':![],'where':{'id':_0x83be9e[_0x8934('0x4a')]['id']}},_0x350d04={};_0x350d04[_0x8934('0x32')]=_['keys'](db[_0x8934('0x2d')][_0x8934('0x2e')]);_0x350d04[_0x8934('0x33')]=_[_0x8934('0x34')](_0x83be9e[_0x8934('0x33')]);_0x350d04[_0x8934('0x35')]=_[_0x8934('0x36')](_0x350d04[_0x8934('0x32')],_0x350d04['query']);_0xefdfab['attributes']=_['intersection'](_0x350d04[_0x8934('0x32')],qs[_0x8934('0x37')](_0x83be9e['query'][_0x8934('0x37')]));_0xefdfab['attributes']=_0xefdfab[_0x8934('0x38')][_0x8934('0x39')]?_0xefdfab['attributes']:_0x350d04[_0x8934('0x32')];if(_0x83be9e[_0x8934('0x33')][_0x8934('0x45')]){_0xefdfab[_0x8934('0x46')]=[{'all':!![]}];}_0xefdfab=_['merge']({},_0xefdfab,_0x83be9e[_0x8934('0x44')]);return db[_0x8934('0x2d')]['find'](_0xefdfab)[_0x8934('0x26')](handleEntityNotFound(_0x566d67,null))[_0x8934('0x26')](respondWithResult(_0x566d67,null))[_0x8934('0x48')](handleError(_0x566d67,null));};exports[_0x8934('0x4b')]=function(_0x406d0a,_0x419e30){return db[_0x8934('0x2d')][_0x8934('0x4b')](_0x406d0a[_0x8934('0x4c')],{})[_0x8934('0x26')](respondWithResult(_0x419e30,0xc9))[_0x8934('0x48')](handleError(_0x419e30,null));};exports[_0x8934('0x25')]=function(_0x2c322d,_0x2febf5){if(_0x2c322d[_0x8934('0x4c')]['id']){delete _0x2c322d[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x4d')]({'where':{'id':_0x2c322d['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x2febf5,null))[_0x8934('0x26')](saveUpdates(_0x2c322d['body'],null))['then'](respondWithResult(_0x2febf5,null))['catch'](handleError(_0x2febf5,null));};exports['destroy']=function(_0x3610a0,_0x15310a){return db[_0x8934('0x2d')]['find']({'where':{'id':_0x3610a0['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x15310a,null))['then'](removeEntity(_0x15310a,null))['catch'](handleError(_0x15310a,null));};exports[_0x8934('0x4e')]=function(_0x2778f9,_0x173bc1,_0x334f27){var _0x21ca17={};var _0x1b66d8={};var _0x3902fb;var _0x575bd7;return db[_0x8934('0x2d')]['findOne']({'where':{'id':_0x2778f9[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x173bc1,null))[_0x8934('0x26')](function(_0x3df31e){if(_0x3df31e){_0x3902fb=_0x3df31e;_0x1b66d8[_0x8934('0x32')]=_[_0x8934('0x34')](db[_0x8934('0x4f')][_0x8934('0x2e')]);_0x1b66d8['query']=_[_0x8934('0x34')](_0x2778f9[_0x8934('0x33')]);_0x1b66d8[_0x8934('0x35')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],_0x1b66d8['query']);_0x21ca17[_0x8934('0x38')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],qs['fields'](_0x2778f9[_0x8934('0x33')][_0x8934('0x37')]));_0x21ca17[_0x8934('0x38')]=_0x21ca17['attributes']['length']?_0x21ca17['attributes']:_0x1b66d8[_0x8934('0x32')];_0x21ca17[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x2778f9['query'][_0x8934('0x3d')]);_0x21ca17[_0x8934('0x3e')]=qs['filters'](_['pick'](_0x2778f9[_0x8934('0x33')],_0x1b66d8[_0x8934('0x35')]));if(_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]){_0x21ca17['where']=_['merge'](_0x21ca17['where'],{'$or':_['map'](_0x21ca17[_0x8934('0x38')],function(_0x2b8837){var _0x18d08e={};_0x18d08e[_0x2b8837]={'$like':'%'+_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]+'%'};return _0x18d08e;})});}_0x21ca17=_[_0x8934('0x43')]({},_0x21ca17,_0x2778f9['options']);return _0x3902fb[_0x8934('0x4e')](_0x21ca17);}})[_0x8934('0x26')](function(_0x4991bd){if(_0x4991bd){_0x575bd7=_0x4991bd[_0x8934('0x39')];if(!_0x2778f9['query'][_0x8934('0x3a')]('nolimit')){_0x21ca17[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x2778f9[_0x8934('0x33')][_0x8934('0x1e')]);_0x21ca17[_0x8934('0x1f')]=qs[_0x8934('0x1f')](_0x2778f9[_0x8934('0x33')]['offset']);}return _0x3902fb['getConfigurations'](_0x21ca17);}})[_0x8934('0x26')](function(_0x3a0378){if(_0x3a0378){return _0x3a0378?{'count':_0x575bd7,'rows':_0x3a0378}:null;}})[_0x8934('0x26')](respondWithResult(_0x173bc1,null))[_0x8934('0x48')](handleError(_0x173bc1,null));};exports[_0x8934('0x50')]=function(_0x18850a,_0x35c437,_0x112957){if(_0x18850a[_0x8934('0x4c')]['id']){delete _0x18850a[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x18850a[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x35c437,null))['then'](function(_0x5c2819){if(_0x5c2819){_0x18850a[_0x8934('0x4c')][_0x8934('0x52')]=_0x5c2819['id'];_0x18850a[_0x8934('0x4c')][_0x8934('0x53')]=integrations[_0x8934('0x54')](_0x18850a[_0x8934('0x4c')][_0x8934('0x55')],_0x18850a['body'][_0x8934('0x30')]);_0x18850a[_0x8934('0x4c')]['Descriptions']=integrations[_0x8934('0x56')](_0x18850a['body'][_0x8934('0x55')],_0x18850a[_0x8934('0x4c')][_0x8934('0x30')]);return db['ZendeskConfiguration'][_0x8934('0x4b')](_0x18850a[_0x8934('0x4c')],{'include':[{'model':db['ZendeskField'],'as':_0x8934('0x53')},{'model':db['ZendeskField'],'as':_0x8934('0x57')}]});}return null;})['then'](respondWithResult(_0x35c437,null))[_0x8934('0x48')](handleError(_0x35c437,null));};exports[_0x8934('0x58')]=function(_0x24b0ce,_0x5ea4fe,_0x196372){var _0xfbad9='';return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x24b0ce['params']['id']},'attributes':['id',_0x8934('0x59'),'password',_0x8934('0x5a'),_0x8934('0x5b'),_0x8934('0x5c')]})[_0x8934('0x26')](handleEntityNotFound(_0x5ea4fe,null))['then'](function(_0xc2799d){if(_0xc2799d){_0xfbad9=_0xc2799d[_0x8934('0x5c')];var _0xd880ba=_0xfbad9['slice'](-0x1);if(_0xd880ba==='/'){_0xfbad9=_0xfbad9[_0x8934('0x5d')](0x0,_0xfbad9[_0x8934('0x5e')](_0xd880ba));}var _0x2acd18={'method':'GET','uri':util['format'](_0x8934('0x5f'),_0xfbad9,_0x8934('0x60')),'json':!![]};switch(_0xc2799d[_0x8934('0x5b')]){case _0x8934('0x61'):_0x2acd18[_0x8934('0x62')]={'Authorization':util[_0x8934('0x63')](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')](_0x8934('0x65'),_0xc2799d['username'],_0xc2799d[_0x8934('0x61')]))[_0x8934('0x66')](_0x8934('0x67')))};break;case _0x8934('0x5a'):_0x2acd18[_0x8934('0x62')]={'Authorization':util['format'](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')]('%s/token:%s',_0xc2799d[_0x8934('0x59')],_0xc2799d['token']))['toString']('base64'))};break;default:throw new db[(_0x8934('0x68'))][(_0x8934('0x69'))](_0x8934('0x6a'));}return rp(_0x2acd18);}})['then'](function(_0x2c289b){if(_0x2c289b){var _0x1d3372=['subject',_0x8934('0x6b'),_0x8934('0x6c'),_0x8934('0x6d')];_[_0x8934('0x6e')](_0x2c289b[_0x8934('0x60')],function(_0x324722){return _0x1d3372[_0x8934('0x6f')](_0x324722[_0x8934('0x30')]);});return{'count':_0x2c289b[_0x8934('0x60')][_0x8934('0x39')],'rows':_['map'](_0x2c289b[_0x8934('0x60')],function(_0x31e7d1){return{'id':_0x31e7d1['id'],'name':_0x31e7d1[_0x8934('0x70')]>0x7?_0x31e7d1[_0x8934('0x71')]:_0x31e7d1[_0x8934('0x30')],'custom':_0x31e7d1[_0x8934('0x70')]>0x7?!![]:![],'options':_0x31e7d1[_0x8934('0x72')]?_0x31e7d1['system_field_options']:_0x31e7d1[_0x8934('0x73')]?_0x31e7d1[_0x8934('0x73')]:[]};})};}})[_0x8934('0x26')](respondWithResult(_0x5ea4fe,null))[_0x8934('0x48')](function(_0x9de459){var _0xdf0ab2=_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?0x1f4:_0x9de459[_0x8934('0x75')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8934('0x58'),_0xdf0ab2,JSON[_0x8934('0x76')](_0x9de459));delete _0x9de459['name'];if(_0xdf0ab2===0x191){_0xdf0ab2=0x190;}_0x5ea4fe[_0x8934('0x1a')](_0xdf0ab2)[_0x8934('0x2b')](_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?{'message':_0x8934('0x77'),'statusCode':_0x9de459[_0x8934('0x75')]}:_0x9de459);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 10642bd..387124f 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 _0x547a=['rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','path'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x547a,0xd8));var _0xa547=function(_0xf89ad3,_0x4a4a05){_0xf89ad3=_0xf89ad3-0x0;var _0x324449=_0x547a[_0xf89ad3];return _0x324449;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa547('0x0'));var rimraf=require(_0xa547('0x1'));var config=require(_0xa547('0x2'));var attributes=require(_0xa547('0x3'));var integrations=require('../../components/integrations/configuration');module[_0xa547('0x4')]=function(_0x4b09fb,_0x4d8cdd){return _0x4b09fb[_0xa547('0x5')](_0xa547('0x6'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x482c=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5e3f0f,_0x16c6c7){var _0xbd8d66=function(_0x3f4da4){while(--_0x3f4da4){_0x5e3f0f['push'](_0x5e3f0f['shift']());}};_0xbd8d66(++_0x16c6c7);}(_0x482c,0x8e));var _0xc482=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x482c[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xc482('0x0'));var util=require(_0xc482('0x1'));var logger=require(_0xc482('0x2'))(_0xc482('0x3'));var moment=require(_0xc482('0x4'));var BPromise=require(_0xc482('0x5'));var rp=require(_0xc482('0x6'));var fs=require('fs');var path=require(_0xc482('0x7'));var rimraf=require(_0xc482('0x8'));var config=require(_0xc482('0x9'));var attributes=require(_0xc482('0xa'));var integrations=require(_0xc482('0xb'));module['exports']=function(_0x49b49c,_0x17009f){return _0x49b49c[_0xc482('0xc')](_0xc482('0xd'),attributes,{'tableName':_0xc482('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 94b0a52..c6edece 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 _0x446d=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','find','ShowZendeskAccount','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x446d,0x126));var _0xd446=function(_0x2fa334,_0xa351de){_0x2fa334=_0x2fa334-0x0;var _0x5b846c=_0x446d[_0x2fa334];return _0x5b846c;};'use strict';var _=require(_0xd446('0x0'));var util=require('util');var moment=require(_0xd446('0x1'));var BPromise=require('bluebird');var rs=require(_0xd446('0x2'));var fs=require('fs');var Redis=require(_0xd446('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd446('0x4'));var logger=require('../../config/logger')(_0xd446('0x5'));var config=require(_0xd446('0x6'));var jayson=require(_0xd446('0x7'));var client=jayson[_0xd446('0x8')][_0xd446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c4639,_0x3d675e,_0x4bbe57){return new BPromise(function(_0x3b8ce1,_0x3d27ca){return client[_0xd446('0xa')](_0x2c4639,_0x4bbe57)['then'](function(_0x5733f5){logger['info'](_0xd446('0xb'),_0x3d675e,'request\x20sent');logger[_0xd446('0xc')](_0xd446('0xd'),_0x3d675e,'request\x20sent',JSON[_0xd446('0xe')](_0x5733f5));if(_0x5733f5['error']){if(_0x5733f5['error']['code']===0x1f4){logger[_0xd446('0xf')](_0xd446('0xb'),_0x3d675e,_0x5733f5['error'][_0xd446('0x10')]);return _0x3d27ca(_0x5733f5[_0xd446('0xf')][_0xd446('0x10')]);}logger[_0xd446('0xf')](_0xd446('0xb'),_0x3d675e,_0x5733f5[_0xd446('0xf')][_0xd446('0x10')]);return _0x3b8ce1(_0x5733f5[_0xd446('0xf')][_0xd446('0x10')]);}else{logger[_0xd446('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x3d675e,'request\x20sent');_0x3b8ce1(_0x5733f5[_0xd446('0x12')]['message']);}})[_0xd446('0x13')](function(_0x1bbb1){logger['error'](_0xd446('0xb'),_0x3d675e,_0x1bbb1);_0x3d27ca(_0x1bbb1);});});}exports[_0xd446('0x14')]=function(_0x1b0f30){var _0x1ab252=this;return new Promise(function(_0x4e3e2a,_0x716aec){return db[_0xd446('0x15')][_0xd446('0x16')]({'raw':_0x1b0f30['options']?_0x1b0f30['options'][_0xd446('0x17')]===undefined?!![]:![]:!![],'where':_0x1b0f30['options']?_0x1b0f30[_0xd446('0x18')][_0xd446('0x19')]||null:null,'attributes':_0x1b0f30['options']?_0x1b0f30[_0xd446('0x18')][_0xd446('0x1a')]||null:null,'limit':_0x1b0f30['options']?_0x1b0f30[_0xd446('0x18')][_0xd446('0x1b')]||null:null,'include':_0x1b0f30[_0xd446('0x18')]?_0x1b0f30[_0xd446('0x18')][_0xd446('0x1c')]?_[_0xd446('0x1d')](_0x1b0f30[_0xd446('0x18')][_0xd446('0x1c')],function(_0x544e61){return{'model':db[_0x544e61[_0xd446('0x1e')]],'as':_0x544e61['as'],'attributes':_0x544e61[_0xd446('0x1a')],'include':_0x544e61[_0xd446('0x1c')]?_[_0xd446('0x1d')](_0x544e61['include'],function(_0x1839f7){return{'model':db[_0x1839f7[_0xd446('0x1e')]],'as':_0x1839f7['as'],'attributes':_0x1839f7[_0xd446('0x1a')],'include':_0x1839f7[_0xd446('0x1c')]?_[_0xd446('0x1d')](_0x1839f7[_0xd446('0x1c')],function(_0x2d4a57){return{'model':db[_0x2d4a57['model']],'as':_0x2d4a57['as'],'attributes':_0x2d4a57['attributes']};}):[]};}):[]};}):[]:[]})[_0xd446('0x1f')](function(_0xb43acf){logger['info'](_0xd446('0x14'),_0x1b0f30);logger[_0xd446('0xc')](_0xd446('0x14'),_0x1b0f30,JSON[_0xd446('0xe')](_0xb43acf));_0x4e3e2a(_0xb43acf);})[_0xd446('0x13')](function(_0x41230f){logger['error'](_0xd446('0x14'),_0x41230f[_0xd446('0x10')],_0x1b0f30);_0x716aec(_0x1ab252[_0xd446('0xf')](0x1f4,_0x41230f['message']));});});};exports['ShowZendeskAccount']=function(_0x32096b){var _0x212072=this;return new Promise(function(_0x4b43b1,_0xd0bac){return db[_0xd446('0x15')][_0xd446('0x20')]({'raw':_0x32096b['options']?_0x32096b[_0xd446('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x32096b[_0xd446('0x18')]?_0x32096b[_0xd446('0x18')][_0xd446('0x19')]||null:null,'attributes':_0x32096b[_0xd446('0x18')]?_0x32096b['options'][_0xd446('0x1a')]||null:null,'include':_0x32096b[_0xd446('0x18')]?_0x32096b['options'][_0xd446('0x1c')]?_[_0xd446('0x1d')](_0x32096b[_0xd446('0x18')]['include'],function(_0x243b90){return{'model':db[_0x243b90[_0xd446('0x1e')]],'as':_0x243b90['as'],'attributes':_0x243b90[_0xd446('0x1a')],'include':_0x243b90['include']?_['map'](_0x243b90[_0xd446('0x1c')],function(_0xe5dd21){return{'model':db[_0xe5dd21[_0xd446('0x1e')]],'as':_0xe5dd21['as'],'attributes':_0xe5dd21['attributes'],'include':_0xe5dd21[_0xd446('0x1c')]?_[_0xd446('0x1d')](_0xe5dd21[_0xd446('0x1c')],function(_0x18e673){return{'model':db[_0x18e673[_0xd446('0x1e')]],'as':_0x18e673['as'],'attributes':_0x18e673[_0xd446('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd446('0x1f')](function(_0xada9ab){logger[_0xd446('0x11')](_0xd446('0x21'),_0x32096b);logger[_0xd446('0xc')](_0xd446('0x21'),_0x32096b,JSON[_0xd446('0xe')](_0xada9ab));_0x4b43b1(_0xada9ab);})['catch'](function(_0x518db8){logger['error'](_0xd446('0x21'),_0x518db8[_0xd446('0x10')],_0x32096b);_0xd0bac(_0x212072[_0xd446('0xf')](0x1f4,_0x518db8[_0xd446('0x10')]));});});}; \ No newline at end of file +var _0x2f91=['GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','map','model','include','where','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x482934,_0x5ad2b9){var _0x130ec2=function(_0x29a84e){while(--_0x29a84e){_0x482934['push'](_0x482934['shift']());}};_0x130ec2(++_0x5ad2b9);}(_0x2f91,0x98));var _0x12f9=function(_0x22da31,_0x5cc256){_0x22da31=_0x22da31-0x0;var _0x2c7e2c=_0x2f91[_0x22da31];return _0x2c7e2c;};'use strict';var _=require(_0x12f9('0x0'));var util=require(_0x12f9('0x1'));var moment=require(_0x12f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x12f9('0x3'));var fs=require('fs');var Redis=require(_0x12f9('0x4'));var db=require(_0x12f9('0x5'))['db'];var utils=require(_0x12f9('0x6'));var logger=require('../../config/logger')(_0x12f9('0x7'));var config=require(_0x12f9('0x8'));var jayson=require(_0x12f9('0x9'));var client=jayson[_0x12f9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7811e,_0x7b1ba,_0x4ea10c){return new BPromise(function(_0x5b892a,_0x4da69c){return client[_0x12f9('0xb')](_0x7811e,_0x4ea10c)[_0x12f9('0xc')](function(_0x42b029){logger[_0x12f9('0xd')](_0x12f9('0xe'),_0x7b1ba,_0x12f9('0xf'));logger[_0x12f9('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x7b1ba,'request\x20sent',JSON[_0x12f9('0x11')](_0x42b029));if(_0x42b029[_0x12f9('0x12')]){if(_0x42b029[_0x12f9('0x12')][_0x12f9('0x13')]===0x1f4){logger[_0x12f9('0x12')](_0x12f9('0xe'),_0x7b1ba,_0x42b029[_0x12f9('0x12')]['message']);return _0x4da69c(_0x42b029[_0x12f9('0x12')][_0x12f9('0x14')]);}logger[_0x12f9('0x12')](_0x12f9('0xe'),_0x7b1ba,_0x42b029[_0x12f9('0x12')][_0x12f9('0x14')]);return _0x5b892a(_0x42b029['error']['message']);}else{logger['info'](_0x12f9('0xe'),_0x7b1ba,_0x12f9('0xf'));_0x5b892a(_0x42b029[_0x12f9('0x15')][_0x12f9('0x14')]);}})[_0x12f9('0x16')](function(_0x6847f3){logger[_0x12f9('0x12')](_0x12f9('0xe'),_0x7b1ba,_0x6847f3);_0x4da69c(_0x6847f3);});});}exports[_0x12f9('0x17')]=function(_0x25fc24){var _0x74b655=this;return new Promise(function(_0x308a1e,_0x5a5807){return db[_0x12f9('0x18')][_0x12f9('0x19')]({'raw':_0x25fc24[_0x12f9('0x1a')]?_0x25fc24['options'][_0x12f9('0x1b')]===undefined?!![]:![]:!![],'where':_0x25fc24[_0x12f9('0x1a')]?_0x25fc24[_0x12f9('0x1a')]['where']||null:null,'attributes':_0x25fc24[_0x12f9('0x1a')]?_0x25fc24[_0x12f9('0x1a')][_0x12f9('0x1c')]||null:null,'limit':_0x25fc24[_0x12f9('0x1a')]?_0x25fc24['options'][_0x12f9('0x1d')]||null:null,'include':_0x25fc24[_0x12f9('0x1a')]?_0x25fc24[_0x12f9('0x1a')]['include']?_[_0x12f9('0x1e')](_0x25fc24[_0x12f9('0x1a')]['include'],function(_0x3d242a){return{'model':db[_0x3d242a[_0x12f9('0x1f')]],'as':_0x3d242a['as'],'attributes':_0x3d242a[_0x12f9('0x1c')],'include':_0x3d242a['include']?_[_0x12f9('0x1e')](_0x3d242a[_0x12f9('0x20')],function(_0x5c21d4){return{'model':db[_0x5c21d4[_0x12f9('0x1f')]],'as':_0x5c21d4['as'],'attributes':_0x5c21d4[_0x12f9('0x1c')],'include':_0x5c21d4[_0x12f9('0x20')]?_['map'](_0x5c21d4[_0x12f9('0x20')],function(_0x4080f8){return{'model':db[_0x4080f8[_0x12f9('0x1f')]],'as':_0x4080f8['as'],'attributes':_0x4080f8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37551a){logger[_0x12f9('0xd')]('GetZendeskAccount',_0x25fc24);logger[_0x12f9('0x10')]('GetZendeskAccount',_0x25fc24,JSON[_0x12f9('0x11')](_0x37551a));_0x308a1e(_0x37551a);})['catch'](function(_0x3ab9ff){logger[_0x12f9('0x12')]('GetZendeskAccount',_0x3ab9ff[_0x12f9('0x14')],_0x25fc24);_0x5a5807(_0x74b655[_0x12f9('0x12')](0x1f4,_0x3ab9ff[_0x12f9('0x14')]));});});};exports['ShowZendeskAccount']=function(_0x1b1266){var _0x24060c=this;return new Promise(function(_0x4ae6bd,_0x4117dc){return db[_0x12f9('0x18')]['find']({'raw':_0x1b1266[_0x12f9('0x1a')]?_0x1b1266['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b1266[_0x12f9('0x1a')]?_0x1b1266[_0x12f9('0x1a')][_0x12f9('0x21')]||null:null,'attributes':_0x1b1266[_0x12f9('0x1a')]?_0x1b1266[_0x12f9('0x1a')][_0x12f9('0x1c')]||null:null,'include':_0x1b1266[_0x12f9('0x1a')]?_0x1b1266[_0x12f9('0x1a')]['include']?_['map'](_0x1b1266['options'][_0x12f9('0x20')],function(_0x37459c){return{'model':db[_0x37459c['model']],'as':_0x37459c['as'],'attributes':_0x37459c[_0x12f9('0x1c')],'include':_0x37459c[_0x12f9('0x20')]?_[_0x12f9('0x1e')](_0x37459c[_0x12f9('0x20')],function(_0x23609a){return{'model':db[_0x23609a[_0x12f9('0x1f')]],'as':_0x23609a['as'],'attributes':_0x23609a[_0x12f9('0x1c')],'include':_0x23609a[_0x12f9('0x20')]?_[_0x12f9('0x1e')](_0x23609a[_0x12f9('0x20')],function(_0x5b9a7e){return{'model':db[_0x5b9a7e['model']],'as':_0x5b9a7e['as'],'attributes':_0x5b9a7e[_0x12f9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2323ef){logger[_0x12f9('0xd')]('ShowZendeskAccount',_0x1b1266);logger[_0x12f9('0x10')](_0x12f9('0x22'),_0x1b1266,JSON[_0x12f9('0x11')](_0x2323ef));_0x4ae6bd(_0x2323ef);})[_0x12f9('0x16')](function(_0x3530e4){logger[_0x12f9('0x12')](_0x12f9('0x22'),_0x3530e4[_0x12f9('0x14')],_0x1b1266);_0x4117dc(_0x24060c[_0x12f9('0x12')](0x1f4,_0x3530e4['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5f56b85..c39925a 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x495b61,_0x295f49){var _0xb616d4=function(_0x1c0181){while(--_0x1c0181){_0x495b61['push'](_0x495b61['shift']());}};_0xb616d4(++_0x295f49);}(_0xe706,0xa3));var _0x6e70=function(_0x38490b,_0x108ad7){_0x38490b=_0x38490b-0x0;var _0x197661=_0xe706[_0x38490b];return _0x197661;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x177488,_0x3aeefa){var _0x328047=function(_0x56d0b6){while(--_0x56d0b6){_0x177488['push'](_0x177488['shift']());}};_0x328047(++_0x3aeefa);}(_0x087b,0x11a));var _0xb087=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x087b[_0x20ef64];return _0x3707d8;};'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/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8e03d36..e0a11cb 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 _0x39b6=['exports','STRING','sequelize'];(function(_0x5c61f3,_0x567a76){var _0x179024=function(_0x4d5232){while(--_0x4d5232){_0x5c61f3['push'](_0x5c61f3['shift']());}};_0x179024(++_0x567a76);}(_0x39b6,0x65));var _0x639b=function(_0x14fbb7,_0x4a1b92){_0x14fbb7=_0x14fbb7-0x0;var _0xc16c10=_0x39b6[_0x14fbb7];return _0xc16c10;};'use strict';var Sequelize=require(_0x639b('0x0'));module[_0x639b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x639b('0x2')]}}; \ No newline at end of file +var _0x20a0=['exports','STRING','sequelize'];(function(_0x1bc3aa,_0x4a2626){var _0xdb0180=function(_0x13962d){while(--_0x13962d){_0x1bc3aa['push'](_0x1bc3aa['shift']());}};_0xdb0180(++_0x4a2626);}(_0x20a0,0x1b8));var _0x020a=function(_0x2d64c4,_0x289306){_0x2d64c4=_0x2d64c4-0x0;var _0x2fc036=_0x20a0[_0x2d64c4];return _0x2fc036;};'use strict';var Sequelize=require(_0x020a('0x0'));module[_0x020a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x020a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0dab2e5..b32195f 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 _0xdffe=['order','sort','pick','merge','where','type','VIRTUAL','filter','count','include','findAll','catch','params','keys','options','ZendeskConfiguration','create','body','find','getFields','getSubjects','ZendeskField','getDescriptions','findOne','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3728b3,_0x24a993){var _0xed0bc6=function(_0x3e31f2){while(--_0x3e31f2){_0x3728b3['push'](_0x3728b3['shift']());}};_0xed0bc6(++_0x24a993);}(_0xdffe,0x1b6));var _0xedff=function(_0x2a1c1c,_0x2c664e){_0x2a1c1c=_0x2a1c1c-0x0;var _0xbf4766=_0xdffe[_0x2a1c1c];return _0xbf4766;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedff('0x0'));var zipdir=require(_0xedff('0x1'));var jsonpatch=require(_0xedff('0x2'));var rp=require('request-promise');var moment=require(_0xedff('0x3'));var BPromise=require(_0xedff('0x4'));var Mustache=require('mustache');var util=require(_0xedff('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xedff('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedff('0x7'));var _=require(_0xedff('0x8'));var squel=require(_0xedff('0x9'));var crypto=require(_0xedff('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xedff('0xb'));var toCsv=require('to-csv');var querystring=require(_0xedff('0xc'));var Papa=require(_0xedff('0xd'));var Redis=require(_0xedff('0xe'));var authService=require(_0xedff('0xf'));var qs=require(_0xedff('0x10'));var as=require(_0xedff('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedff('0x12'))(_0xedff('0x13'));var utils=require(_0xedff('0x14'));var config=require(_0xedff('0x15'));var licenseUtil=require(_0xedff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2624df,_0x2f9dfa){_0x2f9dfa=_0x2f9dfa||0xcc;return function(_0x41f5c3){if(_0x41f5c3){return _0x2624df[_0xedff('0x17')](_0x2f9dfa);}return _0x2624df[_0xedff('0x18')](_0x2f9dfa)[_0xedff('0x19')]();};}function respondWithResult(_0x1c38a7,_0x46425c){_0x46425c=_0x46425c||0xc8;return function(_0x35aebd){if(_0x35aebd){return _0x1c38a7[_0xedff('0x18')](_0x46425c)[_0xedff('0x1a')](_0x35aebd);}};}function respondWithFilteredResult(_0xc3fdde,_0x540dc7){return function(_0x207a49){if(_0x207a49){var _0x5b6361=typeof _0x540dc7[_0xedff('0x1b')]===_0xedff('0x1c')&&typeof _0x540dc7[_0xedff('0x1d')]===_0xedff('0x1c');var _0x2edcc4=_0x207a49['count'];var _0x13886b=_0x5b6361?0x0:_0x540dc7['offset'];var _0x1ebbe4=_0x5b6361?_0x207a49['count']:_0x540dc7['offset']+_0x540dc7[_0xedff('0x1d')];var _0x2c2d32;if(_0x1ebbe4>=_0x2edcc4){_0x1ebbe4=_0x2edcc4;_0x2c2d32=0xc8;}else{_0x2c2d32=0xce;}_0xc3fdde['status'](_0x2c2d32);return _0xc3fdde[_0xedff('0x1e')]('Content-Range',_0x13886b+'-'+_0x1ebbe4+'/'+_0x2edcc4)[_0xedff('0x1a')](_0x207a49);}return null;};}function patchUpdates(_0x2ada37){return function(_0x40b27b){try{jsonpatch[_0xedff('0x1f')](_0x40b27b,_0x2ada37,!![]);}catch(_0x2c1f44){return BPromise[_0xedff('0x20')](_0x2c1f44);}return _0x40b27b[_0xedff('0x21')]();};}function saveUpdates(_0x472b62,_0x4c1ad4){return function(_0xe9d372){if(_0xe9d372){return _0xe9d372[_0xedff('0x22')](_0x472b62)[_0xedff('0x23')](function(_0x1b39da){return _0x1b39da;});}return null;};}function removeEntity(_0x3bbfea,_0x5db1a7){return function(_0x10b2b8){if(_0x10b2b8){return _0x10b2b8[_0xedff('0x24')]()[_0xedff('0x23')](function(){_0x3bbfea[_0xedff('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x367e93,_0xf78653){return function(_0x391e7f){if(!_0x391e7f){_0x367e93['sendStatus'](0x194);}return _0x391e7f;};}function handleError(_0x803926,_0x573d72){_0x573d72=_0x573d72||0x1f4;return function(_0x858ea){logger[_0xedff('0x25')](_0x858ea[_0xedff('0x26')]);if(_0x858ea[_0xedff('0x27')]){delete _0x858ea[_0xedff('0x27')];}_0x803926[_0xedff('0x18')](_0x573d72)[_0xedff('0x28')](_0x858ea);};}exports['index']=function(_0x5421c3,_0x295bde){var _0x2f2f0f={},_0x2b584c={},_0x1a7c9d={'count':0x0,'rows':[]};var _0x5136c8=_['map'](db['ZendeskConfiguration'][_0xedff('0x29')],function(_0x15b860){return{'name':_0x15b860[_0xedff('0x2a')],'type':_0x15b860['type'][_0xedff('0x2b')]};});_0x2b584c[_0xedff('0x2c')]=_[_0xedff('0x2d')](_0x5136c8,_0xedff('0x27'));_0x2b584c[_0xedff('0x2e')]=_['keys'](_0x5421c3[_0xedff('0x2e')]);_0x2b584c[_0xedff('0x2f')]=_[_0xedff('0x30')](_0x2b584c[_0xedff('0x2c')],_0x2b584c[_0xedff('0x2e')]);_0x2f2f0f[_0xedff('0x31')]=_[_0xedff('0x30')](_0x2b584c[_0xedff('0x2c')],qs[_0xedff('0x32')](_0x5421c3[_0xedff('0x2e')][_0xedff('0x32')]));_0x2f2f0f[_0xedff('0x31')]=_0x2f2f0f['attributes'][_0xedff('0x33')]?_0x2f2f0f[_0xedff('0x31')]:_0x2b584c[_0xedff('0x2c')];if(!_0x5421c3[_0xedff('0x2e')][_0xedff('0x34')](_0xedff('0x35'))){_0x2f2f0f[_0xedff('0x1d')]=qs['limit'](_0x5421c3[_0xedff('0x2e')][_0xedff('0x1d')]);_0x2f2f0f[_0xedff('0x1b')]=qs[_0xedff('0x1b')](_0x5421c3['query']['offset']);}_0x2f2f0f[_0xedff('0x36')]=qs[_0xedff('0x37')](_0x5421c3[_0xedff('0x2e')][_0xedff('0x37')]);_0x2f2f0f['where']=qs[_0xedff('0x2f')](_[_0xedff('0x38')](_0x5421c3[_0xedff('0x2e')],_0x2b584c['filters']),_0x5136c8);if(_0x5421c3[_0xedff('0x2e')]['filter']){_0x2f2f0f['where']=_[_0xedff('0x39')](_0x2f2f0f[_0xedff('0x3a')],{'$or':_['map'](_0x5136c8,function(_0xe22c6){if(_0xe22c6[_0xedff('0x3b')]!==_0xedff('0x3c')){var _0x5ebf54={};_0x5ebf54[_0xe22c6[_0xedff('0x27')]]={'$like':'%'+_0x5421c3[_0xedff('0x2e')][_0xedff('0x3d')]+'%'};return _0x5ebf54;}})});}_0x2f2f0f=_[_0xedff('0x39')]({},_0x2f2f0f,_0x5421c3['options']);var _0x12bd33={'where':_0x2f2f0f[_0xedff('0x3a')]};return db['ZendeskConfiguration']['count'](_0x12bd33)[_0xedff('0x23')](function(_0x50da0e){_0x1a7c9d[_0xedff('0x3e')]=_0x50da0e;if(_0x5421c3['query']['includeAll']){_0x2f2f0f[_0xedff('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xedff('0x40')](_0x2f2f0f);})[_0xedff('0x23')](function(_0xeba321){_0x1a7c9d['rows']=_0xeba321;return _0x1a7c9d;})[_0xedff('0x23')](respondWithFilteredResult(_0x295bde,_0x2f2f0f))[_0xedff('0x41')](handleError(_0x295bde,null));};exports['show']=function(_0x5f0a23,_0x326bab){var _0xf5cea5={'raw':![],'where':{'id':_0x5f0a23[_0xedff('0x42')]['id']}},_0x467e0c={};_0x467e0c['model']=_[_0xedff('0x43')](db['ZendeskConfiguration']['rawAttributes']);_0x467e0c[_0xedff('0x2e')]=_['keys'](_0x5f0a23['query']);_0x467e0c[_0xedff('0x2f')]=_[_0xedff('0x30')](_0x467e0c[_0xedff('0x2c')],_0x467e0c[_0xedff('0x2e')]);_0xf5cea5[_0xedff('0x31')]=_[_0xedff('0x30')](_0x467e0c[_0xedff('0x2c')],qs[_0xedff('0x32')](_0x5f0a23['query'][_0xedff('0x32')]));_0xf5cea5[_0xedff('0x31')]=_0xf5cea5['attributes'][_0xedff('0x33')]?_0xf5cea5[_0xedff('0x31')]:_0x467e0c[_0xedff('0x2c')];if(_0x5f0a23['query']['includeAll']){_0xf5cea5[_0xedff('0x3f')]=[{'all':!![]}];}_0xf5cea5=_['merge']({},_0xf5cea5,_0x5f0a23[_0xedff('0x44')]);return db[_0xedff('0x45')]['find'](_0xf5cea5)[_0xedff('0x23')](handleEntityNotFound(_0x326bab,null))[_0xedff('0x23')](respondWithResult(_0x326bab,null))[_0xedff('0x41')](handleError(_0x326bab,null));};exports[_0xedff('0x46')]=function(_0x3d7da7,_0x43b222){return db[_0xedff('0x45')]['create'](_0x3d7da7['body'],{})[_0xedff('0x23')](respondWithResult(_0x43b222,0xc9))['catch'](handleError(_0x43b222,null));};exports[_0xedff('0x22')]=function(_0x188b61,_0x210df4){if(_0x188b61[_0xedff('0x47')]['id']){delete _0x188b61[_0xedff('0x47')]['id'];}return db[_0xedff('0x45')]['find']({'where':{'id':_0x188b61[_0xedff('0x42')]['id']}})[_0xedff('0x23')](handleEntityNotFound(_0x210df4,null))[_0xedff('0x23')](saveUpdates(_0x188b61[_0xedff('0x47')],null))[_0xedff('0x23')](respondWithResult(_0x210df4,null))['catch'](handleError(_0x210df4,null));};exports[_0xedff('0x24')]=function(_0x365679,_0x333969){return db[_0xedff('0x45')][_0xedff('0x48')]({'where':{'id':_0x365679['params']['id']}})[_0xedff('0x23')](handleEntityNotFound(_0x333969,null))['then'](removeEntity(_0x333969,null))['catch'](handleError(_0x333969,null));};exports[_0xedff('0x49')]=function(_0x746f7b,_0xc3b161,_0x289712){var _0x33f09d={};var _0x53eaad={};var _0x54009a;var _0x543219;return db[_0xedff('0x45')]['findOne']({'where':{'id':_0x746f7b['params']['id']}})[_0xedff('0x23')](handleEntityNotFound(_0xc3b161,null))[_0xedff('0x23')](function(_0x611e14){if(_0x611e14){_0x54009a=_0x611e14;_0x53eaad[_0xedff('0x2c')]=_['keys'](db['ZendeskField'][_0xedff('0x29')]);_0x53eaad[_0xedff('0x2e')]=_[_0xedff('0x43')](_0x746f7b[_0xedff('0x2e')]);_0x53eaad[_0xedff('0x2f')]=_[_0xedff('0x30')](_0x53eaad['model'],_0x53eaad['query']);_0x33f09d[_0xedff('0x31')]=_['intersection'](_0x53eaad[_0xedff('0x2c')],qs[_0xedff('0x32')](_0x746f7b[_0xedff('0x2e')]['fields']));_0x33f09d[_0xedff('0x31')]=_0x33f09d['attributes']['length']?_0x33f09d[_0xedff('0x31')]:_0x53eaad[_0xedff('0x2c')];_0x33f09d[_0xedff('0x36')]=qs[_0xedff('0x37')](_0x746f7b[_0xedff('0x2e')][_0xedff('0x37')]);_0x33f09d[_0xedff('0x3a')]=qs[_0xedff('0x2f')](_[_0xedff('0x38')](_0x746f7b[_0xedff('0x2e')],_0x53eaad[_0xedff('0x2f')]));if(_0x746f7b[_0xedff('0x2e')][_0xedff('0x3d')]){_0x33f09d[_0xedff('0x3a')]=_['merge'](_0x33f09d[_0xedff('0x3a')],{'$or':_['map'](_0x33f09d[_0xedff('0x31')],function(_0x50b752){var _0x3f444b={};_0x3f444b[_0x50b752]={'$like':'%'+_0x746f7b[_0xedff('0x2e')][_0xedff('0x3d')]+'%'};return _0x3f444b;})});}_0x33f09d=_[_0xedff('0x39')]({},_0x33f09d,_0x746f7b[_0xedff('0x44')]);return _0x54009a[_0xedff('0x49')](_0x33f09d);}})['then'](function(_0x11b592){if(_0x11b592){_0x543219=_0x11b592[_0xedff('0x33')];if(!_0x746f7b[_0xedff('0x2e')][_0xedff('0x34')]('nolimit')){_0x33f09d[_0xedff('0x1d')]=qs[_0xedff('0x1d')](_0x746f7b['query']['limit']);_0x33f09d['offset']=qs[_0xedff('0x1b')](_0x746f7b[_0xedff('0x2e')][_0xedff('0x1b')]);}return _0x54009a[_0xedff('0x49')](_0x33f09d);}})[_0xedff('0x23')](function(_0x18db70){if(_0x18db70){return _0x18db70?{'count':_0x543219,'rows':_0x18db70}:null;}})['then'](respondWithResult(_0xc3b161,null))[_0xedff('0x41')](handleError(_0xc3b161,null));};exports[_0xedff('0x4a')]=function(_0xdb9bfa,_0x403191,_0x94fab7){var _0x22b2e1={};var _0x5313cb={};var _0x533955;var _0xbdf519;return db[_0xedff('0x45')]['findOne']({'where':{'id':_0xdb9bfa[_0xedff('0x42')]['id']}})['then'](handleEntityNotFound(_0x403191,null))[_0xedff('0x23')](function(_0x4e7f34){if(_0x4e7f34){_0x533955=_0x4e7f34;_0x5313cb[_0xedff('0x2c')]=_['keys'](db[_0xedff('0x4b')][_0xedff('0x29')]);_0x5313cb['query']=_[_0xedff('0x43')](_0xdb9bfa[_0xedff('0x2e')]);_0x5313cb[_0xedff('0x2f')]=_[_0xedff('0x30')](_0x5313cb[_0xedff('0x2c')],_0x5313cb[_0xedff('0x2e')]);_0x22b2e1[_0xedff('0x31')]=_['intersection'](_0x5313cb[_0xedff('0x2c')],qs[_0xedff('0x32')](_0xdb9bfa[_0xedff('0x2e')][_0xedff('0x32')]));_0x22b2e1['attributes']=_0x22b2e1[_0xedff('0x31')]['length']?_0x22b2e1[_0xedff('0x31')]:_0x5313cb['model'];_0x22b2e1[_0xedff('0x36')]=qs[_0xedff('0x37')](_0xdb9bfa[_0xedff('0x2e')]['sort']);_0x22b2e1['where']=qs[_0xedff('0x2f')](_[_0xedff('0x38')](_0xdb9bfa[_0xedff('0x2e')],_0x5313cb[_0xedff('0x2f')]));if(_0xdb9bfa[_0xedff('0x2e')][_0xedff('0x3d')]){_0x22b2e1[_0xedff('0x3a')]=_[_0xedff('0x39')](_0x22b2e1[_0xedff('0x3a')],{'$or':_[_0xedff('0x2d')](_0x22b2e1['attributes'],function(_0x4d389b){var _0x2d7a3d={};_0x2d7a3d[_0x4d389b]={'$like':'%'+_0xdb9bfa[_0xedff('0x2e')]['filter']+'%'};return _0x2d7a3d;})});}_0x22b2e1=_[_0xedff('0x39')]({},_0x22b2e1,_0xdb9bfa[_0xedff('0x44')]);return _0x533955['getSubjects'](_0x22b2e1);}})[_0xedff('0x23')](function(_0x301b42){if(_0x301b42){_0xbdf519=_0x301b42[_0xedff('0x33')];if(!_0xdb9bfa[_0xedff('0x2e')]['hasOwnProperty']('nolimit')){_0x22b2e1[_0xedff('0x1d')]=qs['limit'](_0xdb9bfa['query'][_0xedff('0x1d')]);_0x22b2e1[_0xedff('0x1b')]=qs['offset'](_0xdb9bfa['query'][_0xedff('0x1b')]);}return _0x533955[_0xedff('0x4a')](_0x22b2e1);}})[_0xedff('0x23')](function(_0x2e7e67){if(_0x2e7e67){return _0x2e7e67?{'count':_0xbdf519,'rows':_0x2e7e67}:null;}})[_0xedff('0x23')](respondWithResult(_0x403191,null))[_0xedff('0x41')](handleError(_0x403191,null));};exports[_0xedff('0x4c')]=function(_0x297a88,_0x48a624,_0x4be59f){var _0x2fdddc={};var _0x239875={};var _0x51cff7;var _0x162a0e;return db[_0xedff('0x45')][_0xedff('0x4d')]({'where':{'id':_0x297a88['params']['id']}})[_0xedff('0x23')](handleEntityNotFound(_0x48a624,null))[_0xedff('0x23')](function(_0x4246bb){if(_0x4246bb){_0x51cff7=_0x4246bb;_0x239875[_0xedff('0x2c')]=_[_0xedff('0x43')](db[_0xedff('0x4b')][_0xedff('0x29')]);_0x239875[_0xedff('0x2e')]=_['keys'](_0x297a88['query']);_0x239875[_0xedff('0x2f')]=_['intersection'](_0x239875['model'],_0x239875['query']);_0x2fdddc['attributes']=_[_0xedff('0x30')](_0x239875[_0xedff('0x2c')],qs['fields'](_0x297a88[_0xedff('0x2e')][_0xedff('0x32')]));_0x2fdddc[_0xedff('0x31')]=_0x2fdddc[_0xedff('0x31')][_0xedff('0x33')]?_0x2fdddc[_0xedff('0x31')]:_0x239875[_0xedff('0x2c')];_0x2fdddc[_0xedff('0x36')]=qs[_0xedff('0x37')](_0x297a88[_0xedff('0x2e')][_0xedff('0x37')]);_0x2fdddc[_0xedff('0x3a')]=qs[_0xedff('0x2f')](_[_0xedff('0x38')](_0x297a88[_0xedff('0x2e')],_0x239875[_0xedff('0x2f')]));if(_0x297a88[_0xedff('0x2e')][_0xedff('0x3d')]){_0x2fdddc[_0xedff('0x3a')]=_['merge'](_0x2fdddc[_0xedff('0x3a')],{'$or':_['map'](_0x2fdddc['attributes'],function(_0x3125a0){var _0x1ad6ce={};_0x1ad6ce[_0x3125a0]={'$like':'%'+_0x297a88[_0xedff('0x2e')][_0xedff('0x3d')]+'%'};return _0x1ad6ce;})});}_0x2fdddc=_[_0xedff('0x39')]({},_0x2fdddc,_0x297a88['options']);return _0x51cff7[_0xedff('0x4c')](_0x2fdddc);}})['then'](function(_0x432cc0){if(_0x432cc0){_0x162a0e=_0x432cc0[_0xedff('0x33')];if(!_0x297a88[_0xedff('0x2e')][_0xedff('0x34')](_0xedff('0x35'))){_0x2fdddc[_0xedff('0x1d')]=qs[_0xedff('0x1d')](_0x297a88[_0xedff('0x2e')][_0xedff('0x1d')]);_0x2fdddc[_0xedff('0x1b')]=qs['offset'](_0x297a88[_0xedff('0x2e')][_0xedff('0x1b')]);}return _0x51cff7['getDescriptions'](_0x2fdddc);}})['then'](function(_0xeb713f){if(_0xeb713f){return _0xeb713f?{'count':_0x162a0e,'rows':_0xeb713f}:null;}})[_0xedff('0x23')](respondWithResult(_0x48a624,null))[_0xedff('0x41')](handleError(_0x48a624,null));};exports[_0xedff('0x4e')]=function(_0x48c768,_0x3963e5,_0x1c270f){var _0x48ce29={};var _0x20857e={};var _0x591595;var _0x357425;return db[_0xedff('0x45')][_0xedff('0x4d')]({'where':{'id':_0x48c768['params']['id']}})['then'](handleEntityNotFound(_0x3963e5,null))['then'](function(_0x34654b){if(_0x34654b){_0x591595=_0x34654b;_0x20857e[_0xedff('0x2c')]=_[_0xedff('0x43')](db[_0xedff('0x4f')][_0xedff('0x29')]);_0x20857e[_0xedff('0x2e')]=_['keys'](_0x48c768[_0xedff('0x2e')]);_0x20857e[_0xedff('0x2f')]=_[_0xedff('0x30')](_0x20857e[_0xedff('0x2c')],_0x20857e['query']);_0x48ce29[_0xedff('0x31')]=_[_0xedff('0x30')](_0x20857e[_0xedff('0x2c')],qs['fields'](_0x48c768[_0xedff('0x2e')][_0xedff('0x32')]));_0x48ce29['attributes']=_0x48ce29[_0xedff('0x31')][_0xedff('0x33')]?_0x48ce29[_0xedff('0x31')]:_0x20857e['model'];_0x48ce29[_0xedff('0x36')]=qs[_0xedff('0x37')](_0x48c768['query'][_0xedff('0x37')]);_0x48ce29[_0xedff('0x3a')]=qs[_0xedff('0x2f')](_[_0xedff('0x38')](_0x48c768['query'],_0x20857e['filters']));if(_0x48c768[_0xedff('0x2e')][_0xedff('0x3d')]){_0x48ce29['where']=_[_0xedff('0x39')](_0x48ce29[_0xedff('0x3a')],{'$or':_[_0xedff('0x2d')](_0x48ce29[_0xedff('0x31')],function(_0x157656){var _0x40e7a6={};_0x40e7a6[_0x157656]={'$like':'%'+_0x48c768[_0xedff('0x2e')]['filter']+'%'};return _0x40e7a6;})});}_0x48ce29=_['merge']({},_0x48ce29,_0x48c768['options']);return _0x591595[_0xedff('0x4e')](_0x48ce29);}})[_0xedff('0x23')](function(_0x31002c){if(_0x31002c){_0x357425=_0x31002c[_0xedff('0x33')];if(!_0x48c768[_0xedff('0x2e')][_0xedff('0x34')](_0xedff('0x35'))){_0x48ce29['limit']=qs[_0xedff('0x1d')](_0x48c768[_0xedff('0x2e')][_0xedff('0x1d')]);_0x48ce29[_0xedff('0x1b')]=qs[_0xedff('0x1b')](_0x48c768[_0xedff('0x2e')][_0xedff('0x1b')]);}return _0x591595[_0xedff('0x4e')](_0x48ce29);}})[_0xedff('0x23')](function(_0x262a7a){if(_0x262a7a){return _0x262a7a?{'count':_0x357425,'rows':_0x262a7a}:null;}})['then'](respondWithResult(_0x3963e5,null))[_0xedff('0x41')](handleError(_0x3963e5,null));};exports[_0xedff('0x50')]=function(_0x179955,_0x248165,_0x533f2d){if(_0x179955['body']['id']){delete _0x179955[_0xedff('0x47')]['id'];}return db[_0xedff('0x45')][_0xedff('0x4d')]({'where':{'id':_0x179955[_0xedff('0x42')]['id']}})[_0xedff('0x23')](handleEntityNotFound(_0x248165,null))[_0xedff('0x23')](function(_0xefa070){if(_0xefa070){return _0xefa070[_0xedff('0x50')](_0x179955['body'][_0xedff('0x51')]||[]);}return null;})[_0xedff('0x23')](respondWithResult(_0x248165,null))[_0xedff('0x41')](handleError(_0x248165,null));}; \ No newline at end of file +var _0x69a7=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','params','length','body','find','getFields','ZendeskField','order','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xab5395,_0x364cdf){var _0xf62b05=function(_0x34906b){while(--_0x34906b){_0xab5395['push'](_0xab5395['shift']());}};_0xf62b05(++_0x364cdf);}(_0x69a7,0x8e));var _0x769a=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x69a7[_0x1e91eb];return _0x2af75a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x769a('0x0'));var zipdir=require(_0x769a('0x1'));var jsonpatch=require(_0x769a('0x2'));var rp=require(_0x769a('0x3'));var moment=require(_0x769a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x769a('0x5'));var path=require(_0x769a('0x6'));var sox=require(_0x769a('0x7'));var csv=require('to-csv');var ejs=require(_0x769a('0x8'));var fs=require('fs');var fs_extra=require(_0x769a('0x9'));var _=require(_0x769a('0xa'));var squel=require(_0x769a('0xb'));var crypto=require(_0x769a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x769a('0xd'));var querystring=require(_0x769a('0xe'));var Papa=require(_0x769a('0xf'));var Redis=require('ioredis');var authService=require(_0x769a('0x10'));var qs=require(_0x769a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x769a('0x12'));var logger=require(_0x769a('0x13'))(_0x769a('0x14'));var utils=require(_0x769a('0x15'));var config=require(_0x769a('0x16'));var licenseUtil=require(_0x769a('0x17'));var db=require(_0x769a('0x18'))['db'];function respondWithStatusCode(_0x1f0a2e,_0x4c7047){_0x4c7047=_0x4c7047||0xcc;return function(_0xcb0870){if(_0xcb0870){return _0x1f0a2e[_0x769a('0x19')](_0x4c7047);}return _0x1f0a2e[_0x769a('0x1a')](_0x4c7047)[_0x769a('0x1b')]();};}function respondWithResult(_0x55ecb5,_0x557339){_0x557339=_0x557339||0xc8;return function(_0x2131a7){if(_0x2131a7){return _0x55ecb5['status'](_0x557339)['json'](_0x2131a7);}};}function respondWithFilteredResult(_0x353e80,_0xa70a21){return function(_0x174336){if(_0x174336){var _0xcf560c=typeof _0xa70a21[_0x769a('0x1c')]==='undefined'&&typeof _0xa70a21[_0x769a('0x1d')]===_0x769a('0x1e');var _0x3d2043=_0x174336[_0x769a('0x1f')];var _0x3bc447=_0xcf560c?0x0:_0xa70a21[_0x769a('0x1c')];var _0x2dc2ef=_0xcf560c?_0x174336[_0x769a('0x1f')]:_0xa70a21[_0x769a('0x1c')]+_0xa70a21[_0x769a('0x1d')];var _0x258845;if(_0x2dc2ef>=_0x3d2043){_0x2dc2ef=_0x3d2043;_0x258845=0xc8;}else{_0x258845=0xce;}_0x353e80['status'](_0x258845);return _0x353e80[_0x769a('0x20')](_0x769a('0x21'),_0x3bc447+'-'+_0x2dc2ef+'/'+_0x3d2043)[_0x769a('0x22')](_0x174336);}return null;};}function patchUpdates(_0x479afc){return function(_0x21bf2d){try{jsonpatch[_0x769a('0x23')](_0x21bf2d,_0x479afc,!![]);}catch(_0x52952a){return BPromise[_0x769a('0x24')](_0x52952a);}return _0x21bf2d['save']();};}function saveUpdates(_0x348665,_0x47d272){return function(_0x3d66ad){if(_0x3d66ad){return _0x3d66ad[_0x769a('0x25')](_0x348665)[_0x769a('0x26')](function(_0x1a420c){return _0x1a420c;});}return null;};}function removeEntity(_0x10e6a4,_0x44b106){return function(_0x3c4c47){if(_0x3c4c47){return _0x3c4c47[_0x769a('0x27')]()[_0x769a('0x26')](function(){_0x10e6a4['status'](0xcc)[_0x769a('0x1b')]();});}};}function handleEntityNotFound(_0x2a2795,_0x362a0d){return function(_0x4b47f6){if(!_0x4b47f6){_0x2a2795[_0x769a('0x19')](0x194);}return _0x4b47f6;};}function handleError(_0xc42841,_0x2cc24a){_0x2cc24a=_0x2cc24a||0x1f4;return function(_0x25ce0c){logger[_0x769a('0x28')](_0x25ce0c[_0x769a('0x29')]);if(_0x25ce0c[_0x769a('0x2a')]){delete _0x25ce0c[_0x769a('0x2a')];}_0xc42841[_0x769a('0x1a')](_0x2cc24a)[_0x769a('0x2b')](_0x25ce0c);};}exports['index']=function(_0x3094ff,_0x580a75){var _0x4d1cb6={},_0x41bff1={},_0x2226f4={'count':0x0,'rows':[]};var _0x452bce=_[_0x769a('0x2c')](db[_0x769a('0x2d')][_0x769a('0x2e')],function(_0x2397e0){return{'name':_0x2397e0[_0x769a('0x2f')],'type':_0x2397e0[_0x769a('0x30')][_0x769a('0x31')]};});_0x41bff1[_0x769a('0x32')]=_[_0x769a('0x2c')](_0x452bce,_0x769a('0x2a'));_0x41bff1['query']=_[_0x769a('0x33')](_0x3094ff[_0x769a('0x34')]);_0x41bff1[_0x769a('0x35')]=_[_0x769a('0x36')](_0x41bff1[_0x769a('0x32')],_0x41bff1['query']);_0x4d1cb6[_0x769a('0x37')]=_[_0x769a('0x36')](_0x41bff1[_0x769a('0x32')],qs[_0x769a('0x38')](_0x3094ff[_0x769a('0x34')][_0x769a('0x38')]));_0x4d1cb6[_0x769a('0x37')]=_0x4d1cb6[_0x769a('0x37')]['length']?_0x4d1cb6[_0x769a('0x37')]:_0x41bff1[_0x769a('0x32')];if(!_0x3094ff['query'][_0x769a('0x39')]('nolimit')){_0x4d1cb6[_0x769a('0x1d')]=qs[_0x769a('0x1d')](_0x3094ff[_0x769a('0x34')]['limit']);_0x4d1cb6[_0x769a('0x1c')]=qs[_0x769a('0x1c')](_0x3094ff['query'][_0x769a('0x1c')]);}_0x4d1cb6['order']=qs['sort'](_0x3094ff[_0x769a('0x34')][_0x769a('0x3a')]);_0x4d1cb6['where']=qs['filters'](_[_0x769a('0x3b')](_0x3094ff[_0x769a('0x34')],_0x41bff1[_0x769a('0x35')]),_0x452bce);if(_0x3094ff[_0x769a('0x34')][_0x769a('0x3c')]){_0x4d1cb6['where']=_[_0x769a('0x3d')](_0x4d1cb6[_0x769a('0x3e')],{'$or':_[_0x769a('0x2c')](_0x452bce,function(_0x49caef){if(_0x49caef[_0x769a('0x30')]!=='VIRTUAL'){var _0x48d7b3={};_0x48d7b3[_0x49caef[_0x769a('0x2a')]]={'$like':'%'+_0x3094ff[_0x769a('0x34')]['filter']+'%'};return _0x48d7b3;}})});}_0x4d1cb6=_[_0x769a('0x3d')]({},_0x4d1cb6,_0x3094ff[_0x769a('0x3f')]);var _0x44bed9={'where':_0x4d1cb6[_0x769a('0x3e')]};return db['ZendeskConfiguration'][_0x769a('0x1f')](_0x44bed9)[_0x769a('0x26')](function(_0x1f8bcb){_0x2226f4['count']=_0x1f8bcb;if(_0x3094ff[_0x769a('0x34')][_0x769a('0x40')]){_0x4d1cb6[_0x769a('0x41')]=[{'all':!![]}];}return db[_0x769a('0x2d')][_0x769a('0x42')](_0x4d1cb6);})[_0x769a('0x26')](function(_0x4ab827){_0x2226f4[_0x769a('0x43')]=_0x4ab827;return _0x2226f4;})[_0x769a('0x26')](respondWithFilteredResult(_0x580a75,_0x4d1cb6))[_0x769a('0x44')](handleError(_0x580a75,null));};exports['show']=function(_0x1e872c,_0x57be9a){var _0x5db8a1={'raw':![],'where':{'id':_0x1e872c[_0x769a('0x45')]['id']}},_0x55edd0={};_0x55edd0[_0x769a('0x32')]=_['keys'](db[_0x769a('0x2d')][_0x769a('0x2e')]);_0x55edd0['query']=_[_0x769a('0x33')](_0x1e872c['query']);_0x55edd0[_0x769a('0x35')]=_['intersection'](_0x55edd0[_0x769a('0x32')],_0x55edd0[_0x769a('0x34')]);_0x5db8a1[_0x769a('0x37')]=_[_0x769a('0x36')](_0x55edd0[_0x769a('0x32')],qs[_0x769a('0x38')](_0x1e872c[_0x769a('0x34')][_0x769a('0x38')]));_0x5db8a1[_0x769a('0x37')]=_0x5db8a1[_0x769a('0x37')][_0x769a('0x46')]?_0x5db8a1[_0x769a('0x37')]:_0x55edd0[_0x769a('0x32')];if(_0x1e872c['query'][_0x769a('0x40')]){_0x5db8a1[_0x769a('0x41')]=[{'all':!![]}];}_0x5db8a1=_[_0x769a('0x3d')]({},_0x5db8a1,_0x1e872c[_0x769a('0x3f')]);return db['ZendeskConfiguration']['find'](_0x5db8a1)[_0x769a('0x26')](handleEntityNotFound(_0x57be9a,null))[_0x769a('0x26')](respondWithResult(_0x57be9a,null))[_0x769a('0x44')](handleError(_0x57be9a,null));};exports['create']=function(_0x5e54c2,_0x424cf2){return db[_0x769a('0x2d')]['create'](_0x5e54c2[_0x769a('0x47')],{})[_0x769a('0x26')](respondWithResult(_0x424cf2,0xc9))['catch'](handleError(_0x424cf2,null));};exports[_0x769a('0x25')]=function(_0x382c11,_0x51a652){if(_0x382c11[_0x769a('0x47')]['id']){delete _0x382c11[_0x769a('0x47')]['id'];}return db[_0x769a('0x2d')][_0x769a('0x48')]({'where':{'id':_0x382c11[_0x769a('0x45')]['id']}})[_0x769a('0x26')](handleEntityNotFound(_0x51a652,null))[_0x769a('0x26')](saveUpdates(_0x382c11[_0x769a('0x47')],null))[_0x769a('0x26')](respondWithResult(_0x51a652,null))[_0x769a('0x44')](handleError(_0x51a652,null));};exports[_0x769a('0x27')]=function(_0x29f3c2,_0x20581a){return db[_0x769a('0x2d')][_0x769a('0x48')]({'where':{'id':_0x29f3c2[_0x769a('0x45')]['id']}})[_0x769a('0x26')](handleEntityNotFound(_0x20581a,null))[_0x769a('0x26')](removeEntity(_0x20581a,null))['catch'](handleError(_0x20581a,null));};exports[_0x769a('0x49')]=function(_0x25183e,_0x1bb5b4,_0x441cad){var _0x57fd65={};var _0x3cf334={};var _0x7fe40b;var _0x1b486f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x25183e[_0x769a('0x45')]['id']}})[_0x769a('0x26')](handleEntityNotFound(_0x1bb5b4,null))[_0x769a('0x26')](function(_0x5e7113){if(_0x5e7113){_0x7fe40b=_0x5e7113;_0x3cf334[_0x769a('0x32')]=_[_0x769a('0x33')](db[_0x769a('0x4a')][_0x769a('0x2e')]);_0x3cf334[_0x769a('0x34')]=_[_0x769a('0x33')](_0x25183e[_0x769a('0x34')]);_0x3cf334[_0x769a('0x35')]=_[_0x769a('0x36')](_0x3cf334['model'],_0x3cf334[_0x769a('0x34')]);_0x57fd65['attributes']=_[_0x769a('0x36')](_0x3cf334['model'],qs[_0x769a('0x38')](_0x25183e[_0x769a('0x34')]['fields']));_0x57fd65[_0x769a('0x37')]=_0x57fd65['attributes']['length']?_0x57fd65['attributes']:_0x3cf334[_0x769a('0x32')];_0x57fd65[_0x769a('0x4b')]=qs[_0x769a('0x3a')](_0x25183e[_0x769a('0x34')][_0x769a('0x3a')]);_0x57fd65['where']=qs[_0x769a('0x35')](_[_0x769a('0x3b')](_0x25183e['query'],_0x3cf334[_0x769a('0x35')]));if(_0x25183e[_0x769a('0x34')][_0x769a('0x3c')]){_0x57fd65['where']=_[_0x769a('0x3d')](_0x57fd65['where'],{'$or':_[_0x769a('0x2c')](_0x57fd65['attributes'],function(_0x262a91){var _0x102e39={};_0x102e39[_0x262a91]={'$like':'%'+_0x25183e['query'][_0x769a('0x3c')]+'%'};return _0x102e39;})});}_0x57fd65=_[_0x769a('0x3d')]({},_0x57fd65,_0x25183e[_0x769a('0x3f')]);return _0x7fe40b[_0x769a('0x49')](_0x57fd65);}})[_0x769a('0x26')](function(_0x1b0913){if(_0x1b0913){_0x1b486f=_0x1b0913['length'];if(!_0x25183e[_0x769a('0x34')][_0x769a('0x39')](_0x769a('0x4c'))){_0x57fd65[_0x769a('0x1d')]=qs['limit'](_0x25183e[_0x769a('0x34')]['limit']);_0x57fd65[_0x769a('0x1c')]=qs[_0x769a('0x1c')](_0x25183e[_0x769a('0x34')]['offset']);}return _0x7fe40b[_0x769a('0x49')](_0x57fd65);}})[_0x769a('0x26')](function(_0x116af0){if(_0x116af0){return _0x116af0?{'count':_0x1b486f,'rows':_0x116af0}:null;}})[_0x769a('0x26')](respondWithResult(_0x1bb5b4,null))[_0x769a('0x44')](handleError(_0x1bb5b4,null));};exports[_0x769a('0x4d')]=function(_0x2eb88e,_0x140e55,_0x2c425e){var _0x278c63={};var _0x4ec795={};var _0x2a7141;var _0x49a331;return db[_0x769a('0x2d')][_0x769a('0x4e')]({'where':{'id':_0x2eb88e[_0x769a('0x45')]['id']}})[_0x769a('0x26')](handleEntityNotFound(_0x140e55,null))[_0x769a('0x26')](function(_0x47f81d){if(_0x47f81d){_0x2a7141=_0x47f81d;_0x4ec795[_0x769a('0x32')]=_[_0x769a('0x33')](db[_0x769a('0x4a')][_0x769a('0x2e')]);_0x4ec795[_0x769a('0x34')]=_[_0x769a('0x33')](_0x2eb88e[_0x769a('0x34')]);_0x4ec795['filters']=_['intersection'](_0x4ec795[_0x769a('0x32')],_0x4ec795[_0x769a('0x34')]);_0x278c63[_0x769a('0x37')]=_['intersection'](_0x4ec795['model'],qs['fields'](_0x2eb88e[_0x769a('0x34')][_0x769a('0x38')]));_0x278c63[_0x769a('0x37')]=_0x278c63[_0x769a('0x37')]['length']?_0x278c63[_0x769a('0x37')]:_0x4ec795[_0x769a('0x32')];_0x278c63[_0x769a('0x4b')]=qs[_0x769a('0x3a')](_0x2eb88e[_0x769a('0x34')][_0x769a('0x3a')]);_0x278c63[_0x769a('0x3e')]=qs[_0x769a('0x35')](_[_0x769a('0x3b')](_0x2eb88e[_0x769a('0x34')],_0x4ec795[_0x769a('0x35')]));if(_0x2eb88e['query']['filter']){_0x278c63[_0x769a('0x3e')]=_['merge'](_0x278c63['where'],{'$or':_[_0x769a('0x2c')](_0x278c63['attributes'],function(_0x2316d3){var _0x19866d={};_0x19866d[_0x2316d3]={'$like':'%'+_0x2eb88e[_0x769a('0x34')][_0x769a('0x3c')]+'%'};return _0x19866d;})});}_0x278c63=_[_0x769a('0x3d')]({},_0x278c63,_0x2eb88e[_0x769a('0x3f')]);return _0x2a7141[_0x769a('0x4d')](_0x278c63);}})[_0x769a('0x26')](function(_0x326bd1){if(_0x326bd1){_0x49a331=_0x326bd1[_0x769a('0x46')];if(!_0x2eb88e[_0x769a('0x34')][_0x769a('0x39')](_0x769a('0x4c'))){_0x278c63[_0x769a('0x1d')]=qs[_0x769a('0x1d')](_0x2eb88e['query']['limit']);_0x278c63[_0x769a('0x1c')]=qs[_0x769a('0x1c')](_0x2eb88e['query'][_0x769a('0x1c')]);}return _0x2a7141[_0x769a('0x4d')](_0x278c63);}})['then'](function(_0x18a95f){if(_0x18a95f){return _0x18a95f?{'count':_0x49a331,'rows':_0x18a95f}:null;}})[_0x769a('0x26')](respondWithResult(_0x140e55,null))[_0x769a('0x44')](handleError(_0x140e55,null));};exports[_0x769a('0x4f')]=function(_0x385215,_0x458afe,_0x59166c){var _0x4bc808={};var _0x1b545b={};var _0x4b754f;var _0x5d1a61;return db[_0x769a('0x2d')]['findOne']({'where':{'id':_0x385215['params']['id']}})[_0x769a('0x26')](handleEntityNotFound(_0x458afe,null))['then'](function(_0x2f8c84){if(_0x2f8c84){_0x4b754f=_0x2f8c84;_0x1b545b[_0x769a('0x32')]=_[_0x769a('0x33')](db[_0x769a('0x4a')][_0x769a('0x2e')]);_0x1b545b[_0x769a('0x34')]=_['keys'](_0x385215['query']);_0x1b545b[_0x769a('0x35')]=_[_0x769a('0x36')](_0x1b545b[_0x769a('0x32')],_0x1b545b[_0x769a('0x34')]);_0x4bc808['attributes']=_[_0x769a('0x36')](_0x1b545b['model'],qs['fields'](_0x385215[_0x769a('0x34')][_0x769a('0x38')]));_0x4bc808[_0x769a('0x37')]=_0x4bc808[_0x769a('0x37')][_0x769a('0x46')]?_0x4bc808[_0x769a('0x37')]:_0x1b545b[_0x769a('0x32')];_0x4bc808[_0x769a('0x4b')]=qs[_0x769a('0x3a')](_0x385215[_0x769a('0x34')][_0x769a('0x3a')]);_0x4bc808[_0x769a('0x3e')]=qs[_0x769a('0x35')](_['pick'](_0x385215['query'],_0x1b545b[_0x769a('0x35')]));if(_0x385215['query']['filter']){_0x4bc808[_0x769a('0x3e')]=_[_0x769a('0x3d')](_0x4bc808['where'],{'$or':_[_0x769a('0x2c')](_0x4bc808[_0x769a('0x37')],function(_0x3cd0fc){var _0x3389a2={};_0x3389a2[_0x3cd0fc]={'$like':'%'+_0x385215[_0x769a('0x34')][_0x769a('0x3c')]+'%'};return _0x3389a2;})});}_0x4bc808=_['merge']({},_0x4bc808,_0x385215[_0x769a('0x3f')]);return _0x4b754f['getDescriptions'](_0x4bc808);}})[_0x769a('0x26')](function(_0x56690e){if(_0x56690e){_0x5d1a61=_0x56690e[_0x769a('0x46')];if(!_0x385215[_0x769a('0x34')][_0x769a('0x39')](_0x769a('0x4c'))){_0x4bc808[_0x769a('0x1d')]=qs[_0x769a('0x1d')](_0x385215[_0x769a('0x34')][_0x769a('0x1d')]);_0x4bc808[_0x769a('0x1c')]=qs['offset'](_0x385215[_0x769a('0x34')][_0x769a('0x1c')]);}return _0x4b754f[_0x769a('0x4f')](_0x4bc808);}})[_0x769a('0x26')](function(_0xad5d67){if(_0xad5d67){return _0xad5d67?{'count':_0x5d1a61,'rows':_0xad5d67}:null;}})[_0x769a('0x26')](respondWithResult(_0x458afe,null))[_0x769a('0x44')](handleError(_0x458afe,null));};exports[_0x769a('0x50')]=function(_0x53d23e,_0x4abe60,_0x3dfead){var _0x567cda={};var _0x54b5ab={};var _0x165aba;var _0x169566;return db[_0x769a('0x2d')]['findOne']({'where':{'id':_0x53d23e[_0x769a('0x45')]['id']}})['then'](handleEntityNotFound(_0x4abe60,null))[_0x769a('0x26')](function(_0x18d038){if(_0x18d038){_0x165aba=_0x18d038;_0x54b5ab[_0x769a('0x32')]=_['keys'](db['Tag'][_0x769a('0x2e')]);_0x54b5ab[_0x769a('0x34')]=_['keys'](_0x53d23e[_0x769a('0x34')]);_0x54b5ab[_0x769a('0x35')]=_[_0x769a('0x36')](_0x54b5ab[_0x769a('0x32')],_0x54b5ab[_0x769a('0x34')]);_0x567cda[_0x769a('0x37')]=_[_0x769a('0x36')](_0x54b5ab['model'],qs[_0x769a('0x38')](_0x53d23e[_0x769a('0x34')][_0x769a('0x38')]));_0x567cda[_0x769a('0x37')]=_0x567cda[_0x769a('0x37')][_0x769a('0x46')]?_0x567cda[_0x769a('0x37')]:_0x54b5ab[_0x769a('0x32')];_0x567cda['order']=qs[_0x769a('0x3a')](_0x53d23e[_0x769a('0x34')][_0x769a('0x3a')]);_0x567cda[_0x769a('0x3e')]=qs['filters'](_[_0x769a('0x3b')](_0x53d23e[_0x769a('0x34')],_0x54b5ab['filters']));if(_0x53d23e['query'][_0x769a('0x3c')]){_0x567cda[_0x769a('0x3e')]=_[_0x769a('0x3d')](_0x567cda[_0x769a('0x3e')],{'$or':_[_0x769a('0x2c')](_0x567cda['attributes'],function(_0xba6bd7){var _0x58738c={};_0x58738c[_0xba6bd7]={'$like':'%'+_0x53d23e['query'][_0x769a('0x3c')]+'%'};return _0x58738c;})});}_0x567cda=_[_0x769a('0x3d')]({},_0x567cda,_0x53d23e['options']);return _0x165aba[_0x769a('0x50')](_0x567cda);}})[_0x769a('0x26')](function(_0x264551){if(_0x264551){_0x169566=_0x264551[_0x769a('0x46')];if(!_0x53d23e[_0x769a('0x34')][_0x769a('0x39')](_0x769a('0x4c'))){_0x567cda[_0x769a('0x1d')]=qs[_0x769a('0x1d')](_0x53d23e[_0x769a('0x34')][_0x769a('0x1d')]);_0x567cda[_0x769a('0x1c')]=qs[_0x769a('0x1c')](_0x53d23e['query']['offset']);}return _0x165aba[_0x769a('0x50')](_0x567cda);}})['then'](function(_0x3f3c26){if(_0x3f3c26){return _0x3f3c26?{'count':_0x169566,'rows':_0x3f3c26}:null;}})['then'](respondWithResult(_0x4abe60,null))[_0x769a('0x44')](handleError(_0x4abe60,null));};exports['setTags']=function(_0x396fde,_0x456ff3,_0x1597bc){if(_0x396fde[_0x769a('0x47')]['id']){delete _0x396fde[_0x769a('0x47')]['id'];}return db[_0x769a('0x2d')]['findOne']({'where':{'id':_0x396fde[_0x769a('0x45')]['id']}})[_0x769a('0x26')](handleEntityNotFound(_0x456ff3,null))['then'](function(_0x51ecf5){if(_0x51ecf5){return _0x51ecf5[_0x769a('0x51')](_0x396fde[_0x769a('0x47')]['ids']||[]);}return null;})[_0x769a('0x26')](respondWithResult(_0x456ff3,null))[_0x769a('0x44')](handleError(_0x456ff3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6162731..b1e90b4 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 _0xc900=['api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','../../config/logger'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xc900,0xb3));var _0x0c90=function(_0x174b77,_0x13ba2f){_0x174b77=_0x174b77-0x0;var _0x3ffd78=_0xc900[_0x174b77];return _0x3ffd78;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eba=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x3878d3,_0x82d360){var _0x4fc9ad=function(_0x3d620d){while(--_0x3d620d){_0x3878d3['push'](_0x3878d3['shift']());}};_0x4fc9ad(++_0x82d360);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0x1eba[_0x1a72b8];return _0x39f72d;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 020f9ad..55582ff 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 _0xd575=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xd575,0x81));var _0x5d57=function(_0x3b6d12,_0x59a8b3){_0x3b6d12=_0x3b6d12-0x0;var _0x361b27=_0xd575[_0x3b6d12];return _0x361b27;};'use strict';var _=require(_0x5d57('0x0'));var util=require(_0x5d57('0x1'));var moment=require(_0x5d57('0x2'));var BPromise=require(_0x5d57('0x3'));var rs=require(_0x5d57('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d57('0x5'))['db'];var utils=require(_0x5d57('0x6'));var logger=require(_0x5d57('0x7'))(_0x5d57('0x8'));var config=require(_0x5d57('0x9'));var jayson=require(_0x5d57('0xa'));var client=jayson[_0x5d57('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28e19a,_0x1b3f9a,_0x1a7111){return new BPromise(function(_0x13f28f,_0x262714){return client['request'](_0x28e19a,_0x1a7111)[_0x5d57('0xc')](function(_0x30c7c4){logger[_0x5d57('0xd')](_0x5d57('0xe'),_0x1b3f9a,_0x5d57('0xf'));logger[_0x5d57('0x10')](_0x5d57('0x11'),_0x1b3f9a,_0x5d57('0xf'),JSON[_0x5d57('0x12')](_0x30c7c4));if(_0x30c7c4['error']){if(_0x30c7c4['error'][_0x5d57('0x13')]===0x1f4){logger[_0x5d57('0x14')](_0x5d57('0xe'),_0x1b3f9a,_0x30c7c4[_0x5d57('0x14')]['message']);return _0x262714(_0x30c7c4['error'][_0x5d57('0x15')]);}logger['error'](_0x5d57('0xe'),_0x1b3f9a,_0x30c7c4[_0x5d57('0x14')][_0x5d57('0x15')]);return _0x13f28f(_0x30c7c4['error'][_0x5d57('0x15')]);}else{logger[_0x5d57('0xd')](_0x5d57('0xe'),_0x1b3f9a,_0x5d57('0xf'));_0x13f28f(_0x30c7c4[_0x5d57('0x16')][_0x5d57('0x15')]);}})[_0x5d57('0x17')](function(_0x3f6478){logger[_0x5d57('0x14')](_0x5d57('0xe'),_0x1b3f9a,_0x3f6478);_0x262714(_0x3f6478);});});} \ No newline at end of file +var _0x20ea=['jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1a3102,_0x31d050){var _0x45e398=function(_0x350250){while(--_0x350250){_0x1a3102['push'](_0x1a3102['shift']());}};_0x45e398(++_0x31d050);}(_0x20ea,0x1c2));var _0xa20e=function(_0x755d72,_0x52a145){_0x755d72=_0x755d72-0x0;var _0x37c3f8=_0x20ea[_0x755d72];return _0x37c3f8;};'use strict';var _=require(_0xa20e('0x0'));var util=require(_0xa20e('0x1'));var moment=require(_0xa20e('0x2'));var BPromise=require(_0xa20e('0x3'));var rs=require(_0xa20e('0x4'));var fs=require('fs');var Redis=require(_0xa20e('0x5'));var db=require(_0xa20e('0x6'))['db'];var utils=require(_0xa20e('0x7'));var logger=require(_0xa20e('0x8'))('rpc');var config=require(_0xa20e('0x9'));var jayson=require(_0xa20e('0xa'));var client=jayson[_0xa20e('0xb')][_0xa20e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e7345,_0x26983f,_0x38a923){return new BPromise(function(_0x2f221d,_0xe8076d){return client[_0xa20e('0xd')](_0x5e7345,_0x38a923)[_0xa20e('0xe')](function(_0x5338a0){logger[_0xa20e('0xf')](_0xa20e('0x10'),_0x26983f,'request\x20sent');logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x26983f,_0xa20e('0x11'),JSON['stringify'](_0x5338a0));if(_0x5338a0['error']){if(_0x5338a0[_0xa20e('0x12')][_0xa20e('0x13')]===0x1f4){logger[_0xa20e('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x26983f,_0x5338a0[_0xa20e('0x12')]['message']);return _0xe8076d(_0x5338a0[_0xa20e('0x12')][_0xa20e('0x14')]);}logger[_0xa20e('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x26983f,_0x5338a0[_0xa20e('0x12')][_0xa20e('0x14')]);return _0x2f221d(_0x5338a0['error']['message']);}else{logger[_0xa20e('0xf')](_0xa20e('0x10'),_0x26983f,'request\x20sent');_0x2f221d(_0x5338a0[_0xa20e('0x15')]['message']);}})[_0xa20e('0x16')](function(_0x5a7bed){logger[_0xa20e('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x26983f,_0x5a7bed);_0xe8076d(_0x5a7bed);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c609009..87fec34 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 _0x960c=['index','/:id','show','post','create','put','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x21001b,_0x3ff1a8){var _0x665a00=function(_0x98d912){while(--_0x98d912){_0x21001b['push'](_0x21001b['shift']());}};_0x665a00(++_0x3ff1a8);}(_0x960c,0x15b));var _0xc960=function(_0x52ccac,_0x453e2d){_0x52ccac=_0x52ccac-0x0;var _0x1bc03a=_0x960c[_0x52ccac];return _0x1bc03a;};'use strict';var multer=require(_0xc960('0x0'));var util=require('util');var path=require(_0xc960('0x1'));var timeout=require('connect-timeout');var express=require(_0xc960('0x2'));var router=express[_0xc960('0x3')]();var fs_extra=require(_0xc960('0x4'));var auth=require(_0xc960('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc960('0x6'));var controller=require(_0xc960('0x7'));router[_0xc960('0x8')]('/',auth[_0xc960('0x9')](),controller[_0xc960('0xa')]);router[_0xc960('0x8')](_0xc960('0xb'),auth['isAuthenticated'](),controller[_0xc960('0xc')]);router[_0xc960('0xd')]('/',auth[_0xc960('0x9')](),controller[_0xc960('0xe')]);router[_0xc960('0xf')](_0xc960('0xb'),auth[_0xc960('0x9')](),controller['update']);router['delete'](_0xc960('0xb'),auth[_0xc960('0x9')](),controller[_0xc960('0x10')]);module['exports']=router; \ No newline at end of file +var _0xccf6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','multer','util'];(function(_0x5ee39d,_0x549a1d){var _0x38bccb=function(_0x49d7f1){while(--_0x49d7f1){_0x5ee39d['push'](_0x5ee39d['shift']());}};_0x38bccb(++_0x549a1d);}(_0xccf6,0xb9));var _0x6ccf=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xccf6[_0x585d81];return _0x1aca0d;};'use strict';var multer=require(_0x6ccf('0x0'));var util=require(_0x6ccf('0x1'));var path=require('path');var timeout=require(_0x6ccf('0x2'));var express=require(_0x6ccf('0x3'));var router=express[_0x6ccf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ccf('0x5'));var interaction=require(_0x6ccf('0x6'));var config=require('../../config/environment');var controller=require(_0x6ccf('0x7'));router[_0x6ccf('0x8')]('/',auth[_0x6ccf('0x9')](),controller[_0x6ccf('0xa')]);router[_0x6ccf('0x8')](_0x6ccf('0xb'),auth[_0x6ccf('0x9')](),controller[_0x6ccf('0xc')]);router['post']('/',auth[_0x6ccf('0x9')](),controller[_0x6ccf('0xd')]);router['put'](_0x6ccf('0xb'),auth['isAuthenticated'](),controller[_0x6ccf('0xe')]);router[_0x6ccf('0xf')](_0x6ccf('0xb'),auth[_0x6ccf('0x9')](),controller[_0x6ccf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0ad4192..d319472 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 _0xdedd=['variable','customVariable','keyValue','picklist','STRING','ENUM','sequelize','exports','string'];(function(_0x149c45,_0x444a72){var _0x46d437=function(_0x2f5531){while(--_0x2f5531){_0x149c45['push'](_0x149c45['shift']());}};_0x46d437(++_0x444a72);}(_0xdedd,0xa8));var _0xdded=function(_0x5e01e4,_0x2b7725){_0x5e01e4=_0x5e01e4-0x0;var _0x531513=_0xdedd[_0x5e01e4];return _0x531513;};'use strict';var Sequelize=require(_0xdded('0x0'));module[_0xdded('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdded('0x2'),_0xdded('0x3'),_0xdded('0x4'),_0xdded('0x5'),_0xdded('0x6')),'defaultValue':_0xdded('0x2')},'content':{'type':Sequelize[_0xdded('0x7')]},'key':{'type':Sequelize[_0xdded('0x7')]},'keyType':{'type':Sequelize[_0xdded('0x8')]('string','variable',_0xdded('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdded('0x7')]},'nameField':{'type':Sequelize[_0xdded('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdded('0x7')]}}; \ No newline at end of file +var _0xc861=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0xc861,0x13d));var _0x1c86=function(_0x14310b,_0x4a82ba){_0x14310b=_0x14310b-0x0;var _0x128188=_0xc861[_0x14310b];return _0x128188;};'use strict';var Sequelize=require('sequelize');module[_0x1c86('0x0')]={'type':{'type':Sequelize[_0x1c86('0x1')](_0x1c86('0x2'),_0x1c86('0x3'),_0x1c86('0x4'),_0x1c86('0x5'),'picklist'),'defaultValue':_0x1c86('0x2')},'content':{'type':Sequelize[_0x1c86('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1c86('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1c86('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1c86('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1c86('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 7af9656..0a2e6fa 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 _0x94db=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ZendeskField','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache'];(function(_0x4728b1,_0x44f350){var _0x25f9f2=function(_0x3ee6ad){while(--_0x3ee6ad){_0x4728b1['push'](_0x4728b1['shift']());}};_0x25f9f2(++_0x44f350);}(_0x94db,0xd6));var _0xb94d=function(_0x109eb8,_0x1471ed){_0x109eb8=_0x109eb8-0x0;var _0x1d5d5b=_0x94db[_0x109eb8];return _0x1d5d5b;};'use strict';var emlformat=require(_0xb94d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb94d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb94d('0x2'));var moment=require('moment');var BPromise=require(_0xb94d('0x3'));var Mustache=require(_0xb94d('0x4'));var util=require(_0xb94d('0x5'));var path=require(_0xb94d('0x6'));var sox=require(_0xb94d('0x7'));var csv=require(_0xb94d('0x8'));var ejs=require(_0xb94d('0x9'));var fs=require('fs');var fs_extra=require(_0xb94d('0xa'));var _=require(_0xb94d('0xb'));var squel=require(_0xb94d('0xc'));var crypto=require(_0xb94d('0xd'));var jsforce=require(_0xb94d('0xe'));var deskjs=require(_0xb94d('0xf'));var toCsv=require(_0xb94d('0x8'));var querystring=require(_0xb94d('0x10'));var Papa=require(_0xb94d('0x11'));var Redis=require(_0xb94d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb94d('0x13'));var as=require(_0xb94d('0x14'));var hardwareService=require(_0xb94d('0x15'));var logger=require(_0xb94d('0x16'))(_0xb94d('0x17'));var utils=require('../../config/utils');var config=require(_0xb94d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb94d('0x19'))['db'];function respondWithStatusCode(_0x601389,_0x23f4af){_0x23f4af=_0x23f4af||0xcc;return function(_0x1d545b){if(_0x1d545b){return _0x601389['sendStatus'](_0x23f4af);}return _0x601389[_0xb94d('0x1a')](_0x23f4af)[_0xb94d('0x1b')]();};}function respondWithResult(_0x3451ca,_0x392cf4){_0x392cf4=_0x392cf4||0xc8;return function(_0x15c98a){if(_0x15c98a){return _0x3451ca[_0xb94d('0x1a')](_0x392cf4)[_0xb94d('0x1c')](_0x15c98a);}};}function respondWithFilteredResult(_0x3416b3,_0x411725){return function(_0xb5f785){if(_0xb5f785){var _0x3416f7=typeof _0x411725['offset']===_0xb94d('0x1d')&&typeof _0x411725[_0xb94d('0x1e')]===_0xb94d('0x1d');var _0x3d23ea=_0xb5f785[_0xb94d('0x1f')];var _0x3c27d5=_0x3416f7?0x0:_0x411725['offset'];var _0x5eb28f=_0x3416f7?_0xb5f785['count']:_0x411725[_0xb94d('0x20')]+_0x411725[_0xb94d('0x1e')];var _0x55c9a6;if(_0x5eb28f>=_0x3d23ea){_0x5eb28f=_0x3d23ea;_0x55c9a6=0xc8;}else{_0x55c9a6=0xce;}_0x3416b3[_0xb94d('0x1a')](_0x55c9a6);return _0x3416b3['set'](_0xb94d('0x21'),_0x3c27d5+'-'+_0x5eb28f+'/'+_0x3d23ea)[_0xb94d('0x1c')](_0xb5f785);}return null;};}function patchUpdates(_0xcfb970){return function(_0x552527){try{jsonpatch['apply'](_0x552527,_0xcfb970,!![]);}catch(_0x2aca1b){return BPromise[_0xb94d('0x22')](_0x2aca1b);}return _0x552527[_0xb94d('0x23')]();};}function saveUpdates(_0x451556,_0x3b31bb){return function(_0x17c6a8){if(_0x17c6a8){return _0x17c6a8[_0xb94d('0x24')](_0x451556)['then'](function(_0x1c0a14){return _0x1c0a14;});}return null;};}function removeEntity(_0x936834,_0x3ab5fa){return function(_0x526b6a){if(_0x526b6a){return _0x526b6a[_0xb94d('0x25')]()[_0xb94d('0x26')](function(){_0x936834[_0xb94d('0x1a')](0xcc)[_0xb94d('0x1b')]();});}};}function handleEntityNotFound(_0x41eb3d,_0x486923){return function(_0x8c143a){if(!_0x8c143a){_0x41eb3d['sendStatus'](0x194);}return _0x8c143a;};}function handleError(_0x227933,_0x1a1da5){_0x1a1da5=_0x1a1da5||0x1f4;return function(_0x5d4e34){logger[_0xb94d('0x27')](_0x5d4e34[_0xb94d('0x28')]);if(_0x5d4e34['name']){delete _0x5d4e34[_0xb94d('0x29')];}_0x227933[_0xb94d('0x1a')](_0x1a1da5)[_0xb94d('0x2a')](_0x5d4e34);};}exports['index']=function(_0x5387b5,_0x3e76cb){var _0x1fedea={},_0x2fd335={},_0x2593f2={'count':0x0,'rows':[]};var _0x366c07=_[_0xb94d('0x2b')](db['ZendeskField'][_0xb94d('0x2c')],function(_0x1bba0b){return{'name':_0x1bba0b['fieldName'],'type':_0x1bba0b[_0xb94d('0x2d')][_0xb94d('0x2e')]};});_0x2fd335[_0xb94d('0x2f')]=_[_0xb94d('0x2b')](_0x366c07,_0xb94d('0x29'));_0x2fd335['query']=_[_0xb94d('0x30')](_0x5387b5[_0xb94d('0x31')]);_0x2fd335[_0xb94d('0x32')]=_[_0xb94d('0x33')](_0x2fd335['model'],_0x2fd335['query']);_0x1fedea['attributes']=_[_0xb94d('0x33')](_0x2fd335[_0xb94d('0x2f')],qs[_0xb94d('0x34')](_0x5387b5[_0xb94d('0x31')][_0xb94d('0x34')]));_0x1fedea[_0xb94d('0x35')]=_0x1fedea[_0xb94d('0x35')][_0xb94d('0x36')]?_0x1fedea[_0xb94d('0x35')]:_0x2fd335['model'];if(!_0x5387b5[_0xb94d('0x31')][_0xb94d('0x37')](_0xb94d('0x38'))){_0x1fedea[_0xb94d('0x1e')]=qs[_0xb94d('0x1e')](_0x5387b5[_0xb94d('0x31')][_0xb94d('0x1e')]);_0x1fedea[_0xb94d('0x20')]=qs[_0xb94d('0x20')](_0x5387b5[_0xb94d('0x31')][_0xb94d('0x20')]);}_0x1fedea[_0xb94d('0x39')]=qs['sort'](_0x5387b5[_0xb94d('0x31')][_0xb94d('0x3a')]);_0x1fedea['where']=qs['filters'](_['pick'](_0x5387b5[_0xb94d('0x31')],_0x2fd335['filters']),_0x366c07);if(_0x5387b5[_0xb94d('0x31')][_0xb94d('0x3b')]){_0x1fedea[_0xb94d('0x3c')]=_[_0xb94d('0x3d')](_0x1fedea['where'],{'$or':_[_0xb94d('0x2b')](_0x366c07,function(_0x997222){if(_0x997222['type']!==_0xb94d('0x3e')){var _0x2a984f={};_0x2a984f[_0x997222[_0xb94d('0x29')]]={'$like':'%'+_0x5387b5[_0xb94d('0x31')][_0xb94d('0x3b')]+'%'};return _0x2a984f;}})});}_0x1fedea=_['merge']({},_0x1fedea,_0x5387b5[_0xb94d('0x3f')]);var _0x1eacca={'where':_0x1fedea[_0xb94d('0x3c')]};return db[_0xb94d('0x40')][_0xb94d('0x1f')](_0x1eacca)[_0xb94d('0x26')](function(_0x492f75){_0x2593f2[_0xb94d('0x1f')]=_0x492f75;if(_0x5387b5[_0xb94d('0x31')]['includeAll']){_0x1fedea[_0xb94d('0x41')]=[{'all':!![]}];}return db[_0xb94d('0x40')]['findAll'](_0x1fedea);})[_0xb94d('0x26')](function(_0x2a25f9){_0x2593f2[_0xb94d('0x42')]=_0x2a25f9;return _0x2593f2;})[_0xb94d('0x26')](respondWithFilteredResult(_0x3e76cb,_0x1fedea))[_0xb94d('0x43')](handleError(_0x3e76cb,null));};exports[_0xb94d('0x44')]=function(_0x18292f,_0x34d0b0){var _0x14e5d7={'raw':!![],'where':{'id':_0x18292f[_0xb94d('0x45')]['id']}},_0x177613={};_0x177613['model']=_['keys'](db[_0xb94d('0x40')][_0xb94d('0x2c')]);_0x177613[_0xb94d('0x31')]=_[_0xb94d('0x30')](_0x18292f[_0xb94d('0x31')]);_0x177613[_0xb94d('0x32')]=_[_0xb94d('0x33')](_0x177613[_0xb94d('0x2f')],_0x177613[_0xb94d('0x31')]);_0x14e5d7['attributes']=_[_0xb94d('0x33')](_0x177613[_0xb94d('0x2f')],qs[_0xb94d('0x34')](_0x18292f[_0xb94d('0x31')]['fields']));_0x14e5d7[_0xb94d('0x35')]=_0x14e5d7['attributes']['length']?_0x14e5d7[_0xb94d('0x35')]:_0x177613[_0xb94d('0x2f')];if(_0x18292f[_0xb94d('0x31')]['includeAll']){_0x14e5d7[_0xb94d('0x41')]=[{'all':!![]}];}_0x14e5d7=_[_0xb94d('0x3d')]({},_0x14e5d7,_0x18292f[_0xb94d('0x3f')]);return db[_0xb94d('0x40')][_0xb94d('0x46')](_0x14e5d7)[_0xb94d('0x26')](handleEntityNotFound(_0x34d0b0,null))['then'](respondWithResult(_0x34d0b0,null))[_0xb94d('0x43')](handleError(_0x34d0b0,null));};exports['create']=function(_0x5540c4,_0x157e0e){return db[_0xb94d('0x40')][_0xb94d('0x47')](_0x5540c4[_0xb94d('0x48')],{})[_0xb94d('0x26')](respondWithResult(_0x157e0e,0xc9))[_0xb94d('0x43')](handleError(_0x157e0e,null));};exports[_0xb94d('0x24')]=function(_0x34de8d,_0xac3381){if(_0x34de8d[_0xb94d('0x48')]['id']){delete _0x34de8d[_0xb94d('0x48')]['id'];}return db[_0xb94d('0x40')][_0xb94d('0x46')]({'where':{'id':_0x34de8d[_0xb94d('0x45')]['id']}})[_0xb94d('0x26')](handleEntityNotFound(_0xac3381,null))[_0xb94d('0x26')](saveUpdates(_0x34de8d[_0xb94d('0x48')],null))['then'](respondWithResult(_0xac3381,null))[_0xb94d('0x43')](handleError(_0xac3381,null));};exports[_0xb94d('0x25')]=function(_0x2f4c1b,_0x19e152){return db[_0xb94d('0x40')]['find']({'where':{'id':_0x2f4c1b[_0xb94d('0x45')]['id']}})[_0xb94d('0x26')](handleEntityNotFound(_0x19e152,null))[_0xb94d('0x26')](removeEntity(_0x19e152,null))[_0xb94d('0x43')](handleError(_0x19e152,null));}; \ No newline at end of file +var _0x8b19=['../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','params','keys','catch','create','body','find','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x3b151c,_0x1cb1c2){var _0x4369ba=function(_0x7e8895){while(--_0x7e8895){_0x3b151c['push'](_0x3b151c['shift']());}};_0x4369ba(++_0x1cb1c2);}(_0x8b19,0x1a1));var _0x98b1=function(_0x3d3f02,_0x562073){_0x3d3f02=_0x3d3f02-0x0;var _0x468d7f=_0x8b19[_0x3d3f02];return _0x468d7f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x98b1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98b1('0x1'));var moment=require('moment');var BPromise=require(_0x98b1('0x2'));var Mustache=require(_0x98b1('0x3'));var util=require('util');var path=require(_0x98b1('0x4'));var sox=require(_0x98b1('0x5'));var csv=require(_0x98b1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98b1('0x7'));var _=require(_0x98b1('0x8'));var squel=require('squel');var crypto=require(_0x98b1('0x9'));var jsforce=require(_0x98b1('0xa'));var deskjs=require(_0x98b1('0xb'));var toCsv=require(_0x98b1('0x6'));var querystring=require(_0x98b1('0xc'));var Papa=require(_0x98b1('0xd'));var Redis=require(_0x98b1('0xe'));var authService=require(_0x98b1('0xf'));var qs=require(_0x98b1('0x10'));var as=require(_0x98b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98b1('0x12'))(_0x98b1('0x13'));var utils=require(_0x98b1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x98b1('0x15'));var db=require(_0x98b1('0x16'))['db'];function respondWithStatusCode(_0x2e4a65,_0x569b5e){_0x569b5e=_0x569b5e||0xcc;return function(_0x4b21bd){if(_0x4b21bd){return _0x2e4a65['sendStatus'](_0x569b5e);}return _0x2e4a65[_0x98b1('0x17')](_0x569b5e)[_0x98b1('0x18')]();};}function respondWithResult(_0xfb279b,_0x2ad173){_0x2ad173=_0x2ad173||0xc8;return function(_0x3298d9){if(_0x3298d9){return _0xfb279b[_0x98b1('0x17')](_0x2ad173)['json'](_0x3298d9);}};}function respondWithFilteredResult(_0x442680,_0x19ce84){return function(_0x1b2788){if(_0x1b2788){var _0x57fb61=typeof _0x19ce84[_0x98b1('0x19')]==='undefined'&&typeof _0x19ce84[_0x98b1('0x1a')]==='undefined';var _0x43341e=_0x1b2788[_0x98b1('0x1b')];var _0x3a4814=_0x57fb61?0x0:_0x19ce84['offset'];var _0x4a8e53=_0x57fb61?_0x1b2788[_0x98b1('0x1b')]:_0x19ce84[_0x98b1('0x19')]+_0x19ce84[_0x98b1('0x1a')];var _0x379f6a;if(_0x4a8e53>=_0x43341e){_0x4a8e53=_0x43341e;_0x379f6a=0xc8;}else{_0x379f6a=0xce;}_0x442680[_0x98b1('0x17')](_0x379f6a);return _0x442680[_0x98b1('0x1c')]('Content-Range',_0x3a4814+'-'+_0x4a8e53+'/'+_0x43341e)[_0x98b1('0x1d')](_0x1b2788);}return null;};}function patchUpdates(_0x4ae811){return function(_0x335fc5){try{jsonpatch[_0x98b1('0x1e')](_0x335fc5,_0x4ae811,!![]);}catch(_0x149836){return BPromise[_0x98b1('0x1f')](_0x149836);}return _0x335fc5[_0x98b1('0x20')]();};}function saveUpdates(_0x150ced,_0xa4c391){return function(_0x44d818){if(_0x44d818){return _0x44d818[_0x98b1('0x21')](_0x150ced)[_0x98b1('0x22')](function(_0x2d3f5d){return _0x2d3f5d;});}return null;};}function removeEntity(_0x257174,_0x57cf59){return function(_0x2f70e9){if(_0x2f70e9){return _0x2f70e9[_0x98b1('0x23')]()[_0x98b1('0x22')](function(){_0x257174[_0x98b1('0x17')](0xcc)[_0x98b1('0x18')]();});}};}function handleEntityNotFound(_0x5d7fdc,_0x2dbcb7){return function(_0x4e9225){if(!_0x4e9225){_0x5d7fdc[_0x98b1('0x24')](0x194);}return _0x4e9225;};}function handleError(_0x20b061,_0xdec995){_0xdec995=_0xdec995||0x1f4;return function(_0x55282f){logger['error'](_0x55282f[_0x98b1('0x25')]);if(_0x55282f[_0x98b1('0x26')]){delete _0x55282f['name'];}_0x20b061[_0x98b1('0x17')](_0xdec995)[_0x98b1('0x27')](_0x55282f);};}exports[_0x98b1('0x28')]=function(_0xdcc985,_0x2e37eb){var _0x1b4183={},_0x2ca8aa={},_0x27ec56={'count':0x0,'rows':[]};var _0x2b45ff=_[_0x98b1('0x29')](db[_0x98b1('0x2a')][_0x98b1('0x2b')],function(_0x164196){return{'name':_0x164196[_0x98b1('0x2c')],'type':_0x164196['type'][_0x98b1('0x2d')]};});_0x2ca8aa[_0x98b1('0x2e')]=_[_0x98b1('0x29')](_0x2b45ff,'name');_0x2ca8aa[_0x98b1('0x2f')]=_['keys'](_0xdcc985['query']);_0x2ca8aa[_0x98b1('0x30')]=_[_0x98b1('0x31')](_0x2ca8aa['model'],_0x2ca8aa[_0x98b1('0x2f')]);_0x1b4183[_0x98b1('0x32')]=_[_0x98b1('0x31')](_0x2ca8aa[_0x98b1('0x2e')],qs[_0x98b1('0x33')](_0xdcc985[_0x98b1('0x2f')][_0x98b1('0x33')]));_0x1b4183[_0x98b1('0x32')]=_0x1b4183['attributes'][_0x98b1('0x34')]?_0x1b4183[_0x98b1('0x32')]:_0x2ca8aa[_0x98b1('0x2e')];if(!_0xdcc985[_0x98b1('0x2f')][_0x98b1('0x35')](_0x98b1('0x36'))){_0x1b4183[_0x98b1('0x1a')]=qs['limit'](_0xdcc985[_0x98b1('0x2f')][_0x98b1('0x1a')]);_0x1b4183['offset']=qs['offset'](_0xdcc985[_0x98b1('0x2f')][_0x98b1('0x19')]);}_0x1b4183[_0x98b1('0x37')]=qs[_0x98b1('0x38')](_0xdcc985[_0x98b1('0x2f')]['sort']);_0x1b4183[_0x98b1('0x39')]=qs[_0x98b1('0x30')](_[_0x98b1('0x3a')](_0xdcc985[_0x98b1('0x2f')],_0x2ca8aa[_0x98b1('0x30')]),_0x2b45ff);if(_0xdcc985[_0x98b1('0x2f')][_0x98b1('0x3b')]){_0x1b4183['where']=_['merge'](_0x1b4183[_0x98b1('0x39')],{'$or':_[_0x98b1('0x29')](_0x2b45ff,function(_0x3f92fb){if(_0x3f92fb[_0x98b1('0x3c')]!==_0x98b1('0x3d')){var _0x5f4322={};_0x5f4322[_0x3f92fb[_0x98b1('0x26')]]={'$like':'%'+_0xdcc985[_0x98b1('0x2f')]['filter']+'%'};return _0x5f4322;}})});}_0x1b4183=_[_0x98b1('0x3e')]({},_0x1b4183,_0xdcc985[_0x98b1('0x3f')]);var _0x17429a={'where':_0x1b4183['where']};return db[_0x98b1('0x2a')][_0x98b1('0x1b')](_0x17429a)[_0x98b1('0x22')](function(_0x56024d){_0x27ec56['count']=_0x56024d;if(_0xdcc985[_0x98b1('0x2f')][_0x98b1('0x40')]){_0x1b4183[_0x98b1('0x41')]=[{'all':!![]}];}return db[_0x98b1('0x2a')]['findAll'](_0x1b4183);})['then'](function(_0x288535){_0x27ec56[_0x98b1('0x42')]=_0x288535;return _0x27ec56;})[_0x98b1('0x22')](respondWithFilteredResult(_0x2e37eb,_0x1b4183))['catch'](handleError(_0x2e37eb,null));};exports['show']=function(_0x352ce4,_0x33ca5e){var _0xb53870={'raw':!![],'where':{'id':_0x352ce4[_0x98b1('0x43')]['id']}},_0x4be016={};_0x4be016['model']=_['keys'](db[_0x98b1('0x2a')][_0x98b1('0x2b')]);_0x4be016[_0x98b1('0x2f')]=_[_0x98b1('0x44')](_0x352ce4[_0x98b1('0x2f')]);_0x4be016['filters']=_[_0x98b1('0x31')](_0x4be016[_0x98b1('0x2e')],_0x4be016[_0x98b1('0x2f')]);_0xb53870['attributes']=_['intersection'](_0x4be016[_0x98b1('0x2e')],qs[_0x98b1('0x33')](_0x352ce4[_0x98b1('0x2f')]['fields']));_0xb53870[_0x98b1('0x32')]=_0xb53870['attributes'][_0x98b1('0x34')]?_0xb53870[_0x98b1('0x32')]:_0x4be016['model'];if(_0x352ce4[_0x98b1('0x2f')][_0x98b1('0x40')]){_0xb53870['include']=[{'all':!![]}];}_0xb53870=_[_0x98b1('0x3e')]({},_0xb53870,_0x352ce4['options']);return db[_0x98b1('0x2a')]['find'](_0xb53870)[_0x98b1('0x22')](handleEntityNotFound(_0x33ca5e,null))[_0x98b1('0x22')](respondWithResult(_0x33ca5e,null))[_0x98b1('0x45')](handleError(_0x33ca5e,null));};exports[_0x98b1('0x46')]=function(_0x449cfa,_0x415f01){return db['ZendeskField'][_0x98b1('0x46')](_0x449cfa[_0x98b1('0x47')],{})[_0x98b1('0x22')](respondWithResult(_0x415f01,0xc9))[_0x98b1('0x45')](handleError(_0x415f01,null));};exports[_0x98b1('0x21')]=function(_0x27e3a3,_0x2c1e9b){if(_0x27e3a3['body']['id']){delete _0x27e3a3[_0x98b1('0x47')]['id'];}return db['ZendeskField'][_0x98b1('0x48')]({'where':{'id':_0x27e3a3[_0x98b1('0x43')]['id']}})[_0x98b1('0x22')](handleEntityNotFound(_0x2c1e9b,null))[_0x98b1('0x22')](saveUpdates(_0x27e3a3[_0x98b1('0x47')],null))[_0x98b1('0x22')](respondWithResult(_0x2c1e9b,null))[_0x98b1('0x45')](handleError(_0x2c1e9b,null));};exports[_0x98b1('0x23')]=function(_0x3115a2,_0x3f9aab){return db[_0x98b1('0x2a')][_0x98b1('0x48')]({'where':{'id':_0x3115a2[_0x98b1('0x43')]['id']}})[_0x98b1('0x22')](handleEntityNotFound(_0x3f9aab,null))[_0x98b1('0x22')](removeEntity(_0x3f9aab,null))[_0x98b1('0x45')](handleError(_0x3f9aab,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 50bdaab..dee8e74 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 _0xf07e=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskField','zendesk_unique_index'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf07e,0x7a));var _0xef07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf07e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef07('0x0'));var util=require(_0xef07('0x1'));var logger=require(_0xef07('0x2'))(_0xef07('0x3'));var moment=require(_0xef07('0x4'));var BPromise=require(_0xef07('0x5'));var rp=require(_0xef07('0x6'));var fs=require('fs');var path=require(_0xef07('0x7'));var rimraf=require('rimraf');var config=require(_0xef07('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xef07('0x9')]=function(_0x413cd2,_0x454982){return _0x413cd2[_0xef07('0xa')](_0xef07('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xef07('0xc'),'fields':[_0xef07('0xd'),_0xef07('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1ed=['./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4404f4,_0x5286b8){var _0x2c04e6=function(_0x511e2a){while(--_0x511e2a){_0x4404f4['push'](_0x4404f4['shift']());}};_0x2c04e6(++_0x5286b8);}(_0xc1ed,0x129));var _0xdc1e=function(_0x3df0f4,_0x4ad464){_0x3df0f4=_0x3df0f4-0x0;var _0x562a3a=_0xc1ed[_0x3df0f4];return _0x562a3a;};'use strict';var _=require(_0xdc1e('0x0'));var util=require(_0xdc1e('0x1'));var logger=require(_0xdc1e('0x2'))(_0xdc1e('0x3'));var moment=require(_0xdc1e('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc1e('0x5'));var fs=require('fs');var path=require(_0xdc1e('0x6'));var rimraf=require(_0xdc1e('0x7'));var config=require(_0xdc1e('0x8'));var attributes=require(_0xdc1e('0x9'));module[_0xdc1e('0xa')]=function(_0x43cf5b,_0x444e7d){return _0x43cf5b[_0xdc1e('0xb')](_0xdc1e('0xc'),attributes,{'tableName':_0xdc1e('0xd'),'paranoid':![],'indexes':[{'name':_0xdc1e('0xe'),'fields':[_0xdc1e('0xf'),_0xdc1e('0x10')],'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 9eb07ee..3d93071 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 _0xbedf=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1ec65c,_0x354923){var _0x5249c2=function(_0x451341){while(--_0x451341){_0x1ec65c['push'](_0x1ec65c['shift']());}};_0x5249c2(++_0x354923);}(_0xbedf,0xec));var _0xfbed=function(_0x573592,_0x5ef466){_0x573592=_0x573592-0x0;var _0x411ae5=_0xbedf[_0x573592];return _0x411ae5;};'use strict';var _=require(_0xfbed('0x0'));var util=require(_0xfbed('0x1'));var moment=require(_0xfbed('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbed('0x3'));var fs=require('fs');var Redis=require(_0xfbed('0x4'));var db=require(_0xfbed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbed('0x6'))(_0xfbed('0x7'));var config=require(_0xfbed('0x8'));var jayson=require(_0xfbed('0x9'));var client=jayson[_0xfbed('0xa')][_0xfbed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d1f3f,_0x58f330,_0x2038a1){return new BPromise(function(_0x2c0a16,_0x120835){return client[_0xfbed('0xc')](_0x4d1f3f,_0x2038a1)[_0xfbed('0xd')](function(_0x403020){logger[_0xfbed('0xe')](_0xfbed('0xf'),_0x58f330,_0xfbed('0x10'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x58f330,_0xfbed('0x10'),JSON[_0xfbed('0x11')](_0x403020));if(_0x403020[_0xfbed('0x12')]){if(_0x403020[_0xfbed('0x12')][_0xfbed('0x13')]===0x1f4){logger[_0xfbed('0x12')]('ZendeskField,\x20%s,\x20%s',_0x58f330,_0x403020[_0xfbed('0x12')][_0xfbed('0x14')]);return _0x120835(_0x403020[_0xfbed('0x12')][_0xfbed('0x14')]);}logger['error'](_0xfbed('0xf'),_0x58f330,_0x403020[_0xfbed('0x12')][_0xfbed('0x14')]);return _0x2c0a16(_0x403020[_0xfbed('0x12')][_0xfbed('0x14')]);}else{logger[_0xfbed('0xe')](_0xfbed('0xf'),_0x58f330,_0xfbed('0x10'));_0x2c0a16(_0x403020['result'][_0xfbed('0x14')]);}})[_0xfbed('0x15')](function(_0xb8ac7b){logger[_0xfbed('0x12')](_0xfbed('0xf'),_0x58f330,_0xb8ac7b);_0x120835(_0xb8ac7b);});});} \ No newline at end of file +var _0x01df=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5c5b7a,_0x1b992a){var _0x51cd11=function(_0x378a3d){while(--_0x378a3d){_0x5c5b7a['push'](_0x5c5b7a['shift']());}};_0x51cd11(++_0x1b992a);}(_0x01df,0xf8));var _0xf01d=function(_0x3d5d2e,_0xc26344){_0x3d5d2e=_0x3d5d2e-0x0;var _0xe82ade=_0x01df[_0x3d5d2e];return _0xe82ade;};'use strict';var _=require(_0xf01d('0x0'));var util=require(_0xf01d('0x1'));var moment=require(_0xf01d('0x2'));var BPromise=require(_0xf01d('0x3'));var rs=require(_0xf01d('0x4'));var fs=require('fs');var Redis=require(_0xf01d('0x5'));var db=require(_0xf01d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf01d('0x7'))(_0xf01d('0x8'));var config=require(_0xf01d('0x9'));var jayson=require(_0xf01d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5504,_0x370b8a,_0x11eb20){return new BPromise(function(_0x17b057,_0x24dc72){return client['request'](_0x3d5504,_0x11eb20)[_0xf01d('0xb')](function(_0x2fd2be){logger['info'](_0xf01d('0xc'),_0x370b8a,'request\x20sent');logger[_0xf01d('0xd')](_0xf01d('0xe'),_0x370b8a,_0xf01d('0xf'),JSON['stringify'](_0x2fd2be));if(_0x2fd2be[_0xf01d('0x10')]){if(_0x2fd2be['error'][_0xf01d('0x11')]===0x1f4){logger[_0xf01d('0x10')](_0xf01d('0xc'),_0x370b8a,_0x2fd2be[_0xf01d('0x10')][_0xf01d('0x12')]);return _0x24dc72(_0x2fd2be[_0xf01d('0x10')][_0xf01d('0x12')]);}logger['error'](_0xf01d('0xc'),_0x370b8a,_0x2fd2be[_0xf01d('0x10')][_0xf01d('0x12')]);return _0x17b057(_0x2fd2be[_0xf01d('0x10')]['message']);}else{logger[_0xf01d('0x13')](_0xf01d('0xc'),_0x370b8a,_0xf01d('0xf'));_0x17b057(_0x2fd2be[_0xf01d('0x14')][_0xf01d('0x12')]);}})[_0xf01d('0x15')](function(_0x35f92f){logger[_0xf01d('0x10')](_0xf01d('0xc'),_0x370b8a,_0x35f92f);_0x24dc72(_0x35f92f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c6e599c..7cb4c74 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 _0x370b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','delete','exports','multer','path'];(function(_0x1df3f3,_0x545b7b){var _0x49f3ab=function(_0x131ceb){while(--_0x131ceb){_0x1df3f3['push'](_0x1df3f3['shift']());}};_0x49f3ab(++_0x545b7b);}(_0x370b,0x1b3));var _0xb370=function(_0x59b42e,_0x1e15df){_0x59b42e=_0x59b42e-0x0;var _0x7a645f=_0x370b[_0x59b42e];return _0x7a645f;};'use strict';var multer=require(_0xb370('0x0'));var util=require('util');var path=require(_0xb370('0x1'));var timeout=require('connect-timeout');var express=require(_0xb370('0x2'));var router=express[_0xb370('0x3')]();var fs_extra=require(_0xb370('0x4'));var auth=require(_0xb370('0x5'));var interaction=require(_0xb370('0x6'));var config=require(_0xb370('0x7'));var controller=require(_0xb370('0x8'));router[_0xb370('0x9')]('/',auth[_0xb370('0xa')](),controller[_0xb370('0xb')]);router['get'](_0xb370('0xc'),auth['isAuthenticated'](),controller[_0xb370('0xd')]);router[_0xb370('0x9')]('/:id/configurations',auth[_0xb370('0xa')](),controller[_0xb370('0xe')]);router[_0xb370('0x9')](_0xb370('0xf'),auth['isAuthenticated'](),controller[_0xb370('0x10')]);router[_0xb370('0x11')]('/',auth[_0xb370('0xa')](),controller[_0xb370('0x12')]);router[_0xb370('0x11')](_0xb370('0x13'),auth[_0xb370('0xa')](),controller['addConfiguration']);router[_0xb370('0x14')]('/:id',auth[_0xb370('0xa')](),controller['update']);router[_0xb370('0x15')](_0xb370('0xc'),auth[_0xb370('0xa')](),controller['destroy']);module[_0xb370('0x16')]=router; \ No newline at end of file +var _0xb85c=['isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xb85c,0x1db));var _0xcb85=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb85c[_0x2be8c2];return _0x97f531;};'use strict';var multer=require('multer');var util=require(_0xcb85('0x0'));var path=require(_0xcb85('0x1'));var timeout=require(_0xcb85('0x2'));var express=require(_0xcb85('0x3'));var router=express[_0xcb85('0x4')]();var fs_extra=require(_0xcb85('0x5'));var auth=require(_0xcb85('0x6'));var interaction=require(_0xcb85('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xcb85('0x8')]('/',auth[_0xcb85('0x9')](),controller['index']);router[_0xcb85('0x8')](_0xcb85('0xa'),auth[_0xcb85('0x9')](),controller['show']);router[_0xcb85('0x8')]('/:id/configurations',auth[_0xcb85('0x9')](),controller[_0xcb85('0xb')]);router[_0xcb85('0x8')](_0xcb85('0xc'),auth[_0xcb85('0x9')](),controller[_0xcb85('0xd')]);router[_0xcb85('0xe')]('/',auth[_0xcb85('0x9')](),controller['create']);router[_0xcb85('0xe')](_0xcb85('0xf'),auth['isAuthenticated'](),controller[_0xcb85('0x10')]);router[_0xcb85('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xcb85('0x12')]);router[_0xcb85('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xcb85('0x14')]);module[_0xcb85('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 2c49801..3b41b95 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 _0x6f0d=['exports','STRING'];(function(_0x345e95,_0x29e5bf){var _0x3b7a49=function(_0x4022a0){while(--_0x4022a0){_0x345e95['push'](_0x345e95['shift']());}};_0x3b7a49(++_0x29e5bf);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1fd0bc,_0x351ecf){_0x1fd0bc=_0x1fd0bc-0x0;var _0x3eed7f=_0x6f0d[_0x1fd0bc];return _0x3eed7f;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file +var _0x55e0=['STRING','sequelize','exports'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x55e0,0xdc));var _0x055e=function(_0x377576,_0x29f607){_0x377576=_0x377576-0x0;var _0x1ceacc=_0x55e0[_0x377576];return _0x1ceacc;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'name':{'type':Sequelize[_0x055e('0x2')]},'description':{'type':Sequelize[_0x055e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x055e('0x2')]},'clientSecret':{'type':Sequelize[_0x055e('0x2')]},'serverUrl':{'type':Sequelize[_0x055e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x055e('0x2')]},'refreshToken':{'type':Sequelize[_0x055e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index dbc5392..94c824a 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 _0x85fd=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','keys','length','create','body','update','find','params','destroy','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','code','host','com','serverUrl','substring','lastIndexOf','GET','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3ba2a3,_0x34d0ba){var _0x2d0e38=function(_0x12ee87){while(--_0x12ee87){_0x3ba2a3['push'](_0x3ba2a3['shift']());}};_0x2d0e38(++_0x34d0ba);}(_0x85fd,0x6f));var _0xd85f=function(_0x347d32,_0x181e89){_0x347d32=_0x347d32-0x0;var _0x5eeb56=_0x85fd[_0x347d32];return _0x5eeb56;};'use strict';var emlformat=require(_0xd85f('0x0'));var rimraf=require(_0xd85f('0x1'));var zipdir=require(_0xd85f('0x2'));var jsonpatch=require(_0xd85f('0x3'));var rp=require(_0xd85f('0x4'));var moment=require(_0xd85f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd85f('0x6'));var util=require(_0xd85f('0x7'));var path=require(_0xd85f('0x8'));var sox=require(_0xd85f('0x9'));var csv=require(_0xd85f('0xa'));var ejs=require(_0xd85f('0xb'));var fs=require('fs');var fs_extra=require(_0xd85f('0xc'));var _=require(_0xd85f('0xd'));var squel=require(_0xd85f('0xe'));var crypto=require(_0xd85f('0xf'));var jsforce=require(_0xd85f('0x10'));var deskjs=require(_0xd85f('0x11'));var toCsv=require(_0xd85f('0xa'));var querystring=require(_0xd85f('0x12'));var Papa=require(_0xd85f('0x13'));var Redis=require(_0xd85f('0x14'));var authService=require(_0xd85f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xd85f('0x16'));var hardwareService=require(_0xd85f('0x17'));var logger=require(_0xd85f('0x18'))('api');var utils=require(_0xd85f('0x19'));var config=require(_0xd85f('0x1a'));var licenseUtil=require(_0xd85f('0x1b'));var db=require(_0xd85f('0x1c'))['db'];var integrations=require(_0xd85f('0x1d'));function respondWithStatusCode(_0x4403df,_0x3f014e){_0x3f014e=_0x3f014e||0xcc;return function(_0x2f268d){if(_0x2f268d){return _0x4403df[_0xd85f('0x1e')](_0x3f014e);}return _0x4403df[_0xd85f('0x1f')](_0x3f014e)[_0xd85f('0x20')]();};}function respondWithResult(_0x4bd964,_0x4f3a02){_0x4f3a02=_0x4f3a02||0xc8;return function(_0x112867){if(_0x112867){return _0x4bd964['status'](_0x4f3a02)[_0xd85f('0x21')](_0x112867);}};}function respondWithFilteredResult(_0x5979ed,_0x1dbf34){return function(_0x13d330){if(_0x13d330){var _0x287883=typeof _0x1dbf34[_0xd85f('0x22')]===_0xd85f('0x23')&&typeof _0x1dbf34[_0xd85f('0x24')]===_0xd85f('0x23');var _0x5b5027=_0x13d330[_0xd85f('0x25')];var _0x41fd1c=_0x287883?0x0:_0x1dbf34['offset'];var _0xceb154=_0x287883?_0x13d330[_0xd85f('0x25')]:_0x1dbf34[_0xd85f('0x22')]+_0x1dbf34['limit'];var _0xbf58b0;if(_0xceb154>=_0x5b5027){_0xceb154=_0x5b5027;_0xbf58b0=0xc8;}else{_0xbf58b0=0xce;}_0x5979ed['status'](_0xbf58b0);return _0x5979ed[_0xd85f('0x26')](_0xd85f('0x27'),_0x41fd1c+'-'+_0xceb154+'/'+_0x5b5027)['json'](_0x13d330);}return null;};}function patchUpdates(_0x27e9a5){return function(_0x5e7c21){try{jsonpatch[_0xd85f('0x28')](_0x5e7c21,_0x27e9a5,!![]);}catch(_0x26bdd7){return BPromise['reject'](_0x26bdd7);}return _0x5e7c21[_0xd85f('0x29')]();};}function saveUpdates(_0x2c2fb9,_0x47c7f7){return function(_0x520ed4){if(_0x520ed4){return _0x520ed4['update'](_0x2c2fb9)[_0xd85f('0x2a')](function(_0xcbcb68){return _0xcbcb68;});}return null;};}function removeEntity(_0x291820,_0x235b31){return function(_0x51aa87){if(_0x51aa87){return _0x51aa87['destroy']()[_0xd85f('0x2a')](function(){_0x291820[_0xd85f('0x1f')](0xcc)[_0xd85f('0x20')]();});}};}function handleEntityNotFound(_0x2d5916,_0x1e6fe8){return function(_0x2d3c77){if(!_0x2d3c77){_0x2d5916[_0xd85f('0x1e')](0x194);}return _0x2d3c77;};}function handleError(_0x29d10c,_0x4bbe10){_0x4bbe10=_0x4bbe10||0x1f4;return function(_0x2aa095){logger['error'](_0x2aa095[_0xd85f('0x2b')]);if(_0x2aa095[_0xd85f('0x2c')]){delete _0x2aa095[_0xd85f('0x2c')];}_0x29d10c['status'](_0x4bbe10)[_0xd85f('0x2d')](_0x2aa095);};}exports[_0xd85f('0x2e')]=function(_0x3916e4,_0x599f5a){var _0x2139cb={},_0x147dea={},_0xcf4003={'count':0x0,'rows':[]};var _0x5e2b03=_[_0xd85f('0x2f')](db[_0xd85f('0x30')][_0xd85f('0x31')],function(_0x3667c2){return{'name':_0x3667c2[_0xd85f('0x32')],'type':_0x3667c2[_0xd85f('0x33')]['key']};});_0x147dea[_0xd85f('0x34')]=_[_0xd85f('0x2f')](_0x5e2b03,_0xd85f('0x2c'));_0x147dea[_0xd85f('0x35')]=_['keys'](_0x3916e4['query']);_0x147dea[_0xd85f('0x36')]=_[_0xd85f('0x37')](_0x147dea['model'],_0x147dea[_0xd85f('0x35')]);_0x2139cb['attributes']=_[_0xd85f('0x37')](_0x147dea[_0xd85f('0x34')],qs[_0xd85f('0x38')](_0x3916e4['query'][_0xd85f('0x38')]));_0x2139cb[_0xd85f('0x39')]=_0x2139cb['attributes']['length']?_0x2139cb[_0xd85f('0x39')]:_0x147dea[_0xd85f('0x34')];if(!_0x3916e4[_0xd85f('0x35')]['hasOwnProperty']('nolimit')){_0x2139cb[_0xd85f('0x24')]=qs[_0xd85f('0x24')](_0x3916e4[_0xd85f('0x35')]['limit']);_0x2139cb[_0xd85f('0x22')]=qs[_0xd85f('0x22')](_0x3916e4[_0xd85f('0x35')][_0xd85f('0x22')]);}_0x2139cb[_0xd85f('0x3a')]=qs[_0xd85f('0x3b')](_0x3916e4['query'][_0xd85f('0x3b')]);_0x2139cb[_0xd85f('0x3c')]=qs[_0xd85f('0x36')](_[_0xd85f('0x3d')](_0x3916e4[_0xd85f('0x35')],_0x147dea['filters']),_0x5e2b03);if(_0x3916e4[_0xd85f('0x35')][_0xd85f('0x3e')]){_0x2139cb[_0xd85f('0x3c')]=_[_0xd85f('0x3f')](_0x2139cb[_0xd85f('0x3c')],{'$or':_[_0xd85f('0x2f')](_0x5e2b03,function(_0x5d695c){if(_0x5d695c[_0xd85f('0x33')]!==_0xd85f('0x40')){var _0x465bea={};_0x465bea[_0x5d695c[_0xd85f('0x2c')]]={'$like':'%'+_0x3916e4[_0xd85f('0x35')]['filter']+'%'};return _0x465bea;}})});}_0x2139cb=_[_0xd85f('0x3f')]({},_0x2139cb,_0x3916e4[_0xd85f('0x41')]);var _0x12b722={'where':_0x2139cb[_0xd85f('0x3c')]};return db[_0xd85f('0x30')]['count'](_0x12b722)[_0xd85f('0x2a')](function(_0x56da33){_0xcf4003[_0xd85f('0x25')]=_0x56da33;if(_0x3916e4[_0xd85f('0x35')][_0xd85f('0x42')]){_0x2139cb[_0xd85f('0x43')]=[{'all':!![]}];}return db['ZohoAccount'][_0xd85f('0x44')](_0x2139cb);})['then'](function(_0x115a0a){_0xcf4003['rows']=_0x115a0a;return _0xcf4003;})[_0xd85f('0x2a')](respondWithFilteredResult(_0x599f5a,_0x2139cb))[_0xd85f('0x45')](handleError(_0x599f5a,null));};exports['show']=function(_0xf33bee,_0x3448f1){var _0x49e2cc={'raw':![],'where':{'id':_0xf33bee['params']['id']}},_0x24c2bc={};_0x24c2bc[_0xd85f('0x34')]=_[_0xd85f('0x46')](db[_0xd85f('0x30')][_0xd85f('0x31')]);_0x24c2bc[_0xd85f('0x35')]=_['keys'](_0xf33bee[_0xd85f('0x35')]);_0x24c2bc[_0xd85f('0x36')]=_[_0xd85f('0x37')](_0x24c2bc[_0xd85f('0x34')],_0x24c2bc[_0xd85f('0x35')]);_0x49e2cc['attributes']=_[_0xd85f('0x37')](_0x24c2bc[_0xd85f('0x34')],qs[_0xd85f('0x38')](_0xf33bee[_0xd85f('0x35')][_0xd85f('0x38')]));_0x49e2cc[_0xd85f('0x39')]=_0x49e2cc[_0xd85f('0x39')][_0xd85f('0x47')]?_0x49e2cc[_0xd85f('0x39')]:_0x24c2bc['model'];if(_0xf33bee[_0xd85f('0x35')][_0xd85f('0x42')]){_0x49e2cc[_0xd85f('0x43')]=[{'all':!![]}];}_0x49e2cc=_[_0xd85f('0x3f')]({},_0x49e2cc,_0xf33bee[_0xd85f('0x41')]);return db[_0xd85f('0x30')]['find'](_0x49e2cc)['then'](handleEntityNotFound(_0x3448f1,null))[_0xd85f('0x2a')](respondWithResult(_0x3448f1,null))['catch'](handleError(_0x3448f1,null));};exports[_0xd85f('0x48')]=function(_0x11d216,_0x2fdbd3){return db[_0xd85f('0x30')][_0xd85f('0x48')](_0x11d216[_0xd85f('0x49')],{})['then'](respondWithResult(_0x2fdbd3,0xc9))[_0xd85f('0x45')](handleError(_0x2fdbd3,null));};exports[_0xd85f('0x4a')]=function(_0x14ce82,_0x460b76){if(_0x14ce82[_0xd85f('0x49')]['id']){delete _0x14ce82[_0xd85f('0x49')]['id'];}return db[_0xd85f('0x30')][_0xd85f('0x4b')]({'where':{'id':_0x14ce82[_0xd85f('0x4c')]['id']}})[_0xd85f('0x2a')](handleEntityNotFound(_0x460b76,null))['then'](saveUpdates(_0x14ce82[_0xd85f('0x49')],null))['then'](respondWithResult(_0x460b76,null))[_0xd85f('0x45')](handleError(_0x460b76,null));};exports[_0xd85f('0x4d')]=function(_0x59425e,_0x5f34d7){return db[_0xd85f('0x30')][_0xd85f('0x4b')]({'where':{'id':_0x59425e['params']['id']}})[_0xd85f('0x2a')](handleEntityNotFound(_0x5f34d7,null))['then'](removeEntity(_0x5f34d7,null))['catch'](handleError(_0x5f34d7,null));};exports[_0xd85f('0x4e')]=function(_0x1295e5,_0x5ea7e8,_0x4a1a5c){var _0x5e0819={};var _0x1abff4={};var _0x2849da;var _0x3c6c1d;return db[_0xd85f('0x30')][_0xd85f('0x4f')]({'where':{'id':_0x1295e5[_0xd85f('0x4c')]['id']}})[_0xd85f('0x2a')](handleEntityNotFound(_0x5ea7e8,null))[_0xd85f('0x2a')](function(_0xfbb033){if(_0xfbb033){_0x2849da=_0xfbb033;_0x1abff4['model']=_['keys'](db[_0xd85f('0x50')][_0xd85f('0x31')]);_0x1abff4[_0xd85f('0x35')]=_[_0xd85f('0x46')](_0x1295e5[_0xd85f('0x35')]);_0x1abff4['filters']=_[_0xd85f('0x37')](_0x1abff4[_0xd85f('0x34')],_0x1abff4[_0xd85f('0x35')]);_0x5e0819['attributes']=_[_0xd85f('0x37')](_0x1abff4[_0xd85f('0x34')],qs[_0xd85f('0x38')](_0x1295e5[_0xd85f('0x35')]['fields']));_0x5e0819['attributes']=_0x5e0819['attributes']['length']?_0x5e0819[_0xd85f('0x39')]:_0x1abff4[_0xd85f('0x34')];_0x5e0819[_0xd85f('0x3a')]=qs['sort'](_0x1295e5[_0xd85f('0x35')]['sort']);_0x5e0819[_0xd85f('0x3c')]=qs[_0xd85f('0x36')](_[_0xd85f('0x3d')](_0x1295e5[_0xd85f('0x35')],_0x1abff4[_0xd85f('0x36')]));if(_0x1295e5[_0xd85f('0x35')][_0xd85f('0x3e')]){_0x5e0819[_0xd85f('0x3c')]=_[_0xd85f('0x3f')](_0x5e0819[_0xd85f('0x3c')],{'$or':_['map'](_0x5e0819['attributes'],function(_0x33f88a){var _0xbfcb92={};_0xbfcb92[_0x33f88a]={'$like':'%'+_0x1295e5['query']['filter']+'%'};return _0xbfcb92;})});}_0x5e0819=_['merge']({},_0x5e0819,_0x1295e5[_0xd85f('0x41')]);return _0x2849da[_0xd85f('0x4e')](_0x5e0819);}})['then'](function(_0x56cc1b){if(_0x56cc1b){_0x3c6c1d=_0x56cc1b[_0xd85f('0x47')];if(!_0x1295e5['query'][_0xd85f('0x51')](_0xd85f('0x52'))){_0x5e0819['limit']=qs[_0xd85f('0x24')](_0x1295e5['query'][_0xd85f('0x24')]);_0x5e0819[_0xd85f('0x22')]=qs[_0xd85f('0x22')](_0x1295e5[_0xd85f('0x35')][_0xd85f('0x22')]);}return _0x2849da[_0xd85f('0x4e')](_0x5e0819);}})[_0xd85f('0x2a')](function(_0x4484c6){if(_0x4484c6){return _0x4484c6?{'count':_0x3c6c1d,'rows':_0x4484c6}:null;}})[_0xd85f('0x2a')](respondWithResult(_0x5ea7e8,null))[_0xd85f('0x45')](handleError(_0x5ea7e8,null));};exports['addConfiguration']=function(_0x10761c,_0x243caa,_0xdc68c8){if(_0x10761c['body']['id']){delete _0x10761c[_0xd85f('0x49')]['id'];}return db[_0xd85f('0x30')][_0xd85f('0x4f')]({'where':{'id':_0x10761c[_0xd85f('0x4c')]['id']}})[_0xd85f('0x2a')](handleEntityNotFound(_0x243caa,null))[_0xd85f('0x2a')](function(_0x3d34fd){if(_0x3d34fd){_0x10761c[_0xd85f('0x49')][_0xd85f('0x53')]=_0x3d34fd['id'];_0x10761c[_0xd85f('0x49')][_0xd85f('0x54')]=integrations[_0xd85f('0x55')](_0x10761c[_0xd85f('0x49')][_0xd85f('0x56')],_0x10761c[_0xd85f('0x49')]['type']);_0x10761c[_0xd85f('0x49')]['Descriptions']=integrations[_0xd85f('0x57')](_0x10761c[_0xd85f('0x49')][_0xd85f('0x56')],_0x10761c['body'][_0xd85f('0x33')]);return db['ZohoConfiguration'][_0xd85f('0x48')](_0x10761c[_0xd85f('0x49')],{'include':[{'model':db[_0xd85f('0x58')],'as':_0xd85f('0x54')},{'model':db['ZohoField'],'as':_0xd85f('0x59')}]});}return null;})[_0xd85f('0x2a')](respondWithResult(_0x243caa,null))[_0xd85f('0x45')](handleError(_0x243caa,null));};function getAccessToken(_0x2b2ff4){return new Promise(function(_0x27efec,_0x4f3a86){var _0x5c2523;switch(_0x2b2ff4[_0xd85f('0x5a')]){case'US':_0x5c2523='https://accounts.zoho.com';break;case'AU':_0x5c2523=_0xd85f('0x5b');break;case'EU':_0x5c2523=_0xd85f('0x5c');break;case'IN':_0x5c2523=_0xd85f('0x5d');break;case'CN':_0x5c2523=_0xd85f('0x5e');break;default:_0x5c2523=_0xd85f('0x5c');break;}var _0x33a171={'method':_0xd85f('0x5f'),'uri':_0x5c2523+_0xd85f('0x60'),'qs':{'refresh_token':_0x2b2ff4[_0xd85f('0x61')],'client_id':_0x2b2ff4[_0xd85f('0x62')],'client_secret':_0x2b2ff4[_0xd85f('0x63')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x33a171)['then'](function(_0x4a2b34){if(_0x4a2b34[_0xd85f('0x64')]){_0x27efec(_0x4a2b34[_0xd85f('0x64')]);}else{_0x4f3a86(_0xd85f('0x65'));}})['catch'](function(_0x28cac6){_0x4f3a86(_0x28cac6);});});}exports[_0xd85f('0x66')]=function(_0x2a8444,_0x2e8d0b,_0x2c2191){var _0x2d8a69,_0x24a580,_0x1dec9d,_0x511572,_0x3c5054;return db[_0xd85f('0x30')][_0xd85f('0x4f')]({'where':{'id':_0x2a8444[_0xd85f('0x4c')]['id']},'attributes':['id','host',_0xd85f('0x5a'),_0xd85f('0x62'),_0xd85f('0x63'),'serverUrl',_0xd85f('0x67'),'refreshToken']})[_0xd85f('0x2a')](handleEntityNotFound(_0x2e8d0b,null))['then'](function(_0x5d22c2){_0x3c5054=_0x5d22c2;_0x2d8a69=_0x3c5054[_0xd85f('0x68')];_0x24a580=_0x2d8a69==='zoho.eu'?'eu':_0xd85f('0x69');_0x1dec9d=_0x3c5054[_0xd85f('0x6a')];var _0xf0d606=_0x1dec9d['slice'](-0x1);if(_0xf0d606==='/'||_0xf0d606==='\x5c'||_0xf0d606===':'){_0x1dec9d=_0x1dec9d[_0xd85f('0x6b')](0x0,_0x1dec9d[_0xd85f('0x6c')](_0xf0d606));}if(!_0x3c5054[_0xd85f('0x61')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x3c5054);})[_0xd85f('0x2a')](function(_0x1ab738){if(_0x1ab738){return rp({'method':_0xd85f('0x6d'),'uri':util[_0xd85f('0x6e')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x24a580),'qs':{'module':_0xd85f('0x6f')},'headers':{'Authorization':_0xd85f('0x70')+_0x1ab738},'json':!![]});}})[_0xd85f('0x2a')](function(_0x47c559){if(_0x47c559){if(_0x47c559[_0xd85f('0x71')]&&_0x47c559[_0xd85f('0x71')]['error']){throw new Error(_0x47c559['response'][_0xd85f('0x72')][_0xd85f('0x73')]);}var _0x261259=[];var _0x3379cb=[];var _0xb7d973=[_0xd85f('0x74'),_0xd85f('0x75'),'Description',_0xd85f('0x76'),_0xd85f('0x77'),_0xd85f('0x78'),_0xd85f('0x79'),'Call_Type'];_0x3379cb=_[_0xd85f('0x7a')](_0x47c559['fields'],function(_0x31ca4f){return _0xb7d973[_0xd85f('0x7b')](_0x31ca4f[_0xd85f('0x7c')]);});for(var _0x35652a=0x0;_0x35652a<_0x3379cb['length'];_0x35652a++){if(_0x3379cb[_0x35652a][_0xd85f('0x7d')]===![]){_0x261259[_0xd85f('0x7e')]({'id':_0x3379cb[_0x35652a]['id'],'name':_0x3379cb[_0x35652a]['display_label'],'custom':_0x3379cb[_0x35652a][_0xd85f('0x7f')],'options':_0x3379cb[_0x35652a][_0xd85f('0x80')]===_0xd85f('0x81')&&_0x3379cb[_0x35652a][_0xd85f('0x82')][_0xd85f('0x47')]>-0x1?_[_0xd85f('0x2f')](_0x3379cb[_0x35652a][_0xd85f('0x82')],function(_0x9a0f4c){return{'name':_0x9a0f4c,'value':_0x9a0f4c};}):[]});}}return{'count':_0x261259['length'],'rows':_0x261259};}else{return{'count':0x0,'rows':[]};}})[_0xd85f('0x2a')](respondWithResult(_0x2e8d0b,null))[_0xd85f('0x45')](function(_0x2b3328){var _0x4fa8b6=_0x2a8444[_0xd85f('0x35')]['test']?0x1f4:_0x2b3328[_0xd85f('0x83')]||0x1f4;logger['error'](_0xd85f('0x84'),_0xd85f('0x66'),_0x4fa8b6,JSON[_0xd85f('0x85')](_0x2b3328));delete _0x2b3328[_0xd85f('0x2c')];if(_0x4fa8b6===0x191){_0x4fa8b6=0x190;}_0x2e8d0b['status'](_0x4fa8b6)[_0xd85f('0x2d')](_0x2a8444[_0xd85f('0x35')]['test']?{'message':_0xd85f('0x86'),'statusCode':_0x2b3328[_0xd85f('0x83')]}:_0x2b3328);});}; \ No newline at end of file +var _0xd2e1=['https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientSecret','serverUrl','code','host','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','zip-dir','fast-json-patch','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','ZohoAccount','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','includeAll','include','findAll','rows','catch','rawAttributes','filters','find','create','body','params','findOne','ZohoConfiguration','order','options','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','ZohoField','zone','https://accounts.zoho.com.au'];(function(_0x2f49f8,_0x344ea6){var _0x55f8ae=function(_0x496177){while(--_0x496177){_0x2f49f8['push'](_0x2f49f8['shift']());}};_0x55f8ae(++_0x344ea6);}(_0xd2e1,0x11e));var _0x1d2e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd2e1[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1d2e('0x0'));var jsonpatch=require(_0x1d2e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1d2e('0x2'));var Mustache=require(_0x1d2e('0x3'));var util=require('util');var path=require(_0x1d2e('0x4'));var sox=require(_0x1d2e('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d2e('0x6'));var _=require('lodash');var squel=require(_0x1d2e('0x7'));var crypto=require(_0x1d2e('0x8'));var jsforce=require(_0x1d2e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1d2e('0xa'));var querystring=require('querystring');var Papa=require(_0x1d2e('0xb'));var Redis=require(_0x1d2e('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1d2e('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d2e('0xe'));var logger=require(_0x1d2e('0xf'))(_0x1d2e('0x10'));var utils=require(_0x1d2e('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xbd3982,_0x587500){_0x587500=_0x587500||0xcc;return function(_0x5dcb9a){if(_0x5dcb9a){return _0xbd3982[_0x1d2e('0x12')](_0x587500);}return _0xbd3982[_0x1d2e('0x13')](_0x587500)['end']();};}function respondWithResult(_0x2fe637,_0x1e1daf){_0x1e1daf=_0x1e1daf||0xc8;return function(_0x261587){if(_0x261587){return _0x2fe637[_0x1d2e('0x13')](_0x1e1daf)['json'](_0x261587);}};}function respondWithFilteredResult(_0x3b8258,_0x3092c2){return function(_0x57e503){if(_0x57e503){var _0x5472ce=typeof _0x3092c2[_0x1d2e('0x14')]==='undefined'&&typeof _0x3092c2[_0x1d2e('0x15')]===_0x1d2e('0x16');var _0x5466c6=_0x57e503[_0x1d2e('0x17')];var _0xc6d93b=_0x5472ce?0x0:_0x3092c2[_0x1d2e('0x14')];var _0x22c368=_0x5472ce?_0x57e503[_0x1d2e('0x17')]:_0x3092c2['offset']+_0x3092c2[_0x1d2e('0x15')];var _0x543577;if(_0x22c368>=_0x5466c6){_0x22c368=_0x5466c6;_0x543577=0xc8;}else{_0x543577=0xce;}_0x3b8258[_0x1d2e('0x13')](_0x543577);return _0x3b8258[_0x1d2e('0x18')](_0x1d2e('0x19'),_0xc6d93b+'-'+_0x22c368+'/'+_0x5466c6)[_0x1d2e('0x1a')](_0x57e503);}return null;};}function patchUpdates(_0x297c8d){return function(_0x184839){try{jsonpatch[_0x1d2e('0x1b')](_0x184839,_0x297c8d,!![]);}catch(_0x546020){return BPromise[_0x1d2e('0x1c')](_0x546020);}return _0x184839[_0x1d2e('0x1d')]();};}function saveUpdates(_0x3fbc2e,_0x7098e5){return function(_0x59da8a){if(_0x59da8a){return _0x59da8a[_0x1d2e('0x1e')](_0x3fbc2e)['then'](function(_0x3c05d0){return _0x3c05d0;});}return null;};}function removeEntity(_0x312672,_0x47e6a0){return function(_0x2ad532){if(_0x2ad532){return _0x2ad532[_0x1d2e('0x1f')]()[_0x1d2e('0x20')](function(){_0x312672['status'](0xcc)[_0x1d2e('0x21')]();});}};}function handleEntityNotFound(_0x3ef7f0,_0x22bfc6){return function(_0x2663db){if(!_0x2663db){_0x3ef7f0[_0x1d2e('0x12')](0x194);}return _0x2663db;};}function handleError(_0x2cf17e,_0x2b0e7e){_0x2b0e7e=_0x2b0e7e||0x1f4;return function(_0x3a0d31){logger[_0x1d2e('0x22')](_0x3a0d31[_0x1d2e('0x23')]);if(_0x3a0d31[_0x1d2e('0x24')]){delete _0x3a0d31[_0x1d2e('0x24')];}_0x2cf17e[_0x1d2e('0x13')](_0x2b0e7e)[_0x1d2e('0x25')](_0x3a0d31);};}exports[_0x1d2e('0x26')]=function(_0x459eed,_0x598f3e){var _0x22dc8c={},_0x19dfbd={},_0x20d4bf={'count':0x0,'rows':[]};var _0x2ce07a=_['map'](db[_0x1d2e('0x27')]['rawAttributes'],function(_0x3cc400){return{'name':_0x3cc400[_0x1d2e('0x28')],'type':_0x3cc400[_0x1d2e('0x29')][_0x1d2e('0x2a')]};});_0x19dfbd['model']=_[_0x1d2e('0x2b')](_0x2ce07a,_0x1d2e('0x24'));_0x19dfbd[_0x1d2e('0x2c')]=_[_0x1d2e('0x2d')](_0x459eed[_0x1d2e('0x2c')]);_0x19dfbd['filters']=_[_0x1d2e('0x2e')](_0x19dfbd[_0x1d2e('0x2f')],_0x19dfbd[_0x1d2e('0x2c')]);_0x22dc8c[_0x1d2e('0x30')]=_[_0x1d2e('0x2e')](_0x19dfbd[_0x1d2e('0x2f')],qs[_0x1d2e('0x31')](_0x459eed[_0x1d2e('0x2c')]['fields']));_0x22dc8c[_0x1d2e('0x30')]=_0x22dc8c['attributes'][_0x1d2e('0x32')]?_0x22dc8c[_0x1d2e('0x30')]:_0x19dfbd[_0x1d2e('0x2f')];if(!_0x459eed[_0x1d2e('0x2c')][_0x1d2e('0x33')](_0x1d2e('0x34'))){_0x22dc8c[_0x1d2e('0x15')]=qs[_0x1d2e('0x15')](_0x459eed['query'][_0x1d2e('0x15')]);_0x22dc8c['offset']=qs[_0x1d2e('0x14')](_0x459eed[_0x1d2e('0x2c')]['offset']);}_0x22dc8c['order']=qs[_0x1d2e('0x35')](_0x459eed[_0x1d2e('0x2c')][_0x1d2e('0x35')]);_0x22dc8c['where']=qs['filters'](_[_0x1d2e('0x36')](_0x459eed[_0x1d2e('0x2c')],_0x19dfbd['filters']),_0x2ce07a);if(_0x459eed[_0x1d2e('0x2c')]['filter']){_0x22dc8c['where']=_[_0x1d2e('0x37')](_0x22dc8c[_0x1d2e('0x38')],{'$or':_[_0x1d2e('0x2b')](_0x2ce07a,function(_0x2a8a99){if(_0x2a8a99[_0x1d2e('0x29')]!=='VIRTUAL'){var _0x1d89d3={};_0x1d89d3[_0x2a8a99[_0x1d2e('0x24')]]={'$like':'%'+_0x459eed[_0x1d2e('0x2c')][_0x1d2e('0x39')]+'%'};return _0x1d89d3;}})});}_0x22dc8c=_[_0x1d2e('0x37')]({},_0x22dc8c,_0x459eed['options']);var _0x2e8a3e={'where':_0x22dc8c[_0x1d2e('0x38')]};return db[_0x1d2e('0x27')][_0x1d2e('0x17')](_0x2e8a3e)['then'](function(_0x4318ce){_0x20d4bf['count']=_0x4318ce;if(_0x459eed['query'][_0x1d2e('0x3a')]){_0x22dc8c[_0x1d2e('0x3b')]=[{'all':!![]}];}return db[_0x1d2e('0x27')][_0x1d2e('0x3c')](_0x22dc8c);})['then'](function(_0x2af488){_0x20d4bf[_0x1d2e('0x3d')]=_0x2af488;return _0x20d4bf;})[_0x1d2e('0x20')](respondWithFilteredResult(_0x598f3e,_0x22dc8c))[_0x1d2e('0x3e')](handleError(_0x598f3e,null));};exports['show']=function(_0x37f619,_0x357449){var _0x4bb03e={'raw':![],'where':{'id':_0x37f619['params']['id']}},_0x4a49b6={};_0x4a49b6['model']=_['keys'](db[_0x1d2e('0x27')][_0x1d2e('0x3f')]);_0x4a49b6[_0x1d2e('0x2c')]=_[_0x1d2e('0x2d')](_0x37f619[_0x1d2e('0x2c')]);_0x4a49b6[_0x1d2e('0x40')]=_['intersection'](_0x4a49b6['model'],_0x4a49b6['query']);_0x4bb03e[_0x1d2e('0x30')]=_[_0x1d2e('0x2e')](_0x4a49b6[_0x1d2e('0x2f')],qs[_0x1d2e('0x31')](_0x37f619[_0x1d2e('0x2c')]['fields']));_0x4bb03e['attributes']=_0x4bb03e[_0x1d2e('0x30')][_0x1d2e('0x32')]?_0x4bb03e['attributes']:_0x4a49b6[_0x1d2e('0x2f')];if(_0x37f619[_0x1d2e('0x2c')][_0x1d2e('0x3a')]){_0x4bb03e[_0x1d2e('0x3b')]=[{'all':!![]}];}_0x4bb03e=_[_0x1d2e('0x37')]({},_0x4bb03e,_0x37f619['options']);return db[_0x1d2e('0x27')][_0x1d2e('0x41')](_0x4bb03e)[_0x1d2e('0x20')](handleEntityNotFound(_0x357449,null))[_0x1d2e('0x20')](respondWithResult(_0x357449,null))[_0x1d2e('0x3e')](handleError(_0x357449,null));};exports[_0x1d2e('0x42')]=function(_0x1be520,_0x3948de){return db[_0x1d2e('0x27')][_0x1d2e('0x42')](_0x1be520[_0x1d2e('0x43')],{})['then'](respondWithResult(_0x3948de,0xc9))[_0x1d2e('0x3e')](handleError(_0x3948de,null));};exports[_0x1d2e('0x1e')]=function(_0x5201d1,_0x15f54d){if(_0x5201d1[_0x1d2e('0x43')]['id']){delete _0x5201d1[_0x1d2e('0x43')]['id'];}return db[_0x1d2e('0x27')][_0x1d2e('0x41')]({'where':{'id':_0x5201d1[_0x1d2e('0x44')]['id']}})[_0x1d2e('0x20')](handleEntityNotFound(_0x15f54d,null))[_0x1d2e('0x20')](saveUpdates(_0x5201d1[_0x1d2e('0x43')],null))['then'](respondWithResult(_0x15f54d,null))[_0x1d2e('0x3e')](handleError(_0x15f54d,null));};exports['destroy']=function(_0x2ef030,_0x177146){return db[_0x1d2e('0x27')][_0x1d2e('0x41')]({'where':{'id':_0x2ef030[_0x1d2e('0x44')]['id']}})['then'](handleEntityNotFound(_0x177146,null))['then'](removeEntity(_0x177146,null))[_0x1d2e('0x3e')](handleError(_0x177146,null));};exports['getConfigurations']=function(_0x2b30d2,_0x7995b9,_0x4d926d){var _0x4ffa16={};var _0x3dc4fe={};var _0x24cd35;var _0x396004;return db['ZohoAccount'][_0x1d2e('0x45')]({'where':{'id':_0x2b30d2[_0x1d2e('0x44')]['id']}})[_0x1d2e('0x20')](handleEntityNotFound(_0x7995b9,null))[_0x1d2e('0x20')](function(_0x38961c){if(_0x38961c){_0x24cd35=_0x38961c;_0x3dc4fe['model']=_[_0x1d2e('0x2d')](db[_0x1d2e('0x46')][_0x1d2e('0x3f')]);_0x3dc4fe[_0x1d2e('0x2c')]=_[_0x1d2e('0x2d')](_0x2b30d2[_0x1d2e('0x2c')]);_0x3dc4fe[_0x1d2e('0x40')]=_[_0x1d2e('0x2e')](_0x3dc4fe[_0x1d2e('0x2f')],_0x3dc4fe[_0x1d2e('0x2c')]);_0x4ffa16['attributes']=_[_0x1d2e('0x2e')](_0x3dc4fe[_0x1d2e('0x2f')],qs[_0x1d2e('0x31')](_0x2b30d2[_0x1d2e('0x2c')][_0x1d2e('0x31')]));_0x4ffa16[_0x1d2e('0x30')]=_0x4ffa16[_0x1d2e('0x30')][_0x1d2e('0x32')]?_0x4ffa16[_0x1d2e('0x30')]:_0x3dc4fe[_0x1d2e('0x2f')];_0x4ffa16[_0x1d2e('0x47')]=qs['sort'](_0x2b30d2[_0x1d2e('0x2c')][_0x1d2e('0x35')]);_0x4ffa16[_0x1d2e('0x38')]=qs['filters'](_[_0x1d2e('0x36')](_0x2b30d2[_0x1d2e('0x2c')],_0x3dc4fe['filters']));if(_0x2b30d2[_0x1d2e('0x2c')][_0x1d2e('0x39')]){_0x4ffa16[_0x1d2e('0x38')]=_[_0x1d2e('0x37')](_0x4ffa16[_0x1d2e('0x38')],{'$or':_[_0x1d2e('0x2b')](_0x4ffa16[_0x1d2e('0x30')],function(_0x12fc7b){var _0x5c9101={};_0x5c9101[_0x12fc7b]={'$like':'%'+_0x2b30d2['query']['filter']+'%'};return _0x5c9101;})});}_0x4ffa16=_[_0x1d2e('0x37')]({},_0x4ffa16,_0x2b30d2[_0x1d2e('0x48')]);return _0x24cd35[_0x1d2e('0x49')](_0x4ffa16);}})[_0x1d2e('0x20')](function(_0x349585){if(_0x349585){_0x396004=_0x349585[_0x1d2e('0x32')];if(!_0x2b30d2['query'][_0x1d2e('0x33')](_0x1d2e('0x34'))){_0x4ffa16['limit']=qs[_0x1d2e('0x15')](_0x2b30d2[_0x1d2e('0x2c')][_0x1d2e('0x15')]);_0x4ffa16[_0x1d2e('0x14')]=qs['offset'](_0x2b30d2[_0x1d2e('0x2c')][_0x1d2e('0x14')]);}return _0x24cd35[_0x1d2e('0x49')](_0x4ffa16);}})[_0x1d2e('0x20')](function(_0x4ed65b){if(_0x4ed65b){return _0x4ed65b?{'count':_0x396004,'rows':_0x4ed65b}:null;}})['then'](respondWithResult(_0x7995b9,null))[_0x1d2e('0x3e')](handleError(_0x7995b9,null));};exports[_0x1d2e('0x4a')]=function(_0x36b025,_0x29a01b,_0x174739){if(_0x36b025[_0x1d2e('0x43')]['id']){delete _0x36b025[_0x1d2e('0x43')]['id'];}return db[_0x1d2e('0x27')][_0x1d2e('0x45')]({'where':{'id':_0x36b025[_0x1d2e('0x44')]['id']}})[_0x1d2e('0x20')](handleEntityNotFound(_0x29a01b,null))[_0x1d2e('0x20')](function(_0x67a716){if(_0x67a716){_0x36b025['body']['AccountId']=_0x67a716['id'];_0x36b025['body']['Subjects']=integrations[_0x1d2e('0x4b')](_0x36b025[_0x1d2e('0x43')][_0x1d2e('0x4c')],_0x36b025[_0x1d2e('0x43')][_0x1d2e('0x29')]);_0x36b025[_0x1d2e('0x43')][_0x1d2e('0x4d')]=integrations[_0x1d2e('0x4e')](_0x36b025[_0x1d2e('0x43')][_0x1d2e('0x4c')],_0x36b025[_0x1d2e('0x43')]['type']);return db[_0x1d2e('0x46')][_0x1d2e('0x42')](_0x36b025[_0x1d2e('0x43')],{'include':[{'model':db['ZohoField'],'as':_0x1d2e('0x4f')},{'model':db[_0x1d2e('0x50')],'as':_0x1d2e('0x4d')}]});}return null;})[_0x1d2e('0x20')](respondWithResult(_0x29a01b,null))[_0x1d2e('0x3e')](handleError(_0x29a01b,null));};function getAccessToken(_0x4ca9d5){return new Promise(function(_0x667688,_0x118baa){var _0x2e951a;switch(_0x4ca9d5[_0x1d2e('0x51')]){case'US':_0x2e951a='https://accounts.zoho.com';break;case'AU':_0x2e951a=_0x1d2e('0x52');break;case'EU':_0x2e951a=_0x1d2e('0x53');break;case'IN':_0x2e951a='https://accounts.zoho.in';break;case'CN':_0x2e951a=_0x1d2e('0x54');break;default:_0x2e951a=_0x1d2e('0x53');break;}var _0x1167dd={'method':_0x1d2e('0x55'),'uri':_0x2e951a+_0x1d2e('0x56'),'qs':{'refresh_token':_0x4ca9d5[_0x1d2e('0x57')],'client_id':_0x4ca9d5[_0x1d2e('0x58')],'client_secret':_0x4ca9d5['clientSecret'],'grant_type':_0x1d2e('0x59')},'json':!![]};return rp(_0x1167dd)[_0x1d2e('0x20')](function(_0x193299){if(_0x193299['access_token']){_0x667688(_0x193299[_0x1d2e('0x5a')]);}else{_0x118baa(_0x1d2e('0x5b'));}})[_0x1d2e('0x3e')](function(_0x193d59){_0x118baa(_0x193d59);});});}exports['getFields']=function(_0x1aad8f,_0x111be6,_0x3dd3fe){var _0x1c7d30,_0x2c603e,_0x3045de,_0xae7f1a,_0x4408ce;return db['ZohoAccount'][_0x1d2e('0x45')]({'where':{'id':_0x1aad8f['params']['id']},'attributes':['id','host',_0x1d2e('0x51'),_0x1d2e('0x58'),_0x1d2e('0x5c'),_0x1d2e('0x5d'),_0x1d2e('0x5e'),_0x1d2e('0x57')]})['then'](handleEntityNotFound(_0x111be6,null))[_0x1d2e('0x20')](function(_0x35fae5){_0x4408ce=_0x35fae5;_0x1c7d30=_0x4408ce[_0x1d2e('0x5f')];_0x2c603e=_0x1c7d30===_0x1d2e('0x60')?'eu':_0x1d2e('0x61');_0x3045de=_0x4408ce[_0x1d2e('0x5d')];var _0x46f6f=_0x3045de['slice'](-0x1);if(_0x46f6f==='/'||_0x46f6f==='\x5c'||_0x46f6f===':'){_0x3045de=_0x3045de[_0x1d2e('0x62')](0x0,_0x3045de[_0x1d2e('0x63')](_0x46f6f));}if(!_0x4408ce[_0x1d2e('0x57')]){throw new Error(_0x1d2e('0x64'));}return getAccessToken(_0x4408ce);})[_0x1d2e('0x20')](function(_0x3475dd){if(_0x3475dd){return rp({'method':_0x1d2e('0x65'),'uri':util[_0x1d2e('0x66')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2c603e),'qs':{'module':_0x1d2e('0x67')},'headers':{'Authorization':_0x1d2e('0x68')+_0x3475dd},'json':!![]});}})[_0x1d2e('0x20')](function(_0x23a97d){if(_0x23a97d){if(_0x23a97d[_0x1d2e('0x69')]&&_0x23a97d[_0x1d2e('0x69')][_0x1d2e('0x22')]){throw new Error(_0x23a97d['response'][_0x1d2e('0x22')]['message']);}var _0x11a9f2=[];var _0x2ecbd9=[];var _0x1162b0=[_0x1d2e('0x6a'),'Subject','Description','WhoId',_0x1d2e('0x6b'),_0x1d2e('0x6c'),_0x1d2e('0x6d'),'Call_Type'];_0x2ecbd9=_[_0x1d2e('0x6e')](_0x23a97d[_0x1d2e('0x31')],function(_0x35454d){return _0x1162b0[_0x1d2e('0x6f')](_0x35454d[_0x1d2e('0x70')]);});for(var _0xf7c4fa=0x0;_0xf7c4fa<_0x2ecbd9['length'];_0xf7c4fa++){if(_0x2ecbd9[_0xf7c4fa][_0x1d2e('0x71')]===![]){_0x11a9f2[_0x1d2e('0x72')]({'id':_0x2ecbd9[_0xf7c4fa]['id'],'name':_0x2ecbd9[_0xf7c4fa][_0x1d2e('0x73')],'custom':_0x2ecbd9[_0xf7c4fa][_0x1d2e('0x74')],'options':_0x2ecbd9[_0xf7c4fa][_0x1d2e('0x75')]===_0x1d2e('0x76')&&_0x2ecbd9[_0xf7c4fa][_0x1d2e('0x77')][_0x1d2e('0x32')]>-0x1?_[_0x1d2e('0x2b')](_0x2ecbd9[_0xf7c4fa]['pick_list_values'],function(_0x1ec634){return{'name':_0x1ec634,'value':_0x1ec634};}):[]});}}return{'count':_0x11a9f2[_0x1d2e('0x32')],'rows':_0x11a9f2};}else{return{'count':0x0,'rows':[]};}})[_0x1d2e('0x20')](respondWithResult(_0x111be6,null))[_0x1d2e('0x3e')](function(_0x359e87){var _0x42096d=_0x1aad8f[_0x1d2e('0x2c')][_0x1d2e('0x78')]?0x1f4:_0x359e87[_0x1d2e('0x79')]||0x1f4;logger[_0x1d2e('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x42096d,JSON['stringify'](_0x359e87));delete _0x359e87[_0x1d2e('0x24')];if(_0x42096d===0x191){_0x42096d=0x190;}_0x111be6[_0x1d2e('0x13')](_0x42096d)[_0x1d2e('0x25')](_0x1aad8f['query'][_0x1d2e('0x78')]?{'message':_0x1d2e('0x7a'),'statusCode':_0x359e87[_0x1d2e('0x79')]}:_0x359e87);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e34a646..35b0ebd 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 _0x8651=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','host','slice','substring','/oauth/v2/token','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed','clientSecret','code','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x1fef5b,_0x1ff7ea){var _0x3db143=function(_0x10bcac){while(--_0x10bcac){_0x1fef5b['push'](_0x1fef5b['shift']());}};_0x3db143(++_0x1ff7ea);}(_0x8651,0x6e));var _0x1865=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8651[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1865('0x0'));var util=require(_0x1865('0x1'));var logger=require('../../config/logger')(_0x1865('0x2'));var moment=require(_0x1865('0x3'));var BPromise=require(_0x1865('0x4'));var rp=require(_0x1865('0x5'));var fs=require('fs');var path=require(_0x1865('0x6'));var rimraf=require('rimraf');var config=require(_0x1865('0x7'));var attributes=require(_0x1865('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x1865('0x9')]=function(_0x51343b,_0x451cd6){return _0x51343b[_0x1865('0xa')](_0x1865('0xb'),attributes,{'tableName':_0x1865('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3fb7e2,_0x340865,_0x2a65ae){if(_0x3fb7e2['changed'](_0x1865('0xd'))||_0x3fb7e2['changed'](_0x1865('0xe'))||_0x3fb7e2[_0x1865('0xf')]('clientId')||_0x3fb7e2[_0x1865('0xf')](_0x1865('0x10'))||_0x3fb7e2[_0x1865('0xf')](_0x1865('0x11'))||_0x3fb7e2['changed']('host')){var _0x543cd4,_0x76d5a1;_0x543cd4=_0x3fb7e2[_0x1865('0xe')];var _0x4fc744=_0x543cd4['slice'](-0x1);if(_0x4fc744==='/'||_0x4fc744==='\x5c'||_0x4fc744===':'){_0x543cd4=_0x543cd4['substring'](0x0,_0x543cd4[_0x1865('0x12')](_0x4fc744));}switch(_0x3fb7e2['zone']){case'US':_0x76d5a1=_0x1865('0x13');break;case'AU':_0x76d5a1=_0x1865('0x14');break;case'IN':_0x76d5a1=_0x1865('0x15');break;case'CN':_0x76d5a1=_0x1865('0x16');break;default:_0x76d5a1=_0x1865('0x17');break;}var _0x3f7639={'method':_0x1865('0x18'),'uri':_0x76d5a1+'/oauth/v2/token','form':{'grant_type':_0x1865('0x19'),'client_id':_0x3fb7e2[_0x1865('0x1a')],'client_secret':_0x3fb7e2['clientSecret'],'redirect_uri':_0x3fb7e2[_0x1865('0xe')],'code':_0x3fb7e2[_0x1865('0x11')]},'headers':{'Content-Type':_0x1865('0x1b')}};return rp(_0x3f7639)[_0x1865('0x1c')](function(_0x5b11cf){var _0x4b39d2=JSON[_0x1865('0x1d')](_0x5b11cf);if(_0x4b39d2[_0x1865('0x1e')]){_0x3fb7e2[_0x1865('0x1f')]=_0x4b39d2[_0x1865('0x1e')];logger[_0x1865('0x20')](util[_0x1865('0x21')](_0x1865('0x22'),_0x3fb7e2['name'],_0x3fb7e2['id']));}else{logger[_0x1865('0x23')](util[_0x1865('0x21')](_0x1865('0x24'),_0x3fb7e2[_0x1865('0x25')],_0x3fb7e2['id']),util[_0x1865('0x26')](_0x4b39d2,{'showHidden':![],'depth':null}));}return _0x2a65ae(null,_0x340865);})[_0x1865('0x27')](function(_0x4435c9){logger[_0x1865('0x23')](util[_0x1865('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3fb7e2[_0x1865('0x25')],_0x3fb7e2['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2a65ae(_0x4435c9);});}else{return _0x2a65ae(null,_0x340865);}},'beforeUpdate':function(_0x2df4ae,_0xa237c,_0x12fb63){if(_0x2df4ae[_0x1865('0xf')](_0x1865('0xd'))||_0x2df4ae[_0x1865('0xf')](_0x1865('0xe'))||_0x2df4ae[_0x1865('0xf')]('clientId')||_0x2df4ae[_0x1865('0xf')](_0x1865('0x10'))||_0x2df4ae[_0x1865('0xf')](_0x1865('0x11'))||_0x2df4ae[_0x1865('0xf')](_0x1865('0x28'))){var _0x1a0055,_0x164c66;_0x1a0055=_0x2df4ae[_0x1865('0xe')];var _0x3ca061=_0x1a0055[_0x1865('0x29')](-0x1);if(_0x3ca061==='/'||_0x3ca061==='\x5c'||_0x3ca061===':'){_0x1a0055=_0x1a0055[_0x1865('0x2a')](0x0,_0x1a0055['lastIndexOf'](_0x3ca061));}switch(_0x2df4ae[_0x1865('0xd')]){case'US':_0x164c66=_0x1865('0x13');break;case'AU':_0x164c66='https://accounts.zoho.com.au';break;case'IN':_0x164c66=_0x1865('0x15');break;case'CN':_0x164c66=_0x1865('0x16');break;default:_0x164c66=_0x1865('0x17');break;}var _0x599995={'method':_0x1865('0x18'),'uri':_0x164c66+_0x1865('0x2b'),'form':{'grant_type':_0x1865('0x19'),'client_id':_0x2df4ae[_0x1865('0x1a')],'client_secret':_0x2df4ae['clientSecret'],'redirect_uri':_0x2df4ae[_0x1865('0xe')],'code':_0x2df4ae['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x599995)[_0x1865('0x1c')](function(_0x4a4631){var _0x3f7b57=JSON[_0x1865('0x1d')](_0x4a4631);if(_0x3f7b57[_0x1865('0x1e')]){_0x2df4ae['refreshToken']=_0x3f7b57['refresh_token'];logger[_0x1865('0x20')](util[_0x1865('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2df4ae[_0x1865('0x25')],_0x2df4ae['id']));}else{logger['error'](util[_0x1865('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2df4ae[_0x1865('0x25')],_0x2df4ae['id']),util['inspect'](_0x3f7b57,{'showHidden':![],'depth':null}));}return _0x12fb63(null,_0xa237c);})[_0x1865('0x27')](function(_0x20e394){logger[_0x1865('0x23')](util[_0x1865('0x21')](_0x1865('0x24'),_0x2df4ae[_0x1865('0x25')],_0x2df4ae['id']),util[_0x1865('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x12fb63(_0x20e394);});}else{return _0x12fb63(null,_0xa237c);}}}});}; \ No newline at end of file +var _0x17fb=['slice','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','substring','https://accounts.zoho.com','https://accounts.zoho.com.cn','/oauth/v2/token','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId'];(function(_0x16f55d,_0x43c7fe){var _0x3f3706=function(_0x908684){while(--_0x908684){_0x16f55d['push'](_0x16f55d['shift']());}};_0x3f3706(++_0x43c7fe);}(_0x17fb,0xc1));var _0xb17f=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x17fb[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xb17f('0x0'));var util=require(_0xb17f('0x1'));var logger=require('../../config/logger')(_0xb17f('0x2'));var moment=require(_0xb17f('0x3'));var BPromise=require('bluebird');var rp=require(_0xb17f('0x4'));var fs=require('fs');var path=require(_0xb17f('0x5'));var rimraf=require(_0xb17f('0x6'));var config=require(_0xb17f('0x7'));var attributes=require(_0xb17f('0x8'));var integrations=require(_0xb17f('0x9'));module[_0xb17f('0xa')]=function(_0x5519f0,_0x1cd614){return _0x5519f0[_0xb17f('0xb')]('ZohoAccount',attributes,{'tableName':_0xb17f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3fabd0,_0x236020,_0x153dac){if(_0x3fabd0[_0xb17f('0xd')](_0xb17f('0xe'))||_0x3fabd0[_0xb17f('0xd')](_0xb17f('0xf'))||_0x3fabd0[_0xb17f('0xd')](_0xb17f('0x10'))||_0x3fabd0[_0xb17f('0xd')]('clientSecret')||_0x3fabd0[_0xb17f('0xd')]('code')||_0x3fabd0['changed']('host')){var _0x5ae3eb,_0x494789;_0x5ae3eb=_0x3fabd0['serverUrl'];var _0x185b52=_0x5ae3eb[_0xb17f('0x11')](-0x1);if(_0x185b52==='/'||_0x185b52==='\x5c'||_0x185b52===':'){_0x5ae3eb=_0x5ae3eb['substring'](0x0,_0x5ae3eb[_0xb17f('0x12')](_0x185b52));}switch(_0x3fabd0[_0xb17f('0xe')]){case'US':_0x494789='https://accounts.zoho.com';break;case'AU':_0x494789='https://accounts.zoho.com.au';break;case'IN':_0x494789=_0xb17f('0x13');break;case'CN':_0x494789='https://accounts.zoho.com.cn';break;default:_0x494789=_0xb17f('0x14');break;}var _0x258b7a={'method':_0xb17f('0x15'),'uri':_0x494789+'/oauth/v2/token','form':{'grant_type':_0xb17f('0x16'),'client_id':_0x3fabd0[_0xb17f('0x10')],'client_secret':_0x3fabd0[_0xb17f('0x17')],'redirect_uri':_0x3fabd0[_0xb17f('0xf')],'code':_0x3fabd0[_0xb17f('0x18')]},'headers':{'Content-Type':_0xb17f('0x19')}};return rp(_0x258b7a)[_0xb17f('0x1a')](function(_0x43d16d){var _0x341369=JSON[_0xb17f('0x1b')](_0x43d16d);if(_0x341369[_0xb17f('0x1c')]){_0x3fabd0[_0xb17f('0x1d')]=_0x341369['refresh_token'];logger[_0xb17f('0x1e')](util[_0xb17f('0x1f')](_0xb17f('0x20'),_0x3fabd0[_0xb17f('0x21')],_0x3fabd0['id']));}else{logger[_0xb17f('0x22')](util[_0xb17f('0x1f')](_0xb17f('0x23'),_0x3fabd0[_0xb17f('0x21')],_0x3fabd0['id']),util[_0xb17f('0x24')](_0x341369,{'showHidden':![],'depth':null}));}return _0x153dac(null,_0x236020);})[_0xb17f('0x25')](function(_0x4c3bd1){logger['error'](util[_0xb17f('0x1f')](_0xb17f('0x23'),_0x3fabd0['name'],_0x3fabd0['id']),util[_0xb17f('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x153dac(_0x4c3bd1);});}else{return _0x153dac(null,_0x236020);}},'beforeUpdate':function(_0x3f7ca0,_0x4025ff,_0x9aba46){if(_0x3f7ca0[_0xb17f('0xd')](_0xb17f('0xe'))||_0x3f7ca0[_0xb17f('0xd')](_0xb17f('0xf'))||_0x3f7ca0['changed'](_0xb17f('0x10'))||_0x3f7ca0[_0xb17f('0xd')](_0xb17f('0x17'))||_0x3f7ca0[_0xb17f('0xd')](_0xb17f('0x18'))||_0x3f7ca0[_0xb17f('0xd')]('host')){var _0x1f9b00,_0xa35d97;_0x1f9b00=_0x3f7ca0[_0xb17f('0xf')];var _0x439145=_0x1f9b00['slice'](-0x1);if(_0x439145==='/'||_0x439145==='\x5c'||_0x439145===':'){_0x1f9b00=_0x1f9b00[_0xb17f('0x26')](0x0,_0x1f9b00[_0xb17f('0x12')](_0x439145));}switch(_0x3f7ca0['zone']){case'US':_0xa35d97=_0xb17f('0x27');break;case'AU':_0xa35d97='https://accounts.zoho.com.au';break;case'IN':_0xa35d97=_0xb17f('0x13');break;case'CN':_0xa35d97=_0xb17f('0x28');break;default:_0xa35d97=_0xb17f('0x14');break;}var _0x5e48c1={'method':_0xb17f('0x15'),'uri':_0xa35d97+_0xb17f('0x29'),'form':{'grant_type':_0xb17f('0x16'),'client_id':_0x3f7ca0[_0xb17f('0x10')],'client_secret':_0x3f7ca0[_0xb17f('0x17')],'redirect_uri':_0x3f7ca0['serverUrl'],'code':_0x3f7ca0['code']},'headers':{'Content-Type':_0xb17f('0x19')}};return rp(_0x5e48c1)[_0xb17f('0x1a')](function(_0x4c9b8a){var _0x33eb23=JSON[_0xb17f('0x1b')](_0x4c9b8a);if(_0x33eb23[_0xb17f('0x1c')]){_0x3f7ca0[_0xb17f('0x1d')]=_0x33eb23[_0xb17f('0x1c')];logger[_0xb17f('0x1e')](util['format'](_0xb17f('0x20'),_0x3f7ca0[_0xb17f('0x21')],_0x3f7ca0['id']));}else{logger[_0xb17f('0x22')](util[_0xb17f('0x1f')](_0xb17f('0x23'),_0x3f7ca0[_0xb17f('0x21')],_0x3f7ca0['id']),util['inspect'](_0x33eb23,{'showHidden':![],'depth':null}));}return _0x9aba46(null,_0x4025ff);})[_0xb17f('0x25')](function(_0x4fda15){logger['error'](util[_0xb17f('0x1f')](_0xb17f('0x23'),_0x3f7ca0[_0xb17f('0x21')],_0x3f7ca0['id']),util[_0xb17f('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x9aba46(_0x4fda15);});}else{return _0x9aba46(null,_0x4025ff);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0640916..b55f601 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 _0xe558=['debug','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','findAll','options','raw','where','limit','include','map','attributes','model','GetZohoAccount'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xe558,0x70));var _0x8e55=function(_0x221f1b,_0xa94857){_0x221f1b=_0x221f1b-0x0;var _0x1f1522=_0xe558[_0x221f1b];return _0x1f1522;};'use strict';var _=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var moment=require(_0x8e55('0x2'));var BPromise=require(_0x8e55('0x3'));var rs=require(_0x8e55('0x4'));var fs=require('fs');var Redis=require(_0x8e55('0x5'));var db=require(_0x8e55('0x6'))['db'];var utils=require(_0x8e55('0x7'));var logger=require(_0x8e55('0x8'))('rpc');var config=require(_0x8e55('0x9'));var jayson=require(_0x8e55('0xa'));var client=jayson[_0x8e55('0xb')][_0x8e55('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cef42,_0x13c5db,_0x493307){return new BPromise(function(_0xe27f09,_0x429679){return client['request'](_0x3cef42,_0x493307)[_0x8e55('0xd')](function(_0x578110){logger['info'](_0x8e55('0xe'),_0x13c5db,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x13c5db,_0x8e55('0xf'),JSON[_0x8e55('0x10')](_0x578110));if(_0x578110[_0x8e55('0x11')]){if(_0x578110[_0x8e55('0x11')]['code']===0x1f4){logger[_0x8e55('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x13c5db,_0x578110['error']['message']);return _0x429679(_0x578110[_0x8e55('0x11')]['message']);}logger[_0x8e55('0x11')](_0x8e55('0xe'),_0x13c5db,_0x578110[_0x8e55('0x11')][_0x8e55('0x12')]);return _0xe27f09(_0x578110[_0x8e55('0x11')][_0x8e55('0x12')]);}else{logger[_0x8e55('0x13')](_0x8e55('0xe'),_0x13c5db,_0x8e55('0xf'));_0xe27f09(_0x578110[_0x8e55('0x14')][_0x8e55('0x12')]);}})[_0x8e55('0x15')](function(_0x202bc4){logger[_0x8e55('0x11')](_0x8e55('0xe'),_0x13c5db,_0x202bc4);_0x429679(_0x202bc4);});});}exports['GetZohoAccount']=function(_0xda8f1a){var _0x1e5d1f=this;return new Promise(function(_0x2d69e8,_0x3381c7){return db['ZohoAccount'][_0x8e55('0x16')]({'raw':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x18')]===undefined?!![]:![]:!![],'where':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x19')]||null:null,'attributes':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a['options']['attributes']||null:null,'limit':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x1a')]||null:null,'include':_0xda8f1a['options']?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x1b')],function(_0x25a8f3){return{'model':db[_0x25a8f3['model']],'as':_0x25a8f3['as'],'attributes':_0x25a8f3[_0x8e55('0x1d')],'include':_0x25a8f3[_0x8e55('0x1b')]?_['map'](_0x25a8f3[_0x8e55('0x1b')],function(_0x3f6fd8){return{'model':db[_0x3f6fd8[_0x8e55('0x1e')]],'as':_0x3f6fd8['as'],'attributes':_0x3f6fd8[_0x8e55('0x1d')],'include':_0x3f6fd8[_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0x3f6fd8[_0x8e55('0x1b')],function(_0x3b5d0f){return{'model':db[_0x3b5d0f[_0x8e55('0x1e')]],'as':_0x3b5d0f['as'],'attributes':_0x3b5d0f[_0x8e55('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8e55('0xd')](function(_0x5393e6){logger[_0x8e55('0x13')](_0x8e55('0x1f'),_0xda8f1a);logger[_0x8e55('0x20')](_0x8e55('0x1f'),_0xda8f1a,JSON['stringify'](_0x5393e6));_0x2d69e8(_0x5393e6);})[_0x8e55('0x15')](function(_0x4b96c9){logger[_0x8e55('0x11')](_0x8e55('0x1f'),_0x4b96c9['message'],_0xda8f1a);_0x3381c7(_0x1e5d1f[_0x8e55('0x11')](0x1f4,_0x4b96c9[_0x8e55('0x12')]));});});};exports[_0x8e55('0x21')]=function(_0x52b0d8){var _0x3a8c4d=this;return new Promise(function(_0x1228b3,_0x259d91){return db[_0x8e55('0x22')][_0x8e55('0x23')]({'raw':_0x52b0d8[_0x8e55('0x17')]?_0x52b0d8[_0x8e55('0x17')][_0x8e55('0x18')]===undefined?!![]:![]:!![],'where':_0x52b0d8['options']?_0x52b0d8['options']['where']||null:null,'attributes':_0x52b0d8[_0x8e55('0x17')]?_0x52b0d8[_0x8e55('0x17')][_0x8e55('0x1d')]||null:null,'include':_0x52b0d8['options']?_0x52b0d8[_0x8e55('0x17')]['include']?_['map'](_0x52b0d8[_0x8e55('0x17')][_0x8e55('0x1b')],function(_0x519a3f){return{'model':db[_0x519a3f[_0x8e55('0x1e')]],'as':_0x519a3f['as'],'attributes':_0x519a3f[_0x8e55('0x1d')],'include':_0x519a3f[_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0x519a3f[_0x8e55('0x1b')],function(_0x5f11f0){return{'model':db[_0x5f11f0[_0x8e55('0x1e')]],'as':_0x5f11f0['as'],'attributes':_0x5f11f0[_0x8e55('0x1d')],'include':_0x5f11f0[_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0x5f11f0['include'],function(_0x11c458){return{'model':db[_0x11c458[_0x8e55('0x1e')]],'as':_0x11c458['as'],'attributes':_0x11c458[_0x8e55('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e3dc){logger[_0x8e55('0x13')](_0x8e55('0x21'),_0x52b0d8);logger[_0x8e55('0x20')](_0x8e55('0x21'),_0x52b0d8,JSON[_0x8e55('0x10')](_0x17e3dc));_0x1228b3(_0x17e3dc);})['catch'](function(_0x40f69d){logger[_0x8e55('0x11')](_0x8e55('0x21'),_0x40f69d[_0x8e55('0x12')],_0x52b0d8);_0x259d91(_0x3a8c4d[_0x8e55('0x11')](0x1f4,_0x40f69d[_0x8e55('0x12')]));});});}; \ No newline at end of file +var _0x7da6=['options','attributes','include','map','model','then','GetZohoAccount','stringify','ShowZohoAccount','find','raw','where','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ZohoAccount','findAll'];(function(_0x7a3e1b,_0x206afb){var _0x258916=function(_0x28a323){while(--_0x28a323){_0x7a3e1b['push'](_0x7a3e1b['shift']());}};_0x258916(++_0x206afb);}(_0x7da6,0x124));var _0x67da=function(_0x325bc4,_0x4df462){_0x325bc4=_0x325bc4-0x0;var _0x330091=_0x7da6[_0x325bc4];return _0x330091;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x67da('0x0'));var BPromise=require(_0x67da('0x1'));var rs=require(_0x67da('0x2'));var fs=require('fs');var Redis=require(_0x67da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x67da('0x4'));var logger=require(_0x67da('0x5'))(_0x67da('0x6'));var config=require(_0x67da('0x7'));var jayson=require(_0x67da('0x8'));var client=jayson[_0x67da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb7f52,_0x49025f,_0x4cfe49){return new BPromise(function(_0x3d971d,_0x5ac004){return client[_0x67da('0xa')](_0xb7f52,_0x4cfe49)['then'](function(_0x1e8a4c){logger[_0x67da('0xb')](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));logger[_0x67da('0xe')](_0x67da('0xf'),_0x49025f,_0x67da('0xd'),JSON['stringify'](_0x1e8a4c));if(_0x1e8a4c[_0x67da('0x10')]){if(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x11')]===0x1f4){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x5ac004(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x3d971d(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}else{logger['info'](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));_0x3d971d(_0x1e8a4c[_0x67da('0x13')][_0x67da('0x12')]);}})[_0x67da('0x14')](function(_0xb3a67){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0xb3a67);_0x5ac004(_0xb3a67);});});}exports['GetZohoAccount']=function(_0xaefe69){var _0x524819=this;return new Promise(function(_0x31454f,_0x5765d5){return db[_0x67da('0x15')][_0x67da('0x16')]({'raw':_0xaefe69[_0x67da('0x17')]?_0xaefe69[_0x67da('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xaefe69[_0x67da('0x17')]?_0xaefe69['options']['where']||null:null,'attributes':_0xaefe69[_0x67da('0x17')]?_0xaefe69[_0x67da('0x17')][_0x67da('0x18')]||null:null,'limit':_0xaefe69[_0x67da('0x17')]?_0xaefe69['options']['limit']||null:null,'include':_0xaefe69['options']?_0xaefe69[_0x67da('0x17')][_0x67da('0x19')]?_[_0x67da('0x1a')](_0xaefe69[_0x67da('0x17')][_0x67da('0x19')],function(_0x4e6cb1){return{'model':db[_0x4e6cb1['model']],'as':_0x4e6cb1['as'],'attributes':_0x4e6cb1[_0x67da('0x18')],'include':_0x4e6cb1[_0x67da('0x19')]?_['map'](_0x4e6cb1[_0x67da('0x19')],function(_0x599a9d){return{'model':db[_0x599a9d[_0x67da('0x1b')]],'as':_0x599a9d['as'],'attributes':_0x599a9d[_0x67da('0x18')],'include':_0x599a9d[_0x67da('0x19')]?_[_0x67da('0x1a')](_0x599a9d[_0x67da('0x19')],function(_0x35b1bc){return{'model':db[_0x35b1bc['model']],'as':_0x35b1bc['as'],'attributes':_0x35b1bc[_0x67da('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67da('0x1c')](function(_0x5875d9){logger['info'](_0x67da('0x1d'),_0xaefe69);logger[_0x67da('0xe')](_0x67da('0x1d'),_0xaefe69,JSON[_0x67da('0x1e')](_0x5875d9));_0x31454f(_0x5875d9);})['catch'](function(_0x1cba18){logger[_0x67da('0x10')](_0x67da('0x1d'),_0x1cba18[_0x67da('0x12')],_0xaefe69);_0x5765d5(_0x524819[_0x67da('0x10')](0x1f4,_0x1cba18[_0x67da('0x12')]));});});};exports[_0x67da('0x1f')]=function(_0x1e2bd0){var _0x36d143=this;return new Promise(function(_0x91fc5c,_0x18dd99){return db[_0x67da('0x15')][_0x67da('0x20')]({'raw':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0['options'][_0x67da('0x21')]===undefined?!![]:![]:!![],'where':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0[_0x67da('0x17')][_0x67da('0x22')]||null:null,'attributes':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0[_0x67da('0x17')]['attributes']||null:null,'include':_0x1e2bd0[_0x67da('0x17')]?_0x1e2bd0[_0x67da('0x17')][_0x67da('0x19')]?_['map'](_0x1e2bd0['options']['include'],function(_0x4cfcab){return{'model':db[_0x4cfcab[_0x67da('0x1b')]],'as':_0x4cfcab['as'],'attributes':_0x4cfcab['attributes'],'include':_0x4cfcab[_0x67da('0x19')]?_[_0x67da('0x1a')](_0x4cfcab[_0x67da('0x19')],function(_0x21c253){return{'model':db[_0x21c253[_0x67da('0x1b')]],'as':_0x21c253['as'],'attributes':_0x21c253[_0x67da('0x18')],'include':_0x21c253[_0x67da('0x19')]?_[_0x67da('0x1a')](_0x21c253[_0x67da('0x19')],function(_0x11ec02){return{'model':db[_0x11ec02[_0x67da('0x1b')]],'as':_0x11ec02['as'],'attributes':_0x11ec02[_0x67da('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67da('0x1c')](function(_0x1348bb){logger[_0x67da('0xb')](_0x67da('0x1f'),_0x1e2bd0);logger[_0x67da('0xe')](_0x67da('0x1f'),_0x1e2bd0,JSON[_0x67da('0x1e')](_0x1348bb));_0x91fc5c(_0x1348bb);})[_0x67da('0x14')](function(_0xa96a4e){logger[_0x67da('0x10')](_0x67da('0x1f'),_0xa96a4e[_0x67da('0x12')],_0x1e2bd0);_0x18dd99(_0x36d143[_0x67da('0x10')](0x1f4,_0xa96a4e[_0x67da('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2184351..025ebc9 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 _0x0fd2=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x0fd2,0x190));var _0x20fd=function(_0x2bc4dd,_0x9b5c70){_0x2bc4dd=_0x2bc4dd-0x0;var _0x294b2a=_0x0fd2[_0x2bc4dd];return _0x294b2a;};'use strict';var multer=require(_0x20fd('0x0'));var util=require(_0x20fd('0x1'));var path=require(_0x20fd('0x2'));var timeout=require(_0x20fd('0x3'));var express=require(_0x20fd('0x4'));var router=express['Router']();var fs_extra=require(_0x20fd('0x5'));var auth=require(_0x20fd('0x6'));var interaction=require(_0x20fd('0x7'));var config=require(_0x20fd('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0x20fd('0x9')]('/',auth['isAuthenticated'](),controller[_0x20fd('0xa')]);router['get'](_0x20fd('0xb'),auth[_0x20fd('0xc')](),controller['show']);router[_0x20fd('0x9')](_0x20fd('0xd'),auth[_0x20fd('0xc')](),controller[_0x20fd('0xe')]);router[_0x20fd('0x9')](_0x20fd('0xf'),auth[_0x20fd('0xc')](),controller[_0x20fd('0x10')]);router[_0x20fd('0x9')]('/:id/descriptions',auth[_0x20fd('0xc')](),controller[_0x20fd('0x11')]);router[_0x20fd('0x12')]('/',auth[_0x20fd('0xc')](),controller[_0x20fd('0x13')]);router[_0x20fd('0x14')](_0x20fd('0xb'),auth[_0x20fd('0xc')](),controller[_0x20fd('0x15')]);router[_0x20fd('0x16')]('/:id',auth[_0x20fd('0xc')](),controller[_0x20fd('0x17')]);module[_0x20fd('0x18')]=router; \ No newline at end of file +var _0x8a87=['./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','create','put','update','delete','exports','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x8a87,0x176));var _0x78a8=function(_0x3f7855,_0x535342){_0x3f7855=_0x3f7855-0x0;var _0x301fb7=_0x8a87[_0x3f7855];return _0x301fb7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78a8('0x0')]();var fs_extra=require(_0x78a8('0x1'));var auth=require(_0x78a8('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x78a8('0x3'));var controller=require(_0x78a8('0x4'));router[_0x78a8('0x5')]('/',auth[_0x78a8('0x6')](),controller[_0x78a8('0x7')]);router[_0x78a8('0x5')](_0x78a8('0x8'),auth[_0x78a8('0x6')](),controller[_0x78a8('0x9')]);router[_0x78a8('0x5')](_0x78a8('0xa'),auth[_0x78a8('0x6')](),controller[_0x78a8('0xb')]);router[_0x78a8('0x5')]('/:id/subjects',auth[_0x78a8('0x6')](),controller['getSubjects']);router[_0x78a8('0x5')](_0x78a8('0xc'),auth[_0x78a8('0x6')](),controller['getDescriptions']);router['post']('/',auth[_0x78a8('0x6')](),controller[_0x78a8('0xd')]);router[_0x78a8('0xe')](_0x78a8('0x8'),auth[_0x78a8('0x6')](),controller[_0x78a8('0xf')]);router[_0x78a8('0x10')](_0x78a8('0x8'),auth[_0x78a8('0x6')](),controller['destroy']);module[_0x78a8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index c9985ab..1816793 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 _0xea8e=['contact','sequelize','STRING','ENUM','nothing','lead','contact_lead'];(function(_0x2f35ac,_0x3ddeec){var _0x5cbfff=function(_0x93c7e9){while(--_0x93c7e9){_0x2f35ac['push'](_0x2f35ac['shift']());}};_0x5cbfff(++_0x3ddeec);}(_0xea8e,0x1ba));var _0xeea8=function(_0x56f0b2,_0xdcf225){_0x56f0b2=_0x56f0b2-0x0;var _0x194f36=_0xea8e[_0x56f0b2];return _0x194f36;};'use strict';var Sequelize=require(_0xeea8('0x0'));module['exports']={'name':{'type':Sequelize[_0xeea8('0x1')]},'moduleCreate':{'type':Sequelize[_0xeea8('0x2')]('lead','contact',_0xeea8('0x3')),'defaultValue':_0xeea8('0x4')},'moduleSearch':{'type':Sequelize[_0xeea8('0x2')](_0xeea8('0x5'),_0xeea8('0x6'),_0xeea8('0x4')),'defaultValue':_0xeea8('0x5')},'description':{'type':Sequelize[_0xeea8('0x1')]}}; \ No newline at end of file +var _0x65d3=['lead','contact_lead','exports','STRING','ENUM','contact'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x65d3,0x134));var _0x365d=function(_0x4b25f6,_0x22d2ac){_0x4b25f6=_0x4b25f6-0x0;var _0x4cb200=_0x65d3[_0x4b25f6];return _0x4cb200;};'use strict';var Sequelize=require('sequelize');module[_0x365d('0x0')]={'name':{'type':Sequelize[_0x365d('0x1')]},'moduleCreate':{'type':Sequelize[_0x365d('0x2')]('lead',_0x365d('0x3'),'nothing'),'defaultValue':_0x365d('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x365d('0x5'),_0x365d('0x3'),_0x365d('0x4')),'defaultValue':_0x365d('0x5')},'description':{'type':Sequelize[_0x365d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 10be368..7cd37db 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 _0x5af3=['show','params','keys','find','create','body','destroy','getFields','findOne','ZohoField','rawAttributes','length','pick','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','ZohoConfiguration','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x2709bd,_0x274e31){var _0x4b5d5c=function(_0x5f3a3b){while(--_0x5f3a3b){_0x2709bd['push'](_0x2709bd['shift']());}};_0x4b5d5c(++_0x274e31);}(_0x5af3,0xac));var _0x35af=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x5af3[_0xdc37a1];return _0x99b4fe;};'use strict';var emlformat=require(_0x35af('0x0'));var rimraf=require(_0x35af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x35af('0x2'));var moment=require('moment');var BPromise=require(_0x35af('0x3'));var Mustache=require(_0x35af('0x4'));var util=require('util');var path=require(_0x35af('0x5'));var sox=require(_0x35af('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35af('0x7'));var _=require(_0x35af('0x8'));var squel=require(_0x35af('0x9'));var crypto=require(_0x35af('0xa'));var jsforce=require(_0x35af('0xb'));var deskjs=require(_0x35af('0xc'));var toCsv=require('to-csv');var querystring=require(_0x35af('0xd'));var Papa=require(_0x35af('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x35af('0xf'));var hardwareService=require(_0x35af('0x10'));var logger=require(_0x35af('0x11'))(_0x35af('0x12'));var utils=require(_0x35af('0x13'));var config=require(_0x35af('0x14'));var licenseUtil=require(_0x35af('0x15'));var db=require(_0x35af('0x16'))['db'];function respondWithStatusCode(_0x388132,_0x2e726a){_0x2e726a=_0x2e726a||0xcc;return function(_0x5bce94){if(_0x5bce94){return _0x388132[_0x35af('0x17')](_0x2e726a);}return _0x388132[_0x35af('0x18')](_0x2e726a)[_0x35af('0x19')]();};}function respondWithResult(_0x21db0c,_0x4e534a){_0x4e534a=_0x4e534a||0xc8;return function(_0x112d17){if(_0x112d17){return _0x21db0c[_0x35af('0x18')](_0x4e534a)['json'](_0x112d17);}};}function respondWithFilteredResult(_0x3363d5,_0x28b91d){return function(_0x8c5cdd){if(_0x8c5cdd){var _0x5602bf=typeof _0x28b91d[_0x35af('0x1a')]===_0x35af('0x1b')&&typeof _0x28b91d[_0x35af('0x1c')]===_0x35af('0x1b');var _0x290af3=_0x8c5cdd[_0x35af('0x1d')];var _0x42d7bc=_0x5602bf?0x0:_0x28b91d[_0x35af('0x1a')];var _0x147b57=_0x5602bf?_0x8c5cdd[_0x35af('0x1d')]:_0x28b91d[_0x35af('0x1a')]+_0x28b91d[_0x35af('0x1c')];var _0x182017;if(_0x147b57>=_0x290af3){_0x147b57=_0x290af3;_0x182017=0xc8;}else{_0x182017=0xce;}_0x3363d5[_0x35af('0x18')](_0x182017);return _0x3363d5['set'](_0x35af('0x1e'),_0x42d7bc+'-'+_0x147b57+'/'+_0x290af3)[_0x35af('0x1f')](_0x8c5cdd);}return null;};}function patchUpdates(_0x219a34){return function(_0x42aaa9){try{jsonpatch[_0x35af('0x20')](_0x42aaa9,_0x219a34,!![]);}catch(_0x13dd7b){return BPromise[_0x35af('0x21')](_0x13dd7b);}return _0x42aaa9['save']();};}function saveUpdates(_0xb26e58,_0x5da25c){return function(_0x568dea){if(_0x568dea){return _0x568dea[_0x35af('0x22')](_0xb26e58)[_0x35af('0x23')](function(_0x45a273){return _0x45a273;});}return null;};}function removeEntity(_0x3c1dfc,_0x17d804){return function(_0x370924){if(_0x370924){return _0x370924['destroy']()[_0x35af('0x23')](function(){_0x3c1dfc[_0x35af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8f9d,_0x1d6012){return function(_0x55d14a){if(!_0x55d14a){_0x5a8f9d['sendStatus'](0x194);}return _0x55d14a;};}function handleError(_0x2bb49f,_0x3818b6){_0x3818b6=_0x3818b6||0x1f4;return function(_0x4b813a){logger['error'](_0x4b813a[_0x35af('0x24')]);if(_0x4b813a[_0x35af('0x25')]){delete _0x4b813a[_0x35af('0x25')];}_0x2bb49f[_0x35af('0x18')](_0x3818b6)[_0x35af('0x26')](_0x4b813a);};}exports[_0x35af('0x27')]=function(_0x75517e,_0x537493){var _0x52e5c1={},_0x18f341={},_0x29d250={'count':0x0,'rows':[]};var _0x4015d1=_[_0x35af('0x28')](db[_0x35af('0x29')]['rawAttributes'],function(_0x43369e){return{'name':_0x43369e[_0x35af('0x2a')],'type':_0x43369e[_0x35af('0x2b')]['key']};});_0x18f341['model']=_[_0x35af('0x28')](_0x4015d1,_0x35af('0x25'));_0x18f341['query']=_['keys'](_0x75517e[_0x35af('0x2c')]);_0x18f341[_0x35af('0x2d')]=_[_0x35af('0x2e')](_0x18f341[_0x35af('0x2f')],_0x18f341['query']);_0x52e5c1[_0x35af('0x30')]=_['intersection'](_0x18f341[_0x35af('0x2f')],qs[_0x35af('0x31')](_0x75517e[_0x35af('0x2c')][_0x35af('0x31')]));_0x52e5c1['attributes']=_0x52e5c1[_0x35af('0x30')]['length']?_0x52e5c1[_0x35af('0x30')]:_0x18f341['model'];if(!_0x75517e[_0x35af('0x2c')]['hasOwnProperty'](_0x35af('0x32'))){_0x52e5c1[_0x35af('0x1c')]=qs[_0x35af('0x1c')](_0x75517e[_0x35af('0x2c')]['limit']);_0x52e5c1['offset']=qs[_0x35af('0x1a')](_0x75517e[_0x35af('0x2c')][_0x35af('0x1a')]);}_0x52e5c1[_0x35af('0x33')]=qs[_0x35af('0x34')](_0x75517e[_0x35af('0x2c')][_0x35af('0x34')]);_0x52e5c1[_0x35af('0x35')]=qs[_0x35af('0x2d')](_['pick'](_0x75517e[_0x35af('0x2c')],_0x18f341[_0x35af('0x2d')]),_0x4015d1);if(_0x75517e[_0x35af('0x2c')][_0x35af('0x36')]){_0x52e5c1[_0x35af('0x35')]=_[_0x35af('0x37')](_0x52e5c1[_0x35af('0x35')],{'$or':_['map'](_0x4015d1,function(_0x5ad8ea){if(_0x5ad8ea[_0x35af('0x2b')]!==_0x35af('0x38')){var _0x29cb79={};_0x29cb79[_0x5ad8ea[_0x35af('0x25')]]={'$like':'%'+_0x75517e[_0x35af('0x2c')][_0x35af('0x36')]+'%'};return _0x29cb79;}})});}_0x52e5c1=_[_0x35af('0x37')]({},_0x52e5c1,_0x75517e[_0x35af('0x39')]);var _0x3fad1d={'where':_0x52e5c1[_0x35af('0x35')]};return db[_0x35af('0x29')]['count'](_0x3fad1d)[_0x35af('0x23')](function(_0x28cbb7){_0x29d250['count']=_0x28cbb7;if(_0x75517e[_0x35af('0x2c')][_0x35af('0x3a')]){_0x52e5c1[_0x35af('0x3b')]=[{'all':!![]}];}return db[_0x35af('0x29')][_0x35af('0x3c')](_0x52e5c1);})[_0x35af('0x23')](function(_0x2ad7fa){_0x29d250['rows']=_0x2ad7fa;return _0x29d250;})[_0x35af('0x23')](respondWithFilteredResult(_0x537493,_0x52e5c1))[_0x35af('0x3d')](handleError(_0x537493,null));};exports[_0x35af('0x3e')]=function(_0x47389a,_0x116015){var _0x94aa89={'raw':![],'where':{'id':_0x47389a[_0x35af('0x3f')]['id']}},_0x4e4ddd={};_0x4e4ddd[_0x35af('0x2f')]=_['keys'](db[_0x35af('0x29')]['rawAttributes']);_0x4e4ddd[_0x35af('0x2c')]=_[_0x35af('0x40')](_0x47389a[_0x35af('0x2c')]);_0x4e4ddd[_0x35af('0x2d')]=_['intersection'](_0x4e4ddd['model'],_0x4e4ddd[_0x35af('0x2c')]);_0x94aa89[_0x35af('0x30')]=_[_0x35af('0x2e')](_0x4e4ddd[_0x35af('0x2f')],qs[_0x35af('0x31')](_0x47389a[_0x35af('0x2c')][_0x35af('0x31')]));_0x94aa89[_0x35af('0x30')]=_0x94aa89[_0x35af('0x30')]['length']?_0x94aa89[_0x35af('0x30')]:_0x4e4ddd[_0x35af('0x2f')];if(_0x47389a[_0x35af('0x2c')]['includeAll']){_0x94aa89['include']=[{'all':!![]}];}_0x94aa89=_[_0x35af('0x37')]({},_0x94aa89,_0x47389a[_0x35af('0x39')]);return db[_0x35af('0x29')][_0x35af('0x41')](_0x94aa89)['then'](handleEntityNotFound(_0x116015,null))[_0x35af('0x23')](respondWithResult(_0x116015,null))[_0x35af('0x3d')](handleError(_0x116015,null));};exports[_0x35af('0x42')]=function(_0x1253e7,_0x3d801a){return db[_0x35af('0x29')]['create'](_0x1253e7['body'],{})[_0x35af('0x23')](respondWithResult(_0x3d801a,0xc9))[_0x35af('0x3d')](handleError(_0x3d801a,null));};exports[_0x35af('0x22')]=function(_0x538379,_0x233098){if(_0x538379['body']['id']){delete _0x538379[_0x35af('0x43')]['id'];}return db[_0x35af('0x29')]['find']({'where':{'id':_0x538379[_0x35af('0x3f')]['id']}})[_0x35af('0x23')](handleEntityNotFound(_0x233098,null))[_0x35af('0x23')](saveUpdates(_0x538379[_0x35af('0x43')],null))[_0x35af('0x23')](respondWithResult(_0x233098,null))[_0x35af('0x3d')](handleError(_0x233098,null));};exports[_0x35af('0x44')]=function(_0x1a87f9,_0x108865){return db[_0x35af('0x29')]['find']({'where':{'id':_0x1a87f9[_0x35af('0x3f')]['id']}})[_0x35af('0x23')](handleEntityNotFound(_0x108865,null))[_0x35af('0x23')](removeEntity(_0x108865,null))[_0x35af('0x3d')](handleError(_0x108865,null));};exports[_0x35af('0x45')]=function(_0x2e8cd9,_0x484492,_0x586fa6){var _0x3bc2af={};var _0x35d5c1={};var _0x3b0642;var _0x32b097;return db[_0x35af('0x29')][_0x35af('0x46')]({'where':{'id':_0x2e8cd9[_0x35af('0x3f')]['id']}})['then'](handleEntityNotFound(_0x484492,null))['then'](function(_0x480b8d){if(_0x480b8d){_0x3b0642=_0x480b8d;_0x35d5c1[_0x35af('0x2f')]=_['keys'](db[_0x35af('0x47')][_0x35af('0x48')]);_0x35d5c1[_0x35af('0x2c')]=_[_0x35af('0x40')](_0x2e8cd9[_0x35af('0x2c')]);_0x35d5c1[_0x35af('0x2d')]=_[_0x35af('0x2e')](_0x35d5c1[_0x35af('0x2f')],_0x35d5c1[_0x35af('0x2c')]);_0x3bc2af['attributes']=_[_0x35af('0x2e')](_0x35d5c1[_0x35af('0x2f')],qs[_0x35af('0x31')](_0x2e8cd9['query'][_0x35af('0x31')]));_0x3bc2af['attributes']=_0x3bc2af[_0x35af('0x30')][_0x35af('0x49')]?_0x3bc2af[_0x35af('0x30')]:_0x35d5c1[_0x35af('0x2f')];_0x3bc2af[_0x35af('0x33')]=qs['sort'](_0x2e8cd9[_0x35af('0x2c')][_0x35af('0x34')]);_0x3bc2af['where']=qs[_0x35af('0x2d')](_[_0x35af('0x4a')](_0x2e8cd9[_0x35af('0x2c')],_0x35d5c1['filters']));if(_0x2e8cd9[_0x35af('0x2c')]['filter']){_0x3bc2af[_0x35af('0x35')]=_[_0x35af('0x37')](_0x3bc2af[_0x35af('0x35')],{'$or':_['map'](_0x3bc2af[_0x35af('0x30')],function(_0x8ea577){var _0x3bb8ad={};_0x3bb8ad[_0x8ea577]={'$like':'%'+_0x2e8cd9[_0x35af('0x2c')]['filter']+'%'};return _0x3bb8ad;})});}_0x3bc2af=_[_0x35af('0x37')]({},_0x3bc2af,_0x2e8cd9['options']);return _0x3b0642[_0x35af('0x45')](_0x3bc2af);}})['then'](function(_0x2e777f){if(_0x2e777f){_0x32b097=_0x2e777f[_0x35af('0x49')];if(!_0x2e8cd9[_0x35af('0x2c')]['hasOwnProperty'](_0x35af('0x32'))){_0x3bc2af[_0x35af('0x1c')]=qs['limit'](_0x2e8cd9['query'][_0x35af('0x1c')]);_0x3bc2af[_0x35af('0x1a')]=qs[_0x35af('0x1a')](_0x2e8cd9[_0x35af('0x2c')][_0x35af('0x1a')]);}return _0x3b0642[_0x35af('0x45')](_0x3bc2af);}})[_0x35af('0x23')](function(_0x1e71d3){if(_0x1e71d3){return _0x1e71d3?{'count':_0x32b097,'rows':_0x1e71d3}:null;}})[_0x35af('0x23')](respondWithResult(_0x484492,null))[_0x35af('0x3d')](handleError(_0x484492,null));};exports[_0x35af('0x4b')]=function(_0x59d6ec,_0x292758,_0x2602ff){var _0x2210c8={};var _0x354efa={};var _0x488521;var _0x289c43;return db['ZohoConfiguration'][_0x35af('0x46')]({'where':{'id':_0x59d6ec[_0x35af('0x3f')]['id']}})[_0x35af('0x23')](handleEntityNotFound(_0x292758,null))[_0x35af('0x23')](function(_0x2130fa){if(_0x2130fa){_0x488521=_0x2130fa;_0x354efa[_0x35af('0x2f')]=_[_0x35af('0x40')](db[_0x35af('0x47')][_0x35af('0x48')]);_0x354efa[_0x35af('0x2c')]=_['keys'](_0x59d6ec[_0x35af('0x2c')]);_0x354efa[_0x35af('0x2d')]=_[_0x35af('0x2e')](_0x354efa[_0x35af('0x2f')],_0x354efa[_0x35af('0x2c')]);_0x2210c8['attributes']=_['intersection'](_0x354efa[_0x35af('0x2f')],qs[_0x35af('0x31')](_0x59d6ec[_0x35af('0x2c')][_0x35af('0x31')]));_0x2210c8[_0x35af('0x30')]=_0x2210c8[_0x35af('0x30')][_0x35af('0x49')]?_0x2210c8['attributes']:_0x354efa[_0x35af('0x2f')];_0x2210c8[_0x35af('0x33')]=qs[_0x35af('0x34')](_0x59d6ec[_0x35af('0x2c')]['sort']);_0x2210c8[_0x35af('0x35')]=qs['filters'](_[_0x35af('0x4a')](_0x59d6ec[_0x35af('0x2c')],_0x354efa[_0x35af('0x2d')]));if(_0x59d6ec['query'][_0x35af('0x36')]){_0x2210c8[_0x35af('0x35')]=_[_0x35af('0x37')](_0x2210c8['where'],{'$or':_[_0x35af('0x28')](_0x2210c8[_0x35af('0x30')],function(_0x5d76cc){var _0xbc8b50={};_0xbc8b50[_0x5d76cc]={'$like':'%'+_0x59d6ec[_0x35af('0x2c')][_0x35af('0x36')]+'%'};return _0xbc8b50;})});}_0x2210c8=_[_0x35af('0x37')]({},_0x2210c8,_0x59d6ec[_0x35af('0x39')]);return _0x488521[_0x35af('0x4b')](_0x2210c8);}})[_0x35af('0x23')](function(_0x3da701){if(_0x3da701){_0x289c43=_0x3da701[_0x35af('0x49')];if(!_0x59d6ec[_0x35af('0x2c')][_0x35af('0x4c')](_0x35af('0x32'))){_0x2210c8[_0x35af('0x1c')]=qs['limit'](_0x59d6ec[_0x35af('0x2c')][_0x35af('0x1c')]);_0x2210c8['offset']=qs[_0x35af('0x1a')](_0x59d6ec[_0x35af('0x2c')][_0x35af('0x1a')]);}return _0x488521['getSubjects'](_0x2210c8);}})[_0x35af('0x23')](function(_0x3379fc){if(_0x3379fc){return _0x3379fc?{'count':_0x289c43,'rows':_0x3379fc}:null;}})[_0x35af('0x23')](respondWithResult(_0x292758,null))[_0x35af('0x3d')](handleError(_0x292758,null));};exports['getDescriptions']=function(_0x507cd3,_0x33a2b6,_0x1f187f){var _0x544e39={};var _0x2708e={};var _0x5c83d2;var _0x8d3a53;return db['ZohoConfiguration'][_0x35af('0x46')]({'where':{'id':_0x507cd3[_0x35af('0x3f')]['id']}})[_0x35af('0x23')](handleEntityNotFound(_0x33a2b6,null))[_0x35af('0x23')](function(_0x20d199){if(_0x20d199){_0x5c83d2=_0x20d199;_0x2708e['model']=_[_0x35af('0x40')](db['ZohoField'][_0x35af('0x48')]);_0x2708e[_0x35af('0x2c')]=_[_0x35af('0x40')](_0x507cd3[_0x35af('0x2c')]);_0x2708e[_0x35af('0x2d')]=_[_0x35af('0x2e')](_0x2708e[_0x35af('0x2f')],_0x2708e['query']);_0x544e39[_0x35af('0x30')]=_[_0x35af('0x2e')](_0x2708e['model'],qs[_0x35af('0x31')](_0x507cd3[_0x35af('0x2c')][_0x35af('0x31')]));_0x544e39[_0x35af('0x30')]=_0x544e39['attributes'][_0x35af('0x49')]?_0x544e39['attributes']:_0x2708e[_0x35af('0x2f')];_0x544e39['order']=qs[_0x35af('0x34')](_0x507cd3[_0x35af('0x2c')][_0x35af('0x34')]);_0x544e39[_0x35af('0x35')]=qs[_0x35af('0x2d')](_[_0x35af('0x4a')](_0x507cd3['query'],_0x2708e[_0x35af('0x2d')]));if(_0x507cd3[_0x35af('0x2c')][_0x35af('0x36')]){_0x544e39[_0x35af('0x35')]=_['merge'](_0x544e39[_0x35af('0x35')],{'$or':_['map'](_0x544e39[_0x35af('0x30')],function(_0x370706){var _0x546d66={};_0x546d66[_0x370706]={'$like':'%'+_0x507cd3[_0x35af('0x2c')]['filter']+'%'};return _0x546d66;})});}_0x544e39=_[_0x35af('0x37')]({},_0x544e39,_0x507cd3[_0x35af('0x39')]);return _0x5c83d2[_0x35af('0x4d')](_0x544e39);}})[_0x35af('0x23')](function(_0x423732){if(_0x423732){_0x8d3a53=_0x423732[_0x35af('0x49')];if(!_0x507cd3['query']['hasOwnProperty']('nolimit')){_0x544e39['limit']=qs[_0x35af('0x1c')](_0x507cd3[_0x35af('0x2c')][_0x35af('0x1c')]);_0x544e39[_0x35af('0x1a')]=qs[_0x35af('0x1a')](_0x507cd3[_0x35af('0x2c')]['offset']);}return _0x5c83d2['getDescriptions'](_0x544e39);}})['then'](function(_0x4067a4){if(_0x4067a4){return _0x4067a4?{'count':_0x8d3a53,'rows':_0x4067a4}:null;}})[_0x35af('0x23')](respondWithResult(_0x33a2b6,null))['catch'](handleError(_0x33a2b6,null));}; \ No newline at end of file +var _0xa8b9=['destroy','findOne','ZohoField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','length','options','find','create','body'];(function(_0x3b8ed7,_0x47543e){var _0x3a3534=function(_0x4c2b39){while(--_0x4c2b39){_0x3b8ed7['push'](_0x3b8ed7['shift']());}};_0x3a3534(++_0x47543e);}(_0xa8b9,0xa9));var _0x9a8b=function(_0x41c624,_0x21e8be){_0x41c624=_0x41c624-0x0;var _0x586ec5=_0xa8b9[_0x41c624];return _0x586ec5;};'use strict';var emlformat=require(_0x9a8b('0x0'));var rimraf=require(_0x9a8b('0x1'));var zipdir=require(_0x9a8b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a8b('0x3'));var moment=require(_0x9a8b('0x4'));var BPromise=require(_0x9a8b('0x5'));var Mustache=require(_0x9a8b('0x6'));var util=require(_0x9a8b('0x7'));var path=require(_0x9a8b('0x8'));var sox=require(_0x9a8b('0x9'));var csv=require(_0x9a8b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a8b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9a8b('0xc'));var deskjs=require(_0x9a8b('0xd'));var toCsv=require(_0x9a8b('0xa'));var querystring=require(_0x9a8b('0xe'));var Papa=require(_0x9a8b('0xf'));var Redis=require(_0x9a8b('0x10'));var authService=require(_0x9a8b('0x11'));var qs=require(_0x9a8b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a8b('0x13'));var logger=require(_0x9a8b('0x14'))(_0x9a8b('0x15'));var utils=require('../../config/utils');var config=require(_0x9a8b('0x16'));var licenseUtil=require(_0x9a8b('0x17'));var db=require(_0x9a8b('0x18'))['db'];function respondWithStatusCode(_0x47ec98,_0xe15d88){_0xe15d88=_0xe15d88||0xcc;return function(_0x4c56ef){if(_0x4c56ef){return _0x47ec98[_0x9a8b('0x19')](_0xe15d88);}return _0x47ec98[_0x9a8b('0x1a')](_0xe15d88)['end']();};}function respondWithResult(_0x4ca253,_0x5a047a){_0x5a047a=_0x5a047a||0xc8;return function(_0x8d1238){if(_0x8d1238){return _0x4ca253[_0x9a8b('0x1a')](_0x5a047a)['json'](_0x8d1238);}};}function respondWithFilteredResult(_0x4add87,_0x7d8b01){return function(_0x5c1b82){if(_0x5c1b82){var _0x4cfc9b=typeof _0x7d8b01[_0x9a8b('0x1b')]===_0x9a8b('0x1c')&&typeof _0x7d8b01[_0x9a8b('0x1d')]==='undefined';var _0x4560d7=_0x5c1b82[_0x9a8b('0x1e')];var _0x1b3823=_0x4cfc9b?0x0:_0x7d8b01[_0x9a8b('0x1b')];var _0x3a5046=_0x4cfc9b?_0x5c1b82[_0x9a8b('0x1e')]:_0x7d8b01[_0x9a8b('0x1b')]+_0x7d8b01['limit'];var _0x497ac2;if(_0x3a5046>=_0x4560d7){_0x3a5046=_0x4560d7;_0x497ac2=0xc8;}else{_0x497ac2=0xce;}_0x4add87[_0x9a8b('0x1a')](_0x497ac2);return _0x4add87[_0x9a8b('0x1f')](_0x9a8b('0x20'),_0x1b3823+'-'+_0x3a5046+'/'+_0x4560d7)[_0x9a8b('0x21')](_0x5c1b82);}return null;};}function patchUpdates(_0x2c3253){return function(_0x190142){try{jsonpatch[_0x9a8b('0x22')](_0x190142,_0x2c3253,!![]);}catch(_0x5a1b55){return BPromise[_0x9a8b('0x23')](_0x5a1b55);}return _0x190142[_0x9a8b('0x24')]();};}function saveUpdates(_0x82b93e,_0x98317d){return function(_0x820302){if(_0x820302){return _0x820302[_0x9a8b('0x25')](_0x82b93e)[_0x9a8b('0x26')](function(_0x2d5f28){return _0x2d5f28;});}return null;};}function removeEntity(_0x59db55,_0x5f57c5){return function(_0x22649a){if(_0x22649a){return _0x22649a['destroy']()[_0x9a8b('0x26')](function(){_0x59db55[_0x9a8b('0x1a')](0xcc)[_0x9a8b('0x27')]();});}};}function handleEntityNotFound(_0x26503e,_0x11cb46){return function(_0x47dd45){if(!_0x47dd45){_0x26503e[_0x9a8b('0x19')](0x194);}return _0x47dd45;};}function handleError(_0x1e6538,_0x5763c5){_0x5763c5=_0x5763c5||0x1f4;return function(_0x2e1798){logger['error'](_0x2e1798[_0x9a8b('0x28')]);if(_0x2e1798['name']){delete _0x2e1798[_0x9a8b('0x29')];}_0x1e6538[_0x9a8b('0x1a')](_0x5763c5)[_0x9a8b('0x2a')](_0x2e1798);};}exports[_0x9a8b('0x2b')]=function(_0x508cb3,_0x452b18){var _0x415f99={},_0x5cae88={},_0x363bf0={'count':0x0,'rows':[]};var _0x1b7645=_[_0x9a8b('0x2c')](db[_0x9a8b('0x2d')][_0x9a8b('0x2e')],function(_0x265253){return{'name':_0x265253[_0x9a8b('0x2f')],'type':_0x265253[_0x9a8b('0x30')][_0x9a8b('0x31')]};});_0x5cae88[_0x9a8b('0x32')]=_[_0x9a8b('0x2c')](_0x1b7645,_0x9a8b('0x29'));_0x5cae88[_0x9a8b('0x33')]=_[_0x9a8b('0x34')](_0x508cb3['query']);_0x5cae88[_0x9a8b('0x35')]=_[_0x9a8b('0x36')](_0x5cae88[_0x9a8b('0x32')],_0x5cae88[_0x9a8b('0x33')]);_0x415f99['attributes']=_[_0x9a8b('0x36')](_0x5cae88[_0x9a8b('0x32')],qs[_0x9a8b('0x37')](_0x508cb3[_0x9a8b('0x33')]['fields']));_0x415f99[_0x9a8b('0x38')]=_0x415f99[_0x9a8b('0x38')]['length']?_0x415f99[_0x9a8b('0x38')]:_0x5cae88[_0x9a8b('0x32')];if(!_0x508cb3[_0x9a8b('0x33')][_0x9a8b('0x39')]('nolimit')){_0x415f99['limit']=qs[_0x9a8b('0x1d')](_0x508cb3[_0x9a8b('0x33')][_0x9a8b('0x1d')]);_0x415f99[_0x9a8b('0x1b')]=qs[_0x9a8b('0x1b')](_0x508cb3['query'][_0x9a8b('0x1b')]);}_0x415f99['order']=qs[_0x9a8b('0x3a')](_0x508cb3[_0x9a8b('0x33')]['sort']);_0x415f99[_0x9a8b('0x3b')]=qs['filters'](_[_0x9a8b('0x3c')](_0x508cb3[_0x9a8b('0x33')],_0x5cae88[_0x9a8b('0x35')]),_0x1b7645);if(_0x508cb3[_0x9a8b('0x33')][_0x9a8b('0x3d')]){_0x415f99[_0x9a8b('0x3b')]=_[_0x9a8b('0x3e')](_0x415f99[_0x9a8b('0x3b')],{'$or':_[_0x9a8b('0x2c')](_0x1b7645,function(_0x59959b){if(_0x59959b[_0x9a8b('0x30')]!=='VIRTUAL'){var _0xefb813={};_0xefb813[_0x59959b[_0x9a8b('0x29')]]={'$like':'%'+_0x508cb3[_0x9a8b('0x33')][_0x9a8b('0x3d')]+'%'};return _0xefb813;}})});}_0x415f99=_[_0x9a8b('0x3e')]({},_0x415f99,_0x508cb3['options']);var _0x2d3158={'where':_0x415f99[_0x9a8b('0x3b')]};return db[_0x9a8b('0x2d')]['count'](_0x2d3158)['then'](function(_0x555d67){_0x363bf0[_0x9a8b('0x1e')]=_0x555d67;if(_0x508cb3[_0x9a8b('0x33')][_0x9a8b('0x3f')]){_0x415f99[_0x9a8b('0x40')]=[{'all':!![]}];}return db[_0x9a8b('0x2d')]['findAll'](_0x415f99);})['then'](function(_0x53e318){_0x363bf0[_0x9a8b('0x41')]=_0x53e318;return _0x363bf0;})[_0x9a8b('0x26')](respondWithFilteredResult(_0x452b18,_0x415f99))[_0x9a8b('0x42')](handleError(_0x452b18,null));};exports[_0x9a8b('0x43')]=function(_0x173d55,_0x239498){var _0x4d1e1a={'raw':![],'where':{'id':_0x173d55[_0x9a8b('0x44')]['id']}},_0x11f008={};_0x11f008[_0x9a8b('0x32')]=_[_0x9a8b('0x34')](db[_0x9a8b('0x2d')][_0x9a8b('0x2e')]);_0x11f008[_0x9a8b('0x33')]=_[_0x9a8b('0x34')](_0x173d55[_0x9a8b('0x33')]);_0x11f008[_0x9a8b('0x35')]=_[_0x9a8b('0x36')](_0x11f008['model'],_0x11f008[_0x9a8b('0x33')]);_0x4d1e1a[_0x9a8b('0x38')]=_[_0x9a8b('0x36')](_0x11f008[_0x9a8b('0x32')],qs['fields'](_0x173d55[_0x9a8b('0x33')]['fields']));_0x4d1e1a['attributes']=_0x4d1e1a[_0x9a8b('0x38')][_0x9a8b('0x45')]?_0x4d1e1a['attributes']:_0x11f008[_0x9a8b('0x32')];if(_0x173d55[_0x9a8b('0x33')][_0x9a8b('0x3f')]){_0x4d1e1a['include']=[{'all':!![]}];}_0x4d1e1a=_[_0x9a8b('0x3e')]({},_0x4d1e1a,_0x173d55[_0x9a8b('0x46')]);return db['ZohoConfiguration'][_0x9a8b('0x47')](_0x4d1e1a)['then'](handleEntityNotFound(_0x239498,null))[_0x9a8b('0x26')](respondWithResult(_0x239498,null))[_0x9a8b('0x42')](handleError(_0x239498,null));};exports[_0x9a8b('0x48')]=function(_0x598226,_0x21710c){return db['ZohoConfiguration'][_0x9a8b('0x48')](_0x598226[_0x9a8b('0x49')],{})[_0x9a8b('0x26')](respondWithResult(_0x21710c,0xc9))[_0x9a8b('0x42')](handleError(_0x21710c,null));};exports[_0x9a8b('0x25')]=function(_0x4a035c,_0x2813a9){if(_0x4a035c[_0x9a8b('0x49')]['id']){delete _0x4a035c[_0x9a8b('0x49')]['id'];}return db[_0x9a8b('0x2d')]['find']({'where':{'id':_0x4a035c[_0x9a8b('0x44')]['id']}})[_0x9a8b('0x26')](handleEntityNotFound(_0x2813a9,null))['then'](saveUpdates(_0x4a035c[_0x9a8b('0x49')],null))[_0x9a8b('0x26')](respondWithResult(_0x2813a9,null))[_0x9a8b('0x42')](handleError(_0x2813a9,null));};exports[_0x9a8b('0x4a')]=function(_0x388f8c,_0x390491){return db['ZohoConfiguration'][_0x9a8b('0x47')]({'where':{'id':_0x388f8c[_0x9a8b('0x44')]['id']}})[_0x9a8b('0x26')](handleEntityNotFound(_0x390491,null))[_0x9a8b('0x26')](removeEntity(_0x390491,null))[_0x9a8b('0x42')](handleError(_0x390491,null));};exports['getFields']=function(_0x31f404,_0x57bd3f,_0x5e5b84){var _0x5308e1={};var _0x293827={};var _0x51bbf8;var _0x52ddcf;return db[_0x9a8b('0x2d')][_0x9a8b('0x4b')]({'where':{'id':_0x31f404[_0x9a8b('0x44')]['id']}})[_0x9a8b('0x26')](handleEntityNotFound(_0x57bd3f,null))['then'](function(_0x119cb7){if(_0x119cb7){_0x51bbf8=_0x119cb7;_0x293827[_0x9a8b('0x32')]=_[_0x9a8b('0x34')](db[_0x9a8b('0x4c')][_0x9a8b('0x2e')]);_0x293827[_0x9a8b('0x33')]=_[_0x9a8b('0x34')](_0x31f404[_0x9a8b('0x33')]);_0x293827[_0x9a8b('0x35')]=_[_0x9a8b('0x36')](_0x293827[_0x9a8b('0x32')],_0x293827[_0x9a8b('0x33')]);_0x5308e1[_0x9a8b('0x38')]=_['intersection'](_0x293827['model'],qs[_0x9a8b('0x37')](_0x31f404['query'][_0x9a8b('0x37')]));_0x5308e1[_0x9a8b('0x38')]=_0x5308e1['attributes'][_0x9a8b('0x45')]?_0x5308e1[_0x9a8b('0x38')]:_0x293827[_0x9a8b('0x32')];_0x5308e1[_0x9a8b('0x4d')]=qs[_0x9a8b('0x3a')](_0x31f404[_0x9a8b('0x33')][_0x9a8b('0x3a')]);_0x5308e1[_0x9a8b('0x3b')]=qs[_0x9a8b('0x35')](_[_0x9a8b('0x3c')](_0x31f404[_0x9a8b('0x33')],_0x293827[_0x9a8b('0x35')]));if(_0x31f404[_0x9a8b('0x33')][_0x9a8b('0x3d')]){_0x5308e1[_0x9a8b('0x3b')]=_[_0x9a8b('0x3e')](_0x5308e1[_0x9a8b('0x3b')],{'$or':_[_0x9a8b('0x2c')](_0x5308e1[_0x9a8b('0x38')],function(_0x202536){var _0x4cb906={};_0x4cb906[_0x202536]={'$like':'%'+_0x31f404['query'][_0x9a8b('0x3d')]+'%'};return _0x4cb906;})});}_0x5308e1=_[_0x9a8b('0x3e')]({},_0x5308e1,_0x31f404['options']);return _0x51bbf8['getFields'](_0x5308e1);}})[_0x9a8b('0x26')](function(_0x346ae8){if(_0x346ae8){_0x52ddcf=_0x346ae8[_0x9a8b('0x45')];if(!_0x31f404[_0x9a8b('0x33')][_0x9a8b('0x39')](_0x9a8b('0x4e'))){_0x5308e1[_0x9a8b('0x1d')]=qs[_0x9a8b('0x1d')](_0x31f404[_0x9a8b('0x33')][_0x9a8b('0x1d')]);_0x5308e1['offset']=qs[_0x9a8b('0x1b')](_0x31f404['query'][_0x9a8b('0x1b')]);}return _0x51bbf8['getFields'](_0x5308e1);}})['then'](function(_0x54f48c){if(_0x54f48c){return _0x54f48c?{'count':_0x52ddcf,'rows':_0x54f48c}:null;}})[_0x9a8b('0x26')](respondWithResult(_0x57bd3f,null))[_0x9a8b('0x42')](handleError(_0x57bd3f,null));};exports[_0x9a8b('0x4f')]=function(_0x190d2e,_0x57676a,_0x1777c7){var _0x2b4bad={};var _0x2a5588={};var _0x322caa;var _0x20c53e;return db[_0x9a8b('0x2d')][_0x9a8b('0x4b')]({'where':{'id':_0x190d2e[_0x9a8b('0x44')]['id']}})['then'](handleEntityNotFound(_0x57676a,null))[_0x9a8b('0x26')](function(_0x2fc173){if(_0x2fc173){_0x322caa=_0x2fc173;_0x2a5588[_0x9a8b('0x32')]=_[_0x9a8b('0x34')](db[_0x9a8b('0x4c')][_0x9a8b('0x2e')]);_0x2a5588['query']=_[_0x9a8b('0x34')](_0x190d2e[_0x9a8b('0x33')]);_0x2a5588['filters']=_[_0x9a8b('0x36')](_0x2a5588[_0x9a8b('0x32')],_0x2a5588[_0x9a8b('0x33')]);_0x2b4bad['attributes']=_[_0x9a8b('0x36')](_0x2a5588[_0x9a8b('0x32')],qs[_0x9a8b('0x37')](_0x190d2e['query'][_0x9a8b('0x37')]));_0x2b4bad['attributes']=_0x2b4bad[_0x9a8b('0x38')][_0x9a8b('0x45')]?_0x2b4bad['attributes']:_0x2a5588[_0x9a8b('0x32')];_0x2b4bad[_0x9a8b('0x4d')]=qs[_0x9a8b('0x3a')](_0x190d2e[_0x9a8b('0x33')][_0x9a8b('0x3a')]);_0x2b4bad[_0x9a8b('0x3b')]=qs['filters'](_[_0x9a8b('0x3c')](_0x190d2e['query'],_0x2a5588['filters']));if(_0x190d2e[_0x9a8b('0x33')][_0x9a8b('0x3d')]){_0x2b4bad[_0x9a8b('0x3b')]=_[_0x9a8b('0x3e')](_0x2b4bad[_0x9a8b('0x3b')],{'$or':_[_0x9a8b('0x2c')](_0x2b4bad[_0x9a8b('0x38')],function(_0x5d324b){var _0x4ae66a={};_0x4ae66a[_0x5d324b]={'$like':'%'+_0x190d2e[_0x9a8b('0x33')][_0x9a8b('0x3d')]+'%'};return _0x4ae66a;})});}_0x2b4bad=_[_0x9a8b('0x3e')]({},_0x2b4bad,_0x190d2e[_0x9a8b('0x46')]);return _0x322caa[_0x9a8b('0x4f')](_0x2b4bad);}})[_0x9a8b('0x26')](function(_0x2cd7ef){if(_0x2cd7ef){_0x20c53e=_0x2cd7ef[_0x9a8b('0x45')];if(!_0x190d2e[_0x9a8b('0x33')][_0x9a8b('0x39')](_0x9a8b('0x4e'))){_0x2b4bad['limit']=qs[_0x9a8b('0x1d')](_0x190d2e[_0x9a8b('0x33')][_0x9a8b('0x1d')]);_0x2b4bad['offset']=qs[_0x9a8b('0x1b')](_0x190d2e[_0x9a8b('0x33')][_0x9a8b('0x1b')]);}return _0x322caa[_0x9a8b('0x4f')](_0x2b4bad);}})[_0x9a8b('0x26')](function(_0x18a98c){if(_0x18a98c){return _0x18a98c?{'count':_0x20c53e,'rows':_0x18a98c}:null;}})['then'](respondWithResult(_0x57676a,null))[_0x9a8b('0x42')](handleError(_0x57676a,null));};exports[_0x9a8b('0x50')]=function(_0x4403f4,_0x2ad97d,_0x1a8920){var _0x20360f={};var _0x20aa7e={};var _0x4c81b8;var _0x2d88fb;return db[_0x9a8b('0x2d')][_0x9a8b('0x4b')]({'where':{'id':_0x4403f4[_0x9a8b('0x44')]['id']}})[_0x9a8b('0x26')](handleEntityNotFound(_0x2ad97d,null))[_0x9a8b('0x26')](function(_0x32f5c8){if(_0x32f5c8){_0x4c81b8=_0x32f5c8;_0x20aa7e['model']=_[_0x9a8b('0x34')](db[_0x9a8b('0x4c')]['rawAttributes']);_0x20aa7e['query']=_[_0x9a8b('0x34')](_0x4403f4[_0x9a8b('0x33')]);_0x20aa7e[_0x9a8b('0x35')]=_[_0x9a8b('0x36')](_0x20aa7e[_0x9a8b('0x32')],_0x20aa7e[_0x9a8b('0x33')]);_0x20360f[_0x9a8b('0x38')]=_[_0x9a8b('0x36')](_0x20aa7e[_0x9a8b('0x32')],qs['fields'](_0x4403f4[_0x9a8b('0x33')][_0x9a8b('0x37')]));_0x20360f[_0x9a8b('0x38')]=_0x20360f['attributes']['length']?_0x20360f[_0x9a8b('0x38')]:_0x20aa7e[_0x9a8b('0x32')];_0x20360f[_0x9a8b('0x4d')]=qs[_0x9a8b('0x3a')](_0x4403f4[_0x9a8b('0x33')][_0x9a8b('0x3a')]);_0x20360f[_0x9a8b('0x3b')]=qs[_0x9a8b('0x35')](_[_0x9a8b('0x3c')](_0x4403f4[_0x9a8b('0x33')],_0x20aa7e[_0x9a8b('0x35')]));if(_0x4403f4[_0x9a8b('0x33')]['filter']){_0x20360f['where']=_[_0x9a8b('0x3e')](_0x20360f[_0x9a8b('0x3b')],{'$or':_[_0x9a8b('0x2c')](_0x20360f[_0x9a8b('0x38')],function(_0x16e61a){var _0x4ef5ff={};_0x4ef5ff[_0x16e61a]={'$like':'%'+_0x4403f4[_0x9a8b('0x33')][_0x9a8b('0x3d')]+'%'};return _0x4ef5ff;})});}_0x20360f=_[_0x9a8b('0x3e')]({},_0x20360f,_0x4403f4[_0x9a8b('0x46')]);return _0x4c81b8[_0x9a8b('0x50')](_0x20360f);}})[_0x9a8b('0x26')](function(_0x295865){if(_0x295865){_0x2d88fb=_0x295865[_0x9a8b('0x45')];if(!_0x4403f4['query']['hasOwnProperty'](_0x9a8b('0x4e'))){_0x20360f[_0x9a8b('0x1d')]=qs['limit'](_0x4403f4['query'][_0x9a8b('0x1d')]);_0x20360f[_0x9a8b('0x1b')]=qs[_0x9a8b('0x1b')](_0x4403f4[_0x9a8b('0x33')][_0x9a8b('0x1b')]);}return _0x4c81b8[_0x9a8b('0x50')](_0x20360f);}})[_0x9a8b('0x26')](function(_0x181cc4){if(_0x181cc4){return _0x181cc4?{'count':_0x2d88fb,'rows':_0x181cc4}:null;}})['then'](respondWithResult(_0x2ad97d,null))[_0x9a8b('0x42')](handleError(_0x2ad97d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index dfcc731..b66ea07 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 _0x7cef=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x34cfdf,_0x26e72b){var _0x375364=function(_0x5799c8){while(--_0x5799c8){_0x34cfdf['push'](_0x34cfdf['shift']());}};_0x375364(++_0x26e72b);}(_0x7cef,0x12f));var _0xf7ce=function(_0x11eebb,_0x5cb586){_0x11eebb=_0x11eebb-0x0;var _0x1b366f=_0x7cef[_0x11eebb];return _0x1b366f;};'use strict';var _=require('lodash');var util=require(_0xf7ce('0x0'));var logger=require(_0xf7ce('0x1'))('api');var moment=require(_0xf7ce('0x2'));var BPromise=require(_0xf7ce('0x3'));var rp=require(_0xf7ce('0x4'));var fs=require('fs');var path=require(_0xf7ce('0x5'));var rimraf=require(_0xf7ce('0x6'));var config=require(_0xf7ce('0x7'));var attributes=require(_0xf7ce('0x8'));module['exports']=function(_0x2830e7,_0x4ed5bf){return _0x2830e7['define'](_0xf7ce('0x9'),attributes,{'tableName':_0xf7ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14e1=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14e1,0xdd));var _0x114e=function(_0x44b98c,_0x2959eb){_0x44b98c=_0x44b98c-0x0;var _0x234181=_0x14e1[_0x44b98c];return _0x234181;};'use strict';var _=require(_0x114e('0x0'));var util=require(_0x114e('0x1'));var logger=require(_0x114e('0x2'))(_0x114e('0x3'));var moment=require(_0x114e('0x4'));var BPromise=require('bluebird');var rp=require(_0x114e('0x5'));var fs=require('fs');var path=require(_0x114e('0x6'));var rimraf=require(_0x114e('0x7'));var config=require(_0x114e('0x8'));var attributes=require(_0x114e('0x9'));module[_0x114e('0xa')]=function(_0x1e31da,_0x57899f){return _0x1e31da[_0x114e('0xb')](_0x114e('0xc'),attributes,{'tableName':_0x114e('0xd'),'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 478b094..03c2006 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 _0xc423=['stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4b77d5,_0x51980c){var _0x159903=function(_0x344b85){while(--_0x344b85){_0x4b77d5['push'](_0x4b77d5['shift']());}};_0x159903(++_0x51980c);}(_0xc423,0x1ce));var _0x3c42=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc423[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x3c42('0x0'));var moment=require(_0x3c42('0x1'));var BPromise=require(_0x3c42('0x2'));var rs=require(_0x3c42('0x3'));var fs=require('fs');var Redis=require(_0x3c42('0x4'));var db=require(_0x3c42('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c42('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3c42('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56c53a,_0x25a8cb,_0x279788){return new BPromise(function(_0x17c00e,_0x2f5234){return client['request'](_0x56c53a,_0x279788)[_0x3c42('0x8')](function(_0x145069){logger['info'](_0x3c42('0x9'),_0x25a8cb,_0x3c42('0xa'));logger[_0x3c42('0xb')](_0x3c42('0xc'),_0x25a8cb,'request\x20sent',JSON[_0x3c42('0xd')](_0x145069));if(_0x145069[_0x3c42('0xe')]){if(_0x145069[_0x3c42('0xe')][_0x3c42('0xf')]===0x1f4){logger['error'](_0x3c42('0x9'),_0x25a8cb,_0x145069[_0x3c42('0xe')][_0x3c42('0x10')]);return _0x2f5234(_0x145069[_0x3c42('0xe')][_0x3c42('0x10')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x25a8cb,_0x145069[_0x3c42('0xe')][_0x3c42('0x10')]);return _0x17c00e(_0x145069[_0x3c42('0xe')]['message']);}else{logger[_0x3c42('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x25a8cb,'request\x20sent');_0x17c00e(_0x145069['result']['message']);}})[_0x3c42('0x12')](function(_0x1fbf95){logger[_0x3c42('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x25a8cb,_0x1fbf95);_0x2f5234(_0x1fbf95);});});} \ No newline at end of file +var _0x1c9a=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x517be0,_0x254861){var _0x4e427a=function(_0x4f91d6){while(--_0x4f91d6){_0x517be0['push'](_0x517be0['shift']());}};_0x4e427a(++_0x254861);}(_0x1c9a,0x19e));var _0xa1c9=function(_0x5a47f7,_0x11bb9f){_0x5a47f7=_0x5a47f7-0x0;var _0x3d8585=_0x1c9a[_0x5a47f7];return _0x3d8585;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa1c9('0x1'));var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require(_0xa1c9('0x5'));var logger=require(_0xa1c9('0x6'))(_0xa1c9('0x7'));var config=require(_0xa1c9('0x8'));var jayson=require(_0xa1c9('0x9'));var client=jayson[_0xa1c9('0xa')][_0xa1c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x558d2a,_0x590825,_0x45de20){return new BPromise(function(_0x5740bd,_0x35aacc){return client[_0xa1c9('0xc')](_0x558d2a,_0x45de20)[_0xa1c9('0xd')](function(_0x3c945d){logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x590825,_0xa1c9('0x10'));logger[_0xa1c9('0x11')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x590825,_0xa1c9('0x10'),JSON[_0xa1c9('0x12')](_0x3c945d));if(_0x3c945d['error']){if(_0x3c945d[_0xa1c9('0x13')][_0xa1c9('0x14')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x590825,_0x3c945d['error']['message']);return _0x35aacc(_0x3c945d[_0xa1c9('0x13')][_0xa1c9('0x15')]);}logger[_0xa1c9('0x13')](_0xa1c9('0xf'),_0x590825,_0x3c945d[_0xa1c9('0x13')][_0xa1c9('0x15')]);return _0x5740bd(_0x3c945d[_0xa1c9('0x13')][_0xa1c9('0x15')]);}else{logger[_0xa1c9('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x590825,_0xa1c9('0x10'));_0x5740bd(_0x3c945d['result'][_0xa1c9('0x15')]);}})[_0xa1c9('0x16')](function(_0x5b6fd3){logger['error'](_0xa1c9('0xf'),_0x590825,_0x5b6fd3);_0x35aacc(_0x5b6fd3);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b8a0593..1c56fc0 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 _0xa53c=['fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa53c,0xf2));var _0xca53=function(_0x5b9375,_0x2c5f0c){_0x5b9375=_0x5b9375-0x0;var _0x150940=_0xa53c[_0x5b9375];return _0x150940;};'use strict';var multer=require(_0xca53('0x0'));var util=require(_0xca53('0x1'));var path=require('path');var timeout=require(_0xca53('0x2'));var express=require(_0xca53('0x3'));var router=express[_0xca53('0x4')]();var fs_extra=require(_0xca53('0x5'));var auth=require(_0xca53('0x6'));var interaction=require(_0xca53('0x7'));var config=require('../../config/environment');var controller=require(_0xca53('0x8'));router['get']('/',auth[_0xca53('0x9')](),controller[_0xca53('0xa')]);router['get'](_0xca53('0xb'),auth[_0xca53('0x9')](),controller[_0xca53('0xc')]);router[_0xca53('0xd')]('/',auth[_0xca53('0x9')](),controller[_0xca53('0xe')]);router[_0xca53('0xf')](_0xca53('0xb'),auth[_0xca53('0x9')](),controller[_0xca53('0x10')]);router['delete'](_0xca53('0xb'),auth['isAuthenticated'](),controller[_0xca53('0x11')]);module[_0xca53('0x12')]=router; \ No newline at end of file +var _0xa9b0=['show','post','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','/:id'];(function(_0x30a115,_0x444a45){var _0x1ce9a0=function(_0x25e670){while(--_0x25e670){_0x30a115['push'](_0x30a115['shift']());}};_0x1ce9a0(++_0x444a45);}(_0xa9b0,0x1f3));var _0x0a9b=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xa9b0[_0x38c632];return _0x12737e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a9b('0x0'));var timeout=require(_0x0a9b('0x1'));var express=require('express');var router=express[_0x0a9b('0x2')]();var fs_extra=require(_0x0a9b('0x3'));var auth=require(_0x0a9b('0x4'));var interaction=require(_0x0a9b('0x5'));var config=require(_0x0a9b('0x6'));var controller=require(_0x0a9b('0x7'));router['get']('/',auth[_0x0a9b('0x8')](),controller[_0x0a9b('0x9')]);router['get'](_0x0a9b('0xa'),auth[_0x0a9b('0x8')](),controller[_0x0a9b('0xb')]);router[_0x0a9b('0xc')]('/',auth[_0x0a9b('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9b('0xd')]);router[_0x0a9b('0xe')](_0x0a9b('0xa'),auth[_0x0a9b('0x8')](),controller[_0x0a9b('0xf')]);module[_0x0a9b('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 3eb4260..2b02b8f 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 _0x8eba=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM','string'];(function(_0x4b9f3f,_0x15aeb3){var _0x28c246=function(_0x27cad5){while(--_0x27cad5){_0x4b9f3f['push'](_0x4b9f3f['shift']());}};_0x28c246(++_0x15aeb3);}(_0x8eba,0x177));var _0xa8eb=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x8eba[_0x1f7996];return _0x584609;};'use strict';var Sequelize=require('sequelize');module[_0xa8eb('0x0')]={'type':{'type':Sequelize[_0xa8eb('0x1')](_0xa8eb('0x2'),'variable',_0xa8eb('0x3'),_0xa8eb('0x4'),_0xa8eb('0x5')),'defaultValue':_0xa8eb('0x2')},'content':{'type':Sequelize[_0xa8eb('0x6')]},'key':{'type':Sequelize[_0xa8eb('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa8eb('0x2'),_0xa8eb('0x7'),_0xa8eb('0x3'))},'keyContent':{'type':Sequelize[_0xa8eb('0x6')]},'idField':{'type':Sequelize[_0xa8eb('0x6')]},'nameField':{'type':Sequelize[_0xa8eb('0x6')]},'customField':{'type':Sequelize[_0xa8eb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa8eb('0x6')]}}; \ No newline at end of file +var _0x32a9=['sequelize','exports','ENUM','variable','customVariable','string','STRING'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x32a9,0x1b9));var _0x932a=function(_0xab0a8d,_0x5d9eb6){_0xab0a8d=_0xab0a8d-0x0;var _0x1a14d1=_0x32a9[_0xab0a8d];return _0x1a14d1;};'use strict';var Sequelize=require(_0x932a('0x0'));module[_0x932a('0x1')]={'type':{'type':Sequelize[_0x932a('0x2')]('string',_0x932a('0x3'),_0x932a('0x4'),'keyValue','picklist'),'defaultValue':_0x932a('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x932a('0x2')](_0x932a('0x5'),_0x932a('0x3'),_0x932a('0x4'))},'keyContent':{'type':Sequelize[_0x932a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x932a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2bab0a7..d8110b6 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 _0x736e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZohoField','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','filter','where','merge','type','VIRTUAL','includeAll','findAll','catch','params','include','options','create','body','find','destroy','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment'];(function(_0x328a73,_0x59834a){var _0x6aa064=function(_0x263872){while(--_0x263872){_0x328a73['push'](_0x328a73['shift']());}};_0x6aa064(++_0x59834a);}(_0x736e,0x73));var _0xe736=function(_0x377753,_0x48a6f9){_0x377753=_0x377753-0x0;var _0x3f38a1=_0x736e[_0x377753];return _0x3f38a1;};'use strict';var emlformat=require(_0xe736('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe736('0x1'));var rp=require(_0xe736('0x2'));var moment=require(_0xe736('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe736('0x4'));var util=require(_0xe736('0x5'));var path=require('path');var sox=require(_0xe736('0x6'));var csv=require(_0xe736('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe736('0x8'));var squel=require(_0xe736('0x9'));var crypto=require(_0xe736('0xa'));var jsforce=require(_0xe736('0xb'));var deskjs=require(_0xe736('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe736('0xd'));var Redis=require('ioredis');var authService=require(_0xe736('0xe'));var qs=require(_0xe736('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe736('0x10'));var logger=require('../../config/logger')(_0xe736('0x11'));var utils=require('../../config/utils');var config=require(_0xe736('0x12'));var licenseUtil=require(_0xe736('0x13'));var db=require(_0xe736('0x14'))['db'];function respondWithStatusCode(_0x3cb3ab,_0x5d0815){_0x5d0815=_0x5d0815||0xcc;return function(_0x139113){if(_0x139113){return _0x3cb3ab[_0xe736('0x15')](_0x5d0815);}return _0x3cb3ab[_0xe736('0x16')](_0x5d0815)[_0xe736('0x17')]();};}function respondWithResult(_0x2689ae,_0x11b53f){_0x11b53f=_0x11b53f||0xc8;return function(_0x2f2681){if(_0x2f2681){return _0x2689ae[_0xe736('0x16')](_0x11b53f)[_0xe736('0x18')](_0x2f2681);}};}function respondWithFilteredResult(_0xece22c,_0x375fe2){return function(_0x5e26a6){if(_0x5e26a6){var _0x343ce0=typeof _0x375fe2['offset']==='undefined'&&typeof _0x375fe2[_0xe736('0x19')]===_0xe736('0x1a');var _0x290983=_0x5e26a6[_0xe736('0x1b')];var _0x1b087b=_0x343ce0?0x0:_0x375fe2[_0xe736('0x1c')];var _0x1af6e0=_0x343ce0?_0x5e26a6[_0xe736('0x1b')]:_0x375fe2[_0xe736('0x1c')]+_0x375fe2[_0xe736('0x19')];var _0x2b2bec;if(_0x1af6e0>=_0x290983){_0x1af6e0=_0x290983;_0x2b2bec=0xc8;}else{_0x2b2bec=0xce;}_0xece22c['status'](_0x2b2bec);return _0xece22c['set'](_0xe736('0x1d'),_0x1b087b+'-'+_0x1af6e0+'/'+_0x290983)[_0xe736('0x18')](_0x5e26a6);}return null;};}function patchUpdates(_0x2a161a){return function(_0x4d74c6){try{jsonpatch[_0xe736('0x1e')](_0x4d74c6,_0x2a161a,!![]);}catch(_0x1b50d1){return BPromise[_0xe736('0x1f')](_0x1b50d1);}return _0x4d74c6[_0xe736('0x20')]();};}function saveUpdates(_0xa2f3be,_0x164ec3){return function(_0x299ead){if(_0x299ead){return _0x299ead[_0xe736('0x21')](_0xa2f3be)[_0xe736('0x22')](function(_0x225fa4){return _0x225fa4;});}return null;};}function removeEntity(_0x4251fc,_0x2eadcd){return function(_0x294c55){if(_0x294c55){return _0x294c55['destroy']()[_0xe736('0x22')](function(){_0x4251fc[_0xe736('0x16')](0xcc)[_0xe736('0x17')]();});}};}function handleEntityNotFound(_0x223b95,_0x251b71){return function(_0x57cf00){if(!_0x57cf00){_0x223b95[_0xe736('0x15')](0x194);}return _0x57cf00;};}function handleError(_0x1a97d9,_0x47e480){_0x47e480=_0x47e480||0x1f4;return function(_0x4655a6){logger['error'](_0x4655a6[_0xe736('0x23')]);if(_0x4655a6['name']){delete _0x4655a6[_0xe736('0x24')];}_0x1a97d9[_0xe736('0x16')](_0x47e480)[_0xe736('0x25')](_0x4655a6);};}exports[_0xe736('0x26')]=function(_0x56c5c7,_0x57c1bd){var _0x1bffe7={},_0x5256e2={},_0xb55c64={'count':0x0,'rows':[]};var _0x56467e=_[_0xe736('0x27')](db[_0xe736('0x28')][_0xe736('0x29')],function(_0x48e933){return{'name':_0x48e933['fieldName'],'type':_0x48e933['type'][_0xe736('0x2a')]};});_0x5256e2[_0xe736('0x2b')]=_[_0xe736('0x27')](_0x56467e,'name');_0x5256e2[_0xe736('0x2c')]=_[_0xe736('0x2d')](_0x56c5c7['query']);_0x5256e2[_0xe736('0x2e')]=_[_0xe736('0x2f')](_0x5256e2[_0xe736('0x2b')],_0x5256e2['query']);_0x1bffe7['attributes']=_['intersection'](_0x5256e2[_0xe736('0x2b')],qs['fields'](_0x56c5c7[_0xe736('0x2c')][_0xe736('0x30')]));_0x1bffe7[_0xe736('0x31')]=_0x1bffe7['attributes'][_0xe736('0x32')]?_0x1bffe7[_0xe736('0x31')]:_0x5256e2[_0xe736('0x2b')];if(!_0x56c5c7[_0xe736('0x2c')][_0xe736('0x33')]('nolimit')){_0x1bffe7[_0xe736('0x19')]=qs[_0xe736('0x19')](_0x56c5c7[_0xe736('0x2c')]['limit']);_0x1bffe7[_0xe736('0x1c')]=qs[_0xe736('0x1c')](_0x56c5c7['query']['offset']);}_0x1bffe7['order']=qs['sort'](_0x56c5c7[_0xe736('0x2c')]['sort']);_0x1bffe7['where']=qs['filters'](_['pick'](_0x56c5c7[_0xe736('0x2c')],_0x5256e2['filters']),_0x56467e);if(_0x56c5c7[_0xe736('0x2c')][_0xe736('0x34')]){_0x1bffe7[_0xe736('0x35')]=_[_0xe736('0x36')](_0x1bffe7[_0xe736('0x35')],{'$or':_[_0xe736('0x27')](_0x56467e,function(_0x5ad4ee){if(_0x5ad4ee[_0xe736('0x37')]!==_0xe736('0x38')){var _0x583269={};_0x583269[_0x5ad4ee[_0xe736('0x24')]]={'$like':'%'+_0x56c5c7[_0xe736('0x2c')][_0xe736('0x34')]+'%'};return _0x583269;}})});}_0x1bffe7=_['merge']({},_0x1bffe7,_0x56c5c7['options']);var _0x59de09={'where':_0x1bffe7[_0xe736('0x35')]};return db[_0xe736('0x28')][_0xe736('0x1b')](_0x59de09)[_0xe736('0x22')](function(_0x495f74){_0xb55c64[_0xe736('0x1b')]=_0x495f74;if(_0x56c5c7[_0xe736('0x2c')][_0xe736('0x39')]){_0x1bffe7['include']=[{'all':!![]}];}return db[_0xe736('0x28')][_0xe736('0x3a')](_0x1bffe7);})[_0xe736('0x22')](function(_0x467e06){_0xb55c64['rows']=_0x467e06;return _0xb55c64;})[_0xe736('0x22')](respondWithFilteredResult(_0x57c1bd,_0x1bffe7))[_0xe736('0x3b')](handleError(_0x57c1bd,null));};exports['show']=function(_0x26d408,_0x494a28){var _0x3052cf={'raw':!![],'where':{'id':_0x26d408[_0xe736('0x3c')]['id']}},_0x5e9067={};_0x5e9067[_0xe736('0x2b')]=_[_0xe736('0x2d')](db[_0xe736('0x28')][_0xe736('0x29')]);_0x5e9067[_0xe736('0x2c')]=_[_0xe736('0x2d')](_0x26d408[_0xe736('0x2c')]);_0x5e9067[_0xe736('0x2e')]=_[_0xe736('0x2f')](_0x5e9067[_0xe736('0x2b')],_0x5e9067[_0xe736('0x2c')]);_0x3052cf['attributes']=_['intersection'](_0x5e9067[_0xe736('0x2b')],qs[_0xe736('0x30')](_0x26d408[_0xe736('0x2c')]['fields']));_0x3052cf[_0xe736('0x31')]=_0x3052cf[_0xe736('0x31')][_0xe736('0x32')]?_0x3052cf[_0xe736('0x31')]:_0x5e9067[_0xe736('0x2b')];if(_0x26d408[_0xe736('0x2c')][_0xe736('0x39')]){_0x3052cf[_0xe736('0x3d')]=[{'all':!![]}];}_0x3052cf=_[_0xe736('0x36')]({},_0x3052cf,_0x26d408[_0xe736('0x3e')]);return db[_0xe736('0x28')]['find'](_0x3052cf)[_0xe736('0x22')](handleEntityNotFound(_0x494a28,null))[_0xe736('0x22')](respondWithResult(_0x494a28,null))['catch'](handleError(_0x494a28,null));};exports[_0xe736('0x3f')]=function(_0x3ab16d,_0x249630){return db[_0xe736('0x28')]['create'](_0x3ab16d[_0xe736('0x40')],{})['then'](respondWithResult(_0x249630,0xc9))[_0xe736('0x3b')](handleError(_0x249630,null));};exports[_0xe736('0x21')]=function(_0x37ea2f,_0x3042e5){if(_0x37ea2f[_0xe736('0x40')]['id']){delete _0x37ea2f[_0xe736('0x40')]['id'];}return db['ZohoField'][_0xe736('0x41')]({'where':{'id':_0x37ea2f[_0xe736('0x3c')]['id']}})[_0xe736('0x22')](handleEntityNotFound(_0x3042e5,null))[_0xe736('0x22')](saveUpdates(_0x37ea2f[_0xe736('0x40')],null))[_0xe736('0x22')](respondWithResult(_0x3042e5,null))[_0xe736('0x3b')](handleError(_0x3042e5,null));};exports[_0xe736('0x42')]=function(_0x5d7c72,_0x19b92b){return db[_0xe736('0x28')][_0xe736('0x41')]({'where':{'id':_0x5d7c72[_0xe736('0x3c')]['id']}})['then'](handleEntityNotFound(_0x19b92b,null))[_0xe736('0x22')](removeEntity(_0x19b92b,null))[_0xe736('0x3b')](handleError(_0x19b92b,null));}; \ No newline at end of file +var _0xb688=['attributes','order','sort','where','pick','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','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','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ZohoField','fieldName','type','query','keys','filters','intersection','model','fields'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb688,0x64));var _0x8b68=function(_0x3e9995,_0x2414f0){_0x3e9995=_0x3e9995-0x0;var _0x5ea169=_0xb688[_0x3e9995];return _0x5ea169;};'use strict';var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require('fast-json-patch');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('fs-extra');var _=require(_0x8b68('0xa'));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('papaparse');var Redis=require(_0x8b68('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8b68('0x11'));var as=require(_0x8b68('0x12'));var hardwareService=require(_0x8b68('0x13'));var logger=require(_0x8b68('0x14'))(_0x8b68('0x15'));var utils=require(_0x8b68('0x16'));var config=require(_0x8b68('0x17'));var licenseUtil=require(_0x8b68('0x18'));var db=require(_0x8b68('0x19'))['db'];function respondWithStatusCode(_0x7e3005,_0x37aa8e){_0x37aa8e=_0x37aa8e||0xcc;return function(_0x2723c4){if(_0x2723c4){return _0x7e3005[_0x8b68('0x1a')](_0x37aa8e);}return _0x7e3005['status'](_0x37aa8e)[_0x8b68('0x1b')]();};}function respondWithResult(_0x3235c6,_0x327789){_0x327789=_0x327789||0xc8;return function(_0x1cc135){if(_0x1cc135){return _0x3235c6[_0x8b68('0x1c')](_0x327789)[_0x8b68('0x1d')](_0x1cc135);}};}function respondWithFilteredResult(_0x546b10,_0x3b4f10){return function(_0x46d4c3){if(_0x46d4c3){var _0x2b0931=typeof _0x3b4f10[_0x8b68('0x1e')]===_0x8b68('0x1f')&&typeof _0x3b4f10[_0x8b68('0x20')]===_0x8b68('0x1f');var _0x794c0e=_0x46d4c3['count'];var _0x5abd35=_0x2b0931?0x0:_0x3b4f10['offset'];var _0x499d15=_0x2b0931?_0x46d4c3['count']:_0x3b4f10[_0x8b68('0x1e')]+_0x3b4f10[_0x8b68('0x20')];var _0x5f5aba;if(_0x499d15>=_0x794c0e){_0x499d15=_0x794c0e;_0x5f5aba=0xc8;}else{_0x5f5aba=0xce;}_0x546b10['status'](_0x5f5aba);return _0x546b10[_0x8b68('0x21')](_0x8b68('0x22'),_0x5abd35+'-'+_0x499d15+'/'+_0x794c0e)[_0x8b68('0x1d')](_0x46d4c3);}return null;};}function patchUpdates(_0x2d0c80){return function(_0x4a26db){try{jsonpatch[_0x8b68('0x23')](_0x4a26db,_0x2d0c80,!![]);}catch(_0x300d79){return BPromise[_0x8b68('0x24')](_0x300d79);}return _0x4a26db['save']();};}function saveUpdates(_0x40dba5,_0x1e57e2){return function(_0x28b233){if(_0x28b233){return _0x28b233[_0x8b68('0x25')](_0x40dba5)[_0x8b68('0x26')](function(_0x1191ab){return _0x1191ab;});}return null;};}function removeEntity(_0x189221,_0x4317cd){return function(_0x570aab){if(_0x570aab){return _0x570aab['destroy']()['then'](function(){_0x189221[_0x8b68('0x1c')](0xcc)[_0x8b68('0x1b')]();});}};}function handleEntityNotFound(_0x561a60,_0x48949a){return function(_0x3f9b6e){if(!_0x3f9b6e){_0x561a60[_0x8b68('0x1a')](0x194);}return _0x3f9b6e;};}function handleError(_0x3c330c,_0x44fb72){_0x44fb72=_0x44fb72||0x1f4;return function(_0x4c39ca){logger[_0x8b68('0x27')](_0x4c39ca[_0x8b68('0x28')]);if(_0x4c39ca[_0x8b68('0x29')]){delete _0x4c39ca[_0x8b68('0x29')];}_0x3c330c['status'](_0x44fb72)[_0x8b68('0x2a')](_0x4c39ca);};}exports[_0x8b68('0x2b')]=function(_0x2bf077,_0x57e214){var _0x3b7ce0={},_0x56ab4a={},_0x49c796={'count':0x0,'rows':[]};var _0x3e26a0=_[_0x8b68('0x2c')](db[_0x8b68('0x2d')]['rawAttributes'],function(_0x3f1850){return{'name':_0x3f1850[_0x8b68('0x2e')],'type':_0x3f1850[_0x8b68('0x2f')]['key']};});_0x56ab4a['model']=_[_0x8b68('0x2c')](_0x3e26a0,_0x8b68('0x29'));_0x56ab4a[_0x8b68('0x30')]=_[_0x8b68('0x31')](_0x2bf077[_0x8b68('0x30')]);_0x56ab4a[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x56ab4a[_0x8b68('0x34')],_0x56ab4a['query']);_0x3b7ce0['attributes']=_[_0x8b68('0x33')](_0x56ab4a['model'],qs[_0x8b68('0x35')](_0x2bf077[_0x8b68('0x30')]['fields']));_0x3b7ce0[_0x8b68('0x36')]=_0x3b7ce0['attributes']['length']?_0x3b7ce0['attributes']:_0x56ab4a[_0x8b68('0x34')];if(!_0x2bf077[_0x8b68('0x30')]['hasOwnProperty']('nolimit')){_0x3b7ce0['limit']=qs[_0x8b68('0x20')](_0x2bf077[_0x8b68('0x30')][_0x8b68('0x20')]);_0x3b7ce0['offset']=qs[_0x8b68('0x1e')](_0x2bf077['query'][_0x8b68('0x1e')]);}_0x3b7ce0[_0x8b68('0x37')]=qs[_0x8b68('0x38')](_0x2bf077[_0x8b68('0x30')]['sort']);_0x3b7ce0[_0x8b68('0x39')]=qs[_0x8b68('0x32')](_[_0x8b68('0x3a')](_0x2bf077[_0x8b68('0x30')],_0x56ab4a[_0x8b68('0x32')]),_0x3e26a0);if(_0x2bf077['query']['filter']){_0x3b7ce0[_0x8b68('0x39')]=_['merge'](_0x3b7ce0[_0x8b68('0x39')],{'$or':_[_0x8b68('0x2c')](_0x3e26a0,function(_0x5aa84a){if(_0x5aa84a[_0x8b68('0x2f')]!==_0x8b68('0x3b')){var _0x29f615={};_0x29f615[_0x5aa84a[_0x8b68('0x29')]]={'$like':'%'+_0x2bf077[_0x8b68('0x30')][_0x8b68('0x3c')]+'%'};return _0x29f615;}})});}_0x3b7ce0=_[_0x8b68('0x3d')]({},_0x3b7ce0,_0x2bf077[_0x8b68('0x3e')]);var _0x1cd6fb={'where':_0x3b7ce0[_0x8b68('0x39')]};return db[_0x8b68('0x2d')][_0x8b68('0x3f')](_0x1cd6fb)[_0x8b68('0x26')](function(_0x274324){_0x49c796[_0x8b68('0x3f')]=_0x274324;if(_0x2bf077[_0x8b68('0x30')]['includeAll']){_0x3b7ce0[_0x8b68('0x40')]=[{'all':!![]}];}return db[_0x8b68('0x2d')][_0x8b68('0x41')](_0x3b7ce0);})['then'](function(_0x42ff5d){_0x49c796[_0x8b68('0x42')]=_0x42ff5d;return _0x49c796;})[_0x8b68('0x26')](respondWithFilteredResult(_0x57e214,_0x3b7ce0))[_0x8b68('0x43')](handleError(_0x57e214,null));};exports[_0x8b68('0x44')]=function(_0x162924,_0x306827){var _0x5a1db8={'raw':!![],'where':{'id':_0x162924[_0x8b68('0x45')]['id']}},_0x1b9e13={};_0x1b9e13[_0x8b68('0x34')]=_[_0x8b68('0x31')](db['ZohoField'][_0x8b68('0x46')]);_0x1b9e13[_0x8b68('0x30')]=_[_0x8b68('0x31')](_0x162924[_0x8b68('0x30')]);_0x1b9e13[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x1b9e13[_0x8b68('0x34')],_0x1b9e13[_0x8b68('0x30')]);_0x5a1db8[_0x8b68('0x36')]=_['intersection'](_0x1b9e13[_0x8b68('0x34')],qs[_0x8b68('0x35')](_0x162924[_0x8b68('0x30')][_0x8b68('0x35')]));_0x5a1db8[_0x8b68('0x36')]=_0x5a1db8[_0x8b68('0x36')][_0x8b68('0x47')]?_0x5a1db8['attributes']:_0x1b9e13[_0x8b68('0x34')];if(_0x162924[_0x8b68('0x30')][_0x8b68('0x48')]){_0x5a1db8['include']=[{'all':!![]}];}_0x5a1db8=_[_0x8b68('0x3d')]({},_0x5a1db8,_0x162924[_0x8b68('0x3e')]);return db[_0x8b68('0x2d')][_0x8b68('0x49')](_0x5a1db8)['then'](handleEntityNotFound(_0x306827,null))['then'](respondWithResult(_0x306827,null))['catch'](handleError(_0x306827,null));};exports[_0x8b68('0x4a')]=function(_0x2fc4de,_0x451cb7){return db[_0x8b68('0x2d')][_0x8b68('0x4a')](_0x2fc4de[_0x8b68('0x4b')],{})['then'](respondWithResult(_0x451cb7,0xc9))[_0x8b68('0x43')](handleError(_0x451cb7,null));};exports[_0x8b68('0x25')]=function(_0x37b8fd,_0x1dc784){if(_0x37b8fd['body']['id']){delete _0x37b8fd[_0x8b68('0x4b')]['id'];}return db[_0x8b68('0x2d')][_0x8b68('0x49')]({'where':{'id':_0x37b8fd[_0x8b68('0x45')]['id']}})[_0x8b68('0x26')](handleEntityNotFound(_0x1dc784,null))[_0x8b68('0x26')](saveUpdates(_0x37b8fd['body'],null))[_0x8b68('0x26')](respondWithResult(_0x1dc784,null))['catch'](handleError(_0x1dc784,null));};exports[_0x8b68('0x4c')]=function(_0x4002f8,_0x4d4ea2){return db[_0x8b68('0x2d')][_0x8b68('0x49')]({'where':{'id':_0x4002f8['params']['id']}})[_0x8b68('0x26')](handleEntityNotFound(_0x4d4ea2,null))[_0x8b68('0x26')](removeEntity(_0x4d4ea2,null))[_0x8b68('0x43')](handleError(_0x4d4ea2,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d992377..4afcf9a 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 _0x8aad=['request-promise','../../config/environment','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8aad,0x146));var _0xd8aa=function(_0xa27343,_0x1398ae){_0xa27343=_0xa27343-0x0;var _0x5fbe43=_0x8aad[_0xa27343];return _0x5fbe43;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require('../../config/logger')(_0xd8aa('0x2'));var moment=require('moment');var BPromise=require(_0xd8aa('0x3'));var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8aa('0x5'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x16b648,_0x43ddeb){return _0x16b648[_0xd8aa('0x6')]('ZohoField',attributes,{'tableName':_0xd8aa('0x7'),'paranoid':![],'indexes':[{'name':_0xd8aa('0x8'),'fields':[_0xd8aa('0x9'),_0xd8aa('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['zoho_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x9536,0x179));var _0x6953=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x9536[_0x3b711c];return _0x2685f0;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['idField',_0x6953('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index cb55bc6..7bb4588 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 _0x827b=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x19d27d,_0x5edf43){var _0x534f58=function(_0x9417b6){while(--_0x9417b6){_0x19d27d['push'](_0x19d27d['shift']());}};_0x534f58(++_0x5edf43);}(_0x827b,0x18f));var _0xb827=function(_0x1bc79c,_0x26de9c){_0x1bc79c=_0x1bc79c-0x0;var _0x1a36df=_0x827b[_0x1bc79c];return _0x1a36df;};'use strict';var _=require(_0xb827('0x0'));var util=require(_0xb827('0x1'));var moment=require(_0xb827('0x2'));var BPromise=require(_0xb827('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb827('0x4'));var db=require(_0xb827('0x5'))['db'];var utils=require(_0xb827('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb827('0x7'));var client=jayson[_0xb827('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3d20,_0x3de479,_0x2f5206){return new BPromise(function(_0xb42f23,_0x266152){return client[_0xb827('0x9')](_0x3c3d20,_0x2f5206)[_0xb827('0xa')](function(_0x23ea56){logger['info'](_0xb827('0xb'),_0x3de479,'request\x20sent');logger[_0xb827('0xc')](_0xb827('0xd'),_0x3de479,_0xb827('0xe'),JSON[_0xb827('0xf')](_0x23ea56));if(_0x23ea56[_0xb827('0x10')]){if(_0x23ea56[_0xb827('0x10')][_0xb827('0x11')]===0x1f4){logger[_0xb827('0x10')](_0xb827('0xb'),_0x3de479,_0x23ea56[_0xb827('0x10')][_0xb827('0x12')]);return _0x266152(_0x23ea56[_0xb827('0x10')][_0xb827('0x12')]);}logger[_0xb827('0x10')](_0xb827('0xb'),_0x3de479,_0x23ea56[_0xb827('0x10')][_0xb827('0x12')]);return _0xb42f23(_0x23ea56['error'][_0xb827('0x12')]);}else{logger[_0xb827('0x13')](_0xb827('0xb'),_0x3de479,_0xb827('0xe'));_0xb42f23(_0x23ea56[_0xb827('0x14')][_0xb827('0x12')]);}})[_0xb827('0x15')](function(_0x1b4256){logger[_0xb827('0x10')]('ZohoField,\x20%s,\x20%s',_0x3de479,_0x1b4256);_0x266152(_0x1b4256);});});} \ No newline at end of file +var _0x182c=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x182c,0x164));var _0xc182=function(_0x5d829d,_0x14680a){_0x5d829d=_0x5d829d-0x0;var _0x25a70f=_0x182c[_0x5d829d];return _0x25a70f;};'use strict';var _=require(_0xc182('0x0'));var util=require(_0xc182('0x1'));var moment=require(_0xc182('0x2'));var BPromise=require(_0xc182('0x3'));var rs=require(_0xc182('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc182('0x5'))['db'];var utils=require(_0xc182('0x6'));var logger=require(_0xc182('0x7'))(_0xc182('0x8'));var config=require(_0xc182('0x9'));var jayson=require(_0xc182('0xa'));var client=jayson[_0xc182('0xb')][_0xc182('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ea230,_0x389949,_0x123975){return new BPromise(function(_0x4cc16e,_0x5d4d68){return client[_0xc182('0xd')](_0x3ea230,_0x123975)[_0xc182('0xe')](function(_0xe6b6ef){logger[_0xc182('0xf')](_0xc182('0x10'),_0x389949,_0xc182('0x11'));logger[_0xc182('0x12')](_0xc182('0x13'),_0x389949,_0xc182('0x11'),JSON[_0xc182('0x14')](_0xe6b6ef));if(_0xe6b6ef['error']){if(_0xe6b6ef['error'][_0xc182('0x15')]===0x1f4){logger[_0xc182('0x16')](_0xc182('0x10'),_0x389949,_0xe6b6ef[_0xc182('0x16')]['message']);return _0x5d4d68(_0xe6b6ef['error']['message']);}logger['error'](_0xc182('0x10'),_0x389949,_0xe6b6ef[_0xc182('0x16')][_0xc182('0x17')]);return _0x4cc16e(_0xe6b6ef['error'][_0xc182('0x17')]);}else{logger[_0xc182('0xf')]('ZohoField,\x20%s,\x20%s',_0x389949,'request\x20sent');_0x4cc16e(_0xe6b6ef['result'][_0xc182('0x17')]);}})[_0xc182('0x18')](function(_0x3799a1){logger[_0xc182('0x16')](_0xc182('0x10'),_0x389949,_0x3799a1);_0x5d4d68(_0x3799a1);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 64f20c7..148b795 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x40f7b8,_0x7e425b){var _0x3dddc0=function(_0x304da4){while(--_0x304da4){_0x40f7b8['push'](_0x40f7b8['shift']());}};_0x3dddc0(++_0x7e425b);}(_0x70e0,0x17b));var _0x070e=function(_0x1bd112,_0x6376b2){_0x1bd112=_0x1bd112-0x0;var _0x313cb9=_0x70e0[_0x1bd112];return _0x313cb9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x533af8,_0x1f2b7c){var _0x331f44=function(_0xa2fdf0){while(--_0xa2fdf0){_0x533af8['push'](_0x533af8['shift']());}};_0x331f44(++_0x1f2b7c);}(_0x70e0,0x17b));var _0x070e=function(_0x255d81,_0x4614e1){_0x255d81=_0x255d81-0x0;var _0x4f0831=_0x70e0[_0x255d81];return _0x4f0831;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ab68617..5e67b14 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 _0xa8ac=['BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x283396,_0x3f712e){var _0x23f064=function(_0x4dadcd){while(--_0x4dadcd){_0x283396['push'](_0x283396['shift']());}};_0x23f064(++_0x3f712e);}(_0xa8ac,0xd9));var _0xca8a=function(_0x157099,_0x2af9e4){_0x157099=_0x157099-0x0;var _0x5d8f1b=_0xa8ac[_0x157099];return _0x5d8f1b;};'use strict';var Sequelize=require('sequelize');module[_0xca8a('0x0')]={'name':{'type':Sequelize[_0xca8a('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xca8a('0x1')],'allowNull':![],'unique':_0xca8a('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xca8a('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xca8a('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xca8a('0x3')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xca8a('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xca8a('0x4')},'description':{'type':Sequelize[_0xca8a('0x1')]},'title':{'type':Sequelize[_0xca8a('0x1')]},'remoteUri':{'type':Sequelize[_0xca8a('0x1')]},'link':{'type':Sequelize[_0xca8a('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1c2a=['STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c2a,0xbf));var _0xa1c2=function(_0x565d37,_0x4bf65f){_0x565d37=_0x565d37-0x0;var _0x43fbb9=_0x1c2a[_0x565d37];return _0x43fbb9;};'use strict';var Sequelize=require(_0xa1c2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c2('0x1')],'allowNull':![],'unique':_0xa1c2('0x2')},'version':{'type':Sequelize[_0xa1c2('0x1')],'allowNull':![],'unique':_0xa1c2('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xa1c2('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xa1c2('0x1')]},'type':{'type':Sequelize[_0xa1c2('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xa1c2('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xa1c2('0x1')]},'logo':{'type':Sequelize[_0xa1c2('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xa1c2('0x5')},'description':{'type':Sequelize[_0xa1c2('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa1c2('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 2339707..26644ee 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 _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x5edef8,_0x7af9a9){var _0x5438f6=function(_0x1ad5db){while(--_0x1ad5db){_0x5edef8['push'](_0x5edef8['shift']());}};_0x5438f6(++_0x7af9a9);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ca455,_0xb41742){_0x5ca455=_0x5ca455-0x0;var _0x4658d4=_0x2ef3[_0x5ca455];return _0x4658d4;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file +var _0x524e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Integration','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x524e,0x15e));var _0xe524=function(_0x49f1db,_0x4f2705){_0x49f1db=_0x49f1db-0x0;var _0x1dc34c=_0x524e[_0x49f1db];return _0x1dc34c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['Integration'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['Integration'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 70eeab6..05635aa 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 _0xe085=['exports','define','Integration','integrations','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x43c927,_0x53f9af){var _0x4d358f=function(_0x4c52f3){while(--_0x4c52f3){_0x43c927['push'](_0x43c927['shift']());}};_0x4d358f(++_0x53f9af);}(_0xe085,0x1a4));var _0x5e08=function(_0x4783b3,_0x39c574){_0x4783b3=_0x4783b3-0x0;var _0x2c2526=_0xe085[_0x4783b3];return _0x2c2526;};'use strict';var _=require(_0x5e08('0x0'));var util=require(_0x5e08('0x1'));var logger=require('../../config/logger')(_0x5e08('0x2'));var moment=require(_0x5e08('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e08('0x4'));var fs=require('fs');var path=require(_0x5e08('0x5'));var rimraf=require(_0x5e08('0x6'));var config=require(_0x5e08('0x7'));var attributes=require(_0x5e08('0x8'));module[_0x5e08('0x9')]=function(_0xc7e1a0,_0x2824d){return _0xc7e1a0[_0x5e08('0xa')](_0x5e08('0xb'),attributes,{'tableName':_0x5e08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4825=['util','api','moment','request-promise','rimraf','./integration.attributes','define','Integration','integrations','lodash'];(function(_0x1ad76c,_0x30fe9f){var _0x3810ac=function(_0x1796d8){while(--_0x1796d8){_0x1ad76c['push'](_0x1ad76c['shift']());}};_0x3810ac(++_0x30fe9f);}(_0x4825,0x117));var _0x5482=function(_0x1b7f8d,_0x47a3d0){_0x1b7f8d=_0x1b7f8d-0x0;var _0x28e65a=_0x4825[_0x1b7f8d];return _0x28e65a;};'use strict';var _=require(_0x5482('0x0'));var util=require(_0x5482('0x1'));var logger=require('../../config/logger')(_0x5482('0x2'));var moment=require(_0x5482('0x3'));var BPromise=require('bluebird');var rp=require(_0x5482('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5482('0x5'));var config=require('../../config/environment');var attributes=require(_0x5482('0x6'));module['exports']=function(_0x2ece33,_0x491d3a){return _0x2ece33[_0x5482('0x7')](_0x5482('0x8'),attributes,{'tableName':_0x5482('0x9'),'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 7c8b0ea..e8a0b1f 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x524e,0x15e));var _0xe524=function(_0x364d1f,_0x4b24b3){_0x364d1f=_0x364d1f-0x0;var _0x6a1612=_0x524e[_0x364d1f];return _0x6a1612;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x501c00,_0x1dc98b){var _0x5ad836=function(_0x21299f){while(--_0x21299f){_0x501c00['push'](_0x501c00['shift']());}};_0x5ad836(++_0x1dc98b);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x3fe794,_0x406f0b){_0x3fe794=_0x3fe794-0x0;var _0x153dd1=_0xd7d1[_0x3fe794];return _0x153dd1;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 34a3612..9c53da0 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 _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(_0xae306f,_0x2ef4cb){var _0x14aab7=function(_0x5cb3d2){while(--_0x5cb3d2){_0xae306f['push'](_0xae306f['shift']());}};_0x14aab7(++_0x2ef4cb);}(_0x524e,0x15e));var _0xe524=function(_0x23876d,_0x48d184){_0x23876d=_0x23876d-0x0;var _0x429065=_0x524e[_0x23876d];return _0x429065;};'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 +var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x56b7cf,_0x5e3446){var _0x2d75a0=function(_0x3dec12){while(--_0x3dec12){_0x56b7cf['push'](_0x56b7cf['shift']());}};_0x2d75a0(++_0x5e3446);}(_0x7880,0x1f4));var _0x0788=function(_0x18c4bf,_0x56dfe5){_0x18c4bf=_0x18c4bf-0x0;var _0x5c9674=_0x7880[_0x18c4bf];return _0x5c9674;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 5aef761..9bd82e3 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 _0x8f94=['DATE','BOOLEAN','TEXT','ENUM','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x8f94,0xcb));var _0x48f9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8f94[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x48f9('0x0'));module[_0x48f9('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x48f9('0x2')]},'exitStatus':{'type':Sequelize[_0x48f9('0x2')]},'ticketId':{'type':Sequelize[_0x48f9('0x2')]},'integrationId':{'type':Sequelize[_0x48f9('0x3')]},'contacts':{'type':Sequelize[_0x48f9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x48f9('0x2')]},'calleridname':{'type':Sequelize[_0x48f9('0x2')]},'queue':{'type':Sequelize[_0x48f9('0x2')]},'interface':{'type':Sequelize[_0x48f9('0x2')]},'membername':{'type':Sequelize[_0x48f9('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x48f9('0x4')]},'holdtime':{'type':Sequelize[_0x48f9('0x3')]},'agentcomplete':{'type':Sequelize[_0x48f9('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x48f9('0x4')]},'talktime':{'type':Sequelize[_0x48f9('0x3')]},'agentacw':{'type':Sequelize[_0x48f9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x48f9('0x4')]},'agentdump':{'type':Sequelize[_0x48f9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x48f9('0x4')]},'lastevent':{'type':Sequelize[_0x48f9('0x2')]},'channel':{'type':Sequelize[_0x48f9('0x2')]},'channelstate':{'type':Sequelize[_0x48f9('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x48f9('0x2')]},'connectedlinename':{'type':Sequelize[_0x48f9('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x48f9('0x2')]},'context':{'type':Sequelize[_0x48f9('0x2')]},'exten':{'type':Sequelize[_0x48f9('0x2')]},'priority':{'type':Sequelize[_0x48f9('0x2')]},'destchannel':{'type':Sequelize[_0x48f9('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x48f9('0x2')]},'destcalleridname':{'type':Sequelize[_0x48f9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x48f9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x48f9('0x2')]},'destlanguage':{'type':Sequelize[_0x48f9('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x48f9('0x2')]},'destuniqueid':{'type':Sequelize[_0x48f9('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x48f9('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x48f9('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x48f9('0x2')]},'attachment':{'type':Sequelize[_0x48f9('0x6')]},'html':{'type':Sequelize[_0x48f9('0x6')]},'text':{'type':Sequelize[_0x48f9('0x6')]},'status':{'type':Sequelize[_0x48f9('0x7')]('SENT','SENDING','RECEIVED',_0x48f9('0x8'))},'url':{'type':Sequelize[_0x48f9('0x2')]},'app':{'type':Sequelize[_0x48f9('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x48f9('0x3')]}}; \ No newline at end of file +var _0x3007=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x567e3f,_0x3df761){var _0x3fc825=function(_0x37006e){while(--_0x37006e){_0x567e3f['push'](_0x567e3f['shift']());}};_0x3fc825(++_0x3df761);}(_0x3007,0x19d));var _0x7300=function(_0x5edf01,_0x35aee0){_0x5edf01=_0x5edf01-0x0;var _0x1e9631=_0x3007[_0x5edf01];return _0x1e9631;};'use strict';var Sequelize=require(_0x7300('0x0'));module[_0x7300('0x1')]={'integration':{'type':Sequelize[_0x7300('0x2')]},'eventChannel':{'type':Sequelize[_0x7300('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x7300('0x3')]},'contacts':{'type':Sequelize[_0x7300('0x2')]},'uniqueid':{'type':Sequelize[_0x7300('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7300('0x2')]},'queue':{'type':Sequelize[_0x7300('0x2')]},'interface':{'type':Sequelize[_0x7300('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7300('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7300('0x3')]},'agentcomplete':{'type':Sequelize[_0x7300('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7300('0x4')]},'talktime':{'type':Sequelize[_0x7300('0x3')]},'agentacw':{'type':Sequelize[_0x7300('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7300('0x3')]},'reason':{'type':Sequelize[_0x7300('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x7300('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7300('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7300('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x7300('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7300('0x2')]},'language':{'type':Sequelize[_0x7300('0x2')]},'accountcode':{'type':Sequelize[_0x7300('0x2')]},'context':{'type':Sequelize[_0x7300('0x2')]},'exten':{'type':Sequelize[_0x7300('0x2')]},'priority':{'type':Sequelize[_0x7300('0x2')]},'destchannel':{'type':Sequelize[_0x7300('0x2')]},'destchannelstate':{'type':Sequelize[_0x7300('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7300('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7300('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7300('0x2')]},'destlanguage':{'type':Sequelize[_0x7300('0x2')]},'destaccountcode':{'type':Sequelize[_0x7300('0x2')]},'destcontext':{'type':Sequelize[_0x7300('0x2')]},'destexten':{'type':Sequelize[_0x7300('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x7300('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7300('0x2')]},'subject':{'type':Sequelize[_0x7300('0x2')]},'from':{'type':Sequelize[_0x7300('0x2')]},'to':{'type':Sequelize[_0x7300('0x2')]},'cc':{'type':Sequelize[_0x7300('0x2')]},'attachment':{'type':Sequelize[_0x7300('0x6')]},'html':{'type':Sequelize[_0x7300('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x7300('0x7')]('SENT',_0x7300('0x8'),_0x7300('0x9'),_0x7300('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x7300('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7300('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 170e7ce..c55d1f6 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 _0x24ce=['fieldName','key','query','keys','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','count','rows','catch','show','params','includeAll','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport'];(function(_0x2ea3c0,_0x3db8e9){var _0x1e888e=function(_0x556f82){while(--_0x556f82){_0x2ea3c0['push'](_0x2ea3c0['shift']());}};_0x1e888e(++_0x3db8e9);}(_0x24ce,0x106));var _0xe24c=function(_0x3acf0b,_0x5eeb32){_0x3acf0b=_0x3acf0b-0x0;var _0x153ecf=_0x24ce[_0x3acf0b];return _0x153ecf;};'use strict';var emlformat=require(_0xe24c('0x0'));var rimraf=require(_0xe24c('0x1'));var zipdir=require(_0xe24c('0x2'));var jsonpatch=require(_0xe24c('0x3'));var rp=require(_0xe24c('0x4'));var moment=require(_0xe24c('0x5'));var BPromise=require(_0xe24c('0x6'));var Mustache=require(_0xe24c('0x7'));var util=require(_0xe24c('0x8'));var path=require(_0xe24c('0x9'));var sox=require(_0xe24c('0xa'));var csv=require(_0xe24c('0xb'));var ejs=require(_0xe24c('0xc'));var fs=require('fs');var fs_extra=require(_0xe24c('0xd'));var _=require(_0xe24c('0xe'));var squel=require(_0xe24c('0xf'));var crypto=require(_0xe24c('0x10'));var jsforce=require(_0xe24c('0x11'));var deskjs=require(_0xe24c('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe24c('0x13'));var Redis=require(_0xe24c('0x14'));var authService=require(_0xe24c('0x15'));var qs=require(_0xe24c('0x16'));var as=require(_0xe24c('0x17'));var hardwareService=require(_0xe24c('0x18'));var logger=require(_0xe24c('0x19'))(_0xe24c('0x1a'));var utils=require(_0xe24c('0x1b'));var config=require(_0xe24c('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xe24c('0x1d'))['db'];function respondWithStatusCode(_0x192f9c,_0xd36e18){_0xd36e18=_0xd36e18||0xcc;return function(_0x8ca582){if(_0x8ca582){return _0x192f9c['sendStatus'](_0xd36e18);}return _0x192f9c[_0xe24c('0x1e')](_0xd36e18)[_0xe24c('0x1f')]();};}function respondWithResult(_0x85f717,_0x844786){_0x844786=_0x844786||0xc8;return function(_0x486b9d){if(_0x486b9d){return _0x85f717[_0xe24c('0x1e')](_0x844786)[_0xe24c('0x20')](_0x486b9d);}};}function respondWithFilteredResult(_0x30ec15,_0x1a6bff){return function(_0x1ce0a1){if(_0x1ce0a1){var _0x4f50ff=typeof _0x1a6bff[_0xe24c('0x21')]===_0xe24c('0x22')&&typeof _0x1a6bff[_0xe24c('0x23')]===_0xe24c('0x22');var _0x502c71=_0x1ce0a1['count'];var _0x49fead=_0x4f50ff?0x0:_0x1a6bff[_0xe24c('0x21')];var _0x172c62=_0x4f50ff?_0x1ce0a1['count']:_0x1a6bff[_0xe24c('0x21')]+_0x1a6bff['limit'];var _0x4c19f6;if(_0x172c62>=_0x502c71){_0x172c62=_0x502c71;_0x4c19f6=0xc8;}else{_0x4c19f6=0xce;}_0x30ec15[_0xe24c('0x1e')](_0x4c19f6);return _0x30ec15[_0xe24c('0x24')](_0xe24c('0x25'),_0x49fead+'-'+_0x172c62+'/'+_0x502c71)[_0xe24c('0x20')](_0x1ce0a1);}return null;};}function patchUpdates(_0x1f7bad){return function(_0x58b1e4){try{jsonpatch['apply'](_0x58b1e4,_0x1f7bad,!![]);}catch(_0x17d7b3){return BPromise[_0xe24c('0x26')](_0x17d7b3);}return _0x58b1e4[_0xe24c('0x27')]();};}function saveUpdates(_0x46ff32,_0x3220e2){return function(_0x5218a7){if(_0x5218a7){return _0x5218a7[_0xe24c('0x28')](_0x46ff32)[_0xe24c('0x29')](function(_0x542e07){return _0x542e07;});}return null;};}function removeEntity(_0x2ea48e,_0x35fce9){return function(_0x9a9352){if(_0x9a9352){return _0x9a9352[_0xe24c('0x2a')]()['then'](function(){_0x2ea48e[_0xe24c('0x1e')](0xcc)[_0xe24c('0x1f')]();});}};}function handleEntityNotFound(_0x16e84c,_0x27df17){return function(_0x581a86){if(!_0x581a86){_0x16e84c['sendStatus'](0x194);}return _0x581a86;};}function handleError(_0xa5d10,_0x105b1f){_0x105b1f=_0x105b1f||0x1f4;return function(_0x3fc60f){logger[_0xe24c('0x2b')](_0x3fc60f[_0xe24c('0x2c')]);if(_0x3fc60f[_0xe24c('0x2d')]){delete _0x3fc60f[_0xe24c('0x2d')];}_0xa5d10[_0xe24c('0x1e')](_0x105b1f)[_0xe24c('0x2e')](_0x3fc60f);};}exports[_0xe24c('0x2f')]=function(_0x5d5b97,_0x2e805f){var _0x532d12={},_0x302d4f={},_0xfcc999={'count':0x0,'rows':[]};var _0x389f02=_[_0xe24c('0x30')](db[_0xe24c('0x31')]['rawAttributes'],function(_0x319a2d){return{'name':_0x319a2d[_0xe24c('0x32')],'type':_0x319a2d['type'][_0xe24c('0x33')]};});_0x302d4f['model']=_[_0xe24c('0x30')](_0x389f02,'name');_0x302d4f[_0xe24c('0x34')]=_[_0xe24c('0x35')](_0x5d5b97[_0xe24c('0x34')]);_0x302d4f['filters']=_['intersection'](_0x302d4f['model'],_0x302d4f['query']);_0x532d12[_0xe24c('0x36')]=_['intersection'](_0x302d4f[_0xe24c('0x37')],qs[_0xe24c('0x38')](_0x5d5b97[_0xe24c('0x34')][_0xe24c('0x38')]));_0x532d12[_0xe24c('0x36')]=_0x532d12[_0xe24c('0x36')][_0xe24c('0x39')]?_0x532d12[_0xe24c('0x36')]:_0x302d4f[_0xe24c('0x37')];if(!_0x5d5b97['query'][_0xe24c('0x3a')]('nolimit')){_0x532d12[_0xe24c('0x23')]=qs[_0xe24c('0x23')](_0x5d5b97['query'][_0xe24c('0x23')]);_0x532d12[_0xe24c('0x21')]=qs[_0xe24c('0x21')](_0x5d5b97[_0xe24c('0x34')][_0xe24c('0x21')]);}_0x532d12[_0xe24c('0x3b')]=qs['sort'](_0x5d5b97[_0xe24c('0x34')][_0xe24c('0x3c')]);_0x532d12[_0xe24c('0x3d')]=qs[_0xe24c('0x3e')](_['pick'](_0x5d5b97[_0xe24c('0x34')],_0x302d4f[_0xe24c('0x3e')]),_0x389f02);if(_0x5d5b97['query']['filter']){_0x532d12[_0xe24c('0x3d')]=_[_0xe24c('0x3f')](_0x532d12[_0xe24c('0x3d')],{'$or':_[_0xe24c('0x30')](_0x389f02,function(_0x4ad42f){if(_0x4ad42f['type']!==_0xe24c('0x40')){var _0x36d5ea={};_0x36d5ea[_0x4ad42f[_0xe24c('0x2d')]]={'$like':'%'+_0x5d5b97[_0xe24c('0x34')][_0xe24c('0x41')]+'%'};return _0x36d5ea;}})});}_0x532d12=_[_0xe24c('0x3f')]({},_0x532d12,_0x5d5b97['options']);var _0x1365dc={'where':_0x532d12['where']};return db[_0xe24c('0x31')][_0xe24c('0x42')](_0x1365dc)[_0xe24c('0x29')](function(_0x1a9562){_0xfcc999[_0xe24c('0x42')]=_0x1a9562;if(_0x5d5b97[_0xe24c('0x34')]['includeAll']){_0x532d12['include']=[{'all':!![]}];}return db[_0xe24c('0x31')]['findAll'](_0x532d12);})[_0xe24c('0x29')](function(_0x16b7f6){_0xfcc999[_0xe24c('0x43')]=_0x16b7f6;return _0xfcc999;})['then'](respondWithFilteredResult(_0x2e805f,_0x532d12))[_0xe24c('0x44')](handleError(_0x2e805f,null));};exports[_0xe24c('0x45')]=function(_0x4fbb14,_0x385748){var _0x296be7={'raw':![],'where':{'id':_0x4fbb14[_0xe24c('0x46')]['id']}},_0x3e0fd9={};_0x3e0fd9[_0xe24c('0x37')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x3e0fd9['query']=_['keys'](_0x4fbb14[_0xe24c('0x34')]);_0x3e0fd9[_0xe24c('0x3e')]=_['intersection'](_0x3e0fd9[_0xe24c('0x37')],_0x3e0fd9['query']);_0x296be7[_0xe24c('0x36')]=_['intersection'](_0x3e0fd9[_0xe24c('0x37')],qs[_0xe24c('0x38')](_0x4fbb14[_0xe24c('0x34')]['fields']));_0x296be7['attributes']=_0x296be7[_0xe24c('0x36')][_0xe24c('0x39')]?_0x296be7[_0xe24c('0x36')]:_0x3e0fd9[_0xe24c('0x37')];if(_0x4fbb14[_0xe24c('0x34')][_0xe24c('0x47')]){_0x296be7[_0xe24c('0x48')]=[{'all':!![]}];}_0x296be7=_['merge']({},_0x296be7,_0x4fbb14[_0xe24c('0x49')]);return db[_0xe24c('0x31')]['find'](_0x296be7)['then'](handleEntityNotFound(_0x385748,null))[_0xe24c('0x29')](respondWithResult(_0x385748,null))[_0xe24c('0x44')](handleError(_0x385748,null));};exports['create']=function(_0x2f3aee,_0x38f455){return db[_0xe24c('0x31')][_0xe24c('0x4a')](_0x2f3aee[_0xe24c('0x4b')],{})[_0xe24c('0x29')](respondWithResult(_0x38f455,0xc9))[_0xe24c('0x44')](handleError(_0x38f455,null));};exports[_0xe24c('0x28')]=function(_0x4b0480,_0x214335){if(_0x4b0480[_0xe24c('0x4b')]['id']){delete _0x4b0480['body']['id'];}return db[_0xe24c('0x31')][_0xe24c('0x4c')]({'where':{'id':_0x4b0480[_0xe24c('0x46')]['id']}})[_0xe24c('0x29')](handleEntityNotFound(_0x214335,null))['then'](saveUpdates(_0x4b0480[_0xe24c('0x4b')],null))[_0xe24c('0x29')](respondWithResult(_0x214335,null))[_0xe24c('0x44')](handleError(_0x214335,null));};exports['destroy']=function(_0x440a43,_0x1b24e7){return db[_0xe24c('0x31')][_0xe24c('0x4c')]({'where':{'id':_0x440a43['params']['id']}})[_0xe24c('0x29')](handleEntityNotFound(_0x1b24e7,null))[_0xe24c('0x29')](removeEntity(_0x1b24e7,null))[_0xe24c('0x44')](handleError(_0x1b24e7,null));};exports[_0xe24c('0x4d')]=function(_0x19c561,_0x3d6903){return db[_0xe24c('0x31')][_0xe24c('0x4d')]()[_0xe24c('0x29')](respondWithResult(_0x3d6903,null))[_0xe24c('0x44')](handleError(_0x3d6903,null));}; \ No newline at end of file +var _0x4800=['end','json','offset','count','limit','status','set','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x45bffc,_0x8db6e4){var _0x3c3a9b=function(_0x3ed933){while(--_0x3ed933){_0x45bffc['push'](_0x45bffc['shift']());}};_0x3c3a9b(++_0x8db6e4);}(_0x4800,0x115));var _0x0480=function(_0x271dc9,_0x5c1711){_0x271dc9=_0x271dc9-0x0;var _0x4019de=_0x4800[_0x271dc9];return _0x4019de;};'use strict';var emlformat=require(_0x0480('0x0'));var rimraf=require(_0x0480('0x1'));var zipdir=require(_0x0480('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0480('0x3'));var moment=require(_0x0480('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0480('0x5'));var util=require(_0x0480('0x6'));var path=require(_0x0480('0x7'));var sox=require(_0x0480('0x8'));var csv=require(_0x0480('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0480('0xa'));var _=require(_0x0480('0xb'));var squel=require(_0x0480('0xc'));var crypto=require(_0x0480('0xd'));var jsforce=require(_0x0480('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0480('0x9'));var querystring=require('querystring');var Papa=require(_0x0480('0xf'));var Redis=require(_0x0480('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0480('0x11'));var as=require(_0x0480('0x12'));var hardwareService=require(_0x0480('0x13'));var logger=require(_0x0480('0x14'))(_0x0480('0x15'));var utils=require(_0x0480('0x16'));var config=require(_0x0480('0x17'));var licenseUtil=require(_0x0480('0x18'));var db=require(_0x0480('0x19'))['db'];function respondWithStatusCode(_0x1dfbc1,_0x1f3f17){_0x1f3f17=_0x1f3f17||0xcc;return function(_0x170877){if(_0x170877){return _0x1dfbc1[_0x0480('0x1a')](_0x1f3f17);}return _0x1dfbc1['status'](_0x1f3f17)[_0x0480('0x1b')]();};}function respondWithResult(_0x51148b,_0x2f39bc){_0x2f39bc=_0x2f39bc||0xc8;return function(_0x318a0d){if(_0x318a0d){return _0x51148b['status'](_0x2f39bc)[_0x0480('0x1c')](_0x318a0d);}};}function respondWithFilteredResult(_0x567532,_0x3c3ef9){return function(_0x13588c){if(_0x13588c){var _0x31b48a=typeof _0x3c3ef9[_0x0480('0x1d')]==='undefined'&&typeof _0x3c3ef9['limit']==='undefined';var _0x285483=_0x13588c['count'];var _0x227347=_0x31b48a?0x0:_0x3c3ef9[_0x0480('0x1d')];var _0x4f9d0d=_0x31b48a?_0x13588c[_0x0480('0x1e')]:_0x3c3ef9[_0x0480('0x1d')]+_0x3c3ef9[_0x0480('0x1f')];var _0x7032de;if(_0x4f9d0d>=_0x285483){_0x4f9d0d=_0x285483;_0x7032de=0xc8;}else{_0x7032de=0xce;}_0x567532[_0x0480('0x20')](_0x7032de);return _0x567532[_0x0480('0x21')]('Content-Range',_0x227347+'-'+_0x4f9d0d+'/'+_0x285483)[_0x0480('0x1c')](_0x13588c);}return null;};}function patchUpdates(_0x4db73b){return function(_0x446224){try{jsonpatch['apply'](_0x446224,_0x4db73b,!![]);}catch(_0x8f01ef){return BPromise['reject'](_0x8f01ef);}return _0x446224[_0x0480('0x22')]();};}function saveUpdates(_0x114652,_0x1269fd){return function(_0x1340d8){if(_0x1340d8){return _0x1340d8['update'](_0x114652)[_0x0480('0x23')](function(_0x3317ef){return _0x3317ef;});}return null;};}function removeEntity(_0x4dd386,_0x11545){return function(_0x546c05){if(_0x546c05){return _0x546c05[_0x0480('0x24')]()[_0x0480('0x23')](function(){_0x4dd386['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da943,_0x55017a){return function(_0x3ec80a){if(!_0x3ec80a){_0x4da943[_0x0480('0x1a')](0x194);}return _0x3ec80a;};}function handleError(_0x1a9e38,_0x4cb38f){_0x4cb38f=_0x4cb38f||0x1f4;return function(_0x944ad5){logger[_0x0480('0x25')](_0x944ad5[_0x0480('0x26')]);if(_0x944ad5[_0x0480('0x27')]){delete _0x944ad5[_0x0480('0x27')];}_0x1a9e38[_0x0480('0x20')](_0x4cb38f)[_0x0480('0x28')](_0x944ad5);};}exports[_0x0480('0x29')]=function(_0x196f66,_0x25bc43){var _0x1d19f3={},_0x2984a1={},_0x4cbb09={'count':0x0,'rows':[]};var _0x220f4b=_[_0x0480('0x2a')](db[_0x0480('0x2b')][_0x0480('0x2c')],function(_0x25ded7){return{'name':_0x25ded7[_0x0480('0x2d')],'type':_0x25ded7[_0x0480('0x2e')][_0x0480('0x2f')]};});_0x2984a1['model']=_[_0x0480('0x2a')](_0x220f4b,_0x0480('0x27'));_0x2984a1[_0x0480('0x30')]=_[_0x0480('0x31')](_0x196f66[_0x0480('0x30')]);_0x2984a1[_0x0480('0x32')]=_['intersection'](_0x2984a1[_0x0480('0x33')],_0x2984a1[_0x0480('0x30')]);_0x1d19f3[_0x0480('0x34')]=_[_0x0480('0x35')](_0x2984a1[_0x0480('0x33')],qs[_0x0480('0x36')](_0x196f66[_0x0480('0x30')]['fields']));_0x1d19f3['attributes']=_0x1d19f3[_0x0480('0x34')][_0x0480('0x37')]?_0x1d19f3[_0x0480('0x34')]:_0x2984a1[_0x0480('0x33')];if(!_0x196f66[_0x0480('0x30')][_0x0480('0x38')](_0x0480('0x39'))){_0x1d19f3[_0x0480('0x1f')]=qs['limit'](_0x196f66[_0x0480('0x30')][_0x0480('0x1f')]);_0x1d19f3[_0x0480('0x1d')]=qs[_0x0480('0x1d')](_0x196f66[_0x0480('0x30')][_0x0480('0x1d')]);}_0x1d19f3['order']=qs[_0x0480('0x3a')](_0x196f66[_0x0480('0x30')][_0x0480('0x3a')]);_0x1d19f3[_0x0480('0x3b')]=qs[_0x0480('0x32')](_[_0x0480('0x3c')](_0x196f66[_0x0480('0x30')],_0x2984a1['filters']),_0x220f4b);if(_0x196f66[_0x0480('0x30')][_0x0480('0x3d')]){_0x1d19f3[_0x0480('0x3b')]=_[_0x0480('0x3e')](_0x1d19f3['where'],{'$or':_[_0x0480('0x2a')](_0x220f4b,function(_0xe22b47){if(_0xe22b47['type']!=='VIRTUAL'){var _0x1b84ce={};_0x1b84ce[_0xe22b47['name']]={'$like':'%'+_0x196f66[_0x0480('0x30')]['filter']+'%'};return _0x1b84ce;}})});}_0x1d19f3=_[_0x0480('0x3e')]({},_0x1d19f3,_0x196f66[_0x0480('0x3f')]);var _0x364058={'where':_0x1d19f3[_0x0480('0x3b')]};return db[_0x0480('0x2b')][_0x0480('0x1e')](_0x364058)['then'](function(_0x2c611e){_0x4cbb09['count']=_0x2c611e;if(_0x196f66[_0x0480('0x30')][_0x0480('0x40')]){_0x1d19f3[_0x0480('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0x0480('0x42')](_0x1d19f3);})[_0x0480('0x23')](function(_0x3a6b2d){_0x4cbb09[_0x0480('0x43')]=_0x3a6b2d;return _0x4cbb09;})[_0x0480('0x23')](respondWithFilteredResult(_0x25bc43,_0x1d19f3))['catch'](handleError(_0x25bc43,null));};exports[_0x0480('0x44')]=function(_0x2011f4,_0x508981){var _0x451df0={'raw':![],'where':{'id':_0x2011f4[_0x0480('0x45')]['id']}},_0x4e9f3d={};_0x4e9f3d['model']=_['keys'](db['IntegrationReport'][_0x0480('0x2c')]);_0x4e9f3d[_0x0480('0x30')]=_['keys'](_0x2011f4[_0x0480('0x30')]);_0x4e9f3d[_0x0480('0x32')]=_['intersection'](_0x4e9f3d[_0x0480('0x33')],_0x4e9f3d[_0x0480('0x30')]);_0x451df0[_0x0480('0x34')]=_[_0x0480('0x35')](_0x4e9f3d['model'],qs[_0x0480('0x36')](_0x2011f4[_0x0480('0x30')]['fields']));_0x451df0[_0x0480('0x34')]=_0x451df0['attributes'][_0x0480('0x37')]?_0x451df0[_0x0480('0x34')]:_0x4e9f3d[_0x0480('0x33')];if(_0x2011f4[_0x0480('0x30')][_0x0480('0x40')]){_0x451df0[_0x0480('0x41')]=[{'all':!![]}];}_0x451df0=_[_0x0480('0x3e')]({},_0x451df0,_0x2011f4['options']);return db['IntegrationReport'][_0x0480('0x46')](_0x451df0)[_0x0480('0x23')](handleEntityNotFound(_0x508981,null))['then'](respondWithResult(_0x508981,null))[_0x0480('0x47')](handleError(_0x508981,null));};exports[_0x0480('0x48')]=function(_0x8317bd,_0x5eadd3){return db['IntegrationReport'][_0x0480('0x48')](_0x8317bd[_0x0480('0x49')],{})['then'](respondWithResult(_0x5eadd3,0xc9))[_0x0480('0x47')](handleError(_0x5eadd3,null));};exports[_0x0480('0x4a')]=function(_0x6e304c,_0x142d5a){if(_0x6e304c[_0x0480('0x49')]['id']){delete _0x6e304c[_0x0480('0x49')]['id'];}return db['IntegrationReport'][_0x0480('0x46')]({'where':{'id':_0x6e304c[_0x0480('0x45')]['id']}})[_0x0480('0x23')](handleEntityNotFound(_0x142d5a,null))[_0x0480('0x23')](saveUpdates(_0x6e304c['body'],null))[_0x0480('0x23')](respondWithResult(_0x142d5a,null))[_0x0480('0x47')](handleError(_0x142d5a,null));};exports[_0x0480('0x24')]=function(_0x58e785,_0xce052a){return db[_0x0480('0x2b')]['find']({'where':{'id':_0x58e785['params']['id']}})[_0x0480('0x23')](handleEntityNotFound(_0xce052a,null))[_0x0480('0x23')](removeEntity(_0xce052a,null))[_0x0480('0x47')](handleError(_0xce052a,null));};exports[_0x0480('0x4b')]=function(_0x1c2b4d,_0x25d1f1){return db[_0x0480('0x2b')][_0x0480('0x4b')]()['then'](respondWithResult(_0x25d1f1,null))[_0x0480('0x47')](handleError(_0x25d1f1,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0f1300b..84645af 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 _0xea46=['lodash','../../config/logger','api','bluebird','../../config/environment','./integrationReport.attributes','define','report_integration'];(function(_0x22dbd1,_0x47e0bb){var _0x50a4fd=function(_0x5cadf4){while(--_0x5cadf4){_0x22dbd1['push'](_0x22dbd1['shift']());}};_0x50a4fd(++_0x47e0bb);}(_0xea46,0x1e0));var _0x6ea4=function(_0x103318,_0x3f37ef){_0x103318=_0x103318-0x0;var _0x391be6=_0xea46[_0x103318];return _0x391be6;};'use strict';var _=require(_0x6ea4('0x0'));var util=require('util');var logger=require(_0x6ea4('0x1'))(_0x6ea4('0x2'));var moment=require('moment');var BPromise=require(_0x6ea4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ea4('0x4'));var attributes=require(_0x6ea4('0x5'));module['exports']=function(_0x3fa92c,_0x536b19){return _0x3fa92c[_0x6ea4('0x6')]('IntegrationReport',attributes,{'tableName':_0x6ea4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa8b=['../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xfe0e7,_0x30ee3c){var _0x48ba4c=function(_0x384ad4){while(--_0x384ad4){_0xfe0e7['push'](_0xfe0e7['shift']());}};_0x48ba4c(++_0x30ee3c);}(_0xaa8b,0x19b));var _0xbaa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa8b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbaa8('0x0'));var util=require(_0xbaa8('0x1'));var logger=require(_0xbaa8('0x2'))(_0xbaa8('0x3'));var moment=require(_0xbaa8('0x4'));var BPromise=require(_0xbaa8('0x5'));var rp=require(_0xbaa8('0x6'));var fs=require('fs');var path=require(_0xbaa8('0x7'));var rimraf=require(_0xbaa8('0x8'));var config=require(_0xbaa8('0x9'));var attributes=require(_0xbaa8('0xa'));module['exports']=function(_0x59b9df,_0x509656){return _0x59b9df[_0xbaa8('0xb')](_0xbaa8('0xc'),attributes,{'tableName':_0xbaa8('0xd'),'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 7e9b113..705bcd3 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2cee34,_0x7e21a9){var _0x5a369e=function(_0x5114d1){while(--_0x5114d1){_0x2cee34['push'](_0x2cee34['shift']());}};_0x5a369e(++_0x7e21a9);}(_0xadb5,0xad));var _0x5adb=function(_0x2a0c2a,_0x170f52){_0x2a0c2a=_0x2a0c2a-0x0;var _0x3b86f1=_0xadb5[_0x2a0c2a];return _0x3b86f1;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _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(_0xbe8efe,_0x196a0f){var _0x1a2d7e=function(_0x65f9c1){while(--_0x65f9c1){_0xbe8efe['push'](_0xbe8efe['shift']());}};_0x1a2d7e(++_0x196a0f);}(_0x1261,0x144));var _0x1126=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x1261[_0x4e93a9];return _0x43013c;};'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 c4d5952..edd944c 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 _0xb957=['/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','delete','destroy','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id'];(function(_0x59d6d8,_0x4e81ae){var _0x45e804=function(_0x74869c){while(--_0x74869c){_0x59d6d8['push'](_0x59d6d8['shift']());}};_0x45e804(++_0x4e81ae);}(_0xb957,0x6d));var _0x7b95=function(_0x4249f9,_0x225237){_0x4249f9=_0x4249f9-0x0;var _0x41857e=_0xb957[_0x4249f9];return _0x41857e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b95('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b95('0x1'));var router=express[_0x7b95('0x2')]();var fs_extra=require(_0x7b95('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b95('0x4'));var config=require(_0x7b95('0x5'));var controller=require(_0x7b95('0x6'));router[_0x7b95('0x7')]('/',auth[_0x7b95('0x8')](),controller['index']);router[_0x7b95('0x7')](_0x7b95('0x9'),auth[_0x7b95('0x8')](),controller['show']);router['get'](_0x7b95('0xa'),auth[_0x7b95('0x8')](),controller[_0x7b95('0xb')]);router[_0x7b95('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7b95('0xa'),auth[_0x7b95('0x8')](),controller['addInterval']);router['post'](_0x7b95('0xd'),auth[_0x7b95('0x8')](),controller[_0x7b95('0xe')]);router['put']('/:id',auth[_0x7b95('0x8')](),controller['update']);router[_0x7b95('0xf')](_0x7b95('0x9'),auth[_0x7b95('0x8')](),controller[_0x7b95('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfa12=['addInterval','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','post','create'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x2b0aef,_0x1fe494){_0x2b0aef=_0x2b0aef-0x0;var _0x3d01fd=_0xfa12[_0x2b0aef];return _0x3d01fd;};'use strict';var multer=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var path=require(_0x2fa1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2fa1('0x3')]();var fs_extra=require(_0x2fa1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2fa1('0x5'));var controller=require(_0x2fa1('0x6'));router[_0x2fa1('0x7')]('/',auth['isAuthenticated'](),controller[_0x2fa1('0x8')]);router['get'](_0x2fa1('0x9'),auth[_0x2fa1('0xa')](),controller[_0x2fa1('0xb')]);router[_0x2fa1('0x7')](_0x2fa1('0xc'),auth[_0x2fa1('0xa')](),controller['getIntervals']);router[_0x2fa1('0xd')]('/',auth[_0x2fa1('0xa')](),controller[_0x2fa1('0xe')]);router[_0x2fa1('0xd')](_0x2fa1('0xc'),auth[_0x2fa1('0xa')](),controller[_0x2fa1('0xf')]);router[_0x2fa1('0xd')]('/:id/sub_intervals/create_many',auth[_0x2fa1('0xa')](),controller['addIntervals']);router[_0x2fa1('0x10')]('/:id',auth[_0x2fa1('0xa')](),controller[_0x2fa1('0x11')]);router[_0x2fa1('0x12')](_0x2fa1('0x9'),auth[_0x2fa1('0xa')](),controller[_0x2fa1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 79e6f69..25b8819 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 _0x54df=['exports','STRING','sequelize'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0x54df,0x146));var _0xf54d=function(_0x24aa15,_0x981d6a){_0x24aa15=_0x24aa15-0x0;var _0x52bf6b=_0x54df[_0x24aa15];return _0x52bf6b;};'use strict';var Sequelize=require(_0xf54d('0x0'));module[_0xf54d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf54d('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf3cc=['STRING','sequelize','exports'];(function(_0x44ae2b,_0x6e30bb){var _0x512b65=function(_0x59c37c){while(--_0x59c37c){_0x44ae2b['push'](_0x44ae2b['shift']());}};_0x512b65(++_0x6e30bb);}(_0xf3cc,0x70));var _0xcf3c=function(_0x13ebfc,_0x4313a6){_0x13ebfc=_0x13ebfc-0x0;var _0x3f069e=_0xf3cc[_0x13ebfc];return _0x3f069e;};'use strict';var Sequelize=require(_0xcf3c('0x0'));module[_0xcf3c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcf3c('0x2')]},'interval':{'type':Sequelize[_0xcf3c('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 74402dc..76dba86 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 _0x3f00=['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/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','name','map','Interval','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','IntervalId','getIntervals','findOne','order','nolimit','sequelize','transaction','bulkCreate','eml-format','rimraf','moment','bluebird','mustache','util','path','sox'];(function(_0x7c1a51,_0x24d8ee){var _0x4b7a77=function(_0x2c624b){while(--_0x2c624b){_0x7c1a51['push'](_0x7c1a51['shift']());}};_0x4b7a77(++_0x24d8ee);}(_0x3f00,0x100));var _0x03f0=function(_0x5a001d,_0x591f45){_0x5a001d=_0x5a001d-0x0;var _0x3d0a81=_0x3f00[_0x5a001d];return _0x3d0a81;};'use strict';var emlformat=require(_0x03f0('0x0'));var rimraf=require(_0x03f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x03f0('0x2'));var BPromise=require(_0x03f0('0x3'));var Mustache=require(_0x03f0('0x4'));var util=require(_0x03f0('0x5'));var path=require(_0x03f0('0x6'));var sox=require(_0x03f0('0x7'));var csv=require(_0x03f0('0x8'));var ejs=require(_0x03f0('0x9'));var fs=require('fs');var fs_extra=require(_0x03f0('0xa'));var _=require('lodash');var squel=require(_0x03f0('0xb'));var crypto=require(_0x03f0('0xc'));var jsforce=require(_0x03f0('0xd'));var deskjs=require(_0x03f0('0xe'));var toCsv=require(_0x03f0('0x8'));var querystring=require(_0x03f0('0xf'));var Papa=require(_0x03f0('0x10'));var Redis=require(_0x03f0('0x11'));var authService=require(_0x03f0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x03f0('0x13'));var hardwareService=require(_0x03f0('0x14'));var logger=require(_0x03f0('0x15'))(_0x03f0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03f0('0x17'));var db=require(_0x03f0('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3ac587,_0x32d255){_0x32d255=_0x32d255||0xcc;return function(_0x2b33b3){if(_0x2b33b3){return _0x3ac587[_0x03f0('0x19')](_0x32d255);}return _0x3ac587['status'](_0x32d255)[_0x03f0('0x1a')]();};}function respondWithResult(_0x2eab2c,_0x356210){_0x356210=_0x356210||0xc8;return function(_0x538c6c){if(_0x538c6c){return _0x2eab2c[_0x03f0('0x1b')](_0x356210)[_0x03f0('0x1c')](_0x538c6c);}};}function respondWithFilteredResult(_0x53539b,_0x45a16c){return function(_0x52c968){if(_0x52c968){var _0xeec998=typeof _0x45a16c['offset']===_0x03f0('0x1d')&&typeof _0x45a16c[_0x03f0('0x1e')]==='undefined';var _0x358e29=_0x52c968[_0x03f0('0x1f')];var _0x8fa85b=_0xeec998?0x0:_0x45a16c[_0x03f0('0x20')];var _0x107c15=_0xeec998?_0x52c968[_0x03f0('0x1f')]:_0x45a16c['offset']+_0x45a16c[_0x03f0('0x1e')];var _0x1dd0b5;if(_0x107c15>=_0x358e29){_0x107c15=_0x358e29;_0x1dd0b5=0xc8;}else{_0x1dd0b5=0xce;}_0x53539b[_0x03f0('0x1b')](_0x1dd0b5);return _0x53539b['set'](_0x03f0('0x21'),_0x8fa85b+'-'+_0x107c15+'/'+_0x358e29)['json'](_0x52c968);}return null;};}function patchUpdates(_0x4e46a7){return function(_0x3476c9){try{jsonpatch[_0x03f0('0x22')](_0x3476c9,_0x4e46a7,!![]);}catch(_0x1c7e4d){return BPromise[_0x03f0('0x23')](_0x1c7e4d);}return _0x3476c9[_0x03f0('0x24')]();};}function saveUpdates(_0x4b3217,_0x286f56){return function(_0x91b037){if(_0x91b037){return _0x91b037[_0x03f0('0x25')](_0x4b3217)['then'](function(_0x1b941f){return _0x1b941f;});}return null;};}function removeEntity(_0x59afb3,_0x3b8722){return function(_0x33323b){if(_0x33323b){return _0x33323b[_0x03f0('0x26')]()[_0x03f0('0x27')](function(){var _0x33c4ad=_0x33323b[_0x03f0('0x28')]({'plain':!![]});var _0x185c3b=_0x03f0('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x185c3b,'resourceId':_0x33c4ad['id']}})[_0x03f0('0x27')](function(){return _0x33323b;});})[_0x03f0('0x27')](function(){_0x59afb3['status'](0xcc)[_0x03f0('0x1a')]();});}};}function handleEntityNotFound(_0x53945b,_0x400014){return function(_0x54d1dc){if(!_0x54d1dc){_0x53945b[_0x03f0('0x19')](0x194);}return _0x54d1dc;};}function handleError(_0x2681d2,_0x8500c3){_0x8500c3=_0x8500c3||0x1f4;return function(_0x159c8f){logger['error'](_0x159c8f['stack']);if(_0x159c8f[_0x03f0('0x2a')]){delete _0x159c8f[_0x03f0('0x2a')];}_0x2681d2[_0x03f0('0x1b')](_0x8500c3)['send'](_0x159c8f);};}exports['index']=function(_0x19631d,_0x5f3f99){var _0x8219a8={},_0x584585={},_0x1f9a73={'count':0x0,'rows':[]};var _0x45b821=_[_0x03f0('0x2b')](db[_0x03f0('0x2c')]['rawAttributes'],function(_0x504a04){return{'name':_0x504a04[_0x03f0('0x2d')],'type':_0x504a04[_0x03f0('0x2e')][_0x03f0('0x2f')]};});_0x584585[_0x03f0('0x30')]=_[_0x03f0('0x2b')](_0x45b821,'name');_0x584585['query']=_[_0x03f0('0x31')](_0x19631d[_0x03f0('0x32')]);_0x584585[_0x03f0('0x33')]=_[_0x03f0('0x34')](_0x584585['model'],_0x584585[_0x03f0('0x32')]);_0x8219a8[_0x03f0('0x35')]=_[_0x03f0('0x34')](_0x584585[_0x03f0('0x30')],qs[_0x03f0('0x36')](_0x19631d[_0x03f0('0x32')][_0x03f0('0x36')]));_0x8219a8[_0x03f0('0x35')]=_0x8219a8[_0x03f0('0x35')][_0x03f0('0x37')]?_0x8219a8['attributes']:_0x584585['model'];if(!_0x19631d['query'][_0x03f0('0x38')]('nolimit')){_0x8219a8[_0x03f0('0x1e')]=qs[_0x03f0('0x1e')](_0x19631d['query'][_0x03f0('0x1e')]);_0x8219a8['offset']=qs[_0x03f0('0x20')](_0x19631d[_0x03f0('0x32')][_0x03f0('0x20')]);}_0x8219a8['order']=qs[_0x03f0('0x39')](_0x19631d[_0x03f0('0x32')][_0x03f0('0x39')]);_0x8219a8[_0x03f0('0x3a')]=qs['filters'](_[_0x03f0('0x3b')](_0x19631d[_0x03f0('0x32')],_0x584585[_0x03f0('0x33')]),_0x45b821);if(_0x19631d[_0x03f0('0x32')][_0x03f0('0x3c')]){_0x8219a8['where']=_[_0x03f0('0x3d')](_0x8219a8[_0x03f0('0x3a')],{'$or':_[_0x03f0('0x2b')](_0x45b821,function(_0x3dd31d){if(_0x3dd31d['type']!==_0x03f0('0x3e')){var _0x483124={};_0x483124[_0x3dd31d[_0x03f0('0x2a')]]={'$like':'%'+_0x19631d[_0x03f0('0x32')][_0x03f0('0x3c')]+'%'};return _0x483124;}})});}_0x8219a8=_[_0x03f0('0x3d')]({},_0x8219a8,_0x19631d[_0x03f0('0x3f')]);var _0x544049={'where':_0x8219a8[_0x03f0('0x3a')]};return db['Interval']['count'](_0x544049)['then'](function(_0x261ca0){_0x1f9a73[_0x03f0('0x1f')]=_0x261ca0;if(_0x19631d[_0x03f0('0x32')]['includeAll']){_0x8219a8['include']=[{'all':!![]}];}return db[_0x03f0('0x2c')][_0x03f0('0x40')](_0x8219a8);})[_0x03f0('0x27')](function(_0x49616d){_0x1f9a73[_0x03f0('0x41')]=_0x49616d;return _0x1f9a73;})[_0x03f0('0x27')](respondWithFilteredResult(_0x5f3f99,_0x8219a8))['catch'](handleError(_0x5f3f99,null));};exports[_0x03f0('0x42')]=function(_0x51c5a4,_0x1e4a46){var _0x3cdc3a={'raw':!![],'where':{'id':_0x51c5a4[_0x03f0('0x43')]['id']}},_0x53c563={};_0x53c563[_0x03f0('0x30')]=_['keys'](db[_0x03f0('0x2c')][_0x03f0('0x44')]);_0x53c563[_0x03f0('0x32')]=_[_0x03f0('0x31')](_0x51c5a4[_0x03f0('0x32')]);_0x53c563['filters']=_[_0x03f0('0x34')](_0x53c563[_0x03f0('0x30')],_0x53c563[_0x03f0('0x32')]);_0x3cdc3a['attributes']=_[_0x03f0('0x34')](_0x53c563[_0x03f0('0x30')],qs[_0x03f0('0x36')](_0x51c5a4['query'][_0x03f0('0x36')]));_0x3cdc3a[_0x03f0('0x35')]=_0x3cdc3a[_0x03f0('0x35')][_0x03f0('0x37')]?_0x3cdc3a['attributes']:_0x53c563[_0x03f0('0x30')];if(_0x51c5a4[_0x03f0('0x32')][_0x03f0('0x45')]){_0x3cdc3a[_0x03f0('0x46')]=[{'all':!![]}];}_0x3cdc3a=_[_0x03f0('0x3d')]({},_0x3cdc3a,_0x51c5a4[_0x03f0('0x3f')]);return db[_0x03f0('0x2c')][_0x03f0('0x47')](_0x3cdc3a)[_0x03f0('0x27')](handleEntityNotFound(_0x1e4a46,null))['then'](respondWithResult(_0x1e4a46,null))[_0x03f0('0x48')](handleError(_0x1e4a46,null));};exports[_0x03f0('0x49')]=function(_0xee8dcb,_0x508e82){return db[_0x03f0('0x2c')][_0x03f0('0x49')](_0xee8dcb[_0x03f0('0x4a')],{})['then'](function(_0x289527){var _0x3e9861=_0xee8dcb[_0x03f0('0x4b')][_0x03f0('0x28')]({'plain':!![]});if(!_0x3e9861)throw new Error(_0x03f0('0x4c'));if(_0x3e9861['role']===_0x03f0('0x4b')){var _0x3936e0=_0x289527[_0x03f0('0x28')]({'plain':!![]});var _0x52c0eb=_0x03f0('0x29');return db[_0x03f0('0x4d')][_0x03f0('0x47')]({'where':{'name':_0x52c0eb,'userProfileId':_0x3e9861[_0x03f0('0x4e')]},'raw':!![]})[_0x03f0('0x27')](function(_0x5668f5){if(_0x5668f5&&_0x5668f5[_0x03f0('0x4f')]===0x0){return db['UserProfileResource'][_0x03f0('0x49')]({'name':_0x3936e0[_0x03f0('0x2a')],'resourceId':_0x3936e0['id'],'type':_0x5668f5[_0x03f0('0x2a')],'sectionId':_0x5668f5['id']},{})[_0x03f0('0x27')](function(){return _0x289527;});}else{return _0x289527;}})['catch'](function(_0xee5b54){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xee5b54);throw _0xee5b54;});}return _0x289527;})[_0x03f0('0x27')](respondWithResult(_0x508e82,0xc9))['catch'](handleError(_0x508e82,null));};exports['update']=function(_0x1388ef,_0x101a5e){if(_0x1388ef[_0x03f0('0x4a')]['id']){delete _0x1388ef[_0x03f0('0x4a')]['id'];}return db[_0x03f0('0x2c')][_0x03f0('0x47')]({'where':{'id':_0x1388ef[_0x03f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x101a5e,null))[_0x03f0('0x27')](saveUpdates(_0x1388ef['body'],null))['then'](respondWithResult(_0x101a5e,null))[_0x03f0('0x48')](handleError(_0x101a5e,null));};exports[_0x03f0('0x26')]=function(_0x2870d2,_0x4e4c3e){return db[_0x03f0('0x2c')][_0x03f0('0x47')]({'where':{'id':_0x2870d2[_0x03f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e4c3e,null))[_0x03f0('0x27')](removeEntity(_0x4e4c3e,null))[_0x03f0('0x48')](handleError(_0x4e4c3e,null));};exports['addInterval']=function(_0x2ca520,_0x1691cf,_0x473306){if(_0x2ca520['body']['id']){delete _0x2ca520[_0x03f0('0x4a')]['id'];}return db[_0x03f0('0x2c')][_0x03f0('0x47')]({'where':{'id':_0x2ca520[_0x03f0('0x43')]['id']}})[_0x03f0('0x27')](handleEntityNotFound(_0x1691cf,null))['then'](function(_0x22bb5a){if(_0x22bb5a){_0x2ca520['body'][_0x03f0('0x50')]=_0x22bb5a['id'];return db[_0x03f0('0x2c')][_0x03f0('0x49')](_0x2ca520['body']);}})[_0x03f0('0x27')](respondWithResult(_0x1691cf,null))['catch'](handleError(_0x1691cf,null));};exports[_0x03f0('0x51')]=function(_0x27d95c,_0x54f1f2,_0x1b339e){var _0x4a90a4={};var _0x4b5f08={};var _0x32ee29;var _0x156446;return db['Interval'][_0x03f0('0x52')]({'where':{'id':_0x27d95c[_0x03f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x54f1f2,null))[_0x03f0('0x27')](function(_0x24a09a){if(_0x24a09a){_0x32ee29=_0x24a09a;_0x4b5f08['model']=_[_0x03f0('0x31')](db[_0x03f0('0x2c')][_0x03f0('0x44')]);_0x4b5f08[_0x03f0('0x32')]=_[_0x03f0('0x31')](_0x27d95c[_0x03f0('0x32')]);_0x4b5f08['filters']=_[_0x03f0('0x34')](_0x4b5f08[_0x03f0('0x30')],_0x4b5f08[_0x03f0('0x32')]);_0x4a90a4[_0x03f0('0x35')]=_['intersection'](_0x4b5f08[_0x03f0('0x30')],qs[_0x03f0('0x36')](_0x27d95c['query'][_0x03f0('0x36')]));_0x4a90a4[_0x03f0('0x35')]=_0x4a90a4['attributes']['length']?_0x4a90a4[_0x03f0('0x35')]:_0x4b5f08[_0x03f0('0x30')];_0x4a90a4[_0x03f0('0x53')]=qs[_0x03f0('0x39')](_0x27d95c[_0x03f0('0x32')][_0x03f0('0x39')]);_0x4a90a4[_0x03f0('0x3a')]=qs[_0x03f0('0x33')](_[_0x03f0('0x3b')](_0x27d95c[_0x03f0('0x32')],_0x4b5f08['filters']));if(_0x27d95c[_0x03f0('0x32')][_0x03f0('0x3c')]){_0x4a90a4['where']=_[_0x03f0('0x3d')](_0x4a90a4[_0x03f0('0x3a')],{'$or':_[_0x03f0('0x2b')](_0x4a90a4[_0x03f0('0x35')],function(_0x1b503d){var _0x3ea95a={};_0x3ea95a[_0x1b503d]={'$like':'%'+_0x27d95c[_0x03f0('0x32')][_0x03f0('0x3c')]+'%'};return _0x3ea95a;})});}_0x4a90a4=_[_0x03f0('0x3d')]({},_0x4a90a4,_0x27d95c[_0x03f0('0x3f')]);return _0x32ee29[_0x03f0('0x51')](_0x4a90a4);}})['then'](function(_0x2c899a){if(_0x2c899a){_0x156446=_0x2c899a[_0x03f0('0x37')];if(!_0x27d95c[_0x03f0('0x32')][_0x03f0('0x38')](_0x03f0('0x54'))){_0x4a90a4[_0x03f0('0x1e')]=qs[_0x03f0('0x1e')](_0x27d95c[_0x03f0('0x32')][_0x03f0('0x1e')]);_0x4a90a4[_0x03f0('0x20')]=qs['offset'](_0x27d95c['query'][_0x03f0('0x20')]);}return _0x32ee29[_0x03f0('0x51')](_0x4a90a4);}})[_0x03f0('0x27')](function(_0x15cf36){if(_0x15cf36){return _0x15cf36?{'count':_0x156446,'rows':_0x15cf36}:null;}})[_0x03f0('0x27')](respondWithResult(_0x54f1f2,null))[_0x03f0('0x48')](handleError(_0x54f1f2,null));};exports['addIntervals']=function(_0x3222cc,_0x2596fa,_0x1d1c49){return db[_0x03f0('0x2c')][_0x03f0('0x52')]({'where':{'id':_0x3222cc[_0x03f0('0x43')]['id']}})[_0x03f0('0x27')](handleEntityNotFound(_0x2596fa,null))[_0x03f0('0x27')](function(_0x40206a){if(_0x40206a){return db[_0x03f0('0x55')][_0x03f0('0x56')](function(_0x250d26){return db[_0x03f0('0x2c')][_0x03f0('0x26')]({'where':{'IntervalId':_0x3222cc[_0x03f0('0x43')]['id']},'transaction':_0x250d26})[_0x03f0('0x27')](function(_0x2a94d9){var _0x495d0f=_[_0x03f0('0x2b')](_0x3222cc[_0x03f0('0x4a')],function(_0x4c1973){delete _0x4c1973['id'];_0x4c1973['IntervalId']=_0x3222cc[_0x03f0('0x43')]['id'];return _0x4c1973;});return db['Interval'][_0x03f0('0x57')](_0x495d0f,{'transaction':_0x250d26});});})['then'](function(){return db[_0x03f0('0x2c')][_0x03f0('0x40')]({'where':{'IntervalId':_0x3222cc[_0x03f0('0x43')]['id']}});});}})[_0x03f0('0x27')](respondWithResult(_0x2596fa,null))[_0x03f0('0x48')](handleError(_0x2596fa,null));}; \ No newline at end of file +var _0xa529=['bulkCreate','findAll','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','limit','offset','count','set','json','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','IntervalId','getIntervals','findOne','addIntervals','sequelize'];(function(_0x56762b,_0x5e2ddd){var _0x179344=function(_0x171dff){while(--_0x171dff){_0x56762b['push'](_0x56762b['shift']());}};_0x179344(++_0x5e2ddd);}(_0xa529,0x16e));var _0x9a52=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa529[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a52('0x0'));var zipdir=require(_0x9a52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a52('0x2'));var moment=require('moment');var BPromise=require(_0x9a52('0x3'));var Mustache=require(_0x9a52('0x4'));var util=require(_0x9a52('0x5'));var path=require(_0x9a52('0x6'));var sox=require('sox');var csv=require(_0x9a52('0x7'));var ejs=require(_0x9a52('0x8'));var fs=require('fs');var fs_extra=require(_0x9a52('0x9'));var _=require(_0x9a52('0xa'));var squel=require(_0x9a52('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a52('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9a52('0xd'));var Redis=require(_0x9a52('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9a52('0xf'));var as=require(_0x9a52('0x10'));var hardwareService=require(_0x9a52('0x11'));var logger=require(_0x9a52('0x12'))(_0x9a52('0x13'));var utils=require(_0x9a52('0x14'));var config=require(_0x9a52('0x15'));var licenseUtil=require(_0x9a52('0x16'));var db=require(_0x9a52('0x17'))['db'];var extensions=require(_0x9a52('0x18'));function respondWithStatusCode(_0x44f59d,_0x3859b2){_0x3859b2=_0x3859b2||0xcc;return function(_0x5a0b83){if(_0x5a0b83){return _0x44f59d['sendStatus'](_0x3859b2);}return _0x44f59d[_0x9a52('0x19')](_0x3859b2)[_0x9a52('0x1a')]();};}function respondWithResult(_0x532dcf,_0x6f47a0){_0x6f47a0=_0x6f47a0||0xc8;return function(_0x4b48b1){if(_0x4b48b1){return _0x532dcf[_0x9a52('0x19')](_0x6f47a0)['json'](_0x4b48b1);}};}function respondWithFilteredResult(_0x54cd28,_0x498fd9){return function(_0x2adb6a){if(_0x2adb6a){var _0x4b9557=typeof _0x498fd9['offset']==='undefined'&&typeof _0x498fd9[_0x9a52('0x1b')]==='undefined';var _0x3a16c8=_0x2adb6a['count'];var _0x10a5c2=_0x4b9557?0x0:_0x498fd9[_0x9a52('0x1c')];var _0xf210b3=_0x4b9557?_0x2adb6a[_0x9a52('0x1d')]:_0x498fd9[_0x9a52('0x1c')]+_0x498fd9[_0x9a52('0x1b')];var _0x280f59;if(_0xf210b3>=_0x3a16c8){_0xf210b3=_0x3a16c8;_0x280f59=0xc8;}else{_0x280f59=0xce;}_0x54cd28[_0x9a52('0x19')](_0x280f59);return _0x54cd28[_0x9a52('0x1e')]('Content-Range',_0x10a5c2+'-'+_0xf210b3+'/'+_0x3a16c8)[_0x9a52('0x1f')](_0x2adb6a);}return null;};}function patchUpdates(_0x4b0307){return function(_0x2d78c4){try{jsonpatch[_0x9a52('0x20')](_0x2d78c4,_0x4b0307,!![]);}catch(_0x21209f){return BPromise[_0x9a52('0x21')](_0x21209f);}return _0x2d78c4[_0x9a52('0x22')]();};}function saveUpdates(_0xd18a1a,_0x12790f){return function(_0x45a8ba){if(_0x45a8ba){return _0x45a8ba['update'](_0xd18a1a)[_0x9a52('0x23')](function(_0x20262f){return _0x20262f;});}return null;};}function removeEntity(_0x45d27f,_0x40a51b){return function(_0x5a98fd){if(_0x5a98fd){return _0x5a98fd[_0x9a52('0x24')]()[_0x9a52('0x23')](function(){var _0x3d7e48=_0x5a98fd[_0x9a52('0x25')]({'plain':!![]});var _0x14a737='Intervals';return db[_0x9a52('0x26')]['destroy']({'where':{'type':_0x14a737,'resourceId':_0x3d7e48['id']}})[_0x9a52('0x23')](function(){return _0x5a98fd;});})[_0x9a52('0x23')](function(){_0x45d27f[_0x9a52('0x19')](0xcc)[_0x9a52('0x1a')]();});}};}function handleEntityNotFound(_0x2c9a0a,_0x1e3a37){return function(_0x1c6d43){if(!_0x1c6d43){_0x2c9a0a[_0x9a52('0x27')](0x194);}return _0x1c6d43;};}function handleError(_0x3f3abc,_0x11bbcb){_0x11bbcb=_0x11bbcb||0x1f4;return function(_0x1115e5){logger['error'](_0x1115e5[_0x9a52('0x28')]);if(_0x1115e5[_0x9a52('0x29')]){delete _0x1115e5[_0x9a52('0x29')];}_0x3f3abc[_0x9a52('0x19')](_0x11bbcb)[_0x9a52('0x2a')](_0x1115e5);};}exports[_0x9a52('0x2b')]=function(_0x24564f,_0x5bf319){var _0x186057={},_0x370a3b={},_0x41ff24={'count':0x0,'rows':[]};var _0x1d4607=_[_0x9a52('0x2c')](db[_0x9a52('0x2d')][_0x9a52('0x2e')],function(_0x476cc7){return{'name':_0x476cc7[_0x9a52('0x2f')],'type':_0x476cc7[_0x9a52('0x30')][_0x9a52('0x31')]};});_0x370a3b['model']=_[_0x9a52('0x2c')](_0x1d4607,_0x9a52('0x29'));_0x370a3b[_0x9a52('0x32')]=_[_0x9a52('0x33')](_0x24564f[_0x9a52('0x32')]);_0x370a3b[_0x9a52('0x34')]=_[_0x9a52('0x35')](_0x370a3b['model'],_0x370a3b[_0x9a52('0x32')]);_0x186057['attributes']=_['intersection'](_0x370a3b['model'],qs[_0x9a52('0x36')](_0x24564f[_0x9a52('0x32')][_0x9a52('0x36')]));_0x186057[_0x9a52('0x37')]=_0x186057[_0x9a52('0x37')]['length']?_0x186057[_0x9a52('0x37')]:_0x370a3b[_0x9a52('0x38')];if(!_0x24564f[_0x9a52('0x32')][_0x9a52('0x39')](_0x9a52('0x3a'))){_0x186057[_0x9a52('0x1b')]=qs[_0x9a52('0x1b')](_0x24564f[_0x9a52('0x32')]['limit']);_0x186057[_0x9a52('0x1c')]=qs[_0x9a52('0x1c')](_0x24564f[_0x9a52('0x32')]['offset']);}_0x186057[_0x9a52('0x3b')]=qs[_0x9a52('0x3c')](_0x24564f[_0x9a52('0x32')]['sort']);_0x186057[_0x9a52('0x3d')]=qs[_0x9a52('0x34')](_[_0x9a52('0x3e')](_0x24564f[_0x9a52('0x32')],_0x370a3b[_0x9a52('0x34')]),_0x1d4607);if(_0x24564f['query'][_0x9a52('0x3f')]){_0x186057[_0x9a52('0x3d')]=_[_0x9a52('0x40')](_0x186057['where'],{'$or':_[_0x9a52('0x2c')](_0x1d4607,function(_0xd8ec){if(_0xd8ec[_0x9a52('0x30')]!==_0x9a52('0x41')){var _0x384b47={};_0x384b47[_0xd8ec[_0x9a52('0x29')]]={'$like':'%'+_0x24564f[_0x9a52('0x32')][_0x9a52('0x3f')]+'%'};return _0x384b47;}})});}_0x186057=_['merge']({},_0x186057,_0x24564f[_0x9a52('0x42')]);var _0x5b8e14={'where':_0x186057[_0x9a52('0x3d')]};return db[_0x9a52('0x2d')][_0x9a52('0x1d')](_0x5b8e14)['then'](function(_0x419a3a){_0x41ff24['count']=_0x419a3a;if(_0x24564f['query']['includeAll']){_0x186057[_0x9a52('0x43')]=[{'all':!![]}];}return db[_0x9a52('0x2d')]['findAll'](_0x186057);})['then'](function(_0x1a93b5){_0x41ff24[_0x9a52('0x44')]=_0x1a93b5;return _0x41ff24;})['then'](respondWithFilteredResult(_0x5bf319,_0x186057))['catch'](handleError(_0x5bf319,null));};exports['show']=function(_0x131d08,_0x4b7bb8){var _0x5e8416={'raw':!![],'where':{'id':_0x131d08[_0x9a52('0x45')]['id']}},_0x22cbc7={};_0x22cbc7[_0x9a52('0x38')]=_[_0x9a52('0x33')](db[_0x9a52('0x2d')][_0x9a52('0x2e')]);_0x22cbc7[_0x9a52('0x32')]=_[_0x9a52('0x33')](_0x131d08['query']);_0x22cbc7[_0x9a52('0x34')]=_[_0x9a52('0x35')](_0x22cbc7['model'],_0x22cbc7[_0x9a52('0x32')]);_0x5e8416['attributes']=_['intersection'](_0x22cbc7[_0x9a52('0x38')],qs[_0x9a52('0x36')](_0x131d08[_0x9a52('0x32')][_0x9a52('0x36')]));_0x5e8416[_0x9a52('0x37')]=_0x5e8416[_0x9a52('0x37')][_0x9a52('0x46')]?_0x5e8416['attributes']:_0x22cbc7['model'];if(_0x131d08['query'][_0x9a52('0x47')]){_0x5e8416[_0x9a52('0x43')]=[{'all':!![]}];}_0x5e8416=_[_0x9a52('0x40')]({},_0x5e8416,_0x131d08[_0x9a52('0x42')]);return db['Interval'][_0x9a52('0x48')](_0x5e8416)['then'](handleEntityNotFound(_0x4b7bb8,null))[_0x9a52('0x23')](respondWithResult(_0x4b7bb8,null))['catch'](handleError(_0x4b7bb8,null));};exports[_0x9a52('0x49')]=function(_0x4189e8,_0xfc7052){return db['Interval'][_0x9a52('0x49')](_0x4189e8[_0x9a52('0x4a')],{})[_0x9a52('0x23')](function(_0xc3160e){var _0x39329e=_0x4189e8[_0x9a52('0x4b')][_0x9a52('0x25')]({'plain':!![]});if(!_0x39329e)throw new Error(_0x9a52('0x4c'));if(_0x39329e['role']===_0x9a52('0x4b')){var _0x5ca0a9=_0xc3160e[_0x9a52('0x25')]({'plain':!![]});var _0x46a45c='Intervals';return db[_0x9a52('0x4d')][_0x9a52('0x48')]({'where':{'name':_0x46a45c,'userProfileId':_0x39329e[_0x9a52('0x4e')]},'raw':!![]})[_0x9a52('0x23')](function(_0x5b01f8){if(_0x5b01f8&&_0x5b01f8[_0x9a52('0x4f')]===0x0){return db[_0x9a52('0x26')]['create']({'name':_0x5ca0a9['name'],'resourceId':_0x5ca0a9['id'],'type':_0x5b01f8[_0x9a52('0x29')],'sectionId':_0x5b01f8['id']},{})['then'](function(){return _0xc3160e;});}else{return _0xc3160e;}})['catch'](function(_0x30c0ce){logger[_0x9a52('0x50')](_0x9a52('0x51'),_0x30c0ce);throw _0x30c0ce;});}return _0xc3160e;})[_0x9a52('0x23')](respondWithResult(_0xfc7052,0xc9))[_0x9a52('0x52')](handleError(_0xfc7052,null));};exports[_0x9a52('0x53')]=function(_0x2733ed,_0x40ea8c){if(_0x2733ed[_0x9a52('0x4a')]['id']){delete _0x2733ed[_0x9a52('0x4a')]['id'];}return db['Interval'][_0x9a52('0x48')]({'where':{'id':_0x2733ed[_0x9a52('0x45')]['id']}})['then'](handleEntityNotFound(_0x40ea8c,null))['then'](saveUpdates(_0x2733ed[_0x9a52('0x4a')],null))['then'](respondWithResult(_0x40ea8c,null))['catch'](handleError(_0x40ea8c,null));};exports[_0x9a52('0x24')]=function(_0x4661b2,_0x341672){return db[_0x9a52('0x2d')][_0x9a52('0x48')]({'where':{'id':_0x4661b2['params']['id']}})[_0x9a52('0x23')](handleEntityNotFound(_0x341672,null))['then'](removeEntity(_0x341672,null))[_0x9a52('0x52')](handleError(_0x341672,null));};exports['addInterval']=function(_0x2b65e5,_0x1b06ae,_0xc0c3d9){if(_0x2b65e5[_0x9a52('0x4a')]['id']){delete _0x2b65e5[_0x9a52('0x4a')]['id'];}return db[_0x9a52('0x2d')][_0x9a52('0x48')]({'where':{'id':_0x2b65e5['params']['id']}})['then'](handleEntityNotFound(_0x1b06ae,null))[_0x9a52('0x23')](function(_0x266816){if(_0x266816){_0x2b65e5[_0x9a52('0x4a')][_0x9a52('0x54')]=_0x266816['id'];return db[_0x9a52('0x2d')]['create'](_0x2b65e5['body']);}})['then'](respondWithResult(_0x1b06ae,null))[_0x9a52('0x52')](handleError(_0x1b06ae,null));};exports[_0x9a52('0x55')]=function(_0x231502,_0x47c25e,_0x245cbb){var _0x2cf7e4={};var _0x34f788={};var _0x59d621;var _0x27327e;return db[_0x9a52('0x2d')][_0x9a52('0x56')]({'where':{'id':_0x231502[_0x9a52('0x45')]['id']}})[_0x9a52('0x23')](handleEntityNotFound(_0x47c25e,null))[_0x9a52('0x23')](function(_0x242956){if(_0x242956){_0x59d621=_0x242956;_0x34f788[_0x9a52('0x38')]=_['keys'](db[_0x9a52('0x2d')][_0x9a52('0x2e')]);_0x34f788[_0x9a52('0x32')]=_[_0x9a52('0x33')](_0x231502[_0x9a52('0x32')]);_0x34f788[_0x9a52('0x34')]=_[_0x9a52('0x35')](_0x34f788['model'],_0x34f788[_0x9a52('0x32')]);_0x2cf7e4[_0x9a52('0x37')]=_[_0x9a52('0x35')](_0x34f788[_0x9a52('0x38')],qs['fields'](_0x231502[_0x9a52('0x32')]['fields']));_0x2cf7e4[_0x9a52('0x37')]=_0x2cf7e4[_0x9a52('0x37')][_0x9a52('0x46')]?_0x2cf7e4[_0x9a52('0x37')]:_0x34f788[_0x9a52('0x38')];_0x2cf7e4[_0x9a52('0x3b')]=qs[_0x9a52('0x3c')](_0x231502[_0x9a52('0x32')]['sort']);_0x2cf7e4[_0x9a52('0x3d')]=qs[_0x9a52('0x34')](_[_0x9a52('0x3e')](_0x231502[_0x9a52('0x32')],_0x34f788[_0x9a52('0x34')]));if(_0x231502[_0x9a52('0x32')][_0x9a52('0x3f')]){_0x2cf7e4['where']=_[_0x9a52('0x40')](_0x2cf7e4[_0x9a52('0x3d')],{'$or':_['map'](_0x2cf7e4[_0x9a52('0x37')],function(_0x3029dc){var _0x28ac45={};_0x28ac45[_0x3029dc]={'$like':'%'+_0x231502['query'][_0x9a52('0x3f')]+'%'};return _0x28ac45;})});}_0x2cf7e4=_[_0x9a52('0x40')]({},_0x2cf7e4,_0x231502['options']);return _0x59d621[_0x9a52('0x55')](_0x2cf7e4);}})[_0x9a52('0x23')](function(_0x561969){if(_0x561969){_0x27327e=_0x561969[_0x9a52('0x46')];if(!_0x231502['query'][_0x9a52('0x39')](_0x9a52('0x3a'))){_0x2cf7e4[_0x9a52('0x1b')]=qs[_0x9a52('0x1b')](_0x231502[_0x9a52('0x32')][_0x9a52('0x1b')]);_0x2cf7e4['offset']=qs[_0x9a52('0x1c')](_0x231502['query'][_0x9a52('0x1c')]);}return _0x59d621[_0x9a52('0x55')](_0x2cf7e4);}})[_0x9a52('0x23')](function(_0x39eebb){if(_0x39eebb){return _0x39eebb?{'count':_0x27327e,'rows':_0x39eebb}:null;}})[_0x9a52('0x23')](respondWithResult(_0x47c25e,null))[_0x9a52('0x52')](handleError(_0x47c25e,null));};exports[_0x9a52('0x57')]=function(_0x56a520,_0xa70674,_0x235f59){return db[_0x9a52('0x2d')][_0x9a52('0x56')]({'where':{'id':_0x56a520[_0x9a52('0x45')]['id']}})[_0x9a52('0x23')](handleEntityNotFound(_0xa70674,null))[_0x9a52('0x23')](function(_0x535a90){if(_0x535a90){return db[_0x9a52('0x58')]['transaction'](function(_0x22d954){return db['Interval']['destroy']({'where':{'IntervalId':_0x56a520[_0x9a52('0x45')]['id']},'transaction':_0x22d954})['then'](function(_0x126676){var _0x3b6cc4=_[_0x9a52('0x2c')](_0x56a520['body'],function(_0x44a5f6){delete _0x44a5f6['id'];_0x44a5f6[_0x9a52('0x54')]=_0x56a520[_0x9a52('0x45')]['id'];return _0x44a5f6;});return db[_0x9a52('0x2d')][_0x9a52('0x59')](_0x3b6cc4,{'transaction':_0x22d954});});})[_0x9a52('0x23')](function(){return db[_0x9a52('0x2d')][_0x9a52('0x5a')]({'where':{'IntervalId':_0x56a520['params']['id']}});});}})[_0x9a52('0x23')](respondWithResult(_0xa70674,null))[_0x9a52('0x52')](handleError(_0xa70674,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ac5249b..e2f82b9 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 _0x8074=['request-promise','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird'];(function(_0x135b54,_0x73cc32){var _0x4d3313=function(_0x5acc57){while(--_0x5acc57){_0x135b54['push'](_0x135b54['shift']());}};_0x4d3313(++_0x73cc32);}(_0x8074,0x175));var _0x4807=function(_0x429d77,_0xaceb02){_0x429d77=_0x429d77-0x0;var _0xfea989=_0x8074[_0x429d77];return _0xfea989;};'use strict';var _=require(_0x4807('0x0'));var util=require(_0x4807('0x1'));var logger=require(_0x4807('0x2'))('api');var moment=require(_0x4807('0x3'));var BPromise=require(_0x4807('0x4'));var rp=require(_0x4807('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4807('0x6'));var attributes=require(_0x4807('0x7'));var extensions=require(_0x4807('0x8'));module[_0x4807('0x9')]=function(_0x5c9730,_0x4982dd){return _0x5c9730[_0x4807('0xa')](_0x4807('0xb'),attributes,{'tableName':_0x4807('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3998fb,_0x3b40d2){extensions[_0x4807('0xd')](_0x5c9730,_0x3998fb);},'afterBulkCreate':function(_0x585168,_0x4a3816,_0x201815){_0x201815();extensions[_0x4807('0xd')](_0x5c9730,_0x585168[0x0]);},'afterUpdate':function(_0x1311ab,_0x262ef9){extensions['rewrite'](_0x5c9730,_0x1311ab);},'afterDestroy':function(_0x48c702,_0x14ec8d){extensions[_0x4807('0xd')](_0x5c9730,_0x48c702);}}});}; \ No newline at end of file +var _0x94ed=['path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x34a459,_0x136cd9){var _0x500f8b=function(_0xdcad7f){while(--_0xdcad7f){_0x34a459['push'](_0x34a459['shift']());}};_0x500f8b(++_0x136cd9);}(_0x94ed,0xbd));var _0xd94e=function(_0x47f8d2,_0x259040){_0x47f8d2=_0x47f8d2-0x0;var _0x5b31bb=_0x94ed[_0x47f8d2];return _0x5b31bb;};'use strict';var _=require(_0xd94e('0x0'));var util=require(_0xd94e('0x1'));var logger=require(_0xd94e('0x2'))(_0xd94e('0x3'));var moment=require(_0xd94e('0x4'));var BPromise=require(_0xd94e('0x5'));var rp=require(_0xd94e('0x6'));var fs=require('fs');var path=require(_0xd94e('0x7'));var rimraf=require('rimraf');var config=require(_0xd94e('0x8'));var attributes=require(_0xd94e('0x9'));var extensions=require(_0xd94e('0xa'));module[_0xd94e('0xb')]=function(_0x115922,_0x5dd48a){return _0x115922[_0xd94e('0xc')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2165c4,_0x299671){extensions[_0xd94e('0xd')](_0x115922,_0x2165c4);},'afterBulkCreate':function(_0x284739,_0x4242ff,_0x32ab23){_0x32ab23();extensions['rewrite'](_0x115922,_0x284739[0x0]);},'afterUpdate':function(_0x4e168b,_0x290db9){extensions[_0xd94e('0xd')](_0x115922,_0x4e168b);},'afterDestroy':function(_0x4b6935,_0x19c27a){extensions['rewrite'](_0x115922,_0x4b6935);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 0d23401..f357f16 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(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var 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(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 b26eb84..ab99106 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x141f84,_0x356464){var _0x223b4a=function(_0x5d6ceb){while(--_0x5d6ceb){_0x141f84['push'](_0x141f84['shift']());}};_0x223b4a(++_0x356464);}(_0x2ef3,0xba));var _0x32ef=function(_0x27d94b,_0x18ea34){_0x27d94b=_0x27d94b-0x0;var _0x5bda35=_0x2ef3[_0x27d94b];return _0x5bda35;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x26296d,_0x8ee019){var _0xf36c03=function(_0x276ed3){while(--_0x276ed3){_0x26296d['push'](_0x26296d['shift']());}};_0xf36c03(++_0x8ee019);}(_0xdb28,0x106));var _0x8db2=function(_0x3a7706,_0x1e7c46){_0x3a7706=_0x3a7706-0x0;var _0xac0807=_0xdb28[_0x3a7706];return _0xac0807;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f908eb3..4e471b1 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 _0xc5bd=['https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','stringify','issuetype','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','utf8','data','end','status','json','parse','error','openIssue','send','headers','remoteAddress','socket','bluebird'];(function(_0x4700ac,_0x1ad784){var _0x535468=function(_0x515a96){while(--_0x515a96){_0x4700ac['push'](_0x4700ac['shift']());}};_0x535468(++_0x1ad784);}(_0xc5bd,0x102));var _0xdc5b=function(_0x19ef5d,_0x1a180a){_0x19ef5d=_0x19ef5d-0x0;var _0x13591a=_0xc5bd[_0x19ef5d];return _0x13591a;};'use strict';var BPromise=require(_0xdc5b('0x0'));var https=require(_0xdc5b('0x1'));var logger=require(_0xdc5b('0x2'))('api');var USERNAME=_0xdc5b('0x3');var PASSWORD=_0xdc5b('0x4');function openIssue(_0x2e7e87,_0x212ce8){var _0x1315a9={'fields':{'project':{'key':_0x2e7e87[_0xdc5b('0x5')]||_0xdc5b('0x6')},'summary':(_0x2e7e87['summary']||_0xdc5b('0x7'))+'\x20from\x20'+_0x2e7e87['ip'],'description':_0x2e7e87['description']||JSON[_0xdc5b('0x8')](_0x2e7e87),'issuetype':{'name':_0x2e7e87[_0xdc5b('0x9')]||'Bug'}}};_0x1315a9['fields'][_0xdc5b('0xa')]=_0x2e7e87[_0xdc5b('0xb')];_0x1315a9[_0xdc5b('0xc')][_0xdc5b('0xd')]=_0x2e7e87[_0xdc5b('0xe')];_0x1315a9['fields'][_0xdc5b('0xf')]=_0x2e7e87[_0xdc5b('0x10')];_0x1315a9[_0xdc5b('0xc')][_0xdc5b('0x11')]=_0x2e7e87['name'];_0x1315a9[_0xdc5b('0xc')][_0xdc5b('0x12')]=_0x2e7e87[_0xdc5b('0x13')];_0x1315a9['fields'][_0xdc5b('0x14')]=_0x2e7e87['ip'];var _0x3ef7e8={'host':_0xdc5b('0x15'),'port':0x1bb,'path':_0xdc5b('0x16'),'method':_0xdc5b('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xdc5b('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x3883a6=JSON['stringify'](_0x1315a9);var _0x178f97=https['request'](_0x3ef7e8,function(_0x178343){_0x178343['setEncoding'](_0xdc5b('0x19'));var _0x2ac7fc='';_0x178343['on'](_0xdc5b('0x1a'),function(_0x4b6418){_0x2ac7fc+=_0x4b6418;});_0x178343['on'](_0xdc5b('0x1b'),function(){if(_0x212ce8){return _0x212ce8[_0xdc5b('0x1c')](_0x178343['statusCode'])[_0xdc5b('0x1d')](JSON[_0xdc5b('0x1e')](_0x2ac7fc));}});});_0x178f97['on'](_0xdc5b('0x1f'),function(_0x22c9ca){if(_0x212ce8){return _0x212ce8['status'](0x1f4)[_0xdc5b('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x178f97['write'](_0x3883a6);_0x178f97[_0xdc5b('0x1b')]();}exports[_0xdc5b('0x20')]=openIssue;exports[_0xdc5b('0x21')]=function(_0x588aa9,_0x419003){_0x588aa9['body']['ip']=_0x588aa9[_0xdc5b('0x22')]['x-forwarded-for']||_0x588aa9['connection'][_0xdc5b('0x23')]||_0x588aa9[_0xdc5b('0x24')][_0xdc5b('0x23')]||_0x588aa9['connection']['socket']['remoteAddress'];return openIssue(_0x588aa9['body'],_0x419003);}; \ No newline at end of file +var _0x5353=['https','support','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket'];(function(_0x1cd633,_0x21c3db){var _0x5bf6d8=function(_0x19de57){while(--_0x19de57){_0x1cd633['push'](_0x1cd633['shift']());}};_0x5bf6d8(++_0x21c3db);}(_0x5353,0x195));var _0x3535=function(_0x43d098,_0x553346){_0x43d098=_0x43d098-0x0;var _0x2461c3=_0x5353[_0x43d098];return _0x2461c3;};'use strict';var BPromise=require('bluebird');var https=require(_0x3535('0x0'));var logger=require('../../config/logger')('api');var USERNAME=_0x3535('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2018dc,_0x36a975){var _0x5f310f={'fields':{'project':{'key':_0x2018dc[_0x3535('0x2')]||_0x3535('0x3')},'summary':(_0x2018dc[_0x3535('0x4')]||'Report')+_0x3535('0x5')+_0x2018dc['ip'],'description':_0x2018dc[_0x3535('0x6')]||JSON[_0x3535('0x7')](_0x2018dc),'issuetype':{'name':_0x2018dc[_0x3535('0x8')]||_0x3535('0x9')}}};_0x5f310f[_0x3535('0xa')][_0x3535('0xb')]=_0x2018dc[_0x3535('0xc')];_0x5f310f[_0x3535('0xa')][_0x3535('0xd')]=_0x2018dc[_0x3535('0xe')];_0x5f310f['fields'][_0x3535('0xf')]=_0x2018dc[_0x3535('0x10')];_0x5f310f[_0x3535('0xa')][_0x3535('0x11')]=_0x2018dc[_0x3535('0x12')];_0x5f310f['fields']['customfield_11504']=_0x2018dc[_0x3535('0x13')];_0x5f310f[_0x3535('0xa')]['customfield_10102']=_0x2018dc['ip'];var _0x1db09c={'host':_0x3535('0x14'),'port':0x1bb,'path':_0x3535('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x3535('0x16'),'Authorization':_0x3535('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x3535('0x18'))}};var _0x435471=JSON[_0x3535('0x7')](_0x5f310f);var _0x5bc689=https[_0x3535('0x19')](_0x1db09c,function(_0x5a0aba){_0x5a0aba[_0x3535('0x1a')](_0x3535('0x1b'));var _0x341cb3='';_0x5a0aba['on'](_0x3535('0x1c'),function(_0x2fc35e){_0x341cb3+=_0x2fc35e;});_0x5a0aba['on'](_0x3535('0x1d'),function(){if(_0x36a975){return _0x36a975[_0x3535('0x1e')](_0x5a0aba[_0x3535('0x1f')])['json'](JSON[_0x3535('0x20')](_0x341cb3));}});});_0x5bc689['on']('error',function(_0x1ca1eb){if(_0x36a975){return _0x36a975[_0x3535('0x1e')](0x1f4)[_0x3535('0x21')]({'errors':[{'message':_0x3535('0x22'),'type':_0x3535('0x23')}]});}});_0x5bc689[_0x3535('0x24')](_0x435471);_0x5bc689[_0x3535('0x1d')]();}exports[_0x3535('0x25')]=openIssue;exports[_0x3535('0x26')]=function(_0x363557,_0xcf9d19){_0x363557[_0x3535('0x27')]['ip']=_0x363557[_0x3535('0x28')][_0x3535('0x29')]||_0x363557[_0x3535('0x2a')][_0x3535('0x2b')]||_0x363557[_0x3535('0x2c')][_0x3535('0x2b')]||_0x363557[_0x3535('0x2a')]['socket'][_0x3535('0x2b')];return openIssue(_0x363557['body'],_0xcf9d19);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 86a2edc..5f7b83b 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 _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x41a60b,_0xc398d){var _0x10c95a=function(_0x2b8bd9){while(--_0x2b8bd9){_0x41a60b['push'](_0x41a60b['shift']());}};_0x10c95a(++_0xc398d);}(_0xa74f,0x9a));var _0xfa74=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xa74f[_0x4179e2];return _0x24cb50;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file +var _0xf4eb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','Router','../../components/interaction/service','../../config/environment'];(function(_0x4c13f0,_0x5e4b35){var _0x27ec90=function(_0x10e4e6){while(--_0x10e4e6){_0x4c13f0['push'](_0x4c13f0['shift']());}};_0x27ec90(++_0x5e4b35);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1b3776,_0x37e1a1){_0x1b3776=_0x1b3776-0x0;var _0x31798e=_0xf4eb[_0x1b3776];return _0x31798e;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['delete'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 23160f1..e3a4995 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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x1e438d,_0x2fe788){_0x1e438d=_0x1e438d-0x0;var _0x4e06cc=_0x7a54[_0x1e438d];return _0x4e06cc;};'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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7a54,0x106));var _0x47a5=function(_0x2be91a,_0x50429d){_0x2be91a=_0x2be91a-0x0;var _0xbd1525=_0x7a54[_0x2be91a];return _0xbd1525;};'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 e5a03b3..971215f 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 _0x49c4=['params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','create','body'];(function(_0x346b49,_0x28e33c){var _0x5826fb=function(_0x1ce376){while(--_0x1ce376){_0x346b49['push'](_0x346b49['shift']());}};_0x5826fb(++_0x28e33c);}(_0x49c4,0x9b));var _0x449c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x49c4[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x449c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x449c('0x1'));var jsonpatch=require(_0x449c('0x2'));var rp=require(_0x449c('0x3'));var moment=require(_0x449c('0x4'));var BPromise=require(_0x449c('0x5'));var Mustache=require(_0x449c('0x6'));var util=require(_0x449c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x449c('0x8'));var ejs=require(_0x449c('0x9'));var fs=require('fs');var fs_extra=require(_0x449c('0xa'));var _=require(_0x449c('0xb'));var squel=require(_0x449c('0xc'));var crypto=require(_0x449c('0xd'));var jsforce=require(_0x449c('0xe'));var deskjs=require(_0x449c('0xf'));var toCsv=require(_0x449c('0x8'));var querystring=require(_0x449c('0x10'));var Papa=require(_0x449c('0x11'));var Redis=require(_0x449c('0x12'));var authService=require(_0x449c('0x13'));var qs=require(_0x449c('0x14'));var as=require(_0x449c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x449c('0x16'));var utils=require(_0x449c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e6303,_0x2d5610){_0x2d5610=_0x2d5610||0xcc;return function(_0x181570){if(_0x181570){return _0x3e6303[_0x449c('0x18')](_0x2d5610);}return _0x3e6303['status'](_0x2d5610)[_0x449c('0x19')]();};}function respondWithResult(_0x4fce89,_0x1818a9){_0x1818a9=_0x1818a9||0xc8;return function(_0x5b3a85){if(_0x5b3a85){return _0x4fce89[_0x449c('0x1a')](_0x1818a9)[_0x449c('0x1b')](_0x5b3a85);}};}function respondWithFilteredResult(_0x258b57,_0x39a9c4){return function(_0x3510e1){if(_0x3510e1){var _0x80bdf5=typeof _0x39a9c4[_0x449c('0x1c')]===_0x449c('0x1d')&&typeof _0x39a9c4[_0x449c('0x1e')]===_0x449c('0x1d');var _0x551b31=_0x3510e1[_0x449c('0x1f')];var _0x4474e2=_0x80bdf5?0x0:_0x39a9c4[_0x449c('0x1c')];var _0x1fd0d0=_0x80bdf5?_0x3510e1[_0x449c('0x1f')]:_0x39a9c4['offset']+_0x39a9c4[_0x449c('0x1e')];var _0x1b5b82;if(_0x1fd0d0>=_0x551b31){_0x1fd0d0=_0x551b31;_0x1b5b82=0xc8;}else{_0x1b5b82=0xce;}_0x258b57[_0x449c('0x1a')](_0x1b5b82);return _0x258b57[_0x449c('0x20')](_0x449c('0x21'),_0x4474e2+'-'+_0x1fd0d0+'/'+_0x551b31)[_0x449c('0x1b')](_0x3510e1);}return null;};}function patchUpdates(_0x57c137){return function(_0x3aee9c){try{jsonpatch[_0x449c('0x22')](_0x3aee9c,_0x57c137,!![]);}catch(_0x58bc53){return BPromise[_0x449c('0x23')](_0x58bc53);}return _0x3aee9c[_0x449c('0x24')]();};}function saveUpdates(_0xdb81ec,_0x42c25f){return function(_0x243d68){if(_0x243d68){return _0x243d68[_0x449c('0x25')](_0xdb81ec)['then'](function(_0x2024a3){return _0x2024a3;});}return null;};}function removeEntity(_0x278917,_0x4f06b3){return function(_0x4dff4c){if(_0x4dff4c){return _0x4dff4c['destroy']()[_0x449c('0x26')](function(){_0x278917['status'](0xcc)[_0x449c('0x19')]();});}};}function handleEntityNotFound(_0x43fea6,_0x2deffd){return function(_0x30512f){if(!_0x30512f){_0x43fea6[_0x449c('0x18')](0x194);}return _0x30512f;};}function handleError(_0x3d8c69,_0x30581e){_0x30581e=_0x30581e||0x1f4;return function(_0x9cfd5){logger[_0x449c('0x27')](_0x9cfd5[_0x449c('0x28')]);if(_0x9cfd5[_0x449c('0x29')]){delete _0x9cfd5[_0x449c('0x29')];}_0x3d8c69[_0x449c('0x1a')](_0x30581e)['send'](_0x9cfd5);};}exports['index']=function(_0x390ada,_0xa23b51){var _0x258479={},_0x35757b={},_0x2e9903={'count':0x0,'rows':[]};var _0x45315d=_[_0x449c('0x2a')](db[_0x449c('0x2b')][_0x449c('0x2c')],function(_0xeebeea){return{'name':_0xeebeea[_0x449c('0x2d')],'type':_0xeebeea[_0x449c('0x2e')][_0x449c('0x2f')]};});_0x35757b[_0x449c('0x30')]=_[_0x449c('0x2a')](_0x45315d,_0x449c('0x29'));_0x35757b[_0x449c('0x31')]=_[_0x449c('0x32')](_0x390ada[_0x449c('0x31')]);_0x35757b[_0x449c('0x33')]=_[_0x449c('0x34')](_0x35757b[_0x449c('0x30')],_0x35757b[_0x449c('0x31')]);_0x258479[_0x449c('0x35')]=_[_0x449c('0x34')](_0x35757b[_0x449c('0x30')],qs[_0x449c('0x36')](_0x390ada['query'][_0x449c('0x36')]));_0x258479['attributes']=_0x258479[_0x449c('0x35')]['length']?_0x258479['attributes']:_0x35757b['model'];if(!_0x390ada[_0x449c('0x31')][_0x449c('0x37')](_0x449c('0x38'))){_0x258479['limit']=qs[_0x449c('0x1e')](_0x390ada[_0x449c('0x31')][_0x449c('0x1e')]);_0x258479['offset']=qs['offset'](_0x390ada[_0x449c('0x31')]['offset']);}_0x258479['order']=qs[_0x449c('0x39')](_0x390ada[_0x449c('0x31')][_0x449c('0x39')]);_0x258479[_0x449c('0x3a')]=qs[_0x449c('0x33')](_[_0x449c('0x3b')](_0x390ada[_0x449c('0x31')],_0x35757b[_0x449c('0x33')]),_0x45315d);if(_0x390ada[_0x449c('0x31')]['filter']){_0x258479['where']=_[_0x449c('0x3c')](_0x258479[_0x449c('0x3a')],{'$or':_[_0x449c('0x2a')](_0x45315d,function(_0x2cb4b2){if(_0x2cb4b2[_0x449c('0x2e')]!==_0x449c('0x3d')){var _0x1a721c={};_0x1a721c[_0x2cb4b2['name']]={'$like':'%'+_0x390ada[_0x449c('0x31')][_0x449c('0x3e')]+'%'};return _0x1a721c;}})});}_0x258479=_[_0x449c('0x3c')]({},_0x258479,_0x390ada[_0x449c('0x3f')]);var _0x372398={'where':_0x258479[_0x449c('0x3a')]};return db['JscriptyAnswerReport']['count'](_0x372398)['then'](function(_0x189fa8){_0x2e9903[_0x449c('0x1f')]=_0x189fa8;if(_0x390ada[_0x449c('0x31')][_0x449c('0x40')]){_0x258479[_0x449c('0x41')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x258479);})[_0x449c('0x26')](function(_0x2c6c03){_0x2e9903[_0x449c('0x42')]=_0x2c6c03;return _0x2e9903;})[_0x449c('0x26')](respondWithFilteredResult(_0xa23b51,_0x258479))[_0x449c('0x43')](handleError(_0xa23b51,null));};exports[_0x449c('0x44')]=function(_0x8d3dbf,_0x280548){var _0x5669ef={'raw':!![],'where':{'id':_0x8d3dbf['params']['id']}},_0x4e1c2b={};_0x4e1c2b[_0x449c('0x30')]=_[_0x449c('0x32')](db[_0x449c('0x2b')][_0x449c('0x2c')]);_0x4e1c2b['query']=_[_0x449c('0x32')](_0x8d3dbf['query']);_0x4e1c2b[_0x449c('0x33')]=_[_0x449c('0x34')](_0x4e1c2b['model'],_0x4e1c2b[_0x449c('0x31')]);_0x5669ef['attributes']=_[_0x449c('0x34')](_0x4e1c2b[_0x449c('0x30')],qs[_0x449c('0x36')](_0x8d3dbf[_0x449c('0x31')][_0x449c('0x36')]));_0x5669ef[_0x449c('0x35')]=_0x5669ef['attributes'][_0x449c('0x45')]?_0x5669ef['attributes']:_0x4e1c2b[_0x449c('0x30')];if(_0x8d3dbf[_0x449c('0x31')][_0x449c('0x40')]){_0x5669ef[_0x449c('0x41')]=[{'all':!![]}];}_0x5669ef=_['merge']({},_0x5669ef,_0x8d3dbf[_0x449c('0x3f')]);return db[_0x449c('0x2b')][_0x449c('0x46')](_0x5669ef)['then'](handleEntityNotFound(_0x280548,null))['then'](respondWithResult(_0x280548,null))[_0x449c('0x43')](handleError(_0x280548,null));};exports[_0x449c('0x47')]=function(_0x1e00f2,_0xca783c){return db[_0x449c('0x2b')][_0x449c('0x47')](_0x1e00f2[_0x449c('0x48')],{})['then'](respondWithResult(_0xca783c,0xc9))[_0x449c('0x43')](handleError(_0xca783c,null));};exports[_0x449c('0x25')]=function(_0x3c4632,_0x155f1f){if(_0x3c4632[_0x449c('0x48')]['id']){delete _0x3c4632[_0x449c('0x48')]['id'];}return db[_0x449c('0x2b')][_0x449c('0x46')]({'where':{'id':_0x3c4632[_0x449c('0x49')]['id']}})[_0x449c('0x26')](handleEntityNotFound(_0x155f1f,null))[_0x449c('0x26')](saveUpdates(_0x3c4632[_0x449c('0x48')],null))[_0x449c('0x26')](respondWithResult(_0x155f1f,null))[_0x449c('0x43')](handleError(_0x155f1f,null));};exports[_0x449c('0x4a')]=function(_0x3346ab,_0x189acd){return db[_0x449c('0x2b')][_0x449c('0x46')]({'where':{'id':_0x3346ab['params']['id']}})[_0x449c('0x26')](handleEntityNotFound(_0x189acd,null))['then'](removeEntity(_0x189acd,null))[_0x449c('0x43')](handleError(_0x189acd,null));};exports['describe']=function(_0x3d6807,_0x2a230e){return db[_0x449c('0x2b')][_0x449c('0x4b')]()[_0x449c('0x26')](respondWithResult(_0x2a230e,null))[_0x449c('0x43')](handleError(_0x2a230e,null));}; \ No newline at end of file +var _0x6011=['ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','update','find','describe','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0xab0d5c,_0x1981b2){var _0x1edcd1=function(_0x573a95){while(--_0x573a95){_0xab0d5c['push'](_0xab0d5c['shift']());}};_0x1edcd1(++_0x1981b2);}(_0x6011,0x196));var _0x1601=function(_0x38c82a,_0x22a176){_0x38c82a=_0x38c82a-0x0;var _0xfd0528=_0x6011[_0x38c82a];return _0xfd0528;};'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(_0x1601('0x0'));var BPromise=require(_0x1601('0x1'));var Mustache=require('mustache');var util=require(_0x1601('0x2'));var path=require(_0x1601('0x3'));var sox=require(_0x1601('0x4'));var csv=require(_0x1601('0x5'));var ejs=require(_0x1601('0x6'));var fs=require('fs');var fs_extra=require(_0x1601('0x7'));var _=require(_0x1601('0x8'));var squel=require(_0x1601('0x9'));var crypto=require(_0x1601('0xa'));var jsforce=require(_0x1601('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1601('0x5'));var querystring=require(_0x1601('0xc'));var Papa=require(_0x1601('0xd'));var Redis=require(_0x1601('0xe'));var authService=require(_0x1601('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1601('0x10'))('api');var utils=require(_0x1601('0x11'));var config=require(_0x1601('0x12'));var licenseUtil=require(_0x1601('0x13'));var db=require(_0x1601('0x14'))['db'];function respondWithStatusCode(_0x263bef,_0x322025){_0x322025=_0x322025||0xcc;return function(_0x3ac50b){if(_0x3ac50b){return _0x263bef[_0x1601('0x15')](_0x322025);}return _0x263bef['status'](_0x322025)[_0x1601('0x16')]();};}function respondWithResult(_0x555d4f,_0x4705f0){_0x4705f0=_0x4705f0||0xc8;return function(_0x5d642d){if(_0x5d642d){return _0x555d4f[_0x1601('0x17')](_0x4705f0)[_0x1601('0x18')](_0x5d642d);}};}function respondWithFilteredResult(_0x4bb5c1,_0x1b40be){return function(_0x39873a){if(_0x39873a){var _0x12ddb0=typeof _0x1b40be['offset']==='undefined'&&typeof _0x1b40be[_0x1601('0x19')]===_0x1601('0x1a');var _0x3621e2=_0x39873a[_0x1601('0x1b')];var _0x1d8563=_0x12ddb0?0x0:_0x1b40be[_0x1601('0x1c')];var _0x23b992=_0x12ddb0?_0x39873a[_0x1601('0x1b')]:_0x1b40be[_0x1601('0x1c')]+_0x1b40be['limit'];var _0x4d077e;if(_0x23b992>=_0x3621e2){_0x23b992=_0x3621e2;_0x4d077e=0xc8;}else{_0x4d077e=0xce;}_0x4bb5c1[_0x1601('0x17')](_0x4d077e);return _0x4bb5c1[_0x1601('0x1d')](_0x1601('0x1e'),_0x1d8563+'-'+_0x23b992+'/'+_0x3621e2)['json'](_0x39873a);}return null;};}function patchUpdates(_0x2c3b5d){return function(_0x380157){try{jsonpatch[_0x1601('0x1f')](_0x380157,_0x2c3b5d,!![]);}catch(_0x2e2e0d){return BPromise[_0x1601('0x20')](_0x2e2e0d);}return _0x380157['save']();};}function saveUpdates(_0x1b8314,_0x296023){return function(_0x220313){if(_0x220313){return _0x220313['update'](_0x1b8314)[_0x1601('0x21')](function(_0x330033){return _0x330033;});}return null;};}function removeEntity(_0x4f918b,_0x2b01da){return function(_0xa8e856){if(_0xa8e856){return _0xa8e856['destroy']()['then'](function(){_0x4f918b[_0x1601('0x17')](0xcc)[_0x1601('0x16')]();});}};}function handleEntityNotFound(_0x34d021,_0x4919f2){return function(_0x362f51){if(!_0x362f51){_0x34d021[_0x1601('0x15')](0x194);}return _0x362f51;};}function handleError(_0x23a6a9,_0x250fcc){_0x250fcc=_0x250fcc||0x1f4;return function(_0x296c34){logger['error'](_0x296c34['stack']);if(_0x296c34[_0x1601('0x22')]){delete _0x296c34[_0x1601('0x22')];}_0x23a6a9[_0x1601('0x17')](_0x250fcc)['send'](_0x296c34);};}exports[_0x1601('0x23')]=function(_0x57eb42,_0x2dcbc9){var _0x3c6bc1={},_0x389f0f={},_0x4d4d0b={'count':0x0,'rows':[]};var _0x388530=_[_0x1601('0x24')](db[_0x1601('0x25')][_0x1601('0x26')],function(_0x5cdcfb){return{'name':_0x5cdcfb[_0x1601('0x27')],'type':_0x5cdcfb[_0x1601('0x28')][_0x1601('0x29')]};});_0x389f0f[_0x1601('0x2a')]=_[_0x1601('0x24')](_0x388530,_0x1601('0x22'));_0x389f0f[_0x1601('0x2b')]=_[_0x1601('0x2c')](_0x57eb42[_0x1601('0x2b')]);_0x389f0f[_0x1601('0x2d')]=_[_0x1601('0x2e')](_0x389f0f[_0x1601('0x2a')],_0x389f0f[_0x1601('0x2b')]);_0x3c6bc1['attributes']=_[_0x1601('0x2e')](_0x389f0f[_0x1601('0x2a')],qs[_0x1601('0x2f')](_0x57eb42[_0x1601('0x2b')][_0x1601('0x2f')]));_0x3c6bc1['attributes']=_0x3c6bc1[_0x1601('0x30')][_0x1601('0x31')]?_0x3c6bc1['attributes']:_0x389f0f[_0x1601('0x2a')];if(!_0x57eb42['query'][_0x1601('0x32')](_0x1601('0x33'))){_0x3c6bc1['limit']=qs[_0x1601('0x19')](_0x57eb42[_0x1601('0x2b')][_0x1601('0x19')]);_0x3c6bc1[_0x1601('0x1c')]=qs[_0x1601('0x1c')](_0x57eb42[_0x1601('0x2b')][_0x1601('0x1c')]);}_0x3c6bc1['order']=qs[_0x1601('0x34')](_0x57eb42[_0x1601('0x2b')]['sort']);_0x3c6bc1['where']=qs[_0x1601('0x2d')](_[_0x1601('0x35')](_0x57eb42[_0x1601('0x2b')],_0x389f0f[_0x1601('0x2d')]),_0x388530);if(_0x57eb42[_0x1601('0x2b')][_0x1601('0x36')]){_0x3c6bc1[_0x1601('0x37')]=_['merge'](_0x3c6bc1[_0x1601('0x37')],{'$or':_[_0x1601('0x24')](_0x388530,function(_0x482379){if(_0x482379['type']!==_0x1601('0x38')){var _0x52034d={};_0x52034d[_0x482379['name']]={'$like':'%'+_0x57eb42['query'][_0x1601('0x36')]+'%'};return _0x52034d;}})});}_0x3c6bc1=_[_0x1601('0x39')]({},_0x3c6bc1,_0x57eb42[_0x1601('0x3a')]);var _0xb8146e={'where':_0x3c6bc1[_0x1601('0x37')]};return db[_0x1601('0x25')][_0x1601('0x1b')](_0xb8146e)[_0x1601('0x21')](function(_0x388f3b){_0x4d4d0b[_0x1601('0x1b')]=_0x388f3b;if(_0x57eb42[_0x1601('0x2b')][_0x1601('0x3b')]){_0x3c6bc1[_0x1601('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1601('0x3d')](_0x3c6bc1);})['then'](function(_0x5acf66){_0x4d4d0b['rows']=_0x5acf66;return _0x4d4d0b;})[_0x1601('0x21')](respondWithFilteredResult(_0x2dcbc9,_0x3c6bc1))[_0x1601('0x3e')](handleError(_0x2dcbc9,null));};exports[_0x1601('0x3f')]=function(_0x5a06dc,_0x581941){var _0x3aef1a={'raw':!![],'where':{'id':_0x5a06dc[_0x1601('0x40')]['id']}},_0x3ce65d={};_0x3ce65d['model']=_[_0x1601('0x2c')](db['JscriptyAnswerReport'][_0x1601('0x26')]);_0x3ce65d[_0x1601('0x2b')]=_[_0x1601('0x2c')](_0x5a06dc[_0x1601('0x2b')]);_0x3ce65d['filters']=_[_0x1601('0x2e')](_0x3ce65d['model'],_0x3ce65d[_0x1601('0x2b')]);_0x3aef1a[_0x1601('0x30')]=_['intersection'](_0x3ce65d[_0x1601('0x2a')],qs[_0x1601('0x2f')](_0x5a06dc[_0x1601('0x2b')]['fields']));_0x3aef1a[_0x1601('0x30')]=_0x3aef1a['attributes'][_0x1601('0x31')]?_0x3aef1a[_0x1601('0x30')]:_0x3ce65d[_0x1601('0x2a')];if(_0x5a06dc[_0x1601('0x2b')][_0x1601('0x3b')]){_0x3aef1a[_0x1601('0x3c')]=[{'all':!![]}];}_0x3aef1a=_[_0x1601('0x39')]({},_0x3aef1a,_0x5a06dc[_0x1601('0x3a')]);return db[_0x1601('0x25')]['find'](_0x3aef1a)[_0x1601('0x21')](handleEntityNotFound(_0x581941,null))['then'](respondWithResult(_0x581941,null))[_0x1601('0x3e')](handleError(_0x581941,null));};exports[_0x1601('0x41')]=function(_0x4a8039,_0xbaeefc){return db[_0x1601('0x25')]['create'](_0x4a8039[_0x1601('0x42')],{})[_0x1601('0x21')](respondWithResult(_0xbaeefc,0xc9))[_0x1601('0x3e')](handleError(_0xbaeefc,null));};exports[_0x1601('0x43')]=function(_0x30f2bf,_0xf14c98){if(_0x30f2bf[_0x1601('0x42')]['id']){delete _0x30f2bf[_0x1601('0x42')]['id'];}return db[_0x1601('0x25')][_0x1601('0x44')]({'where':{'id':_0x30f2bf['params']['id']}})[_0x1601('0x21')](handleEntityNotFound(_0xf14c98,null))['then'](saveUpdates(_0x30f2bf[_0x1601('0x42')],null))[_0x1601('0x21')](respondWithResult(_0xf14c98,null))[_0x1601('0x3e')](handleError(_0xf14c98,null));};exports['destroy']=function(_0x56b904,_0x26ba09){return db[_0x1601('0x25')]['find']({'where':{'id':_0x56b904['params']['id']}})['then'](handleEntityNotFound(_0x26ba09,null))[_0x1601('0x21')](removeEntity(_0x26ba09,null))['catch'](handleError(_0x26ba09,null));};exports[_0x1601('0x45')]=function(_0x174eee,_0x50edf3){return db[_0x1601('0x25')]['describe']()['then'](respondWithResult(_0x50edf3,null))[_0x1601('0x3e')](handleError(_0x50edf3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4c32117..e659d48 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 _0x548d=['moment','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','util','api'];(function(_0x55b4ca,_0x2efe08){var _0x4bccbd=function(_0x417096){while(--_0x417096){_0x55b4ca['push'](_0x55b4ca['shift']());}};_0x4bccbd(++_0x2efe08);}(_0x548d,0x8a));var _0xd548=function(_0x4ccf03,_0x7e9e15){_0x4ccf03=_0x4ccf03-0x0;var _0x2e445f=_0x548d[_0x4ccf03];return _0x2e445f;};'use strict';var _=require('lodash');var util=require(_0xd548('0x0'));var logger=require('../../config/logger')(_0xd548('0x1'));var moment=require(_0xd548('0x2'));var BPromise=require('bluebird');var rp=require(_0xd548('0x3'));var fs=require('fs');var path=require(_0xd548('0x4'));var rimraf=require(_0xd548('0x5'));var config=require('../../config/environment');var attributes=require(_0xd548('0x6'));module[_0xd548('0x7')]=function(_0x829a00,_0x2aa770){return _0x829a00[_0xd548('0x8')](_0xd548('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4b9=['JscriptyAnswerReport','lodash','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x388096,_0x50b7c8){var _0x38c620=function(_0x58a1a6){while(--_0x58a1a6){_0x388096['push'](_0x388096['shift']());}};_0x38c620(++_0x50b7c8);}(_0xd4b9,0x1c3));var _0x9d4b=function(_0x39977a,_0x339526){_0x39977a=_0x39977a-0x0;var _0x5622f1=_0xd4b9[_0x39977a];return _0x5622f1;};'use strict';var _=require(_0x9d4b('0x0'));var util=require(_0x9d4b('0x1'));var logger=require('../../config/logger')(_0x9d4b('0x2'));var moment=require(_0x9d4b('0x3'));var BPromise=require(_0x9d4b('0x4'));var rp=require(_0x9d4b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x9d4b('0x6')]=function(_0x19d0c1,_0x26a369){return _0x19d0c1[_0x9d4b('0x7')](_0x9d4b('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 63238e5..0492e55 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 _0xd60e=['message','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd60e,0xbc));var _0xed60=function(_0x4a8b0f,_0x2a7b4f){_0x4a8b0f=_0x4a8b0f-0x0;var _0x45344d=_0xd60e[_0x4a8b0f];return _0x45344d;};'use strict';var _=require(_0xed60('0x0'));var util=require('util');var moment=require(_0xed60('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed60('0x2'));var db=require(_0xed60('0x3'))['db'];var utils=require(_0xed60('0x4'));var logger=require('../../config/logger')(_0xed60('0x5'));var config=require(_0xed60('0x6'));var jayson=require(_0xed60('0x7'));var client=jayson[_0xed60('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x747709,_0x4c97da,_0x78cbda){return new BPromise(function(_0x19d7b8,_0x41f2b0){return client['request'](_0x747709,_0x78cbda)[_0xed60('0x9')](function(_0x8ebf0){logger[_0xed60('0xa')](_0xed60('0xb'),_0x4c97da,_0xed60('0xc'));logger['debug'](_0xed60('0xd'),_0x4c97da,_0xed60('0xc'),JSON['stringify'](_0x8ebf0));if(_0x8ebf0[_0xed60('0xe')]){if(_0x8ebf0[_0xed60('0xe')][_0xed60('0xf')]===0x1f4){logger[_0xed60('0xe')](_0xed60('0xb'),_0x4c97da,_0x8ebf0[_0xed60('0xe')]['message']);return _0x41f2b0(_0x8ebf0[_0xed60('0xe')]['message']);}logger[_0xed60('0xe')](_0xed60('0xb'),_0x4c97da,_0x8ebf0[_0xed60('0xe')][_0xed60('0x10')]);return _0x19d7b8(_0x8ebf0[_0xed60('0xe')][_0xed60('0x10')]);}else{logger[_0xed60('0xa')](_0xed60('0xb'),_0x4c97da,_0xed60('0xc'));_0x19d7b8(_0x8ebf0['result'][_0xed60('0x10')]);}})['catch'](function(_0x27c22c){logger['error'](_0xed60('0xb'),_0x4c97da,_0x27c22c);_0x41f2b0(_0x27c22c);});});} \ No newline at end of file +var _0x9d5a=['rpc','jayson/promise','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x354083,_0x1a40bb){var _0x37e5a2=function(_0x42505e){while(--_0x42505e){_0x354083['push'](_0x354083['shift']());}};_0x37e5a2(++_0x1a40bb);}(_0x9d5a,0x1a3));var _0xa9d5=function(_0xfaf455,_0x13c0a9){_0xfaf455=_0xfaf455-0x0;var _0x5aaa60=_0x9d5a[_0xfaf455];return _0x5aaa60;};'use strict';var _=require(_0xa9d5('0x0'));var util=require(_0xa9d5('0x1'));var moment=require(_0xa9d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9d5('0x4'));var logger=require(_0xa9d5('0x5'))(_0xa9d5('0x6'));var config=require('../../config/environment');var jayson=require(_0xa9d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48f59c,_0x475909,_0x504a40){return new BPromise(function(_0x1693bb,_0x155cf7){return client['request'](_0x48f59c,_0x504a40)['then'](function(_0x572869){logger[_0xa9d5('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x475909,_0xa9d5('0x9'));logger[_0xa9d5('0xa')](_0xa9d5('0xb'),_0x475909,_0xa9d5('0x9'),JSON['stringify'](_0x572869));if(_0x572869[_0xa9d5('0xc')]){if(_0x572869[_0xa9d5('0xc')][_0xa9d5('0xd')]===0x1f4){logger[_0xa9d5('0xc')](_0xa9d5('0xe'),_0x475909,_0x572869[_0xa9d5('0xc')]['message']);return _0x155cf7(_0x572869[_0xa9d5('0xc')][_0xa9d5('0xf')]);}logger[_0xa9d5('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x475909,_0x572869[_0xa9d5('0xc')][_0xa9d5('0xf')]);return _0x1693bb(_0x572869[_0xa9d5('0xc')][_0xa9d5('0xf')]);}else{logger[_0xa9d5('0x8')](_0xa9d5('0xe'),_0x475909,_0xa9d5('0x9'));_0x1693bb(_0x572869[_0xa9d5('0x10')][_0xa9d5('0xf')]);}})['catch'](function(_0x59bd3d){logger[_0xa9d5('0xc')](_0xa9d5('0xe'),_0x475909,_0x59bd3d);_0x155cf7(_0x59bd3d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 67ba228..6582510 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 _0x6af4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/sessions','/:id/answers','/:id/summary','30s','getSummary','post','create','clone','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5dafba,_0x5210d4){var _0x5e03ac=function(_0x394691){while(--_0x394691){_0x5dafba['push'](_0x5dafba['shift']());}};_0x5e03ac(++_0x5210d4);}(_0x6af4,0x1e8));var _0x46af=function(_0x312cbf,_0x2a7414){_0x312cbf=_0x312cbf-0x0;var _0x12dbb9=_0x6af4[_0x312cbf];return _0x12dbb9;};'use strict';var multer=require('multer');var util=require(_0x46af('0x0'));var path=require(_0x46af('0x1'));var timeout=require(_0x46af('0x2'));var express=require(_0x46af('0x3'));var router=express[_0x46af('0x4')]();var fs_extra=require(_0x46af('0x5'));var auth=require(_0x46af('0x6'));var interaction=require(_0x46af('0x7'));var config=require(_0x46af('0x8'));var controller=require('./jscriptyProject.controller');router[_0x46af('0x9')]('/',auth['isAuthenticated'](),controller[_0x46af('0xa')]);router['get'](_0x46af('0xb'),auth[_0x46af('0xc')](),controller['show']);router[_0x46af('0x9')](_0x46af('0xd'),auth[_0x46af('0xc')](),controller['getSessions']);router['get'](_0x46af('0xe'),auth[_0x46af('0xc')](),controller['getAnswers']);router[_0x46af('0x9')](_0x46af('0xf'),auth[_0x46af('0xc')](),timeout(_0x46af('0x10')),controller[_0x46af('0x11')]);router[_0x46af('0x12')]('/',auth[_0x46af('0xc')](),controller[_0x46af('0x13')]);router[_0x46af('0x12')]('/:id/clone',auth[_0x46af('0xc')](),controller[_0x46af('0x14')]);router[_0x46af('0x15')](_0x46af('0xb'),auth[_0x46af('0xc')](),controller[_0x46af('0x16')]);router[_0x46af('0x17')]('/:id',auth[_0x46af('0xc')](),controller[_0x46af('0x18')]);module[_0x46af('0x19')]=router; \ No newline at end of file +var _0xb149=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','getSummary','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util'];(function(_0x1cb94b,_0x576fe5){var _0x39d18e=function(_0x579ffa){while(--_0x579ffa){_0x1cb94b['push'](_0x1cb94b['shift']());}};_0x39d18e(++_0x576fe5);}(_0xb149,0x150));var _0x9b14=function(_0x4bc56e,_0x4f2fc0){_0x4bc56e=_0x4bc56e-0x0;var _0x29c230=_0xb149[_0x4bc56e];return _0x29c230;};'use strict';var multer=require(_0x9b14('0x0'));var util=require(_0x9b14('0x1'));var path=require('path');var timeout=require(_0x9b14('0x2'));var express=require(_0x9b14('0x3'));var router=express[_0x9b14('0x4')]();var fs_extra=require(_0x9b14('0x5'));var auth=require(_0x9b14('0x6'));var interaction=require(_0x9b14('0x7'));var config=require('../../config/environment');var controller=require(_0x9b14('0x8'));router[_0x9b14('0x9')]('/',auth[_0x9b14('0xa')](),controller[_0x9b14('0xb')]);router['get'](_0x9b14('0xc'),auth[_0x9b14('0xa')](),controller[_0x9b14('0xd')]);router[_0x9b14('0x9')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x9b14('0xe')]);router['get'](_0x9b14('0xf'),auth[_0x9b14('0xa')](),controller[_0x9b14('0x10')]);router[_0x9b14('0x9')]('/:id/summary',auth[_0x9b14('0xa')](),timeout('30s'),controller[_0x9b14('0x11')]);router[_0x9b14('0x12')]('/',auth['isAuthenticated'](),controller[_0x9b14('0x13')]);router[_0x9b14('0x12')](_0x9b14('0x14'),auth[_0x9b14('0xa')](),controller[_0x9b14('0x15')]);router[_0x9b14('0x16')](_0x9b14('0xc'),auth[_0x9b14('0xa')](),controller['update']);router[_0x9b14('0x17')](_0x9b14('0xc'),auth[_0x9b14('0xa')](),controller[_0x9b14('0x18')]);module[_0x9b14('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3fd0298..0ae6da2 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 _0x11ba=['BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x11ba,0x133));var _0xa11b=function(_0x5dfccc,_0x53756c){_0x5dfccc=_0x5dfccc-0x0;var _0x59c0e9=_0x11ba[_0x5dfccc];return _0x59c0e9;};'use strict';var Sequelize=require(_0xa11b('0x0'));var _=require(_0xa11b('0x1'));var util=require(_0xa11b('0x2'));module['exports']={'name':{'type':Sequelize[_0xa11b('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa11b('0x4')](_0xa11b('0x5')),'set':function(_0x3ddb18){if(_[_0xa11b('0x6')](_0x3ddb18)){this[_0xa11b('0x7')](_0xa11b('0x8'),JSON[_0xa11b('0x9')](_0x3ddb18));}else if(_[_0xa11b('0xa')](_0x3ddb18)){this['setDataValue']('formData',_0x3ddb18);}else{this[_0xa11b('0x7')](_0xa11b('0x8'),util[_0xa11b('0xb')](_0xa11b('0xc'),this[_0xa11b('0xd')](_0xa11b('0xe'))||'',this['getDataValue'](_0xa11b('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa11b('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x8e98=['isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','TEXT','long'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8e98,0xbd));var _0x88e9=function(_0x19ce7a,_0x35ccb2){_0x19ce7a=_0x19ce7a-0x0;var _0xae087d=_0x8e98[_0x19ce7a];return _0xae087d;};'use strict';var Sequelize=require(_0x88e9('0x0'));var _=require('lodash');var util=require(_0x88e9('0x1'));module[_0x88e9('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x88e9('0x3')]},'formData':{'type':Sequelize[_0x88e9('0x4')](_0x88e9('0x5')),'set':function(_0x502d4b){if(_[_0x88e9('0x6')](_0x502d4b)){this[_0x88e9('0x7')](_0x88e9('0x8'),JSON[_0x88e9('0x9')](_0x502d4b));}else if(_['isString'](_0x502d4b)){this[_0x88e9('0x7')](_0x88e9('0x8'),_0x502d4b);}else{this[_0x88e9('0x7')](_0x88e9('0x8'),util[_0x88e9('0xa')](_0x88e9('0xb'),this['getDataValue']('name')||'',this[_0x88e9('0xc')](_0x88e9('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x88e9('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x88e9('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 af67c0f..dc397a0 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 _0x237d=['fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','autoAssociation','getSessions','findOne','JscriptySessionReport','findAll','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','download','eml-format','rimraf','zip-dir'];(function(_0x434429,_0x471fb7){var _0x28a578=function(_0x4cc42c){while(--_0x4cc42c){_0x434429['push'](_0x434429['shift']());}};_0x28a578(++_0x471fb7);}(_0x237d,0x1d9));var _0xd237=function(_0x2ff635,_0x18673f){_0x2ff635=_0x2ff635-0x0;var _0x11054c=_0x237d[_0x2ff635];return _0x11054c;};'use strict';var emlformat=require(_0xd237('0x0'));var rimraf=require(_0xd237('0x1'));var zipdir=require(_0xd237('0x2'));var jsonpatch=require(_0xd237('0x3'));var rp=require('request-promise');var moment=require(_0xd237('0x4'));var BPromise=require(_0xd237('0x5'));var Mustache=require(_0xd237('0x6'));var util=require(_0xd237('0x7'));var path=require(_0xd237('0x8'));var sox=require(_0xd237('0x9'));var csv=require('to-csv');var ejs=require(_0xd237('0xa'));var fs=require('fs');var fs_extra=require(_0xd237('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd237('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd237('0xd'));var querystring=require(_0xd237('0xe'));var Papa=require('papaparse');var Redis=require(_0xd237('0xf'));var authService=require(_0xd237('0x10'));var qs=require(_0xd237('0x11'));var as=require(_0xd237('0x12'));var hardwareService=require(_0xd237('0x13'));var logger=require(_0xd237('0x14'))(_0xd237('0x15'));var utils=require(_0xd237('0x16'));var config=require(_0xd237('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd237('0x18'))['db'];function respondWithStatusCode(_0x241635,_0x23bb35){_0x23bb35=_0x23bb35||0xcc;return function(_0x2a694c){if(_0x2a694c){return _0x241635['sendStatus'](_0x23bb35);}return _0x241635[_0xd237('0x19')](_0x23bb35)[_0xd237('0x1a')]();};}function respondWithResult(_0x280aa2,_0x32c5fe){_0x32c5fe=_0x32c5fe||0xc8;return function(_0x176b4c){if(_0x176b4c){return _0x280aa2[_0xd237('0x19')](_0x32c5fe)[_0xd237('0x1b')](_0x176b4c);}};}function respondWithFilteredResult(_0x1d8eb2,_0x2b606f){return function(_0x219017){if(_0x219017){var _0x408719=typeof _0x2b606f[_0xd237('0x1c')]===_0xd237('0x1d')&&typeof _0x2b606f['limit']===_0xd237('0x1d');var _0x29c5a0=_0x219017[_0xd237('0x1e')];var _0x38ff01=_0x408719?0x0:_0x2b606f[_0xd237('0x1c')];var _0x44f847=_0x408719?_0x219017[_0xd237('0x1e')]:_0x2b606f[_0xd237('0x1c')]+_0x2b606f['limit'];var _0x38ac7a;if(_0x44f847>=_0x29c5a0){_0x44f847=_0x29c5a0;_0x38ac7a=0xc8;}else{_0x38ac7a=0xce;}_0x1d8eb2[_0xd237('0x19')](_0x38ac7a);return _0x1d8eb2[_0xd237('0x1f')](_0xd237('0x20'),_0x38ff01+'-'+_0x44f847+'/'+_0x29c5a0)[_0xd237('0x1b')](_0x219017);}return null;};}function patchUpdates(_0x19bfb8){return function(_0x65942){try{jsonpatch[_0xd237('0x21')](_0x65942,_0x19bfb8,!![]);}catch(_0x44fbae){return BPromise[_0xd237('0x22')](_0x44fbae);}return _0x65942[_0xd237('0x23')]();};}function saveUpdates(_0xdb4f3f,_0x10d937){return function(_0x343ea1){if(_0x343ea1){return _0x343ea1[_0xd237('0x24')](_0xdb4f3f)['then'](function(_0x13cbda){return _0x13cbda;});}return null;};}function removeEntity(_0x58167a,_0x1b4730){return function(_0x187459){if(_0x187459){return _0x187459[_0xd237('0x25')]()[_0xd237('0x26')](function(){var _0x502ba1=_0x187459[_0xd237('0x27')]({'plain':!![]});var _0x592ef7=_0xd237('0x28');return db[_0xd237('0x29')]['destroy']({'where':{'type':_0x592ef7,'resourceId':_0x502ba1['id']}})[_0xd237('0x26')](function(){return _0x187459;});})[_0xd237('0x26')](function(){_0x58167a['status'](0xcc)[_0xd237('0x1a')]();});}};}function handleEntityNotFound(_0x9f826e,_0x574a23){return function(_0x3190e8){if(!_0x3190e8){_0x9f826e['sendStatus'](0x194);}return _0x3190e8;};}function handleError(_0x4cc361,_0x59133d){_0x59133d=_0x59133d||0x1f4;return function(_0x376d32){logger[_0xd237('0x2a')](_0x376d32[_0xd237('0x2b')]);if(_0x376d32[_0xd237('0x2c')]){delete _0x376d32['name'];}_0x4cc361[_0xd237('0x19')](_0x59133d)[_0xd237('0x2d')](_0x376d32);};}exports['index']=function(_0x126beb,_0x301b7c){var _0x198a9e={},_0x167d57={},_0x3630a7={'count':0x0,'rows':[]};var _0x5e6a63=_[_0xd237('0x2e')](db[_0xd237('0x2f')][_0xd237('0x30')],function(_0x2e3c70){return{'name':_0x2e3c70[_0xd237('0x31')],'type':_0x2e3c70[_0xd237('0x32')]['key']};});_0x167d57[_0xd237('0x33')]=_['map'](_0x5e6a63,_0xd237('0x2c'));_0x167d57['query']=_[_0xd237('0x34')](_0x126beb[_0xd237('0x35')]);_0x167d57[_0xd237('0x36')]=_['intersection'](_0x167d57['model'],_0x167d57['query']);_0x198a9e[_0xd237('0x37')]=_[_0xd237('0x38')](_0x167d57[_0xd237('0x33')],qs['fields'](_0x126beb['query'][_0xd237('0x39')]));_0x198a9e[_0xd237('0x37')]=_0x198a9e[_0xd237('0x37')][_0xd237('0x3a')]?_0x198a9e[_0xd237('0x37')]:_0x167d57[_0xd237('0x33')];if(!_0x126beb[_0xd237('0x35')][_0xd237('0x3b')](_0xd237('0x3c'))){_0x198a9e[_0xd237('0x3d')]=qs['limit'](_0x126beb[_0xd237('0x35')][_0xd237('0x3d')]);_0x198a9e['offset']=qs[_0xd237('0x1c')](_0x126beb[_0xd237('0x35')][_0xd237('0x1c')]);}_0x198a9e[_0xd237('0x3e')]=qs[_0xd237('0x3f')](_0x126beb[_0xd237('0x35')][_0xd237('0x3f')]);_0x198a9e['where']=qs['filters'](_[_0xd237('0x40')](_0x126beb[_0xd237('0x35')],_0x167d57['filters']),_0x5e6a63);if(_0x126beb[_0xd237('0x35')][_0xd237('0x41')]){_0x198a9e[_0xd237('0x42')]=_[_0xd237('0x43')](_0x198a9e['where'],{'$or':_['map'](_0x5e6a63,function(_0x432878){if(_0x432878[_0xd237('0x32')]!==_0xd237('0x44')){var _0x15cbfa={};_0x15cbfa[_0x432878[_0xd237('0x2c')]]={'$like':'%'+_0x126beb[_0xd237('0x35')]['filter']+'%'};return _0x15cbfa;}})});}_0x198a9e=_[_0xd237('0x43')]({},_0x198a9e,_0x126beb['options']);var _0x414622={'where':_0x198a9e[_0xd237('0x42')]};return db[_0xd237('0x2f')][_0xd237('0x1e')](_0x414622)[_0xd237('0x26')](function(_0x3420dc){_0x3630a7[_0xd237('0x1e')]=_0x3420dc;if(_0x126beb[_0xd237('0x35')][_0xd237('0x45')]){_0x198a9e[_0xd237('0x46')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x198a9e);})[_0xd237('0x26')](function(_0x22c579){_0x3630a7[_0xd237('0x47')]=_0x22c579;return _0x3630a7;})[_0xd237('0x26')](respondWithFilteredResult(_0x301b7c,_0x198a9e))[_0xd237('0x48')](handleError(_0x301b7c,null));};exports[_0xd237('0x49')]=function(_0x7e8f21,_0xe12ae6){var _0x4a885e={'raw':![],'where':{'id':_0x7e8f21[_0xd237('0x4a')]['id']}},_0x68717b={};_0x68717b[_0xd237('0x33')]=_[_0xd237('0x34')](db['JscriptyProject'][_0xd237('0x30')]);_0x68717b[_0xd237('0x35')]=_['keys'](_0x7e8f21[_0xd237('0x35')]);_0x68717b['filters']=_[_0xd237('0x38')](_0x68717b['model'],_0x68717b['query']);_0x4a885e[_0xd237('0x37')]=_[_0xd237('0x38')](_0x68717b['model'],qs[_0xd237('0x39')](_0x7e8f21[_0xd237('0x35')][_0xd237('0x39')]));_0x4a885e[_0xd237('0x37')]=_0x4a885e['attributes'][_0xd237('0x3a')]?_0x4a885e['attributes']:_0x68717b[_0xd237('0x33')];if(_0x7e8f21[_0xd237('0x35')][_0xd237('0x45')]){_0x4a885e['include']=[{'all':!![]}];}_0x4a885e=_[_0xd237('0x43')]({},_0x4a885e,_0x7e8f21[_0xd237('0x4b')]);return db[_0xd237('0x2f')]['find'](_0x4a885e)['then'](handleEntityNotFound(_0xe12ae6,null))[_0xd237('0x26')](respondWithResult(_0xe12ae6,null))[_0xd237('0x48')](handleError(_0xe12ae6,null));};exports[_0xd237('0x4c')]=function(_0x3d8040,_0x348e06){return db[_0xd237('0x2f')]['create'](_0x3d8040['body'],{})[_0xd237('0x26')](function(_0xdfa3b3){var _0xe92e67=_0x3d8040[_0xd237('0x4d')]['get']({'plain':!![]});if(!_0xe92e67)throw new Error(_0xd237('0x4e'));if(_0xe92e67[_0xd237('0x4f')]==='user'){var _0x16ea49=_0xdfa3b3[_0xd237('0x27')]({'plain':!![]});var _0x84028e=_0xd237('0x28');return db[_0xd237('0x50')][_0xd237('0x51')]({'where':{'name':_0x84028e,'userProfileId':_0xe92e67[_0xd237('0x52')]},'raw':!![]})[_0xd237('0x26')](function(_0x581e5d){if(_0x581e5d&&_0x581e5d['autoAssociation']===0x0){return db['UserProfileResource'][_0xd237('0x4c')]({'name':_0x16ea49[_0xd237('0x2c')],'resourceId':_0x16ea49['id'],'type':_0x581e5d['name'],'sectionId':_0x581e5d['id']},{})['then'](function(){return _0xdfa3b3;});}else{return _0xdfa3b3;}})['catch'](function(_0x22d89d){logger[_0xd237('0x2a')](_0xd237('0x53'),_0x22d89d);throw _0x22d89d;});}return _0xdfa3b3;})[_0xd237('0x26')](respondWithResult(_0x348e06,0xc9))['catch'](handleError(_0x348e06,null));};exports[_0xd237('0x54')]=function(_0x172365,_0x4314de){var _0xd7d910={'where':{'id':_0x172365['params']['id']}},_0xd39172={};_0xd39172[_0xd237('0x33')]=_[_0xd237('0x34')](db[_0xd237('0x2f')][_0xd237('0x30')]);_0xd7d910[_0xd237('0x37')]=_[_0xd237('0x38')](_0xd39172[_0xd237('0x33')],qs[_0xd237('0x39')](_0x172365['query'][_0xd237('0x39')]));_0xd7d910[_0xd237('0x37')]=_0xd7d910[_0xd237('0x37')][_0xd237('0x3a')]?_0xd7d910[_0xd237('0x37')]:_0xd39172[_0xd237('0x33')];if(_0x172365[_0xd237('0x35')]['includeAll']){_0xd7d910[_0xd237('0x46')]=[{'all':!![]}];}_0xd7d910=_['merge']({},_0xd7d910,_0x172365['options']);return db['JscriptyProject'][_0xd237('0x51')](_0xd7d910)['then'](handleEntityNotFound(_0x4314de,null))[_0xd237('0x26')](function(_0x5977f7){if(_0x5977f7){var _0x50752b=_0x5977f7['get']({'plain':!![]});_0x50752b=qs[_0xd237('0x55')](_0x50752b,['id','createdAt',_0xd237('0x56')]);_0x172365[_0xd237('0x57')]=_[_0xd237('0x55')](_0x172365['body'],['id','createdAt',_0xd237('0x56')]);return db[_0xd237('0x2f')][_0xd237('0x4c')](_[_0xd237('0x43')](_0x50752b,_0x172365[_0xd237('0x57')]),{'include':_0x172365[_0xd237('0x35')][_0xd237('0x45')]?[{'all':!![]}]:undefined})[_0xd237('0x26')](function(_0x58bd59){var _0x1eafe4=_0x172365['user']['get']({'plain':!![]});if(!_0x1eafe4)throw new Error(_0xd237('0x4e'));if(_0x1eafe4['role']===_0xd237('0x4d')){var _0x5076dc=_0x58bd59[_0xd237('0x27')]({'plain':!![]});var _0x33ff24=_0xd237('0x28');return db[_0xd237('0x50')][_0xd237('0x51')]({'where':{'name':_0x33ff24,'userProfileId':_0x1eafe4['userProfileId']},'raw':!![]})[_0xd237('0x26')](function(_0x8c409a){if(_0x8c409a&&_0x8c409a[_0xd237('0x58')]===0x0){return db[_0xd237('0x29')][_0xd237('0x4c')]({'name':_0x5076dc[_0xd237('0x2c')],'resourceId':_0x5076dc['id'],'type':_0x8c409a[_0xd237('0x2c')],'sectionId':_0x8c409a['id']},{})[_0xd237('0x26')](function(){return _0x58bd59;});}else{return _0x58bd59;}})[_0xd237('0x48')](function(_0x4239ec){logger[_0xd237('0x2a')](_0xd237('0x53'),_0x4239ec);throw _0x4239ec;});}return _0x58bd59;});}})[_0xd237('0x26')](respondWithResult(_0x4314de,0xc9))[_0xd237('0x48')](handleError(_0x4314de,null));};exports[_0xd237('0x24')]=function(_0x23e2da,_0x339244){if(_0x23e2da['body']['id']){delete _0x23e2da[_0xd237('0x57')]['id'];}return db[_0xd237('0x2f')][_0xd237('0x51')]({'where':{'id':_0x23e2da[_0xd237('0x4a')]['id']}})[_0xd237('0x26')](handleEntityNotFound(_0x339244,null))[_0xd237('0x26')](saveUpdates(_0x23e2da[_0xd237('0x57')],null))[_0xd237('0x26')](respondWithResult(_0x339244,null))[_0xd237('0x48')](handleError(_0x339244,null));};exports['destroy']=function(_0x19646b,_0x2e7a81){return db[_0xd237('0x2f')][_0xd237('0x51')]({'where':{'id':_0x19646b['params']['id']}})['then'](handleEntityNotFound(_0x2e7a81,null))[_0xd237('0x26')](removeEntity(_0x2e7a81,null))[_0xd237('0x48')](handleError(_0x2e7a81,null));};exports[_0xd237('0x59')]=function(_0x1f4782,_0x3f7d17,_0xd28a2f){var _0x2f24d5={'raw':!![],'where':{}};var _0x246c84={};var _0x24b4a0={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd237('0x5a')]({'where':{'id':_0x1f4782[_0xd237('0x4a')]['id']}})[_0xd237('0x26')](handleEntityNotFound(_0x3f7d17,null))[_0xd237('0x26')](function(_0x4742cb){if(_0x4742cb){_0x246c84[_0xd237('0x33')]=_['keys'](db[_0xd237('0x5b')][_0xd237('0x30')]);_0x246c84[_0xd237('0x35')]=_[_0xd237('0x34')](_0x1f4782[_0xd237('0x35')]);_0x246c84['filters']=_[_0xd237('0x38')](_0x246c84[_0xd237('0x33')],_0x246c84['query']);_0x2f24d5[_0xd237('0x37')]=_[_0xd237('0x38')](_0x246c84[_0xd237('0x33')],qs['fields'](_0x1f4782[_0xd237('0x35')][_0xd237('0x39')]));_0x2f24d5[_0xd237('0x37')]=_0x2f24d5[_0xd237('0x37')][_0xd237('0x3a')]?_0x2f24d5[_0xd237('0x37')]:_0x246c84[_0xd237('0x33')];if(!_0x1f4782[_0xd237('0x35')][_0xd237('0x3b')](_0xd237('0x3c'))){_0x2f24d5[_0xd237('0x3d')]=qs[_0xd237('0x3d')](_0x1f4782[_0xd237('0x35')]['limit']);_0x2f24d5[_0xd237('0x1c')]=qs[_0xd237('0x1c')](_0x1f4782[_0xd237('0x35')][_0xd237('0x1c')]);}_0x2f24d5[_0xd237('0x3e')]=qs[_0xd237('0x3f')](_0x1f4782[_0xd237('0x35')]['sort']);_0x2f24d5[_0xd237('0x42')]=qs['filters'](_[_0xd237('0x40')](_0x1f4782[_0xd237('0x35')],_0x246c84[_0xd237('0x36')]));_0x2f24d5[_0xd237('0x42')]['ProjectId']=_0x4742cb['id'];if(_0x1f4782[_0xd237('0x35')][_0xd237('0x41')]){_0x2f24d5['where']=_['merge'](_0x2f24d5[_0xd237('0x42')],{'$or':_['map'](_0x2f24d5[_0xd237('0x37')],function(_0x5d4123){var _0x5b3ad6={};_0x5b3ad6[_0x5d4123]={'$like':'%'+_0x1f4782[_0xd237('0x35')]['filter']+'%'};return _0x5b3ad6;})});}_0x2f24d5=_[_0xd237('0x43')]({},_0x2f24d5,_0x1f4782[_0xd237('0x4b')]);return db[_0xd237('0x5b')][_0xd237('0x1e')]({'where':_0x2f24d5['where']})[_0xd237('0x26')](function(_0x38963d){_0x24b4a0[_0xd237('0x1e')]=_0x38963d;if(_0x1f4782[_0xd237('0x35')][_0xd237('0x45')]){_0x2f24d5['include']=[{'all':!![]}];}return db[_0xd237('0x5b')][_0xd237('0x5c')](_0x2f24d5);})[_0xd237('0x26')](function(_0x1b4b65){_0x24b4a0[_0xd237('0x47')]=_0x1b4b65;return _0x24b4a0;});}})[_0xd237('0x26')](respondWithFilteredResult(_0x3f7d17,_0x2f24d5))[_0xd237('0x48')](handleError(_0x3f7d17,null));};exports['getAnswers']=function(_0x3d9149,_0x7ec40b,_0x21f9d7){var _0x962cb0={'raw':!![],'where':{}};var _0x2bbb2b={};var _0x408de8={'count':0x0,'rows':[]};return db[_0xd237('0x2f')][_0xd237('0x5a')]({'where':{'id':_0x3d9149[_0xd237('0x4a')]['id']}})[_0xd237('0x26')](handleEntityNotFound(_0x7ec40b,null))[_0xd237('0x26')](function(_0xe5c243){if(_0xe5c243){_0x2bbb2b[_0xd237('0x33')]=_['keys'](db[_0xd237('0x5d')]['rawAttributes']);_0x2bbb2b[_0xd237('0x35')]=_[_0xd237('0x34')](_0x3d9149['query']);_0x2bbb2b[_0xd237('0x36')]=_[_0xd237('0x38')](_0x2bbb2b[_0xd237('0x33')],_0x2bbb2b[_0xd237('0x35')]);_0x962cb0[_0xd237('0x37')]=_[_0xd237('0x38')](_0x2bbb2b[_0xd237('0x33')],qs['fields'](_0x3d9149[_0xd237('0x35')][_0xd237('0x39')]));_0x962cb0[_0xd237('0x37')]=_0x962cb0[_0xd237('0x37')][_0xd237('0x3a')]?_0x962cb0[_0xd237('0x37')]:_0x2bbb2b[_0xd237('0x33')];if(!_0x3d9149[_0xd237('0x35')]['hasOwnProperty']('nolimit')){_0x962cb0[_0xd237('0x3d')]=qs[_0xd237('0x3d')](_0x3d9149[_0xd237('0x35')]['limit']);_0x962cb0[_0xd237('0x1c')]=qs[_0xd237('0x1c')](_0x3d9149[_0xd237('0x35')][_0xd237('0x1c')]);}_0x962cb0[_0xd237('0x3e')]=qs[_0xd237('0x3f')](_0x3d9149[_0xd237('0x35')][_0xd237('0x3f')]);_0x962cb0[_0xd237('0x42')]=qs[_0xd237('0x36')](_['pick'](_0x3d9149[_0xd237('0x35')],_0x2bbb2b[_0xd237('0x36')]));_0x962cb0[_0xd237('0x42')][_0xd237('0x5e')]=_0xe5c243['id'];if(_0x3d9149[_0xd237('0x35')][_0xd237('0x41')]){_0x962cb0[_0xd237('0x42')]=_[_0xd237('0x43')](_0x962cb0[_0xd237('0x42')],{'$or':_['map'](_0x962cb0[_0xd237('0x37')],function(_0xdedc63){var _0x480378={};_0x480378[_0xdedc63]={'$like':'%'+_0x3d9149[_0xd237('0x35')]['filter']+'%'};return _0x480378;})});}_0x962cb0=_[_0xd237('0x43')]({},_0x962cb0,_0x3d9149[_0xd237('0x4b')]);return db['JscriptyAnswerReport'][_0xd237('0x1e')]({'where':_0x962cb0['where']})[_0xd237('0x26')](function(_0x317cc4){_0x408de8[_0xd237('0x1e')]=_0x317cc4;if(_0x3d9149[_0xd237('0x35')][_0xd237('0x45')]){_0x962cb0[_0xd237('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd237('0x5c')](_0x962cb0);})['then'](function(_0x1053b7){_0x408de8[_0xd237('0x47')]=_0x1053b7;return _0x408de8;});}})[_0xd237('0x26')](respondWithFilteredResult(_0x7ec40b,_0x962cb0))[_0xd237('0x48')](handleError(_0x7ec40b,null));};function char(_0x3a7f4d){return _0xd237('0x5f')===typeof _0x3a7f4d?String[_0xd237('0x60')]['apply'](null,arguments):_0x3a7f4d;}function needsEncapsulation(_0x887291){return!!_0x887291&&(_0x887291[_0xd237('0x61')]()[_0xd237('0x62')](char(0xd))>=0x0||_0x887291[_0xd237('0x61')]()[_0xd237('0x62')](char(0xa))>=0x0||_0x887291[_0xd237('0x61')]()[_0xd237('0x62')](char(0x2c))>=0x0||_0x887291['toString']()[_0xd237('0x62')](char(0x22))>=0x0);}function encapsulate(_0x303d95){var _0x4af2a9=char(0x22),_0x24498c='\x5c'+char(0x22),_0x18ef54=_0x303d95[_0xd237('0x61')]()[_0xd237('0x63')](new RegExp(_0x4af2a9,'g'),_0x24498c);return _0x4af2a9+_0x18ef54+_0x4af2a9;}exports[_0xd237('0x64')]=function(_0x291531,_0x5363c8,_0x5cda99){var _0x38b861,_0xcf530a;var _0x271b5d={'where':{'ProjectId':_0x291531[_0xd237('0x4a')]['id']}};if(_0x291531[_0xd237('0x35')][_0xd237('0x65')]){_0x271b5d[_0xd237('0x42')][_0xd237('0x66')]=JSON[_0xd237('0x67')](_0x291531[_0xd237('0x35')][_0xd237('0x65')]);}return db['JscriptySessionReport']['findAll'](_0x271b5d)[_0xd237('0x26')](handleEntityNotFound(_0x5363c8,null))[_0xd237('0x26')](function(_0x19f7db){if(_0x19f7db){_0x38b861=_0x19f7db;return db[_0xd237('0x68')][_0xd237('0x5c')]({'where':{'SessionId':{'$in':_[_0xd237('0x2e')](_0x38b861,'id')},'ProjectId':_0x291531[_0xd237('0x4a')]['id']},'order':_0xd237('0x69')});}})[_0xd237('0x26')](handleEntityNotFound(_0x5363c8,null))[_0xd237('0x26')](function(_0x38f023){if(_0x38f023){_0xcf530a=_0x38f023;var _0x213199={};for(var _0x120a22=0x0,_0x38c912=_0xcf530a[_0xd237('0x3a')];_0x120a22<_0x38c912;_0x120a22++){if(!_0x213199[_0xd237('0x3b')](_0xcf530a[_0x120a22][_0xd237('0x6a')])){_0x213199[_0xcf530a[_0x120a22][_0xd237('0x6a')]]=needsEncapsulation(_0xcf530a[_0x120a22][_0xd237('0x6b')])?encapsulate(_0xcf530a[_0x120a22][_0xd237('0x6b')]):_0xcf530a[_0x120a22][_0xd237('0x6b')];}}var _0x58d7e8=[],_0x34590={};for(var _0x31274d=0x0,_0xff830c=_0x38b861['length'];_0x31274d<_0xff830c;_0x31274d++){_0x34590={'ProjectId':_0x291531[_0xd237('0x4a')]['id'],'SessionId':_0x38b861[_0x31274d]['id'],'StartTime':moment(_0x38b861[_0x31274d][_0xd237('0x66')])[_0xd237('0x6c')](_0xd237('0x6d'))};for(var _0x198d50=0x0,_0x13571f=_0xcf530a[_0xd237('0x3a')];_0x198d50<_0x13571f;_0x198d50++){if(_0xcf530a[_0x198d50]['SessionId']==_0x38b861[_0x31274d]['id']&&_0x213199[_0xd237('0x3b')](_0xcf530a[_0x198d50][_0xd237('0x6a')])){_0x34590[_0x213199[_0xcf530a[_0x198d50][_0xd237('0x6a')]]]=_0xcf530a[_0x198d50][_0xd237('0x6e')];}}for(var _0x58e3ba in _0x213199){if(!_0x34590['hasOwnProperty'](_0x213199[_0x58e3ba])){_0x34590[_0x213199[_0x58e3ba]]=null;}}_0x58d7e8['push'](_0x34590);}return _0x58d7e8;}})['then'](function(_0x1ef589){if(!_[_0xd237('0x6f')](_0x1ef589)){var _0x1c465c=toCsv(_0x1ef589);var _0x4e47c1=Date[_0xd237('0x70')]();fs['writeFileSync'](util['format'](_0xd237('0x71'),_0x291531['params']['id'],_0x4e47c1),_0x1c465c);_0x5363c8['setHeader'](_0xd237('0x72'),_0xd237('0x73')+util[_0xd237('0x6c')](_0xd237('0x74'),_0x291531[_0xd237('0x4a')]['id'],_0x4e47c1));_0x5363c8[_0xd237('0x75')]('Content-type','text/csv');return _0x5363c8[_0xd237('0x76')](util[_0xd237('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x291531[_0xd237('0x4a')]['id'],_0x4e47c1));}else{return _0x5363c8['sendStatus'](0xcc);}})['catch'](handleError(_0x5363c8,null));}; \ No newline at end of file +var _0x8efc=['pick','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','clone','length','include','omit','createdAt','updatedAt','role','user','find','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','filter','getAnswers','JscriptyAnswerReport','nolimit','number','fromCharCode','toString','indexOf','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','stack','name','send','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','sort','filters'];(function(_0x441263,_0x7aa064){var _0x5353a5=function(_0x5a2538){while(--_0x5a2538){_0x441263['push'](_0x441263['shift']());}};_0x5353a5(++_0x7aa064);}(_0x8efc,0xb3));var _0xc8ef=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x8efc[_0x30cc1a];return _0xb3f18f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8ef('0x0'));var zipdir=require(_0xc8ef('0x1'));var jsonpatch=require(_0xc8ef('0x2'));var rp=require(_0xc8ef('0x3'));var moment=require('moment');var BPromise=require(_0xc8ef('0x4'));var Mustache=require(_0xc8ef('0x5'));var util=require(_0xc8ef('0x6'));var path=require('path');var sox=require(_0xc8ef('0x7'));var csv=require(_0xc8ef('0x8'));var ejs=require(_0xc8ef('0x9'));var fs=require('fs');var fs_extra=require(_0xc8ef('0xa'));var _=require('lodash');var squel=require(_0xc8ef('0xb'));var crypto=require(_0xc8ef('0xc'));var jsforce=require(_0xc8ef('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc8ef('0x8'));var querystring=require(_0xc8ef('0xe'));var Papa=require(_0xc8ef('0xf'));var Redis=require(_0xc8ef('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc8ef('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8ef('0x12'));var logger=require(_0xc8ef('0x13'))(_0xc8ef('0x14'));var utils=require(_0xc8ef('0x15'));var config=require(_0xc8ef('0x16'));var licenseUtil=require(_0xc8ef('0x17'));var db=require(_0xc8ef('0x18'))['db'];function respondWithStatusCode(_0x1c6744,_0xb90ed0){_0xb90ed0=_0xb90ed0||0xcc;return function(_0x15669b){if(_0x15669b){return _0x1c6744[_0xc8ef('0x19')](_0xb90ed0);}return _0x1c6744[_0xc8ef('0x1a')](_0xb90ed0)[_0xc8ef('0x1b')]();};}function respondWithResult(_0x2337a0,_0x8ba6d2){_0x8ba6d2=_0x8ba6d2||0xc8;return function(_0x1799ae){if(_0x1799ae){return _0x2337a0[_0xc8ef('0x1a')](_0x8ba6d2)[_0xc8ef('0x1c')](_0x1799ae);}};}function respondWithFilteredResult(_0x2c3bbf,_0x3f5636){return function(_0x175003){if(_0x175003){var _0x45eb4b=typeof _0x3f5636['offset']===_0xc8ef('0x1d')&&typeof _0x3f5636[_0xc8ef('0x1e')]===_0xc8ef('0x1d');var _0x374982=_0x175003[_0xc8ef('0x1f')];var _0x28eed6=_0x45eb4b?0x0:_0x3f5636[_0xc8ef('0x20')];var _0x262768=_0x45eb4b?_0x175003[_0xc8ef('0x1f')]:_0x3f5636[_0xc8ef('0x20')]+_0x3f5636['limit'];var _0x8edf4;if(_0x262768>=_0x374982){_0x262768=_0x374982;_0x8edf4=0xc8;}else{_0x8edf4=0xce;}_0x2c3bbf['status'](_0x8edf4);return _0x2c3bbf[_0xc8ef('0x21')]('Content-Range',_0x28eed6+'-'+_0x262768+'/'+_0x374982)[_0xc8ef('0x1c')](_0x175003);}return null;};}function patchUpdates(_0x4ff970){return function(_0x32f5f3){try{jsonpatch[_0xc8ef('0x22')](_0x32f5f3,_0x4ff970,!![]);}catch(_0x45635b){return BPromise[_0xc8ef('0x23')](_0x45635b);}return _0x32f5f3[_0xc8ef('0x24')]();};}function saveUpdates(_0x4c57e3,_0x3cf7b2){return function(_0x3ee862){if(_0x3ee862){return _0x3ee862[_0xc8ef('0x25')](_0x4c57e3)['then'](function(_0x23dd8d){return _0x23dd8d;});}return null;};}function removeEntity(_0x57555c,_0x5678b3){return function(_0x5f2456){if(_0x5f2456){return _0x5f2456['destroy']()[_0xc8ef('0x26')](function(){var _0x128556=_0x5f2456[_0xc8ef('0x27')]({'plain':!![]});var _0xeb24e4=_0xc8ef('0x28');return db[_0xc8ef('0x29')][_0xc8ef('0x2a')]({'where':{'type':_0xeb24e4,'resourceId':_0x128556['id']}})[_0xc8ef('0x26')](function(){return _0x5f2456;});})[_0xc8ef('0x26')](function(){_0x57555c[_0xc8ef('0x1a')](0xcc)[_0xc8ef('0x1b')]();});}};}function handleEntityNotFound(_0x328a91,_0x248c3d){return function(_0x1b921a){if(!_0x1b921a){_0x328a91['sendStatus'](0x194);}return _0x1b921a;};}function handleError(_0x173e6f,_0x270c79){_0x270c79=_0x270c79||0x1f4;return function(_0x522500){logger['error'](_0x522500[_0xc8ef('0x2b')]);if(_0x522500['name']){delete _0x522500[_0xc8ef('0x2c')];}_0x173e6f['status'](_0x270c79)[_0xc8ef('0x2d')](_0x522500);};}exports['index']=function(_0x33a80e,_0x405be9){var _0x5e50fd={},_0x5f40c9={},_0x289dbb={'count':0x0,'rows':[]};var _0x2c4e46=_['map'](db[_0xc8ef('0x2e')][_0xc8ef('0x2f')],function(_0x28be7f){return{'name':_0x28be7f[_0xc8ef('0x30')],'type':_0x28be7f[_0xc8ef('0x31')][_0xc8ef('0x32')]};});_0x5f40c9[_0xc8ef('0x33')]=_[_0xc8ef('0x34')](_0x2c4e46,_0xc8ef('0x2c'));_0x5f40c9[_0xc8ef('0x35')]=_[_0xc8ef('0x36')](_0x33a80e[_0xc8ef('0x35')]);_0x5f40c9['filters']=_[_0xc8ef('0x37')](_0x5f40c9[_0xc8ef('0x33')],_0x5f40c9[_0xc8ef('0x35')]);_0x5e50fd[_0xc8ef('0x38')]=_['intersection'](_0x5f40c9[_0xc8ef('0x33')],qs[_0xc8ef('0x39')](_0x33a80e['query'][_0xc8ef('0x39')]));_0x5e50fd[_0xc8ef('0x38')]=_0x5e50fd['attributes']['length']?_0x5e50fd[_0xc8ef('0x38')]:_0x5f40c9[_0xc8ef('0x33')];if(!_0x33a80e[_0xc8ef('0x35')]['hasOwnProperty']('nolimit')){_0x5e50fd[_0xc8ef('0x1e')]=qs[_0xc8ef('0x1e')](_0x33a80e[_0xc8ef('0x35')][_0xc8ef('0x1e')]);_0x5e50fd[_0xc8ef('0x20')]=qs['offset'](_0x33a80e[_0xc8ef('0x35')][_0xc8ef('0x20')]);}_0x5e50fd[_0xc8ef('0x3a')]=qs[_0xc8ef('0x3b')](_0x33a80e[_0xc8ef('0x35')][_0xc8ef('0x3b')]);_0x5e50fd['where']=qs[_0xc8ef('0x3c')](_[_0xc8ef('0x3d')](_0x33a80e['query'],_0x5f40c9['filters']),_0x2c4e46);if(_0x33a80e['query']['filter']){_0x5e50fd[_0xc8ef('0x3e')]=_['merge'](_0x5e50fd[_0xc8ef('0x3e')],{'$or':_[_0xc8ef('0x34')](_0x2c4e46,function(_0x368513){if(_0x368513['type']!==_0xc8ef('0x3f')){var _0x38fe94={};_0x38fe94[_0x368513[_0xc8ef('0x2c')]]={'$like':'%'+_0x33a80e[_0xc8ef('0x35')]['filter']+'%'};return _0x38fe94;}})});}_0x5e50fd=_[_0xc8ef('0x40')]({},_0x5e50fd,_0x33a80e[_0xc8ef('0x41')]);var _0x44a740={'where':_0x5e50fd[_0xc8ef('0x3e')]};return db['JscriptyProject']['count'](_0x44a740)[_0xc8ef('0x26')](function(_0x20647f){_0x289dbb[_0xc8ef('0x1f')]=_0x20647f;if(_0x33a80e[_0xc8ef('0x35')][_0xc8ef('0x42')]){_0x5e50fd['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xc8ef('0x43')](_0x5e50fd);})['then'](function(_0xa6ce01){_0x289dbb[_0xc8ef('0x44')]=_0xa6ce01;return _0x289dbb;})[_0xc8ef('0x26')](respondWithFilteredResult(_0x405be9,_0x5e50fd))['catch'](handleError(_0x405be9,null));};exports[_0xc8ef('0x45')]=function(_0xa8dcd4,_0x562df9){var _0x3cd290={'raw':![],'where':{'id':_0xa8dcd4[_0xc8ef('0x46')]['id']}},_0x4ebbe7={};_0x4ebbe7[_0xc8ef('0x33')]=_[_0xc8ef('0x36')](db['JscriptyProject'][_0xc8ef('0x2f')]);_0x4ebbe7['query']=_[_0xc8ef('0x36')](_0xa8dcd4[_0xc8ef('0x35')]);_0x4ebbe7[_0xc8ef('0x3c')]=_[_0xc8ef('0x37')](_0x4ebbe7[_0xc8ef('0x33')],_0x4ebbe7[_0xc8ef('0x35')]);_0x3cd290[_0xc8ef('0x38')]=_['intersection'](_0x4ebbe7['model'],qs[_0xc8ef('0x39')](_0xa8dcd4[_0xc8ef('0x35')][_0xc8ef('0x39')]));_0x3cd290[_0xc8ef('0x38')]=_0x3cd290[_0xc8ef('0x38')]['length']?_0x3cd290[_0xc8ef('0x38')]:_0x4ebbe7[_0xc8ef('0x33')];if(_0xa8dcd4[_0xc8ef('0x35')][_0xc8ef('0x42')]){_0x3cd290['include']=[{'all':!![]}];}_0x3cd290=_[_0xc8ef('0x40')]({},_0x3cd290,_0xa8dcd4[_0xc8ef('0x41')]);return db[_0xc8ef('0x2e')]['find'](_0x3cd290)[_0xc8ef('0x26')](handleEntityNotFound(_0x562df9,null))['then'](respondWithResult(_0x562df9,null))[_0xc8ef('0x47')](handleError(_0x562df9,null));};exports['create']=function(_0x3dbb7a,_0x331faa){return db[_0xc8ef('0x2e')][_0xc8ef('0x48')](_0x3dbb7a[_0xc8ef('0x49')],{})[_0xc8ef('0x26')](function(_0x2eb81b){var _0x76785=_0x3dbb7a['user'][_0xc8ef('0x27')]({'plain':!![]});if(!_0x76785)throw new Error(_0xc8ef('0x4a'));if(_0x76785['role']==='user'){var _0xe997a=_0x2eb81b['get']({'plain':!![]});var _0x12d88a='Projects';return db[_0xc8ef('0x4b')]['find']({'where':{'name':_0x12d88a,'userProfileId':_0x76785[_0xc8ef('0x4c')]},'raw':!![]})[_0xc8ef('0x26')](function(_0xb7816e){if(_0xb7816e&&_0xb7816e[_0xc8ef('0x4d')]===0x0){return db[_0xc8ef('0x29')]['create']({'name':_0xe997a[_0xc8ef('0x2c')],'resourceId':_0xe997a['id'],'type':_0xb7816e[_0xc8ef('0x2c')],'sectionId':_0xb7816e['id']},{})[_0xc8ef('0x26')](function(){return _0x2eb81b;});}else{return _0x2eb81b;}})[_0xc8ef('0x47')](function(_0x1b460a){logger[_0xc8ef('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b460a);throw _0x1b460a;});}return _0x2eb81b;})['then'](respondWithResult(_0x331faa,0xc9))[_0xc8ef('0x47')](handleError(_0x331faa,null));};exports[_0xc8ef('0x4f')]=function(_0x5e88eb,_0x5b41e5){var _0x1cc6e4={'where':{'id':_0x5e88eb['params']['id']}},_0x1cfab1={};_0x1cfab1['model']=_[_0xc8ef('0x36')](db[_0xc8ef('0x2e')][_0xc8ef('0x2f')]);_0x1cc6e4[_0xc8ef('0x38')]=_[_0xc8ef('0x37')](_0x1cfab1['model'],qs[_0xc8ef('0x39')](_0x5e88eb[_0xc8ef('0x35')][_0xc8ef('0x39')]));_0x1cc6e4['attributes']=_0x1cc6e4['attributes'][_0xc8ef('0x50')]?_0x1cc6e4[_0xc8ef('0x38')]:_0x1cfab1[_0xc8ef('0x33')];if(_0x5e88eb[_0xc8ef('0x35')][_0xc8ef('0x42')]){_0x1cc6e4[_0xc8ef('0x51')]=[{'all':!![]}];}_0x1cc6e4=_[_0xc8ef('0x40')]({},_0x1cc6e4,_0x5e88eb[_0xc8ef('0x41')]);return db[_0xc8ef('0x2e')]['find'](_0x1cc6e4)[_0xc8ef('0x26')](handleEntityNotFound(_0x5b41e5,null))['then'](function(_0x1d394a){if(_0x1d394a){var _0x40607a=_0x1d394a[_0xc8ef('0x27')]({'plain':!![]});_0x40607a=qs[_0xc8ef('0x52')](_0x40607a,['id',_0xc8ef('0x53'),_0xc8ef('0x54')]);_0x5e88eb['body']=_[_0xc8ef('0x52')](_0x5e88eb[_0xc8ef('0x49')],['id',_0xc8ef('0x53'),_0xc8ef('0x54')]);return db[_0xc8ef('0x2e')][_0xc8ef('0x48')](_[_0xc8ef('0x40')](_0x40607a,_0x5e88eb[_0xc8ef('0x49')]),{'include':_0x5e88eb[_0xc8ef('0x35')][_0xc8ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x2b6543){var _0x365745=_0x5e88eb['user'][_0xc8ef('0x27')]({'plain':!![]});if(!_0x365745)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x365745[_0xc8ef('0x55')]===_0xc8ef('0x56')){var _0x498900=_0x2b6543[_0xc8ef('0x27')]({'plain':!![]});var _0x1de73d=_0xc8ef('0x28');return db['UserProfileSection'][_0xc8ef('0x57')]({'where':{'name':_0x1de73d,'userProfileId':_0x365745[_0xc8ef('0x4c')]},'raw':!![]})[_0xc8ef('0x26')](function(_0x157bb8){if(_0x157bb8&&_0x157bb8[_0xc8ef('0x4d')]===0x0){return db['UserProfileResource'][_0xc8ef('0x48')]({'name':_0x498900[_0xc8ef('0x2c')],'resourceId':_0x498900['id'],'type':_0x157bb8[_0xc8ef('0x2c')],'sectionId':_0x157bb8['id']},{})[_0xc8ef('0x26')](function(){return _0x2b6543;});}else{return _0x2b6543;}})[_0xc8ef('0x47')](function(_0xdade06){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdade06);throw _0xdade06;});}return _0x2b6543;});}})[_0xc8ef('0x26')](respondWithResult(_0x5b41e5,0xc9))[_0xc8ef('0x47')](handleError(_0x5b41e5,null));};exports[_0xc8ef('0x25')]=function(_0x5928d9,_0x154f30){if(_0x5928d9[_0xc8ef('0x49')]['id']){delete _0x5928d9['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x5928d9[_0xc8ef('0x46')]['id']}})[_0xc8ef('0x26')](handleEntityNotFound(_0x154f30,null))[_0xc8ef('0x26')](saveUpdates(_0x5928d9[_0xc8ef('0x49')],null))[_0xc8ef('0x26')](respondWithResult(_0x154f30,null))[_0xc8ef('0x47')](handleError(_0x154f30,null));};exports[_0xc8ef('0x2a')]=function(_0x32c5a6,_0x2c1f05){return db[_0xc8ef('0x2e')]['find']({'where':{'id':_0x32c5a6[_0xc8ef('0x46')]['id']}})[_0xc8ef('0x26')](handleEntityNotFound(_0x2c1f05,null))[_0xc8ef('0x26')](removeEntity(_0x2c1f05,null))[_0xc8ef('0x47')](handleError(_0x2c1f05,null));};exports[_0xc8ef('0x58')]=function(_0x405672,_0x59a5a6,_0x38e239){var _0x4a7e49={'raw':!![],'where':{}};var _0x5616ae={};var _0x4a4cef={'count':0x0,'rows':[]};return db[_0xc8ef('0x2e')][_0xc8ef('0x59')]({'where':{'id':_0x405672[_0xc8ef('0x46')]['id']}})[_0xc8ef('0x26')](handleEntityNotFound(_0x59a5a6,null))[_0xc8ef('0x26')](function(_0x3b2301){if(_0x3b2301){_0x5616ae['model']=_[_0xc8ef('0x36')](db[_0xc8ef('0x5a')][_0xc8ef('0x2f')]);_0x5616ae[_0xc8ef('0x35')]=_['keys'](_0x405672[_0xc8ef('0x35')]);_0x5616ae[_0xc8ef('0x3c')]=_[_0xc8ef('0x37')](_0x5616ae['model'],_0x5616ae[_0xc8ef('0x35')]);_0x4a7e49[_0xc8ef('0x38')]=_[_0xc8ef('0x37')](_0x5616ae[_0xc8ef('0x33')],qs['fields'](_0x405672['query']['fields']));_0x4a7e49[_0xc8ef('0x38')]=_0x4a7e49[_0xc8ef('0x38')][_0xc8ef('0x50')]?_0x4a7e49[_0xc8ef('0x38')]:_0x5616ae[_0xc8ef('0x33')];if(!_0x405672[_0xc8ef('0x35')][_0xc8ef('0x5b')]('nolimit')){_0x4a7e49[_0xc8ef('0x1e')]=qs[_0xc8ef('0x1e')](_0x405672['query'][_0xc8ef('0x1e')]);_0x4a7e49[_0xc8ef('0x20')]=qs[_0xc8ef('0x20')](_0x405672[_0xc8ef('0x35')]['offset']);}_0x4a7e49[_0xc8ef('0x3a')]=qs['sort'](_0x405672['query'][_0xc8ef('0x3b')]);_0x4a7e49['where']=qs[_0xc8ef('0x3c')](_[_0xc8ef('0x3d')](_0x405672['query'],_0x5616ae[_0xc8ef('0x3c')]));_0x4a7e49[_0xc8ef('0x3e')][_0xc8ef('0x5c')]=_0x3b2301['id'];if(_0x405672['query'][_0xc8ef('0x5d')]){_0x4a7e49[_0xc8ef('0x3e')]=_['merge'](_0x4a7e49[_0xc8ef('0x3e')],{'$or':_[_0xc8ef('0x34')](_0x4a7e49[_0xc8ef('0x38')],function(_0x5d2332){var _0x31fb0c={};_0x31fb0c[_0x5d2332]={'$like':'%'+_0x405672['query'][_0xc8ef('0x5d')]+'%'};return _0x31fb0c;})});}_0x4a7e49=_[_0xc8ef('0x40')]({},_0x4a7e49,_0x405672[_0xc8ef('0x41')]);return db['JscriptySessionReport'][_0xc8ef('0x1f')]({'where':_0x4a7e49[_0xc8ef('0x3e')]})[_0xc8ef('0x26')](function(_0x4f67f4){_0x4a4cef[_0xc8ef('0x1f')]=_0x4f67f4;if(_0x405672[_0xc8ef('0x35')]['includeAll']){_0x4a7e49['include']=[{'all':!![]}];}return db[_0xc8ef('0x5a')][_0xc8ef('0x43')](_0x4a7e49);})[_0xc8ef('0x26')](function(_0x19d9db){_0x4a4cef['rows']=_0x19d9db;return _0x4a4cef;});}})['then'](respondWithFilteredResult(_0x59a5a6,_0x4a7e49))[_0xc8ef('0x47')](handleError(_0x59a5a6,null));};exports[_0xc8ef('0x5e')]=function(_0x38e931,_0x734d4e,_0x147b7a){var _0x121b98={'raw':!![],'where':{}};var _0x176bda={};var _0xfb7c28={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x38e931[_0xc8ef('0x46')]['id']}})[_0xc8ef('0x26')](handleEntityNotFound(_0x734d4e,null))[_0xc8ef('0x26')](function(_0x54a9e9){if(_0x54a9e9){_0x176bda[_0xc8ef('0x33')]=_[_0xc8ef('0x36')](db[_0xc8ef('0x5f')]['rawAttributes']);_0x176bda['query']=_['keys'](_0x38e931[_0xc8ef('0x35')]);_0x176bda[_0xc8ef('0x3c')]=_[_0xc8ef('0x37')](_0x176bda[_0xc8ef('0x33')],_0x176bda[_0xc8ef('0x35')]);_0x121b98[_0xc8ef('0x38')]=_['intersection'](_0x176bda[_0xc8ef('0x33')],qs[_0xc8ef('0x39')](_0x38e931[_0xc8ef('0x35')][_0xc8ef('0x39')]));_0x121b98[_0xc8ef('0x38')]=_0x121b98['attributes']['length']?_0x121b98[_0xc8ef('0x38')]:_0x176bda[_0xc8ef('0x33')];if(!_0x38e931[_0xc8ef('0x35')][_0xc8ef('0x5b')](_0xc8ef('0x60'))){_0x121b98[_0xc8ef('0x1e')]=qs[_0xc8ef('0x1e')](_0x38e931[_0xc8ef('0x35')][_0xc8ef('0x1e')]);_0x121b98[_0xc8ef('0x20')]=qs['offset'](_0x38e931[_0xc8ef('0x35')][_0xc8ef('0x20')]);}_0x121b98[_0xc8ef('0x3a')]=qs[_0xc8ef('0x3b')](_0x38e931['query'][_0xc8ef('0x3b')]);_0x121b98[_0xc8ef('0x3e')]=qs[_0xc8ef('0x3c')](_[_0xc8ef('0x3d')](_0x38e931[_0xc8ef('0x35')],_0x176bda['filters']));_0x121b98[_0xc8ef('0x3e')][_0xc8ef('0x5c')]=_0x54a9e9['id'];if(_0x38e931[_0xc8ef('0x35')][_0xc8ef('0x5d')]){_0x121b98[_0xc8ef('0x3e')]=_[_0xc8ef('0x40')](_0x121b98[_0xc8ef('0x3e')],{'$or':_['map'](_0x121b98[_0xc8ef('0x38')],function(_0x4b6d7e){var _0x1c3131={};_0x1c3131[_0x4b6d7e]={'$like':'%'+_0x38e931[_0xc8ef('0x35')]['filter']+'%'};return _0x1c3131;})});}_0x121b98=_[_0xc8ef('0x40')]({},_0x121b98,_0x38e931['options']);return db[_0xc8ef('0x5f')][_0xc8ef('0x1f')]({'where':_0x121b98[_0xc8ef('0x3e')]})[_0xc8ef('0x26')](function(_0x5376b0){_0xfb7c28['count']=_0x5376b0;if(_0x38e931[_0xc8ef('0x35')][_0xc8ef('0x42')]){_0x121b98[_0xc8ef('0x51')]=[{'all':!![]}];}return db[_0xc8ef('0x5f')]['findAll'](_0x121b98);})[_0xc8ef('0x26')](function(_0x33acd8){_0xfb7c28[_0xc8ef('0x44')]=_0x33acd8;return _0xfb7c28;});}})[_0xc8ef('0x26')](respondWithFilteredResult(_0x734d4e,_0x121b98))[_0xc8ef('0x47')](handleError(_0x734d4e,null));};function char(_0x3884dd){return _0xc8ef('0x61')===typeof _0x3884dd?String[_0xc8ef('0x62')][_0xc8ef('0x22')](null,arguments):_0x3884dd;}function needsEncapsulation(_0x1697ce){return!!_0x1697ce&&(_0x1697ce[_0xc8ef('0x63')]()[_0xc8ef('0x64')](char(0xd))>=0x0||_0x1697ce[_0xc8ef('0x63')]()['indexOf'](char(0xa))>=0x0||_0x1697ce[_0xc8ef('0x63')]()[_0xc8ef('0x64')](char(0x2c))>=0x0||_0x1697ce[_0xc8ef('0x63')]()[_0xc8ef('0x64')](char(0x22))>=0x0);}function encapsulate(_0x3e7351){var _0x53885e=char(0x22),_0x2a98dd='\x5c'+char(0x22),_0x4c369a=_0x3e7351[_0xc8ef('0x63')]()['replace'](new RegExp(_0x53885e,'g'),_0x2a98dd);return _0x53885e+_0x4c369a+_0x53885e;}exports[_0xc8ef('0x65')]=function(_0x15e577,_0x56b2be,_0x2a9ef6){var _0x34a886,_0x317e87;var _0x44a4d5={'where':{'ProjectId':_0x15e577[_0xc8ef('0x46')]['id']}};if(_0x15e577['query']['startTime']){_0x44a4d5[_0xc8ef('0x3e')][_0xc8ef('0x66')]=JSON['parse'](_0x15e577['query'][_0xc8ef('0x67')]);}return db['JscriptySessionReport'][_0xc8ef('0x43')](_0x44a4d5)[_0xc8ef('0x26')](handleEntityNotFound(_0x56b2be,null))['then'](function(_0x41ab61){if(_0x41ab61){_0x34a886=_0x41ab61;return db[_0xc8ef('0x68')][_0xc8ef('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x34a886,'id')},'ProjectId':_0x15e577['params']['id']},'order':_0xc8ef('0x69')});}})[_0xc8ef('0x26')](handleEntityNotFound(_0x56b2be,null))['then'](function(_0x2bb7c7){if(_0x2bb7c7){_0x317e87=_0x2bb7c7;var _0x319ca9={};for(var _0x482197=0x0,_0x43cd35=_0x317e87['length'];_0x482197<_0x43cd35;_0x482197++){if(!_0x319ca9['hasOwnProperty'](_0x317e87[_0x482197][_0xc8ef('0x6a')])){_0x319ca9[_0x317e87[_0x482197][_0xc8ef('0x6a')]]=needsEncapsulation(_0x317e87[_0x482197][_0xc8ef('0x6b')])?encapsulate(_0x317e87[_0x482197]['question']):_0x317e87[_0x482197][_0xc8ef('0x6b')];}}var _0x151e34=[],_0x13d9b4={};for(var _0x150f18=0x0,_0x25ca0f=_0x34a886[_0xc8ef('0x50')];_0x150f18<_0x25ca0f;_0x150f18++){_0x13d9b4={'ProjectId':_0x15e577[_0xc8ef('0x46')]['id'],'SessionId':_0x34a886[_0x150f18]['id'],'StartTime':moment(_0x34a886[_0x150f18][_0xc8ef('0x66')])[_0xc8ef('0x6c')](_0xc8ef('0x6d'))};for(var _0x10b5c1=0x0,_0x49198d=_0x317e87[_0xc8ef('0x50')];_0x10b5c1<_0x49198d;_0x10b5c1++){if(_0x317e87[_0x10b5c1][_0xc8ef('0x6e')]==_0x34a886[_0x150f18]['id']&&_0x319ca9['hasOwnProperty'](_0x317e87[_0x10b5c1][_0xc8ef('0x6a')])){_0x13d9b4[_0x319ca9[_0x317e87[_0x10b5c1]['questionId']]]=_0x317e87[_0x10b5c1][_0xc8ef('0x6f')];}}for(var _0xa10318 in _0x319ca9){if(!_0x13d9b4[_0xc8ef('0x5b')](_0x319ca9[_0xa10318])){_0x13d9b4[_0x319ca9[_0xa10318]]=null;}}_0x151e34['push'](_0x13d9b4);}return _0x151e34;}})[_0xc8ef('0x26')](function(_0x596902){if(!_['isEmpty'](_0x596902)){var _0x34dbd9=toCsv(_0x596902);var _0x5e6fa2=Date['now']();fs[_0xc8ef('0x70')](util[_0xc8ef('0x6c')](_0xc8ef('0x71'),_0x15e577[_0xc8ef('0x46')]['id'],_0x5e6fa2),_0x34dbd9);_0x56b2be['setHeader'](_0xc8ef('0x72'),'attachment;\x20filename='+util[_0xc8ef('0x6c')](_0xc8ef('0x73'),_0x15e577['params']['id'],_0x5e6fa2));_0x56b2be[_0xc8ef('0x74')](_0xc8ef('0x75'),_0xc8ef('0x76'));return _0x56b2be[_0xc8ef('0x77')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x15e577[_0xc8ef('0x46')]['id'],_0x5e6fa2));}else{return _0x56b2be[_0xc8ef('0x19')](0xcc);}})[_0xc8ef('0x47')](handleError(_0x56b2be,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 6ddc3c5..93370f4 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 _0x2b83=['bluebird','request-promise','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2b83,0x1d3));var _0x32b8=function(_0x35d817,_0x21edb8){_0x35d817=_0x35d817-0x0;var _0x251be7=_0x2b83[_0x35d817];return _0x251be7;};'use strict';var _=require('lodash');var util=require(_0x32b8('0x0'));var logger=require(_0x32b8('0x1'))('api');var moment=require(_0x32b8('0x2'));var BPromise=require(_0x32b8('0x3'));var rp=require(_0x32b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32b8('0x5'));var attributes=require(_0x32b8('0x6'));module['exports']=function(_0x6bbc3d,_0x55abd0){return _0x6bbc3d[_0x32b8('0x7')](_0x32b8('0x8'),attributes,{'tableName':_0x32b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc8d=['moment','bluebird','path','rimraf','../../config/environment','exports','JscriptyProject','lodash','../../config/logger','api'];(function(_0x15c5b8,_0x3b670f){var _0xd45fe6=function(_0x15a775){while(--_0x15a775){_0x15c5b8['push'](_0x15c5b8['shift']());}};_0xd45fe6(++_0x3b670f);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbc8('0x0'));var util=require('util');var logger=require(_0xdbc8('0x1'))(_0xdbc8('0x2'));var moment=require(_0xdbc8('0x3'));var BPromise=require(_0xdbc8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbc8('0x5'));var rimraf=require(_0xdbc8('0x6'));var config=require(_0xdbc8('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xdbc8('0x8')]=function(_0x10ede0,_0x3ee39d){return _0x10ede0['define'](_0xdbc8('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 9488f65..c8f44c8 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xd20627,_0x2bf17f){var _0x278b03=function(_0x7da892){while(--_0x7da892){_0xd20627['push'](_0xd20627['shift']());}};_0x278b03(++_0x2bf17f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x40d050,_0x5a7093){_0x40d050=_0x40d050-0x0;var _0x4fa70c=_0xf4eb[_0x40d050];return _0x4fa70c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x47e313,_0x178999){var _0x551c92=function(_0x45a39c){while(--_0x45a39c){_0x47e313['push'](_0x47e313['shift']());}};_0x551c92(++_0x178999);}(_0xe706,0xa3));var _0x6e70=function(_0x4f2039,_0x528e8e){_0x4f2039=_0x4f2039-0x0;var _0x9643db=_0xe706[_0x4f2039];return _0x9643db;};'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']('JscriptyProject,\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']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2d67a1d..9eab0ce 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 _0x07b1=['../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','isAuthenticated','create','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x07b1,0x189));var _0x107b=function(_0x25f206,_0x1121bb){_0x25f206=_0x25f206-0x0;var _0xf96267=_0x07b1[_0x25f206];return _0xf96267;};'use strict';var multer=require(_0x107b('0x0'));var util=require(_0x107b('0x1'));var path=require('path');var timeout=require(_0x107b('0x2'));var express=require(_0x107b('0x3'));var router=express[_0x107b('0x4')]();var fs_extra=require(_0x107b('0x5'));var auth=require(_0x107b('0x6'));var interaction=require(_0x107b('0x7'));var config=require('../../config/environment');var controller=require(_0x107b('0x8'));router[_0x107b('0x9')]('/',auth['isAuthenticated'](),controller[_0x107b('0xa')]);router[_0x107b('0x9')]('/describe',auth[_0x107b('0xb')](),controller['describe']);router[_0x107b('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x107b('0xb')](),controller[_0x107b('0xc')]);router['put'](_0x107b('0xd'),auth[_0x107b('0xb')](),controller[_0x107b('0xe')]);router['delete'](_0x107b('0xd'),auth[_0x107b('0xb')](),controller['destroy']);module[_0x107b('0xf')]=router; \ No newline at end of file +var _0x17f1=['./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x17f1,0x174));var _0x117f=function(_0x5596a2,_0x46816d){_0x5596a2=_0x5596a2-0x0;var _0x12dbe1=_0x17f1[_0x5596a2];return _0x12dbe1;};'use strict';var multer=require(_0x117f('0x0'));var util=require(_0x117f('0x1'));var path=require(_0x117f('0x2'));var timeout=require(_0x117f('0x3'));var express=require(_0x117f('0x4'));var router=express[_0x117f('0x5')]();var fs_extra=require(_0x117f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x117f('0x7'));var controller=require(_0x117f('0x8'));router[_0x117f('0x9')]('/',auth[_0x117f('0xa')](),controller['index']);router['get'](_0x117f('0xb'),auth[_0x117f('0xa')](),controller['describe']);router['get'](_0x117f('0xc'),auth[_0x117f('0xa')](),controller[_0x117f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x117f('0xe')]);router[_0x117f('0xf')](_0x117f('0xc'),auth[_0x117f('0xa')](),controller[_0x117f('0x10')]);router[_0x117f('0x11')](_0x117f('0xc'),auth[_0x117f('0xa')](),controller[_0x117f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 738f599..90c5094 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x58a0c8,_0x41a761){_0x58a0c8=_0x58a0c8-0x0;var _0x33dbdf=_0x7a54[_0x58a0c8];return _0x33dbdf;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x3fb0c5,_0xaeee5b){_0x3fb0c5=_0x3fb0c5-0x0;var _0xb71dd5=_0x7a54[_0x3fb0c5];return _0xb71dd5;};'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 b41e611..c82428b 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 _0x17ca=['count','limit','apply','reject','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x4f1024,_0x32ca87){var _0x27ded3=function(_0x65c09f){while(--_0x65c09f){_0x4f1024['push'](_0x4f1024['shift']());}};_0x27ded3(++_0x32ca87);}(_0x17ca,0x74));var _0xa17c=function(_0x47433e,_0x5da955){_0x47433e=_0x47433e-0x0;var _0x4a1c3c=_0x17ca[_0x47433e];return _0x4a1c3c;};'use strict';var emlformat=require(_0xa17c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa17c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa17c('0x2'));var BPromise=require(_0xa17c('0x3'));var Mustache=require(_0xa17c('0x4'));var util=require(_0xa17c('0x5'));var path=require(_0xa17c('0x6'));var sox=require(_0xa17c('0x7'));var csv=require(_0xa17c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa17c('0x9'));var _=require(_0xa17c('0xa'));var squel=require(_0xa17c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa17c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa17c('0xd'));var Papa=require(_0xa17c('0xe'));var Redis=require('ioredis');var authService=require(_0xa17c('0xf'));var qs=require(_0xa17c('0x10'));var as=require(_0xa17c('0x11'));var hardwareService=require(_0xa17c('0x12'));var logger=require(_0xa17c('0x13'))(_0xa17c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa17c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ca62,_0x2c55a8){_0x2c55a8=_0x2c55a8||0xcc;return function(_0x282072){if(_0x282072){return _0x35ca62[_0xa17c('0x16')](_0x2c55a8);}return _0x35ca62[_0xa17c('0x17')](_0x2c55a8)[_0xa17c('0x18')]();};}function respondWithResult(_0x134930,_0x4467cb){_0x4467cb=_0x4467cb||0xc8;return function(_0x853f8){if(_0x853f8){return _0x134930['status'](_0x4467cb)[_0xa17c('0x19')](_0x853f8);}};}function respondWithFilteredResult(_0x27af02,_0x49dc05){return function(_0x33692d){if(_0x33692d){var _0x3af175=typeof _0x49dc05[_0xa17c('0x1a')]===_0xa17c('0x1b')&&typeof _0x49dc05['limit']==='undefined';var _0xe1b7e4=_0x33692d['count'];var _0x1fe8ef=_0x3af175?0x0:_0x49dc05[_0xa17c('0x1a')];var _0x169a13=_0x3af175?_0x33692d[_0xa17c('0x1c')]:_0x49dc05[_0xa17c('0x1a')]+_0x49dc05[_0xa17c('0x1d')];var _0x275df7;if(_0x169a13>=_0xe1b7e4){_0x169a13=_0xe1b7e4;_0x275df7=0xc8;}else{_0x275df7=0xce;}_0x27af02[_0xa17c('0x17')](_0x275df7);return _0x27af02['set']('Content-Range',_0x1fe8ef+'-'+_0x169a13+'/'+_0xe1b7e4)[_0xa17c('0x19')](_0x33692d);}return null;};}function patchUpdates(_0x46d7e7){return function(_0x22410d){try{jsonpatch[_0xa17c('0x1e')](_0x22410d,_0x46d7e7,!![]);}catch(_0x340737){return BPromise[_0xa17c('0x1f')](_0x340737);}return _0x22410d['save']();};}function saveUpdates(_0x35a650,_0x42c664){return function(_0x585885){if(_0x585885){return _0x585885[_0xa17c('0x20')](_0x35a650)[_0xa17c('0x21')](function(_0x58674d){return _0x58674d;});}return null;};}function removeEntity(_0x3e90af,_0x203688){return function(_0x29165b){if(_0x29165b){return _0x29165b['destroy']()[_0xa17c('0x21')](function(){_0x3e90af[_0xa17c('0x17')](0xcc)[_0xa17c('0x18')]();});}};}function handleEntityNotFound(_0x596f8d,_0x3ee5f9){return function(_0x4b072b){if(!_0x4b072b){_0x596f8d[_0xa17c('0x16')](0x194);}return _0x4b072b;};}function handleError(_0xb60ce7,_0x3fde05){_0x3fde05=_0x3fde05||0x1f4;return function(_0x231a72){logger[_0xa17c('0x22')](_0x231a72[_0xa17c('0x23')]);if(_0x231a72[_0xa17c('0x24')]){delete _0x231a72[_0xa17c('0x24')];}_0xb60ce7[_0xa17c('0x17')](_0x3fde05)[_0xa17c('0x25')](_0x231a72);};}exports[_0xa17c('0x26')]=function(_0x3847ea,_0x551b4f){var _0x5e7042={},_0x1b8ae7={},_0x3cdb40={'count':0x0,'rows':[]};var _0x580224=_[_0xa17c('0x27')](db[_0xa17c('0x28')][_0xa17c('0x29')],function(_0x2fdfad){return{'name':_0x2fdfad[_0xa17c('0x2a')],'type':_0x2fdfad[_0xa17c('0x2b')][_0xa17c('0x2c')]};});_0x1b8ae7[_0xa17c('0x2d')]=_['map'](_0x580224,_0xa17c('0x24'));_0x1b8ae7[_0xa17c('0x2e')]=_[_0xa17c('0x2f')](_0x3847ea[_0xa17c('0x2e')]);_0x1b8ae7[_0xa17c('0x30')]=_[_0xa17c('0x31')](_0x1b8ae7['model'],_0x1b8ae7[_0xa17c('0x2e')]);_0x5e7042[_0xa17c('0x32')]=_[_0xa17c('0x31')](_0x1b8ae7[_0xa17c('0x2d')],qs['fields'](_0x3847ea[_0xa17c('0x2e')][_0xa17c('0x33')]));_0x5e7042['attributes']=_0x5e7042[_0xa17c('0x32')][_0xa17c('0x34')]?_0x5e7042[_0xa17c('0x32')]:_0x1b8ae7[_0xa17c('0x2d')];if(!_0x3847ea[_0xa17c('0x2e')][_0xa17c('0x35')](_0xa17c('0x36'))){_0x5e7042[_0xa17c('0x1d')]=qs[_0xa17c('0x1d')](_0x3847ea[_0xa17c('0x2e')][_0xa17c('0x1d')]);_0x5e7042[_0xa17c('0x1a')]=qs[_0xa17c('0x1a')](_0x3847ea[_0xa17c('0x2e')][_0xa17c('0x1a')]);}_0x5e7042[_0xa17c('0x37')]=qs[_0xa17c('0x38')](_0x3847ea['query'][_0xa17c('0x38')]);_0x5e7042[_0xa17c('0x39')]=qs[_0xa17c('0x30')](_['pick'](_0x3847ea[_0xa17c('0x2e')],_0x1b8ae7[_0xa17c('0x30')]),_0x580224);if(_0x3847ea[_0xa17c('0x2e')]['filter']){_0x5e7042[_0xa17c('0x39')]=_['merge'](_0x5e7042[_0xa17c('0x39')],{'$or':_['map'](_0x580224,function(_0x4db0d4){if(_0x4db0d4[_0xa17c('0x2b')]!==_0xa17c('0x3a')){var _0x49f8c8={};_0x49f8c8[_0x4db0d4[_0xa17c('0x24')]]={'$like':'%'+_0x3847ea['query'][_0xa17c('0x3b')]+'%'};return _0x49f8c8;}})});}_0x5e7042=_[_0xa17c('0x3c')]({},_0x5e7042,_0x3847ea[_0xa17c('0x3d')]);var _0x49dfc8={'where':_0x5e7042[_0xa17c('0x39')]};return db[_0xa17c('0x28')][_0xa17c('0x1c')](_0x49dfc8)['then'](function(_0x593a4e){_0x3cdb40['count']=_0x593a4e;if(_0x3847ea[_0xa17c('0x2e')][_0xa17c('0x3e')]){_0x5e7042['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xa17c('0x3f')](_0x5e7042);})[_0xa17c('0x21')](function(_0x451263){_0x3cdb40[_0xa17c('0x40')]=_0x451263;return _0x3cdb40;})[_0xa17c('0x21')](respondWithFilteredResult(_0x551b4f,_0x5e7042))[_0xa17c('0x41')](handleError(_0x551b4f,null));};exports['show']=function(_0x3dbf87,_0x12984f){var _0x4de233={'raw':!![],'where':{'id':_0x3dbf87[_0xa17c('0x42')]['id']}},_0x44dd86={};_0x44dd86[_0xa17c('0x2d')]=_['keys'](db['JscriptyQuestionReport'][_0xa17c('0x29')]);_0x44dd86[_0xa17c('0x2e')]=_[_0xa17c('0x2f')](_0x3dbf87['query']);_0x44dd86[_0xa17c('0x30')]=_[_0xa17c('0x31')](_0x44dd86[_0xa17c('0x2d')],_0x44dd86['query']);_0x4de233[_0xa17c('0x32')]=_[_0xa17c('0x31')](_0x44dd86['model'],qs['fields'](_0x3dbf87[_0xa17c('0x2e')][_0xa17c('0x33')]));_0x4de233[_0xa17c('0x32')]=_0x4de233['attributes'][_0xa17c('0x34')]?_0x4de233[_0xa17c('0x32')]:_0x44dd86[_0xa17c('0x2d')];if(_0x3dbf87[_0xa17c('0x2e')]['includeAll']){_0x4de233[_0xa17c('0x43')]=[{'all':!![]}];}_0x4de233=_[_0xa17c('0x3c')]({},_0x4de233,_0x3dbf87[_0xa17c('0x3d')]);return db[_0xa17c('0x28')][_0xa17c('0x44')](_0x4de233)[_0xa17c('0x21')](handleEntityNotFound(_0x12984f,null))[_0xa17c('0x21')](respondWithResult(_0x12984f,null))[_0xa17c('0x41')](handleError(_0x12984f,null));};exports[_0xa17c('0x45')]=function(_0x4c57f2,_0x2adf1b){return db['JscriptyQuestionReport'][_0xa17c('0x45')](_0x4c57f2['body'],{})['then'](respondWithResult(_0x2adf1b,0xc9))[_0xa17c('0x41')](handleError(_0x2adf1b,null));};exports[_0xa17c('0x20')]=function(_0x88b885,_0x15b431){if(_0x88b885[_0xa17c('0x46')]['id']){delete _0x88b885['body']['id'];}return db[_0xa17c('0x28')][_0xa17c('0x44')]({'where':{'id':_0x88b885[_0xa17c('0x42')]['id']}})['then'](handleEntityNotFound(_0x15b431,null))[_0xa17c('0x21')](saveUpdates(_0x88b885[_0xa17c('0x46')],null))[_0xa17c('0x21')](respondWithResult(_0x15b431,null))[_0xa17c('0x41')](handleError(_0x15b431,null));};exports['destroy']=function(_0x577fb4,_0x529e8d){return db[_0xa17c('0x28')][_0xa17c('0x44')]({'where':{'id':_0x577fb4[_0xa17c('0x42')]['id']}})[_0xa17c('0x21')](handleEntityNotFound(_0x529e8d,null))['then'](removeEntity(_0x529e8d,null))[_0xa17c('0x41')](handleError(_0x529e8d,null));};exports[_0xa17c('0x47')]=function(_0x274468,_0x1548fd){return db[_0xa17c('0x28')][_0xa17c('0x47')]()['then'](respondWithResult(_0x1548fd,null))['catch'](handleError(_0x1548fd,null));}; \ No newline at end of file +var _0xab93=['JscriptyQuestionReport','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','update','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','name','send','index'];(function(_0x250809,_0x4483c5){var _0x5b6108=function(_0x1a13cb){while(--_0x1a13cb){_0x250809['push'](_0x250809['shift']());}};_0x5b6108(++_0x4483c5);}(_0xab93,0x68));var _0x3ab9=function(_0xa89325,_0x53d83a){_0xa89325=_0xa89325-0x0;var _0x1afc96=_0xab93[_0xa89325];return _0x1afc96;};'use strict';var emlformat=require(_0x3ab9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ab9('0x1'));var rp=require(_0x3ab9('0x2'));var moment=require(_0x3ab9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3ab9('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3ab9('0x5'));var csv=require(_0x3ab9('0x6'));var ejs=require(_0x3ab9('0x7'));var fs=require('fs');var fs_extra=require(_0x3ab9('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3ab9('0x9'));var jsforce=require(_0x3ab9('0xa'));var deskjs=require(_0x3ab9('0xb'));var toCsv=require(_0x3ab9('0x6'));var querystring=require('querystring');var Papa=require(_0x3ab9('0xc'));var Redis=require('ioredis');var authService=require(_0x3ab9('0xd'));var qs=require(_0x3ab9('0xe'));var as=require(_0x3ab9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ab9('0x10'))(_0x3ab9('0x11'));var utils=require('../../config/utils');var config=require(_0x3ab9('0x12'));var licenseUtil=require(_0x3ab9('0x13'));var db=require(_0x3ab9('0x14'))['db'];function respondWithStatusCode(_0x412acd,_0x1f493d){_0x1f493d=_0x1f493d||0xcc;return function(_0x336760){if(_0x336760){return _0x412acd[_0x3ab9('0x15')](_0x1f493d);}return _0x412acd[_0x3ab9('0x16')](_0x1f493d)['end']();};}function respondWithResult(_0x515517,_0x3f67d8){_0x3f67d8=_0x3f67d8||0xc8;return function(_0x2adacd){if(_0x2adacd){return _0x515517[_0x3ab9('0x16')](_0x3f67d8)[_0x3ab9('0x17')](_0x2adacd);}};}function respondWithFilteredResult(_0x45a0b2,_0x13519b){return function(_0xb55173){if(_0xb55173){var _0x1254cb=typeof _0x13519b[_0x3ab9('0x18')]===_0x3ab9('0x19')&&typeof _0x13519b[_0x3ab9('0x1a')]===_0x3ab9('0x19');var _0x736476=_0xb55173['count'];var _0x8bd150=_0x1254cb?0x0:_0x13519b[_0x3ab9('0x18')];var _0x16f1e2=_0x1254cb?_0xb55173[_0x3ab9('0x1b')]:_0x13519b[_0x3ab9('0x18')]+_0x13519b['limit'];var _0x223f84;if(_0x16f1e2>=_0x736476){_0x16f1e2=_0x736476;_0x223f84=0xc8;}else{_0x223f84=0xce;}_0x45a0b2[_0x3ab9('0x16')](_0x223f84);return _0x45a0b2[_0x3ab9('0x1c')](_0x3ab9('0x1d'),_0x8bd150+'-'+_0x16f1e2+'/'+_0x736476)[_0x3ab9('0x17')](_0xb55173);}return null;};}function patchUpdates(_0x2cc2cf){return function(_0x4f3a45){try{jsonpatch[_0x3ab9('0x1e')](_0x4f3a45,_0x2cc2cf,!![]);}catch(_0x1e81fc){return BPromise['reject'](_0x1e81fc);}return _0x4f3a45[_0x3ab9('0x1f')]();};}function saveUpdates(_0x54118f,_0x2edf5e){return function(_0x43ffd1){if(_0x43ffd1){return _0x43ffd1['update'](_0x54118f)[_0x3ab9('0x20')](function(_0x1aeb62){return _0x1aeb62;});}return null;};}function removeEntity(_0x17a3b3,_0x49c3e0){return function(_0x22e28c){if(_0x22e28c){return _0x22e28c[_0x3ab9('0x21')]()[_0x3ab9('0x20')](function(){_0x17a3b3[_0x3ab9('0x16')](0xcc)[_0x3ab9('0x22')]();});}};}function handleEntityNotFound(_0x457a86,_0x5db054){return function(_0x5dde08){if(!_0x5dde08){_0x457a86[_0x3ab9('0x15')](0x194);}return _0x5dde08;};}function handleError(_0x24d06f,_0x3cbdec){_0x3cbdec=_0x3cbdec||0x1f4;return function(_0x173b0b){logger['error'](_0x173b0b['stack']);if(_0x173b0b[_0x3ab9('0x23')]){delete _0x173b0b[_0x3ab9('0x23')];}_0x24d06f[_0x3ab9('0x16')](_0x3cbdec)[_0x3ab9('0x24')](_0x173b0b);};}exports[_0x3ab9('0x25')]=function(_0x235ecc,_0x40dcf7){var _0x232523={},_0x41e047={},_0x233158={'count':0x0,'rows':[]};var _0x452fc0=_['map'](db[_0x3ab9('0x26')]['rawAttributes'],function(_0xeecf83){return{'name':_0xeecf83[_0x3ab9('0x27')],'type':_0xeecf83[_0x3ab9('0x28')][_0x3ab9('0x29')]};});_0x41e047[_0x3ab9('0x2a')]=_[_0x3ab9('0x2b')](_0x452fc0,'name');_0x41e047['query']=_['keys'](_0x235ecc[_0x3ab9('0x2c')]);_0x41e047['filters']=_[_0x3ab9('0x2d')](_0x41e047[_0x3ab9('0x2a')],_0x41e047[_0x3ab9('0x2c')]);_0x232523[_0x3ab9('0x2e')]=_[_0x3ab9('0x2d')](_0x41e047['model'],qs[_0x3ab9('0x2f')](_0x235ecc['query'][_0x3ab9('0x2f')]));_0x232523[_0x3ab9('0x2e')]=_0x232523[_0x3ab9('0x2e')][_0x3ab9('0x30')]?_0x232523[_0x3ab9('0x2e')]:_0x41e047[_0x3ab9('0x2a')];if(!_0x235ecc['query'][_0x3ab9('0x31')]('nolimit')){_0x232523['limit']=qs['limit'](_0x235ecc[_0x3ab9('0x2c')][_0x3ab9('0x1a')]);_0x232523[_0x3ab9('0x18')]=qs['offset'](_0x235ecc[_0x3ab9('0x2c')][_0x3ab9('0x18')]);}_0x232523[_0x3ab9('0x32')]=qs[_0x3ab9('0x33')](_0x235ecc['query'][_0x3ab9('0x33')]);_0x232523[_0x3ab9('0x34')]=qs[_0x3ab9('0x35')](_[_0x3ab9('0x36')](_0x235ecc[_0x3ab9('0x2c')],_0x41e047[_0x3ab9('0x35')]),_0x452fc0);if(_0x235ecc[_0x3ab9('0x2c')][_0x3ab9('0x37')]){_0x232523[_0x3ab9('0x34')]=_['merge'](_0x232523['where'],{'$or':_[_0x3ab9('0x2b')](_0x452fc0,function(_0x2937cd){if(_0x2937cd[_0x3ab9('0x28')]!=='VIRTUAL'){var _0x1e2607={};_0x1e2607[_0x2937cd[_0x3ab9('0x23')]]={'$like':'%'+_0x235ecc['query'][_0x3ab9('0x37')]+'%'};return _0x1e2607;}})});}_0x232523=_[_0x3ab9('0x38')]({},_0x232523,_0x235ecc['options']);var _0x2dd8ee={'where':_0x232523[_0x3ab9('0x34')]};return db[_0x3ab9('0x26')][_0x3ab9('0x1b')](_0x2dd8ee)[_0x3ab9('0x20')](function(_0x3676ac){_0x233158[_0x3ab9('0x1b')]=_0x3676ac;if(_0x235ecc[_0x3ab9('0x2c')][_0x3ab9('0x39')]){_0x232523[_0x3ab9('0x3a')]=[{'all':!![]}];}return db[_0x3ab9('0x26')][_0x3ab9('0x3b')](_0x232523);})['then'](function(_0x4a2b03){_0x233158[_0x3ab9('0x3c')]=_0x4a2b03;return _0x233158;})[_0x3ab9('0x20')](respondWithFilteredResult(_0x40dcf7,_0x232523))['catch'](handleError(_0x40dcf7,null));};exports[_0x3ab9('0x3d')]=function(_0xb20cb1,_0x13f0ea){var _0x49d3c8={'raw':!![],'where':{'id':_0xb20cb1[_0x3ab9('0x3e')]['id']}},_0x15cba9={};_0x15cba9[_0x3ab9('0x2a')]=_[_0x3ab9('0x3f')](db['JscriptyQuestionReport'][_0x3ab9('0x40')]);_0x15cba9[_0x3ab9('0x2c')]=_[_0x3ab9('0x3f')](_0xb20cb1[_0x3ab9('0x2c')]);_0x15cba9['filters']=_['intersection'](_0x15cba9['model'],_0x15cba9['query']);_0x49d3c8[_0x3ab9('0x2e')]=_[_0x3ab9('0x2d')](_0x15cba9[_0x3ab9('0x2a')],qs[_0x3ab9('0x2f')](_0xb20cb1[_0x3ab9('0x2c')][_0x3ab9('0x2f')]));_0x49d3c8['attributes']=_0x49d3c8['attributes'][_0x3ab9('0x30')]?_0x49d3c8['attributes']:_0x15cba9[_0x3ab9('0x2a')];if(_0xb20cb1[_0x3ab9('0x2c')][_0x3ab9('0x39')]){_0x49d3c8['include']=[{'all':!![]}];}_0x49d3c8=_[_0x3ab9('0x38')]({},_0x49d3c8,_0xb20cb1['options']);return db['JscriptyQuestionReport'][_0x3ab9('0x41')](_0x49d3c8)[_0x3ab9('0x20')](handleEntityNotFound(_0x13f0ea,null))[_0x3ab9('0x20')](respondWithResult(_0x13f0ea,null))[_0x3ab9('0x42')](handleError(_0x13f0ea,null));};exports[_0x3ab9('0x43')]=function(_0x45ae5b,_0x405570){return db[_0x3ab9('0x26')]['create'](_0x45ae5b['body'],{})[_0x3ab9('0x20')](respondWithResult(_0x405570,0xc9))[_0x3ab9('0x42')](handleError(_0x405570,null));};exports[_0x3ab9('0x44')]=function(_0x4e8677,_0x4689ce){if(_0x4e8677[_0x3ab9('0x45')]['id']){delete _0x4e8677[_0x3ab9('0x45')]['id'];}return db[_0x3ab9('0x26')][_0x3ab9('0x41')]({'where':{'id':_0x4e8677[_0x3ab9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4689ce,null))['then'](saveUpdates(_0x4e8677[_0x3ab9('0x45')],null))['then'](respondWithResult(_0x4689ce,null))[_0x3ab9('0x42')](handleError(_0x4689ce,null));};exports[_0x3ab9('0x21')]=function(_0x2741dc,_0x29fdc4){return db[_0x3ab9('0x26')][_0x3ab9('0x41')]({'where':{'id':_0x2741dc[_0x3ab9('0x3e')]['id']}})[_0x3ab9('0x20')](handleEntityNotFound(_0x29fdc4,null))[_0x3ab9('0x20')](removeEntity(_0x29fdc4,null))[_0x3ab9('0x42')](handleError(_0x29fdc4,null));};exports[_0x3ab9('0x46')]=function(_0x3cd1ba,_0x384254){return db[_0x3ab9('0x26')][_0x3ab9('0x46')]()[_0x3ab9('0x20')](respondWithResult(_0x384254,null))[_0x3ab9('0x42')](handleError(_0x384254,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7b6514f..82beb72 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 _0x8865=['request-promise','path','rimraf','../../config/environment','exports','define','report_jscripty_questions','util','../../config/logger','api','bluebird'];(function(_0x42605b,_0xc35a76){var _0x29cda0=function(_0x172638){while(--_0x172638){_0x42605b['push'](_0x42605b['shift']());}};_0x29cda0(++_0xc35a76);}(_0x8865,0xcd));var _0x5886=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8865[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0x5886('0x0'));var logger=require(_0x5886('0x1'))(_0x5886('0x2'));var moment=require('moment');var BPromise=require(_0x5886('0x3'));var rp=require(_0x5886('0x4'));var fs=require('fs');var path=require(_0x5886('0x5'));var rimraf=require(_0x5886('0x6'));var config=require(_0x5886('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x5886('0x8')]=function(_0x50c37d,_0x21a43e){return _0x50c37d[_0x5886('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x5886('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb75e=['JscriptyQuestionReport','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','exports'];(function(_0x215dd4,_0x5af42a){var _0x44d47c=function(_0x73af27){while(--_0x73af27){_0x215dd4['push'](_0x215dd4['shift']());}};_0x44d47c(++_0x5af42a);}(_0xb75e,0xd9));var _0xeb75=function(_0x1a9eee,_0x37968f){_0x1a9eee=_0x1a9eee-0x0;var _0x16af98=_0xb75e[_0x1a9eee];return _0x16af98;};'use strict';var _=require(_0xeb75('0x0'));var util=require('util');var logger=require(_0xeb75('0x1'))('api');var moment=require(_0xeb75('0x2'));var BPromise=require(_0xeb75('0x3'));var rp=require(_0xeb75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb75('0x5'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0xeb75('0x6')]=function(_0x1fa84f,_0x467bd1){return _0x1fa84f['define'](_0xeb75('0x7'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 9e713f7..82fb720 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 _0x3cca=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x18fa9f,_0x3dbe84){var _0xcc958a=function(_0x4f225c){while(--_0x4f225c){_0x18fa9f['push'](_0x18fa9f['shift']());}};_0xcc958a(++_0x3dbe84);}(_0x3cca,0x1cb));var _0xa3cc=function(_0x1a795d,_0x368393){_0x1a795d=_0x1a795d-0x0;var _0x879581=_0x3cca[_0x1a795d];return _0x879581;};'use strict';var _=require(_0xa3cc('0x0'));var util=require(_0xa3cc('0x1'));var moment=require('moment');var BPromise=require(_0xa3cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3cc('0x3'));var db=require(_0xa3cc('0x4'))['db'];var utils=require(_0xa3cc('0x5'));var logger=require(_0xa3cc('0x6'))(_0xa3cc('0x7'));var config=require(_0xa3cc('0x8'));var jayson=require(_0xa3cc('0x9'));var client=jayson[_0xa3cc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f6f11,_0x211da8,_0x15ec51){return new BPromise(function(_0x2c1d72,_0x59bd1f){return client[_0xa3cc('0xb')](_0x7f6f11,_0x15ec51)[_0xa3cc('0xc')](function(_0x4e9671){logger['info'](_0xa3cc('0xd'),_0x211da8,_0xa3cc('0xe'));logger['debug'](_0xa3cc('0xf'),_0x211da8,_0xa3cc('0xe'),JSON[_0xa3cc('0x10')](_0x4e9671));if(_0x4e9671[_0xa3cc('0x11')]){if(_0x4e9671[_0xa3cc('0x11')][_0xa3cc('0x12')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x211da8,_0x4e9671[_0xa3cc('0x11')][_0xa3cc('0x13')]);return _0x59bd1f(_0x4e9671[_0xa3cc('0x11')]['message']);}logger[_0xa3cc('0x11')](_0xa3cc('0xd'),_0x211da8,_0x4e9671[_0xa3cc('0x11')][_0xa3cc('0x13')]);return _0x2c1d72(_0x4e9671[_0xa3cc('0x11')][_0xa3cc('0x13')]);}else{logger[_0xa3cc('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x211da8,_0xa3cc('0xe'));_0x2c1d72(_0x4e9671[_0xa3cc('0x15')][_0xa3cc('0x13')]);}})[_0xa3cc('0x16')](function(_0x2f5651){logger[_0xa3cc('0x11')](_0xa3cc('0xd'),_0x211da8,_0x2f5651);_0x59bd1f(_0x2f5651);});});} \ No newline at end of file +var _0xdb3f=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x44ad93,_0x3993c1){var _0x305cf7=function(_0x2bf20c){while(--_0x2bf20c){_0x44ad93['push'](_0x44ad93['shift']());}};_0x305cf7(++_0x3993c1);}(_0xdb3f,0x1f3));var _0xfdb3=function(_0x2a4c0d,_0x326aaa){_0x2a4c0d=_0x2a4c0d-0x0;var _0x232a8b=_0xdb3f[_0x2a4c0d];return _0x232a8b;};'use strict';var _=require(_0xfdb3('0x0'));var util=require(_0xfdb3('0x1'));var moment=require(_0xfdb3('0x2'));var BPromise=require(_0xfdb3('0x3'));var rs=require(_0xfdb3('0x4'));var fs=require('fs');var Redis=require(_0xfdb3('0x5'));var db=require(_0xfdb3('0x6'))['db'];var utils=require(_0xfdb3('0x7'));var logger=require(_0xfdb3('0x8'))(_0xfdb3('0x9'));var config=require('../../config/environment');var jayson=require(_0xfdb3('0xa'));var client=jayson['client'][_0xfdb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1521e7,_0x1f2526,_0xec1e72){return new BPromise(function(_0x3c811e,_0x1cf1d1){return client[_0xfdb3('0xc')](_0x1521e7,_0xec1e72)['then'](function(_0xd9f234){logger['info'](_0xfdb3('0xd'),_0x1f2526,_0xfdb3('0xe'));logger[_0xfdb3('0xf')](_0xfdb3('0x10'),_0x1f2526,_0xfdb3('0xe'),JSON['stringify'](_0xd9f234));if(_0xd9f234['error']){if(_0xd9f234[_0xfdb3('0x11')][_0xfdb3('0x12')]===0x1f4){logger[_0xfdb3('0x11')](_0xfdb3('0xd'),_0x1f2526,_0xd9f234[_0xfdb3('0x11')][_0xfdb3('0x13')]);return _0x1cf1d1(_0xd9f234['error'][_0xfdb3('0x13')]);}logger[_0xfdb3('0x11')](_0xfdb3('0xd'),_0x1f2526,_0xd9f234[_0xfdb3('0x11')][_0xfdb3('0x13')]);return _0x3c811e(_0xd9f234[_0xfdb3('0x11')][_0xfdb3('0x13')]);}else{logger[_0xfdb3('0x14')](_0xfdb3('0xd'),_0x1f2526,_0xfdb3('0xe'));_0x3c811e(_0xd9f234[_0xfdb3('0x15')][_0xfdb3('0x13')]);}})[_0xfdb3('0x16')](function(_0x5961a8){logger['error'](_0xfdb3('0xd'),_0x1f2526,_0x5961a8);_0x1cf1d1(_0x5961a8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 07cca79..17adbe2 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 _0xc8a8=['getQuestions','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','describe','get','/:id','/:id/questions'];(function(_0x4ddbb5,_0x4a5423){var _0x1c0f19=function(_0x4e682a){while(--_0x4e682a){_0x4ddbb5['push'](_0x4ddbb5['shift']());}};_0x1c0f19(++_0x4a5423);}(_0xc8a8,0xf6));var _0x8c8a=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0xc8a8[_0x491faa];return _0x414440;};'use strict';var multer=require(_0x8c8a('0x0'));var util=require(_0x8c8a('0x1'));var path=require('path');var timeout=require(_0x8c8a('0x2'));var express=require(_0x8c8a('0x3'));var router=express[_0x8c8a('0x4')]();var fs_extra=require(_0x8c8a('0x5'));var auth=require(_0x8c8a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c8a('0x7'));var controller=require(_0x8c8a('0x8'));router['get']('/',auth[_0x8c8a('0x9')](),controller['index']);router['get']('/describe',auth[_0x8c8a('0x9')](),controller[_0x8c8a('0xa')]);router[_0x8c8a('0xb')](_0x8c8a('0xc'),auth[_0x8c8a('0x9')](),controller['show']);router['get'](_0x8c8a('0xd'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8c8a('0xf')]);router[_0x8c8a('0x10')](_0x8c8a('0xc'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x11')]);router[_0x8c8a('0x12')](_0x8c8a('0xc'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5aa4=['describe','/:id','show','/:id/questions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe'];(function(_0x2cc659,_0x3981c0){var _0x37c538=function(_0x29778b){while(--_0x29778b){_0x2cc659['push'](_0x2cc659['shift']());}};_0x37c538(++_0x3981c0);}(_0x5aa4,0xa4));var _0x45aa=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x5aa4[_0x51d129];return _0x44c377;};'use strict';var multer=require(_0x45aa('0x0'));var util=require(_0x45aa('0x1'));var path=require(_0x45aa('0x2'));var timeout=require(_0x45aa('0x3'));var express=require('express');var router=express[_0x45aa('0x4')]();var fs_extra=require(_0x45aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x45aa('0x6'));var config=require(_0x45aa('0x7'));var controller=require(_0x45aa('0x8'));router[_0x45aa('0x9')]('/',auth[_0x45aa('0xa')](),controller['index']);router[_0x45aa('0x9')](_0x45aa('0xb'),auth['isAuthenticated'](),controller[_0x45aa('0xc')]);router[_0x45aa('0x9')](_0x45aa('0xd'),auth['isAuthenticated'](),controller[_0x45aa('0xe')]);router[_0x45aa('0x9')](_0x45aa('0xf'),auth[_0x45aa('0xa')](),controller['getQuestions']);router[_0x45aa('0x10')]('/',auth[_0x45aa('0xa')](),controller[_0x45aa('0x11')]);router[_0x45aa('0x12')](_0x45aa('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x45aa('0x13')](_0x45aa('0xd'),auth[_0x45aa('0xa')](),controller[_0x45aa('0x14')]);module[_0x45aa('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index e02ab19..89d8413 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 _0xee20=['endtime','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xee20,0x1c3));var _0x0ee2=function(_0x2b2195,_0x5efc30){_0x2b2195=_0x2b2195-0x0;var _0x435786=_0xee20[_0x2b2195];return _0x435786;};'use strict';var moment=require(_0x0ee2('0x0'));var Sequelize=require(_0x0ee2('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x0ee2('0x2')],'set':function(_0x250a47){this[_0x0ee2('0x3')](_0x0ee2('0x4'),_0x250a47);this['setDataValue'](_0x0ee2('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x0ee2('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0ee2('0x6')]},'calleridnum':{'type':Sequelize[_0x0ee2('0x6')]},'completed':{'type':Sequelize[_0x0ee2('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x5120=['DATE','setDataValue','starttime','STRING','BOOLEAN','sequelize'];(function(_0x17b46b,_0x5a388e){var _0x4c0667=function(_0x333e70){while(--_0x333e70){_0x17b46b['push'](_0x17b46b['shift']());}};_0x4c0667(++_0x5a388e);}(_0x5120,0x179));var _0x0512=function(_0x1915e5,_0xe53420){_0x1915e5=_0x1915e5-0x0;var _0x148dd0=_0x5120[_0x1915e5];return _0x148dd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x0512('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x0512('0x1')],'set':function(_0x2b090f){this[_0x0512('0x2')](_0x0512('0x3'),_0x2b090f);this[_0x0512('0x2')]('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x0512('0x1')]},'membername':{'type':Sequelize[_0x0512('0x4')]},'projectname':{'type':Sequelize[_0x0512('0x4')]},'queue':{'type':Sequelize[_0x0512('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0512('0x4')]},'completed':{'type':Sequelize[_0x0512('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 0506f80..03edb38 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 _0x5ae6=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','limit','where','filter','merge','VIRTUAL','JscriptySessionReport','includeAll','findAll','rows','catch','keys','filters','include','options','create','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','length','hasOwnProperty','order','sort','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5159fd,_0x4b760b){var _0x409bae=function(_0x30f5f0){while(--_0x30f5f0){_0x5159fd['push'](_0x5159fd['shift']());}};_0x409bae(++_0x4b760b);}(_0x5ae6,0xdb));var _0x65ae=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x5ae6[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x65ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65ae('0x1'));var jsonpatch=require(_0x65ae('0x2'));var rp=require('request-promise');var moment=require(_0x65ae('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65ae('0x4'));var path=require(_0x65ae('0x5'));var sox=require(_0x65ae('0x6'));var csv=require(_0x65ae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65ae('0x8'));var _=require(_0x65ae('0x9'));var squel=require(_0x65ae('0xa'));var crypto=require(_0x65ae('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x65ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65ae('0xd'));var Papa=require('papaparse');var Redis=require(_0x65ae('0xe'));var authService=require(_0x65ae('0xf'));var qs=require(_0x65ae('0x10'));var as=require(_0x65ae('0x11'));var hardwareService=require(_0x65ae('0x12'));var logger=require(_0x65ae('0x13'))(_0x65ae('0x14'));var utils=require(_0x65ae('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x65ae('0x16'));var db=require(_0x65ae('0x17'))['db'];function respondWithStatusCode(_0x3fe409,_0x3831cb){_0x3831cb=_0x3831cb||0xcc;return function(_0x40dd21){if(_0x40dd21){return _0x3fe409[_0x65ae('0x18')](_0x3831cb);}return _0x3fe409[_0x65ae('0x19')](_0x3831cb)['end']();};}function respondWithResult(_0x4530da,_0x146911){_0x146911=_0x146911||0xc8;return function(_0x427291){if(_0x427291){return _0x4530da[_0x65ae('0x19')](_0x146911)[_0x65ae('0x1a')](_0x427291);}};}function respondWithFilteredResult(_0x5bd32c,_0x2cc35f){return function(_0x1b4160){if(_0x1b4160){var _0xef41b2=typeof _0x2cc35f['offset']==='undefined'&&typeof _0x2cc35f['limit']===_0x65ae('0x1b');var _0x4920a6=_0x1b4160[_0x65ae('0x1c')];var _0xab487a=_0xef41b2?0x0:_0x2cc35f[_0x65ae('0x1d')];var _0xce018b=_0xef41b2?_0x1b4160[_0x65ae('0x1c')]:_0x2cc35f[_0x65ae('0x1d')]+_0x2cc35f['limit'];var _0x37a51a;if(_0xce018b>=_0x4920a6){_0xce018b=_0x4920a6;_0x37a51a=0xc8;}else{_0x37a51a=0xce;}_0x5bd32c[_0x65ae('0x19')](_0x37a51a);return _0x5bd32c[_0x65ae('0x1e')](_0x65ae('0x1f'),_0xab487a+'-'+_0xce018b+'/'+_0x4920a6)[_0x65ae('0x1a')](_0x1b4160);}return null;};}function patchUpdates(_0x567752){return function(_0x5def15){try{jsonpatch[_0x65ae('0x20')](_0x5def15,_0x567752,!![]);}catch(_0x24d926){return BPromise[_0x65ae('0x21')](_0x24d926);}return _0x5def15[_0x65ae('0x22')]();};}function saveUpdates(_0x3773db,_0x2a9742){return function(_0x106571){if(_0x106571){return _0x106571[_0x65ae('0x23')](_0x3773db)['then'](function(_0x49af3a){return _0x49af3a;});}return null;};}function removeEntity(_0x12c098,_0x311442){return function(_0x542a7e){if(_0x542a7e){return _0x542a7e[_0x65ae('0x24')]()[_0x65ae('0x25')](function(){_0x12c098['status'](0xcc)[_0x65ae('0x26')]();});}};}function handleEntityNotFound(_0x49fcfa,_0xf1735d){return function(_0x691d3c){if(!_0x691d3c){_0x49fcfa[_0x65ae('0x18')](0x194);}return _0x691d3c;};}function handleError(_0x14c62e,_0x2441cc){_0x2441cc=_0x2441cc||0x1f4;return function(_0x4cdcfd){logger[_0x65ae('0x27')](_0x4cdcfd[_0x65ae('0x28')]);if(_0x4cdcfd['name']){delete _0x4cdcfd[_0x65ae('0x29')];}_0x14c62e['status'](_0x2441cc)['send'](_0x4cdcfd);};}exports[_0x65ae('0x2a')]=function(_0x27d2a5,_0x5b6328){var _0x31bc44={},_0x21f1e2={},_0x1b19f5={'count':0x0,'rows':[]};var _0x4313da=_[_0x65ae('0x2b')](db['JscriptySessionReport'][_0x65ae('0x2c')],function(_0x21514b){return{'name':_0x21514b[_0x65ae('0x2d')],'type':_0x21514b[_0x65ae('0x2e')][_0x65ae('0x2f')]};});_0x21f1e2[_0x65ae('0x30')]=_['map'](_0x4313da,_0x65ae('0x29'));_0x21f1e2[_0x65ae('0x31')]=_['keys'](_0x27d2a5[_0x65ae('0x31')]);_0x21f1e2['filters']=_[_0x65ae('0x32')](_0x21f1e2['model'],_0x21f1e2[_0x65ae('0x31')]);_0x31bc44['attributes']=_[_0x65ae('0x32')](_0x21f1e2[_0x65ae('0x30')],qs[_0x65ae('0x33')](_0x27d2a5['query']['fields']));_0x31bc44[_0x65ae('0x34')]=_0x31bc44[_0x65ae('0x34')]['length']?_0x31bc44[_0x65ae('0x34')]:_0x21f1e2['model'];if(!_0x27d2a5['query']['hasOwnProperty'](_0x65ae('0x35'))){_0x31bc44[_0x65ae('0x36')]=qs[_0x65ae('0x36')](_0x27d2a5[_0x65ae('0x31')][_0x65ae('0x36')]);_0x31bc44['offset']=qs['offset'](_0x27d2a5[_0x65ae('0x31')][_0x65ae('0x1d')]);}_0x31bc44['order']=qs['sort'](_0x27d2a5[_0x65ae('0x31')]['sort']);_0x31bc44[_0x65ae('0x37')]=qs['filters'](_['pick'](_0x27d2a5['query'],_0x21f1e2['filters']),_0x4313da);if(_0x27d2a5[_0x65ae('0x31')][_0x65ae('0x38')]){_0x31bc44[_0x65ae('0x37')]=_[_0x65ae('0x39')](_0x31bc44[_0x65ae('0x37')],{'$or':_[_0x65ae('0x2b')](_0x4313da,function(_0x13e044){if(_0x13e044[_0x65ae('0x2e')]!==_0x65ae('0x3a')){var _0x47ad9c={};_0x47ad9c[_0x13e044[_0x65ae('0x29')]]={'$like':'%'+_0x27d2a5['query']['filter']+'%'};return _0x47ad9c;}})});}_0x31bc44=_[_0x65ae('0x39')]({},_0x31bc44,_0x27d2a5['options']);var _0x2f9f5a={'where':_0x31bc44[_0x65ae('0x37')]};return db[_0x65ae('0x3b')][_0x65ae('0x1c')](_0x2f9f5a)[_0x65ae('0x25')](function(_0x24fc2b){_0x1b19f5[_0x65ae('0x1c')]=_0x24fc2b;if(_0x27d2a5['query'][_0x65ae('0x3c')]){_0x31bc44['include']=[{'all':!![]}];}return db[_0x65ae('0x3b')][_0x65ae('0x3d')](_0x31bc44);})[_0x65ae('0x25')](function(_0x569c2f){_0x1b19f5[_0x65ae('0x3e')]=_0x569c2f;return _0x1b19f5;})['then'](respondWithFilteredResult(_0x5b6328,_0x31bc44))[_0x65ae('0x3f')](handleError(_0x5b6328,null));};exports['show']=function(_0x25b958,_0x55ffd2){var _0x2eef97={'raw':!![],'where':{'id':_0x25b958['params']['id']}},_0x4dfd29={};_0x4dfd29[_0x65ae('0x30')]=_[_0x65ae('0x40')](db[_0x65ae('0x3b')]['rawAttributes']);_0x4dfd29[_0x65ae('0x31')]=_[_0x65ae('0x40')](_0x25b958['query']);_0x4dfd29[_0x65ae('0x41')]=_[_0x65ae('0x32')](_0x4dfd29[_0x65ae('0x30')],_0x4dfd29[_0x65ae('0x31')]);_0x2eef97[_0x65ae('0x34')]=_[_0x65ae('0x32')](_0x4dfd29['model'],qs['fields'](_0x25b958[_0x65ae('0x31')][_0x65ae('0x33')]));_0x2eef97[_0x65ae('0x34')]=_0x2eef97['attributes']['length']?_0x2eef97['attributes']:_0x4dfd29[_0x65ae('0x30')];if(_0x25b958[_0x65ae('0x31')][_0x65ae('0x3c')]){_0x2eef97[_0x65ae('0x42')]=[{'all':!![]}];}_0x2eef97=_[_0x65ae('0x39')]({},_0x2eef97,_0x25b958[_0x65ae('0x43')]);return db[_0x65ae('0x3b')]['find'](_0x2eef97)['then'](handleEntityNotFound(_0x55ffd2,null))['then'](respondWithResult(_0x55ffd2,null))['catch'](handleError(_0x55ffd2,null));};exports['create']=function(_0x40ed8c,_0x376f8a){return db[_0x65ae('0x3b')][_0x65ae('0x44')](_0x40ed8c[_0x65ae('0x45')],{})[_0x65ae('0x25')](respondWithResult(_0x376f8a,0xc9))['catch'](handleError(_0x376f8a,null));};exports[_0x65ae('0x23')]=function(_0x32ffd2,_0x3fe19b){if(_0x32ffd2[_0x65ae('0x45')]['id']){delete _0x32ffd2[_0x65ae('0x45')]['id'];}return db[_0x65ae('0x3b')][_0x65ae('0x46')]({'where':{'id':_0x32ffd2[_0x65ae('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fe19b,null))[_0x65ae('0x25')](saveUpdates(_0x32ffd2[_0x65ae('0x45')],null))[_0x65ae('0x25')](respondWithResult(_0x3fe19b,null))['catch'](handleError(_0x3fe19b,null));};exports['destroy']=function(_0x366362,_0x1b241a){return db[_0x65ae('0x3b')][_0x65ae('0x46')]({'where':{'id':_0x366362[_0x65ae('0x47')]['id']}})[_0x65ae('0x25')](handleEntityNotFound(_0x1b241a,null))['then'](removeEntity(_0x1b241a,null))[_0x65ae('0x3f')](handleError(_0x1b241a,null));};exports['describe']=function(_0x1ce62c,_0x5626b2){return db[_0x65ae('0x3b')][_0x65ae('0x48')]()[_0x65ae('0x25')](respondWithResult(_0x5626b2,null))[_0x65ae('0x3f')](handleError(_0x5626b2,null));};exports[_0x65ae('0x49')]=function(_0x30e238,_0x31ed97,_0x31d17c){var _0x165911={'raw':!![],'where':{}};var _0x6de03b={};var _0x590d8d={'count':0x0,'rows':[]};return db[_0x65ae('0x3b')][_0x65ae('0x4a')]({'where':{'id':_0x30e238[_0x65ae('0x47')]['id']}})[_0x65ae('0x25')](handleEntityNotFound(_0x31ed97,null))[_0x65ae('0x25')](function(_0x5be732){if(_0x5be732){_0x6de03b['model']=_[_0x65ae('0x40')](db[_0x65ae('0x4b')][_0x65ae('0x2c')]);_0x6de03b['query']=_[_0x65ae('0x40')](_0x30e238[_0x65ae('0x31')]);_0x6de03b[_0x65ae('0x41')]=_['intersection'](_0x6de03b['model'],_0x6de03b[_0x65ae('0x31')]);_0x165911[_0x65ae('0x34')]=_[_0x65ae('0x32')](_0x6de03b[_0x65ae('0x30')],qs[_0x65ae('0x33')](_0x30e238[_0x65ae('0x31')][_0x65ae('0x33')]));_0x165911[_0x65ae('0x34')]=_0x165911[_0x65ae('0x34')][_0x65ae('0x4c')]?_0x165911[_0x65ae('0x34')]:_0x6de03b[_0x65ae('0x30')];if(!_0x30e238['query'][_0x65ae('0x4d')](_0x65ae('0x35'))){_0x165911['limit']=qs['limit'](_0x30e238[_0x65ae('0x31')][_0x65ae('0x36')]);_0x165911[_0x65ae('0x1d')]=qs['offset'](_0x30e238['query'][_0x65ae('0x1d')]);}_0x165911[_0x65ae('0x4e')]=qs[_0x65ae('0x4f')](_0x30e238[_0x65ae('0x31')]['sort']);_0x165911[_0x65ae('0x37')]=qs['filters'](_['pick'](_0x30e238[_0x65ae('0x31')],_0x6de03b['filters']));_0x165911[_0x65ae('0x37')]['SessionId']=_0x5be732['id'];if(_0x30e238[_0x65ae('0x31')][_0x65ae('0x38')]){_0x165911[_0x65ae('0x37')]=_['merge'](_0x165911[_0x65ae('0x37')],{'$or':_[_0x65ae('0x2b')](_0x165911[_0x65ae('0x34')],function(_0x1b4cae){var _0x1fc845={};_0x1fc845[_0x1b4cae]={'$like':'%'+_0x30e238[_0x65ae('0x31')][_0x65ae('0x38')]+'%'};return _0x1fc845;})});}_0x165911=_[_0x65ae('0x39')]({},_0x165911,_0x30e238['options']);return db[_0x65ae('0x4b')][_0x65ae('0x1c')]({'where':_0x165911['where']})['then'](function(_0x4f8f0d){_0x590d8d[_0x65ae('0x1c')]=_0x4f8f0d;if(_0x30e238[_0x65ae('0x31')][_0x65ae('0x3c')]){_0x165911[_0x65ae('0x42')]=[{'all':!![]}];}return db[_0x65ae('0x4b')][_0x65ae('0x3d')](_0x165911);})[_0x65ae('0x25')](function(_0x596cba){_0x590d8d[_0x65ae('0x3e')]=_0x596cba;return _0x590d8d;});}})[_0x65ae('0x25')](respondWithFilteredResult(_0x31ed97,_0x165911))[_0x65ae('0x3f')](handleError(_0x31ed97,null));}; \ No newline at end of file +var _0xb2e6=['fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','JscriptySessionReport','findAll','rows','catch','show','params','keys','create','body','find','describe','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir'];(function(_0x4fb0e7,_0x80e2e0){var _0x12649d=function(_0x36237e){while(--_0x36237e){_0x4fb0e7['push'](_0x4fb0e7['shift']());}};_0x12649d(++_0x80e2e0);}(_0xb2e6,0x1e9));var _0x6b2e=function(_0x1c4b3e,_0x4956bf){_0x1c4b3e=_0x1c4b3e-0x0;var _0x47392b=_0xb2e6[_0x1c4b3e];return _0x47392b;};'use strict';var emlformat=require(_0x6b2e('0x0'));var rimraf=require(_0x6b2e('0x1'));var zipdir=require(_0x6b2e('0x2'));var jsonpatch=require(_0x6b2e('0x3'));var rp=require(_0x6b2e('0x4'));var moment=require(_0x6b2e('0x5'));var BPromise=require(_0x6b2e('0x6'));var Mustache=require('mustache');var util=require(_0x6b2e('0x7'));var path=require('path');var sox=require(_0x6b2e('0x8'));var csv=require(_0x6b2e('0x9'));var ejs=require(_0x6b2e('0xa'));var fs=require('fs');var fs_extra=require(_0x6b2e('0xb'));var _=require('lodash');var squel=require(_0x6b2e('0xc'));var crypto=require(_0x6b2e('0xd'));var jsforce=require(_0x6b2e('0xe'));var deskjs=require(_0x6b2e('0xf'));var toCsv=require(_0x6b2e('0x9'));var querystring=require(_0x6b2e('0x10'));var Papa=require('papaparse');var Redis=require(_0x6b2e('0x11'));var authService=require(_0x6b2e('0x12'));var qs=require(_0x6b2e('0x13'));var as=require(_0x6b2e('0x14'));var hardwareService=require(_0x6b2e('0x15'));var logger=require(_0x6b2e('0x16'))('api');var utils=require(_0x6b2e('0x17'));var config=require(_0x6b2e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b2e('0x19'))['db'];function respondWithStatusCode(_0xe77c93,_0x2d83d8){_0x2d83d8=_0x2d83d8||0xcc;return function(_0x3486ea){if(_0x3486ea){return _0xe77c93[_0x6b2e('0x1a')](_0x2d83d8);}return _0xe77c93['status'](_0x2d83d8)['end']();};}function respondWithResult(_0x2f6d13,_0x180784){_0x180784=_0x180784||0xc8;return function(_0x8b2e72){if(_0x8b2e72){return _0x2f6d13[_0x6b2e('0x1b')](_0x180784)[_0x6b2e('0x1c')](_0x8b2e72);}};}function respondWithFilteredResult(_0x482822,_0x4ef12e){return function(_0x306561){if(_0x306561){var _0x564c=typeof _0x4ef12e[_0x6b2e('0x1d')]==='undefined'&&typeof _0x4ef12e[_0x6b2e('0x1e')]===_0x6b2e('0x1f');var _0x3ce9cc=_0x306561[_0x6b2e('0x20')];var _0x59cade=_0x564c?0x0:_0x4ef12e['offset'];var _0x590d14=_0x564c?_0x306561[_0x6b2e('0x20')]:_0x4ef12e[_0x6b2e('0x1d')]+_0x4ef12e[_0x6b2e('0x1e')];var _0x129a34;if(_0x590d14>=_0x3ce9cc){_0x590d14=_0x3ce9cc;_0x129a34=0xc8;}else{_0x129a34=0xce;}_0x482822[_0x6b2e('0x1b')](_0x129a34);return _0x482822['set'](_0x6b2e('0x21'),_0x59cade+'-'+_0x590d14+'/'+_0x3ce9cc)['json'](_0x306561);}return null;};}function patchUpdates(_0x1e9517){return function(_0x5ca96b){try{jsonpatch[_0x6b2e('0x22')](_0x5ca96b,_0x1e9517,!![]);}catch(_0x21199e){return BPromise[_0x6b2e('0x23')](_0x21199e);}return _0x5ca96b[_0x6b2e('0x24')]();};}function saveUpdates(_0x29516d,_0x22831f){return function(_0x32aa8e){if(_0x32aa8e){return _0x32aa8e[_0x6b2e('0x25')](_0x29516d)[_0x6b2e('0x26')](function(_0x48a426){return _0x48a426;});}return null;};}function removeEntity(_0xcf5ce4,_0x1e7e22){return function(_0x61d982){if(_0x61d982){return _0x61d982[_0x6b2e('0x27')]()[_0x6b2e('0x26')](function(){_0xcf5ce4['status'](0xcc)[_0x6b2e('0x28')]();});}};}function handleEntityNotFound(_0x245184,_0x179ee3){return function(_0x174310){if(!_0x174310){_0x245184[_0x6b2e('0x1a')](0x194);}return _0x174310;};}function handleError(_0x389e6e,_0x4a6317){_0x4a6317=_0x4a6317||0x1f4;return function(_0x2aee54){logger[_0x6b2e('0x29')](_0x2aee54[_0x6b2e('0x2a')]);if(_0x2aee54['name']){delete _0x2aee54['name'];}_0x389e6e[_0x6b2e('0x1b')](_0x4a6317)[_0x6b2e('0x2b')](_0x2aee54);};}exports[_0x6b2e('0x2c')]=function(_0x47a9f7,_0x2fe474){var _0x241560={},_0x1b6f4f={},_0x4687f1={'count':0x0,'rows':[]};var _0x504adf=_['map'](db['JscriptySessionReport'][_0x6b2e('0x2d')],function(_0x22bae6){return{'name':_0x22bae6[_0x6b2e('0x2e')],'type':_0x22bae6[_0x6b2e('0x2f')][_0x6b2e('0x30')]};});_0x1b6f4f[_0x6b2e('0x31')]=_['map'](_0x504adf,_0x6b2e('0x32'));_0x1b6f4f[_0x6b2e('0x33')]=_['keys'](_0x47a9f7['query']);_0x1b6f4f['filters']=_[_0x6b2e('0x34')](_0x1b6f4f[_0x6b2e('0x31')],_0x1b6f4f[_0x6b2e('0x33')]);_0x241560[_0x6b2e('0x35')]=_['intersection'](_0x1b6f4f[_0x6b2e('0x31')],qs['fields'](_0x47a9f7['query'][_0x6b2e('0x36')]));_0x241560[_0x6b2e('0x35')]=_0x241560[_0x6b2e('0x35')][_0x6b2e('0x37')]?_0x241560[_0x6b2e('0x35')]:_0x1b6f4f[_0x6b2e('0x31')];if(!_0x47a9f7[_0x6b2e('0x33')][_0x6b2e('0x38')](_0x6b2e('0x39'))){_0x241560[_0x6b2e('0x1e')]=qs[_0x6b2e('0x1e')](_0x47a9f7['query'][_0x6b2e('0x1e')]);_0x241560['offset']=qs[_0x6b2e('0x1d')](_0x47a9f7['query'][_0x6b2e('0x1d')]);}_0x241560[_0x6b2e('0x3a')]=qs[_0x6b2e('0x3b')](_0x47a9f7['query'][_0x6b2e('0x3b')]);_0x241560[_0x6b2e('0x3c')]=qs[_0x6b2e('0x3d')](_[_0x6b2e('0x3e')](_0x47a9f7['query'],_0x1b6f4f[_0x6b2e('0x3d')]),_0x504adf);if(_0x47a9f7[_0x6b2e('0x33')][_0x6b2e('0x3f')]){_0x241560[_0x6b2e('0x3c')]=_[_0x6b2e('0x40')](_0x241560['where'],{'$or':_[_0x6b2e('0x41')](_0x504adf,function(_0x4861f1){if(_0x4861f1['type']!=='VIRTUAL'){var _0x26f358={};_0x26f358[_0x4861f1[_0x6b2e('0x32')]]={'$like':'%'+_0x47a9f7['query'][_0x6b2e('0x3f')]+'%'};return _0x26f358;}})});}_0x241560=_[_0x6b2e('0x40')]({},_0x241560,_0x47a9f7[_0x6b2e('0x42')]);var _0x4d2500={'where':_0x241560[_0x6b2e('0x3c')]};return db['JscriptySessionReport'][_0x6b2e('0x20')](_0x4d2500)[_0x6b2e('0x26')](function(_0x5d1f9a){_0x4687f1[_0x6b2e('0x20')]=_0x5d1f9a;if(_0x47a9f7[_0x6b2e('0x33')][_0x6b2e('0x43')]){_0x241560[_0x6b2e('0x44')]=[{'all':!![]}];}return db[_0x6b2e('0x45')][_0x6b2e('0x46')](_0x241560);})[_0x6b2e('0x26')](function(_0x1770a8){_0x4687f1[_0x6b2e('0x47')]=_0x1770a8;return _0x4687f1;})[_0x6b2e('0x26')](respondWithFilteredResult(_0x2fe474,_0x241560))[_0x6b2e('0x48')](handleError(_0x2fe474,null));};exports[_0x6b2e('0x49')]=function(_0x14e494,_0x5f4b41){var _0x3ba0ff={'raw':!![],'where':{'id':_0x14e494[_0x6b2e('0x4a')]['id']}},_0x481b95={};_0x481b95['model']=_[_0x6b2e('0x4b')](db[_0x6b2e('0x45')][_0x6b2e('0x2d')]);_0x481b95[_0x6b2e('0x33')]=_[_0x6b2e('0x4b')](_0x14e494[_0x6b2e('0x33')]);_0x481b95['filters']=_[_0x6b2e('0x34')](_0x481b95[_0x6b2e('0x31')],_0x481b95[_0x6b2e('0x33')]);_0x3ba0ff[_0x6b2e('0x35')]=_['intersection'](_0x481b95['model'],qs[_0x6b2e('0x36')](_0x14e494['query'][_0x6b2e('0x36')]));_0x3ba0ff['attributes']=_0x3ba0ff[_0x6b2e('0x35')][_0x6b2e('0x37')]?_0x3ba0ff[_0x6b2e('0x35')]:_0x481b95['model'];if(_0x14e494[_0x6b2e('0x33')][_0x6b2e('0x43')]){_0x3ba0ff[_0x6b2e('0x44')]=[{'all':!![]}];}_0x3ba0ff=_[_0x6b2e('0x40')]({},_0x3ba0ff,_0x14e494[_0x6b2e('0x42')]);return db[_0x6b2e('0x45')]['find'](_0x3ba0ff)['then'](handleEntityNotFound(_0x5f4b41,null))[_0x6b2e('0x26')](respondWithResult(_0x5f4b41,null))[_0x6b2e('0x48')](handleError(_0x5f4b41,null));};exports[_0x6b2e('0x4c')]=function(_0x4768c4,_0x15be5b){return db[_0x6b2e('0x45')]['create'](_0x4768c4[_0x6b2e('0x4d')],{})[_0x6b2e('0x26')](respondWithResult(_0x15be5b,0xc9))[_0x6b2e('0x48')](handleError(_0x15be5b,null));};exports[_0x6b2e('0x25')]=function(_0x26952b,_0x2c7e80){if(_0x26952b[_0x6b2e('0x4d')]['id']){delete _0x26952b[_0x6b2e('0x4d')]['id'];}return db[_0x6b2e('0x45')][_0x6b2e('0x4e')]({'where':{'id':_0x26952b['params']['id']}})[_0x6b2e('0x26')](handleEntityNotFound(_0x2c7e80,null))[_0x6b2e('0x26')](saveUpdates(_0x26952b[_0x6b2e('0x4d')],null))[_0x6b2e('0x26')](respondWithResult(_0x2c7e80,null))[_0x6b2e('0x48')](handleError(_0x2c7e80,null));};exports[_0x6b2e('0x27')]=function(_0x456adf,_0x167c51){return db[_0x6b2e('0x45')][_0x6b2e('0x4e')]({'where':{'id':_0x456adf['params']['id']}})[_0x6b2e('0x26')](handleEntityNotFound(_0x167c51,null))[_0x6b2e('0x26')](removeEntity(_0x167c51,null))[_0x6b2e('0x48')](handleError(_0x167c51,null));};exports[_0x6b2e('0x4f')]=function(_0xb1d8d9,_0x14a4cd){return db[_0x6b2e('0x45')][_0x6b2e('0x4f')]()[_0x6b2e('0x26')](respondWithResult(_0x14a4cd,null))[_0x6b2e('0x48')](handleError(_0x14a4cd,null));};exports['getQuestions']=function(_0x356fa7,_0x314491,_0x5e705d){var _0x19cc96={'raw':!![],'where':{}};var _0x46f810={};var _0x3e254e={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x6b2e('0x50')]({'where':{'id':_0x356fa7['params']['id']}})['then'](handleEntityNotFound(_0x314491,null))['then'](function(_0x3e2476){if(_0x3e2476){_0x46f810[_0x6b2e('0x31')]=_[_0x6b2e('0x4b')](db['JscriptyQuestionReport']['rawAttributes']);_0x46f810[_0x6b2e('0x33')]=_[_0x6b2e('0x4b')](_0x356fa7[_0x6b2e('0x33')]);_0x46f810[_0x6b2e('0x3d')]=_['intersection'](_0x46f810[_0x6b2e('0x31')],_0x46f810[_0x6b2e('0x33')]);_0x19cc96[_0x6b2e('0x35')]=_[_0x6b2e('0x34')](_0x46f810[_0x6b2e('0x31')],qs[_0x6b2e('0x36')](_0x356fa7[_0x6b2e('0x33')][_0x6b2e('0x36')]));_0x19cc96[_0x6b2e('0x35')]=_0x19cc96[_0x6b2e('0x35')][_0x6b2e('0x37')]?_0x19cc96[_0x6b2e('0x35')]:_0x46f810[_0x6b2e('0x31')];if(!_0x356fa7[_0x6b2e('0x33')][_0x6b2e('0x38')](_0x6b2e('0x39'))){_0x19cc96[_0x6b2e('0x1e')]=qs[_0x6b2e('0x1e')](_0x356fa7[_0x6b2e('0x33')][_0x6b2e('0x1e')]);_0x19cc96[_0x6b2e('0x1d')]=qs['offset'](_0x356fa7['query'][_0x6b2e('0x1d')]);}_0x19cc96['order']=qs[_0x6b2e('0x3b')](_0x356fa7[_0x6b2e('0x33')][_0x6b2e('0x3b')]);_0x19cc96[_0x6b2e('0x3c')]=qs[_0x6b2e('0x3d')](_[_0x6b2e('0x3e')](_0x356fa7[_0x6b2e('0x33')],_0x46f810[_0x6b2e('0x3d')]));_0x19cc96['where']['SessionId']=_0x3e2476['id'];if(_0x356fa7[_0x6b2e('0x33')][_0x6b2e('0x3f')]){_0x19cc96[_0x6b2e('0x3c')]=_['merge'](_0x19cc96[_0x6b2e('0x3c')],{'$or':_['map'](_0x19cc96[_0x6b2e('0x35')],function(_0x624e57){var _0x39f1fc={};_0x39f1fc[_0x624e57]={'$like':'%'+_0x356fa7[_0x6b2e('0x33')][_0x6b2e('0x3f')]+'%'};return _0x39f1fc;})});}_0x19cc96=_[_0x6b2e('0x40')]({},_0x19cc96,_0x356fa7[_0x6b2e('0x42')]);return db['JscriptyQuestionReport']['count']({'where':_0x19cc96[_0x6b2e('0x3c')]})[_0x6b2e('0x26')](function(_0x2c738a){_0x3e254e[_0x6b2e('0x20')]=_0x2c738a;if(_0x356fa7[_0x6b2e('0x33')][_0x6b2e('0x43')]){_0x19cc96[_0x6b2e('0x44')]=[{'all':!![]}];}return db[_0x6b2e('0x51')]['findAll'](_0x19cc96);})['then'](function(_0x860fa4){_0x3e254e[_0x6b2e('0x47')]=_0x860fa4;return _0x3e254e;});}})[_0x6b2e('0x26')](respondWithFilteredResult(_0x314491,_0x19cc96))[_0x6b2e('0x48')](handleError(_0x314491,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 3cfba76..d5538b3 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 _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x1c1b9b,_0x548b29){_0x1c1b9b=_0x1c1b9b-0x0;var _0x507408=_0x0f4d[_0x1c1b9b];return _0x507408;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x40edb7,_0x166c16){var _0x2c38c4=function(_0x35effc){while(--_0x35effc){_0x40edb7['push'](_0x40edb7['shift']());}};_0x2c38c4(++_0x166c16);}(_0x187d,0x93));var _0xd187=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x187d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 33997d4..4ecf70c 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 _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x526074,_0x5e5d09){var _0x83c6c8=function(_0x571483){while(--_0x571483){_0x526074['push'](_0x526074['shift']());}};_0x83c6c8(++_0x5e5d09);}(_0x4888,0x198));var _0x8488=function(_0x2d6334,_0x442f22){_0x2d6334=_0x2d6334-0x0;var _0x2ff29d=_0x4888[_0x2d6334];return _0x2ff29d;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file +var _0x3e24=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0x3e24,0x167));var _0x43e2=function(_0x5a7282,_0xa6e195){_0x5a7282=_0x5a7282-0x0;var _0x4928ec=_0x3e24[_0x5a7282];return _0x4928ec;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f118f60..9c1b14b 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 _0xed5f=['get','index','/:id','isAuthenticated','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller'];(function(_0x3b6195,_0x2b54ee){var _0x252952=function(_0x4dd65c){while(--_0x4dd65c){_0x3b6195['push'](_0x3b6195['shift']());}};_0x252952(++_0x2b54ee);}(_0xed5f,0x1e6));var _0xfed5=function(_0x267ad7,_0x533578){_0x267ad7=_0x267ad7-0x0;var _0x4c659a=_0xed5f[_0x267ad7];return _0x4c659a;};'use strict';var multer=require('multer');var util=require(_0xfed5('0x0'));var path=require(_0xfed5('0x1'));var timeout=require(_0xfed5('0x2'));var express=require('express');var router=express[_0xfed5('0x3')]();var fs_extra=require(_0xfed5('0x4'));var auth=require(_0xfed5('0x5'));var interaction=require(_0xfed5('0x6'));var config=require('../../config/environment');var controller=require(_0xfed5('0x7'));router[_0xfed5('0x8')]('/',controller[_0xfed5('0x9')]);router['put'](_0xfed5('0xa'),auth[_0xfed5('0xb')](),controller['update']);module[_0xfed5('0xc')]=router; \ No newline at end of file +var _0x556b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express'];(function(_0x51144c,_0x137f69){var _0x22b259=function(_0x346686){while(--_0x346686){_0x51144c['push'](_0x51144c['shift']());}};_0x22b259(++_0x137f69);}(_0x556b,0x1d7));var _0xb556=function(_0x3aac5c,_0x5f4b66){_0x3aac5c=_0x3aac5c-0x0;var _0x37f4ad=_0x556b[_0x3aac5c];return _0x37f4ad;};'use strict';var multer=require(_0xb556('0x0'));var util=require(_0xb556('0x1'));var path=require(_0xb556('0x2'));var timeout=require(_0xb556('0x3'));var express=require(_0xb556('0x4'));var router=express['Router']();var fs_extra=require(_0xb556('0x5'));var auth=require(_0xb556('0x6'));var interaction=require(_0xb556('0x7'));var config=require(_0xb556('0x8'));var controller=require(_0xb556('0x9'));router['get']('/',controller['index']);router['put'](_0xb556('0xa'),auth[_0xb556('0xb')](),controller[_0xb556('0xc')]);module[_0xb556('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index dc66118..5581cac 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 _0x2950=['STRING','exports','TEXT'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x2950,0x118));var _0x0295=function(_0xb4ea3d,_0x20c92b){_0xb4ea3d=_0xb4ea3d-0x0;var _0x4c3440=_0x2950[_0xb4ea3d];return _0x4c3440;};'use strict';var Sequelize=require('sequelize');module[_0x0295('0x0')]={'license':{'type':Sequelize[_0x0295('0x1')]},'data1':{'type':Sequelize[_0x0295('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x050c=['STRING','sequelize','exports','TEXT'];(function(_0x5351ff,_0x382ef7){var _0x255428=function(_0x403692){while(--_0x403692){_0x5351ff['push'](_0x5351ff['shift']());}};_0x255428(++_0x382ef7);}(_0x050c,0x15d));var _0xc050=function(_0x19ce50,_0x532835){_0x19ce50=_0x19ce50-0x0;var _0x3b4327=_0x050c[_0x19ce50];return _0x3b4327;};'use strict';var Sequelize=require(_0xc050('0x0'));module[_0xc050('0x1')]={'license':{'type':Sequelize[_0xc050('0x2')]},'data1':{'type':Sequelize[_0xc050('0x3')]},'data2':{'type':Sequelize[_0xc050('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 ad662da..c348fac 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 _0xc4aa=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc4aa[_0x465a0c];return _0x1e202e;};'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);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file +var _0x1261=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','index','model','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','params','get','key','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x29c7a5,_0x5e29f8){var _0x2b231c=function(_0x422925){while(--_0x422925){_0x29c7a5['push'](_0x29c7a5['shift']());}};_0x2b231c(++_0x5e29f8);}(_0x1261,0x144));var _0x1126=function(_0x432af8,_0x477b3d){_0x432af8=_0x432af8-0x0;var _0x228f4f=_0x1261[_0x432af8];return _0x228f4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}var utilLicense=require('../../config/license/util');exports[_0x1126('0x29')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={'raw':!![],'where':{'id':0x1}},_0x4bf807={};_0x4bf807[_0x1126('0x2a')]=_['keys'](db[_0x1126('0x2b')]['rawAttributes']);_0x4bf807[_0x1126('0x2c')]=_['keys'](_0x23d2bc['query']);_0x4bf807['filters']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],_0x4bf807[_0x1126('0x2c')]);_0x3fa694['attributes']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],qs['fields'](_0x23d2bc[_0x1126('0x2c')][_0x1126('0x2e')]));_0x3fa694[_0x1126('0x2f')]=_0x3fa694[_0x1126('0x2f')]['length']?_0x3fa694['attributes']:_0x4bf807[_0x1126('0x2a')];_0x3fa694=_[_0x1126('0x30')]({},_0x3fa694,_0x23d2bc[_0x1126('0x31')]);return utilLicense[_0x1126('0x32')](_0x3fa694)['then'](respondWithResult(_0x4a334a,null))[_0x1126('0x33')](handleError(_0x4a334a,null));};exports[_0x1126('0x24')]=function(_0x313ebe,_0x22436c){if(_0x313ebe[_0x1126('0x34')]['id']){delete _0x313ebe['body']['id'];}return db[_0x1126('0x2b')][_0x1126('0x35')]({'where':{'id':_0x313ebe[_0x1126('0x36')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x22436c,null))['then'](function(_0x4ca51c){var _0x22827a=_0x4ca51c[_0x1126('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x22827a,_0x313ebe[_0x1126('0x34')][_0x1126('0x38')]);})[_0x1126('0x25')](function(_0x5c08b9){if(!_0x5c08b9['demo']){return saveUpdates(_0x313ebe[_0x1126('0x34')],null);}return _0x5c08b9;})[_0x1126('0x25')](respondWithResult(_0x22436c,null))[_0x1126('0x33')](handleError(_0x22436c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d2b107c..24ec15e 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 _0x6e95=['define','License','license','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./license.attributes','exports'];(function(_0x243f71,_0x47491b){var _0x5b6dfd=function(_0x19a0c8){while(--_0x19a0c8){_0x243f71['push'](_0x243f71['shift']());}};_0x5b6dfd(++_0x47491b);}(_0x6e95,0xf5));var _0x56e9=function(_0x2d67b4,_0x4ca8fe){_0x2d67b4=_0x2d67b4-0x0;var _0x4cd582=_0x6e95[_0x2d67b4];return _0x4cd582;};'use strict';var _=require('lodash');var util=require(_0x56e9('0x0'));var logger=require(_0x56e9('0x1'))(_0x56e9('0x2'));var moment=require('moment');var BPromise=require(_0x56e9('0x3'));var rp=require(_0x56e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56e9('0x5'));var attributes=require(_0x56e9('0x6'));module[_0x56e9('0x7')]=function(_0xe11141,_0x6149fd){return _0xe11141[_0x56e9('0x8')](_0x56e9('0x9'),attributes,{'tableName':_0x56e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fc2=['License','license','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x328cdc,_0xe9775){var _0x17eea7=function(_0x7a872f){while(--_0x7a872f){_0x328cdc['push'](_0x328cdc['shift']());}};_0x17eea7(++_0xe9775);}(_0x0fc2,0x14c));var _0x20fc=function(_0x3c1b82,_0x19d766){_0x3c1b82=_0x3c1b82-0x0;var _0xdf858a=_0x0fc2[_0x3c1b82];return _0xdf858a;};'use strict';var _=require(_0x20fc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x20fc('0x1'));var BPromise=require(_0x20fc('0x2'));var rp=require(_0x20fc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20fc('0x4'));var config=require(_0x20fc('0x5'));var attributes=require(_0x20fc('0x6'));module[_0x20fc('0x7')]=function(_0x59a51d,_0x15f9cd){return _0x59a51d['define'](_0x20fc('0x8'),attributes,{'tableName':_0x20fc('0x9'),'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 bdcec93..d23c79d 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 _0xd9bd=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xd9bd,0x1e5));var _0xdd9b=function(_0x3045dd,_0x3de00d){_0x3045dd=_0x3045dd-0x0;var _0x39f13c=_0xd9bd[_0x3045dd];return _0x39f13c;};'use strict';var _=require(_0xdd9b('0x0'));var util=require(_0xdd9b('0x1'));var moment=require(_0xdd9b('0x2'));var BPromise=require(_0xdd9b('0x3'));var rs=require(_0xdd9b('0x4'));var fs=require('fs');var Redis=require(_0xdd9b('0x5'));var db=require(_0xdd9b('0x6'))['db'];var utils=require(_0xdd9b('0x7'));var logger=require(_0xdd9b('0x8'))(_0xdd9b('0x9'));var config=require('../../config/environment');var jayson=require(_0xdd9b('0xa'));var client=jayson[_0xdd9b('0xb')][_0xdd9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4807d5,_0x34de9e,_0x3953d1){return new BPromise(function(_0x28d9db,_0x53297f){return client[_0xdd9b('0xd')](_0x4807d5,_0x3953d1)[_0xdd9b('0xe')](function(_0x13e1de){logger[_0xdd9b('0xf')](_0xdd9b('0x10'),_0x34de9e,'request\x20sent');logger['debug'](_0xdd9b('0x11'),_0x34de9e,_0xdd9b('0x12'),JSON[_0xdd9b('0x13')](_0x13e1de));if(_0x13e1de['error']){if(_0x13e1de[_0xdd9b('0x14')][_0xdd9b('0x15')]===0x1f4){logger[_0xdd9b('0x14')](_0xdd9b('0x10'),_0x34de9e,_0x13e1de[_0xdd9b('0x14')][_0xdd9b('0x16')]);return _0x53297f(_0x13e1de[_0xdd9b('0x14')]['message']);}logger[_0xdd9b('0x14')](_0xdd9b('0x10'),_0x34de9e,_0x13e1de[_0xdd9b('0x14')][_0xdd9b('0x16')]);return _0x28d9db(_0x13e1de[_0xdd9b('0x14')][_0xdd9b('0x16')]);}else{logger[_0xdd9b('0xf')](_0xdd9b('0x10'),_0x34de9e,_0xdd9b('0x12'));_0x28d9db(_0x13e1de['result'][_0xdd9b('0x16')]);}})[_0xdd9b('0x17')](function(_0x20d4a4){logger[_0xdd9b('0x14')](_0xdd9b('0x10'),_0x34de9e,_0x20d4a4);_0x53297f(_0x20d4a4);});});} \ No newline at end of file +var _0x5f67=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x5f67,0x163));var _0x75f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x75f6('0x0'));var util=require(_0x75f6('0x1'));var moment=require(_0x75f6('0x2'));var BPromise=require(_0x75f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75f6('0x4'));var db=require(_0x75f6('0x5'))['db'];var utils=require(_0x75f6('0x6'));var logger=require('../../config/logger')(_0x75f6('0x7'));var config=require(_0x75f6('0x8'));var jayson=require(_0x75f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x307c2e,_0x3d8bb1,_0x56c411){return new BPromise(function(_0x3a3c8c,_0x229e1b){return client[_0x75f6('0xa')](_0x307c2e,_0x56c411)[_0x75f6('0xb')](function(_0x3465fc){logger[_0x75f6('0xc')](_0x75f6('0xd'),_0x3d8bb1,_0x75f6('0xe'));logger[_0x75f6('0xf')](_0x75f6('0x10'),_0x3d8bb1,'request\x20sent',JSON['stringify'](_0x3465fc));if(_0x3465fc[_0x75f6('0x11')]){if(_0x3465fc[_0x75f6('0x11')][_0x75f6('0x12')]===0x1f4){logger[_0x75f6('0x11')](_0x75f6('0xd'),_0x3d8bb1,_0x3465fc[_0x75f6('0x11')][_0x75f6('0x13')]);return _0x229e1b(_0x3465fc[_0x75f6('0x11')]['message']);}logger[_0x75f6('0x11')](_0x75f6('0xd'),_0x3d8bb1,_0x3465fc[_0x75f6('0x11')][_0x75f6('0x13')]);return _0x3a3c8c(_0x3465fc[_0x75f6('0x11')][_0x75f6('0x13')]);}else{logger['info'](_0x75f6('0xd'),_0x3d8bb1,_0x75f6('0xe'));_0x3a3c8c(_0x3465fc[_0x75f6('0x14')][_0x75f6('0x13')]);}})[_0x75f6('0x15')](function(_0x2fd29f){logger[_0x75f6('0x11')](_0x75f6('0xd'),_0x3d8bb1,_0x2fd29f);_0x229e1b(_0x2fd29f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 38d867c..0f53f56 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 _0xc3cb=['destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id'];(function(_0x2ad119,_0x32e4ea){var _0x5eeb83=function(_0x534605){while(--_0x534605){_0x2ad119['push'](_0x2ad119['shift']());}};_0x5eeb83(++_0x32e4ea);}(_0xc3cb,0x1d7));var _0xbc3c=function(_0x488b9d,_0x17fbf5){_0x488b9d=_0x488b9d-0x0;var _0x3204c4=_0xc3cb[_0x488b9d];return _0x3204c4;};'use strict';var multer=require(_0xbc3c('0x0'));var util=require(_0xbc3c('0x1'));var path=require(_0xbc3c('0x2'));var timeout=require(_0xbc3c('0x3'));var express=require(_0xbc3c('0x4'));var router=express[_0xbc3c('0x5')]();var fs_extra=require(_0xbc3c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbc3c('0x7'));var config=require(_0xbc3c('0x8'));var controller=require(_0xbc3c('0x9'));router[_0xbc3c('0xa')]('/',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0xc')]);router[_0xbc3c('0xa')]('/describe',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0xd')]);router[_0xbc3c('0xa')]('/:id',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0xe')]);router[_0xbc3c('0xa')](_0xbc3c('0xf'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x10')]);router['get'](_0xbc3c('0x11'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x12')]);router[_0xbc3c('0xa')]('/:id/in_servers',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x13')]);router['get']('/:id/out_servers',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x14')]);router['get'](_0xbc3c('0x15'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x16')]);router[_0xbc3c('0xa')](_0xbc3c('0x17'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x18')]);router[_0xbc3c('0xa')]('/:id/messages',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x19')]);router[_0xbc3c('0xa')](_0xbc3c('0x1a'),auth[_0xbc3c('0xb')](),controller['verifySmtp']);router[_0xbc3c('0xa')]('/:id/users',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x1b')]);router[_0xbc3c('0x1c')]('/:id/dispositions',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x1d')]);router[_0xbc3c('0x1c')](_0xbc3c('0x11'),auth['isAuthenticated'](),controller[_0xbc3c('0x1e')]);router[_0xbc3c('0x1c')]('/',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x1f')]);router['post'](_0xbc3c('0x20'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x21')]);router[_0xbc3c('0x1c')]('/:id/out_servers',auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x22')]);router[_0xbc3c('0x1c')](_0xbc3c('0x15'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x23')]);router['post'](_0xbc3c('0x17'),auth['isAuthenticated'](),controller[_0xbc3c('0x24')]);router[_0xbc3c('0x1c')](_0xbc3c('0x25'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x26')]);router[_0xbc3c('0x1c')](_0xbc3c('0x27'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x28')]);router[_0xbc3c('0x29')]('/:id',auth['isAuthenticated'](),controller[_0xbc3c('0x2a')]);router[_0xbc3c('0x2b')](_0xbc3c('0xf'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x2c')]);router[_0xbc3c('0x2b')](_0xbc3c('0x11'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x2d')]);router[_0xbc3c('0x2b')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xbc3c('0x2e')]);router[_0xbc3c('0x2b')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xbc3c('0x2f')]);router[_0xbc3c('0x2b')](_0xbc3c('0x30'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x31')]);router[_0xbc3c('0x2b')](_0xbc3c('0x27'),auth[_0xbc3c('0xb')](),controller[_0xbc3c('0x32')]);module[_0xbc3c('0x33')]=router; \ No newline at end of file +var _0xc070=['express','Router','fs-extra','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','addInteraction','addApplications','send','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout'];(function(_0x3b56ff,_0x14cf4e){var _0x4d80be=function(_0x4ba99b){while(--_0x4ba99b){_0x3b56ff['push'](_0x3b56ff['shift']());}};_0x4d80be(++_0x14cf4e);}(_0xc070,0xd9));var _0x0c07=function(_0x16f81d,_0x173756){_0x16f81d=_0x16f81d-0x0;var _0x3697eb=_0xc070[_0x16f81d];return _0x3697eb;};'use strict';var multer=require(_0x0c07('0x0'));var util=require(_0x0c07('0x1'));var path=require('path');var timeout=require(_0x0c07('0x2'));var express=require(_0x0c07('0x3'));var router=express[_0x0c07('0x4')]();var fs_extra=require(_0x0c07('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0c07('0x6'));router[_0x0c07('0x7')]('/',auth['isAuthenticated'](),controller[_0x0c07('0x8')]);router['get'](_0x0c07('0x9'),auth[_0x0c07('0xa')](),controller[_0x0c07('0xb')]);router['get'](_0x0c07('0xc'),auth[_0x0c07('0xa')](),controller[_0x0c07('0xd')]);router['get'](_0x0c07('0xe'),auth[_0x0c07('0xa')](),controller[_0x0c07('0xf')]);router[_0x0c07('0x7')](_0x0c07('0x10'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x11')]);router[_0x0c07('0x7')](_0x0c07('0x12'),auth['isAuthenticated'](),controller[_0x0c07('0x13')]);router[_0x0c07('0x7')](_0x0c07('0x14'),auth[_0x0c07('0xa')](),controller['getSmtp']);router[_0x0c07('0x7')](_0x0c07('0x15'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x16')]);router[_0x0c07('0x7')](_0x0c07('0x17'),auth[_0x0c07('0xa')](),controller['getApplications']);router[_0x0c07('0x7')](_0x0c07('0x18'),auth[_0x0c07('0xa')](),controller['getMessages']);router[_0x0c07('0x7')](_0x0c07('0x19'),auth[_0x0c07('0xa')](),controller['verifySmtp']);router[_0x0c07('0x7')](_0x0c07('0x1a'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x1b')]);router[_0x0c07('0x1c')](_0x0c07('0xe'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x1d')]);router[_0x0c07('0x1c')]('/:id/canned_answers',auth[_0x0c07('0xa')](),controller[_0x0c07('0x1e')]);router[_0x0c07('0x1c')]('/',auth['isAuthenticated'](),controller[_0x0c07('0x1f')]);router['post'](_0x0c07('0x12'),auth['isAuthenticated'](),controller['addImap']);router[_0x0c07('0x1c')]('/:id/out_servers',auth[_0x0c07('0xa')](),controller[_0x0c07('0x20')]);router[_0x0c07('0x1c')](_0x0c07('0x15'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x21')]);router[_0x0c07('0x1c')](_0x0c07('0x17'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x22')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x0c07('0x23')]);router[_0x0c07('0x1c')](_0x0c07('0x1a'),auth[_0x0c07('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0x0c07('0xa')](),controller['update']);router[_0x0c07('0x24')](_0x0c07('0xe'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x25')]);router['delete'](_0x0c07('0x10'),auth['isAuthenticated'](),controller[_0x0c07('0x26')]);router[_0x0c07('0x24')](_0x0c07('0x12'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x27')]);router['delete'](_0x0c07('0x14'),auth[_0x0c07('0xa')](),controller[_0x0c07('0x28')]);router[_0x0c07('0x24')](_0x0c07('0xc'),auth['isAuthenticated'](),controller[_0x0c07('0x29')]);router[_0x0c07('0x24')]('/:id/users',auth[_0x0c07('0xa')](),controller[_0x0c07('0x2a')]);module[_0x0c07('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4197b14..f3fc328 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 _0xec39=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xec39,0x19f));var _0x9ec3=function(_0x540e17,_0x356f61){_0x540e17=_0x540e17-0x0;var _0x2ee0cc=_0xec39[_0x540e17];return _0x2ee0cc;};'use strict';var Sequelize=require(_0x9ec3('0x0'));module[_0x9ec3('0x1')]={'description':{'type':Sequelize[_0x9ec3('0x2')]},'name':{'type':Sequelize[_0x9ec3('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9ec3('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x9ec3('0x4')]},'markAsUnread':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9ec3('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9ec3('0x4')],'defaultValue':function(){return _0x9ec3('0x5');}},'notificationSound':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ec3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ec3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ec3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ec3('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9ec3('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9ec3('0x8'),'set':function(_0xaa1307){if(!_0xaa1307)this[_0x9ec3('0x9')](_0x9ec3('0xa'),null);this[_0x9ec3('0x9')](_0x9ec3('0xb'),_0xaa1307);}}}; \ No newline at end of file +var _0x423b=['setDataValue','mandatoryDisposition','exports','STRING','BOOLEAN','INTEGER','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'];(function(_0x593a33,_0x584f81){var _0x4fbd72=function(_0x1bcb43){while(--_0x1bcb43){_0x593a33['push'](_0x593a33['shift']());}};_0x4fbd72(++_0x584f81);}(_0x423b,0x12b));var _0xb423=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x423b[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require('sequelize');module[_0xb423('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xb423('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xb423('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb423('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb423('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xb423('0x3')](0x2)[_0xb423('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb423('0x5')],'defaultValue':function(){return _0xb423('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb423('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb423('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb423('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb423('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb423('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb423('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb423('0x2')],'defaultValue':![],'comment':_0xb423('0x8'),'set':function(_0x37f802){if(!_0x37f802)this[_0xb423('0x9')]('mandatoryDispositionPauseId',null);this[_0xb423('0x9')](_0xb423('0xa'),_0x37f802);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 15b10dc..b66f0dc 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 _0xf180=['tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','sendMail','defaults','List\x20not\x20found','attach','out','Interaction','Messages','verifySmtp','secure','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','userMailAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','redis','./mailAccount.socket','register','jayson/promise','client','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','MailAccount,\x20%s,\x20%s','message','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','MailAccounts','UserProfileResource','stack','name','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','Imap','find','body','catch','describe','MailAccountId','Disposition','create','getDispositions','hasOwnProperty','nolimit','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','ListId','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','pass','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','fullname','internal','Tag','Tags','color'];(function(_0x5b6f37,_0x1c8faf){var _0x2ddde2=function(_0x586079){while(--_0x586079){_0x5b6f37['push'](_0x5b6f37['shift']());}};_0x2ddde2(++_0x1c8faf);}(_0xf180,0xfe));var _0x0f18=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xf180[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0x0f18('0x0'));var rimraf=require(_0x0f18('0x1'));var zipdir=require(_0x0f18('0x2'));var jsonpatch=require(_0x0f18('0x3'));var rp=require(_0x0f18('0x4'));var moment=require(_0x0f18('0x5'));var BPromise=require(_0x0f18('0x6'));var Mustache=require(_0x0f18('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0f18('0x8'));var csv=require(_0x0f18('0x9'));var ejs=require(_0x0f18('0xa'));var fs=require('fs');var fs_extra=require(_0x0f18('0xb'));var _=require(_0x0f18('0xc'));var squel=require('squel');var crypto=require(_0x0f18('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f18('0xf'));var Papa=require(_0x0f18('0x10'));var htmlToText=require(_0x0f18('0x11'));var juice=require(_0x0f18('0x12'));var Redis=require(_0x0f18('0x13'));var authService=require(_0x0f18('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f18('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0f18('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0f18('0x17')]=_['defaults'](config[_0x0f18('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f18('0x17')]));require(_0x0f18('0x18'))[_0x0f18('0x19')](socket);var jayson=require(_0x0f18('0x1a'));var client=jayson[_0x0f18('0x1b')]['http']({'port':0x232b});function respondWithRpcPromise(_0x13324e,_0x538ab9,_0x48e113,_0x3eecde){return new BPromise(function(_0x270673,_0x36cf1c){var _0x3702b6=_0x3eecde||client;return _0x3702b6['request'](_0x13324e,_0x48e113)[_0x0f18('0x1c')](function(_0x19abf7){logger[_0x0f18('0x1d')]('MailAccount,\x20%s,\x20%s',_0x538ab9,_0x0f18('0x1e'));logger['debug'](_0x0f18('0x1f'),_0x538ab9,'request\x20sent',JSON[_0x0f18('0x20')](_0x19abf7));if(_0x19abf7['error']){if(_0x19abf7['error'][_0x0f18('0x21')]===0x1f4){logger[_0x0f18('0x22')](_0x0f18('0x23'),_0x538ab9,_0x19abf7[_0x0f18('0x22')][_0x0f18('0x24')]);return _0x36cf1c(_0x19abf7[_0x0f18('0x22')][_0x0f18('0x24')]);}logger[_0x0f18('0x22')](_0x0f18('0x23'),_0x538ab9,_0x19abf7[_0x0f18('0x22')][_0x0f18('0x24')]);return _0x270673(_0x19abf7[_0x0f18('0x22')]['message']);}else{logger['info'](_0x0f18('0x23'),_0x538ab9,_0x0f18('0x1e'));_0x270673(_0x19abf7['result']['message']);}})['catch'](function(_0x41b592){logger['error'](_0x0f18('0x23'),_0x538ab9,_0x41b592);_0x36cf1c(_0x41b592);});});}function respondWithStatusCode(_0x257d9a,_0x37bb93){_0x37bb93=_0x37bb93||0xcc;return function(_0x57daaf){if(_0x57daaf){return _0x257d9a[_0x0f18('0x25')](_0x37bb93);}return _0x257d9a['status'](_0x37bb93)[_0x0f18('0x26')]();};}function respondWithResult(_0x44bc0d,_0x3b4c72){_0x3b4c72=_0x3b4c72||0xc8;return function(_0x455863){if(_0x455863){return _0x44bc0d[_0x0f18('0x27')](_0x3b4c72)[_0x0f18('0x28')](_0x455863);}};}function respondWithFilteredResult(_0x18c9c8,_0x533297){return function(_0x6018bd){if(_0x6018bd){var _0x417966=typeof _0x533297[_0x0f18('0x29')]===_0x0f18('0x2a')&&typeof _0x533297[_0x0f18('0x2b')]===_0x0f18('0x2a');var _0x3a9d52=_0x6018bd[_0x0f18('0x2c')];var _0x59f871=_0x417966?0x0:_0x533297[_0x0f18('0x29')];var _0x426e35=_0x417966?_0x6018bd[_0x0f18('0x2c')]:_0x533297[_0x0f18('0x29')]+_0x533297[_0x0f18('0x2b')];var _0x44cf80;if(_0x426e35>=_0x3a9d52){_0x426e35=_0x3a9d52;_0x44cf80=0xc8;}else{_0x44cf80=0xce;}_0x18c9c8['status'](_0x44cf80);return _0x18c9c8[_0x0f18('0x2d')](_0x0f18('0x2e'),_0x59f871+'-'+_0x426e35+'/'+_0x3a9d52)[_0x0f18('0x28')](_0x6018bd);}return null;};}function patchUpdates(_0x4a1b5c){return function(_0x294bdd){try{jsonpatch[_0x0f18('0x2f')](_0x294bdd,_0x4a1b5c,!![]);}catch(_0x5562f5){return BPromise['reject'](_0x5562f5);}return _0x294bdd['save']();};}function saveUpdates(_0x2c0ce5,_0x20441f){return function(_0x1a4d7f){if(_0x1a4d7f){return _0x1a4d7f[_0x0f18('0x30')](_0x2c0ce5)['then'](function(_0x2b4aaa){return _0x2b4aaa;});}return null;};}function removeEntity(_0x58c233,_0x5ddaaf){return function(_0x23badc){if(_0x23badc){return _0x23badc[_0x0f18('0x31')]()['then'](function(){var _0x384bfb=_0x23badc[_0x0f18('0x32')]({'plain':!![]});var _0x2b5d6d=_0x0f18('0x33');return db[_0x0f18('0x34')][_0x0f18('0x31')]({'where':{'type':_0x2b5d6d,'resourceId':_0x384bfb['id']}})['then'](function(){return _0x23badc;});})['then'](function(){_0x58c233[_0x0f18('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374c2a,_0xc53561){return function(_0x4537ce){if(!_0x4537ce){_0x374c2a[_0x0f18('0x25')](0x194);}return _0x4537ce;};}function handleError(_0x483d8a,_0xffde76){_0xffde76=_0xffde76||0x1f4;return function(_0x594ce5){logger[_0x0f18('0x22')](_0x594ce5[_0x0f18('0x35')]);if(_0x594ce5[_0x0f18('0x36')]){delete _0x594ce5['name'];}_0x483d8a[_0x0f18('0x27')](_0xffde76)['send'](_0x594ce5);};}exports[_0x0f18('0x37')]=function(_0x1174e9,_0x5b3b20){var _0x1874ac={'include':[{'model':db[_0x0f18('0x38')],'as':'Imap'},{'model':db[_0x0f18('0x39')],'as':_0x0f18('0x3a')},{'model':db[_0x0f18('0x3b')],'as':_0x0f18('0x3c')}]},_0x36c7aa={},_0x3e8d77={'count':0x0,'rows':[]};var _0x37b559=_['map'](db[_0x0f18('0x3d')][_0x0f18('0x3e')],function(_0x3551ac){return{'name':_0x3551ac[_0x0f18('0x3f')],'type':_0x3551ac['type'][_0x0f18('0x40')]};});_0x36c7aa['model']=_[_0x0f18('0x41')](_0x37b559,_0x0f18('0x36'));_0x36c7aa[_0x0f18('0x42')]=_[_0x0f18('0x43')](_0x1174e9[_0x0f18('0x42')]);_0x36c7aa['filters']=_[_0x0f18('0x44')](_0x36c7aa[_0x0f18('0x45')],_0x36c7aa[_0x0f18('0x42')]);_0x1874ac[_0x0f18('0x46')]=_[_0x0f18('0x44')](_0x36c7aa['model'],qs[_0x0f18('0x47')](_0x1174e9[_0x0f18('0x42')][_0x0f18('0x47')]));_0x1874ac[_0x0f18('0x46')]=_0x1874ac[_0x0f18('0x46')][_0x0f18('0x48')]?_0x1874ac[_0x0f18('0x46')]:_0x36c7aa[_0x0f18('0x45')];if(!_0x1174e9['query']['hasOwnProperty']('nolimit')){_0x1874ac[_0x0f18('0x2b')]=qs['limit'](_0x1174e9['query'][_0x0f18('0x2b')]);_0x1874ac[_0x0f18('0x29')]=qs[_0x0f18('0x29')](_0x1174e9[_0x0f18('0x42')][_0x0f18('0x29')]);}_0x1874ac[_0x0f18('0x49')]=qs[_0x0f18('0x4a')](_0x1174e9[_0x0f18('0x42')]['sort']);_0x1874ac[_0x0f18('0x4b')]=qs[_0x0f18('0x4c')](_['pick'](_0x1174e9[_0x0f18('0x42')],_0x36c7aa['filters']),_0x37b559);if(_0x1174e9[_0x0f18('0x42')][_0x0f18('0x4d')]){_0x1874ac[_0x0f18('0x4b')]=_[_0x0f18('0x4e')](_0x1874ac[_0x0f18('0x4b')],{'$or':_[_0x0f18('0x41')](_0x37b559,function(_0x16530b){if(_0x16530b[_0x0f18('0x4f')]!==_0x0f18('0x50')){var _0x2b4498={};_0x2b4498[_0x16530b[_0x0f18('0x36')]]={'$like':'%'+_0x1174e9[_0x0f18('0x42')][_0x0f18('0x4d')]+'%'};return _0x2b4498;}})});}_0x1874ac=_[_0x0f18('0x4e')]({},_0x1874ac,_0x1174e9[_0x0f18('0x51')]);var _0x1389c7={'where':_0x1874ac['where']};return db[_0x0f18('0x3d')][_0x0f18('0x2c')](_0x1389c7)[_0x0f18('0x1c')](function(_0x4d665e){_0x3e8d77[_0x0f18('0x2c')]=_0x4d665e;if(_0x1174e9[_0x0f18('0x42')][_0x0f18('0x52')]){_0x1874ac[_0x0f18('0x53')]=[{'all':!![]}];}return db[_0x0f18('0x3d')]['findAll'](_0x1874ac);})[_0x0f18('0x1c')](function(_0x711cba){_0x3e8d77[_0x0f18('0x54')]=_0x711cba;return _0x3e8d77;})['then'](respondWithFilteredResult(_0x5b3b20,_0x1874ac))['catch'](handleError(_0x5b3b20,null));};exports[_0x0f18('0x55')]=function(_0x38b575,_0x4d3363){var _0x1e8b0b={'raw':![],'where':{'id':_0x38b575[_0x0f18('0x56')]['id']},'include':[{'model':db[_0x0f18('0x38')],'as':_0x0f18('0x57')},{'model':db[_0x0f18('0x39')],'as':_0x0f18('0x3a')},{'model':db[_0x0f18('0x3b')],'as':'mandatoryDispositionPause'}]},_0x266f65={};_0x266f65[_0x0f18('0x45')]=_['keys'](db[_0x0f18('0x3d')][_0x0f18('0x3e')]);_0x266f65[_0x0f18('0x42')]=_[_0x0f18('0x43')](_0x38b575[_0x0f18('0x42')]);_0x266f65['filters']=_['intersection'](_0x266f65['model'],_0x266f65[_0x0f18('0x42')]);_0x1e8b0b[_0x0f18('0x46')]=_[_0x0f18('0x44')](_0x266f65[_0x0f18('0x45')],qs['fields'](_0x38b575['query']['fields']));_0x1e8b0b['attributes']=_0x1e8b0b[_0x0f18('0x46')][_0x0f18('0x48')]?_0x1e8b0b['attributes']:_0x266f65[_0x0f18('0x45')];if(_0x38b575[_0x0f18('0x42')][_0x0f18('0x52')]){_0x1e8b0b[_0x0f18('0x53')]=[{'all':!![]}];}_0x1e8b0b=_['merge']({},_0x1e8b0b,_0x38b575[_0x0f18('0x51')]);return db[_0x0f18('0x3d')][_0x0f18('0x58')](_0x1e8b0b)[_0x0f18('0x1c')](handleEntityNotFound(_0x4d3363,null))[_0x0f18('0x1c')](respondWithResult(_0x4d3363,null))['catch'](handleError(_0x4d3363,null));};exports[_0x0f18('0x30')]=function(_0x5e607d,_0x328bee){if(_0x5e607d['body']['id']){delete _0x5e607d[_0x0f18('0x59')]['id'];}return db[_0x0f18('0x3d')][_0x0f18('0x58')]({'where':{'id':_0x5e607d[_0x0f18('0x56')]['id']},'include':[{'model':db[_0x0f18('0x38')],'as':_0x0f18('0x57')},{'model':db['MailServerOut'],'as':_0x0f18('0x3a')},{'model':db[_0x0f18('0x3b')],'as':_0x0f18('0x3c')}]})[_0x0f18('0x1c')](handleEntityNotFound(_0x328bee,null))['then'](saveUpdates(_0x5e607d['body'],null))[_0x0f18('0x1c')](function(_0x4b7ed1){if(_0x4b7ed1&&_0x5e607d[_0x0f18('0x59')][_0x0f18('0x57')]){return db[_0x0f18('0x38')]['update'](_0x5e607d[_0x0f18('0x59')]['Imap'],{'where':{'MailAccountId':_0x4b7ed1['id']}})['then'](function(){return _0x4b7ed1;});}return _0x4b7ed1;})[_0x0f18('0x1c')](function(_0x25e470){if(_0x25e470&&_0x5e607d[_0x0f18('0x59')][_0x0f18('0x3a')]){return db[_0x0f18('0x39')][_0x0f18('0x30')](_0x5e607d[_0x0f18('0x59')][_0x0f18('0x3a')],{'where':{'MailAccountId':_0x25e470['id']}})[_0x0f18('0x1c')](function(){return _0x25e470;});}return _0x25e470;})[_0x0f18('0x1c')](respondWithResult(_0x328bee,null))[_0x0f18('0x5a')](handleError(_0x328bee,null));};exports[_0x0f18('0x5b')]=function(_0x313ba0,_0x18398f){return db['MailAccount'][_0x0f18('0x5b')]()[_0x0f18('0x1c')](respondWithResult(_0x18398f,null))['catch'](handleError(_0x18398f,null));};exports['addDisposition']=function(_0x32786a,_0xb7f68f,_0x38c024){if(_0x32786a['body']['id']){delete _0x32786a['body']['id'];}return db['MailAccount'][_0x0f18('0x58')]({'where':{'id':_0x32786a[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0xb7f68f,null))[_0x0f18('0x1c')](function(_0x3d05bd){if(_0x3d05bd){_0x32786a[_0x0f18('0x59')][_0x0f18('0x5c')]=_0x3d05bd['id'];return db[_0x0f18('0x5d')][_0x0f18('0x5e')](_0x32786a[_0x0f18('0x59')]);}})[_0x0f18('0x1c')](respondWithResult(_0xb7f68f,null))[_0x0f18('0x5a')](handleError(_0xb7f68f,null));};exports[_0x0f18('0x5f')]=function(_0x516645,_0x58cdc0,_0x147031){var _0x5125bd={'raw':![],'where':{}};var _0x41e31d={};var _0xba0e99={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x516645[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x58cdc0,null))[_0x0f18('0x1c')](function(_0x4f0348){if(_0x4f0348){_0x41e31d[_0x0f18('0x45')]=_[_0x0f18('0x43')](db[_0x0f18('0x5d')][_0x0f18('0x3e')]);_0x41e31d['query']=_[_0x0f18('0x43')](_0x516645[_0x0f18('0x42')]);_0x41e31d[_0x0f18('0x4c')]=_[_0x0f18('0x44')](_0x41e31d[_0x0f18('0x45')],_0x41e31d['query']);_0x5125bd[_0x0f18('0x46')]=_[_0x0f18('0x44')](_0x41e31d[_0x0f18('0x45')],qs[_0x0f18('0x47')](_0x516645[_0x0f18('0x42')]['fields']));_0x5125bd[_0x0f18('0x46')]=_0x5125bd[_0x0f18('0x46')][_0x0f18('0x48')]?_0x5125bd[_0x0f18('0x46')]:_0x41e31d[_0x0f18('0x45')];if(!_0x516645[_0x0f18('0x42')][_0x0f18('0x60')](_0x0f18('0x61'))){_0x5125bd[_0x0f18('0x2b')]=qs[_0x0f18('0x2b')](_0x516645['query'][_0x0f18('0x2b')]);_0x5125bd[_0x0f18('0x29')]=qs[_0x0f18('0x29')](_0x516645[_0x0f18('0x42')]['offset']);}_0x5125bd[_0x0f18('0x49')]=qs[_0x0f18('0x4a')](_0x516645[_0x0f18('0x42')][_0x0f18('0x4a')]);_0x5125bd[_0x0f18('0x4b')]=qs[_0x0f18('0x4c')](_[_0x0f18('0x62')](_0x516645['query'],_0x41e31d[_0x0f18('0x4c')]));_0x5125bd[_0x0f18('0x4b')][_0x0f18('0x5c')]=_0x4f0348['id'];if(_0x516645[_0x0f18('0x42')]['filter']){_0x5125bd[_0x0f18('0x4b')]=_[_0x0f18('0x4e')](_0x5125bd[_0x0f18('0x4b')],{'$or':_[_0x0f18('0x41')](_0x5125bd[_0x0f18('0x46')],function(_0x2f2d71){var _0x5c4e31={};_0x5c4e31[_0x2f2d71]={'$like':'%'+_0x516645[_0x0f18('0x42')][_0x0f18('0x4d')]+'%'};return _0x5c4e31;})});}_0x5125bd=_['merge']({},_0x5125bd,_0x516645['options']);return db['Disposition'][_0x0f18('0x2c')]({'where':_0x5125bd['where']})[_0x0f18('0x1c')](function(_0x1ed6b8){_0xba0e99[_0x0f18('0x2c')]=_0x1ed6b8;if(_0x516645[_0x0f18('0x42')][_0x0f18('0x52')]){_0x5125bd[_0x0f18('0x53')]=[{'all':!![]}];}return db[_0x0f18('0x5d')][_0x0f18('0x63')](_0x5125bd);})[_0x0f18('0x1c')](function(_0x9945da){_0xba0e99[_0x0f18('0x54')]=_0x9945da;return _0xba0e99;});}})[_0x0f18('0x1c')](respondWithFilteredResult(_0x58cdc0,_0x5125bd))[_0x0f18('0x5a')](handleError(_0x58cdc0,null));};exports[_0x0f18('0x64')]=function(_0x24b7b1,_0x33a9b6,_0x4ac7b5){return db['MailAccount'][_0x0f18('0x58')]({'where':{'id':_0x24b7b1[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x33a9b6,null))[_0x0f18('0x1c')](function(_0x14cb41){if(_0x14cb41){return _0x14cb41['removeDispositions'](_0x24b7b1[_0x0f18('0x42')][_0x0f18('0x65')]);}})[_0x0f18('0x1c')](respondWithStatusCode(_0x33a9b6,null))[_0x0f18('0x5a')](handleError(_0x33a9b6,null));};exports[_0x0f18('0x66')]=function(_0x38ef2b,_0x460bd6,_0x207f6d){if(_0x38ef2b[_0x0f18('0x59')]['id']){delete _0x38ef2b['body']['id'];}return db[_0x0f18('0x3d')][_0x0f18('0x58')]({'where':{'id':_0x38ef2b[_0x0f18('0x56')]['id']}})['then'](handleEntityNotFound(_0x460bd6,null))[_0x0f18('0x1c')](function(_0x27d83f){if(_0x27d83f){_0x38ef2b['body'][_0x0f18('0x5c')]=_0x27d83f['id'];return db[_0x0f18('0x67')]['create'](_0x38ef2b[_0x0f18('0x59')]);}})[_0x0f18('0x1c')](respondWithResult(_0x460bd6,null))['catch'](handleError(_0x460bd6,null));};exports['getAnswers']=function(_0xc336b5,_0x32fea7,_0x3c0b43){var _0x2881e5={'raw':![],'where':{}};var _0x592e23={};var _0x434609={'count':0x0,'rows':[]};return db['MailAccount'][_0x0f18('0x68')]({'where':{'id':_0xc336b5[_0x0f18('0x56')]['id']}})['then'](handleEntityNotFound(_0x32fea7,null))[_0x0f18('0x1c')](function(_0xbe8527){if(_0xbe8527){_0x592e23[_0x0f18('0x45')]=_[_0x0f18('0x43')](db[_0x0f18('0x67')][_0x0f18('0x3e')]);_0x592e23['query']=_[_0x0f18('0x43')](_0xc336b5[_0x0f18('0x42')]);_0x592e23['filters']=_[_0x0f18('0x44')](_0x592e23['model'],_0x592e23[_0x0f18('0x42')]);_0x2881e5['attributes']=_[_0x0f18('0x44')](_0x592e23['model'],qs[_0x0f18('0x47')](_0xc336b5[_0x0f18('0x42')][_0x0f18('0x47')]));_0x2881e5['attributes']=_0x2881e5[_0x0f18('0x46')][_0x0f18('0x48')]?_0x2881e5[_0x0f18('0x46')]:_0x592e23[_0x0f18('0x45')];if(!_0xc336b5[_0x0f18('0x42')][_0x0f18('0x60')](_0x0f18('0x61'))){_0x2881e5[_0x0f18('0x2b')]=qs[_0x0f18('0x2b')](_0xc336b5[_0x0f18('0x42')][_0x0f18('0x2b')]);_0x2881e5[_0x0f18('0x29')]=qs[_0x0f18('0x29')](_0xc336b5[_0x0f18('0x42')][_0x0f18('0x29')]);}_0x2881e5[_0x0f18('0x49')]=qs[_0x0f18('0x4a')](_0xc336b5[_0x0f18('0x42')][_0x0f18('0x4a')]);_0x2881e5[_0x0f18('0x4b')]=qs['filters'](_[_0x0f18('0x62')](_0xc336b5[_0x0f18('0x42')],_0x592e23[_0x0f18('0x4c')]));_0x2881e5['where'][_0x0f18('0x5c')]=_0xbe8527['id'];if(_0xc336b5[_0x0f18('0x42')]['filter']){_0x2881e5['where']=_[_0x0f18('0x4e')](_0x2881e5[_0x0f18('0x4b')],{'$or':_[_0x0f18('0x41')](_0x2881e5['attributes'],function(_0x15e648){var _0x4ae920={};_0x4ae920[_0x15e648]={'$like':'%'+_0xc336b5[_0x0f18('0x42')]['filter']+'%'};return _0x4ae920;})});}_0x2881e5=_[_0x0f18('0x4e')]({},_0x2881e5,_0xc336b5['options']);return db['CannedAnswer'][_0x0f18('0x2c')]({'where':_0x2881e5[_0x0f18('0x4b')]})['then'](function(_0x3f71a8){_0x434609[_0x0f18('0x2c')]=_0x3f71a8;if(_0xc336b5[_0x0f18('0x42')][_0x0f18('0x52')]){_0x2881e5[_0x0f18('0x53')]=[{'all':!![]}];}return db[_0x0f18('0x67')][_0x0f18('0x63')](_0x2881e5);})['then'](function(_0x15aba1){_0x434609[_0x0f18('0x54')]=_0x15aba1;return _0x434609;});}})[_0x0f18('0x1c')](respondWithFilteredResult(_0x32fea7,_0x2881e5))[_0x0f18('0x5a')](handleError(_0x32fea7,null));};exports[_0x0f18('0x69')]=function(_0x54b507,_0x8a62d5,_0x519dcb){return db[_0x0f18('0x3d')]['find']({'where':{'id':_0x54b507[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x8a62d5,null))['then'](function(_0x49f470){if(_0x49f470){return _0x49f470['removeAnswers'](_0x54b507[_0x0f18('0x42')][_0x0f18('0x65')]);}})[_0x0f18('0x1c')](respondWithStatusCode(_0x8a62d5,null))[_0x0f18('0x5a')](handleError(_0x8a62d5,null));};exports['create']=function(_0xe4c67c,_0x1d8748){var _0x220bfc={'name':_0xe4c67c[_0x0f18('0x59')]['name'],'key':_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x40')],'email':_0xe4c67c['body']['email'],'ListId':_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x6a')],'active':!_[_0x0f18('0x6b')](_0xe4c67c['body'][_0x0f18('0x6c')])?_0xe4c67c['body'][_0x0f18('0x6c')]:!![],'description':_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x6d')]||null,'Imap':{},'Smtp':{}};if(_[_0x0f18('0x6b')](_0xe4c67c['body'][_0x0f18('0x6e')])){if(_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x6f')]){_0x220bfc[_0x0f18('0x57')][_0x0f18('0x70')]=_0x220bfc[_0x0f18('0x3a')][_0x0f18('0x70')]=_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x71')];_0x220bfc[_0x0f18('0x57')]['password']=_0x220bfc[_0x0f18('0x3a')]['pass']=_0xe4c67c['body'][_0x0f18('0x72')];}else{_0x220bfc[_0x0f18('0x57')][_0x0f18('0x73')]=_0x220bfc[_0x0f18('0x3a')][_0x0f18('0x73')]=![];}_0x220bfc[_0x0f18('0x57')][_0x0f18('0x74')]=_0xe4c67c[_0x0f18('0x59')]['Imap']['host'];_0x220bfc[_0x0f18('0x57')][_0x0f18('0x75')]=_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x57')]['port'];_0x220bfc[_0x0f18('0x3a')][_0x0f18('0x74')]=_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x3a')][_0x0f18('0x74')];_0x220bfc[_0x0f18('0x3a')][_0x0f18('0x75')]=_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x3a')][_0x0f18('0x75')];}else{_0x220bfc[_0x0f18('0x57')][_0x0f18('0x76')]=_0x220bfc[_0x0f18('0x3a')]['service']=_0xe4c67c['body']['cservice'];_0x220bfc[_0x0f18('0x57')][_0x0f18('0x70')]=_0x220bfc[_0x0f18('0x3a')][_0x0f18('0x70')]=_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x71')];_0x220bfc[_0x0f18('0x57')]['password']=_0x220bfc['Smtp'][_0x0f18('0x77')]=_0xe4c67c[_0x0f18('0x59')][_0x0f18('0x72')];}return db[_0x0f18('0x3d')][_0x0f18('0x5e')](_0x220bfc,{'include':[{'model':db[_0x0f18('0x39')],'as':_0x0f18('0x3a')},{'model':db['MailServerIn'],'as':_0x0f18('0x57')}]})['then'](function(_0x378d14){var _0xa990c7=_0xe4c67c['user'][_0x0f18('0x32')]({'plain':!![]});if(!_0xa990c7)throw new Error(_0x0f18('0x78'));if(_0xa990c7[_0x0f18('0x79')]==='user'){var _0x46a44b=_0x378d14[_0x0f18('0x32')]({'plain':!![]});return db[_0x0f18('0x7a')][_0x0f18('0x58')]({'where':{'name':_0x0f18('0x33'),'userProfileId':_0xa990c7['userProfileId']},'raw':!![]})[_0x0f18('0x1c')](function(_0x356d0e){if(_0x356d0e&&_0x356d0e[_0x0f18('0x7b')]===0x0){return db['UserProfileResource'][_0x0f18('0x5e')]({'name':_0x46a44b[_0x0f18('0x36')],'resourceId':_0x46a44b['id'],'type':_0x356d0e['name'],'sectionId':_0x356d0e['id']},{})['then'](function(){return _0x378d14;});}else{return _0x378d14;}})[_0x0f18('0x5a')](function(_0x49b8e5){logger[_0x0f18('0x22')](_0x0f18('0x7c'),_0x49b8e5);throw _0x49b8e5;});}return _0x378d14;})['then'](respondWithResult(_0x1d8748,0xc9))['catch'](handleError(_0x1d8748,null));};exports['getImap']=function(_0x2bfad8,_0x16b78a,_0x391f74){return db[_0x0f18('0x3d')]['findOne']({'where':{'id':_0x2bfad8['params']['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x16b78a,null))[_0x0f18('0x1c')](function(_0x5a5d25){if(_0x5a5d25){return _0x5a5d25[_0x0f18('0x7d')]();}return null;})['then'](respondWithResult(_0x16b78a,null))['catch'](handleError(_0x16b78a,null));};exports[_0x0f18('0x7e')]=function(_0x59174e,_0x6ab263,_0x19a41a){if(_0x59174e[_0x0f18('0x59')]['id']){delete _0x59174e[_0x0f18('0x59')]['id'];}return db[_0x0f18('0x3d')][_0x0f18('0x58')]({'where':{'id':_0x59174e[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x6ab263,null))[_0x0f18('0x1c')](function(_0x42fcab){if(_0x42fcab){_0x59174e[_0x0f18('0x59')]['MailAccountId']=_0x42fcab['id'];return db[_0x0f18('0x38')]['create'](_0x59174e[_0x0f18('0x59')]);}})[_0x0f18('0x1c')](respondWithResult(_0x6ab263,null))[_0x0f18('0x5a')](handleError(_0x6ab263,null));};exports[_0x0f18('0x7f')]=function(_0x6d7352,_0x2a4c96,_0x2088ff){return db[_0x0f18('0x3d')][_0x0f18('0x68')]({'where':{'id':_0x6d7352[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x2a4c96,null))[_0x0f18('0x1c')](function(_0xf01060){if(_0xf01060){return _0xf01060[_0x0f18('0x80')](null);}return null;})[_0x0f18('0x1c')](respondWithStatusCode(_0x2a4c96,null))[_0x0f18('0x5a')](handleError(_0x2a4c96,null));};exports[_0x0f18('0x81')]=function(_0x5716cb,_0x49dc6c,_0x56a212){return db[_0x0f18('0x3d')][_0x0f18('0x68')]({'where':{'id':_0x5716cb['params']['id']}})['then'](handleEntityNotFound(_0x49dc6c,null))[_0x0f18('0x1c')](function(_0x54d114){if(_0x54d114){return _0x54d114[_0x0f18('0x81')]();}return null;})[_0x0f18('0x1c')](respondWithResult(_0x49dc6c,null))['catch'](handleError(_0x49dc6c,null));};exports[_0x0f18('0x82')]=function(_0x23b67b,_0x43bbe9,_0x4a550e){if(_0x23b67b[_0x0f18('0x59')]['id']){delete _0x23b67b[_0x0f18('0x59')]['id'];}return db[_0x0f18('0x3d')]['find']({'where':{'id':_0x23b67b[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x43bbe9,null))[_0x0f18('0x1c')](function(_0x421a6b){if(_0x421a6b){_0x23b67b[_0x0f18('0x59')][_0x0f18('0x5c')]=_0x421a6b['id'];return db['MailServerOut'][_0x0f18('0x5e')](_0x23b67b[_0x0f18('0x59')]);}})[_0x0f18('0x1c')](respondWithResult(_0x43bbe9,null))[_0x0f18('0x5a')](handleError(_0x43bbe9,null));};exports[_0x0f18('0x83')]=function(_0x5e9825,_0x4b82df,_0xac087){return db[_0x0f18('0x3d')][_0x0f18('0x68')]({'where':{'id':_0x5e9825[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x4b82df,null))[_0x0f18('0x1c')](function(_0x140f50){if(_0x140f50){return _0x140f50[_0x0f18('0x84')](null);}return null;})[_0x0f18('0x1c')](respondWithStatusCode(_0x4b82df,null))[_0x0f18('0x5a')](handleError(_0x4b82df,null));};exports[_0x0f18('0x85')]=function(_0x33dbc3,_0x52de54,_0x1bb191){return db[_0x0f18('0x86')][_0x0f18('0x58')]({'where':{'id':_0x33dbc3[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x52de54,null))[_0x0f18('0x1c')](function(_0x134205){if(_0x134205){return _0x134205['addInteraction'](_0x33dbc3['body'][_0x0f18('0x65')],_[_0x0f18('0x87')](_0x33dbc3[_0x0f18('0x59')],[_0x0f18('0x65'),'id'])||{});}})[_0x0f18('0x1c')](respondWithResult(_0x52de54,null))[_0x0f18('0x5a')](handleError(_0x52de54,null));};exports[_0x0f18('0x88')]=function(_0x369c4e,_0x4461b2,_0x4464fc){var _0x2625a2={'raw':![],'where':{}};var _0x5d28a2={};var _0xa51659={'count':0x0,'rows':[]};return db[_0x0f18('0x3d')][_0x0f18('0x68')]({'where':{'id':_0x369c4e[_0x0f18('0x56')]['id']}})['then'](handleEntityNotFound(_0x4461b2,null))[_0x0f18('0x1c')](function(_0x203c08){if(_0x203c08){_0x5d28a2[_0x0f18('0x45')]=_[_0x0f18('0x43')](db[_0x0f18('0x86')][_0x0f18('0x3e')]);_0x5d28a2[_0x0f18('0x42')]=_[_0x0f18('0x43')](_0x369c4e['query']);_0x5d28a2[_0x0f18('0x4c')]=_[_0x0f18('0x44')](_0x5d28a2[_0x0f18('0x45')],_0x5d28a2[_0x0f18('0x42')]);_0x2625a2[_0x0f18('0x46')]=_['intersection'](_0x5d28a2[_0x0f18('0x45')],qs['fields'](_0x369c4e[_0x0f18('0x42')]['fields']));_0x2625a2[_0x0f18('0x46')]=_0x2625a2['attributes']['length']?_0x2625a2['attributes']:_0x5d28a2['model'];if(!_0x369c4e[_0x0f18('0x42')][_0x0f18('0x60')](_0x0f18('0x61'))){_0x2625a2[_0x0f18('0x2b')]=qs[_0x0f18('0x2b')](_0x369c4e[_0x0f18('0x42')][_0x0f18('0x2b')]);_0x2625a2['offset']=qs[_0x0f18('0x29')](_0x369c4e[_0x0f18('0x42')][_0x0f18('0x29')]);}_0x2625a2[_0x0f18('0x49')]=qs[_0x0f18('0x4a')](_0x369c4e[_0x0f18('0x42')]['sort']);_0x2625a2[_0x0f18('0x4b')]=qs['filters'](_[_0x0f18('0x62')](_0x369c4e[_0x0f18('0x42')],_0x5d28a2[_0x0f18('0x4c')]));_0x2625a2[_0x0f18('0x4b')][_0x0f18('0x5c')]=_0x203c08['id'];if(_0x369c4e[_0x0f18('0x42')][_0x0f18('0x4d')]){_0x2625a2['where']=_['merge'](_0x2625a2[_0x0f18('0x4b')],{'$or':_['map'](_0x2625a2['attributes'],function(_0x3d9b9f){var _0x55877f={};_0x55877f[_0x3d9b9f]={'$like':'%'+_0x369c4e[_0x0f18('0x42')]['filter']+'%'};return _0x55877f;})});}_0x2625a2=_[_0x0f18('0x4e')]({},_0x2625a2,_0x369c4e[_0x0f18('0x51')]);return db[_0x0f18('0x86')][_0x0f18('0x2c')]({'where':_0x2625a2[_0x0f18('0x4b')]})['then'](function(_0x2e94c5){_0xa51659[_0x0f18('0x2c')]=_0x2e94c5;if(_0x369c4e[_0x0f18('0x42')][_0x0f18('0x52')]){_0x2625a2[_0x0f18('0x53')]=[{'model':db[_0x0f18('0x89')],'as':_0x0f18('0x8a'),'required':![]},{'model':db[_0x0f18('0x8b')],'as':_0x0f18('0x8c'),'attributes':[_0x0f18('0x36'),_0x0f18('0x8d'),_0x0f18('0x8e')],'required':![]},{'model':db[_0x0f18('0x8f')],'as':_0x0f18('0x90'),'attributes':['id','name',_0x0f18('0x91')],'where':_0x369c4e[_0x0f18('0x42')][_0x0f18('0x92')]?{'id':_0x369c4e[_0x0f18('0x42')]['tag']}:undefined,'required':_0x369c4e[_0x0f18('0x42')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x0f18('0x63')](_0x2625a2);})[_0x0f18('0x1c')](function(_0x43878f){_0xa51659[_0x0f18('0x54')]=_0x43878f;return _0xa51659;});}})[_0x0f18('0x1c')](respondWithFilteredResult(_0x4461b2,_0x2625a2))[_0x0f18('0x5a')](handleError(_0x4461b2,null));};exports[_0x0f18('0x93')]=function addApplications(_0x466f30,_0x14dfc2){var _0x4e1cd9=_0x466f30[_0x0f18('0x56')]['id'];var _0x3d3cb6=_0x466f30[_0x0f18('0x59')];var _0x216c53=0xc8;var _0x2d9a4b=null;return db[_0x0f18('0x94')][_0x0f18('0x95')]({'isolationLevel':db['sequelize'][_0x0f18('0x96')][_0x0f18('0x97')][_0x0f18('0x98')]},function(_0x3f3022){return db['MailAccount'][_0x0f18('0x68')]({'where':{'id':_0x4e1cd9},'transaction':_0x3f3022})['then'](function(_0x3d1e0d){if(_0x3d1e0d){return db['MailApplication'][_0x0f18('0x31')]({'where':{'MailAccountId':_0x4e1cd9},'transaction':_0x3f3022})[_0x0f18('0x1c')](function(){var _0x1f58cf=_[_0x0f18('0x41')](_0x3d3cb6,function(_0x4a7963){_0x4a7963[_0x0f18('0x5c')]=_0x4e1cd9;return _0x4a7963;});return db[_0x0f18('0x99')][_0x0f18('0x9a')](_0x1f58cf,{'transaction':_0x3f3022});});}else{_0x216c53=0x194;_0x2d9a4b=[];}});})['then'](function(){if(_0x216c53!==0x194){return db[_0x0f18('0x99')][_0x0f18('0x9b')]({'where':{'MailAccountId':_0x4e1cd9},'order':'priority'})[_0x0f18('0x1c')](function(_0xd1f512){_0x2d9a4b=_0xd1f512;});}})[_0x0f18('0x5a')](function(_0x1f779e){_0x216c53=0x1f4;logger[_0x0f18('0x22')](_0x1f779e['stack']);if(_0x1f779e[_0x0f18('0x36')]){delete _0x1f779e[_0x0f18('0x36')];}_0x2d9a4b=_0x1f779e;})[_0x0f18('0x9c')](function(){if(_0x2d9a4b===null){_0x14dfc2[_0x0f18('0x25')](_0x216c53);}else{if(_0x216c53===0x1f4){_0x14dfc2[_0x0f18('0x27')](_0x216c53)[_0x0f18('0x9d')](_0x2d9a4b);}else{_0x14dfc2[_0x0f18('0x27')](_0x216c53)[_0x0f18('0x28')](_0x2d9a4b);}}});};exports[_0x0f18('0x9e')]=function(_0x424e88,_0x79b26c,_0x34d184){var _0x49d7a6={};var _0x3c0898={};var _0x33a36f;var _0x2082df;return db[_0x0f18('0x3d')][_0x0f18('0x68')]({'where':{'id':_0x424e88['params']['id']}})['then'](handleEntityNotFound(_0x79b26c,null))['then'](function(_0x3ad010){if(_0x3ad010){_0x33a36f=_0x3ad010;_0x3c0898[_0x0f18('0x45')]=_[_0x0f18('0x43')](db['MailApplication']['rawAttributes']);_0x3c0898['query']=_[_0x0f18('0x43')](_0x424e88['query']);_0x3c0898[_0x0f18('0x4c')]=_['intersection'](_0x3c0898['model'],_0x3c0898[_0x0f18('0x42')]);_0x49d7a6[_0x0f18('0x46')]=_[_0x0f18('0x44')](_0x3c0898[_0x0f18('0x45')],qs['fields'](_0x424e88[_0x0f18('0x42')][_0x0f18('0x47')]));_0x49d7a6['attributes']=_0x49d7a6[_0x0f18('0x46')][_0x0f18('0x48')]?_0x49d7a6[_0x0f18('0x46')]:_0x3c0898['model'];_0x49d7a6[_0x0f18('0x49')]=qs['sort'](_0x424e88[_0x0f18('0x42')]['sort']);_0x49d7a6[_0x0f18('0x4b')]=qs[_0x0f18('0x4c')](_['pick'](_0x424e88['query'],_0x3c0898['filters']));if(_0x424e88[_0x0f18('0x42')][_0x0f18('0x4d')]){_0x49d7a6[_0x0f18('0x4b')]=_['merge'](_0x49d7a6[_0x0f18('0x4b')],{'$or':_[_0x0f18('0x41')](_0x49d7a6[_0x0f18('0x46')],function(_0x5675b5){var _0x19fdf5={};_0x19fdf5[_0x5675b5]={'$like':'%'+_0x424e88['query'][_0x0f18('0x4d')]+'%'};return _0x19fdf5;})});}_0x49d7a6=_[_0x0f18('0x4e')]({},_0x49d7a6,_0x424e88[_0x0f18('0x51')]);return _0x33a36f[_0x0f18('0x9e')](_0x49d7a6);}})[_0x0f18('0x1c')](function(_0x319a55){if(_0x319a55){_0x2082df=_0x319a55['length'];if(!_0x424e88['query']['hasOwnProperty']('nolimit')){_0x49d7a6[_0x0f18('0x2b')]=qs[_0x0f18('0x2b')](_0x424e88[_0x0f18('0x42')][_0x0f18('0x2b')]);_0x49d7a6[_0x0f18('0x29')]=qs[_0x0f18('0x29')](_0x424e88[_0x0f18('0x42')]['offset']);}return _0x33a36f[_0x0f18('0x9e')](_0x49d7a6);}})[_0x0f18('0x1c')](function(_0x34eea4){if(_0x34eea4){return _0x34eea4?{'count':_0x2082df,'rows':_0x34eea4}:null;}})['then'](respondWithResult(_0x79b26c,null))[_0x0f18('0x5a')](handleError(_0x79b26c,null));};exports[_0x0f18('0x9f')]=function(_0x567588,_0x476be5,_0x25cf46){var _0x2322c8={'raw':!![],'where':{}};var _0x4eb8e4={};var _0x31c77c={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x567588[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x476be5,null))[_0x0f18('0x1c')](function(_0x3d3aa8){if(_0x3d3aa8){_0x4eb8e4[_0x0f18('0x45')]=_[_0x0f18('0x43')](db[_0x0f18('0xa0')][_0x0f18('0x3e')]);_0x4eb8e4[_0x0f18('0x42')]=_['keys'](_0x567588[_0x0f18('0x42')]);_0x4eb8e4[_0x0f18('0x4c')]=_['intersection'](_0x4eb8e4[_0x0f18('0x45')],_0x4eb8e4['query']);_0x2322c8[_0x0f18('0x46')]=_['intersection'](_0x4eb8e4['model'],qs[_0x0f18('0x47')](_0x567588['query'][_0x0f18('0x47')]));_0x2322c8[_0x0f18('0x46')]=_0x2322c8['attributes'][_0x0f18('0x48')]?_0x2322c8[_0x0f18('0x46')]:_0x4eb8e4['model'];if(!_0x567588[_0x0f18('0x42')][_0x0f18('0x60')]('nolimit')){_0x2322c8[_0x0f18('0x2b')]=qs[_0x0f18('0x2b')](_0x567588['query'][_0x0f18('0x2b')]);_0x2322c8[_0x0f18('0x29')]=qs[_0x0f18('0x29')](_0x567588[_0x0f18('0x42')][_0x0f18('0x29')]);}_0x2322c8[_0x0f18('0x49')]=qs[_0x0f18('0x4a')](_0x567588['query']['sort']);_0x2322c8[_0x0f18('0x4b')]=qs[_0x0f18('0x4c')](_[_0x0f18('0x62')](_0x567588[_0x0f18('0x42')],_0x4eb8e4['filters']));_0x2322c8['where'][_0x0f18('0x5c')]=_0x3d3aa8['id'];if(_0x567588[_0x0f18('0x42')][_0x0f18('0x4d')]){_0x2322c8[_0x0f18('0x4b')]=_[_0x0f18('0x4e')](_0x2322c8[_0x0f18('0x4b')],{'$or':_['map'](_0x2322c8['attributes'],function(_0x68632b){var _0x4db3f5={};_0x4db3f5[_0x68632b]={'$like':'%'+_0x567588[_0x0f18('0x42')]['filter']+'%'};return _0x4db3f5;})});}if(_0x567588['query'][_0x0f18('0xa1')]){var _0x5c8ede=_0x567588[_0x0f18('0x42')]['$gte'][_0x0f18('0xa2')](',');var _0xa29b8={};_0xa29b8[_0x5c8ede[0x0]]={'$gte':moment(_0x5c8ede[0x1])[_0x0f18('0xa3')](_0x0f18('0xa4'))};_0x2322c8[_0x0f18('0x4b')]=_['merge'](_0x2322c8[_0x0f18('0x4b')],_0xa29b8);}_0x2322c8=_[_0x0f18('0x4e')]({},_0x2322c8,_0x567588[_0x0f18('0x51')]);return db[_0x0f18('0xa0')][_0x0f18('0x2c')]({'where':_0x2322c8[_0x0f18('0x4b')]})['then'](function(_0xab93ed){_0x31c77c[_0x0f18('0x2c')]=_0xab93ed;if(_0x567588[_0x0f18('0x42')][_0x0f18('0x52')]){_0x2322c8[_0x0f18('0x53')]=[{'all':!![]}];}return db[_0x0f18('0xa0')][_0x0f18('0x63')](_0x2322c8);})[_0x0f18('0x1c')](function(_0x9c7b4c){if(_0x567588[_0x0f18('0x42')][_0x0f18('0xa5')]===_0x0f18('0xa6')){for(var _0x1eea5b=0x0;_0x1eea5b<_0x9c7b4c[_0x0f18('0x48')];_0x1eea5b++){_0x9c7b4c[_0x1eea5b][_0x0f18('0x59')]=juice(_0x9c7b4c[_0x1eea5b][_0x0f18('0x59')]);}}_0x31c77c[_0x0f18('0x54')]=_0x9c7b4c;return _0x31c77c;});}})['then'](respondWithFilteredResult(_0x476be5,_0x2322c8))[_0x0f18('0x5a')](handleError(_0x476be5,null));};exports[_0x0f18('0x9d')]=function(_0x37a7c7,_0x4d127c,_0x1a3251){var _0xe73c9,_0x191db1={},_0x4a20f3;if(_0x37a7c7[_0x0f18('0x59')]['to']){_0x4a20f3=_0x37a7c7[_0x0f18('0x59')]['to'][_0x0f18('0xa2')](',')[0x0];}return db[_0x0f18('0x3d')]['find']({'where':{'id':_0x37a7c7['params']['id']},'include':[{'model':db['CmList'],'as':_0x0f18('0xa7'),'include':[{'model':db[_0x0f18('0x89')],'as':_0x0f18('0xa8'),'where':{'email':_0x4a20f3},'limit':0x1,'order':[[_0x0f18('0xa9'),_0x0f18('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0x0f18('0x3a'),'raw':!![]}]})[_0x0f18('0x1c')](handleEntityNotFound(_0x4d127c,null))[_0x0f18('0x1c')](function(_0x585cbb){if(_0x585cbb){_0xe73c9=_0x585cbb;if(_0x585cbb[_0x0f18('0x3a')]){if(_['isNil'](_0x37a7c7['body'][_0x0f18('0xab')])){_0x37a7c7[_0x0f18('0x59')]['from']=util[_0x0f18('0xa3')](_0x0f18('0xac'),_0x585cbb['name'],_0x585cbb[_0x0f18('0xad')]||_0x585cbb['Smtp'][_0x0f18('0x70')]);}if(_0x37a7c7['body'][_0x0f18('0xae')]&&_0x37a7c7['body'][_0x0f18('0xae')]['length']){for(var _0x5d11e0=0x0;_0x5d11e0<_0x37a7c7[_0x0f18('0x59')][_0x0f18('0xae')][_0x0f18('0x48')];_0x5d11e0+=0x1){_0x37a7c7[_0x0f18('0x59')][_0x0f18('0xae')][_0x5d11e0]={'filename':_0x37a7c7[_0x0f18('0x59')][_0x0f18('0xae')][_0x5d11e0][_0x0f18('0x36')],'path':path[_0x0f18('0xaf')](config[_0x0f18('0xb0')],_0x0f18('0xb1'),_0x37a7c7[_0x0f18('0x59')]['attachments'][_0x5d11e0][_0x0f18('0xb2')])};}}var _0x170386={'tls':{'rejectUnauthorized':![]}};if(_[_0x0f18('0x6b')](_0x585cbb[_0x0f18('0x3a')][_0x0f18('0x76')])){if(_0x585cbb[_0x0f18('0x3a')]['authentication']){_0x170386[_0x0f18('0xb3')]={'user':_0x585cbb[_0x0f18('0x3a')][_0x0f18('0x70')],'pass':_0x585cbb[_0x0f18('0x3a')][_0x0f18('0x77')]};}_0x170386[_0x0f18('0x74')]=_0x585cbb[_0x0f18('0x3a')][_0x0f18('0x74')];_0x170386[_0x0f18('0x75')]=_0x585cbb[_0x0f18('0x3a')][_0x0f18('0x75')];_0x170386['secure']=_0x585cbb[_0x0f18('0x3a')]['secure'];}else{_0x170386[_0x0f18('0x76')]=_0x585cbb['Smtp'][_0x0f18('0x76')];_0x170386['auth']={'user':_0x585cbb[_0x0f18('0x3a')][_0x0f18('0x70')],'pass':_0x585cbb[_0x0f18('0x3a')]['pass']};}return respondWithRpcPromise('SendMail',_0x0f18('0xb4'),{'account':_0x170386,'message':_0x37a7c7[_0x0f18('0x59')]});}else{throw new Error('List\x20not\x20found');}}})[_0x0f18('0x1c')](function(_0x46557d){if(_0x46557d){_0x191db1=_0x46557d;if(_0xe73c9[_0x0f18('0xa7')]){if(_0xe73c9[_0x0f18('0xa7')][_0x0f18('0xa8')]['length']){return _0xe73c9[_0x0f18('0xa7')][_0x0f18('0xa8')][0x0];}else{return db[_0x0f18('0x89')]['create'](_[_0x0f18('0xb5')](_0x37a7c7['body'],{'firstName':_0x37a7c7[_0x0f18('0x59')]['to'],'email':_0x37a7c7['body']['to'],'phone':_0x37a7c7[_0x0f18('0x59')]['to'],'ListId':_0xe73c9[_0x0f18('0x6a')]}));}}else{throw new Error(_0x0f18('0xb6'));}}})[_0x0f18('0x1c')](function(_0xcb061f){if(_0xcb061f){var _0x13ba2d={'UserId':_0x37a7c7[_0x0f18('0x70')]['id'],'ContactId':_0xcb061f['id'],'MailAccountId':_0xe73c9['id'],'inReplyTo':_0x191db1['messageId'],'to':_0x37a7c7['body'][_0x0f18('0xab')],'cc':_0x37a7c7[_0x0f18('0x59')]['cc'],'subject':_0x37a7c7[_0x0f18('0x59')]['subject'],'attach':_0x37a7c7[_0x0f18('0x59')][_0x0f18('0xb7')],'firstMsgDirection':_0x0f18('0xb8'),'lastMsgAt':moment()['format'](_0x0f18('0xa4')),'lastMsgDirection':_0x0f18('0xb8'),'Messages':[_[_0x0f18('0x4e')](_0x37a7c7[_0x0f18('0x59')],{'messageId':_0x191db1['messageId'],'sentAt':moment()[_0x0f18('0xa3')](_0x0f18('0xa4')),'read':!![],'MailAccountId':_0xe73c9['id'],'UserId':_0x37a7c7[_0x0f18('0x70')]['id'],'ContactId':_0xcb061f['id']})]};if(_0x37a7c7[_0x0f18('0x59')][_0x0f18('0xb9')]){_0x13ba2d=_[_0x0f18('0x4e')](_0x13ba2d,_0x37a7c7[_0x0f18('0x59')]['Interaction']);}return db[_0x0f18('0x86')]['create'](_0x13ba2d,{'include':[{'model':db[_0x0f18('0xa0')],'as':_0x0f18('0xba')}]});}})[_0x0f18('0x1c')](respondWithResult(_0x4d127c,null))[_0x0f18('0x5a')](handleError(_0x4d127c,null));};exports[_0x0f18('0xbb')]=function(_0x37434c,_0x1a02bd,_0x1ea4f0){return db[_0x0f18('0x3d')][_0x0f18('0x58')]({'where':{'id':_0x37434c['params']['id']},'include':[{'model':db[_0x0f18('0x39')],'as':_0x0f18('0x3a'),'raw':!![]}]})[_0x0f18('0x1c')](handleEntityNotFound(_0x1a02bd,null))[_0x0f18('0x1c')](function(_0x2466a5){if(_0x2466a5&&_0x2466a5[_0x0f18('0x3a')]){var _0x423105={'id':_0x2466a5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2466a5[_0x0f18('0x3a')]['service']){_0x423105['service']=_0x2466a5['Smtp'][_0x0f18('0x76')];}else{_0x423105[_0x0f18('0x74')]=_0x2466a5[_0x0f18('0x3a')][_0x0f18('0x74')];_0x423105['port']=_0x2466a5[_0x0f18('0x3a')][_0x0f18('0x75')];_0x423105[_0x0f18('0xbc')]=_0x2466a5[_0x0f18('0x3a')]['secure'];}if(_0x2466a5[_0x0f18('0x3a')][_0x0f18('0x73')]){_0x423105[_0x0f18('0xb3')]={'user':_0x2466a5[_0x0f18('0x3a')][_0x0f18('0x70')],'pass':_0x2466a5[_0x0f18('0x3a')][_0x0f18('0x77')]};}return respondWithRpcPromise(_0x0f18('0xbd'),_0x0f18('0xbb'),{'account':_0x423105});}})[_0x0f18('0x1c')](respondWithResult(_0x1a02bd,null))[_0x0f18('0x5a')](handleError(_0x1a02bd,null));};exports[_0x0f18('0x31')]=function(_0x1a4100,_0x41f7bc){return db[_0x0f18('0x3d')][_0x0f18('0x58')]({'where':{'id':_0x1a4100[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x41f7bc,null))[_0x0f18('0x1c')](function(_0x1459f9){if(_0x1459f9&&_0x1459f9['service']){throw new db[(_0x0f18('0xbe'))][(_0x0f18('0xbf'))](_0x0f18('0xc0'));}return _0x1459f9;})[_0x0f18('0x1c')](removeEntity(_0x41f7bc,null))[_0x0f18('0x5a')](handleError(_0x41f7bc,null));};exports[_0x0f18('0xc1')]=function(_0x3ceaad,_0x4b9f6e,_0x5eb261){return db['MailAccount'][_0x0f18('0x58')]({'where':{'id':_0x3ceaad['params']['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x4b9f6e,null))[_0x0f18('0x1c')](function(_0x22eb5b){if(_0x22eb5b){return _0x22eb5b['addAgents'](_0x3ceaad[_0x0f18('0x59')][_0x0f18('0x65')],_[_0x0f18('0x87')](_0x3ceaad[_0x0f18('0x59')],[_0x0f18('0x65'),'id'])||{})[_0x0f18('0xc2')](function(_0x36e302){for(var _0x47d3f1=0x0;_0x47d3f1<_0x3ceaad['body'][_0x0f18('0x65')][_0x0f18('0x48')];_0x47d3f1+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x3ceaad[_0x0f18('0x59')][_0x0f18('0x65')][_0x47d3f1]),'MailAccountId':Number(_0x3ceaad[_0x0f18('0x56')]['id'])});}return _0x36e302;});}})['then'](respondWithResult(_0x4b9f6e,null))['catch'](handleError(_0x4b9f6e,null));};exports[_0x0f18('0xc3')]=function(_0x2a303e,_0x375864,_0x3eeb52){return db['MailAccount']['find']({'where':{'id':_0x2a303e[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0x375864,null))[_0x0f18('0x1c')](function(_0x12a89a){if(_0x12a89a){return _0x12a89a[_0x0f18('0xc3')](_0x2a303e[_0x0f18('0x42')]['ids'])[_0x0f18('0x1c')](function(){if(_[_0x0f18('0xc4')](_0x2a303e[_0x0f18('0x42')][_0x0f18('0x65')])){for(var _0x28fe39=0x0;_0x28fe39<_0x2a303e[_0x0f18('0x42')][_0x0f18('0x65')][_0x0f18('0x48')];_0x28fe39+=0x1){socket['emit'](_0x0f18('0xc5'),{'UserId':Number(_0x2a303e[_0x0f18('0x42')][_0x0f18('0x65')][_0x28fe39]),'MailAccountId':Number(_0x2a303e[_0x0f18('0x56')]['id'])});}}else{socket[_0x0f18('0xc6')](_0x0f18('0xc5'),{'UserId':Number(_0x2a303e[_0x0f18('0x42')][_0x0f18('0x65')]),'MailAccountId':Number(_0x2a303e[_0x0f18('0x56')]['id'])});}});}})[_0x0f18('0x1c')](respondWithStatusCode(_0x375864,null))[_0x0f18('0x5a')](handleError(_0x375864,null));};exports[_0x0f18('0xc7')]=function(_0x13e038,_0xf336f7,_0x45b692){var _0x1b2846={};var _0x352c7b={};var _0x38b39e;var _0x43e0f0;return db[_0x0f18('0x3d')][_0x0f18('0x68')]({'where':{'id':_0x13e038[_0x0f18('0x56')]['id']}})[_0x0f18('0x1c')](handleEntityNotFound(_0xf336f7,null))[_0x0f18('0x1c')](function(_0xbba882){if(_0xbba882){_0x38b39e=_0xbba882;_0x352c7b['model']=_[_0x0f18('0x43')](db['User'][_0x0f18('0x3e')]);_0x352c7b[_0x0f18('0x42')]=_[_0x0f18('0x43')](_0x13e038[_0x0f18('0x42')]);_0x352c7b['filters']=_[_0x0f18('0x44')](_0x352c7b[_0x0f18('0x45')],_0x352c7b['query']);_0x1b2846[_0x0f18('0x46')]=_['intersection'](_0x352c7b[_0x0f18('0x45')],qs[_0x0f18('0x47')](_0x13e038[_0x0f18('0x42')][_0x0f18('0x47')]));_0x1b2846['attributes']=_0x1b2846[_0x0f18('0x46')][_0x0f18('0x48')]?_0x1b2846[_0x0f18('0x46')]:_0x352c7b['model'];_0x1b2846[_0x0f18('0x49')]=qs[_0x0f18('0x4a')](_0x13e038[_0x0f18('0x42')]['sort']);_0x1b2846[_0x0f18('0x4b')]=qs[_0x0f18('0x4c')](_[_0x0f18('0x62')](_0x13e038[_0x0f18('0x42')],_0x352c7b['filters']));if(_0x13e038[_0x0f18('0x42')]['filter']){_0x1b2846[_0x0f18('0x4b')]=_[_0x0f18('0x4e')](_0x1b2846[_0x0f18('0x4b')],{'$or':_[_0x0f18('0x41')](_0x1b2846[_0x0f18('0x46')],function(_0x268808){var _0x1dc84b={};_0x1dc84b[_0x268808]={'$like':'%'+_0x13e038[_0x0f18('0x42')][_0x0f18('0x4d')]+'%'};return _0x1dc84b;})});}_0x1b2846=_[_0x0f18('0x4e')]({},_0x1b2846,_0x13e038[_0x0f18('0x51')]);return _0x38b39e[_0x0f18('0xc7')](_0x1b2846);}})[_0x0f18('0x1c')](function(_0x105ce2){if(_0x105ce2){_0x43e0f0=_0x105ce2[_0x0f18('0x48')];if(!_0x13e038[_0x0f18('0x42')]['hasOwnProperty'](_0x0f18('0x61'))){_0x1b2846['limit']=qs[_0x0f18('0x2b')](_0x13e038['query'][_0x0f18('0x2b')]);_0x1b2846['offset']=qs['offset'](_0x13e038['query'][_0x0f18('0x29')]);}return _0x38b39e[_0x0f18('0xc7')](_0x1b2846);}})[_0x0f18('0x1c')](function(_0x4458c8){if(_0x4458c8){return _0x4458c8?{'count':_0x43e0f0,'rows':_0x4458c8}:null;}})['then'](respondWithResult(_0xf336f7,null))[_0x0f18('0x5a')](handleError(_0xf336f7,null));}; \ No newline at end of file +var _0xd030=['redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','MailAccounts','UserProfileResource','end','index','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','Smtp','keys','include','find','MailServerIn','body','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','stack','send','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','DESC','from','attachments','join','server/files/attachments','auth','port','secure','SendMail','List\x20not\x20found','List','subject','attach','format','messageId','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xb72117,_0x349096){var _0xeb1f7e=function(_0x4df89f){while(--_0x4df89f){_0xb72117['push'](_0xb72117['shift']());}};_0xeb1f7e(++_0x349096);}(_0xd030,0x16c));var _0x0d03=function(_0x3ee38d,_0x1b6fa8){_0x3ee38d=_0x3ee38d-0x0;var _0x2123e7=_0xd030[_0x3ee38d];return _0x2123e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d03('0x1'));var rp=require(_0x0d03('0x2'));var moment=require(_0x0d03('0x3'));var BPromise=require(_0x0d03('0x4'));var Mustache=require(_0x0d03('0x5'));var util=require(_0x0d03('0x6'));var path=require(_0x0d03('0x7'));var sox=require(_0x0d03('0x8'));var csv=require('to-csv');var ejs=require(_0x0d03('0x9'));var fs=require('fs');var fs_extra=require(_0x0d03('0xa'));var _=require('lodash');var squel=require(_0x0d03('0xb'));var crypto=require('crypto');var jsforce=require(_0x0d03('0xc'));var deskjs=require(_0x0d03('0xd'));var toCsv=require(_0x0d03('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require('html-to-text');var juice=require(_0x0d03('0xf'));var Redis=require(_0x0d03('0x10'));var authService=require(_0x0d03('0x11'));var qs=require(_0x0d03('0x12'));var as=require(_0x0d03('0x13'));var hardwareService=require(_0x0d03('0x14'));var logger=require(_0x0d03('0x15'))(_0x0d03('0x16'));var utils=require(_0x0d03('0x17'));var config=require(_0x0d03('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d03('0x19'))['db'];config[_0x0d03('0x1a')]=_[_0x0d03('0x1b')](config['redis'],{'host':_0x0d03('0x1c'),'port':0x18eb});var socket=require(_0x0d03('0x1d'))(new Redis(config[_0x0d03('0x1a')]));require('./mailAccount.socket')[_0x0d03('0x1e')](socket);var jayson=require(_0x0d03('0x1f'));var client=jayson[_0x0d03('0x20')][_0x0d03('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x57dc67,_0x40ec9b,_0x196e09,_0x1e4a8b){return new BPromise(function(_0x56b891,_0xbff535){var _0x120fe8=_0x1e4a8b||client;return _0x120fe8[_0x0d03('0x22')](_0x57dc67,_0x196e09)[_0x0d03('0x23')](function(_0x310dd6){logger[_0x0d03('0x24')](_0x0d03('0x25'),_0x40ec9b,_0x0d03('0x26'));logger[_0x0d03('0x27')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x40ec9b,_0x0d03('0x26'),JSON[_0x0d03('0x28')](_0x310dd6));if(_0x310dd6[_0x0d03('0x29')]){if(_0x310dd6['error'][_0x0d03('0x2a')]===0x1f4){logger['error'](_0x0d03('0x25'),_0x40ec9b,_0x310dd6[_0x0d03('0x29')][_0x0d03('0x2b')]);return _0xbff535(_0x310dd6[_0x0d03('0x29')][_0x0d03('0x2b')]);}logger[_0x0d03('0x29')](_0x0d03('0x25'),_0x40ec9b,_0x310dd6[_0x0d03('0x29')][_0x0d03('0x2b')]);return _0x56b891(_0x310dd6[_0x0d03('0x29')]['message']);}else{logger[_0x0d03('0x24')]('MailAccount,\x20%s,\x20%s',_0x40ec9b,_0x0d03('0x26'));_0x56b891(_0x310dd6['result'][_0x0d03('0x2b')]);}})['catch'](function(_0x507ef7){logger[_0x0d03('0x29')]('MailAccount,\x20%s,\x20%s',_0x40ec9b,_0x507ef7);_0xbff535(_0x507ef7);});});}function respondWithStatusCode(_0xe67bb2,_0x275554){_0x275554=_0x275554||0xcc;return function(_0x51fe7e){if(_0x51fe7e){return _0xe67bb2[_0x0d03('0x2c')](_0x275554);}return _0xe67bb2[_0x0d03('0x2d')](_0x275554)['end']();};}function respondWithResult(_0x38c62b,_0x34dcd6){_0x34dcd6=_0x34dcd6||0xc8;return function(_0x104b4e){if(_0x104b4e){return _0x38c62b[_0x0d03('0x2d')](_0x34dcd6)[_0x0d03('0x2e')](_0x104b4e);}};}function respondWithFilteredResult(_0x198318,_0x4ebc9c){return function(_0x467fd3){if(_0x467fd3){var _0x2b8827=typeof _0x4ebc9c[_0x0d03('0x2f')]===_0x0d03('0x30')&&typeof _0x4ebc9c[_0x0d03('0x31')]==='undefined';var _0x4d41fa=_0x467fd3['count'];var _0x8ce938=_0x2b8827?0x0:_0x4ebc9c[_0x0d03('0x2f')];var _0x348cc5=_0x2b8827?_0x467fd3[_0x0d03('0x32')]:_0x4ebc9c['offset']+_0x4ebc9c[_0x0d03('0x31')];var _0x4b7fbe;if(_0x348cc5>=_0x4d41fa){_0x348cc5=_0x4d41fa;_0x4b7fbe=0xc8;}else{_0x4b7fbe=0xce;}_0x198318[_0x0d03('0x2d')](_0x4b7fbe);return _0x198318[_0x0d03('0x33')]('Content-Range',_0x8ce938+'-'+_0x348cc5+'/'+_0x4d41fa)[_0x0d03('0x2e')](_0x467fd3);}return null;};}function patchUpdates(_0x255b83){return function(_0x58b545){try{jsonpatch['apply'](_0x58b545,_0x255b83,!![]);}catch(_0x261e67){return BPromise[_0x0d03('0x34')](_0x261e67);}return _0x58b545[_0x0d03('0x35')]();};}function saveUpdates(_0x4b35e5,_0x52d31c){return function(_0x1b5284){if(_0x1b5284){return _0x1b5284[_0x0d03('0x36')](_0x4b35e5)['then'](function(_0x50d1bd){return _0x50d1bd;});}return null;};}function removeEntity(_0x268555,_0xe02224){return function(_0x1dbeeb){if(_0x1dbeeb){return _0x1dbeeb[_0x0d03('0x37')]()['then'](function(){var _0x3097c2=_0x1dbeeb[_0x0d03('0x38')]({'plain':!![]});var _0x5bcab1=_0x0d03('0x39');return db[_0x0d03('0x3a')][_0x0d03('0x37')]({'where':{'type':_0x5bcab1,'resourceId':_0x3097c2['id']}})[_0x0d03('0x23')](function(){return _0x1dbeeb;});})[_0x0d03('0x23')](function(){_0x268555[_0x0d03('0x2d')](0xcc)[_0x0d03('0x3b')]();});}};}function handleEntityNotFound(_0x4a9cf1,_0x1d2e62){return function(_0x41b4a5){if(!_0x41b4a5){_0x4a9cf1[_0x0d03('0x2c')](0x194);}return _0x41b4a5;};}function handleError(_0x33ec64,_0xcde3fe){_0xcde3fe=_0xcde3fe||0x1f4;return function(_0x48066c){logger[_0x0d03('0x29')](_0x48066c['stack']);if(_0x48066c['name']){delete _0x48066c['name'];}_0x33ec64[_0x0d03('0x2d')](_0xcde3fe)['send'](_0x48066c);};}exports[_0x0d03('0x3c')]=function(_0x4e410f,_0x3f590e){var _0x223e69={'include':[{'model':db['MailServerIn'],'as':_0x0d03('0x3d')},{'model':db[_0x0d03('0x3e')],'as':'Smtp'},{'model':db[_0x0d03('0x3f')],'as':_0x0d03('0x40')}]},_0x5ed22a={},_0x3bfdc3={'count':0x0,'rows':[]};var _0x2564e6=_[_0x0d03('0x41')](db[_0x0d03('0x42')][_0x0d03('0x43')],function(_0x5eae8e){return{'name':_0x5eae8e[_0x0d03('0x44')],'type':_0x5eae8e[_0x0d03('0x45')][_0x0d03('0x46')]};});_0x5ed22a[_0x0d03('0x47')]=_[_0x0d03('0x41')](_0x2564e6,_0x0d03('0x48'));_0x5ed22a[_0x0d03('0x49')]=_['keys'](_0x4e410f[_0x0d03('0x49')]);_0x5ed22a[_0x0d03('0x4a')]=_[_0x0d03('0x4b')](_0x5ed22a[_0x0d03('0x47')],_0x5ed22a['query']);_0x223e69['attributes']=_[_0x0d03('0x4b')](_0x5ed22a[_0x0d03('0x47')],qs['fields'](_0x4e410f[_0x0d03('0x49')][_0x0d03('0x4c')]));_0x223e69[_0x0d03('0x4d')]=_0x223e69[_0x0d03('0x4d')][_0x0d03('0x4e')]?_0x223e69[_0x0d03('0x4d')]:_0x5ed22a[_0x0d03('0x47')];if(!_0x4e410f[_0x0d03('0x49')][_0x0d03('0x4f')](_0x0d03('0x50'))){_0x223e69[_0x0d03('0x31')]=qs[_0x0d03('0x31')](_0x4e410f[_0x0d03('0x49')][_0x0d03('0x31')]);_0x223e69[_0x0d03('0x2f')]=qs[_0x0d03('0x2f')](_0x4e410f['query'][_0x0d03('0x2f')]);}_0x223e69[_0x0d03('0x51')]=qs[_0x0d03('0x52')](_0x4e410f['query']['sort']);_0x223e69[_0x0d03('0x53')]=qs[_0x0d03('0x4a')](_[_0x0d03('0x54')](_0x4e410f['query'],_0x5ed22a[_0x0d03('0x4a')]),_0x2564e6);if(_0x4e410f[_0x0d03('0x49')][_0x0d03('0x55')]){_0x223e69[_0x0d03('0x53')]=_[_0x0d03('0x56')](_0x223e69[_0x0d03('0x53')],{'$or':_[_0x0d03('0x41')](_0x2564e6,function(_0x38df6e){if(_0x38df6e[_0x0d03('0x45')]!==_0x0d03('0x57')){var _0x7c25a6={};_0x7c25a6[_0x38df6e[_0x0d03('0x48')]]={'$like':'%'+_0x4e410f['query'][_0x0d03('0x55')]+'%'};return _0x7c25a6;}})});}_0x223e69=_[_0x0d03('0x56')]({},_0x223e69,_0x4e410f[_0x0d03('0x58')]);var _0x2cd7e1={'where':_0x223e69['where']};return db[_0x0d03('0x42')]['count'](_0x2cd7e1)[_0x0d03('0x23')](function(_0x4041de){_0x3bfdc3[_0x0d03('0x32')]=_0x4041de;if(_0x4e410f['query'][_0x0d03('0x59')]){_0x223e69['include']=[{'all':!![]}];}return db[_0x0d03('0x42')][_0x0d03('0x5a')](_0x223e69);})['then'](function(_0x472644){_0x3bfdc3[_0x0d03('0x5b')]=_0x472644;return _0x3bfdc3;})[_0x0d03('0x23')](respondWithFilteredResult(_0x3f590e,_0x223e69))[_0x0d03('0x5c')](handleError(_0x3f590e,null));};exports['show']=function(_0x9b127e,_0x314a31){var _0x2ea269={'raw':![],'where':{'id':_0x9b127e[_0x0d03('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x0d03('0x3d')},{'model':db[_0x0d03('0x3e')],'as':_0x0d03('0x5e')},{'model':db['Pause'],'as':_0x0d03('0x40')}]},_0x2b0715={};_0x2b0715[_0x0d03('0x47')]=_[_0x0d03('0x5f')](db['MailAccount'][_0x0d03('0x43')]);_0x2b0715[_0x0d03('0x49')]=_[_0x0d03('0x5f')](_0x9b127e[_0x0d03('0x49')]);_0x2b0715[_0x0d03('0x4a')]=_['intersection'](_0x2b0715['model'],_0x2b0715[_0x0d03('0x49')]);_0x2ea269[_0x0d03('0x4d')]=_['intersection'](_0x2b0715['model'],qs[_0x0d03('0x4c')](_0x9b127e[_0x0d03('0x49')][_0x0d03('0x4c')]));_0x2ea269[_0x0d03('0x4d')]=_0x2ea269[_0x0d03('0x4d')][_0x0d03('0x4e')]?_0x2ea269[_0x0d03('0x4d')]:_0x2b0715[_0x0d03('0x47')];if(_0x9b127e[_0x0d03('0x49')][_0x0d03('0x59')]){_0x2ea269[_0x0d03('0x60')]=[{'all':!![]}];}_0x2ea269=_[_0x0d03('0x56')]({},_0x2ea269,_0x9b127e[_0x0d03('0x58')]);return db[_0x0d03('0x42')][_0x0d03('0x61')](_0x2ea269)['then'](handleEntityNotFound(_0x314a31,null))[_0x0d03('0x23')](respondWithResult(_0x314a31,null))[_0x0d03('0x5c')](handleError(_0x314a31,null));};exports[_0x0d03('0x36')]=function(_0x41d4be,_0xdd576b){if(_0x41d4be['body']['id']){delete _0x41d4be['body']['id'];}return db['MailAccount'][_0x0d03('0x61')]({'where':{'id':_0x41d4be[_0x0d03('0x5d')]['id']},'include':[{'model':db[_0x0d03('0x62')],'as':_0x0d03('0x3d')},{'model':db[_0x0d03('0x3e')],'as':_0x0d03('0x5e')},{'model':db['Pause'],'as':_0x0d03('0x40')}]})[_0x0d03('0x23')](handleEntityNotFound(_0xdd576b,null))[_0x0d03('0x23')](saveUpdates(_0x41d4be['body'],null))['then'](function(_0x11db4e){if(_0x11db4e&&_0x41d4be['body'][_0x0d03('0x3d')]){return db[_0x0d03('0x62')][_0x0d03('0x36')](_0x41d4be[_0x0d03('0x63')]['Imap'],{'where':{'MailAccountId':_0x11db4e['id']}})[_0x0d03('0x23')](function(){return _0x11db4e;});}return _0x11db4e;})[_0x0d03('0x23')](function(_0x4d8bcd){if(_0x4d8bcd&&_0x41d4be['body'][_0x0d03('0x5e')]){return db[_0x0d03('0x3e')][_0x0d03('0x36')](_0x41d4be[_0x0d03('0x63')][_0x0d03('0x5e')],{'where':{'MailAccountId':_0x4d8bcd['id']}})[_0x0d03('0x23')](function(){return _0x4d8bcd;});}return _0x4d8bcd;})[_0x0d03('0x23')](respondWithResult(_0xdd576b,null))['catch'](handleError(_0xdd576b,null));};exports['describe']=function(_0x1615a9,_0x80cda4){return db['MailAccount'][_0x0d03('0x64')]()[_0x0d03('0x23')](respondWithResult(_0x80cda4,null))['catch'](handleError(_0x80cda4,null));};exports[_0x0d03('0x65')]=function(_0x481a7b,_0x254439,_0x19cb0f){if(_0x481a7b[_0x0d03('0x63')]['id']){delete _0x481a7b['body']['id'];}return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x481a7b[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x254439,null))[_0x0d03('0x23')](function(_0x2f5479){if(_0x2f5479){_0x481a7b[_0x0d03('0x63')][_0x0d03('0x66')]=_0x2f5479['id'];return db['Disposition'][_0x0d03('0x67')](_0x481a7b[_0x0d03('0x63')]);}})['then'](respondWithResult(_0x254439,null))['catch'](handleError(_0x254439,null));};exports[_0x0d03('0x68')]=function(_0x50e4fc,_0x329c7d,_0x4e6be0){var _0x25e0a4={'raw':![],'where':{}};var _0x2428e3={};var _0x449341={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x50e4fc[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x329c7d,null))['then'](function(_0x509c0f){if(_0x509c0f){_0x2428e3[_0x0d03('0x47')]=_[_0x0d03('0x5f')](db['Disposition'][_0x0d03('0x43')]);_0x2428e3[_0x0d03('0x49')]=_['keys'](_0x50e4fc['query']);_0x2428e3[_0x0d03('0x4a')]=_['intersection'](_0x2428e3[_0x0d03('0x47')],_0x2428e3[_0x0d03('0x49')]);_0x25e0a4['attributes']=_[_0x0d03('0x4b')](_0x2428e3['model'],qs['fields'](_0x50e4fc[_0x0d03('0x49')][_0x0d03('0x4c')]));_0x25e0a4['attributes']=_0x25e0a4['attributes'][_0x0d03('0x4e')]?_0x25e0a4[_0x0d03('0x4d')]:_0x2428e3['model'];if(!_0x50e4fc['query'][_0x0d03('0x4f')](_0x0d03('0x50'))){_0x25e0a4[_0x0d03('0x31')]=qs[_0x0d03('0x31')](_0x50e4fc[_0x0d03('0x49')]['limit']);_0x25e0a4[_0x0d03('0x2f')]=qs[_0x0d03('0x2f')](_0x50e4fc['query'][_0x0d03('0x2f')]);}_0x25e0a4['order']=qs['sort'](_0x50e4fc[_0x0d03('0x49')][_0x0d03('0x52')]);_0x25e0a4[_0x0d03('0x53')]=qs['filters'](_[_0x0d03('0x54')](_0x50e4fc[_0x0d03('0x49')],_0x2428e3[_0x0d03('0x4a')]));_0x25e0a4[_0x0d03('0x53')]['MailAccountId']=_0x509c0f['id'];if(_0x50e4fc['query'][_0x0d03('0x55')]){_0x25e0a4[_0x0d03('0x53')]=_['merge'](_0x25e0a4['where'],{'$or':_[_0x0d03('0x41')](_0x25e0a4[_0x0d03('0x4d')],function(_0x16c226){var _0x5ba021={};_0x5ba021[_0x16c226]={'$like':'%'+_0x50e4fc[_0x0d03('0x49')][_0x0d03('0x55')]+'%'};return _0x5ba021;})});}_0x25e0a4=_['merge']({},_0x25e0a4,_0x50e4fc[_0x0d03('0x58')]);return db[_0x0d03('0x69')][_0x0d03('0x32')]({'where':_0x25e0a4['where']})[_0x0d03('0x23')](function(_0x2171a2){_0x449341[_0x0d03('0x32')]=_0x2171a2;if(_0x50e4fc[_0x0d03('0x49')][_0x0d03('0x59')]){_0x25e0a4['include']=[{'all':!![]}];}return db[_0x0d03('0x69')]['findAll'](_0x25e0a4);})[_0x0d03('0x23')](function(_0x52f214){_0x449341[_0x0d03('0x5b')]=_0x52f214;return _0x449341;});}})[_0x0d03('0x23')](respondWithFilteredResult(_0x329c7d,_0x25e0a4))[_0x0d03('0x5c')](handleError(_0x329c7d,null));};exports[_0x0d03('0x6a')]=function(_0x104acb,_0x414ca1,_0x36c678){return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x104acb[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x414ca1,null))[_0x0d03('0x23')](function(_0x3d6c7a){if(_0x3d6c7a){return _0x3d6c7a[_0x0d03('0x6a')](_0x104acb['query'][_0x0d03('0x6b')]);}})['then'](respondWithStatusCode(_0x414ca1,null))[_0x0d03('0x5c')](handleError(_0x414ca1,null));};exports[_0x0d03('0x6c')]=function(_0x261559,_0x4ccd61,_0xd5aa61){if(_0x261559[_0x0d03('0x63')]['id']){delete _0x261559[_0x0d03('0x63')]['id'];}return db[_0x0d03('0x42')]['find']({'where':{'id':_0x261559[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x4ccd61,null))[_0x0d03('0x23')](function(_0x5ef757){if(_0x5ef757){_0x261559['body'][_0x0d03('0x66')]=_0x5ef757['id'];return db[_0x0d03('0x6d')][_0x0d03('0x67')](_0x261559[_0x0d03('0x63')]);}})[_0x0d03('0x23')](respondWithResult(_0x4ccd61,null))['catch'](handleError(_0x4ccd61,null));};exports[_0x0d03('0x6e')]=function(_0x1aa41c,_0x179bc7,_0x16b6bc){var _0xcce016={'raw':![],'where':{}};var _0x38ee3f={};var _0x4dcd60={'count':0x0,'rows':[]};return db[_0x0d03('0x42')][_0x0d03('0x6f')]({'where':{'id':_0x1aa41c['params']['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x179bc7,null))[_0x0d03('0x23')](function(_0x2b3661){if(_0x2b3661){_0x38ee3f[_0x0d03('0x47')]=_[_0x0d03('0x5f')](db[_0x0d03('0x6d')][_0x0d03('0x43')]);_0x38ee3f[_0x0d03('0x49')]=_['keys'](_0x1aa41c['query']);_0x38ee3f[_0x0d03('0x4a')]=_[_0x0d03('0x4b')](_0x38ee3f[_0x0d03('0x47')],_0x38ee3f[_0x0d03('0x49')]);_0xcce016['attributes']=_[_0x0d03('0x4b')](_0x38ee3f['model'],qs[_0x0d03('0x4c')](_0x1aa41c[_0x0d03('0x49')][_0x0d03('0x4c')]));_0xcce016[_0x0d03('0x4d')]=_0xcce016[_0x0d03('0x4d')][_0x0d03('0x4e')]?_0xcce016[_0x0d03('0x4d')]:_0x38ee3f['model'];if(!_0x1aa41c['query'][_0x0d03('0x4f')](_0x0d03('0x50'))){_0xcce016[_0x0d03('0x31')]=qs[_0x0d03('0x31')](_0x1aa41c[_0x0d03('0x49')][_0x0d03('0x31')]);_0xcce016[_0x0d03('0x2f')]=qs[_0x0d03('0x2f')](_0x1aa41c[_0x0d03('0x49')][_0x0d03('0x2f')]);}_0xcce016[_0x0d03('0x51')]=qs[_0x0d03('0x52')](_0x1aa41c[_0x0d03('0x49')][_0x0d03('0x52')]);_0xcce016[_0x0d03('0x53')]=qs['filters'](_[_0x0d03('0x54')](_0x1aa41c[_0x0d03('0x49')],_0x38ee3f[_0x0d03('0x4a')]));_0xcce016[_0x0d03('0x53')][_0x0d03('0x66')]=_0x2b3661['id'];if(_0x1aa41c[_0x0d03('0x49')][_0x0d03('0x55')]){_0xcce016[_0x0d03('0x53')]=_['merge'](_0xcce016[_0x0d03('0x53')],{'$or':_[_0x0d03('0x41')](_0xcce016[_0x0d03('0x4d')],function(_0x298175){var _0xaa193e={};_0xaa193e[_0x298175]={'$like':'%'+_0x1aa41c['query'][_0x0d03('0x55')]+'%'};return _0xaa193e;})});}_0xcce016=_[_0x0d03('0x56')]({},_0xcce016,_0x1aa41c['options']);return db[_0x0d03('0x6d')][_0x0d03('0x32')]({'where':_0xcce016[_0x0d03('0x53')]})[_0x0d03('0x23')](function(_0x9c0d19){_0x4dcd60[_0x0d03('0x32')]=_0x9c0d19;if(_0x1aa41c[_0x0d03('0x49')]['includeAll']){_0xcce016[_0x0d03('0x60')]=[{'all':!![]}];}return db[_0x0d03('0x6d')][_0x0d03('0x5a')](_0xcce016);})[_0x0d03('0x23')](function(_0x4db0c8){_0x4dcd60['rows']=_0x4db0c8;return _0x4dcd60;});}})[_0x0d03('0x23')](respondWithFilteredResult(_0x179bc7,_0xcce016))[_0x0d03('0x5c')](handleError(_0x179bc7,null));};exports[_0x0d03('0x70')]=function(_0x2887c4,_0x395949,_0x1a6481){return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x2887c4[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x395949,null))[_0x0d03('0x23')](function(_0x395ea5){if(_0x395ea5){return _0x395ea5[_0x0d03('0x70')](_0x2887c4[_0x0d03('0x49')][_0x0d03('0x6b')]);}})[_0x0d03('0x23')](respondWithStatusCode(_0x395949,null))[_0x0d03('0x5c')](handleError(_0x395949,null));};exports[_0x0d03('0x67')]=function(_0x4f7ddc,_0xfe180f){var _0x564075={'name':_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x48')],'key':_0x4f7ddc[_0x0d03('0x63')]['key'],'email':_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x71')],'ListId':_0x4f7ddc[_0x0d03('0x63')]['ListId'],'active':!_[_0x0d03('0x72')](_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x73')])?_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x73')]:!![],'description':_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x0d03('0x72')](_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x75')])){if(_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x76')]){_0x564075[_0x0d03('0x3d')]['user']=_0x564075[_0x0d03('0x5e')][_0x0d03('0x77')]=_0x4f7ddc['body'][_0x0d03('0x78')];_0x564075[_0x0d03('0x3d')][_0x0d03('0x79')]=_0x564075[_0x0d03('0x5e')][_0x0d03('0x7a')]=_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x7b')];}else{_0x564075[_0x0d03('0x3d')][_0x0d03('0x7c')]=_0x564075['Smtp'][_0x0d03('0x7c')]=![];}_0x564075[_0x0d03('0x3d')]['host']=_0x4f7ddc['body'][_0x0d03('0x3d')][_0x0d03('0x7d')];_0x564075[_0x0d03('0x3d')]['port']=_0x4f7ddc[_0x0d03('0x63')]['Imap']['port'];_0x564075['Smtp']['host']=_0x4f7ddc['body'][_0x0d03('0x5e')][_0x0d03('0x7d')];_0x564075[_0x0d03('0x5e')]['port']=_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x5e')]['port'];}else{_0x564075[_0x0d03('0x3d')][_0x0d03('0x7e')]=_0x564075['Smtp']['service']=_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x75')];_0x564075[_0x0d03('0x3d')][_0x0d03('0x77')]=_0x564075['Smtp'][_0x0d03('0x77')]=_0x4f7ddc[_0x0d03('0x63')][_0x0d03('0x78')];_0x564075['Imap'][_0x0d03('0x79')]=_0x564075[_0x0d03('0x5e')]['pass']=_0x4f7ddc['body'][_0x0d03('0x7b')];}return db[_0x0d03('0x42')][_0x0d03('0x67')](_0x564075,{'include':[{'model':db[_0x0d03('0x3e')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x0d03('0x3d')}]})[_0x0d03('0x23')](function(_0x276875){var _0x1809ef=_0x4f7ddc['user'][_0x0d03('0x38')]({'plain':!![]});if(!_0x1809ef)throw new Error(_0x0d03('0x7f'));if(_0x1809ef['role']===_0x0d03('0x77')){var _0x11e79e=_0x276875['get']({'plain':!![]});return db[_0x0d03('0x80')]['find']({'where':{'name':_0x0d03('0x39'),'userProfileId':_0x1809ef['userProfileId']},'raw':!![]})['then'](function(_0x508fd2){if(_0x508fd2&&_0x508fd2[_0x0d03('0x81')]===0x0){return db[_0x0d03('0x3a')][_0x0d03('0x67')]({'name':_0x11e79e[_0x0d03('0x48')],'resourceId':_0x11e79e['id'],'type':_0x508fd2[_0x0d03('0x48')],'sectionId':_0x508fd2['id']},{})['then'](function(){return _0x276875;});}else{return _0x276875;}})['catch'](function(_0x56fb36){logger['error'](_0x0d03('0x82'),_0x56fb36);throw _0x56fb36;});}return _0x276875;})[_0x0d03('0x23')](respondWithResult(_0xfe180f,0xc9))[_0x0d03('0x5c')](handleError(_0xfe180f,null));};exports['getImap']=function(_0x274fd9,_0x106020,_0x164b29){return db[_0x0d03('0x42')][_0x0d03('0x6f')]({'where':{'id':_0x274fd9[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x106020,null))[_0x0d03('0x23')](function(_0xd0beea){if(_0xd0beea){return _0xd0beea[_0x0d03('0x83')]();}return null;})[_0x0d03('0x23')](respondWithResult(_0x106020,null))['catch'](handleError(_0x106020,null));};exports['addImap']=function(_0x51a728,_0x12e3af,_0x5bd4be){if(_0x51a728[_0x0d03('0x63')]['id']){delete _0x51a728[_0x0d03('0x63')]['id'];}return db[_0x0d03('0x42')]['find']({'where':{'id':_0x51a728[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x12e3af,null))[_0x0d03('0x23')](function(_0x32f776){if(_0x32f776){_0x51a728[_0x0d03('0x63')][_0x0d03('0x66')]=_0x32f776['id'];return db[_0x0d03('0x62')][_0x0d03('0x67')](_0x51a728['body']);}})[_0x0d03('0x23')](respondWithResult(_0x12e3af,null))['catch'](handleError(_0x12e3af,null));};exports[_0x0d03('0x84')]=function(_0x56e0e0,_0x334905,_0x286b10){return db[_0x0d03('0x42')][_0x0d03('0x6f')]({'where':{'id':_0x56e0e0[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x334905,null))[_0x0d03('0x23')](function(_0x25e5ed){if(_0x25e5ed){return _0x25e5ed[_0x0d03('0x85')](null);}return null;})[_0x0d03('0x23')](respondWithStatusCode(_0x334905,null))['catch'](handleError(_0x334905,null));};exports[_0x0d03('0x86')]=function(_0x158430,_0x25d835,_0x46f854){return db[_0x0d03('0x42')][_0x0d03('0x6f')]({'where':{'id':_0x158430[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x25d835,null))[_0x0d03('0x23')](function(_0x2ebf53){if(_0x2ebf53){return _0x2ebf53['getSmtp']();}return null;})[_0x0d03('0x23')](respondWithResult(_0x25d835,null))[_0x0d03('0x5c')](handleError(_0x25d835,null));};exports[_0x0d03('0x87')]=function(_0x361f42,_0x125cd6,_0x27dd2b){if(_0x361f42[_0x0d03('0x63')]['id']){delete _0x361f42[_0x0d03('0x63')]['id'];}return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x361f42[_0x0d03('0x5d')]['id']}})['then'](handleEntityNotFound(_0x125cd6,null))[_0x0d03('0x23')](function(_0xaf2d0e){if(_0xaf2d0e){_0x361f42['body'][_0x0d03('0x66')]=_0xaf2d0e['id'];return db['MailServerOut'][_0x0d03('0x67')](_0x361f42['body']);}})[_0x0d03('0x23')](respondWithResult(_0x125cd6,null))[_0x0d03('0x5c')](handleError(_0x125cd6,null));};exports[_0x0d03('0x88')]=function(_0x3b3eac,_0x4c37c6,_0x5939c9){return db[_0x0d03('0x42')][_0x0d03('0x6f')]({'where':{'id':_0x3b3eac[_0x0d03('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4c37c6,null))[_0x0d03('0x23')](function(_0x369a59){if(_0x369a59){return _0x369a59[_0x0d03('0x89')](null);}return null;})[_0x0d03('0x23')](respondWithStatusCode(_0x4c37c6,null))[_0x0d03('0x5c')](handleError(_0x4c37c6,null));};exports[_0x0d03('0x8a')]=function(_0x51c574,_0x595ff0,_0x4f9b6a){return db[_0x0d03('0x8b')]['find']({'where':{'id':_0x51c574[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x595ff0,null))['then'](function(_0x1a1645){if(_0x1a1645){return _0x1a1645['addInteraction'](_0x51c574[_0x0d03('0x63')][_0x0d03('0x6b')],_[_0x0d03('0x8c')](_0x51c574['body'],[_0x0d03('0x6b'),'id'])||{});}})[_0x0d03('0x23')](respondWithResult(_0x595ff0,null))[_0x0d03('0x5c')](handleError(_0x595ff0,null));};exports[_0x0d03('0x8d')]=function(_0x3b302f,_0x13270b,_0x1e6cdc){var _0x215241={'raw':![],'where':{}};var _0xa4560d={};var _0x51fc66={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3b302f[_0x0d03('0x5d')]['id']}})['then'](handleEntityNotFound(_0x13270b,null))['then'](function(_0x4cef56){if(_0x4cef56){_0xa4560d[_0x0d03('0x47')]=_[_0x0d03('0x5f')](db[_0x0d03('0x8b')][_0x0d03('0x43')]);_0xa4560d[_0x0d03('0x49')]=_[_0x0d03('0x5f')](_0x3b302f[_0x0d03('0x49')]);_0xa4560d[_0x0d03('0x4a')]=_[_0x0d03('0x4b')](_0xa4560d[_0x0d03('0x47')],_0xa4560d['query']);_0x215241['attributes']=_[_0x0d03('0x4b')](_0xa4560d['model'],qs['fields'](_0x3b302f[_0x0d03('0x49')]['fields']));_0x215241[_0x0d03('0x4d')]=_0x215241[_0x0d03('0x4d')][_0x0d03('0x4e')]?_0x215241[_0x0d03('0x4d')]:_0xa4560d[_0x0d03('0x47')];if(!_0x3b302f['query'][_0x0d03('0x4f')](_0x0d03('0x50'))){_0x215241[_0x0d03('0x31')]=qs['limit'](_0x3b302f['query'][_0x0d03('0x31')]);_0x215241[_0x0d03('0x2f')]=qs['offset'](_0x3b302f[_0x0d03('0x49')]['offset']);}_0x215241['order']=qs[_0x0d03('0x52')](_0x3b302f[_0x0d03('0x49')]['sort']);_0x215241[_0x0d03('0x53')]=qs[_0x0d03('0x4a')](_[_0x0d03('0x54')](_0x3b302f['query'],_0xa4560d[_0x0d03('0x4a')]));_0x215241[_0x0d03('0x53')]['MailAccountId']=_0x4cef56['id'];if(_0x3b302f['query'][_0x0d03('0x55')]){_0x215241[_0x0d03('0x53')]=_[_0x0d03('0x56')](_0x215241['where'],{'$or':_[_0x0d03('0x41')](_0x215241['attributes'],function(_0x4383b5){var _0x2dd79a={};_0x2dd79a[_0x4383b5]={'$like':'%'+_0x3b302f[_0x0d03('0x49')][_0x0d03('0x55')]+'%'};return _0x2dd79a;})});}_0x215241=_[_0x0d03('0x56')]({},_0x215241,_0x3b302f[_0x0d03('0x58')]);return db['MailInteraction']['count']({'where':_0x215241[_0x0d03('0x53')]})[_0x0d03('0x23')](function(_0xe5a74d){_0x51fc66[_0x0d03('0x32')]=_0xe5a74d;if(_0x3b302f[_0x0d03('0x49')]['includeAll']){_0x215241[_0x0d03('0x60')]=[{'model':db[_0x0d03('0x8e')],'as':_0x0d03('0x8f'),'required':![]},{'model':db[_0x0d03('0x90')],'as':'Owner','attributes':[_0x0d03('0x48'),_0x0d03('0x91'),_0x0d03('0x92')],'required':![]},{'model':db[_0x0d03('0x93')],'as':'Tags','attributes':['id','name',_0x0d03('0x94')],'where':_0x3b302f[_0x0d03('0x49')]['tag']?{'id':_0x3b302f[_0x0d03('0x49')][_0x0d03('0x95')]}:undefined,'required':_0x3b302f[_0x0d03('0x49')]['tag']?!![]:![]}];}return db[_0x0d03('0x8b')][_0x0d03('0x5a')](_0x215241);})['then'](function(_0x1a2259){_0x51fc66['rows']=_0x1a2259;return _0x51fc66;});}})[_0x0d03('0x23')](respondWithFilteredResult(_0x13270b,_0x215241))[_0x0d03('0x5c')](handleError(_0x13270b,null));};exports[_0x0d03('0x96')]=function addApplications(_0x55abab,_0x4baca3){var _0x5d1510=_0x55abab[_0x0d03('0x5d')]['id'];var _0x54517e=_0x55abab['body'];var _0xb75452=0xc8;var _0xe3cae8=null;return db['sequelize'][_0x0d03('0x97')]({'isolationLevel':db[_0x0d03('0x98')][_0x0d03('0x99')][_0x0d03('0x9a')][_0x0d03('0x9b')]},function(_0x2f5c09){return db['MailAccount']['findOne']({'where':{'id':_0x5d1510},'transaction':_0x2f5c09})[_0x0d03('0x23')](function(_0x562bfa){if(_0x562bfa){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x5d1510},'transaction':_0x2f5c09})[_0x0d03('0x23')](function(){var _0x161090=_[_0x0d03('0x41')](_0x54517e,function(_0x4e303d){_0x4e303d[_0x0d03('0x66')]=_0x5d1510;return _0x4e303d;});return db[_0x0d03('0x9c')]['bulkCreate'](_0x161090,{'transaction':_0x2f5c09});});}else{_0xb75452=0x194;_0xe3cae8=[];}});})['then'](function(){if(_0xb75452!==0x194){return db[_0x0d03('0x9c')]['findAndCountAll']({'where':{'MailAccountId':_0x5d1510},'order':'priority'})[_0x0d03('0x23')](function(_0x45e6f9){_0xe3cae8=_0x45e6f9;});}})[_0x0d03('0x5c')](function(_0x196044){_0xb75452=0x1f4;logger['error'](_0x196044[_0x0d03('0x9d')]);if(_0x196044['name']){delete _0x196044[_0x0d03('0x48')];}_0xe3cae8=_0x196044;})['finally'](function(){if(_0xe3cae8===null){_0x4baca3[_0x0d03('0x2c')](_0xb75452);}else{if(_0xb75452===0x1f4){_0x4baca3[_0x0d03('0x2d')](_0xb75452)[_0x0d03('0x9e')](_0xe3cae8);}else{_0x4baca3[_0x0d03('0x2d')](_0xb75452)['json'](_0xe3cae8);}}});};exports[_0x0d03('0x9f')]=function(_0x34c0fb,_0x1dc344,_0x10e3ea){var _0x1644fa={};var _0x772d1a={};var _0x2412db;var _0x54d396;return db[_0x0d03('0x42')]['findOne']({'where':{'id':_0x34c0fb[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x1dc344,null))[_0x0d03('0x23')](function(_0x2d18f0){if(_0x2d18f0){_0x2412db=_0x2d18f0;_0x772d1a['model']=_[_0x0d03('0x5f')](db['MailApplication'][_0x0d03('0x43')]);_0x772d1a[_0x0d03('0x49')]=_['keys'](_0x34c0fb['query']);_0x772d1a[_0x0d03('0x4a')]=_[_0x0d03('0x4b')](_0x772d1a[_0x0d03('0x47')],_0x772d1a['query']);_0x1644fa[_0x0d03('0x4d')]=_[_0x0d03('0x4b')](_0x772d1a[_0x0d03('0x47')],qs[_0x0d03('0x4c')](_0x34c0fb[_0x0d03('0x49')][_0x0d03('0x4c')]));_0x1644fa[_0x0d03('0x4d')]=_0x1644fa[_0x0d03('0x4d')][_0x0d03('0x4e')]?_0x1644fa[_0x0d03('0x4d')]:_0x772d1a[_0x0d03('0x47')];_0x1644fa[_0x0d03('0x51')]=qs[_0x0d03('0x52')](_0x34c0fb['query']['sort']);_0x1644fa[_0x0d03('0x53')]=qs[_0x0d03('0x4a')](_[_0x0d03('0x54')](_0x34c0fb[_0x0d03('0x49')],_0x772d1a[_0x0d03('0x4a')]));if(_0x34c0fb[_0x0d03('0x49')][_0x0d03('0x55')]){_0x1644fa['where']=_[_0x0d03('0x56')](_0x1644fa[_0x0d03('0x53')],{'$or':_[_0x0d03('0x41')](_0x1644fa[_0x0d03('0x4d')],function(_0x39542e){var _0x4ac85e={};_0x4ac85e[_0x39542e]={'$like':'%'+_0x34c0fb[_0x0d03('0x49')][_0x0d03('0x55')]+'%'};return _0x4ac85e;})});}_0x1644fa=_[_0x0d03('0x56')]({},_0x1644fa,_0x34c0fb[_0x0d03('0x58')]);return _0x2412db[_0x0d03('0x9f')](_0x1644fa);}})['then'](function(_0x4bb6c1){if(_0x4bb6c1){_0x54d396=_0x4bb6c1['length'];if(!_0x34c0fb[_0x0d03('0x49')]['hasOwnProperty'](_0x0d03('0x50'))){_0x1644fa['limit']=qs[_0x0d03('0x31')](_0x34c0fb['query'][_0x0d03('0x31')]);_0x1644fa[_0x0d03('0x2f')]=qs['offset'](_0x34c0fb[_0x0d03('0x49')][_0x0d03('0x2f')]);}return _0x2412db[_0x0d03('0x9f')](_0x1644fa);}})[_0x0d03('0x23')](function(_0x369430){if(_0x369430){return _0x369430?{'count':_0x54d396,'rows':_0x369430}:null;}})[_0x0d03('0x23')](respondWithResult(_0x1dc344,null))[_0x0d03('0x5c')](handleError(_0x1dc344,null));};exports[_0x0d03('0xa0')]=function(_0x564008,_0x5695f9,_0x4aa88b){var _0x187346={'raw':!![],'where':{}};var _0x3530a7={};var _0x521225={'count':0x0,'rows':[]};return db[_0x0d03('0x42')]['findOne']({'where':{'id':_0x564008['params']['id']}})['then'](handleEntityNotFound(_0x5695f9,null))['then'](function(_0x169e50){if(_0x169e50){_0x3530a7[_0x0d03('0x47')]=_['keys'](db[_0x0d03('0xa1')][_0x0d03('0x43')]);_0x3530a7['query']=_['keys'](_0x564008[_0x0d03('0x49')]);_0x3530a7[_0x0d03('0x4a')]=_[_0x0d03('0x4b')](_0x3530a7[_0x0d03('0x47')],_0x3530a7['query']);_0x187346[_0x0d03('0x4d')]=_[_0x0d03('0x4b')](_0x3530a7['model'],qs[_0x0d03('0x4c')](_0x564008[_0x0d03('0x49')][_0x0d03('0x4c')]));_0x187346[_0x0d03('0x4d')]=_0x187346[_0x0d03('0x4d')]['length']?_0x187346[_0x0d03('0x4d')]:_0x3530a7['model'];if(!_0x564008[_0x0d03('0x49')]['hasOwnProperty'](_0x0d03('0x50'))){_0x187346[_0x0d03('0x31')]=qs[_0x0d03('0x31')](_0x564008['query']['limit']);_0x187346[_0x0d03('0x2f')]=qs[_0x0d03('0x2f')](_0x564008['query'][_0x0d03('0x2f')]);}_0x187346['order']=qs[_0x0d03('0x52')](_0x564008['query'][_0x0d03('0x52')]);_0x187346['where']=qs[_0x0d03('0x4a')](_[_0x0d03('0x54')](_0x564008[_0x0d03('0x49')],_0x3530a7[_0x0d03('0x4a')]));_0x187346[_0x0d03('0x53')]['MailAccountId']=_0x169e50['id'];if(_0x564008[_0x0d03('0x49')][_0x0d03('0x55')]){_0x187346['where']=_['merge'](_0x187346['where'],{'$or':_[_0x0d03('0x41')](_0x187346['attributes'],function(_0x3da836){var _0x4a0da6={};_0x4a0da6[_0x3da836]={'$like':'%'+_0x564008[_0x0d03('0x49')][_0x0d03('0x55')]+'%'};return _0x4a0da6;})});}if(_0x564008[_0x0d03('0x49')][_0x0d03('0xa2')]){var _0x230836=_0x564008[_0x0d03('0x49')][_0x0d03('0xa2')][_0x0d03('0xa3')](',');var _0x5c89bb={};_0x5c89bb[_0x230836[0x0]]={'$gte':moment(_0x230836[0x1])['format'](_0x0d03('0xa4'))};_0x187346['where']=_[_0x0d03('0x56')](_0x187346[_0x0d03('0x53')],_0x5c89bb);}_0x187346=_[_0x0d03('0x56')]({},_0x187346,_0x564008[_0x0d03('0x58')]);return db[_0x0d03('0xa1')][_0x0d03('0x32')]({'where':_0x187346[_0x0d03('0x53')]})[_0x0d03('0x23')](function(_0x1fcb85){_0x521225[_0x0d03('0x32')]=_0x1fcb85;if(_0x564008[_0x0d03('0x49')][_0x0d03('0x59')]){_0x187346[_0x0d03('0x60')]=[{'all':!![]}];}return db[_0x0d03('0xa1')][_0x0d03('0x5a')](_0x187346);})[_0x0d03('0x23')](function(_0x22c679){if(_0x564008[_0x0d03('0x49')]['inlineCss']==='true'){for(var _0x2c4f02=0x0;_0x2c4f02<_0x22c679[_0x0d03('0x4e')];_0x2c4f02++){_0x22c679[_0x2c4f02]['body']=juice(_0x22c679[_0x2c4f02]['body']);}}_0x521225['rows']=_0x22c679;return _0x521225;});}})[_0x0d03('0x23')](respondWithFilteredResult(_0x5695f9,_0x187346))[_0x0d03('0x5c')](handleError(_0x5695f9,null));};exports[_0x0d03('0x9e')]=function(_0x2185cd,_0x3254ca,_0x2fdd8d){var _0x493594,_0x1029cb={},_0x4e1970;if(_0x2185cd[_0x0d03('0x63')]['to']){_0x4e1970=_0x2185cd['body']['to'][_0x0d03('0xa3')](',')[0x0];}return db['MailAccount'][_0x0d03('0x61')]({'where':{'id':_0x2185cd[_0x0d03('0x5d')]['id']},'include':[{'model':db[_0x0d03('0xa5')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0d03('0xa6'),'where':{'email':_0x4e1970},'limit':0x1,'order':[[_0x0d03('0xa7'),_0x0d03('0xa8')]]}]},{'model':db[_0x0d03('0x3e')],'as':_0x0d03('0x5e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3254ca,null))[_0x0d03('0x23')](function(_0x2073fd){if(_0x2073fd){_0x493594=_0x2073fd;if(_0x2073fd[_0x0d03('0x5e')]){if(_['isNil'](_0x2185cd['body'][_0x0d03('0xa9')])){_0x2185cd['body'][_0x0d03('0xa9')]=util['format']('%s\x20<%s>',_0x2073fd[_0x0d03('0x48')],_0x2073fd[_0x0d03('0x71')]||_0x2073fd[_0x0d03('0x5e')]['user']);}if(_0x2185cd[_0x0d03('0x63')][_0x0d03('0xaa')]&&_0x2185cd[_0x0d03('0x63')][_0x0d03('0xaa')][_0x0d03('0x4e')]){for(var _0x208046=0x0;_0x208046<_0x2185cd[_0x0d03('0x63')]['attachments'][_0x0d03('0x4e')];_0x208046+=0x1){_0x2185cd[_0x0d03('0x63')][_0x0d03('0xaa')][_0x208046]={'filename':_0x2185cd[_0x0d03('0x63')][_0x0d03('0xaa')][_0x208046][_0x0d03('0x48')],'path':path[_0x0d03('0xab')](config['root'],_0x0d03('0xac'),_0x2185cd[_0x0d03('0x63')][_0x0d03('0xaa')][_0x208046]['basename'])};}}var _0x14a5a2={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x7e')])){if(_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x7c')]){_0x14a5a2[_0x0d03('0xad')]={'user':_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x77')],'pass':_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x7a')]};}_0x14a5a2['host']=_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x7d')];_0x14a5a2['port']=_0x2073fd[_0x0d03('0x5e')][_0x0d03('0xae')];_0x14a5a2[_0x0d03('0xaf')]=_0x2073fd[_0x0d03('0x5e')][_0x0d03('0xaf')];}else{_0x14a5a2['service']=_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x7e')];_0x14a5a2[_0x0d03('0xad')]={'user':_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x77')],'pass':_0x2073fd[_0x0d03('0x5e')][_0x0d03('0x7a')]};}return respondWithRpcPromise(_0x0d03('0xb0'),'sendMail',{'account':_0x14a5a2,'message':_0x2185cd[_0x0d03('0x63')]});}else{throw new Error(_0x0d03('0xb1'));}}})[_0x0d03('0x23')](function(_0x595b5e){if(_0x595b5e){_0x1029cb=_0x595b5e;if(_0x493594[_0x0d03('0xb2')]){if(_0x493594['List'][_0x0d03('0xa6')]['length']){return _0x493594['List'][_0x0d03('0xa6')][0x0];}else{return db[_0x0d03('0x8e')][_0x0d03('0x67')](_[_0x0d03('0x1b')](_0x2185cd['body'],{'firstName':_0x2185cd[_0x0d03('0x63')]['to'],'email':_0x2185cd[_0x0d03('0x63')]['to'],'phone':_0x2185cd[_0x0d03('0x63')]['to'],'ListId':_0x493594['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0x0d03('0x23')](function(_0x43a13c){if(_0x43a13c){var _0x191712={'UserId':_0x2185cd[_0x0d03('0x77')]['id'],'ContactId':_0x43a13c['id'],'MailAccountId':_0x493594['id'],'inReplyTo':_0x1029cb['messageId'],'to':_0x2185cd[_0x0d03('0x63')]['from'],'cc':_0x2185cd[_0x0d03('0x63')]['cc'],'subject':_0x2185cd[_0x0d03('0x63')][_0x0d03('0xb3')],'attach':_0x2185cd[_0x0d03('0x63')][_0x0d03('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x0d03('0xb5')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x0d03('0x56')](_0x2185cd[_0x0d03('0x63')],{'messageId':_0x1029cb[_0x0d03('0xb6')],'sentAt':moment()[_0x0d03('0xb5')](_0x0d03('0xa4')),'read':!![],'MailAccountId':_0x493594['id'],'UserId':_0x2185cd[_0x0d03('0x77')]['id'],'ContactId':_0x43a13c['id']})]};if(_0x2185cd['body'][_0x0d03('0xb7')]){_0x191712=_[_0x0d03('0x56')](_0x191712,_0x2185cd['body'][_0x0d03('0xb7')]);}return db['MailInteraction'][_0x0d03('0x67')](_0x191712,{'include':[{'model':db[_0x0d03('0xa1')],'as':_0x0d03('0xb8')}]});}})[_0x0d03('0x23')](respondWithResult(_0x3254ca,null))[_0x0d03('0x5c')](handleError(_0x3254ca,null));};exports[_0x0d03('0xb9')]=function(_0x5e5057,_0x4c3de0,_0x2c8436){return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x5e5057[_0x0d03('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x4c3de0,null))['then'](function(_0x2eb5fc){if(_0x2eb5fc&&_0x2eb5fc['Smtp']){var _0x5c0c71={'id':_0x2eb5fc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2eb5fc[_0x0d03('0x5e')][_0x0d03('0x7e')]){_0x5c0c71[_0x0d03('0x7e')]=_0x2eb5fc[_0x0d03('0x5e')]['service'];}else{_0x5c0c71['host']=_0x2eb5fc['Smtp'][_0x0d03('0x7d')];_0x5c0c71[_0x0d03('0xae')]=_0x2eb5fc[_0x0d03('0x5e')][_0x0d03('0xae')];_0x5c0c71['secure']=_0x2eb5fc[_0x0d03('0x5e')][_0x0d03('0xaf')];}if(_0x2eb5fc[_0x0d03('0x5e')][_0x0d03('0x7c')]){_0x5c0c71[_0x0d03('0xad')]={'user':_0x2eb5fc['Smtp']['user'],'pass':_0x2eb5fc['Smtp'][_0x0d03('0x7a')]};}return respondWithRpcPromise('VerifySmtp',_0x0d03('0xb9'),{'account':_0x5c0c71});}})[_0x0d03('0x23')](respondWithResult(_0x4c3de0,null))['catch'](handleError(_0x4c3de0,null));};exports[_0x0d03('0x37')]=function(_0x1ab4e2,_0x28bc1f){return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x1ab4e2[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x28bc1f,null))[_0x0d03('0x23')](function(_0x2dfa0c){if(_0x2dfa0c&&_0x2dfa0c[_0x0d03('0x7e')]){throw new db[(_0x0d03('0xba'))][(_0x0d03('0xbb'))](_0x0d03('0xbc'));}return _0x2dfa0c;})[_0x0d03('0x23')](removeEntity(_0x28bc1f,null))[_0x0d03('0x5c')](handleError(_0x28bc1f,null));};exports[_0x0d03('0xbd')]=function(_0x486125,_0x104826,_0x402b56){return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x486125[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x104826,null))[_0x0d03('0x23')](function(_0x1bf191){if(_0x1bf191){return _0x1bf191[_0x0d03('0xbd')](_0x486125['body']['ids'],_['omit'](_0x486125['body'],[_0x0d03('0x6b'),'id'])||{})['spread'](function(_0x33dae0){for(var _0x25f7d6=0x0;_0x25f7d6<_0x486125[_0x0d03('0x63')][_0x0d03('0x6b')][_0x0d03('0x4e')];_0x25f7d6+=0x1){socket[_0x0d03('0xbe')](_0x0d03('0xbf'),{'UserId':Number(_0x486125[_0x0d03('0x63')]['ids'][_0x25f7d6]),'MailAccountId':Number(_0x486125[_0x0d03('0x5d')]['id'])});}return _0x33dae0;});}})['then'](respondWithResult(_0x104826,null))[_0x0d03('0x5c')](handleError(_0x104826,null));};exports[_0x0d03('0xc0')]=function(_0x1265f6,_0x2f4d7a,_0x3c48d0){return db[_0x0d03('0x42')][_0x0d03('0x61')]({'where':{'id':_0x1265f6['params']['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x2f4d7a,null))[_0x0d03('0x23')](function(_0x4ceca3){if(_0x4ceca3){return _0x4ceca3[_0x0d03('0xc0')](_0x1265f6['query'][_0x0d03('0x6b')])[_0x0d03('0x23')](function(){if(_['isArray'](_0x1265f6[_0x0d03('0x49')][_0x0d03('0x6b')])){for(var _0x1c77a6=0x0;_0x1c77a6<_0x1265f6['query'][_0x0d03('0x6b')]['length'];_0x1c77a6+=0x1){socket[_0x0d03('0xbe')](_0x0d03('0xc1'),{'UserId':Number(_0x1265f6[_0x0d03('0x49')][_0x0d03('0x6b')][_0x1c77a6]),'MailAccountId':Number(_0x1265f6[_0x0d03('0x5d')]['id'])});}}else{socket['emit'](_0x0d03('0xc1'),{'UserId':Number(_0x1265f6['query'][_0x0d03('0x6b')]),'MailAccountId':Number(_0x1265f6[_0x0d03('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f4d7a,null))[_0x0d03('0x5c')](handleError(_0x2f4d7a,null));};exports[_0x0d03('0xc2')]=function(_0x3138e7,_0x4ae3ca,_0x1c30de){var _0x49b159={};var _0x5558da={};var _0x26390c;var _0x4db802;return db[_0x0d03('0x42')]['findOne']({'where':{'id':_0x3138e7[_0x0d03('0x5d')]['id']}})[_0x0d03('0x23')](handleEntityNotFound(_0x4ae3ca,null))[_0x0d03('0x23')](function(_0x5b800b){if(_0x5b800b){_0x26390c=_0x5b800b;_0x5558da[_0x0d03('0x47')]=_[_0x0d03('0x5f')](db[_0x0d03('0x90')]['rawAttributes']);_0x5558da[_0x0d03('0x49')]=_[_0x0d03('0x5f')](_0x3138e7[_0x0d03('0x49')]);_0x5558da[_0x0d03('0x4a')]=_[_0x0d03('0x4b')](_0x5558da['model'],_0x5558da['query']);_0x49b159[_0x0d03('0x4d')]=_[_0x0d03('0x4b')](_0x5558da[_0x0d03('0x47')],qs[_0x0d03('0x4c')](_0x3138e7[_0x0d03('0x49')][_0x0d03('0x4c')]));_0x49b159[_0x0d03('0x4d')]=_0x49b159['attributes'][_0x0d03('0x4e')]?_0x49b159[_0x0d03('0x4d')]:_0x5558da[_0x0d03('0x47')];_0x49b159[_0x0d03('0x51')]=qs[_0x0d03('0x52')](_0x3138e7['query'][_0x0d03('0x52')]);_0x49b159['where']=qs[_0x0d03('0x4a')](_[_0x0d03('0x54')](_0x3138e7[_0x0d03('0x49')],_0x5558da[_0x0d03('0x4a')]));if(_0x3138e7[_0x0d03('0x49')][_0x0d03('0x55')]){_0x49b159['where']=_[_0x0d03('0x56')](_0x49b159[_0x0d03('0x53')],{'$or':_[_0x0d03('0x41')](_0x49b159['attributes'],function(_0x2283d6){var _0x1fb23b={};_0x1fb23b[_0x2283d6]={'$like':'%'+_0x3138e7['query'][_0x0d03('0x55')]+'%'};return _0x1fb23b;})});}_0x49b159=_['merge']({},_0x49b159,_0x3138e7[_0x0d03('0x58')]);return _0x26390c[_0x0d03('0xc2')](_0x49b159);}})[_0x0d03('0x23')](function(_0x35cb4d){if(_0x35cb4d){_0x4db802=_0x35cb4d[_0x0d03('0x4e')];if(!_0x3138e7['query'][_0x0d03('0x4f')](_0x0d03('0x50'))){_0x49b159['limit']=qs[_0x0d03('0x31')](_0x3138e7[_0x0d03('0x49')]['limit']);_0x49b159[_0x0d03('0x2f')]=qs['offset'](_0x3138e7[_0x0d03('0x49')][_0x0d03('0x2f')]);}return _0x26390c['getAgents'](_0x49b159);}})[_0x0d03('0x23')](function(_0xec6ccf){if(_0xec6ccf){return _0xec6ccf?{'count':_0x4db802,'rows':_0xec6ccf}:null;}})['then'](respondWithResult(_0x4ae3ca,null))['catch'](handleError(_0x4ae3ca,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2b5d4a4..225ab12 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 _0x9261=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9261,0x1de));var _0x1926=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0x9261[_0x47041d];return _0x5022bd;};'use strict';var EventEmitter=require(_0x1926('0x0'));var MailAccount=require(_0x1926('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1926('0x2')](0x0);var events={'afterCreate':_0x1926('0x3'),'afterUpdate':_0x1926('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b2b33){return function(_0x2fb805,_0x269cb1,_0x31eef2){MailAccountEvents[_0x1926('0x5')](_0x1b2b33+':'+_0x2fb805['id'],_0x2fb805);MailAccountEvents['emit'](_0x1b2b33,_0x2fb805);_0x31eef2(null);};}for(var e in events){if(events[_0x1926('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x1926('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x341c=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','save'];(function(_0x5708ad,_0xdfe547){var _0x5ec1f1=function(_0x563ade){while(--_0x563ade){_0x5708ad['push'](_0x5708ad['shift']());}};_0x5ec1f1(++_0xdfe547);}(_0x341c,0xcc));var _0xc341=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x341c[_0x33ebf5];return _0x66957b;};'use strict';var EventEmitter=require(_0xc341('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xc341('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc341('0x2'),'afterUpdate':_0xc341('0x3'),'afterDestroy':_0xc341('0x4')};function emitEvent(_0x40d92f){return function(_0x4c74c5,_0x3e07f8,_0x3ab689){MailAccountEvents[_0xc341('0x5')](_0x40d92f+':'+_0x4c74c5['id'],_0x4c74c5);MailAccountEvents['emit'](_0x40d92f,_0x4c74c5);_0x3ab689(null);};}for(var e in events){if(events[_0xc341('0x6')](e)){var event=events[e];MailAccount[_0xc341('0x7')](e,emitEvent(event));}}module[_0xc341('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 77f81be..3e29064 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 _0x18e4=['mail_accounts','util','api','moment','bluebird','request-promise','path','./mailAccount.attributes','exports','define'];(function(_0x3d6646,_0x386dce){var _0x3ed23d=function(_0x36e747){while(--_0x36e747){_0x3d6646['push'](_0x3d6646['shift']());}};_0x3ed23d(++_0x386dce);}(_0x18e4,0xe7));var _0x418e=function(_0x38d852,_0x5ce645){_0x38d852=_0x38d852-0x0;var _0x105103=_0x18e4[_0x38d852];return _0x105103;};'use strict';var _=require('lodash');var util=require(_0x418e('0x0'));var logger=require('../../config/logger')(_0x418e('0x1'));var moment=require(_0x418e('0x2'));var BPromise=require(_0x418e('0x3'));var rp=require(_0x418e('0x4'));var fs=require('fs');var path=require(_0x418e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x418e('0x6'));module[_0x418e('0x7')]=function(_0x2e0c62,_0xcc27be){return _0x2e0c62[_0x418e('0x8')]('MailAccount',attributes,{'tableName':_0x418e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d3b=['api','moment','bluebird','path','../../config/environment','exports','MailAccount','mail_accounts','lodash','util'];(function(_0x223106,_0x499e32){var _0x18378c=function(_0x5110c1){while(--_0x5110c1){_0x223106['push'](_0x223106['shift']());}};_0x18378c(++_0x499e32);}(_0x8d3b,0x166));var _0xb8d3=function(_0x37acc7,_0x169745){_0x37acc7=_0x37acc7-0x0;var _0x2b861c=_0x8d3b[_0x37acc7];return _0x2b861c;};'use strict';var _=require(_0xb8d3('0x0'));var util=require(_0xb8d3('0x1'));var logger=require('../../config/logger')(_0xb8d3('0x2'));var moment=require(_0xb8d3('0x3'));var BPromise=require(_0xb8d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d3('0x5'));var rimraf=require('rimraf');var config=require(_0xb8d3('0x6'));var attributes=require('./mailAccount.attributes');module[_0xb8d3('0x7')]=function(_0x6de2de,_0x460924){return _0x6de2de['define'](_0xb8d3('0x8'),attributes,{'tableName':_0xb8d3('0x9'),'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 8b0298d..2af1936 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 _0xa949=['isNil','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','from','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','omit','Applications','applications','list','priority','autoclose','push','close','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','spread','update','format','get','interaction','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId'];(function(_0x1fca96,_0x31208b){var _0x2164ce=function(_0x183859){while(--_0x183859){_0x1fca96['push'](_0x1fca96['shift']());}};_0x2164ce(++_0x31208b);}(_0xa949,0x1ef));var _0x9a94=function(_0x5a3e47,_0x264866){_0x5a3e47=_0x5a3e47-0x0;var _0x534244=_0xa949[_0x5a3e47];return _0x534244;};'use strict';var _=require(_0x9a94('0x0'));var util=require(_0x9a94('0x1'));var moment=require(_0x9a94('0x2'));var BPromise=require(_0x9a94('0x3'));var rs=require(_0x9a94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a94('0x5'))['db'];var utils=require(_0x9a94('0x6'));var logger=require(_0x9a94('0x7'))(_0x9a94('0x8'));var config=require(_0x9a94('0x9'));var jayson=require(_0x9a94('0xa'));var client=jayson[_0x9a94('0xb')][_0x9a94('0xc')]({'port':0x232c});config[_0x9a94('0xd')]=_[_0x9a94('0xe')](config['redis'],{'host':_0x9a94('0xf'),'port':0x18eb});var socket=require(_0x9a94('0x10'))(new Redis(config[_0x9a94('0xd')]));require(_0x9a94('0x11'))[_0x9a94('0x12')](socket);function respondWithRpcPromise(_0x1af233,_0x35245c,_0xf89c3a){return new BPromise(function(_0x3ed3dc,_0x307997){return client[_0x9a94('0x13')](_0x1af233,_0xf89c3a)[_0x9a94('0x14')](function(_0x3ffc3a){logger[_0x9a94('0x15')](_0x9a94('0x16'),_0x35245c,_0x9a94('0x17'));logger[_0x9a94('0x18')](_0x9a94('0x19'),_0x35245c,_0x9a94('0x17'),JSON[_0x9a94('0x1a')](_0x3ffc3a));if(_0x3ffc3a[_0x9a94('0x1b')]){if(_0x3ffc3a['error'][_0x9a94('0x1c')]===0x1f4){logger[_0x9a94('0x1b')](_0x9a94('0x16'),_0x35245c,_0x3ffc3a['error']['message']);return _0x307997(_0x3ffc3a[_0x9a94('0x1b')][_0x9a94('0x1d')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x35245c,_0x3ffc3a[_0x9a94('0x1b')][_0x9a94('0x1d')]);return _0x3ed3dc(_0x3ffc3a[_0x9a94('0x1b')][_0x9a94('0x1d')]);}else{logger['info'](_0x9a94('0x16'),_0x35245c,'request\x20sent');_0x3ed3dc(_0x3ffc3a[_0x9a94('0x1e')]['message']);}})[_0x9a94('0x1f')](function(_0x30ff53){logger[_0x9a94('0x1b')](_0x9a94('0x16'),_0x35245c,_0x30ff53);_0x307997(_0x30ff53);});});}exports[_0x9a94('0x20')]=function(_0xc95b0d){var _0x28108c=this;return new Promise(function(_0x4eb2b8,_0x5b3559){return db[_0x9a94('0x21')]['findAll']({'raw':_0xc95b0d[_0x9a94('0x22')]?_0xc95b0d[_0x9a94('0x22')][_0x9a94('0x23')]===undefined?!![]:![]:!![],'where':_0xc95b0d['options']?_0xc95b0d[_0x9a94('0x22')][_0x9a94('0x24')]||null:null,'attributes':_0xc95b0d[_0x9a94('0x22')]?_0xc95b0d[_0x9a94('0x22')][_0x9a94('0x25')]||null:null,'limit':_0xc95b0d[_0x9a94('0x22')]?_0xc95b0d[_0x9a94('0x22')][_0x9a94('0x26')]||null:null,'include':_0xc95b0d[_0x9a94('0x22')]?_0xc95b0d[_0x9a94('0x22')][_0x9a94('0x27')]?_[_0x9a94('0x28')](_0xc95b0d[_0x9a94('0x22')][_0x9a94('0x27')],function(_0x5c1c7c){return{'model':db[_0x5c1c7c['model']],'as':_0x5c1c7c['as'],'attributes':_0x5c1c7c[_0x9a94('0x25')],'include':_0x5c1c7c[_0x9a94('0x27')]?_[_0x9a94('0x28')](_0x5c1c7c[_0x9a94('0x27')],function(_0x1c29aa){return{'model':db[_0x1c29aa['model']],'as':_0x1c29aa['as'],'attributes':_0x1c29aa[_0x9a94('0x25')],'include':_0x1c29aa[_0x9a94('0x27')]?_[_0x9a94('0x28')](_0x1c29aa['include'],function(_0x47f024){return{'model':db[_0x47f024[_0x9a94('0x29')]],'as':_0x47f024['as'],'attributes':_0x47f024['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a94('0x14')](function(_0x449cd7){logger[_0x9a94('0x15')]('GetMailAccount',_0xc95b0d);logger[_0x9a94('0x18')](_0x9a94('0x20'),_0xc95b0d,JSON[_0x9a94('0x1a')](_0x449cd7));_0x4eb2b8(_0x449cd7);})[_0x9a94('0x1f')](function(_0x2dc77b){logger[_0x9a94('0x1b')](_0x9a94('0x20'),_0x2dc77b['message'],_0xc95b0d);_0x5b3559(_0x28108c[_0x9a94('0x1b')](0x1f4,_0x2dc77b[_0x9a94('0x1d')]));});});};exports[_0x9a94('0x2a')]=function(_0x398155){var _0x4b9799=this;return new Promise(function(_0x2bdf19,_0x31c4d6){return db[_0x9a94('0x21')][_0x9a94('0x2b')]({'raw':_0x398155[_0x9a94('0x22')]?_0x398155['options'][_0x9a94('0x23')]===undefined?!![]:![]:!![],'where':_0x398155[_0x9a94('0x22')]?_0x398155[_0x9a94('0x22')][_0x9a94('0x24')]||null:null,'attributes':_0x398155['options']?_0x398155[_0x9a94('0x22')][_0x9a94('0x25')]||null:null,'include':_0x398155[_0x9a94('0x22')]?_0x398155[_0x9a94('0x22')][_0x9a94('0x27')]?_[_0x9a94('0x28')](_0x398155[_0x9a94('0x22')][_0x9a94('0x27')],function(_0xbafe1b){return{'model':db[_0xbafe1b[_0x9a94('0x29')]],'as':_0xbafe1b['as'],'attributes':_0xbafe1b[_0x9a94('0x25')],'include':_0xbafe1b['include']?_[_0x9a94('0x28')](_0xbafe1b[_0x9a94('0x27')],function(_0x435d6d){return{'model':db[_0x435d6d[_0x9a94('0x29')]],'as':_0x435d6d['as'],'attributes':_0x435d6d[_0x9a94('0x25')],'include':_0x435d6d['include']?_[_0x9a94('0x28')](_0x435d6d[_0x9a94('0x27')],function(_0x10c7ca){return{'model':db[_0x10c7ca[_0x9a94('0x29')]],'as':_0x10c7ca['as'],'attributes':_0x10c7ca[_0x9a94('0x25')]};}):[]};}):[]};}):[]:[]})[_0x9a94('0x14')](function(_0x16e9e8){logger[_0x9a94('0x15')](_0x9a94('0x2a'),_0x398155);logger[_0x9a94('0x18')]('ShowMailAccount',_0x398155,JSON[_0x9a94('0x1a')](_0x16e9e8));_0x2bdf19(_0x16e9e8);})[_0x9a94('0x1f')](function(_0x3d02e5){logger[_0x9a94('0x1b')](_0x9a94('0x2a'),_0x3d02e5[_0x9a94('0x1d')],_0x398155);_0x31c4d6(_0x4b9799['error'](0x1f4,_0x3d02e5[_0x9a94('0x1d')]));});});};exports[_0x9a94('0x2c')]=function(_0x1a858c){var _0x30c55c=this;return new Promise(function(_0x3b60aa,_0x139bac){var _0x1dbead={'body':_0x1a858c[_0x9a94('0x2d')],'channel':_0x9a94('0x2e')};var _0x19367a=_[_0x9a94('0x2f')](_[_0x9a94('0x30')](db[_0x9a94('0x31')][_0x9a94('0x32')]),[_0x9a94('0x33'),_0x9a94('0x34'),_0x9a94('0x35'),_0x9a94('0x36')]);var _0x8ddda6=![];if(_0x1a858c[_0x9a94('0x2d')]['id']){delete _0x1a858c['body']['id'];}if(_[_0x9a94('0x37')](_0x1a858c[_0x9a94('0x2d')]['from'])){return _0x139bac(_0x30c55c[_0x9a94('0x1b')](0x1f4,_0x9a94('0x38')));}if(_[_0x9a94('0x37')](_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x2d')])||_0x1a858c['body'][_0x9a94('0x2d')]===''){return _0x139bac(_0x30c55c[_0x9a94('0x1b')](0x1f4,_0x9a94('0x39')));}if(_[_0x9a94('0x37')](_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x3a')])){return _0x139bac(_0x30c55c[_0x9a94('0x1b')](0x1f4,_0x9a94('0x3b')+_0x19367a));}if(!_['includes'](_0x19367a,_0x1a858c[_0x9a94('0x2d')]['mapKey'])){return _0x139bac(_0x30c55c[_0x9a94('0x1b')](0x1f4,_0x9a94('0x3c')+_0x19367a));}var _0x321e43={};_0x321e43[_0x1a858c['body'][_0x9a94('0x3a')]]=_0x1a858c['body'][_0x9a94('0x3d')];return db[_0x9a94('0x21')][_0x9a94('0x2b')]({'where':{'id':_0x1a858c[_0x9a94('0x3e')]['id']},'include':[{'model':db[_0x9a94('0x3f')],'as':_0x9a94('0x40'),'include':[{'model':db[_0x9a94('0x31')],'as':_0x9a94('0x41'),'where':_0x321e43,'limit':0x1,'order':[[_0x9a94('0x34'),_0x9a94('0x42')]]}]},{'model':db[_0x9a94('0x43')],'as':'Applications'},{'model':db[_0x9a94('0x44')],'as':_0x9a94('0x45')}]})[_0x9a94('0x14')](function(_0x3b92dd){if(_0x3b92dd&&_0x3b92dd[_0x9a94('0x40')]){var _0x57166b=_0x3b92dd['get']({'plain':!![]});_0x1dbead[_0x9a94('0x3e')]=_[_0x9a94('0x46')](_0x57166b,[_0x9a94('0x47'),'List']);_0x1dbead[_0x9a94('0x48')]=_0x57166b[_0x9a94('0x47')];_0x1dbead[_0x9a94('0x49')]=_0x57166b['List'];_0x1dbead[_0x9a94('0x48')]=_['orderBy'](_0x1dbead[_0x9a94('0x48')],[_0x9a94('0x4a')],['asc']);if(_0x1dbead['account']&&_0x1dbead['account'][_0x9a94('0x4b')]){_0x1dbead[_0x9a94('0x48')][_0x9a94('0x4c')]({'id':0x0,'priority':_0x1dbead['applications']['length']+0x1,'app':_0x9a94('0x4d'),'appdata':'autoclose','interval':_0x9a94('0x4e')});}if(_0x1dbead[_0x9a94('0x3e')][_0x9a94('0x47')]){delete _0x1dbead[_0x9a94('0x3e')][_0x9a94('0x47')];}if(_0x1dbead['account']['List']){delete _0x1dbead[_0x9a94('0x3e')][_0x9a94('0x40')];}if(_0x57166b[_0x9a94('0x40')]['Contacts'][_0x9a94('0x4f')]){return _0x57166b[_0x9a94('0x40')][_0x9a94('0x41')][0x0];}var _0x33afa7=_[_0x9a94('0xe')](_0x1a858c[_0x9a94('0x2d')],{'firstName':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x3d')],'ListId':_0x57166b['ListId']});_0x33afa7[_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x3a')]]=_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x3d')];return db[_0x9a94('0x31')][_0x9a94('0x50')](_0x33afa7);}else{throw new Error(_0x9a94('0x51'));}})[_0x9a94('0x14')](function(_0x49eb9d){_0x1dbead[_0x9a94('0x52')]=_0x49eb9d;if(_0x49eb9d){if(!_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x53')]){_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x53')]=rs[_0x9a94('0x54')]()+'\x20'+_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x3d')];}var _0x4b2d53={'ContactId':_0x49eb9d['id'],'MailAccountId':_0x1a858c[_0x9a94('0x3e')]['id'],'inReplyTo':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x53')],'to':_0x1a858c['body'][_0x9a94('0x1d')][_0x9a94('0x3d')],'cc':_0x1a858c['body'][_0x9a94('0x1d')]['cc'],'subject':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x55')],'attach':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x56')],'lastMsgAt':moment()['format'](_0x9a94('0x57')),'lastMsgDirection':'in'};return db[_0x9a94('0x58')][_0x9a94('0x2b')]({'where':{'closed':![],'MailAccountId':_0x1a858c[_0x9a94('0x3e')]['id']},'include':[{'model':db[_0x9a94('0x59')],'as':'Messages','attributes':[_0x9a94('0x53')],'where':{'messageId':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x5a')]}}]})[_0x9a94('0x14')](function(_0x4b3251){if(_0x4b3251){return[_0x4b3251,![]];}return db[_0x9a94('0x58')]['create'](_0x4b2d53)[_0x9a94('0x14')](function(_0x50ccfc){return[_0x50ccfc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9a94('0x5b')](function(_0x59efab,_0x39735a){if(_0x59efab){_0x8ddda6=_0x39735a;if(!_0x39735a){return _0x59efab[_0x9a94('0x5c')]({'inReplyTo':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x53')],'to':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')]['from'],'cc':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')]['cc'],'subject':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x55')],'attach':_0x59efab[_0x9a94('0x56')]?_0x59efab[_0x9a94('0x56')]:_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x56')],'substatus':null,'substatusAt':moment()[_0x9a94('0x5d')](_0x9a94('0x57')),'lastMsgAt':moment()[_0x9a94('0x5d')](_0x9a94('0x57')),'lastMsgDirection':'in'});}else{return _0x59efab;}}})[_0x9a94('0x14')](function(_0x4365af){_0x1dbead['interaction']=_0x4365af[_0x9a94('0x5e')]({'plain':!![]});_0x1dbead[_0x9a94('0x5f')]['created']=_0x8ddda6;return db[_0x9a94('0x59')][_0x9a94('0x50')]({'body':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x2d')],'MailAccountId':_0x1a858c['account']['id'],'MailInteractionId':_0x4365af['id'],'direction':'in','ContactId':_0x1dbead[_0x9a94('0x52')]['id'],'messageId':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')]['messageId'],'from':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x3d')],'to':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')]['to'],'cc':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')]['cc'],'subject':_0x1a858c['body'][_0x9a94('0x1d')]['subject'],'attach':_0x1a858c['body']['message'][_0x9a94('0x56')],'Attachments':_0x1a858c['body'][_0x9a94('0x1d')][_0x9a94('0x60')],'originTo':_0x1a858c[_0x9a94('0x2d')]['message'][_0x9a94('0x61')],'originCc':_0x1a858c['body'][_0x9a94('0x1d')]['originCc'],'bcc':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x62')],'ChatWebsiteId':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x63')]||null,'originChannel':_0x1a858c[_0x9a94('0x2d')]['message'][_0x9a94('0x64')]||_0x9a94('0x65'),'ChatOfflineMessageId':_0x1a858c[_0x9a94('0x2d')][_0x9a94('0x1d')][_0x9a94('0x66')]||null},{'include':[{'model':db[_0x9a94('0x67')],'as':_0x9a94('0x68')}]});})[_0x9a94('0x14')](function(_0x14a2c2){_0x1dbead['message']=_0x14a2c2;if(_0x1dbead[_0x9a94('0x5f')][_0x9a94('0x69')]){return db[_0x9a94('0x6a')]['find']({'attributes':['id','name'],'where':{'id':_0x1dbead[_0x9a94('0x5f')][_0x9a94('0x69')]}})[_0x9a94('0x14')](function(_0xcb5526){if(_0xcb5526){_0x1dbead[_0x9a94('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xcb5526[_0x9a94('0x6b')]+','+(_0x1dbead[_0x9a94('0x3e')][_0x9a94('0x6c')]||0xa),'interval':_0x9a94('0x4e')});}return respondWithRpcPromise(_0x9a94('0x6d'),'startRouting',_0x1dbead);});}return respondWithRpcPromise(_0x9a94('0x6d'),'startRouting',_0x1dbead);})[_0x9a94('0x14')](function(_0x44d9ab){_0x3b60aa(_0x44d9ab);})['catch'](function(_0x2a71a1){_0x139bac(_0x30c55c[_0x9a94('0x1b')](0x1f4,_0x2a71a1[_0x9a94('0x1d')]));});});}; \ No newline at end of file +var _0x618b=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','find','where','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','CmContact','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','List','applications','orderBy','asc','account','push','length','close','autoclose','*,*,*,*','defaults','create','contact','messageId','generate','subject','attach','format','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','get','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x618b,0x141));var _0xb618=function(_0x1b9fc2,_0x493ba3){_0x1b9fc2=_0x1b9fc2-0x0;var _0x211936=_0x618b[_0x1b9fc2];return _0x211936;};'use strict';var _=require(_0xb618('0x0'));var util=require(_0xb618('0x1'));var moment=require(_0xb618('0x2'));var BPromise=require(_0xb618('0x3'));var rs=require(_0xb618('0x4'));var fs=require('fs');var Redis=require(_0xb618('0x5'));var db=require(_0xb618('0x6'))['db'];var utils=require(_0xb618('0x7'));var logger=require('../../config/logger')(_0xb618('0x8'));var config=require(_0xb618('0x9'));var jayson=require(_0xb618('0xa'));var client=jayson[_0xb618('0xb')][_0xb618('0xc')]({'port':0x232c});config[_0xb618('0xd')]=_['defaults'](config[_0xb618('0xd')],{'host':_0xb618('0xe'),'port':0x18eb});var socket=require(_0xb618('0xf'))(new Redis(config[_0xb618('0xd')]));require(_0xb618('0x10'))[_0xb618('0x11')](socket);function respondWithRpcPromise(_0x20507e,_0x32c0ce,_0x39d378){return new BPromise(function(_0x4d5c3a,_0x2548e3){return client[_0xb618('0x12')](_0x20507e,_0x39d378)[_0xb618('0x13')](function(_0x1eaf7d){logger[_0xb618('0x14')](_0xb618('0x15'),_0x32c0ce,_0xb618('0x16'));logger[_0xb618('0x17')](_0xb618('0x18'),_0x32c0ce,'request\x20sent',JSON['stringify'](_0x1eaf7d));if(_0x1eaf7d[_0xb618('0x19')]){if(_0x1eaf7d['error'][_0xb618('0x1a')]===0x1f4){logger[_0xb618('0x19')](_0xb618('0x15'),_0x32c0ce,_0x1eaf7d[_0xb618('0x19')][_0xb618('0x1b')]);return _0x2548e3(_0x1eaf7d[_0xb618('0x19')][_0xb618('0x1b')]);}logger[_0xb618('0x19')](_0xb618('0x15'),_0x32c0ce,_0x1eaf7d['error'][_0xb618('0x1b')]);return _0x4d5c3a(_0x1eaf7d[_0xb618('0x19')][_0xb618('0x1b')]);}else{logger['info'](_0xb618('0x15'),_0x32c0ce,_0xb618('0x16'));_0x4d5c3a(_0x1eaf7d[_0xb618('0x1c')]['message']);}})[_0xb618('0x1d')](function(_0x1f4556){logger['error'](_0xb618('0x15'),_0x32c0ce,_0x1f4556);_0x2548e3(_0x1f4556);});});}exports[_0xb618('0x1e')]=function(_0x9f7721){var _0x4e7bf7=this;return new Promise(function(_0x34e399,_0x362b3f){return db['MailAccount'][_0xb618('0x1f')]({'raw':_0x9f7721[_0xb618('0x20')]?_0x9f7721['options'][_0xb618('0x21')]===undefined?!![]:![]:!![],'where':_0x9f7721[_0xb618('0x20')]?_0x9f7721[_0xb618('0x20')]['where']||null:null,'attributes':_0x9f7721[_0xb618('0x20')]?_0x9f7721[_0xb618('0x20')][_0xb618('0x22')]||null:null,'limit':_0x9f7721[_0xb618('0x20')]?_0x9f7721[_0xb618('0x20')][_0xb618('0x23')]||null:null,'include':_0x9f7721[_0xb618('0x20')]?_0x9f7721['options'][_0xb618('0x24')]?_[_0xb618('0x25')](_0x9f7721['options'][_0xb618('0x24')],function(_0x14fae4){return{'model':db[_0x14fae4[_0xb618('0x26')]],'as':_0x14fae4['as'],'attributes':_0x14fae4['attributes'],'include':_0x14fae4['include']?_['map'](_0x14fae4[_0xb618('0x24')],function(_0x530d10){return{'model':db[_0x530d10[_0xb618('0x26')]],'as':_0x530d10['as'],'attributes':_0x530d10[_0xb618('0x22')],'include':_0x530d10[_0xb618('0x24')]?_[_0xb618('0x25')](_0x530d10[_0xb618('0x24')],function(_0x1ae343){return{'model':db[_0x1ae343[_0xb618('0x26')]],'as':_0x1ae343['as'],'attributes':_0x1ae343['attributes']};}):[]};}):[]};}):[]:[]})[_0xb618('0x13')](function(_0x3cbb19){logger[_0xb618('0x14')]('GetMailAccount',_0x9f7721);logger['debug'](_0xb618('0x1e'),_0x9f7721,JSON[_0xb618('0x27')](_0x3cbb19));_0x34e399(_0x3cbb19);})['catch'](function(_0x2806a0){logger[_0xb618('0x19')](_0xb618('0x1e'),_0x2806a0[_0xb618('0x1b')],_0x9f7721);_0x362b3f(_0x4e7bf7['error'](0x1f4,_0x2806a0['message']));});});};exports[_0xb618('0x28')]=function(_0x4a50a3){var _0x2838b1=this;return new Promise(function(_0x41e4bd,_0x309cf2){return db[_0xb618('0x29')][_0xb618('0x2a')]({'raw':_0x4a50a3[_0xb618('0x20')]?_0x4a50a3[_0xb618('0x20')][_0xb618('0x21')]===undefined?!![]:![]:!![],'where':_0x4a50a3[_0xb618('0x20')]?_0x4a50a3['options'][_0xb618('0x2b')]||null:null,'attributes':_0x4a50a3[_0xb618('0x20')]?_0x4a50a3[_0xb618('0x20')][_0xb618('0x22')]||null:null,'include':_0x4a50a3[_0xb618('0x20')]?_0x4a50a3[_0xb618('0x20')][_0xb618('0x24')]?_[_0xb618('0x25')](_0x4a50a3[_0xb618('0x20')][_0xb618('0x24')],function(_0x9c3c81){return{'model':db[_0x9c3c81[_0xb618('0x26')]],'as':_0x9c3c81['as'],'attributes':_0x9c3c81['attributes'],'include':_0x9c3c81['include']?_[_0xb618('0x25')](_0x9c3c81['include'],function(_0x2ee17a){return{'model':db[_0x2ee17a[_0xb618('0x26')]],'as':_0x2ee17a['as'],'attributes':_0x2ee17a[_0xb618('0x22')],'include':_0x2ee17a[_0xb618('0x24')]?_[_0xb618('0x25')](_0x2ee17a[_0xb618('0x24')],function(_0x1d2617){return{'model':db[_0x1d2617['model']],'as':_0x1d2617['as'],'attributes':_0x1d2617[_0xb618('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb618('0x13')](function(_0x3a693e){logger['info']('ShowMailAccount',_0x4a50a3);logger[_0xb618('0x17')](_0xb618('0x28'),_0x4a50a3,JSON[_0xb618('0x27')](_0x3a693e));_0x41e4bd(_0x3a693e);})['catch'](function(_0xc8231f){logger['error']('ShowMailAccount',_0xc8231f[_0xb618('0x1b')],_0x4a50a3);_0x309cf2(_0x2838b1['error'](0x1f4,_0xc8231f[_0xb618('0x1b')]));});});};exports[_0xb618('0x2c')]=function(_0x151bef){var _0x3ebe96=this;return new Promise(function(_0x153d7a,_0x4580cc){var _0x3c43c4={'body':_0x151bef[_0xb618('0x2d')],'channel':_0xb618('0x2e')};var _0x33ec4d=_[_0xb618('0x2f')](_[_0xb618('0x30')](db['CmContact'][_0xb618('0x31')]),[_0xb618('0x32'),'updatedAt',_0xb618('0x33'),_0xb618('0x34')]);var _0x4f95a5=![];if(_0x151bef[_0xb618('0x2d')]['id']){delete _0x151bef[_0xb618('0x2d')]['id'];}if(_['isNil'](_0x151bef['body'][_0xb618('0x35')])){return _0x4580cc(_0x3ebe96[_0xb618('0x19')](0x1f4,_0xb618('0x36')));}if(_[_0xb618('0x37')](_0x151bef[_0xb618('0x2d')][_0xb618('0x2d')])||_0x151bef[_0xb618('0x2d')][_0xb618('0x2d')]===''){return _0x4580cc(_0x3ebe96[_0xb618('0x19')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xb618('0x37')](_0x151bef['body']['mapKey'])){return _0x4580cc(_0x3ebe96[_0xb618('0x19')](0x1f4,_0xb618('0x38')+_0x33ec4d));}if(!_[_0xb618('0x39')](_0x33ec4d,_0x151bef[_0xb618('0x2d')][_0xb618('0x3a')])){return _0x4580cc(_0x3ebe96[_0xb618('0x19')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33ec4d));}var _0x5f30e5={};_0x5f30e5[_0x151bef['body'][_0xb618('0x3a')]]=_0x151bef['body']['from'];return db[_0xb618('0x29')][_0xb618('0x2a')]({'where':{'id':_0x151bef['account']['id']},'include':[{'model':db[_0xb618('0x3b')],'as':'List','include':[{'model':db[_0xb618('0x3c')],'as':_0xb618('0x3d'),'where':_0x5f30e5,'limit':0x1,'order':[[_0xb618('0x3e'),_0xb618('0x3f')]]}]},{'model':db['MailApplication'],'as':_0xb618('0x40')},{'model':db[_0xb618('0x41')],'as':_0xb618('0x42')}]})[_0xb618('0x13')](function(_0x33b864){if(_0x33b864&&_0x33b864['List']){var _0x279cd9=_0x33b864['get']({'plain':!![]});_0x3c43c4['account']=_['omit'](_0x279cd9,['Applications',_0xb618('0x43')]);_0x3c43c4[_0xb618('0x44')]=_0x279cd9[_0xb618('0x40')];_0x3c43c4['list']=_0x279cd9['List'];_0x3c43c4[_0xb618('0x44')]=_[_0xb618('0x45')](_0x3c43c4[_0xb618('0x44')],['priority'],[_0xb618('0x46')]);if(_0x3c43c4[_0xb618('0x47')]&&_0x3c43c4['account']['autoclose']){_0x3c43c4[_0xb618('0x44')][_0xb618('0x48')]({'id':0x0,'priority':_0x3c43c4['applications'][_0xb618('0x49')]+0x1,'app':_0xb618('0x4a'),'appdata':_0xb618('0x4b'),'interval':_0xb618('0x4c')});}if(_0x3c43c4['account'][_0xb618('0x40')]){delete _0x3c43c4[_0xb618('0x47')][_0xb618('0x40')];}if(_0x3c43c4[_0xb618('0x47')][_0xb618('0x43')]){delete _0x3c43c4['account'][_0xb618('0x43')];}if(_0x279cd9['List'][_0xb618('0x3d')]['length']){return _0x279cd9[_0xb618('0x43')]['Contacts'][0x0];}var _0x42b8b7=_[_0xb618('0x4d')](_0x151bef['body'],{'firstName':_0x151bef['body'][_0xb618('0x35')],'ListId':_0x279cd9[_0xb618('0x34')]});_0x42b8b7[_0x151bef['body'][_0xb618('0x3a')]]=_0x151bef[_0xb618('0x2d')][_0xb618('0x35')];return db['CmContact'][_0xb618('0x4e')](_0x42b8b7);}else{throw new Error('List\x20not\x20found');}})[_0xb618('0x13')](function(_0x1a1e4c){_0x3c43c4[_0xb618('0x4f')]=_0x1a1e4c;if(_0x1a1e4c){if(!_0x151bef[_0xb618('0x2d')]['message'][_0xb618('0x50')]){_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x50')]=rs[_0xb618('0x51')]()+'\x20'+_0x151bef['body']['message']['from'];}var _0x5e10a2={'ContactId':_0x1a1e4c['id'],'MailAccountId':_0x151bef['account']['id'],'inReplyTo':_0x151bef['body'][_0xb618('0x1b')][_0xb618('0x50')],'to':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x35')],'cc':_0x151bef['body'][_0xb618('0x1b')]['cc'],'subject':_0x151bef[_0xb618('0x2d')]['message'][_0xb618('0x52')],'attach':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x53')],'lastMsgAt':moment()[_0xb618('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xb618('0x2a')]({'where':{'closed':![],'MailAccountId':_0x151bef['account']['id']},'include':[{'model':db[_0xb618('0x55')],'as':_0xb618('0x56'),'attributes':[_0xb618('0x50')],'where':{'messageId':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x57')]}}]})[_0xb618('0x13')](function(_0x562eee){if(_0x562eee){return[_0x562eee,![]];}return db[_0xb618('0x58')]['create'](_0x5e10a2)['then'](function(_0x199426){return[_0x199426,!![]];});});}else{throw new Error(_0xb618('0x59'));}})[_0xb618('0x5a')](function(_0x519799,_0x2e0253){if(_0x519799){_0x4f95a5=_0x2e0253;if(!_0x2e0253){return _0x519799['update']({'inReplyTo':_0x151bef[_0xb618('0x2d')]['message'][_0xb618('0x50')],'to':_0x151bef['body'][_0xb618('0x1b')][_0xb618('0x35')],'cc':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')]['cc'],'subject':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')]['subject'],'attach':_0x519799[_0xb618('0x53')]?_0x519799['attach']:_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x53')],'substatus':null,'substatusAt':moment()[_0xb618('0x54')](_0xb618('0x5b')),'lastMsgAt':moment()[_0xb618('0x54')](_0xb618('0x5b')),'lastMsgDirection':'in'});}else{return _0x519799;}}})[_0xb618('0x13')](function(_0x17f39e){_0x3c43c4[_0xb618('0x5c')]=_0x17f39e[_0xb618('0x5d')]({'plain':!![]});_0x3c43c4['interaction']['created']=_0x4f95a5;return db[_0xb618('0x55')][_0xb618('0x4e')]({'body':_0x151bef['body']['body'],'MailAccountId':_0x151bef[_0xb618('0x47')]['id'],'MailInteractionId':_0x17f39e['id'],'direction':'in','ContactId':_0x3c43c4[_0xb618('0x4f')]['id'],'messageId':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')]['messageId'],'from':_0x151bef[_0xb618('0x2d')]['message'][_0xb618('0x35')],'to':_0x151bef['body'][_0xb618('0x1b')]['to'],'cc':_0x151bef[_0xb618('0x2d')]['message']['cc'],'subject':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x52')],'attach':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x53')],'Attachments':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')]['attachments'],'originTo':_0x151bef[_0xb618('0x2d')]['message'][_0xb618('0x5e')],'originCc':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x5f')],'bcc':_0x151bef[_0xb618('0x2d')]['message'][_0xb618('0x60')],'ChatWebsiteId':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x61')]||null,'originChannel':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x62')]||_0xb618('0x63'),'ChatOfflineMessageId':_0x151bef[_0xb618('0x2d')][_0xb618('0x1b')][_0xb618('0x64')]||null},{'include':[{'model':db[_0xb618('0x65')],'as':_0xb618('0x66')}]});})[_0xb618('0x13')](function(_0x2b4518){_0x3c43c4['message']=_0x2b4518;if(_0x3c43c4[_0xb618('0x5c')][_0xb618('0x67')]){return db[_0xb618('0x68')][_0xb618('0x2a')]({'attributes':['id',_0xb618('0x69')],'where':{'id':_0x3c43c4[_0xb618('0x5c')][_0xb618('0x67')]}})[_0xb618('0x13')](function(_0x464eee){if(_0x464eee){_0x3c43c4[_0xb618('0x44')][_0xb618('0x6a')]({'id':0x0,'priority':0x0,'app':_0xb618('0x6b'),'appdata':_0x464eee[_0xb618('0x69')]+','+(_0x3c43c4[_0xb618('0x47')][_0xb618('0x6c')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb618('0x6d'),'startRouting',_0x3c43c4);});}return respondWithRpcPromise('Start','startRouting',_0x3c43c4);})[_0xb618('0x13')](function(_0x35560b){_0x153d7a(_0x35560b);})['catch'](function(_0x3f5a18){_0x4580cc(_0x3ebe96[_0xb618('0x19')](0x1f4,_0x3f5a18[_0xb618('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0e3ca79..f208a43 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 _0x0058=['removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x52093e,_0x3b87a8){var _0x1c95b0=function(_0x3d691c){while(--_0x3d691c){_0x52093e['push'](_0x52093e['shift']());}};_0x1c95b0(++_0x3b87a8);}(_0x0058,0x1ae));var _0x8005=function(_0x428880,_0x4b0c9c){_0x428880=_0x428880-0x0;var _0x202c71=_0x0058[_0x428880];return _0x202c71;};'use strict';var MailAccountEvents=require(_0x8005('0x0'));var events=['save',_0x8005('0x1'),'update'];function createListener(_0xd14ccb,_0x4adf47){return function(_0x1a8604){_0x4adf47['emit'](_0xd14ccb,_0x1a8604);};}function removeListener(_0x47fde0,_0x1c9cc5){return function(){MailAccountEvents[_0x8005('0x2')](_0x47fde0,_0x1c9cc5);};}exports[_0x8005('0x3')]=function(_0x42eaa8){for(var _0x311eea=0x0,_0x456d4f=events[_0x8005('0x4')];_0x311eea<_0x456d4f;_0x311eea++){var _0x32e463=events[_0x311eea];var _0x50ad2f=createListener(_0x8005('0x5')+_0x32e463,_0x42eaa8);MailAccountEvents['on'](_0x32e463,_0x50ad2f);}}; \ No newline at end of file +var _0x3f73=['save','removeListener','mailAccount:','./mailAccount.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3f73,0xc3));var _0x33f7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3f73[_0x122ef9];return _0x42fba0;};'use strict';var MailAccountEvents=require(_0x33f7('0x0'));var events=[_0x33f7('0x1'),'remove','update'];function createListener(_0x918518,_0x50f2fd){return function(_0x407d71){_0x50f2fd['emit'](_0x918518,_0x407d71);};}function removeListener(_0x182643,_0x257947){return function(){MailAccountEvents[_0x33f7('0x2')](_0x182643,_0x257947);};}exports['register']=function(_0x2c8ea9){for(var _0x227540=0x0,_0x172f3e=events['length'];_0x227540<_0x172f3e;_0x227540++){var _0x9ce9ce=events[_0x227540];var _0x52855b=createListener(_0x33f7('0x3')+_0x9ce9ce,_0x2c8ea9);MailAccountEvents['on'](_0x9ce9ce,_0x52855b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2f29484..adb7693 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 _0xf4a0=['path','connect-timeout','express','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xf4a0,0x1c0));var _0x0f4a=function(_0x41213e,_0x1e973d){_0x41213e=_0x41213e-0x0;var _0x3f2960=_0xf4a0[_0x41213e];return _0x3f2960;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f4a('0x0'));var timeout=require(_0x0f4a('0x1'));var express=require(_0x0f4a('0x2'));var router=express['Router']();var fs_extra=require(_0x0f4a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0f4a('0x4'));var config=require('../../config/environment');var controller=require(_0x0f4a('0x5'));router[_0x0f4a('0x6')](_0x0f4a('0x7'),auth[_0x0f4a('0x8')](),controller[_0x0f4a('0x9')]);router[_0x0f4a('0xa')]('/:id',auth[_0x0f4a('0x8')](),controller[_0x0f4a('0xb')]);router['delete'](_0x0f4a('0x7'),auth[_0x0f4a('0x8')](),controller[_0x0f4a('0xc')]);module[_0x0f4a('0xd')]=router; \ No newline at end of file +var _0x769e=['get','isAuthenticated','put','/:id','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x5f3f14,_0x1d09c6){var _0x3468c6=function(_0x1e6077){while(--_0x1e6077){_0x5f3f14['push'](_0x5f3f14['shift']());}};_0x3468c6(++_0x1d09c6);}(_0x769e,0xc7));var _0xe769=function(_0x38fa4a,_0x28c71d){_0x38fa4a=_0x38fa4a-0x0;var _0x3f2b56=_0x769e[_0x38fa4a];return _0x3f2b56;};'use strict';var multer=require(_0xe769('0x0'));var util=require('util');var path=require(_0xe769('0x1'));var timeout=require('connect-timeout');var express=require(_0xe769('0x2'));var router=express[_0xe769('0x3')]();var fs_extra=require(_0xe769('0x4'));var auth=require(_0xe769('0x5'));var interaction=require(_0xe769('0x6'));var config=require(_0xe769('0x7'));var controller=require(_0xe769('0x8'));router[_0xe769('0x9')]('/:id',auth[_0xe769('0xa')](),controller['show']);router[_0xe769('0xb')](_0xe769('0xc'),auth[_0xe769('0xa')](),controller[_0xe769('0xd')]);router[_0xe769('0xe')](_0xe769('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe769('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0569f6e..b13fae3 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 _0xd7cf=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1a2e18,_0x23a494){var _0x3e07c0=function(_0xb703dc){while(--_0xb703dc){_0x1a2e18['push'](_0x1a2e18['shift']());}};_0x3e07c0(++_0x23a494);}(_0xd7cf,0xfd));var _0xfd7c=function(_0x59d369,_0x56a533){_0x59d369=_0x59d369-0x0;var _0x58c3eb=_0xd7cf[_0x59d369];return _0x58c3eb;};'use strict';var Sequelize=require('sequelize');module[_0xfd7c('0x0')]={'priority':{'type':Sequelize[_0xfd7c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfd7c('0x2')],'allowNull':![],'defaultValue':_0xfd7c('0x3')},'appdata':{'type':Sequelize[_0xfd7c('0x4')]()},'description':{'type':Sequelize[_0xfd7c('0x2')]},'interval':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':_0xfd7c('0x5')}}; \ No newline at end of file +var _0xc30b=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x44e384,_0x3cec7d){var _0x3f26d2=function(_0x4428cf){while(--_0x4428cf){_0x44e384['push'](_0x44e384['shift']());}};_0x3f26d2(++_0x3cec7d);}(_0xc30b,0x138));var _0xbc30=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xc30b[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0xbc30('0x0'));module[_0xbc30('0x1')]={'priority':{'type':Sequelize[_0xbc30('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbc30('0x3')},'appdata':{'type':Sequelize[_0xbc30('0x4')]()},'description':{'type':Sequelize[_0xbc30('0x5')]},'interval':{'type':Sequelize[_0xbc30('0x5')],'defaultValue':_0xbc30('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index ec9f8b5..27fb04c 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 _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x5e63d1,_0x120b7e){var _0x29783c=function(_0x128adc){while(--_0x128adc){_0x5e63d1['push'](_0x5e63d1['shift']());}};_0x29783c(++_0x120b7e);}(_0xac4a,0x13f));var _0xaac4=function(_0x2702f0,_0x2d0937){_0x2702f0=_0x2702f0-0x0;var _0x2f19a0=_0xac4a[_0x2702f0];return _0x2f19a0;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +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(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0xaa88[_0x4a5f6c];return _0x281ffd;};'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 diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1598dfe..4496dd1 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 _0xb6a1=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x294072,_0x2cec20){var _0x1cfeab=function(_0x253f53){while(--_0x253f53){_0x294072['push'](_0x294072['shift']());}};_0x1cfeab(++_0x2cec20);}(_0xb6a1,0x110));var _0x1b6a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb6a1[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b6a('0x0'))(_0x1b6a('0x1'));var moment=require('moment');var BPromise=require(_0x1b6a('0x2'));var rp=require(_0x1b6a('0x3'));var fs=require('fs');var path=require(_0x1b6a('0x4'));var rimraf=require(_0x1b6a('0x5'));var config=require(_0x1b6a('0x6'));var attributes=require(_0x1b6a('0x7'));module[_0x1b6a('0x8')]=function(_0x4b9270,_0x2e1367){return _0x4b9270[_0x1b6a('0x9')](_0x1b6a('0xa'),attributes,{'tableName':_0x1b6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1b6a('0xc'),'collate':_0x1b6a('0xd')});}; \ No newline at end of file +var _0x1913=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','rimraf'];(function(_0x4c61b7,_0xbb0ff6){var _0x11f934=function(_0x31e59b){while(--_0x31e59b){_0x4c61b7['push'](_0x4c61b7['shift']());}};_0x11f934(++_0xbb0ff6);}(_0x1913,0x1c3));var _0x3191=function(_0x51ecfc,_0x66e31){_0x51ecfc=_0x51ecfc-0x0;var _0x26cd27=_0x1913[_0x51ecfc];return _0x26cd27;};'use strict';var _=require(_0x3191('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3191('0x1'));var BPromise=require(_0x3191('0x2'));var rp=require(_0x3191('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3191('0x4'));var config=require('../../config/environment');var attributes=require(_0x3191('0x5'));module[_0x3191('0x6')]=function(_0xbc662d,_0x3dafbf){return _0xbc662d[_0x3191('0x7')](_0x3191('0x8'),attributes,{'tableName':_0x3191('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3191('0xa'),'collate':_0x3191('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d529195..1bb87e8 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 _0x7835=['where','attributes','UpdateMailApplication','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','MailApplication','update','body','options','raw'];(function(_0x217e1e,_0x2a0f48){var _0x2dc1ff=function(_0x3f1461){while(--_0x3f1461){_0x217e1e['push'](_0x217e1e['shift']());}};_0x2dc1ff(++_0x2a0f48);}(_0x7835,0xec));var _0x5783=function(_0x175bd3,_0x5c33f9){_0x175bd3=_0x175bd3-0x0;var _0x4d6e8f=_0x7835[_0x175bd3];return _0x4d6e8f;};'use strict';var _=require(_0x5783('0x0'));var util=require(_0x5783('0x1'));var moment=require(_0x5783('0x2'));var BPromise=require(_0x5783('0x3'));var rs=require(_0x5783('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5783('0x5'))['db'];var utils=require(_0x5783('0x6'));var logger=require(_0x5783('0x7'))('rpc');var config=require(_0x5783('0x8'));var jayson=require(_0x5783('0x9'));var client=jayson['client'][_0x5783('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2af7c0,_0x3247e5,_0x237f1f){return new BPromise(function(_0x31cb5f,_0x198cce){return client['request'](_0x2af7c0,_0x237f1f)[_0x5783('0xb')](function(_0x1ab8c8){logger[_0x5783('0xc')](_0x5783('0xd'),_0x3247e5,_0x5783('0xe'));logger[_0x5783('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x3247e5,_0x5783('0xe'),JSON['stringify'](_0x1ab8c8));if(_0x1ab8c8[_0x5783('0x10')]){if(_0x1ab8c8[_0x5783('0x10')][_0x5783('0x11')]===0x1f4){logger[_0x5783('0x10')](_0x5783('0xd'),_0x3247e5,_0x1ab8c8[_0x5783('0x10')]['message']);return _0x198cce(_0x1ab8c8[_0x5783('0x10')][_0x5783('0x12')]);}logger['error'](_0x5783('0xd'),_0x3247e5,_0x1ab8c8['error'][_0x5783('0x12')]);return _0x31cb5f(_0x1ab8c8[_0x5783('0x10')][_0x5783('0x12')]);}else{logger[_0x5783('0xc')](_0x5783('0xd'),_0x3247e5,'request\x20sent');_0x31cb5f(_0x1ab8c8[_0x5783('0x13')][_0x5783('0x12')]);}})['catch'](function(_0x41b522){logger['error'](_0x5783('0xd'),_0x3247e5,_0x41b522);_0x198cce(_0x41b522);});});}exports['UpdateMailApplication']=function(_0x3782d1){var _0x171802=this;return new Promise(function(_0x23728b,_0x489426){return db[_0x5783('0x14')][_0x5783('0x15')](_0x3782d1[_0x5783('0x16')],{'raw':_0x3782d1[_0x5783('0x17')]?_0x3782d1[_0x5783('0x17')][_0x5783('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3782d1['options']?_0x3782d1['options'][_0x5783('0x19')]||null:null,'attributes':_0x3782d1[_0x5783('0x17')]?_0x3782d1[_0x5783('0x17')][_0x5783('0x1a')]||null:null,'limit':_0x3782d1[_0x5783('0x17')]?_0x3782d1[_0x5783('0x17')]['limit']||null:null})[_0x5783('0xb')](function(_0x5a911f){logger[_0x5783('0xc')](_0x5783('0x1b'),_0x3782d1);logger[_0x5783('0xf')]('UpdateMailApplication',_0x3782d1,JSON[_0x5783('0x1c')](_0x5a911f));_0x23728b(_0x5a911f);})['catch'](function(_0x510a86){logger['error'](_0x5783('0x1b'),_0x510a86[_0x5783('0x12')],_0x3782d1);_0x489426(_0x171802[_0x5783('0x10')](0x1f4,_0x510a86[_0x5783('0x12')]));});});}; \ No newline at end of file +var _0x4a93=['where','attributes','limit','then','debug','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','http','request','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailApplication','update','body','raw','options'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0x4a93,0x165));var _0x34a9=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x4a93[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x34a9('0x0'));var util=require(_0x34a9('0x1'));var moment=require(_0x34a9('0x2'));var BPromise=require(_0x34a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34a9('0x5'))('rpc');var config=require(_0x34a9('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x34a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x371d3d,_0x35a887,_0x4c1959){return new BPromise(function(_0x368d22,_0x52c2a3){return client[_0x34a9('0x8')](_0x371d3d,_0x4c1959)['then'](function(_0x56b550){logger[_0x34a9('0x9')](_0x34a9('0xa'),_0x35a887,'request\x20sent');logger['debug'](_0x34a9('0xb'),_0x35a887,'request\x20sent',JSON['stringify'](_0x56b550));if(_0x56b550[_0x34a9('0xc')]){if(_0x56b550[_0x34a9('0xc')][_0x34a9('0xd')]===0x1f4){logger[_0x34a9('0xc')](_0x34a9('0xa'),_0x35a887,_0x56b550['error']['message']);return _0x52c2a3(_0x56b550[_0x34a9('0xc')][_0x34a9('0xe')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x35a887,_0x56b550['error'][_0x34a9('0xe')]);return _0x368d22(_0x56b550['error']['message']);}else{logger[_0x34a9('0x9')](_0x34a9('0xa'),_0x35a887,'request\x20sent');_0x368d22(_0x56b550['result'][_0x34a9('0xe')]);}})[_0x34a9('0xf')](function(_0x34413e){logger[_0x34a9('0xc')]('MailApplication,\x20%s,\x20%s',_0x35a887,_0x34413e);_0x52c2a3(_0x34413e);});});}exports[_0x34a9('0x10')]=function(_0x4452ec){var _0x830f22=this;return new Promise(function(_0x1bd8ed,_0x192153){return db['MailApplication'][_0x34a9('0x11')](_0x4452ec[_0x34a9('0x12')],{'raw':_0x4452ec['options']?_0x4452ec['options'][_0x34a9('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4452ec[_0x34a9('0x14')]?_0x4452ec[_0x34a9('0x14')][_0x34a9('0x15')]||null:null,'attributes':_0x4452ec[_0x34a9('0x14')]?_0x4452ec['options'][_0x34a9('0x16')]||null:null,'limit':_0x4452ec[_0x34a9('0x14')]?_0x4452ec['options'][_0x34a9('0x17')]||null:null})[_0x34a9('0x18')](function(_0x2ab60c){logger['info'](_0x34a9('0x10'),_0x4452ec);logger[_0x34a9('0x19')](_0x34a9('0x10'),_0x4452ec,JSON[_0x34a9('0x1a')](_0x2ab60c));_0x1bd8ed(_0x2ab60c);})[_0x34a9('0xf')](function(_0x154164){logger[_0x34a9('0xc')]('UpdateMailApplication',_0x154164[_0x34a9('0xe')],_0x4452ec);_0x192153(_0x830f22[_0x34a9('0xc')](0x1f4,_0x154164[_0x34a9('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4df32d4..6140378 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 _0x4dc7=['/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:destroy','destroy','delete','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','create'];(function(_0x266601,_0x9b3a19){var _0x13f7d3=function(_0xcf8c2d){while(--_0xcf8c2d){_0x266601['push'](_0x266601['shift']());}};_0x13f7d3(++_0x9b3a19);}(_0x4dc7,0x1e5));var _0x74dc=function(_0x19f564,_0x5c2733){_0x19f564=_0x19f564-0x0;var _0x95fc33=_0x4dc7[_0x19f564];return _0x95fc33;};'use strict';var express=require(_0x74dc('0x0'));var router=express[_0x74dc('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x74dc('0x2'));var controller=require(_0x74dc('0x3'));router[_0x74dc('0x4')]('/',auth[_0x74dc('0x5')](),controller[_0x74dc('0x6')]);router[_0x74dc('0x4')](_0x74dc('0x7'),auth[_0x74dc('0x5')](),controller['describe']);router[_0x74dc('0x4')](_0x74dc('0x8'),auth[_0x74dc('0x5')](),controller[_0x74dc('0x9')]);router['get'](_0x74dc('0xa'),auth['isAuthenticated'](),controller['getMessages']);router[_0x74dc('0x4')](_0x74dc('0xb'),auth[_0x74dc('0x5')](),controller[_0x74dc('0xc')]);router[_0x74dc('0xd')]('/',auth[_0x74dc('0x5')](),controller[_0x74dc('0xe')]);router[_0x74dc('0xd')](_0x74dc('0xa'),auth[_0x74dc('0x5')](),controller['addMessage']);router[_0x74dc('0xd')](_0x74dc('0xf'),auth[_0x74dc('0x5')](),interaction[_0x74dc('0x10')](_0x74dc('0x11'),_0x74dc('0x12')),controller['addTags']);router[_0x74dc('0x13')](_0x74dc('0x8'),auth[_0x74dc('0x5')](),interaction[_0x74dc('0x10')]('mail','mailinteraction:update'),controller['update']);router['delete'](_0x74dc('0x8'),auth[_0x74dc('0x5')](),interaction[_0x74dc('0x10')](_0x74dc('0x11'),_0x74dc('0x14')),controller[_0x74dc('0x15')]);router[_0x74dc('0x16')](_0x74dc('0xf'),auth[_0x74dc('0x5')](),controller[_0x74dc('0x17')]);module[_0x74dc('0x18')]=router; \ No newline at end of file +var _0x42ba=['post','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','/:id','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','/:id/download','download','create'];(function(_0x543971,_0x221213){var _0x5c4626=function(_0x11ca1b){while(--_0x11ca1b){_0x543971['push'](_0x543971['shift']());}};_0x5c4626(++_0x221213);}(_0x42ba,0x1b8));var _0xa42b=function(_0x178361,_0xb85ae0){_0x178361=_0x178361-0x0;var _0x59b3e1=_0x42ba[_0x178361];return _0x59b3e1;};'use strict';var express=require(_0xa42b('0x0'));var router=express[_0xa42b('0x1')]();var auth=require(_0xa42b('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xa42b('0x3'));router[_0xa42b('0x4')]('/',auth[_0xa42b('0x5')](),controller['index']);router[_0xa42b('0x4')](_0xa42b('0x6'),auth[_0xa42b('0x5')](),controller['describe']);router[_0xa42b('0x4')]('/:id',auth[_0xa42b('0x5')](),controller['show']);router[_0xa42b('0x4')]('/:id/messages',auth[_0xa42b('0x5')](),controller['getMessages']);router[_0xa42b('0x4')](_0xa42b('0x7'),auth['isAuthenticated'](),controller[_0xa42b('0x8')]);router['post']('/',auth[_0xa42b('0x5')](),controller[_0xa42b('0x9')]);router[_0xa42b('0xa')](_0xa42b('0xb'),auth[_0xa42b('0x5')](),controller[_0xa42b('0xc')]);router[_0xa42b('0xa')](_0xa42b('0xd'),auth['isAuthenticated'](),interaction[_0xa42b('0xe')](_0xa42b('0xf'),_0xa42b('0x10')),controller[_0xa42b('0x11')]);router['put'](_0xa42b('0x12'),auth[_0xa42b('0x5')](),interaction[_0xa42b('0xe')](_0xa42b('0xf'),_0xa42b('0x13')),controller[_0xa42b('0x14')]);router[_0xa42b('0x15')]('/:id',auth[_0xa42b('0x5')](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0xa42b('0x16')]);router[_0xa42b('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa42b('0x17')]);module[_0xa42b('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 3f2a2fc..f97bebf 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 _0x8a6f=['ENUM','out','sequelize','iconv','exports','DATE','STRING','TEXT','BOOLEAN'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x8a6f,0x1bb));var _0xf8a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf8a6('0x0'));var iconv=require(_0xf8a6('0x1'));module[_0xf8a6('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf8a6('0x3')]},'disposition':{'type':Sequelize[_0xf8a6('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf8a6('0x4')]},'inReplyTo':{'type':Sequelize[_0xf8a6('0x4')](0x1fe)},'to':{'type':Sequelize[_0xf8a6('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xf8a6('0x5')]()},'attach':{'type':Sequelize[_0xf8a6('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf8a6('0x3')]},'substatus':{'type':Sequelize[_0xf8a6('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xf8a6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xf8a6('0x7')]('in',_0xf8a6('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf8a6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf8a6('0x7')]('in',_0xf8a6('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb3eb=['DATE','out','sequelize','iconv','exports','STRING','TEXT','long','BOOLEAN'];(function(_0x53f707,_0x51a2f7){var _0x10a9f5=function(_0x14b513){while(--_0x14b513){_0x53f707['push'](_0x53f707['shift']());}};_0x10a9f5(++_0x51a2f7);}(_0xb3eb,0x80));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbb3e('0x0'));var iconv=require(_0xbb3e('0x1'));module[_0xbb3e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbb3e('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbb3e('0x3')]},'note':{'type':Sequelize[_0xbb3e('0x3')]},'inReplyTo':{'type':Sequelize[_0xbb3e('0x3')](0x1fe)},'to':{'type':Sequelize[_0xbb3e('0x3')]},'cc':{'type':Sequelize[_0xbb3e('0x4')](_0xbb3e('0x5'))},'subject':{'type':Sequelize[_0xbb3e('0x4')]()},'attach':{'type':Sequelize[_0xbb3e('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbb3e('0x7')]},'substatus':{'type':Sequelize[_0xbb3e('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xbb3e('0x7')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb3e('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb3e('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbb3e('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 8481805..d0745ec 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 _0x514a=['html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','json','offset','undefined','count','limit','set','update','then','status','error','stack','name','send','Users','map','Tags','TagIds','split','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','MailInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','getFullTextValue','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','forEach','i.MailAccountId\x20IN\x20?','concat','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','ui.MailInteractionId\x20IN\x20?','enableEmailPreview','all','rows','show','params','includeAll','include','options','body','destroy','describe','addMessage','ids','getMessages','rawAttributes','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','addTags','setTags','omit','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','files','root','server','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','get','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb'];(function(_0x1dc826,_0x30585b){var _0x48f16d=function(_0x2d9e01){while(--_0x2d9e01){_0x1dc826['push'](_0x1dc826['shift']());}};_0x48f16d(++_0x30585b);}(_0x514a,0x1bc));var _0xa514=function(_0x1d2c7d,_0x907a82){_0x1d2c7d=_0x1d2c7d-0x0;var _0x82a49f=_0x514a[_0x1d2c7d];return _0x82a49f;};'use strict';var emlformat=require(_0xa514('0x0'));var rimraf=require(_0xa514('0x1'));var zipdir=require(_0xa514('0x2'));var moment=require(_0xa514('0x3'));var BPromise=require(_0xa514('0x4'));var util=require(_0xa514('0x5'));var path=require(_0xa514('0x6'));var fs=require('fs');var _=require(_0xa514('0x7'));var squel=require('squel');var juice=require('juice');var Redis=require(_0xa514('0x8'));var qs=require(_0xa514('0x9'));var as=require(_0xa514('0xa'));var logger=require(_0xa514('0xb'))(_0xa514('0xc'));var config=require('../../config/environment');var db=require(_0xa514('0xd'))['db'];var htmlEntities=require(_0xa514('0xe'));config[_0xa514('0xf')]=_[_0xa514('0x10')](config['redis'],{'host':_0xa514('0x11'),'port':0x18eb});var socket=require(_0xa514('0x12'))(new Redis(config['redis']));require(_0xa514('0x13'))[_0xa514('0x14')](socket);function respondWithStatusCode(_0x88a66b,_0x4d8139){_0x4d8139=_0x4d8139||0xcc;return function(_0x5d1b6d){if(_0x5d1b6d){return _0x88a66b[_0xa514('0x15')](_0x4d8139);}return _0x88a66b['status'](_0x4d8139)[_0xa514('0x16')]();};}function respondWithResult(_0x416874,_0x239149){_0x239149=_0x239149||0xc8;return function(_0x380d0e){if(_0x380d0e){return _0x416874['status'](_0x239149)[_0xa514('0x17')](_0x380d0e);}};}function respondWithFilteredResult(_0x42a4d7,_0x9b0c38){return function(_0x5b729c){if(_0x5b729c){var _0x4af156=typeof _0x9b0c38[_0xa514('0x18')]===_0xa514('0x19')&&typeof _0x9b0c38['limit']===_0xa514('0x19');var _0xafdf66=_0x5b729c[_0xa514('0x1a')];var _0x223f52=_0x4af156?0x0:_0x9b0c38[_0xa514('0x18')];var _0x276f92=_0x4af156?_0x5b729c[_0xa514('0x1a')]:_0x9b0c38[_0xa514('0x18')]+_0x9b0c38[_0xa514('0x1b')];var _0x2e3131;if(_0x276f92>=_0xafdf66){_0x276f92=_0xafdf66;_0x2e3131=0xc8;}else{_0x2e3131=0xce;}_0x42a4d7['status'](_0x2e3131);return _0x42a4d7[_0xa514('0x1c')]('Content-Range',_0x223f52+'-'+_0x276f92+'/'+_0xafdf66)[_0xa514('0x17')](_0x5b729c);}return null;};}function saveUpdates(_0xece2d0){return function(_0x5bbea3){if(_0x5bbea3){return _0x5bbea3[_0xa514('0x1d')](_0xece2d0)[_0xa514('0x1e')](function(_0x2ef5dd){return _0x2ef5dd;});}return null;};}function removeEntity(_0xea1f5c){return function(_0x30f49c){if(_0x30f49c){return _0x30f49c['destroy']()[_0xa514('0x1e')](function(){_0xea1f5c[_0xa514('0x1f')](0xcc)[_0xa514('0x16')]();});}};}function handleEntityNotFound(_0x5664cd){return function(_0x3733f9){if(!_0x3733f9){_0x5664cd[_0xa514('0x15')](0x194);}return _0x3733f9;};}function handleError(_0x393709,_0x167dbf){_0x167dbf=_0x167dbf||0x1f4;return function(_0x3b0336){logger[_0xa514('0x20')](_0x3b0336[_0xa514('0x21')]);if(_0x3b0336['name']){delete _0x3b0336[_0xa514('0x22')];}_0x393709[_0xa514('0x1f')](_0x167dbf)[_0xa514('0x23')](_0x3b0336);};}function getInteractionUsers(_0x153219,_0x163b4b){return new BPromise(function(_0x359e7f,_0x19e5bc){try{if(_0x163b4b[_0x153219['id']]){_0x153219[_0xa514('0x24')]=_[_0xa514('0x25')](_0x163b4b[_0x153219['id']],function(_0x63d6e3){return{'id':_0x63d6e3['id'],'fullname':_0x63d6e3['fullname']};});}}catch(_0x3e4d22){_0x19e5bc(_0x3e4d22);}_0x359e7f(_0x153219);});}function getInteractionTags(_0x4d5295,_0xdb8cd9){return new BPromise(function(_0x15a9cb,_0x140eb7){try{if(_0x4d5295['TagIds']){_0x4d5295[_0xa514('0x26')]=[];_0x4d5295[_0xa514('0x27')][_0xa514('0x28')](',')['forEach'](function(_0x1e5d96){_0x4d5295[_0xa514('0x26')][_0xa514('0x29')](_0xdb8cd9[_0x1e5d96]);});}delete _0x4d5295[_0xa514('0x27')];}catch(_0x51b8e7){_0x140eb7(_0x51b8e7);}_0x15a9cb(_0x4d5295);});}function getLastMessageText(_0x5e4a51){return new BPromise(function(_0x41ae99,_0x428cb9){return db[_0xa514('0x2a')][_0xa514('0x2b')]({'where':{'$and':[{'MailInteractionId':_0x5e4a51['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xa514('0x2c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xa514('0x2d')],'order':_0xa514('0x2e'),'raw':!![]})[_0xa514('0x1e')](function(_0x1710a9){if(_0x1710a9&&_0x1710a9['plainBody']){_0x5e4a51[_0xa514('0x2f')]=_['trimStart'](_0x1710a9[_0xa514('0x2d')]);}_0x41ae99(_0x5e4a51);})[_0xa514('0x30')](function(_0x141d19){_0x428cb9(_0x141d19);});});}function updateMailInteraction(_0x1101d2,_0x8dc797,_0x1e71a6,_0x5d9d41){return new BPromise(function(_0x3bf277,_0x125544){return getInteractionUsers(_0x1101d2,_0x1e71a6)['then'](function(_0x3fd457){return getInteractionTags(_0x3fd457,_0x8dc797);})['then'](function(_0x5d1ead){if(_0x5d9d41){_0x3bf277(getLastMessageText(_0x5d1ead));}else{_0x3bf277(_0x5d1ead);}})[_0xa514('0x30')](function(_0x2c951f){_0x125544(_0x2c951f);});});}exports['index']=function(_0x149614,_0x4971c2){var _0x3a170b={},_0x215fd7={},_0x5cf504={'count':0x0,'rows':[]};var _0x47024d=_[_0xa514('0x25')](db[_0xa514('0x31')]['rawAttributes'],function(_0x3b33cc){return{'name':_0x3b33cc[_0xa514('0x32')],'type':_0x3b33cc[_0xa514('0x33')][_0xa514('0x34')]};});_0x215fd7[_0xa514('0x35')]=_[_0xa514('0x25')](_0x47024d,_0xa514('0x22'));_0x215fd7[_0xa514('0x36')]=_[_0xa514('0x37')](_0x149614[_0xa514('0x36')]);_0x215fd7[_0xa514('0x38')]=_[_0xa514('0x39')](_0x215fd7[_0xa514('0x35')],_0x215fd7[_0xa514('0x36')]);_0x3a170b['attributes']=_[_0xa514('0x39')](_0x215fd7[_0xa514('0x35')],qs['fields'](_0x149614[_0xa514('0x36')]['fields']));_0x3a170b[_0xa514('0x3a')]=_0x3a170b[_0xa514('0x3a')][_0xa514('0x3b')]?_0x3a170b[_0xa514('0x3a')]:_0x215fd7[_0xa514('0x35')];if(!_0x149614['query'][_0xa514('0x3c')]('nolimit')){_0x3a170b[_0xa514('0x1b')]=qs['limit'](_0x149614[_0xa514('0x36')][_0xa514('0x1b')]);_0x3a170b[_0xa514('0x18')]=qs[_0xa514('0x18')](_0x149614[_0xa514('0x36')][_0xa514('0x18')]);}_0x3a170b[_0xa514('0x3d')]=qs[_0xa514('0x3e')](_0x149614['query'][_0xa514('0x3e')]);_0x3a170b[_0xa514('0x3f')]=qs['filters'](_[_0xa514('0x40')](_0x149614[_0xa514('0x36')],_0x215fd7[_0xa514('0x38')]),_0x47024d);var _0x181d0a=[];var _0x10237a=squel[_0xa514('0x41')]()[_0xa514('0x42')]('id')[_0xa514('0x42')]('name')[_0xa514('0x42')](_0xa514('0x43'))[_0xa514('0x44')](_0xa514('0x45'));var _0x1fb4a4=squel[_0xa514('0x41')]()[_0xa514('0x42')](_0xa514('0x46'))[_0xa514('0x42')](_0xa514('0x47'))['field'](_0xa514('0x48'))['from']('user_has_mail_interactions','ui')[_0xa514('0x49')](_0xa514('0x4a'),'u',_0xa514('0x4b'));var _0x187612=squel['select']()[_0xa514('0x44')](_0xa514('0x4c'),'i')['left_join']('cm_contacts','c',_0xa514('0x4d'))[_0xa514('0x49')](_0xa514('0x4a'),'o',_0xa514('0x4e'))[_0xa514('0x49')](_0xa514('0x4f'),'a',_0xa514('0x50'))[_0xa514('0x49')](_0xa514('0x51'),'me',_0xa514('0x52'))[_0xa514('0x49')](_0xa514('0x53'),'it',_0xa514('0x54'))[_0xa514('0x49')](_0xa514('0x45'),'t','t.id\x20=\x20it.TagId');var _0x746799=squel[_0xa514('0x55')]();var _0xe2c0dd=[];var _0x24474b=squel[_0xa514('0x55')]();var _0x503628;if(_0x149614[_0xa514('0x36')][_0xa514('0x56')]){_0x503628=as[_0xa514('0x57')](_0x149614[_0xa514('0x36')]['search']);var _0x353324=_0x503628[_0xa514('0x58')];for(var _0x51ced6=0x0;_0x51ced6<_0x503628[_0xa514('0x59')][_0xa514('0x3b')];_0x51ced6++){var _0x3aeb2e=_0x503628['conditions'][_0x51ced6];var _0x142124='i';var _0xfc9301=_[_0xa514('0x5a')](_0x47024d,[_0xa514('0x22'),_0x3aeb2e[_0xa514('0x42')]]);if(!_0xfc9301){switch(_0x3aeb2e[_0xa514('0x42')]){case _0xa514('0x5b'):if(_0x3aeb2e[_0xa514('0x5c')]==0x1){_0x187612['having']('`'+_0x3aeb2e['field']+_0xa514('0x5d'));}else{_0x187612[_0xa514('0x5e')]('`'+_0x3aeb2e[_0xa514('0x42')]+'`\x20>\x200');}break;case _0xa514('0x5f'):if(_0x3aeb2e[_0xa514('0x60')]==='$substring'){if(_0x3aeb2e[_0xa514('0x5c')]['split']('\x20')[_0xa514('0x3b')]>0x1){_0x746799[_0x353324]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa514('0x61')](_0x3aeb2e[_0xa514('0x5c')]),null);}else{var _0xdf0b15='%'+_0x3aeb2e[_0xa514('0x5c')]+'%';_0x746799[_0x353324]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xdf0b15,_0xdf0b15,_0xdf0b15);}}else{_0xfc9301=_[_0xa514('0x5a')](_0x47024d,[_0xa514('0x22'),_0xa514('0x62')]);_0x3aeb2e[_0xa514('0x42')]=_0xa514('0x62');_0x172c65=as[_0xa514('0x63')](_0x142124,_0xfc9301[_0xa514('0x33')],_0x3aeb2e);_0x746799[_0x353324](_0x172c65['text'],_0x172c65[_0xa514('0x5c')][_0xa514('0x64')],_0x172c65[_0xa514('0x5c')][_0xa514('0x16')]);}break;case _0xa514('0x65'):var _0x18342e=_0x3aeb2e[_0xa514('0x5c')][_0xa514('0x28')](',')[_0xa514('0x25')](function(_0x20d02b){return Number(_0x20d02b);});_0x18342e['forEach'](function(_0x5cb698){_0x24474b['or'](_0xa514('0x66'),'%,'+_0x5cb698+',%');});_0xe2c0dd=_[_0xa514('0x67')](_0xe2c0dd,_0x18342e);break;case _0xa514('0x68'):if(_0x3aeb2e[_0xa514('0x60')]==='$substring'){_0x746799[_0x353324](_0xa514('0x69'),'%'+_0x3aeb2e[_0xa514('0x5c')]+'%',null);}else{_0xfc9301=_['find'](_0x47024d,[_0xa514('0x22'),_0xa514('0x6a')]);_0x3aeb2e[_0xa514('0x42')]='UserId';_0x172c65=as[_0xa514('0x63')](_0x142124,_0xfc9301[_0xa514('0x33')],_0x3aeb2e);_0x746799[_0x353324](_0x172c65[_0xa514('0x6b')],_0x172c65[_0xa514('0x5c')][_0xa514('0x64')],_0x172c65['value'][_0xa514('0x16')]);}break;case _0xa514('0x2d'):_0x172c65=as[_0xa514('0x63')]('me',null,_0x3aeb2e);_0x746799[_0x353324](_0x172c65[_0xa514('0x6b')],_0x172c65[_0xa514('0x5c')]['start'],_0x172c65[_0xa514('0x5c')][_0xa514('0x16')]);break;}}else{var _0x172c65=as[_0xa514('0x63')](_0x142124,_0xfc9301[_0xa514('0x33')],_0x3aeb2e);_0x746799[_0x353324](_0x172c65[_0xa514('0x6b')],_0x172c65[_0xa514('0x5c')][_0xa514('0x64')],_0x172c65[_0xa514('0x5c')]['end']);}}}else{var _0x146fe7=_(_0x149614[_0xa514('0x36')])['keys']()['map'](function(_0x11908b){return _['some'](_0x47024d,[_0xa514('0x22'),_0x11908b])?_0x11908b:undefined;})[_0xa514('0x6c')]()[_0xa514('0x5c')]();if(!_['isEmpty'](_0x146fe7)){_0x146fe7[_0xa514('0x6d')](function(_0x24e006){if(_0x24e006==='MailAccountId'){_0x187612['where'](_0xa514('0x6e'),[][_0xa514('0x6f')](_0x149614['query'][_0x24e006]));}else if(_0x24e006==='createdAt'){var _0x33380e=JSON[_0xa514('0x70')](_0x149614[_0xa514('0x36')][_0x24e006])['$gte'];var _0x5c2675=JSON[_0xa514('0x70')](_0x149614[_0xa514('0x36')][_0x24e006])[_0xa514('0x71')];_0x187612['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x33380e,_0x5c2675);}else{if(_0x149614[_0xa514('0x36')][_0x24e006]===_0xa514('0x72')){_0x187612[_0xa514('0x3f')]('i.'+_0x24e006+_0xa514('0x73'));}else{_0x187612[_0xa514('0x3f')]('i.'+_0x24e006+_0xa514('0x74'),_0x149614[_0xa514('0x36')][_0x24e006]);}}});}if(_0x149614[_0xa514('0x36')][_0xa514('0x75')]){if(_0x149614[_0xa514('0x36')][_0xa514('0x75')]==0x1){_0x187612['having']('`unreadMessages`\x20=\x200');}else{_0x187612[_0xa514('0x5e')](_0xa514('0x76'));}}if(_0x149614['query'][_0xa514('0x77')]){_0xe2c0dd=_['isArray'](_0x149614['query']['tag'])?_0x149614[_0xa514('0x36')][_0xa514('0x77')]:new Array(_0x149614[_0xa514('0x36')][_0xa514('0x77')]);_0xe2c0dd['forEach'](function(_0x3901c4){_0x24474b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3901c4+',%');});}if(_0x149614[_0xa514('0x36')][_0xa514('0x78')]){var _0x2cf51a=_0x149614['query']['filter'][_0xa514('0x79')]('\x5c','\x5c\x5c')[_0xa514('0x79')](/'/g,'\x27\x27');if(qs[_0xa514('0x7a')](_0x2cf51a)){_0x746799['or'](_0xa514('0x7b'),_0x2cf51a+'%');}else if(qs[_0xa514('0x7c')](_0x2cf51a)){_0x746799['or'](_0xa514('0x7d'),_0x2cf51a+'%');}else{_0x746799['or'](_0xa514('0x7e'),qs[_0xa514('0x61')](_0x2cf51a))['or'](_0xa514('0x7f'),qs['getFullTextValue'](_0x2cf51a));}}}_0x187612[_0xa514('0x3f')](_0x746799);_0x187612[_0xa514('0x80')](_0xa514('0x81'));var _0x5859c6={'type':db[_0xa514('0x82')]['QueryTypes'][_0xa514('0x83')],'raw':!![]};var _0x913327=_0x187612[_0xa514('0x84')]();_0x913327[_0xa514('0x42')](_0xa514('0x81'));_0x913327[_0xa514('0x42')](_0xa514('0x85'),_0xa514('0x5b'));if(_0x3a170b[_0xa514('0x3d')]){_0x3a170b['order'][_0xa514('0x6d')](function(_0x2237e5){var _0x382a7a=_0x2237e5[0x0]==='contactName'?_0x2237e5[0x0]:'i.'+_0x2237e5[0x0];_0x187612[_0xa514('0x3d')](_0x382a7a,_0x2237e5[0x1]===_0xa514('0x86')?![]:!![]);});}if(!_[_0xa514('0x87')](_0xe2c0dd)){_0x187612['having'](_0x24474b);_0x913327[_0xa514('0x3f')]('t.id\x20IN\x20?',_0xe2c0dd);}BPromise[_0xa514('0x88')]()[_0xa514('0x1e')](function(){if(!_0x503628){if(_0x149614['query'][_0xa514('0x89')])return;_0x913327[_0xa514('0x3f')](_0xa514('0x8a'));_0x187612[_0xa514('0x3f')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x149614[_0xa514('0x8b')][_0xa514('0x8c')]!==_0xa514('0x8d'))return;return _0x149614['user'][_0xa514('0x8e')]({'attributes':['id'],'raw':!![]})[_0xa514('0x1e')](function(_0x282293){if(_[_0xa514('0x87')](_0x282293)){_0x913327[_0xa514('0x3f')](_0xa514('0x8f'));_0x187612[_0xa514('0x3f')]('i.MailAccountId\x20IS\x20NULL');}else{_0x913327[_0xa514('0x3f')](_0xa514('0x6e'),_[_0xa514('0x25')](_0x282293,'id'));_0x187612[_0xa514('0x3f')](_0xa514('0x6e'),_[_0xa514('0x25')](_0x282293,'id'));}});})[_0xa514('0x1e')](function(){if(_0x149614['user'][_0xa514('0x8c')]==='agent'&&!_0x503628&&!_0x149614[_0xa514('0x36')][_0xa514('0x89')])return[];return db[_0xa514('0x90')]['query'](_0x913327[_0xa514('0x91')](),_0x5859c6);})['then'](function(_0x421bf4){_0x5cf504[_0xa514('0x1a')]=_0x421bf4[_0xa514('0x3b')];if(_0x5cf504[_0xa514('0x1a')]===0x0)return[];return db[_0xa514('0x90')][_0xa514('0x36')](_0x10237a[_0xa514('0x91')](),_0x5859c6)['then'](function(_0x122255){_0x181d0a=_['keyBy'](_0x122255,'id');_0x5859c6=_[_0xa514('0x92')](_0x5859c6,{'model':db[_0xa514('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x149614[_0xa514('0x36')][_0xa514('0x93')]){_0x3a170b[_0xa514('0x3a')][_0xa514('0x6d')](function(_0x47e46d){_0x187612[_0xa514('0x42')]('i.'+_0x47e46d);});}else{_0x187612[_0xa514('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa514('0x5b'));_0x187612[_0xa514('0x42')]('a.key',_0xa514('0x94'));_0x187612['field'](_0xa514('0x95'),_0xa514('0x96'));_0x187612[_0xa514('0x42')](_0xa514('0x97'),_0xa514('0x98'));_0x187612[_0xa514('0x42')](_0xa514('0x81'));_0x187612[_0xa514('0x42')]('i.createdAt');_0x187612[_0xa514('0x42')](_0xa514('0x99'));_0x187612[_0xa514('0x42')](_0xa514('0x9a'));_0x187612[_0xa514('0x42')](_0xa514('0x9b'));_0x187612['field'](_0xa514('0x9c'));_0x187612[_0xa514('0x42')]('i.lastMsgAt');_0x187612['field'](_0xa514('0x9d'));_0x187612[_0xa514('0x42')](_0xa514('0x9e'));_0x187612[_0xa514('0x42')](_0xa514('0x9f'));_0x187612[_0xa514('0x42')](_0xa514('0xa0'));_0x187612[_0xa514('0x42')]('i.thirdDisposition');_0x187612['field'](_0xa514('0xa1'));_0x187612[_0xa514('0x42')]('i.to');_0x187612[_0xa514('0x42')](_0xa514('0xa2'));_0x187612[_0xa514('0x42')](_0xa514('0xa3'));_0x187612[_0xa514('0x42')]('i.UserId');_0x187612[_0xa514('0x42')](_0xa514('0xa4'),_0xa514('0xa5'));_0x187612[_0xa514('0x42')](_0xa514('0xa6'),_0xa514('0xa7'));_0x187612[_0xa514('0x42')]('c.email',_0xa514('0xa8'));_0x187612[_0xa514('0x42')]('c.phone',_0xa514('0xa9'));_0x187612[_0xa514('0x42')](_0xa514('0xaa'),_0xa514('0xab'));_0x187612[_0xa514('0x42')](_0xa514('0xac'),_0xa514('0xad'));_0x187612['field']('o.fullname','Owner.fullname');_0x187612[_0xa514('0x42')]('o.internal','Owner.internal');_0x187612[_0xa514('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa514('0x27'));}if(_0x3a170b['limit'])_0x187612[_0xa514('0x1b')](_0x3a170b['limit']);if(_0x3a170b[_0xa514('0x18')])_0x187612[_0xa514('0x18')](_0x3a170b[_0xa514('0x18')]);return db[_0xa514('0x90')][_0xa514('0x36')](_0x187612[_0xa514('0x91')](),_0x5859c6);})[_0xa514('0x1e')](function(_0x3f983d){if(_0x3f983d[_0xa514('0x3b')]>0x0)_0x1fb4a4[_0xa514('0x3f')](_0xa514('0xae'),_[_0xa514('0x25')](_0x3f983d,'id'));return db[_0xa514('0x90')][_0xa514('0x36')](_0x1fb4a4[_0xa514('0x91')](),_0x5859c6)[_0xa514('0x1e')](function(_0x5c934e){var _0x2cff86=_['groupBy'](_0x5c934e,'MailInteractionId');var _0x380a4d=[];return db['Setting']['findOne']({'attributes':[_0xa514('0xaf')],'raw':!![]})[_0xa514('0x1e')](function(_0x20f5c2){var _0x3986ed=_0x20f5c2[_0xa514('0xaf')];_0x3f983d[_0xa514('0x6d')](function(_0x3401f5){_0x380a4d[_0xa514('0x29')](updateMailInteraction(_0x3401f5,_0x181d0a,_0x2cff86,_0x3986ed));});return BPromise[_0xa514('0xb0')](_0x380a4d);});});});})[_0xa514('0x1e')](function(_0x2bdd6c){_0x5cf504[_0xa514('0xb1')]=_0x2bdd6c;return _0x5cf504;})[_0xa514('0x1e')](respondWithFilteredResult(_0x4971c2,_0x3a170b))[_0xa514('0x30')](handleError(_0x4971c2,null));};exports[_0xa514('0xb2')]=function(_0x1e3d92,_0x439a32){var _0x55d62b={'raw':![],'where':{'id':_0x1e3d92[_0xa514('0xb3')]['id']}},_0x2fc25d={};_0x2fc25d[_0xa514('0x35')]=_[_0xa514('0x37')](db[_0xa514('0x31')]['rawAttributes']);_0x2fc25d[_0xa514('0x36')]=_[_0xa514('0x37')](_0x1e3d92[_0xa514('0x36')]);_0x2fc25d[_0xa514('0x38')]=_[_0xa514('0x39')](_0x2fc25d[_0xa514('0x35')],_0x2fc25d[_0xa514('0x36')]);_0x55d62b['attributes']=_[_0xa514('0x39')](_0x2fc25d['model'],qs['fields'](_0x1e3d92[_0xa514('0x36')][_0xa514('0x93')]));_0x55d62b[_0xa514('0x3a')]=_0x55d62b[_0xa514('0x3a')]['length']?_0x55d62b[_0xa514('0x3a')]:_0x2fc25d[_0xa514('0x35')];if(_0x1e3d92[_0xa514('0x36')][_0xa514('0xb4')]){_0x55d62b[_0xa514('0xb5')]=[{'all':!![]}];}_0x55d62b=_[_0xa514('0x92')]({},_0x55d62b,_0x1e3d92[_0xa514('0xb6')]);return db[_0xa514('0x31')][_0xa514('0x5a')](_0x55d62b)['then'](handleEntityNotFound(_0x439a32,null))[_0xa514('0x1e')](respondWithResult(_0x439a32,null))[_0xa514('0x30')](handleError(_0x439a32,null));};exports['create']=function(_0x5c99c5,_0x6291ec){return db[_0xa514('0x31')]['create'](_0x5c99c5[_0xa514('0xb7')],{})[_0xa514('0x1e')](respondWithResult(_0x6291ec,0xc9))[_0xa514('0x30')](handleError(_0x6291ec,null));};exports[_0xa514('0x1d')]=function(_0x57581b,_0xf4fcc3){if(_0x57581b[_0xa514('0xb7')]['id']){delete _0x57581b['body']['id'];}return db[_0xa514('0x31')][_0xa514('0x5a')]({'where':{'id':_0x57581b[_0xa514('0xb3')]['id']}})[_0xa514('0x1e')](handleEntityNotFound(_0xf4fcc3,null))[_0xa514('0x1e')](saveUpdates(_0x57581b['body'],null))['then'](respondWithResult(_0xf4fcc3,null))['catch'](handleError(_0xf4fcc3,null));};exports[_0xa514('0xb8')]=function(_0x37cc6c,_0xa078ab){return db[_0xa514('0x31')][_0xa514('0x5a')]({'where':{'id':_0x37cc6c[_0xa514('0xb3')]['id']}})[_0xa514('0x1e')](handleEntityNotFound(_0xa078ab,null))[_0xa514('0x1e')](removeEntity(_0xa078ab,null))['catch'](handleError(_0xa078ab,null));};exports['describe']=function(_0x55579f,_0x408f8c){return db['MailInteraction'][_0xa514('0xb9')]()[_0xa514('0x1e')](respondWithResult(_0x408f8c,null))[_0xa514('0x30')](handleError(_0x408f8c,null));};exports['addMessage']=function(_0xe86a9e,_0xa356e1){return db['MailMessage'][_0xa514('0x5a')]({'where':{'id':_0xe86a9e[_0xa514('0xb3')]['id']}})[_0xa514('0x1e')](handleEntityNotFound(_0xa356e1,null))[_0xa514('0x1e')](function(_0x2670ad){if(_0x2670ad){return _0x2670ad[_0xa514('0xba')](_0xe86a9e[_0xa514('0xb7')][_0xa514('0xbb')],_['omit'](_0xe86a9e['body'],[_0xa514('0xbb'),'id'])||{});}})[_0xa514('0x1e')](respondWithResult(_0xa356e1,null))[_0xa514('0x30')](handleError(_0xa356e1,null));};exports[_0xa514('0xbc')]=function(_0x3d992f,_0x2346ca){var _0x1a5dee={'raw':![],'where':{}};var _0x12bf64={};var _0x24c500={'count':0x0,'rows':[]};return db['MailInteraction'][_0xa514('0x2b')]({'where':{'id':_0x3d992f['params']['id']}})[_0xa514('0x1e')](handleEntityNotFound(_0x2346ca,null))[_0xa514('0x1e')](function(_0x575c65){if(_0x575c65){_0x12bf64[_0xa514('0x35')]=_[_0xa514('0x37')](db[_0xa514('0x2a')][_0xa514('0xbd')]);_0x12bf64['query']=_[_0xa514('0x37')](_0x3d992f[_0xa514('0x36')]);_0x12bf64[_0xa514('0x38')]=_[_0xa514('0x39')](_0x12bf64['model'],_0x12bf64['query']);_0x1a5dee['attributes']=_['intersection'](_0x12bf64[_0xa514('0x35')],qs[_0xa514('0x93')](_0x3d992f[_0xa514('0x36')]['fields']));_0x1a5dee[_0xa514('0x3a')]=_0x1a5dee[_0xa514('0x3a')]['length']?_0x1a5dee[_0xa514('0x3a')]:_0x12bf64[_0xa514('0x35')];if(!_0x3d992f[_0xa514('0x36')]['hasOwnProperty']('nolimit')){_0x1a5dee['limit']=qs[_0xa514('0x1b')](_0x3d992f[_0xa514('0x36')][_0xa514('0x1b')]);_0x1a5dee[_0xa514('0x18')]=qs[_0xa514('0x18')](_0x3d992f[_0xa514('0x36')][_0xa514('0x18')]);}_0x1a5dee['order']=qs[_0xa514('0x3e')](_0x3d992f[_0xa514('0x36')][_0xa514('0x3e')]);_0x1a5dee['where']=qs[_0xa514('0x38')](_[_0xa514('0x40')](_0x3d992f[_0xa514('0x36')],_0x12bf64[_0xa514('0x38')]));_0x1a5dee['where'][_0xa514('0xbe')]=_0x575c65['id'];if(_0x3d992f[_0xa514('0x36')][_0xa514('0x78')]){_0x1a5dee[_0xa514('0x3f')]=_[_0xa514('0x92')](_0x1a5dee[_0xa514('0x3f')],{'$or':_[_0xa514('0x25')](_0x1a5dee[_0xa514('0x3a')],function(_0x30a2a3){var _0x4cfb0b={};_0x4cfb0b[_0x30a2a3]={'$like':'%'+_0x3d992f[_0xa514('0x36')]['filter']+'%'};return _0x4cfb0b;})});}if(_0x3d992f['query'][_0xa514('0xbf')]){var _0x3eeec2=_0x3d992f[_0xa514('0x36')][_0xa514('0xbf')][_0xa514('0x28')](',');var _0x23ca23={};_0x23ca23[_0x3eeec2[0x0]]={'$gte':moment(_0x3eeec2[0x1])[_0xa514('0xc0')](_0xa514('0xc1'))};_0x1a5dee[_0xa514('0x3f')]=_[_0xa514('0x92')](_0x1a5dee[_0xa514('0x3f')],_0x23ca23);}_0x1a5dee=_[_0xa514('0x92')]({},_0x1a5dee,_0x3d992f[_0xa514('0xb6')]);return db[_0xa514('0x2a')][_0xa514('0x1a')]({'where':_0x1a5dee[_0xa514('0x3f')]})[_0xa514('0x1e')](function(_0x5becfa){_0x24c500[_0xa514('0x1a')]=_0x5becfa;if(_0x3d992f[_0xa514('0x36')]['includeAll']){_0x1a5dee['include']=[{'all':!![]}];}return db[_0xa514('0x2a')]['findAll'](_0x1a5dee);})[_0xa514('0x1e')](function(_0x64d5af){if(_0x3d992f[_0xa514('0x36')][_0xa514('0xc2')]==='true'){for(var _0x3925aa=0x0;_0x3925aa<_0x64d5af['length'];_0x3925aa++){_0x64d5af[_0x3925aa][_0xa514('0xb7')]=juice(_0x64d5af[_0x3925aa]['body']);}}_0x24c500[_0xa514('0xb1')]=_0x64d5af;return _0x24c500;});}})[_0xa514('0x1e')](respondWithFilteredResult(_0x2346ca,_0x1a5dee))[_0xa514('0x30')](handleError(_0x2346ca,null));};exports[_0xa514('0xc3')]=function(_0xb3bdd4,_0x56ee0d){return db[_0xa514('0x31')][_0xa514('0x5a')]({'where':{'id':_0xb3bdd4[_0xa514('0xb3')]['id']}})[_0xa514('0x1e')](handleEntityNotFound(_0x56ee0d,null))['then'](function(_0x18ce97){if(_0x18ce97){return _0x18ce97[_0xa514('0xc4')](_0xb3bdd4['body'][_0xa514('0xbb')],_[_0xa514('0xc5')](_0xb3bdd4[_0xa514('0xb7')],[_0xa514('0xbb'),'id'])||{})[_0xa514('0xc6')](function(){return db[_0xa514('0x65')][_0xa514('0xc7')]({'attributes':['id',_0xa514('0x22'),'color'],'where':{'id':_0xb3bdd4[_0xa514('0xb7')][_0xa514('0xbb')]}});})[_0xa514('0x1e')](function(_0x3760d6){socket[_0xa514('0xc8')](_0xa514('0xc9'),{'id':Number(_0xb3bdd4['params']['id']),'tags':_0x3760d6||[]});return{'id':Number(_0xb3bdd4[_0xa514('0xb3')]['id']),'tags':_0x3760d6||[]};});}})['then'](respondWithResult(_0x56ee0d,null))[_0xa514('0x30')](handleError(_0x56ee0d,null));};exports[_0xa514('0xca')]=function(_0x38c648,_0x1ce6a4){return db[_0xa514('0x31')][_0xa514('0x5a')]({'where':{'id':_0x38c648[_0xa514('0xb3')]['id']}})[_0xa514('0x1e')](handleEntityNotFound(_0x1ce6a4,null))['then'](function(_0x4092e1){if(_0x4092e1){return _0x4092e1[_0xa514('0xca')](_0x38c648['query']['ids']);}})[_0xa514('0x1e')](respondWithStatusCode(_0x1ce6a4,null))[_0xa514('0x30')](handleError(_0x1ce6a4,null));};exports[_0xa514('0xcb')]=function(_0x105db6,_0x842b41){var _0x1c095d=moment()[_0xa514('0xcc')]()['toString']();var _0x395e63=path[_0xa514('0xcd')](config['root'],'server',_0xa514('0xce'),'tmp');var _0x24e553=path[_0xa514('0xcd')](config[_0xa514('0xcf')],_0xa514('0xd0'),'files',_0xa514('0xd1'));var _0x333407=path[_0xa514('0xcd')](_0x395e63,_0x1c095d);var _0x592935=util[_0xa514('0xc0')](_0xa514('0xd2'),_0x105db6[_0xa514('0xb3')]['id'],_0x1c095d);var _0x796c93=path[_0xa514('0xcd')](_0x395e63,_0x592935);var _0x41540d=[];if(_0x105db6[_0xa514('0x36')][_0xa514('0xd1')]){_0x41540d[_0xa514('0x29')]({'model':db[_0xa514('0xd3')],'as':'Attachments','raw':!![]});}var _0x120f18=[{'model':db[_0xa514('0x2a')],'as':_0xa514('0xd4'),'attributes':['id',_0xa514('0xb7'),_0xa514('0x44'),'to','cc',_0xa514('0xd5'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0xa514('0x3e')]('id'),'include':_0x41540d}];return db[_0xa514('0x31')][_0xa514('0x5a')]({'where':{'id':_0x105db6[_0xa514('0xb3')]['id']},'include':_0x120f18})[_0xa514('0x1e')](handleEntityNotFound(_0x842b41,null))[_0xa514('0x1e')](function(_0x5c918c){if(_0x5c918c&&_0x5c918c[_0xa514('0xd4')]){var _0x29f8b5=_0x5c918c[_0xa514('0xd6')]({'plain':!![]});fs[_0xa514('0xd7')](_0x333407);return BPromise[_0xa514('0xd8')](_0x29f8b5[_0xa514('0xd4')],function(_0x4ece2b,_0x2032a1){var _0x145a11={'from':_0x4ece2b[_0xa514('0x44')],'to':_0x4ece2b['to'],'subject':_0x4ece2b[_0xa514('0xd9')],'html':htmlEntities[_0xa514('0xda')](_0x4ece2b[_0xa514('0xb7')]),'headers':{'Date':moment(_0x4ece2b['createdAt'])['format'](_0xa514('0xdb'))},'attachments':[]};if(_0x4ece2b['cc']){_0x145a11[_0xa514('0xdc')]['Cc']=_0x4ece2b['cc'];}if(_0x4ece2b['bcc']){_0x145a11[_0xa514('0xdc')][_0xa514('0xdd')]=_0x4ece2b[_0xa514('0xd5')];}return new BPromise(function(_0x3c1e01,_0x3744a6){if(_0x4ece2b['Attachments']){for(var _0x5211c0=0x0;_0x5211c0<_0x4ece2b[_0xa514('0xde')][_0xa514('0x3b')];_0x5211c0++){var _0x15cba8=_0x4ece2b[_0xa514('0xde')][_0x5211c0];var _0x407a0c=path['join'](_0x24e553,_0x15cba8[_0xa514('0xdf')]);if(fs[_0xa514('0xe0')](_0x407a0c)){_0x145a11[_0xa514('0xd1')][_0xa514('0x29')]({'name':_0x15cba8[_0xa514('0x22')],'contentType':_0x15cba8['type'],'data':fs[_0xa514('0xe1')](_0x407a0c)});}}}emlformat[_0xa514('0xe2')](_0x145a11,function(_0x4a00ad,_0x3aab4f){if(_0x4a00ad)return _0x3744a6(_0x4a00ad);fs[_0xa514('0xe3')](path[_0xa514('0xcd')](_0x333407,util[_0xa514('0xc0')]('message%d.eml',_0x2032a1)),_0x3aab4f);return _0x3c1e01(_0x3aab4f);});});})[_0xa514('0x1e')](function(){return new BPromise(function(_0xd815d4,_0x22a624){zipdir(_0x333407,{'saveTo':_0x796c93},function(_0x11071f,_0x19731c){if(_0x11071f)return _0x22a624(_0x11071f);return _0xd815d4(_0x19731c);});})['then'](function(){return new BPromise(function(_0x5a9f58,_0xce53b1){rimraf(_0x333407,function(_0x3425ac){if(_0x3425ac)_0xce53b1(_0x3425ac);return _0x5a9f58();});});})[_0xa514('0x1e')](function(){return _0x842b41['download'](_0x796c93,_0x592935,function(_0x421044){if(!_0x421044)fs[_0xa514('0xe4')](_0x796c93);});});});}else{return _0x842b41[_0xa514('0x15')](0xc8);}})[_0xa514('0x30')](handleError(_0x842b41,null));}; \ No newline at end of file +var _0x8840=['mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','length','conditions','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','UserId','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','a.key','Account.key','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.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','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','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','rawAttributes','includeAll','options','create','body','find','addMessage','ids','omit','merge','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','spread','removeTags','download','root','server','files','tmp','join','attachments','push','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','decode','headers','basename','existsSync','readFileSync','build','eml-format','rimraf','zip-dir','moment','bluebird','util','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','name','send','map','Tags','split','forEach','TagIds','MailMessage','findOne','out','-id','then','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','field','color','from','tools_tags','select','u.id','user_has_mail_interactions','left_join','users','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId'];(function(_0x145e61,_0x2d39ad){var _0x3a10f6=function(_0x3ae3b8){while(--_0x3ae3b8){_0x145e61['push'](_0x145e61['shift']());}};_0x3a10f6(++_0x2d39ad);}(_0x8840,0x16b));var _0x0884=function(_0x4e0560,_0x2841c4){_0x4e0560=_0x4e0560-0x0;var _0x1b34df=_0x8840[_0x4e0560];return _0x1b34df;};'use strict';var emlformat=require(_0x0884('0x0'));var rimraf=require(_0x0884('0x1'));var zipdir=require(_0x0884('0x2'));var moment=require(_0x0884('0x3'));var BPromise=require(_0x0884('0x4'));var util=require(_0x0884('0x5'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0884('0x6'));var juice=require('juice');var Redis=require(_0x0884('0x7'));var qs=require(_0x0884('0x8'));var as=require(_0x0884('0x9'));var logger=require('../../config/logger')(_0x0884('0xa'));var config=require('../../config/environment');var db=require(_0x0884('0xb'))['db'];var htmlEntities=require(_0x0884('0xc'));config[_0x0884('0xd')]=_[_0x0884('0xe')](config[_0x0884('0xd')],{'host':_0x0884('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0884('0xd')]));require(_0x0884('0x10'))[_0x0884('0x11')](socket);function respondWithStatusCode(_0x255c57,_0x508c66){_0x508c66=_0x508c66||0xcc;return function(_0x232c48){if(_0x232c48){return _0x255c57[_0x0884('0x12')](_0x508c66);}return _0x255c57['status'](_0x508c66)[_0x0884('0x13')]();};}function respondWithResult(_0x421eb7,_0x293e68){_0x293e68=_0x293e68||0xc8;return function(_0x5ad12b){if(_0x5ad12b){return _0x421eb7[_0x0884('0x14')](_0x293e68)[_0x0884('0x15')](_0x5ad12b);}};}function respondWithFilteredResult(_0x343527,_0x2308db){return function(_0x248ba6){if(_0x248ba6){var _0x502772=typeof _0x2308db['offset']===_0x0884('0x16')&&typeof _0x2308db[_0x0884('0x17')]==='undefined';var _0x1e4556=_0x248ba6[_0x0884('0x18')];var _0x5e7dcb=_0x502772?0x0:_0x2308db['offset'];var _0x36333c=_0x502772?_0x248ba6[_0x0884('0x18')]:_0x2308db[_0x0884('0x19')]+_0x2308db[_0x0884('0x17')];var _0x1a1726;if(_0x36333c>=_0x1e4556){_0x36333c=_0x1e4556;_0x1a1726=0xc8;}else{_0x1a1726=0xce;}_0x343527[_0x0884('0x14')](_0x1a1726);return _0x343527[_0x0884('0x1a')](_0x0884('0x1b'),_0x5e7dcb+'-'+_0x36333c+'/'+_0x1e4556)['json'](_0x248ba6);}return null;};}function saveUpdates(_0x63b790){return function(_0x178678){if(_0x178678){return _0x178678['update'](_0x63b790)['then'](function(_0x223ea6){return _0x223ea6;});}return null;};}function removeEntity(_0x59528f){return function(_0x406f51){if(_0x406f51){return _0x406f51[_0x0884('0x1c')]()['then'](function(){_0x59528f['status'](0xcc)[_0x0884('0x13')]();});}};}function handleEntityNotFound(_0x1a50b4){return function(_0x5bfe10){if(!_0x5bfe10){_0x1a50b4['sendStatus'](0x194);}return _0x5bfe10;};}function handleError(_0x425c02,_0x2984c5){_0x2984c5=_0x2984c5||0x1f4;return function(_0x56cf3b){logger['error'](_0x56cf3b['stack']);if(_0x56cf3b[_0x0884('0x1d')]){delete _0x56cf3b[_0x0884('0x1d')];}_0x425c02[_0x0884('0x14')](_0x2984c5)[_0x0884('0x1e')](_0x56cf3b);};}function getInteractionUsers(_0x50a991,_0x24bdd9){return new BPromise(function(_0x7989fa,_0x4b7975){try{if(_0x24bdd9[_0x50a991['id']]){_0x50a991['Users']=_[_0x0884('0x1f')](_0x24bdd9[_0x50a991['id']],function(_0x465ecb){return{'id':_0x465ecb['id'],'fullname':_0x465ecb['fullname']};});}}catch(_0x3fe688){_0x4b7975(_0x3fe688);}_0x7989fa(_0x50a991);});}function getInteractionTags(_0x319257,_0x13afd5){return new BPromise(function(_0xf9dfe9,_0x4e7535){try{if(_0x319257['TagIds']){_0x319257[_0x0884('0x20')]=[];_0x319257['TagIds'][_0x0884('0x21')](',')[_0x0884('0x22')](function(_0x4abfb8){_0x319257[_0x0884('0x20')]['push'](_0x13afd5[_0x4abfb8]);});}delete _0x319257[_0x0884('0x23')];}catch(_0x20ef61){_0x4e7535(_0x20ef61);}_0xf9dfe9(_0x319257);});}function getLastMessageText(_0x2b9ce1){return new BPromise(function(_0x24e447,_0x3349c5){return db[_0x0884('0x24')][_0x0884('0x25')]({'where':{'$and':[{'MailInteractionId':_0x2b9ce1['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0884('0x26')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0884('0x27'),'raw':!![]})[_0x0884('0x28')](function(_0x47bcf1){if(_0x47bcf1&&_0x47bcf1[_0x0884('0x29')]){_0x2b9ce1[_0x0884('0x2a')]=_[_0x0884('0x2b')](_0x47bcf1[_0x0884('0x29')]);}_0x24e447(_0x2b9ce1);})['catch'](function(_0x507259){_0x3349c5(_0x507259);});});}function updateMailInteraction(_0x453774,_0x2f5ad4,_0x34e75f,_0x193b1f){return new BPromise(function(_0x3b977c,_0x362156){return getInteractionUsers(_0x453774,_0x34e75f)[_0x0884('0x28')](function(_0x4566b4){return getInteractionTags(_0x4566b4,_0x2f5ad4);})[_0x0884('0x28')](function(_0x181100){if(_0x193b1f){_0x3b977c(getLastMessageText(_0x181100));}else{_0x3b977c(_0x181100);}})[_0x0884('0x2c')](function(_0x3a5ff9){_0x362156(_0x3a5ff9);});});}exports[_0x0884('0x2d')]=function(_0x4a36d5,_0xd0788){var _0x6d79d7={},_0x491c16={},_0x56afad={'count':0x0,'rows':[]};var _0x3938a4=_[_0x0884('0x1f')](db[_0x0884('0x2e')]['rawAttributes'],function(_0x3c5c62){return{'name':_0x3c5c62['fieldName'],'type':_0x3c5c62[_0x0884('0x2f')][_0x0884('0x30')]};});_0x491c16[_0x0884('0x31')]=_[_0x0884('0x1f')](_0x3938a4,_0x0884('0x1d'));_0x491c16[_0x0884('0x32')]=_[_0x0884('0x33')](_0x4a36d5['query']);_0x491c16[_0x0884('0x34')]=_[_0x0884('0x35')](_0x491c16[_0x0884('0x31')],_0x491c16[_0x0884('0x32')]);_0x6d79d7['attributes']=_[_0x0884('0x35')](_0x491c16[_0x0884('0x31')],qs['fields'](_0x4a36d5[_0x0884('0x32')][_0x0884('0x36')]));_0x6d79d7[_0x0884('0x37')]=_0x6d79d7[_0x0884('0x37')]['length']?_0x6d79d7[_0x0884('0x37')]:_0x491c16[_0x0884('0x31')];if(!_0x4a36d5[_0x0884('0x32')][_0x0884('0x38')]('nolimit')){_0x6d79d7['limit']=qs['limit'](_0x4a36d5[_0x0884('0x32')]['limit']);_0x6d79d7[_0x0884('0x19')]=qs[_0x0884('0x19')](_0x4a36d5[_0x0884('0x32')][_0x0884('0x19')]);}_0x6d79d7['order']=qs[_0x0884('0x39')](_0x4a36d5[_0x0884('0x32')]['sort']);_0x6d79d7[_0x0884('0x3a')]=qs[_0x0884('0x34')](_[_0x0884('0x3b')](_0x4a36d5[_0x0884('0x32')],_0x491c16[_0x0884('0x34')]),_0x3938a4);var _0xa136fb=[];var _0x3815ac=squel['select']()['field']('id')[_0x0884('0x3c')](_0x0884('0x1d'))[_0x0884('0x3c')](_0x0884('0x3d'))[_0x0884('0x3e')](_0x0884('0x3f'));var _0x411a96=squel[_0x0884('0x40')]()[_0x0884('0x3c')](_0x0884('0x41'))[_0x0884('0x3c')]('u.fullname')[_0x0884('0x3c')]('ui.MailInteractionId')[_0x0884('0x3e')](_0x0884('0x42'),'ui')[_0x0884('0x43')](_0x0884('0x44'),'u','u.id\x20=\x20ui.UserId');var _0x40bee4=squel[_0x0884('0x40')]()[_0x0884('0x3e')](_0x0884('0x45'),'i')[_0x0884('0x43')](_0x0884('0x46'),'c',_0x0884('0x47'))[_0x0884('0x43')](_0x0884('0x44'),'o',_0x0884('0x48'))[_0x0884('0x43')](_0x0884('0x49'),'a',_0x0884('0x4a'))[_0x0884('0x43')](_0x0884('0x4b'),'me',_0x0884('0x4c'))[_0x0884('0x43')](_0x0884('0x4d'),'it',_0x0884('0x4e'))[_0x0884('0x43')](_0x0884('0x3f'),'t',_0x0884('0x4f'));var _0x8631a2=squel[_0x0884('0x50')]();var _0x154d0d=[];var _0x27183b=squel[_0x0884('0x50')]();var _0x2b7b98;if(_0x4a36d5[_0x0884('0x32')][_0x0884('0x51')]){_0x2b7b98=as['parseSearch'](_0x4a36d5[_0x0884('0x32')][_0x0884('0x51')]);var _0x5524d6=_0x2b7b98['sqlOperator'];for(var _0x34ba7a=0x0;_0x34ba7a<_0x2b7b98['conditions'][_0x0884('0x52')];_0x34ba7a++){var _0x51e24a=_0x2b7b98[_0x0884('0x53')][_0x34ba7a];var _0x3daf26='i';var _0x44e084=_['find'](_0x3938a4,[_0x0884('0x1d'),_0x51e24a['field']]);if(!_0x44e084){switch(_0x51e24a[_0x0884('0x3c')]){case _0x0884('0x54'):if(_0x51e24a['value']==0x1){_0x40bee4['having']('`'+_0x51e24a[_0x0884('0x3c')]+_0x0884('0x55'));}else{_0x40bee4[_0x0884('0x56')]('`'+_0x51e24a['field']+_0x0884('0x57'));}break;case _0x0884('0x58'):if(_0x51e24a['operator']==='$substring'){if(_0x51e24a[_0x0884('0x59')][_0x0884('0x21')]('\x20')['length']>0x1){_0x8631a2[_0x5524d6](_0x0884('0x5a'),qs['getFullTextValue'](_0x51e24a[_0x0884('0x59')]),null);}else{var _0x2a1396='%'+_0x51e24a[_0x0884('0x59')]+'%';_0x8631a2[_0x5524d6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2a1396,_0x2a1396,_0x2a1396);}}else{_0x44e084=_['find'](_0x3938a4,['name',_0x0884('0x5b')]);_0x51e24a['field']=_0x0884('0x5b');_0xb03043=as[_0x0884('0x5c')](_0x3daf26,_0x44e084[_0x0884('0x2f')],_0x51e24a);_0x8631a2[_0x5524d6](_0xb03043[_0x0884('0x5d')],_0xb03043[_0x0884('0x59')][_0x0884('0x5e')],_0xb03043['value'][_0x0884('0x13')]);}break;case _0x0884('0x5f'):var _0x1b22c0=_0x51e24a[_0x0884('0x59')][_0x0884('0x21')](',')[_0x0884('0x1f')](function(_0x197bcc){return Number(_0x197bcc);});_0x1b22c0[_0x0884('0x22')](function(_0x1d2c65){_0x27183b['or'](_0x0884('0x60'),'%,'+_0x1d2c65+',%');});_0x154d0d=_[_0x0884('0x61')](_0x154d0d,_0x1b22c0);break;case _0x0884('0x62'):if(_0x51e24a[_0x0884('0x63')]===_0x0884('0x64')){_0x8631a2[_0x5524d6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x51e24a[_0x0884('0x59')]+'%',null);}else{_0x44e084=_['find'](_0x3938a4,[_0x0884('0x1d'),_0x0884('0x65')]);_0x51e24a[_0x0884('0x3c')]=_0x0884('0x65');_0xb03043=as[_0x0884('0x5c')](_0x3daf26,_0x44e084[_0x0884('0x2f')],_0x51e24a);_0x8631a2[_0x5524d6](_0xb03043[_0x0884('0x5d')],_0xb03043['value']['start'],_0xb03043[_0x0884('0x59')][_0x0884('0x13')]);}break;case _0x0884('0x29'):_0xb03043=as[_0x0884('0x5c')]('me',null,_0x51e24a);_0x8631a2[_0x5524d6](_0xb03043[_0x0884('0x5d')],_0xb03043['value'][_0x0884('0x5e')],_0xb03043[_0x0884('0x59')]['end']);break;}}else{var _0xb03043=as[_0x0884('0x5c')](_0x3daf26,_0x44e084[_0x0884('0x2f')],_0x51e24a);_0x8631a2[_0x5524d6](_0xb03043[_0x0884('0x5d')],_0xb03043[_0x0884('0x59')][_0x0884('0x5e')],_0xb03043['value'][_0x0884('0x13')]);}}}else{var _0x549582=_(_0x4a36d5['query'])[_0x0884('0x33')]()[_0x0884('0x1f')](function(_0x381629){return _[_0x0884('0x66')](_0x3938a4,[_0x0884('0x1d'),_0x381629])?_0x381629:undefined;})[_0x0884('0x67')]()['value']();if(!_[_0x0884('0x68')](_0x549582)){_0x549582['forEach'](function(_0x355e47){if(_0x355e47===_0x0884('0x69')){_0x40bee4[_0x0884('0x3a')](_0x0884('0x6a'),[][_0x0884('0x6b')](_0x4a36d5[_0x0884('0x32')][_0x355e47]));}else if(_0x355e47===_0x0884('0x6c')){var _0x4356b2=JSON[_0x0884('0x6d')](_0x4a36d5['query'][_0x355e47])['$gte'];var _0x423460=JSON[_0x0884('0x6d')](_0x4a36d5['query'][_0x355e47])[_0x0884('0x6e')];_0x40bee4[_0x0884('0x3a')](_0x0884('0x6f'),_0x4356b2,_0x423460);}else{if(_0x4a36d5[_0x0884('0x32')][_0x355e47]===_0x0884('0x70')){_0x40bee4[_0x0884('0x3a')]('i.'+_0x355e47+_0x0884('0x71'));}else{_0x40bee4[_0x0884('0x3a')]('i.'+_0x355e47+_0x0884('0x72'),_0x4a36d5[_0x0884('0x32')][_0x355e47]);}}});}if(_0x4a36d5[_0x0884('0x32')][_0x0884('0x73')]){if(_0x4a36d5['query']['read']==0x1){_0x40bee4[_0x0884('0x56')](_0x0884('0x74'));}else{_0x40bee4['having']('`unreadMessages`\x20>\x200');}}if(_0x4a36d5[_0x0884('0x32')][_0x0884('0x75')]){_0x154d0d=_['isArray'](_0x4a36d5[_0x0884('0x32')][_0x0884('0x75')])?_0x4a36d5[_0x0884('0x32')]['tag']:new Array(_0x4a36d5[_0x0884('0x32')][_0x0884('0x75')]);_0x154d0d[_0x0884('0x22')](function(_0x3e8b1c){_0x27183b['or'](_0x0884('0x60'),'%,'+_0x3e8b1c+',%');});}if(_0x4a36d5[_0x0884('0x32')][_0x0884('0x76')]){var _0x23744f=_0x4a36d5[_0x0884('0x32')][_0x0884('0x76')][_0x0884('0x77')]('\x5c','\x5c\x5c')[_0x0884('0x77')](/'/g,'\x27\x27');if(qs[_0x0884('0x78')](_0x23744f)){_0x8631a2['or'](_0x0884('0x79'),_0x23744f+'%');}else if(qs[_0x0884('0x7a')](_0x23744f)){_0x8631a2['or'](_0x0884('0x7b'),_0x23744f+'%');}else{_0x8631a2['or'](_0x0884('0x7c'),qs[_0x0884('0x7d')](_0x23744f))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0884('0x7d')](_0x23744f));}}}_0x40bee4['where'](_0x8631a2);_0x40bee4['group']('i.id');var _0x1d8395={'type':db[_0x0884('0x7e')]['QueryTypes'][_0x0884('0x7f')],'raw':!![]};var _0xb01930=_0x40bee4[_0x0884('0x80')]();_0xb01930['field'](_0x0884('0x81'));_0xb01930[_0x0884('0x3c')](_0x0884('0x82'),'unreadMessages');if(_0x6d79d7[_0x0884('0x83')]){_0x6d79d7[_0x0884('0x83')][_0x0884('0x22')](function(_0x18a3b8){var _0x9ea087=_0x18a3b8[0x0]==='contactName'?_0x18a3b8[0x0]:'i.'+_0x18a3b8[0x0];_0x40bee4[_0x0884('0x83')](_0x9ea087,_0x18a3b8[0x1]===_0x0884('0x84')?![]:!![]);});}if(!_['isEmpty'](_0x154d0d)){_0x40bee4[_0x0884('0x56')](_0x27183b);_0xb01930[_0x0884('0x3a')](_0x0884('0x85'),_0x154d0d);}BPromise[_0x0884('0x86')]()['then'](function(){if(!_0x2b7b98){if(_0x4a36d5[_0x0884('0x32')][_0x0884('0x69')])return;_0xb01930[_0x0884('0x3a')](_0x0884('0x87'));_0x40bee4[_0x0884('0x3a')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4a36d5['user']['role']!==_0x0884('0x88'))return;return _0x4a36d5[_0x0884('0x89')][_0x0884('0x8a')]({'attributes':['id'],'raw':!![]})[_0x0884('0x28')](function(_0x5f58b3){if(_[_0x0884('0x68')](_0x5f58b3)){_0xb01930[_0x0884('0x3a')](_0x0884('0x8b'));_0x40bee4[_0x0884('0x3a')](_0x0884('0x8b'));}else{_0xb01930['where'](_0x0884('0x6a'),_[_0x0884('0x1f')](_0x5f58b3,'id'));_0x40bee4[_0x0884('0x3a')](_0x0884('0x6a'),_[_0x0884('0x1f')](_0x5f58b3,'id'));}});})['then'](function(){if(_0x4a36d5[_0x0884('0x89')]['role']===_0x0884('0x88')&&!_0x2b7b98&&!_0x4a36d5[_0x0884('0x32')][_0x0884('0x69')])return[];return db['sequelize'][_0x0884('0x32')](_0xb01930[_0x0884('0x8c')](),_0x1d8395);})[_0x0884('0x28')](function(_0x196e74){_0x56afad[_0x0884('0x18')]=_0x196e74[_0x0884('0x52')];if(_0x56afad[_0x0884('0x18')]===0x0)return[];return db[_0x0884('0x8d')]['query'](_0x3815ac['toString'](),_0x1d8395)[_0x0884('0x28')](function(_0x27c4ef){_0xa136fb=_['keyBy'](_0x27c4ef,'id');_0x1d8395=_['merge'](_0x1d8395,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a36d5[_0x0884('0x32')][_0x0884('0x36')]){_0x6d79d7[_0x0884('0x37')][_0x0884('0x22')](function(_0x58d543){_0x40bee4[_0x0884('0x3c')]('i.'+_0x58d543);});}else{_0x40bee4['field'](_0x0884('0x82'),_0x0884('0x54'));_0x40bee4['field'](_0x0884('0x8e'),_0x0884('0x8f'));_0x40bee4[_0x0884('0x3c')]('a.mandatoryDisposition',_0x0884('0x90'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x91'),_0x0884('0x92'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x81'));_0x40bee4[_0x0884('0x3c')]('i.createdAt');_0x40bee4[_0x0884('0x3c')](_0x0884('0x93'));_0x40bee4['field']('i.closed');_0x40bee4[_0x0884('0x3c')](_0x0884('0x94'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x95'));_0x40bee4[_0x0884('0x3c')]('i.lastMsgAt');_0x40bee4['field'](_0x0884('0x96'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x97'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x98'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x99'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x9a'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x9b'));_0x40bee4[_0x0884('0x3c')]('i.to');_0x40bee4[_0x0884('0x3c')](_0x0884('0x9c'));_0x40bee4[_0x0884('0x3c')](_0x0884('0x9d'));_0x40bee4[_0x0884('0x3c')]('i.UserId');_0x40bee4[_0x0884('0x3c')](_0x0884('0x9e'),_0x0884('0x9f'));_0x40bee4[_0x0884('0x3c')](_0x0884('0xa0'),_0x0884('0xa1'));_0x40bee4[_0x0884('0x3c')](_0x0884('0xa2'),_0x0884('0xa3'));_0x40bee4[_0x0884('0x3c')](_0x0884('0xa4'),_0x0884('0xa5'));_0x40bee4[_0x0884('0x3c')](_0x0884('0xa6'),_0x0884('0xa7'));_0x40bee4['field'](_0x0884('0xa8'),_0x0884('0xa9'));_0x40bee4['field'](_0x0884('0xaa'),'Owner.fullname');_0x40bee4['field']('o.internal',_0x0884('0xab'));_0x40bee4[_0x0884('0x3c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0884('0x23'));}if(_0x6d79d7['limit'])_0x40bee4[_0x0884('0x17')](_0x6d79d7[_0x0884('0x17')]);if(_0x6d79d7['offset'])_0x40bee4[_0x0884('0x19')](_0x6d79d7[_0x0884('0x19')]);return db[_0x0884('0x8d')]['query'](_0x40bee4[_0x0884('0x8c')](),_0x1d8395);})[_0x0884('0x28')](function(_0x4dd433){if(_0x4dd433[_0x0884('0x52')]>0x0)_0x411a96[_0x0884('0x3a')](_0x0884('0xac'),_['map'](_0x4dd433,'id'));return db['sequelize'][_0x0884('0x32')](_0x411a96[_0x0884('0x8c')](),_0x1d8395)[_0x0884('0x28')](function(_0x297ef5){var _0x513db9=_[_0x0884('0xad')](_0x297ef5,_0x0884('0xae'));var _0x504e24=[];return db[_0x0884('0xaf')][_0x0884('0x25')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x0884('0x28')](function(_0xa28d4){var _0x544582=_0xa28d4[_0x0884('0xb0')];_0x4dd433[_0x0884('0x22')](function(_0x335190){_0x504e24['push'](updateMailInteraction(_0x335190,_0xa136fb,_0x513db9,_0x544582));});return BPromise[_0x0884('0xb1')](_0x504e24);});});});})['then'](function(_0xdcf33f){_0x56afad[_0x0884('0xb2')]=_0xdcf33f;return _0x56afad;})['then'](respondWithFilteredResult(_0xd0788,_0x6d79d7))['catch'](handleError(_0xd0788,null));};exports[_0x0884('0xb3')]=function(_0x5d4cb0,_0x35043b){var _0x4959d0={'raw':![],'where':{'id':_0x5d4cb0[_0x0884('0xb4')]['id']}},_0x2ad697={};_0x2ad697[_0x0884('0x31')]=_[_0x0884('0x33')](db[_0x0884('0x2e')][_0x0884('0xb5')]);_0x2ad697[_0x0884('0x32')]=_[_0x0884('0x33')](_0x5d4cb0[_0x0884('0x32')]);_0x2ad697[_0x0884('0x34')]=_[_0x0884('0x35')](_0x2ad697[_0x0884('0x31')],_0x2ad697[_0x0884('0x32')]);_0x4959d0['attributes']=_['intersection'](_0x2ad697[_0x0884('0x31')],qs[_0x0884('0x36')](_0x5d4cb0[_0x0884('0x32')][_0x0884('0x36')]));_0x4959d0[_0x0884('0x37')]=_0x4959d0[_0x0884('0x37')][_0x0884('0x52')]?_0x4959d0[_0x0884('0x37')]:_0x2ad697[_0x0884('0x31')];if(_0x5d4cb0['query'][_0x0884('0xb6')]){_0x4959d0['include']=[{'all':!![]}];}_0x4959d0=_['merge']({},_0x4959d0,_0x5d4cb0[_0x0884('0xb7')]);return db[_0x0884('0x2e')]['find'](_0x4959d0)['then'](handleEntityNotFound(_0x35043b,null))[_0x0884('0x28')](respondWithResult(_0x35043b,null))[_0x0884('0x2c')](handleError(_0x35043b,null));};exports[_0x0884('0xb8')]=function(_0x2fd5cb,_0xe9f22f){return db[_0x0884('0x2e')][_0x0884('0xb8')](_0x2fd5cb[_0x0884('0xb9')],{})[_0x0884('0x28')](respondWithResult(_0xe9f22f,0xc9))[_0x0884('0x2c')](handleError(_0xe9f22f,null));};exports['update']=function(_0x4cd057,_0x2ee32d){if(_0x4cd057['body']['id']){delete _0x4cd057[_0x0884('0xb9')]['id'];}return db[_0x0884('0x2e')][_0x0884('0xba')]({'where':{'id':_0x4cd057[_0x0884('0xb4')]['id']}})[_0x0884('0x28')](handleEntityNotFound(_0x2ee32d,null))[_0x0884('0x28')](saveUpdates(_0x4cd057[_0x0884('0xb9')],null))[_0x0884('0x28')](respondWithResult(_0x2ee32d,null))[_0x0884('0x2c')](handleError(_0x2ee32d,null));};exports[_0x0884('0x1c')]=function(_0xef8233,_0x5ae50a){return db['MailInteraction']['find']({'where':{'id':_0xef8233[_0x0884('0xb4')]['id']}})[_0x0884('0x28')](handleEntityNotFound(_0x5ae50a,null))['then'](removeEntity(_0x5ae50a,null))[_0x0884('0x2c')](handleError(_0x5ae50a,null));};exports['describe']=function(_0xa4379a,_0x1a47ce){return db[_0x0884('0x2e')]['describe']()[_0x0884('0x28')](respondWithResult(_0x1a47ce,null))[_0x0884('0x2c')](handleError(_0x1a47ce,null));};exports[_0x0884('0xbb')]=function(_0x44ce53,_0x117838){return db[_0x0884('0x24')]['find']({'where':{'id':_0x44ce53[_0x0884('0xb4')]['id']}})[_0x0884('0x28')](handleEntityNotFound(_0x117838,null))['then'](function(_0x3d7a63){if(_0x3d7a63){return _0x3d7a63[_0x0884('0xbb')](_0x44ce53[_0x0884('0xb9')][_0x0884('0xbc')],_[_0x0884('0xbd')](_0x44ce53['body'],[_0x0884('0xbc'),'id'])||{});}})[_0x0884('0x28')](respondWithResult(_0x117838,null))[_0x0884('0x2c')](handleError(_0x117838,null));};exports['getMessages']=function(_0x3b6ea7,_0x4b31f6){var _0x23729c={'raw':![],'where':{}};var _0x105d9a={};var _0x40f968={'count':0x0,'rows':[]};return db[_0x0884('0x2e')]['findOne']({'where':{'id':_0x3b6ea7[_0x0884('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4b31f6,null))['then'](function(_0x61f324){if(_0x61f324){_0x105d9a['model']=_[_0x0884('0x33')](db[_0x0884('0x24')]['rawAttributes']);_0x105d9a['query']=_[_0x0884('0x33')](_0x3b6ea7[_0x0884('0x32')]);_0x105d9a[_0x0884('0x34')]=_['intersection'](_0x105d9a[_0x0884('0x31')],_0x105d9a[_0x0884('0x32')]);_0x23729c[_0x0884('0x37')]=_['intersection'](_0x105d9a[_0x0884('0x31')],qs['fields'](_0x3b6ea7[_0x0884('0x32')][_0x0884('0x36')]));_0x23729c[_0x0884('0x37')]=_0x23729c[_0x0884('0x37')][_0x0884('0x52')]?_0x23729c[_0x0884('0x37')]:_0x105d9a[_0x0884('0x31')];if(!_0x3b6ea7[_0x0884('0x32')][_0x0884('0x38')]('nolimit')){_0x23729c[_0x0884('0x17')]=qs[_0x0884('0x17')](_0x3b6ea7[_0x0884('0x32')][_0x0884('0x17')]);_0x23729c[_0x0884('0x19')]=qs['offset'](_0x3b6ea7['query'][_0x0884('0x19')]);}_0x23729c['order']=qs[_0x0884('0x39')](_0x3b6ea7[_0x0884('0x32')][_0x0884('0x39')]);_0x23729c[_0x0884('0x3a')]=qs['filters'](_[_0x0884('0x3b')](_0x3b6ea7[_0x0884('0x32')],_0x105d9a[_0x0884('0x34')]));_0x23729c['where'][_0x0884('0xae')]=_0x61f324['id'];if(_0x3b6ea7[_0x0884('0x32')]['filter']){_0x23729c['where']=_[_0x0884('0xbe')](_0x23729c['where'],{'$or':_[_0x0884('0x1f')](_0x23729c[_0x0884('0x37')],function(_0x51e819){var _0x16d457={};_0x16d457[_0x51e819]={'$like':'%'+_0x3b6ea7[_0x0884('0x32')][_0x0884('0x76')]+'%'};return _0x16d457;})});}if(_0x3b6ea7['query']['$gte']){var _0xd76d96=_0x3b6ea7['query']['$gte'][_0x0884('0x21')](',');var _0x62724={};_0x62724[_0xd76d96[0x0]]={'$gte':moment(_0xd76d96[0x1])[_0x0884('0xbf')](_0x0884('0xc0'))};_0x23729c['where']=_[_0x0884('0xbe')](_0x23729c['where'],_0x62724);}_0x23729c=_[_0x0884('0xbe')]({},_0x23729c,_0x3b6ea7['options']);return db[_0x0884('0x24')][_0x0884('0x18')]({'where':_0x23729c['where']})[_0x0884('0x28')](function(_0x692390){_0x40f968[_0x0884('0x18')]=_0x692390;if(_0x3b6ea7[_0x0884('0x32')]['includeAll']){_0x23729c[_0x0884('0xc1')]=[{'all':!![]}];}return db['MailMessage'][_0x0884('0xc2')](_0x23729c);})[_0x0884('0x28')](function(_0x231826){if(_0x3b6ea7[_0x0884('0x32')]['inlineCss']==='true'){for(var _0x1fda78=0x0;_0x1fda78<_0x231826[_0x0884('0x52')];_0x1fda78++){_0x231826[_0x1fda78][_0x0884('0xb9')]=juice(_0x231826[_0x1fda78][_0x0884('0xb9')]);}}_0x40f968[_0x0884('0xb2')]=_0x231826;return _0x40f968;});}})[_0x0884('0x28')](respondWithFilteredResult(_0x4b31f6,_0x23729c))[_0x0884('0x2c')](handleError(_0x4b31f6,null));};exports['addTags']=function(_0x19cd81,_0x53149f){return db[_0x0884('0x2e')][_0x0884('0xba')]({'where':{'id':_0x19cd81[_0x0884('0xb4')]['id']}})[_0x0884('0x28')](handleEntityNotFound(_0x53149f,null))['then'](function(_0x570be1){if(_0x570be1){return _0x570be1['setTags'](_0x19cd81[_0x0884('0xb9')]['ids'],_[_0x0884('0xbd')](_0x19cd81[_0x0884('0xb9')],[_0x0884('0xbc'),'id'])||{})[_0x0884('0xc3')](function(){return db['Tag'][_0x0884('0xc2')]({'attributes':['id',_0x0884('0x1d'),_0x0884('0x3d')],'where':{'id':_0x19cd81[_0x0884('0xb9')][_0x0884('0xbc')]}});})[_0x0884('0x28')](function(_0x5924c3){socket['emit']('mailInteractionTags:save',{'id':Number(_0x19cd81[_0x0884('0xb4')]['id']),'tags':_0x5924c3||[]});return{'id':Number(_0x19cd81[_0x0884('0xb4')]['id']),'tags':_0x5924c3||[]};});}})[_0x0884('0x28')](respondWithResult(_0x53149f,null))[_0x0884('0x2c')](handleError(_0x53149f,null));};exports[_0x0884('0xc4')]=function(_0x48d22e,_0x5351ce){return db[_0x0884('0x2e')][_0x0884('0xba')]({'where':{'id':_0x48d22e['params']['id']}})['then'](handleEntityNotFound(_0x5351ce,null))[_0x0884('0x28')](function(_0x74ee55){if(_0x74ee55){return _0x74ee55['removeTags'](_0x48d22e['query'][_0x0884('0xbc')]);}})[_0x0884('0x28')](respondWithStatusCode(_0x5351ce,null))[_0x0884('0x2c')](handleError(_0x5351ce,null));};exports[_0x0884('0xc5')]=function(_0x310281,_0x206197){var _0x11a95b=moment()['unix']()[_0x0884('0x8c')]();var _0x5264eb=path['join'](config[_0x0884('0xc6')],_0x0884('0xc7'),_0x0884('0xc8'),_0x0884('0xc9'));var _0x52843b=path[_0x0884('0xca')](config[_0x0884('0xc6')],_0x0884('0xc7'),_0x0884('0xc8'),'attachments');var _0x59c1e6=path['join'](_0x5264eb,_0x11a95b);var _0x663ee8=util[_0x0884('0xbf')]('transcript-%d-%s.zip',_0x310281[_0x0884('0xb4')]['id'],_0x11a95b);var _0x38d116=path['join'](_0x5264eb,_0x663ee8);var _0x2da300=[];if(_0x310281[_0x0884('0x32')][_0x0884('0xcb')]){_0x2da300[_0x0884('0xcc')]({'model':db[_0x0884('0xcd')],'as':_0x0884('0xce'),'raw':!![]});}var _0x127b87=[{'model':db['MailMessage'],'as':_0x0884('0xcf'),'attributes':['id',_0x0884('0xb9'),'from','to','cc',_0x0884('0xd0'),_0x0884('0xd1'),_0x0884('0x6c')],'where':{'secret':![]},'order':qs[_0x0884('0x39')]('id'),'include':_0x2da300}];return db[_0x0884('0x2e')][_0x0884('0xba')]({'where':{'id':_0x310281[_0x0884('0xb4')]['id']},'include':_0x127b87})[_0x0884('0x28')](handleEntityNotFound(_0x206197,null))[_0x0884('0x28')](function(_0x5d75d8){if(_0x5d75d8&&_0x5d75d8[_0x0884('0xcf')]){var _0x442b59=_0x5d75d8[_0x0884('0xd2')]({'plain':!![]});fs[_0x0884('0xd3')](_0x59c1e6);return BPromise['each'](_0x442b59[_0x0884('0xcf')],function(_0x4a9572,_0x3f46fd){var _0x341113={'from':_0x4a9572[_0x0884('0x3e')],'to':_0x4a9572['to'],'subject':_0x4a9572[_0x0884('0xd1')],'html':htmlEntities[_0x0884('0xd4')](_0x4a9572[_0x0884('0xb9')]),'headers':{'Date':moment(_0x4a9572[_0x0884('0x6c')])[_0x0884('0xbf')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4a9572['cc']){_0x341113[_0x0884('0xd5')]['Cc']=_0x4a9572['cc'];}if(_0x4a9572[_0x0884('0xd0')]){_0x341113[_0x0884('0xd5')]['Bcc']=_0x4a9572[_0x0884('0xd0')];}return new BPromise(function(_0x3482a5,_0x20decc){if(_0x4a9572[_0x0884('0xce')]){for(var _0xd21904=0x0;_0xd21904<_0x4a9572[_0x0884('0xce')][_0x0884('0x52')];_0xd21904++){var _0x13ca0f=_0x4a9572[_0x0884('0xce')][_0xd21904];var _0x4f6697=path[_0x0884('0xca')](_0x52843b,_0x13ca0f[_0x0884('0xd6')]);if(fs[_0x0884('0xd7')](_0x4f6697)){_0x341113[_0x0884('0xcb')][_0x0884('0xcc')]({'name':_0x13ca0f[_0x0884('0x1d')],'contentType':_0x13ca0f['type'],'data':fs[_0x0884('0xd8')](_0x4f6697)});}}}emlformat[_0x0884('0xd9')](_0x341113,function(_0x30e289,_0x58de20){if(_0x30e289)return _0x20decc(_0x30e289);fs['writeFileSync'](path[_0x0884('0xca')](_0x59c1e6,util[_0x0884('0xbf')]('message%d.eml',_0x3f46fd)),_0x58de20);return _0x3482a5(_0x58de20);});});})[_0x0884('0x28')](function(){return new BPromise(function(_0x3996c6,_0x11553f){zipdir(_0x59c1e6,{'saveTo':_0x38d116},function(_0x574e51,_0x212beb){if(_0x574e51)return _0x11553f(_0x574e51);return _0x3996c6(_0x212beb);});})['then'](function(){return new BPromise(function(_0x5dd08e,_0x36b1a6){rimraf(_0x59c1e6,function(_0x40534e){if(_0x40534e)_0x36b1a6(_0x40534e);return _0x5dd08e();});});})['then'](function(){return _0x206197[_0x0884('0xc5')](_0x38d116,_0x663ee8,function(_0x29b696){if(!_0x29b696)fs['unlinkSync'](_0x38d116);});});});}else{return _0x206197[_0x0884('0x12')](0xc8);}})['catch'](handleError(_0x206197,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a5dd198..661797b 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 _0x195d=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x71009,_0x19f227){var _0x2c103a=function(_0x261694){while(--_0x261694){_0x71009['push'](_0x71009['shift']());}};_0x2c103a(++_0x19f227);}(_0x195d,0x100));var _0xd195=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x195d[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xd195('0x0'));var MailInteraction=require(_0xd195('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xd195('0x1'))['db'][_0xd195('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd195('0x3')](0x0);var events={'afterCreate':_0xd195('0x4'),'afterUpdate':_0xd195('0x5'),'afterDestroy':_0xd195('0x6')};function emitEvent(_0x4221e8){return function(_0x11ee49,_0x4b79ca,_0x289270){_0x11ee49[_0xd195('0x7')]({'attributes':['id'],'raw':!![]})[_0xd195('0x8')](function(_0xb58851){_0x11ee49[_0xd195('0x9')](_0xd195('0xa'),_0xb58851[_0xd195('0xb')](function(_0x451c3a){return{'id':_0x451c3a['id']};}));return MailMessage[_0xd195('0xc')]({'where':{'MailInteractionId':_0x11ee49['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5e53bb){_0x11ee49['setDataValue'](_0xd195('0xd'),_0x5e53bb[_0xd195('0xe')]);MailInteractionEvents[_0xd195('0xf')](_0x4221e8+':'+_0x11ee49['id'],_0x11ee49);MailInteractionEvents[_0xd195('0xf')](_0x4221e8,_0x11ee49);_0x289270(null);})[_0xd195('0x10')](_0x289270(null));};}for(var e in events){if(events[_0xd195('0x11')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xd195('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x58d3=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','findAll'];(function(_0xaaefcc,_0x232326){var _0x514607=function(_0x4795cd){while(--_0x4795cd){_0xaaefcc['push'](_0xaaefcc['shift']());}};_0x514607(++_0x232326);}(_0x58d3,0x1e3));var _0x358d=function(_0x21ad08,_0x382ffd){_0x21ad08=_0x21ad08-0x0;var _0xa1e557=_0x58d3[_0x21ad08];return _0xa1e557;};'use strict';var EventEmitter=require(_0x358d('0x0'));var MailInteraction=require(_0x358d('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x358d('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x358d('0x3')](0x0);var events={'afterCreate':_0x358d('0x4'),'afterUpdate':_0x358d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3b6a53){return function(_0x4093df,_0x20d70d,_0x272d43){_0x4093df[_0x358d('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x28067d){_0x4093df[_0x358d('0x7')](_0x358d('0x8'),_0x28067d['map'](function(_0x16817c){return{'id':_0x16817c['id']};}));return MailMessage[_0x358d('0x9')]({'where':{'MailInteractionId':_0x4093df['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x43764b){_0x4093df[_0x358d('0x7')](_0x358d('0xa'),_0x43764b[_0x358d('0xb')]);MailInteractionEvents[_0x358d('0xc')](_0x3b6a53+':'+_0x4093df['id'],_0x4093df);MailInteractionEvents[_0x358d('0xc')](_0x3b6a53,_0x4093df);_0x272d43(null);})[_0x358d('0xd')](_0x272d43(null));};}for(var e in events){if(events[_0x358d('0xe')](e)){var event=events[e];MailInteraction[_0x358d('0xf')](e,emitEvent(event));}}module[_0x358d('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 70f9ac9..e72cf5c 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 _0x6de0=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','rimraf','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','update','then'];(function(_0x388493,_0x23301e){var _0x5300a1=function(_0x1d9c91){while(--_0x1d9c91){_0x388493['push'](_0x388493['shift']());}};_0x5300a1(++_0x23301e);}(_0x6de0,0xde));var _0x06de=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x6de0[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require(_0x06de('0x0'));var logger=require(_0x06de('0x1'))(_0x06de('0x2'));var moment=require('moment');var BPromise=require(_0x06de('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x06de('0x4'));var config=require('../../config/environment');var attributes=require(_0x06de('0x5'));module[_0x06de('0x6')]=function(_0x5c0bf3,_0x232c39){return _0x5c0bf3['define'](_0x06de('0x7'),attributes,{'tableName':_0x06de('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x229296,_0xe9645f,_0x28534f){if(_0x229296[_0x06de('0x9')]){_0x229296[_0x06de('0xa')]=moment()[_0x06de('0xb')](_0x06de('0xc'));}if(_0x229296[_0x06de('0xd')]){_0x229296[_0x06de('0xe')]=moment()['format'](_0x06de('0xc'));}_0x28534f(null,_0xe9645f);},'beforeUpdate':function(_0x3280d4,_0x15d5a1,_0x1f2a65){if(_0x3280d4['changed'](_0x06de('0x9'))){_0x3280d4[_0x06de('0xa')]=_0x3280d4[_0x06de('0x9')]?moment()[_0x06de('0xb')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3280d4[_0x06de('0xf')](_0x06de('0xd'))){_0x3280d4[_0x06de('0xe')]=moment()[_0x06de('0xb')](_0x06de('0xc'));_0x3280d4['substatus']=null;_0x3280d4[_0x06de('0xa')]=null;}_0x1f2a65(null,_0x3280d4);},'afterUpdate':function(_0x5b5b4c,_0x523c13,_0x4570c5){var _0xb19fe1=_0x5c0bf3['models'];var _0x5adcd9=_0x5b5b4c[_0x06de('0x10')]({'plain':!![]});if(_0x5adcd9[_0x06de('0xd')]){return _0xb19fe1[_0x06de('0x11')][_0x06de('0x12')]({'read':!![]},{'where':{'MailInteractionId':_0x5adcd9['id']}})[_0x06de('0x13')](function(){_0x4570c5();})['catch'](function(_0xf6ddd3){_0x4570c5(_0xf6ddd3);});}else{_0x4570c5();}}},'charset':_0x06de('0x14'),'collate':_0x06de('0x15')});}; \ No newline at end of file +var _0xc1ed=['substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','MailMessage','then','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','subject','FULLTEXT','substatus'];(function(_0x398087,_0x5174ec){var _0x2eef9e=function(_0x33cc5c){while(--_0x33cc5c){_0x398087['push'](_0x398087['shift']());}};_0x2eef9e(++_0x5174ec);}(_0xc1ed,0x12a));var _0xdc1e=function(_0x17e1f7,_0x2894ad){_0x17e1f7=_0x17e1f7-0x0;var _0x1ac7ea=_0xc1ed[_0x17e1f7];return _0x1ac7ea;};'use strict';var _=require(_0xdc1e('0x0'));var util=require(_0xdc1e('0x1'));var logger=require(_0xdc1e('0x2'))(_0xdc1e('0x3'));var moment=require(_0xdc1e('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc1e('0x6'));var config=require(_0xdc1e('0x7'));var attributes=require(_0xdc1e('0x8'));module[_0xdc1e('0x9')]=function(_0x101e07,_0x2ff1bb){return _0x101e07[_0xdc1e('0xa')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xdc1e('0xb'),'to'],'type':_0xdc1e('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5015ef,_0x26f883,_0x3f3f0a){if(_0x5015ef[_0xdc1e('0xd')]){_0x5015ef[_0xdc1e('0xe')]=moment()['format'](_0xdc1e('0xf'));}if(_0x5015ef[_0xdc1e('0x10')]){_0x5015ef[_0xdc1e('0x11')]=moment()[_0xdc1e('0x12')](_0xdc1e('0xf'));}_0x3f3f0a(null,_0x26f883);},'beforeUpdate':function(_0x5b5a2d,_0x224d04,_0x9b5651){if(_0x5b5a2d[_0xdc1e('0x13')](_0xdc1e('0xd'))){_0x5b5a2d['substatusAt']=_0x5b5a2d[_0xdc1e('0xd')]?moment()['format'](_0xdc1e('0xf')):null;}if(_0x5b5a2d['changed']('closed')){_0x5b5a2d[_0xdc1e('0x11')]=moment()['format'](_0xdc1e('0xf'));_0x5b5a2d['substatus']=null;_0x5b5a2d[_0xdc1e('0xe')]=null;}_0x9b5651(null,_0x5b5a2d);},'afterUpdate':function(_0x5b698b,_0x55c142,_0x3f026a){var _0x2862cd=_0x101e07[_0xdc1e('0x14')];var _0xd8f826=_0x5b698b[_0xdc1e('0x15')]({'plain':!![]});if(_0xd8f826['closed']){return _0x2862cd[_0xdc1e('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xd8f826['id']}})[_0xdc1e('0x17')](function(){_0x3f026a();})['catch'](function(_0x11eec3){_0x3f026a(_0x11eec3);});}else{_0x3f026a();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ad4285e..6bf5ab4 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 _0xd9bc=['UpdateMailInteraction','MailInteraction','update','options','where','attributes','limit','AddTagsToMailInteraction','addTags','body','ids','AddTags','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x131e8a,_0x5eb754){var _0x2165ea=function(_0x2b8ea6){while(--_0x2b8ea6){_0x131e8a['push'](_0x131e8a['shift']());}};_0x2165ea(++_0x5eb754);}(_0xd9bc,0x1a3));var _0xcd9b=function(_0x5a910d,_0x225014){_0x5a910d=_0x5a910d-0x0;var _0x2994ac=_0xd9bc[_0x5a910d];return _0x2994ac;};'use strict';var _=require(_0xcd9b('0x0'));var util=require('util');var moment=require(_0xcd9b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd9b('0x2'))['db'];var utils=require(_0xcd9b('0x3'));var logger=require(_0xcd9b('0x4'))('rpc');var config=require(_0xcd9b('0x5'));var jayson=require(_0xcd9b('0x6'));var client=jayson[_0xcd9b('0x7')][_0xcd9b('0x8')]({'port':0x232a});config['redis']=_[_0xcd9b('0x9')](config[_0xcd9b('0xa')],{'host':_0xcd9b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd9b('0xa')]));require(_0xcd9b('0xc'))[_0xcd9b('0xd')](socket);function respondWithRpcPromise(_0x7a6835,_0xa1713e,_0x627801){return new BPromise(function(_0x53edcb,_0x41c926){return client[_0xcd9b('0xe')](_0x7a6835,_0x627801)[_0xcd9b('0xf')](function(_0x5eb35b){logger[_0xcd9b('0x10')](_0xcd9b('0x11'),_0xa1713e,_0xcd9b('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0xa1713e,_0xcd9b('0x12'),JSON[_0xcd9b('0x13')](_0x5eb35b));if(_0x5eb35b[_0xcd9b('0x14')]){if(_0x5eb35b['error'][_0xcd9b('0x15')]===0x1f4){logger[_0xcd9b('0x14')](_0xcd9b('0x11'),_0xa1713e,_0x5eb35b['error'][_0xcd9b('0x16')]);return _0x41c926(_0x5eb35b[_0xcd9b('0x14')]['message']);}logger['error'](_0xcd9b('0x11'),_0xa1713e,_0x5eb35b['error'][_0xcd9b('0x16')]);return _0x53edcb(_0x5eb35b[_0xcd9b('0x14')][_0xcd9b('0x16')]);}else{logger[_0xcd9b('0x10')](_0xcd9b('0x11'),_0xa1713e,_0xcd9b('0x12'));_0x53edcb(_0x5eb35b[_0xcd9b('0x17')][_0xcd9b('0x16')]);}})[_0xcd9b('0x18')](function(_0x4c999a){logger[_0xcd9b('0x14')]('MailInteraction,\x20%s,\x20%s',_0xa1713e,_0x4c999a);_0x41c926(_0x4c999a);});});}exports[_0xcd9b('0x19')]=function(_0x42eee7){var _0x55f33e=this;return new Promise(function(_0x13dcf2,_0xb79fbb){return db[_0xcd9b('0x1a')][_0xcd9b('0x1b')](_0x42eee7['body'],{'raw':_0x42eee7[_0xcd9b('0x1c')]?_0x42eee7[_0xcd9b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42eee7[_0xcd9b('0x1c')]?_0x42eee7[_0xcd9b('0x1c')][_0xcd9b('0x1d')]||null:null,'attributes':_0x42eee7[_0xcd9b('0x1c')]?_0x42eee7['options'][_0xcd9b('0x1e')]||null:null,'limit':_0x42eee7['options']?_0x42eee7[_0xcd9b('0x1c')][_0xcd9b('0x1f')]||null:null})['then'](function(_0x5c8890){logger[_0xcd9b('0x10')](_0xcd9b('0x19'),_0x42eee7);logger['debug'](_0xcd9b('0x19'),_0x42eee7,JSON[_0xcd9b('0x13')](_0x5c8890));_0x13dcf2(_0x5c8890);})['catch'](function(_0x239714){logger['error']('UpdateMailInteraction',_0x239714[_0xcd9b('0x16')],_0x42eee7);_0xb79fbb(_0x55f33e[_0xcd9b('0x14')](0x1f4,_0x239714['message']));});});};exports[_0xcd9b('0x20')]=function(_0x338486){return new Promise(function(_0x1831a9,_0x1b5de0){return db[_0xcd9b('0x1a')]['find']({'where':_0x338486[_0xcd9b('0x1c')]?_0x338486[_0xcd9b('0x1c')][_0xcd9b('0x1d')]||null:null})[_0xcd9b('0xf')](function(_0x402cc4){if(_0x402cc4){return _0x402cc4[_0xcd9b('0x21')](_0x338486[_0xcd9b('0x22')][_0xcd9b('0x23')],_['omit'](_0x338486[_0xcd9b('0x22')],['ids','id'])||{});}})['spread'](function(_0x5f0bf9){logger[_0xcd9b('0x10')](_0xcd9b('0x24'),_0x338486);logger['debug'](_0xcd9b('0x24'),_0x338486,JSON[_0xcd9b('0x13')](_0x5f0bf9));_0x1831a9(_0x5f0bf9);})[_0xcd9b('0x18')](function(_0x38249f){logger[_0xcd9b('0x14')](_0xcd9b('0x24'),_0x38249f['message'],_0x338486);_0x1b5de0(_this[_0xcd9b('0x14')](0x1f4,_0x38249f['message']));});});}; \ No newline at end of file +var _0x2af8=['stringify','error','message','result','catch','UpdateMailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','where','addTags','ids','omit','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5e891f,_0x454184){var _0x48dd81=function(_0x1d478d){while(--_0x1d478d){_0x5e891f['push'](_0x5e891f['shift']());}};_0x48dd81(++_0x454184);}(_0x2af8,0xf6));var _0x82af=function(_0x586642,_0x3b2e5d){_0x586642=_0x586642-0x0;var _0xef997a=_0x2af8[_0x586642];return _0xef997a;};'use strict';var _=require(_0x82af('0x0'));var util=require('util');var moment=require(_0x82af('0x1'));var BPromise=require(_0x82af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82af('0x3'));var db=require(_0x82af('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82af('0x5'))('rpc');var config=require(_0x82af('0x6'));var jayson=require(_0x82af('0x7'));var client=jayson['client'][_0x82af('0x8')]({'port':0x232a});config[_0x82af('0x9')]=_['defaults'](config[_0x82af('0x9')],{'host':_0x82af('0xa'),'port':0x18eb});var socket=require(_0x82af('0xb'))(new Redis(config[_0x82af('0x9')]));require(_0x82af('0xc'))[_0x82af('0xd')](socket);function respondWithRpcPromise(_0x1dbaff,_0x46fe4b,_0x41451a){return new BPromise(function(_0xd5ecc8,_0x459bf0){return client[_0x82af('0xe')](_0x1dbaff,_0x41451a)[_0x82af('0xf')](function(_0x1dedf2){logger[_0x82af('0x10')](_0x82af('0x11'),_0x46fe4b,_0x82af('0x12'));logger[_0x82af('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x46fe4b,'request\x20sent',JSON[_0x82af('0x14')](_0x1dedf2));if(_0x1dedf2[_0x82af('0x15')]){if(_0x1dedf2[_0x82af('0x15')]['code']===0x1f4){logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);return _0x459bf0(_0x1dedf2['error'][_0x82af('0x16')]);}logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);return _0xd5ecc8(_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);}else{logger[_0x82af('0x10')](_0x82af('0x11'),_0x46fe4b,_0x82af('0x12'));_0xd5ecc8(_0x1dedf2[_0x82af('0x17')][_0x82af('0x16')]);}})[_0x82af('0x18')](function(_0x5be05a){logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x5be05a);_0x459bf0(_0x5be05a);});});}exports[_0x82af('0x19')]=function(_0x20cc9e){var _0x59a6fc=this;return new Promise(function(_0x5be0d8,_0x31ffbe){return db['MailInteraction'][_0x82af('0x1a')](_0x20cc9e[_0x82af('0x1b')],{'raw':_0x20cc9e[_0x82af('0x1c')]?_0x20cc9e[_0x82af('0x1c')][_0x82af('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20cc9e[_0x82af('0x1c')]?_0x20cc9e[_0x82af('0x1c')]['where']||null:null,'attributes':_0x20cc9e[_0x82af('0x1c')]?_0x20cc9e['options'][_0x82af('0x1e')]||null:null,'limit':_0x20cc9e['options']?_0x20cc9e['options'][_0x82af('0x1f')]||null:null})['then'](function(_0x7d204e){logger[_0x82af('0x10')](_0x82af('0x19'),_0x20cc9e);logger[_0x82af('0x13')](_0x82af('0x19'),_0x20cc9e,JSON[_0x82af('0x14')](_0x7d204e));_0x5be0d8(_0x7d204e);})[_0x82af('0x18')](function(_0x1adceb){logger['error']('UpdateMailInteraction',_0x1adceb[_0x82af('0x16')],_0x20cc9e);_0x31ffbe(_0x59a6fc[_0x82af('0x15')](0x1f4,_0x1adceb['message']));});});};exports[_0x82af('0x20')]=function(_0x2e6753){return new Promise(function(_0x428c5e,_0x1561f7){return db['MailInteraction']['find']({'where':_0x2e6753[_0x82af('0x1c')]?_0x2e6753[_0x82af('0x1c')][_0x82af('0x21')]||null:null})[_0x82af('0xf')](function(_0x253b01){if(_0x253b01){return _0x253b01[_0x82af('0x22')](_0x2e6753[_0x82af('0x1b')][_0x82af('0x23')],_[_0x82af('0x24')](_0x2e6753[_0x82af('0x1b')],['ids','id'])||{});}})['spread'](function(_0x2412f2){logger['info']('AddTags',_0x2e6753);logger[_0x82af('0x13')](_0x82af('0x25'),_0x2e6753,JSON['stringify'](_0x2412f2));_0x428c5e(_0x2412f2);})['catch'](function(_0x2e6542){logger[_0x82af('0x15')](_0x82af('0x25'),_0x2e6542[_0x82af('0x16')],_0x2e6753);_0x1561f7(_this['error'](0x1f4,_0x2e6542[_0x82af('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 8838e46..cd96689 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 _0xeaa4=['length','save','remove','emit','register'];(function(_0x3ba362,_0x24a3d2){var _0xcad316=function(_0x487ea0){while(--_0x487ea0){_0x3ba362['push'](_0x3ba362['shift']());}};_0xcad316(++_0x24a3d2);}(_0xeaa4,0x123));var _0x4eaa=function(_0x233aad,_0x5238dc){_0x233aad=_0x233aad-0x0;var _0x2072a9=_0xeaa4[_0x233aad];return _0x2072a9;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x4eaa('0x0'),_0x4eaa('0x1'),'update'];function createListener(_0x14da12,_0xc3a613){return function(_0x419722){_0xc3a613[_0x4eaa('0x2')](_0x14da12,_0x419722);};}function removeListener(_0x9affa6,_0x38b594){return function(){MailInteractionEvents['removeListener'](_0x9affa6,_0x38b594);};}exports[_0x4eaa('0x3')]=function(_0x447b84){for(var _0x8151f8=0x0,_0x4110dd=events[_0x4eaa('0x4')];_0x8151f8<_0x4110dd;_0x8151f8++){var _0x399c2d=events[_0x8151f8];var _0x4b3af3=createListener('mailInteraction:'+_0x399c2d,_0x447b84);MailInteractionEvents['on'](_0x399c2d,_0x4b3af3);}}; \ No newline at end of file +var _0xa9ec=['update','removeListener','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x475a12,_0x3a1aa6){var _0x1dfd30=function(_0x4173b8){while(--_0x4173b8){_0x475a12['push'](_0x475a12['shift']());}};_0x1dfd30(++_0x3a1aa6);}(_0xa9ec,0x146));var _0xca9e=function(_0x389c94,_0x2a93d9){_0x389c94=_0x389c94-0x0;var _0x1455cb=_0xa9ec[_0x389c94];return _0x1455cb;};'use strict';var MailInteractionEvents=require(_0xca9e('0x0'));var events=[_0xca9e('0x1'),_0xca9e('0x2'),_0xca9e('0x3')];function createListener(_0x12b747,_0x46cff0){return function(_0x5db90c){_0x46cff0['emit'](_0x12b747,_0x5db90c);};}function removeListener(_0x100762,_0x38f8e2){return function(){MailInteractionEvents[_0xca9e('0x4')](_0x100762,_0x38f8e2);};}exports['register']=function(_0x4a32d0){for(var _0x5782a8=0x0,_0x7d17b=events[_0xca9e('0x5')];_0x5782a8<_0x7d17b;_0x5782a8++){var _0x5a4726=events[_0x5782a8];var _0x9610fa=createListener(_0xca9e('0x6')+_0x5a4726,_0x4a32d0);MailInteractionEvents['on'](_0x5a4726,_0x9610fa);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 715e7a0..f58a31e 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 _0x7235=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x284ada,_0x414edf){var _0xcf12b2=function(_0x61758d){while(--_0x61758d){_0x284ada['push'](_0x284ada['shift']());}};_0xcf12b2(++_0x414edf);}(_0x7235,0x77));var _0x5723=function(_0x21ec35,_0x32f909){_0x21ec35=_0x21ec35-0x0;var _0x56c355=_0x7235[_0x21ec35];return _0x56c355;};'use strict';var multer=require(_0x5723('0x0'));var util=require(_0x5723('0x1'));var path=require(_0x5723('0x2'));var timeout=require(_0x5723('0x3'));var express=require('express');var router=express[_0x5723('0x4')]();var fs_extra=require(_0x5723('0x5'));var auth=require(_0x5723('0x6'));var interaction=require(_0x5723('0x7'));var config=require(_0x5723('0x8'));var controller=require(_0x5723('0x9'));router[_0x5723('0xa')]('/',auth[_0x5723('0xb')](),controller[_0x5723('0xc')]);router[_0x5723('0xa')](_0x5723('0xd'),auth[_0x5723('0xb')](),controller[_0x5723('0xe')]);router[_0x5723('0xa')](_0x5723('0xf'),auth[_0x5723('0xb')](),controller[_0x5723('0x10')]);router['get'](_0x5723('0x11'),auth[_0x5723('0xb')](),controller[_0x5723('0x12')]);router['post']('/',auth[_0x5723('0xb')](),interaction[_0x5723('0x13')](_0x5723('0x14'),_0x5723('0x15')),controller[_0x5723('0x16')]);router[_0x5723('0x17')](_0x5723('0xf'),auth[_0x5723('0xb')](),controller['update']);router['put'](_0x5723('0x18'),auth[_0x5723('0xb')](),controller[_0x5723('0x19')]);router['put'](_0x5723('0x1a'),auth['isAuthenticated'](),controller[_0x5723('0x1b')]);router[_0x5723('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x5723('0x1d')]);module[_0x5723('0x1e')]=router; \ No newline at end of file +var _0xca7b=['accept','/:id/reject','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download','tracked','mailmessage:create','create','put','update'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0xca7b,0x14e));var _0xbca7=function(_0xd0b8f2,_0x5aa8de){_0xd0b8f2=_0xd0b8f2-0x0;var _0x323f76=_0xca7b[_0xd0b8f2];return _0x323f76;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbca7('0x0'));var timeout=require(_0xbca7('0x1'));var express=require('express');var router=express[_0xbca7('0x2')]();var fs_extra=require(_0xbca7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbca7('0x4'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xbca7('0x5')]('/',auth['isAuthenticated'](),controller[_0xbca7('0x6')]);router['get'](_0xbca7('0x7'),auth[_0xbca7('0x8')](),controller[_0xbca7('0x9')]);router[_0xbca7('0x5')](_0xbca7('0xa'),auth[_0xbca7('0x8')](),controller['show']);router[_0xbca7('0x5')](_0xbca7('0xb'),auth[_0xbca7('0x8')](),controller[_0xbca7('0xc')]);router['post']('/',auth[_0xbca7('0x8')](),interaction[_0xbca7('0xd')]('mail',_0xbca7('0xe')),controller[_0xbca7('0xf')]);router[_0xbca7('0x10')](_0xbca7('0xa'),auth[_0xbca7('0x8')](),controller[_0xbca7('0x11')]);router[_0xbca7('0x10')]('/:id/accept',auth[_0xbca7('0x8')](),controller[_0xbca7('0x12')]);router['put'](_0xbca7('0x13'),auth[_0xbca7('0x8')](),controller['reject']);router[_0xbca7('0x14')]('/:id',auth[_0xbca7('0x8')](),controller[_0xbca7('0x15')]);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 251d1c3..d14b4d7 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 _0xb0e3=['medium','BOOLEAN','ENUM','out','INTEGER','Email','sequelize','exports','long','TEXT'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xb0e3,0x18c));var _0x3b0e=function(_0x1796ad,_0x3e21b9){_0x1796ad=_0x1796ad-0x0;var _0x45613c=_0xb0e3[_0x1796ad];return _0x45613c;};'use strict';var Sequelize=require(_0x3b0e('0x0'));var _=require('lodash');module[_0x3b0e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3b0e('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3b0e('0x3')](_0x3b0e('0x4'))},'read':{'type':Sequelize[_0x3b0e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b0e('0x6')]('in',_0x3b0e('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x3b0e('0x2'))},'cc':{'type':Sequelize[_0x3b0e('0x3')](_0x3b0e('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x3b0e('0x2'))},'subject':{'type':Sequelize[_0x3b0e('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x3b0e('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3b0e('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x3b0e('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x3b0e('0x2'))},'originChannel':{'type':Sequelize['ENUM']('Email','Chat'),'defaultValue':_0x3b0e('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0xf8cf=['DATE','Email','Chat','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x2dcf6e,_0x1e971f){var _0x5c9d78=function(_0x57c1d7){while(--_0x57c1d7){_0x2dcf6e['push'](_0x2dcf6e['shift']());}};_0x5c9d78(++_0x1e971f);}(_0xf8cf,0x153));var _0xff8c=function(_0x9f18b0,_0x4fdb49){_0x9f18b0=_0x9f18b0-0x0;var _0x2b08fe=_0xf8cf[_0x9f18b0];return _0x2b08fe;};'use strict';var Sequelize=require('sequelize');var _=require(_0xff8c('0x0'));module[_0xff8c('0x1')]={'body':{'type':Sequelize[_0xff8c('0x2')](_0xff8c('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xff8c('0x2')](_0xff8c('0x4'))},'read':{'type':Sequelize[_0xff8c('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xff8c('0x6')]('in',_0xff8c('0x7')),'defaultValue':_0xff8c('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xff8c('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xff8c('0x2')]('long')},'cc':{'type':Sequelize[_0xff8c('0x2')](_0xff8c('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0xff8c('0x3'))},'subject':{'type':Sequelize[_0xff8c('0x2')]},'sentAt':{'type':Sequelize[_0xff8c('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xff8c('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xff8c('0x3'))},'originCc':{'type':Sequelize[_0xff8c('0x2')](_0xff8c('0x3'))},'originChannel':{'type':Sequelize[_0xff8c('0x6')](_0xff8c('0xa'),_0xff8c('0xb')),'defaultValue':_0xff8c('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 0f418a0..d6260dc 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 _0xf980=['YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','agent','MailInteraction','MailInteractionId','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','rejectmessage','download','toString','join','root','server','files','message-%s.eml','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','Attachments','build','writeFileSync','unlinkSync','moment','util','path','lodash','html-to-text','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','request','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','json','offset','undefined','count','status','Content-Range','then','destroy','end','name','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','update','messageId','format'];(function(_0x566500,_0x44cc35){var _0x1501e5=function(_0x4bbd9e){while(--_0x4bbd9e){_0x566500['push'](_0x566500['shift']());}};_0x1501e5(++_0x44cc35);}(_0xf980,0x174));var _0x0f98=function(_0x472ee2,_0x295444){_0x472ee2=_0x472ee2-0x0;var _0x18387b=_0xf980[_0x472ee2];return _0x18387b;};'use strict';var emlformat=require('eml-format');var moment=require(_0x0f98('0x0'));var BPromise=require('bluebird');var util=require(_0x0f98('0x1'));var path=require(_0x0f98('0x2'));var fs=require('fs');var _=require(_0x0f98('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x0f98('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var interaction_log=require(_0x0f98('0x5'))('mail-interactions');var config=require(_0x0f98('0x6'));var db=require(_0x0f98('0x7'))['db'];config[_0x0f98('0x8')]=_[_0x0f98('0x9')](config[_0x0f98('0x8')],{'host':_0x0f98('0xa'),'port':0x18eb});var socket=require(_0x0f98('0xb'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x0f98('0xc'))[_0x0f98('0xd')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x0f98('0xe')][_0x0f98('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x1d4687,_0x2fa5c3,_0x107ef5,_0xaafaaf){return new BPromise(function(_0x48b5a,_0xaed5f6){var _0x188940=_0xaafaaf||client;return _0x188940[_0x0f98('0x10')](_0x1d4687,_0x107ef5)['then'](function(_0xa2bc7c){logger['info'](_0x0f98('0x11'),_0x2fa5c3,'request\x20sent');logger[_0x0f98('0x12')](_0x0f98('0x13'),_0x2fa5c3,_0x0f98('0x14'),JSON[_0x0f98('0x15')](_0xa2bc7c));if(_0xa2bc7c[_0x0f98('0x16')]){if(_0xa2bc7c['error']['code']===0x1f4){logger[_0x0f98('0x16')](_0x0f98('0x11'),_0x2fa5c3,_0xa2bc7c[_0x0f98('0x16')][_0x0f98('0x17')]);return _0xaed5f6(_0xa2bc7c[_0x0f98('0x16')]['message']);}logger[_0x0f98('0x16')]('MailMessage,\x20%s,\x20%s',_0x2fa5c3,_0xa2bc7c[_0x0f98('0x16')][_0x0f98('0x17')]);return _0x48b5a(_0xa2bc7c[_0x0f98('0x16')]['message']);}else{logger[_0x0f98('0x18')](_0x0f98('0x11'),_0x2fa5c3,_0x0f98('0x14'));_0x48b5a(_0xa2bc7c[_0x0f98('0x19')]['message']);}})[_0x0f98('0x1a')](function(_0x38e232){logger[_0x0f98('0x16')]('MailMessage,\x20%s,\x20%s',_0x2fa5c3,_0x38e232);_0xaed5f6(_0x38e232);});});}function respondWithResult(_0x4442b6,_0x1cb992){_0x1cb992=_0x1cb992||0xc8;return function(_0x21adb0){if(_0x21adb0){return _0x4442b6['status'](_0x1cb992)[_0x0f98('0x1b')](_0x21adb0);}};}function respondWithFilteredResult(_0x13886d,_0x210abf){return function(_0x985a52){if(_0x985a52){var _0x219f8a=typeof _0x210abf[_0x0f98('0x1c')]==='undefined'&&typeof _0x210abf['limit']===_0x0f98('0x1d');var _0x243e15=_0x985a52[_0x0f98('0x1e')];var _0x46b726=_0x219f8a?0x0:_0x210abf[_0x0f98('0x1c')];var _0x3171c3=_0x219f8a?_0x985a52[_0x0f98('0x1e')]:_0x210abf[_0x0f98('0x1c')]+_0x210abf['limit'];var _0x4612f0;if(_0x3171c3>=_0x243e15){_0x3171c3=_0x243e15;_0x4612f0=0xc8;}else{_0x4612f0=0xce;}_0x13886d[_0x0f98('0x1f')](_0x4612f0);return _0x13886d['set'](_0x0f98('0x20'),_0x46b726+'-'+_0x3171c3+'/'+_0x243e15)[_0x0f98('0x1b')](_0x985a52);}return null;};}function saveUpdates(_0x1ca5ea){return function(_0x139359){if(_0x139359){return _0x139359['update'](_0x1ca5ea)[_0x0f98('0x21')](function(_0x523894){return _0x523894;});}return null;};}function removeEntity(_0x4f8121){return function(_0x4b1036){if(_0x4b1036){return _0x4b1036[_0x0f98('0x22')]()[_0x0f98('0x21')](function(){_0x4f8121['status'](0xcc)[_0x0f98('0x23')]();});}};}function handleEntityNotFound(_0x5628aa){return function(_0x1c98b4){if(!_0x1c98b4){_0x5628aa['sendStatus'](0x194);}return _0x1c98b4;};}function handleError(_0x41ae00,_0x219c7a){_0x219c7a=_0x219c7a||0x1f4;return function(_0x255cc4){logger[_0x0f98('0x16')](_0x255cc4['stack']);if(_0x255cc4[_0x0f98('0x24')]){delete _0x255cc4['name'];}_0x41ae00[_0x0f98('0x1f')](_0x219c7a)['send'](_0x255cc4);};}exports[_0x0f98('0x25')]=function(_0x27a434,_0x20f8b9){var _0x17b2e7={},_0x288c2e={},_0x40f96d={'count':0x0,'rows':[]};var _0x20108f=_[_0x0f98('0x26')](db[_0x0f98('0x27')][_0x0f98('0x28')],function(_0x58c663){return{'name':_0x58c663[_0x0f98('0x29')],'type':_0x58c663[_0x0f98('0x2a')]['key']};});_0x288c2e[_0x0f98('0x2b')]=_['map'](_0x20108f,'name');_0x288c2e[_0x0f98('0x2c')]=_[_0x0f98('0x2d')](_0x27a434['query']);_0x288c2e[_0x0f98('0x2e')]=_['intersection'](_0x288c2e[_0x0f98('0x2b')],_0x288c2e['query']);_0x17b2e7[_0x0f98('0x2f')]=_[_0x0f98('0x30')](_0x288c2e[_0x0f98('0x2b')],qs[_0x0f98('0x31')](_0x27a434[_0x0f98('0x2c')][_0x0f98('0x31')]));_0x17b2e7[_0x0f98('0x2f')]=_0x17b2e7[_0x0f98('0x2f')][_0x0f98('0x32')]?_0x17b2e7['attributes']:_0x288c2e[_0x0f98('0x2b')];if(!_0x27a434[_0x0f98('0x2c')][_0x0f98('0x33')](_0x0f98('0x34'))){_0x17b2e7['limit']=qs[_0x0f98('0x35')](_0x27a434[_0x0f98('0x2c')][_0x0f98('0x35')]);_0x17b2e7[_0x0f98('0x1c')]=qs['offset'](_0x27a434[_0x0f98('0x2c')][_0x0f98('0x1c')]);}_0x17b2e7[_0x0f98('0x36')]=qs['sort'](_0x27a434['query'][_0x0f98('0x37')]);_0x17b2e7['where']=qs[_0x0f98('0x2e')](_[_0x0f98('0x38')](_0x27a434[_0x0f98('0x2c')],_0x288c2e[_0x0f98('0x2e')]),_0x20108f);if(_0x27a434[_0x0f98('0x2c')][_0x0f98('0x39')]){_0x17b2e7[_0x0f98('0x3a')]=_[_0x0f98('0x3b')](_0x17b2e7[_0x0f98('0x3a')],{'$or':_[_0x0f98('0x26')](_0x20108f,function(_0x3157fa){if(_0x3157fa[_0x0f98('0x2a')]!==_0x0f98('0x3c')){var _0xb53a1d={};_0xb53a1d[_0x3157fa['name']]={'$like':'%'+_0x27a434[_0x0f98('0x2c')][_0x0f98('0x39')]+'%'};return _0xb53a1d;}})});}_0x17b2e7=_[_0x0f98('0x3b')]({},_0x17b2e7,_0x27a434[_0x0f98('0x3d')]);var _0x1ddd5b={'where':_0x17b2e7[_0x0f98('0x3a')]};return db[_0x0f98('0x27')]['count'](_0x1ddd5b)[_0x0f98('0x21')](function(_0x2fe9aa){_0x40f96d['count']=_0x2fe9aa;if(_0x27a434[_0x0f98('0x2c')]['includeAll']){_0x17b2e7[_0x0f98('0x3e')]=[{'all':!![]}];}return db[_0x0f98('0x27')][_0x0f98('0x3f')](_0x17b2e7);})['then'](function(_0x336d9d){_0x40f96d[_0x0f98('0x40')]=_0x336d9d;return _0x40f96d;})[_0x0f98('0x21')](respondWithFilteredResult(_0x20f8b9,_0x17b2e7))[_0x0f98('0x1a')](handleError(_0x20f8b9,null));};exports['show']=function(_0x25beab,_0x29e47e){var _0xfed793={'raw':!![],'where':{'id':_0x25beab[_0x0f98('0x41')]['id']}},_0x38e4dd={};_0x38e4dd[_0x0f98('0x2b')]=_['keys'](db['MailMessage'][_0x0f98('0x28')]);_0x38e4dd[_0x0f98('0x2c')]=_[_0x0f98('0x2d')](_0x25beab[_0x0f98('0x2c')]);_0x38e4dd[_0x0f98('0x2e')]=_['intersection'](_0x38e4dd[_0x0f98('0x2b')],_0x38e4dd[_0x0f98('0x2c')]);_0xfed793[_0x0f98('0x2f')]=_[_0x0f98('0x30')](_0x38e4dd[_0x0f98('0x2b')],qs[_0x0f98('0x31')](_0x25beab[_0x0f98('0x2c')][_0x0f98('0x31')]));_0xfed793[_0x0f98('0x2f')]=_0xfed793[_0x0f98('0x2f')]['length']?_0xfed793[_0x0f98('0x2f')]:_0x38e4dd[_0x0f98('0x2b')];if(_0x25beab[_0x0f98('0x2c')][_0x0f98('0x42')]){_0xfed793[_0x0f98('0x3e')]=[{'all':!![]}];}_0xfed793=_[_0x0f98('0x3b')]({},_0xfed793,_0x25beab[_0x0f98('0x3d')]);return db[_0x0f98('0x27')][_0x0f98('0x43')](_0xfed793)[_0x0f98('0x21')](handleEntityNotFound(_0x29e47e,null))['then'](respondWithResult(_0x29e47e,null))[_0x0f98('0x1a')](handleError(_0x29e47e,null));};exports['update']=function(_0x62685e,_0x142c21){if(_0x62685e[_0x0f98('0x44')]['id']){delete _0x62685e['body']['id'];}return db[_0x0f98('0x27')][_0x0f98('0x43')]({'where':{'id':_0x62685e['params']['id']}})[_0x0f98('0x21')](handleEntityNotFound(_0x142c21,null))[_0x0f98('0x21')](saveUpdates(_0x62685e['body'],null))[_0x0f98('0x21')](respondWithResult(_0x142c21,null))[_0x0f98('0x1a')](handleError(_0x142c21,null));};exports[_0x0f98('0x22')]=function(_0x33c90a,_0x323976){return db['MailMessage'][_0x0f98('0x43')]({'where':{'id':_0x33c90a['params']['id']}})[_0x0f98('0x21')](handleEntityNotFound(_0x323976,null))['then'](removeEntity(_0x323976,null))[_0x0f98('0x1a')](handleError(_0x323976,null));};exports[_0x0f98('0x45')]=function(_0x132cc7,_0x4a24c2){return db[_0x0f98('0x27')][_0x0f98('0x45')]()[_0x0f98('0x21')](respondWithResult(_0x4a24c2,null))[_0x0f98('0x1a')](handleError(_0x4a24c2,null));};exports[_0x0f98('0x46')]=function(_0x261c5e,_0x4e8f95){return db['MailMessage'][_0x0f98('0x46')](_0x261c5e[_0x0f98('0x44')])['then'](function(_0x528011){if(_0x528011){if(_0x528011['direction']===_0x0f98('0x47')&&!_0x528011[_0x0f98('0x48')]){var _0x4e9da8,_0x37ff50,_0x43a1ce;if(_0x261c5e[_0x0f98('0x44')]['to']){_0x37ff50=_0x261c5e[_0x0f98('0x44')]['to'][_0x0f98('0x49')](',')[0x0];}return db[_0x0f98('0x4a')][_0x0f98('0x4b')]({'where':{'id':_0x528011[_0x0f98('0x4c')]},'include':[{'model':db[_0x0f98('0x4d')],'as':_0x0f98('0x4e'),'include':[{'model':db['CmContact'],'as':_0x0f98('0x4f'),'where':{'email':_0x37ff50},'limit':0x1,'order':[[_0x0f98('0x50'),_0x0f98('0x51')]]}]},{'model':db[_0x0f98('0x52')],'as':_0x0f98('0x53'),'raw':!![]}]})[_0x0f98('0x21')](function(_0x1490fb){_0x4e9da8=_0x1490fb;if(_0x4e9da8&&_0x4e9da8['Smtp']){var _0x6329ce={'tls':{'rejectUnauthorized':![]}};if(_[_0x0f98('0x54')](_0x4e9da8[_0x0f98('0x53')][_0x0f98('0x55')])){_0x6329ce[_0x0f98('0x56')]=_0x4e9da8[_0x0f98('0x53')][_0x0f98('0x56')];_0x6329ce[_0x0f98('0x57')]=_0x4e9da8['Smtp'][_0x0f98('0x57')];_0x6329ce[_0x0f98('0x58')]=_0x4e9da8[_0x0f98('0x53')][_0x0f98('0x58')];if(_0x4e9da8['Smtp']['authentication']){_0x6329ce[_0x0f98('0x59')]={'user':_0x4e9da8[_0x0f98('0x53')][_0x0f98('0x5a')],'pass':_0x4e9da8['Smtp'][_0x0f98('0x5b')]};}}else{_0x6329ce[_0x0f98('0x55')]=_0x4e9da8[_0x0f98('0x53')][_0x0f98('0x55')];_0x6329ce[_0x0f98('0x59')]={'user':_0x4e9da8[_0x0f98('0x53')][_0x0f98('0x5a')],'pass':_0x4e9da8[_0x0f98('0x53')][_0x0f98('0x5b')]};_0x6329ce[_0x0f98('0x58')]=_0x4e9da8[_0x0f98('0x53')]['secure'];}if(_0x261c5e[_0x0f98('0x44')]['attachments']&&_0x261c5e[_0x0f98('0x44')][_0x0f98('0x5c')][_0x0f98('0x32')]){for(var _0x283d01=0x0;_0x283d01<_0x261c5e[_0x0f98('0x44')][_0x0f98('0x5c')][_0x0f98('0x32')];_0x283d01+=0x1){_0x261c5e[_0x0f98('0x44')][_0x0f98('0x5c')][_0x283d01]={'filename':_0x261c5e[_0x0f98('0x44')][_0x0f98('0x5c')][_0x283d01]['name'],'path':path['join'](config['root'],'server/files/attachments',_0x261c5e[_0x0f98('0x44')][_0x0f98('0x5c')][_0x283d01][_0x0f98('0x5d')])};}}_0x43a1ce={'account':_0x6329ce,'message':_0x261c5e[_0x0f98('0x44')]};return;}})['then'](function(){if(_0x4e9da8['List']){if(_0x4e9da8[_0x0f98('0x4e')][_0x0f98('0x4f')]['length']){return _0x4e9da8['List'][_0x0f98('0x4f')][0x0];}else{return db[_0x0f98('0x5e')][_0x0f98('0x46')](_[_0x0f98('0x9')](_0x261c5e['body'],{'firstName':_0x261c5e[_0x0f98('0x44')]['to'],'email':_0x261c5e[_0x0f98('0x44')]['to'],'phone':_0x261c5e[_0x0f98('0x44')]['to'],'ListId':_0x4e9da8[_0x0f98('0x5f')]}));}}else{throw new Error(_0x0f98('0x60'));}})['then'](function(){if(_0x43a1ce){return respondWithRpcPromise(_0x0f98('0x61'),_0x0f98('0x62'),_0x43a1ce,client9003)['then'](function(_0x4c5b32){return _0x528011[_0x0f98('0x63')]({'read':!![],'messageId':_0x4c5b32[_0x0f98('0x64')],'sentAt':moment()[_0x0f98('0x65')](_0x0f98('0x66'))});})[_0x0f98('0x1a')](function(_0x5c8968){logger[_0x0f98('0x16')]('%s',JSON[_0x0f98('0x15')](_0x5c8968));return _0x528011;});}return _0x528011;});}return _0x528011;}})[_0x0f98('0x21')](respondWithResult(_0x4e8f95,0xc9))[_0x0f98('0x1a')](handleError(_0x4e8f95,null));};exports[_0x0f98('0x67')]=function(_0x5a6cec,_0x1b9960){var _0x5c151e={'agent':{},'channel':_0x0f98('0x68')};if(_0x5a6cec['body']['id']){delete _0x5a6cec[_0x0f98('0x44')]['id'];}_0x5a6cec['body']['read']=!![];_0x5a6cec[_0x0f98('0x44')][_0x0f98('0x69')]=moment()[_0x0f98('0x65')](_0x0f98('0x66'));_0x5a6cec['body'][_0x0f98('0x6a')]=_0x5a6cec['body'][_0x0f98('0x6a')]||_0x5a6cec['user']['id'];_0x5c151e[_0x0f98('0x6b')]['id']=_0x5a6cec[_0x0f98('0x44')][_0x0f98('0x6a')];return db[_0x0f98('0x27')][_0x0f98('0x43')]({'where':{'id':_0x5a6cec[_0x0f98('0x41')]['id'],'UserId':null}})[_0x0f98('0x21')](handleEntityNotFound(_0x1b9960,null))[_0x0f98('0x21')](saveUpdates(_0x5a6cec[_0x0f98('0x44')],null))[_0x0f98('0x21')](function(_0x32368e){if(_0x32368e){_0x5c151e[_0x0f98('0x17')]=_0x32368e['get']({'plain':!![]});return db[_0x0f98('0x6c')]['find']({'where':{'id':_0x32368e[_0x0f98('0x6d')]}});}return null;})[_0x0f98('0x21')](handleEntityNotFound(_0x1b9960,null))[_0x0f98('0x21')](function(_0xae7052){if(_0xae7052){return _0xae7052[_0x0f98('0x63')]({'UserId':_0x5a6cec[_0x0f98('0x44')]['UserId'],'read1stAt':_[_0x0f98('0x54')](_0xae7052[_0x0f98('0x6e')])?moment()[_0x0f98('0x65')](_0x0f98('0x66')):undefined});}return null;})[_0x0f98('0x21')](function(_0x5d9be3){if(_0x5d9be3){_0x5c151e['interaction']=_0x5d9be3[_0x0f98('0x6f')]({'plain':!![]});interaction_log['info'](_0x0f98('0x70'),_0x5a6cec[_0x0f98('0x5a')]['id'],_0x5a6cec['user'][_0x0f98('0x24')],_0x5a6cec[_0x0f98('0x5a')][_0x0f98('0x71')],_0x5c151e[_0x0f98('0x72')]['id'],_0x5a6cec['body']?JSON[_0x0f98('0x15')](_0x5a6cec[_0x0f98('0x44')]):_0x0f98('0x73'));return respondWithRpcPromise('AcceptMessage',_0x0f98('0x74'),_0x5c151e);}return null;})[_0x0f98('0x21')](function(_0xccb3e5){var _0x4a9644='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xccb3e5[_0x0f98('0x17')][_0x0f98('0x75')];return db[_0x0f98('0x76')]['query'](_0x4a9644,{'type':db[_0x0f98('0x77')][_0x0f98('0x78')][_0x0f98('0x79')],'raw':!![]})[_0x0f98('0x21')](function(_0x2dc92b){return _0x2dc92b;});})[_0x0f98('0x21')](function(_0x32139f){if(_0x32139f){_0x5c151e[_0x0f98('0x17')][_0x0f98('0x7a')]=_0x32139f[0x0];if(!_0x5a6cec[_0x0f98('0x44')][_0x0f98('0x6a')])return;return db[_0x0f98('0x7b')][_0x0f98('0x43')]({'where':{'id':_0x5a6cec[_0x0f98('0x44')]['UserId'],'role':'agent'},'attributes':['id',_0x0f98('0x24'),_0x0f98('0x7c'),_0x0f98('0x7d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4384d5){if(!_0x4384d5)return null;_0x5c151e[_0x0f98('0x17')][_0x0f98('0x6b')]=_0x4384d5;return _0x5c151e;})[_0x0f98('0x21')](function(_0x2dfad9){if(_0x2dfad9){if(_0x5a6cec[_0x0f98('0x44')][_0x0f98('0x7e')]){_0x5c151e[_0x0f98('0x17')][_0x0f98('0x7f')]=util['format']('SIP/%s',_0x5a6cec['user'][_0x0f98('0x24')]);_0x5c151e[_0x0f98('0x17')]['channel']=_0x5c151e[_0x0f98('0x80')];_0x5c151e[_0x0f98('0x17')][_0x0f98('0x81')]=_0x5c151e['channel'];_0x5c151e[_0x0f98('0x17')]['event']=_0x0f98('0x67');_0x5c151e[_0x0f98('0x17')][_0x0f98('0x44')]=htmlToText[_0x0f98('0x82')](_0x5c151e[_0x0f98('0x17')]['body']);return respondWithRpcPromise(_0x0f98('0x83'),_0x0f98('0x83'),{'event':_0x0f98('0x84'),'message':_0x5c151e[_0x0f98('0x17')]},client9002)[_0x0f98('0x21')](function(){return _0x5c151e;});}return _0x5c151e;}return null;})[_0x0f98('0x21')](respondWithResult(_0x1b9960,null))[_0x0f98('0x1a')](handleError(_0x1b9960,null));};exports[_0x0f98('0x85')]=function(_0x259191,_0x3c5072){var _0x32be04={'agent':{},'channel':_0x0f98('0x68')};if(_0x259191[_0x0f98('0x44')]['id']){delete _0x259191['body']['id'];}_0x259191[_0x0f98('0x44')][_0x0f98('0x6a')]=_0x259191[_0x0f98('0x44')][_0x0f98('0x6a')]||_0x259191[_0x0f98('0x5a')]['id'];_0x32be04['agent']['id']=_0x259191[_0x0f98('0x44')][_0x0f98('0x6a')];return db[_0x0f98('0x27')]['find']({'where':{'id':_0x259191[_0x0f98('0x41')]['id'],'UserId':null}})[_0x0f98('0x21')](handleEntityNotFound(_0x3c5072,null))[_0x0f98('0x21')](function(_0x1d1561){if(_0x1d1561){_0x32be04[_0x0f98('0x17')]=_0x1d1561['get']({'plain':!![]});return db['MailInteraction'][_0x0f98('0x43')]({'where':{'id':_0x1d1561[_0x0f98('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x3c5072,null))[_0x0f98('0x21')](function(_0x318bb8){if(_0x318bb8){_0x32be04[_0x0f98('0x72')]=_0x318bb8[_0x0f98('0x6f')]({'plain':!![]});interaction_log[_0x0f98('0x18')](_0x0f98('0x86'),_0x259191['user']['id'],_0x259191[_0x0f98('0x5a')]['name'],_0x259191['user'][_0x0f98('0x71')],_0x32be04[_0x0f98('0x72')]['id'],_0x259191[_0x0f98('0x44')]?JSON['stringify'](_0x259191[_0x0f98('0x44')]):_0x0f98('0x73'));return respondWithRpcPromise(_0x0f98('0x87'),'rejectMessage',_0x32be04);}return null;})[_0x0f98('0x21')](function(_0x150bcd){var _0x3a8831=_0x0f98('0x88')+_0x150bcd['message'][_0x0f98('0x75')];return db[_0x0f98('0x76')][_0x0f98('0x2c')](_0x3a8831,{'type':db[_0x0f98('0x77')][_0x0f98('0x78')][_0x0f98('0x79')],'raw':!![]})[_0x0f98('0x21')](function(_0x202b80){return _0x202b80;});})[_0x0f98('0x21')](function(_0x1c018b){if(_0x1c018b){_0x32be04[_0x0f98('0x17')][_0x0f98('0x7a')]=_0x1c018b[0x0];if(!_0x259191[_0x0f98('0x44')]['UserId'])return;return db[_0x0f98('0x7b')]['find']({'where':{'id':_0x259191[_0x0f98('0x44')][_0x0f98('0x6a')],'role':_0x0f98('0x6b')},'attributes':['id',_0x0f98('0x24'),'fullname',_0x0f98('0x7d'),'internal'],'raw':!![]});}return null;})[_0x0f98('0x21')](function(_0x544743){if(!_0x544743)return null;_0x32be04[_0x0f98('0x17')][_0x0f98('0x6b')]=_0x544743;return _0x32be04;})[_0x0f98('0x21')](function(_0x13974e){if(_0x13974e){_0x13974e['message']['interface']=util[_0x0f98('0x65')]('SIP/%s',_0x259191['user'][_0x0f98('0x24')]);_0x13974e[_0x0f98('0x17')]['channel']=_0x32be04[_0x0f98('0x80')];_0x13974e[_0x0f98('0x17')]['motionChannel']=_0x32be04[_0x0f98('0x80')];_0x13974e[_0x0f98('0x17')][_0x0f98('0x89')]=_0x0f98('0x85');_0x13974e['message'][_0x0f98('0x44')]=htmlToText['fromString'](_0x32be04['message'][_0x0f98('0x44')]);respondWithRpcPromise(_0x0f98('0x83'),'EventManager',{'event':_0x0f98('0x8a'),'message':_0x13974e[_0x0f98('0x17')]},client9002);return _0x32be04;}return null;})[_0x0f98('0x21')](respondWithResult(_0x3c5072,null))[_0x0f98('0x1a')](handleError(_0x3c5072,null));};exports[_0x0f98('0x8b')]=function(_0x1cb79b,_0x1427de){var _0xf9320f=moment()['unix']()[_0x0f98('0x8c')]();var _0x7560bc=path[_0x0f98('0x8d')](config[_0x0f98('0x8e')],_0x0f98('0x8f'),_0x0f98('0x90'),'tmp');var _0x4fa217=path[_0x0f98('0x8d')](config[_0x0f98('0x8e')],'server',_0x0f98('0x90'),_0x0f98('0x5c'));var _0x3f51cd=util[_0x0f98('0x65')](_0x0f98('0x91'),_0xf9320f);return db[_0x0f98('0x27')][_0x0f98('0x43')]({'where':{'id':_0x1cb79b[_0x0f98('0x41')]['id']},'attributes':['id','body','from','to','cc','bcc',_0x0f98('0x92'),_0x0f98('0x93')],'include':_0x1cb79b['query'][_0x0f98('0x5c')]?[{'model':db[_0x0f98('0x94')],'as':'Attachments'}]:undefined})[_0x0f98('0x21')](handleEntityNotFound(_0x1427de,null))[_0x0f98('0x21')](function(_0x1d9608){if(_0x1d9608){var _0x451289=_0x1d9608;var _0x33a2a2={'from':_0x451289['from'],'to':_0x451289['to'],'subject':_0x451289['subject'],'html':htmlEntities[_0x0f98('0x95')](_0x451289[_0x0f98('0x44')]),'headers':{'Date':moment(_0x451289[_0x0f98('0x93')])['format'](_0x0f98('0x96'))},'attachments':[]};if(_0x1d9608['cc']){_0x33a2a2[_0x0f98('0x97')]['Cc']=_0x1d9608['cc'];}if(_0x1d9608['bcc']){_0x33a2a2[_0x0f98('0x97')][_0x0f98('0x98')]=_0x1d9608[_0x0f98('0x99')];}return new BPromise(function(_0x3a01cc,_0x475e5b){if(_0x1d9608[_0x0f98('0x9a')]){for(var _0x1cc11c=0x0;_0x1cc11c<_0x1d9608[_0x0f98('0x9a')]['length'];_0x1cc11c++){var _0x60af8c=_0x1d9608['Attachments'][_0x1cc11c];var _0x4254bf=path['join'](_0x4fa217,_0x60af8c[_0x0f98('0x5d')]);if(fs['existsSync'](_0x4254bf)){_0x33a2a2['attachments']['push']({'name':_0x60af8c[_0x0f98('0x24')],'contentType':_0x60af8c[_0x0f98('0x2a')],'data':fs['readFileSync'](_0x4254bf)});}}}emlformat[_0x0f98('0x9b')](_0x33a2a2,function(_0x445efe,_0x2c54f6){if(_0x445efe)return _0x475e5b(_0x445efe);fs[_0x0f98('0x9c')](path[_0x0f98('0x8d')](_0x7560bc,_0x3f51cd),_0x2c54f6);return _0x3a01cc(_0x2c54f6);});});}})[_0x0f98('0x21')](function(_0x4c2536){if(_0x4c2536){return _0x1427de[_0x0f98('0x8b')](path['join'](_0x7560bc,_0x3f51cd),_0x3f51cd,function(_0xec826d){if(!_0xec826d)fs[_0x0f98('0x9d')](path[_0x0f98('0x8d')](_0x7560bc,_0x3f51cd));});}})[_0x0f98('0x1a')](handleError(_0x1427de,null));}; \ No newline at end of file +var _0x0eb0=['readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','event','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','findAll','show','includeAll','include','options','find','body','params','destroy','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read'];(function(_0x6202a4,_0x9faa90){var _0x568768=function(_0x2d6b1f){while(--_0x2d6b1f){_0x6202a4['push'](_0x6202a4['shift']());}};_0x568768(++_0x9faa90);}(_0x0eb0,0xea));var _0x00eb=function(_0x49bfd2,_0xcff9a9){_0x49bfd2=_0x49bfd2-0x0;var _0x5a2cc2=_0x0eb0[_0x49bfd2];return _0x5a2cc2;};'use strict';var emlformat=require(_0x00eb('0x0'));var moment=require(_0x00eb('0x1'));var BPromise=require(_0x00eb('0x2'));var util=require(_0x00eb('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x00eb('0x4'));var Redis=require(_0x00eb('0x5'));var htmlToText=require(_0x00eb('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x00eb('0x7'))(_0x00eb('0x8'));var interaction_log=require(_0x00eb('0x7'))(_0x00eb('0x9'));var config=require(_0x00eb('0xa'));var db=require(_0x00eb('0xb'))['db'];config[_0x00eb('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x00eb('0xd'))(new Redis(config[_0x00eb('0xc')]));var htmlEntities=require(_0x00eb('0xe'));require('./mailMessage.socket')[_0x00eb('0xf')](socket);var jayson=require(_0x00eb('0x10'));var client=jayson[_0x00eb('0x11')][_0x00eb('0x12')]({'port':0x232c});var client9003=jayson[_0x00eb('0x11')][_0x00eb('0x12')]({'port':0x232b});var client9002=jayson[_0x00eb('0x11')][_0x00eb('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x48e7fc,_0x2728ce,_0x536610,_0x551c29){return new BPromise(function(_0x4d49ca,_0x35bee7){var _0xe59b0d=_0x551c29||client;return _0xe59b0d['request'](_0x48e7fc,_0x536610)[_0x00eb('0x13')](function(_0x3c35ce){logger[_0x00eb('0x14')](_0x00eb('0x15'),_0x2728ce,_0x00eb('0x16'));logger[_0x00eb('0x17')](_0x00eb('0x18'),_0x2728ce,'request\x20sent',JSON['stringify'](_0x3c35ce));if(_0x3c35ce[_0x00eb('0x19')]){if(_0x3c35ce[_0x00eb('0x19')]['code']===0x1f4){logger[_0x00eb('0x19')](_0x00eb('0x15'),_0x2728ce,_0x3c35ce[_0x00eb('0x19')][_0x00eb('0x1a')]);return _0x35bee7(_0x3c35ce[_0x00eb('0x19')][_0x00eb('0x1a')]);}logger[_0x00eb('0x19')]('MailMessage,\x20%s,\x20%s',_0x2728ce,_0x3c35ce[_0x00eb('0x19')][_0x00eb('0x1a')]);return _0x4d49ca(_0x3c35ce[_0x00eb('0x19')]['message']);}else{logger[_0x00eb('0x14')](_0x00eb('0x15'),_0x2728ce,_0x00eb('0x16'));_0x4d49ca(_0x3c35ce[_0x00eb('0x1b')][_0x00eb('0x1a')]);}})[_0x00eb('0x1c')](function(_0xf4eee3){logger['error'](_0x00eb('0x15'),_0x2728ce,_0xf4eee3);_0x35bee7(_0xf4eee3);});});}function respondWithResult(_0x4c607b,_0x3d03c6){_0x3d03c6=_0x3d03c6||0xc8;return function(_0x13a72d){if(_0x13a72d){return _0x4c607b[_0x00eb('0x1d')](_0x3d03c6)[_0x00eb('0x1e')](_0x13a72d);}};}function respondWithFilteredResult(_0x18ee13,_0x12d5a3){return function(_0x5bdcc4){if(_0x5bdcc4){var _0x1e7e96=typeof _0x12d5a3['offset']===_0x00eb('0x1f')&&typeof _0x12d5a3[_0x00eb('0x20')]===_0x00eb('0x1f');var _0x30d951=_0x5bdcc4[_0x00eb('0x21')];var _0x568e94=_0x1e7e96?0x0:_0x12d5a3[_0x00eb('0x22')];var _0x18ffb4=_0x1e7e96?_0x5bdcc4[_0x00eb('0x21')]:_0x12d5a3['offset']+_0x12d5a3[_0x00eb('0x20')];var _0x290f15;if(_0x18ffb4>=_0x30d951){_0x18ffb4=_0x30d951;_0x290f15=0xc8;}else{_0x290f15=0xce;}_0x18ee13[_0x00eb('0x1d')](_0x290f15);return _0x18ee13[_0x00eb('0x23')](_0x00eb('0x24'),_0x568e94+'-'+_0x18ffb4+'/'+_0x30d951)['json'](_0x5bdcc4);}return null;};}function saveUpdates(_0x40d135){return function(_0x6cd473){if(_0x6cd473){return _0x6cd473[_0x00eb('0x25')](_0x40d135)[_0x00eb('0x13')](function(_0x287363){return _0x287363;});}return null;};}function removeEntity(_0x5ba1f6){return function(_0x40e983){if(_0x40e983){return _0x40e983['destroy']()[_0x00eb('0x13')](function(){_0x5ba1f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b7b0){return function(_0x33425d){if(!_0x33425d){_0x28b7b0[_0x00eb('0x26')](0x194);}return _0x33425d;};}function handleError(_0x183dee,_0x15b806){_0x15b806=_0x15b806||0x1f4;return function(_0x53a8f6){logger['error'](_0x53a8f6[_0x00eb('0x27')]);if(_0x53a8f6[_0x00eb('0x28')]){delete _0x53a8f6['name'];}_0x183dee[_0x00eb('0x1d')](_0x15b806)[_0x00eb('0x29')](_0x53a8f6);};}exports[_0x00eb('0x2a')]=function(_0x4be610,_0x45507c){var _0x30fdf3={},_0x17f6b3={},_0x351c74={'count':0x0,'rows':[]};var _0x424d33=_[_0x00eb('0x2b')](db[_0x00eb('0x2c')][_0x00eb('0x2d')],function(_0x15c9cd){return{'name':_0x15c9cd['fieldName'],'type':_0x15c9cd[_0x00eb('0x2e')][_0x00eb('0x2f')]};});_0x17f6b3[_0x00eb('0x30')]=_[_0x00eb('0x2b')](_0x424d33,_0x00eb('0x28'));_0x17f6b3[_0x00eb('0x31')]=_[_0x00eb('0x32')](_0x4be610[_0x00eb('0x31')]);_0x17f6b3[_0x00eb('0x33')]=_[_0x00eb('0x34')](_0x17f6b3['model'],_0x17f6b3[_0x00eb('0x31')]);_0x30fdf3[_0x00eb('0x35')]=_[_0x00eb('0x34')](_0x17f6b3['model'],qs[_0x00eb('0x36')](_0x4be610[_0x00eb('0x31')][_0x00eb('0x36')]));_0x30fdf3[_0x00eb('0x35')]=_0x30fdf3[_0x00eb('0x35')][_0x00eb('0x37')]?_0x30fdf3[_0x00eb('0x35')]:_0x17f6b3[_0x00eb('0x30')];if(!_0x4be610[_0x00eb('0x31')][_0x00eb('0x38')](_0x00eb('0x39'))){_0x30fdf3[_0x00eb('0x20')]=qs[_0x00eb('0x20')](_0x4be610[_0x00eb('0x31')][_0x00eb('0x20')]);_0x30fdf3[_0x00eb('0x22')]=qs['offset'](_0x4be610[_0x00eb('0x31')]['offset']);}_0x30fdf3['order']=qs['sort'](_0x4be610[_0x00eb('0x31')][_0x00eb('0x3a')]);_0x30fdf3['where']=qs[_0x00eb('0x33')](_['pick'](_0x4be610[_0x00eb('0x31')],_0x17f6b3[_0x00eb('0x33')]),_0x424d33);if(_0x4be610[_0x00eb('0x31')][_0x00eb('0x3b')]){_0x30fdf3['where']=_[_0x00eb('0x3c')](_0x30fdf3[_0x00eb('0x3d')],{'$or':_[_0x00eb('0x2b')](_0x424d33,function(_0x21732f){if(_0x21732f[_0x00eb('0x2e')]!==_0x00eb('0x3e')){var _0x36ec66={};_0x36ec66[_0x21732f['name']]={'$like':'%'+_0x4be610[_0x00eb('0x31')][_0x00eb('0x3b')]+'%'};return _0x36ec66;}})});}_0x30fdf3=_[_0x00eb('0x3c')]({},_0x30fdf3,_0x4be610['options']);var _0x3a360e={'where':_0x30fdf3[_0x00eb('0x3d')]};return db[_0x00eb('0x2c')][_0x00eb('0x21')](_0x3a360e)['then'](function(_0x3680b0){_0x351c74[_0x00eb('0x21')]=_0x3680b0;if(_0x4be610[_0x00eb('0x31')]['includeAll']){_0x30fdf3['include']=[{'all':!![]}];}return db[_0x00eb('0x2c')][_0x00eb('0x3f')](_0x30fdf3);})[_0x00eb('0x13')](function(_0xf9dd77){_0x351c74['rows']=_0xf9dd77;return _0x351c74;})[_0x00eb('0x13')](respondWithFilteredResult(_0x45507c,_0x30fdf3))[_0x00eb('0x1c')](handleError(_0x45507c,null));};exports[_0x00eb('0x40')]=function(_0xca688f,_0x1e66aa){var _0x27c710={'raw':!![],'where':{'id':_0xca688f['params']['id']}},_0x5978e5={};_0x5978e5[_0x00eb('0x30')]=_[_0x00eb('0x32')](db[_0x00eb('0x2c')][_0x00eb('0x2d')]);_0x5978e5[_0x00eb('0x31')]=_[_0x00eb('0x32')](_0xca688f[_0x00eb('0x31')]);_0x5978e5['filters']=_[_0x00eb('0x34')](_0x5978e5[_0x00eb('0x30')],_0x5978e5[_0x00eb('0x31')]);_0x27c710[_0x00eb('0x35')]=_[_0x00eb('0x34')](_0x5978e5[_0x00eb('0x30')],qs[_0x00eb('0x36')](_0xca688f['query'][_0x00eb('0x36')]));_0x27c710[_0x00eb('0x35')]=_0x27c710[_0x00eb('0x35')][_0x00eb('0x37')]?_0x27c710[_0x00eb('0x35')]:_0x5978e5[_0x00eb('0x30')];if(_0xca688f[_0x00eb('0x31')][_0x00eb('0x41')]){_0x27c710[_0x00eb('0x42')]=[{'all':!![]}];}_0x27c710=_['merge']({},_0x27c710,_0xca688f[_0x00eb('0x43')]);return db['MailMessage'][_0x00eb('0x44')](_0x27c710)[_0x00eb('0x13')](handleEntityNotFound(_0x1e66aa,null))[_0x00eb('0x13')](respondWithResult(_0x1e66aa,null))[_0x00eb('0x1c')](handleError(_0x1e66aa,null));};exports['update']=function(_0x4da3fe,_0x3b7f25){if(_0x4da3fe['body']['id']){delete _0x4da3fe[_0x00eb('0x45')]['id'];}return db[_0x00eb('0x2c')][_0x00eb('0x44')]({'where':{'id':_0x4da3fe[_0x00eb('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b7f25,null))[_0x00eb('0x13')](saveUpdates(_0x4da3fe[_0x00eb('0x45')],null))['then'](respondWithResult(_0x3b7f25,null))[_0x00eb('0x1c')](handleError(_0x3b7f25,null));};exports[_0x00eb('0x47')]=function(_0x2729ef,_0x27ef55){return db[_0x00eb('0x2c')][_0x00eb('0x44')]({'where':{'id':_0x2729ef['params']['id']}})[_0x00eb('0x13')](handleEntityNotFound(_0x27ef55,null))['then'](removeEntity(_0x27ef55,null))[_0x00eb('0x1c')](handleError(_0x27ef55,null));};exports['describe']=function(_0x271307,_0x26ebb5){return db['MailMessage'][_0x00eb('0x48')]()[_0x00eb('0x13')](respondWithResult(_0x26ebb5,null))[_0x00eb('0x1c')](handleError(_0x26ebb5,null));};exports[_0x00eb('0x49')]=function(_0x420da4,_0x129148){return db[_0x00eb('0x2c')][_0x00eb('0x49')](_0x420da4[_0x00eb('0x45')])[_0x00eb('0x13')](function(_0x6ae92d){if(_0x6ae92d){if(_0x6ae92d[_0x00eb('0x4a')]===_0x00eb('0x4b')&&!_0x6ae92d[_0x00eb('0x4c')]){var _0x2afa56,_0x2ef8ad,_0x250e78;if(_0x420da4[_0x00eb('0x45')]['to']){_0x2ef8ad=_0x420da4[_0x00eb('0x45')]['to'][_0x00eb('0x4d')](',')[0x0];}return db[_0x00eb('0x4e')]['findOne']({'where':{'id':_0x6ae92d[_0x00eb('0x4f')]},'include':[{'model':db[_0x00eb('0x50')],'as':_0x00eb('0x51'),'include':[{'model':db['CmContact'],'as':_0x00eb('0x52'),'where':{'email':_0x2ef8ad},'limit':0x1,'order':[[_0x00eb('0x53'),_0x00eb('0x54')]]}]},{'model':db[_0x00eb('0x55')],'as':_0x00eb('0x56'),'raw':!![]}]})['then'](function(_0x189b2e){_0x2afa56=_0x189b2e;if(_0x2afa56&&_0x2afa56['Smtp']){var _0x106d75={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2afa56[_0x00eb('0x56')]['service'])){_0x106d75[_0x00eb('0x57')]=_0x2afa56[_0x00eb('0x56')][_0x00eb('0x57')];_0x106d75[_0x00eb('0x58')]=_0x2afa56[_0x00eb('0x56')]['port'];_0x106d75[_0x00eb('0x59')]=_0x2afa56['Smtp'][_0x00eb('0x59')];if(_0x2afa56['Smtp'][_0x00eb('0x5a')]){_0x106d75[_0x00eb('0x5b')]={'user':_0x2afa56[_0x00eb('0x56')][_0x00eb('0x5c')],'pass':_0x2afa56[_0x00eb('0x56')][_0x00eb('0x5d')]};}}else{_0x106d75[_0x00eb('0x5e')]=_0x2afa56[_0x00eb('0x56')][_0x00eb('0x5e')];_0x106d75[_0x00eb('0x5b')]={'user':_0x2afa56['Smtp'][_0x00eb('0x5c')],'pass':_0x2afa56[_0x00eb('0x56')]['pass']};_0x106d75['secure']=_0x2afa56[_0x00eb('0x56')][_0x00eb('0x59')];}if(_0x420da4[_0x00eb('0x45')]['attachments']&&_0x420da4[_0x00eb('0x45')][_0x00eb('0x5f')]['length']){for(var _0x9a771b=0x0;_0x9a771b<_0x420da4['body'][_0x00eb('0x5f')][_0x00eb('0x37')];_0x9a771b+=0x1){_0x420da4[_0x00eb('0x45')][_0x00eb('0x5f')][_0x9a771b]={'filename':_0x420da4['body']['attachments'][_0x9a771b][_0x00eb('0x28')],'path':path[_0x00eb('0x60')](config[_0x00eb('0x61')],_0x00eb('0x62'),_0x420da4['body']['attachments'][_0x9a771b][_0x00eb('0x63')])};}}_0x250e78={'account':_0x106d75,'message':_0x420da4['body']};return;}})['then'](function(){if(_0x2afa56[_0x00eb('0x51')]){if(_0x2afa56[_0x00eb('0x51')][_0x00eb('0x52')][_0x00eb('0x37')]){return _0x2afa56[_0x00eb('0x51')][_0x00eb('0x52')][0x0];}else{return db[_0x00eb('0x64')][_0x00eb('0x49')](_['defaults'](_0x420da4[_0x00eb('0x45')],{'firstName':_0x420da4['body']['to'],'email':_0x420da4[_0x00eb('0x45')]['to'],'phone':_0x420da4['body']['to'],'ListId':_0x2afa56[_0x00eb('0x65')]}));}}else{throw new Error(_0x00eb('0x66'));}})[_0x00eb('0x13')](function(){if(_0x250e78){return respondWithRpcPromise(_0x00eb('0x67'),_0x00eb('0x68'),_0x250e78,client9003)[_0x00eb('0x13')](function(_0x268174){return _0x6ae92d['update']({'read':!![],'messageId':_0x268174[_0x00eb('0x69')],'sentAt':moment()['format'](_0x00eb('0x6a'))});})[_0x00eb('0x1c')](function(_0x489e68){logger[_0x00eb('0x19')]('%s',JSON['stringify'](_0x489e68));return _0x6ae92d;});}return _0x6ae92d;});}return _0x6ae92d;}})[_0x00eb('0x13')](respondWithResult(_0x129148,0xc9))['catch'](handleError(_0x129148,null));};exports[_0x00eb('0x6b')]=function(_0x147d31,_0x3d4f0f){var _0x1cf4f5={'agent':{},'channel':_0x00eb('0x6c')};if(_0x147d31[_0x00eb('0x45')]['id']){delete _0x147d31['body']['id'];}_0x147d31[_0x00eb('0x45')][_0x00eb('0x6d')]=!![];_0x147d31['body'][_0x00eb('0x6e')]=moment()['format'](_0x00eb('0x6a'));_0x147d31['body'][_0x00eb('0x6f')]=_0x147d31['body'][_0x00eb('0x6f')]||_0x147d31[_0x00eb('0x5c')]['id'];_0x1cf4f5[_0x00eb('0x70')]['id']=_0x147d31[_0x00eb('0x45')][_0x00eb('0x6f')];return db[_0x00eb('0x2c')][_0x00eb('0x44')]({'where':{'id':_0x147d31[_0x00eb('0x46')]['id'],'UserId':null}})[_0x00eb('0x13')](handleEntityNotFound(_0x3d4f0f,null))[_0x00eb('0x13')](saveUpdates(_0x147d31[_0x00eb('0x45')],null))[_0x00eb('0x13')](function(_0x29d1a9){if(_0x29d1a9){_0x1cf4f5[_0x00eb('0x1a')]=_0x29d1a9[_0x00eb('0x71')]({'plain':!![]});return db[_0x00eb('0x72')]['find']({'where':{'id':_0x29d1a9[_0x00eb('0x73')]}});}return null;})[_0x00eb('0x13')](handleEntityNotFound(_0x3d4f0f,null))[_0x00eb('0x13')](function(_0x14c361){if(_0x14c361){return _0x14c361[_0x00eb('0x25')]({'UserId':_0x147d31['body']['UserId'],'read1stAt':_[_0x00eb('0x74')](_0x14c361[_0x00eb('0x75')])?moment()['format'](_0x00eb('0x6a')):undefined});}return null;})[_0x00eb('0x13')](function(_0x23163f){if(_0x23163f){_0x1cf4f5[_0x00eb('0x76')]=_0x23163f[_0x00eb('0x71')]({'plain':!![]});interaction_log['info'](_0x00eb('0x77'),_0x147d31[_0x00eb('0x5c')]['id'],_0x147d31['user'][_0x00eb('0x28')],_0x147d31[_0x00eb('0x5c')][_0x00eb('0x78')],_0x1cf4f5[_0x00eb('0x76')]['id'],_0x147d31[_0x00eb('0x45')]?JSON[_0x00eb('0x79')](_0x147d31[_0x00eb('0x45')]):_0x00eb('0x7a'));return respondWithRpcPromise(_0x00eb('0x7b'),_0x00eb('0x7c'),_0x1cf4f5);}return null;})[_0x00eb('0x13')](function(_0x358b18){var _0x38f67a=_0x00eb('0x7d')+_0x358b18[_0x00eb('0x1a')][_0x00eb('0x7e')];return db[_0x00eb('0x7f')][_0x00eb('0x31')](_0x38f67a,{'type':db[_0x00eb('0x80')][_0x00eb('0x81')][_0x00eb('0x82')],'raw':!![]})[_0x00eb('0x13')](function(_0x21dd8a){return _0x21dd8a;});})[_0x00eb('0x13')](function(_0x40d17e){if(_0x40d17e){_0x1cf4f5[_0x00eb('0x1a')]['contact']=_0x40d17e[0x0];if(!_0x147d31[_0x00eb('0x45')]['UserId'])return;return db[_0x00eb('0x83')][_0x00eb('0x44')]({'where':{'id':_0x147d31[_0x00eb('0x45')]['UserId'],'role':_0x00eb('0x70')},'attributes':['id',_0x00eb('0x28'),_0x00eb('0x84'),_0x00eb('0x85'),_0x00eb('0x86')],'raw':!![]});}return null;})[_0x00eb('0x13')](function(_0x1c1489){if(!_0x1c1489)return null;_0x1cf4f5[_0x00eb('0x1a')]['agent']=_0x1c1489;return _0x1cf4f5;})[_0x00eb('0x13')](function(_0x4fef27){if(_0x4fef27){if(_0x147d31[_0x00eb('0x45')][_0x00eb('0x87')]){_0x1cf4f5[_0x00eb('0x1a')][_0x00eb('0x88')]=util[_0x00eb('0x89')](_0x00eb('0x8a'),_0x147d31[_0x00eb('0x5c')]['name']);_0x1cf4f5[_0x00eb('0x1a')][_0x00eb('0x8b')]=_0x1cf4f5[_0x00eb('0x8b')];_0x1cf4f5[_0x00eb('0x1a')][_0x00eb('0x8c')]=_0x1cf4f5[_0x00eb('0x8b')];_0x1cf4f5[_0x00eb('0x1a')]['event']=_0x00eb('0x6b');_0x1cf4f5[_0x00eb('0x1a')]['body']=htmlToText[_0x00eb('0x8d')](_0x1cf4f5['message']['body']);return respondWithRpcPromise(_0x00eb('0x8e'),'EventManager',{'event':'acceptmessage','message':_0x1cf4f5[_0x00eb('0x1a')]},client9002)['then'](function(){return _0x1cf4f5;});}return _0x1cf4f5;}return null;})['then'](respondWithResult(_0x3d4f0f,null))[_0x00eb('0x1c')](handleError(_0x3d4f0f,null));};exports[_0x00eb('0x8f')]=function(_0x1b8e1f,_0x929c14){var _0x3c89ef={'agent':{},'channel':'mail'};if(_0x1b8e1f[_0x00eb('0x45')]['id']){delete _0x1b8e1f['body']['id'];}_0x1b8e1f['body'][_0x00eb('0x6f')]=_0x1b8e1f[_0x00eb('0x45')][_0x00eb('0x6f')]||_0x1b8e1f[_0x00eb('0x5c')]['id'];_0x3c89ef[_0x00eb('0x70')]['id']=_0x1b8e1f[_0x00eb('0x45')][_0x00eb('0x6f')];return db[_0x00eb('0x2c')][_0x00eb('0x44')]({'where':{'id':_0x1b8e1f[_0x00eb('0x46')]['id'],'UserId':null}})[_0x00eb('0x13')](handleEntityNotFound(_0x929c14,null))[_0x00eb('0x13')](function(_0x5bbb8c){if(_0x5bbb8c){_0x3c89ef['message']=_0x5bbb8c[_0x00eb('0x71')]({'plain':!![]});return db[_0x00eb('0x72')][_0x00eb('0x44')]({'where':{'id':_0x5bbb8c['MailInteractionId']}});}return null;})[_0x00eb('0x13')](handleEntityNotFound(_0x929c14,null))[_0x00eb('0x13')](function(_0x3c35bc){if(_0x3c35bc){_0x3c89ef['interaction']=_0x3c35bc['get']({'plain':!![]});interaction_log[_0x00eb('0x14')](_0x00eb('0x90'),_0x1b8e1f[_0x00eb('0x5c')]['id'],_0x1b8e1f['user'][_0x00eb('0x28')],_0x1b8e1f[_0x00eb('0x5c')][_0x00eb('0x78')],_0x3c89ef[_0x00eb('0x76')]['id'],_0x1b8e1f[_0x00eb('0x45')]?JSON[_0x00eb('0x79')](_0x1b8e1f[_0x00eb('0x45')]):_0x00eb('0x7a'));return respondWithRpcPromise(_0x00eb('0x91'),_0x00eb('0x92'),_0x3c89ef);}return null;})[_0x00eb('0x13')](function(_0x546208){var _0x5be720=_0x00eb('0x7d')+_0x546208[_0x00eb('0x1a')][_0x00eb('0x7e')];return db[_0x00eb('0x7f')][_0x00eb('0x31')](_0x5be720,{'type':db['Sequelize'][_0x00eb('0x81')][_0x00eb('0x82')],'raw':!![]})[_0x00eb('0x13')](function(_0x5132c0){return _0x5132c0;});})['then'](function(_0xa4188c){if(_0xa4188c){_0x3c89ef[_0x00eb('0x1a')][_0x00eb('0x93')]=_0xa4188c[0x0];if(!_0x1b8e1f['body'][_0x00eb('0x6f')])return;return db[_0x00eb('0x83')]['find']({'where':{'id':_0x1b8e1f[_0x00eb('0x45')][_0x00eb('0x6f')],'role':_0x00eb('0x70')},'attributes':['id',_0x00eb('0x28'),_0x00eb('0x84'),'email',_0x00eb('0x86')],'raw':!![]});}return null;})[_0x00eb('0x13')](function(_0xbd4d2){if(!_0xbd4d2)return null;_0x3c89ef[_0x00eb('0x1a')]['agent']=_0xbd4d2;return _0x3c89ef;})[_0x00eb('0x13')](function(_0x11a106){if(_0x11a106){_0x11a106[_0x00eb('0x1a')][_0x00eb('0x88')]=util[_0x00eb('0x89')]('SIP/%s',_0x1b8e1f[_0x00eb('0x5c')][_0x00eb('0x28')]);_0x11a106[_0x00eb('0x1a')][_0x00eb('0x8b')]=_0x3c89ef[_0x00eb('0x8b')];_0x11a106[_0x00eb('0x1a')]['motionChannel']=_0x3c89ef[_0x00eb('0x8b')];_0x11a106['message'][_0x00eb('0x94')]='reject';_0x11a106[_0x00eb('0x1a')]['body']=htmlToText[_0x00eb('0x8d')](_0x3c89ef[_0x00eb('0x1a')]['body']);respondWithRpcPromise(_0x00eb('0x8e'),_0x00eb('0x8e'),{'event':'rejectmessage','message':_0x11a106[_0x00eb('0x1a')]},client9002);return _0x3c89ef;}return null;})[_0x00eb('0x13')](respondWithResult(_0x929c14,null))['catch'](handleError(_0x929c14,null));};exports[_0x00eb('0x95')]=function(_0x25dcf9,_0x2e00cd){var _0xd3ccda=moment()[_0x00eb('0x96')]()[_0x00eb('0x97')]();var _0x11a8ae=path[_0x00eb('0x60')](config[_0x00eb('0x61')],_0x00eb('0x98'),_0x00eb('0x99'),_0x00eb('0x9a'));var _0x4298f6=path[_0x00eb('0x60')](config[_0x00eb('0x61')],_0x00eb('0x98'),_0x00eb('0x99'),_0x00eb('0x5f'));var _0x4b5d71=util[_0x00eb('0x89')](_0x00eb('0x9b'),_0xd3ccda);return db['MailMessage'][_0x00eb('0x44')]({'where':{'id':_0x25dcf9['params']['id']},'attributes':['id',_0x00eb('0x45'),_0x00eb('0x9c'),'to','cc',_0x00eb('0x9d'),_0x00eb('0x9e'),_0x00eb('0x9f')],'include':_0x25dcf9['query'][_0x00eb('0x5f')]?[{'model':db[_0x00eb('0xa0')],'as':_0x00eb('0xa1')}]:undefined})[_0x00eb('0x13')](handleEntityNotFound(_0x2e00cd,null))[_0x00eb('0x13')](function(_0x6d067){if(_0x6d067){var _0x51d917=_0x6d067;var _0x4dd2d8={'from':_0x51d917[_0x00eb('0x9c')],'to':_0x51d917['to'],'subject':_0x51d917[_0x00eb('0x9e')],'html':htmlEntities[_0x00eb('0xa2')](_0x51d917['body']),'headers':{'Date':moment(_0x51d917[_0x00eb('0x9f')])['format'](_0x00eb('0xa3'))},'attachments':[]};if(_0x6d067['cc']){_0x4dd2d8[_0x00eb('0xa4')]['Cc']=_0x6d067['cc'];}if(_0x6d067[_0x00eb('0x9d')]){_0x4dd2d8[_0x00eb('0xa4')][_0x00eb('0xa5')]=_0x6d067[_0x00eb('0x9d')];}return new BPromise(function(_0x5b43f5,_0x3fc886){if(_0x6d067[_0x00eb('0xa1')]){for(var _0x28f1a6=0x0;_0x28f1a6<_0x6d067[_0x00eb('0xa1')][_0x00eb('0x37')];_0x28f1a6++){var _0x5dfb3f=_0x6d067[_0x00eb('0xa1')][_0x28f1a6];var _0x48c4ac=path[_0x00eb('0x60')](_0x4298f6,_0x5dfb3f[_0x00eb('0x63')]);if(fs[_0x00eb('0xa6')](_0x48c4ac)){_0x4dd2d8['attachments'][_0x00eb('0xa7')]({'name':_0x5dfb3f[_0x00eb('0x28')],'contentType':_0x5dfb3f[_0x00eb('0x2e')],'data':fs[_0x00eb('0xa8')](_0x48c4ac)});}}}emlformat[_0x00eb('0xa9')](_0x4dd2d8,function(_0x1ce9e1,_0x13374c){if(_0x1ce9e1)return _0x3fc886(_0x1ce9e1);fs[_0x00eb('0xaa')](path['join'](_0x11a8ae,_0x4b5d71),_0x13374c);return _0x5b43f5(_0x13374c);});});}})['then'](function(_0x3d719d){if(_0x3d719d){return _0x2e00cd[_0x00eb('0x95')](path[_0x00eb('0x60')](_0x11a8ae,_0x4b5d71),_0x4b5d71,function(_0x5636ee){if(!_0x5636ee)fs[_0x00eb('0xab')](path[_0x00eb('0x60')](_0x11a8ae,_0x4b5d71));});}})[_0x00eb('0x1c')](handleError(_0x2e00cd,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a4ff674..5c88d6b 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 _0x80d8=['hasOwnProperty','hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x402a92,_0x310512){var _0x39ead2=function(_0x1c7e7a){while(--_0x1c7e7a){_0x402a92['push'](_0x402a92['shift']());}};_0x39ead2(++_0x310512);}(_0x80d8,0x1a2));var _0x880d=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x80d8[_0x4c7935];return _0x30651d;};'use strict';var EventEmitter=require(_0x880d('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x880d('0x1')](0x0);var events={'afterCreate':_0x880d('0x2'),'afterUpdate':_0x880d('0x3'),'afterDestroy':_0x880d('0x4')};function emitEvent(_0x572eda){return function(_0x4e7259,_0x6e13fd,_0xe99695){MailMessageEvents[_0x880d('0x5')](_0x572eda+':'+_0x4e7259['id'],_0x4e7259);MailMessageEvents[_0x880d('0x5')](_0x572eda,_0x4e7259);_0xe99695(null);};}for(var e in events){if(events[_0x880d('0x6')](e)){var event=events[e];MailMessage[_0x880d('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x64f8=['emit','hasOwnProperty','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x86f969,_0x31562d){var _0x528de6=function(_0x39f024){while(--_0x39f024){_0x86f969['push'](_0x86f969['shift']());}};_0x528de6(++_0x31562d);}(_0x64f8,0xd2));var _0x864f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64f8[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x864f('0x0'));var MailMessage=require(_0x864f('0x1'))['db'][_0x864f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x864f('0x3')](0x0);var events={'afterCreate':_0x864f('0x4'),'afterUpdate':_0x864f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x245531){return function(_0x2ec13b,_0x2b6ebd,_0x23a793){MailMessageEvents[_0x864f('0x6')](_0x245531+':'+_0x2ec13b['id'],_0x2ec13b);MailMessageEvents[_0x864f('0x6')](_0x245531,_0x2ec13b);_0x23a793(null);};}for(var e in events){if(events[_0x864f('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b6b3bd3..d24bd08 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 _0x6425=['define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','out','secret','isNil','UserId','MailInteraction','then','update','createdAt','direction','catch','utf8mb4','lodash','util','../../config/logger','api','request-promise','html-to-text','../../config/environment','./mailMessage.attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6425,0xd1));var _0x5642=function(_0x49777a,_0x441c12){_0x49777a=_0x49777a-0x0;var _0x31a8ef=_0x6425[_0x49777a];return _0x31a8ef;};'use strict';var _=require(_0x5642('0x0'));var util=require(_0x5642('0x1'));var logger=require(_0x5642('0x2'))(_0x5642('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5642('0x4'));var htmlToText=require(_0x5642('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5642('0x6'));var attributes=require(_0x5642('0x7'));module['exports']=function(_0x4e0bdf,_0x15cf53){return _0x4e0bdf[_0x5642('0x8')](_0x5642('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5642('0xa')]},{'name':_0x5642('0xb'),'fields':[_0x5642('0xc'),_0x5642('0xd')],'type':_0x5642('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26eeb7,_0x489c55,_0x465624){if(_0x26eeb7[_0x5642('0xf')]){_0x26eeb7[_0x5642('0xc')]=htmlToText[_0x5642('0x10')](_0x26eeb7['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x465624(null,_0x489c55);},'afterCreate':function(_0x50e16,_0x1e22f4,_0x4df778){var _0x2a303c=_0x4e0bdf[_0x5642('0x11')];var _0x352aac=_0x50e16[_0x5642('0x12')]({'plain':!![]});if(_0x352aac['direction'][_0x5642('0x13')]()==='in'||_0x352aac['direction']['toLowerCase']()===_0x5642('0x14')&&!_0x352aac[_0x5642('0x15')]&&!_[_0x5642('0x16')](_0x352aac[_0x5642('0x17')])){_0x2a303c[_0x5642('0x18')]['findOne']({'where':{'id':_0x352aac['MailInteractionId']}})[_0x5642('0x19')](function(_0x4d3f68){if(_0x4d3f68){_0x4d3f68[_0x5642('0x1a')]({'lastMsgAt':_0x352aac[_0x5642('0x1b')],'lastMsgDirection':_0x352aac[_0x5642('0x1c')][_0x5642('0x13')]()});}})[_0x5642('0x1d')](function(_0x2f2c30){console['error'](_0x2f2c30);});}_0x4df778();}},'charset':_0x5642('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2d2c=['../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf'];(function(_0x236ebb,_0x21da6d){var _0x38a7fb=function(_0x669ef6){while(--_0x669ef6){_0x236ebb['push'](_0x236ebb['shift']());}};_0x38a7fb(++_0x21da6d);}(_0x2d2c,0xd5));var _0xc2d2=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0x2d2c[_0x3b0d98];return _0x296885;};'use strict';var _=require(_0xc2d2('0x0'));var util=require(_0xc2d2('0x1'));var logger=require(_0xc2d2('0x2'))(_0xc2d2('0x3'));var moment=require(_0xc2d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xc2d2('0x5'));var htmlToText=require(_0xc2d2('0x6'));var fs=require('fs');var path=require(_0xc2d2('0x7'));var rimraf=require(_0xc2d2('0x8'));var config=require(_0xc2d2('0x9'));var attributes=require('./mailMessage.attributes');module[_0xc2d2('0xa')]=function(_0x5b43e7,_0x427e7c){return _0x5b43e7[_0xc2d2('0xb')](_0xc2d2('0xc'),attributes,{'tableName':_0xc2d2('0xd'),'paranoid':![],'indexes':[{'name':_0xc2d2('0xe'),'fields':['messageId']},{'name':_0xc2d2('0xf'),'fields':[_0xc2d2('0x10'),'subject'],'type':_0xc2d2('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3aff92,_0x4e6236,_0x11b21e){if(_0x3aff92[_0xc2d2('0x12')]){_0x3aff92[_0xc2d2('0x10')]=htmlToText['fromString'](_0x3aff92[_0xc2d2('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x11b21e(null,_0x4e6236);},'afterCreate':function(_0x1bafaf,_0x54f2d5,_0x5b3702){var _0xdc187f=_0x5b43e7[_0xc2d2('0x13')];var _0x3e4c62=_0x1bafaf[_0xc2d2('0x14')]({'plain':!![]});if(_0x3e4c62[_0xc2d2('0x15')][_0xc2d2('0x16')]()==='in'||_0x3e4c62[_0xc2d2('0x15')]['toLowerCase']()===_0xc2d2('0x17')&&!_0x3e4c62[_0xc2d2('0x18')]&&!_[_0xc2d2('0x19')](_0x3e4c62[_0xc2d2('0x1a')])){_0xdc187f[_0xc2d2('0x1b')][_0xc2d2('0x1c')]({'where':{'id':_0x3e4c62[_0xc2d2('0x1d')]}})[_0xc2d2('0x1e')](function(_0x619c83){if(_0x619c83){_0x619c83[_0xc2d2('0x1f')]({'lastMsgAt':_0x3e4c62[_0xc2d2('0x20')],'lastMsgDirection':_0x3e4c62[_0xc2d2('0x15')][_0xc2d2('0x16')]()});}})[_0xc2d2('0x21')](function(_0x18be8b){console[_0xc2d2('0x22')](_0x18be8b);});}_0x5b3702();}},'charset':_0xc2d2('0x23'),'collate':_0xc2d2('0x24')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1540dc7..57746f7 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 _0x7334=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','create','body','options','raw','CreateMailMessage','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x472883,_0x383700){var _0x368226=function(_0x1eaa39){while(--_0x1eaa39){_0x472883['push'](_0x472883['shift']());}};_0x368226(++_0x383700);}(_0x7334,0x184));var _0x4733=function(_0x12c240,_0x391086){_0x12c240=_0x12c240-0x0;var _0x5e1780=_0x7334[_0x12c240];return _0x5e1780;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});config[_0x4733('0xb')]=_[_0x4733('0xc')](config[_0x4733('0xb')],{'host':_0x4733('0xd'),'port':0x18eb});var socket=require(_0x4733('0xe'))(new Redis(config[_0x4733('0xb')]));require(_0x4733('0xf'))[_0x4733('0x10')](socket);function respondWithRpcPromise(_0x1bc511,_0x2bafad,_0x49032d){return new BPromise(function(_0x42b97f,_0x1e6fcf){return client['request'](_0x1bc511,_0x49032d)[_0x4733('0x11')](function(_0x5240a4){logger[_0x4733('0x12')](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));logger[_0x4733('0x15')](_0x4733('0x16'),_0x2bafad,_0x4733('0x14'),JSON[_0x4733('0x17')](_0x5240a4));if(_0x5240a4['error']){if(_0x5240a4[_0x4733('0x18')]['code']===0x1f4){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);return _0x1e6fcf(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')]['message']);return _0x42b97f(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}else{logger['info'](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));_0x42b97f(_0x5240a4[_0x4733('0x1a')][_0x4733('0x19')]);}})['catch'](function(_0x517fbc){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x517fbc);_0x1e6fcf(_0x517fbc);});});}exports['CreateMailMessage']=function(_0x32f166){var _0x1943bc=this;return new Promise(function(_0x15339c,_0x7a4e0){return db['MailMessage'][_0x4733('0x1b')](_0x32f166[_0x4733('0x1c')],{'raw':_0x32f166['options']?_0x32f166[_0x4733('0x1d')][_0x4733('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x15a291){logger[_0x4733('0x12')](_0x4733('0x1f'),_0x32f166);logger[_0x4733('0x15')](_0x4733('0x1f'),_0x32f166,JSON[_0x4733('0x17')](_0x15a291));_0x15339c(_0x15a291);})[_0x4733('0x20')](function(_0x2bb78f){logger['error'](_0x4733('0x1f'),_0x2bb78f[_0x4733('0x19')],_0x32f166);_0x7a4e0(_0x1943bc[_0x4733('0x18')](0x1f4,_0x2bb78f[_0x4733('0x19')]));});});}; \ No newline at end of file +var _0x6d11=['options','raw','CreateMailMessage','debug','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage','create','body'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x6d11,0xbf));var _0x16d1=function(_0x45aa47,_0x52b536){_0x45aa47=_0x45aa47-0x0;var _0x4ec96a=_0x6d11[_0x45aa47];return _0x4ec96a;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});config[_0x16d1('0xa')]=_[_0x16d1('0xb')](config[_0x16d1('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x16d1('0xc'))[_0x16d1('0xd')](socket);function respondWithRpcPromise(_0xe67758,_0x5a6abb,_0x4b7d4f){return new BPromise(function(_0x265a84,_0x2c360f){return client[_0x16d1('0xe')](_0xe67758,_0x4b7d4f)[_0x16d1('0xf')](function(_0x28188f){logger[_0x16d1('0x10')](_0x16d1('0x11'),_0x5a6abb,_0x16d1('0x12'));logger['debug'](_0x16d1('0x13'),_0x5a6abb,_0x16d1('0x12'),JSON[_0x16d1('0x14')](_0x28188f));if(_0x28188f[_0x16d1('0x15')]){if(_0x28188f[_0x16d1('0x15')]['code']===0x1f4){logger[_0x16d1('0x15')](_0x16d1('0x11'),_0x5a6abb,_0x28188f[_0x16d1('0x15')][_0x16d1('0x16')]);return _0x2c360f(_0x28188f[_0x16d1('0x15')][_0x16d1('0x16')]);}logger[_0x16d1('0x15')]('MailMessage,\x20%s,\x20%s',_0x5a6abb,_0x28188f[_0x16d1('0x15')][_0x16d1('0x16')]);return _0x265a84(_0x28188f['error']['message']);}else{logger[_0x16d1('0x10')]('MailMessage,\x20%s,\x20%s',_0x5a6abb,_0x16d1('0x12'));_0x265a84(_0x28188f['result'][_0x16d1('0x16')]);}})['catch'](function(_0x30f694){logger[_0x16d1('0x15')]('MailMessage,\x20%s,\x20%s',_0x5a6abb,_0x30f694);_0x2c360f(_0x30f694);});});}exports['CreateMailMessage']=function(_0x52a0f2){var _0x5b9599=this;return new Promise(function(_0x348425,_0x55a0e0){return db[_0x16d1('0x17')][_0x16d1('0x18')](_0x52a0f2[_0x16d1('0x19')],{'raw':_0x52a0f2[_0x16d1('0x1a')]?_0x52a0f2['options'][_0x16d1('0x1b')]===undefined?!![]:![]:!![]})[_0x16d1('0xf')](function(_0x2a897d){logger['info'](_0x16d1('0x1c'),_0x52a0f2);logger[_0x16d1('0x1d')](_0x16d1('0x1c'),_0x52a0f2,JSON[_0x16d1('0x14')](_0x2a897d));_0x348425(_0x2a897d);})[_0x16d1('0x1e')](function(_0x1448b7){logger[_0x16d1('0x15')](_0x16d1('0x1c'),_0x1448b7[_0x16d1('0x16')],_0x52a0f2);_0x55a0e0(_0x5b9599[_0x16d1('0x15')](0x1f4,_0x1448b7[_0x16d1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9fdb89a..fd96c0d 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 _0x4ddf=['save','remove','update','removeListener','length','./mailMessage.events'];(function(_0x56b204,_0x39aa41){var _0x2a6bc4=function(_0x27b90f){while(--_0x27b90f){_0x56b204['push'](_0x56b204['shift']());}};_0x2a6bc4(++_0x39aa41);}(_0x4ddf,0x1f1));var _0xf4dd=function(_0x22d2db,_0x9286ce){_0x22d2db=_0x22d2db-0x0;var _0x2b2466=_0x4ddf[_0x22d2db];return _0x2b2466;};'use strict';var MailMessageEvents=require(_0xf4dd('0x0'));var events=[_0xf4dd('0x1'),_0xf4dd('0x2'),_0xf4dd('0x3')];function createListener(_0x37fb50,_0xa3b52e){return function(_0x42a337){_0xa3b52e['emit'](_0x37fb50,_0x42a337);};}function removeListener(_0x15900e,_0x244964){return function(){MailMessageEvents[_0xf4dd('0x4')](_0x15900e,_0x244964);};}exports['register']=function(_0x20921c){for(var _0x9e2725=0x0,_0x111c81=events[_0xf4dd('0x5')];_0x9e2725<_0x111c81;_0x9e2725++){var _0x3475c4=events[_0x9e2725];var _0x13328d=createListener('mailMessage:'+_0x3475c4,_0x20921c);MailMessageEvents['on'](_0x3475c4,_0x13328d);}}; \ No newline at end of file +var _0x4731=['removeListener','register','length','./mailMessage.events','save','remove','update'];(function(_0x3e3f27,_0x2c2ecf){var _0x15c868=function(_0x4b348d){while(--_0x4b348d){_0x3e3f27['push'](_0x3e3f27['shift']());}};_0x15c868(++_0x2c2ecf);}(_0x4731,0xce));var _0x1473=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x4731[_0x1477ef];return _0x164acd;};'use strict';var MailMessageEvents=require(_0x1473('0x0'));var events=[_0x1473('0x1'),_0x1473('0x2'),_0x1473('0x3')];function createListener(_0x300551,_0x4d6703){return function(_0x1b0c96){_0x4d6703['emit'](_0x300551,_0x1b0c96);};}function removeListener(_0x4f1546,_0x1397d7){return function(){MailMessageEvents[_0x1473('0x4')](_0x4f1546,_0x1397d7);};}exports[_0x1473('0x5')]=function(_0x5e609a){for(var _0x169ee1=0x0,_0x2c210a=events[_0x1473('0x6')];_0x169ee1<_0x2c210a;_0x169ee1++){var _0x6f4474=events[_0x169ee1];var _0x332abb=createListener('mailMessage:'+_0x6f4474,_0x5e609a);MailMessageEvents['on'](_0x6f4474,_0x332abb);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5cd5259..46fecc2 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 _0x6c46=['index','get','/describe','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','isAuthenticated'];(function(_0x4031e5,_0x5d9cd0){var _0x25b248=function(_0x3f0d9a){while(--_0x3f0d9a){_0x4031e5['push'](_0x4031e5['shift']());}};_0x25b248(++_0x5d9cd0);}(_0x6c46,0x65));var _0x66c4=function(_0x7e4726,_0x1a7d45){_0x7e4726=_0x7e4726-0x0;var _0xf9217d=_0x6c46[_0x7e4726];return _0xf9217d;};'use strict';var multer=require(_0x66c4('0x0'));var util=require(_0x66c4('0x1'));var path=require(_0x66c4('0x2'));var timeout=require(_0x66c4('0x3'));var express=require(_0x66c4('0x4'));var router=express[_0x66c4('0x5')]();var fs_extra=require(_0x66c4('0x6'));var auth=require(_0x66c4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x66c4('0x8'));var controller=require(_0x66c4('0x9'));router['get']('/',auth[_0x66c4('0xa')](),controller[_0x66c4('0xb')]);router[_0x66c4('0xc')](_0x66c4('0xd'),auth[_0x66c4('0xa')](),controller['describe']);router[_0x66c4('0xc')]('/:id',auth[_0x66c4('0xa')](),controller['show']);router[_0x66c4('0xc')](_0x66c4('0xe'),auth[_0x66c4('0xa')](),controller['getMembers']);router[_0x66c4('0xc')]('/:id/teams',auth[_0x66c4('0xa')](),controller['getTeams']);router[_0x66c4('0xc')](_0x66c4('0xf'),auth['isAuthenticated'](),controller[_0x66c4('0x10')]);router[_0x66c4('0x11')]('/',auth['isAuthenticated'](),controller[_0x66c4('0x12')]);router[_0x66c4('0x11')](_0x66c4('0x13'),auth['isAuthenticated'](),controller[_0x66c4('0x14')]);router[_0x66c4('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x66c4('0x15')]);router['put']('/:id',auth[_0x66c4('0xa')](),controller['update']);router[_0x66c4('0x16')](_0x66c4('0x17'),auth['isAuthenticated'](),controller[_0x66c4('0x18')]);router[_0x66c4('0x16')](_0x66c4('0x13'),auth[_0x66c4('0xa')](),controller[_0x66c4('0x19')]);router['delete'](_0x66c4('0xf'),auth[_0x66c4('0xa')](),controller[_0x66c4('0x1a')]);module[_0x66c4('0x1b')]=router; \ No newline at end of file +var _0xc143=['/:id/users','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','index','/describe','describe','isAuthenticated','show','/:id/members','getMembers','get','getTeams','getAgents','post','addTeams'];(function(_0xe574c7,_0x2e5a2d){var _0x59d1db=function(_0x710b09){while(--_0x710b09){_0xe574c7['push'](_0xe574c7['shift']());}};_0x59d1db(++_0x2e5a2d);}(_0xc143,0x1ea));var _0x3c14=function(_0x3d722d,_0x157e44){_0x3d722d=_0x3d722d-0x0;var _0x4b3365=_0xc143[_0x3d722d];return _0x4b3365;};'use strict';var multer=require(_0x3c14('0x0'));var util=require('util');var path=require(_0x3c14('0x1'));var timeout=require(_0x3c14('0x2'));var express=require('express');var router=express[_0x3c14('0x3')]();var fs_extra=require(_0x3c14('0x4'));var auth=require(_0x3c14('0x5'));var interaction=require(_0x3c14('0x6'));var config=require('../../config/environment');var controller=require(_0x3c14('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3c14('0x8')]);router['get'](_0x3c14('0x9'),auth['isAuthenticated'](),controller[_0x3c14('0xa')]);router['get']('/:id',auth[_0x3c14('0xb')](),controller[_0x3c14('0xc')]);router['get'](_0x3c14('0xd'),auth[_0x3c14('0xb')](),controller[_0x3c14('0xe')]);router[_0x3c14('0xf')]('/:id/teams',auth[_0x3c14('0xb')](),controller[_0x3c14('0x10')]);router[_0x3c14('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x3c14('0x11')]);router[_0x3c14('0x12')]('/',auth[_0x3c14('0xb')](),controller['create']);router[_0x3c14('0x12')]('/:id/teams',auth[_0x3c14('0xb')](),controller[_0x3c14('0x13')]);router['post'](_0x3c14('0x14'),auth[_0x3c14('0xb')](),controller[_0x3c14('0x15')]);router[_0x3c14('0x16')](_0x3c14('0x17'),auth[_0x3c14('0xb')](),controller['update']);router[_0x3c14('0x18')](_0x3c14('0x17'),auth['isAuthenticated'](),controller[_0x3c14('0x19')]);router[_0x3c14('0x18')](_0x3c14('0x1a'),auth[_0x3c14('0xb')](),controller[_0x3c14('0x1b')]);router['delete'](_0x3c14('0x14'),auth[_0x3c14('0xb')](),controller[_0x3c14('0x1c')]);module[_0x3c14('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1332e04..99c7018 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 _0x54e0=['INTEGER','rrmemory','roundrobin','exports','STRING'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x54e0,0x125));var _0x054e=function(_0x1fc468,_0x283269){_0x1fc468=_0x1fc468-0x0;var _0x596a68=_0x54e0[_0x1fc468];return _0x596a68;};'use strict';var Sequelize=require('sequelize');module[_0x054e('0x0')]={'name':{'type':Sequelize[_0x054e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x054e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x054e('0x3'),'beepall',_0x054e('0x4'))}}; \ No newline at end of file +var _0x8abb=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x1461ec,_0x68a535){var _0x1c822d=function(_0x34fdc0){while(--_0x34fdc0){_0x1461ec['push'](_0x1461ec['shift']());}};_0x1c822d(++_0x68a535);}(_0x8abb,0x1ca));var _0xb8ab=function(_0x5bcbc7,_0x22253e){_0x5bcbc7=_0x5bcbc7-0x0;var _0x18c65b=_0x8abb[_0x5bcbc7];return _0x18c65b;};'use strict';var Sequelize=require('sequelize');module[_0xb8ab('0x0')]={'name':{'type':Sequelize[_0xb8ab('0x1')],'unique':_0xb8ab('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb8ab('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb8ab('0x4')](_0xb8ab('0x5'),_0xb8ab('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f65f61b..c37d0cd 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 _0x8529=['sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','MailQueue','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','include','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserMailQueue','nolimit','pick','MailQueueId','findAll','User','UserId','mailPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','union','compact','value','removeAgents','userMailQueue:remove','addAgents','spread','emit','isArray','getAgents','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register'];(function(_0xb1b616,_0x3b9023){var _0x1259b0=function(_0xb2e638){while(--_0xb2e638){_0xb1b616['push'](_0xb1b616['shift']());}};_0x1259b0(++_0x3b9023);}(_0x8529,0x73));var _0x9852=function(_0xb164d8,_0x59e110){_0xb164d8=_0xb164d8-0x0;var _0x1bebdd=_0x8529[_0xb164d8];return _0x1bebdd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9852('0x0'));var jsonpatch=require(_0x9852('0x1'));var rp=require(_0x9852('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9852('0x3'));var util=require(_0x9852('0x4'));var path=require(_0x9852('0x5'));var sox=require(_0x9852('0x6'));var csv=require(_0x9852('0x7'));var ejs=require(_0x9852('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9852('0x9'));var crypto=require(_0x9852('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9852('0x7'));var querystring=require(_0x9852('0xb'));var Papa=require('papaparse');var Redis=require(_0x9852('0xc'));var authService=require(_0x9852('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9852('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9852('0xf'))(_0x9852('0x10'));var utils=require(_0x9852('0x11'));var config=require(_0x9852('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9852('0x13'))['db'];config[_0x9852('0x14')]=_['defaults'](config[_0x9852('0x14')],{'host':_0x9852('0x15'),'port':0x18eb});var socket=require(_0x9852('0x16'))(new Redis(config[_0x9852('0x14')]));require(_0x9852('0x17'))[_0x9852('0x18')](socket);function respondWithStatusCode(_0x4f6ba9,_0x3d323c){_0x3d323c=_0x3d323c||0xcc;return function(_0x41cf99){if(_0x41cf99){return _0x4f6ba9[_0x9852('0x19')](_0x3d323c);}return _0x4f6ba9['status'](_0x3d323c)[_0x9852('0x1a')]();};}function respondWithResult(_0x1b69c7,_0x374c46){_0x374c46=_0x374c46||0xc8;return function(_0x41fa56){if(_0x41fa56){return _0x1b69c7[_0x9852('0x1b')](_0x374c46)[_0x9852('0x1c')](_0x41fa56);}};}function respondWithFilteredResult(_0x226332,_0x53a387){return function(_0x31d989){if(_0x31d989){var _0x4d6607=typeof _0x53a387[_0x9852('0x1d')]===_0x9852('0x1e')&&typeof _0x53a387[_0x9852('0x1f')]===_0x9852('0x1e');var _0x47e9d0=_0x31d989[_0x9852('0x20')];var _0x309ac8=_0x4d6607?0x0:_0x53a387[_0x9852('0x1d')];var _0x37d6aa=_0x4d6607?_0x31d989[_0x9852('0x20')]:_0x53a387[_0x9852('0x1d')]+_0x53a387['limit'];var _0x1a73fa;if(_0x37d6aa>=_0x47e9d0){_0x37d6aa=_0x47e9d0;_0x1a73fa=0xc8;}else{_0x1a73fa=0xce;}_0x226332[_0x9852('0x1b')](_0x1a73fa);return _0x226332['set'](_0x9852('0x21'),_0x309ac8+'-'+_0x37d6aa+'/'+_0x47e9d0)['json'](_0x31d989);}return null;};}function patchUpdates(_0x5ba442){return function(_0x4151eb){try{jsonpatch[_0x9852('0x22')](_0x4151eb,_0x5ba442,!![]);}catch(_0x44af63){return BPromise[_0x9852('0x23')](_0x44af63);}return _0x4151eb[_0x9852('0x24')]();};}function saveUpdates(_0x2f4062,_0x1ccce3){return function(_0x25d36e){if(_0x25d36e){return _0x25d36e[_0x9852('0x25')](_0x2f4062)[_0x9852('0x26')](function(_0x19f8a5){return _0x19f8a5;});}return null;};}function removeEntity(_0x52be5e,_0x4aca57){return function(_0x184bd2){if(_0x184bd2){return _0x184bd2[_0x9852('0x27')]()['then'](function(){var _0x2c36e8=_0x184bd2['get']({'plain':!![]});var _0x3f85b6=_0x9852('0x28');return db[_0x9852('0x29')][_0x9852('0x27')]({'where':{'type':_0x3f85b6,'resourceId':_0x2c36e8['id']}})[_0x9852('0x26')](function(){return _0x184bd2;});})[_0x9852('0x26')](function(){_0x52be5e[_0x9852('0x1b')](0xcc)[_0x9852('0x1a')]();});}};}function handleEntityNotFound(_0x4e1660,_0x2c78c0){return function(_0x5b1288){if(!_0x5b1288){_0x4e1660[_0x9852('0x19')](0x194);}return _0x5b1288;};}function handleError(_0x320868,_0x466181){_0x466181=_0x466181||0x1f4;return function(_0x586548){logger[_0x9852('0x2a')](_0x586548[_0x9852('0x2b')]);if(_0x586548['name']){delete _0x586548[_0x9852('0x2c')];}_0x320868[_0x9852('0x1b')](_0x466181)[_0x9852('0x2d')](_0x586548);};}exports['index']=function(_0x270696,_0x2bb86a){var _0x12b72d={},_0x53c70c={},_0xdae9={'count':0x0,'rows':[]};var _0x4edbd0=_['map'](db[_0x9852('0x2e')]['rawAttributes'],function(_0x462bdd){return{'name':_0x462bdd[_0x9852('0x2f')],'type':_0x462bdd[_0x9852('0x30')][_0x9852('0x31')]};});_0x53c70c[_0x9852('0x32')]=_[_0x9852('0x33')](_0x4edbd0,_0x9852('0x2c'));_0x53c70c[_0x9852('0x34')]=_[_0x9852('0x35')](_0x270696[_0x9852('0x34')]);_0x53c70c[_0x9852('0x36')]=_[_0x9852('0x37')](_0x53c70c[_0x9852('0x32')],_0x53c70c['query']);_0x12b72d[_0x9852('0x38')]=_[_0x9852('0x37')](_0x53c70c[_0x9852('0x32')],qs[_0x9852('0x39')](_0x270696[_0x9852('0x34')]['fields']));_0x12b72d[_0x9852('0x38')]=_0x12b72d['attributes'][_0x9852('0x3a')]?_0x12b72d[_0x9852('0x38')]:_0x53c70c[_0x9852('0x32')];if(!_0x270696['query'][_0x9852('0x3b')]('nolimit')){_0x12b72d[_0x9852('0x1f')]=qs[_0x9852('0x1f')](_0x270696[_0x9852('0x34')]['limit']);_0x12b72d[_0x9852('0x1d')]=qs[_0x9852('0x1d')](_0x270696[_0x9852('0x34')]['offset']);}_0x12b72d[_0x9852('0x3c')]=qs[_0x9852('0x3d')](_0x270696[_0x9852('0x34')][_0x9852('0x3d')]);_0x12b72d['where']=qs[_0x9852('0x36')](_['pick'](_0x270696[_0x9852('0x34')],_0x53c70c[_0x9852('0x36')]),_0x4edbd0);if(_0x270696[_0x9852('0x34')][_0x9852('0x3e')]){_0x12b72d[_0x9852('0x3f')]=_[_0x9852('0x40')](_0x12b72d[_0x9852('0x3f')],{'$or':_[_0x9852('0x33')](_0x4edbd0,function(_0x143e08){if(_0x143e08[_0x9852('0x30')]!==_0x9852('0x41')){var _0x3a36a8={};_0x3a36a8[_0x143e08[_0x9852('0x2c')]]={'$like':'%'+_0x270696['query'][_0x9852('0x3e')]+'%'};return _0x3a36a8;}})});}_0x12b72d=_[_0x9852('0x40')]({},_0x12b72d,_0x270696['options']);var _0x1d49f5={'where':_0x12b72d[_0x9852('0x3f')]};return db[_0x9852('0x2e')]['count'](_0x1d49f5)[_0x9852('0x26')](function(_0x51575d){_0xdae9[_0x9852('0x20')]=_0x51575d;if(_0x270696[_0x9852('0x34')][_0x9852('0x42')]){_0x12b72d['include']=[{'all':!![]}];}return db[_0x9852('0x2e')]['findAll'](_0x12b72d);})[_0x9852('0x26')](function(_0x20f028){_0xdae9['rows']=_0x20f028;return _0xdae9;})[_0x9852('0x26')](respondWithFilteredResult(_0x2bb86a,_0x12b72d))[_0x9852('0x43')](handleError(_0x2bb86a,null));};exports[_0x9852('0x44')]=function(_0x4fa3f6,_0x2c60ec){var _0x321f6d={'raw':!![],'where':{'id':_0x4fa3f6[_0x9852('0x45')]['id']}},_0x560cb2={};_0x560cb2[_0x9852('0x32')]=_[_0x9852('0x35')](db[_0x9852('0x2e')][_0x9852('0x46')]);_0x560cb2[_0x9852('0x34')]=_['keys'](_0x4fa3f6['query']);_0x560cb2[_0x9852('0x36')]=_['intersection'](_0x560cb2['model'],_0x560cb2[_0x9852('0x34')]);_0x321f6d[_0x9852('0x38')]=_[_0x9852('0x37')](_0x560cb2[_0x9852('0x32')],qs[_0x9852('0x39')](_0x4fa3f6[_0x9852('0x34')]['fields']));_0x321f6d['attributes']=_0x321f6d[_0x9852('0x38')][_0x9852('0x3a')]?_0x321f6d[_0x9852('0x38')]:_0x560cb2[_0x9852('0x32')];if(_0x4fa3f6['query'][_0x9852('0x42')]){_0x321f6d[_0x9852('0x47')]=[{'all':!![]}];}_0x321f6d=_[_0x9852('0x40')]({},_0x321f6d,_0x4fa3f6[_0x9852('0x48')]);return db['MailQueue']['find'](_0x321f6d)[_0x9852('0x26')](handleEntityNotFound(_0x2c60ec,null))['then'](respondWithResult(_0x2c60ec,null))[_0x9852('0x43')](handleError(_0x2c60ec,null));};exports['create']=function(_0x2796c6,_0x2caabc){return db[_0x9852('0x2e')][_0x9852('0x49')](_0x2796c6['body'],{})['then'](function(_0x54ac22){var _0x102b19=_0x2796c6[_0x9852('0x4a')][_0x9852('0x4b')]({'plain':!![]});if(!_0x102b19)throw new Error(_0x9852('0x4c'));if(_0x102b19[_0x9852('0x4d')]===_0x9852('0x4a')){var _0x508105=_0x54ac22['get']({'plain':!![]});var _0x30152e='MailQueues';return db[_0x9852('0x4e')][_0x9852('0x4f')]({'where':{'name':_0x30152e,'userProfileId':_0x102b19[_0x9852('0x50')]},'raw':!![]})[_0x9852('0x26')](function(_0x18f431){if(_0x18f431&&_0x18f431[_0x9852('0x51')]===0x0){return db[_0x9852('0x29')]['create']({'name':_0x508105[_0x9852('0x2c')],'resourceId':_0x508105['id'],'type':_0x18f431[_0x9852('0x2c')],'sectionId':_0x18f431['id']},{})[_0x9852('0x26')](function(){return _0x54ac22;});}else{return _0x54ac22;}})['catch'](function(_0xc0daff){logger[_0x9852('0x2a')](_0x9852('0x52'),_0xc0daff);throw _0xc0daff;});}return _0x54ac22;})[_0x9852('0x26')](respondWithResult(_0x2caabc,0xc9))['catch'](handleError(_0x2caabc,null));};exports['update']=function(_0x561357,_0x4dc57b){if(_0x561357['body']['id']){delete _0x561357['body']['id'];}return db[_0x9852('0x2e')]['find']({'where':{'id':_0x561357['params']['id']}})[_0x9852('0x26')](handleEntityNotFound(_0x4dc57b,null))[_0x9852('0x26')](saveUpdates(_0x561357[_0x9852('0x53')],null))['then'](respondWithResult(_0x4dc57b,null))[_0x9852('0x43')](handleError(_0x4dc57b,null));};exports[_0x9852('0x27')]=function(_0x12bddb,_0x45ff3a){return db['MailQueue'][_0x9852('0x4f')]({'where':{'id':_0x12bddb[_0x9852('0x45')]['id']}})[_0x9852('0x26')](handleEntityNotFound(_0x45ff3a,null))[_0x9852('0x26')](removeEntity(_0x45ff3a,null))[_0x9852('0x43')](handleError(_0x45ff3a,null));};exports[_0x9852('0x54')]=function(_0x139cdd,_0x25263e){return db[_0x9852('0x2e')][_0x9852('0x54')]()['then'](respondWithResult(_0x25263e,null))[_0x9852('0x43')](handleError(_0x25263e,null));};exports['getMembers']=function(_0xc379b5,_0x41d1aa,_0x349691){var _0x5b3b52={'raw':!![],'where':{}},_0x195d10={},_0x548207;return db[_0x9852('0x2e')][_0x9852('0x55')]({'where':{'id':_0xc379b5[_0x9852('0x45')]['id']}})[_0x9852('0x26')](handleEntityNotFound(_0x41d1aa,null))[_0x9852('0x26')](function(_0x48fb6b){if(_0x48fb6b){_0x548207=_0x48fb6b['get']({'plain':!![]});_0x195d10[_0x9852('0x32')]=_[_0x9852('0x35')](db[_0x9852('0x56')]['rawAttributes']);_0x195d10[_0x9852('0x34')]=_[_0x9852('0x35')](_0xc379b5[_0x9852('0x34')]);_0x195d10[_0x9852('0x36')]=_[_0x9852('0x37')](_0x195d10['model'],_0x195d10['query']);_0x5b3b52['attributes']=_[_0x9852('0x37')](_0x195d10[_0x9852('0x32')],qs[_0x9852('0x39')](_0xc379b5[_0x9852('0x34')][_0x9852('0x39')]));_0x5b3b52[_0x9852('0x38')]=_0x5b3b52['attributes'][_0x9852('0x3a')]?_0x5b3b52[_0x9852('0x38')]:_0x195d10[_0x9852('0x32')];if(!_0xc379b5['query'][_0x9852('0x3b')](_0x9852('0x57'))){_0x5b3b52[_0x9852('0x1f')]=qs[_0x9852('0x1f')](_0xc379b5[_0x9852('0x34')][_0x9852('0x1f')]);_0x5b3b52[_0x9852('0x1d')]=qs[_0x9852('0x1d')](_0xc379b5['query'][_0x9852('0x1d')]);}_0x5b3b52['order']=qs[_0x9852('0x3d')](_0xc379b5['query']['sort']);_0x5b3b52[_0x9852('0x3f')]=qs[_0x9852('0x36')](_[_0x9852('0x58')](_0xc379b5[_0x9852('0x34')],_0x195d10['filters']));_0x5b3b52['where'][_0x9852('0x59')]=_0x48fb6b['id'];if(_0xc379b5[_0x9852('0x34')][_0x9852('0x3e')]){_0x5b3b52[_0x9852('0x3f')]=_[_0x9852('0x40')](_0x5b3b52[_0x9852('0x3f')],{'$or':_[_0x9852('0x33')](_0x5b3b52[_0x9852('0x38')],function(_0x4e0d61){var _0x267be5={};_0x267be5[_0x4e0d61]={'$like':'%'+_0xc379b5[_0x9852('0x34')]['filter']+'%'};return _0x267be5;})});}_0x5b3b52=_['merge']({},_0x5b3b52,_0xc379b5[_0x9852('0x48')]);return db[_0x9852('0x56')][_0x9852('0x5a')](_0x5b3b52);}})[_0x9852('0x26')](function(_0x203086){if(_0x203086){return db[_0x9852('0x5b')]['findAndCountAll']({'where':{'id':_[_0x9852('0x33')](_0x203086,_0x9852('0x5c')),'role':'agent'},'attributes':['id',_0x9852('0x2c'),_0x9852('0x5d'),_0x9852('0x5e'),_0x9852('0x5f')]});}})['then'](function(_0x29662d){if(_0x29662d){return{'count':_0x29662d['count'],'rows':_[_0x9852('0x33')](_0x29662d[_0x9852('0x60')],function(_0x2bf7fb){return{'membername':_0x2bf7fb[_0x9852('0x2c')],'UserId':_0x2bf7fb['id'],'queue_name':_0x548207[_0x9852('0x2c')],'MailQueueId':_0x548207['id'],'interface':util['format'](_0x9852('0x61'),_0x9852('0x62'),_0x2bf7fb['name']),'penalty':0x0,'paused':_0x2bf7fb[_0x9852('0x5d')],'createdAt':_0x2bf7fb[_0x9852('0x5f')],'updatedAt':_0x2bf7fb[_0x9852('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9852('0x26')](respondWithFilteredResult(_0x41d1aa,_0x5b3b52))[_0x9852('0x43')](handleError(_0x41d1aa,null));};exports[_0x9852('0x63')]=function(_0x132ccd,_0x241646,_0x5d862a){var _0x4540fc={};var _0x3d7eaf={};var _0x464413;var _0x3c26b4;return db[_0x9852('0x2e')]['findOne']({'where':{'id':_0x132ccd[_0x9852('0x45')]['id']}})[_0x9852('0x26')](handleEntityNotFound(_0x241646,null))['then'](function(_0x13e103){if(_0x13e103){_0x464413=_0x13e103;_0x3d7eaf[_0x9852('0x32')]=_['keys'](db['Team']['rawAttributes']);_0x3d7eaf[_0x9852('0x34')]=_['keys'](_0x132ccd['query']);_0x3d7eaf[_0x9852('0x36')]=_[_0x9852('0x37')](_0x3d7eaf[_0x9852('0x32')],_0x3d7eaf[_0x9852('0x34')]);_0x4540fc[_0x9852('0x38')]=_[_0x9852('0x37')](_0x3d7eaf[_0x9852('0x32')],qs[_0x9852('0x39')](_0x132ccd['query']['fields']));_0x4540fc['attributes']=_0x4540fc[_0x9852('0x38')]['length']?_0x4540fc['attributes']:_0x3d7eaf['model'];_0x4540fc[_0x9852('0x3c')]=qs[_0x9852('0x3d')](_0x132ccd[_0x9852('0x34')][_0x9852('0x3d')]);_0x4540fc['where']=qs[_0x9852('0x36')](_[_0x9852('0x58')](_0x132ccd[_0x9852('0x34')],_0x3d7eaf[_0x9852('0x36')]));if(_0x132ccd[_0x9852('0x34')][_0x9852('0x3e')]){_0x4540fc['where']=_[_0x9852('0x40')](_0x4540fc['where'],{'$or':_[_0x9852('0x33')](_0x4540fc['attributes'],function(_0x37b8cd){var _0x50c2cb={};_0x50c2cb[_0x37b8cd]={'$like':'%'+_0x132ccd[_0x9852('0x34')][_0x9852('0x3e')]+'%'};return _0x50c2cb;})});}_0x4540fc=_[_0x9852('0x40')]({},_0x4540fc,_0x132ccd[_0x9852('0x48')]);return _0x464413[_0x9852('0x63')](_0x4540fc);}})[_0x9852('0x26')](function(_0x30a5ff){if(_0x30a5ff){_0x3c26b4=_0x30a5ff[_0x9852('0x3a')];if(!_0x132ccd[_0x9852('0x34')][_0x9852('0x3b')](_0x9852('0x57'))){_0x4540fc['limit']=qs[_0x9852('0x1f')](_0x132ccd[_0x9852('0x34')][_0x9852('0x1f')]);_0x4540fc[_0x9852('0x1d')]=qs[_0x9852('0x1d')](_0x132ccd[_0x9852('0x34')][_0x9852('0x1d')]);}return _0x464413[_0x9852('0x63')](_0x4540fc);}})[_0x9852('0x26')](function(_0x929dbe){if(_0x929dbe){return _0x929dbe?{'count':_0x3c26b4,'rows':_0x929dbe}:null;}})['then'](respondWithResult(_0x241646,null))['catch'](handleError(_0x241646,null));};exports[_0x9852('0x64')]=function(_0xd54ff1,_0x4586e8,_0x3fed5b){var _0x131012=_0xd54ff1[_0x9852('0x53')][_0x9852('0x65')];return db['Team'][_0x9852('0x5a')]({'where':{'id':_0x131012},'attributes':['id'],'include':[{'model':db[_0x9852('0x5b')],'as':_0x9852('0x66'),'attributes':['id',_0x9852('0x2c'),_0x9852('0x67'),_0x9852('0x68'),_0x9852('0x69')],'raw':!![]}]})[_0x9852('0x26')](function(_0x1f8841){if(_0x1f8841){var _0xbfadd=_[_0x9852('0x6a')](_0x1f8841,function(_0x118d30){var _0x236f0f=_0x118d30[_0x9852('0x4b')]({'plain':!![]});return _0x236f0f[_0x9852('0x66')];});return db[_0x9852('0x2e')][_0x9852('0x4f')]({'where':{'id':_0xd54ff1['params']['id']}})[_0x9852('0x26')](function(_0x17a567){return db[_0x9852('0x6b')][_0x9852('0x6c')](function(_0xc973a0){return _0x17a567['addTeams'](_0x131012,{'transaction':_0xc973a0})[_0x9852('0x26')](function(){return BPromise[_0x9852('0x6d')](_0xbfadd,function(_0x1e0bfe){return db['UserMailQueue'][_0x9852('0x6e')]({'where':{'UserId':_0x1e0bfe['id'],'MailQueueId':_0xd54ff1[_0x9852('0x45')]['id']},'transaction':_0xc973a0});});})[_0x9852('0x26')](function(){_0xbfadd[_0x9852('0x6f')](function(_0xcdf3a5){socket['emit'](_0x9852('0x70'),{'UserId':_0xcdf3a5['id'],'MailQueueId':_0x17a567['id']});});});});});}})[_0x9852('0x26')](respondWithStatusCode(_0x4586e8,null))[_0x9852('0x43')](handleError(_0x4586e8,null));};exports[_0x9852('0x71')]=function(_0x4bacbe,_0x5f0c39,_0x4867c6){return db[_0x9852('0x72')][_0x9852('0x5a')]({'where':{'id':_0x4bacbe[_0x9852('0x34')][_0x9852('0x65')]},'attributes':['id'],'include':[{'model':db[_0x9852('0x5b')],'as':_0x9852('0x66'),'attributes':['id'],'raw':!![]}]})[_0x9852('0x26')](handleEntityNotFound(_0x5f0c39,null))[_0x9852('0x26')](function(_0x39f9b0){var _0x1b8eb8=_[_0x9852('0x33')](_0x39f9b0,'id');var _0x2f881d=[];var _0x59651e=[];var _0x1f1d2b=squel[_0x9852('0x73')]();_0x1f1d2b[_0x9852('0x74')](_0x9852('0x75'))[_0x9852('0x76')](_0x9852('0x77'),'tq')[_0x9852('0x78')](_0x9852('0x79'),'ut',_0x9852('0x7a'))[_0x9852('0x3f')]('MailQueueId\x20=\x20?',_0x4bacbe[_0x9852('0x45')]['id']);for(var _0x51a221=0x0;_0x51a221<_0x39f9b0[_0x9852('0x3a')];_0x51a221+=0x1){let _0x498164=_0x39f9b0[_0x51a221];for(var _0x2dc175=0x0;_0x2dc175<_0x498164[_0x9852('0x66')][_0x9852('0x3a')];_0x2dc175+=0x1){let _0x415db7=_0x498164['Agents'][_0x2dc175];var _0x3ddb04=_0x1f1d2b[_0x9852('0x7b')]();_0x3ddb04[_0x9852('0x3f')](_0x9852('0x7c'),_0x415db7['id']);_0x59651e[_0x9852('0x7d')](db[_0x9852('0x6b')][_0x9852('0x34')](_0x3ddb04['toString'](),{'type':db[_0x9852('0x6b')]['QueryTypes']['SELECT']})[_0x9852('0x26')](function(_0x3644bf){if(_0x3644bf[_0x9852('0x3a')]===0x1){return _0x415db7['id'];}else{var _0x2ee612=_[_0x9852('0x7e')](_['map'](_0x3644bf,_0x9852('0x7f')),function(_0x58f7c4){return _[_0x9852('0x80')](_0x1b8eb8,_0x58f7c4);});if(_0x2ee612){return _0x415db7['id'];}}}));}}return BPromise[_0x9852('0x81')](_0x59651e)['then'](function(_0x12b18b){_0x2f881d=_(_0x2f881d)[_0x9852('0x82')](_0x12b18b)[_0x9852('0x83')]()[_0x9852('0x84')]();return db[_0x9852('0x2e')]['find']({'where':{'id':_0x4bacbe[_0x9852('0x45')]['id']}})[_0x9852('0x26')](function(_0x286826){return db[_0x9852('0x6b')][_0x9852('0x6c')](function(_0xbd8471){return _0x286826['removeTeams'](_0x4bacbe[_0x9852('0x34')][_0x9852('0x65')],{'transaction':_0xbd8471})['then'](function(){if(!_['isEmpty'](_0x2f881d)){return _0x286826[_0x9852('0x85')](_0x2f881d,{'transaction':_0xbd8471});}})[_0x9852('0x26')](function(){_0x2f881d[_0x9852('0x6f')](function(_0x390bbf){socket['emit'](_0x9852('0x86'),{'UserId':_0x390bbf,'MailQueueId':_0x286826['id']});});});});});});})[_0x9852('0x26')](respondWithStatusCode(_0x5f0c39,null))[_0x9852('0x43')](handleError(_0x5f0c39,null));};exports['addAgents']=function(_0x4b08f9,_0x318783,_0x56dc89){return db[_0x9852('0x2e')][_0x9852('0x4f')]({'where':{'id':_0x4b08f9['params']['id']}})[_0x9852('0x26')](handleEntityNotFound(_0x318783,null))[_0x9852('0x26')](function(_0x13fd16){if(_0x13fd16){return _0x13fd16[_0x9852('0x87')](_0x4b08f9[_0x9852('0x53')][_0x9852('0x65')],_['omit'](_0x4b08f9[_0x9852('0x53')],[_0x9852('0x65'),'id'])||{})[_0x9852('0x88')](function(_0x3242b4){for(var _0x33f2f2=0x0;_0x33f2f2<_0x4b08f9[_0x9852('0x53')]['ids'][_0x9852('0x3a')];_0x33f2f2+=0x1){socket[_0x9852('0x89')](_0x9852('0x70'),{'UserId':Number(_0x4b08f9[_0x9852('0x53')]['ids'][_0x33f2f2]),'MailQueueId':Number(_0x4b08f9[_0x9852('0x45')]['id'])});}return _0x3242b4;});}})[_0x9852('0x26')](respondWithResult(_0x318783,null))[_0x9852('0x43')](handleError(_0x318783,null));};exports[_0x9852('0x85')]=function(_0x4aaeb0,_0x42353c,_0x46f06b){return db[_0x9852('0x2e')]['find']({'where':{'id':_0x4aaeb0[_0x9852('0x45')]['id']}})[_0x9852('0x26')](handleEntityNotFound(_0x42353c,null))[_0x9852('0x26')](function(_0x843b05){if(_0x843b05){return _0x843b05['removeAgents'](_0x4aaeb0[_0x9852('0x34')][_0x9852('0x65')])[_0x9852('0x26')](function(){if(_[_0x9852('0x8a')](_0x4aaeb0[_0x9852('0x34')][_0x9852('0x65')])){for(var _0x24c4b2=0x0;_0x24c4b2<_0x4aaeb0[_0x9852('0x34')][_0x9852('0x65')][_0x9852('0x3a')];_0x24c4b2+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4aaeb0[_0x9852('0x34')][_0x9852('0x65')][_0x24c4b2]),'MailQueueId':Number(_0x4aaeb0[_0x9852('0x45')]['id'])});}}else{socket['emit'](_0x9852('0x86'),{'UserId':Number(_0x4aaeb0[_0x9852('0x34')][_0x9852('0x65')]),'MailQueueId':Number(_0x4aaeb0[_0x9852('0x45')]['id'])});}});}})[_0x9852('0x26')](respondWithStatusCode(_0x42353c,null))[_0x9852('0x43')](handleError(_0x42353c,null));};exports[_0x9852('0x8b')]=function(_0x17bda0,_0x257906,_0x28d556){var _0x325613={};var _0x2dd255={};var _0x47fc4e;var _0x542d00;return db['MailQueue']['findOne']({'where':{'id':_0x17bda0['params']['id']}})[_0x9852('0x26')](handleEntityNotFound(_0x257906,null))[_0x9852('0x26')](function(_0x3409f3){if(_0x3409f3){_0x47fc4e=_0x3409f3;_0x2dd255[_0x9852('0x32')]=_[_0x9852('0x35')](db[_0x9852('0x5b')][_0x9852('0x46')]);_0x2dd255['query']=_[_0x9852('0x35')](_0x17bda0[_0x9852('0x34')]);_0x2dd255['filters']=_[_0x9852('0x37')](_0x2dd255[_0x9852('0x32')],_0x2dd255[_0x9852('0x34')]);_0x325613[_0x9852('0x38')]=_[_0x9852('0x37')](_0x2dd255[_0x9852('0x32')],qs['fields'](_0x17bda0[_0x9852('0x34')][_0x9852('0x39')]));_0x325613[_0x9852('0x38')]=_0x325613['attributes'][_0x9852('0x3a')]?_0x325613[_0x9852('0x38')]:_0x2dd255[_0x9852('0x32')];_0x325613[_0x9852('0x3c')]=qs[_0x9852('0x3d')](_0x17bda0[_0x9852('0x34')]['sort']);_0x325613['where']=qs[_0x9852('0x36')](_[_0x9852('0x58')](_0x17bda0['query'],_0x2dd255[_0x9852('0x36')]));if(_0x17bda0[_0x9852('0x34')][_0x9852('0x3e')]){_0x325613['where']=_[_0x9852('0x40')](_0x325613[_0x9852('0x3f')],{'$or':_[_0x9852('0x33')](_0x325613[_0x9852('0x38')],function(_0xe5c6f6){var _0xfbbc8f={};_0xfbbc8f[_0xe5c6f6]={'$like':'%'+_0x17bda0[_0x9852('0x34')][_0x9852('0x3e')]+'%'};return _0xfbbc8f;})});}_0x325613=_[_0x9852('0x40')]({},_0x325613,_0x17bda0[_0x9852('0x48')]);return _0x47fc4e['getAgents'](_0x325613);}})['then'](function(_0x4e8a37){if(_0x4e8a37){_0x542d00=_0x4e8a37[_0x9852('0x3a')];if(!_0x17bda0[_0x9852('0x34')][_0x9852('0x3b')](_0x9852('0x57'))){_0x325613[_0x9852('0x1f')]=qs[_0x9852('0x1f')](_0x17bda0['query'][_0x9852('0x1f')]);_0x325613[_0x9852('0x1d')]=qs[_0x9852('0x1d')](_0x17bda0[_0x9852('0x34')]['offset']);}return _0x47fc4e['getAgents'](_0x325613);}})['then'](function(_0x7e8a6){if(_0x7e8a6){return _0x7e8a6?{'count':_0x542d00,'rows':_0x7e8a6}:null;}})['then'](respondWithResult(_0x257906,null))[_0x9852('0x43')](handleError(_0x257906,null));}; \ No newline at end of file +var _0x024a=['set','reject','update','then','get','MailQueues','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','MailQueue','findAll','rows','catch','params','fields','length','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','destroy','getMembers','UserMailQueue','order','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','format','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','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','SELECT','every','TeamId','includes','all','union','value','removeTeams','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x024a,0x17f));var _0xa024=function(_0x4f6ea2,_0xb5a2d){_0x4f6ea2=_0x4f6ea2-0x0;var _0x58c868=_0x024a[_0x4f6ea2];return _0x58c868;};'use strict';var emlformat=require(_0xa024('0x0'));var rimraf=require(_0xa024('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa024('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa024('0x3'));var util=require(_0xa024('0x4'));var path=require(_0xa024('0x5'));var sox=require('sox');var csv=require(_0xa024('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa024('0x7'));var _=require(_0xa024('0x8'));var squel=require('squel');var crypto=require(_0xa024('0x9'));var jsforce=require(_0xa024('0xa'));var deskjs=require(_0xa024('0xb'));var toCsv=require(_0xa024('0x6'));var querystring=require(_0xa024('0xc'));var Papa=require(_0xa024('0xd'));var Redis=require(_0xa024('0xe'));var authService=require(_0xa024('0xf'));var qs=require(_0xa024('0x10'));var as=require(_0xa024('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa024('0x12'))('api');var utils=require(_0xa024('0x13'));var config=require(_0xa024('0x14'));var licenseUtil=require(_0xa024('0x15'));var db=require(_0xa024('0x16'))['db'];config[_0xa024('0x17')]=_[_0xa024('0x18')](config[_0xa024('0x17')],{'host':_0xa024('0x19'),'port':0x18eb});var socket=require(_0xa024('0x1a'))(new Redis(config[_0xa024('0x17')]));require(_0xa024('0x1b'))[_0xa024('0x1c')](socket);function respondWithStatusCode(_0x26fb15,_0x4e109d){_0x4e109d=_0x4e109d||0xcc;return function(_0x1336e8){if(_0x1336e8){return _0x26fb15[_0xa024('0x1d')](_0x4e109d);}return _0x26fb15[_0xa024('0x1e')](_0x4e109d)[_0xa024('0x1f')]();};}function respondWithResult(_0xae6ca6,_0x356936){_0x356936=_0x356936||0xc8;return function(_0x7446bf){if(_0x7446bf){return _0xae6ca6[_0xa024('0x1e')](_0x356936)[_0xa024('0x20')](_0x7446bf);}};}function respondWithFilteredResult(_0x36f791,_0x1584c6){return function(_0x88b88a){if(_0x88b88a){var _0x2c8b4=typeof _0x1584c6[_0xa024('0x21')]===_0xa024('0x22')&&typeof _0x1584c6[_0xa024('0x23')]===_0xa024('0x22');var _0x13e7ba=_0x88b88a[_0xa024('0x24')];var _0x162e72=_0x2c8b4?0x0:_0x1584c6['offset'];var _0x325b4f=_0x2c8b4?_0x88b88a[_0xa024('0x24')]:_0x1584c6[_0xa024('0x21')]+_0x1584c6[_0xa024('0x23')];var _0x2acf6a;if(_0x325b4f>=_0x13e7ba){_0x325b4f=_0x13e7ba;_0x2acf6a=0xc8;}else{_0x2acf6a=0xce;}_0x36f791[_0xa024('0x1e')](_0x2acf6a);return _0x36f791[_0xa024('0x25')]('Content-Range',_0x162e72+'-'+_0x325b4f+'/'+_0x13e7ba)[_0xa024('0x20')](_0x88b88a);}return null;};}function patchUpdates(_0x83213c){return function(_0x2ccd60){try{jsonpatch['apply'](_0x2ccd60,_0x83213c,!![]);}catch(_0x5d28b9){return BPromise[_0xa024('0x26')](_0x5d28b9);}return _0x2ccd60['save']();};}function saveUpdates(_0x3f098e,_0x2ee7e5){return function(_0x363659){if(_0x363659){return _0x363659[_0xa024('0x27')](_0x3f098e)[_0xa024('0x28')](function(_0x496eb8){return _0x496eb8;});}return null;};}function removeEntity(_0x357abb,_0x80c6ea){return function(_0x4262a3){if(_0x4262a3){return _0x4262a3['destroy']()['then'](function(){var _0x4302dc=_0x4262a3[_0xa024('0x29')]({'plain':!![]});var _0xb7955f=_0xa024('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0xb7955f,'resourceId':_0x4302dc['id']}})[_0xa024('0x28')](function(){return _0x4262a3;});})['then'](function(){_0x357abb[_0xa024('0x1e')](0xcc)[_0xa024('0x1f')]();});}};}function handleEntityNotFound(_0x27f0ff,_0x214a2d){return function(_0x36e61f){if(!_0x36e61f){_0x27f0ff[_0xa024('0x1d')](0x194);}return _0x36e61f;};}function handleError(_0x54b55b,_0x513600){_0x513600=_0x513600||0x1f4;return function(_0x569d20){logger[_0xa024('0x2b')](_0x569d20[_0xa024('0x2c')]);if(_0x569d20[_0xa024('0x2d')]){delete _0x569d20[_0xa024('0x2d')];}_0x54b55b['status'](_0x513600)[_0xa024('0x2e')](_0x569d20);};}exports['index']=function(_0x3cd206,_0x43583d){var _0x34dfe7={},_0x18066a={},_0x184cb6={'count':0x0,'rows':[]};var _0x41b62c=_[_0xa024('0x2f')](db['MailQueue'][_0xa024('0x30')],function(_0xe2e512){return{'name':_0xe2e512[_0xa024('0x31')],'type':_0xe2e512[_0xa024('0x32')][_0xa024('0x33')]};});_0x18066a['model']=_[_0xa024('0x2f')](_0x41b62c,_0xa024('0x2d'));_0x18066a['query']=_[_0xa024('0x34')](_0x3cd206[_0xa024('0x35')]);_0x18066a[_0xa024('0x36')]=_[_0xa024('0x37')](_0x18066a[_0xa024('0x38')],_0x18066a['query']);_0x34dfe7['attributes']=_[_0xa024('0x37')](_0x18066a[_0xa024('0x38')],qs['fields'](_0x3cd206[_0xa024('0x35')]['fields']));_0x34dfe7[_0xa024('0x39')]=_0x34dfe7[_0xa024('0x39')]['length']?_0x34dfe7[_0xa024('0x39')]:_0x18066a[_0xa024('0x38')];if(!_0x3cd206[_0xa024('0x35')][_0xa024('0x3a')](_0xa024('0x3b'))){_0x34dfe7[_0xa024('0x23')]=qs[_0xa024('0x23')](_0x3cd206['query']['limit']);_0x34dfe7['offset']=qs['offset'](_0x3cd206['query'][_0xa024('0x21')]);}_0x34dfe7['order']=qs[_0xa024('0x3c')](_0x3cd206[_0xa024('0x35')][_0xa024('0x3c')]);_0x34dfe7['where']=qs['filters'](_[_0xa024('0x3d')](_0x3cd206[_0xa024('0x35')],_0x18066a[_0xa024('0x36')]),_0x41b62c);if(_0x3cd206[_0xa024('0x35')][_0xa024('0x3e')]){_0x34dfe7[_0xa024('0x3f')]=_[_0xa024('0x40')](_0x34dfe7['where'],{'$or':_[_0xa024('0x2f')](_0x41b62c,function(_0x38f6b9){if(_0x38f6b9[_0xa024('0x32')]!==_0xa024('0x41')){var _0x3b17fa={};_0x3b17fa[_0x38f6b9[_0xa024('0x2d')]]={'$like':'%'+_0x3cd206[_0xa024('0x35')][_0xa024('0x3e')]+'%'};return _0x3b17fa;}})});}_0x34dfe7=_[_0xa024('0x40')]({},_0x34dfe7,_0x3cd206[_0xa024('0x42')]);var _0x6cb096={'where':_0x34dfe7[_0xa024('0x3f')]};return db['MailQueue'][_0xa024('0x24')](_0x6cb096)[_0xa024('0x28')](function(_0x26fa6e){_0x184cb6['count']=_0x26fa6e;if(_0x3cd206['query'][_0xa024('0x43')]){_0x34dfe7['include']=[{'all':!![]}];}return db[_0xa024('0x44')][_0xa024('0x45')](_0x34dfe7);})[_0xa024('0x28')](function(_0x249192){_0x184cb6[_0xa024('0x46')]=_0x249192;return _0x184cb6;})[_0xa024('0x28')](respondWithFilteredResult(_0x43583d,_0x34dfe7))[_0xa024('0x47')](handleError(_0x43583d,null));};exports['show']=function(_0xc99e45,_0x337638){var _0x269f18={'raw':!![],'where':{'id':_0xc99e45[_0xa024('0x48')]['id']}},_0x4e5ee1={};_0x4e5ee1[_0xa024('0x38')]=_[_0xa024('0x34')](db[_0xa024('0x44')][_0xa024('0x30')]);_0x4e5ee1[_0xa024('0x35')]=_['keys'](_0xc99e45[_0xa024('0x35')]);_0x4e5ee1[_0xa024('0x36')]=_[_0xa024('0x37')](_0x4e5ee1[_0xa024('0x38')],_0x4e5ee1[_0xa024('0x35')]);_0x269f18[_0xa024('0x39')]=_[_0xa024('0x37')](_0x4e5ee1[_0xa024('0x38')],qs[_0xa024('0x49')](_0xc99e45['query']['fields']));_0x269f18[_0xa024('0x39')]=_0x269f18[_0xa024('0x39')][_0xa024('0x4a')]?_0x269f18['attributes']:_0x4e5ee1['model'];if(_0xc99e45[_0xa024('0x35')]['includeAll']){_0x269f18['include']=[{'all':!![]}];}_0x269f18=_[_0xa024('0x40')]({},_0x269f18,_0xc99e45[_0xa024('0x42')]);return db['MailQueue'][_0xa024('0x4b')](_0x269f18)[_0xa024('0x28')](handleEntityNotFound(_0x337638,null))[_0xa024('0x28')](respondWithResult(_0x337638,null))[_0xa024('0x47')](handleError(_0x337638,null));};exports[_0xa024('0x4c')]=function(_0x35cd4a,_0x19d8f9){return db['MailQueue']['create'](_0x35cd4a[_0xa024('0x4d')],{})['then'](function(_0x3cb132){var _0x38e6b6=_0x35cd4a[_0xa024('0x4e')]['get']({'plain':!![]});if(!_0x38e6b6)throw new Error(_0xa024('0x4f'));if(_0x38e6b6[_0xa024('0x50')]===_0xa024('0x4e')){var _0x5eff09=_0x3cb132[_0xa024('0x29')]({'plain':!![]});var _0x262486='MailQueues';return db[_0xa024('0x51')]['find']({'where':{'name':_0x262486,'userProfileId':_0x38e6b6[_0xa024('0x52')]},'raw':!![]})[_0xa024('0x28')](function(_0x285419){if(_0x285419&&_0x285419[_0xa024('0x53')]===0x0){return db['UserProfileResource'][_0xa024('0x4c')]({'name':_0x5eff09[_0xa024('0x2d')],'resourceId':_0x5eff09['id'],'type':_0x285419[_0xa024('0x2d')],'sectionId':_0x285419['id']},{})[_0xa024('0x28')](function(){return _0x3cb132;});}else{return _0x3cb132;}})[_0xa024('0x47')](function(_0xa2ecee){logger[_0xa024('0x2b')](_0xa024('0x54'),_0xa2ecee);throw _0xa2ecee;});}return _0x3cb132;})[_0xa024('0x28')](respondWithResult(_0x19d8f9,0xc9))['catch'](handleError(_0x19d8f9,null));};exports['update']=function(_0x19170c,_0x4de68d){if(_0x19170c[_0xa024('0x4d')]['id']){delete _0x19170c[_0xa024('0x4d')]['id'];}return db['MailQueue'][_0xa024('0x4b')]({'where':{'id':_0x19170c[_0xa024('0x48')]['id']}})[_0xa024('0x28')](handleEntityNotFound(_0x4de68d,null))[_0xa024('0x28')](saveUpdates(_0x19170c[_0xa024('0x4d')],null))[_0xa024('0x28')](respondWithResult(_0x4de68d,null))[_0xa024('0x47')](handleError(_0x4de68d,null));};exports[_0xa024('0x55')]=function(_0x20d9bd,_0x2149b3){return db[_0xa024('0x44')][_0xa024('0x4b')]({'where':{'id':_0x20d9bd[_0xa024('0x48')]['id']}})[_0xa024('0x28')](handleEntityNotFound(_0x2149b3,null))[_0xa024('0x28')](removeEntity(_0x2149b3,null))[_0xa024('0x47')](handleError(_0x2149b3,null));};exports['describe']=function(_0x4a5265,_0x337b41){return db[_0xa024('0x44')]['describe']()['then'](respondWithResult(_0x337b41,null))[_0xa024('0x47')](handleError(_0x337b41,null));};exports[_0xa024('0x56')]=function(_0x18d408,_0x32498d,_0x1214d0){var _0xfdadfd={'raw':!![],'where':{}},_0x1bf985={},_0x362e5f;return db[_0xa024('0x44')]['findOne']({'where':{'id':_0x18d408[_0xa024('0x48')]['id']}})[_0xa024('0x28')](handleEntityNotFound(_0x32498d,null))[_0xa024('0x28')](function(_0x7cfb44){if(_0x7cfb44){_0x362e5f=_0x7cfb44['get']({'plain':!![]});_0x1bf985[_0xa024('0x38')]=_[_0xa024('0x34')](db[_0xa024('0x57')]['rawAttributes']);_0x1bf985[_0xa024('0x35')]=_[_0xa024('0x34')](_0x18d408[_0xa024('0x35')]);_0x1bf985['filters']=_['intersection'](_0x1bf985['model'],_0x1bf985[_0xa024('0x35')]);_0xfdadfd[_0xa024('0x39')]=_['intersection'](_0x1bf985[_0xa024('0x38')],qs['fields'](_0x18d408[_0xa024('0x35')][_0xa024('0x49')]));_0xfdadfd[_0xa024('0x39')]=_0xfdadfd['attributes'][_0xa024('0x4a')]?_0xfdadfd['attributes']:_0x1bf985[_0xa024('0x38')];if(!_0x18d408[_0xa024('0x35')][_0xa024('0x3a')](_0xa024('0x3b'))){_0xfdadfd['limit']=qs[_0xa024('0x23')](_0x18d408[_0xa024('0x35')][_0xa024('0x23')]);_0xfdadfd[_0xa024('0x21')]=qs[_0xa024('0x21')](_0x18d408[_0xa024('0x35')]['offset']);}_0xfdadfd[_0xa024('0x58')]=qs[_0xa024('0x3c')](_0x18d408[_0xa024('0x35')][_0xa024('0x3c')]);_0xfdadfd[_0xa024('0x3f')]=qs['filters'](_[_0xa024('0x3d')](_0x18d408[_0xa024('0x35')],_0x1bf985['filters']));_0xfdadfd[_0xa024('0x3f')][_0xa024('0x59')]=_0x7cfb44['id'];if(_0x18d408[_0xa024('0x35')][_0xa024('0x3e')]){_0xfdadfd['where']=_[_0xa024('0x40')](_0xfdadfd['where'],{'$or':_['map'](_0xfdadfd[_0xa024('0x39')],function(_0x331fa3){var _0x2a1016={};_0x2a1016[_0x331fa3]={'$like':'%'+_0x18d408[_0xa024('0x35')][_0xa024('0x3e')]+'%'};return _0x2a1016;})});}_0xfdadfd=_[_0xa024('0x40')]({},_0xfdadfd,_0x18d408[_0xa024('0x42')]);return db['UserMailQueue'][_0xa024('0x45')](_0xfdadfd);}})[_0xa024('0x28')](function(_0x26331d){if(_0x26331d){return db['User'][_0xa024('0x5a')]({'where':{'id':_[_0xa024('0x2f')](_0x26331d,_0xa024('0x5b')),'role':_0xa024('0x5c')},'attributes':['id','name',_0xa024('0x5d'),_0xa024('0x5e'),'createdAt']});}})[_0xa024('0x28')](function(_0x4b9e62){if(_0x4b9e62){return{'count':_0x4b9e62[_0xa024('0x24')],'rows':_['map'](_0x4b9e62[_0xa024('0x46')],function(_0x1c4a0){return{'membername':_0x1c4a0['name'],'UserId':_0x1c4a0['id'],'queue_name':_0x362e5f[_0xa024('0x2d')],'MailQueueId':_0x362e5f['id'],'interface':util[_0xa024('0x5f')]('%s/%s',_0xa024('0x60'),_0x1c4a0[_0xa024('0x2d')]),'penalty':0x0,'paused':_0x1c4a0['mailPause'],'createdAt':_0x1c4a0[_0xa024('0x61')],'updatedAt':_0x1c4a0[_0xa024('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa024('0x28')](respondWithFilteredResult(_0x32498d,_0xfdadfd))[_0xa024('0x47')](handleError(_0x32498d,null));};exports[_0xa024('0x62')]=function(_0x5412e8,_0x454b4e,_0x4647fd){var _0x24562c={};var _0x4622f4={};var _0xfd214d;var _0x5c4cde;return db[_0xa024('0x44')][_0xa024('0x63')]({'where':{'id':_0x5412e8[_0xa024('0x48')]['id']}})[_0xa024('0x28')](handleEntityNotFound(_0x454b4e,null))[_0xa024('0x28')](function(_0x8168f5){if(_0x8168f5){_0xfd214d=_0x8168f5;_0x4622f4['model']=_[_0xa024('0x34')](db[_0xa024('0x64')][_0xa024('0x30')]);_0x4622f4['query']=_[_0xa024('0x34')](_0x5412e8['query']);_0x4622f4[_0xa024('0x36')]=_[_0xa024('0x37')](_0x4622f4[_0xa024('0x38')],_0x4622f4[_0xa024('0x35')]);_0x24562c['attributes']=_[_0xa024('0x37')](_0x4622f4[_0xa024('0x38')],qs['fields'](_0x5412e8[_0xa024('0x35')][_0xa024('0x49')]));_0x24562c[_0xa024('0x39')]=_0x24562c[_0xa024('0x39')][_0xa024('0x4a')]?_0x24562c['attributes']:_0x4622f4[_0xa024('0x38')];_0x24562c[_0xa024('0x58')]=qs[_0xa024('0x3c')](_0x5412e8[_0xa024('0x35')]['sort']);_0x24562c[_0xa024('0x3f')]=qs['filters'](_['pick'](_0x5412e8['query'],_0x4622f4[_0xa024('0x36')]));if(_0x5412e8[_0xa024('0x35')]['filter']){_0x24562c[_0xa024('0x3f')]=_[_0xa024('0x40')](_0x24562c[_0xa024('0x3f')],{'$or':_[_0xa024('0x2f')](_0x24562c[_0xa024('0x39')],function(_0x3d5cfc){var _0x1f9e2a={};_0x1f9e2a[_0x3d5cfc]={'$like':'%'+_0x5412e8[_0xa024('0x35')][_0xa024('0x3e')]+'%'};return _0x1f9e2a;})});}_0x24562c=_[_0xa024('0x40')]({},_0x24562c,_0x5412e8[_0xa024('0x42')]);return _0xfd214d[_0xa024('0x62')](_0x24562c);}})['then'](function(_0x3748b5){if(_0x3748b5){_0x5c4cde=_0x3748b5[_0xa024('0x4a')];if(!_0x5412e8[_0xa024('0x35')]['hasOwnProperty'](_0xa024('0x3b'))){_0x24562c[_0xa024('0x23')]=qs[_0xa024('0x23')](_0x5412e8[_0xa024('0x35')][_0xa024('0x23')]);_0x24562c[_0xa024('0x21')]=qs[_0xa024('0x21')](_0x5412e8[_0xa024('0x35')]['offset']);}return _0xfd214d['getTeams'](_0x24562c);}})[_0xa024('0x28')](function(_0x249e4c){if(_0x249e4c){return _0x249e4c?{'count':_0x5c4cde,'rows':_0x249e4c}:null;}})[_0xa024('0x28')](respondWithResult(_0x454b4e,null))[_0xa024('0x47')](handleError(_0x454b4e,null));};exports[_0xa024('0x65')]=function(_0xd3a303,_0x455e37,_0x123431){var _0x18b53b=_0xd3a303[_0xa024('0x4d')][_0xa024('0x66')];return db[_0xa024('0x64')]['findAll']({'where':{'id':_0x18b53b},'attributes':['id'],'include':[{'model':db[_0xa024('0x67')],'as':_0xa024('0x68'),'attributes':['id',_0xa024('0x2d'),_0xa024('0x69'),'voicePause',_0xa024('0x6a')],'raw':!![]}]})[_0xa024('0x28')](function(_0x46c240){if(_0x46c240){var _0x3d020b=_[_0xa024('0x6b')](_0x46c240,function(_0x10d4d6){var _0x4db5a5=_0x10d4d6['get']({'plain':!![]});return _0x4db5a5[_0xa024('0x68')];});return db['MailQueue'][_0xa024('0x4b')]({'where':{'id':_0xd3a303['params']['id']}})[_0xa024('0x28')](function(_0x19e024){return db[_0xa024('0x6c')][_0xa024('0x6d')](function(_0x4a3554){return _0x19e024['addTeams'](_0x18b53b,{'transaction':_0x4a3554})[_0xa024('0x28')](function(){return BPromise[_0xa024('0x6e')](_0x3d020b,function(_0x307893){return db[_0xa024('0x57')][_0xa024('0x6f')]({'where':{'UserId':_0x307893['id'],'MailQueueId':_0xd3a303[_0xa024('0x48')]['id']},'transaction':_0x4a3554});});})['then'](function(){_0x3d020b[_0xa024('0x70')](function(_0x43ed92){socket['emit'](_0xa024('0x71'),{'UserId':_0x43ed92['id'],'MailQueueId':_0x19e024['id']});});});});});}})[_0xa024('0x28')](respondWithStatusCode(_0x455e37,null))[_0xa024('0x47')](handleError(_0x455e37,null));};exports['removeTeams']=function(_0x87e4ef,_0x2596f2,_0x1a9529){return db[_0xa024('0x64')][_0xa024('0x45')]({'where':{'id':_0x87e4ef[_0xa024('0x35')][_0xa024('0x66')]},'attributes':['id'],'include':[{'model':db[_0xa024('0x67')],'as':_0xa024('0x68'),'attributes':['id'],'raw':!![]}]})[_0xa024('0x28')](handleEntityNotFound(_0x2596f2,null))[_0xa024('0x28')](function(_0xd8ae32){var _0x53a6b9=_[_0xa024('0x2f')](_0xd8ae32,'id');var _0x4f9840=[];var _0x1a41e3=[];var _0x26c875=squel['select']();_0x26c875['field'](_0xa024('0x72'))[_0xa024('0x73')](_0xa024('0x74'),'tq')[_0xa024('0x75')](_0xa024('0x76'),'ut',_0xa024('0x77'))[_0xa024('0x3f')](_0xa024('0x78'),_0x87e4ef[_0xa024('0x48')]['id']);for(var _0x127ead=0x0;_0x127ead<_0xd8ae32['length'];_0x127ead+=0x1){let _0x449a3a=_0xd8ae32[_0x127ead];for(var _0x338ecd=0x0;_0x338ecd<_0x449a3a[_0xa024('0x68')][_0xa024('0x4a')];_0x338ecd+=0x1){let _0x4898c4=_0x449a3a[_0xa024('0x68')][_0x338ecd];var _0x197957=_0x26c875[_0xa024('0x79')]();_0x197957['where'](_0xa024('0x7a'),_0x4898c4['id']);_0x1a41e3['push'](db['sequelize'][_0xa024('0x35')](_0x197957[_0xa024('0x7b')](),{'type':db[_0xa024('0x6c')]['QueryTypes'][_0xa024('0x7c')]})[_0xa024('0x28')](function(_0x5c31af){if(_0x5c31af[_0xa024('0x4a')]===0x1){return _0x4898c4['id'];}else{var _0x4a4bea=_[_0xa024('0x7d')](_[_0xa024('0x2f')](_0x5c31af,_0xa024('0x7e')),function(_0x43dac4){return _[_0xa024('0x7f')](_0x53a6b9,_0x43dac4);});if(_0x4a4bea){return _0x4898c4['id'];}}}));}}return BPromise[_0xa024('0x80')](_0x1a41e3)['then'](function(_0xb3b1b6){_0x4f9840=_(_0x4f9840)[_0xa024('0x81')](_0xb3b1b6)['compact']()[_0xa024('0x82')]();return db[_0xa024('0x44')][_0xa024('0x4b')]({'where':{'id':_0x87e4ef[_0xa024('0x48')]['id']}})[_0xa024('0x28')](function(_0x4fcf3e){return db['sequelize']['transaction'](function(_0x349a5d){return _0x4fcf3e[_0xa024('0x83')](_0x87e4ef[_0xa024('0x35')][_0xa024('0x66')],{'transaction':_0x349a5d})['then'](function(){if(!_['isEmpty'](_0x4f9840)){return _0x4fcf3e[_0xa024('0x84')](_0x4f9840,{'transaction':_0x349a5d});}})[_0xa024('0x28')](function(){_0x4f9840['forEach'](function(_0x174308){socket[_0xa024('0x85')](_0xa024('0x86'),{'UserId':_0x174308,'MailQueueId':_0x4fcf3e['id']});});});});});});})[_0xa024('0x28')](respondWithStatusCode(_0x2596f2,null))[_0xa024('0x47')](handleError(_0x2596f2,null));};exports[_0xa024('0x87')]=function(_0x5bf509,_0xe84a52,_0x4068cb){return db['MailQueue'][_0xa024('0x4b')]({'where':{'id':_0x5bf509[_0xa024('0x48')]['id']}})['then'](handleEntityNotFound(_0xe84a52,null))[_0xa024('0x28')](function(_0x12c619){if(_0x12c619){return _0x12c619[_0xa024('0x87')](_0x5bf509[_0xa024('0x4d')][_0xa024('0x66')],_[_0xa024('0x88')](_0x5bf509[_0xa024('0x4d')],['ids','id'])||{})[_0xa024('0x89')](function(_0x1f211f){for(var _0x2f5b51=0x0;_0x2f5b51<_0x5bf509[_0xa024('0x4d')]['ids']['length'];_0x2f5b51+=0x1){socket[_0xa024('0x85')](_0xa024('0x71'),{'UserId':Number(_0x5bf509[_0xa024('0x4d')][_0xa024('0x66')][_0x2f5b51]),'MailQueueId':Number(_0x5bf509[_0xa024('0x48')]['id'])});}return _0x1f211f;});}})[_0xa024('0x28')](respondWithResult(_0xe84a52,null))[_0xa024('0x47')](handleError(_0xe84a52,null));};exports[_0xa024('0x84')]=function(_0x4295a9,_0x13c290,_0x144c4c){return db[_0xa024('0x44')][_0xa024('0x4b')]({'where':{'id':_0x4295a9[_0xa024('0x48')]['id']}})[_0xa024('0x28')](handleEntityNotFound(_0x13c290,null))[_0xa024('0x28')](function(_0x3af6e6){if(_0x3af6e6){return _0x3af6e6[_0xa024('0x84')](_0x4295a9[_0xa024('0x35')]['ids'])[_0xa024('0x28')](function(){if(_[_0xa024('0x8a')](_0x4295a9[_0xa024('0x35')][_0xa024('0x66')])){for(var _0x4b249c=0x0;_0x4b249c<_0x4295a9['query'][_0xa024('0x66')]['length'];_0x4b249c+=0x1){socket['emit'](_0xa024('0x86'),{'UserId':Number(_0x4295a9[_0xa024('0x35')][_0xa024('0x66')][_0x4b249c]),'MailQueueId':Number(_0x4295a9['params']['id'])});}}else{socket[_0xa024('0x85')](_0xa024('0x86'),{'UserId':Number(_0x4295a9['query'][_0xa024('0x66')]),'MailQueueId':Number(_0x4295a9[_0xa024('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x13c290,null))['catch'](handleError(_0x13c290,null));};exports[_0xa024('0x8b')]=function(_0x5431d4,_0x105231,_0x280c69){var _0x310b28={};var _0x1ce47b={};var _0x28d2ae;var _0x630458;return db[_0xa024('0x44')][_0xa024('0x63')]({'where':{'id':_0x5431d4[_0xa024('0x48')]['id']}})[_0xa024('0x28')](handleEntityNotFound(_0x105231,null))[_0xa024('0x28')](function(_0x16ac83){if(_0x16ac83){_0x28d2ae=_0x16ac83;_0x1ce47b['model']=_[_0xa024('0x34')](db[_0xa024('0x67')][_0xa024('0x30')]);_0x1ce47b['query']=_[_0xa024('0x34')](_0x5431d4[_0xa024('0x35')]);_0x1ce47b[_0xa024('0x36')]=_[_0xa024('0x37')](_0x1ce47b['model'],_0x1ce47b[_0xa024('0x35')]);_0x310b28['attributes']=_['intersection'](_0x1ce47b['model'],qs[_0xa024('0x49')](_0x5431d4['query']['fields']));_0x310b28['attributes']=_0x310b28[_0xa024('0x39')][_0xa024('0x4a')]?_0x310b28[_0xa024('0x39')]:_0x1ce47b[_0xa024('0x38')];_0x310b28['order']=qs[_0xa024('0x3c')](_0x5431d4[_0xa024('0x35')][_0xa024('0x3c')]);_0x310b28[_0xa024('0x3f')]=qs['filters'](_[_0xa024('0x3d')](_0x5431d4[_0xa024('0x35')],_0x1ce47b[_0xa024('0x36')]));if(_0x5431d4[_0xa024('0x35')][_0xa024('0x3e')]){_0x310b28[_0xa024('0x3f')]=_['merge'](_0x310b28[_0xa024('0x3f')],{'$or':_[_0xa024('0x2f')](_0x310b28[_0xa024('0x39')],function(_0x32c199){var _0x16a9f9={};_0x16a9f9[_0x32c199]={'$like':'%'+_0x5431d4[_0xa024('0x35')]['filter']+'%'};return _0x16a9f9;})});}_0x310b28=_[_0xa024('0x40')]({},_0x310b28,_0x5431d4['options']);return _0x28d2ae[_0xa024('0x8b')](_0x310b28);}})[_0xa024('0x28')](function(_0x1bc7f0){if(_0x1bc7f0){_0x630458=_0x1bc7f0[_0xa024('0x4a')];if(!_0x5431d4['query'][_0xa024('0x3a')](_0xa024('0x3b'))){_0x310b28[_0xa024('0x23')]=qs['limit'](_0x5431d4['query'][_0xa024('0x23')]);_0x310b28[_0xa024('0x21')]=qs[_0xa024('0x21')](_0x5431d4['query']['offset']);}return _0x28d2ae[_0xa024('0x8b')](_0x310b28);}})[_0xa024('0x28')](function(_0x495a02){if(_0x495a02){return _0x495a02?{'count':_0x630458,'rows':_0x495a02}:null;}})[_0xa024('0x28')](respondWithResult(_0x105231,null))[_0xa024('0x47')](handleError(_0x105231,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index dc14b08..06cc808 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 _0x4649=['remove','emit','hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','save','update'];(function(_0x243fbf,_0x445341){var _0x6092ae=function(_0x53b954){while(--_0x53b954){_0x243fbf['push'](_0x243fbf['shift']());}};_0x6092ae(++_0x445341);}(_0x4649,0xff));var _0x9464=function(_0x23257a,_0x5dd3ac){_0x23257a=_0x23257a-0x0;var _0x4303a3=_0x4649[_0x23257a];return _0x4303a3;};'use strict';var EventEmitter=require(_0x9464('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x9464('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9464('0x2')](0x0);var events={'afterCreate':_0x9464('0x3'),'afterUpdate':_0x9464('0x4'),'afterDestroy':_0x9464('0x5')};function emitEvent(_0x18c69a){return function(_0x1a554b,_0x22c1f6,_0x20fddd){MailQueueEvents[_0x9464('0x6')](_0x18c69a+':'+_0x1a554b['id'],_0x1a554b);MailQueueEvents['emit'](_0x18c69a,_0x1a554b);_0x20fddd(null);};}for(var e in events){if(events[_0x9464('0x7')](e)){var event=events[e];MailQueue[_0x9464('0x8')](e,emitEvent(event));}}module[_0x9464('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xcd84=['emit','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xcd84,0x1cf));var _0x4cd8=function(_0x1d3ca8,_0x31cde1){_0x1d3ca8=_0x1d3ca8-0x0;var _0x78b332=_0xcd84[_0x1d3ca8];return _0x78b332;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x4cd8('0x0'))['db'][_0x4cd8('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4cd8('0x2')](0x0);var events={'afterCreate':_0x4cd8('0x3'),'afterUpdate':_0x4cd8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5cfeba){return function(_0x413bf3,_0x5ab61a,_0x4b1c9b){MailQueueEvents['emit'](_0x5cfeba+':'+_0x413bf3['id'],_0x413bf3);MailQueueEvents[_0x4cd8('0x5')](_0x5cfeba,_0x413bf3);_0x4b1c9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9d60656..b671bd2 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 _0x600c=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash','moment','bluebird'];(function(_0x46704c,_0x10504d){var _0x66320c=function(_0x3c42f2){while(--_0x3c42f2){_0x46704c['push'](_0x46704c['shift']());}};_0x66320c(++_0x10504d);}(_0x600c,0x151));var _0xc600=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x600c[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xc600('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc600('0x1'));var BPromise=require(_0xc600('0x2'));var rp=require(_0xc600('0x3'));var fs=require('fs');var path=require(_0xc600('0x4'));var rimraf=require(_0xc600('0x5'));var config=require(_0xc600('0x6'));var attributes=require(_0xc600('0x7'));module[_0xc600('0x8')]=function(_0x3e75d9,_0x2b0a24){return _0x3e75d9['define'](_0xc600('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a66=['mail_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0xd8efb3,_0x504bc9){var _0x1b64e4=function(_0x490083){while(--_0x490083){_0xd8efb3['push'](_0xd8efb3['shift']());}};_0x1b64e4(++_0x504bc9);}(_0x4a66,0x85));var _0x64a6=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x4a66[_0x2d61ac];return _0x3f7d3c;};'use strict';var _=require(_0x64a6('0x0'));var util=require(_0x64a6('0x1'));var logger=require(_0x64a6('0x2'))(_0x64a6('0x3'));var moment=require('moment');var BPromise=require(_0x64a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64a6('0x5'));var rimraf=require(_0x64a6('0x6'));var config=require(_0x64a6('0x7'));var attributes=require(_0x64a6('0x8'));module[_0x64a6('0x9')]=function(_0x265a45,_0x416626){return _0x265a45['define']('MailQueue',attributes,{'tableName':_0x64a6('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 9a13ce2..be38de0 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 _0xa39f=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s'];(function(_0x3b1906,_0x5781dc){var _0x4aea22=function(_0x50a7bb){while(--_0x50a7bb){_0x3b1906['push'](_0x3b1906['shift']());}};_0x4aea22(++_0x5781dc);}(_0xa39f,0x1e4));var _0xfa39=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0xa39f[_0x176317];return _0xef2759;};'use strict';var _=require(_0xfa39('0x0'));var util=require(_0xfa39('0x1'));var moment=require(_0xfa39('0x2'));var BPromise=require('bluebird');var rs=require(_0xfa39('0x3'));var fs=require('fs');var Redis=require(_0xfa39('0x4'));var db=require(_0xfa39('0x5'))['db'];var utils=require(_0xfa39('0x6'));var logger=require(_0xfa39('0x7'))(_0xfa39('0x8'));var config=require(_0xfa39('0x9'));var jayson=require(_0xfa39('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xfa39('0xb')]=_[_0xfa39('0xc')](config[_0xfa39('0xb')],{'host':_0xfa39('0xd'),'port':0x18eb});var socket=require(_0xfa39('0xe'))(new Redis(config['redis']));require(_0xfa39('0xf'))[_0xfa39('0x10')](socket);function respondWithRpcPromise(_0x1a41a4,_0xc9e0b5,_0x239bf0){return new BPromise(function(_0x1d73f9,_0x354f62){return client[_0xfa39('0x11')](_0x1a41a4,_0x239bf0)['then'](function(_0x853c32){logger[_0xfa39('0x12')](_0xfa39('0x13'),_0xc9e0b5,_0xfa39('0x14'));logger[_0xfa39('0x15')](_0xfa39('0x16'),_0xc9e0b5,_0xfa39('0x14'),JSON[_0xfa39('0x17')](_0x853c32));if(_0x853c32[_0xfa39('0x18')]){if(_0x853c32['error']['code']===0x1f4){logger[_0xfa39('0x18')](_0xfa39('0x13'),_0xc9e0b5,_0x853c32[_0xfa39('0x18')]['message']);return _0x354f62(_0x853c32['error'][_0xfa39('0x19')]);}logger[_0xfa39('0x18')]('MailQueue,\x20%s,\x20%s',_0xc9e0b5,_0x853c32['error']['message']);return _0x1d73f9(_0x853c32[_0xfa39('0x18')][_0xfa39('0x19')]);}else{logger[_0xfa39('0x12')]('MailQueue,\x20%s,\x20%s',_0xc9e0b5,_0xfa39('0x14'));_0x1d73f9(_0x853c32[_0xfa39('0x1a')][_0xfa39('0x19')]);}})[_0xfa39('0x1b')](function(_0x37f78e){logger[_0xfa39('0x18')](_0xfa39('0x13'),_0xc9e0b5,_0x37f78e);_0x354f62(_0x37f78e);});});}exports[_0xfa39('0x1c')]=function(_0x5e200b){var _0x10045e=this;return new Promise(function(_0x4f10b6,_0x206b85){return db[_0xfa39('0x1d')][_0xfa39('0x1e')]({'raw':_0x5e200b['options']?_0x5e200b[_0xfa39('0x1f')][_0xfa39('0x20')]===undefined?!![]:![]:!![],'where':_0x5e200b[_0xfa39('0x1f')]?_0x5e200b[_0xfa39('0x1f')][_0xfa39('0x21')]||null:null,'attributes':_0x5e200b[_0xfa39('0x1f')]?_0x5e200b[_0xfa39('0x1f')][_0xfa39('0x22')]||null:null,'limit':_0x5e200b[_0xfa39('0x1f')]?_0x5e200b[_0xfa39('0x1f')][_0xfa39('0x23')]||null:null,'include':_0x5e200b[_0xfa39('0x1f')]?_0x5e200b[_0xfa39('0x1f')][_0xfa39('0x24')]?_[_0xfa39('0x25')](_0x5e200b[_0xfa39('0x1f')][_0xfa39('0x24')],function(_0x3a21be){return{'model':db[_0x3a21be[_0xfa39('0x26')]],'as':_0x3a21be['as'],'attributes':_0x3a21be[_0xfa39('0x22')],'include':_0x3a21be['include']?_[_0xfa39('0x25')](_0x3a21be[_0xfa39('0x24')],function(_0x2f10a7){return{'model':db[_0x2f10a7[_0xfa39('0x26')]],'as':_0x2f10a7['as'],'attributes':_0x2f10a7[_0xfa39('0x22')],'include':_0x2f10a7[_0xfa39('0x24')]?_[_0xfa39('0x25')](_0x2f10a7[_0xfa39('0x24')],function(_0x358fe3){return{'model':db[_0x358fe3[_0xfa39('0x26')]],'as':_0x358fe3['as'],'attributes':_0x358fe3[_0xfa39('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfa39('0x27')](function(_0x44981e){logger['info'](_0xfa39('0x1c'),_0x5e200b);logger[_0xfa39('0x15')](_0xfa39('0x1c'),_0x5e200b,JSON[_0xfa39('0x17')](_0x44981e));_0x4f10b6(_0x44981e);})[_0xfa39('0x1b')](function(_0x541a8b){logger[_0xfa39('0x18')](_0xfa39('0x1c'),_0x541a8b[_0xfa39('0x19')],_0x5e200b);_0x206b85(_0x10045e['error'](0x1f4,_0x541a8b[_0xfa39('0x19')]));});});};exports[_0xfa39('0x28')]=function(_0x59d58e){var _0xf091de=this;return new Promise(function(_0x3dbead,_0x23d5de){return db[_0xfa39('0x1d')][_0xfa39('0x29')]({'raw':_0x59d58e['options']?_0x59d58e['options']['raw']===undefined?!![]:![]:!![],'where':_0x59d58e['options']?_0x59d58e[_0xfa39('0x1f')]['where']||null:null,'attributes':_0x59d58e[_0xfa39('0x1f')]?_0x59d58e['options'][_0xfa39('0x22')]||null:null,'include':_0x59d58e[_0xfa39('0x1f')]?_0x59d58e[_0xfa39('0x1f')][_0xfa39('0x24')]?_[_0xfa39('0x25')](_0x59d58e['options'][_0xfa39('0x24')],function(_0x2d91e2){return{'model':db[_0x2d91e2[_0xfa39('0x26')]],'as':_0x2d91e2['as'],'attributes':_0x2d91e2[_0xfa39('0x22')],'include':_0x2d91e2[_0xfa39('0x24')]?_[_0xfa39('0x25')](_0x2d91e2[_0xfa39('0x24')],function(_0x1eb412){return{'model':db[_0x1eb412[_0xfa39('0x26')]],'as':_0x1eb412['as'],'attributes':_0x1eb412['attributes'],'include':_0x1eb412[_0xfa39('0x24')]?_['map'](_0x1eb412[_0xfa39('0x24')],function(_0x1253a4){return{'model':db[_0x1253a4[_0xfa39('0x26')]],'as':_0x1253a4['as'],'attributes':_0x1253a4[_0xfa39('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfa39('0x27')](function(_0x353d90){logger[_0xfa39('0x12')]('ShowMailQueue',_0x59d58e);logger[_0xfa39('0x15')](_0xfa39('0x28'),_0x59d58e,JSON[_0xfa39('0x17')](_0x353d90));_0x3dbead(_0x353d90);})[_0xfa39('0x1b')](function(_0x136bc5){logger[_0xfa39('0x18')](_0xfa39('0x28'),_0x136bc5[_0xfa39('0x19')],_0x59d58e);_0x23d5de(_0xf091de[_0xfa39('0x18')](0x1f4,_0x136bc5[_0xfa39('0x19')]));});});}; \ No newline at end of file +var _0x6c63=['jayson/promise','http','redis','defaults','localhost','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','raw','options','attributes','limit','map','include','model','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c63,0x1ee));var _0x36c6=function(_0x3b7303,_0x28a6cd){_0x3b7303=_0x3b7303-0x0;var _0x413bf2=_0x6c63[_0x3b7303];return _0x413bf2;};'use strict';var _=require(_0x36c6('0x0'));var util=require(_0x36c6('0x1'));var moment=require(_0x36c6('0x2'));var BPromise=require(_0x36c6('0x3'));var rs=require(_0x36c6('0x4'));var fs=require('fs');var Redis=require(_0x36c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x36c6('0x6'));var logger=require(_0x36c6('0x7'))(_0x36c6('0x8'));var config=require(_0x36c6('0x9'));var jayson=require(_0x36c6('0xa'));var client=jayson['client'][_0x36c6('0xb')]({'port':0x232a});config[_0x36c6('0xc')]=_[_0x36c6('0xd')](config[_0x36c6('0xc')],{'host':_0x36c6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36c6('0xc')]));require('./mailQueue.socket')[_0x36c6('0xf')](socket);function respondWithRpcPromise(_0x4b7ec0,_0x25fcbd,_0xbe21dc){return new BPromise(function(_0x2323b4,_0x17f5c3){return client[_0x36c6('0x10')](_0x4b7ec0,_0xbe21dc)[_0x36c6('0x11')](function(_0x3fe114){logger[_0x36c6('0x12')](_0x36c6('0x13'),_0x25fcbd,_0x36c6('0x14'));logger[_0x36c6('0x15')](_0x36c6('0x16'),_0x25fcbd,_0x36c6('0x14'),JSON[_0x36c6('0x17')](_0x3fe114));if(_0x3fe114['error']){if(_0x3fe114[_0x36c6('0x18')][_0x36c6('0x19')]===0x1f4){logger[_0x36c6('0x18')]('MailQueue,\x20%s,\x20%s',_0x25fcbd,_0x3fe114[_0x36c6('0x18')][_0x36c6('0x1a')]);return _0x17f5c3(_0x3fe114[_0x36c6('0x18')][_0x36c6('0x1a')]);}logger[_0x36c6('0x18')](_0x36c6('0x13'),_0x25fcbd,_0x3fe114[_0x36c6('0x18')][_0x36c6('0x1a')]);return _0x2323b4(_0x3fe114[_0x36c6('0x18')][_0x36c6('0x1a')]);}else{logger['info'](_0x36c6('0x13'),_0x25fcbd,'request\x20sent');_0x2323b4(_0x3fe114[_0x36c6('0x1b')]['message']);}})[_0x36c6('0x1c')](function(_0x396de2){logger[_0x36c6('0x18')]('MailQueue,\x20%s,\x20%s',_0x25fcbd,_0x396de2);_0x17f5c3(_0x396de2);});});}exports[_0x36c6('0x1d')]=function(_0xdee3a5){var _0x981109=this;return new Promise(function(_0x4376c3,_0x4097b1){return db[_0x36c6('0x1e')][_0x36c6('0x1f')]({'raw':_0xdee3a5['options']?_0xdee3a5['options'][_0x36c6('0x20')]===undefined?!![]:![]:!![],'where':_0xdee3a5[_0x36c6('0x21')]?_0xdee3a5['options']['where']||null:null,'attributes':_0xdee3a5[_0x36c6('0x21')]?_0xdee3a5[_0x36c6('0x21')][_0x36c6('0x22')]||null:null,'limit':_0xdee3a5[_0x36c6('0x21')]?_0xdee3a5[_0x36c6('0x21')][_0x36c6('0x23')]||null:null,'include':_0xdee3a5[_0x36c6('0x21')]?_0xdee3a5[_0x36c6('0x21')]['include']?_[_0x36c6('0x24')](_0xdee3a5[_0x36c6('0x21')][_0x36c6('0x25')],function(_0x599db1){return{'model':db[_0x599db1[_0x36c6('0x26')]],'as':_0x599db1['as'],'attributes':_0x599db1[_0x36c6('0x22')],'include':_0x599db1[_0x36c6('0x25')]?_[_0x36c6('0x24')](_0x599db1['include'],function(_0x34b08c){return{'model':db[_0x34b08c['model']],'as':_0x34b08c['as'],'attributes':_0x34b08c[_0x36c6('0x22')],'include':_0x34b08c[_0x36c6('0x25')]?_['map'](_0x34b08c['include'],function(_0x539d99){return{'model':db[_0x539d99[_0x36c6('0x26')]],'as':_0x539d99['as'],'attributes':_0x539d99[_0x36c6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x36c6('0x11')](function(_0x50b21b){logger[_0x36c6('0x12')](_0x36c6('0x1d'),_0xdee3a5);logger[_0x36c6('0x15')](_0x36c6('0x1d'),_0xdee3a5,JSON[_0x36c6('0x17')](_0x50b21b));_0x4376c3(_0x50b21b);})[_0x36c6('0x1c')](function(_0x3c1973){logger[_0x36c6('0x18')](_0x36c6('0x1d'),_0x3c1973[_0x36c6('0x1a')],_0xdee3a5);_0x4097b1(_0x981109[_0x36c6('0x18')](0x1f4,_0x3c1973[_0x36c6('0x1a')]));});});};exports[_0x36c6('0x27')]=function(_0x492ba1){var _0x7f8038=this;return new Promise(function(_0xfffe53,_0x502e84){return db[_0x36c6('0x1e')][_0x36c6('0x28')]({'raw':_0x492ba1[_0x36c6('0x21')]?_0x492ba1['options']['raw']===undefined?!![]:![]:!![],'where':_0x492ba1['options']?_0x492ba1[_0x36c6('0x21')][_0x36c6('0x29')]||null:null,'attributes':_0x492ba1[_0x36c6('0x21')]?_0x492ba1[_0x36c6('0x21')][_0x36c6('0x22')]||null:null,'include':_0x492ba1[_0x36c6('0x21')]?_0x492ba1[_0x36c6('0x21')][_0x36c6('0x25')]?_['map'](_0x492ba1['options'][_0x36c6('0x25')],function(_0x2b9786){return{'model':db[_0x2b9786[_0x36c6('0x26')]],'as':_0x2b9786['as'],'attributes':_0x2b9786[_0x36c6('0x22')],'include':_0x2b9786['include']?_[_0x36c6('0x24')](_0x2b9786['include'],function(_0x1e9ba4){return{'model':db[_0x1e9ba4['model']],'as':_0x1e9ba4['as'],'attributes':_0x1e9ba4[_0x36c6('0x22')],'include':_0x1e9ba4[_0x36c6('0x25')]?_['map'](_0x1e9ba4[_0x36c6('0x25')],function(_0x59c43d){return{'model':db[_0x59c43d[_0x36c6('0x26')]],'as':_0x59c43d['as'],'attributes':_0x59c43d[_0x36c6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x36c6('0x11')](function(_0xcc5b5){logger[_0x36c6('0x12')]('ShowMailQueue',_0x492ba1);logger[_0x36c6('0x15')]('ShowMailQueue',_0x492ba1,JSON[_0x36c6('0x17')](_0xcc5b5));_0xfffe53(_0xcc5b5);})[_0x36c6('0x1c')](function(_0x54475b){logger[_0x36c6('0x18')](_0x36c6('0x27'),_0x54475b[_0x36c6('0x1a')],_0x492ba1);_0x502e84(_0x7f8038['error'](0x1f4,_0x54475b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index cc31b7a..a91cb5f 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 _0xd3f5=['emit','removeListener','length','./mailQueue.events','save','update'];(function(_0x3c1254,_0x34e4f9){var _0x480787=function(_0x2b3f90){while(--_0x2b3f90){_0x3c1254['push'](_0x3c1254['shift']());}};_0x480787(++_0x34e4f9);}(_0xd3f5,0x147));var _0x5d3f=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd3f5[_0x1035c1];return _0x308d67;};'use strict';var MailQueueEvents=require(_0x5d3f('0x0'));var events=[_0x5d3f('0x1'),'remove',_0x5d3f('0x2')];function createListener(_0x175604,_0x346643){return function(_0x432ba1){_0x346643[_0x5d3f('0x3')](_0x175604,_0x432ba1);};}function removeListener(_0x3f663f,_0x413cf4){return function(){MailQueueEvents[_0x5d3f('0x4')](_0x3f663f,_0x413cf4);};}exports['register']=function(_0x1d7b89){for(var _0x4b7986=0x0,_0x2e0ad6=events[_0x5d3f('0x5')];_0x4b7986<_0x2e0ad6;_0x4b7986++){var _0x5791d4=events[_0x4b7986];var _0x1b18bb=createListener('mailQueue:'+_0x5791d4,_0x1d7b89);MailQueueEvents['on'](_0x5791d4,_0x1b18bb);}}; \ No newline at end of file +var _0xddb5=['update','removeListener','register','save','remove'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xddb5,0x120));var _0x5ddb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xddb5[_0x3947c9];return _0x2e7871;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x5ddb('0x0'),_0x5ddb('0x1'),_0x5ddb('0x2')];function createListener(_0x57036e,_0x380956){return function(_0x23aeab){_0x380956['emit'](_0x57036e,_0x23aeab);};}function removeListener(_0x3ac537,_0x30af28){return function(){MailQueueEvents[_0x5ddb('0x3')](_0x3ac537,_0x30af28);};}exports[_0x5ddb('0x4')]=function(_0x492b1a){for(var _0x13c63d=0x0,_0x5b745d=events['length'];_0x13c63d<_0x5b745d;_0x13c63d++){var _0x56d13b=events[_0x13c63d];var _0x371c83=createListener('mailQueue:'+_0x56d13b,_0x492b1a);MailQueueEvents['on'](_0x56d13b,_0x371c83);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7157816..2aacebd 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 _0xc311=['get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller'];(function(_0x6c39d7,_0x52bda7){var _0x8501=function(_0x3dca6a){while(--_0x3dca6a){_0x6c39d7['push'](_0x6c39d7['shift']());}};_0x8501(++_0x52bda7);}(_0xc311,0xbe));var _0x1c31=function(_0x33bb52,_0x47695e){_0x33bb52=_0x33bb52-0x0;var _0x42fd93=_0xc311[_0x33bb52];return _0x42fd93;};'use strict';var multer=require(_0x1c31('0x0'));var util=require(_0x1c31('0x1'));var path=require(_0x1c31('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c31('0x3'));var router=express['Router']();var fs_extra=require(_0x1c31('0x4'));var auth=require(_0x1c31('0x5'));var interaction=require(_0x1c31('0x6'));var config=require('../../config/environment');var controller=require(_0x1c31('0x7'));router[_0x1c31('0x8')]('/',auth[_0x1c31('0x9')](),controller['index']);router['get'](_0x1c31('0xa'),auth[_0x1c31('0x9')](),controller[_0x1c31('0xb')]);router[_0x1c31('0x8')](_0x1c31('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1c31('0xd')]);router[_0x1c31('0xe')](_0x1c31('0xc'),auth[_0x1c31('0x9')](),controller[_0x1c31('0xf')]);router[_0x1c31('0x10')](_0x1c31('0xc'),auth[_0x1c31('0x9')](),controller['destroy']);module[_0x1c31('0x11')]=router; \ No newline at end of file +var _0x86d5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','post','create','put','update','delete','exports','connect-timeout','express'];(function(_0x35cc97,_0x22035f){var _0x35a18a=function(_0x27417f){while(--_0x27417f){_0x35cc97['push'](_0x35cc97['shift']());}};_0x35a18a(++_0x22035f);}(_0x86d5,0xb2));var _0x586d=function(_0xa1a0b1,_0x10d6f6){_0xa1a0b1=_0xa1a0b1-0x0;var _0x22dea3=_0x86d5[_0xa1a0b1];return _0x22dea3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x586d('0x0'));var express=require(_0x586d('0x1'));var router=express[_0x586d('0x2')]();var fs_extra=require(_0x586d('0x3'));var auth=require(_0x586d('0x4'));var interaction=require(_0x586d('0x5'));var config=require(_0x586d('0x6'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x586d('0x7')](),controller[_0x586d('0x8')]);router[_0x586d('0x9')]('/describe',auth[_0x586d('0x7')](),controller[_0x586d('0xa')]);router[_0x586d('0x9')](_0x586d('0xb'),auth[_0x586d('0x7')](),controller['show']);router[_0x586d('0xc')]('/',auth[_0x586d('0x7')](),controller[_0x586d('0xd')]);router[_0x586d('0xe')](_0x586d('0xb'),auth[_0x586d('0x7')](),controller[_0x586d('0xf')]);router[_0x586d('0x10')](_0x586d('0xb'),auth[_0x586d('0x7')](),controller['destroy']);module[_0x586d('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index db14da0..e9bf893 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 _0xfa41=['DATE','sequelize','exports','STRING'];(function(_0x991bc6,_0x5c7c8a){var _0x41b252=function(_0x66e68a){while(--_0x66e68a){_0x991bc6['push'](_0x991bc6['shift']());}};_0x41b252(++_0x5c7c8a);}(_0xfa41,0xd1));var _0x1fa4=function(_0x16d3f8,_0x3f5dd3){_0x16d3f8=_0x16d3f8-0x0;var _0x49a172=_0xfa41[_0x16d3f8];return _0x49a172;};'use strict';var moment=require('moment');var Sequelize=require(_0x1fa4('0x0'));module[_0x1fa4('0x1')]={'uniqueid':{'type':Sequelize[_0x1fa4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1fa4('0x3')]},'leaveAt':{'type':Sequelize[_0x1fa4('0x3')]},'acceptAt':{'type':Sequelize[_0x1fa4('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1fa4('0x2')]}}; \ No newline at end of file +var _0x064a=['moment','sequelize','exports','STRING','DATE'];(function(_0x4e0b87,_0x1de9ab){var _0x54d25b=function(_0x2f05da){while(--_0x2f05da){_0x4e0b87['push'](_0x4e0b87['shift']());}};_0x54d25b(++_0x1de9ab);}(_0x064a,0x17c));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xa064('0x0'));var Sequelize=require(_0xa064('0x1'));module[_0xa064('0x2')]={'uniqueid':{'type':Sequelize[_0xa064('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa064('0x3')]},'joinAt':{'type':Sequelize[_0xa064('0x4')]},'leaveAt':{'type':Sequelize[_0xa064('0x4')]},'acceptAt':{'type':Sequelize[_0xa064('0x4')]},'exitAt':{'type':Sequelize[_0xa064('0x4')]},'reason':{'type':Sequelize[_0xa064('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ee22cb1..deecdaa 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 _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x2db466,_0x228988){_0x2db466=_0x2db466-0x0;var _0x414add=_0xbbbc[_0x2db466];return _0x414add;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['MailQueueReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['MailQueueReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','MailQueueReport','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x6343,0x168));var _0x3634=function(_0xcf6294,_0x5f2d25){_0xcf6294=_0xcf6294-0x0;var _0x15a655=_0x6343[_0xcf6294];return _0x15a655;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['MailQueueReport'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':!![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['MailQueueReport'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index aff667e..e84d439 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 _0x51b4=['api','moment','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x45b2f7,_0x5e71c3){var _0x474f89=function(_0x5afcd0){while(--_0x5afcd0){_0x45b2f7['push'](_0x45b2f7['shift']());}};_0x474f89(++_0x5e71c3);}(_0x51b4,0x1a1));var _0x451b=function(_0x1293e5,_0x38df59){_0x1293e5=_0x1293e5-0x0;var _0x14ed9a=_0x51b4[_0x1293e5];return _0x14ed9a;};'use strict';var _=require(_0x451b('0x0'));var util=require(_0x451b('0x1'));var logger=require(_0x451b('0x2'))(_0x451b('0x3'));var moment=require(_0x451b('0x4'));var BPromise=require(_0x451b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x451b('0x6'));var rimraf=require('rimraf');var config=require(_0x451b('0x7'));var attributes=require(_0x451b('0x8'));module[_0x451b('0x9')]=function(_0x1ddd3f,_0x279999){return _0x1ddd3f[_0x451b('0xa')](_0x451b('0xb'),attributes,{'tableName':_0x451b('0xc'),'paranoid':![],'indexes':[{'name':_0x451b('0xd'),'fields':[_0x451b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48bd=['define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','bluebird','rimraf','exports'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x48bd,0x1bb));var _0xd48b=function(_0x4c5de5,_0x511138){_0x4c5de5=_0x4c5de5-0x0;var _0x51cb06=_0x48bd[_0x4c5de5];return _0x51cb06;};'use strict';var _=require(_0xd48b('0x0'));var util=require(_0xd48b('0x1'));var logger=require(_0xd48b('0x2'))(_0xd48b('0x3'));var moment=require('moment');var BPromise=require(_0xd48b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd48b('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xd48b('0x6')]=function(_0x2083aa,_0x132b6f){return _0x2083aa[_0xd48b('0x7')](_0xd48b('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xd48b('0x9'),'fields':[_0xd48b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 2eeda27..0696dcd 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x57d817,_0x50d0bc){var _0x6ea0d9=function(_0x270345){while(--_0x270345){_0x57d817['push'](_0x57d817['shift']());}};_0x6ea0d9(++_0x50d0bc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x29e124,_0xd208cd){var _0x1371b3=function(_0x1db050){while(--_0x1db050){_0x29e124['push'](_0x29e124['shift']());}};_0x1371b3(++_0xd208cd);}(_0x1261,0x144));var _0x1126=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x1261[_0x4e6eac];return _0x79f963;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 305b165..a21304f 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x17e849,_0x588a88){var _0x35d503=function(_0x1d7eb7){while(--_0x1d7eb7){_0x17e849['push'](_0x17e849['shift']());}};_0x35d503(++_0x588a88);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1fc6a81..36bb8ec 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 _0xaaa2=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x4d4fee,_0x5e9b97){var _0x2e2381=function(_0x2e42b6){while(--_0x2e42b6){_0x4d4fee['push'](_0x4d4fee['shift']());}};_0x2e2381(++_0x5e9b97);}(_0xaaa2,0xac));var _0x2aaa=function(_0x3c2511,_0x475055){_0x3c2511=_0x3c2511-0x0;var _0x1ae52d=_0xaaa2[_0x3c2511];return _0x1ae52d;};'use strict';var Sequelize=require(_0x2aaa('0x0'));module[_0x2aaa('0x1')]={'description':{'type':Sequelize[_0x2aaa('0x2')]},'host':{'type':Sequelize[_0x2aaa('0x2')]},'authentication':{'type':Sequelize[_0x2aaa('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2aaa('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2aaa('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2aaa('0x2')],'defaultValue':_0x2aaa('0x5')},'connTimeout':{'type':Sequelize[_0x2aaa('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2aaa('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2aaa('0x2')]}}; \ No newline at end of file +var _0xd64b=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x809fe5,_0x476534){var _0x3c8d4d=function(_0xdd2d9c){while(--_0xdd2d9c){_0x809fe5['push'](_0x809fe5['shift']());}};_0x3c8d4d(++_0x476534);}(_0xd64b,0xc1));var _0xbd64=function(_0x2d0d68,_0x11e7ab){_0x2d0d68=_0x2d0d68-0x0;var _0xb8b405=_0xd64b[_0x2d0d68];return _0xb8b405;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'description':{'type':Sequelize[_0xbd64('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xbd64('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbd64('0x1')]},'password':{'type':Sequelize[_0xbd64('0x1')]},'port':{'type':Sequelize[_0xbd64('0x3')]},'tls':{'type':Sequelize[_0xbd64('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xbd64('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2cca045..0ed7f2e 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 _0x9037=['lodash','../../config/logger','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x9037,0x90));var _0x7903=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9037[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7903('0x0'));var util=require('util');var logger=require(_0x7903('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7903('0x2'));var rimraf=require(_0x7903('0x3'));var config=require(_0x7903('0x4'));var attributes=require(_0x7903('0x5'));module[_0x7903('0x6')]=function(_0x18cdc5,_0x4f6725){return _0x18cdc5['define'](_0x7903('0x7'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x547f=['./mailServerIn.attributes','exports','define','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x547f,0x193));var _0xf547=function(_0x22b86c,_0x16ff4c){_0x22b86c=_0x22b86c-0x0;var _0x24143a=_0x547f[_0x22b86c];return _0x24143a;};'use strict';var _=require(_0xf547('0x0'));var util=require(_0xf547('0x1'));var logger=require('../../config/logger')(_0xf547('0x2'));var moment=require('moment');var BPromise=require(_0xf547('0x3'));var rp=require(_0xf547('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf547('0x5'));var config=require(_0xf547('0x6'));var attributes=require(_0xf547('0x7'));module[_0xf547('0x8')]=function(_0x50c365,_0x906fd9){return _0x50c365[_0xf547('0x9')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 7701ce2..07ab237 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 _0x86a8=['model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','map'];(function(_0x31a7b9,_0x1894b9){var _0x13b914=function(_0x33c816){while(--_0x33c816){_0x31a7b9['push'](_0x31a7b9['shift']());}};_0x13b914(++_0x1894b9);}(_0x86a8,0x1ae));var _0x886a=function(_0x4f1e98,_0x9d63da){_0x4f1e98=_0x4f1e98-0x0;var _0x24f84e=_0x86a8[_0x4f1e98];return _0x24f84e;};'use strict';var _=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var moment=require(_0x886a('0x2'));var BPromise=require(_0x886a('0x3'));var rs=require(_0x886a('0x4'));var fs=require('fs');var Redis=require(_0x886a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x886a('0x6'));var logger=require(_0x886a('0x7'))('rpc');var config=require(_0x886a('0x8'));var jayson=require(_0x886a('0x9'));var client=jayson['client'][_0x886a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x572c8e,_0x31434c,_0x557bcb){return new BPromise(function(_0x752eed,_0x10641b){return client[_0x886a('0xb')](_0x572c8e,_0x557bcb)[_0x886a('0xc')](function(_0x22d3c0){logger[_0x886a('0xd')](_0x886a('0xe'),_0x31434c,_0x886a('0xf'));logger[_0x886a('0x10')](_0x886a('0x11'),_0x31434c,'request\x20sent',JSON[_0x886a('0x12')](_0x22d3c0));if(_0x22d3c0[_0x886a('0x13')]){if(_0x22d3c0[_0x886a('0x13')][_0x886a('0x14')]===0x1f4){logger['error'](_0x886a('0xe'),_0x31434c,_0x22d3c0[_0x886a('0x13')][_0x886a('0x15')]);return _0x10641b(_0x22d3c0[_0x886a('0x13')][_0x886a('0x15')]);}logger[_0x886a('0x13')](_0x886a('0xe'),_0x31434c,_0x22d3c0[_0x886a('0x13')][_0x886a('0x15')]);return _0x752eed(_0x22d3c0[_0x886a('0x13')]['message']);}else{logger[_0x886a('0xd')](_0x886a('0xe'),_0x31434c,_0x886a('0xf'));_0x752eed(_0x22d3c0[_0x886a('0x16')]['message']);}})[_0x886a('0x17')](function(_0x435cec){logger['error'](_0x886a('0xe'),_0x31434c,_0x435cec);_0x10641b(_0x435cec);});});}exports[_0x886a('0x18')]=function(_0x49cfa1){var _0x36c4c7=this;return new Promise(function(_0x36fca3,_0x157a45){return db[_0x886a('0x19')][_0x886a('0x1a')]({'raw':_0x49cfa1['options']?_0x49cfa1[_0x886a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x49cfa1[_0x886a('0x1b')]?_0x49cfa1[_0x886a('0x1b')][_0x886a('0x1c')]||null:null,'attributes':_0x49cfa1[_0x886a('0x1b')]?_0x49cfa1['options'][_0x886a('0x1d')]||null:null,'limit':_0x49cfa1['options']?_0x49cfa1[_0x886a('0x1b')]['limit']||null:null,'include':_0x49cfa1['options']?_0x49cfa1[_0x886a('0x1b')][_0x886a('0x1e')]?_[_0x886a('0x1f')](_0x49cfa1[_0x886a('0x1b')][_0x886a('0x1e')],function(_0x1b70fa){return{'model':db[_0x1b70fa['model']],'as':_0x1b70fa['as'],'attributes':_0x1b70fa[_0x886a('0x1d')],'include':_0x1b70fa[_0x886a('0x1e')]?_['map'](_0x1b70fa[_0x886a('0x1e')],function(_0x25125c){return{'model':db[_0x25125c['model']],'as':_0x25125c['as'],'attributes':_0x25125c[_0x886a('0x1d')],'include':_0x25125c['include']?_['map'](_0x25125c[_0x886a('0x1e')],function(_0xa7f244){return{'model':db[_0xa7f244[_0x886a('0x20')]],'as':_0xa7f244['as'],'attributes':_0xa7f244[_0x886a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x886a('0xc')](function(_0x1c6173){logger['info'](_0x886a('0x18'),_0x49cfa1);logger[_0x886a('0x10')](_0x886a('0x18'),_0x49cfa1,JSON[_0x886a('0x12')](_0x1c6173));_0x36fca3(_0x1c6173);})[_0x886a('0x17')](function(_0x5ae29e){logger[_0x886a('0x13')](_0x886a('0x18'),_0x5ae29e[_0x886a('0x15')],_0x49cfa1);_0x157a45(_0x36c4c7[_0x886a('0x13')](0x1f4,_0x5ae29e[_0x886a('0x15')]));});});}; \ No newline at end of file +var _0x552a=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','info','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x552a,0xaf));var _0xa552=function(_0x500140,_0x3c574e){_0x500140=_0x500140-0x0;var _0x174ec7=_0x552a[_0x500140];return _0x174ec7;};'use strict';var _=require('lodash');var util=require(_0xa552('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa552('0x1'));var fs=require('fs');var Redis=require(_0xa552('0x2'));var db=require(_0xa552('0x3'))['db'];var utils=require(_0xa552('0x4'));var logger=require('../../config/logger')(_0xa552('0x5'));var config=require('../../config/environment');var jayson=require(_0xa552('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a55bb,_0x341054,_0x42ae3e){return new BPromise(function(_0x26cacf,_0x400561){return client[_0xa552('0x7')](_0x5a55bb,_0x42ae3e)[_0xa552('0x8')](function(_0x47546d){logger['info'](_0xa552('0x9'),_0x341054,_0xa552('0xa'));logger[_0xa552('0xb')](_0xa552('0xc'),_0x341054,_0xa552('0xa'),JSON[_0xa552('0xd')](_0x47546d));if(_0x47546d[_0xa552('0xe')]){if(_0x47546d[_0xa552('0xe')][_0xa552('0xf')]===0x1f4){logger[_0xa552('0xe')]('MailServerIn,\x20%s,\x20%s',_0x341054,_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);return _0x400561(_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);}logger[_0xa552('0xe')]('MailServerIn,\x20%s,\x20%s',_0x341054,_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);return _0x26cacf(_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);}else{logger['info'](_0xa552('0x9'),_0x341054,_0xa552('0xa'));_0x26cacf(_0x47546d[_0xa552('0x11')][_0xa552('0x10')]);}})['catch'](function(_0x169be4){logger[_0xa552('0xe')](_0xa552('0x9'),_0x341054,_0x169be4);_0x400561(_0x169be4);});});}exports[_0xa552('0x12')]=function(_0x5780ad){var _0x2db3df=this;return new Promise(function(_0x1cdb04,_0x3616f9){return db[_0xa552('0x13')][_0xa552('0x14')]({'raw':_0x5780ad[_0xa552('0x15')]?_0x5780ad['options'][_0xa552('0x16')]===undefined?!![]:![]:!![],'where':_0x5780ad['options']?_0x5780ad[_0xa552('0x15')][_0xa552('0x17')]||null:null,'attributes':_0x5780ad[_0xa552('0x15')]?_0x5780ad['options'][_0xa552('0x18')]||null:null,'limit':_0x5780ad[_0xa552('0x15')]?_0x5780ad[_0xa552('0x15')][_0xa552('0x19')]||null:null,'include':_0x5780ad[_0xa552('0x15')]?_0x5780ad[_0xa552('0x15')][_0xa552('0x1a')]?_['map'](_0x5780ad[_0xa552('0x15')][_0xa552('0x1a')],function(_0x575a62){return{'model':db[_0x575a62[_0xa552('0x1b')]],'as':_0x575a62['as'],'attributes':_0x575a62['attributes'],'include':_0x575a62[_0xa552('0x1a')]?_[_0xa552('0x1c')](_0x575a62[_0xa552('0x1a')],function(_0xf4d071){return{'model':db[_0xf4d071[_0xa552('0x1b')]],'as':_0xf4d071['as'],'attributes':_0xf4d071['attributes'],'include':_0xf4d071[_0xa552('0x1a')]?_['map'](_0xf4d071['include'],function(_0x36a048){return{'model':db[_0x36a048['model']],'as':_0x36a048['as'],'attributes':_0x36a048[_0xa552('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa552('0x8')](function(_0x5e20e2){logger[_0xa552('0x1d')](_0xa552('0x12'),_0x5780ad);logger[_0xa552('0xb')](_0xa552('0x12'),_0x5780ad,JSON[_0xa552('0xd')](_0x5e20e2));_0x1cdb04(_0x5e20e2);})[_0xa552('0x1e')](function(_0xd1afcf){logger[_0xa552('0xe')]('GetMailServerIn',_0xd1afcf[_0xa552('0x10')],_0x5780ad);_0x3616f9(_0x2db3df[_0xa552('0xe')](0x1f4,_0xd1afcf[_0xa552('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index caaf4c6..e1f45c4 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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7a54,0x106));var _0x47a5=function(_0xd8faa6,_0x1379c4){_0xd8faa6=_0xd8faa6-0x0;var _0xc0194=_0x7a54[_0xd8faa6];return _0xc0194;};'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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 06df94b..7f91978 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 _0xd0bd=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x188be2,_0x353598){var _0x1d1fca=function(_0x1bcc9f){while(--_0x1bcc9f){_0x188be2['push'](_0x188be2['shift']());}};_0x1d1fca(++_0x353598);}(_0xd0bd,0x191));var _0xdd0b=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xd0bd[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0xdd0b('0x0'));module[_0xdd0b('0x1')]={'description':{'type':Sequelize[_0xdd0b('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdd0b('0x3')]},'secure':{'type':Sequelize[_0xdd0b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xdd0b('0x2')]},'authentication':{'type':Sequelize[_0xdd0b('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc577=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0xdcd260,_0x6199a3){var _0x410169=function(_0x73ceee){while(--_0x73ceee){_0xdcd260['push'](_0xdcd260['shift']());}};_0x410169(++_0x6199a3);}(_0xc577,0x128));var _0x7c57=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0xc577[_0x33ca22];return _0x1790c3;};'use strict';var Sequelize=require(_0x7c57('0x0'));module[_0x7c57('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x7c57('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7c57('0x3')]},'secure':{'type':Sequelize[_0x7c57('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d1b5562..d9c02d0 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 _0x198e=['params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0xf5bd85,_0x160670){var _0x3023b1=function(_0x2b5833){while(--_0x2b5833){_0xf5bd85['push'](_0xf5bd85['shift']());}};_0x3023b1(++_0x160670);}(_0x198e,0x90));var _0xe198=function(_0xa0a1ab,_0x6d0eb7){_0xa0a1ab=_0xa0a1ab-0x0;var _0x3d57aa=_0x198e[_0xa0a1ab];return _0x3d57aa;};'use strict';var emlformat=require(_0xe198('0x0'));var rimraf=require(_0xe198('0x1'));var zipdir=require(_0xe198('0x2'));var jsonpatch=require(_0xe198('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe198('0x4'));var Mustache=require(_0xe198('0x5'));var util=require(_0xe198('0x6'));var path=require('path');var sox=require(_0xe198('0x7'));var csv=require('to-csv');var ejs=require(_0xe198('0x8'));var fs=require('fs');var fs_extra=require(_0xe198('0x9'));var _=require(_0xe198('0xa'));var squel=require(_0xe198('0xb'));var crypto=require(_0xe198('0xc'));var jsforce=require(_0xe198('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe198('0xe'));var querystring=require('querystring');var Papa=require(_0xe198('0xf'));var Redis=require(_0xe198('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe198('0x11'));var as=require(_0xe198('0x12'));var hardwareService=require(_0xe198('0x13'));var logger=require('../../config/logger')(_0xe198('0x14'));var utils=require(_0xe198('0x15'));var config=require(_0xe198('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2bd,_0x175d0a){_0x175d0a=_0x175d0a||0xcc;return function(_0x3acb82){if(_0x3acb82){return _0x4f2bd[_0xe198('0x17')](_0x175d0a);}return _0x4f2bd[_0xe198('0x18')](_0x175d0a)[_0xe198('0x19')]();};}function respondWithResult(_0x21f2d4,_0x113a83){_0x113a83=_0x113a83||0xc8;return function(_0x46a16a){if(_0x46a16a){return _0x21f2d4[_0xe198('0x18')](_0x113a83)[_0xe198('0x1a')](_0x46a16a);}};}function respondWithFilteredResult(_0x386045,_0x17f9d4){return function(_0x227cf2){if(_0x227cf2){var _0x10fb95=typeof _0x17f9d4[_0xe198('0x1b')]===_0xe198('0x1c')&&typeof _0x17f9d4[_0xe198('0x1d')]===_0xe198('0x1c');var _0x40a94a=_0x227cf2['count'];var _0x4cdd03=_0x10fb95?0x0:_0x17f9d4[_0xe198('0x1b')];var _0x244094=_0x10fb95?_0x227cf2['count']:_0x17f9d4[_0xe198('0x1b')]+_0x17f9d4[_0xe198('0x1d')];var _0x4f8ed8;if(_0x244094>=_0x40a94a){_0x244094=_0x40a94a;_0x4f8ed8=0xc8;}else{_0x4f8ed8=0xce;}_0x386045[_0xe198('0x18')](_0x4f8ed8);return _0x386045['set'](_0xe198('0x1e'),_0x4cdd03+'-'+_0x244094+'/'+_0x40a94a)['json'](_0x227cf2);}return null;};}function patchUpdates(_0x902e45){return function(_0x1ea114){try{jsonpatch[_0xe198('0x1f')](_0x1ea114,_0x902e45,!![]);}catch(_0x337f50){return BPromise[_0xe198('0x20')](_0x337f50);}return _0x1ea114['save']();};}function saveUpdates(_0x1c7095,_0x34cc95){return function(_0xabbdbc){if(_0xabbdbc){return _0xabbdbc['update'](_0x1c7095)[_0xe198('0x21')](function(_0x219751){return _0x219751;});}return null;};}function removeEntity(_0x47d8a1,_0x384e7f){return function(_0x4ee6d3){if(_0x4ee6d3){return _0x4ee6d3[_0xe198('0x22')]()[_0xe198('0x21')](function(){_0x47d8a1[_0xe198('0x18')](0xcc)[_0xe198('0x19')]();});}};}function handleEntityNotFound(_0x3485c0,_0x47a531){return function(_0x3d494d){if(!_0x3d494d){_0x3485c0['sendStatus'](0x194);}return _0x3d494d;};}function handleError(_0x38e2fe,_0x1c8225){_0x1c8225=_0x1c8225||0x1f4;return function(_0x5d5bc8){logger['error'](_0x5d5bc8[_0xe198('0x23')]);if(_0x5d5bc8[_0xe198('0x24')]){delete _0x5d5bc8['name'];}_0x38e2fe[_0xe198('0x18')](_0x1c8225)[_0xe198('0x25')](_0x5d5bc8);};}exports[_0xe198('0x26')]=function(_0x2a77b7,_0x12f5d0){var _0x24e9b6={},_0x5235da={},_0x576db1={'count':0x0,'rows':[]};var _0x31a1d1=_[_0xe198('0x27')](db[_0xe198('0x28')][_0xe198('0x29')],function(_0x118e09){return{'name':_0x118e09[_0xe198('0x2a')],'type':_0x118e09[_0xe198('0x2b')][_0xe198('0x2c')]};});_0x5235da[_0xe198('0x2d')]=_[_0xe198('0x27')](_0x31a1d1,_0xe198('0x24'));_0x5235da[_0xe198('0x2e')]=_[_0xe198('0x2f')](_0x2a77b7[_0xe198('0x2e')]);_0x5235da[_0xe198('0x30')]=_[_0xe198('0x31')](_0x5235da['model'],_0x5235da[_0xe198('0x2e')]);_0x24e9b6[_0xe198('0x32')]=_[_0xe198('0x31')](_0x5235da[_0xe198('0x2d')],qs[_0xe198('0x33')](_0x2a77b7[_0xe198('0x2e')][_0xe198('0x33')]));_0x24e9b6[_0xe198('0x32')]=_0x24e9b6[_0xe198('0x32')][_0xe198('0x34')]?_0x24e9b6[_0xe198('0x32')]:_0x5235da[_0xe198('0x2d')];if(!_0x2a77b7[_0xe198('0x2e')][_0xe198('0x35')]('nolimit')){_0x24e9b6[_0xe198('0x1d')]=qs['limit'](_0x2a77b7['query'][_0xe198('0x1d')]);_0x24e9b6['offset']=qs[_0xe198('0x1b')](_0x2a77b7[_0xe198('0x2e')][_0xe198('0x1b')]);}_0x24e9b6[_0xe198('0x36')]=qs[_0xe198('0x37')](_0x2a77b7[_0xe198('0x2e')][_0xe198('0x37')]);_0x24e9b6[_0xe198('0x38')]=qs[_0xe198('0x30')](_[_0xe198('0x39')](_0x2a77b7[_0xe198('0x2e')],_0x5235da[_0xe198('0x30')]),_0x31a1d1);if(_0x2a77b7[_0xe198('0x2e')]['filter']){_0x24e9b6['where']=_[_0xe198('0x3a')](_0x24e9b6[_0xe198('0x38')],{'$or':_[_0xe198('0x27')](_0x31a1d1,function(_0x42aad2){if(_0x42aad2[_0xe198('0x2b')]!==_0xe198('0x3b')){var _0x333e25={};_0x333e25[_0x42aad2[_0xe198('0x24')]]={'$like':'%'+_0x2a77b7['query']['filter']+'%'};return _0x333e25;}})});}_0x24e9b6=_[_0xe198('0x3a')]({},_0x24e9b6,_0x2a77b7[_0xe198('0x3c')]);var _0x4f8601={'where':_0x24e9b6[_0xe198('0x38')]};return db['MailServerOut']['count'](_0x4f8601)[_0xe198('0x21')](function(_0x15cd34){_0x576db1['count']=_0x15cd34;if(_0x2a77b7[_0xe198('0x2e')][_0xe198('0x3d')]){_0x24e9b6[_0xe198('0x3e')]=[{'all':!![]}];}return db[_0xe198('0x28')]['findAll'](_0x24e9b6);})[_0xe198('0x21')](function(_0x4cc56a){_0x576db1[_0xe198('0x3f')]=_0x4cc56a;return _0x576db1;})[_0xe198('0x21')](respondWithFilteredResult(_0x12f5d0,_0x24e9b6))[_0xe198('0x40')](handleError(_0x12f5d0,null));};exports[_0xe198('0x41')]=function(_0x320bf9,_0x15cc66){var _0x13ce55={'raw':!![],'where':{'id':_0x320bf9[_0xe198('0x42')]['id']}},_0x130782={};_0x130782[_0xe198('0x2d')]=_[_0xe198('0x2f')](db[_0xe198('0x28')]['rawAttributes']);_0x130782[_0xe198('0x2e')]=_['keys'](_0x320bf9['query']);_0x130782[_0xe198('0x30')]=_[_0xe198('0x31')](_0x130782[_0xe198('0x2d')],_0x130782['query']);_0x13ce55[_0xe198('0x32')]=_['intersection'](_0x130782[_0xe198('0x2d')],qs[_0xe198('0x33')](_0x320bf9[_0xe198('0x2e')][_0xe198('0x33')]));_0x13ce55['attributes']=_0x13ce55['attributes'][_0xe198('0x34')]?_0x13ce55[_0xe198('0x32')]:_0x130782['model'];if(_0x320bf9[_0xe198('0x2e')][_0xe198('0x3d')]){_0x13ce55['include']=[{'all':!![]}];}_0x13ce55=_[_0xe198('0x3a')]({},_0x13ce55,_0x320bf9[_0xe198('0x3c')]);return db[_0xe198('0x28')]['find'](_0x13ce55)[_0xe198('0x21')](handleEntityNotFound(_0x15cc66,null))[_0xe198('0x21')](respondWithResult(_0x15cc66,null))[_0xe198('0x40')](handleError(_0x15cc66,null));};exports[_0xe198('0x43')]=function(_0x28b980,_0x212c73){return db[_0xe198('0x28')][_0xe198('0x43')](_0x28b980['body'],{})[_0xe198('0x21')](respondWithResult(_0x212c73,0xc9))['catch'](handleError(_0x212c73,null));};exports['update']=function(_0x2a6b9f,_0x47600b){if(_0x2a6b9f[_0xe198('0x44')]['id']){delete _0x2a6b9f[_0xe198('0x44')]['id'];}return db[_0xe198('0x28')][_0xe198('0x45')]({'where':{'id':_0x2a6b9f[_0xe198('0x42')]['id']}})[_0xe198('0x21')](handleEntityNotFound(_0x47600b,null))[_0xe198('0x21')](saveUpdates(_0x2a6b9f[_0xe198('0x44')],null))[_0xe198('0x21')](respondWithResult(_0x47600b,null))['catch'](handleError(_0x47600b,null));};exports['destroy']=function(_0x266f12,_0x4d1c78){return db[_0xe198('0x28')][_0xe198('0x45')]({'where':{'id':_0x266f12[_0xe198('0x42')]['id']}})[_0xe198('0x21')](handleEntityNotFound(_0x4d1c78,null))[_0xe198('0x21')](removeEntity(_0x4d1c78,null))['catch'](handleError(_0x4d1c78,null));}; \ No newline at end of file +var _0xb7c1=['fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','rawAttributes','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x4a6975,_0x4b06ce){var _0x1b38a8=function(_0x3a196d){while(--_0x3a196d){_0x4a6975['push'](_0x4a6975['shift']());}};_0x1b38a8(++_0x4b06ce);}(_0xb7c1,0x1b7));var _0x1b7c=function(_0x5a2e73,_0x43714e){_0x5a2e73=_0x5a2e73-0x0;var _0x2a7a47=_0xb7c1[_0x5a2e73];return _0x2a7a47;};'use strict';var emlformat=require(_0x1b7c('0x0'));var rimraf=require(_0x1b7c('0x1'));var zipdir=require(_0x1b7c('0x2'));var jsonpatch=require(_0x1b7c('0x3'));var rp=require('request-promise');var moment=require(_0x1b7c('0x4'));var BPromise=require(_0x1b7c('0x5'));var Mustache=require(_0x1b7c('0x6'));var util=require(_0x1b7c('0x7'));var path=require(_0x1b7c('0x8'));var sox=require('sox');var csv=require(_0x1b7c('0x9'));var ejs=require(_0x1b7c('0xa'));var fs=require('fs');var fs_extra=require(_0x1b7c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b7c('0xc'));var deskjs=require(_0x1b7c('0xd'));var toCsv=require(_0x1b7c('0x9'));var querystring=require(_0x1b7c('0xe'));var Papa=require(_0x1b7c('0xf'));var Redis=require(_0x1b7c('0x10'));var authService=require(_0x1b7c('0x11'));var qs=require(_0x1b7c('0x12'));var as=require(_0x1b7c('0x13'));var hardwareService=require(_0x1b7c('0x14'));var logger=require(_0x1b7c('0x15'))(_0x1b7c('0x16'));var utils=require(_0x1b7c('0x17'));var config=require(_0x1b7c('0x18'));var licenseUtil=require(_0x1b7c('0x19'));var db=require(_0x1b7c('0x1a'))['db'];function respondWithStatusCode(_0x46ae5f,_0x1e003c){_0x1e003c=_0x1e003c||0xcc;return function(_0x222846){if(_0x222846){return _0x46ae5f[_0x1b7c('0x1b')](_0x1e003c);}return _0x46ae5f[_0x1b7c('0x1c')](_0x1e003c)[_0x1b7c('0x1d')]();};}function respondWithResult(_0x55ebb0,_0x323898){_0x323898=_0x323898||0xc8;return function(_0x3ac70a){if(_0x3ac70a){return _0x55ebb0[_0x1b7c('0x1c')](_0x323898)[_0x1b7c('0x1e')](_0x3ac70a);}};}function respondWithFilteredResult(_0x4a0084,_0x57aa62){return function(_0x584595){if(_0x584595){var _0xe9ad42=typeof _0x57aa62[_0x1b7c('0x1f')]==='undefined'&&typeof _0x57aa62[_0x1b7c('0x20')]==='undefined';var _0x5c1b68=_0x584595[_0x1b7c('0x21')];var _0x10d6f3=_0xe9ad42?0x0:_0x57aa62[_0x1b7c('0x1f')];var _0x56fd92=_0xe9ad42?_0x584595['count']:_0x57aa62[_0x1b7c('0x1f')]+_0x57aa62[_0x1b7c('0x20')];var _0x1dc05d;if(_0x56fd92>=_0x5c1b68){_0x56fd92=_0x5c1b68;_0x1dc05d=0xc8;}else{_0x1dc05d=0xce;}_0x4a0084[_0x1b7c('0x1c')](_0x1dc05d);return _0x4a0084[_0x1b7c('0x22')](_0x1b7c('0x23'),_0x10d6f3+'-'+_0x56fd92+'/'+_0x5c1b68)['json'](_0x584595);}return null;};}function patchUpdates(_0x3e6eee){return function(_0x310685){try{jsonpatch['apply'](_0x310685,_0x3e6eee,!![]);}catch(_0x387efd){return BPromise[_0x1b7c('0x24')](_0x387efd);}return _0x310685['save']();};}function saveUpdates(_0x57c408,_0x1340c2){return function(_0x5b9eab){if(_0x5b9eab){return _0x5b9eab[_0x1b7c('0x25')](_0x57c408)[_0x1b7c('0x26')](function(_0x254875){return _0x254875;});}return null;};}function removeEntity(_0xb833e8,_0x381dc4){return function(_0x515e71){if(_0x515e71){return _0x515e71[_0x1b7c('0x27')]()[_0x1b7c('0x26')](function(){_0xb833e8[_0x1b7c('0x1c')](0xcc)[_0x1b7c('0x1d')]();});}};}function handleEntityNotFound(_0x5be8af,_0x58b2c5){return function(_0x72c3fa){if(!_0x72c3fa){_0x5be8af[_0x1b7c('0x1b')](0x194);}return _0x72c3fa;};}function handleError(_0xa26521,_0x4ddeef){_0x4ddeef=_0x4ddeef||0x1f4;return function(_0x43e70c){logger[_0x1b7c('0x28')](_0x43e70c[_0x1b7c('0x29')]);if(_0x43e70c[_0x1b7c('0x2a')]){delete _0x43e70c[_0x1b7c('0x2a')];}_0xa26521[_0x1b7c('0x1c')](_0x4ddeef)['send'](_0x43e70c);};}exports['index']=function(_0x4a11d6,_0x4b2752){var _0x5cd5d8={},_0x478d44={},_0x5d5ed1={'count':0x0,'rows':[]};var _0x572559=_[_0x1b7c('0x2b')](db[_0x1b7c('0x2c')]['rawAttributes'],function(_0x18559b){return{'name':_0x18559b[_0x1b7c('0x2d')],'type':_0x18559b[_0x1b7c('0x2e')][_0x1b7c('0x2f')]};});_0x478d44[_0x1b7c('0x30')]=_[_0x1b7c('0x2b')](_0x572559,_0x1b7c('0x2a'));_0x478d44[_0x1b7c('0x31')]=_[_0x1b7c('0x32')](_0x4a11d6[_0x1b7c('0x31')]);_0x478d44[_0x1b7c('0x33')]=_[_0x1b7c('0x34')](_0x478d44[_0x1b7c('0x30')],_0x478d44['query']);_0x5cd5d8[_0x1b7c('0x35')]=_[_0x1b7c('0x34')](_0x478d44[_0x1b7c('0x30')],qs[_0x1b7c('0x36')](_0x4a11d6[_0x1b7c('0x31')][_0x1b7c('0x36')]));_0x5cd5d8[_0x1b7c('0x35')]=_0x5cd5d8[_0x1b7c('0x35')][_0x1b7c('0x37')]?_0x5cd5d8[_0x1b7c('0x35')]:_0x478d44['model'];if(!_0x4a11d6[_0x1b7c('0x31')][_0x1b7c('0x38')]('nolimit')){_0x5cd5d8[_0x1b7c('0x20')]=qs[_0x1b7c('0x20')](_0x4a11d6['query'][_0x1b7c('0x20')]);_0x5cd5d8[_0x1b7c('0x1f')]=qs['offset'](_0x4a11d6['query']['offset']);}_0x5cd5d8[_0x1b7c('0x39')]=qs['sort'](_0x4a11d6[_0x1b7c('0x31')][_0x1b7c('0x3a')]);_0x5cd5d8[_0x1b7c('0x3b')]=qs[_0x1b7c('0x33')](_[_0x1b7c('0x3c')](_0x4a11d6[_0x1b7c('0x31')],_0x478d44['filters']),_0x572559);if(_0x4a11d6['query']['filter']){_0x5cd5d8[_0x1b7c('0x3b')]=_[_0x1b7c('0x3d')](_0x5cd5d8[_0x1b7c('0x3b')],{'$or':_[_0x1b7c('0x2b')](_0x572559,function(_0x5d6ef8){if(_0x5d6ef8['type']!==_0x1b7c('0x3e')){var _0x32c6a2={};_0x32c6a2[_0x5d6ef8['name']]={'$like':'%'+_0x4a11d6['query'][_0x1b7c('0x3f')]+'%'};return _0x32c6a2;}})});}_0x5cd5d8=_[_0x1b7c('0x3d')]({},_0x5cd5d8,_0x4a11d6[_0x1b7c('0x40')]);var _0xebde6e={'where':_0x5cd5d8['where']};return db[_0x1b7c('0x2c')][_0x1b7c('0x21')](_0xebde6e)[_0x1b7c('0x26')](function(_0x6a855d){_0x5d5ed1[_0x1b7c('0x21')]=_0x6a855d;if(_0x4a11d6['query'][_0x1b7c('0x41')]){_0x5cd5d8[_0x1b7c('0x42')]=[{'all':!![]}];}return db[_0x1b7c('0x2c')][_0x1b7c('0x43')](_0x5cd5d8);})[_0x1b7c('0x26')](function(_0x45f97f){_0x5d5ed1['rows']=_0x45f97f;return _0x5d5ed1;})[_0x1b7c('0x26')](respondWithFilteredResult(_0x4b2752,_0x5cd5d8))['catch'](handleError(_0x4b2752,null));};exports[_0x1b7c('0x44')]=function(_0xcae120,_0x48be30){var _0x1bee64={'raw':!![],'where':{'id':_0xcae120['params']['id']}},_0x15ff08={};_0x15ff08['model']=_['keys'](db[_0x1b7c('0x2c')][_0x1b7c('0x45')]);_0x15ff08['query']=_['keys'](_0xcae120['query']);_0x15ff08[_0x1b7c('0x33')]=_[_0x1b7c('0x34')](_0x15ff08[_0x1b7c('0x30')],_0x15ff08['query']);_0x1bee64[_0x1b7c('0x35')]=_['intersection'](_0x15ff08[_0x1b7c('0x30')],qs[_0x1b7c('0x36')](_0xcae120[_0x1b7c('0x31')][_0x1b7c('0x36')]));_0x1bee64['attributes']=_0x1bee64[_0x1b7c('0x35')][_0x1b7c('0x37')]?_0x1bee64[_0x1b7c('0x35')]:_0x15ff08[_0x1b7c('0x30')];if(_0xcae120[_0x1b7c('0x31')][_0x1b7c('0x41')]){_0x1bee64['include']=[{'all':!![]}];}_0x1bee64=_[_0x1b7c('0x3d')]({},_0x1bee64,_0xcae120['options']);return db[_0x1b7c('0x2c')]['find'](_0x1bee64)['then'](handleEntityNotFound(_0x48be30,null))[_0x1b7c('0x26')](respondWithResult(_0x48be30,null))[_0x1b7c('0x46')](handleError(_0x48be30,null));};exports[_0x1b7c('0x47')]=function(_0x1aa449,_0x4c3f43){return db[_0x1b7c('0x2c')][_0x1b7c('0x47')](_0x1aa449[_0x1b7c('0x48')],{})['then'](respondWithResult(_0x4c3f43,0xc9))[_0x1b7c('0x46')](handleError(_0x4c3f43,null));};exports[_0x1b7c('0x25')]=function(_0x1a246a,_0x5c5150){if(_0x1a246a[_0x1b7c('0x48')]['id']){delete _0x1a246a[_0x1b7c('0x48')]['id'];}return db[_0x1b7c('0x2c')][_0x1b7c('0x49')]({'where':{'id':_0x1a246a['params']['id']}})[_0x1b7c('0x26')](handleEntityNotFound(_0x5c5150,null))[_0x1b7c('0x26')](saveUpdates(_0x1a246a['body'],null))[_0x1b7c('0x26')](respondWithResult(_0x5c5150,null))[_0x1b7c('0x46')](handleError(_0x5c5150,null));};exports[_0x1b7c('0x27')]=function(_0x3d8b79,_0x4aa35f){return db[_0x1b7c('0x2c')][_0x1b7c('0x49')]({'where':{'id':_0x3d8b79[_0x1b7c('0x4a')]['id']}})[_0x1b7c('0x26')](handleEntityNotFound(_0x4aa35f,null))['then'](removeEntity(_0x4aa35f,null))['catch'](handleError(_0x4aa35f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0b6ff0a..d47a295 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 _0x93f1=['moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','../../config/logger','api'];(function(_0x56fd0e,_0x4d1891){var _0x31ea13=function(_0x4f4652){while(--_0x4f4652){_0x56fd0e['push'](_0x56fd0e['shift']());}};_0x31ea13(++_0x4d1891);}(_0x93f1,0x168));var _0x193f=function(_0x30a886,_0x4e65cd){_0x30a886=_0x30a886-0x0;var _0x161286=_0x93f1[_0x30a886];return _0x161286;};'use strict';var _=require(_0x193f('0x0'));var util=require(_0x193f('0x1'));var logger=require(_0x193f('0x2'))(_0x193f('0x3'));var moment=require(_0x193f('0x4'));var BPromise=require(_0x193f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x193f('0x6'));var rimraf=require(_0x193f('0x7'));var config=require(_0x193f('0x8'));var attributes=require(_0x193f('0x9'));module[_0x193f('0xa')]=function(_0x1d6f59,_0x303c85){return _0x1d6f59[_0x193f('0xb')](_0x193f('0xc'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3aa=['mail_servers_out','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x5fa8f5,_0x45b975){var _0x362151=function(_0x367640){while(--_0x367640){_0x5fa8f5['push'](_0x5fa8f5['shift']());}};_0x362151(++_0x45b975);}(_0xb3aa,0x1b1));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xab3a('0x0'));var logger=require(_0xab3a('0x1'))('api');var moment=require(_0xab3a('0x2'));var BPromise=require(_0xab3a('0x3'));var rp=require(_0xab3a('0x4'));var fs=require('fs');var path=require(_0xab3a('0x5'));var rimraf=require('rimraf');var config=require(_0xab3a('0x6'));var attributes=require(_0xab3a('0x7'));module[_0xab3a('0x8')]=function(_0x56e957,_0x11e618){return _0x56e957[_0xab3a('0x9')](_0xab3a('0xa'),attributes,{'tableName':_0xab3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 04a08b0..8cc22e1 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x29a6c7,_0x3429b5){var _0xbaa852=function(_0x4cb486){while(--_0x4cb486){_0x29a6c7['push'](_0x29a6c7['shift']());}};_0xbaa852(++_0x3429b5);}(_0x2ef3,0xba));var _0x32ef=function(_0x222a7a,_0x339d46){_0x222a7a=_0x222a7a-0x0;var _0x573789=_0x2ef3[_0x222a7a];return _0x573789;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x512eb9,_0x3bd44e){var _0x26a1d1=function(_0x5c6570){while(--_0x5c6570){_0x512eb9['push'](_0x512eb9['shift']());}};_0x26a1d1(++_0x3bd44e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5237274..66a3e0c 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 _0x11ef=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy'];(function(_0x298af1,_0x58bfe1){var _0x3d0a59=function(_0x5dc14e){while(--_0x5dc14e){_0x298af1['push'](_0x298af1['shift']());}};_0x3d0a59(++_0x58bfe1);}(_0x11ef,0x121));var _0xf11e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x11ef[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xf11e('0x0'));var util=require(_0xf11e('0x1'));var path=require(_0xf11e('0x2'));var timeout=require(_0xf11e('0x3'));var express=require(_0xf11e('0x4'));var router=express[_0xf11e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf11e('0x6'));var config=require(_0xf11e('0x7'));var controller=require(_0xf11e('0x8'));router[_0xf11e('0x9')]('/',auth[_0xf11e('0xa')](),controller[_0xf11e('0xb')]);router[_0xf11e('0x9')](_0xf11e('0xc'),auth[_0xf11e('0xa')](),controller['describe']);router['get'](_0xf11e('0xd'),auth[_0xf11e('0xa')](),controller['show']);router[_0xf11e('0xe')]('/',auth[_0xf11e('0xa')](),controller['create']);router['put']('/:id',auth[_0xf11e('0xa')](),controller[_0xf11e('0xf')]);router['delete'](_0xf11e('0xd'),auth[_0xf11e('0xa')](),controller[_0xf11e('0x10')]);module[_0xf11e('0x11')]=router; \ No newline at end of file +var _0x4944=['index','/describe','/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x343b0a,_0x586263){var _0x3d8ff8=function(_0x53c629){while(--_0x53c629){_0x343b0a['push'](_0x343b0a['shift']());}};_0x3d8ff8(++_0x586263);}(_0x4944,0x6d));var _0x4494=function(_0x5b5b1b,_0x2b678c){_0x5b5b1b=_0x5b5b1b-0x0;var _0x50bf87=_0x4944[_0x5b5b1b];return _0x50bf87;};'use strict';var multer=require(_0x4494('0x0'));var util=require(_0x4494('0x1'));var path=require(_0x4494('0x2'));var timeout=require('connect-timeout');var express=require(_0x4494('0x3'));var router=express[_0x4494('0x4')]();var fs_extra=require(_0x4494('0x5'));var auth=require(_0x4494('0x6'));var interaction=require(_0x4494('0x7'));var config=require('../../config/environment');var controller=require(_0x4494('0x8'));router[_0x4494('0x9')]('/',auth[_0x4494('0xa')](),controller[_0x4494('0xb')]);router[_0x4494('0x9')](_0x4494('0xc'),auth[_0x4494('0xa')](),controller['describe']);router[_0x4494('0x9')](_0x4494('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4494('0xe')]('/',auth['isAuthenticated'](),controller[_0x4494('0xf')]);router[_0x4494('0x10')]('/:id',auth[_0x4494('0xa')](),controller[_0x4494('0x11')]);router[_0x4494('0x12')](_0x4494('0xd'),auth[_0x4494('0xa')](),controller[_0x4494('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index db11307..8f34d10 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 _0xdb8b=['STRING','name','exports'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x508117,_0xb836e){_0x508117=_0x508117-0x0;var _0x56c815=_0xdb8b[_0x508117];return _0x56c815;};'use strict';var Sequelize=require('sequelize');module[_0xbdb8('0x0')]={'name':{'type':Sequelize[_0xbdb8('0x1')],'unique':_0xbdb8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcde7=['name','STRING'];(function(_0x49ebb3,_0x56e2e7){var _0x4e8cd1=function(_0x1a8a45){while(--_0x1a8a45){_0x49ebb3['push'](_0x49ebb3['shift']());}};_0x4e8cd1(++_0x56e2e7);}(_0xcde7,0x65));var _0x7cde=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcde7[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7cde('0x0')],'unique':_0x7cde('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7cde('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 5fd01ba..2967524 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 _0x1c51=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','name','send','index','map','MailSubstatus','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','findAll','rows','catch','params','keys','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1034f8,_0x2b21a0){var _0x1016cb=function(_0x4643a6){while(--_0x4643a6){_0x1034f8['push'](_0x1034f8['shift']());}};_0x1016cb(++_0x2b21a0);}(_0x1c51,0x1ef));var _0x11c5=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x1c51[_0x5b7788];return _0x573871;};'use strict';var emlformat=require(_0x11c5('0x0'));var rimraf=require(_0x11c5('0x1'));var zipdir=require(_0x11c5('0x2'));var jsonpatch=require(_0x11c5('0x3'));var rp=require('request-promise');var moment=require(_0x11c5('0x4'));var BPromise=require(_0x11c5('0x5'));var Mustache=require(_0x11c5('0x6'));var util=require('util');var path=require(_0x11c5('0x7'));var sox=require(_0x11c5('0x8'));var csv=require('to-csv');var ejs=require(_0x11c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11c5('0xa'));var crypto=require(_0x11c5('0xb'));var jsforce=require(_0x11c5('0xc'));var deskjs=require(_0x11c5('0xd'));var toCsv=require(_0x11c5('0xe'));var querystring=require(_0x11c5('0xf'));var Papa=require(_0x11c5('0x10'));var Redis=require(_0x11c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x11c5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11c5('0x13'));var logger=require(_0x11c5('0x14'))(_0x11c5('0x15'));var utils=require(_0x11c5('0x16'));var config=require(_0x11c5('0x17'));var licenseUtil=require(_0x11c5('0x18'));var db=require(_0x11c5('0x19'))['db'];function respondWithStatusCode(_0x18aa50,_0x1017f2){_0x1017f2=_0x1017f2||0xcc;return function(_0x23a0c5){if(_0x23a0c5){return _0x18aa50[_0x11c5('0x1a')](_0x1017f2);}return _0x18aa50[_0x11c5('0x1b')](_0x1017f2)[_0x11c5('0x1c')]();};}function respondWithResult(_0x70c39d,_0x1dd27e){_0x1dd27e=_0x1dd27e||0xc8;return function(_0x57aae8){if(_0x57aae8){return _0x70c39d[_0x11c5('0x1b')](_0x1dd27e)[_0x11c5('0x1d')](_0x57aae8);}};}function respondWithFilteredResult(_0x25f519,_0x15515d){return function(_0x18860b){if(_0x18860b){var _0x1547d9=typeof _0x15515d['offset']===_0x11c5('0x1e')&&typeof _0x15515d[_0x11c5('0x1f')]===_0x11c5('0x1e');var _0x2e1c8a=_0x18860b[_0x11c5('0x20')];var _0x407314=_0x1547d9?0x0:_0x15515d[_0x11c5('0x21')];var _0x45a963=_0x1547d9?_0x18860b[_0x11c5('0x20')]:_0x15515d['offset']+_0x15515d['limit'];var _0xdb61c4;if(_0x45a963>=_0x2e1c8a){_0x45a963=_0x2e1c8a;_0xdb61c4=0xc8;}else{_0xdb61c4=0xce;}_0x25f519[_0x11c5('0x1b')](_0xdb61c4);return _0x25f519[_0x11c5('0x22')](_0x11c5('0x23'),_0x407314+'-'+_0x45a963+'/'+_0x2e1c8a)['json'](_0x18860b);}return null;};}function patchUpdates(_0x5386af){return function(_0x5039c5){try{jsonpatch[_0x11c5('0x24')](_0x5039c5,_0x5386af,!![]);}catch(_0x4bceb3){return BPromise['reject'](_0x4bceb3);}return _0x5039c5[_0x11c5('0x25')]();};}function saveUpdates(_0x323e0c,_0x1493af){return function(_0x476469){if(_0x476469){return _0x476469[_0x11c5('0x26')](_0x323e0c)[_0x11c5('0x27')](function(_0x3ac462){return _0x3ac462;});}return null;};}function removeEntity(_0x229beb,_0xde3aa1){return function(_0x4ba082){if(_0x4ba082){return _0x4ba082['destroy']()[_0x11c5('0x27')](function(){_0x229beb[_0x11c5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b22ae,_0x225fcc){return function(_0x4f2110){if(!_0x4f2110){_0x5b22ae['sendStatus'](0x194);}return _0x4f2110;};}function handleError(_0x11d6ac,_0x1895db){_0x1895db=_0x1895db||0x1f4;return function(_0x2a8c2e){logger['error'](_0x2a8c2e['stack']);if(_0x2a8c2e[_0x11c5('0x28')]){delete _0x2a8c2e[_0x11c5('0x28')];}_0x11d6ac['status'](_0x1895db)[_0x11c5('0x29')](_0x2a8c2e);};}exports[_0x11c5('0x2a')]=function(_0x327422,_0x4d1b74){var _0x1acba0={},_0x5aa841={},_0x25ab1c={'count':0x0,'rows':[]};var _0x3e27a6=_[_0x11c5('0x2b')](db[_0x11c5('0x2c')]['rawAttributes'],function(_0x23840f){return{'name':_0x23840f[_0x11c5('0x2d')],'type':_0x23840f['type']['key']};});_0x5aa841[_0x11c5('0x2e')]=_[_0x11c5('0x2b')](_0x3e27a6,_0x11c5('0x28'));_0x5aa841[_0x11c5('0x2f')]=_['keys'](_0x327422[_0x11c5('0x2f')]);_0x5aa841[_0x11c5('0x30')]=_[_0x11c5('0x31')](_0x5aa841['model'],_0x5aa841[_0x11c5('0x2f')]);_0x1acba0['attributes']=_[_0x11c5('0x31')](_0x5aa841['model'],qs[_0x11c5('0x32')](_0x327422[_0x11c5('0x2f')][_0x11c5('0x32')]));_0x1acba0[_0x11c5('0x33')]=_0x1acba0['attributes']['length']?_0x1acba0['attributes']:_0x5aa841['model'];if(!_0x327422[_0x11c5('0x2f')][_0x11c5('0x34')](_0x11c5('0x35'))){_0x1acba0[_0x11c5('0x1f')]=qs[_0x11c5('0x1f')](_0x327422[_0x11c5('0x2f')]['limit']);_0x1acba0[_0x11c5('0x21')]=qs[_0x11c5('0x21')](_0x327422['query'][_0x11c5('0x21')]);}_0x1acba0[_0x11c5('0x36')]=qs['sort'](_0x327422['query'][_0x11c5('0x37')]);_0x1acba0['where']=qs['filters'](_[_0x11c5('0x38')](_0x327422[_0x11c5('0x2f')],_0x5aa841[_0x11c5('0x30')]),_0x3e27a6);if(_0x327422[_0x11c5('0x2f')][_0x11c5('0x39')]){_0x1acba0[_0x11c5('0x3a')]=_[_0x11c5('0x3b')](_0x1acba0['where'],{'$or':_[_0x11c5('0x2b')](_0x3e27a6,function(_0x4cfd0d){if(_0x4cfd0d[_0x11c5('0x3c')]!==_0x11c5('0x3d')){var _0x2e20fc={};_0x2e20fc[_0x4cfd0d[_0x11c5('0x28')]]={'$like':'%'+_0x327422[_0x11c5('0x2f')]['filter']+'%'};return _0x2e20fc;}})});}_0x1acba0=_[_0x11c5('0x3b')]({},_0x1acba0,_0x327422['options']);var _0x80248e={'where':_0x1acba0[_0x11c5('0x3a')]};return db[_0x11c5('0x2c')][_0x11c5('0x20')](_0x80248e)[_0x11c5('0x27')](function(_0x199c1f){_0x25ab1c[_0x11c5('0x20')]=_0x199c1f;if(_0x327422['query']['includeAll']){_0x1acba0['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x11c5('0x3e')](_0x1acba0);})[_0x11c5('0x27')](function(_0x2398c7){_0x25ab1c[_0x11c5('0x3f')]=_0x2398c7;return _0x25ab1c;})['then'](respondWithFilteredResult(_0x4d1b74,_0x1acba0))[_0x11c5('0x40')](handleError(_0x4d1b74,null));};exports['show']=function(_0x388c84,_0x5ab980){var _0x43b392={'raw':!![],'where':{'id':_0x388c84[_0x11c5('0x41')]['id']}},_0x46ed4e={};_0x46ed4e['model']=_['keys'](db[_0x11c5('0x2c')]['rawAttributes']);_0x46ed4e[_0x11c5('0x2f')]=_[_0x11c5('0x42')](_0x388c84['query']);_0x46ed4e[_0x11c5('0x30')]=_[_0x11c5('0x31')](_0x46ed4e[_0x11c5('0x2e')],_0x46ed4e[_0x11c5('0x2f')]);_0x43b392[_0x11c5('0x33')]=_[_0x11c5('0x31')](_0x46ed4e['model'],qs[_0x11c5('0x32')](_0x388c84[_0x11c5('0x2f')][_0x11c5('0x32')]));_0x43b392[_0x11c5('0x33')]=_0x43b392['attributes'][_0x11c5('0x43')]?_0x43b392[_0x11c5('0x33')]:_0x46ed4e['model'];if(_0x388c84['query'][_0x11c5('0x44')]){_0x43b392[_0x11c5('0x45')]=[{'all':!![]}];}_0x43b392=_[_0x11c5('0x3b')]({},_0x43b392,_0x388c84['options']);return db[_0x11c5('0x2c')][_0x11c5('0x46')](_0x43b392)[_0x11c5('0x27')](handleEntityNotFound(_0x5ab980,null))[_0x11c5('0x27')](respondWithResult(_0x5ab980,null))[_0x11c5('0x40')](handleError(_0x5ab980,null));};exports['create']=function(_0x56d516,_0x4d3a54){return db['MailSubstatus'][_0x11c5('0x47')](_0x56d516[_0x11c5('0x48')],{})[_0x11c5('0x27')](respondWithResult(_0x4d3a54,0xc9))[_0x11c5('0x40')](handleError(_0x4d3a54,null));};exports[_0x11c5('0x26')]=function(_0x39f4c0,_0x5cc204){if(_0x39f4c0['body']['id']){delete _0x39f4c0[_0x11c5('0x48')]['id'];}return db['MailSubstatus'][_0x11c5('0x46')]({'where':{'id':_0x39f4c0['params']['id']}})['then'](handleEntityNotFound(_0x5cc204,null))['then'](saveUpdates(_0x39f4c0[_0x11c5('0x48')],null))[_0x11c5('0x27')](respondWithResult(_0x5cc204,null))[_0x11c5('0x40')](handleError(_0x5cc204,null));};exports['destroy']=function(_0x1aedd4,_0x1e090b){return db['MailSubstatus'][_0x11c5('0x46')]({'where':{'id':_0x1aedd4['params']['id']}})[_0x11c5('0x27')](handleEntityNotFound(_0x1e090b,null))[_0x11c5('0x27')](removeEntity(_0x1e090b,null))['catch'](handleError(_0x1e090b,null));};exports[_0x11c5('0x49')]=function(_0x36734e,_0x13255e){return db['MailSubstatus'][_0x11c5('0x49')]()[_0x11c5('0x27')](respondWithResult(_0x13255e,null))[_0x11c5('0x40')](handleError(_0x13255e,null));}; \ No newline at end of file +var _0xa1a1=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','MailSubstatus','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x423736,_0x1417b9){var _0x184f2d=function(_0x43c721){while(--_0x43c721){_0x423736['push'](_0x423736['shift']());}};_0x184f2d(++_0x1417b9);}(_0xa1a1,0x91));var _0x1a1a=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xa1a1[_0x292f93];return _0x5a94b1;};'use strict';var emlformat=require(_0x1a1a('0x0'));var rimraf=require(_0x1a1a('0x1'));var zipdir=require(_0x1a1a('0x2'));var jsonpatch=require(_0x1a1a('0x3'));var rp=require(_0x1a1a('0x4'));var moment=require(_0x1a1a('0x5'));var BPromise=require(_0x1a1a('0x6'));var Mustache=require(_0x1a1a('0x7'));var util=require(_0x1a1a('0x8'));var path=require(_0x1a1a('0x9'));var sox=require(_0x1a1a('0xa'));var csv=require(_0x1a1a('0xb'));var ejs=require(_0x1a1a('0xc'));var fs=require('fs');var fs_extra=require(_0x1a1a('0xd'));var _=require(_0x1a1a('0xe'));var squel=require(_0x1a1a('0xf'));var crypto=require(_0x1a1a('0x10'));var jsforce=require(_0x1a1a('0x11'));var deskjs=require(_0x1a1a('0x12'));var toCsv=require('to-csv');var querystring=require(_0x1a1a('0x13'));var Papa=require(_0x1a1a('0x14'));var Redis=require('ioredis');var authService=require(_0x1a1a('0x15'));var qs=require(_0x1a1a('0x16'));var as=require(_0x1a1a('0x17'));var hardwareService=require(_0x1a1a('0x18'));var logger=require(_0x1a1a('0x19'))(_0x1a1a('0x1a'));var utils=require(_0x1a1a('0x1b'));var config=require(_0x1a1a('0x1c'));var licenseUtil=require(_0x1a1a('0x1d'));var db=require(_0x1a1a('0x1e'))['db'];function respondWithStatusCode(_0x2c82dd,_0x402fd2){_0x402fd2=_0x402fd2||0xcc;return function(_0x2924a6){if(_0x2924a6){return _0x2c82dd['sendStatus'](_0x402fd2);}return _0x2c82dd[_0x1a1a('0x1f')](_0x402fd2)[_0x1a1a('0x20')]();};}function respondWithResult(_0x4abc21,_0x451851){_0x451851=_0x451851||0xc8;return function(_0xd2e9d){if(_0xd2e9d){return _0x4abc21[_0x1a1a('0x1f')](_0x451851)[_0x1a1a('0x21')](_0xd2e9d);}};}function respondWithFilteredResult(_0xdc83be,_0x3d56ac){return function(_0x1f7fa1){if(_0x1f7fa1){var _0x320794=typeof _0x3d56ac[_0x1a1a('0x22')]===_0x1a1a('0x23')&&typeof _0x3d56ac[_0x1a1a('0x24')]===_0x1a1a('0x23');var _0x16f9ba=_0x1f7fa1['count'];var _0x25a2ae=_0x320794?0x0:_0x3d56ac['offset'];var _0x1e704c=_0x320794?_0x1f7fa1[_0x1a1a('0x25')]:_0x3d56ac[_0x1a1a('0x22')]+_0x3d56ac[_0x1a1a('0x24')];var _0x149f2c;if(_0x1e704c>=_0x16f9ba){_0x1e704c=_0x16f9ba;_0x149f2c=0xc8;}else{_0x149f2c=0xce;}_0xdc83be[_0x1a1a('0x1f')](_0x149f2c);return _0xdc83be[_0x1a1a('0x26')](_0x1a1a('0x27'),_0x25a2ae+'-'+_0x1e704c+'/'+_0x16f9ba)['json'](_0x1f7fa1);}return null;};}function patchUpdates(_0x411081){return function(_0xdadff){try{jsonpatch['apply'](_0xdadff,_0x411081,!![]);}catch(_0x3b601f){return BPromise['reject'](_0x3b601f);}return _0xdadff[_0x1a1a('0x28')]();};}function saveUpdates(_0x60905d,_0x53d27a){return function(_0x104fdb){if(_0x104fdb){return _0x104fdb['update'](_0x60905d)[_0x1a1a('0x29')](function(_0xa7a305){return _0xa7a305;});}return null;};}function removeEntity(_0x397ea8,_0x53cd98){return function(_0x3ec3ec){if(_0x3ec3ec){return _0x3ec3ec[_0x1a1a('0x2a')]()[_0x1a1a('0x29')](function(){_0x397ea8[_0x1a1a('0x1f')](0xcc)[_0x1a1a('0x20')]();});}};}function handleEntityNotFound(_0x1e3bc2,_0x5035e7){return function(_0x57750d){if(!_0x57750d){_0x1e3bc2[_0x1a1a('0x2b')](0x194);}return _0x57750d;};}function handleError(_0x40df2e,_0x5b8bc5){_0x5b8bc5=_0x5b8bc5||0x1f4;return function(_0x32fca4){logger[_0x1a1a('0x2c')](_0x32fca4[_0x1a1a('0x2d')]);if(_0x32fca4[_0x1a1a('0x2e')]){delete _0x32fca4[_0x1a1a('0x2e')];}_0x40df2e[_0x1a1a('0x1f')](_0x5b8bc5)[_0x1a1a('0x2f')](_0x32fca4);};}exports[_0x1a1a('0x30')]=function(_0x44fb40,_0x3cac88){var _0x50e7b4={},_0x46041c={},_0x3e3e52={'count':0x0,'rows':[]};var _0x6fe2e4=_[_0x1a1a('0x31')](db['MailSubstatus'][_0x1a1a('0x32')],function(_0x186558){return{'name':_0x186558['fieldName'],'type':_0x186558[_0x1a1a('0x33')][_0x1a1a('0x34')]};});_0x46041c['model']=_['map'](_0x6fe2e4,_0x1a1a('0x2e'));_0x46041c[_0x1a1a('0x35')]=_['keys'](_0x44fb40[_0x1a1a('0x35')]);_0x46041c[_0x1a1a('0x36')]=_[_0x1a1a('0x37')](_0x46041c[_0x1a1a('0x38')],_0x46041c[_0x1a1a('0x35')]);_0x50e7b4[_0x1a1a('0x39')]=_[_0x1a1a('0x37')](_0x46041c['model'],qs['fields'](_0x44fb40[_0x1a1a('0x35')][_0x1a1a('0x3a')]));_0x50e7b4[_0x1a1a('0x39')]=_0x50e7b4[_0x1a1a('0x39')][_0x1a1a('0x3b')]?_0x50e7b4[_0x1a1a('0x39')]:_0x46041c[_0x1a1a('0x38')];if(!_0x44fb40[_0x1a1a('0x35')][_0x1a1a('0x3c')](_0x1a1a('0x3d'))){_0x50e7b4[_0x1a1a('0x24')]=qs['limit'](_0x44fb40['query'][_0x1a1a('0x24')]);_0x50e7b4[_0x1a1a('0x22')]=qs[_0x1a1a('0x22')](_0x44fb40[_0x1a1a('0x35')][_0x1a1a('0x22')]);}_0x50e7b4[_0x1a1a('0x3e')]=qs[_0x1a1a('0x3f')](_0x44fb40[_0x1a1a('0x35')][_0x1a1a('0x3f')]);_0x50e7b4[_0x1a1a('0x40')]=qs['filters'](_['pick'](_0x44fb40[_0x1a1a('0x35')],_0x46041c['filters']),_0x6fe2e4);if(_0x44fb40[_0x1a1a('0x35')][_0x1a1a('0x41')]){_0x50e7b4[_0x1a1a('0x40')]=_['merge'](_0x50e7b4[_0x1a1a('0x40')],{'$or':_['map'](_0x6fe2e4,function(_0x54b985){if(_0x54b985[_0x1a1a('0x33')]!==_0x1a1a('0x42')){var _0x29fdd5={};_0x29fdd5[_0x54b985['name']]={'$like':'%'+_0x44fb40[_0x1a1a('0x35')][_0x1a1a('0x41')]+'%'};return _0x29fdd5;}})});}_0x50e7b4=_[_0x1a1a('0x43')]({},_0x50e7b4,_0x44fb40[_0x1a1a('0x44')]);var _0x2e8ba0={'where':_0x50e7b4[_0x1a1a('0x40')]};return db[_0x1a1a('0x45')][_0x1a1a('0x25')](_0x2e8ba0)['then'](function(_0x1161cb){_0x3e3e52[_0x1a1a('0x25')]=_0x1161cb;if(_0x44fb40[_0x1a1a('0x35')][_0x1a1a('0x46')]){_0x50e7b4[_0x1a1a('0x47')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x50e7b4);})[_0x1a1a('0x29')](function(_0x1f5c1d){_0x3e3e52[_0x1a1a('0x48')]=_0x1f5c1d;return _0x3e3e52;})[_0x1a1a('0x29')](respondWithFilteredResult(_0x3cac88,_0x50e7b4))['catch'](handleError(_0x3cac88,null));};exports[_0x1a1a('0x49')]=function(_0xf4d64f,_0xe64d72){var _0x1af269={'raw':!![],'where':{'id':_0xf4d64f[_0x1a1a('0x4a')]['id']}},_0x2d72dd={};_0x2d72dd['model']=_[_0x1a1a('0x4b')](db[_0x1a1a('0x45')]['rawAttributes']);_0x2d72dd['query']=_[_0x1a1a('0x4b')](_0xf4d64f[_0x1a1a('0x35')]);_0x2d72dd[_0x1a1a('0x36')]=_[_0x1a1a('0x37')](_0x2d72dd[_0x1a1a('0x38')],_0x2d72dd[_0x1a1a('0x35')]);_0x1af269['attributes']=_[_0x1a1a('0x37')](_0x2d72dd[_0x1a1a('0x38')],qs[_0x1a1a('0x3a')](_0xf4d64f[_0x1a1a('0x35')]['fields']));_0x1af269[_0x1a1a('0x39')]=_0x1af269['attributes'][_0x1a1a('0x3b')]?_0x1af269[_0x1a1a('0x39')]:_0x2d72dd['model'];if(_0xf4d64f[_0x1a1a('0x35')][_0x1a1a('0x46')]){_0x1af269[_0x1a1a('0x47')]=[{'all':!![]}];}_0x1af269=_[_0x1a1a('0x43')]({},_0x1af269,_0xf4d64f[_0x1a1a('0x44')]);return db[_0x1a1a('0x45')][_0x1a1a('0x4c')](_0x1af269)[_0x1a1a('0x29')](handleEntityNotFound(_0xe64d72,null))[_0x1a1a('0x29')](respondWithResult(_0xe64d72,null))[_0x1a1a('0x4d')](handleError(_0xe64d72,null));};exports[_0x1a1a('0x4e')]=function(_0x5a51c2,_0x589b54){return db[_0x1a1a('0x45')][_0x1a1a('0x4e')](_0x5a51c2[_0x1a1a('0x4f')],{})['then'](respondWithResult(_0x589b54,0xc9))[_0x1a1a('0x4d')](handleError(_0x589b54,null));};exports['update']=function(_0x5345fe,_0x1bf9eb){if(_0x5345fe['body']['id']){delete _0x5345fe[_0x1a1a('0x4f')]['id'];}return db[_0x1a1a('0x45')][_0x1a1a('0x4c')]({'where':{'id':_0x5345fe['params']['id']}})[_0x1a1a('0x29')](handleEntityNotFound(_0x1bf9eb,null))[_0x1a1a('0x29')](saveUpdates(_0x5345fe[_0x1a1a('0x4f')],null))[_0x1a1a('0x29')](respondWithResult(_0x1bf9eb,null))[_0x1a1a('0x4d')](handleError(_0x1bf9eb,null));};exports[_0x1a1a('0x2a')]=function(_0x77edf4,_0x5b84fd){return db[_0x1a1a('0x45')][_0x1a1a('0x4c')]({'where':{'id':_0x77edf4[_0x1a1a('0x4a')]['id']}})[_0x1a1a('0x29')](handleEntityNotFound(_0x5b84fd,null))['then'](removeEntity(_0x5b84fd,null))['catch'](handleError(_0x5b84fd,null));};exports[_0x1a1a('0x50')]=function(_0x1af99e,_0x950ff2){return db[_0x1a1a('0x45')]['describe']()[_0x1a1a('0x29')](respondWithResult(_0x950ff2,null))[_0x1a1a('0x4d')](handleError(_0x950ff2,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2a0fe4d..17fddf8 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 _0xda6a=['exports','define','MailSubstatus','lodash','util','api','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes'];(function(_0xb47dc0,_0x407032){var _0x57f0b0=function(_0x11c030){while(--_0x11c030){_0xb47dc0['push'](_0xb47dc0['shift']());}};_0x57f0b0(++_0x407032);}(_0xda6a,0x137));var _0xada6=function(_0x445a67,_0x5df93d){_0x445a67=_0x445a67-0x0;var _0x270ecd=_0xda6a[_0x445a67];return _0x270ecd;};'use strict';var _=require(_0xada6('0x0'));var util=require(_0xada6('0x1'));var logger=require('../../config/logger')(_0xada6('0x2'));var moment=require('moment');var BPromise=require(_0xada6('0x3'));var rp=require(_0xada6('0x4'));var fs=require('fs');var path=require(_0xada6('0x5'));var rimraf=require(_0xada6('0x6'));var config=require('../../config/environment');var attributes=require(_0xada6('0x7'));module[_0xada6('0x8')]=function(_0x511174,_0x525dc7){return _0x511174[_0xada6('0x9')](_0xada6('0xa'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54aa=['rimraf','../../config/environment','exports','define','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x469d6c,_0x144b53){var _0xb1c543=function(_0x4ee34d){while(--_0x4ee34d){_0x469d6c['push'](_0x469d6c['shift']());}};_0xb1c543(++_0x144b53);}(_0x54aa,0x123));var _0xa54a=function(_0x301bbf,_0xfb706f){_0x301bbf=_0x301bbf-0x0;var _0x572615=_0x54aa[_0x301bbf];return _0x572615;};'use strict';var _=require(_0xa54a('0x0'));var util=require(_0xa54a('0x1'));var logger=require(_0xa54a('0x2'))(_0xa54a('0x3'));var moment=require(_0xa54a('0x4'));var BPromise=require(_0xa54a('0x5'));var rp=require(_0xa54a('0x6'));var fs=require('fs');var path=require(_0xa54a('0x7'));var rimraf=require(_0xa54a('0x8'));var config=require(_0xa54a('0x9'));var attributes=require('./mailSubstatus.attributes');module[_0xa54a('0xa')]=function(_0x363b28,_0x23012d){return _0x363b28[_0xa54a('0xb')]('MailSubstatus',attributes,{'tableName':_0xa54a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4853421..efc44c0 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 _0x9fc8=['request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x2484be,_0x12368d){var _0x2953f1=function(_0x550863){while(--_0x550863){_0x2484be['push'](_0x2484be['shift']());}};_0x2953f1(++_0x12368d);}(_0x9fc8,0x14d));var _0x89fc=function(_0x3dd994,_0xb6a1ec){_0x3dd994=_0x3dd994-0x0;var _0x1fcec1=_0x9fc8[_0x3dd994];return _0x1fcec1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x89fc('0x0'));var BPromise=require(_0x89fc('0x1'));var rs=require(_0x89fc('0x2'));var fs=require('fs');var Redis=require(_0x89fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89fc('0x4'));var logger=require(_0x89fc('0x5'))(_0x89fc('0x6'));var config=require('../../config/environment');var jayson=require(_0x89fc('0x7'));var client=jayson['client'][_0x89fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x249553,_0x4694c4,_0x38d39e){return new BPromise(function(_0x102cbc,_0x45d6d7){return client[_0x89fc('0x9')](_0x249553,_0x38d39e)['then'](function(_0x4090b2){logger[_0x89fc('0xa')](_0x89fc('0xb'),_0x4694c4,_0x89fc('0xc'));logger['debug'](_0x89fc('0xd'),_0x4694c4,'request\x20sent',JSON[_0x89fc('0xe')](_0x4090b2));if(_0x4090b2[_0x89fc('0xf')]){if(_0x4090b2[_0x89fc('0xf')]['code']===0x1f4){logger[_0x89fc('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x4694c4,_0x4090b2[_0x89fc('0xf')]['message']);return _0x45d6d7(_0x4090b2[_0x89fc('0xf')][_0x89fc('0x10')]);}logger[_0x89fc('0xf')](_0x89fc('0xb'),_0x4694c4,_0x4090b2['error'][_0x89fc('0x10')]);return _0x102cbc(_0x4090b2[_0x89fc('0xf')][_0x89fc('0x10')]);}else{logger[_0x89fc('0xa')](_0x89fc('0xb'),_0x4694c4,_0x89fc('0xc'));_0x102cbc(_0x4090b2[_0x89fc('0x11')]['message']);}})[_0x89fc('0x12')](function(_0x234fd5){logger['error'](_0x89fc('0xb'),_0x4694c4,_0x234fd5);_0x45d6d7(_0x234fd5);});});} \ No newline at end of file +var _0xed31=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','request\x20sent'];(function(_0xca517f,_0x3c6a5e){var _0x213c45=function(_0x28ea51){while(--_0x28ea51){_0xca517f['push'](_0xca517f['shift']());}};_0x213c45(++_0x3c6a5e);}(_0xed31,0x117));var _0x1ed3=function(_0x181322,_0x21ebc8){_0x181322=_0x181322-0x0;var _0x7e377c=_0xed31[_0x181322];return _0x7e377c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ed3('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ed3('0x1'))['db'];var utils=require(_0x1ed3('0x2'));var logger=require('../../config/logger')(_0x1ed3('0x3'));var config=require('../../config/environment');var jayson=require(_0x1ed3('0x4'));var client=jayson[_0x1ed3('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36332e,_0x1db249,_0x4f9aa6){return new BPromise(function(_0x211446,_0x5ef3e4){return client[_0x1ed3('0x6')](_0x36332e,_0x4f9aa6)[_0x1ed3('0x7')](function(_0x57c93d){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x1db249,_0x1ed3('0x8'));logger[_0x1ed3('0x9')](_0x1ed3('0xa'),_0x1db249,_0x1ed3('0x8'),JSON[_0x1ed3('0xb')](_0x57c93d));if(_0x57c93d[_0x1ed3('0xc')]){if(_0x57c93d[_0x1ed3('0xc')][_0x1ed3('0xd')]===0x1f4){logger[_0x1ed3('0xc')](_0x1ed3('0xe'),_0x1db249,_0x57c93d[_0x1ed3('0xc')][_0x1ed3('0xf')]);return _0x5ef3e4(_0x57c93d['error']['message']);}logger['error'](_0x1ed3('0xe'),_0x1db249,_0x57c93d[_0x1ed3('0xc')][_0x1ed3('0xf')]);return _0x211446(_0x57c93d[_0x1ed3('0xc')][_0x1ed3('0xf')]);}else{logger[_0x1ed3('0x10')](_0x1ed3('0xe'),_0x1db249,'request\x20sent');_0x211446(_0x57c93d[_0x1ed3('0x11')][_0x1ed3('0xf')]);}})['catch'](function(_0xa8ec06){logger[_0x1ed3('0xc')](_0x1ed3('0xe'),_0x1db249,_0xa8ec06);_0x5ef3e4(_0xa8ec06);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0696297..9d38b0d 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 _0xd1b6=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','/:id','update','delete','destroy','multer'];(function(_0x4c7fcd,_0x22a373){var _0x16a47c=function(_0x3367f0){while(--_0x3367f0){_0x4c7fcd['push'](_0x4c7fcd['shift']());}};_0x16a47c(++_0x22a373);}(_0xd1b6,0xe3));var _0x6d1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1b6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6d1b('0x0'));var util=require(_0x6d1b('0x1'));var path=require(_0x6d1b('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d1b('0x3'));var router=express[_0x6d1b('0x4')]();var fs_extra=require(_0x6d1b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6d1b('0x6'));var config=require(_0x6d1b('0x7'));var controller=require('./mailTransferReport.controller');router[_0x6d1b('0x8')]('/',auth[_0x6d1b('0x9')](),controller[_0x6d1b('0xa')]);router[_0x6d1b('0x8')](_0x6d1b('0xb'),auth[_0x6d1b('0x9')](),controller[_0x6d1b('0xc')]);router[_0x6d1b('0x8')]('/:id',auth[_0x6d1b('0x9')](),controller['show']);router[_0x6d1b('0xd')]('/',auth[_0x6d1b('0x9')](),controller[_0x6d1b('0xe')]);router['put'](_0x6d1b('0xf'),auth[_0x6d1b('0x9')](),controller[_0x6d1b('0x10')]);router[_0x6d1b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6d1b('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf4ad=['index','describe','post','create','put','update','delete','/:id','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x31e1bc,_0x3b8aca){var _0x1e6a48=function(_0x395226){while(--_0x395226){_0x31e1bc['push'](_0x31e1bc['shift']());}};_0x1e6a48(++_0x3b8aca);}(_0xf4ad,0x15f));var _0xdf4a=function(_0x5ace25,_0x536239){_0x5ace25=_0x5ace25-0x0;var _0x4ba17a=_0xf4ad[_0x5ace25];return _0x4ba17a;};'use strict';var multer=require(_0xdf4a('0x0'));var util=require('util');var path=require(_0xdf4a('0x1'));var timeout=require('connect-timeout');var express=require(_0xdf4a('0x2'));var router=express[_0xdf4a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdf4a('0x4'));var interaction=require(_0xdf4a('0x5'));var config=require(_0xdf4a('0x6'));var controller=require('./mailTransferReport.controller');router[_0xdf4a('0x7')]('/',auth[_0xdf4a('0x8')](),controller[_0xdf4a('0x9')]);router['get']('/describe',auth[_0xdf4a('0x8')](),controller[_0xdf4a('0xa')]);router[_0xdf4a('0x7')]('/:id',auth[_0xdf4a('0x8')](),controller['show']);router[_0xdf4a('0xb')]('/',auth[_0xdf4a('0x8')](),controller[_0xdf4a('0xc')]);router[_0xdf4a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xdf4a('0xe')]);router[_0xdf4a('0xf')](_0xdf4a('0x10'),auth[_0xdf4a('0x8')](),controller['destroy']);module[_0xdf4a('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5ae159d..7fc677c 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x290ba7,_0x115754){var _0x5d5fb7=function(_0x2e4dd7){while(--_0x2e4dd7){_0x290ba7['push'](_0x290ba7['shift']());}};_0x5d5fb7(++_0x115754);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1e671b,_0x28c394){_0x1e671b=_0x1e671b-0x0;var _0x35a15c=_0xf4eb[_0x1e671b];return _0x35a15c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x47a838,_0x1c7e1e){var _0x560260=function(_0x1efd32){while(--_0x1efd32){_0x47a838['push'](_0x47a838['shift']());}};_0x560260(++_0x1c7e1e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xf3cd[_0x2e7a43];return _0x52e9e1;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 956d158..110448c 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 _0x382a=['intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','MailTransferReport','includeAll','findAll','rows','catch','show','params','include','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','map','keys','filters'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x382a,0x67));var _0xa382=function(_0x846ae8,_0x33a70b){_0x846ae8=_0x846ae8-0x0;var _0x356b00=_0x382a[_0x846ae8];return _0x356b00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa382('0x0'));var zipdir=require(_0xa382('0x1'));var jsonpatch=require(_0xa382('0x2'));var rp=require(_0xa382('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa382('0x4'));var path=require(_0xa382('0x5'));var sox=require('sox');var csv=require(_0xa382('0x6'));var ejs=require(_0xa382('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa382('0x8'));var squel=require('squel');var crypto=require(_0xa382('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa382('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa382('0xb'));var Papa=require(_0xa382('0xc'));var Redis=require(_0xa382('0xd'));var authService=require(_0xa382('0xe'));var qs=require(_0xa382('0xf'));var as=require(_0xa382('0x10'));var hardwareService=require(_0xa382('0x11'));var logger=require('../../config/logger')(_0xa382('0x12'));var utils=require(_0xa382('0x13'));var config=require(_0xa382('0x14'));var licenseUtil=require(_0xa382('0x15'));var db=require(_0xa382('0x16'))['db'];function respondWithStatusCode(_0x18828e,_0xfc5bb1){_0xfc5bb1=_0xfc5bb1||0xcc;return function(_0x56c67a){if(_0x56c67a){return _0x18828e[_0xa382('0x17')](_0xfc5bb1);}return _0x18828e[_0xa382('0x18')](_0xfc5bb1)[_0xa382('0x19')]();};}function respondWithResult(_0x264166,_0x4b05f3){_0x4b05f3=_0x4b05f3||0xc8;return function(_0x4746cb){if(_0x4746cb){return _0x264166[_0xa382('0x18')](_0x4b05f3)[_0xa382('0x1a')](_0x4746cb);}};}function respondWithFilteredResult(_0x5852a9,_0x328e78){return function(_0x192cec){if(_0x192cec){var _0x1417c1=typeof _0x328e78[_0xa382('0x1b')]===_0xa382('0x1c')&&typeof _0x328e78[_0xa382('0x1d')]===_0xa382('0x1c');var _0x1930b8=_0x192cec[_0xa382('0x1e')];var _0x447750=_0x1417c1?0x0:_0x328e78[_0xa382('0x1b')];var _0x51d356=_0x1417c1?_0x192cec['count']:_0x328e78[_0xa382('0x1b')]+_0x328e78[_0xa382('0x1d')];var _0x3947e1;if(_0x51d356>=_0x1930b8){_0x51d356=_0x1930b8;_0x3947e1=0xc8;}else{_0x3947e1=0xce;}_0x5852a9[_0xa382('0x18')](_0x3947e1);return _0x5852a9[_0xa382('0x1f')](_0xa382('0x20'),_0x447750+'-'+_0x51d356+'/'+_0x1930b8)[_0xa382('0x1a')](_0x192cec);}return null;};}function patchUpdates(_0xd20f30){return function(_0x328a41){try{jsonpatch['apply'](_0x328a41,_0xd20f30,!![]);}catch(_0x177da0){return BPromise[_0xa382('0x21')](_0x177da0);}return _0x328a41[_0xa382('0x22')]();};}function saveUpdates(_0x5866c4,_0x2bc906){return function(_0x35175f){if(_0x35175f){return _0x35175f[_0xa382('0x23')](_0x5866c4)[_0xa382('0x24')](function(_0x6753e1){return _0x6753e1;});}return null;};}function removeEntity(_0x36d2d6,_0x5d43ae){return function(_0x5dc83f){if(_0x5dc83f){return _0x5dc83f['destroy']()['then'](function(){_0x36d2d6[_0xa382('0x18')](0xcc)[_0xa382('0x19')]();});}};}function handleEntityNotFound(_0x1cbc02,_0x4ed9d6){return function(_0x3cb8c8){if(!_0x3cb8c8){_0x1cbc02[_0xa382('0x17')](0x194);}return _0x3cb8c8;};}function handleError(_0x31a860,_0x59412){_0x59412=_0x59412||0x1f4;return function(_0xa448cf){logger[_0xa382('0x25')](_0xa448cf[_0xa382('0x26')]);if(_0xa448cf[_0xa382('0x27')]){delete _0xa448cf['name'];}_0x31a860[_0xa382('0x18')](_0x59412)[_0xa382('0x28')](_0xa448cf);};}exports[_0xa382('0x29')]=function(_0x1847f6,_0x12e345){var _0x26a8f4={},_0x2c6aa0={},_0x1b2f47={'count':0x0,'rows':[]};var _0x50609a=_['map'](db['MailTransferReport'][_0xa382('0x2a')],function(_0x136c32){return{'name':_0x136c32['fieldName'],'type':_0x136c32[_0xa382('0x2b')]['key']};});_0x2c6aa0['model']=_[_0xa382('0x2c')](_0x50609a,_0xa382('0x27'));_0x2c6aa0['query']=_[_0xa382('0x2d')](_0x1847f6['query']);_0x2c6aa0[_0xa382('0x2e')]=_[_0xa382('0x2f')](_0x2c6aa0[_0xa382('0x30')],_0x2c6aa0[_0xa382('0x31')]);_0x26a8f4[_0xa382('0x32')]=_[_0xa382('0x2f')](_0x2c6aa0['model'],qs['fields'](_0x1847f6[_0xa382('0x31')][_0xa382('0x33')]));_0x26a8f4[_0xa382('0x32')]=_0x26a8f4[_0xa382('0x32')][_0xa382('0x34')]?_0x26a8f4[_0xa382('0x32')]:_0x2c6aa0[_0xa382('0x30')];if(!_0x1847f6[_0xa382('0x31')][_0xa382('0x35')]('nolimit')){_0x26a8f4[_0xa382('0x1d')]=qs[_0xa382('0x1d')](_0x1847f6[_0xa382('0x31')][_0xa382('0x1d')]);_0x26a8f4[_0xa382('0x1b')]=qs[_0xa382('0x1b')](_0x1847f6[_0xa382('0x31')][_0xa382('0x1b')]);}_0x26a8f4[_0xa382('0x36')]=qs[_0xa382('0x37')](_0x1847f6['query'][_0xa382('0x37')]);_0x26a8f4[_0xa382('0x38')]=qs[_0xa382('0x2e')](_[_0xa382('0x39')](_0x1847f6[_0xa382('0x31')],_0x2c6aa0[_0xa382('0x2e')]),_0x50609a);if(_0x1847f6[_0xa382('0x31')][_0xa382('0x3a')]){_0x26a8f4[_0xa382('0x38')]=_['merge'](_0x26a8f4[_0xa382('0x38')],{'$or':_[_0xa382('0x2c')](_0x50609a,function(_0xb6ac6a){if(_0xb6ac6a[_0xa382('0x2b')]!==_0xa382('0x3b')){var _0x1b448d={};_0x1b448d[_0xb6ac6a['name']]={'$like':'%'+_0x1847f6[_0xa382('0x31')][_0xa382('0x3a')]+'%'};return _0x1b448d;}})});}_0x26a8f4=_[_0xa382('0x3c')]({},_0x26a8f4,_0x1847f6[_0xa382('0x3d')]);var _0x201409={'where':_0x26a8f4[_0xa382('0x38')]};return db[_0xa382('0x3e')][_0xa382('0x1e')](_0x201409)[_0xa382('0x24')](function(_0x2431c0){_0x1b2f47[_0xa382('0x1e')]=_0x2431c0;if(_0x1847f6[_0xa382('0x31')][_0xa382('0x3f')]){_0x26a8f4['include']=[{'all':!![]}];}return db[_0xa382('0x3e')][_0xa382('0x40')](_0x26a8f4);})[_0xa382('0x24')](function(_0x4e31c9){_0x1b2f47[_0xa382('0x41')]=_0x4e31c9;return _0x1b2f47;})['then'](respondWithFilteredResult(_0x12e345,_0x26a8f4))[_0xa382('0x42')](handleError(_0x12e345,null));};exports[_0xa382('0x43')]=function(_0x513314,_0x554fb6){var _0x2993fd={'raw':!![],'where':{'id':_0x513314[_0xa382('0x44')]['id']}},_0x585b35={};_0x585b35['model']=_[_0xa382('0x2d')](db[_0xa382('0x3e')][_0xa382('0x2a')]);_0x585b35[_0xa382('0x31')]=_[_0xa382('0x2d')](_0x513314['query']);_0x585b35['filters']=_[_0xa382('0x2f')](_0x585b35[_0xa382('0x30')],_0x585b35['query']);_0x2993fd[_0xa382('0x32')]=_[_0xa382('0x2f')](_0x585b35[_0xa382('0x30')],qs[_0xa382('0x33')](_0x513314[_0xa382('0x31')][_0xa382('0x33')]));_0x2993fd[_0xa382('0x32')]=_0x2993fd['attributes'][_0xa382('0x34')]?_0x2993fd[_0xa382('0x32')]:_0x585b35['model'];if(_0x513314[_0xa382('0x31')][_0xa382('0x3f')]){_0x2993fd[_0xa382('0x45')]=[{'all':!![]}];}_0x2993fd=_[_0xa382('0x3c')]({},_0x2993fd,_0x513314[_0xa382('0x3d')]);return db[_0xa382('0x3e')]['find'](_0x2993fd)[_0xa382('0x24')](handleEntityNotFound(_0x554fb6,null))['then'](respondWithResult(_0x554fb6,null))['catch'](handleError(_0x554fb6,null));};exports[_0xa382('0x46')]=function(_0x4eb093,_0x31e81c){return db['MailTransferReport'][_0xa382('0x46')](_0x4eb093[_0xa382('0x47')],{})[_0xa382('0x24')](respondWithResult(_0x31e81c,0xc9))[_0xa382('0x42')](handleError(_0x31e81c,null));};exports['update']=function(_0x1b2e63,_0x485fba){if(_0x1b2e63[_0xa382('0x47')]['id']){delete _0x1b2e63[_0xa382('0x47')]['id'];}return db[_0xa382('0x3e')]['find']({'where':{'id':_0x1b2e63['params']['id']}})[_0xa382('0x24')](handleEntityNotFound(_0x485fba,null))[_0xa382('0x24')](saveUpdates(_0x1b2e63[_0xa382('0x47')],null))[_0xa382('0x24')](respondWithResult(_0x485fba,null))['catch'](handleError(_0x485fba,null));};exports[_0xa382('0x48')]=function(_0xcd1223,_0x102163){return db[_0xa382('0x3e')][_0xa382('0x49')]({'where':{'id':_0xcd1223['params']['id']}})[_0xa382('0x24')](handleEntityNotFound(_0x102163,null))[_0xa382('0x24')](removeEntity(_0x102163,null))[_0xa382('0x42')](handleError(_0x102163,null));};exports[_0xa382('0x4a')]=function(_0x1e0734,_0x57689a){return db[_0xa382('0x3e')][_0xa382('0x4a')]()['then'](respondWithResult(_0x57689a,null))[_0xa382('0x42')](handleError(_0x57689a,null));}; \ No newline at end of file +var _0x387f=['end','json','count','offset','limit','status','Content-Range','apply','reject','save','destroy','then','error','name','index','map','MailTransferReport','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4adb19,_0x3d3761){var _0x10274b=function(_0x73ca64){while(--_0x73ca64){_0x4adb19['push'](_0x4adb19['shift']());}};_0x10274b(++_0x3d3761);}(_0x387f,0x19c));var _0xf387=function(_0xa06b3f,_0x2cee0b){_0xa06b3f=_0xa06b3f-0x0;var _0x1c007e=_0x387f[_0xa06b3f];return _0x1c007e;};'use strict';var emlformat=require(_0xf387('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf387('0x1'));var jsonpatch=require(_0xf387('0x2'));var rp=require('request-promise');var moment=require(_0xf387('0x3'));var BPromise=require(_0xf387('0x4'));var Mustache=require(_0xf387('0x5'));var util=require(_0xf387('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf387('0x7'));var ejs=require(_0xf387('0x8'));var fs=require('fs');var fs_extra=require(_0xf387('0x9'));var _=require('lodash');var squel=require(_0xf387('0xa'));var crypto=require(_0xf387('0xb'));var jsforce=require(_0xf387('0xc'));var deskjs=require(_0xf387('0xd'));var toCsv=require(_0xf387('0x7'));var querystring=require(_0xf387('0xe'));var Papa=require(_0xf387('0xf'));var Redis=require(_0xf387('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf387('0x11'));var as=require(_0xf387('0x12'));var hardwareService=require(_0xf387('0x13'));var logger=require(_0xf387('0x14'))(_0xf387('0x15'));var utils=require(_0xf387('0x16'));var config=require(_0xf387('0x17'));var licenseUtil=require(_0xf387('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120598,_0x4be1a6){_0x4be1a6=_0x4be1a6||0xcc;return function(_0x2a1364){if(_0x2a1364){return _0x120598[_0xf387('0x19')](_0x4be1a6);}return _0x120598['status'](_0x4be1a6)[_0xf387('0x1a')]();};}function respondWithResult(_0x4a2144,_0xa3b5a9){_0xa3b5a9=_0xa3b5a9||0xc8;return function(_0x2a93f0){if(_0x2a93f0){return _0x4a2144['status'](_0xa3b5a9)[_0xf387('0x1b')](_0x2a93f0);}};}function respondWithFilteredResult(_0x50b3c3,_0x227c25){return function(_0x47c1c3){if(_0x47c1c3){var _0x3da3ba=typeof _0x227c25['offset']==='undefined'&&typeof _0x227c25['limit']==='undefined';var _0xdf80f2=_0x47c1c3[_0xf387('0x1c')];var _0x5573e6=_0x3da3ba?0x0:_0x227c25[_0xf387('0x1d')];var _0x5cfc11=_0x3da3ba?_0x47c1c3['count']:_0x227c25['offset']+_0x227c25[_0xf387('0x1e')];var _0x2344b7;if(_0x5cfc11>=_0xdf80f2){_0x5cfc11=_0xdf80f2;_0x2344b7=0xc8;}else{_0x2344b7=0xce;}_0x50b3c3[_0xf387('0x1f')](_0x2344b7);return _0x50b3c3['set'](_0xf387('0x20'),_0x5573e6+'-'+_0x5cfc11+'/'+_0xdf80f2)['json'](_0x47c1c3);}return null;};}function patchUpdates(_0x27227c){return function(_0x1d9783){try{jsonpatch[_0xf387('0x21')](_0x1d9783,_0x27227c,!![]);}catch(_0x2e6fe1){return BPromise[_0xf387('0x22')](_0x2e6fe1);}return _0x1d9783[_0xf387('0x23')]();};}function saveUpdates(_0x3be7d5,_0x364247){return function(_0x5d00cb){if(_0x5d00cb){return _0x5d00cb['update'](_0x3be7d5)['then'](function(_0x39d87e){return _0x39d87e;});}return null;};}function removeEntity(_0x401799,_0x5003d9){return function(_0x2ad27e){if(_0x2ad27e){return _0x2ad27e[_0xf387('0x24')]()[_0xf387('0x25')](function(){_0x401799['status'](0xcc)[_0xf387('0x1a')]();});}};}function handleEntityNotFound(_0x2be85b,_0x2c856e){return function(_0x3d677d){if(!_0x3d677d){_0x2be85b[_0xf387('0x19')](0x194);}return _0x3d677d;};}function handleError(_0x332edc,_0x4fb2ac){_0x4fb2ac=_0x4fb2ac||0x1f4;return function(_0x229dac){logger[_0xf387('0x26')](_0x229dac['stack']);if(_0x229dac[_0xf387('0x27')]){delete _0x229dac[_0xf387('0x27')];}_0x332edc['status'](_0x4fb2ac)['send'](_0x229dac);};}exports[_0xf387('0x28')]=function(_0x34ecfc,_0x472a1e){var _0x16d4de={},_0x2410a1={},_0x4d3bd7={'count':0x0,'rows':[]};var _0x490e7e=_[_0xf387('0x29')](db[_0xf387('0x2a')][_0xf387('0x2b')],function(_0x2fcfae){return{'name':_0x2fcfae[_0xf387('0x2c')],'type':_0x2fcfae[_0xf387('0x2d')]['key']};});_0x2410a1['model']=_[_0xf387('0x29')](_0x490e7e,_0xf387('0x27'));_0x2410a1[_0xf387('0x2e')]=_['keys'](_0x34ecfc[_0xf387('0x2e')]);_0x2410a1['filters']=_[_0xf387('0x2f')](_0x2410a1[_0xf387('0x30')],_0x2410a1[_0xf387('0x2e')]);_0x16d4de[_0xf387('0x31')]=_[_0xf387('0x2f')](_0x2410a1['model'],qs[_0xf387('0x32')](_0x34ecfc['query'][_0xf387('0x32')]));_0x16d4de[_0xf387('0x31')]=_0x16d4de['attributes']['length']?_0x16d4de['attributes']:_0x2410a1[_0xf387('0x30')];if(!_0x34ecfc[_0xf387('0x2e')]['hasOwnProperty'](_0xf387('0x33'))){_0x16d4de[_0xf387('0x1e')]=qs[_0xf387('0x1e')](_0x34ecfc[_0xf387('0x2e')][_0xf387('0x1e')]);_0x16d4de[_0xf387('0x1d')]=qs[_0xf387('0x1d')](_0x34ecfc['query'][_0xf387('0x1d')]);}_0x16d4de[_0xf387('0x34')]=qs[_0xf387('0x35')](_0x34ecfc[_0xf387('0x2e')][_0xf387('0x35')]);_0x16d4de[_0xf387('0x36')]=qs[_0xf387('0x37')](_[_0xf387('0x38')](_0x34ecfc[_0xf387('0x2e')],_0x2410a1[_0xf387('0x37')]),_0x490e7e);if(_0x34ecfc[_0xf387('0x2e')][_0xf387('0x39')]){_0x16d4de[_0xf387('0x36')]=_['merge'](_0x16d4de[_0xf387('0x36')],{'$or':_[_0xf387('0x29')](_0x490e7e,function(_0x498e1a){if(_0x498e1a[_0xf387('0x2d')]!==_0xf387('0x3a')){var _0x59ef32={};_0x59ef32[_0x498e1a[_0xf387('0x27')]]={'$like':'%'+_0x34ecfc[_0xf387('0x2e')][_0xf387('0x39')]+'%'};return _0x59ef32;}})});}_0x16d4de=_[_0xf387('0x3b')]({},_0x16d4de,_0x34ecfc['options']);var _0x360422={'where':_0x16d4de[_0xf387('0x36')]};return db['MailTransferReport']['count'](_0x360422)[_0xf387('0x25')](function(_0x1fec0d){_0x4d3bd7[_0xf387('0x1c')]=_0x1fec0d;if(_0x34ecfc['query']['includeAll']){_0x16d4de[_0xf387('0x3c')]=[{'all':!![]}];}return db[_0xf387('0x2a')][_0xf387('0x3d')](_0x16d4de);})[_0xf387('0x25')](function(_0x48f14f){_0x4d3bd7[_0xf387('0x3e')]=_0x48f14f;return _0x4d3bd7;})[_0xf387('0x25')](respondWithFilteredResult(_0x472a1e,_0x16d4de))[_0xf387('0x3f')](handleError(_0x472a1e,null));};exports[_0xf387('0x40')]=function(_0x112512,_0x5293b4){var _0x15c81d={'raw':!![],'where':{'id':_0x112512[_0xf387('0x41')]['id']}},_0x26ae1a={};_0x26ae1a['model']=_[_0xf387('0x42')](db[_0xf387('0x2a')][_0xf387('0x2b')]);_0x26ae1a[_0xf387('0x2e')]=_[_0xf387('0x42')](_0x112512[_0xf387('0x2e')]);_0x26ae1a[_0xf387('0x37')]=_[_0xf387('0x2f')](_0x26ae1a[_0xf387('0x30')],_0x26ae1a[_0xf387('0x2e')]);_0x15c81d[_0xf387('0x31')]=_[_0xf387('0x2f')](_0x26ae1a[_0xf387('0x30')],qs[_0xf387('0x32')](_0x112512[_0xf387('0x2e')][_0xf387('0x32')]));_0x15c81d['attributes']=_0x15c81d[_0xf387('0x31')][_0xf387('0x43')]?_0x15c81d[_0xf387('0x31')]:_0x26ae1a[_0xf387('0x30')];if(_0x112512['query']['includeAll']){_0x15c81d[_0xf387('0x3c')]=[{'all':!![]}];}_0x15c81d=_['merge']({},_0x15c81d,_0x112512[_0xf387('0x44')]);return db[_0xf387('0x2a')][_0xf387('0x45')](_0x15c81d)['then'](handleEntityNotFound(_0x5293b4,null))[_0xf387('0x25')](respondWithResult(_0x5293b4,null))[_0xf387('0x3f')](handleError(_0x5293b4,null));};exports['create']=function(_0x58895e,_0x442cfe){return db[_0xf387('0x2a')][_0xf387('0x46')](_0x58895e[_0xf387('0x47')],{})['then'](respondWithResult(_0x442cfe,0xc9))[_0xf387('0x3f')](handleError(_0x442cfe,null));};exports[_0xf387('0x48')]=function(_0x18e7fc,_0x2ef96d){if(_0x18e7fc[_0xf387('0x47')]['id']){delete _0x18e7fc[_0xf387('0x47')]['id'];}return db[_0xf387('0x2a')][_0xf387('0x45')]({'where':{'id':_0x18e7fc[_0xf387('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ef96d,null))[_0xf387('0x25')](saveUpdates(_0x18e7fc[_0xf387('0x47')],null))[_0xf387('0x25')](respondWithResult(_0x2ef96d,null))[_0xf387('0x3f')](handleError(_0x2ef96d,null));};exports[_0xf387('0x24')]=function(_0x1485e4,_0x3cd454){return db['MailTransferReport'][_0xf387('0x45')]({'where':{'id':_0x1485e4[_0xf387('0x41')]['id']}})['then'](handleEntityNotFound(_0x3cd454,null))['then'](removeEntity(_0x3cd454,null))['catch'](handleError(_0x3cd454,null));};exports['describe']=function(_0x18fc11,_0x2f1f78){return db[_0xf387('0x2a')]['describe']()[_0xf387('0x25')](respondWithResult(_0x2f1f78,null))[_0xf387('0x3f')](handleError(_0x2f1f78,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 11bfee1..bbd2b9e 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 _0x6340=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6340,0x71));var _0x0634=function(_0x403e7f,_0x4912f0){_0x403e7f=_0x403e7f-0x0;var _0x18eef0=_0x6340[_0x403e7f];return _0x18eef0;};'use strict';var _=require(_0x0634('0x0'));var util=require(_0x0634('0x1'));var logger=require(_0x0634('0x2'))(_0x0634('0x3'));var moment=require('moment');var BPromise=require(_0x0634('0x4'));var rp=require(_0x0634('0x5'));var fs=require('fs');var path=require(_0x0634('0x6'));var rimraf=require(_0x0634('0x7'));var config=require('../../config/environment');var attributes=require(_0x0634('0x8'));module[_0x0634('0x9')]=function(_0x3e7cc4,_0x393588){return _0x3e7cc4[_0x0634('0xa')](_0x0634('0xb'),attributes,{'tableName':_0x0634('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0634('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb957=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','../../config/logger'];(function(_0x1dc8dc,_0x384acb){var _0x9b6337=function(_0x77f445){while(--_0x77f445){_0x1dc8dc['push'](_0x1dc8dc['shift']());}};_0x9b6337(++_0x384acb);}(_0xb957,0x6d));var _0x7b95=function(_0x538384,_0xafbcef){_0x538384=_0x538384-0x0;var _0x36a5b7=_0xb957[_0x538384];return _0x36a5b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b95('0x0'))('api');var moment=require(_0x7b95('0x1'));var BPromise=require(_0x7b95('0x2'));var rp=require(_0x7b95('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b95('0x4'));var config=require(_0x7b95('0x5'));var attributes=require(_0x7b95('0x6'));module[_0x7b95('0x7')]=function(_0x19ff14,_0x518099){return _0x19ff14[_0x7b95('0x8')](_0x7b95('0x9'),attributes,{'tableName':_0x7b95('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 55fd00d..2b9e174 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 _0x8128=['../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4fd045,_0x15e4a5){var _0x5f5aa6=function(_0x5ac61b){while(--_0x5ac61b){_0x4fd045['push'](_0x4fd045['shift']());}};_0x5f5aa6(++_0x15e4a5);}(_0x8128,0xe0));var _0x8812=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8128[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x8812('0x0'));var util=require(_0x8812('0x1'));var moment=require('moment');var BPromise=require(_0x8812('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8812('0x3'));var db=require(_0x8812('0x4'))['db'];var utils=require(_0x8812('0x5'));var logger=require(_0x8812('0x6'))('rpc');var config=require(_0x8812('0x7'));var jayson=require(_0x8812('0x8'));var client=jayson[_0x8812('0x9')][_0x8812('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x549808,_0x119def,_0x4f9e70){return new BPromise(function(_0x57fdc9,_0x2aeebd){return client[_0x8812('0xb')](_0x549808,_0x4f9e70)['then'](function(_0x910b8f){logger[_0x8812('0xc')](_0x8812('0xd'),_0x119def,'request\x20sent');logger[_0x8812('0xe')](_0x8812('0xf'),_0x119def,_0x8812('0x10'),JSON[_0x8812('0x11')](_0x910b8f));if(_0x910b8f[_0x8812('0x12')]){if(_0x910b8f[_0x8812('0x12')]['code']===0x1f4){logger[_0x8812('0x12')](_0x8812('0xd'),_0x119def,_0x910b8f[_0x8812('0x12')][_0x8812('0x13')]);return _0x2aeebd(_0x910b8f['error'][_0x8812('0x13')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x119def,_0x910b8f[_0x8812('0x12')][_0x8812('0x13')]);return _0x57fdc9(_0x910b8f[_0x8812('0x12')][_0x8812('0x13')]);}else{logger[_0x8812('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x119def,_0x8812('0x10'));_0x57fdc9(_0x910b8f[_0x8812('0x14')]['message']);}})['catch'](function(_0x5671d9){logger[_0x8812('0x12')](_0x8812('0xd'),_0x119def,_0x5671d9);_0x2aeebd(_0x5671d9);});});} \ No newline at end of file +var _0xed87=['MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x29f2c0,_0x1522c6){var _0x46a946=function(_0x447b61){while(--_0x447b61){_0x29f2c0['push'](_0x29f2c0['shift']());}};_0x46a946(++_0x1522c6);}(_0xed87,0x110));var _0x7ed8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xed87[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x7ed8('0x0'));var moment=require(_0x7ed8('0x1'));var BPromise=require(_0x7ed8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ed8('0x3'));var db=require(_0x7ed8('0x4'))['db'];var utils=require(_0x7ed8('0x5'));var logger=require(_0x7ed8('0x6'))('rpc');var config=require(_0x7ed8('0x7'));var jayson=require(_0x7ed8('0x8'));var client=jayson[_0x7ed8('0x9')][_0x7ed8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39b8b8,_0xbd4890,_0x3e7ad3){return new BPromise(function(_0x407180,_0x4b7c41){return client['request'](_0x39b8b8,_0x3e7ad3)[_0x7ed8('0xb')](function(_0x73a76f){logger[_0x7ed8('0xc')](_0x7ed8('0xd'),_0xbd4890,_0x7ed8('0xe'));logger[_0x7ed8('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xbd4890,_0x7ed8('0xe'),JSON['stringify'](_0x73a76f));if(_0x73a76f[_0x7ed8('0x10')]){if(_0x73a76f['error']['code']===0x1f4){logger[_0x7ed8('0x10')](_0x7ed8('0xd'),_0xbd4890,_0x73a76f['error'][_0x7ed8('0x11')]);return _0x4b7c41(_0x73a76f[_0x7ed8('0x10')][_0x7ed8('0x11')]);}logger[_0x7ed8('0x10')]('MailTransferReport,\x20%s,\x20%s',_0xbd4890,_0x73a76f[_0x7ed8('0x10')][_0x7ed8('0x11')]);return _0x407180(_0x73a76f['error']['message']);}else{logger['info'](_0x7ed8('0xd'),_0xbd4890,_0x7ed8('0xe'));_0x407180(_0x73a76f['result'][_0x7ed8('0x11')]);}})[_0x7ed8('0x12')](function(_0x55ff86){logger[_0x7ed8('0x10')]('MailTransferReport,\x20%s,\x20%s',_0xbd4890,_0x55ff86);_0x4b7c41(_0x55ff86);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index aa2b58f..78990a5 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 _0x2365=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x2365,0xe3));var _0x5236=function(_0x2cbde6,_0x1f13cd){_0x2cbde6=_0x2cbde6-0x0;var _0x104112=_0x2365[_0x2cbde6];return _0x104112;};'use strict';var multer=require(_0x5236('0x0'));var util=require(_0x5236('0x1'));var path=require(_0x5236('0x2'));var timeout=require(_0x5236('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5236('0x4'));var auth=require(_0x5236('0x5'));var interaction=require(_0x5236('0x6'));var config=require(_0x5236('0x7'));var controller=require(_0x5236('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5236('0x9')]);router[_0x5236('0xa')](_0x5236('0xb'),auth[_0x5236('0xc')](),controller[_0x5236('0xd')]);router[_0x5236('0xa')](_0x5236('0xe'),auth[_0x5236('0xc')](),controller[_0x5236('0xf')]);router[_0x5236('0x10')]('/',auth[_0x5236('0xc')](),controller[_0x5236('0x11')]);router[_0x5236('0x12')](_0x5236('0xe'),auth[_0x5236('0xc')](),controller[_0x5236('0x13')]);router[_0x5236('0x14')]('/:id',auth[_0x5236('0xc')](),controller['destroy']);module[_0x5236('0x15')]=router; \ No newline at end of file +var _0x204b=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x521b9a,_0x217b1c){var _0x5786aa=function(_0x1af041){while(--_0x1af041){_0x521b9a['push'](_0x521b9a['shift']());}};_0x5786aa(++_0x217b1c);}(_0x204b,0x189));var _0xb204=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x204b[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0xb204('0x0'));var util=require(_0xb204('0x1'));var path=require('path');var timeout=require(_0xb204('0x2'));var express=require(_0xb204('0x3'));var router=express[_0xb204('0x4')]();var fs_extra=require(_0xb204('0x5'));var auth=require(_0xb204('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb204('0x7'));var controller=require(_0xb204('0x8'));router[_0xb204('0x9')]('/',auth[_0xb204('0xa')](),controller[_0xb204('0xb')]);router[_0xb204('0x9')]('/describe',auth[_0xb204('0xa')](),controller[_0xb204('0xc')]);router[_0xb204('0x9')](_0xb204('0xd'),auth[_0xb204('0xa')](),controller['show']);router[_0xb204('0xe')]('/',auth[_0xb204('0xa')](),controller[_0xb204('0xf')]);router[_0xb204('0x10')](_0xb204('0xd'),auth[_0xb204('0xa')](),controller[_0xb204('0x11')]);router[_0xb204('0x12')]('/:id',auth[_0xb204('0xa')](),controller[_0xb204('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6949567..e57442c 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 _0xccdc=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x4007b1,_0x206901){var _0x108d6c=function(_0x84fcb6){while(--_0x84fcb6){_0x4007b1['push'](_0x4007b1['shift']());}};_0x108d6c(++_0x206901);}(_0xccdc,0x1c4));var _0xcccd=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xccdc[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0xcccd('0x0'));var moment=require(_0xcccd('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xcccd('0x2')]},'interface':{'type':Sequelize[_0xcccd('0x2')]},'type':{'type':Sequelize[_0xcccd('0x2')],'defaultValue':_0xcccd('0x3'),'comment':_0xcccd('0x4')},'duration':{'type':Sequelize[_0xcccd('0x5')]},'enterAt':{'type':Sequelize[_0xcccd('0x6')]},'exitAt':{'type':Sequelize[_0xcccd('0x6')],'set':function(_0x2da46a){var _0x18365a=moment(_0x2da46a);var _0x5bd55e=moment(this[_0xcccd('0x7')](_0xcccd('0x8')));var _0x1b8c05=_0x18365a[_0xcccd('0x9')](_0x5bd55e,_0xcccd('0xa'));this[_0xcccd('0xb')](_0xcccd('0xc'),_0x2da46a);this[_0xcccd('0xb')]('duration',_0x1b8c05||null);}},'data1':{'type':Sequelize[_0xcccd('0x2')],'comment':_0xcccd('0xd')},'data2':{'type':Sequelize[_0xcccd('0x2')],'comment':_0xcccd('0xe')},'data3':{'type':Sequelize[_0xcccd('0x2')],'comment':_0xcccd('0xf')},'data4':{'type':Sequelize[_0xcccd('0x2')],'comment':_0xcccd('0x10')},'data5':{'type':Sequelize[_0xcccd('0x2')],'comment':_0xcccd('0x11')},'role':{'type':Sequelize[_0xcccd('0x2')]},'internal':{'type':Sequelize[_0xcccd('0x5')]},'uniqueid':{'type':Sequelize[_0xcccd('0x2')]}}; \ No newline at end of file +var _0x8c38=['moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','sequelize'];(function(_0x1287a6,_0x38b142){var _0x3b6196=function(_0x216e82){while(--_0x216e82){_0x1287a6['push'](_0x1287a6['shift']());}};_0x3b6196(++_0x38b142);}(_0x8c38,0x83));var _0x88c3=function(_0x2f190a,_0x2a2a88){_0x2f190a=_0x2f190a-0x0;var _0x26864a=_0x8c38[_0x2f190a];return _0x26864a;};'use strict';var Sequelize=require(_0x88c3('0x0'));var moment=require(_0x88c3('0x1'));module['exports']={'channel':{'type':Sequelize[_0x88c3('0x2')]},'membername':{'type':Sequelize[_0x88c3('0x2')]},'interface':{'type':Sequelize[_0x88c3('0x2')]},'type':{'type':Sequelize[_0x88c3('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x88c3('0x3')},'duration':{'type':Sequelize[_0x88c3('0x4')]},'enterAt':{'type':Sequelize[_0x88c3('0x5')]},'exitAt':{'type':Sequelize[_0x88c3('0x5')],'set':function(_0x2c413c){var _0x6b76d7=moment(_0x2c413c);var _0xcdbc28=moment(this[_0x88c3('0x6')]('enterAt'));var _0x350a11=_0x6b76d7['diff'](_0xcdbc28,_0x88c3('0x7'));this['setDataValue'](_0x88c3('0x8'),_0x2c413c);this['setDataValue'](_0x88c3('0x9'),_0x350a11||null);}},'data1':{'type':Sequelize[_0x88c3('0x2')],'comment':_0x88c3('0xa')},'data2':{'type':Sequelize[_0x88c3('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x88c3('0x2')],'comment':_0x88c3('0xb')},'data4':{'type':Sequelize[_0x88c3('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x88c3('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x88c3('0x4')]},'uniqueid':{'type':Sequelize[_0x88c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index ff4a3ed..aa41194 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x259d21,_0x3d8c0d){var _0x3bee08=function(_0x5bfbf3){while(--_0x5bfbf3){_0x259d21['push'](_0x259d21['shift']());}};_0x3bee08(++_0x3d8c0d);}(_0x3e74,0x175));var _0x43e7=function(_0x254137,_0x4ae05b){_0x254137=_0x254137-0x0;var _0xf851cd=_0x3e74[_0x254137];return _0xf851cd;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x55ca,0x126));var _0xa55c=function(_0x3bcf9e,_0x148a5d){_0x3bcf9e=_0x3bcf9e-0x0;var _0x1bb37c=_0x55ca[_0x3bcf9e];return _0x1bb37c;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 2ab65a8..5681772 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 _0x090c=['membername_interface','interface','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member'];(function(_0x5bca60,_0x791d29){var _0x11963c=function(_0x4fb1d9){while(--_0x4fb1d9){_0x5bca60['push'](_0x5bca60['shift']());}};_0x11963c(++_0x791d29);}(_0x090c,0xb6));var _0xc090=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x090c[_0x30033a];return _0x5e3518;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc090('0x0'));var BPromise=require(_0xc090('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc090('0x2'));var config=require(_0xc090('0x3'));var attributes=require(_0xc090('0x4'));module['exports']=function(_0x467998,_0x5d9dab){return _0x467998[_0xc090('0x5')](_0xc090('0x6'),attributes,{'tableName':_0xc090('0x7'),'paranoid':![],'indexes':[{'name':_0xc090('0x8'),'fields':['membername',_0xc090('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x798e=['interface','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x798e,0x187));var _0xe798=function(_0x550e68,_0x368a74){_0x550e68=_0x550e68-0x0;var _0x5865bf=_0x798e[_0x550e68];return _0x5865bf;};'use strict';var _=require(_0xe798('0x0'));var util=require('util');var logger=require(_0xe798('0x1'))(_0xe798('0x2'));var moment=require(_0xe798('0x3'));var BPromise=require('bluebird');var rp=require(_0xe798('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe798('0x5'));var config=require(_0xe798('0x6'));var attributes=require(_0xe798('0x7'));module[_0xe798('0x8')]=function(_0x450efb,_0x4a4716){return _0x450efb[_0xe798('0x9')](_0xe798('0xa'),attributes,{'tableName':_0xe798('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xe798('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b6fcc52..ef0578d 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 _0x0845=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','catch','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','bluebird','randomstring'];(function(_0x137b5d,_0x3bd313){var _0x5a0102=function(_0x630912){while(--_0x630912){_0x137b5d['push'](_0x137b5d['shift']());}};_0x5a0102(++_0x3bd313);}(_0x0845,0x125));var _0x5084=function(_0x3ae6d6,_0x3112b0){_0x3ae6d6=_0x3ae6d6-0x0;var _0x30b1ae=_0x0845[_0x3ae6d6];return _0x30b1ae;};'use strict';var _=require(_0x5084('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5084('0x1'));var rs=require(_0x5084('0x2'));var fs=require('fs');var Redis=require(_0x5084('0x3'));var db=require(_0x5084('0x4'))['db'];var utils=require(_0x5084('0x5'));var logger=require(_0x5084('0x6'))('rpc');var config=require(_0x5084('0x7'));var jayson=require(_0x5084('0x8'));var client=jayson[_0x5084('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3d8f,_0x5a999b,_0x212120){return new BPromise(function(_0x439176,_0x14e571){return client['request'](_0x5f3d8f,_0x212120)['then'](function(_0xbbddf0){logger[_0x5084('0xa')](_0x5084('0xb'),_0x5a999b,'request\x20sent');logger[_0x5084('0xc')](_0x5084('0xd'),_0x5a999b,_0x5084('0xe'),JSON['stringify'](_0xbbddf0));if(_0xbbddf0['error']){if(_0xbbddf0[_0x5084('0xf')][_0x5084('0x10')]===0x1f4){logger[_0x5084('0xf')](_0x5084('0xb'),_0x5a999b,_0xbbddf0[_0x5084('0xf')][_0x5084('0x11')]);return _0x14e571(_0xbbddf0[_0x5084('0xf')][_0x5084('0x11')]);}logger['error'](_0x5084('0xb'),_0x5a999b,_0xbbddf0[_0x5084('0xf')][_0x5084('0x11')]);return _0x439176(_0xbbddf0['error'][_0x5084('0x11')]);}else{logger[_0x5084('0xa')](_0x5084('0xb'),_0x5a999b,_0x5084('0xe'));_0x439176(_0xbbddf0['result'][_0x5084('0x11')]);}})['catch'](function(_0x326ca0){logger[_0x5084('0xf')](_0x5084('0xb'),_0x5a999b,_0x326ca0);_0x14e571(_0x326ca0);});});}exports[_0x5084('0x12')]=function(_0x2072b8){var _0x425c46=this;return new Promise(function(_0x369fb5,_0x10a27c){return db[_0x5084('0x13')][_0x5084('0x14')]({'raw':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')][_0x5084('0x16')]===undefined?!![]:![]:!![],'where':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')][_0x5084('0x17')]||null:null,'attributes':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')][_0x5084('0x18')]||null:null,'limit':_0x2072b8[_0x5084('0x15')]?_0x2072b8['options'][_0x5084('0x19')]||null:null,'include':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')]['include']?_['map'](_0x2072b8['options'][_0x5084('0x1a')],function(_0x224c29){return{'model':db[_0x224c29['model']],'as':_0x224c29['as'],'attributes':_0x224c29[_0x5084('0x18')],'include':_0x224c29[_0x5084('0x1a')]?_['map'](_0x224c29[_0x5084('0x1a')],function(_0xfe242a){return{'model':db[_0xfe242a[_0x5084('0x1b')]],'as':_0xfe242a['as'],'attributes':_0xfe242a[_0x5084('0x18')],'include':_0xfe242a[_0x5084('0x1a')]?_[_0x5084('0x1c')](_0xfe242a['include'],function(_0x11b910){return{'model':db[_0x11b910[_0x5084('0x1b')]],'as':_0x11b910['as'],'attributes':_0x11b910['attributes']};}):[]};}):[]};}):[]:[]})[_0x5084('0x1d')](function(_0xe21c3c){logger['info']('GetMemberReport',_0x2072b8);logger['debug'](_0x5084('0x12'),_0x2072b8,JSON[_0x5084('0x1e')](_0xe21c3c));_0x369fb5(_0xe21c3c);})[_0x5084('0x1f')](function(_0x5760e2){logger[_0x5084('0xf')]('GetMemberReport',_0x5760e2[_0x5084('0x11')],_0x2072b8);_0x10a27c(_0x425c46[_0x5084('0xf')](0x1f4,_0x5760e2[_0x5084('0x11')]));});});};exports[_0x5084('0x20')]=function(_0x17268f){var _0x292a54=this;return new Promise(function(_0x3bd529,_0x40541f){return db[_0x5084('0x13')][_0x5084('0x21')](_0x17268f[_0x5084('0x22')],{'raw':_0x17268f[_0x5084('0x15')]?_0x17268f['options'][_0x5084('0x16')]===undefined?!![]:![]:!![]})[_0x5084('0x1d')](function(_0x4c2978){logger['info'](_0x5084('0x20'),_0x17268f);logger[_0x5084('0xc')](_0x5084('0x20'),_0x17268f,JSON['stringify'](_0x4c2978));_0x3bd529(_0x4c2978);})[_0x5084('0x1f')](function(_0x5da13e){logger[_0x5084('0xf')](_0x5084('0x20'),_0x5da13e['message'],_0x17268f);_0x40541f(_0x292a54[_0x5084('0xf')](0x1f4,_0x5da13e[_0x5084('0x11')]));});});};exports[_0x5084('0x23')]=function(_0x3f86bf){var _0x20df84=this;return new Promise(function(_0x5bcfbe,_0xae716c){return db[_0x5084('0x13')][_0x5084('0x24')](_0x3f86bf['body'],{'raw':_0x3f86bf[_0x5084('0x15')]?_0x3f86bf[_0x5084('0x15')][_0x5084('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f86bf[_0x5084('0x15')]?_0x3f86bf[_0x5084('0x15')]['where']||null:null,'attributes':_0x3f86bf[_0x5084('0x15')]?_0x3f86bf[_0x5084('0x15')][_0x5084('0x18')]||null:null,'limit':_0x3f86bf['options']?_0x3f86bf[_0x5084('0x15')][_0x5084('0x19')]||null:null})[_0x5084('0x1d')](function(_0x36fdd8){logger[_0x5084('0xa')]('UpdateMemberReport',_0x3f86bf);logger['debug'](_0x5084('0x23'),_0x3f86bf,JSON['stringify'](_0x36fdd8));_0x5bcfbe(_0x36fdd8);})['catch'](function(_0x463dc2){logger['error']('UpdateMemberReport',_0x463dc2[_0x5084('0x11')],_0x3f86bf);_0xae716c(_0x20df84[_0x5084('0xf')](0x1f4,_0x463dc2[_0x5084('0x11')]));});});}; \ No newline at end of file +var _0xcb41=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','MemberReport','findAll','options','raw','where','attributes','map','include','model','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport','update','limit','lodash'];(function(_0x1d23d6,_0x30b4a6){var _0x4240ad=function(_0x1f0df9){while(--_0x1f0df9){_0x1d23d6['push'](_0x1d23d6['shift']());}};_0x4240ad(++_0x30b4a6);}(_0xcb41,0x1df));var _0x1cb4=function(_0x520934,_0x46f4bb){_0x520934=_0x520934-0x0;var _0x4497f5=_0xcb41[_0x520934];return _0x4497f5;};'use strict';var _=require(_0x1cb4('0x0'));var util=require(_0x1cb4('0x1'));var moment=require(_0x1cb4('0x2'));var BPromise=require(_0x1cb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cb4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb4('0x5'));var logger=require(_0x1cb4('0x6'))(_0x1cb4('0x7'));var config=require(_0x1cb4('0x8'));var jayson=require(_0x1cb4('0x9'));var client=jayson[_0x1cb4('0xa')][_0x1cb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42e7fe,_0x4fd3b6,_0x2b51e3){return new BPromise(function(_0x2a5095,_0x50b603){return client[_0x1cb4('0xc')](_0x42e7fe,_0x2b51e3)[_0x1cb4('0xd')](function(_0x26f5ba){logger['info'](_0x1cb4('0xe'),_0x4fd3b6,_0x1cb4('0xf'));logger[_0x1cb4('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x4fd3b6,'request\x20sent',JSON[_0x1cb4('0x11')](_0x26f5ba));if(_0x26f5ba['error']){if(_0x26f5ba[_0x1cb4('0x12')][_0x1cb4('0x13')]===0x1f4){logger[_0x1cb4('0x12')](_0x1cb4('0xe'),_0x4fd3b6,_0x26f5ba[_0x1cb4('0x12')]['message']);return _0x50b603(_0x26f5ba[_0x1cb4('0x12')]['message']);}logger[_0x1cb4('0x12')](_0x1cb4('0xe'),_0x4fd3b6,_0x26f5ba[_0x1cb4('0x12')][_0x1cb4('0x14')]);return _0x2a5095(_0x26f5ba[_0x1cb4('0x12')][_0x1cb4('0x14')]);}else{logger[_0x1cb4('0x15')](_0x1cb4('0xe'),_0x4fd3b6,_0x1cb4('0xf'));_0x2a5095(_0x26f5ba[_0x1cb4('0x16')]['message']);}})[_0x1cb4('0x17')](function(_0x514285){logger[_0x1cb4('0x12')](_0x1cb4('0xe'),_0x4fd3b6,_0x514285);_0x50b603(_0x514285);});});}exports['GetMemberReport']=function(_0x56d926){var _0x25b120=this;return new Promise(function(_0x281d36,_0xfc93ad){return db[_0x1cb4('0x18')][_0x1cb4('0x19')]({'raw':_0x56d926[_0x1cb4('0x1a')]?_0x56d926[_0x1cb4('0x1a')][_0x1cb4('0x1b')]===undefined?!![]:![]:!![],'where':_0x56d926['options']?_0x56d926[_0x1cb4('0x1a')][_0x1cb4('0x1c')]||null:null,'attributes':_0x56d926['options']?_0x56d926[_0x1cb4('0x1a')][_0x1cb4('0x1d')]||null:null,'limit':_0x56d926[_0x1cb4('0x1a')]?_0x56d926[_0x1cb4('0x1a')]['limit']||null:null,'include':_0x56d926[_0x1cb4('0x1a')]?_0x56d926['options']['include']?_[_0x1cb4('0x1e')](_0x56d926[_0x1cb4('0x1a')][_0x1cb4('0x1f')],function(_0x4d93b9){return{'model':db[_0x4d93b9[_0x1cb4('0x20')]],'as':_0x4d93b9['as'],'attributes':_0x4d93b9[_0x1cb4('0x1d')],'include':_0x4d93b9[_0x1cb4('0x1f')]?_['map'](_0x4d93b9[_0x1cb4('0x1f')],function(_0x1e8d9c){return{'model':db[_0x1e8d9c[_0x1cb4('0x20')]],'as':_0x1e8d9c['as'],'attributes':_0x1e8d9c[_0x1cb4('0x1d')],'include':_0x1e8d9c['include']?_[_0x1cb4('0x1e')](_0x1e8d9c['include'],function(_0x5ef0fe){return{'model':db[_0x5ef0fe['model']],'as':_0x5ef0fe['as'],'attributes':_0x5ef0fe[_0x1cb4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28ac89){logger[_0x1cb4('0x15')]('GetMemberReport',_0x56d926);logger['debug'](_0x1cb4('0x21'),_0x56d926,JSON[_0x1cb4('0x11')](_0x28ac89));_0x281d36(_0x28ac89);})[_0x1cb4('0x17')](function(_0x253864){logger[_0x1cb4('0x12')](_0x1cb4('0x21'),_0x253864['message'],_0x56d926);_0xfc93ad(_0x25b120['error'](0x1f4,_0x253864['message']));});});};exports[_0x1cb4('0x22')]=function(_0x24b709){var _0x22d82a=this;return new Promise(function(_0xd97190,_0x454546){return db[_0x1cb4('0x18')][_0x1cb4('0x23')](_0x24b709[_0x1cb4('0x24')],{'raw':_0x24b709[_0x1cb4('0x1a')]?_0x24b709[_0x1cb4('0x1a')][_0x1cb4('0x1b')]===undefined?!![]:![]:!![]})[_0x1cb4('0xd')](function(_0x26d959){logger[_0x1cb4('0x15')](_0x1cb4('0x22'),_0x24b709);logger[_0x1cb4('0x10')](_0x1cb4('0x22'),_0x24b709,JSON[_0x1cb4('0x11')](_0x26d959));_0xd97190(_0x26d959);})['catch'](function(_0x2722a2){logger[_0x1cb4('0x12')](_0x1cb4('0x22'),_0x2722a2[_0x1cb4('0x14')],_0x24b709);_0x454546(_0x22d82a[_0x1cb4('0x12')](0x1f4,_0x2722a2['message']));});});};exports[_0x1cb4('0x25')]=function(_0xeb037a){var _0x5aa5e4=this;return new Promise(function(_0x375a26,_0x15e139){return db[_0x1cb4('0x18')][_0x1cb4('0x26')](_0xeb037a[_0x1cb4('0x24')],{'raw':_0xeb037a[_0x1cb4('0x1a')]?_0xeb037a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeb037a[_0x1cb4('0x1a')]?_0xeb037a['options']['where']||null:null,'attributes':_0xeb037a[_0x1cb4('0x1a')]?_0xeb037a[_0x1cb4('0x1a')][_0x1cb4('0x1d')]||null:null,'limit':_0xeb037a[_0x1cb4('0x1a')]?_0xeb037a[_0x1cb4('0x1a')][_0x1cb4('0x27')]||null:null})['then'](function(_0x109667){logger[_0x1cb4('0x15')](_0x1cb4('0x25'),_0xeb037a);logger[_0x1cb4('0x10')](_0x1cb4('0x25'),_0xeb037a,JSON[_0x1cb4('0x11')](_0x109667));_0x375a26(_0x109667);})['catch'](function(_0x81955b){logger[_0x1cb4('0x12')](_0x1cb4('0x25'),_0x81955b[_0x1cb4('0x14')],_0xeb037a);_0x15e139(_0x5aa5e4[_0x1cb4('0x12')](0x1f4,_0x81955b[_0x1cb4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index bbf1ceb..0fa9749 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 _0x2d5b=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x1be790,_0x112549){var _0x7668c8=function(_0x47a470){while(--_0x47a470){_0x1be790['push'](_0x1be790['shift']());}};_0x7668c8(++_0x112549);}(_0x2d5b,0x1ce));var _0xb2d5=function(_0x58aad3,_0x2a1647){_0x58aad3=_0x58aad3-0x0;var _0x2618d9=_0x2d5b[_0x58aad3];return _0x2618d9;};'use strict';var multer=require('multer');var util=require(_0xb2d5('0x0'));var path=require(_0xb2d5('0x1'));var timeout=require(_0xb2d5('0x2'));var express=require('express');var router=express[_0xb2d5('0x3')]();var fs_extra=require(_0xb2d5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2d5('0x5'));var config=require(_0xb2d5('0x6'));var controller=require(_0xb2d5('0x7'));router[_0xb2d5('0x8')]('/',controller[_0xb2d5('0x9')]);module[_0xb2d5('0xa')]=router; \ No newline at end of file +var _0x10da=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','multer','util','connect-timeout','Router','fs-extra'];(function(_0x5dc2fa,_0x56279d){var _0x16eaf9=function(_0x83322){while(--_0x83322){_0x5dc2fa['push'](_0x5dc2fa['shift']());}};_0x16eaf9(++_0x56279d);}(_0x10da,0x145));var _0xa10d=function(_0xf101a6,_0x54156c){_0xf101a6=_0xf101a6-0x0;var _0x3c3ad5=_0x10da[_0xf101a6];return _0x3c3ad5;};'use strict';var multer=require(_0xa10d('0x0'));var util=require(_0xa10d('0x1'));var path=require('path');var timeout=require(_0xa10d('0x2'));var express=require('express');var router=express[_0xa10d('0x3')]();var fs_extra=require(_0xa10d('0x4'));var auth=require(_0xa10d('0x5'));var interaction=require(_0xa10d('0x6'));var config=require(_0xa10d('0x7'));var controller=require(_0xa10d('0x8'));router['get']('/',controller[_0xa10d('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 6855c22..0514ec9 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 _0xb63c=['exports','STRING','version','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb63c,0xef));var _0xcb63=function(_0x2b5283,_0x192585){_0x2b5283=_0x2b5283-0x0;var _0x487a96=_0xb63c[_0x2b5283];return _0x487a96;};'use strict';var Sequelize=require(_0xcb63('0x0'));module[_0xcb63('0x1')]={'version':{'type':Sequelize[_0xcb63('0x2')],'unique':_0xcb63('0x3')}}; \ No newline at end of file +var _0xc442=['exports','STRING','version','sequelize'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xc442,0x14f));var _0x2c44=function(_0x73a24,_0x28694a){_0x73a24=_0x73a24-0x0;var _0x51fc53=_0xc442[_0x73a24];return _0x51fc53;};'use strict';var Sequelize=require(_0x2c44('0x0'));module[_0x2c44('0x1')]={'version':{'type':Sequelize[_0x2c44('0x2')],'unique':_0x2c44('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index aa75c32..db304ea 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 _0xfb44=['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','limit','count','Content-Range','reject','then','destroy','end','sendStatus','error','name','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Migration','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring'];(function(_0xddad69,_0x271d14){var _0x5d60a9=function(_0x5176a2){while(--_0x5176a2){_0xddad69['push'](_0xddad69['shift']());}};_0x5d60a9(++_0x271d14);}(_0xfb44,0xb8));var _0x4fb4=function(_0xa2f179,_0x1da756){_0xa2f179=_0xa2f179-0x0;var _0x14ff36=_0xfb44[_0xa2f179];return _0x14ff36;};'use strict';var emlformat=require(_0x4fb4('0x0'));var rimraf=require(_0x4fb4('0x1'));var zipdir=require(_0x4fb4('0x2'));var jsonpatch=require(_0x4fb4('0x3'));var rp=require(_0x4fb4('0x4'));var moment=require(_0x4fb4('0x5'));var BPromise=require(_0x4fb4('0x6'));var Mustache=require(_0x4fb4('0x7'));var util=require(_0x4fb4('0x8'));var path=require(_0x4fb4('0x9'));var sox=require(_0x4fb4('0xa'));var csv=require(_0x4fb4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fb4('0xc'));var _=require(_0x4fb4('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4fb4('0xe'));var deskjs=require(_0x4fb4('0xf'));var toCsv=require(_0x4fb4('0xb'));var querystring=require(_0x4fb4('0x10'));var Papa=require(_0x4fb4('0x11'));var Redis=require(_0x4fb4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4fb4('0x13'));var as=require(_0x4fb4('0x14'));var hardwareService=require(_0x4fb4('0x15'));var logger=require(_0x4fb4('0x16'))(_0x4fb4('0x17'));var utils=require(_0x4fb4('0x18'));var config=require(_0x4fb4('0x19'));var licenseUtil=require(_0x4fb4('0x1a'));var db=require(_0x4fb4('0x1b'))['db'];function respondWithStatusCode(_0x3f8d50,_0x3a456b){_0x3a456b=_0x3a456b||0xcc;return function(_0x163da6){if(_0x163da6){return _0x3f8d50['sendStatus'](_0x3a456b);}return _0x3f8d50[_0x4fb4('0x1c')](_0x3a456b)['end']();};}function respondWithResult(_0x367b86,_0x1d8513){_0x1d8513=_0x1d8513||0xc8;return function(_0x14c709){if(_0x14c709){return _0x367b86[_0x4fb4('0x1c')](_0x1d8513)[_0x4fb4('0x1d')](_0x14c709);}};}function respondWithFilteredResult(_0x38eaab,_0x32d1f6){return function(_0x417331){if(_0x417331){var _0x5187ff=typeof _0x32d1f6[_0x4fb4('0x1e')]===_0x4fb4('0x1f')&&typeof _0x32d1f6[_0x4fb4('0x20')]===_0x4fb4('0x1f');var _0x27608c=_0x417331[_0x4fb4('0x21')];var _0x12f271=_0x5187ff?0x0:_0x32d1f6[_0x4fb4('0x1e')];var _0x2af010=_0x5187ff?_0x417331[_0x4fb4('0x21')]:_0x32d1f6['offset']+_0x32d1f6[_0x4fb4('0x20')];var _0x32562c;if(_0x2af010>=_0x27608c){_0x2af010=_0x27608c;_0x32562c=0xc8;}else{_0x32562c=0xce;}_0x38eaab['status'](_0x32562c);return _0x38eaab['set'](_0x4fb4('0x22'),_0x12f271+'-'+_0x2af010+'/'+_0x27608c)[_0x4fb4('0x1d')](_0x417331);}return null;};}function patchUpdates(_0x18c38a){return function(_0xaeea31){try{jsonpatch['apply'](_0xaeea31,_0x18c38a,!![]);}catch(_0x177bc2){return BPromise[_0x4fb4('0x23')](_0x177bc2);}return _0xaeea31['save']();};}function saveUpdates(_0x408aee,_0x4ce7f0){return function(_0x51d30a){if(_0x51d30a){return _0x51d30a['update'](_0x408aee)[_0x4fb4('0x24')](function(_0x423789){return _0x423789;});}return null;};}function removeEntity(_0x3eb4d1,_0x3a8e82){return function(_0x4fe479){if(_0x4fe479){return _0x4fe479[_0x4fb4('0x25')]()['then'](function(){_0x3eb4d1[_0x4fb4('0x1c')](0xcc)[_0x4fb4('0x26')]();});}};}function handleEntityNotFound(_0x3546a0,_0x31b635){return function(_0x350fc3){if(!_0x350fc3){_0x3546a0[_0x4fb4('0x27')](0x194);}return _0x350fc3;};}function handleError(_0x3fa39d,_0x363772){_0x363772=_0x363772||0x1f4;return function(_0x8e7524){logger[_0x4fb4('0x28')](_0x8e7524['stack']);if(_0x8e7524[_0x4fb4('0x29')]){delete _0x8e7524[_0x4fb4('0x29')];}_0x3fa39d[_0x4fb4('0x1c')](_0x363772)['send'](_0x8e7524);};}exports['index']=function(_0x1d3d15,_0x30e9ac){var _0x58f4eb={},_0x3d9d59={},_0x1819e6={'count':0x0,'rows':[]};var _0x326096=_[_0x4fb4('0x2a')](db['Migration'][_0x4fb4('0x2b')],function(_0x4939df){return{'name':_0x4939df[_0x4fb4('0x2c')],'type':_0x4939df['type'][_0x4fb4('0x2d')]};});_0x3d9d59['model']=_[_0x4fb4('0x2a')](_0x326096,_0x4fb4('0x29'));_0x3d9d59['query']=_[_0x4fb4('0x2e')](_0x1d3d15[_0x4fb4('0x2f')]);_0x3d9d59[_0x4fb4('0x30')]=_[_0x4fb4('0x31')](_0x3d9d59[_0x4fb4('0x32')],_0x3d9d59[_0x4fb4('0x2f')]);_0x58f4eb['attributes']=_['intersection'](_0x3d9d59['model'],qs[_0x4fb4('0x33')](_0x1d3d15[_0x4fb4('0x2f')][_0x4fb4('0x33')]));_0x58f4eb[_0x4fb4('0x34')]=_0x58f4eb[_0x4fb4('0x34')][_0x4fb4('0x35')]?_0x58f4eb['attributes']:_0x3d9d59[_0x4fb4('0x32')];if(!_0x1d3d15[_0x4fb4('0x2f')][_0x4fb4('0x36')](_0x4fb4('0x37'))){_0x58f4eb['limit']=qs[_0x4fb4('0x20')](_0x1d3d15[_0x4fb4('0x2f')][_0x4fb4('0x20')]);_0x58f4eb[_0x4fb4('0x1e')]=qs[_0x4fb4('0x1e')](_0x1d3d15[_0x4fb4('0x2f')]['offset']);}_0x58f4eb[_0x4fb4('0x38')]=qs[_0x4fb4('0x39')](_0x1d3d15[_0x4fb4('0x2f')][_0x4fb4('0x39')]);_0x58f4eb[_0x4fb4('0x3a')]=qs[_0x4fb4('0x30')](_['pick'](_0x1d3d15['query'],_0x3d9d59[_0x4fb4('0x30')]),_0x326096);if(_0x1d3d15['query'][_0x4fb4('0x3b')]){_0x58f4eb[_0x4fb4('0x3a')]=_[_0x4fb4('0x3c')](_0x58f4eb['where'],{'$or':_[_0x4fb4('0x2a')](_0x326096,function(_0x281280){if(_0x281280['type']!==_0x4fb4('0x3d')){var _0x53a3ef={};_0x53a3ef[_0x281280[_0x4fb4('0x29')]]={'$like':'%'+_0x1d3d15[_0x4fb4('0x2f')][_0x4fb4('0x3b')]+'%'};return _0x53a3ef;}})});}_0x58f4eb=_[_0x4fb4('0x3c')]({},_0x58f4eb,_0x1d3d15['options']);var _0x52a830={'where':_0x58f4eb[_0x4fb4('0x3a')]};return db[_0x4fb4('0x3e')]['count'](_0x52a830)[_0x4fb4('0x24')](function(_0x13e909){_0x1819e6[_0x4fb4('0x21')]=_0x13e909;if(_0x1d3d15['query'][_0x4fb4('0x3f')]){_0x58f4eb[_0x4fb4('0x40')]=[{'all':!![]}];}return db['Migration'][_0x4fb4('0x41')](_0x58f4eb);})[_0x4fb4('0x24')](function(_0x1894dd){_0x1819e6[_0x4fb4('0x42')]=_0x1894dd;return _0x1819e6;})[_0x4fb4('0x24')](respondWithFilteredResult(_0x30e9ac,_0x58f4eb))['catch'](handleError(_0x30e9ac,null));}; \ No newline at end of file +var _0x40ce=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','name','send','map','Migration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','count','includeAll','include','rows','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x40ce,0x72));var _0xe40c=function(_0x5aa3cb,_0x2030bf){_0x5aa3cb=_0x5aa3cb-0x0;var _0x5c660a=_0x40ce[_0x5aa3cb];return _0x5c660a;};'use strict';var emlformat=require(_0xe40c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe40c('0x1'));var jsonpatch=require(_0xe40c('0x2'));var rp=require(_0xe40c('0x3'));var moment=require('moment');var BPromise=require(_0xe40c('0x4'));var Mustache=require('mustache');var util=require(_0xe40c('0x5'));var path=require(_0xe40c('0x6'));var sox=require(_0xe40c('0x7'));var csv=require(_0xe40c('0x8'));var ejs=require(_0xe40c('0x9'));var fs=require('fs');var fs_extra=require(_0xe40c('0xa'));var _=require(_0xe40c('0xb'));var squel=require(_0xe40c('0xc'));var crypto=require('crypto');var jsforce=require(_0xe40c('0xd'));var deskjs=require(_0xe40c('0xe'));var toCsv=require(_0xe40c('0x8'));var querystring=require('querystring');var Papa=require(_0xe40c('0xf'));var Redis=require(_0xe40c('0x10'));var authService=require(_0xe40c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe40c('0x12'));var hardwareService=require(_0xe40c('0x13'));var logger=require(_0xe40c('0x14'))('api');var utils=require(_0xe40c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe40c('0x16'));var db=require(_0xe40c('0x17'))['db'];function respondWithStatusCode(_0x45c1a6,_0x277b5f){_0x277b5f=_0x277b5f||0xcc;return function(_0x571f14){if(_0x571f14){return _0x45c1a6[_0xe40c('0x18')](_0x277b5f);}return _0x45c1a6[_0xe40c('0x19')](_0x277b5f)[_0xe40c('0x1a')]();};}function respondWithResult(_0x60c5b9,_0x3ad7a8){_0x3ad7a8=_0x3ad7a8||0xc8;return function(_0x2c58ac){if(_0x2c58ac){return _0x60c5b9[_0xe40c('0x19')](_0x3ad7a8)[_0xe40c('0x1b')](_0x2c58ac);}};}function respondWithFilteredResult(_0x5005a4,_0x37ffb1){return function(_0x29b644){if(_0x29b644){var _0x5de8ac=typeof _0x37ffb1[_0xe40c('0x1c')]===_0xe40c('0x1d')&&typeof _0x37ffb1['limit']==='undefined';var _0x2a4a0b=_0x29b644['count'];var _0x5e757d=_0x5de8ac?0x0:_0x37ffb1[_0xe40c('0x1c')];var _0x476ef6=_0x5de8ac?_0x29b644['count']:_0x37ffb1[_0xe40c('0x1c')]+_0x37ffb1[_0xe40c('0x1e')];var _0x2e3c48;if(_0x476ef6>=_0x2a4a0b){_0x476ef6=_0x2a4a0b;_0x2e3c48=0xc8;}else{_0x2e3c48=0xce;}_0x5005a4[_0xe40c('0x19')](_0x2e3c48);return _0x5005a4[_0xe40c('0x1f')](_0xe40c('0x20'),_0x5e757d+'-'+_0x476ef6+'/'+_0x2a4a0b)['json'](_0x29b644);}return null;};}function patchUpdates(_0xcf6e42){return function(_0x50ac84){try{jsonpatch[_0xe40c('0x21')](_0x50ac84,_0xcf6e42,!![]);}catch(_0x47a04e){return BPromise[_0xe40c('0x22')](_0x47a04e);}return _0x50ac84[_0xe40c('0x23')]();};}function saveUpdates(_0xafd0e2,_0x227d7f){return function(_0x45e5ca){if(_0x45e5ca){return _0x45e5ca['update'](_0xafd0e2)[_0xe40c('0x24')](function(_0x3fddd3){return _0x3fddd3;});}return null;};}function removeEntity(_0x20e170,_0x598c0d){return function(_0x58c8c5){if(_0x58c8c5){return _0x58c8c5['destroy']()[_0xe40c('0x24')](function(){_0x20e170[_0xe40c('0x19')](0xcc)[_0xe40c('0x1a')]();});}};}function handleEntityNotFound(_0x11450d,_0x247787){return function(_0x1c6b00){if(!_0x1c6b00){_0x11450d[_0xe40c('0x18')](0x194);}return _0x1c6b00;};}function handleError(_0x341100,_0x18a5bf){_0x18a5bf=_0x18a5bf||0x1f4;return function(_0x7eac4){logger['error'](_0x7eac4['stack']);if(_0x7eac4[_0xe40c('0x25')]){delete _0x7eac4[_0xe40c('0x25')];}_0x341100[_0xe40c('0x19')](_0x18a5bf)[_0xe40c('0x26')](_0x7eac4);};}exports['index']=function(_0x533070,_0x5ea0e2){var _0x4d9777={},_0x4cba2c={},_0x5a30ba={'count':0x0,'rows':[]};var _0x34c560=_[_0xe40c('0x27')](db[_0xe40c('0x28')][_0xe40c('0x29')],function(_0x348da3){return{'name':_0x348da3[_0xe40c('0x2a')],'type':_0x348da3[_0xe40c('0x2b')][_0xe40c('0x2c')]};});_0x4cba2c['model']=_[_0xe40c('0x27')](_0x34c560,_0xe40c('0x25'));_0x4cba2c[_0xe40c('0x2d')]=_[_0xe40c('0x2e')](_0x533070[_0xe40c('0x2d')]);_0x4cba2c['filters']=_[_0xe40c('0x2f')](_0x4cba2c[_0xe40c('0x30')],_0x4cba2c[_0xe40c('0x2d')]);_0x4d9777[_0xe40c('0x31')]=_[_0xe40c('0x2f')](_0x4cba2c['model'],qs[_0xe40c('0x32')](_0x533070[_0xe40c('0x2d')][_0xe40c('0x32')]));_0x4d9777[_0xe40c('0x31')]=_0x4d9777[_0xe40c('0x31')][_0xe40c('0x33')]?_0x4d9777['attributes']:_0x4cba2c[_0xe40c('0x30')];if(!_0x533070[_0xe40c('0x2d')][_0xe40c('0x34')](_0xe40c('0x35'))){_0x4d9777[_0xe40c('0x1e')]=qs[_0xe40c('0x1e')](_0x533070[_0xe40c('0x2d')][_0xe40c('0x1e')]);_0x4d9777[_0xe40c('0x1c')]=qs['offset'](_0x533070[_0xe40c('0x2d')][_0xe40c('0x1c')]);}_0x4d9777[_0xe40c('0x36')]=qs[_0xe40c('0x37')](_0x533070['query'][_0xe40c('0x37')]);_0x4d9777['where']=qs[_0xe40c('0x38')](_[_0xe40c('0x39')](_0x533070[_0xe40c('0x2d')],_0x4cba2c['filters']),_0x34c560);if(_0x533070[_0xe40c('0x2d')][_0xe40c('0x3a')]){_0x4d9777[_0xe40c('0x3b')]=_['merge'](_0x4d9777[_0xe40c('0x3b')],{'$or':_[_0xe40c('0x27')](_0x34c560,function(_0x565213){if(_0x565213[_0xe40c('0x2b')]!=='VIRTUAL'){var _0xdb6f81={};_0xdb6f81[_0x565213['name']]={'$like':'%'+_0x533070['query'][_0xe40c('0x3a')]+'%'};return _0xdb6f81;}})});}_0x4d9777=_[_0xe40c('0x3c')]({},_0x4d9777,_0x533070[_0xe40c('0x3d')]);var _0x425d50={'where':_0x4d9777[_0xe40c('0x3b')]};return db['Migration'][_0xe40c('0x3e')](_0x425d50)[_0xe40c('0x24')](function(_0x43dace){_0x5a30ba['count']=_0x43dace;if(_0x533070[_0xe40c('0x2d')][_0xe40c('0x3f')]){_0x4d9777[_0xe40c('0x40')]=[{'all':!![]}];}return db[_0xe40c('0x28')]['findAll'](_0x4d9777);})[_0xe40c('0x24')](function(_0x4aa6e9){_0x5a30ba[_0xe40c('0x41')]=_0x4aa6e9;return _0x5a30ba;})[_0xe40c('0x24')](respondWithFilteredResult(_0x5ea0e2,_0x4d9777))['catch'](handleError(_0x5ea0e2,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2166440..87232e2 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 _0xaa79=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes'];(function(_0x5e4a02,_0x131f6b){var _0x4e973a=function(_0x425530){while(--_0x425530){_0x5e4a02['push'](_0x5e4a02['shift']());}};_0x4e973a(++_0x131f6b);}(_0xaa79,0x1c4));var _0x9aa7=function(_0x197bb7,_0xdf492b){_0x197bb7=_0x197bb7-0x0;var _0x4ef78d=_0xaa79[_0x197bb7];return _0x4ef78d;};'use strict';var _=require(_0x9aa7('0x0'));var util=require(_0x9aa7('0x1'));var logger=require(_0x9aa7('0x2'))(_0x9aa7('0x3'));var moment=require(_0x9aa7('0x4'));var BPromise=require(_0x9aa7('0x5'));var rp=require(_0x9aa7('0x6'));var fs=require('fs');var path=require(_0x9aa7('0x7'));var rimraf=require('rimraf');var config=require(_0x9aa7('0x8'));var attributes=require(_0x9aa7('0x9'));module[_0x9aa7('0xa')]=function(_0x2112a7,_0x2c770f){return _0x2112a7[_0x9aa7('0xb')](_0x9aa7('0xc'),attributes,{'tableName':_0x9aa7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab3=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','migrations','util'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0xfab3,0x1f3));var _0x3fab=function(_0x82b66e,_0xc7a91d){_0x82b66e=_0x82b66e-0x0;var _0x1b9888=_0xfab3[_0x82b66e];return _0x1b9888;};'use strict';var _=require('lodash');var util=require(_0x3fab('0x0'));var logger=require(_0x3fab('0x1'))(_0x3fab('0x2'));var moment=require(_0x3fab('0x3'));var BPromise=require(_0x3fab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fab('0x5'));var config=require(_0x3fab('0x6'));var attributes=require('./migration.attributes');module[_0x3fab('0x7')]=function(_0xed2e5,_0x259bc6){return _0xed2e5[_0x3fab('0x8')]('Migration',attributes,{'tableName':_0x3fab('0x9'),'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 c8a28e6..594e2a8 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 _0x6ae0=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ae0,0x192));var _0x06ae=function(_0xb915df,_0x2aa26a){_0xb915df=_0xb915df-0x0;var _0x52bbe5=_0x6ae0[_0xb915df];return _0x52bbe5;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var moment=require(_0x06ae('0x2'));var BPromise=require(_0x06ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06ae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x06ae('0x5'))('rpc');var config=require(_0x06ae('0x6'));var jayson=require(_0x06ae('0x7'));var client=jayson['client'][_0x06ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51bac4,_0x26167c,_0x2bc2ad){return new BPromise(function(_0x591c0f,_0x269be5){return client[_0x06ae('0x9')](_0x51bac4,_0x2bc2ad)[_0x06ae('0xa')](function(_0x39f10e){logger[_0x06ae('0xb')](_0x06ae('0xc'),_0x26167c,_0x06ae('0xd'));logger['debug'](_0x06ae('0xe'),_0x26167c,_0x06ae('0xd'),JSON[_0x06ae('0xf')](_0x39f10e));if(_0x39f10e[_0x06ae('0x10')]){if(_0x39f10e[_0x06ae('0x10')][_0x06ae('0x11')]===0x1f4){logger[_0x06ae('0x10')]('Migration,\x20%s,\x20%s',_0x26167c,_0x39f10e['error']['message']);return _0x269be5(_0x39f10e[_0x06ae('0x10')]['message']);}logger[_0x06ae('0x10')](_0x06ae('0xc'),_0x26167c,_0x39f10e[_0x06ae('0x10')][_0x06ae('0x12')]);return _0x591c0f(_0x39f10e['error']['message']);}else{logger[_0x06ae('0xb')]('Migration,\x20%s,\x20%s',_0x26167c,_0x06ae('0xd'));_0x591c0f(_0x39f10e[_0x06ae('0x13')][_0x06ae('0x12')]);}})['catch'](function(_0x4ec020){logger['error'](_0x06ae('0xc'),_0x26167c,_0x4ec020);_0x269be5(_0x4ec020);});});} \ No newline at end of file +var _0xb9a7=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Migration,\x20%s,\x20%s'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb9a7[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('Migration,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('Migration,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f9dfd3e..beb2c30 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 _0xcbe2=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2cdd1d,_0x58d181){var _0xfcb1be=function(_0x572c8d){while(--_0x572c8d){_0x2cdd1d['push'](_0x2cdd1d['shift']());}};_0xfcb1be(++_0x58d181);}(_0xcbe2,0x148));var _0x2cbe=function(_0xd2d70e,_0x2a7c12){_0xd2d70e=_0xd2d70e-0x0;var _0x1c7822=_0xcbe2[_0xd2d70e];return _0x1c7822;};'use strict';var multer=require(_0x2cbe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2cbe('0x1'));var express=require(_0x2cbe('0x2'));var router=express[_0x2cbe('0x3')]();var fs_extra=require(_0x2cbe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cbe('0x5'));var config=require(_0x2cbe('0x6'));var controller=require(_0x2cbe('0x7'));router[_0x2cbe('0x8')]('/',auth[_0x2cbe('0x9')](),controller[_0x2cbe('0xa')]);router['get'](_0x2cbe('0xb'),auth[_0x2cbe('0x9')](),controller[_0x2cbe('0xc')]);router[_0x2cbe('0xd')]('/',auth[_0x2cbe('0x9')](),controller['create']);router['put'](_0x2cbe('0xb'),auth['isAuthenticated'](),controller[_0x2cbe('0xe')]);router[_0x2cbe('0xf')](_0x2cbe('0xb'),auth['isAuthenticated'](),controller[_0x2cbe('0x10')]);module[_0x2cbe('0x11')]=router; \ No newline at end of file +var _0x4f81=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','exports','path','express','Router'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x4f81,0x1e3));var _0x14f8=function(_0x3ef98c,_0x6477b0){_0x3ef98c=_0x3ef98c-0x0;var _0x768195=_0x4f81[_0x3ef98c];return _0x768195;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x14f8('0x0'));var timeout=require('connect-timeout');var express=require(_0x14f8('0x1'));var router=express[_0x14f8('0x2')]();var fs_extra=require(_0x14f8('0x3'));var auth=require(_0x14f8('0x4'));var interaction=require(_0x14f8('0x5'));var config=require(_0x14f8('0x6'));var controller=require(_0x14f8('0x7'));router['get']('/',auth[_0x14f8('0x8')](),controller['index']);router[_0x14f8('0x9')](_0x14f8('0xa'),auth['isAuthenticated'](),controller[_0x14f8('0xb')]);router[_0x14f8('0xc')]('/',auth['isAuthenticated'](),controller[_0x14f8('0xd')]);router['put']('/:id',auth[_0x14f8('0x8')](),controller[_0x14f8('0xe')]);router[_0x14f8('0xf')](_0x14f8('0xa'),auth[_0x14f8('0x8')](),controller[_0x14f8('0x10')]);module[_0x14f8('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6ce0998..63bee71 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 _0xb542=['exports','ENUM','localnet','externip','STRING','sequelize'];(function(_0x6b4c50,_0x1dffa8){var _0x539bf5=function(_0xcc4d2a){while(--_0xcc4d2a){_0x6b4c50['push'](_0x6b4c50['shift']());}};_0x539bf5(++_0x1dffa8);}(_0xb542,0x77));var _0x2b54=function(_0xba6b88,_0x4f1e92){_0xba6b88=_0xba6b88-0x0;var _0x575135=_0xb542[_0xba6b88];return _0x575135;};'use strict';var Sequelize=require(_0x2b54('0x0'));module[_0x2b54('0x1')]={'type':{'type':Sequelize[_0x2b54('0x2')](_0x2b54('0x3'),_0x2b54('0x4'),'stun','turn')},'value':{'type':Sequelize[_0x2b54('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2b54('0x5')]}}; \ No newline at end of file +var _0x697a=['stun','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x697a,0x18a));var _0xa697=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x697a[_0x903228];return _0xcec81d;};'use strict';var Sequelize=require(_0xa697('0x0'));module[_0xa697('0x1')]={'type':{'type':Sequelize[_0xa697('0x2')](_0xa697('0x3'),_0xa697('0x4'),_0xa697('0x5'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa697('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 0f5f42f..8f4bbb7 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 _0xabfc=['body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','rimraf','zip-dir','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','Network','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','sequelize','transaction'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0xabfc,0x1d9));var _0xcabf=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xabfc[_0x44f974];return _0x805dbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcabf('0x0'));var zipdir=require(_0xcabf('0x1'));var jsonpatch=require(_0xcabf('0x2'));var rp=require(_0xcabf('0x3'));var moment=require(_0xcabf('0x4'));var BPromise=require(_0xcabf('0x5'));var Mustache=require(_0xcabf('0x6'));var util=require(_0xcabf('0x7'));var path=require(_0xcabf('0x8'));var sox=require(_0xcabf('0x9'));var csv=require('to-csv');var ejs=require(_0xcabf('0xa'));var fs=require('fs');var fs_extra=require(_0xcabf('0xb'));var _=require(_0xcabf('0xc'));var squel=require(_0xcabf('0xd'));var crypto=require(_0xcabf('0xe'));var jsforce=require(_0xcabf('0xf'));var deskjs=require(_0xcabf('0x10'));var toCsv=require(_0xcabf('0x11'));var querystring=require(_0xcabf('0x12'));var Papa=require('papaparse');var Redis=require(_0xcabf('0x13'));var authService=require(_0xcabf('0x14'));var qs=require(_0xcabf('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcabf('0x16'));var logger=require(_0xcabf('0x17'))(_0xcabf('0x18'));var utils=require(_0xcabf('0x19'));var config=require(_0xcabf('0x1a'));var licenseUtil=require(_0xcabf('0x1b'));var db=require(_0xcabf('0x1c'))['db'];var jayson=require(_0xcabf('0x1d'));var client=jayson['client'][_0xcabf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x28fc6e,_0x2a4fdb,_0x558b2b,_0x2995c3){return new BPromise(function(_0xd746c5,_0x3990f8){var _0xf2e99f=_0x2995c3||client;return _0xf2e99f[_0xcabf('0x1f')](_0x28fc6e,_0x558b2b)['then'](function(_0x4d788d){logger[_0xcabf('0x20')](_0xcabf('0x21'),_0x2a4fdb,'request\x20sent');logger[_0xcabf('0x22')](_0xcabf('0x23'),_0x2a4fdb,'request\x20sent',JSON[_0xcabf('0x24')](_0x4d788d));if(_0x4d788d[_0xcabf('0x25')]){if(_0x4d788d[_0xcabf('0x25')][_0xcabf('0x26')]===0x1f4){logger[_0xcabf('0x25')](_0xcabf('0x21'),_0x2a4fdb,_0x4d788d[_0xcabf('0x25')][_0xcabf('0x27')]);return _0x3990f8(_0x4d788d[_0xcabf('0x25')][_0xcabf('0x27')]);}logger['error'](_0xcabf('0x21'),_0x2a4fdb,_0x4d788d[_0xcabf('0x25')]['message']);return _0xd746c5(_0x4d788d[_0xcabf('0x25')][_0xcabf('0x27')]);}else{logger[_0xcabf('0x20')]('Network,\x20%s,\x20%s',_0x2a4fdb,'request\x20sent');_0xd746c5(_0x4d788d['result'][_0xcabf('0x27')]);}})['catch'](function(_0x406632){logger[_0xcabf('0x25')](_0xcabf('0x21'),_0x2a4fdb,_0x406632);_0x3990f8(_0x406632);});});}function respondWithStatusCode(_0x9404b4,_0x36d28f){_0x36d28f=_0x36d28f||0xcc;return function(_0x634394){if(_0x634394){return _0x9404b4[_0xcabf('0x28')](_0x36d28f);}return _0x9404b4['status'](_0x36d28f)['end']();};}function respondWithResult(_0x27f69d,_0x1d616c){_0x1d616c=_0x1d616c||0xc8;return function(_0x1af72e){if(_0x1af72e){return _0x27f69d[_0xcabf('0x29')](_0x1d616c)[_0xcabf('0x2a')](_0x1af72e);}};}function respondWithFilteredResult(_0x4ede7e,_0x3733fc){return function(_0x30a3ec){if(_0x30a3ec){var _0x197d7e=typeof _0x3733fc[_0xcabf('0x2b')]===_0xcabf('0x2c')&&typeof _0x3733fc[_0xcabf('0x2d')]===_0xcabf('0x2c');var _0x4b5e0e=_0x30a3ec[_0xcabf('0x2e')];var _0x3865c0=_0x197d7e?0x0:_0x3733fc[_0xcabf('0x2b')];var _0xcf89d8=_0x197d7e?_0x30a3ec[_0xcabf('0x2e')]:_0x3733fc[_0xcabf('0x2b')]+_0x3733fc[_0xcabf('0x2d')];var _0x5ae8e3;if(_0xcf89d8>=_0x4b5e0e){_0xcf89d8=_0x4b5e0e;_0x5ae8e3=0xc8;}else{_0x5ae8e3=0xce;}_0x4ede7e['status'](_0x5ae8e3);return _0x4ede7e[_0xcabf('0x2f')]('Content-Range',_0x3865c0+'-'+_0xcf89d8+'/'+_0x4b5e0e)[_0xcabf('0x2a')](_0x30a3ec);}return null;};}function patchUpdates(_0x5177ba){return function(_0x46afc2){try{jsonpatch[_0xcabf('0x30')](_0x46afc2,_0x5177ba,!![]);}catch(_0x54afab){return BPromise[_0xcabf('0x31')](_0x54afab);}return _0x46afc2[_0xcabf('0x32')]();};}function saveUpdates(_0x331e95,_0x4fbdb6){return function(_0x425612){if(_0x425612){return _0x425612[_0xcabf('0x33')](_0x331e95)[_0xcabf('0x34')](function(_0x17147a){return _0x17147a;});}return null;};}function removeEntity(_0x2bc9f2,_0x5ca7b7){return function(_0xc0622a){if(_0xc0622a){return _0xc0622a[_0xcabf('0x35')]()[_0xcabf('0x34')](function(){_0x2bc9f2[_0xcabf('0x29')](0xcc)[_0xcabf('0x36')]();});}};}function handleEntityNotFound(_0x91830b,_0x3cd4c1){return function(_0x4bd4eb){if(!_0x4bd4eb){_0x91830b[_0xcabf('0x28')](0x194);}return _0x4bd4eb;};}function handleError(_0x1a9b3f,_0x5643be){_0x5643be=_0x5643be||0x1f4;return function(_0xf1dccb){logger[_0xcabf('0x25')](_0xf1dccb[_0xcabf('0x37')]);if(_0xf1dccb[_0xcabf('0x38')]){delete _0xf1dccb[_0xcabf('0x38')];}_0x1a9b3f[_0xcabf('0x29')](_0x5643be)[_0xcabf('0x39')](_0xf1dccb);};}exports[_0xcabf('0x3a')]=function(_0x214eef,_0x28e854){var _0xd4c258={},_0x4043db={},_0x1502f2={'count':0x0,'rows':[]};var _0xc82fa4=_['map'](db[_0xcabf('0x3b')]['rawAttributes'],function(_0x13f4d8){return{'name':_0x13f4d8[_0xcabf('0x3c')],'type':_0x13f4d8[_0xcabf('0x3d')][_0xcabf('0x3e')]};});_0x4043db[_0xcabf('0x3f')]=_[_0xcabf('0x40')](_0xc82fa4,_0xcabf('0x38'));_0x4043db[_0xcabf('0x41')]=_[_0xcabf('0x42')](_0x214eef[_0xcabf('0x41')]);_0x4043db[_0xcabf('0x43')]=_['intersection'](_0x4043db['model'],_0x4043db['query']);_0xd4c258['attributes']=_[_0xcabf('0x44')](_0x4043db[_0xcabf('0x3f')],qs['fields'](_0x214eef['query'][_0xcabf('0x45')]));_0xd4c258[_0xcabf('0x46')]=_0xd4c258['attributes']['length']?_0xd4c258['attributes']:_0x4043db[_0xcabf('0x3f')];if(!_0x214eef[_0xcabf('0x41')]['hasOwnProperty'](_0xcabf('0x47'))){_0xd4c258[_0xcabf('0x2d')]=qs[_0xcabf('0x2d')](_0x214eef[_0xcabf('0x41')][_0xcabf('0x2d')]);_0xd4c258['offset']=qs[_0xcabf('0x2b')](_0x214eef[_0xcabf('0x41')][_0xcabf('0x2b')]);}_0xd4c258[_0xcabf('0x48')]=qs[_0xcabf('0x49')](_0x214eef[_0xcabf('0x41')][_0xcabf('0x49')]);_0xd4c258[_0xcabf('0x4a')]=qs[_0xcabf('0x43')](_[_0xcabf('0x4b')](_0x214eef['query'],_0x4043db[_0xcabf('0x43')]),_0xc82fa4);if(_0x214eef[_0xcabf('0x41')][_0xcabf('0x4c')]){_0xd4c258[_0xcabf('0x4a')]=_[_0xcabf('0x4d')](_0xd4c258[_0xcabf('0x4a')],{'$or':_['map'](_0xc82fa4,function(_0x2246f0){if(_0x2246f0[_0xcabf('0x3d')]!==_0xcabf('0x4e')){var _0x58f66c={};_0x58f66c[_0x2246f0[_0xcabf('0x38')]]={'$like':'%'+_0x214eef[_0xcabf('0x41')][_0xcabf('0x4c')]+'%'};return _0x58f66c;}})});}_0xd4c258=_[_0xcabf('0x4d')]({},_0xd4c258,_0x214eef[_0xcabf('0x4f')]);var _0x53e7e5={'where':_0xd4c258[_0xcabf('0x4a')]};return db['Network'][_0xcabf('0x2e')](_0x53e7e5)[_0xcabf('0x34')](function(_0x170843){_0x1502f2['count']=_0x170843;if(_0x214eef[_0xcabf('0x41')][_0xcabf('0x50')]){_0xd4c258['include']=[{'all':!![]}];}return db[_0xcabf('0x3b')][_0xcabf('0x51')](_0xd4c258);})[_0xcabf('0x34')](function(_0x17ae00){_0x1502f2[_0xcabf('0x52')]=_0x17ae00;return _0x1502f2;})[_0xcabf('0x34')](respondWithFilteredResult(_0x28e854,_0xd4c258))[_0xcabf('0x53')](handleError(_0x28e854,null));};exports[_0xcabf('0x54')]=function(_0x10157c,_0x5ae3f2){var _0x8f2f1={'raw':!![],'where':{'id':_0x10157c[_0xcabf('0x55')]['id']}},_0xf9d691={};_0xf9d691[_0xcabf('0x3f')]=_[_0xcabf('0x42')](db[_0xcabf('0x3b')][_0xcabf('0x56')]);_0xf9d691[_0xcabf('0x41')]=_[_0xcabf('0x42')](_0x10157c[_0xcabf('0x41')]);_0xf9d691['filters']=_[_0xcabf('0x44')](_0xf9d691[_0xcabf('0x3f')],_0xf9d691[_0xcabf('0x41')]);_0x8f2f1[_0xcabf('0x46')]=_[_0xcabf('0x44')](_0xf9d691[_0xcabf('0x3f')],qs[_0xcabf('0x45')](_0x10157c[_0xcabf('0x41')][_0xcabf('0x45')]));_0x8f2f1[_0xcabf('0x46')]=_0x8f2f1['attributes']['length']?_0x8f2f1[_0xcabf('0x46')]:_0xf9d691[_0xcabf('0x3f')];if(_0x10157c[_0xcabf('0x41')][_0xcabf('0x50')]){_0x8f2f1[_0xcabf('0x57')]=[{'all':!![]}];}_0x8f2f1=_['merge']({},_0x8f2f1,_0x10157c['options']);return db[_0xcabf('0x3b')][_0xcabf('0x58')](_0x8f2f1)[_0xcabf('0x34')](handleEntityNotFound(_0x5ae3f2,null))[_0xcabf('0x34')](respondWithResult(_0x5ae3f2,null))[_0xcabf('0x53')](handleError(_0x5ae3f2,null));};exports[_0xcabf('0x59')]=function(_0x3e61ee,_0x13dac1,_0x3e81c7){var _0x457602;return db[_0xcabf('0x5a')][_0xcabf('0x5b')](function(_0x1ea9e0){return db[_0xcabf('0x3b')][_0xcabf('0x59')](_0x3e61ee['body'],{'raw':!![]})[_0xcabf('0x34')](function(_0x2973fa){_0x457602=_0x2973fa;return db[_0xcabf('0x3b')][_0xcabf('0x51')]({'where':{'type':_0x3e61ee[_0xcabf('0x5c')][_0xcabf('0x3d')]},'raw':!![]});})[_0xcabf('0x34')](function(_0x1b66b5){if(_0x457602[_0xcabf('0x3d')][_0xcabf('0x5d')]()==_0xcabf('0x5e')){var _0x406591=fs[_0xcabf('0x5f')](path[_0xcabf('0x60')](config[_0xcabf('0x61')],_0xcabf('0x62')),_0xcabf('0x63'));var _0x2fd0cf=ejs[_0xcabf('0x64')](_0x406591,{'networks':_0x1b66b5||[]});fs[_0xcabf('0x65')](_0xcabf('0x66'),_0x2fd0cf);return respondWithRpcPromise(_0xcabf('0x67'),_0xcabf('0x59'),{'module':_0xcabf('0x68')});}else if(_0x457602['type'][_0xcabf('0x5d')]()==_0xcabf('0x69')){var _0x397b00=fs[_0xcabf('0x5f')](path[_0xcabf('0x60')](config[_0xcabf('0x61')],_0xcabf('0x6a')),_0xcabf('0x63'));var _0x39c9c6=ejs['render'](_0x397b00,{'networks':_0x1b66b5||[]});fs[_0xcabf('0x65')](_0xcabf('0x6b'),_0x39c9c6);return respondWithRpcPromise(_0xcabf('0x67'),_0xcabf('0x59'),{'module':_0xcabf('0x68')});}else{var _0x4356fb=fs[_0xcabf('0x5f')](path[_0xcabf('0x60')](config['root'],_0xcabf('0x6c')),'utf8');var _0x5d3bd5=ejs[_0xcabf('0x64')](_0x4356fb,{'networks':_0x1b66b5||[]});fs[_0xcabf('0x65')](util[_0xcabf('0x6d')]('/etc/asterisk/sip_xcally_%s.conf',_0x3e61ee[_0xcabf('0x5c')]['type'][_0xcabf('0x6e')]()),_0x5d3bd5);return respondWithRpcPromise(_0xcabf('0x67'),'create',{'module':'chan_sip.so'});}return null;})[_0xcabf('0x34')](function(){return _0x457602;});})[_0xcabf('0x34')](respondWithResult(_0x13dac1,0xc9))['catch'](handleError(_0x13dac1,null));};exports[_0xcabf('0x33')]=function(_0x559a49,_0x298b48,_0x13968e){var _0xe90c4d;return db[_0xcabf('0x5a')][_0xcabf('0x5b')](function(_0x4d4cd4){return db[_0xcabf('0x3b')][_0xcabf('0x58')]({'where':{'id':_0x559a49[_0xcabf('0x55')]['id']}})['then'](handleEntityNotFound(_0x298b48,null))[_0xcabf('0x34')](saveUpdates(_0x559a49[_0xcabf('0x5c')],null))['then'](function(_0x43b786){if(_0x43b786){_0xe90c4d=_0x43b786;return db[_0xcabf('0x3b')][_0xcabf('0x51')]({'where':{'type':_0xe90c4d[_0xcabf('0x3d')]},'raw':!![]});}return null;})[_0xcabf('0x34')](function(_0x1116a5){if(_0xe90c4d[_0xcabf('0x3d')][_0xcabf('0x5d')]()=='STUN'){var _0x36b7a5=fs[_0xcabf('0x5f')](path[_0xcabf('0x60')](config[_0xcabf('0x61')],_0xcabf('0x62')),'utf8');var _0x4fb005=ejs[_0xcabf('0x64')](_0x36b7a5,{'networks':_0x1116a5||[]});fs[_0xcabf('0x65')]('/etc/asterisk/stun_xcally.conf',_0x4fb005);return respondWithRpcPromise(_0xcabf('0x67'),_0xcabf('0x33'),{'module':_0xcabf('0x68')});}else if(_0xe90c4d[_0xcabf('0x3d')]['toUpperCase']()==_0xcabf('0x69')){var _0x28551c=fs[_0xcabf('0x5f')](path[_0xcabf('0x60')](config[_0xcabf('0x61')],'server/files/templates/turn_multiple.ejs'),_0xcabf('0x63'));var _0x459c75=ejs[_0xcabf('0x64')](_0x28551c,{'networks':_0x1116a5||[]});fs[_0xcabf('0x65')](_0xcabf('0x6b'),_0x459c75);return respondWithRpcPromise(_0xcabf('0x67'),_0xcabf('0x33'),{'module':_0xcabf('0x68')});}else{var _0x22686a=fs[_0xcabf('0x5f')](path[_0xcabf('0x60')](config['root'],_0xcabf('0x6c')),'utf8');var _0x4294e1=ejs[_0xcabf('0x64')](_0x22686a,{'networks':_0x1116a5||[]});fs[_0xcabf('0x65')](util[_0xcabf('0x6d')](_0xcabf('0x6f'),_0x559a49[_0xcabf('0x5c')]['type']['toLowerCase']()),_0x4294e1);return respondWithRpcPromise(_0xcabf('0x67'),_0xcabf('0x33'),{'module':_0xcabf('0x70')});}return null;})[_0xcabf('0x34')](function(_0x2e7026){if(_0x2e7026){return _0xe90c4d;}return null;});})[_0xcabf('0x34')](respondWithResult(_0x298b48,null))[_0xcabf('0x53')](handleError(_0x298b48,null));};exports['destroy']=function(_0x4b8b81,_0x2f4043,_0x17b980){var _0x4a00a7;return db[_0xcabf('0x3b')][_0xcabf('0x58')]({'where':{'id':_0x4b8b81[_0xcabf('0x55')]['id']}})[_0xcabf('0x34')](function(_0xe36543){_0x4a00a7=_0xe36543;return _0xe36543;})[_0xcabf('0x34')](handleEntityNotFound(_0x2f4043,null))[_0xcabf('0x34')](removeEntity(_0x2f4043,null))['then'](function(){if(_0x4a00a7){return db[_0xcabf('0x3b')][_0xcabf('0x51')]({'where':{'type':_0x4a00a7[_0xcabf('0x3d')]},'raw':!![]});}})[_0xcabf('0x34')](function(_0x41dab0){if(_0x4a00a7[_0xcabf('0x3d')]['toUpperCase']()==_0xcabf('0x5e')){var _0x4cbf43=fs[_0xcabf('0x5f')](path['join'](config[_0xcabf('0x61')],_0xcabf('0x62')),_0xcabf('0x63'));var _0x1c1222=ejs['render'](_0x4cbf43,{'networks':_0x41dab0||[]});fs[_0xcabf('0x65')](_0xcabf('0x66'),_0x1c1222);return respondWithRpcPromise(_0xcabf('0x67'),_0xcabf('0x35'),{'module':_0xcabf('0x68')});}else if(_0x4a00a7[_0xcabf('0x3d')][_0xcabf('0x5d')]()==_0xcabf('0x69')){var _0x1f371a=fs['readFileSync'](path[_0xcabf('0x60')](config[_0xcabf('0x61')],_0xcabf('0x6a')),'utf8');var _0x3a7f5a=ejs['render'](_0x1f371a,{'networks':_0x41dab0||[]});fs[_0xcabf('0x65')](_0xcabf('0x6b'),_0x3a7f5a);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x3a70fb=fs[_0xcabf('0x5f')](path['join'](config['root'],_0xcabf('0x6c')),'utf8');var _0x1b83cc=ejs[_0xcabf('0x64')](_0x3a70fb,{'networks':_0x41dab0||[]});fs[_0xcabf('0x65')](util['format'](_0xcabf('0x6f'),_0x4b8b81['body'][_0xcabf('0x3d')]['toLowerCase']()),_0x1b83cc);return respondWithRpcPromise('Reload','destroy',{'module':_0xcabf('0x70')});}return null;})[_0xcabf('0x53')](handleError(_0x2f4043,null));}; \ No newline at end of file +var _0x9306=['query','filters','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','create','sequelize','transaction','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','find','params','server/files/templates/network.ejs','chan_sip.so','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Network,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','name','index','map','Network','rawAttributes','fieldName','key','keys'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9306,0x176));var _0x6930=function(_0x2094cd,_0x316988){_0x2094cd=_0x2094cd-0x0;var _0xffc545=_0x9306[_0x2094cd];return _0xffc545;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6930('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6930('0x1'));var rp=require(_0x6930('0x2'));var moment=require(_0x6930('0x3'));var BPromise=require(_0x6930('0x4'));var Mustache=require(_0x6930('0x5'));var util=require(_0x6930('0x6'));var path=require(_0x6930('0x7'));var sox=require(_0x6930('0x8'));var csv=require(_0x6930('0x9'));var ejs=require(_0x6930('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6930('0xb'));var crypto=require('crypto');var jsforce=require(_0x6930('0xc'));var deskjs=require(_0x6930('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6930('0xe'));var Papa=require(_0x6930('0xf'));var Redis=require(_0x6930('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6930('0x11'));var as=require(_0x6930('0x12'));var hardwareService=require(_0x6930('0x13'));var logger=require(_0x6930('0x14'))(_0x6930('0x15'));var utils=require(_0x6930('0x16'));var config=require(_0x6930('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6930('0x18'))['db'];var jayson=require(_0x6930('0x19'));var client=jayson['client'][_0x6930('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4e420d,_0x276311,_0x571f07,_0x259fca){return new BPromise(function(_0xc85aca,_0x3b6a95){var _0x371c6a=_0x259fca||client;return _0x371c6a[_0x6930('0x1b')](_0x4e420d,_0x571f07)['then'](function(_0x4e3576){logger[_0x6930('0x1c')]('Network,\x20%s,\x20%s',_0x276311,_0x6930('0x1d'));logger[_0x6930('0x1e')](_0x6930('0x1f'),_0x276311,'request\x20sent',JSON[_0x6930('0x20')](_0x4e3576));if(_0x4e3576[_0x6930('0x21')]){if(_0x4e3576[_0x6930('0x21')][_0x6930('0x22')]===0x1f4){logger[_0x6930('0x21')]('Network,\x20%s,\x20%s',_0x276311,_0x4e3576[_0x6930('0x21')][_0x6930('0x23')]);return _0x3b6a95(_0x4e3576[_0x6930('0x21')][_0x6930('0x23')]);}logger[_0x6930('0x21')](_0x6930('0x24'),_0x276311,_0x4e3576[_0x6930('0x21')][_0x6930('0x23')]);return _0xc85aca(_0x4e3576[_0x6930('0x21')]['message']);}else{logger[_0x6930('0x1c')](_0x6930('0x24'),_0x276311,_0x6930('0x1d'));_0xc85aca(_0x4e3576[_0x6930('0x25')][_0x6930('0x23')]);}})[_0x6930('0x26')](function(_0x3272e4){logger[_0x6930('0x21')](_0x6930('0x24'),_0x276311,_0x3272e4);_0x3b6a95(_0x3272e4);});});}function respondWithStatusCode(_0x48d56f,_0x5b2f5c){_0x5b2f5c=_0x5b2f5c||0xcc;return function(_0x4001bb){if(_0x4001bb){return _0x48d56f[_0x6930('0x27')](_0x5b2f5c);}return _0x48d56f[_0x6930('0x28')](_0x5b2f5c)['end']();};}function respondWithResult(_0x50dbd5,_0x24f955){_0x24f955=_0x24f955||0xc8;return function(_0x34ba0c){if(_0x34ba0c){return _0x50dbd5[_0x6930('0x28')](_0x24f955)[_0x6930('0x29')](_0x34ba0c);}};}function respondWithFilteredResult(_0x2ac21c,_0x409bc7){return function(_0x2a53df){if(_0x2a53df){var _0x288870=typeof _0x409bc7[_0x6930('0x2a')]===_0x6930('0x2b')&&typeof _0x409bc7[_0x6930('0x2c')]==='undefined';var _0x429ed4=_0x2a53df[_0x6930('0x2d')];var _0x2a0b9f=_0x288870?0x0:_0x409bc7['offset'];var _0x58d5e7=_0x288870?_0x2a53df[_0x6930('0x2d')]:_0x409bc7[_0x6930('0x2a')]+_0x409bc7['limit'];var _0x2b0f03;if(_0x58d5e7>=_0x429ed4){_0x58d5e7=_0x429ed4;_0x2b0f03=0xc8;}else{_0x2b0f03=0xce;}_0x2ac21c[_0x6930('0x28')](_0x2b0f03);return _0x2ac21c[_0x6930('0x2e')]('Content-Range',_0x2a0b9f+'-'+_0x58d5e7+'/'+_0x429ed4)['json'](_0x2a53df);}return null;};}function patchUpdates(_0xc3b733){return function(_0x108864){try{jsonpatch[_0x6930('0x2f')](_0x108864,_0xc3b733,!![]);}catch(_0xf94f8d){return BPromise[_0x6930('0x30')](_0xf94f8d);}return _0x108864[_0x6930('0x31')]();};}function saveUpdates(_0x284640,_0x356084){return function(_0x242096){if(_0x242096){return _0x242096[_0x6930('0x32')](_0x284640)[_0x6930('0x33')](function(_0x5493a2){return _0x5493a2;});}return null;};}function removeEntity(_0xda293c,_0x104b37){return function(_0x4ea7de){if(_0x4ea7de){return _0x4ea7de[_0x6930('0x34')]()['then'](function(){_0xda293c[_0x6930('0x28')](0xcc)[_0x6930('0x35')]();});}};}function handleEntityNotFound(_0x2b7514,_0x4ffa06){return function(_0x20ace1){if(!_0x20ace1){_0x2b7514[_0x6930('0x27')](0x194);}return _0x20ace1;};}function handleError(_0x4f8c86,_0x536ac2){_0x536ac2=_0x536ac2||0x1f4;return function(_0x9303f9){logger[_0x6930('0x21')](_0x9303f9['stack']);if(_0x9303f9[_0x6930('0x36')]){delete _0x9303f9[_0x6930('0x36')];}_0x4f8c86[_0x6930('0x28')](_0x536ac2)['send'](_0x9303f9);};}exports[_0x6930('0x37')]=function(_0x3452c5,_0xda0c2c){var _0x418fd8={},_0x51b453={},_0x52807c={'count':0x0,'rows':[]};var _0x19f9f1=_[_0x6930('0x38')](db[_0x6930('0x39')][_0x6930('0x3a')],function(_0x56c99b){return{'name':_0x56c99b[_0x6930('0x3b')],'type':_0x56c99b['type'][_0x6930('0x3c')]};});_0x51b453['model']=_[_0x6930('0x38')](_0x19f9f1,_0x6930('0x36'));_0x51b453['query']=_[_0x6930('0x3d')](_0x3452c5[_0x6930('0x3e')]);_0x51b453[_0x6930('0x3f')]=_['intersection'](_0x51b453[_0x6930('0x40')],_0x51b453[_0x6930('0x3e')]);_0x418fd8[_0x6930('0x41')]=_['intersection'](_0x51b453['model'],qs[_0x6930('0x42')](_0x3452c5[_0x6930('0x3e')][_0x6930('0x42')]));_0x418fd8[_0x6930('0x41')]=_0x418fd8[_0x6930('0x41')][_0x6930('0x43')]?_0x418fd8[_0x6930('0x41')]:_0x51b453[_0x6930('0x40')];if(!_0x3452c5[_0x6930('0x3e')]['hasOwnProperty'](_0x6930('0x44'))){_0x418fd8[_0x6930('0x2c')]=qs[_0x6930('0x2c')](_0x3452c5[_0x6930('0x3e')][_0x6930('0x2c')]);_0x418fd8[_0x6930('0x2a')]=qs['offset'](_0x3452c5['query']['offset']);}_0x418fd8['order']=qs[_0x6930('0x45')](_0x3452c5[_0x6930('0x3e')]['sort']);_0x418fd8[_0x6930('0x46')]=qs[_0x6930('0x3f')](_[_0x6930('0x47')](_0x3452c5[_0x6930('0x3e')],_0x51b453[_0x6930('0x3f')]),_0x19f9f1);if(_0x3452c5['query'][_0x6930('0x48')]){_0x418fd8[_0x6930('0x46')]=_[_0x6930('0x49')](_0x418fd8[_0x6930('0x46')],{'$or':_[_0x6930('0x38')](_0x19f9f1,function(_0x2809f5){if(_0x2809f5[_0x6930('0x4a')]!==_0x6930('0x4b')){var _0x2f0255={};_0x2f0255[_0x2809f5[_0x6930('0x36')]]={'$like':'%'+_0x3452c5[_0x6930('0x3e')][_0x6930('0x48')]+'%'};return _0x2f0255;}})});}_0x418fd8=_['merge']({},_0x418fd8,_0x3452c5[_0x6930('0x4c')]);var _0x1b71d8={'where':_0x418fd8['where']};return db[_0x6930('0x39')][_0x6930('0x2d')](_0x1b71d8)[_0x6930('0x33')](function(_0x113a3d){_0x52807c['count']=_0x113a3d;if(_0x3452c5[_0x6930('0x3e')][_0x6930('0x4d')]){_0x418fd8[_0x6930('0x4e')]=[{'all':!![]}];}return db['Network'][_0x6930('0x4f')](_0x418fd8);})[_0x6930('0x33')](function(_0x5bab3c){_0x52807c[_0x6930('0x50')]=_0x5bab3c;return _0x52807c;})[_0x6930('0x33')](respondWithFilteredResult(_0xda0c2c,_0x418fd8))[_0x6930('0x26')](handleError(_0xda0c2c,null));};exports[_0x6930('0x51')]=function(_0x5dbec0,_0x1cbd04){var _0x4b0d95={'raw':!![],'where':{'id':_0x5dbec0['params']['id']}},_0x174d7a={};_0x174d7a[_0x6930('0x40')]=_[_0x6930('0x3d')](db[_0x6930('0x39')][_0x6930('0x3a')]);_0x174d7a[_0x6930('0x3e')]=_['keys'](_0x5dbec0['query']);_0x174d7a['filters']=_[_0x6930('0x52')](_0x174d7a[_0x6930('0x40')],_0x174d7a['query']);_0x4b0d95[_0x6930('0x41')]=_[_0x6930('0x52')](_0x174d7a[_0x6930('0x40')],qs['fields'](_0x5dbec0[_0x6930('0x3e')][_0x6930('0x42')]));_0x4b0d95[_0x6930('0x41')]=_0x4b0d95['attributes'][_0x6930('0x43')]?_0x4b0d95[_0x6930('0x41')]:_0x174d7a['model'];if(_0x5dbec0[_0x6930('0x3e')][_0x6930('0x4d')]){_0x4b0d95[_0x6930('0x4e')]=[{'all':!![]}];}_0x4b0d95=_['merge']({},_0x4b0d95,_0x5dbec0['options']);return db[_0x6930('0x39')]['find'](_0x4b0d95)[_0x6930('0x33')](handleEntityNotFound(_0x1cbd04,null))['then'](respondWithResult(_0x1cbd04,null))[_0x6930('0x26')](handleError(_0x1cbd04,null));};exports[_0x6930('0x53')]=function(_0x458cfb,_0x264966,_0x2986e4){var _0x562b0b;return db[_0x6930('0x54')][_0x6930('0x55')](function(_0x102888){return db[_0x6930('0x39')][_0x6930('0x53')](_0x458cfb[_0x6930('0x56')],{'raw':!![]})[_0x6930('0x33')](function(_0x13b43a){_0x562b0b=_0x13b43a;return db[_0x6930('0x39')][_0x6930('0x4f')]({'where':{'type':_0x458cfb[_0x6930('0x56')][_0x6930('0x4a')]},'raw':!![]});})[_0x6930('0x33')](function(_0x4821b9){if(_0x562b0b[_0x6930('0x4a')][_0x6930('0x57')]()==_0x6930('0x58')){var _0x3f818a=fs['readFileSync'](path[_0x6930('0x59')](config[_0x6930('0x5a')],_0x6930('0x5b')),_0x6930('0x5c'));var _0x39affd=ejs[_0x6930('0x5d')](_0x3f818a,{'networks':_0x4821b9||[]});fs[_0x6930('0x5e')](_0x6930('0x5f'),_0x39affd);return respondWithRpcPromise(_0x6930('0x60'),_0x6930('0x53'),{'module':_0x6930('0x61')});}else if(_0x562b0b[_0x6930('0x4a')][_0x6930('0x57')]()==_0x6930('0x62')){var _0x46b8e3=fs[_0x6930('0x63')](path[_0x6930('0x59')](config[_0x6930('0x5a')],_0x6930('0x64')),_0x6930('0x5c'));var _0x469828=ejs['render'](_0x46b8e3,{'networks':_0x4821b9||[]});fs[_0x6930('0x5e')](_0x6930('0x65'),_0x469828);return respondWithRpcPromise(_0x6930('0x60'),_0x6930('0x53'),{'module':_0x6930('0x61')});}else{var _0x415dda=fs['readFileSync'](path[_0x6930('0x59')](config[_0x6930('0x5a')],'server/files/templates/network.ejs'),_0x6930('0x5c'));var _0x4c5fc2=ejs['render'](_0x415dda,{'networks':_0x4821b9||[]});fs[_0x6930('0x5e')](util[_0x6930('0x66')](_0x6930('0x67'),_0x458cfb['body'][_0x6930('0x4a')][_0x6930('0x68')]()),_0x4c5fc2);return respondWithRpcPromise('Reload',_0x6930('0x53'),{'module':'chan_sip.so'});}return null;})[_0x6930('0x33')](function(){return _0x562b0b;});})[_0x6930('0x33')](respondWithResult(_0x264966,0xc9))['catch'](handleError(_0x264966,null));};exports[_0x6930('0x32')]=function(_0x2225d6,_0x3b3d0e,_0x3cd104){var _0x9e554a;return db[_0x6930('0x54')]['transaction'](function(_0x16ddc1){return db['Network'][_0x6930('0x69')]({'where':{'id':_0x2225d6[_0x6930('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3b3d0e,null))[_0x6930('0x33')](saveUpdates(_0x2225d6[_0x6930('0x56')],null))[_0x6930('0x33')](function(_0x47614f){if(_0x47614f){_0x9e554a=_0x47614f;return db[_0x6930('0x39')][_0x6930('0x4f')]({'where':{'type':_0x9e554a[_0x6930('0x4a')]},'raw':!![]});}return null;})[_0x6930('0x33')](function(_0x5c580a){if(_0x9e554a['type'][_0x6930('0x57')]()=='STUN'){var _0x2222a4=fs[_0x6930('0x63')](path[_0x6930('0x59')](config[_0x6930('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x6930('0x5c'));var _0x15e4c1=ejs[_0x6930('0x5d')](_0x2222a4,{'networks':_0x5c580a||[]});fs[_0x6930('0x5e')](_0x6930('0x5f'),_0x15e4c1);return respondWithRpcPromise(_0x6930('0x60'),_0x6930('0x32'),{'module':_0x6930('0x61')});}else if(_0x9e554a[_0x6930('0x4a')][_0x6930('0x57')]()==_0x6930('0x62')){var _0x358f70=fs[_0x6930('0x63')](path[_0x6930('0x59')](config[_0x6930('0x5a')],_0x6930('0x64')),_0x6930('0x5c'));var _0x49749=ejs['render'](_0x358f70,{'networks':_0x5c580a||[]});fs[_0x6930('0x5e')]('/etc/asterisk/turn_xcally.conf',_0x49749);return respondWithRpcPromise(_0x6930('0x60'),_0x6930('0x32'),{'module':_0x6930('0x61')});}else{var _0x19aea3=fs[_0x6930('0x63')](path[_0x6930('0x59')](config[_0x6930('0x5a')],_0x6930('0x6b')),_0x6930('0x5c'));var _0x408a71=ejs[_0x6930('0x5d')](_0x19aea3,{'networks':_0x5c580a||[]});fs[_0x6930('0x5e')](util[_0x6930('0x66')](_0x6930('0x67'),_0x2225d6[_0x6930('0x56')]['type'][_0x6930('0x68')]()),_0x408a71);return respondWithRpcPromise(_0x6930('0x60'),_0x6930('0x32'),{'module':_0x6930('0x6c')});}return null;})[_0x6930('0x33')](function(_0x5d1879){if(_0x5d1879){return _0x9e554a;}return null;});})[_0x6930('0x33')](respondWithResult(_0x3b3d0e,null))[_0x6930('0x26')](handleError(_0x3b3d0e,null));};exports[_0x6930('0x34')]=function(_0x2af33c,_0x2eec00,_0x4ce394){var _0x2d72fa;return db['Network'][_0x6930('0x69')]({'where':{'id':_0x2af33c[_0x6930('0x6a')]['id']}})[_0x6930('0x33')](function(_0x33fda3){_0x2d72fa=_0x33fda3;return _0x33fda3;})[_0x6930('0x33')](handleEntityNotFound(_0x2eec00,null))[_0x6930('0x33')](removeEntity(_0x2eec00,null))[_0x6930('0x33')](function(){if(_0x2d72fa){return db[_0x6930('0x39')][_0x6930('0x4f')]({'where':{'type':_0x2d72fa[_0x6930('0x4a')]},'raw':!![]});}})['then'](function(_0x434353){if(_0x2d72fa[_0x6930('0x4a')][_0x6930('0x57')]()==_0x6930('0x58')){var _0xba60e0=fs['readFileSync'](path[_0x6930('0x59')](config['root'],_0x6930('0x5b')),'utf8');var _0x24eecf=ejs['render'](_0xba60e0,{'networks':_0x434353||[]});fs['writeFileSync'](_0x6930('0x5f'),_0x24eecf);return respondWithRpcPromise('Reload',_0x6930('0x34'),{'module':'res_stun_monitor.so'});}else if(_0x2d72fa[_0x6930('0x4a')][_0x6930('0x57')]()==_0x6930('0x62')){var _0x301669=fs[_0x6930('0x63')](path[_0x6930('0x59')](config['root'],_0x6930('0x64')),'utf8');var _0x124952=ejs[_0x6930('0x5d')](_0x301669,{'networks':_0x434353||[]});fs[_0x6930('0x5e')](_0x6930('0x65'),_0x124952);return respondWithRpcPromise('Reload',_0x6930('0x34'),{'module':'res_stun_monitor.so'});}else{var _0x1357f8=fs[_0x6930('0x63')](path[_0x6930('0x59')](config[_0x6930('0x5a')],_0x6930('0x6b')),_0x6930('0x5c'));var _0x5eeaa4=ejs[_0x6930('0x5d')](_0x1357f8,{'networks':_0x434353||[]});fs['writeFileSync'](util[_0x6930('0x66')](_0x6930('0x67'),_0x2af33c[_0x6930('0x56')][_0x6930('0x4a')][_0x6930('0x68')]()),_0x5eeaa4);return respondWithRpcPromise(_0x6930('0x60'),_0x6930('0x34'),{'module':_0x6930('0x6c')});}return null;})[_0x6930('0x26')](handleError(_0x2eec00,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 971ace8..0963638 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 _0xbee3=['define','Network','network','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xbee3,0xd5));var _0x3bee=function(_0x526f70,_0x6777b0){_0x526f70=_0x526f70-0x0;var _0x5152f0=_0xbee3[_0x526f70];return _0x5152f0;};'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 +var _0xcffe=['network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Network'];(function(_0xf05c4d,_0x140378){var _0x14030b=function(_0x4e0fe9){while(--_0x4e0fe9){_0xf05c4d['push'](_0xf05c4d['shift']());}};_0x14030b(++_0x140378);}(_0xcffe,0x1a1));var _0xecff=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xcffe[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var logger=require(_0xecff('0x2'))(_0xecff('0x3'));var moment=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var rp=require(_0xecff('0x6'));var fs=require('fs');var path=require(_0xecff('0x7'));var rimraf=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x3020d9,_0x25572c){return _0x3020d9[_0xecff('0xa')](_0xecff('0xb'),attributes,{'tableName':_0xecff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 817ca61..9e54478 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(_0xca4866,_0x1b9641){var _0x21e06c=function(_0x581398){while(--_0x581398){_0xca4866['push'](_0xca4866['shift']());}};_0x21e06c(++_0x1b9641);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x1c3717,_0x4acc59){_0x1c3717=_0x1c3717-0x0;var _0x4b113c=_0x7a54[_0x1c3717];return _0x4b113c;};'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 3154431..b5f9165 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 _0x37c0=['delete','removeAnswers','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','getAgents','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/users','/:id/send','send','put','update'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x37c0,0x9d));var _0x037c=function(_0x4f770c,_0xa215){_0x4f770c=_0x4f770c-0x0;var _0x9b9be6=_0x37c0[_0x4f770c];return _0x9b9be6;};'use strict';var multer=require('multer');var util=require(_0x037c('0x0'));var path=require(_0x037c('0x1'));var timeout=require(_0x037c('0x2'));var express=require(_0x037c('0x3'));var router=express[_0x037c('0x4')]();var fs_extra=require(_0x037c('0x5'));var auth=require(_0x037c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x037c('0x7'));var controller=require('./openchannelAccount.controller');router[_0x037c('0x8')]('/',auth[_0x037c('0x9')](),controller['index']);router[_0x037c('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x037c('0x8')](_0x037c('0xa'),auth[_0x037c('0x9')](),controller[_0x037c('0xb')]);router['get'](_0x037c('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x037c('0xd'),auth[_0x037c('0x9')](),controller['getAnswers']);router[_0x037c('0x8')]('/:id/applications',auth[_0x037c('0x9')](),controller[_0x037c('0xe')]);router['get'](_0x037c('0xf'),auth[_0x037c('0x9')](),controller[_0x037c('0x10')]);router[_0x037c('0x8')]('/:id/users',auth[_0x037c('0x9')](),controller[_0x037c('0x11')]);router['post']('/',auth[_0x037c('0x9')](),controller['create']);router[_0x037c('0x12')](_0x037c('0xc'),auth[_0x037c('0x9')](),controller[_0x037c('0x13')]);router[_0x037c('0x12')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x037c('0x14')]);router[_0x037c('0x12')](_0x037c('0x15'),controller['notify']);router[_0x037c('0x12')](_0x037c('0x16'),auth[_0x037c('0x9')](),controller[_0x037c('0x17')]);router[_0x037c('0x12')](_0x037c('0x18'),auth[_0x037c('0x9')](),controller['addAgents']);router[_0x037c('0x12')](_0x037c('0x19'),auth['isAuthenticated'](),controller[_0x037c('0x1a')]);router[_0x037c('0x1b')](_0x037c('0xa'),auth[_0x037c('0x9')](),controller[_0x037c('0x1c')]);router[_0x037c('0x1d')](_0x037c('0xa'),auth[_0x037c('0x9')](),controller['destroy']);router[_0x037c('0x1d')](_0x037c('0xc'),auth[_0x037c('0x9')](),controller['removeDispositions']);router[_0x037c('0x1d')]('/:id/canned_answers',auth[_0x037c('0x9')](),controller[_0x037c('0x1e')]);router[_0x037c('0x1d')](_0x037c('0x18'),auth[_0x037c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xce51=['getApplications','/:id/interactions','getInteractions','getAgents','create','post','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x19df8e,_0xc8482){var _0x378598=function(_0x24f1d0){while(--_0x24f1d0){_0x19df8e['push'](_0x19df8e['shift']());}};_0x378598(++_0xc8482);}(_0xce51,0x85));var _0x1ce5=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xce51[_0x1ab0e6];return _0x248815;};'use strict';var multer=require(_0x1ce5('0x0'));var util=require(_0x1ce5('0x1'));var path=require(_0x1ce5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1ce5('0x3')]();var fs_extra=require(_0x1ce5('0x4'));var auth=require(_0x1ce5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ce5('0x6'));var controller=require(_0x1ce5('0x7'));router[_0x1ce5('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ce5('0x9')]);router[_0x1ce5('0x8')](_0x1ce5('0xa'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0xc')]);router[_0x1ce5('0x8')]('/:id',auth[_0x1ce5('0xb')](),controller[_0x1ce5('0xd')]);router['get'](_0x1ce5('0xe'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0xf')]);router[_0x1ce5('0x8')](_0x1ce5('0x10'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x11')]);router[_0x1ce5('0x8')](_0x1ce5('0x12'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x13')]);router[_0x1ce5('0x8')](_0x1ce5('0x14'),auth['isAuthenticated'](),controller[_0x1ce5('0x15')]);router['get']('/:id/users',auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x16')]);router['post']('/',auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x17')]);router[_0x1ce5('0x18')](_0x1ce5('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x1ce5('0x10'),auth[_0x1ce5('0xb')](),controller['addAnswer']);router[_0x1ce5('0x18')](_0x1ce5('0x19'),controller[_0x1ce5('0x1a')]);router['post'](_0x1ce5('0x12'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x1b')]);router[_0x1ce5('0x18')](_0x1ce5('0x1c'),auth['isAuthenticated'](),controller[_0x1ce5('0x1d')]);router['post'](_0x1ce5('0x1e'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x1f')]);router[_0x1ce5('0x20')](_0x1ce5('0x21'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x22')]);router[_0x1ce5('0x23')](_0x1ce5('0x21'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x24')]);router[_0x1ce5('0x23')](_0x1ce5('0xe'),auth[_0x1ce5('0xb')](),controller['removeDispositions']);router[_0x1ce5('0x23')]('/:id/canned_answers',auth[_0x1ce5('0xb')](),controller['removeAnswers']);router[_0x1ce5('0x23')](_0x1ce5('0x1c'),auth[_0x1ce5('0xb')](),controller[_0x1ce5('0x25')]);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 29e7656..1466917 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 _0x99e4=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x99e4,0xf6));var _0x499e=function(_0x557dc4,_0x2c86c6){_0x557dc4=_0x557dc4-0x0;var _0x51e824=_0x99e4[_0x557dc4];return _0x51e824;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x499e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x499e('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x499e('0x2')]},'token':{'type':Sequelize[_0x499e('0x2')],'defaultValue':function(){return rs[_0x499e('0x3')]();}},'replyUri':{'type':Sequelize[_0x499e('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x499e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x499e('0x4')],'defaultValue':function(){return _0x499e('0x5');}},'notificationSound':{'type':Sequelize[_0x499e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x499e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x499e('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x499e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x499e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x499e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x499e('0x6')],'defaultValue':![],'comment':_0x499e('0x8'),'set':function(_0x4c046e){if(!_0x4c046e)this[_0x499e('0x9')](_0x499e('0xa'),null);this[_0x499e('0x9')]('mandatoryDisposition',_0x4c046e);}}}; \ No newline at end of file +var _0x7799=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x39c543,_0x1e8f37){var _0x1bf3c8=function(_0x3a068e){while(--_0x3a068e){_0x39c543['push'](_0x39c543['shift']());}};_0x1bf3c8(++_0x1e8f37);}(_0x7799,0x1c4));var _0x9779=function(_0x1b9edd,_0x66b166){_0x1b9edd=_0x1b9edd-0x0;var _0x4907c4=_0x7799[_0x1b9edd];return _0x4907c4;};'use strict';var Sequelize=require(_0x9779('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x9779('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9779('0x1')]},'token':{'type':Sequelize[_0x9779('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x9779('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9779('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9779('0x2')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9779('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9779('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9779('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9779('0x1')]},'queueTransfer':{'type':Sequelize[_0x9779('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9779('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9779('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9779('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x9779('0x5')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9779('0x6'),'set':function(_0x4ce062){if(!_0x4ce062)this['setDataValue'](_0x9779('0x7'),null);this['setDataValue'](_0x9779('0x8'),_0x4ce062);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6f11c6f..9fac673 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 _0xcb9d=['DESC','OpenchannelApplication','List','account','applications','Applications','list','asc','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','firstName','messageId','interaction','created','push','OpenchannelMessage','AttachmentId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','isArray','emit','userOpenchannelAccount:remove','getAgents','send','spread','dataValues','Messages','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','update','OpenchannelAccounts','UserProfileResource','destroy','name','index','map','OpenchannelAccount','rawAttributes','type','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','Pause','mandatoryDispositionPause','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x44d075,_0x250972){var _0x24218c=function(_0x1a0901){while(--_0x1a0901){_0x44d075['push'](_0x44d075['shift']());}};_0x24218c(++_0x250972);}(_0xcb9d,0xef));var _0xdcb9=function(_0x31f676,_0x55febc){_0x31f676=_0x31f676-0x0;var _0x211bc8=_0xcb9d[_0x31f676];return _0x211bc8;};'use strict';var emlformat=require(_0xdcb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcb9('0x1'));var jsonpatch=require(_0xdcb9('0x2'));var rp=require(_0xdcb9('0x3'));var moment=require('moment');var BPromise=require(_0xdcb9('0x4'));var Mustache=require(_0xdcb9('0x5'));var util=require(_0xdcb9('0x6'));var path=require(_0xdcb9('0x7'));var sox=require(_0xdcb9('0x8'));var csv=require(_0xdcb9('0x9'));var ejs=require(_0xdcb9('0xa'));var fs=require('fs');var fs_extra=require(_0xdcb9('0xb'));var _=require(_0xdcb9('0xc'));var squel=require(_0xdcb9('0xd'));var crypto=require(_0xdcb9('0xe'));var jsforce=require(_0xdcb9('0xf'));var deskjs=require(_0xdcb9('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdcb9('0x11'));var Papa=require(_0xdcb9('0x12'));var Redis=require(_0xdcb9('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xdcb9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcb9('0x15'))(_0xdcb9('0x16'));var utils=require(_0xdcb9('0x17'));var config=require(_0xdcb9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcb9('0x19'))['db'];config[_0xdcb9('0x1a')]=_[_0xdcb9('0x1b')](config[_0xdcb9('0x1a')],{'host':_0xdcb9('0x1c'),'port':0x18eb});var socket=require(_0xdcb9('0x1d'))(new Redis(config[_0xdcb9('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xdcb9('0x1e'));var client=jayson[_0xdcb9('0x1f')][_0xdcb9('0x20')]({'port':0x232c});var client9002=jayson[_0xdcb9('0x1f')][_0xdcb9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x38a2c5,_0x309f98,_0x45e672,_0x300696){return new BPromise(function(_0x462214,_0x5ef5cf){var _0x20318c=_0x300696||client;return _0x20318c[_0xdcb9('0x21')](_0x38a2c5,_0x45e672)[_0xdcb9('0x22')](function(_0xe18036){logger['info'](_0xdcb9('0x23'),_0x309f98,_0xdcb9('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x309f98,_0xdcb9('0x24'),JSON[_0xdcb9('0x25')](_0xe18036));if(_0xe18036[_0xdcb9('0x26')]){if(_0xe18036[_0xdcb9('0x26')][_0xdcb9('0x27')]===0x1f4){logger['error'](_0xdcb9('0x23'),_0x309f98,_0xe18036[_0xdcb9('0x26')][_0xdcb9('0x28')]);return _0x5ef5cf(_0xe18036[_0xdcb9('0x26')][_0xdcb9('0x28')]);}logger['error'](_0xdcb9('0x23'),_0x309f98,_0xe18036[_0xdcb9('0x26')]['message']);return _0x462214(_0xe18036[_0xdcb9('0x26')][_0xdcb9('0x28')]);}else{logger[_0xdcb9('0x29')](_0xdcb9('0x23'),_0x309f98,_0xdcb9('0x24'));_0x462214(_0xe18036[_0xdcb9('0x2a')][_0xdcb9('0x28')]);}})['catch'](function(_0x2204e7){logger[_0xdcb9('0x26')](_0xdcb9('0x23'),_0x309f98,_0x2204e7);_0x5ef5cf(_0x2204e7);});});}function respondWithStatusCode(_0xdd13d7,_0x3fe562){_0x3fe562=_0x3fe562||0xcc;return function(_0x6b164e){if(_0x6b164e){return _0xdd13d7[_0xdcb9('0x2b')](_0x3fe562);}return _0xdd13d7[_0xdcb9('0x2c')](_0x3fe562)[_0xdcb9('0x2d')]();};}function respondWithResult(_0xd3c016,_0x505c57){_0x505c57=_0x505c57||0xc8;return function(_0xe16e7a){if(_0xe16e7a){return _0xd3c016[_0xdcb9('0x2c')](_0x505c57)[_0xdcb9('0x2e')](_0xe16e7a);}};}function respondWithFilteredResult(_0x3f70ef,_0x1ea0f3){return function(_0x4812ee){if(_0x4812ee){var _0x14088a=typeof _0x1ea0f3['offset']==='undefined'&&typeof _0x1ea0f3['limit']===_0xdcb9('0x2f');var _0x386942=_0x4812ee[_0xdcb9('0x30')];var _0x47d6d5=_0x14088a?0x0:_0x1ea0f3[_0xdcb9('0x31')];var _0x253c5b=_0x14088a?_0x4812ee[_0xdcb9('0x30')]:_0x1ea0f3[_0xdcb9('0x31')]+_0x1ea0f3[_0xdcb9('0x32')];var _0x460ddf;if(_0x253c5b>=_0x386942){_0x253c5b=_0x386942;_0x460ddf=0xc8;}else{_0x460ddf=0xce;}_0x3f70ef[_0xdcb9('0x2c')](_0x460ddf);return _0x3f70ef['set']('Content-Range',_0x47d6d5+'-'+_0x253c5b+'/'+_0x386942)['json'](_0x4812ee);}return null;};}function patchUpdates(_0x155e51){return function(_0x354421){try{jsonpatch[_0xdcb9('0x33')](_0x354421,_0x155e51,!![]);}catch(_0xee7cd9){return BPromise[_0xdcb9('0x34')](_0xee7cd9);}return _0x354421[_0xdcb9('0x35')]();};}function saveUpdates(_0x5058a7,_0x4aa5a1){return function(_0x151a71){if(_0x151a71){return _0x151a71[_0xdcb9('0x36')](_0x5058a7)[_0xdcb9('0x22')](function(_0x2e6db3){return _0x2e6db3;});}return null;};}function removeEntity(_0x484425,_0x17306a){return function(_0x46c292){if(_0x46c292){return _0x46c292['destroy']()[_0xdcb9('0x22')](function(){var _0x26731e=_0x46c292['get']({'plain':!![]});var _0x367286=_0xdcb9('0x37');return db[_0xdcb9('0x38')][_0xdcb9('0x39')]({'where':{'type':_0x367286,'resourceId':_0x26731e['id']}})[_0xdcb9('0x22')](function(){return _0x46c292;});})[_0xdcb9('0x22')](function(){_0x484425[_0xdcb9('0x2c')](0xcc)[_0xdcb9('0x2d')]();});}};}function handleEntityNotFound(_0xbfe9cc,_0x1038e3){return function(_0x464a8a){if(!_0x464a8a){_0xbfe9cc[_0xdcb9('0x2b')](0x194);}return _0x464a8a;};}function handleError(_0x5852cd,_0x36cfb7){_0x36cfb7=_0x36cfb7||0x1f4;return function(_0x5ec1ad){logger[_0xdcb9('0x26')](_0x5ec1ad['stack']);if(_0x5ec1ad[_0xdcb9('0x3a')]){delete _0x5ec1ad[_0xdcb9('0x3a')];}_0x5852cd[_0xdcb9('0x2c')](_0x36cfb7)['send'](_0x5ec1ad);};}exports[_0xdcb9('0x3b')]=function(_0x557ea1,_0x2fbab1){var _0x5e8e0a={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x7eb327={},_0x306343={'count':0x0,'rows':[]};var _0x1a9d7d=_[_0xdcb9('0x3c')](db[_0xdcb9('0x3d')][_0xdcb9('0x3e')],function(_0x122897){return{'name':_0x122897['fieldName'],'type':_0x122897[_0xdcb9('0x3f')]['key']};});_0x7eb327[_0xdcb9('0x40')]=_[_0xdcb9('0x3c')](_0x1a9d7d,'name');_0x7eb327[_0xdcb9('0x41')]=_['keys'](_0x557ea1[_0xdcb9('0x41')]);_0x7eb327['filters']=_['intersection'](_0x7eb327[_0xdcb9('0x40')],_0x7eb327['query']);_0x5e8e0a[_0xdcb9('0x42')]=_[_0xdcb9('0x43')](_0x7eb327[_0xdcb9('0x40')],qs[_0xdcb9('0x44')](_0x557ea1[_0xdcb9('0x41')]['fields']));_0x5e8e0a[_0xdcb9('0x42')]=_0x5e8e0a['attributes'][_0xdcb9('0x45')]?_0x5e8e0a[_0xdcb9('0x42')]:_0x7eb327['model'];if(!_0x557ea1['query']['hasOwnProperty'](_0xdcb9('0x46'))){_0x5e8e0a[_0xdcb9('0x32')]=qs[_0xdcb9('0x32')](_0x557ea1[_0xdcb9('0x41')]['limit']);_0x5e8e0a['offset']=qs[_0xdcb9('0x31')](_0x557ea1[_0xdcb9('0x41')][_0xdcb9('0x31')]);}_0x5e8e0a[_0xdcb9('0x47')]=qs[_0xdcb9('0x48')](_0x557ea1[_0xdcb9('0x41')]['sort']);_0x5e8e0a[_0xdcb9('0x49')]=qs[_0xdcb9('0x4a')](_[_0xdcb9('0x4b')](_0x557ea1[_0xdcb9('0x41')],_0x7eb327[_0xdcb9('0x4a')]),_0x1a9d7d);if(_0x557ea1['query'][_0xdcb9('0x4c')]){_0x5e8e0a[_0xdcb9('0x49')]=_[_0xdcb9('0x4d')](_0x5e8e0a['where'],{'$or':_['map'](_0x1a9d7d,function(_0x5e6204){if(_0x5e6204['type']!==_0xdcb9('0x4e')){var _0x487025={};_0x487025[_0x5e6204['name']]={'$like':'%'+_0x557ea1[_0xdcb9('0x41')]['filter']+'%'};return _0x487025;}})});}_0x5e8e0a=_[_0xdcb9('0x4d')]({},_0x5e8e0a,_0x557ea1[_0xdcb9('0x4f')]);var _0x30dc0b={'where':_0x5e8e0a[_0xdcb9('0x49')]};return db['OpenchannelAccount'][_0xdcb9('0x30')](_0x30dc0b)[_0xdcb9('0x22')](function(_0x35bc73){_0x306343[_0xdcb9('0x30')]=_0x35bc73;if(_0x557ea1[_0xdcb9('0x41')][_0xdcb9('0x50')]){_0x5e8e0a['include']=[{'all':!![]}];}return db[_0xdcb9('0x3d')][_0xdcb9('0x51')](_0x5e8e0a);})['then'](function(_0x625e71){_0x306343[_0xdcb9('0x52')]=_0x625e71;return _0x306343;})[_0xdcb9('0x22')](respondWithFilteredResult(_0x2fbab1,_0x5e8e0a))[_0xdcb9('0x53')](handleError(_0x2fbab1,null));};exports[_0xdcb9('0x54')]=function(_0x24be3b,_0x9ef47f){var _0x469654={'raw':![],'where':{'id':_0x24be3b[_0xdcb9('0x55')]['id']},'include':[{'model':db[_0xdcb9('0x56')],'as':_0xdcb9('0x57')}]},_0xd21bb9={};_0xd21bb9[_0xdcb9('0x40')]=_[_0xdcb9('0x58')](db[_0xdcb9('0x3d')][_0xdcb9('0x3e')]);_0xd21bb9[_0xdcb9('0x41')]=_[_0xdcb9('0x58')](_0x24be3b[_0xdcb9('0x41')]);_0xd21bb9['filters']=_[_0xdcb9('0x43')](_0xd21bb9[_0xdcb9('0x40')],_0xd21bb9[_0xdcb9('0x41')]);_0x469654[_0xdcb9('0x42')]=_[_0xdcb9('0x43')](_0xd21bb9['model'],qs[_0xdcb9('0x44')](_0x24be3b[_0xdcb9('0x41')][_0xdcb9('0x44')]));_0x469654['attributes']=_0x469654['attributes'][_0xdcb9('0x45')]?_0x469654[_0xdcb9('0x42')]:_0xd21bb9['model'];if(_0x24be3b['query'][_0xdcb9('0x50')]){_0x469654[_0xdcb9('0x59')]=[{'all':!![]}];}_0x469654=_[_0xdcb9('0x4d')]({},_0x469654,_0x24be3b[_0xdcb9('0x4f')]);return db['OpenchannelAccount'][_0xdcb9('0x5a')](_0x469654)[_0xdcb9('0x22')](handleEntityNotFound(_0x9ef47f,null))[_0xdcb9('0x22')](respondWithResult(_0x9ef47f,null))['catch'](handleError(_0x9ef47f,null));};exports[_0xdcb9('0x5b')]=function(_0x4246ef,_0x609589){return db[_0xdcb9('0x3d')]['create'](_0x4246ef[_0xdcb9('0x5c')],{})[_0xdcb9('0x22')](function(_0x2a0519){var _0x29f9d6=_0x4246ef[_0xdcb9('0x5d')][_0xdcb9('0x5e')]({'plain':!![]});if(!_0x29f9d6)throw new Error(_0xdcb9('0x5f'));if(_0x29f9d6[_0xdcb9('0x60')]==='user'){var _0x24afd0=_0x2a0519['get']({'plain':!![]});var _0x3f1d4b=_0xdcb9('0x37');return db[_0xdcb9('0x61')][_0xdcb9('0x5a')]({'where':{'name':_0x3f1d4b,'userProfileId':_0x29f9d6[_0xdcb9('0x62')]},'raw':!![]})[_0xdcb9('0x22')](function(_0x484517){if(_0x484517&&_0x484517[_0xdcb9('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x24afd0[_0xdcb9('0x3a')],'resourceId':_0x24afd0['id'],'type':_0x484517[_0xdcb9('0x3a')],'sectionId':_0x484517['id']},{})['then'](function(){return _0x2a0519;});}else{return _0x2a0519;}})['catch'](function(_0x37a278){logger['error'](_0xdcb9('0x64'),_0x37a278);throw _0x37a278;});}return _0x2a0519;})[_0xdcb9('0x22')](respondWithResult(_0x609589,0xc9))[_0xdcb9('0x53')](handleError(_0x609589,null));};exports[_0xdcb9('0x36')]=function(_0x4cbee9,_0x5706e0){if(_0x4cbee9[_0xdcb9('0x5c')]['id']){delete _0x4cbee9[_0xdcb9('0x5c')]['id'];}return db['OpenchannelAccount'][_0xdcb9('0x5a')]({'where':{'id':_0x4cbee9[_0xdcb9('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xdcb9('0x22')](handleEntityNotFound(_0x5706e0,null))[_0xdcb9('0x22')](saveUpdates(_0x4cbee9[_0xdcb9('0x5c')],null))[_0xdcb9('0x22')](respondWithResult(_0x5706e0,null))[_0xdcb9('0x53')](handleError(_0x5706e0,null));};exports[_0xdcb9('0x39')]=function(_0x4a4021,_0x24cc88){return db[_0xdcb9('0x3d')][_0xdcb9('0x5a')]({'where':{'id':_0x4a4021[_0xdcb9('0x55')]['id']}})['then'](handleEntityNotFound(_0x24cc88,null))[_0xdcb9('0x22')](removeEntity(_0x24cc88,null))[_0xdcb9('0x53')](handleError(_0x24cc88,null));};exports[_0xdcb9('0x65')]=function(_0x45500b,_0x18b921){return db[_0xdcb9('0x3d')][_0xdcb9('0x65')]()[_0xdcb9('0x22')](respondWithResult(_0x18b921,null))[_0xdcb9('0x53')](handleError(_0x18b921,null));};exports[_0xdcb9('0x66')]=function(_0x869698,_0x3476f8,_0x562274){if(_0x869698[_0xdcb9('0x5c')]['id']){delete _0x869698[_0xdcb9('0x5c')]['id'];}return db[_0xdcb9('0x3d')][_0xdcb9('0x5a')]({'where':{'id':_0x869698[_0xdcb9('0x55')]['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x3476f8,null))['then'](function(_0x1a1723){if(_0x1a1723){_0x869698['body'][_0xdcb9('0x67')]=_0x1a1723['id'];return db[_0xdcb9('0x68')]['create'](_0x869698[_0xdcb9('0x5c')]);}})[_0xdcb9('0x22')](respondWithResult(_0x3476f8,null))[_0xdcb9('0x53')](handleError(_0x3476f8,null));};exports[_0xdcb9('0x69')]=function(_0x26bad4,_0x5125e4,_0x9838cb){var _0x4b6803={'raw':![],'where':{}};var _0xb13f3e={};var _0x186024={'count':0x0,'rows':[]};return db[_0xdcb9('0x3d')]['findOne']({'where':{'id':_0x26bad4[_0xdcb9('0x55')]['id']}})['then'](handleEntityNotFound(_0x5125e4,null))[_0xdcb9('0x22')](function(_0x12c00f){if(_0x12c00f){_0xb13f3e[_0xdcb9('0x40')]=_['keys'](db[_0xdcb9('0x68')][_0xdcb9('0x3e')]);_0xb13f3e[_0xdcb9('0x41')]=_[_0xdcb9('0x58')](_0x26bad4['query']);_0xb13f3e[_0xdcb9('0x4a')]=_['intersection'](_0xb13f3e[_0xdcb9('0x40')],_0xb13f3e[_0xdcb9('0x41')]);_0x4b6803['attributes']=_[_0xdcb9('0x43')](_0xb13f3e['model'],qs[_0xdcb9('0x44')](_0x26bad4[_0xdcb9('0x41')][_0xdcb9('0x44')]));_0x4b6803[_0xdcb9('0x42')]=_0x4b6803[_0xdcb9('0x42')][_0xdcb9('0x45')]?_0x4b6803[_0xdcb9('0x42')]:_0xb13f3e[_0xdcb9('0x40')];if(!_0x26bad4[_0xdcb9('0x41')][_0xdcb9('0x6a')](_0xdcb9('0x46'))){_0x4b6803[_0xdcb9('0x32')]=qs[_0xdcb9('0x32')](_0x26bad4[_0xdcb9('0x41')][_0xdcb9('0x32')]);_0x4b6803[_0xdcb9('0x31')]=qs['offset'](_0x26bad4[_0xdcb9('0x41')][_0xdcb9('0x31')]);}_0x4b6803['order']=qs[_0xdcb9('0x48')](_0x26bad4[_0xdcb9('0x41')][_0xdcb9('0x48')]);_0x4b6803[_0xdcb9('0x49')]=qs[_0xdcb9('0x4a')](_[_0xdcb9('0x4b')](_0x26bad4[_0xdcb9('0x41')],_0xb13f3e['filters']));_0x4b6803[_0xdcb9('0x49')][_0xdcb9('0x67')]=_0x12c00f['id'];if(_0x26bad4[_0xdcb9('0x41')][_0xdcb9('0x4c')]){_0x4b6803[_0xdcb9('0x49')]=_[_0xdcb9('0x4d')](_0x4b6803[_0xdcb9('0x49')],{'$or':_['map'](_0x4b6803[_0xdcb9('0x42')],function(_0x3f2f5c){var _0xffe16={};_0xffe16[_0x3f2f5c]={'$like':'%'+_0x26bad4[_0xdcb9('0x41')]['filter']+'%'};return _0xffe16;})});}_0x4b6803=_[_0xdcb9('0x4d')]({},_0x4b6803,_0x26bad4[_0xdcb9('0x4f')]);return db[_0xdcb9('0x68')][_0xdcb9('0x30')]({'where':_0x4b6803[_0xdcb9('0x49')]})[_0xdcb9('0x22')](function(_0x1a5a26){_0x186024[_0xdcb9('0x30')]=_0x1a5a26;if(_0x26bad4[_0xdcb9('0x41')][_0xdcb9('0x50')]){_0x4b6803[_0xdcb9('0x59')]=[{'all':!![]}];}return db[_0xdcb9('0x68')][_0xdcb9('0x51')](_0x4b6803);})[_0xdcb9('0x22')](function(_0x8fde3d){_0x186024[_0xdcb9('0x52')]=_0x8fde3d;return _0x186024;});}})[_0xdcb9('0x22')](respondWithFilteredResult(_0x5125e4,_0x4b6803))['catch'](handleError(_0x5125e4,null));};exports['removeDispositions']=function(_0x3ded96,_0x24f29c,_0x23efe0){return db['OpenchannelAccount'][_0xdcb9('0x5a')]({'where':{'id':_0x3ded96['params']['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x24f29c,null))[_0xdcb9('0x22')](function(_0x5f1b0a){if(_0x5f1b0a){return _0x5f1b0a[_0xdcb9('0x6b')](_0x3ded96['query'][_0xdcb9('0x6c')]);}})[_0xdcb9('0x22')](respondWithStatusCode(_0x24f29c,null))['catch'](handleError(_0x24f29c,null));};exports['addAnswer']=function(_0x567c0e,_0x3d700e,_0x57b6a2){if(_0x567c0e['body']['id']){delete _0x567c0e[_0xdcb9('0x5c')]['id'];}return db[_0xdcb9('0x3d')]['find']({'where':{'id':_0x567c0e[_0xdcb9('0x55')]['id']}})['then'](handleEntityNotFound(_0x3d700e,null))[_0xdcb9('0x22')](function(_0xa49b6){if(_0xa49b6){_0x567c0e[_0xdcb9('0x5c')]['OpenchannelAccountId']=_0xa49b6['id'];return db['CannedAnswer'][_0xdcb9('0x5b')](_0x567c0e['body']);}})[_0xdcb9('0x22')](respondWithResult(_0x3d700e,null))[_0xdcb9('0x53')](handleError(_0x3d700e,null));};exports[_0xdcb9('0x6d')]=function(_0x408191,_0x1dc703,_0x31c5e9){var _0xd96713={'raw':![],'where':{}};var _0x7cc511={};var _0x2e9fa8={'count':0x0,'rows':[]};return db[_0xdcb9('0x3d')][_0xdcb9('0x6e')]({'where':{'id':_0x408191['params']['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x1dc703,null))[_0xdcb9('0x22')](function(_0xd82a94){if(_0xd82a94){_0x7cc511[_0xdcb9('0x40')]=_[_0xdcb9('0x58')](db[_0xdcb9('0x6f')]['rawAttributes']);_0x7cc511['query']=_[_0xdcb9('0x58')](_0x408191['query']);_0x7cc511[_0xdcb9('0x4a')]=_[_0xdcb9('0x43')](_0x7cc511[_0xdcb9('0x40')],_0x7cc511[_0xdcb9('0x41')]);_0xd96713[_0xdcb9('0x42')]=_[_0xdcb9('0x43')](_0x7cc511[_0xdcb9('0x40')],qs[_0xdcb9('0x44')](_0x408191['query'][_0xdcb9('0x44')]));_0xd96713[_0xdcb9('0x42')]=_0xd96713[_0xdcb9('0x42')][_0xdcb9('0x45')]?_0xd96713['attributes']:_0x7cc511[_0xdcb9('0x40')];if(!_0x408191[_0xdcb9('0x41')]['hasOwnProperty']('nolimit')){_0xd96713[_0xdcb9('0x32')]=qs[_0xdcb9('0x32')](_0x408191[_0xdcb9('0x41')][_0xdcb9('0x32')]);_0xd96713[_0xdcb9('0x31')]=qs[_0xdcb9('0x31')](_0x408191['query']['offset']);}_0xd96713[_0xdcb9('0x47')]=qs[_0xdcb9('0x48')](_0x408191['query'][_0xdcb9('0x48')]);_0xd96713['where']=qs['filters'](_[_0xdcb9('0x4b')](_0x408191[_0xdcb9('0x41')],_0x7cc511[_0xdcb9('0x4a')]));_0xd96713['where']['OpenchannelAccountId']=_0xd82a94['id'];if(_0x408191[_0xdcb9('0x41')][_0xdcb9('0x4c')]){_0xd96713[_0xdcb9('0x49')]=_[_0xdcb9('0x4d')](_0xd96713[_0xdcb9('0x49')],{'$or':_['map'](_0xd96713[_0xdcb9('0x42')],function(_0x47aab2){var _0x5aa1a1={};_0x5aa1a1[_0x47aab2]={'$like':'%'+_0x408191['query']['filter']+'%'};return _0x5aa1a1;})});}_0xd96713=_[_0xdcb9('0x4d')]({},_0xd96713,_0x408191[_0xdcb9('0x4f')]);return db[_0xdcb9('0x6f')][_0xdcb9('0x30')]({'where':_0xd96713[_0xdcb9('0x49')]})[_0xdcb9('0x22')](function(_0x2b8e11){_0x2e9fa8['count']=_0x2b8e11;if(_0x408191[_0xdcb9('0x41')][_0xdcb9('0x50')]){_0xd96713[_0xdcb9('0x59')]=[{'all':!![]}];}return db[_0xdcb9('0x6f')][_0xdcb9('0x51')](_0xd96713);})[_0xdcb9('0x22')](function(_0x28e722){_0x2e9fa8['rows']=_0x28e722;return _0x2e9fa8;});}})['then'](respondWithFilteredResult(_0x1dc703,_0xd96713))[_0xdcb9('0x53')](handleError(_0x1dc703,null));};exports[_0xdcb9('0x70')]=function(_0x247675,_0x12e489,_0x525f42){return db['OpenchannelAccount'][_0xdcb9('0x5a')]({'where':{'id':_0x247675[_0xdcb9('0x55')]['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x12e489,null))[_0xdcb9('0x22')](function(_0x44476e){if(_0x44476e){return _0x44476e['removeAnswers'](_0x247675['query'][_0xdcb9('0x6c')]);}})[_0xdcb9('0x22')](respondWithStatusCode(_0x12e489,null))['catch'](handleError(_0x12e489,null));};exports[_0xdcb9('0x71')]=function(_0x51c3f2,_0x3d112b,_0x3d9fca){var _0x42a257={'body':_0x51c3f2[_0xdcb9('0x5c')],'channel':_0xdcb9('0x72')};var _0x238bc0=[];var _0x4fc084=[];var _0x557c5a={};var _0x4e271c=![];return db[_0xdcb9('0x73')][_0xdcb9('0x65')]()['then'](function(_0x3bd378){if(!_0x3bd378){throw new db[(_0xdcb9('0x74'))][(_0xdcb9('0x75'))](_0xdcb9('0x76'));}_0x238bc0=_[_0xdcb9('0x77')](_[_0xdcb9('0x58')](_0x3bd378),['createdAt',_0xdcb9('0x78')]);_0x4fc084=_[_0xdcb9('0x77')](_[_0xdcb9('0x58')](_0x3bd378),[_0xdcb9('0x79'),'updatedAt',_0xdcb9('0x7a'),_0xdcb9('0x7b')]);if(_0x51c3f2[_0xdcb9('0x5c')]['id']){delete _0x51c3f2[_0xdcb9('0x5c')]['id'];}if(_[_0xdcb9('0x7c')](_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x7d')])){throw new db[(_0xdcb9('0x74'))][(_0xdcb9('0x75'))](_0xdcb9('0x7e'));}if(_[_0xdcb9('0x7c')](_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x5c')])||_0x51c3f2[_0xdcb9('0x5c')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xdcb9('0x7f'));}if(_[_0xdcb9('0x7c')](_0x51c3f2['body'][_0xdcb9('0x80')])){throw new db['Sequelize'][(_0xdcb9('0x75'))](_0xdcb9('0x81')+_0x4fc084);}if(!_[_0xdcb9('0x82')](_0x4fc084,_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x80')])){throw new db['Sequelize'][(_0xdcb9('0x75'))](_0xdcb9('0x83')+_0x4fc084);}_0x557c5a[_0x51c3f2['body'][_0xdcb9('0x80')]]=_0x51c3f2['body'][_0xdcb9('0x7d')];})[_0xdcb9('0x22')](function(){return db[_0xdcb9('0x3d')][_0xdcb9('0x5a')]({'where':{'id':_0x51c3f2[_0xdcb9('0x55')]['id']},'include':[{'model':db[_0xdcb9('0x84')],'as':'List','include':[{'model':db[_0xdcb9('0x73')],'as':'Contacts','where':_0x557c5a,'limit':0x1,'order':[[_0xdcb9('0x78'),_0xdcb9('0x85')]]}]},{'model':db[_0xdcb9('0x86')],'as':'Applications'}]});})[_0xdcb9('0x22')](handleEntityNotFound(_0x3d112b,null))[_0xdcb9('0x22')](function(_0x20b619){if(_0x20b619&&_0x20b619[_0xdcb9('0x87')]){_0x42a257[_0xdcb9('0x88')]=_0x20b619;_0x42a257[_0xdcb9('0x89')]=_0x20b619[_0xdcb9('0x8a')];_0x42a257[_0xdcb9('0x8b')]=_0x20b619[_0xdcb9('0x87')];_0x42a257[_0xdcb9('0x89')]=_['orderBy'](_0x42a257[_0xdcb9('0x89')],['priority'],[_0xdcb9('0x8c')]);if(_0x42a257[_0xdcb9('0x88')][_0xdcb9('0x8a')]){delete _0x42a257[_0xdcb9('0x88')][_0xdcb9('0x8a')];}if(_0x42a257['account'][_0xdcb9('0x87')]&&_0x42a257[_0xdcb9('0x88')][_0xdcb9('0x87')][_0xdcb9('0x8d')][_0xdcb9('0x45')]){return _0x42a257['account'][_0xdcb9('0x87')][_0xdcb9('0x8d')][0x0];}var _0x4602a8=_[_0xdcb9('0x1b')](_0x51c3f2[_0xdcb9('0x5c')],{'firstName':_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x7d')],'ListId':_0x20b619['ListId']});_0x4602a8[_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x80')]]=_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x7d')];return db[_0xdcb9('0x73')][_0xdcb9('0x5b')](_0x4602a8,{'fields':_0x238bc0,'raw':!![]});}})[_0xdcb9('0x22')](handleEntityNotFound(_0x3d112b,null))[_0xdcb9('0x22')](function(_0x43ff00){_0x42a257[_0xdcb9('0x8e')]=_0x43ff00;if(_0x43ff00){var _0x565032={'ContactId':_0x43ff00['id'],'OpenchannelAccountId':_0x51c3f2[_0xdcb9('0x55')]['id'],'from':(_0x43ff00['firstName']||'')+'\x20'+(_0x43ff00[_0xdcb9('0x8f')]||'')};var _0xb02595={'OpenchannelAccountId':_0x51c3f2[_0xdcb9('0x55')]['id'],'closed':![]};if(_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x90')]){_0xb02595[_0xdcb9('0x90')]=_0x51c3f2['body'][_0xdcb9('0x90')];return db[_0xdcb9('0x91')][_0xdcb9('0x5a')]({'where':_0xb02595})['then'](function(_0x51f992){if(_0x51f992){return[_0x51f992,![]];}_0x565032[_0xdcb9('0x90')]=_0x51c3f2['body']['threadId'];_0x565032[_0xdcb9('0x92')]=_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x92')];return db[_0xdcb9('0x91')][_0xdcb9('0x5b')](_0x565032)[_0xdcb9('0x22')](function(_0x1128d2){return[_0x1128d2,!![]];});});}else{_0xb02595[_0xdcb9('0x90')]=null;}_0xb02595['ContactId']=_0x43ff00['id'];return db[_0xdcb9('0x91')][_0xdcb9('0x5a')]({'where':_0xb02595})['then'](function(_0x47569f){if(_0x47569f){return[_0x47569f,![]];}return db['OpenchannelInteraction'][_0xdcb9('0x5b')](_0x565032)[_0xdcb9('0x22')](function(_0x48cb46){return[_0x48cb46,!![]];});});}})['spread'](function(_0x48384f,_0x4e27ba){if(_0x48384f){_0x4e271c=_0x4e27ba;if(!_0x4e27ba){var _0x47de75={'from':(_0x42a257[_0xdcb9('0x8e')][_0xdcb9('0x93')]||'')+'\x20'+(_0x42a257['contact']['lastName']||'')};if(_0x51c3f2['body'][_0xdcb9('0x90')]&&_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x94')]&&_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x90')]!=_0x51c3f2['body']['messageId']){_0x47de75[_0xdcb9('0x90')]=_0x51c3f2[_0xdcb9('0x5c')]['messageId'];}return _0x48384f['update'](_0x47de75);}else{return _0x48384f;}}})[_0xdcb9('0x22')](function(_0x5088d3){_0x42a257[_0xdcb9('0x95')]=_0x5088d3[_0xdcb9('0x5e')]({'plain':!![]});_0x42a257[_0xdcb9('0x95')][_0xdcb9('0x96')]=_0x4e271c;if(_0x42a257['interaction'][_0xdcb9('0x96')]){if(_0x42a257[_0xdcb9('0x88')]['autoclose']){_0x42a257[_0xdcb9('0x89')][_0xdcb9('0x97')]({'id':0x0,'priority':_0x42a257['applications'][_0xdcb9('0x45')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xdcb9('0x98')][_0xdcb9('0x5b')]({'body':_0x51c3f2['body'][_0xdcb9('0x5c')],'OpenchannelAccountId':_0x51c3f2[_0xdcb9('0x55')]['id'],'OpenchannelInteractionId':_0x5088d3['id'],'direction':'in','ContactId':_0x42a257[_0xdcb9('0x8e')]['id'],'AttachmentId':_0x51c3f2[_0xdcb9('0x5c')][_0xdcb9('0x99')]});})['then'](function(_0x535edf){_0x42a257['message']=_0x535edf;if(_0x42a257['interaction']['UserId']){return db[_0xdcb9('0x9a')][_0xdcb9('0x5a')]({'attributes':['id',_0xdcb9('0x3a')],'where':{'id':_0x42a257[_0xdcb9('0x95')]['UserId']}})[_0xdcb9('0x22')](function(_0x14dac0){if(_0x14dac0){_0x42a257['applications'][_0xdcb9('0x9b')]({'id':0x0,'priority':0x0,'app':_0xdcb9('0x9c'),'appdata':_0x14dac0[_0xdcb9('0x3a')]+','+(_0x42a257[_0xdcb9('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0xdcb9('0x9d')});_0x42a257[_0xdcb9('0x9e')]=![];}return respondWithRpcPromise(_0xdcb9('0x9f'),_0xdcb9('0xa0'),_0x42a257);});}return respondWithRpcPromise('Start',_0xdcb9('0xa0'),_0x42a257);})[_0xdcb9('0x22')](function(_0x2c6bc7){respondWithRpcPromise(_0xdcb9('0xa1'),_0xdcb9('0xa1'),{'event':_0xdcb9('0x71'),'message':_0x2c6bc7},client9002);return _0x2c6bc7;})[_0xdcb9('0x22')](respondWithResult(_0x3d112b,null))[_0xdcb9('0x53')](handleError(_0x3d112b,null));};exports[_0xdcb9('0xa2')]=function(_0xa5899b,_0x562eba,_0x55b14e){return db[_0xdcb9('0x3d')]['findOne']({'where':{'id':_0xa5899b['params']['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x562eba,null))[_0xdcb9('0x22')](function(_0x58a77c){if(_0x58a77c){return db[_0xdcb9('0xa3')]['transaction'](function(_0x4ef406){return db['OpenchannelApplication'][_0xdcb9('0x39')]({'where':{'OpenchannelAccountId':_0xa5899b['params']['id']},'transaction':_0x4ef406})[_0xdcb9('0x22')](function(_0x2ab666){var _0x46ee7b=_['map'](_0xa5899b[_0xdcb9('0x5c')],function(_0x1b122b){_0x1b122b[_0xdcb9('0x67')]=_0xa5899b[_0xdcb9('0x55')]['id'];return _0x1b122b;});return db['OpenchannelApplication'][_0xdcb9('0xa4')](_0x46ee7b,{'transaction':_0x4ef406});});})[_0xdcb9('0x22')](function(){return db['OpenchannelApplication'][_0xdcb9('0xa5')]({'where':{'OpenchannelAccountId':_0xa5899b[_0xdcb9('0x55')]['id']},'order':'priority'});});}})[_0xdcb9('0x22')](respondWithResult(_0x562eba,null))['catch'](handleError(_0x562eba,null));};exports[_0xdcb9('0xa6')]=function(_0x5d722d,_0x2bec70,_0x6684d5){var _0x5ba6d4={};var _0x149007={};var _0x43f5b1;var _0x4e7b8f;return db[_0xdcb9('0x3d')][_0xdcb9('0x6e')]({'where':{'id':_0x5d722d[_0xdcb9('0x55')]['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x2bec70,null))[_0xdcb9('0x22')](function(_0x4f0835){if(_0x4f0835){_0x43f5b1=_0x4f0835;_0x149007[_0xdcb9('0x40')]=_['keys'](db[_0xdcb9('0x86')][_0xdcb9('0x3e')]);_0x149007[_0xdcb9('0x41')]=_[_0xdcb9('0x58')](_0x5d722d[_0xdcb9('0x41')]);_0x149007[_0xdcb9('0x4a')]=_['intersection'](_0x149007[_0xdcb9('0x40')],_0x149007[_0xdcb9('0x41')]);_0x5ba6d4[_0xdcb9('0x42')]=_[_0xdcb9('0x43')](_0x149007[_0xdcb9('0x40')],qs[_0xdcb9('0x44')](_0x5d722d[_0xdcb9('0x41')][_0xdcb9('0x44')]));_0x5ba6d4['attributes']=_0x5ba6d4[_0xdcb9('0x42')][_0xdcb9('0x45')]?_0x5ba6d4['attributes']:_0x149007['model'];_0x5ba6d4['order']=qs[_0xdcb9('0x48')](_0x5d722d['query'][_0xdcb9('0x48')]);_0x5ba6d4['where']=qs[_0xdcb9('0x4a')](_[_0xdcb9('0x4b')](_0x5d722d['query'],_0x149007[_0xdcb9('0x4a')]));if(_0x5d722d[_0xdcb9('0x41')]['filter']){_0x5ba6d4[_0xdcb9('0x49')]=_[_0xdcb9('0x4d')](_0x5ba6d4[_0xdcb9('0x49')],{'$or':_[_0xdcb9('0x3c')](_0x5ba6d4[_0xdcb9('0x42')],function(_0x401c5d){var _0x107130={};_0x107130[_0x401c5d]={'$like':'%'+_0x5d722d['query']['filter']+'%'};return _0x107130;})});}_0x5ba6d4=_['merge']({},_0x5ba6d4,_0x5d722d['options']);return _0x43f5b1[_0xdcb9('0xa6')](_0x5ba6d4);}})[_0xdcb9('0x22')](function(_0x2e9de6){if(_0x2e9de6){_0x4e7b8f=_0x2e9de6[_0xdcb9('0x45')];if(!_0x5d722d[_0xdcb9('0x41')][_0xdcb9('0x6a')](_0xdcb9('0x46'))){_0x5ba6d4[_0xdcb9('0x32')]=qs[_0xdcb9('0x32')](_0x5d722d[_0xdcb9('0x41')]['limit']);_0x5ba6d4[_0xdcb9('0x31')]=qs[_0xdcb9('0x31')](_0x5d722d[_0xdcb9('0x41')][_0xdcb9('0x31')]);}return _0x43f5b1['getApplications'](_0x5ba6d4);}})[_0xdcb9('0x22')](function(_0x11a50d){if(_0x11a50d){return _0x11a50d?{'count':_0x4e7b8f,'rows':_0x11a50d}:null;}})[_0xdcb9('0x22')](respondWithResult(_0x2bec70,null))[_0xdcb9('0x53')](handleError(_0x2bec70,null));};exports['getInteractions']=function(_0x9ae2cb,_0x1ff57b,_0x479fcd){var _0x39be01={'raw':![],'where':{}};var _0x4ffc6c={};var _0x3b8471={'count':0x0,'rows':[]};return db[_0xdcb9('0x3d')][_0xdcb9('0x6e')]({'where':{'id':_0x9ae2cb[_0xdcb9('0x55')]['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x1ff57b,null))[_0xdcb9('0x22')](function(_0x595363){if(_0x595363){_0x4ffc6c['model']=_[_0xdcb9('0x58')](db['OpenchannelInteraction'][_0xdcb9('0x3e')]);_0x4ffc6c['query']=_[_0xdcb9('0x58')](_0x9ae2cb[_0xdcb9('0x41')]);_0x4ffc6c[_0xdcb9('0x4a')]=_[_0xdcb9('0x43')](_0x4ffc6c[_0xdcb9('0x40')],_0x4ffc6c[_0xdcb9('0x41')]);_0x39be01[_0xdcb9('0x42')]=_[_0xdcb9('0x43')](_0x4ffc6c[_0xdcb9('0x40')],qs['fields'](_0x9ae2cb['query'][_0xdcb9('0x44')]));_0x39be01[_0xdcb9('0x42')]=_0x39be01[_0xdcb9('0x42')][_0xdcb9('0x45')]?_0x39be01[_0xdcb9('0x42')]:_0x4ffc6c[_0xdcb9('0x40')];if(!_0x9ae2cb['query'][_0xdcb9('0x6a')](_0xdcb9('0x46'))){_0x39be01[_0xdcb9('0x32')]=qs['limit'](_0x9ae2cb['query'][_0xdcb9('0x32')]);_0x39be01[_0xdcb9('0x31')]=qs[_0xdcb9('0x31')](_0x9ae2cb[_0xdcb9('0x41')][_0xdcb9('0x31')]);}_0x39be01[_0xdcb9('0x47')]=qs[_0xdcb9('0x48')](_0x9ae2cb['query'][_0xdcb9('0x48')]);_0x39be01[_0xdcb9('0x49')]=qs[_0xdcb9('0x4a')](_['pick'](_0x9ae2cb[_0xdcb9('0x41')],_0x4ffc6c[_0xdcb9('0x4a')]));_0x39be01[_0xdcb9('0x49')]['OpenchannelAccountId']=_0x595363['id'];if(_0x9ae2cb[_0xdcb9('0x41')][_0xdcb9('0x4c')]){_0x39be01[_0xdcb9('0x49')]=_[_0xdcb9('0x4d')](_0x39be01[_0xdcb9('0x49')],{'$or':_['map'](_0x39be01[_0xdcb9('0x42')],function(_0xc40d44){var _0x5ae3cc={};_0x5ae3cc[_0xc40d44]={'$like':'%'+_0x9ae2cb[_0xdcb9('0x41')][_0xdcb9('0x4c')]+'%'};return _0x5ae3cc;})});}_0x39be01=_['merge']({},_0x39be01,_0x9ae2cb[_0xdcb9('0x4f')]);return db[_0xdcb9('0x91')][_0xdcb9('0x30')]({'where':_0x39be01[_0xdcb9('0x49')]})[_0xdcb9('0x22')](function(_0x144f51){_0x3b8471['count']=_0x144f51;if(_0x9ae2cb['query'][_0xdcb9('0x50')]){_0x39be01[_0xdcb9('0x59')]=[{'model':db['CmContact'],'as':_0xdcb9('0xa7'),'required':![]},{'model':db['User'],'as':_0xdcb9('0xa8'),'attributes':[_0xdcb9('0x3a'),_0xdcb9('0xa9'),_0xdcb9('0xaa')],'required':![]},{'model':db[_0xdcb9('0xab')],'as':_0xdcb9('0xac'),'attributes':['id',_0xdcb9('0x3a'),_0xdcb9('0xad')],'where':_0x9ae2cb['query'][_0xdcb9('0xae')]?{'id':_0x9ae2cb[_0xdcb9('0x41')]['tag']}:undefined,'required':_0x9ae2cb[_0xdcb9('0x41')][_0xdcb9('0xae')]?!![]:![]}];}return db[_0xdcb9('0x91')][_0xdcb9('0x51')](_0x39be01);})[_0xdcb9('0x22')](function(_0x47daf9){_0x3b8471['rows']=_0x47daf9;return _0x3b8471;});}})[_0xdcb9('0x22')](respondWithFilteredResult(_0x1ff57b,_0x39be01))[_0xdcb9('0x53')](handleError(_0x1ff57b,null));};exports['addAgents']=function(_0x5ee774,_0x1221f9,_0x54c451){return db[_0xdcb9('0x3d')][_0xdcb9('0x5a')]({'where':{'id':_0x5ee774['params']['id']}})['then'](handleEntityNotFound(_0x1221f9,null))['then'](function(_0x24a616){if(_0x24a616){return _0x24a616[_0xdcb9('0xaf')](_0x5ee774[_0xdcb9('0x5c')]['ids'],_[_0xdcb9('0xb0')](_0x5ee774[_0xdcb9('0x5c')],[_0xdcb9('0x6c'),'id'])||{})['spread'](function(_0x25aee5){for(var _0x3e44e3=0x0;_0x3e44e3<_0x5ee774['body']['ids'][_0xdcb9('0x45')];_0x3e44e3+=0x1){socket['emit'](_0xdcb9('0xb1'),{'UserId':Number(_0x5ee774[_0xdcb9('0x5c')]['ids'][_0x3e44e3]),'OpenchannelAccountId':Number(_0x5ee774['params']['id'])});}return _0x25aee5;});}})[_0xdcb9('0x22')](respondWithResult(_0x1221f9,null))[_0xdcb9('0x53')](handleError(_0x1221f9,null));};exports['removeAgents']=function(_0x39dd04,_0x576c17,_0x3a8931){return db['OpenchannelAccount'][_0xdcb9('0x5a')]({'where':{'id':_0x39dd04[_0xdcb9('0x55')]['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x576c17,null))[_0xdcb9('0x22')](function(_0x3e01a6){if(_0x3e01a6){return _0x3e01a6['removeAgents'](_0x39dd04[_0xdcb9('0x41')]['ids'])['then'](function(){if(_[_0xdcb9('0xb2')](_0x39dd04[_0xdcb9('0x41')][_0xdcb9('0x6c')])){for(var _0x4a6e83=0x0;_0x4a6e83<_0x39dd04[_0xdcb9('0x41')][_0xdcb9('0x6c')][_0xdcb9('0x45')];_0x4a6e83+=0x1){socket[_0xdcb9('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x39dd04[_0xdcb9('0x41')][_0xdcb9('0x6c')][_0x4a6e83]),'OpenchannelAccountId':Number(_0x39dd04[_0xdcb9('0x55')]['id'])});}}else{socket[_0xdcb9('0xb3')](_0xdcb9('0xb4'),{'UserId':Number(_0x39dd04[_0xdcb9('0x41')][_0xdcb9('0x6c')]),'OpenchannelAccountId':Number(_0x39dd04[_0xdcb9('0x55')]['id'])});}});}})[_0xdcb9('0x22')](respondWithStatusCode(_0x576c17,null))['catch'](handleError(_0x576c17,null));};exports[_0xdcb9('0xb5')]=function(_0x27bd34,_0x4d2eeb,_0x4d32b2){var _0x33e83a={};var _0x3d97cb={};var _0x4b3a6a;var _0x33c18d;return db[_0xdcb9('0x3d')]['findOne']({'where':{'id':_0x27bd34[_0xdcb9('0x55')]['id']}})[_0xdcb9('0x22')](handleEntityNotFound(_0x4d2eeb,null))['then'](function(_0xbd5650){if(_0xbd5650){_0x4b3a6a=_0xbd5650;_0x3d97cb['model']=_['keys'](db[_0xdcb9('0x9a')][_0xdcb9('0x3e')]);_0x3d97cb[_0xdcb9('0x41')]=_['keys'](_0x27bd34['query']);_0x3d97cb['filters']=_[_0xdcb9('0x43')](_0x3d97cb[_0xdcb9('0x40')],_0x3d97cb[_0xdcb9('0x41')]);_0x33e83a[_0xdcb9('0x42')]=_[_0xdcb9('0x43')](_0x3d97cb[_0xdcb9('0x40')],qs[_0xdcb9('0x44')](_0x27bd34[_0xdcb9('0x41')][_0xdcb9('0x44')]));_0x33e83a['attributes']=_0x33e83a[_0xdcb9('0x42')][_0xdcb9('0x45')]?_0x33e83a[_0xdcb9('0x42')]:_0x3d97cb['model'];_0x33e83a[_0xdcb9('0x47')]=qs[_0xdcb9('0x48')](_0x27bd34[_0xdcb9('0x41')][_0xdcb9('0x48')]);_0x33e83a[_0xdcb9('0x49')]=qs[_0xdcb9('0x4a')](_[_0xdcb9('0x4b')](_0x27bd34[_0xdcb9('0x41')],_0x3d97cb['filters']));if(_0x27bd34['query'][_0xdcb9('0x4c')]){_0x33e83a[_0xdcb9('0x49')]=_[_0xdcb9('0x4d')](_0x33e83a['where'],{'$or':_[_0xdcb9('0x3c')](_0x33e83a['attributes'],function(_0x49701c){var _0x273889={};_0x273889[_0x49701c]={'$like':'%'+_0x27bd34[_0xdcb9('0x41')][_0xdcb9('0x4c')]+'%'};return _0x273889;})});}_0x33e83a=_[_0xdcb9('0x4d')]({},_0x33e83a,_0x27bd34[_0xdcb9('0x4f')]);return _0x4b3a6a['getAgents'](_0x33e83a);}})[_0xdcb9('0x22')](function(_0x28f95d){if(_0x28f95d){_0x33c18d=_0x28f95d[_0xdcb9('0x45')];if(!_0x27bd34[_0xdcb9('0x41')][_0xdcb9('0x6a')]('nolimit')){_0x33e83a['limit']=qs[_0xdcb9('0x32')](_0x27bd34['query'][_0xdcb9('0x32')]);_0x33e83a[_0xdcb9('0x31')]=qs[_0xdcb9('0x31')](_0x27bd34[_0xdcb9('0x41')][_0xdcb9('0x31')]);}return _0x4b3a6a['getAgents'](_0x33e83a);}})['then'](function(_0x4f7ac6){if(_0x4f7ac6){return _0x4f7ac6?{'count':_0x33c18d,'rows':_0x4f7ac6}:null;}})[_0xdcb9('0x22')](respondWithResult(_0x4d2eeb,null))[_0xdcb9('0x53')](handleError(_0x4d2eeb,null));};exports[_0xdcb9('0xb6')]=function(_0x2f4fdb,_0x2e691d,_0x356e1b){var _0x35706a,_0x282b8d,_0x2d9170;if(_[_0xdcb9('0x7c')](_0x2f4fdb[_0xdcb9('0x5c')][_0xdcb9('0x5c')])||_0x2f4fdb[_0xdcb9('0x5c')][_0xdcb9('0x5c')]===''){throw new db[(_0xdcb9('0x74'))][(_0xdcb9('0x75'))](_0xdcb9('0x7f'));}if(_[_0xdcb9('0x7c')](_0x2f4fdb[_0xdcb9('0x5c')]['to'])){}_0x35706a=_0x2f4fdb[_0xdcb9('0x5c')]['to'];return db[_0xdcb9('0x3d')][_0xdcb9('0x6e')]({'where':{'id':_0x2f4fdb[_0xdcb9('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e691d,null))[_0xdcb9('0x22')](function(_0x33d1b8){if(_0x33d1b8){return db['OpenchannelAccount'][_0xdcb9('0x5a')]({'where':{'id':_0x33d1b8['id']},'include':[{'model':db['CmList'],'as':_0xdcb9('0x87'),'include':[{'model':db[_0xdcb9('0x73')],'as':_0xdcb9('0x8d'),'where':{[_0x33d1b8[_0xdcb9('0x80')]]:_0x35706a},'limit':0x1,'order':[[_0xdcb9('0x78'),'DESC']]}]}]})[_0xdcb9('0x22')](handleEntityNotFound(_0x2e691d,null))['then'](function(_0x143aa6){if(_0x143aa6&&_0x143aa6[_0xdcb9('0x87')]){_0x282b8d=_0x143aa6['get']({'plain':!![]});if(_0x282b8d[_0xdcb9('0x87')]&&_0x282b8d[_0xdcb9('0x87')][_0xdcb9('0x8d')][_0xdcb9('0x45')]){return _0x282b8d[_0xdcb9('0x87')][_0xdcb9('0x8d')][0x0];}return db[_0xdcb9('0x73')][_0xdcb9('0x5b')](_[_0xdcb9('0x1b')](_0x2f4fdb[_0xdcb9('0x5c')],{'firstName':_0x35706a,[_0x143aa6[_0xdcb9('0x80')]]:_0x35706a,'phone':_0x35706a,'ListId':_0x282b8d[_0xdcb9('0x7b')]}));}})[_0xdcb9('0x22')](handleEntityNotFound(_0x2e691d,null))[_0xdcb9('0x22')](function(_0x176599){if(_0x176599){_0x2d9170=_0x176599;return db[_0xdcb9('0x91')][_0xdcb9('0x5a')]({'where':{'ContactId':_0x2d9170['id'],'closed':![],'OpenchannelAccountId':_0x282b8d['id']}})[_0xdcb9('0x22')](function(_0x807247){if(_0x807247){return[_0x807247,![]];}return db[_0xdcb9('0x91')]['create']({'UserId':_0x2f4fdb[_0xdcb9('0x5d')]['id'],'ContactId':_0x2d9170['id'],'OpenchannelAccountId':_0x282b8d['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x2f4fdb[_0xdcb9('0x5c')],{'read':![],'body':_0x2f4fdb[_0xdcb9('0x5c')][_0xdcb9('0x5c')],'OpenchannelAccountId':_0x282b8d['id'],'UserId':_0x2f4fdb['user']['id'],'ContactId':_0x2d9170['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x56c919){return[_0x56c919,!![]];});});}})[_0xdcb9('0xb7')](function(_0x2b5412,_0x54380b){if(_0x54380b){return _0x2b5412;}return db[_0xdcb9('0x98')][_0xdcb9('0x5b')](_[_0xdcb9('0x4d')](_0x2f4fdb['body'],{'read':![],'body':_0x2f4fdb['body'][_0xdcb9('0x5c')],'OpenchannelAccountId':_0x282b8d['id'],'OpenchannelInteractionId':_0x2b5412['id'],'UserId':_0x2f4fdb[_0xdcb9('0x5d')]['id'],'ContactId':_0x2d9170['id']}))[_0xdcb9('0x22')](function(_0x43ac9d){_0x2b5412[_0xdcb9('0xb8')][_0xdcb9('0xb9')]=[];_0x2b5412[_0xdcb9('0xb8')]['Messages'][_0xdcb9('0x97')](_0x43ac9d[_0xdcb9('0xb8')]);return _0x2b5412;});});}})[_0xdcb9('0x22')](respondWithResult(_0x2e691d,null))[_0xdcb9('0x53')](handleError(_0x2e691d,null));}; \ No newline at end of file +var _0x8c9e=['where','pick','VIRTUAL','merge','includeAll','include','rows','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','filter','findAll','removeDispositions','addAnswer','CannedAnswer','nolimit','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','updatedAt','Applications','account','applications','list','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c9e,0x6f));var _0xe8c9=function(_0x3d3817,_0x5d0b91){_0x3d3817=_0x3d3817-0x0;var _0x4f23ce=_0x8c9e[_0x3d3817];return _0x4f23ce;};'use strict';var emlformat=require(_0xe8c9('0x0'));var rimraf=require(_0xe8c9('0x1'));var zipdir=require(_0xe8c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8c9('0x3'));var moment=require('moment');var BPromise=require(_0xe8c9('0x4'));var Mustache=require(_0xe8c9('0x5'));var util=require(_0xe8c9('0x6'));var path=require(_0xe8c9('0x7'));var sox=require(_0xe8c9('0x8'));var csv=require(_0xe8c9('0x9'));var ejs=require(_0xe8c9('0xa'));var fs=require('fs');var fs_extra=require(_0xe8c9('0xb'));var _=require(_0xe8c9('0xc'));var squel=require(_0xe8c9('0xd'));var crypto=require(_0xe8c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe8c9('0xf'));var toCsv=require(_0xe8c9('0x9'));var querystring=require(_0xe8c9('0x10'));var Papa=require(_0xe8c9('0x11'));var Redis=require(_0xe8c9('0x12'));var authService=require(_0xe8c9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe8c9('0x14'));var hardwareService=require(_0xe8c9('0x15'));var logger=require(_0xe8c9('0x16'))(_0xe8c9('0x17'));var utils=require(_0xe8c9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe8c9('0x19'));var db=require(_0xe8c9('0x1a'))['db'];config[_0xe8c9('0x1b')]=_[_0xe8c9('0x1c')](config[_0xe8c9('0x1b')],{'host':_0xe8c9('0x1d'),'port':0x18eb});var socket=require(_0xe8c9('0x1e'))(new Redis(config[_0xe8c9('0x1b')]));require(_0xe8c9('0x1f'))[_0xe8c9('0x20')](socket);var jayson=require(_0xe8c9('0x21'));var client=jayson['client'][_0xe8c9('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ad214,_0x4f2df6,_0x12caf8,_0x3d2a12){return new BPromise(function(_0x704eef,_0x26a36c){var _0x4e15fd=_0x3d2a12||client;return _0x4e15fd[_0xe8c9('0x23')](_0x5ad214,_0x12caf8)[_0xe8c9('0x24')](function(_0x8fadf9){logger[_0xe8c9('0x25')](_0xe8c9('0x26'),_0x4f2df6,_0xe8c9('0x27'));logger[_0xe8c9('0x28')](_0xe8c9('0x29'),_0x4f2df6,_0xe8c9('0x27'),JSON[_0xe8c9('0x2a')](_0x8fadf9));if(_0x8fadf9[_0xe8c9('0x2b')]){if(_0x8fadf9[_0xe8c9('0x2b')][_0xe8c9('0x2c')]===0x1f4){logger[_0xe8c9('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x4f2df6,_0x8fadf9['error']['message']);return _0x26a36c(_0x8fadf9[_0xe8c9('0x2b')][_0xe8c9('0x2d')]);}logger[_0xe8c9('0x2b')](_0xe8c9('0x26'),_0x4f2df6,_0x8fadf9['error'][_0xe8c9('0x2d')]);return _0x704eef(_0x8fadf9[_0xe8c9('0x2b')]['message']);}else{logger[_0xe8c9('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4f2df6,_0xe8c9('0x27'));_0x704eef(_0x8fadf9[_0xe8c9('0x2e')][_0xe8c9('0x2d')]);}})[_0xe8c9('0x2f')](function(_0xa81b63){logger['error'](_0xe8c9('0x26'),_0x4f2df6,_0xa81b63);_0x26a36c(_0xa81b63);});});}function respondWithStatusCode(_0x505697,_0x4e0d1f){_0x4e0d1f=_0x4e0d1f||0xcc;return function(_0x3fa3ae){if(_0x3fa3ae){return _0x505697[_0xe8c9('0x30')](_0x4e0d1f);}return _0x505697[_0xe8c9('0x31')](_0x4e0d1f)[_0xe8c9('0x32')]();};}function respondWithResult(_0x3276c2,_0x237631){_0x237631=_0x237631||0xc8;return function(_0x3353ca){if(_0x3353ca){return _0x3276c2[_0xe8c9('0x31')](_0x237631)['json'](_0x3353ca);}};}function respondWithFilteredResult(_0x3d4744,_0x25414a){return function(_0x26d81a){if(_0x26d81a){var _0xd87b73=typeof _0x25414a[_0xe8c9('0x33')]===_0xe8c9('0x34')&&typeof _0x25414a[_0xe8c9('0x35')]==='undefined';var _0x16fe6d=_0x26d81a['count'];var _0x39fd80=_0xd87b73?0x0:_0x25414a[_0xe8c9('0x33')];var _0x539b1a=_0xd87b73?_0x26d81a[_0xe8c9('0x36')]:_0x25414a['offset']+_0x25414a[_0xe8c9('0x35')];var _0x45b18f;if(_0x539b1a>=_0x16fe6d){_0x539b1a=_0x16fe6d;_0x45b18f=0xc8;}else{_0x45b18f=0xce;}_0x3d4744['status'](_0x45b18f);return _0x3d4744[_0xe8c9('0x37')]('Content-Range',_0x39fd80+'-'+_0x539b1a+'/'+_0x16fe6d)[_0xe8c9('0x38')](_0x26d81a);}return null;};}function patchUpdates(_0x459923){return function(_0x1ed246){try{jsonpatch['apply'](_0x1ed246,_0x459923,!![]);}catch(_0x458aca){return BPromise[_0xe8c9('0x39')](_0x458aca);}return _0x1ed246['save']();};}function saveUpdates(_0x2366b5,_0x5a8056){return function(_0x173950){if(_0x173950){return _0x173950[_0xe8c9('0x3a')](_0x2366b5)[_0xe8c9('0x24')](function(_0x3c2f4d){return _0x3c2f4d;});}return null;};}function removeEntity(_0x414e13,_0x52596d){return function(_0x5814df){if(_0x5814df){return _0x5814df[_0xe8c9('0x3b')]()[_0xe8c9('0x24')](function(){var _0x2cc95e=_0x5814df[_0xe8c9('0x3c')]({'plain':!![]});var _0x401503='OpenchannelAccounts';return db['UserProfileResource'][_0xe8c9('0x3b')]({'where':{'type':_0x401503,'resourceId':_0x2cc95e['id']}})[_0xe8c9('0x24')](function(){return _0x5814df;});})['then'](function(){_0x414e13[_0xe8c9('0x31')](0xcc)[_0xe8c9('0x32')]();});}};}function handleEntityNotFound(_0x37a61b,_0x2d05ab){return function(_0x500b19){if(!_0x500b19){_0x37a61b[_0xe8c9('0x30')](0x194);}return _0x500b19;};}function handleError(_0x1cabec,_0x1e7420){_0x1e7420=_0x1e7420||0x1f4;return function(_0xd1fda4){logger[_0xe8c9('0x2b')](_0xd1fda4[_0xe8c9('0x3d')]);if(_0xd1fda4['name']){delete _0xd1fda4[_0xe8c9('0x3e')];}_0x1cabec[_0xe8c9('0x31')](_0x1e7420)[_0xe8c9('0x3f')](_0xd1fda4);};}exports[_0xe8c9('0x40')]=function(_0x3c7037,_0x281fba){var _0x52cd99={'include':[{'model':db[_0xe8c9('0x41')],'as':_0xe8c9('0x42')}]},_0x48a2bc={},_0x54e4d5={'count':0x0,'rows':[]};var _0x3a688b=_[_0xe8c9('0x43')](db[_0xe8c9('0x44')][_0xe8c9('0x45')],function(_0x2d007a){return{'name':_0x2d007a['fieldName'],'type':_0x2d007a[_0xe8c9('0x46')][_0xe8c9('0x47')]};});_0x48a2bc[_0xe8c9('0x48')]=_[_0xe8c9('0x43')](_0x3a688b,_0xe8c9('0x3e'));_0x48a2bc[_0xe8c9('0x49')]=_[_0xe8c9('0x4a')](_0x3c7037[_0xe8c9('0x49')]);_0x48a2bc[_0xe8c9('0x4b')]=_[_0xe8c9('0x4c')](_0x48a2bc[_0xe8c9('0x48')],_0x48a2bc['query']);_0x52cd99['attributes']=_[_0xe8c9('0x4c')](_0x48a2bc[_0xe8c9('0x48')],qs['fields'](_0x3c7037[_0xe8c9('0x49')][_0xe8c9('0x4d')]));_0x52cd99['attributes']=_0x52cd99[_0xe8c9('0x4e')][_0xe8c9('0x4f')]?_0x52cd99['attributes']:_0x48a2bc[_0xe8c9('0x48')];if(!_0x3c7037[_0xe8c9('0x49')][_0xe8c9('0x50')]('nolimit')){_0x52cd99[_0xe8c9('0x35')]=qs[_0xe8c9('0x35')](_0x3c7037['query'][_0xe8c9('0x35')]);_0x52cd99[_0xe8c9('0x33')]=qs[_0xe8c9('0x33')](_0x3c7037['query']['offset']);}_0x52cd99[_0xe8c9('0x51')]=qs[_0xe8c9('0x52')](_0x3c7037[_0xe8c9('0x49')]['sort']);_0x52cd99[_0xe8c9('0x53')]=qs['filters'](_[_0xe8c9('0x54')](_0x3c7037[_0xe8c9('0x49')],_0x48a2bc[_0xe8c9('0x4b')]),_0x3a688b);if(_0x3c7037[_0xe8c9('0x49')]['filter']){_0x52cd99[_0xe8c9('0x53')]=_['merge'](_0x52cd99[_0xe8c9('0x53')],{'$or':_[_0xe8c9('0x43')](_0x3a688b,function(_0x21fe86){if(_0x21fe86[_0xe8c9('0x46')]!==_0xe8c9('0x55')){var _0x26d19d={};_0x26d19d[_0x21fe86['name']]={'$like':'%'+_0x3c7037[_0xe8c9('0x49')]['filter']+'%'};return _0x26d19d;}})});}_0x52cd99=_[_0xe8c9('0x56')]({},_0x52cd99,_0x3c7037['options']);var _0x212516={'where':_0x52cd99['where']};return db[_0xe8c9('0x44')][_0xe8c9('0x36')](_0x212516)[_0xe8c9('0x24')](function(_0x27406c){_0x54e4d5[_0xe8c9('0x36')]=_0x27406c;if(_0x3c7037[_0xe8c9('0x49')][_0xe8c9('0x57')]){_0x52cd99[_0xe8c9('0x58')]=[{'all':!![]}];}return db[_0xe8c9('0x44')]['findAll'](_0x52cd99);})[_0xe8c9('0x24')](function(_0x532b10){_0x54e4d5[_0xe8c9('0x59')]=_0x532b10;return _0x54e4d5;})[_0xe8c9('0x24')](respondWithFilteredResult(_0x281fba,_0x52cd99))[_0xe8c9('0x2f')](handleError(_0x281fba,null));};exports[_0xe8c9('0x5a')]=function(_0x27bb59,_0x2dbf21){var _0x25b0e6={'raw':![],'where':{'id':_0x27bb59['params']['id']},'include':[{'model':db[_0xe8c9('0x41')],'as':_0xe8c9('0x42')}]},_0x210bb9={};_0x210bb9[_0xe8c9('0x48')]=_[_0xe8c9('0x4a')](db[_0xe8c9('0x44')][_0xe8c9('0x45')]);_0x210bb9[_0xe8c9('0x49')]=_[_0xe8c9('0x4a')](_0x27bb59[_0xe8c9('0x49')]);_0x210bb9['filters']=_[_0xe8c9('0x4c')](_0x210bb9[_0xe8c9('0x48')],_0x210bb9[_0xe8c9('0x49')]);_0x25b0e6[_0xe8c9('0x4e')]=_[_0xe8c9('0x4c')](_0x210bb9[_0xe8c9('0x48')],qs[_0xe8c9('0x4d')](_0x27bb59['query'][_0xe8c9('0x4d')]));_0x25b0e6[_0xe8c9('0x4e')]=_0x25b0e6[_0xe8c9('0x4e')][_0xe8c9('0x4f')]?_0x25b0e6['attributes']:_0x210bb9[_0xe8c9('0x48')];if(_0x27bb59[_0xe8c9('0x49')]['includeAll']){_0x25b0e6[_0xe8c9('0x58')]=[{'all':!![]}];}_0x25b0e6=_['merge']({},_0x25b0e6,_0x27bb59[_0xe8c9('0x5b')]);return db[_0xe8c9('0x44')]['find'](_0x25b0e6)[_0xe8c9('0x24')](handleEntityNotFound(_0x2dbf21,null))[_0xe8c9('0x24')](respondWithResult(_0x2dbf21,null))[_0xe8c9('0x2f')](handleError(_0x2dbf21,null));};exports[_0xe8c9('0x5c')]=function(_0x2088e2,_0x1c9aae){return db[_0xe8c9('0x44')]['create'](_0x2088e2[_0xe8c9('0x5d')],{})[_0xe8c9('0x24')](function(_0x2d0129){var _0x4a3a3c=_0x2088e2[_0xe8c9('0x5e')]['get']({'plain':!![]});if(!_0x4a3a3c)throw new Error(_0xe8c9('0x5f'));if(_0x4a3a3c['role']==='user'){var _0x6d6962=_0x2d0129[_0xe8c9('0x3c')]({'plain':!![]});var _0x40b1d9=_0xe8c9('0x60');return db[_0xe8c9('0x61')][_0xe8c9('0x62')]({'where':{'name':_0x40b1d9,'userProfileId':_0x4a3a3c['userProfileId']},'raw':!![]})['then'](function(_0x7f5651){if(_0x7f5651&&_0x7f5651[_0xe8c9('0x63')]===0x0){return db[_0xe8c9('0x64')][_0xe8c9('0x5c')]({'name':_0x6d6962['name'],'resourceId':_0x6d6962['id'],'type':_0x7f5651['name'],'sectionId':_0x7f5651['id']},{})['then'](function(){return _0x2d0129;});}else{return _0x2d0129;}})['catch'](function(_0x4a561c){logger[_0xe8c9('0x2b')](_0xe8c9('0x65'),_0x4a561c);throw _0x4a561c;});}return _0x2d0129;})['then'](respondWithResult(_0x1c9aae,0xc9))[_0xe8c9('0x2f')](handleError(_0x1c9aae,null));};exports[_0xe8c9('0x3a')]=function(_0x1b51f5,_0x516582){if(_0x1b51f5[_0xe8c9('0x5d')]['id']){delete _0x1b51f5[_0xe8c9('0x5d')]['id'];}return db[_0xe8c9('0x44')][_0xe8c9('0x62')]({'where':{'id':_0x1b51f5[_0xe8c9('0x66')]['id']},'include':[{'model':db['Pause'],'as':_0xe8c9('0x42')}]})['then'](handleEntityNotFound(_0x516582,null))[_0xe8c9('0x24')](saveUpdates(_0x1b51f5[_0xe8c9('0x5d')],null))[_0xe8c9('0x24')](respondWithResult(_0x516582,null))[_0xe8c9('0x2f')](handleError(_0x516582,null));};exports['destroy']=function(_0x2d2402,_0x542e6d){return db[_0xe8c9('0x44')][_0xe8c9('0x62')]({'where':{'id':_0x2d2402[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x542e6d,null))[_0xe8c9('0x24')](removeEntity(_0x542e6d,null))[_0xe8c9('0x2f')](handleError(_0x542e6d,null));};exports[_0xe8c9('0x67')]=function(_0x3ca745,_0x11a366){return db[_0xe8c9('0x44')][_0xe8c9('0x67')]()[_0xe8c9('0x24')](respondWithResult(_0x11a366,null))[_0xe8c9('0x2f')](handleError(_0x11a366,null));};exports[_0xe8c9('0x68')]=function(_0x30e62e,_0x4008f5,_0x22975b){if(_0x30e62e[_0xe8c9('0x5d')]['id']){delete _0x30e62e[_0xe8c9('0x5d')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x30e62e[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x4008f5,null))[_0xe8c9('0x24')](function(_0x14f2f3){if(_0x14f2f3){_0x30e62e['body'][_0xe8c9('0x69')]=_0x14f2f3['id'];return db[_0xe8c9('0x6a')][_0xe8c9('0x5c')](_0x30e62e[_0xe8c9('0x5d')]);}})[_0xe8c9('0x24')](respondWithResult(_0x4008f5,null))[_0xe8c9('0x2f')](handleError(_0x4008f5,null));};exports[_0xe8c9('0x6b')]=function(_0x262461,_0x1fd5b3,_0x3163f8){var _0x2e90b6={'raw':![],'where':{}};var _0x50f8b0={};var _0x3b6a7e={'count':0x0,'rows':[]};return db[_0xe8c9('0x44')][_0xe8c9('0x6c')]({'where':{'id':_0x262461['params']['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x1fd5b3,null))[_0xe8c9('0x24')](function(_0x4b6b9c){if(_0x4b6b9c){_0x50f8b0['model']=_[_0xe8c9('0x4a')](db[_0xe8c9('0x6a')]['rawAttributes']);_0x50f8b0[_0xe8c9('0x49')]=_[_0xe8c9('0x4a')](_0x262461[_0xe8c9('0x49')]);_0x50f8b0[_0xe8c9('0x4b')]=_[_0xe8c9('0x4c')](_0x50f8b0[_0xe8c9('0x48')],_0x50f8b0[_0xe8c9('0x49')]);_0x2e90b6[_0xe8c9('0x4e')]=_[_0xe8c9('0x4c')](_0x50f8b0[_0xe8c9('0x48')],qs[_0xe8c9('0x4d')](_0x262461[_0xe8c9('0x49')][_0xe8c9('0x4d')]));_0x2e90b6[_0xe8c9('0x4e')]=_0x2e90b6['attributes'][_0xe8c9('0x4f')]?_0x2e90b6[_0xe8c9('0x4e')]:_0x50f8b0[_0xe8c9('0x48')];if(!_0x262461[_0xe8c9('0x49')][_0xe8c9('0x50')]('nolimit')){_0x2e90b6[_0xe8c9('0x35')]=qs['limit'](_0x262461[_0xe8c9('0x49')][_0xe8c9('0x35')]);_0x2e90b6[_0xe8c9('0x33')]=qs['offset'](_0x262461[_0xe8c9('0x49')][_0xe8c9('0x33')]);}_0x2e90b6['order']=qs[_0xe8c9('0x52')](_0x262461[_0xe8c9('0x49')][_0xe8c9('0x52')]);_0x2e90b6[_0xe8c9('0x53')]=qs[_0xe8c9('0x4b')](_[_0xe8c9('0x54')](_0x262461[_0xe8c9('0x49')],_0x50f8b0[_0xe8c9('0x4b')]));_0x2e90b6[_0xe8c9('0x53')][_0xe8c9('0x69')]=_0x4b6b9c['id'];if(_0x262461[_0xe8c9('0x49')][_0xe8c9('0x6d')]){_0x2e90b6[_0xe8c9('0x53')]=_[_0xe8c9('0x56')](_0x2e90b6[_0xe8c9('0x53')],{'$or':_['map'](_0x2e90b6[_0xe8c9('0x4e')],function(_0x5e0734){var _0x56312c={};_0x56312c[_0x5e0734]={'$like':'%'+_0x262461[_0xe8c9('0x49')][_0xe8c9('0x6d')]+'%'};return _0x56312c;})});}_0x2e90b6=_[_0xe8c9('0x56')]({},_0x2e90b6,_0x262461['options']);return db[_0xe8c9('0x6a')][_0xe8c9('0x36')]({'where':_0x2e90b6[_0xe8c9('0x53')]})[_0xe8c9('0x24')](function(_0x1ef156){_0x3b6a7e[_0xe8c9('0x36')]=_0x1ef156;if(_0x262461[_0xe8c9('0x49')][_0xe8c9('0x57')]){_0x2e90b6[_0xe8c9('0x58')]=[{'all':!![]}];}return db[_0xe8c9('0x6a')][_0xe8c9('0x6e')](_0x2e90b6);})[_0xe8c9('0x24')](function(_0x1cbe38){_0x3b6a7e[_0xe8c9('0x59')]=_0x1cbe38;return _0x3b6a7e;});}})[_0xe8c9('0x24')](respondWithFilteredResult(_0x1fd5b3,_0x2e90b6))[_0xe8c9('0x2f')](handleError(_0x1fd5b3,null));};exports[_0xe8c9('0x6f')]=function(_0x1bd771,_0x37d03e,_0x370a46){return db[_0xe8c9('0x44')]['find']({'where':{'id':_0x1bd771[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x37d03e,null))[_0xe8c9('0x24')](function(_0x45b874){if(_0x45b874){return _0x45b874[_0xe8c9('0x6f')](_0x1bd771['query']['ids']);}})[_0xe8c9('0x24')](respondWithStatusCode(_0x37d03e,null))[_0xe8c9('0x2f')](handleError(_0x37d03e,null));};exports[_0xe8c9('0x70')]=function(_0x327830,_0x2540c6,_0x3fd3b6){if(_0x327830[_0xe8c9('0x5d')]['id']){delete _0x327830['body']['id'];}return db[_0xe8c9('0x44')][_0xe8c9('0x62')]({'where':{'id':_0x327830[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x2540c6,null))[_0xe8c9('0x24')](function(_0x12e635){if(_0x12e635){_0x327830[_0xe8c9('0x5d')][_0xe8c9('0x69')]=_0x12e635['id'];return db[_0xe8c9('0x71')][_0xe8c9('0x5c')](_0x327830[_0xe8c9('0x5d')]);}})[_0xe8c9('0x24')](respondWithResult(_0x2540c6,null))[_0xe8c9('0x2f')](handleError(_0x2540c6,null));};exports['getAnswers']=function(_0x4cb01b,_0x40712b,_0x2a65e0){var _0x4471a3={'raw':![],'where':{}};var _0x58e604={};var _0x19df63={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe8c9('0x6c')]({'where':{'id':_0x4cb01b[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x40712b,null))[_0xe8c9('0x24')](function(_0x15af8f){if(_0x15af8f){_0x58e604[_0xe8c9('0x48')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x58e604[_0xe8c9('0x49')]=_['keys'](_0x4cb01b[_0xe8c9('0x49')]);_0x58e604[_0xe8c9('0x4b')]=_[_0xe8c9('0x4c')](_0x58e604[_0xe8c9('0x48')],_0x58e604[_0xe8c9('0x49')]);_0x4471a3[_0xe8c9('0x4e')]=_[_0xe8c9('0x4c')](_0x58e604[_0xe8c9('0x48')],qs[_0xe8c9('0x4d')](_0x4cb01b[_0xe8c9('0x49')][_0xe8c9('0x4d')]));_0x4471a3[_0xe8c9('0x4e')]=_0x4471a3[_0xe8c9('0x4e')][_0xe8c9('0x4f')]?_0x4471a3[_0xe8c9('0x4e')]:_0x58e604[_0xe8c9('0x48')];if(!_0x4cb01b[_0xe8c9('0x49')][_0xe8c9('0x50')](_0xe8c9('0x72'))){_0x4471a3['limit']=qs[_0xe8c9('0x35')](_0x4cb01b['query'][_0xe8c9('0x35')]);_0x4471a3[_0xe8c9('0x33')]=qs[_0xe8c9('0x33')](_0x4cb01b['query']['offset']);}_0x4471a3[_0xe8c9('0x51')]=qs[_0xe8c9('0x52')](_0x4cb01b[_0xe8c9('0x49')][_0xe8c9('0x52')]);_0x4471a3[_0xe8c9('0x53')]=qs[_0xe8c9('0x4b')](_[_0xe8c9('0x54')](_0x4cb01b[_0xe8c9('0x49')],_0x58e604[_0xe8c9('0x4b')]));_0x4471a3['where'][_0xe8c9('0x69')]=_0x15af8f['id'];if(_0x4cb01b['query']['filter']){_0x4471a3[_0xe8c9('0x53')]=_[_0xe8c9('0x56')](_0x4471a3[_0xe8c9('0x53')],{'$or':_['map'](_0x4471a3[_0xe8c9('0x4e')],function(_0x5b8445){var _0x415055={};_0x415055[_0x5b8445]={'$like':'%'+_0x4cb01b['query']['filter']+'%'};return _0x415055;})});}_0x4471a3=_[_0xe8c9('0x56')]({},_0x4471a3,_0x4cb01b['options']);return db[_0xe8c9('0x71')]['count']({'where':_0x4471a3[_0xe8c9('0x53')]})[_0xe8c9('0x24')](function(_0x5b02ea){_0x19df63['count']=_0x5b02ea;if(_0x4cb01b[_0xe8c9('0x49')][_0xe8c9('0x57')]){_0x4471a3[_0xe8c9('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe8c9('0x6e')](_0x4471a3);})['then'](function(_0x3499d7){_0x19df63[_0xe8c9('0x59')]=_0x3499d7;return _0x19df63;});}})[_0xe8c9('0x24')](respondWithFilteredResult(_0x40712b,_0x4471a3))['catch'](handleError(_0x40712b,null));};exports['removeAnswers']=function(_0x455f9d,_0x478f09,_0x26f3a4){return db[_0xe8c9('0x44')]['find']({'where':{'id':_0x455f9d[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x478f09,null))[_0xe8c9('0x24')](function(_0x2725a9){if(_0x2725a9){return _0x2725a9[_0xe8c9('0x73')](_0x455f9d[_0xe8c9('0x49')][_0xe8c9('0x74')]);}})[_0xe8c9('0x24')](respondWithStatusCode(_0x478f09,null))['catch'](handleError(_0x478f09,null));};exports[_0xe8c9('0x75')]=function(_0x588896,_0x687a6f,_0x594f81){var _0x2c9ac3={'body':_0x588896[_0xe8c9('0x5d')],'channel':_0xe8c9('0x76')};var _0x39118a=[];var _0x4adf30=[];var _0x10ae55={};var _0x25c1e2=![];return db[_0xe8c9('0x77')][_0xe8c9('0x67')]()[_0xe8c9('0x24')](function(_0x4e6452){if(!_0x4e6452){throw new db['Sequelize'][(_0xe8c9('0x78'))](_0xe8c9('0x79'));}_0x39118a=_[_0xe8c9('0x7a')](_[_0xe8c9('0x4a')](_0x4e6452),[_0xe8c9('0x7b'),'updatedAt']);_0x4adf30=_['difference'](_[_0xe8c9('0x4a')](_0x4e6452),[_0xe8c9('0x7b'),'updatedAt',_0xe8c9('0x7c'),_0xe8c9('0x7d')]);if(_0x588896[_0xe8c9('0x5d')]['id']){delete _0x588896[_0xe8c9('0x5d')]['id'];}if(_[_0xe8c9('0x7e')](_0x588896['body']['from'])){throw new db[(_0xe8c9('0x7f'))][(_0xe8c9('0x78'))](_0xe8c9('0x80'));}if(_[_0xe8c9('0x7e')](_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x5d')])||_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x5d')]===''){throw new db['Sequelize'][(_0xe8c9('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe8c9('0x7e')](_0x588896['body'][_0xe8c9('0x81')])){throw new db['Sequelize'][(_0xe8c9('0x78'))](_0xe8c9('0x82')+_0x4adf30);}if(!_['includes'](_0x4adf30,_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x81')])){throw new db[(_0xe8c9('0x7f'))]['ValidationError'](_0xe8c9('0x83')+_0x4adf30);}_0x10ae55[_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x81')]]=_0x588896['body'][_0xe8c9('0x84')];})[_0xe8c9('0x24')](function(){return db[_0xe8c9('0x44')]['find']({'where':{'id':_0x588896[_0xe8c9('0x66')]['id']},'include':[{'model':db[_0xe8c9('0x85')],'as':_0xe8c9('0x86'),'include':[{'model':db['CmContact'],'as':_0xe8c9('0x87'),'where':_0x10ae55,'limit':0x1,'order':[[_0xe8c9('0x88'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xe8c9('0x89')}]});})[_0xe8c9('0x24')](handleEntityNotFound(_0x687a6f,null))[_0xe8c9('0x24')](function(_0x46b467){if(_0x46b467&&_0x46b467[_0xe8c9('0x86')]){_0x2c9ac3[_0xe8c9('0x8a')]=_0x46b467;_0x2c9ac3[_0xe8c9('0x8b')]=_0x46b467[_0xe8c9('0x89')];_0x2c9ac3[_0xe8c9('0x8c')]=_0x46b467[_0xe8c9('0x86')];_0x2c9ac3['applications']=_[_0xe8c9('0x8d')](_0x2c9ac3[_0xe8c9('0x8b')],[_0xe8c9('0x8e')],[_0xe8c9('0x8f')]);if(_0x2c9ac3[_0xe8c9('0x8a')][_0xe8c9('0x89')]){delete _0x2c9ac3[_0xe8c9('0x8a')][_0xe8c9('0x89')];}if(_0x2c9ac3[_0xe8c9('0x8a')][_0xe8c9('0x86')]&&_0x2c9ac3[_0xe8c9('0x8a')][_0xe8c9('0x86')][_0xe8c9('0x87')][_0xe8c9('0x4f')]){return _0x2c9ac3[_0xe8c9('0x8a')]['List'][_0xe8c9('0x87')][0x0];}var _0x75638c=_['defaults'](_0x588896[_0xe8c9('0x5d')],{'firstName':_0x588896[_0xe8c9('0x5d')]['from'],'ListId':_0x46b467[_0xe8c9('0x7d')]});_0x75638c[_0x588896['body'][_0xe8c9('0x81')]]=_0x588896[_0xe8c9('0x5d')]['from'];return db[_0xe8c9('0x77')][_0xe8c9('0x5c')](_0x75638c,{'fields':_0x39118a,'raw':!![]});}})['then'](handleEntityNotFound(_0x687a6f,null))[_0xe8c9('0x24')](function(_0x5b83f2){_0x2c9ac3[_0xe8c9('0x90')]=_0x5b83f2;if(_0x5b83f2){var _0x52851f={'ContactId':_0x5b83f2['id'],'OpenchannelAccountId':_0x588896[_0xe8c9('0x66')]['id'],'from':(_0x5b83f2['firstName']||'')+'\x20'+(_0x5b83f2[_0xe8c9('0x91')]||'')};var _0x11bcf7={'OpenchannelAccountId':_0x588896[_0xe8c9('0x66')]['id'],'closed':![]};if(_0x588896[_0xe8c9('0x5d')]['threadId']){_0x11bcf7[_0xe8c9('0x92')]=_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x92')];return db[_0xe8c9('0x93')][_0xe8c9('0x62')]({'where':_0x11bcf7})[_0xe8c9('0x24')](function(_0x4a88e4){if(_0x4a88e4){return[_0x4a88e4,![]];}_0x52851f[_0xe8c9('0x92')]=_0x588896['body']['threadId'];_0x52851f['externalUrl']=_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x94')];return db[_0xe8c9('0x93')][_0xe8c9('0x5c')](_0x52851f)[_0xe8c9('0x24')](function(_0x12c319){return[_0x12c319,!![]];});});}else{_0x11bcf7[_0xe8c9('0x92')]=null;}_0x11bcf7[_0xe8c9('0x95')]=_0x5b83f2['id'];return db['OpenchannelInteraction'][_0xe8c9('0x62')]({'where':_0x11bcf7})['then'](function(_0x55f575){if(_0x55f575){return[_0x55f575,![]];}return db[_0xe8c9('0x93')][_0xe8c9('0x5c')](_0x52851f)['then'](function(_0x53e885){return[_0x53e885,!![]];});});}})['spread'](function(_0x459ba4,_0x2da09d){if(_0x459ba4){_0x25c1e2=_0x2da09d;if(!_0x2da09d){var _0x500e16={'from':(_0x2c9ac3['contact'][_0xe8c9('0x96')]||'')+'\x20'+(_0x2c9ac3[_0xe8c9('0x90')][_0xe8c9('0x91')]||'')};if(_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x92')]&&_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x97')]&&_0x588896[_0xe8c9('0x5d')]['threadId']!=_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x97')]){_0x500e16['threadId']=_0x588896['body'][_0xe8c9('0x97')];}return _0x459ba4[_0xe8c9('0x3a')](_0x500e16);}else{return _0x459ba4;}}})['then'](function(_0x217270){_0x2c9ac3[_0xe8c9('0x98')]=_0x217270['get']({'plain':!![]});_0x2c9ac3[_0xe8c9('0x98')][_0xe8c9('0x99')]=_0x25c1e2;if(_0x2c9ac3['interaction'][_0xe8c9('0x99')]){if(_0x2c9ac3['account'][_0xe8c9('0x9a')]){_0x2c9ac3[_0xe8c9('0x8b')][_0xe8c9('0x9b')]({'id':0x0,'priority':_0x2c9ac3[_0xe8c9('0x8b')][_0xe8c9('0x4f')]+0x1,'app':_0xe8c9('0x9c'),'appdata':_0xe8c9('0x9d'),'interval':'*,*,*,*'});}}return db[_0xe8c9('0x9e')]['create']({'body':_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x5d')],'OpenchannelAccountId':_0x588896[_0xe8c9('0x66')]['id'],'OpenchannelInteractionId':_0x217270['id'],'direction':'in','ContactId':_0x2c9ac3[_0xe8c9('0x90')]['id'],'AttachmentId':_0x588896[_0xe8c9('0x5d')][_0xe8c9('0x9f')]});})[_0xe8c9('0x24')](function(_0x2fd98a){_0x2c9ac3['message']=_0x2fd98a;if(_0x2c9ac3[_0xe8c9('0x98')][_0xe8c9('0xa0')]){return db[_0xe8c9('0xa1')][_0xe8c9('0x62')]({'attributes':['id',_0xe8c9('0x3e')],'where':{'id':_0x2c9ac3[_0xe8c9('0x98')][_0xe8c9('0xa0')]}})[_0xe8c9('0x24')](function(_0x551e8b){if(_0x551e8b){_0x2c9ac3[_0xe8c9('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe8c9('0xa2'),'appdata':_0x551e8b['name']+','+(_0x2c9ac3[_0xe8c9('0x8a')][_0xe8c9('0xa3')]||0xa),'interval':_0xe8c9('0xa4')});_0x2c9ac3[_0xe8c9('0xa5')]=![];}return respondWithRpcPromise(_0xe8c9('0xa6'),_0xe8c9('0xa7'),_0x2c9ac3);});}return respondWithRpcPromise(_0xe8c9('0xa6'),'startRouting',_0x2c9ac3);})['then'](function(_0x328ccf){respondWithRpcPromise(_0xe8c9('0xa8'),_0xe8c9('0xa8'),{'event':'notify','message':_0x328ccf},client9002);return _0x328ccf;})['then'](respondWithResult(_0x687a6f,null))[_0xe8c9('0x2f')](handleError(_0x687a6f,null));};exports['addApplications']=function(_0x2c4027,_0x364876,_0x2c8c9c){return db[_0xe8c9('0x44')][_0xe8c9('0x6c')]({'where':{'id':_0x2c4027[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x364876,null))[_0xe8c9('0x24')](function(_0x4e9ad6){if(_0x4e9ad6){return db[_0xe8c9('0xa9')][_0xe8c9('0xaa')](function(_0x5be16a){return db[_0xe8c9('0xab')][_0xe8c9('0x3b')]({'where':{'OpenchannelAccountId':_0x2c4027[_0xe8c9('0x66')]['id']},'transaction':_0x5be16a})[_0xe8c9('0x24')](function(_0x2e0ae5){var _0x5ca387=_['map'](_0x2c4027['body'],function(_0x52e3ce){_0x52e3ce[_0xe8c9('0x69')]=_0x2c4027[_0xe8c9('0x66')]['id'];return _0x52e3ce;});return db[_0xe8c9('0xab')][_0xe8c9('0xac')](_0x5ca387,{'transaction':_0x5be16a});});})[_0xe8c9('0x24')](function(){return db[_0xe8c9('0xab')][_0xe8c9('0xad')]({'where':{'OpenchannelAccountId':_0x2c4027['params']['id']},'order':_0xe8c9('0x8e')});});}})[_0xe8c9('0x24')](respondWithResult(_0x364876,null))[_0xe8c9('0x2f')](handleError(_0x364876,null));};exports['getApplications']=function(_0x3f6d0b,_0x3bf39f,_0x309cc2){var _0x573e1b={};var _0x327b5c={};var _0x2cac55;var _0xf51ee7;return db[_0xe8c9('0x44')][_0xe8c9('0x6c')]({'where':{'id':_0x3f6d0b[_0xe8c9('0x66')]['id']}})['then'](handleEntityNotFound(_0x3bf39f,null))['then'](function(_0x23f854){if(_0x23f854){_0x2cac55=_0x23f854;_0x327b5c[_0xe8c9('0x48')]=_[_0xe8c9('0x4a')](db[_0xe8c9('0xab')][_0xe8c9('0x45')]);_0x327b5c[_0xe8c9('0x49')]=_[_0xe8c9('0x4a')](_0x3f6d0b['query']);_0x327b5c[_0xe8c9('0x4b')]=_[_0xe8c9('0x4c')](_0x327b5c[_0xe8c9('0x48')],_0x327b5c[_0xe8c9('0x49')]);_0x573e1b['attributes']=_[_0xe8c9('0x4c')](_0x327b5c[_0xe8c9('0x48')],qs['fields'](_0x3f6d0b[_0xe8c9('0x49')][_0xe8c9('0x4d')]));_0x573e1b[_0xe8c9('0x4e')]=_0x573e1b[_0xe8c9('0x4e')][_0xe8c9('0x4f')]?_0x573e1b[_0xe8c9('0x4e')]:_0x327b5c[_0xe8c9('0x48')];_0x573e1b[_0xe8c9('0x51')]=qs[_0xe8c9('0x52')](_0x3f6d0b[_0xe8c9('0x49')]['sort']);_0x573e1b[_0xe8c9('0x53')]=qs[_0xe8c9('0x4b')](_[_0xe8c9('0x54')](_0x3f6d0b[_0xe8c9('0x49')],_0x327b5c[_0xe8c9('0x4b')]));if(_0x3f6d0b['query']['filter']){_0x573e1b[_0xe8c9('0x53')]=_[_0xe8c9('0x56')](_0x573e1b[_0xe8c9('0x53')],{'$or':_['map'](_0x573e1b[_0xe8c9('0x4e')],function(_0x22d7b9){var _0x10aae7={};_0x10aae7[_0x22d7b9]={'$like':'%'+_0x3f6d0b[_0xe8c9('0x49')]['filter']+'%'};return _0x10aae7;})});}_0x573e1b=_[_0xe8c9('0x56')]({},_0x573e1b,_0x3f6d0b[_0xe8c9('0x5b')]);return _0x2cac55[_0xe8c9('0xae')](_0x573e1b);}})[_0xe8c9('0x24')](function(_0x34a91e){if(_0x34a91e){_0xf51ee7=_0x34a91e['length'];if(!_0x3f6d0b[_0xe8c9('0x49')][_0xe8c9('0x50')](_0xe8c9('0x72'))){_0x573e1b[_0xe8c9('0x35')]=qs[_0xe8c9('0x35')](_0x3f6d0b['query']['limit']);_0x573e1b[_0xe8c9('0x33')]=qs['offset'](_0x3f6d0b['query']['offset']);}return _0x2cac55[_0xe8c9('0xae')](_0x573e1b);}})[_0xe8c9('0x24')](function(_0x46a262){if(_0x46a262){return _0x46a262?{'count':_0xf51ee7,'rows':_0x46a262}:null;}})[_0xe8c9('0x24')](respondWithResult(_0x3bf39f,null))[_0xe8c9('0x2f')](handleError(_0x3bf39f,null));};exports[_0xe8c9('0xaf')]=function(_0x420202,_0x12bc67,_0x15e3c2){var _0x2c7e0d={'raw':![],'where':{}};var _0x443980={};var _0x5552c1={'count':0x0,'rows':[]};return db[_0xe8c9('0x44')][_0xe8c9('0x6c')]({'where':{'id':_0x420202[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x12bc67,null))[_0xe8c9('0x24')](function(_0x66658c){if(_0x66658c){_0x443980['model']=_[_0xe8c9('0x4a')](db[_0xe8c9('0x93')][_0xe8c9('0x45')]);_0x443980[_0xe8c9('0x49')]=_[_0xe8c9('0x4a')](_0x420202[_0xe8c9('0x49')]);_0x443980[_0xe8c9('0x4b')]=_[_0xe8c9('0x4c')](_0x443980['model'],_0x443980[_0xe8c9('0x49')]);_0x2c7e0d[_0xe8c9('0x4e')]=_[_0xe8c9('0x4c')](_0x443980[_0xe8c9('0x48')],qs[_0xe8c9('0x4d')](_0x420202[_0xe8c9('0x49')][_0xe8c9('0x4d')]));_0x2c7e0d['attributes']=_0x2c7e0d[_0xe8c9('0x4e')][_0xe8c9('0x4f')]?_0x2c7e0d[_0xe8c9('0x4e')]:_0x443980['model'];if(!_0x420202[_0xe8c9('0x49')][_0xe8c9('0x50')](_0xe8c9('0x72'))){_0x2c7e0d[_0xe8c9('0x35')]=qs[_0xe8c9('0x35')](_0x420202['query'][_0xe8c9('0x35')]);_0x2c7e0d[_0xe8c9('0x33')]=qs[_0xe8c9('0x33')](_0x420202[_0xe8c9('0x49')][_0xe8c9('0x33')]);}_0x2c7e0d[_0xe8c9('0x51')]=qs[_0xe8c9('0x52')](_0x420202['query'][_0xe8c9('0x52')]);_0x2c7e0d[_0xe8c9('0x53')]=qs[_0xe8c9('0x4b')](_[_0xe8c9('0x54')](_0x420202['query'],_0x443980[_0xe8c9('0x4b')]));_0x2c7e0d[_0xe8c9('0x53')][_0xe8c9('0x69')]=_0x66658c['id'];if(_0x420202[_0xe8c9('0x49')][_0xe8c9('0x6d')]){_0x2c7e0d[_0xe8c9('0x53')]=_['merge'](_0x2c7e0d[_0xe8c9('0x53')],{'$or':_['map'](_0x2c7e0d[_0xe8c9('0x4e')],function(_0x252b3a){var _0x47fbb8={};_0x47fbb8[_0x252b3a]={'$like':'%'+_0x420202['query']['filter']+'%'};return _0x47fbb8;})});}_0x2c7e0d=_[_0xe8c9('0x56')]({},_0x2c7e0d,_0x420202['options']);return db[_0xe8c9('0x93')][_0xe8c9('0x36')]({'where':_0x2c7e0d[_0xe8c9('0x53')]})[_0xe8c9('0x24')](function(_0x59c2a5){_0x5552c1[_0xe8c9('0x36')]=_0x59c2a5;if(_0x420202[_0xe8c9('0x49')]['includeAll']){_0x2c7e0d['include']=[{'model':db[_0xe8c9('0x77')],'as':_0xe8c9('0xb0'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0xe8c9('0xb1'),_0xe8c9('0xb2')],'required':![]},{'model':db[_0xe8c9('0xb3')],'as':_0xe8c9('0xb4'),'attributes':['id',_0xe8c9('0x3e'),_0xe8c9('0xb5')],'where':_0x420202['query'][_0xe8c9('0xb6')]?{'id':_0x420202[_0xe8c9('0x49')][_0xe8c9('0xb6')]}:undefined,'required':_0x420202[_0xe8c9('0x49')]['tag']?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x2c7e0d);})[_0xe8c9('0x24')](function(_0xfaccb7){_0x5552c1['rows']=_0xfaccb7;return _0x5552c1;});}})[_0xe8c9('0x24')](respondWithFilteredResult(_0x12bc67,_0x2c7e0d))[_0xe8c9('0x2f')](handleError(_0x12bc67,null));};exports[_0xe8c9('0xb7')]=function(_0x38a810,_0x47c452,_0x205eff){return db['OpenchannelAccount'][_0xe8c9('0x62')]({'where':{'id':_0x38a810[_0xe8c9('0x66')]['id']}})['then'](handleEntityNotFound(_0x47c452,null))[_0xe8c9('0x24')](function(_0x404cb0){if(_0x404cb0){return _0x404cb0[_0xe8c9('0xb7')](_0x38a810[_0xe8c9('0x5d')][_0xe8c9('0x74')],_['omit'](_0x38a810[_0xe8c9('0x5d')],[_0xe8c9('0x74'),'id'])||{})[_0xe8c9('0xb8')](function(_0xc74946){for(var _0x5a998f=0x0;_0x5a998f<_0x38a810[_0xe8c9('0x5d')][_0xe8c9('0x74')][_0xe8c9('0x4f')];_0x5a998f+=0x1){socket[_0xe8c9('0xb9')](_0xe8c9('0xba'),{'UserId':Number(_0x38a810[_0xe8c9('0x5d')][_0xe8c9('0x74')][_0x5a998f]),'OpenchannelAccountId':Number(_0x38a810[_0xe8c9('0x66')]['id'])});}return _0xc74946;});}})['then'](respondWithResult(_0x47c452,null))[_0xe8c9('0x2f')](handleError(_0x47c452,null));};exports[_0xe8c9('0xbb')]=function(_0x471fdf,_0x2f2212,_0x44316a){return db['OpenchannelAccount'][_0xe8c9('0x62')]({'where':{'id':_0x471fdf[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x2f2212,null))[_0xe8c9('0x24')](function(_0x515820){if(_0x515820){return _0x515820[_0xe8c9('0xbb')](_0x471fdf[_0xe8c9('0x49')]['ids'])[_0xe8c9('0x24')](function(){if(_['isArray'](_0x471fdf[_0xe8c9('0x49')][_0xe8c9('0x74')])){for(var _0x3d8060=0x0;_0x3d8060<_0x471fdf['query']['ids'][_0xe8c9('0x4f')];_0x3d8060+=0x1){socket[_0xe8c9('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x471fdf[_0xe8c9('0x49')]['ids'][_0x3d8060]),'OpenchannelAccountId':Number(_0x471fdf[_0xe8c9('0x66')]['id'])});}}else{socket[_0xe8c9('0xb9')](_0xe8c9('0xbc'),{'UserId':Number(_0x471fdf[_0xe8c9('0x49')][_0xe8c9('0x74')]),'OpenchannelAccountId':Number(_0x471fdf[_0xe8c9('0x66')]['id'])});}});}})[_0xe8c9('0x24')](respondWithStatusCode(_0x2f2212,null))[_0xe8c9('0x2f')](handleError(_0x2f2212,null));};exports['getAgents']=function(_0x34c003,_0x3e6ec6,_0x444789){var _0x24f748={};var _0x5b4755={};var _0x35669a;var _0x62f6f1;return db[_0xe8c9('0x44')][_0xe8c9('0x6c')]({'where':{'id':_0x34c003[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x3e6ec6,null))['then'](function(_0x5dbfb7){if(_0x5dbfb7){_0x35669a=_0x5dbfb7;_0x5b4755[_0xe8c9('0x48')]=_[_0xe8c9('0x4a')](db[_0xe8c9('0xa1')][_0xe8c9('0x45')]);_0x5b4755[_0xe8c9('0x49')]=_[_0xe8c9('0x4a')](_0x34c003[_0xe8c9('0x49')]);_0x5b4755['filters']=_['intersection'](_0x5b4755[_0xe8c9('0x48')],_0x5b4755[_0xe8c9('0x49')]);_0x24f748[_0xe8c9('0x4e')]=_[_0xe8c9('0x4c')](_0x5b4755['model'],qs[_0xe8c9('0x4d')](_0x34c003[_0xe8c9('0x49')][_0xe8c9('0x4d')]));_0x24f748[_0xe8c9('0x4e')]=_0x24f748[_0xe8c9('0x4e')]['length']?_0x24f748[_0xe8c9('0x4e')]:_0x5b4755[_0xe8c9('0x48')];_0x24f748[_0xe8c9('0x51')]=qs[_0xe8c9('0x52')](_0x34c003[_0xe8c9('0x49')][_0xe8c9('0x52')]);_0x24f748[_0xe8c9('0x53')]=qs[_0xe8c9('0x4b')](_[_0xe8c9('0x54')](_0x34c003[_0xe8c9('0x49')],_0x5b4755[_0xe8c9('0x4b')]));if(_0x34c003[_0xe8c9('0x49')][_0xe8c9('0x6d')]){_0x24f748[_0xe8c9('0x53')]=_[_0xe8c9('0x56')](_0x24f748[_0xe8c9('0x53')],{'$or':_[_0xe8c9('0x43')](_0x24f748[_0xe8c9('0x4e')],function(_0x2f1edf){var _0x3173b9={};_0x3173b9[_0x2f1edf]={'$like':'%'+_0x34c003[_0xe8c9('0x49')][_0xe8c9('0x6d')]+'%'};return _0x3173b9;})});}_0x24f748=_[_0xe8c9('0x56')]({},_0x24f748,_0x34c003[_0xe8c9('0x5b')]);return _0x35669a[_0xe8c9('0xbd')](_0x24f748);}})[_0xe8c9('0x24')](function(_0x301640){if(_0x301640){_0x62f6f1=_0x301640[_0xe8c9('0x4f')];if(!_0x34c003[_0xe8c9('0x49')][_0xe8c9('0x50')](_0xe8c9('0x72'))){_0x24f748[_0xe8c9('0x35')]=qs[_0xe8c9('0x35')](_0x34c003[_0xe8c9('0x49')][_0xe8c9('0x35')]);_0x24f748[_0xe8c9('0x33')]=qs['offset'](_0x34c003[_0xe8c9('0x49')][_0xe8c9('0x33')]);}return _0x35669a[_0xe8c9('0xbd')](_0x24f748);}})['then'](function(_0x9cc89f){if(_0x9cc89f){return _0x9cc89f?{'count':_0x62f6f1,'rows':_0x9cc89f}:null;}})[_0xe8c9('0x24')](respondWithResult(_0x3e6ec6,null))[_0xe8c9('0x2f')](handleError(_0x3e6ec6,null));};exports[_0xe8c9('0x3f')]=function(_0x1131ed,_0x11f846,_0x583342){var _0x6a5ae8,_0x1177c2,_0x31c4d4;if(_[_0xe8c9('0x7e')](_0x1131ed[_0xe8c9('0x5d')][_0xe8c9('0x5d')])||_0x1131ed[_0xe8c9('0x5d')][_0xe8c9('0x5d')]===''){throw new db[(_0xe8c9('0x7f'))]['ValidationError'](_0xe8c9('0xbe'));}if(_[_0xe8c9('0x7e')](_0x1131ed[_0xe8c9('0x5d')]['to'])){}_0x6a5ae8=_0x1131ed[_0xe8c9('0x5d')]['to'];return db[_0xe8c9('0x44')][_0xe8c9('0x6c')]({'where':{'id':_0x1131ed[_0xe8c9('0x66')]['id']}})[_0xe8c9('0x24')](handleEntityNotFound(_0x11f846,null))[_0xe8c9('0x24')](function(_0x4f4f61){if(_0x4f4f61){return db[_0xe8c9('0x44')][_0xe8c9('0x62')]({'where':{'id':_0x4f4f61['id']},'include':[{'model':db[_0xe8c9('0x85')],'as':_0xe8c9('0x86'),'include':[{'model':db[_0xe8c9('0x77')],'as':_0xe8c9('0x87'),'where':{[_0x4f4f61['mapKey']]:_0x6a5ae8},'limit':0x1,'order':[[_0xe8c9('0x88'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x11f846,null))['then'](function(_0x3d8b6f){if(_0x3d8b6f&&_0x3d8b6f['List']){_0x1177c2=_0x3d8b6f[_0xe8c9('0x3c')]({'plain':!![]});if(_0x1177c2['List']&&_0x1177c2['List']['Contacts'][_0xe8c9('0x4f')]){return _0x1177c2[_0xe8c9('0x86')]['Contacts'][0x0];}return db[_0xe8c9('0x77')][_0xe8c9('0x5c')](_['defaults'](_0x1131ed[_0xe8c9('0x5d')],{'firstName':_0x6a5ae8,[_0x3d8b6f[_0xe8c9('0x81')]]:_0x6a5ae8,'phone':_0x6a5ae8,'ListId':_0x1177c2[_0xe8c9('0x7d')]}));}})[_0xe8c9('0x24')](handleEntityNotFound(_0x11f846,null))[_0xe8c9('0x24')](function(_0x4c9ad){if(_0x4c9ad){_0x31c4d4=_0x4c9ad;return db[_0xe8c9('0x93')][_0xe8c9('0x62')]({'where':{'ContactId':_0x31c4d4['id'],'closed':![],'OpenchannelAccountId':_0x1177c2['id']}})[_0xe8c9('0x24')](function(_0xeb0420){if(_0xeb0420){return[_0xeb0420,![]];}return db[_0xe8c9('0x93')][_0xe8c9('0x5c')]({'UserId':_0x1131ed[_0xe8c9('0x5e')]['id'],'ContactId':_0x31c4d4['id'],'OpenchannelAccountId':_0x1177c2['id'],'lastMsgDirection':_0xe8c9('0xbf'),'Messages':[_[_0xe8c9('0x56')](_0x1131ed['body'],{'read':![],'body':_0x1131ed['body'][_0xe8c9('0x5d')],'OpenchannelAccountId':_0x1177c2['id'],'UserId':_0x1131ed[_0xe8c9('0x5e')]['id'],'ContactId':_0x31c4d4['id']})]},{'include':[{'model':db[_0xe8c9('0x9e')],'as':_0xe8c9('0xc0')}]})['then'](function(_0x3775f2){return[_0x3775f2,!![]];});});}})['spread'](function(_0x57d78,_0x1b4dbb){if(_0x1b4dbb){return _0x57d78;}return db['OpenchannelMessage'][_0xe8c9('0x5c')](_[_0xe8c9('0x56')](_0x1131ed[_0xe8c9('0x5d')],{'read':![],'body':_0x1131ed[_0xe8c9('0x5d')][_0xe8c9('0x5d')],'OpenchannelAccountId':_0x1177c2['id'],'OpenchannelInteractionId':_0x57d78['id'],'UserId':_0x1131ed[_0xe8c9('0x5e')]['id'],'ContactId':_0x31c4d4['id']}))[_0xe8c9('0x24')](function(_0x43656a){_0x57d78[_0xe8c9('0xc1')]['Messages']=[];_0x57d78[_0xe8c9('0xc1')]['Messages'][_0xe8c9('0x9b')](_0x43656a['dataValues']);return _0x57d78;});});}})[_0xe8c9('0x24')](respondWithResult(_0x11f846,null))[_0xe8c9('0x2f')](handleError(_0x11f846,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 65c25df..ec41bfe 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 _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x552b45,_0x3b8dfb){var _0x39f812=function(_0x7bb0a2){while(--_0x7bb0a2){_0x552b45['push'](_0x552b45['shift']());}};_0x39f812(++_0x3b8dfb);}(_0x4522,0x1a0));var _0x2452=function(_0x5bc889,_0xd385d8){_0x5bc889=_0x5bc889-0x0;var _0x2d3152=_0x4522[_0x5bc889];return _0x2d3152;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xee5b=['remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x300e96,_0x329b01){var _0x3a4fe6=function(_0x558e83){while(--_0x558e83){_0x300e96['push'](_0x300e96['shift']());}};_0x3a4fe6(++_0x329b01);}(_0xee5b,0x1f4));var _0xbee5=function(_0x5acc61,_0x3ea41c){_0x5acc61=_0x5acc61-0x0;var _0xa56c6d=_0xee5b[_0x5acc61];return _0xa56c6d;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbee5('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbee5('0x3'),'afterDestroy':_0xbee5('0x4')};function emitEvent(_0x2eb857){return function(_0x210159,_0x4bd202,_0x5200b1){OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857+':'+_0x210159['id'],_0x210159);OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857,_0x210159);_0x5200b1(null);};}for(var e in events){if(events[_0xbee5('0x6')](e)){var event=events[e];OpenchannelAccount[_0xbee5('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3205282..134b87d 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(_0x24ec14,_0x147520){var _0x392328=function(_0x253d24){while(--_0x253d24){_0x24ec14['push'](_0x24ec14['shift']());}};_0x392328(++_0x147520);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x88b95c,_0x4ed0df){var _0x10b2c0=function(_0x58bbf9){while(--_0x58bbf9){_0x88b95c['push'](_0x88b95c['shift']());}};_0x10b2c0(++_0x4ed0df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 945db05..d3095f4 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 _0x2f68=['OpenchannelAccount,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter','redis','./openchannelAccount.socket','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x2484a1,_0x1255c5){var _0x24134c=function(_0x1993f0){while(--_0x1993f0){_0x2484a1['push'](_0x2484a1['shift']());}};_0x24134c(++_0x1255c5);}(_0x2f68,0x9a));var _0x82f6=function(_0x10a84d,_0x4b2359){_0x10a84d=_0x10a84d-0x0;var _0x1ad5b9=_0x2f68[_0x10a84d];return _0x1ad5b9;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x82f6('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x82f6('0xa'))(new Redis(config[_0x82f6('0xb')]));require(_0x82f6('0xc'))['register'](socket);function respondWithRpcPromise(_0x27db58,_0x432289,_0x4e7c12){return new BPromise(function(_0x1cf88e,_0x1eec2f){return client[_0x82f6('0xd')](_0x27db58,_0x4e7c12)[_0x82f6('0xe')](function(_0x1a68c4){logger[_0x82f6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x432289,_0x82f6('0x10'));logger[_0x82f6('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x432289,_0x82f6('0x10'),JSON[_0x82f6('0x12')](_0x1a68c4));if(_0x1a68c4[_0x82f6('0x13')]){if(_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x14')]===0x1f4){logger[_0x82f6('0x13')](_0x82f6('0x15'),_0x432289,_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x16')]);return _0x1eec2f(_0x1a68c4['error'][_0x82f6('0x16')]);}logger['error'](_0x82f6('0x15'),_0x432289,_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x16')]);return _0x1cf88e(_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x16')]);}else{logger[_0x82f6('0xf')](_0x82f6('0x15'),_0x432289,_0x82f6('0x10'));_0x1cf88e(_0x1a68c4[_0x82f6('0x17')][_0x82f6('0x16')]);}})[_0x82f6('0x18')](function(_0x1d9091){logger[_0x82f6('0x13')](_0x82f6('0x15'),_0x432289,_0x1d9091);_0x1eec2f(_0x1d9091);});});} \ No newline at end of file +var _0xaa5e=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x3824d5,_0x246a00){_0x3824d5=_0x3824d5-0x0;var _0x5f3d11=_0xaa5e[_0x3824d5];return _0x5f3d11;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});config['redis']=_[_0xeaa5('0xb')](config[_0xeaa5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xeaa5('0xd'))(new Redis(config[_0xeaa5('0xc')]));require('./openchannelAccount.socket')[_0xeaa5('0xe')](socket);function respondWithRpcPromise(_0x49682b,_0x2f5750,_0x3552ac){return new BPromise(function(_0x503237,_0x3e1c2e){return client[_0xeaa5('0xf')](_0x49682b,_0x3552ac)[_0xeaa5('0x10')](function(_0x46806d){logger[_0xeaa5('0x11')](_0xeaa5('0x12'),_0x2f5750,_0xeaa5('0x13'));logger[_0xeaa5('0x14')](_0xeaa5('0x15'),_0x2f5750,'request\x20sent',JSON[_0xeaa5('0x16')](_0x46806d));if(_0x46806d[_0xeaa5('0x17')]){if(_0x46806d[_0xeaa5('0x17')][_0xeaa5('0x18')]===0x1f4){logger[_0xeaa5('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0x46806d[_0xeaa5('0x17')]['message']);return _0x3e1c2e(_0x46806d[_0xeaa5('0x17')][_0xeaa5('0x19')]);}logger[_0xeaa5('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0x46806d[_0xeaa5('0x17')]['message']);return _0x503237(_0x46806d[_0xeaa5('0x17')][_0xeaa5('0x19')]);}else{logger[_0xeaa5('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0xeaa5('0x13'));_0x503237(_0x46806d['result'][_0xeaa5('0x19')]);}})[_0xeaa5('0x1a')](function(_0x22f4d3){logger[_0xeaa5('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0x22f4d3);_0x3e1c2e(_0x22f4d3);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f491b44..6d7d696 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 _0xe600=['removeListener','register','length','save','update','emit'];(function(_0x557f77,_0x2ff13f){var _0x166ce5=function(_0x153405){while(--_0x153405){_0x557f77['push'](_0x557f77['shift']());}};_0x166ce5(++_0x2ff13f);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x0e60('0x0'),'remove',_0x0e60('0x1')];function createListener(_0x449b56,_0x1476ac){return function(_0x3f0912){_0x1476ac[_0x0e60('0x2')](_0x449b56,_0x3f0912);};}function removeListener(_0x276bdb,_0x1838bf){return function(){OpenchannelAccountEvents[_0x0e60('0x3')](_0x276bdb,_0x1838bf);};}exports[_0x0e60('0x4')]=function(_0x2f9c33){for(var _0x4c5738=0x0,_0x1d7563=events[_0x0e60('0x5')];_0x4c5738<_0x1d7563;_0x4c5738++){var _0x6727dd=events[_0x4c5738];var _0x30eaed=createListener('openchannelAccount:'+_0x6727dd,_0x2f9c33);OpenchannelAccountEvents['on'](_0x6727dd,_0x30eaed);}}; \ No newline at end of file +var _0x5bbd=['remove','update','removeListener','register','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x39dfac,_0x23f528){var _0x385392=function(_0x471620){while(--_0x471620){_0x39dfac['push'](_0x39dfac['shift']());}};_0x385392(++_0x23f528);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0xd5bb('0x0'));var events=[_0xd5bb('0x1'),_0xd5bb('0x2'),_0xd5bb('0x3')];function createListener(_0x31b4a1,_0x44487d){return function(_0x179bab){_0x44487d['emit'](_0x31b4a1,_0x179bab);};}function removeListener(_0x5db64a,_0x4a4799){return function(){OpenchannelAccountEvents[_0xd5bb('0x4')](_0x5db64a,_0x4a4799);};}exports[_0xd5bb('0x5')]=function(_0x489e3d){for(var _0x520c77=0x0,_0x292873=events['length'];_0x520c77<_0x292873;_0x520c77++){var _0x3878ba=events[_0x520c77];var _0x17c08f=createListener(_0xd5bb('0x6')+_0x3878ba,_0x489e3d);OpenchannelAccountEvents['on'](_0x3878ba,_0x17c08f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1a7a42b..183c120 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 _0x8934=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x4bbe8b,_0x3d2e60){var _0x471579=function(_0x196dda){while(--_0x196dda){_0x4bbe8b['push'](_0x4bbe8b['shift']());}};_0x471579(++_0x3d2e60);}(_0x8934,0xd9));var _0x4893=function(_0x546528,_0x5b6156){_0x546528=_0x546528-0x0;var _0x203daf=_0x8934[_0x546528];return _0x203daf;};'use strict';var multer=require(_0x4893('0x0'));var util=require(_0x4893('0x1'));var path=require(_0x4893('0x2'));var timeout=require(_0x4893('0x3'));var express=require(_0x4893('0x4'));var router=express[_0x4893('0x5')]();var fs_extra=require(_0x4893('0x6'));var auth=require(_0x4893('0x7'));var interaction=require(_0x4893('0x8'));var config=require(_0x4893('0x9'));var controller=require('./openchannelApplication.controller');router[_0x4893('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4893('0xa')](_0x4893('0xb'),auth[_0x4893('0xc')](),controller[_0x4893('0xd')]);router[_0x4893('0xe')]('/',auth[_0x4893('0xc')](),controller[_0x4893('0xf')]);router['put'](_0x4893('0xb'),auth[_0x4893('0xc')](),controller[_0x4893('0x10')]);router[_0x4893('0x11')](_0x4893('0xb'),auth[_0x4893('0xc')](),controller[_0x4893('0x12')]);module[_0x4893('0x13')]=router; \ No newline at end of file +var _0x4bf0=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','create','put','update','delete'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x4bf0,0x91));var _0x04bf=function(_0x488b60,_0x43ff12){_0x488b60=_0x488b60-0x0;var _0x4cdd6b=_0x4bf0[_0x488b60];return _0x4cdd6b;};'use strict';var multer=require('multer');var util=require(_0x04bf('0x0'));var path=require(_0x04bf('0x1'));var timeout=require(_0x04bf('0x2'));var express=require(_0x04bf('0x3'));var router=express['Router']();var fs_extra=require(_0x04bf('0x4'));var auth=require(_0x04bf('0x5'));var interaction=require(_0x04bf('0x6'));var config=require(_0x04bf('0x7'));var controller=require(_0x04bf('0x8'));router[_0x04bf('0x9')]('/',auth['isAuthenticated'](),controller[_0x04bf('0xa')]);router[_0x04bf('0x9')](_0x04bf('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x04bf('0xc')](),controller[_0x04bf('0xd')]);router[_0x04bf('0xe')](_0x04bf('0xb'),auth['isAuthenticated'](),controller[_0x04bf('0xf')]);router[_0x04bf('0x10')](_0x04bf('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x04bf('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 8fddae0..8502da9 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 _0x83a8=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x2ed4c4,_0x2f915d){var _0x49d00f=function(_0x578529){while(--_0x578529){_0x2ed4c4['push'](_0x2ed4c4['shift']());}};_0x49d00f(++_0x2f915d);}(_0x83a8,0x134));var _0x883a=function(_0x1eabe8,_0x291bd0){_0x1eabe8=_0x1eabe8-0x0;var _0x59d838=_0x83a8[_0x1eabe8];return _0x59d838;};'use strict';var Sequelize=require('sequelize');module[_0x883a('0x0')]={'priority':{'type':Sequelize[_0x883a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x883a('0x2')},'appdata':{'type':Sequelize[_0x883a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x883a('0x4')],'defaultValue':_0x883a('0x5')}}; \ No newline at end of file +var _0xb365=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x39bc4a,_0x595147){var _0x436b0d=function(_0x44e6eb){while(--_0x44e6eb){_0x39bc4a['push'](_0x39bc4a['shift']());}};_0x436b0d(++_0x595147);}(_0xb365,0x93));var _0x5b36=function(_0x27cd5a,_0x354773){_0x27cd5a=_0x27cd5a-0x0;var _0x31c24e=_0xb365[_0x27cd5a];return _0x31c24e;};'use strict';var Sequelize=require(_0x5b36('0x0'));module[_0x5b36('0x1')]={'priority':{'type':Sequelize[_0x5b36('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5b36('0x3')],'allowNull':![],'defaultValue':_0x5b36('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5b36('0x3')]},'interval':{'type':Sequelize[_0x5b36('0x3')],'defaultValue':_0x5b36('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6b7c64b..e55182d 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 _0x25d0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','OpenchannelApplication','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto'];(function(_0x1462c2,_0x12a9da){var _0x143e0a=function(_0x3289e5){while(--_0x3289e5){_0x1462c2['push'](_0x1462c2['shift']());}};_0x143e0a(++_0x12a9da);}(_0x25d0,0x1a5));var _0x025d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x025d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x025d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x025d('0x2'));var moment=require(_0x025d('0x3'));var BPromise=require(_0x025d('0x4'));var Mustache=require(_0x025d('0x5'));var util=require(_0x025d('0x6'));var path=require(_0x025d('0x7'));var sox=require('sox');var csv=require(_0x025d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x025d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x025d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x025d('0xb'));var toCsv=require(_0x025d('0x8'));var querystring=require(_0x025d('0xc'));var Papa=require(_0x025d('0xd'));var Redis=require(_0x025d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x025d('0xf'));var as=require(_0x025d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x025d('0x11'))(_0x025d('0x12'));var utils=require('../../config/utils');var config=require(_0x025d('0x13'));var licenseUtil=require(_0x025d('0x14'));var db=require(_0x025d('0x15'))['db'];function respondWithStatusCode(_0x12b108,_0x12bfcf){_0x12bfcf=_0x12bfcf||0xcc;return function(_0x43bc29){if(_0x43bc29){return _0x12b108[_0x025d('0x16')](_0x12bfcf);}return _0x12b108[_0x025d('0x17')](_0x12bfcf)[_0x025d('0x18')]();};}function respondWithResult(_0x18578c,_0x11c156){_0x11c156=_0x11c156||0xc8;return function(_0x35d1b0){if(_0x35d1b0){return _0x18578c[_0x025d('0x17')](_0x11c156)[_0x025d('0x19')](_0x35d1b0);}};}function respondWithFilteredResult(_0x3f55bd,_0x52a6e6){return function(_0x10f157){if(_0x10f157){var _0x439b0a=typeof _0x52a6e6[_0x025d('0x1a')]===_0x025d('0x1b')&&typeof _0x52a6e6['limit']===_0x025d('0x1b');var _0x785591=_0x10f157['count'];var _0x2b4740=_0x439b0a?0x0:_0x52a6e6[_0x025d('0x1a')];var _0x3a4b7b=_0x439b0a?_0x10f157[_0x025d('0x1c')]:_0x52a6e6[_0x025d('0x1a')]+_0x52a6e6['limit'];var _0x2cb20b;if(_0x3a4b7b>=_0x785591){_0x3a4b7b=_0x785591;_0x2cb20b=0xc8;}else{_0x2cb20b=0xce;}_0x3f55bd[_0x025d('0x17')](_0x2cb20b);return _0x3f55bd[_0x025d('0x1d')](_0x025d('0x1e'),_0x2b4740+'-'+_0x3a4b7b+'/'+_0x785591)['json'](_0x10f157);}return null;};}function patchUpdates(_0xb5908){return function(_0x252d60){try{jsonpatch[_0x025d('0x1f')](_0x252d60,_0xb5908,!![]);}catch(_0x54d502){return BPromise['reject'](_0x54d502);}return _0x252d60[_0x025d('0x20')]();};}function saveUpdates(_0x3a56bf,_0x43a2df){return function(_0x5a8461){if(_0x5a8461){return _0x5a8461[_0x025d('0x21')](_0x3a56bf)[_0x025d('0x22')](function(_0x1c83ab){return _0x1c83ab;});}return null;};}function removeEntity(_0x6dd0d7,_0x41ec1c){return function(_0x3c44b3){if(_0x3c44b3){return _0x3c44b3[_0x025d('0x23')]()[_0x025d('0x22')](function(){_0x6dd0d7[_0x025d('0x17')](0xcc)[_0x025d('0x18')]();});}};}function handleEntityNotFound(_0x704dda,_0x9aaf32){return function(_0x3d2c69){if(!_0x3d2c69){_0x704dda['sendStatus'](0x194);}return _0x3d2c69;};}function handleError(_0x45fb25,_0x2b0b29){_0x2b0b29=_0x2b0b29||0x1f4;return function(_0x3cf67f){logger[_0x025d('0x24')](_0x3cf67f[_0x025d('0x25')]);if(_0x3cf67f[_0x025d('0x26')]){delete _0x3cf67f['name'];}_0x45fb25[_0x025d('0x17')](_0x2b0b29)[_0x025d('0x27')](_0x3cf67f);};}exports['index']=function(_0x371a51,_0x5b86a2){var _0x4ee43c={},_0x4d47f2={},_0x47db6f={'count':0x0,'rows':[]};var _0x5d6c36=_[_0x025d('0x28')](db[_0x025d('0x29')]['rawAttributes'],function(_0x16a7c0){return{'name':_0x16a7c0[_0x025d('0x2a')],'type':_0x16a7c0[_0x025d('0x2b')]['key']};});_0x4d47f2[_0x025d('0x2c')]=_[_0x025d('0x28')](_0x5d6c36,_0x025d('0x26'));_0x4d47f2[_0x025d('0x2d')]=_['keys'](_0x371a51[_0x025d('0x2d')]);_0x4d47f2[_0x025d('0x2e')]=_[_0x025d('0x2f')](_0x4d47f2[_0x025d('0x2c')],_0x4d47f2[_0x025d('0x2d')]);_0x4ee43c[_0x025d('0x30')]=_[_0x025d('0x2f')](_0x4d47f2[_0x025d('0x2c')],qs[_0x025d('0x31')](_0x371a51[_0x025d('0x2d')][_0x025d('0x31')]));_0x4ee43c[_0x025d('0x30')]=_0x4ee43c['attributes'][_0x025d('0x32')]?_0x4ee43c[_0x025d('0x30')]:_0x4d47f2[_0x025d('0x2c')];if(!_0x371a51[_0x025d('0x2d')][_0x025d('0x33')](_0x025d('0x34'))){_0x4ee43c[_0x025d('0x35')]=qs[_0x025d('0x35')](_0x371a51[_0x025d('0x2d')][_0x025d('0x35')]);_0x4ee43c[_0x025d('0x1a')]=qs[_0x025d('0x1a')](_0x371a51[_0x025d('0x2d')][_0x025d('0x1a')]);}_0x4ee43c[_0x025d('0x36')]=qs[_0x025d('0x37')](_0x371a51[_0x025d('0x2d')]['sort']);_0x4ee43c[_0x025d('0x38')]=qs[_0x025d('0x2e')](_[_0x025d('0x39')](_0x371a51['query'],_0x4d47f2[_0x025d('0x2e')]),_0x5d6c36);if(_0x371a51[_0x025d('0x2d')]['filter']){_0x4ee43c['where']=_[_0x025d('0x3a')](_0x4ee43c[_0x025d('0x38')],{'$or':_['map'](_0x5d6c36,function(_0x2529d2){if(_0x2529d2[_0x025d('0x2b')]!==_0x025d('0x3b')){var _0x2732b1={};_0x2732b1[_0x2529d2[_0x025d('0x26')]]={'$like':'%'+_0x371a51[_0x025d('0x2d')]['filter']+'%'};return _0x2732b1;}})});}_0x4ee43c=_[_0x025d('0x3a')]({},_0x4ee43c,_0x371a51[_0x025d('0x3c')]);var _0x396735={'where':_0x4ee43c[_0x025d('0x38')]};return db[_0x025d('0x29')][_0x025d('0x1c')](_0x396735)[_0x025d('0x22')](function(_0x22116d){_0x47db6f[_0x025d('0x1c')]=_0x22116d;if(_0x371a51[_0x025d('0x2d')][_0x025d('0x3d')]){_0x4ee43c[_0x025d('0x3e')]=[{'all':!![]}];}return db[_0x025d('0x29')][_0x025d('0x3f')](_0x4ee43c);})[_0x025d('0x22')](function(_0x12bf32){_0x47db6f[_0x025d('0x40')]=_0x12bf32;return _0x47db6f;})[_0x025d('0x22')](respondWithFilteredResult(_0x5b86a2,_0x4ee43c))[_0x025d('0x41')](handleError(_0x5b86a2,null));};exports['show']=function(_0x441a51,_0x15cf22){var _0x198fd9={'raw':!![],'where':{'id':_0x441a51[_0x025d('0x42')]['id']}},_0x5b950c={};_0x5b950c['model']=_[_0x025d('0x43')](db[_0x025d('0x29')][_0x025d('0x44')]);_0x5b950c[_0x025d('0x2d')]=_[_0x025d('0x43')](_0x441a51[_0x025d('0x2d')]);_0x5b950c[_0x025d('0x2e')]=_[_0x025d('0x2f')](_0x5b950c['model'],_0x5b950c[_0x025d('0x2d')]);_0x198fd9[_0x025d('0x30')]=_[_0x025d('0x2f')](_0x5b950c[_0x025d('0x2c')],qs[_0x025d('0x31')](_0x441a51['query'][_0x025d('0x31')]));_0x198fd9[_0x025d('0x30')]=_0x198fd9[_0x025d('0x30')][_0x025d('0x32')]?_0x198fd9[_0x025d('0x30')]:_0x5b950c[_0x025d('0x2c')];if(_0x441a51[_0x025d('0x2d')]['includeAll']){_0x198fd9[_0x025d('0x3e')]=[{'all':!![]}];}_0x198fd9=_[_0x025d('0x3a')]({},_0x198fd9,_0x441a51[_0x025d('0x3c')]);return db[_0x025d('0x29')][_0x025d('0x45')](_0x198fd9)[_0x025d('0x22')](handleEntityNotFound(_0x15cf22,null))[_0x025d('0x22')](respondWithResult(_0x15cf22,null))['catch'](handleError(_0x15cf22,null));};exports[_0x025d('0x46')]=function(_0x360d14,_0xe48af9){return db[_0x025d('0x29')][_0x025d('0x46')](_0x360d14[_0x025d('0x47')],{})[_0x025d('0x22')](respondWithResult(_0xe48af9,0xc9))[_0x025d('0x41')](handleError(_0xe48af9,null));};exports[_0x025d('0x21')]=function(_0x39fa0a,_0x18b343){if(_0x39fa0a[_0x025d('0x47')]['id']){delete _0x39fa0a[_0x025d('0x47')]['id'];}return db[_0x025d('0x29')][_0x025d('0x45')]({'where':{'id':_0x39fa0a[_0x025d('0x42')]['id']}})[_0x025d('0x22')](handleEntityNotFound(_0x18b343,null))[_0x025d('0x22')](saveUpdates(_0x39fa0a['body'],null))[_0x025d('0x22')](respondWithResult(_0x18b343,null))['catch'](handleError(_0x18b343,null));};exports['destroy']=function(_0x251297,_0x461a35){return db[_0x025d('0x29')][_0x025d('0x45')]({'where':{'id':_0x251297['params']['id']}})['then'](handleEntityNotFound(_0x461a35,null))['then'](removeEntity(_0x461a35,null))['catch'](handleError(_0x461a35,null));}; \ No newline at end of file +var _0x9663=['sort','pick','filter','where','VIRTUAL','merge','OpenchannelApplication','includeAll','include','findAll','rows','params','rawAttributes','intersection','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x9663,0x137));var _0x3966=function(_0x18b42c,_0x2c1140){_0x18b42c=_0x18b42c-0x0;var _0x178ac0=_0x9663[_0x18b42c];return _0x178ac0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3966('0x0'));var zipdir=require(_0x3966('0x1'));var jsonpatch=require(_0x3966('0x2'));var rp=require(_0x3966('0x3'));var moment=require(_0x3966('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3966('0x5'));var path=require(_0x3966('0x6'));var sox=require(_0x3966('0x7'));var csv=require('to-csv');var ejs=require(_0x3966('0x8'));var fs=require('fs');var fs_extra=require(_0x3966('0x9'));var _=require(_0x3966('0xa'));var squel=require(_0x3966('0xb'));var crypto=require(_0x3966('0xc'));var jsforce=require(_0x3966('0xd'));var deskjs=require(_0x3966('0xe'));var toCsv=require(_0x3966('0xf'));var querystring=require(_0x3966('0x10'));var Papa=require(_0x3966('0x11'));var Redis=require('ioredis');var authService=require(_0x3966('0x12'));var qs=require(_0x3966('0x13'));var as=require(_0x3966('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3966('0x15'))('api');var utils=require(_0x3966('0x16'));var config=require(_0x3966('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3229,_0x64eb78){_0x64eb78=_0x64eb78||0xcc;return function(_0x2bb9fb){if(_0x2bb9fb){return _0x4f3229[_0x3966('0x18')](_0x64eb78);}return _0x4f3229[_0x3966('0x19')](_0x64eb78)[_0x3966('0x1a')]();};}function respondWithResult(_0x56ee0b,_0x493d1f){_0x493d1f=_0x493d1f||0xc8;return function(_0x138ad6){if(_0x138ad6){return _0x56ee0b[_0x3966('0x19')](_0x493d1f)[_0x3966('0x1b')](_0x138ad6);}};}function respondWithFilteredResult(_0x33f48e,_0x78f727){return function(_0x23fb95){if(_0x23fb95){var _0x9d8021=typeof _0x78f727[_0x3966('0x1c')]===_0x3966('0x1d')&&typeof _0x78f727[_0x3966('0x1e')]===_0x3966('0x1d');var _0x198636=_0x23fb95['count'];var _0x21aed2=_0x9d8021?0x0:_0x78f727['offset'];var _0x3ab622=_0x9d8021?_0x23fb95[_0x3966('0x1f')]:_0x78f727['offset']+_0x78f727[_0x3966('0x1e')];var _0x15b8d9;if(_0x3ab622>=_0x198636){_0x3ab622=_0x198636;_0x15b8d9=0xc8;}else{_0x15b8d9=0xce;}_0x33f48e[_0x3966('0x19')](_0x15b8d9);return _0x33f48e[_0x3966('0x20')](_0x3966('0x21'),_0x21aed2+'-'+_0x3ab622+'/'+_0x198636)[_0x3966('0x1b')](_0x23fb95);}return null;};}function patchUpdates(_0x1d800c){return function(_0x3a2f1c){try{jsonpatch[_0x3966('0x22')](_0x3a2f1c,_0x1d800c,!![]);}catch(_0x538d7e){return BPromise[_0x3966('0x23')](_0x538d7e);}return _0x3a2f1c['save']();};}function saveUpdates(_0x50978d,_0x9b8737){return function(_0x409ff2){if(_0x409ff2){return _0x409ff2[_0x3966('0x24')](_0x50978d)['then'](function(_0x50e596){return _0x50e596;});}return null;};}function removeEntity(_0x5d2e1c,_0x5e5b23){return function(_0x3a7524){if(_0x3a7524){return _0x3a7524[_0x3966('0x25')]()[_0x3966('0x26')](function(){_0x5d2e1c[_0x3966('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fdad9,_0x383f8c){return function(_0x3bcf38){if(!_0x3bcf38){_0x3fdad9[_0x3966('0x18')](0x194);}return _0x3bcf38;};}function handleError(_0x103bd9,_0xb41b01){_0xb41b01=_0xb41b01||0x1f4;return function(_0x12ec5e){logger[_0x3966('0x27')](_0x12ec5e[_0x3966('0x28')]);if(_0x12ec5e[_0x3966('0x29')]){delete _0x12ec5e['name'];}_0x103bd9[_0x3966('0x19')](_0xb41b01)[_0x3966('0x2a')](_0x12ec5e);};}exports['index']=function(_0x30da9b,_0x15e3b3){var _0x51e41f={},_0xa7e61c={},_0x4c3b50={'count':0x0,'rows':[]};var _0xc1756c=_[_0x3966('0x2b')](db['OpenchannelApplication']['rawAttributes'],function(_0x2db0fa){return{'name':_0x2db0fa[_0x3966('0x2c')],'type':_0x2db0fa[_0x3966('0x2d')]['key']};});_0xa7e61c[_0x3966('0x2e')]=_[_0x3966('0x2b')](_0xc1756c,_0x3966('0x29'));_0xa7e61c['query']=_[_0x3966('0x2f')](_0x30da9b[_0x3966('0x30')]);_0xa7e61c[_0x3966('0x31')]=_['intersection'](_0xa7e61c[_0x3966('0x2e')],_0xa7e61c[_0x3966('0x30')]);_0x51e41f[_0x3966('0x32')]=_['intersection'](_0xa7e61c[_0x3966('0x2e')],qs[_0x3966('0x33')](_0x30da9b[_0x3966('0x30')][_0x3966('0x33')]));_0x51e41f[_0x3966('0x32')]=_0x51e41f[_0x3966('0x32')][_0x3966('0x34')]?_0x51e41f[_0x3966('0x32')]:_0xa7e61c[_0x3966('0x2e')];if(!_0x30da9b[_0x3966('0x30')][_0x3966('0x35')]('nolimit')){_0x51e41f[_0x3966('0x1e')]=qs[_0x3966('0x1e')](_0x30da9b['query'][_0x3966('0x1e')]);_0x51e41f[_0x3966('0x1c')]=qs[_0x3966('0x1c')](_0x30da9b['query'][_0x3966('0x1c')]);}_0x51e41f['order']=qs[_0x3966('0x36')](_0x30da9b[_0x3966('0x30')][_0x3966('0x36')]);_0x51e41f['where']=qs['filters'](_[_0x3966('0x37')](_0x30da9b[_0x3966('0x30')],_0xa7e61c[_0x3966('0x31')]),_0xc1756c);if(_0x30da9b[_0x3966('0x30')][_0x3966('0x38')]){_0x51e41f[_0x3966('0x39')]=_['merge'](_0x51e41f['where'],{'$or':_[_0x3966('0x2b')](_0xc1756c,function(_0x35be05){if(_0x35be05[_0x3966('0x2d')]!==_0x3966('0x3a')){var _0x5b5ee8={};_0x5b5ee8[_0x35be05[_0x3966('0x29')]]={'$like':'%'+_0x30da9b['query'][_0x3966('0x38')]+'%'};return _0x5b5ee8;}})});}_0x51e41f=_[_0x3966('0x3b')]({},_0x51e41f,_0x30da9b['options']);var _0x2a1f6c={'where':_0x51e41f[_0x3966('0x39')]};return db[_0x3966('0x3c')][_0x3966('0x1f')](_0x2a1f6c)['then'](function(_0x51e468){_0x4c3b50[_0x3966('0x1f')]=_0x51e468;if(_0x30da9b[_0x3966('0x30')][_0x3966('0x3d')]){_0x51e41f[_0x3966('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x3966('0x3f')](_0x51e41f);})[_0x3966('0x26')](function(_0x25edd6){_0x4c3b50[_0x3966('0x40')]=_0x25edd6;return _0x4c3b50;})[_0x3966('0x26')](respondWithFilteredResult(_0x15e3b3,_0x51e41f))['catch'](handleError(_0x15e3b3,null));};exports['show']=function(_0x45e25f,_0x198070){var _0x53e773={'raw':!![],'where':{'id':_0x45e25f[_0x3966('0x41')]['id']}},_0x20c6d7={};_0x20c6d7[_0x3966('0x2e')]=_[_0x3966('0x2f')](db[_0x3966('0x3c')][_0x3966('0x42')]);_0x20c6d7[_0x3966('0x30')]=_['keys'](_0x45e25f['query']);_0x20c6d7[_0x3966('0x31')]=_[_0x3966('0x43')](_0x20c6d7[_0x3966('0x2e')],_0x20c6d7['query']);_0x53e773[_0x3966('0x32')]=_[_0x3966('0x43')](_0x20c6d7[_0x3966('0x2e')],qs[_0x3966('0x33')](_0x45e25f[_0x3966('0x30')][_0x3966('0x33')]));_0x53e773[_0x3966('0x32')]=_0x53e773[_0x3966('0x32')]['length']?_0x53e773[_0x3966('0x32')]:_0x20c6d7[_0x3966('0x2e')];if(_0x45e25f['query']['includeAll']){_0x53e773['include']=[{'all':!![]}];}_0x53e773=_[_0x3966('0x3b')]({},_0x53e773,_0x45e25f[_0x3966('0x44')]);return db[_0x3966('0x3c')][_0x3966('0x45')](_0x53e773)[_0x3966('0x26')](handleEntityNotFound(_0x198070,null))[_0x3966('0x26')](respondWithResult(_0x198070,null))[_0x3966('0x46')](handleError(_0x198070,null));};exports[_0x3966('0x47')]=function(_0x2122d4,_0x1105b9){return db['OpenchannelApplication']['create'](_0x2122d4[_0x3966('0x48')],{})[_0x3966('0x26')](respondWithResult(_0x1105b9,0xc9))['catch'](handleError(_0x1105b9,null));};exports[_0x3966('0x24')]=function(_0x2d04d2,_0x5ee2df){if(_0x2d04d2[_0x3966('0x48')]['id']){delete _0x2d04d2[_0x3966('0x48')]['id'];}return db[_0x3966('0x3c')][_0x3966('0x45')]({'where':{'id':_0x2d04d2[_0x3966('0x41')]['id']}})[_0x3966('0x26')](handleEntityNotFound(_0x5ee2df,null))[_0x3966('0x26')](saveUpdates(_0x2d04d2[_0x3966('0x48')],null))[_0x3966('0x26')](respondWithResult(_0x5ee2df,null))[_0x3966('0x46')](handleError(_0x5ee2df,null));};exports[_0x3966('0x25')]=function(_0x549977,_0x45db78){return db[_0x3966('0x3c')]['find']({'where':{'id':_0x549977[_0x3966('0x41')]['id']}})[_0x3966('0x26')](handleEntityNotFound(_0x45db78,null))['then'](removeEntity(_0x45db78,null))[_0x3966('0x46')](handleError(_0x45db78,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fd745f7..295d8b0 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 _0xf3bf=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x2f11af,_0x2a1b3a){var _0x4b90e2=function(_0x2e9367){while(--_0x2e9367){_0x2f11af['push'](_0x2f11af['shift']());}};_0x4b90e2(++_0x2a1b3a);}(_0xf3bf,0x1a1));var _0xff3b=function(_0x302e18,_0x147adb){_0x302e18=_0x302e18-0x0;var _0x88b25d=_0xf3bf[_0x302e18];return _0x88b25d;};'use strict';var _=require(_0xff3b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff3b('0x1'));var moment=require(_0xff3b('0x2'));var BPromise=require(_0xff3b('0x3'));var rp=require(_0xff3b('0x4'));var fs=require('fs');var path=require(_0xff3b('0x5'));var rimraf=require(_0xff3b('0x6'));var config=require(_0xff3b('0x7'));var attributes=require(_0xff3b('0x8'));module[_0xff3b('0x9')]=function(_0x455dd6,_0x4938ef){return _0x455dd6['define'](_0xff3b('0xa'),attributes,{'tableName':_0xff3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff3b('0xc'),'collate':_0xff3b('0xd')});}; \ No newline at end of file +var _0xfde3=['path','rimraf','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','../../config/logger','moment','bluebird','request-promise'];(function(_0x1c429b,_0xc14315){var _0x136d79=function(_0x4a1b42){while(--_0x4a1b42){_0x1c429b['push'](_0x1c429b['shift']());}};_0x136d79(++_0xc14315);}(_0xfde3,0xba));var _0x3fde=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfde3[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fde('0x0'))('api');var moment=require(_0x3fde('0x1'));var BPromise=require(_0x3fde('0x2'));var rp=require(_0x3fde('0x3'));var fs=require('fs');var path=require(_0x3fde('0x4'));var rimraf=require(_0x3fde('0x5'));var config=require(_0x3fde('0x6'));var attributes=require(_0x3fde('0x7'));module['exports']=function(_0x4c6459,_0x10f6e4){return _0x4c6459[_0x3fde('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x3fde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d6a86e3..eafbe83 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 _0x8f7f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','body','options','raw','where','limit','UpdateOpenchannelApplication','lodash','util','moment'];(function(_0x4e2b4f,_0x172b85){var _0x4d8d9b=function(_0x561b1d){while(--_0x561b1d){_0x4e2b4f['push'](_0x4e2b4f['shift']());}};_0x4d8d9b(++_0x172b85);}(_0x8f7f,0x141));var _0xf8f7=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x8f7f[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xf8f7('0x0'));var util=require(_0xf8f7('0x1'));var moment=require(_0xf8f7('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8f7('0x4'))['db'];var utils=require(_0xf8f7('0x5'));var logger=require(_0xf8f7('0x6'))(_0xf8f7('0x7'));var config=require(_0xf8f7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf8f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7e73c5,_0x35310e,_0x484ea7){return new BPromise(function(_0x366222,_0x255f14){return client[_0xf8f7('0xa')](_0x7e73c5,_0x484ea7)[_0xf8f7('0xb')](function(_0x292b7d){logger['info'](_0xf8f7('0xc'),_0x35310e,'request\x20sent');logger[_0xf8f7('0xd')](_0xf8f7('0xe'),_0x35310e,'request\x20sent',JSON[_0xf8f7('0xf')](_0x292b7d));if(_0x292b7d['error']){if(_0x292b7d[_0xf8f7('0x10')]['code']===0x1f4){logger[_0xf8f7('0x10')](_0xf8f7('0xc'),_0x35310e,_0x292b7d[_0xf8f7('0x10')]['message']);return _0x255f14(_0x292b7d['error'][_0xf8f7('0x11')]);}logger[_0xf8f7('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x35310e,_0x292b7d[_0xf8f7('0x10')]['message']);return _0x366222(_0x292b7d[_0xf8f7('0x10')][_0xf8f7('0x11')]);}else{logger[_0xf8f7('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x35310e,_0xf8f7('0x13'));_0x366222(_0x292b7d[_0xf8f7('0x14')][_0xf8f7('0x11')]);}})['catch'](function(_0x2e06d5){logger['error'](_0xf8f7('0xc'),_0x35310e,_0x2e06d5);_0x255f14(_0x2e06d5);});});}exports['UpdateOpenchannelApplication']=function(_0x1bf3e5){var _0x190a4a=this;return new Promise(function(_0x32a80a,_0x1d22c0){return db['OpenchannelApplication']['update'](_0x1bf3e5[_0xf8f7('0x15')],{'raw':_0x1bf3e5[_0xf8f7('0x16')]?_0x1bf3e5[_0xf8f7('0x16')][_0xf8f7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bf3e5[_0xf8f7('0x16')]?_0x1bf3e5['options'][_0xf8f7('0x18')]||null:null,'attributes':_0x1bf3e5[_0xf8f7('0x16')]?_0x1bf3e5[_0xf8f7('0x16')]['attributes']||null:null,'limit':_0x1bf3e5[_0xf8f7('0x16')]?_0x1bf3e5[_0xf8f7('0x16')][_0xf8f7('0x19')]||null:null})[_0xf8f7('0xb')](function(_0x298bcf){logger[_0xf8f7('0x12')](_0xf8f7('0x1a'),_0x1bf3e5);logger[_0xf8f7('0xd')](_0xf8f7('0x1a'),_0x1bf3e5,JSON['stringify'](_0x298bcf));_0x32a80a(_0x298bcf);})['catch'](function(_0x308863){logger['error'](_0xf8f7('0x1a'),_0x308863[_0xf8f7('0x11')],_0x1bf3e5);_0x1d22c0(_0x190a4a['error'](0x1f4,_0x308863[_0xf8f7('0x11')]));});});}; \ No newline at end of file +var _0xc187=['../../config/utils','rpc','jayson/promise','http','then','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x452d2a,_0x9c7acc){var _0x3686ca=function(_0x254d6d){while(--_0x254d6d){_0x452d2a['push'](_0x452d2a['shift']());}};_0x3686ca(++_0x9c7acc);}(_0xc187,0x11c));var _0x7c18=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xc187[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7c18('0x0'));var util=require(_0x7c18('0x1'));var moment=require(_0x7c18('0x2'));var BPromise=require(_0x7c18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c18('0x4'));var db=require(_0x7c18('0x5'))['db'];var utils=require(_0x7c18('0x6'));var logger=require('../../config/logger')(_0x7c18('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c18('0x8'));var client=jayson['client'][_0x7c18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534457,_0x3fbe41,_0x351a09){return new BPromise(function(_0x405a23,_0x374a9d){return client['request'](_0x534457,_0x351a09)[_0x7c18('0xa')](function(_0x238e18){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3fbe41,'request\x20sent');logger[_0x7c18('0xb')](_0x7c18('0xc'),_0x3fbe41,_0x7c18('0xd'),JSON[_0x7c18('0xe')](_0x238e18));if(_0x238e18['error']){if(_0x238e18[_0x7c18('0xf')][_0x7c18('0x10')]===0x1f4){logger[_0x7c18('0xf')](_0x7c18('0x11'),_0x3fbe41,_0x238e18[_0x7c18('0xf')][_0x7c18('0x12')]);return _0x374a9d(_0x238e18[_0x7c18('0xf')]['message']);}logger['error'](_0x7c18('0x11'),_0x3fbe41,_0x238e18[_0x7c18('0xf')]['message']);return _0x405a23(_0x238e18[_0x7c18('0xf')][_0x7c18('0x12')]);}else{logger[_0x7c18('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x3fbe41,'request\x20sent');_0x405a23(_0x238e18[_0x7c18('0x14')][_0x7c18('0x12')]);}})[_0x7c18('0x15')](function(_0x2380c4){logger[_0x7c18('0xf')](_0x7c18('0x11'),_0x3fbe41,_0x2380c4);_0x374a9d(_0x2380c4);});});}exports[_0x7c18('0x16')]=function(_0x2da6cf){var _0x1c7fc3=this;return new Promise(function(_0x44fc4b,_0x36006b){return db[_0x7c18('0x17')][_0x7c18('0x18')](_0x2da6cf[_0x7c18('0x19')],{'raw':_0x2da6cf[_0x7c18('0x1a')]?_0x2da6cf[_0x7c18('0x1a')][_0x7c18('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da6cf[_0x7c18('0x1a')]?_0x2da6cf[_0x7c18('0x1a')][_0x7c18('0x1c')]||null:null,'attributes':_0x2da6cf['options']?_0x2da6cf[_0x7c18('0x1a')]['attributes']||null:null,'limit':_0x2da6cf[_0x7c18('0x1a')]?_0x2da6cf[_0x7c18('0x1a')]['limit']||null:null})[_0x7c18('0xa')](function(_0x573654){logger[_0x7c18('0x13')](_0x7c18('0x16'),_0x2da6cf);logger[_0x7c18('0xb')](_0x7c18('0x16'),_0x2da6cf,JSON[_0x7c18('0xe')](_0x573654));_0x44fc4b(_0x573654);})['catch'](function(_0x54f4cf){logger[_0x7c18('0xf')](_0x7c18('0x16'),_0x54f4cf[_0x7c18('0x12')],_0x2da6cf);_0x36006b(_0x1c7fc3[_0x7c18('0xf')](0x1f4,_0x54f4cf['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 0a5d953..f356d1c 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 _0xa5aa=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x3a38d0,_0x5cf611){var _0x519f3d=function(_0x21e467){while(--_0x21e467){_0x3a38d0['push'](_0x3a38d0['shift']());}};_0x519f3d(++_0x5cf611);}(_0xa5aa,0xe1));var _0xaa5a=function(_0x7ed3d5,_0x48cc29){_0x7ed3d5=_0x7ed3d5-0x0;var _0xe701d6=_0xa5aa[_0x7ed3d5];return _0xe701d6;};'use strict';var multer=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var path=require('path');var timeout=require(_0xaa5a('0x2'));var express=require(_0xaa5a('0x3'));var router=express[_0xaa5a('0x4')]();var fs_extra=require(_0xaa5a('0x5'));var auth=require(_0xaa5a('0x6'));var interaction=require(_0xaa5a('0x7'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xaa5a('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa5a('0x9')]);router['get']('/describe',auth[_0xaa5a('0xa')](),controller[_0xaa5a('0xb')]);router[_0xaa5a('0x8')](_0xaa5a('0xc'),auth[_0xaa5a('0xa')](),controller[_0xaa5a('0xd')]);router[_0xaa5a('0x8')](_0xaa5a('0xe'),auth['isAuthenticated'](),controller[_0xaa5a('0xf')]);router[_0xaa5a('0x8')](_0xaa5a('0x10'),auth[_0xaa5a('0xa')](),controller[_0xaa5a('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa5a('0x12')]);router[_0xaa5a('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaa5a('0x14')]);router[_0xaa5a('0x13')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xaa5a('0x15')]('openchannel',_0xaa5a('0x16')),controller['addTags']);router[_0xaa5a('0x17')]('/:id',auth[_0xaa5a('0xa')](),interaction['tracked']('openchannel',_0xaa5a('0x18')),controller[_0xaa5a('0x19')]);router[_0xaa5a('0x1a')](_0xaa5a('0xc'),auth['isAuthenticated'](),interaction[_0xaa5a('0x15')]('openchannel',_0xaa5a('0x1b')),controller[_0xaa5a('0x1c')]);router[_0xaa5a('0x1a')](_0xaa5a('0x1d'),auth[_0xaa5a('0xa')](),controller[_0xaa5a('0x1e')]);module[_0xaa5a('0x1f')]=router; \ No newline at end of file +var _0xa34b=['fs-extra','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','get','describe','/:id','show','/:id/messages','download','post','/:id/tags','tracked','addTags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa34b,0xdb));var _0xba34=function(_0x1e0f26,_0x5c07eb){_0x1e0f26=_0x1e0f26-0x0;var _0x457cc5=_0xa34b[_0x1e0f26];return _0x457cc5;};'use strict';var multer=require(_0xba34('0x0'));var util=require(_0xba34('0x1'));var path=require('path');var timeout=require(_0xba34('0x2'));var express=require(_0xba34('0x3'));var router=express[_0xba34('0x4')]();var fs_extra=require(_0xba34('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xba34('0x6'));var config=require('../../config/environment');var controller=require(_0xba34('0x7'));router['get']('/',auth[_0xba34('0x8')](),controller['index']);router[_0xba34('0x9')]('/describe',auth[_0xba34('0x8')](),controller[_0xba34('0xa')]);router['get'](_0xba34('0xb'),auth[_0xba34('0x8')](),controller[_0xba34('0xc')]);router['get'](_0xba34('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xba34('0xe')]);router[_0xba34('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xba34('0xf')](_0xba34('0xd'),auth[_0xba34('0x8')](),controller['addMessage']);router['post'](_0xba34('0x10'),auth[_0xba34('0x8')](),interaction[_0xba34('0x11')]('openchannel','openchannelinteraction:addtags'),controller[_0xba34('0x12')]);router[_0xba34('0x13')]('/:id',auth[_0xba34('0x8')](),interaction[_0xba34('0x11')](_0xba34('0x14'),_0xba34('0x15')),controller[_0xba34('0x16')]);router[_0xba34('0x17')](_0xba34('0xb'),auth[_0xba34('0x8')](),interaction[_0xba34('0x11')](_0xba34('0x14'),_0xba34('0x18')),controller[_0xba34('0x19')]);router[_0xba34('0x17')](_0xba34('0x10'),auth['isAuthenticated'](),controller[_0xba34('0x1a')]);module[_0xba34('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ae1cbd0..d2fd182 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 _0x9c48=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x6f2485,_0x5336aa){var _0x3a2fd6=function(_0x1e7a77){while(--_0x1e7a77){_0x6f2485['push'](_0x6f2485['shift']());}};_0x3a2fd6(++_0x5336aa);}(_0x9c48,0xb1));var _0x89c4=function(_0x106fb1,_0x476554){_0x106fb1=_0x106fb1-0x0;var _0x6680dc=_0x9c48[_0x106fb1];return _0x6680dc;};'use strict';var Sequelize=require(_0x89c4('0x0'));module['exports']={'closed':{'type':Sequelize[_0x89c4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x89c4('0x2')]},'disposition':{'type':Sequelize[_0x89c4('0x3')]},'secondDisposition':{'type':Sequelize[_0x89c4('0x3')]},'thirdDisposition':{'type':Sequelize[_0x89c4('0x3')]},'note':{'type':Sequelize[_0x89c4('0x3')]},'read1stAt':{'type':Sequelize[_0x89c4('0x2')]},'threadId':{'type':Sequelize[_0x89c4('0x3')]},'externalUrl':{'type':Sequelize[_0x89c4('0x3')]},'lastMsgAt':{'type':Sequelize[_0x89c4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x89c4('0x4')]('in',_0x89c4('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x89c4('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x89c4('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b68=['DATE','STRING','ENUM','sequelize','exports','BOOLEAN'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x4b68,0x129));var _0x84b6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4b68[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x84b6('0x0'));module[_0x84b6('0x1')]={'closed':{'type':Sequelize[_0x84b6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x84b6('0x3')]},'disposition':{'type':Sequelize[_0x84b6('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x84b6('0x4')]},'note':{'type':Sequelize[_0x84b6('0x4')]},'read1stAt':{'type':Sequelize[_0x84b6('0x3')]},'threadId':{'type':Sequelize[_0x84b6('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x84b6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x84b6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x84b6('0x4')]},'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 8d66d75..d2cd46f 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 _0xc9d8=['i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','getOpenchannelAccounts','agent','sequelize','toString','keyBy','merge','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.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','filter','$gte','format','include','findAll','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','out','System','firstName','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','color','u.id','u.fullname','from','user_has_openchannel_interactions','users','openchannel_interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','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?','group'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xc9d8,0x65));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8c9d('0x0'));var rimraf=require(_0x8c9d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c9d('0x2'));var rp=require(_0x8c9d('0x3'));var moment=require(_0x8c9d('0x4'));var BPromise=require(_0x8c9d('0x5'));var Mustache=require(_0x8c9d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8c9d('0x7'));var csv=require(_0x8c9d('0x8'));var ejs=require(_0x8c9d('0x9'));var fs=require('fs');var fs_extra=require(_0x8c9d('0xa'));var _=require(_0x8c9d('0xb'));var squel=require(_0x8c9d('0xc'));var crypto=require(_0x8c9d('0xd'));var jsforce=require(_0x8c9d('0xe'));var deskjs=require(_0x8c9d('0xf'));var toCsv=require(_0x8c9d('0x8'));var querystring=require(_0x8c9d('0x10'));var Papa=require(_0x8c9d('0x11'));var Redis=require(_0x8c9d('0x12'));var authService=require(_0x8c9d('0x13'));var qs=require(_0x8c9d('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x8c9d('0x15'));var hardwareService=require(_0x8c9d('0x16'));var logger=require('../../config/logger')(_0x8c9d('0x17'));var utils=require(_0x8c9d('0x18'));var config=require(_0x8c9d('0x19'));var licenseUtil=require(_0x8c9d('0x1a'));var db=require(_0x8c9d('0x1b'))['db'];config['redis']=_[_0x8c9d('0x1c')](config[_0x8c9d('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c9d('0x1e'))(new Redis(config['redis']));require(_0x8c9d('0x1f'))[_0x8c9d('0x20')](socket);function respondWithStatusCode(_0xa583cc,_0x3e5443){_0x3e5443=_0x3e5443||0xcc;return function(_0x3cc681){if(_0x3cc681){return _0xa583cc[_0x8c9d('0x21')](_0x3e5443);}return _0xa583cc[_0x8c9d('0x22')](_0x3e5443)[_0x8c9d('0x23')]();};}function respondWithResult(_0x2574a3,_0x2169c5){_0x2169c5=_0x2169c5||0xc8;return function(_0x5e0431){if(_0x5e0431){return _0x2574a3[_0x8c9d('0x22')](_0x2169c5)[_0x8c9d('0x24')](_0x5e0431);}};}function respondWithFilteredResult(_0xb1f5b3,_0x2f97b9){return function(_0x5518b6){if(_0x5518b6){var _0x4cb2c5=typeof _0x2f97b9['offset']===_0x8c9d('0x25')&&typeof _0x2f97b9[_0x8c9d('0x26')]===_0x8c9d('0x25');var _0x4a238d=_0x5518b6[_0x8c9d('0x27')];var _0x1453d5=_0x4cb2c5?0x0:_0x2f97b9[_0x8c9d('0x28')];var _0x4436c6=_0x4cb2c5?_0x5518b6[_0x8c9d('0x27')]:_0x2f97b9[_0x8c9d('0x28')]+_0x2f97b9[_0x8c9d('0x26')];var _0x2ef61e;if(_0x4436c6>=_0x4a238d){_0x4436c6=_0x4a238d;_0x2ef61e=0xc8;}else{_0x2ef61e=0xce;}_0xb1f5b3[_0x8c9d('0x22')](_0x2ef61e);return _0xb1f5b3[_0x8c9d('0x29')](_0x8c9d('0x2a'),_0x1453d5+'-'+_0x4436c6+'/'+_0x4a238d)[_0x8c9d('0x24')](_0x5518b6);}return null;};}function patchUpdates(_0x38cf04){return function(_0x4eb6ef){try{jsonpatch['apply'](_0x4eb6ef,_0x38cf04,!![]);}catch(_0x29afec){return BPromise[_0x8c9d('0x2b')](_0x29afec);}return _0x4eb6ef[_0x8c9d('0x2c')]();};}function saveUpdates(_0x1cc5aa,_0x1a7d63){return function(_0x386654){if(_0x386654){return _0x386654[_0x8c9d('0x2d')](_0x1cc5aa)[_0x8c9d('0x2e')](function(_0x438a89){return _0x438a89;});}return null;};}function removeEntity(_0x589195,_0x3a9264){return function(_0x34dbd0){if(_0x34dbd0){return _0x34dbd0['destroy']()[_0x8c9d('0x2e')](function(){_0x589195['status'](0xcc)[_0x8c9d('0x23')]();});}};}function handleEntityNotFound(_0x471622,_0x314c0b){return function(_0x503d31){if(!_0x503d31){_0x471622[_0x8c9d('0x21')](0x194);}return _0x503d31;};}function handleError(_0x579570,_0x368e74){_0x368e74=_0x368e74||0x1f4;return function(_0xf30fc9){logger[_0x8c9d('0x2f')](_0xf30fc9[_0x8c9d('0x30')]);if(_0xf30fc9['name']){delete _0xf30fc9[_0x8c9d('0x31')];}_0x579570[_0x8c9d('0x22')](_0x368e74)[_0x8c9d('0x32')](_0xf30fc9);};}function getInteractionUsers(_0x58addd,_0x1a91a8){return new BPromise(function(_0x578204,_0x455e65){try{if(_0x1a91a8[_0x58addd['id']]){_0x58addd[_0x8c9d('0x33')]=_['map'](_0x1a91a8[_0x58addd['id']],function(_0x3398ee){return{'id':_0x3398ee['id'],'fullname':_0x3398ee[_0x8c9d('0x34')]};});}}catch(_0x4bf62a){_0x455e65(_0x4bf62a);}_0x578204(_0x58addd);});}function getInteractionTags(_0x495f4a,_0x5b42fb){return new BPromise(function(_0x55a51b,_0x2aba92){try{if(_0x495f4a[_0x8c9d('0x35')]){_0x495f4a[_0x8c9d('0x36')]=[];_0x495f4a[_0x8c9d('0x35')][_0x8c9d('0x37')](',')[_0x8c9d('0x38')](function(_0x7cd3d2){_0x495f4a[_0x8c9d('0x36')][_0x8c9d('0x39')](_0x5b42fb[_0x7cd3d2]);});}delete _0x495f4a['TagIds'];}catch(_0x442533){_0x2aba92(_0x442533);}_0x55a51b(_0x495f4a);});}function updateOpenchannelInteraction(_0x3a1ce3,_0xa574ca,_0x2d5819){return new BPromise(function(_0xf340d2,_0x53d87a){return getInteractionUsers(_0x3a1ce3,_0x2d5819)['then'](function(_0x4d4654){return getInteractionTags(_0x4d4654,_0xa574ca);})[_0x8c9d('0x2e')](function(_0x26c805){_0xf340d2(_0x26c805);})[_0x8c9d('0x3a')](function(_0x4e8c6e){_0x53d87a(_0x4e8c6e);});});}exports['index']=function(_0x1921b7,_0xc3df59){var _0x403d24={},_0x22af2d={},_0xaacfab={'count':0x0,'rows':[]};var _0x2cd4ba=_[_0x8c9d('0x3b')](db[_0x8c9d('0x3c')][_0x8c9d('0x3d')],function(_0x1cd0d8){return{'name':_0x1cd0d8[_0x8c9d('0x3e')],'type':_0x1cd0d8['type'][_0x8c9d('0x3f')]};});_0x22af2d[_0x8c9d('0x40')]=_[_0x8c9d('0x3b')](_0x2cd4ba,_0x8c9d('0x31'));_0x22af2d[_0x8c9d('0x41')]=_[_0x8c9d('0x42')](_0x1921b7['query']);_0x22af2d[_0x8c9d('0x43')]=_[_0x8c9d('0x44')](_0x22af2d[_0x8c9d('0x40')],_0x22af2d['query']);_0x403d24[_0x8c9d('0x45')]=_[_0x8c9d('0x44')](_0x22af2d['model'],qs['fields'](_0x1921b7['query'][_0x8c9d('0x46')]));_0x403d24[_0x8c9d('0x45')]=_0x403d24[_0x8c9d('0x45')][_0x8c9d('0x47')]?_0x403d24['attributes']:_0x22af2d[_0x8c9d('0x40')];if(!_0x1921b7[_0x8c9d('0x41')]['hasOwnProperty'](_0x8c9d('0x48'))){_0x403d24[_0x8c9d('0x26')]=qs[_0x8c9d('0x26')](_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x26')]);_0x403d24[_0x8c9d('0x28')]=qs[_0x8c9d('0x28')](_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x28')]);}_0x403d24[_0x8c9d('0x49')]=qs['sort'](_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x4a')]);_0x403d24[_0x8c9d('0x4b')]=qs[_0x8c9d('0x43')](_['pick'](_0x1921b7[_0x8c9d('0x41')],_0x22af2d[_0x8c9d('0x43')]),_0x2cd4ba);var _0x32f1a4=[];var _0x5989af=squel[_0x8c9d('0x4c')]()[_0x8c9d('0x4d')]('id')[_0x8c9d('0x4d')](_0x8c9d('0x31'))['field'](_0x8c9d('0x4e'))['from']('tools_tags');var _0x27a6a0=squel[_0x8c9d('0x4c')]()['field'](_0x8c9d('0x4f'))[_0x8c9d('0x4d')](_0x8c9d('0x50'))[_0x8c9d('0x4d')]('ui.OpenchannelInteractionId')[_0x8c9d('0x51')](_0x8c9d('0x52'),'ui')['left_join'](_0x8c9d('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x38cf38=squel[_0x8c9d('0x4c')]()[_0x8c9d('0x51')](_0x8c9d('0x54'),'i')['left_join'](_0x8c9d('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8c9d('0x56')](_0x8c9d('0x53'),'o',_0x8c9d('0x57'))[_0x8c9d('0x56')](_0x8c9d('0x58'),'a',_0x8c9d('0x59'))[_0x8c9d('0x56')](_0x8c9d('0x5a'),'me',_0x8c9d('0x5b'))[_0x8c9d('0x56')]('openchannel_interaction_has_tags','it',_0x8c9d('0x5c'))[_0x8c9d('0x56')](_0x8c9d('0x5d'),'t',_0x8c9d('0x5e'));var _0x18a432=squel[_0x8c9d('0x5f')]();var _0x5c4612=[];var _0x4d1265=squel[_0x8c9d('0x5f')]();var _0x5d9bd5;if(_0x1921b7[_0x8c9d('0x41')]['search']){_0x5d9bd5=as[_0x8c9d('0x60')](_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x61')]);var _0x1bb7d6=_0x5d9bd5[_0x8c9d('0x62')];for(var _0x7cdead=0x0;_0x7cdead<_0x5d9bd5[_0x8c9d('0x63')]['length'];_0x7cdead++){var _0x1a578c=_0x5d9bd5[_0x8c9d('0x63')][_0x7cdead];var _0x1dfc11='i';var _0x86e8ed=_[_0x8c9d('0x64')](_0x2cd4ba,['name',_0x1a578c[_0x8c9d('0x4d')]]);if(!_0x86e8ed){switch(_0x1a578c[_0x8c9d('0x4d')]){case _0x8c9d('0x65'):if(_0x1a578c[_0x8c9d('0x66')]==0x1){_0x38cf38[_0x8c9d('0x67')]('`'+_0x1a578c['field']+'`\x20=\x200');}else{_0x38cf38[_0x8c9d('0x67')]('`'+_0x1a578c[_0x8c9d('0x4d')]+_0x8c9d('0x68'));}break;case _0x8c9d('0x69'):if(_0x1a578c['operator']==='$substring'){if(_0x1a578c['value']['split']('\x20')[_0x8c9d('0x47')]>0x1){_0x18a432[_0x1bb7d6](_0x8c9d('0x6a'),qs[_0x8c9d('0x6b')](_0x1a578c[_0x8c9d('0x66')]),null);}else{var _0x1e2fba='%'+_0x1a578c['value']+'%';_0x18a432[_0x1bb7d6](_0x8c9d('0x6c'),_0x1e2fba,_0x1e2fba,_0x1e2fba);}}else{_0x86e8ed=_[_0x8c9d('0x64')](_0x2cd4ba,[_0x8c9d('0x31'),'ContactId']);_0x1a578c[_0x8c9d('0x4d')]=_0x8c9d('0x6d');_0x87b478=as[_0x8c9d('0x6e')](_0x1dfc11,_0x86e8ed[_0x8c9d('0x6f')],_0x1a578c);_0x18a432[_0x1bb7d6](_0x87b478[_0x8c9d('0x70')],_0x87b478[_0x8c9d('0x66')][_0x8c9d('0x71')],_0x87b478[_0x8c9d('0x66')]['end']);}break;case _0x8c9d('0x72'):var _0x1db63f=_0x1a578c[_0x8c9d('0x66')][_0x8c9d('0x37')](',')[_0x8c9d('0x3b')](function(_0x51900e){return Number(_0x51900e);});_0x1db63f['forEach'](function(_0x26c94e){_0x4d1265['or'](_0x8c9d('0x73'),'%,'+_0x26c94e+',%');});_0x5c4612=_[_0x8c9d('0x74')](_0x5c4612,_0x1db63f);break;case _0x8c9d('0x75'):if(_0x1a578c[_0x8c9d('0x76')]===_0x8c9d('0x77')){_0x18a432[_0x1bb7d6](_0x8c9d('0x78'),'%'+_0x1a578c['value']+'%',null);}else{_0x86e8ed=_[_0x8c9d('0x64')](_0x2cd4ba,[_0x8c9d('0x31'),_0x8c9d('0x79')]);_0x1a578c[_0x8c9d('0x4d')]='UserId';_0x87b478=as['buildExpression'](_0x1dfc11,_0x86e8ed[_0x8c9d('0x6f')],_0x1a578c);_0x18a432[_0x1bb7d6](_0x87b478[_0x8c9d('0x70')],_0x87b478[_0x8c9d('0x66')]['start'],_0x87b478[_0x8c9d('0x66')][_0x8c9d('0x23')]);}break;case _0x8c9d('0x7a'):_0x87b478=as[_0x8c9d('0x6e')]('me',null,_0x1a578c);_0x18a432[_0x1bb7d6](_0x87b478[_0x8c9d('0x70')],_0x87b478[_0x8c9d('0x66')][_0x8c9d('0x71')],_0x87b478[_0x8c9d('0x66')][_0x8c9d('0x23')]);break;}}else{var _0x87b478=as[_0x8c9d('0x6e')](_0x1dfc11,_0x86e8ed['type'],_0x1a578c);_0x18a432[_0x1bb7d6](_0x87b478[_0x8c9d('0x70')],_0x87b478[_0x8c9d('0x66')]['start'],_0x87b478[_0x8c9d('0x66')][_0x8c9d('0x23')]);}}}else{var _0x917166=_(_0x1921b7['query'])[_0x8c9d('0x42')]()[_0x8c9d('0x3b')](function(_0xe07933){return _[_0x8c9d('0x7b')](_0x2cd4ba,['name',_0xe07933])?_0xe07933:undefined;})[_0x8c9d('0x7c')]()[_0x8c9d('0x66')]();if(!_['isEmpty'](_0x917166)){_0x917166[_0x8c9d('0x38')](function(_0x4756ac){if(_0x4756ac===_0x8c9d('0x7d')){_0x38cf38['where'](_0x8c9d('0x7e'),[]['concat'](_0x1921b7['query'][_0x4756ac]));}else if(_0x4756ac==='createdAt'){var _0x192756=JSON[_0x8c9d('0x7f')](_0x1921b7['query'][_0x4756ac])['$gte'];var _0x293606=JSON[_0x8c9d('0x7f')](_0x1921b7[_0x8c9d('0x41')][_0x4756ac])[_0x8c9d('0x80')];_0x38cf38[_0x8c9d('0x4b')](_0x8c9d('0x81'),_0x192756,_0x293606);}else{if(_0x1921b7[_0x8c9d('0x41')][_0x4756ac]===_0x8c9d('0x82')){_0x38cf38[_0x8c9d('0x4b')]('i.'+_0x4756ac+'\x20IS\x20NULL');}else{_0x38cf38['where']('i.'+_0x4756ac+'\x20=\x20?',_0x1921b7['query'][_0x4756ac]);}}});}if(_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x83')]){if(_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x83')]==0x1){_0x38cf38[_0x8c9d('0x67')](_0x8c9d('0x84'));}else{_0x38cf38[_0x8c9d('0x67')](_0x8c9d('0x85'));}}if(_0x1921b7['query'][_0x8c9d('0x86')]){_0x5c4612=_[_0x8c9d('0x87')](_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x86')])?_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x86')]:new Array(_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x86')]);_0x5c4612[_0x8c9d('0x38')](function(_0x5b19e6){_0x4d1265['or'](_0x8c9d('0x73'),'%,'+_0x5b19e6+',%');});}if(_0x1921b7[_0x8c9d('0x41')]['filter']){var _0x5ad7de=_0x1921b7[_0x8c9d('0x41')]['filter'][_0x8c9d('0x88')]('\x5c','\x5c\x5c')[_0x8c9d('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5ad7de)){_0x18a432['or'](_0x8c9d('0x89'),_0x5ad7de+'%');}else{_0x18a432['or'](_0x8c9d('0x8a'),qs[_0x8c9d('0x6b')](_0x5ad7de))['or'](_0x8c9d('0x8b'),_0x5ad7de+'%')['or'](_0x8c9d('0x8c'),_0x5ad7de+'%');}}}_0x38cf38[_0x8c9d('0x4b')](_0x18a432);_0x38cf38[_0x8c9d('0x8d')](_0x8c9d('0x8e'));var _0x35a90b={'type':db[_0x8c9d('0x8f')][_0x8c9d('0x90')][_0x8c9d('0x91')],'raw':!![]};var _0x37c766=_0x38cf38[_0x8c9d('0x92')]();_0x37c766[_0x8c9d('0x4d')](_0x8c9d('0x8e'));_0x37c766[_0x8c9d('0x4d')](_0x8c9d('0x93'),_0x8c9d('0x65'));if(_0x403d24[_0x8c9d('0x49')]){_0x403d24['order'][_0x8c9d('0x38')](function(_0x5b3e34){var _0x2c4451=_0x5b3e34[0x0]===_0x8c9d('0x94')?_0x5b3e34[0x0]:'i.'+_0x5b3e34[0x0];_0x38cf38[_0x8c9d('0x49')](_0x2c4451,_0x5b3e34[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8c9d('0x95')](_0x5c4612)){_0x38cf38[_0x8c9d('0x67')](_0x4d1265);_0x37c766[_0x8c9d('0x4b')]('t.id\x20IN\x20?',_0x5c4612);}BPromise[_0x8c9d('0x96')]()['then'](function(){if(!_0x5d9bd5){if(_0x1921b7['query'][_0x8c9d('0x7d')])return;_0x37c766['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x38cf38['where'](_0x8c9d('0x97'));return;}if(_0x1921b7['user'][_0x8c9d('0x98')]!=='agent')return;return _0x1921b7[_0x8c9d('0x99')][_0x8c9d('0x9a')]({'attributes':['id'],'raw':!![]})[_0x8c9d('0x2e')](function(_0x1dcac9){if(_[_0x8c9d('0x95')](_0x1dcac9)){_0x37c766[_0x8c9d('0x4b')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x38cf38[_0x8c9d('0x4b')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x37c766[_0x8c9d('0x4b')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x8c9d('0x3b')](_0x1dcac9,'id'));_0x38cf38['where'](_0x8c9d('0x7e'),_['map'](_0x1dcac9,'id'));}});})[_0x8c9d('0x2e')](function(){if(_0x1921b7[_0x8c9d('0x99')][_0x8c9d('0x98')]===_0x8c9d('0x9b')&&!_0x5d9bd5&&!_0x1921b7['query'][_0x8c9d('0x7d')])return[];return db[_0x8c9d('0x9c')][_0x8c9d('0x41')](_0x37c766[_0x8c9d('0x9d')](),_0x35a90b);})['then'](function(_0x30d305){_0xaacfab[_0x8c9d('0x27')]=_0x30d305[_0x8c9d('0x47')];if(_0xaacfab[_0x8c9d('0x27')]===0x0)return[];return db[_0x8c9d('0x9c')][_0x8c9d('0x41')](_0x5989af['toString'](),_0x35a90b)['then'](function(_0x34111d){_0x32f1a4=_[_0x8c9d('0x9e')](_0x34111d,'id');_0x35a90b=_[_0x8c9d('0x9f')](_0x35a90b,{'model':db[_0x8c9d('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1921b7[_0x8c9d('0x41')][_0x8c9d('0x46')]){_0x403d24[_0x8c9d('0x45')][_0x8c9d('0x38')](function(_0x455490){_0x38cf38[_0x8c9d('0x4d')]('i.'+_0x455490);});}else{_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0x93'),_0x8c9d('0x65'));_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xa0'),_0x8c9d('0xa1'));_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xa2'),_0x8c9d('0xa3'));_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xa4'),_0x8c9d('0x94'));_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xa5'));_0x38cf38[_0x8c9d('0x4d')]('c.firstName',_0x8c9d('0xa6'));_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xa7'),_0x8c9d('0xa8'));_0x38cf38[_0x8c9d('0x4d')]('c.email',_0x8c9d('0xa9'));_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xaa'),_0x8c9d('0xab'));_0x38cf38[_0x8c9d('0x4d')]('c.mobile',_0x8c9d('0xac'));_0x38cf38[_0x8c9d('0x4d')]('c.fax',_0x8c9d('0xad'));_0x38cf38[_0x8c9d('0x4d')]('o.fullname',_0x8c9d('0xae'));_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xaf'),'Owner.internal');_0x38cf38[_0x8c9d('0x4d')](_0x8c9d('0xb0'),'TagIds');}if(_0x403d24[_0x8c9d('0x26')])_0x38cf38[_0x8c9d('0x26')](_0x403d24[_0x8c9d('0x26')]);if(_0x403d24['offset'])_0x38cf38[_0x8c9d('0x28')](_0x403d24[_0x8c9d('0x28')]);return db['sequelize'][_0x8c9d('0x41')](_0x38cf38[_0x8c9d('0x9d')](),_0x35a90b);})[_0x8c9d('0x2e')](function(_0x1b28ca){if(_0x1b28ca[_0x8c9d('0x47')]>0x0)_0x27a6a0['where'](_0x8c9d('0xb1'),_[_0x8c9d('0x3b')](_0x1b28ca,'id'));return db[_0x8c9d('0x9c')]['query'](_0x27a6a0['toString'](),_0x35a90b)[_0x8c9d('0x2e')](function(_0xcfbad3){var _0x35088a=_[_0x8c9d('0xb2')](_0xcfbad3,_0x8c9d('0xb3'));var _0x54bc3f=[];_0x1b28ca[_0x8c9d('0x38')](function(_0x37ff26){_0x54bc3f[_0x8c9d('0x39')](updateOpenchannelInteraction(_0x37ff26,_0x32f1a4,_0x35088a));});return BPromise[_0x8c9d('0xb4')](_0x54bc3f);});});})[_0x8c9d('0x2e')](function(_0x3a5577){_0xaacfab[_0x8c9d('0xb5')]=_0x3a5577;return _0xaacfab;})['then'](respondWithFilteredResult(_0xc3df59,_0x403d24))[_0x8c9d('0x3a')](handleError(_0xc3df59,null));};exports[_0x8c9d('0xb6')]=function(_0x4ba7f0,_0x525e45){var _0x37a930={};if(_0x4ba7f0[_0x8c9d('0x41')]['type']&&_0x4ba7f0[_0x8c9d('0x41')][_0x8c9d('0x6f')]===_0x8c9d('0x51')){_0x37a930[_0x8c9d('0x51')]=_0x4ba7f0['params']['id'];}else{_0x37a930['id']=_0x4ba7f0[_0x8c9d('0xb7')]['id'];}var _0x2639ca={'raw':![],'where':_0x37a930},_0xe7e3ce={};_0xe7e3ce['model']=_[_0x8c9d('0x42')](db[_0x8c9d('0x3c')]['rawAttributes']);_0xe7e3ce['query']=_[_0x8c9d('0x42')](_0x4ba7f0[_0x8c9d('0x41')]);_0xe7e3ce[_0x8c9d('0x43')]=_[_0x8c9d('0x44')](_0xe7e3ce[_0x8c9d('0x40')],_0xe7e3ce[_0x8c9d('0x41')]);_0x2639ca['attributes']=_['intersection'](_0xe7e3ce[_0x8c9d('0x40')],qs[_0x8c9d('0x46')](_0x4ba7f0[_0x8c9d('0x41')][_0x8c9d('0x46')]));_0x2639ca['attributes']=_0x2639ca['attributes']['length']?_0x2639ca[_0x8c9d('0x45')]:_0xe7e3ce[_0x8c9d('0x40')];if(_0x4ba7f0['query'][_0x8c9d('0xb8')]){_0x2639ca['include']=[{'all':!![]}];}_0x2639ca=_[_0x8c9d('0x9f')]({},_0x2639ca,_0x4ba7f0[_0x8c9d('0xb9')]);return db[_0x8c9d('0x3c')]['find'](_0x2639ca)[_0x8c9d('0x2e')](handleEntityNotFound(_0x525e45,null))[_0x8c9d('0x2e')](respondWithResult(_0x525e45,null))[_0x8c9d('0x3a')](handleError(_0x525e45,null));};exports[_0x8c9d('0xba')]=function(_0x482c5,_0x1ce575){return db[_0x8c9d('0x3c')][_0x8c9d('0xba')](_0x482c5[_0x8c9d('0x7a')],{})[_0x8c9d('0x2e')](respondWithResult(_0x1ce575,0xc9))[_0x8c9d('0x3a')](handleError(_0x1ce575,null));};exports['update']=function(_0x88200e,_0x10edbe){if(_0x88200e[_0x8c9d('0x7a')]['id']){delete _0x88200e['body']['id'];}return db[_0x8c9d('0x3c')][_0x8c9d('0x64')]({'where':{'id':_0x88200e[_0x8c9d('0xb7')]['id']}})[_0x8c9d('0x2e')](handleEntityNotFound(_0x10edbe,null))[_0x8c9d('0x2e')](saveUpdates(_0x88200e[_0x8c9d('0x7a')],null))[_0x8c9d('0x2e')](respondWithResult(_0x10edbe,null))[_0x8c9d('0x3a')](handleError(_0x10edbe,null));};exports[_0x8c9d('0xbb')]=function(_0x3b429d,_0x4c0c50){return db['OpenchannelInteraction'][_0x8c9d('0x64')]({'where':{'id':_0x3b429d[_0x8c9d('0xb7')]['id']}})[_0x8c9d('0x2e')](handleEntityNotFound(_0x4c0c50,null))[_0x8c9d('0x2e')](removeEntity(_0x4c0c50,null))[_0x8c9d('0x3a')](handleError(_0x4c0c50,null));};exports[_0x8c9d('0xbc')]=function(_0x35a587,_0xe7b5c9){return db[_0x8c9d('0x3c')][_0x8c9d('0xbc')]()[_0x8c9d('0x2e')](respondWithResult(_0xe7b5c9,null))[_0x8c9d('0x3a')](handleError(_0xe7b5c9,null));};exports[_0x8c9d('0xbd')]=function(_0x55f4f9,_0x49956b,_0xa152e9){return db[_0x8c9d('0xbe')]['find']({'where':{'id':_0x55f4f9[_0x8c9d('0xb7')]['id']}})[_0x8c9d('0x2e')](handleEntityNotFound(_0x49956b,null))[_0x8c9d('0x2e')](function(_0xdcf62b){if(_0xdcf62b){return _0xdcf62b[_0x8c9d('0xbd')](_0x55f4f9[_0x8c9d('0x7a')][_0x8c9d('0xbf')],_[_0x8c9d('0xc0')](_0x55f4f9['body'],[_0x8c9d('0xbf'),'id'])||{});}})[_0x8c9d('0x2e')](respondWithResult(_0x49956b,null))['catch'](handleError(_0x49956b,null));};exports[_0x8c9d('0xc1')]=function(_0x3ac92f,_0x4a5b85,_0x4bb548){var _0x4aa648={'raw':![],'where':{}};var _0x1611c9={};var _0x5115ef={'count':0x0,'rows':[]};return db[_0x8c9d('0x3c')][_0x8c9d('0xc2')]({'where':{'id':_0x3ac92f['params']['id']}})[_0x8c9d('0x2e')](handleEntityNotFound(_0x4a5b85,null))[_0x8c9d('0x2e')](function(_0x2ffe49){if(_0x2ffe49){_0x1611c9[_0x8c9d('0x40')]=_['keys'](db[_0x8c9d('0xbe')][_0x8c9d('0x3d')]);_0x1611c9[_0x8c9d('0x41')]=_[_0x8c9d('0x42')](_0x3ac92f[_0x8c9d('0x41')]);_0x1611c9[_0x8c9d('0x43')]=_['intersection'](_0x1611c9[_0x8c9d('0x40')],_0x1611c9[_0x8c9d('0x41')]);_0x4aa648[_0x8c9d('0x45')]=_['intersection'](_0x1611c9['model'],qs[_0x8c9d('0x46')](_0x3ac92f[_0x8c9d('0x41')]['fields']));_0x4aa648[_0x8c9d('0x45')]=_0x4aa648[_0x8c9d('0x45')][_0x8c9d('0x47')]?_0x4aa648[_0x8c9d('0x45')]:_0x1611c9['model'];if(!_0x3ac92f[_0x8c9d('0x41')]['hasOwnProperty'](_0x8c9d('0x48'))){_0x4aa648['limit']=qs[_0x8c9d('0x26')](_0x3ac92f[_0x8c9d('0x41')]['limit']);_0x4aa648['offset']=qs[_0x8c9d('0x28')](_0x3ac92f[_0x8c9d('0x41')][_0x8c9d('0x28')]);}_0x4aa648[_0x8c9d('0x49')]=qs[_0x8c9d('0x4a')](_0x3ac92f[_0x8c9d('0x41')][_0x8c9d('0x4a')]);_0x4aa648[_0x8c9d('0x4b')]=qs[_0x8c9d('0x43')](_[_0x8c9d('0xc3')](_0x3ac92f[_0x8c9d('0x41')],_0x1611c9['filters']));_0x4aa648[_0x8c9d('0x4b')][_0x8c9d('0xb3')]=_0x2ffe49['id'];if(_0x3ac92f[_0x8c9d('0x41')][_0x8c9d('0xc4')]){_0x4aa648[_0x8c9d('0x4b')]=_[_0x8c9d('0x9f')](_0x4aa648[_0x8c9d('0x4b')],{'$or':_[_0x8c9d('0x3b')](_0x4aa648[_0x8c9d('0x45')],function(_0x7ef5cf){var _0x363e5b={};_0x363e5b[_0x7ef5cf]={'$like':'%'+_0x3ac92f[_0x8c9d('0x41')][_0x8c9d('0xc4')]+'%'};return _0x363e5b;})});}if(_0x3ac92f[_0x8c9d('0x41')][_0x8c9d('0xc5')]){var _0x1ec5d4=_0x3ac92f[_0x8c9d('0x41')][_0x8c9d('0xc5')][_0x8c9d('0x37')](',');var _0x19bb5a={};_0x19bb5a[_0x1ec5d4[0x0]]={'$gte':moment(_0x1ec5d4[0x1])[_0x8c9d('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4aa648[_0x8c9d('0x4b')]=_[_0x8c9d('0x9f')](_0x4aa648[_0x8c9d('0x4b')],_0x19bb5a);}_0x4aa648=_[_0x8c9d('0x9f')]({},_0x4aa648,_0x3ac92f[_0x8c9d('0xb9')]);return db[_0x8c9d('0xbe')][_0x8c9d('0x27')]({'where':_0x4aa648[_0x8c9d('0x4b')]})[_0x8c9d('0x2e')](function(_0x285775){_0x5115ef[_0x8c9d('0x27')]=_0x285775;if(_0x3ac92f[_0x8c9d('0x41')]['includeAll']){_0x4aa648[_0x8c9d('0xc7')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x8c9d('0xc8')](_0x4aa648);})[_0x8c9d('0x2e')](function(_0x208e4d){_0x5115ef[_0x8c9d('0xb5')]=_0x208e4d;return _0x5115ef;});}})['then'](respondWithFilteredResult(_0x4a5b85,_0x4aa648))[_0x8c9d('0x3a')](handleError(_0x4a5b85,null));};exports['addTags']=function(_0x5b17f6,_0x457755,_0x36e708){return db[_0x8c9d('0x3c')][_0x8c9d('0x64')]({'where':{'id':_0x5b17f6[_0x8c9d('0xb7')]['id']}})[_0x8c9d('0x2e')](handleEntityNotFound(_0x457755,null))['then'](function(_0x5c6b23){if(_0x5c6b23){return _0x5c6b23[_0x8c9d('0xc9')](_0x5b17f6[_0x8c9d('0x7a')][_0x8c9d('0xbf')],_[_0x8c9d('0xc0')](_0x5b17f6[_0x8c9d('0x7a')],[_0x8c9d('0xbf'),'id'])||{})[_0x8c9d('0xca')](function(){return db[_0x8c9d('0x72')][_0x8c9d('0xc8')]({'attributes':['id','name',_0x8c9d('0x4e')],'where':{'id':_0x5b17f6[_0x8c9d('0x7a')][_0x8c9d('0xbf')]}});})[_0x8c9d('0x2e')](function(_0x2694ce){socket[_0x8c9d('0xcb')](_0x8c9d('0xcc'),{'id':Number(_0x5b17f6['params']['id']),'tags':_0x2694ce||[]});return{'id':Number(_0x5b17f6[_0x8c9d('0xb7')]['id']),'tags':_0x2694ce||[]};});}})['then'](respondWithResult(_0x457755,null))[_0x8c9d('0x3a')](handleError(_0x457755,null));};exports[_0x8c9d('0xcd')]=function(_0x1ae865,_0x33cef2,_0x5f2fb4){return db[_0x8c9d('0x3c')][_0x8c9d('0x64')]({'where':{'id':_0x1ae865[_0x8c9d('0xb7')]['id']}})[_0x8c9d('0x2e')](handleEntityNotFound(_0x33cef2,null))[_0x8c9d('0x2e')](function(_0x2efa67){if(_0x2efa67){return _0x2efa67[_0x8c9d('0xcd')](_0x1ae865[_0x8c9d('0x41')][_0x8c9d('0xbf')]);}})[_0x8c9d('0x2e')](respondWithStatusCode(_0x33cef2,null))[_0x8c9d('0x3a')](handleError(_0x33cef2,null));};exports[_0x8c9d('0xce')]=function(_0x2f6532,_0x226641){var _0x5a2eb4=moment()[_0x8c9d('0xcf')]()[_0x8c9d('0x9d')]();var _0x2a56e8=path[_0x8c9d('0xd0')](config['root'],_0x8c9d('0xd1'),_0x8c9d('0xd2'),_0x8c9d('0xd3'));var _0x2d1f86=path[_0x8c9d('0xd0')](config[_0x8c9d('0xd4')],_0x8c9d('0xd1'),'files',_0x8c9d('0xd5'));var _0x5566a6=path['join'](_0x2a56e8,_0x5a2eb4);var _0x1e2e19=util[_0x8c9d('0xc6')](_0x8c9d('0xd6'),_0x2f6532[_0x8c9d('0xb7')]['id'],_0x5a2eb4);var _0x33c655=path[_0x8c9d('0xd0')](_0x2a56e8,_0x1e2e19);var _0x39fc5d=[];_0x39fc5d[_0x8c9d('0x39')]({'model':db[_0x8c9d('0x75')],'as':'User','attributes':['id',_0x8c9d('0x34')],'raw':!![]});_0x39fc5d[_0x8c9d('0x39')]({'model':db['CmContact'],'as':_0x8c9d('0x69'),'attributes':['id','firstName',_0x8c9d('0xd7')],'raw':!![]});if(_0x2f6532['query'][_0x8c9d('0xd5')]){_0x39fc5d['push']({'model':db[_0x8c9d('0xd8')],'as':_0x8c9d('0xd8'),'raw':!![]});}var _0x5639c5=[{'model':db[_0x8c9d('0xbe')],'as':_0x8c9d('0xd9'),'attributes':['id',_0x8c9d('0x7a'),_0x8c9d('0xda'),_0x8c9d('0xdb'),_0x8c9d('0xdc'),_0x8c9d('0x83')],'include':_0x39fc5d}];_0x5639c5['push']({'model':db[_0x8c9d('0xdd')],'as':_0x8c9d('0xde'),'attributes':['id','name']});_0x5639c5['push']({'model':db[_0x8c9d('0x75')],'as':_0x8c9d('0xdf'),'attributes':['id',_0x8c9d('0x34')]});return db[_0x8c9d('0x3c')][_0x8c9d('0x64')]({'where':{'id':_0x2f6532['params']['id']},'include':_0x5639c5})['then'](handleEntityNotFound(_0x226641,null))[_0x8c9d('0x2e')](function(_0x4b0d88){if(_0x4b0d88){var _0x34386e=_0x4b0d88[_0x8c9d('0xe0')]({'plain':!![]});fs[_0x8c9d('0xe1')](_0x5566a6);var _0x13cb1f={'channel':_0x8c9d('0xe2'),'account':_0x34386e['Account']['name'],'agent':_0x34386e[_0x8c9d('0xdf')]?_0x34386e['Owner'][_0x8c9d('0x34')]:'N.A.','createdAt':moment(_0x34386e['createdAt'])['format'](_0x8c9d('0xe3'))[_0x8c9d('0x9d')](),'closedAt':_0x34386e[_0x8c9d('0xe4')]?moment(_0x34386e[_0x8c9d('0xe5')])[_0x8c9d('0xc6')](_0x8c9d('0xe3'))[_0x8c9d('0x9d')]():'','disposition':_0x34386e[_0x8c9d('0xe6')],'visibility':_0x34386e[_0x8c9d('0xe7')]?_0x8c9d('0xe8'):_0x8c9d('0xe9'),'messages':_(_0x34386e[_0x8c9d('0xd9')])[_0x8c9d('0xc4')]({'secret':![]})[_0x8c9d('0x3b')](function(_0x4ff081){if(_0x4ff081[_0x8c9d('0xd8')]){var _0x12511c=path[_0x8c9d('0xd0')](_0x2d1f86,_0x4ff081[_0x8c9d('0xd8')][_0x8c9d('0xea')]);if(fs[_0x8c9d('0xeb')](_0x12511c)){fs['createReadStream'](_0x12511c)['pipe'](fs['createWriteStream'](path[_0x8c9d('0xd0')](_0x5566a6,_0x4ff081['Attachment']['basename'])));}}return{'date':moment(_0x4ff081[_0x8c9d('0xda')])[_0x8c9d('0xc6')](_0x8c9d('0xe3'))[_0x8c9d('0x9d')](),'sender':_0x4ff081[_0x8c9d('0xdb')]===_0x8c9d('0xec')?_0x4ff081[_0x8c9d('0x75')]?_0x4ff081[_0x8c9d('0x75')][_0x8c9d('0x34')]:_0x8c9d('0xed'):_0x4ff081['Contact'][_0x8c9d('0xee')]+(_0x4ff081[_0x8c9d('0x69')]['lastName']?'\x20'+_0x4ff081['Contact'][_0x8c9d('0xd7')]:''),'body':_0x4ff081[_0x8c9d('0xd8')]?_0x4ff081['Attachment'][_0x8c9d('0xea')]:_0x4ff081[_0x8c9d('0x7a')],'direction':_0x4ff081[_0x8c9d('0xdb')]===_0x8c9d('0xec')?'A':'C','secret':_0x4ff081[_0x8c9d('0xdc')],'read':_0x4ff081['read'],'attachment':_0x4ff081[_0x8c9d('0xd8')]};})['value']()};return ejs['renderFile'](path['join'](config[_0x8c9d('0xd4')],_0x8c9d('0xd1'),'views',_0x8c9d('0xef')),{'interaction':_0x13cb1f})['then'](function(_0x55f6cb){var _0x449655=path['join'](_0x5566a6,'transcript-'+_0x34386e['id']+'-'+_0x5a2eb4+_0x8c9d('0xf0'));var _0x1efa75={'path':_0x449655,'channel':'Openchannel','interactionId':_0x34386e['id']};return pdf[_0x8c9d('0xf1')](_0x55f6cb,_0x1efa75);})[_0x8c9d('0x2e')](function(){return new BPromise(function(_0x4279ab,_0x44ef91){zipdir(_0x5566a6,{'saveTo':_0x33c655},function(_0x3f323b,_0x34eb7b){if(_0x3f323b)return _0x44ef91(_0x3f323b);return _0x4279ab(_0x34eb7b);});})[_0x8c9d('0x2e')](function(){return new BPromise(function(_0x5644d1,_0x595183){rimraf(_0x5566a6,function(_0x5f5c69){if(_0x5f5c69)_0x595183(_0x5f5c69);return _0x5644d1();});});})[_0x8c9d('0x2e')](function(){return _0x226641[_0x8c9d('0xce')](_0x33c655,_0x1e2e19,function(_0x28ee5a){if(_0x28ee5a){console[_0x8c9d('0xf2')]('err',_0x28ee5a);}else{fs['unlinkSync'](_0x33c655);}});});});}else{return _0x226641[_0x8c9d('0x21')](0xc8);}})[_0x8c9d('0x3a')](handleError(_0x226641,null));}; \ No newline at end of file +var _0x4141=['getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','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','i.*','c.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','rows','params','includeAll','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','rawAttributes','merge','include','findAll','addTags','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','Contact','firstName','Attachment','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','basename','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','catch','index','OpenchannelInteraction','fieldName','type','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','$substring','split','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','start','Tag','union','User','operator','UserId','text','body','keys','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','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','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role'];(function(_0x2eb790,_0x13fbe9){var _0x310fc7=function(_0x5eb3d6){while(--_0x5eb3d6){_0x2eb790['push'](_0x2eb790['shift']());}};_0x310fc7(++_0x13fbe9);}(_0x4141,0x147));var _0x1414=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4141[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x1414('0x0'));var rimraf=require(_0x1414('0x1'));var zipdir=require(_0x1414('0x2'));var jsonpatch=require(_0x1414('0x3'));var rp=require(_0x1414('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1414('0x5'));var path=require(_0x1414('0x6'));var sox=require(_0x1414('0x7'));var csv=require(_0x1414('0x8'));var ejs=require(_0x1414('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1414('0xa'));var squel=require(_0x1414('0xb'));var crypto=require(_0x1414('0xc'));var jsforce=require(_0x1414('0xd'));var deskjs=require(_0x1414('0xe'));var toCsv=require(_0x1414('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1414('0xf'));var authService=require(_0x1414('0x10'));var qs=require(_0x1414('0x11'));var as=require(_0x1414('0x12'));var pdf=require(_0x1414('0x13'));var hardwareService=require(_0x1414('0x14'));var logger=require(_0x1414('0x15'))(_0x1414('0x16'));var utils=require('../../config/utils');var config=require(_0x1414('0x17'));var licenseUtil=require(_0x1414('0x18'));var db=require(_0x1414('0x19'))['db'];config[_0x1414('0x1a')]=_[_0x1414('0x1b')](config[_0x1414('0x1a')],{'host':_0x1414('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1414('0x1a')]));require(_0x1414('0x1d'))['register'](socket);function respondWithStatusCode(_0x1ceb82,_0x5c41b7){_0x5c41b7=_0x5c41b7||0xcc;return function(_0x5ddd9b){if(_0x5ddd9b){return _0x1ceb82[_0x1414('0x1e')](_0x5c41b7);}return _0x1ceb82[_0x1414('0x1f')](_0x5c41b7)[_0x1414('0x20')]();};}function respondWithResult(_0x5f24b0,_0x21a10d){_0x21a10d=_0x21a10d||0xc8;return function(_0x279879){if(_0x279879){return _0x5f24b0[_0x1414('0x1f')](_0x21a10d)[_0x1414('0x21')](_0x279879);}};}function respondWithFilteredResult(_0x26b666,_0x21527b){return function(_0x26c0bd){if(_0x26c0bd){var _0x4b15c7=typeof _0x21527b[_0x1414('0x22')]===_0x1414('0x23')&&typeof _0x21527b[_0x1414('0x24')]==='undefined';var _0x358a84=_0x26c0bd[_0x1414('0x25')];var _0x3f957d=_0x4b15c7?0x0:_0x21527b[_0x1414('0x22')];var _0x1528ab=_0x4b15c7?_0x26c0bd[_0x1414('0x25')]:_0x21527b['offset']+_0x21527b['limit'];var _0x384235;if(_0x1528ab>=_0x358a84){_0x1528ab=_0x358a84;_0x384235=0xc8;}else{_0x384235=0xce;}_0x26b666[_0x1414('0x1f')](_0x384235);return _0x26b666['set'](_0x1414('0x26'),_0x3f957d+'-'+_0x1528ab+'/'+_0x358a84)[_0x1414('0x21')](_0x26c0bd);}return null;};}function patchUpdates(_0x406adc){return function(_0x148c47){try{jsonpatch[_0x1414('0x27')](_0x148c47,_0x406adc,!![]);}catch(_0x157111){return BPromise[_0x1414('0x28')](_0x157111);}return _0x148c47[_0x1414('0x29')]();};}function saveUpdates(_0x387352,_0xa41340){return function(_0x57c7a1){if(_0x57c7a1){return _0x57c7a1[_0x1414('0x2a')](_0x387352)[_0x1414('0x2b')](function(_0xdde3a7){return _0xdde3a7;});}return null;};}function removeEntity(_0x1071ec,_0x21e833){return function(_0x321bd4){if(_0x321bd4){return _0x321bd4[_0x1414('0x2c')]()[_0x1414('0x2b')](function(){_0x1071ec[_0x1414('0x1f')](0xcc)[_0x1414('0x20')]();});}};}function handleEntityNotFound(_0x4ac1ba,_0xfed8cd){return function(_0x2e28f4){if(!_0x2e28f4){_0x4ac1ba[_0x1414('0x1e')](0x194);}return _0x2e28f4;};}function handleError(_0x41b2e3,_0x580ab9){_0x580ab9=_0x580ab9||0x1f4;return function(_0x56b467){logger[_0x1414('0x2d')](_0x56b467[_0x1414('0x2e')]);if(_0x56b467[_0x1414('0x2f')]){delete _0x56b467[_0x1414('0x2f')];}_0x41b2e3[_0x1414('0x1f')](_0x580ab9)[_0x1414('0x30')](_0x56b467);};}function getInteractionUsers(_0x131d53,_0x3bd3e8){return new BPromise(function(_0x6a1b63,_0x1b8d62){try{if(_0x3bd3e8[_0x131d53['id']]){_0x131d53[_0x1414('0x31')]=_[_0x1414('0x32')](_0x3bd3e8[_0x131d53['id']],function(_0x29a911){return{'id':_0x29a911['id'],'fullname':_0x29a911[_0x1414('0x33')]};});}}catch(_0x198477){_0x1b8d62(_0x198477);}_0x6a1b63(_0x131d53);});}function getInteractionTags(_0x333d82,_0x477048){return new BPromise(function(_0xcf4de3,_0x3187a4){try{if(_0x333d82[_0x1414('0x34')]){_0x333d82['Tags']=[];_0x333d82[_0x1414('0x34')]['split'](',')['forEach'](function(_0x53c35a){_0x333d82[_0x1414('0x35')]['push'](_0x477048[_0x53c35a]);});}delete _0x333d82[_0x1414('0x34')];}catch(_0x5e49ac){_0x3187a4(_0x5e49ac);}_0xcf4de3(_0x333d82);});}function updateOpenchannelInteraction(_0x247979,_0xcbd6a4,_0x19dc13){return new BPromise(function(_0x19181c,_0x5b2159){return getInteractionUsers(_0x247979,_0x19dc13)[_0x1414('0x2b')](function(_0x500ae6){return getInteractionTags(_0x500ae6,_0xcbd6a4);})[_0x1414('0x2b')](function(_0x506eff){_0x19181c(_0x506eff);})[_0x1414('0x36')](function(_0x214710){_0x5b2159(_0x214710);});});}exports[_0x1414('0x37')]=function(_0x1d70c5,_0x332dfc){var _0x180ed9={},_0x1833c7={},_0x24114d={'count':0x0,'rows':[]};var _0x5770ea=_['map'](db[_0x1414('0x38')]['rawAttributes'],function(_0x411ca3){return{'name':_0x411ca3[_0x1414('0x39')],'type':_0x411ca3[_0x1414('0x3a')][_0x1414('0x3b')]};});_0x1833c7['model']=_[_0x1414('0x32')](_0x5770ea,_0x1414('0x2f'));_0x1833c7[_0x1414('0x3c')]=_['keys'](_0x1d70c5['query']);_0x1833c7[_0x1414('0x3d')]=_[_0x1414('0x3e')](_0x1833c7['model'],_0x1833c7[_0x1414('0x3c')]);_0x180ed9['attributes']=_['intersection'](_0x1833c7['model'],qs[_0x1414('0x3f')](_0x1d70c5[_0x1414('0x3c')]['fields']));_0x180ed9[_0x1414('0x40')]=_0x180ed9[_0x1414('0x40')][_0x1414('0x41')]?_0x180ed9[_0x1414('0x40')]:_0x1833c7[_0x1414('0x42')];if(!_0x1d70c5[_0x1414('0x3c')][_0x1414('0x43')](_0x1414('0x44'))){_0x180ed9[_0x1414('0x24')]=qs[_0x1414('0x24')](_0x1d70c5['query'][_0x1414('0x24')]);_0x180ed9[_0x1414('0x22')]=qs[_0x1414('0x22')](_0x1d70c5[_0x1414('0x3c')][_0x1414('0x22')]);}_0x180ed9[_0x1414('0x45')]=qs[_0x1414('0x46')](_0x1d70c5[_0x1414('0x3c')][_0x1414('0x46')]);_0x180ed9['where']=qs[_0x1414('0x3d')](_[_0x1414('0x47')](_0x1d70c5['query'],_0x1833c7[_0x1414('0x3d')]),_0x5770ea);var _0x49f4da=[];var _0x2bb177=squel[_0x1414('0x48')]()[_0x1414('0x49')]('id')[_0x1414('0x49')]('name')[_0x1414('0x49')](_0x1414('0x4a'))[_0x1414('0x4b')](_0x1414('0x4c'));var _0x210a20=squel[_0x1414('0x48')]()[_0x1414('0x49')](_0x1414('0x4d'))['field']('u.fullname')[_0x1414('0x49')](_0x1414('0x4e'))[_0x1414('0x4b')]('user_has_openchannel_interactions','ui')[_0x1414('0x4f')](_0x1414('0x50'),'u',_0x1414('0x51'));var _0xaab2a7=squel[_0x1414('0x48')]()[_0x1414('0x4b')](_0x1414('0x52'),'i')[_0x1414('0x4f')](_0x1414('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1414('0x4f')]('users','o',_0x1414('0x54'))[_0x1414('0x4f')](_0x1414('0x55'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x1414('0x4f')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x1414('0x4f')](_0x1414('0x56'),'it',_0x1414('0x57'))['left_join'](_0x1414('0x4c'),'t',_0x1414('0x58'));var _0xcfc651=squel[_0x1414('0x59')]();var _0x16eb9a=[];var _0x384370=squel[_0x1414('0x59')]();var _0x430a88;if(_0x1d70c5['query'][_0x1414('0x5a')]){_0x430a88=as[_0x1414('0x5b')](_0x1d70c5[_0x1414('0x3c')]['search']);var _0x26578a=_0x430a88[_0x1414('0x5c')];for(var _0x110973=0x0;_0x110973<_0x430a88['conditions']['length'];_0x110973++){var _0x1dc84f=_0x430a88['conditions'][_0x110973];var _0x54fc7='i';var _0x251bb3=_[_0x1414('0x5d')](_0x5770ea,[_0x1414('0x2f'),_0x1dc84f[_0x1414('0x49')]]);if(!_0x251bb3){switch(_0x1dc84f[_0x1414('0x49')]){case _0x1414('0x5e'):if(_0x1dc84f[_0x1414('0x5f')]==0x1){_0xaab2a7[_0x1414('0x60')]('`'+_0x1dc84f[_0x1414('0x49')]+_0x1414('0x61'));}else{_0xaab2a7['having']('`'+_0x1dc84f[_0x1414('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x1dc84f['operator']===_0x1414('0x62')){if(_0x1dc84f['value'][_0x1414('0x63')]('\x20')[_0x1414('0x41')]>0x1){_0xcfc651[_0x26578a](_0x1414('0x64'),qs['getFullTextValue'](_0x1dc84f[_0x1414('0x5f')]),null);}else{var _0x599ea4='%'+_0x1dc84f[_0x1414('0x5f')]+'%';_0xcfc651[_0x26578a](_0x1414('0x65'),_0x599ea4,_0x599ea4,_0x599ea4);}}else{_0x251bb3=_[_0x1414('0x5d')](_0x5770ea,[_0x1414('0x2f'),_0x1414('0x66')]);_0x1dc84f[_0x1414('0x49')]=_0x1414('0x66');_0x30dc96=as[_0x1414('0x67')](_0x54fc7,_0x251bb3[_0x1414('0x3a')],_0x1dc84f);_0xcfc651[_0x26578a](_0x30dc96['text'],_0x30dc96[_0x1414('0x5f')][_0x1414('0x68')],_0x30dc96[_0x1414('0x5f')][_0x1414('0x20')]);}break;case _0x1414('0x69'):var _0x2d1a6c=_0x1dc84f[_0x1414('0x5f')][_0x1414('0x63')](',')[_0x1414('0x32')](function(_0x3ce2ea){return Number(_0x3ce2ea);});_0x2d1a6c['forEach'](function(_0x356ca1){_0x384370['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x356ca1+',%');});_0x16eb9a=_[_0x1414('0x6a')](_0x16eb9a,_0x2d1a6c);break;case _0x1414('0x6b'):if(_0x1dc84f[_0x1414('0x6c')]===_0x1414('0x62')){_0xcfc651[_0x26578a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1dc84f[_0x1414('0x5f')]+'%',null);}else{_0x251bb3=_[_0x1414('0x5d')](_0x5770ea,[_0x1414('0x2f'),_0x1414('0x6d')]);_0x1dc84f['field']=_0x1414('0x6d');_0x30dc96=as[_0x1414('0x67')](_0x54fc7,_0x251bb3[_0x1414('0x3a')],_0x1dc84f);_0xcfc651[_0x26578a](_0x30dc96[_0x1414('0x6e')],_0x30dc96[_0x1414('0x5f')]['start'],_0x30dc96[_0x1414('0x5f')]['end']);}break;case _0x1414('0x6f'):_0x30dc96=as[_0x1414('0x67')]('me',null,_0x1dc84f);_0xcfc651[_0x26578a](_0x30dc96[_0x1414('0x6e')],_0x30dc96[_0x1414('0x5f')][_0x1414('0x68')],_0x30dc96[_0x1414('0x5f')]['end']);break;}}else{var _0x30dc96=as[_0x1414('0x67')](_0x54fc7,_0x251bb3[_0x1414('0x3a')],_0x1dc84f);_0xcfc651[_0x26578a](_0x30dc96[_0x1414('0x6e')],_0x30dc96[_0x1414('0x5f')][_0x1414('0x68')],_0x30dc96[_0x1414('0x5f')][_0x1414('0x20')]);}}}else{var _0x1be553=_(_0x1d70c5[_0x1414('0x3c')])[_0x1414('0x70')]()[_0x1414('0x32')](function(_0x472748){return _[_0x1414('0x71')](_0x5770ea,[_0x1414('0x2f'),_0x472748])?_0x472748:undefined;})[_0x1414('0x72')]()[_0x1414('0x5f')]();if(!_[_0x1414('0x73')](_0x1be553)){_0x1be553['forEach'](function(_0x1bdaad){if(_0x1bdaad===_0x1414('0x74')){_0xaab2a7[_0x1414('0x75')](_0x1414('0x76'),[]['concat'](_0x1d70c5[_0x1414('0x3c')][_0x1bdaad]));}else if(_0x1bdaad===_0x1414('0x77')){var _0x4907e8=JSON['parse'](_0x1d70c5['query'][_0x1bdaad])[_0x1414('0x78')];var _0x9a95d=JSON[_0x1414('0x79')](_0x1d70c5[_0x1414('0x3c')][_0x1bdaad])[_0x1414('0x7a')];_0xaab2a7['where'](_0x1414('0x7b'),_0x4907e8,_0x9a95d);}else{if(_0x1d70c5['query'][_0x1bdaad]==='null'){_0xaab2a7[_0x1414('0x75')]('i.'+_0x1bdaad+'\x20IS\x20NULL');}else{_0xaab2a7['where']('i.'+_0x1bdaad+_0x1414('0x7c'),_0x1d70c5['query'][_0x1bdaad]);}}});}if(_0x1d70c5['query'][_0x1414('0x7d')]){if(_0x1d70c5[_0x1414('0x3c')][_0x1414('0x7d')]==0x1){_0xaab2a7[_0x1414('0x60')](_0x1414('0x7e'));}else{_0xaab2a7[_0x1414('0x60')](_0x1414('0x7f'));}}if(_0x1d70c5[_0x1414('0x3c')][_0x1414('0x80')]){_0x16eb9a=_['isArray'](_0x1d70c5[_0x1414('0x3c')][_0x1414('0x80')])?_0x1d70c5[_0x1414('0x3c')][_0x1414('0x80')]:new Array(_0x1d70c5[_0x1414('0x3c')][_0x1414('0x80')]);_0x16eb9a[_0x1414('0x81')](function(_0x54836b){_0x384370['or'](_0x1414('0x82'),'%,'+_0x54836b+',%');});}if(_0x1d70c5[_0x1414('0x3c')][_0x1414('0x83')]){var _0x5cb9bf=_0x1d70c5[_0x1414('0x3c')][_0x1414('0x83')][_0x1414('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1414('0x85')](_0x5cb9bf)){_0xcfc651['or'](_0x1414('0x86'),_0x5cb9bf+'%');}else{_0xcfc651['or'](_0x1414('0x87'),qs[_0x1414('0x88')](_0x5cb9bf))['or']('i.from\x20LIKE\x20?',_0x5cb9bf+'%')['or'](_0x1414('0x89'),_0x5cb9bf+'%');}}}_0xaab2a7[_0x1414('0x75')](_0xcfc651);_0xaab2a7[_0x1414('0x8a')](_0x1414('0x8b'));var _0x1b3f48={'type':db[_0x1414('0x8c')][_0x1414('0x8d')][_0x1414('0x8e')],'raw':!![]};var _0x1b3648=_0xaab2a7[_0x1414('0x8f')]();_0x1b3648[_0x1414('0x49')](_0x1414('0x8b'));_0x1b3648[_0x1414('0x49')](_0x1414('0x90'),'unreadMessages');if(_0x180ed9['order']){_0x180ed9[_0x1414('0x45')][_0x1414('0x81')](function(_0x4cbdf6){var _0x3551c6=_0x4cbdf6[0x0]===_0x1414('0x91')?_0x4cbdf6[0x0]:'i.'+_0x4cbdf6[0x0];_0xaab2a7['order'](_0x3551c6,_0x4cbdf6[0x1]===_0x1414('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x16eb9a)){_0xaab2a7['having'](_0x384370);_0x1b3648[_0x1414('0x75')]('t.id\x20IN\x20?',_0x16eb9a);}BPromise[_0x1414('0x93')]()['then'](function(){if(!_0x430a88){if(_0x1d70c5[_0x1414('0x3c')][_0x1414('0x74')])return;_0x1b3648[_0x1414('0x75')](_0x1414('0x94'));_0xaab2a7['where'](_0x1414('0x94'));return;}if(_0x1d70c5[_0x1414('0x95')][_0x1414('0x96')]!=='agent')return;return _0x1d70c5[_0x1414('0x95')][_0x1414('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x412009){if(_[_0x1414('0x73')](_0x412009)){_0x1b3648[_0x1414('0x75')](_0x1414('0x98'));_0xaab2a7[_0x1414('0x75')](_0x1414('0x98'));}else{_0x1b3648[_0x1414('0x75')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x412009,'id'));_0xaab2a7['where'](_0x1414('0x76'),_[_0x1414('0x32')](_0x412009,'id'));}});})[_0x1414('0x2b')](function(){if(_0x1d70c5[_0x1414('0x95')][_0x1414('0x96')]===_0x1414('0x99')&&!_0x430a88&&!_0x1d70c5[_0x1414('0x3c')][_0x1414('0x74')])return[];return db[_0x1414('0x9a')]['query'](_0x1b3648[_0x1414('0x9b')](),_0x1b3f48);})[_0x1414('0x2b')](function(_0x46d070){_0x24114d[_0x1414('0x25')]=_0x46d070[_0x1414('0x41')];if(_0x24114d['count']===0x0)return[];return db[_0x1414('0x9a')][_0x1414('0x3c')](_0x2bb177[_0x1414('0x9b')](),_0x1b3f48)[_0x1414('0x2b')](function(_0x30b046){_0x49f4da=_[_0x1414('0x9c')](_0x30b046,'id');_0x1b3f48=_['merge'](_0x1b3f48,{'model':db[_0x1414('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1d70c5[_0x1414('0x3c')]['fields']){_0x180ed9[_0x1414('0x40')][_0x1414('0x81')](function(_0x1cf091){_0xaab2a7[_0x1414('0x49')]('i.'+_0x1cf091);});}else{_0xaab2a7[_0x1414('0x49')](_0x1414('0x90'),_0x1414('0x5e'));_0xaab2a7[_0x1414('0x49')]('a.key',_0x1414('0x9d'));_0xaab2a7[_0x1414('0x49')]('a.mandatoryDisposition',_0x1414('0x9e'));_0xaab2a7[_0x1414('0x49')](_0x1414('0x9f'),_0x1414('0x91'));_0xaab2a7[_0x1414('0x49')](_0x1414('0xa0'));_0xaab2a7[_0x1414('0x49')](_0x1414('0xa1'),'Contact.firstName');_0xaab2a7[_0x1414('0x49')](_0x1414('0xa2'),'Contact.lastName');_0xaab2a7[_0x1414('0x49')](_0x1414('0xa3'),_0x1414('0xa4'));_0xaab2a7[_0x1414('0x49')]('c.phone',_0x1414('0xa5'));_0xaab2a7['field']('c.mobile',_0x1414('0xa6'));_0xaab2a7[_0x1414('0x49')]('c.fax',_0x1414('0xa7'));_0xaab2a7[_0x1414('0x49')](_0x1414('0xa8'),_0x1414('0xa9'));_0xaab2a7['field'](_0x1414('0xaa'),_0x1414('0xab'));_0xaab2a7['field'](_0x1414('0xac'),_0x1414('0x34'));}if(_0x180ed9[_0x1414('0x24')])_0xaab2a7['limit'](_0x180ed9[_0x1414('0x24')]);if(_0x180ed9[_0x1414('0x22')])_0xaab2a7[_0x1414('0x22')](_0x180ed9[_0x1414('0x22')]);return db[_0x1414('0x9a')]['query'](_0xaab2a7[_0x1414('0x9b')](),_0x1b3f48);})[_0x1414('0x2b')](function(_0x31b5e9){if(_0x31b5e9['length']>0x0)_0x210a20[_0x1414('0x75')](_0x1414('0xad'),_[_0x1414('0x32')](_0x31b5e9,'id'));return db['sequelize'][_0x1414('0x3c')](_0x210a20[_0x1414('0x9b')](),_0x1b3f48)['then'](function(_0xe172ca){var _0x613c12=_['groupBy'](_0xe172ca,_0x1414('0xae'));var _0x3a8f5b=[];_0x31b5e9['forEach'](function(_0x3a40d7){_0x3a8f5b[_0x1414('0xaf')](updateOpenchannelInteraction(_0x3a40d7,_0x49f4da,_0x613c12));});return BPromise[_0x1414('0xb0')](_0x3a8f5b);});});})[_0x1414('0x2b')](function(_0x16bbd0){_0x24114d[_0x1414('0xb1')]=_0x16bbd0;return _0x24114d;})[_0x1414('0x2b')](respondWithFilteredResult(_0x332dfc,_0x180ed9))['catch'](handleError(_0x332dfc,null));};exports['show']=function(_0x484284,_0x3d6078){var _0x5a2204={};if(_0x484284['query'][_0x1414('0x3a')]&&_0x484284['query'][_0x1414('0x3a')]===_0x1414('0x4b')){_0x5a2204[_0x1414('0x4b')]=_0x484284['params']['id'];}else{_0x5a2204['id']=_0x484284[_0x1414('0xb2')]['id'];}var _0x27198b={'raw':![],'where':_0x5a2204},_0x108def={};_0x108def[_0x1414('0x42')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x108def[_0x1414('0x3c')]=_['keys'](_0x484284[_0x1414('0x3c')]);_0x108def[_0x1414('0x3d')]=_[_0x1414('0x3e')](_0x108def[_0x1414('0x42')],_0x108def[_0x1414('0x3c')]);_0x27198b[_0x1414('0x40')]=_[_0x1414('0x3e')](_0x108def[_0x1414('0x42')],qs[_0x1414('0x3f')](_0x484284[_0x1414('0x3c')][_0x1414('0x3f')]));_0x27198b[_0x1414('0x40')]=_0x27198b['attributes']['length']?_0x27198b[_0x1414('0x40')]:_0x108def['model'];if(_0x484284['query'][_0x1414('0xb3')]){_0x27198b['include']=[{'all':!![]}];}_0x27198b=_['merge']({},_0x27198b,_0x484284[_0x1414('0xb4')]);return db[_0x1414('0x38')][_0x1414('0x5d')](_0x27198b)[_0x1414('0x2b')](handleEntityNotFound(_0x3d6078,null))[_0x1414('0x2b')](respondWithResult(_0x3d6078,null))[_0x1414('0x36')](handleError(_0x3d6078,null));};exports['create']=function(_0x2e5453,_0x271793){return db['OpenchannelInteraction'][_0x1414('0xb5')](_0x2e5453[_0x1414('0x6f')],{})[_0x1414('0x2b')](respondWithResult(_0x271793,0xc9))['catch'](handleError(_0x271793,null));};exports[_0x1414('0x2a')]=function(_0x4c12bd,_0x19e166){if(_0x4c12bd['body']['id']){delete _0x4c12bd[_0x1414('0x6f')]['id'];}return db[_0x1414('0x38')][_0x1414('0x5d')]({'where':{'id':_0x4c12bd[_0x1414('0xb2')]['id']}})[_0x1414('0x2b')](handleEntityNotFound(_0x19e166,null))[_0x1414('0x2b')](saveUpdates(_0x4c12bd[_0x1414('0x6f')],null))['then'](respondWithResult(_0x19e166,null))[_0x1414('0x36')](handleError(_0x19e166,null));};exports[_0x1414('0x2c')]=function(_0x4559db,_0x187b77){return db[_0x1414('0x38')][_0x1414('0x5d')]({'where':{'id':_0x4559db[_0x1414('0xb2')]['id']}})[_0x1414('0x2b')](handleEntityNotFound(_0x187b77,null))[_0x1414('0x2b')](removeEntity(_0x187b77,null))[_0x1414('0x36')](handleError(_0x187b77,null));};exports[_0x1414('0xb6')]=function(_0x547bb8,_0x4bf4ee){return db['OpenchannelInteraction'][_0x1414('0xb6')]()[_0x1414('0x2b')](respondWithResult(_0x4bf4ee,null))[_0x1414('0x36')](handleError(_0x4bf4ee,null));};exports[_0x1414('0xb7')]=function(_0xa3973c,_0x88100e,_0x49e70d){return db[_0x1414('0xb8')]['find']({'where':{'id':_0xa3973c[_0x1414('0xb2')]['id']}})[_0x1414('0x2b')](handleEntityNotFound(_0x88100e,null))[_0x1414('0x2b')](function(_0x533719){if(_0x533719){return _0x533719[_0x1414('0xb7')](_0xa3973c[_0x1414('0x6f')][_0x1414('0xb9')],_[_0x1414('0xba')](_0xa3973c['body'],[_0x1414('0xb9'),'id'])||{});}})[_0x1414('0x2b')](respondWithResult(_0x88100e,null))[_0x1414('0x36')](handleError(_0x88100e,null));};exports[_0x1414('0xbb')]=function(_0x10fa51,_0x2d2b4c,_0x4b4010){var _0x440c89={'raw':![],'where':{}};var _0x2691fc={};var _0x147721={'count':0x0,'rows':[]};return db[_0x1414('0x38')][_0x1414('0xbc')]({'where':{'id':_0x10fa51[_0x1414('0xb2')]['id']}})['then'](handleEntityNotFound(_0x2d2b4c,null))[_0x1414('0x2b')](function(_0x5a8e94){if(_0x5a8e94){_0x2691fc['model']=_[_0x1414('0x70')](db['OpenchannelMessage'][_0x1414('0xbd')]);_0x2691fc[_0x1414('0x3c')]=_[_0x1414('0x70')](_0x10fa51[_0x1414('0x3c')]);_0x2691fc[_0x1414('0x3d')]=_[_0x1414('0x3e')](_0x2691fc[_0x1414('0x42')],_0x2691fc[_0x1414('0x3c')]);_0x440c89['attributes']=_[_0x1414('0x3e')](_0x2691fc[_0x1414('0x42')],qs['fields'](_0x10fa51[_0x1414('0x3c')][_0x1414('0x3f')]));_0x440c89[_0x1414('0x40')]=_0x440c89[_0x1414('0x40')]['length']?_0x440c89[_0x1414('0x40')]:_0x2691fc[_0x1414('0x42')];if(!_0x10fa51['query'][_0x1414('0x43')]('nolimit')){_0x440c89['limit']=qs[_0x1414('0x24')](_0x10fa51[_0x1414('0x3c')][_0x1414('0x24')]);_0x440c89[_0x1414('0x22')]=qs[_0x1414('0x22')](_0x10fa51[_0x1414('0x3c')]['offset']);}_0x440c89['order']=qs['sort'](_0x10fa51[_0x1414('0x3c')][_0x1414('0x46')]);_0x440c89['where']=qs[_0x1414('0x3d')](_[_0x1414('0x47')](_0x10fa51['query'],_0x2691fc[_0x1414('0x3d')]));_0x440c89[_0x1414('0x75')][_0x1414('0xae')]=_0x5a8e94['id'];if(_0x10fa51['query']['filter']){_0x440c89['where']=_['merge'](_0x440c89[_0x1414('0x75')],{'$or':_[_0x1414('0x32')](_0x440c89[_0x1414('0x40')],function(_0x150319){var _0x5a61e0={};_0x5a61e0[_0x150319]={'$like':'%'+_0x10fa51[_0x1414('0x3c')][_0x1414('0x83')]+'%'};return _0x5a61e0;})});}if(_0x10fa51[_0x1414('0x3c')][_0x1414('0x78')]){var _0x18a9c4=_0x10fa51[_0x1414('0x3c')][_0x1414('0x78')][_0x1414('0x63')](',');var _0x40325a={};_0x40325a[_0x18a9c4[0x0]]={'$gte':moment(_0x18a9c4[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x440c89['where']=_[_0x1414('0xbe')](_0x440c89['where'],_0x40325a);}_0x440c89=_[_0x1414('0xbe')]({},_0x440c89,_0x10fa51[_0x1414('0xb4')]);return db[_0x1414('0xb8')][_0x1414('0x25')]({'where':_0x440c89[_0x1414('0x75')]})[_0x1414('0x2b')](function(_0x4d9652){_0x147721['count']=_0x4d9652;if(_0x10fa51[_0x1414('0x3c')][_0x1414('0xb3')]){_0x440c89[_0x1414('0xbf')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1414('0xc0')](_0x440c89);})[_0x1414('0x2b')](function(_0xd7c228){_0x147721['rows']=_0xd7c228;return _0x147721;});}})[_0x1414('0x2b')](respondWithFilteredResult(_0x2d2b4c,_0x440c89))[_0x1414('0x36')](handleError(_0x2d2b4c,null));};exports[_0x1414('0xc1')]=function(_0xbf57d7,_0x302f87,_0xcb3838){return db[_0x1414('0x38')][_0x1414('0x5d')]({'where':{'id':_0xbf57d7[_0x1414('0xb2')]['id']}})['then'](handleEntityNotFound(_0x302f87,null))[_0x1414('0x2b')](function(_0x570bae){if(_0x570bae){return _0x570bae['setTags'](_0xbf57d7[_0x1414('0x6f')]['ids'],_[_0x1414('0xba')](_0xbf57d7[_0x1414('0x6f')],[_0x1414('0xb9'),'id'])||{})['spread'](function(){return db['Tag'][_0x1414('0xc0')]({'attributes':['id','name',_0x1414('0x4a')],'where':{'id':_0xbf57d7[_0x1414('0x6f')]['ids']}});})['then'](function(_0x1873ce){socket['emit'](_0x1414('0xc2'),{'id':Number(_0xbf57d7['params']['id']),'tags':_0x1873ce||[]});return{'id':Number(_0xbf57d7[_0x1414('0xb2')]['id']),'tags':_0x1873ce||[]};});}})[_0x1414('0x2b')](respondWithResult(_0x302f87,null))[_0x1414('0x36')](handleError(_0x302f87,null));};exports[_0x1414('0xc3')]=function(_0x33a294,_0x3ea6c,_0x48c5ab){return db[_0x1414('0x38')][_0x1414('0x5d')]({'where':{'id':_0x33a294['params']['id']}})[_0x1414('0x2b')](handleEntityNotFound(_0x3ea6c,null))['then'](function(_0x5ba080){if(_0x5ba080){return _0x5ba080[_0x1414('0xc3')](_0x33a294['query'][_0x1414('0xb9')]);}})[_0x1414('0x2b')](respondWithStatusCode(_0x3ea6c,null))[_0x1414('0x36')](handleError(_0x3ea6c,null));};exports[_0x1414('0xc4')]=function(_0x4bd721,_0x43b6f3){var _0x5ef67f=moment()[_0x1414('0xc5')]()[_0x1414('0x9b')]();var _0x160df5=path[_0x1414('0xc6')](config[_0x1414('0xc7')],_0x1414('0xc8'),_0x1414('0xc9'),_0x1414('0xca'));var _0x51b527=path[_0x1414('0xc6')](config[_0x1414('0xc7')],'server',_0x1414('0xc9'),_0x1414('0xcb'));var _0x42531a=path['join'](_0x160df5,_0x5ef67f);var _0x5844ed=util[_0x1414('0xcc')](_0x1414('0xcd'),_0x4bd721[_0x1414('0xb2')]['id'],_0x5ef67f);var _0x86676c=path[_0x1414('0xc6')](_0x160df5,_0x5844ed);var _0x72d1dc=[];_0x72d1dc[_0x1414('0xaf')]({'model':db[_0x1414('0x6b')],'as':_0x1414('0x6b'),'attributes':['id',_0x1414('0x33')],'raw':!![]});_0x72d1dc[_0x1414('0xaf')]({'model':db[_0x1414('0xce')],'as':_0x1414('0xcf'),'attributes':['id',_0x1414('0xd0'),'lastName'],'raw':!![]});if(_0x4bd721['query'][_0x1414('0xcb')]){_0x72d1dc[_0x1414('0xaf')]({'model':db[_0x1414('0xd1')],'as':_0x1414('0xd1'),'raw':!![]});}var _0x3682d1=[{'model':db[_0x1414('0xb8')],'as':'Messages','attributes':['id',_0x1414('0x6f'),'createdAt',_0x1414('0xd2'),_0x1414('0xd3'),_0x1414('0x7d')],'include':_0x72d1dc}];_0x3682d1[_0x1414('0xaf')]({'model':db[_0x1414('0xd4')],'as':_0x1414('0xd5'),'attributes':['id',_0x1414('0x2f')]});_0x3682d1[_0x1414('0xaf')]({'model':db['User'],'as':'Owner','attributes':['id',_0x1414('0x33')]});return db['OpenchannelInteraction'][_0x1414('0x5d')]({'where':{'id':_0x4bd721[_0x1414('0xb2')]['id']},'include':_0x3682d1})[_0x1414('0x2b')](handleEntityNotFound(_0x43b6f3,null))['then'](function(_0x37b8f5){if(_0x37b8f5){var _0x425d20=_0x37b8f5[_0x1414('0xd6')]({'plain':!![]});fs[_0x1414('0xd7')](_0x42531a);var _0xb7403e={'channel':_0x1414('0xd8'),'account':_0x425d20[_0x1414('0xd5')][_0x1414('0x2f')],'agent':_0x425d20[_0x1414('0xd9')]?_0x425d20[_0x1414('0xd9')][_0x1414('0x33')]:_0x1414('0xda'),'createdAt':moment(_0x425d20[_0x1414('0x77')])[_0x1414('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1414('0x9b')](),'closedAt':_0x425d20[_0x1414('0xdb')]?moment(_0x425d20['closedAt'])['format'](_0x1414('0xdc'))['toString']():'','disposition':_0x425d20[_0x1414('0xdd')],'visibility':_0x425d20[_0x1414('0xde')]?_0x1414('0xdf'):'Private','messages':_(_0x425d20['Messages'])[_0x1414('0x83')]({'secret':![]})['map'](function(_0x287629){if(_0x287629[_0x1414('0xd1')]){var _0x26bec3=path[_0x1414('0xc6')](_0x51b527,_0x287629[_0x1414('0xd1')][_0x1414('0xe0')]);if(fs['existsSync'](_0x26bec3)){fs[_0x1414('0xe1')](_0x26bec3)[_0x1414('0xe2')](fs[_0x1414('0xe3')](path[_0x1414('0xc6')](_0x42531a,_0x287629[_0x1414('0xd1')][_0x1414('0xe0')])));}}return{'date':moment(_0x287629[_0x1414('0x77')])[_0x1414('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1414('0x9b')](),'sender':_0x287629[_0x1414('0xd2')]===_0x1414('0xe4')?_0x287629['User']?_0x287629[_0x1414('0x6b')][_0x1414('0x33')]:_0x1414('0xe5'):_0x287629['Contact'][_0x1414('0xd0')]+(_0x287629[_0x1414('0xcf')][_0x1414('0xe6')]?'\x20'+_0x287629['Contact']['lastName']:''),'body':_0x287629[_0x1414('0xd1')]?_0x287629[_0x1414('0xd1')][_0x1414('0xe0')]:_0x287629[_0x1414('0x6f')],'direction':_0x287629[_0x1414('0xd2')]===_0x1414('0xe4')?'A':'C','secret':_0x287629[_0x1414('0xd3')],'read':_0x287629['read'],'attachment':_0x287629[_0x1414('0xd1')]};})[_0x1414('0x5f')]()};return ejs[_0x1414('0xe7')](path[_0x1414('0xc6')](config['root'],_0x1414('0xc8'),_0x1414('0xe8'),_0x1414('0xe9')),{'interaction':_0xb7403e})[_0x1414('0x2b')](function(_0x370310){var _0x56504e=path[_0x1414('0xc6')](_0x42531a,_0x1414('0xea')+_0x425d20['id']+'-'+_0x5ef67f+_0x1414('0xeb'));var _0x14b59a={'path':_0x56504e,'channel':_0x1414('0xd8'),'interactionId':_0x425d20['id']};return pdf['createPdfFromHTML'](_0x370310,_0x14b59a);})[_0x1414('0x2b')](function(){return new BPromise(function(_0x474411,_0x5db225){zipdir(_0x42531a,{'saveTo':_0x86676c},function(_0x327d14,_0x4b6547){if(_0x327d14)return _0x5db225(_0x327d14);return _0x474411(_0x4b6547);});})[_0x1414('0x2b')](function(){return new BPromise(function(_0x26c341,_0x380334){rimraf(_0x42531a,function(_0x93233e){if(_0x93233e)_0x380334(_0x93233e);return _0x26c341();});});})[_0x1414('0x2b')](function(){return _0x43b6f3[_0x1414('0xc4')](_0x86676c,_0x5844ed,function(_0x13e498){if(_0x13e498){console[_0x1414('0xec')](_0x1414('0xed'),_0x13e498);}else{fs[_0x1414('0xee')](_0x86676c);}});});});}else{return _0x43b6f3[_0x1414('0x1e')](0xc8);}})[_0x1414('0x36')](handleError(_0x43b6f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 4c3d3c3..24fc28f 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 _0x66ab=['Users','findAll','unreadMessages','length','emit','catch','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x66ab,0x1d6));var _0xb66a=function(_0x468836,_0x1d4cd8){_0x468836=_0x468836-0x0;var _0x328f9e=_0x66ab[_0x468836];return _0x328f9e;};'use strict';var EventEmitter=require(_0xb66a('0x0'));var OpenchannelInteraction=require(_0xb66a('0x1'))['db'][_0xb66a('0x2')];var OpenchannelMessage=require(_0xb66a('0x1'))['db'][_0xb66a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb66a('0x4')](0x0);var events={'afterCreate':_0xb66a('0x5'),'afterUpdate':_0xb66a('0x6'),'afterDestroy':_0xb66a('0x7')};function emitEvent(_0x284886){return function(_0x187d7b,_0x3290d9,_0x368aff){_0x187d7b['getUsers']({'attributes':['id'],'raw':!![]})[_0xb66a('0x8')](function(_0x1f1333){_0x187d7b[_0xb66a('0x9')](_0xb66a('0xa'),_0x1f1333['map'](function(_0x575120){return{'id':_0x575120['id']};}));return OpenchannelMessage[_0xb66a('0xb')]({'where':{'OpenchannelInteractionId':_0x187d7b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb66a('0x8')](function(_0x487695){_0x187d7b[_0xb66a('0x9')](_0xb66a('0xc'),_0x487695[_0xb66a('0xd')]);OpenchannelInteractionEvents[_0xb66a('0xe')](_0x284886+':'+_0x187d7b['id'],_0x187d7b);OpenchannelInteractionEvents[_0xb66a('0xe')](_0x284886,_0x187d7b);_0x368aff(null);})[_0xb66a('0xf')](_0x368aff(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 +var _0xb789=['exports','events','../../mysqldb','OpenchannelInteraction','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb789,0x188));var _0x9b78=function(_0x4c3c97,_0x5ec114){_0x4c3c97=_0x4c3c97-0x0;var _0x112244=_0xb789[_0x4c3c97];return _0x112244;};'use strict';var EventEmitter=require(_0x9b78('0x0'));var OpenchannelInteraction=require(_0x9b78('0x1'))['db'][_0x9b78('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9b78('0x3'),'afterUpdate':_0x9b78('0x4'),'afterDestroy':_0x9b78('0x5')};function emitEvent(_0x3b15f2){return function(_0x5beecf,_0x3d8c7f,_0x696c5e){_0x5beecf['getUsers']({'attributes':['id'],'raw':!![]})[_0x9b78('0x6')](function(_0x1506a5){_0x5beecf['setDataValue'](_0x9b78('0x7'),_0x1506a5[_0x9b78('0x8')](function(_0x59e61e){return{'id':_0x59e61e['id']};}));return OpenchannelMessage[_0x9b78('0x9')]({'where':{'OpenchannelInteractionId':_0x5beecf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e214f){_0x5beecf[_0x9b78('0xa')](_0x9b78('0xb'),_0x3e214f[_0x9b78('0xc')]);OpenchannelInteractionEvents['emit'](_0x3b15f2+':'+_0x5beecf['id'],_0x5beecf);OpenchannelInteractionEvents[_0x9b78('0xd')](_0x3b15f2,_0x5beecf);_0x696c5e(null);})['catch'](_0x696c5e(null));};}for(var e in events){if(events[_0x9b78('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x9b78('0xf')](e,emitEvent(event));}}module[_0x9b78('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ca54ed1..b8e0139 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 _0x63a8=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird'];(function(_0x3b74cc,_0xb1420){var _0x6e1aac=function(_0x3689ec){while(--_0x3689ec){_0x3b74cc['push'](_0x3b74cc['shift']());}};_0x6e1aac(++_0xb1420);}(_0x63a8,0x1ea));var _0x863a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x63a8[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x863a('0x0'));var util=require('util');var logger=require(_0x863a('0x1'))('api');var moment=require(_0x863a('0x2'));var BPromise=require(_0x863a('0x3'));var rp=require(_0x863a('0x4'));var fs=require('fs');var path=require(_0x863a('0x5'));var rimraf=require(_0x863a('0x6'));var config=require(_0x863a('0x7'));var attributes=require(_0x863a('0x8'));module[_0x863a('0x9')]=function(_0x28f064,_0x3ecd9a){return _0x28f064[_0x863a('0xa')](_0x863a('0xb'),attributes,{'tableName':_0x863a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x863a('0xd'),'collate':_0x863a('0xe'),'hooks':{'beforeUpdate':function(_0x4d70ba,_0x37f52f,_0xed11b2){if(_0x4d70ba[_0x863a('0xf')](_0x863a('0x10'))){_0x4d70ba['closedAt']=moment()[_0x863a('0x11')](_0x863a('0x12'));}_0xed11b2(null,_0x4d70ba);}}});}; \ No newline at end of file +var _0x00fc=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x416205,_0x38b0e4){var _0x59fe6c=function(_0x13fa52){while(--_0x13fa52){_0x416205['push'](_0x416205['shift']());}};_0x59fe6c(++_0x38b0e4);}(_0x00fc,0x143));var _0xc00f=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x00fc[_0x44cb92];return _0x56b9e6;};'use strict';var _=require(_0xc00f('0x0'));var util=require('util');var logger=require(_0xc00f('0x1'))(_0xc00f('0x2'));var moment=require(_0xc00f('0x3'));var BPromise=require(_0xc00f('0x4'));var rp=require(_0xc00f('0x5'));var fs=require('fs');var path=require(_0xc00f('0x6'));var rimraf=require(_0xc00f('0x7'));var config=require(_0xc00f('0x8'));var attributes=require(_0xc00f('0x9'));module[_0xc00f('0xa')]=function(_0x3662bf,_0x4813f8){return _0x3662bf[_0xc00f('0xb')](_0xc00f('0xc'),attributes,{'tableName':_0xc00f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc00f('0xe'),'collate':_0xc00f('0xf'),'hooks':{'beforeUpdate':function(_0x9620f2,_0x13180e,_0xc62134){if(_0x9620f2[_0xc00f('0x10')](_0xc00f('0x11'))){_0x9620f2[_0xc00f('0x12')]=moment()[_0xc00f('0x13')](_0xc00f('0x14'));}_0xc62134(null,_0x9620f2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 544bbfe..d4ca4e7 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 _0xad07=['attributes','limit','stringify','catch','AddTagsToOpenchannelInteraction','where','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw'];(function(_0x2483f6,_0x70bc75){var _0x44f7b9=function(_0x42aa04){while(--_0x42aa04){_0x2483f6['push'](_0x2483f6['shift']());}};_0x44f7b9(++_0x70bc75);}(_0xad07,0x87));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7ad0('0x0'));var moment=require(_0x7ad0('0x1'));var BPromise=require(_0x7ad0('0x2'));var rs=require(_0x7ad0('0x3'));var fs=require('fs');var Redis=require(_0x7ad0('0x4'));var db=require(_0x7ad0('0x5'))['db'];var utils=require(_0x7ad0('0x6'));var logger=require(_0x7ad0('0x7'))(_0x7ad0('0x8'));var config=require(_0x7ad0('0x9'));var jayson=require(_0x7ad0('0xa'));var client=jayson[_0x7ad0('0xb')]['http']({'port':0x232a});config[_0x7ad0('0xc')]=_[_0x7ad0('0xd')](config[_0x7ad0('0xc')],{'host':_0x7ad0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ad0('0xc')]));require(_0x7ad0('0xf'))['register'](socket);function respondWithRpcPromise(_0x16e2f8,_0x177ad1,_0x4079e8){return new BPromise(function(_0x564e54,_0xc07da6){return client[_0x7ad0('0x10')](_0x16e2f8,_0x4079e8)[_0x7ad0('0x11')](function(_0x4df029){logger[_0x7ad0('0x12')](_0x7ad0('0x13'),_0x177ad1,'request\x20sent');logger[_0x7ad0('0x14')](_0x7ad0('0x15'),_0x177ad1,_0x7ad0('0x16'),JSON['stringify'](_0x4df029));if(_0x4df029[_0x7ad0('0x17')]){if(_0x4df029[_0x7ad0('0x17')][_0x7ad0('0x18')]===0x1f4){logger[_0x7ad0('0x17')](_0x7ad0('0x13'),_0x177ad1,_0x4df029[_0x7ad0('0x17')]['message']);return _0xc07da6(_0x4df029[_0x7ad0('0x17')][_0x7ad0('0x19')]);}logger[_0x7ad0('0x17')](_0x7ad0('0x13'),_0x177ad1,_0x4df029[_0x7ad0('0x17')][_0x7ad0('0x19')]);return _0x564e54(_0x4df029[_0x7ad0('0x17')][_0x7ad0('0x19')]);}else{logger[_0x7ad0('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x177ad1,_0x7ad0('0x16'));_0x564e54(_0x4df029[_0x7ad0('0x1a')][_0x7ad0('0x19')]);}})['catch'](function(_0x236e0a){logger[_0x7ad0('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x177ad1,_0x236e0a);_0xc07da6(_0x236e0a);});});}exports[_0x7ad0('0x1b')]=function(_0x44a865){var _0x5d265b=this;return new Promise(function(_0x3f4731,_0x595913){return db[_0x7ad0('0x1c')][_0x7ad0('0x1d')](_0x44a865[_0x7ad0('0x1e')],{'raw':_0x44a865[_0x7ad0('0x1f')]?_0x44a865[_0x7ad0('0x1f')][_0x7ad0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a865[_0x7ad0('0x1f')]?_0x44a865[_0x7ad0('0x1f')]['where']||null:null,'attributes':_0x44a865[_0x7ad0('0x1f')]?_0x44a865[_0x7ad0('0x1f')][_0x7ad0('0x21')]||null:null,'limit':_0x44a865['options']?_0x44a865['options'][_0x7ad0('0x22')]||null:null})['then'](function(_0x469ef2){logger[_0x7ad0('0x12')](_0x7ad0('0x1b'),_0x44a865);logger[_0x7ad0('0x14')](_0x7ad0('0x1b'),_0x44a865,JSON[_0x7ad0('0x23')](_0x469ef2));_0x3f4731(_0x469ef2);})[_0x7ad0('0x24')](function(_0x2c0d73){logger[_0x7ad0('0x17')](_0x7ad0('0x1b'),_0x2c0d73['message'],_0x44a865);_0x595913(_0x5d265b['error'](0x1f4,_0x2c0d73[_0x7ad0('0x19')]));});});};exports[_0x7ad0('0x25')]=function(_0x17d4dd){return new Promise(function(_0x54322e,_0xb4050c){return db[_0x7ad0('0x1c')]['find']({'where':_0x17d4dd[_0x7ad0('0x1f')]?_0x17d4dd[_0x7ad0('0x1f')][_0x7ad0('0x26')]||null:null})['then'](function(_0x3cfdf9){if(_0x3cfdf9){return _0x3cfdf9['addTags'](_0x17d4dd[_0x7ad0('0x1e')]['ids'],_[_0x7ad0('0x27')](_0x17d4dd[_0x7ad0('0x1e')],['ids','id'])||{});}})[_0x7ad0('0x28')](function(_0x48db70){logger[_0x7ad0('0x12')](_0x7ad0('0x29'),_0x17d4dd);logger[_0x7ad0('0x14')](_0x7ad0('0x29'),_0x17d4dd,JSON[_0x7ad0('0x23')](_0x48db70));_0x54322e(_0x48db70);})['catch'](function(_0x1ed5f7){logger[_0x7ad0('0x17')](_0x7ad0('0x29'),_0x1ed5f7[_0x7ad0('0x19')],_0x17d4dd);_0xb4050c(_this[_0x7ad0('0x17')](0x1f4,_0x1ed5f7[_0x7ad0('0x19')]));});});}; \ No newline at end of file +var _0xe192=['../../config/utils','../../config/logger','client','http','redis','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','bluebird','ioredis'];(function(_0x159395,_0x2457c8){var _0x44e2af=function(_0x30e137){while(--_0x30e137){_0x159395['push'](_0x159395['shift']());}};_0x44e2af(++_0x2457c8);}(_0xe192,0x1b8));var _0x2e19=function(_0x502b80,_0x4b7c9a){_0x502b80=_0x502b80-0x0;var _0x2e6df8=_0xe192[_0x502b80];return _0x2e6df8;};'use strict';var _=require(_0x2e19('0x0'));var util=require(_0x2e19('0x1'));var moment=require('moment');var BPromise=require(_0x2e19('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e19('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e19('0x4'));var logger=require(_0x2e19('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e19('0x6')][_0x2e19('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2e19('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e19('0x8')]));require('./openchannelInteraction.socket')[_0x2e19('0x9')](socket);function respondWithRpcPromise(_0x18931a,_0x54bd9f,_0x3fa7fe){return new BPromise(function(_0x55dff5,_0x411aee){return client[_0x2e19('0xa')](_0x18931a,_0x3fa7fe)[_0x2e19('0xb')](function(_0x2920b7){logger[_0x2e19('0xc')](_0x2e19('0xd'),_0x54bd9f,_0x2e19('0xe'));logger[_0x2e19('0xf')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x54bd9f,_0x2e19('0xe'),JSON[_0x2e19('0x10')](_0x2920b7));if(_0x2920b7[_0x2e19('0x11')]){if(_0x2920b7[_0x2e19('0x11')][_0x2e19('0x12')]===0x1f4){logger[_0x2e19('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x54bd9f,_0x2920b7[_0x2e19('0x11')][_0x2e19('0x13')]);return _0x411aee(_0x2920b7[_0x2e19('0x11')][_0x2e19('0x13')]);}logger[_0x2e19('0x11')](_0x2e19('0xd'),_0x54bd9f,_0x2920b7['error']['message']);return _0x55dff5(_0x2920b7[_0x2e19('0x11')]['message']);}else{logger[_0x2e19('0xc')]('OpenchannelInteraction,\x20%s,\x20%s',_0x54bd9f,_0x2e19('0xe'));_0x55dff5(_0x2920b7[_0x2e19('0x14')][_0x2e19('0x13')]);}})['catch'](function(_0x387a03){logger[_0x2e19('0x11')](_0x2e19('0xd'),_0x54bd9f,_0x387a03);_0x411aee(_0x387a03);});});}exports[_0x2e19('0x15')]=function(_0x54929e){var _0x214785=this;return new Promise(function(_0x33b438,_0x34165b){return db['OpenchannelInteraction'][_0x2e19('0x16')](_0x54929e[_0x2e19('0x17')],{'raw':_0x54929e[_0x2e19('0x18')]?_0x54929e[_0x2e19('0x18')][_0x2e19('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54929e[_0x2e19('0x18')]?_0x54929e[_0x2e19('0x18')][_0x2e19('0x1a')]||null:null,'attributes':_0x54929e['options']?_0x54929e[_0x2e19('0x18')]['attributes']||null:null,'limit':_0x54929e[_0x2e19('0x18')]?_0x54929e[_0x2e19('0x18')][_0x2e19('0x1b')]||null:null})[_0x2e19('0xb')](function(_0x4ae574){logger[_0x2e19('0xc')](_0x2e19('0x15'),_0x54929e);logger['debug']('UpdateOpenchannelInteraction',_0x54929e,JSON[_0x2e19('0x10')](_0x4ae574));_0x33b438(_0x4ae574);})['catch'](function(_0x531684){logger[_0x2e19('0x11')](_0x2e19('0x15'),_0x531684[_0x2e19('0x13')],_0x54929e);_0x34165b(_0x214785['error'](0x1f4,_0x531684[_0x2e19('0x13')]));});});};exports[_0x2e19('0x1c')]=function(_0x3c4490){return new Promise(function(_0x12a47d,_0x309c7a){return db[_0x2e19('0x1d')][_0x2e19('0x1e')]({'where':_0x3c4490[_0x2e19('0x18')]?_0x3c4490[_0x2e19('0x18')][_0x2e19('0x1a')]||null:null})[_0x2e19('0xb')](function(_0x2d5d20){if(_0x2d5d20){return _0x2d5d20[_0x2e19('0x1f')](_0x3c4490['body'][_0x2e19('0x20')],_[_0x2e19('0x21')](_0x3c4490[_0x2e19('0x17')],[_0x2e19('0x20'),'id'])||{});}})[_0x2e19('0x22')](function(_0xb60fed){logger[_0x2e19('0xc')]('AddTags',_0x3c4490);logger[_0x2e19('0xf')](_0x2e19('0x23'),_0x3c4490,JSON[_0x2e19('0x10')](_0xb60fed));_0x12a47d(_0xb60fed);})[_0x2e19('0x24')](function(_0x29a28e){logger['error'](_0x2e19('0x23'),_0x29a28e[_0x2e19('0x13')],_0x3c4490);_0x309c7a(_this['error'](0x1f4,_0x29a28e[_0x2e19('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index d336132..aaf7c91 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 _0x2be8=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit'];(function(_0x492c9d,_0x4ab7e6){var _0x5c5866=function(_0x4d92b8){while(--_0x4d92b8){_0x492c9d['push'](_0x492c9d['shift']());}};_0x5c5866(++_0x4ab7e6);}(_0x2be8,0x1f4));var _0x82be=function(_0x553a72,_0x120470){_0x553a72=_0x553a72-0x0;var _0x410e05=_0x2be8[_0x553a72];return _0x410e05;};'use strict';var OpenchannelInteractionEvents=require(_0x82be('0x0'));var events=['save',_0x82be('0x1'),_0x82be('0x2')];function createListener(_0x509231,_0x1934a0){return function(_0x11e857){_0x1934a0[_0x82be('0x3')](_0x509231,_0x11e857);};}function removeListener(_0x1efbac,_0x4f1c15){return function(){OpenchannelInteractionEvents[_0x82be('0x4')](_0x1efbac,_0x4f1c15);};}exports[_0x82be('0x5')]=function(_0x565393){for(var _0x5938f9=0x0,_0x458211=events[_0x82be('0x6')];_0x5938f9<_0x458211;_0x5938f9++){var _0x3313e9=events[_0x5938f9];var _0x5756a0=createListener(_0x82be('0x7')+_0x3313e9,_0x565393);OpenchannelInteractionEvents['on'](_0x3313e9,_0x5756a0);}}; \ No newline at end of file +var _0x678b=['./openchannelInteraction.events','save','emit','length','openchannelInteraction:'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x678b,0x64));var _0xb678=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x678b[_0x576170];return _0x397c70;};'use strict';var OpenchannelInteractionEvents=require(_0xb678('0x0'));var events=[_0xb678('0x1'),'remove','update'];function createListener(_0x15fe62,_0x477887){return function(_0x587860){_0x477887[_0xb678('0x2')](_0x15fe62,_0x587860);};}function removeListener(_0x56bd52,_0x3fc573){return function(){OpenchannelInteractionEvents['removeListener'](_0x56bd52,_0x3fc573);};}exports['register']=function(_0xd1446b){for(var _0x598c75=0x0,_0x407add=events[_0xb678('0x3')];_0x598c75<_0x407add;_0x598c75++){var _0x9f76ea=events[_0x598c75];var _0x2719d2=createListener(_0xb678('0x4')+_0x9f76ea,_0xd1446b);OpenchannelInteractionEvents['on'](_0x9f76ea,_0x2719d2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d3fb293..d365e5c 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b1b8e0d..af1d728 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 _0x51c5=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x1eb982,_0x1ff7f7){var _0x12281a=function(_0x35c00c){while(--_0x35c00c){_0x1eb982['push'](_0x1eb982['shift']());}};_0x12281a(++_0x1ff7f7);}(_0x51c5,0x8f));var _0x551c=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x51c5[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0x551c('0x0'));module[_0x551c('0x1')]={'body':{'type':Sequelize[_0x551c('0x2')](_0x551c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x551c('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x551c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x551c('0x5')]('in','out'),'defaultValue':_0x551c('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x551c('0x7')]},'providerName':{'type':Sequelize[_0x551c('0x8')]},'providerResponse':{'type':Sequelize[_0x551c('0x2')]}}; \ No newline at end of file +var _0xd3f5=['exports','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd3f5,0x147));var _0x5d3f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd3f5[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x5d3f('0x0'));module[_0x5d3f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5d3f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5d3f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5d3f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5d3f('0x4')]('in',_0x5d3f('0x5')),'defaultValue':_0x5d3f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5d3f('0x6')]},'providerName':{'type':Sequelize[_0x5d3f('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 9669025..96f48ef 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 _0x84e1=['map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','reject','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','name','send','index'];(function(_0x2b1d30,_0x581a26){var _0x538ba7=function(_0x3b692e){while(--_0x3b692e){_0x2b1d30['push'](_0x2b1d30['shift']());}};_0x538ba7(++_0x581a26);}(_0x84e1,0x1da));var _0x184e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x84e1[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x184e('0x0'));var rimraf=require(_0x184e('0x1'));var zipdir=require(_0x184e('0x2'));var jsonpatch=require(_0x184e('0x3'));var rp=require(_0x184e('0x4'));var moment=require(_0x184e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x184e('0x6'));var util=require(_0x184e('0x7'));var path=require('path');var sox=require(_0x184e('0x8'));var csv=require(_0x184e('0x9'));var ejs=require(_0x184e('0xa'));var fs=require('fs');var fs_extra=require(_0x184e('0xb'));var _=require('lodash');var squel=require(_0x184e('0xc'));var crypto=require(_0x184e('0xd'));var jsforce=require(_0x184e('0xe'));var deskjs=require(_0x184e('0xf'));var toCsv=require(_0x184e('0x9'));var querystring=require(_0x184e('0x10'));var Papa=require(_0x184e('0x11'));var Redis=require(_0x184e('0x12'));var authService=require(_0x184e('0x13'));var qs=require(_0x184e('0x14'));var as=require(_0x184e('0x15'));var hardwareService=require(_0x184e('0x16'));var logger=require(_0x184e('0x17'))(_0x184e('0x18'));var utils=require(_0x184e('0x19'));var config=require(_0x184e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x184e('0x1b'))['db'];config[_0x184e('0x1c')]=_[_0x184e('0x1d')](config['redis'],{'host':_0x184e('0x1e'),'port':0x18eb});var socket=require(_0x184e('0x1f'))(new Redis(config[_0x184e('0x1c')]));require(_0x184e('0x20'))['register'](socket);var jayson=require(_0x184e('0x21'));var client=jayson[_0x184e('0x22')][_0x184e('0x23')]({'port':0x232c});var client9002=jayson[_0x184e('0x22')][_0x184e('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x4841de,_0x413e36,_0x4b2246,_0x572eb8){return new BPromise(function(_0x3308c7,_0x518a05){var _0xc44a07=_0x572eb8||client;return _0xc44a07[_0x184e('0x24')](_0x4841de,_0x4b2246)[_0x184e('0x25')](function(_0x458ded){logger[_0x184e('0x26')](_0x184e('0x27'),_0x413e36,'request\x20sent');logger['debug'](_0x184e('0x28'),_0x413e36,'request\x20sent',JSON[_0x184e('0x29')](_0x458ded));if(_0x458ded['error']){if(_0x458ded[_0x184e('0x2a')][_0x184e('0x2b')]===0x1f4){logger[_0x184e('0x2a')](_0x184e('0x27'),_0x413e36,_0x458ded['error'][_0x184e('0x2c')]);return _0x518a05(_0x458ded[_0x184e('0x2a')][_0x184e('0x2c')]);}logger[_0x184e('0x2a')](_0x184e('0x27'),_0x413e36,_0x458ded['error'][_0x184e('0x2c')]);return _0x3308c7(_0x458ded['error'][_0x184e('0x2c')]);}else{logger['info'](_0x184e('0x27'),_0x413e36,_0x184e('0x2d'));_0x3308c7(_0x458ded['result'][_0x184e('0x2c')]);}})[_0x184e('0x2e')](function(_0x174b5f){logger[_0x184e('0x2a')](_0x184e('0x27'),_0x413e36,_0x174b5f);_0x518a05(_0x174b5f);});});}function respondWithStatusCode(_0x295a9b,_0x10af33){_0x10af33=_0x10af33||0xcc;return function(_0x4ba83c){if(_0x4ba83c){return _0x295a9b[_0x184e('0x2f')](_0x10af33);}return _0x295a9b[_0x184e('0x30')](_0x10af33)[_0x184e('0x31')]();};}function respondWithResult(_0x482191,_0x224baa){_0x224baa=_0x224baa||0xc8;return function(_0x58b637){if(_0x58b637){return _0x482191[_0x184e('0x30')](_0x224baa)[_0x184e('0x32')](_0x58b637);}};}function respondWithFilteredResult(_0x2f5b40,_0x3966e2){return function(_0x27a60a){if(_0x27a60a){var _0x1aa986=typeof _0x3966e2['offset']===_0x184e('0x33')&&typeof _0x3966e2['limit']===_0x184e('0x33');var _0x10d42e=_0x27a60a['count'];var _0x5e057e=_0x1aa986?0x0:_0x3966e2['offset'];var _0x4c57ba=_0x1aa986?_0x27a60a[_0x184e('0x34')]:_0x3966e2[_0x184e('0x35')]+_0x3966e2[_0x184e('0x36')];var _0x45f0a9;if(_0x4c57ba>=_0x10d42e){_0x4c57ba=_0x10d42e;_0x45f0a9=0xc8;}else{_0x45f0a9=0xce;}_0x2f5b40[_0x184e('0x30')](_0x45f0a9);return _0x2f5b40[_0x184e('0x37')](_0x184e('0x38'),_0x5e057e+'-'+_0x4c57ba+'/'+_0x10d42e)[_0x184e('0x32')](_0x27a60a);}return null;};}function patchUpdates(_0x3b5816){return function(_0x315f70){try{jsonpatch['apply'](_0x315f70,_0x3b5816,!![]);}catch(_0x1499e7){return BPromise['reject'](_0x1499e7);}return _0x315f70['save']();};}function saveUpdates(_0x131b69,_0xfc6b2b){return function(_0x3fc85f){if(_0x3fc85f){return _0x3fc85f[_0x184e('0x39')](_0x131b69)[_0x184e('0x25')](function(_0xbf259e){return _0xbf259e;});}return null;};}function removeEntity(_0x9866f8,_0x2414ac){return function(_0x273035){if(_0x273035){return _0x273035[_0x184e('0x3a')]()[_0x184e('0x25')](function(){_0x9866f8[_0x184e('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x391e41,_0x5976ea){return function(_0x48f0a){if(!_0x48f0a){_0x391e41[_0x184e('0x2f')](0x194);}return _0x48f0a;};}function handleError(_0x54abba,_0x4570fe){_0x4570fe=_0x4570fe||0x1f4;return function(_0x468207){logger[_0x184e('0x2a')](_0x468207['stack']);if(_0x468207[_0x184e('0x3b')]){delete _0x468207[_0x184e('0x3b')];}_0x54abba[_0x184e('0x30')](_0x4570fe)[_0x184e('0x3c')](_0x468207);};}exports[_0x184e('0x3d')]=function(_0x215730,_0x2febb6){var _0x5d2b28={},_0x5f4557={},_0x1718de={'count':0x0,'rows':[]};var _0x515ae9=_[_0x184e('0x3e')](db[_0x184e('0x3f')][_0x184e('0x40')],function(_0x32625b){return{'name':_0x32625b[_0x184e('0x41')],'type':_0x32625b[_0x184e('0x42')][_0x184e('0x43')]};});_0x5f4557['model']=_[_0x184e('0x3e')](_0x515ae9,'name');_0x5f4557[_0x184e('0x44')]=_[_0x184e('0x45')](_0x215730[_0x184e('0x44')]);_0x5f4557[_0x184e('0x46')]=_[_0x184e('0x47')](_0x5f4557[_0x184e('0x48')],_0x5f4557['query']);_0x5d2b28[_0x184e('0x49')]=_[_0x184e('0x47')](_0x5f4557[_0x184e('0x48')],qs[_0x184e('0x4a')](_0x215730['query'][_0x184e('0x4a')]));_0x5d2b28[_0x184e('0x49')]=_0x5d2b28[_0x184e('0x49')][_0x184e('0x4b')]?_0x5d2b28[_0x184e('0x49')]:_0x5f4557[_0x184e('0x48')];if(!_0x215730[_0x184e('0x44')]['hasOwnProperty']('nolimit')){_0x5d2b28[_0x184e('0x36')]=qs[_0x184e('0x36')](_0x215730[_0x184e('0x44')][_0x184e('0x36')]);_0x5d2b28['offset']=qs[_0x184e('0x35')](_0x215730[_0x184e('0x44')][_0x184e('0x35')]);}_0x5d2b28['order']=qs[_0x184e('0x4c')](_0x215730['query'][_0x184e('0x4c')]);_0x5d2b28['where']=qs[_0x184e('0x46')](_[_0x184e('0x4d')](_0x215730['query'],_0x5f4557[_0x184e('0x46')]),_0x515ae9);if(_0x215730[_0x184e('0x44')][_0x184e('0x4e')]){_0x5d2b28[_0x184e('0x4f')]=_[_0x184e('0x50')](_0x5d2b28[_0x184e('0x4f')],{'$or':_[_0x184e('0x3e')](_0x515ae9,function(_0x2b184b){if(_0x2b184b[_0x184e('0x42')]!==_0x184e('0x51')){var _0x400ad4={};_0x400ad4[_0x2b184b[_0x184e('0x3b')]]={'$like':'%'+_0x215730[_0x184e('0x44')][_0x184e('0x4e')]+'%'};return _0x400ad4;}})});}_0x5d2b28=_['merge']({},_0x5d2b28,_0x215730['options']);var _0x1010c2={'where':_0x5d2b28[_0x184e('0x4f')]};return db[_0x184e('0x3f')][_0x184e('0x34')](_0x1010c2)[_0x184e('0x25')](function(_0x4f72ea){_0x1718de[_0x184e('0x34')]=_0x4f72ea;if(_0x215730['query'][_0x184e('0x52')]){_0x5d2b28['include']=[{'all':!![]}];}return db[_0x184e('0x3f')][_0x184e('0x53')](_0x5d2b28);})[_0x184e('0x25')](function(_0x4acbc3){_0x1718de[_0x184e('0x54')]=_0x4acbc3;return _0x1718de;})[_0x184e('0x25')](respondWithFilteredResult(_0x2febb6,_0x5d2b28))[_0x184e('0x2e')](handleError(_0x2febb6,null));};exports[_0x184e('0x55')]=function(_0x3081be,_0x23f7e2){var _0x32311d={'raw':!![],'where':{'id':_0x3081be[_0x184e('0x56')]['id']}},_0xadbe9f={};_0xadbe9f[_0x184e('0x48')]=_[_0x184e('0x45')](db[_0x184e('0x3f')]['rawAttributes']);_0xadbe9f['query']=_[_0x184e('0x45')](_0x3081be['query']);_0xadbe9f[_0x184e('0x46')]=_['intersection'](_0xadbe9f[_0x184e('0x48')],_0xadbe9f[_0x184e('0x44')]);_0x32311d['attributes']=_['intersection'](_0xadbe9f[_0x184e('0x48')],qs[_0x184e('0x4a')](_0x3081be['query'][_0x184e('0x4a')]));_0x32311d[_0x184e('0x49')]=_0x32311d[_0x184e('0x49')][_0x184e('0x4b')]?_0x32311d['attributes']:_0xadbe9f[_0x184e('0x48')];if(_0x3081be['query']['includeAll']){_0x32311d[_0x184e('0x57')]=[{'all':!![]}];}_0x32311d=_[_0x184e('0x50')]({},_0x32311d,_0x3081be['options']);return db[_0x184e('0x3f')][_0x184e('0x58')](_0x32311d)['then'](handleEntityNotFound(_0x23f7e2,null))[_0x184e('0x25')](respondWithResult(_0x23f7e2,null))['catch'](handleError(_0x23f7e2,null));};exports[_0x184e('0x59')]=function(_0x5d0f00,_0x509508){return db[_0x184e('0x3f')][_0x184e('0x59')](_0x5d0f00['body'],{})[_0x184e('0x25')](respondWithResult(_0x509508,0xc9))[_0x184e('0x2e')](handleError(_0x509508,null));};exports[_0x184e('0x39')]=function(_0x1bc833,_0x38a1f5){if(_0x1bc833[_0x184e('0x5a')]['id']){delete _0x1bc833[_0x184e('0x5a')]['id'];}return db[_0x184e('0x3f')][_0x184e('0x58')]({'where':{'id':_0x1bc833[_0x184e('0x56')]['id']}})['then'](handleEntityNotFound(_0x38a1f5,null))[_0x184e('0x25')](saveUpdates(_0x1bc833[_0x184e('0x5a')],null))[_0x184e('0x25')](respondWithResult(_0x38a1f5,null))['catch'](handleError(_0x38a1f5,null));};exports[_0x184e('0x3a')]=function(_0x369505,_0x1ad35e){return db['OpenchannelMessage'][_0x184e('0x58')]({'where':{'id':_0x369505[_0x184e('0x56')]['id']}})[_0x184e('0x25')](handleEntityNotFound(_0x1ad35e,null))[_0x184e('0x25')](removeEntity(_0x1ad35e,null))[_0x184e('0x2e')](handleError(_0x1ad35e,null));};exports[_0x184e('0x5b')]=function(_0x13048d,_0x598cc9){return db[_0x184e('0x3f')][_0x184e('0x5b')]()[_0x184e('0x25')](respondWithResult(_0x598cc9,null))[_0x184e('0x2e')](handleError(_0x598cc9,null));};var interaction_log=require(_0x184e('0x17'))(_0x184e('0x5c'));exports[_0x184e('0x5d')]=function(_0x4ce933,_0x5e8655,_0x5923c4){var _0x4f7331={'agent':{},'channel':_0x184e('0x5e')};if(_0x4ce933['body']['id']){delete _0x4ce933[_0x184e('0x5a')]['id'];}_0x4ce933['body'][_0x184e('0x5f')]=!![];_0x4ce933[_0x184e('0x5a')][_0x184e('0x60')]=moment()[_0x184e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ce933['body'][_0x184e('0x62')]=_0x4ce933['body']['UserId']||_0x4ce933[_0x184e('0x63')]['id'];_0x4f7331[_0x184e('0x64')]['id']=_0x4ce933[_0x184e('0x5a')]['UserId'];return db['OpenchannelMessage'][_0x184e('0x58')]({'where':{'id':_0x4ce933[_0x184e('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5e8655,null))[_0x184e('0x25')](saveUpdates(_0x4ce933['body'],null))[_0x184e('0x25')](function(_0xcb3231){if(_0xcb3231){_0x4f7331[_0x184e('0x2c')]=_0xcb3231[_0x184e('0x65')]({'plain':!![]});return db[_0x184e('0x66')][_0x184e('0x58')]({'where':{'id':_0xcb3231[_0x184e('0x67')]}});}return null;})[_0x184e('0x25')](handleEntityNotFound(_0x5e8655,null))['then'](function(_0x3aeb7e){if(_0x3aeb7e){return _0x3aeb7e[_0x184e('0x39')]({'UserId':_0x4ce933['body'][_0x184e('0x62')],'read1stAt':_['isNil'](_0x3aeb7e[_0x184e('0x68')])?moment()[_0x184e('0x61')](_0x184e('0x69')):undefined});}return null;})[_0x184e('0x25')](function(_0x3d500e){if(_0x3d500e){_0x4f7331[_0x184e('0x6a')]=_0x3d500e['get']({'plain':!![]});interaction_log[_0x184e('0x26')](_0x184e('0x6b'),_0x4ce933[_0x184e('0x63')]['id'],_0x4ce933['user'][_0x184e('0x3b')],_0x4ce933[_0x184e('0x63')][_0x184e('0x6c')],_0x4f7331['interaction']['id'],_0x4ce933[_0x184e('0x5a')]?JSON[_0x184e('0x29')](_0x4ce933[_0x184e('0x5a')]):'null');return respondWithRpcPromise(_0x184e('0x6d'),_0x184e('0x6e'),_0x4f7331);}return null;})['then'](function(_0x16ed20){var _0x2aac6a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x16ed20[_0x184e('0x2c')][_0x184e('0x6f')];return db['sequelize'][_0x184e('0x44')](_0x2aac6a,{'type':db['Sequelize'][_0x184e('0x70')][_0x184e('0x71')],'raw':!![]})['then'](function(_0x18b4ab){return _0x18b4ab;});})[_0x184e('0x25')](function(_0x32a251){if(_0x32a251){_0x4f7331[_0x184e('0x2c')][_0x184e('0x72')]=_0x32a251[0x0];if(!_0x4ce933[_0x184e('0x5a')][_0x184e('0x62')])return;return db[_0x184e('0x73')][_0x184e('0x58')]({'where':{'id':_0x4ce933[_0x184e('0x5a')][_0x184e('0x62')],'role':'agent'},'attributes':['id',_0x184e('0x3b'),_0x184e('0x74'),_0x184e('0x75'),_0x184e('0x76')],'raw':!![]});}return null;})[_0x184e('0x25')](function(_0x432633){if(!_0x432633)return null;_0x4f7331['message'][_0x184e('0x64')]=_0x432633;return _0x4f7331;})[_0x184e('0x25')](function(_0xf0c568){if(_0xf0c568){if(_0x4ce933[_0x184e('0x5a')][_0x184e('0x77')]){_0x4f7331['message'][_0x184e('0x78')]=util[_0x184e('0x61')](_0x184e('0x79'),_0x4ce933[_0x184e('0x63')][_0x184e('0x3b')]);_0x4f7331[_0x184e('0x2c')][_0x184e('0x7a')]=_0x4f7331[_0x184e('0x7a')];_0x4f7331[_0x184e('0x2c')][_0x184e('0x7b')]=_0x4f7331[_0x184e('0x7a')];_0x4f7331[_0x184e('0x2c')][_0x184e('0x7c')]=_0x184e('0x5d');return respondWithRpcPromise(_0x184e('0x7d'),_0x184e('0x7d'),{'event':_0x184e('0x7e'),'message':_0x4f7331[_0x184e('0x2c')]},client9002)[_0x184e('0x25')](function(){return _0x4f7331;});}return _0x4f7331;}return null;})[_0x184e('0x25')](respondWithResult(_0x5e8655,null))[_0x184e('0x2e')](handleError(_0x5e8655,null));};var interaction_log=require(_0x184e('0x17'))(_0x184e('0x5c'));exports['reject']=function(_0x4f5e35,_0x4d8765,_0x2a6f1b){var _0x542bff={'agent':{},'channel':_0x184e('0x5e')};if(_0x4f5e35[_0x184e('0x5a')]['id']){delete _0x4f5e35['body']['id'];}_0x4f5e35[_0x184e('0x5a')][_0x184e('0x62')]=_0x4f5e35[_0x184e('0x5a')]['UserId']||_0x4f5e35['user']['id'];_0x542bff[_0x184e('0x64')]['id']=_0x4f5e35[_0x184e('0x5a')][_0x184e('0x62')];return db[_0x184e('0x3f')][_0x184e('0x58')]({'where':{'id':_0x4f5e35[_0x184e('0x56')]['id'],'UserId':null}})[_0x184e('0x25')](handleEntityNotFound(_0x4d8765,null))[_0x184e('0x25')](function(_0x5085ef){if(_0x5085ef){_0x542bff['message']=_0x5085ef[_0x184e('0x65')]({'plain':!![]});return db[_0x184e('0x66')][_0x184e('0x58')]({'where':{'id':_0x5085ef[_0x184e('0x67')]}});}return null;})[_0x184e('0x25')](handleEntityNotFound(_0x4d8765,null))[_0x184e('0x25')](function(_0x19104d){if(_0x19104d){_0x542bff[_0x184e('0x6a')]=_0x19104d[_0x184e('0x65')]({'plain':!![]});interaction_log[_0x184e('0x26')](_0x184e('0x7f'),_0x4f5e35[_0x184e('0x63')]['id'],_0x4f5e35[_0x184e('0x63')][_0x184e('0x3b')],_0x4f5e35[_0x184e('0x63')][_0x184e('0x6c')],_0x542bff['interaction']['id'],_0x4f5e35['body']?JSON['stringify'](_0x4f5e35[_0x184e('0x5a')]):_0x184e('0x80'));return respondWithRpcPromise('RejectMessage',_0x184e('0x81'),_0x542bff);}return null;})['then'](function(_0x10f2c1){var _0x50111c=_0x184e('0x82')+_0x10f2c1[_0x184e('0x2c')][_0x184e('0x6f')];return db[_0x184e('0x83')][_0x184e('0x44')](_0x50111c,{'type':db[_0x184e('0x84')][_0x184e('0x70')][_0x184e('0x71')],'raw':!![]})['then'](function(_0x414980){return _0x414980;});})[_0x184e('0x25')](function(_0x53f276){if(_0x53f276){_0x542bff[_0x184e('0x2c')]['contact']=_0x53f276[0x0];if(!_0x4f5e35['body'][_0x184e('0x62')])return;return db[_0x184e('0x73')]['find']({'where':{'id':_0x4f5e35[_0x184e('0x5a')]['UserId'],'role':_0x184e('0x64')},'attributes':['id','name',_0x184e('0x74'),_0x184e('0x75'),_0x184e('0x76')],'raw':!![]});}return null;})[_0x184e('0x25')](function(_0x2c9554){if(!_0x2c9554)return null;_0x542bff[_0x184e('0x2c')][_0x184e('0x64')]=_0x2c9554;return _0x542bff;})[_0x184e('0x25')](function(_0x4fe4c4){if(_0x4fe4c4){_0x4fe4c4[_0x184e('0x2c')][_0x184e('0x78')]=util[_0x184e('0x61')](_0x184e('0x79'),_0x4f5e35[_0x184e('0x63')][_0x184e('0x3b')]);_0x4fe4c4['message']['channel']=_0x542bff[_0x184e('0x7a')];_0x4fe4c4[_0x184e('0x2c')]['motionChannel']=_0x542bff['channel'];_0x4fe4c4['message'][_0x184e('0x7c')]=_0x184e('0x85');respondWithRpcPromise(_0x184e('0x7d'),_0x184e('0x7d'),{'event':'rejectmessage','message':_0x4fe4c4['message']},client9002);return _0x542bff;}return null;})[_0x184e('0x25')](respondWithResult(_0x4d8765,null))[_0x184e('0x2e')](handleError(_0x4d8765,null));}; \ No newline at end of file +var _0x7212=['rejectMessage','ContactId','contact','eml-format','request-promise','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','keys','query','filters','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','intersection','length','find','create','body','destroy','openchannel-interactions','openchannel','readAt','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x1032bf,_0x44910a){var _0x2aa822=function(_0x40104b){while(--_0x40104b){_0x1032bf['push'](_0x1032bf['shift']());}};_0x2aa822(++_0x44910a);}(_0x7212,0x1e3));var _0x2721=function(_0x2b4ac6,_0x4baabb){_0x2b4ac6=_0x2b4ac6-0x0;var _0x4ef86b=_0x7212[_0x2b4ac6];return _0x4ef86b;};'use strict';var emlformat=require(_0x2721('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2721('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2721('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0x2721('0x3'));var ejs=require(_0x2721('0x4'));var fs=require('fs');var fs_extra=require(_0x2721('0x5'));var _=require('lodash');var squel=require(_0x2721('0x6'));var crypto=require(_0x2721('0x7'));var jsforce=require(_0x2721('0x8'));var deskjs=require(_0x2721('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2721('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2721('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2721('0xc'))(_0x2721('0xd'));var utils=require(_0x2721('0xe'));var config=require(_0x2721('0xf'));var licenseUtil=require(_0x2721('0x10'));var db=require(_0x2721('0x11'))['db'];config['redis']=_['defaults'](config[_0x2721('0x12')],{'host':_0x2721('0x13'),'port':0x18eb});var socket=require(_0x2721('0x14'))(new Redis(config[_0x2721('0x12')]));require(_0x2721('0x15'))[_0x2721('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2721('0x17')]['http']({'port':0x232c});var client9002=jayson[_0x2721('0x17')][_0x2721('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xae4f44,_0x1a0dbb,_0x79c2e,_0xd860ff){return new BPromise(function(_0x1b9fe1,_0x172d26){var _0x2ff05c=_0xd860ff||client;return _0x2ff05c[_0x2721('0x19')](_0xae4f44,_0x79c2e)[_0x2721('0x1a')](function(_0x186285){logger['info'](_0x2721('0x1b'),_0x1a0dbb,_0x2721('0x1c'));logger[_0x2721('0x1d')](_0x2721('0x1e'),_0x1a0dbb,'request\x20sent',JSON[_0x2721('0x1f')](_0x186285));if(_0x186285[_0x2721('0x20')]){if(_0x186285[_0x2721('0x20')][_0x2721('0x21')]===0x1f4){logger['error'](_0x2721('0x1b'),_0x1a0dbb,_0x186285['error'][_0x2721('0x22')]);return _0x172d26(_0x186285[_0x2721('0x20')][_0x2721('0x22')]);}logger[_0x2721('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x1a0dbb,_0x186285['error'][_0x2721('0x22')]);return _0x1b9fe1(_0x186285[_0x2721('0x20')][_0x2721('0x22')]);}else{logger['info'](_0x2721('0x1b'),_0x1a0dbb,_0x2721('0x1c'));_0x1b9fe1(_0x186285[_0x2721('0x23')]['message']);}})['catch'](function(_0x28c968){logger[_0x2721('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x1a0dbb,_0x28c968);_0x172d26(_0x28c968);});});}function respondWithStatusCode(_0xef2b48,_0x3e7028){_0x3e7028=_0x3e7028||0xcc;return function(_0x500f83){if(_0x500f83){return _0xef2b48[_0x2721('0x24')](_0x3e7028);}return _0xef2b48[_0x2721('0x25')](_0x3e7028)[_0x2721('0x26')]();};}function respondWithResult(_0x36f2c9,_0x27c083){_0x27c083=_0x27c083||0xc8;return function(_0x3a556a){if(_0x3a556a){return _0x36f2c9[_0x2721('0x25')](_0x27c083)[_0x2721('0x27')](_0x3a556a);}};}function respondWithFilteredResult(_0x396b9c,_0x2ae791){return function(_0x3f56a9){if(_0x3f56a9){var _0x49437c=typeof _0x2ae791[_0x2721('0x28')]==='undefined'&&typeof _0x2ae791[_0x2721('0x29')]===_0x2721('0x2a');var _0x1c5e49=_0x3f56a9[_0x2721('0x2b')];var _0xec099b=_0x49437c?0x0:_0x2ae791['offset'];var _0x2871ec=_0x49437c?_0x3f56a9[_0x2721('0x2b')]:_0x2ae791[_0x2721('0x28')]+_0x2ae791[_0x2721('0x29')];var _0xbbf12f;if(_0x2871ec>=_0x1c5e49){_0x2871ec=_0x1c5e49;_0xbbf12f=0xc8;}else{_0xbbf12f=0xce;}_0x396b9c[_0x2721('0x25')](_0xbbf12f);return _0x396b9c[_0x2721('0x2c')]('Content-Range',_0xec099b+'-'+_0x2871ec+'/'+_0x1c5e49)[_0x2721('0x27')](_0x3f56a9);}return null;};}function patchUpdates(_0x5ad530){return function(_0x27cb59){try{jsonpatch[_0x2721('0x2d')](_0x27cb59,_0x5ad530,!![]);}catch(_0x42dda5){return BPromise[_0x2721('0x2e')](_0x42dda5);}return _0x27cb59['save']();};}function saveUpdates(_0x442b93,_0xeae5d4){return function(_0x48ca46){if(_0x48ca46){return _0x48ca46[_0x2721('0x2f')](_0x442b93)[_0x2721('0x1a')](function(_0x3df767){return _0x3df767;});}return null;};}function removeEntity(_0xee379c,_0x327c8c){return function(_0x4a10e1){if(_0x4a10e1){return _0x4a10e1['destroy']()['then'](function(){_0xee379c[_0x2721('0x25')](0xcc)[_0x2721('0x26')]();});}};}function handleEntityNotFound(_0x9204a7,_0x17214b){return function(_0x3680d3){if(!_0x3680d3){_0x9204a7['sendStatus'](0x194);}return _0x3680d3;};}function handleError(_0x143098,_0x1826ad){_0x1826ad=_0x1826ad||0x1f4;return function(_0x25aee9){logger[_0x2721('0x20')](_0x25aee9[_0x2721('0x30')]);if(_0x25aee9['name']){delete _0x25aee9[_0x2721('0x31')];}_0x143098[_0x2721('0x25')](_0x1826ad)['send'](_0x25aee9);};}exports[_0x2721('0x32')]=function(_0xb9e986,_0x575a17){var _0x5c4562={},_0x519a15={},_0x1050a4={'count':0x0,'rows':[]};var _0x483a17=_[_0x2721('0x33')](db[_0x2721('0x34')][_0x2721('0x35')],function(_0x46786b){return{'name':_0x46786b[_0x2721('0x36')],'type':_0x46786b[_0x2721('0x37')][_0x2721('0x38')]};});_0x519a15['model']=_[_0x2721('0x33')](_0x483a17,_0x2721('0x31'));_0x519a15['query']=_[_0x2721('0x39')](_0xb9e986[_0x2721('0x3a')]);_0x519a15[_0x2721('0x3b')]=_['intersection'](_0x519a15['model'],_0x519a15['query']);_0x5c4562[_0x2721('0x3c')]=_['intersection'](_0x519a15[_0x2721('0x3d')],qs[_0x2721('0x3e')](_0xb9e986[_0x2721('0x3a')][_0x2721('0x3e')]));_0x5c4562['attributes']=_0x5c4562[_0x2721('0x3c')]['length']?_0x5c4562[_0x2721('0x3c')]:_0x519a15[_0x2721('0x3d')];if(!_0xb9e986['query'][_0x2721('0x3f')](_0x2721('0x40'))){_0x5c4562[_0x2721('0x29')]=qs[_0x2721('0x29')](_0xb9e986[_0x2721('0x3a')][_0x2721('0x29')]);_0x5c4562[_0x2721('0x28')]=qs[_0x2721('0x28')](_0xb9e986[_0x2721('0x3a')][_0x2721('0x28')]);}_0x5c4562['order']=qs[_0x2721('0x41')](_0xb9e986[_0x2721('0x3a')][_0x2721('0x41')]);_0x5c4562[_0x2721('0x42')]=qs[_0x2721('0x3b')](_[_0x2721('0x43')](_0xb9e986[_0x2721('0x3a')],_0x519a15['filters']),_0x483a17);if(_0xb9e986[_0x2721('0x3a')]['filter']){_0x5c4562[_0x2721('0x42')]=_['merge'](_0x5c4562[_0x2721('0x42')],{'$or':_[_0x2721('0x33')](_0x483a17,function(_0xd22b6a){if(_0xd22b6a[_0x2721('0x37')]!=='VIRTUAL'){var _0x4c22f4={};_0x4c22f4[_0xd22b6a[_0x2721('0x31')]]={'$like':'%'+_0xb9e986['query'][_0x2721('0x44')]+'%'};return _0x4c22f4;}})});}_0x5c4562=_[_0x2721('0x45')]({},_0x5c4562,_0xb9e986[_0x2721('0x46')]);var _0x3096ce={'where':_0x5c4562['where']};return db[_0x2721('0x34')]['count'](_0x3096ce)[_0x2721('0x1a')](function(_0x52ddfb){_0x1050a4[_0x2721('0x2b')]=_0x52ddfb;if(_0xb9e986[_0x2721('0x3a')][_0x2721('0x47')]){_0x5c4562[_0x2721('0x48')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x2721('0x49')](_0x5c4562);})['then'](function(_0x1d848d){_0x1050a4[_0x2721('0x4a')]=_0x1d848d;return _0x1050a4;})[_0x2721('0x1a')](respondWithFilteredResult(_0x575a17,_0x5c4562))[_0x2721('0x4b')](handleError(_0x575a17,null));};exports['show']=function(_0x466ea7,_0x3bf7c1){var _0x28bc7f={'raw':!![],'where':{'id':_0x466ea7[_0x2721('0x4c')]['id']}},_0x593b33={};_0x593b33[_0x2721('0x3d')]=_[_0x2721('0x39')](db['OpenchannelMessage'][_0x2721('0x35')]);_0x593b33[_0x2721('0x3a')]=_[_0x2721('0x39')](_0x466ea7['query']);_0x593b33[_0x2721('0x3b')]=_[_0x2721('0x4d')](_0x593b33[_0x2721('0x3d')],_0x593b33[_0x2721('0x3a')]);_0x28bc7f[_0x2721('0x3c')]=_[_0x2721('0x4d')](_0x593b33[_0x2721('0x3d')],qs[_0x2721('0x3e')](_0x466ea7[_0x2721('0x3a')][_0x2721('0x3e')]));_0x28bc7f[_0x2721('0x3c')]=_0x28bc7f['attributes'][_0x2721('0x4e')]?_0x28bc7f[_0x2721('0x3c')]:_0x593b33['model'];if(_0x466ea7[_0x2721('0x3a')]['includeAll']){_0x28bc7f[_0x2721('0x48')]=[{'all':!![]}];}_0x28bc7f=_[_0x2721('0x45')]({},_0x28bc7f,_0x466ea7['options']);return db[_0x2721('0x34')][_0x2721('0x4f')](_0x28bc7f)[_0x2721('0x1a')](handleEntityNotFound(_0x3bf7c1,null))[_0x2721('0x1a')](respondWithResult(_0x3bf7c1,null))['catch'](handleError(_0x3bf7c1,null));};exports[_0x2721('0x50')]=function(_0x2ecd12,_0x474ddd){return db['OpenchannelMessage'][_0x2721('0x50')](_0x2ecd12[_0x2721('0x51')],{})[_0x2721('0x1a')](respondWithResult(_0x474ddd,0xc9))[_0x2721('0x4b')](handleError(_0x474ddd,null));};exports[_0x2721('0x2f')]=function(_0x314632,_0x21628c){if(_0x314632[_0x2721('0x51')]['id']){delete _0x314632[_0x2721('0x51')]['id'];}return db[_0x2721('0x34')][_0x2721('0x4f')]({'where':{'id':_0x314632['params']['id']}})[_0x2721('0x1a')](handleEntityNotFound(_0x21628c,null))['then'](saveUpdates(_0x314632['body'],null))[_0x2721('0x1a')](respondWithResult(_0x21628c,null))['catch'](handleError(_0x21628c,null));};exports[_0x2721('0x52')]=function(_0x2fbabb,_0x163587){return db[_0x2721('0x34')][_0x2721('0x4f')]({'where':{'id':_0x2fbabb['params']['id']}})['then'](handleEntityNotFound(_0x163587,null))['then'](removeEntity(_0x163587,null))[_0x2721('0x4b')](handleError(_0x163587,null));};exports['describe']=function(_0x571fa2,_0x1eb020){return db[_0x2721('0x34')]['describe']()[_0x2721('0x1a')](respondWithResult(_0x1eb020,null))[_0x2721('0x4b')](handleError(_0x1eb020,null));};var interaction_log=require(_0x2721('0xc'))(_0x2721('0x53'));exports['accept']=function(_0x1b2607,_0x26e596,_0x39a37b){var _0x72359d={'agent':{},'channel':_0x2721('0x54')};if(_0x1b2607[_0x2721('0x51')]['id']){delete _0x1b2607['body']['id'];}_0x1b2607[_0x2721('0x51')]['read']=!![];_0x1b2607['body'][_0x2721('0x55')]=moment()[_0x2721('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b2607['body']['UserId']=_0x1b2607[_0x2721('0x51')][_0x2721('0x57')]||_0x1b2607[_0x2721('0x58')]['id'];_0x72359d['agent']['id']=_0x1b2607['body']['UserId'];return db[_0x2721('0x34')][_0x2721('0x4f')]({'where':{'id':_0x1b2607['params']['id'],'UserId':null}})[_0x2721('0x1a')](handleEntityNotFound(_0x26e596,null))[_0x2721('0x1a')](saveUpdates(_0x1b2607[_0x2721('0x51')],null))[_0x2721('0x1a')](function(_0xbdd7ee){if(_0xbdd7ee){_0x72359d[_0x2721('0x22')]=_0xbdd7ee[_0x2721('0x59')]({'plain':!![]});return db[_0x2721('0x5a')][_0x2721('0x4f')]({'where':{'id':_0xbdd7ee[_0x2721('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x26e596,null))[_0x2721('0x1a')](function(_0x1caecd){if(_0x1caecd){return _0x1caecd[_0x2721('0x2f')]({'UserId':_0x1b2607[_0x2721('0x51')][_0x2721('0x57')],'read1stAt':_[_0x2721('0x5c')](_0x1caecd[_0x2721('0x5d')])?moment()[_0x2721('0x56')](_0x2721('0x5e')):undefined});}return null;})['then'](function(_0x24116b){if(_0x24116b){_0x72359d[_0x2721('0x5f')]=_0x24116b[_0x2721('0x59')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b2607['user']['id'],_0x1b2607[_0x2721('0x58')]['name'],_0x1b2607[_0x2721('0x58')][_0x2721('0x60')],_0x72359d[_0x2721('0x5f')]['id'],_0x1b2607[_0x2721('0x51')]?JSON[_0x2721('0x1f')](_0x1b2607[_0x2721('0x51')]):_0x2721('0x61'));return respondWithRpcPromise('AcceptMessage',_0x2721('0x62'),_0x72359d);}return null;})[_0x2721('0x1a')](function(_0x5aa697){var _0x5efee0=_0x2721('0x63')+_0x5aa697[_0x2721('0x22')]['ContactId'];return db[_0x2721('0x64')][_0x2721('0x3a')](_0x5efee0,{'type':db[_0x2721('0x65')][_0x2721('0x66')][_0x2721('0x67')],'raw':!![]})[_0x2721('0x1a')](function(_0x17c07c){return _0x17c07c;});})[_0x2721('0x1a')](function(_0x5f4415){if(_0x5f4415){_0x72359d['message']['contact']=_0x5f4415[0x0];if(!_0x1b2607['body']['UserId'])return;return db[_0x2721('0x68')][_0x2721('0x4f')]({'where':{'id':_0x1b2607['body'][_0x2721('0x57')],'role':_0x2721('0x69')},'attributes':['id',_0x2721('0x31'),_0x2721('0x6a'),_0x2721('0x6b'),_0x2721('0x6c')],'raw':!![]});}return null;})[_0x2721('0x1a')](function(_0x5a97e5){if(!_0x5a97e5)return null;_0x72359d['message'][_0x2721('0x69')]=_0x5a97e5;return _0x72359d;})[_0x2721('0x1a')](function(_0x2c0e57){if(_0x2c0e57){if(_0x1b2607['body'][_0x2721('0x6d')]){_0x72359d[_0x2721('0x22')][_0x2721('0x6e')]=util[_0x2721('0x56')](_0x2721('0x6f'),_0x1b2607[_0x2721('0x58')][_0x2721('0x31')]);_0x72359d['message']['channel']=_0x72359d[_0x2721('0x70')];_0x72359d['message'][_0x2721('0x71')]=_0x72359d[_0x2721('0x70')];_0x72359d['message'][_0x2721('0x72')]='accept';return respondWithRpcPromise(_0x2721('0x73'),_0x2721('0x73'),{'event':'acceptmessage','message':_0x72359d[_0x2721('0x22')]},client9002)['then'](function(){return _0x72359d;});}return _0x72359d;}return null;})['then'](respondWithResult(_0x26e596,null))[_0x2721('0x4b')](handleError(_0x26e596,null));};var interaction_log=require(_0x2721('0xc'))(_0x2721('0x53'));exports[_0x2721('0x2e')]=function(_0x1d83be,_0xf478e9,_0x1db2ee){var _0x317cce={'agent':{},'channel':_0x2721('0x54')};if(_0x1d83be[_0x2721('0x51')]['id']){delete _0x1d83be[_0x2721('0x51')]['id'];}_0x1d83be['body'][_0x2721('0x57')]=_0x1d83be['body']['UserId']||_0x1d83be[_0x2721('0x58')]['id'];_0x317cce[_0x2721('0x69')]['id']=_0x1d83be[_0x2721('0x51')][_0x2721('0x57')];return db[_0x2721('0x34')]['find']({'where':{'id':_0x1d83be[_0x2721('0x4c')]['id'],'UserId':null}})[_0x2721('0x1a')](handleEntityNotFound(_0xf478e9,null))[_0x2721('0x1a')](function(_0x35b068){if(_0x35b068){_0x317cce[_0x2721('0x22')]=_0x35b068['get']({'plain':!![]});return db[_0x2721('0x5a')]['find']({'where':{'id':_0x35b068[_0x2721('0x5b')]}});}return null;})[_0x2721('0x1a')](handleEntityNotFound(_0xf478e9,null))[_0x2721('0x1a')](function(_0x1b0bd7){if(_0x1b0bd7){_0x317cce[_0x2721('0x5f')]=_0x1b0bd7['get']({'plain':!![]});interaction_log['info'](_0x2721('0x74'),_0x1d83be[_0x2721('0x58')]['id'],_0x1d83be[_0x2721('0x58')][_0x2721('0x31')],_0x1d83be[_0x2721('0x58')][_0x2721('0x60')],_0x317cce[_0x2721('0x5f')]['id'],_0x1d83be[_0x2721('0x51')]?JSON['stringify'](_0x1d83be[_0x2721('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0x2721('0x75'),_0x317cce);}return null;})['then'](function(_0x55c76f){var _0x295468=_0x2721('0x63')+_0x55c76f[_0x2721('0x22')][_0x2721('0x76')];return db[_0x2721('0x64')][_0x2721('0x3a')](_0x295468,{'type':db[_0x2721('0x65')][_0x2721('0x66')]['SELECT'],'raw':!![]})['then'](function(_0xf39e0a){return _0xf39e0a;});})[_0x2721('0x1a')](function(_0x235509){if(_0x235509){_0x317cce[_0x2721('0x22')][_0x2721('0x77')]=_0x235509[0x0];if(!_0x1d83be['body'][_0x2721('0x57')])return;return db[_0x2721('0x68')]['find']({'where':{'id':_0x1d83be[_0x2721('0x51')]['UserId'],'role':_0x2721('0x69')},'attributes':['id',_0x2721('0x31'),'fullname',_0x2721('0x6b'),'internal'],'raw':!![]});}return null;})[_0x2721('0x1a')](function(_0x5674a1){if(!_0x5674a1)return null;_0x317cce[_0x2721('0x22')]['agent']=_0x5674a1;return _0x317cce;})[_0x2721('0x1a')](function(_0x34dd9d){if(_0x34dd9d){_0x34dd9d[_0x2721('0x22')][_0x2721('0x6e')]=util[_0x2721('0x56')](_0x2721('0x6f'),_0x1d83be[_0x2721('0x58')][_0x2721('0x31')]);_0x34dd9d[_0x2721('0x22')][_0x2721('0x70')]=_0x317cce[_0x2721('0x70')];_0x34dd9d['message'][_0x2721('0x71')]=_0x317cce[_0x2721('0x70')];_0x34dd9d['message'][_0x2721('0x72')]=_0x2721('0x2e');respondWithRpcPromise(_0x2721('0x73'),_0x2721('0x73'),{'event':'rejectmessage','message':_0x34dd9d[_0x2721('0x22')]},client9002);return _0x317cce;}return null;})[_0x2721('0x1a')](respondWithResult(_0xf478e9,null))[_0x2721('0x4b')](handleError(_0xf478e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 119dc4b..215b3e6 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 _0x0494=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x39e4fd,_0x34d136){var _0xec280e=function(_0x44962e){while(--_0x44962e){_0x39e4fd['push'](_0x39e4fd['shift']());}};_0xec280e(++_0x34d136);}(_0x0494,0x11f));var _0x4049=function(_0x386b47,_0x4cd642){_0x386b47=_0x386b47-0x0;var _0x3a63c4=_0x0494[_0x386b47];return _0x3a63c4;};'use strict';var EventEmitter=require(_0x4049('0x0'));var OpenchannelMessage=require(_0x4049('0x1'))['db'][_0x4049('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4049('0x3')](0x0);var events={'afterCreate':_0x4049('0x4'),'afterUpdate':'update','afterDestroy':_0x4049('0x5')};function emitEvent(_0x83bd54){return function(_0x568fd5,_0x172cab,_0xc1d95a){OpenchannelMessageEvents[_0x4049('0x6')](_0x83bd54+':'+_0x568fd5['id'],_0x568fd5);OpenchannelMessageEvents[_0x4049('0x6')](_0x83bd54,_0x568fd5);_0xc1d95a(null);};}for(var e in events){if(events[_0x4049('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x4049('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xc029=['remove','emit','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x372fc6,_0x4de4d9){var _0x52382c=function(_0x549d6a){while(--_0x549d6a){_0x372fc6['push'](_0x372fc6['shift']());}};_0x52382c(++_0x4de4d9);}(_0xc029,0x7a));var _0x9c02=function(_0x1b0a89,_0x5f4f8f){_0x1b0a89=_0x1b0a89-0x0;var _0x3800f0=_0xc029[_0x1b0a89];return _0x3800f0;};'use strict';var EventEmitter=require(_0x9c02('0x0'));var OpenchannelMessage=require(_0x9c02('0x1'))['db'][_0x9c02('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9c02('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9c02('0x4')};function emitEvent(_0x3e0cdf){return function(_0x32ac6c,_0x51c908,_0x2d78f1){OpenchannelMessageEvents[_0x9c02('0x5')](_0x3e0cdf+':'+_0x32ac6c['id'],_0x32ac6c);OpenchannelMessageEvents[_0x9c02('0x5')](_0x3e0cdf,_0x32ac6c);_0x2d78f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x9c02('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 be7a89d..54a5dbf 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 _0xe511=['define','fti_openchannel_messages','body','models','get','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','POST','info','format','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports'];(function(_0x2c74cc,_0x559eaf){var _0x5005df=function(_0x18fd8d){while(--_0x18fd8d){_0x2c74cc['push'](_0x2c74cc['shift']());}};_0x5005df(++_0x559eaf);}(_0xe511,0x16f));var _0x1e51=function(_0x73865a,_0x451e72){_0x73865a=_0x73865a-0x0;var _0x47767f=_0xe511[_0x73865a];return _0x47767f;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x1e51('0xa'),'fields':[_0x1e51('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49d359,_0x658941,_0x2712e0){var _0x29da1f=_0x480cca[_0x1e51('0xc')];var _0x4241a6=_0x49d359[_0x1e51('0xd')]({'plain':!![]});if(_0x4241a6['direction'][_0x1e51('0xe')]()==='in'||_0x4241a6[_0x1e51('0xf')][_0x1e51('0xe')]()===_0x1e51('0x10')&&!_0x4241a6[_0x1e51('0x11')]&&!_[_0x1e51('0x12')](_0x4241a6['UserId'])){_0x29da1f[_0x1e51('0x13')][_0x1e51('0x14')]({'where':{'id':_0x4241a6[_0x1e51('0x15')]}})[_0x1e51('0x16')](function(_0x21bcbd){if(_0x21bcbd){_0x21bcbd[_0x1e51('0x17')]({'lastMsgAt':_0x4241a6[_0x1e51('0x18')],'lastMsgDirection':_0x4241a6[_0x1e51('0xf')][_0x1e51('0xe')]()});}})[_0x1e51('0x19')](function(_0x5a5c07){console[_0x1e51('0x1a')](_0x5a5c07);});}if(_0x4241a6[_0x1e51('0xf')]===_0x1e51('0x10')&&!_0x4241a6['secret']){var _0xa3b410;_0x29da1f['CmContact']['describe']()[_0x1e51('0x16')](function(_0x27dcad){return _0x29da1f[_0x1e51('0x1b')][_0x1e51('0x1c')]({'where':{'id':_0x4241a6[_0x1e51('0x1d')]},'include':[{'model':_0x29da1f[_0x1e51('0x13')],'as':'Interactions','where':{'id':_0x4241a6[_0x1e51('0x15')]},'limit':0x1,'include':[{'model':_0x29da1f['CmContact'],'as':_0x1e51('0x1e'),'attributes':_[_0x1e51('0x1f')](_0x27dcad)}]}]});})[_0x1e51('0x16')](function(_0x183a95){_0xa3b410=_0x183a95['get']({'plain':!![]});if(_0xa3b410&&_0xa3b410['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1e51('0x20'),util['format'](_0x1e51('0x21'),_0x4241a6['id'],_0xa3b410[_0x1e51('0x22')]));if(_0xa3b410[_0x1e51('0x23')]&&_0xa3b410[_0x1e51('0x23')][_0x1e51('0x24')]){_0x4241a6[_0x1e51('0x25')]=_[_0x1e51('0x26')](_0xa3b410[_0x1e51('0x23')][0x0],'Contact');_0x4241a6['Contact']=_0xa3b410[_0x1e51('0x23')][0x0][_0x1e51('0x1e')];}var _0x658941={'method':_0x1e51('0x27'),'uri':encodeURI(_0xa3b410['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x658941['method']){case'GET':_0x658941['qs']=_0x4241a6;break;case _0x1e51('0x27'):_0x658941[_0x1e51('0xb')]=_0x4241a6;break;}return rp(_0x658941)[_0x1e51('0x16')](function(_0x5412bc){logger[_0x1e51('0x28')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x1e51('0x29')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4241a6['id'],_0xa3b410[_0x1e51('0x22')]));if(_0x5412bc[_0x1e51('0xb')]['threadId']&&_0x5412bc[_0x1e51('0xb')][_0x1e51('0x2a')]!=_0x4241a6[_0x1e51('0x25')][_0x1e51('0x2a')]){return _0x29da1f['OpenchannelInteraction']['update']({'threadId':_0x5412bc['body'][_0x1e51('0x2a')]},{'logging':!![],'where':{'id':_0x4241a6[_0x1e51('0x25')]['id']}});}else{return;}})[_0x1e51('0x16')](function(){return _0x49d359[_0x1e51('0x17')]({'read':!![]});})[_0x1e51('0x19')](function(_0x27d9a2){logger[_0x1e51('0x1a')](_0x1e51('0x2b'),_0x1e51('0x20'),util[_0x1e51('0x2c')](_0x27d9a2,{'showHidden':![],'depth':null}));_0x2712e0();});}else{_0x2712e0();}})[_0x1e51('0x2d')](function(){_0x2712e0();});}else{_0x2712e0();}}},'charset':'utf8mb4','collate':_0x1e51('0x2e')});}; \ No newline at end of file +var _0x9354=['threadId','inspect','finally','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','toLowerCase','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','Contact','POST','method','GET','body'];(function(_0x27a894,_0x3fcf4c){var _0x45a756=function(_0x158418){while(--_0x158418){_0x27a894['push'](_0x27a894['shift']());}};_0x45a756(++_0x3fcf4c);}(_0x9354,0x96));var _0x4935=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x9354[_0x1857c6];return _0x51011c;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('0xb'),'paranoid':![],'indexes':[{'name':_0x4935('0xc'),'fields':['body'],'type':_0x4935('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47a44f,_0x2aac9a,_0x38de96){var _0xd5b117=_0x2d518a[_0x4935('0xe')];var _0x261462=_0x47a44f[_0x4935('0xf')]({'plain':!![]});if(_0x261462['direction']['toLowerCase']()==='in'||_0x261462[_0x4935('0x10')]['toLowerCase']()==='out'&&!_0x261462[_0x4935('0x11')]&&!_[_0x4935('0x12')](_0x261462[_0x4935('0x13')])){_0xd5b117[_0x4935('0x14')][_0x4935('0x15')]({'where':{'id':_0x261462[_0x4935('0x16')]}})[_0x4935('0x17')](function(_0x3a7c30){if(_0x3a7c30){_0x3a7c30[_0x4935('0x18')]({'lastMsgAt':_0x261462[_0x4935('0x19')],'lastMsgDirection':_0x261462[_0x4935('0x10')][_0x4935('0x1a')]()});}})[_0x4935('0x1b')](function(_0x3652c4){console[_0x4935('0x1c')](_0x3652c4);});}if(_0x261462[_0x4935('0x10')]==='out'&&!_0x261462[_0x4935('0x11')]){var _0x46526a;_0xd5b117[_0x4935('0x1d')][_0x4935('0x1e')]()[_0x4935('0x17')](function(_0x429ef3){return _0xd5b117['OpenchannelAccount'][_0x4935('0x1f')]({'where':{'id':_0x261462[_0x4935('0x20')]},'include':[{'model':_0xd5b117['OpenchannelInteraction'],'as':_0x4935('0x21'),'where':{'id':_0x261462[_0x4935('0x16')]},'limit':0x1,'include':[{'model':_0xd5b117[_0x4935('0x1d')],'as':'Contact','attributes':_['keys'](_0x429ef3)}]}]});})[_0x4935('0x17')](function(_0x6b849f){_0x46526a=_0x6b849f[_0x4935('0xf')]({'plain':!![]});if(_0x46526a&&_0x46526a[_0x4935('0x22')]){logger[_0x4935('0x23')](_0x4935('0x24'),_0x4935('0x25'),util[_0x4935('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x46526a[_0x4935('0x21')]&&_0x46526a[_0x4935('0x21')][_0x4935('0x27')]){_0x261462[_0x4935('0x28')]=_['omit'](_0x46526a['Interactions'][0x0],_0x4935('0x29'));_0x261462[_0x4935('0x29')]=_0x46526a[_0x4935('0x21')][0x0][_0x4935('0x29')];}var _0x2aac9a={'method':_0x4935('0x2a'),'uri':encodeURI(_0x46526a[_0x4935('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2aac9a[_0x4935('0x2b')]){case _0x4935('0x2c'):_0x2aac9a['qs']=_0x261462;break;case _0x4935('0x2a'):_0x2aac9a[_0x4935('0x2d')]=_0x261462;break;}return rp(_0x2aac9a)[_0x4935('0x17')](function(_0x2c47ab){logger[_0x4935('0x23')](_0x4935('0x24'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x2c47ab[_0x4935('0x2d')]['threadId']&&_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]!=_0x261462[_0x4935('0x28')][_0x4935('0x2e')]){return _0xd5b117[_0x4935('0x14')][_0x4935('0x18')]({'threadId':_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]},{'logging':!![],'where':{'id':_0x261462['Interaction']['id']}});}else{return;}})[_0x4935('0x17')](function(){return _0x47a44f[_0x4935('0x18')]({'read':!![]});})['catch'](function(_0x48a289){logger[_0x4935('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x4935('0x25'),util[_0x4935('0x2f')](_0x48a289,{'showHidden':![],'depth':null}));_0x38de96();});}else{_0x38de96();}})[_0x4935('0x30')](function(){_0x38de96();});}else{_0x38de96();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index fceb689..cac798e 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(_0x328b5a,_0x12aab1){var _0x1372bd=function(_0x2bd823){while(--_0x2bd823){_0x328b5a['push'](_0x328b5a['shift']());}};_0x1372bd(++_0x12aab1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x348754,_0x5ab02d){var _0x290b19=function(_0x5833b9){while(--_0x5833b9){_0x348754['push'](_0x348754['shift']());}};_0x290b19(++_0x5ab02d);}(_0x0b0e,0x187));var _0xe0b0=function(_0xb4e2df,_0x1cbb7c){_0xb4e2df=_0xb4e2df-0x0;var _0x5e95ba=_0x0b0e[_0xb4e2df];return _0x5e95ba;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0f64006..534aa42 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 _0xbbbd=['save','remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x12523b,_0x235833){var _0x11984c=function(_0x3c464e){while(--_0x3c464e){_0x12523b['push'](_0x12523b['shift']());}};_0x11984c(++_0x235833);}(_0xbbbd,0x86));var _0xdbbb=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xbbbd[_0x32b542];return _0x554d54;};'use strict';var OpenchannelMessageEvents=require(_0xdbbb('0x0'));var events=[_0xdbbb('0x1'),_0xdbbb('0x2'),_0xdbbb('0x3')];function createListener(_0x364f2b,_0x21cb13){return function(_0x2f4a15){_0x21cb13[_0xdbbb('0x4')](_0x364f2b,_0x2f4a15);};}function removeListener(_0x3b665d,_0x114d3a){return function(){OpenchannelMessageEvents[_0xdbbb('0x5')](_0x3b665d,_0x114d3a);};}exports[_0xdbbb('0x6')]=function(_0x4e9523){for(var _0xa5399d=0x0,_0x42ea38=events[_0xdbbb('0x7')];_0xa5399d<_0x42ea38;_0xa5399d++){var _0x478756=events[_0xa5399d];var _0x463ea6=createListener(_0xdbbb('0x8')+_0x478756,_0x4e9523);OpenchannelMessageEvents['on'](_0x478756,_0x463ea6);}}; \ No newline at end of file +var _0x6b3e=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x2adc28,_0x38e880){var _0x450f5a=function(_0x3c89f6){while(--_0x3c89f6){_0x2adc28['push'](_0x2adc28['shift']());}};_0x450f5a(++_0x38e880);}(_0x6b3e,0x122));var _0xe6b3=function(_0x38ea9d,_0x25b874){_0x38ea9d=_0x38ea9d-0x0;var _0x224ef5=_0x6b3e[_0x38ea9d];return _0x224ef5;};'use strict';var OpenchannelMessageEvents=require(_0xe6b3('0x0'));var events=[_0xe6b3('0x1'),_0xe6b3('0x2'),_0xe6b3('0x3')];function createListener(_0x448fca,_0x48be86){return function(_0x28ee36){_0x48be86[_0xe6b3('0x4')](_0x448fca,_0x28ee36);};}function removeListener(_0xbbf7d5,_0x2f7034){return function(){OpenchannelMessageEvents[_0xe6b3('0x5')](_0xbbf7d5,_0x2f7034);};}exports['register']=function(_0x3d33c4){for(var _0x2893f7=0x0,_0x50a59d=events[_0xe6b3('0x6')];_0x2893f7<_0x50a59d;_0x2893f7++){var _0x3e8afc=events[_0x2893f7];var _0x2a6e1c=createListener(_0xe6b3('0x7')+_0x3e8afc,_0x3d33c4);OpenchannelMessageEvents['on'](_0x3e8afc,_0x2a6e1c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index bd97d9c..fecff95 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 _0x7428=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7428,0x1c4));var _0x8742=function(_0x318263,_0x248c10){_0x318263=_0x318263-0x0;var _0x57e00a=_0x7428[_0x318263];return _0x57e00a;};'use strict';var multer=require(_0x8742('0x0'));var util=require(_0x8742('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8742('0x2')]();var fs_extra=require(_0x8742('0x3'));var auth=require(_0x8742('0x4'));var interaction=require(_0x8742('0x5'));var config=require(_0x8742('0x6'));var controller=require(_0x8742('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8742('0x8')]);router[_0x8742('0x9')](_0x8742('0xa'),auth[_0x8742('0xb')](),controller[_0x8742('0xc')]);router[_0x8742('0x9')](_0x8742('0xd'),auth[_0x8742('0xb')](),controller[_0x8742('0xe')]);router[_0x8742('0x9')](_0x8742('0xf'),auth[_0x8742('0xb')](),controller[_0x8742('0x10')]);router['get'](_0x8742('0x11'),auth[_0x8742('0xb')](),controller[_0x8742('0x12')]);router[_0x8742('0x9')](_0x8742('0x13'),auth['isAuthenticated'](),controller[_0x8742('0x14')]);router['post']('/',auth[_0x8742('0xb')](),controller[_0x8742('0x15')]);router[_0x8742('0x16')](_0x8742('0x11'),auth[_0x8742('0xb')](),controller[_0x8742('0x17')]);router['post'](_0x8742('0x13'),auth[_0x8742('0xb')](),controller[_0x8742('0x18')]);router[_0x8742('0x19')](_0x8742('0xd'),auth['isAuthenticated'](),controller[_0x8742('0x1a')]);router[_0x8742('0x1b')](_0x8742('0xd'),auth['isAuthenticated'](),controller[_0x8742('0x1c')]);router[_0x8742('0x1b')](_0x8742('0x11'),auth[_0x8742('0xb')](),controller['removeTeams']);router[_0x8742('0x1b')](_0x8742('0x13'),auth['isAuthenticated'](),controller[_0x8742('0x1d')]);module[_0x8742('0x1e')]=router; \ No newline at end of file +var _0x0425=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xb6212f,_0x1d05b2){var _0x33bce7=function(_0xe010e8){while(--_0xe010e8){_0xb6212f['push'](_0xb6212f['shift']());}};_0x33bce7(++_0x1d05b2);}(_0x0425,0x156));var _0x5042=function(_0x2af5da,_0x21eed1){_0x2af5da=_0x2af5da-0x0;var _0x359ca5=_0x0425[_0x2af5da];return _0x359ca5;};'use strict';var multer=require(_0x5042('0x0'));var util=require(_0x5042('0x1'));var path=require(_0x5042('0x2'));var timeout=require(_0x5042('0x3'));var express=require(_0x5042('0x4'));var router=express[_0x5042('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5042('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5042('0x7'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x5042('0x8')](),controller[_0x5042('0x9')]);router[_0x5042('0xa')](_0x5042('0xb'),auth['isAuthenticated'](),controller[_0x5042('0xc')]);router[_0x5042('0xa')]('/:id',auth[_0x5042('0x8')](),controller[_0x5042('0xd')]);router[_0x5042('0xa')](_0x5042('0xe'),auth[_0x5042('0x8')](),controller[_0x5042('0xf')]);router[_0x5042('0xa')]('/:id/teams',auth[_0x5042('0x8')](),controller[_0x5042('0x10')]);router[_0x5042('0xa')]('/:id/users',auth[_0x5042('0x8')](),controller[_0x5042('0x11')]);router[_0x5042('0x12')]('/',auth[_0x5042('0x8')](),controller['create']);router[_0x5042('0x12')](_0x5042('0x13'),auth[_0x5042('0x8')](),controller[_0x5042('0x14')]);router[_0x5042('0x12')](_0x5042('0x15'),auth[_0x5042('0x8')](),controller[_0x5042('0x16')]);router['put'](_0x5042('0x17'),auth[_0x5042('0x8')](),controller[_0x5042('0x18')]);router[_0x5042('0x19')](_0x5042('0x17'),auth[_0x5042('0x8')](),controller[_0x5042('0x1a')]);router[_0x5042('0x19')](_0x5042('0x13'),auth[_0x5042('0x8')](),controller[_0x5042('0x1b')]);router[_0x5042('0x19')](_0x5042('0x15'),auth[_0x5042('0x8')](),controller['removeAgents']);module[_0x5042('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 74d86f5..7259354 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 _0x212a=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x212a,0x78));var _0xa212=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x212a[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xa212('0x0'));module[_0xa212('0x1')]={'name':{'type':Sequelize[_0xa212('0x2')],'unique':_0xa212('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa212('0x2')]},'timeout':{'type':Sequelize[_0xa212('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa212('0x5')]('rrmemory','beepall',_0xa212('0x6'))}}; \ No newline at end of file +var _0xb461=['name','beepall','sequelize','exports','STRING'];(function(_0x57e750,_0x35fbf3){var _0x7e5115=function(_0x51683f){while(--_0x51683f){_0x57e750['push'](_0x57e750['shift']());}};_0x7e5115(++_0x35fbf3);}(_0xb461,0x179));var _0x1b46=function(_0x5ef23c,_0x189b9b){_0x5ef23c=_0x5ef23c-0x0;var _0x8ab4eb=_0xb461[_0x5ef23c];return _0x8ab4eb;};'use strict';var Sequelize=require(_0x1b46('0x0'));module[_0x1b46('0x1')]={'name':{'type':Sequelize[_0x1b46('0x2')],'unique':_0x1b46('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x1b46('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8c2f220..f76ef63 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 _0xa629=['mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','catch','show','params','length','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','%s/%s','openchannelPause','getTeams','hasOwnProperty','ids','Team','User','Agents','online','interface','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x1a8dae,_0x112ef6){var _0x5cc40b=function(_0x4e1436){while(--_0x4e1436){_0x1a8dae['push'](_0x1a8dae['shift']());}};_0x5cc40b(++_0x112ef6);}(_0xa629,0x1a2));var _0x9a62=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa629[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9a62('0x0'));var rimraf=require(_0x9a62('0x1'));var zipdir=require(_0x9a62('0x2'));var jsonpatch=require(_0x9a62('0x3'));var rp=require('request-promise');var moment=require(_0x9a62('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9a62('0x5'));var util=require(_0x9a62('0x6'));var path=require(_0x9a62('0x7'));var sox=require('sox');var csv=require(_0x9a62('0x8'));var ejs=require(_0x9a62('0x9'));var fs=require('fs');var fs_extra=require(_0x9a62('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a62('0xb'));var jsforce=require(_0x9a62('0xc'));var deskjs=require(_0x9a62('0xd'));var toCsv=require(_0x9a62('0x8'));var querystring=require('querystring');var Papa=require(_0x9a62('0xe'));var Redis=require(_0x9a62('0xf'));var authService=require(_0x9a62('0x10'));var qs=require(_0x9a62('0x11'));var as=require(_0x9a62('0x12'));var hardwareService=require(_0x9a62('0x13'));var logger=require(_0x9a62('0x14'))('api');var utils=require(_0x9a62('0x15'));var config=require(_0x9a62('0x16'));var licenseUtil=require(_0x9a62('0x17'));var db=require(_0x9a62('0x18'))['db'];config[_0x9a62('0x19')]=_[_0x9a62('0x1a')](config[_0x9a62('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a62('0x19')]));require(_0x9a62('0x1b'))[_0x9a62('0x1c')](socket);function respondWithStatusCode(_0xf7111f,_0x576384){_0x576384=_0x576384||0xcc;return function(_0x3ab219){if(_0x3ab219){return _0xf7111f[_0x9a62('0x1d')](_0x576384);}return _0xf7111f[_0x9a62('0x1e')](_0x576384)[_0x9a62('0x1f')]();};}function respondWithResult(_0x120106,_0x164c64){_0x164c64=_0x164c64||0xc8;return function(_0xedeb2b){if(_0xedeb2b){return _0x120106[_0x9a62('0x1e')](_0x164c64)[_0x9a62('0x20')](_0xedeb2b);}};}function respondWithFilteredResult(_0x34b313,_0x53939c){return function(_0xeee450){if(_0xeee450){var _0x2a33a0=typeof _0x53939c[_0x9a62('0x21')]===_0x9a62('0x22')&&typeof _0x53939c['limit']===_0x9a62('0x22');var _0x1d6def=_0xeee450[_0x9a62('0x23')];var _0x49d11a=_0x2a33a0?0x0:_0x53939c[_0x9a62('0x21')];var _0x50c5f1=_0x2a33a0?_0xeee450[_0x9a62('0x23')]:_0x53939c[_0x9a62('0x21')]+_0x53939c[_0x9a62('0x24')];var _0x4f8a98;if(_0x50c5f1>=_0x1d6def){_0x50c5f1=_0x1d6def;_0x4f8a98=0xc8;}else{_0x4f8a98=0xce;}_0x34b313[_0x9a62('0x1e')](_0x4f8a98);return _0x34b313[_0x9a62('0x25')](_0x9a62('0x26'),_0x49d11a+'-'+_0x50c5f1+'/'+_0x1d6def)[_0x9a62('0x20')](_0xeee450);}return null;};}function patchUpdates(_0x830d08){return function(_0x13746b){try{jsonpatch[_0x9a62('0x27')](_0x13746b,_0x830d08,!![]);}catch(_0xf4cb7e){return BPromise['reject'](_0xf4cb7e);}return _0x13746b[_0x9a62('0x28')]();};}function saveUpdates(_0x37d061,_0x5e9a01){return function(_0x380443){if(_0x380443){return _0x380443[_0x9a62('0x29')](_0x37d061)[_0x9a62('0x2a')](function(_0x3bfca2){return _0x3bfca2;});}return null;};}function removeEntity(_0x1b919b,_0x4748b2){return function(_0x60c565){if(_0x60c565){return _0x60c565[_0x9a62('0x2b')]()['then'](function(){var _0x20b616=_0x60c565[_0x9a62('0x2c')]({'plain':!![]});var _0xf1bfd0=_0x9a62('0x2d');return db[_0x9a62('0x2e')]['destroy']({'where':{'type':_0xf1bfd0,'resourceId':_0x20b616['id']}})[_0x9a62('0x2a')](function(){return _0x60c565;});})[_0x9a62('0x2a')](function(){_0x1b919b[_0x9a62('0x1e')](0xcc)[_0x9a62('0x1f')]();});}};}function handleEntityNotFound(_0xb8684b,_0x45234f){return function(_0x30fc4a){if(!_0x30fc4a){_0xb8684b['sendStatus'](0x194);}return _0x30fc4a;};}function handleError(_0x194945,_0x4060aa){_0x4060aa=_0x4060aa||0x1f4;return function(_0x223525){logger[_0x9a62('0x2f')](_0x223525[_0x9a62('0x30')]);if(_0x223525[_0x9a62('0x31')]){delete _0x223525['name'];}_0x194945[_0x9a62('0x1e')](_0x4060aa)[_0x9a62('0x32')](_0x223525);};}exports[_0x9a62('0x33')]=function(_0x5f4aa6,_0x1565bc){var _0x20f942={},_0x50d139={},_0x1faeb9={'count':0x0,'rows':[]};var _0x2f16d3=_[_0x9a62('0x34')](db[_0x9a62('0x35')][_0x9a62('0x36')],function(_0x152791){return{'name':_0x152791[_0x9a62('0x37')],'type':_0x152791[_0x9a62('0x38')][_0x9a62('0x39')]};});_0x50d139[_0x9a62('0x3a')]=_['map'](_0x2f16d3,_0x9a62('0x31'));_0x50d139[_0x9a62('0x3b')]=_[_0x9a62('0x3c')](_0x5f4aa6[_0x9a62('0x3b')]);_0x50d139[_0x9a62('0x3d')]=_['intersection'](_0x50d139[_0x9a62('0x3a')],_0x50d139[_0x9a62('0x3b')]);_0x20f942[_0x9a62('0x3e')]=_[_0x9a62('0x3f')](_0x50d139[_0x9a62('0x3a')],qs[_0x9a62('0x40')](_0x5f4aa6['query'][_0x9a62('0x40')]));_0x20f942[_0x9a62('0x3e')]=_0x20f942[_0x9a62('0x3e')]['length']?_0x20f942['attributes']:_0x50d139[_0x9a62('0x3a')];if(!_0x5f4aa6[_0x9a62('0x3b')]['hasOwnProperty'](_0x9a62('0x41'))){_0x20f942[_0x9a62('0x24')]=qs[_0x9a62('0x24')](_0x5f4aa6[_0x9a62('0x3b')][_0x9a62('0x24')]);_0x20f942['offset']=qs['offset'](_0x5f4aa6[_0x9a62('0x3b')][_0x9a62('0x21')]);}_0x20f942[_0x9a62('0x42')]=qs[_0x9a62('0x43')](_0x5f4aa6[_0x9a62('0x3b')][_0x9a62('0x43')]);_0x20f942['where']=qs[_0x9a62('0x3d')](_[_0x9a62('0x44')](_0x5f4aa6['query'],_0x50d139[_0x9a62('0x3d')]),_0x2f16d3);if(_0x5f4aa6['query'][_0x9a62('0x45')]){_0x20f942[_0x9a62('0x46')]=_[_0x9a62('0x47')](_0x20f942['where'],{'$or':_['map'](_0x2f16d3,function(_0xf9df26){if(_0xf9df26['type']!==_0x9a62('0x48')){var _0x2923cf={};_0x2923cf[_0xf9df26[_0x9a62('0x31')]]={'$like':'%'+_0x5f4aa6[_0x9a62('0x3b')][_0x9a62('0x45')]+'%'};return _0x2923cf;}})});}_0x20f942=_[_0x9a62('0x47')]({},_0x20f942,_0x5f4aa6[_0x9a62('0x49')]);var _0x3bb249={'where':_0x20f942[_0x9a62('0x46')]};return db[_0x9a62('0x35')]['count'](_0x3bb249)['then'](function(_0x1128b0){_0x1faeb9[_0x9a62('0x23')]=_0x1128b0;if(_0x5f4aa6['query']['includeAll']){_0x20f942[_0x9a62('0x4a')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x20f942);})[_0x9a62('0x2a')](function(_0x3359bf){_0x1faeb9['rows']=_0x3359bf;return _0x1faeb9;})[_0x9a62('0x2a')](respondWithFilteredResult(_0x1565bc,_0x20f942))[_0x9a62('0x4b')](handleError(_0x1565bc,null));};exports[_0x9a62('0x4c')]=function(_0x15510d,_0x13be7e){var _0xd262ea={'raw':!![],'where':{'id':_0x15510d[_0x9a62('0x4d')]['id']}},_0x191065={};_0x191065[_0x9a62('0x3a')]=_[_0x9a62('0x3c')](db[_0x9a62('0x35')][_0x9a62('0x36')]);_0x191065[_0x9a62('0x3b')]=_['keys'](_0x15510d[_0x9a62('0x3b')]);_0x191065[_0x9a62('0x3d')]=_['intersection'](_0x191065[_0x9a62('0x3a')],_0x191065[_0x9a62('0x3b')]);_0xd262ea[_0x9a62('0x3e')]=_[_0x9a62('0x3f')](_0x191065['model'],qs[_0x9a62('0x40')](_0x15510d[_0x9a62('0x3b')][_0x9a62('0x40')]));_0xd262ea[_0x9a62('0x3e')]=_0xd262ea[_0x9a62('0x3e')][_0x9a62('0x4e')]?_0xd262ea[_0x9a62('0x3e')]:_0x191065['model'];if(_0x15510d[_0x9a62('0x3b')][_0x9a62('0x4f')]){_0xd262ea[_0x9a62('0x4a')]=[{'all':!![]}];}_0xd262ea=_[_0x9a62('0x47')]({},_0xd262ea,_0x15510d[_0x9a62('0x49')]);return db[_0x9a62('0x35')][_0x9a62('0x50')](_0xd262ea)[_0x9a62('0x2a')](handleEntityNotFound(_0x13be7e,null))[_0x9a62('0x2a')](respondWithResult(_0x13be7e,null))[_0x9a62('0x4b')](handleError(_0x13be7e,null));};exports['create']=function(_0x5317bb,_0x2d4cbf){return db[_0x9a62('0x35')]['create'](_0x5317bb[_0x9a62('0x51')],{})[_0x9a62('0x2a')](function(_0xeef6c7){var _0x4259e7=_0x5317bb[_0x9a62('0x52')]['get']({'plain':!![]});if(!_0x4259e7)throw new Error(_0x9a62('0x53'));if(_0x4259e7[_0x9a62('0x54')]==='user'){var _0x24fef5=_0xeef6c7[_0x9a62('0x2c')]({'plain':!![]});var _0x308996=_0x9a62('0x2d');return db['UserProfileSection'][_0x9a62('0x50')]({'where':{'name':_0x308996,'userProfileId':_0x4259e7[_0x9a62('0x55')]},'raw':!![]})[_0x9a62('0x2a')](function(_0x38fbbf){if(_0x38fbbf&&_0x38fbbf['autoAssociation']===0x0){return db[_0x9a62('0x2e')]['create']({'name':_0x24fef5[_0x9a62('0x31')],'resourceId':_0x24fef5['id'],'type':_0x38fbbf[_0x9a62('0x31')],'sectionId':_0x38fbbf['id']},{})[_0x9a62('0x2a')](function(){return _0xeef6c7;});}else{return _0xeef6c7;}})['catch'](function(_0x557470){logger['error'](_0x9a62('0x56'),_0x557470);throw _0x557470;});}return _0xeef6c7;})[_0x9a62('0x2a')](respondWithResult(_0x2d4cbf,0xc9))[_0x9a62('0x4b')](handleError(_0x2d4cbf,null));};exports['update']=function(_0x192830,_0x57038d){if(_0x192830[_0x9a62('0x51')]['id']){delete _0x192830['body']['id'];}return db[_0x9a62('0x35')]['find']({'where':{'id':_0x192830[_0x9a62('0x4d')]['id']}})[_0x9a62('0x2a')](handleEntityNotFound(_0x57038d,null))['then'](saveUpdates(_0x192830['body'],null))[_0x9a62('0x2a')](respondWithResult(_0x57038d,null))[_0x9a62('0x4b')](handleError(_0x57038d,null));};exports[_0x9a62('0x2b')]=function(_0x242644,_0x317e1b){return db[_0x9a62('0x35')][_0x9a62('0x50')]({'where':{'id':_0x242644[_0x9a62('0x4d')]['id']}})['then'](handleEntityNotFound(_0x317e1b,null))['then'](removeEntity(_0x317e1b,null))[_0x9a62('0x4b')](handleError(_0x317e1b,null));};exports[_0x9a62('0x57')]=function(_0x329d0d,_0x21afd5){return db[_0x9a62('0x35')]['describe']()[_0x9a62('0x2a')](respondWithResult(_0x21afd5,null))[_0x9a62('0x4b')](handleError(_0x21afd5,null));};exports[_0x9a62('0x58')]=function(_0xef3595,_0x270a32,_0x3b022d){var _0x451bff={'raw':!![],'where':{}},_0x2a5cba={},_0x15c671;return db['OpenchannelQueue'][_0x9a62('0x59')]({'where':{'id':_0xef3595['params']['id']}})[_0x9a62('0x2a')](handleEntityNotFound(_0x270a32,null))['then'](function(_0x11f3f3){if(_0x11f3f3){_0x15c671=_0x11f3f3[_0x9a62('0x2c')]({'plain':!![]});_0x2a5cba[_0x9a62('0x3a')]=_[_0x9a62('0x3c')](db[_0x9a62('0x5a')][_0x9a62('0x36')]);_0x2a5cba[_0x9a62('0x3b')]=_[_0x9a62('0x3c')](_0xef3595[_0x9a62('0x3b')]);_0x2a5cba[_0x9a62('0x3d')]=_[_0x9a62('0x3f')](_0x2a5cba[_0x9a62('0x3a')],_0x2a5cba['query']);_0x451bff['attributes']=_['intersection'](_0x2a5cba[_0x9a62('0x3a')],qs['fields'](_0xef3595[_0x9a62('0x3b')]['fields']));_0x451bff[_0x9a62('0x3e')]=_0x451bff[_0x9a62('0x3e')]['length']?_0x451bff[_0x9a62('0x3e')]:_0x2a5cba[_0x9a62('0x3a')];if(!_0xef3595[_0x9a62('0x3b')]['hasOwnProperty'](_0x9a62('0x41'))){_0x451bff[_0x9a62('0x24')]=qs['limit'](_0xef3595[_0x9a62('0x3b')][_0x9a62('0x24')]);_0x451bff[_0x9a62('0x21')]=qs[_0x9a62('0x21')](_0xef3595['query'][_0x9a62('0x21')]);}_0x451bff[_0x9a62('0x42')]=qs[_0x9a62('0x43')](_0xef3595[_0x9a62('0x3b')][_0x9a62('0x43')]);_0x451bff[_0x9a62('0x46')]=qs[_0x9a62('0x3d')](_[_0x9a62('0x44')](_0xef3595['query'],_0x2a5cba[_0x9a62('0x3d')]));_0x451bff['where'][_0x9a62('0x5b')]=_0x11f3f3['id'];if(_0xef3595[_0x9a62('0x3b')]['filter']){_0x451bff[_0x9a62('0x46')]=_[_0x9a62('0x47')](_0x451bff[_0x9a62('0x46')],{'$or':_[_0x9a62('0x34')](_0x451bff[_0x9a62('0x3e')],function(_0x47f19f){var _0x369f1b={};_0x369f1b[_0x47f19f]={'$like':'%'+_0xef3595[_0x9a62('0x3b')][_0x9a62('0x45')]+'%'};return _0x369f1b;})});}_0x451bff=_[_0x9a62('0x47')]({},_0x451bff,_0xef3595['options']);return db['UserOpenchannelQueue'][_0x9a62('0x5c')](_0x451bff);}})[_0x9a62('0x2a')](function(_0x3fceb5){if(_0x3fceb5){return db['User'][_0x9a62('0x5d')]({'where':{'id':_[_0x9a62('0x34')](_0x3fceb5,_0x9a62('0x5e')),'role':_0x9a62('0x5f')},'attributes':['id',_0x9a62('0x31'),'openchannelPause',_0x9a62('0x60'),_0x9a62('0x61')]});}})[_0x9a62('0x2a')](function(_0x4397e7){if(_0x4397e7){return{'count':_0x4397e7[_0x9a62('0x23')],'rows':_['map'](_0x4397e7[_0x9a62('0x62')],function(_0x1087f0){return{'membername':_0x1087f0[_0x9a62('0x31')],'UserId':_0x1087f0['id'],'queue_name':_0x15c671[_0x9a62('0x31')],'OpenchannelQueueId':_0x15c671['id'],'interface':util['format'](_0x9a62('0x63'),'SIP',_0x1087f0['name']),'penalty':0x0,'paused':_0x1087f0[_0x9a62('0x64')],'createdAt':_0x1087f0[_0x9a62('0x61')],'updatedAt':_0x1087f0[_0x9a62('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x270a32,_0x451bff))[_0x9a62('0x4b')](handleError(_0x270a32,null));};exports[_0x9a62('0x65')]=function(_0x418dbb,_0xaff4f,_0x314fbd){var _0x236d95={};var _0x367747={};var _0x9d8dfa;var _0x1babeb;return db[_0x9a62('0x35')][_0x9a62('0x59')]({'where':{'id':_0x418dbb[_0x9a62('0x4d')]['id']}})[_0x9a62('0x2a')](handleEntityNotFound(_0xaff4f,null))[_0x9a62('0x2a')](function(_0xe074ea){if(_0xe074ea){_0x9d8dfa=_0xe074ea;_0x367747['model']=_[_0x9a62('0x3c')](db['Team'][_0x9a62('0x36')]);_0x367747[_0x9a62('0x3b')]=_[_0x9a62('0x3c')](_0x418dbb[_0x9a62('0x3b')]);_0x367747[_0x9a62('0x3d')]=_[_0x9a62('0x3f')](_0x367747[_0x9a62('0x3a')],_0x367747['query']);_0x236d95[_0x9a62('0x3e')]=_[_0x9a62('0x3f')](_0x367747[_0x9a62('0x3a')],qs['fields'](_0x418dbb['query'][_0x9a62('0x40')]));_0x236d95[_0x9a62('0x3e')]=_0x236d95[_0x9a62('0x3e')][_0x9a62('0x4e')]?_0x236d95['attributes']:_0x367747[_0x9a62('0x3a')];_0x236d95[_0x9a62('0x42')]=qs[_0x9a62('0x43')](_0x418dbb['query'][_0x9a62('0x43')]);_0x236d95['where']=qs[_0x9a62('0x3d')](_['pick'](_0x418dbb[_0x9a62('0x3b')],_0x367747[_0x9a62('0x3d')]));if(_0x418dbb[_0x9a62('0x3b')][_0x9a62('0x45')]){_0x236d95[_0x9a62('0x46')]=_[_0x9a62('0x47')](_0x236d95[_0x9a62('0x46')],{'$or':_[_0x9a62('0x34')](_0x236d95[_0x9a62('0x3e')],function(_0x16e950){var _0x2d1d72={};_0x2d1d72[_0x16e950]={'$like':'%'+_0x418dbb['query'][_0x9a62('0x45')]+'%'};return _0x2d1d72;})});}_0x236d95=_[_0x9a62('0x47')]({},_0x236d95,_0x418dbb['options']);return _0x9d8dfa[_0x9a62('0x65')](_0x236d95);}})['then'](function(_0x49a6bc){if(_0x49a6bc){_0x1babeb=_0x49a6bc[_0x9a62('0x4e')];if(!_0x418dbb['query'][_0x9a62('0x66')]('nolimit')){_0x236d95[_0x9a62('0x24')]=qs[_0x9a62('0x24')](_0x418dbb[_0x9a62('0x3b')][_0x9a62('0x24')]);_0x236d95[_0x9a62('0x21')]=qs[_0x9a62('0x21')](_0x418dbb['query'][_0x9a62('0x21')]);}return _0x9d8dfa['getTeams'](_0x236d95);}})['then'](function(_0x89ed76){if(_0x89ed76){return _0x89ed76?{'count':_0x1babeb,'rows':_0x89ed76}:null;}})[_0x9a62('0x2a')](respondWithResult(_0xaff4f,null))['catch'](handleError(_0xaff4f,null));};exports['addTeams']=function(_0x237bd4,_0x41c3dd,_0x1695b6){var _0x258994=_0x237bd4['body'][_0x9a62('0x67')];return db[_0x9a62('0x68')][_0x9a62('0x5c')]({'where':{'id':_0x258994},'attributes':['id'],'include':[{'model':db[_0x9a62('0x69')],'as':_0x9a62('0x6a'),'attributes':['id','name',_0x9a62('0x6b'),'voicePause',_0x9a62('0x6c')],'raw':!![]}]})[_0x9a62('0x2a')](function(_0x108812){if(_0x108812){var _0x39bf42=_['flatMap'](_0x108812,function(_0x9b2627){var _0x290060=_0x9b2627[_0x9a62('0x2c')]({'plain':!![]});return _0x290060[_0x9a62('0x6a')];});return db['OpenchannelQueue'][_0x9a62('0x50')]({'where':{'id':_0x237bd4[_0x9a62('0x4d')]['id']}})[_0x9a62('0x2a')](function(_0x4868b1){return db[_0x9a62('0x6d')]['transaction'](function(_0x28acbc){return _0x4868b1[_0x9a62('0x6e')](_0x258994,{'transaction':_0x28acbc})['then'](function(){return BPromise['each'](_0x39bf42,function(_0x11dbbe){return db['UserOpenchannelQueue'][_0x9a62('0x6f')]({'where':{'UserId':_0x11dbbe['id'],'OpenchannelQueueId':_0x237bd4[_0x9a62('0x4d')]['id']},'transaction':_0x28acbc});});})['then'](function(){_0x39bf42[_0x9a62('0x70')](function(_0x3faca0){socket[_0x9a62('0x71')](_0x9a62('0x72'),{'UserId':_0x3faca0['id'],'OpenchannelQueueId':_0x4868b1['id']});});});});});}})[_0x9a62('0x2a')](respondWithStatusCode(_0x41c3dd,null))[_0x9a62('0x4b')](handleError(_0x41c3dd,null));};exports[_0x9a62('0x73')]=function(_0x33547b,_0x1cf6db,_0x1d2e71){return db[_0x9a62('0x68')]['findAll']({'where':{'id':_0x33547b[_0x9a62('0x3b')][_0x9a62('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9a62('0x2a')](handleEntityNotFound(_0x1cf6db,null))[_0x9a62('0x2a')](function(_0x10f4fa){var _0xc23efe=_[_0x9a62('0x34')](_0x10f4fa,'id');var _0x19b5de=[];var _0x2ee75b=[];var _0x2e5991=squel[_0x9a62('0x74')]();_0x2e5991[_0x9a62('0x75')]('tq.TeamId')[_0x9a62('0x76')](_0x9a62('0x77'),'tq')[_0x9a62('0x78')](_0x9a62('0x79'),'ut',_0x9a62('0x7a'))[_0x9a62('0x46')](_0x9a62('0x7b'),_0x33547b[_0x9a62('0x4d')]['id']);for(var _0x1cece1=0x0;_0x1cece1<_0x10f4fa[_0x9a62('0x4e')];_0x1cece1+=0x1){let _0xff53f9=_0x10f4fa[_0x1cece1];for(var _0x22d000=0x0;_0x22d000<_0xff53f9['Agents'][_0x9a62('0x4e')];_0x22d000+=0x1){let _0x578d6d=_0xff53f9['Agents'][_0x22d000];var _0x23308c=_0x2e5991[_0x9a62('0x7c')]();_0x23308c['where'](_0x9a62('0x7d'),_0x578d6d['id']);_0x2ee75b[_0x9a62('0x7e')](db['sequelize'][_0x9a62('0x3b')](_0x23308c[_0x9a62('0x7f')](),{'type':db['sequelize'][_0x9a62('0x80')]['SELECT']})[_0x9a62('0x2a')](function(_0x5f1cbd){if(_0x5f1cbd[_0x9a62('0x4e')]===0x1){return _0x578d6d['id'];}else{var _0xe1875=_['every'](_['map'](_0x5f1cbd,_0x9a62('0x81')),function(_0x50da9f){return _[_0x9a62('0x82')](_0xc23efe,_0x50da9f);});if(_0xe1875){return _0x578d6d['id'];}}}));}}return BPromise[_0x9a62('0x83')](_0x2ee75b)[_0x9a62('0x2a')](function(_0x356838){_0x19b5de=_(_0x19b5de)[_0x9a62('0x84')](_0x356838)['compact']()['value']();return db[_0x9a62('0x35')][_0x9a62('0x50')]({'where':{'id':_0x33547b[_0x9a62('0x4d')]['id']}})[_0x9a62('0x2a')](function(_0x2ec7b0){return db['sequelize'][_0x9a62('0x85')](function(_0x254370){return _0x2ec7b0[_0x9a62('0x73')](_0x33547b[_0x9a62('0x3b')]['ids'],{'transaction':_0x254370})[_0x9a62('0x2a')](function(){if(!_[_0x9a62('0x86')](_0x19b5de)){return _0x2ec7b0[_0x9a62('0x87')](_0x19b5de,{'transaction':_0x254370});}})[_0x9a62('0x2a')](function(){_0x19b5de[_0x9a62('0x70')](function(_0xb8ea44){socket[_0x9a62('0x71')](_0x9a62('0x88'),{'UserId':_0xb8ea44,'OpenchannelQueueId':_0x2ec7b0['id']});});});});});});})['then'](respondWithStatusCode(_0x1cf6db,null))[_0x9a62('0x4b')](handleError(_0x1cf6db,null));};exports[_0x9a62('0x89')]=function(_0x4e7548,_0x509052,_0x195102){return db[_0x9a62('0x35')][_0x9a62('0x50')]({'where':{'id':_0x4e7548[_0x9a62('0x4d')]['id']}})[_0x9a62('0x2a')](handleEntityNotFound(_0x509052,null))[_0x9a62('0x2a')](function(_0x2c0eaf){if(_0x2c0eaf){return _0x2c0eaf[_0x9a62('0x89')](_0x4e7548[_0x9a62('0x51')][_0x9a62('0x67')],_['omit'](_0x4e7548['body'],[_0x9a62('0x67'),'id'])||{})[_0x9a62('0x8a')](function(_0x2946df){for(var _0x4d87c7=0x0;_0x4d87c7<_0x4e7548[_0x9a62('0x51')]['ids']['length'];_0x4d87c7+=0x1){socket[_0x9a62('0x71')](_0x9a62('0x72'),{'UserId':Number(_0x4e7548['body'][_0x9a62('0x67')][_0x4d87c7]),'OpenchannelQueueId':Number(_0x4e7548[_0x9a62('0x4d')]['id'])});}return _0x2946df;});}})['then'](respondWithResult(_0x509052,null))[_0x9a62('0x4b')](handleError(_0x509052,null));};exports[_0x9a62('0x87')]=function(_0x3c18e2,_0x31aec6,_0x92c147){return db[_0x9a62('0x35')][_0x9a62('0x50')]({'where':{'id':_0x3c18e2['params']['id']}})['then'](handleEntityNotFound(_0x31aec6,null))[_0x9a62('0x2a')](function(_0xc24267){if(_0xc24267){return _0xc24267['removeAgents'](_0x3c18e2['query']['ids'])[_0x9a62('0x2a')](function(){if(_[_0x9a62('0x8b')](_0x3c18e2[_0x9a62('0x3b')][_0x9a62('0x67')])){for(var _0x80126a=0x0;_0x80126a<_0x3c18e2['query'][_0x9a62('0x67')][_0x9a62('0x4e')];_0x80126a+=0x1){socket[_0x9a62('0x71')](_0x9a62('0x88'),{'UserId':Number(_0x3c18e2[_0x9a62('0x3b')][_0x9a62('0x67')][_0x80126a]),'OpenchannelQueueId':Number(_0x3c18e2[_0x9a62('0x4d')]['id'])});}}else{socket[_0x9a62('0x71')](_0x9a62('0x88'),{'UserId':Number(_0x3c18e2[_0x9a62('0x3b')][_0x9a62('0x67')]),'OpenchannelQueueId':Number(_0x3c18e2[_0x9a62('0x4d')]['id'])});}});}})[_0x9a62('0x2a')](respondWithStatusCode(_0x31aec6,null))['catch'](handleError(_0x31aec6,null));};exports[_0x9a62('0x8c')]=function(_0x7139f0,_0x34c2cf,_0xa672b3){var _0x59be8a={};var _0x1ba7d8={};var _0x4c3b27;var _0x2e2bdd;return db[_0x9a62('0x35')][_0x9a62('0x59')]({'where':{'id':_0x7139f0[_0x9a62('0x4d')]['id']}})[_0x9a62('0x2a')](handleEntityNotFound(_0x34c2cf,null))[_0x9a62('0x2a')](function(_0xff0206){if(_0xff0206){_0x4c3b27=_0xff0206;_0x1ba7d8[_0x9a62('0x3a')]=_[_0x9a62('0x3c')](db['User'][_0x9a62('0x36')]);_0x1ba7d8[_0x9a62('0x3b')]=_[_0x9a62('0x3c')](_0x7139f0[_0x9a62('0x3b')]);_0x1ba7d8[_0x9a62('0x3d')]=_['intersection'](_0x1ba7d8[_0x9a62('0x3a')],_0x1ba7d8[_0x9a62('0x3b')]);_0x59be8a[_0x9a62('0x3e')]=_['intersection'](_0x1ba7d8[_0x9a62('0x3a')],qs[_0x9a62('0x40')](_0x7139f0['query'][_0x9a62('0x40')]));_0x59be8a[_0x9a62('0x3e')]=_0x59be8a[_0x9a62('0x3e')]['length']?_0x59be8a['attributes']:_0x1ba7d8[_0x9a62('0x3a')];_0x59be8a[_0x9a62('0x42')]=qs['sort'](_0x7139f0[_0x9a62('0x3b')][_0x9a62('0x43')]);_0x59be8a[_0x9a62('0x46')]=qs[_0x9a62('0x3d')](_['pick'](_0x7139f0[_0x9a62('0x3b')],_0x1ba7d8[_0x9a62('0x3d')]));if(_0x7139f0['query']['filter']){_0x59be8a[_0x9a62('0x46')]=_[_0x9a62('0x47')](_0x59be8a[_0x9a62('0x46')],{'$or':_[_0x9a62('0x34')](_0x59be8a[_0x9a62('0x3e')],function(_0x5d9f03){var _0x150234={};_0x150234[_0x5d9f03]={'$like':'%'+_0x7139f0['query'][_0x9a62('0x45')]+'%'};return _0x150234;})});}_0x59be8a=_['merge']({},_0x59be8a,_0x7139f0[_0x9a62('0x49')]);return _0x4c3b27[_0x9a62('0x8c')](_0x59be8a);}})['then'](function(_0x3e3762){if(_0x3e3762){_0x2e2bdd=_0x3e3762[_0x9a62('0x4e')];if(!_0x7139f0[_0x9a62('0x3b')][_0x9a62('0x66')](_0x9a62('0x41'))){_0x59be8a[_0x9a62('0x24')]=qs[_0x9a62('0x24')](_0x7139f0[_0x9a62('0x3b')][_0x9a62('0x24')]);_0x59be8a['offset']=qs[_0x9a62('0x21')](_0x7139f0[_0x9a62('0x3b')][_0x9a62('0x21')]);}return _0x4c3b27[_0x9a62('0x8c')](_0x59be8a);}})[_0x9a62('0x2a')](function(_0x4c6396){if(_0x4c6396){return _0x4c6396?{'count':_0x2e2bdd,'rows':_0x4c6396}:null;}})['then'](respondWithResult(_0x34c2cf,null))['catch'](handleError(_0x34c2cf,null));}; \ No newline at end of file +var _0x23cb=['mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','defaults','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','stack','name','index','OpenchannelQueue','rawAttributes','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','filter','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','value','ids','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23cb,0x115));var _0xb23c=function(_0x20714a,_0x7de591){_0x20714a=_0x20714a-0x0;var _0x15e877=_0x23cb[_0x20714a];return _0x15e877;};'use strict';var emlformat=require(_0xb23c('0x0'));var rimraf=require(_0xb23c('0x1'));var zipdir=require(_0xb23c('0x2'));var jsonpatch=require(_0xb23c('0x3'));var rp=require(_0xb23c('0x4'));var moment=require(_0xb23c('0x5'));var BPromise=require(_0xb23c('0x6'));var Mustache=require(_0xb23c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb23c('0x8'));var csv=require('to-csv');var ejs=require(_0xb23c('0x9'));var fs=require('fs');var fs_extra=require(_0xb23c('0xa'));var _=require(_0xb23c('0xb'));var squel=require(_0xb23c('0xc'));var crypto=require(_0xb23c('0xd'));var jsforce=require(_0xb23c('0xe'));var deskjs=require(_0xb23c('0xf'));var toCsv=require(_0xb23c('0x10'));var querystring=require(_0xb23c('0x11'));var Papa=require(_0xb23c('0x12'));var Redis=require('ioredis');var authService=require(_0xb23c('0x13'));var qs=require(_0xb23c('0x14'));var as=require(_0xb23c('0x15'));var hardwareService=require(_0xb23c('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xb23c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb23c('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb23c('0x19')](config[_0xb23c('0x1a')],{'host':_0xb23c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb23c('0x1c'))[_0xb23c('0x1d')](socket);function respondWithStatusCode(_0x509d2a,_0x28b3ff){_0x28b3ff=_0x28b3ff||0xcc;return function(_0x2d7147){if(_0x2d7147){return _0x509d2a[_0xb23c('0x1e')](_0x28b3ff);}return _0x509d2a[_0xb23c('0x1f')](_0x28b3ff)['end']();};}function respondWithResult(_0x3d73d0,_0x2b7d71){_0x2b7d71=_0x2b7d71||0xc8;return function(_0x407266){if(_0x407266){return _0x3d73d0['status'](_0x2b7d71)['json'](_0x407266);}};}function respondWithFilteredResult(_0x528c9d,_0x24333b){return function(_0xb52382){if(_0xb52382){var _0x294b1f=typeof _0x24333b[_0xb23c('0x20')]===_0xb23c('0x21')&&typeof _0x24333b[_0xb23c('0x22')]==='undefined';var _0x5e2bd7=_0xb52382['count'];var _0x438ae6=_0x294b1f?0x0:_0x24333b[_0xb23c('0x20')];var _0x56adb1=_0x294b1f?_0xb52382[_0xb23c('0x23')]:_0x24333b[_0xb23c('0x20')]+_0x24333b[_0xb23c('0x22')];var _0xa40f76;if(_0x56adb1>=_0x5e2bd7){_0x56adb1=_0x5e2bd7;_0xa40f76=0xc8;}else{_0xa40f76=0xce;}_0x528c9d[_0xb23c('0x1f')](_0xa40f76);return _0x528c9d[_0xb23c('0x24')](_0xb23c('0x25'),_0x438ae6+'-'+_0x56adb1+'/'+_0x5e2bd7)['json'](_0xb52382);}return null;};}function patchUpdates(_0x4f7a74){return function(_0x33557b){try{jsonpatch[_0xb23c('0x26')](_0x33557b,_0x4f7a74,!![]);}catch(_0x19fa46){return BPromise['reject'](_0x19fa46);}return _0x33557b[_0xb23c('0x27')]();};}function saveUpdates(_0x27b83b,_0x2fd857){return function(_0x3134fd){if(_0x3134fd){return _0x3134fd[_0xb23c('0x28')](_0x27b83b)[_0xb23c('0x29')](function(_0x293ca4){return _0x293ca4;});}return null;};}function removeEntity(_0x8fd82b,_0x3c6b17){return function(_0x228563){if(_0x228563){return _0x228563['destroy']()[_0xb23c('0x29')](function(){var _0x5334bb=_0x228563[_0xb23c('0x2a')]({'plain':!![]});var _0x288f48=_0xb23c('0x2b');return db[_0xb23c('0x2c')][_0xb23c('0x2d')]({'where':{'type':_0x288f48,'resourceId':_0x5334bb['id']}})[_0xb23c('0x29')](function(){return _0x228563;});})['then'](function(){_0x8fd82b[_0xb23c('0x1f')](0xcc)[_0xb23c('0x2e')]();});}};}function handleEntityNotFound(_0x3fa8b9,_0x1d925c){return function(_0x23e0fa){if(!_0x23e0fa){_0x3fa8b9[_0xb23c('0x1e')](0x194);}return _0x23e0fa;};}function handleError(_0x225a7f,_0x347a93){_0x347a93=_0x347a93||0x1f4;return function(_0x567afc){logger[_0xb23c('0x2f')](_0x567afc[_0xb23c('0x30')]);if(_0x567afc[_0xb23c('0x31')]){delete _0x567afc[_0xb23c('0x31')];}_0x225a7f['status'](_0x347a93)['send'](_0x567afc);};}exports[_0xb23c('0x32')]=function(_0x81d6ed,_0x3b4767){var _0x83357a={},_0x2f6b6e={},_0x3e7391={'count':0x0,'rows':[]};var _0x119ce1=_['map'](db[_0xb23c('0x33')][_0xb23c('0x34')],function(_0x4661d1){return{'name':_0x4661d1['fieldName'],'type':_0x4661d1[_0xb23c('0x35')][_0xb23c('0x36')]};});_0x2f6b6e[_0xb23c('0x37')]=_[_0xb23c('0x38')](_0x119ce1,_0xb23c('0x31'));_0x2f6b6e['query']=_[_0xb23c('0x39')](_0x81d6ed[_0xb23c('0x3a')]);_0x2f6b6e['filters']=_[_0xb23c('0x3b')](_0x2f6b6e['model'],_0x2f6b6e[_0xb23c('0x3a')]);_0x83357a['attributes']=_[_0xb23c('0x3b')](_0x2f6b6e[_0xb23c('0x37')],qs['fields'](_0x81d6ed[_0xb23c('0x3a')][_0xb23c('0x3c')]));_0x83357a[_0xb23c('0x3d')]=_0x83357a['attributes'][_0xb23c('0x3e')]?_0x83357a[_0xb23c('0x3d')]:_0x2f6b6e[_0xb23c('0x37')];if(!_0x81d6ed[_0xb23c('0x3a')][_0xb23c('0x3f')]('nolimit')){_0x83357a[_0xb23c('0x22')]=qs['limit'](_0x81d6ed['query'][_0xb23c('0x22')]);_0x83357a['offset']=qs[_0xb23c('0x20')](_0x81d6ed[_0xb23c('0x3a')]['offset']);}_0x83357a[_0xb23c('0x40')]=qs[_0xb23c('0x41')](_0x81d6ed[_0xb23c('0x3a')][_0xb23c('0x41')]);_0x83357a[_0xb23c('0x42')]=qs[_0xb23c('0x43')](_[_0xb23c('0x44')](_0x81d6ed['query'],_0x2f6b6e['filters']),_0x119ce1);if(_0x81d6ed[_0xb23c('0x3a')]['filter']){_0x83357a['where']=_['merge'](_0x83357a[_0xb23c('0x42')],{'$or':_['map'](_0x119ce1,function(_0x56b362){if(_0x56b362[_0xb23c('0x35')]!==_0xb23c('0x45')){var _0x2dbe90={};_0x2dbe90[_0x56b362[_0xb23c('0x31')]]={'$like':'%'+_0x81d6ed[_0xb23c('0x3a')]['filter']+'%'};return _0x2dbe90;}})});}_0x83357a=_[_0xb23c('0x46')]({},_0x83357a,_0x81d6ed[_0xb23c('0x47')]);var _0x2bc918={'where':_0x83357a[_0xb23c('0x42')]};return db[_0xb23c('0x33')][_0xb23c('0x23')](_0x2bc918)['then'](function(_0x1290b4){_0x3e7391['count']=_0x1290b4;if(_0x81d6ed[_0xb23c('0x3a')][_0xb23c('0x48')]){_0x83357a[_0xb23c('0x49')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xb23c('0x4a')](_0x83357a);})[_0xb23c('0x29')](function(_0x49b0bb){_0x3e7391[_0xb23c('0x4b')]=_0x49b0bb;return _0x3e7391;})[_0xb23c('0x29')](respondWithFilteredResult(_0x3b4767,_0x83357a))[_0xb23c('0x4c')](handleError(_0x3b4767,null));};exports['show']=function(_0x3b4a51,_0x3665a0){var _0x14ff02={'raw':!![],'where':{'id':_0x3b4a51[_0xb23c('0x4d')]['id']}},_0x2315db={};_0x2315db['model']=_[_0xb23c('0x39')](db[_0xb23c('0x33')][_0xb23c('0x34')]);_0x2315db['query']=_[_0xb23c('0x39')](_0x3b4a51[_0xb23c('0x3a')]);_0x2315db[_0xb23c('0x43')]=_[_0xb23c('0x3b')](_0x2315db[_0xb23c('0x37')],_0x2315db[_0xb23c('0x3a')]);_0x14ff02[_0xb23c('0x3d')]=_[_0xb23c('0x3b')](_0x2315db[_0xb23c('0x37')],qs[_0xb23c('0x3c')](_0x3b4a51[_0xb23c('0x3a')][_0xb23c('0x3c')]));_0x14ff02[_0xb23c('0x3d')]=_0x14ff02['attributes'][_0xb23c('0x3e')]?_0x14ff02[_0xb23c('0x3d')]:_0x2315db[_0xb23c('0x37')];if(_0x3b4a51['query'][_0xb23c('0x48')]){_0x14ff02[_0xb23c('0x49')]=[{'all':!![]}];}_0x14ff02=_[_0xb23c('0x46')]({},_0x14ff02,_0x3b4a51[_0xb23c('0x47')]);return db[_0xb23c('0x33')][_0xb23c('0x4e')](_0x14ff02)[_0xb23c('0x29')](handleEntityNotFound(_0x3665a0,null))[_0xb23c('0x29')](respondWithResult(_0x3665a0,null))[_0xb23c('0x4c')](handleError(_0x3665a0,null));};exports[_0xb23c('0x4f')]=function(_0x5e902f,_0x1aadb5){return db['OpenchannelQueue'][_0xb23c('0x4f')](_0x5e902f[_0xb23c('0x50')],{})[_0xb23c('0x29')](function(_0x409ffe){var _0x4b5552=_0x5e902f[_0xb23c('0x51')][_0xb23c('0x2a')]({'plain':!![]});if(!_0x4b5552)throw new Error(_0xb23c('0x52'));if(_0x4b5552['role']==='user'){var _0x2d8cd1=_0x409ffe[_0xb23c('0x2a')]({'plain':!![]});var _0x52de4b=_0xb23c('0x2b');return db[_0xb23c('0x53')][_0xb23c('0x4e')]({'where':{'name':_0x52de4b,'userProfileId':_0x4b5552[_0xb23c('0x54')]},'raw':!![]})[_0xb23c('0x29')](function(_0x227acd){if(_0x227acd&&_0x227acd[_0xb23c('0x55')]===0x0){return db[_0xb23c('0x2c')][_0xb23c('0x4f')]({'name':_0x2d8cd1[_0xb23c('0x31')],'resourceId':_0x2d8cd1['id'],'type':_0x227acd[_0xb23c('0x31')],'sectionId':_0x227acd['id']},{})[_0xb23c('0x29')](function(){return _0x409ffe;});}else{return _0x409ffe;}})[_0xb23c('0x4c')](function(_0x9895f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9895f3);throw _0x9895f3;});}return _0x409ffe;})[_0xb23c('0x29')](respondWithResult(_0x1aadb5,0xc9))[_0xb23c('0x4c')](handleError(_0x1aadb5,null));};exports[_0xb23c('0x28')]=function(_0x5e66bb,_0x2b17e0){if(_0x5e66bb[_0xb23c('0x50')]['id']){delete _0x5e66bb[_0xb23c('0x50')]['id'];}return db[_0xb23c('0x33')][_0xb23c('0x4e')]({'where':{'id':_0x5e66bb[_0xb23c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2b17e0,null))['then'](saveUpdates(_0x5e66bb[_0xb23c('0x50')],null))['then'](respondWithResult(_0x2b17e0,null))[_0xb23c('0x4c')](handleError(_0x2b17e0,null));};exports[_0xb23c('0x2d')]=function(_0x522134,_0x5b8a4d){return db[_0xb23c('0x33')][_0xb23c('0x4e')]({'where':{'id':_0x522134[_0xb23c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b8a4d,null))[_0xb23c('0x29')](removeEntity(_0x5b8a4d,null))[_0xb23c('0x4c')](handleError(_0x5b8a4d,null));};exports[_0xb23c('0x56')]=function(_0x16771a,_0x4e580a){return db['OpenchannelQueue'][_0xb23c('0x56')]()[_0xb23c('0x29')](respondWithResult(_0x4e580a,null))[_0xb23c('0x4c')](handleError(_0x4e580a,null));};exports['getMembers']=function(_0x1a0fa8,_0x405dd6,_0x40d774){var _0x1c2ca2={'raw':!![],'where':{}},_0xd5bb3={},_0x2405aa;return db[_0xb23c('0x33')][_0xb23c('0x57')]({'where':{'id':_0x1a0fa8[_0xb23c('0x4d')]['id']}})[_0xb23c('0x29')](handleEntityNotFound(_0x405dd6,null))[_0xb23c('0x29')](function(_0x135958){if(_0x135958){_0x2405aa=_0x135958[_0xb23c('0x2a')]({'plain':!![]});_0xd5bb3[_0xb23c('0x37')]=_[_0xb23c('0x39')](db[_0xb23c('0x58')][_0xb23c('0x34')]);_0xd5bb3[_0xb23c('0x3a')]=_[_0xb23c('0x39')](_0x1a0fa8[_0xb23c('0x3a')]);_0xd5bb3[_0xb23c('0x43')]=_[_0xb23c('0x3b')](_0xd5bb3[_0xb23c('0x37')],_0xd5bb3[_0xb23c('0x3a')]);_0x1c2ca2[_0xb23c('0x3d')]=_[_0xb23c('0x3b')](_0xd5bb3[_0xb23c('0x37')],qs[_0xb23c('0x3c')](_0x1a0fa8[_0xb23c('0x3a')][_0xb23c('0x3c')]));_0x1c2ca2[_0xb23c('0x3d')]=_0x1c2ca2[_0xb23c('0x3d')][_0xb23c('0x3e')]?_0x1c2ca2[_0xb23c('0x3d')]:_0xd5bb3['model'];if(!_0x1a0fa8[_0xb23c('0x3a')][_0xb23c('0x3f')]('nolimit')){_0x1c2ca2['limit']=qs[_0xb23c('0x22')](_0x1a0fa8[_0xb23c('0x3a')][_0xb23c('0x22')]);_0x1c2ca2[_0xb23c('0x20')]=qs[_0xb23c('0x20')](_0x1a0fa8['query'][_0xb23c('0x20')]);}_0x1c2ca2[_0xb23c('0x40')]=qs[_0xb23c('0x41')](_0x1a0fa8[_0xb23c('0x3a')][_0xb23c('0x41')]);_0x1c2ca2[_0xb23c('0x42')]=qs['filters'](_[_0xb23c('0x44')](_0x1a0fa8['query'],_0xd5bb3[_0xb23c('0x43')]));_0x1c2ca2[_0xb23c('0x42')][_0xb23c('0x59')]=_0x135958['id'];if(_0x1a0fa8[_0xb23c('0x3a')][_0xb23c('0x5a')]){_0x1c2ca2[_0xb23c('0x42')]=_[_0xb23c('0x46')](_0x1c2ca2[_0xb23c('0x42')],{'$or':_[_0xb23c('0x38')](_0x1c2ca2['attributes'],function(_0x2a00ae){var _0x166200={};_0x166200[_0x2a00ae]={'$like':'%'+_0x1a0fa8[_0xb23c('0x3a')]['filter']+'%'};return _0x166200;})});}_0x1c2ca2=_[_0xb23c('0x46')]({},_0x1c2ca2,_0x1a0fa8[_0xb23c('0x47')]);return db[_0xb23c('0x58')][_0xb23c('0x4a')](_0x1c2ca2);}})[_0xb23c('0x29')](function(_0x2aab89){if(_0x2aab89){return db[_0xb23c('0x5b')][_0xb23c('0x5c')]({'where':{'id':_[_0xb23c('0x38')](_0x2aab89,_0xb23c('0x5d')),'role':'agent'},'attributes':['id',_0xb23c('0x31'),_0xb23c('0x5e'),_0xb23c('0x5f'),_0xb23c('0x60')]});}})[_0xb23c('0x29')](function(_0x549bf4){if(_0x549bf4){return{'count':_0x549bf4[_0xb23c('0x23')],'rows':_[_0xb23c('0x38')](_0x549bf4[_0xb23c('0x4b')],function(_0x2e6242){return{'membername':_0x2e6242['name'],'UserId':_0x2e6242['id'],'queue_name':_0x2405aa['name'],'OpenchannelQueueId':_0x2405aa['id'],'interface':util[_0xb23c('0x61')]('%s/%s',_0xb23c('0x62'),_0x2e6242[_0xb23c('0x31')]),'penalty':0x0,'paused':_0x2e6242[_0xb23c('0x5e')],'createdAt':_0x2e6242[_0xb23c('0x60')],'updatedAt':_0x2e6242[_0xb23c('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x405dd6,_0x1c2ca2))[_0xb23c('0x4c')](handleError(_0x405dd6,null));};exports[_0xb23c('0x63')]=function(_0x109a9e,_0x4bfb4c,_0xbf3aea){var _0x4d3809={};var _0x4918c6={};var _0xd5db0a;var _0x35f284;return db[_0xb23c('0x33')][_0xb23c('0x57')]({'where':{'id':_0x109a9e[_0xb23c('0x4d')]['id']}})[_0xb23c('0x29')](handleEntityNotFound(_0x4bfb4c,null))[_0xb23c('0x29')](function(_0x4cee97){if(_0x4cee97){_0xd5db0a=_0x4cee97;_0x4918c6[_0xb23c('0x37')]=_[_0xb23c('0x39')](db[_0xb23c('0x64')][_0xb23c('0x34')]);_0x4918c6['query']=_['keys'](_0x109a9e[_0xb23c('0x3a')]);_0x4918c6[_0xb23c('0x43')]=_[_0xb23c('0x3b')](_0x4918c6[_0xb23c('0x37')],_0x4918c6[_0xb23c('0x3a')]);_0x4d3809[_0xb23c('0x3d')]=_[_0xb23c('0x3b')](_0x4918c6[_0xb23c('0x37')],qs['fields'](_0x109a9e[_0xb23c('0x3a')][_0xb23c('0x3c')]));_0x4d3809['attributes']=_0x4d3809[_0xb23c('0x3d')][_0xb23c('0x3e')]?_0x4d3809[_0xb23c('0x3d')]:_0x4918c6[_0xb23c('0x37')];_0x4d3809[_0xb23c('0x40')]=qs[_0xb23c('0x41')](_0x109a9e[_0xb23c('0x3a')][_0xb23c('0x41')]);_0x4d3809[_0xb23c('0x42')]=qs['filters'](_[_0xb23c('0x44')](_0x109a9e['query'],_0x4918c6[_0xb23c('0x43')]));if(_0x109a9e['query'][_0xb23c('0x5a')]){_0x4d3809[_0xb23c('0x42')]=_['merge'](_0x4d3809[_0xb23c('0x42')],{'$or':_['map'](_0x4d3809['attributes'],function(_0x18a009){var _0x5cc004={};_0x5cc004[_0x18a009]={'$like':'%'+_0x109a9e['query'][_0xb23c('0x5a')]+'%'};return _0x5cc004;})});}_0x4d3809=_['merge']({},_0x4d3809,_0x109a9e[_0xb23c('0x47')]);return _0xd5db0a[_0xb23c('0x63')](_0x4d3809);}})[_0xb23c('0x29')](function(_0x509588){if(_0x509588){_0x35f284=_0x509588['length'];if(!_0x109a9e[_0xb23c('0x3a')][_0xb23c('0x3f')](_0xb23c('0x65'))){_0x4d3809[_0xb23c('0x22')]=qs['limit'](_0x109a9e['query'][_0xb23c('0x22')]);_0x4d3809[_0xb23c('0x20')]=qs[_0xb23c('0x20')](_0x109a9e[_0xb23c('0x3a')][_0xb23c('0x20')]);}return _0xd5db0a[_0xb23c('0x63')](_0x4d3809);}})[_0xb23c('0x29')](function(_0x1d33f3){if(_0x1d33f3){return _0x1d33f3?{'count':_0x35f284,'rows':_0x1d33f3}:null;}})[_0xb23c('0x29')](respondWithResult(_0x4bfb4c,null))[_0xb23c('0x4c')](handleError(_0x4bfb4c,null));};exports['addTeams']=function(_0x1ec4a1,_0x423075,_0x54fe23){var _0x8915b8=_0x1ec4a1[_0xb23c('0x50')]['ids'];return db[_0xb23c('0x64')]['findAll']({'where':{'id':_0x8915b8},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb23c('0x66'),'attributes':['id','name',_0xb23c('0x67'),_0xb23c('0x68'),_0xb23c('0x69')],'raw':!![]}]})[_0xb23c('0x29')](function(_0x4144c9){if(_0x4144c9){var _0x40492f=_[_0xb23c('0x6a')](_0x4144c9,function(_0x3b2a83){var _0x5d07d9=_0x3b2a83[_0xb23c('0x2a')]({'plain':!![]});return _0x5d07d9[_0xb23c('0x66')];});return db[_0xb23c('0x33')][_0xb23c('0x4e')]({'where':{'id':_0x1ec4a1[_0xb23c('0x4d')]['id']}})[_0xb23c('0x29')](function(_0x3ce806){return db[_0xb23c('0x6b')][_0xb23c('0x6c')](function(_0x1befc3){return _0x3ce806[_0xb23c('0x6d')](_0x8915b8,{'transaction':_0x1befc3})[_0xb23c('0x29')](function(){return BPromise[_0xb23c('0x6e')](_0x40492f,function(_0x18e505){return db[_0xb23c('0x58')][_0xb23c('0x6f')]({'where':{'UserId':_0x18e505['id'],'OpenchannelQueueId':_0x1ec4a1[_0xb23c('0x4d')]['id']},'transaction':_0x1befc3});});})['then'](function(){_0x40492f['forEach'](function(_0x2690fc){socket[_0xb23c('0x70')](_0xb23c('0x71'),{'UserId':_0x2690fc['id'],'OpenchannelQueueId':_0x3ce806['id']});});});});});}})[_0xb23c('0x29')](respondWithStatusCode(_0x423075,null))[_0xb23c('0x4c')](handleError(_0x423075,null));};exports[_0xb23c('0x72')]=function(_0x589575,_0x44bad7,_0x588711){return db[_0xb23c('0x64')][_0xb23c('0x4a')]({'where':{'id':_0x589575[_0xb23c('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb23c('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb23c('0x29')](handleEntityNotFound(_0x44bad7,null))['then'](function(_0x4c322b){var _0x546fab=_[_0xb23c('0x38')](_0x4c322b,'id');var _0x5d394b=[];var _0x53b8c2=[];var _0x533694=squel[_0xb23c('0x73')]();_0x533694['field'](_0xb23c('0x74'))[_0xb23c('0x75')](_0xb23c('0x76'),'tq')[_0xb23c('0x77')](_0xb23c('0x78'),'ut',_0xb23c('0x79'))[_0xb23c('0x42')](_0xb23c('0x7a'),_0x589575['params']['id']);for(var _0xc4c4e2=0x0;_0xc4c4e2<_0x4c322b[_0xb23c('0x3e')];_0xc4c4e2+=0x1){let _0x2c10ae=_0x4c322b[_0xc4c4e2];for(var _0x4d862a=0x0;_0x4d862a<_0x2c10ae['Agents'][_0xb23c('0x3e')];_0x4d862a+=0x1){let _0xfce327=_0x2c10ae['Agents'][_0x4d862a];var _0x58ddbf=_0x533694[_0xb23c('0x7b')]();_0x58ddbf['where'](_0xb23c('0x7c'),_0xfce327['id']);_0x53b8c2[_0xb23c('0x7d')](db['sequelize'][_0xb23c('0x3a')](_0x58ddbf[_0xb23c('0x7e')](),{'type':db['sequelize'][_0xb23c('0x7f')][_0xb23c('0x80')]})['then'](function(_0x130d14){if(_0x130d14[_0xb23c('0x3e')]===0x1){return _0xfce327['id'];}else{var _0x432363=_['every'](_[_0xb23c('0x38')](_0x130d14,'TeamId'),function(_0x38bb2f){return _[_0xb23c('0x81')](_0x546fab,_0x38bb2f);});if(_0x432363){return _0xfce327['id'];}}}));}}return BPromise[_0xb23c('0x82')](_0x53b8c2)[_0xb23c('0x29')](function(_0x331452){_0x5d394b=_(_0x5d394b)[_0xb23c('0x83')](_0x331452)['compact']()[_0xb23c('0x84')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x589575[_0xb23c('0x4d')]['id']}})[_0xb23c('0x29')](function(_0x9b35d0){return db[_0xb23c('0x6b')][_0xb23c('0x6c')](function(_0x36a575){return _0x9b35d0[_0xb23c('0x72')](_0x589575[_0xb23c('0x3a')][_0xb23c('0x85')],{'transaction':_0x36a575})[_0xb23c('0x29')](function(){if(!_[_0xb23c('0x86')](_0x5d394b)){return _0x9b35d0['removeAgents'](_0x5d394b,{'transaction':_0x36a575});}})[_0xb23c('0x29')](function(){_0x5d394b[_0xb23c('0x87')](function(_0x5370a3){socket[_0xb23c('0x70')](_0xb23c('0x88'),{'UserId':_0x5370a3,'OpenchannelQueueId':_0x9b35d0['id']});});});});});});})['then'](respondWithStatusCode(_0x44bad7,null))[_0xb23c('0x4c')](handleError(_0x44bad7,null));};exports[_0xb23c('0x89')]=function(_0x56922f,_0x447f83,_0x42e853){return db['OpenchannelQueue'][_0xb23c('0x4e')]({'where':{'id':_0x56922f['params']['id']}})[_0xb23c('0x29')](handleEntityNotFound(_0x447f83,null))['then'](function(_0xd5175){if(_0xd5175){return _0xd5175['addAgents'](_0x56922f['body'][_0xb23c('0x85')],_[_0xb23c('0x8a')](_0x56922f[_0xb23c('0x50')],['ids','id'])||{})[_0xb23c('0x8b')](function(_0xe77d58){for(var _0x53b4ab=0x0;_0x53b4ab<_0x56922f[_0xb23c('0x50')]['ids'][_0xb23c('0x3e')];_0x53b4ab+=0x1){socket[_0xb23c('0x70')](_0xb23c('0x71'),{'UserId':Number(_0x56922f[_0xb23c('0x50')][_0xb23c('0x85')][_0x53b4ab]),'OpenchannelQueueId':Number(_0x56922f['params']['id'])});}return _0xe77d58;});}})[_0xb23c('0x29')](respondWithResult(_0x447f83,null))[_0xb23c('0x4c')](handleError(_0x447f83,null));};exports['removeAgents']=function(_0x34e164,_0x3b9ecd,_0x597758){return db['OpenchannelQueue']['find']({'where':{'id':_0x34e164[_0xb23c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b9ecd,null))[_0xb23c('0x29')](function(_0x49be1b){if(_0x49be1b){return _0x49be1b[_0xb23c('0x8c')](_0x34e164['query']['ids'])[_0xb23c('0x29')](function(){if(_['isArray'](_0x34e164['query'][_0xb23c('0x85')])){for(var _0xc96d5a=0x0;_0xc96d5a<_0x34e164[_0xb23c('0x3a')][_0xb23c('0x85')][_0xb23c('0x3e')];_0xc96d5a+=0x1){socket[_0xb23c('0x70')](_0xb23c('0x88'),{'UserId':Number(_0x34e164[_0xb23c('0x3a')][_0xb23c('0x85')][_0xc96d5a]),'OpenchannelQueueId':Number(_0x34e164[_0xb23c('0x4d')]['id'])});}}else{socket[_0xb23c('0x70')](_0xb23c('0x88'),{'UserId':Number(_0x34e164[_0xb23c('0x3a')]['ids']),'OpenchannelQueueId':Number(_0x34e164[_0xb23c('0x4d')]['id'])});}});}})[_0xb23c('0x29')](respondWithStatusCode(_0x3b9ecd,null))[_0xb23c('0x4c')](handleError(_0x3b9ecd,null));};exports[_0xb23c('0x8d')]=function(_0x3a7267,_0x4dda90,_0x4b0d08){var _0x552c17={};var _0x5cf8b2={};var _0x41756f;var _0x928b15;return db[_0xb23c('0x33')]['findOne']({'where':{'id':_0x3a7267[_0xb23c('0x4d')]['id']}})[_0xb23c('0x29')](handleEntityNotFound(_0x4dda90,null))[_0xb23c('0x29')](function(_0x685074){if(_0x685074){_0x41756f=_0x685074;_0x5cf8b2['model']=_[_0xb23c('0x39')](db[_0xb23c('0x5b')][_0xb23c('0x34')]);_0x5cf8b2[_0xb23c('0x3a')]=_[_0xb23c('0x39')](_0x3a7267[_0xb23c('0x3a')]);_0x5cf8b2[_0xb23c('0x43')]=_['intersection'](_0x5cf8b2[_0xb23c('0x37')],_0x5cf8b2[_0xb23c('0x3a')]);_0x552c17[_0xb23c('0x3d')]=_['intersection'](_0x5cf8b2[_0xb23c('0x37')],qs[_0xb23c('0x3c')](_0x3a7267[_0xb23c('0x3a')][_0xb23c('0x3c')]));_0x552c17[_0xb23c('0x3d')]=_0x552c17[_0xb23c('0x3d')][_0xb23c('0x3e')]?_0x552c17[_0xb23c('0x3d')]:_0x5cf8b2[_0xb23c('0x37')];_0x552c17[_0xb23c('0x40')]=qs[_0xb23c('0x41')](_0x3a7267[_0xb23c('0x3a')][_0xb23c('0x41')]);_0x552c17[_0xb23c('0x42')]=qs[_0xb23c('0x43')](_['pick'](_0x3a7267['query'],_0x5cf8b2[_0xb23c('0x43')]));if(_0x3a7267[_0xb23c('0x3a')]['filter']){_0x552c17[_0xb23c('0x42')]=_[_0xb23c('0x46')](_0x552c17[_0xb23c('0x42')],{'$or':_['map'](_0x552c17[_0xb23c('0x3d')],function(_0x10670f){var _0x5e13f0={};_0x5e13f0[_0x10670f]={'$like':'%'+_0x3a7267['query']['filter']+'%'};return _0x5e13f0;})});}_0x552c17=_['merge']({},_0x552c17,_0x3a7267[_0xb23c('0x47')]);return _0x41756f[_0xb23c('0x8d')](_0x552c17);}})[_0xb23c('0x29')](function(_0x69bf38){if(_0x69bf38){_0x928b15=_0x69bf38['length'];if(!_0x3a7267[_0xb23c('0x3a')][_0xb23c('0x3f')](_0xb23c('0x65'))){_0x552c17['limit']=qs[_0xb23c('0x22')](_0x3a7267[_0xb23c('0x3a')][_0xb23c('0x22')]);_0x552c17[_0xb23c('0x20')]=qs[_0xb23c('0x20')](_0x3a7267[_0xb23c('0x3a')]['offset']);}return _0x41756f[_0xb23c('0x8d')](_0x552c17);}})[_0xb23c('0x29')](function(_0x430684){if(_0x430684){return _0x430684?{'count':_0x928b15,'rows':_0x430684}:null;}})[_0xb23c('0x29')](respondWithResult(_0x4dda90,null))[_0xb23c('0x4c')](handleError(_0x4dda90,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ce6d90f..5af98d2 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 _0xa4ac=['remove','emit','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x4f8fc6,_0x49865a){var _0xdb26c0=function(_0x2a1a6b){while(--_0x2a1a6b){_0x4f8fc6['push'](_0x4f8fc6['shift']());}};_0xdb26c0(++_0x49865a);}(_0xa4ac,0x16b));var _0xca4a=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xa4ac[_0x37b7b6];return _0x10c4c3;};'use strict';var EventEmitter=require(_0xca4a('0x0'));var OpenchannelQueue=require(_0xca4a('0x1'))['db'][_0xca4a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xca4a('0x3')](0x0);var events={'afterCreate':_0xca4a('0x4'),'afterUpdate':_0xca4a('0x5'),'afterDestroy':_0xca4a('0x6')};function emitEvent(_0x209068){return function(_0x357e6b,_0x11e278,_0x47f70f){OpenchannelQueueEvents[_0xca4a('0x7')](_0x209068+':'+_0x357e6b['id'],_0x357e6b);OpenchannelQueueEvents['emit'](_0x209068,_0x357e6b);_0x47f70f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xca4a('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xbbcd=['hook','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3887b3,_0x38d669){var _0x2541a9=function(_0x2195ba){while(--_0x2195ba){_0x3887b3['push'](_0x3887b3['shift']());}};_0x2541a9(++_0x38d669);}(_0xbbcd,0xe9));var _0xdbbc=function(_0x5eaf89,_0x2204d6){_0x5eaf89=_0x5eaf89-0x0;var _0x2d878f=_0xbbcd[_0x5eaf89];return _0x2d878f;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xdbbc('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdbbc('0x1')](0x0);var events={'afterCreate':_0xdbbc('0x2'),'afterUpdate':_0xdbbc('0x3'),'afterDestroy':_0xdbbc('0x4')};function emitEvent(_0x3e3b4b){return function(_0x3b51ca,_0x29d5f5,_0x54bcc0){OpenchannelQueueEvents[_0xdbbc('0x5')](_0x3e3b4b+':'+_0x3b51ca['id'],_0x3b51ca);OpenchannelQueueEvents[_0xdbbc('0x5')](_0x3e3b4b,_0x3b51ca);_0x54bcc0(null);};}for(var e in events){if(events[_0xdbbc('0x6')](e)){var event=events[e];OpenchannelQueue[_0xdbbc('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 34e85e5..3e92e50 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 _0x915c=['openchannel_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x39c8ba,_0x216e0b){var _0x56c70d=function(_0x588ec0){while(--_0x588ec0){_0x39c8ba['push'](_0x39c8ba['shift']());}};_0x56c70d(++_0x216e0b);}(_0x915c,0x1c9));var _0xc915=function(_0x2ead79,_0x2acd48){_0x2ead79=_0x2ead79-0x0;var _0x4d9b4c=_0x915c[_0x2ead79];return _0x4d9b4c;};'use strict';var _=require(_0xc915('0x0'));var util=require(_0xc915('0x1'));var logger=require(_0xc915('0x2'))('api');var moment=require(_0xc915('0x3'));var BPromise=require('bluebird');var rp=require(_0xc915('0x4'));var fs=require('fs');var path=require(_0xc915('0x5'));var rimraf=require('rimraf');var config=require(_0xc915('0x6'));var attributes=require(_0xc915('0x7'));module[_0xc915('0x8')]=function(_0x37355d,_0x4edd13){return _0x37355d[_0xc915('0x9')](_0xc915('0xa'),attributes,{'tableName':_0xc915('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a1d=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x24deb9,_0x206ea7){var _0xa375ba=function(_0x19078f){while(--_0x19078f){_0x24deb9['push'](_0x24deb9['shift']());}};_0xa375ba(++_0x206ea7);}(_0x0a1d,0x152));var _0xd0a1=function(_0x2d5219,_0x5adf57){_0x2d5219=_0x2d5219-0x0;var _0xf67855=_0x0a1d[_0x2d5219];return _0xf67855;};'use strict';var _=require(_0xd0a1('0x0'));var util=require('util');var logger=require(_0xd0a1('0x1'))(_0xd0a1('0x2'));var moment=require(_0xd0a1('0x3'));var BPromise=require(_0xd0a1('0x4'));var rp=require(_0xd0a1('0x5'));var fs=require('fs');var path=require(_0xd0a1('0x6'));var rimraf=require(_0xd0a1('0x7'));var config=require(_0xd0a1('0x8'));var attributes=require(_0xd0a1('0x9'));module[_0xd0a1('0xa')]=function(_0x36b91a,_0x5cee28){return _0x36b91a[_0xd0a1('0xb')](_0xd0a1('0xc'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 7569ce2..0962278 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 _0x7d3a=['model','GetOpenchannelQueue','catch','ShowOpenchannelQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x3769ce,_0x268847){var _0x129708=function(_0x479723){while(--_0x479723){_0x3769ce['push'](_0x3769ce['shift']());}};_0x129708(++_0x268847);}(_0x7d3a,0x9d));var _0xa7d3=function(_0x4a219c,_0x2ab4af){_0x4a219c=_0x4a219c-0x0;var _0x8ea251=_0x7d3a[_0x4a219c];return _0x8ea251;};'use strict';var _=require('lodash');var util=require(_0xa7d3('0x0'));var moment=require('moment');var BPromise=require(_0xa7d3('0x1'));var rs=require(_0xa7d3('0x2'));var fs=require('fs');var Redis=require(_0xa7d3('0x3'));var db=require(_0xa7d3('0x4'))['db'];var utils=require(_0xa7d3('0x5'));var logger=require('../../config/logger')(_0xa7d3('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7d3('0x7'));var client=jayson['client'][_0xa7d3('0x8')]({'port':0x232a});config['redis']=_[_0xa7d3('0x9')](config[_0xa7d3('0xa')],{'host':_0xa7d3('0xb'),'port':0x18eb});var socket=require(_0xa7d3('0xc'))(new Redis(config[_0xa7d3('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x420169,_0x4f0362,_0x51bd79){return new BPromise(function(_0x164f57,_0x5cedb4){return client[_0xa7d3('0xd')](_0x420169,_0x51bd79)[_0xa7d3('0xe')](function(_0x429d82){logger[_0xa7d3('0xf')](_0xa7d3('0x10'),_0x4f0362,_0xa7d3('0x11'));logger[_0xa7d3('0x12')](_0xa7d3('0x13'),_0x4f0362,_0xa7d3('0x11'),JSON[_0xa7d3('0x14')](_0x429d82));if(_0x429d82['error']){if(_0x429d82[_0xa7d3('0x15')][_0xa7d3('0x16')]===0x1f4){logger[_0xa7d3('0x15')](_0xa7d3('0x10'),_0x4f0362,_0x429d82[_0xa7d3('0x15')][_0xa7d3('0x17')]);return _0x5cedb4(_0x429d82['error'][_0xa7d3('0x17')]);}logger[_0xa7d3('0x15')](_0xa7d3('0x10'),_0x4f0362,_0x429d82['error'][_0xa7d3('0x17')]);return _0x164f57(_0x429d82[_0xa7d3('0x15')][_0xa7d3('0x17')]);}else{logger['info'](_0xa7d3('0x10'),_0x4f0362,_0xa7d3('0x11'));_0x164f57(_0x429d82['result'][_0xa7d3('0x17')]);}})['catch'](function(_0x38eec4){logger[_0xa7d3('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x4f0362,_0x38eec4);_0x5cedb4(_0x38eec4);});});}exports['GetOpenchannelQueue']=function(_0x3c2240){var _0x218769=this;return new Promise(function(_0x20b369,_0x26135b){return db[_0xa7d3('0x18')][_0xa7d3('0x19')]({'raw':_0x3c2240[_0xa7d3('0x1a')]?_0x3c2240[_0xa7d3('0x1a')][_0xa7d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c2240[_0xa7d3('0x1a')]?_0x3c2240[_0xa7d3('0x1a')][_0xa7d3('0x1c')]||null:null,'attributes':_0x3c2240['options']?_0x3c2240[_0xa7d3('0x1a')][_0xa7d3('0x1d')]||null:null,'limit':_0x3c2240['options']?_0x3c2240[_0xa7d3('0x1a')][_0xa7d3('0x1e')]||null:null,'include':_0x3c2240[_0xa7d3('0x1a')]?_0x3c2240['options']['include']?_[_0xa7d3('0x1f')](_0x3c2240[_0xa7d3('0x1a')][_0xa7d3('0x20')],function(_0x49c1f1){return{'model':db[_0x49c1f1[_0xa7d3('0x21')]],'as':_0x49c1f1['as'],'attributes':_0x49c1f1[_0xa7d3('0x1d')],'include':_0x49c1f1[_0xa7d3('0x20')]?_['map'](_0x49c1f1['include'],function(_0x38f8c9){return{'model':db[_0x38f8c9[_0xa7d3('0x21')]],'as':_0x38f8c9['as'],'attributes':_0x38f8c9[_0xa7d3('0x1d')],'include':_0x38f8c9['include']?_[_0xa7d3('0x1f')](_0x38f8c9[_0xa7d3('0x20')],function(_0x55135e){return{'model':db[_0x55135e[_0xa7d3('0x21')]],'as':_0x55135e['as'],'attributes':_0x55135e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x510652){logger[_0xa7d3('0xf')](_0xa7d3('0x22'),_0x3c2240);logger[_0xa7d3('0x12')](_0xa7d3('0x22'),_0x3c2240,JSON[_0xa7d3('0x14')](_0x510652));_0x20b369(_0x510652);})[_0xa7d3('0x23')](function(_0x32e03c){logger[_0xa7d3('0x15')](_0xa7d3('0x22'),_0x32e03c[_0xa7d3('0x17')],_0x3c2240);_0x26135b(_0x218769[_0xa7d3('0x15')](0x1f4,_0x32e03c['message']));});});};exports[_0xa7d3('0x24')]=function(_0x5a6653){var _0x22561f=this;return new Promise(function(_0x218838,_0x16d21b){return db[_0xa7d3('0x18')][_0xa7d3('0x25')]({'raw':_0x5a6653['options']?_0x5a6653['options'][_0xa7d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a6653[_0xa7d3('0x1a')]?_0x5a6653[_0xa7d3('0x1a')]['where']||null:null,'attributes':_0x5a6653['options']?_0x5a6653[_0xa7d3('0x1a')][_0xa7d3('0x1d')]||null:null,'include':_0x5a6653[_0xa7d3('0x1a')]?_0x5a6653[_0xa7d3('0x1a')][_0xa7d3('0x20')]?_['map'](_0x5a6653['options'][_0xa7d3('0x20')],function(_0x2d778b){return{'model':db[_0x2d778b[_0xa7d3('0x21')]],'as':_0x2d778b['as'],'attributes':_0x2d778b[_0xa7d3('0x1d')],'include':_0x2d778b[_0xa7d3('0x20')]?_[_0xa7d3('0x1f')](_0x2d778b[_0xa7d3('0x20')],function(_0x3d3df4){return{'model':db[_0x3d3df4['model']],'as':_0x3d3df4['as'],'attributes':_0x3d3df4[_0xa7d3('0x1d')],'include':_0x3d3df4[_0xa7d3('0x20')]?_[_0xa7d3('0x1f')](_0x3d3df4[_0xa7d3('0x20')],function(_0x316913){return{'model':db[_0x316913[_0xa7d3('0x21')]],'as':_0x316913['as'],'attributes':_0x316913[_0xa7d3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x442d56){logger['info'](_0xa7d3('0x24'),_0x5a6653);logger[_0xa7d3('0x12')](_0xa7d3('0x24'),_0x5a6653,JSON[_0xa7d3('0x14')](_0x442d56));_0x218838(_0x442d56);})['catch'](function(_0x16a0c0){logger[_0xa7d3('0x15')](_0xa7d3('0x24'),_0x16a0c0[_0xa7d3('0x17')],_0x5a6653);_0x16d21b(_0x22561f['error'](0x1f4,_0x16a0c0[_0xa7d3('0x17')]));});});}; \ No newline at end of file +var _0x0fb8=['request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','where','debug','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x1ac4be,_0x254fbb){var _0x4417ba=function(_0x291f87){while(--_0x291f87){_0x1ac4be['push'](_0x1ac4be['shift']());}};_0x4417ba(++_0x254fbb);}(_0x0fb8,0x190));var _0x80fb=function(_0x57426f,_0x52f0d3){_0x57426f=_0x57426f-0x0;var _0xe15733=_0x0fb8[_0x57426f];return _0xe15733;};'use strict';var _=require(_0x80fb('0x0'));var util=require(_0x80fb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x80fb('0x2'));var fs=require('fs');var Redis=require(_0x80fb('0x3'));var db=require(_0x80fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x80fb('0x5'));var config=require('../../config/environment');var jayson=require(_0x80fb('0x6'));var client=jayson[_0x80fb('0x7')][_0x80fb('0x8')]({'port':0x232a});config[_0x80fb('0x9')]=_[_0x80fb('0xa')](config[_0x80fb('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x80fb('0xb'))(new Redis(config[_0x80fb('0x9')]));require(_0x80fb('0xc'))[_0x80fb('0xd')](socket);function respondWithRpcPromise(_0x3b7b83,_0x1b6d1b,_0x2b7457){return new BPromise(function(_0x22abd2,_0x57f0a6){return client[_0x80fb('0xe')](_0x3b7b83,_0x2b7457)[_0x80fb('0xf')](function(_0x110c97){logger[_0x80fb('0x10')](_0x80fb('0x11'),_0x1b6d1b,_0x80fb('0x12'));logger['debug'](_0x80fb('0x13'),_0x1b6d1b,_0x80fb('0x12'),JSON[_0x80fb('0x14')](_0x110c97));if(_0x110c97[_0x80fb('0x15')]){if(_0x110c97['error']['code']===0x1f4){logger[_0x80fb('0x15')](_0x80fb('0x11'),_0x1b6d1b,_0x110c97[_0x80fb('0x15')][_0x80fb('0x16')]);return _0x57f0a6(_0x110c97['error'][_0x80fb('0x16')]);}logger['error'](_0x80fb('0x11'),_0x1b6d1b,_0x110c97[_0x80fb('0x15')]['message']);return _0x22abd2(_0x110c97[_0x80fb('0x15')][_0x80fb('0x16')]);}else{logger['info'](_0x80fb('0x11'),_0x1b6d1b,_0x80fb('0x12'));_0x22abd2(_0x110c97[_0x80fb('0x17')][_0x80fb('0x16')]);}})[_0x80fb('0x18')](function(_0x2e6c9e){logger[_0x80fb('0x15')](_0x80fb('0x11'),_0x1b6d1b,_0x2e6c9e);_0x57f0a6(_0x2e6c9e);});});}exports[_0x80fb('0x19')]=function(_0x42fab9){var _0x35a1bf=this;return new Promise(function(_0x48cdb9,_0x2df9bc){return db[_0x80fb('0x1a')][_0x80fb('0x1b')]({'raw':_0x42fab9['options']?_0x42fab9[_0x80fb('0x1c')][_0x80fb('0x1d')]===undefined?!![]:![]:!![],'where':_0x42fab9[_0x80fb('0x1c')]?_0x42fab9[_0x80fb('0x1c')]['where']||null:null,'attributes':_0x42fab9[_0x80fb('0x1c')]?_0x42fab9[_0x80fb('0x1c')][_0x80fb('0x1e')]||null:null,'limit':_0x42fab9[_0x80fb('0x1c')]?_0x42fab9[_0x80fb('0x1c')][_0x80fb('0x1f')]||null:null,'include':_0x42fab9[_0x80fb('0x1c')]?_0x42fab9[_0x80fb('0x1c')][_0x80fb('0x20')]?_[_0x80fb('0x21')](_0x42fab9[_0x80fb('0x1c')][_0x80fb('0x20')],function(_0x1697e6){return{'model':db[_0x1697e6[_0x80fb('0x22')]],'as':_0x1697e6['as'],'attributes':_0x1697e6[_0x80fb('0x1e')],'include':_0x1697e6[_0x80fb('0x20')]?_['map'](_0x1697e6['include'],function(_0x34dfe6){return{'model':db[_0x34dfe6[_0x80fb('0x22')]],'as':_0x34dfe6['as'],'attributes':_0x34dfe6[_0x80fb('0x1e')],'include':_0x34dfe6[_0x80fb('0x20')]?_['map'](_0x34dfe6[_0x80fb('0x20')],function(_0x3ec5a0){return{'model':db[_0x3ec5a0[_0x80fb('0x22')]],'as':_0x3ec5a0['as'],'attributes':_0x3ec5a0[_0x80fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x80fb('0xf')](function(_0x33ad84){logger[_0x80fb('0x10')](_0x80fb('0x19'),_0x42fab9);logger['debug']('GetOpenchannelQueue',_0x42fab9,JSON[_0x80fb('0x14')](_0x33ad84));_0x48cdb9(_0x33ad84);})[_0x80fb('0x18')](function(_0x21463e){logger[_0x80fb('0x15')]('GetOpenchannelQueue',_0x21463e[_0x80fb('0x16')],_0x42fab9);_0x2df9bc(_0x35a1bf[_0x80fb('0x15')](0x1f4,_0x21463e[_0x80fb('0x16')]));});});};exports[_0x80fb('0x23')]=function(_0x5cd4fe){var _0xb9d866=this;return new Promise(function(_0x492772,_0x249261){return db[_0x80fb('0x1a')]['find']({'raw':_0x5cd4fe['options']?_0x5cd4fe[_0x80fb('0x1c')][_0x80fb('0x1d')]===undefined?!![]:![]:!![],'where':_0x5cd4fe[_0x80fb('0x1c')]?_0x5cd4fe[_0x80fb('0x1c')][_0x80fb('0x24')]||null:null,'attributes':_0x5cd4fe[_0x80fb('0x1c')]?_0x5cd4fe[_0x80fb('0x1c')]['attributes']||null:null,'include':_0x5cd4fe[_0x80fb('0x1c')]?_0x5cd4fe[_0x80fb('0x1c')][_0x80fb('0x20')]?_[_0x80fb('0x21')](_0x5cd4fe['options'][_0x80fb('0x20')],function(_0x57ea7a){return{'model':db[_0x57ea7a[_0x80fb('0x22')]],'as':_0x57ea7a['as'],'attributes':_0x57ea7a[_0x80fb('0x1e')],'include':_0x57ea7a[_0x80fb('0x20')]?_['map'](_0x57ea7a[_0x80fb('0x20')],function(_0x299106){return{'model':db[_0x299106['model']],'as':_0x299106['as'],'attributes':_0x299106[_0x80fb('0x1e')],'include':_0x299106['include']?_[_0x80fb('0x21')](_0x299106[_0x80fb('0x20')],function(_0x4c44da){return{'model':db[_0x4c44da[_0x80fb('0x22')]],'as':_0x4c44da['as'],'attributes':_0x4c44da[_0x80fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x80fb('0xf')](function(_0x3fec08){logger[_0x80fb('0x10')]('ShowOpenchannelQueue',_0x5cd4fe);logger[_0x80fb('0x25')](_0x80fb('0x23'),_0x5cd4fe,JSON['stringify'](_0x3fec08));_0x492772(_0x3fec08);})[_0x80fb('0x18')](function(_0x5c4269){logger['error']('ShowOpenchannelQueue',_0x5c4269[_0x80fb('0x16')],_0x5cd4fe);_0x249261(_0xb9d866[_0x80fb('0x15')](0x1f4,_0x5c4269[_0x80fb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b1f3b7d..4020335 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 _0x75d1=['remove','update','removeListener','register','length','openchannelQueue:','save'];(function(_0x23f3c7,_0x1a5b16){var _0xf28d3a=function(_0x2add67){while(--_0x2add67){_0x23f3c7['push'](_0x23f3c7['shift']());}};_0xf28d3a(++_0x1a5b16);}(_0x75d1,0xed));var _0x175d=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x75d1[_0x209941];return _0x1e8729;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x175d('0x0'),_0x175d('0x1'),_0x175d('0x2')];function createListener(_0xc6738e,_0xc4a417){return function(_0x58cfad){_0xc4a417['emit'](_0xc6738e,_0x58cfad);};}function removeListener(_0xf0d7f4,_0x5b6828){return function(){OpenchannelQueueEvents[_0x175d('0x3')](_0xf0d7f4,_0x5b6828);};}exports[_0x175d('0x4')]=function(_0x1b260c){for(var _0x51d9c3=0x0,_0x395e8c=events[_0x175d('0x5')];_0x51d9c3<_0x395e8c;_0x51d9c3++){var _0x2d3b7f=events[_0x51d9c3];var _0x1668d3=createListener(_0x175d('0x6')+_0x2d3b7f,_0x1b260c);OpenchannelQueueEvents['on'](_0x2d3b7f,_0x1668d3);}}; \ No newline at end of file +var _0x205d=['openchannelQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x1a2006,_0x28593c){var _0x83d34f=function(_0x1eadf8){while(--_0x1eadf8){_0x1a2006['push'](_0x1a2006['shift']());}};_0x83d34f(++_0x28593c);}(_0x205d,0x1f1));var _0xd205=function(_0x1fbde3,_0x59da39){_0x1fbde3=_0x1fbde3-0x0;var _0x2b092f=_0x205d[_0x1fbde3];return _0x2b092f;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xd205('0x0'),_0xd205('0x1'),_0xd205('0x2')];function createListener(_0x5bfe5b,_0x39b080){return function(_0x38b674){_0x39b080[_0xd205('0x3')](_0x5bfe5b,_0x38b674);};}function removeListener(_0x305da1,_0x25e4dd){return function(){OpenchannelQueueEvents[_0xd205('0x4')](_0x305da1,_0x25e4dd);};}exports[_0xd205('0x5')]=function(_0x3c5535){for(var _0x1387d1=0x0,_0x37dd0e=events[_0xd205('0x6')];_0x1387d1<_0x37dd0e;_0x1387d1++){var _0x2e84ff=events[_0x1387d1];var _0x31f437=createListener(_0xd205('0x7')+_0x2e84ff,_0x3c5535);OpenchannelQueueEvents['on'](_0x2e84ff,_0x31f437);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 83c8f1d..098bea8 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 _0x5688=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x5688,0x7c));var _0x8568=function(_0x3d46cf,_0x1d39e9){_0x3d46cf=_0x3d46cf-0x0;var _0x1e048e=_0x5688[_0x3d46cf];return _0x1e048e;};'use strict';var multer=require(_0x8568('0x0'));var util=require(_0x8568('0x1'));var path=require(_0x8568('0x2'));var timeout=require('connect-timeout');var express=require(_0x8568('0x3'));var router=express[_0x8568('0x4')]();var fs_extra=require(_0x8568('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8568('0x6'));var config=require(_0x8568('0x7'));var controller=require(_0x8568('0x8'));router[_0x8568('0x9')]('/',auth[_0x8568('0xa')](),controller['index']);router['get'](_0x8568('0xb'),auth[_0x8568('0xa')](),controller[_0x8568('0xc')]);router[_0x8568('0x9')](_0x8568('0xd'),auth[_0x8568('0xa')](),controller[_0x8568('0xe')]);router[_0x8568('0xf')]('/',auth['isAuthenticated'](),controller[_0x8568('0x10')]);router[_0x8568('0x11')](_0x8568('0xd'),auth[_0x8568('0xa')](),controller[_0x8568('0x12')]);router[_0x8568('0x13')](_0x8568('0xd'),auth[_0x8568('0xa')](),controller[_0x8568('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7be9=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','put','update','delete'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x7be9,0x86));var _0x97be=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7be9[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require(_0x97be('0x0'));var util=require(_0x97be('0x1'));var path=require('path');var timeout=require(_0x97be('0x2'));var express=require(_0x97be('0x3'));var router=express[_0x97be('0x4')]();var fs_extra=require(_0x97be('0x5'));var auth=require(_0x97be('0x6'));var interaction=require(_0x97be('0x7'));var config=require(_0x97be('0x8'));var controller=require(_0x97be('0x9'));router[_0x97be('0xa')]('/',auth[_0x97be('0xb')](),controller['index']);router[_0x97be('0xa')](_0x97be('0xc'),auth[_0x97be('0xb')](),controller[_0x97be('0xd')]);router[_0x97be('0xa')](_0x97be('0xe'),auth[_0x97be('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x97be('0xf')](_0x97be('0xe'),auth['isAuthenticated'](),controller[_0x97be('0x10')]);router[_0x97be('0x11')](_0x97be('0xe'),auth[_0x97be('0xb')](),controller[_0x97be('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c7158cd..e36840f 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 _0x5a8f=['DATE','moment','sequelize','exports','STRING'];(function(_0x263152,_0x3de44c){var _0x5dc909=function(_0x329d2f){while(--_0x329d2f){_0x263152['push'](_0x263152['shift']());}};_0x5dc909(++_0x3de44c);}(_0x5a8f,0x1be));var _0xf5a8=function(_0x5b4f92,_0x1c16ef){_0x5b4f92=_0x5b4f92-0x0;var _0x57a3a7=_0x5a8f[_0x5b4f92];return _0x57a3a7;};'use strict';var moment=require(_0xf5a8('0x0'));var Sequelize=require(_0xf5a8('0x1'));module[_0xf5a8('0x2')]={'uniqueid':{'type':Sequelize[_0xf5a8('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf5a8('0x4')]},'leaveAt':{'type':Sequelize[_0xf5a8('0x4')]},'acceptAt':{'type':Sequelize[_0xf5a8('0x4')]},'exitAt':{'type':Sequelize[_0xf5a8('0x4')]},'reason':{'type':Sequelize[_0xf5a8('0x3')]}}; \ No newline at end of file +var _0x7989=['sequelize','exports','STRING','DATE','moment'];(function(_0x249963,_0xe59db5){var _0x5c169c=function(_0x18cc5c){while(--_0x18cc5c){_0x249963['push'](_0x249963['shift']());}};_0x5c169c(++_0xe59db5);}(_0x7989,0x135));var _0x9798=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x7989[_0x7c0074];return _0x13e95b;};'use strict';var moment=require(_0x9798('0x0'));var Sequelize=require(_0x9798('0x1'));module[_0x9798('0x2')]={'uniqueid':{'type':Sequelize[_0x9798('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9798('0x3')]},'joinAt':{'type':Sequelize[_0x9798('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9798('0x4')]},'exitAt':{'type':Sequelize[_0x9798('0x4')]},'reason':{'type':Sequelize[_0x9798('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3621201..67a1d79 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 _0x9c2b=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','options','OpenchannelQueueReport','includeAll','findAll','catch','show','params','keys','include','merge','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3f597e,_0x17877d){var _0x5bc18f=function(_0x1c59a9){while(--_0x1c59a9){_0x3f597e['push'](_0x3f597e['shift']());}};_0x5bc18f(++_0x17877d);}(_0x9c2b,0x132));var _0xb9c2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9c2b[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0xb9c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9c2('0x1'));var jsonpatch=require(_0xb9c2('0x2'));var rp=require(_0xb9c2('0x3'));var moment=require('moment');var BPromise=require(_0xb9c2('0x4'));var Mustache=require('mustache');var util=require(_0xb9c2('0x5'));var path=require(_0xb9c2('0x6'));var sox=require(_0xb9c2('0x7'));var csv=require(_0xb9c2('0x8'));var ejs=require(_0xb9c2('0x9'));var fs=require('fs');var fs_extra=require(_0xb9c2('0xa'));var _=require(_0xb9c2('0xb'));var squel=require(_0xb9c2('0xc'));var crypto=require(_0xb9c2('0xd'));var jsforce=require(_0xb9c2('0xe'));var deskjs=require(_0xb9c2('0xf'));var toCsv=require(_0xb9c2('0x8'));var querystring=require(_0xb9c2('0x10'));var Papa=require(_0xb9c2('0x11'));var Redis=require(_0xb9c2('0x12'));var authService=require(_0xb9c2('0x13'));var qs=require(_0xb9c2('0x14'));var as=require(_0xb9c2('0x15'));var hardwareService=require(_0xb9c2('0x16'));var logger=require(_0xb9c2('0x17'))(_0xb9c2('0x18'));var utils=require(_0xb9c2('0x19'));var config=require(_0xb9c2('0x1a'));var licenseUtil=require(_0xb9c2('0x1b'));var db=require(_0xb9c2('0x1c'))['db'];function respondWithStatusCode(_0x1148ed,_0x4947ec){_0x4947ec=_0x4947ec||0xcc;return function(_0x4e0228){if(_0x4e0228){return _0x1148ed[_0xb9c2('0x1d')](_0x4947ec);}return _0x1148ed[_0xb9c2('0x1e')](_0x4947ec)[_0xb9c2('0x1f')]();};}function respondWithResult(_0x5b3f20,_0x3590f5){_0x3590f5=_0x3590f5||0xc8;return function(_0x16c899){if(_0x16c899){return _0x5b3f20['status'](_0x3590f5)[_0xb9c2('0x20')](_0x16c899);}};}function respondWithFilteredResult(_0x233631,_0x14bf6c){return function(_0x3ab232){if(_0x3ab232){var _0x2d99af=typeof _0x14bf6c[_0xb9c2('0x21')]===_0xb9c2('0x22')&&typeof _0x14bf6c[_0xb9c2('0x23')]===_0xb9c2('0x22');var _0x4feac5=_0x3ab232[_0xb9c2('0x24')];var _0x1ad0bf=_0x2d99af?0x0:_0x14bf6c[_0xb9c2('0x21')];var _0x5ed1c6=_0x2d99af?_0x3ab232[_0xb9c2('0x24')]:_0x14bf6c[_0xb9c2('0x21')]+_0x14bf6c[_0xb9c2('0x23')];var _0x254ee4;if(_0x5ed1c6>=_0x4feac5){_0x5ed1c6=_0x4feac5;_0x254ee4=0xc8;}else{_0x254ee4=0xce;}_0x233631[_0xb9c2('0x1e')](_0x254ee4);return _0x233631[_0xb9c2('0x25')]('Content-Range',_0x1ad0bf+'-'+_0x5ed1c6+'/'+_0x4feac5)[_0xb9c2('0x20')](_0x3ab232);}return null;};}function patchUpdates(_0x389f8a){return function(_0x146f95){try{jsonpatch['apply'](_0x146f95,_0x389f8a,!![]);}catch(_0x5c0c7d){return BPromise[_0xb9c2('0x26')](_0x5c0c7d);}return _0x146f95[_0xb9c2('0x27')]();};}function saveUpdates(_0x36a1a3,_0xd6e588){return function(_0x3d8a1e){if(_0x3d8a1e){return _0x3d8a1e[_0xb9c2('0x28')](_0x36a1a3)[_0xb9c2('0x29')](function(_0x444d43){return _0x444d43;});}return null;};}function removeEntity(_0x582803,_0x17a2ef){return function(_0x143cc1){if(_0x143cc1){return _0x143cc1[_0xb9c2('0x2a')]()['then'](function(){_0x582803['status'](0xcc)[_0xb9c2('0x1f')]();});}};}function handleEntityNotFound(_0x5c3c61,_0x2fa03c){return function(_0x1afe78){if(!_0x1afe78){_0x5c3c61[_0xb9c2('0x1d')](0x194);}return _0x1afe78;};}function handleError(_0x580ee1,_0x1ea4bf){_0x1ea4bf=_0x1ea4bf||0x1f4;return function(_0x4aee62){logger[_0xb9c2('0x2b')](_0x4aee62[_0xb9c2('0x2c')]);if(_0x4aee62[_0xb9c2('0x2d')]){delete _0x4aee62[_0xb9c2('0x2d')];}_0x580ee1[_0xb9c2('0x1e')](_0x1ea4bf)[_0xb9c2('0x2e')](_0x4aee62);};}exports[_0xb9c2('0x2f')]=function(_0x5d0e7c,_0x15a4c1){var _0x8234d5={},_0x395ad1={},_0x4a3802={'count':0x0,'rows':[]};var _0x471747=_[_0xb9c2('0x30')](db['OpenchannelQueueReport'][_0xb9c2('0x31')],function(_0x13064c){return{'name':_0x13064c[_0xb9c2('0x32')],'type':_0x13064c[_0xb9c2('0x33')][_0xb9c2('0x34')]};});_0x395ad1[_0xb9c2('0x35')]=_[_0xb9c2('0x30')](_0x471747,_0xb9c2('0x2d'));_0x395ad1[_0xb9c2('0x36')]=_['keys'](_0x5d0e7c[_0xb9c2('0x36')]);_0x395ad1[_0xb9c2('0x37')]=_[_0xb9c2('0x38')](_0x395ad1['model'],_0x395ad1[_0xb9c2('0x36')]);_0x8234d5[_0xb9c2('0x39')]=_[_0xb9c2('0x38')](_0x395ad1[_0xb9c2('0x35')],qs[_0xb9c2('0x3a')](_0x5d0e7c[_0xb9c2('0x36')][_0xb9c2('0x3a')]));_0x8234d5['attributes']=_0x8234d5[_0xb9c2('0x39')][_0xb9c2('0x3b')]?_0x8234d5[_0xb9c2('0x39')]:_0x395ad1['model'];if(!_0x5d0e7c[_0xb9c2('0x36')]['hasOwnProperty'](_0xb9c2('0x3c'))){_0x8234d5['limit']=qs[_0xb9c2('0x23')](_0x5d0e7c[_0xb9c2('0x36')]['limit']);_0x8234d5[_0xb9c2('0x21')]=qs['offset'](_0x5d0e7c[_0xb9c2('0x36')][_0xb9c2('0x21')]);}_0x8234d5[_0xb9c2('0x3d')]=qs[_0xb9c2('0x3e')](_0x5d0e7c[_0xb9c2('0x36')][_0xb9c2('0x3e')]);_0x8234d5[_0xb9c2('0x3f')]=qs['filters'](_[_0xb9c2('0x40')](_0x5d0e7c[_0xb9c2('0x36')],_0x395ad1[_0xb9c2('0x37')]),_0x471747);if(_0x5d0e7c[_0xb9c2('0x36')][_0xb9c2('0x41')]){_0x8234d5[_0xb9c2('0x3f')]=_['merge'](_0x8234d5['where'],{'$or':_[_0xb9c2('0x30')](_0x471747,function(_0x556eb1){if(_0x556eb1[_0xb9c2('0x33')]!=='VIRTUAL'){var _0x4869ff={};_0x4869ff[_0x556eb1[_0xb9c2('0x2d')]]={'$like':'%'+_0x5d0e7c[_0xb9c2('0x36')][_0xb9c2('0x41')]+'%'};return _0x4869ff;}})});}_0x8234d5=_['merge']({},_0x8234d5,_0x5d0e7c[_0xb9c2('0x42')]);var _0x1dbf05={'where':_0x8234d5[_0xb9c2('0x3f')]};return db[_0xb9c2('0x43')][_0xb9c2('0x24')](_0x1dbf05)['then'](function(_0x3fcad5){_0x4a3802['count']=_0x3fcad5;if(_0x5d0e7c[_0xb9c2('0x36')][_0xb9c2('0x44')]){_0x8234d5['include']=[{'all':!![]}];}return db[_0xb9c2('0x43')][_0xb9c2('0x45')](_0x8234d5);})[_0xb9c2('0x29')](function(_0x435022){_0x4a3802['rows']=_0x435022;return _0x4a3802;})[_0xb9c2('0x29')](respondWithFilteredResult(_0x15a4c1,_0x8234d5))[_0xb9c2('0x46')](handleError(_0x15a4c1,null));};exports[_0xb9c2('0x47')]=function(_0x16803f,_0x189b6a){var _0x102964={'raw':!![],'where':{'id':_0x16803f[_0xb9c2('0x48')]['id']}},_0x3221e3={};_0x3221e3[_0xb9c2('0x35')]=_[_0xb9c2('0x49')](db[_0xb9c2('0x43')][_0xb9c2('0x31')]);_0x3221e3[_0xb9c2('0x36')]=_['keys'](_0x16803f[_0xb9c2('0x36')]);_0x3221e3['filters']=_[_0xb9c2('0x38')](_0x3221e3[_0xb9c2('0x35')],_0x3221e3[_0xb9c2('0x36')]);_0x102964[_0xb9c2('0x39')]=_[_0xb9c2('0x38')](_0x3221e3[_0xb9c2('0x35')],qs[_0xb9c2('0x3a')](_0x16803f['query'][_0xb9c2('0x3a')]));_0x102964[_0xb9c2('0x39')]=_0x102964[_0xb9c2('0x39')][_0xb9c2('0x3b')]?_0x102964[_0xb9c2('0x39')]:_0x3221e3[_0xb9c2('0x35')];if(_0x16803f[_0xb9c2('0x36')][_0xb9c2('0x44')]){_0x102964[_0xb9c2('0x4a')]=[{'all':!![]}];}_0x102964=_[_0xb9c2('0x4b')]({},_0x102964,_0x16803f[_0xb9c2('0x42')]);return db[_0xb9c2('0x43')][_0xb9c2('0x4c')](_0x102964)[_0xb9c2('0x29')](handleEntityNotFound(_0x189b6a,null))['then'](respondWithResult(_0x189b6a,null))[_0xb9c2('0x46')](handleError(_0x189b6a,null));};exports[_0xb9c2('0x4d')]=function(_0x1ce9f4,_0x309a5e){return db[_0xb9c2('0x43')][_0xb9c2('0x4d')](_0x1ce9f4['body'],{})['then'](respondWithResult(_0x309a5e,0xc9))[_0xb9c2('0x46')](handleError(_0x309a5e,null));};exports[_0xb9c2('0x28')]=function(_0x1934f4,_0x28df74){if(_0x1934f4[_0xb9c2('0x4e')]['id']){delete _0x1934f4['body']['id'];}return db[_0xb9c2('0x43')]['find']({'where':{'id':_0x1934f4['params']['id']}})[_0xb9c2('0x29')](handleEntityNotFound(_0x28df74,null))[_0xb9c2('0x29')](saveUpdates(_0x1934f4[_0xb9c2('0x4e')],null))[_0xb9c2('0x29')](respondWithResult(_0x28df74,null))['catch'](handleError(_0x28df74,null));};exports[_0xb9c2('0x2a')]=function(_0x321d7f,_0x5dae4c){return db[_0xb9c2('0x43')][_0xb9c2('0x4c')]({'where':{'id':_0x321d7f[_0xb9c2('0x48')]['id']}})[_0xb9c2('0x29')](handleEntityNotFound(_0x5dae4c,null))[_0xb9c2('0x29')](removeEntity(_0x5dae4c,null))[_0xb9c2('0x46')](handleError(_0x5dae4c,null));};exports[_0xb9c2('0x4f')]=function(_0x3d6521,_0x364bfc){return db[_0xb9c2('0x43')][_0xb9c2('0x4f')]()[_0xb9c2('0x29')](respondWithResult(_0x364bfc,null))[_0xb9c2('0x46')](handleError(_0x364bfc,null));}; \ No newline at end of file +var _0xb6a5=['merge','options','then','count','includeAll','include','rows','catch','show','params','model','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','offset','limit','undefined','set','json','apply','save','update','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','type','key','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','VIRTUAL','filter'];(function(_0x4513fb,_0x400f2b){var _0x18a8c9=function(_0xce95ac){while(--_0xce95ac){_0x4513fb['push'](_0x4513fb['shift']());}};_0x18a8c9(++_0x400f2b);}(_0xb6a5,0xab));var _0x5b6a=function(_0x3ce1fd,_0x5add51){_0x3ce1fd=_0x3ce1fd-0x0;var _0x35c34b=_0xb6a5[_0x3ce1fd];return _0x35c34b;};'use strict';var emlformat=require(_0x5b6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b6a('0x1'));var jsonpatch=require(_0x5b6a('0x2'));var rp=require(_0x5b6a('0x3'));var moment=require(_0x5b6a('0x4'));var BPromise=require(_0x5b6a('0x5'));var Mustache=require(_0x5b6a('0x6'));var util=require(_0x5b6a('0x7'));var path=require(_0x5b6a('0x8'));var sox=require(_0x5b6a('0x9'));var csv=require(_0x5b6a('0xa'));var ejs=require(_0x5b6a('0xb'));var fs=require('fs');var fs_extra=require(_0x5b6a('0xc'));var _=require(_0x5b6a('0xd'));var squel=require(_0x5b6a('0xe'));var crypto=require(_0x5b6a('0xf'));var jsforce=require(_0x5b6a('0x10'));var deskjs=require(_0x5b6a('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5b6a('0x12'));var Redis=require(_0x5b6a('0x13'));var authService=require(_0x5b6a('0x14'));var qs=require(_0x5b6a('0x15'));var as=require(_0x5b6a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b6a('0x17'))(_0x5b6a('0x18'));var utils=require(_0x5b6a('0x19'));var config=require(_0x5b6a('0x1a'));var licenseUtil=require(_0x5b6a('0x1b'));var db=require(_0x5b6a('0x1c'))['db'];function respondWithStatusCode(_0x1a943a,_0x5cf32f){_0x5cf32f=_0x5cf32f||0xcc;return function(_0x874a8b){if(_0x874a8b){return _0x1a943a['sendStatus'](_0x5cf32f);}return _0x1a943a[_0x5b6a('0x1d')](_0x5cf32f)[_0x5b6a('0x1e')]();};}function respondWithResult(_0x2089a6,_0x392448){_0x392448=_0x392448||0xc8;return function(_0x1de151){if(_0x1de151){return _0x2089a6[_0x5b6a('0x1d')](_0x392448)['json'](_0x1de151);}};}function respondWithFilteredResult(_0xf0aaa7,_0x1d5a59){return function(_0x1d21f0){if(_0x1d21f0){var _0x202d00=typeof _0x1d5a59[_0x5b6a('0x1f')]==='undefined'&&typeof _0x1d5a59[_0x5b6a('0x20')]===_0x5b6a('0x21');var _0x3fefa8=_0x1d21f0['count'];var _0x4aec60=_0x202d00?0x0:_0x1d5a59[_0x5b6a('0x1f')];var _0x2fbdc7=_0x202d00?_0x1d21f0['count']:_0x1d5a59['offset']+_0x1d5a59[_0x5b6a('0x20')];var _0x303e45;if(_0x2fbdc7>=_0x3fefa8){_0x2fbdc7=_0x3fefa8;_0x303e45=0xc8;}else{_0x303e45=0xce;}_0xf0aaa7[_0x5b6a('0x1d')](_0x303e45);return _0xf0aaa7[_0x5b6a('0x22')]('Content-Range',_0x4aec60+'-'+_0x2fbdc7+'/'+_0x3fefa8)[_0x5b6a('0x23')](_0x1d21f0);}return null;};}function patchUpdates(_0x4b41e2){return function(_0x5ead49){try{jsonpatch[_0x5b6a('0x24')](_0x5ead49,_0x4b41e2,!![]);}catch(_0xd70ecd){return BPromise['reject'](_0xd70ecd);}return _0x5ead49[_0x5b6a('0x25')]();};}function saveUpdates(_0x1a34ec,_0x3e3577){return function(_0x3fa524){if(_0x3fa524){return _0x3fa524[_0x5b6a('0x26')](_0x1a34ec)['then'](function(_0x5a5d19){return _0x5a5d19;});}return null;};}function removeEntity(_0x244913,_0x4c15c4){return function(_0x2e0942){if(_0x2e0942){return _0x2e0942[_0x5b6a('0x27')]()['then'](function(){_0x244913['status'](0xcc)[_0x5b6a('0x1e')]();});}};}function handleEntityNotFound(_0x10b728,_0x20094d){return function(_0x57b475){if(!_0x57b475){_0x10b728[_0x5b6a('0x28')](0x194);}return _0x57b475;};}function handleError(_0x315b87,_0x11de0b){_0x11de0b=_0x11de0b||0x1f4;return function(_0x3079a2){logger[_0x5b6a('0x29')](_0x3079a2[_0x5b6a('0x2a')]);if(_0x3079a2[_0x5b6a('0x2b')]){delete _0x3079a2['name'];}_0x315b87[_0x5b6a('0x1d')](_0x11de0b)[_0x5b6a('0x2c')](_0x3079a2);};}exports[_0x5b6a('0x2d')]=function(_0xae1a1,_0x4ade94){var _0x546f3a={},_0x47f5c7={},_0x3537f5={'count':0x0,'rows':[]};var _0x541496=_[_0x5b6a('0x2e')](db[_0x5b6a('0x2f')]['rawAttributes'],function(_0x459027){return{'name':_0x459027['fieldName'],'type':_0x459027[_0x5b6a('0x30')][_0x5b6a('0x31')]};});_0x47f5c7['model']=_[_0x5b6a('0x2e')](_0x541496,'name');_0x47f5c7[_0x5b6a('0x32')]=_[_0x5b6a('0x33')](_0xae1a1['query']);_0x47f5c7[_0x5b6a('0x34')]=_['intersection'](_0x47f5c7['model'],_0x47f5c7[_0x5b6a('0x32')]);_0x546f3a['attributes']=_[_0x5b6a('0x35')](_0x47f5c7['model'],qs[_0x5b6a('0x36')](_0xae1a1[_0x5b6a('0x32')][_0x5b6a('0x36')]));_0x546f3a[_0x5b6a('0x37')]=_0x546f3a[_0x5b6a('0x37')][_0x5b6a('0x38')]?_0x546f3a[_0x5b6a('0x37')]:_0x47f5c7['model'];if(!_0xae1a1[_0x5b6a('0x32')]['hasOwnProperty']('nolimit')){_0x546f3a[_0x5b6a('0x20')]=qs[_0x5b6a('0x20')](_0xae1a1[_0x5b6a('0x32')][_0x5b6a('0x20')]);_0x546f3a[_0x5b6a('0x1f')]=qs['offset'](_0xae1a1[_0x5b6a('0x32')][_0x5b6a('0x1f')]);}_0x546f3a[_0x5b6a('0x39')]=qs['sort'](_0xae1a1[_0x5b6a('0x32')][_0x5b6a('0x3a')]);_0x546f3a[_0x5b6a('0x3b')]=qs[_0x5b6a('0x34')](_[_0x5b6a('0x3c')](_0xae1a1['query'],_0x47f5c7[_0x5b6a('0x34')]),_0x541496);if(_0xae1a1['query']['filter']){_0x546f3a[_0x5b6a('0x3b')]=_['merge'](_0x546f3a[_0x5b6a('0x3b')],{'$or':_['map'](_0x541496,function(_0x2102a){if(_0x2102a[_0x5b6a('0x30')]!==_0x5b6a('0x3d')){var _0x3a4940={};_0x3a4940[_0x2102a[_0x5b6a('0x2b')]]={'$like':'%'+_0xae1a1[_0x5b6a('0x32')][_0x5b6a('0x3e')]+'%'};return _0x3a4940;}})});}_0x546f3a=_[_0x5b6a('0x3f')]({},_0x546f3a,_0xae1a1[_0x5b6a('0x40')]);var _0x253f3a={'where':_0x546f3a['where']};return db[_0x5b6a('0x2f')]['count'](_0x253f3a)[_0x5b6a('0x41')](function(_0xa503ec){_0x3537f5[_0x5b6a('0x42')]=_0xa503ec;if(_0xae1a1['query'][_0x5b6a('0x43')]){_0x546f3a[_0x5b6a('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x546f3a);})[_0x5b6a('0x41')](function(_0x1a4b55){_0x3537f5[_0x5b6a('0x45')]=_0x1a4b55;return _0x3537f5;})[_0x5b6a('0x41')](respondWithFilteredResult(_0x4ade94,_0x546f3a))[_0x5b6a('0x46')](handleError(_0x4ade94,null));};exports[_0x5b6a('0x47')]=function(_0x508cc6,_0x22d2e0){var _0x5ec2e5={'raw':!![],'where':{'id':_0x508cc6[_0x5b6a('0x48')]['id']}},_0x317153={};_0x317153[_0x5b6a('0x49')]=_[_0x5b6a('0x33')](db['OpenchannelQueueReport']['rawAttributes']);_0x317153[_0x5b6a('0x32')]=_[_0x5b6a('0x33')](_0x508cc6[_0x5b6a('0x32')]);_0x317153['filters']=_[_0x5b6a('0x35')](_0x317153[_0x5b6a('0x49')],_0x317153['query']);_0x5ec2e5['attributes']=_[_0x5b6a('0x35')](_0x317153[_0x5b6a('0x49')],qs['fields'](_0x508cc6[_0x5b6a('0x32')][_0x5b6a('0x36')]));_0x5ec2e5['attributes']=_0x5ec2e5['attributes'][_0x5b6a('0x38')]?_0x5ec2e5[_0x5b6a('0x37')]:_0x317153[_0x5b6a('0x49')];if(_0x508cc6['query'][_0x5b6a('0x43')]){_0x5ec2e5[_0x5b6a('0x44')]=[{'all':!![]}];}_0x5ec2e5=_[_0x5b6a('0x3f')]({},_0x5ec2e5,_0x508cc6['options']);return db[_0x5b6a('0x2f')][_0x5b6a('0x4a')](_0x5ec2e5)['then'](handleEntityNotFound(_0x22d2e0,null))[_0x5b6a('0x41')](respondWithResult(_0x22d2e0,null))[_0x5b6a('0x46')](handleError(_0x22d2e0,null));};exports[_0x5b6a('0x4b')]=function(_0x4cd391,_0x2fa781){return db[_0x5b6a('0x2f')][_0x5b6a('0x4b')](_0x4cd391[_0x5b6a('0x4c')],{})[_0x5b6a('0x41')](respondWithResult(_0x2fa781,0xc9))[_0x5b6a('0x46')](handleError(_0x2fa781,null));};exports[_0x5b6a('0x26')]=function(_0xe59402,_0x59fc3f){if(_0xe59402[_0x5b6a('0x4c')]['id']){delete _0xe59402[_0x5b6a('0x4c')]['id'];}return db[_0x5b6a('0x2f')][_0x5b6a('0x4a')]({'where':{'id':_0xe59402['params']['id']}})[_0x5b6a('0x41')](handleEntityNotFound(_0x59fc3f,null))[_0x5b6a('0x41')](saveUpdates(_0xe59402[_0x5b6a('0x4c')],null))[_0x5b6a('0x41')](respondWithResult(_0x59fc3f,null))[_0x5b6a('0x46')](handleError(_0x59fc3f,null));};exports[_0x5b6a('0x27')]=function(_0x27ebe1,_0x49566e){return db[_0x5b6a('0x2f')][_0x5b6a('0x4a')]({'where':{'id':_0x27ebe1[_0x5b6a('0x48')]['id']}})[_0x5b6a('0x41')](handleEntityNotFound(_0x49566e,null))['then'](removeEntity(_0x49566e,null))['catch'](handleError(_0x49566e,null));};exports[_0x5b6a('0x4d')]=function(_0x258274,_0x34f3de){return db[_0x5b6a('0x2f')][_0x5b6a('0x4d')]()[_0x5b6a('0x41')](respondWithResult(_0x34f3de,null))[_0x5b6a('0x46')](handleError(_0x34f3de,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 71f9ffd..f5ee047 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x571b9c,_0x31fa45){var _0x56a62c=function(_0x400db4){while(--_0x400db4){_0x571b9c['push'](_0x571b9c['shift']());}};_0x56a62c(++_0x31fa45);}(_0x5fc3,0xa8));var _0x35fc=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x5fc3[_0x240261];return _0x45c332;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x31672c,_0x3b2b79){var _0x459dc4=function(_0x1c44e0){while(--_0x1c44e0){_0x31672c['push'](_0x31672c['shift']());}};_0x459dc4(++_0x3b2b79);}(_0x1261,0x144));var _0x1126=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x1261[_0x46428c];return _0x16a677;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 414ab04..fefa2c5 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 _0xb10b=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','debug','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ced9d,_0x18daa5){_0x3ced9d=_0x3ced9d-0x0;var _0xa06cbb=_0xb10b[_0x3ced9d];return _0xa06cbb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateOpenchannelQueueReport',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});};exports[_0xbb10('0x1b')]=function(_0x436104){var _0x7f2377=this;return new Promise(function(_0x395404,_0x3ba6cd){return db[_0xbb10('0x16')]['update'](_0x436104['body'],{'raw':_0x436104['options']?_0x436104[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x436104[_0xbb10('0x18')]?_0x436104['options'][_0xbb10('0x1c')]||null:null,'attributes':_0x436104[_0xbb10('0x18')]?_0x436104[_0xbb10('0x18')][_0xbb10('0x1d')]||null:null,'limit':_0x436104[_0xbb10('0x18')]?_0x436104[_0xbb10('0x18')][_0xbb10('0x1e')]||null:null})['then'](function(_0x3796c7){logger[_0xbb10('0xd')](_0xbb10('0x1b'),_0x436104);logger[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x436104,JSON[_0xbb10('0x11')](_0x3796c7));_0x395404(_0x3796c7);})['catch'](function(_0x221624){logger['error'](_0xbb10('0x1b'),_0x221624['message'],_0x436104);_0x3ba6cd(_0x7f2377[_0xbb10('0x12')](0x1f4,_0x221624[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7d25=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x3aac8d,_0x34d74c){var _0x1add83=function(_0xb9bfb3){while(--_0xb9bfb3){_0x3aac8d['push'](_0x3aac8d['shift']());}};_0x1add83(++_0x34d74c);}(_0x7d25,0x8a));var _0x57d2=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x7d25[_0xfa634c];return _0x73e478;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')](_0x7d4cf1[_0x57d2('0x17')],{'raw':_0x7d4cf1[_0x57d2('0x18')]?_0x7d4cf1['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![]})[_0x57d2('0x1a')](function(_0x55191e){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x55191e));_0x4a94e3(_0x55191e);})[_0x57d2('0x13')](function(_0x803c25){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x803c25[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x803c25[_0x57d2('0x11')]));});});};exports[_0x57d2('0x1b')]=function(_0x12ff19){var _0x473df2=this;return new Promise(function(_0x5327ea,_0x424ddc){return db[_0x57d2('0x15')][_0x57d2('0x1c')](_0x12ff19[_0x57d2('0x17')],{'raw':_0x12ff19[_0x57d2('0x18')]?_0x12ff19['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1d')]||null:null,'attributes':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1e')]||null:null,'limit':_0x12ff19['options']?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1f')]||null:null})[_0x57d2('0x1a')](function(_0x1fe383){logger[_0x57d2('0x9')](_0x57d2('0x1b'),_0x12ff19);logger[_0x57d2('0xb')](_0x57d2('0x1b'),_0x12ff19,JSON[_0x57d2('0xe')](_0x1fe383));_0x5327ea(_0x1fe383);})[_0x57d2('0x13')](function(_0x574589){logger[_0x57d2('0xf')](_0x57d2('0x1b'),_0x574589[_0x57d2('0x11')],_0x12ff19);_0x424ddc(_0x473df2[_0x57d2('0xf')](0x1f4,_0x574589['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 3a8a3ca..c8c1154 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 _0xf912=['isAuthenticated','show','create','put','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index','/describe','describe'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf912,0x78));var _0x2f91=function(_0x3f93cb,_0x1121c1){_0x3f93cb=_0x3f93cb-0x0;var _0x3c205e=_0xf912[_0x3f93cb];return _0x3c205e;};'use strict';var multer=require(_0x2f91('0x0'));var util=require('util');var path=require(_0x2f91('0x1'));var timeout=require(_0x2f91('0x2'));var express=require(_0x2f91('0x3'));var router=express[_0x2f91('0x4')]();var fs_extra=require(_0x2f91('0x5'));var auth=require(_0x2f91('0x6'));var interaction=require(_0x2f91('0x7'));var config=require('../../config/environment');var controller=require(_0x2f91('0x8'));router[_0x2f91('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f91('0xa')]);router[_0x2f91('0x9')](_0x2f91('0xb'),auth['isAuthenticated'](),controller[_0x2f91('0xc')]);router[_0x2f91('0x9')]('/:id',auth[_0x2f91('0xd')](),controller[_0x2f91('0xe')]);router['post']('/',auth[_0x2f91('0xd')](),controller[_0x2f91('0xf')]);router[_0x2f91('0x10')](_0x2f91('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2f91('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x2f91('0x12')]=router; \ No newline at end of file +var _0x832a=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x832a,0x1a4));var _0xa832=function(_0x4252bf,_0xc977d7){_0x4252bf=_0x4252bf-0x0;var _0x32a218=_0x832a[_0x4252bf];return _0x32a218;};'use strict';var multer=require(_0xa832('0x0'));var util=require(_0xa832('0x1'));var path=require('path');var timeout=require(_0xa832('0x2'));var express=require(_0xa832('0x3'));var router=express['Router']();var fs_extra=require(_0xa832('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa832('0x5'));var config=require(_0xa832('0x6'));var controller=require(_0xa832('0x7'));router[_0xa832('0x8')]('/',auth[_0xa832('0x9')](),controller[_0xa832('0xa')]);router[_0xa832('0x8')](_0xa832('0xb'),auth[_0xa832('0x9')](),controller[_0xa832('0xc')]);router[_0xa832('0x8')]('/:id',auth[_0xa832('0x9')](),controller[_0xa832('0xd')]);router[_0xa832('0xe')]('/',auth[_0xa832('0x9')](),controller[_0xa832('0xf')]);router[_0xa832('0x10')](_0xa832('0x11'),auth[_0xa832('0x9')](),controller[_0xa832('0x12')]);router[_0xa832('0x13')](_0xa832('0x11'),auth[_0xa832('0x9')](),controller['destroy']);module[_0xa832('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 2dae0fc..6930192 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x253c32,_0x3e3bcf){var _0x22afe4=function(_0x2e75f8){while(--_0x2e75f8){_0x253c32['push'](_0x253c32['shift']());}};_0x22afe4(++_0x3e3bcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1e8db4,_0x12b067){var _0x3e1495=function(_0x3b9e39){while(--_0x3b9e39){_0x1e8db4['push'](_0x1e8db4['shift']());}};_0x3e1495(++_0x12b067);}(_0x008c,0x188));var _0xc008=function(_0x1fc85c,_0x4b72b8){_0x1fc85c=_0x1fc85c-0x0;var _0x952c1e=_0x008c[_0x1fc85c];return _0x952c1e;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9e8bd12..20f1bab 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 _0xb7a6=['VIRTUAL','includeAll','include','OpenchannelTransferReport','findAll','rows','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','map'];(function(_0x29d732,_0x4b2ca1){var _0x19cb2f=function(_0x114405){while(--_0x114405){_0x29d732['push'](_0x29d732['shift']());}};_0x19cb2f(++_0x4b2ca1);}(_0xb7a6,0x189));var _0x6b7a=function(_0xb36c0a,_0x4ac490){_0xb36c0a=_0xb36c0a-0x0;var _0x4caca0=_0xb7a6[_0xb36c0a];return _0x4caca0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b7a('0x0'));var zipdir=require(_0x6b7a('0x1'));var jsonpatch=require(_0x6b7a('0x2'));var rp=require(_0x6b7a('0x3'));var moment=require(_0x6b7a('0x4'));var BPromise=require(_0x6b7a('0x5'));var Mustache=require(_0x6b7a('0x6'));var util=require(_0x6b7a('0x7'));var path=require(_0x6b7a('0x8'));var sox=require('sox');var csv=require(_0x6b7a('0x9'));var ejs=require(_0x6b7a('0xa'));var fs=require('fs');var fs_extra=require(_0x6b7a('0xb'));var _=require('lodash');var squel=require(_0x6b7a('0xc'));var crypto=require('crypto');var jsforce=require(_0x6b7a('0xd'));var deskjs=require(_0x6b7a('0xe'));var toCsv=require(_0x6b7a('0x9'));var querystring=require(_0x6b7a('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b7a('0x10'));var authService=require(_0x6b7a('0x11'));var qs=require(_0x6b7a('0x12'));var as=require(_0x6b7a('0x13'));var hardwareService=require(_0x6b7a('0x14'));var logger=require(_0x6b7a('0x15'))(_0x6b7a('0x16'));var utils=require(_0x6b7a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6b7a('0x18'));var db=require(_0x6b7a('0x19'))['db'];function respondWithStatusCode(_0x456270,_0x416ea3){_0x416ea3=_0x416ea3||0xcc;return function(_0x29662e){if(_0x29662e){return _0x456270[_0x6b7a('0x1a')](_0x416ea3);}return _0x456270[_0x6b7a('0x1b')](_0x416ea3)['end']();};}function respondWithResult(_0x2b0015,_0x4fc141){_0x4fc141=_0x4fc141||0xc8;return function(_0x48a97c){if(_0x48a97c){return _0x2b0015[_0x6b7a('0x1b')](_0x4fc141)[_0x6b7a('0x1c')](_0x48a97c);}};}function respondWithFilteredResult(_0xf16ba0,_0x766e39){return function(_0x52065a){if(_0x52065a){var _0x2cb977=typeof _0x766e39[_0x6b7a('0x1d')]===_0x6b7a('0x1e')&&typeof _0x766e39[_0x6b7a('0x1f')]===_0x6b7a('0x1e');var _0x2c2437=_0x52065a['count'];var _0x168351=_0x2cb977?0x0:_0x766e39[_0x6b7a('0x1d')];var _0xed6f91=_0x2cb977?_0x52065a[_0x6b7a('0x20')]:_0x766e39[_0x6b7a('0x1d')]+_0x766e39['limit'];var _0x787a91;if(_0xed6f91>=_0x2c2437){_0xed6f91=_0x2c2437;_0x787a91=0xc8;}else{_0x787a91=0xce;}_0xf16ba0[_0x6b7a('0x1b')](_0x787a91);return _0xf16ba0[_0x6b7a('0x21')]('Content-Range',_0x168351+'-'+_0xed6f91+'/'+_0x2c2437)[_0x6b7a('0x1c')](_0x52065a);}return null;};}function patchUpdates(_0x535ce0){return function(_0x5ce8ef){try{jsonpatch[_0x6b7a('0x22')](_0x5ce8ef,_0x535ce0,!![]);}catch(_0xf94ad4){return BPromise[_0x6b7a('0x23')](_0xf94ad4);}return _0x5ce8ef[_0x6b7a('0x24')]();};}function saveUpdates(_0x418786,_0x302aa9){return function(_0xc6059c){if(_0xc6059c){return _0xc6059c['update'](_0x418786)[_0x6b7a('0x25')](function(_0x31d2c1){return _0x31d2c1;});}return null;};}function removeEntity(_0x85337d,_0x4708f5){return function(_0x3e9dbe){if(_0x3e9dbe){return _0x3e9dbe['destroy']()[_0x6b7a('0x25')](function(){_0x85337d[_0x6b7a('0x1b')](0xcc)[_0x6b7a('0x26')]();});}};}function handleEntityNotFound(_0x3095d3,_0x2a7812){return function(_0x5584f0){if(!_0x5584f0){_0x3095d3[_0x6b7a('0x1a')](0x194);}return _0x5584f0;};}function handleError(_0x3512d5,_0x4d0148){_0x4d0148=_0x4d0148||0x1f4;return function(_0xecca4f){logger[_0x6b7a('0x27')](_0xecca4f[_0x6b7a('0x28')]);if(_0xecca4f[_0x6b7a('0x29')]){delete _0xecca4f[_0x6b7a('0x29')];}_0x3512d5[_0x6b7a('0x1b')](_0x4d0148)[_0x6b7a('0x2a')](_0xecca4f);};}exports[_0x6b7a('0x2b')]=function(_0x1d19eb,_0x3f3d85){var _0x4ce0bc={},_0x3d41a5={},_0x89d08e={'count':0x0,'rows':[]};var _0x224619=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x2de232){return{'name':_0x2de232[_0x6b7a('0x2c')],'type':_0x2de232[_0x6b7a('0x2d')][_0x6b7a('0x2e')]};});_0x3d41a5[_0x6b7a('0x2f')]=_['map'](_0x224619,_0x6b7a('0x29'));_0x3d41a5[_0x6b7a('0x30')]=_[_0x6b7a('0x31')](_0x1d19eb[_0x6b7a('0x30')]);_0x3d41a5[_0x6b7a('0x32')]=_[_0x6b7a('0x33')](_0x3d41a5['model'],_0x3d41a5[_0x6b7a('0x30')]);_0x4ce0bc[_0x6b7a('0x34')]=_[_0x6b7a('0x33')](_0x3d41a5[_0x6b7a('0x2f')],qs['fields'](_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x35')]));_0x4ce0bc[_0x6b7a('0x34')]=_0x4ce0bc[_0x6b7a('0x34')][_0x6b7a('0x36')]?_0x4ce0bc[_0x6b7a('0x34')]:_0x3d41a5['model'];if(!_0x1d19eb[_0x6b7a('0x30')]['hasOwnProperty'](_0x6b7a('0x37'))){_0x4ce0bc[_0x6b7a('0x1f')]=qs[_0x6b7a('0x1f')](_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x1f')]);_0x4ce0bc['offset']=qs[_0x6b7a('0x1d')](_0x1d19eb[_0x6b7a('0x30')]['offset']);}_0x4ce0bc[_0x6b7a('0x38')]=qs['sort'](_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x39')]);_0x4ce0bc['where']=qs['filters'](_[_0x6b7a('0x3a')](_0x1d19eb[_0x6b7a('0x30')],_0x3d41a5[_0x6b7a('0x32')]),_0x224619);if(_0x1d19eb['query'][_0x6b7a('0x3b')]){_0x4ce0bc['where']=_[_0x6b7a('0x3c')](_0x4ce0bc[_0x6b7a('0x3d')],{'$or':_[_0x6b7a('0x3e')](_0x224619,function(_0x3b512d){if(_0x3b512d[_0x6b7a('0x2d')]!==_0x6b7a('0x3f')){var _0x54f3e3={};_0x54f3e3[_0x3b512d[_0x6b7a('0x29')]]={'$like':'%'+_0x1d19eb[_0x6b7a('0x30')][_0x6b7a('0x3b')]+'%'};return _0x54f3e3;}})});}_0x4ce0bc=_['merge']({},_0x4ce0bc,_0x1d19eb['options']);var _0x51cb20={'where':_0x4ce0bc[_0x6b7a('0x3d')]};return db['OpenchannelTransferReport'][_0x6b7a('0x20')](_0x51cb20)['then'](function(_0x3c7aac){_0x89d08e[_0x6b7a('0x20')]=_0x3c7aac;if(_0x1d19eb['query'][_0x6b7a('0x40')]){_0x4ce0bc[_0x6b7a('0x41')]=[{'all':!![]}];}return db[_0x6b7a('0x42')][_0x6b7a('0x43')](_0x4ce0bc);})[_0x6b7a('0x25')](function(_0x44d4df){_0x89d08e[_0x6b7a('0x44')]=_0x44d4df;return _0x89d08e;})[_0x6b7a('0x25')](respondWithFilteredResult(_0x3f3d85,_0x4ce0bc))['catch'](handleError(_0x3f3d85,null));};exports['show']=function(_0x330c3f,_0x15f3e5){var _0x323e0a={'raw':!![],'where':{'id':_0x330c3f[_0x6b7a('0x45')]['id']}},_0x1b22ff={};_0x1b22ff[_0x6b7a('0x2f')]=_[_0x6b7a('0x31')](db['OpenchannelTransferReport']['rawAttributes']);_0x1b22ff[_0x6b7a('0x30')]=_[_0x6b7a('0x31')](_0x330c3f[_0x6b7a('0x30')]);_0x1b22ff[_0x6b7a('0x32')]=_[_0x6b7a('0x33')](_0x1b22ff['model'],_0x1b22ff[_0x6b7a('0x30')]);_0x323e0a[_0x6b7a('0x34')]=_[_0x6b7a('0x33')](_0x1b22ff['model'],qs['fields'](_0x330c3f[_0x6b7a('0x30')][_0x6b7a('0x35')]));_0x323e0a['attributes']=_0x323e0a['attributes']['length']?_0x323e0a['attributes']:_0x1b22ff[_0x6b7a('0x2f')];if(_0x330c3f[_0x6b7a('0x30')]['includeAll']){_0x323e0a['include']=[{'all':!![]}];}_0x323e0a=_[_0x6b7a('0x3c')]({},_0x323e0a,_0x330c3f['options']);return db[_0x6b7a('0x42')][_0x6b7a('0x46')](_0x323e0a)[_0x6b7a('0x25')](handleEntityNotFound(_0x15f3e5,null))[_0x6b7a('0x25')](respondWithResult(_0x15f3e5,null))[_0x6b7a('0x47')](handleError(_0x15f3e5,null));};exports[_0x6b7a('0x48')]=function(_0x26f8ef,_0x29983c){return db[_0x6b7a('0x42')][_0x6b7a('0x48')](_0x26f8ef[_0x6b7a('0x49')],{})['then'](respondWithResult(_0x29983c,0xc9))[_0x6b7a('0x47')](handleError(_0x29983c,null));};exports[_0x6b7a('0x4a')]=function(_0x32e9cc,_0x190761){if(_0x32e9cc[_0x6b7a('0x49')]['id']){delete _0x32e9cc[_0x6b7a('0x49')]['id'];}return db[_0x6b7a('0x42')]['find']({'where':{'id':_0x32e9cc[_0x6b7a('0x45')]['id']}})[_0x6b7a('0x25')](handleEntityNotFound(_0x190761,null))[_0x6b7a('0x25')](saveUpdates(_0x32e9cc[_0x6b7a('0x49')],null))[_0x6b7a('0x25')](respondWithResult(_0x190761,null))[_0x6b7a('0x47')](handleError(_0x190761,null));};exports['destroy']=function(_0x416d16,_0x5b7f8e){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x416d16['params']['id']}})[_0x6b7a('0x25')](handleEntityNotFound(_0x5b7f8e,null))[_0x6b7a('0x25')](removeEntity(_0x5b7f8e,null))[_0x6b7a('0x47')](handleError(_0x5b7f8e,null));};exports[_0x6b7a('0x4b')]=function(_0x16d8bd,_0x1a007c){return db[_0x6b7a('0x42')][_0x6b7a('0x4b')]()[_0x6b7a('0x25')](respondWithResult(_0x1a007c,null))[_0x6b7a('0x47')](handleError(_0x1a007c,null));}; \ No newline at end of file +var _0x0b36=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xe01639,_0x2eea58){var _0x5f8321=function(_0x48a30d){while(--_0x48a30d){_0xe01639['push'](_0xe01639['shift']());}};_0x5f8321(++_0x2eea58);}(_0x0b36,0x80));var _0x60b3=function(_0x2ef7b0,_0x3c1a32){_0x2ef7b0=_0x2ef7b0-0x0;var _0x41739b=_0x0b36[_0x2ef7b0];return _0x41739b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60b3('0x0'));var zipdir=require(_0x60b3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60b3('0x2'));var moment=require(_0x60b3('0x3'));var BPromise=require(_0x60b3('0x4'));var Mustache=require(_0x60b3('0x5'));var util=require(_0x60b3('0x6'));var path=require(_0x60b3('0x7'));var sox=require(_0x60b3('0x8'));var csv=require(_0x60b3('0x9'));var ejs=require(_0x60b3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60b3('0xb'));var squel=require(_0x60b3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x60b3('0xd'));var toCsv=require(_0x60b3('0x9'));var querystring=require(_0x60b3('0xe'));var Papa=require(_0x60b3('0xf'));var Redis=require(_0x60b3('0x10'));var authService=require(_0x60b3('0x11'));var qs=require(_0x60b3('0x12'));var as=require(_0x60b3('0x13'));var hardwareService=require(_0x60b3('0x14'));var logger=require(_0x60b3('0x15'))(_0x60b3('0x16'));var utils=require(_0x60b3('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9ffd,_0x212ed1){_0x212ed1=_0x212ed1||0xcc;return function(_0x89ebe4){if(_0x89ebe4){return _0x5e9ffd[_0x60b3('0x18')](_0x212ed1);}return _0x5e9ffd[_0x60b3('0x19')](_0x212ed1)['end']();};}function respondWithResult(_0x2a1e37,_0xcbd7ed){_0xcbd7ed=_0xcbd7ed||0xc8;return function(_0x5b40b5){if(_0x5b40b5){return _0x2a1e37[_0x60b3('0x19')](_0xcbd7ed)[_0x60b3('0x1a')](_0x5b40b5);}};}function respondWithFilteredResult(_0x757170,_0x511e5d){return function(_0x5661e5){if(_0x5661e5){var _0x5eb339=typeof _0x511e5d[_0x60b3('0x1b')]==='undefined'&&typeof _0x511e5d['limit']===_0x60b3('0x1c');var _0x5ac95c=_0x5661e5['count'];var _0x248840=_0x5eb339?0x0:_0x511e5d[_0x60b3('0x1b')];var _0x746b04=_0x5eb339?_0x5661e5[_0x60b3('0x1d')]:_0x511e5d['offset']+_0x511e5d['limit'];var _0x7433a0;if(_0x746b04>=_0x5ac95c){_0x746b04=_0x5ac95c;_0x7433a0=0xc8;}else{_0x7433a0=0xce;}_0x757170[_0x60b3('0x19')](_0x7433a0);return _0x757170[_0x60b3('0x1e')](_0x60b3('0x1f'),_0x248840+'-'+_0x746b04+'/'+_0x5ac95c)[_0x60b3('0x1a')](_0x5661e5);}return null;};}function patchUpdates(_0x10a05c){return function(_0x4afcaf){try{jsonpatch['apply'](_0x4afcaf,_0x10a05c,!![]);}catch(_0x4647b2){return BPromise[_0x60b3('0x20')](_0x4647b2);}return _0x4afcaf['save']();};}function saveUpdates(_0x50b698,_0x4a0e45){return function(_0x144598){if(_0x144598){return _0x144598[_0x60b3('0x21')](_0x50b698)[_0x60b3('0x22')](function(_0x58d0c6){return _0x58d0c6;});}return null;};}function removeEntity(_0x17a77c,_0x161f21){return function(_0x16bb21){if(_0x16bb21){return _0x16bb21[_0x60b3('0x23')]()[_0x60b3('0x22')](function(){_0x17a77c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe6bcfe,_0x11231f){return function(_0x1ea062){if(!_0x1ea062){_0xe6bcfe[_0x60b3('0x18')](0x194);}return _0x1ea062;};}function handleError(_0x57b186,_0x279d44){_0x279d44=_0x279d44||0x1f4;return function(_0x130367){logger[_0x60b3('0x24')](_0x130367[_0x60b3('0x25')]);if(_0x130367['name']){delete _0x130367['name'];}_0x57b186['status'](_0x279d44)['send'](_0x130367);};}exports[_0x60b3('0x26')]=function(_0x586830,_0x2ac9b5){var _0x3d6428={},_0x1ca519={},_0x3ab862={'count':0x0,'rows':[]};var _0x3f25e7=_[_0x60b3('0x27')](db[_0x60b3('0x28')][_0x60b3('0x29')],function(_0x199e81){return{'name':_0x199e81[_0x60b3('0x2a')],'type':_0x199e81['type'][_0x60b3('0x2b')]};});_0x1ca519['model']=_[_0x60b3('0x27')](_0x3f25e7,'name');_0x1ca519[_0x60b3('0x2c')]=_[_0x60b3('0x2d')](_0x586830[_0x60b3('0x2c')]);_0x1ca519[_0x60b3('0x2e')]=_[_0x60b3('0x2f')](_0x1ca519[_0x60b3('0x30')],_0x1ca519['query']);_0x3d6428[_0x60b3('0x31')]=_['intersection'](_0x1ca519[_0x60b3('0x30')],qs[_0x60b3('0x32')](_0x586830[_0x60b3('0x2c')][_0x60b3('0x32')]));_0x3d6428[_0x60b3('0x31')]=_0x3d6428[_0x60b3('0x31')][_0x60b3('0x33')]?_0x3d6428[_0x60b3('0x31')]:_0x1ca519[_0x60b3('0x30')];if(!_0x586830[_0x60b3('0x2c')][_0x60b3('0x34')](_0x60b3('0x35'))){_0x3d6428[_0x60b3('0x36')]=qs[_0x60b3('0x36')](_0x586830[_0x60b3('0x2c')][_0x60b3('0x36')]);_0x3d6428[_0x60b3('0x1b')]=qs[_0x60b3('0x1b')](_0x586830[_0x60b3('0x2c')][_0x60b3('0x1b')]);}_0x3d6428[_0x60b3('0x37')]=qs[_0x60b3('0x38')](_0x586830[_0x60b3('0x2c')]['sort']);_0x3d6428['where']=qs[_0x60b3('0x2e')](_[_0x60b3('0x39')](_0x586830['query'],_0x1ca519[_0x60b3('0x2e')]),_0x3f25e7);if(_0x586830[_0x60b3('0x2c')][_0x60b3('0x3a')]){_0x3d6428[_0x60b3('0x3b')]=_[_0x60b3('0x3c')](_0x3d6428[_0x60b3('0x3b')],{'$or':_[_0x60b3('0x27')](_0x3f25e7,function(_0x1505ff){if(_0x1505ff['type']!=='VIRTUAL'){var _0x479f1c={};_0x479f1c[_0x1505ff['name']]={'$like':'%'+_0x586830[_0x60b3('0x2c')]['filter']+'%'};return _0x479f1c;}})});}_0x3d6428=_[_0x60b3('0x3c')]({},_0x3d6428,_0x586830[_0x60b3('0x3d')]);var _0x5a7749={'where':_0x3d6428[_0x60b3('0x3b')]};return db[_0x60b3('0x28')][_0x60b3('0x1d')](_0x5a7749)[_0x60b3('0x22')](function(_0x5012f6){_0x3ab862[_0x60b3('0x1d')]=_0x5012f6;if(_0x586830[_0x60b3('0x2c')][_0x60b3('0x3e')]){_0x3d6428[_0x60b3('0x3f')]=[{'all':!![]}];}return db[_0x60b3('0x28')][_0x60b3('0x40')](_0x3d6428);})['then'](function(_0x18c206){_0x3ab862[_0x60b3('0x41')]=_0x18c206;return _0x3ab862;})[_0x60b3('0x22')](respondWithFilteredResult(_0x2ac9b5,_0x3d6428))[_0x60b3('0x42')](handleError(_0x2ac9b5,null));};exports[_0x60b3('0x43')]=function(_0x191da2,_0x3b80ad){var _0x5a65da={'raw':!![],'where':{'id':_0x191da2[_0x60b3('0x44')]['id']}},_0x51954c={};_0x51954c['model']=_[_0x60b3('0x2d')](db[_0x60b3('0x28')][_0x60b3('0x29')]);_0x51954c[_0x60b3('0x2c')]=_[_0x60b3('0x2d')](_0x191da2[_0x60b3('0x2c')]);_0x51954c[_0x60b3('0x2e')]=_[_0x60b3('0x2f')](_0x51954c[_0x60b3('0x30')],_0x51954c[_0x60b3('0x2c')]);_0x5a65da[_0x60b3('0x31')]=_[_0x60b3('0x2f')](_0x51954c['model'],qs[_0x60b3('0x32')](_0x191da2['query'][_0x60b3('0x32')]));_0x5a65da[_0x60b3('0x31')]=_0x5a65da[_0x60b3('0x31')][_0x60b3('0x33')]?_0x5a65da[_0x60b3('0x31')]:_0x51954c['model'];if(_0x191da2[_0x60b3('0x2c')][_0x60b3('0x3e')]){_0x5a65da[_0x60b3('0x3f')]=[{'all':!![]}];}_0x5a65da=_[_0x60b3('0x3c')]({},_0x5a65da,_0x191da2[_0x60b3('0x3d')]);return db[_0x60b3('0x28')][_0x60b3('0x45')](_0x5a65da)['then'](handleEntityNotFound(_0x3b80ad,null))[_0x60b3('0x22')](respondWithResult(_0x3b80ad,null))[_0x60b3('0x42')](handleError(_0x3b80ad,null));};exports[_0x60b3('0x46')]=function(_0x4c0a51,_0x2b3854){return db[_0x60b3('0x28')][_0x60b3('0x46')](_0x4c0a51[_0x60b3('0x47')],{})[_0x60b3('0x22')](respondWithResult(_0x2b3854,0xc9))[_0x60b3('0x42')](handleError(_0x2b3854,null));};exports[_0x60b3('0x21')]=function(_0x34b155,_0x410b4f){if(_0x34b155[_0x60b3('0x47')]['id']){delete _0x34b155['body']['id'];}return db[_0x60b3('0x28')]['find']({'where':{'id':_0x34b155['params']['id']}})[_0x60b3('0x22')](handleEntityNotFound(_0x410b4f,null))[_0x60b3('0x22')](saveUpdates(_0x34b155[_0x60b3('0x47')],null))[_0x60b3('0x22')](respondWithResult(_0x410b4f,null))[_0x60b3('0x42')](handleError(_0x410b4f,null));};exports[_0x60b3('0x23')]=function(_0x3724aa,_0xb4fb46){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3724aa[_0x60b3('0x44')]['id']}})[_0x60b3('0x22')](handleEntityNotFound(_0xb4fb46,null))[_0x60b3('0x22')](removeEntity(_0xb4fb46,null))['catch'](handleError(_0xb4fb46,null));};exports['describe']=function(_0x2319c9,_0x2c81d3){return db[_0x60b3('0x28')][_0x60b3('0x48')]()[_0x60b3('0x22')](respondWithResult(_0x2c81d3,null))[_0x60b3('0x42')](handleError(_0x2c81d3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4e94f88..43486a6 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 _0x2638=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0x2638,0x1d4));var _0x8263=function(_0x909dfe,_0x36e38a){_0x909dfe=_0x909dfe-0x0;var _0x5cb58f=_0x2638[_0x909dfe];return _0x5cb58f;};'use strict';var _=require(_0x8263('0x0'));var util=require(_0x8263('0x1'));var logger=require(_0x8263('0x2'))(_0x8263('0x3'));var moment=require('moment');var BPromise=require(_0x8263('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8263('0x5'));var config=require(_0x8263('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8263('0x7')]=function(_0x31a47e,_0x22e678){return _0x31a47e[_0x8263('0x8')](_0x8263('0x9'),attributes,{'tableName':_0x8263('0xa'),'paranoid':![],'indexes':[{'name':_0x8263('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dce=['../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','util'];(function(_0x4ae8f8,_0x40a58e){var _0x24c8c6=function(_0x2457da){while(--_0x2457da){_0x4ae8f8['push'](_0x4ae8f8['shift']());}};_0x24c8c6(++_0x40a58e);}(_0x2dce,0xdb));var _0xe2dc=function(_0x5a7b96,_0x896caa){_0x5a7b96=_0x5a7b96-0x0;var _0x309775=_0x2dce[_0x5a7b96];return _0x309775;};'use strict';var _=require('lodash');var util=require(_0xe2dc('0x0'));var logger=require(_0xe2dc('0x1'))(_0xe2dc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe2dc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2dc('0x4'));var config=require(_0xe2dc('0x5'));var attributes=require(_0xe2dc('0x6'));module[_0xe2dc('0x7')]=function(_0x646602,_0x433b70){return _0x646602['define'](_0xe2dc('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe2dc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 600c0b5..fa251fb 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 _0xdc97=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ff581,_0x3147e4){var _0x761a0c=function(_0x4b07fa){while(--_0x4b07fa){_0x1ff581['push'](_0x1ff581['shift']());}};_0x761a0c(++_0x3147e4);}(_0xdc97,0x13b));var _0x7dc9=function(_0x520c22,_0x43ed81){_0x520c22=_0x520c22-0x0;var _0x343c71=_0xdc97[_0x520c22];return _0x343c71;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});} \ No newline at end of file +var _0xb647=['request','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x2ea857,_0x692ec1){var _0x13b408=function(_0x5f43ba){while(--_0x5f43ba){_0x2ea857['push'](_0x2ea857['shift']());}};_0x13b408(++_0x692ec1);}(_0xb647,0xdb));var _0x7b64=function(_0x44a699,_0x489eca){_0x44a699=_0x44a699-0x0;var _0x15ceb0=_0xb647[_0x44a699];return _0x15ceb0;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var moment=require(_0x7b64('0x2'));var BPromise=require(_0x7b64('0x3'));var rs=require(_0x7b64('0x4'));var fs=require('fs');var Redis=require(_0x7b64('0x5'));var db=require(_0x7b64('0x6'))['db'];var utils=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var jayson=require(_0x7b64('0x9'));var client=jayson[_0x7b64('0xa')][_0x7b64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x80721a,_0xcdec41,_0x22eca3){return new BPromise(function(_0x727684,_0x2ff650){return client[_0x7b64('0xc')](_0x80721a,_0x22eca3)['then'](function(_0x1b8b2a){logger['info'](_0x7b64('0xd'),_0xcdec41,'request\x20sent');logger['debug'](_0x7b64('0xe'),_0xcdec41,_0x7b64('0xf'),JSON['stringify'](_0x1b8b2a));if(_0x1b8b2a[_0x7b64('0x10')]){if(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x11')]===0x1f4){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x2ff650(_0x1b8b2a['error'][_0x7b64('0x12')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0xcdec41,_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);return _0x727684(_0x1b8b2a[_0x7b64('0x10')][_0x7b64('0x12')]);}else{logger[_0x7b64('0x13')](_0x7b64('0xd'),_0xcdec41,_0x7b64('0xf'));_0x727684(_0x1b8b2a['result'][_0x7b64('0x12')]);}})[_0x7b64('0x14')](function(_0x16ff72){logger[_0x7b64('0x10')](_0x7b64('0xd'),_0xcdec41,_0x16ff72);_0x2ff650(_0x16ff72);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 18ac567..3163c31 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 _0xe6f8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4f33f0,_0x2f7df8){var _0x40e3c2=function(_0x1ddb45){while(--_0x1ddb45){_0x4f33f0['push'](_0x4f33f0['shift']());}};_0x40e3c2(++_0x2f7df8);}(_0xe6f8,0x153));var _0x8e6f=function(_0xc48c16,_0x10892e){_0xc48c16=_0xc48c16-0x0;var _0x3cfeaa=_0xe6f8[_0xc48c16];return _0x3cfeaa;};'use strict';var multer=require('multer');var util=require(_0x8e6f('0x0'));var path=require(_0x8e6f('0x1'));var timeout=require(_0x8e6f('0x2'));var express=require(_0x8e6f('0x3'));var router=express[_0x8e6f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e6f('0x5'));var interaction=require(_0x8e6f('0x6'));var config=require(_0x8e6f('0x7'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8e6f('0x8')]);router[_0x8e6f('0x9')](_0x8e6f('0xa'),auth[_0x8e6f('0xb')](),controller[_0x8e6f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8e6f('0xd')]);router[_0x8e6f('0xe')](_0x8e6f('0xa'),auth[_0x8e6f('0xb')](),controller[_0x8e6f('0xf')]);router[_0x8e6f('0x10')](_0x8e6f('0xa'),auth[_0x8e6f('0xb')](),controller[_0x8e6f('0x11')]);module[_0x8e6f('0x12')]=router; \ No newline at end of file +var _0x23f2=['get','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated'];(function(_0x78a2d8,_0x1c2137){var _0x34cb72=function(_0x2713a1){while(--_0x2713a1){_0x78a2d8['push'](_0x78a2d8['shift']());}};_0x34cb72(++_0x1c2137);}(_0x23f2,0x171));var _0x223f=function(_0x1b9e62,_0x34523c){_0x1b9e62=_0x1b9e62-0x0;var _0x1e3eef=_0x23f2[_0x1b9e62];return _0x1e3eef;};'use strict';var multer=require(_0x223f('0x0'));var util=require(_0x223f('0x1'));var path=require(_0x223f('0x2'));var timeout=require(_0x223f('0x3'));var express=require(_0x223f('0x4'));var router=express['Router']();var fs_extra=require(_0x223f('0x5'));var auth=require(_0x223f('0x6'));var interaction=require(_0x223f('0x7'));var config=require(_0x223f('0x8'));var controller=require(_0x223f('0x9'));router['get']('/',auth[_0x223f('0xa')](),controller['index']);router[_0x223f('0xb')](_0x223f('0xc'),auth[_0x223f('0xa')](),controller['show']);router['post']('/',auth[_0x223f('0xa')](),controller[_0x223f('0xd')]);router[_0x223f('0xe')](_0x223f('0xc'),auth[_0x223f('0xa')](),controller[_0x223f('0xf')]);router[_0x223f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x223f('0x11')]);module[_0x223f('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 6a7bbae..f28346c 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 _0xdf97=['name','STRING','sequelize','exports'];(function(_0xdebd5b,_0x3da8ee){var _0x5bc076=function(_0x3a58af){while(--_0x3a58af){_0xdebd5b['push'](_0xdebd5b['shift']());}};_0x5bc076(++_0x3da8ee);}(_0xdf97,0x6a));var _0x7df9=function(_0x2bbb1e,_0x4abf09){_0x2bbb1e=_0x2bbb1e-0x0;var _0x14302d=_0xdf97[_0x2bbb1e];return _0x14302d;};'use strict';var Sequelize=require(_0x7df9('0x0'));module[_0x7df9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7df9('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7df9('0x3')]}}; \ No newline at end of file +var _0x2b29=['name','STRING','sequelize','exports'];(function(_0x1c80e4,_0x54093e){var _0x52cf4f=function(_0x58e283){while(--_0x58e283){_0x1c80e4['push'](_0x1c80e4['shift']());}};_0x52cf4f(++_0x54093e);}(_0x2b29,0x14e));var _0x92b2=function(_0x12926d,_0x35ac15){_0x12926d=_0x12926d-0x0;var _0x2d5f0f=_0x2b29[_0x12926d];return _0x2d5f0f;};'use strict';var Sequelize=require(_0x92b2('0x0'));module[_0x92b2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x92b2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x92b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 14bfa8c..dd1800b 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 _0xf097=['Pause','rows','show','params','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','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','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','filter','includeAll','include'];(function(_0x2dcebc,_0x3e6fd2){var _0x3199cb=function(_0x5bd3bc){while(--_0x5bd3bc){_0x2dcebc['push'](_0x2dcebc['shift']());}};_0x3199cb(++_0x3e6fd2);}(_0xf097,0x66));var _0x7f09=function(_0x21a54e,_0x51a172){_0x21a54e=_0x21a54e-0x0;var _0x199d0d=_0xf097[_0x21a54e];return _0x199d0d;};'use strict';var emlformat=require(_0x7f09('0x0'));var rimraf=require(_0x7f09('0x1'));var zipdir=require(_0x7f09('0x2'));var jsonpatch=require(_0x7f09('0x3'));var rp=require(_0x7f09('0x4'));var moment=require(_0x7f09('0x5'));var BPromise=require(_0x7f09('0x6'));var Mustache=require(_0x7f09('0x7'));var util=require(_0x7f09('0x8'));var path=require(_0x7f09('0x9'));var sox=require('sox');var csv=require(_0x7f09('0xa'));var ejs=require(_0x7f09('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f09('0xc'));var squel=require(_0x7f09('0xd'));var crypto=require(_0x7f09('0xe'));var jsforce=require(_0x7f09('0xf'));var deskjs=require(_0x7f09('0x10'));var toCsv=require(_0x7f09('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f09('0x11'));var authService=require(_0x7f09('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f09('0x13'));var hardwareService=require(_0x7f09('0x14'));var logger=require(_0x7f09('0x15'))(_0x7f09('0x16'));var utils=require(_0x7f09('0x17'));var config=require(_0x7f09('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f09('0x19'))['db'];function respondWithStatusCode(_0x45592d,_0x46d2d1){_0x46d2d1=_0x46d2d1||0xcc;return function(_0x1c2583){if(_0x1c2583){return _0x45592d['sendStatus'](_0x46d2d1);}return _0x45592d['status'](_0x46d2d1)[_0x7f09('0x1a')]();};}function respondWithResult(_0x3d3270,_0x51650b){_0x51650b=_0x51650b||0xc8;return function(_0x4a2107){if(_0x4a2107){return _0x3d3270[_0x7f09('0x1b')](_0x51650b)[_0x7f09('0x1c')](_0x4a2107);}};}function respondWithFilteredResult(_0x3f0fd8,_0x55ebbd){return function(_0x2da406){if(_0x2da406){var _0x447702=typeof _0x55ebbd[_0x7f09('0x1d')]===_0x7f09('0x1e')&&typeof _0x55ebbd[_0x7f09('0x1f')]===_0x7f09('0x1e');var _0x247d69=_0x2da406[_0x7f09('0x20')];var _0x25ba41=_0x447702?0x0:_0x55ebbd[_0x7f09('0x1d')];var _0x4a4bcb=_0x447702?_0x2da406[_0x7f09('0x20')]:_0x55ebbd[_0x7f09('0x1d')]+_0x55ebbd[_0x7f09('0x1f')];var _0x4ddb58;if(_0x4a4bcb>=_0x247d69){_0x4a4bcb=_0x247d69;_0x4ddb58=0xc8;}else{_0x4ddb58=0xce;}_0x3f0fd8[_0x7f09('0x1b')](_0x4ddb58);return _0x3f0fd8[_0x7f09('0x21')](_0x7f09('0x22'),_0x25ba41+'-'+_0x4a4bcb+'/'+_0x247d69)[_0x7f09('0x1c')](_0x2da406);}return null;};}function patchUpdates(_0x5e59e5){return function(_0x21af58){try{jsonpatch['apply'](_0x21af58,_0x5e59e5,!![]);}catch(_0x4f6af5){return BPromise[_0x7f09('0x23')](_0x4f6af5);}return _0x21af58[_0x7f09('0x24')]();};}function saveUpdates(_0x1864ba,_0x916963){return function(_0x300c50){if(_0x300c50){return _0x300c50[_0x7f09('0x25')](_0x1864ba)[_0x7f09('0x26')](function(_0x16cec5){return _0x16cec5;});}return null;};}function removeEntity(_0x178aad,_0x3a30cb){return function(_0x225299){if(_0x225299){return _0x225299[_0x7f09('0x27')]()['then'](function(){var _0x2c40cf=_0x225299[_0x7f09('0x28')]({'plain':!![]});var _0x42c928=_0x7f09('0x29');return db[_0x7f09('0x2a')]['destroy']({'where':{'type':_0x42c928,'resourceId':_0x2c40cf['id']}})[_0x7f09('0x26')](function(){return _0x225299;});})[_0x7f09('0x26')](function(){_0x178aad[_0x7f09('0x1b')](0xcc)[_0x7f09('0x1a')]();});}};}function handleEntityNotFound(_0x4fbd38,_0x2a533b){return function(_0x39a9bf){if(!_0x39a9bf){_0x4fbd38[_0x7f09('0x2b')](0x194);}return _0x39a9bf;};}function handleError(_0x54997e,_0x1e12ac){_0x1e12ac=_0x1e12ac||0x1f4;return function(_0x650508){logger['error'](_0x650508[_0x7f09('0x2c')]);if(_0x650508[_0x7f09('0x2d')]){delete _0x650508[_0x7f09('0x2d')];}_0x54997e[_0x7f09('0x1b')](_0x1e12ac)[_0x7f09('0x2e')](_0x650508);};}exports[_0x7f09('0x2f')]=function(_0x2af662,_0x10170d){var _0x205e3e={},_0x30d55a={},_0x4e06f1={'count':0x0,'rows':[]};var _0x3a22f0=_[_0x7f09('0x30')](db['Pause'][_0x7f09('0x31')],function(_0x364993){return{'name':_0x364993['fieldName'],'type':_0x364993[_0x7f09('0x32')][_0x7f09('0x33')]};});_0x30d55a[_0x7f09('0x34')]=_[_0x7f09('0x30')](_0x3a22f0,_0x7f09('0x2d'));_0x30d55a[_0x7f09('0x35')]=_[_0x7f09('0x36')](_0x2af662[_0x7f09('0x35')]);_0x30d55a[_0x7f09('0x37')]=_[_0x7f09('0x38')](_0x30d55a[_0x7f09('0x34')],_0x30d55a['query']);_0x205e3e[_0x7f09('0x39')]=_[_0x7f09('0x38')](_0x30d55a['model'],qs[_0x7f09('0x3a')](_0x2af662[_0x7f09('0x35')][_0x7f09('0x3a')]));_0x205e3e[_0x7f09('0x39')]=_0x205e3e[_0x7f09('0x39')]['length']?_0x205e3e[_0x7f09('0x39')]:_0x30d55a[_0x7f09('0x34')];if(!_0x2af662[_0x7f09('0x35')]['hasOwnProperty'](_0x7f09('0x3b'))){_0x205e3e[_0x7f09('0x1f')]=qs['limit'](_0x2af662[_0x7f09('0x35')]['limit']);_0x205e3e[_0x7f09('0x1d')]=qs['offset'](_0x2af662[_0x7f09('0x35')][_0x7f09('0x1d')]);}_0x205e3e[_0x7f09('0x3c')]=qs['sort'](_0x2af662['query'][_0x7f09('0x3d')]);_0x205e3e[_0x7f09('0x3e')]=qs[_0x7f09('0x37')](_[_0x7f09('0x3f')](_0x2af662['query'],_0x30d55a[_0x7f09('0x37')]),_0x3a22f0);if(_0x2af662[_0x7f09('0x35')]['filter']){_0x205e3e['where']=_[_0x7f09('0x40')](_0x205e3e[_0x7f09('0x3e')],{'$or':_[_0x7f09('0x30')](_0x3a22f0,function(_0x180859){if(_0x180859[_0x7f09('0x32')]!=='VIRTUAL'){var _0x116230={};_0x116230[_0x180859['name']]={'$like':'%'+_0x2af662[_0x7f09('0x35')][_0x7f09('0x41')]+'%'};return _0x116230;}})});}_0x205e3e=_['merge']({},_0x205e3e,_0x2af662['options']);var _0x1d3abc={'where':_0x205e3e[_0x7f09('0x3e')]};return db['Pause']['count'](_0x1d3abc)[_0x7f09('0x26')](function(_0x27ed54){_0x4e06f1['count']=_0x27ed54;if(_0x2af662[_0x7f09('0x35')][_0x7f09('0x42')]){_0x205e3e[_0x7f09('0x43')]=[{'all':!![]}];}return db[_0x7f09('0x44')]['findAll'](_0x205e3e);})[_0x7f09('0x26')](function(_0x4fec90){_0x4e06f1[_0x7f09('0x45')]=_0x4fec90;return _0x4e06f1;})[_0x7f09('0x26')](respondWithFilteredResult(_0x10170d,_0x205e3e))['catch'](handleError(_0x10170d,null));};exports[_0x7f09('0x46')]=function(_0x25bd11,_0x558af3){var _0x3a37a4={'raw':!![],'where':{'id':_0x25bd11[_0x7f09('0x47')]['id']}},_0x33d10f={};_0x33d10f[_0x7f09('0x34')]=_[_0x7f09('0x36')](db[_0x7f09('0x44')][_0x7f09('0x31')]);_0x33d10f[_0x7f09('0x35')]=_[_0x7f09('0x36')](_0x25bd11[_0x7f09('0x35')]);_0x33d10f['filters']=_['intersection'](_0x33d10f[_0x7f09('0x34')],_0x33d10f[_0x7f09('0x35')]);_0x3a37a4[_0x7f09('0x39')]=_[_0x7f09('0x38')](_0x33d10f['model'],qs[_0x7f09('0x3a')](_0x25bd11[_0x7f09('0x35')]['fields']));_0x3a37a4['attributes']=_0x3a37a4[_0x7f09('0x39')]['length']?_0x3a37a4[_0x7f09('0x39')]:_0x33d10f[_0x7f09('0x34')];if(_0x25bd11[_0x7f09('0x35')][_0x7f09('0x42')]){_0x3a37a4[_0x7f09('0x43')]=[{'all':!![]}];}_0x3a37a4=_[_0x7f09('0x40')]({},_0x3a37a4,_0x25bd11[_0x7f09('0x48')]);return db['Pause'][_0x7f09('0x49')](_0x3a37a4)[_0x7f09('0x26')](handleEntityNotFound(_0x558af3,null))[_0x7f09('0x26')](respondWithResult(_0x558af3,null))[_0x7f09('0x4a')](handleError(_0x558af3,null));};exports['create']=function(_0x38a1a7,_0x6b3820){return db['Pause']['create'](_0x38a1a7[_0x7f09('0x4b')],{})['then'](function(_0x201754){var _0x37fca4=_0x38a1a7[_0x7f09('0x4c')][_0x7f09('0x28')]({'plain':!![]});if(!_0x37fca4)throw new Error(_0x7f09('0x4d'));if(_0x37fca4[_0x7f09('0x4e')]===_0x7f09('0x4c')){var _0x34b912=_0x201754[_0x7f09('0x28')]({'plain':!![]});var _0x3894be=_0x7f09('0x29');return db[_0x7f09('0x4f')][_0x7f09('0x49')]({'where':{'name':_0x3894be,'userProfileId':_0x37fca4[_0x7f09('0x50')]},'raw':!![]})[_0x7f09('0x26')](function(_0x1a1290){if(_0x1a1290&&_0x1a1290[_0x7f09('0x51')]===0x0){return db[_0x7f09('0x2a')][_0x7f09('0x52')]({'name':_0x34b912['name'],'resourceId':_0x34b912['id'],'type':_0x1a1290['name'],'sectionId':_0x1a1290['id']},{})[_0x7f09('0x26')](function(){return _0x201754;});}else{return _0x201754;}})[_0x7f09('0x4a')](function(_0x37350a){logger[_0x7f09('0x53')](_0x7f09('0x54'),_0x37350a);throw _0x37350a;});}return _0x201754;})[_0x7f09('0x26')](respondWithResult(_0x6b3820,0xc9))[_0x7f09('0x4a')](handleError(_0x6b3820,null));};exports[_0x7f09('0x25')]=function(_0x525278,_0x5be08c){if(_0x525278[_0x7f09('0x4b')]['id']){delete _0x525278[_0x7f09('0x4b')]['id'];}return db[_0x7f09('0x44')][_0x7f09('0x49')]({'where':{'id':_0x525278['params']['id']}})[_0x7f09('0x26')](handleEntityNotFound(_0x5be08c,null))[_0x7f09('0x26')](saveUpdates(_0x525278['body'],null))['then'](respondWithResult(_0x5be08c,null))[_0x7f09('0x4a')](handleError(_0x5be08c,null));};exports[_0x7f09('0x27')]=function(_0x19972c,_0x9a49af){return db[_0x7f09('0x44')][_0x7f09('0x49')]({'where':{'id':_0x19972c[_0x7f09('0x47')]['id']}})[_0x7f09('0x26')](handleEntityNotFound(_0x9a49af,null))[_0x7f09('0x26')](removeEntity(_0x9a49af,null))[_0x7f09('0x4a')](handleError(_0x9a49af,null));}; \ No newline at end of file +var _0xaf84=['include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','get','end','stack','name','send','map','Pause','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys'];(function(_0x2ff55d,_0x404f4b){var _0x1af942=function(_0x39ad08){while(--_0x39ad08){_0x2ff55d['push'](_0x2ff55d['shift']());}};_0x1af942(++_0x404f4b);}(_0xaf84,0x1e7));var _0x4af8=function(_0x5c4d30,_0x2bc47a){_0x5c4d30=_0x5c4d30-0x0;var _0x120851=_0xaf84[_0x5c4d30];return _0x120851;};'use strict';var emlformat=require(_0x4af8('0x0'));var rimraf=require(_0x4af8('0x1'));var zipdir=require(_0x4af8('0x2'));var jsonpatch=require(_0x4af8('0x3'));var rp=require(_0x4af8('0x4'));var moment=require(_0x4af8('0x5'));var BPromise=require(_0x4af8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4af8('0x7'));var csv=require(_0x4af8('0x8'));var ejs=require(_0x4af8('0x9'));var fs=require('fs');var fs_extra=require(_0x4af8('0xa'));var _=require(_0x4af8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4af8('0xc'));var toCsv=require(_0x4af8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4af8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4af8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4af8('0xf'))('api');var utils=require(_0x4af8('0x10'));var config=require(_0x4af8('0x11'));var licenseUtil=require(_0x4af8('0x12'));var db=require(_0x4af8('0x13'))['db'];function respondWithStatusCode(_0x56b198,_0x40cdb5){_0x40cdb5=_0x40cdb5||0xcc;return function(_0x46a5c8){if(_0x46a5c8){return _0x56b198[_0x4af8('0x14')](_0x40cdb5);}return _0x56b198[_0x4af8('0x15')](_0x40cdb5)['end']();};}function respondWithResult(_0x53fc95,_0x2fb984){_0x2fb984=_0x2fb984||0xc8;return function(_0x52e7a3){if(_0x52e7a3){return _0x53fc95['status'](_0x2fb984)[_0x4af8('0x16')](_0x52e7a3);}};}function respondWithFilteredResult(_0x3a1c4b,_0x5dfbf9){return function(_0x3eb858){if(_0x3eb858){var _0x216057=typeof _0x5dfbf9[_0x4af8('0x17')]===_0x4af8('0x18')&&typeof _0x5dfbf9[_0x4af8('0x19')]===_0x4af8('0x18');var _0xa1021a=_0x3eb858['count'];var _0x18b270=_0x216057?0x0:_0x5dfbf9[_0x4af8('0x17')];var _0x409600=_0x216057?_0x3eb858[_0x4af8('0x1a')]:_0x5dfbf9[_0x4af8('0x17')]+_0x5dfbf9['limit'];var _0x171503;if(_0x409600>=_0xa1021a){_0x409600=_0xa1021a;_0x171503=0xc8;}else{_0x171503=0xce;}_0x3a1c4b[_0x4af8('0x15')](_0x171503);return _0x3a1c4b[_0x4af8('0x1b')](_0x4af8('0x1c'),_0x18b270+'-'+_0x409600+'/'+_0xa1021a)[_0x4af8('0x16')](_0x3eb858);}return null;};}function patchUpdates(_0x33e057){return function(_0x24dccf){try{jsonpatch[_0x4af8('0x1d')](_0x24dccf,_0x33e057,!![]);}catch(_0x3f4362){return BPromise['reject'](_0x3f4362);}return _0x24dccf['save']();};}function saveUpdates(_0x5a52b9,_0x24470e){return function(_0xdc4165){if(_0xdc4165){return _0xdc4165[_0x4af8('0x1e')](_0x5a52b9)['then'](function(_0x3f6671){return _0x3f6671;});}return null;};}function removeEntity(_0x3ca952,_0x415518){return function(_0x1b4991){if(_0x1b4991){return _0x1b4991[_0x4af8('0x1f')]()[_0x4af8('0x20')](function(){var _0x4a290a=_0x1b4991[_0x4af8('0x21')]({'plain':!![]});var _0x28deee='Pauses';return db['UserProfileResource'][_0x4af8('0x1f')]({'where':{'type':_0x28deee,'resourceId':_0x4a290a['id']}})[_0x4af8('0x20')](function(){return _0x1b4991;});})[_0x4af8('0x20')](function(){_0x3ca952[_0x4af8('0x15')](0xcc)[_0x4af8('0x22')]();});}};}function handleEntityNotFound(_0x2dead3,_0x34a400){return function(_0x46a73a){if(!_0x46a73a){_0x2dead3[_0x4af8('0x14')](0x194);}return _0x46a73a;};}function handleError(_0x436645,_0xf34d8a){_0xf34d8a=_0xf34d8a||0x1f4;return function(_0x2625c7){logger['error'](_0x2625c7[_0x4af8('0x23')]);if(_0x2625c7[_0x4af8('0x24')]){delete _0x2625c7[_0x4af8('0x24')];}_0x436645['status'](_0xf34d8a)[_0x4af8('0x25')](_0x2625c7);};}exports['index']=function(_0x179bd7,_0x2193ed){var _0x1a5b65={},_0x3a84c7={},_0x310692={'count':0x0,'rows':[]};var _0x1981e6=_[_0x4af8('0x26')](db[_0x4af8('0x27')][_0x4af8('0x28')],function(_0x176b9c){return{'name':_0x176b9c[_0x4af8('0x29')],'type':_0x176b9c[_0x4af8('0x2a')]['key']};});_0x3a84c7[_0x4af8('0x2b')]=_[_0x4af8('0x26')](_0x1981e6,_0x4af8('0x24'));_0x3a84c7[_0x4af8('0x2c')]=_['keys'](_0x179bd7[_0x4af8('0x2c')]);_0x3a84c7['filters']=_[_0x4af8('0x2d')](_0x3a84c7[_0x4af8('0x2b')],_0x3a84c7['query']);_0x1a5b65['attributes']=_[_0x4af8('0x2d')](_0x3a84c7['model'],qs[_0x4af8('0x2e')](_0x179bd7[_0x4af8('0x2c')]['fields']));_0x1a5b65[_0x4af8('0x2f')]=_0x1a5b65[_0x4af8('0x2f')][_0x4af8('0x30')]?_0x1a5b65[_0x4af8('0x2f')]:_0x3a84c7[_0x4af8('0x2b')];if(!_0x179bd7[_0x4af8('0x2c')][_0x4af8('0x31')](_0x4af8('0x32'))){_0x1a5b65['limit']=qs['limit'](_0x179bd7[_0x4af8('0x2c')][_0x4af8('0x19')]);_0x1a5b65[_0x4af8('0x17')]=qs[_0x4af8('0x17')](_0x179bd7[_0x4af8('0x2c')][_0x4af8('0x17')]);}_0x1a5b65[_0x4af8('0x33')]=qs['sort'](_0x179bd7[_0x4af8('0x2c')][_0x4af8('0x34')]);_0x1a5b65[_0x4af8('0x35')]=qs[_0x4af8('0x36')](_[_0x4af8('0x37')](_0x179bd7[_0x4af8('0x2c')],_0x3a84c7[_0x4af8('0x36')]),_0x1981e6);if(_0x179bd7[_0x4af8('0x2c')][_0x4af8('0x38')]){_0x1a5b65['where']=_[_0x4af8('0x39')](_0x1a5b65[_0x4af8('0x35')],{'$or':_['map'](_0x1981e6,function(_0x8effe8){if(_0x8effe8[_0x4af8('0x2a')]!==_0x4af8('0x3a')){var _0x3c52d8={};_0x3c52d8[_0x8effe8[_0x4af8('0x24')]]={'$like':'%'+_0x179bd7['query'][_0x4af8('0x38')]+'%'};return _0x3c52d8;}})});}_0x1a5b65=_['merge']({},_0x1a5b65,_0x179bd7[_0x4af8('0x3b')]);var _0x402951={'where':_0x1a5b65[_0x4af8('0x35')]};return db[_0x4af8('0x27')][_0x4af8('0x1a')](_0x402951)['then'](function(_0x55768e){_0x310692['count']=_0x55768e;if(_0x179bd7[_0x4af8('0x2c')][_0x4af8('0x3c')]){_0x1a5b65['include']=[{'all':!![]}];}return db[_0x4af8('0x27')]['findAll'](_0x1a5b65);})[_0x4af8('0x20')](function(_0x10d4e9){_0x310692[_0x4af8('0x3d')]=_0x10d4e9;return _0x310692;})[_0x4af8('0x20')](respondWithFilteredResult(_0x2193ed,_0x1a5b65))[_0x4af8('0x3e')](handleError(_0x2193ed,null));};exports[_0x4af8('0x3f')]=function(_0x3d2f28,_0x461532){var _0x482987={'raw':!![],'where':{'id':_0x3d2f28[_0x4af8('0x40')]['id']}},_0x2a9ca4={};_0x2a9ca4[_0x4af8('0x2b')]=_['keys'](db['Pause'][_0x4af8('0x28')]);_0x2a9ca4[_0x4af8('0x2c')]=_[_0x4af8('0x41')](_0x3d2f28[_0x4af8('0x2c')]);_0x2a9ca4['filters']=_[_0x4af8('0x2d')](_0x2a9ca4['model'],_0x2a9ca4[_0x4af8('0x2c')]);_0x482987[_0x4af8('0x2f')]=_[_0x4af8('0x2d')](_0x2a9ca4[_0x4af8('0x2b')],qs['fields'](_0x3d2f28['query'][_0x4af8('0x2e')]));_0x482987[_0x4af8('0x2f')]=_0x482987[_0x4af8('0x2f')][_0x4af8('0x30')]?_0x482987[_0x4af8('0x2f')]:_0x2a9ca4['model'];if(_0x3d2f28[_0x4af8('0x2c')][_0x4af8('0x3c')]){_0x482987[_0x4af8('0x42')]=[{'all':!![]}];}_0x482987=_['merge']({},_0x482987,_0x3d2f28[_0x4af8('0x3b')]);return db[_0x4af8('0x27')][_0x4af8('0x43')](_0x482987)[_0x4af8('0x20')](handleEntityNotFound(_0x461532,null))[_0x4af8('0x20')](respondWithResult(_0x461532,null))[_0x4af8('0x3e')](handleError(_0x461532,null));};exports[_0x4af8('0x44')]=function(_0x28fcd1,_0x1193b1){return db[_0x4af8('0x27')][_0x4af8('0x44')](_0x28fcd1['body'],{})[_0x4af8('0x20')](function(_0x51a482){var _0x65e69c=_0x28fcd1[_0x4af8('0x45')][_0x4af8('0x21')]({'plain':!![]});if(!_0x65e69c)throw new Error(_0x4af8('0x46'));if(_0x65e69c[_0x4af8('0x47')]===_0x4af8('0x45')){var _0x3fd4b9=_0x51a482[_0x4af8('0x21')]({'plain':!![]});var _0x307cf6=_0x4af8('0x48');return db[_0x4af8('0x49')][_0x4af8('0x43')]({'where':{'name':_0x307cf6,'userProfileId':_0x65e69c['userProfileId']},'raw':!![]})['then'](function(_0x4e2f4c){if(_0x4e2f4c&&_0x4e2f4c[_0x4af8('0x4a')]===0x0){return db[_0x4af8('0x4b')][_0x4af8('0x44')]({'name':_0x3fd4b9[_0x4af8('0x24')],'resourceId':_0x3fd4b9['id'],'type':_0x4e2f4c[_0x4af8('0x24')],'sectionId':_0x4e2f4c['id']},{})['then'](function(){return _0x51a482;});}else{return _0x51a482;}})[_0x4af8('0x3e')](function(_0x467407){logger[_0x4af8('0x4c')](_0x4af8('0x4d'),_0x467407);throw _0x467407;});}return _0x51a482;})['then'](respondWithResult(_0x1193b1,0xc9))['catch'](handleError(_0x1193b1,null));};exports[_0x4af8('0x1e')]=function(_0x35574b,_0x564244){if(_0x35574b[_0x4af8('0x4e')]['id']){delete _0x35574b['body']['id'];}return db[_0x4af8('0x27')]['find']({'where':{'id':_0x35574b[_0x4af8('0x40')]['id']}})[_0x4af8('0x20')](handleEntityNotFound(_0x564244,null))[_0x4af8('0x20')](saveUpdates(_0x35574b[_0x4af8('0x4e')],null))['then'](respondWithResult(_0x564244,null))['catch'](handleError(_0x564244,null));};exports[_0x4af8('0x1f')]=function(_0x2f5f7f,_0x19c2cc){return db[_0x4af8('0x27')][_0x4af8('0x43')]({'where':{'id':_0x2f5f7f[_0x4af8('0x40')]['id']}})[_0x4af8('0x20')](handleEntityNotFound(_0x19c2cc,null))[_0x4af8('0x20')](removeEntity(_0x19c2cc,null))[_0x4af8('0x3e')](handleError(_0x19c2cc,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7b12c14..510ff17 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x21c627,_0x5bd960){_0x21c627=_0x21c627-0x0;var _0x1e0fbf=_0x6aa7[_0x21c627];return _0x1e0fbf;};'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 +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1fb9640..2651846 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(_0x5bd1b6,_0x12890b){var _0x5e5e97=function(_0x7b2cb4){while(--_0x7b2cb4){_0x5bd1b6['push'](_0x5bd1b6['shift']());}};_0x5e5e97(++_0x12890b);}(_0xb10b,0x12a));var _0xbb10=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0xb10b[_0x39a04c];return _0x580cb0;};'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(_0x15f628,_0x4e2a1){var _0x519601=function(_0x5acf7e){while(--_0x5acf7e){_0x15f628['push'](_0x15f628['shift']());}};_0x519601(++_0x4e2a1);}(_0x7a54,0x106));var _0x47a5=function(_0x3740fb,_0x5f24a4){_0x3740fb=_0x3740fb-0x0;var _0x4f0d1a=_0x7a54[_0x3740fb];return _0x4f0d1a;};'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 2b252c5..627016f 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 _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0x331066,_0x58fb28){var _0x283056=function(_0x324d7b){while(--_0x324d7b){_0x331066['push'](_0x331066['shift']());}};_0x283056(++_0x58fb28);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file +var _0x5db8=['basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s'];(function(_0x52304d,_0x2e0d13){var _0x27220a=function(_0x16433a){while(--_0x16433a){_0x52304d['push'](_0x52304d['shift']());}};_0x27220a(++_0x2e0d13);}(_0x5db8,0xbb));var _0x85db=function(_0x3a6922,_0xc728be){_0x3a6922=_0x3a6922-0x0;var _0x9c1b44=_0x5db8[_0x3a6922];return _0x9c1b44;};'use strict';var multer=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var timeout=require('connect-timeout');var express=require(_0x85db('0x3'));var router=express[_0x85db('0x4')]();var fs_extra=require(_0x85db('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85db('0x6'));var controller=require(_0x85db('0x7'));router[_0x85db('0x8')]('/',auth[_0x85db('0x9')](),controller['index']);router['get'](_0x85db('0xa'),controller[_0x85db('0xb')]);router[_0x85db('0x8')](_0x85db('0xc'),auth['isAuthenticated'](),controller[_0x85db('0xd')]);router['get'](_0x85db('0xe'),auth[_0x85db('0x9')](),controller[_0x85db('0xf')]);var upload=multer({'storage':multer[_0x85db('0x10')]({'destination':function(_0x5491fa,_0x54feb2,_0x51fd42){_0x51fd42(null,path[_0x85db('0x11')](config[_0x85db('0x12')],'server/files/plugins'));},'filename':function(_0x11ac68,_0x541f2f,_0x437f7a){_0x541f2f[_0x85db('0x13')]=_0x541f2f[_0x85db('0x13')][_0x85db('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x437f7a(null,util[_0x85db('0x15')](_0x85db('0x16'),path[_0x85db('0x17')](_0x541f2f[_0x85db('0x13')],path[_0x85db('0x18')](_0x541f2f[_0x85db('0x13')])),Date[_0x85db('0x19')](),path[_0x85db('0x18')](_0x541f2f[_0x85db('0x13')])));}})});router['post']('/',upload[_0x85db('0x1a')](_0x85db('0x1b')),controller[_0x85db('0x1c')]);router[_0x85db('0x1d')](_0x85db('0xa'),controller[_0x85db('0x1e')]);router[_0x85db('0x1f')]('/:id',auth[_0x85db('0x9')](),controller[_0x85db('0x20')]);router[_0x85db('0x21')](_0x85db('0xc'),auth[_0x85db('0x9')](),controller[_0x85db('0x21')]);module[_0x85db('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 74c22db..4343a68 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 _0x633a=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x39dbbf,_0x1f8319){var _0x3e5f9a=function(_0x8c94a9){while(--_0x8c94a9){_0x39dbbf['push'](_0x39dbbf['shift']());}};_0x3e5f9a(++_0x1f8319);}(_0x633a,0x11c));var _0xa633=function(_0xabca41,_0xbfdf4a){_0xabca41=_0xabca41-0x0;var _0x404ccb=_0x633a[_0xabca41];return _0x404ccb;};'use strict';var Sequelize=require(_0xa633('0x0'));module['exports']={'name':{'type':Sequelize[_0xa633('0x1')]},'type':{'type':Sequelize[_0xa633('0x2')](_0xa633('0x3'),_0xa633('0x4'))},'description':{'type':Sequelize[_0xa633('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xa633('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa633('0x7')},'sidebar':{'type':Sequelize[_0xa633('0x2')](_0xa633('0x8'),_0xa633('0x9'),_0xa633('0xa'),_0xa633('0xb')),'defaultValue':_0xa633('0xa'),'comment':_0xa633('0xc')},'icon':{'type':Sequelize[_0xa633('0x1')]},'adminUrl':{'type':Sequelize[_0xa633('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xa633('0x1')]},'scriptPath':{'type':Sequelize[_0xa633('0x1')]}}; \ No newline at end of file +var _0x4983=['adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x448336,_0x20ac96){var _0x4628b2=function(_0x2c2767){while(--_0x2c2767){_0x448336['push'](_0x448336['shift']());}};_0x4628b2(++_0x20ac96);}(_0x4983,0xb8));var _0x3498=function(_0x522162,_0x301a55){_0x522162=_0x522162-0x0;var _0x363516=_0x4983[_0x522162];return _0x363516;};'use strict';var Sequelize=require(_0x3498('0x0'));module[_0x3498('0x1')]={'name':{'type':Sequelize[_0x3498('0x2')]},'type':{'type':Sequelize[_0x3498('0x3')](_0x3498('0x4'),'script')},'description':{'type':Sequelize[_0x3498('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x3498('0x2')],'comment':_0x3498('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3498('0x7')},'sidebar':{'type':Sequelize[_0x3498('0x3')](_0x3498('0x8'),'agentOnly',_0x3498('0x9'),_0x3498('0xa')),'defaultValue':'always','comment':_0x3498('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x3498('0x2')]},'scriptPath':{'type':Sequelize[_0x3498('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index bf479bc..61c6d5e 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 _0x25fd=['info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','version','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','statusCode','sendStatus','webhookPost','resolve','method','%s%s','eml-format','rimraf','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','Plugins','UserProfileResource','destroy','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','find','catch','download','path','join','root','server/files/plugins','%s.zip','createWriteStream','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','basename','node_modules/**/*','finalize','close','format','Error','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed'];(function(_0xbef352,_0x5a4fc5){var _0x1352c1=function(_0x2d6716){while(--_0x2d6716){_0xbef352['push'](_0xbef352['shift']());}};_0x1352c1(++_0x5a4fc5);}(_0x25fd,0x185));var _0xd25f=function(_0x1fb394,_0xd1497){_0x1fb394=_0x1fb394-0x0;var _0x3c35cc=_0x25fd[_0x1fb394];return _0x3c35cc;};'use strict';var emlformat=require(_0xd25f('0x0'));var rimraf=require(_0xd25f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd25f('0x2'));var rp=require(_0xd25f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd25f('0x4'));var csv=require(_0xd25f('0x5'));var ejs=require(_0xd25f('0x6'));var fs=require('fs');var fs_extra=require(_0xd25f('0x7'));var _=require(_0xd25f('0x8'));var squel=require(_0xd25f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd25f('0x5'));var querystring=require(_0xd25f('0xa'));var Papa=require('papaparse');var extract=require(_0xd25f('0xb'));var rimraf=require(_0xd25f('0x1'));var archiver=require(_0xd25f('0xc'));var Redis=require(_0xd25f('0xd'));var authService=require(_0xd25f('0xe'));var qs=require(_0xd25f('0xf'));var as=require(_0xd25f('0x10'));var hardwareService=require(_0xd25f('0x11'));var logger=require(_0xd25f('0x12'))('api');var utils=require(_0xd25f('0x13'));var config=require(_0xd25f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd25f('0x15'))['db'];config[_0xd25f('0x16')]=_[_0xd25f('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd25f('0x18'))(new Redis(config[_0xd25f('0x16')]));require(_0xd25f('0x19'))[_0xd25f('0x1a')](socket);function respondWithStatusCode(_0x37930f,_0x283071){_0x283071=_0x283071||0xcc;return function(_0x47d97b){if(_0x47d97b){return _0x37930f['sendStatus'](_0x283071);}return _0x37930f[_0xd25f('0x1b')](_0x283071)[_0xd25f('0x1c')]();};}function respondWithResult(_0x1f8643,_0xc71fa8){_0xc71fa8=_0xc71fa8||0xc8;return function(_0x330efe){if(_0x330efe){return _0x1f8643[_0xd25f('0x1b')](_0xc71fa8)[_0xd25f('0x1d')](_0x330efe);}};}function respondWithFilteredResult(_0x40fca9,_0x506103){return function(_0x4ae66c){if(_0x4ae66c){var _0x5df08c=typeof _0x506103[_0xd25f('0x1e')]===_0xd25f('0x1f')&&typeof _0x506103[_0xd25f('0x20')]===_0xd25f('0x1f');var _0x3c4586=_0x4ae66c[_0xd25f('0x21')];var _0x2d9eeb=_0x5df08c?0x0:_0x506103[_0xd25f('0x1e')];var _0x53a93d=_0x5df08c?_0x4ae66c[_0xd25f('0x21')]:_0x506103[_0xd25f('0x1e')]+_0x506103[_0xd25f('0x20')];var _0x2098f5;if(_0x53a93d>=_0x3c4586){_0x53a93d=_0x3c4586;_0x2098f5=0xc8;}else{_0x2098f5=0xce;}_0x40fca9[_0xd25f('0x1b')](_0x2098f5);return _0x40fca9[_0xd25f('0x22')](_0xd25f('0x23'),_0x2d9eeb+'-'+_0x53a93d+'/'+_0x3c4586)[_0xd25f('0x1d')](_0x4ae66c);}return null;};}function patchUpdates(_0xbe1f6b){return function(_0x269d2c){try{jsonpatch['apply'](_0x269d2c,_0xbe1f6b,!![]);}catch(_0x2de935){return BPromise[_0xd25f('0x24')](_0x2de935);}return _0x269d2c[_0xd25f('0x25')]();};}function saveUpdates(_0x152849,_0x1a5b24){return function(_0x29b6f2){if(_0x29b6f2){return _0x29b6f2[_0xd25f('0x26')](_0x152849)[_0xd25f('0x27')](function(_0x569baa){return _0x569baa;});}return null;};}function removeEntity(_0xb2bf4a,_0x1ac8d7){return function(_0x465f13){if(_0x465f13){return _0x465f13['destroy']()[_0xd25f('0x27')](function(){var _0x2751ca=_0x465f13['get']({'plain':!![]});var _0x9d967d=_0xd25f('0x28');return db[_0xd25f('0x29')][_0xd25f('0x2a')]({'where':{'type':_0x9d967d,'resourceId':_0x2751ca['id']}})[_0xd25f('0x27')](function(){return _0x465f13;});})[_0xd25f('0x27')](function(){_0xb2bf4a[_0xd25f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed51c4,_0x4dfac4){return function(_0x58c23d){if(!_0x58c23d){_0xed51c4['sendStatus'](0x194);}return _0x58c23d;};}function handleError(_0x4d2f85,_0x3c4024){_0x3c4024=_0x3c4024||0x1f4;return function(_0x26669e){logger[_0xd25f('0x2b')](_0x26669e['stack']);if(_0x26669e[_0xd25f('0x2c')]){delete _0x26669e[_0xd25f('0x2c')];}_0x4d2f85[_0xd25f('0x1b')](_0x3c4024)[_0xd25f('0x2d')](_0x26669e);};}exports[_0xd25f('0x2e')]=function(_0x2b4db9,_0x30c567){var _0xb3ae04={},_0x1d647f={},_0x2def76={'count':0x0,'rows':[]};var _0x844c37=_[_0xd25f('0x2f')](db[_0xd25f('0x30')][_0xd25f('0x31')],function(_0x575928){return{'name':_0x575928[_0xd25f('0x32')],'type':_0x575928[_0xd25f('0x33')][_0xd25f('0x34')]};});_0x1d647f[_0xd25f('0x35')]=_[_0xd25f('0x2f')](_0x844c37,_0xd25f('0x2c'));_0x1d647f[_0xd25f('0x36')]=_[_0xd25f('0x37')](_0x2b4db9[_0xd25f('0x36')]);_0x1d647f[_0xd25f('0x38')]=_[_0xd25f('0x39')](_0x1d647f[_0xd25f('0x35')],_0x1d647f[_0xd25f('0x36')]);_0xb3ae04[_0xd25f('0x3a')]=_[_0xd25f('0x39')](_0x1d647f[_0xd25f('0x35')],qs['fields'](_0x2b4db9['query'][_0xd25f('0x3b')]));_0xb3ae04['attributes']=_0xb3ae04[_0xd25f('0x3a')][_0xd25f('0x3c')]?_0xb3ae04['attributes']:_0x1d647f[_0xd25f('0x35')];if(!_0x2b4db9[_0xd25f('0x36')][_0xd25f('0x3d')]('nolimit')){_0xb3ae04[_0xd25f('0x20')]=qs['limit'](_0x2b4db9['query']['limit']);_0xb3ae04[_0xd25f('0x1e')]=qs['offset'](_0x2b4db9[_0xd25f('0x36')][_0xd25f('0x1e')]);}_0xb3ae04[_0xd25f('0x3e')]=qs[_0xd25f('0x3f')](_0x2b4db9[_0xd25f('0x36')]['sort']);_0xb3ae04[_0xd25f('0x40')]=qs[_0xd25f('0x38')](_[_0xd25f('0x41')](_0x2b4db9[_0xd25f('0x36')],_0x1d647f[_0xd25f('0x38')]),_0x844c37);if(_0x2b4db9[_0xd25f('0x36')][_0xd25f('0x42')]){_0xb3ae04['where']=_[_0xd25f('0x43')](_0xb3ae04[_0xd25f('0x40')],{'$or':_[_0xd25f('0x2f')](_0x844c37,function(_0x4231c6){if(_0x4231c6['type']!==_0xd25f('0x44')){var _0x103577={};_0x103577[_0x4231c6[_0xd25f('0x2c')]]={'$like':'%'+_0x2b4db9[_0xd25f('0x36')][_0xd25f('0x42')]+'%'};return _0x103577;}})});}_0xb3ae04=_[_0xd25f('0x43')]({},_0xb3ae04,_0x2b4db9['options']);var _0x1c8970={'where':_0xb3ae04[_0xd25f('0x40')]};return db[_0xd25f('0x30')][_0xd25f('0x21')](_0x1c8970)[_0xd25f('0x27')](function(_0x23196b){_0x2def76['count']=_0x23196b;if(_0x2b4db9[_0xd25f('0x36')][_0xd25f('0x45')]){_0xb3ae04[_0xd25f('0x46')]=[{'all':!![]}];}return db[_0xd25f('0x30')][_0xd25f('0x47')](_0xb3ae04);})['then'](function(_0xcd7ec6){_0x2def76['rows']=_0xcd7ec6;return _0x2def76;})[_0xd25f('0x27')](respondWithFilteredResult(_0x30c567,_0xb3ae04))['catch'](handleError(_0x30c567,null));};exports[_0xd25f('0x48')]=function(_0xac9008,_0x5b7dcc){var _0x255d34={'raw':!![],'where':{'id':_0xac9008[_0xd25f('0x49')]['id']}},_0x488f38={};_0x488f38['model']=_[_0xd25f('0x37')](db[_0xd25f('0x30')]['rawAttributes']);_0x488f38['query']=_['keys'](_0xac9008['query']);_0x488f38['filters']=_[_0xd25f('0x39')](_0x488f38['model'],_0x488f38[_0xd25f('0x36')]);_0x255d34[_0xd25f('0x3a')]=_[_0xd25f('0x39')](_0x488f38[_0xd25f('0x35')],qs[_0xd25f('0x3b')](_0xac9008[_0xd25f('0x36')][_0xd25f('0x3b')]));_0x255d34['attributes']=_0x255d34['attributes']['length']?_0x255d34[_0xd25f('0x3a')]:_0x488f38[_0xd25f('0x35')];if(_0xac9008['query'][_0xd25f('0x45')]){_0x255d34[_0xd25f('0x46')]=[{'all':!![]}];}_0x255d34=_[_0xd25f('0x43')]({},_0x255d34,_0xac9008['options']);return db[_0xd25f('0x30')][_0xd25f('0x4a')](_0x255d34)['then'](handleEntityNotFound(_0x5b7dcc,null))[_0xd25f('0x27')](respondWithResult(_0x5b7dcc,null))[_0xd25f('0x4b')](handleError(_0x5b7dcc,null));};exports[_0xd25f('0x4c')]=function(_0x734a99,_0x5e27b9,_0xeb926c){return db[_0xd25f('0x30')][_0xd25f('0x4a')]({'where':{'id':_0x734a99[_0xd25f('0x49')]['id']},'attributes':[_0xd25f('0x2c'),_0xd25f('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x5e27b9,null))[_0xd25f('0x27')](function(_0x3d68ee){if(_0x3d68ee){var _0x5ec6e9=path[_0xd25f('0x4e')](config[_0xd25f('0x4f')],_0xd25f('0x50'),util['format'](_0xd25f('0x51'),path['basename'](_0x3d68ee[_0xd25f('0x4d')])));var _0x30e0ce=fs[_0xd25f('0x52')](_0x5ec6e9);var _0x3d0103=archiver('zip',{'zlib':{'level':0x9}});_0x3d0103['on'](_0xd25f('0x53'),function(_0x16abc9){if(_0x16abc9[_0xd25f('0x54')]===_0xd25f('0x55')){logger[_0xd25f('0x2b')](_0x16abc9);}else{throw new db[(_0xd25f('0x56'))]['Error'](_0xd25f('0x57'));}});_0x3d0103['on'](_0xd25f('0x2b'),function(_0x3e6d4c){throw new db[(_0xd25f('0x56'))]['Error'](_0xd25f('0x57'));});_0x3d0103[_0xd25f('0x58')](_0x30e0ce);_0x3d0103[_0xd25f('0x59')](_0xd25f('0x5a'),{'cwd':path[_0xd25f('0x4e')](config[_0xd25f('0x4f')],'server/files/plugins',path['dirname'](_0x3d68ee[_0xd25f('0x4d')])),'ignore':[path['join'](path[_0xd25f('0x5b')](_0x3d68ee[_0xd25f('0x4d')]),_0xd25f('0x5c')),path[_0xd25f('0x4e')](path[_0xd25f('0x5b')](_0x3d68ee[_0xd25f('0x4d')]),'attachments/**/*')],'nodir':!![]})[_0xd25f('0x5d')]();_0x30e0ce['on'](_0xd25f('0x5e'),function(){if(!fs['existsSync'](_0x5ec6e9)){throw new db[(_0xd25f('0x56'))]['Error']('Plugin\x20not\x20found');}return _0x5e27b9[_0xd25f('0x4c')](_0x5ec6e9,util[_0xd25f('0x5f')](_0xd25f('0x51'),path['basename'](_0x3d68ee[_0xd25f('0x4d')])),function(_0x1dd06a){if(_0x1dd06a){throw new db[(_0xd25f('0x56'))][(_0xd25f('0x60'))](_0xd25f('0x61'));}fs[_0xd25f('0x62')](_0x5ec6e9);logger['info'](_0xd25f('0x63'));logger[_0xd25f('0x64')](_0xd25f('0x65'));});});}return null;})[_0xd25f('0x4b')](handleError(_0x5e27b9,null));};exports[_0xd25f('0x66')]=function(_0x4c0d4f,_0x1d7e43,_0xcfb73f){var _0x89f4b1=path[_0xd25f('0x5b')](_0x4c0d4f[_0xd25f('0x67')][_0xd25f('0x68')],path[_0xd25f('0x69')](_0x4c0d4f[_0xd25f('0x67')]['filename']));var _0xb66d07=path[_0xd25f('0x4e')](config[_0xd25f('0x4f')],'server/files/plugins',_0x4c0d4f[_0xd25f('0x67')]['filename']);var _0x4179be=path[_0xd25f('0x4e')](config[_0xd25f('0x4f')],_0xd25f('0x50'),_0x89f4b1);logger[_0xd25f('0x64')](_0xd25f('0x6a'),_0xb66d07);logger['info'](_0xd25f('0x6b'),_0x4179be);try{fs[_0xd25f('0x6c')](_0xb66d07,parseInt(_0xd25f('0x6d'),0x8));extract(_0xb66d07,{'dir':_0x4179be},function(_0x1d473d){if(_0x1d473d){logger[_0xd25f('0x2b')](_0x1d473d);handleError(_0x1d473d,!![]);};var _0x3eb025=fs[_0xd25f('0x6e')](_0x4179be);if(_0x3eb025['length']>0x1){removeReferences(_0xb66d07,_0x4179be);logger['error']('Invalid\x20plugin\x20structure');return _0xcfb73f(new Error(_0xd25f('0x6f')));}var _0x5bb67f=fs[_0xd25f('0x70')](path[_0xd25f('0x4e')](_0x4179be,_0x3eb025[0x0]));if(_0x5bb67f[_0xd25f('0x71')]()){removeReferences(_0xb66d07,_0x4179be);logger[_0xd25f('0x2b')]('Invalid\x20plugin\x20structure');return _0xcfb73f(new Error(_0xd25f('0x6f')));}if(_0x5bb67f['isDirectory']()){var _0x33b364=fs['readdirSync'](path['join'](_0x4179be,_0x3eb025[0x0]));if(_0x33b364['length']===0x0){removeReferences(_0xb66d07,_0x4179be);logger[_0xd25f('0x2b')]('Invalid\x20plugin\x20structure');return _0xcfb73f(new Error(_0xd25f('0x6f')));}var _0x2ece4d=_0x33b364[_0xd25f('0x72')](function(_0x173a92){return _0x173a92===_0xd25f('0x73');});if(!_0x2ece4d){return _0xcfb73f(new Error('Plugin\x20manifest\x20missing'));}var _0x1a8a9d=fs[_0xd25f('0x74')](path[_0xd25f('0x4e')](_0x4179be,_0x3eb025[0x0],_0xd25f('0x73')));var _0x23b2da=JSON['parse'](_0x1a8a9d);if(_0xd25f('0x1f')==typeof _0x23b2da[_0xd25f('0x2c')]){return _0xcfb73f(new Error(_0xd25f('0x75')));}if(_0xd25f('0x1f')==typeof _0x23b2da[_0xd25f('0x33')]){return _0xcfb73f(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x23b2da['version']){return _0xcfb73f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xd25f('0x1f')==typeof _0x23b2da['parameters']){return _0xcfb73f(new Error(_0xd25f('0x76')));}if(_0x23b2da[_0xd25f('0x33')]===_0xd25f('0x77')){if(_0xd25f('0x1f')==typeof _0x23b2da[_0xd25f('0x78')][_0xd25f('0x79')]){return _0xcfb73f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xd25f('0x1f')==typeof _0x23b2da[_0xd25f('0x78')][_0xd25f('0x79')][_0xd25f('0x7a')]&&'undefined'==typeof _0x23b2da[_0xd25f('0x78')][_0xd25f('0x79')][_0xd25f('0x7b')]){return _0xcfb73f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x23b2da[_0xd25f('0x33')]===_0xd25f('0x7c')){if(_0xd25f('0x1f')==typeof _0x23b2da[_0xd25f('0x78')][_0xd25f('0x7d')]){return _0xcfb73f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xd25f('0x1f')==typeof _0x23b2da[_0xd25f('0x78')][_0xd25f('0x7e')]){return _0xcfb73f(new Error(_0xd25f('0x7f')));}}else{return _0xcfb73f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5926ff=_0x23b2da['name'];var _0x1e30e7=_0x23b2da[_0xd25f('0x80')];var _0x2537b1=_0x23b2da['type'];var _0x546e03=_0x23b2da[_0xd25f('0x81')]?_0x23b2da[_0xd25f('0x81')]:'always';var _0x3a2c4b=_0x23b2da[_0xd25f('0x82')]?_0x23b2da[_0xd25f('0x82')]:_0xd25f('0x83');var _0x364dfd='';var _0x4715fb='';var _0x91cdf0='';var _0x1b6b22='';var _0x1d2f84=_0x23b2da[_0xd25f('0x84')];if(_0x2537b1===_0xd25f('0x77')){if(_0xd25f('0x1f')!=typeof _0x23b2da[_0xd25f('0x78')]['views']['admin']){var _0x276e48=_0x23b2da[_0xd25f('0x78')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x276e48)){_0x364dfd=path[_0xd25f('0x4e')](_0xd25f('0x85'),_0x89f4b1,_0x3eb025[0x0],_0x276e48);}else{_0x364dfd=_0x276e48;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xd25f('0x1f')!=typeof _0x23b2da['parameters']['views']['agent']){var _0x536159=_0x23b2da['parameters'][_0xd25f('0x79')][_0xd25f('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xd25f('0x86')](_0x536159)){_0x4715fb=path[_0xd25f('0x4e')](_0xd25f('0x85'),_0x89f4b1,_0x3eb025[0x0],_0x536159);}else{_0x4715fb=_0x536159;}}else{logger['info'](_0xd25f('0x87'));}}else if(_0x2537b1===_0xd25f('0x7c')){_0x91cdf0=_0x23b2da['parameters'][_0xd25f('0x7d')];_0x1b6b22=_0x23b2da[_0xd25f('0x78')][_0xd25f('0x7e')];if(_0xd25f('0x1f')!=typeof _0x23b2da[_0xd25f('0x78')]['views']){if(_0xd25f('0x1f')!=typeof _0x23b2da['parameters'][_0xd25f('0x79')]['admin']){var _0x276e48=_0x23b2da[_0xd25f('0x78')][_0xd25f('0x79')][_0xd25f('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xd25f('0x86')](_0x276e48)){_0x364dfd=path[_0xd25f('0x4e')](_0xd25f('0x85'),_0x89f4b1,_0x3eb025[0x0],_0x276e48);}else{_0x364dfd=_0x276e48;}}if(_0xd25f('0x1f')!=typeof _0x23b2da[_0xd25f('0x78')][_0xd25f('0x79')]['agent']){var _0x536159=_0x23b2da['parameters']['views'][_0xd25f('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xd25f('0x86')](_0x536159)){_0x4715fb=path[_0xd25f('0x4e')](_0xd25f('0x85'),_0x89f4b1,_0x3eb025[0x0],_0x536159);}else{_0x4715fb=_0x536159;}}}}var _0x459727={'name':_0x5926ff,'description':_0x1e30e7,'path':path[_0xd25f('0x4e')](_0x89f4b1,_0x3eb025[0x0]),'type':_0x2537b1,'sidebar':_0x546e03,'icon':_0x3a2c4b,'adminUrl':_0x364dfd,'agentUrl':_0x4715fb,'scriptName':_0x91cdf0,'scriptPath':_0x1b6b22,'version':_0x1d2f84};removeReferences(_0xb66d07,null);return db['Plugin']['create'](_0x459727)[_0xd25f('0x27')](function(_0x2614ef){var _0x1f8a6c={'role':_0x4c0d4f['body']['role'],'userProfileId':_0x4c0d4f['body'][_0xd25f('0x88')]};if(!_0x1f8a6c)throw new Error(_0xd25f('0x89'));if(_0x1f8a6c[_0xd25f('0x8a')]===_0xd25f('0x8b')){var _0x5a741d=_0x2614ef['get']({'plain':!![]});return db[_0xd25f('0x8c')][_0xd25f('0x4a')]({'where':{'name':'Plugins','userProfileId':_0x1f8a6c['userProfileId']},'raw':!![]})[_0xd25f('0x27')](function(_0x37b7ef){if(_0x37b7ef&&_0x37b7ef[_0xd25f('0x8d')]===0x0){return db[_0xd25f('0x29')]['create']({'name':_0x5a741d['name'],'resourceId':_0x5a741d['id'],'type':_0x37b7ef[_0xd25f('0x2c')],'sectionId':_0x37b7ef['id']},{})[_0xd25f('0x27')](function(){return _0x2614ef;});}else{return _0x2614ef;}})[_0xd25f('0x4b')](function(_0x1fc2d9){logger[_0xd25f('0x2b')](_0xd25f('0x8e'),_0x1fc2d9);throw _0x1fc2d9;});}return _0x2614ef;})[_0xd25f('0x27')](respondWithResult(_0x1d7e43,null))['catch'](handleError(_0x1d7e43,null));}});}catch(_0x1c1392){_0x1d7e43[_0xd25f('0x1b')](0x1f4)[_0xd25f('0x2d')](_0x1c1392);}};function removeReferences(_0x2c3321,_0x26a5a7){try{if(_0x2c3321){fs[_0xd25f('0x62')](_0x2c3321);logger[_0xd25f('0x64')](_0xd25f('0x8f'));}if(_0x26a5a7){rimraf(_0x26a5a7,function(){});logger['info'](_0xd25f('0x90'));}}catch(_0x3acf55){logger[_0xd25f('0x2b')](_0x3acf55);}}exports['update']=function(_0x358cb7,_0x3735bc,_0x6331b4){return db['Plugin']['find']({'where':{'id':_0x358cb7['params']['id']}})['then'](handleEntityNotFound(_0x3735bc,null))['then'](saveUpdates(_0x358cb7[_0xd25f('0x91')],null))[_0xd25f('0x27')](respondWithResult(_0x3735bc,null))[_0xd25f('0x4b')](handleError(_0x3735bc,null));};exports[_0xd25f('0x92')]=function(_0x2da684,_0x326e00,_0x3d1e99){return db[_0xd25f('0x30')][_0xd25f('0x4a')]({'where':{'id':_0x2da684['params']['id']}})['then'](function(_0x2895f8){if(_0x2895f8){return _0x2895f8[_0xd25f('0x2a')]();}})[_0xd25f('0x27')](function(_0x1bc1e0){rimraf(path[_0xd25f('0x4e')](config[_0xd25f('0x4f')],'server/files/plugins',path['dirname'](_0x1bc1e0[_0xd25f('0x4d')])),function(){});return _0x1bc1e0;})['then'](handleEntityNotFound(_0x326e00,null))['then'](respondWithStatusCode(_0x326e00,null))[_0xd25f('0x4b')](handleError(_0x326e00,null));};exports[_0xd25f('0x93')]=function(_0x2c5036,_0x38bf0c,_0x259d0c){return BPromise['resolve']()['then'](function(){if(!_0x2c5036[_0xd25f('0x36')][_0xd25f('0x4d')]){throw new Error(_0xd25f('0x94'));}if(!_0x2c5036[_0xd25f('0x36')][_0xd25f('0x95')]){throw new Error(_0xd25f('0x96'));}var _0x4375be=_0x2c5036[_0xd25f('0x36')][_0xd25f('0x97')]?_0x2c5036['query']['hostname']+':'+_0x2c5036[_0xd25f('0x36')][_0xd25f('0x95')]:_0xd25f('0x98')+_0x2c5036['query'][_0xd25f('0x95')];var _0xb2b428=_0x2c5036[_0xd25f('0x36')][_0xd25f('0x1d')]?_0x2c5036[_0xd25f('0x36')]['json']:!![];var _0x413ced=_0x2c5036[_0xd25f('0x36')][_0xd25f('0x99')]?_0x2c5036[_0xd25f('0x36')][_0xd25f('0x99')]:null;var _0x37fabe={'method':_0x2c5036['method'],'uri':util[_0xd25f('0x5f')]('%s%s',_0x4375be,_0x2c5036[_0xd25f('0x36')][_0xd25f('0x4d')]),'json':_0xb2b428,'resolveWithFullResponse':!![],'encoding':_0x413ced,'qs':_0x2c5036[_0xd25f('0x36')]};if(_0x2c5036[_0xd25f('0x9a')]){_0x37fabe[_0xd25f('0x9a')]=_0x2c5036[_0xd25f('0x9a')];if(_0x37fabe[_0xd25f('0x9a')][_0xd25f('0x9b')]){delete _0x37fabe[_0xd25f('0x9a')][_0xd25f('0x9b')];}}if(_0x37fabe[_0xd25f('0x9a')][_0xd25f('0x9c')]){delete _0x37fabe[_0xd25f('0x9a')]['content-type'];}return rp(_0x37fabe);})[_0xd25f('0x27')](function(_0xad72d6){if(_0xad72d6){_0x38bf0c['set'](_0xad72d6[_0xd25f('0x9a')]);logger['info'](_0xad72d6[_0xd25f('0x91')]);if(_['endsWith'](_0x2c5036['query'][_0xd25f('0x4d')],'download')&&_0xad72d6[_0xd25f('0x9d')]==0x1f4){return _0x38bf0c[_0xd25f('0x9e')](_0xad72d6['statusCode']);}else{return _0x38bf0c['status'](_0xad72d6[_0xd25f('0x9d')])['send'](_0xad72d6[_0xd25f('0x91')]);}}else{return _0x38bf0c[_0xd25f('0x9e')](0xc8);}})[_0xd25f('0x4b')](handleError(_0x38bf0c,null));};exports[_0xd25f('0x9f')]=function(_0x43b708,_0x479e4a,_0x363d0f){return BPromise[_0xd25f('0xa0')]()[_0xd25f('0x27')](function(){if(!_0x43b708[_0xd25f('0x36')][_0xd25f('0x4d')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x43b708[_0xd25f('0x36')]['port']){throw new Error(_0xd25f('0x96'));}var _0x2fcb1c=_0x43b708[_0xd25f('0x36')]['hostname']?_0x43b708[_0xd25f('0x36')][_0xd25f('0x97')]+':'+_0x43b708[_0xd25f('0x36')][_0xd25f('0x95')]:_0xd25f('0x98')+_0x43b708['query'][_0xd25f('0x95')];var _0xa732eb=_0x43b708[_0xd25f('0x36')]['json']?_0x43b708[_0xd25f('0x36')][_0xd25f('0x1d')]:!![];var _0x2eb61b=_0x43b708[_0xd25f('0x36')]['encoding']?_0x43b708[_0xd25f('0x36')][_0xd25f('0x99')]:null;var _0x5263cd={'method':_0x43b708[_0xd25f('0xa1')],'uri':util[_0xd25f('0x5f')](_0xd25f('0xa2'),_0x2fcb1c,_0x43b708[_0xd25f('0x36')][_0xd25f('0x4d')]),'json':_0xa732eb,'resolveWithFullResponse':!![],'encoding':_0x2eb61b,'body':_0x43b708[_0xd25f('0x91')]};if(_0x43b708[_0xd25f('0x9a')]){_0x5263cd[_0xd25f('0x9a')]=_0x43b708['headers'];if(_0x5263cd[_0xd25f('0x9a')][_0xd25f('0x9b')]){delete _0x5263cd[_0xd25f('0x9a')][_0xd25f('0x9b')];}}if(_0x5263cd['headers']['content-type']){delete _0x5263cd[_0xd25f('0x9a')][_0xd25f('0x9c')];}return rp(_0x5263cd);})[_0xd25f('0x27')](function(_0x10bbef){if(_0x10bbef){_0x479e4a[_0xd25f('0x22')](_0x10bbef[_0xd25f('0x9a')]);logger[_0xd25f('0x64')](_0x10bbef[_0xd25f('0x91')]);return _0x479e4a[_0xd25f('0x1b')](_0x10bbef[_0xd25f('0x9d')])[_0xd25f('0x2d')](_0x10bbef['body']);}else{return _0x479e4a[_0xd25f('0x9e')](0xc8);}})['catch'](handleError(_0x479e4a,null));}; \ No newline at end of file +var _0x23cb=['localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Plugins','UserProfileResource','error','name','Plugin','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','find','download','path','join','root','server/files/plugins','format','%s.zip','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','filename','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','description','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','eml-format','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0xf529ba,_0x47f543){var _0xe7e86e=function(_0x14c828){while(--_0x14c828){_0xf529ba['push'](_0xf529ba['shift']());}};_0xe7e86e(++_0x47f543);}(_0x23cb,0x12e));var _0xb23c=function(_0x10d79b,_0x40e651){_0x10d79b=_0x10d79b-0x0;var _0x348f39=_0x23cb[_0x10d79b];return _0x348f39;};'use strict';var emlformat=require(_0xb23c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb23c('0x1'));var moment=require(_0xb23c('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb23c('0x3'));var path=require('path');var sox=require(_0xb23c('0x4'));var csv=require(_0xb23c('0x5'));var ejs=require(_0xb23c('0x6'));var fs=require('fs');var fs_extra=require(_0xb23c('0x7'));var _=require(_0xb23c('0x8'));var squel=require(_0xb23c('0x9'));var crypto=require(_0xb23c('0xa'));var jsforce=require(_0xb23c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb23c('0x5'));var querystring=require(_0xb23c('0xc'));var Papa=require('papaparse');var extract=require(_0xb23c('0xd'));var rimraf=require('rimraf');var archiver=require(_0xb23c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb23c('0xf'));var as=require(_0xb23c('0x10'));var hardwareService=require(_0xb23c('0x11'));var logger=require(_0xb23c('0x12'))(_0xb23c('0x13'));var utils=require(_0xb23c('0x14'));var config=require(_0xb23c('0x15'));var licenseUtil=require(_0xb23c('0x16'));var db=require(_0xb23c('0x17'))['db'];config['redis']=_[_0xb23c('0x18')](config[_0xb23c('0x19')],{'host':_0xb23c('0x1a'),'port':0x18eb});var socket=require(_0xb23c('0x1b'))(new Redis(config[_0xb23c('0x19')]));require(_0xb23c('0x1c'))[_0xb23c('0x1d')](socket);function respondWithStatusCode(_0x3826be,_0x4661ba){_0x4661ba=_0x4661ba||0xcc;return function(_0x2a0981){if(_0x2a0981){return _0x3826be[_0xb23c('0x1e')](_0x4661ba);}return _0x3826be[_0xb23c('0x1f')](_0x4661ba)[_0xb23c('0x20')]();};}function respondWithResult(_0x1c3e49,_0x59a15f){_0x59a15f=_0x59a15f||0xc8;return function(_0x5a79f1){if(_0x5a79f1){return _0x1c3e49['status'](_0x59a15f)[_0xb23c('0x21')](_0x5a79f1);}};}function respondWithFilteredResult(_0x5486f8,_0x544f05){return function(_0x20dfc0){if(_0x20dfc0){var _0x2d63d0=typeof _0x544f05[_0xb23c('0x22')]===_0xb23c('0x23')&&typeof _0x544f05[_0xb23c('0x24')]===_0xb23c('0x23');var _0x19d16e=_0x20dfc0[_0xb23c('0x25')];var _0x327c7a=_0x2d63d0?0x0:_0x544f05[_0xb23c('0x22')];var _0x1ee486=_0x2d63d0?_0x20dfc0[_0xb23c('0x25')]:_0x544f05[_0xb23c('0x22')]+_0x544f05['limit'];var _0x1f8cc3;if(_0x1ee486>=_0x19d16e){_0x1ee486=_0x19d16e;_0x1f8cc3=0xc8;}else{_0x1f8cc3=0xce;}_0x5486f8[_0xb23c('0x1f')](_0x1f8cc3);return _0x5486f8[_0xb23c('0x26')](_0xb23c('0x27'),_0x327c7a+'-'+_0x1ee486+'/'+_0x19d16e)[_0xb23c('0x21')](_0x20dfc0);}return null;};}function patchUpdates(_0x3e49cc){return function(_0x3fe9c2){try{jsonpatch[_0xb23c('0x28')](_0x3fe9c2,_0x3e49cc,!![]);}catch(_0x2c1167){return BPromise['reject'](_0x2c1167);}return _0x3fe9c2[_0xb23c('0x29')]();};}function saveUpdates(_0x2e3440,_0x2f68ee){return function(_0x466ef6){if(_0x466ef6){return _0x466ef6[_0xb23c('0x2a')](_0x2e3440)['then'](function(_0x2b71c2){return _0x2b71c2;});}return null;};}function removeEntity(_0x46a9f6,_0x4dbd6e){return function(_0x10e364){if(_0x10e364){return _0x10e364[_0xb23c('0x2b')]()[_0xb23c('0x2c')](function(){var _0x1fdaca=_0x10e364[_0xb23c('0x2d')]({'plain':!![]});var _0x4c0c04=_0xb23c('0x2e');return db[_0xb23c('0x2f')][_0xb23c('0x2b')]({'where':{'type':_0x4c0c04,'resourceId':_0x1fdaca['id']}})[_0xb23c('0x2c')](function(){return _0x10e364;});})['then'](function(){_0x46a9f6['status'](0xcc)[_0xb23c('0x20')]();});}};}function handleEntityNotFound(_0x14123f,_0xe8aea){return function(_0xba6dc0){if(!_0xba6dc0){_0x14123f['sendStatus'](0x194);}return _0xba6dc0;};}function handleError(_0x488348,_0x84beba){_0x84beba=_0x84beba||0x1f4;return function(_0x5f4c71){logger[_0xb23c('0x30')](_0x5f4c71['stack']);if(_0x5f4c71[_0xb23c('0x31')]){delete _0x5f4c71['name'];}_0x488348[_0xb23c('0x1f')](_0x84beba)['send'](_0x5f4c71);};}exports['index']=function(_0x244cc6,_0x302c57){var _0x523153={},_0x1599d6={},_0x1cb65a={'count':0x0,'rows':[]};var _0x4e296c=_['map'](db[_0xb23c('0x32')][_0xb23c('0x33')],function(_0x2e1a05){return{'name':_0x2e1a05['fieldName'],'type':_0x2e1a05[_0xb23c('0x34')][_0xb23c('0x35')]};});_0x1599d6[_0xb23c('0x36')]=_[_0xb23c('0x37')](_0x4e296c,_0xb23c('0x31'));_0x1599d6['query']=_[_0xb23c('0x38')](_0x244cc6['query']);_0x1599d6[_0xb23c('0x39')]=_[_0xb23c('0x3a')](_0x1599d6[_0xb23c('0x36')],_0x1599d6[_0xb23c('0x3b')]);_0x523153[_0xb23c('0x3c')]=_['intersection'](_0x1599d6[_0xb23c('0x36')],qs[_0xb23c('0x3d')](_0x244cc6['query'][_0xb23c('0x3d')]));_0x523153[_0xb23c('0x3c')]=_0x523153[_0xb23c('0x3c')][_0xb23c('0x3e')]?_0x523153['attributes']:_0x1599d6[_0xb23c('0x36')];if(!_0x244cc6['query'][_0xb23c('0x3f')](_0xb23c('0x40'))){_0x523153[_0xb23c('0x24')]=qs[_0xb23c('0x24')](_0x244cc6[_0xb23c('0x3b')][_0xb23c('0x24')]);_0x523153[_0xb23c('0x22')]=qs[_0xb23c('0x22')](_0x244cc6[_0xb23c('0x3b')][_0xb23c('0x22')]);}_0x523153['order']=qs[_0xb23c('0x41')](_0x244cc6[_0xb23c('0x3b')]['sort']);_0x523153[_0xb23c('0x42')]=qs[_0xb23c('0x39')](_[_0xb23c('0x43')](_0x244cc6[_0xb23c('0x3b')],_0x1599d6[_0xb23c('0x39')]),_0x4e296c);if(_0x244cc6[_0xb23c('0x3b')][_0xb23c('0x44')]){_0x523153[_0xb23c('0x42')]=_[_0xb23c('0x45')](_0x523153[_0xb23c('0x42')],{'$or':_[_0xb23c('0x37')](_0x4e296c,function(_0x53c075){if(_0x53c075['type']!==_0xb23c('0x46')){var _0x3181ee={};_0x3181ee[_0x53c075[_0xb23c('0x31')]]={'$like':'%'+_0x244cc6[_0xb23c('0x3b')][_0xb23c('0x44')]+'%'};return _0x3181ee;}})});}_0x523153=_[_0xb23c('0x45')]({},_0x523153,_0x244cc6['options']);var _0x3add73={'where':_0x523153['where']};return db[_0xb23c('0x32')][_0xb23c('0x25')](_0x3add73)['then'](function(_0x45273a){_0x1cb65a[_0xb23c('0x25')]=_0x45273a;if(_0x244cc6[_0xb23c('0x3b')]['includeAll']){_0x523153[_0xb23c('0x47')]=[{'all':!![]}];}return db[_0xb23c('0x32')][_0xb23c('0x48')](_0x523153);})[_0xb23c('0x2c')](function(_0x5c135d){_0x1cb65a[_0xb23c('0x49')]=_0x5c135d;return _0x1cb65a;})['then'](respondWithFilteredResult(_0x302c57,_0x523153))[_0xb23c('0x4a')](handleError(_0x302c57,null));};exports[_0xb23c('0x4b')]=function(_0x3064ae,_0x2eb678){var _0x4dffa9={'raw':!![],'where':{'id':_0x3064ae[_0xb23c('0x4c')]['id']}},_0x24ba1b={};_0x24ba1b[_0xb23c('0x36')]=_[_0xb23c('0x38')](db['Plugin'][_0xb23c('0x33')]);_0x24ba1b[_0xb23c('0x3b')]=_[_0xb23c('0x38')](_0x3064ae[_0xb23c('0x3b')]);_0x24ba1b[_0xb23c('0x39')]=_['intersection'](_0x24ba1b[_0xb23c('0x36')],_0x24ba1b['query']);_0x4dffa9[_0xb23c('0x3c')]=_[_0xb23c('0x3a')](_0x24ba1b[_0xb23c('0x36')],qs[_0xb23c('0x3d')](_0x3064ae[_0xb23c('0x3b')][_0xb23c('0x3d')]));_0x4dffa9[_0xb23c('0x3c')]=_0x4dffa9[_0xb23c('0x3c')][_0xb23c('0x3e')]?_0x4dffa9[_0xb23c('0x3c')]:_0x24ba1b[_0xb23c('0x36')];if(_0x3064ae[_0xb23c('0x3b')]['includeAll']){_0x4dffa9[_0xb23c('0x47')]=[{'all':!![]}];}_0x4dffa9=_[_0xb23c('0x45')]({},_0x4dffa9,_0x3064ae['options']);return db[_0xb23c('0x32')][_0xb23c('0x4d')](_0x4dffa9)['then'](handleEntityNotFound(_0x2eb678,null))[_0xb23c('0x2c')](respondWithResult(_0x2eb678,null))['catch'](handleError(_0x2eb678,null));};exports[_0xb23c('0x4e')]=function(_0x65da22,_0x26444f,_0x419d62){return db[_0xb23c('0x32')][_0xb23c('0x4d')]({'where':{'id':_0x65da22[_0xb23c('0x4c')]['id']},'attributes':['name',_0xb23c('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x26444f,null))[_0xb23c('0x2c')](function(_0x1636f2){if(_0x1636f2){var _0x4ee7bc=path[_0xb23c('0x50')](config[_0xb23c('0x51')],_0xb23c('0x52'),util[_0xb23c('0x53')](_0xb23c('0x54'),path[_0xb23c('0x55')](_0x1636f2[_0xb23c('0x4f')])));var _0x549761=fs['createWriteStream'](_0x4ee7bc);var _0x706583=archiver('zip',{'zlib':{'level':0x9}});_0x706583['on'](_0xb23c('0x56'),function(_0x2f2bb1){if(_0x2f2bb1[_0xb23c('0x57')]===_0xb23c('0x58')){logger[_0xb23c('0x30')](_0x2f2bb1);}else{throw new db[(_0xb23c('0x59'))][(_0xb23c('0x5a'))](_0xb23c('0x5b'));}});_0x706583['on'](_0xb23c('0x30'),function(_0x580778){throw new db['Sequelize'][(_0xb23c('0x5a'))](_0xb23c('0x5b'));});_0x706583[_0xb23c('0x5c')](_0x549761);_0x706583[_0xb23c('0x5d')](_0xb23c('0x5e'),{'cwd':path['join'](config[_0xb23c('0x51')],_0xb23c('0x52'),path[_0xb23c('0x5f')](_0x1636f2[_0xb23c('0x4f')])),'ignore':[path['join'](path[_0xb23c('0x55')](_0x1636f2[_0xb23c('0x4f')]),_0xb23c('0x60')),path[_0xb23c('0x50')](path[_0xb23c('0x55')](_0x1636f2['path']),_0xb23c('0x61'))],'nodir':!![]})['finalize']();_0x549761['on'](_0xb23c('0x62'),function(){if(!fs['existsSync'](_0x4ee7bc)){throw new db[(_0xb23c('0x59'))][(_0xb23c('0x5a'))](_0xb23c('0x63'));}return _0x26444f[_0xb23c('0x4e')](_0x4ee7bc,util['format']('%s.zip',path[_0xb23c('0x55')](_0x1636f2[_0xb23c('0x4f')])),function(_0xeda1ce){if(_0xeda1ce){throw new db[(_0xb23c('0x59'))][(_0xb23c('0x5a'))](_0xb23c('0x64'));}fs['unlinkSync'](_0x4ee7bc);logger[_0xb23c('0x65')](_0xb23c('0x66'));logger['info'](_0xb23c('0x67'));});});}return null;})['catch'](handleError(_0x26444f,null));};exports['upload']=function(_0x44620d,_0x2e9a39,_0x2abb1e){var _0x243f32=path['basename'](_0x44620d['file'][_0xb23c('0x68')],path['extname'](_0x44620d[_0xb23c('0x69')][_0xb23c('0x68')]));var _0x7b82ca=path[_0xb23c('0x50')](config[_0xb23c('0x51')],_0xb23c('0x52'),_0x44620d[_0xb23c('0x69')][_0xb23c('0x68')]);var _0x49fc9e=path[_0xb23c('0x50')](config['root'],_0xb23c('0x52'),_0x243f32);logger[_0xb23c('0x65')](_0xb23c('0x6a'),_0x7b82ca);logger[_0xb23c('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x49fc9e);try{fs[_0xb23c('0x6b')](_0x7b82ca,parseInt(_0xb23c('0x6c'),0x8));extract(_0x7b82ca,{'dir':_0x49fc9e},function(_0x3d7b89){if(_0x3d7b89){logger[_0xb23c('0x30')](_0x3d7b89);handleError(_0x3d7b89,!![]);};var _0x285818=fs['readdirSync'](_0x49fc9e);if(_0x285818[_0xb23c('0x3e')]>0x1){removeReferences(_0x7b82ca,_0x49fc9e);logger[_0xb23c('0x30')](_0xb23c('0x6d'));return _0x2abb1e(new Error(_0xb23c('0x6d')));}var _0x3b5f3b=fs[_0xb23c('0x6e')](path[_0xb23c('0x50')](_0x49fc9e,_0x285818[0x0]));if(_0x3b5f3b['isFile']()){removeReferences(_0x7b82ca,_0x49fc9e);logger[_0xb23c('0x30')](_0xb23c('0x6d'));return _0x2abb1e(new Error(_0xb23c('0x6d')));}if(_0x3b5f3b[_0xb23c('0x6f')]()){var _0x1c4ac1=fs[_0xb23c('0x70')](path[_0xb23c('0x50')](_0x49fc9e,_0x285818[0x0]));if(_0x1c4ac1['length']===0x0){removeReferences(_0x7b82ca,_0x49fc9e);logger[_0xb23c('0x30')](_0xb23c('0x6d'));return _0x2abb1e(new Error('Invalid\x20plugin\x20structure'));}var _0x3b6ecb=_0x1c4ac1[_0xb23c('0x71')](function(_0x5ac7ba){return _0x5ac7ba==='manifest.json';});if(!_0x3b6ecb){return _0x2abb1e(new Error(_0xb23c('0x72')));}var _0x25b546=fs[_0xb23c('0x73')](path[_0xb23c('0x50')](_0x49fc9e,_0x285818[0x0],'manifest.json'));var _0x46e223=JSON['parse'](_0x25b546);if('undefined'==typeof _0x46e223[_0xb23c('0x31')]){return _0x2abb1e(new Error(_0xb23c('0x74')));}if(_0xb23c('0x23')==typeof _0x46e223[_0xb23c('0x34')]){return _0x2abb1e(new Error(_0xb23c('0x75')));}if(_0xb23c('0x23')==typeof _0x46e223['version']){return _0x2abb1e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb23c('0x23')==typeof _0x46e223[_0xb23c('0x76')]){return _0x2abb1e(new Error(_0xb23c('0x77')));}if(_0x46e223[_0xb23c('0x34')]===_0xb23c('0x78')){if(_0xb23c('0x23')==typeof _0x46e223[_0xb23c('0x76')][_0xb23c('0x79')]){return _0x2abb1e(new Error(_0xb23c('0x7a')));}if(_0xb23c('0x23')==typeof _0x46e223[_0xb23c('0x76')][_0xb23c('0x79')][_0xb23c('0x7b')]&&_0xb23c('0x23')==typeof _0x46e223['parameters'][_0xb23c('0x79')][_0xb23c('0x7c')]){return _0x2abb1e(new Error(_0xb23c('0x7d')));}}else if(_0x46e223[_0xb23c('0x34')]===_0xb23c('0x7e')){if(_0xb23c('0x23')==typeof _0x46e223[_0xb23c('0x76')]['scriptName']){return _0x2abb1e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb23c('0x23')==typeof _0x46e223['parameters'][_0xb23c('0x7f')]){return _0x2abb1e(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2abb1e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4760c6=_0x46e223['name'];var _0x1e1abc=_0x46e223[_0xb23c('0x80')];var _0xcd4339=_0x46e223['type'];var _0x41408b=_0x46e223['sidebar']?_0x46e223['sidebar']:_0xb23c('0x81');var _0x209a4b=_0x46e223[_0xb23c('0x82')]?_0x46e223[_0xb23c('0x82')]:_0xb23c('0x83');var _0x482492='';var _0x41e744='';var _0x1eb2d9='';var _0x156a99='';var _0x2fbfa2=_0x46e223[_0xb23c('0x84')];if(_0xcd4339===_0xb23c('0x78')){if('undefined'!=typeof _0x46e223[_0xb23c('0x76')][_0xb23c('0x79')]['admin']){var _0x638d3=_0x46e223['parameters'][_0xb23c('0x79')][_0xb23c('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x85')](_0x638d3)){_0x482492=path[_0xb23c('0x50')](_0xb23c('0x86'),_0x243f32,_0x285818[0x0],_0x638d3);}else{_0x482492=_0x638d3;}}else{logger[_0xb23c('0x65')](_0xb23c('0x87'));}if('undefined'!=typeof _0x46e223[_0xb23c('0x76')]['views']['agent']){var _0x3a72b3=_0x46e223[_0xb23c('0x76')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x85')](_0x3a72b3)){_0x41e744=path['join']('plugins',_0x243f32,_0x285818[0x0],_0x3a72b3);}else{_0x41e744=_0x3a72b3;}}else{logger[_0xb23c('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xcd4339===_0xb23c('0x7e')){_0x1eb2d9=_0x46e223[_0xb23c('0x76')][_0xb23c('0x88')];_0x156a99=_0x46e223[_0xb23c('0x76')][_0xb23c('0x7f')];if(_0xb23c('0x23')!=typeof _0x46e223[_0xb23c('0x76')][_0xb23c('0x79')]){if(_0xb23c('0x23')!=typeof _0x46e223[_0xb23c('0x76')][_0xb23c('0x79')][_0xb23c('0x7b')]){var _0x638d3=_0x46e223[_0xb23c('0x76')][_0xb23c('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x85')](_0x638d3)){_0x482492=path['join']('plugins',_0x243f32,_0x285818[0x0],_0x638d3);}else{_0x482492=_0x638d3;}}if('undefined'!=typeof _0x46e223[_0xb23c('0x76')][_0xb23c('0x79')]['agent']){var _0x3a72b3=_0x46e223[_0xb23c('0x76')][_0xb23c('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x85')](_0x3a72b3)){_0x41e744=path[_0xb23c('0x50')](_0xb23c('0x86'),_0x243f32,_0x285818[0x0],_0x3a72b3);}else{_0x41e744=_0x3a72b3;}}}}var _0x533253={'name':_0x4760c6,'description':_0x1e1abc,'path':path['join'](_0x243f32,_0x285818[0x0]),'type':_0xcd4339,'sidebar':_0x41408b,'icon':_0x209a4b,'adminUrl':_0x482492,'agentUrl':_0x41e744,'scriptName':_0x1eb2d9,'scriptPath':_0x156a99,'version':_0x2fbfa2};removeReferences(_0x7b82ca,null);return db[_0xb23c('0x32')][_0xb23c('0x89')](_0x533253)['then'](function(_0x418f68){var _0x4c4fc8={'role':_0x44620d[_0xb23c('0x8a')][_0xb23c('0x8b')],'userProfileId':_0x44620d[_0xb23c('0x8a')]['userProfileId']};if(!_0x4c4fc8)throw new Error(_0xb23c('0x8c'));if(_0x4c4fc8[_0xb23c('0x8b')]===_0xb23c('0x8d')){var _0x5888a6=_0x418f68['get']({'plain':!![]});return db[_0xb23c('0x8e')]['find']({'where':{'name':_0xb23c('0x2e'),'userProfileId':_0x4c4fc8[_0xb23c('0x8f')]},'raw':!![]})[_0xb23c('0x2c')](function(_0x367298){if(_0x367298&&_0x367298['autoAssociation']===0x0){return db[_0xb23c('0x2f')][_0xb23c('0x89')]({'name':_0x5888a6['name'],'resourceId':_0x5888a6['id'],'type':_0x367298['name'],'sectionId':_0x367298['id']},{})[_0xb23c('0x2c')](function(){return _0x418f68;});}else{return _0x418f68;}})[_0xb23c('0x4a')](function(_0x17aa7c){logger['error'](_0xb23c('0x90'),_0x17aa7c);throw _0x17aa7c;});}return _0x418f68;})[_0xb23c('0x2c')](respondWithResult(_0x2e9a39,null))[_0xb23c('0x4a')](handleError(_0x2e9a39,null));}});}catch(_0x1be0ab){_0x2e9a39['status'](0x1f4)[_0xb23c('0x91')](_0x1be0ab);}};function removeReferences(_0x34ded4,_0x3f8b6c){try{if(_0x34ded4){fs[_0xb23c('0x92')](_0x34ded4);logger[_0xb23c('0x65')](_0xb23c('0x93'));}if(_0x3f8b6c){rimraf(_0x3f8b6c,function(){});logger[_0xb23c('0x65')](_0xb23c('0x94'));}}catch(_0x2ffe76){logger[_0xb23c('0x30')](_0x2ffe76);}}exports['update']=function(_0xdbbb,_0x5aeade,_0x41daad){return db[_0xb23c('0x32')][_0xb23c('0x4d')]({'where':{'id':_0xdbbb[_0xb23c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5aeade,null))[_0xb23c('0x2c')](saveUpdates(_0xdbbb['body'],null))[_0xb23c('0x2c')](respondWithResult(_0x5aeade,null))[_0xb23c('0x4a')](handleError(_0x5aeade,null));};exports['delete']=function(_0x5d89f4,_0x57be13,_0x545ab){return db['Plugin'][_0xb23c('0x4d')]({'where':{'id':_0x5d89f4[_0xb23c('0x4c')]['id']}})[_0xb23c('0x2c')](function(_0x590043){if(_0x590043){return _0x590043['destroy']();}})[_0xb23c('0x2c')](function(_0x54a08c){rimraf(path[_0xb23c('0x50')](config[_0xb23c('0x51')],_0xb23c('0x52'),path[_0xb23c('0x5f')](_0x54a08c[_0xb23c('0x4f')])),function(){});return _0x54a08c;})[_0xb23c('0x2c')](handleEntityNotFound(_0x57be13,null))[_0xb23c('0x2c')](respondWithStatusCode(_0x57be13,null))[_0xb23c('0x4a')](handleError(_0x57be13,null));};exports[_0xb23c('0x95')]=function(_0x29b59f,_0x1a9153,_0x5964fa){return BPromise[_0xb23c('0x96')]()[_0xb23c('0x2c')](function(){if(!_0x29b59f[_0xb23c('0x3b')][_0xb23c('0x4f')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x29b59f[_0xb23c('0x3b')][_0xb23c('0x97')]){throw new Error(_0xb23c('0x98'));}var _0x3469b7=_0x29b59f[_0xb23c('0x3b')]['hostname']?_0x29b59f[_0xb23c('0x3b')]['hostname']+':'+_0x29b59f[_0xb23c('0x3b')][_0xb23c('0x97')]:_0xb23c('0x99')+_0x29b59f[_0xb23c('0x3b')][_0xb23c('0x97')];var _0x4b1019=_0x29b59f[_0xb23c('0x3b')][_0xb23c('0x21')]?_0x29b59f[_0xb23c('0x3b')][_0xb23c('0x21')]:!![];var _0x40c369=_0x29b59f['query'][_0xb23c('0x9a')]?_0x29b59f[_0xb23c('0x3b')]['encoding']:null;var _0x48d6fb={'method':_0x29b59f['method'],'uri':util[_0xb23c('0x53')](_0xb23c('0x9b'),_0x3469b7,_0x29b59f[_0xb23c('0x3b')][_0xb23c('0x4f')]),'json':_0x4b1019,'resolveWithFullResponse':!![],'encoding':_0x40c369,'qs':_0x29b59f[_0xb23c('0x3b')]};if(_0x29b59f[_0xb23c('0x9c')]){_0x48d6fb[_0xb23c('0x9c')]=_0x29b59f[_0xb23c('0x9c')];if(_0x48d6fb[_0xb23c('0x9c')][_0xb23c('0x9d')]){delete _0x48d6fb[_0xb23c('0x9c')][_0xb23c('0x9d')];}}if(_0x48d6fb[_0xb23c('0x9c')][_0xb23c('0x9e')]){delete _0x48d6fb[_0xb23c('0x9c')][_0xb23c('0x9e')];}return rp(_0x48d6fb);})[_0xb23c('0x2c')](function(_0x4cdc56){if(_0x4cdc56){_0x1a9153[_0xb23c('0x26')](_0x4cdc56[_0xb23c('0x9c')]);logger[_0xb23c('0x65')](_0x4cdc56[_0xb23c('0x8a')]);if(_[_0xb23c('0x9f')](_0x29b59f['query'][_0xb23c('0x4f')],'download')&&_0x4cdc56['statusCode']==0x1f4){return _0x1a9153[_0xb23c('0x1e')](_0x4cdc56[_0xb23c('0xa0')]);}else{return _0x1a9153['status'](_0x4cdc56['statusCode'])[_0xb23c('0x91')](_0x4cdc56[_0xb23c('0x8a')]);}}else{return _0x1a9153['sendStatus'](0xc8);}})['catch'](handleError(_0x1a9153,null));};exports[_0xb23c('0xa1')]=function(_0x5eb539,_0x21ab84,_0x13afd4){return BPromise[_0xb23c('0x96')]()[_0xb23c('0x2c')](function(){if(!_0x5eb539['query']['path']){throw new Error(_0xb23c('0xa2'));}if(!_0x5eb539[_0xb23c('0x3b')]['port']){throw new Error(_0xb23c('0x98'));}var _0x47f9e3=_0x5eb539[_0xb23c('0x3b')][_0xb23c('0xa3')]?_0x5eb539[_0xb23c('0x3b')]['hostname']+':'+_0x5eb539[_0xb23c('0x3b')][_0xb23c('0x97')]:_0xb23c('0x99')+_0x5eb539[_0xb23c('0x3b')][_0xb23c('0x97')];var _0x51367b=_0x5eb539[_0xb23c('0x3b')][_0xb23c('0x21')]?_0x5eb539[_0xb23c('0x3b')][_0xb23c('0x21')]:!![];var _0xae06e1=_0x5eb539[_0xb23c('0x3b')][_0xb23c('0x9a')]?_0x5eb539[_0xb23c('0x3b')][_0xb23c('0x9a')]:null;var _0x44f5f3={'method':_0x5eb539['method'],'uri':util[_0xb23c('0x53')](_0xb23c('0x9b'),_0x47f9e3,_0x5eb539[_0xb23c('0x3b')][_0xb23c('0x4f')]),'json':_0x51367b,'resolveWithFullResponse':!![],'encoding':_0xae06e1,'body':_0x5eb539[_0xb23c('0x8a')]};if(_0x5eb539[_0xb23c('0x9c')]){_0x44f5f3['headers']=_0x5eb539[_0xb23c('0x9c')];if(_0x44f5f3[_0xb23c('0x9c')]['content-length']){delete _0x44f5f3[_0xb23c('0x9c')][_0xb23c('0x9d')];}}if(_0x44f5f3['headers'][_0xb23c('0x9e')]){delete _0x44f5f3[_0xb23c('0x9c')]['content-type'];}return rp(_0x44f5f3);})[_0xb23c('0x2c')](function(_0x5d84b1){if(_0x5d84b1){_0x21ab84[_0xb23c('0x26')](_0x5d84b1[_0xb23c('0x9c')]);logger[_0xb23c('0x65')](_0x5d84b1[_0xb23c('0x8a')]);return _0x21ab84[_0xb23c('0x1f')](_0x5d84b1[_0xb23c('0xa0')])[_0xb23c('0x91')](_0x5d84b1['body']);}else{return _0x21ab84[_0xb23c('0x1e')](0xc8);}})[_0xb23c('0x4a')](handleError(_0x21ab84,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a46464a..4883248 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 _0x3baf=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin'];(function(_0x497d26,_0x2b9deb){var _0x4e22a5=function(_0x4cb248){while(--_0x4cb248){_0x497d26['push'](_0x497d26['shift']());}};_0x4e22a5(++_0x2b9deb);}(_0x3baf,0xf7));var _0xf3ba=function(_0x431488,_0x37f9d5){_0x431488=_0x431488-0x0;var _0x9ce3d1=_0x3baf[_0x431488];return _0x9ce3d1;};'use strict';var EventEmitter=require(_0xf3ba('0x0'));var Plugin=require(_0xf3ba('0x1'))['db'][_0xf3ba('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf3ba('0x3')](0x0);var events={'afterCreate':_0xf3ba('0x4'),'afterUpdate':_0xf3ba('0x5'),'afterDestroy':_0xf3ba('0x6')};function emitEvent(_0x306bdd){return function(_0x3e6058,_0x1ae6e6,_0x57e17d){PluginEvents[_0xf3ba('0x7')](_0x306bdd+':'+_0x3e6058['id'],_0x3e6058);PluginEvents[_0xf3ba('0x7')](_0x306bdd,_0x3e6058);_0x57e17d(null);};}for(var e in events){if(events[_0xf3ba('0x8')](e)){var event=events[e];Plugin[_0xf3ba('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x6bb4=['update','emit','exports','events','../../mysqldb','Plugin','save'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x4852f9,_0x3b7fbd){_0x4852f9=_0x4852f9-0x0;var _0x4be4db=_0x6bb4[_0x4852f9];return _0x4be4db;};'use strict';var EventEmitter=require(_0x46bb('0x0'));var Plugin=require(_0x46bb('0x1'))['db'][_0x46bb('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46bb('0x3'),'afterUpdate':_0x46bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x74054){return function(_0x100be2,_0x2eefcc,_0x3c8bef){PluginEvents[_0x46bb('0x5')](_0x74054+':'+_0x100be2['id'],_0x100be2);PluginEvents[_0x46bb('0x5')](_0x74054,_0x100be2);_0x3c8bef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x46bb('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 050977b..4059bf6 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 _0x8f64=['bluebird','rimraf','../../config/environment','./plugin.attributes','define','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x48806a,_0x55838b){var _0x1e9dd0=function(_0x19f6ce){while(--_0x19f6ce){_0x48806a['push'](_0x48806a['shift']());}};_0x1e9dd0(++_0x55838b);}(_0x8f64,0x150));var _0x48f6=function(_0x41da45,_0x56fa54){_0x41da45=_0x41da45-0x0;var _0x304afb=_0x8f64[_0x41da45];return _0x304afb;};'use strict';var _=require(_0x48f6('0x0'));var util=require(_0x48f6('0x1'));var logger=require(_0x48f6('0x2'))(_0x48f6('0x3'));var moment=require(_0x48f6('0x4'));var BPromise=require(_0x48f6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x48f6('0x6'));var config=require(_0x48f6('0x7'));var attributes=require(_0x48f6('0x8'));module['exports']=function(_0x1bbb1f,_0x32fb17){return _0x1bbb1f[_0x48f6('0x9')]('Plugin',attributes,{'tableName':_0x48f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f50=['../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f50,0x7e));var _0x03f5=function(_0x208f6a,_0x3e2afb){_0x208f6a=_0x208f6a-0x0;var _0x107bd7=_0x3f50[_0x208f6a];return _0x107bd7;};'use strict';var _=require(_0x03f5('0x0'));var util=require(_0x03f5('0x1'));var logger=require(_0x03f5('0x2'))(_0x03f5('0x3'));var moment=require(_0x03f5('0x4'));var BPromise=require(_0x03f5('0x5'));var rp=require(_0x03f5('0x6'));var fs=require('fs');var path=require(_0x03f5('0x7'));var rimraf=require(_0x03f5('0x8'));var config=require(_0x03f5('0x9'));var attributes=require(_0x03f5('0xa'));module[_0x03f5('0xb')]=function(_0x497d53,_0x3366e2){return _0x497d53[_0x03f5('0xc')](_0x03f5('0xd'),attributes,{'tableName':_0x03f5('0xe'),'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 56f46c1..869029e 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 _0x7899=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','create','options','raw','CreatePlugin','lodash','util','moment'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x7899,0x168));var _0x9789=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x7899[_0x1e05c1];return _0x15f1ca;};'use strict';var _=require(_0x9789('0x0'));var util=require(_0x9789('0x1'));var moment=require(_0x9789('0x2'));var BPromise=require(_0x9789('0x3'));var rs=require(_0x9789('0x4'));var fs=require('fs');var Redis=require(_0x9789('0x5'));var db=require(_0x9789('0x6'))['db'];var utils=require(_0x9789('0x7'));var logger=require('../../config/logger')(_0x9789('0x8'));var config=require('../../config/environment');var jayson=require(_0x9789('0x9'));var client=jayson[_0x9789('0xa')][_0x9789('0xb')]({'port':0x232a});config['redis']=_[_0x9789('0xc')](config['redis'],{'host':_0x9789('0xd'),'port':0x18eb});var socket=require(_0x9789('0xe'))(new Redis(config[_0x9789('0xf')]));require(_0x9789('0x10'))[_0x9789('0x11')](socket);function respondWithRpcPromise(_0x2bee5e,_0x268902,_0x237c59){return new BPromise(function(_0x1d2851,_0x433b6c){return client[_0x9789('0x12')](_0x2bee5e,_0x237c59)[_0x9789('0x13')](function(_0x1da407){logger[_0x9789('0x14')](_0x9789('0x15'),_0x268902,'request\x20sent');logger[_0x9789('0x16')](_0x9789('0x17'),_0x268902,_0x9789('0x18'),JSON[_0x9789('0x19')](_0x1da407));if(_0x1da407[_0x9789('0x1a')]){if(_0x1da407[_0x9789('0x1a')]['code']===0x1f4){logger[_0x9789('0x1a')](_0x9789('0x15'),_0x268902,_0x1da407[_0x9789('0x1a')][_0x9789('0x1b')]);return _0x433b6c(_0x1da407['error'][_0x9789('0x1b')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x268902,_0x1da407[_0x9789('0x1a')][_0x9789('0x1b')]);return _0x1d2851(_0x1da407[_0x9789('0x1a')][_0x9789('0x1b')]);}else{logger['info'](_0x9789('0x15'),_0x268902,_0x9789('0x18'));_0x1d2851(_0x1da407['result']['message']);}})[_0x9789('0x1c')](function(_0x48336a){logger['error'](_0x9789('0x15'),_0x268902,_0x48336a);_0x433b6c(_0x48336a);});});}exports['CreatePlugin']=function(_0x18ff65){var _0x1881f0=this;return new Promise(function(_0x4c4b6d,_0x5efbe0){return db['Plugin'][_0x9789('0x1d')](_0x18ff65['body'],{'raw':_0x18ff65['options']?_0x18ff65[_0x9789('0x1e')][_0x9789('0x1f')]===undefined?!![]:![]:!![]})[_0x9789('0x13')](function(_0x27553c){logger['info']('CreatePlugin',_0x18ff65);logger[_0x9789('0x16')](_0x9789('0x20'),_0x18ff65,JSON[_0x9789('0x19')](_0x27553c));_0x4c4b6d(_0x27553c);})[_0x9789('0x1c')](function(_0x42acd3){logger[_0x9789('0x1a')]('CreatePlugin',_0x42acd3[_0x9789('0x1b')],_0x18ff65);_0x5efbe0(_0x1881f0['error'](0x1f4,_0x42acd3[_0x9789('0x1b')]));});});}; \ No newline at end of file +var _0x2227=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','debug','request\x20sent','error','message','Plugin,\x20%s,\x20%s','CreatePlugin','Plugin','body','options','raw','then','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3cd359,_0x558786){var _0x117e49=function(_0x4d578d){while(--_0x4d578d){_0x3cd359['push'](_0x3cd359['shift']());}};_0x117e49(++_0x558786);}(_0x2227,0x143));var _0x7222=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2227[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x7222('0x0'));var util=require('util');var moment=require(_0x7222('0x1'));var BPromise=require(_0x7222('0x2'));var rs=require(_0x7222('0x3'));var fs=require('fs');var Redis=require(_0x7222('0x4'));var db=require(_0x7222('0x5'))['db'];var utils=require(_0x7222('0x6'));var logger=require(_0x7222('0x7'))(_0x7222('0x8'));var config=require(_0x7222('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7222('0xa')][_0x7222('0xb')]({'port':0x232a});config[_0x7222('0xc')]=_[_0x7222('0xd')](config['redis'],{'host':_0x7222('0xe'),'port':0x18eb});var socket=require(_0x7222('0xf'))(new Redis(config[_0x7222('0xc')]));require(_0x7222('0x10'))[_0x7222('0x11')](socket);function respondWithRpcPromise(_0x549edc,_0xd0ee27,_0x186650){return new BPromise(function(_0x314a21,_0x477388){return client[_0x7222('0x12')](_0x549edc,_0x186650)['then'](function(_0xa44f3f){logger[_0x7222('0x13')]('Plugin,\x20%s,\x20%s',_0xd0ee27,'request\x20sent');logger[_0x7222('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0xd0ee27,_0x7222('0x15'),JSON['stringify'](_0xa44f3f));if(_0xa44f3f[_0x7222('0x16')]){if(_0xa44f3f[_0x7222('0x16')]['code']===0x1f4){logger[_0x7222('0x16')]('Plugin,\x20%s,\x20%s',_0xd0ee27,_0xa44f3f[_0x7222('0x16')][_0x7222('0x17')]);return _0x477388(_0xa44f3f[_0x7222('0x16')][_0x7222('0x17')]);}logger[_0x7222('0x16')]('Plugin,\x20%s,\x20%s',_0xd0ee27,_0xa44f3f[_0x7222('0x16')]['message']);return _0x314a21(_0xa44f3f['error'][_0x7222('0x17')]);}else{logger[_0x7222('0x13')]('Plugin,\x20%s,\x20%s',_0xd0ee27,_0x7222('0x15'));_0x314a21(_0xa44f3f['result'][_0x7222('0x17')]);}})['catch'](function(_0x405308){logger[_0x7222('0x16')](_0x7222('0x18'),_0xd0ee27,_0x405308);_0x477388(_0x405308);});});}exports[_0x7222('0x19')]=function(_0x7a9a01){var _0x3be837=this;return new Promise(function(_0x28a579,_0x438e02){return db[_0x7222('0x1a')]['create'](_0x7a9a01[_0x7222('0x1b')],{'raw':_0x7a9a01[_0x7222('0x1c')]?_0x7a9a01[_0x7222('0x1c')][_0x7222('0x1d')]===undefined?!![]:![]:!![]})[_0x7222('0x1e')](function(_0x2fa982){logger['info']('CreatePlugin',_0x7a9a01);logger[_0x7222('0x14')](_0x7222('0x19'),_0x7a9a01,JSON[_0x7222('0x1f')](_0x2fa982));_0x28a579(_0x2fa982);})[_0x7222('0x20')](function(_0x3d41db){logger[_0x7222('0x16')](_0x7222('0x19'),_0x3d41db[_0x7222('0x17')],_0x7a9a01);_0x438e02(_0x3be837['error'](0x1f4,_0x3d41db[_0x7222('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1d84098..def30ce 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 _0xe4ab=['remove','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x5560df,_0x548b46){var _0x1d0688=function(_0x5383f9){while(--_0x5383f9){_0x5560df['push'](_0x5560df['shift']());}};_0x1d0688(++_0x548b46);}(_0xe4ab,0x176));var _0xbe4a=function(_0x1cb16a,_0x101a2c){_0x1cb16a=_0x1cb16a-0x0;var _0x120213=_0xe4ab[_0x1cb16a];return _0x120213;};'use strict';var PluginEvents=require(_0xbe4a('0x0'));var events=[_0xbe4a('0x1'),_0xbe4a('0x2'),'update'];function createListener(_0xf2159c,_0x5081d1){return function(_0x58cab0){_0x5081d1[_0xbe4a('0x3')](_0xf2159c,_0x58cab0);};}function removeListener(_0x4778b2,_0x4c141f){return function(){PluginEvents[_0xbe4a('0x4')](_0x4778b2,_0x4c141f);};}exports[_0xbe4a('0x5')]=function(_0x1cc25d){for(var _0x4e90cb=0x0,_0x4e52f2=events[_0xbe4a('0x6')];_0x4e90cb<_0x4e52f2;_0x4e90cb++){var _0x15489a=events[_0x4e90cb];var _0x5b3aaa=createListener(_0xbe4a('0x7')+_0x15489a,_0x1cc25d);PluginEvents['on'](_0x15489a,_0x5b3aaa);}}; \ No newline at end of file +var _0xa5dd=['save','remove','update','removeListener','register'];(function(_0x377f50,_0x5589ba){var _0x14a9d2=function(_0x4ab38b){while(--_0x4ab38b){_0x377f50['push'](_0x377f50['shift']());}};_0x14a9d2(++_0x5589ba);}(_0xa5dd,0x1c7));var _0xda5d=function(_0x13f05f,_0x1c4b2f){_0x13f05f=_0x13f05f-0x0;var _0x585afd=_0xa5dd[_0x13f05f];return _0x585afd;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xda5d('0x0'),_0xda5d('0x1'),_0xda5d('0x2')];function createListener(_0x38eaae,_0x286da0){return function(_0x2d3962){_0x286da0['emit'](_0x38eaae,_0x2d3962);};}function removeListener(_0x47504d,_0x2e7940){return function(){PluginEvents[_0xda5d('0x3')](_0x47504d,_0x2e7940);};}exports[_0xda5d('0x4')]=function(_0xcbe13e){for(var _0x35c3dc=0x0,_0x235536=events['length'];_0x35c3dc<_0x235536;_0x35c3dc++){var _0x41e0c2=events[_0x35c3dc];var _0xf52094=createListener('plugin:'+_0x41e0c2,_0xcbe13e);PluginEvents['on'](_0x41e0c2,_0xf52094);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 223b656..ae5bdfe 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(_0x17d617,_0x1953a7){var _0x3d9471=function(_0x2c80fb){while(--_0x2c80fb){_0x17d617['push'](_0x17d617['shift']());}};_0x3d9471(++_0x1953a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x125af9,_0x41ed83){var _0x1a8dd2=function(_0x4028c7){while(--_0x4028c7){_0x125af9['push'](_0x125af9['shift']());}};_0x1a8dd2(++_0x41ed83);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 6679c37..3fae67c 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 _0xe5b5=['../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','then','reject','motion2','length','show','describe','catch','body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x40f933,_0x4e3520){var _0x4c7dbd=function(_0x122fe0){while(--_0x122fe0){_0x40f933['push'](_0x40f933['shift']());}};_0x4c7dbd(++_0x4e3520);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0xe5b5[_0x2c96f6];return _0x6d4808;};'use strict';var _=require(_0x5e5b('0x0'));var pm2=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var path=require(_0x5e5b('0x4'));var exec=require(_0x5e5b('0x5'))[_0x5e5b('0x6')];var BPromise=require(_0x5e5b('0x7'));function handleEntityNotFound(_0xf20c6a,_0x20a50c){return function(_0xdc6616){if(!_0xdc6616){_0xf20c6a[_0x5e5b('0x8')](0x194);;}return _0xdc6616;};}function respondWithResult(_0xf1fbe2,_0x11e0e0){_0x11e0e0=_0x11e0e0||0xc8;return function(_0x545eb3){if(_0x545eb3){return _0xf1fbe2[_0x5e5b('0x9')](_0x11e0e0)[_0x5e5b('0xa')](_0x545eb3);}return null;};}function handleError(_0xcbd478,_0x258414){_0x258414=_0x258414||0x1f4;return function(_0xb9d72b){logger[_0x5e5b('0xb')](_0xb9d72b[_0x5e5b('0xc')]);if(_0xb9d72b[_0x5e5b('0xd')]){delete _0xb9d72b['name'];}_0xcbd478[_0x5e5b('0x9')](_0x258414)['send'](_0xb9d72b);};}function execChildProcess(){return new BPromise(function(_0x108c34,_0x58185){exec(_0x5e5b('0xe'),function(_0x3f64b6,_0x55c974,_0x4a1424){logger['info'](_0x55c974);logger[_0x5e5b('0xf')](_0x4a1424);if(_0x3f64b6){logger[_0x5e5b('0xb')](_0x3f64b6);return _0x58185(_0x3f64b6);}return _0x108c34(_0x55c974);});});}exports[_0x5e5b('0x10')]=function(_0x1694ff,_0x13a01e){return pm2[_0x5e5b('0x11')]()[_0x5e5b('0x12')](function(_0x49edd0){if(_0x49edd0){var _0x2b37fa=_[_0x5e5b('0x13')](_0x49edd0,function(_0x4ff37b){return _0x4ff37b[_0x5e5b('0xd')]==='express'||_0x4ff37b['name']===_0x5e5b('0x14');});return{'rows':_0x2b37fa,'count':_0x2b37fa[_0x5e5b('0x15')]};}return null;})[_0x5e5b('0x12')](respondWithResult(_0x13a01e,null))['catch'](handleError(_0x13a01e,null));};exports[_0x5e5b('0x16')]=function(_0x4d490c,_0x1796af){return pm2[_0x5e5b('0x17')](_0x4d490c['params']['id'])[_0x5e5b('0x12')](respondWithResult(_0x1796af,null))[_0x5e5b('0x12')](handleEntityNotFound(_0x1796af,null))[_0x5e5b('0x18')](handleError(_0x1796af,null));};exports['create']=function(_0x2bf0b7,_0x3f1103){if(_0x2bf0b7['body'][_0x5e5b('0xd')]&&_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]){var _0x2d8252=path[_0x5e5b('0x1b')](__dirname,_0x5e5b('0x1c'),_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]);var _0x4a78e3=process['cwd']();process[_0x5e5b('0x1d')](path[_0x5e5b('0x1e')](_0x2d8252));return execChildProcess()[_0x5e5b('0x12')](function(_0xe1c268){process[_0x5e5b('0x1d')](_0x4a78e3);return pm2[_0x5e5b('0x1f')]({'name':_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0xd')],'script':_0x2d8252});})[_0x5e5b('0x12')](function(_0x26bc02){pm2[_0x5e5b('0x20')]();return _0x26bc02[0x0];})['then'](respondWithResult(_0x3f1103,0xc9))[_0x5e5b('0x18')](handleError(_0x3f1103,null));}else{return _0x3f1103[_0x5e5b('0x9')](0x1f4)[_0x5e5b('0x21')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5e5b('0x22')]=function(_0xdb2863,_0x5ee866){if(_0xdb2863[_0x5e5b('0x19')]['id']){delete _0xdb2863[_0x5e5b('0x19')]['id'];}var _0x39ce16={'online':_0x5e5b('0x23'),'stopped':_0x5e5b('0x24')};if(_0x39ce16[_0x5e5b('0x25')](_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')])){return pm2[_0x39ce16[_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')]]](_0xdb2863[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](respondWithResult(_0x5ee866,0xc8))['catch'](handleError(_0x5ee866,null));}else{return _0x5ee866['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x27')});}};exports[_0x5e5b('0x28')]=function(_0x3dcdab,_0x12f1ee){if(_0x3dcdab['body']['id']){delete _0x3dcdab[_0x5e5b('0x19')]['id'];}if(_0x3dcdab['params']['id']){return pm2[_0x5e5b('0x29')](_0x3dcdab[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](function(_0xc2bc09){pm2['dump']();return _0xc2bc09[0x0];})[_0x5e5b('0x12')](respondWithResult(_0x12f1ee,null))[_0x5e5b('0x18')](handleError(_0x12f1ee,null));}else{return _0x12f1ee['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x2a')});}}; \ No newline at end of file +var _0x4ded=['name','express','motion2','catch','show','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','send','info','index','list','then','reject'];(function(_0x35b788,_0x41a9f8){var _0x2788cd=function(_0x50a0d5){while(--_0x50a0d5){_0x35b788['push'](_0x35b788['shift']());}};_0x2788cd(++_0x41a9f8);}(_0x4ded,0x116));var _0xd4de=function(_0x53bbf6,_0x3a9649){_0x53bbf6=_0x53bbf6-0x0;var _0xa4d3ff=_0x4ded[_0x53bbf6];return _0xa4d3ff;};'use strict';var _=require(_0xd4de('0x0'));var pm2=require(_0xd4de('0x1'));var logger=require(_0xd4de('0x2'))(_0xd4de('0x3'));var path=require(_0xd4de('0x4'));var exec=require(_0xd4de('0x5'))[_0xd4de('0x6')];var BPromise=require(_0xd4de('0x7'));function handleEntityNotFound(_0x20930f,_0x36d4dd){return function(_0x2e8d86){if(!_0x2e8d86){_0x20930f[_0xd4de('0x8')](0x194);;}return _0x2e8d86;};}function respondWithResult(_0x554a51,_0x23e5b9){_0x23e5b9=_0x23e5b9||0xc8;return function(_0x2433b8){if(_0x2433b8){return _0x554a51[_0xd4de('0x9')](_0x23e5b9)[_0xd4de('0xa')](_0x2433b8);}return null;};}function handleError(_0x4453c2,_0x1e8c35){_0x1e8c35=_0x1e8c35||0x1f4;return function(_0x5c612f){logger[_0xd4de('0xb')](_0x5c612f['stack']);if(_0x5c612f['name']){delete _0x5c612f['name'];}_0x4453c2[_0xd4de('0x9')](_0x1e8c35)[_0xd4de('0xc')](_0x5c612f);};}function execChildProcess(){return new BPromise(function(_0x4e5b10,_0x5b6dc4){exec('npm\x20install',function(_0x29e265,_0x49d931,_0x38ac13){logger[_0xd4de('0xd')](_0x49d931);logger[_0xd4de('0xd')](_0x38ac13);if(_0x29e265){logger[_0xd4de('0xb')](_0x29e265);return _0x5b6dc4(_0x29e265);}return _0x4e5b10(_0x49d931);});});}exports[_0xd4de('0xe')]=function(_0x3af6e0,_0x1dc9d5){return pm2[_0xd4de('0xf')]()[_0xd4de('0x10')](function(_0x37cb9f){if(_0x37cb9f){var _0x691ba9=_[_0xd4de('0x11')](_0x37cb9f,function(_0x164ca0){return _0x164ca0[_0xd4de('0x12')]===_0xd4de('0x13')||_0x164ca0[_0xd4de('0x12')]===_0xd4de('0x14');});return{'rows':_0x691ba9,'count':_0x691ba9['length']};}return null;})['then'](respondWithResult(_0x1dc9d5,null))[_0xd4de('0x15')](handleError(_0x1dc9d5,null));};exports[_0xd4de('0x16')]=function(_0x17b377,_0x428aa2){return pm2['describe'](_0x17b377['params']['id'])[_0xd4de('0x10')](respondWithResult(_0x428aa2,null))['then'](handleEntityNotFound(_0x428aa2,null))[_0xd4de('0x15')](handleError(_0x428aa2,null));};exports[_0xd4de('0x17')]=function(_0x50b9e3,_0xc15081){if(_0x50b9e3['body'][_0xd4de('0x12')]&&_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x19')]){var _0x8e8712=path['join'](__dirname,_0xd4de('0x1a'),_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x19')]);var _0xdb3fc=process[_0xd4de('0x1b')]();process[_0xd4de('0x1c')](path[_0xd4de('0x1d')](_0x8e8712));return execChildProcess()[_0xd4de('0x10')](function(_0x2f9de6){process[_0xd4de('0x1c')](_0xdb3fc);return pm2['start']({'name':_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x12')],'script':_0x8e8712});})[_0xd4de('0x10')](function(_0x22970c){pm2[_0xd4de('0x1e')]();return _0x22970c[0x0];})[_0xd4de('0x10')](respondWithResult(_0xc15081,0xc9))[_0xd4de('0x15')](handleError(_0xc15081,null));}else{return _0xc15081[_0xd4de('0x9')](0x1f4)[_0xd4de('0xc')]({'message':_0xd4de('0x1f')});}};exports[_0xd4de('0x20')]=function(_0xb2d8a1,_0x586126){if(_0xb2d8a1[_0xd4de('0x18')]['id']){delete _0xb2d8a1[_0xd4de('0x18')]['id'];}var _0x5005b0={'online':_0xd4de('0x21'),'stopped':'stop'};if(_0x5005b0[_0xd4de('0x22')](_0xb2d8a1[_0xd4de('0x18')][_0xd4de('0x9')])){return pm2[_0x5005b0[_0xb2d8a1['body'][_0xd4de('0x9')]]](_0xb2d8a1[_0xd4de('0x23')]['id'])[_0xd4de('0x10')](respondWithResult(_0x586126,0xc8))['catch'](handleError(_0x586126,null));}else{return _0x586126[_0xd4de('0x9')](0x1f4)[_0xd4de('0xc')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x5706fe,_0x3f6491){if(_0x5706fe['body']['id']){delete _0x5706fe[_0xd4de('0x18')]['id'];}if(_0x5706fe[_0xd4de('0x23')]['id']){return pm2[_0xd4de('0x24')](_0x5706fe[_0xd4de('0x23')]['id'])['then'](function(_0x3fe6c8){pm2[_0xd4de('0x1e')]();return _0x3fe6c8[0x0];})['then'](respondWithResult(_0x3f6491,null))[_0xd4de('0x15')](handleError(_0x3f6491,null));}else{return _0x3f6491[_0xd4de('0x9')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index dacc5e1..1b003ea 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 _0x04d5=['exports','express','Router','./realtime.controller','get','/queues','getQueues'];(function(_0x298977,_0x46ce97){var _0x318125=function(_0x1e4fb2){while(--_0x1e4fb2){_0x298977['push'](_0x298977['shift']());}};_0x318125(++_0x46ce97);}(_0x04d5,0xe1));var _0x504d=function(_0x42cd70,_0x3f543f){_0x42cd70=_0x42cd70-0x0;var _0x20f4f6=_0x04d5[_0x42cd70];return _0x20f4f6;};'use strict';var express=require(_0x504d('0x0'));var router=express[_0x504d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x504d('0x2'));router[_0x504d('0x3')](_0x504d('0x4'),auth['isAuthenticated'](),controller[_0x504d('0x5')]);module[_0x504d('0x6')]=router; \ No newline at end of file +var _0xaafc=['isAuthenticated','getQueues','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0xaafc,0x176));var _0xcaaf=function(_0x4c2182,_0xce2299){_0x4c2182=_0x4c2182-0x0;var _0x2f684d=_0xaafc[_0x4c2182];return _0x2f684d;};'use strict';var express=require('express');var router=express[_0xcaaf('0x0')]();var auth=require(_0xcaaf('0x1'));var controller=require(_0xcaaf('0x2'));router[_0xcaaf('0x3')]('/queues',auth[_0xcaaf('0x4')](),controller[_0xcaaf('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 88c6aca..acf4ac5 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 _0xe881=['count','status','Content-Range','stack','name','send','request','Agents','error','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','waiting','paused','voice','outbound','push','pTalking','originated','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','agents','loggedInDb','available','talking','busy','find','pick','filter','queue','length','some','internal','getMembers','UserId','accountcode','online','Queue','findAll','QueueId','getQueues','mail','chat','openchannel','fax','whatsapp','resolve','query','includes','Invalid\x20channel','channel','toLowerCase','map','rawAttributes','fieldName','key','getOptions','role','user','userProfileId','type','QueueCampaigns','Queues','UserProfile','findAndCountAll','rows','all','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','http','client','offset','undefined','limit'];(function(_0x3f4288,_0x5b5534){var _0x459fb7=function(_0x529a11){while(--_0x529a11){_0x3f4288['push'](_0x3f4288['shift']());}};_0x459fb7(++_0x5b5534);}(_0xe881,0xbe));var _0x1e88=function(_0x2ed88f,_0x5bc5ae){_0x2ed88f=_0x2ed88f-0x0;var _0x17ca96=_0xe881[_0x2ed88f];return _0x17ca96;};'use strict';var util=require(_0x1e88('0x0'));var _=require('lodash');var jayson=require(_0x1e88('0x1'));var qs=require(_0x1e88('0x2'));var logger=require(_0x1e88('0x3'))(_0x1e88('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x1e88('0x5')]({'port':0x232a});var routingClient=jayson[_0x1e88('0x6')][_0x1e88('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x525de3,_0x176365){return function(_0x37b1f7){if(_0x37b1f7){var _0x3a7cd4=typeof _0x176365[_0x1e88('0x7')]===_0x1e88('0x8')&&typeof _0x176365[_0x1e88('0x9')]===_0x1e88('0x8');var _0x449835=_0x37b1f7[_0x1e88('0xa')];var _0x468ee4=_0x3a7cd4?0x0:_0x176365[_0x1e88('0x7')];var _0x2f9387=_0x3a7cd4?_0x37b1f7[_0x1e88('0xa')]:_0x176365['offset']+_0x176365[_0x1e88('0x9')];var _0xc872;if(_0x2f9387>=_0x449835){_0x2f9387=_0x449835;_0xc872=0xc8;}else{_0xc872=0xce;}_0x525de3[_0x1e88('0xb')](_0xc872);return _0x525de3['set'](_0x1e88('0xc'),_0x468ee4+'-'+_0x2f9387+'/'+_0x449835)['json'](_0x37b1f7);}return null;};}function handleError(_0x26dbc5,_0x1857d6){_0x1857d6=_0x1857d6||0x1f4;return function(_0x392d5d){logger['error'](_0x392d5d[_0x1e88('0xd')]);if(_0x392d5d[_0x1e88('0xe')]){delete _0x392d5d[_0x1e88('0xe')];}_0x26dbc5[_0x1e88('0xb')](_0x1857d6)[_0x1e88('0xf')](_0x392d5d);};}function getRealtimeAgents(){return new Promise(function(_0x577a10,_0x39d30d){return amiClient[_0x1e88('0x10')](_0x1e88('0x11'),{})['then'](function(_0x2cba8d){if(_0x2cba8d[_0x1e88('0x12')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x8559dd=_0x2cba8d[_0x1e88('0x13')];return routingClient[_0x1e88('0x10')](_0x1e88('0x11'),{})[_0x1e88('0x14')](function(_0x575e09){if(_0x575e09['error'])throw new Error(_0x1e88('0x15'));var _0x28dd47=_0x575e09['result'];return _0x577a10(_[_0x1e88('0x16')]({},_0x8559dd,_0x28dd47));});})[_0x1e88('0x17')](function(_0x43b8c5){_0x39d30d(_0x43b8c5);});});}function getRealtimeQueues(_0x154bbc,_0x2ffdcd){return new Promise(function(_0x3c5d9d,_0x1e234d){var _0x173809=_0x2ffdcd==='voice'?amiClient:routingClient;return _0x173809[_0x1e88('0x10')](_[_0x1e88('0x18')](_0x2ffdcd)+'Queues',_0x154bbc)['then'](function(_0x17d76a){if(_0x17d76a[_0x1e88('0x12')])throw new Error(util[_0x1e88('0x19')](_0x1e88('0x1a'),_0x2ffdcd));return _0x3c5d9d(_0x17d76a[_0x1e88('0x13')]);})[_0x1e88('0x17')](function(_0x244f05){_0x1e234d(_0x244f05);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x25521a,_0x34ab91){return amiClient[_0x1e88('0x10')](_0x1e88('0x1b'),{})[_0x1e88('0x14')](function(_0x2cf26e){if(_0x2cf26e['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x25521a(_0x2cf26e[_0x1e88('0x13')]);})[_0x1e88('0x17')](function(_0x17a4c6){_0x34ab91(_0x17a4c6);});});}function initializeQueues(_0x36a98d,_0x35d9b5,_0x3f4f00,_0x20082e){var _0x46db4e=[_0x1e88('0x1c'),'available',_0x1e88('0x1d'),'talking',_0x1e88('0x1e')];if(_0x3f4f00===_0x1e88('0x1f')&&_0x20082e===_0x1e88('0x20')){_0x46db4e[_0x1e88('0x21')](_0x1e88('0x22'),_0x1e88('0x23'),'message',_0x1e88('0x24'),_0x1e88('0x25'),'Trunk',_0x1e88('0x26'),_0x1e88('0x27'),_0x1e88('0x28'),_0x1e88('0x29'),_0x1e88('0x2a'),_0x1e88('0x2b'),_0x1e88('0x2c'),_0x1e88('0x2d'),_0x1e88('0x2e'),_0x1e88('0x2f'),_0x1e88('0x30'),_0x1e88('0x31'),_0x1e88('0x32'),_0x1e88('0x33'),_0x1e88('0x34'),_0x1e88('0x35'));}return _0x36a98d['map'](function(_0x40272b){var _0x2f6881=_0x40272b['get']({'plain':!![]});_0x2f6881[_0x1e88('0x36')]=[];_0x2f6881[_0x1e88('0x1e')]=0x0;_0x2f6881[_0x1e88('0x37')]=0x0;_0x2f6881[_0x1e88('0x1c')]=0x0;_0x2f6881[_0x1e88('0x38')]=0x0;_0x2f6881[_0x1e88('0x1d')]=0x0;if(_0x3f4f00===_0x1e88('0x1f')){_0x2f6881[_0x1e88('0x39')]=0x0;_0x2f6881[_0x1e88('0x3a')]=0x0;if(_0x20082e==='outbound'){_0x2f6881['pTalking']=0x0;_0x2f6881['originated']=0x0;}}var _0x1db2d9=_[_0x1e88('0x3b')](_0x35d9b5,['id',_0x2f6881['id']]);if(_0x1db2d9)_[_0x1e88('0x16')](_0x2f6881,_[_0x1e88('0x3c')](_0x1db2d9,_0x46db4e));return _0x2f6881;});}function updateAgentVoiceStatus(_0x43fd5d,_0x4ddd92,_0x27975b){var _0x5a9260=_[_0x1e88('0x3d')](_0x27975b,[_0x1e88('0x3e'),_0x4ddd92['name']]);if(_0x5a9260[_0x1e88('0x3f')]===0x0)return _0x43fd5d['busy']=!![];if(_[_0x1e88('0x40')](_0x5a9260,['connectedlinenum',_0x43fd5d[_0x1e88('0x41')]['toString']()]))return _0x43fd5d[_0x1e88('0x39')]=!![];if(!_0x43fd5d['talking'])return _0x43fd5d[_0x1e88('0x3a')]=!![];}function getVoiceQueueAgents(_0x4c8a6a,_0xc5be78,_0x363e8b,_0x23f155){var _0x36cbdd=_[_0x1e88('0x3b')](_0xc5be78,['id',_0x4c8a6a['id']]);if(!_0x36cbdd)return _0x4c8a6a;return _0x36cbdd[_0x1e88('0x42')]({'raw':!![]})[_0x1e88('0x14')](function(_0x3fdcfe){for(var _0x27786e=0x0;_0x27786e<_0x3fdcfe[_0x1e88('0x3f')];_0x27786e++){var _0x2e905e=_[_0x1e88('0x3b')](_0x363e8b,['id',_0x3fdcfe[_0x27786e][_0x1e88('0x43')]]);if(!_0x2e905e){_0x2e905e={'id':_0x3fdcfe[_0x27786e][_0x1e88('0x43')],'name':_0x3fdcfe[_0x27786e][_0x1e88('0x43')],'accountcode':'','online':![]};}var _0x452921={'id':_0x2e905e['id'],'name':_0x2e905e[_0x1e88('0xe')],'internal':_0x2e905e[_0x1e88('0x44')],'online':Boolean(_0x2e905e[_0x1e88('0x45')]),'paused':Boolean(_0x3fdcfe[_0x27786e][_0x1e88('0x1e')])};if(_0x2e905e['voiceStatus']===_0x1e88('0x39'))updateAgentVoiceStatus(_0x452921,_0x4c8a6a,_0x23f155);if(_0x452921['online'])_0x4c8a6a[_0x1e88('0x37')]++;if(_0x452921['busy'])_0x4c8a6a[_0x1e88('0x3a')]++;if(_0x452921[_0x1e88('0x1e')]&&!_0x452921[_0x1e88('0x3a')]&&!_0x452921[_0x1e88('0x39')])_0x4c8a6a[_0x1e88('0x1e')]++;_0x4c8a6a['agents'][_0x1e88('0x21')](_0x452921);}return _0x4c8a6a;});}function getQueueAgents(_0x53c805,_0x278d93,_0x38762b){var _0x318d0b='User'+_[_0x1e88('0x18')](_0x38762b)+_0x1e88('0x46');var _0x17566e=_0x38762b+'Pause';return db[_0x318d0b][_0x1e88('0x47')]({'where':{[_[_0x1e88('0x18')](_0x38762b)+_0x1e88('0x48')]:_0x53c805['id']},'raw':!![]})['then'](function(_0x171350){for(var _0x2bbc81=0x0;_0x2bbc81<_0x171350[_0x1e88('0x3f')];_0x2bbc81++){var _0xeaa5fb=_['find'](_0x278d93,['id',_0x171350[_0x2bbc81][_0x1e88('0x43')]]);if(!_0xeaa5fb){_0xeaa5fb={'id':_0x171350[_0x2bbc81][_0x1e88('0x43')],'name':_0x171350[_0x2bbc81][_0x1e88('0x43')],'online':![],['pauseField']:![]};}var _0x5657f3={'id':_0xeaa5fb['id'],'name':_0xeaa5fb[_0x1e88('0xe')],'online':Boolean(_0xeaa5fb[_0x1e88('0x45')]),'paused':Boolean(_0xeaa5fb[_0x17566e])};if(_0x5657f3['online'])_0x53c805['loggedInDb']++;_0x53c805[_0x1e88('0x36')][_0x1e88('0x21')](_0x5657f3);}return _0x53c805;});}exports[_0x1e88('0x49')]=function(_0x5a9859,_0x1aa7af){var _0x98da88=[_0x1e88('0x4a'),_0x1e88('0x4b'),'sms',_0x1e88('0x4c'),_0x1e88('0x4d'),_0x1e88('0x4e'),'voice'];var _0x2deb3f={'count':0x0,'rows':[]},_0x1272b7={},_0x3948e5,_0x1862b3,_0x57fd65,_0x1be96c,_0x434aac;Promise[_0x1e88('0x4f')]()[_0x1e88('0x14')](function(){if(_0x5a9859[_0x1e88('0x50')]['channel']){if(!_[_0x1e88('0x51')](_0x98da88,_0x5a9859[_0x1e88('0x50')]['channel']['toLowerCase']()))throw new Error(_0x1e88('0x52'));_0x3948e5=_0x5a9859[_0x1e88('0x50')][_0x1e88('0x53')][_0x1e88('0x54')]();}var _0x583516=_['startCase'](_0x3948e5)+_0x1e88('0x46');var _0x3ecc95=_[_0x1e88('0x55')](db[_0x583516][_0x1e88('0x56')],function(_0x1ec221){return{'name':_0x1ec221[_0x1e88('0x57')],'type':_0x1ec221['type'][_0x1e88('0x58')]};});_0x1272b7=qs[_0x1e88('0x59')](_0x3ecc95,_0x5a9859);if(_0x5a9859['user'][_0x1e88('0x5a')]==='user'){var _0x4f1e87={'params':{'id':_0x5a9859[_0x1e88('0x5b')][_0x1e88('0x5c')]},'query':{'section':_0x3948e5===_0x1e88('0x1f')&&_0x5a9859[_0x1e88('0x50')][_0x1e88('0x5d')]===_0x1e88('0x20')?_0x1e88('0x5e'):_['startCase'](_0x3948e5)+_0x1e88('0x5f'),'type':_0x5a9859[_0x1e88('0x50')][_0x1e88('0x5d')],'nolimit':!![],'sort':_0x1e88('0xe'),'filter':_0x5a9859[_0x1e88('0x50')][_0x1e88('0x3d')]}};return db[_0x1e88('0x60')]['getResources'](_0x4f1e87);}return db[_0x583516][_0x1e88('0x61')](_0x1272b7);})[_0x1e88('0x14')](function(_0x4cec69){_0x2deb3f[_0x1e88('0xa')]=_0x4cec69['count'];_0x1862b3=_0x4cec69[_0x1e88('0x62')];return getRealtimeQueues(_0x5a9859,_0x3948e5);})[_0x1e88('0x14')](function(_0x131666){_0x1be96c=_0x131666[_0x1e88('0x62')];return getRealtimeAgents();})[_0x1e88('0x14')](function(_0x107acb){_0x57fd65=_0x107acb[_0x1e88('0x62')];if(_0x3948e5!=_0x1e88('0x1f'))return;return getRealtimeVoiceQueueChannels();})[_0x1e88('0x14')](function(_0x1d4f6d){_0x434aac=_0x1d4f6d?_0x1d4f6d[_0x1e88('0x62')]:[];return initializeQueues(_0x1862b3,_0x1be96c,_0x3948e5,_0x5a9859['query']['type']);})[_0x1e88('0x14')](function(_0x23ec17){var _0x3c6afa=_0x23ec17[_0x1e88('0x55')](function(_0x66e6b){if(_0x3948e5===_0x1e88('0x1f'))return getVoiceQueueAgents(_0x66e6b,_0x1862b3,_0x57fd65,_0x434aac);else return getQueueAgents(_0x66e6b,_0x57fd65,_0x3948e5);});return Promise[_0x1e88('0x63')](_0x3c6afa);})['then'](function(_0x94fffd){_0x2deb3f[_0x1e88('0x62')]=_0x94fffd;return _0x2deb3f;})[_0x1e88('0x14')](respondWithFilteredResult(_0x1aa7af,_0x1272b7))['catch'](handleError(_0x1aa7af,null));}; \ No newline at end of file +var _0x0e2f=['UserId','accountcode','online','voiceStatus','User','Pause','startCase','mail','chat','sms','openchannel','fax','whatsapp','resolve','channel','includes','toLowerCase','Invalid\x20channel','Queue','rawAttributes','fieldName','type','key','getOptions','user','role','userProfileId','query','QueueCampaigns','getResources','rows','all','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','limit','undefined','count','offset','status','set','stack','name','send','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','catch','voice','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','originated','merge','pick','filter','find','getMembers','length'];(function(_0x36c777,_0x2616f2){var _0x8c2dc5=function(_0x1539a0){while(--_0x1539a0){_0x36c777['push'](_0x36c777['shift']());}};_0x8c2dc5(++_0x2616f2);}(_0x0e2f,0xe2));var _0xf0e2=function(_0x162f79,_0xc4ad7d){_0x162f79=_0x162f79-0x0;var _0x380302=_0x0e2f[_0x162f79];return _0x380302;};'use strict';var util=require(_0xf0e2('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0xf0e2('0x1'));var logger=require(_0xf0e2('0x2'))(_0xf0e2('0x3'));var db=require(_0xf0e2('0x4'))['db'];var amiClient=jayson[_0xf0e2('0x5')][_0xf0e2('0x6')]({'port':0x232a});var routingClient=jayson[_0xf0e2('0x5')][_0xf0e2('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x144b27,_0x4c58f2){return function(_0x5045ba){if(_0x5045ba){var _0xd59b43=typeof _0x4c58f2['offset']==='undefined'&&typeof _0x4c58f2[_0xf0e2('0x7')]===_0xf0e2('0x8');var _0x1e2715=_0x5045ba[_0xf0e2('0x9')];var _0x37a0c3=_0xd59b43?0x0:_0x4c58f2['offset'];var _0x4a9037=_0xd59b43?_0x5045ba[_0xf0e2('0x9')]:_0x4c58f2[_0xf0e2('0xa')]+_0x4c58f2[_0xf0e2('0x7')];var _0x1e0a3f;if(_0x4a9037>=_0x1e2715){_0x4a9037=_0x1e2715;_0x1e0a3f=0xc8;}else{_0x1e0a3f=0xce;}_0x144b27[_0xf0e2('0xb')](_0x1e0a3f);return _0x144b27[_0xf0e2('0xc')]('Content-Range',_0x37a0c3+'-'+_0x4a9037+'/'+_0x1e2715)['json'](_0x5045ba);}return null;};}function handleError(_0x448305,_0x5a4f6d){_0x5a4f6d=_0x5a4f6d||0x1f4;return function(_0x5acbcf){logger['error'](_0x5acbcf[_0xf0e2('0xd')]);if(_0x5acbcf['name']){delete _0x5acbcf[_0xf0e2('0xe')];}_0x448305[_0xf0e2('0xb')](_0x5a4f6d)[_0xf0e2('0xf')](_0x5acbcf);};}function getRealtimeAgents(){return new Promise(function(_0x50adfa,_0x34bd29){return amiClient[_0xf0e2('0x10')](_0xf0e2('0x11'),{})[_0xf0e2('0x12')](function(_0x14b0bb){if(_0x14b0bb[_0xf0e2('0x13')])throw new Error(_0xf0e2('0x14'));var _0x589175=_0x14b0bb[_0xf0e2('0x15')];return routingClient[_0xf0e2('0x10')](_0xf0e2('0x11'),{})[_0xf0e2('0x12')](function(_0x3dc17a){if(_0x3dc17a[_0xf0e2('0x13')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x4dd722=_0x3dc17a[_0xf0e2('0x15')];return _0x50adfa(_['merge']({},_0x589175,_0x4dd722));});})[_0xf0e2('0x16')](function(_0x42bdab){_0x34bd29(_0x42bdab);});});}function getRealtimeQueues(_0x3b3f67,_0x1c58d9){return new Promise(function(_0x1623b1,_0x50efc9){var _0x2cd0b6=_0x1c58d9===_0xf0e2('0x17')?amiClient:routingClient;return _0x2cd0b6[_0xf0e2('0x10')](_['startCase'](_0x1c58d9)+_0xf0e2('0x18'),_0x3b3f67)[_0xf0e2('0x12')](function(_0x573067){if(_0x573067[_0xf0e2('0x13')])throw new Error(util['format'](_0xf0e2('0x19'),_0x1c58d9));return _0x1623b1(_0x573067[_0xf0e2('0x15')]);})[_0xf0e2('0x16')](function(_0x3d55a4){_0x50efc9(_0x3d55a4);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x3205b0,_0xbf5d94){return amiClient[_0xf0e2('0x10')](_0xf0e2('0x1a'),{})[_0xf0e2('0x12')](function(_0x12c552){if(_0x12c552[_0xf0e2('0x13')])throw new Error(_0xf0e2('0x1b'));return _0x3205b0(_0x12c552['result']);})[_0xf0e2('0x16')](function(_0x29a8a6){_0xbf5d94(_0x29a8a6);});});}function initializeQueues(_0x1dbe45,_0xfd4e0a,_0xed358c,_0x14417b){var _0x5e2bf8=[_0xf0e2('0x1c'),_0xf0e2('0x1d'),_0xf0e2('0x1e'),_0xf0e2('0x1f'),_0xf0e2('0x20')];if(_0xed358c===_0xf0e2('0x17')&&_0x14417b===_0xf0e2('0x21')){_0x5e2bf8[_0xf0e2('0x22')](_0xf0e2('0x23'),'originated',_0xf0e2('0x24'),_0xf0e2('0x25'),_0xf0e2('0x26'),_0xf0e2('0x27'),_0xf0e2('0x28'),_0xf0e2('0x29'),_0xf0e2('0x2a'),_0xf0e2('0x2b'),_0xf0e2('0x2c'),'erlangBusyFactor',_0xf0e2('0x2d'),_0xf0e2('0x2e'),_0xf0e2('0x2f'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0xf0e2('0x30'),_0xf0e2('0x31'),_0xf0e2('0x32'),_0xf0e2('0x33'),_0xf0e2('0x34'));}return _0x1dbe45[_0xf0e2('0x35')](function(_0x5472c8){var _0x25eabb=_0x5472c8[_0xf0e2('0x36')]({'plain':!![]});_0x25eabb[_0xf0e2('0x37')]=[];_0x25eabb['paused']=0x0;_0x25eabb[_0xf0e2('0x38')]=0x0;_0x25eabb[_0xf0e2('0x1c')]=0x0;_0x25eabb[_0xf0e2('0x1d')]=0x0;_0x25eabb[_0xf0e2('0x1e')]=0x0;if(_0xed358c===_0xf0e2('0x17')){_0x25eabb[_0xf0e2('0x1f')]=0x0;_0x25eabb[_0xf0e2('0x39')]=0x0;if(_0x14417b===_0xf0e2('0x21')){_0x25eabb[_0xf0e2('0x23')]=0x0;_0x25eabb[_0xf0e2('0x3a')]=0x0;}}var _0x148436=_['find'](_0xfd4e0a,['id',_0x25eabb['id']]);if(_0x148436)_[_0xf0e2('0x3b')](_0x25eabb,_[_0xf0e2('0x3c')](_0x148436,_0x5e2bf8));return _0x25eabb;});}function updateAgentVoiceStatus(_0x5bfb28,_0x17f2ff,_0xa4b509){var _0x2190ea=_[_0xf0e2('0x3d')](_0xa4b509,['queue',_0x17f2ff['name']]);if(_0x2190ea['length']===0x0)return _0x5bfb28[_0xf0e2('0x39')]=!![];if(_['some'](_0x2190ea,['connectedlinenum',_0x5bfb28['internal']['toString']()]))return _0x5bfb28[_0xf0e2('0x1f')]=!![];if(!_0x5bfb28[_0xf0e2('0x1f')])return _0x5bfb28[_0xf0e2('0x39')]=!![];}function getVoiceQueueAgents(_0x56f10c,_0x4c95d4,_0x470c6d,_0x205cc4){var _0x202511=_[_0xf0e2('0x3e')](_0x4c95d4,['id',_0x56f10c['id']]);if(!_0x202511)return _0x56f10c;return _0x202511[_0xf0e2('0x3f')]({'raw':!![]})[_0xf0e2('0x12')](function(_0x4e2f39){for(var _0x14bd6c=0x0;_0x14bd6c<_0x4e2f39[_0xf0e2('0x40')];_0x14bd6c++){var _0x59ed4f=_[_0xf0e2('0x3e')](_0x470c6d,['id',_0x4e2f39[_0x14bd6c][_0xf0e2('0x41')]]);if(!_0x59ed4f){_0x59ed4f={'id':_0x4e2f39[_0x14bd6c][_0xf0e2('0x41')],'name':_0x4e2f39[_0x14bd6c]['UserId'],'accountcode':'','online':![]};}var _0x2c40f5={'id':_0x59ed4f['id'],'name':_0x59ed4f['name'],'internal':_0x59ed4f[_0xf0e2('0x42')],'online':Boolean(_0x59ed4f[_0xf0e2('0x43')]),'paused':Boolean(_0x4e2f39[_0x14bd6c][_0xf0e2('0x20')])};if(_0x59ed4f[_0xf0e2('0x44')]===_0xf0e2('0x1f'))updateAgentVoiceStatus(_0x2c40f5,_0x56f10c,_0x205cc4);if(_0x2c40f5[_0xf0e2('0x43')])_0x56f10c[_0xf0e2('0x38')]++;if(_0x2c40f5[_0xf0e2('0x39')])_0x56f10c['busy']++;if(_0x2c40f5[_0xf0e2('0x20')]&&!_0x2c40f5['busy']&&!_0x2c40f5[_0xf0e2('0x1f')])_0x56f10c[_0xf0e2('0x20')]++;_0x56f10c[_0xf0e2('0x37')]['push'](_0x2c40f5);}return _0x56f10c;});}function getQueueAgents(_0x4c4bea,_0x598193,_0x1dce60){var _0x1bc026=_0xf0e2('0x45')+_['startCase'](_0x1dce60)+'Queue';var _0x186716=_0x1dce60+_0xf0e2('0x46');return db[_0x1bc026]['findAll']({'where':{[_[_0xf0e2('0x47')](_0x1dce60)+'QueueId']:_0x4c4bea['id']},'raw':!![]})[_0xf0e2('0x12')](function(_0x37e762){for(var _0x4d6996=0x0;_0x4d6996<_0x37e762['length'];_0x4d6996++){var _0x12027a=_[_0xf0e2('0x3e')](_0x598193,['id',_0x37e762[_0x4d6996]['UserId']]);if(!_0x12027a){_0x12027a={'id':_0x37e762[_0x4d6996][_0xf0e2('0x41')],'name':_0x37e762[_0x4d6996]['UserId'],'online':![],['pauseField']:![]};}var _0x18e3e1={'id':_0x12027a['id'],'name':_0x12027a[_0xf0e2('0xe')],'online':Boolean(_0x12027a[_0xf0e2('0x43')]),'paused':Boolean(_0x12027a[_0x186716])};if(_0x18e3e1[_0xf0e2('0x43')])_0x4c4bea[_0xf0e2('0x38')]++;_0x4c4bea[_0xf0e2('0x37')]['push'](_0x18e3e1);}return _0x4c4bea;});}exports['getQueues']=function(_0x2cd2a5,_0x367672){var _0x25c312=[_0xf0e2('0x48'),_0xf0e2('0x49'),_0xf0e2('0x4a'),_0xf0e2('0x4b'),_0xf0e2('0x4c'),_0xf0e2('0x4d'),_0xf0e2('0x17')];var _0x63567e={'count':0x0,'rows':[]},_0x3194d3={},_0x49c423,_0x59689d,_0x74b9b7,_0x374692,_0x490b21;Promise[_0xf0e2('0x4e')]()[_0xf0e2('0x12')](function(){if(_0x2cd2a5['query'][_0xf0e2('0x4f')]){if(!_[_0xf0e2('0x50')](_0x25c312,_0x2cd2a5['query'][_0xf0e2('0x4f')][_0xf0e2('0x51')]()))throw new Error(_0xf0e2('0x52'));_0x49c423=_0x2cd2a5['query']['channel']['toLowerCase']();}var _0x3f388f=_[_0xf0e2('0x47')](_0x49c423)+_0xf0e2('0x53');var _0x11366d=_[_0xf0e2('0x35')](db[_0x3f388f][_0xf0e2('0x54')],function(_0x33db20){return{'name':_0x33db20[_0xf0e2('0x55')],'type':_0x33db20[_0xf0e2('0x56')][_0xf0e2('0x57')]};});_0x3194d3=qs[_0xf0e2('0x58')](_0x11366d,_0x2cd2a5);if(_0x2cd2a5[_0xf0e2('0x59')][_0xf0e2('0x5a')]===_0xf0e2('0x59')){var _0xe12b1e={'params':{'id':_0x2cd2a5[_0xf0e2('0x59')][_0xf0e2('0x5b')]},'query':{'section':_0x49c423===_0xf0e2('0x17')&&_0x2cd2a5[_0xf0e2('0x5c')][_0xf0e2('0x56')]==='outbound'?_0xf0e2('0x5d'):_[_0xf0e2('0x47')](_0x49c423)+_0xf0e2('0x18'),'type':_0x2cd2a5[_0xf0e2('0x5c')][_0xf0e2('0x56')],'nolimit':!![],'sort':_0xf0e2('0xe'),'filter':_0x2cd2a5[_0xf0e2('0x5c')][_0xf0e2('0x3d')]}};return db['UserProfile'][_0xf0e2('0x5e')](_0xe12b1e);}return db[_0x3f388f]['findAndCountAll'](_0x3194d3);})['then'](function(_0x3d55bd){_0x63567e['count']=_0x3d55bd['count'];_0x59689d=_0x3d55bd[_0xf0e2('0x5f')];return getRealtimeQueues(_0x2cd2a5,_0x49c423);})[_0xf0e2('0x12')](function(_0x466beb){_0x374692=_0x466beb['rows'];return getRealtimeAgents();})['then'](function(_0x2074d7){_0x74b9b7=_0x2074d7[_0xf0e2('0x5f')];if(_0x49c423!=_0xf0e2('0x17'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x6e2f4e){_0x490b21=_0x6e2f4e?_0x6e2f4e['rows']:[];return initializeQueues(_0x59689d,_0x374692,_0x49c423,_0x2cd2a5['query']['type']);})[_0xf0e2('0x12')](function(_0x27c2f7){var _0x1fefe0=_0x27c2f7[_0xf0e2('0x35')](function(_0x3ffc71){if(_0x49c423===_0xf0e2('0x17'))return getVoiceQueueAgents(_0x3ffc71,_0x59689d,_0x74b9b7,_0x490b21);else return getQueueAgents(_0x3ffc71,_0x74b9b7,_0x49c423);});return Promise[_0xf0e2('0x60')](_0x1fefe0);})[_0xf0e2('0x12')](function(_0x493034){_0x63567e[_0xf0e2('0x5f')]=_0x493034;return _0x63567e;})[_0xf0e2('0x12')](respondWithFilteredResult(_0x367672,_0x3194d3))['catch'](handleError(_0x367672,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5a93f35..32924a1 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1710b7,_0x148ee7){var _0xaeabc7=function(_0x3dea58){while(--_0x3dea58){_0x1710b7['push'](_0x1710b7['shift']());}};_0xaeabc7(++_0x148ee7);}(_0x70e0,0x17b));var _0x070e=function(_0x2fb89c,_0x9e8a58){_0x2fb89c=_0x2fb89c-0x0;var _0x288c2c=_0x70e0[_0x2fb89c];return _0x288c2c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x49b59f,_0x1f3a28){var _0x46f0de=function(_0x3841f1){while(--_0x3841f1){_0x49b59f['push'](_0x49b59f['shift']());}};_0x46f0de(++_0x1f3a28);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2cd3acf..5d34f0e 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 _0x46ed=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x2a6f78,_0x57aee6){var _0x37f15e=function(_0x154ef8){while(--_0x154ef8){_0x2a6f78['push'](_0x2a6f78['shift']());}};_0x37f15e(++_0x57aee6);}(_0x46ed,0x168));var _0xd46e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46ed[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd46e('0x2')]},'scheduledat':{'type':Sequelize[_0xd46e('0x3')]},'uniqueid':{'type':Sequelize[_0xd46e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xd46e('0x3')]},'ringtime':{'type':Sequelize[_0xd46e('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd46e('0x2')]},'membername':{'type':Sequelize[_0xd46e('0x2')]}}; \ No newline at end of file +var _0x7919=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x5528fa,_0x4f0b2e){var _0x489299=function(_0x5db840){while(--_0x5db840){_0x5528fa['push'](_0x5528fa['shift']());}};_0x489299(++_0x4f0b2e);}(_0x7919,0xeb));var _0x9791=function(_0x543d2d,_0x4436e2){_0x543d2d=_0x543d2d-0x0;var _0x3d5343=_0x7919[_0x543d2d];return _0x3d5343;};'use strict';var Sequelize=require(_0x9791('0x0'));module[_0x9791('0x1')]={'state':{'type':Sequelize[_0x9791('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9791('0x3')]},'scheduledat':{'type':Sequelize[_0x9791('0x4')]},'uniqueid':{'type':Sequelize[_0x9791('0x3')]},'starttime':{'type':Sequelize[_0x9791('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9791('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9791('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9791('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 586a92b..e356f42 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 _0xbb68=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x975c31,_0x4a4036){var _0x37beb3=function(_0x11e937){while(--_0x11e937){_0x975c31['push'](_0x975c31['shift']());}};_0x37beb3(++_0x4a4036);}(_0xbb68,0x180));var _0x8bb6=function(_0x2e7f0a,_0x219118){_0x2e7f0a=_0x2e7f0a-0x0;var _0x1539a4=_0xbb68[_0x2e7f0a];return _0x1539a4;};'use strict';var _=require(_0x8bb6('0x0'));var util=require(_0x8bb6('0x1'));var logger=require(_0x8bb6('0x2'))(_0x8bb6('0x3'));var moment=require('moment');var BPromise=require(_0x8bb6('0x4'));var rp=require(_0x8bb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bb6('0x6'));var config=require(_0x8bb6('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x8da56d,_0x525ed2){return _0x8da56d[_0x8bb6('0x8')](_0x8bb6('0x9'),attributes,{'tableName':_0x8bb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1323=['path','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','../../config/logger','api','moment','request-promise'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x1323,0xd8));var _0x3132=function(_0x1c0982,_0x1247ce){_0x1c0982=_0x1c0982-0x0;var _0x2106a4=_0x1323[_0x1c0982];return _0x2106a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3132('0x0'))(_0x3132('0x1'));var moment=require(_0x3132('0x2'));var BPromise=require('bluebird');var rp=require(_0x3132('0x3'));var fs=require('fs');var path=require(_0x3132('0x4'));var rimraf=require('rimraf');var config=require(_0x3132('0x5'));var attributes=require(_0x3132('0x6'));module[_0x3132('0x7')]=function(_0x2ce1d1,_0x12a011){return _0x2ce1d1[_0x3132('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x3132('0x9'),'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 a583fdb..6f38b4c 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 _0xf5ec=['jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xf5ec,0x80));var _0xcf5e=function(_0x54b293,_0x199a08){_0x54b293=_0x54b293-0x0;var _0x201e55=_0xf5ec[_0x54b293];return _0x201e55;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcf5e('0x0'));var BPromise=require(_0xcf5e('0x1'));var rs=require(_0xcf5e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf5e('0x3'))['db'];var utils=require(_0xcf5e('0x4'));var logger=require(_0xcf5e('0x5'))(_0xcf5e('0x6'));var config=require('../../config/environment');var jayson=require(_0xcf5e('0x7'));var client=jayson[_0xcf5e('0x8')][_0xcf5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b6aa1,_0x2fcb95,_0x432d25){return new BPromise(function(_0x2c01f3,_0x2171bb){return client[_0xcf5e('0xa')](_0x4b6aa1,_0x432d25)[_0xcf5e('0xb')](function(_0x553b7a){logger[_0xcf5e('0xc')](_0xcf5e('0xd'),_0x2fcb95,_0xcf5e('0xe'));logger[_0xcf5e('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2fcb95,_0xcf5e('0xe'),JSON[_0xcf5e('0x10')](_0x553b7a));if(_0x553b7a[_0xcf5e('0x11')]){if(_0x553b7a[_0xcf5e('0x11')][_0xcf5e('0x12')]===0x1f4){logger[_0xcf5e('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2fcb95,_0x553b7a[_0xcf5e('0x11')]['message']);return _0x2171bb(_0x553b7a[_0xcf5e('0x11')]['message']);}logger[_0xcf5e('0x11')](_0xcf5e('0xd'),_0x2fcb95,_0x553b7a[_0xcf5e('0x11')][_0xcf5e('0x13')]);return _0x2c01f3(_0x553b7a['error'][_0xcf5e('0x13')]);}else{logger[_0xcf5e('0xc')](_0xcf5e('0xd'),_0x2fcb95,_0xcf5e('0xe'));_0x2c01f3(_0x553b7a[_0xcf5e('0x14')]['message']);}})['catch'](function(_0x550f88){logger[_0xcf5e('0x11')](_0xcf5e('0xd'),_0x2fcb95,_0x550f88);_0x2171bb(_0x550f88);});});}exports[_0xcf5e('0x15')]=function(_0x88cec2){var _0x260594=this;return new Promise(function(_0x28bf59,_0x51d93a){return db[_0xcf5e('0x16')][_0xcf5e('0x17')](_0x88cec2[_0xcf5e('0x18')],{'raw':_0x88cec2['options']?_0x88cec2[_0xcf5e('0x19')][_0xcf5e('0x1a')]===undefined?!![]:![]:!![]})[_0xcf5e('0xb')](function(_0x4db609){logger[_0xcf5e('0xc')](_0xcf5e('0x15'),_0x88cec2);logger['debug']('CreateReportAgentPreview',_0x88cec2,JSON[_0xcf5e('0x10')](_0x4db609));_0x28bf59(_0x4db609);})['catch'](function(_0x38c44e){logger[_0xcf5e('0x11')]('CreateReportAgentPreview',_0x38c44e[_0xcf5e('0x13')],_0x88cec2);_0x51d93a(_0x260594['error'](0x1f4,_0x38c44e['message']));});});}; \ No newline at end of file +var _0x1438=['ReportAgentPreview','create','body','options','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateReportAgentPreview'];(function(_0x54e53e,_0x3eb4fe){var _0x98e574=function(_0x1e0b30){while(--_0x1e0b30){_0x54e53e['push'](_0x54e53e['shift']());}};_0x98e574(++_0x3eb4fe);}(_0x1438,0xad));var _0x8143=function(_0xf219b,_0x1ad38e){_0xf219b=_0xf219b-0x0;var _0x4db27e=_0x1438[_0xf219b];return _0x4db27e;};'use strict';var _=require(_0x8143('0x0'));var util=require('util');var moment=require(_0x8143('0x1'));var BPromise=require('bluebird');var rs=require(_0x8143('0x2'));var fs=require('fs');var Redis=require(_0x8143('0x3'));var db=require(_0x8143('0x4'))['db'];var utils=require(_0x8143('0x5'));var logger=require(_0x8143('0x6'))(_0x8143('0x7'));var config=require(_0x8143('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8143('0x9')][_0x8143('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x87422e,_0x362939,_0x34e96b){return new BPromise(function(_0x140cac,_0xae9415){return client[_0x8143('0xb')](_0x87422e,_0x34e96b)[_0x8143('0xc')](function(_0x361869){logger[_0x8143('0xd')](_0x8143('0xe'),_0x362939,_0x8143('0xf'));logger[_0x8143('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x362939,_0x8143('0xf'),JSON[_0x8143('0x11')](_0x361869));if(_0x361869[_0x8143('0x12')]){if(_0x361869[_0x8143('0x12')][_0x8143('0x13')]===0x1f4){logger[_0x8143('0x12')](_0x8143('0xe'),_0x362939,_0x361869[_0x8143('0x12')][_0x8143('0x14')]);return _0xae9415(_0x361869[_0x8143('0x12')][_0x8143('0x14')]);}logger[_0x8143('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x362939,_0x361869[_0x8143('0x12')][_0x8143('0x14')]);return _0x140cac(_0x361869[_0x8143('0x12')][_0x8143('0x14')]);}else{logger[_0x8143('0xd')](_0x8143('0xe'),_0x362939,_0x8143('0xf'));_0x140cac(_0x361869[_0x8143('0x15')][_0x8143('0x14')]);}})['catch'](function(_0x2999e2){logger[_0x8143('0x12')](_0x8143('0xe'),_0x362939,_0x2999e2);_0xae9415(_0x2999e2);});});}exports[_0x8143('0x16')]=function(_0x48a87f){var _0x17fb57=this;return new Promise(function(_0x39274d,_0x1d05cc){return db[_0x8143('0x17')][_0x8143('0x18')](_0x48a87f[_0x8143('0x19')],{'raw':_0x48a87f['options']?_0x48a87f[_0x8143('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5a49ee){logger[_0x8143('0xd')](_0x8143('0x16'),_0x48a87f);logger['debug'](_0x8143('0x16'),_0x48a87f,JSON[_0x8143('0x11')](_0x5a49ee));_0x39274d(_0x5a49ee);})[_0x8143('0x1b')](function(_0x4ce134){logger[_0x8143('0x12')](_0x8143('0x16'),_0x4ce134[_0x8143('0x14')],_0x48a87f);_0x1d05cc(_0x17fb57[_0x8143('0x12')](0x1f4,_0x4ce134[_0x8143('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7a396e2..c868c63 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 _0x5b8b=['isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','path','express','Router','../../components/auth/service','./rpc.controller'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5b8b,0x1e0));var _0xb5b8=function(_0x2de81b,_0x322f1d){_0x2de81b=_0x2de81b-0x0;var _0x3df553=_0x5b8b[_0x2de81b];return _0x3df553;};'use strict';var multer=require(_0xb5b8('0x0'));var util=require('util');var path=require(_0xb5b8('0x1'));var express=require(_0xb5b8('0x2'));var router=express[_0xb5b8('0x3')]();var auth=require(_0xb5b8('0x4'));var controller=require(_0xb5b8('0x5'));router['get']('/voice/channels',auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x7')]);router[_0xb5b8('0x8')](_0xb5b8('0x9'),auth[_0xb5b8('0x6')](),controller['voiceChannelMixMonitor']);router[_0xb5b8('0x8')](_0xb5b8('0xa'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0xb')]);router[_0xb5b8('0x8')](_0xb5b8('0xc'),auth[_0xb5b8('0x6')](),controller['voiceQueues']);router[_0xb5b8('0x8')](_0xb5b8('0xd'),auth['isAuthenticated'](),controller[_0xb5b8('0xe')]);router[_0xb5b8('0x8')](_0xb5b8('0xf'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x10')]);router[_0xb5b8('0x8')](_0xb5b8('0x11'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x12')]);router[_0xb5b8('0x8')](_0xb5b8('0x13'),auth[_0xb5b8('0x6')](),controller['openchannelQueues']);router['get'](_0xb5b8('0x14'),auth[_0xb5b8('0x6')](),controller['smsQueues']);router[_0xb5b8('0x8')](_0xb5b8('0x15'),auth[_0xb5b8('0x6')](),controller['whatsappQueues']);router[_0xb5b8('0x8')](_0xb5b8('0x16'),auth['isAuthenticated'](),controller['faxQueues']);router[_0xb5b8('0x8')](_0xb5b8('0x17'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x18')]);router[_0xb5b8('0x8')](_0xb5b8('0x19'),auth[_0xb5b8('0x6')](),controller['voiceQueuesChannels']);router['get'](_0xb5b8('0x1a'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x1c')]);router['get'](_0xb5b8('0x1d'),auth[_0xb5b8('0x6')](),controller['voiceQueuesChannelRedirect']);router['get'](_0xb5b8('0x1e'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x1f')]);router['put'](_0xb5b8('0x1e'),auth[_0xb5b8('0x6')](),controller['updateVoiceQueue']);router['get'](_0xb5b8('0x20'),auth['isAuthenticated'](),controller['outbound']);router['get'](_0xb5b8('0x21'),auth['isAuthenticated'](),controller[_0xb5b8('0x22')]);router[_0xb5b8('0x8')](_0xb5b8('0x23'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x24')]);router[_0xb5b8('0x25')](_0xb5b8('0x26'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x27')]);router[_0xb5b8('0x8')]('/telephones',auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x28')]);router[_0xb5b8('0x8')]('/trunks',auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x29')]);router['get'](_0xb5b8('0x2a'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x2b')]);router[_0xb5b8('0x8')](_0xb5b8('0x2c'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x2d')]);router['get'](_0xb5b8('0x2e'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x2f')]);router[_0xb5b8('0x8')](_0xb5b8('0x30'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x31')]);router[_0xb5b8('0x8')](_0xb5b8('0x32'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x33')]);router[_0xb5b8('0x8')](_0xb5b8('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xb5b8('0x8')](_0xb5b8('0x35'),auth[_0xb5b8('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0xb5b8('0x8')](_0xb5b8('0x36'),auth['isAuthenticated'](),controller[_0xb5b8('0x37')]);router[_0xb5b8('0x8')](_0xb5b8('0x38'),auth['isAuthenticated'](),controller[_0xb5b8('0x39')]);router['post'](_0xb5b8('0x3a'),auth[_0xb5b8('0x6')](),controller['queueNotify'](_0xb5b8('0x3b')));router[_0xb5b8('0x8')](_0xb5b8('0x3c'),auth[_0xb5b8('0x6')](),controller['showMailQueues']);router[_0xb5b8('0x3d')](_0xb5b8('0x3e'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x3f')](_0xb5b8('0x40')));router[_0xb5b8('0x8')](_0xb5b8('0x41'),auth[_0xb5b8('0x6')](),controller['showChatQueues']);router[_0xb5b8('0x3d')](_0xb5b8('0x42'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x3f')](_0xb5b8('0x43')));router['get'](_0xb5b8('0x44'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x45')]);router[_0xb5b8('0x3d')](_0xb5b8('0x46'),auth['isAuthenticated'](),controller[_0xb5b8('0x3f')](_0xb5b8('0x47')));router['get'](_0xb5b8('0x48'),auth[_0xb5b8('0x6')](),controller['showOpenchannelQueues']);router[_0xb5b8('0x3d')](_0xb5b8('0x49'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x3f')]('sms'));router[_0xb5b8('0x3d')](_0xb5b8('0x4a'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x3f')](_0xb5b8('0x4b')));router[_0xb5b8('0x8')](_0xb5b8('0x4c'),auth['isAuthenticated'](),controller[_0xb5b8('0x4d')]);router['get'](_0xb5b8('0x4e'),auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x4f')]);router[_0xb5b8('0x3d')]('/agents/:id/notify',auth[_0xb5b8('0x6')](),controller[_0xb5b8('0x50')]);module['exports']=router; \ No newline at end of file +var _0x0be7=['whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','get','/voice/queues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannel','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x8338b1,_0x1eb097){var _0x4f4e95=function(_0x19fe46){while(--_0x19fe46){_0x8338b1['push'](_0x8338b1['shift']());}};_0x4f4e95(++_0x1eb097);}(_0x0be7,0x158));var _0x70be=function(_0x3a6a05,_0x2f515e){_0x3a6a05=_0x3a6a05-0x0;var _0x4e0452=_0x0be7[_0x3a6a05];return _0x4e0452;};'use strict';var multer=require(_0x70be('0x0'));var util=require(_0x70be('0x1'));var path=require(_0x70be('0x2'));var express=require(_0x70be('0x3'));var router=express['Router']();var auth=require(_0x70be('0x4'));var controller=require('./rpc.controller');router['get'](_0x70be('0x5'),auth[_0x70be('0x6')](),controller['voiceChannels']);router['get'](_0x70be('0x7'),auth[_0x70be('0x6')](),controller['voiceChannelMixMonitor']);router['get'](_0x70be('0x8'),auth[_0x70be('0x6')](),controller[_0x70be('0x9')]);router[_0x70be('0xa')](_0x70be('0xb'),auth[_0x70be('0x6')](),controller['voiceQueues']);router[_0x70be('0xa')](_0x70be('0xc'),auth['isAuthenticated'](),controller[_0x70be('0xd')]);router['get'](_0x70be('0xe'),auth[_0x70be('0x6')](),controller['mailQueues']);router['get'](_0x70be('0xf'),auth[_0x70be('0x6')](),controller[_0x70be('0x10')]);router[_0x70be('0xa')](_0x70be('0x11'),auth[_0x70be('0x6')](),controller[_0x70be('0x12')]);router[_0x70be('0xa')](_0x70be('0x13'),auth[_0x70be('0x6')](),controller[_0x70be('0x14')]);router[_0x70be('0xa')](_0x70be('0x15'),auth[_0x70be('0x6')](),controller['whatsappQueues']);router[_0x70be('0xa')](_0x70be('0x16'),auth[_0x70be('0x6')](),controller[_0x70be('0x17')]);router[_0x70be('0xa')](_0x70be('0x18'),auth[_0x70be('0x6')](),controller['voiceQueuesPreview']);router['get'](_0x70be('0x19'),auth[_0x70be('0x6')](),controller['voiceQueuesChannels']);router[_0x70be('0xa')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x70be('0x1a')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x70be('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x70be('0xa')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x70be('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x70be('0xa')](_0x70be('0x1b'),auth[_0x70be('0x6')](),controller[_0x70be('0x1c')]);router['put'](_0x70be('0x1b'),auth[_0x70be('0x6')](),controller[_0x70be('0x1d')]);router['get'](_0x70be('0x1e'),auth[_0x70be('0x6')](),controller[_0x70be('0x1f')]);router['get'](_0x70be('0x20'),auth['isAuthenticated'](),controller[_0x70be('0x21')]);router[_0x70be('0xa')](_0x70be('0x22'),auth[_0x70be('0x6')](),controller[_0x70be('0x23')]);router['put'](_0x70be('0x24'),auth[_0x70be('0x6')](),controller[_0x70be('0x25')]);router['get']('/telephones',auth[_0x70be('0x6')](),controller[_0x70be('0x26')]);router[_0x70be('0xa')]('/trunks',auth[_0x70be('0x6')](),controller[_0x70be('0x27')]);router[_0x70be('0xa')](_0x70be('0x28'),auth[_0x70be('0x6')](),controller[_0x70be('0x29')]);router[_0x70be('0xa')](_0x70be('0x2a'),auth[_0x70be('0x6')](),controller[_0x70be('0x2b')]);router[_0x70be('0xa')]('/chat/queues/waitinginteractions',auth[_0x70be('0x6')](),controller[_0x70be('0x2c')]);router[_0x70be('0xa')](_0x70be('0x2d'),auth['isAuthenticated'](),controller[_0x70be('0x2e')]);router[_0x70be('0xa')](_0x70be('0x2f'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x70be('0xa')](_0x70be('0x30'),auth['isAuthenticated'](),controller[_0x70be('0x31')]);router[_0x70be('0xa')]('/sms/queues/waitinginteractions',auth[_0x70be('0x6')](),controller[_0x70be('0x32')]);router[_0x70be('0xa')]('/whatsapp/queues/waitinginteractions',auth[_0x70be('0x6')](),controller[_0x70be('0x33')]);router[_0x70be('0xa')](_0x70be('0x34'),auth['isAuthenticated'](),controller[_0x70be('0x35')]);router[_0x70be('0x36')](_0x70be('0x37'),auth[_0x70be('0x6')](),controller[_0x70be('0x38')](_0x70be('0x39')));router[_0x70be('0xa')](_0x70be('0x3a'),auth['isAuthenticated'](),controller[_0x70be('0x3b')]);router['post'](_0x70be('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0x70be('0x3d')));router['get'](_0x70be('0x3e'),auth[_0x70be('0x6')](),controller[_0x70be('0x3f')]);router['post'](_0x70be('0x40'),auth['isAuthenticated'](),controller['queueNotify']('fax'));router['get'](_0x70be('0x41'),auth[_0x70be('0x6')](),controller[_0x70be('0x42')]);router[_0x70be('0x36')](_0x70be('0x43'),auth[_0x70be('0x6')](),controller[_0x70be('0x38')](_0x70be('0x44')));router['get'](_0x70be('0x45'),auth[_0x70be('0x6')](),controller[_0x70be('0x46')]);router[_0x70be('0x36')](_0x70be('0x47'),auth['isAuthenticated'](),controller[_0x70be('0x38')](_0x70be('0x48')));router['post']('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x70be('0x49')));router[_0x70be('0xa')](_0x70be('0x4a'),auth[_0x70be('0x6')](),controller['showSmsQueues']);router[_0x70be('0xa')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x70be('0x4b')]);router['post'](_0x70be('0x4c'),auth[_0x70be('0x6')](),controller[_0x70be('0x4d')]);module[_0x70be('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 163b9c8..5df899b 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 _0xd8fb=['ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Message','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','find','rows','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd8fb,0x99));var _0xbd8f=function(_0xf76bec,_0x238dfa){_0xf76bec=_0xf76bec-0x0;var _0x2d5b64=_0xd8fb[_0xf76bec];return _0x2d5b64;};'use strict';var BPromise=require(_0xbd8f('0x0'));var moment=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));var util=require(_0xbd8f('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xbd8f('0x4'));var amiClient=jayson[_0xbd8f('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xbd8f('0x5')][_0xbd8f('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0xbd8f('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){var _0x493298=_0x578499?_0x578499:amiClient;return _0x493298['request'](_0x4e97cf,_0xf503c4)[_0xbd8f('0x7')](function(_0x2393a9){if(_0x2393a9[_0xbd8f('0x8')]){if(_0x2393a9['error'][_0xbd8f('0x9')]===0x1f4){return _0x403edc(_0x2393a9[_0xbd8f('0x8')]['message']);}return _0x197827(_0x2393a9['error'][_0xbd8f('0xa')]);}else{_0x197827(_0x2393a9[_0xbd8f('0xb')]);}})[_0xbd8f('0xc')](function(_0x5d5705){_0x403edc(_0x5d5705);});});}function respondWithResult(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xc8;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0xd')](_0x159f09)[_0xbd8f('0xe')](_0x39be16);}return _0x230988[_0xbd8f('0xf')](0x194);};}function handleError(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0x1f4;return function(_0x14606c){logger['error'](_0x14606c[_0xbd8f('0x10')]);if(_0x14606c[_0xbd8f('0x11')]){delete _0x14606c[_0xbd8f('0x11')];}_0x37d4d5[_0xbd8f('0xd')](_0x29ffe8)['send'](_0x14606c);};}function findById(_0x174929){return function(_0x63db18){if(!_['isNil'](_0x174929)&&!_[_0xbd8f('0x12')](_0x63db18)&&!_[_0xbd8f('0x12')](_0x63db18['rows'])){return _[_0xbd8f('0x13')](_0x63db18[_0xbd8f('0x14')],function(_0x47d317){return _0x47d317['id']==_0x174929;});}return null;};}exports['voiceChannels']=function(_0x33f77c,_0x5d2fdb){return respondWithRpcPromise('VoiceChannels',_0x33f77c[_0xbd8f('0x15')])['then'](respondWithResult(_0x5d2fdb,null))[_0xbd8f('0xc')](handleError(_0x5d2fdb,null));};exports[_0xbd8f('0x16')]=function(_0xb47c8e,_0x897f25){return respondWithRpcPromise(_0xbd8f('0x17'),_[_0xbd8f('0x18')](_0xb47c8e[_0xbd8f('0x15')],_0xb47c8e[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x897f25,null))[_0xbd8f('0xc')](handleError(_0x897f25,null));};exports[_0xbd8f('0x1a')]=function(_0x1628f5,_0x2f7c45){return respondWithRpcPromise(_0xbd8f('0x1b'),_[_0xbd8f('0x18')](_0x1628f5[_0xbd8f('0x15')],_0x1628f5[_0xbd8f('0x19')]))['then'](respondWithResult(_0x2f7c45,null))[_0xbd8f('0xc')](handleError(_0x2f7c45,null));};exports[_0xbd8f('0x1c')]=function(_0x1f9fcc,_0x2f3df7){return respondWithRpcPromise(_0xbd8f('0x1d'),_0x1f9fcc[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x2f3df7,null))[_0xbd8f('0xc')](handleError(_0x2f3df7,null));};exports['showVoiceQueues']=function(_0x40cb43,_0x421f3e){return respondWithRpcPromise('VoiceQueues',_0x40cb43[_0xbd8f('0x15')])['then'](findById(_0x40cb43[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x421f3e,null))[_0xbd8f('0xc')](handleError(_0x421f3e,null));};exports[_0xbd8f('0x1e')]=function(_0x2aefa2,_0x247b07){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xbd8f('0x18')](_0x2aefa2[_0xbd8f('0x1f')],_0x2aefa2[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x247b07,null))[_0xbd8f('0xc')](handleError(_0x247b07,null));};exports[_0xbd8f('0x20')]=function(_0x2a4b32,_0x479a0c){return respondWithRpcPromise(_0xbd8f('0x21'),_[_0xbd8f('0x18')](_0x2a4b32[_0xbd8f('0x15')],_0x2a4b32[_0xbd8f('0x19')]))['then'](respondWithResult(_0x479a0c,null))['catch'](handleError(_0x479a0c,null));};exports[_0xbd8f('0x22')]=function(_0x3cdec2,_0x2fd6f8){return respondWithRpcPromise(_0xbd8f('0x23'),_0x3cdec2['query'])[_0xbd8f('0x7')](respondWithResult(_0x2fd6f8,null))[_0xbd8f('0xc')](handleError(_0x2fd6f8,null));};exports[_0xbd8f('0x24')]=function(_0x2137ed,_0x25ad9a){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xbd8f('0x18')](_0x2137ed[_0xbd8f('0x15')],_0x2137ed[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x25ad9a,null))[_0xbd8f('0xc')](handleError(_0x25ad9a,null));};exports['voiceQueuesChannelHangup']=function(_0x24e5f4,_0x5f404e){return respondWithRpcPromise(_0xbd8f('0x25'),_[_0xbd8f('0x18')](_0x24e5f4[_0xbd8f('0x15')],_0x24e5f4[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x5f404e,null))[_0xbd8f('0xc')](handleError(_0x5f404e,null));};exports['voiceQueuesChannelRedirect']=function(_0x4bafcd,_0x4c9a8d){return respondWithRpcPromise(_0xbd8f('0x26'),_[_0xbd8f('0x18')](_0x4bafcd[_0xbd8f('0x15')],_0x4bafcd[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x4c9a8d,null))[_0xbd8f('0xc')](handleError(_0x4c9a8d,null));};exports[_0xbd8f('0x27')]=function(_0x30c1c2,_0x2d4882){return respondWithRpcPromise(_0xbd8f('0x28'),_0x30c1c2[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x2d4882,null))[_0xbd8f('0xc')](handleError(_0x2d4882,null));};exports[_0xbd8f('0x29')]=function(_0x391d45,_0x50e081){return respondWithRpcPromise(_0xbd8f('0x2a'),_0x391d45[_0xbd8f('0x15')])['then'](respondWithResult(_0x50e081,null))[_0xbd8f('0xc')](handleError(_0x50e081,null));};exports[_0xbd8f('0x2b')]=function(_0x3d3902,_0x582bcf){var _0x21da54;return respondWithRpcPromise('Agents',_0x3d3902[_0xbd8f('0x15')])[_0xbd8f('0x7')](function(_0x298952){_0x21da54=_0x298952;return respondWithRpcPromise('Agents',_0x3d3902[_0xbd8f('0x15')],routingClient);})[_0xbd8f('0x7')](function(_0xdab323){return _['merge']({},_0xdab323,_0x21da54);})[_0xbd8f('0x7')](respondWithResult(_0x582bcf,null))[_0xbd8f('0xc')](handleError(_0x582bcf,null));};exports[_0xbd8f('0x2c')]=function(_0x351027,_0x280d95){if(_0x351027[_0xbd8f('0x1f')]&&_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')]&&_0x351027[_0xbd8f('0x2e')]&&_0x351027['user']['name']){for(var _0x2907a3 in _0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')]){if(_0x351027[_0xbd8f('0x1f')]['interaction'][_0xbd8f('0x2f')](_0x2907a3)){db[_0xbd8f('0x30')][_0xbd8f('0x31')]({'where':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x351027['body'][_0xbd8f('0x2d')][_0x2907a3]&&_0x351027['body'][_0xbd8f('0x2d')][_0x2907a3][_0xbd8f('0x32')]?{'$notIn':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3]}:{'$ne':null}}})[_0xbd8f('0x7')](function(_0x151f82){var _0x1ea49a=moment()[_0xbd8f('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x36c43f=0x0,_0x2fbbbe=_0x151f82[_0xbd8f('0x32')];_0x36c43f<_0x2fbbbe;_0x36c43f+=0x1){_0x151f82[_0x36c43f][_0xbd8f('0x34')]({'exitAt':_0x1ea49a});}});for(var _0x229bc0=0x0;_0x229bc0<_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3][_0xbd8f('0x32')];_0x229bc0+=0x1){db['MemberReport'][_0xbd8f('0x35')]({'where':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'type':_0xbd8f('0x36'),'uniqueid':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3][_0x229bc0],'exitAt':null},'defaults':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'interface':_[_0xbd8f('0x12')](_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x37')])?util[_0xbd8f('0x33')](_0xbd8f('0x38'),_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')]):_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x37')],'type':_0xbd8f('0x36'),'enterAt':moment()[_0xbd8f('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xbd8f('0x39'),'internal':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x3a')],'uniqueid':_0x351027[_0xbd8f('0x1f')]['interaction'][_0x2907a3][_0x229bc0]}});}}}}return respondWithRpcPromise(_0xbd8f('0x3b'),{'id':_0x351027['params']['id'],'capacity':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x3c')]},routingClient)[_0xbd8f('0x7')](respondWithResult(_0x280d95,null))[_0xbd8f('0xc')](handleError(_0x280d95,null));};exports['telephones']=function(_0x3964f5,_0x35b814){return respondWithRpcPromise(_0xbd8f('0x3d'),_0x3964f5[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x35b814,null))[_0xbd8f('0xc')](handleError(_0x35b814,null));};exports['trunks']=function(_0x42a597,_0x4a2da8){return respondWithRpcPromise(_0xbd8f('0x3e'),_0x42a597[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x4a2da8,null))[_0xbd8f('0xc')](handleError(_0x4a2da8,null));};exports[_0xbd8f('0x3f')]=function(_0x358424,_0x2a331d){return respondWithRpcPromise(_0xbd8f('0x40'),_0x358424[_0xbd8f('0x15')])['then'](respondWithResult(_0x2a331d,null))[_0xbd8f('0xc')](handleError(_0x2a331d,null));};exports['chatQueues']=function(_0xd09e5,_0xb04dae){return respondWithRpcPromise('ChatQueues',_0xd09e5[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0xb04dae,null))['catch'](handleError(_0xb04dae,null));};exports['showChatQueues']=function(_0x55de68,_0x4042e0){return respondWithRpcPromise(_0xbd8f('0x41'),_0x55de68[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x55de68[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x4042e0,null))['catch'](handleError(_0x4042e0,null));};exports[_0xbd8f('0x42')]=function(_0x3848cb,_0x21d40b){return respondWithRpcPromise(_0xbd8f('0x43'),_0x3848cb[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x21d40b,null))[_0xbd8f('0xc')](handleError(_0x21d40b,null));};exports['showMailQueues']=function(_0x9cf2d5,_0x40c834){return respondWithRpcPromise(_0xbd8f('0x43'),_0x9cf2d5['query'],routingClient)[_0xbd8f('0x7')](findById(_0x9cf2d5[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x40c834,null))[_0xbd8f('0xc')](handleError(_0x40c834,null));};exports['mailAccounts']=function(_0x5327f2,_0x388af8){return respondWithRpcPromise('MailAccounts',_0x5327f2[_0xbd8f('0x15')],mailClient)[_0xbd8f('0x7')](respondWithResult(_0x388af8,null))[_0xbd8f('0xc')](handleError(_0x388af8,null));};exports[_0xbd8f('0x44')]=function(_0x4a86a9,_0x5ea275){return respondWithRpcPromise(_0xbd8f('0x45'),_0x4a86a9[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5ea275,null))[_0xbd8f('0xc')](handleError(_0x5ea275,null));};exports[_0xbd8f('0x46')]=function(_0x21cad7,_0x31adfb){return respondWithRpcPromise(_0xbd8f('0x45'),_0x21cad7[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x21cad7[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x31adfb,null))[_0xbd8f('0xc')](handleError(_0x31adfb,null));};exports[_0xbd8f('0x47')]=function(_0x225ebd,_0x12ee82){return respondWithRpcPromise(_0xbd8f('0x48'),_0x225ebd[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x12ee82,null))[_0xbd8f('0xc')](handleError(_0x12ee82,null));};exports[_0xbd8f('0x49')]=function(_0x538fd7,_0x5e18fc){return respondWithRpcPromise(_0xbd8f('0x48'),_0x538fd7[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x538fd7['params']['id']))['then'](respondWithResult(_0x5e18fc,null))[_0xbd8f('0xc')](handleError(_0x5e18fc,null));};exports['whatsappQueues']=function(_0x565e63,_0x5b5bd8){return respondWithRpcPromise('WhatsappQueues',_0x565e63['query'],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5b5bd8,null))['catch'](handleError(_0x5b5bd8,null));};exports[_0xbd8f('0x4a')]=function(_0x400aac,_0x53f297){return respondWithRpcPromise(_0xbd8f('0x4b'),_0x400aac[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x400aac[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x53f297,null))['catch'](handleError(_0x53f297,null));};exports['faxQueues']=function(_0x378e72,_0x44469e){return respondWithRpcPromise(_0xbd8f('0x4c'),_0x378e72[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x44469e,null))[_0xbd8f('0xc')](handleError(_0x44469e,null));};exports['showFaxQueues']=function(_0x4eddf2,_0x467b0f){return respondWithRpcPromise(_0xbd8f('0x4c'),_0x4eddf2['query'],routingClient)[_0xbd8f('0x7')](findById(_0x4eddf2[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x467b0f,null))[_0xbd8f('0xc')](handleError(_0x467b0f,null));};exports[_0xbd8f('0x4d')]=function(_0x10268a,_0x5a8c8f){return respondWithRpcPromise('FaxAccounts',_0x10268a[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x5a8c8f,null))[_0xbd8f('0xc')](handleError(_0x5a8c8f,null));};exports[_0xbd8f('0x4e')]=function(_0x41be86,_0x5b900c){return respondWithRpcPromise(_0xbd8f('0x4f'),_0x41be86[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5b900c,null))[_0xbd8f('0xc')](handleError(_0x5b900c,null));};exports[_0xbd8f('0x50')]=function(_0x3574a6,_0x2a7eaa){return respondWithRpcPromise(_0xbd8f('0x51'),_0x3574a6[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x2a7eaa,null))[_0xbd8f('0xc')](handleError(_0x2a7eaa,null));};exports[_0xbd8f('0x52')]=function(_0x34eec5,_0x40fc53){return respondWithRpcPromise(_0xbd8f('0x53'),_0x34eec5[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x40fc53,null))[_0xbd8f('0xc')](handleError(_0x40fc53,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x38d98e,_0x2957fd){return respondWithRpcPromise(_0xbd8f('0x53'),_0x38d98e[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](function(_0x18ccf2){if(_0x38d98e['query']['type']!==undefined){var _0x2a3982=_(_0x18ccf2[_0xbd8f('0x14')])['filter']([_0x38d98e[_0xbd8f('0x15')]['type'],_0x38d98e[_0xbd8f('0x19')]['id']])[_0xbd8f('0x54')](_0xbd8f('0x55'))[_0xbd8f('0x56')]()['value']();return _0x18ccf2[_0xbd8f('0x14')][_0xbd8f('0x57')](function(_0x84e98d){return _0x2a3982['indexOf'](_0x84e98d[_0xbd8f('0x55')])>-0x1;});}else{return _0x18ccf2[_0xbd8f('0x14')][_0xbd8f('0x57')](function(_0x161ec8){return _0x161ec8['queue_id']===parseInt(_0x38d98e[_0xbd8f('0x19')]['id']);});}})[_0xbd8f('0x7')](respondWithResult(_0x2957fd,null))[_0xbd8f('0xc')](handleError(_0x2957fd,null));};exports[_0xbd8f('0x58')]=function(_0x18645e,_0x23e962){return respondWithRpcPromise(_0xbd8f('0x59'),_0x18645e[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x23e962,null))[_0xbd8f('0xc')](handleError(_0x23e962,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3da31b,_0x4e908d){return respondWithRpcPromise(_0xbd8f('0x5a'),_0x3da31b[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x4e908d,null))[_0xbd8f('0xc')](handleError(_0x4e908d,null));};exports[_0xbd8f('0x5b')]=function(_0x60cd2b,_0x2ab853){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x60cd2b[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x2ab853,null))[_0xbd8f('0xc')](handleError(_0x2ab853,null));};exports[_0xbd8f('0x5c')]=function(_0x58651d){return function(_0x4e19ec,_0x2fb942){var _0x3641e9,_0x1f685d;var _0x2acd13=_[_0xbd8f('0x5d')](_0x58651d);var _0x53076d=_0x58651d===_0xbd8f('0x5e')?_0xbd8f('0x5f'):_0xbd8f('0x60');return db[_0x2acd13+_0xbd8f('0x61')][_0xbd8f('0x62')]({'raw':!![],'where':{'id':_0x4e19ec['params']['id']}})['then'](function(_0x542075){if(_[_0xbd8f('0x12')](_0x542075)){throw new Error(_0x2acd13+'\x20Queue\x20not\x20found');}_0x3641e9=_0x542075;return db[_0x2acd13+'Message']['findOne']({'where':{'id':_0x4e19ec[_0xbd8f('0x1f')][_0xbd8f('0x63')]},'include':[{'model':db[_0x2acd13+_0xbd8f('0x64')],'as':_0xbd8f('0x64')},{'model':db[_0x2acd13+_0x53076d],'as':_0xbd8f('0x60')}]});})[_0xbd8f('0x7')](function(_0xefcfc1){if(_[_0xbd8f('0x12')](_0xefcfc1)){throw new Error(_0x2acd13+'\x20Message\x20not\x20found');}_0x1f685d=_0xefcfc1;return _0xefcfc1[_0xbd8f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbd8f('0x7')](function(){var _0x3caa98={'uniqueid':_0x58651d+'.'+_0x1f685d['id']+'.'+_0x1f685d['Interaction']['id'],'FromUserId':_0x4e19ec[_0xbd8f('0x2e')]['id'],'type':_0xbd8f('0x66')};_0x3caa98[_0x2acd13+_0xbd8f('0x67')]=_0x1f685d['id'];_0x3caa98[_0x2acd13+_0xbd8f('0x68')]=_0x1f685d[_0xbd8f('0x64')]['id'];_0x3caa98[_0xbd8f('0x69')+_0x2acd13+_0x53076d+'Id']=_0x1f685d[_0xbd8f('0x60')]['id'];_0x3caa98['To'+_0x2acd13+_0xbd8f('0x6a')]=_0x3641e9['id'];return db[_0x2acd13+_0xbd8f('0x6b')][_0xbd8f('0x6c')](_0x3caa98);})['then'](function(){return respondWithRpcPromise(_0xbd8f('0x6d'),{'channel':_0x58651d,'interaction':_0x1f685d[_0xbd8f('0x64')],'message':_0x1f685d,'account':_0x1f685d[_0xbd8f('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3641e9[_0xbd8f('0x11')]+','+(_0x1f685d['Account'][_0xbd8f('0x6e')]||0x12c),'interval':_0xbd8f('0x6f')}]},routingClient);})[_0xbd8f('0x7')](respondWithResult(_0x2fb942,null))[_0xbd8f('0xc')](handleError(_0x2fb942,null));};};exports[_0xbd8f('0x70')]=function(_0x57762c,_0xe58b64){var _0x198d4b,_0x60c94c;if(_[_0xbd8f('0x12')](_0x57762c[_0xbd8f('0x1f')][_0xbd8f('0x71')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x672cfb=_0x57762c[_0xbd8f('0x1f')]['channel'];var _0x49e15e=_[_0xbd8f('0x5d')](_0x672cfb);var _0x5b0716=_0x672cfb==='chat'?'Website':_0xbd8f('0x60');return db[_0xbd8f('0x72')][_0xbd8f('0x62')]({'raw':!![],'where':{'id':_0x57762c[_0xbd8f('0x19')]['id'],'role':'agent'}})[_0xbd8f('0x7')](function(_0x398cc9){if(_['isNil'](_0x398cc9)){throw new Error('Agent\x20not\x20found');}_0x198d4b=_0x398cc9;return db[_0x49e15e+_0xbd8f('0x73')]['findOne']({'where':{'id':_0x57762c[_0xbd8f('0x1f')]['messageId']},'include':[{'model':db[_0x49e15e+'Interaction'],'as':_0xbd8f('0x64')},{'model':db[_0x49e15e+_0x5b0716],'as':_0xbd8f('0x60')}]});})[_0xbd8f('0x7')](function(_0x18e9f0){if(_[_0xbd8f('0x12')](_0x18e9f0)){throw new Error(_0x49e15e+'\x20Message\x20not\x20found');}_0x60c94c=_0x18e9f0;return _0x18e9f0[_0xbd8f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbd8f('0x7')](function(){var _0x3a6ec4={'uniqueid':_0x672cfb+'.'+_0x60c94c['id']+'.'+_0x60c94c['Interaction']['id'],'FromUserId':_0x57762c[_0xbd8f('0x2e')]['id'],'type':_0xbd8f('0x66'),'ToUserId':_0x198d4b['id']};_0x3a6ec4[_0x49e15e+_0xbd8f('0x67')]=_0x60c94c['id'];_0x3a6ec4[_0x49e15e+_0xbd8f('0x68')]=_0x60c94c[_0xbd8f('0x64')]['id'];_0x3a6ec4[_0xbd8f('0x69')+_0x49e15e+_0x5b0716+'Id']=_0x60c94c[_0xbd8f('0x60')]['id'];return db[_0x49e15e+_0xbd8f('0x6b')][_0xbd8f('0x6c')](_0x3a6ec4);})[_0xbd8f('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x672cfb,'interaction':_0x60c94c['Interaction'],'message':_0x60c94c,'account':_0x60c94c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x198d4b[_0xbd8f('0x11')]+','+(_0x60c94c[_0xbd8f('0x60')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xe58b64,null))['catch'](handleError(_0xe58b64,null));}; \ No newline at end of file +var _0xda19=['rows','find','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Message','TransferReport','moment','lodash','../../mysqldb','api','client','http','then','error','code','message','status','json','name','send','isNil'];(function(_0x551906,_0x569941){var _0x58bfb6=function(_0x1eb6de){while(--_0x1eb6de){_0x551906['push'](_0x551906['shift']());}};_0x58bfb6(++_0x569941);}(_0xda19,0xd5));var _0x9da1=function(_0x3c7f88,_0x15ee86){_0x3c7f88=_0x3c7f88-0x0;var _0x31cefe=_0xda19[_0x3c7f88];return _0x31cefe;};'use strict';var BPromise=require('bluebird');var moment=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));var util=require('util');var db=require(_0x9da1('0x2'))['db'];var logger=require('../../config/logger')(_0x9da1('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x9da1('0x4')][_0x9da1('0x5')]({'port':0x232a});var mailClient=jayson[_0x9da1('0x4')][_0x9da1('0x5')]({'port':0x232b});var routingClient=jayson[_0x9da1('0x4')][_0x9da1('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){var _0x55f66b=_0x1c24e6?_0x1c24e6:amiClient;return _0x55f66b['request'](_0x23e4f7,_0x2c3cdd)[_0x9da1('0x6')](function(_0x493d0b){if(_0x493d0b[_0x9da1('0x7')]){if(_0x493d0b[_0x9da1('0x7')][_0x9da1('0x8')]===0x1f4){return _0x47df89(_0x493d0b[_0x9da1('0x7')][_0x9da1('0x9')]);}return _0x5e2d18(_0x493d0b[_0x9da1('0x7')][_0x9da1('0x9')]);}else{_0x5e2d18(_0x493d0b['result']);}})['catch'](function(_0x3114f7){_0x47df89(_0x3114f7);});});}function respondWithResult(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xc8;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0xa')](_0x4735c7)[_0x9da1('0xb')](_0x1d93f8);}return _0x596b6b['sendStatus'](0x194);};}function handleError(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0x1f4;return function(_0x4d17e1){logger[_0x9da1('0x7')](_0x4d17e1['stack']);if(_0x4d17e1[_0x9da1('0xc')]){delete _0x4d17e1[_0x9da1('0xc')];}_0x2837e3[_0x9da1('0xa')](_0x535a13)[_0x9da1('0xd')](_0x4d17e1);};}function findById(_0x7f1a64){return function(_0x514d8e){if(!_[_0x9da1('0xe')](_0x7f1a64)&&!_[_0x9da1('0xe')](_0x514d8e)&&!_[_0x9da1('0xe')](_0x514d8e[_0x9da1('0xf')])){return _[_0x9da1('0x10')](_0x514d8e[_0x9da1('0xf')],function(_0x497676){return _0x497676['id']==_0x7f1a64;});}return null;};}exports['voiceChannels']=function(_0x17205d,_0x8da712){return respondWithRpcPromise(_0x9da1('0x11'),_0x17205d[_0x9da1('0x12')])[_0x9da1('0x6')](respondWithResult(_0x8da712,null))[_0x9da1('0x13')](handleError(_0x8da712,null));};exports[_0x9da1('0x14')]=function(_0x47e5cf,_0x1a459c){return respondWithRpcPromise(_0x9da1('0x15'),_[_0x9da1('0x16')](_0x47e5cf[_0x9da1('0x12')],_0x47e5cf[_0x9da1('0x17')]))['then'](respondWithResult(_0x1a459c,null))['catch'](handleError(_0x1a459c,null));};exports[_0x9da1('0x18')]=function(_0x3e6f85,_0x16ee0c){return respondWithRpcPromise(_0x9da1('0x19'),_[_0x9da1('0x16')](_0x3e6f85[_0x9da1('0x12')],_0x3e6f85['params']))[_0x9da1('0x6')](respondWithResult(_0x16ee0c,null))[_0x9da1('0x13')](handleError(_0x16ee0c,null));};exports['voiceQueues']=function(_0x45fcce,_0x3f5680){return respondWithRpcPromise('VoiceQueues',_0x45fcce[_0x9da1('0x12')])[_0x9da1('0x6')](respondWithResult(_0x3f5680,null))['catch'](handleError(_0x3f5680,null));};exports[_0x9da1('0x1a')]=function(_0x1d6af5,_0x55cd3d){return respondWithRpcPromise('VoiceQueues',_0x1d6af5[_0x9da1('0x12')])[_0x9da1('0x6')](findById(_0x1d6af5['params']['id']))[_0x9da1('0x6')](respondWithResult(_0x55cd3d,null))['catch'](handleError(_0x55cd3d,null));};exports['updateVoiceQueue']=function(_0x5a59c2,_0x31b826){return respondWithRpcPromise(_0x9da1('0x1b'),_[_0x9da1('0x16')](_0x5a59c2[_0x9da1('0x1c')],_0x5a59c2[_0x9da1('0x17')]))['then'](respondWithResult(_0x31b826,null))[_0x9da1('0x13')](handleError(_0x31b826,null));};exports['voiceQueuesPreview']=function(_0x1feae0,_0x235ced){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x9da1('0x16')](_0x1feae0[_0x9da1('0x12')],_0x1feae0['params']))[_0x9da1('0x6')](respondWithResult(_0x235ced,null))[_0x9da1('0x13')](handleError(_0x235ced,null));};exports[_0x9da1('0x1d')]=function(_0x2b2b48,_0x581e9f){return respondWithRpcPromise('VoiceQueuesChannels',_0x2b2b48[_0x9da1('0x12')])[_0x9da1('0x6')](respondWithResult(_0x581e9f,null))[_0x9da1('0x13')](handleError(_0x581e9f,null));};exports[_0x9da1('0x1e')]=function(_0x193273,_0x559645){return respondWithRpcPromise(_0x9da1('0x1f'),_[_0x9da1('0x16')](_0x193273[_0x9da1('0x12')],_0x193273[_0x9da1('0x17')]))[_0x9da1('0x6')](respondWithResult(_0x559645,null))[_0x9da1('0x13')](handleError(_0x559645,null));};exports['voiceQueuesChannelHangup']=function(_0xa43301,_0x5af570){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x9da1('0x16')](_0xa43301['query'],_0xa43301[_0x9da1('0x17')]))[_0x9da1('0x6')](respondWithResult(_0x5af570,null))[_0x9da1('0x13')](handleError(_0x5af570,null));};exports[_0x9da1('0x20')]=function(_0x98b294,_0x5efa40){return respondWithRpcPromise(_0x9da1('0x21'),_[_0x9da1('0x16')](_0x98b294['query'],_0x98b294[_0x9da1('0x17')]))['then'](respondWithResult(_0x5efa40,null))[_0x9da1('0x13')](handleError(_0x5efa40,null));};exports['outbound']=function(_0x5eaa7e,_0x1ce0f8){return respondWithRpcPromise('Outbound',_0x5eaa7e[_0x9da1('0x12')])[_0x9da1('0x6')](respondWithResult(_0x1ce0f8,null))['catch'](handleError(_0x1ce0f8,null));};exports[_0x9da1('0x22')]=function(_0x1b750f,_0x390457){return respondWithRpcPromise(_0x9da1('0x23'),_0x1b750f['query'])[_0x9da1('0x6')](respondWithResult(_0x390457,null))['catch'](handleError(_0x390457,null));};exports[_0x9da1('0x24')]=function(_0x4bdaf1,_0x26e8d3){var _0x46c176;return respondWithRpcPromise('Agents',_0x4bdaf1[_0x9da1('0x12')])[_0x9da1('0x6')](function(_0x394acf){_0x46c176=_0x394acf;return respondWithRpcPromise('Agents',_0x4bdaf1['query'],routingClient);})['then'](function(_0x27e78c){return _['merge']({},_0x27e78c,_0x46c176);})[_0x9da1('0x6')](respondWithResult(_0x26e8d3,null))[_0x9da1('0x13')](handleError(_0x26e8d3,null));};exports[_0x9da1('0x25')]=function(_0x43c064,_0x54f188){if(_0x43c064[_0x9da1('0x1c')]&&_0x43c064[_0x9da1('0x1c')][_0x9da1('0x26')]&&_0x43c064[_0x9da1('0x27')]&&_0x43c064[_0x9da1('0x27')][_0x9da1('0xc')]){for(var _0x28e0b2 in _0x43c064['body'][_0x9da1('0x26')]){if(_0x43c064['body'][_0x9da1('0x26')]['hasOwnProperty'](_0x28e0b2)){db[_0x9da1('0x28')][_0x9da1('0x29')]({'where':{'channel':_0x28e0b2,'membername':_0x43c064['user'][_0x9da1('0xc')],'type':_0x9da1('0x2a'),'exitAt':null,'uniqueid':_0x43c064['body'][_0x9da1('0x26')][_0x28e0b2]&&_0x43c064['body'][_0x9da1('0x26')][_0x28e0b2][_0x9da1('0x2b')]?{'$notIn':_0x43c064['body']['interaction'][_0x28e0b2]}:{'$ne':null}}})[_0x9da1('0x6')](function(_0x3f3688){var _0x15bb24=moment()[_0x9da1('0x2c')](_0x9da1('0x2d'));for(var _0x15578d=0x0,_0x2d7003=_0x3f3688[_0x9da1('0x2b')];_0x15578d<_0x2d7003;_0x15578d+=0x1){_0x3f3688[_0x15578d]['updateAttributes']({'exitAt':_0x15bb24});}});for(var _0xd7fb0a=0x0;_0xd7fb0a<_0x43c064[_0x9da1('0x1c')][_0x9da1('0x26')][_0x28e0b2]['length'];_0xd7fb0a+=0x1){db[_0x9da1('0x28')][_0x9da1('0x2e')]({'where':{'channel':_0x28e0b2,'membername':_0x43c064[_0x9da1('0x27')]['name'],'type':_0x9da1('0x2a'),'uniqueid':_0x43c064[_0x9da1('0x1c')][_0x9da1('0x26')][_0x28e0b2][_0xd7fb0a],'exitAt':null},'defaults':{'channel':_0x28e0b2,'membername':_0x43c064['user'][_0x9da1('0xc')],'interface':_['isNil'](_0x43c064['user'][_0x9da1('0x2f')])?util[_0x9da1('0x2c')]('SIP/%s',_0x43c064[_0x9da1('0x27')][_0x9da1('0xc')]):_0x43c064['user'][_0x9da1('0x2f')],'type':_0x9da1('0x2a'),'enterAt':moment()[_0x9da1('0x2c')](_0x9da1('0x2d')),'role':_0x9da1('0x30'),'internal':_0x43c064[_0x9da1('0x27')][_0x9da1('0x31')],'uniqueid':_0x43c064[_0x9da1('0x1c')][_0x9da1('0x26')][_0x28e0b2][_0xd7fb0a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x43c064[_0x9da1('0x17')]['id'],'capacity':_0x43c064[_0x9da1('0x1c')][_0x9da1('0x32')]},routingClient)[_0x9da1('0x6')](respondWithResult(_0x54f188,null))['catch'](handleError(_0x54f188,null));};exports['telephones']=function(_0xf36078,_0x6ca1ac){return respondWithRpcPromise(_0x9da1('0x33'),_0xf36078[_0x9da1('0x12')])[_0x9da1('0x6')](respondWithResult(_0x6ca1ac,null))[_0x9da1('0x13')](handleError(_0x6ca1ac,null));};exports[_0x9da1('0x34')]=function(_0x1b1148,_0x34327e){return respondWithRpcPromise(_0x9da1('0x35'),_0x1b1148[_0x9da1('0x12')])[_0x9da1('0x6')](respondWithResult(_0x34327e,null))[_0x9da1('0x13')](handleError(_0x34327e,null));};exports[_0x9da1('0x36')]=function(_0x4c99e8,_0x26ecdb){return respondWithRpcPromise(_0x9da1('0x37'),_0x4c99e8['query'])[_0x9da1('0x6')](respondWithResult(_0x26ecdb,null))['catch'](handleError(_0x26ecdb,null));};exports[_0x9da1('0x38')]=function(_0x4f4980,_0x5df0d8){return respondWithRpcPromise(_0x9da1('0x39'),_0x4f4980[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](respondWithResult(_0x5df0d8,null))[_0x9da1('0x13')](handleError(_0x5df0d8,null));};exports[_0x9da1('0x3a')]=function(_0x2787e1,_0x343b05){return respondWithRpcPromise(_0x9da1('0x39'),_0x2787e1[_0x9da1('0x12')],routingClient)['then'](findById(_0x2787e1[_0x9da1('0x17')]['id']))[_0x9da1('0x6')](respondWithResult(_0x343b05,null))[_0x9da1('0x13')](handleError(_0x343b05,null));};exports[_0x9da1('0x3b')]=function(_0x2aae1b,_0x4607a9){return respondWithRpcPromise(_0x9da1('0x3c'),_0x2aae1b[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](respondWithResult(_0x4607a9,null))[_0x9da1('0x13')](handleError(_0x4607a9,null));};exports['showMailQueues']=function(_0xdaa51b,_0x374a1a){return respondWithRpcPromise('MailQueues',_0xdaa51b[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](findById(_0xdaa51b[_0x9da1('0x17')]['id']))[_0x9da1('0x6')](respondWithResult(_0x374a1a,null))[_0x9da1('0x13')](handleError(_0x374a1a,null));};exports[_0x9da1('0x3d')]=function(_0x3081d7,_0x5d9ac7){return respondWithRpcPromise(_0x9da1('0x3e'),_0x3081d7[_0x9da1('0x12')],mailClient)[_0x9da1('0x6')](respondWithResult(_0x5d9ac7,null))[_0x9da1('0x13')](handleError(_0x5d9ac7,null));};exports['openchannelQueues']=function(_0x1a9df0,_0x5c236e){return respondWithRpcPromise(_0x9da1('0x3f'),_0x1a9df0[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](respondWithResult(_0x5c236e,null))[_0x9da1('0x13')](handleError(_0x5c236e,null));};exports[_0x9da1('0x40')]=function(_0x4445e2,_0x5e262c){return respondWithRpcPromise('OpenchannelQueues',_0x4445e2[_0x9da1('0x12')],routingClient)['then'](findById(_0x4445e2['params']['id']))['then'](respondWithResult(_0x5e262c,null))[_0x9da1('0x13')](handleError(_0x5e262c,null));};exports['smsQueues']=function(_0x1ee86e,_0x558602){return respondWithRpcPromise(_0x9da1('0x41'),_0x1ee86e[_0x9da1('0x12')],routingClient)['then'](respondWithResult(_0x558602,null))[_0x9da1('0x13')](handleError(_0x558602,null));};exports[_0x9da1('0x42')]=function(_0x575a9b,_0x1a91c8){return respondWithRpcPromise(_0x9da1('0x41'),_0x575a9b['query'],routingClient)['then'](findById(_0x575a9b[_0x9da1('0x17')]['id']))[_0x9da1('0x6')](respondWithResult(_0x1a91c8,null))[_0x9da1('0x13')](handleError(_0x1a91c8,null));};exports[_0x9da1('0x43')]=function(_0x236b01,_0x44d7fe){return respondWithRpcPromise('WhatsappQueues',_0x236b01[_0x9da1('0x12')],routingClient)['then'](respondWithResult(_0x44d7fe,null))['catch'](handleError(_0x44d7fe,null));};exports[_0x9da1('0x44')]=function(_0x41717a,_0x2e4ea4){return respondWithRpcPromise(_0x9da1('0x45'),_0x41717a[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](findById(_0x41717a[_0x9da1('0x17')]['id']))[_0x9da1('0x6')](respondWithResult(_0x2e4ea4,null))[_0x9da1('0x13')](handleError(_0x2e4ea4,null));};exports['faxQueues']=function(_0x41283e,_0xbd54e){return respondWithRpcPromise(_0x9da1('0x46'),_0x41283e[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](respondWithResult(_0xbd54e,null))['catch'](handleError(_0xbd54e,null));};exports[_0x9da1('0x47')]=function(_0x13fadd,_0x419f78){return respondWithRpcPromise(_0x9da1('0x46'),_0x13fadd[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](findById(_0x13fadd['params']['id']))[_0x9da1('0x6')](respondWithResult(_0x419f78,null))['catch'](handleError(_0x419f78,null));};exports[_0x9da1('0x48')]=function(_0x5b6d9f,_0x7cfa7e){return respondWithRpcPromise(_0x9da1('0x49'),_0x5b6d9f[_0x9da1('0x12')])[_0x9da1('0x6')](respondWithResult(_0x7cfa7e,null))['catch'](handleError(_0x7cfa7e,null));};exports['chatQueuesWaitingInteractions']=function(_0x4c832f,_0x73a2fc){return respondWithRpcPromise(_0x9da1('0x4a'),_0x4c832f[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](respondWithResult(_0x73a2fc,null))['catch'](handleError(_0x73a2fc,null));};exports['mailQueuesWaitingInteractions']=function(_0x35b782,_0x327bb4){return respondWithRpcPromise(_0x9da1('0x4b'),_0x35b782['query'],routingClient)['then'](respondWithResult(_0x327bb4,null))[_0x9da1('0x13')](handleError(_0x327bb4,null));};exports[_0x9da1('0x4c')]=function(_0x114093,_0x57f20c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x114093[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](respondWithResult(_0x57f20c,null))[_0x9da1('0x13')](handleError(_0x57f20c,null));};exports[_0x9da1('0x4d')]=function(_0x3cfe64,_0x5daa11){return respondWithRpcPromise(_0x9da1('0x4e'),_0x3cfe64[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](function(_0x1f0369){if(_0x3cfe64['query'][_0x9da1('0x4f')]!==undefined){var _0x244987=_(_0x1f0369[_0x9da1('0xf')])['filter']([_0x3cfe64[_0x9da1('0x12')][_0x9da1('0x4f')],_0x3cfe64[_0x9da1('0x17')]['id']])['map'](_0x9da1('0x50'))[_0x9da1('0x51')]()['value']();return _0x1f0369[_0x9da1('0xf')]['filter'](function(_0x247710){return _0x244987['indexOf'](_0x247710[_0x9da1('0x50')])>-0x1;});}else{return _0x1f0369[_0x9da1('0xf')][_0x9da1('0x52')](function(_0x2d3541){return _0x2d3541[_0x9da1('0x50')]===parseInt(_0x3cfe64[_0x9da1('0x17')]['id']);});}})[_0x9da1('0x6')](respondWithResult(_0x5daa11,null))[_0x9da1('0x13')](handleError(_0x5daa11,null));};exports[_0x9da1('0x53')]=function(_0x457b45,_0x323cae){return respondWithRpcPromise(_0x9da1('0x54'),_0x457b45[_0x9da1('0x12')],routingClient)['then'](respondWithResult(_0x323cae,null))[_0x9da1('0x13')](handleError(_0x323cae,null));};exports[_0x9da1('0x55')]=function(_0x27cec6,_0x890b14){return respondWithRpcPromise(_0x9da1('0x56'),_0x27cec6['query'],routingClient)[_0x9da1('0x6')](respondWithResult(_0x890b14,null))[_0x9da1('0x13')](handleError(_0x890b14,null));};exports['faxQueuesWaitingInteractions']=function(_0x4a4cda,_0x84f8d8){return respondWithRpcPromise(_0x9da1('0x57'),_0x4a4cda[_0x9da1('0x12')],routingClient)[_0x9da1('0x6')](respondWithResult(_0x84f8d8,null))[_0x9da1('0x13')](handleError(_0x84f8d8,null));};exports[_0x9da1('0x58')]=function(_0x1e5b52){return function(_0x1eaaeb,_0x29c4e8){var _0x1d02ff,_0x21748e;var _0x48341a=_[_0x9da1('0x59')](_0x1e5b52);var _0x49a95c=_0x1e5b52===_0x9da1('0x5a')?_0x9da1('0x5b'):_0x9da1('0x5c');return db[_0x48341a+_0x9da1('0x5d')][_0x9da1('0x5e')]({'raw':!![],'where':{'id':_0x1eaaeb['params']['id']}})[_0x9da1('0x6')](function(_0x354c5a){if(_['isNil'](_0x354c5a)){throw new Error(_0x48341a+_0x9da1('0x5f'));}_0x1d02ff=_0x354c5a;return db[_0x48341a+'Message'][_0x9da1('0x5e')]({'where':{'id':_0x1eaaeb['body'][_0x9da1('0x60')]},'include':[{'model':db[_0x48341a+_0x9da1('0x61')],'as':_0x9da1('0x61')},{'model':db[_0x48341a+_0x49a95c],'as':_0x9da1('0x5c')}]});})[_0x9da1('0x6')](function(_0x3e331a){if(_[_0x9da1('0xe')](_0x3e331a)){throw new Error(_0x48341a+_0x9da1('0x62'));}_0x21748e=_0x3e331a;return _0x3e331a[_0x9da1('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x9da1('0x6')](function(){var _0xbd3a16={'uniqueid':_0x1e5b52+'.'+_0x21748e['id']+'.'+_0x21748e[_0x9da1('0x61')]['id'],'FromUserId':_0x1eaaeb['user']['id'],'type':_0x9da1('0x64')};_0xbd3a16[_0x48341a+_0x9da1('0x65')]=_0x21748e['id'];_0xbd3a16[_0x48341a+_0x9da1('0x66')]=_0x21748e[_0x9da1('0x61')]['id'];_0xbd3a16[_0x9da1('0x67')+_0x48341a+_0x49a95c+'Id']=_0x21748e[_0x9da1('0x5c')]['id'];_0xbd3a16['To'+_0x48341a+'QueueId']=_0x1d02ff['id'];return db[_0x48341a+'TransferReport'][_0x9da1('0x68')](_0xbd3a16);})[_0x9da1('0x6')](function(){return respondWithRpcPromise(_0x9da1('0x69'),{'channel':_0x1e5b52,'interaction':_0x21748e['Interaction'],'message':_0x21748e,'account':_0x21748e[_0x9da1('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x9da1('0x64'),'appdata':_0x1d02ff[_0x9da1('0xc')]+','+(_0x21748e[_0x9da1('0x5c')][_0x9da1('0x6a')]||0x12c),'interval':_0x9da1('0x6b')}]},routingClient);})[_0x9da1('0x6')](respondWithResult(_0x29c4e8,null))['catch'](handleError(_0x29c4e8,null));};};exports[_0x9da1('0x6c')]=function(_0x18fbc9,_0x5a64fd){var _0x56af13,_0x392d19;if(_['isNil'](_0x18fbc9['body'][_0x9da1('0x6d')])){throw new Error(_0x9da1('0x6e'));}var _0x3f9010=_0x18fbc9[_0x9da1('0x1c')][_0x9da1('0x6d')];var _0x30065d=_[_0x9da1('0x59')](_0x3f9010);var _0x39afa7=_0x3f9010==='chat'?'Website':_0x9da1('0x5c');return db[_0x9da1('0x6f')][_0x9da1('0x5e')]({'raw':!![],'where':{'id':_0x18fbc9[_0x9da1('0x17')]['id'],'role':_0x9da1('0x30')}})[_0x9da1('0x6')](function(_0x20a71f){if(_[_0x9da1('0xe')](_0x20a71f)){throw new Error('Agent\x20not\x20found');}_0x56af13=_0x20a71f;return db[_0x30065d+_0x9da1('0x70')]['findOne']({'where':{'id':_0x18fbc9[_0x9da1('0x1c')][_0x9da1('0x60')]},'include':[{'model':db[_0x30065d+_0x9da1('0x61')],'as':_0x9da1('0x61')},{'model':db[_0x30065d+_0x39afa7],'as':_0x9da1('0x5c')}]});})[_0x9da1('0x6')](function(_0xe59156){if(_['isNil'](_0xe59156)){throw new Error(_0x30065d+_0x9da1('0x62'));}_0x392d19=_0xe59156;return _0xe59156['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x9da1('0x6')](function(){var _0x35322c={'uniqueid':_0x3f9010+'.'+_0x392d19['id']+'.'+_0x392d19[_0x9da1('0x61')]['id'],'FromUserId':_0x18fbc9[_0x9da1('0x27')]['id'],'type':'queue','ToUserId':_0x56af13['id']};_0x35322c[_0x30065d+_0x9da1('0x65')]=_0x392d19['id'];_0x35322c[_0x30065d+_0x9da1('0x66')]=_0x392d19[_0x9da1('0x61')]['id'];_0x35322c[_0x9da1('0x67')+_0x30065d+_0x39afa7+'Id']=_0x392d19[_0x9da1('0x5c')]['id'];return db[_0x30065d+_0x9da1('0x71')][_0x9da1('0x68')](_0x35322c);})[_0x9da1('0x6')](function(){return respondWithRpcPromise(_0x9da1('0x69'),{'channel':_0x3f9010,'interaction':_0x392d19[_0x9da1('0x61')],'message':_0x392d19,'account':_0x392d19[_0x9da1('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x9da1('0x30'),'appdata':_0x56af13[_0x9da1('0xc')]+','+(_0x392d19[_0x9da1('0x5c')]['agentTransferTimeout']||0x12c),'interval':_0x9da1('0x6b')}]},routingClient);})['then'](respondWithResult(_0x5a64fd,null))[_0x9da1('0x13')](handleError(_0x5a64fd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d40e1e2..7020f0c 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 _0x06f5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./schedule.controller','get','isAuthenticated','show','/:id/run','run','post','put','update','delete','/:id','exports','multer','util'];(function(_0x15cc17,_0x5a498d){var _0x9607cc=function(_0x2c84fb){while(--_0x2c84fb){_0x15cc17['push'](_0x15cc17['shift']());}};_0x9607cc(++_0x5a498d);}(_0x06f5,0xcf));var _0x506f=function(_0x5829df,_0x3e9fa8){_0x5829df=_0x5829df-0x0;var _0x170366=_0x06f5[_0x5829df];return _0x170366;};'use strict';var multer=require(_0x506f('0x0'));var util=require(_0x506f('0x1'));var path=require(_0x506f('0x2'));var timeout=require(_0x506f('0x3'));var express=require('express');var router=express[_0x506f('0x4')]();var fs_extra=require(_0x506f('0x5'));var auth=require(_0x506f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x506f('0x7'));router[_0x506f('0x8')]('/',auth[_0x506f('0x9')](),controller['index']);router[_0x506f('0x8')]('/:id',auth[_0x506f('0x9')](),controller[_0x506f('0xa')]);router[_0x506f('0x8')](_0x506f('0xb'),auth[_0x506f('0x9')](),controller[_0x506f('0xc')]);router[_0x506f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x506f('0xe')]('/:id',auth[_0x506f('0x9')](),controller[_0x506f('0xf')]);router[_0x506f('0x10')](_0x506f('0x11'),auth[_0x506f('0x9')](),controller['destroy']);module[_0x506f('0x12')]=router; \ No newline at end of file +var _0xa51f=['../../components/auth/service','../../config/environment','./schedule.controller','index','isAuthenticated','get','create','put','update','delete','/:id','destroy','multer','path','express','Router','fs-extra'];(function(_0x3e55b8,_0x56eb70){var _0x378a60=function(_0x18582d){while(--_0x18582d){_0x3e55b8['push'](_0x3e55b8['shift']());}};_0x378a60(++_0x56eb70);}(_0xa51f,0x72));var _0xfa51=function(_0x2a05b0,_0x45eed9){_0x2a05b0=_0x2a05b0-0x0;var _0x36eb0a=_0xa51f[_0x2a05b0];return _0x36eb0a;};'use strict';var multer=require(_0xfa51('0x0'));var util=require('util');var path=require(_0xfa51('0x1'));var timeout=require('connect-timeout');var express=require(_0xfa51('0x2'));var router=express[_0xfa51('0x3')]();var fs_extra=require(_0xfa51('0x4'));var auth=require(_0xfa51('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa51('0x6'));var controller=require(_0xfa51('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa51('0x8')]);router['get']('/:id',auth[_0xfa51('0x9')](),controller['show']);router[_0xfa51('0xa')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0xfa51('0xb')]);router[_0xfa51('0xc')]('/:id',auth[_0xfa51('0x9')](),controller[_0xfa51('0xd')]);router[_0xfa51('0xe')](_0xfa51('0xf'),auth['isAuthenticated'](),controller[_0xfa51('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b56601a..c7d0c99 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 _0x88df=['TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','days','hours','minutes','pdf','xlsx','custom','default','BOOLEAN'];(function(_0x173194,_0x55f32c){var _0x341b86=function(_0x574d7d){while(--_0x574d7d){_0x173194['push'](_0x173194['shift']());}};_0x341b86(++_0x55f32c);}(_0x88df,0x155));var _0xf88d=function(_0x11c5ec,_0x111a29){_0x11c5ec=_0x11c5ec-0x0;var _0x45f3a4=_0x88df[_0x11c5ec];return _0x45f3a4;};'use strict';var Sequelize=require('sequelize');module[_0xf88d('0x0')]={'name':{'type':Sequelize[_0xf88d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf88d('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf88d('0x1')],'allowNull':![],'defaultValue':_0xf88d('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xf88d('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf88d('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf88d('0x5')]('years',_0xf88d('0x6'),_0xf88d('0x7'),'weeks',_0xf88d('0x8'),_0xf88d('0x9'),_0xf88d('0xa')),'allowNull':![],'defaultValue':_0xf88d('0x8')},'output':{'type':Sequelize['ENUM']('csv',_0xf88d('0xb'),_0xf88d('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xf88d('0xd'),_0xf88d('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xf88d('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0xf88d('0x1')]},'cc':{'type':Sequelize[_0xf88d('0x10')]},'bcc':{'type':Sequelize[_0xf88d('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xf88d('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0x05e6=['years','quarters','months','weeks','days','hours','minutes','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM'];(function(_0x2b9618,_0x4b37b1){var _0x1e7ab4=function(_0x24d6c8){while(--_0x24d6c8){_0x2b9618['push'](_0x2b9618['shift']());}};_0x1e7ab4(++_0x4b37b1);}(_0x05e6,0x7a));var _0x605e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x05e6[_0x411add];return _0x238242;};'use strict';var Sequelize=require('sequelize');module[_0x605e('0x0')]={'name':{'type':Sequelize[_0x605e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x605e('0x1')]},'active':{'type':Sequelize[_0x605e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x605e('0x1')],'allowNull':![],'defaultValue':_0x605e('0x3')},'startAt':{'type':Sequelize[_0x605e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x605e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x605e('0x5')](_0x605e('0x6'),_0x605e('0x7'),_0x605e('0x8'),_0x605e('0x9'),_0x605e('0xa'),_0x605e('0xb'),_0x605e('0xc')),'allowNull':![],'defaultValue':_0x605e('0xa')},'output':{'type':Sequelize[_0x605e('0x5')]('csv','pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x605e('0x5')](_0x605e('0xd'),_0x605e('0xe')),'allowNull':![],'defaultValue':_0x605e('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x605e('0x1')]},'cc':{'type':Sequelize[_0x605e('0xf')]},'bcc':{'type':Sequelize[_0x605e('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x605e('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 c5385dd..6b2ff18 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 _0x3796=['filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','type','model','query','keys'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3796,0x1c7));var _0x6379=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3796[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x6379('0x0'));var rimraf=require(_0x6379('0x1'));var zipdir=require(_0x6379('0x2'));var jsonpatch=require(_0x6379('0x3'));var rp=require(_0x6379('0x4'));var moment=require(_0x6379('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6379('0x6'));var path=require(_0x6379('0x7'));var sox=require(_0x6379('0x8'));var csv=require(_0x6379('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6379('0xa'));var _=require(_0x6379('0xb'));var squel=require(_0x6379('0xc'));var crypto=require(_0x6379('0xd'));var jsforce=require(_0x6379('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6379('0xf'));var Papa=require(_0x6379('0x10'));var Redis=require(_0x6379('0x11'));var authService=require(_0x6379('0x12'));var qs=require(_0x6379('0x13'));var as=require(_0x6379('0x14'));var hardwareService=require(_0x6379('0x15'));var logger=require(_0x6379('0x16'))(_0x6379('0x17'));var utils=require(_0x6379('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6379('0x19'));var db=require(_0x6379('0x1a'))['db'];function respondWithStatusCode(_0x544f37,_0x44d604){_0x44d604=_0x44d604||0xcc;return function(_0x2d5ef1){if(_0x2d5ef1){return _0x544f37[_0x6379('0x1b')](_0x44d604);}return _0x544f37['status'](_0x44d604)['end']();};}function respondWithResult(_0x345e21,_0x55ed0f){_0x55ed0f=_0x55ed0f||0xc8;return function(_0x2f36ac){if(_0x2f36ac){return _0x345e21[_0x6379('0x1c')](_0x55ed0f)['json'](_0x2f36ac);}};}function respondWithFilteredResult(_0x11d91b,_0x389805){return function(_0x1506d8){if(_0x1506d8){var _0xa495d4=typeof _0x389805[_0x6379('0x1d')]==='undefined'&&typeof _0x389805[_0x6379('0x1e')]===_0x6379('0x1f');var _0x30f0e8=_0x1506d8['count'];var _0x24ba34=_0xa495d4?0x0:_0x389805[_0x6379('0x1d')];var _0x24fce7=_0xa495d4?_0x1506d8[_0x6379('0x20')]:_0x389805[_0x6379('0x1d')]+_0x389805[_0x6379('0x1e')];var _0x228710;if(_0x24fce7>=_0x30f0e8){_0x24fce7=_0x30f0e8;_0x228710=0xc8;}else{_0x228710=0xce;}_0x11d91b['status'](_0x228710);return _0x11d91b[_0x6379('0x21')]('Content-Range',_0x24ba34+'-'+_0x24fce7+'/'+_0x30f0e8)['json'](_0x1506d8);}return null;};}function patchUpdates(_0x2c8ecf){return function(_0x2520cb){try{jsonpatch[_0x6379('0x22')](_0x2520cb,_0x2c8ecf,!![]);}catch(_0x1e40bf){return BPromise[_0x6379('0x23')](_0x1e40bf);}return _0x2520cb[_0x6379('0x24')]();};}function saveUpdates(_0x237d40,_0x549bc6){return function(_0x46b8d7){if(_0x46b8d7){return _0x46b8d7[_0x6379('0x25')](_0x237d40)[_0x6379('0x26')](function(_0x4fc305){return _0x4fc305;});}return null;};}function removeEntity(_0x269890,_0x50f029){return function(_0x55d1a0){if(_0x55d1a0){return _0x55d1a0[_0x6379('0x27')]()['then'](function(){var _0x53110d=_0x55d1a0[_0x6379('0x28')]({'plain':!![]});var _0x254cad=_0x6379('0x29');return db[_0x6379('0x2a')]['destroy']({'where':{'type':_0x254cad,'resourceId':_0x53110d['id']}})[_0x6379('0x26')](function(){return _0x55d1a0;});})[_0x6379('0x26')](function(){_0x269890[_0x6379('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183d91,_0x52a1db){return function(_0x1717a7){if(!_0x1717a7){_0x183d91[_0x6379('0x1b')](0x194);}return _0x1717a7;};}function handleError(_0x3adb81,_0x53f499){_0x53f499=_0x53f499||0x1f4;return function(_0x39a936){logger[_0x6379('0x2b')](_0x39a936[_0x6379('0x2c')]);if(_0x39a936[_0x6379('0x2d')]){delete _0x39a936[_0x6379('0x2d')];}_0x3adb81[_0x6379('0x1c')](_0x53f499)[_0x6379('0x2e')](_0x39a936);};}exports[_0x6379('0x2f')]=function(_0x38f52d,_0x179744){var _0xa08bc4={},_0x3e36b6={},_0x16ee15={'count':0x0,'rows':[]};var _0x3065e3=_[_0x6379('0x30')](db[_0x6379('0x31')][_0x6379('0x32')],function(_0x1654ef){return{'name':_0x1654ef['fieldName'],'type':_0x1654ef[_0x6379('0x33')]['key']};});_0x3e36b6[_0x6379('0x34')]=_[_0x6379('0x30')](_0x3065e3,_0x6379('0x2d'));_0x3e36b6[_0x6379('0x35')]=_[_0x6379('0x36')](_0x38f52d[_0x6379('0x35')]);_0x3e36b6[_0x6379('0x37')]=_['intersection'](_0x3e36b6[_0x6379('0x34')],_0x3e36b6[_0x6379('0x35')]);_0xa08bc4[_0x6379('0x38')]=_[_0x6379('0x39')](_0x3e36b6[_0x6379('0x34')],qs[_0x6379('0x3a')](_0x38f52d[_0x6379('0x35')][_0x6379('0x3a')]));_0xa08bc4[_0x6379('0x38')]=_0xa08bc4[_0x6379('0x38')][_0x6379('0x3b')]?_0xa08bc4['attributes']:_0x3e36b6[_0x6379('0x34')];if(!_0x38f52d['query']['hasOwnProperty'](_0x6379('0x3c'))){_0xa08bc4[_0x6379('0x1e')]=qs[_0x6379('0x1e')](_0x38f52d[_0x6379('0x35')]['limit']);_0xa08bc4[_0x6379('0x1d')]=qs['offset'](_0x38f52d[_0x6379('0x35')][_0x6379('0x1d')]);}_0xa08bc4[_0x6379('0x3d')]=qs[_0x6379('0x3e')](_0x38f52d[_0x6379('0x35')]['sort']);_0xa08bc4['where']=qs[_0x6379('0x37')](_[_0x6379('0x3f')](_0x38f52d[_0x6379('0x35')],_0x3e36b6[_0x6379('0x37')]),_0x3065e3);if(_0x38f52d[_0x6379('0x35')][_0x6379('0x40')]){_0xa08bc4['where']=_[_0x6379('0x41')](_0xa08bc4[_0x6379('0x42')],{'$or':_[_0x6379('0x30')](_0x3065e3,function(_0x16cddd){if(_0x16cddd[_0x6379('0x33')]!==_0x6379('0x43')){var _0x636a7b={};_0x636a7b[_0x16cddd['name']]={'$like':'%'+_0x38f52d[_0x6379('0x35')][_0x6379('0x40')]+'%'};return _0x636a7b;}})});}_0xa08bc4=_[_0x6379('0x41')]({},_0xa08bc4,_0x38f52d[_0x6379('0x44')]);var _0x481ee9={'where':_0xa08bc4[_0x6379('0x42')]};return db[_0x6379('0x31')][_0x6379('0x20')](_0x481ee9)[_0x6379('0x26')](function(_0xd001e2){_0x16ee15[_0x6379('0x20')]=_0xd001e2;if(_0x38f52d[_0x6379('0x35')][_0x6379('0x45')]){_0xa08bc4[_0x6379('0x46')]=[{'all':!![]}];}return db[_0x6379('0x31')][_0x6379('0x47')](_0xa08bc4);})['then'](function(_0x561219){_0x16ee15['rows']=_0x561219;return _0x16ee15;})[_0x6379('0x26')](respondWithFilteredResult(_0x179744,_0xa08bc4))[_0x6379('0x48')](handleError(_0x179744,null));};exports[_0x6379('0x49')]=function(_0x684e53,_0x4d2b27){var _0x1a5e6f={'raw':![],'where':{'id':_0x684e53[_0x6379('0x4a')]['id']}},_0x56a156={};_0x56a156[_0x6379('0x34')]=_[_0x6379('0x36')](db[_0x6379('0x31')][_0x6379('0x32')]);_0x56a156[_0x6379('0x35')]=_['keys'](_0x684e53[_0x6379('0x35')]);_0x56a156[_0x6379('0x37')]=_[_0x6379('0x39')](_0x56a156[_0x6379('0x34')],_0x56a156[_0x6379('0x35')]);_0x1a5e6f[_0x6379('0x38')]=_[_0x6379('0x39')](_0x56a156[_0x6379('0x34')],qs[_0x6379('0x3a')](_0x684e53['query'][_0x6379('0x3a')]));_0x1a5e6f['attributes']=_0x1a5e6f['attributes']['length']?_0x1a5e6f[_0x6379('0x38')]:_0x56a156[_0x6379('0x34')];if(_0x684e53[_0x6379('0x35')][_0x6379('0x45')]){_0x1a5e6f['include']=[{'all':!![]}];}_0x1a5e6f=_['merge']({},_0x1a5e6f,_0x684e53['options']);return db['Schedule']['find'](_0x1a5e6f)[_0x6379('0x26')](handleEntityNotFound(_0x4d2b27,null))[_0x6379('0x26')](respondWithResult(_0x4d2b27,null))[_0x6379('0x48')](handleError(_0x4d2b27,null));};exports[_0x6379('0x4b')]=function(_0x5bc2e3,_0x36837){return db[_0x6379('0x31')][_0x6379('0x4b')](_0x5bc2e3['body'],{})[_0x6379('0x26')](function(_0x52f3b2){var _0x219156=_0x5bc2e3[_0x6379('0x4c')][_0x6379('0x28')]({'plain':!![]});if(!_0x219156)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219156[_0x6379('0x4d')]===_0x6379('0x4c')){var _0x419cc4=_0x52f3b2[_0x6379('0x28')]({'plain':!![]});var _0x5381c0=_0x6379('0x29');return db[_0x6379('0x4e')][_0x6379('0x4f')]({'where':{'name':_0x5381c0,'userProfileId':_0x219156['userProfileId']},'raw':!![]})[_0x6379('0x26')](function(_0x396233){if(_0x396233&&_0x396233[_0x6379('0x50')]===0x0){return db[_0x6379('0x2a')][_0x6379('0x4b')]({'name':_0x419cc4['name'],'resourceId':_0x419cc4['id'],'type':_0x396233[_0x6379('0x2d')],'sectionId':_0x396233['id']},{})[_0x6379('0x26')](function(){return _0x52f3b2;});}else{return _0x52f3b2;}})[_0x6379('0x48')](function(_0x113baa){logger[_0x6379('0x2b')](_0x6379('0x51'),_0x113baa);throw _0x113baa;});}return _0x52f3b2;})[_0x6379('0x26')](respondWithResult(_0x36837,0xc9))[_0x6379('0x48')](handleError(_0x36837,null));};exports[_0x6379('0x25')]=function(_0x29fab7,_0x2559d9){if(_0x29fab7[_0x6379('0x52')]['id']){delete _0x29fab7['body']['id'];}return db[_0x6379('0x31')][_0x6379('0x4f')]({'where':{'id':_0x29fab7[_0x6379('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2559d9,null))[_0x6379('0x26')](saveUpdates(_0x29fab7[_0x6379('0x52')],null))[_0x6379('0x26')](respondWithResult(_0x2559d9,null))[_0x6379('0x48')](handleError(_0x2559d9,null));};exports['destroy']=function(_0x264fd7,_0xb48d2c){return db[_0x6379('0x31')][_0x6379('0x4f')]({'where':{'id':_0x264fd7[_0x6379('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb48d2c,null))[_0x6379('0x26')](removeEntity(_0xb48d2c,null))[_0x6379('0x48')](handleError(_0xb48d2c,null));};exports[_0x6379('0x53')]=function(_0x1b2687,_0x49a10f,_0x177f33){var _0x77306f=require(_0x6379('0x54'));return db[_0x6379('0x31')][_0x6379('0x4f')]({'where':{'id':_0x1b2687[_0x6379('0x4a')]['id']},'raw':!![]})[_0x6379('0x26')](handleEntityNotFound(_0x49a10f,null))[_0x6379('0x26')](function(){_0x77306f[_0x6379('0x53')](_0x1b2687['params']['id']);})['then'](respondWithStatusCode(_0x49a10f,null))['catch'](handleError(_0x49a10f,null));}; \ No newline at end of file +var _0x9eb7=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','update','then','destroy','Scheduler','UserProfileResource','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','Schedule','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x4688e3,_0x1f5d34){var _0x348354=function(_0x417a92){while(--_0x417a92){_0x4688e3['push'](_0x4688e3['shift']());}};_0x348354(++_0x1f5d34);}(_0x9eb7,0x13a));var _0x79eb=function(_0x48f085,_0x47bb7d){_0x48f085=_0x48f085-0x0;var _0x2dec00=_0x9eb7[_0x48f085];return _0x2dec00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x79eb('0x0'));var zipdir=require(_0x79eb('0x1'));var jsonpatch=require(_0x79eb('0x2'));var rp=require(_0x79eb('0x3'));var moment=require(_0x79eb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x79eb('0x5'));var path=require('path');var sox=require(_0x79eb('0x6'));var csv=require(_0x79eb('0x7'));var ejs=require(_0x79eb('0x8'));var fs=require('fs');var fs_extra=require(_0x79eb('0x9'));var _=require(_0x79eb('0xa'));var squel=require(_0x79eb('0xb'));var crypto=require(_0x79eb('0xc'));var jsforce=require(_0x79eb('0xd'));var deskjs=require(_0x79eb('0xe'));var toCsv=require(_0x79eb('0x7'));var querystring=require(_0x79eb('0xf'));var Papa=require('papaparse');var Redis=require(_0x79eb('0x10'));var authService=require(_0x79eb('0x11'));var qs=require(_0x79eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79eb('0x13'));var logger=require(_0x79eb('0x14'))(_0x79eb('0x15'));var utils=require(_0x79eb('0x16'));var config=require(_0x79eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x79eb('0x18'))['db'];function respondWithStatusCode(_0x4af6c6,_0x13ad7a){_0x13ad7a=_0x13ad7a||0xcc;return function(_0x2f5abb){if(_0x2f5abb){return _0x4af6c6[_0x79eb('0x19')](_0x13ad7a);}return _0x4af6c6['status'](_0x13ad7a)[_0x79eb('0x1a')]();};}function respondWithResult(_0x3f1ffd,_0x57eb11){_0x57eb11=_0x57eb11||0xc8;return function(_0xbfafba){if(_0xbfafba){return _0x3f1ffd['status'](_0x57eb11)[_0x79eb('0x1b')](_0xbfafba);}};}function respondWithFilteredResult(_0x15df2e,_0x3f3941){return function(_0x5c0a0e){if(_0x5c0a0e){var _0x38ebec=typeof _0x3f3941[_0x79eb('0x1c')]===_0x79eb('0x1d')&&typeof _0x3f3941[_0x79eb('0x1e')]===_0x79eb('0x1d');var _0x5ee224=_0x5c0a0e[_0x79eb('0x1f')];var _0x4d951b=_0x38ebec?0x0:_0x3f3941[_0x79eb('0x1c')];var _0x4484f2=_0x38ebec?_0x5c0a0e['count']:_0x3f3941[_0x79eb('0x1c')]+_0x3f3941[_0x79eb('0x1e')];var _0x2cadaf;if(_0x4484f2>=_0x5ee224){_0x4484f2=_0x5ee224;_0x2cadaf=0xc8;}else{_0x2cadaf=0xce;}_0x15df2e[_0x79eb('0x20')](_0x2cadaf);return _0x15df2e['set'](_0x79eb('0x21'),_0x4d951b+'-'+_0x4484f2+'/'+_0x5ee224)[_0x79eb('0x1b')](_0x5c0a0e);}return null;};}function patchUpdates(_0x2a4241){return function(_0xad539a){try{jsonpatch['apply'](_0xad539a,_0x2a4241,!![]);}catch(_0x17c8eb){return BPromise[_0x79eb('0x22')](_0x17c8eb);}return _0xad539a['save']();};}function saveUpdates(_0x249145,_0x25073e){return function(_0xa85f5f){if(_0xa85f5f){return _0xa85f5f[_0x79eb('0x23')](_0x249145)[_0x79eb('0x24')](function(_0xf2f8fb){return _0xf2f8fb;});}return null;};}function removeEntity(_0x106ff1,_0x5c4da2){return function(_0x28243a){if(_0x28243a){return _0x28243a[_0x79eb('0x25')]()['then'](function(){var _0xaa2508=_0x28243a['get']({'plain':!![]});var _0x52dc7e=_0x79eb('0x26');return db[_0x79eb('0x27')]['destroy']({'where':{'type':_0x52dc7e,'resourceId':_0xaa2508['id']}})['then'](function(){return _0x28243a;});})[_0x79eb('0x24')](function(){_0x106ff1[_0x79eb('0x20')](0xcc)[_0x79eb('0x1a')]();});}};}function handleEntityNotFound(_0x6e4af3,_0x390cb6){return function(_0x1fded3){if(!_0x1fded3){_0x6e4af3[_0x79eb('0x19')](0x194);}return _0x1fded3;};}function handleError(_0x385ed8,_0x4262bf){_0x4262bf=_0x4262bf||0x1f4;return function(_0xb99148){logger[_0x79eb('0x28')](_0xb99148['stack']);if(_0xb99148[_0x79eb('0x29')]){delete _0xb99148[_0x79eb('0x29')];}_0x385ed8[_0x79eb('0x20')](_0x4262bf)[_0x79eb('0x2a')](_0xb99148);};}exports['index']=function(_0x57b929,_0x29471d){var _0x279031={},_0x1af7b1={},_0x3bdcb2={'count':0x0,'rows':[]};var _0x579359=_[_0x79eb('0x2b')](db['Schedule'][_0x79eb('0x2c')],function(_0x13b5b2){return{'name':_0x13b5b2['fieldName'],'type':_0x13b5b2[_0x79eb('0x2d')][_0x79eb('0x2e')]};});_0x1af7b1[_0x79eb('0x2f')]=_[_0x79eb('0x2b')](_0x579359,_0x79eb('0x29'));_0x1af7b1[_0x79eb('0x30')]=_[_0x79eb('0x31')](_0x57b929[_0x79eb('0x30')]);_0x1af7b1[_0x79eb('0x32')]=_[_0x79eb('0x33')](_0x1af7b1[_0x79eb('0x2f')],_0x1af7b1[_0x79eb('0x30')]);_0x279031[_0x79eb('0x34')]=_[_0x79eb('0x33')](_0x1af7b1[_0x79eb('0x2f')],qs[_0x79eb('0x35')](_0x57b929['query']['fields']));_0x279031[_0x79eb('0x34')]=_0x279031[_0x79eb('0x34')]['length']?_0x279031[_0x79eb('0x34')]:_0x1af7b1['model'];if(!_0x57b929[_0x79eb('0x30')][_0x79eb('0x36')](_0x79eb('0x37'))){_0x279031['limit']=qs['limit'](_0x57b929['query'][_0x79eb('0x1e')]);_0x279031[_0x79eb('0x1c')]=qs[_0x79eb('0x1c')](_0x57b929[_0x79eb('0x30')][_0x79eb('0x1c')]);}_0x279031[_0x79eb('0x38')]=qs[_0x79eb('0x39')](_0x57b929[_0x79eb('0x30')][_0x79eb('0x39')]);_0x279031[_0x79eb('0x3a')]=qs[_0x79eb('0x32')](_[_0x79eb('0x3b')](_0x57b929['query'],_0x1af7b1[_0x79eb('0x32')]),_0x579359);if(_0x57b929[_0x79eb('0x30')][_0x79eb('0x3c')]){_0x279031[_0x79eb('0x3a')]=_[_0x79eb('0x3d')](_0x279031[_0x79eb('0x3a')],{'$or':_[_0x79eb('0x2b')](_0x579359,function(_0x1fe9c1){if(_0x1fe9c1[_0x79eb('0x2d')]!==_0x79eb('0x3e')){var _0x265e04={};_0x265e04[_0x1fe9c1['name']]={'$like':'%'+_0x57b929[_0x79eb('0x30')]['filter']+'%'};return _0x265e04;}})});}_0x279031=_[_0x79eb('0x3d')]({},_0x279031,_0x57b929[_0x79eb('0x3f')]);var _0x1c77ea={'where':_0x279031[_0x79eb('0x3a')]};return db['Schedule'][_0x79eb('0x1f')](_0x1c77ea)[_0x79eb('0x24')](function(_0xea1150){_0x3bdcb2[_0x79eb('0x1f')]=_0xea1150;if(_0x57b929['query'][_0x79eb('0x40')]){_0x279031[_0x79eb('0x41')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x279031);})[_0x79eb('0x24')](function(_0x36ee86){_0x3bdcb2[_0x79eb('0x42')]=_0x36ee86;return _0x3bdcb2;})['then'](respondWithFilteredResult(_0x29471d,_0x279031))[_0x79eb('0x43')](handleError(_0x29471d,null));};exports['show']=function(_0x384f70,_0x2aabd1){var _0x44ba3b={'raw':![],'where':{'id':_0x384f70['params']['id']}},_0x5d5a5a={};_0x5d5a5a['model']=_[_0x79eb('0x31')](db[_0x79eb('0x44')][_0x79eb('0x2c')]);_0x5d5a5a[_0x79eb('0x30')]=_[_0x79eb('0x31')](_0x384f70[_0x79eb('0x30')]);_0x5d5a5a['filters']=_['intersection'](_0x5d5a5a[_0x79eb('0x2f')],_0x5d5a5a[_0x79eb('0x30')]);_0x44ba3b[_0x79eb('0x34')]=_[_0x79eb('0x33')](_0x5d5a5a[_0x79eb('0x2f')],qs[_0x79eb('0x35')](_0x384f70[_0x79eb('0x30')]['fields']));_0x44ba3b[_0x79eb('0x34')]=_0x44ba3b[_0x79eb('0x34')][_0x79eb('0x45')]?_0x44ba3b['attributes']:_0x5d5a5a[_0x79eb('0x2f')];if(_0x384f70[_0x79eb('0x30')][_0x79eb('0x40')]){_0x44ba3b[_0x79eb('0x41')]=[{'all':!![]}];}_0x44ba3b=_['merge']({},_0x44ba3b,_0x384f70[_0x79eb('0x3f')]);return db[_0x79eb('0x44')][_0x79eb('0x46')](_0x44ba3b)['then'](handleEntityNotFound(_0x2aabd1,null))[_0x79eb('0x24')](respondWithResult(_0x2aabd1,null))[_0x79eb('0x43')](handleError(_0x2aabd1,null));};exports[_0x79eb('0x47')]=function(_0x4a5afc,_0x4860eb){return db[_0x79eb('0x44')][_0x79eb('0x47')](_0x4a5afc['body'],{})[_0x79eb('0x24')](function(_0x215233){var _0x2f4649=_0x4a5afc[_0x79eb('0x48')]['get']({'plain':!![]});if(!_0x2f4649)throw new Error(_0x79eb('0x49'));if(_0x2f4649[_0x79eb('0x4a')]===_0x79eb('0x48')){var _0x3ba23f=_0x215233['get']({'plain':!![]});var _0x4bdb9a=_0x79eb('0x26');return db[_0x79eb('0x4b')][_0x79eb('0x46')]({'where':{'name':_0x4bdb9a,'userProfileId':_0x2f4649[_0x79eb('0x4c')]},'raw':!![]})[_0x79eb('0x24')](function(_0x379f23){if(_0x379f23&&_0x379f23[_0x79eb('0x4d')]===0x0){return db[_0x79eb('0x27')][_0x79eb('0x47')]({'name':_0x3ba23f[_0x79eb('0x29')],'resourceId':_0x3ba23f['id'],'type':_0x379f23[_0x79eb('0x29')],'sectionId':_0x379f23['id']},{})[_0x79eb('0x24')](function(){return _0x215233;});}else{return _0x215233;}})[_0x79eb('0x43')](function(_0x100f56){logger['error'](_0x79eb('0x4e'),_0x100f56);throw _0x100f56;});}return _0x215233;})[_0x79eb('0x24')](respondWithResult(_0x4860eb,0xc9))[_0x79eb('0x43')](handleError(_0x4860eb,null));};exports[_0x79eb('0x23')]=function(_0x52ef95,_0x44fa5a){if(_0x52ef95['body']['id']){delete _0x52ef95['body']['id'];}return db[_0x79eb('0x44')]['find']({'where':{'id':_0x52ef95[_0x79eb('0x4f')]['id']}})[_0x79eb('0x24')](handleEntityNotFound(_0x44fa5a,null))[_0x79eb('0x24')](saveUpdates(_0x52ef95[_0x79eb('0x50')],null))['then'](respondWithResult(_0x44fa5a,null))[_0x79eb('0x43')](handleError(_0x44fa5a,null));};exports[_0x79eb('0x25')]=function(_0x89d8a,_0x48695f){return db[_0x79eb('0x44')]['find']({'where':{'id':_0x89d8a[_0x79eb('0x4f')]['id']}})[_0x79eb('0x24')](handleEntityNotFound(_0x48695f,null))[_0x79eb('0x24')](removeEntity(_0x48695f,null))[_0x79eb('0x43')](handleError(_0x48695f,null));};exports[_0x79eb('0x51')]=function(_0x142a68,_0x55b373,_0x37a347){var _0x506551=require(_0x79eb('0x52'));return db[_0x79eb('0x44')][_0x79eb('0x46')]({'where':{'id':_0x142a68['params']['id']},'raw':!![]})[_0x79eb('0x24')](handleEntityNotFound(_0x55b373,null))[_0x79eb('0x24')](function(){_0x506551[_0x79eb('0x51')](_0x142a68[_0x79eb('0x4f')]['id']);})[_0x79eb('0x24')](respondWithStatusCode(_0x55b373,null))[_0x79eb('0x43')](handleError(_0x55b373,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b1ff254..ca5bcb1 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 _0x6c80=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x6c80,0x1e7));var _0x06c8=function(_0x215f90,_0x48d035){_0x215f90=_0x215f90-0x0;var _0x89d17d=_0x6c80[_0x215f90];return _0x89d17d;};'use strict';var _=require(_0x06c8('0x0'));var util=require(_0x06c8('0x1'));var logger=require(_0x06c8('0x2'))('api');var moment=require(_0x06c8('0x3'));var BPromise=require(_0x06c8('0x4'));var rp=require(_0x06c8('0x5'));var fs=require('fs');var path=require(_0x06c8('0x6'));var rimraf=require(_0x06c8('0x7'));var config=require(_0x06c8('0x8'));var attributes=require(_0x06c8('0x9'));module[_0x06c8('0xa')]=function(_0x4e6c4d,_0x20a3fd){return _0x4e6c4d[_0x06c8('0xb')](_0x06c8('0xc'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x168e=['./schedule.attributes','exports','define','util','api','request-promise','rimraf'];(function(_0x2fab69,_0x2c6f0d){var _0x5dcffa=function(_0x1be8d2){while(--_0x1be8d2){_0x2fab69['push'](_0x2fab69['shift']());}};_0x5dcffa(++_0x2c6f0d);}(_0x168e,0x11b));var _0xe168=function(_0x248ca8,_0x207fe6){_0x248ca8=_0x248ca8-0x0;var _0x1ada4f=_0x168e[_0x248ca8];return _0x1ada4f;};'use strict';var _=require('lodash');var util=require(_0xe168('0x0'));var logger=require('../../config/logger')(_0xe168('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe168('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe168('0x3'));var config=require('../../config/environment');var attributes=require(_0xe168('0x4'));module[_0xe168('0x5')]=function(_0x124dfe,_0x2892e3){return _0x124dfe[_0xe168('0x6')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index e91fd0b..0a6c493 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 _0x5367=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','randomstring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5367,0x10e));var _0x7536=function(_0x153e8d,_0x5aab1c){_0x153e8d=_0x153e8d-0x0;var _0x185c20=_0x5367[_0x153e8d];return _0x185c20;};'use strict';var _=require(_0x7536('0x0'));var util=require('util');var moment=require(_0x7536('0x1'));var BPromise=require('bluebird');var rs=require(_0x7536('0x2'));var fs=require('fs');var Redis=require(_0x7536('0x3'));var db=require(_0x7536('0x4'))['db'];var utils=require(_0x7536('0x5'));var logger=require(_0x7536('0x6'))(_0x7536('0x7'));var config=require(_0x7536('0x8'));var jayson=require(_0x7536('0x9'));var client=jayson['client'][_0x7536('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d3b1e,_0x1132e3,_0x289d49){return new BPromise(function(_0x5d698a,_0x5158b3){return client[_0x7536('0xb')](_0x5d3b1e,_0x289d49)['then'](function(_0x3b3a53){logger['info'](_0x7536('0xc'),_0x1132e3,_0x7536('0xd'));logger[_0x7536('0xe')](_0x7536('0xf'),_0x1132e3,_0x7536('0xd'),JSON['stringify'](_0x3b3a53));if(_0x3b3a53[_0x7536('0x10')]){if(_0x3b3a53['error'][_0x7536('0x11')]===0x1f4){logger[_0x7536('0x10')](_0x7536('0xc'),_0x1132e3,_0x3b3a53[_0x7536('0x10')][_0x7536('0x12')]);return _0x5158b3(_0x3b3a53[_0x7536('0x10')][_0x7536('0x12')]);}logger[_0x7536('0x10')](_0x7536('0xc'),_0x1132e3,_0x3b3a53[_0x7536('0x10')][_0x7536('0x12')]);return _0x5d698a(_0x3b3a53[_0x7536('0x10')][_0x7536('0x12')]);}else{logger[_0x7536('0x13')](_0x7536('0xc'),_0x1132e3,_0x7536('0xd'));_0x5d698a(_0x3b3a53['result'][_0x7536('0x12')]);}})[_0x7536('0x14')](function(_0x309202){logger[_0x7536('0x10')](_0x7536('0xc'),_0x1132e3,_0x309202);_0x5158b3(_0x309202);});});} \ No newline at end of file +var _0x54c0=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x21c152,_0x449b00){var _0x54501a=function(_0x5f5be7){while(--_0x5f5be7){_0x21c152['push'](_0x21c152['shift']());}};_0x54501a(++_0x449b00);}(_0x54c0,0x1cd));var _0x054c=function(_0x306248,_0x496141){_0x306248=_0x306248-0x0;var _0x1def01=_0x54c0[_0x306248];return _0x1def01;};'use strict';var _=require(_0x054c('0x0'));var util=require(_0x054c('0x1'));var moment=require(_0x054c('0x2'));var BPromise=require(_0x054c('0x3'));var rs=require(_0x054c('0x4'));var fs=require('fs');var Redis=require(_0x054c('0x5'));var db=require(_0x054c('0x6'))['db'];var utils=require(_0x054c('0x7'));var logger=require(_0x054c('0x8'))(_0x054c('0x9'));var config=require('../../config/environment');var jayson=require(_0x054c('0xa'));var client=jayson[_0x054c('0xb')][_0x054c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46285f,_0x344c9c,_0x559cba){return new BPromise(function(_0x531747,_0xe5dceb){return client[_0x054c('0xd')](_0x46285f,_0x559cba)[_0x054c('0xe')](function(_0xd115ce){logger[_0x054c('0xf')](_0x054c('0x10'),_0x344c9c,_0x054c('0x11'));logger[_0x054c('0x12')](_0x054c('0x13'),_0x344c9c,_0x054c('0x11'),JSON['stringify'](_0xd115ce));if(_0xd115ce[_0x054c('0x14')]){if(_0xd115ce[_0x054c('0x14')]['code']===0x1f4){logger[_0x054c('0x14')](_0x054c('0x10'),_0x344c9c,_0xd115ce[_0x054c('0x14')][_0x054c('0x15')]);return _0xe5dceb(_0xd115ce[_0x054c('0x14')]['message']);}logger['error'](_0x054c('0x10'),_0x344c9c,_0xd115ce['error']['message']);return _0x531747(_0xd115ce[_0x054c('0x14')][_0x054c('0x15')]);}else{logger[_0x054c('0xf')](_0x054c('0x10'),_0x344c9c,_0x054c('0x11'));_0x531747(_0xd115ce[_0x054c('0x16')][_0x054c('0x15')]);}})['catch'](function(_0x4bc13f){logger[_0x054c('0x14')](_0x054c('0x10'),_0x344c9c,_0x4bc13f);_0xe5dceb(_0x4bc13f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 1a428d0..a42b23f 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 _0x4b4f=['Router','fs-extra','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','util','path','express'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x4b4f,0xad));var _0xf4b4=function(_0x39344c,_0x5a5b44){_0x39344c=_0x39344c-0x0;var _0x392bfc=_0x4b4f[_0x39344c];return _0x392bfc;};'use strict';var multer=require('multer');var util=require(_0xf4b4('0x0'));var path=require(_0xf4b4('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4b4('0x2'));var router=express[_0xf4b4('0x3')]();var fs_extra=require(_0xf4b4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf4b4('0x5'));var controller=require(_0xf4b4('0x6'));router[_0xf4b4('0x7')]('/',auth['isAuthenticated'](),controller[_0xf4b4('0x8')]);router[_0xf4b4('0x7')](_0xf4b4('0x9'),auth[_0xf4b4('0xa')](),controller[_0xf4b4('0xb')]);router['get'](_0xf4b4('0xc'),auth[_0xf4b4('0xa')](),controller[_0xf4b4('0xd')]);router[_0xf4b4('0x7')](_0xf4b4('0xe'),auth[_0xf4b4('0xa')](),controller[_0xf4b4('0xf')]);router[_0xf4b4('0x10')]('/',auth['isAuthenticated'](),controller[_0xf4b4('0x11')]);router[_0xf4b4('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf4b4('0x13')](_0xf4b4('0xc'),auth['isAuthenticated'](),controller[_0xf4b4('0x14')]);module[_0xf4b4('0x15')]=router; \ No newline at end of file +var _0x6223=['post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','show','/:id/download'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x6223,0xc5));var _0x3622=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x6223[_0x2850c0];return _0x21e830;};'use strict';var multer=require(_0x3622('0x0'));var util=require(_0x3622('0x1'));var path=require('path');var timeout=require(_0x3622('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3622('0x3'));var auth=require(_0x3622('0x4'));var interaction=require(_0x3622('0x5'));var config=require('../../config/environment');var controller=require(_0x3622('0x6'));router['get']('/',auth[_0x3622('0x7')](),controller[_0x3622('0x8')]);router[_0x3622('0x9')]('/describe',auth[_0x3622('0x7')](),controller['describe']);router[_0x3622('0x9')]('/:id',auth[_0x3622('0x7')](),controller[_0x3622('0xa')]);router[_0x3622('0x9')](_0x3622('0xb'),auth[_0x3622('0x7')](),controller['download']);router[_0x3622('0xc')]('/',auth['isAuthenticated'](),controller[_0x3622('0xd')]);router[_0x3622('0xe')](_0x3622('0xf'),auth[_0x3622('0x7')](),controller[_0x3622('0x10')]);router[_0x3622('0x11')](_0x3622('0xf'),auth[_0x3622('0x7')](),controller['destroy']);module[_0x3622('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index faf34c1..1949864 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 _0xfff0=['subtract','setDataValue','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','path','../../config/environment','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','startedAt'];(function(_0x17ef24,_0x130579){var _0x500e40=function(_0x347bec){while(--_0x347bec){_0x17ef24['push'](_0x17ef24['shift']());}};_0x500e40(++_0x130579);}(_0xfff0,0x139));var _0x0fff=function(_0x4bc8f1,_0x20e541){_0x4bc8f1=_0x4bc8f1-0x0;var _0x26a351=_0xfff0[_0x4bc8f1];return _0x26a351;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var config=require(_0x0fff('0x2'));module['exports']={'format':{'type':Sequelize[_0x0fff('0x3')],'get':function(){return this[_0x0fff('0x4')](_0x0fff('0x5'))?path['extname'](this[_0x0fff('0x4')](_0x0fff('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0fff('0x6')]},'value':{'type':Sequelize[_0x0fff('0x6')],'set':function(_0x2f1d2b){var _0x586dc5=_0x2f1d2b[_0x0fff('0x7')](/\\/g,'/');this['setDataValue'](_0x0fff('0x5'),_0x586dc5);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0fff('0x8')],'set':function(_0x3db6f6){this['setDataValue'](_0x0fff('0x9'),moment()[_0x0fff('0xa')](_0x3db6f6,'ms'));this[_0x0fff('0xb')](_0x0fff('0xc'),moment());this[_0x0fff('0xb')](_0x0fff('0xd'),_0x3db6f6);}},'startedAt':{'type':Sequelize[_0x0fff('0xe')],'get':function(){return moment(this[_0x0fff('0x4')](_0x0fff('0x9')))[_0x0fff('0xf')](_0x0fff('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x0fff('0xe')],'get':function(){return moment(this['getDataValue'](_0x0fff('0xc')))[_0x0fff('0xf')](_0x0fff('0x10'))[_0x0fff('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x0fff('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x0fff('0xe')],'get':function(){return moment(this[_0x0fff('0x4')]('updatedAt'))[_0x0fff('0xf')](_0x0fff('0x10'))['toString']();}}}; \ No newline at end of file +var _0x42c3=['toString','DATE','createdAt','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm'];(function(_0xeb17cc,_0x40c096){var _0x3b9ae3=function(_0xb0abe7){while(--_0xb0abe7){_0xeb17cc['push'](_0xeb17cc['shift']());}};_0x3b9ae3(++_0x40c096);}(_0x42c3,0x1bc));var _0x342c=function(_0x360195,_0x51f689){_0x360195=_0x360195-0x0;var _0x51a470=_0x42c3[_0x360195];return _0x51a470;};'use strict';var Sequelize=require(_0x342c('0x0'));var moment=require(_0x342c('0x1'));var path=require(_0x342c('0x2'));var config=require('../../config/environment');module[_0x342c('0x3')]={'format':{'type':Sequelize[_0x342c('0x4')],'get':function(){return this[_0x342c('0x5')]('value')?path[_0x342c('0x6')](this['getDataValue'](_0x342c('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x342c('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x3f6d68){var _0x364f48=_0x3f6d68[_0x342c('0x9')](/\\/g,'/');this[_0x342c('0xa')]('value',_0x364f48);}},'rating':{'type':Sequelize[_0x342c('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x342c('0xb')],'set':function(_0x3bc287){this[_0x342c('0xa')](_0x342c('0xc'),moment()['subtract'](_0x3bc287,'ms'));this[_0x342c('0xa')](_0x342c('0xd'),moment());this[_0x342c('0xa')]('duration',_0x3bc287);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x342c('0xc')))[_0x342c('0xe')](_0x342c('0xf'))[_0x342c('0x10')]();}},'closedAt':{'type':Sequelize[_0x342c('0x11')],'get':function(){return moment(this[_0x342c('0x5')](_0x342c('0xd')))[_0x342c('0xe')](_0x342c('0xf'))[_0x342c('0x10')]();}},'createdAt':{'type':Sequelize[_0x342c('0x11')],'get':function(){return moment(this[_0x342c('0x5')](_0x342c('0x12')))[_0x342c('0xe')](_0x342c('0xf'))[_0x342c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x342c('0x11')],'get':function(){return moment(this['getDataValue'](_0x342c('0x13')))['format'](_0x342c('0xf'))[_0x342c('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 33d621d..17c53d8 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 _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x4be430,_0x59ca02){var _0x63ee3=function(_0x2e0081){while(--_0x2e0081){_0x4be430['push'](_0x4be430['shift']());}};_0x63ee3(++_0x59ca02);}(_0xed1f,0x6a));var _0xfed1=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xed1f[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file +var _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0x5e3cd8,_0x406428){var _0x20126b=function(_0x49da29){while(--_0x49da29){_0x5e3cd8['push'](_0x5e3cd8['shift']());}};_0x20126b(++_0x406428);}(_0x55ca,0x126));var _0xa55c=function(_0x1c3b41,_0x50f776){_0x1c3b41=_0x1c3b41-0x0;var _0x41e3fe=_0x55ca[_0x1c3b41];return _0x41e3fe;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ca8253d..3195c93 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 _0x7d89=['util','../../config/logger','request-promise','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x285ed8,_0x2de26b){var _0x4b1b8=function(_0x42c016){while(--_0x42c016){_0x285ed8['push'](_0x285ed8['shift']());}};_0x4b1b8(++_0x2de26b);}(_0x7d89,0x13e));var _0x97d8=function(_0x2e787d,_0x1300ba){_0x2e787d=_0x2e787d-0x0;var _0x1a351e=_0x7d89[_0x2e787d];return _0x1a351e;};'use strict';var _=require(_0x97d8('0x0'));var util=require(_0x97d8('0x1'));var logger=require(_0x97d8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x97d8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97d8('0x4'));var config=require('../../config/environment');var attributes=require(_0x97d8('0x5'));module[_0x97d8('0x6')]=function(_0x449ca3,_0x4ed7a3){return _0x449ca3[_0x97d8('0x7')](_0x97d8('0x8'),attributes,{'tableName':_0x97d8('0x9'),'paranoid':![],'indexes':[{'name':_0x97d8('0xa'),'fields':[_0x97d8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e1d=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x5bedd7,_0x48e6a6){var _0x1cdcfd=function(_0x50d6ea){while(--_0x50d6ea){_0x5bedd7['push'](_0x5bedd7['shift']());}};_0x1cdcfd(++_0x48e6a6);}(_0x8e1d,0x110));var _0xd8e1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8e1d[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xd8e1('0x0'));var util=require(_0xd8e1('0x1'));var logger=require(_0xd8e1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd8e1('0x3'));var rp=require(_0xd8e1('0x4'));var fs=require('fs');var path=require(_0xd8e1('0x5'));var rimraf=require('rimraf');var config=require(_0xd8e1('0x6'));var attributes=require(_0xd8e1('0x7'));module[_0xd8e1('0x8')]=function(_0xdb3009,_0x164d54){return _0xdb3009[_0xd8e1('0x9')](_0xd8e1('0xa'),attributes,{'tableName':_0xd8e1('0xb'),'paranoid':![],'indexes':[{'name':_0xd8e1('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 4066d95..471584e 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 _0x1ab1=['message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1d6396,_0x29fe97){var _0x869291=function(_0x869a6d){while(--_0x869a6d){_0x1d6396['push'](_0x1d6396['shift']());}};_0x869291(++_0x29fe97);}(_0x1ab1,0x9c));var _0x11ab=function(_0x4dc2df,_0x21b4e7){_0x4dc2df=_0x4dc2df-0x0;var _0x427035=_0x1ab1[_0x4dc2df];return _0x427035;};'use strict';var _=require('lodash');var util=require(_0x11ab('0x0'));var moment=require('moment');var BPromise=require(_0x11ab('0x1'));var rs=require(_0x11ab('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11ab('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x11ab('0x4'));var jayson=require(_0x11ab('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x362925,_0x26fc90,_0x4d1df8){return new BPromise(function(_0x4f8926,_0x29ed66){return client[_0x11ab('0x6')](_0x362925,_0x4d1df8)[_0x11ab('0x7')](function(_0x63ddd4){logger[_0x11ab('0x8')](_0x11ab('0x9'),_0x26fc90,_0x11ab('0xa'));logger[_0x11ab('0xb')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x26fc90,_0x11ab('0xa'),JSON[_0x11ab('0xc')](_0x63ddd4));if(_0x63ddd4[_0x11ab('0xd')]){if(_0x63ddd4[_0x11ab('0xd')]['code']===0x1f4){logger[_0x11ab('0xd')](_0x11ab('0x9'),_0x26fc90,_0x63ddd4[_0x11ab('0xd')][_0x11ab('0xe')]);return _0x29ed66(_0x63ddd4[_0x11ab('0xd')][_0x11ab('0xe')]);}logger[_0x11ab('0xd')](_0x11ab('0x9'),_0x26fc90,_0x63ddd4[_0x11ab('0xd')]['message']);return _0x4f8926(_0x63ddd4[_0x11ab('0xd')][_0x11ab('0xe')]);}else{logger[_0x11ab('0x8')](_0x11ab('0x9'),_0x26fc90,_0x11ab('0xa'));_0x4f8926(_0x63ddd4[_0x11ab('0xf')][_0x11ab('0xe')]);}})[_0x11ab('0x10')](function(_0x311e20){logger[_0x11ab('0xd')](_0x11ab('0x9'),_0x26fc90,_0x311e20);_0x29ed66(_0x311e20);});});} \ No newline at end of file +var _0x08ae=['message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3e4e85,_0x45dffc){var _0x575f18=function(_0x12d456){while(--_0x12d456){_0x3e4e85['push'](_0x3e4e85['shift']());}};_0x575f18(++_0x45dffc);}(_0x08ae,0x1ba));var _0xe08a=function(_0x18ed25,_0x3f4fbb){_0x18ed25=_0x18ed25-0x0;var _0x1bc566=_0x08ae[_0x18ed25];return _0x1bc566;};'use strict';var _=require(_0xe08a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe08a('0x1'));var fs=require('fs');var Redis=require(_0xe08a('0x2'));var db=require(_0xe08a('0x3'))['db'];var utils=require(_0xe08a('0x4'));var logger=require(_0xe08a('0x5'))(_0xe08a('0x6'));var config=require(_0xe08a('0x7'));var jayson=require(_0xe08a('0x8'));var client=jayson[_0xe08a('0x9')][_0xe08a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x391a08,_0x331973,_0xe4d053){return new BPromise(function(_0x2fbb73,_0x2e4d3c){return client[_0xe08a('0xb')](_0x391a08,_0xe4d053)['then'](function(_0x5680e1){logger[_0xe08a('0xc')](_0xe08a('0xd'),_0x331973,'request\x20sent');logger[_0xe08a('0xe')](_0xe08a('0xf'),_0x331973,_0xe08a('0x10'),JSON[_0xe08a('0x11')](_0x5680e1));if(_0x5680e1['error']){if(_0x5680e1[_0xe08a('0x12')][_0xe08a('0x13')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x331973,_0x5680e1[_0xe08a('0x12')][_0xe08a('0x14')]);return _0x2e4d3c(_0x5680e1[_0xe08a('0x12')][_0xe08a('0x14')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x331973,_0x5680e1[_0xe08a('0x12')]['message']);return _0x2fbb73(_0x5680e1[_0xe08a('0x12')][_0xe08a('0x14')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x331973,_0xe08a('0x10'));_0x2fbb73(_0x5680e1[_0xe08a('0x15')][_0xe08a('0x14')]);}})['catch'](function(_0x1d5b18){logger[_0xe08a('0x12')](_0xe08a('0xd'),_0x331973,_0x1d5b18);_0x2e4d3c(_0x1d5b18);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 63d5a6d..9034521 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 _0xf8d7=['update','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','index','get','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getFavicon','root','server/files/images/logos/','%s%s','extname','originalname','post','single','file','diskStorage','join','logologin','format','preferred','addPreferred','/:id/favicon','addFavicon'];(function(_0x32a6b6,_0x5b4051){var _0x1f0d46=function(_0x57a315){while(--_0x57a315){_0x32a6b6['push'](_0x32a6b6['shift']());}};_0x1f0d46(++_0x5b4051);}(_0xf8d7,0x10b));var _0x7f8d=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xf8d7[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0x7f8d('0x0'));var util=require(_0x7f8d('0x1'));var path=require('path');var timeout=require(_0x7f8d('0x2'));var express=require('express');var router=express[_0x7f8d('0x3')]();var fs_extra=require(_0x7f8d('0x4'));var auth=require(_0x7f8d('0x5'));var interaction=require(_0x7f8d('0x6'));var config=require('../../config/environment');var controller=require(_0x7f8d('0x7'));router['get']('/',auth[_0x7f8d('0x8')](),controller[_0x7f8d('0x9')]);router[_0x7f8d('0xa')](_0x7f8d('0xb'),controller['getDate']);router[_0x7f8d('0xa')](_0x7f8d('0xc'),controller[_0x7f8d('0xd')]);router[_0x7f8d('0xa')](_0x7f8d('0xe'),controller[_0x7f8d('0xf')]);router[_0x7f8d('0xa')](_0x7f8d('0x10'),controller[_0x7f8d('0x11')]);router[_0x7f8d('0xa')](_0x7f8d('0x12'),controller[_0x7f8d('0x13')]);router['get']('/:id/preferred',controller['getPreferred']);router[_0x7f8d('0xa')]('/:id/favicon',controller[_0x7f8d('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3bbce0,_0x2bcaea,_0x330260){_0x330260(null,path['join'](config[_0x7f8d('0x15')],_0x7f8d('0x16')));},'filename':function(_0x513797,_0x2a2fdb,_0x10902c){_0x10902c(null,util['format'](_0x7f8d('0x17'),'logo',path[_0x7f8d('0x18')](_0x2a2fdb[_0x7f8d('0x19')])));}})});router[_0x7f8d('0x1a')]('/:id/logo',upload[_0x7f8d('0x1b')](_0x7f8d('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0x7f8d('0x1d')]({'destination':function(_0x26f8f5,_0x51de35,_0x2af3fd){_0x2af3fd(null,path[_0x7f8d('0x1e')](config[_0x7f8d('0x15')],_0x7f8d('0x16')));},'filename':function(_0x3b8295,_0x2a1c2a,_0x56b429){_0x56b429(null,util['format'](_0x7f8d('0x17'),_0x7f8d('0x1f'),path[_0x7f8d('0x18')](_0x2a1c2a[_0x7f8d('0x19')])));}})});router[_0x7f8d('0x1a')](_0x7f8d('0x10'),upload[_0x7f8d('0x1b')](_0x7f8d('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7f8d('0x1d')]({'destination':function(_0x4f2b1a,_0x41ee62,_0x46f647){_0x46f647(null,path[_0x7f8d('0x1e')](config[_0x7f8d('0x15')],_0x7f8d('0x16')));},'filename':function(_0x5947b6,_0x509452,_0x3a77ef){_0x3a77ef(null,util[_0x7f8d('0x20')](_0x7f8d('0x17'),_0x7f8d('0x21'),path[_0x7f8d('0x18')](_0x509452[_0x7f8d('0x19')])));}})});router[_0x7f8d('0x1a')]('/:id/preferred',upload['single'](_0x7f8d('0x1c')),controller[_0x7f8d('0x22')]);var upload=multer({'storage':multer[_0x7f8d('0x1d')]({'destination':function(_0x227189,_0x5e1bcf,_0xccf9e4){_0xccf9e4(null,path[_0x7f8d('0x1e')](config[_0x7f8d('0x15')],_0x7f8d('0x16')));},'filename':function(_0x36c9c9,_0x3934df,_0x1c3446){_0x1c3446(null,util[_0x7f8d('0x20')]('%s%s','favicon',path[_0x7f8d('0x18')](_0x3934df[_0x7f8d('0x19')])));}})});router['post'](_0x7f8d('0x23'),upload[_0x7f8d('0x1b')]('file'),controller[_0x7f8d('0x24')]);router['put'](_0x7f8d('0xc'),auth[_0x7f8d('0x8')](),controller[_0x7f8d('0x25')]);module['exports']=router; \ No newline at end of file +var _0x4855=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/now','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','addLogoLogin','addPreferred','originalname','/:id','isAuthenticated','update','multer','path'];(function(_0x400019,_0xb47109){var _0x16a47a=function(_0x1fbc0e){while(--_0x1fbc0e){_0x400019['push'](_0x400019['shift']());}};_0x16a47a(++_0xb47109);}(_0x4855,0x1c6));var _0x5485=function(_0x2aa83a,_0x4b5c0b){_0x2aa83a=_0x2aa83a-0x0;var _0x36a653=_0x4855[_0x2aa83a];return _0x36a653;};'use strict';var multer=require(_0x5485('0x0'));var util=require('util');var path=require(_0x5485('0x1'));var timeout=require(_0x5485('0x2'));var express=require('express');var router=express[_0x5485('0x3')]();var fs_extra=require(_0x5485('0x4'));var auth=require(_0x5485('0x5'));var interaction=require(_0x5485('0x6'));var config=require(_0x5485('0x7'));var controller=require('./setting.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5485('0x8')]);router[_0x5485('0x9')](_0x5485('0xa'),controller['getDate']);router[_0x5485('0x9')]('/:id',controller[_0x5485('0xb')]);router['get'](_0x5485('0xc'),controller[_0x5485('0xd')]);router['get'](_0x5485('0xe'),controller[_0x5485('0xf')]);router['get'](_0x5485('0x10'),controller['gdpr']);router['get'](_0x5485('0x11'),controller['getPreferred']);router['get'](_0x5485('0x12'),controller[_0x5485('0x13')]);var upload=multer({'storage':multer[_0x5485('0x14')]({'destination':function(_0x564ef6,_0x498f82,_0x2f885b){_0x2f885b(null,path[_0x5485('0x15')](config[_0x5485('0x16')],_0x5485('0x17')));},'filename':function(_0x5026c7,_0x5c6131,_0x411011){_0x411011(null,util[_0x5485('0x18')](_0x5485('0x19'),_0x5485('0x1a'),path[_0x5485('0x1b')](_0x5c6131['originalname'])));}})});router[_0x5485('0x1c')](_0x5485('0xc'),upload[_0x5485('0x1d')](_0x5485('0x1e')),controller[_0x5485('0x1f')]);var upload=multer({'storage':multer[_0x5485('0x14')]({'destination':function(_0x17c514,_0x1003e6,_0xeae318){_0xeae318(null,path[_0x5485('0x15')](config[_0x5485('0x16')],_0x5485('0x17')));},'filename':function(_0x371815,_0x4f6ba2,_0x31290e){_0x31290e(null,util[_0x5485('0x18')]('%s%s','logologin',path[_0x5485('0x1b')](_0x4f6ba2['originalname'])));}})});router[_0x5485('0x1c')]('/:id/logo_login',upload[_0x5485('0x1d')](_0x5485('0x1e')),controller[_0x5485('0x20')]);var upload=multer({'storage':multer[_0x5485('0x14')]({'destination':function(_0x5324cc,_0x5e3e1d,_0x509e63){_0x509e63(null,path['join'](config[_0x5485('0x16')],'server/files/images/logos/'));},'filename':function(_0xf3aba7,_0xfe2d4b,_0x2b81e1){_0x2b81e1(null,util[_0x5485('0x18')](_0x5485('0x19'),'preferred',path[_0x5485('0x1b')](_0xfe2d4b['originalname'])));}})});router[_0x5485('0x1c')](_0x5485('0x11'),upload[_0x5485('0x1d')](_0x5485('0x1e')),controller[_0x5485('0x21')]);var upload=multer({'storage':multer[_0x5485('0x14')]({'destination':function(_0x35f235,_0x4fef6e,_0x1010a9){_0x1010a9(null,path[_0x5485('0x15')](config[_0x5485('0x16')],'server/files/images/logos/'));},'filename':function(_0x204aca,_0x1b887c,_0x55ab9f){_0x55ab9f(null,util[_0x5485('0x18')](_0x5485('0x19'),'favicon',path[_0x5485('0x1b')](_0x1b887c[_0x5485('0x22')])));}})});router[_0x5485('0x1c')](_0x5485('0x12'),upload[_0x5485('0x1d')]('file'),controller['addFavicon']);router['put'](_0x5485('0x23'),auth[_0x5485('0x24')](),controller[_0x5485('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 22f580c..e151492 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 _0x846d=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize','min_internal','min_mailbox','INTEGER'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x846d,0xef));var _0xd846=function(_0x1aed01,_0x3b59f3){_0x1aed01=_0x1aed01-0x0;var _0x34ccb8=_0x846d[_0x1aed01];return _0x34ccb8;};'use strict';var Sequelize=require(_0xd846('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xd846('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xd846('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd846('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd846('0x4')],'defaultValue':_0xd846('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd846('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xd846('0x4')]},'turnaddr':{'type':Sequelize[_0xd846('0x4')]},'turnusername':{'type':Sequelize[_0xd846('0x4')]},'turnpassword':{'type':Sequelize[_0xd846('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd846('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xd846('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd846('0x4')],'defaultValue':_0xd846('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd846('0x4')]},'defaultPreferred':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xd846('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd846('0x4')]},'defaultFavicon':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd846('0x3')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xd846('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xd846('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xd846('0x3')](0x2)[_0xd846('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xd846('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xd846('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd846('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xd846('0x6')],'defaultValue':![]},'viewHelpSection':{'type':Sequelize[_0xd846('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdc1d=['BOOLEAN','alternate','UNSIGNED','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x370736,_0x965e53){var _0x531a67=function(_0x5f1430){while(--_0x5f1430){_0x370736['push'](_0x370736['shift']());}};_0x531a67(++_0x965e53);}(_0xdc1d,0x88));var _0xddc1=function(_0x127904,_0x4fc951){_0x127904=_0x127904-0x0;var _0x3e7177=_0xdc1d[_0x127904];return _0x3e7177;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0xddc1('0x0')](0xb),'unique':_0xddc1('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xddc1('0x0')](0xb),'unique':_0xddc1('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xddc1('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xddc1('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xddc1('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xddc1('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xddc1('0x3')]},'turnaddr':{'type':Sequelize[_0xddc1('0x3')]},'turnusername':{'type':Sequelize[_0xddc1('0x3')]},'turnpassword':{'type':Sequelize[_0xddc1('0x3')]},'pageTitle':{'type':Sequelize[_0xddc1('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xddc1('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xddc1('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xddc1('0x3')],'defaultValue':_0xddc1('0x5')},'chatTimeout':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xddc1('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xddc1('0x0')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xddc1('0x0')]},'sentimentRegion':{'type':Sequelize[_0xddc1('0x3')]},'language':{'type':Sequelize[_0xddc1('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xddc1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xddc1('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xddc1('0x0')](0x2)[_0xddc1('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xddc1('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xddc1('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xddc1('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7472225..c1f0516 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 _0x5c86=['mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','client','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','filter','includeAll','include','findAll','rows','show','params','options','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','custom','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','../../config/license/util','getLogoLogin','getLicense','preferred','favicon','default_loginLogo.svg','default','gdpr','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x2a7b74,_0x45b0d5){var _0x114666=function(_0x1a293b){while(--_0x1a293b){_0x2a7b74['push'](_0x2a7b74['shift']());}};_0x114666(++_0x45b0d5);}(_0x5c86,0x73));var _0x65c8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5c86[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x65c8('0x0'));var jsonpatch=require(_0x65c8('0x1'));var rp=require(_0x65c8('0x2'));var moment=require('moment');var BPromise=require(_0x65c8('0x3'));var Mustache=require(_0x65c8('0x4'));var util=require(_0x65c8('0x5'));var path=require('path');var sox=require(_0x65c8('0x6'));var csv=require('to-csv');var ejs=require(_0x65c8('0x7'));var fs=require('fs');var fs_extra=require(_0x65c8('0x8'));var _=require(_0x65c8('0x9'));var squel=require(_0x65c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x65c8('0xb'));var deskjs=require(_0x65c8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65c8('0xd'));var Papa=require(_0x65c8('0xe'));var Redis=require(_0x65c8('0xf'));var authService=require(_0x65c8('0x10'));var qs=require(_0x65c8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65c8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x65c8('0x13'));var config=require(_0x65c8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x65c8('0x15')][_0x65c8('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3c5eda,_0x58af60,_0x493a3c,_0x1404ce){return new BPromise(function(_0x284e3e,_0x32359f){var _0x1cac71=_0x1404ce||client;return _0x1cac71['request'](_0x3c5eda,_0x493a3c)[_0x65c8('0x17')](function(_0x26b4d1){logger[_0x65c8('0x18')]('Setting,\x20%s,\x20%s',_0x58af60,_0x65c8('0x19'));logger[_0x65c8('0x1a')](_0x65c8('0x1b'),_0x58af60,'request\x20sent',JSON[_0x65c8('0x1c')](_0x26b4d1));if(_0x26b4d1[_0x65c8('0x1d')]){if(_0x26b4d1['error'][_0x65c8('0x1e')]===0x1f4){logger[_0x65c8('0x1d')](_0x65c8('0x1f'),_0x58af60,_0x26b4d1[_0x65c8('0x1d')]['message']);return _0x32359f(_0x26b4d1[_0x65c8('0x1d')]['message']);}logger[_0x65c8('0x1d')](_0x65c8('0x1f'),_0x58af60,_0x26b4d1['error']['message']);return _0x284e3e(_0x26b4d1[_0x65c8('0x1d')][_0x65c8('0x20')]);}else{logger['info'](_0x65c8('0x1f'),_0x58af60,_0x65c8('0x19'));_0x284e3e(_0x26b4d1[_0x65c8('0x21')][_0x65c8('0x20')]);}})[_0x65c8('0x22')](function(_0x6d1bc9){logger[_0x65c8('0x1d')](_0x65c8('0x1f'),_0x58af60,_0x6d1bc9);_0x32359f(_0x6d1bc9);});});}function respondWithStatusCode(_0x5b96fa,_0x2b8466){_0x2b8466=_0x2b8466||0xcc;return function(_0x574573){if(_0x574573){return _0x5b96fa[_0x65c8('0x23')](_0x2b8466);}return _0x5b96fa[_0x65c8('0x24')](_0x2b8466)[_0x65c8('0x25')]();};}function respondWithResult(_0xbe7718,_0x2ddf32){_0x2ddf32=_0x2ddf32||0xc8;return function(_0x1ad765){if(_0x1ad765){return _0xbe7718[_0x65c8('0x24')](_0x2ddf32)[_0x65c8('0x26')](_0x1ad765);}};}function respondWithFilteredResult(_0x1c2177,_0xeb9317){return function(_0x34ea7c){if(_0x34ea7c){var _0x36e6a8=typeof _0xeb9317[_0x65c8('0x27')]===_0x65c8('0x28')&&typeof _0xeb9317['limit']===_0x65c8('0x28');var _0x32efe9=_0x34ea7c[_0x65c8('0x29')];var _0x1ef607=_0x36e6a8?0x0:_0xeb9317[_0x65c8('0x27')];var _0x1c3e3b=_0x36e6a8?_0x34ea7c[_0x65c8('0x29')]:_0xeb9317[_0x65c8('0x27')]+_0xeb9317[_0x65c8('0x2a')];var _0x206480;if(_0x1c3e3b>=_0x32efe9){_0x1c3e3b=_0x32efe9;_0x206480=0xc8;}else{_0x206480=0xce;}_0x1c2177[_0x65c8('0x24')](_0x206480);return _0x1c2177[_0x65c8('0x2b')](_0x65c8('0x2c'),_0x1ef607+'-'+_0x1c3e3b+'/'+_0x32efe9)[_0x65c8('0x26')](_0x34ea7c);}return null;};}function patchUpdates(_0x584cf4){return function(_0x1bee79){try{jsonpatch['apply'](_0x1bee79,_0x584cf4,!![]);}catch(_0x2124ef){return BPromise[_0x65c8('0x2d')](_0x2124ef);}return _0x1bee79['save']();};}function saveUpdates(_0x5f1e05,_0x3cbb7c){return function(_0x153b4d){if(_0x153b4d){return _0x153b4d[_0x65c8('0x2e')](_0x5f1e05)['then'](function(_0x455f0b){return _0x455f0b;});}return null;};}function removeEntity(_0x106bcc,_0x50f8bc){return function(_0x3c99e9){if(_0x3c99e9){return _0x3c99e9[_0x65c8('0x2f')]()['then'](function(){_0x106bcc[_0x65c8('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f2277,_0x56b951){return function(_0x200ed6){if(!_0x200ed6){_0x4f2277[_0x65c8('0x23')](0x194);}return _0x200ed6;};}function handleError(_0x2e05e7,_0x58c482){_0x58c482=_0x58c482||0x1f4;return function(_0xaede22){logger[_0x65c8('0x1d')](_0xaede22[_0x65c8('0x30')]);if(_0xaede22[_0x65c8('0x31')]){delete _0xaede22[_0x65c8('0x31')];}_0x2e05e7[_0x65c8('0x24')](_0x58c482)[_0x65c8('0x32')](_0xaede22);};}exports[_0x65c8('0x33')]=function(_0xdeab03,_0x4cae46){var _0x418f35={},_0x1ca141={},_0x277caf={'count':0x0,'rows':[]};var _0x160911=_[_0x65c8('0x34')](db[_0x65c8('0x35')][_0x65c8('0x36')],function(_0x524849){return{'name':_0x524849[_0x65c8('0x37')],'type':_0x524849[_0x65c8('0x38')]['key']};});_0x1ca141[_0x65c8('0x39')]=_[_0x65c8('0x34')](_0x160911,_0x65c8('0x31'));_0x1ca141['query']=_[_0x65c8('0x3a')](_0xdeab03['query']);_0x1ca141[_0x65c8('0x3b')]=_[_0x65c8('0x3c')](_0x1ca141['model'],_0x1ca141[_0x65c8('0x3d')]);_0x418f35['attributes']=_['intersection'](_0x1ca141['model'],qs['fields'](_0xdeab03[_0x65c8('0x3d')][_0x65c8('0x3e')]));_0x418f35[_0x65c8('0x3f')]=_0x418f35['attributes'][_0x65c8('0x40')]?_0x418f35['attributes']:_0x1ca141[_0x65c8('0x39')];if(!_0xdeab03[_0x65c8('0x3d')][_0x65c8('0x41')](_0x65c8('0x42'))){_0x418f35['limit']=qs[_0x65c8('0x2a')](_0xdeab03[_0x65c8('0x3d')][_0x65c8('0x2a')]);_0x418f35[_0x65c8('0x27')]=qs['offset'](_0xdeab03[_0x65c8('0x3d')][_0x65c8('0x27')]);}_0x418f35['order']=qs[_0x65c8('0x43')](_0xdeab03[_0x65c8('0x3d')][_0x65c8('0x43')]);_0x418f35[_0x65c8('0x44')]=qs[_0x65c8('0x3b')](_['pick'](_0xdeab03['query'],_0x1ca141['filters']),_0x160911);if(_0xdeab03[_0x65c8('0x3d')]['filter']){_0x418f35['where']=_[_0x65c8('0x45')](_0x418f35[_0x65c8('0x44')],{'$or':_[_0x65c8('0x34')](_0x160911,function(_0xcba295){if(_0xcba295[_0x65c8('0x38')]!=='VIRTUAL'){var _0x1500ea={};_0x1500ea[_0xcba295[_0x65c8('0x31')]]={'$like':'%'+_0xdeab03[_0x65c8('0x3d')][_0x65c8('0x46')]+'%'};return _0x1500ea;}})});}_0x418f35=_[_0x65c8('0x45')]({},_0x418f35,_0xdeab03['options']);var _0x3eea22={'where':_0x418f35[_0x65c8('0x44')]};return db['Setting'][_0x65c8('0x29')](_0x3eea22)[_0x65c8('0x17')](function(_0x5647f5){_0x277caf[_0x65c8('0x29')]=_0x5647f5;if(_0xdeab03['query'][_0x65c8('0x47')]){_0x418f35[_0x65c8('0x48')]=[{'all':!![]}];}return db[_0x65c8('0x35')][_0x65c8('0x49')](_0x418f35);})[_0x65c8('0x17')](function(_0x1bcf9d){_0x277caf[_0x65c8('0x4a')]=_0x1bcf9d;return _0x277caf;})[_0x65c8('0x17')](respondWithFilteredResult(_0x4cae46,_0x418f35))[_0x65c8('0x22')](handleError(_0x4cae46,null));};exports[_0x65c8('0x4b')]=function(_0x91e357,_0x1d85d0){var _0x5a50b8={'raw':![],'where':{'id':_0x91e357[_0x65c8('0x4c')]['id']}},_0x5e7fc3={};_0x5e7fc3[_0x65c8('0x39')]=_[_0x65c8('0x3a')](db[_0x65c8('0x35')][_0x65c8('0x36')]);_0x5e7fc3['query']=_[_0x65c8('0x3a')](_0x91e357[_0x65c8('0x3d')]);_0x5e7fc3[_0x65c8('0x3b')]=_[_0x65c8('0x3c')](_0x5e7fc3[_0x65c8('0x39')],_0x5e7fc3[_0x65c8('0x3d')]);_0x5a50b8['attributes']=_['intersection'](_0x5e7fc3[_0x65c8('0x39')],qs[_0x65c8('0x3e')](_0x91e357[_0x65c8('0x3d')][_0x65c8('0x3e')]));_0x5a50b8['attributes']=_0x5a50b8['attributes'][_0x65c8('0x40')]?_0x5a50b8['attributes']:_0x5e7fc3['model'];if(_0x91e357[_0x65c8('0x3d')]['includeAll']){_0x5a50b8[_0x65c8('0x48')]=[{'all':!![]}];}_0x5a50b8=_[_0x65c8('0x45')]({},_0x5a50b8,_0x91e357[_0x65c8('0x4d')]);return db[_0x65c8('0x35')][_0x65c8('0x4e')](_0x5a50b8)[_0x65c8('0x17')](handleEntityNotFound(_0x1d85d0,null))['then'](respondWithResult(_0x1d85d0,null))['catch'](handleError(_0x1d85d0,null));};exports[_0x65c8('0x2e')]=function(_0x4741a4,_0x58cb4d){if(_0x4741a4[_0x65c8('0x4f')]['id']){delete _0x4741a4['body']['id'];}return db['Setting'][_0x65c8('0x4e')]({'where':{'id':_0x4741a4[_0x65c8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58cb4d,null))[_0x65c8('0x17')](saveUpdates(_0x4741a4[_0x65c8('0x4f')],null))[_0x65c8('0x17')](respondWithResult(_0x58cb4d,null))[_0x65c8('0x22')](handleError(_0x58cb4d,null));};exports[_0x65c8('0x50')]=function(_0x27ea04,_0x56567e,_0xb22874){if(_0x27ea04[_0x65c8('0x51')]&&_0x27ea04[_0x65c8('0x51')][_0x65c8('0x52')]){_0x27ea04[_0x65c8('0x4f')][_0x65c8('0x53')]=_0x27ea04['file'][_0x65c8('0x52')];}return db[_0x65c8('0x35')][_0x65c8('0x4e')]({'where':{'id':_0x27ea04['params']['id']}})['then'](handleEntityNotFound(_0x56567e,null))['then'](saveUpdates(_0x27ea04[_0x65c8('0x4f')],null))[_0x65c8('0x17')](respondWithResult(_0x56567e,null))['catch'](handleError(_0x56567e,null));};exports['addLogoLogin']=function(_0x26e9fd,_0x1b7773,_0x5cff16){if(_0x26e9fd[_0x65c8('0x51')]&&_0x26e9fd[_0x65c8('0x51')][_0x65c8('0x52')]){_0x26e9fd[_0x65c8('0x4f')][_0x65c8('0x54')]=_0x26e9fd[_0x65c8('0x51')][_0x65c8('0x52')];}return db[_0x65c8('0x35')][_0x65c8('0x4e')]({'where':{'id':_0x26e9fd['params']['id']}})[_0x65c8('0x17')](handleEntityNotFound(_0x1b7773,null))[_0x65c8('0x17')](saveUpdates(_0x26e9fd[_0x65c8('0x4f')],null))[_0x65c8('0x17')](respondWithResult(_0x1b7773,null))[_0x65c8('0x22')](handleError(_0x1b7773,null));};var utilLicense=require('../../config/license/util');exports[_0x65c8('0x55')]=function(_0x1c8c02,_0x3f57a4,_0x124cf0){var _0x2b8ffa=_0x65c8('0x56');var _0x4d1a8b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x55420){if(_0x55420){_0x4d1a8b=_0x55420;}return db[_0x65c8('0x35')][_0x65c8('0x4e')]({'where':{'id':_0x1c8c02[_0x65c8('0x4c')]['id']},'attributes':['logo',_0x65c8('0x54'),'preferred','favicon',_0x65c8('0x57'),_0x65c8('0x58'),_0x65c8('0x59'),_0x65c8('0x5a')],'raw':!![]});})[_0x65c8('0x17')](handleEntityNotFound(_0x3f57a4,null))[_0x65c8('0x17')](function(_0xa5995f){if(_0xa5995f){var _0x223c3e=_0xa5995f[_0x65c8('0x53')]&&fs['existsSync'](path['join'](config[_0x65c8('0x5b')],_0x2b8ffa,_[_0x65c8('0x5c')](_0xa5995f[_0x65c8('0x53')])))?path[_0x65c8('0x5d')](config[_0x65c8('0x5b')],_0x2b8ffa,_[_0x65c8('0x5c')](_0xa5995f[_0x65c8('0x53')])):path[_0x65c8('0x5d')](config['root'],_0x2b8ffa,_[_0x65c8('0x5c')](_0x65c8('0x5e')));var _0x4473de='default'+_['upperFirst']('logo');if(_0xa5995f[_0x4473de]||!_0x4d1a8b[_0x65c8('0x5f')]){_0x223c3e=path[_0x65c8('0x5d')](config[_0x65c8('0x5b')],_0x2b8ffa,_[_0x65c8('0x5c')](_0x65c8('0x5e')));}if(!fs[_0x65c8('0x60')](_0x223c3e)){throw new db[(_0x65c8('0x61'))][(_0x65c8('0x62'))](_[_0x65c8('0x63')](_0x65c8('0x53'))+_0x65c8('0x64'));}return _0x3f57a4[_0x65c8('0x65')](_0x223c3e);}})['catch'](handleError(_0x3f57a4,null));};var utilLicense=require(_0x65c8('0x66'));exports[_0x65c8('0x67')]=function(_0x97408e,_0x3c1a70,_0x18f0d9){var _0x12559='server/files/images/logos';var _0x53e0f7={'custom':![]};return utilLicense[_0x65c8('0x68')]()[_0x65c8('0x17')](function(_0x12a444){if(_0x12a444){_0x53e0f7=_0x12a444;}return db[_0x65c8('0x35')][_0x65c8('0x4e')]({'where':{'id':_0x97408e[_0x65c8('0x4c')]['id']},'attributes':[_0x65c8('0x53'),_0x65c8('0x54'),_0x65c8('0x69'),_0x65c8('0x6a'),_0x65c8('0x57'),_0x65c8('0x58'),'defaultPreferred',_0x65c8('0x5a')],'raw':!![]});})[_0x65c8('0x17')](handleEntityNotFound(_0x3c1a70,null))[_0x65c8('0x17')](function(_0xde3795){if(_0xde3795){var _0x11e0f0=_0xde3795[_0x65c8('0x54')]&&fs['existsSync'](path[_0x65c8('0x5d')](config[_0x65c8('0x5b')],_0x12559,_['toLower'](_0xde3795['loginLogo'])))?path['join'](config['root'],_0x12559,_[_0x65c8('0x5c')](_0xde3795['loginLogo'])):path[_0x65c8('0x5d')](config[_0x65c8('0x5b')],_0x12559,_[_0x65c8('0x5c')](_0x65c8('0x6b')));var _0x3a9887=_0x65c8('0x6c')+_[_0x65c8('0x63')](_0x65c8('0x54'));if(_0xde3795[_0x3a9887]||!_0x53e0f7[_0x65c8('0x5f')]){_0x11e0f0=path['join'](config[_0x65c8('0x5b')],_0x12559,_['toLower'](_0x65c8('0x6b')));}if(!fs[_0x65c8('0x60')](_0x11e0f0)){throw new db['Sequelize'][(_0x65c8('0x62'))](_[_0x65c8('0x63')](_0x65c8('0x54'))+'\x20not\x20found');}return _0x3c1a70[_0x65c8('0x65')](_0x11e0f0);}})[_0x65c8('0x22')](handleError(_0x3c1a70,null));};exports[_0x65c8('0x6d')]=function(_0x3cfa2c,_0xb500f9){return db[_0x65c8('0x35')]['find']({'where':{'id':_0x3cfa2c['params']['id']},'attributes':['securePassword']})['then'](respondWithResult(_0xb500f9,null))[_0x65c8('0x22')](handleError(_0xb500f9,null));};exports[_0x65c8('0x6e')]=function(_0x2ac453,_0x4c6d09,_0x4dbfad){if(_0x2ac453[_0x65c8('0x51')]&&_0x2ac453[_0x65c8('0x51')]['filename']){_0x2ac453[_0x65c8('0x4f')][_0x65c8('0x69')]=_0x2ac453[_0x65c8('0x51')][_0x65c8('0x52')];}return db[_0x65c8('0x35')][_0x65c8('0x4e')]({'where':{'id':_0x2ac453[_0x65c8('0x4c')]['id']}})[_0x65c8('0x17')](handleEntityNotFound(_0x4c6d09,null))['then'](saveUpdates(_0x2ac453['body'],null))[_0x65c8('0x17')](respondWithResult(_0x4c6d09,null))['catch'](handleError(_0x4c6d09,null));};var utilLicense=require(_0x65c8('0x66'));exports[_0x65c8('0x6f')]=function(_0xa893ba,_0x164e17,_0x5ada5c){var _0x440751=_0x65c8('0x56');var _0x2955db={'custom':![]};return utilLicense['getLicense']()[_0x65c8('0x17')](function(_0x3a14c3){if(_0x3a14c3){_0x2955db=_0x3a14c3;}return db['Setting'][_0x65c8('0x4e')]({'where':{'id':_0xa893ba['params']['id']},'attributes':[_0x65c8('0x53'),_0x65c8('0x54'),_0x65c8('0x69'),'favicon',_0x65c8('0x57'),_0x65c8('0x58'),_0x65c8('0x59'),_0x65c8('0x5a')],'raw':!![]});})[_0x65c8('0x17')](handleEntityNotFound(_0x164e17,null))[_0x65c8('0x17')](function(_0x9c2256){if(_0x9c2256){var _0x2bdcb4=_0x9c2256[_0x65c8('0x69')]&&fs[_0x65c8('0x60')](path['join'](config[_0x65c8('0x5b')],_0x440751,_[_0x65c8('0x5c')](_0x9c2256[_0x65c8('0x69')])))?path[_0x65c8('0x5d')](config[_0x65c8('0x5b')],_0x440751,_[_0x65c8('0x5c')](_0x9c2256[_0x65c8('0x69')])):path[_0x65c8('0x5d')](config[_0x65c8('0x5b')],_0x440751,_[_0x65c8('0x5c')]('default_preferred.png'));var _0x4d728c=_0x65c8('0x6c')+_[_0x65c8('0x63')]('preferred');if(_0x9c2256[_0x4d728c]||!_0x2955db[_0x65c8('0x5f')]||!_0x2955db[_0x65c8('0x69')]){_0x2bdcb4=path[_0x65c8('0x5d')](config['root'],_0x440751,_[_0x65c8('0x5c')](_0x65c8('0x70')));}if(!fs[_0x65c8('0x60')](_0x2bdcb4)){throw new db['Sequelize'][(_0x65c8('0x62'))](_[_0x65c8('0x63')]('preferred')+_0x65c8('0x64'));}return _0x164e17['download'](_0x2bdcb4);}})[_0x65c8('0x22')](handleError(_0x164e17,null));};exports['addFavicon']=function(_0x65ae5b,_0x1668e8,_0x219a33){if(_0x65ae5b[_0x65c8('0x51')]&&_0x65ae5b[_0x65c8('0x51')][_0x65c8('0x52')]){_0x65ae5b['body']['favicon']=_0x65ae5b[_0x65c8('0x51')][_0x65c8('0x52')];}return db[_0x65c8('0x35')][_0x65c8('0x4e')]({'where':{'id':_0x65ae5b[_0x65c8('0x4c')]['id']}})[_0x65c8('0x17')](handleEntityNotFound(_0x1668e8,null))[_0x65c8('0x17')](saveUpdates(_0x65ae5b[_0x65c8('0x4f')],null))[_0x65c8('0x17')](respondWithResult(_0x1668e8,null))[_0x65c8('0x22')](handleError(_0x1668e8,null));};var utilLicense=require('../../config/license/util');exports[_0x65c8('0x71')]=function(_0x3b1424,_0x43e642,_0x2504dd){var _0x5285d6=_0x65c8('0x56');var _0xdc7d18={'custom':![]};return utilLicense[_0x65c8('0x68')]()[_0x65c8('0x17')](function(_0xc48e22){if(_0xc48e22){_0xdc7d18=_0xc48e22;}return db['Setting'][_0x65c8('0x4e')]({'where':{'id':_0x3b1424['params']['id']},'attributes':[_0x65c8('0x53'),_0x65c8('0x54'),_0x65c8('0x69'),_0x65c8('0x6a'),_0x65c8('0x57'),_0x65c8('0x58'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x65c8('0x17')](handleEntityNotFound(_0x43e642,null))[_0x65c8('0x17')](function(_0x1da0c5){if(_0x1da0c5){var _0x2d383b=_0x1da0c5[_0x65c8('0x6a')]&&fs['existsSync'](path[_0x65c8('0x5d')](config['root'],_0x5285d6,_['toLower'](_0x1da0c5[_0x65c8('0x6a')])))?path['join'](config['root'],_0x5285d6,_[_0x65c8('0x5c')](_0x1da0c5[_0x65c8('0x6a')])):path[_0x65c8('0x5d')](config[_0x65c8('0x5b')],_0x5285d6,_[_0x65c8('0x5c')](_0x65c8('0x72')));var _0x116c17='default'+_[_0x65c8('0x63')](_0x65c8('0x6a'));if(_0x1da0c5[_0x116c17]||!_0xdc7d18[_0x65c8('0x5f')]){_0x2d383b=path['join'](config[_0x65c8('0x5b')],_0x5285d6,_[_0x65c8('0x5c')](_0x65c8('0x72')));}if(!fs['existsSync'](_0x2d383b)){throw new db[(_0x65c8('0x61'))][(_0x65c8('0x62'))](_[_0x65c8('0x63')](_0x65c8('0x6a'))+_0x65c8('0x64'));}return _0x43e642['download'](_0x2d383b);}})[_0x65c8('0x22')](handleError(_0x43e642,null));};exports['getDate']=function(_0x2031f7,_0x5e17e4){var _0x424c83={'offset':moment()[_0x65c8('0x73')]()};_0x424c83[_0x65c8('0x74')]=moment()[_0x65c8('0x73')](_0x424c83['offset'])[_0x65c8('0x75')](_0x65c8('0x76'));return _0x5e17e4[_0x65c8('0x24')](0xc8)[_0x65c8('0x32')](_0x424c83);}; \ No newline at end of file +var _0x5cd7=['existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','getLogoLogin','default_loginLogo.svg','\x20not\x20found','download','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','send','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','client','http','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','end','sendStatus','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','rows','params','keys','includeAll','find','body','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'];(function(_0x19adb0,_0x436f03){var _0x18a4b9=function(_0x2f5ab1){while(--_0x2f5ab1){_0x19adb0['push'](_0x19adb0['shift']());}};_0x18a4b9(++_0x436f03);}(_0x5cd7,0x102));var _0x75cd=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x5cd7[_0x27bd2c];return _0x3784ea;};'use strict';var emlformat=require(_0x75cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x75cd('0x1'));var jsonpatch=require(_0x75cd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75cd('0x3'));var Mustache=require(_0x75cd('0x4'));var util=require(_0x75cd('0x5'));var path=require(_0x75cd('0x6'));var sox=require(_0x75cd('0x7'));var csv=require(_0x75cd('0x8'));var ejs=require(_0x75cd('0x9'));var fs=require('fs');var fs_extra=require(_0x75cd('0xa'));var _=require(_0x75cd('0xb'));var squel=require('squel');var crypto=require(_0x75cd('0xc'));var jsforce=require(_0x75cd('0xd'));var deskjs=require(_0x75cd('0xe'));var toCsv=require(_0x75cd('0x8'));var querystring=require(_0x75cd('0xf'));var Papa=require(_0x75cd('0x10'));var Redis=require(_0x75cd('0x11'));var authService=require(_0x75cd('0x12'));var qs=require(_0x75cd('0x13'));var as=require(_0x75cd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75cd('0x15'))('api');var utils=require(_0x75cd('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x75cd('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x75cd('0x18')][_0x75cd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x12701f,_0x5f0712,_0x4b7ee0,_0x265daa){return new BPromise(function(_0x474abe,_0x3a3e79){var _0x3c40ab=_0x265daa||client;return _0x3c40ab['request'](_0x12701f,_0x4b7ee0)[_0x75cd('0x1a')](function(_0x1159b2){logger[_0x75cd('0x1b')]('Setting,\x20%s,\x20%s',_0x5f0712,_0x75cd('0x1c'));logger['debug'](_0x75cd('0x1d'),_0x5f0712,_0x75cd('0x1c'),JSON[_0x75cd('0x1e')](_0x1159b2));if(_0x1159b2[_0x75cd('0x1f')]){if(_0x1159b2[_0x75cd('0x1f')]['code']===0x1f4){logger[_0x75cd('0x1f')](_0x75cd('0x20'),_0x5f0712,_0x1159b2['error'][_0x75cd('0x21')]);return _0x3a3e79(_0x1159b2[_0x75cd('0x1f')][_0x75cd('0x21')]);}logger[_0x75cd('0x1f')](_0x75cd('0x20'),_0x5f0712,_0x1159b2[_0x75cd('0x1f')][_0x75cd('0x21')]);return _0x474abe(_0x1159b2[_0x75cd('0x1f')][_0x75cd('0x21')]);}else{logger[_0x75cd('0x1b')](_0x75cd('0x20'),_0x5f0712,_0x75cd('0x1c'));_0x474abe(_0x1159b2[_0x75cd('0x22')][_0x75cd('0x21')]);}})[_0x75cd('0x23')](function(_0x19c7cc){logger[_0x75cd('0x1f')]('Setting,\x20%s,\x20%s',_0x5f0712,_0x19c7cc);_0x3a3e79(_0x19c7cc);});});}function respondWithStatusCode(_0xd37b7b,_0x496842){_0x496842=_0x496842||0xcc;return function(_0x31f298){if(_0x31f298){return _0xd37b7b['sendStatus'](_0x496842);}return _0xd37b7b[_0x75cd('0x24')](_0x496842)['end']();};}function respondWithResult(_0x14b398,_0x12c2a1){_0x12c2a1=_0x12c2a1||0xc8;return function(_0x22935a){if(_0x22935a){return _0x14b398[_0x75cd('0x24')](_0x12c2a1)[_0x75cd('0x25')](_0x22935a);}};}function respondWithFilteredResult(_0x51a084,_0x2343aa){return function(_0x2c85df){if(_0x2c85df){var _0x37dbe7=typeof _0x2343aa[_0x75cd('0x26')]===_0x75cd('0x27')&&typeof _0x2343aa[_0x75cd('0x28')]===_0x75cd('0x27');var _0x5ab986=_0x2c85df[_0x75cd('0x29')];var _0x421b35=_0x37dbe7?0x0:_0x2343aa[_0x75cd('0x26')];var _0x5f504c=_0x37dbe7?_0x2c85df['count']:_0x2343aa[_0x75cd('0x26')]+_0x2343aa['limit'];var _0x23bc4d;if(_0x5f504c>=_0x5ab986){_0x5f504c=_0x5ab986;_0x23bc4d=0xc8;}else{_0x23bc4d=0xce;}_0x51a084[_0x75cd('0x24')](_0x23bc4d);return _0x51a084[_0x75cd('0x2a')](_0x75cd('0x2b'),_0x421b35+'-'+_0x5f504c+'/'+_0x5ab986)[_0x75cd('0x25')](_0x2c85df);}return null;};}function patchUpdates(_0x3994a0){return function(_0x5b77f5){try{jsonpatch[_0x75cd('0x2c')](_0x5b77f5,_0x3994a0,!![]);}catch(_0xd1a878){return BPromise['reject'](_0xd1a878);}return _0x5b77f5['save']();};}function saveUpdates(_0x4f64f0,_0x26d904){return function(_0x3adf7b){if(_0x3adf7b){return _0x3adf7b[_0x75cd('0x2d')](_0x4f64f0)['then'](function(_0x2d79e6){return _0x2d79e6;});}return null;};}function removeEntity(_0x12e7cb,_0x386c93){return function(_0x4666ad){if(_0x4666ad){return _0x4666ad[_0x75cd('0x2e')]()[_0x75cd('0x1a')](function(){_0x12e7cb[_0x75cd('0x24')](0xcc)[_0x75cd('0x2f')]();});}};}function handleEntityNotFound(_0x46512d,_0x1c577d){return function(_0x3d2cd5){if(!_0x3d2cd5){_0x46512d[_0x75cd('0x30')](0x194);}return _0x3d2cd5;};}function handleError(_0x306ccd,_0x5e50f8){_0x5e50f8=_0x5e50f8||0x1f4;return function(_0x47431a){logger[_0x75cd('0x1f')](_0x47431a[_0x75cd('0x31')]);if(_0x47431a['name']){delete _0x47431a[_0x75cd('0x32')];}_0x306ccd[_0x75cd('0x24')](_0x5e50f8)['send'](_0x47431a);};}exports['index']=function(_0x13a800,_0x3b1516){var _0x54ae51={},_0x460506={},_0x3f6489={'count':0x0,'rows':[]};var _0x5cecb9=_[_0x75cd('0x33')](db[_0x75cd('0x34')][_0x75cd('0x35')],function(_0x2da639){return{'name':_0x2da639[_0x75cd('0x36')],'type':_0x2da639[_0x75cd('0x37')][_0x75cd('0x38')]};});_0x460506[_0x75cd('0x39')]=_[_0x75cd('0x33')](_0x5cecb9,'name');_0x460506['query']=_['keys'](_0x13a800[_0x75cd('0x3a')]);_0x460506[_0x75cd('0x3b')]=_[_0x75cd('0x3c')](_0x460506[_0x75cd('0x39')],_0x460506[_0x75cd('0x3a')]);_0x54ae51[_0x75cd('0x3d')]=_[_0x75cd('0x3c')](_0x460506[_0x75cd('0x39')],qs['fields'](_0x13a800[_0x75cd('0x3a')][_0x75cd('0x3e')]));_0x54ae51[_0x75cd('0x3d')]=_0x54ae51[_0x75cd('0x3d')][_0x75cd('0x3f')]?_0x54ae51[_0x75cd('0x3d')]:_0x460506[_0x75cd('0x39')];if(!_0x13a800[_0x75cd('0x3a')]['hasOwnProperty'](_0x75cd('0x40'))){_0x54ae51[_0x75cd('0x28')]=qs[_0x75cd('0x28')](_0x13a800['query'][_0x75cd('0x28')]);_0x54ae51[_0x75cd('0x26')]=qs[_0x75cd('0x26')](_0x13a800[_0x75cd('0x3a')]['offset']);}_0x54ae51['order']=qs[_0x75cd('0x41')](_0x13a800[_0x75cd('0x3a')][_0x75cd('0x41')]);_0x54ae51['where']=qs[_0x75cd('0x3b')](_[_0x75cd('0x42')](_0x13a800['query'],_0x460506[_0x75cd('0x3b')]),_0x5cecb9);if(_0x13a800[_0x75cd('0x3a')][_0x75cd('0x43')]){_0x54ae51[_0x75cd('0x44')]=_[_0x75cd('0x45')](_0x54ae51[_0x75cd('0x44')],{'$or':_[_0x75cd('0x33')](_0x5cecb9,function(_0x21e144){if(_0x21e144[_0x75cd('0x37')]!==_0x75cd('0x46')){var _0x443c92={};_0x443c92[_0x21e144[_0x75cd('0x32')]]={'$like':'%'+_0x13a800[_0x75cd('0x3a')]['filter']+'%'};return _0x443c92;}})});}_0x54ae51=_[_0x75cd('0x45')]({},_0x54ae51,_0x13a800[_0x75cd('0x47')]);var _0x4ee504={'where':_0x54ae51['where']};return db[_0x75cd('0x34')][_0x75cd('0x29')](_0x4ee504)['then'](function(_0x39364d){_0x3f6489['count']=_0x39364d;if(_0x13a800[_0x75cd('0x3a')]['includeAll']){_0x54ae51['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x54ae51);})[_0x75cd('0x1a')](function(_0x3996e4){_0x3f6489[_0x75cd('0x48')]=_0x3996e4;return _0x3f6489;})[_0x75cd('0x1a')](respondWithFilteredResult(_0x3b1516,_0x54ae51))[_0x75cd('0x23')](handleError(_0x3b1516,null));};exports['show']=function(_0x1e96c5,_0x48e2e6){var _0x2dc65f={'raw':![],'where':{'id':_0x1e96c5[_0x75cd('0x49')]['id']}},_0x415769={};_0x415769[_0x75cd('0x39')]=_[_0x75cd('0x4a')](db[_0x75cd('0x34')][_0x75cd('0x35')]);_0x415769['query']=_[_0x75cd('0x4a')](_0x1e96c5[_0x75cd('0x3a')]);_0x415769[_0x75cd('0x3b')]=_['intersection'](_0x415769[_0x75cd('0x39')],_0x415769[_0x75cd('0x3a')]);_0x2dc65f[_0x75cd('0x3d')]=_[_0x75cd('0x3c')](_0x415769[_0x75cd('0x39')],qs[_0x75cd('0x3e')](_0x1e96c5[_0x75cd('0x3a')][_0x75cd('0x3e')]));_0x2dc65f[_0x75cd('0x3d')]=_0x2dc65f[_0x75cd('0x3d')][_0x75cd('0x3f')]?_0x2dc65f[_0x75cd('0x3d')]:_0x415769[_0x75cd('0x39')];if(_0x1e96c5[_0x75cd('0x3a')][_0x75cd('0x4b')]){_0x2dc65f['include']=[{'all':!![]}];}_0x2dc65f=_[_0x75cd('0x45')]({},_0x2dc65f,_0x1e96c5[_0x75cd('0x47')]);return db[_0x75cd('0x34')][_0x75cd('0x4c')](_0x2dc65f)['then'](handleEntityNotFound(_0x48e2e6,null))['then'](respondWithResult(_0x48e2e6,null))[_0x75cd('0x23')](handleError(_0x48e2e6,null));};exports['update']=function(_0x251dbc,_0x27af77){if(_0x251dbc[_0x75cd('0x4d')]['id']){delete _0x251dbc['body']['id'];}return db[_0x75cd('0x34')][_0x75cd('0x4c')]({'where':{'id':_0x251dbc[_0x75cd('0x49')]['id']}})[_0x75cd('0x1a')](handleEntityNotFound(_0x27af77,null))[_0x75cd('0x1a')](saveUpdates(_0x251dbc[_0x75cd('0x4d')],null))['then'](respondWithResult(_0x27af77,null))[_0x75cd('0x23')](handleError(_0x27af77,null));};exports['addLogo']=function(_0x41c56f,_0x58634f,_0x5ec770){if(_0x41c56f[_0x75cd('0x4e')]&&_0x41c56f[_0x75cd('0x4e')][_0x75cd('0x4f')]){_0x41c56f[_0x75cd('0x4d')][_0x75cd('0x50')]=_0x41c56f['file'][_0x75cd('0x4f')];}return db[_0x75cd('0x34')][_0x75cd('0x4c')]({'where':{'id':_0x41c56f[_0x75cd('0x49')]['id']}})[_0x75cd('0x1a')](handleEntityNotFound(_0x58634f,null))['then'](saveUpdates(_0x41c56f[_0x75cd('0x4d')],null))[_0x75cd('0x1a')](respondWithResult(_0x58634f,null))['catch'](handleError(_0x58634f,null));};exports[_0x75cd('0x51')]=function(_0x1a5225,_0x564745,_0x31488f){if(_0x1a5225['file']&&_0x1a5225['file']['filename']){_0x1a5225[_0x75cd('0x4d')][_0x75cd('0x52')]=_0x1a5225[_0x75cd('0x4e')][_0x75cd('0x4f')];}return db['Setting'][_0x75cd('0x4c')]({'where':{'id':_0x1a5225[_0x75cd('0x49')]['id']}})[_0x75cd('0x1a')](handleEntityNotFound(_0x564745,null))[_0x75cd('0x1a')](saveUpdates(_0x1a5225[_0x75cd('0x4d')],null))[_0x75cd('0x1a')](respondWithResult(_0x564745,null))['catch'](handleError(_0x564745,null));};var utilLicense=require(_0x75cd('0x53'));exports[_0x75cd('0x54')]=function(_0x41cbd5,_0x2a86fc,_0x498471){var _0x3a45cb=_0x75cd('0x55');var _0x5b1ec9={'custom':![]};return utilLicense[_0x75cd('0x56')]()['then'](function(_0x4146d9){if(_0x4146d9){_0x5b1ec9=_0x4146d9;}return db['Setting'][_0x75cd('0x4c')]({'where':{'id':_0x41cbd5['params']['id']},'attributes':['logo',_0x75cd('0x52'),_0x75cd('0x57'),_0x75cd('0x58'),_0x75cd('0x59'),_0x75cd('0x5a'),_0x75cd('0x5b'),_0x75cd('0x5c')],'raw':!![]});})[_0x75cd('0x1a')](handleEntityNotFound(_0x2a86fc,null))[_0x75cd('0x1a')](function(_0x4770d4){if(_0x4770d4){var _0x554c17=_0x4770d4['logo']&&fs[_0x75cd('0x5d')](path[_0x75cd('0x5e')](config[_0x75cd('0x5f')],_0x3a45cb,_[_0x75cd('0x60')](_0x4770d4[_0x75cd('0x50')])))?path[_0x75cd('0x5e')](config['root'],_0x3a45cb,_['toLower'](_0x4770d4[_0x75cd('0x50')])):path[_0x75cd('0x5e')](config['root'],_0x3a45cb,_[_0x75cd('0x60')](_0x75cd('0x61')));var _0x549324=_0x75cd('0x62')+_[_0x75cd('0x63')](_0x75cd('0x50'));if(_0x4770d4[_0x549324]||!_0x5b1ec9[_0x75cd('0x64')]){_0x554c17=path[_0x75cd('0x5e')](config[_0x75cd('0x5f')],_0x3a45cb,_[_0x75cd('0x60')](_0x75cd('0x61')));}if(!fs[_0x75cd('0x5d')](_0x554c17)){throw new db[(_0x75cd('0x65'))][(_0x75cd('0x66'))](_[_0x75cd('0x63')]('logo')+'\x20not\x20found');}return _0x2a86fc['download'](_0x554c17);}})[_0x75cd('0x23')](handleError(_0x2a86fc,null));};var utilLicense=require(_0x75cd('0x53'));exports[_0x75cd('0x67')]=function(_0x3f04ba,_0x2b4652,_0x728853){var _0x474981=_0x75cd('0x55');var _0x1340b5={'custom':![]};return utilLicense[_0x75cd('0x56')]()[_0x75cd('0x1a')](function(_0x514a34){if(_0x514a34){_0x1340b5=_0x514a34;}return db[_0x75cd('0x34')][_0x75cd('0x4c')]({'where':{'id':_0x3f04ba[_0x75cd('0x49')]['id']},'attributes':['logo',_0x75cd('0x52'),_0x75cd('0x57'),'favicon',_0x75cd('0x59'),'defaultLoginLogo','defaultPreferred',_0x75cd('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x2b4652,null))['then'](function(_0x1223bf){if(_0x1223bf){var _0x2c2d53=_0x1223bf[_0x75cd('0x52')]&&fs[_0x75cd('0x5d')](path['join'](config[_0x75cd('0x5f')],_0x474981,_[_0x75cd('0x60')](_0x1223bf[_0x75cd('0x52')])))?path['join'](config[_0x75cd('0x5f')],_0x474981,_[_0x75cd('0x60')](_0x1223bf[_0x75cd('0x52')])):path[_0x75cd('0x5e')](config['root'],_0x474981,_['toLower'](_0x75cd('0x68')));var _0xd8971c=_0x75cd('0x62')+_[_0x75cd('0x63')](_0x75cd('0x52'));if(_0x1223bf[_0xd8971c]||!_0x1340b5[_0x75cd('0x64')]){_0x2c2d53=path[_0x75cd('0x5e')](config[_0x75cd('0x5f')],_0x474981,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x75cd('0x5d')](_0x2c2d53)){throw new db[(_0x75cd('0x65'))][(_0x75cd('0x66'))](_['upperFirst']('loginLogo')+_0x75cd('0x69'));}return _0x2b4652[_0x75cd('0x6a')](_0x2c2d53);}})['catch'](handleError(_0x2b4652,null));};exports['gdpr']=function(_0x43382c,_0x176dbe){return db[_0x75cd('0x34')]['find']({'where':{'id':_0x43382c[_0x75cd('0x49')]['id']},'attributes':[_0x75cd('0x6b')]})[_0x75cd('0x1a')](respondWithResult(_0x176dbe,null))[_0x75cd('0x23')](handleError(_0x176dbe,null));};exports[_0x75cd('0x6c')]=function(_0x45be06,_0x31137f,_0x210e65){if(_0x45be06['file']&&_0x45be06[_0x75cd('0x4e')][_0x75cd('0x4f')]){_0x45be06[_0x75cd('0x4d')][_0x75cd('0x57')]=_0x45be06[_0x75cd('0x4e')][_0x75cd('0x4f')];}return db['Setting'][_0x75cd('0x4c')]({'where':{'id':_0x45be06[_0x75cd('0x49')]['id']}})['then'](handleEntityNotFound(_0x31137f,null))['then'](saveUpdates(_0x45be06[_0x75cd('0x4d')],null))[_0x75cd('0x1a')](respondWithResult(_0x31137f,null))['catch'](handleError(_0x31137f,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x34b8a0,_0x5631bd,_0x34a1e6){var _0x4e2af1='server/files/images/logos';var _0xd1280e={'custom':![]};return utilLicense[_0x75cd('0x56')]()[_0x75cd('0x1a')](function(_0xf18bf8){if(_0xf18bf8){_0xd1280e=_0xf18bf8;}return db[_0x75cd('0x34')][_0x75cd('0x4c')]({'where':{'id':_0x34b8a0['params']['id']},'attributes':['logo',_0x75cd('0x52'),_0x75cd('0x57'),_0x75cd('0x58'),_0x75cd('0x59'),_0x75cd('0x5a'),_0x75cd('0x5b'),_0x75cd('0x5c')],'raw':!![]});})[_0x75cd('0x1a')](handleEntityNotFound(_0x5631bd,null))[_0x75cd('0x1a')](function(_0x2b0e91){if(_0x2b0e91){var _0x249b60=_0x2b0e91[_0x75cd('0x57')]&&fs['existsSync'](path[_0x75cd('0x5e')](config['root'],_0x4e2af1,_['toLower'](_0x2b0e91[_0x75cd('0x57')])))?path['join'](config[_0x75cd('0x5f')],_0x4e2af1,_[_0x75cd('0x60')](_0x2b0e91['preferred'])):path[_0x75cd('0x5e')](config[_0x75cd('0x5f')],_0x4e2af1,_[_0x75cd('0x60')]('default_preferred.png'));var _0x3bce2e=_0x75cd('0x62')+_[_0x75cd('0x63')](_0x75cd('0x57'));if(_0x2b0e91[_0x3bce2e]||!_0xd1280e[_0x75cd('0x64')]||!_0xd1280e[_0x75cd('0x57')]){_0x249b60=path['join'](config[_0x75cd('0x5f')],_0x4e2af1,_[_0x75cd('0x60')](_0x75cd('0x6d')));}if(!fs[_0x75cd('0x5d')](_0x249b60)){throw new db[(_0x75cd('0x65'))][(_0x75cd('0x66'))](_['upperFirst'](_0x75cd('0x57'))+_0x75cd('0x69'));}return _0x5631bd[_0x75cd('0x6a')](_0x249b60);}})[_0x75cd('0x23')](handleError(_0x5631bd,null));};exports[_0x75cd('0x6e')]=function(_0x27fde4,_0x287108,_0x29366d){if(_0x27fde4[_0x75cd('0x4e')]&&_0x27fde4[_0x75cd('0x4e')][_0x75cd('0x4f')]){_0x27fde4[_0x75cd('0x4d')][_0x75cd('0x58')]=_0x27fde4[_0x75cd('0x4e')][_0x75cd('0x4f')];}return db[_0x75cd('0x34')][_0x75cd('0x4c')]({'where':{'id':_0x27fde4[_0x75cd('0x49')]['id']}})[_0x75cd('0x1a')](handleEntityNotFound(_0x287108,null))[_0x75cd('0x1a')](saveUpdates(_0x27fde4['body'],null))[_0x75cd('0x1a')](respondWithResult(_0x287108,null))['catch'](handleError(_0x287108,null));};var utilLicense=require(_0x75cd('0x53'));exports[_0x75cd('0x6f')]=function(_0x30eb41,_0x641d2,_0x11961e){var _0x156729=_0x75cd('0x55');var _0x4c9044={'custom':![]};return utilLicense['getLicense']()[_0x75cd('0x1a')](function(_0x121bf9){if(_0x121bf9){_0x4c9044=_0x121bf9;}return db[_0x75cd('0x34')][_0x75cd('0x4c')]({'where':{'id':_0x30eb41[_0x75cd('0x49')]['id']},'attributes':['logo',_0x75cd('0x52'),'preferred',_0x75cd('0x58'),_0x75cd('0x59'),_0x75cd('0x5a'),_0x75cd('0x5b'),_0x75cd('0x5c')],'raw':!![]});})[_0x75cd('0x1a')](handleEntityNotFound(_0x641d2,null))[_0x75cd('0x1a')](function(_0x4ecf4b){if(_0x4ecf4b){var _0x2e3869=_0x4ecf4b[_0x75cd('0x58')]&&fs[_0x75cd('0x5d')](path[_0x75cd('0x5e')](config['root'],_0x156729,_['toLower'](_0x4ecf4b[_0x75cd('0x58')])))?path[_0x75cd('0x5e')](config[_0x75cd('0x5f')],_0x156729,_[_0x75cd('0x60')](_0x4ecf4b[_0x75cd('0x58')])):path['join'](config[_0x75cd('0x5f')],_0x156729,_['toLower'](_0x75cd('0x70')));var _0x3e5446=_0x75cd('0x62')+_['upperFirst'](_0x75cd('0x58'));if(_0x4ecf4b[_0x3e5446]||!_0x4c9044[_0x75cd('0x64')]){_0x2e3869=path['join'](config['root'],_0x156729,_['toLower']('default_favicon.ico'));}if(!fs[_0x75cd('0x5d')](_0x2e3869)){throw new db['Sequelize'][(_0x75cd('0x66'))](_[_0x75cd('0x63')](_0x75cd('0x58'))+_0x75cd('0x69'));}return _0x641d2['download'](_0x2e3869);}})[_0x75cd('0x23')](handleError(_0x641d2,null));};exports[_0x75cd('0x71')]=function(_0x513340,_0x142465){var _0x25077d={'offset':moment()[_0x75cd('0x72')]()};_0x25077d[_0x75cd('0x73')]=moment()[_0x75cd('0x72')](_0x25077d[_0x75cd('0x26')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x142465[_0x75cd('0x24')](0xc8)[_0x75cd('0x74')](_0x25077d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 4077358..97bc037 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x7217,0x19e));var _0x7721=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x7217[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x4575e5,_0x95f8a4){var _0x55d543=function(_0x314196){while(--_0x314196){_0x4575e5['push'](_0x4575e5['shift']());}};_0x55d543(++_0x95f8a4);}(_0xedd9,0xfc));var _0x9edd=function(_0x4bd11d,_0xee69b8){_0x4bd11d=_0x4bd11d-0x0;var _0x328238=_0xedd9[_0x4bd11d];return _0x328238;};'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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 8ffc119..c33b702 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 _0x7ad1=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7ad1,0xf6));var _0x17ad=function(_0x1d4beb,_0x4de883){_0x1d4beb=_0x1d4beb-0x0;var _0x29474c=_0x7ad1[_0x1d4beb];return _0x29474c;};'use strict';var _=require(_0x17ad('0x0'));var util=require('util');var moment=require(_0x17ad('0x1'));var BPromise=require(_0x17ad('0x2'));var rs=require(_0x17ad('0x3'));var fs=require('fs');var Redis=require(_0x17ad('0x4'));var db=require(_0x17ad('0x5'))['db'];var utils=require(_0x17ad('0x6'));var logger=require(_0x17ad('0x7'))(_0x17ad('0x8'));var config=require(_0x17ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x17ad('0xa')][_0x17ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x596a9e,_0x3f1594,_0x5d2186){return new BPromise(function(_0xaae150,_0x3461df){return client[_0x17ad('0xc')](_0x596a9e,_0x5d2186)[_0x17ad('0xd')](function(_0x1550f9){logger[_0x17ad('0xe')](_0x17ad('0xf'),_0x3f1594,_0x17ad('0x10'));logger[_0x17ad('0x11')](_0x17ad('0x12'),_0x3f1594,_0x17ad('0x10'),JSON[_0x17ad('0x13')](_0x1550f9));if(_0x1550f9['error']){if(_0x1550f9[_0x17ad('0x14')][_0x17ad('0x15')]===0x1f4){logger[_0x17ad('0x14')](_0x17ad('0xf'),_0x3f1594,_0x1550f9['error'][_0x17ad('0x16')]);return _0x3461df(_0x1550f9['error'][_0x17ad('0x16')]);}logger[_0x17ad('0x14')](_0x17ad('0xf'),_0x3f1594,_0x1550f9['error'][_0x17ad('0x16')]);return _0xaae150(_0x1550f9[_0x17ad('0x14')][_0x17ad('0x16')]);}else{logger[_0x17ad('0xe')](_0x17ad('0xf'),_0x3f1594,_0x17ad('0x10'));_0xaae150(_0x1550f9['result'][_0x17ad('0x16')]);}})[_0x17ad('0x17')](function(_0x1a3d30){logger[_0x17ad('0x14')](_0x17ad('0xf'),_0x3f1594,_0x1a3d30);_0x3461df(_0x1a3d30);});});}exports[_0x17ad('0x18')]=function(_0x2618c3){var _0x3f4142=this;return new Promise(function(_0xd14ed5,_0x35d8eb){return db['Setting'][_0x17ad('0x19')]({'raw':_0x2618c3[_0x17ad('0x1a')]?_0x2618c3[_0x17ad('0x1a')][_0x17ad('0x1b')]===undefined?!![]:![]:!![],'where':_0x2618c3[_0x17ad('0x1a')]?_0x2618c3['options'][_0x17ad('0x1c')]||null:null,'attributes':_0x2618c3[_0x17ad('0x1a')]?_0x2618c3[_0x17ad('0x1a')][_0x17ad('0x1d')]||null:null,'include':_0x2618c3['options']?_0x2618c3[_0x17ad('0x1a')][_0x17ad('0x1e')]?_[_0x17ad('0x1f')](_0x2618c3['options'][_0x17ad('0x1e')],function(_0x4aa1de){return{'model':db[_0x4aa1de['model']],'as':_0x4aa1de['as'],'attributes':_0x4aa1de[_0x17ad('0x1d')],'include':_0x4aa1de[_0x17ad('0x1e')]?_['map'](_0x4aa1de['include'],function(_0x4e1ed8){return{'model':db[_0x4e1ed8['model']],'as':_0x4e1ed8['as'],'attributes':_0x4e1ed8['attributes'],'include':_0x4e1ed8[_0x17ad('0x1e')]?_[_0x17ad('0x1f')](_0x4e1ed8[_0x17ad('0x1e')],function(_0x43da25){return{'model':db[_0x43da25[_0x17ad('0x20')]],'as':_0x43da25['as'],'attributes':_0x43da25['attributes']};}):[]};}):[]};}):[]:[]})[_0x17ad('0xd')](function(_0x191a4d){logger['info']('ShowSetting',_0x2618c3);logger[_0x17ad('0x11')](_0x17ad('0x18'),_0x2618c3,JSON[_0x17ad('0x13')](_0x191a4d));_0xd14ed5(_0x191a4d);})[_0x17ad('0x17')](function(_0x2d4c0e){logger['error'](_0x17ad('0x18'),_0x2d4c0e[_0x17ad('0x16')],_0x2618c3);_0x35d8eb(_0x3f4142['error'](0x1f4,_0x2d4c0e[_0x17ad('0x16')]));});});}; \ No newline at end of file +var _0xbb11=['ShowSetting','find','options','raw','where','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','catch'];(function(_0x989e19,_0x41f0dc){var _0x14e47b=function(_0x20f7ad){while(--_0x20f7ad){_0x989e19['push'](_0x989e19['shift']());}};_0x14e47b(++_0x41f0dc);}(_0xbb11,0xa9));var _0x1bb1=function(_0x3d7d2e,_0x39ce8c){_0x3d7d2e=_0x3d7d2e-0x0;var _0x384d4c=_0xbb11[_0x3d7d2e];return _0x384d4c;};'use strict';var _=require(_0x1bb1('0x0'));var util=require('util');var moment=require(_0x1bb1('0x1'));var BPromise=require(_0x1bb1('0x2'));var rs=require(_0x1bb1('0x3'));var fs=require('fs');var Redis=require(_0x1bb1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bb1('0x5'));var logger=require(_0x1bb1('0x6'))(_0x1bb1('0x7'));var config=require(_0x1bb1('0x8'));var jayson=require(_0x1bb1('0x9'));var client=jayson['client'][_0x1bb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3be152,_0x49ca71,_0x2bebaf){return new BPromise(function(_0x3c6f70,_0x49038c){return client[_0x1bb1('0xb')](_0x3be152,_0x2bebaf)[_0x1bb1('0xc')](function(_0x38802e){logger[_0x1bb1('0xd')]('Setting,\x20%s,\x20%s',_0x49ca71,_0x1bb1('0xe'));logger[_0x1bb1('0xf')](_0x1bb1('0x10'),_0x49ca71,_0x1bb1('0xe'),JSON[_0x1bb1('0x11')](_0x38802e));if(_0x38802e['error']){if(_0x38802e[_0x1bb1('0x12')][_0x1bb1('0x13')]===0x1f4){logger[_0x1bb1('0x12')](_0x1bb1('0x14'),_0x49ca71,_0x38802e[_0x1bb1('0x12')][_0x1bb1('0x15')]);return _0x49038c(_0x38802e[_0x1bb1('0x12')]['message']);}logger['error'](_0x1bb1('0x14'),_0x49ca71,_0x38802e['error'][_0x1bb1('0x15')]);return _0x3c6f70(_0x38802e['error'][_0x1bb1('0x15')]);}else{logger[_0x1bb1('0xd')](_0x1bb1('0x14'),_0x49ca71,_0x1bb1('0xe'));_0x3c6f70(_0x38802e['result'][_0x1bb1('0x15')]);}})[_0x1bb1('0x16')](function(_0x2f1bc7){logger[_0x1bb1('0x12')](_0x1bb1('0x14'),_0x49ca71,_0x2f1bc7);_0x49038c(_0x2f1bc7);});});}exports[_0x1bb1('0x17')]=function(_0x5296d8){var _0x28e85c=this;return new Promise(function(_0x41751e,_0x28d9c8){return db['Setting'][_0x1bb1('0x18')]({'raw':_0x5296d8[_0x1bb1('0x19')]?_0x5296d8['options'][_0x1bb1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5296d8[_0x1bb1('0x19')]?_0x5296d8['options'][_0x1bb1('0x1b')]||null:null,'attributes':_0x5296d8['options']?_0x5296d8['options']['attributes']||null:null,'include':_0x5296d8[_0x1bb1('0x19')]?_0x5296d8[_0x1bb1('0x19')][_0x1bb1('0x1c')]?_[_0x1bb1('0x1d')](_0x5296d8[_0x1bb1('0x19')][_0x1bb1('0x1c')],function(_0x1c43f5){return{'model':db[_0x1c43f5[_0x1bb1('0x1e')]],'as':_0x1c43f5['as'],'attributes':_0x1c43f5['attributes'],'include':_0x1c43f5[_0x1bb1('0x1c')]?_[_0x1bb1('0x1d')](_0x1c43f5[_0x1bb1('0x1c')],function(_0x1c6bb1){return{'model':db[_0x1c6bb1[_0x1bb1('0x1e')]],'as':_0x1c6bb1['as'],'attributes':_0x1c6bb1['attributes'],'include':_0x1c6bb1['include']?_[_0x1bb1('0x1d')](_0x1c6bb1['include'],function(_0x4769e3){return{'model':db[_0x4769e3[_0x1bb1('0x1e')]],'as':_0x4769e3['as'],'attributes':_0x4769e3[_0x1bb1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1bb1('0xc')](function(_0x5328c1){logger[_0x1bb1('0xd')]('ShowSetting',_0x5296d8);logger['debug'](_0x1bb1('0x17'),_0x5296d8,JSON[_0x1bb1('0x11')](_0x5328c1));_0x41751e(_0x5328c1);})['catch'](function(_0x4755a7){logger[_0x1bb1('0x12')]('ShowSetting',_0x4755a7['message'],_0x5296d8);_0x28d9c8(_0x28e85c[_0x1bb1('0x12')](0x1f4,_0x4755a7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4ddd4d3..44a9c88 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 _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x2bc7bc,_0x827ea){var _0xbae862=function(_0xdde795){while(--_0xdde795){_0x2bc7bc['push'](_0x2bc7bc['shift']());}};_0xbae862(++_0x827ea);}(_0xe14b,0x93));var _0xbe14=function(_0x18c19f,_0x43a990){_0x18c19f=_0x18c19f-0x0;var _0x37acce=_0xe14b[_0x18c19f];return _0x37acce;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=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(_0x3208d3,_0x3b31bb){var _0x5adbd3=function(_0xf4f7da){while(--_0xf4f7da){_0x3208d3['push'](_0x3208d3['shift']());}};_0x5adbd3(++_0x3b31bb);}(_0x53ec,0x192));var _0xc53e=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0x53ec[_0x25acfe];return _0x547928;};'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 54a3784..68e25e4 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 _0x71e6=['csc','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','clickatell','bandwidth'];(function(_0xc2594c,_0x51bda8){var _0x10a3d1=function(_0x491263){while(--_0x491263){_0xc2594c['push'](_0xc2594c['shift']());}};_0x10a3d1(++_0x51bda8);}(_0x71e6,0x135));var _0x671e=function(_0xf200b2,_0x59538b){_0xf200b2=_0xf200b2-0x0;var _0x34f028=_0x71e6[_0xf200b2];return _0x34f028;};'use strict';var Sequelize=require(_0x671e('0x0'));var rs=require('randomstring');module[_0x671e('0x1')]={'name':{'type':Sequelize[_0x671e('0x2')],'unique':_0x671e('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x671e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x671e('0x2')],'defaultValue':function(){return rs[_0x671e('0x4')]();}},'phone':{'type':Sequelize[_0x671e('0x2')]},'type':{'type':Sequelize[_0x671e('0x5')](_0x671e('0x6'),'skebby',_0x671e('0x7'),_0x671e('0x8'),'plivo',_0x671e('0x9'),_0x671e('0xa'),_0x671e('0xb'),'infobip',_0x671e('0xc'))},'accountSid':{'type':Sequelize[_0x671e('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x671e('0x2')]},'smsMethod':{'type':Sequelize[_0x671e('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x671e('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x671e('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x671e('0x2')]},'senderString':{'type':Sequelize[_0x671e('0x2')]},'deliveryReport':{'type':Sequelize[_0x671e('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x671e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x671e('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x671e('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x671e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x671e('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x671e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x671e('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x671e('0xf')],'comment':_0x671e('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x671e('0xd')],'defaultValue':![],'comment':_0x671e('0x11'),'set':function(_0x70ff4b){if(!_0x70ff4b)this[_0x671e('0x12')]('mandatoryDispositionPauseId',null);this[_0x671e('0x12')](_0x671e('0x13'),_0x70ff4b);}}}; \ No newline at end of file +var _0x45ce=['generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x45ce,0x133));var _0xe45c=function(_0x47f3f9,_0x1c347a){_0x47f3f9=_0x47f3f9-0x0;var _0x2f9922=_0x45ce[_0x47f3f9];return _0x2f9922;};'use strict';var Sequelize=require(_0xe45c('0x0'));var rs=require(_0xe45c('0x1'));module[_0xe45c('0x2')]={'name':{'type':Sequelize[_0xe45c('0x3')],'unique':_0xe45c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe45c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe45c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe45c('0x3')],'defaultValue':function(){return rs[_0xe45c('0x5')]();}},'phone':{'type':Sequelize[_0xe45c('0x3')]},'type':{'type':Sequelize[_0xe45c('0x6')](_0xe45c('0x7'),_0xe45c('0x8'),'connectel',_0xe45c('0x9'),_0xe45c('0xa'),_0xe45c('0xb'),_0xe45c('0xc'),_0xe45c('0xd'),_0xe45c('0xe'),_0xe45c('0xf'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xe45c('0x3')]},'authToken':{'type':Sequelize[_0xe45c('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xe45c('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xe45c('0x3')]},'applicationId':{'type':Sequelize[_0xe45c('0x3')]},'accountId':{'type':Sequelize[_0xe45c('0x3')]},'senderString':{'type':Sequelize[_0xe45c('0x3')]},'deliveryReport':{'type':Sequelize[_0xe45c('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe45c('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe45c('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe45c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe45c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe45c('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe45c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe45c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe45c('0x12')],'comment':_0xe45c('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xe45c('0x10')],'defaultValue':![],'comment':_0xe45c('0x14'),'set':function(_0x522887){if(!_0x522887)this[_0xe45c('0x15')](_0xe45c('0x16'),null);this['setDataValue'](_0xe45c('0x17'),_0x522887);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index fbe1159..cbc4e50 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 _0x5a6b=['options','SmsAccount','includeAll','include','findAll','rows','show','params','length','find','create','user','role','SmsAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','account','Applications','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','MessageSid','sender','text','connectel','messageId','message_id','Text','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','applications','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','sequelize','transaction','findAndCountAll','getApplications','order','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','SmsMessage','dataValues','Messages','push','debug','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','inspect','infobip','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','get','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','nolimit','sort','where','filters','pick','merge','filter'];(function(_0x202494,_0x530f8c){var _0x5ae4d9=function(_0x5d3194){while(--_0x5d3194){_0x202494['push'](_0x202494['shift']());}};_0x5ae4d9(++_0x530f8c);}(_0x5a6b,0x8d));var _0xb5a6=function(_0x517f80,_0x22d74c){_0x517f80=_0x517f80-0x0;var _0x133d17=_0x5a6b[_0x517f80];return _0x133d17;};'use strict';var emlformat=require(_0xb5a6('0x0'));var rimraf=require(_0xb5a6('0x1'));var zipdir=require(_0xb5a6('0x2'));var jsonpatch=require(_0xb5a6('0x3'));var rp=require(_0xb5a6('0x4'));var moment=require('moment');var BPromise=require(_0xb5a6('0x5'));var Mustache=require(_0xb5a6('0x6'));var util=require(_0xb5a6('0x7'));var path=require(_0xb5a6('0x8'));var sox=require(_0xb5a6('0x9'));var csv=require(_0xb5a6('0xa'));var ejs=require(_0xb5a6('0xb'));var fs=require('fs');var fs_extra=require(_0xb5a6('0xc'));var _=require(_0xb5a6('0xd'));var squel=require('squel');var crypto=require(_0xb5a6('0xe'));var jsforce=require(_0xb5a6('0xf'));var deskjs=require(_0xb5a6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb5a6('0x11'));var Papa=require(_0xb5a6('0x12'));var Redis=require(_0xb5a6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb5a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5a6('0x15'));var logger=require(_0xb5a6('0x16'))(_0xb5a6('0x17'));var utils=require(_0xb5a6('0x18'));var config=require(_0xb5a6('0x19'));var licenseUtil=require(_0xb5a6('0x1a'));var db=require(_0xb5a6('0x1b'))['db'];config[_0xb5a6('0x1c')]=_[_0xb5a6('0x1d')](config['redis'],{'host':_0xb5a6('0x1e'),'port':0x18eb});var socket=require(_0xb5a6('0x1f'))(new Redis(config['redis']));require(_0xb5a6('0x20'))[_0xb5a6('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x4c5bde,_0x220796,_0x39060f,_0x4ae509){return new BPromise(function(_0x4c7fc3,_0x2c2add){var _0x3d9e43=_0x4ae509||client;return _0x3d9e43[_0xb5a6('0x22')](_0x4c5bde,_0x39060f)[_0xb5a6('0x23')](function(_0x56b647){logger['info'](_0xb5a6('0x24'),_0x220796,_0xb5a6('0x25'));logger['debug'](_0xb5a6('0x26'),_0x220796,_0xb5a6('0x25'),JSON[_0xb5a6('0x27')](_0x56b647));if(_0x56b647['error']){if(_0x56b647[_0xb5a6('0x28')]['code']===0x1f4){logger[_0xb5a6('0x28')](_0xb5a6('0x24'),_0x220796,_0x56b647[_0xb5a6('0x28')][_0xb5a6('0x29')]);return _0x2c2add(_0x56b647['error'][_0xb5a6('0x29')]);}logger['error'](_0xb5a6('0x24'),_0x220796,_0x56b647['error']['message']);return _0x4c7fc3(_0x56b647[_0xb5a6('0x28')][_0xb5a6('0x29')]);}else{logger['info'](_0xb5a6('0x24'),_0x220796,_0xb5a6('0x25'));_0x4c7fc3(_0x56b647['result'][_0xb5a6('0x29')]);}})[_0xb5a6('0x2a')](function(_0x272842){logger[_0xb5a6('0x28')](_0xb5a6('0x24'),_0x220796,_0x272842);_0x2c2add(_0x272842);});});}function respondWithStatusCode(_0x41c6c5,_0x4328d9){_0x4328d9=_0x4328d9||0xcc;return function(_0x1dbf7f){if(_0x1dbf7f){return _0x41c6c5[_0xb5a6('0x2b')](_0x4328d9);}return _0x41c6c5[_0xb5a6('0x2c')](_0x4328d9)[_0xb5a6('0x2d')]();};}function respondWithResult(_0x3d6583,_0x42dd33){_0x42dd33=_0x42dd33||0xc8;return function(_0x51f036){if(_0x51f036){return _0x3d6583[_0xb5a6('0x2c')](_0x42dd33)[_0xb5a6('0x2e')](_0x51f036);}};}function respondWithFilteredResult(_0x58d1bb,_0x3ac882){return function(_0x3922e2){if(_0x3922e2){var _0x305740=typeof _0x3ac882['offset']===_0xb5a6('0x2f')&&typeof _0x3ac882[_0xb5a6('0x30')]===_0xb5a6('0x2f');var _0x130c0b=_0x3922e2[_0xb5a6('0x31')];var _0x4ed5f2=_0x305740?0x0:_0x3ac882[_0xb5a6('0x32')];var _0x5a6934=_0x305740?_0x3922e2[_0xb5a6('0x31')]:_0x3ac882['offset']+_0x3ac882[_0xb5a6('0x30')];var _0x97aba3;if(_0x5a6934>=_0x130c0b){_0x5a6934=_0x130c0b;_0x97aba3=0xc8;}else{_0x97aba3=0xce;}_0x58d1bb[_0xb5a6('0x2c')](_0x97aba3);return _0x58d1bb[_0xb5a6('0x33')]('Content-Range',_0x4ed5f2+'-'+_0x5a6934+'/'+_0x130c0b)[_0xb5a6('0x2e')](_0x3922e2);}return null;};}function patchUpdates(_0x44c976){return function(_0x6792fe){try{jsonpatch[_0xb5a6('0x34')](_0x6792fe,_0x44c976,!![]);}catch(_0x19ca87){return BPromise[_0xb5a6('0x35')](_0x19ca87);}return _0x6792fe[_0xb5a6('0x36')]();};}function saveUpdates(_0x323bbb,_0x3e7b43){return function(_0xd878b9){if(_0xd878b9){return _0xd878b9[_0xb5a6('0x37')](_0x323bbb)[_0xb5a6('0x23')](function(_0x3b1ab0){return _0x3b1ab0;});}return null;};}function removeEntity(_0x11994c,_0x2f58dd){return function(_0x3daab2){if(_0x3daab2){return _0x3daab2['destroy']()[_0xb5a6('0x23')](function(){var _0x208b8d=_0x3daab2[_0xb5a6('0x38')]({'plain':!![]});var _0x7e222e='SmsAccounts';return db[_0xb5a6('0x39')][_0xb5a6('0x3a')]({'where':{'type':_0x7e222e,'resourceId':_0x208b8d['id']}})[_0xb5a6('0x23')](function(){return _0x3daab2;});})['then'](function(){_0x11994c[_0xb5a6('0x2c')](0xcc)[_0xb5a6('0x2d')]();});}};}function handleEntityNotFound(_0x5807a7,_0x11d903){return function(_0x4e1510){if(!_0x4e1510){_0x5807a7[_0xb5a6('0x2b')](0x194);}return _0x4e1510;};}function handleError(_0x1fb5b8,_0x148a34){_0x148a34=_0x148a34||0x1f4;return function(_0x33559b){logger[_0xb5a6('0x28')](_0x33559b['stack']);if(_0x33559b[_0xb5a6('0x3b')]){delete _0x33559b['name'];}_0x1fb5b8[_0xb5a6('0x2c')](_0x148a34)[_0xb5a6('0x3c')](_0x33559b);};}exports['index']=function(_0x264000,_0x1cdba1){var _0x399ebd={'include':[{'model':db[_0xb5a6('0x3d')],'as':_0xb5a6('0x3e')}]},_0x3f9708={},_0x5c7546={'count':0x0,'rows':[]};var _0x13730f=_['map'](db['SmsAccount'][_0xb5a6('0x3f')],function(_0x4288fc){return{'name':_0x4288fc[_0xb5a6('0x40')],'type':_0x4288fc[_0xb5a6('0x41')][_0xb5a6('0x42')]};});_0x3f9708[_0xb5a6('0x43')]=_[_0xb5a6('0x44')](_0x13730f,_0xb5a6('0x3b'));_0x3f9708[_0xb5a6('0x45')]=_[_0xb5a6('0x46')](_0x264000[_0xb5a6('0x45')]);_0x3f9708['filters']=_[_0xb5a6('0x47')](_0x3f9708[_0xb5a6('0x43')],_0x3f9708[_0xb5a6('0x45')]);_0x399ebd['attributes']=_[_0xb5a6('0x47')](_0x3f9708[_0xb5a6('0x43')],qs[_0xb5a6('0x48')](_0x264000['query'][_0xb5a6('0x48')]));_0x399ebd[_0xb5a6('0x49')]=_0x399ebd[_0xb5a6('0x49')]['length']?_0x399ebd['attributes']:_0x3f9708[_0xb5a6('0x43')];if(!_0x264000[_0xb5a6('0x45')]['hasOwnProperty'](_0xb5a6('0x4a'))){_0x399ebd['limit']=qs['limit'](_0x264000['query'][_0xb5a6('0x30')]);_0x399ebd['offset']=qs[_0xb5a6('0x32')](_0x264000[_0xb5a6('0x45')][_0xb5a6('0x32')]);}_0x399ebd['order']=qs[_0xb5a6('0x4b')](_0x264000[_0xb5a6('0x45')][_0xb5a6('0x4b')]);_0x399ebd[_0xb5a6('0x4c')]=qs[_0xb5a6('0x4d')](_[_0xb5a6('0x4e')](_0x264000[_0xb5a6('0x45')],_0x3f9708[_0xb5a6('0x4d')]),_0x13730f);if(_0x264000['query']['filter']){_0x399ebd[_0xb5a6('0x4c')]=_[_0xb5a6('0x4f')](_0x399ebd[_0xb5a6('0x4c')],{'$or':_[_0xb5a6('0x44')](_0x13730f,function(_0x198def){if(_0x198def[_0xb5a6('0x41')]!=='VIRTUAL'){var _0x1636c0={};_0x1636c0[_0x198def[_0xb5a6('0x3b')]]={'$like':'%'+_0x264000[_0xb5a6('0x45')][_0xb5a6('0x50')]+'%'};return _0x1636c0;}})});}_0x399ebd=_['merge']({},_0x399ebd,_0x264000[_0xb5a6('0x51')]);var _0x28042a={'where':_0x399ebd[_0xb5a6('0x4c')]};return db[_0xb5a6('0x52')][_0xb5a6('0x31')](_0x28042a)[_0xb5a6('0x23')](function(_0x475b89){_0x5c7546['count']=_0x475b89;if(_0x264000['query'][_0xb5a6('0x53')]){_0x399ebd[_0xb5a6('0x54')]=[{'all':!![]}];}return db['SmsAccount'][_0xb5a6('0x55')](_0x399ebd);})['then'](function(_0x4a2865){_0x5c7546[_0xb5a6('0x56')]=_0x4a2865;return _0x5c7546;})[_0xb5a6('0x23')](respondWithFilteredResult(_0x1cdba1,_0x399ebd))[_0xb5a6('0x2a')](handleError(_0x1cdba1,null));};exports[_0xb5a6('0x57')]=function(_0x3f44b0,_0x240cad){var _0x18e8fd={'raw':![],'where':{'id':_0x3f44b0[_0xb5a6('0x58')]['id']},'include':[{'model':db[_0xb5a6('0x3d')],'as':_0xb5a6('0x3e')}]},_0xfabcae={};_0xfabcae[_0xb5a6('0x43')]=_[_0xb5a6('0x46')](db[_0xb5a6('0x52')][_0xb5a6('0x3f')]);_0xfabcae['query']=_[_0xb5a6('0x46')](_0x3f44b0[_0xb5a6('0x45')]);_0xfabcae[_0xb5a6('0x4d')]=_[_0xb5a6('0x47')](_0xfabcae[_0xb5a6('0x43')],_0xfabcae[_0xb5a6('0x45')]);_0x18e8fd[_0xb5a6('0x49')]=_[_0xb5a6('0x47')](_0xfabcae[_0xb5a6('0x43')],qs[_0xb5a6('0x48')](_0x3f44b0[_0xb5a6('0x45')][_0xb5a6('0x48')]));_0x18e8fd[_0xb5a6('0x49')]=_0x18e8fd['attributes'][_0xb5a6('0x59')]?_0x18e8fd[_0xb5a6('0x49')]:_0xfabcae['model'];if(_0x3f44b0[_0xb5a6('0x45')][_0xb5a6('0x53')]){_0x18e8fd[_0xb5a6('0x54')]=[{'all':!![]}];}_0x18e8fd=_['merge']({},_0x18e8fd,_0x3f44b0[_0xb5a6('0x51')]);return db['SmsAccount'][_0xb5a6('0x5a')](_0x18e8fd)[_0xb5a6('0x23')](handleEntityNotFound(_0x240cad,null))[_0xb5a6('0x23')](respondWithResult(_0x240cad,null))[_0xb5a6('0x2a')](handleError(_0x240cad,null));};exports[_0xb5a6('0x5b')]=function(_0xe37a25,_0x54fd84){return db[_0xb5a6('0x52')]['create'](_0xe37a25['body'],{})[_0xb5a6('0x23')](function(_0x16e315){var _0x570595=_0xe37a25[_0xb5a6('0x5c')][_0xb5a6('0x38')]({'plain':!![]});if(!_0x570595)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x570595[_0xb5a6('0x5d')]==='user'){var _0x52a727=_0x16e315[_0xb5a6('0x38')]({'plain':!![]});var _0x15ab17=_0xb5a6('0x5e');return db['UserProfileSection'][_0xb5a6('0x5a')]({'where':{'name':_0x15ab17,'userProfileId':_0x570595['userProfileId']},'raw':!![]})[_0xb5a6('0x23')](function(_0x37dd94){if(_0x37dd94&&_0x37dd94[_0xb5a6('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x52a727[_0xb5a6('0x3b')],'resourceId':_0x52a727['id'],'type':_0x37dd94[_0xb5a6('0x3b')],'sectionId':_0x37dd94['id']},{})['then'](function(){return _0x16e315;});}else{return _0x16e315;}})[_0xb5a6('0x2a')](function(_0x5bd474){logger[_0xb5a6('0x28')](_0xb5a6('0x60'),_0x5bd474);throw _0x5bd474;});}return _0x16e315;})[_0xb5a6('0x23')](respondWithResult(_0x54fd84,0xc9))[_0xb5a6('0x2a')](handleError(_0x54fd84,null));};exports[_0xb5a6('0x37')]=function(_0x5eed2c,_0xfc996d){if(_0x5eed2c[_0xb5a6('0x61')]['id']){delete _0x5eed2c[_0xb5a6('0x61')]['id'];}return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x5eed2c[_0xb5a6('0x58')]['id']},'include':[{'model':db[_0xb5a6('0x3d')],'as':_0xb5a6('0x3e')}]})[_0xb5a6('0x23')](handleEntityNotFound(_0xfc996d,null))['then'](saveUpdates(_0x5eed2c[_0xb5a6('0x61')],null))[_0xb5a6('0x23')](respondWithResult(_0xfc996d,null))[_0xb5a6('0x2a')](handleError(_0xfc996d,null));};exports[_0xb5a6('0x3a')]=function(_0x12b654,_0xbb5684){return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x12b654['params']['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0xbb5684,null))['then'](removeEntity(_0xbb5684,null))[_0xb5a6('0x2a')](handleError(_0xbb5684,null));};exports['describe']=function(_0x25e7c1,_0x107602){return db[_0xb5a6('0x52')]['describe']()[_0xb5a6('0x23')](respondWithResult(_0x107602,null))[_0xb5a6('0x2a')](handleError(_0x107602,null));};exports[_0xb5a6('0x62')]=function(_0x5859e6,_0xd92fe6,_0x45ea1d){if(_0x5859e6[_0xb5a6('0x61')]['id']){delete _0x5859e6[_0xb5a6('0x61')]['id'];}return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x5859e6[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0xd92fe6,null))['then'](function(_0x1fc50c){if(_0x1fc50c){_0x5859e6[_0xb5a6('0x61')][_0xb5a6('0x63')]=_0x1fc50c['id'];return db[_0xb5a6('0x64')]['create'](_0x5859e6[_0xb5a6('0x61')]);}})[_0xb5a6('0x23')](respondWithResult(_0xd92fe6,null))[_0xb5a6('0x2a')](handleError(_0xd92fe6,null));};exports[_0xb5a6('0x65')]=function(_0x7ed286,_0x2b6e07,_0x15d6ad){var _0x350194={'raw':![],'where':{}};var _0x5ea1a9={};var _0x569be6={'count':0x0,'rows':[]};return db[_0xb5a6('0x52')][_0xb5a6('0x66')]({'where':{'id':_0x7ed286[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x2b6e07,null))[_0xb5a6('0x23')](function(_0x5cfba9){if(_0x5cfba9){_0x5ea1a9[_0xb5a6('0x43')]=_['keys'](db['Disposition'][_0xb5a6('0x3f')]);_0x5ea1a9[_0xb5a6('0x45')]=_[_0xb5a6('0x46')](_0x7ed286[_0xb5a6('0x45')]);_0x5ea1a9[_0xb5a6('0x4d')]=_[_0xb5a6('0x47')](_0x5ea1a9[_0xb5a6('0x43')],_0x5ea1a9[_0xb5a6('0x45')]);_0x350194['attributes']=_['intersection'](_0x5ea1a9[_0xb5a6('0x43')],qs['fields'](_0x7ed286[_0xb5a6('0x45')][_0xb5a6('0x48')]));_0x350194[_0xb5a6('0x49')]=_0x350194[_0xb5a6('0x49')][_0xb5a6('0x59')]?_0x350194[_0xb5a6('0x49')]:_0x5ea1a9[_0xb5a6('0x43')];if(!_0x7ed286[_0xb5a6('0x45')]['hasOwnProperty'](_0xb5a6('0x4a'))){_0x350194[_0xb5a6('0x30')]=qs['limit'](_0x7ed286[_0xb5a6('0x45')][_0xb5a6('0x30')]);_0x350194[_0xb5a6('0x32')]=qs[_0xb5a6('0x32')](_0x7ed286[_0xb5a6('0x45')][_0xb5a6('0x32')]);}_0x350194['order']=qs['sort'](_0x7ed286[_0xb5a6('0x45')][_0xb5a6('0x4b')]);_0x350194['where']=qs[_0xb5a6('0x4d')](_[_0xb5a6('0x4e')](_0x7ed286[_0xb5a6('0x45')],_0x5ea1a9[_0xb5a6('0x4d')]));_0x350194[_0xb5a6('0x4c')][_0xb5a6('0x63')]=_0x5cfba9['id'];if(_0x7ed286['query'][_0xb5a6('0x50')]){_0x350194[_0xb5a6('0x4c')]=_[_0xb5a6('0x4f')](_0x350194['where'],{'$or':_['map'](_0x350194[_0xb5a6('0x49')],function(_0x575f7e){var _0x317182={};_0x317182[_0x575f7e]={'$like':'%'+_0x7ed286[_0xb5a6('0x45')][_0xb5a6('0x50')]+'%'};return _0x317182;})});}_0x350194=_['merge']({},_0x350194,_0x7ed286[_0xb5a6('0x51')]);return db[_0xb5a6('0x64')][_0xb5a6('0x31')]({'where':_0x350194[_0xb5a6('0x4c')]})[_0xb5a6('0x23')](function(_0x50c6f3){_0x569be6[_0xb5a6('0x31')]=_0x50c6f3;if(_0x7ed286[_0xb5a6('0x45')][_0xb5a6('0x53')]){_0x350194[_0xb5a6('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x350194);})['then'](function(_0x2f6384){_0x569be6['rows']=_0x2f6384;return _0x569be6;});}})[_0xb5a6('0x23')](respondWithFilteredResult(_0x2b6e07,_0x350194))[_0xb5a6('0x2a')](handleError(_0x2b6e07,null));};exports['removeDispositions']=function(_0x2cce3b,_0xb6a597,_0x2a553b){return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x2cce3b[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0xb6a597,null))[_0xb5a6('0x23')](function(_0x1fbd5e){if(_0x1fbd5e){return _0x1fbd5e[_0xb5a6('0x67')](_0x2cce3b[_0xb5a6('0x45')][_0xb5a6('0x68')]);}})[_0xb5a6('0x23')](respondWithStatusCode(_0xb6a597,null))[_0xb5a6('0x2a')](handleError(_0xb6a597,null));};exports[_0xb5a6('0x69')]=function(_0x53a5c7,_0x3ea2ff,_0x28b81d){if(_0x53a5c7[_0xb5a6('0x61')]['id']){delete _0x53a5c7[_0xb5a6('0x61')]['id'];}return db[_0xb5a6('0x52')]['find']({'where':{'id':_0x53a5c7['params']['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x3ea2ff,null))[_0xb5a6('0x23')](function(_0x35bd58){if(_0x35bd58){_0x53a5c7[_0xb5a6('0x61')][_0xb5a6('0x63')]=_0x35bd58['id'];return db[_0xb5a6('0x6a')][_0xb5a6('0x5b')](_0x53a5c7['body']);}})['then'](respondWithResult(_0x3ea2ff,null))[_0xb5a6('0x2a')](handleError(_0x3ea2ff,null));};exports['getAnswers']=function(_0x27e701,_0xe8f453,_0x23868d){var _0x1f8567={'raw':![],'where':{}};var _0x2482b1={};var _0xe2d7e1={'count':0x0,'rows':[]};return db[_0xb5a6('0x52')]['findOne']({'where':{'id':_0x27e701[_0xb5a6('0x58')]['id']}})['then'](handleEntityNotFound(_0xe8f453,null))[_0xb5a6('0x23')](function(_0x107dd6){if(_0x107dd6){_0x2482b1[_0xb5a6('0x43')]=_[_0xb5a6('0x46')](db[_0xb5a6('0x6a')]['rawAttributes']);_0x2482b1[_0xb5a6('0x45')]=_[_0xb5a6('0x46')](_0x27e701['query']);_0x2482b1[_0xb5a6('0x4d')]=_[_0xb5a6('0x47')](_0x2482b1[_0xb5a6('0x43')],_0x2482b1[_0xb5a6('0x45')]);_0x1f8567['attributes']=_[_0xb5a6('0x47')](_0x2482b1[_0xb5a6('0x43')],qs[_0xb5a6('0x48')](_0x27e701[_0xb5a6('0x45')]['fields']));_0x1f8567[_0xb5a6('0x49')]=_0x1f8567[_0xb5a6('0x49')][_0xb5a6('0x59')]?_0x1f8567[_0xb5a6('0x49')]:_0x2482b1[_0xb5a6('0x43')];if(!_0x27e701['query'][_0xb5a6('0x6b')](_0xb5a6('0x4a'))){_0x1f8567['limit']=qs[_0xb5a6('0x30')](_0x27e701[_0xb5a6('0x45')]['limit']);_0x1f8567[_0xb5a6('0x32')]=qs[_0xb5a6('0x32')](_0x27e701[_0xb5a6('0x45')]['offset']);}_0x1f8567['order']=qs[_0xb5a6('0x4b')](_0x27e701[_0xb5a6('0x45')][_0xb5a6('0x4b')]);_0x1f8567[_0xb5a6('0x4c')]=qs[_0xb5a6('0x4d')](_[_0xb5a6('0x4e')](_0x27e701['query'],_0x2482b1[_0xb5a6('0x4d')]));_0x1f8567[_0xb5a6('0x4c')][_0xb5a6('0x63')]=_0x107dd6['id'];if(_0x27e701['query'][_0xb5a6('0x50')]){_0x1f8567['where']=_[_0xb5a6('0x4f')](_0x1f8567[_0xb5a6('0x4c')],{'$or':_[_0xb5a6('0x44')](_0x1f8567['attributes'],function(_0x5ce471){var _0x4ee59b={};_0x4ee59b[_0x5ce471]={'$like':'%'+_0x27e701['query'][_0xb5a6('0x50')]+'%'};return _0x4ee59b;})});}_0x1f8567=_[_0xb5a6('0x4f')]({},_0x1f8567,_0x27e701['options']);return db[_0xb5a6('0x6a')][_0xb5a6('0x31')]({'where':_0x1f8567[_0xb5a6('0x4c')]})[_0xb5a6('0x23')](function(_0x46f8d6){_0xe2d7e1['count']=_0x46f8d6;if(_0x27e701['query'][_0xb5a6('0x53')]){_0x1f8567[_0xb5a6('0x54')]=[{'all':!![]}];}return db[_0xb5a6('0x6a')]['findAll'](_0x1f8567);})[_0xb5a6('0x23')](function(_0xa69889){_0xe2d7e1[_0xb5a6('0x56')]=_0xa69889;return _0xe2d7e1;});}})['then'](respondWithFilteredResult(_0xe8f453,_0x1f8567))['catch'](handleError(_0xe8f453,null));};exports[_0xb5a6('0x6c')]=function(_0x3f3b08,_0x589666,_0x5273aa){return db[_0xb5a6('0x52')]['find']({'where':{'id':_0x3f3b08[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x589666,null))[_0xb5a6('0x23')](function(_0x16d42a){if(_0x16d42a){return _0x16d42a[_0xb5a6('0x6c')](_0x3f3b08[_0xb5a6('0x45')]['ids']);}})[_0xb5a6('0x23')](respondWithStatusCode(_0x589666,null))[_0xb5a6('0x2a')](handleError(_0x589666,null));};exports[_0xb5a6('0x6d')]=function(_0x42c8b3,_0x5b4213,_0xcb0035){var _0x625a31={'channel':_0xb5a6('0x6e')};var _0x5c5860=[];var _0x352879=[];var _0x5b9c9c={};return db[_0xb5a6('0x52')]['find']({'where':{'id':_0x42c8b3['params']['id']},'include':[{'model':db[_0xb5a6('0x6f')],'as':'Applications'}]})[_0xb5a6('0x23')](handleEntityNotFound(_0x5b4213,null))[_0xb5a6('0x23')](function(_0x1ec9bf){_0x625a31[_0xb5a6('0x70')]=_0x1ec9bf;_0x625a31['applications']=_['orderBy'](_0x1ec9bf[_0xb5a6('0x71')],[_0xb5a6('0x72')],[_0xb5a6('0x73')]);if(_0x625a31[_0xb5a6('0x70')][_0xb5a6('0x71')]){delete _0x625a31[_0xb5a6('0x70')][_0xb5a6('0x71')];}return db[_0xb5a6('0x74')]['describe']();})[_0xb5a6('0x23')](function(_0xaf60b5){if(!_0xaf60b5){throw new db['Sequelize'][(_0xb5a6('0x75'))](_0xb5a6('0x76'));}_0x5c5860=_[_0xb5a6('0x77')](_[_0xb5a6('0x46')](_0xaf60b5),[_0xb5a6('0x78'),_0xb5a6('0x79')]);_0x352879=_[_0xb5a6('0x77')](_[_0xb5a6('0x46')](_0xaf60b5),['createdAt',_0xb5a6('0x79'),_0xb5a6('0x7a'),_0xb5a6('0x7b')]);_0x625a31[_0xb5a6('0x61')]={'mapKey':_0xb5a6('0x7c')};if(_0x625a31[_0xb5a6('0x70')][_0xb5a6('0x41')]){switch(_0x625a31[_0xb5a6('0x70')][_0xb5a6('0x41')]){case _0xb5a6('0x7d'):_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x7f')];_0x625a31['body'][_0xb5a6('0x61')]=_0x42c8b3[_0xb5a6('0x61')]['Body'];_0x625a31[_0xb5a6('0x61')]['messageId']=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x80')];break;case'skebby':_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')]='+'+_0x42c8b3['body'][_0xb5a6('0x81')];_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x61')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x82')];break;case _0xb5a6('0x83'):_0x625a31['body'][_0xb5a6('0x7e')]=_0x42c8b3[_0xb5a6('0x61')]['from'];_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x61')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x29')];break;case'clicksend':_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x7e')];_0x625a31[_0xb5a6('0x61')]['body']=_0x42c8b3[_0xb5a6('0x61')]['body'];_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x84')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x85')];break;case'plivo':_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x7f')];_0x625a31['body'][_0xb5a6('0x61')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x86')];_0x625a31[_0xb5a6('0x61')]['messageId']=_0x42c8b3[_0xb5a6('0x61')]['MessageUUID'];break;case'infobip':_0x625a31[_0xb5a6('0x61')]['from']='+'+_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x87')][0x0][_0xb5a6('0x7e')];_0x625a31['body'][_0xb5a6('0x61')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x87')][0x0][_0xb5a6('0x82')];_0x625a31['body'][_0xb5a6('0x84')]=_0x42c8b3['body'][_0xb5a6('0x87')][0x0][_0xb5a6('0x84')];break;case _0xb5a6('0x88'):_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x89')];_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x61')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x8a')]['message'];break;case _0xb5a6('0x8b'):_0x625a31['body']['from']=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x8c')];_0x625a31[_0xb5a6('0x61')]['body']=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x82')];_0x625a31['body'][_0xb5a6('0x84')]=_0x42c8b3[_0xb5a6('0x61')]['replyMessageId'];break;case _0xb5a6('0x8d'):_0x625a31['body']['messageId']=_0x42c8b3['body'][0x0]['message']['id'];_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')]=_0x42c8b3['body'][0x0][_0xb5a6('0x29')][_0xb5a6('0x7e')];_0x625a31['body']['body']=_0x42c8b3[_0xb5a6('0x61')][0x0]['message'][_0xb5a6('0x82')];break;case _0xb5a6('0x8e'):_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x7e')];_0x625a31['body'][_0xb5a6('0x61')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x29')];_0x625a31['body'][_0xb5a6('0x84')]=_0x42c8b3[_0xb5a6('0x61')][_0xb5a6('0x8f')];break;}}if(_0x625a31[_0xb5a6('0x61')]['id']){delete _0x625a31[_0xb5a6('0x61')]['id'];}if(_[_0xb5a6('0x90')](_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')])){throw new db[(_0xb5a6('0x91'))][(_0xb5a6('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x625a31[_0xb5a6('0x61')]['body'])||_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x61')]===''){throw new db[(_0xb5a6('0x91'))][(_0xb5a6('0x75'))](_0xb5a6('0x92'));}if(_['isNil'](_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x93')])){throw new db[(_0xb5a6('0x91'))][(_0xb5a6('0x75'))](_0xb5a6('0x94')+_0x352879);}if(!_['includes'](_0x352879,_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x93')])){throw new db[(_0xb5a6('0x91'))][(_0xb5a6('0x75'))](_0xb5a6('0x95')+_0x352879);}_0x5b9c9c[_0x625a31[_0xb5a6('0x61')]['mapKey']]=_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')];return db['CmList'][_0xb5a6('0x5a')]({'where':{'id':_0x625a31[_0xb5a6('0x70')][_0xb5a6('0x7b')]},'include':[{'model':db[_0xb5a6('0x74')],'as':_0xb5a6('0x96'),'where':_0x5b9c9c,'limit':0x1,'order':[[_0xb5a6('0x79'),_0xb5a6('0x97')]]}]});})['then'](handleEntityNotFound(_0x5b4213,null))['then'](function(_0x24e3b6){if(_0x24e3b6){_0x625a31[_0xb5a6('0x98')]=_[_0xb5a6('0x99')](_0x24e3b6,[_0xb5a6('0x96')]);if(_0x24e3b6['Contacts'][_0xb5a6('0x59')]){return _0x24e3b6['Contacts'][0x0];}var _0xe7a12c=_[_0xb5a6('0x1d')](_0x625a31[_0xb5a6('0x61')],{'firstName':_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')],'ListId':_0x24e3b6['id']});_0xe7a12c[_0x625a31[_0xb5a6('0x61')]['mapKey']]=_0x625a31['body'][_0xb5a6('0x7e')];return db['CmContact'][_0xb5a6('0x5b')](_0xe7a12c,{'fields':_0x5c5860,'raw':!![]});}})[_0xb5a6('0x23')](handleEntityNotFound(_0x5b4213,null))[_0xb5a6('0x23')](function(_0xb7e978){if(_0xb7e978){_0x625a31[_0xb5a6('0x9a')]=_0xb7e978;var _0x3497ec={'ContactId':_0xb7e978['id'],'phone':_0x625a31[_0xb5a6('0x61')][_0xb5a6('0x7e')],'SmsAccountId':_0x42c8b3[_0xb5a6('0x58')]['id']};var _0x1542c9={'ContactId':_0xb7e978['id'],'SmsAccountId':_0x42c8b3[_0xb5a6('0x58')]['id'],'closed':![]};return db['SmsInteraction'][_0xb5a6('0x5a')]({'where':_0x1542c9})[_0xb5a6('0x23')](function(_0x3fa87b){if(_0x3fa87b){return[_0x3fa87b,![]];}return db[_0xb5a6('0x9b')][_0xb5a6('0x5b')](_0x3497ec)[_0xb5a6('0x23')](function(_0x3292c2){return[_0x3292c2,!![]];});});}})[_0xb5a6('0x9c')](function(_0x31cb9e,_0xa5b5f7){_0x625a31[_0xb5a6('0x9d')]=_0x31cb9e[_0xb5a6('0x38')]({'plain':!![]});_0x625a31[_0xb5a6('0x9d')][_0xb5a6('0x9e')]=![];if(_0xa5b5f7){if(_0x625a31[_0xb5a6('0x70')]['autoclose']){_0x625a31[_0xb5a6('0x9f')]['push']({'id':0x0,'priority':_0x625a31[_0xb5a6('0x9f')][_0xb5a6('0x59')]+0x1,'app':_0xb5a6('0xa0'),'appdata':_0xb5a6('0xa1'),'interval':_0xb5a6('0xa2')});}_0x625a31[_0xb5a6('0x9d')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x625a31[_0xb5a6('0x61')]['from'],'messageId':_0x625a31[_0xb5a6('0x61')]['messageId'],'body':_0x625a31['body'][_0xb5a6('0x61')],'SmsAccountId':_0x42c8b3['params']['id'],'SmsInteractionId':_0x31cb9e['id'],'direction':'in','ContactId':_0x31cb9e['ContactId'],'AttachmentId':_0x625a31[_0xb5a6('0x61')][_0xb5a6('0xa3')]});})[_0xb5a6('0x23')](function(_0x3266ab){_0x625a31['message']=_0x3266ab;if(_0x625a31[_0xb5a6('0x9d')][_0xb5a6('0xa4')]){return db[_0xb5a6('0xa5')]['find']({'attributes':['id',_0xb5a6('0x3b')],'where':{'id':_0x625a31['interaction'][_0xb5a6('0xa4')]}})[_0xb5a6('0x23')](function(_0x1d9a30){if(_0x1d9a30){_0x625a31['applications'][_0xb5a6('0xa6')]({'id':0x0,'priority':0x0,'app':_0xb5a6('0xa7'),'appdata':_0x1d9a30[_0xb5a6('0x3b')]+','+(_0x625a31[_0xb5a6('0x70')][_0xb5a6('0xa8')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb5a6('0xa9'),_0xb5a6('0xaa'),_0x625a31);});}return respondWithRpcPromise(_0xb5a6('0xa9'),_0xb5a6('0xaa'),_0x625a31);})[_0xb5a6('0x23')](function(_0x1742dc){if(_0x1742dc){var _0x2efd51=0xc8;var _0x57976b=_0xb5a6('0xab');logger[_0xb5a6('0xac')](_0xb5a6('0x26'),_0x57976b,_0x2efd51,_0xb5a6('0xad'));logger['debug'](_0xb5a6('0xae'),_0x57976b,_0x2efd51,_0xb5a6('0xad'),JSON[_0xb5a6('0x27')](_0x1742dc));if(_0x625a31[_0xb5a6('0x70')][_0xb5a6('0x41')]===_0xb5a6('0x7d')){return _0x5b4213[_0xb5a6('0x2c')](_0x2efd51)[_0xb5a6('0x33')](_0xb5a6('0xaf'),'text/xml')['send']('\x0a');}else{return _0x5b4213[_0xb5a6('0x2c')](_0x2efd51)['json'](_0x1742dc);}}})[_0xb5a6('0x2a')](handleError(_0x5b4213,null));};exports['addApplications']=function(_0x530053,_0x49a076,_0x271233){return db[_0xb5a6('0x52')][_0xb5a6('0x66')]({'where':{'id':_0x530053[_0xb5a6('0x58')]['id']}})['then'](handleEntityNotFound(_0x49a076,null))[_0xb5a6('0x23')](function(_0x10e179){if(_0x10e179){return db[_0xb5a6('0xb0')][_0xb5a6('0xb1')](function(_0x51adbe){return db[_0xb5a6('0x6f')][_0xb5a6('0x3a')]({'where':{'SmsAccountId':_0x530053['params']['id']},'transaction':_0x51adbe})[_0xb5a6('0x23')](function(_0x5679c5){var _0x404153=_[_0xb5a6('0x44')](_0x530053['body'],function(_0x57c813){_0x57c813[_0xb5a6('0x63')]=_0x530053[_0xb5a6('0x58')]['id'];return _0x57c813;});return db[_0xb5a6('0x6f')]['bulkCreate'](_0x404153,{'transaction':_0x51adbe});});})[_0xb5a6('0x23')](function(){return db[_0xb5a6('0x6f')][_0xb5a6('0xb2')]({'where':{'SmsAccountId':_0x530053[_0xb5a6('0x58')]['id']},'order':_0xb5a6('0x72')});});}})[_0xb5a6('0x23')](respondWithResult(_0x49a076,null))[_0xb5a6('0x2a')](handleError(_0x49a076,null));};exports[_0xb5a6('0xb3')]=function(_0x2f1f2f,_0x336645,_0x16115d){var _0x1faaff={};var _0x5a7f99={};var _0x3fbedf;var _0x5dae35;return db[_0xb5a6('0x52')][_0xb5a6('0x66')]({'where':{'id':_0x2f1f2f['params']['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x336645,null))[_0xb5a6('0x23')](function(_0x41956c){if(_0x41956c){_0x3fbedf=_0x41956c;_0x5a7f99[_0xb5a6('0x43')]=_[_0xb5a6('0x46')](db[_0xb5a6('0x6f')][_0xb5a6('0x3f')]);_0x5a7f99[_0xb5a6('0x45')]=_[_0xb5a6('0x46')](_0x2f1f2f[_0xb5a6('0x45')]);_0x5a7f99[_0xb5a6('0x4d')]=_[_0xb5a6('0x47')](_0x5a7f99[_0xb5a6('0x43')],_0x5a7f99[_0xb5a6('0x45')]);_0x1faaff[_0xb5a6('0x49')]=_['intersection'](_0x5a7f99[_0xb5a6('0x43')],qs[_0xb5a6('0x48')](_0x2f1f2f[_0xb5a6('0x45')]['fields']));_0x1faaff[_0xb5a6('0x49')]=_0x1faaff[_0xb5a6('0x49')]['length']?_0x1faaff[_0xb5a6('0x49')]:_0x5a7f99[_0xb5a6('0x43')];_0x1faaff[_0xb5a6('0xb4')]=qs[_0xb5a6('0x4b')](_0x2f1f2f[_0xb5a6('0x45')][_0xb5a6('0x4b')]);_0x1faaff[_0xb5a6('0x4c')]=qs['filters'](_[_0xb5a6('0x4e')](_0x2f1f2f[_0xb5a6('0x45')],_0x5a7f99[_0xb5a6('0x4d')]));if(_0x2f1f2f[_0xb5a6('0x45')]['filter']){_0x1faaff[_0xb5a6('0x4c')]=_[_0xb5a6('0x4f')](_0x1faaff[_0xb5a6('0x4c')],{'$or':_[_0xb5a6('0x44')](_0x1faaff[_0xb5a6('0x49')],function(_0x182a76){var _0x3011af={};_0x3011af[_0x182a76]={'$like':'%'+_0x2f1f2f[_0xb5a6('0x45')]['filter']+'%'};return _0x3011af;})});}_0x1faaff=_[_0xb5a6('0x4f')]({},_0x1faaff,_0x2f1f2f[_0xb5a6('0x51')]);return _0x3fbedf[_0xb5a6('0xb3')](_0x1faaff);}})[_0xb5a6('0x23')](function(_0x441b34){if(_0x441b34){_0x5dae35=_0x441b34[_0xb5a6('0x59')];if(!_0x2f1f2f[_0xb5a6('0x45')][_0xb5a6('0x6b')](_0xb5a6('0x4a'))){_0x1faaff[_0xb5a6('0x30')]=qs[_0xb5a6('0x30')](_0x2f1f2f[_0xb5a6('0x45')][_0xb5a6('0x30')]);_0x1faaff[_0xb5a6('0x32')]=qs[_0xb5a6('0x32')](_0x2f1f2f[_0xb5a6('0x45')][_0xb5a6('0x32')]);}return _0x3fbedf[_0xb5a6('0xb3')](_0x1faaff);}})['then'](function(_0x1031f9){if(_0x1031f9){return _0x1031f9?{'count':_0x5dae35,'rows':_0x1031f9}:null;}})[_0xb5a6('0x23')](respondWithResult(_0x336645,null))['catch'](handleError(_0x336645,null));};exports[_0xb5a6('0xb5')]=function(_0xeb3504,_0x2ef256,_0x425733){var _0x525b55={'raw':![],'where':{}};var _0x15e477={};var _0x29fcc8={'count':0x0,'rows':[]};return db[_0xb5a6('0x52')][_0xb5a6('0x66')]({'where':{'id':_0xeb3504[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x2ef256,null))[_0xb5a6('0x23')](function(_0x4735da){if(_0x4735da){_0x15e477['model']=_['keys'](db['SmsInteraction'][_0xb5a6('0x3f')]);_0x15e477[_0xb5a6('0x45')]=_[_0xb5a6('0x46')](_0xeb3504['query']);_0x15e477['filters']=_[_0xb5a6('0x47')](_0x15e477['model'],_0x15e477[_0xb5a6('0x45')]);_0x525b55[_0xb5a6('0x49')]=_['intersection'](_0x15e477['model'],qs['fields'](_0xeb3504[_0xb5a6('0x45')]['fields']));_0x525b55[_0xb5a6('0x49')]=_0x525b55['attributes'][_0xb5a6('0x59')]?_0x525b55[_0xb5a6('0x49')]:_0x15e477['model'];if(!_0xeb3504[_0xb5a6('0x45')][_0xb5a6('0x6b')](_0xb5a6('0x4a'))){_0x525b55[_0xb5a6('0x30')]=qs[_0xb5a6('0x30')](_0xeb3504[_0xb5a6('0x45')][_0xb5a6('0x30')]);_0x525b55['offset']=qs['offset'](_0xeb3504['query'][_0xb5a6('0x32')]);}_0x525b55[_0xb5a6('0xb4')]=qs[_0xb5a6('0x4b')](_0xeb3504[_0xb5a6('0x45')][_0xb5a6('0x4b')]);_0x525b55[_0xb5a6('0x4c')]=qs['filters'](_['pick'](_0xeb3504[_0xb5a6('0x45')],_0x15e477[_0xb5a6('0x4d')]));_0x525b55[_0xb5a6('0x4c')][_0xb5a6('0x63')]=_0x4735da['id'];if(_0xeb3504[_0xb5a6('0x45')][_0xb5a6('0x50')]){_0x525b55[_0xb5a6('0x4c')]=_[_0xb5a6('0x4f')](_0x525b55[_0xb5a6('0x4c')],{'$or':_[_0xb5a6('0x44')](_0x525b55[_0xb5a6('0x49')],function(_0x4fe8bd){var _0x40288a={};_0x40288a[_0x4fe8bd]={'$like':'%'+_0xeb3504[_0xb5a6('0x45')]['filter']+'%'};return _0x40288a;})});}_0x525b55=_[_0xb5a6('0x4f')]({},_0x525b55,_0xeb3504[_0xb5a6('0x51')]);return db[_0xb5a6('0x9b')][_0xb5a6('0x31')]({'where':_0x525b55['where']})[_0xb5a6('0x23')](function(_0x1dfad0){_0x29fcc8[_0xb5a6('0x31')]=_0x1dfad0;if(_0xeb3504[_0xb5a6('0x45')][_0xb5a6('0x53')]){_0x525b55[_0xb5a6('0x54')]=[{'model':db[_0xb5a6('0x74')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xb5a6('0xb6'),'attributes':[_0xb5a6('0x3b'),_0xb5a6('0xb7'),_0xb5a6('0xb8')],'required':![]},{'model':db[_0xb5a6('0xb9')],'as':_0xb5a6('0xba'),'attributes':['id',_0xb5a6('0x3b'),_0xb5a6('0xbb')],'where':_0xeb3504[_0xb5a6('0x45')]['tag']?{'id':_0xeb3504[_0xb5a6('0x45')][_0xb5a6('0xbc')]}:undefined,'required':_0xeb3504[_0xb5a6('0x45')]['tag']?!![]:![]}];}return db[_0xb5a6('0x9b')][_0xb5a6('0x55')](_0x525b55);})['then'](function(_0xbe2d23){_0x29fcc8[_0xb5a6('0x56')]=_0xbe2d23;return _0x29fcc8;});}})['then'](respondWithFilteredResult(_0x2ef256,_0x525b55))[_0xb5a6('0x2a')](handleError(_0x2ef256,null));};exports[_0xb5a6('0x3c')]=function(_0x2e3908,_0x1114f4,_0x489738){var _0x1ffcc7,_0x526bac,_0x303c8e;if(_[_0xb5a6('0x90')](_0x2e3908[_0xb5a6('0x61')][_0xb5a6('0x61')])||_0x2e3908[_0xb5a6('0x61')][_0xb5a6('0x61')]===''){throw new db['Sequelize'][(_0xb5a6('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2e3908[_0xb5a6('0x61')]['to'])){throw new db[(_0xb5a6('0x91'))][(_0xb5a6('0x75'))](_0xb5a6('0xbd'));}_0x1ffcc7=_0x2e3908['body']['to'];return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x2e3908[_0xb5a6('0x58')]['id']},'include':[{'model':db[_0xb5a6('0xbe')],'as':_0xb5a6('0xbf'),'include':[{'model':db[_0xb5a6('0x74')],'as':_0xb5a6('0x96'),'where':{'mobile':_0x1ffcc7},'limit':0x1,'order':[[_0xb5a6('0x79'),'DESC']]}]}]})[_0xb5a6('0x23')](handleEntityNotFound(_0x1114f4,null))['then'](function(_0x1a8f7c){if(_0x1a8f7c&&_0x1a8f7c[_0xb5a6('0xbf')]){_0x526bac=_0x1a8f7c['get']({'plain':!![]});if(_0x526bac[_0xb5a6('0xbf')]&&_0x526bac[_0xb5a6('0xbf')]['Contacts']['length']){return _0x526bac['List'][_0xb5a6('0x96')][0x0];}return db[_0xb5a6('0x74')][_0xb5a6('0x5b')](_['defaults'](_0x2e3908[_0xb5a6('0x61')],{'firstName':_0x1ffcc7,'mobile':_0x1ffcc7,'phone':_0x1ffcc7,'ListId':_0x526bac[_0xb5a6('0x7b')]}));}})[_0xb5a6('0x23')](handleEntityNotFound(_0x1114f4,null))[_0xb5a6('0x23')](function(_0x5af9b6){if(_0x5af9b6){_0x303c8e=_0x5af9b6;return db[_0xb5a6('0x9b')][_0xb5a6('0x5a')]({'where':{'ContactId':_0x303c8e['id'],'closed':![],'SmsAccountId':_0x526bac['id']}})[_0xb5a6('0x23')](function(_0x18c5ab){if(_0x18c5ab){return[_0x18c5ab,![]];}return db[_0xb5a6('0x9b')][_0xb5a6('0x5b')]({'UserId':_0x2e3908[_0xb5a6('0x5c')]['id'],'ContactId':_0x303c8e['id'],'SmsAccountId':_0x526bac['id'],'phone':_0x1ffcc7,'firstMsgDirection':_0xb5a6('0xc0'),'Messages':[_['merge'](_0x2e3908[_0xb5a6('0x61')],{'read':![],'body':_0x2e3908['body'][_0xb5a6('0x61')],'phone':_0x1ffcc7,'SmsAccountId':_0x526bac['id'],'UserId':_0x2e3908[_0xb5a6('0x5c')]['id'],'ContactId':_0x303c8e['id']})]},{'include':[{'model':db[_0xb5a6('0xc1')],'as':'Messages'}]})[_0xb5a6('0x23')](function(_0x160f52){return[_0x160f52,!![]];});});}})[_0xb5a6('0x9c')](function(_0x1220e7,_0x4ed57c){if(_0x4ed57c){return _0x1220e7;}return db['SmsMessage'][_0xb5a6('0x5b')](_[_0xb5a6('0x4f')](_0x2e3908[_0xb5a6('0x61')],{'read':![],'body':_0x2e3908[_0xb5a6('0x61')][_0xb5a6('0x61')],'phone':_0x1ffcc7,'SmsAccountId':_0x526bac['id'],'SmsInteractionId':_0x1220e7['id'],'UserId':_0x2e3908[_0xb5a6('0x5c')]['id'],'ContactId':_0x303c8e['id']}))[_0xb5a6('0x23')](function(_0x388dd4){_0x1220e7['dataValues']['Messages']=[];_0x1220e7[_0xb5a6('0xc2')][_0xb5a6('0xc3')][_0xb5a6('0xc4')](_0x388dd4[_0xb5a6('0xc2')]);return _0x1220e7;});})[_0xb5a6('0x23')](respondWithResult(_0x1114f4,null))[_0xb5a6('0x2a')](handleError(_0x1114f4,null));};exports[_0xb5a6('0x2c')]=function(_0x5e1860,_0x33ac6d,_0x54b5f1){if(_0x5e1860[_0xb5a6('0x61')]['id']){delete _0x5e1860[_0xb5a6('0x61')]['id'];}var _0x25740c,_0x1a4ab6,_0x3a5a60;return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x5e1860[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x33ac6d,null))[_0xb5a6('0x23')](function(_0x1a0a93){if(_0x1a0a93){_0x3a5a60=_0x1a0a93;logger[_0xb5a6('0xc5')](_0xb5a6('0x26'),'status',_0xb5a6('0xc6'),_0x1a0a93[_0xb5a6('0x41')],util['inspect'](_0x5e1860['body'],{'showHidden':![],'depth':null}));switch(_0x1a0a93['type']){case _0xb5a6('0xc7'):if(_0x5e1860[_0xb5a6('0x61')]['skebby_dispatch_id']&&_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x2c')]){_0x1a4ab6=_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x2c')];return db[_0xb5a6('0xc1')]['find']({'where':{'messageId':_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0xc8')]}});}break;case _0xb5a6('0x83'):if(_0x5e1860['body'][_0xb5a6('0xc9')]&&_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0xca')]){_0x1a4ab6=_0x5e1860['body'][_0xb5a6('0xca')];return db[_0xb5a6('0xc1')][_0xb5a6('0x5a')]({'where':{'messageId':_0x5e1860['body'][_0xb5a6('0xc9')]}});}break;case _0xb5a6('0xcb'):if(_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x85')]&&_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0xcc')]){_0x1a4ab6=_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0xcc')];return db[_0xb5a6('0xc1')][_0xb5a6('0x5a')]({'where':{'messageId':_0x5e1860['body'][_0xb5a6('0x85')]}});}break;case'infobip':var _0x5980cc=_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x87')][0x0];if(_0x5980cc['messageId']&&_0x5980cc[_0xb5a6('0x2c')][_0xb5a6('0xcd')]===_0xb5a6('0xce')){_0x1a4ab6=_0x5980cc[_0xb5a6('0x2c')][_0xb5a6('0xcd')];return db[_0xb5a6('0xc1')][_0xb5a6('0x5a')]({'where':{'messageId':_0x5980cc[_0xb5a6('0x84')]}});}break;case _0xb5a6('0x8b'):if(_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x84')]&&_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x2c')]){_0x1a4ab6=_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x2c')];return db['SmsMessage'][_0xb5a6('0x5a')]({'where':{'messageId':_0x5e1860[_0xb5a6('0x61')][_0xb5a6('0x84')]}});}break;case _0xb5a6('0x8d'):if(_0x5e1860[_0xb5a6('0x61')][0x0]['message']['id']){_0x1a4ab6=_0x5e1860[_0xb5a6('0x61')][0x0][_0xb5a6('0x41')];return db[_0xb5a6('0xc1')][_0xb5a6('0x5a')]({'where':{'messageId':_0x5e1860[_0xb5a6('0x61')][0x0][_0xb5a6('0x29')]['id']}});}break;case _0xb5a6('0x8e'):if(_0x5e1860['body'][_0xb5a6('0xcf')]&&_0x5e1860['body'][_0xb5a6('0x2c')]){_0x1a4ab6=_0x5e1860['body'][_0xb5a6('0x2c')];return db[_0xb5a6('0xc1')][_0xb5a6('0x5a')]({'where':{'messageId':_0x5e1860['body'][_0xb5a6('0xcf')]}});}break;}}})[_0xb5a6('0x23')](handleEntityNotFound(_0x33ac6d,null))[_0xb5a6('0x23')](function(_0x3c2068){if(_0x3c2068){_0x25740c=_0x3c2068;switch(_0x3a5a60[_0xb5a6('0x41')]){case _0xb5a6('0xc7'):if(_0x1a4ab6===_0xb5a6('0xce')){return _0x25740c['update']({'read':!![]});}else{logger[_0xb5a6('0x28')](_0xb5a6('0x26'),'status',_0xb5a6('0xc7'),util[_0xb5a6('0xd0')](_0x5e1860[_0xb5a6('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb5a6('0x83'):if(_0x1a4ab6==='1'){return _0x25740c[_0xb5a6('0x37')]({'read':!![]});}else{logger['error'](_0xb5a6('0x26'),_0xb5a6('0x2c'),_0xb5a6('0xc7'),util[_0xb5a6('0xd0')](_0x5e1860[_0xb5a6('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb5a6('0xcb'):if(!_0x5e1860[_0xb5a6('0x61')]['error_code']&&_0x1a4ab6>=0xc8&&_0x1a4ab6<=0xce){return _0x25740c[_0xb5a6('0x37')]({'read':!![]});}else{logger[_0xb5a6('0x28')](_0xb5a6('0x26'),_0xb5a6('0x2c'),_0xb5a6('0xcb'),util['inspect'](_0x5e1860[_0xb5a6('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb5a6('0xd1'):var _0xac750a=_0x5e1860['body'][_0xb5a6('0x87')][0x0];if(_0xac750a[_0xb5a6('0x2c')][_0xb5a6('0xcd')]===_0xb5a6('0xce')){return _0x25740c[_0xb5a6('0x37')]({'read':!![]});}else{logger['error'](_0xb5a6('0x26'),_0xb5a6('0x2c'),_0xb5a6('0xd1'),util['inspect'](_0x5e1860[_0xb5a6('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1a4ab6==_0xb5a6('0xd2')||_0x1a4ab6=='RECEIVED_BY_RECIPIENT'){return _0x25740c[_0xb5a6('0x37')]({'read':!![]});}else{logger['error'](_0xb5a6('0x26'),'status',_0xb5a6('0x8b'),util[_0xb5a6('0xd0')](_0x5e1860[_0xb5a6('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb5a6('0x8d'):if(_0x1a4ab6=='message-delivered'){return _0x25740c['update']({'read':!![]});}else{logger[_0xb5a6('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb5a6('0x2c'),_0xb5a6('0x8d'),util[_0xb5a6('0xd0')](_0x5e1860[_0xb5a6('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb5a6('0x8e'):if(_0x1a4ab6===_0xb5a6('0xd3')||_0x1a4ab6===_0xb5a6('0xd4')){return _0x25740c['update']({'read':!![]});}else{logger['error'](_0xb5a6('0x26'),'status',_0xb5a6('0x8e'),util[_0xb5a6('0xd0')](_0x5e1860[_0xb5a6('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x25740c;}})[_0xb5a6('0x23')](respondWithResult(_0x33ac6d,null))[_0xb5a6('0x2a')](handleError(_0x33ac6d,null));};exports[_0xb5a6('0xd5')]=function(_0x1448e7,_0x3c076d,_0x34b580){var _0x57a455,_0x3aaebc,_0x5b9a21;return db['SmsAccount'][_0xb5a6('0x5a')]({'where':{'id':_0x1448e7[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x3c076d,null))[_0xb5a6('0x23')](function(_0x558261){if(_0x558261){_0x5b9a21=_0x558261;logger[_0xb5a6('0xc5')](_0xb5a6('0x26'),_0xb5a6('0x2c'),_0xb5a6('0xc6'),_0x558261[_0xb5a6('0x41')],util[_0xb5a6('0xd0')](_0x1448e7['query'],{'showHidden':![],'depth':null}));switch(_0x558261[_0xb5a6('0x41')]){case _0xb5a6('0x88'):if(_0x1448e7[_0xb5a6('0x45')][_0xb5a6('0xd6')]&&_0x1448e7[_0xb5a6('0x45')][_0xb5a6('0xd7')]){_0x3aaebc=_0x1448e7[_0xb5a6('0x45')][_0xb5a6('0xd7')];return db[_0xb5a6('0xc1')][_0xb5a6('0x5a')]({'where':{'messageId':_0x1448e7[_0xb5a6('0x45')][_0xb5a6('0xd6')]}});}break;}}})[_0xb5a6('0x23')](handleEntityNotFound(_0x3c076d,null))[_0xb5a6('0x23')](function(_0x1d1129){if(_0x1d1129){_0x57a455=_0x1d1129;switch(_0x5b9a21['type']){case _0xb5a6('0x88'):if(_0x3aaebc==='2'||_0x3aaebc==='6'){return _0x57a455[_0xb5a6('0x37')]({'read':!![]});}else{logger[_0xb5a6('0x28')](_0xb5a6('0x26'),_0xb5a6('0x2c'),_0xb5a6('0x88'),util[_0xb5a6('0xd0')](_0x1448e7['query'],{'showHidden':![],'depth':null}));};break;}return _0x57a455;}})['then'](respondWithResult(_0x3c076d,null))[_0xb5a6('0x2a')](handleError(_0x3c076d,null));};exports['addAgents']=function(_0x348f77,_0x4b3b4e,_0x4d155f){return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x348f77[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x4b3b4e,null))[_0xb5a6('0x23')](function(_0x19716c){if(_0x19716c){return _0x19716c[_0xb5a6('0xd8')](_0x348f77[_0xb5a6('0x61')][_0xb5a6('0x68')],_[_0xb5a6('0x99')](_0x348f77[_0xb5a6('0x61')],['ids','id'])||{})[_0xb5a6('0x9c')](function(_0x208fd4){for(var _0x305b6d=0x0;_0x305b6d<_0x348f77[_0xb5a6('0x61')][_0xb5a6('0x68')][_0xb5a6('0x59')];_0x305b6d+=0x1){socket[_0xb5a6('0xd9')]('userSmsAccount:save',{'UserId':Number(_0x348f77[_0xb5a6('0x61')]['ids'][_0x305b6d]),'SmsAccountId':Number(_0x348f77[_0xb5a6('0x58')]['id'])});}return _0x208fd4;});}})[_0xb5a6('0x23')](respondWithResult(_0x4b3b4e,null))[_0xb5a6('0x2a')](handleError(_0x4b3b4e,null));};exports['removeAgents']=function(_0x22e32a,_0x28a138,_0x39fe25){return db[_0xb5a6('0x52')][_0xb5a6('0x5a')]({'where':{'id':_0x22e32a['params']['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x28a138,null))[_0xb5a6('0x23')](function(_0x1314aa){if(_0x1314aa){return _0x1314aa[_0xb5a6('0xda')](_0x22e32a[_0xb5a6('0x45')]['ids'])[_0xb5a6('0x23')](function(){if(_[_0xb5a6('0xdb')](_0x22e32a[_0xb5a6('0x45')][_0xb5a6('0x68')])){for(var _0x4b4156=0x0;_0x4b4156<_0x22e32a[_0xb5a6('0x45')][_0xb5a6('0x68')][_0xb5a6('0x59')];_0x4b4156+=0x1){socket[_0xb5a6('0xd9')](_0xb5a6('0xdc'),{'UserId':Number(_0x22e32a[_0xb5a6('0x45')][_0xb5a6('0x68')][_0x4b4156]),'SmsAccountId':Number(_0x22e32a[_0xb5a6('0x58')]['id'])});}}else{socket[_0xb5a6('0xd9')](_0xb5a6('0xdc'),{'UserId':Number(_0x22e32a[_0xb5a6('0x45')][_0xb5a6('0x68')]),'SmsAccountId':Number(_0x22e32a[_0xb5a6('0x58')]['id'])});}});}})[_0xb5a6('0x23')](respondWithStatusCode(_0x28a138,null))['catch'](handleError(_0x28a138,null));};exports[_0xb5a6('0xdd')]=function(_0x392ce9,_0x718259,_0x58c9b5){var _0x2862f9={};var _0x5c94ee={};var _0x338841;var _0x885e30;return db[_0xb5a6('0x52')][_0xb5a6('0x66')]({'where':{'id':_0x392ce9[_0xb5a6('0x58')]['id']}})[_0xb5a6('0x23')](handleEntityNotFound(_0x718259,null))[_0xb5a6('0x23')](function(_0x13eee2){if(_0x13eee2){_0x338841=_0x13eee2;_0x5c94ee[_0xb5a6('0x43')]=_['keys'](db[_0xb5a6('0xa5')][_0xb5a6('0x3f')]);_0x5c94ee[_0xb5a6('0x45')]=_[_0xb5a6('0x46')](_0x392ce9[_0xb5a6('0x45')]);_0x5c94ee[_0xb5a6('0x4d')]=_[_0xb5a6('0x47')](_0x5c94ee['model'],_0x5c94ee[_0xb5a6('0x45')]);_0x2862f9[_0xb5a6('0x49')]=_[_0xb5a6('0x47')](_0x5c94ee[_0xb5a6('0x43')],qs[_0xb5a6('0x48')](_0x392ce9['query'][_0xb5a6('0x48')]));_0x2862f9[_0xb5a6('0x49')]=_0x2862f9[_0xb5a6('0x49')][_0xb5a6('0x59')]?_0x2862f9['attributes']:_0x5c94ee[_0xb5a6('0x43')];_0x2862f9[_0xb5a6('0xb4')]=qs['sort'](_0x392ce9['query'][_0xb5a6('0x4b')]);_0x2862f9[_0xb5a6('0x4c')]=qs[_0xb5a6('0x4d')](_['pick'](_0x392ce9['query'],_0x5c94ee[_0xb5a6('0x4d')]));if(_0x392ce9[_0xb5a6('0x45')]['filter']){_0x2862f9[_0xb5a6('0x4c')]=_[_0xb5a6('0x4f')](_0x2862f9[_0xb5a6('0x4c')],{'$or':_['map'](_0x2862f9[_0xb5a6('0x49')],function(_0x5e89e8){var _0x2920e9={};_0x2920e9[_0x5e89e8]={'$like':'%'+_0x392ce9[_0xb5a6('0x45')][_0xb5a6('0x50')]+'%'};return _0x2920e9;})});}_0x2862f9=_[_0xb5a6('0x4f')]({},_0x2862f9,_0x392ce9[_0xb5a6('0x51')]);return _0x338841[_0xb5a6('0xdd')](_0x2862f9);}})[_0xb5a6('0x23')](function(_0x36d741){if(_0x36d741){_0x885e30=_0x36d741[_0xb5a6('0x59')];if(!_0x392ce9[_0xb5a6('0x45')][_0xb5a6('0x6b')](_0xb5a6('0x4a'))){_0x2862f9[_0xb5a6('0x30')]=qs['limit'](_0x392ce9[_0xb5a6('0x45')][_0xb5a6('0x30')]);_0x2862f9['offset']=qs[_0xb5a6('0x32')](_0x392ce9[_0xb5a6('0x45')][_0xb5a6('0x32')]);}return _0x338841[_0xb5a6('0xdd')](_0x2862f9);}})[_0xb5a6('0x23')](function(_0x59fb5c){if(_0x59fb5c){return _0x59fb5c?{'count':_0x885e30,'rows':_0x59fb5c}:null;}})['then'](respondWithResult(_0x718259,null))['catch'](handleError(_0x718259,null));}; \ No newline at end of file +var _0xa8d8=['Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','messageId','skebby','sender','connectel','message_id','Text','MessageUUID','results','text','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','Contacts','list','omit','defaults','contact','SmsInteraction','interaction','created','autoclose','close','unmanaged','SmsMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','entity\x20found','text/xml','send','\x0a','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','User','fullname','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','clicksend','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsAccount.socket','register','jayson/promise','client','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SmsAccount','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','role','get','UserProfileSection','userProfileId','describe','addDisposition','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','SmsAccountId','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication'];(function(_0x4454e7,_0x2e916a){var _0x4c2a56=function(_0x103efc){while(--_0x103efc){_0x4454e7['push'](_0x4454e7['shift']());}};_0x4c2a56(++_0x2e916a);}(_0xa8d8,0x6a));var _0x8a8d=function(_0x59c135,_0x2324ac){_0x59c135=_0x59c135-0x0;var _0x1603eb=_0xa8d8[_0x59c135];return _0x1603eb;};'use strict';var emlformat=require(_0x8a8d('0x0'));var rimraf=require(_0x8a8d('0x1'));var zipdir=require(_0x8a8d('0x2'));var jsonpatch=require(_0x8a8d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a8d('0x4'));var Mustache=require(_0x8a8d('0x5'));var util=require(_0x8a8d('0x6'));var path=require(_0x8a8d('0x7'));var sox=require(_0x8a8d('0x8'));var csv=require(_0x8a8d('0x9'));var ejs=require(_0x8a8d('0xa'));var fs=require('fs');var fs_extra=require(_0x8a8d('0xb'));var _=require(_0x8a8d('0xc'));var squel=require(_0x8a8d('0xd'));var crypto=require(_0x8a8d('0xe'));var jsforce=require(_0x8a8d('0xf'));var deskjs=require(_0x8a8d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a8d('0x11'));var Redis=require(_0x8a8d('0x12'));var authService=require(_0x8a8d('0x13'));var qs=require(_0x8a8d('0x14'));var as=require(_0x8a8d('0x15'));var hardwareService=require(_0x8a8d('0x16'));var logger=require('../../config/logger')(_0x8a8d('0x17'));var utils=require(_0x8a8d('0x18'));var config=require(_0x8a8d('0x19'));var licenseUtil=require(_0x8a8d('0x1a'));var db=require(_0x8a8d('0x1b'))['db'];config[_0x8a8d('0x1c')]=_['defaults'](config['redis'],{'host':_0x8a8d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8a8d('0x1e'))[_0x8a8d('0x1f')](socket);var jayson=require(_0x8a8d('0x20'));var client=jayson[_0x8a8d('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2daf74,_0x5b2439,_0x45fd56,_0x2c13e9){return new BPromise(function(_0x55bf6b,_0x332084){var _0x1ab404=_0x2c13e9||client;return _0x1ab404[_0x8a8d('0x22')](_0x2daf74,_0x45fd56)[_0x8a8d('0x23')](function(_0x4ad5c3){logger['info'](_0x8a8d('0x24'),_0x5b2439,_0x8a8d('0x25'));logger[_0x8a8d('0x26')](_0x8a8d('0x27'),_0x5b2439,_0x8a8d('0x25'),JSON[_0x8a8d('0x28')](_0x4ad5c3));if(_0x4ad5c3[_0x8a8d('0x29')]){if(_0x4ad5c3[_0x8a8d('0x29')][_0x8a8d('0x2a')]===0x1f4){logger[_0x8a8d('0x29')](_0x8a8d('0x24'),_0x5b2439,_0x4ad5c3[_0x8a8d('0x29')][_0x8a8d('0x2b')]);return _0x332084(_0x4ad5c3[_0x8a8d('0x29')][_0x8a8d('0x2b')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x5b2439,_0x4ad5c3[_0x8a8d('0x29')][_0x8a8d('0x2b')]);return _0x55bf6b(_0x4ad5c3[_0x8a8d('0x29')][_0x8a8d('0x2b')]);}else{logger[_0x8a8d('0x2c')](_0x8a8d('0x24'),_0x5b2439,_0x8a8d('0x25'));_0x55bf6b(_0x4ad5c3['result'][_0x8a8d('0x2b')]);}})['catch'](function(_0x54fe09){logger[_0x8a8d('0x29')]('SmsAccount,\x20%s,\x20%s',_0x5b2439,_0x54fe09);_0x332084(_0x54fe09);});});}function respondWithStatusCode(_0x4cd96e,_0x1671cd){_0x1671cd=_0x1671cd||0xcc;return function(_0x5afb0c){if(_0x5afb0c){return _0x4cd96e['sendStatus'](_0x1671cd);}return _0x4cd96e['status'](_0x1671cd)[_0x8a8d('0x2d')]();};}function respondWithResult(_0x1eeea1,_0x98f720){_0x98f720=_0x98f720||0xc8;return function(_0x1486d2){if(_0x1486d2){return _0x1eeea1[_0x8a8d('0x2e')](_0x98f720)[_0x8a8d('0x2f')](_0x1486d2);}};}function respondWithFilteredResult(_0x3f8acd,_0x2e1b00){return function(_0x439f7d){if(_0x439f7d){var _0xb3af95=typeof _0x2e1b00[_0x8a8d('0x30')]===_0x8a8d('0x31')&&typeof _0x2e1b00[_0x8a8d('0x32')]===_0x8a8d('0x31');var _0x1895fb=_0x439f7d[_0x8a8d('0x33')];var _0x50ae0e=_0xb3af95?0x0:_0x2e1b00[_0x8a8d('0x30')];var _0x1d03d0=_0xb3af95?_0x439f7d[_0x8a8d('0x33')]:_0x2e1b00[_0x8a8d('0x30')]+_0x2e1b00[_0x8a8d('0x32')];var _0x50641f;if(_0x1d03d0>=_0x1895fb){_0x1d03d0=_0x1895fb;_0x50641f=0xc8;}else{_0x50641f=0xce;}_0x3f8acd[_0x8a8d('0x2e')](_0x50641f);return _0x3f8acd[_0x8a8d('0x34')]('Content-Range',_0x50ae0e+'-'+_0x1d03d0+'/'+_0x1895fb)['json'](_0x439f7d);}return null;};}function patchUpdates(_0x259cee){return function(_0x4c961f){try{jsonpatch[_0x8a8d('0x35')](_0x4c961f,_0x259cee,!![]);}catch(_0x4c79ba){return BPromise[_0x8a8d('0x36')](_0x4c79ba);}return _0x4c961f[_0x8a8d('0x37')]();};}function saveUpdates(_0x592df9,_0x2df66c){return function(_0x4ac227){if(_0x4ac227){return _0x4ac227[_0x8a8d('0x38')](_0x592df9)[_0x8a8d('0x23')](function(_0x1f7813){return _0x1f7813;});}return null;};}function removeEntity(_0x172375,_0x11c3b6){return function(_0x37285e){if(_0x37285e){return _0x37285e[_0x8a8d('0x39')]()['then'](function(){var _0x32ecdc=_0x37285e['get']({'plain':!![]});var _0x5d88d8=_0x8a8d('0x3a');return db[_0x8a8d('0x3b')][_0x8a8d('0x39')]({'where':{'type':_0x5d88d8,'resourceId':_0x32ecdc['id']}})[_0x8a8d('0x23')](function(){return _0x37285e;});})['then'](function(){_0x172375[_0x8a8d('0x2e')](0xcc)[_0x8a8d('0x2d')]();});}};}function handleEntityNotFound(_0x22e60d,_0x4226ce){return function(_0x35514d){if(!_0x35514d){_0x22e60d['sendStatus'](0x194);}return _0x35514d;};}function handleError(_0x548c77,_0x2bb11d){_0x2bb11d=_0x2bb11d||0x1f4;return function(_0xe43f25){logger[_0x8a8d('0x29')](_0xe43f25[_0x8a8d('0x3c')]);if(_0xe43f25[_0x8a8d('0x3d')]){delete _0xe43f25[_0x8a8d('0x3d')];}_0x548c77['status'](_0x2bb11d)['send'](_0xe43f25);};}exports[_0x8a8d('0x3e')]=function(_0x4e0769,_0x1385e9){var _0x320c9b={'include':[{'model':db[_0x8a8d('0x3f')],'as':_0x8a8d('0x40')}]},_0x3627f1={},_0x2e8976={'count':0x0,'rows':[]};var _0x37f7fd=_[_0x8a8d('0x41')](db['SmsAccount']['rawAttributes'],function(_0x28e274){return{'name':_0x28e274[_0x8a8d('0x42')],'type':_0x28e274[_0x8a8d('0x43')][_0x8a8d('0x44')]};});_0x3627f1['model']=_[_0x8a8d('0x41')](_0x37f7fd,_0x8a8d('0x3d'));_0x3627f1[_0x8a8d('0x45')]=_[_0x8a8d('0x46')](_0x4e0769[_0x8a8d('0x45')]);_0x3627f1[_0x8a8d('0x47')]=_[_0x8a8d('0x48')](_0x3627f1[_0x8a8d('0x49')],_0x3627f1[_0x8a8d('0x45')]);_0x320c9b[_0x8a8d('0x4a')]=_[_0x8a8d('0x48')](_0x3627f1[_0x8a8d('0x49')],qs[_0x8a8d('0x4b')](_0x4e0769[_0x8a8d('0x45')][_0x8a8d('0x4b')]));_0x320c9b[_0x8a8d('0x4a')]=_0x320c9b['attributes'][_0x8a8d('0x4c')]?_0x320c9b[_0x8a8d('0x4a')]:_0x3627f1[_0x8a8d('0x49')];if(!_0x4e0769[_0x8a8d('0x45')][_0x8a8d('0x4d')](_0x8a8d('0x4e'))){_0x320c9b['limit']=qs['limit'](_0x4e0769[_0x8a8d('0x45')][_0x8a8d('0x32')]);_0x320c9b['offset']=qs['offset'](_0x4e0769[_0x8a8d('0x45')][_0x8a8d('0x30')]);}_0x320c9b[_0x8a8d('0x4f')]=qs[_0x8a8d('0x50')](_0x4e0769['query'][_0x8a8d('0x50')]);_0x320c9b[_0x8a8d('0x51')]=qs[_0x8a8d('0x47')](_[_0x8a8d('0x52')](_0x4e0769[_0x8a8d('0x45')],_0x3627f1[_0x8a8d('0x47')]),_0x37f7fd);if(_0x4e0769[_0x8a8d('0x45')][_0x8a8d('0x53')]){_0x320c9b[_0x8a8d('0x51')]=_[_0x8a8d('0x54')](_0x320c9b['where'],{'$or':_[_0x8a8d('0x41')](_0x37f7fd,function(_0xbea6a){if(_0xbea6a[_0x8a8d('0x43')]!=='VIRTUAL'){var _0x2f6d0f={};_0x2f6d0f[_0xbea6a[_0x8a8d('0x3d')]]={'$like':'%'+_0x4e0769[_0x8a8d('0x45')]['filter']+'%'};return _0x2f6d0f;}})});}_0x320c9b=_[_0x8a8d('0x54')]({},_0x320c9b,_0x4e0769[_0x8a8d('0x55')]);var _0x5c2393={'where':_0x320c9b[_0x8a8d('0x51')]};return db[_0x8a8d('0x56')][_0x8a8d('0x33')](_0x5c2393)[_0x8a8d('0x23')](function(_0x3a8017){_0x2e8976[_0x8a8d('0x33')]=_0x3a8017;if(_0x4e0769[_0x8a8d('0x45')]['includeAll']){_0x320c9b[_0x8a8d('0x57')]=[{'all':!![]}];}return db[_0x8a8d('0x56')]['findAll'](_0x320c9b);})[_0x8a8d('0x23')](function(_0x7bcff6){_0x2e8976[_0x8a8d('0x58')]=_0x7bcff6;return _0x2e8976;})[_0x8a8d('0x23')](respondWithFilteredResult(_0x1385e9,_0x320c9b))['catch'](handleError(_0x1385e9,null));};exports[_0x8a8d('0x59')]=function(_0x10cb28,_0xf38189){var _0x454207={'raw':![],'where':{'id':_0x10cb28[_0x8a8d('0x5a')]['id']},'include':[{'model':db[_0x8a8d('0x3f')],'as':_0x8a8d('0x40')}]},_0xe26fb8={};_0xe26fb8[_0x8a8d('0x49')]=_[_0x8a8d('0x46')](db['SmsAccount'][_0x8a8d('0x5b')]);_0xe26fb8[_0x8a8d('0x45')]=_[_0x8a8d('0x46')](_0x10cb28['query']);_0xe26fb8['filters']=_['intersection'](_0xe26fb8[_0x8a8d('0x49')],_0xe26fb8[_0x8a8d('0x45')]);_0x454207[_0x8a8d('0x4a')]=_[_0x8a8d('0x48')](_0xe26fb8[_0x8a8d('0x49')],qs[_0x8a8d('0x4b')](_0x10cb28[_0x8a8d('0x45')][_0x8a8d('0x4b')]));_0x454207[_0x8a8d('0x4a')]=_0x454207['attributes'][_0x8a8d('0x4c')]?_0x454207[_0x8a8d('0x4a')]:_0xe26fb8[_0x8a8d('0x49')];if(_0x10cb28[_0x8a8d('0x45')][_0x8a8d('0x5c')]){_0x454207['include']=[{'all':!![]}];}_0x454207=_['merge']({},_0x454207,_0x10cb28['options']);return db[_0x8a8d('0x56')][_0x8a8d('0x5d')](_0x454207)[_0x8a8d('0x23')](handleEntityNotFound(_0xf38189,null))[_0x8a8d('0x23')](respondWithResult(_0xf38189,null))[_0x8a8d('0x5e')](handleError(_0xf38189,null));};exports[_0x8a8d('0x5f')]=function(_0x129328,_0x149d74){return db['SmsAccount'][_0x8a8d('0x5f')](_0x129328[_0x8a8d('0x60')],{})[_0x8a8d('0x23')](function(_0x34a887){var _0x43398a=_0x129328[_0x8a8d('0x61')]['get']({'plain':!![]});if(!_0x43398a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43398a[_0x8a8d('0x62')]===_0x8a8d('0x61')){var _0x31aeb6=_0x34a887[_0x8a8d('0x63')]({'plain':!![]});var _0x39f5dc=_0x8a8d('0x3a');return db[_0x8a8d('0x64')][_0x8a8d('0x5d')]({'where':{'name':_0x39f5dc,'userProfileId':_0x43398a[_0x8a8d('0x65')]},'raw':!![]})[_0x8a8d('0x23')](function(_0x5318b7){if(_0x5318b7&&_0x5318b7['autoAssociation']===0x0){return db[_0x8a8d('0x3b')][_0x8a8d('0x5f')]({'name':_0x31aeb6[_0x8a8d('0x3d')],'resourceId':_0x31aeb6['id'],'type':_0x5318b7[_0x8a8d('0x3d')],'sectionId':_0x5318b7['id']},{})[_0x8a8d('0x23')](function(){return _0x34a887;});}else{return _0x34a887;}})['catch'](function(_0x1a00ab){logger[_0x8a8d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a00ab);throw _0x1a00ab;});}return _0x34a887;})[_0x8a8d('0x23')](respondWithResult(_0x149d74,0xc9))[_0x8a8d('0x5e')](handleError(_0x149d74,null));};exports[_0x8a8d('0x38')]=function(_0x2b6ee5,_0x30811){if(_0x2b6ee5[_0x8a8d('0x60')]['id']){delete _0x2b6ee5[_0x8a8d('0x60')]['id'];}return db['SmsAccount'][_0x8a8d('0x5d')]({'where':{'id':_0x2b6ee5['params']['id']},'include':[{'model':db[_0x8a8d('0x3f')],'as':_0x8a8d('0x40')}]})['then'](handleEntityNotFound(_0x30811,null))[_0x8a8d('0x23')](saveUpdates(_0x2b6ee5[_0x8a8d('0x60')],null))[_0x8a8d('0x23')](respondWithResult(_0x30811,null))[_0x8a8d('0x5e')](handleError(_0x30811,null));};exports[_0x8a8d('0x39')]=function(_0x378125,_0x4aee3c){return db[_0x8a8d('0x56')]['find']({'where':{'id':_0x378125[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x4aee3c,null))[_0x8a8d('0x23')](removeEntity(_0x4aee3c,null))['catch'](handleError(_0x4aee3c,null));};exports[_0x8a8d('0x66')]=function(_0x3f045d,_0x46995f){return db[_0x8a8d('0x56')][_0x8a8d('0x66')]()[_0x8a8d('0x23')](respondWithResult(_0x46995f,null))[_0x8a8d('0x5e')](handleError(_0x46995f,null));};exports[_0x8a8d('0x67')]=function(_0x30662e,_0x2aeeea,_0x563787){if(_0x30662e['body']['id']){delete _0x30662e[_0x8a8d('0x60')]['id'];}return db[_0x8a8d('0x56')][_0x8a8d('0x5d')]({'where':{'id':_0x30662e[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x2aeeea,null))[_0x8a8d('0x23')](function(_0x3366d6){if(_0x3366d6){_0x30662e[_0x8a8d('0x60')]['SmsAccountId']=_0x3366d6['id'];return db[_0x8a8d('0x68')]['create'](_0x30662e[_0x8a8d('0x60')]);}})[_0x8a8d('0x23')](respondWithResult(_0x2aeeea,null))[_0x8a8d('0x5e')](handleError(_0x2aeeea,null));};exports[_0x8a8d('0x69')]=function(_0x146e03,_0x2d85bd,_0x570f22){var _0x234d14={'raw':![],'where':{}};var _0x561e5a={};var _0x45ee4f={'count':0x0,'rows':[]};return db[_0x8a8d('0x56')][_0x8a8d('0x6a')]({'where':{'id':_0x146e03['params']['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x2d85bd,null))['then'](function(_0x214a40){if(_0x214a40){_0x561e5a[_0x8a8d('0x49')]=_[_0x8a8d('0x46')](db[_0x8a8d('0x68')][_0x8a8d('0x5b')]);_0x561e5a['query']=_[_0x8a8d('0x46')](_0x146e03['query']);_0x561e5a['filters']=_['intersection'](_0x561e5a[_0x8a8d('0x49')],_0x561e5a[_0x8a8d('0x45')]);_0x234d14['attributes']=_[_0x8a8d('0x48')](_0x561e5a[_0x8a8d('0x49')],qs['fields'](_0x146e03[_0x8a8d('0x45')][_0x8a8d('0x4b')]));_0x234d14[_0x8a8d('0x4a')]=_0x234d14[_0x8a8d('0x4a')][_0x8a8d('0x4c')]?_0x234d14[_0x8a8d('0x4a')]:_0x561e5a[_0x8a8d('0x49')];if(!_0x146e03[_0x8a8d('0x45')][_0x8a8d('0x4d')]('nolimit')){_0x234d14[_0x8a8d('0x32')]=qs[_0x8a8d('0x32')](_0x146e03[_0x8a8d('0x45')][_0x8a8d('0x32')]);_0x234d14['offset']=qs[_0x8a8d('0x30')](_0x146e03[_0x8a8d('0x45')]['offset']);}_0x234d14[_0x8a8d('0x4f')]=qs[_0x8a8d('0x50')](_0x146e03['query'][_0x8a8d('0x50')]);_0x234d14['where']=qs[_0x8a8d('0x47')](_['pick'](_0x146e03[_0x8a8d('0x45')],_0x561e5a[_0x8a8d('0x47')]));_0x234d14[_0x8a8d('0x51')]['SmsAccountId']=_0x214a40['id'];if(_0x146e03['query'][_0x8a8d('0x53')]){_0x234d14[_0x8a8d('0x51')]=_[_0x8a8d('0x54')](_0x234d14[_0x8a8d('0x51')],{'$or':_[_0x8a8d('0x41')](_0x234d14[_0x8a8d('0x4a')],function(_0x30315c){var _0x390dfd={};_0x390dfd[_0x30315c]={'$like':'%'+_0x146e03[_0x8a8d('0x45')][_0x8a8d('0x53')]+'%'};return _0x390dfd;})});}_0x234d14=_['merge']({},_0x234d14,_0x146e03['options']);return db[_0x8a8d('0x68')]['count']({'where':_0x234d14['where']})[_0x8a8d('0x23')](function(_0x5c2f67){_0x45ee4f[_0x8a8d('0x33')]=_0x5c2f67;if(_0x146e03[_0x8a8d('0x45')][_0x8a8d('0x5c')]){_0x234d14[_0x8a8d('0x57')]=[{'all':!![]}];}return db[_0x8a8d('0x68')][_0x8a8d('0x6b')](_0x234d14);})[_0x8a8d('0x23')](function(_0x275b66){_0x45ee4f[_0x8a8d('0x58')]=_0x275b66;return _0x45ee4f;});}})[_0x8a8d('0x23')](respondWithFilteredResult(_0x2d85bd,_0x234d14))[_0x8a8d('0x5e')](handleError(_0x2d85bd,null));};exports[_0x8a8d('0x6c')]=function(_0x17a69c,_0x14eed4,_0x242bc8){return db[_0x8a8d('0x56')][_0x8a8d('0x5d')]({'where':{'id':_0x17a69c[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x14eed4,null))[_0x8a8d('0x23')](function(_0x11eac4){if(_0x11eac4){return _0x11eac4[_0x8a8d('0x6c')](_0x17a69c[_0x8a8d('0x45')][_0x8a8d('0x6d')]);}})[_0x8a8d('0x23')](respondWithStatusCode(_0x14eed4,null))['catch'](handleError(_0x14eed4,null));};exports[_0x8a8d('0x6e')]=function(_0x2f0246,_0x5eaf9b,_0x40c251){if(_0x2f0246[_0x8a8d('0x60')]['id']){delete _0x2f0246[_0x8a8d('0x60')]['id'];}return db[_0x8a8d('0x56')][_0x8a8d('0x5d')]({'where':{'id':_0x2f0246[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x5eaf9b,null))[_0x8a8d('0x23')](function(_0x447fc8){if(_0x447fc8){_0x2f0246[_0x8a8d('0x60')][_0x8a8d('0x6f')]=_0x447fc8['id'];return db['CannedAnswer']['create'](_0x2f0246[_0x8a8d('0x60')]);}})['then'](respondWithResult(_0x5eaf9b,null))[_0x8a8d('0x5e')](handleError(_0x5eaf9b,null));};exports[_0x8a8d('0x70')]=function(_0x277cec,_0x3705c1,_0x15b4d9){var _0x1b663c={'raw':![],'where':{}};var _0x4938fc={};var _0x53bc21={'count':0x0,'rows':[]};return db[_0x8a8d('0x56')][_0x8a8d('0x6a')]({'where':{'id':_0x277cec['params']['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x3705c1,null))['then'](function(_0x26aaf3){if(_0x26aaf3){_0x4938fc[_0x8a8d('0x49')]=_[_0x8a8d('0x46')](db[_0x8a8d('0x71')][_0x8a8d('0x5b')]);_0x4938fc[_0x8a8d('0x45')]=_[_0x8a8d('0x46')](_0x277cec[_0x8a8d('0x45')]);_0x4938fc[_0x8a8d('0x47')]=_[_0x8a8d('0x48')](_0x4938fc[_0x8a8d('0x49')],_0x4938fc[_0x8a8d('0x45')]);_0x1b663c['attributes']=_[_0x8a8d('0x48')](_0x4938fc[_0x8a8d('0x49')],qs[_0x8a8d('0x4b')](_0x277cec['query'][_0x8a8d('0x4b')]));_0x1b663c['attributes']=_0x1b663c[_0x8a8d('0x4a')][_0x8a8d('0x4c')]?_0x1b663c[_0x8a8d('0x4a')]:_0x4938fc['model'];if(!_0x277cec[_0x8a8d('0x45')]['hasOwnProperty'](_0x8a8d('0x4e'))){_0x1b663c[_0x8a8d('0x32')]=qs[_0x8a8d('0x32')](_0x277cec[_0x8a8d('0x45')]['limit']);_0x1b663c[_0x8a8d('0x30')]=qs[_0x8a8d('0x30')](_0x277cec['query']['offset']);}_0x1b663c['order']=qs[_0x8a8d('0x50')](_0x277cec[_0x8a8d('0x45')][_0x8a8d('0x50')]);_0x1b663c[_0x8a8d('0x51')]=qs[_0x8a8d('0x47')](_[_0x8a8d('0x52')](_0x277cec[_0x8a8d('0x45')],_0x4938fc[_0x8a8d('0x47')]));_0x1b663c[_0x8a8d('0x51')]['SmsAccountId']=_0x26aaf3['id'];if(_0x277cec[_0x8a8d('0x45')][_0x8a8d('0x53')]){_0x1b663c['where']=_[_0x8a8d('0x54')](_0x1b663c['where'],{'$or':_[_0x8a8d('0x41')](_0x1b663c[_0x8a8d('0x4a')],function(_0x3fe276){var _0x4fb454={};_0x4fb454[_0x3fe276]={'$like':'%'+_0x277cec[_0x8a8d('0x45')][_0x8a8d('0x53')]+'%'};return _0x4fb454;})});}_0x1b663c=_[_0x8a8d('0x54')]({},_0x1b663c,_0x277cec[_0x8a8d('0x55')]);return db['CannedAnswer'][_0x8a8d('0x33')]({'where':_0x1b663c['where']})[_0x8a8d('0x23')](function(_0x4f11dd){_0x53bc21[_0x8a8d('0x33')]=_0x4f11dd;if(_0x277cec['query'][_0x8a8d('0x5c')]){_0x1b663c[_0x8a8d('0x57')]=[{'all':!![]}];}return db[_0x8a8d('0x71')][_0x8a8d('0x6b')](_0x1b663c);})[_0x8a8d('0x23')](function(_0x388930){_0x53bc21[_0x8a8d('0x58')]=_0x388930;return _0x53bc21;});}})[_0x8a8d('0x23')](respondWithFilteredResult(_0x3705c1,_0x1b663c))[_0x8a8d('0x5e')](handleError(_0x3705c1,null));};exports[_0x8a8d('0x72')]=function(_0x311b2d,_0x2950c9,_0x170320){return db[_0x8a8d('0x56')][_0x8a8d('0x5d')]({'where':{'id':_0x311b2d[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x2950c9,null))['then'](function(_0x4d01ef){if(_0x4d01ef){return _0x4d01ef[_0x8a8d('0x72')](_0x311b2d[_0x8a8d('0x45')][_0x8a8d('0x6d')]);}})[_0x8a8d('0x23')](respondWithStatusCode(_0x2950c9,null))[_0x8a8d('0x5e')](handleError(_0x2950c9,null));};exports[_0x8a8d('0x73')]=function(_0x3b1202,_0x3b2a02,_0x56c448){var _0xf9e39c={'channel':_0x8a8d('0x74')};var _0x52c0a7=[];var _0x13997e=[];var _0x3817d5={};return db[_0x8a8d('0x56')][_0x8a8d('0x5d')]({'where':{'id':_0x3b1202[_0x8a8d('0x5a')]['id']},'include':[{'model':db[_0x8a8d('0x75')],'as':_0x8a8d('0x76')}]})[_0x8a8d('0x23')](handleEntityNotFound(_0x3b2a02,null))['then'](function(_0x396e81){_0xf9e39c[_0x8a8d('0x77')]=_0x396e81;_0xf9e39c[_0x8a8d('0x78')]=_[_0x8a8d('0x79')](_0x396e81[_0x8a8d('0x76')],[_0x8a8d('0x7a')],[_0x8a8d('0x7b')]);if(_0xf9e39c[_0x8a8d('0x77')]['Applications']){delete _0xf9e39c[_0x8a8d('0x77')]['Applications'];}return db[_0x8a8d('0x7c')][_0x8a8d('0x66')]();})[_0x8a8d('0x23')](function(_0x45d2a0){if(!_0x45d2a0){throw new db[(_0x8a8d('0x7d'))][(_0x8a8d('0x7e'))](_0x8a8d('0x7f'));}_0x52c0a7=_[_0x8a8d('0x80')](_[_0x8a8d('0x46')](_0x45d2a0),[_0x8a8d('0x81'),_0x8a8d('0x82')]);_0x13997e=_[_0x8a8d('0x80')](_[_0x8a8d('0x46')](_0x45d2a0),[_0x8a8d('0x81'),'updatedAt',_0x8a8d('0x83'),'ListId']);_0xf9e39c[_0x8a8d('0x60')]={'mapKey':_0x8a8d('0x84')};if(_0xf9e39c[_0x8a8d('0x77')]['type']){switch(_0xf9e39c[_0x8a8d('0x77')][_0x8a8d('0x43')]){case _0x8a8d('0x85'):_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x87')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]=_0x3b1202['body']['Body'];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x88')]=_0x3b1202[_0x8a8d('0x60')]['MessageSid'];break;case _0x8a8d('0x89'):_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')]='+'+_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x8a')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]=_0x3b1202['body']['text'];break;case _0x8a8d('0x8b'):_0xf9e39c[_0x8a8d('0x60')]['from']=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x86')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x2b')];break;case'clicksend':_0xf9e39c['body'][_0x8a8d('0x86')]=_0x3b1202['body'][_0x8a8d('0x86')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]=_0x3b1202['body'][_0x8a8d('0x60')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x88')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x8c')];break;case'plivo':_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x87')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]=_0x3b1202['body'][_0x8a8d('0x8d')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x88')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x8e')];break;case'infobip':_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')]='+'+_0x3b1202[_0x8a8d('0x60')]['results'][0x0][_0x8a8d('0x86')];_0xf9e39c[_0x8a8d('0x60')]['body']=_0x3b1202['body'][_0x8a8d('0x8f')][0x0][_0x8a8d('0x90')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x88')]=_0x3b1202[_0x8a8d('0x60')]['results'][0x0][_0x8a8d('0x88')];break;case _0x8a8d('0x91'):_0xf9e39c['body'][_0x8a8d('0x86')]=_0x3b1202['body'][_0x8a8d('0x92')];_0xf9e39c['body'][_0x8a8d('0x60')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x93')][_0x8a8d('0x2b')];break;case _0x8a8d('0x94'):_0xf9e39c['body'][_0x8a8d('0x86')]=_0x3b1202[_0x8a8d('0x60')]['fromNumber'];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]=_0x3b1202[_0x8a8d('0x60')]['text'];_0xf9e39c['body']['messageId']=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x95')];break;case _0x8a8d('0x96'):_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x88')]=_0x3b1202[_0x8a8d('0x60')][0x0]['message']['id'];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')]=_0x3b1202[_0x8a8d('0x60')][0x0][_0x8a8d('0x2b')][_0x8a8d('0x86')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]=_0x3b1202[_0x8a8d('0x60')][0x0]['message'][_0x8a8d('0x90')];break;case _0x8a8d('0x97'):_0xf9e39c['body'][_0x8a8d('0x86')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x86')];_0xf9e39c['body'][_0x8a8d('0x60')]=_0x3b1202['body'][_0x8a8d('0x2b')];_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x88')]=_0x3b1202[_0x8a8d('0x60')][_0x8a8d('0x98')];break;}}if(_0xf9e39c[_0x8a8d('0x60')]['id']){delete _0xf9e39c[_0x8a8d('0x60')]['id'];}if(_[_0x8a8d('0x99')](_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')])){throw new db[(_0x8a8d('0x7d'))][(_0x8a8d('0x7e'))](_0x8a8d('0x9a'));}if(_['isNil'](_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')])||_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xf9e39c['body']['mapKey'])){throw new db['Sequelize'][(_0x8a8d('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13997e);}if(!_['includes'](_0x13997e,_0xf9e39c[_0x8a8d('0x60')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x8a8d('0x9b')+_0x13997e);}_0x3817d5[_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x9c')]]=_0xf9e39c[_0x8a8d('0x60')]['from'];return db[_0x8a8d('0x9d')][_0x8a8d('0x5d')]({'where':{'id':_0xf9e39c[_0x8a8d('0x77')][_0x8a8d('0x9e')]},'include':[{'model':db[_0x8a8d('0x7c')],'as':_0x8a8d('0x9f'),'where':_0x3817d5,'limit':0x1,'order':[[_0x8a8d('0x82'),'DESC']]}]});})['then'](handleEntityNotFound(_0x3b2a02,null))['then'](function(_0x3d3542){if(_0x3d3542){_0xf9e39c[_0x8a8d('0xa0')]=_[_0x8a8d('0xa1')](_0x3d3542,[_0x8a8d('0x9f')]);if(_0x3d3542[_0x8a8d('0x9f')]['length']){return _0x3d3542[_0x8a8d('0x9f')][0x0];}var _0x2d0809=_[_0x8a8d('0xa2')](_0xf9e39c[_0x8a8d('0x60')],{'firstName':_0xf9e39c[_0x8a8d('0x60')]['from'],'ListId':_0x3d3542['id']});_0x2d0809[_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x9c')]]=_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')];return db[_0x8a8d('0x7c')]['create'](_0x2d0809,{'fields':_0x52c0a7,'raw':!![]});}})[_0x8a8d('0x23')](handleEntityNotFound(_0x3b2a02,null))[_0x8a8d('0x23')](function(_0x46d975){if(_0x46d975){_0xf9e39c[_0x8a8d('0xa3')]=_0x46d975;var _0x2b0c83={'ContactId':_0x46d975['id'],'phone':_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')],'SmsAccountId':_0x3b1202[_0x8a8d('0x5a')]['id']};var _0x12275e={'ContactId':_0x46d975['id'],'SmsAccountId':_0x3b1202[_0x8a8d('0x5a')]['id'],'closed':![]};return db[_0x8a8d('0xa4')]['find']({'where':_0x12275e})['then'](function(_0xac84ba){if(_0xac84ba){return[_0xac84ba,![]];}return db[_0x8a8d('0xa4')][_0x8a8d('0x5f')](_0x2b0c83)[_0x8a8d('0x23')](function(_0x1af805){return[_0x1af805,!![]];});});}})['spread'](function(_0x31b510,_0x5f4bed){_0xf9e39c[_0x8a8d('0xa5')]=_0x31b510['get']({'plain':!![]});_0xf9e39c[_0x8a8d('0xa5')][_0x8a8d('0xa6')]=![];if(_0x5f4bed){if(_0xf9e39c['account'][_0x8a8d('0xa7')]){_0xf9e39c['applications']['push']({'id':0x0,'priority':_0xf9e39c['applications'][_0x8a8d('0x4c')]+0x1,'app':_0x8a8d('0xa8'),'appdata':_0x8a8d('0xa9'),'interval':'*,*,*,*'});}_0xf9e39c[_0x8a8d('0xa5')][_0x8a8d('0xa6')]=!![];}return db[_0x8a8d('0xaa')][_0x8a8d('0x5f')]({'phone':_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x86')],'messageId':_0xf9e39c[_0x8a8d('0x60')]['messageId'],'body':_0xf9e39c[_0x8a8d('0x60')][_0x8a8d('0x60')],'SmsAccountId':_0x3b1202[_0x8a8d('0x5a')]['id'],'SmsInteractionId':_0x31b510['id'],'direction':'in','ContactId':_0x31b510[_0x8a8d('0xab')],'AttachmentId':_0xf9e39c[_0x8a8d('0x60')]['AttachmentId']});})[_0x8a8d('0x23')](function(_0x421004){_0xf9e39c[_0x8a8d('0x2b')]=_0x421004;if(_0xf9e39c['interaction'][_0x8a8d('0xac')]){return db['User']['find']({'attributes':['id',_0x8a8d('0x3d')],'where':{'id':_0xf9e39c[_0x8a8d('0xa5')][_0x8a8d('0xac')]}})[_0x8a8d('0x23')](function(_0x211c9b){if(_0x211c9b){_0xf9e39c[_0x8a8d('0x78')][_0x8a8d('0xad')]({'id':0x0,'priority':0x0,'app':_0x8a8d('0xae'),'appdata':_0x211c9b[_0x8a8d('0x3d')]+','+(_0xf9e39c['account'][_0x8a8d('0xaf')]||0xa),'interval':_0x8a8d('0xb0')});}return respondWithRpcPromise(_0x8a8d('0xb1'),'startRouting',_0xf9e39c);});}return respondWithRpcPromise(_0x8a8d('0xb1'),'startRouting',_0xf9e39c);})['then'](function(_0x637905){if(_0x637905){var _0x1f1da3=0xc8;var _0x2d70bd='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d70bd,_0x1f1da3,_0x8a8d('0xb2'));logger[_0x8a8d('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2d70bd,_0x1f1da3,_0x8a8d('0xb2'),JSON[_0x8a8d('0x28')](_0x637905));if(_0xf9e39c[_0x8a8d('0x77')][_0x8a8d('0x43')]===_0x8a8d('0x85')){return _0x3b2a02['status'](_0x1f1da3)[_0x8a8d('0x34')]('Content-Type',_0x8a8d('0xb3'))[_0x8a8d('0xb4')](_0x8a8d('0xb5'));}else{return _0x3b2a02[_0x8a8d('0x2e')](_0x1f1da3)[_0x8a8d('0x2f')](_0x637905);}}})[_0x8a8d('0x5e')](handleError(_0x3b2a02,null));};exports[_0x8a8d('0xb6')]=function(_0x5a7e75,_0xe9a8cc,_0x5af7ab){return db['SmsAccount'][_0x8a8d('0x6a')]({'where':{'id':_0x5a7e75[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0xe9a8cc,null))[_0x8a8d('0x23')](function(_0x4cdb37){if(_0x4cdb37){return db[_0x8a8d('0xb7')][_0x8a8d('0xb8')](function(_0xe677db){return db[_0x8a8d('0x75')][_0x8a8d('0x39')]({'where':{'SmsAccountId':_0x5a7e75[_0x8a8d('0x5a')]['id']},'transaction':_0xe677db})[_0x8a8d('0x23')](function(_0x38ca8b){var _0x194bd6=_[_0x8a8d('0x41')](_0x5a7e75[_0x8a8d('0x60')],function(_0x419057){_0x419057[_0x8a8d('0x6f')]=_0x5a7e75[_0x8a8d('0x5a')]['id'];return _0x419057;});return db[_0x8a8d('0x75')]['bulkCreate'](_0x194bd6,{'transaction':_0xe677db});});})[_0x8a8d('0x23')](function(){return db[_0x8a8d('0x75')][_0x8a8d('0xb9')]({'where':{'SmsAccountId':_0x5a7e75[_0x8a8d('0x5a')]['id']},'order':_0x8a8d('0x7a')});});}})[_0x8a8d('0x23')](respondWithResult(_0xe9a8cc,null))[_0x8a8d('0x5e')](handleError(_0xe9a8cc,null));};exports[_0x8a8d('0xba')]=function(_0x48d3b6,_0xa3cf3a,_0x1c6dc3){var _0x36108d={};var _0x15acff={};var _0x5371a2;var _0x4bc66a;return db[_0x8a8d('0x56')][_0x8a8d('0x6a')]({'where':{'id':_0x48d3b6[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0xa3cf3a,null))[_0x8a8d('0x23')](function(_0x7c1c1b){if(_0x7c1c1b){_0x5371a2=_0x7c1c1b;_0x15acff['model']=_['keys'](db[_0x8a8d('0x75')][_0x8a8d('0x5b')]);_0x15acff[_0x8a8d('0x45')]=_['keys'](_0x48d3b6[_0x8a8d('0x45')]);_0x15acff[_0x8a8d('0x47')]=_[_0x8a8d('0x48')](_0x15acff['model'],_0x15acff[_0x8a8d('0x45')]);_0x36108d[_0x8a8d('0x4a')]=_['intersection'](_0x15acff[_0x8a8d('0x49')],qs[_0x8a8d('0x4b')](_0x48d3b6[_0x8a8d('0x45')][_0x8a8d('0x4b')]));_0x36108d[_0x8a8d('0x4a')]=_0x36108d[_0x8a8d('0x4a')][_0x8a8d('0x4c')]?_0x36108d[_0x8a8d('0x4a')]:_0x15acff[_0x8a8d('0x49')];_0x36108d[_0x8a8d('0x4f')]=qs[_0x8a8d('0x50')](_0x48d3b6[_0x8a8d('0x45')][_0x8a8d('0x50')]);_0x36108d[_0x8a8d('0x51')]=qs[_0x8a8d('0x47')](_['pick'](_0x48d3b6[_0x8a8d('0x45')],_0x15acff[_0x8a8d('0x47')]));if(_0x48d3b6['query'][_0x8a8d('0x53')]){_0x36108d[_0x8a8d('0x51')]=_[_0x8a8d('0x54')](_0x36108d[_0x8a8d('0x51')],{'$or':_['map'](_0x36108d[_0x8a8d('0x4a')],function(_0x3b9e2a){var _0x5e1047={};_0x5e1047[_0x3b9e2a]={'$like':'%'+_0x48d3b6[_0x8a8d('0x45')][_0x8a8d('0x53')]+'%'};return _0x5e1047;})});}_0x36108d=_[_0x8a8d('0x54')]({},_0x36108d,_0x48d3b6[_0x8a8d('0x55')]);return _0x5371a2[_0x8a8d('0xba')](_0x36108d);}})[_0x8a8d('0x23')](function(_0x2b11ee){if(_0x2b11ee){_0x4bc66a=_0x2b11ee[_0x8a8d('0x4c')];if(!_0x48d3b6['query'][_0x8a8d('0x4d')](_0x8a8d('0x4e'))){_0x36108d[_0x8a8d('0x32')]=qs[_0x8a8d('0x32')](_0x48d3b6['query'][_0x8a8d('0x32')]);_0x36108d[_0x8a8d('0x30')]=qs[_0x8a8d('0x30')](_0x48d3b6[_0x8a8d('0x45')][_0x8a8d('0x30')]);}return _0x5371a2[_0x8a8d('0xba')](_0x36108d);}})[_0x8a8d('0x23')](function(_0x36a68b){if(_0x36a68b){return _0x36a68b?{'count':_0x4bc66a,'rows':_0x36a68b}:null;}})[_0x8a8d('0x23')](respondWithResult(_0xa3cf3a,null))[_0x8a8d('0x5e')](handleError(_0xa3cf3a,null));};exports[_0x8a8d('0xbb')]=function(_0x26b257,_0x42ad7d,_0x21c28a){var _0x366a18={'raw':![],'where':{}};var _0x16445d={};var _0xbc59a4={'count':0x0,'rows':[]};return db[_0x8a8d('0x56')][_0x8a8d('0x6a')]({'where':{'id':_0x26b257[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x42ad7d,null))[_0x8a8d('0x23')](function(_0x228083){if(_0x228083){_0x16445d['model']=_[_0x8a8d('0x46')](db[_0x8a8d('0xa4')]['rawAttributes']);_0x16445d[_0x8a8d('0x45')]=_[_0x8a8d('0x46')](_0x26b257[_0x8a8d('0x45')]);_0x16445d[_0x8a8d('0x47')]=_['intersection'](_0x16445d['model'],_0x16445d[_0x8a8d('0x45')]);_0x366a18['attributes']=_[_0x8a8d('0x48')](_0x16445d[_0x8a8d('0x49')],qs[_0x8a8d('0x4b')](_0x26b257['query'][_0x8a8d('0x4b')]));_0x366a18[_0x8a8d('0x4a')]=_0x366a18[_0x8a8d('0x4a')][_0x8a8d('0x4c')]?_0x366a18[_0x8a8d('0x4a')]:_0x16445d[_0x8a8d('0x49')];if(!_0x26b257[_0x8a8d('0x45')][_0x8a8d('0x4d')]('nolimit')){_0x366a18[_0x8a8d('0x32')]=qs[_0x8a8d('0x32')](_0x26b257[_0x8a8d('0x45')][_0x8a8d('0x32')]);_0x366a18[_0x8a8d('0x30')]=qs[_0x8a8d('0x30')](_0x26b257[_0x8a8d('0x45')][_0x8a8d('0x30')]);}_0x366a18[_0x8a8d('0x4f')]=qs[_0x8a8d('0x50')](_0x26b257[_0x8a8d('0x45')][_0x8a8d('0x50')]);_0x366a18['where']=qs[_0x8a8d('0x47')](_[_0x8a8d('0x52')](_0x26b257[_0x8a8d('0x45')],_0x16445d['filters']));_0x366a18['where'][_0x8a8d('0x6f')]=_0x228083['id'];if(_0x26b257['query'][_0x8a8d('0x53')]){_0x366a18[_0x8a8d('0x51')]=_[_0x8a8d('0x54')](_0x366a18[_0x8a8d('0x51')],{'$or':_['map'](_0x366a18[_0x8a8d('0x4a')],function(_0x3742d9){var _0x1e1950={};_0x1e1950[_0x3742d9]={'$like':'%'+_0x26b257[_0x8a8d('0x45')][_0x8a8d('0x53')]+'%'};return _0x1e1950;})});}_0x366a18=_[_0x8a8d('0x54')]({},_0x366a18,_0x26b257[_0x8a8d('0x55')]);return db[_0x8a8d('0xa4')][_0x8a8d('0x33')]({'where':_0x366a18[_0x8a8d('0x51')]})['then'](function(_0x5aa625){_0xbc59a4[_0x8a8d('0x33')]=_0x5aa625;if(_0x26b257['query']['includeAll']){_0x366a18[_0x8a8d('0x57')]=[{'model':db[_0x8a8d('0x7c')],'as':'Contact','required':![]},{'model':db[_0x8a8d('0xbc')],'as':'Owner','attributes':[_0x8a8d('0x3d'),_0x8a8d('0xbd'),'internal'],'required':![]},{'model':db[_0x8a8d('0xbe')],'as':_0x8a8d('0xbf'),'attributes':['id',_0x8a8d('0x3d'),_0x8a8d('0xc0')],'where':_0x26b257[_0x8a8d('0x45')][_0x8a8d('0xc1')]?{'id':_0x26b257[_0x8a8d('0x45')][_0x8a8d('0xc1')]}:undefined,'required':_0x26b257[_0x8a8d('0x45')][_0x8a8d('0xc1')]?!![]:![]}];}return db[_0x8a8d('0xa4')][_0x8a8d('0x6b')](_0x366a18);})[_0x8a8d('0x23')](function(_0x9d46a9){_0xbc59a4[_0x8a8d('0x58')]=_0x9d46a9;return _0xbc59a4;});}})[_0x8a8d('0x23')](respondWithFilteredResult(_0x42ad7d,_0x366a18))['catch'](handleError(_0x42ad7d,null));};exports[_0x8a8d('0xb4')]=function(_0xdee389,_0xb5dd67,_0x57a3f7){var _0x43e6d8,_0x1fbc58,_0x23cef0;if(_['isNil'](_0xdee389['body'][_0x8a8d('0x60')])||_0xdee389[_0x8a8d('0x60')][_0x8a8d('0x60')]===''){throw new db['Sequelize'][(_0x8a8d('0x7e'))](_0x8a8d('0xc2'));}if(_[_0x8a8d('0x99')](_0xdee389[_0x8a8d('0x60')]['to'])){throw new db[(_0x8a8d('0x7d'))][(_0x8a8d('0x7e'))](_0x8a8d('0xc3'));}_0x43e6d8=_0xdee389['body']['to'];return db[_0x8a8d('0x56')][_0x8a8d('0x5d')]({'where':{'id':_0xdee389[_0x8a8d('0x5a')]['id']},'include':[{'model':db[_0x8a8d('0x9d')],'as':_0x8a8d('0xc4'),'include':[{'model':db[_0x8a8d('0x7c')],'as':_0x8a8d('0x9f'),'where':{'mobile':_0x43e6d8},'limit':0x1,'order':[[_0x8a8d('0x82'),_0x8a8d('0xc5')]]}]}]})['then'](handleEntityNotFound(_0xb5dd67,null))['then'](function(_0xdbdc59){if(_0xdbdc59&&_0xdbdc59[_0x8a8d('0xc4')]){_0x1fbc58=_0xdbdc59[_0x8a8d('0x63')]({'plain':!![]});if(_0x1fbc58[_0x8a8d('0xc4')]&&_0x1fbc58[_0x8a8d('0xc4')][_0x8a8d('0x9f')][_0x8a8d('0x4c')]){return _0x1fbc58[_0x8a8d('0xc4')][_0x8a8d('0x9f')][0x0];}return db[_0x8a8d('0x7c')][_0x8a8d('0x5f')](_[_0x8a8d('0xa2')](_0xdee389[_0x8a8d('0x60')],{'firstName':_0x43e6d8,'mobile':_0x43e6d8,'phone':_0x43e6d8,'ListId':_0x1fbc58[_0x8a8d('0x9e')]}));}})['then'](handleEntityNotFound(_0xb5dd67,null))[_0x8a8d('0x23')](function(_0x5f1ed1){if(_0x5f1ed1){_0x23cef0=_0x5f1ed1;return db[_0x8a8d('0xa4')]['find']({'where':{'ContactId':_0x23cef0['id'],'closed':![],'SmsAccountId':_0x1fbc58['id']}})['then'](function(_0x1ba2f9){if(_0x1ba2f9){return[_0x1ba2f9,![]];}return db[_0x8a8d('0xa4')][_0x8a8d('0x5f')]({'UserId':_0xdee389[_0x8a8d('0x61')]['id'],'ContactId':_0x23cef0['id'],'SmsAccountId':_0x1fbc58['id'],'phone':_0x43e6d8,'firstMsgDirection':'out','Messages':[_[_0x8a8d('0x54')](_0xdee389[_0x8a8d('0x60')],{'read':![],'body':_0xdee389[_0x8a8d('0x60')][_0x8a8d('0x60')],'phone':_0x43e6d8,'SmsAccountId':_0x1fbc58['id'],'UserId':_0xdee389[_0x8a8d('0x61')]['id'],'ContactId':_0x23cef0['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x8a8d('0xc6')}]})[_0x8a8d('0x23')](function(_0x51f19c){return[_0x51f19c,!![]];});});}})[_0x8a8d('0xc7')](function(_0x239ef1,_0x1a1726){if(_0x1a1726){return _0x239ef1;}return db['SmsMessage']['create'](_['merge'](_0xdee389[_0x8a8d('0x60')],{'read':![],'body':_0xdee389[_0x8a8d('0x60')]['body'],'phone':_0x43e6d8,'SmsAccountId':_0x1fbc58['id'],'SmsInteractionId':_0x239ef1['id'],'UserId':_0xdee389['user']['id'],'ContactId':_0x23cef0['id']}))['then'](function(_0x1940a7){_0x239ef1[_0x8a8d('0xc8')]['Messages']=[];_0x239ef1[_0x8a8d('0xc8')][_0x8a8d('0xc6')]['push'](_0x1940a7[_0x8a8d('0xc8')]);return _0x239ef1;});})['then'](respondWithResult(_0xb5dd67,null))[_0x8a8d('0x5e')](handleError(_0xb5dd67,null));};exports[_0x8a8d('0x2e')]=function(_0x5a0830,_0x220092,_0x131999){if(_0x5a0830[_0x8a8d('0x60')]['id']){delete _0x5a0830[_0x8a8d('0x60')]['id'];}var _0x556bf1,_0x360bae,_0x379b61;return db[_0x8a8d('0x56')][_0x8a8d('0x5d')]({'where':{'id':_0x5a0830[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x220092,null))[_0x8a8d('0x23')](function(_0x1dbab8){if(_0x1dbab8){_0x379b61=_0x1dbab8;logger['debug'](_0x8a8d('0x27'),'status',_0x8a8d('0xc9'),_0x1dbab8['type'],util[_0x8a8d('0xca')](_0x5a0830[_0x8a8d('0x60')],{'showHidden':![],'depth':null}));switch(_0x1dbab8[_0x8a8d('0x43')]){case _0x8a8d('0x89'):if(_0x5a0830[_0x8a8d('0x60')]['skebby_dispatch_id']&&_0x5a0830[_0x8a8d('0x60')]['status']){_0x360bae=_0x5a0830[_0x8a8d('0x60')]['status'];return db[_0x8a8d('0xaa')][_0x8a8d('0x5d')]({'where':{'messageId':_0x5a0830[_0x8a8d('0x60')]['skebby_dispatch_id']}});}break;case _0x8a8d('0x8b'):if(_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0xcb')]&&_0x5a0830['body'][_0x8a8d('0xcc')]){_0x360bae=_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0xcc')];return db[_0x8a8d('0xaa')][_0x8a8d('0x5d')]({'where':{'messageId':_0x5a0830['body'][_0x8a8d('0xcb')]}});}break;case'clicksend':if(_0x5a0830['body'][_0x8a8d('0x8c')]&&_0x5a0830['body']['status_code']){_0x360bae=_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0xcd')];return db[_0x8a8d('0xaa')][_0x8a8d('0x5d')]({'where':{'messageId':_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0x8c')]}});}break;case _0x8a8d('0xce'):var _0x233f14=_0x5a0830[_0x8a8d('0x60')]['results'][0x0];if(_0x233f14[_0x8a8d('0x88')]&&_0x233f14[_0x8a8d('0x2e')][_0x8a8d('0xcf')]===_0x8a8d('0xd0')){_0x360bae=_0x233f14[_0x8a8d('0x2e')]['groupName'];return db[_0x8a8d('0xaa')][_0x8a8d('0x5d')]({'where':{'messageId':_0x233f14['messageId']}});}break;case _0x8a8d('0x94'):if(_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0x88')]&&_0x5a0830[_0x8a8d('0x60')]['status']){_0x360bae=_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0x2e')];return db[_0x8a8d('0xaa')][_0x8a8d('0x5d')]({'where':{'messageId':_0x5a0830[_0x8a8d('0x60')]['messageId']}});}break;case _0x8a8d('0x96'):if(_0x5a0830[_0x8a8d('0x60')][0x0][_0x8a8d('0x2b')]['id']){_0x360bae=_0x5a0830['body'][0x0][_0x8a8d('0x43')];return db[_0x8a8d('0xaa')]['find']({'where':{'messageId':_0x5a0830[_0x8a8d('0x60')][0x0][_0x8a8d('0x2b')]['id']}});}break;case _0x8a8d('0x97'):if(_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0xd1')]&&_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0x2e')]){_0x360bae=_0x5a0830['body'][_0x8a8d('0x2e')];return db[_0x8a8d('0xaa')][_0x8a8d('0x5d')]({'where':{'messageId':_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0xd1')]}});}break;}}})[_0x8a8d('0x23')](handleEntityNotFound(_0x220092,null))['then'](function(_0x40f16a){if(_0x40f16a){_0x556bf1=_0x40f16a;switch(_0x379b61[_0x8a8d('0x43')]){case _0x8a8d('0x89'):if(_0x360bae===_0x8a8d('0xd0')){return _0x556bf1['update']({'read':!![]});}else{logger[_0x8a8d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8a8d('0x2e'),'skebby',util[_0x8a8d('0xca')](_0x5a0830['body'],{'showHidden':![],'depth':null}));}break;case _0x8a8d('0x8b'):if(_0x360bae==='1'){return _0x556bf1[_0x8a8d('0x38')]({'read':!![]});}else{logger[_0x8a8d('0x29')](_0x8a8d('0x27'),_0x8a8d('0x2e'),_0x8a8d('0x89'),util[_0x8a8d('0xca')](_0x5a0830[_0x8a8d('0x60')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5a0830[_0x8a8d('0x60')]['error_code']&&_0x360bae>=0xc8&&_0x360bae<=0xce){return _0x556bf1['update']({'read':!![]});}else{logger[_0x8a8d('0x29')](_0x8a8d('0x27'),_0x8a8d('0x2e'),_0x8a8d('0xd2'),util[_0x8a8d('0xca')](_0x5a0830['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2085a1=_0x5a0830[_0x8a8d('0x60')][_0x8a8d('0x8f')][0x0];if(_0x2085a1['status']['groupName']===_0x8a8d('0xd0')){return _0x556bf1['update']({'read':!![]});}else{logger['error'](_0x8a8d('0x27'),_0x8a8d('0x2e'),'infobip',util['inspect'](_0x5a0830[_0x8a8d('0x60')],{'showHidden':![],'depth':null}));}break;case _0x8a8d('0x94'):if(_0x360bae==_0x8a8d('0xd3')||_0x360bae=='RECEIVED_BY_RECIPIENT'){return _0x556bf1[_0x8a8d('0x38')]({'read':!![]});}else{logger[_0x8a8d('0x29')](_0x8a8d('0x27'),_0x8a8d('0x2e'),_0x8a8d('0x94'),util[_0x8a8d('0xca')](_0x5a0830[_0x8a8d('0x60')],{'showHidden':![],'depth':null}));}break;case _0x8a8d('0x96'):if(_0x360bae==_0x8a8d('0xd4')){return _0x556bf1[_0x8a8d('0x38')]({'read':!![]});}else{logger[_0x8a8d('0x29')](_0x8a8d('0x27'),_0x8a8d('0x2e'),_0x8a8d('0x96'),util['inspect'](_0x5a0830[_0x8a8d('0x60')],{'showHidden':![],'depth':null}));}break;case _0x8a8d('0x97'):if(_0x360bae===_0x8a8d('0xd5')||_0x360bae===_0x8a8d('0xd6')){return _0x556bf1['update']({'read':!![]});}else{logger[_0x8a8d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8a8d('0x2e'),_0x8a8d('0x97'),util[_0x8a8d('0xca')](_0x5a0830['body'],{'showHidden':![],'depth':null}));}break;}return _0x556bf1;}})[_0x8a8d('0x23')](respondWithResult(_0x220092,null))[_0x8a8d('0x5e')](handleError(_0x220092,null));};exports[_0x8a8d('0xd7')]=function(_0x28512f,_0x443d8d,_0xbcd9e2){var _0x253ca2,_0x226f36,_0x55f49b;return db['SmsAccount']['find']({'where':{'id':_0x28512f['params']['id']}})['then'](handleEntityNotFound(_0x443d8d,null))[_0x8a8d('0x23')](function(_0x1a7253){if(_0x1a7253){_0x55f49b=_0x1a7253;logger['debug'](_0x8a8d('0x27'),'status',_0x8a8d('0xc9'),_0x1a7253['type'],util[_0x8a8d('0xca')](_0x28512f['query'],{'showHidden':![],'depth':null}));switch(_0x1a7253[_0x8a8d('0x43')]){case _0x8a8d('0x91'):if(_0x28512f['query'][_0x8a8d('0xd8')]&&_0x28512f[_0x8a8d('0x45')]['state']){_0x226f36=_0x28512f[_0x8a8d('0x45')][_0x8a8d('0xd9')];return db[_0x8a8d('0xaa')][_0x8a8d('0x5d')]({'where':{'messageId':_0x28512f[_0x8a8d('0x45')][_0x8a8d('0xd8')]}});}break;}}})[_0x8a8d('0x23')](handleEntityNotFound(_0x443d8d,null))[_0x8a8d('0x23')](function(_0xf4e2a2){if(_0xf4e2a2){_0x253ca2=_0xf4e2a2;switch(_0x55f49b[_0x8a8d('0x43')]){case _0x8a8d('0x91'):if(_0x226f36==='2'||_0x226f36==='6'){return _0x253ca2[_0x8a8d('0x38')]({'read':!![]});}else{logger[_0x8a8d('0x29')](_0x8a8d('0x27'),_0x8a8d('0x2e'),_0x8a8d('0x91'),util[_0x8a8d('0xca')](_0x28512f[_0x8a8d('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x253ca2;}})['then'](respondWithResult(_0x443d8d,null))[_0x8a8d('0x5e')](handleError(_0x443d8d,null));};exports['addAgents']=function(_0x3e6c1a,_0x4ac397,_0x1e86ef){return db[_0x8a8d('0x56')]['find']({'where':{'id':_0x3e6c1a[_0x8a8d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4ac397,null))['then'](function(_0x1adcf1){if(_0x1adcf1){return _0x1adcf1[_0x8a8d('0xda')](_0x3e6c1a['body'][_0x8a8d('0x6d')],_[_0x8a8d('0xa1')](_0x3e6c1a['body'],[_0x8a8d('0x6d'),'id'])||{})[_0x8a8d('0xc7')](function(_0x1e5e12){for(var _0x340172=0x0;_0x340172<_0x3e6c1a[_0x8a8d('0x60')]['ids'][_0x8a8d('0x4c')];_0x340172+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x3e6c1a[_0x8a8d('0x60')][_0x8a8d('0x6d')][_0x340172]),'SmsAccountId':Number(_0x3e6c1a['params']['id'])});}return _0x1e5e12;});}})[_0x8a8d('0x23')](respondWithResult(_0x4ac397,null))['catch'](handleError(_0x4ac397,null));};exports[_0x8a8d('0xdb')]=function(_0xd4dc84,_0x46d87f,_0x25b99c){return db[_0x8a8d('0x56')]['find']({'where':{'id':_0xd4dc84[_0x8a8d('0x5a')]['id']}})[_0x8a8d('0x23')](handleEntityNotFound(_0x46d87f,null))[_0x8a8d('0x23')](function(_0x152ab9){if(_0x152ab9){return _0x152ab9[_0x8a8d('0xdb')](_0xd4dc84[_0x8a8d('0x45')]['ids'])[_0x8a8d('0x23')](function(){if(_[_0x8a8d('0xdc')](_0xd4dc84[_0x8a8d('0x45')][_0x8a8d('0x6d')])){for(var _0x46d02e=0x0;_0x46d02e<_0xd4dc84['query'][_0x8a8d('0x6d')][_0x8a8d('0x4c')];_0x46d02e+=0x1){socket[_0x8a8d('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0xd4dc84[_0x8a8d('0x45')][_0x8a8d('0x6d')][_0x46d02e]),'SmsAccountId':Number(_0xd4dc84[_0x8a8d('0x5a')]['id'])});}}else{socket[_0x8a8d('0xdd')](_0x8a8d('0xde'),{'UserId':Number(_0xd4dc84[_0x8a8d('0x45')]['ids']),'SmsAccountId':Number(_0xd4dc84[_0x8a8d('0x5a')]['id'])});}});}})[_0x8a8d('0x23')](respondWithStatusCode(_0x46d87f,null))['catch'](handleError(_0x46d87f,null));};exports[_0x8a8d('0xdf')]=function(_0x5c717b,_0x338f21,_0x37ae01){var _0x526777={};var _0x2a3f4e={};var _0x223de7;var _0xdd9609;return db[_0x8a8d('0x56')][_0x8a8d('0x6a')]({'where':{'id':_0x5c717b[_0x8a8d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x338f21,null))['then'](function(_0x539f82){if(_0x539f82){_0x223de7=_0x539f82;_0x2a3f4e['model']=_[_0x8a8d('0x46')](db['User']['rawAttributes']);_0x2a3f4e[_0x8a8d('0x45')]=_[_0x8a8d('0x46')](_0x5c717b[_0x8a8d('0x45')]);_0x2a3f4e[_0x8a8d('0x47')]=_[_0x8a8d('0x48')](_0x2a3f4e[_0x8a8d('0x49')],_0x2a3f4e['query']);_0x526777[_0x8a8d('0x4a')]=_[_0x8a8d('0x48')](_0x2a3f4e[_0x8a8d('0x49')],qs['fields'](_0x5c717b[_0x8a8d('0x45')]['fields']));_0x526777[_0x8a8d('0x4a')]=_0x526777['attributes'][_0x8a8d('0x4c')]?_0x526777[_0x8a8d('0x4a')]:_0x2a3f4e[_0x8a8d('0x49')];_0x526777[_0x8a8d('0x4f')]=qs['sort'](_0x5c717b[_0x8a8d('0x45')][_0x8a8d('0x50')]);_0x526777[_0x8a8d('0x51')]=qs['filters'](_[_0x8a8d('0x52')](_0x5c717b['query'],_0x2a3f4e['filters']));if(_0x5c717b[_0x8a8d('0x45')][_0x8a8d('0x53')]){_0x526777['where']=_['merge'](_0x526777['where'],{'$or':_['map'](_0x526777[_0x8a8d('0x4a')],function(_0x38bbe6){var _0x487f85={};_0x487f85[_0x38bbe6]={'$like':'%'+_0x5c717b['query'][_0x8a8d('0x53')]+'%'};return _0x487f85;})});}_0x526777=_[_0x8a8d('0x54')]({},_0x526777,_0x5c717b[_0x8a8d('0x55')]);return _0x223de7[_0x8a8d('0xdf')](_0x526777);}})['then'](function(_0x2b8b04){if(_0x2b8b04){_0xdd9609=_0x2b8b04[_0x8a8d('0x4c')];if(!_0x5c717b[_0x8a8d('0x45')][_0x8a8d('0x4d')]('nolimit')){_0x526777[_0x8a8d('0x32')]=qs[_0x8a8d('0x32')](_0x5c717b['query'][_0x8a8d('0x32')]);_0x526777['offset']=qs['offset'](_0x5c717b[_0x8a8d('0x45')][_0x8a8d('0x30')]);}return _0x223de7[_0x8a8d('0xdf')](_0x526777);}})[_0x8a8d('0x23')](function(_0x1b6eec){if(_0x1b6eec){return _0x1b6eec?{'count':_0xdd9609,'rows':_0x1b6eec}:null;}})['then'](respondWithResult(_0x338f21,null))['catch'](handleError(_0x338f21,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 4801019..2012cda 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 _0x070c=['hook','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x070c,0x106));var _0xc070=function(_0x33e116,_0x14214f){_0x33e116=_0x33e116-0x0;var _0x4ece9a=_0x070c[_0x33e116];return _0x4ece9a;};'use strict';var EventEmitter=require(_0xc070('0x0'));var SmsAccount=require(_0xc070('0x1'))['db'][_0xc070('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc070('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc070('0x4'),'afterDestroy':_0xc070('0x5')};function emitEvent(_0x4d74e4){return function(_0x1efbbb,_0x5cf0f2,_0x28f2a1){SmsAccountEvents[_0xc070('0x6')](_0x4d74e4+':'+_0x1efbbb['id'],_0x1efbbb);SmsAccountEvents[_0xc070('0x6')](_0x4d74e4,_0x1efbbb);_0x28f2a1(null);};}for(var e in events){if(events[_0xc070('0x7')](e)){var event=events[e];SmsAccount[_0xc070('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x8f39=['SmsAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x524cc3,_0x411124){var _0x47d234=function(_0x37aa09){while(--_0x37aa09){_0x524cc3['push'](_0x524cc3['shift']());}};_0x47d234(++_0x411124);}(_0x8f39,0xda));var _0x98f3=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x8f39[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require(_0x98f3('0x0'));var SmsAccount=require(_0x98f3('0x1'))['db'][_0x98f3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x98f3('0x3'),'afterUpdate':_0x98f3('0x4'),'afterDestroy':_0x98f3('0x5')};function emitEvent(_0x30ed78){return function(_0x15a948,_0x535732,_0x251e93){SmsAccountEvents[_0x98f3('0x6')](_0x30ed78+':'+_0x15a948['id'],_0x15a948);SmsAccountEvents[_0x98f3('0x6')](_0x30ed78,_0x15a948);_0x251e93(null);};}for(var e in events){if(events[_0x98f3('0x7')](e)){var event=events[e];SmsAccount[_0x98f3('0x8')](e,emitEvent(event));}}module[_0x98f3('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 25f4f07..ee2eb8f 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 _0xbee0=['moment','bluebird','request-promise','path','rimraf','define','SmsAccount','util','../../config/logger','api'];(function(_0x24a82f,_0x29c594){var _0x317055=function(_0x45b201){while(--_0x45b201){_0x24a82f['push'](_0x24a82f['shift']());}};_0x317055(++_0x29c594);}(_0xbee0,0x147));var _0x0bee=function(_0x3c221a,_0x29fdd8){_0x3c221a=_0x3c221a-0x0;var _0x412b85=_0xbee0[_0x3c221a];return _0x412b85;};'use strict';var _=require('lodash');var util=require(_0x0bee('0x0'));var logger=require(_0x0bee('0x1'))(_0x0bee('0x2'));var moment=require(_0x0bee('0x3'));var BPromise=require(_0x0bee('0x4'));var rp=require(_0x0bee('0x5'));var fs=require('fs');var path=require(_0x0bee('0x6'));var rimraf=require(_0x0bee('0x7'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0xd0c8f,_0xa3a091){return _0xd0c8f[_0x0bee('0x8')](_0x0bee('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b2d=['moment','bluebird','request-promise','path','rimraf','exports','define','../../config/logger','api'];(function(_0x5eed74,_0x445143){var _0x5cf861=function(_0x3e8eae){while(--_0x3e8eae){_0x5eed74['push'](_0x5eed74['shift']());}};_0x5cf861(++_0x445143);}(_0x0b2d,0x130));var _0xd0b2=function(_0x29b6c9,_0xbfcae3){_0x29b6c9=_0x29b6c9-0x0;var _0x10f339=_0x0b2d[_0x29b6c9];return _0x10f339;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd0b2('0x0'))(_0xd0b2('0x1'));var moment=require(_0xd0b2('0x2'));var BPromise=require(_0xd0b2('0x3'));var rp=require(_0xd0b2('0x4'));var fs=require('fs');var path=require(_0xd0b2('0x5'));var rimraf=require(_0xd0b2('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xd0b2('0x7')]=function(_0x4c68ea,_0x127547){return _0x4c68ea[_0xd0b2('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index afb7dbc..b27e4b5 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 _0xaafb=['SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','debug'];(function(_0x499e80,_0x3609aa){var _0x2629d7=function(_0x5f5dce){while(--_0x5f5dce){_0x499e80['push'](_0x499e80['shift']());}};_0x2629d7(++_0x3609aa);}(_0xaafb,0xa6));var _0xbaaf=function(_0x95b15a,_0x5dfbdd){_0x95b15a=_0x95b15a-0x0;var _0x6f3297=_0xaafb[_0x95b15a];return _0x6f3297;};'use strict';var _=require(_0xbaaf('0x0'));var util=require(_0xbaaf('0x1'));var moment=require(_0xbaaf('0x2'));var BPromise=require(_0xbaaf('0x3'));var rs=require(_0xbaaf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbaaf('0x5'));var logger=require(_0xbaaf('0x6'))('rpc');var config=require(_0xbaaf('0x7'));var jayson=require(_0xbaaf('0x8'));var client=jayson['client'][_0xbaaf('0x9')]({'port':0x232a});config[_0xbaaf('0xa')]=_[_0xbaaf('0xb')](config[_0xbaaf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xbaaf('0xc'))(new Redis(config['redis']));require(_0xbaaf('0xd'))[_0xbaaf('0xe')](socket);function respondWithRpcPromise(_0x585714,_0x4f7f76,_0x2a9c77){return new BPromise(function(_0x42f6d0,_0x123554){return client[_0xbaaf('0xf')](_0x585714,_0x2a9c77)[_0xbaaf('0x10')](function(_0x16dcfb){logger['info'](_0xbaaf('0x11'),_0x4f7f76,'request\x20sent');logger[_0xbaaf('0x12')](_0xbaaf('0x13'),_0x4f7f76,'request\x20sent',JSON['stringify'](_0x16dcfb));if(_0x16dcfb[_0xbaaf('0x14')]){if(_0x16dcfb[_0xbaaf('0x14')][_0xbaaf('0x15')]===0x1f4){logger[_0xbaaf('0x14')](_0xbaaf('0x11'),_0x4f7f76,_0x16dcfb['error'][_0xbaaf('0x16')]);return _0x123554(_0x16dcfb[_0xbaaf('0x14')][_0xbaaf('0x16')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4f7f76,_0x16dcfb[_0xbaaf('0x14')][_0xbaaf('0x16')]);return _0x42f6d0(_0x16dcfb['error'][_0xbaaf('0x16')]);}else{logger[_0xbaaf('0x17')](_0xbaaf('0x11'),_0x4f7f76,_0xbaaf('0x18'));_0x42f6d0(_0x16dcfb[_0xbaaf('0x19')]['message']);}})[_0xbaaf('0x1a')](function(_0x43f642){logger[_0xbaaf('0x14')](_0xbaaf('0x11'),_0x4f7f76,_0x43f642);_0x123554(_0x43f642);});});}exports[_0xbaaf('0x1b')]=function(_0x261baf){var _0x1edf08=this;return new Promise(function(_0x1f6633,_0x1b3249){return db[_0xbaaf('0x1c')][_0xbaaf('0x1d')]({'raw':_0x261baf[_0xbaaf('0x1e')]?_0x261baf[_0xbaaf('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x261baf['options']?_0x261baf[_0xbaaf('0x1e')][_0xbaaf('0x1f')]||null:null,'attributes':_0x261baf[_0xbaaf('0x1e')]?_0x261baf[_0xbaaf('0x1e')][_0xbaaf('0x20')]||null:null,'include':_0x261baf[_0xbaaf('0x1e')]?_0x261baf[_0xbaaf('0x1e')][_0xbaaf('0x21')]?_['map'](_0x261baf[_0xbaaf('0x1e')]['include'],function(_0x1db498){return{'model':db[_0x1db498[_0xbaaf('0x22')]],'as':_0x1db498['as'],'attributes':_0x1db498[_0xbaaf('0x20')],'include':_0x1db498['include']?_['map'](_0x1db498[_0xbaaf('0x21')],function(_0x4689c2){return{'model':db[_0x4689c2['model']],'as':_0x4689c2['as'],'attributes':_0x4689c2[_0xbaaf('0x20')],'include':_0x4689c2[_0xbaaf('0x21')]?_[_0xbaaf('0x23')](_0x4689c2['include'],function(_0x3e11cc){return{'model':db[_0x3e11cc[_0xbaaf('0x22')]],'as':_0x3e11cc['as'],'attributes':_0x3e11cc[_0xbaaf('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbaaf('0x10')](function(_0x356d53){logger[_0xbaaf('0x17')](_0xbaaf('0x1b'),_0x261baf);logger[_0xbaaf('0x12')](_0xbaaf('0x1b'),_0x261baf,JSON[_0xbaaf('0x24')](_0x356d53));_0x1f6633(_0x356d53);})[_0xbaaf('0x1a')](function(_0x47de31){logger[_0xbaaf('0x14')]('ShowSmsAccount',_0x47de31[_0xbaaf('0x16')],_0x261baf);_0x1b3249(_0x1edf08[_0xbaaf('0x14')](0x1f4,_0x47de31[_0xbaaf('0x16')]));});});}; \ No newline at end of file +var _0x5406=['map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','attributes','include'];(function(_0x174eab,_0x46b1f8){var _0x97f256=function(_0x6393a9){while(--_0x6393a9){_0x174eab['push'](_0x174eab['shift']());}};_0x97f256(++_0x46b1f8);}(_0x5406,0x183));var _0x6540=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x5406[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x6540('0x0'));var util=require(_0x6540('0x1'));var moment=require(_0x6540('0x2'));var BPromise=require(_0x6540('0x3'));var rs=require(_0x6540('0x4'));var fs=require('fs');var Redis=require(_0x6540('0x5'));var db=require(_0x6540('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6540('0x7'))(_0x6540('0x8'));var config=require(_0x6540('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6540('0xa')]=_[_0x6540('0xb')](config[_0x6540('0xa')],{'host':_0x6540('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6540('0xa')]));require(_0x6540('0xd'))[_0x6540('0xe')](socket);function respondWithRpcPromise(_0x25a2c9,_0x5dbf31,_0x160db9){return new BPromise(function(_0x62d232,_0x3e90b0){return client[_0x6540('0xf')](_0x25a2c9,_0x160db9)[_0x6540('0x10')](function(_0x2c7f4c){logger[_0x6540('0x11')](_0x6540('0x12'),_0x5dbf31,_0x6540('0x13'));logger['debug'](_0x6540('0x14'),_0x5dbf31,_0x6540('0x13'),JSON[_0x6540('0x15')](_0x2c7f4c));if(_0x2c7f4c['error']){if(_0x2c7f4c[_0x6540('0x16')][_0x6540('0x17')]===0x1f4){logger['error'](_0x6540('0x12'),_0x5dbf31,_0x2c7f4c[_0x6540('0x16')][_0x6540('0x18')]);return _0x3e90b0(_0x2c7f4c[_0x6540('0x16')][_0x6540('0x18')]);}logger['error'](_0x6540('0x12'),_0x5dbf31,_0x2c7f4c[_0x6540('0x16')][_0x6540('0x18')]);return _0x62d232(_0x2c7f4c[_0x6540('0x16')][_0x6540('0x18')]);}else{logger[_0x6540('0x11')](_0x6540('0x12'),_0x5dbf31,_0x6540('0x13'));_0x62d232(_0x2c7f4c[_0x6540('0x19')][_0x6540('0x18')]);}})[_0x6540('0x1a')](function(_0x51722c){logger[_0x6540('0x16')]('SmsAccount,\x20%s,\x20%s',_0x5dbf31,_0x51722c);_0x3e90b0(_0x51722c);});});}exports[_0x6540('0x1b')]=function(_0x49429d){var _0x2a4508=this;return new Promise(function(_0x72113a,_0xe11bc0){return db[_0x6540('0x1c')]['find']({'raw':_0x49429d[_0x6540('0x1d')]?_0x49429d[_0x6540('0x1d')][_0x6540('0x1e')]===undefined?!![]:![]:!![],'where':_0x49429d['options']?_0x49429d[_0x6540('0x1d')]['where']||null:null,'attributes':_0x49429d[_0x6540('0x1d')]?_0x49429d[_0x6540('0x1d')][_0x6540('0x1f')]||null:null,'include':_0x49429d['options']?_0x49429d['options'][_0x6540('0x20')]?_[_0x6540('0x21')](_0x49429d['options']['include'],function(_0x590dbb){return{'model':db[_0x590dbb[_0x6540('0x22')]],'as':_0x590dbb['as'],'attributes':_0x590dbb['attributes'],'include':_0x590dbb[_0x6540('0x20')]?_[_0x6540('0x21')](_0x590dbb[_0x6540('0x20')],function(_0x2019d3){return{'model':db[_0x2019d3[_0x6540('0x22')]],'as':_0x2019d3['as'],'attributes':_0x2019d3[_0x6540('0x1f')],'include':_0x2019d3[_0x6540('0x20')]?_['map'](_0x2019d3[_0x6540('0x20')],function(_0x5da4c1){return{'model':db[_0x5da4c1[_0x6540('0x22')]],'as':_0x5da4c1['as'],'attributes':_0x5da4c1[_0x6540('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6540('0x10')](function(_0x29bc27){logger[_0x6540('0x11')]('ShowSmsAccount',_0x49429d);logger['debug'](_0x6540('0x1b'),_0x49429d,JSON[_0x6540('0x15')](_0x29bc27));_0x72113a(_0x29bc27);})[_0x6540('0x1a')](function(_0x41b141){logger['error']('ShowSmsAccount',_0x41b141['message'],_0x49429d);_0xe11bc0(_0x2a4508['error'](0x1f4,_0x41b141['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 88eab53..0a3bdbd 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 c47fbe8..e269f06 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(_0x5708d1,_0x6bb234){var _0x8beee=function(_0x40f13b){while(--_0x40f13b){_0x5708d1['push'](_0x5708d1['shift']());}};_0x8beee(++_0x6bb234);}(_0xedd9,0xfc));var _0x9edd=function(_0xa4be3,_0xfe9db9){_0xa4be3=_0xa4be3-0x0;var _0x411769=_0xedd9[_0xa4be3];return _0x411769;};'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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5eb009,_0x56d2f4){var _0x38b580=function(_0xca3fe6){while(--_0xca3fe6){_0x5eb009['push'](_0x5eb009['shift']());}};_0x38b580(++_0x56d2f4);}(_0x34e8,0x12c));var _0x834e=function(_0x156e81,_0x137628){_0x156e81=_0x156e81-0x0;var _0x1191ba=_0x34e8[_0x156e81];return _0x1191ba;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index dee7bc6..b55a373 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 _0x39b2=['sequelize','exports','STRING','*,*,*,*'];(function(_0xba84fb,_0x45fd7c){var _0x5e5b9f=function(_0x57428c){while(--_0x57428c){_0xba84fb['push'](_0xba84fb['shift']());}};_0x5e5b9f(++_0x45fd7c);}(_0x39b2,0x198));var _0x239b=function(_0x138151,_0x1a34b1){_0x138151=_0x138151-0x0;var _0x2403e8=_0x39b2[_0x138151];return _0x2403e8;};'use strict';var Sequelize=require(_0x239b('0x0'));module[_0x239b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x239b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x239b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x239b('0x3')}}; \ No newline at end of file +var _0x3b52=['exports','STRING','noop','TEXT','sequelize'];(function(_0x395739,_0x39a094){var _0x3c244e=function(_0x139b82){while(--_0x139b82){_0x395739['push'](_0x395739['shift']());}};_0x3c244e(++_0x39a094);}(_0x3b52,0x135));var _0x23b5=function(_0x3c9eaa,_0x496585){_0x3c9eaa=_0x3c9eaa-0x0;var _0x91d9c6=_0x3b52[_0x3c9eaa];return _0x91d9c6;};'use strict';var Sequelize=require(_0x23b5('0x0'));module[_0x23b5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x23b5('0x2')],'allowNull':![],'defaultValue':_0x23b5('0x3')},'appdata':{'type':Sequelize[_0x23b5('0x4')]()},'description':{'type':Sequelize[_0x23b5('0x2')]},'interval':{'type':Sequelize[_0x23b5('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a66ed66..4f13a0f 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 _0x4151=['to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','end','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x47848c,_0x1c52f3){var _0x520324=function(_0x202798){while(--_0x202798){_0x47848c['push'](_0x47848c['shift']());}};_0x520324(++_0x1c52f3);}(_0x4151,0x1a7));var _0x1415=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x4151[_0x4e90e3];return _0x295e5b;};'use strict';var emlformat=require(_0x1415('0x0'));var rimraf=require(_0x1415('0x1'));var zipdir=require(_0x1415('0x2'));var jsonpatch=require(_0x1415('0x3'));var rp=require('request-promise');var moment=require(_0x1415('0x4'));var BPromise=require(_0x1415('0x5'));var Mustache=require(_0x1415('0x6'));var util=require('util');var path=require(_0x1415('0x7'));var sox=require(_0x1415('0x8'));var csv=require(_0x1415('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1415('0xa'));var squel=require('squel');var crypto=require(_0x1415('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1415('0xc'));var toCsv=require(_0x1415('0x9'));var querystring=require(_0x1415('0xd'));var Papa=require(_0x1415('0xe'));var Redis=require(_0x1415('0xf'));var authService=require(_0x1415('0x10'));var qs=require(_0x1415('0x11'));var as=require(_0x1415('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1415('0x13'))(_0x1415('0x14'));var utils=require('../../config/utils');var config=require(_0x1415('0x15'));var licenseUtil=require(_0x1415('0x16'));var db=require(_0x1415('0x17'))['db'];function respondWithStatusCode(_0x4afc3c,_0x3f95d9){_0x3f95d9=_0x3f95d9||0xcc;return function(_0x2e409b){if(_0x2e409b){return _0x4afc3c[_0x1415('0x18')](_0x3f95d9);}return _0x4afc3c['status'](_0x3f95d9)['end']();};}function respondWithResult(_0x2f7475,_0x3b8449){_0x3b8449=_0x3b8449||0xc8;return function(_0x48314f){if(_0x48314f){return _0x2f7475[_0x1415('0x19')](_0x3b8449)[_0x1415('0x1a')](_0x48314f);}};}function respondWithFilteredResult(_0x28764f,_0x3798ed){return function(_0x1398c4){if(_0x1398c4){var _0x31afcb=typeof _0x3798ed[_0x1415('0x1b')]===_0x1415('0x1c')&&typeof _0x3798ed['limit']===_0x1415('0x1c');var _0x12e670=_0x1398c4[_0x1415('0x1d')];var _0x5e5674=_0x31afcb?0x0:_0x3798ed[_0x1415('0x1b')];var _0x48c36d=_0x31afcb?_0x1398c4['count']:_0x3798ed[_0x1415('0x1b')]+_0x3798ed[_0x1415('0x1e')];var _0x445725;if(_0x48c36d>=_0x12e670){_0x48c36d=_0x12e670;_0x445725=0xc8;}else{_0x445725=0xce;}_0x28764f[_0x1415('0x19')](_0x445725);return _0x28764f['set'](_0x1415('0x1f'),_0x5e5674+'-'+_0x48c36d+'/'+_0x12e670)['json'](_0x1398c4);}return null;};}function patchUpdates(_0x48f4bf){return function(_0x4452a1){try{jsonpatch['apply'](_0x4452a1,_0x48f4bf,!![]);}catch(_0x2cc388){return BPromise['reject'](_0x2cc388);}return _0x4452a1[_0x1415('0x20')]();};}function saveUpdates(_0x543267,_0x1eb40d){return function(_0xa9f274){if(_0xa9f274){return _0xa9f274[_0x1415('0x21')](_0x543267)[_0x1415('0x22')](function(_0x33c77c){return _0x33c77c;});}return null;};}function removeEntity(_0x575123,_0x35b052){return function(_0x464d37){if(_0x464d37){return _0x464d37[_0x1415('0x23')]()['then'](function(){_0x575123[_0x1415('0x19')](0xcc)[_0x1415('0x24')]();});}};}function handleEntityNotFound(_0x4f0111,_0x33ee3d){return function(_0x4e5af7){if(!_0x4e5af7){_0x4f0111[_0x1415('0x18')](0x194);}return _0x4e5af7;};}function handleError(_0x56fc43,_0x32b584){_0x32b584=_0x32b584||0x1f4;return function(_0x1f4aab){logger['error'](_0x1f4aab['stack']);if(_0x1f4aab['name']){delete _0x1f4aab[_0x1415('0x25')];}_0x56fc43[_0x1415('0x19')](_0x32b584)[_0x1415('0x26')](_0x1f4aab);};}exports[_0x1415('0x27')]=function(_0x860dc5,_0x424787){var _0x3c06ce={},_0x4154af={},_0x130a3c={'count':0x0,'rows':[]};var _0x5cfef0=_[_0x1415('0x28')](db[_0x1415('0x29')][_0x1415('0x2a')],function(_0x491c55){return{'name':_0x491c55[_0x1415('0x2b')],'type':_0x491c55['type'][_0x1415('0x2c')]};});_0x4154af[_0x1415('0x2d')]=_[_0x1415('0x28')](_0x5cfef0,_0x1415('0x25'));_0x4154af[_0x1415('0x2e')]=_[_0x1415('0x2f')](_0x860dc5['query']);_0x4154af['filters']=_[_0x1415('0x30')](_0x4154af[_0x1415('0x2d')],_0x4154af[_0x1415('0x2e')]);_0x3c06ce[_0x1415('0x31')]=_[_0x1415('0x30')](_0x4154af['model'],qs['fields'](_0x860dc5[_0x1415('0x2e')][_0x1415('0x32')]));_0x3c06ce[_0x1415('0x31')]=_0x3c06ce[_0x1415('0x31')]['length']?_0x3c06ce[_0x1415('0x31')]:_0x4154af[_0x1415('0x2d')];if(!_0x860dc5[_0x1415('0x2e')]['hasOwnProperty'](_0x1415('0x33'))){_0x3c06ce[_0x1415('0x1e')]=qs[_0x1415('0x1e')](_0x860dc5[_0x1415('0x2e')]['limit']);_0x3c06ce['offset']=qs[_0x1415('0x1b')](_0x860dc5[_0x1415('0x2e')]['offset']);}_0x3c06ce[_0x1415('0x34')]=qs['sort'](_0x860dc5[_0x1415('0x2e')]['sort']);_0x3c06ce[_0x1415('0x35')]=qs[_0x1415('0x36')](_[_0x1415('0x37')](_0x860dc5[_0x1415('0x2e')],_0x4154af['filters']),_0x5cfef0);if(_0x860dc5[_0x1415('0x2e')]['filter']){_0x3c06ce[_0x1415('0x35')]=_[_0x1415('0x38')](_0x3c06ce[_0x1415('0x35')],{'$or':_[_0x1415('0x28')](_0x5cfef0,function(_0x33e917){if(_0x33e917[_0x1415('0x39')]!==_0x1415('0x3a')){var _0x1ea13d={};_0x1ea13d[_0x33e917[_0x1415('0x25')]]={'$like':'%'+_0x860dc5[_0x1415('0x2e')][_0x1415('0x3b')]+'%'};return _0x1ea13d;}})});}_0x3c06ce=_[_0x1415('0x38')]({},_0x3c06ce,_0x860dc5[_0x1415('0x3c')]);var _0x3b513d={'where':_0x3c06ce[_0x1415('0x35')]};return db['SmsApplication'][_0x1415('0x1d')](_0x3b513d)[_0x1415('0x22')](function(_0x39e595){_0x130a3c[_0x1415('0x1d')]=_0x39e595;if(_0x860dc5[_0x1415('0x2e')][_0x1415('0x3d')]){_0x3c06ce[_0x1415('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0x1415('0x3f')](_0x3c06ce);})['then'](function(_0x14c0c9){_0x130a3c[_0x1415('0x40')]=_0x14c0c9;return _0x130a3c;})[_0x1415('0x22')](respondWithFilteredResult(_0x424787,_0x3c06ce))[_0x1415('0x41')](handleError(_0x424787,null));};exports[_0x1415('0x42')]=function(_0x5d703c,_0x483d7c){var _0x59f912={'raw':!![],'where':{'id':_0x5d703c['params']['id']}},_0x22ca3b={};_0x22ca3b[_0x1415('0x2d')]=_[_0x1415('0x2f')](db[_0x1415('0x29')][_0x1415('0x2a')]);_0x22ca3b[_0x1415('0x2e')]=_['keys'](_0x5d703c[_0x1415('0x2e')]);_0x22ca3b['filters']=_['intersection'](_0x22ca3b['model'],_0x22ca3b[_0x1415('0x2e')]);_0x59f912[_0x1415('0x31')]=_[_0x1415('0x30')](_0x22ca3b['model'],qs[_0x1415('0x32')](_0x5d703c[_0x1415('0x2e')][_0x1415('0x32')]));_0x59f912[_0x1415('0x31')]=_0x59f912['attributes'][_0x1415('0x43')]?_0x59f912['attributes']:_0x22ca3b[_0x1415('0x2d')];if(_0x5d703c[_0x1415('0x2e')]['includeAll']){_0x59f912['include']=[{'all':!![]}];}_0x59f912=_['merge']({},_0x59f912,_0x5d703c[_0x1415('0x3c')]);return db['SmsApplication'][_0x1415('0x44')](_0x59f912)[_0x1415('0x22')](handleEntityNotFound(_0x483d7c,null))[_0x1415('0x22')](respondWithResult(_0x483d7c,null))[_0x1415('0x41')](handleError(_0x483d7c,null));};exports[_0x1415('0x45')]=function(_0x86ecd9,_0x1fc434){return db['SmsApplication'][_0x1415('0x45')](_0x86ecd9['body'],{})[_0x1415('0x22')](respondWithResult(_0x1fc434,0xc9))[_0x1415('0x41')](handleError(_0x1fc434,null));};exports[_0x1415('0x21')]=function(_0x3e34fb,_0x1c4987){if(_0x3e34fb[_0x1415('0x46')]['id']){delete _0x3e34fb[_0x1415('0x46')]['id'];}return db['SmsApplication'][_0x1415('0x44')]({'where':{'id':_0x3e34fb[_0x1415('0x47')]['id']}})[_0x1415('0x22')](handleEntityNotFound(_0x1c4987,null))[_0x1415('0x22')](saveUpdates(_0x3e34fb[_0x1415('0x46')],null))[_0x1415('0x22')](respondWithResult(_0x1c4987,null))['catch'](handleError(_0x1c4987,null));};exports[_0x1415('0x23')]=function(_0x327f85,_0x6bf66c){return db[_0x1415('0x29')][_0x1415('0x44')]({'where':{'id':_0x327f85[_0x1415('0x47')]['id']}})[_0x1415('0x22')](handleEntityNotFound(_0x6bf66c,null))[_0x1415('0x22')](removeEntity(_0x6bf66c,null))[_0x1415('0x41')](handleError(_0x6bf66c,null));}; \ No newline at end of file +var _0x0660=['send','index','map','SmsApplication','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack'];(function(_0x6a4fe7,_0x40a337){var _0x5e467d=function(_0x24eb0b){while(--_0x24eb0b){_0x6a4fe7['push'](_0x6a4fe7['shift']());}};_0x5e467d(++_0x40a337);}(_0x0660,0xb1));var _0x0066=function(_0x580ce7,_0x57fa40){_0x580ce7=_0x580ce7-0x0;var _0x2164e2=_0x0660[_0x580ce7];return _0x2164e2;};'use strict';var emlformat=require(_0x0066('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0066('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0066('0x2'));var moment=require(_0x0066('0x3'));var BPromise=require(_0x0066('0x4'));var Mustache=require(_0x0066('0x5'));var util=require(_0x0066('0x6'));var path=require(_0x0066('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0066('0x8'));var fs=require('fs');var fs_extra=require(_0x0066('0x9'));var _=require('lodash');var squel=require(_0x0066('0xa'));var crypto=require(_0x0066('0xb'));var jsforce=require(_0x0066('0xc'));var deskjs=require(_0x0066('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0066('0xe'));var Papa=require(_0x0066('0xf'));var Redis=require('ioredis');var authService=require(_0x0066('0x10'));var qs=require(_0x0066('0x11'));var as=require(_0x0066('0x12'));var hardwareService=require(_0x0066('0x13'));var logger=require(_0x0066('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0066('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0066('0x16'))['db'];function respondWithStatusCode(_0x2df48b,_0x18e57b){_0x18e57b=_0x18e57b||0xcc;return function(_0x5685cd){if(_0x5685cd){return _0x2df48b[_0x0066('0x17')](_0x18e57b);}return _0x2df48b['status'](_0x18e57b)[_0x0066('0x18')]();};}function respondWithResult(_0x32a91f,_0x2a9b73){_0x2a9b73=_0x2a9b73||0xc8;return function(_0x5617ed){if(_0x5617ed){return _0x32a91f[_0x0066('0x19')](_0x2a9b73)[_0x0066('0x1a')](_0x5617ed);}};}function respondWithFilteredResult(_0x5d270a,_0x2257bc){return function(_0x46b358){if(_0x46b358){var _0x375d43=typeof _0x2257bc[_0x0066('0x1b')]==='undefined'&&typeof _0x2257bc[_0x0066('0x1c')]===_0x0066('0x1d');var _0x4fb480=_0x46b358['count'];var _0x3f1d56=_0x375d43?0x0:_0x2257bc['offset'];var _0x393b28=_0x375d43?_0x46b358[_0x0066('0x1e')]:_0x2257bc[_0x0066('0x1b')]+_0x2257bc[_0x0066('0x1c')];var _0x3125cb;if(_0x393b28>=_0x4fb480){_0x393b28=_0x4fb480;_0x3125cb=0xc8;}else{_0x3125cb=0xce;}_0x5d270a[_0x0066('0x19')](_0x3125cb);return _0x5d270a[_0x0066('0x1f')](_0x0066('0x20'),_0x3f1d56+'-'+_0x393b28+'/'+_0x4fb480)[_0x0066('0x1a')](_0x46b358);}return null;};}function patchUpdates(_0x5d2249){return function(_0x4dcd4a){try{jsonpatch[_0x0066('0x21')](_0x4dcd4a,_0x5d2249,!![]);}catch(_0x22a88a){return BPromise['reject'](_0x22a88a);}return _0x4dcd4a[_0x0066('0x22')]();};}function saveUpdates(_0x2c7d73,_0xae5d1e){return function(_0x3f7a59){if(_0x3f7a59){return _0x3f7a59['update'](_0x2c7d73)[_0x0066('0x23')](function(_0x2c4b8b){return _0x2c4b8b;});}return null;};}function removeEntity(_0x55f0a1,_0x546e17){return function(_0x154bed){if(_0x154bed){return _0x154bed[_0x0066('0x24')]()[_0x0066('0x23')](function(){_0x55f0a1[_0x0066('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1414b0,_0xf05596){return function(_0x203b1a){if(!_0x203b1a){_0x1414b0[_0x0066('0x17')](0x194);}return _0x203b1a;};}function handleError(_0x22ab9d,_0x43b08e){_0x43b08e=_0x43b08e||0x1f4;return function(_0x565714){logger[_0x0066('0x25')](_0x565714[_0x0066('0x26')]);if(_0x565714['name']){delete _0x565714['name'];}_0x22ab9d[_0x0066('0x19')](_0x43b08e)[_0x0066('0x27')](_0x565714);};}exports[_0x0066('0x28')]=function(_0x1de8ca,_0x23af1e){var _0x3ca121={},_0x35f9b2={},_0x1e9b29={'count':0x0,'rows':[]};var _0x3a0316=_[_0x0066('0x29')](db[_0x0066('0x2a')][_0x0066('0x2b')],function(_0x31cf12){return{'name':_0x31cf12[_0x0066('0x2c')],'type':_0x31cf12[_0x0066('0x2d')][_0x0066('0x2e')]};});_0x35f9b2['model']=_[_0x0066('0x29')](_0x3a0316,_0x0066('0x2f'));_0x35f9b2[_0x0066('0x30')]=_[_0x0066('0x31')](_0x1de8ca[_0x0066('0x30')]);_0x35f9b2['filters']=_[_0x0066('0x32')](_0x35f9b2['model'],_0x35f9b2[_0x0066('0x30')]);_0x3ca121['attributes']=_[_0x0066('0x32')](_0x35f9b2[_0x0066('0x33')],qs[_0x0066('0x34')](_0x1de8ca['query'][_0x0066('0x34')]));_0x3ca121['attributes']=_0x3ca121['attributes']['length']?_0x3ca121[_0x0066('0x35')]:_0x35f9b2[_0x0066('0x33')];if(!_0x1de8ca[_0x0066('0x30')][_0x0066('0x36')]('nolimit')){_0x3ca121['limit']=qs[_0x0066('0x1c')](_0x1de8ca[_0x0066('0x30')][_0x0066('0x1c')]);_0x3ca121[_0x0066('0x1b')]=qs[_0x0066('0x1b')](_0x1de8ca[_0x0066('0x30')][_0x0066('0x1b')]);}_0x3ca121['order']=qs[_0x0066('0x37')](_0x1de8ca['query'][_0x0066('0x37')]);_0x3ca121[_0x0066('0x38')]=qs[_0x0066('0x39')](_[_0x0066('0x3a')](_0x1de8ca[_0x0066('0x30')],_0x35f9b2[_0x0066('0x39')]),_0x3a0316);if(_0x1de8ca[_0x0066('0x30')][_0x0066('0x3b')]){_0x3ca121['where']=_[_0x0066('0x3c')](_0x3ca121[_0x0066('0x38')],{'$or':_['map'](_0x3a0316,function(_0x5f590c){if(_0x5f590c['type']!==_0x0066('0x3d')){var _0x2951c6={};_0x2951c6[_0x5f590c[_0x0066('0x2f')]]={'$like':'%'+_0x1de8ca[_0x0066('0x30')][_0x0066('0x3b')]+'%'};return _0x2951c6;}})});}_0x3ca121=_['merge']({},_0x3ca121,_0x1de8ca[_0x0066('0x3e')]);var _0x371fcf={'where':_0x3ca121[_0x0066('0x38')]};return db[_0x0066('0x2a')]['count'](_0x371fcf)['then'](function(_0x3c58f0){_0x1e9b29['count']=_0x3c58f0;if(_0x1de8ca[_0x0066('0x30')][_0x0066('0x3f')]){_0x3ca121[_0x0066('0x40')]=[{'all':!![]}];}return db[_0x0066('0x2a')][_0x0066('0x41')](_0x3ca121);})[_0x0066('0x23')](function(_0x286786){_0x1e9b29['rows']=_0x286786;return _0x1e9b29;})[_0x0066('0x23')](respondWithFilteredResult(_0x23af1e,_0x3ca121))['catch'](handleError(_0x23af1e,null));};exports['show']=function(_0x32b895,_0x31b0d3){var _0x2ca28d={'raw':!![],'where':{'id':_0x32b895[_0x0066('0x42')]['id']}},_0x4032c7={};_0x4032c7['model']=_[_0x0066('0x31')](db[_0x0066('0x2a')][_0x0066('0x2b')]);_0x4032c7[_0x0066('0x30')]=_[_0x0066('0x31')](_0x32b895[_0x0066('0x30')]);_0x4032c7[_0x0066('0x39')]=_[_0x0066('0x32')](_0x4032c7[_0x0066('0x33')],_0x4032c7[_0x0066('0x30')]);_0x2ca28d['attributes']=_['intersection'](_0x4032c7[_0x0066('0x33')],qs['fields'](_0x32b895['query']['fields']));_0x2ca28d[_0x0066('0x35')]=_0x2ca28d[_0x0066('0x35')][_0x0066('0x43')]?_0x2ca28d[_0x0066('0x35')]:_0x4032c7[_0x0066('0x33')];if(_0x32b895[_0x0066('0x30')]['includeAll']){_0x2ca28d[_0x0066('0x40')]=[{'all':!![]}];}_0x2ca28d=_[_0x0066('0x3c')]({},_0x2ca28d,_0x32b895[_0x0066('0x3e')]);return db[_0x0066('0x2a')][_0x0066('0x44')](_0x2ca28d)[_0x0066('0x23')](handleEntityNotFound(_0x31b0d3,null))[_0x0066('0x23')](respondWithResult(_0x31b0d3,null))[_0x0066('0x45')](handleError(_0x31b0d3,null));};exports[_0x0066('0x46')]=function(_0x2634c8,_0x29d7b7){return db[_0x0066('0x2a')]['create'](_0x2634c8[_0x0066('0x47')],{})[_0x0066('0x23')](respondWithResult(_0x29d7b7,0xc9))[_0x0066('0x45')](handleError(_0x29d7b7,null));};exports['update']=function(_0x2d3c5f,_0x1bcf08){if(_0x2d3c5f[_0x0066('0x47')]['id']){delete _0x2d3c5f[_0x0066('0x47')]['id'];}return db[_0x0066('0x2a')]['find']({'where':{'id':_0x2d3c5f[_0x0066('0x42')]['id']}})['then'](handleEntityNotFound(_0x1bcf08,null))[_0x0066('0x23')](saveUpdates(_0x2d3c5f['body'],null))['then'](respondWithResult(_0x1bcf08,null))[_0x0066('0x45')](handleError(_0x1bcf08,null));};exports[_0x0066('0x24')]=function(_0x460e55,_0x1d5eb2){return db[_0x0066('0x2a')][_0x0066('0x44')]({'where':{'id':_0x460e55['params']['id']}})[_0x0066('0x23')](handleEntityNotFound(_0x1d5eb2,null))[_0x0066('0x23')](removeEntity(_0x1d5eb2,null))[_0x0066('0x45')](handleError(_0x1d5eb2,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d9e3a5a..f856fce 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 _0x6a88=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','utf8mb4'];(function(_0x16c170,_0x210ed3){var _0x5ae1f7=function(_0x55018b){while(--_0x55018b){_0x16c170['push'](_0x16c170['shift']());}};_0x5ae1f7(++_0x210ed3);}(_0x6a88,0xa9));var _0x86a8=function(_0x4acf20,_0x3f4636){_0x4acf20=_0x4acf20-0x0;var _0x50eabc=_0x6a88[_0x4acf20];return _0x50eabc;};'use strict';var _=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var logger=require(_0x86a8('0x2'))(_0x86a8('0x3'));var moment=require(_0x86a8('0x4'));var BPromise=require(_0x86a8('0x5'));var rp=require(_0x86a8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86a8('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x86a8('0x8')]=function(_0x29a32a,_0x4b4eb7){return _0x29a32a[_0x86a8('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86a8('0xa'),'collate':_0x86a8('0xb')});}; \ No newline at end of file +var _0x7d9f=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x1614c2,_0x1fccfc){var _0x182c4c=function(_0x19c361){while(--_0x19c361){_0x1614c2['push'](_0x1614c2['shift']());}};_0x182c4c(++_0x1fccfc);}(_0x7d9f,0x135));var _0xf7d9=function(_0x1598fb,_0x29645f){_0x1598fb=_0x1598fb-0x0;var _0x4fae38=_0x7d9f[_0x1598fb];return _0x4fae38;};'use strict';var _=require('lodash');var util=require(_0xf7d9('0x0'));var logger=require(_0xf7d9('0x1'))(_0xf7d9('0x2'));var moment=require(_0xf7d9('0x3'));var BPromise=require(_0xf7d9('0x4'));var rp=require(_0xf7d9('0x5'));var fs=require('fs');var path=require(_0xf7d9('0x6'));var rimraf=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var attributes=require(_0xf7d9('0x9'));module[_0xf7d9('0xa')]=function(_0x273379,_0x43889c){return _0x273379[_0xf7d9('0xb')](_0xf7d9('0xc'),attributes,{'tableName':_0xf7d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf7d9('0xe'),'collate':_0xf7d9('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b38474e..b60db3c 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 _0xd4ad=['info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','http','request','then'];(function(_0x358131,_0x35cb39){var _0x449d40=function(_0x1b9232){while(--_0x1b9232){_0x358131['push'](_0x358131['shift']());}};_0x449d40(++_0x35cb39);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x5009bb,_0x40380c){_0x5009bb=_0x5009bb-0x0;var _0x48ec0d=_0xd4ad[_0x5009bb];return _0x48ec0d;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var moment=require(_0xdd4a('0x2'));var BPromise=require(_0xdd4a('0x3'));var rs=require(_0xdd4a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd4a('0x5'));var logger=require(_0xdd4a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdd4a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fdfa2,_0x2f0952,_0x5b5ab3){return new BPromise(function(_0x3c7a01,_0x45647c){return client[_0xdd4a('0x8')](_0x4fdfa2,_0x5b5ab3)[_0xdd4a('0x9')](function(_0xd1ee35){logger[_0xdd4a('0xa')]('SmsApplication,\x20%s,\x20%s',_0x2f0952,_0xdd4a('0xb'));logger[_0xdd4a('0xc')](_0xdd4a('0xd'),_0x2f0952,'request\x20sent',JSON['stringify'](_0xd1ee35));if(_0xd1ee35[_0xdd4a('0xe')]){if(_0xd1ee35[_0xdd4a('0xe')]['code']===0x1f4){logger[_0xdd4a('0xe')]('SmsApplication,\x20%s,\x20%s',_0x2f0952,_0xd1ee35[_0xdd4a('0xe')][_0xdd4a('0xf')]);return _0x45647c(_0xd1ee35[_0xdd4a('0xe')][_0xdd4a('0xf')]);}logger[_0xdd4a('0xe')](_0xdd4a('0x10'),_0x2f0952,_0xd1ee35[_0xdd4a('0xe')]['message']);return _0x3c7a01(_0xd1ee35[_0xdd4a('0xe')][_0xdd4a('0xf')]);}else{logger[_0xdd4a('0xa')](_0xdd4a('0x10'),_0x2f0952,_0xdd4a('0xb'));_0x3c7a01(_0xd1ee35[_0xdd4a('0x11')][_0xdd4a('0xf')]);}})[_0xdd4a('0x12')](function(_0x42bc93){logger[_0xdd4a('0xe')](_0xdd4a('0x10'),_0x2f0952,_0x42bc93);_0x45647c(_0x42bc93);});});} \ No newline at end of file +var _0xc74c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0xc74c,0x163));var _0xcc74=function(_0x5c7a6f,_0x2e0f25){_0x5c7a6f=_0x5c7a6f-0x0;var _0x51b56a=_0xc74c[_0x5c7a6f];return _0x51b56a;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc74('0x2'));var fs=require('fs');var Redis=require(_0xcc74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc74('0x4'));var logger=require(_0xcc74('0x5'))(_0xcc74('0x6'));var config=require(_0xcc74('0x7'));var jayson=require(_0xcc74('0x8'));var client=jayson[_0xcc74('0x9')][_0xcc74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d46a6,_0x15248f,_0x86f429){return new BPromise(function(_0x1eb886,_0x473308){return client[_0xcc74('0xb')](_0x5d46a6,_0x86f429)['then'](function(_0x4b4534){logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));logger['debug'](_0xcc74('0xf'),_0x15248f,_0xcc74('0xe'),JSON[_0xcc74('0x10')](_0x4b4534));if(_0x4b4534['error']){if(_0x4b4534[_0xcc74('0x11')]['code']===0x1f4){logger[_0xcc74('0x11')]('SmsApplication,\x20%s,\x20%s',_0x15248f,_0x4b4534['error']['message']);return _0x473308(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0x4b4534[_0xcc74('0x11')]['message']);return _0x1eb886(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}else{logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));_0x1eb886(_0x4b4534['result'][_0xcc74('0x12')]);}})[_0xcc74('0x13')](function(_0xe44014){logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0xe44014);_0x473308(_0xe44014);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9abc40e..306bd1e 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f4c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x5c6eed,_0x32b509){var _0xcf37c5=function(_0x378187){while(--_0x378187){_0x5c6eed['push'](_0x5c6eed['shift']());}};_0xcf37c5(++_0x32b509);}(_0x8f4c,0x113));var _0xc8f4=function(_0x54deb9,_0x6bae72){_0x54deb9=_0x54deb9-0x0;var _0x263f96=_0x8f4c[_0x54deb9];return _0x263f96;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./smsInteraction.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/download',auth[_0xc8f4('0xd')](),controller['download']);router[_0xc8f4('0x11')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x11')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x11')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),'smsinteraction:addtags'),controller[_0xc8f4('0x17')]);router[_0xc8f4('0x18')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')]('sms',_0xc8f4('0x19')),controller['update']);router['delete'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),_0xc8f4('0x1a')),controller[_0xc8f4('0x1b')]);router[_0xc8f4('0x1c')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1d')]);module[_0xc8f4('0x1e')]=router; \ No newline at end of file +var _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20a4c5,_0x43f6f1){var _0x1cac1a=function(_0x2c6f08){while(--_0x2c6f08){_0x20a4c5['push'](_0x20a4c5['shift']());}};_0x1cac1a(++_0x43f6f1);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('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 e75ecf8..99f7908 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 _0x7f27=['ENUM','BOOLEAN','sequelize','moment','DATE','STRING'];(function(_0x4b29bb,_0x1b612a){var _0x27fb10=function(_0x12179c){while(--_0x12179c){_0x4b29bb['push'](_0x4b29bb['shift']());}};_0x27fb10(++_0x1b612a);}(_0x7f27,0x12e));var _0x77f2=function(_0x2c5aa0,_0x4bd904){_0x2c5aa0=_0x2c5aa0-0x0;var _0x5bdfb8=_0x7f27[_0x2c5aa0];return _0x5bdfb8;};'use strict';var Sequelize=require(_0x77f2('0x0'));var moment=require(_0x77f2('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x77f2('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x77f2('0x3')]},'note':{'type':Sequelize[_0x77f2('0x3')]},'phone':{'type':Sequelize[_0x77f2('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x77f2('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x77f2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x77f2('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x77f2('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x2caf=['out','BOOLEAN','STRING','DATE','ENUM'];(function(_0x347de1,_0x2feeaa){var _0x18ad77=function(_0x2a335e){while(--_0x2a335e){_0x347de1['push'](_0x347de1['shift']());}};_0x18ad77(++_0x2feeaa);}(_0x2caf,0x6a));var _0xf2ca=function(_0x359365,_0x4119c4){_0x359365=_0x359365-0x0;var _0x5dea1=_0x2caf[_0x359365];return _0x5dea1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xf2ca('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf2ca('0x1')]},'secondDisposition':{'type':Sequelize[_0xf2ca('0x1')]},'thirdDisposition':{'type':Sequelize[_0xf2ca('0x1')]},'note':{'type':Sequelize[_0xf2ca('0x1')]},'phone':{'type':Sequelize[_0xf2ca('0x1')]},'read1stAt':{'type':Sequelize[_0xf2ca('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf2ca('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf2ca('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf2ca('0x3')]('in',_0xf2ca('0x4')),'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 9c13076..461789a 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 _0x26b5=['.pdf','Sms','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','ioredis','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','start','body','keys','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','toString','sequelize','keyBy','merge','fields','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','Tag','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','Messages','direction','secret','SmsAccount','Account','get','Owner','N.A.','closed','closedAt','disposition','out','lastName','renderFile','downloadInteraction.ejs','transcript-'];(function(_0x4e95b9,_0x394618){var _0x274725=function(_0x463777){while(--_0x463777){_0x4e95b9['push'](_0x4e95b9['shift']());}};_0x274725(++_0x394618);}(_0x26b5,0xed));var _0x526b=function(_0x3f55ea,_0x5b5bd2){_0x3f55ea=_0x3f55ea-0x0;var _0x510b6d=_0x26b5[_0x3f55ea];return _0x510b6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x526b('0x0'));var zipdir=require(_0x526b('0x1'));var jsonpatch=require(_0x526b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x526b('0x3'));var Mustache=require(_0x526b('0x4'));var util=require(_0x526b('0x5'));var path=require('path');var sox=require(_0x526b('0x6'));var csv=require(_0x526b('0x7'));var ejs=require(_0x526b('0x8'));var fs=require('fs');var fs_extra=require(_0x526b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x526b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x526b('0x7'));var querystring=require(_0x526b('0xb'));var Papa=require('papaparse');var Redis=require(_0x526b('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x526b('0xd'));var hardwareService=require(_0x526b('0xe'));var logger=require(_0x526b('0xf'))(_0x526b('0x10'));var utils=require(_0x526b('0x11'));var config=require(_0x526b('0x12'));var licenseUtil=require(_0x526b('0x13'));var db=require(_0x526b('0x14'))['db'];config[_0x526b('0x15')]=_['defaults'](config[_0x526b('0x15')],{'host':_0x526b('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x526b('0x15')]));require(_0x526b('0x17'))[_0x526b('0x18')](socket);function respondWithStatusCode(_0x2cf69e,_0x508a51){_0x508a51=_0x508a51||0xcc;return function(_0x1abd4d){if(_0x1abd4d){return _0x2cf69e[_0x526b('0x19')](_0x508a51);}return _0x2cf69e[_0x526b('0x1a')](_0x508a51)[_0x526b('0x1b')]();};}function respondWithResult(_0x318fc5,_0x538962){_0x538962=_0x538962||0xc8;return function(_0x4c08f3){if(_0x4c08f3){return _0x318fc5[_0x526b('0x1a')](_0x538962)[_0x526b('0x1c')](_0x4c08f3);}};}function respondWithFilteredResult(_0x856815,_0x5e0291){return function(_0x3c4b74){if(_0x3c4b74){var _0x3f642b=typeof _0x5e0291[_0x526b('0x1d')]==='undefined'&&typeof _0x5e0291['limit']==='undefined';var _0x42b663=_0x3c4b74[_0x526b('0x1e')];var _0x491105=_0x3f642b?0x0:_0x5e0291[_0x526b('0x1d')];var _0x4e57c3=_0x3f642b?_0x3c4b74[_0x526b('0x1e')]:_0x5e0291[_0x526b('0x1d')]+_0x5e0291[_0x526b('0x1f')];var _0x5f24b5;if(_0x4e57c3>=_0x42b663){_0x4e57c3=_0x42b663;_0x5f24b5=0xc8;}else{_0x5f24b5=0xce;}_0x856815[_0x526b('0x1a')](_0x5f24b5);return _0x856815[_0x526b('0x20')](_0x526b('0x21'),_0x491105+'-'+_0x4e57c3+'/'+_0x42b663)[_0x526b('0x1c')](_0x3c4b74);}return null;};}function patchUpdates(_0x419ccc){return function(_0x2c484c){try{jsonpatch[_0x526b('0x22')](_0x2c484c,_0x419ccc,!![]);}catch(_0x5f57fc){return BPromise[_0x526b('0x23')](_0x5f57fc);}return _0x2c484c[_0x526b('0x24')]();};}function saveUpdates(_0x4bfae6,_0x37d2bf){return function(_0x2b5aaf){if(_0x2b5aaf){return _0x2b5aaf[_0x526b('0x25')](_0x4bfae6)[_0x526b('0x26')](function(_0x28891f){return _0x28891f;});}return null;};}function removeEntity(_0x5dffb7,_0x30a4b6){return function(_0x18c3d2){if(_0x18c3d2){return _0x18c3d2[_0x526b('0x27')]()[_0x526b('0x26')](function(){_0x5dffb7[_0x526b('0x1a')](0xcc)[_0x526b('0x1b')]();});}};}function handleEntityNotFound(_0x37b68b,_0x1ce159){return function(_0x34d4d8){if(!_0x34d4d8){_0x37b68b[_0x526b('0x19')](0x194);}return _0x34d4d8;};}function handleError(_0x32b921,_0x21cb15){_0x21cb15=_0x21cb15||0x1f4;return function(_0x5a29f9){logger[_0x526b('0x28')](_0x5a29f9['stack']);if(_0x5a29f9[_0x526b('0x29')]){delete _0x5a29f9[_0x526b('0x29')];}_0x32b921['status'](_0x21cb15)[_0x526b('0x2a')](_0x5a29f9);};}function getInteractionUsers(_0x18c29c,_0x221c13){return new BPromise(function(_0x4e3610,_0x41fb4e){try{if(_0x221c13[_0x18c29c['id']]){_0x18c29c['Users']=_[_0x526b('0x2b')](_0x221c13[_0x18c29c['id']],function(_0x5278c3){return{'id':_0x5278c3['id'],'fullname':_0x5278c3[_0x526b('0x2c')]};});}}catch(_0x117b95){_0x41fb4e(_0x117b95);}_0x4e3610(_0x18c29c);});}function getInteractionTags(_0x3f3c10,_0x445822){return new BPromise(function(_0x46bc81,_0x1b1241){try{if(_0x3f3c10[_0x526b('0x2d')]){_0x3f3c10[_0x526b('0x2e')]=[];_0x3f3c10['TagIds'][_0x526b('0x2f')](',')[_0x526b('0x30')](function(_0x1da596){_0x3f3c10[_0x526b('0x2e')][_0x526b('0x31')](_0x445822[_0x1da596]);});}delete _0x3f3c10[_0x526b('0x2d')];}catch(_0x20ffb4){_0x1b1241(_0x20ffb4);}_0x46bc81(_0x3f3c10);});}function updateSmsInteraction(_0x234fe1,_0xed445,_0x87d625){return new BPromise(function(_0x26cc4f,_0x462ce0){return getInteractionUsers(_0x234fe1,_0x87d625)['then'](function(_0x3ce409){return getInteractionTags(_0x3ce409,_0xed445);})[_0x526b('0x26')](function(_0x2c9b01){_0x26cc4f(_0x2c9b01);})['catch'](function(_0x52d604){_0x462ce0(_0x52d604);});});}exports[_0x526b('0x32')]=function(_0x31e978,_0x361fe2){var _0x8a201b={},_0x42bb4f={},_0x313265={'count':0x0,'rows':[]};var _0xe9ea91=_[_0x526b('0x2b')](db[_0x526b('0x33')][_0x526b('0x34')],function(_0x5cc42a){return{'name':_0x5cc42a[_0x526b('0x35')],'type':_0x5cc42a[_0x526b('0x36')][_0x526b('0x37')]};});_0x42bb4f[_0x526b('0x38')]=_[_0x526b('0x2b')](_0xe9ea91,_0x526b('0x29'));_0x42bb4f['query']=_['keys'](_0x31e978[_0x526b('0x39')]);_0x42bb4f[_0x526b('0x3a')]=_[_0x526b('0x3b')](_0x42bb4f[_0x526b('0x38')],_0x42bb4f[_0x526b('0x39')]);_0x8a201b[_0x526b('0x3c')]=_['intersection'](_0x42bb4f[_0x526b('0x38')],qs['fields'](_0x31e978[_0x526b('0x39')]['fields']));_0x8a201b['attributes']=_0x8a201b[_0x526b('0x3c')][_0x526b('0x3d')]?_0x8a201b[_0x526b('0x3c')]:_0x42bb4f['model'];if(!_0x31e978[_0x526b('0x39')][_0x526b('0x3e')](_0x526b('0x3f'))){_0x8a201b[_0x526b('0x1f')]=qs[_0x526b('0x1f')](_0x31e978[_0x526b('0x39')][_0x526b('0x1f')]);_0x8a201b[_0x526b('0x1d')]=qs['offset'](_0x31e978[_0x526b('0x39')][_0x526b('0x1d')]);}_0x8a201b[_0x526b('0x40')]=qs[_0x526b('0x41')](_0x31e978[_0x526b('0x39')][_0x526b('0x41')]);_0x8a201b[_0x526b('0x42')]=qs[_0x526b('0x3a')](_[_0x526b('0x43')](_0x31e978['query'],_0x42bb4f[_0x526b('0x3a')]),_0xe9ea91);var _0x1134ca=[];var _0xa1bfd1=squel[_0x526b('0x44')]()[_0x526b('0x45')]('id')[_0x526b('0x45')](_0x526b('0x29'))['field'](_0x526b('0x46'))['from'](_0x526b('0x47'));var _0x4353a3=squel['select']()[_0x526b('0x45')]('u.id')[_0x526b('0x45')](_0x526b('0x48'))[_0x526b('0x45')](_0x526b('0x49'))[_0x526b('0x4a')](_0x526b('0x4b'),'ui')[_0x526b('0x4c')](_0x526b('0x4d'),'u',_0x526b('0x4e'));var _0x50d04e=squel['select']()[_0x526b('0x4a')](_0x526b('0x4f'),'i')[_0x526b('0x4c')]('cm_contacts','c',_0x526b('0x50'))['left_join'](_0x526b('0x4d'),'o',_0x526b('0x51'))[_0x526b('0x4c')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0x526b('0x4c')]('sms_messages','me',_0x526b('0x52'))['left_join']('sms_interaction_has_tags','it',_0x526b('0x53'))[_0x526b('0x4c')](_0x526b('0x47'),'t','t.id\x20=\x20it.TagId');var _0x1e91d3=squel[_0x526b('0x54')]();var _0x2385bb=[];var _0x3aac42=squel[_0x526b('0x54')]();var _0xcfb600;if(_0x31e978[_0x526b('0x39')][_0x526b('0x55')]){_0xcfb600=as[_0x526b('0x56')](_0x31e978[_0x526b('0x39')][_0x526b('0x55')]);var _0x463656=_0xcfb600[_0x526b('0x57')];for(var _0x4817a0=0x0;_0x4817a0<_0xcfb600['conditions'][_0x526b('0x3d')];_0x4817a0++){var _0x42a76b=_0xcfb600[_0x526b('0x58')][_0x4817a0];var _0x31f55d='i';var _0xa22b07=_[_0x526b('0x59')](_0xe9ea91,[_0x526b('0x29'),_0x42a76b[_0x526b('0x45')]]);if(!_0xa22b07){switch(_0x42a76b[_0x526b('0x45')]){case _0x526b('0x5a'):if(_0x42a76b[_0x526b('0x5b')]==0x1){_0x50d04e[_0x526b('0x5c')]('`'+_0x42a76b['field']+_0x526b('0x5d'));}else{_0x50d04e[_0x526b('0x5c')]('`'+_0x42a76b['field']+_0x526b('0x5e'));}break;case _0x526b('0x5f'):if(_0x42a76b[_0x526b('0x60')]===_0x526b('0x61')){if(_0x42a76b[_0x526b('0x5b')][_0x526b('0x2f')]('\x20')[_0x526b('0x3d')]>0x1){_0x1e91d3[_0x463656](_0x526b('0x62'),qs[_0x526b('0x63')](_0x42a76b[_0x526b('0x5b')]),null);}else{var _0x10a101='%'+_0x42a76b[_0x526b('0x5b')]+'%';_0x1e91d3[_0x463656](_0x526b('0x64'),_0x10a101,_0x10a101,_0x10a101);}}else{_0xa22b07=_['find'](_0xe9ea91,['name','ContactId']);_0x42a76b[_0x526b('0x45')]=_0x526b('0x65');_0x3fb988=as['buildExpression'](_0x31f55d,_0xa22b07[_0x526b('0x36')],_0x42a76b);_0x1e91d3[_0x463656](_0x3fb988['text'],_0x3fb988[_0x526b('0x5b')]['start'],_0x3fb988[_0x526b('0x5b')][_0x526b('0x1b')]);}break;case'Tag':var _0x41b45f=_0x42a76b[_0x526b('0x5b')]['split'](',')['map'](function(_0x396ab4){return Number(_0x396ab4);});_0x41b45f[_0x526b('0x30')](function(_0x2a094f){_0x3aac42['or'](_0x526b('0x66'),'%,'+_0x2a094f+',%');});_0x2385bb=_[_0x526b('0x67')](_0x2385bb,_0x41b45f);break;case'User':if(_0x42a76b[_0x526b('0x60')]===_0x526b('0x61')){_0x1e91d3[_0x463656](_0x526b('0x68'),'%'+_0x42a76b['value']+'%',null);}else{_0xa22b07=_[_0x526b('0x59')](_0xe9ea91,[_0x526b('0x29'),_0x526b('0x69')]);_0x42a76b[_0x526b('0x45')]='UserId';_0x3fb988=as[_0x526b('0x6a')](_0x31f55d,_0xa22b07['type'],_0x42a76b);_0x1e91d3[_0x463656](_0x3fb988[_0x526b('0x6b')],_0x3fb988[_0x526b('0x5b')][_0x526b('0x6c')],_0x3fb988[_0x526b('0x5b')][_0x526b('0x1b')]);}break;case _0x526b('0x6d'):_0x3fb988=as['buildExpression']('me',null,_0x42a76b);_0x1e91d3[_0x463656](_0x3fb988[_0x526b('0x6b')],_0x3fb988[_0x526b('0x5b')][_0x526b('0x6c')],_0x3fb988[_0x526b('0x5b')][_0x526b('0x1b')]);break;}}else{var _0x3fb988=as[_0x526b('0x6a')](_0x31f55d,_0xa22b07[_0x526b('0x36')],_0x42a76b);_0x1e91d3[_0x463656](_0x3fb988['text'],_0x3fb988[_0x526b('0x5b')][_0x526b('0x6c')],_0x3fb988[_0x526b('0x5b')]['end']);}}}else{var _0x930d37=_(_0x31e978[_0x526b('0x39')])[_0x526b('0x6e')]()[_0x526b('0x2b')](function(_0x35133d){return _[_0x526b('0x6f')](_0xe9ea91,[_0x526b('0x29'),_0x35133d])?_0x35133d:undefined;})['compact']()[_0x526b('0x5b')]();if(!_[_0x526b('0x70')](_0x930d37)){_0x930d37[_0x526b('0x30')](function(_0x3c3f95){if(_0x3c3f95===_0x526b('0x71')){_0x50d04e[_0x526b('0x42')](_0x526b('0x72'),[]['concat'](_0x31e978[_0x526b('0x39')][_0x3c3f95]));}else if(_0x3c3f95===_0x526b('0x73')){var _0x4fba9e=JSON['parse'](_0x31e978[_0x526b('0x39')][_0x3c3f95])[_0x526b('0x74')];var _0x3de3b7=JSON[_0x526b('0x75')](_0x31e978[_0x526b('0x39')][_0x3c3f95])[_0x526b('0x76')];_0x50d04e['where'](_0x526b('0x77'),_0x4fba9e,_0x3de3b7);}else{if(_0x31e978[_0x526b('0x39')][_0x3c3f95]===_0x526b('0x78')){_0x50d04e[_0x526b('0x42')]('i.'+_0x3c3f95+_0x526b('0x79'));}else{_0x50d04e[_0x526b('0x42')]('i.'+_0x3c3f95+_0x526b('0x7a'),_0x31e978['query'][_0x3c3f95]);}}});}if(_0x31e978[_0x526b('0x39')][_0x526b('0x7b')]){if(_0x31e978[_0x526b('0x39')][_0x526b('0x7b')]==0x1){_0x50d04e[_0x526b('0x5c')](_0x526b('0x7c'));}else{_0x50d04e['having'](_0x526b('0x7d'));}}if(_0x31e978[_0x526b('0x39')]['tag']){_0x2385bb=_[_0x526b('0x7e')](_0x31e978[_0x526b('0x39')]['tag'])?_0x31e978[_0x526b('0x39')][_0x526b('0x7f')]:new Array(_0x31e978[_0x526b('0x39')][_0x526b('0x7f')]);_0x2385bb[_0x526b('0x30')](function(_0x1c3e50){_0x3aac42['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1c3e50+',%');});}if(_0x31e978[_0x526b('0x39')][_0x526b('0x80')]){var _0x5c399f=_0x31e978[_0x526b('0x39')][_0x526b('0x80')]['replace']('\x5c','\x5c\x5c')[_0x526b('0x81')](/'/g,'\x27\x27');if(qs[_0x526b('0x82')](_0x5c399f)){_0x1e91d3['or']('i.id\x20LIKE\x20?',_0x5c399f+'%')['or'](_0x526b('0x83'),_0x5c399f+'%');}else{_0x1e91d3['or'](_0x526b('0x84'),qs['getFullTextValue'](_0x5c399f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5c399f+'%');}}}_0x50d04e[_0x526b('0x42')](_0x1e91d3);_0x50d04e[_0x526b('0x85')](_0x526b('0x86'));var _0x5a050e={'type':db[_0x526b('0x87')][_0x526b('0x88')]['SELECT'],'raw':!![]};var _0x4d8e5c=_0x50d04e[_0x526b('0x89')]();_0x4d8e5c['field'](_0x526b('0x86'));_0x4d8e5c[_0x526b('0x45')](_0x526b('0x8a'),_0x526b('0x5a'));if(_0x8a201b[_0x526b('0x40')]){_0x8a201b[_0x526b('0x40')][_0x526b('0x30')](function(_0x5cbb8c){var _0x5a01aa=_0x5cbb8c[0x0]===_0x526b('0x8b')?_0x5cbb8c[0x0]:'i.'+_0x5cbb8c[0x0];_0x50d04e['order'](_0x5a01aa,_0x5cbb8c[0x1]===_0x526b('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x2385bb)){_0x50d04e[_0x526b('0x5c')](_0x3aac42);_0x4d8e5c[_0x526b('0x42')](_0x526b('0x8d'),_0x2385bb);}BPromise[_0x526b('0x8e')]()[_0x526b('0x26')](function(){if(!_0xcfb600){if(_0x31e978[_0x526b('0x39')]['SmsAccountId'])return;_0x4d8e5c['where'](_0x526b('0x8f'));_0x50d04e[_0x526b('0x42')](_0x526b('0x8f'));return;}if(_0x31e978[_0x526b('0x90')]['role']!==_0x526b('0x91'))return;return _0x31e978['user'][_0x526b('0x92')]({'attributes':['id'],'raw':!![]})[_0x526b('0x26')](function(_0x11f3a6){if(_['isEmpty'](_0x11f3a6)){_0x4d8e5c[_0x526b('0x42')](_0x526b('0x93'));_0x50d04e[_0x526b('0x42')](_0x526b('0x93'));}else{_0x4d8e5c[_0x526b('0x42')](_0x526b('0x72'),_[_0x526b('0x2b')](_0x11f3a6,'id'));_0x50d04e['where'](_0x526b('0x72'),_['map'](_0x11f3a6,'id'));}});})[_0x526b('0x26')](function(){if(_0x31e978['user'][_0x526b('0x94')]===_0x526b('0x91')&&!_0xcfb600&&!_0x31e978[_0x526b('0x39')][_0x526b('0x71')])return[];return db['sequelize'][_0x526b('0x39')](_0x4d8e5c[_0x526b('0x95')](),_0x5a050e);})[_0x526b('0x26')](function(_0x1160d1){_0x313265[_0x526b('0x1e')]=_0x1160d1[_0x526b('0x3d')];if(_0x313265[_0x526b('0x1e')]===0x0)return[];return db[_0x526b('0x96')][_0x526b('0x39')](_0xa1bfd1[_0x526b('0x95')](),_0x5a050e)['then'](function(_0x50214f){_0x1134ca=_[_0x526b('0x97')](_0x50214f,'id');_0x5a050e=_[_0x526b('0x98')](_0x5a050e,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31e978[_0x526b('0x39')][_0x526b('0x99')]){_0x8a201b[_0x526b('0x3c')][_0x526b('0x30')](function(_0x464a92){_0x50d04e['field']('i.'+_0x464a92);});}else{_0x50d04e[_0x526b('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x50d04e[_0x526b('0x45')](_0x526b('0x9a'),'Account.key');_0x50d04e[_0x526b('0x45')](_0x526b('0x9b'),_0x526b('0x9c'));_0x50d04e[_0x526b('0x45')](_0x526b('0x9d'),_0x526b('0x8b'));_0x50d04e[_0x526b('0x45')](_0x526b('0x9e'));_0x50d04e['field'](_0x526b('0x9f'),_0x526b('0xa0'));_0x50d04e[_0x526b('0x45')](_0x526b('0xa1'),_0x526b('0xa2'));_0x50d04e[_0x526b('0x45')](_0x526b('0xa3'),'Contact.email');_0x50d04e[_0x526b('0x45')](_0x526b('0xa4'),_0x526b('0xa5'));_0x50d04e[_0x526b('0x45')]('c.mobile',_0x526b('0xa6'));_0x50d04e[_0x526b('0x45')]('c.fax',_0x526b('0xa7'));_0x50d04e['field'](_0x526b('0xa8'),_0x526b('0xa9'));_0x50d04e[_0x526b('0x45')](_0x526b('0xaa'),_0x526b('0xab'));_0x50d04e[_0x526b('0x45')](_0x526b('0xac'),'TagIds');}if(_0x8a201b[_0x526b('0x1f')])_0x50d04e['limit'](_0x8a201b[_0x526b('0x1f')]);if(_0x8a201b[_0x526b('0x1d')])_0x50d04e['offset'](_0x8a201b[_0x526b('0x1d')]);return db[_0x526b('0x96')][_0x526b('0x39')](_0x50d04e[_0x526b('0x95')](),_0x5a050e);})[_0x526b('0x26')](function(_0x365d38){if(_0x365d38[_0x526b('0x3d')]>0x0)_0x4353a3[_0x526b('0x42')](_0x526b('0xad'),_[_0x526b('0x2b')](_0x365d38,'id'));return db[_0x526b('0x96')][_0x526b('0x39')](_0x4353a3['toString'](),_0x5a050e)[_0x526b('0x26')](function(_0x17a9de){var _0x14e25a=_[_0x526b('0xae')](_0x17a9de,_0x526b('0xaf'));var _0xc2e577=[];_0x365d38['forEach'](function(_0x268abc){_0xc2e577[_0x526b('0x31')](updateSmsInteraction(_0x268abc,_0x1134ca,_0x14e25a));});return BPromise[_0x526b('0xb0')](_0xc2e577);});});})['then'](function(_0x49650c){_0x313265[_0x526b('0xb1')]=_0x49650c;return _0x313265;})['then'](respondWithFilteredResult(_0x361fe2,_0x8a201b))[_0x526b('0xb2')](handleError(_0x361fe2,null));};exports[_0x526b('0xb3')]=function(_0x5c92fb,_0x1e983a){var _0x57e9ca={'raw':![],'where':{'id':_0x5c92fb[_0x526b('0xb4')]['id']}},_0x3dec57={};_0x3dec57[_0x526b('0x38')]=_[_0x526b('0x6e')](db[_0x526b('0x33')][_0x526b('0x34')]);_0x3dec57['query']=_[_0x526b('0x6e')](_0x5c92fb['query']);_0x3dec57[_0x526b('0x3a')]=_[_0x526b('0x3b')](_0x3dec57[_0x526b('0x38')],_0x3dec57['query']);_0x57e9ca['attributes']=_['intersection'](_0x3dec57['model'],qs['fields'](_0x5c92fb[_0x526b('0x39')]['fields']));_0x57e9ca[_0x526b('0x3c')]=_0x57e9ca[_0x526b('0x3c')][_0x526b('0x3d')]?_0x57e9ca[_0x526b('0x3c')]:_0x3dec57[_0x526b('0x38')];if(_0x5c92fb[_0x526b('0x39')][_0x526b('0xb5')]){_0x57e9ca[_0x526b('0xb6')]=[{'all':!![]}];}_0x57e9ca=_[_0x526b('0x98')]({},_0x57e9ca,_0x5c92fb[_0x526b('0xb7')]);return db[_0x526b('0x33')][_0x526b('0x59')](_0x57e9ca)[_0x526b('0x26')](handleEntityNotFound(_0x1e983a,null))[_0x526b('0x26')](respondWithResult(_0x1e983a,null))['catch'](handleError(_0x1e983a,null));};exports['create']=function(_0x4bed72,_0x4141a5){return db[_0x526b('0x33')][_0x526b('0xb8')](_0x4bed72[_0x526b('0x6d')],{})[_0x526b('0x26')](respondWithResult(_0x4141a5,0xc9))[_0x526b('0xb2')](handleError(_0x4141a5,null));};exports[_0x526b('0x25')]=function(_0x247edc,_0x3c703b){if(_0x247edc[_0x526b('0x6d')]['id']){delete _0x247edc[_0x526b('0x6d')]['id'];}return db[_0x526b('0x33')][_0x526b('0x59')]({'where':{'id':_0x247edc[_0x526b('0xb4')]['id']}})[_0x526b('0x26')](handleEntityNotFound(_0x3c703b,null))[_0x526b('0x26')](saveUpdates(_0x247edc[_0x526b('0x6d')],null))[_0x526b('0x26')](respondWithResult(_0x3c703b,null))[_0x526b('0xb2')](handleError(_0x3c703b,null));};exports[_0x526b('0x27')]=function(_0x570c5a,_0x30791c){return db[_0x526b('0x33')][_0x526b('0x59')]({'where':{'id':_0x570c5a[_0x526b('0xb4')]['id']}})[_0x526b('0x26')](handleEntityNotFound(_0x30791c,null))['then'](removeEntity(_0x30791c,null))['catch'](handleError(_0x30791c,null));};exports[_0x526b('0xb9')]=function(_0x473011,_0x143e9e){return db[_0x526b('0x33')][_0x526b('0xb9')]()[_0x526b('0x26')](respondWithResult(_0x143e9e,null))[_0x526b('0xb2')](handleError(_0x143e9e,null));};exports['addMessage']=function(_0x3589b0,_0x553c46,_0x4c36ac){return db['SmsMessage'][_0x526b('0x59')]({'where':{'id':_0x3589b0[_0x526b('0xb4')]['id']}})[_0x526b('0x26')](handleEntityNotFound(_0x553c46,null))[_0x526b('0x26')](function(_0x177733){if(_0x177733){return _0x177733[_0x526b('0xba')](_0x3589b0[_0x526b('0x6d')][_0x526b('0xbb')],_[_0x526b('0xbc')](_0x3589b0['body'],[_0x526b('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x553c46,null))[_0x526b('0xb2')](handleError(_0x553c46,null));};exports[_0x526b('0xbd')]=function(_0xe436ca,_0x4c83e8,_0x15c6ff){var _0x2835d0={'raw':![],'where':{}};var _0xf57bb6={};var _0x557082={'count':0x0,'rows':[]};return db[_0x526b('0x33')][_0x526b('0xbe')]({'where':{'id':_0xe436ca['params']['id']}})[_0x526b('0x26')](handleEntityNotFound(_0x4c83e8,null))[_0x526b('0x26')](function(_0x23c3fc){if(_0x23c3fc){_0xf57bb6[_0x526b('0x38')]=_[_0x526b('0x6e')](db[_0x526b('0xbf')][_0x526b('0x34')]);_0xf57bb6[_0x526b('0x39')]=_[_0x526b('0x6e')](_0xe436ca[_0x526b('0x39')]);_0xf57bb6[_0x526b('0x3a')]=_[_0x526b('0x3b')](_0xf57bb6[_0x526b('0x38')],_0xf57bb6[_0x526b('0x39')]);_0x2835d0[_0x526b('0x3c')]=_[_0x526b('0x3b')](_0xf57bb6[_0x526b('0x38')],qs['fields'](_0xe436ca[_0x526b('0x39')]['fields']));_0x2835d0[_0x526b('0x3c')]=_0x2835d0[_0x526b('0x3c')][_0x526b('0x3d')]?_0x2835d0[_0x526b('0x3c')]:_0xf57bb6[_0x526b('0x38')];if(!_0xe436ca['query'][_0x526b('0x3e')](_0x526b('0x3f'))){_0x2835d0[_0x526b('0x1f')]=qs[_0x526b('0x1f')](_0xe436ca[_0x526b('0x39')][_0x526b('0x1f')]);_0x2835d0['offset']=qs['offset'](_0xe436ca[_0x526b('0x39')][_0x526b('0x1d')]);}_0x2835d0[_0x526b('0x40')]=qs[_0x526b('0x41')](_0xe436ca[_0x526b('0x39')][_0x526b('0x41')]);_0x2835d0['where']=qs[_0x526b('0x3a')](_[_0x526b('0x43')](_0xe436ca[_0x526b('0x39')],_0xf57bb6[_0x526b('0x3a')]));_0x2835d0[_0x526b('0x42')]['SmsInteractionId']=_0x23c3fc['id'];if(_0xe436ca[_0x526b('0x39')]['filter']){_0x2835d0[_0x526b('0x42')]=_[_0x526b('0x98')](_0x2835d0[_0x526b('0x42')],{'$or':_['map'](_0x2835d0[_0x526b('0x3c')],function(_0x5ef6c1){var _0x4d16b0={};_0x4d16b0[_0x5ef6c1]={'$like':'%'+_0xe436ca['query']['filter']+'%'};return _0x4d16b0;})});}if(_0xe436ca[_0x526b('0x39')][_0x526b('0x74')]){var _0x5775df=_0xe436ca[_0x526b('0x39')]['$gte'][_0x526b('0x2f')](',');var _0x47f542={};_0x47f542[_0x5775df[0x0]]={'$gte':moment(_0x5775df[0x1])[_0x526b('0xc0')](_0x526b('0xc1'))};_0x2835d0[_0x526b('0x42')]=_['merge'](_0x2835d0['where'],_0x47f542);}_0x2835d0=_[_0x526b('0x98')]({},_0x2835d0,_0xe436ca['options']);return db['SmsMessage']['count']({'where':_0x2835d0['where']})[_0x526b('0x26')](function(_0x240ade){_0x557082[_0x526b('0x1e')]=_0x240ade;if(_0xe436ca[_0x526b('0x39')][_0x526b('0xb5')]){_0x2835d0[_0x526b('0xb6')]=[{'all':!![]}];}return db[_0x526b('0xbf')][_0x526b('0xc2')](_0x2835d0);})[_0x526b('0x26')](function(_0x59a294){_0x557082[_0x526b('0xb1')]=_0x59a294;return _0x557082;});}})[_0x526b('0x26')](respondWithFilteredResult(_0x4c83e8,_0x2835d0))['catch'](handleError(_0x4c83e8,null));};exports['addTags']=function(_0x2f76e1,_0x213631,_0x4da019){return db['SmsInteraction']['find']({'where':{'id':_0x2f76e1[_0x526b('0xb4')]['id']}})['then'](handleEntityNotFound(_0x213631,null))[_0x526b('0x26')](function(_0x1543d0){if(_0x1543d0){return _0x1543d0[_0x526b('0xc3')](_0x2f76e1[_0x526b('0x6d')][_0x526b('0xbb')],_[_0x526b('0xbc')](_0x2f76e1['body'],[_0x526b('0xbb'),'id'])||{})[_0x526b('0xc4')](function(){return db[_0x526b('0xc5')][_0x526b('0xc2')]({'attributes':['id','name',_0x526b('0x46')],'where':{'id':_0x2f76e1[_0x526b('0x6d')][_0x526b('0xbb')]}});})[_0x526b('0x26')](function(_0x2a63d7){socket[_0x526b('0xc6')]('smsInteractionTags:save',{'id':Number(_0x2f76e1[_0x526b('0xb4')]['id']),'tags':_0x2a63d7||[]});return{'id':Number(_0x2f76e1[_0x526b('0xb4')]['id']),'tags':_0x2a63d7||[]};});}})[_0x526b('0x26')](respondWithResult(_0x213631,null))[_0x526b('0xb2')](handleError(_0x213631,null));};exports[_0x526b('0xc7')]=function(_0x8e12e3,_0xedd210,_0x216790){return db['SmsInteraction'][_0x526b('0x59')]({'where':{'id':_0x8e12e3[_0x526b('0xb4')]['id']}})[_0x526b('0x26')](handleEntityNotFound(_0xedd210,null))[_0x526b('0x26')](function(_0x45d81f){if(_0x45d81f){return _0x45d81f[_0x526b('0xc7')](_0x8e12e3['query'][_0x526b('0xbb')]);}})[_0x526b('0x26')](respondWithStatusCode(_0xedd210,null))[_0x526b('0xb2')](handleError(_0xedd210,null));};exports[_0x526b('0xc8')]=function(_0x14ee17,_0x189af5){var _0x437183=moment()[_0x526b('0xc9')]()['toString']();var _0x5d517f=path[_0x526b('0xca')](config[_0x526b('0xcb')],_0x526b('0xcc'),_0x526b('0xcd'),'tmp');var _0x4a2ffb=path[_0x526b('0xca')](config[_0x526b('0xcb')],_0x526b('0xcc'),'files',_0x526b('0xce'));var _0x5c2f9e=path[_0x526b('0xca')](_0x5d517f,_0x437183);var _0x2ee720=util[_0x526b('0xc0')](_0x526b('0xcf'),_0x14ee17[_0x526b('0xb4')]['id'],_0x437183);var _0x7a7016=path[_0x526b('0xca')](_0x5d517f,_0x2ee720);var _0x1f0465=[];_0x1f0465[_0x526b('0x31')]({'model':db['User'],'as':_0x526b('0xd0'),'attributes':['id',_0x526b('0x2c')],'raw':!![]});_0x1f0465[_0x526b('0x31')]({'model':db[_0x526b('0xd1')],'as':_0x526b('0x5f'),'attributes':['id',_0x526b('0xd2'),'lastName'],'raw':!![]});var _0x1ac25d=[{'model':db[_0x526b('0xbf')],'as':_0x526b('0xd3'),'attributes':['id',_0x526b('0x6d'),'createdAt',_0x526b('0xd4'),_0x526b('0xd5'),_0x526b('0x7b')],'include':_0x1f0465}];_0x1ac25d[_0x526b('0x31')]({'model':db[_0x526b('0xd6')],'as':_0x526b('0xd7'),'attributes':['id',_0x526b('0x29')]});_0x1ac25d['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x526b('0x2c')]});return db[_0x526b('0x33')]['find']({'where':{'id':_0x14ee17['params']['id']},'include':_0x1ac25d})[_0x526b('0x26')](handleEntityNotFound(_0x189af5,null))[_0x526b('0x26')](function(_0x24d6d7){if(_0x24d6d7){var _0x1f9955=_0x24d6d7[_0x526b('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x5c2f9e);var _0x5187a1={'channel':'Sms','account':_0x1f9955[_0x526b('0xd7')][_0x526b('0x29')],'agent':_0x1f9955['Owner']?_0x1f9955[_0x526b('0xd9')]['fullname']:_0x526b('0xda'),'createdAt':moment(_0x1f9955[_0x526b('0x73')])[_0x526b('0xc0')](_0x526b('0xc1'))['toString'](),'closedAt':_0x1f9955[_0x526b('0xdb')]?moment(_0x1f9955[_0x526b('0xdc')])[_0x526b('0xc0')](_0x526b('0xc1'))[_0x526b('0x95')]():'','disposition':_0x1f9955[_0x526b('0xdd')],'messages':_(_0x1f9955['Messages'])[_0x526b('0x80')]({'secret':![]})[_0x526b('0x2b')](function(_0x11b363){return{'date':moment(_0x11b363[_0x526b('0x73')])[_0x526b('0xc0')](_0x526b('0xc1'))[_0x526b('0x95')](),'sender':_0x11b363['direction']===_0x526b('0xde')?_0x11b363[_0x526b('0xd0')]?_0x11b363['User'][_0x526b('0x2c')]:'System':_0x11b363[_0x526b('0x5f')]['firstName']+(_0x11b363[_0x526b('0x5f')][_0x526b('0xdf')]?'\x20'+_0x11b363['Contact'][_0x526b('0xdf')]:''),'body':_0x11b363['body'],'direction':_0x11b363[_0x526b('0xd4')]===_0x526b('0xde')?'A':'C','secret':_0x11b363['secret'],'read':_0x11b363[_0x526b('0x7b')]};})[_0x526b('0x5b')]()};return ejs[_0x526b('0xe0')](path[_0x526b('0xca')](config[_0x526b('0xcb')],_0x526b('0xcc'),'views',_0x526b('0xe1')),{'interaction':_0x5187a1})['then'](function(_0x14bbcf){var _0x433744=path[_0x526b('0xca')](_0x5c2f9e,_0x526b('0xe2')+_0x1f9955['id']+'-'+_0x437183+_0x526b('0xe3'));var _0x530ebf={'path':_0x433744,'channel':_0x526b('0xe4'),'interactionId':_0x1f9955['id']};return pdf[_0x526b('0xe5')](_0x14bbcf,_0x530ebf);})['then'](function(){return new BPromise(function(_0x41d0a9,_0x157232){zipdir(_0x5c2f9e,{'saveTo':_0x7a7016},function(_0x3ad183,_0x37dec9){if(_0x3ad183)return _0x157232(_0x3ad183);return _0x41d0a9(_0x37dec9);});})[_0x526b('0x26')](function(){return new BPromise(function(_0x23aae7,_0x11bbc){rimraf(_0x5c2f9e,function(_0x2aafb8){if(_0x2aafb8)_0x11bbc(_0x2aafb8);return _0x23aae7();});});})[_0x526b('0x26')](function(){return _0x189af5[_0x526b('0xc8')](_0x7a7016,_0x2ee720,function(_0x190476){if(_0x190476){console['log'](_0x526b('0xe6'),_0x190476);}else{fs[_0x526b('0xe7')](_0x7a7016);}});});});}else{return _0x189af5[_0x526b('0x19')](0xc8);}})['catch'](handleError(_0x189af5,null));}; \ No newline at end of file +var _0x0ea2=['user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','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','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','groupBy','all','rows','catch','show','params','includeAll','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','merge','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','smsInteractionTags:save','removeTags','download','unix','tmp','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','secret','Account','fullname','mkdirSync','Sms','Owner','N.A.','createdAt','closed','System','firstName','out','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','TagIds','split','Tags','push','then','index','SmsInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId'];(function(_0x83736e,_0x50ab9a){var _0x2db4f6=function(_0x2c7617){while(--_0x2c7617){_0x83736e['push'](_0x83736e['shift']());}};_0x2db4f6(++_0x50ab9a);}(_0x0ea2,0x189));var _0x20ea=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x0ea2[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require(_0x20ea('0x0'));var rimraf=require(_0x20ea('0x1'));var zipdir=require(_0x20ea('0x2'));var jsonpatch=require(_0x20ea('0x3'));var rp=require('request-promise');var moment=require(_0x20ea('0x4'));var BPromise=require(_0x20ea('0x5'));var Mustache=require(_0x20ea('0x6'));var util=require(_0x20ea('0x7'));var path=require(_0x20ea('0x8'));var sox=require(_0x20ea('0x9'));var csv=require(_0x20ea('0xa'));var ejs=require(_0x20ea('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20ea('0xc'));var squel=require(_0x20ea('0xd'));var crypto=require('crypto');var jsforce=require(_0x20ea('0xe'));var deskjs=require(_0x20ea('0xf'));var toCsv=require('to-csv');var querystring=require(_0x20ea('0x10'));var Papa=require(_0x20ea('0x11'));var Redis=require(_0x20ea('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x20ea('0x13'));var pdf=require(_0x20ea('0x14'));var hardwareService=require(_0x20ea('0x15'));var logger=require('../../config/logger')(_0x20ea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x20ea('0x17'));var db=require(_0x20ea('0x18'))['db'];config[_0x20ea('0x19')]=_[_0x20ea('0x1a')](config[_0x20ea('0x19')],{'host':_0x20ea('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x20ea('0x1c'))[_0x20ea('0x1d')](socket);function respondWithStatusCode(_0x3bc1aa,_0x831704){_0x831704=_0x831704||0xcc;return function(_0x5c127a){if(_0x5c127a){return _0x3bc1aa[_0x20ea('0x1e')](_0x831704);}return _0x3bc1aa[_0x20ea('0x1f')](_0x831704)[_0x20ea('0x20')]();};}function respondWithResult(_0x29a79f,_0x456266){_0x456266=_0x456266||0xc8;return function(_0x2a6a66){if(_0x2a6a66){return _0x29a79f[_0x20ea('0x1f')](_0x456266)[_0x20ea('0x21')](_0x2a6a66);}};}function respondWithFilteredResult(_0x4ee9bd,_0x2a87a0){return function(_0x4fb5e4){if(_0x4fb5e4){var _0xeb0888=typeof _0x2a87a0['offset']===_0x20ea('0x22')&&typeof _0x2a87a0[_0x20ea('0x23')]===_0x20ea('0x22');var _0x24ba01=_0x4fb5e4[_0x20ea('0x24')];var _0x3688cf=_0xeb0888?0x0:_0x2a87a0[_0x20ea('0x25')];var _0x37f802=_0xeb0888?_0x4fb5e4[_0x20ea('0x24')]:_0x2a87a0[_0x20ea('0x25')]+_0x2a87a0['limit'];var _0xecc372;if(_0x37f802>=_0x24ba01){_0x37f802=_0x24ba01;_0xecc372=0xc8;}else{_0xecc372=0xce;}_0x4ee9bd['status'](_0xecc372);return _0x4ee9bd[_0x20ea('0x26')](_0x20ea('0x27'),_0x3688cf+'-'+_0x37f802+'/'+_0x24ba01)[_0x20ea('0x21')](_0x4fb5e4);}return null;};}function patchUpdates(_0x46a533){return function(_0x1593d2){try{jsonpatch[_0x20ea('0x28')](_0x1593d2,_0x46a533,!![]);}catch(_0x1a8ff6){return BPromise[_0x20ea('0x29')](_0x1a8ff6);}return _0x1593d2[_0x20ea('0x2a')]();};}function saveUpdates(_0x1601e8,_0x14e6ca){return function(_0x51a855){if(_0x51a855){return _0x51a855[_0x20ea('0x2b')](_0x1601e8)['then'](function(_0x40db28){return _0x40db28;});}return null;};}function removeEntity(_0x3ee9cb,_0x39fdfe){return function(_0x1dbf1a){if(_0x1dbf1a){return _0x1dbf1a[_0x20ea('0x2c')]()['then'](function(){_0x3ee9cb[_0x20ea('0x1f')](0xcc)[_0x20ea('0x20')]();});}};}function handleEntityNotFound(_0x1e1a80,_0xe81aa0){return function(_0x5e9a64){if(!_0x5e9a64){_0x1e1a80[_0x20ea('0x1e')](0x194);}return _0x5e9a64;};}function handleError(_0x4f4810,_0x1550d1){_0x1550d1=_0x1550d1||0x1f4;return function(_0x1a0e0b){logger['error'](_0x1a0e0b[_0x20ea('0x2d')]);if(_0x1a0e0b['name']){delete _0x1a0e0b[_0x20ea('0x2e')];}_0x4f4810[_0x20ea('0x1f')](_0x1550d1)[_0x20ea('0x2f')](_0x1a0e0b);};}function getInteractionUsers(_0x1a2957,_0x170797){return new BPromise(function(_0x1a6d93,_0x5498a6){try{if(_0x170797[_0x1a2957['id']]){_0x1a2957['Users']=_[_0x20ea('0x30')](_0x170797[_0x1a2957['id']],function(_0x5c669d){return{'id':_0x5c669d['id'],'fullname':_0x5c669d['fullname']};});}}catch(_0x4b112f){_0x5498a6(_0x4b112f);}_0x1a6d93(_0x1a2957);});}function getInteractionTags(_0x217cf7,_0x29204a){return new BPromise(function(_0x1ef8ba,_0x7bc0f1){try{if(_0x217cf7[_0x20ea('0x31')]){_0x217cf7['Tags']=[];_0x217cf7[_0x20ea('0x31')][_0x20ea('0x32')](',')['forEach'](function(_0x229031){_0x217cf7[_0x20ea('0x33')][_0x20ea('0x34')](_0x29204a[_0x229031]);});}delete _0x217cf7[_0x20ea('0x31')];}catch(_0x216fe5){_0x7bc0f1(_0x216fe5);}_0x1ef8ba(_0x217cf7);});}function updateSmsInteraction(_0x47a140,_0x13511f,_0x3c9f46){return new BPromise(function(_0x537682,_0x4fabe8){return getInteractionUsers(_0x47a140,_0x3c9f46)['then'](function(_0x412d04){return getInteractionTags(_0x412d04,_0x13511f);})[_0x20ea('0x35')](function(_0x498ae6){_0x537682(_0x498ae6);})['catch'](function(_0x1a7e85){_0x4fabe8(_0x1a7e85);});});}exports[_0x20ea('0x36')]=function(_0x3de48a,_0x433cbc){var _0x3688e6={},_0x4dc400={},_0x143ba1={'count':0x0,'rows':[]};var _0x3ff73f=_[_0x20ea('0x30')](db[_0x20ea('0x37')][_0x20ea('0x38')],function(_0xe6c059){return{'name':_0xe6c059[_0x20ea('0x39')],'type':_0xe6c059[_0x20ea('0x3a')][_0x20ea('0x3b')]};});_0x4dc400[_0x20ea('0x3c')]=_['map'](_0x3ff73f,_0x20ea('0x2e'));_0x4dc400['query']=_[_0x20ea('0x3d')](_0x3de48a[_0x20ea('0x3e')]);_0x4dc400['filters']=_[_0x20ea('0x3f')](_0x4dc400[_0x20ea('0x3c')],_0x4dc400[_0x20ea('0x3e')]);_0x3688e6[_0x20ea('0x40')]=_[_0x20ea('0x3f')](_0x4dc400[_0x20ea('0x3c')],qs[_0x20ea('0x41')](_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x41')]));_0x3688e6[_0x20ea('0x40')]=_0x3688e6[_0x20ea('0x40')][_0x20ea('0x42')]?_0x3688e6[_0x20ea('0x40')]:_0x4dc400[_0x20ea('0x3c')];if(!_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x43')](_0x20ea('0x44'))){_0x3688e6[_0x20ea('0x23')]=qs[_0x20ea('0x23')](_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x23')]);_0x3688e6[_0x20ea('0x25')]=qs[_0x20ea('0x25')](_0x3de48a['query'][_0x20ea('0x25')]);}_0x3688e6[_0x20ea('0x45')]=qs[_0x20ea('0x46')](_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x46')]);_0x3688e6[_0x20ea('0x47')]=qs[_0x20ea('0x48')](_[_0x20ea('0x49')](_0x3de48a[_0x20ea('0x3e')],_0x4dc400[_0x20ea('0x48')]),_0x3ff73f);var _0x1fc9e1=[];var _0x354ce2=squel[_0x20ea('0x4a')]()[_0x20ea('0x4b')]('id')[_0x20ea('0x4b')](_0x20ea('0x2e'))[_0x20ea('0x4b')](_0x20ea('0x4c'))[_0x20ea('0x4d')](_0x20ea('0x4e'));var _0x448f58=squel[_0x20ea('0x4a')]()[_0x20ea('0x4b')]('u.id')['field'](_0x20ea('0x4f'))[_0x20ea('0x4b')](_0x20ea('0x50'))[_0x20ea('0x4d')](_0x20ea('0x51'),'ui')[_0x20ea('0x52')](_0x20ea('0x53'),'u',_0x20ea('0x54'));var _0x39789f=squel['select']()[_0x20ea('0x4d')](_0x20ea('0x55'),'i')[_0x20ea('0x52')](_0x20ea('0x56'),'c',_0x20ea('0x57'))[_0x20ea('0x52')](_0x20ea('0x53'),'o',_0x20ea('0x58'))[_0x20ea('0x52')]('sms_accounts','a',_0x20ea('0x59'))['left_join']('sms_messages','me',_0x20ea('0x5a'))[_0x20ea('0x52')](_0x20ea('0x5b'),'it',_0x20ea('0x5c'))[_0x20ea('0x52')](_0x20ea('0x4e'),'t',_0x20ea('0x5d'));var _0x4f6453=squel[_0x20ea('0x5e')]();var _0x2f67d3=[];var _0x1d6bc5=squel[_0x20ea('0x5e')]();var _0x1fc7f0;if(_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x5f')]){_0x1fc7f0=as[_0x20ea('0x60')](_0x3de48a[_0x20ea('0x3e')]['search']);var _0x378bc0=_0x1fc7f0['sqlOperator'];for(var _0x448344=0x0;_0x448344<_0x1fc7f0[_0x20ea('0x61')][_0x20ea('0x42')];_0x448344++){var _0x34c7d6=_0x1fc7f0[_0x20ea('0x61')][_0x448344];var _0x4faeea='i';var _0x342fc9=_[_0x20ea('0x62')](_0x3ff73f,['name',_0x34c7d6[_0x20ea('0x4b')]]);if(!_0x342fc9){switch(_0x34c7d6[_0x20ea('0x4b')]){case _0x20ea('0x63'):if(_0x34c7d6['value']==0x1){_0x39789f[_0x20ea('0x64')]('`'+_0x34c7d6[_0x20ea('0x4b')]+_0x20ea('0x65'));}else{_0x39789f[_0x20ea('0x64')]('`'+_0x34c7d6['field']+_0x20ea('0x66'));}break;case _0x20ea('0x67'):if(_0x34c7d6[_0x20ea('0x68')]===_0x20ea('0x69')){if(_0x34c7d6[_0x20ea('0x6a')]['split']('\x20')[_0x20ea('0x42')]>0x1){_0x4f6453[_0x378bc0](_0x20ea('0x6b'),qs[_0x20ea('0x6c')](_0x34c7d6[_0x20ea('0x6a')]),null);}else{var _0x3c9f5f='%'+_0x34c7d6[_0x20ea('0x6a')]+'%';_0x4f6453[_0x378bc0](_0x20ea('0x6d'),_0x3c9f5f,_0x3c9f5f,_0x3c9f5f);}}else{_0x342fc9=_[_0x20ea('0x62')](_0x3ff73f,[_0x20ea('0x2e'),'ContactId']);_0x34c7d6[_0x20ea('0x4b')]=_0x20ea('0x6e');_0x116eb3=as[_0x20ea('0x6f')](_0x4faeea,_0x342fc9[_0x20ea('0x3a')],_0x34c7d6);_0x4f6453[_0x378bc0](_0x116eb3[_0x20ea('0x70')],_0x116eb3[_0x20ea('0x6a')][_0x20ea('0x71')],_0x116eb3[_0x20ea('0x6a')][_0x20ea('0x20')]);}break;case _0x20ea('0x72'):var _0x36f1a1=_0x34c7d6['value']['split'](',')[_0x20ea('0x30')](function(_0x4e84f5){return Number(_0x4e84f5);});_0x36f1a1[_0x20ea('0x73')](function(_0x1d397d){_0x1d6bc5['or'](_0x20ea('0x74'),'%,'+_0x1d397d+',%');});_0x2f67d3=_['union'](_0x2f67d3,_0x36f1a1);break;case _0x20ea('0x75'):if(_0x34c7d6[_0x20ea('0x68')]===_0x20ea('0x69')){_0x4f6453[_0x378bc0](_0x20ea('0x76'),'%'+_0x34c7d6[_0x20ea('0x6a')]+'%',null);}else{_0x342fc9=_[_0x20ea('0x62')](_0x3ff73f,[_0x20ea('0x2e'),_0x20ea('0x77')]);_0x34c7d6[_0x20ea('0x4b')]='UserId';_0x116eb3=as[_0x20ea('0x6f')](_0x4faeea,_0x342fc9[_0x20ea('0x3a')],_0x34c7d6);_0x4f6453[_0x378bc0](_0x116eb3[_0x20ea('0x70')],_0x116eb3[_0x20ea('0x6a')][_0x20ea('0x71')],_0x116eb3['value'][_0x20ea('0x20')]);}break;case _0x20ea('0x78'):_0x116eb3=as[_0x20ea('0x6f')]('me',null,_0x34c7d6);_0x4f6453[_0x378bc0](_0x116eb3['text'],_0x116eb3[_0x20ea('0x6a')][_0x20ea('0x71')],_0x116eb3[_0x20ea('0x6a')][_0x20ea('0x20')]);break;}}else{var _0x116eb3=as[_0x20ea('0x6f')](_0x4faeea,_0x342fc9[_0x20ea('0x3a')],_0x34c7d6);_0x4f6453[_0x378bc0](_0x116eb3[_0x20ea('0x70')],_0x116eb3[_0x20ea('0x6a')][_0x20ea('0x71')],_0x116eb3[_0x20ea('0x6a')]['end']);}}}else{var _0x2cafbe=_(_0x3de48a[_0x20ea('0x3e')])['keys']()[_0x20ea('0x30')](function(_0x4d4776){return _[_0x20ea('0x79')](_0x3ff73f,['name',_0x4d4776])?_0x4d4776:undefined;})[_0x20ea('0x7a')]()[_0x20ea('0x6a')]();if(!_[_0x20ea('0x7b')](_0x2cafbe)){_0x2cafbe[_0x20ea('0x73')](function(_0x3e41a1){if(_0x3e41a1===_0x20ea('0x7c')){_0x39789f[_0x20ea('0x47')](_0x20ea('0x7d'),[][_0x20ea('0x7e')](_0x3de48a['query'][_0x3e41a1]));}else if(_0x3e41a1==='createdAt'){var _0x16176f=JSON['parse'](_0x3de48a[_0x20ea('0x3e')][_0x3e41a1])[_0x20ea('0x7f')];var _0x4758f7=JSON['parse'](_0x3de48a['query'][_0x3e41a1])[_0x20ea('0x80')];_0x39789f['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16176f,_0x4758f7);}else{if(_0x3de48a[_0x20ea('0x3e')][_0x3e41a1]===_0x20ea('0x81')){_0x39789f[_0x20ea('0x47')]('i.'+_0x3e41a1+'\x20IS\x20NULL');}else{_0x39789f[_0x20ea('0x47')]('i.'+_0x3e41a1+_0x20ea('0x82'),_0x3de48a['query'][_0x3e41a1]);}}});}if(_0x3de48a['query'][_0x20ea('0x83')]){if(_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x83')]==0x1){_0x39789f['having'](_0x20ea('0x84'));}else{_0x39789f[_0x20ea('0x64')](_0x20ea('0x85'));}}if(_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x86')]){_0x2f67d3=_[_0x20ea('0x87')](_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x86')])?_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x86')]:new Array(_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x86')]);_0x2f67d3[_0x20ea('0x73')](function(_0xf6cf44){_0x1d6bc5['or'](_0x20ea('0x74'),'%,'+_0xf6cf44+',%');});}if(_0x3de48a['query']['filter']){var _0x583a92=_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x88')]['replace']('\x5c','\x5c\x5c')[_0x20ea('0x89')](/'/g,'\x27\x27');if(qs[_0x20ea('0x8a')](_0x583a92)){_0x4f6453['or'](_0x20ea('0x8b'),_0x583a92+'%')['or'](_0x20ea('0x8c'),_0x583a92+'%');}else{_0x4f6453['or'](_0x20ea('0x8d'),qs['getFullTextValue'](_0x583a92))['or'](_0x20ea('0x8e'),_0x583a92+'%');}}}_0x39789f[_0x20ea('0x47')](_0x4f6453);_0x39789f[_0x20ea('0x8f')]('i.id');var _0x30ba34={'type':db['Sequelize'][_0x20ea('0x90')][_0x20ea('0x91')],'raw':!![]};var _0x20ee4c=_0x39789f[_0x20ea('0x92')]();_0x20ee4c[_0x20ea('0x4b')](_0x20ea('0x93'));_0x20ee4c[_0x20ea('0x4b')](_0x20ea('0x94'),_0x20ea('0x63'));if(_0x3688e6[_0x20ea('0x45')]){_0x3688e6[_0x20ea('0x45')][_0x20ea('0x73')](function(_0x17e307){var _0x222e94=_0x17e307[0x0]===_0x20ea('0x95')?_0x17e307[0x0]:'i.'+_0x17e307[0x0];_0x39789f['order'](_0x222e94,_0x17e307[0x1]===_0x20ea('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x2f67d3)){_0x39789f[_0x20ea('0x64')](_0x1d6bc5);_0x20ee4c[_0x20ea('0x47')](_0x20ea('0x97'),_0x2f67d3);}BPromise[_0x20ea('0x98')]()['then'](function(){if(!_0x1fc7f0){if(_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x7c')])return;_0x20ee4c[_0x20ea('0x47')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x39789f[_0x20ea('0x47')](_0x20ea('0x99'));return;}if(_0x3de48a[_0x20ea('0x9a')]['role']!==_0x20ea('0x9b'))return;return _0x3de48a[_0x20ea('0x9a')][_0x20ea('0x9c')]({'attributes':['id'],'raw':!![]})[_0x20ea('0x35')](function(_0x1d034c){if(_[_0x20ea('0x7b')](_0x1d034c)){_0x20ee4c[_0x20ea('0x47')](_0x20ea('0x9d'));_0x39789f['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x20ee4c[_0x20ea('0x47')]('i.SmsAccountId\x20IN\x20?',_[_0x20ea('0x30')](_0x1d034c,'id'));_0x39789f[_0x20ea('0x47')](_0x20ea('0x7d'),_['map'](_0x1d034c,'id'));}});})['then'](function(){if(_0x3de48a[_0x20ea('0x9a')][_0x20ea('0x9e')]===_0x20ea('0x9b')&&!_0x1fc7f0&&!_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x7c')])return[];return db[_0x20ea('0x9f')][_0x20ea('0x3e')](_0x20ee4c[_0x20ea('0xa0')](),_0x30ba34);})[_0x20ea('0x35')](function(_0x37bc3b){_0x143ba1[_0x20ea('0x24')]=_0x37bc3b[_0x20ea('0x42')];if(_0x143ba1[_0x20ea('0x24')]===0x0)return[];return db['sequelize']['query'](_0x354ce2[_0x20ea('0xa0')](),_0x30ba34)['then'](function(_0x89f529){_0x1fc9e1=_[_0x20ea('0xa1')](_0x89f529,'id');_0x30ba34=_['merge'](_0x30ba34,{'model':db[_0x20ea('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3de48a[_0x20ea('0x3e')][_0x20ea('0x41')]){_0x3688e6[_0x20ea('0x40')]['forEach'](function(_0x54ca92){_0x39789f['field']('i.'+_0x54ca92);});}else{_0x39789f[_0x20ea('0x4b')](_0x20ea('0x94'),_0x20ea('0x63'));_0x39789f['field'](_0x20ea('0xa2'),'Account.key');_0x39789f[_0x20ea('0x4b')](_0x20ea('0xa3'),_0x20ea('0xa4'));_0x39789f[_0x20ea('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',_0x20ea('0x95'));_0x39789f[_0x20ea('0x4b')](_0x20ea('0xa5'));_0x39789f[_0x20ea('0x4b')](_0x20ea('0xa6'),_0x20ea('0xa7'));_0x39789f[_0x20ea('0x4b')](_0x20ea('0xa8'),'Contact.lastName');_0x39789f[_0x20ea('0x4b')](_0x20ea('0xa9'),_0x20ea('0xaa'));_0x39789f[_0x20ea('0x4b')](_0x20ea('0xab'),_0x20ea('0xac'));_0x39789f[_0x20ea('0x4b')](_0x20ea('0xad'),_0x20ea('0xae'));_0x39789f['field'](_0x20ea('0xaf'),_0x20ea('0xb0'));_0x39789f[_0x20ea('0x4b')](_0x20ea('0xb1'),'Owner.fullname');_0x39789f['field'](_0x20ea('0xb2'),'Owner.internal');_0x39789f[_0x20ea('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x20ea('0x31'));}if(_0x3688e6[_0x20ea('0x23')])_0x39789f[_0x20ea('0x23')](_0x3688e6[_0x20ea('0x23')]);if(_0x3688e6[_0x20ea('0x25')])_0x39789f[_0x20ea('0x25')](_0x3688e6[_0x20ea('0x25')]);return db[_0x20ea('0x9f')][_0x20ea('0x3e')](_0x39789f[_0x20ea('0xa0')](),_0x30ba34);})['then'](function(_0x5c4d17){if(_0x5c4d17['length']>0x0)_0x448f58[_0x20ea('0x47')]('ui.SmsInteractionId\x20IN\x20?',_['map'](_0x5c4d17,'id'));return db[_0x20ea('0x9f')][_0x20ea('0x3e')](_0x448f58[_0x20ea('0xa0')](),_0x30ba34)[_0x20ea('0x35')](function(_0x4df517){var _0x147c6c=_[_0x20ea('0xb3')](_0x4df517,'SmsInteractionId');var _0x54c83b=[];_0x5c4d17['forEach'](function(_0x50b46c){_0x54c83b[_0x20ea('0x34')](updateSmsInteraction(_0x50b46c,_0x1fc9e1,_0x147c6c));});return BPromise[_0x20ea('0xb4')](_0x54c83b);});});})[_0x20ea('0x35')](function(_0x4c2018){_0x143ba1[_0x20ea('0xb5')]=_0x4c2018;return _0x143ba1;})[_0x20ea('0x35')](respondWithFilteredResult(_0x433cbc,_0x3688e6))[_0x20ea('0xb6')](handleError(_0x433cbc,null));};exports[_0x20ea('0xb7')]=function(_0x7a7a67,_0x4f052c){var _0x30c89a={'raw':![],'where':{'id':_0x7a7a67[_0x20ea('0xb8')]['id']}},_0x576895={};_0x576895['model']=_['keys'](db['SmsInteraction'][_0x20ea('0x38')]);_0x576895[_0x20ea('0x3e')]=_['keys'](_0x7a7a67[_0x20ea('0x3e')]);_0x576895[_0x20ea('0x48')]=_[_0x20ea('0x3f')](_0x576895[_0x20ea('0x3c')],_0x576895['query']);_0x30c89a[_0x20ea('0x40')]=_[_0x20ea('0x3f')](_0x576895[_0x20ea('0x3c')],qs[_0x20ea('0x41')](_0x7a7a67['query'][_0x20ea('0x41')]));_0x30c89a[_0x20ea('0x40')]=_0x30c89a[_0x20ea('0x40')][_0x20ea('0x42')]?_0x30c89a[_0x20ea('0x40')]:_0x576895[_0x20ea('0x3c')];if(_0x7a7a67[_0x20ea('0x3e')][_0x20ea('0xb9')]){_0x30c89a['include']=[{'all':!![]}];}_0x30c89a=_['merge']({},_0x30c89a,_0x7a7a67[_0x20ea('0xba')]);return db[_0x20ea('0x37')][_0x20ea('0x62')](_0x30c89a)[_0x20ea('0x35')](handleEntityNotFound(_0x4f052c,null))[_0x20ea('0x35')](respondWithResult(_0x4f052c,null))[_0x20ea('0xb6')](handleError(_0x4f052c,null));};exports[_0x20ea('0xbb')]=function(_0x352966,_0x588d07){return db['SmsInteraction'][_0x20ea('0xbb')](_0x352966[_0x20ea('0x78')],{})['then'](respondWithResult(_0x588d07,0xc9))[_0x20ea('0xb6')](handleError(_0x588d07,null));};exports[_0x20ea('0x2b')]=function(_0xe9915,_0x7f93a7){if(_0xe9915[_0x20ea('0x78')]['id']){delete _0xe9915['body']['id'];}return db[_0x20ea('0x37')][_0x20ea('0x62')]({'where':{'id':_0xe9915[_0x20ea('0xb8')]['id']}})[_0x20ea('0x35')](handleEntityNotFound(_0x7f93a7,null))[_0x20ea('0x35')](saveUpdates(_0xe9915['body'],null))['then'](respondWithResult(_0x7f93a7,null))[_0x20ea('0xb6')](handleError(_0x7f93a7,null));};exports[_0x20ea('0x2c')]=function(_0x1b6b94,_0x281b45){return db[_0x20ea('0x37')][_0x20ea('0x62')]({'where':{'id':_0x1b6b94['params']['id']}})['then'](handleEntityNotFound(_0x281b45,null))[_0x20ea('0x35')](removeEntity(_0x281b45,null))[_0x20ea('0xb6')](handleError(_0x281b45,null));};exports[_0x20ea('0xbc')]=function(_0x48c389,_0x3cda4e){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x3cda4e,null))[_0x20ea('0xb6')](handleError(_0x3cda4e,null));};exports[_0x20ea('0xbd')]=function(_0x43065b,_0x6de3b7,_0x2e0ead){return db[_0x20ea('0xbe')][_0x20ea('0x62')]({'where':{'id':_0x43065b['params']['id']}})[_0x20ea('0x35')](handleEntityNotFound(_0x6de3b7,null))[_0x20ea('0x35')](function(_0x264f35){if(_0x264f35){return _0x264f35[_0x20ea('0xbd')](_0x43065b[_0x20ea('0x78')][_0x20ea('0xbf')],_[_0x20ea('0xc0')](_0x43065b['body'],[_0x20ea('0xbf'),'id'])||{});}})[_0x20ea('0x35')](respondWithResult(_0x6de3b7,null))[_0x20ea('0xb6')](handleError(_0x6de3b7,null));};exports[_0x20ea('0xc1')]=function(_0x474b5d,_0x4a15a0,_0x57db4a){var _0xdb9130={'raw':![],'where':{}};var _0x22dac0={};var _0x301ac4={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x20ea('0xc2')]({'where':{'id':_0x474b5d['params']['id']}})[_0x20ea('0x35')](handleEntityNotFound(_0x4a15a0,null))[_0x20ea('0x35')](function(_0x192695){if(_0x192695){_0x22dac0[_0x20ea('0x3c')]=_[_0x20ea('0x3d')](db[_0x20ea('0xbe')][_0x20ea('0x38')]);_0x22dac0['query']=_['keys'](_0x474b5d[_0x20ea('0x3e')]);_0x22dac0[_0x20ea('0x48')]=_[_0x20ea('0x3f')](_0x22dac0[_0x20ea('0x3c')],_0x22dac0[_0x20ea('0x3e')]);_0xdb9130[_0x20ea('0x40')]=_['intersection'](_0x22dac0[_0x20ea('0x3c')],qs[_0x20ea('0x41')](_0x474b5d[_0x20ea('0x3e')][_0x20ea('0x41')]));_0xdb9130[_0x20ea('0x40')]=_0xdb9130['attributes'][_0x20ea('0x42')]?_0xdb9130['attributes']:_0x22dac0[_0x20ea('0x3c')];if(!_0x474b5d[_0x20ea('0x3e')][_0x20ea('0x43')](_0x20ea('0x44'))){_0xdb9130['limit']=qs[_0x20ea('0x23')](_0x474b5d['query'][_0x20ea('0x23')]);_0xdb9130[_0x20ea('0x25')]=qs[_0x20ea('0x25')](_0x474b5d[_0x20ea('0x3e')][_0x20ea('0x25')]);}_0xdb9130[_0x20ea('0x45')]=qs[_0x20ea('0x46')](_0x474b5d[_0x20ea('0x3e')][_0x20ea('0x46')]);_0xdb9130[_0x20ea('0x47')]=qs[_0x20ea('0x48')](_['pick'](_0x474b5d[_0x20ea('0x3e')],_0x22dac0[_0x20ea('0x48')]));_0xdb9130[_0x20ea('0x47')]['SmsInteractionId']=_0x192695['id'];if(_0x474b5d[_0x20ea('0x3e')][_0x20ea('0x88')]){_0xdb9130[_0x20ea('0x47')]=_[_0x20ea('0xc3')](_0xdb9130[_0x20ea('0x47')],{'$or':_[_0x20ea('0x30')](_0xdb9130[_0x20ea('0x40')],function(_0x57a393){var _0x80bd7c={};_0x80bd7c[_0x57a393]={'$like':'%'+_0x474b5d[_0x20ea('0x3e')]['filter']+'%'};return _0x80bd7c;})});}if(_0x474b5d[_0x20ea('0x3e')][_0x20ea('0x7f')]){var _0x5d8f66=_0x474b5d['query'][_0x20ea('0x7f')]['split'](',');var _0x5ac2a6={};_0x5ac2a6[_0x5d8f66[0x0]]={'$gte':moment(_0x5d8f66[0x1])[_0x20ea('0xc4')](_0x20ea('0xc5'))};_0xdb9130[_0x20ea('0x47')]=_[_0x20ea('0xc3')](_0xdb9130[_0x20ea('0x47')],_0x5ac2a6);}_0xdb9130=_[_0x20ea('0xc3')]({},_0xdb9130,_0x474b5d[_0x20ea('0xba')]);return db[_0x20ea('0xbe')]['count']({'where':_0xdb9130[_0x20ea('0x47')]})[_0x20ea('0x35')](function(_0x43b7b2){_0x301ac4[_0x20ea('0x24')]=_0x43b7b2;if(_0x474b5d[_0x20ea('0x3e')][_0x20ea('0xb9')]){_0xdb9130['include']=[{'all':!![]}];}return db[_0x20ea('0xbe')]['findAll'](_0xdb9130);})[_0x20ea('0x35')](function(_0x2a56cc){_0x301ac4[_0x20ea('0xb5')]=_0x2a56cc;return _0x301ac4;});}})['then'](respondWithFilteredResult(_0x4a15a0,_0xdb9130))[_0x20ea('0xb6')](handleError(_0x4a15a0,null));};exports[_0x20ea('0xc6')]=function(_0x4f2772,_0xa8509e,_0x296c47){return db[_0x20ea('0x37')][_0x20ea('0x62')]({'where':{'id':_0x4f2772[_0x20ea('0xb8')]['id']}})[_0x20ea('0x35')](handleEntityNotFound(_0xa8509e,null))['then'](function(_0x30f43d){if(_0x30f43d){return _0x30f43d[_0x20ea('0xc7')](_0x4f2772['body'][_0x20ea('0xbf')],_['omit'](_0x4f2772[_0x20ea('0x78')],[_0x20ea('0xbf'),'id'])||{})[_0x20ea('0xc8')](function(){return db[_0x20ea('0x72')][_0x20ea('0xc9')]({'attributes':['id',_0x20ea('0x2e'),_0x20ea('0x4c')],'where':{'id':_0x4f2772[_0x20ea('0x78')][_0x20ea('0xbf')]}});})[_0x20ea('0x35')](function(_0x1b7843){socket[_0x20ea('0xca')](_0x20ea('0xcb'),{'id':Number(_0x4f2772[_0x20ea('0xb8')]['id']),'tags':_0x1b7843||[]});return{'id':Number(_0x4f2772[_0x20ea('0xb8')]['id']),'tags':_0x1b7843||[]};});}})[_0x20ea('0x35')](respondWithResult(_0xa8509e,null))[_0x20ea('0xb6')](handleError(_0xa8509e,null));};exports[_0x20ea('0xcc')]=function(_0x4e59fa,_0x36f2ad,_0x45bb5a){return db[_0x20ea('0x37')][_0x20ea('0x62')]({'where':{'id':_0x4e59fa[_0x20ea('0xb8')]['id']}})[_0x20ea('0x35')](handleEntityNotFound(_0x36f2ad,null))[_0x20ea('0x35')](function(_0x396b0d){if(_0x396b0d){return _0x396b0d['removeTags'](_0x4e59fa['query'][_0x20ea('0xbf')]);}})[_0x20ea('0x35')](respondWithStatusCode(_0x36f2ad,null))[_0x20ea('0xb6')](handleError(_0x36f2ad,null));};exports[_0x20ea('0xcd')]=function(_0x2f41d0,_0x1fc8ee){var _0x24a5a8=moment()[_0x20ea('0xce')]()['toString']();var _0x8c2ba1=path['join'](config['root'],'server','files',_0x20ea('0xcf'));var _0x14bd52=path[_0x20ea('0xd0')](config[_0x20ea('0xd1')],_0x20ea('0xd2'),_0x20ea('0xd3'),_0x20ea('0xd4'));var _0xaf3079=path[_0x20ea('0xd0')](_0x8c2ba1,_0x24a5a8);var _0xac2f11=util[_0x20ea('0xc4')](_0x20ea('0xd5'),_0x2f41d0[_0x20ea('0xb8')]['id'],_0x24a5a8);var _0x4411f6=path[_0x20ea('0xd0')](_0x8c2ba1,_0xac2f11);var _0x4dc7b4=[];_0x4dc7b4[_0x20ea('0x34')]({'model':db[_0x20ea('0x75')],'as':_0x20ea('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x4dc7b4[_0x20ea('0x34')]({'model':db[_0x20ea('0xd6')],'as':'Contact','attributes':['id','firstName',_0x20ea('0xd7')],'raw':!![]});var _0x3512e1=[{'model':db[_0x20ea('0xbe')],'as':_0x20ea('0xd8'),'attributes':['id',_0x20ea('0x78'),'createdAt',_0x20ea('0xd9'),_0x20ea('0xda'),_0x20ea('0x83')],'include':_0x4dc7b4}];_0x3512e1[_0x20ea('0x34')]({'model':db['SmsAccount'],'as':_0x20ea('0xdb'),'attributes':['id',_0x20ea('0x2e')]});_0x3512e1[_0x20ea('0x34')]({'model':db[_0x20ea('0x75')],'as':'Owner','attributes':['id',_0x20ea('0xdc')]});return db['SmsInteraction'][_0x20ea('0x62')]({'where':{'id':_0x2f41d0[_0x20ea('0xb8')]['id']},'include':_0x3512e1})['then'](handleEntityNotFound(_0x1fc8ee,null))['then'](function(_0x3e685c){if(_0x3e685c){var _0x4bacf6=_0x3e685c['get']({'plain':!![]});fs[_0x20ea('0xdd')](_0xaf3079);var _0x5d8c8a={'channel':_0x20ea('0xde'),'account':_0x4bacf6[_0x20ea('0xdb')][_0x20ea('0x2e')],'agent':_0x4bacf6['Owner']?_0x4bacf6[_0x20ea('0xdf')][_0x20ea('0xdc')]:_0x20ea('0xe0'),'createdAt':moment(_0x4bacf6[_0x20ea('0xe1')])[_0x20ea('0xc4')](_0x20ea('0xc5'))['toString'](),'closedAt':_0x4bacf6[_0x20ea('0xe2')]?moment(_0x4bacf6['closedAt'])[_0x20ea('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x20ea('0xa0')]():'','disposition':_0x4bacf6['disposition'],'messages':_(_0x4bacf6['Messages'])[_0x20ea('0x88')]({'secret':![]})[_0x20ea('0x30')](function(_0x4d68e6){return{'date':moment(_0x4d68e6[_0x20ea('0xe1')])[_0x20ea('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4d68e6[_0x20ea('0xd9')]==='out'?_0x4d68e6[_0x20ea('0x75')]?_0x4d68e6[_0x20ea('0x75')][_0x20ea('0xdc')]:_0x20ea('0xe3'):_0x4d68e6[_0x20ea('0x67')][_0x20ea('0xe4')]+(_0x4d68e6[_0x20ea('0x67')]['lastName']?'\x20'+_0x4d68e6['Contact'][_0x20ea('0xd7')]:''),'body':_0x4d68e6[_0x20ea('0x78')],'direction':_0x4d68e6['direction']===_0x20ea('0xe5')?'A':'C','secret':_0x4d68e6['secret'],'read':_0x4d68e6[_0x20ea('0x83')]};})[_0x20ea('0x6a')]()};return ejs[_0x20ea('0xe6')](path[_0x20ea('0xd0')](config[_0x20ea('0xd1')],_0x20ea('0xd2'),'views','downloadInteraction.ejs'),{'interaction':_0x5d8c8a})['then'](function(_0x5bd175){var _0x4cdeb1=path[_0x20ea('0xd0')](_0xaf3079,_0x20ea('0xe7')+_0x4bacf6['id']+'-'+_0x24a5a8+_0x20ea('0xe8'));var _0x5e8669={'path':_0x4cdeb1,'channel':_0x20ea('0xde'),'interactionId':_0x4bacf6['id']};return pdf[_0x20ea('0xe9')](_0x5bd175,_0x5e8669);})[_0x20ea('0x35')](function(){return new BPromise(function(_0x4065b8,_0x277e81){zipdir(_0xaf3079,{'saveTo':_0x4411f6},function(_0x1f4161,_0x418b99){if(_0x1f4161)return _0x277e81(_0x1f4161);return _0x4065b8(_0x418b99);});})[_0x20ea('0x35')](function(){return new BPromise(function(_0x53a3e8,_0x3053ab){rimraf(_0xaf3079,function(_0x319fb8){if(_0x319fb8)_0x3053ab(_0x319fb8);return _0x53a3e8();});});})[_0x20ea('0x35')](function(){return _0x1fc8ee[_0x20ea('0xcd')](_0x4411f6,_0xac2f11,function(_0x3dca68){if(_0x3dca68){console[_0x20ea('0xea')](_0x20ea('0xeb'),_0x3dca68);}else{fs[_0x20ea('0xec')](_0x4411f6);}});});});}else{return _0x1fc8ee[_0x20ea('0x1e')](0xc8);}})[_0x20ea('0xb6')](handleError(_0x1fc8ee,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9eeafea..5c27678 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 _0xf61e=['exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x20c878,_0x26a58d){var _0x5637b9=function(_0x63d368){while(--_0x63d368){_0x20c878['push'](_0x20c878['shift']());}};_0x5637b9(++_0x26a58d);}(_0xf61e,0x191));var _0xef61=function(_0x1b1ad4,_0x105af8){_0x1b1ad4=_0x1b1ad4-0x0;var _0x2f6f7c=_0xf61e[_0x1b1ad4];return _0x2f6f7c;};'use strict';var EventEmitter=require(_0xef61('0x0'));var SmsInteraction=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var SmsMessage=require(_0xef61('0x1'))['db'][_0xef61('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xef61('0x4')](0x0);var events={'afterCreate':_0xef61('0x5'),'afterUpdate':_0xef61('0x6'),'afterDestroy':_0xef61('0x7')};function emitEvent(_0x14122a){return function(_0x239fa9,_0x45a18d,_0x5b00b2){_0x239fa9[_0xef61('0x8')]({'attributes':['id'],'raw':!![]})[_0xef61('0x9')](function(_0x4f0cc5){_0x239fa9[_0xef61('0xa')](_0xef61('0xb'),_0x4f0cc5[_0xef61('0xc')](function(_0x4dba00){return{'id':_0x4dba00['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x239fa9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef61('0x9')](function(_0x2e28c7){_0x239fa9[_0xef61('0xa')](_0xef61('0xd'),_0x2e28c7[_0xef61('0xe')]);SmsInteractionEvents[_0xef61('0xf')](_0x14122a+':'+_0x239fa9['id'],_0x239fa9);SmsInteractionEvents[_0xef61('0xf')](_0x14122a,_0x239fa9);_0x5b00b2(null);})[_0xef61('0x10')](_0x5b00b2(null));};}for(var e in events){if(events[_0xef61('0x11')](e)){var event=events[e];SmsInteraction[_0xef61('0x12')](e,emitEvent(event));}}module[_0xef61('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0xaebd=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events'];(function(_0xa0e629,_0x36300f){var _0x29659c=function(_0x5df6a3){while(--_0x5df6a3){_0xa0e629['push'](_0xa0e629['shift']());}};_0x29659c(++_0x36300f);}(_0xaebd,0x1e9));var _0xdaeb=function(_0xac675f,_0x5e100e){_0xac675f=_0xac675f-0x0;var _0x4362b9=_0xaebd[_0xac675f];return _0x4362b9;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xdaeb('0x1')];var SmsMessage=require(_0xdaeb('0x2'))['db'][_0xdaeb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xdaeb('0x4')](0x0);var events={'afterCreate':_0xdaeb('0x5'),'afterUpdate':'update','afterDestroy':_0xdaeb('0x6')};function emitEvent(_0x1c617a){return function(_0x1a99be,_0x1141fe,_0xee94f9){_0x1a99be['getUsers']({'attributes':['id'],'raw':!![]})[_0xdaeb('0x7')](function(_0x3f7ba1){_0x1a99be['setDataValue']('Users',_0x3f7ba1[_0xdaeb('0x8')](function(_0x11b164){return{'id':_0x11b164['id']};}));return SmsMessage[_0xdaeb('0x9')]({'where':{'SmsInteractionId':_0x1a99be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xbb4b72){_0x1a99be['setDataValue'](_0xdaeb('0xa'),_0xbb4b72['length']);SmsInteractionEvents[_0xdaeb('0xb')](_0x1c617a+':'+_0x1a99be['id'],_0x1a99be);SmsInteractionEvents['emit'](_0x1c617a,_0x1a99be);_0xee94f9(null);})[_0xdaeb('0xc')](_0xee94f9(null));};}for(var e in events){if(events[_0xdaeb('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 544e287..41a47e7 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 _0x4751=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed'];(function(_0x4d7968,_0x2ddef7){var _0x3b3495=function(_0x378d92){while(--_0x378d92){_0x4d7968['push'](_0x4d7968['shift']());}};_0x3b3495(++_0x2ddef7);}(_0x4751,0x8b));var _0x1475=function(_0x9e2d79,_0x5cbcda){_0x9e2d79=_0x9e2d79-0x0;var _0x38d224=_0x4751[_0x9e2d79];return _0x38d224;};'use strict';var _=require(_0x1475('0x0'));var util=require(_0x1475('0x1'));var logger=require(_0x1475('0x2'))(_0x1475('0x3'));var moment=require('moment');var BPromise=require(_0x1475('0x4'));var rp=require(_0x1475('0x5'));var fs=require('fs');var path=require(_0x1475('0x6'));var rimraf=require(_0x1475('0x7'));var config=require(_0x1475('0x8'));var attributes=require(_0x1475('0x9'));module['exports']=function(_0x122e5b,_0x45b610){return _0x122e5b[_0x1475('0xa')](_0x1475('0xb'),attributes,{'tableName':_0x1475('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c2bd9,_0x49d95a,_0x5931a4){if(_0x5c2bd9[_0x1475('0xd')](_0x1475('0xe'))){_0x5c2bd9[_0x1475('0xf')]=moment()['format'](_0x1475('0x10'));}_0x5931a4(null,_0x5c2bd9);}}});}; \ No newline at end of file +var _0xbbce=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x2dfba7,_0x116f68){var _0xdf34b6=function(_0x11269e){while(--_0x11269e){_0x2dfba7['push'](_0x2dfba7['shift']());}};_0xdf34b6(++_0x116f68);}(_0xbbce,0xbd));var _0xebbc=function(_0x4a94fb,_0x4a9122){_0x4a94fb=_0x4a94fb-0x0;var _0x360176=_0xbbce[_0x4a94fb];return _0x360176;};'use strict';var _=require(_0xebbc('0x0'));var util=require(_0xebbc('0x1'));var logger=require(_0xebbc('0x2'))(_0xebbc('0x3'));var moment=require(_0xebbc('0x4'));var BPromise=require(_0xebbc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xebbc('0x6'));var config=require(_0xebbc('0x7'));var attributes=require('./smsInteraction.attributes');module[_0xebbc('0x8')]=function(_0x339333,_0x58cc35){return _0x339333[_0xebbc('0x9')](_0xebbc('0xa'),attributes,{'tableName':_0xebbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50cf25,_0xbd8a11,_0x295f68){if(_0x50cf25[_0xebbc('0xc')](_0xebbc('0xd'))){_0x50cf25[_0xebbc('0xe')]=moment()[_0xebbc('0xf')](_0xebbc('0x10'));}_0x295f68(null,_0x50cf25);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 1189cf8..4a47157 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 _0x8e5d=['rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','limit','AddTagsToSmsInteraction','body','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4d28f7,_0x3b2a38){var _0x4579aa=function(_0x494122){while(--_0x494122){_0x4d28f7['push'](_0x4d28f7['shift']());}};_0x4579aa(++_0x3b2a38);}(_0x8e5d,0x139));var _0xd8e5=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x8e5d[_0x308213];return _0x2e1619;};'use strict';var _=require('lodash');var util=require(_0xd8e5('0x0'));var moment=require(_0xd8e5('0x1'));var BPromise=require(_0xd8e5('0x2'));var rs=require(_0xd8e5('0x3'));var fs=require('fs');var Redis=require(_0xd8e5('0x4'));var db=require(_0xd8e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8e5('0x6'))(_0xd8e5('0x7'));var config=require(_0xd8e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8e5('0x9')][_0xd8e5('0xa')]({'port':0x232a});config[_0xd8e5('0xb')]=_[_0xd8e5('0xc')](config[_0xd8e5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8e5('0xd'))(new Redis(config[_0xd8e5('0xb')]));require(_0xd8e5('0xe'))[_0xd8e5('0xf')](socket);function respondWithRpcPromise(_0x4e9091,_0x98b9c9,_0x5e2b4b){return new BPromise(function(_0x325866,_0x1892d0){return client['request'](_0x4e9091,_0x5e2b4b)[_0xd8e5('0x10')](function(_0x26714e){logger[_0xd8e5('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x98b9c9,_0xd8e5('0x12'));logger[_0xd8e5('0x13')](_0xd8e5('0x14'),_0x98b9c9,_0xd8e5('0x12'),JSON[_0xd8e5('0x15')](_0x26714e));if(_0x26714e['error']){if(_0x26714e[_0xd8e5('0x16')][_0xd8e5('0x17')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x98b9c9,_0x26714e[_0xd8e5('0x16')][_0xd8e5('0x18')]);return _0x1892d0(_0x26714e['error'][_0xd8e5('0x18')]);}logger[_0xd8e5('0x16')](_0xd8e5('0x19'),_0x98b9c9,_0x26714e[_0xd8e5('0x16')]['message']);return _0x325866(_0x26714e[_0xd8e5('0x16')][_0xd8e5('0x18')]);}else{logger[_0xd8e5('0x11')](_0xd8e5('0x19'),_0x98b9c9,_0xd8e5('0x12'));_0x325866(_0x26714e[_0xd8e5('0x1a')][_0xd8e5('0x18')]);}})[_0xd8e5('0x1b')](function(_0x4c4e90){logger['error'](_0xd8e5('0x19'),_0x98b9c9,_0x4c4e90);_0x1892d0(_0x4c4e90);});});}exports[_0xd8e5('0x1c')]=function(_0x1bce98){var _0x495339=this;return new Promise(function(_0x4045ee,_0x1ae897){return db[_0xd8e5('0x1d')][_0xd8e5('0x1e')](_0x1bce98['body'],{'raw':_0x1bce98['options']?_0x1bce98[_0xd8e5('0x1f')][_0xd8e5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bce98[_0xd8e5('0x1f')]?_0x1bce98['options'][_0xd8e5('0x21')]||null:null,'attributes':_0x1bce98[_0xd8e5('0x1f')]?_0x1bce98[_0xd8e5('0x1f')]['attributes']||null:null,'limit':_0x1bce98[_0xd8e5('0x1f')]?_0x1bce98['options'][_0xd8e5('0x22')]||null:null})[_0xd8e5('0x10')](function(_0x3966e8){logger[_0xd8e5('0x11')](_0xd8e5('0x1c'),_0x1bce98);logger[_0xd8e5('0x13')](_0xd8e5('0x1c'),_0x1bce98,JSON[_0xd8e5('0x15')](_0x3966e8));_0x4045ee(_0x3966e8);})[_0xd8e5('0x1b')](function(_0x3383c6){logger[_0xd8e5('0x16')](_0xd8e5('0x1c'),_0x3383c6['message'],_0x1bce98);_0x1ae897(_0x495339['error'](0x1f4,_0x3383c6[_0xd8e5('0x18')]));});});};exports[_0xd8e5('0x23')]=function(_0x36f261){return new Promise(function(_0x58b86c,_0x8da58c){return db['SmsInteraction']['find']({'where':_0x36f261[_0xd8e5('0x1f')]?_0x36f261[_0xd8e5('0x1f')][_0xd8e5('0x21')]||null:null})[_0xd8e5('0x10')](function(_0xcc0f88){if(_0xcc0f88){return _0xcc0f88['addTags'](_0x36f261[_0xd8e5('0x24')][_0xd8e5('0x25')],_['omit'](_0x36f261[_0xd8e5('0x24')],[_0xd8e5('0x25'),'id'])||{});}})[_0xd8e5('0x26')](function(_0xfc848b){logger[_0xd8e5('0x11')](_0xd8e5('0x27'),_0x36f261);logger[_0xd8e5('0x13')](_0xd8e5('0x27'),_0x36f261,JSON[_0xd8e5('0x15')](_0xfc848b));_0x58b86c(_0xfc848b);})[_0xd8e5('0x1b')](function(_0x51acaf){logger[_0xd8e5('0x16')](_0xd8e5('0x27'),_0x51acaf['message'],_0x36f261);_0x8da58c(_this[_0xd8e5('0x16')](0x1f4,_0x51acaf['message']));});});}; \ No newline at end of file +var _0x8f33=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','socket.io-emitter','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f33,0x12b));var _0x38f3=function(_0x589248,_0x31dea3){_0x589248=_0x589248-0x0;var _0x486750=_0x8f33[_0x589248];return _0x486750;};'use strict';var _=require(_0x38f3('0x0'));var util=require('util');var moment=require(_0x38f3('0x1'));var BPromise=require(_0x38f3('0x2'));var rs=require(_0x38f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38f3('0x4'))['db'];var utils=require(_0x38f3('0x5'));var logger=require(_0x38f3('0x6'))(_0x38f3('0x7'));var config=require(_0x38f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38f3('0x9')]['http']({'port':0x232a});config['redis']=_[_0x38f3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x38f3('0xb'))(new Redis(config[_0x38f3('0xc')]));require(_0x38f3('0xd'))[_0x38f3('0xe')](socket);function respondWithRpcPromise(_0x408df6,_0x559f67,_0x4b7356){return new BPromise(function(_0x4d9923,_0x34a58d){return client[_0x38f3('0xf')](_0x408df6,_0x4b7356)[_0x38f3('0x10')](function(_0x2e9103){logger[_0x38f3('0x11')](_0x38f3('0x12'),_0x559f67,_0x38f3('0x13'));logger[_0x38f3('0x14')](_0x38f3('0x15'),_0x559f67,_0x38f3('0x13'),JSON[_0x38f3('0x16')](_0x2e9103));if(_0x2e9103[_0x38f3('0x17')]){if(_0x2e9103[_0x38f3('0x17')][_0x38f3('0x18')]===0x1f4){logger[_0x38f3('0x17')](_0x38f3('0x12'),_0x559f67,_0x2e9103['error']['message']);return _0x34a58d(_0x2e9103[_0x38f3('0x17')][_0x38f3('0x19')]);}logger[_0x38f3('0x17')](_0x38f3('0x12'),_0x559f67,_0x2e9103[_0x38f3('0x17')][_0x38f3('0x19')]);return _0x4d9923(_0x2e9103[_0x38f3('0x17')]['message']);}else{logger['info'](_0x38f3('0x12'),_0x559f67,_0x38f3('0x13'));_0x4d9923(_0x2e9103[_0x38f3('0x1a')]['message']);}})[_0x38f3('0x1b')](function(_0x4f48cb){logger[_0x38f3('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x559f67,_0x4f48cb);_0x34a58d(_0x4f48cb);});});}exports['UpdateSmsInteraction']=function(_0x1a8e8b){var _0x16b947=this;return new Promise(function(_0x2fbcac,_0x2c9fc1){return db[_0x38f3('0x1c')]['update'](_0x1a8e8b['body'],{'raw':_0x1a8e8b[_0x38f3('0x1d')]?_0x1a8e8b[_0x38f3('0x1d')][_0x38f3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a8e8b[_0x38f3('0x1d')]?_0x1a8e8b['options'][_0x38f3('0x1f')]||null:null,'attributes':_0x1a8e8b[_0x38f3('0x1d')]?_0x1a8e8b[_0x38f3('0x1d')][_0x38f3('0x20')]||null:null,'limit':_0x1a8e8b[_0x38f3('0x1d')]?_0x1a8e8b[_0x38f3('0x1d')][_0x38f3('0x21')]||null:null})[_0x38f3('0x10')](function(_0x1e80d3){logger[_0x38f3('0x11')](_0x38f3('0x22'),_0x1a8e8b);logger['debug'](_0x38f3('0x22'),_0x1a8e8b,JSON[_0x38f3('0x16')](_0x1e80d3));_0x2fbcac(_0x1e80d3);})[_0x38f3('0x1b')](function(_0x33b87c){logger['error'](_0x38f3('0x22'),_0x33b87c['message'],_0x1a8e8b);_0x2c9fc1(_0x16b947[_0x38f3('0x17')](0x1f4,_0x33b87c['message']));});});};exports[_0x38f3('0x23')]=function(_0xcae435){return new Promise(function(_0x1c9075,_0x37979b){return db[_0x38f3('0x1c')][_0x38f3('0x24')]({'where':_0xcae435[_0x38f3('0x1d')]?_0xcae435[_0x38f3('0x1d')][_0x38f3('0x1f')]||null:null})[_0x38f3('0x10')](function(_0x153f54){if(_0x153f54){return _0x153f54[_0x38f3('0x25')](_0xcae435[_0x38f3('0x26')][_0x38f3('0x27')],_[_0x38f3('0x28')](_0xcae435[_0x38f3('0x26')],[_0x38f3('0x27'),'id'])||{});}})[_0x38f3('0x29')](function(_0xd3bf79){logger['info'](_0x38f3('0x2a'),_0xcae435);logger[_0x38f3('0x14')]('AddTags',_0xcae435,JSON[_0x38f3('0x16')](_0xd3bf79));_0x1c9075(_0xd3bf79);})[_0x38f3('0x1b')](function(_0x47c82e){logger[_0x38f3('0x17')](_0x38f3('0x2a'),_0x47c82e[_0x38f3('0x19')],_0xcae435);_0x37979b(_this[_0x38f3('0x17')](0x1f4,_0x47c82e[_0x38f3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 88dbe92..b8856e3 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 _0x0000=['register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x562103,_0xa48b0b){var _0x427f9c=function(_0xaa4751){while(--_0xaa4751){_0x562103['push'](_0x562103['shift']());}};_0x427f9c(++_0xa48b0b);}(_0x0000,0x176));var _0x0000=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0000[_0x14add3];return _0x4a174f;};'use strict';var SmsInteractionEvents=require(_0x0000('0x0'));var events=['save',_0x0000('0x1'),_0x0000('0x2')];function createListener(_0x2babca,_0x1ca371){return function(_0x4238b8){_0x1ca371[_0x0000('0x3')](_0x2babca,_0x4238b8);};}function removeListener(_0x16e77f,_0x2259c8){return function(){SmsInteractionEvents['removeListener'](_0x16e77f,_0x2259c8);};}exports[_0x0000('0x4')]=function(_0x2dc622){for(var _0x213b03=0x0,_0x3397a3=events[_0x0000('0x5')];_0x213b03<_0x3397a3;_0x213b03++){var _0x4d8f1c=events[_0x213b03];var _0x8f079d=createListener(_0x0000('0x6')+_0x4d8f1c,_0x2dc622);SmsInteractionEvents['on'](_0x4d8f1c,_0x8f079d);}}; \ No newline at end of file +var _0xc396=['remove','removeListener','register','length','./smsInteraction.events','save'];(function(_0x444168,_0x271bd9){var _0xec12ff=function(_0x1e68cb){while(--_0x1e68cb){_0x444168['push'](_0x444168['shift']());}};_0xec12ff(++_0x271bd9);}(_0xc396,0x1c6));var _0x6c39=function(_0xe1b0b8,_0x42b1af){_0xe1b0b8=_0xe1b0b8-0x0;var _0x27772c=_0xc396[_0xe1b0b8];return _0x27772c;};'use strict';var SmsInteractionEvents=require(_0x6c39('0x0'));var events=[_0x6c39('0x1'),_0x6c39('0x2'),'update'];function createListener(_0x334f63,_0xa61125){return function(_0x147e42){_0xa61125['emit'](_0x334f63,_0x147e42);};}function removeListener(_0x593cf4,_0x8d716d){return function(){SmsInteractionEvents[_0x6c39('0x3')](_0x593cf4,_0x8d716d);};}exports[_0x6c39('0x4')]=function(_0x5249d1){for(var _0x2e397a=0x0,_0x6fa9bc=events[_0x6c39('0x5')];_0x2e397a<_0x6fa9bc;_0x2e397a++){var _0x1f5513=events[_0x2e397a];var _0x215f81=createListener('smsInteraction:'+_0x1f5513,_0x5249d1);SmsInteractionEvents['on'](_0x1f5513,_0x215f81);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a85260d..795649e 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 _0xdd99=['put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update'];(function(_0x29464e,_0x1f69c7){var _0x16eb98=function(_0x1ae9a8){while(--_0x1ae9a8){_0x29464e['push'](_0x29464e['shift']());}};_0x16eb98(++_0x1f69c7);}(_0xdd99,0x146));var _0x9dd9=function(_0xbd478f,_0x546399){_0xbd478f=_0xbd478f-0x0;var _0x418b6d=_0xdd99[_0xbd478f];return _0x418b6d;};'use strict';var multer=require(_0x9dd9('0x0'));var util=require(_0x9dd9('0x1'));var path=require(_0x9dd9('0x2'));var timeout=require('connect-timeout');var express=require(_0x9dd9('0x3'));var router=express['Router']();var fs_extra=require(_0x9dd9('0x4'));var auth=require(_0x9dd9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9dd9('0x6'));var controller=require(_0x9dd9('0x7'));router[_0x9dd9('0x8')]('/',auth[_0x9dd9('0x9')](),controller[_0x9dd9('0xa')]);router['get']('/describe',auth[_0x9dd9('0x9')](),controller[_0x9dd9('0xb')]);router[_0x9dd9('0x8')](_0x9dd9('0xc'),auth[_0x9dd9('0x9')](),controller[_0x9dd9('0xd')]);router[_0x9dd9('0xe')]('/',auth[_0x9dd9('0x9')](),interaction[_0x9dd9('0xf')](_0x9dd9('0x10'),_0x9dd9('0x11')),controller[_0x9dd9('0x12')]);router[_0x9dd9('0xe')](_0x9dd9('0x13'),controller[_0x9dd9('0x14')]);router['put'](_0x9dd9('0xc'),auth[_0x9dd9('0x9')](),controller[_0x9dd9('0x15')]);router[_0x9dd9('0x16')](_0x9dd9('0x17'),auth['isAuthenticated'](),controller['accept']);router[_0x9dd9('0x16')](_0x9dd9('0x18'),auth['isAuthenticated'](),controller[_0x9dd9('0x19')]);router[_0x9dd9('0x1a')](_0x9dd9('0xc'),auth['isAuthenticated'](),controller[_0x9dd9('0x1b')]);module[_0x9dd9('0x1c')]=router; \ No newline at end of file +var _0x2357=['../../components/auth/service','../../components/interaction/service','./smsMessage.controller','index','get','describe','/:id','isAuthenticated','show','post','tracked','sms','put','update','/:id/accept','accept','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x351953,_0x1c24bc){var _0x5ca379=function(_0x2a9d3d){while(--_0x2a9d3d){_0x351953['push'](_0x351953['shift']());}};_0x5ca379(++_0x1c24bc);}(_0x2357,0xa9));var _0x7235=function(_0x1c1f40,_0x21a793){_0x1c1f40=_0x1c1f40-0x0;var _0x5f3de5=_0x2357[_0x1c1f40];return _0x5f3de5;};'use strict';var multer=require('multer');var util=require(_0x7235('0x0'));var path=require(_0x7235('0x1'));var timeout=require(_0x7235('0x2'));var express=require(_0x7235('0x3'));var router=express[_0x7235('0x4')]();var fs_extra=require(_0x7235('0x5'));var auth=require(_0x7235('0x6'));var interaction=require(_0x7235('0x7'));var config=require('../../config/environment');var controller=require(_0x7235('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7235('0x9')]);router[_0x7235('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x7235('0xb')]);router[_0x7235('0xa')](_0x7235('0xc'),auth[_0x7235('0xd')](),controller[_0x7235('0xe')]);router[_0x7235('0xf')]('/',auth[_0x7235('0xd')](),interaction[_0x7235('0x10')](_0x7235('0x11'),'smsmessage:create'),controller['create']);router[_0x7235('0xf')]('/:id/status',controller['status']);router[_0x7235('0x12')](_0x7235('0xc'),auth['isAuthenticated'](),controller[_0x7235('0x13')]);router[_0x7235('0x12')](_0x7235('0x14'),auth[_0x7235('0xd')](),controller[_0x7235('0x15')]);router[_0x7235('0x12')]('/:id/reject',auth[_0x7235('0xd')](),controller['reject']);router[_0x7235('0x16')](_0x7235('0xc'),auth['isAuthenticated'](),controller[_0x7235('0x17')]);module[_0x7235('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1962182..04da812 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 _0xc476=['TEXT','BOOLEAN','out','STRING','DATE','exports'];(function(_0x1e6db4,_0x32d930){var _0x936263=function(_0x24184f){while(--_0x24184f){_0x1e6db4['push'](_0x1e6db4['shift']());}};_0x936263(++_0x32d930);}(_0xc476,0xfb));var _0x6c47=function(_0xa39d41,_0x47cddc){_0xa39d41=_0xa39d41-0x0;var _0x26eff7=_0xc476[_0xa39d41];return _0x26eff7;};'use strict';var Sequelize=require('sequelize');module[_0x6c47('0x0')]={'body':{'type':Sequelize[_0x6c47('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6c47('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6c47('0x3')),'defaultValue':_0x6c47('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6c47('0x4')](0xbe)},'phone':{'type':Sequelize[_0x6c47('0x4')]},'readAt':{'type':Sequelize[_0x6c47('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6c47('0x4')]},'providerResponse':{'type':Sequelize[_0x6c47('0x1')]}}; \ No newline at end of file +var _0x6cae=['sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0x4fff8c,_0x140337){var _0x48634=function(_0x30d0b2){while(--_0x30d0b2){_0x4fff8c['push'](_0x4fff8c['shift']());}};_0x48634(++_0x140337);}(_0x6cae,0xf0));var _0xe6ca=function(_0x39e6cd,_0x1336d3){_0x39e6cd=_0x39e6cd-0x0;var _0x95a708=_0x6cae[_0x39e6cd];return _0x95a708;};'use strict';var Sequelize=require(_0xe6ca('0x0'));module[_0xe6ca('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe6ca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe6ca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe6ca('0x4')]('in',_0xe6ca('0x5')),'defaultValue':_0xe6ca('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe6ca('0x6')](0xbe)},'phone':{'type':Sequelize[_0xe6ca('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe6ca('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe6ca('0x6')]},'providerResponse':{'type':Sequelize[_0xe6ca('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 63c02ae..b18fb2b 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 _0x276d=['include','findAll','rows','show','params','rawAttributes','includeAll','merge','create','find','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','email','internal','agent','manual','SIP/%s','channel','motionChannel','event','EventManager','reject','RejectMessage','rejectMessage','ContactId','SELECT','fullname','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','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','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','where','pick','filter','type','VIRTUAL','options','SmsMessage'];(function(_0x2f44d3,_0x338fae){var _0x328db6=function(_0x21b20d){while(--_0x21b20d){_0x2f44d3['push'](_0x2f44d3['shift']());}};_0x328db6(++_0x338fae);}(_0x276d,0xe3));var _0xd276=function(_0x5c21c9,_0x8cdef){_0x5c21c9=_0x5c21c9-0x0;var _0xe41a99=_0x276d[_0x5c21c9];return _0xe41a99;};'use strict';var emlformat=require(_0xd276('0x0'));var rimraf=require(_0xd276('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd276('0x2'));var rp=require(_0xd276('0x3'));var moment=require(_0xd276('0x4'));var BPromise=require(_0xd276('0x5'));var Mustache=require(_0xd276('0x6'));var util=require(_0xd276('0x7'));var path=require('path');var sox=require(_0xd276('0x8'));var csv=require(_0xd276('0x9'));var ejs=require(_0xd276('0xa'));var fs=require('fs');var fs_extra=require(_0xd276('0xb'));var _=require(_0xd276('0xc'));var squel=require(_0xd276('0xd'));var crypto=require(_0xd276('0xe'));var jsforce=require(_0xd276('0xf'));var deskjs=require(_0xd276('0x10'));var toCsv=require(_0xd276('0x9'));var querystring=require(_0xd276('0x11'));var Papa=require(_0xd276('0x12'));var Redis=require(_0xd276('0x13'));var authService=require(_0xd276('0x14'));var qs=require(_0xd276('0x15'));var as=require(_0xd276('0x16'));var hardwareService=require(_0xd276('0x17'));var logger=require('../../config/logger')(_0xd276('0x18'));var utils=require(_0xd276('0x19'));var config=require(_0xd276('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd276('0x1b'))['db'];config['redis']=_[_0xd276('0x1c')](config[_0xd276('0x1d')],{'host':_0xd276('0x1e'),'port':0x18eb});var socket=require(_0xd276('0x1f'))(new Redis(config[_0xd276('0x1d')]));require(_0xd276('0x20'))['register'](socket);var jayson=require(_0xd276('0x21'));var client=jayson[_0xd276('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xd276('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17149b,_0x5e313f,_0x262421,_0x55ab67){return new BPromise(function(_0x58c1b4,_0x4750a8){var _0x45e372=_0x55ab67||client;return _0x45e372[_0xd276('0x23')](_0x17149b,_0x262421)[_0xd276('0x24')](function(_0x3773af){logger[_0xd276('0x25')](_0xd276('0x26'),_0x5e313f,_0xd276('0x27'));logger[_0xd276('0x28')](_0xd276('0x29'),_0x5e313f,_0xd276('0x27'),JSON[_0xd276('0x2a')](_0x3773af));if(_0x3773af[_0xd276('0x2b')]){if(_0x3773af[_0xd276('0x2b')][_0xd276('0x2c')]===0x1f4){logger['error'](_0xd276('0x26'),_0x5e313f,_0x3773af['error'][_0xd276('0x2d')]);return _0x4750a8(_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);}logger[_0xd276('0x2b')](_0xd276('0x26'),_0x5e313f,_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);return _0x58c1b4(_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);}else{logger[_0xd276('0x25')]('SmsMessage,\x20%s,\x20%s',_0x5e313f,'request\x20sent');_0x58c1b4(_0x3773af[_0xd276('0x2e')][_0xd276('0x2d')]);}})[_0xd276('0x2f')](function(_0x57512e){logger[_0xd276('0x2b')](_0xd276('0x26'),_0x5e313f,_0x57512e);_0x4750a8(_0x57512e);});});}function respondWithStatusCode(_0x14e3a9,_0x44dd84){_0x44dd84=_0x44dd84||0xcc;return function(_0xcb542d){if(_0xcb542d){return _0x14e3a9[_0xd276('0x30')](_0x44dd84);}return _0x14e3a9[_0xd276('0x31')](_0x44dd84)[_0xd276('0x32')]();};}function respondWithResult(_0x1feace,_0x17819f){_0x17819f=_0x17819f||0xc8;return function(_0x54041e){if(_0x54041e){return _0x1feace[_0xd276('0x31')](_0x17819f)[_0xd276('0x33')](_0x54041e);}};}function respondWithFilteredResult(_0x929d9a,_0x6d9cd5){return function(_0x252acc){if(_0x252acc){var _0x58193f=typeof _0x6d9cd5[_0xd276('0x34')]===_0xd276('0x35')&&typeof _0x6d9cd5['limit']==='undefined';var _0xee5357=_0x252acc[_0xd276('0x36')];var _0x13e4cc=_0x58193f?0x0:_0x6d9cd5[_0xd276('0x34')];var _0x3d238b=_0x58193f?_0x252acc[_0xd276('0x36')]:_0x6d9cd5['offset']+_0x6d9cd5['limit'];var _0x4f2e41;if(_0x3d238b>=_0xee5357){_0x3d238b=_0xee5357;_0x4f2e41=0xc8;}else{_0x4f2e41=0xce;}_0x929d9a[_0xd276('0x31')](_0x4f2e41);return _0x929d9a['set'](_0xd276('0x37'),_0x13e4cc+'-'+_0x3d238b+'/'+_0xee5357)[_0xd276('0x33')](_0x252acc);}return null;};}function patchUpdates(_0x1204b0){return function(_0x85d5f2){try{jsonpatch[_0xd276('0x38')](_0x85d5f2,_0x1204b0,!![]);}catch(_0x1600eb){return BPromise['reject'](_0x1600eb);}return _0x85d5f2[_0xd276('0x39')]();};}function saveUpdates(_0x141aa2,_0x4752b8){return function(_0x495a9f){if(_0x495a9f){return _0x495a9f[_0xd276('0x3a')](_0x141aa2)[_0xd276('0x24')](function(_0x4aee1d){return _0x4aee1d;});}return null;};}function removeEntity(_0x42f1b5,_0x19a048){return function(_0xede458){if(_0xede458){return _0xede458[_0xd276('0x3b')]()[_0xd276('0x24')](function(){_0x42f1b5[_0xd276('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13fc4f,_0x13336d){return function(_0x5d7180){if(!_0x5d7180){_0x13fc4f[_0xd276('0x30')](0x194);}return _0x5d7180;};}function handleError(_0x2ff2e9,_0x1c840c){_0x1c840c=_0x1c840c||0x1f4;return function(_0xea2fb4){logger[_0xd276('0x2b')](_0xea2fb4[_0xd276('0x3c')]);if(_0xea2fb4[_0xd276('0x3d')]){delete _0xea2fb4[_0xd276('0x3d')];}_0x2ff2e9[_0xd276('0x31')](_0x1c840c)[_0xd276('0x3e')](_0xea2fb4);};}exports[_0xd276('0x3f')]=function(_0x22cb89,_0x123b34){var _0x5bfaf6={},_0x395afa={},_0x44d7e3={'count':0x0,'rows':[]};var _0x56b82f=_[_0xd276('0x40')](db['SmsMessage']['rawAttributes'],function(_0x225f85){return{'name':_0x225f85[_0xd276('0x41')],'type':_0x225f85['type']['key']};});_0x395afa[_0xd276('0x42')]=_[_0xd276('0x40')](_0x56b82f,'name');_0x395afa['query']=_[_0xd276('0x43')](_0x22cb89['query']);_0x395afa[_0xd276('0x44')]=_[_0xd276('0x45')](_0x395afa['model'],_0x395afa[_0xd276('0x46')]);_0x5bfaf6[_0xd276('0x47')]=_[_0xd276('0x45')](_0x395afa['model'],qs[_0xd276('0x48')](_0x22cb89[_0xd276('0x46')][_0xd276('0x48')]));_0x5bfaf6[_0xd276('0x47')]=_0x5bfaf6['attributes'][_0xd276('0x49')]?_0x5bfaf6[_0xd276('0x47')]:_0x395afa['model'];if(!_0x22cb89[_0xd276('0x46')]['hasOwnProperty'](_0xd276('0x4a'))){_0x5bfaf6[_0xd276('0x4b')]=qs['limit'](_0x22cb89[_0xd276('0x46')]['limit']);_0x5bfaf6[_0xd276('0x34')]=qs['offset'](_0x22cb89['query']['offset']);}_0x5bfaf6['order']=qs['sort'](_0x22cb89['query']['sort']);_0x5bfaf6[_0xd276('0x4c')]=qs[_0xd276('0x44')](_[_0xd276('0x4d')](_0x22cb89[_0xd276('0x46')],_0x395afa[_0xd276('0x44')]),_0x56b82f);if(_0x22cb89['query'][_0xd276('0x4e')]){_0x5bfaf6['where']=_['merge'](_0x5bfaf6[_0xd276('0x4c')],{'$or':_[_0xd276('0x40')](_0x56b82f,function(_0x4d3ae9){if(_0x4d3ae9[_0xd276('0x4f')]!==_0xd276('0x50')){var _0x346f86={};_0x346f86[_0x4d3ae9[_0xd276('0x3d')]]={'$like':'%'+_0x22cb89['query'][_0xd276('0x4e')]+'%'};return _0x346f86;}})});}_0x5bfaf6=_['merge']({},_0x5bfaf6,_0x22cb89[_0xd276('0x51')]);var _0x560248={'where':_0x5bfaf6[_0xd276('0x4c')]};return db[_0xd276('0x52')][_0xd276('0x36')](_0x560248)[_0xd276('0x24')](function(_0x1908ba){_0x44d7e3[_0xd276('0x36')]=_0x1908ba;if(_0x22cb89[_0xd276('0x46')]['includeAll']){_0x5bfaf6[_0xd276('0x53')]=[{'all':!![]}];}return db[_0xd276('0x52')][_0xd276('0x54')](_0x5bfaf6);})['then'](function(_0x37cc4b){_0x44d7e3[_0xd276('0x55')]=_0x37cc4b;return _0x44d7e3;})[_0xd276('0x24')](respondWithFilteredResult(_0x123b34,_0x5bfaf6))[_0xd276('0x2f')](handleError(_0x123b34,null));};exports[_0xd276('0x56')]=function(_0x23d4af,_0x2a24dc){var _0x13ae83={'raw':!![],'where':{'id':_0x23d4af[_0xd276('0x57')]['id']}},_0x23777f={};_0x23777f[_0xd276('0x42')]=_['keys'](db[_0xd276('0x52')][_0xd276('0x58')]);_0x23777f[_0xd276('0x46')]=_[_0xd276('0x43')](_0x23d4af['query']);_0x23777f[_0xd276('0x44')]=_[_0xd276('0x45')](_0x23777f['model'],_0x23777f['query']);_0x13ae83[_0xd276('0x47')]=_[_0xd276('0x45')](_0x23777f[_0xd276('0x42')],qs[_0xd276('0x48')](_0x23d4af[_0xd276('0x46')][_0xd276('0x48')]));_0x13ae83[_0xd276('0x47')]=_0x13ae83[_0xd276('0x47')][_0xd276('0x49')]?_0x13ae83['attributes']:_0x23777f['model'];if(_0x23d4af[_0xd276('0x46')][_0xd276('0x59')]){_0x13ae83[_0xd276('0x53')]=[{'all':!![]}];}_0x13ae83=_[_0xd276('0x5a')]({},_0x13ae83,_0x23d4af[_0xd276('0x51')]);return db[_0xd276('0x52')]['find'](_0x13ae83)['then'](handleEntityNotFound(_0x2a24dc,null))[_0xd276('0x24')](respondWithResult(_0x2a24dc,null))[_0xd276('0x2f')](handleError(_0x2a24dc,null));};exports['create']=function(_0xb5426c,_0x47ffed){return db['SmsMessage'][_0xd276('0x5b')](_0xb5426c['body'],{})[_0xd276('0x24')](respondWithResult(_0x47ffed,0xc9))['catch'](handleError(_0x47ffed,null));};exports['update']=function(_0x1391ed,_0x5dfc87){if(_0x1391ed['body']['id']){delete _0x1391ed['body']['id'];}return db[_0xd276('0x52')][_0xd276('0x5c')]({'where':{'id':_0x1391ed[_0xd276('0x57')]['id']}})[_0xd276('0x24')](handleEntityNotFound(_0x5dfc87,null))['then'](saveUpdates(_0x1391ed[_0xd276('0x5d')],null))[_0xd276('0x24')](respondWithResult(_0x5dfc87,null))[_0xd276('0x2f')](handleError(_0x5dfc87,null));};exports[_0xd276('0x3b')]=function(_0x2f8a0a,_0x5effa7){return db['SmsMessage']['find']({'where':{'id':_0x2f8a0a[_0xd276('0x57')]['id']}})['then'](handleEntityNotFound(_0x5effa7,null))[_0xd276('0x24')](removeEntity(_0x5effa7,null))[_0xd276('0x2f')](handleError(_0x5effa7,null));};exports['describe']=function(_0x2e07c4,_0x445bd6){return db[_0xd276('0x52')][_0xd276('0x5e')]()[_0xd276('0x24')](respondWithResult(_0x445bd6,null))[_0xd276('0x2f')](handleError(_0x445bd6,null));};var interaction_log=require(_0xd276('0x5f'))(_0xd276('0x60'));exports[_0xd276('0x61')]=function(_0x1a28da,_0x274f86,_0x3a1967){var _0x271ecf={'agent':{},'channel':_0xd276('0x62')};if(_0x1a28da[_0xd276('0x5d')]['id']){delete _0x1a28da['body']['id'];}_0x1a28da[_0xd276('0x5d')][_0xd276('0x63')]=!![];_0x1a28da[_0xd276('0x5d')][_0xd276('0x64')]=moment()[_0xd276('0x65')](_0xd276('0x66'));_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')]=_0x1a28da['body']['UserId']||_0x1a28da[_0xd276('0x68')]['id'];_0x271ecf['agent']['id']=_0x1a28da[_0xd276('0x5d')]['UserId'];return db[_0xd276('0x52')]['find']({'where':{'id':_0x1a28da[_0xd276('0x57')]['id'],'UserId':null}})[_0xd276('0x24')](handleEntityNotFound(_0x274f86,null))[_0xd276('0x24')](saveUpdates(_0x1a28da['body'],null))['then'](function(_0x5b305d){if(_0x5b305d){_0x271ecf[_0xd276('0x2d')]=_0x5b305d[_0xd276('0x69')]({'plain':!![]});return db[_0xd276('0x6a')][_0xd276('0x5c')]({'where':{'id':_0x5b305d['SmsInteractionId']}});}return null;})[_0xd276('0x24')](handleEntityNotFound(_0x274f86,null))[_0xd276('0x24')](function(_0x10c81a){if(_0x10c81a){return _0x10c81a['update']({'UserId':_0x1a28da['body'][_0xd276('0x67')],'read1stAt':_[_0xd276('0x6b')](_0x10c81a[_0xd276('0x6c')])?moment()[_0xd276('0x65')](_0xd276('0x66')):undefined});}return null;})[_0xd276('0x24')](function(_0x2d563f){if(_0x2d563f){_0x271ecf[_0xd276('0x6d')]=_0x2d563f['get']({'plain':!![]});interaction_log[_0xd276('0x25')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a28da['user']['id'],_0x1a28da[_0xd276('0x68')]['name'],_0x1a28da[_0xd276('0x68')][_0xd276('0x6e')],_0x271ecf['interaction']['id'],_0x1a28da['body']?JSON[_0xd276('0x2a')](_0x1a28da[_0xd276('0x5d')]):_0xd276('0x6f'));return respondWithRpcPromise(_0xd276('0x70'),_0xd276('0x71'),_0x271ecf);}return null;})[_0xd276('0x24')](function(_0x45f25f){var _0x43d9b5=_0xd276('0x72')+_0x45f25f[_0xd276('0x2d')]['ContactId'];return db[_0xd276('0x73')][_0xd276('0x46')](_0x43d9b5,{'type':db[_0xd276('0x74')][_0xd276('0x75')]['SELECT'],'raw':!![]})['then'](function(_0x3d08ec){return _0x3d08ec;});})['then'](function(_0x444577){if(_0x444577){_0x271ecf[_0xd276('0x2d')][_0xd276('0x76')]=_0x444577[0x0];if(!_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')])return;return db[_0xd276('0x77')][_0xd276('0x5c')]({'where':{'id':_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')],'role':'agent'},'attributes':['id',_0xd276('0x3d'),'fullname',_0xd276('0x78'),_0xd276('0x79')],'raw':!![]});}return null;})[_0xd276('0x24')](function(_0x1cf414){if(!_0x1cf414)return null;_0x271ecf[_0xd276('0x2d')][_0xd276('0x7a')]=_0x1cf414;return _0x271ecf;})[_0xd276('0x24')](function(_0x540b1a){if(_0x540b1a){if(_0x1a28da[_0xd276('0x5d')][_0xd276('0x7b')]){_0x271ecf[_0xd276('0x2d')]['interface']=util[_0xd276('0x65')](_0xd276('0x7c'),_0x1a28da[_0xd276('0x68')][_0xd276('0x3d')]);_0x271ecf[_0xd276('0x2d')][_0xd276('0x7d')]=_0x271ecf[_0xd276('0x7d')];_0x271ecf[_0xd276('0x2d')][_0xd276('0x7e')]=_0x271ecf[_0xd276('0x7d')];_0x271ecf[_0xd276('0x2d')][_0xd276('0x7f')]=_0xd276('0x61');return respondWithRpcPromise(_0xd276('0x80'),_0xd276('0x80'),{'event':'acceptmessage','message':_0x271ecf[_0xd276('0x2d')]},client9002)[_0xd276('0x24')](function(){return _0x271ecf;});}return _0x271ecf;}return null;})['then'](respondWithResult(_0x274f86,null))[_0xd276('0x2f')](handleError(_0x274f86,null));};var interaction_log=require(_0xd276('0x5f'))(_0xd276('0x60'));exports[_0xd276('0x81')]=function(_0x1988d3,_0x1a2a8c,_0x86e4e5){var _0x40db82={'agent':{},'channel':'sms'};if(_0x1988d3[_0xd276('0x5d')]['id']){delete _0x1988d3[_0xd276('0x5d')]['id'];}_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')]=_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')]||_0x1988d3[_0xd276('0x68')]['id'];_0x40db82[_0xd276('0x7a')]['id']=_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')];return db[_0xd276('0x52')][_0xd276('0x5c')]({'where':{'id':_0x1988d3[_0xd276('0x57')]['id'],'UserId':null}})[_0xd276('0x24')](handleEntityNotFound(_0x1a2a8c,null))[_0xd276('0x24')](function(_0x3a67b4){if(_0x3a67b4){_0x40db82[_0xd276('0x2d')]=_0x3a67b4[_0xd276('0x69')]({'plain':!![]});return db[_0xd276('0x6a')][_0xd276('0x5c')]({'where':{'id':_0x3a67b4['SmsInteractionId']}});}return null;})[_0xd276('0x24')](handleEntityNotFound(_0x1a2a8c,null))[_0xd276('0x24')](function(_0x4ab084){if(_0x4ab084){_0x40db82[_0xd276('0x6d')]=_0x4ab084['get']({'plain':!![]});interaction_log[_0xd276('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1988d3['user']['id'],_0x1988d3[_0xd276('0x68')][_0xd276('0x3d')],_0x1988d3[_0xd276('0x68')]['role'],_0x40db82[_0xd276('0x6d')]['id'],_0x1988d3['body']?JSON[_0xd276('0x2a')](_0x1988d3[_0xd276('0x5d')]):_0xd276('0x6f'));return respondWithRpcPromise(_0xd276('0x82'),_0xd276('0x83'),_0x40db82);}return null;})[_0xd276('0x24')](function(_0x59dbd4){var _0x502ebc=_0xd276('0x72')+_0x59dbd4[_0xd276('0x2d')][_0xd276('0x84')];return db[_0xd276('0x73')][_0xd276('0x46')](_0x502ebc,{'type':db[_0xd276('0x74')][_0xd276('0x75')][_0xd276('0x85')],'raw':!![]})['then'](function(_0x35ead1){return _0x35ead1;});})['then'](function(_0x560d2c){if(_0x560d2c){_0x40db82[_0xd276('0x2d')][_0xd276('0x76')]=_0x560d2c[0x0];if(!_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')])return;return db[_0xd276('0x77')][_0xd276('0x5c')]({'where':{'id':_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')],'role':_0xd276('0x7a')},'attributes':['id',_0xd276('0x3d'),_0xd276('0x86'),'email',_0xd276('0x79')],'raw':!![]});}return null;})[_0xd276('0x24')](function(_0x2c1bd5){if(!_0x2c1bd5)return null;_0x40db82[_0xd276('0x2d')]['agent']=_0x2c1bd5;return _0x40db82;})[_0xd276('0x24')](function(_0x1e7de3){if(_0x1e7de3){_0x1e7de3[_0xd276('0x2d')]['interface']=util[_0xd276('0x65')](_0xd276('0x7c'),_0x1988d3['user'][_0xd276('0x3d')]);_0x1e7de3[_0xd276('0x2d')]['channel']=_0x40db82['channel'];_0x1e7de3[_0xd276('0x2d')][_0xd276('0x7e')]=_0x40db82['channel'];_0x1e7de3[_0xd276('0x2d')][_0xd276('0x7f')]='reject';respondWithRpcPromise(_0xd276('0x80'),_0xd276('0x80'),{'event':_0xd276('0x87'),'message':_0x1e7de3['message']},client9002);return _0x40db82;}return null;})[_0xd276('0x24')](respondWithResult(_0x1a2a8c,null))[_0xd276('0x2f')](handleError(_0x1a2a8c,null));};exports[_0xd276('0x31')]=function(_0x293910,_0x1e27ed,_0x3c8fbd){if(_0x293910[_0xd276('0x5d')]['id']){delete _0x293910['body']['id'];}var _0x24dc8f;return db[_0xd276('0x52')]['find']({'where':{'id':_0x293910[_0xd276('0x57')]['id']}})[_0xd276('0x24')](handleEntityNotFound(_0x1e27ed,null))[_0xd276('0x24')](function(_0x4965ea){if(_0x4965ea){_0x24dc8f=_0x4965ea;return db[_0xd276('0x88')][_0xd276('0x5c')]({'where':{'id':_0x4965ea[_0xd276('0x89')]}});}})[_0xd276('0x24')](handleEntityNotFound(_0x1e27ed,null))['then'](function(_0x1cccf9){if(_0x1cccf9){logger[_0xd276('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xd276('0x8a'),_0x1cccf9['type'],util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1cccf9['type']){case _0xd276('0x8c'):if(_0x293910[_0xd276('0x5d')][_0xd276('0x8d')]&&_0x293910['body'][_0xd276('0x8d')]===_0x24dc8f[_0xd276('0x8e')]){return _0x24dc8f['update']({'read':!![]});}else{logger[_0xd276('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd276('0x31'),_0xd276('0x8c'),util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xd276('0x8f'):if(_0x293910[_0xd276('0x5d')]['MessageUUID']&&_0x293910[_0xd276('0x5d')][_0xd276('0x90')]===_0x24dc8f[_0xd276('0x8e')]&&_[_0xd276('0x91')]([_0xd276('0x92'),_0xd276('0x93')],_0x293910[_0xd276('0x5d')][_0xd276('0x94')])>=0x0){return _0x24dc8f['update']({'read':!![]});}else{logger[_0xd276('0x2b')](_0xd276('0x95'),_0xd276('0x31'),_0xd276('0x96'),util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xd276('0x97'):var _0x42d21a=_0x293910['body'][_0xd276('0x98')][0x0];if(_0x42d21a[_0xd276('0x31')][_0xd276('0x99')]===_0xd276('0x9a')){return _0x24dc8f[_0xd276('0x3a')]({'read':!![]});}else{logger['error'](_0xd276('0x95'),_0xd276('0x31'),'infobip',util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x24dc8f;}})[_0xd276('0x24')](respondWithResult(_0x1e27ed,null))[_0xd276('0x2f')](handleError(_0x1e27ed,null));}; \ No newline at end of file +var _0xaafc=['destroy','name','index','map','SmsMessage','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','interface','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','delivered','Status','plivio','infobip','results','groupName','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','limit','offset','count','apply','reject','save','update'];(function(_0x36feba,_0x541932){var _0x358e41=function(_0x3dc247){while(--_0x3dc247){_0x36feba['push'](_0x36feba['shift']());}};_0x358e41(++_0x541932);}(_0xaafc,0x176));var _0xcaaf=function(_0x15dd77,_0x1fdec5){_0x15dd77=_0x15dd77-0x0;var _0x159400=_0xaafc[_0x15dd77];return _0x159400;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaaf('0x0'));var zipdir=require(_0xcaaf('0x1'));var jsonpatch=require(_0xcaaf('0x2'));var rp=require(_0xcaaf('0x3'));var moment=require('moment');var BPromise=require(_0xcaaf('0x4'));var Mustache=require(_0xcaaf('0x5'));var util=require('util');var path=require('path');var sox=require(_0xcaaf('0x6'));var csv=require('to-csv');var ejs=require(_0xcaaf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaaf('0x8'));var squel=require(_0xcaaf('0x9'));var crypto=require(_0xcaaf('0xa'));var jsforce=require(_0xcaaf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcaaf('0xc'));var querystring=require('querystring');var Papa=require(_0xcaaf('0xd'));var Redis=require('ioredis');var authService=require(_0xcaaf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcaaf('0xf'));var hardwareService=require(_0xcaaf('0x10'));var logger=require(_0xcaaf('0x11'))(_0xcaaf('0x12'));var utils=require(_0xcaaf('0x13'));var config=require(_0xcaaf('0x14'));var licenseUtil=require(_0xcaaf('0x15'));var db=require(_0xcaaf('0x16'))['db'];config[_0xcaaf('0x17')]=_['defaults'](config[_0xcaaf('0x17')],{'host':_0xcaaf('0x18'),'port':0x18eb});var socket=require(_0xcaaf('0x19'))(new Redis(config[_0xcaaf('0x17')]));require(_0xcaaf('0x1a'))[_0xcaaf('0x1b')](socket);var jayson=require(_0xcaaf('0x1c'));var client=jayson[_0xcaaf('0x1d')][_0xcaaf('0x1e')]({'port':0x232c});var client9002=jayson[_0xcaaf('0x1d')][_0xcaaf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x552cf1,_0x301344,_0xb8532b,_0x7f23fb){return new BPromise(function(_0x3bb678,_0x3580ac){var _0x360078=_0x7f23fb||client;return _0x360078['request'](_0x552cf1,_0xb8532b)[_0xcaaf('0x1f')](function(_0x10ad54){logger['info'](_0xcaaf('0x20'),_0x301344,_0xcaaf('0x21'));logger[_0xcaaf('0x22')](_0xcaaf('0x23'),_0x301344,_0xcaaf('0x21'),JSON[_0xcaaf('0x24')](_0x10ad54));if(_0x10ad54[_0xcaaf('0x25')]){if(_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x26')]===0x1f4){logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x10ad54['error'][_0xcaaf('0x27')]);return _0x3580ac(_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x27')]);}logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x27')]);return _0x3bb678(_0x10ad54['error'][_0xcaaf('0x27')]);}else{logger[_0xcaaf('0x28')](_0xcaaf('0x20'),_0x301344,'request\x20sent');_0x3bb678(_0x10ad54[_0xcaaf('0x29')][_0xcaaf('0x27')]);}})[_0xcaaf('0x2a')](function(_0x3dac7d){logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x3dac7d);_0x3580ac(_0x3dac7d);});});}function respondWithStatusCode(_0x1cc1fb,_0x4ffbab){_0x4ffbab=_0x4ffbab||0xcc;return function(_0x387319){if(_0x387319){return _0x1cc1fb['sendStatus'](_0x4ffbab);}return _0x1cc1fb['status'](_0x4ffbab)['end']();};}function respondWithResult(_0x30d68a,_0x85b4a){_0x85b4a=_0x85b4a||0xc8;return function(_0x149dbb){if(_0x149dbb){return _0x30d68a[_0xcaaf('0x2b')](_0x85b4a)[_0xcaaf('0x2c')](_0x149dbb);}};}function respondWithFilteredResult(_0x35e500,_0x20be72){return function(_0x34019c){if(_0x34019c){var _0x1523bc=typeof _0x20be72['offset']==='undefined'&&typeof _0x20be72[_0xcaaf('0x2d')]==='undefined';var _0x4429e3=_0x34019c['count'];var _0x343cd5=_0x1523bc?0x0:_0x20be72[_0xcaaf('0x2e')];var _0x2e8530=_0x1523bc?_0x34019c[_0xcaaf('0x2f')]:_0x20be72['offset']+_0x20be72[_0xcaaf('0x2d')];var _0x2d0881;if(_0x2e8530>=_0x4429e3){_0x2e8530=_0x4429e3;_0x2d0881=0xc8;}else{_0x2d0881=0xce;}_0x35e500[_0xcaaf('0x2b')](_0x2d0881);return _0x35e500['set']('Content-Range',_0x343cd5+'-'+_0x2e8530+'/'+_0x4429e3)[_0xcaaf('0x2c')](_0x34019c);}return null;};}function patchUpdates(_0xe1207f){return function(_0x5696e4){try{jsonpatch[_0xcaaf('0x30')](_0x5696e4,_0xe1207f,!![]);}catch(_0x315565){return BPromise[_0xcaaf('0x31')](_0x315565);}return _0x5696e4[_0xcaaf('0x32')]();};}function saveUpdates(_0x427510,_0x3cdf87){return function(_0x19135d){if(_0x19135d){return _0x19135d[_0xcaaf('0x33')](_0x427510)[_0xcaaf('0x1f')](function(_0x4f1eb1){return _0x4f1eb1;});}return null;};}function removeEntity(_0x48b018,_0x318e42){return function(_0x581c02){if(_0x581c02){return _0x581c02[_0xcaaf('0x34')]()[_0xcaaf('0x1f')](function(){_0x48b018[_0xcaaf('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aae88,_0x41b0f0){return function(_0x37fb0a){if(!_0x37fb0a){_0x5aae88['sendStatus'](0x194);}return _0x37fb0a;};}function handleError(_0x553ae9,_0x168082){_0x168082=_0x168082||0x1f4;return function(_0x12a4fc){logger[_0xcaaf('0x25')](_0x12a4fc['stack']);if(_0x12a4fc[_0xcaaf('0x35')]){delete _0x12a4fc['name'];}_0x553ae9[_0xcaaf('0x2b')](_0x168082)['send'](_0x12a4fc);};}exports[_0xcaaf('0x36')]=function(_0x44abfd,_0x51d6a1){var _0x5318f2={},_0x27d7d4={},_0x41bd8f={'count':0x0,'rows':[]};var _0x4a6936=_[_0xcaaf('0x37')](db[_0xcaaf('0x38')]['rawAttributes'],function(_0x210268){return{'name':_0x210268['fieldName'],'type':_0x210268[_0xcaaf('0x39')][_0xcaaf('0x3a')]};});_0x27d7d4[_0xcaaf('0x3b')]=_[_0xcaaf('0x37')](_0x4a6936,_0xcaaf('0x35'));_0x27d7d4[_0xcaaf('0x3c')]=_[_0xcaaf('0x3d')](_0x44abfd[_0xcaaf('0x3c')]);_0x27d7d4[_0xcaaf('0x3e')]=_['intersection'](_0x27d7d4['model'],_0x27d7d4[_0xcaaf('0x3c')]);_0x5318f2['attributes']=_[_0xcaaf('0x3f')](_0x27d7d4['model'],qs[_0xcaaf('0x40')](_0x44abfd[_0xcaaf('0x3c')][_0xcaaf('0x40')]));_0x5318f2[_0xcaaf('0x41')]=_0x5318f2['attributes'][_0xcaaf('0x42')]?_0x5318f2[_0xcaaf('0x41')]:_0x27d7d4['model'];if(!_0x44abfd[_0xcaaf('0x3c')][_0xcaaf('0x43')](_0xcaaf('0x44'))){_0x5318f2[_0xcaaf('0x2d')]=qs[_0xcaaf('0x2d')](_0x44abfd[_0xcaaf('0x3c')][_0xcaaf('0x2d')]);_0x5318f2[_0xcaaf('0x2e')]=qs[_0xcaaf('0x2e')](_0x44abfd[_0xcaaf('0x3c')][_0xcaaf('0x2e')]);}_0x5318f2[_0xcaaf('0x45')]=qs[_0xcaaf('0x46')](_0x44abfd[_0xcaaf('0x3c')][_0xcaaf('0x46')]);_0x5318f2[_0xcaaf('0x47')]=qs['filters'](_['pick'](_0x44abfd['query'],_0x27d7d4['filters']),_0x4a6936);if(_0x44abfd[_0xcaaf('0x3c')][_0xcaaf('0x48')]){_0x5318f2[_0xcaaf('0x47')]=_[_0xcaaf('0x49')](_0x5318f2['where'],{'$or':_['map'](_0x4a6936,function(_0x50eeb1){if(_0x50eeb1[_0xcaaf('0x39')]!==_0xcaaf('0x4a')){var _0x4aa9f3={};_0x4aa9f3[_0x50eeb1[_0xcaaf('0x35')]]={'$like':'%'+_0x44abfd[_0xcaaf('0x3c')][_0xcaaf('0x48')]+'%'};return _0x4aa9f3;}})});}_0x5318f2=_[_0xcaaf('0x49')]({},_0x5318f2,_0x44abfd['options']);var _0x1d90f3={'where':_0x5318f2[_0xcaaf('0x47')]};return db['SmsMessage']['count'](_0x1d90f3)['then'](function(_0x417f4e){_0x41bd8f[_0xcaaf('0x2f')]=_0x417f4e;if(_0x44abfd['query'][_0xcaaf('0x4b')]){_0x5318f2['include']=[{'all':!![]}];}return db['SmsMessage'][_0xcaaf('0x4c')](_0x5318f2);})[_0xcaaf('0x1f')](function(_0x1176a7){_0x41bd8f[_0xcaaf('0x4d')]=_0x1176a7;return _0x41bd8f;})[_0xcaaf('0x1f')](respondWithFilteredResult(_0x51d6a1,_0x5318f2))[_0xcaaf('0x2a')](handleError(_0x51d6a1,null));};exports[_0xcaaf('0x4e')]=function(_0x4eb630,_0x19a7ae){var _0x4a19ed={'raw':!![],'where':{'id':_0x4eb630[_0xcaaf('0x4f')]['id']}},_0x27ba34={};_0x27ba34[_0xcaaf('0x3b')]=_[_0xcaaf('0x3d')](db['SmsMessage'][_0xcaaf('0x50')]);_0x27ba34['query']=_[_0xcaaf('0x3d')](_0x4eb630[_0xcaaf('0x3c')]);_0x27ba34[_0xcaaf('0x3e')]=_[_0xcaaf('0x3f')](_0x27ba34[_0xcaaf('0x3b')],_0x27ba34[_0xcaaf('0x3c')]);_0x4a19ed[_0xcaaf('0x41')]=_[_0xcaaf('0x3f')](_0x27ba34['model'],qs[_0xcaaf('0x40')](_0x4eb630[_0xcaaf('0x3c')]['fields']));_0x4a19ed[_0xcaaf('0x41')]=_0x4a19ed['attributes'][_0xcaaf('0x42')]?_0x4a19ed[_0xcaaf('0x41')]:_0x27ba34['model'];if(_0x4eb630[_0xcaaf('0x3c')][_0xcaaf('0x4b')]){_0x4a19ed['include']=[{'all':!![]}];}_0x4a19ed=_[_0xcaaf('0x49')]({},_0x4a19ed,_0x4eb630['options']);return db[_0xcaaf('0x38')]['find'](_0x4a19ed)[_0xcaaf('0x1f')](handleEntityNotFound(_0x19a7ae,null))[_0xcaaf('0x1f')](respondWithResult(_0x19a7ae,null))[_0xcaaf('0x2a')](handleError(_0x19a7ae,null));};exports[_0xcaaf('0x51')]=function(_0x8519e9,_0x27a4cc){return db[_0xcaaf('0x38')][_0xcaaf('0x51')](_0x8519e9[_0xcaaf('0x52')],{})[_0xcaaf('0x1f')](respondWithResult(_0x27a4cc,0xc9))[_0xcaaf('0x2a')](handleError(_0x27a4cc,null));};exports['update']=function(_0x466ad8,_0xf26672){if(_0x466ad8[_0xcaaf('0x52')]['id']){delete _0x466ad8[_0xcaaf('0x52')]['id'];}return db[_0xcaaf('0x38')][_0xcaaf('0x53')]({'where':{'id':_0x466ad8[_0xcaaf('0x4f')]['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0xf26672,null))[_0xcaaf('0x1f')](saveUpdates(_0x466ad8[_0xcaaf('0x52')],null))['then'](respondWithResult(_0xf26672,null))['catch'](handleError(_0xf26672,null));};exports[_0xcaaf('0x34')]=function(_0x6807c6,_0x5c9b2b){return db[_0xcaaf('0x38')][_0xcaaf('0x53')]({'where':{'id':_0x6807c6['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x5c9b2b,null))[_0xcaaf('0x1f')](removeEntity(_0x5c9b2b,null))['catch'](handleError(_0x5c9b2b,null));};exports[_0xcaaf('0x54')]=function(_0x284ae3,_0x3ea4da){return db['SmsMessage'][_0xcaaf('0x54')]()[_0xcaaf('0x1f')](respondWithResult(_0x3ea4da,null))[_0xcaaf('0x2a')](handleError(_0x3ea4da,null));};var interaction_log=require(_0xcaaf('0x11'))(_0xcaaf('0x55'));exports[_0xcaaf('0x56')]=function(_0xf84a37,_0x5793c5,_0x4f5505){var _0x31cfc8={'agent':{},'channel':_0xcaaf('0x57')};if(_0xf84a37[_0xcaaf('0x52')]['id']){delete _0xf84a37['body']['id'];}_0xf84a37[_0xcaaf('0x52')][_0xcaaf('0x58')]=!![];_0xf84a37['body'][_0xcaaf('0x59')]=moment()[_0xcaaf('0x5a')](_0xcaaf('0x5b'));_0xf84a37[_0xcaaf('0x52')][_0xcaaf('0x5c')]=_0xf84a37['body'][_0xcaaf('0x5c')]||_0xf84a37[_0xcaaf('0x5d')]['id'];_0x31cfc8[_0xcaaf('0x5e')]['id']=_0xf84a37[_0xcaaf('0x52')][_0xcaaf('0x5c')];return db[_0xcaaf('0x38')][_0xcaaf('0x53')]({'where':{'id':_0xf84a37['params']['id'],'UserId':null}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x5793c5,null))['then'](saveUpdates(_0xf84a37[_0xcaaf('0x52')],null))['then'](function(_0x42e400){if(_0x42e400){_0x31cfc8[_0xcaaf('0x27')]=_0x42e400[_0xcaaf('0x5f')]({'plain':!![]});return db[_0xcaaf('0x60')][_0xcaaf('0x53')]({'where':{'id':_0x42e400[_0xcaaf('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x5793c5,null))[_0xcaaf('0x1f')](function(_0x324d87){if(_0x324d87){return _0x324d87[_0xcaaf('0x33')]({'UserId':_0xf84a37[_0xcaaf('0x52')][_0xcaaf('0x5c')],'read1stAt':_[_0xcaaf('0x62')](_0x324d87[_0xcaaf('0x63')])?moment()[_0xcaaf('0x5a')](_0xcaaf('0x5b')):undefined});}return null;})[_0xcaaf('0x1f')](function(_0x588478){if(_0x588478){_0x31cfc8[_0xcaaf('0x64')]=_0x588478['get']({'plain':!![]});interaction_log[_0xcaaf('0x28')](_0xcaaf('0x65'),_0xf84a37[_0xcaaf('0x5d')]['id'],_0xf84a37[_0xcaaf('0x5d')]['name'],_0xf84a37[_0xcaaf('0x5d')][_0xcaaf('0x66')],_0x31cfc8[_0xcaaf('0x64')]['id'],_0xf84a37[_0xcaaf('0x52')]?JSON[_0xcaaf('0x24')](_0xf84a37['body']):_0xcaaf('0x67'));return respondWithRpcPromise(_0xcaaf('0x68'),_0xcaaf('0x69'),_0x31cfc8);}return null;})[_0xcaaf('0x1f')](function(_0x11424a){var _0x328971=_0xcaaf('0x6a')+_0x11424a[_0xcaaf('0x27')]['ContactId'];return db[_0xcaaf('0x6b')]['query'](_0x328971,{'type':db[_0xcaaf('0x6c')][_0xcaaf('0x6d')][_0xcaaf('0x6e')],'raw':!![]})[_0xcaaf('0x1f')](function(_0x49e9ae){return _0x49e9ae;});})[_0xcaaf('0x1f')](function(_0x50b6be){if(_0x50b6be){_0x31cfc8[_0xcaaf('0x27')][_0xcaaf('0x6f')]=_0x50b6be[0x0];if(!_0xf84a37[_0xcaaf('0x52')][_0xcaaf('0x5c')])return;return db[_0xcaaf('0x70')]['find']({'where':{'id':_0xf84a37['body'][_0xcaaf('0x5c')],'role':_0xcaaf('0x5e')},'attributes':['id',_0xcaaf('0x35'),_0xcaaf('0x71'),_0xcaaf('0x72'),_0xcaaf('0x73')],'raw':!![]});}return null;})['then'](function(_0x11e4a3){if(!_0x11e4a3)return null;_0x31cfc8[_0xcaaf('0x27')]['agent']=_0x11e4a3;return _0x31cfc8;})[_0xcaaf('0x1f')](function(_0x4cbdff){if(_0x4cbdff){if(_0xf84a37[_0xcaaf('0x52')][_0xcaaf('0x74')]){_0x31cfc8['message']['interface']=util[_0xcaaf('0x5a')](_0xcaaf('0x75'),_0xf84a37[_0xcaaf('0x5d')][_0xcaaf('0x35')]);_0x31cfc8[_0xcaaf('0x27')][_0xcaaf('0x76')]=_0x31cfc8[_0xcaaf('0x76')];_0x31cfc8[_0xcaaf('0x27')][_0xcaaf('0x77')]=_0x31cfc8[_0xcaaf('0x76')];_0x31cfc8[_0xcaaf('0x27')][_0xcaaf('0x78')]=_0xcaaf('0x56');return respondWithRpcPromise('EventManager',_0xcaaf('0x79'),{'event':_0xcaaf('0x7a'),'message':_0x31cfc8[_0xcaaf('0x27')]},client9002)[_0xcaaf('0x1f')](function(){return _0x31cfc8;});}return _0x31cfc8;}return null;})[_0xcaaf('0x1f')](respondWithResult(_0x5793c5,null))[_0xcaaf('0x2a')](handleError(_0x5793c5,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xcaaf('0x31')]=function(_0x5d981a,_0x1c307c,_0x230b48){var _0x5919db={'agent':{},'channel':_0xcaaf('0x57')};if(_0x5d981a[_0xcaaf('0x52')]['id']){delete _0x5d981a['body']['id'];}_0x5d981a[_0xcaaf('0x52')][_0xcaaf('0x5c')]=_0x5d981a[_0xcaaf('0x52')][_0xcaaf('0x5c')]||_0x5d981a[_0xcaaf('0x5d')]['id'];_0x5919db[_0xcaaf('0x5e')]['id']=_0x5d981a[_0xcaaf('0x52')]['UserId'];return db[_0xcaaf('0x38')][_0xcaaf('0x53')]({'where':{'id':_0x5d981a[_0xcaaf('0x4f')]['id'],'UserId':null}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x1c307c,null))[_0xcaaf('0x1f')](function(_0x5db5da){if(_0x5db5da){_0x5919db[_0xcaaf('0x27')]=_0x5db5da['get']({'plain':!![]});return db[_0xcaaf('0x60')]['find']({'where':{'id':_0x5db5da[_0xcaaf('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x1c307c,null))['then'](function(_0x3d45df){if(_0x3d45df){_0x5919db[_0xcaaf('0x64')]=_0x3d45df[_0xcaaf('0x5f')]({'plain':!![]});interaction_log[_0xcaaf('0x28')](_0xcaaf('0x7b'),_0x5d981a['user']['id'],_0x5d981a[_0xcaaf('0x5d')][_0xcaaf('0x35')],_0x5d981a[_0xcaaf('0x5d')][_0xcaaf('0x66')],_0x5919db['interaction']['id'],_0x5d981a['body']?JSON['stringify'](_0x5d981a[_0xcaaf('0x52')]):_0xcaaf('0x67'));return respondWithRpcPromise(_0xcaaf('0x7c'),'rejectMessage',_0x5919db);}return null;})[_0xcaaf('0x1f')](function(_0x216853){var _0x5ae4fd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x216853[_0xcaaf('0x27')][_0xcaaf('0x7d')];return db['sequelize']['query'](_0x5ae4fd,{'type':db['Sequelize'][_0xcaaf('0x6d')][_0xcaaf('0x6e')],'raw':!![]})[_0xcaaf('0x1f')](function(_0x25c427){return _0x25c427;});})[_0xcaaf('0x1f')](function(_0x4b6eba){if(_0x4b6eba){_0x5919db['message'][_0xcaaf('0x6f')]=_0x4b6eba[0x0];if(!_0x5d981a[_0xcaaf('0x52')]['UserId'])return;return db[_0xcaaf('0x70')][_0xcaaf('0x53')]({'where':{'id':_0x5d981a['body'][_0xcaaf('0x5c')],'role':_0xcaaf('0x5e')},'attributes':['id',_0xcaaf('0x35'),_0xcaaf('0x71'),_0xcaaf('0x72'),_0xcaaf('0x73')],'raw':!![]});}return null;})[_0xcaaf('0x1f')](function(_0xf47d74){if(!_0xf47d74)return null;_0x5919db[_0xcaaf('0x27')][_0xcaaf('0x5e')]=_0xf47d74;return _0x5919db;})['then'](function(_0x43fd5a){if(_0x43fd5a){_0x43fd5a[_0xcaaf('0x27')][_0xcaaf('0x7e')]=util['format'](_0xcaaf('0x75'),_0x5d981a[_0xcaaf('0x5d')][_0xcaaf('0x35')]);_0x43fd5a[_0xcaaf('0x27')]['channel']=_0x5919db[_0xcaaf('0x76')];_0x43fd5a['message']['motionChannel']=_0x5919db[_0xcaaf('0x76')];_0x43fd5a[_0xcaaf('0x27')]['event']=_0xcaaf('0x31');respondWithRpcPromise(_0xcaaf('0x79'),'EventManager',{'event':_0xcaaf('0x7f'),'message':_0x43fd5a[_0xcaaf('0x27')]},client9002);return _0x5919db;}return null;})[_0xcaaf('0x1f')](respondWithResult(_0x1c307c,null))['catch'](handleError(_0x1c307c,null));};exports[_0xcaaf('0x2b')]=function(_0x84e3c7,_0x16cf92,_0x21b516){if(_0x84e3c7[_0xcaaf('0x52')]['id']){delete _0x84e3c7[_0xcaaf('0x52')]['id'];}var _0x13511a;return db[_0xcaaf('0x38')][_0xcaaf('0x53')]({'where':{'id':_0x84e3c7['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x16cf92,null))[_0xcaaf('0x1f')](function(_0x5aa209){if(_0x5aa209){_0x13511a=_0x5aa209;return db['SmsAccount'][_0xcaaf('0x53')]({'where':{'id':_0x5aa209[_0xcaaf('0x80')]}});}})['then'](handleEntityNotFound(_0x16cf92,null))['then'](function(_0x812d19){if(_0x812d19){logger[_0xcaaf('0x22')](_0xcaaf('0x23'),_0xcaaf('0x2b'),_0xcaaf('0x81'),_0x812d19[_0xcaaf('0x39')],util[_0xcaaf('0x82')](_0x84e3c7[_0xcaaf('0x52')],{'showHidden':![],'depth':null}));switch(_0x812d19[_0xcaaf('0x39')]){case _0xcaaf('0x83'):if(_0x84e3c7['body'][_0xcaaf('0x84')]&&_0x84e3c7[_0xcaaf('0x52')][_0xcaaf('0x84')]===_0x13511a[_0xcaaf('0x85')]){return _0x13511a['update']({'read':!![]});}else{logger[_0xcaaf('0x25')](_0xcaaf('0x86'),_0xcaaf('0x2b'),_0xcaaf('0x83'),util[_0xcaaf('0x82')](_0x84e3c7[_0xcaaf('0x52')],{'showHidden':![],'depth':null}));}break;case _0xcaaf('0x87'):if(_0x84e3c7[_0xcaaf('0x52')]['MessageUUID']&&_0x84e3c7['body']['MessageUUID']===_0x13511a[_0xcaaf('0x85')]&&_['indexOf'](['sent',_0xcaaf('0x88')],_0x84e3c7[_0xcaaf('0x52')][_0xcaaf('0x89')])>=0x0){return _0x13511a[_0xcaaf('0x33')]({'read':!![]});}else{logger[_0xcaaf('0x25')](_0xcaaf('0x86'),_0xcaaf('0x2b'),_0xcaaf('0x8a'),util[_0xcaaf('0x82')](_0x84e3c7[_0xcaaf('0x52')],{'showHidden':![],'depth':null}));}break;case _0xcaaf('0x8b'):var _0x43b83f=_0x84e3c7['body'][_0xcaaf('0x8c')][0x0];if(_0x43b83f[_0xcaaf('0x2b')][_0xcaaf('0x8d')]==='DELIVERED'){return _0x13511a[_0xcaaf('0x33')]({'read':!![]});}else{logger[_0xcaaf('0x25')](_0xcaaf('0x86'),_0xcaaf('0x2b'),_0xcaaf('0x8b'),util['inspect'](_0x84e3c7[_0xcaaf('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x13511a;}})[_0xcaaf('0x1f')](respondWithResult(_0x16cf92,null))[_0xcaaf('0x2a')](handleError(_0x16cf92,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 9cd19a4..9c26719 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 _0xefe7=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x21dd65,_0x542d64){var _0x264b6d=function(_0x1e1f82){while(--_0x1e1f82){_0x21dd65['push'](_0x21dd65['shift']());}};_0x264b6d(++_0x542d64);}(_0xefe7,0x14c));var _0x7efe=function(_0x1132f8,_0x122a52){_0x1132f8=_0x1132f8-0x0;var _0x481f4c=_0xefe7[_0x1132f8];return _0x481f4c;};'use strict';var EventEmitter=require(_0x7efe('0x0'));var SmsMessage=require(_0x7efe('0x1'))['db'][_0x7efe('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7efe('0x3')](0x0);var events={'afterCreate':_0x7efe('0x4'),'afterUpdate':_0x7efe('0x5'),'afterDestroy':_0x7efe('0x6')};function emitEvent(_0xca7b67){return function(_0x1b25ab,_0x544735,_0x181f71){SmsMessageEvents[_0x7efe('0x7')](_0xca7b67+':'+_0x1b25ab['id'],_0x1b25ab);SmsMessageEvents[_0x7efe('0x7')](_0xca7b67,_0x1b25ab);_0x181f71(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7efe('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x762b=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x762b,0x172));var _0xb762=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x762b[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xb762('0x0'));var SmsMessage=require(_0xb762('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb762('0x2')](0x0);var events={'afterCreate':_0xb762('0x3'),'afterUpdate':_0xb762('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c4325){return function(_0x2179d0,_0x41b243,_0x116384){SmsMessageEvents[_0xb762('0x5')](_0x1c4325+':'+_0x2179d0['id'],_0x2179d0);SmsMessageEvents['emit'](_0x1c4325,_0x2179d0);_0x116384(null);};}for(var e in events){if(events[_0xb762('0x6')](e)){var event=events[e];SmsMessage[_0xb762('0x7')](e,emitEvent(event));}}module[_0xb762('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index b3907e1..bcbbfb3 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 _0xca66=['/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','Token\x20not\x20received','finally','utf8mb4','lodash','api','moment','bluebird','path','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','out','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','username','&password=','GET','split','total_sent','deliveryReport','read','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20username,\x20password','csc','apiKey','login','text','timestamp','keys','sort','length','digest','hex','signature='];(function(_0x42d5f0,_0x34d4c9){var _0x3c42cb=function(_0x44db59){while(--_0x44db59){_0x42d5f0['push'](_0x42d5f0['shift']());}};_0x3c42cb(++_0x34d4c9);}(_0xca66,0x8b));var _0x6ca6=function(_0x23225f,_0x278015){_0x23225f=_0x23225f-0x0;var _0x46b5a4=_0xca66[_0x23225f];return _0x46b5a4;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ca6('0x1'));var moment=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ca6('0x4'));var rimraf=require('rimraf');var config=require(_0x6ca6('0x5'));var attributes=require('./smsMessage.attributes');module[_0x6ca6('0x6')]=function(_0x27d8c6,_0x34836f){return _0x27d8c6[_0x6ca6('0x7')](_0x6ca6('0x8'),attributes,{'tableName':_0x6ca6('0x9'),'paranoid':![],'indexes':[{'name':_0x6ca6('0xa'),'fields':['messageId']},{'name':_0x6ca6('0xb'),'fields':[_0x6ca6('0xc')],'type':_0x6ca6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4352a5,_0x231f4c,_0x4198dc){var _0x22f0f3=_0x27d8c6['models'];var _0x38678e=_0x4352a5[_0x6ca6('0xe')]({'plain':!![]});if(_0x38678e[_0x6ca6('0xf')][_0x6ca6('0x10')]()==='in'||_0x38678e[_0x6ca6('0xf')][_0x6ca6('0x10')]()==='out'&&!_0x38678e[_0x6ca6('0x11')]&&!_[_0x6ca6('0x12')](_0x38678e['UserId'])){_0x22f0f3[_0x6ca6('0x13')][_0x6ca6('0x14')]({'where':{'id':_0x38678e[_0x6ca6('0x15')]}})[_0x6ca6('0x16')](function(_0xc774c){if(_0xc774c){_0xc774c[_0x6ca6('0x17')]({'lastMsgAt':_0x38678e['createdAt'],'lastMsgDirection':_0x38678e['direction']['toLowerCase']()});}})[_0x6ca6('0x18')](function(_0x19e94f){console[_0x6ca6('0x19')](_0x19e94f);});}if(_0x38678e[_0x6ca6('0xf')]===_0x6ca6('0x1a')&&!_0x38678e[_0x6ca6('0x11')]){var _0x25dc6c;_0x22f0f3['SmsAccount'][_0x6ca6('0x1b')]({'where':{'id':_0x38678e[_0x6ca6('0x1c')]},'raw':!![]})[_0x6ca6('0x16')](function(_0x1f21ff){_0x25dc6c=_0x1f21ff;if(_0x25dc6c&&_0x25dc6c[_0x6ca6('0x1d')]){switch(_0x25dc6c[_0x6ca6('0x1d')]){case _0x6ca6('0x1e'):var _0x251072=require(_0x6ca6('0x1e'));if(_0x25dc6c[_0x6ca6('0x1f')]&&_0x25dc6c[_0x6ca6('0x20')]&&_0x25dc6c['phone']){var _0x28a982=new _0x251072(_0x25dc6c[_0x6ca6('0x1f')],_0x25dc6c[_0x6ca6('0x20')]);_0x28a982[_0x6ca6('0x21')][_0x6ca6('0x22')]({'body':_0x38678e[_0x6ca6('0xc')],'to':_0x38678e['phone'],'from':_0x25dc6c[_0x6ca6('0x23')],'statusCallback':_0x25dc6c[_0x6ca6('0x24')]+'/api/sms/messages/'+_0x38678e['id']+'/status?token='+_0x25dc6c[_0x6ca6('0x25')]})[_0x6ca6('0x16')](function(_0xfe0760){if(_0xfe0760[_0x6ca6('0x26')]){return _0x4352a5[_0x6ca6('0x17')]({'messageId':_0xfe0760['sid']});}})[_0x6ca6('0x18')](function(_0x1d6caa){logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x1e'),util[_0x6ca6('0x29')](_0x1d6caa,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ca6('0x1e'),_0x6ca6('0x2a'));}break;case _0x6ca6('0x2b'):var _0x141c0f='https://api.skebby.it/API/v1.0/REST/';if(_0x25dc6c['username']&&_0x25dc6c[_0x6ca6('0x2c')]){var _0x47cf48={'recipient':[_0x38678e['phone']],'message':_0x38678e[_0x6ca6('0xc')],'message_type':_0x25dc6c[_0x6ca6('0x2d')]};if(_0x25dc6c['smsMethod']&&_0x25dc6c[_0x6ca6('0x2d')]!=='SI'){_0x47cf48[_0x6ca6('0x2e')]=_0x25dc6c[_0x6ca6('0x23')];}var _0x1e9674={'url':_0x141c0f+'login?username='+_0x25dc6c[_0x6ca6('0x2f')]+_0x6ca6('0x30')+_0x25dc6c[_0x6ca6('0x2c')],'method':_0x6ca6('0x31')};rp(_0x1e9674)['then'](function(_0x467a89){var _0x15b962=_0x467a89[_0x6ca6('0x32')](';');var _0x1c6d50={'user_key':_0x15b962[0x0],'session_key':_0x15b962[0x1]};_0x1e9674={'url':_0x141c0f+'sms','method':'POST','headers':{'user_key':_0x1c6d50['user_key'],'Session_key':_0x1c6d50['session_key']},'json':!![],'body':_0x47cf48};return rp(_0x1e9674);})['then'](function(_0x1c3505){if(_0x1c3505[_0x6ca6('0x33')]>=0x1){var _0x138cce={'messageId':_0x1c3505['internal_order_id']};if(_0x25dc6c[_0x6ca6('0x2d')]!=='GP'||!_0x25dc6c[_0x6ca6('0x34')]){_0x138cce[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x138cce);}else{return logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x2b'),util[_0x6ca6('0x29')](_0x1c3505,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e28b4){return logger['error'](_0x6ca6('0x27'),'afterCreate','skebby',util[_0x6ca6('0x29')](_0x1e28b4,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x6ca6('0x36'):if(_0x25dc6c[_0x6ca6('0x20')]){var _0x5546c3={'recipient':_0x38678e[_0x6ca6('0x23')],'message':_0x38678e['body'],'sender':_0x25dc6c[_0x6ca6('0x37')]||_0x25dc6c['phone'],'authorization':_0x25dc6c[_0x6ca6('0x20')]};var _0x231f4c={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x39'),'body':_0x5546c3,'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x3ca258){var _0x45e77b={'messageId':_0x3ca258[_0x6ca6('0x3a')]};if(!_0x25dc6c['deliveryReport']){_0x45e77b[_0x6ca6('0x35')]=!![];}return _0x4352a5['update'](_0x45e77b);})['catch'](function(_0x11265f){logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'connectel',util[_0x6ca6('0x29')](_0x11265f,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x6ca6('0x3b'):if(_0x25dc6c[_0x6ca6('0x2f')]&&_0x25dc6c[_0x6ca6('0x2c')]){var _0x5546c3={'messages':[{'source':_0x6ca6('0x3c'),'to':_0x38678e['phone'],'body':_0x38678e[_0x6ca6('0xc')],'from':_0x25dc6c[_0x6ca6('0x37')]||_0x25dc6c['phone']}]};var _0x233193=util[_0x6ca6('0x3d')](_0x6ca6('0x3e'),_0x25dc6c[_0x6ca6('0x2f')],_0x25dc6c[_0x6ca6('0x2c')]);var _0x231f4c={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x3f'),'body':_0x5546c3,'headers':{'Authorization':util[_0x6ca6('0x3d')]('Basic\x20%s',new Buffer(_0x233193)[_0x6ca6('0x40')](_0x6ca6('0x41')))},'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x35dcfd){if(_0x35dcfd[_0x6ca6('0x42')]>=0xc8&&_0x35dcfd[_0x6ca6('0x42')]<=0xce){if(_0x35dcfd[_0x6ca6('0x43')]&&_0x35dcfd[_0x6ca6('0x43')]['queued_count']>0x0){var _0x5a719e=_[_0x6ca6('0x44')](_0x35dcfd[_0x6ca6('0x43')][_0x6ca6('0x21')]);var _0x31edd4={'messageId':_0x5a719e[_0x6ca6('0x45')]};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x31edd4[_0x6ca6('0x35')]=!![];}return _0x4352a5['update'](_0x31edd4);}else{logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),'clickSend',util[_0x6ca6('0x29')](_0x35dcfd,{'showHidden':![],'depth':null}));}}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x46'),util[_0x6ca6('0x29')](_0x35dcfd,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x5f27f5){logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'clickSend',util[_0x6ca6('0x29')](_0x5f27f5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ca6('0x27'),'afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x6ca6('0x47'):if(_0x25dc6c[_0x6ca6('0x48')]&&_0x25dc6c[_0x6ca6('0x20')]){var _0x5546c3={'dst':_0x38678e[_0x6ca6('0x23')],'text':_0x38678e['body'],'src':_0x25dc6c[_0x6ca6('0x37')]||_0x25dc6c[_0x6ca6('0x23')],'url':_0x25dc6c[_0x6ca6('0x24')]+_0x6ca6('0x49')+_0x38678e['id']+_0x6ca6('0x4a')+_0x25dc6c[_0x6ca6('0x25')]};var _0x233193=util[_0x6ca6('0x3d')](_0x6ca6('0x3e'),_0x25dc6c[_0x6ca6('0x48')],_0x25dc6c[_0x6ca6('0x20')]);var _0x231f4c={'method':_0x6ca6('0x38'),'uri':util[_0x6ca6('0x3d')](_0x6ca6('0x4b'),_0x25dc6c[_0x6ca6('0x48')]),'body':_0x5546c3,'headers':{'Authorization':util[_0x6ca6('0x3d')]('Basic\x20%s',new Buffer(_0x233193)[_0x6ca6('0x40')](_0x6ca6('0x41')))},'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x523f5d){var _0x5490ce={'messageId':_0x523f5d['message_uuid'][0x0]};return _0x4352a5['update'](_0x5490ce);})[_0x6ca6('0x18')](function(_0x7609ba){logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ca6('0x47'),util[_0x6ca6('0x29')](_0x7609ba,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'plivo',_0x6ca6('0x4c'));}break;case _0x6ca6('0x4d'):if(_0x25dc6c[_0x6ca6('0x2f')]&&_0x25dc6c[_0x6ca6('0x2c')]){if(_0x25dc6c['baseUrl']){var _0x106f63={'method':'POST','uri':_0x25dc6c['baseUrl']+_0x6ca6('0x4e'),'body':{'username':_0x25dc6c[_0x6ca6('0x2f')],'password':_0x25dc6c[_0x6ca6('0x2c')]},'json':!![]};return rp(_0x106f63)[_0x6ca6('0x16')](function(_0x50321f){var _0x2b893c={'method':_0x6ca6('0x38'),'uri':_0x25dc6c[_0x6ca6('0x4f')]+_0x6ca6('0x50'),'body':{'messages':[{'from':_0x25dc6c[_0x6ca6('0x23')],'destinations':[{'to':_0x38678e[_0x6ca6('0x23')]}],'text':_0x38678e[_0x6ca6('0xc')],'notifyUrl':_0x25dc6c[_0x6ca6('0x24')]+_0x6ca6('0x49')+_0x38678e['id']+_0x6ca6('0x4a')+_0x25dc6c[_0x6ca6('0x25')],'notifyContentType':_0x6ca6('0x51'),'callbackData':_0x25dc6c[_0x6ca6('0x23')]+';'+_0x38678e[_0x6ca6('0xc')]}]},'headers':{'Authorization':_0x6ca6('0x52')+_0x50321f[_0x6ca6('0x25')]},'json':!![]};return rp(_0x2b893c)['then'](function(_0x353865){if(_0x353865[_0x6ca6('0x21')]){var _0x2f4886={'messageId':_0x353865[_0x6ca6('0x21')][0x0][_0x6ca6('0xa')]};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x2f4886[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x2f4886);}else{return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x4d'),util[_0x6ca6('0x29')](_0x353865,{'showHidden':![],'depth':null}));}});})[_0x6ca6('0x18')](function(_0x278342){return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),_0x6ca6('0x4d'),util[_0x6ca6('0x29')](_0x278342,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),'infobip',_0x6ca6('0x53'));}break;case _0x6ca6('0x54'):var _0x97f23=require('crypto');if(_0x25dc6c[_0x6ca6('0x55')]){var _0x18e9c1={};_0x18e9c1[_0x6ca6('0x56')]=_0x25dc6c[_0x6ca6('0x2f')];_0x18e9c1[_0x6ca6('0x23')]=_0x38678e['phone'];_0x18e9c1['sender']=_0x25dc6c[_0x6ca6('0x23')];_0x18e9c1[_0x6ca6('0x57')]=_0x38678e['body'];_0x18e9c1[_0x6ca6('0x58')]=+new Date();var _0x43ec39='';var _0x217dc8='';var _0x19e7ac=Object[_0x6ca6('0x59')](_0x18e9c1);_0x19e7ac[_0x6ca6('0x5a')]();for(var _0x27f907=0x0;_0x27f907<_0x19e7ac[_0x6ca6('0x5b')];_0x27f907++){if(_0x43ec39!=''){_0x43ec39+='&';}_0x43ec39+=_0x19e7ac[_0x27f907]+'='+encodeURIComponent(_0x18e9c1[_0x19e7ac[_0x27f907]]);_0x217dc8+=_0x18e9c1[_0x19e7ac[_0x27f907]];}_0x217dc8+=_0x25dc6c[_0x6ca6('0x55')];_0x217dc8=_0x97f23['createHash']('md5')[_0x6ca6('0x17')](_0x217dc8)[_0x6ca6('0x5c')](_0x6ca6('0x5d'));if(_0x43ec39!==''){_0x43ec39+='&';}_0x43ec39+=_0x6ca6('0x5e')+_0x217dc8;var _0x1e9674={'method':_0x6ca6('0x31'),'uri':_0x25dc6c['baseUrl']+_0x6ca6('0x5f')+_0x43ec39,'json':!![]};return rp(_0x1e9674)['then'](function(_0x450126){var _0x44bbe6=Object[_0x6ca6('0x59')](_0x450126);if(_0x450126[_0x44bbe6[0x0]][_0x6ca6('0x19')]&&parseInt(_0x450126[_0x44bbe6[0x0]][_0x6ca6('0x19')])===0x0){var _0x5a2775={'messageId':_0x450126[_0x44bbe6[0x0]]['id_sms']};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x5a2775[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x5a2775);}else{return logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x54'),util[_0x6ca6('0x29')](_0x450126['error'],{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x377ec7){return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'csc',util[_0x6ca6('0x29')](_0x377ec7,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x54'),_0x6ca6('0x60'));}break;case _0x6ca6('0x61'):if(_0x25dc6c['apiKey']){var _0x5d9d14={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x62'),'headers':{'Authorization':_0x25dc6c[_0x6ca6('0x55')]},'body':{'content':_0x38678e['body'],'to':[_0x38678e[_0x6ca6('0x23')]],'from':_0x25dc6c[_0x6ca6('0x23')],'binary':![],'clientMessageId':_0x6ca6('0x63'),'charset':_0x6ca6('0x64')},'json':!![]};rp(_0x5d9d14)[_0x6ca6('0x16')](function(_0x299b87){if(!_0x299b87['error']){var _0x4e6c8c={'messageId':_0x299b87[_0x6ca6('0x21')][0x0]['apiMessageId']};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x4e6c8c[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x4e6c8c);}else{return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x61'),util['inspect'](_0x299b87[_0x6ca6('0x19')],{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x1f051b){return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x6ca6('0x29')](_0x1f051b,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x61'),'Missing\x20parameters:\x20apiKey');}break;case _0x6ca6('0x65'):if(_0x25dc6c[_0x6ca6('0x2f')]&&_0x25dc6c['password']){var _0x233193=util[_0x6ca6('0x3d')](_0x6ca6('0x3e'),_0x25dc6c['username'],_0x25dc6c[_0x6ca6('0x2c')]);var _0x231f4c={'method':'POST','uri':_0x6ca6('0x66')+_0x25dc6c['accountId']+_0x6ca6('0x67'),'body':{'to':[_0x38678e[_0x6ca6('0x23')]],'text':_0x38678e[_0x6ca6('0xc')],'from':_0x25dc6c[_0x6ca6('0x23')],'applicationId':_0x25dc6c[_0x6ca6('0x68')]},'headers':{'Authorization':util['format'](_0x6ca6('0x69'),new Buffer(_0x233193)['toString'](_0x6ca6('0x41')))},'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x2a79ee){if(_0x2a79ee['id']){var _0x4d4b77={'messageId':_0x2a79ee['id']};return _0x4352a5['update'](_0x4d4b77);}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x65'),util[_0x6ca6('0x29')](_0x2a79ee,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x1b8c6e){logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),_0x6ca6('0x65'),util[_0x6ca6('0x29')](_0x1b8c6e,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x65'),_0x6ca6('0x53'));}break;case _0x6ca6('0x6a'):if(_0x25dc6c[_0x6ca6('0x55')]){var _0x4e714d={};var _0x1e9674={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x6b'),'headers':{'Authorization':_0x6ca6('0x6c')+_0x25dc6c[_0x6ca6('0x55')],'Content-Type':_0x6ca6('0x51')},'body':{'from':_0x25dc6c['phone'],'to':_0x38678e[_0x6ca6('0x23')],'text':_0x38678e[_0x6ca6('0xc')]},'json':!![]};return rp(_0x1e9674)[_0x6ca6('0x16')](function(_0x503670){if(_0x503670[_0x6ca6('0x6d')]==0xca){_0x4e714d['message']=_0x503670;var _0x1b67f6={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x25dc6c[_0x6ca6('0x55')],'Content-Type':'application/json'},'body':{'refid':_0x4e714d[_0x6ca6('0x6f')]['refid']},'json':!![]};return rp(_0x1b67f6)['then'](function(_0x4070c5){_0x4e714d[_0x6ca6('0x70')]=_0x4070c5;var _0x48790a={'messageId':_0x4e714d[_0x6ca6('0x6f')][_0x6ca6('0x71')],'read':!![]};return _0x4352a5['update'](_0x48790a);});}else{return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x6a'),util[_0x6ca6('0x29')](_0x503670,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x5e6f79){return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x6a'),util['inspect'](_0x5e6f79,{'showHidden':![],'depth':null}));});}else{return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'intelepeer',_0x6ca6('0x72'));}break;}}})[_0x6ca6('0x73')](function(){_0x4198dc();});}else{_0x4198dc();}}},'charset':_0x6ca6('0x74'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd957=['phone','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','username','GET','split','sms','POST','user_key','session_key','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','clickSend','authId','senderString','remote','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','plivo','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','infobip','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','base64','bandwidth','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd957,0x153));var _0x7d95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd957[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d95('0x0'));var util=require(_0x7d95('0x1'));var logger=require('../../config/logger')(_0x7d95('0x2'));var moment=require(_0x7d95('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d95('0x4'));var fs=require('fs');var path=require(_0x7d95('0x5'));var rimraf=require(_0x7d95('0x6'));var config=require(_0x7d95('0x7'));var attributes=require(_0x7d95('0x8'));module[_0x7d95('0x9')]=function(_0x2de581,_0x514355){return _0x2de581[_0x7d95('0xa')](_0x7d95('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x7d95('0xc'),'fields':[_0x7d95('0xc')]},{'name':_0x7d95('0xd'),'fields':[_0x7d95('0xe')],'type':_0x7d95('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x572e5f,_0x2e0589,_0x109cec){var _0x33f544=_0x2de581[_0x7d95('0x10')];var _0x2af3bd=_0x572e5f['get']({'plain':!![]});if(_0x2af3bd['direction'][_0x7d95('0x11')]()==='in'||_0x2af3bd[_0x7d95('0x12')]['toLowerCase']()===_0x7d95('0x13')&&!_0x2af3bd[_0x7d95('0x14')]&&!_[_0x7d95('0x15')](_0x2af3bd[_0x7d95('0x16')])){_0x33f544[_0x7d95('0x17')][_0x7d95('0x18')]({'where':{'id':_0x2af3bd['SmsInteractionId']}})[_0x7d95('0x19')](function(_0x56e18f){if(_0x56e18f){_0x56e18f[_0x7d95('0x1a')]({'lastMsgAt':_0x2af3bd['createdAt'],'lastMsgDirection':_0x2af3bd[_0x7d95('0x12')]['toLowerCase']()});}})[_0x7d95('0x1b')](function(_0x30c2f8){console[_0x7d95('0x1c')](_0x30c2f8);});}if(_0x2af3bd[_0x7d95('0x12')]==='out'&&!_0x2af3bd['secret']){var _0x186198;_0x33f544[_0x7d95('0x1d')][_0x7d95('0x1e')]({'where':{'id':_0x2af3bd[_0x7d95('0x1f')]},'raw':!![]})['then'](function(_0x1c656c){_0x186198=_0x1c656c;if(_0x186198&&_0x186198[_0x7d95('0x20')]){switch(_0x186198['type']){case _0x7d95('0x21'):var _0x1b5629=require(_0x7d95('0x21'));if(_0x186198[_0x7d95('0x22')]&&_0x186198[_0x7d95('0x23')]&&_0x186198[_0x7d95('0x24')]){var _0x3ae23a=new _0x1b5629(_0x186198[_0x7d95('0x22')],_0x186198[_0x7d95('0x23')]);_0x3ae23a['messages'][_0x7d95('0x25')]({'body':_0x2af3bd['body'],'to':_0x2af3bd[_0x7d95('0x24')],'from':_0x186198['phone'],'statusCallback':_0x186198['remote']+_0x7d95('0x26')+_0x2af3bd['id']+_0x7d95('0x27')+_0x186198[_0x7d95('0x28')]})['then'](function(_0x2f54c4){if(_0x2f54c4[_0x7d95('0x29')]){return _0x572e5f['update']({'messageId':_0x2f54c4[_0x7d95('0x29')]});}})['catch'](function(_0x4ec676){logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),'twilio',util[_0x7d95('0x2c')](_0x4ec676,{'showHidden':![],'depth':null}));});}else{logger[_0x7d95('0x1c')](_0x7d95('0x2a'),'afterCreate',_0x7d95('0x21'),_0x7d95('0x2d'));}break;case _0x7d95('0x2e'):var _0x5c0664=_0x7d95('0x2f');if(_0x186198['username']&&_0x186198[_0x7d95('0x30')]){var _0x3be6fa={'recipient':[_0x2af3bd[_0x7d95('0x24')]],'message':_0x2af3bd[_0x7d95('0xe')],'message_type':_0x186198[_0x7d95('0x31')]};if(_0x186198[_0x7d95('0x31')]&&_0x186198[_0x7d95('0x31')]!=='SI'){_0x3be6fa[_0x7d95('0x32')]=_0x186198['phone'];}var _0x2a98aa={'url':_0x5c0664+'login?username='+_0x186198[_0x7d95('0x33')]+'&password='+_0x186198[_0x7d95('0x30')],'method':_0x7d95('0x34')};rp(_0x2a98aa)[_0x7d95('0x19')](function(_0xfae5b2){var _0x2556ef=_0xfae5b2[_0x7d95('0x35')](';');var _0x563fcd={'user_key':_0x2556ef[0x0],'session_key':_0x2556ef[0x1]};_0x2a98aa={'url':_0x5c0664+_0x7d95('0x36'),'method':_0x7d95('0x37'),'headers':{'user_key':_0x563fcd[_0x7d95('0x38')],'Session_key':_0x563fcd[_0x7d95('0x39')]},'json':!![],'body':_0x3be6fa};return rp(_0x2a98aa);})[_0x7d95('0x19')](function(_0x3ddd23){if(_0x3ddd23['total_sent']>=0x1){var _0xc59bc8={'messageId':_0x3ddd23[_0x7d95('0x3a')]};if(_0x186198['smsMethod']!=='GP'||!_0x186198['deliveryReport']){_0xc59bc8[_0x7d95('0x3b')]=!![];}return _0x572e5f[_0x7d95('0x1a')](_0xc59bc8);}else{return logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x2e'),util[_0x7d95('0x2c')](_0x3ddd23,{'showHidden':![],'depth':null}));}})[_0x7d95('0x1b')](function(_0x1b5648){return logger[_0x7d95('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d95('0x2b'),_0x7d95('0x2e'),util[_0x7d95('0x2c')](_0x1b5648,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),'skebby',_0x7d95('0x3c'));}break;case _0x7d95('0x3d'):if(_0x186198[_0x7d95('0x23')]){var _0x632cc4={'recipient':_0x2af3bd['phone'],'message':_0x2af3bd['body'],'sender':_0x186198['senderString']||_0x186198['phone'],'authorization':_0x186198['authToken']};var _0x2e0589={'method':'POST','uri':_0x7d95('0x3e'),'body':_0x632cc4,'json':!![]};rp(_0x2e0589)[_0x7d95('0x19')](function(_0x40f2ae){var _0x28d7eb={'messageId':_0x40f2ae[_0x7d95('0x3f')]};if(!_0x186198[_0x7d95('0x40')]){_0x28d7eb[_0x7d95('0x3b')]=!![];}return _0x572e5f[_0x7d95('0x1a')](_0x28d7eb);})[_0x7d95('0x1b')](function(_0x6901c5){logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x3d'),util[_0x7d95('0x2c')](_0x6901c5,{'showHidden':![],'depth':null}));});}else{logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0x7d95('0x41'):if(_0x186198[_0x7d95('0x33')]&&_0x186198['password']){var _0x632cc4={'messages':[{'source':_0x7d95('0x42'),'to':_0x2af3bd['phone'],'body':_0x2af3bd[_0x7d95('0xe')],'from':_0x186198['senderString']||_0x186198['phone']}]};var _0x2671e6=util[_0x7d95('0x43')](_0x7d95('0x44'),_0x186198[_0x7d95('0x33')],_0x186198[_0x7d95('0x30')]);var _0x2e0589={'method':_0x7d95('0x37'),'uri':_0x7d95('0x45'),'body':_0x632cc4,'headers':{'Authorization':util[_0x7d95('0x43')]('Basic\x20%s',new Buffer(_0x2671e6)[_0x7d95('0x46')]('base64'))},'json':!![]};rp(_0x2e0589)[_0x7d95('0x19')](function(_0x2d4a5b){if(_0x2d4a5b[_0x7d95('0x47')]>=0xc8&&_0x2d4a5b[_0x7d95('0x47')]<=0xce){if(_0x2d4a5b[_0x7d95('0x48')]&&_0x2d4a5b[_0x7d95('0x48')][_0x7d95('0x49')]>0x0){var _0x14ae42=_[_0x7d95('0x4a')](_0x2d4a5b[_0x7d95('0x48')]['messages']);var _0x226daa={'messageId':_0x14ae42[_0x7d95('0x4b')]};if(!_0x186198[_0x7d95('0x40')]){_0x226daa[_0x7d95('0x3b')]=!![];}return _0x572e5f[_0x7d95('0x1a')](_0x226daa);}else{logger[_0x7d95('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7d95('0x4c'),util[_0x7d95('0x2c')](_0x2d4a5b,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),'clickSend',util[_0x7d95('0x2c')](_0x2d4a5b,{'showHidden':![],'depth':null}));}})[_0x7d95('0x1b')](function(_0x306ae9){logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x4c'),util[_0x7d95('0x2c')](_0x306ae9,{'showHidden':![],'depth':null}));});}else{logger[_0x7d95('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d95('0x2b'),'clickSend',_0x7d95('0x3c'));}break;case'plivo':if(_0x186198[_0x7d95('0x4d')]&&_0x186198[_0x7d95('0x23')]){var _0x632cc4={'dst':_0x2af3bd[_0x7d95('0x24')],'text':_0x2af3bd[_0x7d95('0xe')],'src':_0x186198[_0x7d95('0x4e')]||_0x186198[_0x7d95('0x24')],'url':_0x186198[_0x7d95('0x4f')]+_0x7d95('0x26')+_0x2af3bd['id']+'/status?token='+_0x186198[_0x7d95('0x28')]};var _0x2671e6=util[_0x7d95('0x43')](_0x7d95('0x44'),_0x186198[_0x7d95('0x4d')],_0x186198[_0x7d95('0x23')]);var _0x2e0589={'method':_0x7d95('0x37'),'uri':util[_0x7d95('0x43')](_0x7d95('0x50'),_0x186198[_0x7d95('0x4d')]),'body':_0x632cc4,'headers':{'Authorization':util[_0x7d95('0x43')](_0x7d95('0x51'),new Buffer(_0x2671e6)[_0x7d95('0x46')]('base64'))},'json':!![]};rp(_0x2e0589)[_0x7d95('0x19')](function(_0x1d6b9b){var _0x26edb3={'messageId':_0x1d6b9b[_0x7d95('0x52')][0x0]};return _0x572e5f[_0x7d95('0x1a')](_0x26edb3);})[_0x7d95('0x1b')](function(_0x426a3e){logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x53'),util[_0x7d95('0x2c')](_0x426a3e,{'showHidden':![],'depth':null}));});}else{logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x53'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x186198[_0x7d95('0x33')]&&_0x186198[_0x7d95('0x30')]){if(_0x186198[_0x7d95('0x54')]){var _0x5771c7={'method':_0x7d95('0x37'),'uri':_0x186198[_0x7d95('0x54')]+_0x7d95('0x55'),'body':{'username':_0x186198[_0x7d95('0x33')],'password':_0x186198[_0x7d95('0x30')]},'json':!![]};return rp(_0x5771c7)[_0x7d95('0x19')](function(_0x47a6a6){var _0x5267d0={'method':_0x7d95('0x37'),'uri':_0x186198[_0x7d95('0x54')]+_0x7d95('0x56'),'body':{'messages':[{'from':_0x186198[_0x7d95('0x24')],'destinations':[{'to':_0x2af3bd[_0x7d95('0x24')]}],'text':_0x2af3bd[_0x7d95('0xe')],'notifyUrl':_0x186198['remote']+_0x7d95('0x26')+_0x2af3bd['id']+_0x7d95('0x27')+_0x186198[_0x7d95('0x28')],'notifyContentType':_0x7d95('0x57'),'callbackData':_0x186198[_0x7d95('0x24')]+';'+_0x2af3bd['body']}]},'headers':{'Authorization':_0x7d95('0x58')+_0x47a6a6[_0x7d95('0x28')]},'json':!![]};return rp(_0x5267d0)[_0x7d95('0x19')](function(_0x32194e){if(_0x32194e[_0x7d95('0x59')]){var _0x22439f={'messageId':_0x32194e[_0x7d95('0x59')][0x0][_0x7d95('0xc')]};if(!_0x186198[_0x7d95('0x40')]){_0x22439f['read']=!![];}return _0x572e5f['update'](_0x22439f);}else{return logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x5a'),util[_0x7d95('0x2c')](_0x32194e,{'showHidden':![],'depth':null}));}});})[_0x7d95('0x1b')](function(_0x2f691a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d95('0x2b'),_0x7d95('0x5a'),util[_0x7d95('0x2c')](_0x2f691a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7d95('0x5a'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x5a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7d95('0x5b'):var _0x29de59=require(_0x7d95('0x5c'));if(_0x186198[_0x7d95('0x5d')]){var _0x2504d3={};_0x2504d3[_0x7d95('0x5e')]=_0x186198[_0x7d95('0x33')];_0x2504d3[_0x7d95('0x24')]=_0x2af3bd[_0x7d95('0x24')];_0x2504d3['sender']=_0x186198['phone'];_0x2504d3[_0x7d95('0x5f')]=_0x2af3bd[_0x7d95('0xe')];_0x2504d3['timestamp']=+new Date();var _0x49bcc9='';var _0x60825c='';var _0x15dddd=Object[_0x7d95('0x60')](_0x2504d3);_0x15dddd[_0x7d95('0x61')]();for(var _0x493f64=0x0;_0x493f64<_0x15dddd[_0x7d95('0x62')];_0x493f64++){if(_0x49bcc9!=''){_0x49bcc9+='&';}_0x49bcc9+=_0x15dddd[_0x493f64]+'='+encodeURIComponent(_0x2504d3[_0x15dddd[_0x493f64]]);_0x60825c+=_0x2504d3[_0x15dddd[_0x493f64]];}_0x60825c+=_0x186198[_0x7d95('0x5d')];_0x60825c=_0x29de59[_0x7d95('0x63')](_0x7d95('0x64'))[_0x7d95('0x1a')](_0x60825c)[_0x7d95('0x65')](_0x7d95('0x66'));if(_0x49bcc9!==''){_0x49bcc9+='&';}_0x49bcc9+='signature='+_0x60825c;var _0x2a98aa={'method':_0x7d95('0x34'),'uri':_0x186198[_0x7d95('0x54')]+_0x7d95('0x67')+_0x49bcc9,'json':!![]};return rp(_0x2a98aa)[_0x7d95('0x19')](function(_0x17f428){var _0x258a28=Object[_0x7d95('0x60')](_0x17f428);if(_0x17f428[_0x258a28[0x0]]['error']&&parseInt(_0x17f428[_0x258a28[0x0]][_0x7d95('0x1c')])===0x0){var _0x52a99c={'messageId':_0x17f428[_0x258a28[0x0]]['id_sms']};if(!_0x186198[_0x7d95('0x40')]){_0x52a99c[_0x7d95('0x3b')]=!![];}return _0x572e5f[_0x7d95('0x1a')](_0x52a99c);}else{return logger[_0x7d95('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7d95('0x5b'),util[_0x7d95('0x2c')](_0x17f428['error'],{'showHidden':![],'depth':null}));}})[_0x7d95('0x1b')](function(_0x47e5b0){return logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),'csc',util['inspect'](_0x47e5b0,{'showHidden':![],'depth':null}));});}else{logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x5b'),_0x7d95('0x68'));}break;case _0x7d95('0x69'):if(_0x186198['apiKey']){var _0x298da8={'method':_0x7d95('0x37'),'uri':_0x7d95('0x6a'),'headers':{'Authorization':_0x186198[_0x7d95('0x5d')]},'body':{'content':_0x2af3bd[_0x7d95('0xe')],'to':[_0x2af3bd[_0x7d95('0x24')]],'from':_0x186198[_0x7d95('0x24')],'binary':![],'clientMessageId':_0x7d95('0x6b'),'charset':_0x7d95('0x6c')},'json':!![]};rp(_0x298da8)[_0x7d95('0x19')](function(_0x50fb3d){if(!_0x50fb3d['error']){var _0x54ee95={'messageId':_0x50fb3d[_0x7d95('0x59')][0x0][_0x7d95('0x6d')]};if(!_0x186198[_0x7d95('0x40')]){_0x54ee95[_0x7d95('0x3b')]=!![];}return _0x572e5f['update'](_0x54ee95);}else{return logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x69'),util['inspect'](_0x50fb3d[_0x7d95('0x1c')],{'showHidden':![],'depth':null}));}})[_0x7d95('0x1b')](function(_0x32e05d){return logger[_0x7d95('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d95('0x2b'),_0x7d95('0x69'),util[_0x7d95('0x2c')](_0x32e05d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x69'),_0x7d95('0x68'));}break;case'bandwidth':if(_0x186198[_0x7d95('0x33')]&&_0x186198[_0x7d95('0x30')]){var _0x2671e6=util[_0x7d95('0x43')](_0x7d95('0x44'),_0x186198[_0x7d95('0x33')],_0x186198[_0x7d95('0x30')]);var _0x2e0589={'method':_0x7d95('0x37'),'uri':_0x7d95('0x6e')+_0x186198[_0x7d95('0x6f')]+_0x7d95('0x70'),'body':{'to':[_0x2af3bd[_0x7d95('0x24')]],'text':_0x2af3bd[_0x7d95('0xe')],'from':_0x186198[_0x7d95('0x24')],'applicationId':_0x186198['applicationId']},'headers':{'Authorization':util[_0x7d95('0x43')](_0x7d95('0x51'),new Buffer(_0x2671e6)[_0x7d95('0x46')](_0x7d95('0x71')))},'json':!![]};rp(_0x2e0589)[_0x7d95('0x19')](function(_0x42488e){if(_0x42488e['id']){var _0x3f1359={'messageId':_0x42488e['id']};return _0x572e5f[_0x7d95('0x1a')](_0x3f1359);}else{logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x72'),util['inspect'](_0x42488e,{'showHidden':![],'depth':null}));}})[_0x7d95('0x1b')](function(_0x287576){logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x72'),util[_0x7d95('0x2c')](_0x287576,{'showHidden':![],'depth':null}));});}else{logger[_0x7d95('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d95('0x2b'),_0x7d95('0x72'),_0x7d95('0x3c'));}break;case'intelepeer':if(_0x186198[_0x7d95('0x5d')]){var _0x366051={};var _0x2a98aa={'method':_0x7d95('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x7d95('0x73')+_0x186198[_0x7d95('0x5d')],'Content-Type':_0x7d95('0x57')},'body':{'from':_0x186198['phone'],'to':_0x2af3bd['phone'],'text':_0x2af3bd['body']},'json':!![]};return rp(_0x2a98aa)[_0x7d95('0x19')](function(_0x5db6de){if(_0x5db6de[_0x7d95('0x74')]==0xca){_0x366051[_0x7d95('0x75')]=_0x5db6de;var _0x4b562a={'method':'POST','uri':_0x7d95('0x76'),'headers':{'Authorization':_0x7d95('0x73')+_0x186198[_0x7d95('0x5d')],'Content-Type':_0x7d95('0x57')},'body':{'refid':_0x366051['message'][_0x7d95('0x77')]},'json':!![]};return rp(_0x4b562a)[_0x7d95('0x19')](function(_0x4d6378){_0x366051['status']=_0x4d6378;var _0x22b918={'messageId':_0x366051[_0x7d95('0x75')]['refid'],'read':!![]};return _0x572e5f[_0x7d95('0x1a')](_0x22b918);});}else{return logger[_0x7d95('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7d95('0x78'),util[_0x7d95('0x2c')](_0x5db6de,{'showHidden':![],'depth':null}));}})[_0x7d95('0x1b')](function(_0x5b4497){return logger['error'](_0x7d95('0x2a'),'afterCreate','intelepeer',util[_0x7d95('0x2c')](_0x5b4497,{'showHidden':![],'depth':null}));});}else{return logger[_0x7d95('0x1c')](_0x7d95('0x2a'),_0x7d95('0x2b'),_0x7d95('0x78'),_0x7d95('0x79'));}break;}}})[_0x7d95('0x7a')](function(){_0x109cec();});}else{_0x109cec();}}},'charset':_0x7d95('0x7b'),'collate':_0x7d95('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index cbe6e4f..8642230 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 _0x9367=['socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x1bbe7e,_0x2080cf){var _0x9d176b=function(_0x1a69a1){while(--_0x1a69a1){_0x1bbe7e['push'](_0x1bbe7e['shift']());}};_0x9d176b(++_0x2080cf);}(_0x9367,0x113));var _0x7936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9367[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7936('0x0'));var util=require('util');var moment=require(_0x7936('0x1'));var BPromise=require(_0x7936('0x2'));var rs=require(_0x7936('0x3'));var fs=require('fs');var Redis=require(_0x7936('0x4'));var db=require(_0x7936('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7936('0x6'))(_0x7936('0x7'));var config=require('../../config/environment');var jayson=require(_0x7936('0x8'));var client=jayson[_0x7936('0x9')][_0x7936('0xa')]({'port':0x232a});config[_0x7936('0xb')]=_['defaults'](config[_0x7936('0xb')],{'host':_0x7936('0xc'),'port':0x18eb});var socket=require(_0x7936('0xd'))(new Redis(config['redis']));require(_0x7936('0xe'))['register'](socket);function respondWithRpcPromise(_0x2c434e,_0x26a06a,_0x1abdad){return new BPromise(function(_0x38f7e7,_0x1fca3e){return client[_0x7936('0xf')](_0x2c434e,_0x1abdad)[_0x7936('0x10')](function(_0x29f700){logger['info'](_0x7936('0x11'),_0x26a06a,_0x7936('0x12'));logger[_0x7936('0x13')](_0x7936('0x14'),_0x26a06a,'request\x20sent',JSON['stringify'](_0x29f700));if(_0x29f700[_0x7936('0x15')]){if(_0x29f700[_0x7936('0x15')]['code']===0x1f4){logger[_0x7936('0x15')](_0x7936('0x11'),_0x26a06a,_0x29f700['error'][_0x7936('0x16')]);return _0x1fca3e(_0x29f700[_0x7936('0x15')][_0x7936('0x16')]);}logger[_0x7936('0x15')]('SmsMessage,\x20%s,\x20%s',_0x26a06a,_0x29f700['error'][_0x7936('0x16')]);return _0x38f7e7(_0x29f700[_0x7936('0x15')][_0x7936('0x16')]);}else{logger[_0x7936('0x17')]('SmsMessage,\x20%s,\x20%s',_0x26a06a,_0x7936('0x12'));_0x38f7e7(_0x29f700[_0x7936('0x18')][_0x7936('0x16')]);}})[_0x7936('0x19')](function(_0x5b4011){logger[_0x7936('0x15')](_0x7936('0x11'),_0x26a06a,_0x5b4011);_0x1fca3e(_0x5b4011);});});}exports[_0x7936('0x1a')]=function(_0x21a196){var _0x41a47d=this;return new Promise(function(_0x511dae,_0x2394d8){return db[_0x7936('0x1b')]['create'](_0x21a196[_0x7936('0x1c')],{'raw':_0x21a196[_0x7936('0x1d')]?_0x21a196[_0x7936('0x1d')][_0x7936('0x1e')]===undefined?!![]:![]:!![]})[_0x7936('0x10')](function(_0x53a050){logger[_0x7936('0x17')]('CreateSmsMessage',_0x21a196);logger[_0x7936('0x13')]('CreateSmsMessage',_0x21a196,JSON[_0x7936('0x1f')](_0x53a050));_0x511dae(_0x53a050);})['catch'](function(_0x411805){logger[_0x7936('0x15')]('CreateSmsMessage',_0x411805[_0x7936('0x16')],_0x21a196);_0x2394d8(_0x41a47d[_0x7936('0x15')](0x1f4,_0x411805[_0x7936('0x16')]));});});}; \ No newline at end of file +var _0x4375=['code','message','result','CreateSmsMessage','SmsMessage','body','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4375,0x6a));var _0x5437=function(_0x4483a6,_0x3b9882){_0x4483a6=_0x4483a6-0x0;var _0x2edaed=_0x4375[_0x4483a6];return _0x2edaed;};'use strict';var _=require(_0x5437('0x0'));var util=require(_0x5437('0x1'));var moment=require(_0x5437('0x2'));var BPromise=require('bluebird');var rs=require(_0x5437('0x3'));var fs=require('fs');var Redis=require(_0x5437('0x4'));var db=require(_0x5437('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5437('0x6'))(_0x5437('0x7'));var config=require(_0x5437('0x8'));var jayson=require(_0x5437('0x9'));var client=jayson['client'][_0x5437('0xa')]({'port':0x232a});config[_0x5437('0xb')]=_[_0x5437('0xc')](config[_0x5437('0xb')],{'host':_0x5437('0xd'),'port':0x18eb});var socket=require(_0x5437('0xe'))(new Redis(config[_0x5437('0xb')]));require(_0x5437('0xf'))[_0x5437('0x10')](socket);function respondWithRpcPromise(_0xda1c3d,_0x355aa2,_0x3c1f3f){return new BPromise(function(_0x1f98e8,_0x18b634){return client[_0x5437('0x11')](_0xda1c3d,_0x3c1f3f)[_0x5437('0x12')](function(_0x3d2ad3){logger[_0x5437('0x13')](_0x5437('0x14'),_0x355aa2,_0x5437('0x15'));logger[_0x5437('0x16')](_0x5437('0x17'),_0x355aa2,_0x5437('0x15'),JSON[_0x5437('0x18')](_0x3d2ad3));if(_0x3d2ad3[_0x5437('0x19')]){if(_0x3d2ad3[_0x5437('0x19')][_0x5437('0x1a')]===0x1f4){logger[_0x5437('0x19')](_0x5437('0x14'),_0x355aa2,_0x3d2ad3[_0x5437('0x19')][_0x5437('0x1b')]);return _0x18b634(_0x3d2ad3[_0x5437('0x19')][_0x5437('0x1b')]);}logger['error'](_0x5437('0x14'),_0x355aa2,_0x3d2ad3[_0x5437('0x19')][_0x5437('0x1b')]);return _0x1f98e8(_0x3d2ad3[_0x5437('0x19')][_0x5437('0x1b')]);}else{logger[_0x5437('0x13')](_0x5437('0x14'),_0x355aa2,'request\x20sent');_0x1f98e8(_0x3d2ad3[_0x5437('0x1c')][_0x5437('0x1b')]);}})['catch'](function(_0x27ed8c){logger['error'](_0x5437('0x14'),_0x355aa2,_0x27ed8c);_0x18b634(_0x27ed8c);});});}exports[_0x5437('0x1d')]=function(_0x2b3797){var _0x124b7f=this;return new Promise(function(_0x19af03,_0xa7b685){return db[_0x5437('0x1e')]['create'](_0x2b3797[_0x5437('0x1f')],{'raw':_0x2b3797['options']?_0x2b3797['options']['raw']===undefined?!![]:![]:!![]})[_0x5437('0x12')](function(_0x411eb8){logger[_0x5437('0x13')](_0x5437('0x1d'),_0x2b3797);logger[_0x5437('0x16')](_0x5437('0x1d'),_0x2b3797,JSON['stringify'](_0x411eb8));_0x19af03(_0x411eb8);})[_0x5437('0x20')](function(_0x5280c2){logger[_0x5437('0x19')](_0x5437('0x1d'),_0x5280c2[_0x5437('0x1b')],_0x2b3797);_0xa7b685(_0x124b7f[_0x5437('0x19')](0x1f4,_0x5280c2[_0x5437('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 206fcb6..54ce4ee 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 _0x4149=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x22d2e9,_0x2be6ef){var _0x367531=function(_0x172ac7){while(--_0x172ac7){_0x22d2e9['push'](_0x22d2e9['shift']());}};_0x367531(++_0x2be6ef);}(_0x4149,0xa8));var _0x9414=function(_0x39c1d1,_0x3da3f0){_0x39c1d1=_0x39c1d1-0x0;var _0x26e67e=_0x4149[_0x39c1d1];return _0x26e67e;};'use strict';var SmsMessageEvents=require(_0x9414('0x0'));var events=[_0x9414('0x1'),_0x9414('0x2'),_0x9414('0x3')];function createListener(_0x25246c,_0x2b5ac2){return function(_0x49412e){_0x2b5ac2[_0x9414('0x4')](_0x25246c,_0x49412e);};}function removeListener(_0x599669,_0x541d63){return function(){SmsMessageEvents[_0x9414('0x5')](_0x599669,_0x541d63);};}exports[_0x9414('0x6')]=function(_0x350d3c){for(var _0x337d05=0x0,_0x2e4235=events[_0x9414('0x7')];_0x337d05<_0x2e4235;_0x337d05++){var _0xdd61bb=events[_0x337d05];var _0xf1467e=createListener(_0x9414('0x8')+_0xdd61bb,_0x350d3c);SmsMessageEvents['on'](_0xdd61bb,_0xf1467e);}}; \ No newline at end of file +var _0x77a2=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77a2,0x1ae));var _0x277a=function(_0x55fb99,_0x1af191){_0x55fb99=_0x55fb99-0x0;var _0x2ce6eb=_0x77a2[_0x55fb99];return _0x2ce6eb;};'use strict';var SmsMessageEvents=require(_0x277a('0x0'));var events=[_0x277a('0x1'),'remove',_0x277a('0x2')];function createListener(_0x5f5397,_0x3dd794){return function(_0x2fa993){_0x3dd794[_0x277a('0x3')](_0x5f5397,_0x2fa993);};}function removeListener(_0x330eb4,_0x2704d0){return function(){SmsMessageEvents[_0x277a('0x4')](_0x330eb4,_0x2704d0);};}exports[_0x277a('0x5')]=function(_0xa02c0c){for(var _0x554f35=0x0,_0x362595=events[_0x277a('0x6')];_0x554f35<_0x362595;_0x554f35++){var _0xc91997=events[_0x554f35];var _0x4d8154=createListener(_0x277a('0x7')+_0xc91997,_0xa02c0c);SmsMessageEvents['on'](_0xc91997,_0x4d8154);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2568443..1060680 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 _0x9898=['describe','/:id','show','getMembers','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated'];(function(_0x2262f1,_0x88fef8){var _0x433644=function(_0x4e761c){while(--_0x4e761c){_0x2262f1['push'](_0x2262f1['shift']());}};_0x433644(++_0x88fef8);}(_0x9898,0xc5));var _0x8989=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0x9898[_0x328b1c];return _0x4dbeaa;};'use strict';var multer=require(_0x8989('0x0'));var util=require(_0x8989('0x1'));var path=require(_0x8989('0x2'));var timeout=require('connect-timeout');var express=require(_0x8989('0x3'));var router=express['Router']();var fs_extra=require(_0x8989('0x4'));var auth=require(_0x8989('0x5'));var interaction=require(_0x8989('0x6'));var config=require(_0x8989('0x7'));var controller=require(_0x8989('0x8'));router[_0x8989('0x9')]('/',auth['isAuthenticated'](),controller[_0x8989('0xa')]);router[_0x8989('0x9')](_0x8989('0xb'),auth[_0x8989('0xc')](),controller[_0x8989('0xd')]);router[_0x8989('0x9')](_0x8989('0xe'),auth[_0x8989('0xc')](),controller[_0x8989('0xf')]);router[_0x8989('0x9')]('/:id/members',auth[_0x8989('0xc')](),controller[_0x8989('0x10')]);router[_0x8989('0x9')]('/:id/teams',auth[_0x8989('0xc')](),controller['getTeams']);router[_0x8989('0x9')]('/:id/users',auth[_0x8989('0xc')](),controller['getAgents']);router[_0x8989('0x11')]('/',auth[_0x8989('0xc')](),controller[_0x8989('0x12')]);router[_0x8989('0x11')](_0x8989('0x13'),auth[_0x8989('0xc')](),controller[_0x8989('0x14')]);router[_0x8989('0x11')](_0x8989('0x15'),auth[_0x8989('0xc')](),controller[_0x8989('0x16')]);router[_0x8989('0x17')](_0x8989('0xe'),auth[_0x8989('0xc')](),controller[_0x8989('0x18')]);router[_0x8989('0x19')](_0x8989('0xe'),auth[_0x8989('0xc')](),controller[_0x8989('0x1a')]);router[_0x8989('0x19')](_0x8989('0x13'),auth[_0x8989('0xc')](),controller[_0x8989('0x1b')]);router[_0x8989('0x19')](_0x8989('0x15'),auth[_0x8989('0xc')](),controller[_0x8989('0x1c')]);module[_0x8989('0x1d')]=router; \ No newline at end of file +var _0x1da1=['../../components/auth/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','Router','fs-extra'];(function(_0x38e685,_0x446b34){var _0x5439a9=function(_0x36af33){while(--_0x36af33){_0x38e685['push'](_0x38e685['shift']());}};_0x5439a9(++_0x446b34);}(_0x1da1,0x6c));var _0x11da=function(_0x10aefe,_0x5adb5e){_0x10aefe=_0x10aefe-0x0;var _0x1a4cca=_0x1da1[_0x10aefe];return _0x1a4cca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11da('0x0'));var timeout=require(_0x11da('0x1'));var express=require('express');var router=express[_0x11da('0x2')]();var fs_extra=require(_0x11da('0x3'));var auth=require(_0x11da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x11da('0x5'));var controller=require(_0x11da('0x6'));router[_0x11da('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x11da('0x7')](_0x11da('0x8'),auth[_0x11da('0x9')](),controller[_0x11da('0xa')]);router[_0x11da('0x7')](_0x11da('0xb'),auth[_0x11da('0x9')](),controller[_0x11da('0xc')]);router[_0x11da('0x7')](_0x11da('0xd'),auth[_0x11da('0x9')](),controller[_0x11da('0xe')]);router['get'](_0x11da('0xf'),auth[_0x11da('0x9')](),controller[_0x11da('0x10')]);router[_0x11da('0x7')](_0x11da('0x11'),auth[_0x11da('0x9')](),controller[_0x11da('0x12')]);router[_0x11da('0x13')]('/',auth[_0x11da('0x9')](),controller[_0x11da('0x14')]);router[_0x11da('0x13')](_0x11da('0xf'),auth[_0x11da('0x9')](),controller[_0x11da('0x15')]);router['post']('/:id/users',auth[_0x11da('0x9')](),controller['addAgents']);router['put'](_0x11da('0xb'),auth['isAuthenticated'](),controller[_0x11da('0x16')]);router[_0x11da('0x17')](_0x11da('0xb'),auth[_0x11da('0x9')](),controller[_0x11da('0x18')]);router[_0x11da('0x17')](_0x11da('0xf'),auth[_0x11da('0x9')](),controller[_0x11da('0x19')]);router[_0x11da('0x17')](_0x11da('0x11'),auth[_0x11da('0x9')](),controller[_0x11da('0x1a')]);module[_0x11da('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4195109..6801121 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 _0x360b=['ENUM','beepall','roundrobin','name'];(function(_0x3661b6,_0x19a9fb){var _0x6b4280=function(_0x297b22){while(--_0x297b22){_0x3661b6['push'](_0x3661b6['shift']());}};_0x6b4280(++_0x19a9fb);}(_0x360b,0x7f));var _0xb360=function(_0xb29bdd,_0x52dcee){_0xb29bdd=_0xb29bdd-0x0;var _0x3ec172=_0x360b[_0xb29bdd];return _0x3ec172;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb360('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb360('0x1')]('rrmemory',_0xb360('0x2'),_0xb360('0x3'))}}; \ No newline at end of file +var _0x49d2=['beepall','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x5b9666,_0x50b1ac){var _0x2499a5=function(_0x453c5c){while(--_0x453c5c){_0x5b9666['push'](_0x5b9666['shift']());}};_0x2499a5(++_0x50b1ac);}(_0x49d2,0x9d));var _0x249d=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x49d2[_0x347471];return _0x422b6a;};'use strict';var Sequelize=require(_0x249d('0x0'));module[_0x249d('0x1')]={'name':{'type':Sequelize[_0x249d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x249d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x249d('0x3')](_0x249d('0x4'),_0x249d('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index dd8ee05..37a92a3 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 _0xb697=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','params','describe','findOne','hasOwnProperty','order','UserSmsQueue','User','updatedAt','createdAt','format','SIP','getTeams','Team','ids','findAll','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','removeTeams','isEmpty','omit','spread','removeAgents','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','SmsQueues','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','rows','include','find','catch','create','body'];(function(_0x5382f1,_0x5704ec){var _0x914fae=function(_0x460173){while(--_0x460173){_0x5382f1['push'](_0x5382f1['shift']());}};_0x914fae(++_0x5704ec);}(_0xb697,0x142));var _0x7b69=function(_0x2ff7c5,_0x2dda17){_0x2ff7c5=_0x2ff7c5-0x0;var _0x3e17c5=_0xb697[_0x2ff7c5];return _0x3e17c5;};'use strict';var emlformat=require(_0x7b69('0x0'));var rimraf=require(_0x7b69('0x1'));var zipdir=require(_0x7b69('0x2'));var jsonpatch=require(_0x7b69('0x3'));var rp=require(_0x7b69('0x4'));var moment=require('moment');var BPromise=require(_0x7b69('0x5'));var Mustache=require(_0x7b69('0x6'));var util=require(_0x7b69('0x7'));var path=require(_0x7b69('0x8'));var sox=require(_0x7b69('0x9'));var csv=require('to-csv');var ejs=require(_0x7b69('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b69('0xb'));var squel=require('squel');var crypto=require(_0x7b69('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b69('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b69('0xe'));var Redis=require('ioredis');var authService=require(_0x7b69('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7b69('0x10'));var hardwareService=require(_0x7b69('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7b69('0x12'));var config=require(_0x7b69('0x13'));var licenseUtil=require(_0x7b69('0x14'));var db=require('../../mysqldb')['db'];config[_0x7b69('0x15')]=_[_0x7b69('0x16')](config[_0x7b69('0x15')],{'host':_0x7b69('0x17'),'port':0x18eb});var socket=require(_0x7b69('0x18'))(new Redis(config[_0x7b69('0x15')]));require(_0x7b69('0x19'))[_0x7b69('0x1a')](socket);function respondWithStatusCode(_0x347f54,_0x50575c){_0x50575c=_0x50575c||0xcc;return function(_0xc0e732){if(_0xc0e732){return _0x347f54[_0x7b69('0x1b')](_0x50575c);}return _0x347f54[_0x7b69('0x1c')](_0x50575c)[_0x7b69('0x1d')]();};}function respondWithResult(_0x458c53,_0x429a59){_0x429a59=_0x429a59||0xc8;return function(_0xc0fc2d){if(_0xc0fc2d){return _0x458c53[_0x7b69('0x1c')](_0x429a59)[_0x7b69('0x1e')](_0xc0fc2d);}};}function respondWithFilteredResult(_0x466ea7,_0x31d174){return function(_0x13b433){if(_0x13b433){var _0x358bed=typeof _0x31d174['offset']==='undefined'&&typeof _0x31d174[_0x7b69('0x1f')]===_0x7b69('0x20');var _0x2b66db=_0x13b433[_0x7b69('0x21')];var _0x2869c2=_0x358bed?0x0:_0x31d174[_0x7b69('0x22')];var _0x301c44=_0x358bed?_0x13b433['count']:_0x31d174['offset']+_0x31d174[_0x7b69('0x1f')];var _0x1e71dd;if(_0x301c44>=_0x2b66db){_0x301c44=_0x2b66db;_0x1e71dd=0xc8;}else{_0x1e71dd=0xce;}_0x466ea7[_0x7b69('0x1c')](_0x1e71dd);return _0x466ea7['set'](_0x7b69('0x23'),_0x2869c2+'-'+_0x301c44+'/'+_0x2b66db)[_0x7b69('0x1e')](_0x13b433);}return null;};}function patchUpdates(_0x4a7d60){return function(_0x2b610d){try{jsonpatch[_0x7b69('0x24')](_0x2b610d,_0x4a7d60,!![]);}catch(_0x522f69){return BPromise[_0x7b69('0x25')](_0x522f69);}return _0x2b610d[_0x7b69('0x26')]();};}function saveUpdates(_0x4088bd,_0x35041d){return function(_0x2dbec4){if(_0x2dbec4){return _0x2dbec4[_0x7b69('0x27')](_0x4088bd)['then'](function(_0x526548){return _0x526548;});}return null;};}function removeEntity(_0x527ded,_0x455094){return function(_0x232736){if(_0x232736){return _0x232736[_0x7b69('0x28')]()[_0x7b69('0x29')](function(){var _0x259f20=_0x232736[_0x7b69('0x2a')]({'plain':!![]});var _0x37b3ab=_0x7b69('0x2b');return db[_0x7b69('0x2c')][_0x7b69('0x28')]({'where':{'type':_0x37b3ab,'resourceId':_0x259f20['id']}})[_0x7b69('0x29')](function(){return _0x232736;});})[_0x7b69('0x29')](function(){_0x527ded[_0x7b69('0x1c')](0xcc)[_0x7b69('0x1d')]();});}};}function handleEntityNotFound(_0x22e485,_0x330873){return function(_0x3cd189){if(!_0x3cd189){_0x22e485[_0x7b69('0x1b')](0x194);}return _0x3cd189;};}function handleError(_0xa4ee1b,_0x4b3700){_0x4b3700=_0x4b3700||0x1f4;return function(_0x55340d){logger[_0x7b69('0x2d')](_0x55340d[_0x7b69('0x2e')]);if(_0x55340d[_0x7b69('0x2f')]){delete _0x55340d[_0x7b69('0x2f')];}_0xa4ee1b[_0x7b69('0x1c')](_0x4b3700)[_0x7b69('0x30')](_0x55340d);};}exports['index']=function(_0xc877cb,_0x1fa1a2){var _0x104f9d={},_0x15fd61={},_0x20227c={'count':0x0,'rows':[]};var _0x2892ed=_[_0x7b69('0x31')](db[_0x7b69('0x32')][_0x7b69('0x33')],function(_0x3acbc2){return{'name':_0x3acbc2[_0x7b69('0x34')],'type':_0x3acbc2[_0x7b69('0x35')][_0x7b69('0x36')]};});_0x15fd61[_0x7b69('0x37')]=_['map'](_0x2892ed,_0x7b69('0x2f'));_0x15fd61['query']=_[_0x7b69('0x38')](_0xc877cb[_0x7b69('0x39')]);_0x15fd61['filters']=_[_0x7b69('0x3a')](_0x15fd61[_0x7b69('0x37')],_0x15fd61[_0x7b69('0x39')]);_0x104f9d[_0x7b69('0x3b')]=_[_0x7b69('0x3a')](_0x15fd61['model'],qs[_0x7b69('0x3c')](_0xc877cb[_0x7b69('0x39')][_0x7b69('0x3c')]));_0x104f9d['attributes']=_0x104f9d[_0x7b69('0x3b')][_0x7b69('0x3d')]?_0x104f9d[_0x7b69('0x3b')]:_0x15fd61[_0x7b69('0x37')];if(!_0xc877cb[_0x7b69('0x39')]['hasOwnProperty'](_0x7b69('0x3e'))){_0x104f9d[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0xc877cb[_0x7b69('0x39')]['limit']);_0x104f9d[_0x7b69('0x22')]=qs[_0x7b69('0x22')](_0xc877cb[_0x7b69('0x39')][_0x7b69('0x22')]);}_0x104f9d['order']=qs[_0x7b69('0x3f')](_0xc877cb['query'][_0x7b69('0x3f')]);_0x104f9d['where']=qs[_0x7b69('0x40')](_[_0x7b69('0x41')](_0xc877cb[_0x7b69('0x39')],_0x15fd61[_0x7b69('0x40')]),_0x2892ed);if(_0xc877cb[_0x7b69('0x39')][_0x7b69('0x42')]){_0x104f9d[_0x7b69('0x43')]=_[_0x7b69('0x44')](_0x104f9d[_0x7b69('0x43')],{'$or':_['map'](_0x2892ed,function(_0x5afb9a){if(_0x5afb9a[_0x7b69('0x35')]!=='VIRTUAL'){var _0x53c24f={};_0x53c24f[_0x5afb9a[_0x7b69('0x2f')]]={'$like':'%'+_0xc877cb[_0x7b69('0x39')][_0x7b69('0x42')]+'%'};return _0x53c24f;}})});}_0x104f9d=_[_0x7b69('0x44')]({},_0x104f9d,_0xc877cb[_0x7b69('0x45')]);var _0x63bc11={'where':_0x104f9d['where']};return db[_0x7b69('0x32')][_0x7b69('0x21')](_0x63bc11)[_0x7b69('0x29')](function(_0x5b509d){_0x20227c[_0x7b69('0x21')]=_0x5b509d;if(_0xc877cb['query'][_0x7b69('0x46')]){_0x104f9d['include']=[{'all':!![]}];}return db[_0x7b69('0x32')]['findAll'](_0x104f9d);})[_0x7b69('0x29')](function(_0x5e8487){_0x20227c[_0x7b69('0x47')]=_0x5e8487;return _0x20227c;})[_0x7b69('0x29')](respondWithFilteredResult(_0x1fa1a2,_0x104f9d))['catch'](handleError(_0x1fa1a2,null));};exports['show']=function(_0x14ec39,_0x143695){var _0x20999b={'raw':!![],'where':{'id':_0x14ec39['params']['id']}},_0x25b5f2={};_0x25b5f2['model']=_['keys'](db[_0x7b69('0x32')][_0x7b69('0x33')]);_0x25b5f2[_0x7b69('0x39')]=_[_0x7b69('0x38')](_0x14ec39[_0x7b69('0x39')]);_0x25b5f2['filters']=_[_0x7b69('0x3a')](_0x25b5f2[_0x7b69('0x37')],_0x25b5f2[_0x7b69('0x39')]);_0x20999b['attributes']=_[_0x7b69('0x3a')](_0x25b5f2['model'],qs[_0x7b69('0x3c')](_0x14ec39[_0x7b69('0x39')][_0x7b69('0x3c')]));_0x20999b['attributes']=_0x20999b[_0x7b69('0x3b')][_0x7b69('0x3d')]?_0x20999b[_0x7b69('0x3b')]:_0x25b5f2[_0x7b69('0x37')];if(_0x14ec39[_0x7b69('0x39')][_0x7b69('0x46')]){_0x20999b[_0x7b69('0x48')]=[{'all':!![]}];}_0x20999b=_[_0x7b69('0x44')]({},_0x20999b,_0x14ec39[_0x7b69('0x45')]);return db[_0x7b69('0x32')][_0x7b69('0x49')](_0x20999b)['then'](handleEntityNotFound(_0x143695,null))[_0x7b69('0x29')](respondWithResult(_0x143695,null))[_0x7b69('0x4a')](handleError(_0x143695,null));};exports[_0x7b69('0x4b')]=function(_0x2994fa,_0x6ef83f){return db['SmsQueue'][_0x7b69('0x4b')](_0x2994fa[_0x7b69('0x4c')],{})[_0x7b69('0x29')](function(_0x412a6e){var _0x1ef1e0=_0x2994fa[_0x7b69('0x4d')]['get']({'plain':!![]});if(!_0x1ef1e0)throw new Error(_0x7b69('0x4e'));if(_0x1ef1e0['role']===_0x7b69('0x4d')){var _0x3394e0=_0x412a6e['get']({'plain':!![]});var _0x2a830b=_0x7b69('0x2b');return db[_0x7b69('0x4f')][_0x7b69('0x49')]({'where':{'name':_0x2a830b,'userProfileId':_0x1ef1e0['userProfileId']},'raw':!![]})[_0x7b69('0x29')](function(_0x52ccae){if(_0x52ccae&&_0x52ccae[_0x7b69('0x50')]===0x0){return db[_0x7b69('0x2c')][_0x7b69('0x4b')]({'name':_0x3394e0[_0x7b69('0x2f')],'resourceId':_0x3394e0['id'],'type':_0x52ccae[_0x7b69('0x2f')],'sectionId':_0x52ccae['id']},{})['then'](function(){return _0x412a6e;});}else{return _0x412a6e;}})[_0x7b69('0x4a')](function(_0x5173dd){logger[_0x7b69('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5173dd);throw _0x5173dd;});}return _0x412a6e;})[_0x7b69('0x29')](respondWithResult(_0x6ef83f,0xc9))[_0x7b69('0x4a')](handleError(_0x6ef83f,null));};exports[_0x7b69('0x27')]=function(_0x1c7f7a,_0x5470a6){if(_0x1c7f7a[_0x7b69('0x4c')]['id']){delete _0x1c7f7a[_0x7b69('0x4c')]['id'];}return db['SmsQueue'][_0x7b69('0x49')]({'where':{'id':_0x1c7f7a[_0x7b69('0x51')]['id']}})[_0x7b69('0x29')](handleEntityNotFound(_0x5470a6,null))[_0x7b69('0x29')](saveUpdates(_0x1c7f7a[_0x7b69('0x4c')],null))['then'](respondWithResult(_0x5470a6,null))[_0x7b69('0x4a')](handleError(_0x5470a6,null));};exports[_0x7b69('0x28')]=function(_0x2b6b8e,_0xc93fa5){return db['SmsQueue'][_0x7b69('0x49')]({'where':{'id':_0x2b6b8e[_0x7b69('0x51')]['id']}})[_0x7b69('0x29')](handleEntityNotFound(_0xc93fa5,null))[_0x7b69('0x29')](removeEntity(_0xc93fa5,null))[_0x7b69('0x4a')](handleError(_0xc93fa5,null));};exports[_0x7b69('0x52')]=function(_0x2e72fe,_0x4aa075){return db['SmsQueue'][_0x7b69('0x52')]()[_0x7b69('0x29')](respondWithResult(_0x4aa075,null))[_0x7b69('0x4a')](handleError(_0x4aa075,null));};exports['getMembers']=function(_0x3fb15e,_0x2d2123,_0x1565f6){var _0x4caea7={'raw':!![],'where':{}},_0x5f3932={},_0x2ef0c7;return db[_0x7b69('0x32')][_0x7b69('0x53')]({'where':{'id':_0x3fb15e[_0x7b69('0x51')]['id']}})[_0x7b69('0x29')](handleEntityNotFound(_0x2d2123,null))['then'](function(_0x2a8568){if(_0x2a8568){_0x2ef0c7=_0x2a8568[_0x7b69('0x2a')]({'plain':!![]});_0x5f3932[_0x7b69('0x37')]=_[_0x7b69('0x38')](db['UserSmsQueue'][_0x7b69('0x33')]);_0x5f3932[_0x7b69('0x39')]=_['keys'](_0x3fb15e[_0x7b69('0x39')]);_0x5f3932[_0x7b69('0x40')]=_[_0x7b69('0x3a')](_0x5f3932[_0x7b69('0x37')],_0x5f3932[_0x7b69('0x39')]);_0x4caea7['attributes']=_[_0x7b69('0x3a')](_0x5f3932['model'],qs[_0x7b69('0x3c')](_0x3fb15e[_0x7b69('0x39')][_0x7b69('0x3c')]));_0x4caea7[_0x7b69('0x3b')]=_0x4caea7[_0x7b69('0x3b')][_0x7b69('0x3d')]?_0x4caea7[_0x7b69('0x3b')]:_0x5f3932[_0x7b69('0x37')];if(!_0x3fb15e[_0x7b69('0x39')][_0x7b69('0x54')](_0x7b69('0x3e'))){_0x4caea7[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0x3fb15e[_0x7b69('0x39')][_0x7b69('0x1f')]);_0x4caea7[_0x7b69('0x22')]=qs[_0x7b69('0x22')](_0x3fb15e[_0x7b69('0x39')]['offset']);}_0x4caea7[_0x7b69('0x55')]=qs['sort'](_0x3fb15e[_0x7b69('0x39')][_0x7b69('0x3f')]);_0x4caea7[_0x7b69('0x43')]=qs['filters'](_[_0x7b69('0x41')](_0x3fb15e['query'],_0x5f3932[_0x7b69('0x40')]));_0x4caea7[_0x7b69('0x43')]['SmsQueueId']=_0x2a8568['id'];if(_0x3fb15e[_0x7b69('0x39')][_0x7b69('0x42')]){_0x4caea7[_0x7b69('0x43')]=_[_0x7b69('0x44')](_0x4caea7[_0x7b69('0x43')],{'$or':_[_0x7b69('0x31')](_0x4caea7['attributes'],function(_0x30a04b){var _0x575994={};_0x575994[_0x30a04b]={'$like':'%'+_0x3fb15e[_0x7b69('0x39')]['filter']+'%'};return _0x575994;})});}_0x4caea7=_[_0x7b69('0x44')]({},_0x4caea7,_0x3fb15e[_0x7b69('0x45')]);return db[_0x7b69('0x56')]['findAll'](_0x4caea7);}})[_0x7b69('0x29')](function(_0x4b5011){if(_0x4b5011){return db[_0x7b69('0x57')]['findAndCountAll']({'where':{'id':_[_0x7b69('0x31')](_0x4b5011,'UserId'),'role':'agent'},'attributes':['id','name','smsPause',_0x7b69('0x58'),_0x7b69('0x59')]});}})['then'](function(_0x301337){if(_0x301337){return{'count':_0x301337[_0x7b69('0x21')],'rows':_['map'](_0x301337['rows'],function(_0x3c3da0){return{'membername':_0x3c3da0['name'],'UserId':_0x3c3da0['id'],'queue_name':_0x2ef0c7[_0x7b69('0x2f')],'SmsQueueId':_0x2ef0c7['id'],'interface':util[_0x7b69('0x5a')]('%s/%s',_0x7b69('0x5b'),_0x3c3da0['name']),'penalty':0x0,'paused':_0x3c3da0['smsPause'],'createdAt':_0x3c3da0['createdAt'],'updatedAt':_0x3c3da0[_0x7b69('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7b69('0x29')](respondWithFilteredResult(_0x2d2123,_0x4caea7))[_0x7b69('0x4a')](handleError(_0x2d2123,null));};exports[_0x7b69('0x5c')]=function(_0x7dd4b4,_0x537355,_0x371711){var _0x6d28cc={};var _0x43746c={};var _0xa1aab;var _0xb30a6d;return db[_0x7b69('0x32')][_0x7b69('0x53')]({'where':{'id':_0x7dd4b4['params']['id']}})['then'](handleEntityNotFound(_0x537355,null))[_0x7b69('0x29')](function(_0x3fd478){if(_0x3fd478){_0xa1aab=_0x3fd478;_0x43746c[_0x7b69('0x37')]=_[_0x7b69('0x38')](db[_0x7b69('0x5d')][_0x7b69('0x33')]);_0x43746c[_0x7b69('0x39')]=_[_0x7b69('0x38')](_0x7dd4b4[_0x7b69('0x39')]);_0x43746c['filters']=_[_0x7b69('0x3a')](_0x43746c[_0x7b69('0x37')],_0x43746c[_0x7b69('0x39')]);_0x6d28cc[_0x7b69('0x3b')]=_[_0x7b69('0x3a')](_0x43746c[_0x7b69('0x37')],qs['fields'](_0x7dd4b4[_0x7b69('0x39')]['fields']));_0x6d28cc[_0x7b69('0x3b')]=_0x6d28cc[_0x7b69('0x3b')][_0x7b69('0x3d')]?_0x6d28cc[_0x7b69('0x3b')]:_0x43746c['model'];_0x6d28cc[_0x7b69('0x55')]=qs['sort'](_0x7dd4b4[_0x7b69('0x39')][_0x7b69('0x3f')]);_0x6d28cc[_0x7b69('0x43')]=qs[_0x7b69('0x40')](_['pick'](_0x7dd4b4[_0x7b69('0x39')],_0x43746c[_0x7b69('0x40')]));if(_0x7dd4b4['query']['filter']){_0x6d28cc[_0x7b69('0x43')]=_[_0x7b69('0x44')](_0x6d28cc[_0x7b69('0x43')],{'$or':_[_0x7b69('0x31')](_0x6d28cc[_0x7b69('0x3b')],function(_0x16e499){var _0x50be77={};_0x50be77[_0x16e499]={'$like':'%'+_0x7dd4b4['query'][_0x7b69('0x42')]+'%'};return _0x50be77;})});}_0x6d28cc=_[_0x7b69('0x44')]({},_0x6d28cc,_0x7dd4b4['options']);return _0xa1aab[_0x7b69('0x5c')](_0x6d28cc);}})[_0x7b69('0x29')](function(_0xc1b92){if(_0xc1b92){_0xb30a6d=_0xc1b92['length'];if(!_0x7dd4b4[_0x7b69('0x39')]['hasOwnProperty'](_0x7b69('0x3e'))){_0x6d28cc[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0x7dd4b4[_0x7b69('0x39')][_0x7b69('0x1f')]);_0x6d28cc[_0x7b69('0x22')]=qs[_0x7b69('0x22')](_0x7dd4b4['query'][_0x7b69('0x22')]);}return _0xa1aab['getTeams'](_0x6d28cc);}})['then'](function(_0x2ba1ed){if(_0x2ba1ed){return _0x2ba1ed?{'count':_0xb30a6d,'rows':_0x2ba1ed}:null;}})[_0x7b69('0x29')](respondWithResult(_0x537355,null))[_0x7b69('0x4a')](handleError(_0x537355,null));};exports['addTeams']=function(_0x140ee0,_0x32ee75,_0x2f970c){var _0x348804=_0x140ee0['body'][_0x7b69('0x5e')];return db[_0x7b69('0x5d')][_0x7b69('0x5f')]({'where':{'id':_0x348804},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b69('0x60'),'attributes':['id',_0x7b69('0x2f'),_0x7b69('0x61'),_0x7b69('0x62'),_0x7b69('0x63')],'raw':!![]}]})[_0x7b69('0x29')](function(_0x5e2b4b){if(_0x5e2b4b){var _0x44b9f9=_['flatMap'](_0x5e2b4b,function(_0x320d25){var _0x3c062b=_0x320d25['get']({'plain':!![]});return _0x3c062b[_0x7b69('0x60')];});return db[_0x7b69('0x32')][_0x7b69('0x49')]({'where':{'id':_0x140ee0['params']['id']}})['then'](function(_0x33fd0d){return db[_0x7b69('0x64')][_0x7b69('0x65')](function(_0x1ed384){return _0x33fd0d[_0x7b69('0x66')](_0x348804,{'transaction':_0x1ed384})[_0x7b69('0x29')](function(){return BPromise[_0x7b69('0x67')](_0x44b9f9,function(_0x3cf1c6){return db['UserSmsQueue'][_0x7b69('0x68')]({'where':{'UserId':_0x3cf1c6['id'],'SmsQueueId':_0x140ee0[_0x7b69('0x51')]['id']},'transaction':_0x1ed384});});})['then'](function(){_0x44b9f9[_0x7b69('0x69')](function(_0x249ac7){socket[_0x7b69('0x6a')](_0x7b69('0x6b'),{'UserId':_0x249ac7['id'],'SmsQueueId':_0x33fd0d['id']});});});});});}})[_0x7b69('0x29')](respondWithStatusCode(_0x32ee75,null))['catch'](handleError(_0x32ee75,null));};exports['removeTeams']=function(_0x40bb2e,_0x583b12,_0xbfb776){return db['Team'][_0x7b69('0x5f')]({'where':{'id':_0x40bb2e[_0x7b69('0x39')][_0x7b69('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7b69('0x29')](handleEntityNotFound(_0x583b12,null))[_0x7b69('0x29')](function(_0x45a6b1){var _0x60be34=_[_0x7b69('0x31')](_0x45a6b1,'id');var _0x386a82=[];var _0x37f01c=[];var _0x100be4=squel['select']();_0x100be4[_0x7b69('0x6c')](_0x7b69('0x6d'))[_0x7b69('0x6e')](_0x7b69('0x6f'),'tq')[_0x7b69('0x70')](_0x7b69('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7b69('0x43')](_0x7b69('0x72'),_0x40bb2e['params']['id']);for(var _0x553e69=0x0;_0x553e69<_0x45a6b1['length'];_0x553e69+=0x1){let _0x446d4a=_0x45a6b1[_0x553e69];for(var _0x51be07=0x0;_0x51be07<_0x446d4a[_0x7b69('0x60')]['length'];_0x51be07+=0x1){let _0x12eb8d=_0x446d4a[_0x7b69('0x60')][_0x51be07];var _0x54bddd=_0x100be4[_0x7b69('0x73')]();_0x54bddd['where'](_0x7b69('0x74'),_0x12eb8d['id']);_0x37f01c[_0x7b69('0x75')](db[_0x7b69('0x64')]['query'](_0x54bddd[_0x7b69('0x76')](),{'type':db[_0x7b69('0x64')][_0x7b69('0x77')][_0x7b69('0x78')]})[_0x7b69('0x29')](function(_0x48e470){if(_0x48e470[_0x7b69('0x3d')]===0x1){return _0x12eb8d['id'];}else{var _0x2ce159=_['every'](_[_0x7b69('0x31')](_0x48e470,_0x7b69('0x79')),function(_0x57efaa){return _['includes'](_0x60be34,_0x57efaa);});if(_0x2ce159){return _0x12eb8d['id'];}}}));}}return BPromise[_0x7b69('0x7a')](_0x37f01c)[_0x7b69('0x29')](function(_0x685a11){_0x386a82=_(_0x386a82)[_0x7b69('0x7b')](_0x685a11)[_0x7b69('0x7c')]()['value']();return db[_0x7b69('0x32')][_0x7b69('0x49')]({'where':{'id':_0x40bb2e[_0x7b69('0x51')]['id']}})[_0x7b69('0x29')](function(_0x1718f9){return db[_0x7b69('0x64')]['transaction'](function(_0x9e43f4){return _0x1718f9[_0x7b69('0x7d')](_0x40bb2e['query'][_0x7b69('0x5e')],{'transaction':_0x9e43f4})['then'](function(){if(!_[_0x7b69('0x7e')](_0x386a82)){return _0x1718f9['removeAgents'](_0x386a82,{'transaction':_0x9e43f4});}})[_0x7b69('0x29')](function(){_0x386a82[_0x7b69('0x69')](function(_0x133917){socket[_0x7b69('0x6a')]('userSmsQueue:remove',{'UserId':_0x133917,'SmsQueueId':_0x1718f9['id']});});});});});});})[_0x7b69('0x29')](respondWithStatusCode(_0x583b12,null))[_0x7b69('0x4a')](handleError(_0x583b12,null));};exports['addAgents']=function(_0xe30ab,_0x1aaa81,_0x2a3ddf){return db[_0x7b69('0x32')][_0x7b69('0x49')]({'where':{'id':_0xe30ab[_0x7b69('0x51')]['id']}})[_0x7b69('0x29')](handleEntityNotFound(_0x1aaa81,null))[_0x7b69('0x29')](function(_0x55aa78){if(_0x55aa78){return _0x55aa78['addAgents'](_0xe30ab[_0x7b69('0x4c')]['ids'],_[_0x7b69('0x7f')](_0xe30ab[_0x7b69('0x4c')],['ids','id'])||{})[_0x7b69('0x80')](function(_0x49f99d){for(var _0x36f01b=0x0;_0x36f01b<_0xe30ab[_0x7b69('0x4c')][_0x7b69('0x5e')][_0x7b69('0x3d')];_0x36f01b+=0x1){socket[_0x7b69('0x6a')](_0x7b69('0x6b'),{'UserId':Number(_0xe30ab[_0x7b69('0x4c')]['ids'][_0x36f01b]),'SmsQueueId':Number(_0xe30ab[_0x7b69('0x51')]['id'])});}return _0x49f99d;});}})[_0x7b69('0x29')](respondWithResult(_0x1aaa81,null))['catch'](handleError(_0x1aaa81,null));};exports['removeAgents']=function(_0x303d10,_0x3c320f,_0x589f0e){return db[_0x7b69('0x32')][_0x7b69('0x49')]({'where':{'id':_0x303d10[_0x7b69('0x51')]['id']}})[_0x7b69('0x29')](handleEntityNotFound(_0x3c320f,null))[_0x7b69('0x29')](function(_0x285fed){if(_0x285fed){return _0x285fed[_0x7b69('0x81')](_0x303d10['query']['ids'])[_0x7b69('0x29')](function(){if(_[_0x7b69('0x82')](_0x303d10[_0x7b69('0x39')][_0x7b69('0x5e')])){for(var _0x20df76=0x0;_0x20df76<_0x303d10[_0x7b69('0x39')][_0x7b69('0x5e')][_0x7b69('0x3d')];_0x20df76+=0x1){socket['emit'](_0x7b69('0x83'),{'UserId':Number(_0x303d10[_0x7b69('0x39')][_0x7b69('0x5e')][_0x20df76]),'SmsQueueId':Number(_0x303d10[_0x7b69('0x51')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x303d10['query'][_0x7b69('0x5e')]),'SmsQueueId':Number(_0x303d10[_0x7b69('0x51')]['id'])});}});}})[_0x7b69('0x29')](respondWithStatusCode(_0x3c320f,null))['catch'](handleError(_0x3c320f,null));};exports['getAgents']=function(_0x483caa,_0x4d8563,_0x1d0d8e){var _0x3543bd={};var _0x555ddb={};var _0x3788d5;var _0x221fba;return db[_0x7b69('0x32')][_0x7b69('0x53')]({'where':{'id':_0x483caa[_0x7b69('0x51')]['id']}})[_0x7b69('0x29')](handleEntityNotFound(_0x4d8563,null))['then'](function(_0x3f0f4c){if(_0x3f0f4c){_0x3788d5=_0x3f0f4c;_0x555ddb[_0x7b69('0x37')]=_[_0x7b69('0x38')](db[_0x7b69('0x57')]['rawAttributes']);_0x555ddb[_0x7b69('0x39')]=_[_0x7b69('0x38')](_0x483caa[_0x7b69('0x39')]);_0x555ddb[_0x7b69('0x40')]=_[_0x7b69('0x3a')](_0x555ddb[_0x7b69('0x37')],_0x555ddb[_0x7b69('0x39')]);_0x3543bd[_0x7b69('0x3b')]=_[_0x7b69('0x3a')](_0x555ddb['model'],qs[_0x7b69('0x3c')](_0x483caa[_0x7b69('0x39')][_0x7b69('0x3c')]));_0x3543bd['attributes']=_0x3543bd[_0x7b69('0x3b')]['length']?_0x3543bd[_0x7b69('0x3b')]:_0x555ddb[_0x7b69('0x37')];_0x3543bd['order']=qs[_0x7b69('0x3f')](_0x483caa[_0x7b69('0x39')][_0x7b69('0x3f')]);_0x3543bd[_0x7b69('0x43')]=qs['filters'](_[_0x7b69('0x41')](_0x483caa[_0x7b69('0x39')],_0x555ddb[_0x7b69('0x40')]));if(_0x483caa[_0x7b69('0x39')]['filter']){_0x3543bd['where']=_['merge'](_0x3543bd['where'],{'$or':_[_0x7b69('0x31')](_0x3543bd[_0x7b69('0x3b')],function(_0x45df7e){var _0x3f25e5={};_0x3f25e5[_0x45df7e]={'$like':'%'+_0x483caa[_0x7b69('0x39')]['filter']+'%'};return _0x3f25e5;})});}_0x3543bd=_[_0x7b69('0x44')]({},_0x3543bd,_0x483caa['options']);return _0x3788d5['getAgents'](_0x3543bd);}})[_0x7b69('0x29')](function(_0x542a8e){if(_0x542a8e){_0x221fba=_0x542a8e['length'];if(!_0x483caa['query'][_0x7b69('0x54')](_0x7b69('0x3e'))){_0x3543bd[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0x483caa[_0x7b69('0x39')][_0x7b69('0x1f')]);_0x3543bd[_0x7b69('0x22')]=qs['offset'](_0x483caa[_0x7b69('0x39')]['offset']);}return _0x3788d5[_0x7b69('0x84')](_0x3543bd);}})[_0x7b69('0x29')](function(_0x13f268){if(_0x13f268){return _0x13f268?{'count':_0x221fba,'rows':_0x13f268}:null;}})['then'](respondWithResult(_0x4d8563,null))[_0x7b69('0x4a')](handleError(_0x4d8563,null));}; \ No newline at end of file +var _0x6972=['send','index','SmsQueue','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','body','describe','getMembers','findOne','UserSmsQueue','nolimit','SmsQueueId','User','findAndCountAll','agent','format','SIP','smsPause','createdAt','updatedAt','Team','rawAttributes','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','toString','every','TeamId','all','union','value','isEmpty','removeAgents','userSmsQueue:remove','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','count','limit','set','Content-Range','save','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name'];(function(_0x4812bd,_0x476c0e){var _0x36581c=function(_0x4330e9){while(--_0x4330e9){_0x4812bd['push'](_0x4812bd['shift']());}};_0x36581c(++_0x476c0e);}(_0x6972,0x173));var _0x2697=function(_0x5d8d87,_0x12bf56){_0x5d8d87=_0x5d8d87-0x0;var _0x2cbd53=_0x6972[_0x5d8d87];return _0x2cbd53;};'use strict';var emlformat=require(_0x2697('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2697('0x1'));var jsonpatch=require(_0x2697('0x2'));var rp=require(_0x2697('0x3'));var moment=require('moment');var BPromise=require(_0x2697('0x4'));var Mustache=require(_0x2697('0x5'));var util=require('util');var path=require(_0x2697('0x6'));var sox=require(_0x2697('0x7'));var csv=require(_0x2697('0x8'));var ejs=require(_0x2697('0x9'));var fs=require('fs');var fs_extra=require(_0x2697('0xa'));var _=require(_0x2697('0xb'));var squel=require(_0x2697('0xc'));var crypto=require(_0x2697('0xd'));var jsforce=require(_0x2697('0xe'));var deskjs=require(_0x2697('0xf'));var toCsv=require(_0x2697('0x8'));var querystring=require(_0x2697('0x10'));var Papa=require(_0x2697('0x11'));var Redis=require('ioredis');var authService=require(_0x2697('0x12'));var qs=require(_0x2697('0x13'));var as=require(_0x2697('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2697('0x15'))(_0x2697('0x16'));var utils=require(_0x2697('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2697('0x18'));var db=require(_0x2697('0x19'))['db'];config[_0x2697('0x1a')]=_[_0x2697('0x1b')](config[_0x2697('0x1a')],{'host':_0x2697('0x1c'),'port':0x18eb});var socket=require(_0x2697('0x1d'))(new Redis(config[_0x2697('0x1a')]));require(_0x2697('0x1e'))['register'](socket);function respondWithStatusCode(_0x476f2d,_0x230658){_0x230658=_0x230658||0xcc;return function(_0x90dead){if(_0x90dead){return _0x476f2d[_0x2697('0x1f')](_0x230658);}return _0x476f2d[_0x2697('0x20')](_0x230658)[_0x2697('0x21')]();};}function respondWithResult(_0x14f6ef,_0x5817a7){_0x5817a7=_0x5817a7||0xc8;return function(_0x140512){if(_0x140512){return _0x14f6ef['status'](_0x5817a7)[_0x2697('0x22')](_0x140512);}};}function respondWithFilteredResult(_0x2150b4,_0x4aa435){return function(_0x277e69){if(_0x277e69){var _0x8b11f5=typeof _0x4aa435[_0x2697('0x23')]==='undefined'&&typeof _0x4aa435['limit']==='undefined';var _0x3da5db=_0x277e69[_0x2697('0x24')];var _0x3a1277=_0x8b11f5?0x0:_0x4aa435[_0x2697('0x23')];var _0x4b49f7=_0x8b11f5?_0x277e69[_0x2697('0x24')]:_0x4aa435[_0x2697('0x23')]+_0x4aa435[_0x2697('0x25')];var _0xe4e697;if(_0x4b49f7>=_0x3da5db){_0x4b49f7=_0x3da5db;_0xe4e697=0xc8;}else{_0xe4e697=0xce;}_0x2150b4['status'](_0xe4e697);return _0x2150b4[_0x2697('0x26')](_0x2697('0x27'),_0x3a1277+'-'+_0x4b49f7+'/'+_0x3da5db)[_0x2697('0x22')](_0x277e69);}return null;};}function patchUpdates(_0x2c9efd){return function(_0x445509){try{jsonpatch['apply'](_0x445509,_0x2c9efd,!![]);}catch(_0x55bf3e){return BPromise['reject'](_0x55bf3e);}return _0x445509[_0x2697('0x28')]();};}function saveUpdates(_0xaa83bf,_0x1cc909){return function(_0x1b99ad){if(_0x1b99ad){return _0x1b99ad[_0x2697('0x29')](_0xaa83bf)[_0x2697('0x2a')](function(_0x5a888c){return _0x5a888c;});}return null;};}function removeEntity(_0xdd6a6d,_0x34683b){return function(_0x1a2917){if(_0x1a2917){return _0x1a2917[_0x2697('0x2b')]()[_0x2697('0x2a')](function(){var _0x5854ae=_0x1a2917['get']({'plain':!![]});var _0x1a34fb=_0x2697('0x2c');return db[_0x2697('0x2d')][_0x2697('0x2b')]({'where':{'type':_0x1a34fb,'resourceId':_0x5854ae['id']}})[_0x2697('0x2a')](function(){return _0x1a2917;});})[_0x2697('0x2a')](function(){_0xdd6a6d['status'](0xcc)[_0x2697('0x21')]();});}};}function handleEntityNotFound(_0xe08ebb,_0x2c12aa){return function(_0x1a4dee){if(!_0x1a4dee){_0xe08ebb[_0x2697('0x1f')](0x194);}return _0x1a4dee;};}function handleError(_0x3a1a1f,_0x46e4c5){_0x46e4c5=_0x46e4c5||0x1f4;return function(_0x5df4bd){logger[_0x2697('0x2e')](_0x5df4bd[_0x2697('0x2f')]);if(_0x5df4bd[_0x2697('0x30')]){delete _0x5df4bd[_0x2697('0x30')];}_0x3a1a1f[_0x2697('0x20')](_0x46e4c5)[_0x2697('0x31')](_0x5df4bd);};}exports[_0x2697('0x32')]=function(_0x18d3a7,_0x287a29){var _0x107dd3={},_0xa04c45={},_0x2d0235={'count':0x0,'rows':[]};var _0xf656ae=_['map'](db[_0x2697('0x33')]['rawAttributes'],function(_0x13d267){return{'name':_0x13d267[_0x2697('0x34')],'type':_0x13d267[_0x2697('0x35')][_0x2697('0x36')]};});_0xa04c45[_0x2697('0x37')]=_['map'](_0xf656ae,'name');_0xa04c45['query']=_[_0x2697('0x38')](_0x18d3a7[_0x2697('0x39')]);_0xa04c45[_0x2697('0x3a')]=_[_0x2697('0x3b')](_0xa04c45[_0x2697('0x37')],_0xa04c45[_0x2697('0x39')]);_0x107dd3[_0x2697('0x3c')]=_[_0x2697('0x3b')](_0xa04c45[_0x2697('0x37')],qs['fields'](_0x18d3a7[_0x2697('0x39')][_0x2697('0x3d')]));_0x107dd3[_0x2697('0x3c')]=_0x107dd3['attributes'][_0x2697('0x3e')]?_0x107dd3['attributes']:_0xa04c45[_0x2697('0x37')];if(!_0x18d3a7['query'][_0x2697('0x3f')]('nolimit')){_0x107dd3[_0x2697('0x25')]=qs[_0x2697('0x25')](_0x18d3a7[_0x2697('0x39')][_0x2697('0x25')]);_0x107dd3[_0x2697('0x23')]=qs[_0x2697('0x23')](_0x18d3a7['query'][_0x2697('0x23')]);}_0x107dd3[_0x2697('0x40')]=qs[_0x2697('0x41')](_0x18d3a7[_0x2697('0x39')][_0x2697('0x41')]);_0x107dd3[_0x2697('0x42')]=qs[_0x2697('0x3a')](_[_0x2697('0x43')](_0x18d3a7[_0x2697('0x39')],_0xa04c45['filters']),_0xf656ae);if(_0x18d3a7[_0x2697('0x39')][_0x2697('0x44')]){_0x107dd3[_0x2697('0x42')]=_['merge'](_0x107dd3['where'],{'$or':_[_0x2697('0x45')](_0xf656ae,function(_0x475007){if(_0x475007[_0x2697('0x35')]!==_0x2697('0x46')){var _0x715912={};_0x715912[_0x475007[_0x2697('0x30')]]={'$like':'%'+_0x18d3a7[_0x2697('0x39')][_0x2697('0x44')]+'%'};return _0x715912;}})});}_0x107dd3=_[_0x2697('0x47')]({},_0x107dd3,_0x18d3a7[_0x2697('0x48')]);var _0x4d5a98={'where':_0x107dd3[_0x2697('0x42')]};return db['SmsQueue'][_0x2697('0x24')](_0x4d5a98)[_0x2697('0x2a')](function(_0x463296){_0x2d0235[_0x2697('0x24')]=_0x463296;if(_0x18d3a7[_0x2697('0x39')]['includeAll']){_0x107dd3['include']=[{'all':!![]}];}return db[_0x2697('0x33')][_0x2697('0x49')](_0x107dd3);})[_0x2697('0x2a')](function(_0x1ae880){_0x2d0235[_0x2697('0x4a')]=_0x1ae880;return _0x2d0235;})[_0x2697('0x2a')](respondWithFilteredResult(_0x287a29,_0x107dd3))[_0x2697('0x4b')](handleError(_0x287a29,null));};exports[_0x2697('0x4c')]=function(_0x47d384,_0x1810d1){var _0x39dd9b={'raw':!![],'where':{'id':_0x47d384[_0x2697('0x4d')]['id']}},_0x53f7b1={};_0x53f7b1['model']=_[_0x2697('0x38')](db[_0x2697('0x33')]['rawAttributes']);_0x53f7b1[_0x2697('0x39')]=_[_0x2697('0x38')](_0x47d384[_0x2697('0x39')]);_0x53f7b1[_0x2697('0x3a')]=_['intersection'](_0x53f7b1['model'],_0x53f7b1[_0x2697('0x39')]);_0x39dd9b[_0x2697('0x3c')]=_['intersection'](_0x53f7b1[_0x2697('0x37')],qs[_0x2697('0x3d')](_0x47d384[_0x2697('0x39')]['fields']));_0x39dd9b[_0x2697('0x3c')]=_0x39dd9b[_0x2697('0x3c')][_0x2697('0x3e')]?_0x39dd9b[_0x2697('0x3c')]:_0x53f7b1['model'];if(_0x47d384[_0x2697('0x39')][_0x2697('0x4e')]){_0x39dd9b[_0x2697('0x4f')]=[{'all':!![]}];}_0x39dd9b=_[_0x2697('0x47')]({},_0x39dd9b,_0x47d384[_0x2697('0x48')]);return db[_0x2697('0x33')]['find'](_0x39dd9b)[_0x2697('0x2a')](handleEntityNotFound(_0x1810d1,null))[_0x2697('0x2a')](respondWithResult(_0x1810d1,null))['catch'](handleError(_0x1810d1,null));};exports[_0x2697('0x50')]=function(_0x4bd343,_0x5c64ef){return db[_0x2697('0x33')][_0x2697('0x50')](_0x4bd343['body'],{})[_0x2697('0x2a')](function(_0x47adae){var _0x3d434f=_0x4bd343['user'][_0x2697('0x51')]({'plain':!![]});if(!_0x3d434f)throw new Error(_0x2697('0x52'));if(_0x3d434f['role']===_0x2697('0x53')){var _0x8014f6=_0x47adae[_0x2697('0x51')]({'plain':!![]});var _0x53ee98=_0x2697('0x2c');return db[_0x2697('0x54')][_0x2697('0x55')]({'where':{'name':_0x53ee98,'userProfileId':_0x3d434f[_0x2697('0x56')]},'raw':!![]})['then'](function(_0x172a55){if(_0x172a55&&_0x172a55['autoAssociation']===0x0){return db[_0x2697('0x2d')][_0x2697('0x50')]({'name':_0x8014f6['name'],'resourceId':_0x8014f6['id'],'type':_0x172a55[_0x2697('0x30')],'sectionId':_0x172a55['id']},{})[_0x2697('0x2a')](function(){return _0x47adae;});}else{return _0x47adae;}})[_0x2697('0x4b')](function(_0x45a0e1){logger[_0x2697('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45a0e1);throw _0x45a0e1;});}return _0x47adae;})[_0x2697('0x2a')](respondWithResult(_0x5c64ef,0xc9))[_0x2697('0x4b')](handleError(_0x5c64ef,null));};exports[_0x2697('0x29')]=function(_0x4b801f,_0x5ecda9){if(_0x4b801f['body']['id']){delete _0x4b801f[_0x2697('0x57')]['id'];}return db[_0x2697('0x33')][_0x2697('0x55')]({'where':{'id':_0x4b801f['params']['id']}})[_0x2697('0x2a')](handleEntityNotFound(_0x5ecda9,null))[_0x2697('0x2a')](saveUpdates(_0x4b801f[_0x2697('0x57')],null))['then'](respondWithResult(_0x5ecda9,null))[_0x2697('0x4b')](handleError(_0x5ecda9,null));};exports['destroy']=function(_0x276dac,_0x231895){return db[_0x2697('0x33')]['find']({'where':{'id':_0x276dac['params']['id']}})['then'](handleEntityNotFound(_0x231895,null))[_0x2697('0x2a')](removeEntity(_0x231895,null))[_0x2697('0x4b')](handleError(_0x231895,null));};exports[_0x2697('0x58')]=function(_0x511492,_0x3374fe){return db['SmsQueue']['describe']()[_0x2697('0x2a')](respondWithResult(_0x3374fe,null))['catch'](handleError(_0x3374fe,null));};exports[_0x2697('0x59')]=function(_0x3eb885,_0xdd091d,_0xe63e92){var _0x474157={'raw':!![],'where':{}},_0x47f84a={},_0xf7ae78;return db[_0x2697('0x33')][_0x2697('0x5a')]({'where':{'id':_0x3eb885[_0x2697('0x4d')]['id']}})[_0x2697('0x2a')](handleEntityNotFound(_0xdd091d,null))['then'](function(_0x83921f){if(_0x83921f){_0xf7ae78=_0x83921f[_0x2697('0x51')]({'plain':!![]});_0x47f84a[_0x2697('0x37')]=_[_0x2697('0x38')](db[_0x2697('0x5b')]['rawAttributes']);_0x47f84a[_0x2697('0x39')]=_[_0x2697('0x38')](_0x3eb885[_0x2697('0x39')]);_0x47f84a[_0x2697('0x3a')]=_[_0x2697('0x3b')](_0x47f84a[_0x2697('0x37')],_0x47f84a[_0x2697('0x39')]);_0x474157[_0x2697('0x3c')]=_[_0x2697('0x3b')](_0x47f84a['model'],qs[_0x2697('0x3d')](_0x3eb885[_0x2697('0x39')][_0x2697('0x3d')]));_0x474157[_0x2697('0x3c')]=_0x474157[_0x2697('0x3c')][_0x2697('0x3e')]?_0x474157[_0x2697('0x3c')]:_0x47f84a[_0x2697('0x37')];if(!_0x3eb885[_0x2697('0x39')][_0x2697('0x3f')](_0x2697('0x5c'))){_0x474157['limit']=qs[_0x2697('0x25')](_0x3eb885[_0x2697('0x39')]['limit']);_0x474157[_0x2697('0x23')]=qs[_0x2697('0x23')](_0x3eb885[_0x2697('0x39')][_0x2697('0x23')]);}_0x474157['order']=qs['sort'](_0x3eb885[_0x2697('0x39')][_0x2697('0x41')]);_0x474157[_0x2697('0x42')]=qs['filters'](_[_0x2697('0x43')](_0x3eb885[_0x2697('0x39')],_0x47f84a[_0x2697('0x3a')]));_0x474157[_0x2697('0x42')][_0x2697('0x5d')]=_0x83921f['id'];if(_0x3eb885[_0x2697('0x39')][_0x2697('0x44')]){_0x474157[_0x2697('0x42')]=_[_0x2697('0x47')](_0x474157['where'],{'$or':_[_0x2697('0x45')](_0x474157[_0x2697('0x3c')],function(_0x3028c1){var _0x3372ff={};_0x3372ff[_0x3028c1]={'$like':'%'+_0x3eb885['query'][_0x2697('0x44')]+'%'};return _0x3372ff;})});}_0x474157=_[_0x2697('0x47')]({},_0x474157,_0x3eb885['options']);return db[_0x2697('0x5b')][_0x2697('0x49')](_0x474157);}})['then'](function(_0x1a5667){if(_0x1a5667){return db[_0x2697('0x5e')][_0x2697('0x5f')]({'where':{'id':_['map'](_0x1a5667,'UserId'),'role':_0x2697('0x60')},'attributes':['id',_0x2697('0x30'),'smsPause','updatedAt','createdAt']});}})[_0x2697('0x2a')](function(_0x364337){if(_0x364337){return{'count':_0x364337[_0x2697('0x24')],'rows':_[_0x2697('0x45')](_0x364337['rows'],function(_0x3bfbc4){return{'membername':_0x3bfbc4[_0x2697('0x30')],'UserId':_0x3bfbc4['id'],'queue_name':_0xf7ae78[_0x2697('0x30')],'SmsQueueId':_0xf7ae78['id'],'interface':util[_0x2697('0x61')]('%s/%s',_0x2697('0x62'),_0x3bfbc4[_0x2697('0x30')]),'penalty':0x0,'paused':_0x3bfbc4[_0x2697('0x63')],'createdAt':_0x3bfbc4[_0x2697('0x64')],'updatedAt':_0x3bfbc4[_0x2697('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xdd091d,_0x474157))['catch'](handleError(_0xdd091d,null));};exports['getTeams']=function(_0x5b9270,_0x3c7838,_0x255558){var _0x39cbc6={};var _0x1951da={};var _0x58ccf3;var _0x1c899b;return db[_0x2697('0x33')][_0x2697('0x5a')]({'where':{'id':_0x5b9270[_0x2697('0x4d')]['id']}})[_0x2697('0x2a')](handleEntityNotFound(_0x3c7838,null))[_0x2697('0x2a')](function(_0x31624f){if(_0x31624f){_0x58ccf3=_0x31624f;_0x1951da[_0x2697('0x37')]=_['keys'](db[_0x2697('0x66')][_0x2697('0x67')]);_0x1951da['query']=_[_0x2697('0x38')](_0x5b9270[_0x2697('0x39')]);_0x1951da[_0x2697('0x3a')]=_['intersection'](_0x1951da[_0x2697('0x37')],_0x1951da[_0x2697('0x39')]);_0x39cbc6[_0x2697('0x3c')]=_[_0x2697('0x3b')](_0x1951da[_0x2697('0x37')],qs[_0x2697('0x3d')](_0x5b9270[_0x2697('0x39')][_0x2697('0x3d')]));_0x39cbc6[_0x2697('0x3c')]=_0x39cbc6[_0x2697('0x3c')][_0x2697('0x3e')]?_0x39cbc6[_0x2697('0x3c')]:_0x1951da[_0x2697('0x37')];_0x39cbc6[_0x2697('0x40')]=qs[_0x2697('0x41')](_0x5b9270[_0x2697('0x39')][_0x2697('0x41')]);_0x39cbc6[_0x2697('0x42')]=qs[_0x2697('0x3a')](_[_0x2697('0x43')](_0x5b9270['query'],_0x1951da['filters']));if(_0x5b9270[_0x2697('0x39')][_0x2697('0x44')]){_0x39cbc6[_0x2697('0x42')]=_[_0x2697('0x47')](_0x39cbc6[_0x2697('0x42')],{'$or':_[_0x2697('0x45')](_0x39cbc6['attributes'],function(_0x119b7d){var _0x49a658={};_0x49a658[_0x119b7d]={'$like':'%'+_0x5b9270['query']['filter']+'%'};return _0x49a658;})});}_0x39cbc6=_[_0x2697('0x47')]({},_0x39cbc6,_0x5b9270['options']);return _0x58ccf3['getTeams'](_0x39cbc6);}})[_0x2697('0x2a')](function(_0x584182){if(_0x584182){_0x1c899b=_0x584182[_0x2697('0x3e')];if(!_0x5b9270[_0x2697('0x39')][_0x2697('0x3f')](_0x2697('0x5c'))){_0x39cbc6[_0x2697('0x25')]=qs['limit'](_0x5b9270[_0x2697('0x39')][_0x2697('0x25')]);_0x39cbc6[_0x2697('0x23')]=qs[_0x2697('0x23')](_0x5b9270['query'][_0x2697('0x23')]);}return _0x58ccf3['getTeams'](_0x39cbc6);}})[_0x2697('0x2a')](function(_0x30935e){if(_0x30935e){return _0x30935e?{'count':_0x1c899b,'rows':_0x30935e}:null;}})[_0x2697('0x2a')](respondWithResult(_0x3c7838,null))[_0x2697('0x4b')](handleError(_0x3c7838,null));};exports[_0x2697('0x68')]=function(_0x553768,_0x5c94ea,_0x2e7080){var _0x24730e=_0x553768[_0x2697('0x57')]['ids'];return db[_0x2697('0x66')][_0x2697('0x49')]({'where':{'id':_0x24730e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2697('0x69'),'attributes':['id',_0x2697('0x30'),'online',_0x2697('0x6a'),_0x2697('0x6b')],'raw':!![]}]})['then'](function(_0x482dd2){if(_0x482dd2){var _0x31a5f3=_[_0x2697('0x6c')](_0x482dd2,function(_0x5071cd){var _0x5703c5=_0x5071cd['get']({'plain':!![]});return _0x5703c5[_0x2697('0x69')];});return db[_0x2697('0x33')][_0x2697('0x55')]({'where':{'id':_0x553768['params']['id']}})['then'](function(_0x2c238f){return db[_0x2697('0x6d')][_0x2697('0x6e')](function(_0x2d1512){return _0x2c238f['addTeams'](_0x24730e,{'transaction':_0x2d1512})[_0x2697('0x2a')](function(){return BPromise[_0x2697('0x6f')](_0x31a5f3,function(_0x13d71c){return db[_0x2697('0x5b')]['findOrCreate']({'where':{'UserId':_0x13d71c['id'],'SmsQueueId':_0x553768['params']['id']},'transaction':_0x2d1512});});})['then'](function(){_0x31a5f3[_0x2697('0x70')](function(_0x9b0bef){socket[_0x2697('0x71')](_0x2697('0x72'),{'UserId':_0x9b0bef['id'],'SmsQueueId':_0x2c238f['id']});});});});});}})[_0x2697('0x2a')](respondWithStatusCode(_0x5c94ea,null))['catch'](handleError(_0x5c94ea,null));};exports[_0x2697('0x73')]=function(_0x4b6b8d,_0xd62a6b,_0x3d3388){return db['Team'][_0x2697('0x49')]({'where':{'id':_0x4b6b8d[_0x2697('0x39')][_0x2697('0x74')]},'attributes':['id'],'include':[{'model':db[_0x2697('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2697('0x2a')](handleEntityNotFound(_0xd62a6b,null))[_0x2697('0x2a')](function(_0x1bd914){var _0x44be25=_[_0x2697('0x45')](_0x1bd914,'id');var _0x1adddc=[];var _0x2fbf2d=[];var _0x5aa207=squel[_0x2697('0x75')]();_0x5aa207[_0x2697('0x76')](_0x2697('0x77'))[_0x2697('0x78')](_0x2697('0x79'),'tq')[_0x2697('0x7a')](_0x2697('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2697('0x7c'),_0x4b6b8d[_0x2697('0x4d')]['id']);for(var _0x59241e=0x0;_0x59241e<_0x1bd914[_0x2697('0x3e')];_0x59241e+=0x1){let _0xeb5845=_0x1bd914[_0x59241e];for(var _0xc8b8d8=0x0;_0xc8b8d8<_0xeb5845[_0x2697('0x69')][_0x2697('0x3e')];_0xc8b8d8+=0x1){let _0x4e81d6=_0xeb5845[_0x2697('0x69')][_0xc8b8d8];var _0x3595a2=_0x5aa207[_0x2697('0x7d')]();_0x3595a2[_0x2697('0x42')]('ut.UserId\x20=\x20?',_0x4e81d6['id']);_0x2fbf2d[_0x2697('0x7e')](db[_0x2697('0x6d')][_0x2697('0x39')](_0x3595a2[_0x2697('0x7f')](),{'type':db[_0x2697('0x6d')]['QueryTypes']['SELECT']})[_0x2697('0x2a')](function(_0xcfdc51){if(_0xcfdc51[_0x2697('0x3e')]===0x1){return _0x4e81d6['id'];}else{var _0x190ee0=_[_0x2697('0x80')](_[_0x2697('0x45')](_0xcfdc51,_0x2697('0x81')),function(_0x3ded33){return _['includes'](_0x44be25,_0x3ded33);});if(_0x190ee0){return _0x4e81d6['id'];}}}));}}return BPromise[_0x2697('0x82')](_0x2fbf2d)[_0x2697('0x2a')](function(_0x2ae839){_0x1adddc=_(_0x1adddc)[_0x2697('0x83')](_0x2ae839)['compact']()[_0x2697('0x84')]();return db[_0x2697('0x33')][_0x2697('0x55')]({'where':{'id':_0x4b6b8d['params']['id']}})[_0x2697('0x2a')](function(_0x2da404){return db[_0x2697('0x6d')][_0x2697('0x6e')](function(_0x510278){return _0x2da404[_0x2697('0x73')](_0x4b6b8d['query'][_0x2697('0x74')],{'transaction':_0x510278})[_0x2697('0x2a')](function(){if(!_[_0x2697('0x85')](_0x1adddc)){return _0x2da404[_0x2697('0x86')](_0x1adddc,{'transaction':_0x510278});}})['then'](function(){_0x1adddc[_0x2697('0x70')](function(_0x35fd81){socket['emit'](_0x2697('0x87'),{'UserId':_0x35fd81,'SmsQueueId':_0x2da404['id']});});});});});});})[_0x2697('0x2a')](respondWithStatusCode(_0xd62a6b,null))['catch'](handleError(_0xd62a6b,null));};exports['addAgents']=function(_0x4853ba,_0x42958c,_0x5de0a7){return db['SmsQueue'][_0x2697('0x55')]({'where':{'id':_0x4853ba[_0x2697('0x4d')]['id']}})[_0x2697('0x2a')](handleEntityNotFound(_0x42958c,null))[_0x2697('0x2a')](function(_0x3d0a51){if(_0x3d0a51){return _0x3d0a51['addAgents'](_0x4853ba['body'][_0x2697('0x74')],_[_0x2697('0x88')](_0x4853ba[_0x2697('0x57')],[_0x2697('0x74'),'id'])||{})[_0x2697('0x89')](function(_0x41c0ca){for(var _0x5de9a4=0x0;_0x5de9a4<_0x4853ba[_0x2697('0x57')]['ids']['length'];_0x5de9a4+=0x1){socket[_0x2697('0x71')](_0x2697('0x72'),{'UserId':Number(_0x4853ba[_0x2697('0x57')]['ids'][_0x5de9a4]),'SmsQueueId':Number(_0x4853ba[_0x2697('0x4d')]['id'])});}return _0x41c0ca;});}})[_0x2697('0x2a')](respondWithResult(_0x42958c,null))['catch'](handleError(_0x42958c,null));};exports[_0x2697('0x86')]=function(_0x37af1b,_0x508fa0,_0x259d04){return db[_0x2697('0x33')][_0x2697('0x55')]({'where':{'id':_0x37af1b['params']['id']}})[_0x2697('0x2a')](handleEntityNotFound(_0x508fa0,null))[_0x2697('0x2a')](function(_0x4e945f){if(_0x4e945f){return _0x4e945f[_0x2697('0x86')](_0x37af1b[_0x2697('0x39')][_0x2697('0x74')])[_0x2697('0x2a')](function(){if(_[_0x2697('0x8a')](_0x37af1b[_0x2697('0x39')]['ids'])){for(var _0x5a72a8=0x0;_0x5a72a8<_0x37af1b[_0x2697('0x39')][_0x2697('0x74')]['length'];_0x5a72a8+=0x1){socket['emit'](_0x2697('0x87'),{'UserId':Number(_0x37af1b[_0x2697('0x39')][_0x2697('0x74')][_0x5a72a8]),'SmsQueueId':Number(_0x37af1b['params']['id'])});}}else{socket[_0x2697('0x71')](_0x2697('0x87'),{'UserId':Number(_0x37af1b[_0x2697('0x39')][_0x2697('0x74')]),'SmsQueueId':Number(_0x37af1b[_0x2697('0x4d')]['id'])});}});}})[_0x2697('0x2a')](respondWithStatusCode(_0x508fa0,null))['catch'](handleError(_0x508fa0,null));};exports[_0x2697('0x8b')]=function(_0xf7b2a9,_0x5b284f,_0x2d33ed){var _0x194745={};var _0x1de58b={};var _0x18fa6c;var _0x319cf0;return db['SmsQueue'][_0x2697('0x5a')]({'where':{'id':_0xf7b2a9[_0x2697('0x4d')]['id']}})[_0x2697('0x2a')](handleEntityNotFound(_0x5b284f,null))['then'](function(_0x53998f){if(_0x53998f){_0x18fa6c=_0x53998f;_0x1de58b[_0x2697('0x37')]=_['keys'](db[_0x2697('0x5e')][_0x2697('0x67')]);_0x1de58b[_0x2697('0x39')]=_[_0x2697('0x38')](_0xf7b2a9['query']);_0x1de58b[_0x2697('0x3a')]=_[_0x2697('0x3b')](_0x1de58b[_0x2697('0x37')],_0x1de58b[_0x2697('0x39')]);_0x194745[_0x2697('0x3c')]=_[_0x2697('0x3b')](_0x1de58b[_0x2697('0x37')],qs[_0x2697('0x3d')](_0xf7b2a9['query']['fields']));_0x194745['attributes']=_0x194745[_0x2697('0x3c')][_0x2697('0x3e')]?_0x194745['attributes']:_0x1de58b['model'];_0x194745[_0x2697('0x40')]=qs[_0x2697('0x41')](_0xf7b2a9[_0x2697('0x39')][_0x2697('0x41')]);_0x194745[_0x2697('0x42')]=qs[_0x2697('0x3a')](_[_0x2697('0x43')](_0xf7b2a9[_0x2697('0x39')],_0x1de58b[_0x2697('0x3a')]));if(_0xf7b2a9[_0x2697('0x39')][_0x2697('0x44')]){_0x194745[_0x2697('0x42')]=_['merge'](_0x194745['where'],{'$or':_[_0x2697('0x45')](_0x194745[_0x2697('0x3c')],function(_0x3617cd){var _0x2ebbc5={};_0x2ebbc5[_0x3617cd]={'$like':'%'+_0xf7b2a9[_0x2697('0x39')]['filter']+'%'};return _0x2ebbc5;})});}_0x194745=_[_0x2697('0x47')]({},_0x194745,_0xf7b2a9['options']);return _0x18fa6c[_0x2697('0x8b')](_0x194745);}})[_0x2697('0x2a')](function(_0x86b7f8){if(_0x86b7f8){_0x319cf0=_0x86b7f8['length'];if(!_0xf7b2a9[_0x2697('0x39')][_0x2697('0x3f')](_0x2697('0x5c'))){_0x194745[_0x2697('0x25')]=qs[_0x2697('0x25')](_0xf7b2a9[_0x2697('0x39')]['limit']);_0x194745[_0x2697('0x23')]=qs[_0x2697('0x23')](_0xf7b2a9[_0x2697('0x39')]['offset']);}return _0x18fa6c[_0x2697('0x8b')](_0x194745);}})[_0x2697('0x2a')](function(_0x5db4fa){if(_0x5db4fa){return _0x5db4fa?{'count':_0x319cf0,'rows':_0x5db4fa}:null;}})[_0x2697('0x2a')](respondWithResult(_0x5b284f,null))[_0x2697('0x4b')](handleError(_0x5b284f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 63b314f..f33400f 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 _0xd7eb=['emit','hasOwnProperty','events','../../mysqldb','save','update'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xd7eb,0xb6));var _0xbd7e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xd7eb[_0x46d0c9];return _0x174506;};'use strict';var EventEmitter=require(_0xbd7e('0x0'));var SmsQueue=require(_0xbd7e('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd7e('0x2'),'afterUpdate':_0xbd7e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x349f25){return function(_0x3c6e3d,_0x5e5516,_0x32ecca){SmsQueueEvents[_0xbd7e('0x4')](_0x349f25+':'+_0x3c6e3d['id'],_0x3c6e3d);SmsQueueEvents[_0xbd7e('0x4')](_0x349f25,_0x3c6e3d);_0x32ecca(null);};}for(var e in events){if(events[_0xbd7e('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x1433=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1433,0xaf));var _0x3143=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1433[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x3143('0x0'));var SmsQueue=require(_0x3143('0x1'))['db'][_0x3143('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3143('0x3')](0x0);var events={'afterCreate':_0x3143('0x4'),'afterUpdate':'update','afterDestroy':_0x3143('0x5')};function emitEvent(_0x527fc8){return function(_0xa417a1,_0x3b6c75,_0x170870){SmsQueueEvents[_0x3143('0x6')](_0x527fc8+':'+_0xa417a1['id'],_0xa417a1);SmsQueueEvents['emit'](_0x527fc8,_0xa417a1);_0x170870(null);};}for(var e in events){if(events[_0x3143('0x7')](e)){var event=events[e];SmsQueue[_0x3143('0x8')](e,emitEvent(event));}}module[_0x3143('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 79a64cc..20b66e3 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 _0x5dc7=['api','moment','bluebird','request-promise','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util'];(function(_0x44ba8a,_0x19c5ea){var _0x2ac7fb=function(_0x225dd4){while(--_0x225dd4){_0x44ba8a['push'](_0x44ba8a['shift']());}};_0x2ac7fb(++_0x19c5ea);}(_0x5dc7,0x148));var _0x75dc=function(_0xb16d01,_0x44aa30){_0xb16d01=_0xb16d01-0x0;var _0x43e52c=_0x5dc7[_0xb16d01];return _0x43e52c;};'use strict';var _=require(_0x75dc('0x0'));var util=require(_0x75dc('0x1'));var logger=require('../../config/logger')(_0x75dc('0x2'));var moment=require(_0x75dc('0x3'));var BPromise=require(_0x75dc('0x4'));var rp=require(_0x75dc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x75dc('0x6'));var attributes=require(_0x75dc('0x7'));module['exports']=function(_0x274df5,_0x4cd009){return _0x274df5[_0x75dc('0x8')](_0x75dc('0x9'),attributes,{'tableName':_0x75dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfee9=['sms_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xfee9,0x90));var _0x9fee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfee9[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x9fee('0x0'));var util=require(_0x9fee('0x1'));var logger=require('../../config/logger')(_0x9fee('0x2'));var moment=require('moment');var BPromise=require(_0x9fee('0x3'));var rp=require(_0x9fee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fee('0x5'));var config=require(_0x9fee('0x6'));var attributes=require(_0x9fee('0x7'));module[_0x9fee('0x8')]=function(_0x5c66ad,_0x3d6590){return _0x5c66ad[_0x9fee('0x9')]('SmsQueue',attributes,{'tableName':_0x9fee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 39c7645..910ed08 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 _0x27d5=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','attributes','limit','map','include','model','then','GetSmsQueue','stringify','ShowSmsQueue','find'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0x27d5,0xa0));var _0x527d=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0x27d5[_0x51bb38];return _0x51c09b;};'use strict';var _=require(_0x527d('0x0'));var util=require(_0x527d('0x1'));var moment=require('moment');var BPromise=require(_0x527d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x527d('0x3'));var db=require(_0x527d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x527d('0x5'))(_0x527d('0x6'));var config=require(_0x527d('0x7'));var jayson=require(_0x527d('0x8'));var client=jayson[_0x527d('0x9')][_0x527d('0xa')]({'port':0x232a});config[_0x527d('0xb')]=_[_0x527d('0xc')](config[_0x527d('0xb')],{'host':_0x527d('0xd'),'port':0x18eb});var socket=require(_0x527d('0xe'))(new Redis(config['redis']));require(_0x527d('0xf'))[_0x527d('0x10')](socket);function respondWithRpcPromise(_0x40b828,_0x39ccb7,_0x2e6132){return new BPromise(function(_0x141217,_0x7d799a){return client[_0x527d('0x11')](_0x40b828,_0x2e6132)['then'](function(_0x85687b){logger[_0x527d('0x12')](_0x527d('0x13'),_0x39ccb7,_0x527d('0x14'));logger[_0x527d('0x15')](_0x527d('0x16'),_0x39ccb7,_0x527d('0x14'),JSON['stringify'](_0x85687b));if(_0x85687b[_0x527d('0x17')]){if(_0x85687b['error'][_0x527d('0x18')]===0x1f4){logger[_0x527d('0x17')](_0x527d('0x13'),_0x39ccb7,_0x85687b['error'][_0x527d('0x19')]);return _0x7d799a(_0x85687b[_0x527d('0x17')][_0x527d('0x19')]);}logger[_0x527d('0x17')](_0x527d('0x13'),_0x39ccb7,_0x85687b[_0x527d('0x17')][_0x527d('0x19')]);return _0x141217(_0x85687b[_0x527d('0x17')]['message']);}else{logger[_0x527d('0x12')](_0x527d('0x13'),_0x39ccb7,_0x527d('0x14'));_0x141217(_0x85687b[_0x527d('0x1a')][_0x527d('0x19')]);}})[_0x527d('0x1b')](function(_0xbf4fbd){logger['error'](_0x527d('0x13'),_0x39ccb7,_0xbf4fbd);_0x7d799a(_0xbf4fbd);});});}exports['GetSmsQueue']=function(_0x4e2d1f){var _0x16ea1e=this;return new Promise(function(_0x5d22f5,_0x4752a4){return db['SmsQueue']['findAll']({'raw':_0x4e2d1f['options']?_0x4e2d1f[_0x527d('0x1c')][_0x527d('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e2d1f[_0x527d('0x1c')]?_0x4e2d1f[_0x527d('0x1c')]['where']||null:null,'attributes':_0x4e2d1f[_0x527d('0x1c')]?_0x4e2d1f[_0x527d('0x1c')][_0x527d('0x1e')]||null:null,'limit':_0x4e2d1f[_0x527d('0x1c')]?_0x4e2d1f['options'][_0x527d('0x1f')]||null:null,'include':_0x4e2d1f[_0x527d('0x1c')]?_0x4e2d1f[_0x527d('0x1c')]['include']?_[_0x527d('0x20')](_0x4e2d1f['options'][_0x527d('0x21')],function(_0x102aaa){return{'model':db[_0x102aaa['model']],'as':_0x102aaa['as'],'attributes':_0x102aaa[_0x527d('0x1e')],'include':_0x102aaa[_0x527d('0x21')]?_[_0x527d('0x20')](_0x102aaa[_0x527d('0x21')],function(_0x2e2d77){return{'model':db[_0x2e2d77[_0x527d('0x22')]],'as':_0x2e2d77['as'],'attributes':_0x2e2d77[_0x527d('0x1e')],'include':_0x2e2d77['include']?_[_0x527d('0x20')](_0x2e2d77[_0x527d('0x21')],function(_0x23916b){return{'model':db[_0x23916b[_0x527d('0x22')]],'as':_0x23916b['as'],'attributes':_0x23916b[_0x527d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x527d('0x23')](function(_0x49316c){logger[_0x527d('0x12')](_0x527d('0x24'),_0x4e2d1f);logger[_0x527d('0x15')](_0x527d('0x24'),_0x4e2d1f,JSON[_0x527d('0x25')](_0x49316c));_0x5d22f5(_0x49316c);})['catch'](function(_0x25c084){logger[_0x527d('0x17')](_0x527d('0x24'),_0x25c084[_0x527d('0x19')],_0x4e2d1f);_0x4752a4(_0x16ea1e[_0x527d('0x17')](0x1f4,_0x25c084[_0x527d('0x19')]));});});};exports[_0x527d('0x26')]=function(_0x5af106){var _0x1142c8=this;return new Promise(function(_0x241cc5,_0x3ecc09){return db['SmsQueue'][_0x527d('0x27')]({'raw':_0x5af106[_0x527d('0x1c')]?_0x5af106[_0x527d('0x1c')][_0x527d('0x1d')]===undefined?!![]:![]:!![],'where':_0x5af106[_0x527d('0x1c')]?_0x5af106['options']['where']||null:null,'attributes':_0x5af106['options']?_0x5af106[_0x527d('0x1c')][_0x527d('0x1e')]||null:null,'include':_0x5af106[_0x527d('0x1c')]?_0x5af106['options'][_0x527d('0x21')]?_[_0x527d('0x20')](_0x5af106[_0x527d('0x1c')]['include'],function(_0x5af3eb){return{'model':db[_0x5af3eb[_0x527d('0x22')]],'as':_0x5af3eb['as'],'attributes':_0x5af3eb[_0x527d('0x1e')],'include':_0x5af3eb[_0x527d('0x21')]?_['map'](_0x5af3eb['include'],function(_0x2f9052){return{'model':db[_0x2f9052[_0x527d('0x22')]],'as':_0x2f9052['as'],'attributes':_0x2f9052[_0x527d('0x1e')],'include':_0x2f9052[_0x527d('0x21')]?_[_0x527d('0x20')](_0x2f9052[_0x527d('0x21')],function(_0x466a79){return{'model':db[_0x466a79[_0x527d('0x22')]],'as':_0x466a79['as'],'attributes':_0x466a79[_0x527d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x539f59){logger[_0x527d('0x12')]('ShowSmsQueue',_0x5af106);logger['debug']('ShowSmsQueue',_0x5af106,JSON[_0x527d('0x25')](_0x539f59));_0x241cc5(_0x539f59);})[_0x527d('0x1b')](function(_0x14b621){logger[_0x527d('0x17')](_0x527d('0x26'),_0x14b621['message'],_0x5af106);_0x3ecc09(_0x1142c8[_0x527d('0x17')](0x1f4,_0x14b621[_0x527d('0x19')]));});});}; \ No newline at end of file +var _0x227a=['./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter'];(function(_0x412274,_0x4f9a69){var _0x55353e=function(_0x3fc8b2){while(--_0x3fc8b2){_0x412274['push'](_0x412274['shift']());}};_0x55353e(++_0x4f9a69);}(_0x227a,0x96));var _0xa227=function(_0x2a5fdc,_0x1119cf){_0x2a5fdc=_0x2a5fdc-0x0;var _0x83d8de=_0x227a[_0x2a5fdc];return _0x83d8de;};'use strict';var _=require(_0xa227('0x0'));var util=require(_0xa227('0x1'));var moment=require(_0xa227('0x2'));var BPromise=require(_0xa227('0x3'));var rs=require(_0xa227('0x4'));var fs=require('fs');var Redis=require(_0xa227('0x5'));var db=require(_0xa227('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa227('0x7'))(_0xa227('0x8'));var config=require('../../config/environment');var jayson=require(_0xa227('0x9'));var client=jayson['client'][_0xa227('0xa')]({'port':0x232a});config['redis']=_[_0xa227('0xb')](config[_0xa227('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa227('0xd'))(new Redis(config['redis']));require(_0xa227('0xe'))[_0xa227('0xf')](socket);function respondWithRpcPromise(_0x5d853d,_0x5bb469,_0x30f403){return new BPromise(function(_0x37559f,_0xbcf4f2){return client[_0xa227('0x10')](_0x5d853d,_0x30f403)[_0xa227('0x11')](function(_0x929f20){logger[_0xa227('0x12')](_0xa227('0x13'),_0x5bb469,_0xa227('0x14'));logger[_0xa227('0x15')](_0xa227('0x16'),_0x5bb469,_0xa227('0x14'),JSON[_0xa227('0x17')](_0x929f20));if(_0x929f20['error']){if(_0x929f20[_0xa227('0x18')][_0xa227('0x19')]===0x1f4){logger[_0xa227('0x18')]('SmsQueue,\x20%s,\x20%s',_0x5bb469,_0x929f20[_0xa227('0x18')][_0xa227('0x1a')]);return _0xbcf4f2(_0x929f20[_0xa227('0x18')][_0xa227('0x1a')]);}logger[_0xa227('0x18')](_0xa227('0x13'),_0x5bb469,_0x929f20[_0xa227('0x18')][_0xa227('0x1a')]);return _0x37559f(_0x929f20['error'][_0xa227('0x1a')]);}else{logger[_0xa227('0x12')](_0xa227('0x13'),_0x5bb469,_0xa227('0x14'));_0x37559f(_0x929f20['result'][_0xa227('0x1a')]);}})[_0xa227('0x1b')](function(_0x40773b){logger[_0xa227('0x18')](_0xa227('0x13'),_0x5bb469,_0x40773b);_0xbcf4f2(_0x40773b);});});}exports[_0xa227('0x1c')]=function(_0x2a2258){var _0x31dbd3=this;return new Promise(function(_0x4561f7,_0x2350db){return db[_0xa227('0x1d')][_0xa227('0x1e')]({'raw':_0x2a2258['options']?_0x2a2258[_0xa227('0x1f')][_0xa227('0x20')]===undefined?!![]:![]:!![],'where':_0x2a2258[_0xa227('0x1f')]?_0x2a2258['options'][_0xa227('0x21')]||null:null,'attributes':_0x2a2258[_0xa227('0x1f')]?_0x2a2258[_0xa227('0x1f')][_0xa227('0x22')]||null:null,'limit':_0x2a2258[_0xa227('0x1f')]?_0x2a2258[_0xa227('0x1f')][_0xa227('0x23')]||null:null,'include':_0x2a2258[_0xa227('0x1f')]?_0x2a2258[_0xa227('0x1f')][_0xa227('0x24')]?_['map'](_0x2a2258[_0xa227('0x1f')][_0xa227('0x24')],function(_0x10f7c5){return{'model':db[_0x10f7c5[_0xa227('0x25')]],'as':_0x10f7c5['as'],'attributes':_0x10f7c5[_0xa227('0x22')],'include':_0x10f7c5[_0xa227('0x24')]?_[_0xa227('0x26')](_0x10f7c5[_0xa227('0x24')],function(_0xff96ef){return{'model':db[_0xff96ef[_0xa227('0x25')]],'as':_0xff96ef['as'],'attributes':_0xff96ef['attributes'],'include':_0xff96ef[_0xa227('0x24')]?_[_0xa227('0x26')](_0xff96ef[_0xa227('0x24')],function(_0x387e0e){return{'model':db[_0x387e0e[_0xa227('0x25')]],'as':_0x387e0e['as'],'attributes':_0x387e0e[_0xa227('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa227('0x11')](function(_0x34f22e){logger[_0xa227('0x12')](_0xa227('0x1c'),_0x2a2258);logger[_0xa227('0x15')](_0xa227('0x1c'),_0x2a2258,JSON[_0xa227('0x17')](_0x34f22e));_0x4561f7(_0x34f22e);})[_0xa227('0x1b')](function(_0x3b4f4f){logger[_0xa227('0x18')](_0xa227('0x1c'),_0x3b4f4f[_0xa227('0x1a')],_0x2a2258);_0x2350db(_0x31dbd3[_0xa227('0x18')](0x1f4,_0x3b4f4f[_0xa227('0x1a')]));});});};exports[_0xa227('0x27')]=function(_0x80ad82){var _0x2ba0ca=this;return new Promise(function(_0x5771b8,_0x3f692a){return db[_0xa227('0x1d')][_0xa227('0x28')]({'raw':_0x80ad82[_0xa227('0x1f')]?_0x80ad82['options'][_0xa227('0x20')]===undefined?!![]:![]:!![],'where':_0x80ad82[_0xa227('0x1f')]?_0x80ad82[_0xa227('0x1f')]['where']||null:null,'attributes':_0x80ad82[_0xa227('0x1f')]?_0x80ad82[_0xa227('0x1f')][_0xa227('0x22')]||null:null,'include':_0x80ad82['options']?_0x80ad82[_0xa227('0x1f')][_0xa227('0x24')]?_[_0xa227('0x26')](_0x80ad82[_0xa227('0x1f')][_0xa227('0x24')],function(_0x23f774){return{'model':db[_0x23f774[_0xa227('0x25')]],'as':_0x23f774['as'],'attributes':_0x23f774[_0xa227('0x22')],'include':_0x23f774[_0xa227('0x24')]?_['map'](_0x23f774[_0xa227('0x24')],function(_0x1957d9){return{'model':db[_0x1957d9[_0xa227('0x25')]],'as':_0x1957d9['as'],'attributes':_0x1957d9[_0xa227('0x22')],'include':_0x1957d9[_0xa227('0x24')]?_[_0xa227('0x26')](_0x1957d9[_0xa227('0x24')],function(_0x4dc125){return{'model':db[_0x4dc125[_0xa227('0x25')]],'as':_0x4dc125['as'],'attributes':_0x4dc125[_0xa227('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x114af4){logger['info']('ShowSmsQueue',_0x80ad82);logger['debug']('ShowSmsQueue',_0x80ad82,JSON[_0xa227('0x17')](_0x114af4));_0x5771b8(_0x114af4);})[_0xa227('0x1b')](function(_0xf43322){logger[_0xa227('0x18')](_0xa227('0x27'),_0xf43322[_0xa227('0x1a')],_0x80ad82);_0x3f692a(_0x2ba0ca['error'](0x1f4,_0xf43322[_0xa227('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8385083..5a4e686 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 _0x8bd5=['smsQueue:','./smsQueue.events','save','remove','update','removeListener','register'];(function(_0x2b01f9,_0x4df7ea){var _0x10ac0c=function(_0x23e767){while(--_0x23e767){_0x2b01f9['push'](_0x2b01f9['shift']());}};_0x10ac0c(++_0x4df7ea);}(_0x8bd5,0xe1));var _0x58bd=function(_0x424b9d,_0x15f0fa){_0x424b9d=_0x424b9d-0x0;var _0x395a17=_0x8bd5[_0x424b9d];return _0x395a17;};'use strict';var SmsQueueEvents=require(_0x58bd('0x0'));var events=[_0x58bd('0x1'),_0x58bd('0x2'),_0x58bd('0x3')];function createListener(_0x5d7b13,_0x37997a){return function(_0x56def0){_0x37997a['emit'](_0x5d7b13,_0x56def0);};}function removeListener(_0x1befc2,_0x5ac6a7){return function(){SmsQueueEvents[_0x58bd('0x4')](_0x1befc2,_0x5ac6a7);};}exports[_0x58bd('0x5')]=function(_0x604834){for(var _0x454546=0x0,_0x35ed7b=events['length'];_0x454546<_0x35ed7b;_0x454546++){var _0xd4b106=events[_0x454546];var _0xea1c54=createListener(_0x58bd('0x6')+_0xd4b106,_0x604834);SmsQueueEvents['on'](_0xd4b106,_0xea1c54);}}; \ No newline at end of file +var _0x9d96=['remove','update','emit','removeListener','register','smsQueue:','./smsQueue.events','save'];(function(_0x2e6c01,_0x2072a8){var _0x5e7a75=function(_0x28a48e){while(--_0x28a48e){_0x2e6c01['push'](_0x2e6c01['shift']());}};_0x5e7a75(++_0x2072a8);}(_0x9d96,0x17e));var _0x69d9=function(_0x140187,_0x4c735e){_0x140187=_0x140187-0x0;var _0x2b395c=_0x9d96[_0x140187];return _0x2b395c;};'use strict';var SmsQueueEvents=require(_0x69d9('0x0'));var events=[_0x69d9('0x1'),_0x69d9('0x2'),_0x69d9('0x3')];function createListener(_0x1172e2,_0x2c878b){return function(_0x5f0040){_0x2c878b[_0x69d9('0x4')](_0x1172e2,_0x5f0040);};}function removeListener(_0x123e2c,_0x45d9d8){return function(){SmsQueueEvents[_0x69d9('0x5')](_0x123e2c,_0x45d9d8);};}exports[_0x69d9('0x6')]=function(_0x2ce06d){for(var _0x316cc9=0x0,_0x527610=events['length'];_0x316cc9<_0x527610;_0x316cc9++){var _0x4af6b4=events[_0x316cc9];var _0x20fa4c=createListener(_0x69d9('0x7')+_0x4af6b4,_0x2ce06d);SmsQueueEvents['on'](_0x4af6b4,_0x20fa4c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5b5a2ab..629602b 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 _0x1a96=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x1788d,_0xf4453f){var _0x5c755d=function(_0x195fc6){while(--_0x195fc6){_0x1788d['push'](_0x1788d['shift']());}};_0x5c755d(++_0xf4453f);}(_0x1a96,0x1a3));var _0x61a9=function(_0x30570a,_0x27857e){_0x30570a=_0x30570a-0x0;var _0x232a43=_0x1a96[_0x30570a];return _0x232a43;};'use strict';var multer=require(_0x61a9('0x0'));var util=require(_0x61a9('0x1'));var path=require(_0x61a9('0x2'));var timeout=require(_0x61a9('0x3'));var express=require('express');var router=express[_0x61a9('0x4')]();var fs_extra=require(_0x61a9('0x5'));var auth=require(_0x61a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x61a9('0x7'));var controller=require(_0x61a9('0x8'));router[_0x61a9('0x9')]('/',auth[_0x61a9('0xa')](),controller[_0x61a9('0xb')]);router['get'](_0x61a9('0xc'),auth[_0x61a9('0xa')](),controller[_0x61a9('0xd')]);router[_0x61a9('0x9')](_0x61a9('0xe'),auth['isAuthenticated'](),controller[_0x61a9('0xf')]);router[_0x61a9('0x10')]('/',auth[_0x61a9('0xa')](),controller[_0x61a9('0x11')]);router[_0x61a9('0x12')](_0x61a9('0xe'),auth[_0x61a9('0xa')](),controller[_0x61a9('0x13')]);router[_0x61a9('0x14')](_0x61a9('0xe'),auth['isAuthenticated'](),controller[_0x61a9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x91f6=['post','create','put','/:id','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x12fb36,_0x2285e9){var _0x37952d=function(_0xb5fe2d){while(--_0xb5fe2d){_0x12fb36['push'](_0x12fb36['shift']());}};_0x37952d(++_0x2285e9);}(_0x91f6,0x7c));var _0x691f=function(_0x1b4b0a,_0x1083d5){_0x1b4b0a=_0x1b4b0a-0x0;var _0x2e6f15=_0x91f6[_0x1b4b0a];return _0x2e6f15;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x691f('0x0'));var timeout=require('connect-timeout');var express=require(_0x691f('0x1'));var router=express['Router']();var fs_extra=require(_0x691f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x691f('0x3'));var config=require(_0x691f('0x4'));var controller=require(_0x691f('0x5'));router[_0x691f('0x6')]('/',auth['isAuthenticated'](),controller[_0x691f('0x7')]);router['get'](_0x691f('0x8'),auth[_0x691f('0x9')](),controller[_0x691f('0xa')]);router[_0x691f('0x6')]('/:id',auth[_0x691f('0x9')](),controller[_0x691f('0xb')]);router[_0x691f('0xc')]('/',auth[_0x691f('0x9')](),controller[_0x691f('0xd')]);router[_0x691f('0xe')](_0x691f('0xf'),auth[_0x691f('0x9')](),controller['update']);router['delete']('/:id',auth[_0x691f('0x9')](),controller['destroy']);module[_0x691f('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 2722068..0667270 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 _0xe1d8=['sequelize','STRING','DATE'];(function(_0x10c714,_0x3fde2f){var _0x320af2=function(_0x171e38){while(--_0x171e38){_0x10c714['push'](_0x10c714['shift']());}};_0x320af2(++_0x3fde2f);}(_0xe1d8,0x189));var _0x8e1d=function(_0x63a233,_0x2c6be5){_0x63a233=_0x63a233-0x0;var _0x4e5b00=_0xe1d8[_0x63a233];return _0x4e5b00;};'use strict';var moment=require('moment');var Sequelize=require(_0x8e1d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8e1d('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8e1d('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc00=['moment','sequelize','STRING','DATE'];(function(_0x312fb6,_0x49b5aa){var _0x5536f1=function(_0x3e2848){while(--_0x3e2848){_0x312fb6['push'](_0x312fb6['shift']());}};_0x5536f1(++_0x49b5aa);}(_0xdc00,0x120));var _0x0dc0=function(_0x19694a,_0x20374e){_0x19694a=_0x19694a-0x0;var _0x120927=_0xdc00[_0x19694a];return _0x120927;};'use strict';var moment=require(_0x0dc0('0x0'));var Sequelize=require(_0x0dc0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0dc0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0dc0('0x3')]},'leaveAt':{'type':Sequelize[_0x0dc0('0x3')]},'acceptAt':{'type':Sequelize[_0x0dc0('0x3')]},'exitAt':{'type':Sequelize[_0x0dc0('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index df14eaf..8b72ace 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 _0x590c=['rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','index','map','SmsQueueReport'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x590c,0x68));var _0xc590=function(_0x5c802c,_0x434257){_0x5c802c=_0x5c802c-0x0;var _0x3ca25f=_0x590c[_0x5c802c];return _0x3ca25f;};'use strict';var emlformat=require(_0xc590('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc590('0x1'));var rp=require(_0xc590('0x2'));var moment=require(_0xc590('0x3'));var BPromise=require(_0xc590('0x4'));var Mustache=require(_0xc590('0x5'));var util=require(_0xc590('0x6'));var path=require(_0xc590('0x7'));var sox=require('sox');var csv=require(_0xc590('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc590('0x9'));var _=require(_0xc590('0xa'));var squel=require(_0xc590('0xb'));var crypto=require(_0xc590('0xc'));var jsforce=require(_0xc590('0xd'));var deskjs=require(_0xc590('0xe'));var toCsv=require(_0xc590('0x8'));var querystring=require('querystring');var Papa=require(_0xc590('0xf'));var Redis=require(_0xc590('0x10'));var authService=require(_0xc590('0x11'));var qs=require(_0xc590('0x12'));var as=require(_0xc590('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc590('0x14'));var config=require(_0xc590('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc590('0x16'))['db'];function respondWithStatusCode(_0x430470,_0x4c0a43){_0x4c0a43=_0x4c0a43||0xcc;return function(_0x18e347){if(_0x18e347){return _0x430470[_0xc590('0x17')](_0x4c0a43);}return _0x430470[_0xc590('0x18')](_0x4c0a43)[_0xc590('0x19')]();};}function respondWithResult(_0x5d0834,_0x50bc42){_0x50bc42=_0x50bc42||0xc8;return function(_0x13b089){if(_0x13b089){return _0x5d0834[_0xc590('0x18')](_0x50bc42)['json'](_0x13b089);}};}function respondWithFilteredResult(_0x37f5d9,_0x3f9f72){return function(_0x34a73f){if(_0x34a73f){var _0x273621=typeof _0x3f9f72[_0xc590('0x1a')]===_0xc590('0x1b')&&typeof _0x3f9f72[_0xc590('0x1c')]===_0xc590('0x1b');var _0x524cbe=_0x34a73f[_0xc590('0x1d')];var _0x46ac8f=_0x273621?0x0:_0x3f9f72[_0xc590('0x1a')];var _0x42bae7=_0x273621?_0x34a73f['count']:_0x3f9f72[_0xc590('0x1a')]+_0x3f9f72[_0xc590('0x1c')];var _0x5ce886;if(_0x42bae7>=_0x524cbe){_0x42bae7=_0x524cbe;_0x5ce886=0xc8;}else{_0x5ce886=0xce;}_0x37f5d9[_0xc590('0x18')](_0x5ce886);return _0x37f5d9[_0xc590('0x1e')](_0xc590('0x1f'),_0x46ac8f+'-'+_0x42bae7+'/'+_0x524cbe)[_0xc590('0x20')](_0x34a73f);}return null;};}function patchUpdates(_0x1c88b5){return function(_0x59f7f3){try{jsonpatch[_0xc590('0x21')](_0x59f7f3,_0x1c88b5,!![]);}catch(_0x20a39a){return BPromise[_0xc590('0x22')](_0x20a39a);}return _0x59f7f3[_0xc590('0x23')]();};}function saveUpdates(_0x38e8ae,_0x2494d1){return function(_0x5bc1ab){if(_0x5bc1ab){return _0x5bc1ab['update'](_0x38e8ae)['then'](function(_0x4bc99f){return _0x4bc99f;});}return null;};}function removeEntity(_0xed5293,_0x11dd64){return function(_0x44bf2b){if(_0x44bf2b){return _0x44bf2b['destroy']()[_0xc590('0x24')](function(){_0xed5293[_0xc590('0x18')](0xcc)[_0xc590('0x19')]();});}};}function handleEntityNotFound(_0x42590b,_0x298603){return function(_0x327f13){if(!_0x327f13){_0x42590b[_0xc590('0x17')](0x194);}return _0x327f13;};}function handleError(_0x380a27,_0xe99163){_0xe99163=_0xe99163||0x1f4;return function(_0x5f12b5){logger[_0xc590('0x25')](_0x5f12b5[_0xc590('0x26')]);if(_0x5f12b5['name']){delete _0x5f12b5['name'];}_0x380a27[_0xc590('0x18')](_0xe99163)['send'](_0x5f12b5);};}exports[_0xc590('0x27')]=function(_0x3d4892,_0x3dd795){var _0x18ca67={},_0x141d4c={},_0x50e2a5={'count':0x0,'rows':[]};var _0x117bf7=_[_0xc590('0x28')](db[_0xc590('0x29')][_0xc590('0x2a')],function(_0x273c69){return{'name':_0x273c69['fieldName'],'type':_0x273c69[_0xc590('0x2b')][_0xc590('0x2c')]};});_0x141d4c[_0xc590('0x2d')]=_[_0xc590('0x28')](_0x117bf7,_0xc590('0x2e'));_0x141d4c[_0xc590('0x2f')]=_['keys'](_0x3d4892[_0xc590('0x2f')]);_0x141d4c[_0xc590('0x30')]=_[_0xc590('0x31')](_0x141d4c[_0xc590('0x2d')],_0x141d4c[_0xc590('0x2f')]);_0x18ca67[_0xc590('0x32')]=_[_0xc590('0x31')](_0x141d4c[_0xc590('0x2d')],qs[_0xc590('0x33')](_0x3d4892[_0xc590('0x2f')]['fields']));_0x18ca67[_0xc590('0x32')]=_0x18ca67[_0xc590('0x32')][_0xc590('0x34')]?_0x18ca67[_0xc590('0x32')]:_0x141d4c[_0xc590('0x2d')];if(!_0x3d4892[_0xc590('0x2f')]['hasOwnProperty'](_0xc590('0x35'))){_0x18ca67[_0xc590('0x1c')]=qs[_0xc590('0x1c')](_0x3d4892['query'][_0xc590('0x1c')]);_0x18ca67[_0xc590('0x1a')]=qs['offset'](_0x3d4892['query']['offset']);}_0x18ca67['order']=qs[_0xc590('0x36')](_0x3d4892[_0xc590('0x2f')]['sort']);_0x18ca67[_0xc590('0x37')]=qs['filters'](_[_0xc590('0x38')](_0x3d4892['query'],_0x141d4c[_0xc590('0x30')]),_0x117bf7);if(_0x3d4892['query'][_0xc590('0x39')]){_0x18ca67['where']=_[_0xc590('0x3a')](_0x18ca67[_0xc590('0x37')],{'$or':_['map'](_0x117bf7,function(_0x2e2f0b){if(_0x2e2f0b[_0xc590('0x2b')]!==_0xc590('0x3b')){var _0x201ef5={};_0x201ef5[_0x2e2f0b['name']]={'$like':'%'+_0x3d4892[_0xc590('0x2f')][_0xc590('0x39')]+'%'};return _0x201ef5;}})});}_0x18ca67=_[_0xc590('0x3a')]({},_0x18ca67,_0x3d4892['options']);var _0x35fc2d={'where':_0x18ca67[_0xc590('0x37')]};return db[_0xc590('0x29')][_0xc590('0x1d')](_0x35fc2d)[_0xc590('0x24')](function(_0x1a2f41){_0x50e2a5[_0xc590('0x1d')]=_0x1a2f41;if(_0x3d4892[_0xc590('0x2f')][_0xc590('0x3c')]){_0x18ca67[_0xc590('0x3d')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xc590('0x3e')](_0x18ca67);})[_0xc590('0x24')](function(_0x2c6466){_0x50e2a5[_0xc590('0x3f')]=_0x2c6466;return _0x50e2a5;})[_0xc590('0x24')](respondWithFilteredResult(_0x3dd795,_0x18ca67))['catch'](handleError(_0x3dd795,null));};exports[_0xc590('0x40')]=function(_0x32bd43,_0x5cd9dd){var _0x3798ff={'raw':!![],'where':{'id':_0x32bd43[_0xc590('0x41')]['id']}},_0x5cc13c={};_0x5cc13c[_0xc590('0x2d')]=_[_0xc590('0x42')](db[_0xc590('0x29')]['rawAttributes']);_0x5cc13c['query']=_[_0xc590('0x42')](_0x32bd43['query']);_0x5cc13c[_0xc590('0x30')]=_[_0xc590('0x31')](_0x5cc13c[_0xc590('0x2d')],_0x5cc13c[_0xc590('0x2f')]);_0x3798ff[_0xc590('0x32')]=_[_0xc590('0x31')](_0x5cc13c[_0xc590('0x2d')],qs[_0xc590('0x33')](_0x32bd43[_0xc590('0x2f')][_0xc590('0x33')]));_0x3798ff['attributes']=_0x3798ff[_0xc590('0x32')]['length']?_0x3798ff[_0xc590('0x32')]:_0x5cc13c['model'];if(_0x32bd43[_0xc590('0x2f')][_0xc590('0x3c')]){_0x3798ff[_0xc590('0x3d')]=[{'all':!![]}];}_0x3798ff=_[_0xc590('0x3a')]({},_0x3798ff,_0x32bd43[_0xc590('0x43')]);return db['SmsQueueReport'][_0xc590('0x44')](_0x3798ff)[_0xc590('0x24')](handleEntityNotFound(_0x5cd9dd,null))[_0xc590('0x24')](respondWithResult(_0x5cd9dd,null))[_0xc590('0x45')](handleError(_0x5cd9dd,null));};exports['create']=function(_0x18e2f9,_0x3ea25c){return db[_0xc590('0x29')][_0xc590('0x46')](_0x18e2f9[_0xc590('0x47')],{})[_0xc590('0x24')](respondWithResult(_0x3ea25c,0xc9))['catch'](handleError(_0x3ea25c,null));};exports['update']=function(_0x17069e,_0x3e22ca){if(_0x17069e[_0xc590('0x47')]['id']){delete _0x17069e[_0xc590('0x47')]['id'];}return db[_0xc590('0x29')]['find']({'where':{'id':_0x17069e[_0xc590('0x41')]['id']}})[_0xc590('0x24')](handleEntityNotFound(_0x3e22ca,null))[_0xc590('0x24')](saveUpdates(_0x17069e['body'],null))[_0xc590('0x24')](respondWithResult(_0x3e22ca,null))[_0xc590('0x45')](handleError(_0x3e22ca,null));};exports['destroy']=function(_0xe8b4fa,_0x2185cd){return db[_0xc590('0x29')][_0xc590('0x44')]({'where':{'id':_0xe8b4fa[_0xc590('0x41')]['id']}})[_0xc590('0x24')](handleEntityNotFound(_0x2185cd,null))[_0xc590('0x24')](removeEntity(_0x2185cd,null))[_0xc590('0x45')](handleError(_0x2185cd,null));};exports[_0xc590('0x48')]=function(_0x56b610,_0x3b25ef){return db['SmsQueueReport'][_0xc590('0x48')]()[_0xc590('0x24')](respondWithResult(_0x3b25ef,null))[_0xc590('0x45')](handleError(_0x3b25ef,null));}; \ No newline at end of file +var _0xc248=['ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','update','then','end','error','stack','name','send','index','map','SmsQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','include','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x183906,_0x223210){var _0x106f18=function(_0x5630a5){while(--_0x5630a5){_0x183906['push'](_0x183906['shift']());}};_0x106f18(++_0x223210);}(_0xc248,0x1a6));var _0x8c24=function(_0x517cfd,_0xbf678e){_0x517cfd=_0x517cfd-0x0;var _0x5e2beb=_0xc248[_0x517cfd];return _0x5e2beb;};'use strict';var emlformat=require(_0x8c24('0x0'));var rimraf=require(_0x8c24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c24('0x2'));var rp=require(_0x8c24('0x3'));var moment=require(_0x8c24('0x4'));var BPromise=require(_0x8c24('0x5'));var Mustache=require(_0x8c24('0x6'));var util=require('util');var path=require(_0x8c24('0x7'));var sox=require(_0x8c24('0x8'));var csv=require(_0x8c24('0x9'));var ejs=require(_0x8c24('0xa'));var fs=require('fs');var fs_extra=require(_0x8c24('0xb'));var _=require('lodash');var squel=require(_0x8c24('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c24('0xd'));var deskjs=require(_0x8c24('0xe'));var toCsv=require(_0x8c24('0x9'));var querystring=require('querystring');var Papa=require(_0x8c24('0xf'));var Redis=require(_0x8c24('0x10'));var authService=require(_0x8c24('0x11'));var qs=require(_0x8c24('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c24('0x13'))('api');var utils=require(_0x8c24('0x14'));var config=require(_0x8c24('0x15'));var licenseUtil=require(_0x8c24('0x16'));var db=require(_0x8c24('0x17'))['db'];function respondWithStatusCode(_0x369ee3,_0x447e15){_0x447e15=_0x447e15||0xcc;return function(_0xf69e0d){if(_0xf69e0d){return _0x369ee3[_0x8c24('0x18')](_0x447e15);}return _0x369ee3[_0x8c24('0x19')](_0x447e15)['end']();};}function respondWithResult(_0x5d296c,_0x36da30){_0x36da30=_0x36da30||0xc8;return function(_0x14cc4f){if(_0x14cc4f){return _0x5d296c[_0x8c24('0x19')](_0x36da30)['json'](_0x14cc4f);}};}function respondWithFilteredResult(_0x3e8a6b,_0x5b9c86){return function(_0x5c3620){if(_0x5c3620){var _0x41ed5e=typeof _0x5b9c86[_0x8c24('0x1a')]===_0x8c24('0x1b')&&typeof _0x5b9c86[_0x8c24('0x1c')]===_0x8c24('0x1b');var _0x3d20e6=_0x5c3620[_0x8c24('0x1d')];var _0x374ba7=_0x41ed5e?0x0:_0x5b9c86[_0x8c24('0x1a')];var _0x1921ec=_0x41ed5e?_0x5c3620[_0x8c24('0x1d')]:_0x5b9c86['offset']+_0x5b9c86['limit'];var _0x1b8e19;if(_0x1921ec>=_0x3d20e6){_0x1921ec=_0x3d20e6;_0x1b8e19=0xc8;}else{_0x1b8e19=0xce;}_0x3e8a6b[_0x8c24('0x19')](_0x1b8e19);return _0x3e8a6b[_0x8c24('0x1e')]('Content-Range',_0x374ba7+'-'+_0x1921ec+'/'+_0x3d20e6)['json'](_0x5c3620);}return null;};}function patchUpdates(_0x42225c){return function(_0xbc652){try{jsonpatch['apply'](_0xbc652,_0x42225c,!![]);}catch(_0x124e98){return BPromise[_0x8c24('0x1f')](_0x124e98);}return _0xbc652[_0x8c24('0x20')]();};}function saveUpdates(_0x487599,_0x83ba16){return function(_0xd672b){if(_0xd672b){return _0xd672b[_0x8c24('0x21')](_0x487599)['then'](function(_0x568e87){return _0x568e87;});}return null;};}function removeEntity(_0x36a117,_0x181dd7){return function(_0x5d9fa9){if(_0x5d9fa9){return _0x5d9fa9['destroy']()[_0x8c24('0x22')](function(){_0x36a117[_0x8c24('0x19')](0xcc)[_0x8c24('0x23')]();});}};}function handleEntityNotFound(_0x381d50,_0xfc08d7){return function(_0x2c6847){if(!_0x2c6847){_0x381d50[_0x8c24('0x18')](0x194);}return _0x2c6847;};}function handleError(_0x513a1b,_0x193b93){_0x193b93=_0x193b93||0x1f4;return function(_0x4e8d7f){logger[_0x8c24('0x24')](_0x4e8d7f[_0x8c24('0x25')]);if(_0x4e8d7f[_0x8c24('0x26')]){delete _0x4e8d7f[_0x8c24('0x26')];}_0x513a1b[_0x8c24('0x19')](_0x193b93)[_0x8c24('0x27')](_0x4e8d7f);};}exports[_0x8c24('0x28')]=function(_0x31b802,_0x46fe54){var _0x5a329e={},_0x37c85a={},_0x2838ae={'count':0x0,'rows':[]};var _0x5004dd=_[_0x8c24('0x29')](db[_0x8c24('0x2a')]['rawAttributes'],function(_0x4fc80a){return{'name':_0x4fc80a['fieldName'],'type':_0x4fc80a[_0x8c24('0x2b')][_0x8c24('0x2c')]};});_0x37c85a[_0x8c24('0x2d')]=_['map'](_0x5004dd,_0x8c24('0x26'));_0x37c85a[_0x8c24('0x2e')]=_[_0x8c24('0x2f')](_0x31b802[_0x8c24('0x2e')]);_0x37c85a[_0x8c24('0x30')]=_[_0x8c24('0x31')](_0x37c85a[_0x8c24('0x2d')],_0x37c85a[_0x8c24('0x2e')]);_0x5a329e[_0x8c24('0x32')]=_[_0x8c24('0x31')](_0x37c85a[_0x8c24('0x2d')],qs[_0x8c24('0x33')](_0x31b802[_0x8c24('0x2e')]['fields']));_0x5a329e[_0x8c24('0x32')]=_0x5a329e[_0x8c24('0x32')]['length']?_0x5a329e['attributes']:_0x37c85a[_0x8c24('0x2d')];if(!_0x31b802[_0x8c24('0x2e')]['hasOwnProperty']('nolimit')){_0x5a329e[_0x8c24('0x1c')]=qs[_0x8c24('0x1c')](_0x31b802[_0x8c24('0x2e')][_0x8c24('0x1c')]);_0x5a329e['offset']=qs[_0x8c24('0x1a')](_0x31b802[_0x8c24('0x2e')][_0x8c24('0x1a')]);}_0x5a329e[_0x8c24('0x34')]=qs['sort'](_0x31b802['query'][_0x8c24('0x35')]);_0x5a329e['where']=qs['filters'](_[_0x8c24('0x36')](_0x31b802['query'],_0x37c85a[_0x8c24('0x30')]),_0x5004dd);if(_0x31b802['query'][_0x8c24('0x37')]){_0x5a329e[_0x8c24('0x38')]=_[_0x8c24('0x39')](_0x5a329e[_0x8c24('0x38')],{'$or':_[_0x8c24('0x29')](_0x5004dd,function(_0x32ec5c){if(_0x32ec5c[_0x8c24('0x2b')]!==_0x8c24('0x3a')){var _0x3f556d={};_0x3f556d[_0x32ec5c['name']]={'$like':'%'+_0x31b802[_0x8c24('0x2e')][_0x8c24('0x37')]+'%'};return _0x3f556d;}})});}_0x5a329e=_[_0x8c24('0x39')]({},_0x5a329e,_0x31b802[_0x8c24('0x3b')]);var _0x55820d={'where':_0x5a329e[_0x8c24('0x38')]};return db[_0x8c24('0x2a')][_0x8c24('0x1d')](_0x55820d)[_0x8c24('0x22')](function(_0x58eca4){_0x2838ae[_0x8c24('0x1d')]=_0x58eca4;if(_0x31b802[_0x8c24('0x2e')][_0x8c24('0x3c')]){_0x5a329e['include']=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x5a329e);})[_0x8c24('0x22')](function(_0xf74514){_0x2838ae[_0x8c24('0x3d')]=_0xf74514;return _0x2838ae;})[_0x8c24('0x22')](respondWithFilteredResult(_0x46fe54,_0x5a329e))[_0x8c24('0x3e')](handleError(_0x46fe54,null));};exports[_0x8c24('0x3f')]=function(_0x595f9a,_0x103ff2){var _0xc4540f={'raw':!![],'where':{'id':_0x595f9a['params']['id']}},_0x2e9f9c={};_0x2e9f9c[_0x8c24('0x2d')]=_[_0x8c24('0x2f')](db[_0x8c24('0x2a')][_0x8c24('0x40')]);_0x2e9f9c[_0x8c24('0x2e')]=_[_0x8c24('0x2f')](_0x595f9a[_0x8c24('0x2e')]);_0x2e9f9c['filters']=_[_0x8c24('0x31')](_0x2e9f9c[_0x8c24('0x2d')],_0x2e9f9c['query']);_0xc4540f['attributes']=_[_0x8c24('0x31')](_0x2e9f9c[_0x8c24('0x2d')],qs[_0x8c24('0x33')](_0x595f9a[_0x8c24('0x2e')][_0x8c24('0x33')]));_0xc4540f[_0x8c24('0x32')]=_0xc4540f[_0x8c24('0x32')]['length']?_0xc4540f[_0x8c24('0x32')]:_0x2e9f9c[_0x8c24('0x2d')];if(_0x595f9a[_0x8c24('0x2e')][_0x8c24('0x3c')]){_0xc4540f[_0x8c24('0x41')]=[{'all':!![]}];}_0xc4540f=_[_0x8c24('0x39')]({},_0xc4540f,_0x595f9a['options']);return db[_0x8c24('0x2a')][_0x8c24('0x42')](_0xc4540f)[_0x8c24('0x22')](handleEntityNotFound(_0x103ff2,null))['then'](respondWithResult(_0x103ff2,null))[_0x8c24('0x3e')](handleError(_0x103ff2,null));};exports[_0x8c24('0x43')]=function(_0x3b447d,_0x2d772f){return db['SmsQueueReport'][_0x8c24('0x43')](_0x3b447d[_0x8c24('0x44')],{})[_0x8c24('0x22')](respondWithResult(_0x2d772f,0xc9))[_0x8c24('0x3e')](handleError(_0x2d772f,null));};exports[_0x8c24('0x21')]=function(_0x4cae88,_0x4e61ea){if(_0x4cae88[_0x8c24('0x44')]['id']){delete _0x4cae88[_0x8c24('0x44')]['id'];}return db[_0x8c24('0x2a')][_0x8c24('0x42')]({'where':{'id':_0x4cae88[_0x8c24('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e61ea,null))['then'](saveUpdates(_0x4cae88[_0x8c24('0x44')],null))[_0x8c24('0x22')](respondWithResult(_0x4e61ea,null))['catch'](handleError(_0x4e61ea,null));};exports[_0x8c24('0x46')]=function(_0x18a6b3,_0x166d3c){return db[_0x8c24('0x2a')]['find']({'where':{'id':_0x18a6b3['params']['id']}})[_0x8c24('0x22')](handleEntityNotFound(_0x166d3c,null))[_0x8c24('0x22')](removeEntity(_0x166d3c,null))[_0x8c24('0x3e')](handleError(_0x166d3c,null));};exports[_0x8c24('0x47')]=function(_0x18fa3d,_0x4ab4ab){return db[_0x8c24('0x2a')][_0x8c24('0x47')]()[_0x8c24('0x22')](respondWithResult(_0x4ab4ab,null))[_0x8c24('0x3e')](handleError(_0x4ab4ab,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e5aa814..b77c39c 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3edecf,_0xee137a){var _0x589f6a=function(_0x571335){while(--_0x571335){_0x3edecf['push'](_0x3edecf['shift']());}};_0x589f6a(++_0xee137a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xb7e7[_0x47a349];return _0x18ab75;};'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 +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x12b670,_0x26e8f9){var _0x5d4d7b=function(_0x573b5c){while(--_0x573b5c){_0x12b670['push'](_0x12b670['shift']());}};_0x5d4d7b(++_0x26e8f9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index e07272e..2a541b5 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 _0x2d8a=['catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x32b248,_0x2b9af4){var _0x54336c=function(_0x1720db){while(--_0x1720db){_0x32b248['push'](_0x32b248['shift']());}};_0x54336c(++_0x2b9af4);}(_0x2d8a,0x17d));var _0xa2d8=function(_0x21d627,_0x4e52f9){_0x21d627=_0x21d627-0x0;var _0x2f3d99=_0x2d8a[_0x21d627];return _0x2f3d99;};'use strict';var _=require(_0xa2d8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2d8('0x1'));var rs=require(_0xa2d8('0x2'));var fs=require('fs');var Redis=require(_0xa2d8('0x3'));var db=require(_0xa2d8('0x4'))['db'];var utils=require(_0xa2d8('0x5'));var logger=require(_0xa2d8('0x6'))(_0xa2d8('0x7'));var config=require(_0xa2d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa2d8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55e681,_0x8c53a7,_0x308502){return new BPromise(function(_0x331051,_0x28e54d){return client[_0xa2d8('0xa')](_0x55e681,_0x308502)[_0xa2d8('0xb')](function(_0x38e9a9){logger['info'](_0xa2d8('0xc'),_0x8c53a7,_0xa2d8('0xd'));logger[_0xa2d8('0xe')](_0xa2d8('0xf'),_0x8c53a7,_0xa2d8('0xd'),JSON[_0xa2d8('0x10')](_0x38e9a9));if(_0x38e9a9[_0xa2d8('0x11')]){if(_0x38e9a9[_0xa2d8('0x11')][_0xa2d8('0x12')]===0x1f4){logger[_0xa2d8('0x11')](_0xa2d8('0xc'),_0x8c53a7,_0x38e9a9[_0xa2d8('0x11')][_0xa2d8('0x13')]);return _0x28e54d(_0x38e9a9[_0xa2d8('0x11')][_0xa2d8('0x13')]);}logger['error'](_0xa2d8('0xc'),_0x8c53a7,_0x38e9a9[_0xa2d8('0x11')]['message']);return _0x331051(_0x38e9a9[_0xa2d8('0x11')][_0xa2d8('0x13')]);}else{logger[_0xa2d8('0x14')](_0xa2d8('0xc'),_0x8c53a7,'request\x20sent');_0x331051(_0x38e9a9[_0xa2d8('0x15')][_0xa2d8('0x13')]);}})[_0xa2d8('0x16')](function(_0x5bb23c){logger[_0xa2d8('0x11')](_0xa2d8('0xc'),_0x8c53a7,_0x5bb23c);_0x28e54d(_0x5bb23c);});});}exports['CreateSmsQueueReport']=function(_0x1b9839){var _0x35da6f=this;return new Promise(function(_0x4ad9f8,_0xf21798){return db[_0xa2d8('0x17')][_0xa2d8('0x18')](_0x1b9839['body'],{'raw':_0x1b9839[_0xa2d8('0x19')]?_0x1b9839[_0xa2d8('0x19')][_0xa2d8('0x1a')]===undefined?!![]:![]:!![]})[_0xa2d8('0xb')](function(_0x499ebd){logger[_0xa2d8('0x14')](_0xa2d8('0x1b'),_0x1b9839);logger[_0xa2d8('0xe')](_0xa2d8('0x1b'),_0x1b9839,JSON[_0xa2d8('0x10')](_0x499ebd));_0x4ad9f8(_0x499ebd);})['catch'](function(_0x1befa8){logger[_0xa2d8('0x11')]('CreateSmsQueueReport',_0x1befa8[_0xa2d8('0x13')],_0x1b9839);_0xf21798(_0x35da6f['error'](0x1f4,_0x1befa8[_0xa2d8('0x13')]));});});};exports[_0xa2d8('0x1c')]=function(_0x577df5){var _0x84fa25=this;return new Promise(function(_0xb6f416,_0x475372){return db[_0xa2d8('0x17')]['update'](_0x577df5['body'],{'raw':_0x577df5[_0xa2d8('0x19')]?_0x577df5[_0xa2d8('0x19')][_0xa2d8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x577df5[_0xa2d8('0x19')]?_0x577df5[_0xa2d8('0x19')][_0xa2d8('0x1d')]||null:null,'attributes':_0x577df5[_0xa2d8('0x19')]?_0x577df5[_0xa2d8('0x19')]['attributes']||null:null,'limit':_0x577df5['options']?_0x577df5[_0xa2d8('0x19')][_0xa2d8('0x1e')]||null:null})[_0xa2d8('0xb')](function(_0x406237){logger[_0xa2d8('0x14')](_0xa2d8('0x1c'),_0x577df5);logger[_0xa2d8('0xe')](_0xa2d8('0x1c'),_0x577df5,JSON[_0xa2d8('0x10')](_0x406237));_0xb6f416(_0x406237);})['catch'](function(_0x3b8509){logger[_0xa2d8('0x11')](_0xa2d8('0x1c'),_0x3b8509['message'],_0x577df5);_0x475372(_0x84fa25[_0xa2d8('0x11')](0x1f4,_0x3b8509['message']));});});}; \ No newline at end of file +var _0x11cf=['then','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','where','attributes','limit','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x331161,_0x309438){var _0x1cb001=function(_0x34abd5){while(--_0x34abd5){_0x331161['push'](_0x331161['shift']());}};_0x1cb001(++_0x309438);}(_0x11cf,0x106));var _0xf11c=function(_0x12cc4a,_0x48352f){_0x12cc4a=_0x12cc4a-0x0;var _0x25b563=_0x11cf[_0x12cc4a];return _0x25b563;};'use strict';var _=require(_0xf11c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf11c('0x1'));var db=require(_0xf11c('0x2'))['db'];var utils=require(_0xf11c('0x3'));var logger=require(_0xf11c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf11c('0x5'));var client=jayson[_0xf11c('0x6')][_0xf11c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xff7269,_0x496bad,_0x158d80){return new BPromise(function(_0x43b4f9,_0x43bc2f){return client['request'](_0xff7269,_0x158d80)[_0xf11c('0x8')](function(_0x2ab1fb){logger[_0xf11c('0x9')](_0xf11c('0xa'),_0x496bad,'request\x20sent');logger['debug'](_0xf11c('0xb'),_0x496bad,_0xf11c('0xc'),JSON[_0xf11c('0xd')](_0x2ab1fb));if(_0x2ab1fb[_0xf11c('0xe')]){if(_0x2ab1fb[_0xf11c('0xe')]['code']===0x1f4){logger['error'](_0xf11c('0xa'),_0x496bad,_0x2ab1fb['error'][_0xf11c('0xf')]);return _0x43bc2f(_0x2ab1fb[_0xf11c('0xe')][_0xf11c('0xf')]);}logger[_0xf11c('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x496bad,_0x2ab1fb['error'][_0xf11c('0xf')]);return _0x43b4f9(_0x2ab1fb[_0xf11c('0xe')]['message']);}else{logger[_0xf11c('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x496bad,'request\x20sent');_0x43b4f9(_0x2ab1fb[_0xf11c('0x10')]['message']);}})[_0xf11c('0x11')](function(_0x2126c1){logger[_0xf11c('0xe')](_0xf11c('0xa'),_0x496bad,_0x2126c1);_0x43bc2f(_0x2126c1);});});}exports[_0xf11c('0x12')]=function(_0x1ae705){var _0x4e4d0d=this;return new Promise(function(_0x2dc7f3,_0x448883){return db[_0xf11c('0x13')][_0xf11c('0x14')](_0x1ae705[_0xf11c('0x15')],{'raw':_0x1ae705[_0xf11c('0x16')]?_0x1ae705[_0xf11c('0x16')][_0xf11c('0x17')]===undefined?!![]:![]:!![]})[_0xf11c('0x8')](function(_0x17bf92){logger[_0xf11c('0x9')](_0xf11c('0x12'),_0x1ae705);logger[_0xf11c('0x18')](_0xf11c('0x12'),_0x1ae705,JSON['stringify'](_0x17bf92));_0x2dc7f3(_0x17bf92);})[_0xf11c('0x11')](function(_0x491e49){logger['error'](_0xf11c('0x12'),_0x491e49[_0xf11c('0xf')],_0x1ae705);_0x448883(_0x4e4d0d[_0xf11c('0xe')](0x1f4,_0x491e49[_0xf11c('0xf')]));});});};exports[_0xf11c('0x19')]=function(_0x228c8c){var _0x32295d=this;return new Promise(function(_0x1a0e44,_0x17d281){return db['SmsQueueReport'][_0xf11c('0x1a')](_0x228c8c[_0xf11c('0x15')],{'raw':_0x228c8c[_0xf11c('0x16')]?_0x228c8c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x228c8c[_0xf11c('0x16')]?_0x228c8c[_0xf11c('0x16')][_0xf11c('0x1b')]||null:null,'attributes':_0x228c8c[_0xf11c('0x16')]?_0x228c8c['options'][_0xf11c('0x1c')]||null:null,'limit':_0x228c8c[_0xf11c('0x16')]?_0x228c8c[_0xf11c('0x16')][_0xf11c('0x1d')]||null:null})[_0xf11c('0x8')](function(_0x3c6d08){logger[_0xf11c('0x9')](_0xf11c('0x19'),_0x228c8c);logger[_0xf11c('0x18')]('UpdateSmsQueueReport',_0x228c8c,JSON[_0xf11c('0xd')](_0x3c6d08));_0x1a0e44(_0x3c6d08);})[_0xf11c('0x11')](function(_0x20e928){logger[_0xf11c('0xe')](_0xf11c('0x19'),_0x20e928[_0xf11c('0xf')],_0x228c8c);_0x17d281(_0x32295d[_0xf11c('0xe')](0x1f4,_0x20e928[_0xf11c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ba40ae9..1605359 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 _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index'];(function(_0x54e8c2,_0x28cd6e){var _0x1ffb53=function(_0x76914e){while(--_0x76914e){_0x54e8c2['push'](_0x54e8c2['shift']());}};_0x1ffb53(++_0x28cd6e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x495f3c,_0x592bbe){_0x495f3c=_0x495f3c-0x0;var _0x4b97ee=_0x7fbe[_0x495f3c];return _0x4b97ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0xd58c=['update','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x1956d1,_0x256b7d){var _0x5a0116=function(_0x3c3269){while(--_0x3c3269){_0x1956d1['push'](_0x1956d1['shift']());}};_0x5a0116(++_0x256b7d);}(_0xd58c,0xb6));var _0xcd58=function(_0x1aad50,_0x3fb27f){_0x1aad50=_0x1aad50-0x0;var _0x2db378=_0xd58c[_0x1aad50];return _0x2db378;};'use strict';var multer=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var path=require(_0xcd58('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd58('0x3'));var router=express['Router']();var fs_extra=require(_0xcd58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcd58('0x5'));var config=require(_0xcd58('0x6'));var controller=require(_0xcd58('0x7'));router[_0xcd58('0x8')]('/',auth[_0xcd58('0x9')](),controller['index']);router['get'](_0xcd58('0xa'),auth[_0xcd58('0x9')](),controller[_0xcd58('0xb')]);router[_0xcd58('0x8')](_0xcd58('0xc'),auth['isAuthenticated'](),controller[_0xcd58('0xd')]);router[_0xcd58('0xe')]('/',auth['isAuthenticated'](),controller[_0xcd58('0xf')]);router['put'](_0xcd58('0xc'),auth[_0xcd58('0x9')](),controller[_0xcd58('0x10')]);router['delete'](_0xcd58('0xc'),auth['isAuthenticated'](),controller[_0xcd58('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 6ca475e..53c7f34 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x535b94,_0x52b822){var _0x48bad6=function(_0xc9d302){while(--_0xc9d302){_0x535b94['push'](_0x535b94['shift']());}};_0x48bad6(++_0x52b822);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x41d5e,_0x4d8a7b){var _0x1894bb=function(_0x15b047){while(--_0x15b047){_0x41d5e['push'](_0x41d5e['shift']());}};_0x1894bb(++_0x4d8a7b);}(_0xaa88,0x137));var _0x8aa8=function(_0x962fc5,_0x58f074){_0x962fc5=_0x962fc5-0x0;var _0x43667c=_0xaa88[_0x962fc5];return _0x43667c;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 72ee7e3..61435c7 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 _0xc1d2=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','apply','reject','update','then','destroy','end','sendStatus','error','stack','send','map','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','SmsTransferReport','findAll','catch','includeAll','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x386984,_0x410210){var _0x214fc5=function(_0x5ec8cd){while(--_0x5ec8cd){_0x386984['push'](_0x386984['shift']());}};_0x214fc5(++_0x410210);}(_0xc1d2,0x1e1));var _0x2c1d=function(_0x14abbd,_0x4fc21e){_0x14abbd=_0x14abbd-0x0;var _0x49dd43=_0xc1d2[_0x14abbd];return _0x49dd43;};'use strict';var emlformat=require(_0x2c1d('0x0'));var rimraf=require(_0x2c1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c1d('0x2'));var moment=require(_0x2c1d('0x3'));var BPromise=require(_0x2c1d('0x4'));var Mustache=require(_0x2c1d('0x5'));var util=require('util');var path=require(_0x2c1d('0x6'));var sox=require(_0x2c1d('0x7'));var csv=require(_0x2c1d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c1d('0x9'));var _=require(_0x2c1d('0xa'));var squel=require(_0x2c1d('0xb'));var crypto=require(_0x2c1d('0xc'));var jsforce=require(_0x2c1d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2c1d('0x8'));var querystring=require(_0x2c1d('0xe'));var Papa=require(_0x2c1d('0xf'));var Redis=require(_0x2c1d('0x10'));var authService=require(_0x2c1d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2c1d('0x12'));var hardwareService=require(_0x2c1d('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2c1d('0x14'));var licenseUtil=require(_0x2c1d('0x15'));var db=require(_0x2c1d('0x16'))['db'];function respondWithStatusCode(_0x59b5ab,_0xaa4d58){_0xaa4d58=_0xaa4d58||0xcc;return function(_0x5ec414){if(_0x5ec414){return _0x59b5ab['sendStatus'](_0xaa4d58);}return _0x59b5ab[_0x2c1d('0x17')](_0xaa4d58)['end']();};}function respondWithResult(_0xa77c4e,_0x4ecb45){_0x4ecb45=_0x4ecb45||0xc8;return function(_0x434efa){if(_0x434efa){return _0xa77c4e['status'](_0x4ecb45)[_0x2c1d('0x18')](_0x434efa);}};}function respondWithFilteredResult(_0x4e1778,_0x5efa94){return function(_0x108fa5){if(_0x108fa5){var _0x4d7ed9=typeof _0x5efa94['offset']===_0x2c1d('0x19')&&typeof _0x5efa94[_0x2c1d('0x1a')]===_0x2c1d('0x19');var _0x3827d7=_0x108fa5['count'];var _0x159862=_0x4d7ed9?0x0:_0x5efa94['offset'];var _0x134444=_0x4d7ed9?_0x108fa5[_0x2c1d('0x1b')]:_0x5efa94['offset']+_0x5efa94[_0x2c1d('0x1a')];var _0x1fed6a;if(_0x134444>=_0x3827d7){_0x134444=_0x3827d7;_0x1fed6a=0xc8;}else{_0x1fed6a=0xce;}_0x4e1778[_0x2c1d('0x17')](_0x1fed6a);return _0x4e1778['set']('Content-Range',_0x159862+'-'+_0x134444+'/'+_0x3827d7)[_0x2c1d('0x18')](_0x108fa5);}return null;};}function patchUpdates(_0xad8281){return function(_0x57d9e0){try{jsonpatch[_0x2c1d('0x1c')](_0x57d9e0,_0xad8281,!![]);}catch(_0x571ee8){return BPromise[_0x2c1d('0x1d')](_0x571ee8);}return _0x57d9e0['save']();};}function saveUpdates(_0x3b23fd,_0x3f4902){return function(_0x349c51){if(_0x349c51){return _0x349c51[_0x2c1d('0x1e')](_0x3b23fd)[_0x2c1d('0x1f')](function(_0x1e90b2){return _0x1e90b2;});}return null;};}function removeEntity(_0x4a0313,_0x7b8cd2){return function(_0x34cccf){if(_0x34cccf){return _0x34cccf[_0x2c1d('0x20')]()[_0x2c1d('0x1f')](function(){_0x4a0313['status'](0xcc)[_0x2c1d('0x21')]();});}};}function handleEntityNotFound(_0x14d675,_0x4e4490){return function(_0x2becba){if(!_0x2becba){_0x14d675[_0x2c1d('0x22')](0x194);}return _0x2becba;};}function handleError(_0x513e7e,_0x199ebe){_0x199ebe=_0x199ebe||0x1f4;return function(_0x3c97db){logger[_0x2c1d('0x23')](_0x3c97db[_0x2c1d('0x24')]);if(_0x3c97db['name']){delete _0x3c97db['name'];}_0x513e7e[_0x2c1d('0x17')](_0x199ebe)[_0x2c1d('0x25')](_0x3c97db);};}exports['index']=function(_0x8301f8,_0x14fc2b){var _0x2b4ed5={},_0x569b6c={},_0x48d7bc={'count':0x0,'rows':[]};var _0x4a5780=_[_0x2c1d('0x26')](db['SmsTransferReport'][_0x2c1d('0x27')],function(_0x24d867){return{'name':_0x24d867['fieldName'],'type':_0x24d867[_0x2c1d('0x28')]['key']};});_0x569b6c[_0x2c1d('0x29')]=_[_0x2c1d('0x26')](_0x4a5780,_0x2c1d('0x2a'));_0x569b6c[_0x2c1d('0x2b')]=_[_0x2c1d('0x2c')](_0x8301f8[_0x2c1d('0x2b')]);_0x569b6c[_0x2c1d('0x2d')]=_[_0x2c1d('0x2e')](_0x569b6c[_0x2c1d('0x29')],_0x569b6c[_0x2c1d('0x2b')]);_0x2b4ed5[_0x2c1d('0x2f')]=_[_0x2c1d('0x2e')](_0x569b6c[_0x2c1d('0x29')],qs[_0x2c1d('0x30')](_0x8301f8[_0x2c1d('0x2b')][_0x2c1d('0x30')]));_0x2b4ed5[_0x2c1d('0x2f')]=_0x2b4ed5['attributes'][_0x2c1d('0x31')]?_0x2b4ed5[_0x2c1d('0x2f')]:_0x569b6c[_0x2c1d('0x29')];if(!_0x8301f8['query'][_0x2c1d('0x32')](_0x2c1d('0x33'))){_0x2b4ed5['limit']=qs[_0x2c1d('0x1a')](_0x8301f8[_0x2c1d('0x2b')][_0x2c1d('0x1a')]);_0x2b4ed5['offset']=qs[_0x2c1d('0x34')](_0x8301f8['query'][_0x2c1d('0x34')]);}_0x2b4ed5[_0x2c1d('0x35')]=qs[_0x2c1d('0x36')](_0x8301f8[_0x2c1d('0x2b')][_0x2c1d('0x36')]);_0x2b4ed5[_0x2c1d('0x37')]=qs[_0x2c1d('0x2d')](_[_0x2c1d('0x38')](_0x8301f8[_0x2c1d('0x2b')],_0x569b6c[_0x2c1d('0x2d')]),_0x4a5780);if(_0x8301f8[_0x2c1d('0x2b')][_0x2c1d('0x39')]){_0x2b4ed5['where']=_[_0x2c1d('0x3a')](_0x2b4ed5[_0x2c1d('0x37')],{'$or':_['map'](_0x4a5780,function(_0x344d77){if(_0x344d77[_0x2c1d('0x28')]!==_0x2c1d('0x3b')){var _0x42e3d5={};_0x42e3d5[_0x344d77[_0x2c1d('0x2a')]]={'$like':'%'+_0x8301f8[_0x2c1d('0x2b')][_0x2c1d('0x39')]+'%'};return _0x42e3d5;}})});}_0x2b4ed5=_[_0x2c1d('0x3a')]({},_0x2b4ed5,_0x8301f8[_0x2c1d('0x3c')]);var _0x588334={'where':_0x2b4ed5[_0x2c1d('0x37')]};return db['SmsTransferReport']['count'](_0x588334)[_0x2c1d('0x1f')](function(_0x5e5d14){_0x48d7bc[_0x2c1d('0x1b')]=_0x5e5d14;if(_0x8301f8[_0x2c1d('0x2b')]['includeAll']){_0x2b4ed5[_0x2c1d('0x3d')]=[{'all':!![]}];}return db[_0x2c1d('0x3e')][_0x2c1d('0x3f')](_0x2b4ed5);})['then'](function(_0x2211ed){_0x48d7bc['rows']=_0x2211ed;return _0x48d7bc;})['then'](respondWithFilteredResult(_0x14fc2b,_0x2b4ed5))[_0x2c1d('0x40')](handleError(_0x14fc2b,null));};exports['show']=function(_0x2bec30,_0x1393c0){var _0x9e8385={'raw':!![],'where':{'id':_0x2bec30['params']['id']}},_0xbec2e8={};_0xbec2e8['model']=_[_0x2c1d('0x2c')](db['SmsTransferReport'][_0x2c1d('0x27')]);_0xbec2e8['query']=_['keys'](_0x2bec30[_0x2c1d('0x2b')]);_0xbec2e8[_0x2c1d('0x2d')]=_[_0x2c1d('0x2e')](_0xbec2e8['model'],_0xbec2e8[_0x2c1d('0x2b')]);_0x9e8385[_0x2c1d('0x2f')]=_[_0x2c1d('0x2e')](_0xbec2e8[_0x2c1d('0x29')],qs[_0x2c1d('0x30')](_0x2bec30[_0x2c1d('0x2b')]['fields']));_0x9e8385[_0x2c1d('0x2f')]=_0x9e8385[_0x2c1d('0x2f')][_0x2c1d('0x31')]?_0x9e8385[_0x2c1d('0x2f')]:_0xbec2e8[_0x2c1d('0x29')];if(_0x2bec30['query'][_0x2c1d('0x41')]){_0x9e8385[_0x2c1d('0x3d')]=[{'all':!![]}];}_0x9e8385=_['merge']({},_0x9e8385,_0x2bec30['options']);return db[_0x2c1d('0x3e')][_0x2c1d('0x42')](_0x9e8385)[_0x2c1d('0x1f')](handleEntityNotFound(_0x1393c0,null))['then'](respondWithResult(_0x1393c0,null))[_0x2c1d('0x40')](handleError(_0x1393c0,null));};exports[_0x2c1d('0x43')]=function(_0x589173,_0x49ea15){return db['SmsTransferReport']['create'](_0x589173[_0x2c1d('0x44')],{})[_0x2c1d('0x1f')](respondWithResult(_0x49ea15,0xc9))[_0x2c1d('0x40')](handleError(_0x49ea15,null));};exports['update']=function(_0x3c0790,_0xb4830f){if(_0x3c0790['body']['id']){delete _0x3c0790['body']['id'];}return db[_0x2c1d('0x3e')][_0x2c1d('0x42')]({'where':{'id':_0x3c0790[_0x2c1d('0x45')]['id']}})[_0x2c1d('0x1f')](handleEntityNotFound(_0xb4830f,null))[_0x2c1d('0x1f')](saveUpdates(_0x3c0790[_0x2c1d('0x44')],null))[_0x2c1d('0x1f')](respondWithResult(_0xb4830f,null))[_0x2c1d('0x40')](handleError(_0xb4830f,null));};exports[_0x2c1d('0x20')]=function(_0x5b47f6,_0x4e7f5d){return db['SmsTransferReport'][_0x2c1d('0x42')]({'where':{'id':_0x5b47f6[_0x2c1d('0x45')]['id']}})[_0x2c1d('0x1f')](handleEntityNotFound(_0x4e7f5d,null))[_0x2c1d('0x1f')](removeEntity(_0x4e7f5d,null))[_0x2c1d('0x40')](handleError(_0x4e7f5d,null));};exports[_0x2c1d('0x46')]=function(_0x252e49,_0x372e48){return db['SmsTransferReport'][_0x2c1d('0x46')]()[_0x2c1d('0x1f')](respondWithResult(_0x372e48,null))[_0x2c1d('0x40')](handleError(_0x372e48,null));}; \ No newline at end of file +var _0xc22b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x5668da,_0x29a605){var _0x55e297=function(_0x292e90){while(--_0x292e90){_0x5668da['push'](_0x5668da['shift']());}};_0x55e297(++_0x29a605);}(_0xc22b,0x12d));var _0xbc22=function(_0x5d7f49,_0x5b4580){_0x5d7f49=_0x5d7f49-0x0;var _0x119a7b=_0xc22b[_0x5d7f49];return _0x119a7b;};'use strict';var emlformat=require(_0xbc22('0x0'));var rimraf=require(_0xbc22('0x1'));var zipdir=require(_0xbc22('0x2'));var jsonpatch=require(_0xbc22('0x3'));var rp=require(_0xbc22('0x4'));var moment=require(_0xbc22('0x5'));var BPromise=require(_0xbc22('0x6'));var Mustache=require(_0xbc22('0x7'));var util=require('util');var path=require(_0xbc22('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc22('0x9'));var _=require(_0xbc22('0xa'));var squel=require(_0xbc22('0xb'));var crypto=require(_0xbc22('0xc'));var jsforce=require(_0xbc22('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbc22('0xe'));var querystring=require(_0xbc22('0xf'));var Papa=require(_0xbc22('0x10'));var Redis=require(_0xbc22('0x11'));var authService=require(_0xbc22('0x12'));var qs=require(_0xbc22('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc22('0x14'));var logger=require(_0xbc22('0x15'))(_0xbc22('0x16'));var utils=require(_0xbc22('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbc22('0x18'));var db=require(_0xbc22('0x19'))['db'];function respondWithStatusCode(_0x39d381,_0x34651a){_0x34651a=_0x34651a||0xcc;return function(_0x45891c){if(_0x45891c){return _0x39d381[_0xbc22('0x1a')](_0x34651a);}return _0x39d381['status'](_0x34651a)[_0xbc22('0x1b')]();};}function respondWithResult(_0x2c624b,_0x3d982d){_0x3d982d=_0x3d982d||0xc8;return function(_0x440441){if(_0x440441){return _0x2c624b[_0xbc22('0x1c')](_0x3d982d)['json'](_0x440441);}};}function respondWithFilteredResult(_0xc3a86f,_0x502df0){return function(_0x112586){if(_0x112586){var _0x498e01=typeof _0x502df0[_0xbc22('0x1d')]===_0xbc22('0x1e')&&typeof _0x502df0[_0xbc22('0x1f')]===_0xbc22('0x1e');var _0x516025=_0x112586[_0xbc22('0x20')];var _0x27150a=_0x498e01?0x0:_0x502df0[_0xbc22('0x1d')];var _0x1f3014=_0x498e01?_0x112586['count']:_0x502df0[_0xbc22('0x1d')]+_0x502df0[_0xbc22('0x1f')];var _0x38b47d;if(_0x1f3014>=_0x516025){_0x1f3014=_0x516025;_0x38b47d=0xc8;}else{_0x38b47d=0xce;}_0xc3a86f[_0xbc22('0x1c')](_0x38b47d);return _0xc3a86f[_0xbc22('0x21')](_0xbc22('0x22'),_0x27150a+'-'+_0x1f3014+'/'+_0x516025)[_0xbc22('0x23')](_0x112586);}return null;};}function patchUpdates(_0x345af1){return function(_0x519200){try{jsonpatch[_0xbc22('0x24')](_0x519200,_0x345af1,!![]);}catch(_0x1703db){return BPromise[_0xbc22('0x25')](_0x1703db);}return _0x519200[_0xbc22('0x26')]();};}function saveUpdates(_0x207773,_0x5c0cc2){return function(_0xdcb18e){if(_0xdcb18e){return _0xdcb18e[_0xbc22('0x27')](_0x207773)[_0xbc22('0x28')](function(_0x3c7a43){return _0x3c7a43;});}return null;};}function removeEntity(_0x45280d,_0x42d185){return function(_0x297513){if(_0x297513){return _0x297513[_0xbc22('0x29')]()[_0xbc22('0x28')](function(){_0x45280d[_0xbc22('0x1c')](0xcc)[_0xbc22('0x1b')]();});}};}function handleEntityNotFound(_0x12ac9c,_0x219cd1){return function(_0x514483){if(!_0x514483){_0x12ac9c[_0xbc22('0x1a')](0x194);}return _0x514483;};}function handleError(_0x5ea2b0,_0x598a9a){_0x598a9a=_0x598a9a||0x1f4;return function(_0x389e99){logger[_0xbc22('0x2a')](_0x389e99[_0xbc22('0x2b')]);if(_0x389e99[_0xbc22('0x2c')]){delete _0x389e99['name'];}_0x5ea2b0[_0xbc22('0x1c')](_0x598a9a)[_0xbc22('0x2d')](_0x389e99);};}exports[_0xbc22('0x2e')]=function(_0x1cf627,_0x1ae32c){var _0x4dc11d={},_0x21cf99={},_0x54e742={'count':0x0,'rows':[]};var _0x1abda3=_[_0xbc22('0x2f')](db[_0xbc22('0x30')][_0xbc22('0x31')],function(_0x12a3d9){return{'name':_0x12a3d9[_0xbc22('0x32')],'type':_0x12a3d9[_0xbc22('0x33')]['key']};});_0x21cf99[_0xbc22('0x34')]=_['map'](_0x1abda3,_0xbc22('0x2c'));_0x21cf99[_0xbc22('0x35')]=_['keys'](_0x1cf627['query']);_0x21cf99[_0xbc22('0x36')]=_[_0xbc22('0x37')](_0x21cf99['model'],_0x21cf99[_0xbc22('0x35')]);_0x4dc11d[_0xbc22('0x38')]=_[_0xbc22('0x37')](_0x21cf99['model'],qs[_0xbc22('0x39')](_0x1cf627['query'][_0xbc22('0x39')]));_0x4dc11d[_0xbc22('0x38')]=_0x4dc11d[_0xbc22('0x38')][_0xbc22('0x3a')]?_0x4dc11d[_0xbc22('0x38')]:_0x21cf99['model'];if(!_0x1cf627[_0xbc22('0x35')][_0xbc22('0x3b')]('nolimit')){_0x4dc11d[_0xbc22('0x1f')]=qs[_0xbc22('0x1f')](_0x1cf627[_0xbc22('0x35')]['limit']);_0x4dc11d['offset']=qs[_0xbc22('0x1d')](_0x1cf627['query'][_0xbc22('0x1d')]);}_0x4dc11d[_0xbc22('0x3c')]=qs[_0xbc22('0x3d')](_0x1cf627[_0xbc22('0x35')][_0xbc22('0x3d')]);_0x4dc11d[_0xbc22('0x3e')]=qs[_0xbc22('0x36')](_[_0xbc22('0x3f')](_0x1cf627['query'],_0x21cf99[_0xbc22('0x36')]),_0x1abda3);if(_0x1cf627['query'][_0xbc22('0x40')]){_0x4dc11d[_0xbc22('0x3e')]=_[_0xbc22('0x41')](_0x4dc11d[_0xbc22('0x3e')],{'$or':_[_0xbc22('0x2f')](_0x1abda3,function(_0x3ea570){if(_0x3ea570[_0xbc22('0x33')]!=='VIRTUAL'){var _0x24d498={};_0x24d498[_0x3ea570[_0xbc22('0x2c')]]={'$like':'%'+_0x1cf627[_0xbc22('0x35')][_0xbc22('0x40')]+'%'};return _0x24d498;}})});}_0x4dc11d=_[_0xbc22('0x41')]({},_0x4dc11d,_0x1cf627[_0xbc22('0x42')]);var _0x5bb86a={'where':_0x4dc11d[_0xbc22('0x3e')]};return db['SmsTransferReport']['count'](_0x5bb86a)[_0xbc22('0x28')](function(_0x2104d5){_0x54e742[_0xbc22('0x20')]=_0x2104d5;if(_0x1cf627[_0xbc22('0x35')][_0xbc22('0x43')]){_0x4dc11d[_0xbc22('0x44')]=[{'all':!![]}];}return db[_0xbc22('0x30')][_0xbc22('0x45')](_0x4dc11d);})['then'](function(_0x517d19){_0x54e742[_0xbc22('0x46')]=_0x517d19;return _0x54e742;})['then'](respondWithFilteredResult(_0x1ae32c,_0x4dc11d))[_0xbc22('0x47')](handleError(_0x1ae32c,null));};exports[_0xbc22('0x48')]=function(_0x5e1c84,_0x3b0e80){var _0x1cfd8f={'raw':!![],'where':{'id':_0x5e1c84[_0xbc22('0x49')]['id']}},_0x410532={};_0x410532[_0xbc22('0x34')]=_[_0xbc22('0x4a')](db[_0xbc22('0x30')][_0xbc22('0x31')]);_0x410532['query']=_[_0xbc22('0x4a')](_0x5e1c84[_0xbc22('0x35')]);_0x410532['filters']=_[_0xbc22('0x37')](_0x410532[_0xbc22('0x34')],_0x410532[_0xbc22('0x35')]);_0x1cfd8f[_0xbc22('0x38')]=_[_0xbc22('0x37')](_0x410532[_0xbc22('0x34')],qs[_0xbc22('0x39')](_0x5e1c84[_0xbc22('0x35')][_0xbc22('0x39')]));_0x1cfd8f['attributes']=_0x1cfd8f[_0xbc22('0x38')][_0xbc22('0x3a')]?_0x1cfd8f[_0xbc22('0x38')]:_0x410532[_0xbc22('0x34')];if(_0x5e1c84[_0xbc22('0x35')][_0xbc22('0x43')]){_0x1cfd8f[_0xbc22('0x44')]=[{'all':!![]}];}_0x1cfd8f=_[_0xbc22('0x41')]({},_0x1cfd8f,_0x5e1c84[_0xbc22('0x42')]);return db['SmsTransferReport'][_0xbc22('0x4b')](_0x1cfd8f)[_0xbc22('0x28')](handleEntityNotFound(_0x3b0e80,null))['then'](respondWithResult(_0x3b0e80,null))['catch'](handleError(_0x3b0e80,null));};exports[_0xbc22('0x4c')]=function(_0x19a2a4,_0x1f751e){return db[_0xbc22('0x30')][_0xbc22('0x4c')](_0x19a2a4[_0xbc22('0x4d')],{})[_0xbc22('0x28')](respondWithResult(_0x1f751e,0xc9))[_0xbc22('0x47')](handleError(_0x1f751e,null));};exports['update']=function(_0xa119d5,_0x3599b1){if(_0xa119d5['body']['id']){delete _0xa119d5['body']['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0xa119d5[_0xbc22('0x49')]['id']}})['then'](handleEntityNotFound(_0x3599b1,null))[_0xbc22('0x28')](saveUpdates(_0xa119d5[_0xbc22('0x4d')],null))[_0xbc22('0x28')](respondWithResult(_0x3599b1,null))[_0xbc22('0x47')](handleError(_0x3599b1,null));};exports[_0xbc22('0x29')]=function(_0x407a4b,_0x5e128e){return db[_0xbc22('0x30')][_0xbc22('0x4b')]({'where':{'id':_0x407a4b['params']['id']}})[_0xbc22('0x28')](handleEntityNotFound(_0x5e128e,null))[_0xbc22('0x28')](removeEntity(_0x5e128e,null))['catch'](handleError(_0x5e128e,null));};exports[_0xbc22('0x4e')]=function(_0x5e0476,_0x57a826){return db[_0xbc22('0x30')]['describe']()[_0xbc22('0x28')](respondWithResult(_0x57a826,null))[_0xbc22('0x47')](handleError(_0x57a826,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 9fcd0b3..65daf17 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 _0xa162=['bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','api','moment'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0xa162,0x169));var _0x2a16=function(_0x1b37cd,_0x120336){_0x1b37cd=_0x1b37cd-0x0;var _0x3609f9=_0xa162[_0x1b37cd];return _0x3609f9;};'use strict';var _=require(_0x2a16('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2a16('0x1'));var moment=require(_0x2a16('0x2'));var BPromise=require(_0x2a16('0x3'));var rp=require(_0x2a16('0x4'));var fs=require('fs');var path=require(_0x2a16('0x5'));var rimraf=require(_0x2a16('0x6'));var config=require(_0x2a16('0x7'));var attributes=require(_0x2a16('0x8'));module['exports']=function(_0x2674f6,_0xc66f31){return _0x2674f6[_0x2a16('0x9')](_0x2a16('0xa'),attributes,{'tableName':_0x2a16('0xb'),'paranoid':![],'indexes':[{'name':_0x2a16('0xc'),'fields':[_0x2a16('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc576=['path','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc576,0x1ea));var _0x6c57=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0xc576[_0x25f3e3];return _0xa89b6d;};'use strict';var _=require(_0x6c57('0x0'));var util=require(_0x6c57('0x1'));var logger=require(_0x6c57('0x2'))(_0x6c57('0x3'));var moment=require(_0x6c57('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c57('0x5'));var rimraf=require('rimraf');var config=require(_0x6c57('0x6'));var attributes=require(_0x6c57('0x7'));module['exports']=function(_0xa6e0c4,_0x5e81a6){return _0xa6e0c4[_0x6c57('0x8')](_0x6c57('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x6c57('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 4a7f55b..732522a 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 _0x27bf=['rpc','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x27bf,0x117));var _0xf27b=function(_0x4c2071,_0x10e540){_0x4c2071=_0x4c2071-0x0;var _0x32485d=_0x27bf[_0x4c2071];return _0x32485d;};'use strict';var _=require(_0xf27b('0x0'));var util=require(_0xf27b('0x1'));var moment=require(_0xf27b('0x2'));var BPromise=require(_0xf27b('0x3'));var rs=require(_0xf27b('0x4'));var fs=require('fs');var Redis=require(_0xf27b('0x5'));var db=require(_0xf27b('0x6'))['db'];var utils=require(_0xf27b('0x7'));var logger=require(_0xf27b('0x8'))(_0xf27b('0x9'));var config=require(_0xf27b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf27b('0xb')][_0xf27b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2476ab,_0x32391c,_0x1fdc28){return new BPromise(function(_0x36d178,_0x4df7c0){return client[_0xf27b('0xd')](_0x2476ab,_0x1fdc28)[_0xf27b('0xe')](function(_0x969a6f){logger[_0xf27b('0xf')](_0xf27b('0x10'),_0x32391c,_0xf27b('0x11'));logger[_0xf27b('0x12')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x32391c,'request\x20sent',JSON['stringify'](_0x969a6f));if(_0x969a6f[_0xf27b('0x13')]){if(_0x969a6f['error'][_0xf27b('0x14')]===0x1f4){logger[_0xf27b('0x13')](_0xf27b('0x10'),_0x32391c,_0x969a6f[_0xf27b('0x13')]['message']);return _0x4df7c0(_0x969a6f[_0xf27b('0x13')][_0xf27b('0x15')]);}logger[_0xf27b('0x13')](_0xf27b('0x10'),_0x32391c,_0x969a6f['error'][_0xf27b('0x15')]);return _0x36d178(_0x969a6f[_0xf27b('0x13')]['message']);}else{logger['info'](_0xf27b('0x10'),_0x32391c,'request\x20sent');_0x36d178(_0x969a6f[_0xf27b('0x16')][_0xf27b('0x15')]);}})[_0xf27b('0x17')](function(_0x5305d9){logger[_0xf27b('0x13')](_0xf27b('0x10'),_0x32391c,_0x5305d9);_0x4df7c0(_0x5305d9);});});} \ No newline at end of file +var _0xef39=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x46627d,_0x5e8cae){var _0x126284=function(_0x54ec60){while(--_0x54ec60){_0x46627d['push'](_0x46627d['shift']());}};_0x126284(++_0x5e8cae);}(_0xef39,0x92));var _0x9ef3=function(_0x300f14,_0x150d61){_0x300f14=_0x300f14-0x0;var _0x3682a2=_0xef39[_0x300f14];return _0x3682a2;};'use strict';var _=require('lodash');var util=require(_0x9ef3('0x0'));var moment=require(_0x9ef3('0x1'));var BPromise=require(_0x9ef3('0x2'));var rs=require(_0x9ef3('0x3'));var fs=require('fs');var Redis=require(_0x9ef3('0x4'));var db=require(_0x9ef3('0x5'))['db'];var utils=require(_0x9ef3('0x6'));var logger=require(_0x9ef3('0x7'))(_0x9ef3('0x8'));var config=require(_0x9ef3('0x9'));var jayson=require(_0x9ef3('0xa'));var client=jayson[_0x9ef3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8488,_0x1f7ab7,_0x290ffd){return new BPromise(function(_0x27cfaa,_0x370330){return client[_0x9ef3('0xc')](_0x1b8488,_0x290ffd)[_0x9ef3('0xd')](function(_0x15ae4c){logger[_0x9ef3('0xe')](_0x9ef3('0xf'),_0x1f7ab7,_0x9ef3('0x10'));logger[_0x9ef3('0x11')](_0x9ef3('0x12'),_0x1f7ab7,'request\x20sent',JSON[_0x9ef3('0x13')](_0x15ae4c));if(_0x15ae4c[_0x9ef3('0x14')]){if(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x15')]===0x1f4){logger[_0x9ef3('0x14')](_0x9ef3('0xf'),_0x1f7ab7,_0x15ae4c['error'][_0x9ef3('0x16')]);return _0x370330(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x16')]);}logger['error'](_0x9ef3('0xf'),_0x1f7ab7,_0x15ae4c[_0x9ef3('0x14')]['message']);return _0x27cfaa(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x16')]);}else{logger[_0x9ef3('0xe')](_0x9ef3('0xf'),_0x1f7ab7,_0x9ef3('0x10'));_0x27cfaa(_0x15ae4c[_0x9ef3('0x17')]['message']);}})[_0x9ef3('0x18')](function(_0x355dbb){logger[_0x9ef3('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x1f7ab7,_0x355dbb);_0x370330(_0x355dbb);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 4ac5c28..e158889 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 _0x3c3e=['basename','single','file','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x3c3e,0x18d));var _0xe3c3=function(_0x4243b4,_0x5af212){_0x4243b4=_0x4243b4-0x0;var _0x3c5490=_0x3c3e[_0x4243b4];return _0x3c5490;};'use strict';var multer=require(_0xe3c3('0x0'));var util=require(_0xe3c3('0x1'));var path=require(_0xe3c3('0x2'));var timeout=require('connect-timeout');var express=require(_0xe3c3('0x3'));var router=express[_0xe3c3('0x4')]();var fs_extra=require(_0xe3c3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe3c3('0x6'));var config=require(_0xe3c3('0x7'));var controller=require('./sound.controller');router[_0xe3c3('0x8')]('/',auth[_0xe3c3('0x9')](),controller['index']);router[_0xe3c3('0x8')](_0xe3c3('0xa'),auth[_0xe3c3('0x9')](),controller['show']);router[_0xe3c3('0x8')](_0xe3c3('0xb'),auth['isAuthenticated'](),controller[_0xe3c3('0xc')]);var upload=multer({'storage':multer[_0xe3c3('0xd')]({'destination':function(_0x51f862,_0x40b2be,_0x31953e){_0x31953e(null,path[_0xe3c3('0xe')](config['root'],_0xe3c3('0xf')));},'filename':function(_0x4ea9f8,_0x1dc083,_0x2a80ee){_0x1dc083[_0xe3c3('0x10')]=_0x1dc083[_0xe3c3('0x10')][_0xe3c3('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a80ee(null,util[_0xe3c3('0x12')]('%s-%s%s',path[_0xe3c3('0x13')](_0x1dc083['originalname'],path['extname'](_0x1dc083[_0xe3c3('0x10')])),Date['now'](),path['extname'](_0x1dc083['originalname'])));}})});router['post']('/',upload[_0xe3c3('0x14')](_0xe3c3('0x15')),controller[_0xe3c3('0x16')]);router['put'](_0xe3c3('0xa'),auth[_0xe3c3('0x9')](),controller[_0xe3c3('0x17')]);router[_0xe3c3('0x18')](_0xe3c3('0xa'),auth[_0xe3c3('0x9')](),controller[_0xe3c3('0x18')]);module[_0xe3c3('0x19')]=router; \ No newline at end of file +var _0x318e=['../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','file','update','delete','multer','util','path','express','Router','../../components/auth/service'];(function(_0x565a92,_0x33b98a){var _0x4ec258=function(_0x4c2dd9){while(--_0x4c2dd9){_0x565a92['push'](_0x565a92['shift']());}};_0x4ec258(++_0x33b98a);}(_0x318e,0x108));var _0xe318=function(_0x319927,_0x481f64){_0x319927=_0x319927-0x0;var _0x58be17=_0x318e[_0x319927];return _0x58be17;};'use strict';var multer=require(_0xe318('0x0'));var util=require(_0xe318('0x1'));var path=require(_0xe318('0x2'));var timeout=require('connect-timeout');var express=require(_0xe318('0x3'));var router=express[_0xe318('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe318('0x5'));var interaction=require(_0xe318('0x6'));var config=require(_0xe318('0x7'));var controller=require(_0xe318('0x8'));router[_0xe318('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe318('0x9')](_0xe318('0xa'),auth[_0xe318('0xb')](),controller[_0xe318('0xc')]);router['get'](_0xe318('0xd'),auth[_0xe318('0xb')](),controller[_0xe318('0xe')]);var upload=multer({'storage':multer[_0xe318('0xf')]({'destination':function(_0x3dd119,_0x1727cc,_0xa21ec5){_0xa21ec5(null,path['join'](config['root'],_0xe318('0x10')));},'filename':function(_0x954d26,_0x2a69d2,_0x1d30c4){_0x2a69d2['originalname']=_0x2a69d2[_0xe318('0x11')][_0xe318('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d30c4(null,util[_0xe318('0x13')]('%s-%s%s',path[_0xe318('0x14')](_0x2a69d2['originalname'],path[_0xe318('0x15')](_0x2a69d2[_0xe318('0x11')])),Date[_0xe318('0x16')](),path['extname'](_0x2a69d2['originalname'])));}})});router[_0xe318('0x17')]('/',upload['single'](_0xe318('0x18')),controller['create']);router['put']('/:id',auth[_0xe318('0xb')](),controller[_0xe318('0x19')]);router[_0xe318('0x1a')](_0xe318('0xa'),auth[_0xe318('0xb')](),controller[_0xe318('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 6300977..93f301c 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 _0x02fd=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x4d769e,_0x20fa09){var _0x125b01=function(_0x4b1a2c){while(--_0x4b1a2c){_0x4d769e['push'](_0x4d769e['shift']());}};_0x125b01(++_0x20fa09);}(_0x02fd,0x1b1));var _0xd02f=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x02fd[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require('sequelize');module[_0xd02f('0x0')]={'name':{'type':Sequelize[_0xd02f('0x1')],'unique':_0xd02f('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd02f('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xd02f('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd02f('0x4')]},'original_channelCount':{'type':Sequelize[_0xd02f('0x5')]},'original_bitRate':{'type':Sequelize[_0xd02f('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xd02f('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xd02f('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xd02f('0x5')]}}; \ No newline at end of file +var _0x5b4f=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x4a66e2,_0x4c448d){var _0x5c8237=function(_0x5f5c65){while(--_0x5f5c65){_0x4a66e2['push'](_0x4a66e2['shift']());}};_0x5c8237(++_0x4c448d);}(_0x5b4f,0x145));var _0xf5b4=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x5b4f[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0xf5b4('0x0'));module[_0xf5b4('0x1')]={'name':{'type':Sequelize[_0xf5b4('0x2')],'unique':_0xf5b4('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf5b4('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xf5b4('0x2')]},'original_duration':{'type':Sequelize[_0xf5b4('0x4')]},'original_sampleCount':{'type':Sequelize[_0xf5b4('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xf5b4('0x5')]},'original_sampleRate':{'type':Sequelize[_0xf5b4('0x6')]},'converted_format':{'type':Sequelize[_0xf5b4('0x2')]},'converted_duration':{'type':Sequelize[_0xf5b4('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xf5b4('0x5')]},'converted_channelCount':{'type':Sequelize[_0xf5b4('0x6')]},'converted_bitRate':{'type':Sequelize[_0xf5b4('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xf5b4('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2794ac9..8de7bdd 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 _0xc814=['status','end','undefined','limit','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','keys','attributes','query','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','intersection','find','existsSync','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','download','join','format','save_name','%s.%s','catch','file','extname','originalname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','converted_duration','converted_sampleCount','converted_bitRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x37c10a,_0xaeafa4){var _0x25be15=function(_0x4966fd){while(--_0x4966fd){_0x37c10a['push'](_0x37c10a['shift']());}};_0x25be15(++_0xaeafa4);}(_0xc814,0x1e8));var _0x4c81=function(_0x56f8b8,_0x3e1f25){_0x56f8b8=_0x56f8b8-0x0;var _0x45b035=_0xc814[_0x56f8b8];return _0x45b035;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c81('0x0'));var zipdir=require(_0x4c81('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c81('0x2'));var moment=require(_0x4c81('0x3'));var BPromise=require(_0x4c81('0x4'));var Mustache=require(_0x4c81('0x5'));var util=require('util');var path=require(_0x4c81('0x6'));var sox=require(_0x4c81('0x7'));var csv=require(_0x4c81('0x8'));var ejs=require(_0x4c81('0x9'));var fs=require('fs');var fs_extra=require(_0x4c81('0xa'));var _=require(_0x4c81('0xb'));var squel=require(_0x4c81('0xc'));var crypto=require(_0x4c81('0xd'));var jsforce=require(_0x4c81('0xe'));var deskjs=require(_0x4c81('0xf'));var toCsv=require(_0x4c81('0x8'));var querystring=require(_0x4c81('0x10'));var Papa=require(_0x4c81('0x11'));var Redis=require(_0x4c81('0x12'));var authService=require(_0x4c81('0x13'));var qs=require(_0x4c81('0x14'));var as=require(_0x4c81('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4c81('0x16'));var utils=require(_0x4c81('0x17'));var config=require(_0x4c81('0x18'));var licenseUtil=require(_0x4c81('0x19'));var db=require(_0x4c81('0x1a'))['db'];function respondWithStatusCode(_0x1b129d,_0x23b6fa){_0x23b6fa=_0x23b6fa||0xcc;return function(_0x8c1f76){if(_0x8c1f76){return _0x1b129d[_0x4c81('0x1b')](_0x23b6fa);}return _0x1b129d[_0x4c81('0x1c')](_0x23b6fa)[_0x4c81('0x1d')]();};}function respondWithResult(_0x48cc3f,_0x119456){_0x119456=_0x119456||0xc8;return function(_0x226e5d){if(_0x226e5d){return _0x48cc3f[_0x4c81('0x1c')](_0x119456)['json'](_0x226e5d);}};}function respondWithFilteredResult(_0x9cfcb5,_0x806586){return function(_0x40a618){if(_0x40a618){var _0x4025f8=typeof _0x806586['offset']===_0x4c81('0x1e')&&typeof _0x806586[_0x4c81('0x1f')]===_0x4c81('0x1e');var _0x479403=_0x40a618['count'];var _0x113103=_0x4025f8?0x0:_0x806586[_0x4c81('0x20')];var _0x56e0f8=_0x4025f8?_0x40a618['count']:_0x806586[_0x4c81('0x20')]+_0x806586['limit'];var _0x435e17;if(_0x56e0f8>=_0x479403){_0x56e0f8=_0x479403;_0x435e17=0xc8;}else{_0x435e17=0xce;}_0x9cfcb5[_0x4c81('0x1c')](_0x435e17);return _0x9cfcb5['set'](_0x4c81('0x21'),_0x113103+'-'+_0x56e0f8+'/'+_0x479403)[_0x4c81('0x22')](_0x40a618);}return null;};}function patchUpdates(_0x5159a5){return function(_0x57182f){try{jsonpatch[_0x4c81('0x23')](_0x57182f,_0x5159a5,!![]);}catch(_0x167984){return BPromise[_0x4c81('0x24')](_0x167984);}return _0x57182f[_0x4c81('0x25')]();};}function saveUpdates(_0x3200b0,_0x1ad4af){return function(_0x33c435){if(_0x33c435){return _0x33c435[_0x4c81('0x26')](_0x3200b0)['then'](function(_0x5b0674){return _0x5b0674;});}return null;};}function removeEntity(_0x58dc46,_0x467f9e){return function(_0x3a21f7){if(_0x3a21f7){return _0x3a21f7[_0x4c81('0x27')]()[_0x4c81('0x28')](function(){var _0x203a8c=_0x3a21f7[_0x4c81('0x29')]({'plain':!![]});var _0x461033=_0x4c81('0x2a');return db[_0x4c81('0x2b')][_0x4c81('0x27')]({'where':{'type':_0x461033,'resourceId':_0x203a8c['id']}})[_0x4c81('0x28')](function(){return _0x3a21f7;});})[_0x4c81('0x28')](function(){_0x58dc46[_0x4c81('0x1c')](0xcc)[_0x4c81('0x1d')]();});}};}function handleEntityNotFound(_0x20ba3c,_0x2d6ba1){return function(_0x5579c8){if(!_0x5579c8){_0x20ba3c[_0x4c81('0x1b')](0x194);}return _0x5579c8;};}function handleError(_0x399413,_0x53be8b){_0x53be8b=_0x53be8b||0x1f4;return function(_0x34bfc5){logger['error'](_0x34bfc5['stack']);if(_0x34bfc5[_0x4c81('0x2c')]){delete _0x34bfc5[_0x4c81('0x2c')];}_0x399413[_0x4c81('0x1c')](_0x53be8b)[_0x4c81('0x2d')](_0x34bfc5);};}exports[_0x4c81('0x2e')]=function(_0x4ecf5d,_0x4274c6){var _0x8a2ba6={},_0x4974a7={},_0x369919={'count':0x0,'rows':[]};var _0x1a01b9=_[_0x4c81('0x2f')](db[_0x4c81('0x30')][_0x4c81('0x31')],function(_0x479f22){return{'name':_0x479f22[_0x4c81('0x32')],'type':_0x479f22[_0x4c81('0x33')][_0x4c81('0x34')]};});_0x4974a7[_0x4c81('0x35')]=_[_0x4c81('0x2f')](_0x1a01b9,_0x4c81('0x2c'));_0x4974a7['query']=_[_0x4c81('0x36')](_0x4ecf5d['query']);_0x4974a7['filters']=_['intersection'](_0x4974a7[_0x4c81('0x35')],_0x4974a7['query']);_0x8a2ba6[_0x4c81('0x37')]=_['intersection'](_0x4974a7[_0x4c81('0x35')],qs['fields'](_0x4ecf5d[_0x4c81('0x38')][_0x4c81('0x39')]));_0x8a2ba6[_0x4c81('0x37')]=_0x8a2ba6[_0x4c81('0x37')][_0x4c81('0x3a')]?_0x8a2ba6[_0x4c81('0x37')]:_0x4974a7[_0x4c81('0x35')];if(!_0x4ecf5d[_0x4c81('0x38')]['hasOwnProperty'](_0x4c81('0x3b'))){_0x8a2ba6[_0x4c81('0x1f')]=qs[_0x4c81('0x1f')](_0x4ecf5d['query'][_0x4c81('0x1f')]);_0x8a2ba6['offset']=qs[_0x4c81('0x20')](_0x4ecf5d['query'][_0x4c81('0x20')]);}_0x8a2ba6[_0x4c81('0x3c')]=qs[_0x4c81('0x3d')](_0x4ecf5d[_0x4c81('0x38')][_0x4c81('0x3d')]);_0x8a2ba6[_0x4c81('0x3e')]=qs[_0x4c81('0x3f')](_[_0x4c81('0x40')](_0x4ecf5d[_0x4c81('0x38')],_0x4974a7[_0x4c81('0x3f')]),_0x1a01b9);if(_0x4ecf5d[_0x4c81('0x38')]['filter']){_0x8a2ba6[_0x4c81('0x3e')]=_[_0x4c81('0x41')](_0x8a2ba6[_0x4c81('0x3e')],{'$or':_[_0x4c81('0x2f')](_0x1a01b9,function(_0x465bab){if(_0x465bab['type']!==_0x4c81('0x42')){var _0xdebc38={};_0xdebc38[_0x465bab[_0x4c81('0x2c')]]={'$like':'%'+_0x4ecf5d[_0x4c81('0x38')]['filter']+'%'};return _0xdebc38;}})});}_0x8a2ba6=_[_0x4c81('0x41')]({},_0x8a2ba6,_0x4ecf5d[_0x4c81('0x43')]);var _0x50d006={'where':_0x8a2ba6[_0x4c81('0x3e')]};return db[_0x4c81('0x30')]['count'](_0x50d006)[_0x4c81('0x28')](function(_0x555292){_0x369919[_0x4c81('0x44')]=_0x555292;if(_0x4ecf5d[_0x4c81('0x38')][_0x4c81('0x45')]){_0x8a2ba6[_0x4c81('0x46')]=[{'all':!![]}];}return db[_0x4c81('0x30')][_0x4c81('0x47')](_0x8a2ba6);})[_0x4c81('0x28')](function(_0x1fab27){_0x369919[_0x4c81('0x48')]=_0x1fab27;return _0x369919;})[_0x4c81('0x28')](respondWithFilteredResult(_0x4274c6,_0x8a2ba6))['catch'](handleError(_0x4274c6,null));};exports[_0x4c81('0x49')]=function(_0xae6204,_0x2b3a6d){var _0x1da976={'raw':!![],'where':{'id':_0xae6204[_0x4c81('0x4a')]['id']}},_0x50f14b={};_0x50f14b['model']=_['keys'](db[_0x4c81('0x30')][_0x4c81('0x31')]);_0x50f14b[_0x4c81('0x38')]=_['keys'](_0xae6204[_0x4c81('0x38')]);_0x50f14b['filters']=_[_0x4c81('0x4b')](_0x50f14b[_0x4c81('0x35')],_0x50f14b[_0x4c81('0x38')]);_0x1da976['attributes']=_['intersection'](_0x50f14b['model'],qs[_0x4c81('0x39')](_0xae6204[_0x4c81('0x38')][_0x4c81('0x39')]));_0x1da976['attributes']=_0x1da976[_0x4c81('0x37')]['length']?_0x1da976['attributes']:_0x50f14b[_0x4c81('0x35')];if(_0xae6204[_0x4c81('0x38')]['includeAll']){_0x1da976[_0x4c81('0x46')]=[{'all':!![]}];}_0x1da976=_[_0x4c81('0x41')]({},_0x1da976,_0xae6204[_0x4c81('0x43')]);return db[_0x4c81('0x30')][_0x4c81('0x4c')](_0x1da976)['then'](handleEntityNotFound(_0x2b3a6d,null))['then'](respondWithResult(_0x2b3a6d,null))['catch'](handleError(_0x2b3a6d,null));};exports['download']=function(_0x32bb39,_0x27ff62,_0x180ee0){return db[_0x4c81('0x30')][_0x4c81('0x4c')]({'where':{'id':_0x32bb39[_0x4c81('0x4a')]['id']},'attributes':[_0x4c81('0x2c'),'save_name','converted_format'],'raw':!![]})[_0x4c81('0x28')](handleEntityNotFound(_0x27ff62,null))[_0x4c81('0x28')](function(_0x157cd8){if(_0x157cd8){if(!fs[_0x4c81('0x4d')](path['join'](config[_0x4c81('0x4e')],_0x4c81('0x4f'),_0x157cd8['save_name']+'.'+_0x157cd8[_0x4c81('0x50')]))){throw new db[(_0x4c81('0x51'))]['ValidationError'](_0x4c81('0x52'));}return _0x27ff62[_0x4c81('0x53')](path[_0x4c81('0x54')](config[_0x4c81('0x4e')],'server/files/sounds/converted',util[_0x4c81('0x55')]('%s.%s',_0x157cd8[_0x4c81('0x56')],_0x157cd8['converted_format'])),util[_0x4c81('0x55')](_0x4c81('0x57'),_0x157cd8['name'],_0x157cd8[_0x4c81('0x50')]));}return null;})[_0x4c81('0x58')](handleError(_0x27ff62,null));};exports['create']=function(_0x409b23,_0x222803,_0x371a49){var _0x6780d8={'name':path['basename'](_0x409b23[_0x4c81('0x59')]['originalname'],path[_0x4c81('0x5a')](_0x409b23[_0x4c81('0x59')][_0x4c81('0x5b')])),'save_name':path[_0x4c81('0x5c')](_0x409b23[_0x4c81('0x59')][_0x4c81('0x5d')],path['extname'](_0x409b23[_0x4c81('0x59')][_0x4c81('0x5d')])),'original_format':path[_0x4c81('0x5a')](_0x409b23[_0x4c81('0x59')]['originalname'])[_0x4c81('0x5e')](0x1),'converted_format':_0x4c81('0x5f')};var _0x4c9284=path[_0x4c81('0x54')](config[_0x4c81('0x4e')],_0x4c81('0x60'),_0x409b23[_0x4c81('0x59')][_0x4c81('0x5d')]);var _0x5765dd=path[_0x4c81('0x54')](config[_0x4c81('0x4e')],_0x4c81('0x4f'),util['format'](_0x4c81('0x57'),path[_0x4c81('0x5c')](_0x409b23[_0x4c81('0x59')]['filename'],path['extname'](_0x409b23[_0x4c81('0x59')]['filename'])),_0x6780d8[_0x4c81('0x50')]));logger[_0x4c81('0x61')](_0x4c81('0x62'),_0x4c9284);logger['info'](_0x4c81('0x63'),_0x5765dd);try{fs[_0x4c81('0x64')](_0x4c9284,parseInt(_0x4c81('0x65'),0x8));var _0x1ff7a5=sox[_0x4c81('0x66')](_0x4c9284,_0x5765dd,{'sampleRate':0x1f40,'format':_0x4c81('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ff7a5['on']('error',function(_0x3afc15){fs[_0x4c81('0x67')](_0x4c9284);_0x222803['status'](0x1f4)[_0x4c81('0x2d')](_0x3afc15);});_0x1ff7a5['on'](_0x4c81('0x68'),function(_0x28039a){_0x6780d8[_0x4c81('0x69')]=isNaN(_0x28039a[_0x4c81('0x6a')])?null:_0x28039a[_0x4c81('0x6a')]*0x3e8;_0x6780d8[_0x4c81('0x6b')]=isNaN(_0x28039a[_0x4c81('0x6c')])?null:_0x28039a[_0x4c81('0x6c')];_0x6780d8[_0x4c81('0x6d')]=isNaN(_0x28039a[_0x4c81('0x6e')])?null:_0x28039a[_0x4c81('0x6e')];_0x6780d8[_0x4c81('0x6f')]=isNaN(_0x28039a[_0x4c81('0x70')])?null:_0x28039a['bitRate'];_0x6780d8[_0x4c81('0x71')]=isNaN(_0x28039a['sampleRate'])?null:_0x28039a['sampleRate'];});_0x1ff7a5['on']('dest',function(_0xeccf4a){_0x6780d8[_0x4c81('0x72')]=isNaN(_0xeccf4a[_0x4c81('0x6a')])?null:_0xeccf4a[_0x4c81('0x6a')]*0x3e8;_0x6780d8[_0x4c81('0x73')]=isNaN(_0xeccf4a[_0x4c81('0x6c')])?null:_0xeccf4a[_0x4c81('0x6c')];_0x6780d8['converted_channelCount']=isNaN(_0xeccf4a[_0x4c81('0x6e')])?null:_0xeccf4a['channelCount'];_0x6780d8[_0x4c81('0x74')]=isNaN(_0xeccf4a[_0x4c81('0x70')])?null:_0xeccf4a[_0x4c81('0x70')];_0x6780d8['converted_sampleRate']=isNaN(_0xeccf4a['sampleRate'])?null:_0xeccf4a['sampleRate'];});_0x1ff7a5['on']('end',function(){fs[_0x4c81('0x64')](_0x5765dd,parseInt('0777',0x8));return db['Sound'][_0x4c81('0x75')](_0x6780d8)[_0x4c81('0x28')](function(_0x48c21b){var _0x427439={'role':_0x409b23[_0x4c81('0x76')][_0x4c81('0x77')],'userProfileId':_0x409b23[_0x4c81('0x76')][_0x4c81('0x78')]};if(!_0x427439)throw new Error(_0x4c81('0x79'));if(_0x427439[_0x4c81('0x77')]===_0x4c81('0x7a')){var _0x804227=_0x48c21b[_0x4c81('0x29')]({'plain':!![]});return db[_0x4c81('0x7b')][_0x4c81('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x427439['userProfileId']},'raw':!![]})[_0x4c81('0x28')](function(_0x1818b3){if(_0x1818b3&&_0x1818b3[_0x4c81('0x7c')]===0x0){return db['UserProfileResource']['create']({'name':_0x804227['name'],'resourceId':_0x804227['id'],'type':_0x1818b3[_0x4c81('0x2c')],'sectionId':_0x1818b3['id']},{})['then'](function(){return _0x48c21b;});}else{return _0x48c21b;}})[_0x4c81('0x58')](function(_0x329899){logger[_0x4c81('0x7d')](_0x4c81('0x7e'),_0x329899);throw _0x329899;});}return _0x48c21b;})[_0x4c81('0x28')](respondWithResult(_0x222803,null))[_0x4c81('0x58')](handleError(_0x222803,null));});_0x1ff7a5['start']();}catch(_0x1d7d87){_0x222803[_0x4c81('0x1c')](0x1f4)[_0x4c81('0x2d')](_0x1d7d87);}};exports['update']=function(_0x123b30,_0x54ccef,_0x6dc957){return db[_0x4c81('0x30')][_0x4c81('0x4c')]({'where':{'id':_0x123b30[_0x4c81('0x4a')]['id']}})[_0x4c81('0x28')](handleEntityNotFound(_0x54ccef,null))[_0x4c81('0x28')](saveUpdates(_[_0x4c81('0x40')](_0x123b30[_0x4c81('0x76')],[_0x4c81('0x2c'),'description']),null))[_0x4c81('0x28')](respondWithResult(_0x54ccef,null))['catch'](handleError(_0x54ccef,null));};exports[_0x4c81('0x7f')]=function(_0xfd5dc2,_0x509237,_0x2337ed){return db[_0x4c81('0x30')][_0x4c81('0x4c')]({'where':{'id':_0xfd5dc2['params']['id']}})[_0x4c81('0x28')](function(_0xfcc29c){if(_0xfcc29c){return _0xfcc29c[_0x4c81('0x27')]();}})['then'](function(_0x46eea5){var _0x1b250f=path[_0x4c81('0x54')](config[_0x4c81('0x4e')],_0x4c81('0x60'),util[_0x4c81('0x55')](_0x4c81('0x57'),_0x46eea5[_0x4c81('0x56')],_0x46eea5[_0x4c81('0x80')]));var _0x17c541=path['join'](config[_0x4c81('0x4e')],_0x4c81('0x4f'),util[_0x4c81('0x55')](_0x4c81('0x57'),_0x46eea5['save_name'],_0x46eea5[_0x4c81('0x50')]));fs[_0x4c81('0x67')](_0x1b250f);fs[_0x4c81('0x67')](_0x17c541);return _0x46eea5;})[_0x4c81('0x28')](function(_0x40ad15){if(_0x40ad15){return _0x509237['status'](0xcc)[_0x4c81('0x1d')]();}})[_0x4c81('0x28')](handleEntityNotFound(_0x509237,null))['catch'](handleError(_0x509237,null));}; \ No newline at end of file +var _0xe370=['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','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','then','get','destroy','error','stack','name','send','map','Sound','type','key','model','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','intersection','length','include','find','params','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','create','basename','file','originalname','extname','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_bitRate','converted_sampleRate','0777','body','userProfileId','role','UserProfileSection','Sounds','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xe370,0x6e));var _0x0e37=function(_0x29d1ba,_0x7a5223){_0x29d1ba=_0x29d1ba-0x0;var _0x3de575=_0xe370[_0x29d1ba];return _0x3de575;};'use strict';var emlformat=require(_0x0e37('0x0'));var rimraf=require(_0x0e37('0x1'));var zipdir=require(_0x0e37('0x2'));var jsonpatch=require(_0x0e37('0x3'));var rp=require(_0x0e37('0x4'));var moment=require(_0x0e37('0x5'));var BPromise=require(_0x0e37('0x6'));var Mustache=require(_0x0e37('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0e37('0x8'));var csv=require(_0x0e37('0x9'));var ejs=require(_0x0e37('0xa'));var fs=require('fs');var fs_extra=require(_0x0e37('0xb'));var _=require(_0x0e37('0xc'));var squel=require(_0x0e37('0xd'));var crypto=require(_0x0e37('0xe'));var jsforce=require(_0x0e37('0xf'));var deskjs=require(_0x0e37('0x10'));var toCsv=require(_0x0e37('0x9'));var querystring=require(_0x0e37('0x11'));var Papa=require(_0x0e37('0x12'));var Redis=require('ioredis');var authService=require(_0x0e37('0x13'));var qs=require(_0x0e37('0x14'));var as=require(_0x0e37('0x15'));var hardwareService=require(_0x0e37('0x16'));var logger=require(_0x0e37('0x17'))(_0x0e37('0x18'));var utils=require(_0x0e37('0x19'));var config=require(_0x0e37('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475270,_0x2bb6b8){_0x2bb6b8=_0x2bb6b8||0xcc;return function(_0x6bc7fe){if(_0x6bc7fe){return _0x475270[_0x0e37('0x1b')](_0x2bb6b8);}return _0x475270[_0x0e37('0x1c')](_0x2bb6b8)[_0x0e37('0x1d')]();};}function respondWithResult(_0x19619d,_0x45f825){_0x45f825=_0x45f825||0xc8;return function(_0x153985){if(_0x153985){return _0x19619d[_0x0e37('0x1c')](_0x45f825)['json'](_0x153985);}};}function respondWithFilteredResult(_0x37c462,_0x562184){return function(_0x14eb20){if(_0x14eb20){var _0x36b09d=typeof _0x562184[_0x0e37('0x1e')]===_0x0e37('0x1f')&&typeof _0x562184[_0x0e37('0x20')]==='undefined';var _0x1b3c03=_0x14eb20['count'];var _0x130c95=_0x36b09d?0x0:_0x562184[_0x0e37('0x1e')];var _0x2e282f=_0x36b09d?_0x14eb20[_0x0e37('0x21')]:_0x562184['offset']+_0x562184[_0x0e37('0x20')];var _0x341438;if(_0x2e282f>=_0x1b3c03){_0x2e282f=_0x1b3c03;_0x341438=0xc8;}else{_0x341438=0xce;}_0x37c462[_0x0e37('0x1c')](_0x341438);return _0x37c462[_0x0e37('0x22')]('Content-Range',_0x130c95+'-'+_0x2e282f+'/'+_0x1b3c03)['json'](_0x14eb20);}return null;};}function patchUpdates(_0x363a1e){return function(_0x587ecb){try{jsonpatch['apply'](_0x587ecb,_0x363a1e,!![]);}catch(_0xd149c2){return BPromise[_0x0e37('0x23')](_0xd149c2);}return _0x587ecb[_0x0e37('0x24')]();};}function saveUpdates(_0x1b8f0d,_0xe5c5a9){return function(_0x3c6958){if(_0x3c6958){return _0x3c6958[_0x0e37('0x25')](_0x1b8f0d)[_0x0e37('0x26')](function(_0x4f11d8){return _0x4f11d8;});}return null;};}function removeEntity(_0x4abe00,_0xd19282){return function(_0xfaeac9){if(_0xfaeac9){return _0xfaeac9['destroy']()['then'](function(){var _0x417c0d=_0xfaeac9[_0x0e37('0x27')]({'plain':!![]});var _0x40500a='Sounds';return db['UserProfileResource'][_0x0e37('0x28')]({'where':{'type':_0x40500a,'resourceId':_0x417c0d['id']}})[_0x0e37('0x26')](function(){return _0xfaeac9;});})[_0x0e37('0x26')](function(){_0x4abe00[_0x0e37('0x1c')](0xcc)[_0x0e37('0x1d')]();});}};}function handleEntityNotFound(_0x48af39,_0x40e45b){return function(_0x4a71e4){if(!_0x4a71e4){_0x48af39[_0x0e37('0x1b')](0x194);}return _0x4a71e4;};}function handleError(_0x2d7b7f,_0x8668c4){_0x8668c4=_0x8668c4||0x1f4;return function(_0x4b1e6c){logger[_0x0e37('0x29')](_0x4b1e6c[_0x0e37('0x2a')]);if(_0x4b1e6c['name']){delete _0x4b1e6c[_0x0e37('0x2b')];}_0x2d7b7f['status'](_0x8668c4)[_0x0e37('0x2c')](_0x4b1e6c);};}exports['index']=function(_0x50b9ec,_0x54b43c){var _0x3e182f={},_0x2d9225={},_0x1ce8dc={'count':0x0,'rows':[]};var _0xa860c2=_[_0x0e37('0x2d')](db[_0x0e37('0x2e')]['rawAttributes'],function(_0xe6ea00){return{'name':_0xe6ea00['fieldName'],'type':_0xe6ea00[_0x0e37('0x2f')][_0x0e37('0x30')]};});_0x2d9225[_0x0e37('0x31')]=_[_0x0e37('0x2d')](_0xa860c2,'name');_0x2d9225['query']=_[_0x0e37('0x32')](_0x50b9ec[_0x0e37('0x33')]);_0x2d9225[_0x0e37('0x34')]=_['intersection'](_0x2d9225['model'],_0x2d9225[_0x0e37('0x33')]);_0x3e182f['attributes']=_['intersection'](_0x2d9225['model'],qs['fields'](_0x50b9ec[_0x0e37('0x33')][_0x0e37('0x35')]));_0x3e182f['attributes']=_0x3e182f['attributes']['length']?_0x3e182f[_0x0e37('0x36')]:_0x2d9225[_0x0e37('0x31')];if(!_0x50b9ec[_0x0e37('0x33')][_0x0e37('0x37')](_0x0e37('0x38'))){_0x3e182f[_0x0e37('0x20')]=qs[_0x0e37('0x20')](_0x50b9ec[_0x0e37('0x33')][_0x0e37('0x20')]);_0x3e182f[_0x0e37('0x1e')]=qs[_0x0e37('0x1e')](_0x50b9ec[_0x0e37('0x33')]['offset']);}_0x3e182f['order']=qs[_0x0e37('0x39')](_0x50b9ec['query'][_0x0e37('0x39')]);_0x3e182f['where']=qs[_0x0e37('0x34')](_[_0x0e37('0x3a')](_0x50b9ec[_0x0e37('0x33')],_0x2d9225['filters']),_0xa860c2);if(_0x50b9ec[_0x0e37('0x33')][_0x0e37('0x3b')]){_0x3e182f[_0x0e37('0x3c')]=_[_0x0e37('0x3d')](_0x3e182f[_0x0e37('0x3c')],{'$or':_[_0x0e37('0x2d')](_0xa860c2,function(_0x2dbb94){if(_0x2dbb94[_0x0e37('0x2f')]!==_0x0e37('0x3e')){var _0x23b1ad={};_0x23b1ad[_0x2dbb94[_0x0e37('0x2b')]]={'$like':'%'+_0x50b9ec[_0x0e37('0x33')][_0x0e37('0x3b')]+'%'};return _0x23b1ad;}})});}_0x3e182f=_[_0x0e37('0x3d')]({},_0x3e182f,_0x50b9ec[_0x0e37('0x3f')]);var _0x350c31={'where':_0x3e182f[_0x0e37('0x3c')]};return db[_0x0e37('0x2e')][_0x0e37('0x21')](_0x350c31)[_0x0e37('0x26')](function(_0x489075){_0x1ce8dc[_0x0e37('0x21')]=_0x489075;if(_0x50b9ec[_0x0e37('0x33')][_0x0e37('0x40')]){_0x3e182f['include']=[{'all':!![]}];}return db[_0x0e37('0x2e')][_0x0e37('0x41')](_0x3e182f);})['then'](function(_0x427b13){_0x1ce8dc['rows']=_0x427b13;return _0x1ce8dc;})[_0x0e37('0x26')](respondWithFilteredResult(_0x54b43c,_0x3e182f))[_0x0e37('0x42')](handleError(_0x54b43c,null));};exports[_0x0e37('0x43')]=function(_0x38f180,_0x2a06f9){var _0x24e4a7={'raw':!![],'where':{'id':_0x38f180['params']['id']}},_0x3660f4={};_0x3660f4[_0x0e37('0x31')]=_['keys'](db['Sound']['rawAttributes']);_0x3660f4[_0x0e37('0x33')]=_[_0x0e37('0x32')](_0x38f180[_0x0e37('0x33')]);_0x3660f4['filters']=_[_0x0e37('0x44')](_0x3660f4[_0x0e37('0x31')],_0x3660f4[_0x0e37('0x33')]);_0x24e4a7[_0x0e37('0x36')]=_[_0x0e37('0x44')](_0x3660f4[_0x0e37('0x31')],qs[_0x0e37('0x35')](_0x38f180[_0x0e37('0x33')][_0x0e37('0x35')]));_0x24e4a7[_0x0e37('0x36')]=_0x24e4a7[_0x0e37('0x36')][_0x0e37('0x45')]?_0x24e4a7[_0x0e37('0x36')]:_0x3660f4['model'];if(_0x38f180[_0x0e37('0x33')][_0x0e37('0x40')]){_0x24e4a7[_0x0e37('0x46')]=[{'all':!![]}];}_0x24e4a7=_[_0x0e37('0x3d')]({},_0x24e4a7,_0x38f180[_0x0e37('0x3f')]);return db[_0x0e37('0x2e')]['find'](_0x24e4a7)[_0x0e37('0x26')](handleEntityNotFound(_0x2a06f9,null))[_0x0e37('0x26')](respondWithResult(_0x2a06f9,null))[_0x0e37('0x42')](handleError(_0x2a06f9,null));};exports['download']=function(_0x44db26,_0xec8ed0,_0x535cee){return db[_0x0e37('0x2e')][_0x0e37('0x47')]({'where':{'id':_0x44db26[_0x0e37('0x48')]['id']},'attributes':[_0x0e37('0x2b'),'save_name',_0x0e37('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0xec8ed0,null))[_0x0e37('0x26')](function(_0x314db7){if(_0x314db7){if(!fs[_0x0e37('0x4a')](path[_0x0e37('0x4b')](config['root'],_0x0e37('0x4c'),_0x314db7[_0x0e37('0x4d')]+'.'+_0x314db7['converted_format']))){throw new db[(_0x0e37('0x4e'))][(_0x0e37('0x4f'))](_0x0e37('0x50'));}return _0xec8ed0[_0x0e37('0x51')](path[_0x0e37('0x4b')](config[_0x0e37('0x52')],_0x0e37('0x4c'),util[_0x0e37('0x53')](_0x0e37('0x54'),_0x314db7[_0x0e37('0x4d')],_0x314db7['converted_format'])),util[_0x0e37('0x53')]('%s.%s',_0x314db7[_0x0e37('0x2b')],_0x314db7[_0x0e37('0x49')]));}return null;})['catch'](handleError(_0xec8ed0,null));};exports[_0x0e37('0x55')]=function(_0xca6c77,_0x57d7f7,_0xd25e04){var _0x2e5877={'name':path[_0x0e37('0x56')](_0xca6c77[_0x0e37('0x57')][_0x0e37('0x58')],path['extname'](_0xca6c77[_0x0e37('0x57')][_0x0e37('0x58')])),'save_name':path[_0x0e37('0x56')](_0xca6c77[_0x0e37('0x57')]['filename'],path['extname'](_0xca6c77[_0x0e37('0x57')]['filename'])),'original_format':path[_0x0e37('0x59')](_0xca6c77[_0x0e37('0x57')][_0x0e37('0x58')])['substring'](0x1),'converted_format':_0x0e37('0x5a')};var _0x42c36a=path[_0x0e37('0x4b')](config[_0x0e37('0x52')],_0x0e37('0x5b'),_0xca6c77[_0x0e37('0x57')]['filename']);var _0x4833b9=path[_0x0e37('0x4b')](config[_0x0e37('0x52')],_0x0e37('0x4c'),util[_0x0e37('0x53')](_0x0e37('0x54'),path['basename'](_0xca6c77['file'][_0x0e37('0x5c')],path[_0x0e37('0x59')](_0xca6c77['file'][_0x0e37('0x5c')])),_0x2e5877[_0x0e37('0x49')]));logger[_0x0e37('0x5d')](_0x0e37('0x5e'),_0x42c36a);logger[_0x0e37('0x5d')](_0x0e37('0x5f'),_0x4833b9);try{fs[_0x0e37('0x60')](_0x42c36a,parseInt('0777',0x8));var _0x3cda14=sox[_0x0e37('0x61')](_0x42c36a,_0x4833b9,{'sampleRate':0x1f40,'format':_0x0e37('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3cda14['on']('error',function(_0x79fcd2){fs[_0x0e37('0x62')](_0x42c36a);_0x57d7f7[_0x0e37('0x1c')](0x1f4)['send'](_0x79fcd2);});_0x3cda14['on'](_0x0e37('0x63'),function(_0x46530c){_0x2e5877['original_duration']=isNaN(_0x46530c[_0x0e37('0x64')])?null:_0x46530c[_0x0e37('0x64')]*0x3e8;_0x2e5877[_0x0e37('0x65')]=isNaN(_0x46530c[_0x0e37('0x66')])?null:_0x46530c[_0x0e37('0x66')];_0x2e5877[_0x0e37('0x67')]=isNaN(_0x46530c[_0x0e37('0x68')])?null:_0x46530c[_0x0e37('0x68')];_0x2e5877[_0x0e37('0x69')]=isNaN(_0x46530c[_0x0e37('0x6a')])?null:_0x46530c[_0x0e37('0x6a')];_0x2e5877[_0x0e37('0x6b')]=isNaN(_0x46530c[_0x0e37('0x6c')])?null:_0x46530c[_0x0e37('0x6c')];});_0x3cda14['on']('dest',function(_0x132b21){_0x2e5877['converted_duration']=isNaN(_0x132b21[_0x0e37('0x64')])?null:_0x132b21['duration']*0x3e8;_0x2e5877[_0x0e37('0x6d')]=isNaN(_0x132b21[_0x0e37('0x66')])?null:_0x132b21[_0x0e37('0x66')];_0x2e5877['converted_channelCount']=isNaN(_0x132b21['channelCount'])?null:_0x132b21[_0x0e37('0x68')];_0x2e5877[_0x0e37('0x6e')]=isNaN(_0x132b21[_0x0e37('0x6a')])?null:_0x132b21[_0x0e37('0x6a')];_0x2e5877[_0x0e37('0x6f')]=isNaN(_0x132b21[_0x0e37('0x6c')])?null:_0x132b21[_0x0e37('0x6c')];});_0x3cda14['on']('end',function(){fs[_0x0e37('0x60')](_0x4833b9,parseInt(_0x0e37('0x70'),0x8));return db['Sound'][_0x0e37('0x55')](_0x2e5877)[_0x0e37('0x26')](function(_0x54508d){var _0x581a40={'role':_0xca6c77[_0x0e37('0x71')]['role'],'userProfileId':_0xca6c77['body'][_0x0e37('0x72')]};if(!_0x581a40)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x581a40[_0x0e37('0x73')]==='user'){var _0x2b851e=_0x54508d[_0x0e37('0x27')]({'plain':!![]});return db[_0x0e37('0x74')]['find']({'where':{'name':_0x0e37('0x75'),'userProfileId':_0x581a40[_0x0e37('0x72')]},'raw':!![]})['then'](function(_0x30be5c){if(_0x30be5c&&_0x30be5c[_0x0e37('0x76')]===0x0){return db[_0x0e37('0x77')]['create']({'name':_0x2b851e['name'],'resourceId':_0x2b851e['id'],'type':_0x30be5c['name'],'sectionId':_0x30be5c['id']},{})[_0x0e37('0x26')](function(){return _0x54508d;});}else{return _0x54508d;}})['catch'](function(_0x4c85c9){logger[_0x0e37('0x29')](_0x0e37('0x78'),_0x4c85c9);throw _0x4c85c9;});}return _0x54508d;})[_0x0e37('0x26')](respondWithResult(_0x57d7f7,null))[_0x0e37('0x42')](handleError(_0x57d7f7,null));});_0x3cda14[_0x0e37('0x79')]();}catch(_0x458173){_0x57d7f7[_0x0e37('0x1c')](0x1f4)[_0x0e37('0x2c')](_0x458173);}};exports[_0x0e37('0x25')]=function(_0x42978,_0x5624d8,_0x3761fa){return db[_0x0e37('0x2e')][_0x0e37('0x47')]({'where':{'id':_0x42978['params']['id']}})['then'](handleEntityNotFound(_0x5624d8,null))['then'](saveUpdates(_[_0x0e37('0x3a')](_0x42978[_0x0e37('0x71')],[_0x0e37('0x2b'),'description']),null))[_0x0e37('0x26')](respondWithResult(_0x5624d8,null))[_0x0e37('0x42')](handleError(_0x5624d8,null));};exports[_0x0e37('0x7a')]=function(_0x51895b,_0x39a4f5,_0x2a2a7c){return db[_0x0e37('0x2e')][_0x0e37('0x47')]({'where':{'id':_0x51895b[_0x0e37('0x48')]['id']}})[_0x0e37('0x26')](function(_0x403e90){if(_0x403e90){return _0x403e90[_0x0e37('0x28')]();}})[_0x0e37('0x26')](function(_0x212c4d){var _0x16ab36=path[_0x0e37('0x4b')](config[_0x0e37('0x52')],_0x0e37('0x5b'),util['format']('%s.%s',_0x212c4d[_0x0e37('0x4d')],_0x212c4d[_0x0e37('0x7b')]));var _0x356e76=path[_0x0e37('0x4b')](config[_0x0e37('0x52')],_0x0e37('0x4c'),util[_0x0e37('0x53')]('%s.%s',_0x212c4d[_0x0e37('0x4d')],_0x212c4d['converted_format']));fs[_0x0e37('0x62')](_0x16ab36);fs['unlinkSync'](_0x356e76);return _0x212c4d;})[_0x0e37('0x26')](function(_0x4d042f){if(_0x4d042f){return _0x39a4f5[_0x0e37('0x1c')](0xcc)[_0x0e37('0x1d')]();}})[_0x0e37('0x26')](handleEntityNotFound(_0x39a4f5,null))['catch'](handleError(_0x39a4f5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 782c9c8..6efc645 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 _0x24c1=['moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','../../config/logger'];(function(_0x2d61d9,_0x14b8fb){var _0x9647f9=function(_0x3fa584){while(--_0x3fa584){_0x2d61d9['push'](_0x2d61d9['shift']());}};_0x9647f9(++_0x14b8fb);}(_0x24c1,0x78));var _0x124c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x24c1[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x124c('0x0'))('api');var moment=require(_0x124c('0x1'));var BPromise=require('bluebird');var rp=require(_0x124c('0x2'));var fs=require('fs');var path=require(_0x124c('0x3'));var rimraf=require(_0x124c('0x4'));var config=require(_0x124c('0x5'));var attributes=require(_0x124c('0x6'));module[_0x124c('0x7')]=function(_0x4c4cbb,_0x3a8098){return _0x4c4cbb[_0x124c('0x8')](_0x124c('0x9'),attributes,{'tableName':_0x124c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc298=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds'];(function(_0x38617,_0x363518){var _0x14f6cf=function(_0x46d695){while(--_0x46d695){_0x38617['push'](_0x38617['shift']());}};_0x14f6cf(++_0x363518);}(_0xc298,0x138));var _0x8c29=function(_0x546336,_0x1d4fd6){_0x546336=_0x546336-0x0;var _0x141043=_0xc298[_0x546336];return _0x141043;};'use strict';var _=require(_0x8c29('0x0'));var util=require('util');var logger=require(_0x8c29('0x1'))('api');var moment=require(_0x8c29('0x2'));var BPromise=require(_0x8c29('0x3'));var rp=require(_0x8c29('0x4'));var fs=require('fs');var path=require(_0x8c29('0x5'));var rimraf=require(_0x8c29('0x6'));var config=require(_0x8c29('0x7'));var attributes=require(_0x8c29('0x8'));module[_0x8c29('0x9')]=function(_0x5898e2,_0x1bca75){return _0x5898e2[_0x8c29('0xa')]('Sound',attributes,{'tableName':_0x8c29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 52aedd7..9216e7d 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 _0x39a1=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Sound','find','options','raw','where','attributes','map','include','model','ShowSound','debug'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x39a1,0x160));var _0x139a=function(_0x3c0dff,_0x39ac92){_0x3c0dff=_0x3c0dff-0x0;var _0xdf60ea=_0x39a1[_0x3c0dff];return _0xdf60ea;};'use strict';var _=require('lodash');var util=require(_0x139a('0x0'));var moment=require(_0x139a('0x1'));var BPromise=require('bluebird');var rs=require(_0x139a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x139a('0x3'));var logger=require(_0x139a('0x4'))(_0x139a('0x5'));var config=require(_0x139a('0x6'));var jayson=require(_0x139a('0x7'));var client=jayson[_0x139a('0x8')][_0x139a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2814ad,_0x45fb1d,_0x47d060){return new BPromise(function(_0x56a9f6,_0x1522f2){return client[_0x139a('0xa')](_0x2814ad,_0x47d060)[_0x139a('0xb')](function(_0x23af90){logger[_0x139a('0xc')](_0x139a('0xd'),_0x45fb1d,_0x139a('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x45fb1d,_0x139a('0xe'),JSON[_0x139a('0xf')](_0x23af90));if(_0x23af90[_0x139a('0x10')]){if(_0x23af90[_0x139a('0x10')][_0x139a('0x11')]===0x1f4){logger['error'](_0x139a('0xd'),_0x45fb1d,_0x23af90[_0x139a('0x10')][_0x139a('0x12')]);return _0x1522f2(_0x23af90['error']['message']);}logger[_0x139a('0x10')](_0x139a('0xd'),_0x45fb1d,_0x23af90[_0x139a('0x10')][_0x139a('0x12')]);return _0x56a9f6(_0x23af90[_0x139a('0x10')][_0x139a('0x12')]);}else{logger['info'](_0x139a('0xd'),_0x45fb1d,_0x139a('0xe'));_0x56a9f6(_0x23af90[_0x139a('0x13')][_0x139a('0x12')]);}})[_0x139a('0x14')](function(_0x11c2f7){logger['error'](_0x139a('0xd'),_0x45fb1d,_0x11c2f7);_0x1522f2(_0x11c2f7);});});}exports['ShowSound']=function(_0x54edd6){var _0xd4aefb=this;return new Promise(function(_0x19c11f,_0x119a1f){return db[_0x139a('0x15')][_0x139a('0x16')]({'raw':_0x54edd6['options']?_0x54edd6[_0x139a('0x17')][_0x139a('0x18')]===undefined?!![]:![]:!![],'where':_0x54edd6[_0x139a('0x17')]?_0x54edd6['options'][_0x139a('0x19')]||null:null,'attributes':_0x54edd6[_0x139a('0x17')]?_0x54edd6['options'][_0x139a('0x1a')]||null:null,'include':_0x54edd6[_0x139a('0x17')]?_0x54edd6['options']['include']?_[_0x139a('0x1b')](_0x54edd6['options'][_0x139a('0x1c')],function(_0x4dc83c){return{'model':db[_0x4dc83c[_0x139a('0x1d')]],'as':_0x4dc83c['as'],'attributes':_0x4dc83c[_0x139a('0x1a')],'include':_0x4dc83c[_0x139a('0x1c')]?_[_0x139a('0x1b')](_0x4dc83c['include'],function(_0x5ac919){return{'model':db[_0x5ac919[_0x139a('0x1d')]],'as':_0x5ac919['as'],'attributes':_0x5ac919['attributes'],'include':_0x5ac919[_0x139a('0x1c')]?_[_0x139a('0x1b')](_0x5ac919[_0x139a('0x1c')],function(_0x4aacdf){return{'model':db[_0x4aacdf['model']],'as':_0x4aacdf['as'],'attributes':_0x4aacdf[_0x139a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x139a('0xb')](function(_0x470049){logger[_0x139a('0xc')](_0x139a('0x1e'),_0x54edd6);logger[_0x139a('0x1f')](_0x139a('0x1e'),_0x54edd6,JSON[_0x139a('0xf')](_0x470049));_0x19c11f(_0x470049);})[_0x139a('0x14')](function(_0x4e3aa9){logger[_0x139a('0x10')](_0x139a('0x1e'),_0x4e3aa9[_0x139a('0x12')],_0x54edd6);_0x119a1f(_0xd4aefb[_0x139a('0x10')](0x1f4,_0x4e3aa9['message']));});});}; \ No newline at end of file +var _0xe525=['util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','Sound','find','options','where','attributes','include','map','model','debug','ShowSound'];(function(_0x573050,_0x50e171){var _0x2029c6=function(_0x11e888){while(--_0x11e888){_0x573050['push'](_0x573050['shift']());}};_0x2029c6(++_0x50e171);}(_0xe525,0xe8));var _0x5e52=function(_0x3abde4,_0x4076e2){_0x3abde4=_0x3abde4-0x0;var _0x96f3cc=_0xe525[_0x3abde4];return _0x96f3cc;};'use strict';var _=require('lodash');var util=require(_0x5e52('0x0'));var moment=require('moment');var BPromise=require(_0x5e52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e52('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e52('0x3'))(_0x5e52('0x4'));var config=require(_0x5e52('0x5'));var jayson=require(_0x5e52('0x6'));var client=jayson[_0x5e52('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59cdb8,_0x37cc02,_0x1cc6fe){return new BPromise(function(_0x271cfa,_0x1b597e){return client['request'](_0x59cdb8,_0x1cc6fe)[_0x5e52('0x8')](function(_0x1f2eaf){logger[_0x5e52('0x9')](_0x5e52('0xa'),_0x37cc02,'request\x20sent');logger['debug'](_0x5e52('0xb'),_0x37cc02,_0x5e52('0xc'),JSON[_0x5e52('0xd')](_0x1f2eaf));if(_0x1f2eaf['error']){if(_0x1f2eaf['error'][_0x5e52('0xe')]===0x1f4){logger['error'](_0x5e52('0xa'),_0x37cc02,_0x1f2eaf['error']['message']);return _0x1b597e(_0x1f2eaf['error']['message']);}logger['error'](_0x5e52('0xa'),_0x37cc02,_0x1f2eaf[_0x5e52('0xf')][_0x5e52('0x10')]);return _0x271cfa(_0x1f2eaf[_0x5e52('0xf')][_0x5e52('0x10')]);}else{logger[_0x5e52('0x9')](_0x5e52('0xa'),_0x37cc02,_0x5e52('0xc'));_0x271cfa(_0x1f2eaf[_0x5e52('0x11')][_0x5e52('0x10')]);}})[_0x5e52('0x12')](function(_0x505f1c){logger[_0x5e52('0xf')](_0x5e52('0xa'),_0x37cc02,_0x505f1c);_0x1b597e(_0x505f1c);});});}exports['ShowSound']=function(_0x4ed8ab){var _0xd1f45a=this;return new Promise(function(_0x3c84f9,_0x43533f){return db[_0x5e52('0x13')][_0x5e52('0x14')]({'raw':_0x4ed8ab[_0x5e52('0x15')]?_0x4ed8ab[_0x5e52('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4ed8ab[_0x5e52('0x15')]?_0x4ed8ab[_0x5e52('0x15')][_0x5e52('0x16')]||null:null,'attributes':_0x4ed8ab[_0x5e52('0x15')]?_0x4ed8ab['options'][_0x5e52('0x17')]||null:null,'include':_0x4ed8ab[_0x5e52('0x15')]?_0x4ed8ab[_0x5e52('0x15')][_0x5e52('0x18')]?_[_0x5e52('0x19')](_0x4ed8ab[_0x5e52('0x15')][_0x5e52('0x18')],function(_0x30806f){return{'model':db[_0x30806f[_0x5e52('0x1a')]],'as':_0x30806f['as'],'attributes':_0x30806f[_0x5e52('0x17')],'include':_0x30806f[_0x5e52('0x18')]?_['map'](_0x30806f[_0x5e52('0x18')],function(_0x49b8bb){return{'model':db[_0x49b8bb['model']],'as':_0x49b8bb['as'],'attributes':_0x49b8bb[_0x5e52('0x17')],'include':_0x49b8bb[_0x5e52('0x18')]?_[_0x5e52('0x19')](_0x49b8bb[_0x5e52('0x18')],function(_0x25060a){return{'model':db[_0x25060a[_0x5e52('0x1a')]],'as':_0x25060a['as'],'attributes':_0x25060a[_0x5e52('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5e52('0x8')](function(_0x4ac15e){logger[_0x5e52('0x9')]('ShowSound',_0x4ed8ab);logger[_0x5e52('0x1b')](_0x5e52('0x1c'),_0x4ed8ab,JSON[_0x5e52('0xd')](_0x4ac15e));_0x3c84f9(_0x4ac15e);})[_0x5e52('0x12')](function(_0x1e5478){logger[_0x5e52('0xf')](_0x5e52('0x1c'),_0x1e5478[_0x5e52('0x10')],_0x4ed8ab);_0x43533f(_0xd1f45a[_0x5e52('0xf')](0x1f4,_0x1e5478[_0x5e52('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a1f0064..441f542 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x4cc3c9,_0xb82262){var _0x3d76d4=function(_0x834b7a){while(--_0x834b7a){_0x4cc3c9['push'](_0x4cc3c9['shift']());}};_0x3d76d4(++_0xb82262);}(_0xda3f,0xec));var _0xfda3=function(_0x26a682,_0x433a23){_0x26a682=_0x26a682-0x0;var _0x10b3ba=_0xda3f[_0x26a682];return _0x10b3ba;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x3a16be,_0x15899a){var _0x2be480=function(_0x4f6b97){while(--_0x4f6b97){_0x3a16be['push'](_0x3a16be['shift']());}};_0x2be480(++_0x15899a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ae0452c..e22fe8f 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 _0x17c6=['TEXT','medium','ENUM','sequelize','exports','STRING'];(function(_0x1ebf21,_0x4f32d0){var _0x524eef=function(_0x4c56ce){while(--_0x4c56ce){_0x1ebf21['push'](_0x1ebf21['shift']());}};_0x524eef(++_0x4f32d0);}(_0x17c6,0x195));var _0x617c=function(_0x71002a,_0x1cee3d){_0x71002a=_0x71002a-0x0;var _0xea467c=_0x17c6[_0x71002a];return _0xea467c;};'use strict';var Sequelize=require(_0x617c('0x0'));module[_0x617c('0x1')]={'uniqueid':{'type':Sequelize[_0x617c('0x2')]},'body':{'type':Sequelize[_0x617c('0x3')](_0x617c('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x617c('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x617c('0x3')]}}; \ No newline at end of file +var _0x39b5=['ENUM','out','sequelize','exports','STRING','medium'];(function(_0x4cfd78,_0x52355e){var _0xf4a95a=function(_0x5c2d5b){while(--_0x5c2d5b){_0x4cfd78['push'](_0x4cfd78['shift']());}};_0xf4a95a(++_0x52355e);}(_0x39b5,0xe6));var _0x539b=function(_0xc3a516,_0x32c235){_0xc3a516=_0xc3a516-0x0;var _0x1aec8a=_0x39b5[_0xc3a516];return _0x1aec8a;};'use strict';var Sequelize=require(_0x539b('0x0'));module[_0x539b('0x1')]={'uniqueid':{'type':Sequelize[_0x539b('0x2')]},'body':{'type':Sequelize['TEXT'](_0x539b('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x539b('0x4')]('in','out'),'defaultValue':_0x539b('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x539b('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8d03d70..d4bc4d0 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 _0x3f94=['then','destroy','error','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x247cf8,_0x64d93f){var _0x3f79cc=function(_0x1cb6ea){while(--_0x1cb6ea){_0x247cf8['push'](_0x247cf8['shift']());}};_0x3f79cc(++_0x64d93f);}(_0x3f94,0x11b));var _0x43f9=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x3f94[_0x1b6c6d];return _0x290d9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x43f9('0x1'));var rp=require(_0x43f9('0x2'));var moment=require(_0x43f9('0x3'));var BPromise=require(_0x43f9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x43f9('0x5'));var csv=require(_0x43f9('0x6'));var ejs=require(_0x43f9('0x7'));var fs=require('fs');var fs_extra=require(_0x43f9('0x8'));var _=require(_0x43f9('0x9'));var squel=require(_0x43f9('0xa'));var crypto=require(_0x43f9('0xb'));var jsforce=require(_0x43f9('0xc'));var deskjs=require(_0x43f9('0xd'));var toCsv=require(_0x43f9('0x6'));var querystring=require(_0x43f9('0xe'));var Papa=require(_0x43f9('0xf'));var Redis=require(_0x43f9('0x10'));var authService=require(_0x43f9('0x11'));var qs=require(_0x43f9('0x12'));var as=require(_0x43f9('0x13'));var hardwareService=require(_0x43f9('0x14'));var logger=require(_0x43f9('0x15'))(_0x43f9('0x16'));var utils=require(_0x43f9('0x17'));var config=require(_0x43f9('0x18'));var licenseUtil=require(_0x43f9('0x19'));var db=require(_0x43f9('0x1a'))['db'];function respondWithStatusCode(_0x10da41,_0x5b1e7){_0x5b1e7=_0x5b1e7||0xcc;return function(_0x43ea45){if(_0x43ea45){return _0x10da41[_0x43f9('0x1b')](_0x5b1e7);}return _0x10da41[_0x43f9('0x1c')](_0x5b1e7)[_0x43f9('0x1d')]();};}function respondWithResult(_0x52b982,_0x4a7a67){_0x4a7a67=_0x4a7a67||0xc8;return function(_0x371414){if(_0x371414){return _0x52b982[_0x43f9('0x1c')](_0x4a7a67)[_0x43f9('0x1e')](_0x371414);}};}function respondWithFilteredResult(_0x478adc,_0x40a2b7){return function(_0x15cd9f){if(_0x15cd9f){var _0x135154=typeof _0x40a2b7[_0x43f9('0x1f')]===_0x43f9('0x20')&&typeof _0x40a2b7[_0x43f9('0x21')]===_0x43f9('0x20');var _0x736bc4=_0x15cd9f[_0x43f9('0x22')];var _0x36e4e3=_0x135154?0x0:_0x40a2b7[_0x43f9('0x1f')];var _0x3b5b8d=_0x135154?_0x15cd9f[_0x43f9('0x22')]:_0x40a2b7[_0x43f9('0x1f')]+_0x40a2b7[_0x43f9('0x21')];var _0x23723f;if(_0x3b5b8d>=_0x736bc4){_0x3b5b8d=_0x736bc4;_0x23723f=0xc8;}else{_0x23723f=0xce;}_0x478adc[_0x43f9('0x1c')](_0x23723f);return _0x478adc[_0x43f9('0x23')](_0x43f9('0x24'),_0x36e4e3+'-'+_0x3b5b8d+'/'+_0x736bc4)[_0x43f9('0x1e')](_0x15cd9f);}return null;};}function patchUpdates(_0x2328e2){return function(_0x8d0f3e){try{jsonpatch[_0x43f9('0x25')](_0x8d0f3e,_0x2328e2,!![]);}catch(_0x81ed8){return BPromise[_0x43f9('0x26')](_0x81ed8);}return _0x8d0f3e[_0x43f9('0x27')]();};}function saveUpdates(_0x2c16b1,_0x267156){return function(_0x56d5af){if(_0x56d5af){return _0x56d5af[_0x43f9('0x28')](_0x2c16b1)[_0x43f9('0x29')](function(_0x1df794){return _0x1df794;});}return null;};}function removeEntity(_0x4ebe36,_0x310e79){return function(_0x31f8d3){if(_0x31f8d3){return _0x31f8d3[_0x43f9('0x2a')]()['then'](function(){_0x4ebe36['status'](0xcc)[_0x43f9('0x1d')]();});}};}function handleEntityNotFound(_0x112e4c,_0x2a23f1){return function(_0x4d6228){if(!_0x4d6228){_0x112e4c[_0x43f9('0x1b')](0x194);}return _0x4d6228;};}function handleError(_0x4bdffc,_0x4452eb){_0x4452eb=_0x4452eb||0x1f4;return function(_0x3e8085){logger[_0x43f9('0x2b')](_0x3e8085['stack']);if(_0x3e8085['name']){delete _0x3e8085['name'];}_0x4bdffc[_0x43f9('0x1c')](_0x4452eb)[_0x43f9('0x2c')](_0x3e8085);};}exports[_0x43f9('0x2d')]=function(_0x412112,_0x30a8f2){var _0x51679b={},_0x1a1a0f={},_0x5bd6d4={'count':0x0,'rows':[]};var _0x2aa46c=_['map'](db[_0x43f9('0x2e')][_0x43f9('0x2f')],function(_0x27f26d){return{'name':_0x27f26d[_0x43f9('0x30')],'type':_0x27f26d[_0x43f9('0x31')][_0x43f9('0x32')]};});_0x1a1a0f[_0x43f9('0x33')]=_[_0x43f9('0x34')](_0x2aa46c,'name');_0x1a1a0f[_0x43f9('0x35')]=_[_0x43f9('0x36')](_0x412112[_0x43f9('0x35')]);_0x1a1a0f[_0x43f9('0x37')]=_['intersection'](_0x1a1a0f[_0x43f9('0x33')],_0x1a1a0f[_0x43f9('0x35')]);_0x51679b['attributes']=_['intersection'](_0x1a1a0f['model'],qs['fields'](_0x412112[_0x43f9('0x35')][_0x43f9('0x38')]));_0x51679b[_0x43f9('0x39')]=_0x51679b[_0x43f9('0x39')][_0x43f9('0x3a')]?_0x51679b[_0x43f9('0x39')]:_0x1a1a0f[_0x43f9('0x33')];if(!_0x412112[_0x43f9('0x35')][_0x43f9('0x3b')](_0x43f9('0x3c'))){_0x51679b['limit']=qs['limit'](_0x412112['query']['limit']);_0x51679b[_0x43f9('0x1f')]=qs[_0x43f9('0x1f')](_0x412112['query']['offset']);}_0x51679b[_0x43f9('0x3d')]=qs[_0x43f9('0x3e')](_0x412112[_0x43f9('0x35')][_0x43f9('0x3e')]);_0x51679b[_0x43f9('0x3f')]=qs['filters'](_[_0x43f9('0x40')](_0x412112[_0x43f9('0x35')],_0x1a1a0f[_0x43f9('0x37')]),_0x2aa46c);if(_0x412112[_0x43f9('0x35')]['filter']){_0x51679b[_0x43f9('0x3f')]=_['merge'](_0x51679b['where'],{'$or':_[_0x43f9('0x34')](_0x2aa46c,function(_0x581013){if(_0x581013[_0x43f9('0x31')]!==_0x43f9('0x41')){var _0x33d326={};_0x33d326[_0x581013[_0x43f9('0x42')]]={'$like':'%'+_0x412112[_0x43f9('0x35')][_0x43f9('0x43')]+'%'};return _0x33d326;}})});}_0x51679b=_[_0x43f9('0x44')]({},_0x51679b,_0x412112[_0x43f9('0x45')]);var _0x406dc7={'where':_0x51679b['where']};return db[_0x43f9('0x2e')][_0x43f9('0x22')](_0x406dc7)[_0x43f9('0x29')](function(_0x143c43){_0x5bd6d4[_0x43f9('0x22')]=_0x143c43;if(_0x412112['query'][_0x43f9('0x46')]){_0x51679b[_0x43f9('0x47')]=[{'all':!![]}];}return db['SquareMessage'][_0x43f9('0x48')](_0x51679b);})[_0x43f9('0x29')](function(_0x420edb){_0x5bd6d4[_0x43f9('0x49')]=_0x420edb;return _0x5bd6d4;})[_0x43f9('0x29')](respondWithFilteredResult(_0x30a8f2,_0x51679b))['catch'](handleError(_0x30a8f2,null));};exports[_0x43f9('0x4a')]=function(_0x2321b7,_0x42af84){var _0xcde763={'raw':!![],'where':{'id':_0x2321b7[_0x43f9('0x4b')]['id']}},_0x54d4a2={};_0x54d4a2[_0x43f9('0x33')]=_['keys'](db['SquareMessage'][_0x43f9('0x2f')]);_0x54d4a2[_0x43f9('0x35')]=_[_0x43f9('0x36')](_0x2321b7['query']);_0x54d4a2[_0x43f9('0x37')]=_[_0x43f9('0x4c')](_0x54d4a2['model'],_0x54d4a2['query']);_0xcde763['attributes']=_[_0x43f9('0x4c')](_0x54d4a2[_0x43f9('0x33')],qs[_0x43f9('0x38')](_0x2321b7[_0x43f9('0x35')][_0x43f9('0x38')]));_0xcde763['attributes']=_0xcde763[_0x43f9('0x39')][_0x43f9('0x3a')]?_0xcde763[_0x43f9('0x39')]:_0x54d4a2[_0x43f9('0x33')];if(_0x2321b7[_0x43f9('0x35')][_0x43f9('0x46')]){_0xcde763[_0x43f9('0x47')]=[{'all':!![]}];}_0xcde763=_['merge']({},_0xcde763,_0x2321b7[_0x43f9('0x45')]);return db[_0x43f9('0x2e')][_0x43f9('0x4d')](_0xcde763)[_0x43f9('0x29')](handleEntityNotFound(_0x42af84,null))[_0x43f9('0x29')](respondWithResult(_0x42af84,null))[_0x43f9('0x4e')](handleError(_0x42af84,null));};exports['create']=function(_0x49f960,_0x43d1d5){return db[_0x43f9('0x2e')][_0x43f9('0x4f')](_0x49f960['body'],{})['then'](respondWithResult(_0x43d1d5,0xc9))[_0x43f9('0x4e')](handleError(_0x43d1d5,null));};exports['update']=function(_0x954b77,_0xc36913){if(_0x954b77[_0x43f9('0x50')]['id']){delete _0x954b77[_0x43f9('0x50')]['id'];}return db[_0x43f9('0x2e')][_0x43f9('0x4d')]({'where':{'id':_0x954b77[_0x43f9('0x4b')]['id']}})[_0x43f9('0x29')](handleEntityNotFound(_0xc36913,null))[_0x43f9('0x29')](saveUpdates(_0x954b77[_0x43f9('0x50')],null))[_0x43f9('0x29')](respondWithResult(_0xc36913,null))['catch'](handleError(_0xc36913,null));};exports[_0x43f9('0x2a')]=function(_0x41e582,_0x346986){return db[_0x43f9('0x2e')][_0x43f9('0x4d')]({'where':{'id':_0x41e582[_0x43f9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x346986,null))['then'](removeEntity(_0x346986,null))[_0x43f9('0x4e')](handleError(_0x346986,null));}; \ No newline at end of file +var _0xa9e1=['ioredis','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','SquareMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa9e1,0x7a));var _0x1a9e=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0xa9e1[_0xacb1e2];return _0x463815;};'use strict';var emlformat=require(_0x1a9e('0x0'));var rimraf=require(_0x1a9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a9e('0x2'));var rp=require(_0x1a9e('0x3'));var moment=require(_0x1a9e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a9e('0x5'));var util=require('util');var path=require(_0x1a9e('0x6'));var sox=require('sox');var csv=require(_0x1a9e('0x7'));var ejs=require(_0x1a9e('0x8'));var fs=require('fs');var fs_extra=require(_0x1a9e('0x9'));var _=require(_0x1a9e('0xa'));var squel=require(_0x1a9e('0xb'));var crypto=require(_0x1a9e('0xc'));var jsforce=require(_0x1a9e('0xd'));var deskjs=require(_0x1a9e('0xe'));var toCsv=require(_0x1a9e('0x7'));var querystring=require(_0x1a9e('0xf'));var Papa=require('papaparse');var Redis=require(_0x1a9e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a9e('0x11'));var logger=require('../../config/logger')(_0x1a9e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27ac0e,_0x4f6319){_0x4f6319=_0x4f6319||0xcc;return function(_0xe41277){if(_0xe41277){return _0x27ac0e[_0x1a9e('0x14')](_0x4f6319);}return _0x27ac0e[_0x1a9e('0x15')](_0x4f6319)[_0x1a9e('0x16')]();};}function respondWithResult(_0x6cf4d0,_0x1ac5aa){_0x1ac5aa=_0x1ac5aa||0xc8;return function(_0x39c1c0){if(_0x39c1c0){return _0x6cf4d0[_0x1a9e('0x15')](_0x1ac5aa)['json'](_0x39c1c0);}};}function respondWithFilteredResult(_0x2beade,_0x1a9aed){return function(_0x3d51bd){if(_0x3d51bd){var _0x3540d=typeof _0x1a9aed[_0x1a9e('0x17')]==='undefined'&&typeof _0x1a9aed[_0x1a9e('0x18')]===_0x1a9e('0x19');var _0xfe073f=_0x3d51bd['count'];var _0x44f39e=_0x3540d?0x0:_0x1a9aed[_0x1a9e('0x17')];var _0x3869cb=_0x3540d?_0x3d51bd[_0x1a9e('0x1a')]:_0x1a9aed[_0x1a9e('0x17')]+_0x1a9aed[_0x1a9e('0x18')];var _0x52df94;if(_0x3869cb>=_0xfe073f){_0x3869cb=_0xfe073f;_0x52df94=0xc8;}else{_0x52df94=0xce;}_0x2beade[_0x1a9e('0x15')](_0x52df94);return _0x2beade[_0x1a9e('0x1b')](_0x1a9e('0x1c'),_0x44f39e+'-'+_0x3869cb+'/'+_0xfe073f)[_0x1a9e('0x1d')](_0x3d51bd);}return null;};}function patchUpdates(_0x89a640){return function(_0x19d859){try{jsonpatch[_0x1a9e('0x1e')](_0x19d859,_0x89a640,!![]);}catch(_0x106385){return BPromise['reject'](_0x106385);}return _0x19d859[_0x1a9e('0x1f')]();};}function saveUpdates(_0x3e517e,_0x10ab8a){return function(_0x194778){if(_0x194778){return _0x194778[_0x1a9e('0x20')](_0x3e517e)[_0x1a9e('0x21')](function(_0x19b3d7){return _0x19b3d7;});}return null;};}function removeEntity(_0x2f8ed6,_0x21aa68){return function(_0x5cbf91){if(_0x5cbf91){return _0x5cbf91[_0x1a9e('0x22')]()['then'](function(){_0x2f8ed6[_0x1a9e('0x15')](0xcc)[_0x1a9e('0x16')]();});}};}function handleEntityNotFound(_0x2953ac,_0x279df5){return function(_0x33b453){if(!_0x33b453){_0x2953ac[_0x1a9e('0x14')](0x194);}return _0x33b453;};}function handleError(_0x464fba,_0x54ba8e){_0x54ba8e=_0x54ba8e||0x1f4;return function(_0x1f660f){logger[_0x1a9e('0x23')](_0x1f660f['stack']);if(_0x1f660f['name']){delete _0x1f660f[_0x1a9e('0x24')];}_0x464fba[_0x1a9e('0x15')](_0x54ba8e)[_0x1a9e('0x25')](_0x1f660f);};}exports[_0x1a9e('0x26')]=function(_0x44b3df,_0x3acd58){var _0x45474e={},_0x13aa7a={},_0x204f9c={'count':0x0,'rows':[]};var _0x275256=_[_0x1a9e('0x27')](db[_0x1a9e('0x28')][_0x1a9e('0x29')],function(_0x443707){return{'name':_0x443707['fieldName'],'type':_0x443707[_0x1a9e('0x2a')]['key']};});_0x13aa7a[_0x1a9e('0x2b')]=_[_0x1a9e('0x27')](_0x275256,_0x1a9e('0x24'));_0x13aa7a[_0x1a9e('0x2c')]=_[_0x1a9e('0x2d')](_0x44b3df[_0x1a9e('0x2c')]);_0x13aa7a['filters']=_[_0x1a9e('0x2e')](_0x13aa7a[_0x1a9e('0x2b')],_0x13aa7a[_0x1a9e('0x2c')]);_0x45474e[_0x1a9e('0x2f')]=_[_0x1a9e('0x2e')](_0x13aa7a['model'],qs[_0x1a9e('0x30')](_0x44b3df[_0x1a9e('0x2c')][_0x1a9e('0x30')]));_0x45474e[_0x1a9e('0x2f')]=_0x45474e[_0x1a9e('0x2f')]['length']?_0x45474e['attributes']:_0x13aa7a['model'];if(!_0x44b3df[_0x1a9e('0x2c')][_0x1a9e('0x31')](_0x1a9e('0x32'))){_0x45474e['limit']=qs[_0x1a9e('0x18')](_0x44b3df[_0x1a9e('0x2c')][_0x1a9e('0x18')]);_0x45474e[_0x1a9e('0x17')]=qs[_0x1a9e('0x17')](_0x44b3df['query']['offset']);}_0x45474e[_0x1a9e('0x33')]=qs[_0x1a9e('0x34')](_0x44b3df[_0x1a9e('0x2c')]['sort']);_0x45474e['where']=qs[_0x1a9e('0x35')](_[_0x1a9e('0x36')](_0x44b3df['query'],_0x13aa7a[_0x1a9e('0x35')]),_0x275256);if(_0x44b3df[_0x1a9e('0x2c')]['filter']){_0x45474e[_0x1a9e('0x37')]=_[_0x1a9e('0x38')](_0x45474e['where'],{'$or':_[_0x1a9e('0x27')](_0x275256,function(_0x18a726){if(_0x18a726[_0x1a9e('0x2a')]!=='VIRTUAL'){var _0x2531c1={};_0x2531c1[_0x18a726['name']]={'$like':'%'+_0x44b3df[_0x1a9e('0x2c')][_0x1a9e('0x39')]+'%'};return _0x2531c1;}})});}_0x45474e=_[_0x1a9e('0x38')]({},_0x45474e,_0x44b3df[_0x1a9e('0x3a')]);var _0x1c2770={'where':_0x45474e['where']};return db['SquareMessage'][_0x1a9e('0x1a')](_0x1c2770)[_0x1a9e('0x21')](function(_0x468f82){_0x204f9c[_0x1a9e('0x1a')]=_0x468f82;if(_0x44b3df['query'][_0x1a9e('0x3b')]){_0x45474e[_0x1a9e('0x3c')]=[{'all':!![]}];}return db[_0x1a9e('0x28')][_0x1a9e('0x3d')](_0x45474e);})[_0x1a9e('0x21')](function(_0xeb3e58){_0x204f9c[_0x1a9e('0x3e')]=_0xeb3e58;return _0x204f9c;})[_0x1a9e('0x21')](respondWithFilteredResult(_0x3acd58,_0x45474e))[_0x1a9e('0x3f')](handleError(_0x3acd58,null));};exports['show']=function(_0x2c83f1,_0x54c421){var _0x5d9372={'raw':!![],'where':{'id':_0x2c83f1[_0x1a9e('0x40')]['id']}},_0x124c86={};_0x124c86[_0x1a9e('0x2b')]=_[_0x1a9e('0x2d')](db['SquareMessage'][_0x1a9e('0x29')]);_0x124c86['query']=_[_0x1a9e('0x2d')](_0x2c83f1[_0x1a9e('0x2c')]);_0x124c86[_0x1a9e('0x35')]=_['intersection'](_0x124c86[_0x1a9e('0x2b')],_0x124c86[_0x1a9e('0x2c')]);_0x5d9372['attributes']=_[_0x1a9e('0x2e')](_0x124c86[_0x1a9e('0x2b')],qs[_0x1a9e('0x30')](_0x2c83f1[_0x1a9e('0x2c')]['fields']));_0x5d9372[_0x1a9e('0x2f')]=_0x5d9372[_0x1a9e('0x2f')][_0x1a9e('0x41')]?_0x5d9372['attributes']:_0x124c86[_0x1a9e('0x2b')];if(_0x2c83f1[_0x1a9e('0x2c')][_0x1a9e('0x3b')]){_0x5d9372[_0x1a9e('0x3c')]=[{'all':!![]}];}_0x5d9372=_[_0x1a9e('0x38')]({},_0x5d9372,_0x2c83f1[_0x1a9e('0x3a')]);return db[_0x1a9e('0x28')][_0x1a9e('0x42')](_0x5d9372)[_0x1a9e('0x21')](handleEntityNotFound(_0x54c421,null))[_0x1a9e('0x21')](respondWithResult(_0x54c421,null))['catch'](handleError(_0x54c421,null));};exports[_0x1a9e('0x43')]=function(_0x2c741d,_0x32908e){return db[_0x1a9e('0x28')]['create'](_0x2c741d[_0x1a9e('0x44')],{})[_0x1a9e('0x21')](respondWithResult(_0x32908e,0xc9))[_0x1a9e('0x3f')](handleError(_0x32908e,null));};exports[_0x1a9e('0x20')]=function(_0x29133e,_0x231526){if(_0x29133e[_0x1a9e('0x44')]['id']){delete _0x29133e[_0x1a9e('0x44')]['id'];}return db[_0x1a9e('0x28')]['find']({'where':{'id':_0x29133e[_0x1a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x231526,null))['then'](saveUpdates(_0x29133e[_0x1a9e('0x44')],null))[_0x1a9e('0x21')](respondWithResult(_0x231526,null))[_0x1a9e('0x3f')](handleError(_0x231526,null));};exports[_0x1a9e('0x22')]=function(_0xe6025e,_0x1e00aa){return db[_0x1a9e('0x28')]['find']({'where':{'id':_0xe6025e[_0x1a9e('0x40')]['id']}})[_0x1a9e('0x21')](handleEntityNotFound(_0x1e00aa,null))[_0x1a9e('0x21')](removeEntity(_0x1e00aa,null))[_0x1a9e('0x3f')](handleError(_0x1e00aa,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 931b8b7..da3735a 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 _0x9512=['path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xb328fb,_0x2c62f2){var _0x1965c3=function(_0x38421a){while(--_0x38421a){_0xb328fb['push'](_0xb328fb['shift']());}};_0x1965c3(++_0x2c62f2);}(_0x9512,0x66));var _0x2951=function(_0x3bd4ec,_0x4cb5ce){_0x3bd4ec=_0x3bd4ec-0x0;var _0x5062dc=_0x9512[_0x3bd4ec];return _0x5062dc;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var logger=require(_0x2951('0x2'))(_0x2951('0x3'));var moment=require(_0x2951('0x4'));var BPromise=require('bluebird');var rp=require(_0x2951('0x5'));var fs=require('fs');var path=require(_0x2951('0x6'));var rimraf=require(_0x2951('0x7'));var config=require('../../config/environment');var attributes=require(_0x2951('0x8'));module[_0x2951('0x9')]=function(_0x4bf722,_0x2994c7){return _0x4bf722[_0x2951('0xa')](_0x2951('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x578e=['square_messages','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x578e,0x91));var _0xe578=function(_0x3b4bad,_0x285d01){_0x3b4bad=_0x3b4bad-0x0;var _0xef47c9=_0x578e[_0x3b4bad];return _0xef47c9;};'use strict';var _=require('lodash');var util=require(_0xe578('0x0'));var logger=require(_0xe578('0x1'))(_0xe578('0x2'));var moment=require('moment');var BPromise=require(_0xe578('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe578('0x4'));var rimraf=require('rimraf');var config=require(_0xe578('0x5'));var attributes=require('./squareMessage.attributes');module[_0xe578('0x6')]=function(_0x189259,_0x5675e0){return _0x189259[_0xe578('0x7')]('SquareMessage',attributes,{'tableName':_0xe578('0x8'),'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 79939b9..1e219f4 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 _0x8455=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareMessage','SquareMessage','create','options','raw','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x4e2d60,_0x3f9c06){var _0x5417b4=function(_0x47fda4){while(--_0x47fda4){_0x4e2d60['push'](_0x4e2d60['shift']());}};_0x5417b4(++_0x3f9c06);}(_0x8455,0x101));var _0x5845=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8455[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5845('0x0'));var util=require(_0x5845('0x1'));var moment=require(_0x5845('0x2'));var BPromise=require(_0x5845('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5845('0x4'))['db'];var utils=require(_0x5845('0x5'));var logger=require(_0x5845('0x6'))(_0x5845('0x7'));var config=require(_0x5845('0x8'));var jayson=require(_0x5845('0x9'));var client=jayson[_0x5845('0xa')][_0x5845('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb2ab86,_0x3855bb,_0x3fa545){return new BPromise(function(_0x1021b7,_0x4ff588){return client['request'](_0xb2ab86,_0x3fa545)['then'](function(_0x6552f4){logger[_0x5845('0xc')](_0x5845('0xd'),_0x3855bb,_0x5845('0xe'));logger[_0x5845('0xf')](_0x5845('0x10'),_0x3855bb,_0x5845('0xe'),JSON[_0x5845('0x11')](_0x6552f4));if(_0x6552f4[_0x5845('0x12')]){if(_0x6552f4[_0x5845('0x12')]['code']===0x1f4){logger[_0x5845('0x12')](_0x5845('0xd'),_0x3855bb,_0x6552f4[_0x5845('0x12')][_0x5845('0x13')]);return _0x4ff588(_0x6552f4[_0x5845('0x12')][_0x5845('0x13')]);}logger[_0x5845('0x12')]('SquareMessage,\x20%s,\x20%s',_0x3855bb,_0x6552f4[_0x5845('0x12')][_0x5845('0x13')]);return _0x1021b7(_0x6552f4['error']['message']);}else{logger[_0x5845('0xc')](_0x5845('0xd'),_0x3855bb,_0x5845('0xe'));_0x1021b7(_0x6552f4['result'][_0x5845('0x13')]);}})[_0x5845('0x14')](function(_0x2f8dd1){logger[_0x5845('0x12')](_0x5845('0xd'),_0x3855bb,_0x2f8dd1);_0x4ff588(_0x2f8dd1);});});}exports[_0x5845('0x15')]=function(_0x61b51a){var _0x1ce874=this;return new Promise(function(_0x69a969,_0x32ffe0){return db[_0x5845('0x16')][_0x5845('0x17')](_0x61b51a['body'],{'raw':_0x61b51a['options']?_0x61b51a[_0x5845('0x18')][_0x5845('0x19')]===undefined?!![]:![]:!![]})[_0x5845('0x1a')](function(_0x28df9b){logger['info'](_0x5845('0x15'),_0x61b51a);logger[_0x5845('0xf')](_0x5845('0x15'),_0x61b51a,JSON[_0x5845('0x11')](_0x28df9b));_0x69a969(_0x28df9b);})[_0x5845('0x14')](function(_0x14e0b1){logger[_0x5845('0x12')](_0x5845('0x15'),_0x14e0b1[_0x5845('0x13')],_0x61b51a);_0x32ffe0(_0x1ce874[_0x5845('0x12')](0x1f4,_0x14e0b1['message']));});});}; \ No newline at end of file +var _0x3b6b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','bluebird','randomstring'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x3b6b,0xd5));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb3b6('0x0'));var util=require(_0xb3b6('0x1'));var moment=require('moment');var BPromise=require(_0xb3b6('0x2'));var rs=require(_0xb3b6('0x3'));var fs=require('fs');var Redis=require(_0xb3b6('0x4'));var db=require(_0xb3b6('0x5'))['db'];var utils=require(_0xb3b6('0x6'));var logger=require(_0xb3b6('0x7'))(_0xb3b6('0x8'));var config=require(_0xb3b6('0x9'));var jayson=require(_0xb3b6('0xa'));var client=jayson[_0xb3b6('0xb')][_0xb3b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x345d96,_0x2c6b75,_0x33179c){return new BPromise(function(_0x2f98bf,_0x41138){return client[_0xb3b6('0xd')](_0x345d96,_0x33179c)['then'](function(_0x32ba75){logger['info'](_0xb3b6('0xe'),_0x2c6b75,'request\x20sent');logger[_0xb3b6('0xf')](_0xb3b6('0x10'),_0x2c6b75,_0xb3b6('0x11'),JSON[_0xb3b6('0x12')](_0x32ba75));if(_0x32ba75[_0xb3b6('0x13')]){if(_0x32ba75['error'][_0xb3b6('0x14')]===0x1f4){logger['error'](_0xb3b6('0xe'),_0x2c6b75,_0x32ba75[_0xb3b6('0x13')][_0xb3b6('0x15')]);return _0x41138(_0x32ba75['error'][_0xb3b6('0x15')]);}logger[_0xb3b6('0x13')](_0xb3b6('0xe'),_0x2c6b75,_0x32ba75[_0xb3b6('0x13')][_0xb3b6('0x15')]);return _0x2f98bf(_0x32ba75['error'][_0xb3b6('0x15')]);}else{logger[_0xb3b6('0x16')](_0xb3b6('0xe'),_0x2c6b75,_0xb3b6('0x11'));_0x2f98bf(_0x32ba75[_0xb3b6('0x17')]['message']);}})[_0xb3b6('0x18')](function(_0x4d1fc9){logger[_0xb3b6('0x13')](_0xb3b6('0xe'),_0x2c6b75,_0x4d1fc9);_0x41138(_0x4d1fc9);});});}exports[_0xb3b6('0x19')]=function(_0x1a9c11){var _0x12abf2=this;return new Promise(function(_0x3ae8bc,_0x851475){return db[_0xb3b6('0x1a')][_0xb3b6('0x1b')](_0x1a9c11[_0xb3b6('0x1c')],{'raw':_0x1a9c11[_0xb3b6('0x1d')]?_0x1a9c11[_0xb3b6('0x1d')][_0xb3b6('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x7f2f5d){logger['info'](_0xb3b6('0x19'),_0x1a9c11);logger[_0xb3b6('0xf')](_0xb3b6('0x19'),_0x1a9c11,JSON[_0xb3b6('0x12')](_0x7f2f5d));_0x3ae8bc(_0x7f2f5d);})[_0xb3b6('0x18')](function(_0xe2173){logger['error']('CreateSquareMessage',_0xe2173[_0xb3b6('0x15')],_0x1a9c11);_0x851475(_0x12abf2[_0xb3b6('0x13')](0x1f4,_0xe2173['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b35b319..4e376e2 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 _0x8e92=['Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','15s','test','post','create','put','delete','exports','multer','path','connect-timeout'];(function(_0xb30aa,_0x38acc2){var _0x12e2b6=function(_0x3597ba){while(--_0x3597ba){_0xb30aa['push'](_0xb30aa['shift']());}};_0x12e2b6(++_0x38acc2);}(_0x8e92,0x95));var _0x28e9=function(_0x2997e1,_0x11e79d){_0x2997e1=_0x2997e1-0x0;var _0x1bd039=_0x8e92[_0x2997e1];return _0x1bd039;};'use strict';var multer=require(_0x28e9('0x0'));var util=require('util');var path=require(_0x28e9('0x1'));var timeout=require(_0x28e9('0x2'));var express=require('express');var router=express[_0x28e9('0x3')]();var fs_extra=require(_0x28e9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x28e9('0x5'));var config=require('../../config/environment');var controller=require(_0x28e9('0x6'));router[_0x28e9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x28e9('0x7')](_0x28e9('0x8'),auth[_0x28e9('0x9')](),controller[_0x28e9('0xa')]);router[_0x28e9('0x7')](_0x28e9('0xb'),auth[_0x28e9('0x9')](),timeout(_0x28e9('0xc')),controller[_0x28e9('0xd')]);router[_0x28e9('0xe')]('/',auth[_0x28e9('0x9')](),controller[_0x28e9('0xf')]);router[_0x28e9('0x10')](_0x28e9('0x8'),auth[_0x28e9('0x9')](),controller['update']);router[_0x28e9('0x11')](_0x28e9('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x28e9('0x12')]=router; \ No newline at end of file +var _0x4b7d=['create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x4b7d,0xca));var _0xd4b7=function(_0x19d0c3,_0x434365){_0x19d0c3=_0x19d0c3-0x0;var _0x41fbfb=_0x4b7d[_0x19d0c3];return _0x41fbfb;};'use strict';var multer=require(_0xd4b7('0x0'));var util=require(_0xd4b7('0x1'));var path=require(_0xd4b7('0x2'));var timeout=require(_0xd4b7('0x3'));var express=require(_0xd4b7('0x4'));var router=express[_0xd4b7('0x5')]();var fs_extra=require(_0xd4b7('0x6'));var auth=require(_0xd4b7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd4b7('0x8'));var controller=require(_0xd4b7('0x9'));router[_0xd4b7('0xa')]('/',auth[_0xd4b7('0xb')](),controller[_0xd4b7('0xc')]);router['get'](_0xd4b7('0xd'),auth['isAuthenticated'](),controller[_0xd4b7('0xe')]);router[_0xd4b7('0xa')]('/:id/test',auth[_0xd4b7('0xb')](),timeout(_0xd4b7('0xf')),controller[_0xd4b7('0x10')]);router[_0xd4b7('0x11')]('/',auth[_0xd4b7('0xb')](),controller[_0xd4b7('0x12')]);router[_0xd4b7('0x13')]('/:id',auth[_0xd4b7('0xb')](),controller['update']);router['delete'](_0xd4b7('0xd'),auth[_0xd4b7('0xb')](),controller[_0xd4b7('0x14')]);module[_0xd4b7('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1bcf28a..8b5033e 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 _0xbd50=['sequelize','exports','STRING','name'];(function(_0x4ec72c,_0x2bf0e7){var _0x344147=function(_0x28d01f){while(--_0x28d01f){_0x4ec72c['push'](_0x4ec72c['shift']());}};_0x344147(++_0x2bf0e7);}(_0xbd50,0x1b8));var _0x0bd5=function(_0x57b913,_0x48b176){_0x57b913=_0x57b913-0x0;var _0x466aaa=_0xbd50[_0x57b913];return _0x466aaa;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')],'unique':_0x0bd5('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0bd5('0x2')]},'description':{'type':Sequelize[_0x0bd5('0x2')]}}; \ No newline at end of file +var _0x617f=['STRING','name','sequelize','exports'];(function(_0x5822c6,_0x11d122){var _0x330d31=function(_0x223289){while(--_0x223289){_0x5822c6['push'](_0x5822c6['shift']());}};_0x330d31(++_0x11d122);}(_0x617f,0x13e));var _0xf617=function(_0xb333cf,_0x5cd879){_0xb333cf=_0xb333cf-0x0;var _0x265eb=_0x617f[_0xb333cf];return _0x265eb;};'use strict';var Sequelize=require(_0xf617('0x0'));module[_0xf617('0x1')]={'name':{'type':Sequelize[_0xf617('0x2')],'unique':_0xf617('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf617('0x2')]},'description':{'type':Sequelize[_0xf617('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 34fc974..2699a30 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 _0xad2e=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','get','ODBC','UserProfileResource','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x1cd6a5,_0x5186d1){var _0x43c885=function(_0x29b8c3){while(--_0x29b8c3){_0x1cd6a5['push'](_0x1cd6a5['shift']());}};_0x43c885(++_0x5186d1);}(_0xad2e,0x117));var _0xead2=function(_0x121c31,_0x2abe4f){_0x121c31=_0x121c31-0x0;var _0x508c3e=_0xad2e[_0x121c31];return _0x508c3e;};'use strict';var emlformat=require(_0xead2('0x0'));var rimraf=require(_0xead2('0x1'));var zipdir=require(_0xead2('0x2'));var jsonpatch=require(_0xead2('0x3'));var rp=require(_0xead2('0x4'));var moment=require('moment');var BPromise=require(_0xead2('0x5'));var Mustache=require(_0xead2('0x6'));var util=require(_0xead2('0x7'));var path=require(_0xead2('0x8'));var sox=require(_0xead2('0x9'));var csv=require(_0xead2('0xa'));var ejs=require(_0xead2('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(_0xead2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xead2('0xd'));var Papa=require(_0xead2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xead2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xead2('0x10'));var logger=require(_0xead2('0x11'))('api');var utils=require(_0xead2('0x12'));var config=require(_0xead2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xead2('0x14'))['db'];function respondWithStatusCode(_0x137bde,_0x511558){_0x511558=_0x511558||0xcc;return function(_0x380e4f){if(_0x380e4f){return _0x137bde[_0xead2('0x15')](_0x511558);}return _0x137bde[_0xead2('0x16')](_0x511558)[_0xead2('0x17')]();};}function respondWithResult(_0x35287d,_0x259faf){_0x259faf=_0x259faf||0xc8;return function(_0xb9516a){if(_0xb9516a){return _0x35287d[_0xead2('0x16')](_0x259faf)[_0xead2('0x18')](_0xb9516a);}};}function respondWithFilteredResult(_0x565d72,_0xebc16){return function(_0x41efcd){if(_0x41efcd){var _0x1367ab=typeof _0xebc16[_0xead2('0x19')]===_0xead2('0x1a')&&typeof _0xebc16['limit']===_0xead2('0x1a');var _0xd6e9fd=_0x41efcd[_0xead2('0x1b')];var _0xfadf3f=_0x1367ab?0x0:_0xebc16[_0xead2('0x19')];var _0x3c9969=_0x1367ab?_0x41efcd[_0xead2('0x1b')]:_0xebc16[_0xead2('0x19')]+_0xebc16[_0xead2('0x1c')];var _0x92799a;if(_0x3c9969>=_0xd6e9fd){_0x3c9969=_0xd6e9fd;_0x92799a=0xc8;}else{_0x92799a=0xce;}_0x565d72[_0xead2('0x16')](_0x92799a);return _0x565d72['set'](_0xead2('0x1d'),_0xfadf3f+'-'+_0x3c9969+'/'+_0xd6e9fd)[_0xead2('0x18')](_0x41efcd);}return null;};}function patchUpdates(_0x237a9b){return function(_0xc6118b){try{jsonpatch[_0xead2('0x1e')](_0xc6118b,_0x237a9b,!![]);}catch(_0x5da763){return BPromise['reject'](_0x5da763);}return _0xc6118b['save']();};}function saveUpdates(_0x584535,_0x27336b){return function(_0xf8dcfe){if(_0xf8dcfe){return _0xf8dcfe[_0xead2('0x1f')](_0x584535)[_0xead2('0x20')](function(_0x546e49){return _0x546e49;});}return null;};}function removeEntity(_0x4fbff7,_0x2f995f){return function(_0x533011){if(_0x533011){return _0x533011[_0xead2('0x21')]()[_0xead2('0x20')](function(){var _0x473900=_0x533011[_0xead2('0x22')]({'plain':!![]});var _0x4154a7=_0xead2('0x23');return db[_0xead2('0x24')][_0xead2('0x21')]({'where':{'type':_0x4154a7,'resourceId':_0x473900['id']}})[_0xead2('0x20')](function(){return _0x533011;});})['then'](function(){_0x4fbff7[_0xead2('0x16')](0xcc)[_0xead2('0x17')]();});}};}function handleEntityNotFound(_0x42d686,_0x57236a){return function(_0x377ce3){if(!_0x377ce3){_0x42d686[_0xead2('0x15')](0x194);}return _0x377ce3;};}function handleError(_0x32d894,_0xc01a18){_0xc01a18=_0xc01a18||0x1f4;return function(_0x3976fa){logger['error'](_0x3976fa[_0xead2('0x25')]);if(_0x3976fa[_0xead2('0x26')]){delete _0x3976fa['name'];}_0x32d894[_0xead2('0x16')](_0xc01a18)[_0xead2('0x27')](_0x3976fa);};}exports[_0xead2('0x28')]=function(_0x20ec19,_0x1ae735){var _0x31cfd2={},_0x633fa5={},_0x12d663={'count':0x0,'rows':[]};var _0x1a59fb=_[_0xead2('0x29')](db[_0xead2('0x2a')][_0xead2('0x2b')],function(_0x1c0c79){return{'name':_0x1c0c79[_0xead2('0x2c')],'type':_0x1c0c79[_0xead2('0x2d')]['key']};});_0x633fa5[_0xead2('0x2e')]=_[_0xead2('0x29')](_0x1a59fb,_0xead2('0x26'));_0x633fa5[_0xead2('0x2f')]=_['keys'](_0x20ec19[_0xead2('0x2f')]);_0x633fa5[_0xead2('0x30')]=_[_0xead2('0x31')](_0x633fa5[_0xead2('0x2e')],_0x633fa5['query']);_0x31cfd2[_0xead2('0x32')]=_['intersection'](_0x633fa5[_0xead2('0x2e')],qs[_0xead2('0x33')](_0x20ec19[_0xead2('0x2f')]['fields']));_0x31cfd2[_0xead2('0x32')]=_0x31cfd2['attributes'][_0xead2('0x34')]?_0x31cfd2[_0xead2('0x32')]:_0x633fa5[_0xead2('0x2e')];if(!_0x20ec19['query'][_0xead2('0x35')](_0xead2('0x36'))){_0x31cfd2['limit']=qs[_0xead2('0x1c')](_0x20ec19[_0xead2('0x2f')]['limit']);_0x31cfd2[_0xead2('0x19')]=qs[_0xead2('0x19')](_0x20ec19[_0xead2('0x2f')][_0xead2('0x19')]);}_0x31cfd2[_0xead2('0x37')]=qs[_0xead2('0x38')](_0x20ec19['query'][_0xead2('0x38')]);_0x31cfd2[_0xead2('0x39')]=qs[_0xead2('0x30')](_[_0xead2('0x3a')](_0x20ec19[_0xead2('0x2f')],_0x633fa5[_0xead2('0x30')]),_0x1a59fb);if(_0x20ec19[_0xead2('0x2f')][_0xead2('0x3b')]){_0x31cfd2['where']=_[_0xead2('0x3c')](_0x31cfd2[_0xead2('0x39')],{'$or':_['map'](_0x1a59fb,function(_0x3b4411){if(_0x3b4411[_0xead2('0x2d')]!==_0xead2('0x3d')){var _0x46d59b={};_0x46d59b[_0x3b4411['name']]={'$like':'%'+_0x20ec19[_0xead2('0x2f')][_0xead2('0x3b')]+'%'};return _0x46d59b;}})});}_0x31cfd2=_['merge']({},_0x31cfd2,_0x20ec19[_0xead2('0x3e')]);var _0x1f093c={'where':_0x31cfd2[_0xead2('0x39')]};return db[_0xead2('0x2a')][_0xead2('0x1b')](_0x1f093c)['then'](function(_0x5757ba){_0x12d663['count']=_0x5757ba;if(_0x20ec19[_0xead2('0x2f')][_0xead2('0x3f')]){_0x31cfd2[_0xead2('0x40')]=[{'all':!![]}];}return db[_0xead2('0x2a')][_0xead2('0x41')](_0x31cfd2);})[_0xead2('0x20')](function(_0x2fd879){_0x12d663[_0xead2('0x42')]=_0x2fd879;return _0x12d663;})[_0xead2('0x20')](respondWithFilteredResult(_0x1ae735,_0x31cfd2))[_0xead2('0x43')](handleError(_0x1ae735,null));};exports['show']=function(_0x39a79c,_0x4da0c9){var _0x425520={'raw':!![],'where':{'id':_0x39a79c[_0xead2('0x44')]['id']}},_0x1635b6={};_0x1635b6['model']=_[_0xead2('0x45')](db[_0xead2('0x2a')][_0xead2('0x2b')]);_0x1635b6[_0xead2('0x2f')]=_[_0xead2('0x45')](_0x39a79c[_0xead2('0x2f')]);_0x1635b6[_0xead2('0x30')]=_[_0xead2('0x31')](_0x1635b6[_0xead2('0x2e')],_0x1635b6[_0xead2('0x2f')]);_0x425520[_0xead2('0x32')]=_['intersection'](_0x1635b6[_0xead2('0x2e')],qs[_0xead2('0x33')](_0x39a79c[_0xead2('0x2f')][_0xead2('0x33')]));_0x425520[_0xead2('0x32')]=_0x425520[_0xead2('0x32')][_0xead2('0x34')]?_0x425520[_0xead2('0x32')]:_0x1635b6['model'];if(_0x39a79c[_0xead2('0x2f')][_0xead2('0x3f')]){_0x425520['include']=[{'all':!![]}];}_0x425520=_['merge']({},_0x425520,_0x39a79c[_0xead2('0x3e')]);return db['SquareOdbc'][_0xead2('0x46')](_0x425520)[_0xead2('0x20')](handleEntityNotFound(_0x4da0c9,null))[_0xead2('0x20')](respondWithResult(_0x4da0c9,null))['catch'](handleError(_0x4da0c9,null));};exports[_0xead2('0x47')]=function(_0x1f68c7,_0x25ffab){return db[_0xead2('0x2a')][_0xead2('0x47')](_0x1f68c7[_0xead2('0x48')],{})[_0xead2('0x20')](function(_0x16f58f){var _0x36cad9=_0x1f68c7['user'][_0xead2('0x22')]({'plain':!![]});if(!_0x36cad9)throw new Error(_0xead2('0x49'));if(_0x36cad9[_0xead2('0x4a')]===_0xead2('0x4b')){var _0x4f1b31=_0x16f58f[_0xead2('0x22')]({'plain':!![]});var _0x4175a4=_0xead2('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x4175a4,'userProfileId':_0x36cad9['userProfileId']},'raw':!![]})[_0xead2('0x20')](function(_0x5f245a){if(_0x5f245a&&_0x5f245a[_0xead2('0x4c')]===0x0){return db['UserProfileResource'][_0xead2('0x47')]({'name':_0x4f1b31[_0xead2('0x26')],'resourceId':_0x4f1b31['id'],'type':_0x5f245a['name'],'sectionId':_0x5f245a['id']},{})[_0xead2('0x20')](function(){return _0x16f58f;});}else{return _0x16f58f;}})['catch'](function(_0x3efb3c){logger[_0xead2('0x4d')](_0xead2('0x4e'),_0x3efb3c);throw _0x3efb3c;});}return _0x16f58f;})[_0xead2('0x20')](respondWithResult(_0x25ffab,0xc9))['catch'](handleError(_0x25ffab,null));};exports['update']=function(_0x5e65d9,_0x5d90df){if(_0x5e65d9['body']['id']){delete _0x5e65d9[_0xead2('0x48')]['id'];}return db[_0xead2('0x2a')][_0xead2('0x46')]({'where':{'id':_0x5e65d9['params']['id']}})[_0xead2('0x20')](handleEntityNotFound(_0x5d90df,null))['then'](saveUpdates(_0x5e65d9['body'],null))[_0xead2('0x20')](respondWithResult(_0x5d90df,null))[_0xead2('0x43')](handleError(_0x5d90df,null));};exports[_0xead2('0x21')]=function(_0x2ec7f0,_0x22941b){return db['SquareOdbc']['find']({'where':{'id':_0x2ec7f0[_0xead2('0x44')]['id']}})['then'](handleEntityNotFound(_0x22941b,null))[_0xead2('0x20')](removeEntity(_0x22941b,null))[_0xead2('0x43')](handleError(_0x22941b,null));};exports[_0xead2('0x4f')]=function(_0x187c10,_0x12c079,_0x584e9a){var _0x1a4d03;return db[_0xead2('0x2a')][_0xead2('0x46')]({'where':{'id':_0x187c10[_0xead2('0x44')]['id']},'attributes':['id',_0xead2('0x50')]})[_0xead2('0x20')](handleEntityNotFound(_0x12c079,null))['then'](function(_0x3c8316){if(_0x3c8316){var _0x233000=require('odbc')();_0x233000[_0xead2('0x51')](_0x3c8316['dsn']);_0x233000[_0xead2('0x52')]();return _0x3c8316;}})['then'](respondWithResult(_0x12c079,null))[_0xead2('0x43')](handleError(_0x12c079,null));}; \ No newline at end of file +var _0x13f9=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','SquareOdbc','count','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','rimraf','zip-dir','moment','bluebird','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','Content-Range','save','then','ODBC','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes'];(function(_0x14e36d,_0x1e816d){var _0x113a30=function(_0x1a6e5c){while(--_0x1a6e5c){_0x14e36d['push'](_0x14e36d['shift']());}};_0x113a30(++_0x1e816d);}(_0x13f9,0x1ad));var _0x913f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x13f9[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x913f('0x0'));var zipdir=require(_0x913f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x913f('0x2'));var BPromise=require(_0x913f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x913f('0x4'));var sox=require(_0x913f('0x5'));var csv=require('to-csv');var ejs=require(_0x913f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x913f('0x7'));var squel=require(_0x913f('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x913f('0x9'));var toCsv=require(_0x913f('0xa'));var querystring=require(_0x913f('0xb'));var Papa=require(_0x913f('0xc'));var Redis=require(_0x913f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x913f('0xe'));var as=require(_0x913f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x913f('0x10'))(_0x913f('0x11'));var utils=require(_0x913f('0x12'));var config=require(_0x913f('0x13'));var licenseUtil=require(_0x913f('0x14'));var db=require(_0x913f('0x15'))['db'];function respondWithStatusCode(_0x302c47,_0x5f294e){_0x5f294e=_0x5f294e||0xcc;return function(_0x8750e1){if(_0x8750e1){return _0x302c47[_0x913f('0x16')](_0x5f294e);}return _0x302c47[_0x913f('0x17')](_0x5f294e)['end']();};}function respondWithResult(_0x1e6a77,_0x1f4b1a){_0x1f4b1a=_0x1f4b1a||0xc8;return function(_0x8a9004){if(_0x8a9004){return _0x1e6a77['status'](_0x1f4b1a)[_0x913f('0x18')](_0x8a9004);}};}function respondWithFilteredResult(_0x869887,_0x4c34f4){return function(_0x43b2a3){if(_0x43b2a3){var _0x241f1a=typeof _0x4c34f4['offset']==='undefined'&&typeof _0x4c34f4['limit']===_0x913f('0x19');var _0x531b01=_0x43b2a3['count'];var _0x1edbc8=_0x241f1a?0x0:_0x4c34f4['offset'];var _0x56eea1=_0x241f1a?_0x43b2a3['count']:_0x4c34f4[_0x913f('0x1a')]+_0x4c34f4['limit'];var _0x2fe98f;if(_0x56eea1>=_0x531b01){_0x56eea1=_0x531b01;_0x2fe98f=0xc8;}else{_0x2fe98f=0xce;}_0x869887[_0x913f('0x17')](_0x2fe98f);return _0x869887['set'](_0x913f('0x1b'),_0x1edbc8+'-'+_0x56eea1+'/'+_0x531b01)['json'](_0x43b2a3);}return null;};}function patchUpdates(_0x4a3918){return function(_0x2c50e3){try{jsonpatch['apply'](_0x2c50e3,_0x4a3918,!![]);}catch(_0x1903f3){return BPromise['reject'](_0x1903f3);}return _0x2c50e3[_0x913f('0x1c')]();};}function saveUpdates(_0x3a0217,_0x40fb32){return function(_0x17eeaf){if(_0x17eeaf){return _0x17eeaf['update'](_0x3a0217)[_0x913f('0x1d')](function(_0x2f3318){return _0x2f3318;});}return null;};}function removeEntity(_0x419332,_0xe53227){return function(_0x3116f2){if(_0x3116f2){return _0x3116f2['destroy']()['then'](function(){var _0x34a47f=_0x3116f2['get']({'plain':!![]});var _0x4d847d=_0x913f('0x1e');return db['UserProfileResource'][_0x913f('0x1f')]({'where':{'type':_0x4d847d,'resourceId':_0x34a47f['id']}})[_0x913f('0x1d')](function(){return _0x3116f2;});})['then'](function(){_0x419332[_0x913f('0x17')](0xcc)[_0x913f('0x20')]();});}};}function handleEntityNotFound(_0x13d124,_0x4041eb){return function(_0xd482b1){if(!_0xd482b1){_0x13d124[_0x913f('0x16')](0x194);}return _0xd482b1;};}function handleError(_0x33bef4,_0x2e63af){_0x2e63af=_0x2e63af||0x1f4;return function(_0x3858d0){logger[_0x913f('0x21')](_0x3858d0[_0x913f('0x22')]);if(_0x3858d0[_0x913f('0x23')]){delete _0x3858d0[_0x913f('0x23')];}_0x33bef4[_0x913f('0x17')](_0x2e63af)['send'](_0x3858d0);};}exports['index']=function(_0x57d5c3,_0x253cc1){var _0x51ac4c={},_0x51df53={},_0x23f2cd={'count':0x0,'rows':[]};var _0x338a20=_[_0x913f('0x24')](db['SquareOdbc'][_0x913f('0x25')],function(_0x46169a){return{'name':_0x46169a[_0x913f('0x26')],'type':_0x46169a[_0x913f('0x27')]['key']};});_0x51df53['model']=_[_0x913f('0x24')](_0x338a20,'name');_0x51df53[_0x913f('0x28')]=_['keys'](_0x57d5c3[_0x913f('0x28')]);_0x51df53[_0x913f('0x29')]=_[_0x913f('0x2a')](_0x51df53[_0x913f('0x2b')],_0x51df53[_0x913f('0x28')]);_0x51ac4c[_0x913f('0x2c')]=_[_0x913f('0x2a')](_0x51df53['model'],qs['fields'](_0x57d5c3[_0x913f('0x28')][_0x913f('0x2d')]));_0x51ac4c[_0x913f('0x2c')]=_0x51ac4c['attributes'][_0x913f('0x2e')]?_0x51ac4c[_0x913f('0x2c')]:_0x51df53[_0x913f('0x2b')];if(!_0x57d5c3['query'][_0x913f('0x2f')](_0x913f('0x30'))){_0x51ac4c[_0x913f('0x31')]=qs['limit'](_0x57d5c3['query']['limit']);_0x51ac4c[_0x913f('0x1a')]=qs[_0x913f('0x1a')](_0x57d5c3['query'][_0x913f('0x1a')]);}_0x51ac4c[_0x913f('0x32')]=qs[_0x913f('0x33')](_0x57d5c3['query']['sort']);_0x51ac4c['where']=qs[_0x913f('0x29')](_['pick'](_0x57d5c3[_0x913f('0x28')],_0x51df53[_0x913f('0x29')]),_0x338a20);if(_0x57d5c3[_0x913f('0x28')]['filter']){_0x51ac4c[_0x913f('0x34')]=_[_0x913f('0x35')](_0x51ac4c[_0x913f('0x34')],{'$or':_[_0x913f('0x24')](_0x338a20,function(_0x4e43e9){if(_0x4e43e9[_0x913f('0x27')]!==_0x913f('0x36')){var _0x2ce23a={};_0x2ce23a[_0x4e43e9[_0x913f('0x23')]]={'$like':'%'+_0x57d5c3[_0x913f('0x28')][_0x913f('0x37')]+'%'};return _0x2ce23a;}})});}_0x51ac4c=_[_0x913f('0x35')]({},_0x51ac4c,_0x57d5c3[_0x913f('0x38')]);var _0x50b0a1={'where':_0x51ac4c[_0x913f('0x34')]};return db[_0x913f('0x39')][_0x913f('0x3a')](_0x50b0a1)['then'](function(_0xdef4b0){_0x23f2cd[_0x913f('0x3a')]=_0xdef4b0;if(_0x57d5c3[_0x913f('0x28')][_0x913f('0x3b')]){_0x51ac4c[_0x913f('0x3c')]=[{'all':!![]}];}return db[_0x913f('0x39')]['findAll'](_0x51ac4c);})[_0x913f('0x1d')](function(_0x31699f){_0x23f2cd[_0x913f('0x3d')]=_0x31699f;return _0x23f2cd;})[_0x913f('0x1d')](respondWithFilteredResult(_0x253cc1,_0x51ac4c))[_0x913f('0x3e')](handleError(_0x253cc1,null));};exports[_0x913f('0x3f')]=function(_0x13bce6,_0x3f7c80){var _0x485918={'raw':!![],'where':{'id':_0x13bce6[_0x913f('0x40')]['id']}},_0x4651a6={};_0x4651a6['model']=_['keys'](db[_0x913f('0x39')][_0x913f('0x25')]);_0x4651a6['query']=_['keys'](_0x13bce6[_0x913f('0x28')]);_0x4651a6[_0x913f('0x29')]=_['intersection'](_0x4651a6[_0x913f('0x2b')],_0x4651a6[_0x913f('0x28')]);_0x485918[_0x913f('0x2c')]=_[_0x913f('0x2a')](_0x4651a6[_0x913f('0x2b')],qs[_0x913f('0x2d')](_0x13bce6[_0x913f('0x28')][_0x913f('0x2d')]));_0x485918[_0x913f('0x2c')]=_0x485918['attributes']['length']?_0x485918[_0x913f('0x2c')]:_0x4651a6[_0x913f('0x2b')];if(_0x13bce6[_0x913f('0x28')]['includeAll']){_0x485918['include']=[{'all':!![]}];}_0x485918=_[_0x913f('0x35')]({},_0x485918,_0x13bce6[_0x913f('0x38')]);return db[_0x913f('0x39')][_0x913f('0x41')](_0x485918)[_0x913f('0x1d')](handleEntityNotFound(_0x3f7c80,null))[_0x913f('0x1d')](respondWithResult(_0x3f7c80,null))['catch'](handleError(_0x3f7c80,null));};exports[_0x913f('0x42')]=function(_0x5cdbb0,_0x2c47e4){return db[_0x913f('0x39')][_0x913f('0x42')](_0x5cdbb0[_0x913f('0x43')],{})['then'](function(_0xa3a95b){var _0x3be8ea=_0x5cdbb0[_0x913f('0x44')][_0x913f('0x45')]({'plain':!![]});if(!_0x3be8ea)throw new Error(_0x913f('0x46'));if(_0x3be8ea[_0x913f('0x47')]===_0x913f('0x44')){var _0x253435=_0xa3a95b[_0x913f('0x45')]({'plain':!![]});var _0x524665=_0x913f('0x1e');return db[_0x913f('0x48')]['find']({'where':{'name':_0x524665,'userProfileId':_0x3be8ea[_0x913f('0x49')]},'raw':!![]})[_0x913f('0x1d')](function(_0x421682){if(_0x421682&&_0x421682['autoAssociation']===0x0){return db[_0x913f('0x4a')][_0x913f('0x42')]({'name':_0x253435[_0x913f('0x23')],'resourceId':_0x253435['id'],'type':_0x421682[_0x913f('0x23')],'sectionId':_0x421682['id']},{})['then'](function(){return _0xa3a95b;});}else{return _0xa3a95b;}})['catch'](function(_0x28450a){logger[_0x913f('0x21')](_0x913f('0x4b'),_0x28450a);throw _0x28450a;});}return _0xa3a95b;})[_0x913f('0x1d')](respondWithResult(_0x2c47e4,0xc9))[_0x913f('0x3e')](handleError(_0x2c47e4,null));};exports[_0x913f('0x4c')]=function(_0x4073e2,_0x1d5c21){if(_0x4073e2[_0x913f('0x43')]['id']){delete _0x4073e2[_0x913f('0x43')]['id'];}return db[_0x913f('0x39')][_0x913f('0x41')]({'where':{'id':_0x4073e2[_0x913f('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d5c21,null))[_0x913f('0x1d')](saveUpdates(_0x4073e2[_0x913f('0x43')],null))[_0x913f('0x1d')](respondWithResult(_0x1d5c21,null))[_0x913f('0x3e')](handleError(_0x1d5c21,null));};exports[_0x913f('0x1f')]=function(_0x213d72,_0x4c2873){return db[_0x913f('0x39')][_0x913f('0x41')]({'where':{'id':_0x213d72[_0x913f('0x40')]['id']}})[_0x913f('0x1d')](handleEntityNotFound(_0x4c2873,null))[_0x913f('0x1d')](removeEntity(_0x4c2873,null))['catch'](handleError(_0x4c2873,null));};exports['test']=function(_0xceaaad,_0x2517f8,_0x30750e){var _0x4af145;return db[_0x913f('0x39')]['find']({'where':{'id':_0xceaaad['params']['id']},'attributes':['id',_0x913f('0x4d')]})[_0x913f('0x1d')](handleEntityNotFound(_0x2517f8,null))[_0x913f('0x1d')](function(_0x44c919){if(_0x44c919){var _0x186ea4=require(_0x913f('0x4e'))();_0x186ea4['openSync'](_0x44c919[_0x913f('0x4d')]);_0x186ea4['closeSync']();return _0x44c919;}})[_0x913f('0x1d')](respondWithResult(_0x2517f8,null))[_0x913f('0x3e')](handleError(_0x2517f8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d6e6de2..9b800ab 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 _0x42eb=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','lodash','api','moment','bluebird','request-promise'];(function(_0x411f85,_0x334d79){var _0x14402d=function(_0x357c31){while(--_0x357c31){_0x411f85['push'](_0x411f85['shift']());}};_0x14402d(++_0x334d79);}(_0x42eb,0x74));var _0xb42e=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x42eb[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0xb42e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb42e('0x1'));var moment=require(_0xb42e('0x2'));var BPromise=require(_0xb42e('0x3'));var rp=require(_0xb42e('0x4'));var fs=require('fs');var path=require(_0xb42e('0x5'));var rimraf=require(_0xb42e('0x6'));var config=require(_0xb42e('0x7'));var attributes=require(_0xb42e('0x8'));module[_0xb42e('0x9')]=function(_0x1b569a,_0x4d0f41){return _0x1b569a['define'](_0xb42e('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce9f=['square_odbc','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc'];(function(_0x3dfff5,_0x4ff80c){var _0x217287=function(_0x32b4ac){while(--_0x32b4ac){_0x3dfff5['push'](_0x3dfff5['shift']());}};_0x217287(++_0x4ff80c);}(_0xce9f,0xb5));var _0xfce9=function(_0x583524,_0x238987){_0x583524=_0x583524-0x0;var _0x52613b=_0xce9f[_0x583524];return _0x52613b;};'use strict';var _=require(_0xfce9('0x0'));var util=require(_0xfce9('0x1'));var logger=require(_0xfce9('0x2'))(_0xfce9('0x3'));var moment=require(_0xfce9('0x4'));var BPromise=require('bluebird');var rp=require(_0xfce9('0x5'));var fs=require('fs');var path=require(_0xfce9('0x6'));var rimraf=require('rimraf');var config=require(_0xfce9('0x7'));var attributes=require(_0xfce9('0x8'));module[_0xfce9('0x9')]=function(_0x9045cf,_0x55e0bc){return _0x9045cf['define'](_0xfce9('0xa'),attributes,{'tableName':_0xfce9('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 e8c97cf..b1dc079 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 _0x4758=['error','code','message','result','catch','SquareOdbc','find','options','raw','include','model','attributes','map','ShowSquareOdbc','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44ec3a,_0xc95a13){var _0x18bf5f=function(_0x2aa14d){while(--_0x2aa14d){_0x44ec3a['push'](_0x44ec3a['shift']());}};_0x18bf5f(++_0xc95a13);}(_0x4758,0x10e));var _0x8475=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4758[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8475('0x0'));var util=require(_0x8475('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8475('0x2'));var db=require(_0x8475('0x3'))['db'];var utils=require(_0x8475('0x4'));var logger=require(_0x8475('0x5'))('rpc');var config=require(_0x8475('0x6'));var jayson=require(_0x8475('0x7'));var client=jayson[_0x8475('0x8')][_0x8475('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f3942,_0x122f0a,_0x152d72){return new BPromise(function(_0x37fde0,_0x27824b){return client[_0x8475('0xa')](_0x3f3942,_0x152d72)[_0x8475('0xb')](function(_0x4d3beb){logger[_0x8475('0xc')](_0x8475('0xd'),_0x122f0a,_0x8475('0xe'));logger[_0x8475('0xf')](_0x8475('0x10'),_0x122f0a,_0x8475('0xe'),JSON[_0x8475('0x11')](_0x4d3beb));if(_0x4d3beb[_0x8475('0x12')]){if(_0x4d3beb[_0x8475('0x12')][_0x8475('0x13')]===0x1f4){logger[_0x8475('0x12')](_0x8475('0xd'),_0x122f0a,_0x4d3beb[_0x8475('0x12')]['message']);return _0x27824b(_0x4d3beb[_0x8475('0x12')][_0x8475('0x14')]);}logger[_0x8475('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x122f0a,_0x4d3beb[_0x8475('0x12')][_0x8475('0x14')]);return _0x37fde0(_0x4d3beb['error'][_0x8475('0x14')]);}else{logger[_0x8475('0xc')](_0x8475('0xd'),_0x122f0a,_0x8475('0xe'));_0x37fde0(_0x4d3beb[_0x8475('0x15')][_0x8475('0x14')]);}})[_0x8475('0x16')](function(_0x4eaec9){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x122f0a,_0x4eaec9);_0x27824b(_0x4eaec9);});});}exports['ShowSquareOdbc']=function(_0x24bfd9){var _0x50a748=this;return new Promise(function(_0x455d6e,_0x3bf3e9){return db[_0x8475('0x17')][_0x8475('0x18')]({'raw':_0x24bfd9[_0x8475('0x19')]?_0x24bfd9[_0x8475('0x19')][_0x8475('0x1a')]===undefined?!![]:![]:!![],'where':_0x24bfd9[_0x8475('0x19')]?_0x24bfd9[_0x8475('0x19')]['where']||null:null,'attributes':_0x24bfd9[_0x8475('0x19')]?_0x24bfd9['options']['attributes']||null:null,'include':_0x24bfd9['options']?_0x24bfd9['options'][_0x8475('0x1b')]?_['map'](_0x24bfd9[_0x8475('0x19')]['include'],function(_0x30a249){return{'model':db[_0x30a249[_0x8475('0x1c')]],'as':_0x30a249['as'],'attributes':_0x30a249[_0x8475('0x1d')],'include':_0x30a249['include']?_[_0x8475('0x1e')](_0x30a249[_0x8475('0x1b')],function(_0x38238a){return{'model':db[_0x38238a['model']],'as':_0x38238a['as'],'attributes':_0x38238a[_0x8475('0x1d')],'include':_0x38238a[_0x8475('0x1b')]?_[_0x8475('0x1e')](_0x38238a[_0x8475('0x1b')],function(_0x33421c){return{'model':db[_0x33421c[_0x8475('0x1c')]],'as':_0x33421c['as'],'attributes':_0x33421c[_0x8475('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8475('0xb')](function(_0x406900){logger[_0x8475('0xc')](_0x8475('0x1f'),_0x24bfd9);logger[_0x8475('0xf')](_0x8475('0x1f'),_0x24bfd9,JSON[_0x8475('0x11')](_0x406900));_0x455d6e(_0x406900);})[_0x8475('0x16')](function(_0x4cded9){logger[_0x8475('0x12')](_0x8475('0x1f'),_0x4cded9[_0x8475('0x14')],_0x24bfd9);_0x3bf3e9(_0x50a748[_0x8475('0x12')](0x1f4,_0x4cded9[_0x8475('0x14')]));});});}; \ No newline at end of file +var _0x9a21=['model','map','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include'];(function(_0x146c17,_0x15028e){var _0x3a5e45=function(_0x33459d){while(--_0x33459d){_0x146c17['push'](_0x146c17['shift']());}};_0x3a5e45(++_0x15028e);}(_0x9a21,0x16b));var _0x19a2=function(_0x56e6e9,_0x291627){_0x56e6e9=_0x56e6e9-0x0;var _0x5e3a01=_0x9a21[_0x56e6e9];return _0x5e3a01;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x19a2('0x0'));var BPromise=require(_0x19a2('0x1'));var rs=require(_0x19a2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19a2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x19a2('0x4'))(_0x19a2('0x5'));var config=require(_0x19a2('0x6'));var jayson=require(_0x19a2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x205110,_0xe80faa,_0x272e30){return new BPromise(function(_0x32d13d,_0xa6a4f7){return client[_0x19a2('0x8')](_0x205110,_0x272e30)[_0x19a2('0x9')](function(_0xf7fe27){logger[_0x19a2('0xa')]('SquareOdbc,\x20%s,\x20%s',_0xe80faa,_0x19a2('0xb'));logger[_0x19a2('0xc')](_0x19a2('0xd'),_0xe80faa,_0x19a2('0xb'),JSON[_0x19a2('0xe')](_0xf7fe27));if(_0xf7fe27[_0x19a2('0xf')]){if(_0xf7fe27['error'][_0x19a2('0x10')]===0x1f4){logger['error'](_0x19a2('0x11'),_0xe80faa,_0xf7fe27[_0x19a2('0xf')]['message']);return _0xa6a4f7(_0xf7fe27[_0x19a2('0xf')][_0x19a2('0x12')]);}logger[_0x19a2('0xf')]('SquareOdbc,\x20%s,\x20%s',_0xe80faa,_0xf7fe27['error'][_0x19a2('0x12')]);return _0x32d13d(_0xf7fe27['error'][_0x19a2('0x12')]);}else{logger[_0x19a2('0xa')](_0x19a2('0x11'),_0xe80faa,_0x19a2('0xb'));_0x32d13d(_0xf7fe27[_0x19a2('0x13')][_0x19a2('0x12')]);}})['catch'](function(_0x2a1035){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xe80faa,_0x2a1035);_0xa6a4f7(_0x2a1035);});});}exports[_0x19a2('0x14')]=function(_0x57c370){var _0x4fc5a6=this;return new Promise(function(_0x5b1e21,_0x45955b){return db[_0x19a2('0x15')]['find']({'raw':_0x57c370[_0x19a2('0x16')]?_0x57c370[_0x19a2('0x16')][_0x19a2('0x17')]===undefined?!![]:![]:!![],'where':_0x57c370['options']?_0x57c370['options'][_0x19a2('0x18')]||null:null,'attributes':_0x57c370[_0x19a2('0x16')]?_0x57c370[_0x19a2('0x16')][_0x19a2('0x19')]||null:null,'include':_0x57c370['options']?_0x57c370[_0x19a2('0x16')][_0x19a2('0x1a')]?_['map'](_0x57c370['options'][_0x19a2('0x1a')],function(_0x579187){return{'model':db[_0x579187[_0x19a2('0x1b')]],'as':_0x579187['as'],'attributes':_0x579187[_0x19a2('0x19')],'include':_0x579187[_0x19a2('0x1a')]?_['map'](_0x579187['include'],function(_0x5d6a27){return{'model':db[_0x5d6a27[_0x19a2('0x1b')]],'as':_0x5d6a27['as'],'attributes':_0x5d6a27[_0x19a2('0x19')],'include':_0x5d6a27[_0x19a2('0x1a')]?_[_0x19a2('0x1c')](_0x5d6a27[_0x19a2('0x1a')],function(_0x2e292e){return{'model':db[_0x2e292e[_0x19a2('0x1b')]],'as':_0x2e292e['as'],'attributes':_0x2e292e[_0x19a2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x19a2('0x9')](function(_0x3fbcb6){logger[_0x19a2('0xa')](_0x19a2('0x14'),_0x57c370);logger[_0x19a2('0xc')](_0x19a2('0x14'),_0x57c370,JSON[_0x19a2('0xe')](_0x3fbcb6));_0x5b1e21(_0x3fbcb6);})[_0x19a2('0x1d')](function(_0x2b8f50){logger[_0x19a2('0xf')](_0x19a2('0x14'),_0x2b8f50['message'],_0x57c370);_0x45955b(_0x4fc5a6[_0x19a2('0xf')](0x1f4,_0x2b8f50[_0x19a2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4db25b6..eecbf42 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 _0x2a5c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','isAuthenticated','getUsers','post','create','/:id/users','addUsers','put','/:id','update','delete','destroy','removeUsers','exports','multer'];(function(_0x36aec4,_0x3130fe){var _0x44755a=function(_0x54754c){while(--_0x54754c){_0x36aec4['push'](_0x36aec4['shift']());}};_0x44755a(++_0x3130fe);}(_0x2a5c,0x1f3));var _0xc2a5=function(_0x385856,_0xac02a8){_0x385856=_0x385856-0x0;var _0x55b857=_0x2a5c[_0x385856];return _0x55b857;};'use strict';var multer=require(_0xc2a5('0x0'));var util=require(_0xc2a5('0x1'));var path=require(_0xc2a5('0x2'));var timeout=require(_0xc2a5('0x3'));var express=require(_0xc2a5('0x4'));var router=express['Router']();var fs_extra=require(_0xc2a5('0x5'));var auth=require(_0xc2a5('0x6'));var interaction=require(_0xc2a5('0x7'));var config=require(_0xc2a5('0x8'));var controller=require('./squareProject.controller');router[_0xc2a5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc2a5('0xa')]);router[_0xc2a5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc2a5('0xb')]);router[_0xc2a5('0x9')]('/:id/users',auth[_0xc2a5('0xc')](),controller[_0xc2a5('0xd')]);router[_0xc2a5('0xe')]('/',auth[_0xc2a5('0xc')](),controller[_0xc2a5('0xf')]);router[_0xc2a5('0xe')](_0xc2a5('0x10'),auth[_0xc2a5('0xc')](),controller[_0xc2a5('0x11')]);router[_0xc2a5('0x12')](_0xc2a5('0x13'),auth['isAuthenticated'](),controller[_0xc2a5('0x14')]);router[_0xc2a5('0x15')](_0xc2a5('0x13'),auth[_0xc2a5('0xc')](),controller[_0xc2a5('0x16')]);router[_0xc2a5('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xc2a5('0x17')]);module[_0xc2a5('0x18')]=router; \ No newline at end of file +var _0xa509=['getUsers','post','create','addUsers','put','/:id','update','delete','removeUsers','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','get','/:id/users'];(function(_0x374b08,_0x26f0ef){var _0x3abec8=function(_0x5d6271){while(--_0x5d6271){_0x374b08['push'](_0x374b08['shift']());}};_0x3abec8(++_0x26f0ef);}(_0xa509,0x12f));var _0x9a50=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa509[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x9a50('0x0'));var util=require(_0x9a50('0x1'));var path=require(_0x9a50('0x2'));var timeout=require(_0x9a50('0x3'));var express=require('express');var router=express[_0x9a50('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a50('0x5'));var interaction=require(_0x9a50('0x6'));var config=require(_0x9a50('0x7'));var controller=require(_0x9a50('0x8'));router['get']('/',auth[_0x9a50('0x9')](),controller['index']);router[_0x9a50('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x9a50('0xb'),auth[_0x9a50('0x9')](),controller[_0x9a50('0xc')]);router[_0x9a50('0xd')]('/',auth[_0x9a50('0x9')](),controller[_0x9a50('0xe')]);router[_0x9a50('0xd')](_0x9a50('0xb'),auth[_0x9a50('0x9')](),controller[_0x9a50('0xf')]);router[_0x9a50('0x10')](_0x9a50('0x11'),auth[_0x9a50('0x9')](),controller[_0x9a50('0x12')]);router[_0x9a50('0x13')](_0x9a50('0x11'),auth[_0x9a50('0x9')](),controller['destroy']);router['delete'](_0x9a50('0xb'),auth[_0x9a50('0x9')](),controller[_0x9a50('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3b894ac..d29ef5c 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 _0xea21=['name','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING'];(function(_0x4b6cd1,_0x2449b9){var _0x46a883=function(_0x1e068d){while(--_0x1e068d){_0x4b6cd1['push'](_0x4b6cd1['shift']());}};_0x46a883(++_0x2449b9);}(_0xea21,0xf4));var _0x1ea2=function(_0x2d83a0,_0x455d1f){_0x2d83a0=_0x2d83a0-0x0;var _0x161351=_0xea21[_0x2d83a0];return _0x161351;};'use strict';var Sequelize=require(_0x1ea2('0x0'));module[_0x1ea2('0x1')]={'name':{'type':Sequelize[_0x1ea2('0x2')],'unique':_0x1ea2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1ea2('0x2')]},'notes':{'type':Sequelize[_0x1ea2('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x1ea2('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x1ea2('0x6')](_0x1ea2('0x7'))[_0x1ea2('0x8')](_0x1ea2('0x9'));}}},'production':{'type':Sequelize[_0x1ea2('0xa')]('long'),'get':function(){if(this['getDataValue'](_0x1ea2('0xb'))){return this[_0x1ea2('0x6')]('production')['toString'](_0x1ea2('0x9'));}}},'savedAt':{'type':Sequelize[_0x1ea2('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2c9b=['utf8','DATE','sequelize','exports','STRING','TEXT','BLOB','long','preproduction','getDataValue','toString'];(function(_0xd6e343,_0x41a619){var _0x5c0e4a=function(_0x2a8e6a){while(--_0x2a8e6a){_0xd6e343['push'](_0xd6e343['shift']());}};_0x5c0e4a(++_0x41a619);}(_0x2c9b,0x141));var _0xb2c9=function(_0x51b8a3,_0x4c49af){_0x51b8a3=_0x51b8a3-0x0;var _0x40ed9d=_0x2c9b[_0x51b8a3];return _0x40ed9d;};'use strict';var Sequelize=require(_0xb2c9('0x0'));module[_0xb2c9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb2c9('0x2')]},'notes':{'type':Sequelize[_0xb2c9('0x3')]},'preproduction':{'type':Sequelize[_0xb2c9('0x4')](_0xb2c9('0x5')),'get':function(){if(this['getDataValue'](_0xb2c9('0x6'))){return this[_0xb2c9('0x7')]('preproduction')[_0xb2c9('0x8')](_0xb2c9('0x9'));}}},'production':{'type':Sequelize[_0xb2c9('0x4')](_0xb2c9('0x5')),'get':function(){if(this[_0xb2c9('0x7')]('production')){return this['getDataValue']('production')['toString'](_0xb2c9('0x9'));}}},'savedAt':{'type':Sequelize[_0xb2c9('0xa')]},'publishedAt':{'type':Sequelize[_0xb2c9('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 0cdb398..bd51a54 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 _0x0ebc=['includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareProject'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0ebc,0xef));var _0xc0eb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0ebc[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xc0eb('0x0'));var rimraf=require(_0xc0eb('0x1'));var zipdir=require(_0xc0eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0eb('0x3'));var moment=require(_0xc0eb('0x4'));var BPromise=require(_0xc0eb('0x5'));var Mustache=require(_0xc0eb('0x6'));var util=require('util');var path=require(_0xc0eb('0x7'));var sox=require(_0xc0eb('0x8'));var csv=require('to-csv');var ejs=require(_0xc0eb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc0eb('0xa'));var crypto=require(_0xc0eb('0xb'));var jsforce=require(_0xc0eb('0xc'));var deskjs=require(_0xc0eb('0xd'));var toCsv=require(_0xc0eb('0xe'));var querystring=require(_0xc0eb('0xf'));var Papa=require(_0xc0eb('0x10'));var Redis=require(_0xc0eb('0x11'));var authService=require(_0xc0eb('0x12'));var qs=require(_0xc0eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0eb('0x14'))('api');var utils=require(_0xc0eb('0x15'));var config=require(_0xc0eb('0x16'));var licenseUtil=require(_0xc0eb('0x17'));var db=require(_0xc0eb('0x18'))['db'];config['redis']=_[_0xc0eb('0x19')](config[_0xc0eb('0x1a')],{'host':_0xc0eb('0x1b'),'port':0x18eb});var socket=require(_0xc0eb('0x1c'))(new Redis(config['redis']));require(_0xc0eb('0x1d'))[_0xc0eb('0x1e')](socket);function respondWithStatusCode(_0x2d4716,_0x4393cc){_0x4393cc=_0x4393cc||0xcc;return function(_0x20cb1d){if(_0x20cb1d){return _0x2d4716[_0xc0eb('0x1f')](_0x4393cc);}return _0x2d4716[_0xc0eb('0x20')](_0x4393cc)[_0xc0eb('0x21')]();};}function respondWithResult(_0x3ef50b,_0x4a862d){_0x4a862d=_0x4a862d||0xc8;return function(_0x166677){if(_0x166677){return _0x3ef50b[_0xc0eb('0x20')](_0x4a862d)[_0xc0eb('0x22')](_0x166677);}};}function respondWithFilteredResult(_0x3fde37,_0x4bd8c3){return function(_0x3c5cfd){if(_0x3c5cfd){var _0x2219a6=typeof _0x4bd8c3['offset']===_0xc0eb('0x23')&&typeof _0x4bd8c3[_0xc0eb('0x24')]==='undefined';var _0x3bfd07=_0x3c5cfd['count'];var _0x17e3e3=_0x2219a6?0x0:_0x4bd8c3[_0xc0eb('0x25')];var _0x240f45=_0x2219a6?_0x3c5cfd[_0xc0eb('0x26')]:_0x4bd8c3[_0xc0eb('0x25')]+_0x4bd8c3[_0xc0eb('0x24')];var _0x2d54f2;if(_0x240f45>=_0x3bfd07){_0x240f45=_0x3bfd07;_0x2d54f2=0xc8;}else{_0x2d54f2=0xce;}_0x3fde37[_0xc0eb('0x20')](_0x2d54f2);return _0x3fde37[_0xc0eb('0x27')](_0xc0eb('0x28'),_0x17e3e3+'-'+_0x240f45+'/'+_0x3bfd07)[_0xc0eb('0x22')](_0x3c5cfd);}return null;};}function patchUpdates(_0xea0c7e){return function(_0x1f1541){try{jsonpatch[_0xc0eb('0x29')](_0x1f1541,_0xea0c7e,!![]);}catch(_0x4d9b68){return BPromise[_0xc0eb('0x2a')](_0x4d9b68);}return _0x1f1541[_0xc0eb('0x2b')]();};}function saveUpdates(_0x4eef97,_0x1b00cb){return function(_0x2ba746){if(_0x2ba746){return _0x2ba746['update'](_0x4eef97)[_0xc0eb('0x2c')](function(_0x58acbc){return _0x58acbc;});}return null;};}function removeEntity(_0x3224ef,_0xfcb233){return function(_0x4fe9bc){if(_0x4fe9bc){return _0x4fe9bc[_0xc0eb('0x2d')]()[_0xc0eb('0x2c')](function(){var _0x190f29=_0x4fe9bc[_0xc0eb('0x2e')]({'plain':!![]});var _0x3d5c5c=_0xc0eb('0x2f');return db[_0xc0eb('0x30')][_0xc0eb('0x2d')]({'where':{'type':_0x3d5c5c,'resourceId':_0x190f29['id']}})['then'](function(){return _0x4fe9bc;});})[_0xc0eb('0x2c')](function(){_0x3224ef[_0xc0eb('0x20')](0xcc)[_0xc0eb('0x21')]();});}};}function handleEntityNotFound(_0x33f249,_0xabf409){return function(_0x5bb967){if(!_0x5bb967){_0x33f249[_0xc0eb('0x1f')](0x194);}return _0x5bb967;};}function handleError(_0x3ce17e,_0x29fa79){_0x29fa79=_0x29fa79||0x1f4;return function(_0x1b82e7){logger[_0xc0eb('0x31')](_0x1b82e7[_0xc0eb('0x32')]);if(_0x1b82e7[_0xc0eb('0x33')]){delete _0x1b82e7[_0xc0eb('0x33')];}_0x3ce17e[_0xc0eb('0x20')](_0x29fa79)[_0xc0eb('0x34')](_0x1b82e7);};}exports[_0xc0eb('0x35')]=function(_0x5ac878,_0x23a142){var _0x3e14bc={},_0x67533b={},_0x21ca78={'count':0x0,'rows':[]};var _0x10dbc4=_[_0xc0eb('0x36')](db['SquareProject'][_0xc0eb('0x37')],function(_0x960e65){return{'name':_0x960e65['fieldName'],'type':_0x960e65[_0xc0eb('0x38')][_0xc0eb('0x39')]};});_0x67533b[_0xc0eb('0x3a')]=_[_0xc0eb('0x36')](_0x10dbc4,_0xc0eb('0x33'));_0x67533b[_0xc0eb('0x3b')]=_['keys'](_0x5ac878[_0xc0eb('0x3b')]);_0x67533b[_0xc0eb('0x3c')]=_[_0xc0eb('0x3d')](_0x67533b[_0xc0eb('0x3a')],_0x67533b[_0xc0eb('0x3b')]);_0x3e14bc[_0xc0eb('0x3e')]=_[_0xc0eb('0x3d')](_0x67533b['model'],qs[_0xc0eb('0x3f')](_0x5ac878[_0xc0eb('0x3b')]['fields']));_0x3e14bc[_0xc0eb('0x3e')]=_0x3e14bc[_0xc0eb('0x3e')][_0xc0eb('0x40')]?_0x3e14bc[_0xc0eb('0x3e')]:_0x67533b[_0xc0eb('0x3a')];if(!_0x5ac878['query'][_0xc0eb('0x41')](_0xc0eb('0x42'))){_0x3e14bc[_0xc0eb('0x24')]=qs[_0xc0eb('0x24')](_0x5ac878['query'][_0xc0eb('0x24')]);_0x3e14bc[_0xc0eb('0x25')]=qs['offset'](_0x5ac878['query'][_0xc0eb('0x25')]);}_0x3e14bc[_0xc0eb('0x43')]=qs[_0xc0eb('0x44')](_0x5ac878[_0xc0eb('0x3b')][_0xc0eb('0x44')]);_0x3e14bc[_0xc0eb('0x45')]=qs['filters'](_[_0xc0eb('0x46')](_0x5ac878[_0xc0eb('0x3b')],_0x67533b[_0xc0eb('0x3c')]),_0x10dbc4);if(_0x5ac878[_0xc0eb('0x3b')]['filter']){_0x3e14bc[_0xc0eb('0x45')]=_[_0xc0eb('0x47')](_0x3e14bc[_0xc0eb('0x45')],{'$or':_['map'](_0x10dbc4,function(_0xbfbecc){if(_0xbfbecc[_0xc0eb('0x38')]!==_0xc0eb('0x48')){var _0x3c4381={};_0x3c4381[_0xbfbecc[_0xc0eb('0x33')]]={'$like':'%'+_0x5ac878[_0xc0eb('0x3b')][_0xc0eb('0x49')]+'%'};return _0x3c4381;}})});}_0x3e14bc=_['merge']({},_0x3e14bc,_0x5ac878[_0xc0eb('0x4a')]);var _0x73c374={'where':_0x3e14bc[_0xc0eb('0x45')]};return db[_0xc0eb('0x4b')][_0xc0eb('0x26')](_0x73c374)['then'](function(_0x1bb59a){_0x21ca78[_0xc0eb('0x26')]=_0x1bb59a;if(_0x5ac878[_0xc0eb('0x3b')][_0xc0eb('0x4c')]){_0x3e14bc[_0xc0eb('0x4d')]=[{'all':!![]}];}return db['SquareProject'][_0xc0eb('0x4e')](_0x3e14bc);})[_0xc0eb('0x2c')](function(_0x24f02e){_0x21ca78[_0xc0eb('0x4f')]=_0x24f02e;return _0x21ca78;})[_0xc0eb('0x2c')](respondWithFilteredResult(_0x23a142,_0x3e14bc))[_0xc0eb('0x50')](handleError(_0x23a142,null));};exports[_0xc0eb('0x51')]=function(_0x47591f,_0x107a71){var _0x42332a={'raw':![],'where':{'id':_0x47591f[_0xc0eb('0x52')]['id']}},_0x456c40={};_0x456c40[_0xc0eb('0x3a')]=_['keys'](db[_0xc0eb('0x4b')][_0xc0eb('0x37')]);_0x456c40[_0xc0eb('0x3b')]=_[_0xc0eb('0x53')](_0x47591f[_0xc0eb('0x3b')]);_0x456c40['filters']=_[_0xc0eb('0x3d')](_0x456c40[_0xc0eb('0x3a')],_0x456c40[_0xc0eb('0x3b')]);_0x42332a['attributes']=_[_0xc0eb('0x3d')](_0x456c40[_0xc0eb('0x3a')],qs['fields'](_0x47591f[_0xc0eb('0x3b')][_0xc0eb('0x3f')]));_0x42332a[_0xc0eb('0x3e')]=_0x42332a[_0xc0eb('0x3e')][_0xc0eb('0x40')]?_0x42332a[_0xc0eb('0x3e')]:_0x456c40[_0xc0eb('0x3a')];if(_0x47591f[_0xc0eb('0x3b')][_0xc0eb('0x4c')]){_0x42332a[_0xc0eb('0x4d')]=[{'all':!![]}];}_0x42332a=_[_0xc0eb('0x47')]({},_0x42332a,_0x47591f['options']);return db[_0xc0eb('0x4b')][_0xc0eb('0x54')](_0x42332a)[_0xc0eb('0x2c')](handleEntityNotFound(_0x107a71,null))[_0xc0eb('0x2c')](respondWithResult(_0x107a71,null))[_0xc0eb('0x50')](handleError(_0x107a71,null));};exports[_0xc0eb('0x55')]=function(_0x560ba3,_0x2da2a3){return db[_0xc0eb('0x4b')][_0xc0eb('0x55')](_0x560ba3['body'],{})['then'](function(_0x353f4e){var _0x5c16c7=_0x560ba3[_0xc0eb('0x56')][_0xc0eb('0x2e')]({'plain':!![]});if(!_0x5c16c7)throw new Error(_0xc0eb('0x57'));if(_0x5c16c7[_0xc0eb('0x58')]===_0xc0eb('0x56')){var _0x177600=_0x353f4e['get']({'plain':!![]});var _0x235e2d=_0xc0eb('0x2f');return db[_0xc0eb('0x59')][_0xc0eb('0x54')]({'where':{'name':_0x235e2d,'userProfileId':_0x5c16c7[_0xc0eb('0x5a')]},'raw':!![]})[_0xc0eb('0x2c')](function(_0x16f3af){if(_0x16f3af&&_0x16f3af[_0xc0eb('0x5b')]===0x0){return db[_0xc0eb('0x30')]['create']({'name':_0x177600[_0xc0eb('0x33')],'resourceId':_0x177600['id'],'type':_0x16f3af[_0xc0eb('0x33')],'sectionId':_0x16f3af['id']},{})['then'](function(){return _0x353f4e;});}else{return _0x353f4e;}})[_0xc0eb('0x50')](function(_0x585e53){logger['error'](_0xc0eb('0x5c'),_0x585e53);throw _0x585e53;});}return _0x353f4e;})[_0xc0eb('0x2c')](respondWithResult(_0x2da2a3,0xc9))['catch'](handleError(_0x2da2a3,null));};exports[_0xc0eb('0x5d')]=function(_0x4f03fe,_0x2e1adb){if(_0x4f03fe[_0xc0eb('0x5e')]['id']){delete _0x4f03fe[_0xc0eb('0x5e')]['id'];}return db[_0xc0eb('0x4b')][_0xc0eb('0x54')]({'where':{'id':_0x4f03fe['params']['id']}})[_0xc0eb('0x2c')](handleEntityNotFound(_0x2e1adb,null))[_0xc0eb('0x2c')](saveUpdates(_0x4f03fe[_0xc0eb('0x5e')],null))[_0xc0eb('0x2c')](respondWithResult(_0x2e1adb,null))[_0xc0eb('0x50')](handleError(_0x2e1adb,null));};exports[_0xc0eb('0x2d')]=function(_0x44d1cb,_0x1a760d){return db[_0xc0eb('0x4b')][_0xc0eb('0x54')]({'where':{'id':_0x44d1cb[_0xc0eb('0x52')]['id']}})[_0xc0eb('0x2c')](handleEntityNotFound(_0x1a760d,null))[_0xc0eb('0x2c')](removeEntity(_0x1a760d,null))[_0xc0eb('0x50')](handleError(_0x1a760d,null));};exports[_0xc0eb('0x5f')]=function(_0x42d1f2,_0x30d4df,_0x358606){return db['SquareProject']['find']({'where':{'id':_0x42d1f2[_0xc0eb('0x52')]['id']}})[_0xc0eb('0x2c')](handleEntityNotFound(_0x30d4df,null))[_0xc0eb('0x2c')](function(_0xb967fb){if(_0xb967fb){return _0xb967fb[_0xc0eb('0x5f')](_0x42d1f2[_0xc0eb('0x5e')]['ids'],_[_0xc0eb('0x60')](_0x42d1f2[_0xc0eb('0x5e')],[_0xc0eb('0x61'),'id'])||{});}})[_0xc0eb('0x2c')](respondWithResult(_0x30d4df,null))['catch'](handleError(_0x30d4df,null));};exports[_0xc0eb('0x62')]=function(_0x57d41d,_0x3022de,_0x3904f0){return db['SquareProject'][_0xc0eb('0x54')]({'where':{'id':_0x57d41d[_0xc0eb('0x52')]['id']}})[_0xc0eb('0x2c')](handleEntityNotFound(_0x3022de,null))['then'](function(_0x14d5fc){if(_0x14d5fc){return _0x14d5fc[_0xc0eb('0x62')](_0x57d41d[_0xc0eb('0x3b')][_0xc0eb('0x61')])[_0xc0eb('0x2c')](function(){if(_[_0xc0eb('0x63')](_0x57d41d[_0xc0eb('0x3b')][_0xc0eb('0x61')])){for(var _0x4ac839=0x0;_0x4ac839<_0x57d41d['query'][_0xc0eb('0x61')]['length'];_0x4ac839+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x57d41d[_0xc0eb('0x3b')][_0xc0eb('0x61')][_0x4ac839]),'SquareProjectId':Number(_0x57d41d['params']['id'])});}}else{socket[_0xc0eb('0x64')](_0xc0eb('0x65'),{'UserId':Number(_0x57d41d[_0xc0eb('0x3b')][_0xc0eb('0x61')]),'SquareProjectId':Number(_0x57d41d['params']['id'])});}});}})[_0xc0eb('0x2c')](respondWithStatusCode(_0x3022de,null))['catch'](handleError(_0x3022de,null));};exports[_0xc0eb('0x66')]=function(_0x3dc6a4,_0x52b8e4,_0x133404){var _0x318999={};var _0x3cfd02={};var _0x5e83e7;var _0x405c04;return db['SquareProject'][_0xc0eb('0x67')]({'where':{'id':_0x3dc6a4[_0xc0eb('0x52')]['id']}})[_0xc0eb('0x2c')](handleEntityNotFound(_0x52b8e4,null))['then'](function(_0x114e4d){if(_0x114e4d){_0x5e83e7=_0x114e4d;_0x3cfd02[_0xc0eb('0x3a')]=_['keys'](db[_0xc0eb('0x68')][_0xc0eb('0x37')]);_0x3cfd02[_0xc0eb('0x3b')]=_[_0xc0eb('0x53')](_0x3dc6a4[_0xc0eb('0x3b')]);_0x3cfd02[_0xc0eb('0x3c')]=_[_0xc0eb('0x3d')](_0x3cfd02['model'],_0x3cfd02[_0xc0eb('0x3b')]);_0x318999[_0xc0eb('0x3e')]=_[_0xc0eb('0x3d')](_0x3cfd02['model'],qs['fields'](_0x3dc6a4['query'][_0xc0eb('0x3f')]));_0x318999[_0xc0eb('0x3e')]=_0x318999['attributes'][_0xc0eb('0x40')]?_0x318999[_0xc0eb('0x3e')]:_0x3cfd02[_0xc0eb('0x3a')];_0x318999[_0xc0eb('0x43')]=qs[_0xc0eb('0x44')](_0x3dc6a4[_0xc0eb('0x3b')][_0xc0eb('0x44')]);_0x318999[_0xc0eb('0x45')]=qs[_0xc0eb('0x3c')](_[_0xc0eb('0x46')](_0x3dc6a4[_0xc0eb('0x3b')],_0x3cfd02[_0xc0eb('0x3c')]));if(_0x3dc6a4['query']['filter']){_0x318999['where']=_[_0xc0eb('0x47')](_0x318999[_0xc0eb('0x45')],{'$or':_[_0xc0eb('0x36')](_0x318999['attributes'],function(_0x18c057){var _0x39e79f={};_0x39e79f[_0x18c057]={'$like':'%'+_0x3dc6a4['query']['filter']+'%'};return _0x39e79f;})});}_0x318999=_[_0xc0eb('0x47')]({},_0x318999,_0x3dc6a4['options']);return _0x5e83e7[_0xc0eb('0x66')](_0x318999);}})[_0xc0eb('0x2c')](function(_0x4d3af2){if(_0x4d3af2){_0x405c04=_0x4d3af2['length'];if(!_0x3dc6a4[_0xc0eb('0x3b')][_0xc0eb('0x41')]('nolimit')){_0x318999[_0xc0eb('0x24')]=qs[_0xc0eb('0x24')](_0x3dc6a4['query'][_0xc0eb('0x24')]);_0x318999[_0xc0eb('0x25')]=qs[_0xc0eb('0x25')](_0x3dc6a4[_0xc0eb('0x3b')][_0xc0eb('0x25')]);}return _0x5e83e7['getUsers'](_0x318999);}})[_0xc0eb('0x2c')](function(_0x3ef502){if(_0x3ef502){return _0x3ef502?{'count':_0x405c04,'rows':_0x3ef502}:null;}})[_0xc0eb('0x2c')](respondWithResult(_0x52b8e4,null))[_0xc0eb('0x50')](handleError(_0x52b8e4,null));}; \ No newline at end of file +var _0xdf46=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','update','body','addUsers','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','SquareProjects','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xdf46,0x88));var _0x6df4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdf46[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x6df4('0x0'));var rimraf=require(_0x6df4('0x1'));var zipdir=require(_0x6df4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6df4('0x3'));var moment=require(_0x6df4('0x4'));var BPromise=require(_0x6df4('0x5'));var Mustache=require(_0x6df4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6df4('0x7'));var csv=require(_0x6df4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6df4('0x9'));var _=require('lodash');var squel=require(_0x6df4('0xa'));var crypto=require(_0x6df4('0xb'));var jsforce=require(_0x6df4('0xc'));var deskjs=require(_0x6df4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6df4('0xe'));var Papa=require('papaparse');var Redis=require(_0x6df4('0xf'));var authService=require(_0x6df4('0x10'));var qs=require(_0x6df4('0x11'));var as=require(_0x6df4('0x12'));var hardwareService=require(_0x6df4('0x13'));var logger=require('../../config/logger')(_0x6df4('0x14'));var utils=require('../../config/utils');var config=require(_0x6df4('0x15'));var licenseUtil=require(_0x6df4('0x16'));var db=require(_0x6df4('0x17'))['db'];config['redis']=_[_0x6df4('0x18')](config['redis'],{'host':_0x6df4('0x19'),'port':0x18eb});var socket=require(_0x6df4('0x1a'))(new Redis(config[_0x6df4('0x1b')]));require(_0x6df4('0x1c'))[_0x6df4('0x1d')](socket);function respondWithStatusCode(_0x2a5875,_0x2c6978){_0x2c6978=_0x2c6978||0xcc;return function(_0x2ff45a){if(_0x2ff45a){return _0x2a5875['sendStatus'](_0x2c6978);}return _0x2a5875['status'](_0x2c6978)[_0x6df4('0x1e')]();};}function respondWithResult(_0x1180b,_0xdcf290){_0xdcf290=_0xdcf290||0xc8;return function(_0x2a4eca){if(_0x2a4eca){return _0x1180b[_0x6df4('0x1f')](_0xdcf290)[_0x6df4('0x20')](_0x2a4eca);}};}function respondWithFilteredResult(_0x4d9620,_0x68d33f){return function(_0x95ba08){if(_0x95ba08){var _0x1fd841=typeof _0x68d33f['offset']===_0x6df4('0x21')&&typeof _0x68d33f[_0x6df4('0x22')]===_0x6df4('0x21');var _0x117ed4=_0x95ba08[_0x6df4('0x23')];var _0x4499bd=_0x1fd841?0x0:_0x68d33f[_0x6df4('0x24')];var _0x4a94c2=_0x1fd841?_0x95ba08[_0x6df4('0x23')]:_0x68d33f['offset']+_0x68d33f[_0x6df4('0x22')];var _0x38188c;if(_0x4a94c2>=_0x117ed4){_0x4a94c2=_0x117ed4;_0x38188c=0xc8;}else{_0x38188c=0xce;}_0x4d9620['status'](_0x38188c);return _0x4d9620[_0x6df4('0x25')](_0x6df4('0x26'),_0x4499bd+'-'+_0x4a94c2+'/'+_0x117ed4)[_0x6df4('0x20')](_0x95ba08);}return null;};}function patchUpdates(_0x41aa16){return function(_0x1fa5c8){try{jsonpatch[_0x6df4('0x27')](_0x1fa5c8,_0x41aa16,!![]);}catch(_0x4b4d7e){return BPromise[_0x6df4('0x28')](_0x4b4d7e);}return _0x1fa5c8[_0x6df4('0x29')]();};}function saveUpdates(_0x45fb36,_0x3c760c){return function(_0x20ea1c){if(_0x20ea1c){return _0x20ea1c['update'](_0x45fb36)[_0x6df4('0x2a')](function(_0x3bf4f6){return _0x3bf4f6;});}return null;};}function removeEntity(_0x4fd153,_0x440a5a){return function(_0x4c12d7){if(_0x4c12d7){return _0x4c12d7[_0x6df4('0x2b')]()[_0x6df4('0x2a')](function(){var _0x3d0fb0=_0x4c12d7['get']({'plain':!![]});var _0x3ba5c8=_0x6df4('0x2c');return db[_0x6df4('0x2d')]['destroy']({'where':{'type':_0x3ba5c8,'resourceId':_0x3d0fb0['id']}})[_0x6df4('0x2a')](function(){return _0x4c12d7;});})[_0x6df4('0x2a')](function(){_0x4fd153['status'](0xcc)[_0x6df4('0x1e')]();});}};}function handleEntityNotFound(_0x5281c8,_0x43b3d6){return function(_0x5678cd){if(!_0x5678cd){_0x5281c8[_0x6df4('0x2e')](0x194);}return _0x5678cd;};}function handleError(_0x37f4ad,_0x56ef88){_0x56ef88=_0x56ef88||0x1f4;return function(_0x1051f9){logger[_0x6df4('0x2f')](_0x1051f9[_0x6df4('0x30')]);if(_0x1051f9[_0x6df4('0x31')]){delete _0x1051f9[_0x6df4('0x31')];}_0x37f4ad['status'](_0x56ef88)[_0x6df4('0x32')](_0x1051f9);};}exports[_0x6df4('0x33')]=function(_0x1f2942,_0x5d93cc){var _0x404edf={},_0x2a2d7e={},_0x43ed79={'count':0x0,'rows':[]};var _0x577d55=_[_0x6df4('0x34')](db[_0x6df4('0x35')][_0x6df4('0x36')],function(_0x41bda2){return{'name':_0x41bda2[_0x6df4('0x37')],'type':_0x41bda2[_0x6df4('0x38')]['key']};});_0x2a2d7e['model']=_[_0x6df4('0x34')](_0x577d55,'name');_0x2a2d7e[_0x6df4('0x39')]=_[_0x6df4('0x3a')](_0x1f2942[_0x6df4('0x39')]);_0x2a2d7e[_0x6df4('0x3b')]=_[_0x6df4('0x3c')](_0x2a2d7e[_0x6df4('0x3d')],_0x2a2d7e[_0x6df4('0x39')]);_0x404edf[_0x6df4('0x3e')]=_['intersection'](_0x2a2d7e['model'],qs[_0x6df4('0x3f')](_0x1f2942[_0x6df4('0x39')][_0x6df4('0x3f')]));_0x404edf['attributes']=_0x404edf['attributes'][_0x6df4('0x40')]?_0x404edf[_0x6df4('0x3e')]:_0x2a2d7e[_0x6df4('0x3d')];if(!_0x1f2942[_0x6df4('0x39')][_0x6df4('0x41')](_0x6df4('0x42'))){_0x404edf[_0x6df4('0x22')]=qs[_0x6df4('0x22')](_0x1f2942['query'][_0x6df4('0x22')]);_0x404edf[_0x6df4('0x24')]=qs[_0x6df4('0x24')](_0x1f2942[_0x6df4('0x39')][_0x6df4('0x24')]);}_0x404edf[_0x6df4('0x43')]=qs[_0x6df4('0x44')](_0x1f2942[_0x6df4('0x39')]['sort']);_0x404edf[_0x6df4('0x45')]=qs['filters'](_[_0x6df4('0x46')](_0x1f2942['query'],_0x2a2d7e[_0x6df4('0x3b')]),_0x577d55);if(_0x1f2942[_0x6df4('0x39')][_0x6df4('0x47')]){_0x404edf[_0x6df4('0x45')]=_[_0x6df4('0x48')](_0x404edf[_0x6df4('0x45')],{'$or':_[_0x6df4('0x34')](_0x577d55,function(_0x43da05){if(_0x43da05[_0x6df4('0x38')]!==_0x6df4('0x49')){var _0x2f11a8={};_0x2f11a8[_0x43da05[_0x6df4('0x31')]]={'$like':'%'+_0x1f2942['query'][_0x6df4('0x47')]+'%'};return _0x2f11a8;}})});}_0x404edf=_[_0x6df4('0x48')]({},_0x404edf,_0x1f2942['options']);var _0x239b2a={'where':_0x404edf[_0x6df4('0x45')]};return db['SquareProject'][_0x6df4('0x23')](_0x239b2a)[_0x6df4('0x2a')](function(_0x1f2325){_0x43ed79[_0x6df4('0x23')]=_0x1f2325;if(_0x1f2942[_0x6df4('0x39')][_0x6df4('0x4a')]){_0x404edf['include']=[{'all':!![]}];}return db['SquareProject'][_0x6df4('0x4b')](_0x404edf);})['then'](function(_0x1d00e1){_0x43ed79[_0x6df4('0x4c')]=_0x1d00e1;return _0x43ed79;})['then'](respondWithFilteredResult(_0x5d93cc,_0x404edf))[_0x6df4('0x4d')](handleError(_0x5d93cc,null));};exports[_0x6df4('0x4e')]=function(_0x272fd0,_0x24d5e4){var _0x2f9903={'raw':![],'where':{'id':_0x272fd0[_0x6df4('0x4f')]['id']}},_0x355558={};_0x355558['model']=_['keys'](db[_0x6df4('0x35')][_0x6df4('0x36')]);_0x355558[_0x6df4('0x39')]=_[_0x6df4('0x3a')](_0x272fd0[_0x6df4('0x39')]);_0x355558[_0x6df4('0x3b')]=_[_0x6df4('0x3c')](_0x355558[_0x6df4('0x3d')],_0x355558[_0x6df4('0x39')]);_0x2f9903[_0x6df4('0x3e')]=_['intersection'](_0x355558[_0x6df4('0x3d')],qs[_0x6df4('0x3f')](_0x272fd0['query'][_0x6df4('0x3f')]));_0x2f9903[_0x6df4('0x3e')]=_0x2f9903['attributes'][_0x6df4('0x40')]?_0x2f9903[_0x6df4('0x3e')]:_0x355558[_0x6df4('0x3d')];if(_0x272fd0['query'][_0x6df4('0x4a')]){_0x2f9903['include']=[{'all':!![]}];}_0x2f9903=_['merge']({},_0x2f9903,_0x272fd0[_0x6df4('0x50')]);return db[_0x6df4('0x35')][_0x6df4('0x51')](_0x2f9903)[_0x6df4('0x2a')](handleEntityNotFound(_0x24d5e4,null))['then'](respondWithResult(_0x24d5e4,null))[_0x6df4('0x4d')](handleError(_0x24d5e4,null));};exports['create']=function(_0x214c9e,_0x20ca3e){return db['SquareProject']['create'](_0x214c9e['body'],{})[_0x6df4('0x2a')](function(_0x23f0c8){var _0x4cd809=_0x214c9e[_0x6df4('0x52')][_0x6df4('0x53')]({'plain':!![]});if(!_0x4cd809)throw new Error(_0x6df4('0x54'));if(_0x4cd809[_0x6df4('0x55')]===_0x6df4('0x52')){var _0x3c39be=_0x23f0c8[_0x6df4('0x53')]({'plain':!![]});var _0x3742cd=_0x6df4('0x2c');return db[_0x6df4('0x56')][_0x6df4('0x51')]({'where':{'name':_0x3742cd,'userProfileId':_0x4cd809[_0x6df4('0x57')]},'raw':!![]})[_0x6df4('0x2a')](function(_0x1da7e9){if(_0x1da7e9&&_0x1da7e9[_0x6df4('0x58')]===0x0){return db[_0x6df4('0x2d')][_0x6df4('0x59')]({'name':_0x3c39be[_0x6df4('0x31')],'resourceId':_0x3c39be['id'],'type':_0x1da7e9[_0x6df4('0x31')],'sectionId':_0x1da7e9['id']},{})[_0x6df4('0x2a')](function(){return _0x23f0c8;});}else{return _0x23f0c8;}})[_0x6df4('0x4d')](function(_0x1e8d9f){logger[_0x6df4('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e8d9f);throw _0x1e8d9f;});}return _0x23f0c8;})[_0x6df4('0x2a')](respondWithResult(_0x20ca3e,0xc9))[_0x6df4('0x4d')](handleError(_0x20ca3e,null));};exports[_0x6df4('0x5a')]=function(_0x56752a,_0x38ef30){if(_0x56752a[_0x6df4('0x5b')]['id']){delete _0x56752a['body']['id'];}return db[_0x6df4('0x35')]['find']({'where':{'id':_0x56752a[_0x6df4('0x4f')]['id']}})[_0x6df4('0x2a')](handleEntityNotFound(_0x38ef30,null))[_0x6df4('0x2a')](saveUpdates(_0x56752a[_0x6df4('0x5b')],null))['then'](respondWithResult(_0x38ef30,null))[_0x6df4('0x4d')](handleError(_0x38ef30,null));};exports['destroy']=function(_0x42cba3,_0x5e6160){return db[_0x6df4('0x35')][_0x6df4('0x51')]({'where':{'id':_0x42cba3[_0x6df4('0x4f')]['id']}})[_0x6df4('0x2a')](handleEntityNotFound(_0x5e6160,null))[_0x6df4('0x2a')](removeEntity(_0x5e6160,null))[_0x6df4('0x4d')](handleError(_0x5e6160,null));};exports['addUsers']=function(_0x5dad4f,_0x30cb86,_0x109045){return db['SquareProject'][_0x6df4('0x51')]({'where':{'id':_0x5dad4f[_0x6df4('0x4f')]['id']}})[_0x6df4('0x2a')](handleEntityNotFound(_0x30cb86,null))[_0x6df4('0x2a')](function(_0x45d0e7){if(_0x45d0e7){return _0x45d0e7[_0x6df4('0x5c')](_0x5dad4f['body'][_0x6df4('0x5d')],_['omit'](_0x5dad4f['body'],[_0x6df4('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x30cb86,null))[_0x6df4('0x4d')](handleError(_0x30cb86,null));};exports[_0x6df4('0x5e')]=function(_0x15cea3,_0x5616ab,_0x47269d){return db[_0x6df4('0x35')]['find']({'where':{'id':_0x15cea3[_0x6df4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5616ab,null))[_0x6df4('0x2a')](function(_0x212188){if(_0x212188){return _0x212188['removeUsers'](_0x15cea3[_0x6df4('0x39')][_0x6df4('0x5d')])[_0x6df4('0x2a')](function(){if(_[_0x6df4('0x5f')](_0x15cea3[_0x6df4('0x39')][_0x6df4('0x5d')])){for(var _0x35c158=0x0;_0x35c158<_0x15cea3[_0x6df4('0x39')][_0x6df4('0x5d')]['length'];_0x35c158+=0x1){socket['emit'](_0x6df4('0x60'),{'UserId':Number(_0x15cea3[_0x6df4('0x39')]['ids'][_0x35c158]),'SquareProjectId':Number(_0x15cea3[_0x6df4('0x4f')]['id'])});}}else{socket[_0x6df4('0x61')](_0x6df4('0x60'),{'UserId':Number(_0x15cea3[_0x6df4('0x39')]['ids']),'SquareProjectId':Number(_0x15cea3[_0x6df4('0x4f')]['id'])});}});}})[_0x6df4('0x2a')](respondWithStatusCode(_0x5616ab,null))[_0x6df4('0x4d')](handleError(_0x5616ab,null));};exports[_0x6df4('0x62')]=function(_0x36b7d7,_0x2604b0,_0xedbbd0){var _0x43784e={};var _0x400aec={};var _0x1aeab3;var _0x21b762;return db['SquareProject'][_0x6df4('0x63')]({'where':{'id':_0x36b7d7[_0x6df4('0x4f')]['id']}})[_0x6df4('0x2a')](handleEntityNotFound(_0x2604b0,null))[_0x6df4('0x2a')](function(_0x5b9754){if(_0x5b9754){_0x1aeab3=_0x5b9754;_0x400aec[_0x6df4('0x3d')]=_[_0x6df4('0x3a')](db[_0x6df4('0x64')][_0x6df4('0x36')]);_0x400aec[_0x6df4('0x39')]=_[_0x6df4('0x3a')](_0x36b7d7[_0x6df4('0x39')]);_0x400aec['filters']=_['intersection'](_0x400aec['model'],_0x400aec[_0x6df4('0x39')]);_0x43784e[_0x6df4('0x3e')]=_[_0x6df4('0x3c')](_0x400aec['model'],qs[_0x6df4('0x3f')](_0x36b7d7[_0x6df4('0x39')][_0x6df4('0x3f')]));_0x43784e[_0x6df4('0x3e')]=_0x43784e['attributes'][_0x6df4('0x40')]?_0x43784e[_0x6df4('0x3e')]:_0x400aec['model'];_0x43784e['order']=qs[_0x6df4('0x44')](_0x36b7d7[_0x6df4('0x39')][_0x6df4('0x44')]);_0x43784e[_0x6df4('0x45')]=qs[_0x6df4('0x3b')](_[_0x6df4('0x46')](_0x36b7d7[_0x6df4('0x39')],_0x400aec[_0x6df4('0x3b')]));if(_0x36b7d7[_0x6df4('0x39')][_0x6df4('0x47')]){_0x43784e[_0x6df4('0x45')]=_[_0x6df4('0x48')](_0x43784e[_0x6df4('0x45')],{'$or':_[_0x6df4('0x34')](_0x43784e[_0x6df4('0x3e')],function(_0x211693){var _0x42aea9={};_0x42aea9[_0x211693]={'$like':'%'+_0x36b7d7[_0x6df4('0x39')][_0x6df4('0x47')]+'%'};return _0x42aea9;})});}_0x43784e=_['merge']({},_0x43784e,_0x36b7d7[_0x6df4('0x50')]);return _0x1aeab3[_0x6df4('0x62')](_0x43784e);}})[_0x6df4('0x2a')](function(_0x13ce75){if(_0x13ce75){_0x21b762=_0x13ce75[_0x6df4('0x40')];if(!_0x36b7d7[_0x6df4('0x39')][_0x6df4('0x41')](_0x6df4('0x42'))){_0x43784e[_0x6df4('0x22')]=qs[_0x6df4('0x22')](_0x36b7d7['query'][_0x6df4('0x22')]);_0x43784e[_0x6df4('0x24')]=qs['offset'](_0x36b7d7[_0x6df4('0x39')][_0x6df4('0x24')]);}return _0x1aeab3['getUsers'](_0x43784e);}})[_0x6df4('0x2a')](function(_0x6dce48){if(_0x6dce48){return _0x6dce48?{'count':_0x21b762,'rows':_0x6dce48}:null;}})[_0x6df4('0x2a')](respondWithResult(_0x2604b0,null))[_0x6df4('0x4d')](handleError(_0x2604b0,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8ac0a71..5f68b0a 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 _0x4892=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2f1b4e,_0x57f22e){var _0x29f989=function(_0x4574a2){while(--_0x4574a2){_0x2f1b4e['push'](_0x2f1b4e['shift']());}};_0x29f989(++_0x57f22e);}(_0x4892,0xbe));var _0x2489=function(_0x400323,_0x1fb077){_0x400323=_0x400323-0x0;var _0x133c78=_0x4892[_0x400323];return _0x133c78;};'use strict';var EventEmitter=require(_0x2489('0x0'));var SquareProject=require(_0x2489('0x1'))['db'][_0x2489('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2489('0x3')](0x0);var events={'afterCreate':_0x2489('0x4'),'afterUpdate':_0x2489('0x5'),'afterDestroy':_0x2489('0x6')};function emitEvent(_0x4593c0){return function(_0x15b8f0,_0x1063df,_0x149e08){SquareProjectEvents[_0x2489('0x7')](_0x4593c0+':'+_0x15b8f0['id'],_0x15b8f0);SquareProjectEvents[_0x2489('0x7')](_0x4593c0,_0x15b8f0);_0x149e08(null);};}for(var e in events){if(events[_0x2489('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x2489('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x62b4=['save','remove','emit','exports','events','../../mysqldb','SquareProject'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x62b4,0x10e));var _0x462b=function(_0x2e0854,_0x52544a){_0x2e0854=_0x2e0854-0x0;var _0x4d0ff9=_0x62b4[_0x2e0854];return _0x4d0ff9;};'use strict';var EventEmitter=require(_0x462b('0x0'));var SquareProject=require(_0x462b('0x1'))['db'][_0x462b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x462b('0x3'),'afterUpdate':'update','afterDestroy':_0x462b('0x4')};function emitEvent(_0x5c44a7){return function(_0x4dcc3d,_0x5d7887,_0x12b38c){SquareProjectEvents['emit'](_0x5c44a7+':'+_0x4dcc3d['id'],_0x4dcc3d);SquareProjectEvents[_0x462b('0x5')](_0x5c44a7,_0x4dcc3d);_0x12b38c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x462b('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6f2ede9..334546e 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 _0x0dcc=['bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','publishedAt','util','../../config/logger','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0dcc,0x1e3));var _0xc0dc=function(_0x53c036,_0x1e3e33){_0x53c036=_0x53c036-0x0;var _0x3e3394=_0x0dcc[_0x53c036];return _0x3e3394;};'use strict';var _=require('lodash');var util=require(_0xc0dc('0x0'));var logger=require(_0xc0dc('0x1'))('api');var moment=require(_0xc0dc('0x2'));var BPromise=require(_0xc0dc('0x3'));var rp=require(_0xc0dc('0x4'));var fs=require('fs');var path=require(_0xc0dc('0x5'));var rimraf=require(_0xc0dc('0x6'));var config=require(_0xc0dc('0x7'));var attributes=require(_0xc0dc('0x8'));module[_0xc0dc('0x9')]=function(_0x23fc1a,_0x2337ca){return _0x23fc1a['define'](_0xc0dc('0xa'),attributes,{'tableName':_0xc0dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14d73e,_0x1ece8b,_0x5e3276){if(_0x14d73e['changed'](_0xc0dc('0xc'))){_0x14d73e[_0xc0dc('0xd')]=moment()[_0xc0dc('0xe')](_0xc0dc('0xf'));}if(_0x14d73e[_0xc0dc('0x10')]('production')){_0x14d73e[_0xc0dc('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5e3276(null,_0x14d73e);}}});}; \ No newline at end of file +var _0xec66=['changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareProject.attributes','exports','square_projects'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xec66,0x1f1));var _0x6ec6=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0xec66[_0x3388d8];return _0x2bbe73;};'use strict';var _=require('lodash');var util=require(_0x6ec6('0x0'));var logger=require(_0x6ec6('0x1'))(_0x6ec6('0x2'));var moment=require(_0x6ec6('0x3'));var BPromise=require(_0x6ec6('0x4'));var rp=require(_0x6ec6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ec6('0x6'));var attributes=require(_0x6ec6('0x7'));module[_0x6ec6('0x8')]=function(_0x56401a,_0x5e46d6){return _0x56401a['define']('SquareProject',attributes,{'tableName':_0x6ec6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3cfced,_0x67d8de,_0x4bbae6){if(_0x3cfced[_0x6ec6('0xa')]('preproduction')){_0x3cfced['savedAt']=moment()[_0x6ec6('0xb')](_0x6ec6('0xc'));}if(_0x3cfced[_0x6ec6('0xa')]('production')){_0x3cfced['publishedAt']=moment()[_0x6ec6('0xb')](_0x6ec6('0xc'));}_0x4bbae6(null,_0x3cfced);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 20e8849..0af3431 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 _0xdead=['ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b0322,_0x12a6f9){var _0xdc3394=function(_0x2532e1){while(--_0x2532e1){_0x3b0322['push'](_0x3b0322['shift']());}};_0xdc3394(++_0x12a6f9);}(_0xdead,0x1ad));var _0xddea=function(_0xcd8fab,_0x1d0f1c){_0xcd8fab=_0xcd8fab-0x0;var _0x32cffa=_0xdead[_0xcd8fab];return _0x32cffa;};'use strict';var _=require('lodash');var util=require(_0xddea('0x0'));var moment=require(_0xddea('0x1'));var BPromise=require('bluebird');var rs=require(_0xddea('0x2'));var fs=require('fs');var Redis=require(_0xddea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xddea('0x4'));var logger=require(_0xddea('0x5'))(_0xddea('0x6'));var config=require(_0xddea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xddea('0x8')][_0xddea('0x9')]({'port':0x232a});config[_0xddea('0xa')]=_[_0xddea('0xb')](config[_0xddea('0xa')],{'host':_0xddea('0xc'),'port':0x18eb});var socket=require(_0xddea('0xd'))(new Redis(config[_0xddea('0xa')]));require(_0xddea('0xe'))[_0xddea('0xf')](socket);function respondWithRpcPromise(_0x54fab8,_0x40511f,_0x3ea2d3){return new BPromise(function(_0x1af289,_0x3ae1ae){return client[_0xddea('0x10')](_0x54fab8,_0x3ea2d3)[_0xddea('0x11')](function(_0x5ebde6){logger[_0xddea('0x12')](_0xddea('0x13'),_0x40511f,_0xddea('0x14'));logger[_0xddea('0x15')](_0xddea('0x16'),_0x40511f,_0xddea('0x14'),JSON[_0xddea('0x17')](_0x5ebde6));if(_0x5ebde6['error']){if(_0x5ebde6[_0xddea('0x18')][_0xddea('0x19')]===0x1f4){logger[_0xddea('0x18')](_0xddea('0x13'),_0x40511f,_0x5ebde6['error']['message']);return _0x3ae1ae(_0x5ebde6[_0xddea('0x18')][_0xddea('0x1a')]);}logger[_0xddea('0x18')](_0xddea('0x13'),_0x40511f,_0x5ebde6['error'][_0xddea('0x1a')]);return _0x1af289(_0x5ebde6[_0xddea('0x18')]['message']);}else{logger[_0xddea('0x12')](_0xddea('0x13'),_0x40511f,_0xddea('0x14'));_0x1af289(_0x5ebde6['result'][_0xddea('0x1a')]);}})['catch'](function(_0x2ea1a6){logger[_0xddea('0x18')]('SquareProject,\x20%s,\x20%s',_0x40511f,_0x2ea1a6);_0x3ae1ae(_0x2ea1a6);});});}exports[_0xddea('0x1b')]=function(_0x4be42c){var _0x333529=this;return new Promise(function(_0x2441bd,_0xa975cb){return db[_0xddea('0x1c')][_0xddea('0x1d')]({'raw':_0x4be42c[_0xddea('0x1e')]?_0x4be42c[_0xddea('0x1e')][_0xddea('0x1f')]===undefined?!![]:![]:!![],'where':_0x4be42c[_0xddea('0x1e')]?_0x4be42c[_0xddea('0x1e')][_0xddea('0x20')]||null:null,'attributes':_0x4be42c[_0xddea('0x1e')]?_0x4be42c[_0xddea('0x1e')][_0xddea('0x21')]||null:null,'include':_0x4be42c['options']?_0x4be42c['options'][_0xddea('0x22')]?_[_0xddea('0x23')](_0x4be42c[_0xddea('0x1e')][_0xddea('0x22')],function(_0x4ae72f){return{'model':db[_0x4ae72f[_0xddea('0x24')]],'as':_0x4ae72f['as'],'attributes':_0x4ae72f[_0xddea('0x21')],'include':_0x4ae72f[_0xddea('0x22')]?_[_0xddea('0x23')](_0x4ae72f[_0xddea('0x22')],function(_0x40b36a){return{'model':db[_0x40b36a['model']],'as':_0x40b36a['as'],'attributes':_0x40b36a[_0xddea('0x21')],'include':_0x40b36a[_0xddea('0x22')]?_[_0xddea('0x23')](_0x40b36a[_0xddea('0x22')],function(_0x293693){return{'model':db[_0x293693[_0xddea('0x24')]],'as':_0x293693['as'],'attributes':_0x293693[_0xddea('0x21')]};}):[]};}):[]};}):[]:[]})[_0xddea('0x11')](function(_0xee6a80){logger['info'](_0xddea('0x1b'),_0x4be42c);logger[_0xddea('0x15')](_0xddea('0x1b'),_0x4be42c,JSON[_0xddea('0x17')](_0xee6a80));_0x2441bd(_0xee6a80);})[_0xddea('0x25')](function(_0x238b30){logger['error'](_0xddea('0x1b'),_0x238b30[_0xddea('0x1a')],_0x4be42c);_0xa975cb(_0x333529[_0xddea('0x18')](0x1f4,_0x238b30[_0xddea('0x1a')]));});});}; \ No newline at end of file +var _0xd14a=['request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSquareProject','SquareProject','options','raw','attributes','include','map','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x5027dc,_0x567afa){var _0xc4bd14=function(_0x5b180d){while(--_0x5b180d){_0x5027dc['push'](_0x5027dc['shift']());}};_0xc4bd14(++_0x567afa);}(_0xd14a,0x83));var _0xad14=function(_0x547a79,_0x3de915){_0x547a79=_0x547a79-0x0;var _0x2b6eb8=_0xd14a[_0x547a79];return _0x2b6eb8;};'use strict';var _=require(_0xad14('0x0'));var util=require(_0xad14('0x1'));var moment=require(_0xad14('0x2'));var BPromise=require(_0xad14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad14('0x4'));var db=require(_0xad14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xad14('0x6'))(_0xad14('0x7'));var config=require(_0xad14('0x8'));var jayson=require(_0xad14('0x9'));var client=jayson[_0xad14('0xa')][_0xad14('0xb')]({'port':0x232a});config[_0xad14('0xc')]=_[_0xad14('0xd')](config[_0xad14('0xc')],{'host':_0xad14('0xe'),'port':0x18eb});var socket=require(_0xad14('0xf'))(new Redis(config[_0xad14('0xc')]));require(_0xad14('0x10'))['register'](socket);function respondWithRpcPromise(_0x5dc9ae,_0x3aee6d,_0x441abb){return new BPromise(function(_0x280194,_0x2189f1){return client[_0xad14('0x11')](_0x5dc9ae,_0x441abb)[_0xad14('0x12')](function(_0x698d59){logger[_0xad14('0x13')](_0xad14('0x14'),_0x3aee6d,_0xad14('0x15'));logger[_0xad14('0x16')](_0xad14('0x17'),_0x3aee6d,_0xad14('0x15'),JSON[_0xad14('0x18')](_0x698d59));if(_0x698d59['error']){if(_0x698d59[_0xad14('0x19')][_0xad14('0x1a')]===0x1f4){logger[_0xad14('0x19')](_0xad14('0x14'),_0x3aee6d,_0x698d59['error'][_0xad14('0x1b')]);return _0x2189f1(_0x698d59['error'][_0xad14('0x1b')]);}logger[_0xad14('0x19')](_0xad14('0x14'),_0x3aee6d,_0x698d59[_0xad14('0x19')]['message']);return _0x280194(_0x698d59[_0xad14('0x19')][_0xad14('0x1b')]);}else{logger[_0xad14('0x13')](_0xad14('0x14'),_0x3aee6d,_0xad14('0x15'));_0x280194(_0x698d59['result'][_0xad14('0x1b')]);}})['catch'](function(_0x4526b2){logger['error'](_0xad14('0x14'),_0x3aee6d,_0x4526b2);_0x2189f1(_0x4526b2);});});}exports[_0xad14('0x1c')]=function(_0x136d8c){var _0x544688=this;return new Promise(function(_0x3700bc,_0x56865a){return db[_0xad14('0x1d')]['find']({'raw':_0x136d8c['options']?_0x136d8c[_0xad14('0x1e')][_0xad14('0x1f')]===undefined?!![]:![]:!![],'where':_0x136d8c[_0xad14('0x1e')]?_0x136d8c[_0xad14('0x1e')]['where']||null:null,'attributes':_0x136d8c[_0xad14('0x1e')]?_0x136d8c[_0xad14('0x1e')][_0xad14('0x20')]||null:null,'include':_0x136d8c[_0xad14('0x1e')]?_0x136d8c['options'][_0xad14('0x21')]?_['map'](_0x136d8c[_0xad14('0x1e')]['include'],function(_0x3af722){return{'model':db[_0x3af722['model']],'as':_0x3af722['as'],'attributes':_0x3af722[_0xad14('0x20')],'include':_0x3af722[_0xad14('0x21')]?_[_0xad14('0x22')](_0x3af722[_0xad14('0x21')],function(_0x45b947){return{'model':db[_0x45b947['model']],'as':_0x45b947['as'],'attributes':_0x45b947['attributes'],'include':_0x45b947[_0xad14('0x21')]?_['map'](_0x45b947['include'],function(_0x11899d){return{'model':db[_0x11899d[_0xad14('0x23')]],'as':_0x11899d['as'],'attributes':_0x11899d[_0xad14('0x20')]};}):[]};}):[]};}):[]:[]})[_0xad14('0x12')](function(_0x1950b1){logger['info']('ShowSquareProject',_0x136d8c);logger[_0xad14('0x16')](_0xad14('0x1c'),_0x136d8c,JSON[_0xad14('0x18')](_0x1950b1));_0x3700bc(_0x1950b1);})[_0xad14('0x24')](function(_0x2b2559){logger[_0xad14('0x19')](_0xad14('0x1c'),_0x2b2559[_0xad14('0x1b')],_0x136d8c);_0x56865a(_0x544688[_0xad14('0x19')](0x1f4,_0x2b2559[_0xad14('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 357a014..af7fe1c 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 _0xf042=['squareProject:','./squareProject.events','save','update','emit','removeListener','register','length'];(function(_0xbd8189,_0x2412ea){var _0x59eee8=function(_0x11dff6){while(--_0x11dff6){_0xbd8189['push'](_0xbd8189['shift']());}};_0x59eee8(++_0x2412ea);}(_0xf042,0x1a9));var _0x2f04=function(_0x3b1a20,_0x2fbead){_0x3b1a20=_0x3b1a20-0x0;var _0x296b03=_0xf042[_0x3b1a20];return _0x296b03;};'use strict';var SquareProjectEvents=require(_0x2f04('0x0'));var events=[_0x2f04('0x1'),'remove',_0x2f04('0x2')];function createListener(_0x1894ba,_0xb248a){return function(_0x1440a9){_0xb248a[_0x2f04('0x3')](_0x1894ba,_0x1440a9);};}function removeListener(_0xcceddd,_0x265dc5){return function(){SquareProjectEvents[_0x2f04('0x4')](_0xcceddd,_0x265dc5);};}exports[_0x2f04('0x5')]=function(_0x8b740f){for(var _0x3fcfa7=0x0,_0x865d61=events[_0x2f04('0x6')];_0x3fcfa7<_0x865d61;_0x3fcfa7++){var _0x4b0f11=events[_0x3fcfa7];var _0x4c45c9=createListener(_0x2f04('0x7')+_0x4b0f11,_0x8b740f);SquareProjectEvents['on'](_0x4b0f11,_0x4c45c9);}}; \ No newline at end of file +var _0x985b=['length','squareProject:','save','update','emit','removeListener','register'];(function(_0x3e18a8,_0x482cb4){var _0x20bd0d=function(_0xb63cf){while(--_0xb63cf){_0x3e18a8['push'](_0x3e18a8['shift']());}};_0x20bd0d(++_0x482cb4);}(_0x985b,0x191));var _0xb985=function(_0x6ee93b,_0x573ada){_0x6ee93b=_0x6ee93b-0x0;var _0x4804ca=_0x985b[_0x6ee93b];return _0x4804ca;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb985('0x0'),'remove',_0xb985('0x1')];function createListener(_0x30daea,_0x64babb){return function(_0x53fc90){_0x64babb[_0xb985('0x2')](_0x30daea,_0x53fc90);};}function removeListener(_0x55c637,_0xe160c9){return function(){SquareProjectEvents[_0xb985('0x3')](_0x55c637,_0xe160c9);};}exports[_0xb985('0x4')]=function(_0x3312c2){for(var _0x3b2f30=0x0,_0xf4aee5=events[_0xb985('0x5')];_0x3b2f30<_0xf4aee5;_0x3b2f30++){var _0x2f5677=events[_0x3b2f30];var _0x4f07dd=createListener(_0xb985('0x6')+_0x2f5677,_0x3312c2);SquareProjectEvents['on'](_0x2f5677,_0x4f07dd);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 69b6b10..34a59bb 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x4ef69d,_0x68952e){var _0x5c84a7=function(_0x456b90){while(--_0x456b90){_0x4ef69d['push'](_0x4ef69d['shift']());}};_0x5c84a7(++_0x68952e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x35003c,_0x2c95ec){_0x35003c=_0x35003c-0x0;var _0x4a94bd=_0x1cb9[_0x35003c];return _0x4a94bd;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x57ccc0,_0x194c3e){var _0x47b45a=function(_0x2efc76){while(--_0x2efc76){_0x57ccc0['push'](_0x57ccc0['shift']());}};_0x47b45a(++_0x194c3e);}(_0xf494,0x1c6));var _0x4f49=function(_0x1a7bc9,_0x1b001d){_0x1a7bc9=_0x1a7bc9-0x0;var _0x3b7c98=_0xf494[_0x1a7bc9];return _0x3b7c98;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index c6baf2c..7b795d4 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 _0xbd51=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x5cf82f,_0xebf25f){var _0x3ca524=function(_0x4c466b){while(--_0x4c466b){_0x5cf82f['push'](_0x5cf82f['shift']());}};_0x3ca524(++_0xebf25f);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5ad638,_0x43676f){_0x5ad638=_0x5ad638-0x0;var _0x20db5f=_0xbd51[_0x5ad638];return _0x20db5f;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'callerid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize[_0x1bd5('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1bd5('0x1')]},'saveName':{'type':Sequelize[_0x1bd5('0x1')]},'filename':{'type':Sequelize[_0x1bd5('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1bd5('0x2')],'get':function(){var _0x30a385='';var _0x19077c=this[_0x1bd5('0x3')](_0x1bd5('0x4'));if(_0x19077c){_0x30a385=_0x19077c['substring'](_0x19077c[_0x1bd5('0x5')]('.'));}return _0x30a385;}}}; \ No newline at end of file +var _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0xb86b7a,_0x3fe5c8){var _0x2dead2=function(_0x180c4c){while(--_0x180c4c){_0xb86b7a['push'](_0xb86b7a['shift']());}};_0x2dead2(++_0x3fe5c8);}(_0x5d17,0x114));var _0x75d1=function(_0xe9e6cf,_0x395f6d){_0xe9e6cf=_0xe9e6cf-0x0;var _0x2b8851=_0x5d17[_0xe9e6cf];return _0x2b8851;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9687cf2..652fb7d 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 _0x4adf=['cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','save','then','destroy','name','send','index','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','update','download','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Entity\x20not\x20found'];(function(_0x1aaac9,_0xa095e8){var _0x11823e=function(_0x36fc21){while(--_0x36fc21){_0x1aaac9['push'](_0x1aaac9['shift']());}};_0x11823e(++_0xa095e8);}(_0x4adf,0x121));var _0xf4ad=function(_0x33a735,_0x484371){_0x33a735=_0x33a735-0x0;var _0x19b235=_0x4adf[_0x33a735];return _0x19b235;};'use strict';var emlformat=require(_0xf4ad('0x0'));var rimraf=require(_0xf4ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ad('0x2'));var moment=require('moment');var BPromise=require(_0xf4ad('0x3'));var Mustache=require('mustache');var util=require(_0xf4ad('0x4'));var path=require(_0xf4ad('0x5'));var sox=require('sox');var csv=require(_0xf4ad('0x6'));var ejs=require(_0xf4ad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4ad('0x8'));var squel=require(_0xf4ad('0x9'));var crypto=require(_0xf4ad('0xa'));var jsforce=require(_0xf4ad('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4ad('0xc'));var Redis=require('ioredis');var authService=require(_0xf4ad('0xd'));var qs=require(_0xf4ad('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4ad('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xf4ad('0x10'));var config=require(_0xf4ad('0x11'));var licenseUtil=require(_0xf4ad('0x12'));var db=require(_0xf4ad('0x13'))['db'];function respondWithStatusCode(_0x3beceb,_0x4b34a0){_0x4b34a0=_0x4b34a0||0xcc;return function(_0x44231f){if(_0x44231f){return _0x3beceb[_0xf4ad('0x14')](_0x4b34a0);}return _0x3beceb[_0xf4ad('0x15')](_0x4b34a0)[_0xf4ad('0x16')]();};}function respondWithResult(_0x49190a,_0x14872f){_0x14872f=_0x14872f||0xc8;return function(_0x22bc01){if(_0x22bc01){return _0x49190a[_0xf4ad('0x15')](_0x14872f)['json'](_0x22bc01);}};}function respondWithFilteredResult(_0x1c55bf,_0x5cda0c){return function(_0x76bd3f){if(_0x76bd3f){var _0x499a2e=typeof _0x5cda0c[_0xf4ad('0x17')]==='undefined'&&typeof _0x5cda0c[_0xf4ad('0x18')]==='undefined';var _0x324ff9=_0x76bd3f[_0xf4ad('0x19')];var _0x542c70=_0x499a2e?0x0:_0x5cda0c[_0xf4ad('0x17')];var _0xb6e1e6=_0x499a2e?_0x76bd3f[_0xf4ad('0x19')]:_0x5cda0c['offset']+_0x5cda0c[_0xf4ad('0x18')];var _0xcffcc9;if(_0xb6e1e6>=_0x324ff9){_0xb6e1e6=_0x324ff9;_0xcffcc9=0xc8;}else{_0xcffcc9=0xce;}_0x1c55bf[_0xf4ad('0x15')](_0xcffcc9);return _0x1c55bf['set'](_0xf4ad('0x1a'),_0x542c70+'-'+_0xb6e1e6+'/'+_0x324ff9)[_0xf4ad('0x1b')](_0x76bd3f);}return null;};}function patchUpdates(_0x6597b7){return function(_0x56693f){try{jsonpatch[_0xf4ad('0x1c')](_0x56693f,_0x6597b7,!![]);}catch(_0x475d16){return BPromise[_0xf4ad('0x1d')](_0x475d16);}return _0x56693f[_0xf4ad('0x1e')]();};}function saveUpdates(_0x5f199c,_0x4deda1){return function(_0x332a91){if(_0x332a91){return _0x332a91['update'](_0x5f199c)[_0xf4ad('0x1f')](function(_0x376461){return _0x376461;});}return null;};}function removeEntity(_0x5f0f1a,_0x48130b){return function(_0x2d2d6b){if(_0x2d2d6b){return _0x2d2d6b[_0xf4ad('0x20')]()[_0xf4ad('0x1f')](function(){_0x5f0f1a['status'](0xcc)[_0xf4ad('0x16')]();});}};}function handleEntityNotFound(_0x28027e,_0x54c2a6){return function(_0x3a4720){if(!_0x3a4720){_0x28027e[_0xf4ad('0x14')](0x194);}return _0x3a4720;};}function handleError(_0x5c245e,_0x2536c0){_0x2536c0=_0x2536c0||0x1f4;return function(_0x1f17d2){logger['error'](_0x1f17d2['stack']);if(_0x1f17d2[_0xf4ad('0x21')]){delete _0x1f17d2[_0xf4ad('0x21')];}_0x5c245e[_0xf4ad('0x15')](_0x2536c0)[_0xf4ad('0x22')](_0x1f17d2);};}exports[_0xf4ad('0x23')]=function(_0x5a4455,_0x4eae28){var _0x1dc15a={},_0x5cb469={},_0x275c29={'count':0x0,'rows':[]};var _0xf0ccc1=_['map'](db[_0xf4ad('0x24')][_0xf4ad('0x25')],function(_0xec7284){return{'name':_0xec7284[_0xf4ad('0x26')],'type':_0xec7284['type'][_0xf4ad('0x27')]};});_0x5cb469[_0xf4ad('0x28')]=_['map'](_0xf0ccc1,'name');_0x5cb469[_0xf4ad('0x29')]=_[_0xf4ad('0x2a')](_0x5a4455[_0xf4ad('0x29')]);_0x5cb469[_0xf4ad('0x2b')]=_[_0xf4ad('0x2c')](_0x5cb469[_0xf4ad('0x28')],_0x5cb469['query']);_0x1dc15a[_0xf4ad('0x2d')]=_[_0xf4ad('0x2c')](_0x5cb469[_0xf4ad('0x28')],qs[_0xf4ad('0x2e')](_0x5a4455[_0xf4ad('0x29')][_0xf4ad('0x2e')]));_0x1dc15a[_0xf4ad('0x2d')]=_0x1dc15a['attributes'][_0xf4ad('0x2f')]?_0x1dc15a[_0xf4ad('0x2d')]:_0x5cb469['model'];if(!_0x5a4455[_0xf4ad('0x29')][_0xf4ad('0x30')](_0xf4ad('0x31'))){_0x1dc15a[_0xf4ad('0x18')]=qs[_0xf4ad('0x18')](_0x5a4455[_0xf4ad('0x29')][_0xf4ad('0x18')]);_0x1dc15a[_0xf4ad('0x17')]=qs['offset'](_0x5a4455['query']['offset']);}_0x1dc15a[_0xf4ad('0x32')]=qs[_0xf4ad('0x33')](_0x5a4455[_0xf4ad('0x29')]['sort']);_0x1dc15a[_0xf4ad('0x34')]=qs[_0xf4ad('0x2b')](_[_0xf4ad('0x35')](_0x5a4455['query'],_0x5cb469[_0xf4ad('0x2b')]),_0xf0ccc1);if(_0x5a4455[_0xf4ad('0x29')][_0xf4ad('0x36')]){_0x1dc15a[_0xf4ad('0x34')]=_[_0xf4ad('0x37')](_0x1dc15a[_0xf4ad('0x34')],{'$or':_[_0xf4ad('0x38')](_0xf0ccc1,function(_0x1be711){if(_0x1be711['type']!==_0xf4ad('0x39')){var _0x5c7530={};_0x5c7530[_0x1be711[_0xf4ad('0x21')]]={'$like':'%'+_0x5a4455[_0xf4ad('0x29')][_0xf4ad('0x36')]+'%'};return _0x5c7530;}})});}_0x1dc15a=_['merge']({},_0x1dc15a,_0x5a4455[_0xf4ad('0x3a')]);var _0x5b7be9={'where':_0x1dc15a[_0xf4ad('0x34')]};return db[_0xf4ad('0x24')][_0xf4ad('0x19')](_0x5b7be9)['then'](function(_0x1712a6){_0x275c29[_0xf4ad('0x19')]=_0x1712a6;if(_0x5a4455[_0xf4ad('0x29')]['includeAll']){_0x1dc15a['include']=[{'all':!![]}];}return db['SquareRecording'][_0xf4ad('0x3b')](_0x1dc15a);})[_0xf4ad('0x1f')](function(_0x59e5db){_0x275c29[_0xf4ad('0x3c')]=_0x59e5db;return _0x275c29;})[_0xf4ad('0x1f')](respondWithFilteredResult(_0x4eae28,_0x1dc15a))[_0xf4ad('0x3d')](handleError(_0x4eae28,null));};exports['show']=function(_0x251846,_0x3a70f3){var _0x300079={'raw':!![],'where':{'id':_0x251846[_0xf4ad('0x3e')]['id']}},_0x9c5ed3={};_0x9c5ed3[_0xf4ad('0x28')]=_[_0xf4ad('0x2a')](db['SquareRecording']['rawAttributes']);_0x9c5ed3[_0xf4ad('0x29')]=_[_0xf4ad('0x2a')](_0x251846['query']);_0x9c5ed3['filters']=_[_0xf4ad('0x2c')](_0x9c5ed3['model'],_0x9c5ed3[_0xf4ad('0x29')]);_0x300079[_0xf4ad('0x2d')]=_[_0xf4ad('0x2c')](_0x9c5ed3['model'],qs[_0xf4ad('0x2e')](_0x251846[_0xf4ad('0x29')][_0xf4ad('0x2e')]));_0x300079[_0xf4ad('0x2d')]=_0x300079[_0xf4ad('0x2d')][_0xf4ad('0x2f')]?_0x300079[_0xf4ad('0x2d')]:_0x9c5ed3['model'];if(_0x251846[_0xf4ad('0x29')][_0xf4ad('0x3f')]){_0x300079[_0xf4ad('0x40')]=[{'all':!![]}];}_0x300079=_['merge']({},_0x300079,_0x251846[_0xf4ad('0x3a')]);return db[_0xf4ad('0x24')][_0xf4ad('0x41')](_0x300079)['then'](handleEntityNotFound(_0x3a70f3,null))[_0xf4ad('0x1f')](respondWithResult(_0x3a70f3,null))[_0xf4ad('0x3d')](handleError(_0x3a70f3,null));};exports[_0xf4ad('0x42')]=function(_0x153120,_0x590a55){return db[_0xf4ad('0x24')][_0xf4ad('0x42')](_0x153120[_0xf4ad('0x43')],{})['then'](respondWithResult(_0x590a55,0xc9))[_0xf4ad('0x3d')](handleError(_0x590a55,null));};exports[_0xf4ad('0x44')]=function(_0x26fc73,_0x38c08d){if(_0x26fc73[_0xf4ad('0x43')]['id']){delete _0x26fc73[_0xf4ad('0x43')]['id'];}return db[_0xf4ad('0x24')][_0xf4ad('0x41')]({'where':{'id':_0x26fc73['params']['id']}})[_0xf4ad('0x1f')](handleEntityNotFound(_0x38c08d,null))['then'](saveUpdates(_0x26fc73[_0xf4ad('0x43')],null))[_0xf4ad('0x1f')](respondWithResult(_0x38c08d,null))['catch'](handleError(_0x38c08d,null));};exports[_0xf4ad('0x45')]=function(_0xe04bbb,_0x1a3a4f,_0xadf72){var _0x238473=require('../../components/encryptor');var _0x1e2a1f=![];var _0x557776={};if(_0xe04bbb[_0xf4ad('0x29')][_0xf4ad('0x46')]&&_0xe04bbb[_0xf4ad('0x29')][_0xf4ad('0x46')]===_0xf4ad('0x47')){_0x557776[_0xf4ad('0x47')]=_0xe04bbb['params']['id'];}else{_0x557776['id']=_0xe04bbb['params']['id'];}return db[_0xf4ad('0x24')][_0xf4ad('0x41')]({'where':_0x557776,'attributes':['id',_0xf4ad('0x48'),_0xf4ad('0x49')],'raw':!![]})[_0xf4ad('0x1f')](handleEntityNotFound(_0x1a3a4f,null))[_0xf4ad('0x1f')](function(_0x14984c){if(_0x14984c){var _0x214ec5=_0x14984c[_0xf4ad('0x48')];var _0x265850=util[_0xf4ad('0x4a')](_0xf4ad('0x4b'),_0x214ec5);if(fs[_0xf4ad('0x4c')](_0x265850)){_0x1e2a1f=!![];return _0x238473[_0xf4ad('0x4d')](_0x265850,_0x214ec5,config[_0xf4ad('0x4e')][_0xf4ad('0x4f')])['then'](function(){return _0x14984c;});}return _0x14984c;}})[_0xf4ad('0x1f')](function(_0x57d0c7){if(_0x57d0c7){var _0x2c104d=_0x57d0c7[_0xf4ad('0x48')];if(!fs['existsSync'](_0x2c104d)){throw new db[(_0xf4ad('0x50'))][(_0xf4ad('0x51'))]('SquareRecording\x20not\x20found');}if(_0x57d0c7[_0xf4ad('0x49')]){return _0x1a3a4f[_0xf4ad('0x45')](_0x2c104d,_0x57d0c7[_0xf4ad('0x49')]+path[_0xf4ad('0x52')](_0x2c104d),function(){if(_0x1e2a1f){fs['unlink'](_0x2c104d);}});}else{return _0x1a3a4f[_0xf4ad('0x45')](_0x2c104d,function(_0x50b7dc){if(_0x1e2a1f){fs[_0xf4ad('0x53')](_0x2c104d);}});}}})[_0xf4ad('0x3d')](function(_0x43dccc){if(_0x43dccc[_0xf4ad('0x54')]===_0xf4ad('0x55')){_0x1a3a4f[_0xf4ad('0x15')](0x194)['send']('Not\x20found');}else{return handleError(_0x1a3a4f,null);}});};exports[_0xf4ad('0x20')]=function(_0x4af346,_0x31b572){return db[_0xf4ad('0x24')][_0xf4ad('0x41')]({'where':{'id':_0x4af346[_0xf4ad('0x3e')]['id']}})['then'](function(_0x1d2966){if(_['isNil'](_0x1d2966)){throw new ReferenceError(_0xf4ad('0x56'));}return _0x1d2966;})[_0xf4ad('0x1f')](function(_0x4267d3){var _0x2dcb80=_0x4267d3[_0xf4ad('0x48')];logger['info'](_0xf4ad('0x57'),_0x2dcb80);if(!_[_0xf4ad('0x58')](_0x4267d3['savePath'])&&fs[_0xf4ad('0x4c')](_0x2dcb80)){logger[_0xf4ad('0x59')]('File:\x20\x22'+_0x2dcb80+_0xf4ad('0x5a'));fs[_0xf4ad('0x5b')](_0x2dcb80);}_0x2dcb80=_0x2dcb80+_0xf4ad('0x5c');if(!_['isNil'](_0x4267d3[_0xf4ad('0x48')])&&fs[_0xf4ad('0x4c')](_0x2dcb80)){logger[_0xf4ad('0x59')](_0xf4ad('0x5d')+_0x2dcb80+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf4ad('0x5b')](_0x2dcb80);}return _0x4267d3;})[_0xf4ad('0x1f')](function(_0x506eee){if(!_0x506eee)throw new InternalError();return _0x506eee['destroy']();})[_0xf4ad('0x1f')](function(){_0x31b572[_0xf4ad('0x15')](0xcc)[_0xf4ad('0x16')]();})['catch'](handleError(_0x31b572,null));}; \ No newline at end of file +var _0x939a=['findAll','catch','params','keys','length','include','find','create','body','download','uniqueid','savePath','format','existsSync','decryptFile','secrets','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x939a,0x1e4));var _0xa939=function(_0x55f486,_0x9a56d4){_0x55f486=_0x55f486-0x0;var _0x181589=_0x939a[_0x55f486];return _0x181589;};'use strict';var emlformat=require(_0xa939('0x0'));var rimraf=require(_0xa939('0x1'));var zipdir=require(_0xa939('0x2'));var jsonpatch=require(_0xa939('0x3'));var rp=require(_0xa939('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa939('0x5'));var path=require(_0xa939('0x6'));var sox=require('sox');var csv=require(_0xa939('0x7'));var ejs=require(_0xa939('0x8'));var fs=require('fs');var fs_extra=require(_0xa939('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa939('0xa'));var jsforce=require(_0xa939('0xb'));var deskjs=require(_0xa939('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa939('0xd'));var Redis=require(_0xa939('0xe'));var authService=require(_0xa939('0xf'));var qs=require(_0xa939('0x10'));var as=require(_0xa939('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa939('0x12'));var utils=require(_0xa939('0x13'));var config=require(_0xa939('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa939('0x15'))['db'];function respondWithStatusCode(_0x5b8d0c,_0x3e831a){_0x3e831a=_0x3e831a||0xcc;return function(_0x5836e4){if(_0x5836e4){return _0x5b8d0c[_0xa939('0x16')](_0x3e831a);}return _0x5b8d0c[_0xa939('0x17')](_0x3e831a)[_0xa939('0x18')]();};}function respondWithResult(_0x3b8e7d,_0x322da7){_0x322da7=_0x322da7||0xc8;return function(_0x3eeebf){if(_0x3eeebf){return _0x3b8e7d[_0xa939('0x17')](_0x322da7)[_0xa939('0x19')](_0x3eeebf);}};}function respondWithFilteredResult(_0x1e37fb,_0x30fa55){return function(_0x17a9bb){if(_0x17a9bb){var _0x222554=typeof _0x30fa55[_0xa939('0x1a')]===_0xa939('0x1b')&&typeof _0x30fa55[_0xa939('0x1c')]==='undefined';var _0x9fe18f=_0x17a9bb[_0xa939('0x1d')];var _0x9190ac=_0x222554?0x0:_0x30fa55[_0xa939('0x1a')];var _0x4058db=_0x222554?_0x17a9bb[_0xa939('0x1d')]:_0x30fa55['offset']+_0x30fa55[_0xa939('0x1c')];var _0x44558b;if(_0x4058db>=_0x9fe18f){_0x4058db=_0x9fe18f;_0x44558b=0xc8;}else{_0x44558b=0xce;}_0x1e37fb[_0xa939('0x17')](_0x44558b);return _0x1e37fb[_0xa939('0x1e')](_0xa939('0x1f'),_0x9190ac+'-'+_0x4058db+'/'+_0x9fe18f)['json'](_0x17a9bb);}return null;};}function patchUpdates(_0x53dce8){return function(_0xa50f2a){try{jsonpatch['apply'](_0xa50f2a,_0x53dce8,!![]);}catch(_0x1be723){return BPromise[_0xa939('0x20')](_0x1be723);}return _0xa50f2a[_0xa939('0x21')]();};}function saveUpdates(_0x371a84,_0x1c1199){return function(_0xd2d3a3){if(_0xd2d3a3){return _0xd2d3a3[_0xa939('0x22')](_0x371a84)['then'](function(_0x41fff5){return _0x41fff5;});}return null;};}function removeEntity(_0x5394e7,_0x157188){return function(_0x2db7db){if(_0x2db7db){return _0x2db7db[_0xa939('0x23')]()[_0xa939('0x24')](function(){_0x5394e7[_0xa939('0x17')](0xcc)[_0xa939('0x18')]();});}};}function handleEntityNotFound(_0x52cd17,_0xdf61a9){return function(_0x4ccc41){if(!_0x4ccc41){_0x52cd17[_0xa939('0x16')](0x194);}return _0x4ccc41;};}function handleError(_0x5b5e44,_0x221f7c){_0x221f7c=_0x221f7c||0x1f4;return function(_0xdb746e){logger[_0xa939('0x25')](_0xdb746e[_0xa939('0x26')]);if(_0xdb746e[_0xa939('0x27')]){delete _0xdb746e[_0xa939('0x27')];}_0x5b5e44['status'](_0x221f7c)[_0xa939('0x28')](_0xdb746e);};}exports['index']=function(_0x32c7db,_0x4090ef){var _0x4d9de2={},_0x4f34c4={},_0x5be5bb={'count':0x0,'rows':[]};var _0x28fab9=_[_0xa939('0x29')](db[_0xa939('0x2a')][_0xa939('0x2b')],function(_0x2dfd93){return{'name':_0x2dfd93[_0xa939('0x2c')],'type':_0x2dfd93['type'][_0xa939('0x2d')]};});_0x4f34c4[_0xa939('0x2e')]=_['map'](_0x28fab9,_0xa939('0x27'));_0x4f34c4[_0xa939('0x2f')]=_['keys'](_0x32c7db[_0xa939('0x2f')]);_0x4f34c4[_0xa939('0x30')]=_['intersection'](_0x4f34c4[_0xa939('0x2e')],_0x4f34c4[_0xa939('0x2f')]);_0x4d9de2[_0xa939('0x31')]=_[_0xa939('0x32')](_0x4f34c4[_0xa939('0x2e')],qs['fields'](_0x32c7db[_0xa939('0x2f')][_0xa939('0x33')]));_0x4d9de2[_0xa939('0x31')]=_0x4d9de2[_0xa939('0x31')]['length']?_0x4d9de2[_0xa939('0x31')]:_0x4f34c4['model'];if(!_0x32c7db[_0xa939('0x2f')][_0xa939('0x34')](_0xa939('0x35'))){_0x4d9de2[_0xa939('0x1c')]=qs[_0xa939('0x1c')](_0x32c7db[_0xa939('0x2f')][_0xa939('0x1c')]);_0x4d9de2[_0xa939('0x1a')]=qs[_0xa939('0x1a')](_0x32c7db[_0xa939('0x2f')]['offset']);}_0x4d9de2['order']=qs[_0xa939('0x36')](_0x32c7db[_0xa939('0x2f')][_0xa939('0x36')]);_0x4d9de2[_0xa939('0x37')]=qs[_0xa939('0x30')](_[_0xa939('0x38')](_0x32c7db['query'],_0x4f34c4[_0xa939('0x30')]),_0x28fab9);if(_0x32c7db[_0xa939('0x2f')][_0xa939('0x39')]){_0x4d9de2[_0xa939('0x37')]=_['merge'](_0x4d9de2[_0xa939('0x37')],{'$or':_[_0xa939('0x29')](_0x28fab9,function(_0x28adaf){if(_0x28adaf[_0xa939('0x3a')]!==_0xa939('0x3b')){var _0x1ac263={};_0x1ac263[_0x28adaf[_0xa939('0x27')]]={'$like':'%'+_0x32c7db['query']['filter']+'%'};return _0x1ac263;}})});}_0x4d9de2=_['merge']({},_0x4d9de2,_0x32c7db[_0xa939('0x3c')]);var _0x47a209={'where':_0x4d9de2[_0xa939('0x37')]};return db['SquareRecording'][_0xa939('0x1d')](_0x47a209)[_0xa939('0x24')](function(_0x11cfd3){_0x5be5bb['count']=_0x11cfd3;if(_0x32c7db[_0xa939('0x2f')][_0xa939('0x3d')]){_0x4d9de2['include']=[{'all':!![]}];}return db['SquareRecording'][_0xa939('0x3e')](_0x4d9de2);})[_0xa939('0x24')](function(_0x54dfe2){_0x5be5bb['rows']=_0x54dfe2;return _0x5be5bb;})[_0xa939('0x24')](respondWithFilteredResult(_0x4090ef,_0x4d9de2))[_0xa939('0x3f')](handleError(_0x4090ef,null));};exports['show']=function(_0x371d65,_0x4ca242){var _0x26e51c={'raw':!![],'where':{'id':_0x371d65[_0xa939('0x40')]['id']}},_0x117f1f={};_0x117f1f[_0xa939('0x2e')]=_[_0xa939('0x41')](db['SquareRecording'][_0xa939('0x2b')]);_0x117f1f[_0xa939('0x2f')]=_['keys'](_0x371d65[_0xa939('0x2f')]);_0x117f1f['filters']=_['intersection'](_0x117f1f[_0xa939('0x2e')],_0x117f1f[_0xa939('0x2f')]);_0x26e51c['attributes']=_[_0xa939('0x32')](_0x117f1f[_0xa939('0x2e')],qs['fields'](_0x371d65[_0xa939('0x2f')][_0xa939('0x33')]));_0x26e51c[_0xa939('0x31')]=_0x26e51c[_0xa939('0x31')][_0xa939('0x42')]?_0x26e51c[_0xa939('0x31')]:_0x117f1f['model'];if(_0x371d65['query'][_0xa939('0x3d')]){_0x26e51c[_0xa939('0x43')]=[{'all':!![]}];}_0x26e51c=_['merge']({},_0x26e51c,_0x371d65[_0xa939('0x3c')]);return db[_0xa939('0x2a')][_0xa939('0x44')](_0x26e51c)[_0xa939('0x24')](handleEntityNotFound(_0x4ca242,null))[_0xa939('0x24')](respondWithResult(_0x4ca242,null))[_0xa939('0x3f')](handleError(_0x4ca242,null));};exports['create']=function(_0x358cc2,_0x4ed4d7){return db['SquareRecording'][_0xa939('0x45')](_0x358cc2['body'],{})[_0xa939('0x24')](respondWithResult(_0x4ed4d7,0xc9))[_0xa939('0x3f')](handleError(_0x4ed4d7,null));};exports['update']=function(_0x21b73d,_0x5623a9){if(_0x21b73d['body']['id']){delete _0x21b73d[_0xa939('0x46')]['id'];}return db[_0xa939('0x2a')][_0xa939('0x44')]({'where':{'id':_0x21b73d[_0xa939('0x40')]['id']}})['then'](handleEntityNotFound(_0x5623a9,null))['then'](saveUpdates(_0x21b73d[_0xa939('0x46')],null))[_0xa939('0x24')](respondWithResult(_0x5623a9,null))['catch'](handleError(_0x5623a9,null));};exports[_0xa939('0x47')]=function(_0x1c2cc3,_0xfbb777,_0x3640fb){var _0x4b8144=require('../../components/encryptor');var _0x4dd6b7=![];var _0x177303={};if(_0x1c2cc3[_0xa939('0x2f')]['type']&&_0x1c2cc3[_0xa939('0x2f')]['type']===_0xa939('0x48')){_0x177303[_0xa939('0x48')]=_0x1c2cc3[_0xa939('0x40')]['id'];}else{_0x177303['id']=_0x1c2cc3[_0xa939('0x40')]['id'];}return db[_0xa939('0x2a')][_0xa939('0x44')]({'where':_0x177303,'attributes':['id',_0xa939('0x49'),'filename'],'raw':!![]})[_0xa939('0x24')](handleEntityNotFound(_0xfbb777,null))['then'](function(_0x4c256e){if(_0x4c256e){var _0x5d5d3e=_0x4c256e[_0xa939('0x49')];var _0xc7d884=util[_0xa939('0x4a')]('%s.cypher',_0x5d5d3e);if(fs[_0xa939('0x4b')](_0xc7d884)){_0x4dd6b7=!![];return _0x4b8144[_0xa939('0x4c')](_0xc7d884,_0x5d5d3e,config[_0xa939('0x4d')]['recording'])['then'](function(){return _0x4c256e;});}return _0x4c256e;}})['then'](function(_0x36c9bc){if(_0x36c9bc){var _0x100df3=_0x36c9bc[_0xa939('0x49')];if(!fs[_0xa939('0x4b')](_0x100df3)){throw new db['Sequelize'][(_0xa939('0x4e'))](_0xa939('0x4f'));}if(_0x36c9bc[_0xa939('0x50')]){return _0xfbb777[_0xa939('0x47')](_0x100df3,_0x36c9bc[_0xa939('0x50')]+path[_0xa939('0x51')](_0x100df3),function(){if(_0x4dd6b7){fs[_0xa939('0x52')](_0x100df3);}});}else{return _0xfbb777[_0xa939('0x47')](_0x100df3,function(_0x4ca227){if(_0x4dd6b7){fs[_0xa939('0x52')](_0x100df3);}});}}})[_0xa939('0x3f')](function(_0x2e4676){if(_0x2e4676['message']==='SquareRecording\x20not\x20found'){_0xfbb777[_0xa939('0x17')](0x194)[_0xa939('0x28')](_0xa939('0x53'));}else{return handleError(_0xfbb777,null);}});};exports[_0xa939('0x23')]=function(_0x1bfd17,_0x581247){return db[_0xa939('0x2a')][_0xa939('0x44')]({'where':{'id':_0x1bfd17['params']['id']}})[_0xa939('0x24')](function(_0x1ba287){if(_[_0xa939('0x54')](_0x1ba287)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ba287;})['then'](function(_0x15af0f){var _0x3f2275=_0x15af0f[_0xa939('0x49')];logger[_0xa939('0x55')](_0xa939('0x56'),_0x3f2275);if(!_['isNil'](_0x15af0f[_0xa939('0x49')])&&fs[_0xa939('0x4b')](_0x3f2275)){logger[_0xa939('0x55')](_0xa939('0x57')+_0x3f2275+_0xa939('0x58'));fs['unlinkSync'](_0x3f2275);}_0x3f2275=_0x3f2275+_0xa939('0x59');if(!_['isNil'](_0x15af0f[_0xa939('0x49')])&&fs[_0xa939('0x4b')](_0x3f2275)){logger['info'](_0xa939('0x57')+_0x3f2275+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa939('0x5a')](_0x3f2275);}return _0x15af0f;})[_0xa939('0x24')](function(_0x57faa7){if(!_0x57faa7)throw new InternalError();return _0x57faa7[_0xa939('0x23')]();})[_0xa939('0x24')](function(){_0x581247['status'](0xcc)[_0xa939('0x18')]();})[_0xa939('0x3f')](handleError(_0x581247,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 914cd48..b981a3c 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 _0x6d11=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','request-promise','path','./squareRecording.attributes'];(function(_0x3744ec,_0x4fb078){var _0x3a2da6=function(_0x1dfa93){while(--_0x1dfa93){_0x3744ec['push'](_0x3744ec['shift']());}};_0x3a2da6(++_0x4fb078);}(_0x6d11,0xbf));var _0x16d1=function(_0x445448,_0x5d1127){_0x445448=_0x445448-0x0;var _0x313e1d=_0x6d11[_0x445448];return _0x313e1d;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eba=['square_recordings','util','../../config/logger','api','moment','path','../../config/environment','./squareRecording.attributes','exports'];(function(_0x4a1a02,_0x1d1c2e){var _0x1db28a=function(_0x4675d3){while(--_0x4675d3){_0x4a1a02['push'](_0x4a1a02['shift']());}};_0x1db28a(++_0x1d1c2e);}(_0x2eba,0xc7));var _0xa2eb=function(_0x295b87,_0xab18){_0x295b87=_0x295b87-0x0;var _0x1425f9=_0x2eba[_0x295b87];return _0x1425f9;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('SquareRecording',attributes,{'tableName':_0xa2eb('0x8'),'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 1ce4a0f..2d1f66a 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 _0xdb6a=['request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x102474,_0x39e8e4){var _0x76687f=function(_0x526bd2){while(--_0x526bd2){_0x102474['push'](_0x102474['shift']());}};_0x76687f(++_0x39e8e4);}(_0xdb6a,0x16b));var _0xadb6=function(_0xfd780a,_0x3947cc){_0xfd780a=_0xfd780a-0x0;var _0x12bfa0=_0xdb6a[_0xfd780a];return _0x12bfa0;};'use strict';var _=require(_0xadb6('0x0'));var util=require(_0xadb6('0x1'));var moment=require(_0xadb6('0x2'));var BPromise=require(_0xadb6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xadb6('0x5'));var logger=require(_0xadb6('0x6'))(_0xadb6('0x7'));var config=require(_0xadb6('0x8'));var jayson=require(_0xadb6('0x9'));var client=jayson[_0xadb6('0xa')][_0xadb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d25af,_0xdea653,_0x2d9f45){return new BPromise(function(_0x36947f,_0x71ea91){return client[_0xadb6('0xc')](_0x2d25af,_0x2d9f45)['then'](function(_0x1fdbc8){logger[_0xadb6('0xd')]('SquareRecording,\x20%s,\x20%s',_0xdea653,'request\x20sent');logger[_0xadb6('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xdea653,_0xadb6('0xf'),JSON[_0xadb6('0x10')](_0x1fdbc8));if(_0x1fdbc8[_0xadb6('0x11')]){if(_0x1fdbc8[_0xadb6('0x11')][_0xadb6('0x12')]===0x1f4){logger[_0xadb6('0x11')](_0xadb6('0x13'),_0xdea653,_0x1fdbc8[_0xadb6('0x11')][_0xadb6('0x14')]);return _0x71ea91(_0x1fdbc8['error'][_0xadb6('0x14')]);}logger[_0xadb6('0x11')]('SquareRecording,\x20%s,\x20%s',_0xdea653,_0x1fdbc8[_0xadb6('0x11')][_0xadb6('0x14')]);return _0x36947f(_0x1fdbc8[_0xadb6('0x11')][_0xadb6('0x14')]);}else{logger[_0xadb6('0xd')]('SquareRecording,\x20%s,\x20%s',_0xdea653,_0xadb6('0xf'));_0x36947f(_0x1fdbc8[_0xadb6('0x15')]['message']);}})[_0xadb6('0x16')](function(_0x3c523f){logger['error']('SquareRecording,\x20%s,\x20%s',_0xdea653,_0x3c523f);_0x71ea91(_0x3c523f);});});}exports[_0xadb6('0x17')]=function(_0x4c4f1f){var _0x2fbab2=this;return new Promise(function(_0x5cde52,_0x3a7b21){return db['SquareRecording']['create'](_0x4c4f1f[_0xadb6('0x18')],{'raw':_0x4c4f1f['options']?_0x4c4f1f[_0xadb6('0x19')][_0xadb6('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5ea539){logger[_0xadb6('0xd')](_0xadb6('0x17'),_0x4c4f1f);logger[_0xadb6('0xe')]('CreateSquareRecording',_0x4c4f1f,JSON[_0xadb6('0x10')](_0x5ea539));_0x5cde52(_0x5ea539);})['catch'](function(_0x3eed35){logger[_0xadb6('0x11')](_0xadb6('0x17'),_0x3eed35[_0xadb6('0x14')],_0x4c4f1f);_0x3a7b21(_0x2fbab2[_0xadb6('0x11')](0x1f4,_0x3eed35[_0xadb6('0x14')]));});});}; \ No newline at end of file +var _0x1033=['stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x1033,0x15c));var _0x3103=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x1033[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x3103('0x0'));var util=require(_0x3103('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3103('0x2'));var fs=require('fs');var Redis=require(_0x3103('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3103('0x4'));var logger=require(_0x3103('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3103('0x6'));var client=jayson[_0x3103('0x7')][_0x3103('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x415825,_0xc60f56,_0x5a4d0a){return new BPromise(function(_0x40a0ea,_0x5bd7ab){return client[_0x3103('0x9')](_0x415825,_0x5a4d0a)[_0x3103('0xa')](function(_0x5bb33d){logger[_0x3103('0xb')](_0x3103('0xc'),_0xc60f56,_0x3103('0xd'));logger[_0x3103('0xe')](_0x3103('0xf'),_0xc60f56,_0x3103('0xd'),JSON[_0x3103('0x10')](_0x5bb33d));if(_0x5bb33d[_0x3103('0x11')]){if(_0x5bb33d['error'][_0x3103('0x12')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0xc60f56,_0x5bb33d[_0x3103('0x11')][_0x3103('0x13')]);return _0x5bd7ab(_0x5bb33d[_0x3103('0x11')]['message']);}logger[_0x3103('0x11')](_0x3103('0xc'),_0xc60f56,_0x5bb33d[_0x3103('0x11')]['message']);return _0x40a0ea(_0x5bb33d[_0x3103('0x11')][_0x3103('0x13')]);}else{logger[_0x3103('0xb')](_0x3103('0xc'),_0xc60f56,_0x3103('0xd'));_0x40a0ea(_0x5bb33d[_0x3103('0x14')][_0x3103('0x13')]);}})[_0x3103('0x15')](function(_0x4f389c){logger['error']('SquareRecording,\x20%s,\x20%s',_0xc60f56,_0x4f389c);_0x5bd7ab(_0x4f389c);});});}exports[_0x3103('0x16')]=function(_0x5ea3ec){var _0x3a2065=this;return new Promise(function(_0x66330a,_0x29ad4b){return db[_0x3103('0x17')][_0x3103('0x18')](_0x5ea3ec[_0x3103('0x19')],{'raw':_0x5ea3ec[_0x3103('0x1a')]?_0x5ea3ec['options'][_0x3103('0x1b')]===undefined?!![]:![]:!![]})[_0x3103('0xa')](function(_0x366b71){logger[_0x3103('0xb')](_0x3103('0x16'),_0x5ea3ec);logger[_0x3103('0xe')]('CreateSquareRecording',_0x5ea3ec,JSON[_0x3103('0x10')](_0x366b71));_0x66330a(_0x366b71);})[_0x3103('0x15')](function(_0x26aae3){logger[_0x3103('0x11')](_0x3103('0x16'),_0x26aae3[_0x3103('0x13')],_0x5ea3ec);_0x29ad4b(_0x3a2065[_0x3103('0x11')](0x1f4,_0x26aae3[_0x3103('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 58ef253..ec7be83 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4bd76e,_0x260c31){var _0x96a285=function(_0x28176d){while(--_0x28176d){_0x4bd76e['push'](_0x4bd76e['shift']());}};_0x96a285(++_0x260c31);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x56d9c0,_0x23cac4){var _0x183ba1=function(_0x21fa23){while(--_0x21fa23){_0x56d9c0['push'](_0x56d9c0['shift']());}};_0x183ba1(++_0x23cac4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 89be314..330cb80 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 _0x018a=['sequelize','STRING','DATE'];(function(_0xaad835,_0x35ec62){var _0x4543f2=function(_0x3f0c67){while(--_0x3f0c67){_0xaad835['push'](_0xaad835['shift']());}};_0x4543f2(++_0x35ec62);}(_0x018a,0xfc));var _0xa018=function(_0x3072e2,_0x648a09){_0x3072e2=_0x3072e2-0x0;var _0x42c45b=_0x018a[_0x3072e2];return _0x42c45b;};'use strict';var Sequelize=require(_0xa018('0x0'));module['exports']={'network':{'type':Sequelize[_0xa018('0x1')]},'network_script':{'type':Sequelize[_0xa018('0x1')]},'request':{'type':Sequelize[_0xa018('0x1')]},'channel':{'type':Sequelize[_0xa018('0x1')]},'language':{'type':Sequelize[_0xa018('0x1')]},'type':{'type':Sequelize[_0xa018('0x1')]},'uniqueid':{'type':Sequelize[_0xa018('0x1')]},'version':{'type':Sequelize[_0xa018('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa018('0x1')]},'callingani2':{'type':Sequelize[_0xa018('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xa018('0x1')]},'dnid':{'type':Sequelize[_0xa018('0x1')]},'rdnis':{'type':Sequelize[_0xa018('0x1')]},'context':{'type':Sequelize[_0xa018('0x1')]},'extension':{'type':Sequelize[_0xa018('0x1')]},'priority':{'type':Sequelize[_0xa018('0x1')]},'enhanced':{'type':Sequelize[_0xa018('0x1')]},'accountcode':{'type':Sequelize[_0xa018('0x1')]},'threadid':{'type':Sequelize[_0xa018('0x1')]},'project_name':{'type':Sequelize[_0xa018('0x1')]},'joinAt':{'type':Sequelize[_0xa018('0x2')]},'leaveAt':{'type':Sequelize[_0xa018('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5e84=['exports','STRING','DATE','BOOLEAN'];(function(_0x2eb40b,_0x452d82){var _0xc8e83f=function(_0x113170){while(--_0x113170){_0x2eb40b['push'](_0x2eb40b['shift']());}};_0xc8e83f(++_0x452d82);}(_0x5e84,0xb8));var _0x45e8=function(_0x1fd4ea,_0x374cc6){_0x1fd4ea=_0x1fd4ea-0x0;var _0x2e6a63=_0x5e84[_0x1fd4ea];return _0x2e6a63;};'use strict';var Sequelize=require('sequelize');module[_0x45e8('0x0')]={'network':{'type':Sequelize[_0x45e8('0x1')]},'network_script':{'type':Sequelize[_0x45e8('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x45e8('0x1')]},'language':{'type':Sequelize[_0x45e8('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x45e8('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x45e8('0x1')]},'callingpres':{'type':Sequelize[_0x45e8('0x1')]},'callingani2':{'type':Sequelize[_0x45e8('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x45e8('0x1')]},'dnid':{'type':Sequelize[_0x45e8('0x1')]},'rdnis':{'type':Sequelize[_0x45e8('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x45e8('0x1')]},'priority':{'type':Sequelize[_0x45e8('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x45e8('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x45e8('0x2')]},'bot':{'type':Sequelize[_0x45e8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d7ec3b1..f7cdb12 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 _0x8645=['length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','params','keys','catch','create','body','find','destroy','describe','eml-format','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x49f118,_0x5138e4){var _0x3a0443=function(_0x557a45){while(--_0x557a45){_0x49f118['push'](_0x49f118['shift']());}};_0x3a0443(++_0x5138e4);}(_0x8645,0x188));var _0x5864=function(_0x548c66,_0x4ea9b6){_0x548c66=_0x548c66-0x0;var _0x48b69d=_0x8645[_0x548c66];return _0x48b69d;};'use strict';var emlformat=require(_0x5864('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5864('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5864('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5864('0x3'));var util=require(_0x5864('0x4'));var path=require(_0x5864('0x5'));var sox=require(_0x5864('0x6'));var csv=require('to-csv');var ejs=require(_0x5864('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5864('0x8'));var squel=require('squel');var crypto=require(_0x5864('0x9'));var jsforce=require(_0x5864('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5864('0xb'));var querystring=require('querystring');var Papa=require(_0x5864('0xc'));var Redis=require(_0x5864('0xd'));var authService=require(_0x5864('0xe'));var qs=require(_0x5864('0xf'));var as=require(_0x5864('0x10'));var hardwareService=require(_0x5864('0x11'));var logger=require(_0x5864('0x12'))(_0x5864('0x13'));var utils=require(_0x5864('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f1110,_0x2e85a9){_0x2e85a9=_0x2e85a9||0xcc;return function(_0x54e879){if(_0x54e879){return _0x3f1110[_0x5864('0x15')](_0x2e85a9);}return _0x3f1110[_0x5864('0x16')](_0x2e85a9)[_0x5864('0x17')]();};}function respondWithResult(_0x31f64b,_0x4a34a2){_0x4a34a2=_0x4a34a2||0xc8;return function(_0x408d6e){if(_0x408d6e){return _0x31f64b[_0x5864('0x16')](_0x4a34a2)['json'](_0x408d6e);}};}function respondWithFilteredResult(_0x348467,_0x16194c){return function(_0x1e8313){if(_0x1e8313){var _0x2c07b1=typeof _0x16194c[_0x5864('0x18')]===_0x5864('0x19')&&typeof _0x16194c[_0x5864('0x1a')]==='undefined';var _0x48771b=_0x1e8313[_0x5864('0x1b')];var _0x1f0f2c=_0x2c07b1?0x0:_0x16194c['offset'];var _0x2e447f=_0x2c07b1?_0x1e8313[_0x5864('0x1b')]:_0x16194c[_0x5864('0x18')]+_0x16194c[_0x5864('0x1a')];var _0x5c758b;if(_0x2e447f>=_0x48771b){_0x2e447f=_0x48771b;_0x5c758b=0xc8;}else{_0x5c758b=0xce;}_0x348467[_0x5864('0x16')](_0x5c758b);return _0x348467[_0x5864('0x1c')](_0x5864('0x1d'),_0x1f0f2c+'-'+_0x2e447f+'/'+_0x48771b)[_0x5864('0x1e')](_0x1e8313);}return null;};}function patchUpdates(_0x1a0ab4){return function(_0x5883ea){try{jsonpatch[_0x5864('0x1f')](_0x5883ea,_0x1a0ab4,!![]);}catch(_0x1bde94){return BPromise[_0x5864('0x20')](_0x1bde94);}return _0x5883ea[_0x5864('0x21')]();};}function saveUpdates(_0x2c7f80,_0x12af6e){return function(_0x4952eb){if(_0x4952eb){return _0x4952eb[_0x5864('0x22')](_0x2c7f80)[_0x5864('0x23')](function(_0x1096ce){return _0x1096ce;});}return null;};}function removeEntity(_0x473764,_0x49b282){return function(_0x49b8df){if(_0x49b8df){return _0x49b8df['destroy']()[_0x5864('0x23')](function(){_0x473764[_0x5864('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d3d89,_0x1d70d2){return function(_0x14780){if(!_0x14780){_0x8d3d89[_0x5864('0x15')](0x194);}return _0x14780;};}function handleError(_0x3e4dc4,_0x1c8f0b){_0x1c8f0b=_0x1c8f0b||0x1f4;return function(_0x1d3682){logger[_0x5864('0x24')](_0x1d3682[_0x5864('0x25')]);if(_0x1d3682['name']){delete _0x1d3682[_0x5864('0x26')];}_0x3e4dc4[_0x5864('0x16')](_0x1c8f0b)[_0x5864('0x27')](_0x1d3682);};}exports[_0x5864('0x28')]=function(_0xbe18f1,_0x3a5b85){var _0x332ccd={},_0x46300d={},_0x2b08ba={'count':0x0,'rows':[]};var _0x271c04=_['map'](db[_0x5864('0x29')][_0x5864('0x2a')],function(_0x346531){return{'name':_0x346531[_0x5864('0x2b')],'type':_0x346531['type'][_0x5864('0x2c')]};});_0x46300d[_0x5864('0x2d')]=_[_0x5864('0x2e')](_0x271c04,_0x5864('0x26'));_0x46300d['query']=_['keys'](_0xbe18f1[_0x5864('0x2f')]);_0x46300d[_0x5864('0x30')]=_[_0x5864('0x31')](_0x46300d[_0x5864('0x2d')],_0x46300d[_0x5864('0x2f')]);_0x332ccd[_0x5864('0x32')]=_[_0x5864('0x31')](_0x46300d[_0x5864('0x2d')],qs[_0x5864('0x33')](_0xbe18f1[_0x5864('0x2f')][_0x5864('0x33')]));_0x332ccd[_0x5864('0x32')]=_0x332ccd['attributes'][_0x5864('0x34')]?_0x332ccd[_0x5864('0x32')]:_0x46300d[_0x5864('0x2d')];if(!_0xbe18f1[_0x5864('0x2f')][_0x5864('0x35')]('nolimit')){_0x332ccd[_0x5864('0x1a')]=qs[_0x5864('0x1a')](_0xbe18f1[_0x5864('0x2f')][_0x5864('0x1a')]);_0x332ccd[_0x5864('0x18')]=qs[_0x5864('0x18')](_0xbe18f1[_0x5864('0x2f')][_0x5864('0x18')]);}_0x332ccd[_0x5864('0x36')]=qs[_0x5864('0x37')](_0xbe18f1[_0x5864('0x2f')]['sort']);_0x332ccd[_0x5864('0x38')]=qs[_0x5864('0x30')](_[_0x5864('0x39')](_0xbe18f1[_0x5864('0x2f')],_0x46300d[_0x5864('0x30')]),_0x271c04);if(_0xbe18f1['query'][_0x5864('0x3a')]){_0x332ccd[_0x5864('0x38')]=_['merge'](_0x332ccd['where'],{'$or':_[_0x5864('0x2e')](_0x271c04,function(_0x310abf){if(_0x310abf[_0x5864('0x3b')]!==_0x5864('0x3c')){var _0x21814e={};_0x21814e[_0x310abf[_0x5864('0x26')]]={'$like':'%'+_0xbe18f1[_0x5864('0x2f')][_0x5864('0x3a')]+'%'};return _0x21814e;}})});}_0x332ccd=_[_0x5864('0x3d')]({},_0x332ccd,_0xbe18f1[_0x5864('0x3e')]);var _0x38da30={'where':_0x332ccd['where']};return db['SquareReport']['count'](_0x38da30)[_0x5864('0x23')](function(_0x5e819b){_0x2b08ba[_0x5864('0x1b')]=_0x5e819b;if(_0xbe18f1[_0x5864('0x2f')][_0x5864('0x3f')]){_0x332ccd[_0x5864('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0x5864('0x41')](_0x332ccd);})[_0x5864('0x23')](function(_0xf8e5b2){_0x2b08ba['rows']=_0xf8e5b2;return _0x2b08ba;})[_0x5864('0x23')](respondWithFilteredResult(_0x3a5b85,_0x332ccd))['catch'](handleError(_0x3a5b85,null));};exports['show']=function(_0x3d35f9,_0x5a8695){var _0x45c8e0={'raw':!![],'where':{'id':_0x3d35f9[_0x5864('0x42')]['id']}},_0xcf4ea0={};_0xcf4ea0[_0x5864('0x2d')]=_[_0x5864('0x43')](db[_0x5864('0x29')][_0x5864('0x2a')]);_0xcf4ea0[_0x5864('0x2f')]=_[_0x5864('0x43')](_0x3d35f9['query']);_0xcf4ea0[_0x5864('0x30')]=_[_0x5864('0x31')](_0xcf4ea0[_0x5864('0x2d')],_0xcf4ea0[_0x5864('0x2f')]);_0x45c8e0[_0x5864('0x32')]=_['intersection'](_0xcf4ea0[_0x5864('0x2d')],qs[_0x5864('0x33')](_0x3d35f9[_0x5864('0x2f')][_0x5864('0x33')]));_0x45c8e0[_0x5864('0x32')]=_0x45c8e0[_0x5864('0x32')][_0x5864('0x34')]?_0x45c8e0['attributes']:_0xcf4ea0[_0x5864('0x2d')];if(_0x3d35f9[_0x5864('0x2f')]['includeAll']){_0x45c8e0[_0x5864('0x40')]=[{'all':!![]}];}_0x45c8e0=_['merge']({},_0x45c8e0,_0x3d35f9[_0x5864('0x3e')]);return db['SquareReport']['find'](_0x45c8e0)[_0x5864('0x23')](handleEntityNotFound(_0x5a8695,null))[_0x5864('0x23')](respondWithResult(_0x5a8695,null))[_0x5864('0x44')](handleError(_0x5a8695,null));};exports[_0x5864('0x45')]=function(_0x437abc,_0x4bf54e){return db[_0x5864('0x29')]['create'](_0x437abc[_0x5864('0x46')],{})[_0x5864('0x23')](respondWithResult(_0x4bf54e,0xc9))[_0x5864('0x44')](handleError(_0x4bf54e,null));};exports[_0x5864('0x22')]=function(_0xaa56e9,_0x3848d8){if(_0xaa56e9[_0x5864('0x46')]['id']){delete _0xaa56e9[_0x5864('0x46')]['id'];}return db[_0x5864('0x29')][_0x5864('0x47')]({'where':{'id':_0xaa56e9[_0x5864('0x42')]['id']}})[_0x5864('0x23')](handleEntityNotFound(_0x3848d8,null))[_0x5864('0x23')](saveUpdates(_0xaa56e9[_0x5864('0x46')],null))[_0x5864('0x23')](respondWithResult(_0x3848d8,null))[_0x5864('0x44')](handleError(_0x3848d8,null));};exports[_0x5864('0x48')]=function(_0x531d5b,_0x9eae36){return db[_0x5864('0x29')][_0x5864('0x47')]({'where':{'id':_0x531d5b[_0x5864('0x42')]['id']}})[_0x5864('0x23')](handleEntityNotFound(_0x9eae36,null))[_0x5864('0x23')](removeEntity(_0x9eae36,null))[_0x5864('0x44')](handleError(_0x9eae36,null));};exports[_0x5864('0x49')]=function(_0x1fb468,_0x287238){return db[_0x5864('0x29')][_0x5864('0x49')]()['then'](respondWithResult(_0x287238,null))[_0x5864('0x44')](handleError(_0x287238,null));}; \ No newline at end of file +var _0x624c=['eml-format','rimraf','zip-dir','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','offset','count','limit','set','json','apply','reject','save','update','destroy','then','name','index','map','SquareReport','rawAttributes','fieldName','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','type','filter','merge','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','body','describe'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x624c,0x12c));var _0xc624=function(_0x446414,_0x166ce3){_0x446414=_0x446414-0x0;var _0x3bbeac=_0x624c[_0x446414];return _0x3bbeac;};'use strict';var emlformat=require(_0xc624('0x0'));var rimraf=require(_0xc624('0x1'));var zipdir=require(_0xc624('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc624('0x3'));var BPromise=require(_0xc624('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc624('0x5'));var sox=require(_0xc624('0x6'));var csv=require('to-csv');var ejs=require(_0xc624('0x7'));var fs=require('fs');var fs_extra=require(_0xc624('0x8'));var _=require(_0xc624('0x9'));var squel=require(_0xc624('0xa'));var crypto=require(_0xc624('0xb'));var jsforce=require(_0xc624('0xc'));var deskjs=require(_0xc624('0xd'));var toCsv=require(_0xc624('0xe'));var querystring=require('querystring');var Papa=require(_0xc624('0xf'));var Redis=require(_0xc624('0x10'));var authService=require(_0xc624('0x11'));var qs=require(_0xc624('0x12'));var as=require(_0xc624('0x13'));var hardwareService=require(_0xc624('0x14'));var logger=require(_0xc624('0x15'))(_0xc624('0x16'));var utils=require(_0xc624('0x17'));var config=require(_0xc624('0x18'));var licenseUtil=require(_0xc624('0x19'));var db=require(_0xc624('0x1a'))['db'];function respondWithStatusCode(_0x473b7a,_0x5616ab){_0x5616ab=_0x5616ab||0xcc;return function(_0x468932){if(_0x468932){return _0x473b7a[_0xc624('0x1b')](_0x5616ab);}return _0x473b7a[_0xc624('0x1c')](_0x5616ab)['end']();};}function respondWithResult(_0x5987c9,_0x1c99af){_0x1c99af=_0x1c99af||0xc8;return function(_0x45849e){if(_0x45849e){return _0x5987c9['status'](_0x1c99af)['json'](_0x45849e);}};}function respondWithFilteredResult(_0x279819,_0x59f6aa){return function(_0x19c136){if(_0x19c136){var _0x2f12d2=typeof _0x59f6aa['offset']===_0xc624('0x1d')&&typeof _0x59f6aa['limit']==='undefined';var _0x586cb9=_0x19c136['count'];var _0x545cd7=_0x2f12d2?0x0:_0x59f6aa[_0xc624('0x1e')];var _0x4f1cc4=_0x2f12d2?_0x19c136[_0xc624('0x1f')]:_0x59f6aa[_0xc624('0x1e')]+_0x59f6aa[_0xc624('0x20')];var _0x2a799c;if(_0x4f1cc4>=_0x586cb9){_0x4f1cc4=_0x586cb9;_0x2a799c=0xc8;}else{_0x2a799c=0xce;}_0x279819[_0xc624('0x1c')](_0x2a799c);return _0x279819[_0xc624('0x21')]('Content-Range',_0x545cd7+'-'+_0x4f1cc4+'/'+_0x586cb9)[_0xc624('0x22')](_0x19c136);}return null;};}function patchUpdates(_0x204ece){return function(_0x209518){try{jsonpatch[_0xc624('0x23')](_0x209518,_0x204ece,!![]);}catch(_0x5d1490){return BPromise[_0xc624('0x24')](_0x5d1490);}return _0x209518[_0xc624('0x25')]();};}function saveUpdates(_0x2a8280,_0x5a7b97){return function(_0x31155a){if(_0x31155a){return _0x31155a[_0xc624('0x26')](_0x2a8280)['then'](function(_0x229387){return _0x229387;});}return null;};}function removeEntity(_0x5a0f0e,_0x1ed826){return function(_0x1f04cc){if(_0x1f04cc){return _0x1f04cc[_0xc624('0x27')]()[_0xc624('0x28')](function(){_0x5a0f0e[_0xc624('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25bffe,_0x1d799b){return function(_0x4910dc){if(!_0x4910dc){_0x25bffe['sendStatus'](0x194);}return _0x4910dc;};}function handleError(_0xd249d9,_0x4eb00e){_0x4eb00e=_0x4eb00e||0x1f4;return function(_0x363cfe){logger['error'](_0x363cfe['stack']);if(_0x363cfe['name']){delete _0x363cfe[_0xc624('0x29')];}_0xd249d9['status'](_0x4eb00e)['send'](_0x363cfe);};}exports[_0xc624('0x2a')]=function(_0x2dc454,_0x37767e){var _0x41018f={},_0x388570={},_0x4eacf7={'count':0x0,'rows':[]};var _0x1c95bc=_[_0xc624('0x2b')](db[_0xc624('0x2c')][_0xc624('0x2d')],function(_0x5c9418){return{'name':_0x5c9418[_0xc624('0x2e')],'type':_0x5c9418['type'][_0xc624('0x2f')]};});_0x388570[_0xc624('0x30')]=_[_0xc624('0x2b')](_0x1c95bc,_0xc624('0x29'));_0x388570['query']=_[_0xc624('0x31')](_0x2dc454[_0xc624('0x32')]);_0x388570[_0xc624('0x33')]=_['intersection'](_0x388570[_0xc624('0x30')],_0x388570['query']);_0x41018f['attributes']=_['intersection'](_0x388570[_0xc624('0x30')],qs[_0xc624('0x34')](_0x2dc454[_0xc624('0x32')][_0xc624('0x34')]));_0x41018f[_0xc624('0x35')]=_0x41018f['attributes'][_0xc624('0x36')]?_0x41018f[_0xc624('0x35')]:_0x388570[_0xc624('0x30')];if(!_0x2dc454[_0xc624('0x32')][_0xc624('0x37')]('nolimit')){_0x41018f['limit']=qs[_0xc624('0x20')](_0x2dc454[_0xc624('0x32')]['limit']);_0x41018f[_0xc624('0x1e')]=qs['offset'](_0x2dc454[_0xc624('0x32')][_0xc624('0x1e')]);}_0x41018f[_0xc624('0x38')]=qs[_0xc624('0x39')](_0x2dc454[_0xc624('0x32')]['sort']);_0x41018f[_0xc624('0x3a')]=qs[_0xc624('0x33')](_[_0xc624('0x3b')](_0x2dc454[_0xc624('0x32')],_0x388570[_0xc624('0x33')]),_0x1c95bc);if(_0x2dc454[_0xc624('0x32')]['filter']){_0x41018f[_0xc624('0x3a')]=_['merge'](_0x41018f['where'],{'$or':_['map'](_0x1c95bc,function(_0x43a785){if(_0x43a785[_0xc624('0x3c')]!=='VIRTUAL'){var _0x142abd={};_0x142abd[_0x43a785[_0xc624('0x29')]]={'$like':'%'+_0x2dc454[_0xc624('0x32')][_0xc624('0x3d')]+'%'};return _0x142abd;}})});}_0x41018f=_[_0xc624('0x3e')]({},_0x41018f,_0x2dc454['options']);var _0x4f773e={'where':_0x41018f['where']};return db[_0xc624('0x2c')][_0xc624('0x1f')](_0x4f773e)[_0xc624('0x28')](function(_0x1c316f){_0x4eacf7[_0xc624('0x1f')]=_0x1c316f;if(_0x2dc454[_0xc624('0x32')][_0xc624('0x3f')]){_0x41018f[_0xc624('0x40')]=[{'all':!![]}];}return db[_0xc624('0x2c')][_0xc624('0x41')](_0x41018f);})['then'](function(_0x11cb7e){_0x4eacf7[_0xc624('0x42')]=_0x11cb7e;return _0x4eacf7;})['then'](respondWithFilteredResult(_0x37767e,_0x41018f))[_0xc624('0x43')](handleError(_0x37767e,null));};exports['show']=function(_0x3a38b6,_0x31305e){var _0x5be375={'raw':!![],'where':{'id':_0x3a38b6[_0xc624('0x44')]['id']}},_0x1e00f6={};_0x1e00f6[_0xc624('0x30')]=_['keys'](db[_0xc624('0x2c')]['rawAttributes']);_0x1e00f6[_0xc624('0x32')]=_[_0xc624('0x31')](_0x3a38b6[_0xc624('0x32')]);_0x1e00f6[_0xc624('0x33')]=_[_0xc624('0x45')](_0x1e00f6[_0xc624('0x30')],_0x1e00f6[_0xc624('0x32')]);_0x5be375[_0xc624('0x35')]=_[_0xc624('0x45')](_0x1e00f6['model'],qs[_0xc624('0x34')](_0x3a38b6[_0xc624('0x32')]['fields']));_0x5be375[_0xc624('0x35')]=_0x5be375[_0xc624('0x35')][_0xc624('0x36')]?_0x5be375[_0xc624('0x35')]:_0x1e00f6[_0xc624('0x30')];if(_0x3a38b6[_0xc624('0x32')]['includeAll']){_0x5be375[_0xc624('0x40')]=[{'all':!![]}];}_0x5be375=_[_0xc624('0x3e')]({},_0x5be375,_0x3a38b6[_0xc624('0x46')]);return db[_0xc624('0x2c')][_0xc624('0x47')](_0x5be375)[_0xc624('0x28')](handleEntityNotFound(_0x31305e,null))[_0xc624('0x28')](respondWithResult(_0x31305e,null))[_0xc624('0x43')](handleError(_0x31305e,null));};exports[_0xc624('0x48')]=function(_0x3dea0e,_0x2492d9){return db[_0xc624('0x2c')]['create'](_0x3dea0e['body'],{})[_0xc624('0x28')](respondWithResult(_0x2492d9,0xc9))['catch'](handleError(_0x2492d9,null));};exports[_0xc624('0x26')]=function(_0x59edda,_0x313f78){if(_0x59edda[_0xc624('0x49')]['id']){delete _0x59edda[_0xc624('0x49')]['id'];}return db[_0xc624('0x2c')][_0xc624('0x47')]({'where':{'id':_0x59edda[_0xc624('0x44')]['id']}})[_0xc624('0x28')](handleEntityNotFound(_0x313f78,null))[_0xc624('0x28')](saveUpdates(_0x59edda[_0xc624('0x49')],null))[_0xc624('0x28')](respondWithResult(_0x313f78,null))[_0xc624('0x43')](handleError(_0x313f78,null));};exports[_0xc624('0x27')]=function(_0x121749,_0x4e42d4){return db['SquareReport'][_0xc624('0x47')]({'where':{'id':_0x121749[_0xc624('0x44')]['id']}})[_0xc624('0x28')](handleEntityNotFound(_0x4e42d4,null))[_0xc624('0x28')](removeEntity(_0x4e42d4,null))[_0xc624('0x43')](handleError(_0x4e42d4,null));};exports[_0xc624('0x4a')]=function(_0xe6f29e,_0x25af3b){return db[_0xc624('0x2c')][_0xc624('0x4a')]()[_0xc624('0x28')](respondWithResult(_0x25af3b,null))['catch'](handleError(_0x25af3b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f75768d..9543e0c 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 _0x8729=['../../config/logger','api','request-promise','path','../../config/environment','exports','uid_pname','uniqueid','leaveAt','lodash','util'];(function(_0x1915f1,_0x397850){var _0x1717c9=function(_0x25e23e){while(--_0x25e23e){_0x1915f1['push'](_0x1915f1['shift']());}};_0x1717c9(++_0x397850);}(_0x8729,0x106));var _0x9872=function(_0x421aae,_0x888e64){_0x421aae=_0x421aae-0x0;var _0x3caf8c=_0x8729[_0x421aae];return _0x3caf8c;};'use strict';var _=require(_0x9872('0x0'));var util=require(_0x9872('0x1'));var logger=require(_0x9872('0x2'))(_0x9872('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9872('0x4'));var fs=require('fs');var path=require(_0x9872('0x5'));var rimraf=require('rimraf');var config=require(_0x9872('0x6'));var attributes=require('./squareReport.attributes');module[_0x9872('0x7')]=function(_0x457423,_0x1d90c6){return _0x457423['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x9872('0x8'),'fields':[_0x9872('0x9'),'project_name']},{'name':_0x9872('0xa'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3be=['project_name','leaveAt','util','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','report_square','uid_pname','uniqueid'];(function(_0x2aca3e,_0x58c179){var _0x579a5d=function(_0x246726){while(--_0x246726){_0x2aca3e['push'](_0x2aca3e['shift']());}};_0x579a5d(++_0x58c179);}(_0xe3be,0x10c));var _0xee3b=function(_0x4c364b,_0x152581){_0x4c364b=_0x4c364b-0x0;var _0x3bf506=_0xe3be[_0x4c364b];return _0x3bf506;};'use strict';var _=require('lodash');var util=require(_0xee3b('0x0'));var logger=require('../../config/logger')(_0xee3b('0x1'));var moment=require(_0xee3b('0x2'));var BPromise=require('bluebird');var rp=require(_0xee3b('0x3'));var fs=require('fs');var path=require(_0xee3b('0x4'));var rimraf=require(_0xee3b('0x5'));var config=require(_0xee3b('0x6'));var attributes=require(_0xee3b('0x7'));module['exports']=function(_0x20adfc,_0x48afe6){return _0x20adfc[_0xee3b('0x8')]('SquareReport',attributes,{'tableName':_0xee3b('0x9'),'paranoid':![],'indexes':[{'name':_0xee3b('0xa'),'fields':[_0xee3b('0xb'),_0xee3b('0xc')]},{'name':_0xee3b('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 94f9c12..ce45067 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 _0x07ed=['CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result'];(function(_0xba31b4,_0x2d6cb7){var _0x1495d0=function(_0xaac348){while(--_0xaac348){_0xba31b4['push'](_0xba31b4['shift']());}};_0x1495d0(++_0x2d6cb7);}(_0x07ed,0x11b));var _0xd07e=function(_0x17ce4c,_0x334562){_0x17ce4c=_0x17ce4c-0x0;var _0x484a33=_0x07ed[_0x17ce4c];return _0x484a33;};'use strict';var _=require(_0xd07e('0x0'));var util=require(_0xd07e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd07e('0x2'));var fs=require('fs');var Redis=require(_0xd07e('0x3'));var db=require(_0xd07e('0x4'))['db'];var utils=require(_0xd07e('0x5'));var logger=require(_0xd07e('0x6'))(_0xd07e('0x7'));var config=require(_0xd07e('0x8'));var jayson=require(_0xd07e('0x9'));var client=jayson['client'][_0xd07e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb1c55e,_0x4868f5,_0x484877){return new BPromise(function(_0x1a974b,_0x27a625){return client[_0xd07e('0xb')](_0xb1c55e,_0x484877)[_0xd07e('0xc')](function(_0xc944c0){logger[_0xd07e('0xd')]('SquareReport,\x20%s,\x20%s',_0x4868f5,_0xd07e('0xe'));logger[_0xd07e('0xf')](_0xd07e('0x10'),_0x4868f5,_0xd07e('0xe'),JSON[_0xd07e('0x11')](_0xc944c0));if(_0xc944c0[_0xd07e('0x12')]){if(_0xc944c0[_0xd07e('0x12')][_0xd07e('0x13')]===0x1f4){logger[_0xd07e('0x12')](_0xd07e('0x14'),_0x4868f5,_0xc944c0[_0xd07e('0x12')][_0xd07e('0x15')]);return _0x27a625(_0xc944c0['error'][_0xd07e('0x15')]);}logger[_0xd07e('0x12')](_0xd07e('0x14'),_0x4868f5,_0xc944c0[_0xd07e('0x12')][_0xd07e('0x15')]);return _0x1a974b(_0xc944c0[_0xd07e('0x12')][_0xd07e('0x15')]);}else{logger[_0xd07e('0xd')](_0xd07e('0x14'),_0x4868f5,'request\x20sent');_0x1a974b(_0xc944c0[_0xd07e('0x16')][_0xd07e('0x15')]);}})['catch'](function(_0x52d953){logger[_0xd07e('0x12')](_0xd07e('0x14'),_0x4868f5,_0x52d953);_0x27a625(_0x52d953);});});}exports[_0xd07e('0x17')]=function(_0x3cb700){var _0x24d607=this;return new Promise(function(_0x122bf1,_0x2d3cb9){return db[_0xd07e('0x18')][_0xd07e('0x19')](_0x3cb700[_0xd07e('0x1a')],{'raw':_0x3cb700[_0xd07e('0x1b')]?_0x3cb700[_0xd07e('0x1b')][_0xd07e('0x1c')]===undefined?!![]:![]:!![]})[_0xd07e('0xc')](function(_0x45415f){logger[_0xd07e('0xd')](_0xd07e('0x17'),_0x3cb700);logger['debug']('CreateSquareReport',_0x3cb700,JSON['stringify'](_0x45415f));_0x122bf1(_0x45415f);})['catch'](function(_0x126ea1){logger[_0xd07e('0x12')](_0xd07e('0x17'),_0x126ea1[_0xd07e('0x15')],_0x3cb700);_0x2d3cb9(_0x24d607[_0xd07e('0x12')](0x1f4,_0x126ea1[_0xd07e('0x15')]));});});};exports[_0xd07e('0x1d')]=function(_0x5c9874){var _0x590b28=this;return new Promise(function(_0x13acf4,_0x4cbc56){return db[_0xd07e('0x18')][_0xd07e('0x1e')](_0x5c9874[_0xd07e('0x1a')],{'raw':_0x5c9874['options']?_0x5c9874['options'][_0xd07e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c9874[_0xd07e('0x1b')]?_0x5c9874[_0xd07e('0x1b')][_0xd07e('0x1f')]||null:null,'attributes':_0x5c9874[_0xd07e('0x1b')]?_0x5c9874[_0xd07e('0x1b')][_0xd07e('0x20')]||null:null,'limit':_0x5c9874[_0xd07e('0x1b')]?_0x5c9874[_0xd07e('0x1b')][_0xd07e('0x21')]||null:null})[_0xd07e('0xc')](function(_0x3f6cc4){logger[_0xd07e('0xd')]('UpdateSquareReport',_0x5c9874);logger[_0xd07e('0xf')](_0xd07e('0x1d'),_0x5c9874,JSON[_0xd07e('0x11')](_0x3f6cc4));_0x13acf4(_0x3f6cc4);})['catch'](function(_0x4e290b){logger[_0xd07e('0x12')](_0xd07e('0x1d'),_0x4e290b[_0xd07e('0x15')],_0x5c9874);_0x4cbc56(_0x590b28['error'](0x1f4,_0x4e290b['message']));});});}; \ No newline at end of file +var _0x31bc=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x39151a,_0x61bc58){var _0x1367f9=function(_0x41e6c1){while(--_0x41e6c1){_0x39151a['push'](_0x39151a['shift']());}};_0x1367f9(++_0x61bc58);}(_0x31bc,0x10e));var _0xc31b=function(_0x4d3016,_0x3351a0){_0x4d3016=_0x4d3016-0x0;var _0x20057c=_0x31bc[_0x4d3016];return _0x20057c;};'use strict';var _=require(_0xc31b('0x0'));var util=require(_0xc31b('0x1'));var moment=require(_0xc31b('0x2'));var BPromise=require(_0xc31b('0x3'));var rs=require(_0xc31b('0x4'));var fs=require('fs');var Redis=require(_0xc31b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc31b('0x6'));var logger=require(_0xc31b('0x7'))(_0xc31b('0x8'));var config=require(_0xc31b('0x9'));var jayson=require(_0xc31b('0xa'));var client=jayson[_0xc31b('0xb')][_0xc31b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b04b,_0x5a6bb3,_0x5dd7c2){return new BPromise(function(_0x535a29,_0x275318){return client[_0xc31b('0xd')](_0x42b04b,_0x5dd7c2)[_0xc31b('0xe')](function(_0x261b81){logger[_0xc31b('0xf')]('SquareReport,\x20%s,\x20%s',_0x5a6bb3,_0xc31b('0x10'));logger[_0xc31b('0x11')](_0xc31b('0x12'),_0x5a6bb3,_0xc31b('0x10'),JSON[_0xc31b('0x13')](_0x261b81));if(_0x261b81['error']){if(_0x261b81['error']['code']===0x1f4){logger[_0xc31b('0x14')](_0xc31b('0x15'),_0x5a6bb3,_0x261b81['error']['message']);return _0x275318(_0x261b81['error'][_0xc31b('0x16')]);}logger[_0xc31b('0x14')](_0xc31b('0x15'),_0x5a6bb3,_0x261b81['error']['message']);return _0x535a29(_0x261b81[_0xc31b('0x14')][_0xc31b('0x16')]);}else{logger['info'](_0xc31b('0x15'),_0x5a6bb3,_0xc31b('0x10'));_0x535a29(_0x261b81[_0xc31b('0x17')][_0xc31b('0x16')]);}})[_0xc31b('0x18')](function(_0x588898){logger[_0xc31b('0x14')]('SquareReport,\x20%s,\x20%s',_0x5a6bb3,_0x588898);_0x275318(_0x588898);});});}exports[_0xc31b('0x19')]=function(_0x5ed93f){var _0x207e28=this;return new Promise(function(_0x5c921a,_0x5e20e2){return db[_0xc31b('0x1a')][_0xc31b('0x1b')](_0x5ed93f[_0xc31b('0x1c')],{'raw':_0x5ed93f[_0xc31b('0x1d')]?_0x5ed93f[_0xc31b('0x1d')][_0xc31b('0x1e')]===undefined?!![]:![]:!![]})[_0xc31b('0xe')](function(_0xdc7b25){logger[_0xc31b('0xf')]('CreateSquareReport',_0x5ed93f);logger['debug'](_0xc31b('0x19'),_0x5ed93f,JSON[_0xc31b('0x13')](_0xdc7b25));_0x5c921a(_0xdc7b25);})[_0xc31b('0x18')](function(_0x14481c){logger[_0xc31b('0x14')](_0xc31b('0x19'),_0x14481c[_0xc31b('0x16')],_0x5ed93f);_0x5e20e2(_0x207e28[_0xc31b('0x14')](0x1f4,_0x14481c['message']));});});};exports[_0xc31b('0x1f')]=function(_0x4ca3d7){var _0x88c4c5=this;return new Promise(function(_0x237724,_0x4bcebe){return db['SquareReport'][_0xc31b('0x20')](_0x4ca3d7[_0xc31b('0x1c')],{'raw':_0x4ca3d7[_0xc31b('0x1d')]?_0x4ca3d7[_0xc31b('0x1d')][_0xc31b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca3d7['options']?_0x4ca3d7[_0xc31b('0x1d')][_0xc31b('0x21')]||null:null,'attributes':_0x4ca3d7['options']?_0x4ca3d7[_0xc31b('0x1d')][_0xc31b('0x22')]||null:null,'limit':_0x4ca3d7[_0xc31b('0x1d')]?_0x4ca3d7[_0xc31b('0x1d')][_0xc31b('0x23')]||null:null})['then'](function(_0x4814fe){logger[_0xc31b('0xf')](_0xc31b('0x1f'),_0x4ca3d7);logger[_0xc31b('0x11')](_0xc31b('0x1f'),_0x4ca3d7,JSON['stringify'](_0x4814fe));_0x237724(_0x4814fe);})[_0xc31b('0x18')](function(_0x5164c1){logger[_0xc31b('0x14')](_0xc31b('0x1f'),_0x5164c1[_0xc31b('0x16')],_0x4ca3d7);_0x4bcebe(_0x88c4c5[_0xc31b('0x14')](0x1f4,_0x5164c1[_0xc31b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6ebb719..5855f44 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 _0xa6b1=['create','delete','destroy','multer','express','Router','../../components/auth/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xa6b1,0x19b));var _0x1a6b=function(_0x50343b,_0xbb3add){_0x50343b=_0x50343b-0x0;var _0x56ce62=_0xa6b1[_0x50343b];return _0x56ce62;};'use strict';var multer=require(_0x1a6b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1a6b('0x1'));var router=express[_0x1a6b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1a6b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1a6b('0x4'));var controller=require(_0x1a6b('0x5'));router['get']('/',auth[_0x1a6b('0x6')](),controller[_0x1a6b('0x7')]);router[_0x1a6b('0x8')](_0x1a6b('0x9'),auth[_0x1a6b('0x6')](),controller[_0x1a6b('0xa')]);router[_0x1a6b('0x8')](_0x1a6b('0xb'),auth[_0x1a6b('0x6')](),controller[_0x1a6b('0xc')]);router[_0x1a6b('0xd')]('/',auth['isAuthenticated'](),controller[_0x1a6b('0xe')]);router['put'](_0x1a6b('0xb'),auth[_0x1a6b('0x6')](),controller['update']);router[_0x1a6b('0xf')](_0x1a6b('0xb'),auth[_0x1a6b('0x6')](),controller[_0x1a6b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4601=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','/:id','show','put','update','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4601,0xd1));var _0x1460=function(_0x32bc2c,_0x2f1456){_0x32bc2c=_0x32bc2c-0x0;var _0x1115f6=_0x4601[_0x32bc2c];return _0x1115f6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1460('0x0'));var express=require(_0x1460('0x1'));var router=express[_0x1460('0x2')]();var fs_extra=require(_0x1460('0x3'));var auth=require(_0x1460('0x4'));var interaction=require(_0x1460('0x5'));var config=require(_0x1460('0x6'));var controller=require(_0x1460('0x7'));router[_0x1460('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1460('0x8')]('/describe',auth[_0x1460('0x9')](),controller[_0x1460('0xa')]);router[_0x1460('0x8')](_0x1460('0xb'),auth[_0x1460('0x9')](),controller[_0x1460('0xc')]);router['post']('/',auth[_0x1460('0x9')](),controller['create']);router[_0x1460('0xd')]('/:id',auth[_0x1460('0x9')](),controller[_0x1460('0xe')]);router['delete'](_0x1460('0xb'),auth[_0x1460('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6d721f7..00bed72 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 _0x0412=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0412,0xad));var _0x2041=function(_0x3fa1db,_0x170cae){_0x3fa1db=_0x3fa1db-0x0;var _0x25272c=_0x0412[_0x3fa1db];return _0x25272c;};'use strict';var Sequelize=require(_0x2041('0x0'));module[_0x2041('0x1')]={'uniqueid':{'type':Sequelize[_0x2041('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x2041('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x2041('0x2')]},'callerid':{'type':Sequelize[_0x2041('0x2')]}}; \ No newline at end of file +var _0xc9ca=['STRING','TEXT','sequelize','exports'];(function(_0x5f31f6,_0x83e4f3){var _0x5acc4b=function(_0x3c7a89){while(--_0x3c7a89){_0x5f31f6['push'](_0x5f31f6['shift']());}};_0x5acc4b(++_0x83e4f3);}(_0xc9ca,0x116));var _0xac9c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc9ca[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xac9c('0x0'));module[_0xac9c('0x1')]={'uniqueid':{'type':Sequelize[_0xac9c('0x2')]},'node':{'type':Sequelize[_0xac9c('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xac9c('0x3')]},'project_name':{'type':Sequelize[_0xac9c('0x2')]},'callerid':{'type':Sequelize[_0xac9c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7d43f0e..4006d08 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 _0x91a7=['options','findAll','rows','catch','rawAttributes','includeAll','include','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','merge','where','VIRTUAL'];(function(_0x21dbe6,_0x1e16af){var _0x130810=function(_0x38b189){while(--_0x38b189){_0x21dbe6['push'](_0x21dbe6['shift']());}};_0x130810(++_0x1e16af);}(_0x91a7,0xe7));var _0x791a=function(_0x218121,_0x2199c5){_0x218121=_0x218121-0x0;var _0x1b8a54=_0x91a7[_0x218121];return _0x1b8a54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x380329,_0x2966b8){return function(_0x4d748a){if(!_0x4d748a){_0x380329[_0x791a('0x16')](0x194);}return _0x4d748a;};}function handleError(_0x2db3f7,_0x51dcca){_0x51dcca=_0x51dcca||0x1f4;return function(_0xdfa84f){logger[_0x791a('0x24')](_0xdfa84f[_0x791a('0x25')]);if(_0xdfa84f['name']){delete _0xdfa84f[_0x791a('0x26')];}_0x2db3f7[_0x791a('0x18')](_0x51dcca)[_0x791a('0x27')](_0xdfa84f);};}exports[_0x791a('0x28')]=function(_0x4f423,_0x1a9c6b){var _0x628816={},_0x889534={},_0x58bbc0={'count':0x0,'rows':[]};var _0xbc3436=_[_0x791a('0x29')](db[_0x791a('0x2a')]['rawAttributes'],function(_0x1cdda9){return{'name':_0x1cdda9['fieldName'],'type':_0x1cdda9[_0x791a('0x2b')][_0x791a('0x2c')]};});_0x889534[_0x791a('0x2d')]=_[_0x791a('0x29')](_0xbc3436,_0x791a('0x26'));_0x889534[_0x791a('0x2e')]=_[_0x791a('0x2f')](_0x4f423['query']);_0x889534[_0x791a('0x30')]=_[_0x791a('0x31')](_0x889534[_0x791a('0x2d')],_0x889534[_0x791a('0x2e')]);_0x628816[_0x791a('0x32')]=_['intersection'](_0x889534[_0x791a('0x2d')],qs[_0x791a('0x33')](_0x4f423[_0x791a('0x2e')][_0x791a('0x33')]));_0x628816[_0x791a('0x32')]=_0x628816['attributes'][_0x791a('0x34')]?_0x628816[_0x791a('0x32')]:_0x889534[_0x791a('0x2d')];if(!_0x4f423[_0x791a('0x2e')][_0x791a('0x35')]('nolimit')){_0x628816[_0x791a('0x36')]=qs['limit'](_0x4f423[_0x791a('0x2e')]['limit']);_0x628816['offset']=qs[_0x791a('0x1a')](_0x4f423[_0x791a('0x2e')][_0x791a('0x1a')]);}_0x628816[_0x791a('0x37')]=qs[_0x791a('0x38')](_0x4f423[_0x791a('0x2e')][_0x791a('0x38')]);_0x628816['where']=qs[_0x791a('0x30')](_['pick'](_0x4f423[_0x791a('0x2e')],_0x889534['filters']),_0xbc3436);if(_0x4f423[_0x791a('0x2e')][_0x791a('0x39')]){_0x628816['where']=_[_0x791a('0x3a')](_0x628816[_0x791a('0x3b')],{'$or':_['map'](_0xbc3436,function(_0x45fbfa){if(_0x45fbfa[_0x791a('0x2b')]!==_0x791a('0x3c')){var _0x23db7d={};_0x23db7d[_0x45fbfa[_0x791a('0x26')]]={'$like':'%'+_0x4f423[_0x791a('0x2e')][_0x791a('0x39')]+'%'};return _0x23db7d;}})});}_0x628816=_[_0x791a('0x3a')]({},_0x628816,_0x4f423[_0x791a('0x3d')]);var _0xeafbb5={'where':_0x628816['where']};return db[_0x791a('0x2a')][_0x791a('0x1c')](_0xeafbb5)[_0x791a('0x22')](function(_0x4efbf6){_0x58bbc0[_0x791a('0x1c')]=_0x4efbf6;if(_0x4f423['query']['includeAll']){_0x628816['include']=[{'all':!![]}];}return db[_0x791a('0x2a')][_0x791a('0x3e')](_0x628816);})['then'](function(_0x415c44){_0x58bbc0[_0x791a('0x3f')]=_0x415c44;return _0x58bbc0;})[_0x791a('0x22')](respondWithFilteredResult(_0x1a9c6b,_0x628816))[_0x791a('0x40')](handleError(_0x1a9c6b,null));};exports['show']=function(_0x483336,_0x57b9ba){var _0x2f0395={'raw':!![],'where':{'id':_0x483336['params']['id']}},_0x216dd3={};_0x216dd3[_0x791a('0x2d')]=_[_0x791a('0x2f')](db[_0x791a('0x2a')][_0x791a('0x41')]);_0x216dd3['query']=_[_0x791a('0x2f')](_0x483336['query']);_0x216dd3[_0x791a('0x30')]=_[_0x791a('0x31')](_0x216dd3[_0x791a('0x2d')],_0x216dd3[_0x791a('0x2e')]);_0x2f0395[_0x791a('0x32')]=_['intersection'](_0x216dd3[_0x791a('0x2d')],qs[_0x791a('0x33')](_0x483336[_0x791a('0x2e')][_0x791a('0x33')]));_0x2f0395[_0x791a('0x32')]=_0x2f0395['attributes'][_0x791a('0x34')]?_0x2f0395[_0x791a('0x32')]:_0x216dd3['model'];if(_0x483336['query'][_0x791a('0x42')]){_0x2f0395[_0x791a('0x43')]=[{'all':!![]}];}_0x2f0395=_[_0x791a('0x3a')]({},_0x2f0395,_0x483336['options']);return db['SquareDetailsReport'][_0x791a('0x44')](_0x2f0395)[_0x791a('0x22')](handleEntityNotFound(_0x57b9ba,null))['then'](respondWithResult(_0x57b9ba,null))[_0x791a('0x40')](handleError(_0x57b9ba,null));};exports[_0x791a('0x45')]=function(_0x3eac77,_0x549980){return db['SquareDetailsReport'][_0x791a('0x45')](_0x3eac77[_0x791a('0x46')],{})[_0x791a('0x22')](respondWithResult(_0x549980,0xc9))[_0x791a('0x40')](handleError(_0x549980,null));};exports['update']=function(_0x2d7c7d,_0x9f768a){if(_0x2d7c7d[_0x791a('0x46')]['id']){delete _0x2d7c7d[_0x791a('0x46')]['id'];}return db['SquareDetailsReport'][_0x791a('0x44')]({'where':{'id':_0x2d7c7d[_0x791a('0x47')]['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x9f768a,null))[_0x791a('0x22')](saveUpdates(_0x2d7c7d[_0x791a('0x46')],null))[_0x791a('0x22')](respondWithResult(_0x9f768a,null))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['destroy']=function(_0xdcb1b,_0x1fd826){return db['SquareDetailsReport'][_0x791a('0x44')]({'where':{'id':_0xdcb1b[_0x791a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1fd826,null))[_0x791a('0x22')](removeEntity(_0x1fd826,null))[_0x791a('0x40')](handleError(_0x1fd826,null));};exports[_0x791a('0x48')]=function(_0x2e357c,_0xd5ec90){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0xd5ec90,null))[_0x791a('0x40')](handleError(_0xd5ec90,null));}; \ No newline at end of file +var _0xf119=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','keys','includeAll','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis'];(function(_0x48d1ee,_0x4e27b2){var _0x1960aa=function(_0x564ec1){while(--_0x564ec1){_0x48d1ee['push'](_0x48d1ee['shift']());}};_0x1960aa(++_0x4e27b2);}(_0xf119,0x7f));var _0x9f11=function(_0x55a9d4,_0x203e63){_0x55a9d4=_0x55a9d4-0x0;var _0x43186c=_0xf119[_0x55a9d4];return _0x43186c;};'use strict';var emlformat=require(_0x9f11('0x0'));var rimraf=require(_0x9f11('0x1'));var zipdir=require(_0x9f11('0x2'));var jsonpatch=require(_0x9f11('0x3'));var rp=require(_0x9f11('0x4'));var moment=require(_0x9f11('0x5'));var BPromise=require(_0x9f11('0x6'));var Mustache=require('mustache');var util=require(_0x9f11('0x7'));var path=require('path');var sox=require(_0x9f11('0x8'));var csv=require(_0x9f11('0x9'));var ejs=require(_0x9f11('0xa'));var fs=require('fs');var fs_extra=require(_0x9f11('0xb'));var _=require('lodash');var squel=require(_0x9f11('0xc'));var crypto=require(_0x9f11('0xd'));var jsforce=require(_0x9f11('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9f11('0x9'));var querystring=require(_0x9f11('0xf'));var Papa=require('papaparse');var Redis=require(_0x9f11('0x10'));var authService=require(_0x9f11('0x11'));var qs=require(_0x9f11('0x12'));var as=require(_0x9f11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f11('0x14'))(_0x9f11('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f11('0x16'));var db=require(_0x9f11('0x17'))['db'];function respondWithStatusCode(_0x16570c,_0x11edee){_0x11edee=_0x11edee||0xcc;return function(_0x48087c){if(_0x48087c){return _0x16570c['sendStatus'](_0x11edee);}return _0x16570c[_0x9f11('0x18')](_0x11edee)[_0x9f11('0x19')]();};}function respondWithResult(_0xfe273f,_0xc3efb0){_0xc3efb0=_0xc3efb0||0xc8;return function(_0x3895fb){if(_0x3895fb){return _0xfe273f[_0x9f11('0x18')](_0xc3efb0)['json'](_0x3895fb);}};}function respondWithFilteredResult(_0x49f9e6,_0x4cf9b2){return function(_0x155b46){if(_0x155b46){var _0x569639=typeof _0x4cf9b2[_0x9f11('0x1a')]==='undefined'&&typeof _0x4cf9b2[_0x9f11('0x1b')]===_0x9f11('0x1c');var _0x5b39b2=_0x155b46['count'];var _0x6be188=_0x569639?0x0:_0x4cf9b2['offset'];var _0x4d41d5=_0x569639?_0x155b46[_0x9f11('0x1d')]:_0x4cf9b2[_0x9f11('0x1a')]+_0x4cf9b2['limit'];var _0x4b2bb0;if(_0x4d41d5>=_0x5b39b2){_0x4d41d5=_0x5b39b2;_0x4b2bb0=0xc8;}else{_0x4b2bb0=0xce;}_0x49f9e6[_0x9f11('0x18')](_0x4b2bb0);return _0x49f9e6['set'](_0x9f11('0x1e'),_0x6be188+'-'+_0x4d41d5+'/'+_0x5b39b2)['json'](_0x155b46);}return null;};}function patchUpdates(_0x34d396){return function(_0x283cb3){try{jsonpatch[_0x9f11('0x1f')](_0x283cb3,_0x34d396,!![]);}catch(_0x41a727){return BPromise[_0x9f11('0x20')](_0x41a727);}return _0x283cb3[_0x9f11('0x21')]();};}function saveUpdates(_0x2e2823,_0x50a511){return function(_0x112efe){if(_0x112efe){return _0x112efe[_0x9f11('0x22')](_0x2e2823)[_0x9f11('0x23')](function(_0x17009a){return _0x17009a;});}return null;};}function removeEntity(_0x20203d,_0x2e5b89){return function(_0x280a81){if(_0x280a81){return _0x280a81[_0x9f11('0x24')]()[_0x9f11('0x23')](function(){_0x20203d[_0x9f11('0x18')](0xcc)[_0x9f11('0x19')]();});}};}function handleEntityNotFound(_0x37c7cc,_0x553d4c){return function(_0x52efde){if(!_0x52efde){_0x37c7cc['sendStatus'](0x194);}return _0x52efde;};}function handleError(_0x5a3fb5,_0xdd2f89){_0xdd2f89=_0xdd2f89||0x1f4;return function(_0x46a180){logger[_0x9f11('0x25')](_0x46a180[_0x9f11('0x26')]);if(_0x46a180[_0x9f11('0x27')]){delete _0x46a180['name'];}_0x5a3fb5[_0x9f11('0x18')](_0xdd2f89)[_0x9f11('0x28')](_0x46a180);};}exports['index']=function(_0xafab56,_0x3550e4){var _0x54c319={},_0x66db59={},_0x436b08={'count':0x0,'rows':[]};var _0x284052=_[_0x9f11('0x29')](db[_0x9f11('0x2a')][_0x9f11('0x2b')],function(_0xcd45c1){return{'name':_0xcd45c1[_0x9f11('0x2c')],'type':_0xcd45c1[_0x9f11('0x2d')]['key']};});_0x66db59['model']=_['map'](_0x284052,_0x9f11('0x27'));_0x66db59[_0x9f11('0x2e')]=_['keys'](_0xafab56[_0x9f11('0x2e')]);_0x66db59[_0x9f11('0x2f')]=_['intersection'](_0x66db59['model'],_0x66db59['query']);_0x54c319[_0x9f11('0x30')]=_[_0x9f11('0x31')](_0x66db59[_0x9f11('0x32')],qs[_0x9f11('0x33')](_0xafab56['query']['fields']));_0x54c319[_0x9f11('0x30')]=_0x54c319[_0x9f11('0x30')]['length']?_0x54c319['attributes']:_0x66db59[_0x9f11('0x32')];if(!_0xafab56[_0x9f11('0x2e')][_0x9f11('0x34')](_0x9f11('0x35'))){_0x54c319[_0x9f11('0x1b')]=qs[_0x9f11('0x1b')](_0xafab56['query'][_0x9f11('0x1b')]);_0x54c319[_0x9f11('0x1a')]=qs[_0x9f11('0x1a')](_0xafab56[_0x9f11('0x2e')][_0x9f11('0x1a')]);}_0x54c319['order']=qs[_0x9f11('0x36')](_0xafab56[_0x9f11('0x2e')][_0x9f11('0x36')]);_0x54c319[_0x9f11('0x37')]=qs[_0x9f11('0x2f')](_[_0x9f11('0x38')](_0xafab56[_0x9f11('0x2e')],_0x66db59[_0x9f11('0x2f')]),_0x284052);if(_0xafab56['query'][_0x9f11('0x39')]){_0x54c319['where']=_[_0x9f11('0x3a')](_0x54c319['where'],{'$or':_[_0x9f11('0x29')](_0x284052,function(_0x32e98f){if(_0x32e98f[_0x9f11('0x2d')]!==_0x9f11('0x3b')){var _0x58d03f={};_0x58d03f[_0x32e98f[_0x9f11('0x27')]]={'$like':'%'+_0xafab56[_0x9f11('0x2e')]['filter']+'%'};return _0x58d03f;}})});}_0x54c319=_['merge']({},_0x54c319,_0xafab56['options']);var _0x2bb2cf={'where':_0x54c319['where']};return db[_0x9f11('0x2a')]['count'](_0x2bb2cf)[_0x9f11('0x23')](function(_0x545411){_0x436b08[_0x9f11('0x1d')]=_0x545411;if(_0xafab56[_0x9f11('0x2e')]['includeAll']){_0x54c319['include']=[{'all':!![]}];}return db[_0x9f11('0x2a')][_0x9f11('0x3c')](_0x54c319);})[_0x9f11('0x23')](function(_0x2eab59){_0x436b08[_0x9f11('0x3d')]=_0x2eab59;return _0x436b08;})[_0x9f11('0x23')](respondWithFilteredResult(_0x3550e4,_0x54c319))['catch'](handleError(_0x3550e4,null));};exports[_0x9f11('0x3e')]=function(_0x313ffa,_0x2134b6){var _0x11a7a3={'raw':!![],'where':{'id':_0x313ffa[_0x9f11('0x3f')]['id']}},_0x7d74f5={};_0x7d74f5[_0x9f11('0x32')]=_['keys'](db[_0x9f11('0x2a')][_0x9f11('0x2b')]);_0x7d74f5[_0x9f11('0x2e')]=_[_0x9f11('0x40')](_0x313ffa[_0x9f11('0x2e')]);_0x7d74f5[_0x9f11('0x2f')]=_[_0x9f11('0x31')](_0x7d74f5['model'],_0x7d74f5[_0x9f11('0x2e')]);_0x11a7a3[_0x9f11('0x30')]=_[_0x9f11('0x31')](_0x7d74f5[_0x9f11('0x32')],qs[_0x9f11('0x33')](_0x313ffa[_0x9f11('0x2e')][_0x9f11('0x33')]));_0x11a7a3[_0x9f11('0x30')]=_0x11a7a3['attributes']['length']?_0x11a7a3[_0x9f11('0x30')]:_0x7d74f5[_0x9f11('0x32')];if(_0x313ffa['query'][_0x9f11('0x41')]){_0x11a7a3['include']=[{'all':!![]}];}_0x11a7a3=_[_0x9f11('0x3a')]({},_0x11a7a3,_0x313ffa[_0x9f11('0x42')]);return db[_0x9f11('0x2a')][_0x9f11('0x43')](_0x11a7a3)['then'](handleEntityNotFound(_0x2134b6,null))[_0x9f11('0x23')](respondWithResult(_0x2134b6,null))['catch'](handleError(_0x2134b6,null));};exports[_0x9f11('0x44')]=function(_0x20172c,_0x1cecf4){return db['SquareDetailsReport'][_0x9f11('0x44')](_0x20172c[_0x9f11('0x45')],{})[_0x9f11('0x23')](respondWithResult(_0x1cecf4,0xc9))[_0x9f11('0x46')](handleError(_0x1cecf4,null));};exports[_0x9f11('0x22')]=function(_0x3ef6c6,_0xb2d6f4){if(_0x3ef6c6[_0x9f11('0x45')]['id']){delete _0x3ef6c6[_0x9f11('0x45')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x3ef6c6[_0x9f11('0x3f')]['id']}})[_0x9f11('0x23')](handleEntityNotFound(_0xb2d6f4,null))[_0x9f11('0x23')](saveUpdates(_0x3ef6c6[_0x9f11('0x45')],null))[_0x9f11('0x23')](respondWithResult(_0xb2d6f4,null))[_0x9f11('0x46')](handleError(_0xb2d6f4,null));};exports[_0x9f11('0x24')]=function(_0x35c57b,_0x596d5d){return db[_0x9f11('0x2a')][_0x9f11('0x43')]({'where':{'id':_0x35c57b[_0x9f11('0x3f')]['id']}})['then'](handleEntityNotFound(_0x596d5d,null))['then'](removeEntity(_0x596d5d,null))[_0x9f11('0x46')](handleError(_0x596d5d,null));};exports[_0x9f11('0x47')]=function(_0x5cbfb3,_0x542d23){return db[_0x9f11('0x2a')][_0x9f11('0x47')]()[_0x9f11('0x23')](respondWithResult(_0x542d23,null))[_0x9f11('0x46')](handleError(_0x542d23,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 6745b15..1cfd85c 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 _0x76b9=['define','report_square_details','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x3cdd7a,_0x266f22){var _0xca7994=function(_0xf9114c){while(--_0xf9114c){_0x3cdd7a['push'](_0x3cdd7a['shift']());}};_0xca7994(++_0x266f22);}(_0x76b9,0x18e));var _0x976b=function(_0x4309ec,_0x169857){_0x4309ec=_0x4309ec-0x0;var _0x2b6458=_0x76b9[_0x4309ec];return _0x2b6458;};'use strict';var _=require(_0x976b('0x0'));var util=require(_0x976b('0x1'));var logger=require(_0x976b('0x2'))(_0x976b('0x3'));var moment=require('moment');var BPromise=require(_0x976b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x976b('0x5'));var rimraf=require('rimraf');var config=require(_0x976b('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x472c6f,_0x38de41){return _0x472c6f[_0x976b('0x7')]('SquareDetailsReport',attributes,{'tableName':_0x976b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ce7=['SquareDetailsReport','report_square_details','util','api','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x9ce7,0x12e));var _0x79ce=function(_0x1a8cbd,_0x11565b){_0x1a8cbd=_0x1a8cbd-0x0;var _0x53fcc3=_0x9ce7[_0x1a8cbd];return _0x53fcc3;};'use strict';var _=require('lodash');var util=require(_0x79ce('0x0'));var logger=require('../../config/logger')(_0x79ce('0x1'));var moment=require(_0x79ce('0x2'));var BPromise=require('bluebird');var rp=require(_0x79ce('0x3'));var fs=require('fs');var path=require(_0x79ce('0x4'));var rimraf=require(_0x79ce('0x5'));var config=require(_0x79ce('0x6'));var attributes=require(_0x79ce('0x7'));module[_0x79ce('0x8')]=function(_0x2923ad,_0x352e20){return _0x2923ad[_0x79ce('0x9')](_0x79ce('0xa'),attributes,{'tableName':_0x79ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 5b48b74..379336c 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 _0x5ba3=['../../config/utils','rpc','../../config/environment','jayson/promise','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','CreateSquareDetailsReport','create','body','options','raw','stringify','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x25b314,_0x2af525){var _0x2f267f=function(_0x38061b){while(--_0x38061b){_0x25b314['push'](_0x25b314['shift']());}};_0x2f267f(++_0x2af525);}(_0x5ba3,0x140));var _0x35ba=function(_0x1c29dd,_0xd3421){_0x1c29dd=_0x1c29dd-0x0;var _0x21f64a=_0x5ba3[_0x1c29dd];return _0x21f64a;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ba('0x3'));var db=require(_0x35ba('0x4'))['db'];var utils=require(_0x35ba('0x5'));var logger=require('../../config/logger')(_0x35ba('0x6'));var config=require(_0x35ba('0x7'));var jayson=require(_0x35ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cd5f,_0x3264d3,_0x380ffb){return new BPromise(function(_0x4c55f3,_0x22bed8){return client['request'](_0x20cd5f,_0x380ffb)[_0x35ba('0x9')](function(_0x366ddc){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x3264d3,'request\x20sent');logger[_0x35ba('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3264d3,'request\x20sent',JSON['stringify'](_0x366ddc));if(_0x366ddc[_0x35ba('0xd')]){if(_0x366ddc[_0x35ba('0xd')][_0x35ba('0xe')]===0x1f4){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x22bed8(_0x366ddc[_0x35ba('0xd')]['message']);}logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x4c55f3(_0x366ddc['error'][_0x35ba('0xf')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3264d3,_0x35ba('0x10'));_0x4c55f3(_0x366ddc[_0x35ba('0x11')]['message']);}})[_0x35ba('0x12')](function(_0x2b6b71){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x2b6b71);_0x22bed8(_0x2b6b71);});});}exports[_0x35ba('0x13')]=function(_0x374f91){var _0x4e96c6=this;return new Promise(function(_0x423666,_0x247440){return db['SquareDetailsReport'][_0x35ba('0x14')](_0x374f91[_0x35ba('0x15')],{'raw':_0x374f91[_0x35ba('0x16')]?_0x374f91[_0x35ba('0x16')][_0x35ba('0x17')]===undefined?!![]:![]:!![]})[_0x35ba('0x9')](function(_0x3f5e92){logger[_0x35ba('0xa')](_0x35ba('0x13'),_0x374f91);logger[_0x35ba('0xc')](_0x35ba('0x13'),_0x374f91,JSON[_0x35ba('0x18')](_0x3f5e92));_0x423666(_0x3f5e92);})['catch'](function(_0x2d3b2b){logger[_0x35ba('0xd')](_0x35ba('0x13'),_0x2d3b2b[_0x35ba('0xf')],_0x374f91);_0x247440(_0x4e96c6[_0x35ba('0xd')](0x1f4,_0x2d3b2b[_0x35ba('0xf')]));});});}; \ No newline at end of file +var _0x8f59=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','debug','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x405022,_0x2377a8){var _0x3b29e7=function(_0xb927b5){while(--_0xb927b5){_0x405022['push'](_0x405022['shift']());}};_0x3b29e7(++_0x2377a8);}(_0x8f59,0x11d));var _0x98f5=function(_0x4641d5,_0x5bf8c9){_0x4641d5=_0x4641d5-0x0;var _0x253adb=_0x8f59[_0x4641d5];return _0x253adb;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')](_0x51a567[_0x98f5('0x17')],{'raw':_0x51a567['options']?_0x51a567[_0x98f5('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x98f5('0x19')](function(_0x191f23){logger['info'](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x1a')](_0x98f5('0x14'),_0x51a567,JSON[_0x98f5('0x1b')](_0x191f23));_0x9e42dd(_0x191f23);})[_0x98f5('0x1c')](function(_0x3dc7c2){logger[_0x98f5('0x11')]('CreateSquareDetailsReport',_0x3dc7c2[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c['error'](0x1f4,_0x3dc7c2[_0x98f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f75de84..f0d6713 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 _0xc386=['/process/:pid/kill','isAuthenticated','killProcess','express','../../components/auth/service','./system.controller','get','index'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0xc386,0x123));var _0x6c38=function(_0x5d8e21,_0x1cacd5){_0x5d8e21=_0x5d8e21-0x0;var _0x18dd58=_0xc386[_0x5d8e21];return _0x18dd58;};'use strict';var express=require(_0x6c38('0x0'));var router=express['Router']();var auth=require(_0x6c38('0x1'));var controller=require(_0x6c38('0x2'));router[_0x6c38('0x3')]('/',auth['isAuthenticated'](),controller[_0x6c38('0x4')]);router['get'](_0x6c38('0x5'),auth[_0x6c38('0x6')](),controller[_0x6c38('0x7')]);module['exports']=router; \ No newline at end of file +var _0x1690=['get','/process/:pid/kill','exports','express','Router','./system.controller','isAuthenticated','index'];(function(_0xdaff31,_0xaf350e){var _0x27f9fb=function(_0x5dedb0){while(--_0x5dedb0){_0xdaff31['push'](_0xdaff31['shift']());}};_0x27f9fb(++_0xaf350e);}(_0x1690,0x1b3));var _0x0169=function(_0x11bf6e,_0x5283f4){_0x11bf6e=_0x11bf6e-0x0;var _0xe68c9e=_0x1690[_0x11bf6e];return _0xe68c9e;};'use strict';var express=require(_0x0169('0x0'));var router=express[_0x0169('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x0169('0x2'));router['get']('/',auth[_0x0169('0x3')](),controller[_0x0169('0x4')]);router[_0x0169('0x5')](_0x0169('0x6'),auth[_0x0169('0x3')](),controller['killProcess']);module[_0x0169('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 40ed72a..e4a6d79 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 _0xeb17=['components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','format','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','killProcess'];(function(_0x455eb8,_0x32d25a){var _0x313b84=function(_0xb813e1){while(--_0xb813e1){_0x455eb8['push'](_0x455eb8['shift']());}};_0x313b84(++_0x32d25a);}(_0xeb17,0x1d2));var _0x7eb1=function(_0x27bffc,_0x281f4d){_0x27bffc=_0x27bffc-0x0;var _0x8d362e=_0xeb17[_0x27bffc];return _0x8d362e;};'use strict';var info=require(_0x7eb1('0x0'));var exec=require(_0x7eb1('0x1'))['exec'];var logger=require('../../config/logger')('api');var util=require(_0x7eb1('0x2'));var BPromise=require(_0x7eb1('0x3'));var _=require(_0x7eb1('0x4'));function handleError(_0x582b3a,_0x126995,_0x442bfc){_0x126995=_0x126995||0x1f4;return function(_0x2ffd5b){logger['error'](_0x7eb1('0x5'),_0x442bfc,_0x126995,util[_0x7eb1('0x6')](_0x2ffd5b,{'showHidden':![],'depth':null}));delete _0x2ffd5b[_0x7eb1('0x7')];_0x582b3a[_0x7eb1('0x8')](_0x126995)['send'](_0x2ffd5b);};}exports[_0x7eb1('0x9')]=function(_0x3df73f,_0x4bd229){return info[_0x7eb1('0xa')]()[_0x7eb1('0xb')](function(_0x2d2cf7){return _0x4bd229[_0x7eb1('0x8')](0xc8)[_0x7eb1('0xc')](_0x2d2cf7);})['catch'](function(_0x244818){return _0x4bd229[_0x7eb1('0x8')](0x1f4)[_0x7eb1('0xc')](_0x244818);});};exports[_0x7eb1('0xd')]=function(_0x58212d,_0x3ab2ca){var _0x210516=[_0x7eb1('0xe')];return new BPromise(function(_0x2c3ca2,_0x5516d0){return exec(util['format'](_0x7eb1('0xf'),_0x58212d['params'][_0x7eb1('0x10')]),function(_0xa3c029,_0x4d1b70,_0x41c4e5){if(_0xa3c029){return _0x5516d0(_0xa3c029);}return _0x2c3ca2(_0x4d1b70);});})[_0x7eb1('0xb')](function(_0x1a4e83){var _0x579d96=![];var _0x474633=_0x1a4e83['split'](/\n/);for(var _0x4bef1d=0x0,_0x2709c4=_0x210516[_0x7eb1('0x11')];_0x4bef1d<_0x2709c4,_0x579d96===![];_0x4bef1d+=0x1){if(_0x1a4e83[_0x7eb1('0x12')](_0x210516[_0x4bef1d])>=0x0){_0x579d96=!![];}}if(!_0x579d96){throw new Error(util[_0x7eb1('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x58212d[_0x7eb1('0x14')][_0x7eb1('0x10')]));}process[_0x7eb1('0x15')](_0x58212d[_0x7eb1('0x14')][_0x7eb1('0x10')],'SIGINT');return _0x3ab2ca['status'](0xc8)['json']({'message':util[_0x7eb1('0x13')](_0x7eb1('0x16'),_0x58212d[_0x7eb1('0x14')][_0x7eb1('0x10')])});})[_0x7eb1('0x17')](handleError(_0x3ab2ca,null,_0x7eb1('0xd')));}; \ No newline at end of file +var _0x4969=['pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','then','json','killProcess','components/import/cm'];(function(_0x5c4798,_0x4f29e8){var _0x6c0a96=function(_0x30de62){while(--_0x30de62){_0x5c4798['push'](_0x5c4798['shift']());}};_0x6c0a96(++_0x4f29e8);}(_0x4969,0x1ec));var _0x9496=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x4969[_0x2ddfd9];return _0x2668f0;};'use strict';var info=require('systeminformation');var exec=require(_0x9496('0x0'))[_0x9496('0x1')];var logger=require(_0x9496('0x2'))('api');var util=require(_0x9496('0x3'));var BPromise=require(_0x9496('0x4'));var _=require(_0x9496('0x5'));function handleError(_0x1893b5,_0x172e4d,_0x4af479){_0x172e4d=_0x172e4d||0x1f4;return function(_0x5be29e){logger['error'](_0x9496('0x6'),_0x4af479,_0x172e4d,util['inspect'](_0x5be29e,{'showHidden':![],'depth':null}));delete _0x5be29e['name'];_0x1893b5[_0x9496('0x7')](_0x172e4d)[_0x9496('0x8')](_0x5be29e);};}exports[_0x9496('0x9')]=function(_0xd87e14,_0x4ff0d8){return info['getAllData']()[_0x9496('0xa')](function(_0x42ad14){return _0x4ff0d8[_0x9496('0x7')](0xc8)[_0x9496('0xb')](_0x42ad14);})['catch'](function(_0x413f61){return _0x4ff0d8[_0x9496('0x7')](0x1f4)[_0x9496('0xb')](_0x413f61);});};exports[_0x9496('0xc')]=function(_0x317646,_0x4fe75d){var _0x509e66=[_0x9496('0xd')];return new BPromise(function(_0x4f2389,_0x3bea0f){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x317646['params'][_0x9496('0xe')]),function(_0x24ef96,_0x3cc651,_0x4a2122){if(_0x24ef96){return _0x3bea0f(_0x24ef96);}return _0x4f2389(_0x3cc651);});})['then'](function(_0x290f74){var _0x3d2371=![];var _0x50a0bc=_0x290f74[_0x9496('0xf')](/\n/);for(var _0x146703=0x0,_0x2d4452=_0x509e66[_0x9496('0x10')];_0x146703<_0x2d4452,_0x3d2371===![];_0x146703+=0x1){if(_0x290f74[_0x9496('0x11')](_0x509e66[_0x146703])>=0x0){_0x3d2371=!![];}}if(!_0x3d2371){throw new Error(util['format'](_0x9496('0x12'),_0x317646[_0x9496('0x13')][_0x9496('0xe')]));}process['kill'](_0x317646[_0x9496('0x13')][_0x9496('0xe')],_0x9496('0x14'));return _0x4fe75d['status'](0xc8)[_0x9496('0xb')]({'message':util[_0x9496('0x15')](_0x9496('0x16'),_0x317646[_0x9496('0x13')][_0x9496('0xe')])});})['catch'](handleError(_0x4fe75d,null,_0x9496('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a1e2403..6d92112 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 _0xf930=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x4eeefb,_0x3d2ecc){var _0x136ec5=function(_0x2020f4){while(--_0x2020f4){_0x4eeefb['push'](_0x4eeefb['shift']());}};_0x136ec5(++_0x3d2ecc);}(_0xf930,0x17e));var _0x0f93=function(_0x4cda61,_0x58285d){_0x4cda61=_0x4cda61-0x0;var _0x3a1fc3=_0xf930[_0x4cda61];return _0x3a1fc3;};'use strict';var multer=require(_0x0f93('0x0'));var util=require(_0x0f93('0x1'));var path=require(_0x0f93('0x2'));var timeout=require(_0x0f93('0x3'));var express=require(_0x0f93('0x4'));var router=express[_0x0f93('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f93('0x6'));var config=require(_0x0f93('0x7'));var controller=require(_0x0f93('0x8'));router[_0x0f93('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f93('0xa')]);router[_0x0f93('0x9')](_0x0f93('0xb'),auth[_0x0f93('0xc')](),controller[_0x0f93('0xd')]);router[_0x0f93('0xe')]('/',auth[_0x0f93('0xc')](),controller[_0x0f93('0xf')]);router[_0x0f93('0x10')]('/:id',auth[_0x0f93('0xc')](),controller[_0x0f93('0x11')]);router[_0x0f93('0x12')](_0x0f93('0xb'),auth[_0x0f93('0xc')](),controller[_0x0f93('0x13')]);module[_0x0f93('0x14')]=router; \ No newline at end of file +var _0x6b68=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','post','put','update','delete','/:id'];(function(_0x55ed81,_0x31b89b){var _0x4fbbc7=function(_0x4fb2a9){while(--_0x4fb2a9){_0x55ed81['push'](_0x55ed81['shift']());}};_0x4fbbc7(++_0x31b89b);}(_0x6b68,0x1ea));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x86b6('0x0'));var path=require(_0x86b6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x86b6('0x2')]();var fs_extra=require(_0x86b6('0x3'));var auth=require(_0x86b6('0x4'));var interaction=require(_0x86b6('0x5'));var config=require(_0x86b6('0x6'));var controller=require('./tag.controller');router['get']('/',auth[_0x86b6('0x7')](),controller['index']);router[_0x86b6('0x8')]('/:id',auth[_0x86b6('0x7')](),controller['show']);router[_0x86b6('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x86b6('0xa')]('/:id',auth[_0x86b6('0x7')](),controller[_0x86b6('0xb')]);router[_0x86b6('0xc')](_0x86b6('0xd'),auth[_0x86b6('0x7')](),controller['destroy']);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 42f77d8..9ea9c28 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 _0xe493=['STRING','name','sequelize','exports'];(function(_0x2f4f77,_0x33c466){var _0x170735=function(_0x6d6477){while(--_0x6d6477){_0x2f4f77['push'](_0x2f4f77['shift']());}};_0x170735(++_0x33c466);}(_0xe493,0x7e));var _0x3e49=function(_0x52240b,_0x327380){_0x52240b=_0x52240b-0x0;var _0x11cade=_0xe493[_0x52240b];return _0x11cade;};'use strict';var Sequelize=require(_0x3e49('0x0'));module[_0x3e49('0x1')]={'name':{'type':Sequelize[_0x3e49('0x2')],'unique':_0x3e49('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3e49('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x3e49('0x2')]}}; \ No newline at end of file +var _0x3266=['#0091EA','sequelize','exports','STRING','name'];(function(_0x73a2f6,_0x2f9681){var _0xf23f46=function(_0x3383de){while(--_0x3383de){_0x73a2f6['push'](_0x73a2f6['shift']());}};_0xf23f46(++_0x2f9681);}(_0x3266,0x6a));var _0x6326=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x3266[_0xbf8ebe];return _0x1e25e8;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6326('0x2')],'defaultValue':_0x6326('0x4')},'description':{'type':Sequelize[_0x6326('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 234722a..f287273 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 _0xbb53=['sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','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','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x461019,_0x55bb65){var _0x3a8bc3=function(_0x33c387){while(--_0x33c387){_0x461019['push'](_0x461019['shift']());}};_0x3a8bc3(++_0x55bb65);}(_0xbb53,0x121));var _0x3bb5=function(_0x4defdf,_0x4872c9){_0x4defdf=_0x4defdf-0x0;var _0x40437d=_0xbb53[_0x4defdf];return _0x40437d;};'use strict';var emlformat=require(_0x3bb5('0x0'));var rimraf=require(_0x3bb5('0x1'));var zipdir=require(_0x3bb5('0x2'));var jsonpatch=require(_0x3bb5('0x3'));var rp=require(_0x3bb5('0x4'));var moment=require(_0x3bb5('0x5'));var BPromise=require(_0x3bb5('0x6'));var Mustache=require(_0x3bb5('0x7'));var util=require(_0x3bb5('0x8'));var path=require(_0x3bb5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bb5('0xa'));var fs=require('fs');var fs_extra=require(_0x3bb5('0xb'));var _=require(_0x3bb5('0xc'));var squel=require(_0x3bb5('0xd'));var crypto=require(_0x3bb5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bb5('0xf'));var Papa=require(_0x3bb5('0x10'));var Redis=require(_0x3bb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bb5('0x13'))(_0x3bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x3bb5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bb5('0x16'))['db'];function respondWithStatusCode(_0x511bd8,_0x526bf0){_0x526bf0=_0x526bf0||0xcc;return function(_0x223356){if(_0x223356){return _0x511bd8[_0x3bb5('0x17')](_0x526bf0);}return _0x511bd8[_0x3bb5('0x18')](_0x526bf0)['end']();};}function respondWithResult(_0xd578fc,_0x12e409){_0x12e409=_0x12e409||0xc8;return function(_0x519123){if(_0x519123){return _0xd578fc[_0x3bb5('0x18')](_0x12e409)[_0x3bb5('0x19')](_0x519123);}};}function respondWithFilteredResult(_0x5cec77,_0x5ca99f){return function(_0x50617f){if(_0x50617f){var _0x42ef1b=typeof _0x5ca99f[_0x3bb5('0x1a')]==='undefined'&&typeof _0x5ca99f[_0x3bb5('0x1b')]===_0x3bb5('0x1c');var _0x4656c4=_0x50617f[_0x3bb5('0x1d')];var _0x48bc25=_0x42ef1b?0x0:_0x5ca99f[_0x3bb5('0x1a')];var _0x1109d0=_0x42ef1b?_0x50617f[_0x3bb5('0x1d')]:_0x5ca99f['offset']+_0x5ca99f['limit'];var _0x19b177;if(_0x1109d0>=_0x4656c4){_0x1109d0=_0x4656c4;_0x19b177=0xc8;}else{_0x19b177=0xce;}_0x5cec77[_0x3bb5('0x18')](_0x19b177);return _0x5cec77[_0x3bb5('0x1e')]('Content-Range',_0x48bc25+'-'+_0x1109d0+'/'+_0x4656c4)[_0x3bb5('0x19')](_0x50617f);}return null;};}function patchUpdates(_0x2afe6e){return function(_0x3f94ad){try{jsonpatch[_0x3bb5('0x1f')](_0x3f94ad,_0x2afe6e,!![]);}catch(_0x21a3ff){return BPromise[_0x3bb5('0x20')](_0x21a3ff);}return _0x3f94ad['save']();};}function saveUpdates(_0x37444e,_0x3eae85){return function(_0x438a8d){if(_0x438a8d){return _0x438a8d[_0x3bb5('0x21')](_0x37444e)[_0x3bb5('0x22')](function(_0xfb9e8){return _0xfb9e8;});}return null;};}function removeEntity(_0x341a3f,_0x58c10f){return function(_0x1d2a24){if(_0x1d2a24){return _0x1d2a24[_0x3bb5('0x23')]()['then'](function(){var _0x4fc81b=_0x1d2a24[_0x3bb5('0x24')]({'plain':!![]});var _0x36cfda='Tags';return db['UserProfileResource'][_0x3bb5('0x23')]({'where':{'type':_0x36cfda,'resourceId':_0x4fc81b['id']}})[_0x3bb5('0x22')](function(){return _0x1d2a24;});})[_0x3bb5('0x22')](function(){_0x341a3f[_0x3bb5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5baf9a,_0x33e943){return function(_0x4e8c65){if(!_0x4e8c65){_0x5baf9a[_0x3bb5('0x17')](0x194);}return _0x4e8c65;};}function handleError(_0x2d65ec,_0x2e67f7){_0x2e67f7=_0x2e67f7||0x1f4;return function(_0x534b15){logger['error'](_0x534b15[_0x3bb5('0x25')]);if(_0x534b15[_0x3bb5('0x26')]){delete _0x534b15[_0x3bb5('0x26')];}_0x2d65ec[_0x3bb5('0x18')](_0x2e67f7)[_0x3bb5('0x27')](_0x534b15);};}exports[_0x3bb5('0x28')]=function(_0x3ed2cc,_0x5ce225){var _0x1b429e={},_0xa643c9={},_0x5ebd0a={'count':0x0,'rows':[]};var _0x2ba5f4=_[_0x3bb5('0x29')](db[_0x3bb5('0x2a')][_0x3bb5('0x2b')],function(_0x52cd46){return{'name':_0x52cd46[_0x3bb5('0x2c')],'type':_0x52cd46[_0x3bb5('0x2d')]['key']};});_0xa643c9[_0x3bb5('0x2e')]=_[_0x3bb5('0x29')](_0x2ba5f4,_0x3bb5('0x26'));_0xa643c9[_0x3bb5('0x2f')]=_[_0x3bb5('0x30')](_0x3ed2cc['query']);_0xa643c9[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0xa643c9[_0x3bb5('0x2e')],_0xa643c9[_0x3bb5('0x2f')]);_0x1b429e['attributes']=_['intersection'](_0xa643c9[_0x3bb5('0x2e')],qs[_0x3bb5('0x33')](_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x1b429e[_0x3bb5('0x34')]=_0x1b429e[_0x3bb5('0x34')][_0x3bb5('0x35')]?_0x1b429e[_0x3bb5('0x34')]:_0xa643c9[_0x3bb5('0x2e')];if(!_0x3ed2cc['query'][_0x3bb5('0x36')](_0x3bb5('0x37'))){_0x1b429e['limit']=qs['limit'](_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x1b')]);_0x1b429e[_0x3bb5('0x1a')]=qs[_0x3bb5('0x1a')](_0x3ed2cc['query']['offset']);}_0x1b429e[_0x3bb5('0x38')]=qs['sort'](_0x3ed2cc[_0x3bb5('0x2f')]['sort']);_0x1b429e['where']=qs[_0x3bb5('0x31')](_['pick'](_0x3ed2cc['query'],_0xa643c9[_0x3bb5('0x31')]),_0x2ba5f4);if(_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x39')]){_0x1b429e['where']=_[_0x3bb5('0x3a')](_0x1b429e['where'],{'$or':_[_0x3bb5('0x29')](_0x2ba5f4,function(_0x47c663){if(_0x47c663[_0x3bb5('0x2d')]!==_0x3bb5('0x3b')){var _0x4209d2={};_0x4209d2[_0x47c663[_0x3bb5('0x26')]]={'$like':'%'+_0x3ed2cc[_0x3bb5('0x2f')][_0x3bb5('0x39')]+'%'};return _0x4209d2;}})});}_0x1b429e=_['merge']({},_0x1b429e,_0x3ed2cc[_0x3bb5('0x3c')]);var _0x7c1b7b={'where':_0x1b429e['where']};return db[_0x3bb5('0x2a')][_0x3bb5('0x1d')](_0x7c1b7b)[_0x3bb5('0x22')](function(_0x5cfb72){_0x5ebd0a[_0x3bb5('0x1d')]=_0x5cfb72;if(_0x3ed2cc[_0x3bb5('0x2f')]['includeAll']){_0x1b429e[_0x3bb5('0x3d')]=[{'all':!![]}];}return db[_0x3bb5('0x2a')][_0x3bb5('0x3e')](_0x1b429e);})[_0x3bb5('0x22')](function(_0x663685){_0x5ebd0a[_0x3bb5('0x3f')]=_0x663685;return _0x5ebd0a;})[_0x3bb5('0x22')](respondWithFilteredResult(_0x5ce225,_0x1b429e))[_0x3bb5('0x40')](handleError(_0x5ce225,null));};exports[_0x3bb5('0x41')]=function(_0x42676d,_0x2539e4){var _0x64e6e7={'raw':!![],'where':{'id':_0x42676d[_0x3bb5('0x42')]['id']}},_0x20478a={};_0x20478a['model']=_[_0x3bb5('0x30')](db[_0x3bb5('0x2a')]['rawAttributes']);_0x20478a['query']=_[_0x3bb5('0x30')](_0x42676d[_0x3bb5('0x2f')]);_0x20478a[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0x20478a[_0x3bb5('0x2e')],_0x20478a[_0x3bb5('0x2f')]);_0x64e6e7[_0x3bb5('0x34')]=_[_0x3bb5('0x32')](_0x20478a['model'],qs['fields'](_0x42676d[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x64e6e7[_0x3bb5('0x34')]=_0x64e6e7['attributes'][_0x3bb5('0x35')]?_0x64e6e7['attributes']:_0x20478a[_0x3bb5('0x2e')];if(_0x42676d[_0x3bb5('0x2f')][_0x3bb5('0x43')]){_0x64e6e7[_0x3bb5('0x3d')]=[{'all':!![]}];}_0x64e6e7=_[_0x3bb5('0x3a')]({},_0x64e6e7,_0x42676d[_0x3bb5('0x3c')]);return db['Tag'][_0x3bb5('0x44')](_0x64e6e7)[_0x3bb5('0x22')](handleEntityNotFound(_0x2539e4,null))['then'](respondWithResult(_0x2539e4,null))[_0x3bb5('0x40')](handleError(_0x2539e4,null));};exports[_0x3bb5('0x45')]=function(_0x5075bd,_0x41edf7){return db[_0x3bb5('0x2a')][_0x3bb5('0x45')](_0x5075bd[_0x3bb5('0x46')],{})[_0x3bb5('0x22')](function(_0x5b2e46){var _0x40f47c=_0x5075bd[_0x3bb5('0x47')]['get']({'plain':!![]});if(!_0x40f47c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40f47c[_0x3bb5('0x48')]===_0x3bb5('0x47')){var _0x1e5b64=_0x5b2e46[_0x3bb5('0x24')]({'plain':!![]});var _0x1e4edd='Tags';return db[_0x3bb5('0x49')][_0x3bb5('0x44')]({'where':{'name':_0x1e4edd,'userProfileId':_0x40f47c[_0x3bb5('0x4a')]},'raw':!![]})[_0x3bb5('0x22')](function(_0x2d03c0){if(_0x2d03c0&&_0x2d03c0[_0x3bb5('0x4b')]===0x0){return db[_0x3bb5('0x4c')]['create']({'name':_0x1e5b64[_0x3bb5('0x26')],'resourceId':_0x1e5b64['id'],'type':_0x2d03c0[_0x3bb5('0x26')],'sectionId':_0x2d03c0['id']},{})[_0x3bb5('0x22')](function(){return _0x5b2e46;});}else{return _0x5b2e46;}})[_0x3bb5('0x40')](function(_0x29e695){logger['error'](_0x3bb5('0x4d'),_0x29e695);throw _0x29e695;});}return _0x5b2e46;})[_0x3bb5('0x22')](respondWithResult(_0x41edf7,0xc9))[_0x3bb5('0x40')](handleError(_0x41edf7,null));};exports[_0x3bb5('0x21')]=function(_0x168aae,_0x3f9133){if(_0x168aae[_0x3bb5('0x46')]['id']){delete _0x168aae[_0x3bb5('0x46')]['id'];}return db['Tag'][_0x3bb5('0x44')]({'where':{'id':_0x168aae[_0x3bb5('0x42')]['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x3f9133,null))[_0x3bb5('0x22')](saveUpdates(_0x168aae['body'],null))[_0x3bb5('0x22')](respondWithResult(_0x3f9133,null))['catch'](handleError(_0x3f9133,null));};exports[_0x3bb5('0x23')]=function(_0x26f66d,_0xe04576){return db[_0x3bb5('0x2a')][_0x3bb5('0x44')]({'where':{'id':_0x26f66d['params']['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0xe04576,null))[_0x3bb5('0x22')](removeEntity(_0xe04576,null))[_0x3bb5('0x40')](handleError(_0xe04576,null));}; \ No newline at end of file +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','Tag','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(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0x008c,0x188));var _0xc008=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x008c[_0x5d72da];return _0x43ebe7;};'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='Tags';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['Tag'][_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['Tag'][_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['Tag'][_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='Tags';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['Tag']['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 diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 6d04b1d..76aa2e9 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 _0xf443=['moment','bluebird','request-promise','path','rimraf','../../config/environment','Tag','tools_tags','lodash','util'];(function(_0x130a1f,_0x120722){var _0x4d8b58=function(_0x5e3b45){while(--_0x5e3b45){_0x130a1f['push'](_0x130a1f['shift']());}};_0x4d8b58(++_0x120722);}(_0xf443,0xda));var _0x3f44=function(_0x4c00f7,_0x59411b){_0x4c00f7=_0x4c00f7-0x0;var _0x3409b5=_0xf443[_0x4c00f7];return _0x3409b5;};'use strict';var _=require(_0x3f44('0x0'));var util=require(_0x3f44('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f44('0x2'));var BPromise=require(_0x3f44('0x3'));var rp=require(_0x3f44('0x4'));var fs=require('fs');var path=require(_0x3f44('0x5'));var rimraf=require(_0x3f44('0x6'));var config=require(_0x3f44('0x7'));var attributes=require('./tag.attributes');module['exports']=function(_0x59b15b,_0x15adbf){return _0x59b15b['define'](_0x3f44('0x8'),attributes,{'tableName':_0x3f44('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ecf=['lodash','util','api','request-promise','path','../../config/environment','./tag.attributes','define','Tag','tools_tags'];(function(_0x4df04b,_0x52b8cb){var _0x5ce10e=function(_0x1dd148){while(--_0x1dd148){_0x4df04b['push'](_0x4df04b['shift']());}};_0x5ce10e(++_0x52b8cb);}(_0x4ecf,0x186));var _0xf4ec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4ecf[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var logger=require('../../config/logger')(_0xf4ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf4ec('0x3'));var fs=require('fs');var path=require(_0xf4ec('0x4'));var rimraf=require('rimraf');var config=require(_0xf4ec('0x5'));var attributes=require(_0xf4ec('0x6'));module['exports']=function(_0x124633,_0x50aa86){return _0x124633[_0xf4ec('0x7')](_0xf4ec('0x8'),attributes,{'tableName':_0xf4ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 7d63f7e..0d9d3ab 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 _0x0c6d=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x63bba5,_0xcb04f6){_0x63bba5=_0x63bba5-0x0;var _0x42e8e8=_0x0c6d[_0x63bba5];return _0x42e8e8;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var moment=require(_0xd0c6('0x1'));var BPromise=require(_0xd0c6('0x2'));var rs=require(_0xd0c6('0x3'));var fs=require('fs');var Redis=require(_0xd0c6('0x4'));var db=require(_0xd0c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c6('0x7')][_0xd0c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4a64,_0x5de1cd,_0x16c6da){return new BPromise(function(_0x534412,_0x2a14f1){return client[_0xd0c6('0x9')](_0x2d4a64,_0x16c6da)[_0xd0c6('0xa')](function(_0x184f65){logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));logger[_0xd0c6('0xe')](_0xd0c6('0xf'),_0x5de1cd,'request\x20sent',JSON[_0xd0c6('0x10')](_0x184f65));if(_0x184f65['error']){if(_0x184f65['error'][_0xd0c6('0x11')]===0x1f4){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x2a14f1(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x534412(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}else{logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));_0x534412(_0x184f65[_0xd0c6('0x14')][_0xd0c6('0x13')]);}})[_0xd0c6('0x15')](function(_0x19dd14){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x19dd14);_0x2a14f1(_0x19dd14);});});} \ No newline at end of file +var _0x0ba7=['client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x0ba7,0x16d));var _0x70ba=function(_0x565580,_0x4f9375){_0x565580=_0x565580-0x0;var _0x4a166d=_0x0ba7[_0x565580];return _0x4a166d;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var moment=require(_0x70ba('0x1'));var BPromise=require(_0x70ba('0x2'));var rs=require(_0x70ba('0x3'));var fs=require('fs');var Redis=require(_0x70ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require(_0x70ba('0x8'));var jayson=require(_0x70ba('0x9'));var client=jayson[_0x70ba('0xa')][_0x70ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5a16,_0x240696,_0x1185cb){return new BPromise(function(_0x1a968b,_0x41cd10){return client[_0x70ba('0xc')](_0x2d5a16,_0x1185cb)[_0x70ba('0xd')](function(_0x465b7c){logger['info'](_0x70ba('0xe'),_0x240696,'request\x20sent');logger[_0x70ba('0xf')](_0x70ba('0x10'),_0x240696,_0x70ba('0x11'),JSON[_0x70ba('0x12')](_0x465b7c));if(_0x465b7c['error']){if(_0x465b7c['error'][_0x70ba('0x13')]===0x1f4){logger['error'](_0x70ba('0xe'),_0x240696,_0x465b7c['error'][_0x70ba('0x14')]);return _0x41cd10(_0x465b7c[_0x70ba('0x15')]['message']);}logger[_0x70ba('0x15')]('Tag,\x20%s,\x20%s',_0x240696,_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);return _0x1a968b(_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);}else{logger[_0x70ba('0x16')](_0x70ba('0xe'),_0x240696,_0x70ba('0x11'));_0x1a968b(_0x465b7c[_0x70ba('0x17')][_0x70ba('0x14')]);}})[_0x70ba('0x18')](function(_0x30ac22){logger[_0x70ba('0x15')](_0x70ba('0xe'),_0x240696,_0x30ac22);_0x41cd10(_0x30ac22);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ceccd34..85b0d16 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_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['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 5d0b5f0..4a1060c 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x2d99c6,_0x2be9d8){var _0x4d611f=function(_0x11e34c){while(--_0x11e34c){_0x2d99c6['push'](_0x2d99c6['shift']());}};_0x4d611f(++_0x2be9d8);}(_0x757a,0xde));var _0xa757=function(_0x465740,_0x1b72ce){_0x465740=_0x465740-0x0;var _0x824123=_0x757a[_0x465740];return _0x824123;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x1499dc,_0x457597){var _0x116878=function(_0x33d535){while(--_0x33d535){_0x1499dc['push'](_0x1499dc['shift']());}};_0x116878(++_0x457597);}(_0xb10b,0x12a));var _0xbb10=function(_0x475191,_0x5bce86){_0x475191=_0x475191-0x0;var _0x189e96=_0xb10b[_0x475191];return _0x189e96;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 398b1cc..5bc09e1 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 _0x8c5b=['UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','order','Queues','findOne','isValidChannel','ids','remove','addAgents','isArray','Chat','Mail','Fax','Openchannel','Whatsapp','Voice','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Sms','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','error','stack','name','index','map','fieldName','type','key','model','keys','intersection','query','fields','attributes','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','Team','then','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','VoiceQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x4f1c33,_0x599f46){var _0x220684=function(_0x2588fa){while(--_0x2588fa){_0x4f1c33['push'](_0x4f1c33['shift']());}};_0x220684(++_0x599f46);}(_0x8c5b,0x16f));var _0xb8c5=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x8c5b[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0xb8c5('0x0'));var rimraf=require(_0xb8c5('0x1'));var zipdir=require(_0xb8c5('0x2'));var jsonpatch=require(_0xb8c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb8c5('0x4'));var Mustache=require('mustache');var util=require(_0xb8c5('0x5'));var path=require(_0xb8c5('0x6'));var sox=require(_0xb8c5('0x7'));var csv=require(_0xb8c5('0x8'));var ejs=require(_0xb8c5('0x9'));var fs=require('fs');var fs_extra=require(_0xb8c5('0xa'));var _=require(_0xb8c5('0xb'));var squel=require(_0xb8c5('0xc'));var crypto=require(_0xb8c5('0xd'));var jsforce=require(_0xb8c5('0xe'));var deskjs=require(_0xb8c5('0xf'));var toCsv=require(_0xb8c5('0x8'));var querystring=require(_0xb8c5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb8c5('0x11'));var qs=require(_0xb8c5('0x12'));var as=require(_0xb8c5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8c5('0x14'))(_0xb8c5('0x15'));var utils=require(_0xb8c5('0x16'));var config=require(_0xb8c5('0x17'));var licenseUtil=require(_0xb8c5('0x18'));var db=require('../../mysqldb')['db'];config[_0xb8c5('0x19')]=_[_0xb8c5('0x1a')](config[_0xb8c5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8c5('0x1b'))(new Redis(config['redis']));require(_0xb8c5('0x1c'))[_0xb8c5('0x1d')](socket);function respondWithStatusCode(_0x5495c2,_0x2888db){_0x2888db=_0x2888db||0xcc;return function(_0x142b13){if(_0x142b13){return _0x5495c2[_0xb8c5('0x1e')](_0x2888db);}return _0x5495c2[_0xb8c5('0x1f')](_0x2888db)[_0xb8c5('0x20')]();};}function respondWithResult(_0x20c558,_0x23167e){_0x23167e=_0x23167e||0xc8;return function(_0x1d8491){if(_0x1d8491){return _0x20c558[_0xb8c5('0x1f')](_0x23167e)['json'](_0x1d8491);}};}function respondWithFilteredResult(_0x38699c,_0x19913a){return function(_0x2eccc0){if(_0x2eccc0){var _0x220b60=typeof _0x19913a[_0xb8c5('0x21')]===_0xb8c5('0x22')&&typeof _0x19913a[_0xb8c5('0x23')]===_0xb8c5('0x22');var _0x35ef3f=_0x2eccc0['count'];var _0x39f30b=_0x220b60?0x0:_0x19913a['offset'];var _0x490171=_0x220b60?_0x2eccc0[_0xb8c5('0x24')]:_0x19913a[_0xb8c5('0x21')]+_0x19913a['limit'];var _0x2d7d5e;if(_0x490171>=_0x35ef3f){_0x490171=_0x35ef3f;_0x2d7d5e=0xc8;}else{_0x2d7d5e=0xce;}_0x38699c[_0xb8c5('0x1f')](_0x2d7d5e);return _0x38699c[_0xb8c5('0x25')](_0xb8c5('0x26'),_0x39f30b+'-'+_0x490171+'/'+_0x35ef3f)['json'](_0x2eccc0);}return null;};}function patchUpdates(_0x2a8d50){return function(_0x180e83){try{jsonpatch['apply'](_0x180e83,_0x2a8d50,!![]);}catch(_0x1be4c0){return BPromise[_0xb8c5('0x27')](_0x1be4c0);}return _0x180e83['save']();};}function saveUpdates(_0x52a448,_0x1a4115){return function(_0x11708b){if(_0x11708b){return _0x11708b['update'](_0x52a448)['then'](function(_0x240d60){return _0x240d60;});}return null;};}function handleEntityNotFound(_0x1a7ad2,_0x459ab4){return function(_0x45fcd5){if(!_0x45fcd5){_0x1a7ad2[_0xb8c5('0x1e')](0x194);}return _0x45fcd5;};}function handleError(_0x5db0e0,_0x1caf06){_0x1caf06=_0x1caf06||0x1f4;return function(_0x4d27f8){logger[_0xb8c5('0x28')](_0x4d27f8[_0xb8c5('0x29')]);if(_0x4d27f8[_0xb8c5('0x2a')]){delete _0x4d27f8[_0xb8c5('0x2a')];}_0x5db0e0['status'](_0x1caf06)['send'](_0x4d27f8);};}exports[_0xb8c5('0x2b')]=function(_0x1e9faa,_0x1d7b64){var _0x355ebb={},_0x54534b={},_0x587ed8={'count':0x0,'rows':[]};var _0x10ceaf=_[_0xb8c5('0x2c')](db['Team']['rawAttributes'],function(_0x1d4570){return{'name':_0x1d4570[_0xb8c5('0x2d')],'type':_0x1d4570[_0xb8c5('0x2e')][_0xb8c5('0x2f')]};});_0x54534b[_0xb8c5('0x30')]=_['map'](_0x10ceaf,_0xb8c5('0x2a'));_0x54534b['query']=_[_0xb8c5('0x31')](_0x1e9faa['query']);_0x54534b['filters']=_[_0xb8c5('0x32')](_0x54534b[_0xb8c5('0x30')],_0x54534b[_0xb8c5('0x33')]);_0x355ebb['attributes']=_[_0xb8c5('0x32')](_0x54534b['model'],qs[_0xb8c5('0x34')](_0x1e9faa[_0xb8c5('0x33')]['fields']));_0x355ebb['attributes']=_0x355ebb[_0xb8c5('0x35')]['length']?_0x355ebb[_0xb8c5('0x35')]:_0x54534b['model'];if(!_0x1e9faa[_0xb8c5('0x33')]['hasOwnProperty'](_0xb8c5('0x36'))){_0x355ebb['limit']=qs[_0xb8c5('0x23')](_0x1e9faa[_0xb8c5('0x33')][_0xb8c5('0x23')]);_0x355ebb[_0xb8c5('0x21')]=qs[_0xb8c5('0x21')](_0x1e9faa[_0xb8c5('0x33')][_0xb8c5('0x21')]);}_0x355ebb['order']=qs[_0xb8c5('0x37')](_0x1e9faa['query']['sort']);_0x355ebb[_0xb8c5('0x38')]=qs[_0xb8c5('0x39')](_[_0xb8c5('0x3a')](_0x1e9faa[_0xb8c5('0x33')],_0x54534b['filters']),_0x10ceaf);if(_0x1e9faa['query'][_0xb8c5('0x3b')]){_0x355ebb[_0xb8c5('0x38')]=_[_0xb8c5('0x3c')](_0x355ebb[_0xb8c5('0x38')],{'$or':_[_0xb8c5('0x2c')](_0x10ceaf,function(_0x2779de){if(_0x2779de[_0xb8c5('0x2e')]!==_0xb8c5('0x3d')){var _0xda1b87={};_0xda1b87[_0x2779de[_0xb8c5('0x2a')]]={'$like':'%'+_0x1e9faa[_0xb8c5('0x33')][_0xb8c5('0x3b')]+'%'};return _0xda1b87;}})});}_0x355ebb=_['merge']({},_0x355ebb,_0x1e9faa['options']);var _0xafb85c={'where':_0x355ebb[_0xb8c5('0x38')]};return db[_0xb8c5('0x3e')][_0xb8c5('0x24')](_0xafb85c)[_0xb8c5('0x3f')](function(_0x156300){_0x587ed8[_0xb8c5('0x24')]=_0x156300;if(_0x1e9faa[_0xb8c5('0x33')][_0xb8c5('0x40')]){_0x355ebb[_0xb8c5('0x41')]=[{'all':!![]}];}return db['Team'][_0xb8c5('0x42')](_0x355ebb);})['then'](function(_0xf6293c){_0x587ed8[_0xb8c5('0x43')]=_0xf6293c;return _0x587ed8;})[_0xb8c5('0x3f')](respondWithFilteredResult(_0x1d7b64,_0x355ebb))[_0xb8c5('0x44')](handleError(_0x1d7b64,null));};exports[_0xb8c5('0x45')]=function(_0x542c9b,_0x2c6627){var _0x5a5a3c={'raw':![],'where':{'id':_0x542c9b[_0xb8c5('0x46')]['id']}},_0x11d3ce={};_0x11d3ce[_0xb8c5('0x30')]=_['keys'](db[_0xb8c5('0x3e')]['rawAttributes']);_0x11d3ce[_0xb8c5('0x33')]=_[_0xb8c5('0x31')](_0x542c9b[_0xb8c5('0x33')]);_0x11d3ce['filters']=_[_0xb8c5('0x32')](_0x11d3ce[_0xb8c5('0x30')],_0x11d3ce['query']);_0x5a5a3c['attributes']=_[_0xb8c5('0x32')](_0x11d3ce[_0xb8c5('0x30')],qs[_0xb8c5('0x34')](_0x542c9b[_0xb8c5('0x33')][_0xb8c5('0x34')]));_0x5a5a3c[_0xb8c5('0x35')]=_0x5a5a3c[_0xb8c5('0x35')][_0xb8c5('0x47')]?_0x5a5a3c[_0xb8c5('0x35')]:_0x11d3ce[_0xb8c5('0x30')];if(_0x542c9b[_0xb8c5('0x33')][_0xb8c5('0x40')]){_0x5a5a3c[_0xb8c5('0x41')]=[{'all':!![]}];}_0x5a5a3c=_[_0xb8c5('0x3c')]({},_0x5a5a3c,_0x542c9b[_0xb8c5('0x48')]);return db[_0xb8c5('0x3e')][_0xb8c5('0x49')](_0x5a5a3c)['then'](handleEntityNotFound(_0x2c6627,null))['then'](respondWithResult(_0x2c6627,null))[_0xb8c5('0x44')](handleError(_0x2c6627,null));};exports[_0xb8c5('0x4a')]=function(_0x4583ed,_0x86477){return db[_0xb8c5('0x3e')]['create'](_0x4583ed[_0xb8c5('0x4b')],{})[_0xb8c5('0x3f')](function(_0x16d86c){var _0x4d61e7=_0x4583ed[_0xb8c5('0x4c')][_0xb8c5('0x4d')]({'plain':!![]});if(!_0x4d61e7)throw new Error(_0xb8c5('0x4e'));if(_0x4d61e7[_0xb8c5('0x4f')]==='user'){var _0x31e455=_0x16d86c[_0xb8c5('0x4d')]({'plain':!![]});var _0x23d964=_0xb8c5('0x50');return db[_0xb8c5('0x51')][_0xb8c5('0x49')]({'where':{'name':_0x23d964,'userProfileId':_0x4d61e7['userProfileId']},'raw':!![]})[_0xb8c5('0x3f')](function(_0x10e0af){if(_0x10e0af&&_0x10e0af[_0xb8c5('0x52')]===0x0){return db[_0xb8c5('0x53')]['create']({'name':_0x31e455[_0xb8c5('0x2a')],'resourceId':_0x31e455['id'],'type':_0x10e0af[_0xb8c5('0x2a')],'sectionId':_0x10e0af['id']},{})[_0xb8c5('0x3f')](function(){return _0x16d86c;});}else{return _0x16d86c;}})[_0xb8c5('0x44')](function(_0x43fe68){logger[_0xb8c5('0x28')](_0xb8c5('0x54'),_0x43fe68);throw _0x43fe68;});}return _0x16d86c;})[_0xb8c5('0x3f')](respondWithResult(_0x86477,0xc9))['catch'](handleError(_0x86477,null));};exports[_0xb8c5('0x55')]=function(_0x5bd395,_0x48494b){if(_0x5bd395['body']['id']){delete _0x5bd395['body']['id'];}return db[_0xb8c5('0x3e')]['find']({'where':{'id':_0x5bd395[_0xb8c5('0x46')]['id']}})['then'](handleEntityNotFound(_0x48494b,null))[_0xb8c5('0x3f')](saveUpdates(_0x5bd395[_0xb8c5('0x4b')],null))[_0xb8c5('0x3f')](respondWithResult(_0x48494b,null))[_0xb8c5('0x44')](handleError(_0x48494b,null));};exports[_0xb8c5('0x56')]=function(_0x5177b7,_0x588b19){var _0x1a8a06=_0x5177b7[_0xb8c5('0x46')]['id'];var _0x418c9a=[];return db[_0xb8c5('0x57')][_0xb8c5('0x58')](function(_0x21d064){var _0x52dd93=_0xb8c5('0x59')+_0x1a8a06;return db[_0xb8c5('0x57')][_0xb8c5('0x33')](_0x52dd93,{'type':db[_0xb8c5('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x21d064})['then'](function(_0xdc3462){_0x418c9a=_[_0xb8c5('0x2c')](_0xdc3462,function(_0x57a145){return Number(_0x57a145[_0xb8c5('0x5b')]);});})['then'](function(){var _0x330ed7=_0xb8c5('0x5c')+_0x1a8a06;return db['sequelize']['query'](_0x330ed7,{'type':db[_0xb8c5('0x5a')][_0xb8c5('0x5d')][_0xb8c5('0x5e')],'raw':!![],'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(_0x321d58){var _0x3c13aa=_[_0xb8c5('0x2c')](_0x321d58,function(_0x3fe115){return Number(_0x3fe115[_0xb8c5('0x5f')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x418c9a},'VoiceQueueId':{'$in':_0x3c13aa}},'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(){var _0x5dff41='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1a8a06;return db['sequelize'][_0xb8c5('0x33')](_0x5dff41,{'type':db[_0xb8c5('0x5a')][_0xb8c5('0x5d')][_0xb8c5('0x5e')],'raw':!![],'transaction':_0x21d064});})['then'](function(_0x10efc3){var _0x2b3e0a=_['map'](_0x10efc3,function(_0x385a99){return Number(_0x385a99['MailQueueId']);});return db[_0xb8c5('0x60')][_0xb8c5('0x56')]({'where':{'UserId':{'$in':_0x418c9a},'MailQueueId':{'$in':_0x2b3e0a}},'transaction':_0x21d064});})['then'](function(){var _0x54c881=_0xb8c5('0x61')+_0x1a8a06;return db[_0xb8c5('0x57')][_0xb8c5('0x33')](_0x54c881,{'type':db[_0xb8c5('0x5a')][_0xb8c5('0x5d')][_0xb8c5('0x5e')],'raw':!![],'transaction':_0x21d064});})['then'](function(_0x525d32){var _0x245c80=_[_0xb8c5('0x2c')](_0x525d32,function(_0xc19cf1){return Number(_0xc19cf1['SmsQueueId']);});return db[_0xb8c5('0x62')]['destroy']({'where':{'UserId':{'$in':_0x418c9a},'SmsQueueId':{'$in':_0x245c80}},'transaction':_0x21d064});})['then'](function(){var _0x2b135c=_0xb8c5('0x63')+_0x1a8a06;return db[_0xb8c5('0x57')][_0xb8c5('0x33')](_0x2b135c,{'type':db[_0xb8c5('0x5a')][_0xb8c5('0x5d')][_0xb8c5('0x5e')],'raw':!![],'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(_0x26ef03){var _0x2a91cd=_['map'](_0x26ef03,function(_0x390ed3){return Number(_0x390ed3[_0xb8c5('0x64')]);});return db[_0xb8c5('0x65')][_0xb8c5('0x56')]({'where':{'UserId':{'$in':_0x418c9a},'ChatQueueId':{'$in':_0x2a91cd}},'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(){var _0x17860d=_0xb8c5('0x66')+_0x1a8a06;return db['sequelize'][_0xb8c5('0x33')](_0x17860d,{'type':db[_0xb8c5('0x5a')][_0xb8c5('0x5d')][_0xb8c5('0x5e')],'raw':!![],'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(_0x5d2755){var _0x589e58=_[_0xb8c5('0x2c')](_0x5d2755,function(_0x4861e6){return Number(_0x4861e6['FaxQueueId']);});return db[_0xb8c5('0x67')][_0xb8c5('0x56')]({'where':{'UserId':{'$in':_0x418c9a},'FaxQueueId':{'$in':_0x589e58}},'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(){var _0x27c2db=_0xb8c5('0x68')+_0x1a8a06;return db['sequelize'][_0xb8c5('0x33')](_0x27c2db,{'type':db[_0xb8c5('0x5a')]['QueryTypes'][_0xb8c5('0x5e')],'raw':!![],'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(_0x352ea3){var _0x39e079=_[_0xb8c5('0x2c')](_0x352ea3,function(_0x14a319){return Number(_0x14a319[_0xb8c5('0x69')]);});return db[_0xb8c5('0x6a')][_0xb8c5('0x56')]({'where':{'UserId':{'$in':_0x418c9a},'OpenchannelQueueId':{'$in':_0x39e079}},'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(){var _0x3091cd='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1a8a06;return db[_0xb8c5('0x57')][_0xb8c5('0x33')](_0x3091cd,{'type':db['Sequelize'][_0xb8c5('0x5d')][_0xb8c5('0x5e')],'raw':!![],'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(_0x3e5fb5){var _0x3b2686=_[_0xb8c5('0x2c')](_0x3e5fb5,function(_0x3ddafa){return Number(_0x3ddafa['WhatsappQueueId']);});return db[_0xb8c5('0x6b')][_0xb8c5('0x56')]({'where':{'UserId':{'$in':_0x418c9a},'WhatsappQueueId':{'$in':_0x3b2686}},'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(){return db[_0xb8c5('0x6c')][_0xb8c5('0x49')]({'where':{'TeamId':_0x1a8a06}});})[_0xb8c5('0x3f')](function(_0x5034b0){if(_0x5034b0===null){return;}return db[_0xb8c5('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x418c9a},'VoicePrefixId':_0x5034b0[_0xb8c5('0x6e')]},'transaction':_0x21d064});})[_0xb8c5('0x3f')](function(){return db[_0xb8c5('0x3e')][_0xb8c5('0x56')]({'where':{'id':_0x1a8a06},'cascade':!![],'transaction':_0x21d064});})['then'](function(_0x5eb8fc){if(_0x5eb8fc===0x0){_0x588b19[_0xb8c5('0x1e')](0x194);}else{return db[_0xb8c5('0x53')][_0xb8c5('0x56')]({'where':{'type':'Teams','resourceId':_0x1a8a06},'cascade':!![],'transaction':_0x21d064})['then'](function(){_0x588b19[_0xb8c5('0x1f')](0xcc)[_0xb8c5('0x20')]();});}})[_0xb8c5('0x44')](function(_0x341a2b){_0x588b19['status'](0x1f4)['send'](_0x341a2b);});});};exports[_0xb8c5('0x6f')]=function(_0x3b143d,_0x56f9d9,_0xfe8337){return db[_0xb8c5('0x3e')]['findOne']({'where':{'id':_0x3b143d[_0xb8c5('0x46')]['id']}})[_0xb8c5('0x3f')](handleEntityNotFound(_0x56f9d9,null))[_0xb8c5('0x3f')](function(_0x10f437){if(!_0x3b143d[_0xb8c5('0x33')][_0xb8c5('0x70')]||!utils['isValidChannel'](_0x3b143d[_0xb8c5('0x33')]['channel'])){throw new db[(_0xb8c5('0x5a'))][(_0xb8c5('0x71'))](_0xb8c5('0x72'));}var _0x2df99a={};var _0x40927f={};_0x40927f[_0xb8c5('0x30')]=_['keys'](db[_[_0xb8c5('0x73')](_0x3b143d[_0xb8c5('0x33')][_0xb8c5('0x70')][_0xb8c5('0x74')]())+_0xb8c5('0x75')][_0xb8c5('0x76')]);_0x40927f['query']=_['keys'](_0x3b143d['query']);_0x40927f[_0xb8c5('0x39')]=_[_0xb8c5('0x32')](_0x40927f[_0xb8c5('0x30')],_0x40927f['query']);_0x2df99a['attributes']=_['intersection'](_0x40927f[_0xb8c5('0x30')],qs['fields'](_0x3b143d[_0xb8c5('0x33')][_0xb8c5('0x34')]));_0x2df99a['attributes']=_0x2df99a[_0xb8c5('0x35')][_0xb8c5('0x47')]?_0x2df99a[_0xb8c5('0x35')]:_0x40927f['model'];_0x2df99a['limit']=qs[_0xb8c5('0x23')](_0x3b143d[_0xb8c5('0x33')][_0xb8c5('0x23')]);_0x2df99a[_0xb8c5('0x21')]=qs[_0xb8c5('0x21')](_0x3b143d[_0xb8c5('0x33')][_0xb8c5('0x21')]);_0x2df99a[_0xb8c5('0x77')]=qs[_0xb8c5('0x37')](_0x3b143d[_0xb8c5('0x33')][_0xb8c5('0x37')]);_0x2df99a[_0xb8c5('0x38')]=qs[_0xb8c5('0x39')](_[_0xb8c5('0x3a')](_0x3b143d['query'],_0x40927f[_0xb8c5('0x39')]));_0x2df99a=_[_0xb8c5('0x3c')]({},_0x2df99a,_0x3b143d['options']);return _0x10f437['get'+_[_0xb8c5('0x73')](_0x3b143d[_0xb8c5('0x33')]['channel']['toLowerCase']())+_0xb8c5('0x78')](_0x2df99a);})[_0xb8c5('0x3f')](respondWithResult(_0x56f9d9,null))[_0xb8c5('0x44')](handleError(_0x56f9d9,null));};exports['addQueues']=function(_0x127bf5,_0x4b2b16,_0x1021c7){return db[_0xb8c5('0x3e')][_0xb8c5('0x79')]({'where':{'id':_0x127bf5[_0xb8c5('0x46')]['id']}})['then'](function(_0x332271){if(_0x332271){if(!_0x127bf5[_0xb8c5('0x4b')][_0xb8c5('0x70')]||!utils[_0xb8c5('0x7a')](_0x127bf5[_0xb8c5('0x4b')][_0xb8c5('0x70')])){throw new db[(_0xb8c5('0x5a'))]['ValidationError'](_0xb8c5('0x72'));}return _0x332271['add'+_[_0xb8c5('0x73')](_0x127bf5['body'][_0xb8c5('0x70')]['toLowerCase']())+_0xb8c5('0x78')](_0x127bf5[_0xb8c5('0x4b')][_0xb8c5('0x7b')]);}return null;})[_0xb8c5('0x3f')](handleEntityNotFound(_0x4b2b16,null))[_0xb8c5('0x3f')](respondWithStatusCode(_0x4b2b16,null))[_0xb8c5('0x44')](handleError(_0x4b2b16,null));};exports['removeQueues']=function(_0x5de840,_0x462a98,_0x520f7f){return db[_0xb8c5('0x3e')][_0xb8c5('0x79')]({'where':{'id':_0x5de840[_0xb8c5('0x46')]['id']}})[_0xb8c5('0x3f')](function(_0x24d013){if(_0x24d013){if(!_0x5de840[_0xb8c5('0x33')][_0xb8c5('0x70')]||!utils[_0xb8c5('0x7a')](_0x5de840[_0xb8c5('0x33')]['channel'])){throw new db[(_0xb8c5('0x5a'))][(_0xb8c5('0x71'))](_0xb8c5('0x72'));}return _0x24d013[_0xb8c5('0x7c')+_[_0xb8c5('0x73')](_0x5de840[_0xb8c5('0x33')][_0xb8c5('0x70')][_0xb8c5('0x74')]())+'Queues'](_0x5de840[_0xb8c5('0x33')][_0xb8c5('0x7b')]);}return null;})[_0xb8c5('0x3f')](handleEntityNotFound(_0x462a98,null))[_0xb8c5('0x3f')](respondWithStatusCode(_0x462a98,null))[_0xb8c5('0x44')](handleError(_0x462a98,null));};exports[_0xb8c5('0x7d')]=function(_0x5a3cb7,_0x76b47a){var _0x294594=_[_0xb8c5('0x7e')](_0x5a3cb7[_0xb8c5('0x4b')][_0xb8c5('0x7b')])?_0x5a3cb7[_0xb8c5('0x4b')][_0xb8c5('0x7b')]:[_0x5a3cb7[_0xb8c5('0x4b')][_0xb8c5('0x7b')]];var _0x22bee5=_0x5a3cb7[_0xb8c5('0x46')]['id'];return db[_0xb8c5('0x3e')]['find']({'where':{'id':_0x22bee5}})[_0xb8c5('0x3f')](handleEntityNotFound(_0x76b47a,null))[_0xb8c5('0x3f')](function(_0x5506ab){if(_0x5506ab){var _0x179df8=['Voice',_0xb8c5('0x7f'),_0xb8c5('0x80'),'Sms',_0xb8c5('0x81'),_0xb8c5('0x82'),_0xb8c5('0x83')];return db[_0xb8c5('0x57')][_0xb8c5('0x58')](function(_0x199bde){var _0x9adebb=_[_0xb8c5('0x2c')](_0x179df8,function(_0x5eda91){var _0x366bd8={'attributes':['id',_0xb8c5('0x2a')]};if(_0x5eda91===_0xb8c5('0x84')){_0x366bd8['through']={'attributes':[_0xb8c5('0x85')]};}return _0x5506ab[_0xb8c5('0x4d')+_0x5eda91+'Queues'](_0x366bd8)[_0xb8c5('0x3f')](function(_0x26ab13){var _0x47472b=_[_0xb8c5('0x2c')](_0x26ab13,function(_0x163770){var _0x3dbb73=_[_0xb8c5('0x2c')](_0x294594,function(_0x1e7f50){var _0x3ade91={'where':{'UserId':_0x1e7f50,[_0x5eda91+_0xb8c5('0x86')]:_0x163770['id']},'transaction':_0x199bde};if(_0x5eda91===_0xb8c5('0x84')){_0x3ade91['defaults']={'penalty':_0x163770[_0xb8c5('0x87')][_0xb8c5('0x85')]};}return db[_0xb8c5('0x88')+_0x5eda91+_0xb8c5('0x75')][_0xb8c5('0x89')](_0x3ade91)[_0xb8c5('0x3f')](function(){socket[_0xb8c5('0x8a')]('user'+_0x5eda91+_0xb8c5('0x8b'),{'UserId':_0x1e7f50,[_0x5eda91+_0xb8c5('0x86')]:_0x163770['id']});if(_0x5eda91!==_0xb8c5('0x84')){return;}return db[_0xb8c5('0x88')][_0xb8c5('0x42')]({'where':{'id':_0x294594,'online':0x1},'attributes':['id',_0xb8c5('0x2a'),_0xb8c5('0x8c'),_0xb8c5('0x8d'),_0xb8c5('0x8e')],'raw':!![]})[_0xb8c5('0x3f')](function(_0x52066d){var _0x4e3d24=_[_0xb8c5('0x2c')](_0x52066d,function(_0x32926f){return db[_0xb8c5('0x8f')][_0xb8c5('0x90')]({'membername':_0x32926f['name'],'UserId':_0x32926f['id'],'queue_name':_0x163770[_0xb8c5('0x2a')],'VoiceQueueId':_0x163770['id'],'interface':_[_0xb8c5('0x91')](_0x32926f[_0xb8c5('0x8e')])?util[_0xb8c5('0x92')](_0xb8c5('0x93'),_0x32926f['name']):_0x32926f[_0xb8c5('0x8e')],'paused':_0x32926f['voicePause']||![],'penalty':_0x163770[_0xb8c5('0x87')][_0xb8c5('0x85')]},{'transaction':_0x199bde});});return Promise['all'](_0x4e3d24);});});});return Promise['all'](_0x3dbb73);});return Promise['all'](_0x47472b);})[_0xb8c5('0x3f')](function(){return db[_0xb8c5('0x6c')][_0xb8c5('0x79')]({'where':{'teamId':_0x22bee5}})[_0xb8c5('0x3f')](function(_0x27842f){if(_0x27842f){var _0xe4ba0d=_[_0xb8c5('0x2c')](_0x294594,function(_0x32d3ca){db[_0xb8c5('0x6d')]['upsert']({'UserId':_0x32d3ca,'VoicePrefixId':_0x27842f[_0xb8c5('0x6e')]});});return Promise['all'](_0xe4ba0d);}});});});return Promise[_0xb8c5('0x94')](_0x9adebb)['then'](function(){return _0x5506ab['addAgents'](_0x294594,{'transaction':_0x199bde})[_0xb8c5('0x95')](function(_0x16e18a){return _0x16e18a;});});});}})[_0xb8c5('0x3f')](respondWithResult(_0x76b47a,null))[_0xb8c5('0x44')](handleError(_0x76b47a,null));};exports[_0xb8c5('0x96')]=function(_0x1a6d2e,_0x1353a8){var _0x1e8a00=_[_0xb8c5('0x7e')](_0x1a6d2e[_0xb8c5('0x33')]['ids'])?_0x1a6d2e[_0xb8c5('0x33')][_0xb8c5('0x7b')]:[_0x1a6d2e[_0xb8c5('0x33')][_0xb8c5('0x7b')]];var _0x199b06=_0x1a6d2e[_0xb8c5('0x46')]['id'];return db['Team']['find']({'where':{'id':_0x199b06}})[_0xb8c5('0x3f')](handleEntityNotFound(_0x1353a8,null))[_0xb8c5('0x3f')](function(_0x144dac){if(_0x144dac){var _0x3daf77=['Voice',_0xb8c5('0x7f'),_0xb8c5('0x80'),_0xb8c5('0x97'),'Fax',_0xb8c5('0x82'),_0xb8c5('0x83')];return db[_0xb8c5('0x57')][_0xb8c5('0x58')](function(_0x371fae){var _0x4697aa=_[_0xb8c5('0x2c')](_0x3daf77,function(_0x2db274){var _0x1201f0={'attributes':['id',_0xb8c5('0x2a')]};return _0x144dac[_0xb8c5('0x4d')+_0x2db274+'Queues'](_0x1201f0)[_0xb8c5('0x3f')](function(_0x1c5198){var _0x528fd8=_['map'](_0x1c5198,function(_0x1507eb){return _0x1507eb[_0xb8c5('0x96')](_0x1e8a00,{'transaction':_0x371fae})[_0xb8c5('0x3f')](function(){var _0x2f4780=_[_0xb8c5('0x2c')](_0x1e8a00,function(_0x234bdb){socket[_0xb8c5('0x8a')]('user'+_0x2db274+_0xb8c5('0x98'),{'UserId':Number(_0x234bdb),[_0x2db274+_0xb8c5('0x86')]:_0x1507eb['id']});if(_0x2db274!==_0xb8c5('0x84')){return;}return db[_0xb8c5('0x8f')]['destroy']({'where':{'VoiceQueueId':_0x1507eb['id'],'UserId':_0x234bdb},'transaction':_0x371fae});});return Promise[_0xb8c5('0x94')](_0x2f4780);});});return Promise[_0xb8c5('0x94')](_0x528fd8);});});return Promise['all'](_0x4697aa)['then'](function(){return _0x144dac[_0xb8c5('0x96')](_0x1e8a00,{'transaction':_0x371fae});})['then'](function(){return db[_0xb8c5('0x6c')][_0xb8c5('0x79')]({'where':{'teamId':_0x199b06}})['then'](function(_0x3e8013){if(_0x3e8013){var _0x1525b9=_[_0xb8c5('0x2c')](_0x1e8a00,function(_0x4997b6){db['UserVoicePrefix'][_0xb8c5('0x56')]({'where':{'UserId':_0x4997b6,'VoicePrefixId':_0x3e8013[_0xb8c5('0x6e')]}});});return Promise[_0xb8c5('0x94')](_0x1525b9);}});});});}})[_0xb8c5('0x3f')](respondWithStatusCode(_0x1353a8,null))[_0xb8c5('0x44')](handleError(_0x1353a8,null));};exports['getAgents']=function(_0x506ec4,_0x5ba105,_0x42c61d){var _0x374e9c={};var _0x574d76={};var _0x293a7a;var _0x57f856;return db[_0xb8c5('0x3e')][_0xb8c5('0x79')]({'where':{'id':_0x506ec4['params']['id']}})[_0xb8c5('0x3f')](handleEntityNotFound(_0x5ba105,null))['then'](function(_0x1fcbec){if(_0x1fcbec){_0x293a7a=_0x1fcbec;_0x574d76[_0xb8c5('0x30')]=_[_0xb8c5('0x31')](db['User'][_0xb8c5('0x76')]);_0x574d76[_0xb8c5('0x33')]=_[_0xb8c5('0x31')](_0x506ec4[_0xb8c5('0x33')]);_0x574d76[_0xb8c5('0x39')]=_[_0xb8c5('0x32')](_0x574d76['model'],_0x574d76[_0xb8c5('0x33')]);_0x374e9c[_0xb8c5('0x35')]=_['intersection'](_0x574d76['model'],qs['fields'](_0x506ec4[_0xb8c5('0x33')][_0xb8c5('0x34')]));_0x374e9c[_0xb8c5('0x35')]=_0x374e9c[_0xb8c5('0x35')][_0xb8c5('0x47')]?_0x374e9c[_0xb8c5('0x35')]:_0x574d76[_0xb8c5('0x30')];_0x374e9c[_0xb8c5('0x77')]=qs[_0xb8c5('0x37')](_0x506ec4[_0xb8c5('0x33')]['sort']);_0x374e9c[_0xb8c5('0x38')]=qs[_0xb8c5('0x39')](_[_0xb8c5('0x3a')](_0x506ec4[_0xb8c5('0x33')],_0x574d76[_0xb8c5('0x39')]));if(_0x506ec4[_0xb8c5('0x33')][_0xb8c5('0x3b')]){_0x374e9c[_0xb8c5('0x38')]=_[_0xb8c5('0x3c')](_0x374e9c[_0xb8c5('0x38')],{'$or':_[_0xb8c5('0x2c')](_0x374e9c[_0xb8c5('0x35')],function(_0x360aba){var _0x39ba18={};_0x39ba18[_0x360aba]={'$like':'%'+_0x506ec4['query'][_0xb8c5('0x3b')]+'%'};return _0x39ba18;})});}_0x374e9c=_[_0xb8c5('0x3c')]({},_0x374e9c,_0x506ec4[_0xb8c5('0x48')]);return _0x293a7a[_0xb8c5('0x99')](_0x374e9c);}})['then'](function(_0xcaa2fb){if(_0xcaa2fb){_0x57f856=_0xcaa2fb[_0xb8c5('0x47')];if(!_0x506ec4[_0xb8c5('0x33')][_0xb8c5('0x9a')](_0xb8c5('0x36'))){_0x374e9c[_0xb8c5('0x23')]=qs['limit'](_0x506ec4['query'][_0xb8c5('0x23')]);_0x374e9c[_0xb8c5('0x21')]=qs[_0xb8c5('0x21')](_0x506ec4[_0xb8c5('0x33')]['offset']);}return _0x293a7a[_0xb8c5('0x99')](_0x374e9c);}})[_0xb8c5('0x3f')](function(_0x3640f1){if(_0x3640f1){return _0x3640f1?{'count':_0x57f856,'rows':_0x3640f1}:null;}})[_0xb8c5('0x3f')](respondWithResult(_0x5ba105,null))[_0xb8c5('0x44')](handleError(_0x5ba105,null));}; \ No newline at end of file +var _0xe1c7=['SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','sendStatus','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','addQueues','Queues','removeQueues','remove','ids','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','interface','format','SIP/%s','all','addAgents','spread','removeAgents','isArray','getAgents','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','error','name','send','index','Team','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','find','create','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','VoiceQueueId','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','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue'];(function(_0x3223c5,_0xdc8557){var _0x4d062b=function(_0xcdda77){while(--_0xcdda77){_0x3223c5['push'](_0x3223c5['shift']());}};_0x4d062b(++_0xdc8557);}(_0xe1c7,0x16e));var _0x7e1c=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0xe1c7[_0x1f6f84];return _0x177f40;};'use strict';var emlformat=require(_0x7e1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e1c('0x1'));var jsonpatch=require(_0x7e1c('0x2'));var rp=require(_0x7e1c('0x3'));var moment=require(_0x7e1c('0x4'));var BPromise=require(_0x7e1c('0x5'));var Mustache=require(_0x7e1c('0x6'));var util=require('util');var path=require(_0x7e1c('0x7'));var sox=require(_0x7e1c('0x8'));var csv=require(_0x7e1c('0x9'));var ejs=require(_0x7e1c('0xa'));var fs=require('fs');var fs_extra=require(_0x7e1c('0xb'));var _=require('lodash');var squel=require(_0x7e1c('0xc'));var crypto=require(_0x7e1c('0xd'));var jsforce=require(_0x7e1c('0xe'));var deskjs=require(_0x7e1c('0xf'));var toCsv=require(_0x7e1c('0x9'));var querystring=require(_0x7e1c('0x10'));var Papa=require(_0x7e1c('0x11'));var Redis=require('ioredis');var authService=require(_0x7e1c('0x12'));var qs=require(_0x7e1c('0x13'));var as=require(_0x7e1c('0x14'));var hardwareService=require(_0x7e1c('0x15'));var logger=require(_0x7e1c('0x16'))(_0x7e1c('0x17'));var utils=require(_0x7e1c('0x18'));var config=require(_0x7e1c('0x19'));var licenseUtil=require(_0x7e1c('0x1a'));var db=require(_0x7e1c('0x1b'))['db'];config[_0x7e1c('0x1c')]=_[_0x7e1c('0x1d')](config[_0x7e1c('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e1c('0x1e'))(new Redis(config[_0x7e1c('0x1c')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x4fd033,_0x1f3cd8){_0x1f3cd8=_0x1f3cd8||0xcc;return function(_0x4b4eae){if(_0x4b4eae){return _0x4fd033['sendStatus'](_0x1f3cd8);}return _0x4fd033[_0x7e1c('0x1f')](_0x1f3cd8)[_0x7e1c('0x20')]();};}function respondWithResult(_0x305c89,_0xee8a3d){_0xee8a3d=_0xee8a3d||0xc8;return function(_0x3fd022){if(_0x3fd022){return _0x305c89['status'](_0xee8a3d)[_0x7e1c('0x21')](_0x3fd022);}};}function respondWithFilteredResult(_0x46d241,_0x4ea4f2){return function(_0xaccbfa){if(_0xaccbfa){var _0x36b64d=typeof _0x4ea4f2['offset']==='undefined'&&typeof _0x4ea4f2[_0x7e1c('0x22')]===_0x7e1c('0x23');var _0x510054=_0xaccbfa[_0x7e1c('0x24')];var _0x3fe459=_0x36b64d?0x0:_0x4ea4f2[_0x7e1c('0x25')];var _0x5f1ab8=_0x36b64d?_0xaccbfa[_0x7e1c('0x24')]:_0x4ea4f2[_0x7e1c('0x25')]+_0x4ea4f2[_0x7e1c('0x22')];var _0x50b183;if(_0x5f1ab8>=_0x510054){_0x5f1ab8=_0x510054;_0x50b183=0xc8;}else{_0x50b183=0xce;}_0x46d241[_0x7e1c('0x1f')](_0x50b183);return _0x46d241[_0x7e1c('0x26')](_0x7e1c('0x27'),_0x3fe459+'-'+_0x5f1ab8+'/'+_0x510054)[_0x7e1c('0x21')](_0xaccbfa);}return null;};}function patchUpdates(_0x3f7ed1){return function(_0x18f545){try{jsonpatch['apply'](_0x18f545,_0x3f7ed1,!![]);}catch(_0x324576){return BPromise[_0x7e1c('0x28')](_0x324576);}return _0x18f545['save']();};}function saveUpdates(_0x235cdd,_0x498aa7){return function(_0x173280){if(_0x173280){return _0x173280[_0x7e1c('0x29')](_0x235cdd)['then'](function(_0x40351b){return _0x40351b;});}return null;};}function handleEntityNotFound(_0x22000f,_0x7882a5){return function(_0x8c8c56){if(!_0x8c8c56){_0x22000f['sendStatus'](0x194);}return _0x8c8c56;};}function handleError(_0x52444b,_0x375b5e){_0x375b5e=_0x375b5e||0x1f4;return function(_0x1457ef){logger[_0x7e1c('0x2a')](_0x1457ef['stack']);if(_0x1457ef[_0x7e1c('0x2b')]){delete _0x1457ef['name'];}_0x52444b[_0x7e1c('0x1f')](_0x375b5e)[_0x7e1c('0x2c')](_0x1457ef);};}exports[_0x7e1c('0x2d')]=function(_0x3a1ec6,_0x4bcc16){var _0x527413={},_0x1cc9ab={},_0xa6c5c2={'count':0x0,'rows':[]};var _0x780eeb=_['map'](db[_0x7e1c('0x2e')][_0x7e1c('0x2f')],function(_0x141f10){return{'name':_0x141f10['fieldName'],'type':_0x141f10[_0x7e1c('0x30')][_0x7e1c('0x31')]};});_0x1cc9ab['model']=_[_0x7e1c('0x32')](_0x780eeb,_0x7e1c('0x2b'));_0x1cc9ab['query']=_[_0x7e1c('0x33')](_0x3a1ec6[_0x7e1c('0x34')]);_0x1cc9ab[_0x7e1c('0x35')]=_[_0x7e1c('0x36')](_0x1cc9ab[_0x7e1c('0x37')],_0x1cc9ab[_0x7e1c('0x34')]);_0x527413[_0x7e1c('0x38')]=_['intersection'](_0x1cc9ab[_0x7e1c('0x37')],qs[_0x7e1c('0x39')](_0x3a1ec6[_0x7e1c('0x34')][_0x7e1c('0x39')]));_0x527413[_0x7e1c('0x38')]=_0x527413[_0x7e1c('0x38')][_0x7e1c('0x3a')]?_0x527413[_0x7e1c('0x38')]:_0x1cc9ab[_0x7e1c('0x37')];if(!_0x3a1ec6[_0x7e1c('0x34')][_0x7e1c('0x3b')]('nolimit')){_0x527413['limit']=qs[_0x7e1c('0x22')](_0x3a1ec6['query'][_0x7e1c('0x22')]);_0x527413[_0x7e1c('0x25')]=qs[_0x7e1c('0x25')](_0x3a1ec6[_0x7e1c('0x34')][_0x7e1c('0x25')]);}_0x527413[_0x7e1c('0x3c')]=qs['sort'](_0x3a1ec6[_0x7e1c('0x34')][_0x7e1c('0x3d')]);_0x527413['where']=qs[_0x7e1c('0x35')](_[_0x7e1c('0x3e')](_0x3a1ec6[_0x7e1c('0x34')],_0x1cc9ab['filters']),_0x780eeb);if(_0x3a1ec6[_0x7e1c('0x34')][_0x7e1c('0x3f')]){_0x527413[_0x7e1c('0x40')]=_['merge'](_0x527413[_0x7e1c('0x40')],{'$or':_[_0x7e1c('0x32')](_0x780eeb,function(_0x2d2c4d){if(_0x2d2c4d['type']!=='VIRTUAL'){var _0x4f80e7={};_0x4f80e7[_0x2d2c4d[_0x7e1c('0x2b')]]={'$like':'%'+_0x3a1ec6[_0x7e1c('0x34')][_0x7e1c('0x3f')]+'%'};return _0x4f80e7;}})});}_0x527413=_[_0x7e1c('0x41')]({},_0x527413,_0x3a1ec6[_0x7e1c('0x42')]);var _0x630d25={'where':_0x527413['where']};return db[_0x7e1c('0x2e')][_0x7e1c('0x24')](_0x630d25)[_0x7e1c('0x43')](function(_0x27237b){_0xa6c5c2[_0x7e1c('0x24')]=_0x27237b;if(_0x3a1ec6[_0x7e1c('0x34')][_0x7e1c('0x44')]){_0x527413[_0x7e1c('0x45')]=[{'all':!![]}];}return db[_0x7e1c('0x2e')][_0x7e1c('0x46')](_0x527413);})[_0x7e1c('0x43')](function(_0x3eb9e2){_0xa6c5c2[_0x7e1c('0x47')]=_0x3eb9e2;return _0xa6c5c2;})[_0x7e1c('0x43')](respondWithFilteredResult(_0x4bcc16,_0x527413))[_0x7e1c('0x48')](handleError(_0x4bcc16,null));};exports[_0x7e1c('0x49')]=function(_0x2f216e,_0x43ab59){var _0x3c7984={'raw':![],'where':{'id':_0x2f216e['params']['id']}},_0x1e4282={};_0x1e4282[_0x7e1c('0x37')]=_['keys'](db[_0x7e1c('0x2e')][_0x7e1c('0x2f')]);_0x1e4282[_0x7e1c('0x34')]=_['keys'](_0x2f216e[_0x7e1c('0x34')]);_0x1e4282['filters']=_[_0x7e1c('0x36')](_0x1e4282[_0x7e1c('0x37')],_0x1e4282[_0x7e1c('0x34')]);_0x3c7984[_0x7e1c('0x38')]=_[_0x7e1c('0x36')](_0x1e4282[_0x7e1c('0x37')],qs[_0x7e1c('0x39')](_0x2f216e[_0x7e1c('0x34')]['fields']));_0x3c7984[_0x7e1c('0x38')]=_0x3c7984['attributes']['length']?_0x3c7984[_0x7e1c('0x38')]:_0x1e4282['model'];if(_0x2f216e[_0x7e1c('0x34')][_0x7e1c('0x44')]){_0x3c7984[_0x7e1c('0x45')]=[{'all':!![]}];}_0x3c7984=_[_0x7e1c('0x41')]({},_0x3c7984,_0x2f216e[_0x7e1c('0x42')]);return db[_0x7e1c('0x2e')][_0x7e1c('0x4a')](_0x3c7984)[_0x7e1c('0x43')](handleEntityNotFound(_0x43ab59,null))[_0x7e1c('0x43')](respondWithResult(_0x43ab59,null))[_0x7e1c('0x48')](handleError(_0x43ab59,null));};exports[_0x7e1c('0x4b')]=function(_0x5e4234,_0x137fee){return db['Team']['create'](_0x5e4234['body'],{})[_0x7e1c('0x43')](function(_0x51564a){var _0x1474d0=_0x5e4234[_0x7e1c('0x4c')][_0x7e1c('0x4d')]({'plain':!![]});if(!_0x1474d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1474d0[_0x7e1c('0x4e')]===_0x7e1c('0x4c')){var _0x56b9f0=_0x51564a[_0x7e1c('0x4d')]({'plain':!![]});var _0x2d8180=_0x7e1c('0x4f');return db[_0x7e1c('0x50')]['find']({'where':{'name':_0x2d8180,'userProfileId':_0x1474d0[_0x7e1c('0x51')]},'raw':!![]})[_0x7e1c('0x43')](function(_0x462bb8){if(_0x462bb8&&_0x462bb8[_0x7e1c('0x52')]===0x0){return db[_0x7e1c('0x53')][_0x7e1c('0x4b')]({'name':_0x56b9f0['name'],'resourceId':_0x56b9f0['id'],'type':_0x462bb8[_0x7e1c('0x2b')],'sectionId':_0x462bb8['id']},{})[_0x7e1c('0x43')](function(){return _0x51564a;});}else{return _0x51564a;}})[_0x7e1c('0x48')](function(_0x368dc9){logger[_0x7e1c('0x2a')](_0x7e1c('0x54'),_0x368dc9);throw _0x368dc9;});}return _0x51564a;})['then'](respondWithResult(_0x137fee,0xc9))[_0x7e1c('0x48')](handleError(_0x137fee,null));};exports[_0x7e1c('0x29')]=function(_0x9824d2,_0x562595){if(_0x9824d2[_0x7e1c('0x55')]['id']){delete _0x9824d2[_0x7e1c('0x55')]['id'];}return db['Team'][_0x7e1c('0x4a')]({'where':{'id':_0x9824d2['params']['id']}})[_0x7e1c('0x43')](handleEntityNotFound(_0x562595,null))[_0x7e1c('0x43')](saveUpdates(_0x9824d2['body'],null))['then'](respondWithResult(_0x562595,null))[_0x7e1c('0x48')](handleError(_0x562595,null));};exports[_0x7e1c('0x56')]=function(_0x28c442,_0x581a1a){var _0xa73d45=_0x28c442[_0x7e1c('0x57')]['id'];var _0x3f7cb5=[];return db[_0x7e1c('0x58')][_0x7e1c('0x59')](function(_0x432c7b){var _0x3e459e=_0x7e1c('0x5a')+_0xa73d45;return db[_0x7e1c('0x58')][_0x7e1c('0x34')](_0x3e459e,{'type':db['Sequelize'][_0x7e1c('0x5b')]['SELECT'],'raw':!![],'transaction':_0x432c7b})[_0x7e1c('0x43')](function(_0x55c262){_0x3f7cb5=_[_0x7e1c('0x32')](_0x55c262,function(_0x4c5bab){return Number(_0x4c5bab[_0x7e1c('0x5c')]);});})[_0x7e1c('0x43')](function(){var _0x397b29=_0x7e1c('0x5d')+_0xa73d45;return db[_0x7e1c('0x58')][_0x7e1c('0x34')](_0x397b29,{'type':db[_0x7e1c('0x5e')]['QueryTypes'][_0x7e1c('0x5f')],'raw':!![],'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(_0x488cc){var _0x55906e=_['map'](_0x488cc,function(_0x55a902){return Number(_0x55a902[_0x7e1c('0x60')]);});return db[_0x7e1c('0x61')]['destroy']({'where':{'UserId':{'$in':_0x3f7cb5},'VoiceQueueId':{'$in':_0x55906e}},'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(){var _0x18559e=_0x7e1c('0x62')+_0xa73d45;return db['sequelize'][_0x7e1c('0x34')](_0x18559e,{'type':db['Sequelize'][_0x7e1c('0x5b')][_0x7e1c('0x5f')],'raw':!![],'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(_0x58e241){var _0x296825=_['map'](_0x58e241,function(_0x10d511){return Number(_0x10d511['MailQueueId']);});return db[_0x7e1c('0x63')][_0x7e1c('0x56')]({'where':{'UserId':{'$in':_0x3f7cb5},'MailQueueId':{'$in':_0x296825}},'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(){var _0x4ea10e=_0x7e1c('0x64')+_0xa73d45;return db[_0x7e1c('0x58')][_0x7e1c('0x34')](_0x4ea10e,{'type':db[_0x7e1c('0x5e')][_0x7e1c('0x5b')]['SELECT'],'raw':!![],'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(_0x4cfde3){var _0x1fa4a8=_[_0x7e1c('0x32')](_0x4cfde3,function(_0xe6b6e){return Number(_0xe6b6e[_0x7e1c('0x65')]);});return db['UserSmsQueue'][_0x7e1c('0x56')]({'where':{'UserId':{'$in':_0x3f7cb5},'SmsQueueId':{'$in':_0x1fa4a8}},'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(){var _0x9776e7='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0xa73d45;return db[_0x7e1c('0x58')]['query'](_0x9776e7,{'type':db['Sequelize'][_0x7e1c('0x5b')]['SELECT'],'raw':!![],'transaction':_0x432c7b});})['then'](function(_0x3d23ab){var _0x1e3526=_[_0x7e1c('0x32')](_0x3d23ab,function(_0x10ef1c){return Number(_0x10ef1c['ChatQueueId']);});return db[_0x7e1c('0x66')][_0x7e1c('0x56')]({'where':{'UserId':{'$in':_0x3f7cb5},'ChatQueueId':{'$in':_0x1e3526}},'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(){var _0x4356e4=_0x7e1c('0x67')+_0xa73d45;return db[_0x7e1c('0x58')]['query'](_0x4356e4,{'type':db[_0x7e1c('0x5e')][_0x7e1c('0x5b')]['SELECT'],'raw':!![],'transaction':_0x432c7b});})['then'](function(_0xda63b3){var _0x5e7db4=_['map'](_0xda63b3,function(_0x5d4bc1){return Number(_0x5d4bc1[_0x7e1c('0x68')]);});return db['UserFaxQueue'][_0x7e1c('0x56')]({'where':{'UserId':{'$in':_0x3f7cb5},'FaxQueueId':{'$in':_0x5e7db4}},'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(){var _0x480399=_0x7e1c('0x69')+_0xa73d45;return db[_0x7e1c('0x58')][_0x7e1c('0x34')](_0x480399,{'type':db[_0x7e1c('0x5e')][_0x7e1c('0x5b')]['SELECT'],'raw':!![],'transaction':_0x432c7b});})['then'](function(_0x6067d8){var _0x302c67=_[_0x7e1c('0x32')](_0x6067d8,function(_0x22862a){return Number(_0x22862a[_0x7e1c('0x6a')]);});return db[_0x7e1c('0x6b')][_0x7e1c('0x56')]({'where':{'UserId':{'$in':_0x3f7cb5},'OpenchannelQueueId':{'$in':_0x302c67}},'transaction':_0x432c7b});})['then'](function(){var _0x3f0335=_0x7e1c('0x6c')+_0xa73d45;return db[_0x7e1c('0x58')][_0x7e1c('0x34')](_0x3f0335,{'type':db[_0x7e1c('0x5e')][_0x7e1c('0x5b')]['SELECT'],'raw':!![],'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(_0x5a89b2){var _0x1cfb40=_[_0x7e1c('0x32')](_0x5a89b2,function(_0x3ddadd){return Number(_0x3ddadd[_0x7e1c('0x6d')]);});return db[_0x7e1c('0x6e')][_0x7e1c('0x56')]({'where':{'UserId':{'$in':_0x3f7cb5},'WhatsappQueueId':{'$in':_0x1cfb40}},'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(){return db[_0x7e1c('0x6f')]['find']({'where':{'TeamId':_0xa73d45}});})[_0x7e1c('0x43')](function(_0x38a48e){if(_0x38a48e===null){return;}return db[_0x7e1c('0x70')][_0x7e1c('0x56')]({'where':{'UserId':{'$in':_0x3f7cb5},'VoicePrefixId':_0x38a48e[_0x7e1c('0x71')]},'transaction':_0x432c7b});})[_0x7e1c('0x43')](function(){return db[_0x7e1c('0x2e')][_0x7e1c('0x56')]({'where':{'id':_0xa73d45},'cascade':!![],'transaction':_0x432c7b});})['then'](function(_0x3031bd){if(_0x3031bd===0x0){_0x581a1a[_0x7e1c('0x72')](0x194);}else{return db[_0x7e1c('0x53')][_0x7e1c('0x56')]({'where':{'type':_0x7e1c('0x4f'),'resourceId':_0xa73d45},'cascade':!![],'transaction':_0x432c7b})[_0x7e1c('0x43')](function(){_0x581a1a[_0x7e1c('0x1f')](0xcc)[_0x7e1c('0x20')]();});}})['catch'](function(_0x57c36b){_0x581a1a[_0x7e1c('0x1f')](0x1f4)[_0x7e1c('0x2c')](_0x57c36b);});});};exports[_0x7e1c('0x73')]=function(_0xf1873,_0x3dd3f6,_0x3c6b72){return db['Team'][_0x7e1c('0x74')]({'where':{'id':_0xf1873[_0x7e1c('0x57')]['id']}})[_0x7e1c('0x43')](handleEntityNotFound(_0x3dd3f6,null))['then'](function(_0x53f53e){if(!_0xf1873[_0x7e1c('0x34')]['channel']||!utils[_0x7e1c('0x75')](_0xf1873[_0x7e1c('0x34')][_0x7e1c('0x76')])){throw new db[(_0x7e1c('0x5e'))][(_0x7e1c('0x77'))](_0x7e1c('0x78'));}var _0x3c3026={};var _0x2e2644={};_0x2e2644[_0x7e1c('0x37')]=_['keys'](db[_[_0x7e1c('0x79')](_0xf1873[_0x7e1c('0x34')][_0x7e1c('0x76')]['toLowerCase']())+'Queue'][_0x7e1c('0x2f')]);_0x2e2644[_0x7e1c('0x34')]=_[_0x7e1c('0x33')](_0xf1873[_0x7e1c('0x34')]);_0x2e2644[_0x7e1c('0x35')]=_['intersection'](_0x2e2644['model'],_0x2e2644[_0x7e1c('0x34')]);_0x3c3026[_0x7e1c('0x38')]=_[_0x7e1c('0x36')](_0x2e2644['model'],qs[_0x7e1c('0x39')](_0xf1873[_0x7e1c('0x34')][_0x7e1c('0x39')]));_0x3c3026[_0x7e1c('0x38')]=_0x3c3026[_0x7e1c('0x38')][_0x7e1c('0x3a')]?_0x3c3026[_0x7e1c('0x38')]:_0x2e2644['model'];_0x3c3026[_0x7e1c('0x22')]=qs[_0x7e1c('0x22')](_0xf1873['query']['limit']);_0x3c3026[_0x7e1c('0x25')]=qs[_0x7e1c('0x25')](_0xf1873[_0x7e1c('0x34')][_0x7e1c('0x25')]);_0x3c3026[_0x7e1c('0x3c')]=qs[_0x7e1c('0x3d')](_0xf1873[_0x7e1c('0x34')][_0x7e1c('0x3d')]);_0x3c3026[_0x7e1c('0x40')]=qs['filters'](_[_0x7e1c('0x3e')](_0xf1873[_0x7e1c('0x34')],_0x2e2644['filters']));_0x3c3026=_[_0x7e1c('0x41')]({},_0x3c3026,_0xf1873[_0x7e1c('0x42')]);return _0x53f53e['get'+_[_0x7e1c('0x79')](_0xf1873['query'][_0x7e1c('0x76')][_0x7e1c('0x7a')]())+'Queues'](_0x3c3026);})[_0x7e1c('0x43')](respondWithResult(_0x3dd3f6,null))['catch'](handleError(_0x3dd3f6,null));};exports[_0x7e1c('0x7b')]=function(_0x1e6307,_0x3df652,_0x262cf0){return db[_0x7e1c('0x2e')][_0x7e1c('0x74')]({'where':{'id':_0x1e6307[_0x7e1c('0x57')]['id']}})['then'](function(_0x4b4057){if(_0x4b4057){if(!_0x1e6307[_0x7e1c('0x55')]['channel']||!utils[_0x7e1c('0x75')](_0x1e6307[_0x7e1c('0x55')][_0x7e1c('0x76')])){throw new db[(_0x7e1c('0x5e'))][(_0x7e1c('0x77'))](_0x7e1c('0x78'));}return _0x4b4057['add'+_[_0x7e1c('0x79')](_0x1e6307['body'][_0x7e1c('0x76')][_0x7e1c('0x7a')]())+_0x7e1c('0x7c')](_0x1e6307[_0x7e1c('0x55')]['ids']);}return null;})[_0x7e1c('0x43')](handleEntityNotFound(_0x3df652,null))['then'](respondWithStatusCode(_0x3df652,null))[_0x7e1c('0x48')](handleError(_0x3df652,null));};exports[_0x7e1c('0x7d')]=function(_0x3c2040,_0x12f357,_0x1782fa){return db['Team'][_0x7e1c('0x74')]({'where':{'id':_0x3c2040[_0x7e1c('0x57')]['id']}})['then'](function(_0x17fbb1){if(_0x17fbb1){if(!_0x3c2040[_0x7e1c('0x34')]['channel']||!utils['isValidChannel'](_0x3c2040['query'][_0x7e1c('0x76')])){throw new db['Sequelize'][(_0x7e1c('0x77'))]('Unknown\x20channel');}return _0x17fbb1[_0x7e1c('0x7e')+_[_0x7e1c('0x79')](_0x3c2040[_0x7e1c('0x34')]['channel'][_0x7e1c('0x7a')]())+_0x7e1c('0x7c')](_0x3c2040[_0x7e1c('0x34')]['ids']);}return null;})[_0x7e1c('0x43')](handleEntityNotFound(_0x12f357,null))[_0x7e1c('0x43')](respondWithStatusCode(_0x12f357,null))[_0x7e1c('0x48')](handleError(_0x12f357,null));};exports['addAgents']=function(_0x195872,_0x28e150){var _0x38f97a=_['isArray'](_0x195872['body'][_0x7e1c('0x7f')])?_0x195872[_0x7e1c('0x55')][_0x7e1c('0x7f')]:[_0x195872[_0x7e1c('0x55')]['ids']];var _0x45cb31=_0x195872['params']['id'];return db[_0x7e1c('0x2e')]['find']({'where':{'id':_0x45cb31}})['then'](handleEntityNotFound(_0x28e150,null))[_0x7e1c('0x43')](function(_0x2a4e93){if(_0x2a4e93){var _0x55bbac=[_0x7e1c('0x80'),_0x7e1c('0x81'),_0x7e1c('0x82'),_0x7e1c('0x83'),_0x7e1c('0x84'),_0x7e1c('0x85'),_0x7e1c('0x86')];return db['sequelize'][_0x7e1c('0x59')](function(_0x30c1fd){var _0x2a3019=_[_0x7e1c('0x32')](_0x55bbac,function(_0x335769){var _0x4efcca={'attributes':['id',_0x7e1c('0x2b')]};if(_0x335769===_0x7e1c('0x80')){_0x4efcca[_0x7e1c('0x87')]={'attributes':[_0x7e1c('0x88')]};}return _0x2a4e93[_0x7e1c('0x4d')+_0x335769+_0x7e1c('0x7c')](_0x4efcca)[_0x7e1c('0x43')](function(_0x4ad917){var _0x2e78e0=_['map'](_0x4ad917,function(_0x1f0a99){var _0x35e95c=_[_0x7e1c('0x32')](_0x38f97a,function(_0x3eb1c3){var _0x6ee5c4={'where':{'UserId':_0x3eb1c3,[_0x335769+_0x7e1c('0x89')]:_0x1f0a99['id']},'transaction':_0x30c1fd};if(_0x335769===_0x7e1c('0x80')){_0x6ee5c4['defaults']={'penalty':_0x1f0a99[_0x7e1c('0x8a')][_0x7e1c('0x88')]};}return db[_0x7e1c('0x8b')+_0x335769+_0x7e1c('0x8c')][_0x7e1c('0x8d')](_0x6ee5c4)[_0x7e1c('0x43')](function(){socket[_0x7e1c('0x8e')](_0x7e1c('0x4c')+_0x335769+_0x7e1c('0x8f'),{'UserId':_0x3eb1c3,[_0x335769+_0x7e1c('0x89')]:_0x1f0a99['id']});if(_0x335769!==_0x7e1c('0x80')){return;}return db[_0x7e1c('0x8b')]['findAll']({'where':{'id':_0x38f97a,'online':0x1},'attributes':['id',_0x7e1c('0x2b'),_0x7e1c('0x90'),_0x7e1c('0x91'),'interface'],'raw':!![]})[_0x7e1c('0x43')](function(_0x2bfa6c){var _0x54024c=_[_0x7e1c('0x32')](_0x2bfa6c,function(_0x2f9737){return db[_0x7e1c('0x92')][_0x7e1c('0x93')]({'membername':_0x2f9737[_0x7e1c('0x2b')],'UserId':_0x2f9737['id'],'queue_name':_0x1f0a99[_0x7e1c('0x2b')],'VoiceQueueId':_0x1f0a99['id'],'interface':_['isNil'](_0x2f9737[_0x7e1c('0x94')])?util[_0x7e1c('0x95')](_0x7e1c('0x96'),_0x2f9737[_0x7e1c('0x2b')]):_0x2f9737[_0x7e1c('0x94')],'paused':_0x2f9737[_0x7e1c('0x91')]||![],'penalty':_0x1f0a99['TeamVoiceQueue'][_0x7e1c('0x88')]},{'transaction':_0x30c1fd});});return Promise[_0x7e1c('0x97')](_0x54024c);});});});return Promise[_0x7e1c('0x97')](_0x35e95c);});return Promise[_0x7e1c('0x97')](_0x2e78e0);})[_0x7e1c('0x43')](function(){return db[_0x7e1c('0x6f')][_0x7e1c('0x74')]({'where':{'teamId':_0x45cb31}})['then'](function(_0x431938){if(_0x431938){var _0x4596d9=_['map'](_0x38f97a,function(_0x45365c){db[_0x7e1c('0x70')][_0x7e1c('0x93')]({'UserId':_0x45365c,'VoicePrefixId':_0x431938['VoicePrefixId']});});return Promise[_0x7e1c('0x97')](_0x4596d9);}});});});return Promise[_0x7e1c('0x97')](_0x2a3019)[_0x7e1c('0x43')](function(){return _0x2a4e93[_0x7e1c('0x98')](_0x38f97a,{'transaction':_0x30c1fd})[_0x7e1c('0x99')](function(_0x975335){return _0x975335;});});});}})[_0x7e1c('0x43')](respondWithResult(_0x28e150,null))[_0x7e1c('0x48')](handleError(_0x28e150,null));};exports[_0x7e1c('0x9a')]=function(_0x11fa02,_0x17f5e4){var _0x2a87eb=_[_0x7e1c('0x9b')](_0x11fa02[_0x7e1c('0x34')][_0x7e1c('0x7f')])?_0x11fa02['query'][_0x7e1c('0x7f')]:[_0x11fa02[_0x7e1c('0x34')][_0x7e1c('0x7f')]];var _0x77d0c9=_0x11fa02[_0x7e1c('0x57')]['id'];return db[_0x7e1c('0x2e')][_0x7e1c('0x4a')]({'where':{'id':_0x77d0c9}})[_0x7e1c('0x43')](handleEntityNotFound(_0x17f5e4,null))[_0x7e1c('0x43')](function(_0x5753f6){if(_0x5753f6){var _0x5339ff=[_0x7e1c('0x80'),_0x7e1c('0x81'),_0x7e1c('0x82'),_0x7e1c('0x83'),_0x7e1c('0x84'),_0x7e1c('0x85'),_0x7e1c('0x86')];return db[_0x7e1c('0x58')][_0x7e1c('0x59')](function(_0x3a4806){var _0x68eb22=_[_0x7e1c('0x32')](_0x5339ff,function(_0x5516b6){var _0x582b92={'attributes':['id',_0x7e1c('0x2b')]};return _0x5753f6['get'+_0x5516b6+_0x7e1c('0x7c')](_0x582b92)['then'](function(_0x1626c8){var _0x14e166=_[_0x7e1c('0x32')](_0x1626c8,function(_0x596f55){return _0x596f55[_0x7e1c('0x9a')](_0x2a87eb,{'transaction':_0x3a4806})['then'](function(){var _0x3fd95e=_['map'](_0x2a87eb,function(_0x22c8cb){socket[_0x7e1c('0x8e')](_0x7e1c('0x4c')+_0x5516b6+'Queue:remove',{'UserId':Number(_0x22c8cb),[_0x5516b6+'QueueId']:_0x596f55['id']});if(_0x5516b6!==_0x7e1c('0x80')){return;}return db[_0x7e1c('0x92')][_0x7e1c('0x56')]({'where':{'VoiceQueueId':_0x596f55['id'],'UserId':_0x22c8cb},'transaction':_0x3a4806});});return Promise[_0x7e1c('0x97')](_0x3fd95e);});});return Promise['all'](_0x14e166);});});return Promise[_0x7e1c('0x97')](_0x68eb22)['then'](function(){return _0x5753f6['removeAgents'](_0x2a87eb,{'transaction':_0x3a4806});})[_0x7e1c('0x43')](function(){return db[_0x7e1c('0x6f')]['findOne']({'where':{'teamId':_0x77d0c9}})[_0x7e1c('0x43')](function(_0x4efec5){if(_0x4efec5){var _0x681250=_[_0x7e1c('0x32')](_0x2a87eb,function(_0x3ad0c0){db['UserVoicePrefix'][_0x7e1c('0x56')]({'where':{'UserId':_0x3ad0c0,'VoicePrefixId':_0x4efec5[_0x7e1c('0x71')]}});});return Promise['all'](_0x681250);}});});});}})[_0x7e1c('0x43')](respondWithStatusCode(_0x17f5e4,null))['catch'](handleError(_0x17f5e4,null));};exports[_0x7e1c('0x9c')]=function(_0x3b72f7,_0x19aa1b,_0x8264dd){var _0x2ad3a8={};var _0x33cfd1={};var _0x1e321e;var _0x144917;return db['Team']['findOne']({'where':{'id':_0x3b72f7[_0x7e1c('0x57')]['id']}})[_0x7e1c('0x43')](handleEntityNotFound(_0x19aa1b,null))[_0x7e1c('0x43')](function(_0xfc38f){if(_0xfc38f){_0x1e321e=_0xfc38f;_0x33cfd1[_0x7e1c('0x37')]=_[_0x7e1c('0x33')](db[_0x7e1c('0x8b')][_0x7e1c('0x2f')]);_0x33cfd1[_0x7e1c('0x34')]=_['keys'](_0x3b72f7[_0x7e1c('0x34')]);_0x33cfd1[_0x7e1c('0x35')]=_[_0x7e1c('0x36')](_0x33cfd1[_0x7e1c('0x37')],_0x33cfd1['query']);_0x2ad3a8[_0x7e1c('0x38')]=_[_0x7e1c('0x36')](_0x33cfd1[_0x7e1c('0x37')],qs[_0x7e1c('0x39')](_0x3b72f7[_0x7e1c('0x34')][_0x7e1c('0x39')]));_0x2ad3a8[_0x7e1c('0x38')]=_0x2ad3a8['attributes'][_0x7e1c('0x3a')]?_0x2ad3a8['attributes']:_0x33cfd1[_0x7e1c('0x37')];_0x2ad3a8[_0x7e1c('0x3c')]=qs['sort'](_0x3b72f7['query'][_0x7e1c('0x3d')]);_0x2ad3a8[_0x7e1c('0x40')]=qs['filters'](_[_0x7e1c('0x3e')](_0x3b72f7[_0x7e1c('0x34')],_0x33cfd1['filters']));if(_0x3b72f7[_0x7e1c('0x34')]['filter']){_0x2ad3a8[_0x7e1c('0x40')]=_[_0x7e1c('0x41')](_0x2ad3a8[_0x7e1c('0x40')],{'$or':_[_0x7e1c('0x32')](_0x2ad3a8[_0x7e1c('0x38')],function(_0x1789fe){var _0x535c91={};_0x535c91[_0x1789fe]={'$like':'%'+_0x3b72f7[_0x7e1c('0x34')][_0x7e1c('0x3f')]+'%'};return _0x535c91;})});}_0x2ad3a8=_[_0x7e1c('0x41')]({},_0x2ad3a8,_0x3b72f7[_0x7e1c('0x42')]);return _0x1e321e[_0x7e1c('0x9c')](_0x2ad3a8);}})[_0x7e1c('0x43')](function(_0x13295d){if(_0x13295d){_0x144917=_0x13295d[_0x7e1c('0x3a')];if(!_0x3b72f7[_0x7e1c('0x34')][_0x7e1c('0x3b')](_0x7e1c('0x9d'))){_0x2ad3a8[_0x7e1c('0x22')]=qs['limit'](_0x3b72f7[_0x7e1c('0x34')][_0x7e1c('0x22')]);_0x2ad3a8['offset']=qs[_0x7e1c('0x25')](_0x3b72f7['query'][_0x7e1c('0x25')]);}return _0x1e321e[_0x7e1c('0x9c')](_0x2ad3a8);}})[_0x7e1c('0x43')](function(_0x19f68c){if(_0x19f68c){return _0x19f68c?{'count':_0x144917,'rows':_0x19f68c}:null;}})[_0x7e1c('0x43')](respondWithResult(_0x19aa1b,null))[_0x7e1c('0x48')](handleError(_0x19aa1b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8ee21f1..a666a4a 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 _0xa78d=['../../mysqldb','Team','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x48ce3b,_0x154893){var _0x1627df=function(_0x5ea188){while(--_0x5ea188){_0x48ce3b['push'](_0x48ce3b['shift']());}};_0x1627df(++_0x154893);}(_0xa78d,0x160));var _0xda78=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xa78d[_0x369151];return _0x4292d5;};'use strict';var EventEmitter=require('events');var Team=require(_0xda78('0x0'))['db'][_0xda78('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xda78('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda78('0x3'),'afterDestroy':_0xda78('0x4')};function emitEvent(_0x525883){return function(_0x3c4322,_0x2da9f3,_0xae6941){TeamEvents[_0xda78('0x5')](_0x525883+':'+_0x3c4322['id'],_0x3c4322);TeamEvents[_0xda78('0x5')](_0x525883,_0x3c4322);_0xae6941(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xda78('0x6')](e,emitEvent(event));}}module[_0xda78('0x7')]=TeamEvents; \ No newline at end of file +var _0x51c7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','save','update','remove'];(function(_0x25f797,_0x449916){var _0x157fdd=function(_0x329fe1){while(--_0x329fe1){_0x25f797['push'](_0x25f797['shift']());}};_0x157fdd(++_0x449916);}(_0x51c7,0x126));var _0x751c=function(_0x41eccd,_0x2052f4){_0x41eccd=_0x41eccd-0x0;var _0x4ebf84=_0x51c7[_0x41eccd];return _0x4ebf84;};'use strict';var EventEmitter=require(_0x751c('0x0'));var Team=require(_0x751c('0x1'))['db'][_0x751c('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x751c('0x3'),'afterUpdate':_0x751c('0x4'),'afterDestroy':_0x751c('0x5')};function emitEvent(_0x5cf273){return function(_0x253fe1,_0x3dfa35,_0x2f2f76){TeamEvents[_0x751c('0x6')](_0x5cf273+':'+_0x253fe1['id'],_0x253fe1);TeamEvents[_0x751c('0x6')](_0x5cf273,_0x253fe1);_0x2f2f76(null);};}for(var e in events){if(events[_0x751c('0x7')](e)){var event=events[e];Team[_0x751c('0x8')](e,emitEvent(event));}}module[_0x751c('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8895ea3..f7a0f97 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 _0x41d3=['teams','util','api','request-promise','path','./team.attributes','exports','define'];(function(_0x37aff1,_0x5ece65){var _0xd0d054=function(_0x1d5a28){while(--_0x1d5a28){_0x37aff1['push'](_0x37aff1['shift']());}};_0xd0d054(++_0x5ece65);}(_0x41d3,0x1b9));var _0x341d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x41d3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x341d('0x0'));var logger=require('../../config/logger')(_0x341d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x341d('0x2'));var fs=require('fs');var path=require(_0x341d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x341d('0x4'));module[_0x341d('0x5')]=function(_0x2b3840,_0x33d514){return _0x2b3840[_0x341d('0x6')]('Team',attributes,{'tableName':_0x341d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc9f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams'];(function(_0xbf64af,_0x581dbf){var _0x3a41bd=function(_0x2a5351){while(--_0x2a5351){_0xbf64af['push'](_0xbf64af['shift']());}};_0x3a41bd(++_0x581dbf);}(_0xcc9f,0x186));var _0xfcc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfcc9('0x0'));var util=require(_0xfcc9('0x1'));var logger=require(_0xfcc9('0x2'))('api');var moment=require(_0xfcc9('0x3'));var BPromise=require(_0xfcc9('0x4'));var rp=require(_0xfcc9('0x5'));var fs=require('fs');var path=require(_0xfcc9('0x6'));var rimraf=require(_0xfcc9('0x7'));var config=require(_0xfcc9('0x8'));var attributes=require('./team.attributes');module[_0xfcc9('0x9')]=function(_0x35f298,_0x2a83e7){return _0x35f298[_0xfcc9('0xa')](_0xfcc9('0xb'),attributes,{'tableName':_0xfcc9('0xc'),'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 032d830..be79990 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 _0x97d6=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1367a1,_0x2bfb4f){var _0x2b77e9=function(_0x4b7d68){while(--_0x4b7d68){_0x1367a1['push'](_0x1367a1['shift']());}};_0x2b77e9(++_0x2bfb4f);}(_0x97d6,0x11b));var _0x697d=function(_0x1fd3e7,_0x133500){_0x1fd3e7=_0x1fd3e7-0x0;var _0x2a17ad=_0x97d6[_0x1fd3e7];return _0x2a17ad;};'use strict';var _=require(_0x697d('0x0'));var util=require('util');var moment=require(_0x697d('0x1'));var BPromise=require(_0x697d('0x2'));var rs=require(_0x697d('0x3'));var fs=require('fs');var Redis=require(_0x697d('0x4'));var db=require(_0x697d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x697d('0x6'))(_0x697d('0x7'));var config=require(_0x697d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x697d('0x9')]['http']({'port':0x232a});config[_0x697d('0xa')]=_[_0x697d('0xb')](config[_0x697d('0xa')],{'host':_0x697d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x697d('0xa')]));require('./team.socket')[_0x697d('0xd')](socket);function respondWithRpcPromise(_0x34ae3f,_0xeb0d5e,_0x11ff01){return new BPromise(function(_0x440040,_0x58cbe9){return client[_0x697d('0xe')](_0x34ae3f,_0x11ff01)['then'](function(_0x510e91){logger[_0x697d('0xf')](_0x697d('0x10'),_0xeb0d5e,_0x697d('0x11'));logger[_0x697d('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0xeb0d5e,_0x697d('0x11'),JSON[_0x697d('0x13')](_0x510e91));if(_0x510e91[_0x697d('0x14')]){if(_0x510e91[_0x697d('0x14')][_0x697d('0x15')]===0x1f4){logger[_0x697d('0x14')]('Team,\x20%s,\x20%s',_0xeb0d5e,_0x510e91['error'][_0x697d('0x16')]);return _0x58cbe9(_0x510e91[_0x697d('0x14')][_0x697d('0x16')]);}logger[_0x697d('0x14')]('Team,\x20%s,\x20%s',_0xeb0d5e,_0x510e91[_0x697d('0x14')][_0x697d('0x16')]);return _0x440040(_0x510e91[_0x697d('0x14')]['message']);}else{logger[_0x697d('0xf')](_0x697d('0x10'),_0xeb0d5e,_0x697d('0x11'));_0x440040(_0x510e91[_0x697d('0x17')][_0x697d('0x16')]);}})['catch'](function(_0x1905d0){logger[_0x697d('0x14')]('Team,\x20%s,\x20%s',_0xeb0d5e,_0x1905d0);_0x58cbe9(_0x1905d0);});});} \ No newline at end of file +var _0xdd41=['client','http','defaults','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x27c4da,_0x524970){var _0xdcb26f=function(_0x38699d){while(--_0x38699d){_0x27c4da['push'](_0x27c4da['shift']());}};_0xdcb26f(++_0x524970);}(_0xdd41,0x1f2));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var moment=require(_0x1dd4('0x2'));var BPromise=require(_0x1dd4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dd4('0x4'));var db=require(_0x1dd4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1dd4('0x6'));var config=require(_0x1dd4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1dd4('0x8')][_0x1dd4('0x9')]({'port':0x232a});config['redis']=_[_0x1dd4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1dd4('0xb'))['register'](socket);function respondWithRpcPromise(_0x3ddfee,_0x1cc223,_0x2f8aa0){return new BPromise(function(_0xa64be4,_0x5c6b6d){return client[_0x1dd4('0xc')](_0x3ddfee,_0x2f8aa0)['then'](function(_0x47684f){logger[_0x1dd4('0xd')](_0x1dd4('0xe'),_0x1cc223,_0x1dd4('0xf'));logger[_0x1dd4('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0x1cc223,_0x1dd4('0xf'),JSON[_0x1dd4('0x11')](_0x47684f));if(_0x47684f[_0x1dd4('0x12')]){if(_0x47684f[_0x1dd4('0x12')][_0x1dd4('0x13')]===0x1f4){logger[_0x1dd4('0x12')](_0x1dd4('0xe'),_0x1cc223,_0x47684f['error'][_0x1dd4('0x14')]);return _0x5c6b6d(_0x47684f[_0x1dd4('0x12')][_0x1dd4('0x14')]);}logger[_0x1dd4('0x12')](_0x1dd4('0xe'),_0x1cc223,_0x47684f[_0x1dd4('0x12')][_0x1dd4('0x14')]);return _0xa64be4(_0x47684f[_0x1dd4('0x12')][_0x1dd4('0x14')]);}else{logger[_0x1dd4('0xd')]('Team,\x20%s,\x20%s',_0x1cc223,'request\x20sent');_0xa64be4(_0x47684f[_0x1dd4('0x15')][_0x1dd4('0x14')]);}})[_0x1dd4('0x16')](function(_0x32e8c0){logger[_0x1dd4('0x12')]('Team,\x20%s,\x20%s',_0x1cc223,_0x32e8c0);_0x5c6b6d(_0x32e8c0);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8a05328..a7bc5ce 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 _0x49c9=['./team.events','save','update','removeListener'];(function(_0x37ecc7,_0x1aea2f){var _0x624472=function(_0x20f5bb){while(--_0x20f5bb){_0x37ecc7['push'](_0x37ecc7['shift']());}};_0x624472(++_0x1aea2f);}(_0x49c9,0x164));var _0x949c=function(_0x1d1fbc,_0x43ee32){_0x1d1fbc=_0x1d1fbc-0x0;var _0x5cb846=_0x49c9[_0x1d1fbc];return _0x5cb846;};'use strict';var TeamEvents=require(_0x949c('0x0'));var events=[_0x949c('0x1'),'remove',_0x949c('0x2')];function createListener(_0x1bff65,_0x9686f7){return function(_0x541f51){_0x9686f7['emit'](_0x1bff65,_0x541f51);};}function removeListener(_0xe6586d,_0x58dff5){return function(){TeamEvents[_0x949c('0x3')](_0xe6586d,_0x58dff5);};}exports['register']=function(_0x477a38){for(var _0x4a5e52=0x0,_0x13d36b=events['length'];_0x4a5e52<_0x13d36b;_0x4a5e52++){var _0x1d37a1=events[_0x4a5e52];var _0x21af0d=createListener('team:'+_0x1d37a1,_0x477a38);TeamEvents['on'](_0x1d37a1,_0x21af0d);}}; \ No newline at end of file +var _0x4574=['update','register','length','./team.events','remove'];(function(_0x2d9e67,_0x3fc67b){var _0x465915=function(_0x5b0f38){while(--_0x5b0f38){_0x2d9e67['push'](_0x2d9e67['shift']());}};_0x465915(++_0x3fc67b);}(_0x4574,0xbc));var _0x4457=function(_0x3cd447,_0x1ddfda){_0x3cd447=_0x3cd447-0x0;var _0x3d0b31=_0x4574[_0x3cd447];return _0x3d0b31;};'use strict';var TeamEvents=require(_0x4457('0x0'));var events=['save',_0x4457('0x1'),_0x4457('0x2')];function createListener(_0x4d61c2,_0x277662){return function(_0x34ef2f){_0x277662['emit'](_0x4d61c2,_0x34ef2f);};}function removeListener(_0x104a6c,_0x35320c){return function(){TeamEvents['removeListener'](_0x104a6c,_0x35320c);};}exports[_0x4457('0x3')]=function(_0x25bd0b){for(var _0x110a03=0x0,_0x2b1246=events[_0x4457('0x4')];_0x110a03<_0x2b1246;_0x110a03++){var _0x52bcf7=events[_0x110a03];var _0x4f16b9=createListener('team:'+_0x52bcf7,_0x25bd0b);TeamEvents['on'](_0x52bcf7,_0x4f16b9);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 38452de..e11a104 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 _0x8d53=['sequelize','exports','INTEGER'];(function(_0x2c2996,_0x41e06d){var _0x3e93e9=function(_0x4561ae){while(--_0x4561ae){_0x2c2996['push'](_0x2c2996['shift']());}};_0x3e93e9(++_0x41e06d);}(_0x8d53,0x1c2));var _0x38d5=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0x8d53[_0x572637];return _0xb6748;};'use strict';var Sequelize=require(_0x38d5('0x0'));module[_0x38d5('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x38d5('0x2')]}}; \ No newline at end of file +var _0x2141=['INTEGER','sequelize','exports'];(function(_0x514b14,_0x2b20ee){var _0x47aa2b=function(_0x1f3b43){while(--_0x1f3b43){_0x514b14['push'](_0x514b14['shift']());}};_0x47aa2b(++_0x2b20ee);}(_0x2141,0x1ba));var _0x1214=function(_0x9e7cd9,_0x1942a2){_0x9e7cd9=_0x9e7cd9-0x0;var _0xa3dc2b=_0x2141[_0x9e7cd9];return _0xa3dc2b;};'use strict';var Sequelize=require(_0x1214('0x0'));module[_0x1214('0x1')]={'TeamId':{'type':Sequelize[_0x1214('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1214('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e154866..d7c9730 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 _0x3419=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x11f3b3,_0x97a7b6){var _0x180b20=function(_0x524319){while(--_0x524319){_0x11f3b3['push'](_0x11f3b3['shift']());}};_0x180b20(++_0x97a7b6);}(_0x3419,0xb3));var _0x9341=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x3419[_0x274dd7];return _0x148829;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var logger=require(_0x9341('0x2'))(_0x9341('0x3'));var moment=require(_0x9341('0x4'));var BPromise=require('bluebird');var rp=require(_0x9341('0x5'));var fs=require('fs');var path=require(_0x9341('0x6'));var rimraf=require(_0x9341('0x7'));var config=require(_0x9341('0x8'));var attributes=require(_0x9341('0x9'));module['exports']=function(_0xa36232,_0x204ee){return _0xa36232['define'](_0x9341('0xa'),attributes,{'tableName':_0x9341('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cae=['../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','lodash','util','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cae,0x16b));var _0xe2ca=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x2cae[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xe2ca('0x0'));var util=require(_0xe2ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe2ca('0x2'));var BPromise=require(_0xe2ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ca('0x4'));var rimraf=require(_0xe2ca('0x5'));var config=require(_0xe2ca('0x6'));var attributes=require(_0xe2ca('0x7'));module['exports']=function(_0x2b4c70,_0x3cabde){return _0x2b4c70['define'](_0xe2ca('0x8'),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 f347b73..7faa824 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x18849b,_0x530b07){var _0x23b2df=function(_0x582c14){while(--_0x582c14){_0x18849b['push'](_0x18849b['shift']());}};_0x23b2df(++_0x530b07);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'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(_0x50b57f,_0x2f01e9){var _0x4386fd=function(_0x9aa517){while(--_0x9aa517){_0x50b57f['push'](_0x50b57f['shift']());}};_0x4386fd(++_0x2f01e9);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2b932bc..790ded7 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 _0x0c83=['INTEGER','sequelize','exports'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0x0c83,0x1d2));var _0x30c8=function(_0x2db532,_0x471525){_0x2db532=_0x2db532-0x0;var _0x25042d=_0x0c83[_0x2db532];return _0x25042d;};'use strict';var Sequelize=require(_0x30c8('0x0'));module[_0x30c8('0x1')]={'penalty':{'type':Sequelize[_0x30c8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf368=['INTEGER','sequelize'];(function(_0x2d5887,_0xace828){var _0x257084=function(_0x457e3a){while(--_0x457e3a){_0x2d5887['push'](_0x2d5887['shift']());}};_0x257084(++_0xace828);}(_0xf368,0x175));var _0x8f36=function(_0x33645f,_0x1f72e0){_0x33645f=_0x33645f-0x0;var _0x360eea=_0xf368[_0x33645f];return _0x360eea;};'use strict';var Sequelize=require(_0x8f36('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8f36('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 267a409..0d69570 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 _0x2a3a=['exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x593f0e,_0x3555e7){var _0x116f30=function(_0x4df802){while(--_0x4df802){_0x593f0e['push'](_0x593f0e['shift']());}};_0x116f30(++_0x3555e7);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x55487d,_0x2fdac0){_0x55487d=_0x55487d-0x0;var _0x3d7e6a=_0x2a3a[_0x55487d];return _0x3d7e6a;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c70=['../../config/environment','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a077b,_0x5c893d){var _0xc9d88=function(_0x4e1175){while(--_0x4e1175){_0x4a077b['push'](_0x4a077b['shift']());}};_0xc9d88(++_0x5c893d);}(_0x3c70,0x10c));var _0x03c7=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x3c70[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var logger=require(_0x03c7('0x2'))('api');var moment=require(_0x03c7('0x3'));var BPromise=require(_0x03c7('0x4'));var rp=require(_0x03c7('0x5'));var fs=require('fs');var path=require(_0x03c7('0x6'));var rimraf=require(_0x03c7('0x7'));var config=require(_0x03c7('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x03c7('0x9')]=function(_0x4f774e,_0x5b6c32){return _0x4f774e[_0x03c7('0xa')](_0x03c7('0xb'),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 a1d8b7d..ba83a73 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 _0xe27e=['rpc','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x42a587,_0x445b94){var _0x535d40=function(_0x47a3ca){while(--_0x47a3ca){_0x42a587['push'](_0x42a587['shift']());}};_0x535d40(++_0x445b94);}(_0xe27e,0xa8));var _0xee27=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xe27e[_0x59eefb];return _0x1a49e8;};'use strict';var _=require(_0xee27('0x0'));var util=require('util');var moment=require(_0xee27('0x1'));var BPromise=require(_0xee27('0x2'));var rs=require(_0xee27('0x3'));var fs=require('fs');var Redis=require(_0xee27('0x4'));var db=require(_0xee27('0x5'))['db'];var utils=require(_0xee27('0x6'));var logger=require(_0xee27('0x7'))(_0xee27('0x8'));var config=require('../../config/environment');var jayson=require(_0xee27('0x9'));var client=jayson[_0xee27('0xa')][_0xee27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x199a2e,_0x4d16d6,_0x4df68b){return new BPromise(function(_0x5b97db,_0x472274){return client['request'](_0x199a2e,_0x4df68b)['then'](function(_0x4f0174){logger[_0xee27('0xc')](_0xee27('0xd'),_0x4d16d6,_0xee27('0xe'));logger[_0xee27('0xf')](_0xee27('0x10'),_0x4d16d6,_0xee27('0xe'),JSON['stringify'](_0x4f0174));if(_0x4f0174[_0xee27('0x11')]){if(_0x4f0174['error'][_0xee27('0x12')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4d16d6,_0x4f0174[_0xee27('0x11')][_0xee27('0x13')]);return _0x472274(_0x4f0174[_0xee27('0x11')][_0xee27('0x13')]);}logger[_0xee27('0x11')](_0xee27('0xd'),_0x4d16d6,_0x4f0174[_0xee27('0x11')]['message']);return _0x5b97db(_0x4f0174[_0xee27('0x11')][_0xee27('0x13')]);}else{logger[_0xee27('0xc')](_0xee27('0xd'),_0x4d16d6,_0xee27('0xe'));_0x5b97db(_0x4f0174[_0xee27('0x14')][_0xee27('0x13')]);}})[_0xee27('0x15')](function(_0x218725){logger[_0xee27('0x11')](_0xee27('0xd'),_0x4d16d6,_0x218725);_0x472274(_0x218725);});});} \ No newline at end of file +var _0x27e6=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x27e6,0x121));var _0x627e=function(_0x5144cd,_0x37ee07){_0x5144cd=_0x5144cd-0x0;var _0xe5bd11=_0x27e6[_0x5144cd];return _0xe5bd11;};'use strict';var _=require(_0x627e('0x0'));var util=require(_0x627e('0x1'));var moment=require(_0x627e('0x2'));var BPromise=require(_0x627e('0x3'));var rs=require(_0x627e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x627e('0x5'))['db'];var utils=require(_0x627e('0x6'));var logger=require(_0x627e('0x7'))(_0x627e('0x8'));var config=require('../../config/environment');var jayson=require(_0x627e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x169230,_0x33dc07,_0x20412c){return new BPromise(function(_0x1733e5,_0x34c2f4){return client['request'](_0x169230,_0x20412c)[_0x627e('0xa')](function(_0x4440a7){logger[_0x627e('0xb')](_0x627e('0xc'),_0x33dc07,'request\x20sent');logger[_0x627e('0xd')](_0x627e('0xe'),_0x33dc07,_0x627e('0xf'),JSON[_0x627e('0x10')](_0x4440a7));if(_0x4440a7[_0x627e('0x11')]){if(_0x4440a7[_0x627e('0x11')][_0x627e('0x12')]===0x1f4){logger[_0x627e('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33dc07,_0x4440a7[_0x627e('0x11')][_0x627e('0x13')]);return _0x34c2f4(_0x4440a7[_0x627e('0x11')]['message']);}logger[_0x627e('0x11')](_0x627e('0xc'),_0x33dc07,_0x4440a7[_0x627e('0x11')]['message']);return _0x1733e5(_0x4440a7[_0x627e('0x11')]['message']);}else{logger[_0x627e('0xb')](_0x627e('0xc'),_0x33dc07,'request\x20sent');_0x1733e5(_0x4440a7[_0x627e('0x14')]['message']);}})[_0x627e('0x15')](function(_0x3f8715){logger['error'](_0x627e('0xc'),_0x33dc07,_0x3f8715);_0x34c2f4(_0x3f8715);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index fb32c67..e36b2d2 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 _0x3f48=['../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','put','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2a0109,_0x2a2ffe){var _0x1be180=function(_0x25b1e0){while(--_0x25b1e0){_0x2a0109['push'](_0x2a0109['shift']());}};_0x1be180(++_0x2a2ffe);}(_0x3f48,0x17c));var _0x83f4=function(_0x46ef13,_0x2f3c6a){_0x46ef13=_0x46ef13-0x0;var _0x2a827b=_0x3f48[_0x46ef13];return _0x2a827b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83f4('0x0'));var timeout=require(_0x83f4('0x1'));var express=require(_0x83f4('0x2'));var router=express[_0x83f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x83f4('0x4'));var interaction=require(_0x83f4('0x5'));var config=require('../../config/environment');var controller=require(_0x83f4('0x6'));router['get']('/',auth[_0x83f4('0x7')](),controller[_0x83f4('0x8')]);router[_0x83f4('0x9')](_0x83f4('0xa'),auth[_0x83f4('0x7')](),controller[_0x83f4('0xb')]);router[_0x83f4('0xc')]('/',auth[_0x83f4('0x7')](),controller['create']);router[_0x83f4('0xd')](_0x83f4('0xa'),auth[_0x83f4('0x7')](),controller['update']);router['delete']('/:id',auth[_0x83f4('0x7')](),controller[_0x83f4('0xe')]);module[_0x83f4('0xf')]=router; \ No newline at end of file +var _0xb5f3=['create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./template.controller','get','isAuthenticated','/:id','show'];(function(_0x103d2d,_0x1e8172){var _0x4f3fc0=function(_0x5563be){while(--_0x5563be){_0x103d2d['push'](_0x103d2d['shift']());}};_0x4f3fc0(++_0x1e8172);}(_0xb5f3,0x137));var _0x3b5f=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xb5f3[_0x4099ee];return _0x1b7bfc;};'use strict';var multer=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var path=require(_0x3b5f('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b5f('0x3'));var router=express[_0x3b5f('0x4')]();var fs_extra=require(_0x3b5f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b5f('0x6'));var controller=require(_0x3b5f('0x7'));router[_0x3b5f('0x8')]('/',auth[_0x3b5f('0x9')](),controller['index']);router[_0x3b5f('0x8')](_0x3b5f('0xa'),auth['isAuthenticated'](),controller[_0x3b5f('0xb')]);router['post']('/',auth[_0x3b5f('0x9')](),controller[_0x3b5f('0xc')]);router[_0x3b5f('0xd')](_0x3b5f('0xa'),auth['isAuthenticated'](),controller[_0x3b5f('0xe')]);router[_0x3b5f('0xf')](_0x3b5f('0xa'),auth[_0x3b5f('0x9')](),controller[_0x3b5f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 378a253..513a685 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 _0x99c0=['sequelize','STRING'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x99c0,0x10a));var _0x099c=function(_0xe63ca1,_0x38dbee){_0xe63ca1=_0xe63ca1-0x0;var _0x3a2983=_0x99c0[_0xe63ca1];return _0x3a2983;};'use strict';var Sequelize=require(_0x099c('0x0'));module['exports']={'name':{'type':Sequelize[_0x099c('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x96bd=['exports','STRING'];(function(_0x35b2a5,_0x2a2ea1){var _0xdb3fb8=function(_0x3ca842){while(--_0x3ca842){_0x35b2a5['push'](_0x35b2a5['shift']());}};_0xdb3fb8(++_0x2a2ea1);}(_0x96bd,0x18a));var _0xd96b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x96bd[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0xd96b('0x0')]={'name':{'type':Sequelize[_0xd96b('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 065ba7d..9ce426c 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 _0x6f69=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','get','Templates','stack','name','send','index','Template','fieldName','type','key','model','keys','intersection','query','attributes','fields','nolimit','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x58d94a,_0x4150a8){var _0x5d8bd6=function(_0x400e1c){while(--_0x400e1c){_0x58d94a['push'](_0x58d94a['shift']());}};_0x5d8bd6(++_0x4150a8);}(_0x6f69,0xaa));var _0x96f6=function(_0x2aa28f,_0x4482a6){_0x2aa28f=_0x2aa28f-0x0;var _0x490860=_0x6f69[_0x2aa28f];return _0x490860;};'use strict';var emlformat=require(_0x96f6('0x0'));var rimraf=require(_0x96f6('0x1'));var zipdir=require(_0x96f6('0x2'));var jsonpatch=require(_0x96f6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96f6('0x4'));var Mustache=require(_0x96f6('0x5'));var util=require(_0x96f6('0x6'));var path=require(_0x96f6('0x7'));var sox=require(_0x96f6('0x8'));var csv=require(_0x96f6('0x9'));var ejs=require(_0x96f6('0xa'));var fs=require('fs');var fs_extra=require(_0x96f6('0xb'));var _=require('lodash');var squel=require(_0x96f6('0xc'));var crypto=require('crypto');var jsforce=require(_0x96f6('0xd'));var deskjs=require(_0x96f6('0xe'));var toCsv=require(_0x96f6('0x9'));var querystring=require(_0x96f6('0xf'));var Papa=require(_0x96f6('0x10'));var Redis=require(_0x96f6('0x11'));var authService=require(_0x96f6('0x12'));var qs=require(_0x96f6('0x13'));var as=require(_0x96f6('0x14'));var hardwareService=require(_0x96f6('0x15'));var logger=require(_0x96f6('0x16'))(_0x96f6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96f6('0x18'));var db=require(_0x96f6('0x19'))['db'];function respondWithStatusCode(_0x46eb98,_0x1d7b1f){_0x1d7b1f=_0x1d7b1f||0xcc;return function(_0x2f4093){if(_0x2f4093){return _0x46eb98[_0x96f6('0x1a')](_0x1d7b1f);}return _0x46eb98[_0x96f6('0x1b')](_0x1d7b1f)[_0x96f6('0x1c')]();};}function respondWithResult(_0x18eca5,_0xfd96d){_0xfd96d=_0xfd96d||0xc8;return function(_0x43c22e){if(_0x43c22e){return _0x18eca5[_0x96f6('0x1b')](_0xfd96d)[_0x96f6('0x1d')](_0x43c22e);}};}function respondWithFilteredResult(_0x38bcb2,_0xcad201){return function(_0x5cb011){if(_0x5cb011){var _0x546469=typeof _0xcad201[_0x96f6('0x1e')]==='undefined'&&typeof _0xcad201['limit']===_0x96f6('0x1f');var _0x1ad2ed=_0x5cb011[_0x96f6('0x20')];var _0x43c454=_0x546469?0x0:_0xcad201[_0x96f6('0x1e')];var _0x401c78=_0x546469?_0x5cb011[_0x96f6('0x20')]:_0xcad201['offset']+_0xcad201['limit'];var _0x5c6f95;if(_0x401c78>=_0x1ad2ed){_0x401c78=_0x1ad2ed;_0x5c6f95=0xc8;}else{_0x5c6f95=0xce;}_0x38bcb2[_0x96f6('0x1b')](_0x5c6f95);return _0x38bcb2[_0x96f6('0x21')](_0x96f6('0x22'),_0x43c454+'-'+_0x401c78+'/'+_0x1ad2ed)[_0x96f6('0x1d')](_0x5cb011);}return null;};}function patchUpdates(_0x44f831){return function(_0x2e9f3b){try{jsonpatch['apply'](_0x2e9f3b,_0x44f831,!![]);}catch(_0x2dd64a){return BPromise[_0x96f6('0x23')](_0x2dd64a);}return _0x2e9f3b[_0x96f6('0x24')]();};}function saveUpdates(_0x1a0dcf,_0x47f703){return function(_0x209cfa){if(_0x209cfa){return _0x209cfa['update'](_0x1a0dcf)[_0x96f6('0x25')](function(_0x5673c4){return _0x5673c4;});}return null;};}function removeEntity(_0x23b941,_0x340670){return function(_0x29ce20){if(_0x29ce20){return _0x29ce20[_0x96f6('0x26')]()[_0x96f6('0x25')](function(){var _0x422bb2=_0x29ce20[_0x96f6('0x27')]({'plain':!![]});var _0x1a46ff=_0x96f6('0x28');return db['UserProfileResource'][_0x96f6('0x26')]({'where':{'type':_0x1a46ff,'resourceId':_0x422bb2['id']}})[_0x96f6('0x25')](function(){return _0x29ce20;});})[_0x96f6('0x25')](function(){_0x23b941[_0x96f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x162307,_0x269711){return function(_0x1a0243){if(!_0x1a0243){_0x162307[_0x96f6('0x1a')](0x194);}return _0x1a0243;};}function handleError(_0x1daa9f,_0x4b6a45){_0x4b6a45=_0x4b6a45||0x1f4;return function(_0x27a6ea){logger['error'](_0x27a6ea[_0x96f6('0x29')]);if(_0x27a6ea[_0x96f6('0x2a')]){delete _0x27a6ea[_0x96f6('0x2a')];}_0x1daa9f[_0x96f6('0x1b')](_0x4b6a45)[_0x96f6('0x2b')](_0x27a6ea);};}exports[_0x96f6('0x2c')]=function(_0x2037ce,_0x220cb4){var _0x26c3a2={},_0x57e81f={},_0x2ea234={'count':0x0,'rows':[]};var _0x29fbb9=_['map'](db[_0x96f6('0x2d')]['rawAttributes'],function(_0x58d406){return{'name':_0x58d406[_0x96f6('0x2e')],'type':_0x58d406[_0x96f6('0x2f')][_0x96f6('0x30')]};});_0x57e81f[_0x96f6('0x31')]=_['map'](_0x29fbb9,_0x96f6('0x2a'));_0x57e81f['query']=_[_0x96f6('0x32')](_0x2037ce['query']);_0x57e81f['filters']=_[_0x96f6('0x33')](_0x57e81f['model'],_0x57e81f[_0x96f6('0x34')]);_0x26c3a2[_0x96f6('0x35')]=_['intersection'](_0x57e81f['model'],qs[_0x96f6('0x36')](_0x2037ce[_0x96f6('0x34')][_0x96f6('0x36')]));_0x26c3a2[_0x96f6('0x35')]=_0x26c3a2[_0x96f6('0x35')]['length']?_0x26c3a2['attributes']:_0x57e81f[_0x96f6('0x31')];if(!_0x2037ce[_0x96f6('0x34')]['hasOwnProperty'](_0x96f6('0x37'))){_0x26c3a2[_0x96f6('0x38')]=qs['limit'](_0x2037ce[_0x96f6('0x34')][_0x96f6('0x38')]);_0x26c3a2['offset']=qs[_0x96f6('0x1e')](_0x2037ce['query'][_0x96f6('0x1e')]);}_0x26c3a2[_0x96f6('0x39')]=qs[_0x96f6('0x3a')](_0x2037ce['query'][_0x96f6('0x3a')]);_0x26c3a2['where']=qs[_0x96f6('0x3b')](_[_0x96f6('0x3c')](_0x2037ce['query'],_0x57e81f[_0x96f6('0x3b')]),_0x29fbb9);if(_0x2037ce['query'][_0x96f6('0x3d')]){_0x26c3a2['where']=_[_0x96f6('0x3e')](_0x26c3a2[_0x96f6('0x3f')],{'$or':_['map'](_0x29fbb9,function(_0x8c5737){if(_0x8c5737[_0x96f6('0x2f')]!==_0x96f6('0x40')){var _0x4c6600={};_0x4c6600[_0x8c5737['name']]={'$like':'%'+_0x2037ce['query'][_0x96f6('0x3d')]+'%'};return _0x4c6600;}})});}_0x26c3a2=_[_0x96f6('0x3e')]({},_0x26c3a2,_0x2037ce[_0x96f6('0x41')]);var _0x1ac6b9={'where':_0x26c3a2[_0x96f6('0x3f')]};return db[_0x96f6('0x2d')]['count'](_0x1ac6b9)[_0x96f6('0x25')](function(_0x50cdd6){_0x2ea234[_0x96f6('0x20')]=_0x50cdd6;if(_0x2037ce['query']['includeAll']){_0x26c3a2[_0x96f6('0x42')]=[{'all':!![]}];}return db[_0x96f6('0x2d')][_0x96f6('0x43')](_0x26c3a2);})[_0x96f6('0x25')](function(_0x192f60){_0x2ea234[_0x96f6('0x44')]=_0x192f60;return _0x2ea234;})['then'](respondWithFilteredResult(_0x220cb4,_0x26c3a2))[_0x96f6('0x45')](handleError(_0x220cb4,null));};exports[_0x96f6('0x46')]=function(_0x5700ea,_0x5f026d){var _0x5dbf53={'raw':!![],'where':{'id':_0x5700ea[_0x96f6('0x47')]['id']}},_0x1bf3ac={};_0x1bf3ac['model']=_[_0x96f6('0x32')](db['Template'][_0x96f6('0x48')]);_0x1bf3ac[_0x96f6('0x34')]=_[_0x96f6('0x32')](_0x5700ea['query']);_0x1bf3ac[_0x96f6('0x3b')]=_[_0x96f6('0x33')](_0x1bf3ac['model'],_0x1bf3ac[_0x96f6('0x34')]);_0x5dbf53['attributes']=_[_0x96f6('0x33')](_0x1bf3ac[_0x96f6('0x31')],qs[_0x96f6('0x36')](_0x5700ea[_0x96f6('0x34')][_0x96f6('0x36')]));_0x5dbf53[_0x96f6('0x35')]=_0x5dbf53[_0x96f6('0x35')]['length']?_0x5dbf53[_0x96f6('0x35')]:_0x1bf3ac[_0x96f6('0x31')];if(_0x5700ea[_0x96f6('0x34')][_0x96f6('0x49')]){_0x5dbf53[_0x96f6('0x42')]=[{'all':!![]}];}_0x5dbf53=_[_0x96f6('0x3e')]({},_0x5dbf53,_0x5700ea[_0x96f6('0x41')]);return db[_0x96f6('0x2d')][_0x96f6('0x4a')](_0x5dbf53)[_0x96f6('0x25')](handleEntityNotFound(_0x5f026d,null))[_0x96f6('0x25')](respondWithResult(_0x5f026d,null))['catch'](handleError(_0x5f026d,null));};exports[_0x96f6('0x4b')]=function(_0x452ade,_0x1ca86b){return db[_0x96f6('0x2d')]['create'](_0x452ade[_0x96f6('0x4c')],{})[_0x96f6('0x25')](function(_0x516084){var _0x17a0a6=_0x452ade['user'][_0x96f6('0x27')]({'plain':!![]});if(!_0x17a0a6)throw new Error(_0x96f6('0x4d'));if(_0x17a0a6[_0x96f6('0x4e')]===_0x96f6('0x4f')){var _0x5da99d=_0x516084[_0x96f6('0x27')]({'plain':!![]});var _0x263417='Templates';return db[_0x96f6('0x50')]['find']({'where':{'name':_0x263417,'userProfileId':_0x17a0a6[_0x96f6('0x51')]},'raw':!![]})[_0x96f6('0x25')](function(_0x18958c){if(_0x18958c&&_0x18958c['autoAssociation']===0x0){return db[_0x96f6('0x52')][_0x96f6('0x4b')]({'name':_0x5da99d['name'],'resourceId':_0x5da99d['id'],'type':_0x18958c[_0x96f6('0x2a')],'sectionId':_0x18958c['id']},{})['then'](function(){return _0x516084;});}else{return _0x516084;}})['catch'](function(_0x3d3a5d){logger['error'](_0x96f6('0x53'),_0x3d3a5d);throw _0x3d3a5d;});}return _0x516084;})[_0x96f6('0x25')](respondWithResult(_0x1ca86b,0xc9))[_0x96f6('0x45')](handleError(_0x1ca86b,null));};exports[_0x96f6('0x54')]=function(_0x518093,_0x476ab2){if(_0x518093[_0x96f6('0x4c')]['id']){delete _0x518093[_0x96f6('0x4c')]['id'];}return db[_0x96f6('0x2d')][_0x96f6('0x4a')]({'where':{'id':_0x518093['params']['id']}})[_0x96f6('0x25')](handleEntityNotFound(_0x476ab2,null))[_0x96f6('0x25')](saveUpdates(_0x518093[_0x96f6('0x4c')],null))['then'](respondWithResult(_0x476ab2,null))[_0x96f6('0x45')](handleError(_0x476ab2,null));};exports[_0x96f6('0x26')]=function(_0x4141d9,_0x189c6c){return db[_0x96f6('0x2d')]['find']({'where':{'id':_0x4141d9[_0x96f6('0x47')]['id']}})[_0x96f6('0x25')](handleEntityNotFound(_0x189c6c,null))[_0x96f6('0x25')](removeEntity(_0x189c6c,null))['catch'](handleError(_0x189c6c,null));}; \ No newline at end of file +var _0xcb88=['lodash','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','Template','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','filter','includeAll','findAll','show','rawAttributes','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x5b5e9b,_0xe289fa){var _0x4ab979=function(_0x3ee1e6){while(--_0x3ee1e6){_0x5b5e9b['push'](_0x5b5e9b['shift']());}};_0x4ab979(++_0xe289fa);}(_0xcb88,0x1b7));var _0x8cb8=function(_0x1e4fae,_0x5893ce){_0x1e4fae=_0x1e4fae-0x0;var _0x5ccc9c=_0xcb88[_0x1e4fae];return _0x5ccc9c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cb8('0x0'));var zipdir=require(_0x8cb8('0x1'));var jsonpatch=require(_0x8cb8('0x2'));var rp=require('request-promise');var moment=require(_0x8cb8('0x3'));var BPromise=require(_0x8cb8('0x4'));var Mustache=require(_0x8cb8('0x5'));var util=require(_0x8cb8('0x6'));var path=require(_0x8cb8('0x7'));var sox=require(_0x8cb8('0x8'));var csv=require(_0x8cb8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cb8('0xa'));var _=require(_0x8cb8('0xb'));var squel=require(_0x8cb8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cb8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8cb8('0xe'));var Papa=require(_0x8cb8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8cb8('0x10'));var hardwareService=require(_0x8cb8('0x11'));var logger=require(_0x8cb8('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8cb8('0x13'));var db=require(_0x8cb8('0x14'))['db'];function respondWithStatusCode(_0x4577fb,_0x1121a3){_0x1121a3=_0x1121a3||0xcc;return function(_0x203483){if(_0x203483){return _0x4577fb[_0x8cb8('0x15')](_0x1121a3);}return _0x4577fb[_0x8cb8('0x16')](_0x1121a3)[_0x8cb8('0x17')]();};}function respondWithResult(_0x3f546a,_0x4f82f6){_0x4f82f6=_0x4f82f6||0xc8;return function(_0x301b85){if(_0x301b85){return _0x3f546a[_0x8cb8('0x16')](_0x4f82f6)[_0x8cb8('0x18')](_0x301b85);}};}function respondWithFilteredResult(_0x39d7d2,_0x5e1a15){return function(_0x36b5bf){if(_0x36b5bf){var _0x10a920=typeof _0x5e1a15['offset']===_0x8cb8('0x19')&&typeof _0x5e1a15[_0x8cb8('0x1a')]===_0x8cb8('0x19');var _0x9f54f6=_0x36b5bf[_0x8cb8('0x1b')];var _0x4d6de3=_0x10a920?0x0:_0x5e1a15[_0x8cb8('0x1c')];var _0x2d0755=_0x10a920?_0x36b5bf[_0x8cb8('0x1b')]:_0x5e1a15['offset']+_0x5e1a15['limit'];var _0x577c3c;if(_0x2d0755>=_0x9f54f6){_0x2d0755=_0x9f54f6;_0x577c3c=0xc8;}else{_0x577c3c=0xce;}_0x39d7d2['status'](_0x577c3c);return _0x39d7d2[_0x8cb8('0x1d')](_0x8cb8('0x1e'),_0x4d6de3+'-'+_0x2d0755+'/'+_0x9f54f6)[_0x8cb8('0x18')](_0x36b5bf);}return null;};}function patchUpdates(_0x208784){return function(_0x56d7f3){try{jsonpatch['apply'](_0x56d7f3,_0x208784,!![]);}catch(_0x4665ff){return BPromise['reject'](_0x4665ff);}return _0x56d7f3['save']();};}function saveUpdates(_0xe1213c,_0x1ff54f){return function(_0x30e16f){if(_0x30e16f){return _0x30e16f[_0x8cb8('0x1f')](_0xe1213c)['then'](function(_0xcda30a){return _0xcda30a;});}return null;};}function removeEntity(_0x334ca9,_0x9c7917){return function(_0x3795c7){if(_0x3795c7){return _0x3795c7[_0x8cb8('0x20')]()['then'](function(){var _0x101821=_0x3795c7[_0x8cb8('0x21')]({'plain':!![]});var _0x8bfea7='Templates';return db[_0x8cb8('0x22')][_0x8cb8('0x20')]({'where':{'type':_0x8bfea7,'resourceId':_0x101821['id']}})[_0x8cb8('0x23')](function(){return _0x3795c7;});})[_0x8cb8('0x23')](function(){_0x334ca9[_0x8cb8('0x16')](0xcc)[_0x8cb8('0x17')]();});}};}function handleEntityNotFound(_0x2dc156,_0x7e33cb){return function(_0x387df0){if(!_0x387df0){_0x2dc156[_0x8cb8('0x15')](0x194);}return _0x387df0;};}function handleError(_0x419367,_0x5f0592){_0x5f0592=_0x5f0592||0x1f4;return function(_0xbb8411){logger[_0x8cb8('0x24')](_0xbb8411[_0x8cb8('0x25')]);if(_0xbb8411[_0x8cb8('0x26')]){delete _0xbb8411[_0x8cb8('0x26')];}_0x419367[_0x8cb8('0x16')](_0x5f0592)[_0x8cb8('0x27')](_0xbb8411);};}exports[_0x8cb8('0x28')]=function(_0x208976,_0x33feb2){var _0xd6b53f={},_0x1250af={},_0x41549f={'count':0x0,'rows':[]};var _0x372c92=_['map'](db[_0x8cb8('0x29')]['rawAttributes'],function(_0x233dad){return{'name':_0x233dad['fieldName'],'type':_0x233dad[_0x8cb8('0x2a')][_0x8cb8('0x2b')]};});_0x1250af[_0x8cb8('0x2c')]=_[_0x8cb8('0x2d')](_0x372c92,'name');_0x1250af[_0x8cb8('0x2e')]=_[_0x8cb8('0x2f')](_0x208976['query']);_0x1250af[_0x8cb8('0x30')]=_[_0x8cb8('0x31')](_0x1250af['model'],_0x1250af['query']);_0xd6b53f[_0x8cb8('0x32')]=_[_0x8cb8('0x31')](_0x1250af['model'],qs[_0x8cb8('0x33')](_0x208976[_0x8cb8('0x2e')][_0x8cb8('0x33')]));_0xd6b53f['attributes']=_0xd6b53f[_0x8cb8('0x32')][_0x8cb8('0x34')]?_0xd6b53f['attributes']:_0x1250af['model'];if(!_0x208976[_0x8cb8('0x2e')][_0x8cb8('0x35')]('nolimit')){_0xd6b53f[_0x8cb8('0x1a')]=qs[_0x8cb8('0x1a')](_0x208976['query'][_0x8cb8('0x1a')]);_0xd6b53f[_0x8cb8('0x1c')]=qs[_0x8cb8('0x1c')](_0x208976['query'][_0x8cb8('0x1c')]);}_0xd6b53f[_0x8cb8('0x36')]=qs['sort'](_0x208976['query'][_0x8cb8('0x37')]);_0xd6b53f['where']=qs[_0x8cb8('0x30')](_[_0x8cb8('0x38')](_0x208976[_0x8cb8('0x2e')],_0x1250af[_0x8cb8('0x30')]),_0x372c92);if(_0x208976[_0x8cb8('0x2e')]['filter']){_0xd6b53f[_0x8cb8('0x39')]=_['merge'](_0xd6b53f[_0x8cb8('0x39')],{'$or':_[_0x8cb8('0x2d')](_0x372c92,function(_0x51abbc){if(_0x51abbc[_0x8cb8('0x2a')]!=='VIRTUAL'){var _0x4ad11b={};_0x4ad11b[_0x51abbc[_0x8cb8('0x26')]]={'$like':'%'+_0x208976[_0x8cb8('0x2e')][_0x8cb8('0x3a')]+'%'};return _0x4ad11b;}})});}_0xd6b53f=_['merge']({},_0xd6b53f,_0x208976['options']);var _0x42abb7={'where':_0xd6b53f[_0x8cb8('0x39')]};return db[_0x8cb8('0x29')][_0x8cb8('0x1b')](_0x42abb7)[_0x8cb8('0x23')](function(_0x2a003e){_0x41549f['count']=_0x2a003e;if(_0x208976[_0x8cb8('0x2e')][_0x8cb8('0x3b')]){_0xd6b53f['include']=[{'all':!![]}];}return db[_0x8cb8('0x29')][_0x8cb8('0x3c')](_0xd6b53f);})['then'](function(_0x1de08b){_0x41549f['rows']=_0x1de08b;return _0x41549f;})[_0x8cb8('0x23')](respondWithFilteredResult(_0x33feb2,_0xd6b53f))['catch'](handleError(_0x33feb2,null));};exports[_0x8cb8('0x3d')]=function(_0x2ce3af,_0x4b36df){var _0x516445={'raw':!![],'where':{'id':_0x2ce3af['params']['id']}},_0x4ac5f9={};_0x4ac5f9[_0x8cb8('0x2c')]=_['keys'](db['Template'][_0x8cb8('0x3e')]);_0x4ac5f9[_0x8cb8('0x2e')]=_['keys'](_0x2ce3af[_0x8cb8('0x2e')]);_0x4ac5f9[_0x8cb8('0x30')]=_['intersection'](_0x4ac5f9['model'],_0x4ac5f9[_0x8cb8('0x2e')]);_0x516445[_0x8cb8('0x32')]=_[_0x8cb8('0x31')](_0x4ac5f9[_0x8cb8('0x2c')],qs[_0x8cb8('0x33')](_0x2ce3af[_0x8cb8('0x2e')][_0x8cb8('0x33')]));_0x516445[_0x8cb8('0x32')]=_0x516445[_0x8cb8('0x32')][_0x8cb8('0x34')]?_0x516445['attributes']:_0x4ac5f9['model'];if(_0x2ce3af[_0x8cb8('0x2e')][_0x8cb8('0x3b')]){_0x516445[_0x8cb8('0x3f')]=[{'all':!![]}];}_0x516445=_[_0x8cb8('0x40')]({},_0x516445,_0x2ce3af['options']);return db[_0x8cb8('0x29')][_0x8cb8('0x41')](_0x516445)['then'](handleEntityNotFound(_0x4b36df,null))[_0x8cb8('0x23')](respondWithResult(_0x4b36df,null))[_0x8cb8('0x42')](handleError(_0x4b36df,null));};exports['create']=function(_0x621a02,_0x5eb922){return db['Template'][_0x8cb8('0x43')](_0x621a02[_0x8cb8('0x44')],{})[_0x8cb8('0x23')](function(_0x4edf66){var _0x2e66e7=_0x621a02[_0x8cb8('0x45')]['get']({'plain':!![]});if(!_0x2e66e7)throw new Error(_0x8cb8('0x46'));if(_0x2e66e7['role']===_0x8cb8('0x45')){var _0x36a4fc=_0x4edf66[_0x8cb8('0x21')]({'plain':!![]});var _0x2c5178='Templates';return db[_0x8cb8('0x47')][_0x8cb8('0x41')]({'where':{'name':_0x2c5178,'userProfileId':_0x2e66e7['userProfileId']},'raw':!![]})['then'](function(_0x4f351b){if(_0x4f351b&&_0x4f351b[_0x8cb8('0x48')]===0x0){return db[_0x8cb8('0x22')][_0x8cb8('0x43')]({'name':_0x36a4fc[_0x8cb8('0x26')],'resourceId':_0x36a4fc['id'],'type':_0x4f351b['name'],'sectionId':_0x4f351b['id']},{})[_0x8cb8('0x23')](function(){return _0x4edf66;});}else{return _0x4edf66;}})[_0x8cb8('0x42')](function(_0x2baf03){logger[_0x8cb8('0x24')](_0x8cb8('0x49'),_0x2baf03);throw _0x2baf03;});}return _0x4edf66;})['then'](respondWithResult(_0x5eb922,0xc9))['catch'](handleError(_0x5eb922,null));};exports[_0x8cb8('0x1f')]=function(_0x462074,_0xa7f001){if(_0x462074[_0x8cb8('0x44')]['id']){delete _0x462074[_0x8cb8('0x44')]['id'];}return db['Template'][_0x8cb8('0x41')]({'where':{'id':_0x462074[_0x8cb8('0x4a')]['id']}})[_0x8cb8('0x23')](handleEntityNotFound(_0xa7f001,null))[_0x8cb8('0x23')](saveUpdates(_0x462074[_0x8cb8('0x44')],null))[_0x8cb8('0x23')](respondWithResult(_0xa7f001,null))[_0x8cb8('0x42')](handleError(_0xa7f001,null));};exports[_0x8cb8('0x20')]=function(_0x47ab95,_0x31e1e5){return db[_0x8cb8('0x29')]['find']({'where':{'id':_0x47ab95[_0x8cb8('0x4a')]['id']}})[_0x8cb8('0x23')](handleEntityNotFound(_0x31e1e5,null))[_0x8cb8('0x23')](removeEntity(_0x31e1e5,null))[_0x8cb8('0x42')](handleError(_0x31e1e5,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 2588466..660fe22 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 _0x9634=['./template.attributes','exports','define','Template','tools_templates','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f50e8,_0x866ade){var _0x2e84b5=function(_0x3b7137){while(--_0x3b7137){_0x2f50e8['push'](_0x2f50e8['shift']());}};_0x2e84b5(++_0x866ade);}(_0x9634,0xae));var _0x4963=function(_0x56165c,_0x4687b1){_0x56165c=_0x56165c-0x0;var _0x7a93c7=_0x9634[_0x56165c];return _0x7a93c7;};'use strict';var _=require(_0x4963('0x0'));var util=require(_0x4963('0x1'));var logger=require('../../config/logger')(_0x4963('0x2'));var moment=require('moment');var BPromise=require(_0x4963('0x3'));var rp=require(_0x4963('0x4'));var fs=require('fs');var path=require(_0x4963('0x5'));var rimraf=require(_0x4963('0x6'));var config=require(_0x4963('0x7'));var attributes=require(_0x4963('0x8'));module[_0x4963('0x9')]=function(_0x17bb1f,_0x1caafd){return _0x17bb1f[_0x4963('0xa')](_0x4963('0xb'),attributes,{'tableName':_0x4963('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8684=['exports','define','Template','tools_templates','util','api','moment','rimraf','../../config/environment','./template.attributes'];(function(_0x51d27e,_0x2876d8){var _0x26d424=function(_0x42a5ba){while(--_0x42a5ba){_0x51d27e['push'](_0x51d27e['shift']());}};_0x26d424(++_0x2876d8);}(_0x8684,0xcc));var _0x4868=function(_0xe34c3f,_0x55b113){_0xe34c3f=_0xe34c3f-0x0;var _0xfa74be=_0x8684[_0xe34c3f];return _0xfa74be;};'use strict';var _=require('lodash');var util=require(_0x4868('0x0'));var logger=require('../../config/logger')(_0x4868('0x1'));var moment=require(_0x4868('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4868('0x3'));var config=require(_0x4868('0x4'));var attributes=require(_0x4868('0x5'));module[_0x4868('0x6')]=function(_0x47c5e1,_0x38f976){return _0x47c5e1[_0x4868('0x7')](_0x4868('0x8'),attributes,{'tableName':_0x4868('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index b4aa35d..d8c2887 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 _0x1e0c=['error','message','catch','Template','findAll','options','raw','where','attributes','map','include','model','GetTemplate','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cf39b,_0x24bb32){var _0x3aba62=function(_0x4c7b03){while(--_0x4c7b03){_0x4cf39b['push'](_0x4cf39b['shift']());}};_0x3aba62(++_0x24bb32);}(_0x1e0c,0xc7));var _0xc1e0=function(_0x3c40be,_0x3d3f2a){_0x3c40be=_0x3c40be-0x0;var _0x4561f8=_0x1e0c[_0x3c40be];return _0x4561f8;};'use strict';var _=require(_0xc1e0('0x0'));var util=require(_0xc1e0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1e0('0x3'))['db'];var utils=require(_0xc1e0('0x4'));var logger=require(_0xc1e0('0x5'))(_0xc1e0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1e0('0x7'));var client=jayson[_0xc1e0('0x8')][_0xc1e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a7979,_0x5a3fa1,_0x5e5713){return new BPromise(function(_0x26944a,_0x1d6cb6){return client[_0xc1e0('0xa')](_0x8a7979,_0x5e5713)[_0xc1e0('0xb')](function(_0x1ac755){logger[_0xc1e0('0xc')](_0xc1e0('0xd'),_0x5a3fa1,_0xc1e0('0xe'));logger[_0xc1e0('0xf')](_0xc1e0('0x10'),_0x5a3fa1,_0xc1e0('0xe'),JSON[_0xc1e0('0x11')](_0x1ac755));if(_0x1ac755['error']){if(_0x1ac755['error']['code']===0x1f4){logger[_0xc1e0('0x12')]('Template,\x20%s,\x20%s',_0x5a3fa1,_0x1ac755['error']['message']);return _0x1d6cb6(_0x1ac755[_0xc1e0('0x12')][_0xc1e0('0x13')]);}logger[_0xc1e0('0x12')](_0xc1e0('0xd'),_0x5a3fa1,_0x1ac755['error'][_0xc1e0('0x13')]);return _0x26944a(_0x1ac755[_0xc1e0('0x12')]['message']);}else{logger[_0xc1e0('0xc')](_0xc1e0('0xd'),_0x5a3fa1,'request\x20sent');_0x26944a(_0x1ac755['result'][_0xc1e0('0x13')]);}})[_0xc1e0('0x14')](function(_0x1c1194){logger['error']('Template,\x20%s,\x20%s',_0x5a3fa1,_0x1c1194);_0x1d6cb6(_0x1c1194);});});}exports['GetTemplate']=function(_0xfa5701){var _0x1d2060=this;return new Promise(function(_0x21f347,_0x270914){return db[_0xc1e0('0x15')][_0xc1e0('0x16')]({'raw':_0xfa5701['options']?_0xfa5701[_0xc1e0('0x17')][_0xc1e0('0x18')]===undefined?!![]:![]:!![],'where':_0xfa5701[_0xc1e0('0x17')]?_0xfa5701[_0xc1e0('0x17')][_0xc1e0('0x19')]||null:null,'attributes':_0xfa5701[_0xc1e0('0x17')]?_0xfa5701[_0xc1e0('0x17')][_0xc1e0('0x1a')]||null:null,'limit':_0xfa5701[_0xc1e0('0x17')]?_0xfa5701['options']['limit']||null:null,'include':_0xfa5701[_0xc1e0('0x17')]?_0xfa5701['options']['include']?_[_0xc1e0('0x1b')](_0xfa5701['options'][_0xc1e0('0x1c')],function(_0x213446){return{'model':db[_0x213446[_0xc1e0('0x1d')]],'as':_0x213446['as'],'attributes':_0x213446[_0xc1e0('0x1a')],'include':_0x213446[_0xc1e0('0x1c')]?_[_0xc1e0('0x1b')](_0x213446[_0xc1e0('0x1c')],function(_0x530ed2){return{'model':db[_0x530ed2[_0xc1e0('0x1d')]],'as':_0x530ed2['as'],'attributes':_0x530ed2['attributes'],'include':_0x530ed2[_0xc1e0('0x1c')]?_[_0xc1e0('0x1b')](_0x530ed2['include'],function(_0x5e833b){return{'model':db[_0x5e833b['model']],'as':_0x5e833b['as'],'attributes':_0x5e833b[_0xc1e0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a8aa8){logger[_0xc1e0('0xc')](_0xc1e0('0x1e'),_0xfa5701);logger['debug'](_0xc1e0('0x1e'),_0xfa5701,JSON['stringify'](_0x2a8aa8));_0x21f347(_0x2a8aa8);})[_0xc1e0('0x14')](function(_0x530089){logger[_0xc1e0('0x12')](_0xc1e0('0x1e'),_0x530089[_0xc1e0('0x13')],_0xfa5701);_0x270914(_0x1d2060[_0xc1e0('0x12')](0x1f4,_0x530089['message']));});});}; \ No newline at end of file +var _0x5f56=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','findAll','options','raw','where','limit','include','map','model','attributes','GetTemplate','catch','lodash','util'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x5f56,0xc4));var _0x65f5=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0x5f56[_0x2a390b];return _0x5df10a;};'use strict';var _=require(_0x65f5('0x0'));var util=require(_0x65f5('0x1'));var moment=require(_0x65f5('0x2'));var BPromise=require(_0x65f5('0x3'));var rs=require(_0x65f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65f5('0x5'))['db'];var utils=require(_0x65f5('0x6'));var logger=require('../../config/logger')(_0x65f5('0x7'));var config=require('../../config/environment');var jayson=require(_0x65f5('0x8'));var client=jayson[_0x65f5('0x9')][_0x65f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x72e2f2,_0xe5d50f,_0x456d12){return new BPromise(function(_0x140eee,_0x38c878){return client[_0x65f5('0xb')](_0x72e2f2,_0x456d12)[_0x65f5('0xc')](function(_0x23d2d8){logger[_0x65f5('0xd')](_0x65f5('0xe'),_0xe5d50f,'request\x20sent');logger[_0x65f5('0xf')](_0x65f5('0x10'),_0xe5d50f,_0x65f5('0x11'),JSON[_0x65f5('0x12')](_0x23d2d8));if(_0x23d2d8[_0x65f5('0x13')]){if(_0x23d2d8[_0x65f5('0x13')]['code']===0x1f4){logger[_0x65f5('0x13')]('Template,\x20%s,\x20%s',_0xe5d50f,_0x23d2d8[_0x65f5('0x13')][_0x65f5('0x14')]);return _0x38c878(_0x23d2d8['error'][_0x65f5('0x14')]);}logger[_0x65f5('0x13')](_0x65f5('0xe'),_0xe5d50f,_0x23d2d8[_0x65f5('0x13')][_0x65f5('0x14')]);return _0x140eee(_0x23d2d8[_0x65f5('0x13')][_0x65f5('0x14')]);}else{logger[_0x65f5('0xd')]('Template,\x20%s,\x20%s',_0xe5d50f,_0x65f5('0x11'));_0x140eee(_0x23d2d8[_0x65f5('0x15')][_0x65f5('0x14')]);}})['catch'](function(_0x1a8e33){logger[_0x65f5('0x13')]('Template,\x20%s,\x20%s',_0xe5d50f,_0x1a8e33);_0x38c878(_0x1a8e33);});});}exports['GetTemplate']=function(_0x43536a){var _0x2d612a=this;return new Promise(function(_0x2b0dc3,_0x5f4821){return db['Template'][_0x65f5('0x16')]({'raw':_0x43536a[_0x65f5('0x17')]?_0x43536a[_0x65f5('0x17')][_0x65f5('0x18')]===undefined?!![]:![]:!![],'where':_0x43536a['options']?_0x43536a[_0x65f5('0x17')][_0x65f5('0x19')]||null:null,'attributes':_0x43536a[_0x65f5('0x17')]?_0x43536a[_0x65f5('0x17')]['attributes']||null:null,'limit':_0x43536a[_0x65f5('0x17')]?_0x43536a[_0x65f5('0x17')][_0x65f5('0x1a')]||null:null,'include':_0x43536a[_0x65f5('0x17')]?_0x43536a[_0x65f5('0x17')][_0x65f5('0x1b')]?_[_0x65f5('0x1c')](_0x43536a['options'][_0x65f5('0x1b')],function(_0x6df1fd){return{'model':db[_0x6df1fd[_0x65f5('0x1d')]],'as':_0x6df1fd['as'],'attributes':_0x6df1fd[_0x65f5('0x1e')],'include':_0x6df1fd[_0x65f5('0x1b')]?_[_0x65f5('0x1c')](_0x6df1fd[_0x65f5('0x1b')],function(_0x2be49b){return{'model':db[_0x2be49b[_0x65f5('0x1d')]],'as':_0x2be49b['as'],'attributes':_0x2be49b[_0x65f5('0x1e')],'include':_0x2be49b[_0x65f5('0x1b')]?_[_0x65f5('0x1c')](_0x2be49b[_0x65f5('0x1b')],function(_0x80ad06){return{'model':db[_0x80ad06[_0x65f5('0x1d')]],'as':_0x80ad06['as'],'attributes':_0x80ad06[_0x65f5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x65f5('0xc')](function(_0x2ee4a1){logger['info']('GetTemplate',_0x43536a);logger['debug'](_0x65f5('0x1f'),_0x43536a,JSON[_0x65f5('0x12')](_0x2ee4a1));_0x2b0dc3(_0x2ee4a1);})[_0x65f5('0x20')](function(_0x59e524){logger['error'](_0x65f5('0x1f'),_0x59e524[_0x65f5('0x14')],_0x43536a);_0x5f4821(_0x2d612a[_0x65f5('0x13')](0x1f4,_0x59e524[_0x65f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b8c86e8..01b1f21 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 _0xe9ea=['destroy','exports','multer','connect-timeout','express','Router','./trigger.controller','isAuthenticated','get','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAction','put','/:id','delete'];(function(_0x594a97,_0x1e5b33){var _0x115aad=function(_0x4ce5da){while(--_0x4ce5da){_0x594a97['push'](_0x594a97['shift']());}};_0x115aad(++_0x1e5b33);}(_0xe9ea,0x128));var _0xae9e=function(_0x1edc21,_0x1b5cb4){_0x1edc21=_0x1edc21-0x0;var _0x4a57b6=_0xe9ea[_0x1edc21];return _0x4a57b6;};'use strict';var multer=require(_0xae9e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xae9e('0x1'));var express=require(_0xae9e('0x2'));var router=express[_0xae9e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae9e('0x4'));router['get']('/',auth[_0xae9e('0x5')](),controller['index']);router[_0xae9e('0x6')]('/:id',auth[_0xae9e('0x5')](),controller['show']);router[_0xae9e('0x6')](_0xae9e('0x7'),auth[_0xae9e('0x5')](),controller['getAllConditions']);router[_0xae9e('0x6')]('/:id/any_conditions',auth[_0xae9e('0x5')](),controller[_0xae9e('0x8')]);router[_0xae9e('0x6')](_0xae9e('0x9'),auth[_0xae9e('0x5')](),controller[_0xae9e('0xa')]);router[_0xae9e('0xb')]('/',auth[_0xae9e('0x5')](),controller[_0xae9e('0xc')]);router[_0xae9e('0xb')](_0xae9e('0x7'),auth['isAuthenticated'](),controller[_0xae9e('0xd')]);router[_0xae9e('0xb')](_0xae9e('0xe'),auth[_0xae9e('0x5')](),controller['addAnyCondition']);router['post']('/:id/actions',auth[_0xae9e('0x5')](),controller[_0xae9e('0xf')]);router[_0xae9e('0x10')](_0xae9e('0x11'),auth[_0xae9e('0x5')](),controller['update']);router[_0xae9e('0x12')](_0xae9e('0x11'),auth[_0xae9e('0x5')](),controller[_0xae9e('0x13')]);module[_0xae9e('0x14')]=router; \ No newline at end of file +var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','post','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2d7fd5,_0x38785f){var _0xdd134f=function(_0x5cac2b){while(--_0x5cac2b){_0x2d7fd5['push'](_0x2d7fd5['shift']());}};_0xdd134f(++_0x38785f);}(_0xea28,0x13a));var _0x8ea2=function(_0x48e421,_0x5cbea5){_0x48e421=_0x48e421-0x0;var _0x5295a4=_0xea28[_0x48e421];return _0x5295a4;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getAnyConditions']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller['addAllCondition']);router[_0x8ea2('0x15')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x8ea2('0x16')]);router[_0x8ea2('0x15')](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index b6f0bd4..0c04ddc 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 _0x142f=['BOOLEAN','sequelize','STRING'];(function(_0x168478,_0x323a27){var _0x29c2f8=function(_0x4f7a8a){while(--_0x4f7a8a){_0x168478['push'](_0x168478['shift']());}};_0x29c2f8(++_0x323a27);}(_0x142f,0x136));var _0xf142=function(_0x31cb87,_0x81c6ff){_0x31cb87=_0x31cb87-0x0;var _0x1b61a0=_0x142f[_0x31cb87];return _0x1b61a0;};'use strict';var Sequelize=require(_0xf142('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf142('0x1')]},'description':{'type':Sequelize[_0xf142('0x1')]},'status':{'type':Sequelize[_0xf142('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9075=['STRING','BOOLEAN'];(function(_0x146f21,_0x24dc1f){var _0x59a416=function(_0x36ea07){while(--_0x36ea07){_0x146f21['push'](_0x146f21['shift']());}};_0x59a416(++_0x24dc1f);}(_0x9075,0x7a));var _0x5907=function(_0x2c84e5,_0x58a7c7){_0x2c84e5=_0x2c84e5-0x0;var _0x4990ec=_0x9075[_0x2c84e5];return _0x4990ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5907('0x0')]},'channel':{'type':Sequelize[_0x5907('0x0')]},'description':{'type':Sequelize[_0x5907('0x0')]},'status':{'type':Sequelize[_0x5907('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index a3394c0..b7179b4 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 _0xba0a=['querystring','ioredis','../../components/parsers/qs','../../config/logger','../../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','name','send','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','TriggerAllId','Condition','TriggerAnyId','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x454c12,_0x45c282){var _0x7bb4dc=function(_0x585c87){while(--_0x585c87){_0x454c12['push'](_0x454c12['shift']());}};_0x7bb4dc(++_0x45c282);}(_0xba0a,0xf6));var _0xaba0=function(_0x8fa4bc,_0x5cd2af){_0x8fa4bc=_0x8fa4bc-0x0;var _0x35b6a7=_0xba0a[_0x8fa4bc];return _0x35b6a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaba0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaba0('0x1'));var rp=require(_0xaba0('0x2'));var moment=require(_0xaba0('0x3'));var BPromise=require(_0xaba0('0x4'));var Mustache=require('mustache');var util=require(_0xaba0('0x5'));var path=require('path');var sox=require(_0xaba0('0x6'));var csv=require(_0xaba0('0x7'));var ejs=require(_0xaba0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaba0('0x9'));var crypto=require(_0xaba0('0xa'));var jsforce=require(_0xaba0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaba0('0xc'));var Papa=require('papaparse');var Redis=require(_0xaba0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xaba0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaba0('0xf'))('api');var utils=require(_0xaba0('0x10'));var config=require(_0xaba0('0x11'));var licenseUtil=require(_0xaba0('0x12'));var db=require(_0xaba0('0x13'))['db'];function respondWithStatusCode(_0x2bbc6b,_0x41fe5c){_0x41fe5c=_0x41fe5c||0xcc;return function(_0x49c0a8){if(_0x49c0a8){return _0x2bbc6b[_0xaba0('0x14')](_0x41fe5c);}return _0x2bbc6b['status'](_0x41fe5c)[_0xaba0('0x15')]();};}function respondWithResult(_0x97b682,_0x3dfdb2){_0x3dfdb2=_0x3dfdb2||0xc8;return function(_0xeb6ae8){if(_0xeb6ae8){return _0x97b682[_0xaba0('0x16')](_0x3dfdb2)[_0xaba0('0x17')](_0xeb6ae8);}};}function respondWithFilteredResult(_0x2d7d71,_0x4a6903){return function(_0x3ce859){if(_0x3ce859){var _0x583fd0=typeof _0x4a6903[_0xaba0('0x18')]==='undefined'&&typeof _0x4a6903[_0xaba0('0x19')]===_0xaba0('0x1a');var _0x1b76c5=_0x3ce859[_0xaba0('0x1b')];var _0x58ce83=_0x583fd0?0x0:_0x4a6903[_0xaba0('0x18')];var _0x208a86=_0x583fd0?_0x3ce859['count']:_0x4a6903[_0xaba0('0x18')]+_0x4a6903[_0xaba0('0x19')];var _0x2c63bd;if(_0x208a86>=_0x1b76c5){_0x208a86=_0x1b76c5;_0x2c63bd=0xc8;}else{_0x2c63bd=0xce;}_0x2d7d71[_0xaba0('0x16')](_0x2c63bd);return _0x2d7d71[_0xaba0('0x1c')](_0xaba0('0x1d'),_0x58ce83+'-'+_0x208a86+'/'+_0x1b76c5)[_0xaba0('0x17')](_0x3ce859);}return null;};}function patchUpdates(_0x19d4f7){return function(_0x311ca3){try{jsonpatch[_0xaba0('0x1e')](_0x311ca3,_0x19d4f7,!![]);}catch(_0x1a00e3){return BPromise[_0xaba0('0x1f')](_0x1a00e3);}return _0x311ca3['save']();};}function saveUpdates(_0x2b855e,_0x136f43){return function(_0x35f47d){if(_0x35f47d){return _0x35f47d[_0xaba0('0x20')](_0x2b855e)[_0xaba0('0x21')](function(_0x34db42){return _0x34db42;});}return null;};}function removeEntity(_0xc922e0,_0x47ecde){return function(_0x15d35f){if(_0x15d35f){return _0x15d35f[_0xaba0('0x22')]()['then'](function(){var _0x1171de=_0x15d35f[_0xaba0('0x23')]({'plain':!![]});var _0x4325a1='Triggers';return db['UserProfileResource'][_0xaba0('0x22')]({'where':{'type':_0x4325a1,'resourceId':_0x1171de['id']}})['then'](function(){return _0x15d35f;});})[_0xaba0('0x21')](function(){_0xc922e0[_0xaba0('0x16')](0xcc)[_0xaba0('0x15')]();});}};}function handleEntityNotFound(_0x34a99b,_0x4a19c1){return function(_0x26acac){if(!_0x26acac){_0x34a99b['sendStatus'](0x194);}return _0x26acac;};}function handleError(_0x2edc2c,_0x33a7bb){_0x33a7bb=_0x33a7bb||0x1f4;return function(_0x4fd01b){logger['error'](_0x4fd01b['stack']);if(_0x4fd01b['name']){delete _0x4fd01b[_0xaba0('0x24')];}_0x2edc2c['status'](_0x33a7bb)[_0xaba0('0x25')](_0x4fd01b);};}exports['index']=function(_0x2d276e,_0x49fa1b){var _0x2258b7={},_0x36dc10={},_0x472c68={'count':0x0,'rows':[]};var _0x2452f4=_[_0xaba0('0x26')](db[_0xaba0('0x27')][_0xaba0('0x28')],function(_0x2b6500){return{'name':_0x2b6500[_0xaba0('0x29')],'type':_0x2b6500[_0xaba0('0x2a')]['key']};});_0x36dc10[_0xaba0('0x2b')]=_['map'](_0x2452f4,_0xaba0('0x24'));_0x36dc10[_0xaba0('0x2c')]=_[_0xaba0('0x2d')](_0x2d276e[_0xaba0('0x2c')]);_0x36dc10[_0xaba0('0x2e')]=_['intersection'](_0x36dc10[_0xaba0('0x2b')],_0x36dc10[_0xaba0('0x2c')]);_0x2258b7['attributes']=_[_0xaba0('0x2f')](_0x36dc10['model'],qs[_0xaba0('0x30')](_0x2d276e[_0xaba0('0x2c')][_0xaba0('0x30')]));_0x2258b7['attributes']=_0x2258b7[_0xaba0('0x31')][_0xaba0('0x32')]?_0x2258b7[_0xaba0('0x31')]:_0x36dc10[_0xaba0('0x2b')];if(!_0x2d276e['query'][_0xaba0('0x33')](_0xaba0('0x34'))){_0x2258b7['limit']=qs[_0xaba0('0x19')](_0x2d276e[_0xaba0('0x2c')][_0xaba0('0x19')]);_0x2258b7[_0xaba0('0x18')]=qs[_0xaba0('0x18')](_0x2d276e[_0xaba0('0x2c')][_0xaba0('0x18')]);}_0x2258b7[_0xaba0('0x35')]=qs[_0xaba0('0x36')](_0x2d276e[_0xaba0('0x2c')]['sort']);_0x2258b7[_0xaba0('0x37')]=qs['filters'](_[_0xaba0('0x38')](_0x2d276e['query'],_0x36dc10[_0xaba0('0x2e')]),_0x2452f4);if(_0x2d276e[_0xaba0('0x2c')][_0xaba0('0x39')]){_0x2258b7[_0xaba0('0x37')]=_[_0xaba0('0x3a')](_0x2258b7['where'],{'$or':_[_0xaba0('0x26')](_0x2452f4,function(_0x25d3fe){if(_0x25d3fe[_0xaba0('0x2a')]!==_0xaba0('0x3b')){var _0x2f342c={};_0x2f342c[_0x25d3fe['name']]={'$like':'%'+_0x2d276e['query'][_0xaba0('0x39')]+'%'};return _0x2f342c;}})});}_0x2258b7=_[_0xaba0('0x3a')]({},_0x2258b7,_0x2d276e[_0xaba0('0x3c')]);var _0x39d131={'where':_0x2258b7[_0xaba0('0x37')]};return db['Trigger'][_0xaba0('0x1b')](_0x39d131)[_0xaba0('0x21')](function(_0x391dcf){_0x472c68['count']=_0x391dcf;if(_0x2d276e[_0xaba0('0x2c')][_0xaba0('0x3d')]){_0x2258b7[_0xaba0('0x3e')]=[{'all':!![]}];}return db[_0xaba0('0x27')]['findAll'](_0x2258b7);})['then'](function(_0x6f40a){_0x472c68['rows']=_0x6f40a;return _0x472c68;})[_0xaba0('0x21')](respondWithFilteredResult(_0x49fa1b,_0x2258b7))[_0xaba0('0x3f')](handleError(_0x49fa1b,null));};exports['show']=function(_0x58b263,_0x109346){var _0x51dac2={'raw':![],'where':{'id':_0x58b263['params']['id']}},_0x23f840={};_0x23f840['model']=_['keys'](db[_0xaba0('0x27')][_0xaba0('0x28')]);_0x23f840['query']=_[_0xaba0('0x2d')](_0x58b263[_0xaba0('0x2c')]);_0x23f840['filters']=_[_0xaba0('0x2f')](_0x23f840[_0xaba0('0x2b')],_0x23f840[_0xaba0('0x2c')]);_0x51dac2[_0xaba0('0x31')]=_['intersection'](_0x23f840['model'],qs[_0xaba0('0x30')](_0x58b263[_0xaba0('0x2c')][_0xaba0('0x30')]));_0x51dac2[_0xaba0('0x31')]=_0x51dac2[_0xaba0('0x31')][_0xaba0('0x32')]?_0x51dac2['attributes']:_0x23f840['model'];if(_0x58b263['query'][_0xaba0('0x3d')]){_0x51dac2[_0xaba0('0x3e')]=[{'all':!![]}];}_0x51dac2=_[_0xaba0('0x3a')]({},_0x51dac2,_0x58b263['options']);return db[_0xaba0('0x27')][_0xaba0('0x40')](_0x51dac2)['then'](handleEntityNotFound(_0x109346,null))[_0xaba0('0x21')](respondWithResult(_0x109346,null))[_0xaba0('0x3f')](handleError(_0x109346,null));};exports[_0xaba0('0x41')]=function(_0x22c1db,_0x559bec){return db[_0xaba0('0x27')][_0xaba0('0x41')](_0x22c1db['body'],{})[_0xaba0('0x21')](function(_0x28f851){var _0x35b65e=_0x22c1db['user'][_0xaba0('0x23')]({'plain':!![]});if(!_0x35b65e)throw new Error(_0xaba0('0x42'));if(_0x35b65e[_0xaba0('0x43')]===_0xaba0('0x44')){var _0x3fd056=_0x28f851['get']({'plain':!![]});var _0x1676b4=_0xaba0('0x45');return db[_0xaba0('0x46')][_0xaba0('0x40')]({'where':{'name':_0x1676b4,'userProfileId':_0x35b65e['userProfileId']},'raw':!![]})[_0xaba0('0x21')](function(_0x41565b){if(_0x41565b&&_0x41565b[_0xaba0('0x47')]===0x0){return db[_0xaba0('0x48')][_0xaba0('0x41')]({'name':_0x3fd056[_0xaba0('0x24')],'resourceId':_0x3fd056['id'],'type':_0x41565b['name'],'sectionId':_0x41565b['id']},{})[_0xaba0('0x21')](function(){return _0x28f851;});}else{return _0x28f851;}})[_0xaba0('0x3f')](function(_0x250595){logger[_0xaba0('0x49')](_0xaba0('0x4a'),_0x250595);throw _0x250595;});}return _0x28f851;})[_0xaba0('0x21')](respondWithResult(_0x559bec,0xc9))[_0xaba0('0x3f')](handleError(_0x559bec,null));};exports[_0xaba0('0x20')]=function(_0x1a1021,_0x5793a5){if(_0x1a1021[_0xaba0('0x4b')]['id']){delete _0x1a1021[_0xaba0('0x4b')]['id'];}return db['Trigger'][_0xaba0('0x40')]({'where':{'id':_0x1a1021[_0xaba0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5793a5,null))[_0xaba0('0x21')](saveUpdates(_0x1a1021['body'],null))['then'](respondWithResult(_0x5793a5,null))['catch'](handleError(_0x5793a5,null));};exports[_0xaba0('0x22')]=function(_0x406448,_0x224776){return db[_0xaba0('0x27')][_0xaba0('0x40')]({'where':{'id':_0x406448[_0xaba0('0x4c')]['id']}})[_0xaba0('0x21')](handleEntityNotFound(_0x224776,null))['then'](removeEntity(_0x224776,null))[_0xaba0('0x3f')](handleError(_0x224776,null));};exports['addAllCondition']=function(_0x3a756f,_0x36e3d6,_0x33b5e0){if(_0x3a756f[_0xaba0('0x4b')]['id']){delete _0x3a756f[_0xaba0('0x4b')]['id'];}return db[_0xaba0('0x27')][_0xaba0('0x40')]({'where':{'id':_0x3a756f[_0xaba0('0x4c')]['id']}})[_0xaba0('0x21')](handleEntityNotFound(_0x36e3d6,null))['then'](function(_0x13cb7c){if(_0x13cb7c){_0x3a756f[_0xaba0('0x4b')][_0xaba0('0x4d')]=_0x13cb7c['id'];return db[_0xaba0('0x4e')][_0xaba0('0x41')](_0x3a756f['body']);}})[_0xaba0('0x21')](respondWithResult(_0x36e3d6,null))[_0xaba0('0x3f')](handleError(_0x36e3d6,null));};exports['addAnyCondition']=function(_0x42938d,_0x9f89fc,_0x4fd9ab){if(_0x42938d[_0xaba0('0x4b')]['id']){delete _0x42938d[_0xaba0('0x4b')]['id'];}return db['Trigger'][_0xaba0('0x40')]({'where':{'id':_0x42938d[_0xaba0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9f89fc,null))[_0xaba0('0x21')](function(_0x250d65){if(_0x250d65){_0x42938d['body'][_0xaba0('0x4f')]=_0x250d65['id'];return db[_0xaba0('0x4e')][_0xaba0('0x41')](_0x42938d[_0xaba0('0x4b')]);}})['then'](respondWithResult(_0x9f89fc,null))['catch'](handleError(_0x9f89fc,null));};exports[_0xaba0('0x50')]=function(_0x4c2d42,_0x19f0f5,_0x34ed52){var _0x1c4162={};var _0x1a631c={};var _0x541d3c;var _0x3b8240;return db[_0xaba0('0x27')]['findOne']({'where':{'id':_0x4c2d42[_0xaba0('0x4c')]['id']}})[_0xaba0('0x21')](handleEntityNotFound(_0x19f0f5,null))['then'](function(_0x1985c5){if(_0x1985c5){_0x541d3c=_0x1985c5;_0x1a631c['model']=_[_0xaba0('0x2d')](db[_0xaba0('0x4e')][_0xaba0('0x28')]);_0x1a631c[_0xaba0('0x2c')]=_[_0xaba0('0x2d')](_0x4c2d42[_0xaba0('0x2c')]);_0x1a631c['filters']=_['intersection'](_0x1a631c[_0xaba0('0x2b')],_0x1a631c[_0xaba0('0x2c')]);_0x1c4162['attributes']=_[_0xaba0('0x2f')](_0x1a631c[_0xaba0('0x2b')],qs[_0xaba0('0x30')](_0x4c2d42['query']['fields']));_0x1c4162[_0xaba0('0x31')]=_0x1c4162['attributes'][_0xaba0('0x32')]?_0x1c4162[_0xaba0('0x31')]:_0x1a631c[_0xaba0('0x2b')];_0x1c4162[_0xaba0('0x35')]=qs[_0xaba0('0x36')](_0x4c2d42[_0xaba0('0x2c')]['sort']);_0x1c4162[_0xaba0('0x37')]=qs[_0xaba0('0x2e')](_['pick'](_0x4c2d42[_0xaba0('0x2c')],_0x1a631c[_0xaba0('0x2e')]));if(_0x4c2d42['query'][_0xaba0('0x39')]){_0x1c4162['where']=_[_0xaba0('0x3a')](_0x1c4162[_0xaba0('0x37')],{'$or':_[_0xaba0('0x26')](_0x1c4162['attributes'],function(_0x16920b){var _0x4d8948={};_0x4d8948[_0x16920b]={'$like':'%'+_0x4c2d42[_0xaba0('0x2c')][_0xaba0('0x39')]+'%'};return _0x4d8948;})});}_0x1c4162=_['merge']({},_0x1c4162,_0x4c2d42[_0xaba0('0x3c')]);return _0x541d3c[_0xaba0('0x50')](_0x1c4162);}})[_0xaba0('0x21')](function(_0x1f2626){if(_0x1f2626){_0x3b8240=_0x1f2626['length'];if(!_0x4c2d42['query'][_0xaba0('0x33')](_0xaba0('0x34'))){_0x1c4162[_0xaba0('0x19')]=qs[_0xaba0('0x19')](_0x4c2d42[_0xaba0('0x2c')][_0xaba0('0x19')]);_0x1c4162[_0xaba0('0x18')]=qs[_0xaba0('0x18')](_0x4c2d42['query']['offset']);}return _0x541d3c[_0xaba0('0x50')](_0x1c4162);}})[_0xaba0('0x21')](function(_0x45d5e1){if(_0x45d5e1){return _0x45d5e1?{'count':_0x3b8240,'rows':_0x45d5e1}:null;}})[_0xaba0('0x21')](respondWithResult(_0x19f0f5,null))[_0xaba0('0x3f')](handleError(_0x19f0f5,null));};exports[_0xaba0('0x51')]=function(_0x418aa3,_0x3b734c,_0x5ca966){var _0x1c6bbb={};var _0x56b0e5={};var _0x3afb5b;var _0xdf937d;return db['Trigger']['findOne']({'where':{'id':_0x418aa3[_0xaba0('0x4c')]['id']}})[_0xaba0('0x21')](handleEntityNotFound(_0x3b734c,null))[_0xaba0('0x21')](function(_0xa6efcc){if(_0xa6efcc){_0x3afb5b=_0xa6efcc;_0x56b0e5[_0xaba0('0x2b')]=_[_0xaba0('0x2d')](db[_0xaba0('0x4e')][_0xaba0('0x28')]);_0x56b0e5['query']=_[_0xaba0('0x2d')](_0x418aa3[_0xaba0('0x2c')]);_0x56b0e5[_0xaba0('0x2e')]=_['intersection'](_0x56b0e5[_0xaba0('0x2b')],_0x56b0e5['query']);_0x1c6bbb[_0xaba0('0x31')]=_[_0xaba0('0x2f')](_0x56b0e5[_0xaba0('0x2b')],qs[_0xaba0('0x30')](_0x418aa3[_0xaba0('0x2c')][_0xaba0('0x30')]));_0x1c6bbb[_0xaba0('0x31')]=_0x1c6bbb[_0xaba0('0x31')][_0xaba0('0x32')]?_0x1c6bbb['attributes']:_0x56b0e5[_0xaba0('0x2b')];_0x1c6bbb[_0xaba0('0x35')]=qs[_0xaba0('0x36')](_0x418aa3[_0xaba0('0x2c')][_0xaba0('0x36')]);_0x1c6bbb['where']=qs['filters'](_[_0xaba0('0x38')](_0x418aa3[_0xaba0('0x2c')],_0x56b0e5[_0xaba0('0x2e')]));if(_0x418aa3[_0xaba0('0x2c')][_0xaba0('0x39')]){_0x1c6bbb['where']=_[_0xaba0('0x3a')](_0x1c6bbb[_0xaba0('0x37')],{'$or':_[_0xaba0('0x26')](_0x1c6bbb[_0xaba0('0x31')],function(_0x4abb4b){var _0x5633b7={};_0x5633b7[_0x4abb4b]={'$like':'%'+_0x418aa3[_0xaba0('0x2c')][_0xaba0('0x39')]+'%'};return _0x5633b7;})});}_0x1c6bbb=_['merge']({},_0x1c6bbb,_0x418aa3[_0xaba0('0x3c')]);return _0x3afb5b['getAnyConditions'](_0x1c6bbb);}})[_0xaba0('0x21')](function(_0x2a647f){if(_0x2a647f){_0xdf937d=_0x2a647f[_0xaba0('0x32')];if(!_0x418aa3['query'][_0xaba0('0x33')](_0xaba0('0x34'))){_0x1c6bbb[_0xaba0('0x19')]=qs[_0xaba0('0x19')](_0x418aa3[_0xaba0('0x2c')]['limit']);_0x1c6bbb[_0xaba0('0x18')]=qs['offset'](_0x418aa3[_0xaba0('0x2c')][_0xaba0('0x18')]);}return _0x3afb5b[_0xaba0('0x51')](_0x1c6bbb);}})['then'](function(_0x3bb2c3){if(_0x3bb2c3){return _0x3bb2c3?{'count':_0xdf937d,'rows':_0x3bb2c3}:null;}})[_0xaba0('0x21')](respondWithResult(_0x3b734c,null))['catch'](handleError(_0x3b734c,null));};exports[_0xaba0('0x52')]=function(_0x578381,_0x33c5d8,_0x306548){if(_0x578381[_0xaba0('0x4b')]['id']){delete _0x578381['body']['id'];}return db['Trigger'][_0xaba0('0x40')]({'where':{'id':_0x578381['params']['id']}})[_0xaba0('0x21')](handleEntityNotFound(_0x33c5d8,null))[_0xaba0('0x21')](function(_0x4a002b){if(_0x4a002b){_0x578381[_0xaba0('0x4b')][_0xaba0('0x53')]=_0x4a002b['id'];return db[_0xaba0('0x54')][_0xaba0('0x41')](_0x578381[_0xaba0('0x4b')]);}})[_0xaba0('0x21')](respondWithResult(_0x33c5d8,null))[_0xaba0('0x3f')](handleError(_0x33c5d8,null));};exports[_0xaba0('0x55')]=function(_0x11da70,_0x3430c8,_0x2f71b7){var _0x57276a={};var _0x479e25={};var _0x21ee74;var _0x210be0;return db['Trigger']['findOne']({'where':{'id':_0x11da70[_0xaba0('0x4c')]['id']}})[_0xaba0('0x21')](handleEntityNotFound(_0x3430c8,null))[_0xaba0('0x21')](function(_0x43f68f){if(_0x43f68f){_0x21ee74=_0x43f68f;_0x479e25[_0xaba0('0x2b')]=_['keys'](db[_0xaba0('0x54')][_0xaba0('0x28')]);_0x479e25['query']=_[_0xaba0('0x2d')](_0x11da70[_0xaba0('0x2c')]);_0x479e25[_0xaba0('0x2e')]=_[_0xaba0('0x2f')](_0x479e25[_0xaba0('0x2b')],_0x479e25[_0xaba0('0x2c')]);_0x57276a[_0xaba0('0x31')]=_['intersection'](_0x479e25['model'],qs['fields'](_0x11da70[_0xaba0('0x2c')][_0xaba0('0x30')]));_0x57276a[_0xaba0('0x31')]=_0x57276a[_0xaba0('0x31')]['length']?_0x57276a['attributes']:_0x479e25['model'];_0x57276a['order']=qs[_0xaba0('0x36')](_0x11da70[_0xaba0('0x2c')]['sort']);_0x57276a[_0xaba0('0x37')]=qs[_0xaba0('0x2e')](_[_0xaba0('0x38')](_0x11da70[_0xaba0('0x2c')],_0x479e25[_0xaba0('0x2e')]));if(_0x11da70[_0xaba0('0x2c')][_0xaba0('0x39')]){_0x57276a[_0xaba0('0x37')]=_[_0xaba0('0x3a')](_0x57276a['where'],{'$or':_[_0xaba0('0x26')](_0x57276a[_0xaba0('0x31')],function(_0x5f0755){var _0x25291c={};_0x25291c[_0x5f0755]={'$like':'%'+_0x11da70['query'][_0xaba0('0x39')]+'%'};return _0x25291c;})});}_0x57276a=_[_0xaba0('0x3a')]({},_0x57276a,_0x11da70[_0xaba0('0x3c')]);return _0x21ee74[_0xaba0('0x55')](_0x57276a);}})[_0xaba0('0x21')](function(_0x2aca7e){if(_0x2aca7e){_0x210be0=_0x2aca7e[_0xaba0('0x32')];if(!_0x11da70[_0xaba0('0x2c')][_0xaba0('0x33')](_0xaba0('0x34'))){_0x57276a[_0xaba0('0x19')]=qs['limit'](_0x11da70[_0xaba0('0x2c')]['limit']);_0x57276a['offset']=qs[_0xaba0('0x18')](_0x11da70[_0xaba0('0x2c')][_0xaba0('0x18')]);}return _0x21ee74[_0xaba0('0x55')](_0x57276a);}})[_0xaba0('0x21')](function(_0x5dc752){if(_0x5dc752){return _0x5dc752?{'count':_0x210be0,'rows':_0x5dc752}:null;}})[_0xaba0('0x21')](respondWithResult(_0x3430c8,null))['catch'](handleError(_0x3430c8,null));}; \ No newline at end of file +var _0x4dd2=['util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','Trigger','includeAll','include','findAll','rows','catch','keys','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','findOne','nolimit','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','request-promise','moment'];(function(_0x137d1d,_0x35c663){var _0x485108=function(_0x108a2a){while(--_0x108a2a){_0x137d1d['push'](_0x137d1d['shift']());}};_0x485108(++_0x35c663);}(_0x4dd2,0x15c));var _0x24dd=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0x4dd2[_0x35f6b4];return _0x10f072;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24dd('0x0'));var zipdir=require(_0x24dd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24dd('0x2'));var moment=require(_0x24dd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x24dd('0x4'));var path=require(_0x24dd('0x5'));var sox=require(_0x24dd('0x6'));var csv=require(_0x24dd('0x7'));var ejs=require(_0x24dd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24dd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x24dd('0xa'));var toCsv=require(_0x24dd('0x7'));var querystring=require('querystring');var Papa=require(_0x24dd('0xb'));var Redis=require('ioredis');var authService=require(_0x24dd('0xc'));var qs=require(_0x24dd('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24dd('0xe'));var logger=require('../../config/logger')(_0x24dd('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x24dd('0x10'))['db'];function respondWithStatusCode(_0x2cdfac,_0x3233eb){_0x3233eb=_0x3233eb||0xcc;return function(_0x9d71e8){if(_0x9d71e8){return _0x2cdfac['sendStatus'](_0x3233eb);}return _0x2cdfac[_0x24dd('0x11')](_0x3233eb)[_0x24dd('0x12')]();};}function respondWithResult(_0x2d3eee,_0x38285b){_0x38285b=_0x38285b||0xc8;return function(_0x22c1c7){if(_0x22c1c7){return _0x2d3eee[_0x24dd('0x11')](_0x38285b)[_0x24dd('0x13')](_0x22c1c7);}};}function respondWithFilteredResult(_0x8ee3cf,_0x3aa6eb){return function(_0x368c49){if(_0x368c49){var _0x250240=typeof _0x3aa6eb['offset']===_0x24dd('0x14')&&typeof _0x3aa6eb[_0x24dd('0x15')]===_0x24dd('0x14');var _0x4fd970=_0x368c49[_0x24dd('0x16')];var _0x3e9efa=_0x250240?0x0:_0x3aa6eb[_0x24dd('0x17')];var _0x58ce96=_0x250240?_0x368c49['count']:_0x3aa6eb[_0x24dd('0x17')]+_0x3aa6eb['limit'];var _0x34777c;if(_0x58ce96>=_0x4fd970){_0x58ce96=_0x4fd970;_0x34777c=0xc8;}else{_0x34777c=0xce;}_0x8ee3cf[_0x24dd('0x11')](_0x34777c);return _0x8ee3cf[_0x24dd('0x18')](_0x24dd('0x19'),_0x3e9efa+'-'+_0x58ce96+'/'+_0x4fd970)['json'](_0x368c49);}return null;};}function patchUpdates(_0x478a6d){return function(_0x1376d6){try{jsonpatch[_0x24dd('0x1a')](_0x1376d6,_0x478a6d,!![]);}catch(_0x370277){return BPromise[_0x24dd('0x1b')](_0x370277);}return _0x1376d6[_0x24dd('0x1c')]();};}function saveUpdates(_0x46dc58,_0x22661a){return function(_0xf53381){if(_0xf53381){return _0xf53381[_0x24dd('0x1d')](_0x46dc58)[_0x24dd('0x1e')](function(_0x17eacc){return _0x17eacc;});}return null;};}function removeEntity(_0x1c12c0,_0x18e122){return function(_0x5e189d){if(_0x5e189d){return _0x5e189d[_0x24dd('0x1f')]()[_0x24dd('0x1e')](function(){var _0x24a9da=_0x5e189d['get']({'plain':!![]});var _0x7435cf='Triggers';return db['UserProfileResource'][_0x24dd('0x1f')]({'where':{'type':_0x7435cf,'resourceId':_0x24a9da['id']}})[_0x24dd('0x1e')](function(){return _0x5e189d;});})[_0x24dd('0x1e')](function(){_0x1c12c0[_0x24dd('0x11')](0xcc)[_0x24dd('0x12')]();});}};}function handleEntityNotFound(_0x3fdc5e,_0x2412b){return function(_0x372683){if(!_0x372683){_0x3fdc5e['sendStatus'](0x194);}return _0x372683;};}function handleError(_0x1d93f2,_0x5728f6){_0x5728f6=_0x5728f6||0x1f4;return function(_0x2ac3ed){logger[_0x24dd('0x20')](_0x2ac3ed[_0x24dd('0x21')]);if(_0x2ac3ed[_0x24dd('0x22')]){delete _0x2ac3ed[_0x24dd('0x22')];}_0x1d93f2[_0x24dd('0x11')](_0x5728f6)[_0x24dd('0x23')](_0x2ac3ed);};}exports[_0x24dd('0x24')]=function(_0x354847,_0x246238){var _0x1684ec={},_0x531d0f={},_0x5ed90b={'count':0x0,'rows':[]};var _0x4efbc0=_[_0x24dd('0x25')](db['Trigger'][_0x24dd('0x26')],function(_0xc67601){return{'name':_0xc67601[_0x24dd('0x27')],'type':_0xc67601[_0x24dd('0x28')][_0x24dd('0x29')]};});_0x531d0f[_0x24dd('0x2a')]=_[_0x24dd('0x25')](_0x4efbc0,'name');_0x531d0f[_0x24dd('0x2b')]=_['keys'](_0x354847['query']);_0x531d0f['filters']=_[_0x24dd('0x2c')](_0x531d0f[_0x24dd('0x2a')],_0x531d0f['query']);_0x1684ec['attributes']=_['intersection'](_0x531d0f[_0x24dd('0x2a')],qs[_0x24dd('0x2d')](_0x354847[_0x24dd('0x2b')][_0x24dd('0x2d')]));_0x1684ec['attributes']=_0x1684ec[_0x24dd('0x2e')][_0x24dd('0x2f')]?_0x1684ec[_0x24dd('0x2e')]:_0x531d0f[_0x24dd('0x2a')];if(!_0x354847[_0x24dd('0x2b')][_0x24dd('0x30')]('nolimit')){_0x1684ec['limit']=qs[_0x24dd('0x15')](_0x354847[_0x24dd('0x2b')][_0x24dd('0x15')]);_0x1684ec[_0x24dd('0x17')]=qs['offset'](_0x354847[_0x24dd('0x2b')][_0x24dd('0x17')]);}_0x1684ec[_0x24dd('0x31')]=qs[_0x24dd('0x32')](_0x354847[_0x24dd('0x2b')][_0x24dd('0x32')]);_0x1684ec[_0x24dd('0x33')]=qs['filters'](_[_0x24dd('0x34')](_0x354847[_0x24dd('0x2b')],_0x531d0f[_0x24dd('0x35')]),_0x4efbc0);if(_0x354847[_0x24dd('0x2b')][_0x24dd('0x36')]){_0x1684ec[_0x24dd('0x33')]=_['merge'](_0x1684ec[_0x24dd('0x33')],{'$or':_[_0x24dd('0x25')](_0x4efbc0,function(_0x50451a){if(_0x50451a[_0x24dd('0x28')]!==_0x24dd('0x37')){var _0x5b9f62={};_0x5b9f62[_0x50451a[_0x24dd('0x22')]]={'$like':'%'+_0x354847[_0x24dd('0x2b')]['filter']+'%'};return _0x5b9f62;}})});}_0x1684ec=_['merge']({},_0x1684ec,_0x354847['options']);var _0x5e3112={'where':_0x1684ec[_0x24dd('0x33')]};return db[_0x24dd('0x38')]['count'](_0x5e3112)['then'](function(_0x5a8e4c){_0x5ed90b[_0x24dd('0x16')]=_0x5a8e4c;if(_0x354847[_0x24dd('0x2b')][_0x24dd('0x39')]){_0x1684ec[_0x24dd('0x3a')]=[{'all':!![]}];}return db[_0x24dd('0x38')][_0x24dd('0x3b')](_0x1684ec);})['then'](function(_0x9d021){_0x5ed90b[_0x24dd('0x3c')]=_0x9d021;return _0x5ed90b;})[_0x24dd('0x1e')](respondWithFilteredResult(_0x246238,_0x1684ec))[_0x24dd('0x3d')](handleError(_0x246238,null));};exports['show']=function(_0x281de0,_0x348f08){var _0x498fb0={'raw':![],'where':{'id':_0x281de0['params']['id']}},_0x55b325={};_0x55b325[_0x24dd('0x2a')]=_[_0x24dd('0x3e')](db[_0x24dd('0x38')][_0x24dd('0x26')]);_0x55b325['query']=_[_0x24dd('0x3e')](_0x281de0[_0x24dd('0x2b')]);_0x55b325[_0x24dd('0x35')]=_['intersection'](_0x55b325['model'],_0x55b325[_0x24dd('0x2b')]);_0x498fb0['attributes']=_['intersection'](_0x55b325[_0x24dd('0x2a')],qs['fields'](_0x281de0[_0x24dd('0x2b')]['fields']));_0x498fb0['attributes']=_0x498fb0[_0x24dd('0x2e')][_0x24dd('0x2f')]?_0x498fb0[_0x24dd('0x2e')]:_0x55b325['model'];if(_0x281de0[_0x24dd('0x2b')][_0x24dd('0x39')]){_0x498fb0[_0x24dd('0x3a')]=[{'all':!![]}];}_0x498fb0=_[_0x24dd('0x3f')]({},_0x498fb0,_0x281de0[_0x24dd('0x40')]);return db[_0x24dd('0x38')][_0x24dd('0x41')](_0x498fb0)[_0x24dd('0x1e')](handleEntityNotFound(_0x348f08,null))[_0x24dd('0x1e')](respondWithResult(_0x348f08,null))[_0x24dd('0x3d')](handleError(_0x348f08,null));};exports[_0x24dd('0x42')]=function(_0xdd4ffb,_0x1050c5){return db[_0x24dd('0x38')][_0x24dd('0x42')](_0xdd4ffb[_0x24dd('0x43')],{})['then'](function(_0x15b4f2){var _0x3a6a56=_0xdd4ffb[_0x24dd('0x44')][_0x24dd('0x45')]({'plain':!![]});if(!_0x3a6a56)throw new Error(_0x24dd('0x46'));if(_0x3a6a56[_0x24dd('0x47')]===_0x24dd('0x44')){var _0x3341cc=_0x15b4f2['get']({'plain':!![]});var _0x44d6a6=_0x24dd('0x48');return db[_0x24dd('0x49')]['find']({'where':{'name':_0x44d6a6,'userProfileId':_0x3a6a56['userProfileId']},'raw':!![]})[_0x24dd('0x1e')](function(_0x3678a9){if(_0x3678a9&&_0x3678a9['autoAssociation']===0x0){return db[_0x24dd('0x4a')]['create']({'name':_0x3341cc[_0x24dd('0x22')],'resourceId':_0x3341cc['id'],'type':_0x3678a9[_0x24dd('0x22')],'sectionId':_0x3678a9['id']},{})['then'](function(){return _0x15b4f2;});}else{return _0x15b4f2;}})[_0x24dd('0x3d')](function(_0x310a98){logger[_0x24dd('0x20')](_0x24dd('0x4b'),_0x310a98);throw _0x310a98;});}return _0x15b4f2;})[_0x24dd('0x1e')](respondWithResult(_0x1050c5,0xc9))[_0x24dd('0x3d')](handleError(_0x1050c5,null));};exports[_0x24dd('0x1d')]=function(_0x20de37,_0xa26485){if(_0x20de37[_0x24dd('0x43')]['id']){delete _0x20de37[_0x24dd('0x43')]['id'];}return db[_0x24dd('0x38')][_0x24dd('0x41')]({'where':{'id':_0x20de37[_0x24dd('0x4c')]['id']}})[_0x24dd('0x1e')](handleEntityNotFound(_0xa26485,null))[_0x24dd('0x1e')](saveUpdates(_0x20de37[_0x24dd('0x43')],null))[_0x24dd('0x1e')](respondWithResult(_0xa26485,null))[_0x24dd('0x3d')](handleError(_0xa26485,null));};exports[_0x24dd('0x1f')]=function(_0x3d6ff6,_0x55a1cd){return db[_0x24dd('0x38')][_0x24dd('0x41')]({'where':{'id':_0x3d6ff6[_0x24dd('0x4c')]['id']}})[_0x24dd('0x1e')](handleEntityNotFound(_0x55a1cd,null))[_0x24dd('0x1e')](removeEntity(_0x55a1cd,null))[_0x24dd('0x3d')](handleError(_0x55a1cd,null));};exports[_0x24dd('0x4d')]=function(_0x31ae23,_0x3cfd6a,_0x53d6b9){if(_0x31ae23[_0x24dd('0x43')]['id']){delete _0x31ae23[_0x24dd('0x43')]['id'];}return db[_0x24dd('0x38')]['find']({'where':{'id':_0x31ae23[_0x24dd('0x4c')]['id']}})[_0x24dd('0x1e')](handleEntityNotFound(_0x3cfd6a,null))[_0x24dd('0x1e')](function(_0x5b9356){if(_0x5b9356){_0x31ae23[_0x24dd('0x43')][_0x24dd('0x4e')]=_0x5b9356['id'];return db[_0x24dd('0x4f')][_0x24dd('0x42')](_0x31ae23['body']);}})[_0x24dd('0x1e')](respondWithResult(_0x3cfd6a,null))[_0x24dd('0x3d')](handleError(_0x3cfd6a,null));};exports['addAnyCondition']=function(_0x5bd74c,_0x14528c,_0x55f90b){if(_0x5bd74c[_0x24dd('0x43')]['id']){delete _0x5bd74c[_0x24dd('0x43')]['id'];}return db[_0x24dd('0x38')]['find']({'where':{'id':_0x5bd74c[_0x24dd('0x4c')]['id']}})[_0x24dd('0x1e')](handleEntityNotFound(_0x14528c,null))[_0x24dd('0x1e')](function(_0x2cd262){if(_0x2cd262){_0x5bd74c[_0x24dd('0x43')]['TriggerAnyId']=_0x2cd262['id'];return db[_0x24dd('0x4f')][_0x24dd('0x42')](_0x5bd74c[_0x24dd('0x43')]);}})[_0x24dd('0x1e')](respondWithResult(_0x14528c,null))[_0x24dd('0x3d')](handleError(_0x14528c,null));};exports['getAllConditions']=function(_0xd88922,_0x3ab247,_0x37a681){var _0x184950={};var _0x1e2bd6={};var _0x280c2d;var _0x471299;return db['Trigger'][_0x24dd('0x50')]({'where':{'id':_0xd88922[_0x24dd('0x4c')]['id']}})[_0x24dd('0x1e')](handleEntityNotFound(_0x3ab247,null))[_0x24dd('0x1e')](function(_0x389606){if(_0x389606){_0x280c2d=_0x389606;_0x1e2bd6[_0x24dd('0x2a')]=_[_0x24dd('0x3e')](db[_0x24dd('0x4f')][_0x24dd('0x26')]);_0x1e2bd6[_0x24dd('0x2b')]=_[_0x24dd('0x3e')](_0xd88922[_0x24dd('0x2b')]);_0x1e2bd6[_0x24dd('0x35')]=_[_0x24dd('0x2c')](_0x1e2bd6[_0x24dd('0x2a')],_0x1e2bd6[_0x24dd('0x2b')]);_0x184950['attributes']=_[_0x24dd('0x2c')](_0x1e2bd6[_0x24dd('0x2a')],qs['fields'](_0xd88922[_0x24dd('0x2b')][_0x24dd('0x2d')]));_0x184950[_0x24dd('0x2e')]=_0x184950[_0x24dd('0x2e')][_0x24dd('0x2f')]?_0x184950[_0x24dd('0x2e')]:_0x1e2bd6[_0x24dd('0x2a')];_0x184950[_0x24dd('0x31')]=qs[_0x24dd('0x32')](_0xd88922['query'][_0x24dd('0x32')]);_0x184950[_0x24dd('0x33')]=qs[_0x24dd('0x35')](_[_0x24dd('0x34')](_0xd88922[_0x24dd('0x2b')],_0x1e2bd6[_0x24dd('0x35')]));if(_0xd88922[_0x24dd('0x2b')][_0x24dd('0x36')]){_0x184950[_0x24dd('0x33')]=_[_0x24dd('0x3f')](_0x184950['where'],{'$or':_['map'](_0x184950[_0x24dd('0x2e')],function(_0x317d46){var _0x47d529={};_0x47d529[_0x317d46]={'$like':'%'+_0xd88922[_0x24dd('0x2b')][_0x24dd('0x36')]+'%'};return _0x47d529;})});}_0x184950=_[_0x24dd('0x3f')]({},_0x184950,_0xd88922[_0x24dd('0x40')]);return _0x280c2d['getAllConditions'](_0x184950);}})[_0x24dd('0x1e')](function(_0x2b1b60){if(_0x2b1b60){_0x471299=_0x2b1b60['length'];if(!_0xd88922[_0x24dd('0x2b')][_0x24dd('0x30')](_0x24dd('0x51'))){_0x184950[_0x24dd('0x15')]=qs[_0x24dd('0x15')](_0xd88922[_0x24dd('0x2b')][_0x24dd('0x15')]);_0x184950[_0x24dd('0x17')]=qs['offset'](_0xd88922[_0x24dd('0x2b')][_0x24dd('0x17')]);}return _0x280c2d[_0x24dd('0x52')](_0x184950);}})['then'](function(_0x338bbe){if(_0x338bbe){return _0x338bbe?{'count':_0x471299,'rows':_0x338bbe}:null;}})['then'](respondWithResult(_0x3ab247,null))[_0x24dd('0x3d')](handleError(_0x3ab247,null));};exports[_0x24dd('0x53')]=function(_0x130534,_0x1d5946,_0xbe8dd9){var _0x369f84={};var _0x146181={};var _0x5b370d;var _0x330453;return db[_0x24dd('0x38')][_0x24dd('0x50')]({'where':{'id':_0x130534[_0x24dd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d5946,null))[_0x24dd('0x1e')](function(_0x58c750){if(_0x58c750){_0x5b370d=_0x58c750;_0x146181[_0x24dd('0x2a')]=_[_0x24dd('0x3e')](db[_0x24dd('0x4f')]['rawAttributes']);_0x146181[_0x24dd('0x2b')]=_[_0x24dd('0x3e')](_0x130534[_0x24dd('0x2b')]);_0x146181[_0x24dd('0x35')]=_[_0x24dd('0x2c')](_0x146181[_0x24dd('0x2a')],_0x146181[_0x24dd('0x2b')]);_0x369f84[_0x24dd('0x2e')]=_[_0x24dd('0x2c')](_0x146181[_0x24dd('0x2a')],qs[_0x24dd('0x2d')](_0x130534['query'][_0x24dd('0x2d')]));_0x369f84[_0x24dd('0x2e')]=_0x369f84[_0x24dd('0x2e')][_0x24dd('0x2f')]?_0x369f84[_0x24dd('0x2e')]:_0x146181['model'];_0x369f84['order']=qs['sort'](_0x130534[_0x24dd('0x2b')][_0x24dd('0x32')]);_0x369f84[_0x24dd('0x33')]=qs[_0x24dd('0x35')](_['pick'](_0x130534[_0x24dd('0x2b')],_0x146181[_0x24dd('0x35')]));if(_0x130534[_0x24dd('0x2b')][_0x24dd('0x36')]){_0x369f84['where']=_[_0x24dd('0x3f')](_0x369f84[_0x24dd('0x33')],{'$or':_[_0x24dd('0x25')](_0x369f84[_0x24dd('0x2e')],function(_0x49a3a7){var _0x50798f={};_0x50798f[_0x49a3a7]={'$like':'%'+_0x130534[_0x24dd('0x2b')][_0x24dd('0x36')]+'%'};return _0x50798f;})});}_0x369f84=_[_0x24dd('0x3f')]({},_0x369f84,_0x130534[_0x24dd('0x40')]);return _0x5b370d[_0x24dd('0x53')](_0x369f84);}})[_0x24dd('0x1e')](function(_0x38a03f){if(_0x38a03f){_0x330453=_0x38a03f[_0x24dd('0x2f')];if(!_0x130534['query'][_0x24dd('0x30')](_0x24dd('0x51'))){_0x369f84[_0x24dd('0x15')]=qs[_0x24dd('0x15')](_0x130534[_0x24dd('0x2b')][_0x24dd('0x15')]);_0x369f84[_0x24dd('0x17')]=qs['offset'](_0x130534['query'][_0x24dd('0x17')]);}return _0x5b370d['getAnyConditions'](_0x369f84);}})[_0x24dd('0x1e')](function(_0x1b299b){if(_0x1b299b){return _0x1b299b?{'count':_0x330453,'rows':_0x1b299b}:null;}})['then'](respondWithResult(_0x1d5946,null))[_0x24dd('0x3d')](handleError(_0x1d5946,null));};exports[_0x24dd('0x54')]=function(_0x3da7d6,_0xeef383,_0x411d0a){if(_0x3da7d6[_0x24dd('0x43')]['id']){delete _0x3da7d6['body']['id'];}return db[_0x24dd('0x38')]['find']({'where':{'id':_0x3da7d6[_0x24dd('0x4c')]['id']}})['then'](handleEntityNotFound(_0xeef383,null))[_0x24dd('0x1e')](function(_0xfbc327){if(_0xfbc327){_0x3da7d6[_0x24dd('0x43')][_0x24dd('0x55')]=_0xfbc327['id'];return db[_0x24dd('0x56')][_0x24dd('0x42')](_0x3da7d6[_0x24dd('0x43')]);}})[_0x24dd('0x1e')](respondWithResult(_0xeef383,null))[_0x24dd('0x3d')](handleError(_0xeef383,null));};exports[_0x24dd('0x57')]=function(_0x19cb47,_0x20c6c7,_0x5a017f){var _0x3780fe={};var _0x2b9b71={};var _0x5d5dfc;var _0x34f151;return db[_0x24dd('0x38')][_0x24dd('0x50')]({'where':{'id':_0x19cb47[_0x24dd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20c6c7,null))[_0x24dd('0x1e')](function(_0x1c5228){if(_0x1c5228){_0x5d5dfc=_0x1c5228;_0x2b9b71[_0x24dd('0x2a')]=_[_0x24dd('0x3e')](db[_0x24dd('0x56')][_0x24dd('0x26')]);_0x2b9b71[_0x24dd('0x2b')]=_[_0x24dd('0x3e')](_0x19cb47['query']);_0x2b9b71[_0x24dd('0x35')]=_[_0x24dd('0x2c')](_0x2b9b71['model'],_0x2b9b71['query']);_0x3780fe[_0x24dd('0x2e')]=_[_0x24dd('0x2c')](_0x2b9b71[_0x24dd('0x2a')],qs[_0x24dd('0x2d')](_0x19cb47[_0x24dd('0x2b')]['fields']));_0x3780fe[_0x24dd('0x2e')]=_0x3780fe[_0x24dd('0x2e')][_0x24dd('0x2f')]?_0x3780fe[_0x24dd('0x2e')]:_0x2b9b71[_0x24dd('0x2a')];_0x3780fe[_0x24dd('0x31')]=qs[_0x24dd('0x32')](_0x19cb47[_0x24dd('0x2b')][_0x24dd('0x32')]);_0x3780fe[_0x24dd('0x33')]=qs[_0x24dd('0x35')](_[_0x24dd('0x34')](_0x19cb47[_0x24dd('0x2b')],_0x2b9b71[_0x24dd('0x35')]));if(_0x19cb47[_0x24dd('0x2b')][_0x24dd('0x36')]){_0x3780fe[_0x24dd('0x33')]=_['merge'](_0x3780fe[_0x24dd('0x33')],{'$or':_[_0x24dd('0x25')](_0x3780fe[_0x24dd('0x2e')],function(_0x3faca7){var _0x1fa54b={};_0x1fa54b[_0x3faca7]={'$like':'%'+_0x19cb47[_0x24dd('0x2b')][_0x24dd('0x36')]+'%'};return _0x1fa54b;})});}_0x3780fe=_[_0x24dd('0x3f')]({},_0x3780fe,_0x19cb47[_0x24dd('0x40')]);return _0x5d5dfc[_0x24dd('0x57')](_0x3780fe);}})[_0x24dd('0x1e')](function(_0x3bf39a){if(_0x3bf39a){_0x34f151=_0x3bf39a[_0x24dd('0x2f')];if(!_0x19cb47[_0x24dd('0x2b')][_0x24dd('0x30')](_0x24dd('0x51'))){_0x3780fe[_0x24dd('0x15')]=qs['limit'](_0x19cb47['query']['limit']);_0x3780fe[_0x24dd('0x17')]=qs[_0x24dd('0x17')](_0x19cb47[_0x24dd('0x2b')][_0x24dd('0x17')]);}return _0x5d5dfc[_0x24dd('0x57')](_0x3780fe);}})[_0x24dd('0x1e')](function(_0x13ee7f){if(_0x13ee7f){return _0x13ee7f?{'count':_0x34f151,'rows':_0x13ee7f}:null;}})[_0x24dd('0x1e')](respondWithResult(_0x20c6c7,null))[_0x24dd('0x3d')](handleError(_0x20c6c7,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6eac46b..a1e64d9 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 _0x0f3c=['request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','bluebird'];(function(_0x309b0d,_0x59fe87){var _0x56defa=function(_0x30eda2){while(--_0x30eda2){_0x309b0d['push'](_0x309b0d['shift']());}};_0x56defa(++_0x59fe87);}(_0x0f3c,0x189));var _0xc0f3=function(_0x305520,_0x1c73c5){_0x305520=_0x305520-0x0;var _0x1aabfa=_0x0f3c[_0x305520];return _0x1aabfa;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc0f3('0x2'));var rp=require(_0xc0f3('0x3'));var fs=require('fs');var path=require(_0xc0f3('0x4'));var rimraf=require(_0xc0f3('0x5'));var config=require(_0xc0f3('0x6'));var attributes=require(_0xc0f3('0x7'));module[_0xc0f3('0x8')]=function(_0x256643,_0x4b76a0){return _0x256643[_0xc0f3('0x9')](_0xc0f3('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9181=['Trigger','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x9181,0x182));var _0x1918=function(_0x39ff60,_0x501ae8){_0x39ff60=_0x39ff60-0x0;var _0xa3a946=_0x9181[_0x39ff60];return _0xa3a946;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var logger=require(_0x1918('0x2'))(_0x1918('0x3'));var moment=require(_0x1918('0x4'));var BPromise=require('bluebird');var rp=require(_0x1918('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1918('0x6'));var config=require(_0x1918('0x7'));var attributes=require(_0x1918('0x8'));module[_0x1918('0x9')]=function(_0x424951,_0x4106d7){return _0x424951['define'](_0x1918('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index b7039d9..61dbde7 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 _0xd103=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','debug','find','where','ShowTrigger'];(function(_0x3ba282,_0x1dde3d){var _0x374bfd=function(_0x536bbc){while(--_0x536bbc){_0x3ba282['push'](_0x3ba282['shift']());}};_0x374bfd(++_0x1dde3d);}(_0xd103,0x140));var _0x3d10=function(_0x754926,_0x2d921e){_0x754926=_0x754926-0x0;var _0x2236a3=_0xd103[_0x754926];return _0x2236a3;};'use strict';var _=require(_0x3d10('0x0'));var util=require(_0x3d10('0x1'));var moment=require('moment');var BPromise=require(_0x3d10('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d10('0x3'));var db=require(_0x3d10('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d10('0x5'))(_0x3d10('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3d10('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ce82a,_0x90ca20,_0x24f260){return new BPromise(function(_0x342937,_0x439cc0){return client[_0x3d10('0x8')](_0x4ce82a,_0x24f260)[_0x3d10('0x9')](function(_0x54c7ae){logger[_0x3d10('0xa')]('Trigger,\x20%s,\x20%s',_0x90ca20,_0x3d10('0xb'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x90ca20,_0x3d10('0xb'),JSON[_0x3d10('0xc')](_0x54c7ae));if(_0x54c7ae[_0x3d10('0xd')]){if(_0x54c7ae['error']['code']===0x1f4){logger['error'](_0x3d10('0xe'),_0x90ca20,_0x54c7ae[_0x3d10('0xd')][_0x3d10('0xf')]);return _0x439cc0(_0x54c7ae[_0x3d10('0xd')][_0x3d10('0xf')]);}logger[_0x3d10('0xd')](_0x3d10('0xe'),_0x90ca20,_0x54c7ae[_0x3d10('0xd')]['message']);return _0x342937(_0x54c7ae[_0x3d10('0xd')][_0x3d10('0xf')]);}else{logger[_0x3d10('0xa')](_0x3d10('0xe'),_0x90ca20,_0x3d10('0xb'));_0x342937(_0x54c7ae[_0x3d10('0x10')][_0x3d10('0xf')]);}})[_0x3d10('0x11')](function(_0x3fa9e5){logger['error'](_0x3d10('0xe'),_0x90ca20,_0x3fa9e5);_0x439cc0(_0x3fa9e5);});});}exports[_0x3d10('0x12')]=function(_0x55ed3c){var _0x23e8f0=this;return new Promise(function(_0x55fb87,_0xf0853b){return db[_0x3d10('0x13')][_0x3d10('0x14')]({'raw':_0x55ed3c[_0x3d10('0x15')]?_0x55ed3c['options'][_0x3d10('0x16')]===undefined?!![]:![]:!![],'where':_0x55ed3c[_0x3d10('0x15')]?_0x55ed3c[_0x3d10('0x15')]['where']||null:null,'attributes':_0x55ed3c[_0x3d10('0x15')]?_0x55ed3c[_0x3d10('0x15')][_0x3d10('0x17')]||null:null,'limit':_0x55ed3c['options']?_0x55ed3c[_0x3d10('0x15')][_0x3d10('0x18')]||null:null,'include':_0x55ed3c[_0x3d10('0x15')]?_0x55ed3c[_0x3d10('0x15')][_0x3d10('0x19')]?_[_0x3d10('0x1a')](_0x55ed3c[_0x3d10('0x15')][_0x3d10('0x19')],function(_0x5a3340){return{'model':db[_0x5a3340[_0x3d10('0x1b')]],'as':_0x5a3340['as'],'attributes':_0x5a3340[_0x3d10('0x17')],'include':_0x5a3340[_0x3d10('0x19')]?_['map'](_0x5a3340[_0x3d10('0x19')],function(_0x240cd4){return{'model':db[_0x240cd4['model']],'as':_0x240cd4['as'],'attributes':_0x240cd4[_0x3d10('0x17')],'include':_0x240cd4['include']?_['map'](_0x240cd4[_0x3d10('0x19')],function(_0x4849ec){return{'model':db[_0x4849ec['model']],'as':_0x4849ec['as'],'attributes':_0x4849ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d10('0x9')](function(_0x17797d){logger[_0x3d10('0xa')](_0x3d10('0x12'),_0x55ed3c);logger[_0x3d10('0x1c')](_0x3d10('0x12'),_0x55ed3c,JSON[_0x3d10('0xc')](_0x17797d));_0x55fb87(_0x17797d);})[_0x3d10('0x11')](function(_0xd1e804){logger[_0x3d10('0xd')]('GetTrigger',_0xd1e804[_0x3d10('0xf')],_0x55ed3c);_0xf0853b(_0x23e8f0[_0x3d10('0xd')](0x1f4,_0xd1e804[_0x3d10('0xf')]));});});};exports['ShowTrigger']=function(_0x35b150){var _0x594c7e=this;return new Promise(function(_0x19cfa8,_0x1b2a94){return db[_0x3d10('0x13')][_0x3d10('0x1d')]({'raw':_0x35b150[_0x3d10('0x15')]?_0x35b150[_0x3d10('0x15')][_0x3d10('0x16')]===undefined?!![]:![]:!![],'where':_0x35b150[_0x3d10('0x15')]?_0x35b150['options'][_0x3d10('0x1e')]||null:null,'attributes':_0x35b150['options']?_0x35b150[_0x3d10('0x15')][_0x3d10('0x17')]||null:null,'include':_0x35b150[_0x3d10('0x15')]?_0x35b150[_0x3d10('0x15')][_0x3d10('0x19')]?_[_0x3d10('0x1a')](_0x35b150[_0x3d10('0x15')][_0x3d10('0x19')],function(_0x52f7da){return{'model':db[_0x52f7da[_0x3d10('0x1b')]],'as':_0x52f7da['as'],'attributes':_0x52f7da[_0x3d10('0x17')],'include':_0x52f7da['include']?_[_0x3d10('0x1a')](_0x52f7da[_0x3d10('0x19')],function(_0x56a15c){return{'model':db[_0x56a15c[_0x3d10('0x1b')]],'as':_0x56a15c['as'],'attributes':_0x56a15c[_0x3d10('0x17')],'include':_0x56a15c[_0x3d10('0x19')]?_['map'](_0x56a15c[_0x3d10('0x19')],function(_0x169e0c){return{'model':db[_0x169e0c[_0x3d10('0x1b')]],'as':_0x169e0c['as'],'attributes':_0x169e0c[_0x3d10('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b2eb4){logger[_0x3d10('0xa')](_0x3d10('0x1f'),_0x35b150);logger['debug'](_0x3d10('0x1f'),_0x35b150,JSON[_0x3d10('0xc')](_0x5b2eb4));_0x19cfa8(_0x5b2eb4);})[_0x3d10('0x11')](function(_0x137045){logger[_0x3d10('0xd')]('ShowTrigger',_0x137045[_0x3d10('0xf')],_0x35b150);_0x1b2a94(_0x594c7e[_0x3d10('0xd')](0x1f4,_0x137045[_0x3d10('0xf')]));});});}; \ No newline at end of file +var _0x4d08=['http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','result','catch','Trigger','findAll','options','raw','where','include','map','model','attributes','GetTrigger','stringify','ShowTrigger','find','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0xfdbd37,_0x5f17de){var _0x45a78c=function(_0x3ea4d6){while(--_0x3ea4d6){_0xfdbd37['push'](_0xfdbd37['shift']());}};_0x45a78c(++_0x5f17de);}(_0x4d08,0x119));var _0x84d0=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x4d08[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0x84d0('0x0'));var util=require(_0x84d0('0x1'));var moment=require(_0x84d0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84d0('0x3'));var db=require(_0x84d0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x84d0('0x5'));var config=require(_0x84d0('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x84d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ea90a,_0x4f88db,_0x5e9004){return new BPromise(function(_0x3e61f,_0x4f62b4){return client[_0x84d0('0x8')](_0x1ea90a,_0x5e9004)[_0x84d0('0x9')](function(_0x31b1c9){logger[_0x84d0('0xa')](_0x84d0('0xb'),_0x4f88db,_0x84d0('0xc'));logger[_0x84d0('0xd')](_0x84d0('0xe'),_0x4f88db,_0x84d0('0xc'),JSON['stringify'](_0x31b1c9));if(_0x31b1c9[_0x84d0('0xf')]){if(_0x31b1c9['error']['code']===0x1f4){logger['error'](_0x84d0('0xb'),_0x4f88db,_0x31b1c9[_0x84d0('0xf')]['message']);return _0x4f62b4(_0x31b1c9[_0x84d0('0xf')][_0x84d0('0x10')]);}logger[_0x84d0('0xf')]('Trigger,\x20%s,\x20%s',_0x4f88db,_0x31b1c9['error'][_0x84d0('0x10')]);return _0x3e61f(_0x31b1c9[_0x84d0('0xf')]['message']);}else{logger['info'](_0x84d0('0xb'),_0x4f88db,_0x84d0('0xc'));_0x3e61f(_0x31b1c9[_0x84d0('0x11')][_0x84d0('0x10')]);}})[_0x84d0('0x12')](function(_0x2c2461){logger[_0x84d0('0xf')]('Trigger,\x20%s,\x20%s',_0x4f88db,_0x2c2461);_0x4f62b4(_0x2c2461);});});}exports['GetTrigger']=function(_0x33269a){var _0x3e4706=this;return new Promise(function(_0x45eed3,_0x51ef79){return db[_0x84d0('0x13')][_0x84d0('0x14')]({'raw':_0x33269a[_0x84d0('0x15')]?_0x33269a['options'][_0x84d0('0x16')]===undefined?!![]:![]:!![],'where':_0x33269a['options']?_0x33269a[_0x84d0('0x15')][_0x84d0('0x17')]||null:null,'attributes':_0x33269a[_0x84d0('0x15')]?_0x33269a['options']['attributes']||null:null,'limit':_0x33269a[_0x84d0('0x15')]?_0x33269a[_0x84d0('0x15')]['limit']||null:null,'include':_0x33269a[_0x84d0('0x15')]?_0x33269a[_0x84d0('0x15')][_0x84d0('0x18')]?_[_0x84d0('0x19')](_0x33269a[_0x84d0('0x15')]['include'],function(_0x5cf8b7){return{'model':db[_0x5cf8b7[_0x84d0('0x1a')]],'as':_0x5cf8b7['as'],'attributes':_0x5cf8b7['attributes'],'include':_0x5cf8b7[_0x84d0('0x18')]?_['map'](_0x5cf8b7['include'],function(_0x40fb27){return{'model':db[_0x40fb27[_0x84d0('0x1a')]],'as':_0x40fb27['as'],'attributes':_0x40fb27[_0x84d0('0x1b')],'include':_0x40fb27[_0x84d0('0x18')]?_[_0x84d0('0x19')](_0x40fb27[_0x84d0('0x18')],function(_0xf5122){return{'model':db[_0xf5122[_0x84d0('0x1a')]],'as':_0xf5122['as'],'attributes':_0xf5122[_0x84d0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84d0('0x9')](function(_0x24084d){logger['info']('GetTrigger',_0x33269a);logger[_0x84d0('0xd')](_0x84d0('0x1c'),_0x33269a,JSON[_0x84d0('0x1d')](_0x24084d));_0x45eed3(_0x24084d);})[_0x84d0('0x12')](function(_0x2133f4){logger[_0x84d0('0xf')]('GetTrigger',_0x2133f4[_0x84d0('0x10')],_0x33269a);_0x51ef79(_0x3e4706[_0x84d0('0xf')](0x1f4,_0x2133f4[_0x84d0('0x10')]));});});};exports[_0x84d0('0x1e')]=function(_0x2ac201){var _0xb8486c=this;return new Promise(function(_0x533658,_0x247592){return db[_0x84d0('0x13')][_0x84d0('0x1f')]({'raw':_0x2ac201[_0x84d0('0x15')]?_0x2ac201[_0x84d0('0x15')][_0x84d0('0x16')]===undefined?!![]:![]:!![],'where':_0x2ac201[_0x84d0('0x15')]?_0x2ac201[_0x84d0('0x15')][_0x84d0('0x17')]||null:null,'attributes':_0x2ac201['options']?_0x2ac201['options'][_0x84d0('0x1b')]||null:null,'include':_0x2ac201['options']?_0x2ac201[_0x84d0('0x15')][_0x84d0('0x18')]?_[_0x84d0('0x19')](_0x2ac201[_0x84d0('0x15')][_0x84d0('0x18')],function(_0x2ffb2f){return{'model':db[_0x2ffb2f[_0x84d0('0x1a')]],'as':_0x2ffb2f['as'],'attributes':_0x2ffb2f[_0x84d0('0x1b')],'include':_0x2ffb2f[_0x84d0('0x18')]?_[_0x84d0('0x19')](_0x2ffb2f[_0x84d0('0x18')],function(_0x41e8fa){return{'model':db[_0x41e8fa[_0x84d0('0x1a')]],'as':_0x41e8fa['as'],'attributes':_0x41e8fa[_0x84d0('0x1b')],'include':_0x41e8fa['include']?_[_0x84d0('0x19')](_0x41e8fa['include'],function(_0x87d45){return{'model':db[_0x87d45[_0x84d0('0x1a')]],'as':_0x87d45['as'],'attributes':_0x87d45[_0x84d0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84d0('0x9')](function(_0x3e2192){logger[_0x84d0('0xa')](_0x84d0('0x1e'),_0x2ac201);logger[_0x84d0('0xd')](_0x84d0('0x1e'),_0x2ac201,JSON[_0x84d0('0x1d')](_0x3e2192));_0x533658(_0x3e2192);})[_0x84d0('0x12')](function(_0x283720){logger['error']('ShowTrigger',_0x283720['message'],_0x2ac201);_0x247592(_0xb8486c[_0x84d0('0xf')](0x1f4,_0x283720[_0x84d0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 40ec109..cc12feb 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 _0xc836=['Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','clone','post','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc836,0xb9));var _0x6c83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc836[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6c83('0x0'));var path=require(_0x6c83('0x1'));var timeout=require(_0x6c83('0x2'));var express=require(_0x6c83('0x3'));var router=express[_0x6c83('0x4')]();var fs_extra=require(_0x6c83('0x5'));var auth=require(_0x6c83('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6c83('0x7'));var controller=require(_0x6c83('0x8'));router[_0x6c83('0x9')]('/',auth[_0x6c83('0xa')](),controller[_0x6c83('0xb')]);router[_0x6c83('0x9')](_0x6c83('0xc'),auth[_0x6c83('0xa')](),controller[_0x6c83('0xd')]);router['post']('/:id/clone',auth[_0x6c83('0xa')](),controller[_0x6c83('0xe')]);router[_0x6c83('0xf')]('/',auth[_0x6c83('0xa')](),controller[_0x6c83('0x10')]);router[_0x6c83('0x11')](_0x6c83('0xc'),auth['isAuthenticated'](),controller[_0x6c83('0x12')]);router[_0x6c83('0x13')](_0x6c83('0xc'),auth[_0x6c83('0xa')](),controller['destroy']);module[_0x6c83('0x14')]=router; \ No newline at end of file +var _0x52f6=['put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','show','post'];(function(_0x5bb077,_0x314590){var _0x487afc=function(_0x1293b3){while(--_0x1293b3){_0x5bb077['push'](_0x5bb077['shift']());}};_0x487afc(++_0x314590);}(_0x52f6,0x83));var _0x652f=function(_0x4b6214,_0x59bb66){_0x4b6214=_0x4b6214-0x0;var _0x3cf589=_0x52f6[_0x4b6214];return _0x3cf589;};'use strict';var multer=require(_0x652f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x652f('0x1'));var express=require(_0x652f('0x2'));var router=express[_0x652f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x652f('0x4'));var interaction=require(_0x652f('0x5'));var config=require(_0x652f('0x6'));var controller=require(_0x652f('0x7'));router['get']('/',auth[_0x652f('0x8')](),controller['index']);router[_0x652f('0x9')](_0x652f('0xa'),auth[_0x652f('0x8')](),controller[_0x652f('0xb')]);router[_0x652f('0xc')]('/:id/clone',auth[_0x652f('0x8')](),controller['clone']);router[_0x652f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x652f('0xd')]('/:id',auth[_0x652f('0x8')](),controller[_0x652f('0xe')]);router['delete']('/:id',auth[_0x652f('0x8')](),controller['destroy']);module[_0x652f('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index d772d3c..71bec7d 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 _0x0444=['BOOLEAN','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','info','shortinfo','inband','auto','rfc2833','yes','update','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','INTEGER','accept','uac','uas','certificate','passive','actpass','dynamic','nonat','update,nonat'];(function(_0x372f9e,_0x416f8){var _0x5090ea=function(_0x35f92a){while(--_0x35f92a){_0x372f9e['push'](_0x372f9e['shift']());}};_0x5090ea(++_0x416f8);}(_0x0444,0x8e));var _0x4044=function(_0x2f0fec,_0x4b6b66){_0x2f0fec=_0x2f0fec-0x0;var _0x1a4f56=_0x0444[_0x2f0fec];return _0x1a4f56;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4044('0x0')],'allowNull':![],'unique':_0x4044('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x3'),_0x4044('0x4'),_0x4044('0x5')),'allowNull':![],'defaultValue':_0x4044('0x3')},'context':{'type':Sequelize[_0x4044('0x0')],'allowNull':![],'defaultValue':_0x4044('0x6')},'callingpres':{'type':Sequelize[_0x4044('0x2')]('ALLOWED_NOT_SCREENED',_0x4044('0x7'),'ALLOWED_FAILED_SCREEN',_0x4044('0x8'),_0x4044('0x9'),_0x4044('0xa'),'PROHIB_FAILED_SCREEN',_0x4044('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x4044('0x0')]},'secret':{'type':Sequelize[_0x4044('0x0')]},'md5secret':{'type':Sequelize[_0x4044('0x0')]},'remotesecret':{'type':Sequelize[_0x4044('0x0')]},'transport':{'type':Sequelize[_0x4044('0x0')],'defaultValue':_0x4044('0xc'),'set':function(_0xac6375){this[_0x4044('0xd')]('transport',_0xac6375?_0xac6375['join'](','):null);},'get':function(){return this['getDataValue'](_0x4044('0xe'))?this[_0x4044('0xf')](_0x4044('0xe'))[_0x4044('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x4044('0x11'),_0x4044('0x12'),_0x4044('0x13'),_0x4044('0x14')),'defaultValue':_0x4044('0x15')},'directmedia':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no','nonat',_0x4044('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4044('0x0')]},'directmediadeny':{'type':Sequelize[_0x4044('0x0')]},'nat':{'type':Sequelize[_0x4044('0x0')],'defaultValue':_0x4044('0x18'),'set':function(_0x38da01){this['setDataValue'](_0x4044('0x19'),_0x38da01?_0x38da01[_0x4044('0x1a')](','):null);},'get':function(){return this[_0x4044('0xf')](_0x4044('0x19'))?this[_0x4044('0xf')](_0x4044('0x19'))[_0x4044('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4044('0x0')]},'namedcallgroup':{'type':Sequelize[_0x4044('0x0')]},'pickupgroup':{'type':Sequelize[_0x4044('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x4044('0x0')]},'language':{'type':Sequelize[_0x4044('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4044('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4044('0x0')],'defaultValue':_0x4044('0x1b')},'allow':{'type':Sequelize[_0x4044('0x0')],'allowNull':![],'defaultValue':_0x4044('0x1c'),'set':function(_0x303db2){this[_0x4044('0xd')]('allow',_0x303db2?_0x303db2[_0x4044('0x1a')](';'):_0x4044('0x1c'));},'get':function(){return this[_0x4044('0xf')](_0x4044('0x1d'))?this['getDataValue'](_0x4044('0x1d'))[_0x4044('0x10')](';'):null;},'comment':_0x4044('0x1e')},'autoframing':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'insecure':{'type':Sequelize[_0x4044('0x0')],'defaultValue':_0x4044('0x1f'),'set':function(_0x6bf8b8){this['setDataValue'](_0x4044('0x20'),_0x6bf8b8?_0x6bf8b8[_0x4044('0x1a')](','):null);},'get':function(){return this[_0x4044('0xf')](_0x4044('0x20'))?this[_0x4044('0xf')](_0x4044('0x20'))[_0x4044('0x10')](','):null;},'comment':_0x4044('0x21')},'trustrpid':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4044('0x2')]('yes','no',_0x4044('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4044('0x0')]},'callerid':{'type':Sequelize[_0x4044('0x0')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x4044('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x4044('0x0')]},'template':{'type':Sequelize[_0x4044('0x0')]},'videosupport':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no',_0x4044('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4044('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'mailbox':{'type':Sequelize[_0x4044('0x0')]},'session_timers':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x25'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x4044('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x4044('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x26'),_0x4044('0x27')),'defaultValue':_0x4044('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x4044('0x0')]},'regexten':{'type':Sequelize[_0x4044('0x0')]},'fromdomain':{'type':Sequelize[_0x4044('0x0')]},'fromuser':{'type':Sequelize[_0x4044('0x0')]},'port':{'type':Sequelize[_0x4044('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no'),'defaultValue':_0x4044('0x16')},'keepalive':{'type':Sequelize[_0x4044('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x4044('0x0')]},'defaultuser':{'type':Sequelize[_0x4044('0x0')]},'rtptimeout':{'type':Sequelize[_0x4044('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4044('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4044('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4044('0x0')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4044('0x24')](0xb)},'timerb':{'type':Sequelize[_0x4044('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x4044('0x0')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x4044('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x4044('0x0')]},'use_q850_reason':{'type':Sequelize[_0x4044('0x0')]},'maxforwards':{'type':Sequelize[_0x4044('0x24')](0xb)},'encryption':{'type':Sequelize[_0x4044('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no')},'force_avp':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'icesupport':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no','fingerprint',_0x4044('0x28'))},'dtlsrekey':{'type':Sequelize[_0x4044('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4044('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x4044('0x0')]},'dtlscipher':{'type':Sequelize[_0x4044('0x0')]},'dtlscafile':{'type':Sequelize[_0x4044('0x0')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x4044('0x2')]('active',_0x4044('0x29'),_0x4044('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4044('0x0')]},'usereqphone':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4044('0x0')]},'recordofffeature':{'type':Sequelize[_0x4044('0x0')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x4044('0x2')](_0x4044('0x16'),'no')},'vmexten':{'type':Sequelize[_0x4044('0x0')]},'mohinterpret':{'type':Sequelize[_0x4044('0x0')]},'mohsuggest':{'type':Sequelize[_0x4044('0x0')]},'parkinglot':{'type':Sequelize[_0x4044('0x0')]},'description':{'type':Sequelize[_0x4044('0x0')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x4044('0x2b')},'canreinvite':{'type':Sequelize['ENUM'](_0x4044('0x16'),'no',_0x4044('0x2c'),_0x4044('0x17'),_0x4044('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4044('0x0')]},'otherFields':{'type':Sequelize[_0x4044('0x0')]},'active':{'type':Sequelize[_0x4044('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4044('0x0')],'defaultValue':'no'}}; \ No newline at end of file +var _0x75b4=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x75b4,0x1cf));var _0x475b=function(_0x185ae2,_0x44ee9d){_0x185ae2=_0x185ae2-0x0;var _0x4beb86=_0x75b4[_0x185ae2];return _0x4beb86;};'use strict';var Sequelize=require(_0x475b('0x0'));module[_0x475b('0x1')]={'name':{'type':Sequelize[_0x475b('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x475b('0x3')]('friend',_0x475b('0x4'),_0x475b('0x5')),'allowNull':![],'defaultValue':_0x475b('0x6')},'context':{'type':Sequelize[_0x475b('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x7'),_0x475b('0x8'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x475b('0x9'),_0x475b('0xa'),_0x475b('0xb'))},'deny':{'type':Sequelize[_0x475b('0x2')]},'permit':{'type':Sequelize[_0x475b('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x475b('0x2')],'defaultValue':'udp','set':function(_0x58676e){this['setDataValue'](_0x475b('0xc'),_0x58676e?_0x58676e[_0x475b('0xd')](','):null);},'get':function(){return this[_0x475b('0xe')](_0x475b('0xc'))?this[_0x475b('0xe')](_0x475b('0xc'))[_0x475b('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x10'),'info',_0x475b('0x11'),'inband',_0x475b('0x12')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no',_0x475b('0x14'),_0x475b('0x15'),_0x475b('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x475b('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x475b('0x2')]},'directmediadeny':{'type':Sequelize[_0x475b('0x2')]},'nat':{'type':Sequelize[_0x475b('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x14ff50){this['setDataValue']('nat',_0x14ff50?_0x14ff50['join'](','):null);},'get':function(){return this[_0x475b('0xe')](_0x475b('0x17'))?this['getDataValue'](_0x475b('0x17'))['split'](','):null;},'comment':_0x475b('0x18')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x475b('0x2')]},'pickupgroup':{'type':Sequelize[_0x475b('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x475b('0x2')]},'language':{'type':Sequelize[_0x475b('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x475b('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x475b('0x2')],'defaultValue':_0x475b('0x19')},'allow':{'type':Sequelize[_0x475b('0x2')],'allowNull':![],'defaultValue':_0x475b('0x1a'),'set':function(_0x247306){this['setDataValue'](_0x475b('0x1b'),_0x247306?_0x247306['join'](';'):_0x475b('0x1a'));},'get':function(){return this['getDataValue'](_0x475b('0x1b'))?this['getDataValue'](_0x475b('0x1b'))['split'](';'):null;},'comment':_0x475b('0x1c')},'autoframing':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x475b('0x1d'),'set':function(_0xc82584){this['setDataValue'](_0x475b('0x1e'),_0xc82584?_0xc82584['join'](','):null);},'get':function(){return this[_0x475b('0xe')](_0x475b('0x1e'))?this[_0x475b('0xe')]('insecure')['split'](','):null;},'comment':_0x475b('0x1f')},'trustrpid':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no',_0x475b('0x20'))},'promiscredir':{'type':Sequelize[_0x475b('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'accountcode':{'type':Sequelize[_0x475b('0x21')](0xb)},'setvar':{'type':Sequelize[_0x475b('0x2')]},'callerid':{'type':Sequelize[_0x475b('0x2')],'defaultValue':_0x475b('0x22')},'amaflags':{'type':Sequelize[_0x475b('0x2')]},'callcounter':{'type':Sequelize[_0x475b('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x475b('0x13'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x475b('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x475b('0x2')]},'videosupport':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no',_0x475b('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x475b('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x475b('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x475b('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x475b('0x24'),_0x475b('0x25'),_0x475b('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x475b('0x21')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'defaultValue':_0x475b('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x475b('0x2')]},'regexten':{'type':Sequelize[_0x475b('0x2')]},'fromdomain':{'type':Sequelize[_0x475b('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x475b('0x21')](0x5)},'qualify':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no'),'defaultValue':_0x475b('0x13')},'keepalive':{'type':Sequelize[_0x475b('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x475b('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x475b('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x475b('0x3')]('yes','no',_0x475b('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x475b('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x475b('0x21')](0xb)},'timerb':{'type':Sequelize[_0x475b('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x475b('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x475b('0x2')]},'contactdeny':{'type':Sequelize[_0x475b('0x2')]},'contactacl':{'type':Sequelize[_0x475b('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x475b('0x2')]},'maxforwards':{'type':Sequelize[_0x475b('0x21')](0xb)},'encryption':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'force_avp':{'type':Sequelize[_0x475b('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no',_0x475b('0x29'),_0x475b('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x475b('0x21')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x475b('0x2')]},'dtlscipher':{'type':Sequelize[_0x475b('0x2')]},'dtlscafile':{'type':Sequelize[_0x475b('0x2')]},'dtlscapath':{'type':Sequelize[_0x475b('0x2')]},'dtlssetup':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x2b'),_0x475b('0x2c'),_0x475b('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x475b('0x2')]},'usereqphone':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x475b('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x475b('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x475b('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x475b('0x3')](_0x475b('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x475b('0x2')]},'mohsuggest':{'type':Sequelize[_0x475b('0x2')]},'parkinglot':{'type':Sequelize[_0x475b('0x2')]},'description':{'type':Sequelize[_0x475b('0x2')]},'host':{'type':Sequelize[_0x475b('0x2')],'defaultValue':_0x475b('0x2e')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x475b('0x14'),_0x475b('0x15'),_0x475b('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x475b('0x2')]},'otherFields':{'type':Sequelize[_0x475b('0x2')]},'active':{'type':Sequelize[_0x475b('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x475b('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 d9601e1..d7fba7e 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 _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5c5590,_0x29d800){var _0x110470=function(_0x3bbd06){while(--_0x3bbd06){_0x5c5590['push'](_0x5c5590['shift']());}};_0x110470(++_0x29d800);}(_0x24ca,0x1bc));var _0xa24c=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x24ca[_0x136a0d];return _0x212ea5;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3b2b55,_0x31c65d){_0x3b2b55=_0x3b2b55-0x0;var _0x172194=_0xe5b3[_0x3b2b55];return _0x172194;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 944227c..572fe3b 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 _0x9e5e=['bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','../../config/logger','moment'];(function(_0x419ffd,_0x10bdfe){var _0xb0b19d=function(_0x335815){while(--_0x335815){_0x419ffd['push'](_0x419ffd['shift']());}};_0xb0b19d(++_0x10bdfe);}(_0x9e5e,0x69));var _0xe9e5=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x9e5e[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0xe9e5('0x0'));var util=require('util');var logger=require(_0xe9e5('0x1'))('api');var moment=require(_0xe9e5('0x2'));var BPromise=require(_0xe9e5('0x3'));var rp=require(_0xe9e5('0x4'));var fs=require('fs');var path=require(_0xe9e5('0x5'));var rimraf=require(_0xe9e5('0x6'));var config=require(_0xe9e5('0x7'));var attributes=require(_0xe9e5('0x8'));module['exports']=function(_0x183f03,_0x10da49){return _0x183f03[_0xe9e5('0x9')](_0xe9e5('0xa'),attributes,{'tableName':_0xe9e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea5c=['path','rimraf','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x2a6def,_0x47772f){var _0x3bcc53=function(_0x108a8e){while(--_0x108a8e){_0x2a6def['push'](_0x2a6def['shift']());}};_0x3bcc53(++_0x47772f);}(_0xea5c,0x8a));var _0xcea5=function(_0x45497a,_0x513ab9){_0x45497a=_0x45497a-0x0;var _0x2637da=_0xea5c[_0x45497a];return _0x2637da;};'use strict';var _=require(_0xcea5('0x0'));var util=require('util');var logger=require(_0xcea5('0x1'))(_0xcea5('0x2'));var moment=require('moment');var BPromise=require(_0xcea5('0x3'));var rp=require(_0xcea5('0x4'));var fs=require('fs');var path=require(_0xcea5('0x5'));var rimraf=require(_0xcea5('0x6'));var config=require('../../config/environment');var attributes=require(_0xcea5('0x7'));module[_0xcea5('0x8')]=function(_0x3a6466,_0x13d486){return _0x3a6466['define'](_0xcea5('0x9'),attributes,{'tableName':_0xcea5('0xa'),'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 dbc3a63..2d6c581 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 _0x9d9e=['GetTrunk','options','raw','where','attributes','limit','include','map','model','debug','ShowTrunk','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x395c24,_0x48d2cb){var _0x1d708b=function(_0x517a7b){while(--_0x517a7b){_0x395c24['push'](_0x395c24['shift']());}};_0x1d708b(++_0x48d2cb);}(_0x9d9e,0xd2));var _0xe9d9=function(_0x166294,_0x175bc9){_0x166294=_0x166294-0x0;var _0x304968=_0x9d9e[_0x166294];return _0x304968;};'use strict';var _=require(_0xe9d9('0x0'));var util=require(_0xe9d9('0x1'));var moment=require(_0xe9d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9d9('0x3'));var fs=require('fs');var Redis=require(_0xe9d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9d9('0x5'));var logger=require(_0xe9d9('0x6'))(_0xe9d9('0x7'));var config=require(_0xe9d9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe9d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56e501,_0x117834,_0x751ef7){return new BPromise(function(_0x246a97,_0x5c58a3){return client[_0xe9d9('0xa')](_0x56e501,_0x751ef7)[_0xe9d9('0xb')](function(_0x34fa77){logger[_0xe9d9('0xc')](_0xe9d9('0xd'),_0x117834,_0xe9d9('0xe'));logger['debug'](_0xe9d9('0xf'),_0x117834,_0xe9d9('0xe'),JSON[_0xe9d9('0x10')](_0x34fa77));if(_0x34fa77['error']){if(_0x34fa77[_0xe9d9('0x11')]['code']===0x1f4){logger[_0xe9d9('0x11')](_0xe9d9('0xd'),_0x117834,_0x34fa77[_0xe9d9('0x11')][_0xe9d9('0x12')]);return _0x5c58a3(_0x34fa77[_0xe9d9('0x11')]['message']);}logger[_0xe9d9('0x11')](_0xe9d9('0xd'),_0x117834,_0x34fa77[_0xe9d9('0x11')][_0xe9d9('0x12')]);return _0x246a97(_0x34fa77['error'][_0xe9d9('0x12')]);}else{logger[_0xe9d9('0xc')](_0xe9d9('0xd'),_0x117834,_0xe9d9('0xe'));_0x246a97(_0x34fa77[_0xe9d9('0x13')][_0xe9d9('0x12')]);}})[_0xe9d9('0x14')](function(_0x3dbacb){logger[_0xe9d9('0x11')](_0xe9d9('0xd'),_0x117834,_0x3dbacb);_0x5c58a3(_0x3dbacb);});});}exports[_0xe9d9('0x15')]=function(_0xcf741e){var _0x3e5b49=this;return new Promise(function(_0x52fa29,_0x3557ab){return db['Trunk']['findAll']({'raw':_0xcf741e[_0xe9d9('0x16')]?_0xcf741e['options'][_0xe9d9('0x17')]===undefined?!![]:![]:!![],'where':_0xcf741e[_0xe9d9('0x16')]?_0xcf741e['options'][_0xe9d9('0x18')]||null:null,'attributes':_0xcf741e['options']?_0xcf741e['options'][_0xe9d9('0x19')]||null:null,'limit':_0xcf741e[_0xe9d9('0x16')]?_0xcf741e[_0xe9d9('0x16')][_0xe9d9('0x1a')]||null:null,'include':_0xcf741e[_0xe9d9('0x16')]?_0xcf741e[_0xe9d9('0x16')][_0xe9d9('0x1b')]?_[_0xe9d9('0x1c')](_0xcf741e[_0xe9d9('0x16')][_0xe9d9('0x1b')],function(_0xa4c3ca){return{'model':db[_0xa4c3ca['model']],'as':_0xa4c3ca['as'],'attributes':_0xa4c3ca['attributes'],'include':_0xa4c3ca[_0xe9d9('0x1b')]?_[_0xe9d9('0x1c')](_0xa4c3ca[_0xe9d9('0x1b')],function(_0x477428){return{'model':db[_0x477428[_0xe9d9('0x1d')]],'as':_0x477428['as'],'attributes':_0x477428[_0xe9d9('0x19')],'include':_0x477428[_0xe9d9('0x1b')]?_[_0xe9d9('0x1c')](_0x477428[_0xe9d9('0x1b')],function(_0x2f1a4c){return{'model':db[_0x2f1a4c[_0xe9d9('0x1d')]],'as':_0x2f1a4c['as'],'attributes':_0x2f1a4c[_0xe9d9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe9d9('0xb')](function(_0x12456e){logger['info']('GetTrunk',_0xcf741e);logger[_0xe9d9('0x1e')](_0xe9d9('0x15'),_0xcf741e,JSON[_0xe9d9('0x10')](_0x12456e));_0x52fa29(_0x12456e);})['catch'](function(_0x4f0e94){logger[_0xe9d9('0x11')](_0xe9d9('0x15'),_0x4f0e94[_0xe9d9('0x12')],_0xcf741e);_0x3557ab(_0x3e5b49[_0xe9d9('0x11')](0x1f4,_0x4f0e94[_0xe9d9('0x12')]));});});};exports[_0xe9d9('0x1f')]=function(_0x1e6dae){var _0x5d90dc=this;return new Promise(function(_0x1c0355,_0x50f7ae){return db['Trunk'][_0xe9d9('0x20')]({'raw':_0x1e6dae['options']?_0x1e6dae[_0xe9d9('0x16')][_0xe9d9('0x17')]===undefined?!![]:![]:!![],'where':_0x1e6dae[_0xe9d9('0x16')]?_0x1e6dae[_0xe9d9('0x16')][_0xe9d9('0x18')]||null:null,'attributes':_0x1e6dae['options']?_0x1e6dae[_0xe9d9('0x16')][_0xe9d9('0x19')]||null:null,'include':_0x1e6dae[_0xe9d9('0x16')]?_0x1e6dae[_0xe9d9('0x16')][_0xe9d9('0x1b')]?_['map'](_0x1e6dae[_0xe9d9('0x16')]['include'],function(_0x5da120){return{'model':db[_0x5da120[_0xe9d9('0x1d')]],'as':_0x5da120['as'],'attributes':_0x5da120['attributes'],'include':_0x5da120[_0xe9d9('0x1b')]?_[_0xe9d9('0x1c')](_0x5da120[_0xe9d9('0x1b')],function(_0x2db738){return{'model':db[_0x2db738[_0xe9d9('0x1d')]],'as':_0x2db738['as'],'attributes':_0x2db738[_0xe9d9('0x19')],'include':_0x2db738[_0xe9d9('0x1b')]?_[_0xe9d9('0x1c')](_0x2db738[_0xe9d9('0x1b')],function(_0x529596){return{'model':db[_0x529596[_0xe9d9('0x1d')]],'as':_0x529596['as'],'attributes':_0x529596[_0xe9d9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe9d9('0xb')](function(_0x2adcf3){logger[_0xe9d9('0xc')](_0xe9d9('0x1f'),_0x1e6dae);logger['debug'](_0xe9d9('0x1f'),_0x1e6dae,JSON[_0xe9d9('0x10')](_0x2adcf3));_0x1c0355(_0x2adcf3);})[_0xe9d9('0x14')](function(_0x186264){logger[_0xe9d9('0x11')](_0xe9d9('0x1f'),_0x186264[_0xe9d9('0x12')],_0x1e6dae);_0x50f7ae(_0x5d90dc[_0xe9d9('0x11')](0x1f4,_0x186264[_0xe9d9('0x12')]));});});}; \ No newline at end of file +var _0x45ac=['result','catch','GetTrunk','Trunk','options','where','attributes','include','map','model','debug','ShowTrunk','find','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s'];(function(_0x250b5f,_0x45290b){var _0x5375ff=function(_0x296de4){while(--_0x296de4){_0x250b5f['push'](_0x250b5f['shift']());}};_0x5375ff(++_0x45290b);}(_0x45ac,0xf3));var _0xc45a=function(_0x585f40,_0x4a3091){_0x585f40=_0x585f40-0x0;var _0x44fc86=_0x45ac[_0x585f40];return _0x44fc86;};'use strict';var _=require(_0xc45a('0x0'));var util=require(_0xc45a('0x1'));var moment=require(_0xc45a('0x2'));var BPromise=require(_0xc45a('0x3'));var rs=require(_0xc45a('0x4'));var fs=require('fs');var Redis=require(_0xc45a('0x5'));var db=require(_0xc45a('0x6'))['db'];var utils=require(_0xc45a('0x7'));var logger=require(_0xc45a('0x8'))(_0xc45a('0x9'));var config=require(_0xc45a('0xa'));var jayson=require(_0xc45a('0xb'));var client=jayson[_0xc45a('0xc')][_0xc45a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x352d17,_0x58402d,_0x56fdf2){return new BPromise(function(_0x35c431,_0x43e510){return client[_0xc45a('0xe')](_0x352d17,_0x56fdf2)[_0xc45a('0xf')](function(_0x3d2e30){logger[_0xc45a('0x10')]('Trunk,\x20%s,\x20%s',_0x58402d,_0xc45a('0x11'));logger['debug'](_0xc45a('0x12'),_0x58402d,'request\x20sent',JSON['stringify'](_0x3d2e30));if(_0x3d2e30[_0xc45a('0x13')]){if(_0x3d2e30[_0xc45a('0x13')][_0xc45a('0x14')]===0x1f4){logger[_0xc45a('0x13')]('Trunk,\x20%s,\x20%s',_0x58402d,_0x3d2e30[_0xc45a('0x13')][_0xc45a('0x15')]);return _0x43e510(_0x3d2e30[_0xc45a('0x13')][_0xc45a('0x15')]);}logger[_0xc45a('0x13')]('Trunk,\x20%s,\x20%s',_0x58402d,_0x3d2e30[_0xc45a('0x13')][_0xc45a('0x15')]);return _0x35c431(_0x3d2e30['error'][_0xc45a('0x15')]);}else{logger[_0xc45a('0x10')](_0xc45a('0x16'),_0x58402d,_0xc45a('0x11'));_0x35c431(_0x3d2e30[_0xc45a('0x17')][_0xc45a('0x15')]);}})[_0xc45a('0x18')](function(_0x518ba7){logger[_0xc45a('0x13')](_0xc45a('0x16'),_0x58402d,_0x518ba7);_0x43e510(_0x518ba7);});});}exports[_0xc45a('0x19')]=function(_0x679ac3){var _0x2402ec=this;return new Promise(function(_0x7dbb57,_0x419b3c){return db[_0xc45a('0x1a')]['findAll']({'raw':_0x679ac3[_0xc45a('0x1b')]?_0x679ac3[_0xc45a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x679ac3[_0xc45a('0x1b')]?_0x679ac3[_0xc45a('0x1b')][_0xc45a('0x1c')]||null:null,'attributes':_0x679ac3['options']?_0x679ac3['options'][_0xc45a('0x1d')]||null:null,'limit':_0x679ac3['options']?_0x679ac3[_0xc45a('0x1b')]['limit']||null:null,'include':_0x679ac3['options']?_0x679ac3['options'][_0xc45a('0x1e')]?_[_0xc45a('0x1f')](_0x679ac3['options']['include'],function(_0x55956b){return{'model':db[_0x55956b[_0xc45a('0x20')]],'as':_0x55956b['as'],'attributes':_0x55956b['attributes'],'include':_0x55956b[_0xc45a('0x1e')]?_[_0xc45a('0x1f')](_0x55956b[_0xc45a('0x1e')],function(_0x3cbb0c){return{'model':db[_0x3cbb0c[_0xc45a('0x20')]],'as':_0x3cbb0c['as'],'attributes':_0x3cbb0c[_0xc45a('0x1d')],'include':_0x3cbb0c[_0xc45a('0x1e')]?_[_0xc45a('0x1f')](_0x3cbb0c['include'],function(_0x1195cd){return{'model':db[_0x1195cd[_0xc45a('0x20')]],'as':_0x1195cd['as'],'attributes':_0x1195cd[_0xc45a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x283d1b){logger['info']('GetTrunk',_0x679ac3);logger[_0xc45a('0x21')](_0xc45a('0x19'),_0x679ac3,JSON['stringify'](_0x283d1b));_0x7dbb57(_0x283d1b);})['catch'](function(_0xd3aa12){logger['error'](_0xc45a('0x19'),_0xd3aa12[_0xc45a('0x15')],_0x679ac3);_0x419b3c(_0x2402ec[_0xc45a('0x13')](0x1f4,_0xd3aa12[_0xc45a('0x15')]));});});};exports[_0xc45a('0x22')]=function(_0x592aa9){var _0x511f66=this;return new Promise(function(_0x53c86d,_0x3d0415){return db[_0xc45a('0x1a')][_0xc45a('0x23')]({'raw':_0x592aa9['options']?_0x592aa9['options'][_0xc45a('0x24')]===undefined?!![]:![]:!![],'where':_0x592aa9[_0xc45a('0x1b')]?_0x592aa9[_0xc45a('0x1b')][_0xc45a('0x1c')]||null:null,'attributes':_0x592aa9[_0xc45a('0x1b')]?_0x592aa9[_0xc45a('0x1b')][_0xc45a('0x1d')]||null:null,'include':_0x592aa9[_0xc45a('0x1b')]?_0x592aa9[_0xc45a('0x1b')]['include']?_[_0xc45a('0x1f')](_0x592aa9[_0xc45a('0x1b')][_0xc45a('0x1e')],function(_0x199a3c){return{'model':db[_0x199a3c[_0xc45a('0x20')]],'as':_0x199a3c['as'],'attributes':_0x199a3c[_0xc45a('0x1d')],'include':_0x199a3c[_0xc45a('0x1e')]?_['map'](_0x199a3c['include'],function(_0x5a85f2){return{'model':db[_0x5a85f2[_0xc45a('0x20')]],'as':_0x5a85f2['as'],'attributes':_0x5a85f2[_0xc45a('0x1d')],'include':_0x5a85f2[_0xc45a('0x1e')]?_[_0xc45a('0x1f')](_0x5a85f2[_0xc45a('0x1e')],function(_0x461765){return{'model':db[_0x461765['model']],'as':_0x461765['as'],'attributes':_0x461765[_0xc45a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f747a){logger['info'](_0xc45a('0x22'),_0x592aa9);logger[_0xc45a('0x21')](_0xc45a('0x22'),_0x592aa9,JSON[_0xc45a('0x25')](_0x4f747a));_0x53c86d(_0x4f747a);})[_0xc45a('0x18')](function(_0x5b4eb7){logger[_0xc45a('0x13')]('ShowTrunk',_0x5b4eb7['message'],_0x592aa9);_0x3d0415(_0x511f66['error'](0x1f4,_0x5b4eb7[_0xc45a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 088eda9..c00b50a 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 _0xe052=['removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getQueues','/:id/queues_rt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','/:id/login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/mail_interactions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id/password','changePassword','delete','/:id/queues','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions'];(function(_0x576023,_0xc9c1c7){var _0x33dcd5=function(_0x311df0){while(--_0x311df0){_0x576023['push'](_0x576023['shift']());}};_0x33dcd5(++_0xc9c1c7);}(_0xe052,0xf1));var _0x2e05=function(_0x20ab6d,_0x1bfbc1){_0x20ab6d=_0x20ab6d-0x0;var _0x4ab9d7=_0xe052[_0x20ab6d];return _0x4ab9d7;};'use strict';var multer=require(_0x2e05('0x0'));var util=require(_0x2e05('0x1'));var path=require(_0x2e05('0x2'));var timeout=require(_0x2e05('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2e05('0x4'));var auth=require(_0x2e05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2e05('0x6'));var controller=require(_0x2e05('0x7'));router[_0x2e05('0x8')]('/',auth[_0x2e05('0x9')](),controller[_0x2e05('0xa')]);router[_0x2e05('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2e05('0xb')]);router['get'](_0x2e05('0xc'),auth[_0x2e05('0x9')](),controller[_0x2e05('0xd')]);router['get'](_0x2e05('0xe'),auth['isAuthenticated'](),controller[_0x2e05('0xf')]);router[_0x2e05('0x8')](_0x2e05('0x10'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x11')]);router[_0x2e05('0x8')](_0x2e05('0x12'),controller[_0x2e05('0x13')]);router[_0x2e05('0x8')]('/:id/open_tabs',auth[_0x2e05('0x9')](),controller['getOpenTabs']);router[_0x2e05('0x8')](_0x2e05('0x14'),auth[_0x2e05('0x9')](),controller['getContacts']);router[_0x2e05('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x2e05('0x15')]);router[_0x2e05('0x8')](_0x2e05('0x16'),auth[_0x2e05('0x9')](),controller['getVoiceQueuesRt']);router[_0x2e05('0x8')]('/:id/groups',auth[_0x2e05('0x9')](),controller[_0x2e05('0x17')]);router[_0x2e05('0x8')]('/:id/recordings',auth[_0x2e05('0x9')](),controller[_0x2e05('0x18')]);router[_0x2e05('0x8')](_0x2e05('0x19'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x1a')]);router[_0x2e05('0x8')](_0x2e05('0x1b'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x1c')]);router[_0x2e05('0x8')](_0x2e05('0x1d'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x1e')]);router[_0x2e05('0x8')](_0x2e05('0x1f'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x20')]);router[_0x2e05('0x8')]('/:id/sms/interactions',auth[_0x2e05('0x9')](),controller['getSmsInteractions']);router[_0x2e05('0x8')](_0x2e05('0x21'),auth[_0x2e05('0x9')](),controller['getFaxInteractions']);router['get'](_0x2e05('0x22'),auth[_0x2e05('0x9')](),controller['getWhatsappInteractions']);router[_0x2e05('0x8')](_0x2e05('0x23'),auth['isAuthenticated'](),controller[_0x2e05('0x24')]);router[_0x2e05('0x8')]('/:id/lists',auth[_0x2e05('0x9')](),controller[_0x2e05('0x25')]);router[_0x2e05('0x8')](_0x2e05('0x26'),auth['isAuthenticated'](),controller[_0x2e05('0x27')]);router[_0x2e05('0x8')](_0x2e05('0x28'),auth[_0x2e05('0x9')](),controller['getVoicePrefixes']);router[_0x2e05('0x8')]('/:id/fax_accounts',auth[_0x2e05('0x9')](),controller[_0x2e05('0x29')]);router[_0x2e05('0x8')](_0x2e05('0x2a'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x2b')]);router[_0x2e05('0x8')](_0x2e05('0x2c'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x2d')]);router[_0x2e05('0x8')](_0x2e05('0x2e'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x2f')]);router[_0x2e05('0x8')](_0x2e05('0x30'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x31')]);router[_0x2e05('0x8')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x2e05('0x32')]);router[_0x2e05('0x8')](_0x2e05('0x33'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x34')]);router[_0x2e05('0x8')](_0x2e05('0x35'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x2e05('0x8')]('/:id/api_key',auth[_0x2e05('0x9')](),controller[_0x2e05('0x36')]);router[_0x2e05('0x37')](_0x2e05('0x14'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x38')]);router['post']('/',auth[_0x2e05('0x9')](),controller[_0x2e05('0x39')]);router[_0x2e05('0x37')](_0x2e05('0x3a'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x2e05('0x37')]('/:id/queues',auth['isAuthenticated'](),controller[_0x2e05('0x3b')]);var upload=multer({'storage':multer[_0x2e05('0x3c')]({'destination':function(_0x2a9f76,_0x2bc122,_0x37f011){_0x37f011(null,path[_0x2e05('0x3d')](config[_0x2e05('0x3e')],_0x2e05('0x3f')));},'filename':function(_0x2c5bc6,_0x4dd1b0,_0x58b032){_0x58b032(null,util[_0x2e05('0x40')](_0x2e05('0x41'),Date[_0x2e05('0x42')](),_0x4dd1b0['originalname']));}})});router['post'](_0x2e05('0x12'),upload[_0x2e05('0x43')](_0x2e05('0x44')),controller['addAvatar']);router[_0x2e05('0x37')](_0x2e05('0x45'),auth[_0x2e05('0x9')](),controller['login']);router['post'](_0x2e05('0x46'),auth[_0x2e05('0x9')](),controller['logout']);router[_0x2e05('0x37')](_0x2e05('0x47'),auth['isAuthenticated'](),controller[_0x2e05('0x48')]);router[_0x2e05('0x37')](_0x2e05('0x49'),auth['isAuthenticated'](),controller[_0x2e05('0x4a')]);router['post']('/:id/teams',auth[_0x2e05('0x9')](),controller[_0x2e05('0x4b')]);router[_0x2e05('0x37')]('/:id/chat_interactions',auth[_0x2e05('0x9')](),controller['addChatInteractions']);router[_0x2e05('0x37')](_0x2e05('0x4c'),auth[_0x2e05('0x9')](),controller['addMailInteractions']);router['post'](_0x2e05('0x4d'),auth[_0x2e05('0x9')](),controller['addFaxInteractions']);router[_0x2e05('0x37')]('/:id/sms_interactions',auth[_0x2e05('0x9')](),controller[_0x2e05('0x4e')]);router[_0x2e05('0x37')](_0x2e05('0x4f'),auth['isAuthenticated'](),controller[_0x2e05('0x50')]);router['post'](_0x2e05('0x51'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x52')]);router[_0x2e05('0x37')]('/:id/fax_accounts',auth[_0x2e05('0x9')](),controller[_0x2e05('0x53')]);router[_0x2e05('0x37')]('/:id/mail_accounts',auth[_0x2e05('0x9')](),controller[_0x2e05('0x54')]);router['post'](_0x2e05('0x2c'),auth[_0x2e05('0x9')](),controller['addOpenchannelAccounts']);router['post'](_0x2e05('0x2e'),auth['isAuthenticated'](),controller[_0x2e05('0x55')]);router[_0x2e05('0x37')](_0x2e05('0x30'),auth['isAuthenticated'](),controller[_0x2e05('0x56')]);router[_0x2e05('0x37')]('/:id/whatsapp_accounts',auth[_0x2e05('0x9')](),controller[_0x2e05('0x57')]);router[_0x2e05('0x37')](_0x2e05('0x33'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x58')]);router[_0x2e05('0x37')](_0x2e05('0x59'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x5a')]);router[_0x2e05('0x5b')]('/:id',auth[_0x2e05('0x9')](),controller['update']);router[_0x2e05('0x5b')](_0x2e05('0x5c'),auth['isAuthenticated'](),controller[_0x2e05('0x5d')]);router[_0x2e05('0x5e')](_0x2e05('0x5f'),auth['isAuthenticated'](),controller[_0x2e05('0x60')]);router['delete']('/:id/teams',auth[_0x2e05('0x9')](),controller['removeTeams']);router['delete'](_0x2e05('0x10'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x61')]);router[_0x2e05('0x5e')](_0x2e05('0x62'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x63')]);router[_0x2e05('0x5e')](_0x2e05('0x4c'),auth['isAuthenticated'](),controller[_0x2e05('0x64')]);router[_0x2e05('0x5e')](_0x2e05('0x4d'),auth[_0x2e05('0x9')](),controller['removeFaxInteractions']);router['delete'](_0x2e05('0x65'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x66')]);router['delete'](_0x2e05('0x4f'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x67')]);router[_0x2e05('0x5e')](_0x2e05('0x51'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x68')]);router['delete'](_0x2e05('0x69'),auth['isAuthenticated'](),controller[_0x2e05('0x6a')]);router[_0x2e05('0x5e')](_0x2e05('0x2a'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x6b')]);router[_0x2e05('0x5e')](_0x2e05('0x2c'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x6c')]);router[_0x2e05('0x5e')]('/:id/sms_accounts',auth[_0x2e05('0x9')](),controller[_0x2e05('0x6d')]);router[_0x2e05('0x5e')](_0x2e05('0x30'),auth['isAuthenticated'](),controller[_0x2e05('0x6e')]);router[_0x2e05('0x5e')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x2e05('0x6f')]);router[_0x2e05('0x5e')](_0x2e05('0x33'),auth['isAuthenticated'](),controller[_0x2e05('0x70')]);router['delete'](_0x2e05('0x59'),auth[_0x2e05('0x9')](),controller[_0x2e05('0x71')]);module[_0x2e05('0x72')]=router; \ No newline at end of file +var _0xc423=['addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','/:id/api_key','createApiKey','put','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','join','server/files/images/','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','/:id/teams','addTeams','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions'];(function(_0x32bd47,_0x574b54){var _0x16cef6=function(_0x24ca87){while(--_0x24ca87){_0x32bd47['push'](_0x32bd47['shift']());}};_0x16cef6(++_0x574b54);}(_0xc423,0x10c));var _0x3c42=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc423[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x3c42('0x0'));var util=require(_0x3c42('0x1'));var path=require('path');var timeout=require(_0x3c42('0x2'));var express=require('express');var router=express[_0x3c42('0x3')]();var fs_extra=require(_0x3c42('0x4'));var auth=require(_0x3c42('0x5'));var interaction=require(_0x3c42('0x6'));var config=require(_0x3c42('0x7'));var controller=require(_0x3c42('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3c42('0x9')](_0x3c42('0xa'),auth[_0x3c42('0xb')](),controller[_0x3c42('0xc')]);router[_0x3c42('0x9')](_0x3c42('0xd'),auth[_0x3c42('0xb')](),controller['whoami']);router[_0x3c42('0x9')](_0x3c42('0xe'),auth[_0x3c42('0xb')](),controller[_0x3c42('0xf')]);router[_0x3c42('0x9')](_0x3c42('0x10'),auth['isAuthenticated'](),controller[_0x3c42('0x11')]);router['get'](_0x3c42('0x12'),controller[_0x3c42('0x13')]);router[_0x3c42('0x9')](_0x3c42('0x14'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x15')]);router[_0x3c42('0x9')](_0x3c42('0x16'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x17')]);router[_0x3c42('0x9')](_0x3c42('0x18'),auth['isAuthenticated'](),controller['getQueues']);router[_0x3c42('0x9')](_0x3c42('0x19'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x1a')]);router[_0x3c42('0x9')](_0x3c42('0x1b'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x1c')]);router['get']('/:id/recordings',auth[_0x3c42('0xb')](),controller[_0x3c42('0x1d')]);router['get'](_0x3c42('0x1e'),auth['isAuthenticated'](),controller[_0x3c42('0x1f')]);router[_0x3c42('0x9')](_0x3c42('0x20'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x21')]);router[_0x3c42('0x9')](_0x3c42('0x22'),auth['isAuthenticated'](),controller[_0x3c42('0x23')]);router['get'](_0x3c42('0x24'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x25')]);router['get'](_0x3c42('0x26'),auth[_0x3c42('0xb')](),controller['getSmsInteractions']);router['get'](_0x3c42('0x27'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x28')]);router[_0x3c42('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x3c42('0x29')]);router['get']('/:id/teams',auth[_0x3c42('0xb')](),controller[_0x3c42('0x2a')]);router[_0x3c42('0x9')](_0x3c42('0x2b'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x2c')]);router[_0x3c42('0x9')](_0x3c42('0x2d'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x2e')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x3c42('0x2f')]);router[_0x3c42('0x9')](_0x3c42('0x30'),auth['isAuthenticated'](),controller[_0x3c42('0x31')]);router[_0x3c42('0x9')](_0x3c42('0x32'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x33')]);router[_0x3c42('0x9')](_0x3c42('0x34'),auth['isAuthenticated'](),controller[_0x3c42('0x35')]);router[_0x3c42('0x9')](_0x3c42('0x36'),auth['isAuthenticated'](),controller[_0x3c42('0x37')]);router['get'](_0x3c42('0x38'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x39')]);router[_0x3c42('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x3c42('0x3a')]);router[_0x3c42('0x9')]('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x3c42('0x9')](_0x3c42('0x3b'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x3c42('0x9')]('/:id/api_key',auth[_0x3c42('0xb')](),controller[_0x3c42('0x3c')]);router[_0x3c42('0x3d')]('/:id/contacts',auth[_0x3c42('0xb')](),controller[_0x3c42('0x3e')]);router[_0x3c42('0x3d')]('/',auth[_0x3c42('0xb')](),controller[_0x3c42('0x3f')]);router['post'](_0x3c42('0x40'),auth[_0x3c42('0xb')](),controller['bulkCreate']);router[_0x3c42('0x3d')](_0x3c42('0x18'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x41')]);var upload=multer({'storage':multer[_0x3c42('0x42')]({'destination':function(_0x9869d6,_0x23c0e5,_0x12e78f){_0x12e78f(null,path[_0x3c42('0x43')](config['root'],_0x3c42('0x44')));},'filename':function(_0x150724,_0xb30ff5,_0x4a2990){_0x4a2990(null,util['format'](_0x3c42('0x45'),Date[_0x3c42('0x46')](),_0xb30ff5['originalname']));}})});router[_0x3c42('0x3d')](_0x3c42('0x12'),upload[_0x3c42('0x47')](_0x3c42('0x48')),controller[_0x3c42('0x49')]);router[_0x3c42('0x3d')](_0x3c42('0x4a'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x4b')]);router['post'](_0x3c42('0x4c'),auth['isAuthenticated'](),controller[_0x3c42('0x4d')]);router[_0x3c42('0x3d')](_0x3c42('0x4e'),auth[_0x3c42('0xb')](),controller['pause']);router['post'](_0x3c42('0x4f'),auth['isAuthenticated'](),controller['unpause']);router[_0x3c42('0x3d')](_0x3c42('0x50'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x51')]);router[_0x3c42('0x3d')]('/:id/chat_interactions',auth[_0x3c42('0xb')](),controller['addChatInteractions']);router[_0x3c42('0x3d')](_0x3c42('0x52'),auth[_0x3c42('0xb')](),controller['addMailInteractions']);router[_0x3c42('0x3d')](_0x3c42('0x53'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x54')]);router[_0x3c42('0x3d')](_0x3c42('0x55'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x56')]);router['post'](_0x3c42('0x57'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x58')]);router['post'](_0x3c42('0x59'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x5a')]);router[_0x3c42('0x3d')](_0x3c42('0x30'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x5b')]);router[_0x3c42('0x3d')](_0x3c42('0x32'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x5c')]);router[_0x3c42('0x3d')]('/:id/openchannel_accounts',auth[_0x3c42('0xb')](),controller[_0x3c42('0x5d')]);router[_0x3c42('0x3d')]('/:id/sms_accounts',auth[_0x3c42('0xb')](),controller[_0x3c42('0x5e')]);router[_0x3c42('0x3d')](_0x3c42('0x38'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x5f')]);router[_0x3c42('0x3d')](_0x3c42('0x60'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x61')]);router['post'](_0x3c42('0x62'),auth['isAuthenticated'](),controller[_0x3c42('0x63')]);router['post'](_0x3c42('0x64'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x65')]);router[_0x3c42('0x66')]('/:id',auth[_0x3c42('0xb')](),controller['update']);router[_0x3c42('0x66')]('/:id/password',auth[_0x3c42('0xb')](),controller['changePassword']);router['delete'](_0x3c42('0x18'),auth['isAuthenticated'](),controller[_0x3c42('0x67')]);router[_0x3c42('0x68')]('/:id/teams',auth[_0x3c42('0xb')](),controller[_0x3c42('0x69')]);router[_0x3c42('0x68')](_0x3c42('0x10'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x6a')]);router['delete']('/:id/chat_interactions',auth[_0x3c42('0xb')](),controller[_0x3c42('0x6b')]);router[_0x3c42('0x68')](_0x3c42('0x52'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x6c')]);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller['removeFaxInteractions']);router['delete'](_0x3c42('0x55'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x6d')]);router['delete'](_0x3c42('0x57'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x6e')]);router[_0x3c42('0x68')]('/:id/whatsapp_interactions',auth[_0x3c42('0xb')](),controller['removeWhatsappInteractions']);router[_0x3c42('0x68')](_0x3c42('0x30'),auth[_0x3c42('0xb')](),controller['removeFaxAccounts']);router[_0x3c42('0x68')](_0x3c42('0x32'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x6f')]);router[_0x3c42('0x68')]('/:id/openchannel_accounts',auth[_0x3c42('0xb')](),controller[_0x3c42('0x70')]);router[_0x3c42('0x68')](_0x3c42('0x36'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x71')]);router['delete'](_0x3c42('0x38'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x72')]);router[_0x3c42('0x68')](_0x3c42('0x60'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x73')]);router[_0x3c42('0x68')](_0x3c42('0x62'),auth[_0x3c42('0xb')](),controller[_0x3c42('0x74')]);router[_0x3c42('0x68')](_0x3c42('0x64'),auth[_0x3c42('0xb')](),controller['removeApiKey']);module[_0x3c42('0x75')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e343c74..18be2f1 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 _0x1298=['update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','split','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','TEXT','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsverify','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','email','ENUM','agent','telephone','local','INTEGER','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','user','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1298,0x19e));var _0x8129=function(_0x3b7dbb,_0x4536ce){_0x3b7dbb=_0x3b7dbb-0x0;var _0x1a9860=_0x1298[_0x3b7dbb];return _0x1a9860;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8129('0x0'));var util=require('util');var _=require(_0x8129('0x1'));module[_0x8129('0x2')]={'name':{'type':Sequelize[_0x8129('0x3')],'allowNull':![],'unique':_0x8129('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x6031b2){this[_0x8129('0x5')](_0x8129('0x4'),_0x6031b2);this['setDataValue'](_0x8129('0x6'),_0x6031b2);},'comment':_0x8129('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4f0a40){this[_0x8129('0x5')](_0x8129('0x8'),_0x4f0a40);this[_0x8129('0x5')](_0x8129('0x9'),util[_0x8129('0xa')]('\x22%s\x22\x20<%s>',_0x4f0a40,this['getDataValue']('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8129('0x3')],'allowNull':![],'unique':_0x8129('0xb'),'validate':{'isEmail':!![]},'set':function(_0x4cfa1d){if(_0x4cfa1d){this[_0x8129('0x5')]('email',_0x4cfa1d['toLowerCase']());}}},'role':{'type':Sequelize[_0x8129('0xc')]('admin','user',_0x8129('0xd'),_0x8129('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x8129('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8129('0x3')],'defaultValue':_0x8129('0xf')},'internal':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4dbd35){this[_0x8129('0x5')]('internal',_0x4dbd35);this[_0x8129('0x5')]('accountcode',_0x4dbd35);this[_0x8129('0x5')](_0x8129('0x9'),util['format'](_0x8129('0x11'),this['getDataValue'](_0x8129('0x8')),_0x4dbd35));}},'salt':{'type':Sequelize[_0x8129('0x3')]},'phone':{'type':Sequelize[_0x8129('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x8129('0x3')]},'zipcode':{'type':Sequelize[_0x8129('0x3')]},'userpic':{'type':Sequelize[_0x8129('0x3')]},'city':{'type':Sequelize[_0x8129('0x3')]},'country':{'type':Sequelize[_0x8129('0x3')]},'online':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8129('0x3')],'defaultValue':_0x8129('0x13')},'lastPauseAt':{'type':Sequelize[_0x8129('0x14')]},'chatCapacity':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8129('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8129('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x8129('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x8129('0x15'),_0x8129('0x16'),'peer'),'allowNull':!![],'defaultValue':_0x8129('0x15')},'context':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x17'),_0x8129('0x18'),_0x8129('0x19'),_0x8129('0x1a'),_0x8129('0x1b'),_0x8129('0x1c'),_0x8129('0x1d'),_0x8129('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![],'defaultValue':_0x8129('0x1f'),'set':function(_0x3d55d3){this['setDataValue'](_0x8129('0x20'),_0x3d55d3?_0x3d55d3[_0x8129('0x21')](','):null);},'get':function(){return this[_0x8129('0x22')](_0x8129('0x20'))?this[_0x8129('0x22')]('transport')['split'](','):null;},'comment':_0x8129('0x23')},'dtmfmode':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x24'),_0x8129('0x25'),'shortinfo','inband',_0x8129('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no',_0x8129('0x28'),_0x8129('0x29'),_0x8129('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![],'defaultValue':_0x8129('0x2b'),'set':function(_0x50bfeb){this['setDataValue']('nat',_0x50bfeb?_0x50bfeb[_0x8129('0x21')](','):null);},'get':function(){return this[_0x8129('0x22')](_0x8129('0x2c'))?this['getDataValue'](_0x8129('0x2c'))['split'](','):null;},'comment':_0x8129('0x2d')},'callgroup':{'type':Sequelize[_0x8129('0x3')]},'namedcallgroup':{'type':Sequelize[_0x8129('0x3')]},'pickupgroup':{'type':Sequelize[_0x8129('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x8129('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8129('0x3')]},'disallow':{'type':Sequelize[_0x8129('0x3')],'allowNull':![],'defaultValue':_0x8129('0x2e')},'allow':{'type':Sequelize[_0x8129('0x3')],'allowNull':![],'defaultValue':_0x8129('0x2f'),'set':function(_0x34a232){this[_0x8129('0x5')](_0x8129('0x30'),_0x34a232?_0x34a232[_0x8129('0x21')](';'):_0x8129('0x2f'));},'get':function(){return this[_0x8129('0x22')](_0x8129('0x30'))?this[_0x8129('0x22')](_0x8129('0x30'))['split'](';'):null;},'comment':_0x8129('0x31')},'autoframing':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![],'set':function(_0x56ef89){this['setDataValue'](_0x8129('0x32'),_0x56ef89?_0x56ef89[_0x8129('0x21')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x8129('0x22')](_0x8129('0x32'))[_0x8129('0x33')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x8129('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no',_0x8129('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8129('0xc')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x8129('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8129('0x35')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no',_0x8129('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x8129('0x37'),_0x8129('0x38'),_0x8129('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x3a'),_0x8129('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8129('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8129('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8129('0xc')]('yes','no',_0x8129('0x3c'),_0x8129('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8129('0x3e'),_0x8129('0x3f'),_0x8129('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x8129('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8129('0xc')](_0x8129('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x8129('0x27'),'no',_0x8129('0x28'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8129('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x8129('0x14')]},'passwordResetAt':{'type':Sequelize[_0x8129('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x8129('0x41')]},'showWebBar':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0,'set':function(_0x1301a7){this[_0x8129('0x5')]('showWebBar',_0x1301a7);var _0x44ef71=this[_0x8129('0x42')]({'plain':!![]});switch(_0x1301a7){case 0x0:case 0x1:var _0x2e4c76=_0x44ef71[_0x8129('0x20')]?_[_0x8129('0x43')](_0x44ef71[_0x8129('0x20')])?_0x44ef71[_0x8129('0x20')][_0x8129('0x21')]():_0x44ef71['transport']:_0x8129('0x1f');if(_0x2e4c76===_0x8129('0x44')){_0x2e4c76=_0x8129('0x1f');}this['setDataValue'](_0x8129('0x20'),_0x2e4c76);this[_0x8129('0x5')](_0x8129('0x45'),'no');this[_0x8129('0x5')](_0x8129('0x46'),null);this[_0x8129('0x5')](_0x8129('0x47'),null);this[_0x8129('0x5')](_0x8129('0x48'),null);this[_0x8129('0x5')](_0x8129('0x49'),null);this[_0x8129('0x5')]('dtlsverify',null);this[_0x8129('0x5')](_0x8129('0x4a'),null);this[_0x8129('0x5')](_0x8129('0x4b'),null);this['setDataValue'](_0x8129('0x4c'),null);this[_0x8129('0x5')]('rtcp_mux','no');break;case 0x2:this[_0x8129('0x5')]('transport',_0x8129('0x44'));this[_0x8129('0x5')](_0x8129('0x45'),'yes');this[_0x8129('0x5')]('avpf',_0x8129('0x27'));this[_0x8129('0x5')](_0x8129('0x47'),_0x8129('0x27'));this[_0x8129('0x5')](_0x8129('0x48'),_0x8129('0x27'));this[_0x8129('0x5')]('dtlsenable',_0x8129('0x27'));this[_0x8129('0x5')](_0x8129('0x4d'),'no');this[_0x8129('0x5')]('dtlssetup',_0x8129('0x40'));this['setDataValue'](_0x8129('0x4b'),_0x44ef71['dtlscertfile']||_0x8129('0x4e'));this['setDataValue'](_0x8129('0x4c'),_0x44ef71[_0x8129('0x4c')]||_0x8129('0x4f'));this[_0x8129('0x5')](_0x8129('0x50'),_0x8129('0x27'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x34d92c){this[_0x8129('0x5')](_0x8129('0x51'),_0x34d92c?_0x34d92c[_0x8129('0x21')](','):[]);},'get':function(){return this[_0x8129('0x22')]('permissions')?_[_0x8129('0x52')](this[_0x8129('0x22')](_0x8129('0x51'))[_0x8129('0x33')](','),function(_0xbd3d49){return parseInt(_0xbd3d49,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x8129('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8129('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8129('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8129('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8129('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8129('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8129('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8129('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8129('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8129('0x53')],'get':function(){return this[_0x8129('0x22')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x8129('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x8129('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8129('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![],'set':function(_0x339157){if(typeof _0x339157===_0x8129('0x55')){var _0x2ac3ba=_0x339157==='1'?!![]:_0x339157==='0'?![]:_0x339157==='true'?!![]:_0x339157===_0x8129('0x56')?![]:![];this['setDataValue'](_0x8129('0x57'),_0x2ac3ba);}else{this['setDataValue'](_0x8129('0x57'),_0x339157);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x28a986){this[_0x8129('0x5')](_0x8129('0x58'),_0x28a986);if(_0x28a986===!![]){this[_0x8129('0x5')](_0x8129('0x59'),moment());this['setDataValue'](_0x8129('0x5a'),0x0);}else{this['setDataValue'](_0x8129('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x8129('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8129('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8129('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8129('0x12')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8129('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8129('0x12')],'defaultValue':!![]}}; \ No newline at end of file +var _0x29b1=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','yes','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','nonat','update','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','user','agent','local','INTEGER','callerid','DATE','BOOLEAN','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','join','getDataValue'];(function(_0x4d9d1e,_0x3c2d20){var _0x1b9d54=function(_0x373c21){while(--_0x373c21){_0x4d9d1e['push'](_0x4d9d1e['shift']());}};_0x1b9d54(++_0x3c2d20);}(_0x29b1,0x13b));var _0x129b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x29b1[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x129b('0x0'));var _=require(_0x129b('0x1'));module[_0x129b('0x2')]={'name':{'type':Sequelize[_0x129b('0x3')],'allowNull':![],'unique':_0x129b('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2a052a){this[_0x129b('0x5')](_0x129b('0x4'),_0x2a052a);this[_0x129b('0x5')](_0x129b('0x6'),_0x2a052a);},'comment':_0x129b('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4b0923){this['setDataValue'](_0x129b('0x8'),_0x4b0923);this[_0x129b('0x5')]('callerid',util['format'](_0x129b('0x9'),_0x4b0923,this['getDataValue'](_0x129b('0xa'))));}},'alias':{'type':Sequelize[_0x129b('0x3')]},'email':{'type':Sequelize[_0x129b('0x3')],'allowNull':![],'unique':_0x129b('0xb'),'validate':{'isEmail':!![]},'set':function(_0x1cd1d){if(_0x1cd1d){this[_0x129b('0x5')]('email',_0x1cd1d[_0x129b('0xc')]());}}},'role':{'type':Sequelize[_0x129b('0xd')]('admin',_0x129b('0xe'),_0x129b('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x129b('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x129b('0x3')],'defaultValue':_0x129b('0x10')},'internal':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':![],'unique':_0x129b('0xa'),'set':function(_0x4f3ff3){this[_0x129b('0x5')](_0x129b('0xa'),_0x4f3ff3);this[_0x129b('0x5')]('accountcode',_0x4f3ff3);this[_0x129b('0x5')](_0x129b('0x12'),util['format'](_0x129b('0x9'),this['getDataValue'](_0x129b('0x8')),_0x4f3ff3));}},'salt':{'type':Sequelize[_0x129b('0x3')]},'phone':{'type':Sequelize[_0x129b('0x3')]},'mobile':{'type':Sequelize[_0x129b('0x3')]},'address':{'type':Sequelize[_0x129b('0x3')]},'zipcode':{'type':Sequelize[_0x129b('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x129b('0x3')]},'country':{'type':Sequelize[_0x129b('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x129b('0x13')]},'voicePause':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x129b('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x129b('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x129b('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x129b('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x129b('0x15')},'ipaddr':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x129b('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x16'),_0x129b('0xe'),_0x129b('0x17')),'allowNull':!![],'defaultValue':_0x129b('0x16')},'context':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![],'defaultValue':_0x129b('0x18')},'callingpres':{'type':Sequelize[_0x129b('0xd')]('ALLOWED_NOT_SCREENED',_0x129b('0x19'),_0x129b('0x1a'),'ALLOWED',_0x129b('0x1b'),_0x129b('0x1c'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![],'defaultValue':_0x129b('0x1d'),'set':function(_0x162b8d){this[_0x129b('0x5')](_0x129b('0x1e'),_0x162b8d?_0x162b8d[_0x129b('0x1f')](','):null);},'get':function(){return this[_0x129b('0x20')](_0x129b('0x1e'))?this['getDataValue']('transport')[_0x129b('0x21')](','):null;},'comment':_0x129b('0x22')},'dtmfmode':{'type':Sequelize['ENUM'](_0x129b('0x23'),_0x129b('0x24'),'shortinfo','inband','auto'),'allowNull':!![],'defaultValue':_0x129b('0x23')},'directmedia':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no','nonat','update',_0x129b('0x26')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![],'defaultValue':_0x129b('0x27'),'set':function(_0x5f36d2){this[_0x129b('0x5')](_0x129b('0x28'),_0x5f36d2?_0x5f36d2[_0x129b('0x1f')](','):null);},'get':function(){return this[_0x129b('0x20')](_0x129b('0x28'))?this[_0x129b('0x20')](_0x129b('0x28'))[_0x129b('0x21')](','):null;},'comment':_0x129b('0x29')},'callgroup':{'type':Sequelize[_0x129b('0x3')]},'namedcallgroup':{'type':Sequelize[_0x129b('0x3')]},'pickupgroup':{'type':Sequelize[_0x129b('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x129b('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x129b('0x3')]},'disallow':{'type':Sequelize[_0x129b('0x3')],'allowNull':![],'defaultValue':_0x129b('0x2a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x129b('0x2b'),'set':function(_0x503b07){this[_0x129b('0x5')](_0x129b('0x2c'),_0x503b07?_0x503b07[_0x129b('0x1f')](';'):_0x129b('0x2b'));},'get':function(){return this[_0x129b('0x20')](_0x129b('0x2c'))?this[_0x129b('0x20')](_0x129b('0x2c'))['split'](';'):null;},'comment':_0x129b('0x2d')},'autoframing':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3dfe1d){this[_0x129b('0x5')](_0x129b('0x2e'),_0x3dfe1d?_0x3dfe1d[_0x129b('0x1f')](','):null);},'get':function(){return this[_0x129b('0x20')](_0x129b('0x2e'))?this['getDataValue']('insecure')[_0x129b('0x21')](','):null;},'comment':_0x129b('0x2f')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x129b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x129b('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x129b('0xd')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x129b('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x129b('0x31')},'amaflags':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![],'defaultValue':_0x129b('0x25')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x129b('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x129b('0xd')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no',_0x129b('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x129b('0x33'),_0x129b('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x35'),_0x129b('0x36')),'allowNull':!![],'defaultValue':_0x129b('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x129b('0x25'),'no'),'allowNull':!![],'defaultValue':_0x129b('0x25')},'keepalive':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x129b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x129b('0x25'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no',_0x129b('0x37'),_0x129b('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x129b('0xd')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x129b('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x129b('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x129b('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no',_0x129b('0x39'),_0x129b('0x3a'),_0x129b('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x129b('0x13')]},'passwordResetAt':{'type':Sequelize[_0x129b('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x129b('0x3c')]},'showWebBar':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x0,'set':function(_0x4931c8){this['setDataValue'](_0x129b('0x3d'),_0x4931c8);var _0x3d23c4=this[_0x129b('0x3e')]({'plain':!![]});switch(_0x4931c8){case 0x0:case 0x1:var _0x426473=_0x3d23c4[_0x129b('0x1e')]?_[_0x129b('0x3f')](_0x3d23c4[_0x129b('0x1e')])?_0x3d23c4[_0x129b('0x1e')]['join']():_0x3d23c4[_0x129b('0x1e')]:'udp';if(_0x426473===_0x129b('0x40')){_0x426473=_0x129b('0x1d');}this[_0x129b('0x5')]('transport',_0x426473);this[_0x129b('0x5')](_0x129b('0x41'),'no');this['setDataValue']('avpf',null);this[_0x129b('0x5')](_0x129b('0x42'),null);this['setDataValue'](_0x129b('0x43'),null);this[_0x129b('0x5')](_0x129b('0x44'),null);this[_0x129b('0x5')](_0x129b('0x45'),null);this[_0x129b('0x5')](_0x129b('0x46'),null);this[_0x129b('0x5')](_0x129b('0x47'),null);this['setDataValue'](_0x129b('0x48'),null);this['setDataValue'](_0x129b('0x49'),'no');break;case 0x2:this[_0x129b('0x5')]('transport','wss');this['setDataValue'](_0x129b('0x41'),_0x129b('0x25'));this[_0x129b('0x5')]('avpf',_0x129b('0x25'));this[_0x129b('0x5')](_0x129b('0x42'),_0x129b('0x25'));this[_0x129b('0x5')](_0x129b('0x43'),_0x129b('0x25'));this[_0x129b('0x5')](_0x129b('0x44'),'yes');this[_0x129b('0x5')]('dtlsverify','no');this[_0x129b('0x5')]('dtlssetup','actpass');this[_0x129b('0x5')](_0x129b('0x47'),_0x3d23c4[_0x129b('0x47')]||'/etc/pki/tls/certs/motion.crt');this[_0x129b('0x5')](_0x129b('0x48'),_0x3d23c4['dtlsprivatekey']||_0x129b('0x4a'));this[_0x129b('0x5')](_0x129b('0x49'),_0x129b('0x25'));break;default:}}},'permissions':{'type':Sequelize[_0x129b('0x3c')],'set':function(_0x151bce){this[_0x129b('0x5')](_0x129b('0x4b'),_0x151bce?_0x151bce['join'](','):[]);},'get':function(){return this[_0x129b('0x20')](_0x129b('0x4b'))?_[_0x129b('0x4c')](this[_0x129b('0x20')](_0x129b('0x4b'))[_0x129b('0x21')](','),function(_0x4a3a12){return parseInt(_0x4a3a12,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x129b('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x129b('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x129b('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x129b('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x129b('0xd')](_0x129b('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x129b('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x129b('0x4d')],'get':function(){return this[_0x129b('0x20')](_0x129b('0x4e'))?this[_0x129b('0x20')](_0x129b('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x129b('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x129b('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![],'set':function(_0x60742d){if(typeof _0x60742d===_0x129b('0x4f')){var _0x515d42=_0x60742d==='1'?!![]:_0x60742d==='0'?![]:_0x60742d===_0x129b('0x50')?!![]:_0x60742d===_0x129b('0x51')?![]:![];this[_0x129b('0x5')](_0x129b('0x52'),_0x515d42);}else{this['setDataValue'](_0x129b('0x52'),_0x60742d);}}},'blocked':{'type':Sequelize[_0x129b('0x14')],'defaultValue':![],'set':function(_0x3129e5){this[_0x129b('0x5')](_0x129b('0x53'),_0x3129e5);if(_0x3129e5===!![]){this[_0x129b('0x5')](_0x129b('0x54'),moment());this[_0x129b('0x5')](_0x129b('0x55'),0x0);}else{this['setDataValue'](_0x129b('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x129b('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x129b('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x129b('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x129b('0x11')](0x5)[_0x129b('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x129b('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x129b('0x14')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 245b44d..3b57400 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 _0x5f2f=['Sms','Openchannel','removeAgent','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','spread','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$like','$notLike','$iLike','$contained','$any','firstName','lastName','CmContact','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyIat','whoami','resolve','teams','queues','inbound','lower','col','desc','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','slice','ui.','ui.createdAt','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket','register','defaults','localhost','http','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','user','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','name','stack','index','User','rawAttributes','type','key','password','salt','getOptions','where','query','includeAll','attributes','openTabs','true','rows','length','push','chat','dataValues','sms','mail','openchannel','whatsapp','all','model','differenceBy','filters','intersection','fields','include','merge','body','params','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','102','103','113','110','104','107','108','109','100','115','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','create','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','checkUserLimits','each','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','emit','Queue:save','voice','VoiceQueue','findAll','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','QueueId','Queue:remove','addAvatar','userpic','filename','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','fax','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','keys','order','sort','pick','options','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Unknown\x20channel','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','FaxInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','getChannels','YYYY-MM-DD\x20HH:mm:ss','forEach','device','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','getTeams','Team','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams'];(function(_0x45551a,_0x564b03){var _0x144e9f=function(_0x55ca96){while(--_0x55ca96){_0x45551a['push'](_0x45551a['shift']());}};_0x144e9f(++_0x564b03);}(_0x5f2f,0x73));var _0xf5f2=function(_0x351453,_0x34718d){_0x351453=_0x351453-0x0;var _0x37be69=_0x5f2f[_0x351453];return _0x37be69;};'use strict';var moment=require(_0xf5f2('0x0'));var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var fs=require('fs');var _=require(_0xf5f2('0x4'));var squel=require(_0xf5f2('0x5'));var jayson=require(_0xf5f2('0x6'));var Redis=require(_0xf5f2('0x7'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var logger=require(_0xf5f2('0x8'))(_0xf5f2('0x9'));var utils=require(_0xf5f2('0xa'));var config=require(_0xf5f2('0xb'));var licenseUtil=require(_0xf5f2('0xc'));var db=require(_0xf5f2('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0xe')]));require(_0xf5f2('0xf'))[_0xf5f2('0x10')](socket);config['redis']=_[_0xf5f2('0x11')](config[_0xf5f2('0xe')],{'host':_0xf5f2('0x12'),'port':0x18eb});var client=jayson['client'][_0xf5f2('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4ebbbe,_0x53fb33,_0xa7e1a6,_0x151aba){return new BPromise(function(_0x4b78cd,_0x336f6b){var _0x14b51f=_0x151aba||client;return _0x14b51f[_0xf5f2('0x14')](_0x4ebbbe,_0xa7e1a6)[_0xf5f2('0x15')](function(_0x59bb6c){logger[_0xf5f2('0x16')]('User,\x20%s,\x20%s',_0x53fb33,_0xf5f2('0x17'));logger[_0xf5f2('0x18')](_0xf5f2('0x19'),_0x53fb33,_0xf5f2('0x17'),JSON[_0xf5f2('0x1a')](_0x59bb6c));if(_0x59bb6c['error']){if(_0x59bb6c[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===0x1f4){logger[_0xf5f2('0x1b')](_0xf5f2('0x1d'),_0x53fb33,_0x59bb6c[_0xf5f2('0x1b')][_0xf5f2('0x1e')]);return _0x336f6b(_0x59bb6c[_0xf5f2('0x1b')][_0xf5f2('0x1e')]);}logger[_0xf5f2('0x1b')](_0xf5f2('0x1d'),_0x53fb33,_0x59bb6c[_0xf5f2('0x1b')][_0xf5f2('0x1e')]);return _0x4b78cd(_0x59bb6c[_0xf5f2('0x1b')][_0xf5f2('0x1e')]);}else{logger[_0xf5f2('0x16')](_0xf5f2('0x1d'),_0x53fb33,_0xf5f2('0x17'));_0x4b78cd(_0x59bb6c['result'][_0xf5f2('0x1e')]);}})[_0xf5f2('0x1f')](function(_0x49dac2){logger['error'](_0xf5f2('0x1d'),_0x53fb33,_0x49dac2);_0x336f6b(_0x49dac2);});});}function respondWithStatusCode(_0x388e6c,_0x4ae323){_0x4ae323=_0x4ae323||0xcc;return function(_0x45b74f){if(_0x45b74f){return _0x388e6c[_0xf5f2('0x20')](_0x4ae323);}return _0x388e6c[_0xf5f2('0x21')](_0x4ae323)[_0xf5f2('0x22')]();};}function respondWithResult(_0x36f1cb,_0x4c691a){_0x4c691a=_0x4c691a||0xc8;return function(_0x21cd91){if(_0x21cd91){return _0x36f1cb[_0xf5f2('0x21')](_0x4c691a)[_0xf5f2('0x23')](_0x21cd91);}};}function respondWithFilteredResult(_0x2833fe,_0x287ad5){return function(_0x5bdf4a){if(_0x5bdf4a){var _0x529f07=typeof _0x287ad5[_0xf5f2('0x24')]===_0xf5f2('0x25')&&typeof _0x287ad5[_0xf5f2('0x26')]===_0xf5f2('0x25');var _0xf6c58d=_0x5bdf4a[_0xf5f2('0x27')];var _0x13a3be=_0x529f07?0x0:_0x287ad5[_0xf5f2('0x24')];var _0x294414=_0x529f07?_0x5bdf4a['count']:_0x287ad5[_0xf5f2('0x24')]+_0x287ad5[_0xf5f2('0x26')];var _0x375ca8;if(_0x294414>=_0xf6c58d){_0x294414=_0xf6c58d;_0x375ca8=0xc8;}else{_0x375ca8=0xce;}_0x2833fe[_0xf5f2('0x21')](_0x375ca8);return _0x2833fe[_0xf5f2('0x28')](_0xf5f2('0x29'),_0x13a3be+'-'+_0x294414+'/'+_0xf6c58d)['json'](_0x5bdf4a);}return null;};}function saveUpdates(_0x53cb96){return function(_0x22c826){if(_0x22c826){return _0x22c826[_0xf5f2('0x2a')](_0x53cb96)[_0xf5f2('0x15')](function(_0x5027ab){return _0x5027ab;});}return null;};}function removeEntity(_0x5a2c7e){return function(_0x29571b){if(_0x29571b){return _0x29571b[_0xf5f2('0x2b')]()[_0xf5f2('0x15')](function(){var _0x153924=_0x29571b[_0xf5f2('0x2c')]({'plain':!![]});if(_0x153924['role']==='admin')return;var _0x2f4778=[{'name':'Users','value':_0xf5f2('0x2d'),'ignore':!![]},{'name':'Agents','value':_0xf5f2('0x2e'),'ignore':![]},{'name':_0xf5f2('0x2f'),'value':_0xf5f2('0x30'),'ignore':![]}];var _0x428770=_(_0x2f4778)[_0xf5f2('0x31')](_0xf5f2('0x32'))[_0xf5f2('0x33')](_0xf5f2('0x34'))['value']();if(_[_0xf5f2('0x35')](_0x428770,_0x153924[_0xf5f2('0x36')])){return;}var _0x4590ec=_[_0xf5f2('0x37')](_0x2f4778,[_0xf5f2('0x34'),_0x153924[_0xf5f2('0x36')]])[_0xf5f2('0x38')];return db['UserProfileResource'][_0xf5f2('0x2b')]({'where':{'type':_0x4590ec,'resourceId':_0x153924['id']}})[_0xf5f2('0x15')](function(){return _0x29571b;});})['then'](function(){_0x5a2c7e[_0xf5f2('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ae07){return function(_0x3930fb){if(!_0x3930fb){_0x18ae07[_0xf5f2('0x20')](0x194);}return _0x3930fb;};}function handleError(_0x2e3cca,_0x59a6dd){_0x59a6dd=_0x59a6dd||0x1f4;return function(_0x5a98d7){logger[_0xf5f2('0x1b')](_0x5a98d7[_0xf5f2('0x39')]);if(_0x5a98d7[_0xf5f2('0x38')]){delete _0x5a98d7['name'];}_0x2e3cca[_0xf5f2('0x21')](_0x59a6dd)['send'](_0x5a98d7);};}exports[_0xf5f2('0x3a')]=function(_0x566c47,_0x46f464){var _0x456764={},_0x5337a6={'count':0x0,'rows':[]};var _0x29694f=_(db[_0xf5f2('0x3b')][_0xf5f2('0x3c')])[_0xf5f2('0x33')](function(_0x542cd6){return{'name':_0x542cd6['fieldName'],'type':_0x542cd6[_0xf5f2('0x3d')][_0xf5f2('0x3e')]};})[_0xf5f2('0x31')](function(_0x2d4400){return!_[_0xf5f2('0x35')]([_0xf5f2('0x3f'),_0xf5f2('0x40')],_0x2d4400['name']);})[_0xf5f2('0x34')]();_0x456764=qs[_0xf5f2('0x41')](_0x29694f,_0x566c47);var _0x536501={'where':_0x456764[_0xf5f2('0x42')]};return db[_0xf5f2('0x3b')][_0xf5f2('0x27')](_0x536501)[_0xf5f2('0x15')](function(_0xd10701){_0x5337a6[_0xf5f2('0x27')]=_0xd10701;if(_0x566c47[_0xf5f2('0x43')][_0xf5f2('0x44')]){_0x456764['include']=[{'all':!![]}];}if(!_[_0xf5f2('0x35')](_0x456764[_0xf5f2('0x45')],'id')){_0x456764[_0xf5f2('0x45')]['push']('id');}return db['User']['findAll'](_0x456764);})[_0xf5f2('0x15')](function(_0x2ad13c){_0x5337a6['rows']=_0x2ad13c;if(_0x566c47[_0xf5f2('0x43')][_0xf5f2('0x46')]===_0xf5f2('0x47')){var _0x31f86c=[];for(var _0x354c34=0x0;_0x354c34<_0x5337a6[_0xf5f2('0x48')][_0xf5f2('0x49')];_0x354c34++){_0x31f86c[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4b'),_0x5337a6[_0xf5f2('0x48')][_0x354c34][_0xf5f2('0x4c')]));_0x31f86c[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4d'),_0x5337a6[_0xf5f2('0x48')][_0x354c34]['dataValues']));_0x31f86c[_0xf5f2('0x4a')](get_open_tabs('fax',_0x5337a6[_0xf5f2('0x48')][_0x354c34][_0xf5f2('0x4c')]));_0x31f86c[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4e'),_0x5337a6[_0xf5f2('0x48')][_0x354c34][_0xf5f2('0x4c')]));_0x31f86c['push'](get_open_tabs(_0xf5f2('0x4f'),_0x5337a6[_0xf5f2('0x48')][_0x354c34][_0xf5f2('0x4c')]));_0x31f86c[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x50'),_0x5337a6[_0xf5f2('0x48')][_0x354c34][_0xf5f2('0x4c')]));}return BPromise[_0xf5f2('0x51')](_0x31f86c)['then'](function(_0x35dece){return _0x5337a6;});}else{return _0x5337a6;}})[_0xf5f2('0x15')](respondWithFilteredResult(_0x46f464,_0x456764))[_0xf5f2('0x1f')](handleError(_0x46f464,null));};exports['show']=function(_0x1177ba,_0xc91b64){var _0x3179a9={'raw':![],'where':{'id':_0x1177ba['params']['id']}},_0x5e761c={};_0x5e761c[_0xf5f2('0x52')]=_[_0xf5f2('0x53')](_['keys'](db[_0xf5f2('0x3b')]['rawAttributes']),[_0xf5f2('0x3f'),'salt']);_0x5e761c[_0xf5f2('0x43')]=_['keys'](_0x1177ba[_0xf5f2('0x43')]);_0x5e761c[_0xf5f2('0x54')]=_[_0xf5f2('0x55')](_0x5e761c[_0xf5f2('0x52')],_0x5e761c['query']);_0x3179a9[_0xf5f2('0x45')]=_[_0xf5f2('0x55')](_0x5e761c['model'],qs['fields'](_0x1177ba[_0xf5f2('0x43')][_0xf5f2('0x56')]));_0x3179a9['attributes']=_0x3179a9[_0xf5f2('0x45')][_0xf5f2('0x49')]?_0x3179a9[_0xf5f2('0x45')]:_0x5e761c[_0xf5f2('0x52')];if(_0x1177ba['query']['includeAll']){_0x3179a9[_0xf5f2('0x57')]=[{'all':!![]}];}_0x3179a9=_[_0xf5f2('0x58')]({},_0x3179a9,_0x1177ba['options']);if(!_[_0xf5f2('0x35')](_0x3179a9[_0xf5f2('0x45')],'id')){_0x3179a9[_0xf5f2('0x45')][_0xf5f2('0x4a')]('id');}return db[_0xf5f2('0x3b')][_0xf5f2('0x37')](_0x3179a9)[_0xf5f2('0x15')](handleEntityNotFound(_0xc91b64,null))['then'](function(_0x59e8ef){var _0x330730=[];values=_0x59e8ef;if(_0x1177ba[_0xf5f2('0x43')][_0xf5f2('0x46')]===_0xf5f2('0x47')){_0x330730[_0xf5f2('0x4a')](get_open_tabs('chat',_0x59e8ef[_0xf5f2('0x4c')]));_0x330730[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4d'),_0x59e8ef['dataValues']));_0x330730[_0xf5f2('0x4a')](get_open_tabs('openchannel',_0x59e8ef[_0xf5f2('0x4c')]));_0x330730[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x50'),_0x59e8ef[_0xf5f2('0x4c')]));_0x330730['push'](get_open_tabs('fax',_0x59e8ef[_0xf5f2('0x4c')]));_0x330730['push'](get_open_tabs(_0xf5f2('0x4e'),_0x59e8ef[_0xf5f2('0x4c')]));return BPromise['all'](_0x330730);}else{return values;}})[_0xf5f2('0x15')](function(_0xa4c0be){return values;})[_0xf5f2('0x15')](respondWithResult(_0xc91b64,null))['catch'](handleError(_0xc91b64,null));};exports[_0xf5f2('0x2a')]=function(_0xcf7a50,_0x42cc27){if(_0xcf7a50[_0xf5f2('0x59')]['id']){delete _0xcf7a50['body']['id'];}delete _0xcf7a50[_0xf5f2('0x59')]['role'];return db[_0xf5f2('0x3b')][_0xf5f2('0x37')]({'where':{'id':_0xcf7a50[_0xf5f2('0x5a')]['id']}})[_0xf5f2('0x15')](handleEntityNotFound(_0x42cc27,null))[_0xf5f2('0x15')](saveUpdates(_0xcf7a50['body'],null))[_0xf5f2('0x15')](respondWithResult(_0x42cc27,null))[_0xf5f2('0x1f')](handleError(_0x42cc27,null));};exports[_0xf5f2('0x5b')]=function(_0x212639,_0x2c5733){return db['User'][_0xf5f2('0x5b')]()['then'](respondWithResult(_0x2c5733,null))['catch'](handleError(_0x2c5733,null));};exports[_0xf5f2('0x5c')]=function(_0x4802c5,_0x10f2b8){return db[_0xf5f2('0x3b')][_0xf5f2('0x37')]({'where':{'id':_0x4802c5[_0xf5f2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x10f2b8,null))[_0xf5f2('0x15')](function(_0x3a53f2){if(_0x3a53f2){return _0x3a53f2[_0xf5f2('0x5c')](_0x4802c5[_0xf5f2('0x59')][_0xf5f2('0x5d')],_[_0xf5f2('0x5e')](_0x4802c5[_0xf5f2('0x59')],['ids','id'])||{});}})[_0xf5f2('0x15')](respondWithResult(_0x10f2b8,null))[_0xf5f2('0x1f')](handleError(_0x10f2b8,null));};function validateUser(_0xb39a6e){return new BPromise(function(_0x45c7c1,_0x5a5b2b){if(_0xb39a6e[_0xf5f2('0x5f')])return _0x45c7c1(_0xb39a6e);return db['Setting'][_0xf5f2('0x60')](0x1)[_0xf5f2('0x15')](function(_0x5588cf){if(_0x5588cf[_0xf5f2('0x61')])authService[_0xf5f2('0x62')](_0xb39a6e[_0xf5f2('0x3f')]);db[_0xf5f2('0x3b')][_0xf5f2('0x63')]('internal')[_0xf5f2('0x15')](function(_0x21c107){if(_[_0xf5f2('0x64')](_0x21c107)){_0xb39a6e[_0xf5f2('0x5f')]=_0x5588cf[_0xf5f2('0x65')]||0x1;return;}if(_[_0xf5f2('0x64')](_0x5588cf['min_internal'])||_0x5588cf[_0xf5f2('0x65')]===_0x21c107){_0xb39a6e[_0xf5f2('0x5f')]=_0x21c107+0x1;return;}if(_0x5588cf['min_internal']>_0x21c107){_0xb39a6e[_0xf5f2('0x5f')]=_0x5588cf[_0xf5f2('0x65')];return;}return db[_0xf5f2('0x66')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0xf5f2('0x67')][_0xf5f2('0x68')]})[_0xf5f2('0x15')](function(_0x450691){if(_0x450691&&_0x450691[_0xf5f2('0x49')]){for(var _0x4d878e=0x0,_0x278b76=_0x450691[_0xf5f2('0x49')];_0x4d878e<_0x278b76&&_[_0xf5f2('0x64')](_0xb39a6e[_0xf5f2('0x5f')]);_0x4d878e++){if(_0x5588cf[_0xf5f2('0x65')]<=_0x450691[_0x4d878e][_0xf5f2('0x69')]){_0xb39a6e[_0xf5f2('0x5f')]=_0x450691[_0x4d878e][_0xf5f2('0x69')];}else if(_0x5588cf[_0xf5f2('0x65')]>_0x450691[_0x4d878e][_0xf5f2('0x69')]&&_0x5588cf[_0xf5f2('0x65')]<=_0x450691[_0x4d878e]['to']){_0xb39a6e['internal']=_0x5588cf['min_internal'];}}}if(_['isNil'](_0xb39a6e[_0xf5f2('0x5f')])){_0xb39a6e[_0xf5f2('0x5f')]=_0x21c107+0x1;}return _0x45c7c1(_0xb39a6e);});});})[_0xf5f2('0x1f')](function(_0x878e8b){_0x5a5b2b(_0x878e8b);});});}function updateUser(_0x1bb752){return new BPromise(function(_0x5c6959,_0x9d943f){try{if(_0x1bb752[_0xf5f2('0x6a')]){_0x1bb752[_0xf5f2('0x6b')]=_0x1bb752[_0xf5f2('0x5f')];_0x1bb752[_0xf5f2('0x6c')]={'mailbox':_0x1bb752['internal'],'password':_0x1bb752[_0xf5f2('0x3f')],'fullname':_0x1bb752[_0xf5f2('0x6d')],'email':_0x1bb752['email']};}if(_0x1bb752[_0xf5f2('0x36')]===_0xf5f2('0x2e')){if(!_0x1bb752[_0xf5f2('0x6e')])_0x1bb752[_0xf5f2('0x6e')]=['101',_0xf5f2('0x6f'),_0xf5f2('0x70'),_0xf5f2('0x71'),_0xf5f2('0x72'),_0xf5f2('0x73'),'105','106',_0xf5f2('0x74'),_0xf5f2('0x75'),_0xf5f2('0x76'),_0xf5f2('0x77'),'111','114',_0xf5f2('0x78')];}_0x5c6959(_0x1bb752);}catch(_0x4f2fcc){_0x9d943f(_0x4f2fcc);}});}exports['create']=function(_0x4c899a,_0x57cb18){if(_0x4c899a[_0xf5f2('0x2d')][_0xf5f2('0x36')]===_0xf5f2('0x2e'))throw new Error(_0xf5f2('0x79'));if(_0x4c899a[_0xf5f2('0x59')][_0xf5f2('0x36')]===_0xf5f2('0x2d')&&_0x4c899a[_0xf5f2('0x2d')][_0xf5f2('0x36')]!==_0xf5f2('0x7a')){throw new Error(_0xf5f2('0x7b'));}if(_0x4c899a[_0xf5f2('0x59')][_0xf5f2('0x36')]===_0xf5f2('0x7a')&&_0x4c899a[_0xf5f2('0x2d')][_0xf5f2('0x36')]!==_0xf5f2('0x7a')){throw new Error(_0xf5f2('0x7c'));}return licenseUtil['checkUserLimits']([_0x4c899a[_0xf5f2('0x59')]])[_0xf5f2('0x15')](function(){return validateUser(_0x4c899a[_0xf5f2('0x59')]);})[_0xf5f2('0x15')](function(_0x18c353){return updateUser(_0x18c353)[_0xf5f2('0x15')](function(_0x16491c){if(_0x16491c[_0xf5f2('0x36')]==='admin'){_0x16491c[_0xf5f2('0x7d')]=_0x4c899a['user']['settingsEnabled'];delete _0x16491c['userProfileId'];}return _0x16491c;});})['then'](function(_0x50befc){return db['User'][_0xf5f2('0x7e')](_0x50befc,{'include':[{'model':db[_0xf5f2('0x6c')],'as':_0xf5f2('0x6c')}]});})[_0xf5f2('0x15')](function(_0x145d4d){if(_0x4c899a[_0xf5f2('0x59')]['role']==='user')return _0x145d4d;if(_0x4c899a[_0xf5f2('0x2d')]['role']!==_0xf5f2('0x2d'))return _0x145d4d;return db[_0xf5f2('0x7f')]['find']({'where':{'name':_0x145d4d['role']===_0xf5f2('0x2e')?_0xf5f2('0x80'):'Telephones','userProfileId':_0x4c899a[_0xf5f2('0x2d')][_0xf5f2('0x81')]},'raw':!![]})['then'](function(_0x1774ab){if(!_0x1774ab||_0x1774ab[_0xf5f2('0x82')]!=0x0)return _0x145d4d;return db[_0xf5f2('0x83')]['create']({'name':_0x145d4d[_0xf5f2('0x38')],'resourceId':_0x145d4d['id'],'type':_0x1774ab[_0xf5f2('0x38')],'sectionId':_0x1774ab['id']},{})[_0xf5f2('0x15')](function(){return _0x145d4d;});})[_0xf5f2('0x1f')](function(_0x3e188e){logger[_0xf5f2('0x1b')](_0xf5f2('0x84'),_0x3e188e);throw _0x3e188e;});})[_0xf5f2('0x15')](respondWithResult(_0x57cb18,0xc9))[_0xf5f2('0x1f')](handleError(_0x57cb18,null));};exports[_0xf5f2('0x85')]=function(_0x191af3,_0x2601aa){var _0x6f9240=_0x191af3[_0xf5f2('0x59')];var _0xe900ea=[];if(_0x191af3[_0xf5f2('0x2d')][_0xf5f2('0x36')]===_0xf5f2('0x2e'))throw new Error(_0xf5f2('0x79'));if(_[_0xf5f2('0x86')](_0x6f9240,[_0xf5f2('0x36'),'user'])&&_0x191af3[_0xf5f2('0x2d')][_0xf5f2('0x36')]!=='admin'){throw new Error(_0xf5f2('0x7b'));}if(_[_0xf5f2('0x86')](_0x6f9240,['role',_0xf5f2('0x7a')])&&_0x191af3[_0xf5f2('0x2d')][_0xf5f2('0x36')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xf5f2('0x87')](_0x6f9240)[_0xf5f2('0x15')](function(){return validateUser(_0x6f9240[0x0]);})[_0xf5f2('0x15')](function(){for(var _0x5ba275=0x1;_0x5ba275<_0x6f9240['length'];_0x5ba275++){var _0x2572c0=_0x6f9240[_0x5ba275-0x1][_0xf5f2('0x5f')];if(!_0x6f9240[_0x5ba275][_0xf5f2('0x5f')])_0x6f9240[_0x5ba275]['internal']=_0x2572c0+0x1;_0xe900ea['push'](validateUser(_0x6f9240[_0x5ba275]));}return BPromise['all'](_0xe900ea);})['then'](function(){_0xe900ea=[];for(var _0x560b39=0x0;_0x560b39<_0x6f9240[_0xf5f2('0x49')];_0x560b39++){_0xe900ea['push'](updateUser(_0x6f9240[_0x560b39]));}return BPromise[_0xf5f2('0x51')](_0xe900ea);})[_0xf5f2('0x15')](function(){return BPromise[_0xf5f2('0x88')](_0x6f9240,function(_0x43a167){return db[_0xf5f2('0x3b')][_0xf5f2('0x7e')](_0x43a167,{'include':[{'model':db[_0xf5f2('0x6c')],'as':_0xf5f2('0x6c')}]})[_0xf5f2('0x15')](function(_0x27ca4a){_0x43a167['id']=_0x27ca4a['id'];return _0x43a167;});});})[_0xf5f2('0x15')](function(_0x36c3c8){if(_0x191af3[_0xf5f2('0x59')]['role']===_0xf5f2('0x2d'))return _0x36c3c8;if(_0x191af3[_0xf5f2('0x2d')]['role']!==_0xf5f2('0x2d'))return _0x36c3c8;var _0x3395d3=_['some'](_0x36c3c8,function(_0x433ba0){return _0x433ba0[_0xf5f2('0x36')]===_0xf5f2('0x2e')||_0x433ba0['role']===_0xf5f2('0x30');});if(!_0x3395d3)return _0x36c3c8;return db[_0xf5f2('0x7f')]['findAll']({'where':{'name':{'$or':[_0xf5f2('0x80'),_0xf5f2('0x2f')]},'userProfileId':_0x191af3[_0xf5f2('0x2d')]['userProfileId']},'raw':!![]})[_0xf5f2('0x15')](function(_0x5573c4){if(_[_0xf5f2('0x89')](_0x5573c4)||!_['some'](_0x5573c4,[_0xf5f2('0x82'),0x0]))return _0x36c3c8;_0xe900ea=[];var _0x3cbc58=_(_0x5573c4)[_0xf5f2('0x33')](function(_0x42c915){if(_0x42c915['autoAssociation']===0x1)return;return _0x42c915[_0xf5f2('0x38')]==='Agents'?'agent':'telephone';})[_0xf5f2('0x8a')]()[_0xf5f2('0x34')]();for(var _0x5ece9e=0x0;_0x5ece9e<_0x36c3c8[_0xf5f2('0x49')];_0x5ece9e++){if(!_[_0xf5f2('0x35')](_0x3cbc58,_0x36c3c8[_0x5ece9e][_0xf5f2('0x36')]))return;var _0x3962b2=_0x36c3c8[_0x5ece9e][_0xf5f2('0x36')]===_0xf5f2('0x2e')?'Agents':_0xf5f2('0x2f');_0xe900ea[_0xf5f2('0x4a')](db['UserProfileResource'][_0xf5f2('0x7e')]({'name':_0x36c3c8[_0x5ece9e][_0xf5f2('0x38')],'resourceId':_0x36c3c8[_0x5ece9e]['id'],'type':_0x3962b2,'sectionId':_['find'](_0x5573c4,[_0xf5f2('0x38'),_0x3962b2])['id']},{}));}return BPromise[_0xf5f2('0x51')](_0xe900ea);});})[_0xf5f2('0x15')](respondWithResult(_0x2601aa,0xc9))[_0xf5f2('0x1f')](handleError(_0x2601aa,null));};exports[_0xf5f2('0x8b')]=function(_0x28dd0c,_0x4df05c){if(_0x28dd0c[_0xf5f2('0x59')]['id']){delete _0x28dd0c[_0xf5f2('0x59')]['id'];}return db[_0xf5f2('0x3b')][_0xf5f2('0x37')]({'where':{'id':_0x28dd0c[_0xf5f2('0x5a')]['id']}})[_0xf5f2('0x15')](function(_0x162c13){if(!_0x162c13)return null;if(_0x162c13['id']===_0x28dd0c[_0xf5f2('0x2d')]['id']){if(!_0x28dd0c[_0xf5f2('0x59')]['oldPassword']||!_0x28dd0c[_0xf5f2('0x59')][_0xf5f2('0x8c')]){throw new db[(_0xf5f2('0x8d'))][(_0xf5f2('0x8e'))](_0xf5f2('0x8f'));}if(!_0x162c13[_0xf5f2('0x90')](_0x28dd0c[_0xf5f2('0x59')][_0xf5f2('0x91')])){throw new db[(_0xf5f2('0x8d'))][(_0xf5f2('0x8e'))]('Wrong\x20credentials');}if(_0x28dd0c['body'][_0xf5f2('0x91')]===_0x28dd0c[_0xf5f2('0x59')][_0xf5f2('0x8c')]){throw new db[(_0xf5f2('0x8d'))]['ValidationError'](_0xf5f2('0x92'));}}else if(_0x28dd0c[_0xf5f2('0x2d')][_0xf5f2('0x36')]===_0xf5f2('0x7a')){if(!_0x28dd0c[_0xf5f2('0x59')]['newPassword']){throw new db[(_0xf5f2('0x8d'))][(_0xf5f2('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x28dd0c[_0xf5f2('0x2d')][_0xf5f2('0x36')]===_0xf5f2('0x2d')){if(!_0x28dd0c[_0xf5f2('0x59')]['newPassword']){throw new db[(_0xf5f2('0x8d'))][(_0xf5f2('0x8e'))](_0xf5f2('0x93'));}if(_0x162c13['role']!=='agent'){throw new db[(_0xf5f2('0x8d'))][(_0xf5f2('0x8e'))](_0xf5f2('0x79'));}}else{throw new db[(_0xf5f2('0x8d'))][(_0xf5f2('0x8e'))](_0xf5f2('0x79'));}return _0x162c13;})['then'](handleEntityNotFound(_0x4df05c,null))[_0xf5f2('0x15')](function(_0x51e84c){return db[_0xf5f2('0x94')][_0xf5f2('0x95')]({'attributes':['id',_0xf5f2('0x61'),_0xf5f2('0x96'),_0xf5f2('0x97')]})[_0xf5f2('0x15')](function(_0x4a586c){if(_0x4a586c[_0xf5f2('0x61')])authService[_0xf5f2('0x62')](_0x28dd0c[_0xf5f2('0x59')][_0xf5f2('0x8c')]);if(!_0x4a586c[_0xf5f2('0x96')]||!_0x51e84c[_0xf5f2('0x98')])return _0x51e84c;authService[_0xf5f2('0x99')](_0x28dd0c['body'][_0xf5f2('0x8c')],_0x51e84c['previousPasswords'],_0x4a586c['passwordHistoryLimit']);return _0x51e84c;})['then'](saveUpdates({'password':_0x28dd0c[_0xf5f2('0x59')][_0xf5f2('0x8c')],'passwordResetAt':_0x28dd0c['user']['id']==_0x28dd0c[_0xf5f2('0x5a')]['id']?moment():null,'previousPasswords':authService[_0xf5f2('0x9a')](_0x28dd0c[_0xf5f2('0x59')][_0xf5f2('0x8c')],_0x51e84c['previousPasswords'])},null));})[_0xf5f2('0x15')](respondWithResult(_0x4df05c,null))[_0xf5f2('0x1f')](handleError(_0x4df05c,null));};exports[_0xf5f2('0x9b')]=function(_0x5d3ca7,_0x29f7bd){var _0x1efd91=_0x5d3ca7['body'][_0xf5f2('0x9c')];return db[_0xf5f2('0x3b')][_0xf5f2('0x37')]({'where':{'id':_0x5d3ca7[_0xf5f2('0x5a')]['id']},'attributes':['id',_0xf5f2('0x38'),_0xf5f2('0x36'),_0xf5f2('0x9d'),_0xf5f2('0x9e'),_0xf5f2('0x9f'),_0xf5f2('0xa0')]})[_0xf5f2('0x15')](handleEntityNotFound(_0x29f7bd,null))['then'](function(_0x299c53){if(_0x299c53){if(!utils[_0xf5f2('0xa1')](_0x1efd91)){throw new db['Sequelize'][(_0xf5f2('0x8e'))]('Unknown\x20channel');}return _0x299c53[_0xf5f2('0xa2')+_[_0xf5f2('0xa3')](_0x1efd91[_0xf5f2('0xa4')]())+_0xf5f2('0xa5')](_0x5d3ca7['body'][_0xf5f2('0x5d')],{'penalty':_0x5d3ca7['body'][_0xf5f2('0xa6')]||0x0})['spread'](function(_0x3310cb){for(var _0xde71c=0x0;_0xde71c<_0x5d3ca7['body'][_0xf5f2('0x5d')][_0xf5f2('0x49')];_0xde71c+=0x1){var _0x16619b={'UserId':Number(_0x5d3ca7[_0xf5f2('0x5a')]['id'])};_0x16619b[_[_0xf5f2('0xa3')](_0x1efd91[_0xf5f2('0xa4')]())+'QueueId']=Number(_0x5d3ca7['body'][_0xf5f2('0x5d')][_0xde71c]);socket[_0xf5f2('0xa7')]('user'+_[_0xf5f2('0xa3')](_0x1efd91[_0xf5f2('0xa4')]())+_0xf5f2('0xa8'),_0x16619b);}return _0x3310cb;})[_0xf5f2('0x15')](function(){if(_0x1efd91===_0xf5f2('0xa9')){return db[_0xf5f2('0xaa')][_0xf5f2('0xab')]({'where':{'id':_0x5d3ca7['body'][_0xf5f2('0x5d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xf5f2('0x15')](function(_0x5ec0f3){var _0x3ff273=_0x299c53['get']({'plain':!![]});var _0xc51962=[];if(_0x1efd91==='voice'&&_0x3ff273['role']===_0xf5f2('0x2e')&&_0x3ff273[_0xf5f2('0x9d')]){for(var _0x57708f=0x0;_0x57708f<_0x5ec0f3[_0xf5f2('0x49')];_0x57708f+=0x1){_0xc51962[_0xf5f2('0x4a')]({'membername':_0x3ff273[_0xf5f2('0x38')],'UserId':_0x3ff273['id'],'queue_name':_0x5ec0f3[_0x57708f][_0xf5f2('0x38')],'VoiceQueueId':_0x5ec0f3[_0x57708f]['id'],'interface':_[_0xf5f2('0x64')](_0x3ff273[_0xf5f2('0xa0')])?util[_0xf5f2('0xac')](_0xf5f2('0xad'),_0x3ff273['name']):_0x3ff273['interface'],'paused':_0x3ff273[_0xf5f2('0x9f')]||![],'penalty':_0x5d3ca7['body'][_0xf5f2('0xa6')]||0x0});}return BPromise[_0xf5f2('0x88')](_0xc51962,function(_0x3a0e5c){return db[_0xf5f2('0xae')][_0xf5f2('0xaf')](_0x3a0e5c);});}return _0x299c53;});}})[_0xf5f2('0x15')](respondWithStatusCode(_0x29f7bd,null))[_0xf5f2('0x1f')](handleError(_0x29f7bd,null));};exports[_0xf5f2('0xb0')]=function(_0x28f65b,_0x16cbd3){var _0x275fb7;return db[_0xf5f2('0x3b')]['find']({'where':{'id':_0x28f65b[_0xf5f2('0x5a')]['id']},'attributes':['id','name',_0xf5f2('0x36')]})[_0xf5f2('0x15')](handleEntityNotFound(_0x16cbd3,null))[_0xf5f2('0x15')](function(_0x36afea){if(_0x36afea){_0x275fb7=_0x36afea;if(!_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x9c')]||!utils[_0xf5f2('0xa1')](_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x9c')])){throw new db[(_0xf5f2('0x8d'))][(_0xf5f2('0x8e'))]('Unknown\x20channel');}return _0x36afea[_0xf5f2('0xb1')+_[_0xf5f2('0xa3')](_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x9c')][_0xf5f2('0xa4')]())+_0xf5f2('0xa5')](_0x28f65b[_0xf5f2('0x43')]['ids']);}})[_0xf5f2('0x15')](function(_0x37d8b5){if(_[_0xf5f2('0xb2')](_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x5d')])){for(var _0x36ea7f=0x0;_0x36ea7f<_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x5d')][_0xf5f2('0x49')];_0x36ea7f+=0x1){var _0x529d6f={'UserId':Number(_0x28f65b[_0xf5f2('0x5a')]['id'])};_0x529d6f[_[_0xf5f2('0xa3')](_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x9c')][_0xf5f2('0xa4')]())+_0xf5f2('0xb3')]=Number(_0x28f65b['query'][_0xf5f2('0x5d')][_0x36ea7f]);socket[_0xf5f2('0xa7')]('user'+_['capitalize'](_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x9c')][_0xf5f2('0xa4')]())+_0xf5f2('0xb4'),_0x529d6f);}}else{var _0x529d6f={'UserId':Number(_0x28f65b[_0xf5f2('0x5a')]['id'])};_0x529d6f[_[_0xf5f2('0xa3')](_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x9c')][_0xf5f2('0xa4')]())+_0xf5f2('0xb3')]=Number(_0x28f65b['query'][_0xf5f2('0x5d')]);socket['emit']('user'+_[_0xf5f2('0xa3')](_0x28f65b[_0xf5f2('0x43')][_0xf5f2('0x9c')][_0xf5f2('0xa4')]())+_0xf5f2('0xb4'),_0x529d6f);}return _0x37d8b5;})[_0xf5f2('0x15')](function(){if(_0x28f65b[_0xf5f2('0x43')]['channel']===_0xf5f2('0xa9')){return db[_0xf5f2('0xae')][_0xf5f2('0x2b')]({'where':{'UserId':_0x28f65b['params']['id'],'VoiceQueueId':_0x28f65b[_0xf5f2('0x43')]['ids']},'individualHooks':!![]})['then'](function(){return _0x275fb7;});}return _0x275fb7;})[_0xf5f2('0x15')](respondWithStatusCode(_0x16cbd3,null))['catch'](handleError(_0x16cbd3,null));};exports[_0xf5f2('0xb5')]=function(_0x10215d,_0x5c7afd){_0x10215d[_0xf5f2('0x59')][_0xf5f2('0xb6')]=_0x10215d['file'][_0xf5f2('0xb7')];return db[_0xf5f2('0x3b')][_0xf5f2('0x37')]({'where':{'id':_0x10215d[_0xf5f2('0x5a')]['id']}})[_0xf5f2('0x15')](handleEntityNotFound(_0x5c7afd,null))['then'](saveUpdates(_0x10215d[_0xf5f2('0x59')],null))[_0xf5f2('0x15')](respondWithResult(_0x5c7afd,null))['catch'](handleError(_0x5c7afd,null));};exports['getAvatar']=function(_0x3dd6e8,_0x37f2f1){var _0x2d3ed2=path[_0xf5f2('0xb8')](config[_0xf5f2('0xb9')],_0xf5f2('0xba'));return db[_0xf5f2('0x3b')][_0xf5f2('0x37')]({'where':{'id':_0x3dd6e8['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xf5f2('0x15')](handleEntityNotFound(_0x37f2f1,null))['then'](function(_0x34abb6){if(_0x34abb6){if(_[_0xf5f2('0x64')](_0x34abb6[_0xf5f2('0xb6')])){return _0x37f2f1[_0xf5f2('0xbb')](_0x2d3ed2);}else{if(!fs['existsSync'](path[_0xf5f2('0xb8')](config[_0xf5f2('0xb9')],_0xf5f2('0xbc'),_0x34abb6[_0xf5f2('0xb6')]))){return _0x37f2f1[_0xf5f2('0xbb')](_0x2d3ed2);}return _0x37f2f1['download'](path[_0xf5f2('0xb8')](config[_0xf5f2('0xb9')],_0xf5f2('0xbc'),_0x34abb6[_0xf5f2('0xb6')]));}}})[_0xf5f2('0x1f')](handleError(_0x37f2f1,null));};exports[_0xf5f2('0xbd')]=function(_0x137bce,_0x3f7f3b){return db[_0xf5f2('0x3b')][_0xf5f2('0x37')]({'where':{'id':_0x137bce[_0xf5f2('0x5a')]['id']},'attributes':['id']})[_0xf5f2('0x15')](handleEntityNotFound(_0x3f7f3b,null))['then'](function(_0xd05e21){var _0x492175=[];values=_0xd05e21[_0xf5f2('0x4c')];_0x492175[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4b'),_0xd05e21[_0xf5f2('0x4c')]));_0x492175[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4d'),_0xd05e21[_0xf5f2('0x4c')]));_0x492175[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4f'),_0xd05e21[_0xf5f2('0x4c')]));_0x492175[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x50'),_0xd05e21[_0xf5f2('0x4c')]));_0x492175[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0xbe'),_0xd05e21[_0xf5f2('0x4c')]));_0x492175[_0xf5f2('0x4a')](get_open_tabs(_0xf5f2('0x4e'),_0xd05e21['dataValues']));return BPromise[_0xf5f2('0x51')](_0x492175);})['then'](function(_0x5b96ef){var _0x10dbac=[];if(_0x5b96ef){for(var _0x4fc28b=0x0;_0x4fc28b=_0x393005){_0x5f0a53=_0x393005;_0x79d653=0xc8;}else{_0x79d653=0xce;}_0x5882ba['status'](_0x79d653);return _0x5882ba[_0xf33a('0x24')](_0xf33a('0x25'),_0x4af24a+'-'+_0x5f0a53+'/'+_0x393005)[_0xf33a('0x21')](_0x3f9ef7);}return null;};}function saveUpdates(_0x729fca){return function(_0x4552c9){if(_0x4552c9){return _0x4552c9[_0xf33a('0x26')](_0x729fca)[_0xf33a('0x13')](function(_0x1246ff){return _0x1246ff;});}return null;};}function removeEntity(_0x26e81){return function(_0xf6f9be){if(_0xf6f9be){return _0xf6f9be[_0xf33a('0x27')]()[_0xf33a('0x13')](function(){var _0x22c9f2=_0xf6f9be[_0xf33a('0x28')]({'plain':!![]});if(_0x22c9f2[_0xf33a('0x29')]==='admin')return;var _0x627fd2=[{'name':_0xf33a('0x2a'),'value':_0xf33a('0x2b'),'ignore':!![]},{'name':_0xf33a('0x2c'),'value':'agent','ignore':![]},{'name':_0xf33a('0x2d'),'value':_0xf33a('0x2e'),'ignore':![]}];var _0x2d9a9d=_(_0x627fd2)[_0xf33a('0x2f')](_0xf33a('0x30'))[_0xf33a('0x31')]('value')[_0xf33a('0x32')]();if(_[_0xf33a('0x33')](_0x2d9a9d,_0x22c9f2[_0xf33a('0x29')])){return;}var _0x300007=_[_0xf33a('0x34')](_0x627fd2,['value',_0x22c9f2['role']])[_0xf33a('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x300007,'resourceId':_0x22c9f2['id']}})['then'](function(){return _0xf6f9be;});})[_0xf33a('0x13')](function(){_0x26e81[_0xf33a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f250){return function(_0x55f457){if(!_0x55f457){_0x21f250[_0xf33a('0x36')](0x194);}return _0x55f457;};}function handleError(_0x1f11b3,_0x395ad3){_0x395ad3=_0x395ad3||0x1f4;return function(_0x2a8e9e){logger[_0xf33a('0x18')](_0x2a8e9e[_0xf33a('0x37')]);if(_0x2a8e9e['name']){delete _0x2a8e9e[_0xf33a('0x35')];}_0x1f11b3[_0xf33a('0x1f')](_0x395ad3)['send'](_0x2a8e9e);};}exports[_0xf33a('0x38')]=function(_0x3793b4,_0x3e0a98){var _0x516336={},_0x7a06e1={'count':0x0,'rows':[]};var _0x1650c=_(db[_0xf33a('0x39')][_0xf33a('0x3a')])[_0xf33a('0x31')](function(_0x7a6aa4){return{'name':_0x7a6aa4[_0xf33a('0x3b')],'type':_0x7a6aa4[_0xf33a('0x3c')][_0xf33a('0x3d')]};})['filter'](function(_0x31028b){return!_[_0xf33a('0x33')](['password',_0xf33a('0x3e')],_0x31028b['name']);})['value']();_0x516336=qs[_0xf33a('0x3f')](_0x1650c,_0x3793b4);var _0x893cef={'where':_0x516336['where']};return db[_0xf33a('0x39')][_0xf33a('0x40')](_0x893cef)[_0xf33a('0x13')](function(_0x5776b1){_0x7a06e1[_0xf33a('0x40')]=_0x5776b1;if(_0x3793b4[_0xf33a('0x41')]['includeAll']){_0x516336[_0xf33a('0x42')]=[{'all':!![]}];}if(!_[_0xf33a('0x33')](_0x516336[_0xf33a('0x43')],'id')){_0x516336[_0xf33a('0x43')][_0xf33a('0x44')]('id');}return db['User'][_0xf33a('0x45')](_0x516336);})[_0xf33a('0x13')](function(_0x2325eb){_0x7a06e1[_0xf33a('0x46')]=_0x2325eb;if(_0x3793b4[_0xf33a('0x41')]['openTabs']===_0xf33a('0x47')){var _0x4700df=[];for(var _0x6ae3ef=0x0;_0x6ae3ef<_0x7a06e1['rows'][_0xf33a('0x48')];_0x6ae3ef++){_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x49'),_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef][_0xf33a('0x4a')]));_0x4700df[_0xf33a('0x44')](get_open_tabs('sms',_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef][_0xf33a('0x4a')]));_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4b'),_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef]['dataValues']));_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4c'),_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef]['dataValues']));_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4d'),_0x7a06e1['rows'][_0x6ae3ef]['dataValues']));_0x4700df[_0xf33a('0x44')](get_open_tabs('whatsapp',_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef][_0xf33a('0x4a')]));}return BPromise[_0xf33a('0x4e')](_0x4700df)[_0xf33a('0x13')](function(_0xecc82f){return _0x7a06e1;});}else{return _0x7a06e1;}})[_0xf33a('0x13')](respondWithFilteredResult(_0x3e0a98,_0x516336))[_0xf33a('0x1e')](handleError(_0x3e0a98,null));};exports[_0xf33a('0x4f')]=function(_0x205409,_0xbe98a9){var _0x704817={'raw':![],'where':{'id':_0x205409[_0xf33a('0x50')]['id']}},_0x4107b1={};_0x4107b1[_0xf33a('0x51')]=_[_0xf33a('0x52')](_[_0xf33a('0x53')](db[_0xf33a('0x39')][_0xf33a('0x3a')]),[_0xf33a('0x54'),_0xf33a('0x3e')]);_0x4107b1[_0xf33a('0x41')]=_[_0xf33a('0x53')](_0x205409[_0xf33a('0x41')]);_0x4107b1[_0xf33a('0x55')]=_[_0xf33a('0x56')](_0x4107b1[_0xf33a('0x51')],_0x4107b1[_0xf33a('0x41')]);_0x704817[_0xf33a('0x43')]=_[_0xf33a('0x56')](_0x4107b1['model'],qs[_0xf33a('0x57')](_0x205409[_0xf33a('0x41')]['fields']));_0x704817[_0xf33a('0x43')]=_0x704817[_0xf33a('0x43')][_0xf33a('0x48')]?_0x704817['attributes']:_0x4107b1[_0xf33a('0x51')];if(_0x205409[_0xf33a('0x41')][_0xf33a('0x58')]){_0x704817['include']=[{'all':!![]}];}_0x704817=_[_0xf33a('0x59')]({},_0x704817,_0x205409['options']);if(!_[_0xf33a('0x33')](_0x704817[_0xf33a('0x43')],'id')){_0x704817['attributes']['push']('id');}return db[_0xf33a('0x39')][_0xf33a('0x34')](_0x704817)[_0xf33a('0x13')](handleEntityNotFound(_0xbe98a9,null))['then'](function(_0x469d75){var _0x38c5df=[];values=_0x469d75;if(_0x205409[_0xf33a('0x41')][_0xf33a('0x5a')]===_0xf33a('0x47')){_0x38c5df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x49'),_0x469d75['dataValues']));_0x38c5df[_0xf33a('0x44')](get_open_tabs('sms',_0x469d75['dataValues']));_0x38c5df['push'](get_open_tabs(_0xf33a('0x4d'),_0x469d75[_0xf33a('0x4a')]));_0x38c5df[_0xf33a('0x44')](get_open_tabs('whatsapp',_0x469d75[_0xf33a('0x4a')]));_0x38c5df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4b'),_0x469d75[_0xf33a('0x4a')]));_0x38c5df[_0xf33a('0x44')](get_open_tabs('mail',_0x469d75['dataValues']));return BPromise['all'](_0x38c5df);}else{return values;}})[_0xf33a('0x13')](function(_0x528ac4){return values;})[_0xf33a('0x13')](respondWithResult(_0xbe98a9,null))[_0xf33a('0x1e')](handleError(_0xbe98a9,null));};exports[_0xf33a('0x26')]=function(_0x430d7b,_0xe5f799){if(_0x430d7b[_0xf33a('0x5b')]['id']){delete _0x430d7b['body']['id'];}delete _0x430d7b[_0xf33a('0x5b')][_0xf33a('0x29')];return db[_0xf33a('0x39')]['find']({'where':{'id':_0x430d7b[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](handleEntityNotFound(_0xe5f799,null))[_0xf33a('0x13')](saveUpdates(_0x430d7b[_0xf33a('0x5b')],null))[_0xf33a('0x13')](respondWithResult(_0xe5f799,null))[_0xf33a('0x1e')](handleError(_0xe5f799,null));};exports[_0xf33a('0x5c')]=function(_0x244993,_0x13743f){return db[_0xf33a('0x39')][_0xf33a('0x5c')]()[_0xf33a('0x13')](respondWithResult(_0x13743f,null))[_0xf33a('0x1e')](handleError(_0x13743f,null));};exports[_0xf33a('0x5d')]=function(_0x572bb4,_0x489cb2){return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x572bb4[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](handleEntityNotFound(_0x489cb2,null))[_0xf33a('0x13')](function(_0x9e6063){if(_0x9e6063){return _0x9e6063[_0xf33a('0x5d')](_0x572bb4[_0xf33a('0x5b')][_0xf33a('0x5e')],_[_0xf33a('0x5f')](_0x572bb4[_0xf33a('0x5b')],['ids','id'])||{});}})[_0xf33a('0x13')](respondWithResult(_0x489cb2,null))[_0xf33a('0x1e')](handleError(_0x489cb2,null));};function validateUser(_0x3720e1){return new BPromise(function(_0x375889,_0x3ffcca){if(_0x3720e1[_0xf33a('0x60')])return _0x375889(_0x3720e1);return db[_0xf33a('0x61')][_0xf33a('0x62')](0x1)[_0xf33a('0x13')](function(_0x495e87){if(_0x495e87[_0xf33a('0x63')])authService[_0xf33a('0x64')](_0x3720e1['password']);db[_0xf33a('0x39')][_0xf33a('0x65')](_0xf33a('0x60'))[_0xf33a('0x13')](function(_0x7b8d61){if(_[_0xf33a('0x66')](_0x7b8d61)){_0x3720e1['internal']=_0x495e87[_0xf33a('0x67')]||0x1;return;}if(_[_0xf33a('0x66')](_0x495e87[_0xf33a('0x67')])||_0x495e87[_0xf33a('0x67')]===_0x7b8d61){_0x3720e1[_0xf33a('0x60')]=_0x7b8d61+0x1;return;}if(_0x495e87[_0xf33a('0x67')]>_0x7b8d61){_0x3720e1[_0xf33a('0x60')]=_0x495e87['min_internal'];return;}return db[_0xf33a('0x68')][_0xf33a('0x41')]('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'][_0xf33a('0x69')]})[_0xf33a('0x13')](function(_0xe23c77){if(_0xe23c77&&_0xe23c77[_0xf33a('0x48')]){for(var _0x2a9995=0x0,_0xb3a823=_0xe23c77[_0xf33a('0x48')];_0x2a9995<_0xb3a823&&_[_0xf33a('0x66')](_0x3720e1[_0xf33a('0x60')]);_0x2a9995++){if(_0x495e87[_0xf33a('0x67')]<=_0xe23c77[_0x2a9995][_0xf33a('0x6a')]){_0x3720e1[_0xf33a('0x60')]=_0xe23c77[_0x2a9995]['from'];}else if(_0x495e87[_0xf33a('0x67')]>_0xe23c77[_0x2a9995]['from']&&_0x495e87['min_internal']<=_0xe23c77[_0x2a9995]['to']){_0x3720e1[_0xf33a('0x60')]=_0x495e87[_0xf33a('0x67')];}}}if(_[_0xf33a('0x66')](_0x3720e1['internal'])){_0x3720e1['internal']=_0x7b8d61+0x1;}return _0x375889(_0x3720e1);});});})[_0xf33a('0x1e')](function(_0x4c414c){_0x3ffcca(_0x4c414c);});});}function updateUser(_0x2552f3){return new BPromise(function(_0x15b91b,_0x266d3e){try{if(_0x2552f3[_0xf33a('0x6b')]){_0x2552f3[_0xf33a('0x6c')]=_0x2552f3['internal'];_0x2552f3['VoiceMail']={'mailbox':_0x2552f3[_0xf33a('0x60')],'password':_0x2552f3[_0xf33a('0x54')],'fullname':_0x2552f3[_0xf33a('0x6d')],'email':_0x2552f3[_0xf33a('0x6e')]};}if(_0x2552f3['role']===_0xf33a('0x6f')){if(!_0x2552f3[_0xf33a('0x70')])_0x2552f3['permissions']=[_0xf33a('0x71'),_0xf33a('0x72'),_0xf33a('0x73'),'113',_0xf33a('0x74'),_0xf33a('0x75'),_0xf33a('0x76'),_0xf33a('0x77'),'107',_0xf33a('0x78'),_0xf33a('0x79'),_0xf33a('0x7a'),'111',_0xf33a('0x7b'),_0xf33a('0x7c')];}_0x15b91b(_0x2552f3);}catch(_0x26b3c6){_0x266d3e(_0x26b3c6);}});}exports[_0xf33a('0x7d')]=function(_0x42f669,_0x3c959a){if(_0x42f669[_0xf33a('0x2b')][_0xf33a('0x29')]===_0xf33a('0x6f'))throw new Error(_0xf33a('0x7e'));if(_0x42f669[_0xf33a('0x5b')][_0xf33a('0x29')]===_0xf33a('0x2b')&&_0x42f669[_0xf33a('0x2b')][_0xf33a('0x29')]!=='admin'){throw new Error(_0xf33a('0x7f'));}if(_0x42f669[_0xf33a('0x5b')][_0xf33a('0x29')]===_0xf33a('0x80')&&_0x42f669[_0xf33a('0x2b')][_0xf33a('0x29')]!==_0xf33a('0x80')){throw new Error(_0xf33a('0x81'));}return licenseUtil[_0xf33a('0x82')]([_0x42f669[_0xf33a('0x5b')]])[_0xf33a('0x13')](function(){return validateUser(_0x42f669[_0xf33a('0x5b')]);})[_0xf33a('0x13')](function(_0x439c40){return updateUser(_0x439c40)['then'](function(_0x34417a){if(_0x34417a[_0xf33a('0x29')]===_0xf33a('0x80')){_0x34417a[_0xf33a('0x83')]=_0x42f669['user'][_0xf33a('0x83')];delete _0x34417a[_0xf33a('0x84')];}return _0x34417a;});})[_0xf33a('0x13')](function(_0xfd113f){return db[_0xf33a('0x39')][_0xf33a('0x7d')](_0xfd113f,{'include':[{'model':db[_0xf33a('0x85')],'as':_0xf33a('0x85')}]});})['then'](function(_0x2404dc){if(_0x42f669[_0xf33a('0x5b')][_0xf33a('0x29')]===_0xf33a('0x2b'))return _0x2404dc;if(_0x42f669['user']['role']!==_0xf33a('0x2b'))return _0x2404dc;return db['UserProfileSection'][_0xf33a('0x34')]({'where':{'name':_0x2404dc[_0xf33a('0x29')]===_0xf33a('0x6f')?_0xf33a('0x2c'):'Telephones','userProfileId':_0x42f669['user'][_0xf33a('0x84')]},'raw':!![]})['then'](function(_0x343003){if(!_0x343003||_0x343003[_0xf33a('0x86')]!=0x0)return _0x2404dc;return db[_0xf33a('0x87')][_0xf33a('0x7d')]({'name':_0x2404dc[_0xf33a('0x35')],'resourceId':_0x2404dc['id'],'type':_0x343003[_0xf33a('0x35')],'sectionId':_0x343003['id']},{})[_0xf33a('0x13')](function(){return _0x2404dc;});})[_0xf33a('0x1e')](function(_0x339eaf){logger[_0xf33a('0x18')](_0xf33a('0x88'),_0x339eaf);throw _0x339eaf;});})[_0xf33a('0x13')](respondWithResult(_0x3c959a,0xc9))[_0xf33a('0x1e')](handleError(_0x3c959a,null));};exports[_0xf33a('0x89')]=function(_0xc2e6ae,_0x254c5c){var _0x5b654b=_0xc2e6ae[_0xf33a('0x5b')];var _0x59c9e9=[];if(_0xc2e6ae[_0xf33a('0x2b')]['role']==='agent')throw new Error('Unauthorized');if(_[_0xf33a('0x8a')](_0x5b654b,[_0xf33a('0x29'),'user'])&&_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x29')]!==_0xf33a('0x80')){throw new Error(_0xf33a('0x7f'));}if(_[_0xf33a('0x8a')](_0x5b654b,[_0xf33a('0x29'),'admin'])&&_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x29')]!=='admin'){throw new Error(_0xf33a('0x8b'));}return licenseUtil[_0xf33a('0x82')](_0x5b654b)[_0xf33a('0x13')](function(){return validateUser(_0x5b654b[0x0]);})['then'](function(){for(var _0x3a550f=0x1;_0x3a550f<_0x5b654b[_0xf33a('0x48')];_0x3a550f++){var _0xb2aa64=_0x5b654b[_0x3a550f-0x1][_0xf33a('0x60')];if(!_0x5b654b[_0x3a550f][_0xf33a('0x60')])_0x5b654b[_0x3a550f]['internal']=_0xb2aa64+0x1;_0x59c9e9[_0xf33a('0x44')](validateUser(_0x5b654b[_0x3a550f]));}return BPromise[_0xf33a('0x4e')](_0x59c9e9);})[_0xf33a('0x13')](function(){_0x59c9e9=[];for(var _0x399b5b=0x0;_0x399b5b<_0x5b654b[_0xf33a('0x48')];_0x399b5b++){_0x59c9e9['push'](updateUser(_0x5b654b[_0x399b5b]));}return BPromise[_0xf33a('0x4e')](_0x59c9e9);})[_0xf33a('0x13')](function(){return BPromise[_0xf33a('0x8c')](_0x5b654b,function(_0x2719c1){return db[_0xf33a('0x39')]['create'](_0x2719c1,{'include':[{'model':db[_0xf33a('0x85')],'as':'VoiceMail'}]})['then'](function(_0x14ff0d){_0x2719c1['id']=_0x14ff0d['id'];return _0x2719c1;});});})['then'](function(_0x1cdfc4){if(_0xc2e6ae[_0xf33a('0x5b')]['role']===_0xf33a('0x2b'))return _0x1cdfc4;if(_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x29')]!==_0xf33a('0x2b'))return _0x1cdfc4;var _0x17c6d3=_[_0xf33a('0x8a')](_0x1cdfc4,function(_0x1d5d3f){return _0x1d5d3f['role']===_0xf33a('0x6f')||_0x1d5d3f[_0xf33a('0x29')]===_0xf33a('0x2e');});if(!_0x17c6d3)return _0x1cdfc4;return db[_0xf33a('0x8d')]['findAll']({'where':{'name':{'$or':[_0xf33a('0x2c'),'Telephones']},'userProfileId':_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x84')]},'raw':!![]})[_0xf33a('0x13')](function(_0x3facd6){if(_[_0xf33a('0x8e')](_0x3facd6)||!_['some'](_0x3facd6,[_0xf33a('0x86'),0x0]))return _0x1cdfc4;_0x59c9e9=[];var _0x28fbfa=_(_0x3facd6)[_0xf33a('0x31')](function(_0x3c5f46){if(_0x3c5f46[_0xf33a('0x86')]===0x1)return;return _0x3c5f46[_0xf33a('0x35')]==='Agents'?_0xf33a('0x6f'):_0xf33a('0x2e');})['compact']()[_0xf33a('0x32')]();for(var _0x8128a6=0x0;_0x8128a6<_0x1cdfc4[_0xf33a('0x48')];_0x8128a6++){if(!_[_0xf33a('0x33')](_0x28fbfa,_0x1cdfc4[_0x8128a6]['role']))return;var _0x4e5bc8=_0x1cdfc4[_0x8128a6]['role']===_0xf33a('0x6f')?_0xf33a('0x2c'):_0xf33a('0x2d');_0x59c9e9[_0xf33a('0x44')](db[_0xf33a('0x87')][_0xf33a('0x7d')]({'name':_0x1cdfc4[_0x8128a6][_0xf33a('0x35')],'resourceId':_0x1cdfc4[_0x8128a6]['id'],'type':_0x4e5bc8,'sectionId':_['find'](_0x3facd6,[_0xf33a('0x35'),_0x4e5bc8])['id']},{}));}return BPromise[_0xf33a('0x4e')](_0x59c9e9);});})[_0xf33a('0x13')](respondWithResult(_0x254c5c,0xc9))[_0xf33a('0x1e')](handleError(_0x254c5c,null));};exports[_0xf33a('0x8f')]=function(_0x26afb8,_0xbdb564){if(_0x26afb8[_0xf33a('0x5b')]['id']){delete _0x26afb8[_0xf33a('0x5b')]['id'];}return db['User'][_0xf33a('0x34')]({'where':{'id':_0x26afb8[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](function(_0x63d5ec){if(!_0x63d5ec)return null;if(_0x63d5ec['id']===_0x26afb8['user']['id']){if(!_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x90')]||!_0x26afb8['body'][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x63d5ec['authenticate'](_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x90')])){throw new db['Sequelize'][(_0xf33a('0x93'))](_0xf33a('0x94'));}if(_0x26afb8['body'][_0xf33a('0x90')]===_0x26afb8['body'][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x26afb8['user']['role']==='admin'){if(!_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x26afb8['user'][_0xf33a('0x29')]===_0xf33a('0x2b')){if(!_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x63d5ec[_0xf33a('0x29')]!==_0xf33a('0x6f')){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Unauthorized');}}else{throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Unauthorized');}return _0x63d5ec;})['then'](handleEntityNotFound(_0xbdb564,null))['then'](function(_0x1e63d5){return db[_0xf33a('0x61')][_0xf33a('0x95')]({'attributes':['id',_0xf33a('0x63'),_0xf33a('0x96'),_0xf33a('0x97')]})['then'](function(_0x528266){if(_0x528266[_0xf33a('0x63')])authService[_0xf33a('0x64')](_0x26afb8[_0xf33a('0x5b')]['newPassword']);if(!_0x528266[_0xf33a('0x96')]||!_0x1e63d5[_0xf33a('0x98')])return _0x1e63d5;authService[_0xf33a('0x99')](_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x91')],_0x1e63d5[_0xf33a('0x98')],_0x528266[_0xf33a('0x97')]);return _0x1e63d5;})[_0xf33a('0x13')](saveUpdates({'password':_0x26afb8[_0xf33a('0x5b')]['newPassword'],'passwordResetAt':_0x26afb8['user']['id']==_0x26afb8[_0xf33a('0x50')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x26afb8['body']['newPassword'],_0x1e63d5['previousPasswords'])},null));})[_0xf33a('0x13')](respondWithResult(_0xbdb564,null))[_0xf33a('0x1e')](handleError(_0xbdb564,null));};exports[_0xf33a('0x9a')]=function(_0x105cb5,_0x56e5bc){var _0x299219=_0x105cb5['body'][_0xf33a('0x9b')];return db['User'][_0xf33a('0x34')]({'where':{'id':_0x105cb5[_0xf33a('0x50')]['id']},'attributes':['id',_0xf33a('0x35'),_0xf33a('0x29'),_0xf33a('0x9c'),_0xf33a('0x9d'),_0xf33a('0x9e'),_0xf33a('0x9f')]})[_0xf33a('0x13')](handleEntityNotFound(_0x56e5bc,null))[_0xf33a('0x13')](function(_0x5ea425){if(_0x5ea425){if(!utils['isValidChannel'](_0x299219)){throw new db['Sequelize'][(_0xf33a('0x93'))](_0xf33a('0xa0'));}return _0x5ea425[_0xf33a('0xa1')+_[_0xf33a('0xa2')](_0x299219[_0xf33a('0xa3')]())+_0xf33a('0xa4')](_0x105cb5[_0xf33a('0x5b')][_0xf33a('0x5e')],{'penalty':_0x105cb5['body'][_0xf33a('0xa5')]||0x0})[_0xf33a('0xa6')](function(_0x55939d){for(var _0x40b5dc=0x0;_0x40b5dc<_0x105cb5[_0xf33a('0x5b')][_0xf33a('0x5e')][_0xf33a('0x48')];_0x40b5dc+=0x1){var _0xcc08ba={'UserId':Number(_0x105cb5[_0xf33a('0x50')]['id'])};_0xcc08ba[_[_0xf33a('0xa2')](_0x299219[_0xf33a('0xa3')]())+'QueueId']=Number(_0x105cb5[_0xf33a('0x5b')]['ids'][_0x40b5dc]);socket[_0xf33a('0xa7')](_0xf33a('0x2b')+_['capitalize'](_0x299219[_0xf33a('0xa3')]())+_0xf33a('0xa8'),_0xcc08ba);}return _0x55939d;})['then'](function(){if(_0x299219==='voice'){return db['VoiceQueue'][_0xf33a('0x45')]({'where':{'id':_0x105cb5[_0xf33a('0x5b')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x90165){var _0x519a3d=_0x5ea425[_0xf33a('0x28')]({'plain':!![]});var _0x4f5192=[];if(_0x299219===_0xf33a('0xa9')&&_0x519a3d[_0xf33a('0x29')]==='agent'&&_0x519a3d[_0xf33a('0x9c')]){for(var _0x3c522d=0x0;_0x3c522d<_0x90165[_0xf33a('0x48')];_0x3c522d+=0x1){_0x4f5192[_0xf33a('0x44')]({'membername':_0x519a3d[_0xf33a('0x35')],'UserId':_0x519a3d['id'],'queue_name':_0x90165[_0x3c522d][_0xf33a('0x35')],'VoiceQueueId':_0x90165[_0x3c522d]['id'],'interface':_[_0xf33a('0x66')](_0x519a3d[_0xf33a('0x9f')])?util[_0xf33a('0xaa')](_0xf33a('0xab'),_0x519a3d['name']):_0x519a3d[_0xf33a('0x9f')],'paused':_0x519a3d['voicePause']||![],'penalty':_0x105cb5[_0xf33a('0x5b')]['penalty']||0x0});}return BPromise[_0xf33a('0x8c')](_0x4f5192,function(_0x2dc74a){return db[_0xf33a('0xac')][_0xf33a('0xad')](_0x2dc74a);});}return _0x5ea425;});}})[_0xf33a('0x13')](respondWithStatusCode(_0x56e5bc,null))['catch'](handleError(_0x56e5bc,null));};exports[_0xf33a('0xae')]=function(_0x102520,_0x402e38){var _0x2ddd8e;return db[_0xf33a('0x39')]['find']({'where':{'id':_0x102520[_0xf33a('0x50')]['id']},'attributes':['id',_0xf33a('0x35'),_0xf33a('0x29')]})[_0xf33a('0x13')](handleEntityNotFound(_0x402e38,null))['then'](function(_0x2f02bb){if(_0x2f02bb){_0x2ddd8e=_0x2f02bb;if(!_0x102520['query'][_0xf33a('0x9b')]||!utils[_0xf33a('0xaf')](_0x102520[_0xf33a('0x41')]['channel'])){throw new db['Sequelize'][(_0xf33a('0x93'))](_0xf33a('0xa0'));}return _0x2f02bb[_0xf33a('0xb0')+_['capitalize'](_0x102520[_0xf33a('0x41')][_0xf33a('0x9b')][_0xf33a('0xa3')]())+_0xf33a('0xa4')](_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')]);}})[_0xf33a('0x13')](function(_0x59a02b){if(_['isArray'](_0x102520[_0xf33a('0x41')]['ids'])){for(var _0x432d08=0x0;_0x432d08<_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')][_0xf33a('0x48')];_0x432d08+=0x1){var _0x34781e={'UserId':Number(_0x102520[_0xf33a('0x50')]['id'])};_0x34781e[_['capitalize'](_0x102520[_0xf33a('0x41')][_0xf33a('0x9b')][_0xf33a('0xa3')]())+_0xf33a('0xb1')]=Number(_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')][_0x432d08]);socket['emit'](_0xf33a('0x2b')+_[_0xf33a('0xa2')](_0x102520['query'][_0xf33a('0x9b')][_0xf33a('0xa3')]())+_0xf33a('0xb2'),_0x34781e);}}else{var _0x34781e={'UserId':Number(_0x102520[_0xf33a('0x50')]['id'])};_0x34781e[_['capitalize'](_0x102520[_0xf33a('0x41')][_0xf33a('0x9b')]['toLowerCase']())+_0xf33a('0xb1')]=Number(_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')]);socket[_0xf33a('0xa7')](_0xf33a('0x2b')+_['capitalize'](_0x102520[_0xf33a('0x41')]['channel'][_0xf33a('0xa3')]())+'Queue:remove',_0x34781e);}return _0x59a02b;})['then'](function(){if(_0x102520[_0xf33a('0x41')]['channel']===_0xf33a('0xa9')){return db[_0xf33a('0xac')][_0xf33a('0x27')]({'where':{'UserId':_0x102520[_0xf33a('0x50')]['id'],'VoiceQueueId':_0x102520[_0xf33a('0x41')]['ids']},'individualHooks':!![]})[_0xf33a('0x13')](function(){return _0x2ddd8e;});}return _0x2ddd8e;})['then'](respondWithStatusCode(_0x402e38,null))[_0xf33a('0x1e')](handleError(_0x402e38,null));};exports[_0xf33a('0xb3')]=function(_0x43883e,_0xb6b478){_0x43883e[_0xf33a('0x5b')][_0xf33a('0xb4')]=_0x43883e[_0xf33a('0xb5')][_0xf33a('0xb6')];return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x43883e[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](handleEntityNotFound(_0xb6b478,null))[_0xf33a('0x13')](saveUpdates(_0x43883e[_0xf33a('0x5b')],null))[_0xf33a('0x13')](respondWithResult(_0xb6b478,null))[_0xf33a('0x1e')](handleError(_0xb6b478,null));};exports[_0xf33a('0xb7')]=function(_0x2df5a9,_0x5664b1){var _0x1f4aec=path[_0xf33a('0xb8')](config[_0xf33a('0xb9')],'server/files/images/logos/default_profile.png');return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x2df5a9[_0xf33a('0x50')]['id']},'attributes':['id',_0xf33a('0xb4')],'raw':!![]})[_0xf33a('0x13')](handleEntityNotFound(_0x5664b1,null))[_0xf33a('0x13')](function(_0x2d2293){if(_0x2d2293){if(_[_0xf33a('0x66')](_0x2d2293[_0xf33a('0xb4')])){return _0x5664b1[_0xf33a('0xba')](_0x1f4aec);}else{if(!fs[_0xf33a('0xbb')](path[_0xf33a('0xb8')](config['root'],'server/files/images/',_0x2d2293[_0xf33a('0xb4')]))){return _0x5664b1[_0xf33a('0xba')](_0x1f4aec);}return _0x5664b1[_0xf33a('0xba')](path[_0xf33a('0xb8')](config[_0xf33a('0xb9')],_0xf33a('0xbc'),_0x2d2293['userpic']));}}})['catch'](handleError(_0x5664b1,null));};exports[_0xf33a('0xbd')]=function(_0x56de47,_0x5728a6){return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x56de47[_0xf33a('0x50')]['id']},'attributes':['id']})[_0xf33a('0x13')](handleEntityNotFound(_0x5728a6,null))[_0xf33a('0x13')](function(_0x142960){var _0x1c6f2d=[];values=_0x142960[_0xf33a('0x4a')];_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x49'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0xbe'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4d'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0xbf'),_0x142960['dataValues']));_0x1c6f2d['push'](get_open_tabs(_0xf33a('0x4b'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d['push'](get_open_tabs(_0xf33a('0x4c'),_0x142960['dataValues']));return BPromise[_0xf33a('0x4e')](_0x1c6f2d);})[_0xf33a('0x13')](function(_0x5b7fce){var _0x3e0df3=[];if(_0x5b7fce){for(var _0x25f561=0x0;_0x25f561=_0x124ebb[_0xb294('0x50')]){throw new Error(_0xb294('0x51'));}})[_0xb294('0x12')](function(){if(_0x2eaa03){return db[_0xb294('0x2d')]['destroy']({'where':{'membername':_0x2eaa03[_0xb294('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x2eaa03){return _0x2eaa03[_0xb294('0x52')]({'raw':!![]});}})[_0xb294('0x12')](function(_0x252348){if(_0x2eaa03){if(_0x252348){var _0x3ba2be=[];_0x19f664=_0x252348;if(_0x19f664[_0xb294('0x31')]){for(var _0xa8761c=0x0;_0xa8761c<_0x19f664[_0xb294('0x31')];_0xa8761c++){_0x3ba2be['push'](db[_0xb294('0x2d')][_0xb294('0x53')]({'membername':_0x2eaa03['name'],'UserId':_0x2eaa03['id'],'queue_name':_0x19f664[_0xa8761c][_0xb294('0x2a')],'VoiceQueueId':_0x19f664[_0xa8761c]['id'],'interface':_0x55e737,'paused':_0x2eaa03['loginInPause']||![],'penalty':_0x19f664[_0xa8761c][_0xb294('0x54')]||0x0}));}return BPromise[_0xb294('0x48')](_0x3ba2be);}}}})[_0xb294('0x12')](function(){if(_0x2eaa03){return db['MemberReport'][_0xb294('0x1d')]({'where':{'membername':_0x2eaa03[_0xb294('0x2a')],'exitAt':null}});}})[_0xb294('0x12')](function(_0x33c91f){if(_0x2eaa03){if(_0x33c91f&&_0x33c91f[_0xb294('0x31')]){var _0x5d6f1b=[];_0x33c91f[_0xb294('0x34')](function(_0x5a5a36){_0x5d6f1b[_0xb294('0x55')](_0x5a5a36['update']({'exitAt':moment()[_0xb294('0x3c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5d6f1b);}}})[_0xb294('0x12')](function(_0x5ecca4){if(_0x2eaa03){var _0x104047=[];var _0x4808e0=[];var _0x229e5f=utils[_0xb294('0x33')]();var _0x397a9c={'membername':_0x2eaa03[_0xb294('0x2a')],'interface':_0x55e737,'enterAt':moment()['format'](_0xb294('0x36')),'role':_0x2eaa03[_0xb294('0x3a')],'internal':_0x2eaa03[_0xb294('0x2b')]};_0x229e5f['forEach'](function(_0x1a22f2){_0x104047['push'](_[_0xb294('0x56')]({'channel':_0x1a22f2,'type':'LOGIN','data1':_0xb294('0x57'),'data2':_0x55e737},_0x397a9c));if(_0x2eaa03[_0xb294('0x4d')]){_0x4808e0[_0xb294('0x55')](_[_0xb294('0x56')]({'channel':_0x1a22f2,'type':_0xb294('0x30'),'data1':'LOGININPAUSE'},_0x397a9c));}});return db[_0xb294('0x2f')][_0xb294('0x58')](_0x104047['concat'](_0x4808e0),{'individualHooks':!![]});}})['then'](function(){if(_0x2eaa03){return _0x2eaa03['update']({'online':!![],'lastLoginAt':moment()[_0xb294('0x3c')](_0xb294('0x36')),'voicePause':_0x2eaa03[_0xb294('0x4d')]||![],'mailPause':_0x2eaa03[_0xb294('0x4d')]||![],'chatPause':_0x2eaa03[_0xb294('0x4d')]||![],'faxPause':_0x2eaa03[_0xb294('0x4d')]||![],'smsPause':_0x2eaa03[_0xb294('0x4d')]||![],'openchannelPause':_0x2eaa03[_0xb294('0x4d')]||![],'pauseType':_0x2eaa03[_0xb294('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xb294('0x3c')](_0xb294('0x36')),'interface':_0x55e737});}})[_0xb294('0x12')](function(_0x181657){_0x2729ab(_0x181657);})[_0xb294('0x1a')](function(_0x49adb2){_0x349c52(_0x4b5505[_0xb294('0x15')](0x1f4,_0x49adb2[_0xb294('0x17')]));});});}; \ No newline at end of file +var _0xba42=['then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','code','error','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowUser','PauseUser','find','role','internal','interface','update','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','UnpauseUser','findOne','channel','voice','system','mail','chat','sms','openchannel','whatsapp','set','%s%s','Pause','forEach','LogoutUser','all','LoginUser','phone','SIP/%s','count','agent','../../config/license/util','getLicense','agents','UserVoiceQueueRt','destroy','getVoiceQueues','upsert','loginInPause','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./user.socket','register','request'];(function(_0x129874,_0x1c5a3){var _0x2d7d79=function(_0x148a6a){while(--_0x148a6a){_0x129874['push'](_0x129874['shift']());}};_0x2d7d79(++_0x1c5a3);}(_0xba42,0x10b));var _0x2ba4=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xba42[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x2ba4('0x0'));var util=require(_0x2ba4('0x1'));var moment=require(_0x2ba4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ba4('0x3'));var db=require(_0x2ba4('0x4'))['db'];var utils=require(_0x2ba4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2ba4('0x6'));var jayson=require(_0x2ba4('0x7'));var client=jayson[_0x2ba4('0x8')][_0x2ba4('0x9')]({'port':0x232a});config[_0x2ba4('0xa')]=_[_0x2ba4('0xb')](config[_0x2ba4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2ba4('0xc'))[_0x2ba4('0xd')](socket);function respondWithRpcPromise(_0x8aacc4,_0x2d9425,_0x2cb480){return new BPromise(function(_0x536c64,_0x1d333b){return client[_0x2ba4('0xe')](_0x8aacc4,_0x2cb480)[_0x2ba4('0xf')](function(_0x3def80){logger[_0x2ba4('0x10')]('User,\x20%s,\x20%s',_0x2d9425,_0x2ba4('0x11'));logger[_0x2ba4('0x12')](_0x2ba4('0x13'),_0x2d9425,_0x2ba4('0x11'),JSON['stringify'](_0x3def80));if(_0x3def80['error']){if(_0x3def80['error'][_0x2ba4('0x14')]===0x1f4){logger[_0x2ba4('0x15')](_0x2ba4('0x16'),_0x2d9425,_0x3def80[_0x2ba4('0x15')][_0x2ba4('0x17')]);return _0x1d333b(_0x3def80[_0x2ba4('0x15')]['message']);}logger['error']('User,\x20%s,\x20%s',_0x2d9425,_0x3def80[_0x2ba4('0x15')][_0x2ba4('0x17')]);return _0x536c64(_0x3def80[_0x2ba4('0x15')]['message']);}else{logger[_0x2ba4('0x10')]('User,\x20%s,\x20%s',_0x2d9425,_0x2ba4('0x11'));_0x536c64(_0x3def80[_0x2ba4('0x18')]['message']);}})[_0x2ba4('0x19')](function(_0x3124bd){logger[_0x2ba4('0x15')](_0x2ba4('0x16'),_0x2d9425,_0x3124bd);_0x1d333b(_0x3124bd);});});}exports[_0x2ba4('0x1a')]=function(_0xdff689){var _0x4865ac=this;return new Promise(function(_0x6b8d73,_0x234b7b){return db[_0x2ba4('0x1b')][_0x2ba4('0x1c')]({'raw':_0xdff689[_0x2ba4('0x1d')]?_0xdff689['options'][_0x2ba4('0x1e')]===undefined?!![]:![]:!![],'where':_0xdff689[_0x2ba4('0x1d')]?_0xdff689['options'][_0x2ba4('0x1f')]||null:null,'attributes':_0xdff689[_0x2ba4('0x1d')]?_0xdff689[_0x2ba4('0x1d')][_0x2ba4('0x20')]||null:null,'limit':_0xdff689[_0x2ba4('0x1d')]?_0xdff689['options'][_0x2ba4('0x21')]||null:null,'include':_0xdff689[_0x2ba4('0x1d')]?_0xdff689['options'][_0x2ba4('0x22')]?_[_0x2ba4('0x23')](_0xdff689[_0x2ba4('0x1d')][_0x2ba4('0x22')],function(_0x5eeb50){return{'model':db[_0x5eeb50[_0x2ba4('0x24')]],'as':_0x5eeb50['as'],'attributes':_0x5eeb50[_0x2ba4('0x20')],'include':_0x5eeb50[_0x2ba4('0x22')]?_['map'](_0x5eeb50[_0x2ba4('0x22')],function(_0x383949){return{'model':db[_0x383949[_0x2ba4('0x24')]],'as':_0x383949['as'],'attributes':_0x383949[_0x2ba4('0x20')],'include':_0x383949[_0x2ba4('0x22')]?_['map'](_0x383949[_0x2ba4('0x22')],function(_0x2cfb54){return{'model':db[_0x2cfb54['model']],'as':_0x2cfb54['as'],'attributes':_0x2cfb54[_0x2ba4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2ba4('0xf')](function(_0x2155b7){logger[_0x2ba4('0x10')]('GetUser',_0xdff689);logger['debug']('GetUser',_0xdff689,JSON[_0x2ba4('0x25')](_0x2155b7));_0x6b8d73(_0x2155b7);})['catch'](function(_0x4d8db0){logger['error']('GetUser',_0x4d8db0['message'],_0xdff689);_0x234b7b(_0x4865ac[_0x2ba4('0x15')](0x1f4,_0x4d8db0[_0x2ba4('0x17')]));});});};exports[_0x2ba4('0x26')]=function(_0x291069){var _0x1876cd=this;return new Promise(function(_0x8c0d16,_0x19e19b){return db['User']['find']({'raw':_0x291069[_0x2ba4('0x1d')]?_0x291069[_0x2ba4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x291069[_0x2ba4('0x1d')]?_0x291069[_0x2ba4('0x1d')][_0x2ba4('0x1f')]||null:null,'attributes':_0x291069[_0x2ba4('0x1d')]?_0x291069[_0x2ba4('0x1d')][_0x2ba4('0x20')]||null:null,'include':_0x291069[_0x2ba4('0x1d')]?_0x291069[_0x2ba4('0x1d')]['include']?_[_0x2ba4('0x23')](_0x291069[_0x2ba4('0x1d')][_0x2ba4('0x22')],function(_0x144830){return{'model':db[_0x144830[_0x2ba4('0x24')]],'as':_0x144830['as'],'attributes':_0x144830[_0x2ba4('0x20')],'include':_0x144830[_0x2ba4('0x22')]?_['map'](_0x144830[_0x2ba4('0x22')],function(_0x2261e1){return{'model':db[_0x2261e1[_0x2ba4('0x24')]],'as':_0x2261e1['as'],'attributes':_0x2261e1[_0x2ba4('0x20')],'include':_0x2261e1[_0x2ba4('0x22')]?_[_0x2ba4('0x23')](_0x2261e1[_0x2ba4('0x22')],function(_0x4551fc){return{'model':db[_0x4551fc[_0x2ba4('0x24')]],'as':_0x4551fc['as'],'attributes':_0x4551fc['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ba4('0xf')](function(_0xfa96ab){logger[_0x2ba4('0x10')](_0x2ba4('0x26'),_0x291069);logger[_0x2ba4('0x12')](_0x2ba4('0x26'),_0x291069,JSON[_0x2ba4('0x25')](_0xfa96ab));_0x8c0d16(_0xfa96ab);})['catch'](function(_0x4c3b6c){logger[_0x2ba4('0x15')]('ShowUser',_0x4c3b6c[_0x2ba4('0x17')],_0x291069);_0x19e19b(_0x1876cd[_0x2ba4('0x15')](0x1f4,_0x4c3b6c['message']));});});};exports[_0x2ba4('0x27')]=function(_0x2c762a){var _0x4830b6=this;return new Promise(function(_0x328ee0,_0x3fe1ba){var _0x385458;return db[_0x2ba4('0x1b')][_0x2ba4('0x28')]({'where':_0x2c762a[_0x2ba4('0x1d')][_0x2ba4('0x1f')]||{},'attributes':['id','name',_0x2ba4('0x29'),_0x2ba4('0x2a'),_0x2ba4('0x2b')]})['then'](function(_0x29e5c8){if(_0x29e5c8){_0x385458=_0x29e5c8;return db['UserVoiceQueueRt'][_0x2ba4('0x2c')]({'paused':0x1},{'where':{'UserId':_0x385458['id']},'individualHooks':!![]});}})[_0x2ba4('0xf')](function(){if(_0x385458){return db['MemberReport'][_0x2ba4('0x1c')]({'where':{'membername':_0x385458[_0x2ba4('0x2d')],'type':_0x2ba4('0x2e'),'exitAt':null}});}})[_0x2ba4('0xf')](function(_0x44d025){if(_0x385458){if(_0x44d025&&_0x44d025[_0x2ba4('0x2f')]){var _0x4d891f=moment()[_0x2ba4('0x30')](_0x2ba4('0x31'));for(var _0x57e18d=0x0,_0x13d525=_0x44d025[_0x2ba4('0x2f')];_0x57e18d<_0x13d525;_0x57e18d++){_0x44d025[_0x57e18d][_0x2ba4('0x32')]({'exitAt':_0x4d891f});}}}})['then'](function(){if(_0x385458){var _0x5acc10=[];var _0x25d8f4=utils[_0x2ba4('0x33')]();_0x25d8f4['forEach'](function(_0x3a9a58){_0x5acc10[_0x2ba4('0x34')]({'channel':_0x3a9a58,'membername':_0x385458[_0x2ba4('0x2d')],'interface':_[_0x2ba4('0x35')](_0x385458['interface'])?util[_0x2ba4('0x30')]('SIP/%s',_0x385458[_0x2ba4('0x2d')]):_0x385458[_0x2ba4('0x2b')],'type':_0x2ba4('0x2e'),'enterAt':moment()[_0x2ba4('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2c762a[_0x2ba4('0x36')][_0x2ba4('0x37')]||_0x2ba4('0x38'),'role':_0x385458['role'],'internal':_0x385458['internal'],'uniqueid':_0x2c762a[_0x2ba4('0x36')][_0x2ba4('0x39')]||null});});return db[_0x2ba4('0x3a')][_0x2ba4('0x3b')](_0x5acc10,{'individualHooks':!![]});}})['then'](function(){if(_0x385458){return _0x385458[_0x2ba4('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2c762a[_0x2ba4('0x36')][_0x2ba4('0x37')]||_0x2ba4('0x38'),'lastPauseAt':moment()[_0x2ba4('0x30')](_0x2ba4('0x31'))});}})[_0x2ba4('0xf')](function(_0x4a6f1f){_0x328ee0(_0x4a6f1f);})[_0x2ba4('0x19')](function(_0x435edd){_0x3fe1ba(_0x4830b6[_0x2ba4('0x15')](0x1f4,_0x435edd['message']));});});};exports[_0x2ba4('0x3c')]=function(_0x4907d5){var _0xef2e01=this;return new Promise(function(_0x1f7e8e,_0x5856ab){var _0x2fd184;return db[_0x2ba4('0x1b')][_0x2ba4('0x3d')]({'where':_0x4907d5[_0x2ba4('0x1d')][_0x2ba4('0x1f')]||{},'attributes':['id',_0x2ba4('0x2d')]})[_0x2ba4('0xf')](function(_0x32ea8e){if(_0x32ea8e){_0x2fd184=_0x32ea8e;if(_0x4907d5[_0x2ba4('0x36')][_0x2ba4('0x3e')]&&!utils['isValidChannel'](_0x4907d5[_0x2ba4('0x36')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x4907d5['body']['channel']){case _0x2ba4('0x3f'):return db['UserVoiceQueueRt'][_0x2ba4('0x2c')]({'paused':0x0},{'where':{'UserId':_0x2fd184['id']}})[_0x2ba4('0xf')](function(){return db['MemberReport'][_0x2ba4('0x28')]({'where':{'channel':_0x4907d5[_0x2ba4('0x36')]['channel'],'membername':_0x2fd184[_0x2ba4('0x2d')],'type':_0x2ba4('0x2e'),'exitAt':null}});})[_0x2ba4('0xf')](function(_0x79a905){if(_0x79a905){return _0x79a905['update']({'exitAt':moment()['format'](_0x2ba4('0x31')),'data2':_0x2ba4('0x40')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2fd184[_0x2ba4('0x2c')]({'voicePause':![]});});case _0x2ba4('0x41'):case _0x2ba4('0x42'):case'fax':case _0x2ba4('0x43'):case _0x2ba4('0x44'):case _0x2ba4('0x45'):return db['MemberReport'][_0x2ba4('0x28')]({'where':{'channel':_0x4907d5[_0x2ba4('0x36')][_0x2ba4('0x3e')],'membername':_0x2fd184[_0x2ba4('0x2d')],'type':_0x2ba4('0x2e'),'exitAt':null}})['then'](function(_0x15084b){return _0x15084b['update']({'exitAt':moment()[_0x2ba4('0x30')](_0x2ba4('0x31')),'data2':'system'},{'individualHooks':!![]});})[_0x2ba4('0xf')](function(){var _0x2e439e={};_[_0x2ba4('0x46')](_0x2e439e,util[_0x2ba4('0x30')](_0x2ba4('0x47'),_0x4907d5[_0x2ba4('0x36')][_0x2ba4('0x3e')],_0x2ba4('0x48')),![]);return _0x2fd184[_0x2ba4('0x2c')](_0x2e439e);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x2fd184['id']}})[_0x2ba4('0xf')](function(){return db[_0x2ba4('0x3a')][_0x2ba4('0x1c')]({'where':{'membername':_0x2fd184[_0x2ba4('0x2d')],'type':'PAUSE','exitAt':null}});})[_0x2ba4('0xf')](function(_0x52b400){var _0x16c6af=[];_0x52b400[_0x2ba4('0x49')](function(_0x5e9c64){_0x16c6af[_0x2ba4('0x34')](_0x5e9c64[_0x2ba4('0x2c')]({'exitAt':moment()[_0x2ba4('0x30')](_0x2ba4('0x31')),'data2':'system'}));});return BPromise['all'](_0x16c6af);})['then'](function(){return _0x2fd184[_0x2ba4('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x2598f8){_0x1f7e8e(_0x2598f8);})[_0x2ba4('0x19')](function(_0x55d520){_0x5856ab(_0xef2e01['error'](0x1f4,_0x55d520['message']));});});};exports[_0x2ba4('0x4a')]=function(_0xcb34ea){var _0x557383=this;return new Promise(function(_0x263780,_0x261969){var _0x1d451c;return db[_0x2ba4('0x1b')][_0x2ba4('0x3d')]({'where':_0xcb34ea[_0x2ba4('0x1d')]['where']||{},'attributes':['id','name']})[_0x2ba4('0xf')](function(_0x358101){if(_0x358101){_0x1d451c=_0x358101;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1d451c[_0x2ba4('0x2d')]},'individualHooks':!![]});}})[_0x2ba4('0xf')](function(){if(_0x1d451c){return db[_0x2ba4('0x3a')][_0x2ba4('0x1c')]({'where':{'membername':_0x1d451c[_0x2ba4('0x2d')],'exitAt':null}});}})['then'](function(_0x3ee314){if(_0x1d451c){if(_0x3ee314&&_0x3ee314[_0x2ba4('0x2f')]){var _0x2baa23=[];_0x3ee314['forEach'](function(_0x4a56f4){_0x2baa23[_0x2ba4('0x34')](_0x4a56f4[_0x2ba4('0x2c')]({'exitAt':moment()['format'](_0x2ba4('0x31'))}));});return BPromise[_0x2ba4('0x4b')](_0x2baa23);}}})[_0x2ba4('0xf')](function(){if(_0x1d451c){return _0x1d451c[_0x2ba4('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2ba4('0xf')](function(_0x5c1264){_0x263780(_0x5c1264);})[_0x2ba4('0x19')](function(_0xc0cf1b){_0x261969(_0x557383[_0x2ba4('0x15')](0x1f4,_0xc0cf1b['message']));});});};exports[_0x2ba4('0x4c')]=function(_0x1d6a00){var _0x4a5900=this;return new Promise(function(_0xb56773,_0x4ed9a1){var _0x39795f;var _0x81540a;var _0x4daf50;var _0x15c61e;return db[_0x2ba4('0x1b')][_0x2ba4('0x3d')]({'where':_0x1d6a00[_0x2ba4('0x1d')][_0x2ba4('0x1f')]||{},'attributes':['id','name',_0x2ba4('0x29'),'mobile',_0x2ba4('0x4d'),_0x2ba4('0x2a'),'loginInPause',_0x2ba4('0x2b')]})['then'](function(_0x25fe18){if(_0x25fe18){_0x39795f=_0x25fe18;_0x15c61e=_0x1d6a00['body'][_0x2ba4('0x2b')]?_0x1d6a00[_0x2ba4('0x36')][_0x2ba4('0x2b')]:util[_0x2ba4('0x30')](_0x2ba4('0x4e'),_0x39795f[_0x2ba4('0x2d')]);return db[_0x2ba4('0x1b')][_0x2ba4('0x4f')]({'where':{'role':_0x2ba4('0x50'),'online':!![],'id':{'$ne':_0x39795f['id']}}});}})[_0x2ba4('0xf')](function(_0x1c1eb9){if(_0x1c1eb9){_0x4daf50=_0x1c1eb9;return require(_0x2ba4('0x51'))[_0x2ba4('0x52')]();}})[_0x2ba4('0xf')](function(_0x4ae9bd){if(_0x4ae9bd&&_0x4ae9bd[_0x2ba4('0x53')]&&_0x4daf50>=_0x4ae9bd['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x39795f){return db[_0x2ba4('0x54')][_0x2ba4('0x55')]({'where':{'membername':_0x39795f[_0x2ba4('0x2d')]},'individualHooks':!![]});}})[_0x2ba4('0xf')](function(){if(_0x39795f){return _0x39795f[_0x2ba4('0x56')]({'raw':!![]});}})[_0x2ba4('0xf')](function(_0x51fbd0){if(_0x39795f){if(_0x51fbd0){var _0x1225db=[];_0x81540a=_0x51fbd0;if(_0x81540a['length']){for(var _0x2427f9=0x0;_0x2427f9<_0x81540a['length'];_0x2427f9++){_0x1225db[_0x2ba4('0x34')](db[_0x2ba4('0x54')][_0x2ba4('0x57')]({'membername':_0x39795f[_0x2ba4('0x2d')],'UserId':_0x39795f['id'],'queue_name':_0x81540a[_0x2427f9][_0x2ba4('0x2d')],'VoiceQueueId':_0x81540a[_0x2427f9]['id'],'interface':_0x15c61e,'paused':_0x39795f[_0x2ba4('0x58')]||![],'penalty':_0x81540a[_0x2427f9]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x1225db);}}}})[_0x2ba4('0xf')](function(){if(_0x39795f){return db[_0x2ba4('0x3a')][_0x2ba4('0x1c')]({'where':{'membername':_0x39795f[_0x2ba4('0x2d')],'exitAt':null}});}})[_0x2ba4('0xf')](function(_0x56d63d){if(_0x39795f){if(_0x56d63d&&_0x56d63d[_0x2ba4('0x2f')]){var _0x1639b9=[];_0x56d63d['forEach'](function(_0x4e9379){_0x1639b9['push'](_0x4e9379[_0x2ba4('0x2c')]({'exitAt':moment()[_0x2ba4('0x30')](_0x2ba4('0x31'))}));});return BPromise[_0x2ba4('0x4b')](_0x1639b9);}}})[_0x2ba4('0xf')](function(_0x4089f1){if(_0x39795f){var _0x2b02b4=[];var _0x14fd42=[];var _0x365938=utils[_0x2ba4('0x33')]();var _0x49cdb5={'membername':_0x39795f['name'],'interface':_0x15c61e,'enterAt':moment()['format'](_0x2ba4('0x31')),'role':_0x39795f['role'],'internal':_0x39795f[_0x2ba4('0x2a')]};_0x365938[_0x2ba4('0x49')](function(_0x303aa3){_0x2b02b4[_0x2ba4('0x34')](_[_0x2ba4('0x59')]({'channel':_0x303aa3,'type':_0x2ba4('0x5a'),'data1':_0x2ba4('0x5b'),'data2':_0x15c61e},_0x49cdb5));if(_0x39795f[_0x2ba4('0x58')]){_0x14fd42[_0x2ba4('0x34')](_[_0x2ba4('0x59')]({'channel':_0x303aa3,'type':_0x2ba4('0x2e'),'data1':'LOGININPAUSE'},_0x49cdb5));}});return db['MemberReport'][_0x2ba4('0x3b')](_0x2b02b4[_0x2ba4('0x5c')](_0x14fd42),{'individualHooks':!![]});}})['then'](function(){if(_0x39795f){return _0x39795f[_0x2ba4('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0x2ba4('0x31')),'voicePause':_0x39795f[_0x2ba4('0x58')]||![],'mailPause':_0x39795f['loginInPause']||![],'chatPause':_0x39795f['loginInPause']||![],'faxPause':_0x39795f['loginInPause']||![],'smsPause':_0x39795f[_0x2ba4('0x58')]||![],'openchannelPause':_0x39795f[_0x2ba4('0x58')]||![],'pauseType':_0x39795f[_0x2ba4('0x58')]?_0x2ba4('0x5d'):null,'lastPauseAt':moment()['format'](_0x2ba4('0x31')),'interface':_0x15c61e});}})[_0x2ba4('0xf')](function(_0x4b12e5){_0xb56773(_0x4b12e5);})['catch'](function(_0x311c2c){_0x4ed9a1(_0x4a5900[_0x2ba4('0x15')](0x1f4,_0x311c2c['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ba082a1..db90fa2 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 _0x75f0=['emit','removeListener','register','user:','save','remove','update'];(function(_0xed71ed,_0x2c3a97){var _0xbb1e2c=function(_0x5a8f0a){while(--_0x5a8f0a){_0xed71ed['push'](_0xed71ed['shift']());}};_0xbb1e2c(++_0x2c3a97);}(_0x75f0,0x13f));var _0x075f=function(_0x3d708f,_0x23791c){_0x3d708f=_0x3d708f-0x0;var _0x461863=_0x75f0[_0x3d708f];return _0x461863;};'use strict';var UserEvents=require('./user.events');var events=[_0x075f('0x0'),_0x075f('0x1'),_0x075f('0x2')];function createListener(_0x241757,_0x227bf8){return function(_0x241aab){_0x227bf8[_0x075f('0x3')](_0x241757,_0x241aab);};}function removeListener(_0x57ae9c,_0xfce093){return function(){UserEvents[_0x075f('0x4')](_0x57ae9c,_0xfce093);};}exports[_0x075f('0x5')]=function(_0x40dc16){for(var _0x3f0517=0x0,_0x47e05c=events['length'];_0x3f0517<_0x47e05c;_0x3f0517++){var _0x13b640=events[_0x3f0517];var _0xc292d1=createListener(_0x075f('0x6')+_0x13b640,_0x40dc16);UserEvents['on'](_0x13b640,_0xc292d1);}}; \ No newline at end of file +var _0xa749=['save','remove','update','removeListener','register','./user.events'];(function(_0x5448ba,_0x1f67c7){var _0x2b14e5=function(_0x2a1bcc){while(--_0x2a1bcc){_0x5448ba['push'](_0x5448ba['shift']());}};_0x2b14e5(++_0x1f67c7);}(_0xa749,0xe3));var _0x9a74=function(_0x3e894d,_0x5300d5){_0x3e894d=_0x3e894d-0x0;var _0x12222a=_0xa749[_0x3e894d];return _0x12222a;};'use strict';var UserEvents=require(_0x9a74('0x0'));var events=[_0x9a74('0x1'),_0x9a74('0x2'),_0x9a74('0x3')];function createListener(_0x961400,_0x47c6b0){return function(_0x2136ea){_0x47c6b0['emit'](_0x961400,_0x2136ea);};}function removeListener(_0x44dd9c,_0x46f7a4){return function(){UserEvents[_0x9a74('0x4')](_0x44dd9c,_0x46f7a4);};}exports[_0x9a74('0x5')]=function(_0x34bb0b){for(var _0x529e32=0x0,_0x3cf44b=events['length'];_0x529e32<_0x3cf44b;_0x529e32++){var _0x270485=events[_0x529e32];var _0x1c21f5=createListener('user:'+_0x270485,_0x34bb0b);UserEvents['on'](_0x270485,_0x1c21f5);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 1d5f079..b33b200 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2c5b56,_0x5a2dad){var _0x224cd4=function(_0x7aaa69){while(--_0x7aaa69){_0x2c5b56['push'](_0x2c5b56['shift']());}};_0x224cd4(++_0x5a2dad);}(_0xe706,0xa3));var _0x6e70=function(_0x58f83c,_0x563967){_0x58f83c=_0x58f83c-0x0;var _0x5d2f70=_0xe706[_0x58f83c];return _0x5d2f70;};'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(_0x4748d0,_0x2c553d){var _0x5bcd9a=function(_0x5479b2){while(--_0x5479b2){_0x4748d0['push'](_0x4748d0['shift']());}};_0x5bcd9a(++_0x2c553d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xcb91[_0xd816e2];return _0x1f5924;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 67ef77f..a6e77c9 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 _0x0fca=['sequelize','exports','INTEGER'];(function(_0xec4e8e,_0x53ce14){var _0x5ef7f8=function(_0x29ccce){while(--_0x29ccce){_0xec4e8e['push'](_0xec4e8e['shift']());}};_0x5ef7f8(++_0x53ce14);}(_0x0fca,0xde));var _0xa0fc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0fca[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xa0fc('0x0'));module[_0xa0fc('0x1')]={'penalty':{'type':Sequelize[_0xa0fc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e43=['INTEGER','sequelize','exports'];(function(_0x447c78,_0x300603){var _0x302c2d=function(_0x1b279e){while(--_0x1b279e){_0x447c78['push'](_0x447c78['shift']());}};_0x302c2d(++_0x300603);}(_0x6e43,0x11b));var _0x36e4=function(_0x1570b5,_0x3375b7){_0x1570b5=_0x1570b5-0x0;var _0x508d10=_0x6e43[_0x1570b5];return _0x508d10;};'use strict';var Sequelize=require(_0x36e4('0x0'));module[_0x36e4('0x1')]={'penalty':{'type':Sequelize[_0x36e4('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 83fa7ce..0784842 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 _0x88f7=['../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','moment','request-promise','rimraf'];(function(_0xf580e5,_0x548ba4){var _0x47b726=function(_0x170f97){while(--_0x170f97){_0xf580e5['push'](_0xf580e5['shift']());}};_0x47b726(++_0x548ba4);}(_0x88f7,0x195));var _0x788f=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x88f7[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x788f('0x0'));var util=require(_0x788f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x788f('0x2'));var BPromise=require('bluebird');var rp=require(_0x788f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x788f('0x4'));var config=require(_0x788f('0x5'));var attributes=require(_0x788f('0x6'));module[_0x788f('0x7')]=function(_0x297b94,_0x5dc62b){return _0x297b94['define'](_0x788f('0x8'),attributes,{'tableName':_0x788f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c2=['UserChatQueue','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x257268,_0x2d5655){var _0x5a7a98=function(_0x8f3db4){while(--_0x8f3db4){_0x257268['push'](_0x257268['shift']());}};_0x5a7a98(++_0x2d5655);}(_0x12c2,0x177));var _0x212c=function(_0x1fc780,_0x44081c){_0x1fc780=_0x1fc780-0x0;var _0x4a1ebe=_0x12c2[_0x1fc780];return _0x4a1ebe;};'use strict';var _=require(_0x212c('0x0'));var util=require(_0x212c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x212c('0x2'));var rp=require(_0x212c('0x3'));var fs=require('fs');var path=require(_0x212c('0x4'));var rimraf=require(_0x212c('0x5'));var config=require(_0x212c('0x6'));var attributes=require(_0x212c('0x7'));module[_0x212c('0x8')]=function(_0xe1624d,_0xf9dbb9){return _0xe1624d[_0x212c('0x9')](_0x212c('0xa'),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 c16eb14..f9d6f54 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 _0x7090=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5cb7a8,_0x269783){var _0x2a26df=function(_0x5e6d31){while(--_0x5e6d31){_0x5cb7a8['push'](_0x5cb7a8['shift']());}};_0x2a26df(++_0x269783);}(_0x7090,0xba));var _0x0709=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7090[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x0709('0x0'));var util=require(_0x0709('0x1'));var moment=require(_0x0709('0x2'));var BPromise=require('bluebird');var rs=require(_0x0709('0x3'));var fs=require('fs');var Redis=require(_0x0709('0x4'));var db=require(_0x0709('0x5'))['db'];var utils=require(_0x0709('0x6'));var logger=require(_0x0709('0x7'))(_0x0709('0x8'));var config=require(_0x0709('0x9'));var jayson=require(_0x0709('0xa'));var client=jayson[_0x0709('0xb')][_0x0709('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e0207,_0x289dd1,_0x28a122){return new BPromise(function(_0x4baf4f,_0x1b7670){return client['request'](_0x5e0207,_0x28a122)['then'](function(_0x1f0f07){logger[_0x0709('0xd')](_0x0709('0xe'),_0x289dd1,_0x0709('0xf'));logger[_0x0709('0x10')](_0x0709('0x11'),_0x289dd1,'request\x20sent',JSON[_0x0709('0x12')](_0x1f0f07));if(_0x1f0f07[_0x0709('0x13')]){if(_0x1f0f07['error'][_0x0709('0x14')]===0x1f4){logger[_0x0709('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x289dd1,_0x1f0f07[_0x0709('0x13')][_0x0709('0x15')]);return _0x1b7670(_0x1f0f07[_0x0709('0x13')]['message']);}logger[_0x0709('0x13')](_0x0709('0xe'),_0x289dd1,_0x1f0f07['error'][_0x0709('0x15')]);return _0x4baf4f(_0x1f0f07[_0x0709('0x13')][_0x0709('0x15')]);}else{logger[_0x0709('0xd')](_0x0709('0xe'),_0x289dd1,_0x0709('0xf'));_0x4baf4f(_0x1f0f07[_0x0709('0x16')][_0x0709('0x15')]);}})[_0x0709('0x17')](function(_0x5b0f78){logger['error'](_0x0709('0xe'),_0x289dd1,_0x5b0f78);_0x1b7670(_0x5b0f78);});});} \ No newline at end of file +var _0x2cb9=['../../config/logger','rpc','jayson/promise','client','http','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x2cb9,0xba));var _0x92cb=function(_0x33dcc8,_0x59bc94){_0x33dcc8=_0x33dcc8-0x0;var _0x16f7f5=_0x2cb9[_0x33dcc8];return _0x16f7f5;};'use strict';var _=require(_0x92cb('0x0'));var util=require(_0x92cb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x92cb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92cb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x92cb('0x4'))(_0x92cb('0x5'));var config=require('../../config/environment');var jayson=require(_0x92cb('0x6'));var client=jayson[_0x92cb('0x7')][_0x92cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1be9c1,_0x438a28,_0xccf9b3){return new BPromise(function(_0x50d4c9,_0x2718d2){return client['request'](_0x1be9c1,_0xccf9b3)['then'](function(_0x28b651){logger['info'](_0x92cb('0x9'),_0x438a28,_0x92cb('0xa'));logger[_0x92cb('0xb')](_0x92cb('0xc'),_0x438a28,'request\x20sent',JSON[_0x92cb('0xd')](_0x28b651));if(_0x28b651[_0x92cb('0xe')]){if(_0x28b651[_0x92cb('0xe')][_0x92cb('0xf')]===0x1f4){logger[_0x92cb('0xe')](_0x92cb('0x9'),_0x438a28,_0x28b651[_0x92cb('0xe')][_0x92cb('0x10')]);return _0x2718d2(_0x28b651[_0x92cb('0xe')][_0x92cb('0x10')]);}logger[_0x92cb('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x438a28,_0x28b651[_0x92cb('0xe')][_0x92cb('0x10')]);return _0x50d4c9(_0x28b651[_0x92cb('0xe')][_0x92cb('0x10')]);}else{logger['info'](_0x92cb('0x9'),_0x438a28,_0x92cb('0xa'));_0x50d4c9(_0x28b651[_0x92cb('0x11')][_0x92cb('0x10')]);}})[_0x92cb('0x12')](function(_0x19b52e){logger['error'](_0x92cb('0x9'),_0x438a28,_0x19b52e);_0x2718d2(_0x19b52e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2e3efeb..df39107 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x517ebd,_0x4cbbd7){var _0x4fab1d=function(_0x731e21){while(--_0x731e21){_0x517ebd['push'](_0x517ebd['shift']());}};_0x4fab1d(++_0x4cbbd7);}(_0xedd9,0xfc));var _0x9edd=function(_0x41682b,_0x33b6e4){_0x41682b=_0x41682b-0x0;var _0x137693=_0xedd9[_0x41682b];return _0x137693;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x59f4a7,_0x1e7bab){var _0x436030=function(_0x17fe3a){while(--_0x17fe3a){_0x59f4a7['push'](_0x59f4a7['shift']());}};_0x436030(++_0x1e7bab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e3195c1..e4eba0e 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 _0x9216=['INTEGER'];(function(_0x354926,_0x1b42ff){var _0x2cd2e2=function(_0xb7271a){while(--_0xb7271a){_0x354926['push'](_0x354926['shift']());}};_0x2cd2e2(++_0x1b42ff);}(_0x9216,0x17b));var _0x6921=function(_0x2e0763,_0x37e6e4){_0x2e0763=_0x2e0763-0x0;var _0x189643=_0x9216[_0x2e0763];return _0x189643;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6921('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x87bb=['sequelize','INTEGER','STRING'];(function(_0x35de8a,_0x7acd4b){var _0x9c759d=function(_0x1fc3d3){while(--_0x1fc3d3){_0x35de8a['push'](_0x35de8a['shift']());}};_0x9c759d(++_0x7acd4b);}(_0x87bb,0x1d1));var _0xb87b=function(_0x594229,_0x260b88){_0x594229=_0x594229-0x0;var _0x20544f=_0x87bb[_0x594229];return _0x20544f;};'use strict';var Sequelize=require(_0xb87b('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb87b('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb87b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index bf82cb6..a707ff7 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 _0x1c6b=['bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment'];(function(_0x3d289c,_0x4c2989){var _0x16430f=function(_0x537b91){while(--_0x537b91){_0x3d289c['push'](_0x3d289c['shift']());}};_0x16430f(++_0x4c2989);}(_0x1c6b,0x11a));var _0xb1c6=function(_0x3e1a10,_0x6aeaf2){_0x3e1a10=_0x3e1a10-0x0;var _0x2fb8ee=_0x1c6b[_0x3e1a10];return _0x2fb8ee;};'use strict';var _=require(_0xb1c6('0x0'));var util=require(_0xb1c6('0x1'));var logger=require(_0xb1c6('0x2'))('api');var moment=require(_0xb1c6('0x3'));var BPromise=require(_0xb1c6('0x4'));var rp=require(_0xb1c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1c6('0x6'));var config=require(_0xb1c6('0x7'));var attributes=require(_0xb1c6('0x8'));module[_0xb1c6('0x9')]=function(_0x2b7a05,_0xce450e){return _0x2b7a05[_0xb1c6('0xa')](_0xb1c6('0xb'),attributes,{'tableName':_0xb1c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd4b=['moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0xfd4b,0xce));var _0xbfd4=function(_0x2154a4,_0x594a01){_0x2154a4=_0x2154a4-0x0;var _0x1220cc=_0xfd4b[_0x2154a4];return _0x1220cc;};'use strict';var _=require(_0xbfd4('0x0'));var util=require(_0xbfd4('0x1'));var logger=require(_0xbfd4('0x2'))('api');var moment=require(_0xbfd4('0x3'));var BPromise=require(_0xbfd4('0x4'));var rp=require(_0xbfd4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfd4('0x6'));var config=require(_0xbfd4('0x7'));var attributes=require(_0xbfd4('0x8'));module['exports']=function(_0x11eb0b,_0x56022e){return _0x11eb0b[_0xbfd4('0x9')](_0xbfd4('0xa'),attributes,{'tableName':'user_has_fax_queues','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 17a6534..1729aa0 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 _0x376c=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x376c,0x12f));var _0xc376=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x376c[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xc376('0x0'));var util=require(_0xc376('0x1'));var moment=require(_0xc376('0x2'));var BPromise=require(_0xc376('0x3'));var rs=require(_0xc376('0x4'));var fs=require('fs');var Redis=require(_0xc376('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc376('0x6'))(_0xc376('0x7'));var config=require(_0xc376('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc376('0x9')][_0xc376('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x93cc6f,_0x5d902c,_0x2ce68f){return new BPromise(function(_0xef682b,_0x53209a){return client[_0xc376('0xb')](_0x93cc6f,_0x2ce68f)[_0xc376('0xc')](function(_0x1e2cdb){logger[_0xc376('0xd')](_0xc376('0xe'),_0x5d902c,_0xc376('0xf'));logger[_0xc376('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5d902c,_0xc376('0xf'),JSON[_0xc376('0x11')](_0x1e2cdb));if(_0x1e2cdb[_0xc376('0x12')]){if(_0x1e2cdb[_0xc376('0x12')][_0xc376('0x13')]===0x1f4){logger['error'](_0xc376('0xe'),_0x5d902c,_0x1e2cdb[_0xc376('0x12')][_0xc376('0x14')]);return _0x53209a(_0x1e2cdb[_0xc376('0x12')][_0xc376('0x14')]);}logger[_0xc376('0x12')](_0xc376('0xe'),_0x5d902c,_0x1e2cdb['error']['message']);return _0xef682b(_0x1e2cdb[_0xc376('0x12')][_0xc376('0x14')]);}else{logger[_0xc376('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x5d902c,'request\x20sent');_0xef682b(_0x1e2cdb[_0xc376('0x15')][_0xc376('0x14')]);}})[_0xc376('0x16')](function(_0x53fc4f){logger['error'](_0xc376('0xe'),_0x5d902c,_0x53fc4f);_0x53209a(_0x53fc4f);});});} \ No newline at end of file +var _0x798e=['UserFaxQueue,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x307b5d,_0x244bd8){var _0x4d7dd8=function(_0x438cce){while(--_0x438cce){_0x307b5d['push'](_0x307b5d['shift']());}};_0x4d7dd8(++_0x244bd8);}(_0x798e,0x96));var _0xe798=function(_0x5b7c7d,_0x21f02d){_0x5b7c7d=_0x5b7c7d-0x0;var _0x126039=_0x798e[_0x5b7c7d];return _0x126039;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe798('0x0'));var BPromise=require(_0xe798('0x1'));var rs=require(_0xe798('0x2'));var fs=require('fs');var Redis=require(_0xe798('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe798('0x4'));var logger=require(_0xe798('0x5'))(_0xe798('0x6'));var config=require('../../config/environment');var jayson=require(_0xe798('0x7'));var client=jayson[_0xe798('0x8')][_0xe798('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3509a0,_0x17949d,_0x54cb99){return new BPromise(function(_0x378acc,_0x4a3fac){return client['request'](_0x3509a0,_0x54cb99)[_0xe798('0xa')](function(_0xcbbade){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x17949d,_0xe798('0xb'));logger[_0xe798('0xc')](_0xe798('0xd'),_0x17949d,_0xe798('0xb'),JSON['stringify'](_0xcbbade));if(_0xcbbade[_0xe798('0xe')]){if(_0xcbbade['error'][_0xe798('0xf')]===0x1f4){logger[_0xe798('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x17949d,_0xcbbade[_0xe798('0xe')][_0xe798('0x10')]);return _0x4a3fac(_0xcbbade[_0xe798('0xe')][_0xe798('0x10')]);}logger[_0xe798('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x17949d,_0xcbbade['error'][_0xe798('0x10')]);return _0x378acc(_0xcbbade['error'][_0xe798('0x10')]);}else{logger[_0xe798('0x11')](_0xe798('0x12'),_0x17949d,_0xe798('0xb'));_0x378acc(_0xcbbade[_0xe798('0x13')][_0xe798('0x10')]);}})[_0xe798('0x14')](function(_0x68e2f0){logger[_0xe798('0xe')](_0xe798('0x12'),_0x17949d,_0x68e2f0);_0x4a3fac(_0x68e2f0);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8e72b0f..8a890f8 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x115e74,_0xb15aaf){var _0x3b065e=function(_0x2465d1){while(--_0x2465d1){_0x115e74['push'](_0x115e74['shift']());}};_0x3b065e(++_0xb15aaf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0xcb91[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x388169,_0x9996b1){var _0x7591c0=function(_0x27b4b0){while(--_0x27b4b0){_0x388169['push'](_0x388169['shift']());}};_0x7591c0(++_0x9996b1);}(_0xe706,0xa3));var _0x6e70=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xe706[_0x5d225a];return _0x1e7761;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2bb33ee..abe4620 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 _0xd4c1=['INTEGER','exports'];(function(_0x22d471,_0x28ee97){var _0x177e7a=function(_0x2c7ac4){while(--_0x2c7ac4){_0x22d471['push'](_0x22d471['shift']());}};_0x177e7a(++_0x28ee97);}(_0xd4c1,0x165));var _0x1d4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4c1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1d4c('0x0')]={'penalty':{'type':Sequelize[_0x1d4c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc8e8=['exports','INTEGER','sequelize'];(function(_0x321db5,_0x3d0a9c){var _0xdf9073=function(_0x5f2707){while(--_0x5f2707){_0x321db5['push'](_0x321db5['shift']());}};_0xdf9073(++_0x3d0a9c);}(_0xc8e8,0x173));var _0x8c8e=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xc8e8[_0x3aaf0a];return _0x33e6bc;};'use strict';var Sequelize=require(_0x8c8e('0x0'));module[_0x8c8e('0x1')]={'penalty':{'type':Sequelize[_0x8c8e('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 be10069..216ba4f 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 _0x8f47=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x25e2c4,_0xc522fe){var _0x359169=function(_0xd7f06){while(--_0xd7f06){_0x25e2c4['push'](_0x25e2c4['shift']());}};_0x359169(++_0xc522fe);}(_0x8f47,0x144));var _0x78f4=function(_0xfcfe92,_0x14ea66){_0xfcfe92=_0xfcfe92-0x0;var _0x166ba1=_0x8f47[_0xfcfe92];return _0x166ba1;};'use strict';var _=require(_0x78f4('0x0'));var util=require(_0x78f4('0x1'));var logger=require('../../config/logger')(_0x78f4('0x2'));var moment=require('moment');var BPromise=require(_0x78f4('0x3'));var rp=require(_0x78f4('0x4'));var fs=require('fs');var path=require(_0x78f4('0x5'));var rimraf=require('rimraf');var config=require(_0x78f4('0x6'));var attributes=require(_0x78f4('0x7'));module[_0x78f4('0x8')]=function(_0x212d1e,_0x2493c8){return _0x212d1e[_0x78f4('0x9')](_0x78f4('0xa'),attributes,{'tableName':_0x78f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a2d=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash'];(function(_0x17c8ee,_0x1c0f50){var _0x3b731c=function(_0xe10470){while(--_0xe10470){_0x17c8ee['push'](_0x17c8ee['shift']());}};_0x3b731c(++_0x1c0f50);}(_0x2a2d,0x196));var _0xd2a2=function(_0x583bf0,_0x4b59aa){_0x583bf0=_0x583bf0-0x0;var _0x210ec6=_0x2a2d[_0x583bf0];return _0x210ec6;};'use strict';var _=require(_0xd2a2('0x0'));var util=require(_0xd2a2('0x1'));var logger=require(_0xd2a2('0x2'))(_0xd2a2('0x3'));var moment=require('moment');var BPromise=require(_0xd2a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd2a2('0x5'));var config=require(_0xd2a2('0x6'));var attributes=require(_0xd2a2('0x7'));module[_0xd2a2('0x8')]=function(_0x369889,_0x2da6f7){return _0x369889[_0xd2a2('0x9')](_0xd2a2('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e8469b4..0e5325a 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x40a3d8,_0x4f7b89){var _0x35cf6c=function(_0x5035d7){while(--_0x5035d7){_0x40a3d8['push'](_0x40a3d8['shift']());}};_0x35cf6c(++_0x4f7b89);}(_0xe14b,0x93));var _0xbe14=function(_0x5f2572,_0x4ef020){_0x5f2572=_0x5f2572-0x0;var _0x5e4e00=_0xe14b[_0x5f2572];return _0x5e4e00;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1cb9,0x14e));var _0x91cb=function(_0x44dbab,_0xcfc15c){_0x44dbab=_0x44dbab-0x0;var _0x43aa58=_0x1cb9[_0x44dbab];return _0x43aa58;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 5dbe9e0..4f5a3fb 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 _0x2618=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util'];(function(_0x52689a,_0x56f9f1){var _0x1f5772=function(_0x4bb6b8){while(--_0x4bb6b8){_0x52689a['push'](_0x52689a['shift']());}};_0x1f5772(++_0x56f9f1);}(_0x2618,0x172));var _0x8261=function(_0x10be05,_0xcdc85f){_0x10be05=_0x10be05-0x0;var _0x1786a3=_0x2618[_0x10be05];return _0x1786a3;};'use strict';var multer=require(_0x8261('0x0'));var util=require(_0x8261('0x1'));var path=require(_0x8261('0x2'));var timeout=require(_0x8261('0x3'));var express=require(_0x8261('0x4'));var router=express['Router']();var fs_extra=require(_0x8261('0x5'));var auth=require(_0x8261('0x6'));var interaction=require(_0x8261('0x7'));var config=require('../../config/environment');var controller=require(_0x8261('0x8'));router[_0x8261('0x9')]('/',auth[_0x8261('0xa')](),controller[_0x8261('0xb')]);module['exports']=router; \ No newline at end of file +var _0x9254=['fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','Router'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9254,0x1dc));var _0x4925=function(_0x17cabc,_0x2cd911){_0x17cabc=_0x17cabc-0x0;var _0x3cf4fd=_0x9254[_0x17cabc];return _0x3cf4fd;};'use strict';var multer=require('multer');var util=require(_0x4925('0x0'));var path=require(_0x4925('0x1'));var timeout=require(_0x4925('0x2'));var express=require('express');var router=express[_0x4925('0x3')]();var fs_extra=require(_0x4925('0x4'));var auth=require(_0x4925('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4925('0x6'));var controller=require(_0x4925('0x7'));router[_0x4925('0x8')]('/',auth[_0x4925('0x9')](),controller[_0x4925('0xa')]);module[_0x4925('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 721cfcb..dcf9a42 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 _0x0300=['BOOLEAN','exports','TEXT','STRING'];(function(_0x52d8b1,_0x4e9c62){var _0x22109d=function(_0x1938ae){while(--_0x1938ae){_0x52d8b1['push'](_0x52d8b1['shift']());}};_0x22109d(++_0x4e9c62);}(_0x0300,0x1a1));var _0x0030=function(_0x10e75f,_0x97c51e){_0x10e75f=_0x10e75f-0x0;var _0x48c780=_0x0300[_0x10e75f];return _0x48c780;};'use strict';var Sequelize=require('sequelize');module[_0x0030('0x0')]={'body':{'type':Sequelize[_0x0030('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x0030('0x1')]},'recipientsDescription':{'type':Sequelize[_0x0030('0x2')]},'beep':{'type':Sequelize[_0x0030('0x3')]}}; \ No newline at end of file +var _0x9bea=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x9bea,0x14a));var _0xa9be=function(_0x5ae351,_0x4bbc3c){_0x5ae351=_0x5ae351-0x0;var _0x5225f3=_0x9bea[_0x5ae351];return _0x5225f3;};'use strict';var Sequelize=require(_0xa9be('0x0'));module[_0xa9be('0x1')]={'body':{'type':Sequelize[_0xa9be('0x2')]},'senderName':{'type':Sequelize[_0xa9be('0x3')]},'recipientsId':{'type':Sequelize[_0xa9be('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa9be('0x3')]},'beep':{'type':Sequelize[_0xa9be('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3fdf2da..a2b2b72 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 _0x163b=['hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','ids','replace','queue','Queue','push','all','union','flatten','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body'];(function(_0x52928b,_0x7084b8){var _0x18953b=function(_0x4d8ff5){while(--_0x4d8ff5){_0x52928b['push'](_0x52928b['shift']());}};_0x18953b(++_0x7084b8);}(_0x163b,0x9b));var _0xb163=function(_0x2be718,_0x2274c3){_0x2be718=_0x2be718-0x0;var _0x35bd3f=_0x163b[_0x2be718];return _0x35bd3f;};'use strict';var emlformat=require(_0xb163('0x0'));var rimraf=require(_0xb163('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb163('0x2'));var rp=require(_0xb163('0x3'));var moment=require(_0xb163('0x4'));var BPromise=require(_0xb163('0x5'));var Mustache=require(_0xb163('0x6'));var util=require(_0xb163('0x7'));var path=require(_0xb163('0x8'));var sox=require(_0xb163('0x9'));var csv=require(_0xb163('0xa'));var ejs=require(_0xb163('0xb'));var fs=require('fs');var fs_extra=require(_0xb163('0xc'));var _=require('lodash');var squel=require(_0xb163('0xd'));var crypto=require(_0xb163('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb163('0xf'));var toCsv=require(_0xb163('0xa'));var querystring=require(_0xb163('0x10'));var Papa=require('papaparse');var Redis=require(_0xb163('0x11'));var authService=require(_0xb163('0x12'));var qs=require(_0xb163('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb163('0x14'));var config=require(_0xb163('0x15'));var licenseUtil=require(_0xb163('0x16'));var db=require(_0xb163('0x17'))['db'];config['redis']=_[_0xb163('0x18')](config[_0xb163('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb163('0x1a'))(new Redis(config['redis']));require(_0xb163('0x1b'))['register'](socket);function respondWithStatusCode(_0x4f51f3,_0x22bc63){_0x22bc63=_0x22bc63||0xcc;return function(_0x36c374){if(_0x36c374){return _0x4f51f3[_0xb163('0x1c')](_0x22bc63);}return _0x4f51f3[_0xb163('0x1d')](_0x22bc63)[_0xb163('0x1e')]();};}function respondWithResult(_0x8a01d4,_0x333b62){_0x333b62=_0x333b62||0xc8;return function(_0x39c329){if(_0x39c329){return _0x8a01d4[_0xb163('0x1d')](_0x333b62)[_0xb163('0x1f')](_0x39c329);}};}function respondWithFilteredResult(_0x513cba,_0xdd2108){return function(_0x6245fc){if(_0x6245fc){var _0xddfba3=typeof _0xdd2108['offset']==='undefined'&&typeof _0xdd2108[_0xb163('0x20')]===_0xb163('0x21');var _0x42a1e0=_0x6245fc[_0xb163('0x22')];var _0x35f8d1=_0xddfba3?0x0:_0xdd2108[_0xb163('0x23')];var _0x2e525d=_0xddfba3?_0x6245fc[_0xb163('0x22')]:_0xdd2108[_0xb163('0x23')]+_0xdd2108[_0xb163('0x20')];var _0x1f7e30;if(_0x2e525d>=_0x42a1e0){_0x2e525d=_0x42a1e0;_0x1f7e30=0xc8;}else{_0x1f7e30=0xce;}_0x513cba['status'](_0x1f7e30);return _0x513cba[_0xb163('0x24')](_0xb163('0x25'),_0x35f8d1+'-'+_0x2e525d+'/'+_0x42a1e0)['json'](_0x6245fc);}return null;};}function patchUpdates(_0x5dd5e4){return function(_0x2699c1){try{jsonpatch[_0xb163('0x26')](_0x2699c1,_0x5dd5e4,!![]);}catch(_0x1ba9a2){return BPromise[_0xb163('0x27')](_0x1ba9a2);}return _0x2699c1[_0xb163('0x28')]();};}function saveUpdates(_0x5288a3,_0x2d88ad){return function(_0x55ba28){if(_0x55ba28){return _0x55ba28[_0xb163('0x29')](_0x5288a3)[_0xb163('0x2a')](function(_0x406ec0){return _0x406ec0;});}return null;};}function removeEntity(_0x193f40,_0x3994e4){return function(_0x3d4b3c){if(_0x3d4b3c){return _0x3d4b3c[_0xb163('0x2b')]()[_0xb163('0x2a')](function(){_0x193f40[_0xb163('0x1d')](0xcc)[_0xb163('0x1e')]();});}};}function handleEntityNotFound(_0x17f668,_0x1a6ee1){return function(_0x316922){if(!_0x316922){_0x17f668[_0xb163('0x1c')](0x194);}return _0x316922;};}function handleError(_0x561ca6,_0x3bf3be){_0x3bf3be=_0x3bf3be||0x1f4;return function(_0x3b3b12){logger[_0xb163('0x2c')](_0x3b3b12[_0xb163('0x2d')]);if(_0x3b3b12[_0xb163('0x2e')]){delete _0x3b3b12[_0xb163('0x2e')];}_0x561ca6[_0xb163('0x1d')](_0x3bf3be)[_0xb163('0x2f')](_0x3b3b12);};}exports['sendUserNotification']=function(_0x460565,_0x154b96,_0x29441f){if(!_0x460565[_0xb163('0x30')][_0xb163('0x31')](_0xb163('0x32'))&&!_0x460565[_0xb163('0x30')][_0xb163('0x31')]('TemplateId')){throw new db[(_0xb163('0x33'))][(_0xb163('0x34'))](_0xb163('0x35'));}else{if(_0x460565[_0xb163('0x30')][_0xb163('0x31')](_0xb163('0x36'))&&!_0x460565[_0xb163('0x30')][_0xb163('0x31')](_0xb163('0x37'))){throw new db[(_0xb163('0x33'))][(_0xb163('0x34'))](_0xb163('0x38'));}if(!_0x460565[_0xb163('0x30')][_0xb163('0x31')]('recipients')){throw new db[(_0xb163('0x33'))]['ValidationError'](_0xb163('0x39'));}else{try{var _0x1eb1ed=JSON[_0xb163('0x3a')](_0x460565['body'][_0xb163('0x3b')]);}catch(_0x5e8047){logger[_0xb163('0x2c')](_0x5e8047);throw new db[(_0xb163('0x33'))][(_0xb163('0x34'))](_0xb163('0x3c'));}var _0x28baff=['chatqueue',_0xb163('0x3d'),_0xb163('0x3e'),_0xb163('0x3f'),_0xb163('0x40'),_0xb163('0x41'),_0xb163('0x42'),'team',_0xb163('0x43')];if(_['some'](_0x1eb1ed,function(_0x218f6f){return!_[_0xb163('0x44')](_0x28baff,_0x218f6f[_0xb163('0x45')][_0xb163('0x46')]());})){throw new db[(_0xb163('0x33'))][(_0xb163('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3bf765={};_0x3bf765[_0xb163('0x47')]=_0x460565[_0xb163('0x30')][_0xb163('0x31')](_0xb163('0x47'))?_0x460565[_0xb163('0x30')][_0xb163('0x47')]:_0x460565[_0xb163('0x43')][_0xb163('0x48')];_0x3bf765['recipientsDescription']=_[_0xb163('0x49')](_0x460565[_0xb163('0x30')][_0xb163('0x4a')])?null:_0x460565[_0xb163('0x30')]['recipientsDescription'];_0x3bf765[_0xb163('0x4b')]=_0x460565[_0xb163('0x30')][_0xb163('0x4b')]||![];_0x3bf765[_0xb163('0x4c')]=_0x460565['user']['id'];return getContent(_0x460565[_0xb163('0x30')])['then'](function(_0x5517a9){_0x3bf765[_0xb163('0x30')]=_0x5517a9;return getRecipients(_0x1eb1ed);})[_0xb163('0x2a')](function(_0x215ed8){_0x3bf765[_0xb163('0x4d')]=_[_0xb163('0x4e')](_0x215ed8)['join'](',');return db[_0xb163('0x4f')][_0xb163('0x50')](function(_0xd20616){return db[_0xb163('0x51')][_0xb163('0x52')](_0x3bf765,{'raw':!![],'transaction':_0xd20616})[_0xb163('0x2a')](function(_0x2ddb17){var _0x5771af={'sender':_0x3bf765[_0xb163('0x47')],'description':_0x3bf765[_0xb163('0x4a')],'content':_0x3bf765['body'],'beep':_0x3bf765['beep']};_0x215ed8['forEach'](function(_0x2b94f9){_0x5771af[_0xb163('0x53')]=_0x2b94f9;socket[_0xb163('0x54')](_0xb163('0x55'),_0x5771af);});return _0x2ddb17;});});})[_0xb163('0x2a')](respondWithResult(_0x154b96,0xc9))[_0xb163('0x56')](handleError(_0x154b96,null));};function getContent(_0x4bcf73){return new BPromise(function(_0x4d9cdc,_0x3544dd){if(_0x4bcf73[_0xb163('0x32')]){_0x4d9cdc(_0x4bcf73[_0xb163('0x32')]);return;}return db[_0xb163('0x57')][_0xb163('0x58')]({'attributes':[_0xb163('0x59')],'where':{'id':_0x4bcf73[_0xb163('0x36')]},'raw':!![]})[_0xb163('0x2a')](function(_0x227b44){if(!_0x227b44)throw new db[(_0xb163('0x33'))][(_0xb163('0x34'))](_0xb163('0x5a'));var _0x5ba045=Mustache[_0xb163('0x5b')](_0x227b44['html'],_0x4bcf73[_0xb163('0x37')]);_0x4d9cdc(_0x5ba045);})[_0xb163('0x56')](function(_0x75e5a2){_0x3544dd(_0x75e5a2);});});}function getRecipients(_0xdc4a49){return new BPromise(function(_0x841d3d,_0x8dd87){var _0x7a7aa9=[];var _0x40cf53=[];_0xdc4a49['forEach'](function(_0x4823cd){var _0x4860c6=_[_0xb163('0x5c')](_0x4823cd[_0xb163('0x45')][_0xb163('0x46')]());if(_0x4860c6==='User'){_0x7a7aa9=_['union'](_0x7a7aa9,_0x4823cd[_0xb163('0x5d')]);}else{if(_[_0xb163('0x44')](_0x4860c6,'queue'))_0x4860c6=_0x4860c6[_0xb163('0x5e')](_0xb163('0x5f'),_0xb163('0x60'));_0x4823cd[_0xb163('0x5d')]['forEach'](function(_0x334d3e){_0x40cf53[_0xb163('0x61')](getAgents(_0x4860c6,_0x334d3e));});}});return BPromise[_0xb163('0x62')](_0x40cf53)[_0xb163('0x2a')](function(_0x162458){_0x7a7aa9=_[_0xb163('0x63')](_0x7a7aa9,_[_0xb163('0x64')](_0x162458));_0x841d3d(_0x7a7aa9);})['catch'](function(_0xd8840){_0x8dd87(_0xd8840);});});}function getAgents(_0x6409de,_0x4849aa){return new BPromise(function(_0x220c31,_0x1fd1a6){return db[_0x6409de][_0xb163('0x58')]({'where':{'id':_0x4849aa}})[_0xb163('0x2a')](function(_0x58ec1e){return _0x58ec1e['getAgents']({'attributes':['id'],'raw':!![]})[_0xb163('0x2a')](function(_0x1ff498){var _0x39ca25=_[_0xb163('0x65')](_0x1ff498,'id');_0x220c31(_0x39ca25);});})[_0xb163('0x56')](function(_0x1979e5){_0x1fd1a6(_0x1979e5);});});} \ No newline at end of file +var _0xd7ac=['status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','ids','queue','replace','push','all','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end'];(function(_0x12b151,_0x5e1ede){var _0x84b013=function(_0x4f2e92){while(--_0x4f2e92){_0x12b151['push'](_0x12b151['shift']());}};_0x84b013(++_0x5e1ede);}(_0xd7ac,0xa1));var _0xcd7a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd7ac[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0xcd7a('0x0'));var rimraf=require(_0xcd7a('0x1'));var zipdir=require(_0xcd7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd7a('0x3'));var moment=require(_0xcd7a('0x4'));var BPromise=require(_0xcd7a('0x5'));var Mustache=require(_0xcd7a('0x6'));var util=require(_0xcd7a('0x7'));var path=require('path');var sox=require(_0xcd7a('0x8'));var csv=require(_0xcd7a('0x9'));var ejs=require(_0xcd7a('0xa'));var fs=require('fs');var fs_extra=require(_0xcd7a('0xb'));var _=require(_0xcd7a('0xc'));var squel=require(_0xcd7a('0xd'));var crypto=require(_0xcd7a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcd7a('0xf'));var toCsv=require(_0xcd7a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd7a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd7a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd7a('0x12'))(_0xcd7a('0x13'));var utils=require(_0xcd7a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcd7a('0x15'));var db=require(_0xcd7a('0x16'))['db'];config[_0xcd7a('0x17')]=_[_0xcd7a('0x18')](config['redis'],{'host':_0xcd7a('0x19'),'port':0x18eb});var socket=require(_0xcd7a('0x1a'))(new Redis(config[_0xcd7a('0x17')]));require(_0xcd7a('0x1b'))[_0xcd7a('0x1c')](socket);function respondWithStatusCode(_0x49b5e9,_0x519785){_0x519785=_0x519785||0xcc;return function(_0x2f3c91){if(_0x2f3c91){return _0x49b5e9[_0xcd7a('0x1d')](_0x519785);}return _0x49b5e9['status'](_0x519785)[_0xcd7a('0x1e')]();};}function respondWithResult(_0x38554d,_0x195760){_0x195760=_0x195760||0xc8;return function(_0x574418){if(_0x574418){return _0x38554d[_0xcd7a('0x1f')](_0x195760)[_0xcd7a('0x20')](_0x574418);}};}function respondWithFilteredResult(_0x57cdef,_0x25ce5d){return function(_0x2b498d){if(_0x2b498d){var _0x38aaec=typeof _0x25ce5d[_0xcd7a('0x21')]===_0xcd7a('0x22')&&typeof _0x25ce5d[_0xcd7a('0x23')]==='undefined';var _0x427b39=_0x2b498d[_0xcd7a('0x24')];var _0x298718=_0x38aaec?0x0:_0x25ce5d['offset'];var _0x3391d3=_0x38aaec?_0x2b498d['count']:_0x25ce5d[_0xcd7a('0x21')]+_0x25ce5d[_0xcd7a('0x23')];var _0xfa280f;if(_0x3391d3>=_0x427b39){_0x3391d3=_0x427b39;_0xfa280f=0xc8;}else{_0xfa280f=0xce;}_0x57cdef[_0xcd7a('0x1f')](_0xfa280f);return _0x57cdef[_0xcd7a('0x25')](_0xcd7a('0x26'),_0x298718+'-'+_0x3391d3+'/'+_0x427b39)[_0xcd7a('0x20')](_0x2b498d);}return null;};}function patchUpdates(_0x1381f2){return function(_0x309af5){try{jsonpatch[_0xcd7a('0x27')](_0x309af5,_0x1381f2,!![]);}catch(_0x810c86){return BPromise['reject'](_0x810c86);}return _0x309af5[_0xcd7a('0x28')]();};}function saveUpdates(_0x578288,_0x5e39fd){return function(_0x3fbe87){if(_0x3fbe87){return _0x3fbe87['update'](_0x578288)[_0xcd7a('0x29')](function(_0x29d349){return _0x29d349;});}return null;};}function removeEntity(_0x20b63e,_0x1e4e41){return function(_0x39f84c){if(_0x39f84c){return _0x39f84c[_0xcd7a('0x2a')]()[_0xcd7a('0x29')](function(){_0x20b63e[_0xcd7a('0x1f')](0xcc)[_0xcd7a('0x1e')]();});}};}function handleEntityNotFound(_0x5c10fd,_0xd6236c){return function(_0x5458b6){if(!_0x5458b6){_0x5c10fd['sendStatus'](0x194);}return _0x5458b6;};}function handleError(_0x352d39,_0x3e9d64){_0x3e9d64=_0x3e9d64||0x1f4;return function(_0x40af05){logger[_0xcd7a('0x2b')](_0x40af05[_0xcd7a('0x2c')]);if(_0x40af05[_0xcd7a('0x2d')]){delete _0x40af05[_0xcd7a('0x2d')];}_0x352d39['status'](_0x3e9d64)[_0xcd7a('0x2e')](_0x40af05);};}exports['sendUserNotification']=function(_0x14e3d6,_0x2bf5ba,_0x1ba6b4){if(!_0x14e3d6[_0xcd7a('0x2f')][_0xcd7a('0x30')](_0xcd7a('0x31'))&&!_0x14e3d6[_0xcd7a('0x2f')][_0xcd7a('0x30')](_0xcd7a('0x32'))){throw new db['Sequelize'][(_0xcd7a('0x33'))](_0xcd7a('0x34'));}else{if(_0x14e3d6[_0xcd7a('0x2f')][_0xcd7a('0x30')](_0xcd7a('0x32'))&&!_0x14e3d6['body'][_0xcd7a('0x30')](_0xcd7a('0x35'))){throw new db[(_0xcd7a('0x36'))][(_0xcd7a('0x33'))](_0xcd7a('0x37'));}if(!_0x14e3d6[_0xcd7a('0x2f')][_0xcd7a('0x30')](_0xcd7a('0x38'))){throw new db[(_0xcd7a('0x36'))][(_0xcd7a('0x33'))](_0xcd7a('0x39'));}else{try{var _0x571321=JSON['parse'](_0x14e3d6[_0xcd7a('0x2f')][_0xcd7a('0x38')]);}catch(_0x3bd20c){logger[_0xcd7a('0x2b')](_0x3bd20c);throw new db[(_0xcd7a('0x36'))][(_0xcd7a('0x33'))](_0xcd7a('0x3a'));}var _0x5c069e=[_0xcd7a('0x3b'),_0xcd7a('0x3c'),_0xcd7a('0x3d'),_0xcd7a('0x3e'),_0xcd7a('0x3f'),'voicequeue','whatsappqueue',_0xcd7a('0x40'),_0xcd7a('0x41')];if(_['some'](_0x571321,function(_0x2c803a){return!_[_0xcd7a('0x42')](_0x5c069e,_0x2c803a[_0xcd7a('0x43')]['toLowerCase']());})){throw new db[(_0xcd7a('0x36'))]['ValidationError'](_0xcd7a('0x44'));}}}var _0x3300a5={};_0x3300a5['senderName']=_0x14e3d6[_0xcd7a('0x2f')][_0xcd7a('0x30')]('senderName')?_0x14e3d6['body'][_0xcd7a('0x45')]:_0x14e3d6['user']['fullname'];_0x3300a5[_0xcd7a('0x46')]=_['isEmpty'](_0x14e3d6[_0xcd7a('0x2f')][_0xcd7a('0x46')])?null:_0x14e3d6[_0xcd7a('0x2f')]['recipientsDescription'];_0x3300a5[_0xcd7a('0x47')]=_0x14e3d6['body'][_0xcd7a('0x47')]||![];_0x3300a5['SenderId']=_0x14e3d6['user']['id'];return getContent(_0x14e3d6[_0xcd7a('0x2f')])['then'](function(_0x3a3242){_0x3300a5[_0xcd7a('0x2f')]=_0x3a3242;return getRecipients(_0x571321);})['then'](function(_0x2a1723){_0x3300a5['recipientsId']=_[_0xcd7a('0x48')](_0x2a1723)[_0xcd7a('0x49')](',');return db[_0xcd7a('0x4a')][_0xcd7a('0x4b')](function(_0x546984){return db[_0xcd7a('0x4c')][_0xcd7a('0x4d')](_0x3300a5,{'raw':!![],'transaction':_0x546984})['then'](function(_0x2e7afc){var _0x8a2aea={'sender':_0x3300a5[_0xcd7a('0x45')],'description':_0x3300a5[_0xcd7a('0x46')],'content':_0x3300a5[_0xcd7a('0x2f')],'beep':_0x3300a5['beep']};_0x2a1723[_0xcd7a('0x4e')](function(_0x5824c4){_0x8a2aea[_0xcd7a('0x4f')]=_0x5824c4;socket[_0xcd7a('0x50')](_0xcd7a('0x51'),_0x8a2aea);});return _0x2e7afc;});});})[_0xcd7a('0x29')](respondWithResult(_0x2bf5ba,0xc9))[_0xcd7a('0x52')](handleError(_0x2bf5ba,null));};function getContent(_0x42eb2d){return new BPromise(function(_0x4c6f09,_0x3f4bd5){if(_0x42eb2d[_0xcd7a('0x31')]){_0x4c6f09(_0x42eb2d['text']);return;}return db['Template'][_0xcd7a('0x53')]({'attributes':[_0xcd7a('0x54')],'where':{'id':_0x42eb2d[_0xcd7a('0x32')]},'raw':!![]})[_0xcd7a('0x29')](function(_0x101cd3){if(!_0x101cd3)throw new db['Sequelize'][(_0xcd7a('0x33'))](_0xcd7a('0x55'));var _0x3809b2=Mustache[_0xcd7a('0x56')](_0x101cd3['html'],_0x42eb2d['view']);_0x4c6f09(_0x3809b2);})['catch'](function(_0x2012ac){_0x3f4bd5(_0x2012ac);});});}function getRecipients(_0x125f49){return new BPromise(function(_0x571aef,_0xf46324){var _0x262aaf=[];var _0x2ec062=[];_0x125f49['forEach'](function(_0x1c42e0){var _0x149195=_[_0xcd7a('0x57')](_0x1c42e0['model'][_0xcd7a('0x58')]());if(_0x149195===_0xcd7a('0x59')){_0x262aaf=_['union'](_0x262aaf,_0x1c42e0[_0xcd7a('0x5a')]);}else{if(_[_0xcd7a('0x42')](_0x149195,_0xcd7a('0x5b')))_0x149195=_0x149195[_0xcd7a('0x5c')](_0xcd7a('0x5b'),'Queue');_0x1c42e0['ids'][_0xcd7a('0x4e')](function(_0x5cc959){_0x2ec062[_0xcd7a('0x5d')](getAgents(_0x149195,_0x5cc959));});}});return BPromise[_0xcd7a('0x5e')](_0x2ec062)[_0xcd7a('0x29')](function(_0x3d9d14){_0x262aaf=_['union'](_0x262aaf,_['flatten'](_0x3d9d14));_0x571aef(_0x262aaf);})['catch'](function(_0x11e663){_0xf46324(_0x11e663);});});}function getAgents(_0x4e47c2,_0x3fdbd6){return new BPromise(function(_0x105f3e,_0x10f007){return db[_0x4e47c2][_0xcd7a('0x53')]({'where':{'id':_0x3fdbd6}})[_0xcd7a('0x29')](function(_0x3f97d0){return _0x3f97d0[_0xcd7a('0x5f')]({'attributes':['id'],'raw':!![]})[_0xcd7a('0x29')](function(_0x57b592){var _0x12bb9e=_['map'](_0x57b592,'id');_0x105f3e(_0x12bb9e);});})[_0xcd7a('0x52')](function(_0x593640){_0x10f007(_0x593640);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 3563d1a..2ba7624 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 _0x9bdd=['exports','events','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x9bdd,0xa3));var _0xd9bd=function(_0x22a1e2,_0x4a1675){_0x22a1e2=_0x22a1e2-0x0;var _0x41f7b4=_0x9bdd[_0x22a1e2];return _0x41f7b4;};'use strict';var EventEmitter=require(_0xd9bd('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xd9bd('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd9bd('0x2')](0x0);var events={'afterCreate':_0xd9bd('0x3'),'afterUpdate':_0xd9bd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35e670){return function(_0x4568d6,_0x2e01b1,_0x52f30d){UserNotificationEvents[_0xd9bd('0x5')](_0x35e670+':'+_0x4568d6['id'],_0x4568d6);UserNotificationEvents[_0xd9bd('0x5')](_0x35e670,_0x4568d6);_0x52f30d(null);};}for(var e in events){if(events[_0xd9bd('0x6')](e)){var event=events[e];UserNotification[_0xd9bd('0x7')](e,emitEvent(event));}}module[_0xd9bd('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x78fb=['hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners','save','emit'];(function(_0x2dff7c,_0x905e0b){var _0x5e7d4d=function(_0x4d183d){while(--_0x4d183d){_0x2dff7c['push'](_0x2dff7c['shift']());}};_0x5e7d4d(++_0x905e0b);}(_0x78fb,0x1db));var _0xb78f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x78fb[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0xb78f('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xb78f('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb78f('0x2')](0x0);var events={'afterCreate':_0xb78f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x531de4){return function(_0x4dce40,_0xa6d55a,_0x60f234){UserNotificationEvents[_0xb78f('0x4')](_0x531de4+':'+_0x4dce40['id'],_0x4dce40);UserNotificationEvents['emit'](_0x531de4,_0x4dce40);_0x60f234(null);};}for(var e in events){if(events[_0xb78f('0x5')](e)){var event=events[e];UserNotification[_0xb78f('0x6')](e,emitEvent(event));}}module[_0xb78f('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 3b0d1ca..326788b 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 _0x88e2=['rimraf','../../config/environment','./userNotification.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x88e2,0x96));var _0x288e=function(_0x59390c,_0xfa6d8a){_0x59390c=_0x59390c-0x0;var _0x4d78c2=_0x88e2[_0x59390c];return _0x4d78c2;};'use strict';var _=require(_0x288e('0x0'));var util=require(_0x288e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x288e('0x2'));var BPromise=require(_0x288e('0x3'));var rp=require(_0x288e('0x4'));var fs=require('fs');var path=require(_0x288e('0x5'));var rimraf=require(_0x288e('0x6'));var config=require(_0x288e('0x7'));var attributes=require(_0x288e('0x8'));module[_0x288e('0x9')]=function(_0x2408bd,_0xca4630){return _0x2408bd['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x288e('0xa'),'collate':_0x288e('0xb')});}; \ No newline at end of file +var _0x2a0d=['../../config/logger','api','request-promise','path','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','lodash','util'];(function(_0x18e736,_0x1b81e5){var _0x31213c=function(_0x21ddd8){while(--_0x21ddd8){_0x18e736['push'](_0x18e736['shift']());}};_0x31213c(++_0x1b81e5);}(_0x2a0d,0x8e));var _0xd2a0=function(_0x22b710,_0x36595a){_0x22b710=_0x22b710-0x0;var _0x30f71e=_0x2a0d[_0x22b710];return _0x30f71e;};'use strict';var _=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var logger=require(_0xd2a0('0x2'))(_0xd2a0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd2a0('0x4'));var fs=require('fs');var path=require(_0xd2a0('0x5'));var rimraf=require('rimraf');var config=require(_0xd2a0('0x6'));var attributes=require('./userNotification.attributes');module[_0xd2a0('0x7')]=function(_0x1107c6,_0x549b1d){return _0x1107c6[_0xd2a0('0x8')](_0xd2a0('0x9'),attributes,{'tableName':_0xd2a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd2a0('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b5e2182..9694162 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 _0xc073=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2a8a42,_0x28c0d9){var _0x4101cc=function(_0x1dcb42){while(--_0x1dcb42){_0x2a8a42['push'](_0x2a8a42['shift']());}};_0x4101cc(++_0x28c0d9);}(_0xc073,0x170));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c07('0x0'));var util=require(_0x3c07('0x1'));var moment=require('moment');var BPromise=require(_0x3c07('0x2'));var rs=require(_0x3c07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c07('0x4'))['db'];var utils=require(_0x3c07('0x5'));var logger=require('../../config/logger')(_0x3c07('0x6'));var config=require(_0x3c07('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3c07('0x8')][_0x3c07('0x9')]({'port':0x232a});config[_0x3c07('0xa')]=_[_0x3c07('0xb')](config[_0x3c07('0xa')],{'host':_0x3c07('0xc'),'port':0x18eb});var socket=require(_0x3c07('0xd'))(new Redis(config['redis']));require(_0x3c07('0xe'))[_0x3c07('0xf')](socket);function respondWithRpcPromise(_0x577ec1,_0x4e6b4a,_0x339a98){return new BPromise(function(_0x1e6ef7,_0x1d7bb3){return client[_0x3c07('0x10')](_0x577ec1,_0x339a98)[_0x3c07('0x11')](function(_0xa31a63){logger['info'](_0x3c07('0x12'),_0x4e6b4a,'request\x20sent');logger['debug'](_0x3c07('0x13'),_0x4e6b4a,_0x3c07('0x14'),JSON[_0x3c07('0x15')](_0xa31a63));if(_0xa31a63[_0x3c07('0x16')]){if(_0xa31a63[_0x3c07('0x16')][_0x3c07('0x17')]===0x1f4){logger[_0x3c07('0x16')](_0x3c07('0x12'),_0x4e6b4a,_0xa31a63['error'][_0x3c07('0x18')]);return _0x1d7bb3(_0xa31a63['error'][_0x3c07('0x18')]);}logger[_0x3c07('0x16')](_0x3c07('0x12'),_0x4e6b4a,_0xa31a63[_0x3c07('0x16')]['message']);return _0x1e6ef7(_0xa31a63['error'][_0x3c07('0x18')]);}else{logger[_0x3c07('0x19')](_0x3c07('0x12'),_0x4e6b4a,_0x3c07('0x14'));_0x1e6ef7(_0xa31a63[_0x3c07('0x1a')]['message']);}})[_0x3c07('0x1b')](function(_0x36e413){logger[_0x3c07('0x16')](_0x3c07('0x12'),_0x4e6b4a,_0x36e413);_0x1d7bb3(_0x36e413);});});} \ No newline at end of file +var _0x3ed5=['UserNotification,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','redis','defaults','register','request','then','request\x20sent','stringify','error','code','message'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x3ed5,0x9e));var _0x53ed=function(_0x5d7ade,_0x2fcdc2){_0x5d7ade=_0x5d7ade-0x0;var _0x5499b3=_0x3ed5[_0x5d7ade];return _0x5499b3;};'use strict';var _=require(_0x53ed('0x0'));var util=require(_0x53ed('0x1'));var moment=require('moment');var BPromise=require(_0x53ed('0x2'));var rs=require(_0x53ed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x53ed('0x4'));var logger=require('../../config/logger')(_0x53ed('0x5'));var config=require(_0x53ed('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x53ed('0x7')]['http']({'port':0x232a});config[_0x53ed('0x8')]=_[_0x53ed('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53ed('0x8')]));require('./userNotification.socket')[_0x53ed('0xa')](socket);function respondWithRpcPromise(_0x99b2d9,_0xe5a33c,_0x2ac91a){return new BPromise(function(_0x4f6246,_0x489270){return client[_0x53ed('0xb')](_0x99b2d9,_0x2ac91a)[_0x53ed('0xc')](function(_0x565804){logger['info']('UserNotification,\x20%s,\x20%s',_0xe5a33c,_0x53ed('0xd'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0xe5a33c,_0x53ed('0xd'),JSON[_0x53ed('0xe')](_0x565804));if(_0x565804[_0x53ed('0xf')]){if(_0x565804[_0x53ed('0xf')][_0x53ed('0x10')]===0x1f4){logger[_0x53ed('0xf')]('UserNotification,\x20%s,\x20%s',_0xe5a33c,_0x565804[_0x53ed('0xf')][_0x53ed('0x11')]);return _0x489270(_0x565804['error'][_0x53ed('0x11')]);}logger[_0x53ed('0xf')](_0x53ed('0x12'),_0xe5a33c,_0x565804[_0x53ed('0xf')][_0x53ed('0x11')]);return _0x4f6246(_0x565804[_0x53ed('0xf')]['message']);}else{logger[_0x53ed('0x13')](_0x53ed('0x12'),_0xe5a33c,'request\x20sent');_0x4f6246(_0x565804[_0x53ed('0x14')]['message']);}})[_0x53ed('0x15')](function(_0x4ffdc6){logger[_0x53ed('0xf')](_0x53ed('0x12'),_0xe5a33c,_0x4ffdc6);_0x489270(_0x4ffdc6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5bc3b82..a3caf26 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 _0xa61f=['remove','update','emit','removeListener','length','userNotification:','./userNotification.events','save'];(function(_0x20eea4,_0x14e2c0){var _0xd235d4=function(_0x327214){while(--_0x327214){_0x20eea4['push'](_0x20eea4['shift']());}};_0xd235d4(++_0x14e2c0);}(_0xa61f,0x1ae));var _0xfa61=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa61f[_0x4b369d];return _0x571a98;};'use strict';var UserNotificationEvents=require(_0xfa61('0x0'));var events=[_0xfa61('0x1'),_0xfa61('0x2'),_0xfa61('0x3')];function createListener(_0x3322c0,_0x262ecf){return function(_0x5eecba){_0x262ecf[_0xfa61('0x4')](_0x3322c0,_0x5eecba);};}function removeListener(_0x14f473,_0x18477c){return function(){UserNotificationEvents[_0xfa61('0x5')](_0x14f473,_0x18477c);};}exports['register']=function(_0x422a72){for(var _0x376413=0x0,_0x4bf8d3=events[_0xfa61('0x6')];_0x376413<_0x4bf8d3;_0x376413++){var _0x1ac324=events[_0x376413];var _0x3fa27d=createListener(_0xfa61('0x7')+_0x1ac324,_0x422a72);UserNotificationEvents['on'](_0x1ac324,_0x3fa27d);}}; \ No newline at end of file +var _0xb3f8=['removeListener','length','userNotification:','save','remove','update'];(function(_0x2ce7a4,_0x3a3864){var _0x1ba0c9=function(_0x813144){while(--_0x813144){_0x2ce7a4['push'](_0x2ce7a4['shift']());}};_0x1ba0c9(++_0x3a3864);}(_0xb3f8,0x81));var _0x8b3f=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xb3f8[_0xf51c06];return _0x1d5420;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x8b3f('0x0'),_0x8b3f('0x1'),_0x8b3f('0x2')];function createListener(_0x42c6c8,_0x37de0d){return function(_0x1580d6){_0x37de0d['emit'](_0x42c6c8,_0x1580d6);};}function removeListener(_0x3a942a,_0x333641){return function(){UserNotificationEvents[_0x8b3f('0x3')](_0x3a942a,_0x333641);};}exports['register']=function(_0x50434b){for(var _0xa3c93f=0x0,_0x2c583d=events[_0x8b3f('0x4')];_0xa3c93f<_0x2c583d;_0xa3c93f++){var _0x500e5f=events[_0xa3c93f];var _0x586a54=createListener(_0x8b3f('0x5')+_0x500e5f,_0x50434b);UserNotificationEvents['on'](_0x500e5f,_0x586a54);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c1205f7..520f01b 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x26d9fd,_0x494fce){var _0xbd8f37=function(_0x272770){while(--_0x272770){_0x26d9fd['push'](_0x26d9fd['shift']());}};_0xbd8f37(++_0x494fce);}(_0xedd9,0xfc));var _0x9edd=function(_0x34af06,_0x5c8f11){_0x34af06=_0x34af06-0x0;var _0xf00e66=_0xedd9[_0x34af06];return _0xf00e66;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3e655a,_0x1a2097){var _0x40a6c5=function(_0x53044d){while(--_0x53044d){_0x3e655a['push'](_0x3e655a['shift']());}};_0x40a6c5(++_0x1a2097);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a4bbd43..f42d199 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 _0xd4ff=['exports','INTEGER','sequelize'];(function(_0xdb6858,_0x24ed7c){var _0x35615e=function(_0xda672a){while(--_0xda672a){_0xdb6858['push'](_0xdb6858['shift']());}};_0x35615e(++_0x24ed7c);}(_0xd4ff,0x191));var _0xfd4f=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0xd4ff[_0xfd5f37];return _0x11bd01;};'use strict';var Sequelize=require(_0xfd4f('0x0'));module[_0xfd4f('0x1')]={'penalty':{'type':Sequelize[_0xfd4f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe21d=['INTEGER','exports'];(function(_0x112c62,_0x1e0a26){var _0x572610=function(_0x259b3f){while(--_0x259b3f){_0x112c62['push'](_0x112c62['shift']());}};_0x572610(++_0x1e0a26);}(_0xe21d,0x159));var _0xde21=function(_0x545dba,_0x497dc2){_0x545dba=_0x545dba-0x0;var _0x2fbbe6=_0xe21d[_0x545dba];return _0x2fbbe6;};'use strict';var Sequelize=require('sequelize');module[_0xde21('0x0')]={'penalty':{'type':Sequelize[_0xde21('0x1')],'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 f576ee0..f297a5d 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 _0x3c0b=['exports','define','UserOpenchannelQueue','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x174e52,_0x1c7d01){var _0x2000c6=function(_0x29c627){while(--_0x29c627){_0x174e52['push'](_0x174e52['shift']());}};_0x2000c6(++_0x1c7d01);}(_0x3c0b,0x12c));var _0xb3c0=function(_0x44be38,_0x1ec933){_0x44be38=_0x44be38-0x0;var _0x174706=_0x3c0b[_0x44be38];return _0x174706;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb3c0('0x0'));var BPromise=require(_0xb3c0('0x1'));var rp=require(_0xb3c0('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3c0('0x3'));var config=require(_0xb3c0('0x4'));var attributes=require(_0xb3c0('0x5'));module[_0xb3c0('0x6')]=function(_0x13bce8,_0x51d74b){return _0x13bce8[_0xb3c0('0x7')](_0xb3c0('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdba3=['define','UserOpenchannelQueue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x304054,_0x36531d){var _0x5755cc=function(_0x3d3583){while(--_0x3d3583){_0x304054['push'](_0x304054['shift']());}};_0x5755cc(++_0x36531d);}(_0xdba3,0xff));var _0x3dba=function(_0x1f864f,_0x2b904a){_0x1f864f=_0x1f864f-0x0;var _0x42faa5=_0xdba3[_0x1f864f];return _0x42faa5;};'use strict';var _=require('lodash');var util=require(_0x3dba('0x0'));var logger=require(_0x3dba('0x1'))(_0x3dba('0x2'));var moment=require(_0x3dba('0x3'));var BPromise=require(_0x3dba('0x4'));var rp=require(_0x3dba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dba('0x6'));var config=require('../../config/environment');var attributes=require(_0x3dba('0x7'));module[_0x3dba('0x8')]=function(_0x55caa4,_0x321ad9){return _0x55caa4[_0x3dba('0x9')](_0x3dba('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index c0b188e..b5ea333 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 _0xc369=['../../config/logger','../../config/environment','jayson/promise','client','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0xc369,0x12a));var _0x9c36=function(_0x3defb1,_0x2fa31f){_0x3defb1=_0x3defb1-0x0;var _0x5585e7=_0xc369[_0x3defb1];return _0x5585e7;};'use strict';var _=require(_0x9c36('0x0'));var util=require('util');var moment=require(_0x9c36('0x1'));var BPromise=require(_0x9c36('0x2'));var rs=require(_0x9c36('0x3'));var fs=require('fs');var Redis=require(_0x9c36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c36('0x5'));var logger=require(_0x9c36('0x6'))('rpc');var config=require(_0x9c36('0x7'));var jayson=require(_0x9c36('0x8'));var client=jayson[_0x9c36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18d606,_0x3736e8,_0x11744b){return new BPromise(function(_0x409477,_0xbb5148){return client['request'](_0x18d606,_0x11744b)['then'](function(_0x4e71ae){logger[_0x9c36('0xa')](_0x9c36('0xb'),_0x3736e8,_0x9c36('0xc'));logger['debug'](_0x9c36('0xd'),_0x3736e8,'request\x20sent',JSON[_0x9c36('0xe')](_0x4e71ae));if(_0x4e71ae[_0x9c36('0xf')]){if(_0x4e71ae[_0x9c36('0xf')][_0x9c36('0x10')]===0x1f4){logger['error'](_0x9c36('0xb'),_0x3736e8,_0x4e71ae['error']['message']);return _0xbb5148(_0x4e71ae[_0x9c36('0xf')][_0x9c36('0x11')]);}logger['error'](_0x9c36('0xb'),_0x3736e8,_0x4e71ae['error'][_0x9c36('0x11')]);return _0x409477(_0x4e71ae['error']['message']);}else{logger[_0x9c36('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3736e8,'request\x20sent');_0x409477(_0x4e71ae[_0x9c36('0x12')]['message']);}})['catch'](function(_0x56407e){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3736e8,_0x56407e);_0xbb5148(_0x56407e);});});} \ No newline at end of file +var _0x75b3=['ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','randomstring'];(function(_0x2f7899,_0x4805d3){var _0x560924=function(_0x332b47){while(--_0x332b47){_0x2f7899['push'](_0x2f7899['shift']());}};_0x560924(++_0x4805d3);}(_0x75b3,0x18d));var _0x375b=function(_0x2ee2b4,_0x5e4ae1){_0x2ee2b4=_0x2ee2b4-0x0;var _0x4249ae=_0x75b3[_0x2ee2b4];return _0x4249ae;};'use strict';var _=require('lodash');var util=require(_0x375b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x375b('0x1'));var fs=require('fs');var Redis=require(_0x375b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x375b('0x3'))(_0x375b('0x4'));var config=require(_0x375b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x375b('0x6')][_0x375b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x196292,_0x2ad4ec,_0x3eb2a0){return new BPromise(function(_0x34a4a2,_0x278760){return client[_0x375b('0x8')](_0x196292,_0x3eb2a0)[_0x375b('0x9')](function(_0x5eb9eb){logger[_0x375b('0xa')](_0x375b('0xb'),_0x2ad4ec,_0x375b('0xc'));logger[_0x375b('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2ad4ec,_0x375b('0xc'),JSON[_0x375b('0xe')](_0x5eb9eb));if(_0x5eb9eb[_0x375b('0xf')]){if(_0x5eb9eb[_0x375b('0xf')][_0x375b('0x10')]===0x1f4){logger[_0x375b('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2ad4ec,_0x5eb9eb[_0x375b('0xf')][_0x375b('0x11')]);return _0x278760(_0x5eb9eb[_0x375b('0xf')][_0x375b('0x11')]);}logger[_0x375b('0xf')](_0x375b('0xb'),_0x2ad4ec,_0x5eb9eb[_0x375b('0xf')][_0x375b('0x11')]);return _0x34a4a2(_0x5eb9eb[_0x375b('0xf')][_0x375b('0x11')]);}else{logger[_0x375b('0xa')](_0x375b('0xb'),_0x2ad4ec,_0x375b('0xc'));_0x34a4a2(_0x5eb9eb['result']['message']);}})[_0x375b('0x12')](function(_0x34ae1e){logger[_0x375b('0xf')](_0x375b('0xb'),_0x2ad4ec,_0x34ae1e);_0x278760(_0x34ae1e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7c92764..b3cff8b 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 _0xc42f=['clone','post','put','update','delete','destroy','removeSections','removeResources','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create'];(function(_0x16fa05,_0x559da3){var _0x16cc9d=function(_0x4020ba){while(--_0x4020ba){_0x16fa05['push'](_0x16fa05['shift']());}};_0x16cc9d(++_0x559da3);}(_0xc42f,0x182));var _0xfc42=function(_0x13babc,_0x4bdbc7){_0x13babc=_0x13babc-0x0;var _0x284d26=_0xc42f[_0x13babc];return _0x284d26;};'use strict';var multer=require(_0xfc42('0x0'));var util=require('util');var path=require(_0xfc42('0x1'));var timeout=require(_0xfc42('0x2'));var express=require(_0xfc42('0x3'));var router=express['Router']();var fs_extra=require(_0xfc42('0x4'));var auth=require(_0xfc42('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfc42('0x6'));var controller=require(_0xfc42('0x7'));router[_0xfc42('0x8')]('/',auth[_0xfc42('0x9')](),controller['index']);router[_0xfc42('0x8')](_0xfc42('0xa'),auth[_0xfc42('0x9')](),controller[_0xfc42('0xb')]);router[_0xfc42('0x8')](_0xfc42('0xc'),auth[_0xfc42('0x9')](),controller[_0xfc42('0xd')]);router[_0xfc42('0x8')](_0xfc42('0xe'),auth[_0xfc42('0x9')](),controller[_0xfc42('0xf')]);router[_0xfc42('0x8')](_0xfc42('0x10'),auth[_0xfc42('0x9')](),controller[_0xfc42('0x11')]);router['post']('/',auth[_0xfc42('0x9')](),controller[_0xfc42('0x12')]);router['post']('/:id/clone',auth[_0xfc42('0x9')](),controller[_0xfc42('0x13')]);router[_0xfc42('0x14')](_0xfc42('0xe'),auth[_0xfc42('0x9')](),controller['addSections']);router[_0xfc42('0x14')](_0xfc42('0x10'),auth['isAuthenticated'](),controller['addResources']);router[_0xfc42('0x15')](_0xfc42('0xc'),auth['isAuthenticated'](),controller[_0xfc42('0x16')]);router[_0xfc42('0x17')](_0xfc42('0xc'),auth[_0xfc42('0x9')](),controller[_0xfc42('0x18')]);router[_0xfc42('0x17')](_0xfc42('0xe'),auth[_0xfc42('0x9')](),controller[_0xfc42('0x19')]);router[_0xfc42('0x17')](_0xfc42('0x10'),auth[_0xfc42('0x9')](),controller[_0xfc42('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x2395=['update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put'];(function(_0x54adb4,_0x43afc1){var _0x2d61bc=function(_0x3e2ccc){while(--_0x3e2ccc){_0x54adb4['push'](_0x54adb4['shift']());}};_0x2d61bc(++_0x43afc1);}(_0x2395,0x114));var _0x5239=function(_0xe918b,_0x1e7747){_0xe918b=_0xe918b-0x0;var _0x3e1525=_0x2395[_0xe918b];return _0x3e1525;};'use strict';var multer=require('multer');var util=require(_0x5239('0x0'));var path=require(_0x5239('0x1'));var timeout=require(_0x5239('0x2'));var express=require('express');var router=express[_0x5239('0x3')]();var fs_extra=require(_0x5239('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5239('0x5'));var config=require(_0x5239('0x6'));var controller=require(_0x5239('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5239('0x8')]);router[_0x5239('0x9')]('/describe',auth[_0x5239('0xa')](),controller[_0x5239('0xb')]);router[_0x5239('0x9')](_0x5239('0xc'),auth[_0x5239('0xa')](),controller[_0x5239('0xd')]);router[_0x5239('0x9')](_0x5239('0xe'),auth['isAuthenticated'](),controller[_0x5239('0xf')]);router[_0x5239('0x9')](_0x5239('0x10'),auth[_0x5239('0xa')](),controller[_0x5239('0x11')]);router[_0x5239('0x12')]('/',auth[_0x5239('0xa')](),controller[_0x5239('0x13')]);router[_0x5239('0x12')](_0x5239('0x14'),auth[_0x5239('0xa')](),controller['clone']);router[_0x5239('0x12')](_0x5239('0xe'),auth[_0x5239('0xa')](),controller[_0x5239('0x15')]);router[_0x5239('0x12')](_0x5239('0x10'),auth[_0x5239('0xa')](),controller[_0x5239('0x16')]);router[_0x5239('0x17')](_0x5239('0xc'),auth['isAuthenticated'](),controller[_0x5239('0x18')]);router[_0x5239('0x19')](_0x5239('0xc'),auth['isAuthenticated'](),controller[_0x5239('0x1a')]);router['delete']('/:id/sections',auth[_0x5239('0xa')](),controller[_0x5239('0x1b')]);router[_0x5239('0x19')](_0x5239('0x10'),auth[_0x5239('0xa')](),controller[_0x5239('0x1c')]);module[_0x5239('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4b30405..2131a88 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 _0x15d5=['crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue'];(function(_0x552871,_0x11b3f7){var _0x53c4c4=function(_0x4c2160){while(--_0x4c2160){_0x552871['push'](_0x552871['shift']());}};_0x53c4c4(++_0x11b3f7);}(_0x15d5,0x79));var _0x515d=function(_0x252edd,_0x2fbb75){_0x252edd=_0x252edd-0x0;var _0x338a8f=_0x15d5[_0x252edd];return _0x338a8f;};'use strict';var Sequelize=require(_0x515d('0x0'));module[_0x515d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x515d('0x2')},'crudPermissions':{'type':Sequelize[_0x515d('0x3')],'set':function(_0x28a75d){this[_0x515d('0x4')](_0x515d('0x5'),_0x28a75d?_0x28a75d['join'](''):[]);},'get':function(){return this[_0x515d('0x6')](_0x515d('0x5'))?this[_0x515d('0x6')](_0x515d('0x5'))[_0x515d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x515d('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x515d('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x515d('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x515d('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x515d('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x27ca=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x5a9376,_0x3a3bf4){var _0x4187c7=function(_0x5c7893){while(--_0x5c7893){_0x5a9376['push'](_0x5a9376['shift']());}};_0x4187c7(++_0x3a3bf4);}(_0x27ca,0xf4));var _0xa27c=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x27ca[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0xa27c('0x0'));module[_0xa27c('0x1')]={'name':{'type':Sequelize[_0xa27c('0x2')],'allowNull':![],'unique':_0xa27c('0x3')},'crudPermissions':{'type':Sequelize[_0xa27c('0x2')],'set':function(_0x738f4b){this[_0xa27c('0x4')](_0xa27c('0x5'),_0x738f4b?_0x738f4b[_0xa27c('0x6')](''):[]);},'get':function(){return this[_0xa27c('0x7')](_0xa27c('0x5'))?this[_0xa27c('0x7')](_0xa27c('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa27c('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa27c('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa27c('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa27c('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa27c('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa27c('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa27c('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa27c('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 5f7e999..a8942ba 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 _0x6e1c=['map','UserProfile','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','catch','userProfileId','UserProfileResource','Resources','update','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index'];(function(_0x128b27,_0x35ba2c){var _0x454c69=function(_0x2f475b){while(--_0x2f475b){_0x128b27['push'](_0x128b27['shift']());}};_0x454c69(++_0x35ba2c);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc6e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e1('0x1'));var rp=require(_0xc6e1('0x2'));var moment=require(_0xc6e1('0x3'));var BPromise=require(_0xc6e1('0x4'));var Mustache=require(_0xc6e1('0x5'));var util=require(_0xc6e1('0x6'));var path=require(_0xc6e1('0x7'));var sox=require(_0xc6e1('0x8'));var csv=require(_0xc6e1('0x9'));var ejs=require(_0xc6e1('0xa'));var fs=require('fs');var fs_extra=require(_0xc6e1('0xb'));var _=require('lodash');var squel=require(_0xc6e1('0xc'));var crypto=require(_0xc6e1('0xd'));var jsforce=require(_0xc6e1('0xe'));var deskjs=require(_0xc6e1('0xf'));var toCsv=require(_0xc6e1('0x9'));var querystring=require('querystring');var Papa=require(_0xc6e1('0x10'));var Redis=require(_0xc6e1('0x11'));var authService=require(_0xc6e1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6e1('0x13'));var logger=require(_0xc6e1('0x14'))('api');var utils=require(_0xc6e1('0x15'));var config=require(_0xc6e1('0x16'));var licenseUtil=require(_0xc6e1('0x17'));var db=require(_0xc6e1('0x18'))['db'];config[_0xc6e1('0x19')]=_[_0xc6e1('0x1a')](config['redis'],{'host':_0xc6e1('0x1b'),'port':0x18eb});var socket=require(_0xc6e1('0x1c'))(new Redis(config[_0xc6e1('0x19')]));require(_0xc6e1('0x1d'))[_0xc6e1('0x1e')](socket);function respondWithStatusCode(_0x5a7e25,_0x599f47){_0x599f47=_0x599f47||0xcc;return function(_0x42e7a1){if(_0x42e7a1){return _0x5a7e25[_0xc6e1('0x1f')](_0x599f47);}return _0x5a7e25['status'](_0x599f47)[_0xc6e1('0x20')]();};}function respondWithResult(_0x580fae,_0x353469){_0x353469=_0x353469||0xc8;return function(_0x5645d3){if(_0x5645d3){return _0x580fae[_0xc6e1('0x21')](_0x353469)[_0xc6e1('0x22')](_0x5645d3);}};}function respondWithFilteredResult(_0x18dad6,_0x47488f){return function(_0x527c70){if(_0x527c70){var _0x2c9fd7=typeof _0x47488f[_0xc6e1('0x23')]===_0xc6e1('0x24')&&typeof _0x47488f[_0xc6e1('0x25')]===_0xc6e1('0x24');var _0x40c19c=_0x527c70[_0xc6e1('0x26')];var _0x1fa16f=_0x2c9fd7?0x0:_0x47488f[_0xc6e1('0x23')];var _0x1046b9=_0x2c9fd7?_0x527c70[_0xc6e1('0x26')]:_0x47488f[_0xc6e1('0x23')]+_0x47488f[_0xc6e1('0x25')];var _0x107ab7;if(_0x1046b9>=_0x40c19c){_0x1046b9=_0x40c19c;_0x107ab7=0xc8;}else{_0x107ab7=0xce;}_0x18dad6['status'](_0x107ab7);return _0x18dad6[_0xc6e1('0x27')](_0xc6e1('0x28'),_0x1fa16f+'-'+_0x1046b9+'/'+_0x40c19c)[_0xc6e1('0x22')](_0x527c70);}return null;};}function patchUpdates(_0x36c460){return function(_0x236aff){try{jsonpatch[_0xc6e1('0x29')](_0x236aff,_0x36c460,!![]);}catch(_0x571aa7){return BPromise[_0xc6e1('0x2a')](_0x571aa7);}return _0x236aff[_0xc6e1('0x2b')]();};}function saveUpdates(_0x5597d3,_0x6a44fb){return function(_0xcc509){if(_0xcc509){return _0xcc509['update'](_0x5597d3)['then'](function(_0x2e284e){return _0x2e284e;});}return null;};}function removeEntity(_0x431cca,_0x5b0537){return function(_0x1a5fdc){if(_0x1a5fdc){return _0x1a5fdc[_0xc6e1('0x2c')]()[_0xc6e1('0x2d')](function(){_0x431cca[_0xc6e1('0x21')](0xcc)[_0xc6e1('0x20')]();});}};}function handleEntityNotFound(_0x240801,_0x26cec4){return function(_0x71fa6d){if(!_0x71fa6d){_0x240801[_0xc6e1('0x1f')](0x194);}return _0x71fa6d;};}function handleError(_0x511191,_0x1fcc3a){_0x1fcc3a=_0x1fcc3a||0x1f4;return function(_0x600377){logger[_0xc6e1('0x2e')](_0x600377['stack']);if(_0x600377[_0xc6e1('0x2f')]){delete _0x600377[_0xc6e1('0x2f')];}_0x511191[_0xc6e1('0x21')](_0x1fcc3a)[_0xc6e1('0x30')](_0x600377);};}exports[_0xc6e1('0x31')]=function(_0x4ba865,_0x17c8f0){var _0x1585d4={},_0x5a7c24={},_0x2cdb1e={'count':0x0,'rows':[]};var _0x3d6d3d=_[_0xc6e1('0x32')](db[_0xc6e1('0x33')][_0xc6e1('0x34')],function(_0x60446a){return{'name':_0x60446a[_0xc6e1('0x35')],'type':_0x60446a[_0xc6e1('0x36')]['key']};});_0x5a7c24[_0xc6e1('0x37')]=_[_0xc6e1('0x32')](_0x3d6d3d,_0xc6e1('0x2f'));_0x5a7c24[_0xc6e1('0x38')]=_[_0xc6e1('0x39')](_0x4ba865[_0xc6e1('0x38')]);_0x5a7c24['filters']=_['intersection'](_0x5a7c24[_0xc6e1('0x37')],_0x5a7c24[_0xc6e1('0x38')]);_0x1585d4[_0xc6e1('0x3a')]=_['intersection'](_0x5a7c24[_0xc6e1('0x37')],qs[_0xc6e1('0x3b')](_0x4ba865['query'][_0xc6e1('0x3b')]));_0x1585d4[_0xc6e1('0x3a')]=_0x1585d4[_0xc6e1('0x3a')][_0xc6e1('0x3c')]?_0x1585d4['attributes']:_0x5a7c24[_0xc6e1('0x37')];if(!_0x4ba865['query'][_0xc6e1('0x3d')](_0xc6e1('0x3e'))){_0x1585d4[_0xc6e1('0x25')]=qs[_0xc6e1('0x25')](_0x4ba865[_0xc6e1('0x38')]['limit']);_0x1585d4['offset']=qs[_0xc6e1('0x23')](_0x4ba865[_0xc6e1('0x38')][_0xc6e1('0x23')]);}_0x1585d4['order']=qs[_0xc6e1('0x3f')](_0x4ba865['query'][_0xc6e1('0x3f')]);_0x1585d4[_0xc6e1('0x40')]=qs[_0xc6e1('0x41')](_[_0xc6e1('0x42')](_0x4ba865[_0xc6e1('0x38')],_0x5a7c24[_0xc6e1('0x41')]),_0x3d6d3d);if(_0x4ba865[_0xc6e1('0x38')][_0xc6e1('0x43')]){_0x1585d4['where']=_[_0xc6e1('0x44')](_0x1585d4[_0xc6e1('0x40')],{'$or':_[_0xc6e1('0x32')](_0x3d6d3d,function(_0x5f14c3){if(_0x5f14c3['type']!==_0xc6e1('0x45')){var _0x3fc735={};_0x3fc735[_0x5f14c3[_0xc6e1('0x2f')]]={'$like':'%'+_0x4ba865['query'][_0xc6e1('0x43')]+'%'};return _0x3fc735;}})});}_0x1585d4=_[_0xc6e1('0x44')]({},_0x1585d4,_0x4ba865[_0xc6e1('0x46')]);var _0x54e913={'where':_0x1585d4[_0xc6e1('0x40')]};return db[_0xc6e1('0x33')][_0xc6e1('0x26')](_0x54e913)[_0xc6e1('0x2d')](function(_0x33e085){_0x2cdb1e[_0xc6e1('0x26')]=_0x33e085;if(_0x4ba865[_0xc6e1('0x38')][_0xc6e1('0x47')]){_0x1585d4[_0xc6e1('0x48')]=[{'all':!![]}];}return db[_0xc6e1('0x33')][_0xc6e1('0x49')](_0x1585d4);})[_0xc6e1('0x2d')](function(_0xce5a71){_0x2cdb1e[_0xc6e1('0x4a')]=_0xce5a71;return _0x2cdb1e;})[_0xc6e1('0x2d')](respondWithFilteredResult(_0x17c8f0,_0x1585d4))['catch'](handleError(_0x17c8f0,null));};exports[_0xc6e1('0x4b')]=function(_0x18c7b0,_0x599a66){var _0x1fee7c={'raw':![],'where':{'id':_0x18c7b0[_0xc6e1('0x4c')]['id']}},_0xa47300={};_0xa47300[_0xc6e1('0x37')]=_[_0xc6e1('0x39')](db['UserProfile'][_0xc6e1('0x34')]);_0xa47300[_0xc6e1('0x38')]=_['keys'](_0x18c7b0[_0xc6e1('0x38')]);_0xa47300[_0xc6e1('0x41')]=_[_0xc6e1('0x4d')](_0xa47300[_0xc6e1('0x37')],_0xa47300['query']);_0x1fee7c[_0xc6e1('0x3a')]=_[_0xc6e1('0x4d')](_0xa47300[_0xc6e1('0x37')],qs[_0xc6e1('0x3b')](_0x18c7b0[_0xc6e1('0x38')]['fields']));_0x1fee7c[_0xc6e1('0x3a')]=_0x1fee7c['attributes'][_0xc6e1('0x3c')]?_0x1fee7c[_0xc6e1('0x3a')]:_0xa47300[_0xc6e1('0x37')];if(_0x18c7b0[_0xc6e1('0x38')][_0xc6e1('0x47')]){_0x1fee7c[_0xc6e1('0x48')]=[{'all':!![]}];}_0x1fee7c=_['merge']({},_0x1fee7c,_0x18c7b0[_0xc6e1('0x46')]);return db[_0xc6e1('0x33')][_0xc6e1('0x4e')](_0x1fee7c)[_0xc6e1('0x2d')](handleEntityNotFound(_0x599a66,null))[_0xc6e1('0x2d')](respondWithResult(_0x599a66,null))['catch'](handleError(_0x599a66,null));};exports[_0xc6e1('0x4f')]=function(_0x2cd2f9,_0x4bd706){return db['UserProfile'][_0xc6e1('0x4f')](_0x2cd2f9[_0xc6e1('0x50')],{})['then'](respondWithResult(_0x4bd706,0xc9))['catch'](handleError(_0x4bd706,null));};exports[_0xc6e1('0x51')]=function(_0x360724,_0x408b57){var _0x17fb86={'where':{'id':_0x360724['params']['id']}},_0x2066fa={};_0x2066fa[_0xc6e1('0x37')]=_[_0xc6e1('0x39')](db[_0xc6e1('0x33')][_0xc6e1('0x34')]);_0x17fb86[_0xc6e1('0x3a')]=_[_0xc6e1('0x4d')](_0x2066fa[_0xc6e1('0x37')],qs['fields'](_0x360724[_0xc6e1('0x38')][_0xc6e1('0x3b')]));_0x17fb86['attributes']=_0x17fb86[_0xc6e1('0x3a')][_0xc6e1('0x3c')]?_0x17fb86[_0xc6e1('0x3a')]:_0x2066fa[_0xc6e1('0x37')];if(_0x360724[_0xc6e1('0x38')]['includeAll']){_0x17fb86['include']=[{'all':!![]}];}_0x17fb86=_[_0xc6e1('0x44')]({},_0x17fb86,_0x360724[_0xc6e1('0x46')]);return db[_0xc6e1('0x33')][_0xc6e1('0x4e')](_0x17fb86)[_0xc6e1('0x2d')](handleEntityNotFound(_0x408b57,null))[_0xc6e1('0x2d')](function(_0x25fa2d){if(_0x25fa2d){var _0xf9630e=_0x25fa2d[_0xc6e1('0x52')]({'plain':!![]});_0xf9630e=qs[_0xc6e1('0x53')](_0xf9630e,['id',_0xc6e1('0x54'),_0xc6e1('0x55'),_0xc6e1('0x56')]);_0x360724[_0xc6e1('0x50')]=_[_0xc6e1('0x53')](_0x360724[_0xc6e1('0x50')],['id',_0xc6e1('0x54'),_0xc6e1('0x55')]);return db[_0xc6e1('0x57')][_0xc6e1('0x58')](function(_0x8e1bc6){return db[_0xc6e1('0x33')][_0xc6e1('0x4f')](_['merge'](_0xf9630e,_0x360724[_0xc6e1('0x50')]),{'include':_0x360724[_0xc6e1('0x38')][_0xc6e1('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x8e1bc6})['then'](function(_0x2a280c){var _0x1db335=_0x2a280c[_0xc6e1('0x52')]({'plain':!![]});return db[_0xc6e1('0x59')][_0xc6e1('0x49')]({'where':{'userProfileId':_0x360724[_0xc6e1('0x4c')]['id']},'raw':!![]})[_0xc6e1('0x2d')](function(_0x591c59){if(_0x591c59){return BPromise[_0xc6e1('0x5a')](_0x591c59,function(_0x36340f){return new BPromise(function(_0x7a7b26,_0x43e9a6){if(_0x36340f[_0xc6e1('0x5b')]===null||_0x36340f[_0xc6e1('0x5b')]===0x1)_0x7a7b26(null);return db['UserProfileResource'][_0xc6e1('0x49')]({'where':{'sectionId':_0x36340f['id']},'raw':!![]})[_0xc6e1('0x2d')](function(_0x520dee){var _0x2fc932=_[_0xc6e1('0x32')](_0x520dee,function(_0x27b967){return qs[_0xc6e1('0x53')](_0x27b967,['id',_0xc6e1('0x54'),_0xc6e1('0x55'),_0xc6e1('0x5c')]);});_0x7a7b26(_0x2fc932);})[_0xc6e1('0x5d')](function(_0x3beaf3){_0x43e9a6(_0x3beaf3);});})[_0xc6e1('0x2d')](function(_0x5b26f2){var _0x32dea1=qs[_0xc6e1('0x53')](_0x36340f,['id',_0xc6e1('0x54'),_0xc6e1('0x55')]);_0x32dea1[_0xc6e1('0x5e')]=_0x1db335['id'];if(_0x5b26f2)_0x32dea1['Resources']=_0x5b26f2;return _0x32dea1;})[_0xc6e1('0x2d')](function(_0x52a6cb){return db[_0xc6e1('0x59')][_0xc6e1('0x4f')](_0x52a6cb,{'include':[{'model':db[_0xc6e1('0x5f')],'as':_0xc6e1('0x60')}],'raw':!![],'transaction':_0x8e1bc6});});})[_0xc6e1('0x2d')](function(){return _0x1db335;});}});});});}})[_0xc6e1('0x2d')](respondWithResult(_0x408b57,0xc9))[_0xc6e1('0x5d')](handleError(_0x408b57,null));};exports[_0xc6e1('0x61')]=function(_0x356c26,_0x54161e){if(_0x356c26[_0xc6e1('0x50')]['id']){delete _0x356c26[_0xc6e1('0x50')]['id'];}return db['UserProfile'][_0xc6e1('0x4e')]({'where':{'id':_0x356c26[_0xc6e1('0x4c')]['id']}})[_0xc6e1('0x2d')](handleEntityNotFound(_0x54161e,null))[_0xc6e1('0x2d')](saveUpdates(_0x356c26[_0xc6e1('0x50')],null))[_0xc6e1('0x2d')](respondWithResult(_0x54161e,null))[_0xc6e1('0x5d')](handleError(_0x54161e,null));};exports[_0xc6e1('0x2c')]=function(_0x3b4e7a,_0x23259b){return db[_0xc6e1('0x33')]['find']({'where':{'id':_0x3b4e7a['params']['id']}})['then'](handleEntityNotFound(_0x23259b,null))['then'](removeEntity(_0x23259b,null))[_0xc6e1('0x5d')](handleError(_0x23259b,null));};exports['describe']=function(_0x5c6086,_0x3065e5){return db[_0xc6e1('0x33')][_0xc6e1('0x62')]()['then'](respondWithResult(_0x3065e5,null))[_0xc6e1('0x5d')](handleError(_0x3065e5,null));};exports['addSections']=function(_0x65150,_0x1cc75f){var _0x499082=_0x65150['body'];return db[_0xc6e1('0x33')][_0xc6e1('0x4e')]({'where':{'id':_0x65150[_0xc6e1('0x4c')]['id']}})[_0xc6e1('0x2d')](handleEntityNotFound(_0x1cc75f,null))['then'](function(_0x1c1b8a){if(_0x1c1b8a){return db['sequelize']['transaction'](function(_0x22d437){return db['UserProfileSection'][_0xc6e1('0x2c')]({'where':{'userProfileId':_0x65150[_0xc6e1('0x4c')]['id'],'sectionId':_[_0xc6e1('0x32')](_0x499082,function(_0x2cdd59){return _0x2cdd59[_0xc6e1('0x5c')];})},'transaction':_0x22d437})['then'](function(){var _0x30f6db=_[_0xc6e1('0x32')](_0x499082,function(_0x58cd97){_0x58cd97[_0xc6e1('0x5e')]=_0x65150[_0xc6e1('0x4c')]['id'];return _0x58cd97;});var _0x385c52=[];return BPromise[_0xc6e1('0x5a')](_0x30f6db,function(_0x424a7c){return db[_0xc6e1('0x59')][_0xc6e1('0x4f')](_0x424a7c,{'include':[{'model':db[_0xc6e1('0x5f')],'as':_0xc6e1('0x60')}],'raw':!![],'transaction':_0x22d437})[_0xc6e1('0x2d')](function(_0x35c5b5){_0x385c52[_0xc6e1('0x63')](_0x35c5b5[_0xc6e1('0x52')]({'plain':!![]}));});})[_0xc6e1('0x2d')](function(){return _0x385c52;});});});}})['then'](function(_0x3e1e84){return _0x3e1e84;})[_0xc6e1('0x2d')](respondWithResult(_0x1cc75f,null))[_0xc6e1('0x5d')](handleError(_0x1cc75f,null));};exports[_0xc6e1('0x64')]=function(_0x4161cd,_0x29847e){var _0x150a98;return db[_0xc6e1('0x33')][_0xc6e1('0x4e')]({'where':{'id':_0x4161cd[_0xc6e1('0x4c')]['id']},'attributes':['id',_0xc6e1('0x2f')]})['then'](handleEntityNotFound(_0x29847e,null))[_0xc6e1('0x2d')](function(_0x866cf4){if(_0x866cf4){_0x150a98=_0x866cf4;return db[_0xc6e1('0x59')][_0xc6e1('0x2c')]({'where':{'userProfileId':_0x4161cd[_0xc6e1('0x4c')]['id'],'sectionId':_0x4161cd[_0xc6e1('0x38')][_0xc6e1('0x65')]}});}})['then'](function(){return _0x150a98;})['then'](respondWithStatusCode(_0x29847e,null))['catch'](handleError(_0x29847e,null));};exports[_0xc6e1('0x66')]=function(_0x570022,_0xb93667){var _0x187002=[];var _0x7c6d22=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x570022[_0xc6e1('0x4c')]['id']},'raw':!![]})[_0xc6e1('0x2d')](function(_0x338044){_0x187002=_[_0xc6e1('0x43')](_0x338044,function(_0x3c2b08){return _0x3c2b08[_0xc6e1('0x67')]===0x1||_[_0xc6e1('0x68')]([0x3eb,0x709],_0x3c2b08['sectionId']);});if(!_[_0xc6e1('0x69')](_0x187002)){return _['map'](_0x187002,function(_0x4a2734){return _0x4a2734[_0xc6e1('0x5c')];});}else{return;}})[_0xc6e1('0x2d')](function(_0x1c09b4){if(_0x1c09b4)_0x7c6d22=_0x1c09b4;if(_[_0xc6e1('0x68')](_0x7c6d22,0x64)){var _0xc339d7=_[_0xc6e1('0x4e')](_0x187002,{'sectionId':0x64});return hasDefaultDashboard(_0xc339d7)[_0xc6e1('0x2d')](function(_0x138e32){return _[_0xc6e1('0x32')](_0x187002,function(_0x1669a7){if(_0x1669a7['sectionId']===0x64){_0x1669a7['subsections']=_0x138e32;}return _0x1669a7;});});}else{return;}})[_0xc6e1('0x2d')](function(_0x631d91){if(_0x631d91)_0x187002=_0x631d91;if(_[_0xc6e1('0x68')](_0x7c6d22,0x3eb)){var _0x30255c=_[_0xc6e1('0x4e')](_0x187002,{'sectionId':0x3eb});return getCustomDashboards(_0x30255c)[_0xc6e1('0x2d')](function(_0x354704){return _[_0xc6e1('0x32')](_0x187002,function(_0x170088){if(_0x30255c[_0xc6e1('0x67')]){if(_0x170088[_0xc6e1('0x5c')]===0x3eb){_0x170088[_0xc6e1('0x6a')]=_0x354704;}}else{if(_0x170088[_0xc6e1('0x5c')]===0x64){_0x170088[_0xc6e1('0x6a')]=_0x354704;}}return _0x170088;});});}else{return;}})[_0xc6e1('0x2d')](function(_0x1dad35){if(_0x1dad35)_0x187002=_0x1dad35;if(_[_0xc6e1('0x68')](_0x7c6d22,0x709)){var _0x321b9d=_[_0xc6e1('0x4e')](_0x187002,{'sectionId':0x709});return getPlugins(_0x321b9d)['then'](function(_0x2b6de8){if(_0x321b9d[_0xc6e1('0x67')]){return _[_0xc6e1('0x32')](_0x187002,function(_0x23d56b){if(_0x23d56b[_0xc6e1('0x5c')]===0x709){_0x23d56b[_0xc6e1('0x6a')]=_0x2b6de8;}return _0x23d56b;});}else{var _0x413df4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2b6de8};var _0x182f7e=_[_0xc6e1('0x32')](_0x187002);_0x182f7e['push'](_0x413df4);return _0x182f7e;}});}else{return;}})[_0xc6e1('0x2d')](function(_0x43b6f1){if(_0x43b6f1)_0x187002=_0x43b6f1;return _[_0xc6e1('0x43')](_0x187002,[_0xc6e1('0x67'),0x1]);})[_0xc6e1('0x2d')](respondWithResult(_0xb93667,null))[_0xc6e1('0x5d')](handleError(_0xb93667,null));};function hasDefaultDashboard(_0x10b808){var _0x522800=[0x65];return new BPromise(function(_0x1a123e,_0x4498e4){try{if(_0x10b808[_0xc6e1('0x5b')]){_0x1a123e(_0x522800);}else{return db[_0xc6e1('0x5f')][_0xc6e1('0x6b')]({'where':{'sectionId':_0x10b808['id']},'raw':!![]})[_0xc6e1('0x2d')](function(_0x4464cc){_0x4464cc?_0x1a123e(_0x522800):_0x1a123e();});}}catch(_0x2adaa7){_0x4498e4(_0x2adaa7);}});}function getCustomDashboards(_0x42828b){var _0xa7af8=[];return new BPromise(function(_0x5edd69,_0x3f9fc3){try{if(_0x42828b[_0xc6e1('0x5b')]){return db['Dashboard']['findAll']({'raw':!![]})['then'](function(_0x4861a4){_0x4861a4[_0xc6e1('0x6c')](function(_0x3ce9e0){_0xa7af8['push'](_0x3ce9e0['id']+0x1869f);});_0x5edd69(_0xa7af8);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x42828b['id']},'raw':!![]})[_0xc6e1('0x2d')](function(_0x1ad662){_0x1ad662[_0xc6e1('0x6c')](function(_0x2a31b4){_0xa7af8[_0xc6e1('0x63')](_0x2a31b4[_0xc6e1('0x6d')]+0x1869f);});_0x5edd69(_0xa7af8);});}}catch(_0x435b95){_0x3f9fc3(_0x435b95);}});}function getPlugins(_0x410933){var _0x50ea98=[];return new BPromise(function(_0x37c7b3,_0x26d961){try{if(_0x410933[_0xc6e1('0x5b')]){return db[_0xc6e1('0x6e')][_0xc6e1('0x49')]({'raw':!![]})[_0xc6e1('0x2d')](function(_0x1f23e1){_0x1f23e1[_0xc6e1('0x6c')](function(_0x3170a4){_0x50ea98[_0xc6e1('0x63')](_0x3170a4['id']+0x15b38);});_0x37c7b3(_0x50ea98);});}else{return db[_0xc6e1('0x5f')]['findAll']({'where':{'sectionId':_0x410933['id']},'raw':!![]})[_0xc6e1('0x2d')](function(_0x3cabac){_0x3cabac[_0xc6e1('0x6c')](function(_0x323a63){_0x50ea98[_0xc6e1('0x63')](_0x323a63[_0xc6e1('0x6d')]+0x15b38);});_0x37c7b3(_0x50ea98);});}}catch(_0x3ab9d8){_0x26d961(_0x3ab9d8);}});}exports[_0xc6e1('0x6f')]=function(_0x3d0eee,_0x4b4bf4){return db['UserProfile'][_0xc6e1('0x4e')]({'where':{'id':_0x3d0eee['params']['id']}})[_0xc6e1('0x2d')](handleEntityNotFound(_0x4b4bf4,null))[_0xc6e1('0x2d')](function(_0x5ee8ee){if(_0x5ee8ee){return db[_0xc6e1('0x57')][_0xc6e1('0x58')](function(_0x51eaf7){return db[_0xc6e1('0x59')][_0xc6e1('0x49')]({'where':{'userProfileId':_0x3d0eee['params']['id']},'attributes':['id'],'raw':!![]})[_0xc6e1('0x2d')](function(_0x447177){if(_0x447177){return db[_0xc6e1('0x59')][_0xc6e1('0x2c')]({'where':{'userProfileId':_0x3d0eee[_0xc6e1('0x4c')]['id'],'id':_[_0xc6e1('0x32')](_0x447177,function(_0x5341d1){return _0x5341d1['id'];})},'transaction':_0x51eaf7});}})[_0xc6e1('0x2d')](function(_0x227e07){var _0x1670fc=_[_0xc6e1('0x32')](_0x3d0eee[_0xc6e1('0x50')],function(_0x36b47f){_0x36b47f[_0xc6e1('0x5e')]=_0x3d0eee['params']['id'];return _0x36b47f;});return db['UserProfileSection'][_0xc6e1('0x70')](_0x1670fc,{'raw':!![],'transaction':_0x51eaf7});})[_0xc6e1('0x2d')](function(_0x2b22f8){var _0xe3d420=_[_0xc6e1('0x43')](_['map'](_0x2b22f8,function(_0x4c45f6){return _0x4c45f6['get']({'plain':!![]});}),{'includeAll':![]});if(_0xe3d420){return db[_0xc6e1('0x59')][_0xc6e1('0x49')]({'where':{'userProfileId':_0x3d0eee['params']['id'],'sectionId':_['map'](_0xe3d420,function(_0x16a28c){return _0x16a28c[_0xc6e1('0x5c')];})},'attributes':['id',_0xc6e1('0x5c')],'raw':!![]})[_0xc6e1('0x2d')](function(_0x1af648){var _0x4b362d=_[_0xc6e1('0x32')](_0x3d0eee[_0xc6e1('0x50')],function(_0x3bc76e){_0x3bc76e[_0xc6e1('0x5e')]=_0x3d0eee[_0xc6e1('0x4c')]['id'];return _0x3bc76e;});return db[_0xc6e1('0x5f')][_0xc6e1('0x70')](_0x4b362d,{'raw':!![],'transaction':_0x51eaf7});});}})[_0xc6e1('0x5d')](handleError(_0x4b4bf4,null));});}})['then'](function(_0x47db91){var _0x59a48b=_['map'](_0x47db91,function(_0x190c17){return _0x190c17['get']({'plain':!![]});});})[_0xc6e1('0x2d')](respondWithResult(_0x4b4bf4,null))[_0xc6e1('0x5d')](handleError(_0x4b4bf4,null));};exports[_0xc6e1('0x71')]=function(_0x4328e7,_0x298443,_0x243316){return db['UserProfile']['find']({'where':{'id':_0x4328e7[_0xc6e1('0x4c')]['id']}})[_0xc6e1('0x2d')](handleEntityNotFound(_0x298443,null))[_0xc6e1('0x2d')](function(_0x3db72d){if(_0x3db72d){return _0x3db72d[_0xc6e1('0x71')](_0x4328e7[_0xc6e1('0x38')][_0xc6e1('0x65')]);}})[_0xc6e1('0x2d')](respondWithStatusCode(_0x298443,null))['catch'](handleError(_0x298443,null));};exports[_0xc6e1('0x72')]=function(_0x3d2f63,_0x5b17f3){var _0x11a710={};if(!_0x3d2f63[_0xc6e1('0x38')]['section'])throw new Error(_0xc6e1('0x73'));if(!_0x3d2f63[_0xc6e1('0x38')][_0xc6e1('0x3d')](_0xc6e1('0x3e'))){_0x11a710['limit']=qs['limit'](_0x3d2f63['query'][_0xc6e1('0x25')]);_0x11a710[_0xc6e1('0x23')]=qs[_0xc6e1('0x23')](_0x3d2f63[_0xc6e1('0x38')][_0xc6e1('0x23')]);}return db[_0xc6e1('0x33')]['find']({'where':{'id':_0x3d2f63['params']['id']}})[_0xc6e1('0x2d')](function(_0x378ac0){if(!_0x378ac0)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x3d2f63[_0xc6e1('0x4c')]['id']);return db['UserProfile']['getResources'](_0x3d2f63);})[_0xc6e1('0x2d')](respondWithFilteredResult(_0x5b17f3,_0x11a710))[_0xc6e1('0x5d')](handleError(_0x5b17f3,null));}; \ No newline at end of file +var _0xe785=['model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','create','body','clone','keys','find','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','update','describe','addSections','userProfileId','each','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','push','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','UserProfile','fieldName','type'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0xe785,0x128));var _0x5e78=function(_0x451f72,_0x58043e){_0x451f72=_0x451f72-0x0;var _0x912533=_0xe785[_0x451f72];return _0x912533;};'use strict';var emlformat=require(_0x5e78('0x0'));var rimraf=require(_0x5e78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e78('0x2'));var rp=require(_0x5e78('0x3'));var moment=require(_0x5e78('0x4'));var BPromise=require(_0x5e78('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e78('0x6'));var sox=require(_0x5e78('0x7'));var csv=require(_0x5e78('0x8'));var ejs=require(_0x5e78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e78('0xa'));var crypto=require(_0x5e78('0xb'));var jsforce=require(_0x5e78('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5e78('0x8'));var querystring=require('querystring');var Papa=require(_0x5e78('0xd'));var Redis=require('ioredis');var authService=require(_0x5e78('0xe'));var qs=require(_0x5e78('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e78('0x10'));var logger=require(_0x5e78('0x11'))(_0x5e78('0x12'));var utils=require(_0x5e78('0x13'));var config=require(_0x5e78('0x14'));var licenseUtil=require(_0x5e78('0x15'));var db=require(_0x5e78('0x16'))['db'];config['redis']=_[_0x5e78('0x17')](config[_0x5e78('0x18')],{'host':_0x5e78('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e78('0x18')]));require(_0x5e78('0x1a'))[_0x5e78('0x1b')](socket);function respondWithStatusCode(_0x1e49bf,_0x51c20f){_0x51c20f=_0x51c20f||0xcc;return function(_0x4f125f){if(_0x4f125f){return _0x1e49bf[_0x5e78('0x1c')](_0x51c20f);}return _0x1e49bf[_0x5e78('0x1d')](_0x51c20f)[_0x5e78('0x1e')]();};}function respondWithResult(_0x399424,_0x154c7f){_0x154c7f=_0x154c7f||0xc8;return function(_0x493adc){if(_0x493adc){return _0x399424['status'](_0x154c7f)[_0x5e78('0x1f')](_0x493adc);}};}function respondWithFilteredResult(_0x263109,_0x40e31a){return function(_0x5d6063){if(_0x5d6063){var _0x5d2fb9=typeof _0x40e31a['offset']==='undefined'&&typeof _0x40e31a[_0x5e78('0x20')]===_0x5e78('0x21');var _0xe0ccf4=_0x5d6063[_0x5e78('0x22')];var _0x1b6721=_0x5d2fb9?0x0:_0x40e31a[_0x5e78('0x23')];var _0x578a61=_0x5d2fb9?_0x5d6063[_0x5e78('0x22')]:_0x40e31a[_0x5e78('0x23')]+_0x40e31a[_0x5e78('0x20')];var _0x10166e;if(_0x578a61>=_0xe0ccf4){_0x578a61=_0xe0ccf4;_0x10166e=0xc8;}else{_0x10166e=0xce;}_0x263109[_0x5e78('0x1d')](_0x10166e);return _0x263109[_0x5e78('0x24')](_0x5e78('0x25'),_0x1b6721+'-'+_0x578a61+'/'+_0xe0ccf4)[_0x5e78('0x1f')](_0x5d6063);}return null;};}function patchUpdates(_0x56a804){return function(_0x2eb71d){try{jsonpatch[_0x5e78('0x26')](_0x2eb71d,_0x56a804,!![]);}catch(_0x5d001a){return BPromise[_0x5e78('0x27')](_0x5d001a);}return _0x2eb71d[_0x5e78('0x28')]();};}function saveUpdates(_0x3e297e,_0x112773){return function(_0x352536){if(_0x352536){return _0x352536['update'](_0x3e297e)[_0x5e78('0x29')](function(_0x874a24){return _0x874a24;});}return null;};}function removeEntity(_0x454404,_0x3b39f4){return function(_0x363696){if(_0x363696){return _0x363696[_0x5e78('0x2a')]()[_0x5e78('0x29')](function(){_0x454404[_0x5e78('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250618,_0x2de40e){return function(_0x4b540c){if(!_0x4b540c){_0x250618['sendStatus'](0x194);}return _0x4b540c;};}function handleError(_0x4ff829,_0x47b385){_0x47b385=_0x47b385||0x1f4;return function(_0x8d0a4a){logger[_0x5e78('0x2b')](_0x8d0a4a['stack']);if(_0x8d0a4a[_0x5e78('0x2c')]){delete _0x8d0a4a[_0x5e78('0x2c')];}_0x4ff829['status'](_0x47b385)[_0x5e78('0x2d')](_0x8d0a4a);};}exports['index']=function(_0xdb88,_0x2b27be){var _0x2a5ad5={},_0x2c68d8={},_0x527843={'count':0x0,'rows':[]};var _0x298cc3=_['map'](db[_0x5e78('0x2e')]['rawAttributes'],function(_0x10329d){return{'name':_0x10329d[_0x5e78('0x2f')],'type':_0x10329d[_0x5e78('0x30')]['key']};});_0x2c68d8[_0x5e78('0x31')]=_[_0x5e78('0x32')](_0x298cc3,'name');_0x2c68d8[_0x5e78('0x33')]=_['keys'](_0xdb88[_0x5e78('0x33')]);_0x2c68d8[_0x5e78('0x34')]=_['intersection'](_0x2c68d8[_0x5e78('0x31')],_0x2c68d8[_0x5e78('0x33')]);_0x2a5ad5[_0x5e78('0x35')]=_[_0x5e78('0x36')](_0x2c68d8[_0x5e78('0x31')],qs[_0x5e78('0x37')](_0xdb88[_0x5e78('0x33')][_0x5e78('0x37')]));_0x2a5ad5[_0x5e78('0x35')]=_0x2a5ad5['attributes'][_0x5e78('0x38')]?_0x2a5ad5['attributes']:_0x2c68d8[_0x5e78('0x31')];if(!_0xdb88['query'][_0x5e78('0x39')]('nolimit')){_0x2a5ad5[_0x5e78('0x20')]=qs[_0x5e78('0x20')](_0xdb88[_0x5e78('0x33')]['limit']);_0x2a5ad5[_0x5e78('0x23')]=qs[_0x5e78('0x23')](_0xdb88['query']['offset']);}_0x2a5ad5[_0x5e78('0x3a')]=qs[_0x5e78('0x3b')](_0xdb88[_0x5e78('0x33')][_0x5e78('0x3b')]);_0x2a5ad5[_0x5e78('0x3c')]=qs[_0x5e78('0x34')](_[_0x5e78('0x3d')](_0xdb88[_0x5e78('0x33')],_0x2c68d8[_0x5e78('0x34')]),_0x298cc3);if(_0xdb88[_0x5e78('0x33')][_0x5e78('0x3e')]){_0x2a5ad5['where']=_[_0x5e78('0x3f')](_0x2a5ad5[_0x5e78('0x3c')],{'$or':_[_0x5e78('0x32')](_0x298cc3,function(_0x32097a){if(_0x32097a['type']!==_0x5e78('0x40')){var _0x2d3012={};_0x2d3012[_0x32097a[_0x5e78('0x2c')]]={'$like':'%'+_0xdb88[_0x5e78('0x33')][_0x5e78('0x3e')]+'%'};return _0x2d3012;}})});}_0x2a5ad5=_[_0x5e78('0x3f')]({},_0x2a5ad5,_0xdb88['options']);var _0x3311d0={'where':_0x2a5ad5[_0x5e78('0x3c')]};return db[_0x5e78('0x2e')][_0x5e78('0x22')](_0x3311d0)[_0x5e78('0x29')](function(_0x4d1ed6){_0x527843[_0x5e78('0x22')]=_0x4d1ed6;if(_0xdb88['query'][_0x5e78('0x41')]){_0x2a5ad5[_0x5e78('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0x5e78('0x43')](_0x2a5ad5);})[_0x5e78('0x29')](function(_0x525a3e){_0x527843[_0x5e78('0x44')]=_0x525a3e;return _0x527843;})[_0x5e78('0x29')](respondWithFilteredResult(_0x2b27be,_0x2a5ad5))[_0x5e78('0x45')](handleError(_0x2b27be,null));};exports['show']=function(_0x64c22,_0x5856e3){var _0x13eed6={'raw':![],'where':{'id':_0x64c22[_0x5e78('0x46')]['id']}},_0x3013e9={};_0x3013e9[_0x5e78('0x31')]=_['keys'](db[_0x5e78('0x2e')][_0x5e78('0x47')]);_0x3013e9['query']=_['keys'](_0x64c22[_0x5e78('0x33')]);_0x3013e9[_0x5e78('0x34')]=_[_0x5e78('0x36')](_0x3013e9[_0x5e78('0x31')],_0x3013e9[_0x5e78('0x33')]);_0x13eed6['attributes']=_[_0x5e78('0x36')](_0x3013e9[_0x5e78('0x31')],qs[_0x5e78('0x37')](_0x64c22[_0x5e78('0x33')][_0x5e78('0x37')]));_0x13eed6['attributes']=_0x13eed6[_0x5e78('0x35')][_0x5e78('0x38')]?_0x13eed6['attributes']:_0x3013e9['model'];if(_0x64c22['query'][_0x5e78('0x41')]){_0x13eed6[_0x5e78('0x42')]=[{'all':!![]}];}_0x13eed6=_[_0x5e78('0x3f')]({},_0x13eed6,_0x64c22[_0x5e78('0x48')]);return db[_0x5e78('0x2e')]['find'](_0x13eed6)[_0x5e78('0x29')](handleEntityNotFound(_0x5856e3,null))[_0x5e78('0x29')](respondWithResult(_0x5856e3,null))[_0x5e78('0x45')](handleError(_0x5856e3,null));};exports['create']=function(_0x2ae6dd,_0xd6522e){return db[_0x5e78('0x2e')][_0x5e78('0x49')](_0x2ae6dd[_0x5e78('0x4a')],{})['then'](respondWithResult(_0xd6522e,0xc9))[_0x5e78('0x45')](handleError(_0xd6522e,null));};exports[_0x5e78('0x4b')]=function(_0x4c8a73,_0x51c807){var _0x291127={'where':{'id':_0x4c8a73[_0x5e78('0x46')]['id']}},_0x55b87c={};_0x55b87c[_0x5e78('0x31')]=_[_0x5e78('0x4c')](db[_0x5e78('0x2e')][_0x5e78('0x47')]);_0x291127[_0x5e78('0x35')]=_[_0x5e78('0x36')](_0x55b87c['model'],qs[_0x5e78('0x37')](_0x4c8a73[_0x5e78('0x33')]['fields']));_0x291127['attributes']=_0x291127[_0x5e78('0x35')][_0x5e78('0x38')]?_0x291127[_0x5e78('0x35')]:_0x55b87c[_0x5e78('0x31')];if(_0x4c8a73[_0x5e78('0x33')][_0x5e78('0x41')]){_0x291127[_0x5e78('0x42')]=[{'all':!![]}];}_0x291127=_['merge']({},_0x291127,_0x4c8a73[_0x5e78('0x48')]);return db[_0x5e78('0x2e')][_0x5e78('0x4d')](_0x291127)[_0x5e78('0x29')](handleEntityNotFound(_0x51c807,null))[_0x5e78('0x29')](function(_0xd27aba){if(_0xd27aba){var _0x47c9f5=_0xd27aba[_0x5e78('0x4e')]({'plain':!![]});_0x47c9f5=qs[_0x5e78('0x4f')](_0x47c9f5,['id',_0x5e78('0x50'),'updatedAt',_0x5e78('0x51')]);_0x4c8a73[_0x5e78('0x4a')]=_[_0x5e78('0x4f')](_0x4c8a73[_0x5e78('0x4a')],['id',_0x5e78('0x50'),_0x5e78('0x52')]);return db[_0x5e78('0x53')][_0x5e78('0x54')](function(_0x2ecd73){return db[_0x5e78('0x2e')][_0x5e78('0x49')](_[_0x5e78('0x3f')](_0x47c9f5,_0x4c8a73[_0x5e78('0x4a')]),{'include':_0x4c8a73[_0x5e78('0x33')][_0x5e78('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x2ecd73})[_0x5e78('0x29')](function(_0x172649){var _0x33cd32=_0x172649['get']({'plain':!![]});return db[_0x5e78('0x55')][_0x5e78('0x43')]({'where':{'userProfileId':_0x4c8a73[_0x5e78('0x46')]['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x15bb14){if(_0x15bb14){return BPromise['each'](_0x15bb14,function(_0x39871e){return new BPromise(function(_0x459d62,_0x53a499){if(_0x39871e[_0x5e78('0x56')]===null||_0x39871e[_0x5e78('0x56')]===0x1)_0x459d62(null);return db[_0x5e78('0x57')][_0x5e78('0x43')]({'where':{'sectionId':_0x39871e['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x3ec04c){var _0x486af0=_['map'](_0x3ec04c,function(_0x3f0dcf){return qs[_0x5e78('0x4f')](_0x3f0dcf,['id',_0x5e78('0x50'),_0x5e78('0x52'),_0x5e78('0x58')]);});_0x459d62(_0x486af0);})[_0x5e78('0x45')](function(_0x28b213){_0x53a499(_0x28b213);});})[_0x5e78('0x29')](function(_0x35fab0){var _0x23490e=qs[_0x5e78('0x4f')](_0x39871e,['id',_0x5e78('0x50'),'updatedAt']);_0x23490e['userProfileId']=_0x33cd32['id'];if(_0x35fab0)_0x23490e[_0x5e78('0x59')]=_0x35fab0;return _0x23490e;})[_0x5e78('0x29')](function(_0x5ae962){return db[_0x5e78('0x55')][_0x5e78('0x49')](_0x5ae962,{'include':[{'model':db[_0x5e78('0x57')],'as':_0x5e78('0x59')}],'raw':!![],'transaction':_0x2ecd73});});})[_0x5e78('0x29')](function(){return _0x33cd32;});}});});});}})[_0x5e78('0x29')](respondWithResult(_0x51c807,0xc9))['catch'](handleError(_0x51c807,null));};exports[_0x5e78('0x5a')]=function(_0x55badd,_0x93cd5f){if(_0x55badd['body']['id']){delete _0x55badd[_0x5e78('0x4a')]['id'];}return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x55badd[_0x5e78('0x46')]['id']}})[_0x5e78('0x29')](handleEntityNotFound(_0x93cd5f,null))['then'](saveUpdates(_0x55badd['body'],null))[_0x5e78('0x29')](respondWithResult(_0x93cd5f,null))[_0x5e78('0x45')](handleError(_0x93cd5f,null));};exports[_0x5e78('0x2a')]=function(_0x257c3d,_0x564be0){return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x257c3d[_0x5e78('0x46')]['id']}})['then'](handleEntityNotFound(_0x564be0,null))['then'](removeEntity(_0x564be0,null))[_0x5e78('0x45')](handleError(_0x564be0,null));};exports[_0x5e78('0x5b')]=function(_0x136eb4,_0x531ea4){return db[_0x5e78('0x2e')][_0x5e78('0x5b')]()[_0x5e78('0x29')](respondWithResult(_0x531ea4,null))[_0x5e78('0x45')](handleError(_0x531ea4,null));};exports[_0x5e78('0x5c')]=function(_0x16ca35,_0x190be3){var _0x337f8f=_0x16ca35[_0x5e78('0x4a')];return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x16ca35['params']['id']}})[_0x5e78('0x29')](handleEntityNotFound(_0x190be3,null))[_0x5e78('0x29')](function(_0x4ecc4c){if(_0x4ecc4c){return db[_0x5e78('0x53')][_0x5e78('0x54')](function(_0x53224d){return db[_0x5e78('0x55')]['destroy']({'where':{'userProfileId':_0x16ca35['params']['id'],'sectionId':_[_0x5e78('0x32')](_0x337f8f,function(_0x701372){return _0x701372['sectionId'];})},'transaction':_0x53224d})[_0x5e78('0x29')](function(){var _0x31bdb0=_['map'](_0x337f8f,function(_0x2f2ab5){_0x2f2ab5[_0x5e78('0x5d')]=_0x16ca35[_0x5e78('0x46')]['id'];return _0x2f2ab5;});var _0x105571=[];return BPromise[_0x5e78('0x5e')](_0x31bdb0,function(_0x1ffa99){return db[_0x5e78('0x55')][_0x5e78('0x49')](_0x1ffa99,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x53224d})[_0x5e78('0x29')](function(_0x37f933){_0x105571['push'](_0x37f933[_0x5e78('0x4e')]({'plain':!![]}));});})[_0x5e78('0x29')](function(){return _0x105571;});});});}})[_0x5e78('0x29')](function(_0x252795){return _0x252795;})[_0x5e78('0x29')](respondWithResult(_0x190be3,null))['catch'](handleError(_0x190be3,null));};exports[_0x5e78('0x5f')]=function(_0x5545bd,_0x300520){var _0x2086b3;return db['UserProfile'][_0x5e78('0x4d')]({'where':{'id':_0x5545bd[_0x5e78('0x46')]['id']},'attributes':['id',_0x5e78('0x2c')]})[_0x5e78('0x29')](handleEntityNotFound(_0x300520,null))['then'](function(_0x42049a){if(_0x42049a){_0x2086b3=_0x42049a;return db[_0x5e78('0x55')][_0x5e78('0x2a')]({'where':{'userProfileId':_0x5545bd[_0x5e78('0x46')]['id'],'sectionId':_0x5545bd[_0x5e78('0x33')]['ids']}});}})['then'](function(){return _0x2086b3;})[_0x5e78('0x29')](respondWithStatusCode(_0x300520,null))[_0x5e78('0x45')](handleError(_0x300520,null));};exports[_0x5e78('0x60')]=function(_0x55bdd0,_0x180d01){var _0xf9ac6b=[];var _0x41d98c=[];return db[_0x5e78('0x55')][_0x5e78('0x43')]({'where':{'userProfileId':_0x55bdd0[_0x5e78('0x46')]['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x20942e){_0xf9ac6b=_[_0x5e78('0x3e')](_0x20942e,function(_0x299045){return _0x299045[_0x5e78('0x61')]===0x1||_[_0x5e78('0x62')]([0x3eb,0x709],_0x299045[_0x5e78('0x58')]);});if(!_[_0x5e78('0x63')](_0xf9ac6b)){return _[_0x5e78('0x32')](_0xf9ac6b,function(_0x140e95){return _0x140e95[_0x5e78('0x58')];});}else{return;}})[_0x5e78('0x29')](function(_0xce14d2){if(_0xce14d2)_0x41d98c=_0xce14d2;if(_[_0x5e78('0x62')](_0x41d98c,0x64)){var _0x2eeb01=_[_0x5e78('0x4d')](_0xf9ac6b,{'sectionId':0x64});return hasDefaultDashboard(_0x2eeb01)[_0x5e78('0x29')](function(_0x1a9056){return _[_0x5e78('0x32')](_0xf9ac6b,function(_0x3fb4d6){if(_0x3fb4d6[_0x5e78('0x58')]===0x64){_0x3fb4d6[_0x5e78('0x64')]=_0x1a9056;}return _0x3fb4d6;});});}else{return;}})['then'](function(_0x468388){if(_0x468388)_0xf9ac6b=_0x468388;if(_[_0x5e78('0x62')](_0x41d98c,0x3eb)){var _0x5fffef=_['find'](_0xf9ac6b,{'sectionId':0x3eb});return getCustomDashboards(_0x5fffef)[_0x5e78('0x29')](function(_0x4719eb){return _[_0x5e78('0x32')](_0xf9ac6b,function(_0x1dcd69){if(_0x5fffef[_0x5e78('0x61')]){if(_0x1dcd69[_0x5e78('0x58')]===0x3eb){_0x1dcd69['subsections']=_0x4719eb;}}else{if(_0x1dcd69[_0x5e78('0x58')]===0x64){_0x1dcd69[_0x5e78('0x64')]=_0x4719eb;}}return _0x1dcd69;});});}else{return;}})[_0x5e78('0x29')](function(_0x57cd66){if(_0x57cd66)_0xf9ac6b=_0x57cd66;if(_['includes'](_0x41d98c,0x709)){var _0x3242e6=_['find'](_0xf9ac6b,{'sectionId':0x709});return getPlugins(_0x3242e6)[_0x5e78('0x29')](function(_0x5ea26f){if(_0x3242e6[_0x5e78('0x61')]){return _['map'](_0xf9ac6b,function(_0x2fc9dc){if(_0x2fc9dc['sectionId']===0x709){_0x2fc9dc[_0x5e78('0x64')]=_0x5ea26f;}return _0x2fc9dc;});}else{var _0x550a33={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5ea26f};var _0x31b01f=_[_0x5e78('0x32')](_0xf9ac6b);_0x31b01f['push'](_0x550a33);return _0x31b01f;}});}else{return;}})[_0x5e78('0x29')](function(_0x1b15a8){if(_0x1b15a8)_0xf9ac6b=_0x1b15a8;return _['filter'](_0xf9ac6b,['enabled',0x1]);})[_0x5e78('0x29')](respondWithResult(_0x180d01,null))[_0x5e78('0x45')](handleError(_0x180d01,null));};function hasDefaultDashboard(_0x209c09){var _0x343d09=[0x65];return new BPromise(function(_0x386234,_0x2a48d1){try{if(_0x209c09[_0x5e78('0x56')]){_0x386234(_0x343d09);}else{return db['UserProfileResource'][_0x5e78('0x65')]({'where':{'sectionId':_0x209c09['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x28631d){_0x28631d?_0x386234(_0x343d09):_0x386234();});}}catch(_0xd5dc3d){_0x2a48d1(_0xd5dc3d);}});}function getCustomDashboards(_0x57e2a2){var _0x1d6288=[];return new BPromise(function(_0x32044e,_0x31a807){try{if(_0x57e2a2[_0x5e78('0x56')]){return db[_0x5e78('0x66')][_0x5e78('0x43')]({'raw':!![]})['then'](function(_0x1a1c90){_0x1a1c90[_0x5e78('0x67')](function(_0x354717){_0x1d6288[_0x5e78('0x68')](_0x354717['id']+0x1869f);});_0x32044e(_0x1d6288);});}else{return db[_0x5e78('0x57')][_0x5e78('0x43')]({'where':{'sectionId':_0x57e2a2['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x2ef75d){_0x2ef75d[_0x5e78('0x67')](function(_0x40a576){_0x1d6288[_0x5e78('0x68')](_0x40a576[_0x5e78('0x69')]+0x1869f);});_0x32044e(_0x1d6288);});}}catch(_0x162778){_0x31a807(_0x162778);}});}function getPlugins(_0x63370b){var _0x266f26=[];return new BPromise(function(_0x251000,_0x57a085){try{if(_0x63370b[_0x5e78('0x56')]){return db[_0x5e78('0x6a')][_0x5e78('0x43')]({'raw':!![]})[_0x5e78('0x29')](function(_0x4d1fe7){_0x4d1fe7[_0x5e78('0x67')](function(_0x2fe3f3){_0x266f26[_0x5e78('0x68')](_0x2fe3f3['id']+0x15b38);});_0x251000(_0x266f26);});}else{return db[_0x5e78('0x57')]['findAll']({'where':{'sectionId':_0x63370b['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x260373){_0x260373['forEach'](function(_0xc69f59){_0x266f26[_0x5e78('0x68')](_0xc69f59['resourceId']+0x15b38);});_0x251000(_0x266f26);});}}catch(_0x2bde45){_0x57a085(_0x2bde45);}});}exports[_0x5e78('0x6b')]=function(_0x3d60e6,_0x4d10cf){return db['UserProfile'][_0x5e78('0x4d')]({'where':{'id':_0x3d60e6[_0x5e78('0x46')]['id']}})[_0x5e78('0x29')](handleEntityNotFound(_0x4d10cf,null))[_0x5e78('0x29')](function(_0x326fbf){if(_0x326fbf){return db[_0x5e78('0x53')][_0x5e78('0x54')](function(_0x26475a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3d60e6['params']['id']},'attributes':['id'],'raw':!![]})[_0x5e78('0x29')](function(_0xc91fb2){if(_0xc91fb2){return db['UserProfileSection'][_0x5e78('0x2a')]({'where':{'userProfileId':_0x3d60e6[_0x5e78('0x46')]['id'],'id':_['map'](_0xc91fb2,function(_0x55c519){return _0x55c519['id'];})},'transaction':_0x26475a});}})[_0x5e78('0x29')](function(_0x15aff9){var _0x4d62f8=_['map'](_0x3d60e6['body'],function(_0x44bd42){_0x44bd42[_0x5e78('0x5d')]=_0x3d60e6['params']['id'];return _0x44bd42;});return db[_0x5e78('0x55')][_0x5e78('0x6c')](_0x4d62f8,{'raw':!![],'transaction':_0x26475a});})[_0x5e78('0x29')](function(_0x121c64){var _0x406c7e=_[_0x5e78('0x3e')](_[_0x5e78('0x32')](_0x121c64,function(_0x292da1){return _0x292da1[_0x5e78('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x406c7e){return db[_0x5e78('0x55')][_0x5e78('0x43')]({'where':{'userProfileId':_0x3d60e6[_0x5e78('0x46')]['id'],'sectionId':_[_0x5e78('0x32')](_0x406c7e,function(_0x4e5916){return _0x4e5916[_0x5e78('0x58')];})},'attributes':['id',_0x5e78('0x58')],'raw':!![]})[_0x5e78('0x29')](function(_0x9902f8){var _0x400bd0=_[_0x5e78('0x32')](_0x3d60e6[_0x5e78('0x4a')],function(_0x5da82e){_0x5da82e['userProfileId']=_0x3d60e6['params']['id'];return _0x5da82e;});return db['UserProfileResource']['bulkCreate'](_0x400bd0,{'raw':!![],'transaction':_0x26475a});});}})[_0x5e78('0x45')](handleError(_0x4d10cf,null));});}})[_0x5e78('0x29')](function(_0x2a4281){var _0x222154=_[_0x5e78('0x32')](_0x2a4281,function(_0x48b4bc){return _0x48b4bc[_0x5e78('0x4e')]({'plain':!![]});});})[_0x5e78('0x29')](respondWithResult(_0x4d10cf,null))[_0x5e78('0x45')](handleError(_0x4d10cf,null));};exports[_0x5e78('0x6d')]=function(_0x25264d,_0x2408f5,_0x2d4a56){return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x25264d[_0x5e78('0x46')]['id']}})['then'](handleEntityNotFound(_0x2408f5,null))[_0x5e78('0x29')](function(_0x569b91){if(_0x569b91){return _0x569b91[_0x5e78('0x6d')](_0x25264d['query'][_0x5e78('0x6e')]);}})[_0x5e78('0x29')](respondWithStatusCode(_0x2408f5,null))[_0x5e78('0x45')](handleError(_0x2408f5,null));};exports[_0x5e78('0x6f')]=function(_0x493cfa,_0x508b95){var _0xf54c18={};if(!_0x493cfa[_0x5e78('0x33')][_0x5e78('0x70')])throw new Error(_0x5e78('0x71'));if(!_0x493cfa[_0x5e78('0x33')][_0x5e78('0x39')](_0x5e78('0x72'))){_0xf54c18['limit']=qs['limit'](_0x493cfa[_0x5e78('0x33')][_0x5e78('0x20')]);_0xf54c18[_0x5e78('0x23')]=qs['offset'](_0x493cfa[_0x5e78('0x33')][_0x5e78('0x23')]);}return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x493cfa['params']['id']}})['then'](function(_0x25bd5b){if(!_0x25bd5b)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x493cfa['params']['id']);return db[_0x5e78('0x2e')]['getResources'](_0x493cfa);})[_0x5e78('0x29')](respondWithFilteredResult(_0x508b95,_0xf54c18))[_0x5e78('0x45')](handleError(_0x508b95,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ad25c7c..f84d872 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 _0xcb22=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xcb22,0xc8));var _0x2cb2=function(_0x5543ce,_0x24baa5){_0x5543ce=_0x5543ce-0x0;var _0x557341=_0xcb22[_0x5543ce];return _0x557341;};'use strict';var EventEmitter=require(_0x2cb2('0x0'));var UserProfile=require(_0x2cb2('0x1'))['db'][_0x2cb2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2cb2('0x3')](0x0);var events={'afterCreate':_0x2cb2('0x4'),'afterUpdate':_0x2cb2('0x5'),'afterDestroy':_0x2cb2('0x6')};function emitEvent(_0xe763ff){return function(_0x386f8b,_0x3b1af5,_0x3dec93){UserProfileEvents['emit'](_0xe763ff+':'+_0x386f8b['id'],_0x386f8b);UserProfileEvents[_0x2cb2('0x7')](_0xe763ff,_0x386f8b);_0x3dec93(null);};}for(var e in events){if(events[_0x2cb2('0x8')](e)){var event=events[e];UserProfile[_0x2cb2('0x9')](e,emitEvent(event));}}module[_0x2cb2('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x975b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserProfile'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x975b,0x1c9));var _0xb975=function(_0xfc273e,_0x57bb39){_0xfc273e=_0xfc273e-0x0;var _0x34656d=_0x975b[_0xfc273e];return _0x34656d;};'use strict';var EventEmitter=require(_0xb975('0x0'));var UserProfile=require(_0xb975('0x1'))['db'][_0xb975('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb975('0x3')](0x0);var events={'afterCreate':_0xb975('0x4'),'afterUpdate':_0xb975('0x5'),'afterDestroy':_0xb975('0x6')};function emitEvent(_0x5e662b){return function(_0xa92c72,_0xfb173,_0x2007e4){UserProfileEvents[_0xb975('0x7')](_0x5e662b+':'+_0xa92c72['id'],_0xa92c72);UserProfileEvents[_0xb975('0x7')](_0x5e662b,_0xa92c72);_0x2007e4(null);};}for(var e in events){if(events[_0xb975('0x8')](e)){var event=events[e];UserProfile[_0xb975('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 7931dcc..75991b4 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 _0xe2fe=['FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','chanspies','VoiceChanSpy','Campaign','mailqueues','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','UserProfile','user_profiles','query','section','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','include','color','tag','true','rows','dataValues','sms','mail','openchannel','whatsapp','lodash','squel','models','filter','findAll','then','associatedResources','map','field','value','model','name','catch','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','globalcustomfields','chatwebsites','faxqueues'];(function(_0x348e0a,_0xd2f1ff){var _0x1158bd=function(_0x273b5c){while(--_0x273b5c){_0x348e0a['push'](_0x348e0a['shift']());}};_0x1158bd(++_0xd2f1ff);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0xee2f('0x1'));module['exports']=function(_0x169cf9){var _0x1b6f4c=_0x169cf9[_0xee2f('0x2')];function _0x2d2b03(_0xcb45e6,_0x4ba89f){return new Promise(function(_0x311a2f,_0x2b7e7c){if(!_0x4ba89f)return _0x311a2f(null);var _0x49926b=_0x4ba89f[_0xee2f('0x3')]?{[_0x4ba89f[_0xee2f('0x3')]['field']]:_0x4ba89f[_0xee2f('0x3')]['value']}:undefined;return _0x1b6f4c[_0xcb45e6][_0xee2f('0x4')]({'where':_0x49926b,'raw':!![]})[_0xee2f('0x5')](function(_0x53f7dd){_0x4ba89f[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x53f7dd,'id');_0x311a2f(_0x4ba89f);})['catch'](function(_0x5597ea){_0x2b7e7c(_0x5597ea);});});}function _0x4818df(_0x56bbea,_0x2b8fb1){return new Promise(function(_0x4cb4bf,_0x481ea7){var _0x53047d=_0x56bbea[_0xee2f('0x3')]?{[_0x56bbea[_0xee2f('0x3')][_0xee2f('0x8')]]:_0x56bbea[_0xee2f('0x3')][_0xee2f('0x9')]}:undefined;return _0x1b6f4c[_0x56bbea[_0xee2f('0xa')]]['findAll']({'where':_0x53047d,'raw':!![]})[_0xee2f('0x5')](function(_0x531c3a){_0x2b8fb1[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x531c3a,function(_0x48b30c){return _0x48b30c[_0xee2f('0xb')];});_0x4cb4bf(_0x2b8fb1);})[_0xee2f('0xc')](function(_0x28b614){_0x481ea7(_0x28b614);});});}function _0x1bbf7d(_0x390c2c,_0x58f42a,_0x3f6372){if(!_0x58f42a)return Promise['resolve'](null);return new Promise(function(_0x17d288,_0x3359ff){return _0x1b6f4c['UserProfileResource']['findAll']({'where':{'sectionId':_0x58f42a['id']},'raw':!![]})[_0xee2f('0x5')](function(_0x5a5078){if(_0x390c2c[_0xee2f('0x8')]&&_0x390c2c[_0xee2f('0x8')]!=='id'){_0x58f42a[_0xee2f('0x6')]=_['map'](_0x5a5078,function(_0x35e1a4){return _0x35e1a4[_0x390c2c[_0xee2f('0x8')]];});}else{if(_0x3f6372===_0xee2f('0xd')){_0x58f42a[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x5a5078,function(_0x5d36d4){return{'id':_0x5d36d4['resourceId'],'type':_0x5d36d4[_0xee2f('0xe')]};});}else{_0x58f42a[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x5a5078,function(_0x203b2f){return _0x203b2f[_0xee2f('0xf')];});}}_0x17d288(_0x58f42a);})[_0xee2f('0xc')](function(_0x39a39c){_0x3359ff(_0x39a39c);});});}function _0x4d68d3(_0x250399,_0x2c47c5){var _0x15ceda={'parentSections':[]};switch(_0x250399[_0xee2f('0x10')]()){case _0xee2f('0x11'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x13');break;case _0xee2f('0x14'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x15');break;case _0xee2f('0x16'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x17');_0x15ceda[_0xee2f('0x18')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0xee2f('0x19'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1a');break;case _0xee2f('0x1b'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1c');_0x15ceda['parentSections']=[{'name':_0xee2f('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0xee2f('0x1e'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1f');break;case _0xee2f('0x20'):_0x15ceda[_0xee2f('0x12')]='CmCompany';break;case _0xee2f('0x21'):_0x15ceda[_0xee2f('0x12')]='CmCustomField';break;case'chatqueues':_0x15ceda[_0xee2f('0x12')]='ChatQueue';break;case _0xee2f('0x22'):_0x15ceda[_0xee2f('0x12')]='ChatWebsite';break;case _0xee2f('0x23'):_0x15ceda['childModel']='FaxQueue';break;case'faxaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x24');break;case'inboundroutes':case _0xee2f('0x25'):case _0xee2f('0x26'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x27');break;case _0xee2f('0x28'):_0x15ceda['childModel']=_0xee2f('0x29');break;case'voicemails':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x2a');break;case _0xee2f('0x2b'):_0x15ceda['childModel']=_0xee2f('0x2c');_0x15ceda['parentSections']=[{'name':_0xee2f('0x2d'),'field':'name','foreignKey':_0xee2f('0x2e'),'model':_0xee2f('0x2f'),'filter':{'field':_0xee2f('0x30'),'value':[_0xee2f('0x31')]}},{'name':_0xee2f('0x32'),'field':_0xee2f('0xb'),'foreignKey':_0xee2f('0x2e'),'model':_0xee2f('0x2f'),'filter':{'field':_0xee2f('0x30'),'value':[_0xee2f('0x33')]}},{'name':_0xee2f('0x34'),'field':'name','foreignKey':_0xee2f('0x35'),'model':'VoiceQueue','filter':{'field':_0xee2f('0xe'),'value':[_0xee2f('0x36')]}},{'name':_0xee2f('0x37'),'field':_0xee2f('0xb'),'foreignKey':_0xee2f('0x35'),'model':_0xee2f('0x38'),'filter':{'field':_0xee2f('0xe'),'value':[_0xee2f('0x39')]}}];break;case'musiconholds':_0x15ceda['childModel']='VoiceMusicOnHold';break;case _0xee2f('0x3a'):_0x15ceda['childModel']=_0xee2f('0x3b');break;case'voiceprefixes':_0x15ceda['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x3c');break;case _0xee2f('0x3d'):_0x15ceda[_0xee2f('0x12')]='MailQueue';break;case'mailaccounts':_0x15ceda[_0xee2f('0x12')]='MailAccount';break;case'mailsubstatuses':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x3e');break;case _0xee2f('0x3f'):_0x15ceda['childModel']=_0xee2f('0x40');break;case _0xee2f('0x41'):_0x15ceda[_0xee2f('0x12')]='OpenchannelAccount';break;case'smsqueues':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x42');break;case _0xee2f('0x43'):_0x15ceda[_0xee2f('0x12')]='SmsAccount';break;case _0xee2f('0x44'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x45');break;case _0xee2f('0x46'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x47');break;case _0xee2f('0x48'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x49');break;case _0xee2f('0x4a'):case'queuecampaigns':_0x15ceda['childModel']='VoiceQueue';if(_0x2c47c5){_0x15ceda['parentSections']=[{'name':_0xee2f('0x34')},{'name':_0xee2f('0x37')}];}break;case _0xee2f('0x4b'):case _0xee2f('0x4c'):case _0xee2f('0x4d'):_0x15ceda['childModel']=_0xee2f('0x2f');if(_0x2c47c5){_0x15ceda[_0xee2f('0x18')]=[{'name':_0xee2f('0x4e'),'filter':{'field':_0xee2f('0x30'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xee2f('0x32')}];}break;case'zendeskaccounts':_0x15ceda['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x4f');break;case _0xee2f('0x50'):_0x15ceda['childModel']=_0xee2f('0x51');break;case'sugarcrmaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x52');break;case _0xee2f('0x53'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x54');break;case'zohoaccounts':_0x15ceda['childModel']=_0xee2f('0x55');break;case'vtigeraccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x2f');break;case _0xee2f('0x56'):_0x15ceda[_0xee2f('0x12')]='CannedAnswer';break;case'dispositions':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x57');break;case _0xee2f('0x58'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x59');break;case _0xee2f('0x5a'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x5b');break;case _0xee2f('0x5c'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x5d');break;case _0xee2f('0x5e'):_0x15ceda['childModel']=_0xee2f('0x5f');break;case _0xee2f('0x60'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x61');break;case'tags':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x62');break;case _0xee2f('0x63'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x64');break;case'triggers':_0x15ceda[_0xee2f('0x12')]='Trigger';break;case'trunks':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x65');break;case _0xee2f('0x66'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x67');break;case _0xee2f('0x68'):_0x15ceda[_0xee2f('0x12')]='Plugin';break;case _0xee2f('0x69'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0xd');_0x15ceda[_0xee2f('0x18')]=[{'name':_0xee2f('0x6a'),'field':'id','foreignKey':_0xee2f('0x6b')}];break;case _0xee2f('0x6c'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x6d');break;}return _0x15ceda;}function _0x5d6c40(_0x12373b,_0x4b9d29){var _0x1b4ee6=_0x12373b[_0xee2f('0x6e')](0x0)[_0xee2f('0x6f')]()+_0x12373b[_0xee2f('0x70')](0x1);var _0x2f3891={'type':_0x1b6f4c['Sequelize'][_0xee2f('0x71')][_0xee2f('0x72')],'raw':!![]};return new Promise(function(_0x27a938,_0x65d1af){var _0x53441d=squel['select']()['field']('ui.'+_0x1b4ee6+'InteractionId','id')[_0xee2f('0x8')]('ui.createdAt')[_0xee2f('0x73')](_0xee2f('0x74')+_0x12373b+_0xee2f('0x75'),'ui')[_0xee2f('0x76')](_0xee2f('0x77'),_0x4b9d29['id']);return _0x1b6f4c[_0xee2f('0x78')]['query'](_0x53441d['toString'](),_0x2f3891)[_0xee2f('0x5')](function(_0x58e464){_0x4b9d29[_0x1b4ee6+_0xee2f('0x79')]=_0x58e464;_0x27a938(_0x58e464);})['catch'](function(_0x7167f9){_0x65d1af(_0x7167f9);});});}return _0x169cf9['define'](_0xee2f('0x7a'),attributes,{'tableName':_0xee2f('0x7b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2f419c){var _0x5655f4={'raw':![],'where':{}};var _0x3cc477={};var _0x3fd375={'count':0x0,'rows':[]};var _0x3bdfc5=_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x7d')];var _0x486146=_0x2f419c[_0xee2f('0x7c')]['mergeResources']||![];var _0x3ee766=_0x4d68d3(_0x3bdfc5,_0x486146);if(!_0x3ee766[_0xee2f('0x12')])throw new Error(_0xee2f('0x7e')+_0x3bdfc5+'\x27');var _0x353bd9=[{'name':_0x3bdfc5}];if(!_[_0xee2f('0x7f')](_0x3ee766[_0xee2f('0x18')]))_0x353bd9=_0x3ee766[_0xee2f('0x18')];var _0x15c7ff=[];for(var _0x191af8=0x0;_0x191af8<_0x353bd9[_0xee2f('0x80')];_0x191af8++){_0x15c7ff[_0xee2f('0x81')](_0x1b6f4c['UserProfileSection'][_0xee2f('0x82')]({'where':{'userProfileId':_0x2f419c[_0xee2f('0x83')]['id'],'name':_0x353bd9[_0x191af8]['name']},'raw':!![]}));}return Promise[_0xee2f('0x84')](_0x15c7ff)['then'](function(_0x4372cc){var _0x4ed7c9=_['filter'](_0x4372cc,function(_0x465acd){return _0x465acd?_0x465acd:undefined;});var _0x46ecac=_[_0xee2f('0x3')](_0x353bd9,[_0xee2f('0x85'),!![]]);var _0x48c3fa=_['isEmpty'](_0x4ed7c9)&&_[_0xee2f('0x7f')](_0x46ecac)?null:_[_0xee2f('0x86')](_0x46ecac,_0x4ed7c9);if(!_0x48c3fa)return null;var _0x42fae8=[];for(var _0x5d4fe8=0x0;_0x5d4fe8<_0x48c3fa[_0xee2f('0x80')];_0x5d4fe8++){var _0x413d70=_['find'](_0x353bd9,function(_0x1f1c55){return _0x48c3fa[_0x5d4fe8]?_0x1f1c55[_0xee2f('0xb')]===_0x48c3fa[_0x5d4fe8][_0xee2f('0xb')]:null;});if(_0x413d70){if(_0x48c3fa[_0x5d4fe8][_0xee2f('0x85')]){_0x42fae8[_0xee2f('0x81')](_0x2d2b03(_0x3ee766[_0xee2f('0x12')],_0x48c3fa[_0x5d4fe8]));}else{if(!_0x48c3fa[_0x5d4fe8][_0xee2f('0x87')]){_0x42fae8[_0xee2f('0x81')](_0x1bbf7d(_0x413d70,_0x48c3fa[_0x5d4fe8],_0x3ee766[_0xee2f('0x12')]));}else{if(_0x413d70['model']){_0x42fae8['push'](_0x4818df(_0x413d70,_0x48c3fa[_0x5d4fe8]));}}}}}return Promise['all'](_0x42fae8);})[_0xee2f('0x5')](function(_0x19ce25){var _0x4288eb=_0x19ce25;var _0x7ab1db=null;if(_0x4288eb){_0x7ab1db=_0x4288eb[_0xee2f('0x80')]===0x1?_0x4288eb[0x0]:null;}if(!_0x7ab1db&&!_0x4288eb)return _0x3fd375;var _0x4f7be1=_0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x88')];_0x3cc477['model']=_[_0xee2f('0x89')](_0x4f7be1);_0x3cc477[_0xee2f('0x7c')]=_[_0xee2f('0x89')](_0x2f419c['query']);_0x3cc477[_0xee2f('0x8a')]=_['intersection'](_0x3cc477[_0xee2f('0xa')],_0x3cc477[_0xee2f('0x7c')]);_0x5655f4['attributes']=_[_0xee2f('0x8b')](_0x3cc477[_0xee2f('0xa')],qs['fields'](_0x2f419c['query']['fields']));_0x5655f4[_0xee2f('0x8c')]=_0x5655f4['attributes']['length']?_0x5655f4[_0xee2f('0x8c')]:_0x3cc477[_0xee2f('0xa')];if(!_0x2f419c['query'][_0xee2f('0x8d')]('nolimit')){_0x5655f4[_0xee2f('0x8e')]=qs[_0xee2f('0x8e')](_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x8e')]);_0x5655f4[_0xee2f('0x8f')]=qs[_0xee2f('0x8f')](_0x2f419c[_0xee2f('0x7c')]['offset']);}_0x5655f4[_0xee2f('0x90')]=qs[_0xee2f('0x91')](_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x91')]);_0x5655f4[_0xee2f('0x76')]=qs['filters'](_[_0xee2f('0x92')](_0x2f419c[_0xee2f('0x7c')],_0x3cc477[_0xee2f('0x8a')]));if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x3')]){_0x5655f4[_0xee2f('0x76')]=_['merge'](_0x5655f4['where'],{'$or':_[_0xee2f('0x7')](_0x4f7be1,function(_0x28320c){if(_0x28320c[_0xee2f('0xe')][_0xee2f('0x93')]!==_0xee2f('0x94')){var _0x266fb7={};_0x266fb7[_0x28320c[_0xee2f('0x8')]]={'$like':'%'+_0x2f419c['query']['filter']+'%'};return _0x266fb7;}})});}var _0x2ad26d=[];var _0x27eabc=null;var _0x12c4f9={};if(_0x7ab1db){_0x27eabc=_[_0xee2f('0x82')](_0x353bd9,[_0xee2f('0xb'),_0x7ab1db[_0xee2f('0xb')]]);if(_0x27eabc[_0xee2f('0x8')]){_0x12c4f9={};if(_0x3ee766[_0xee2f('0x12')]===_0xee2f('0xd')){_0x12c4f9[_0x27eabc[_0xee2f('0x95')]]=_[_0xee2f('0x7')](_0x7ab1db[_0xee2f('0x6')],'id');}else{_0x12c4f9[_0x27eabc['foreignKey']]=_0x7ab1db['associatedResources'];}_0x2ad26d[_0xee2f('0x81')](_0x12c4f9);}else{_0x5655f4['where']['id']=_0x7ab1db['associatedResources'];}}else{for(var _0x5a460d=0x0;_0x5a460d<_0x4288eb['length'];_0x5a460d++){_0x27eabc=_[_0xee2f('0x82')](_0x353bd9,[_0xee2f('0xb'),_0x4288eb[_0x5a460d]['name']]);if(_0x27eabc['field']){_0x12c4f9={};_0x12c4f9[_0x27eabc[_0xee2f('0x95')]]=_0x4288eb[_0x5a460d][_0xee2f('0x6')];_0x2ad26d[_0xee2f('0x81')](_0x12c4f9);}else{if(!_0x5655f4['where']['id'])_0x5655f4['where']['id']=[];_0x4288eb[_0x5a460d][_0xee2f('0x6')][_0xee2f('0x96')](function(_0x499d0e){_0x5655f4['where']['id'][_0xee2f('0x81')](_0x499d0e);});}}}if(!_['isEmpty'](_0x2ad26d)){_0x5655f4[_0xee2f('0x76')]=_['merge'](_0x5655f4[_0xee2f('0x76')],{'$and':{'$or':_0x2ad26d}});}_0x5655f4=_[_0xee2f('0x97')]({},_0x5655f4,_0x2f419c[_0xee2f('0x98')]);if(_0x7ab1db&&!_0x7ab1db['autoAssociation']&&_0x3ee766['childModel']===_0xee2f('0xd')){if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x99')]){_0x5655f4['include']=[{'all':!![]}];}return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x4')](_0x5655f4)[_0xee2f('0x5')](function(_0x346fc2){var _0x413340=[];_0x346fc2[_0xee2f('0x96')](function(_0x411afb){var _0x16326e;switch(_0x411afb[_0xee2f('0x9a')]){case _0xee2f('0x9b'):_0x16326e=_[_0xee2f('0x82')](_0x7ab1db[_0xee2f('0x6')],function(_0x28bde7){return _0x28bde7['id']===_0x411afb[_0xee2f('0x6b')]&&_0x28bde7['type']===_0xee2f('0x9c');});break;case _0xee2f('0x9d'):_0x16326e=_[_0xee2f('0x82')](_0x7ab1db[_0xee2f('0x6')],function(_0x23f8c7){return _0x23f8c7['id']===_0x411afb[_0xee2f('0x6b')]&&_0x23f8c7[_0xee2f('0xe')]===_0xee2f('0x9e');});break;}if(_0x16326e)_0x413340[_0xee2f('0x81')](_0x411afb);});_0x3fd375[_0xee2f('0x9f')]=_0x413340[_0xee2f('0x80')];_0x3fd375['rows']=_0x413340;return _0x3fd375;});}else{return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x9f')]({'where':_0x5655f4[_0xee2f('0x76')]})[_0xee2f('0x5')](function(_0x53d769){_0x3fd375[_0xee2f('0x9f')]=_0x53d769;if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x99')]){if(_0x3ee766['childModel']==='CmContact'){_0x5655f4[_0xee2f('0xa0')]=[{'model':_0x1b6f4c['Tag'],'as':'Tags','attributes':['id','name',_0xee2f('0xa1')],'required':_0x2f419c[_0xee2f('0x7c')][_0xee2f('0xa2')]?!![]:![]},{'model':_0x1b6f4c[_0xee2f('0x62')],'as':'ThroughTags','attributes':['id',_0xee2f('0xb'),_0xee2f('0xa1')],'through':_0x2f419c[_0xee2f('0x7c')]['tag']?{'attributes':[],'where':{'TagId':_0x2f419c[_0xee2f('0x7c')]['tag']||undefined}}:{},'required':_0x2f419c[_0xee2f('0x7c')]['tag']?!![]:![]}];}else{_0x5655f4['include']=[{'all':!![]}];}}return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]]['findAll'](_0x5655f4);})[_0xee2f('0x5')](function(_0x5a95e0){_0x3fd375['rows']=_0x5a95e0;if(_0x3bdfc5===_0xee2f('0x2d')&&_0x2f419c[_0xee2f('0x7c')]['openTabs']===_0xee2f('0xa3')){var _0x34f882=[];for(var _0x4fe164=0x0;_0x4fe164<_0x3fd375['rows'][_0xee2f('0x80')];_0x4fe164++){_0x34f882[_0xee2f('0x81')](_0x5d6c40('chat',_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa6'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164]['dataValues']));_0x34f882['push'](_0x5d6c40('fax',_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa7'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa8'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa9'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));}return Promise[_0xee2f('0x84')](_0x34f882)[_0xee2f('0x5')](function(){return _0x3fd375;});}return _0x3fd375;});}});}}});}; \ No newline at end of file +var _0x4c60=['rows','count','CmContact','tag','ThroughTags','color','openTabs','chat','dataValues','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','filter','field','value','findAll','then','model','associatedResources','map','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','contacts','Lists','ListId','lists','CmList','companies','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','VoiceQueues','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','smsqueues','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','trunks','plugins','Plugin','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','sequelize','query','UserProfile','user_profiles','section','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','union','length','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','key','foreignKey','forEach','merge','includeAll','include','default','DefaultReports','custom','CustomReports'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x4c60,0xc1));var _0x04c6=function(_0x4a0892,_0x36bf56){_0x4a0892=_0x4a0892-0x0;var _0x5772d6=_0x4c60[_0x4a0892];return _0x5772d6;};'use strict';var _=require(_0x04c6('0x0'));var attributes=require(_0x04c6('0x1'));var qs=require(_0x04c6('0x2'));var squel=require(_0x04c6('0x3'));module['exports']=function(_0x2a1d36){var _0x5d9fa3=_0x2a1d36['models'];function _0x4ad4f1(_0x53ca7a,_0x3a9493){return new Promise(function(_0xc6e772,_0x2054da){if(!_0x3a9493)return _0xc6e772(null);var _0x12bd5d=_0x3a9493[_0x04c6('0x4')]?{[_0x3a9493[_0x04c6('0x4')][_0x04c6('0x5')]]:_0x3a9493['filter'][_0x04c6('0x6')]}:undefined;return _0x5d9fa3[_0x53ca7a][_0x04c6('0x7')]({'where':_0x12bd5d,'raw':!![]})[_0x04c6('0x8')](function(_0x30b901){_0x3a9493['associatedResources']=_['map'](_0x30b901,'id');_0xc6e772(_0x3a9493);})['catch'](function(_0x376da8){_0x2054da(_0x376da8);});});}function _0x5584cd(_0x15d31a,_0x2772fa){return new Promise(function(_0x5236c8,_0x4316f8){var _0x19eb01=_0x15d31a[_0x04c6('0x4')]?{[_0x15d31a[_0x04c6('0x4')]['field']]:_0x15d31a[_0x04c6('0x4')][_0x04c6('0x6')]}:undefined;return _0x5d9fa3[_0x15d31a[_0x04c6('0x9')]]['findAll']({'where':_0x19eb01,'raw':!![]})[_0x04c6('0x8')](function(_0x15cbe0){_0x2772fa[_0x04c6('0xa')]=_[_0x04c6('0xb')](_0x15cbe0,function(_0x4760f8){return _0x4760f8[_0x04c6('0xc')];});_0x5236c8(_0x2772fa);})[_0x04c6('0xd')](function(_0x3d46a9){_0x4316f8(_0x3d46a9);});});}function _0x5a5a66(_0x31edf9,_0xa2bc92,_0x382e58){if(!_0xa2bc92)return Promise[_0x04c6('0xe')](null);return new Promise(function(_0x43596a,_0xfb4db5){return _0x5d9fa3[_0x04c6('0xf')][_0x04c6('0x7')]({'where':{'sectionId':_0xa2bc92['id']},'raw':!![]})['then'](function(_0x142065){if(_0x31edf9[_0x04c6('0x5')]&&_0x31edf9[_0x04c6('0x5')]!=='id'){_0xa2bc92['associatedResources']=_['map'](_0x142065,function(_0x53ac86){return _0x53ac86[_0x31edf9[_0x04c6('0x5')]];});}else{if(_0x382e58===_0x04c6('0x10')){_0xa2bc92['associatedResources']=_['map'](_0x142065,function(_0x1e6854){return{'id':_0x1e6854[_0x04c6('0x11')],'type':_0x1e6854[_0x04c6('0x12')]};});}else{_0xa2bc92['associatedResources']=_[_0x04c6('0xb')](_0x142065,function(_0x13f2dc){return _0x13f2dc[_0x04c6('0x11')];});}}_0x43596a(_0xa2bc92);})['catch'](function(_0x2d3277){_0xfb4db5(_0x2d3277);});});}function _0x41e29f(_0x562491,_0x54a8b0){var _0x4c8d72={'parentSections':[]};switch(_0x562491[_0x04c6('0x13')]()){case _0x04c6('0x14'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x16');break;case _0x04c6('0x17'):_0x4c8d72['childModel']='SquareOdbc';break;case _0x04c6('0x18'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x19');_0x4c8d72[_0x04c6('0x1a')]=[{'name':_0x04c6('0x1b'),'field':_0x04c6('0xc'),'foreignKey':'projectName'}];break;case _0x04c6('0x1c'):_0x4c8d72[_0x04c6('0x15')]='JscriptyProject';break;case _0x04c6('0x1d'):_0x4c8d72[_0x04c6('0x15')]='CmContact';_0x4c8d72['parentSections']=[{'name':_0x04c6('0x1e'),'field':'id','foreignKey':_0x04c6('0x1f')}];break;case _0x04c6('0x20'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x21');break;case _0x04c6('0x22'):_0x4c8d72['childModel']='CmCompany';break;case'globalcustomfields':_0x4c8d72[_0x04c6('0x15')]='CmCustomField';break;case _0x04c6('0x23'):_0x4c8d72[_0x04c6('0x15')]='ChatQueue';break;case _0x04c6('0x24'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x25');break;case _0x04c6('0x26'):_0x4c8d72['childModel']=_0x04c6('0x27');break;case _0x04c6('0x28'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x29');break;case _0x04c6('0x2a'):case _0x04c6('0x2b'):case _0x04c6('0x2c'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x2d');break;case _0x04c6('0x2e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x2f');break;case _0x04c6('0x30'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x31');break;case'voicerecordings':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x32');_0x4c8d72[_0x04c6('0x1a')]=[{'name':_0x04c6('0x33'),'field':'name','foreignKey':_0x04c6('0x34'),'model':_0x04c6('0x35'),'filter':{'field':'role','value':['agent']}},{'name':'Telephones','field':_0x04c6('0xc'),'foreignKey':_0x04c6('0x34'),'model':'User','filter':{'field':_0x04c6('0x36'),'value':['telephone']}},{'name':_0x04c6('0x37'),'field':_0x04c6('0xc'),'foreignKey':_0x04c6('0x38'),'model':_0x04c6('0x39'),'filter':{'field':'type','value':['inbound']}},{'name':_0x04c6('0x3a'),'field':_0x04c6('0xc'),'foreignKey':'queue','model':_0x04c6('0x39'),'filter':{'field':'type','value':['outbound']}}];break;case _0x04c6('0x3b'):_0x4c8d72['childModel']=_0x04c6('0x3c');break;case _0x04c6('0x3d'):_0x4c8d72['childModel']=_0x04c6('0x3e');break;case'voiceprefixes':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x3f');break;case _0x04c6('0x40'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x41');break;case'mailqueues':_0x4c8d72[_0x04c6('0x15')]='MailQueue';break;case _0x04c6('0x42'):_0x4c8d72['childModel']=_0x04c6('0x43');break;case _0x04c6('0x44'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x45');break;case _0x04c6('0x46'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x47');break;case'openchannelaccounts':_0x4c8d72[_0x04c6('0x15')]='OpenchannelAccount';break;case _0x04c6('0x48'):_0x4c8d72['childModel']='SmsQueue';break;case _0x04c6('0x49'):_0x4c8d72['childModel']=_0x04c6('0x4a');break;case _0x04c6('0x4b'):_0x4c8d72[_0x04c6('0x15')]='WhatsappQueue';break;case _0x04c6('0x4c'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x4d');break;case _0x04c6('0x4e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x4f');break;case _0x04c6('0x50'):case'queuecampaigns':_0x4c8d72['childModel']=_0x04c6('0x39');if(_0x54a8b0){_0x4c8d72[_0x04c6('0x1a')]=[{'name':_0x04c6('0x37')},{'name':'QueueCampaigns'}];}break;case _0x04c6('0x51'):case _0x04c6('0x52'):case _0x04c6('0x53'):_0x4c8d72['childModel']='User';if(_0x54a8b0){_0x4c8d72['parentSections']=[{'name':_0x04c6('0x54'),'filter':{'field':_0x04c6('0x36'),'value':['admin',_0x04c6('0x55')]},'ignore':!![]},{'name':_0x04c6('0x33')},{'name':_0x04c6('0x56')}];}break;case'zendeskaccounts':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x57');break;case'salesforceaccounts':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x58');break;case _0x04c6('0x59'):_0x4c8d72[_0x04c6('0x15')]='FreshdeskAccount';break;case _0x04c6('0x5a'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x5b');break;case _0x04c6('0x5c'):_0x4c8d72['childModel']=_0x04c6('0x5d');break;case _0x04c6('0x5e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x5f');break;case'vtigeraccounts':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x35');break;case _0x04c6('0x60'):_0x4c8d72['childModel']=_0x04c6('0x61');break;case _0x04c6('0x62'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x63');break;case _0x04c6('0x64'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x65');break;case _0x04c6('0x66'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x67');break;case _0x04c6('0x68'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x69');break;case'scheduler':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6a');break;case _0x04c6('0x6b'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6c');break;case'tags':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6d');break;case _0x04c6('0x6e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6f');break;case _0x04c6('0x70'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x71');break;case _0x04c6('0x72'):_0x4c8d72[_0x04c6('0x15')]='Trunk';break;case'variables':_0x4c8d72['childModel']='Variable';break;case _0x04c6('0x73'):_0x4c8d72['childModel']=_0x04c6('0x74');break;case'extractedreports':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x10');_0x4c8d72['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x04c6('0x75')}];break;case _0x04c6('0x76'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x77');break;}return _0x4c8d72;}function _0x583b3c(_0x2fb324,_0xf4e9d6){var _0x216cb0=_0x2fb324[_0x04c6('0x78')](0x0)[_0x04c6('0x79')]()+_0x2fb324[_0x04c6('0x7a')](0x1);var _0x145854={'type':_0x5d9fa3['Sequelize'][_0x04c6('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x4336a3,_0x3bbd8b){var _0x4bcdab=squel[_0x04c6('0x7c')]()[_0x04c6('0x5')](_0x04c6('0x7d')+_0x216cb0+_0x04c6('0x7e'),'id')[_0x04c6('0x5')](_0x04c6('0x7f'))[_0x04c6('0x80')](_0x04c6('0x81')+_0x2fb324+'_interactions','ui')[_0x04c6('0x82')]('ui.UserId\x20=\x20?',_0xf4e9d6['id']);return _0x5d9fa3[_0x04c6('0x83')][_0x04c6('0x84')](_0x4bcdab['toString'](),_0x145854)['then'](function(_0x2e649d){_0xf4e9d6[_0x216cb0+'OpenTabs']=_0x2e649d;_0x4336a3(_0x2e649d);})[_0x04c6('0xd')](function(_0x4530de){_0x3bbd8b(_0x4530de);});});}return _0x2a1d36['define'](_0x04c6('0x85'),attributes,{'tableName':_0x04c6('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xae0006){var _0x1cc1a1={'raw':![],'where':{}};var _0x2be139={};var _0xd12535={'count':0x0,'rows':[]};var _0x3e5a53=_0xae0006[_0x04c6('0x84')][_0x04c6('0x87')];var _0x129731=_0xae0006[_0x04c6('0x84')]['mergeResources']||![];var _0x3aaa1e=_0x41e29f(_0x3e5a53,_0x129731);if(!_0x3aaa1e[_0x04c6('0x15')])throw new Error(_0x04c6('0x88')+_0x3e5a53+'\x27');var _0x12394f=[{'name':_0x3e5a53}];if(!_['isEmpty'](_0x3aaa1e[_0x04c6('0x1a')]))_0x12394f=_0x3aaa1e[_0x04c6('0x1a')];var _0x1b38d1=[];for(var _0x49be80=0x0;_0x49be80<_0x12394f['length'];_0x49be80++){_0x1b38d1[_0x04c6('0x89')](_0x5d9fa3[_0x04c6('0x8a')][_0x04c6('0x8b')]({'where':{'userProfileId':_0xae0006[_0x04c6('0x8c')]['id'],'name':_0x12394f[_0x49be80][_0x04c6('0xc')]},'raw':!![]}));}return Promise[_0x04c6('0x8d')](_0x1b38d1)['then'](function(_0x375159){var _0x173df7=_[_0x04c6('0x4')](_0x375159,function(_0x596ac0){return _0x596ac0?_0x596ac0:undefined;});var _0x4f0850=_[_0x04c6('0x4')](_0x12394f,[_0x04c6('0x8e'),!![]]);var _0x1c62da=_[_0x04c6('0x8f')](_0x173df7)&&_['isEmpty'](_0x4f0850)?null:_[_0x04c6('0x90')](_0x4f0850,_0x173df7);if(!_0x1c62da)return null;var _0x4d4e50=[];for(var _0x5b5b09=0x0;_0x5b5b09<_0x1c62da[_0x04c6('0x91')];_0x5b5b09++){var _0xe178dd=_[_0x04c6('0x8b')](_0x12394f,function(_0x1904d4){return _0x1c62da[_0x5b5b09]?_0x1904d4[_0x04c6('0xc')]===_0x1c62da[_0x5b5b09][_0x04c6('0xc')]:null;});if(_0xe178dd){if(_0x1c62da[_0x5b5b09][_0x04c6('0x8e')]){_0x4d4e50['push'](_0x4ad4f1(_0x3aaa1e[_0x04c6('0x15')],_0x1c62da[_0x5b5b09]));}else{if(!_0x1c62da[_0x5b5b09][_0x04c6('0x92')]){_0x4d4e50[_0x04c6('0x89')](_0x5a5a66(_0xe178dd,_0x1c62da[_0x5b5b09],_0x3aaa1e[_0x04c6('0x15')]));}else{if(_0xe178dd[_0x04c6('0x9')]){_0x4d4e50['push'](_0x5584cd(_0xe178dd,_0x1c62da[_0x5b5b09]));}}}}}return Promise['all'](_0x4d4e50);})[_0x04c6('0x8')](function(_0x598941){var _0x2df63b=_0x598941;var _0x518e4e=null;if(_0x2df63b){_0x518e4e=_0x2df63b[_0x04c6('0x91')]===0x1?_0x2df63b[0x0]:null;}if(!_0x518e4e&&!_0x2df63b)return _0xd12535;var _0x467f3b=_0x5d9fa3[_0x3aaa1e['childModel']][_0x04c6('0x93')];_0x2be139[_0x04c6('0x9')]=_[_0x04c6('0x94')](_0x467f3b);_0x2be139[_0x04c6('0x84')]=_[_0x04c6('0x94')](_0xae0006[_0x04c6('0x84')]);_0x2be139[_0x04c6('0x95')]=_[_0x04c6('0x96')](_0x2be139[_0x04c6('0x9')],_0x2be139[_0x04c6('0x84')]);_0x1cc1a1[_0x04c6('0x97')]=_[_0x04c6('0x96')](_0x2be139[_0x04c6('0x9')],qs['fields'](_0xae0006[_0x04c6('0x84')][_0x04c6('0x98')]));_0x1cc1a1['attributes']=_0x1cc1a1[_0x04c6('0x97')][_0x04c6('0x91')]?_0x1cc1a1[_0x04c6('0x97')]:_0x2be139[_0x04c6('0x9')];if(!_0xae0006[_0x04c6('0x84')]['hasOwnProperty'](_0x04c6('0x99'))){_0x1cc1a1['limit']=qs[_0x04c6('0x9a')](_0xae0006['query'][_0x04c6('0x9a')]);_0x1cc1a1[_0x04c6('0x9b')]=qs[_0x04c6('0x9b')](_0xae0006[_0x04c6('0x84')][_0x04c6('0x9b')]);}_0x1cc1a1[_0x04c6('0x9c')]=qs[_0x04c6('0x9d')](_0xae0006[_0x04c6('0x84')][_0x04c6('0x9d')]);_0x1cc1a1['where']=qs[_0x04c6('0x95')](_[_0x04c6('0x9e')](_0xae0006['query'],_0x2be139[_0x04c6('0x95')]));if(_0xae0006['query'][_0x04c6('0x4')]){_0x1cc1a1[_0x04c6('0x82')]=_['merge'](_0x1cc1a1[_0x04c6('0x82')],{'$or':_[_0x04c6('0xb')](_0x467f3b,function(_0x5bdad4){if(_0x5bdad4[_0x04c6('0x12')][_0x04c6('0x9f')]!=='VIRTUAL'){var _0x7b9132={};_0x7b9132[_0x5bdad4[_0x04c6('0x5')]]={'$like':'%'+_0xae0006['query'][_0x04c6('0x4')]+'%'};return _0x7b9132;}})});}var _0x186aa0=[];var _0x4f02d9=null;var _0x5314ee={};if(_0x518e4e){_0x4f02d9=_['find'](_0x12394f,[_0x04c6('0xc'),_0x518e4e[_0x04c6('0xc')]]);if(_0x4f02d9[_0x04c6('0x5')]){_0x5314ee={};if(_0x3aaa1e[_0x04c6('0x15')]===_0x04c6('0x10')){_0x5314ee[_0x4f02d9['foreignKey']]=_[_0x04c6('0xb')](_0x518e4e[_0x04c6('0xa')],'id');}else{_0x5314ee[_0x4f02d9[_0x04c6('0xa0')]]=_0x518e4e[_0x04c6('0xa')];}_0x186aa0[_0x04c6('0x89')](_0x5314ee);}else{_0x1cc1a1[_0x04c6('0x82')]['id']=_0x518e4e[_0x04c6('0xa')];}}else{for(var _0x51858a=0x0;_0x51858a<_0x2df63b[_0x04c6('0x91')];_0x51858a++){_0x4f02d9=_['find'](_0x12394f,[_0x04c6('0xc'),_0x2df63b[_0x51858a]['name']]);if(_0x4f02d9['field']){_0x5314ee={};_0x5314ee[_0x4f02d9[_0x04c6('0xa0')]]=_0x2df63b[_0x51858a]['associatedResources'];_0x186aa0[_0x04c6('0x89')](_0x5314ee);}else{if(!_0x1cc1a1[_0x04c6('0x82')]['id'])_0x1cc1a1[_0x04c6('0x82')]['id']=[];_0x2df63b[_0x51858a][_0x04c6('0xa')][_0x04c6('0xa1')](function(_0x48fbdd){_0x1cc1a1['where']['id'][_0x04c6('0x89')](_0x48fbdd);});}}}if(!_[_0x04c6('0x8f')](_0x186aa0)){_0x1cc1a1[_0x04c6('0x82')]=_[_0x04c6('0xa2')](_0x1cc1a1[_0x04c6('0x82')],{'$and':{'$or':_0x186aa0}});}_0x1cc1a1=_[_0x04c6('0xa2')]({},_0x1cc1a1,_0xae0006['options']);if(_0x518e4e&&!_0x518e4e[_0x04c6('0x92')]&&_0x3aaa1e['childModel']==='AnalyticExtractedReport'){if(_0xae0006[_0x04c6('0x84')][_0x04c6('0xa3')]){_0x1cc1a1[_0x04c6('0xa4')]=[{'all':!![]}];}return _0x5d9fa3[_0x3aaa1e[_0x04c6('0x15')]][_0x04c6('0x7')](_0x1cc1a1)[_0x04c6('0x8')](function(_0x2e65f0){var _0x243553=[];_0x2e65f0[_0x04c6('0xa1')](function(_0x3dd78e){var _0x21dc7c;switch(_0x3dd78e['reportType']){case _0x04c6('0xa5'):_0x21dc7c=_['find'](_0x518e4e['associatedResources'],function(_0x38164e){return _0x38164e['id']===_0x3dd78e[_0x04c6('0x75')]&&_0x38164e[_0x04c6('0x12')]===_0x04c6('0xa6');});break;case _0x04c6('0xa7'):_0x21dc7c=_[_0x04c6('0x8b')](_0x518e4e[_0x04c6('0xa')],function(_0x383437){return _0x383437['id']===_0x3dd78e[_0x04c6('0x75')]&&_0x383437[_0x04c6('0x12')]===_0x04c6('0xa8');});break;}if(_0x21dc7c)_0x243553['push'](_0x3dd78e);});_0xd12535['count']=_0x243553[_0x04c6('0x91')];_0xd12535[_0x04c6('0xa9')]=_0x243553;return _0xd12535;});}else{return _0x5d9fa3[_0x3aaa1e['childModel']][_0x04c6('0xaa')]({'where':_0x1cc1a1[_0x04c6('0x82')]})['then'](function(_0x4504fc){_0xd12535[_0x04c6('0xaa')]=_0x4504fc;if(_0xae0006[_0x04c6('0x84')][_0x04c6('0xa3')]){if(_0x3aaa1e[_0x04c6('0x15')]===_0x04c6('0xab')){_0x1cc1a1[_0x04c6('0xa4')]=[{'model':_0x5d9fa3[_0x04c6('0x6d')],'as':'Tags','attributes':['id',_0x04c6('0xc'),'color'],'required':_0xae0006[_0x04c6('0x84')][_0x04c6('0xac')]?!![]:![]},{'model':_0x5d9fa3[_0x04c6('0x6d')],'as':_0x04c6('0xad'),'attributes':['id',_0x04c6('0xc'),_0x04c6('0xae')],'through':_0xae0006['query'][_0x04c6('0xac')]?{'attributes':[],'where':{'TagId':_0xae0006[_0x04c6('0x84')][_0x04c6('0xac')]||undefined}}:{},'required':_0xae0006['query']['tag']?!![]:![]}];}else{_0x1cc1a1['include']=[{'all':!![]}];}}return _0x5d9fa3[_0x3aaa1e[_0x04c6('0x15')]][_0x04c6('0x7')](_0x1cc1a1);})['then'](function(_0xd17fa3){_0xd12535[_0x04c6('0xa9')]=_0xd17fa3;if(_0x3e5a53===_0x04c6('0x33')&&_0xae0006['query'][_0x04c6('0xaf')]==='true'){var _0x1c0c74=[];for(var _0x3a1b76=0x0;_0x3a1b76<_0xd12535[_0x04c6('0xa9')]['length'];_0x3a1b76++){_0x1c0c74['push'](_0x583b3c(_0x04c6('0xb0'),_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c('sms',_0xd12535['rows'][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c(_0x04c6('0xb2'),_0xd12535['rows'][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c(_0x04c6('0xb3'),_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c(_0x04c6('0xb4'),_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c('whatsapp',_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));}return Promise[_0x04c6('0x8d')](_0x1c0c74)[_0x04c6('0x8')](function(){return _0xd12535;});}return _0xd12535;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d4ee255..f04b6af 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 _0x5502=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2c301c,_0x4aca4c){var _0x2a073b=function(_0x1896b6){while(--_0x1896b6){_0x2c301c['push'](_0x2c301c['shift']());}};_0x2a073b(++_0x4aca4c);}(_0x5502,0x69));var _0x2550=function(_0x57cc49,_0x44ab4b){_0x57cc49=_0x57cc49-0x0;var _0x5dc398=_0x5502[_0x57cc49];return _0x5dc398;};'use strict';var _=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var moment=require(_0x2550('0x2'));var BPromise=require(_0x2550('0x3'));var rs=require(_0x2550('0x4'));var fs=require('fs');var Redis=require(_0x2550('0x5'));var db=require(_0x2550('0x6'))['db'];var utils=require(_0x2550('0x7'));var logger=require(_0x2550('0x8'))(_0x2550('0x9'));var config=require(_0x2550('0xa'));var jayson=require(_0x2550('0xb'));var client=jayson[_0x2550('0xc')]['http']({'port':0x232a});config[_0x2550('0xd')]=_['defaults'](config['redis'],{'host':_0x2550('0xe'),'port':0x18eb});var socket=require(_0x2550('0xf'))(new Redis(config['redis']));require(_0x2550('0x10'))['register'](socket);function respondWithRpcPromise(_0x5a35,_0xd9345,_0x43a7df){return new BPromise(function(_0x1691d6,_0x4266cc){return client[_0x2550('0x11')](_0x5a35,_0x43a7df)['then'](function(_0x1d958b){logger[_0x2550('0x12')](_0x2550('0x13'),_0xd9345,_0x2550('0x14'));logger['debug'](_0x2550('0x15'),_0xd9345,_0x2550('0x14'),JSON['stringify'](_0x1d958b));if(_0x1d958b[_0x2550('0x16')]){if(_0x1d958b[_0x2550('0x16')][_0x2550('0x17')]===0x1f4){logger[_0x2550('0x16')](_0x2550('0x13'),_0xd9345,_0x1d958b[_0x2550('0x16')]['message']);return _0x4266cc(_0x1d958b[_0x2550('0x16')][_0x2550('0x18')]);}logger[_0x2550('0x16')](_0x2550('0x13'),_0xd9345,_0x1d958b[_0x2550('0x16')][_0x2550('0x18')]);return _0x1691d6(_0x1d958b['error'][_0x2550('0x18')]);}else{logger[_0x2550('0x12')](_0x2550('0x13'),_0xd9345,'request\x20sent');_0x1691d6(_0x1d958b[_0x2550('0x19')]['message']);}})['catch'](function(_0x190946){logger['error'](_0x2550('0x13'),_0xd9345,_0x190946);_0x4266cc(_0x190946);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x2ef3,0xba));var _0x32ef=function(_0x48d610,_0x27e09f){_0x48d610=_0x48d610-0x0;var _0x946827=_0x2ef3[_0x48d610];return _0x946827;};'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')]('UserProfile,\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']('UserProfile,\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);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3ea4ecf..b81ffc8 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 _0x1a4d=['userProfile:','./userProfile.events','save','remove','emit','removeListener','register','length'];(function(_0x27def7,_0x3f0835){var _0x581cbc=function(_0x5b8ae4){while(--_0x5b8ae4){_0x27def7['push'](_0x27def7['shift']());}};_0x581cbc(++_0x3f0835);}(_0x1a4d,0x171));var _0xd1a4=function(_0x34c628,_0x1b59c2){_0x34c628=_0x34c628-0x0;var _0x3d96ec=_0x1a4d[_0x34c628];return _0x3d96ec;};'use strict';var UserProfileEvents=require(_0xd1a4('0x0'));var events=[_0xd1a4('0x1'),_0xd1a4('0x2'),'update'];function createListener(_0x426846,_0x2b30e6){return function(_0x108fde){_0x2b30e6[_0xd1a4('0x3')](_0x426846,_0x108fde);};}function removeListener(_0x1f26fd,_0x3b59a0){return function(){UserProfileEvents[_0xd1a4('0x4')](_0x1f26fd,_0x3b59a0);};}exports[_0xd1a4('0x5')]=function(_0x1a54ea){for(var _0x71d7d4=0x0,_0x4f5197=events[_0xd1a4('0x6')];_0x71d7d4<_0x4f5197;_0x71d7d4++){var _0x952352=events[_0x71d7d4];var _0x57adf2=createListener(_0xd1a4('0x7')+_0x952352,_0x1a54ea);UserProfileEvents['on'](_0x952352,_0x57adf2);}}; \ No newline at end of file +var _0xc7b5=['save','remove','update','emit','removeListener','register','userProfile:','./userProfile.events'];(function(_0x271899,_0x3c843a){var _0x3e12cc=function(_0x3102b8){while(--_0x3102b8){_0x271899['push'](_0x271899['shift']());}};_0x3e12cc(++_0x3c843a);}(_0xc7b5,0x97));var _0x5c7b=function(_0x59e45d,_0x4eae77){_0x59e45d=_0x59e45d-0x0;var _0x10ec22=_0xc7b5[_0x59e45d];return _0x10ec22;};'use strict';var UserProfileEvents=require(_0x5c7b('0x0'));var events=[_0x5c7b('0x1'),_0x5c7b('0x2'),_0x5c7b('0x3')];function createListener(_0x2d4166,_0x1fa9a7){return function(_0x332fc5){_0x1fa9a7[_0x5c7b('0x4')](_0x2d4166,_0x332fc5);};}function removeListener(_0x12b154,_0x123bee){return function(){UserProfileEvents[_0x5c7b('0x5')](_0x12b154,_0x123bee);};}exports[_0x5c7b('0x6')]=function(_0x43bd62){for(var _0x5cb34e=0x0,_0x146bf4=events['length'];_0x5cb34e<_0x146bf4;_0x5cb34e++){var _0x536d51=events[_0x5cb34e];var _0xca6aec=createListener(_0x5c7b('0x7')+_0x536d51,_0x43bd62);UserProfileEvents['on'](_0x536d51,_0xca6aec);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 5960b1f..0628a76 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 _0xfcad=['fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','post','put','destroy','util','path'];(function(_0x2c5b4c,_0x3d0f01){var _0x16db0d=function(_0x499f84){while(--_0x499f84){_0x2c5b4c['push'](_0x2c5b4c['shift']());}};_0x16db0d(++_0x3d0f01);}(_0xfcad,0xa6));var _0xdfca=function(_0x510ae8,_0x557243){_0x510ae8=_0x510ae8-0x0;var _0x803b46=_0xfcad[_0x510ae8];return _0x803b46;};'use strict';var multer=require('multer');var util=require(_0xdfca('0x0'));var path=require(_0xdfca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdfca('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xdfca('0x3'));var config=require(_0xdfca('0x4'));var controller=require(_0xdfca('0x5'));router[_0xdfca('0x6')]('/',auth[_0xdfca('0x7')](),controller[_0xdfca('0x8')]);router[_0xdfca('0x6')](_0xdfca('0x9'),auth[_0xdfca('0x7')](),controller['describe']);router[_0xdfca('0x6')](_0xdfca('0xa'),auth[_0xdfca('0x7')](),controller['show']);router[_0xdfca('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdfca('0xc')](_0xdfca('0xa'),auth[_0xdfca('0x7')](),controller['update']);router['delete']('/:id',auth[_0xdfca('0x7')](),controller[_0xdfca('0xd')]);module['exports']=router; \ No newline at end of file +var _0x628e=['get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller'];(function(_0x36909f,_0x4f45a5){var _0x512c12=function(_0x45f2a5){while(--_0x45f2a5){_0x36909f['push'](_0x36909f['shift']());}};_0x512c12(++_0x4f45a5);}(_0x628e,0xe9));var _0xe628=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x628e[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xe628('0x0'));var util=require(_0xe628('0x1'));var path=require(_0xe628('0x2'));var timeout=require(_0xe628('0x3'));var express=require(_0xe628('0x4'));var router=express[_0xe628('0x5')]();var fs_extra=require(_0xe628('0x6'));var auth=require(_0xe628('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe628('0x8'));router[_0xe628('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe628('0xa'),auth[_0xe628('0xb')](),controller[_0xe628('0xc')]);router[_0xe628('0x9')]('/:id',auth[_0xe628('0xb')](),controller[_0xe628('0xd')]);router[_0xe628('0xe')]('/',auth[_0xe628('0xb')](),controller[_0xe628('0xf')]);router[_0xe628('0x10')](_0xe628('0x11'),auth[_0xe628('0xb')](),controller[_0xe628('0x12')]);router[_0xe628('0x13')]('/:id',auth[_0xe628('0xb')](),controller[_0xe628('0x14')]);module[_0xe628('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8b0d83c..71bfefc 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 _0x85e2=['exports','STRING'];(function(_0x210138,_0x41462b){var _0x185746=function(_0x415dc2){while(--_0x415dc2){_0x210138['push'](_0x210138['shift']());}};_0x185746(++_0x41462b);}(_0x85e2,0x17a));var _0x285e=function(_0x1055ff,_0x71c531){_0x1055ff=_0x1055ff-0x0;var _0x5125c2=_0x85e2[_0x1055ff];return _0x5125c2;};'use strict';var Sequelize=require('sequelize');module[_0x285e('0x0')]={'name':{'type':Sequelize[_0x285e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1d36=['sequelize','exports','STRING'];(function(_0x1155d4,_0x236a16){var _0x2f424a=function(_0x5e6ad4){while(--_0x5e6ad4){_0x1155d4['push'](_0x1155d4['shift']());}};_0x2f424a(++_0x236a16);}(_0x1d36,0x8d));var _0x61d3=function(_0x169163,_0x4737c7){_0x169163=_0x169163-0x0;var _0x4a2080=_0x1d36[_0x169163];return _0x4a2080;};'use strict';var Sequelize=require(_0x61d3('0x0'));module[_0x61d3('0x1')]={'name':{'type':Sequelize[_0x61d3('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 85d60e9..b33c00a 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 _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x5beb45,_0x2cef68){var _0x29781d=function(_0x413e30){while(--_0x413e30){_0x5beb45['push'](_0x5beb45['shift']());}};_0x29781d(++_0x2cef68);}(_0x57ca,0x108));var _0xa57c=function(_0x4ee243,_0x56fa14){_0x4ee243=_0x4ee243-0x0;var _0x2aa25a=_0x57ca[_0x4ee243];return _0x2aa25a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file +var _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xacf4,0xe7));var _0x4acf=function(_0x318309,_0x430ab9){_0x318309=_0x318309-0x0;var _0x4c25ff=_0xacf4[_0x318309];return _0x4c25ff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e55e7c2..cd3fd7f 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 _0xed10=['../../config/logger','request-promise','path','./userProfileResource.attributes','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xed10,0xbc));var _0x0ed1=function(_0x12306d,_0x2b8f14){_0x12306d=_0x12306d-0x0;var _0x16804f=_0xed10[_0x12306d];return _0x16804f;};'use strict';var _=require(_0x0ed1('0x0'));var util=require(_0x0ed1('0x1'));var logger=require(_0x0ed1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ed1('0x3'));var fs=require('fs');var path=require(_0x0ed1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ed1('0x5'));module['exports']=function(_0x474e82,_0x383418){return _0x474e82['define'](_0x0ed1('0x6'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x0ed1('0x7'),'fields':[_0x0ed1('0x8'),_0x0ed1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5e2=['lodash','bluebird','path','exports','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0xe76139,_0x23acc4){var _0xb2bd6f=function(_0x5e9740){while(--_0x5e9740){_0xe76139['push'](_0xe76139['shift']());}};_0xb2bd6f(++_0x23acc4);}(_0xc5e2,0x16c));var _0x2c5e=function(_0x42676a,_0x5804eb){_0x42676a=_0x42676a-0x0;var _0x1b76d2=_0xc5e2[_0x42676a];return _0x1b76d2;};'use strict';var _=require(_0x2c5e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2c5e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c5e('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x2c5e('0x3')]=function(_0x31b284,_0x13f3ae){return _0x31b284['define'](_0x2c5e('0x4'),attributes,{'tableName':_0x2c5e('0x5'),'paranoid':![],'indexes':[{'name':_0x2c5e('0x6'),'fields':['resourceId','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 bad3573..6bc3926 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 _0x7ea1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0x7ea1,0x9d));var _0x17ea=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x7ea1[_0xfc406a];return _0x395473;};'use strict';var _=require(_0x17ea('0x0'));var util=require(_0x17ea('0x1'));var moment=require(_0x17ea('0x2'));var BPromise=require(_0x17ea('0x3'));var rs=require(_0x17ea('0x4'));var fs=require('fs');var Redis=require(_0x17ea('0x5'));var db=require(_0x17ea('0x6'))['db'];var utils=require(_0x17ea('0x7'));var logger=require('../../config/logger')(_0x17ea('0x8'));var config=require(_0x17ea('0x9'));var jayson=require(_0x17ea('0xa'));var client=jayson[_0x17ea('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2058aa,_0x1bc1fc,_0x83012a){return new BPromise(function(_0x578a0e,_0x407681){return client[_0x17ea('0xc')](_0x2058aa,_0x83012a)[_0x17ea('0xd')](function(_0x35a52d){logger[_0x17ea('0xe')](_0x17ea('0xf'),_0x1bc1fc,_0x17ea('0x10'));logger['debug'](_0x17ea('0x11'),_0x1bc1fc,_0x17ea('0x10'),JSON['stringify'](_0x35a52d));if(_0x35a52d[_0x17ea('0x12')]){if(_0x35a52d[_0x17ea('0x12')][_0x17ea('0x13')]===0x1f4){logger[_0x17ea('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x1bc1fc,_0x35a52d['error'][_0x17ea('0x14')]);return _0x407681(_0x35a52d[_0x17ea('0x12')][_0x17ea('0x14')]);}logger['error'](_0x17ea('0xf'),_0x1bc1fc,_0x35a52d[_0x17ea('0x12')][_0x17ea('0x14')]);return _0x578a0e(_0x35a52d[_0x17ea('0x12')][_0x17ea('0x14')]);}else{logger[_0x17ea('0xe')](_0x17ea('0xf'),_0x1bc1fc,'request\x20sent');_0x578a0e(_0x35a52d[_0x17ea('0x15')][_0x17ea('0x14')]);}})[_0x17ea('0x16')](function(_0x169242){logger[_0x17ea('0x12')](_0x17ea('0xf'),_0x1bc1fc,_0x169242);_0x407681(_0x169242);});});} \ No newline at end of file +var _0xeae0=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1b6f3e,_0x1e3e85){var _0x5b6f9d=function(_0x5a7f92){while(--_0x5a7f92){_0x1b6f3e['push'](_0x1b6f3e['shift']());}};_0x5b6f9d(++_0x1e3e85);}(_0xeae0,0x1b7));var _0x0eae=function(_0x2c40bf,_0x5ce37a){_0x2c40bf=_0x2c40bf-0x0;var _0x31ab19=_0xeae0[_0x2c40bf];return _0x31ab19;};'use strict';var _=require(_0x0eae('0x0'));var util=require(_0x0eae('0x1'));var moment=require(_0x0eae('0x2'));var BPromise=require('bluebird');var rs=require(_0x0eae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eae('0x4'))['db'];var utils=require(_0x0eae('0x5'));var logger=require(_0x0eae('0x6'))(_0x0eae('0x7'));var config=require(_0x0eae('0x8'));var jayson=require(_0x0eae('0x9'));var client=jayson[_0x0eae('0xa')][_0x0eae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26810d,_0x45e1a6,_0x3435e0){return new BPromise(function(_0x29deb5,_0x42aeb8){return client['request'](_0x26810d,_0x3435e0)[_0x0eae('0xc')](function(_0x58bcf8){logger[_0x0eae('0xd')](_0x0eae('0xe'),_0x45e1a6,_0x0eae('0xf'));logger[_0x0eae('0x10')](_0x0eae('0x11'),_0x45e1a6,_0x0eae('0xf'),JSON[_0x0eae('0x12')](_0x58bcf8));if(_0x58bcf8[_0x0eae('0x13')]){if(_0x58bcf8[_0x0eae('0x13')][_0x0eae('0x14')]===0x1f4){logger[_0x0eae('0x13')](_0x0eae('0xe'),_0x45e1a6,_0x58bcf8[_0x0eae('0x13')]['message']);return _0x42aeb8(_0x58bcf8[_0x0eae('0x13')][_0x0eae('0x15')]);}logger[_0x0eae('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x45e1a6,_0x58bcf8['error'][_0x0eae('0x15')]);return _0x29deb5(_0x58bcf8['error'][_0x0eae('0x15')]);}else{logger['info'](_0x0eae('0xe'),_0x45e1a6,'request\x20sent');_0x29deb5(_0x58bcf8[_0x0eae('0x16')][_0x0eae('0x15')]);}})['catch'](function(_0x1dae44){logger[_0x0eae('0x13')](_0x0eae('0xe'),_0x45e1a6,_0x1dae44);_0x42aeb8(_0x1dae44);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6605bc8..f7bbc8a 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 _0xe9b3=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x52c8e8,_0x5ee20d){var _0x31bb1a=function(_0x47233a){while(--_0x47233a){_0x52c8e8['push'](_0x52c8e8['shift']());}};_0x31bb1a(++_0x5ee20d);}(_0xe9b3,0x85));var _0x3e9b=function(_0x3ae54b,_0x6440fb){_0x3ae54b=_0x3ae54b-0x0;var _0x3b72e5=_0xe9b3[_0x3ae54b];return _0x3b72e5;};'use strict';var multer=require(_0x3e9b('0x0'));var util=require(_0x3e9b('0x1'));var path=require(_0x3e9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e9b('0x3'));var router=express[_0x3e9b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3e9b('0x5'));var config=require(_0x3e9b('0x6'));var controller=require(_0x3e9b('0x7'));router['get']('/',auth[_0x3e9b('0x8')](),controller[_0x3e9b('0x9')]);router[_0x3e9b('0xa')]('/describe',auth[_0x3e9b('0x8')](),controller['describe']);router[_0x3e9b('0xa')](_0x3e9b('0xb'),auth[_0x3e9b('0x8')](),controller[_0x3e9b('0xc')]);router['post']('/',auth[_0x3e9b('0x8')](),controller[_0x3e9b('0xd')]);router[_0x3e9b('0xe')](_0x3e9b('0xb'),auth['isAuthenticated'](),controller[_0x3e9b('0xf')]);router[_0x3e9b('0x10')](_0x3e9b('0xb'),auth['isAuthenticated'](),controller[_0x3e9b('0x11')]);module[_0x3e9b('0x12')]=router; \ No newline at end of file +var _0x5e58=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0xcbee1d,_0x4bbdfe){var _0x4e64bb=function(_0x202825){while(--_0x202825){_0xcbee1d['push'](_0xcbee1d['shift']());}};_0x4e64bb(++_0x4bbdfe);}(_0x5e58,0x190));var _0x85e5=function(_0x2542d1,_0xdb7645){_0x2542d1=_0x2542d1-0x0;var _0xec2ce7=_0x5e58[_0x2542d1];return _0xec2ce7;};'use strict';var multer=require(_0x85e5('0x0'));var util=require(_0x85e5('0x1'));var path=require(_0x85e5('0x2'));var timeout=require('connect-timeout');var express=require(_0x85e5('0x3'));var router=express['Router']();var fs_extra=require(_0x85e5('0x4'));var auth=require(_0x85e5('0x5'));var interaction=require(_0x85e5('0x6'));var config=require(_0x85e5('0x7'));var controller=require(_0x85e5('0x8'));router[_0x85e5('0x9')]('/',auth[_0x85e5('0xa')](),controller[_0x85e5('0xb')]);router[_0x85e5('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x85e5('0x9')](_0x85e5('0xc'),auth[_0x85e5('0xa')](),controller['show']);router[_0x85e5('0xd')]('/',auth[_0x85e5('0xa')](),controller[_0x85e5('0xe')]);router[_0x85e5('0xf')](_0x85e5('0xc'),auth[_0x85e5('0xa')](),controller[_0x85e5('0x10')]);router[_0x85e5('0x11')]('/:id',auth[_0x85e5('0xa')](),controller[_0x85e5('0x12')]);module[_0x85e5('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2a15e77..b95aacb 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 _0x5b12=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions'];(function(_0x3cb859,_0x593cf1){var _0x39e457=function(_0x4f9f7f){while(--_0x4f9f7f){_0x3cb859['push'](_0x3cb859['shift']());}};_0x39e457(++_0x593cf1);}(_0x5b12,0xa3));var _0x25b1=function(_0x3309a6,_0x33aabd){_0x3309a6=_0x3309a6-0x0;var _0x2ddabf=_0x5b12[_0x3309a6];return _0x2ddabf;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x25b1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x25b1('0x2')],'set':function(_0x47995b){this[_0x25b1('0x5')]('crudPermissions',_0x47995b?_0x47995b['join'](''):[]);},'get':function(){return this[_0x25b1('0x6')]('crudPermissions')?this['getDataValue'](_0x25b1('0x7'))[_0x25b1('0x8')](''):[];}}}; \ No newline at end of file +var _0xb688=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split','exports'];(function(_0x3a1afc,_0x5efc4c){var _0x261fb2=function(_0x56269b){while(--_0x56269b){_0x3a1afc['push'](_0x3a1afc['shift']());}};_0x261fb2(++_0x5efc4c);}(_0xb688,0xcf));var _0x8b68=function(_0x232672,_0x562bb8){_0x232672=_0x232672-0x0;var _0x71ba81=_0xb688[_0x232672];return _0x71ba81;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8b68('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41030e){this[_0x8b68('0x4')](_0x8b68('0x5'),_0x41030e?_0x41030e[_0x8b68('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8b68('0x5'))?this['getDataValue'](_0x8b68('0x5'))[_0x8b68('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 96da982..aa79506 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 _0x82e0=['offset','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','UserProfileSection','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0xcace09,_0x21e1df){var _0x36c712=function(_0x11acfa){while(--_0x11acfa){_0xcace09['push'](_0xcace09['shift']());}};_0x36c712(++_0x21e1df);}(_0x82e0,0x1af));var _0x082e=function(_0x2931d6,_0x3eff03){_0x2931d6=_0x2931d6-0x0;var _0x288cc9=_0x82e0[_0x2931d6];return _0x288cc9;};'use strict';var emlformat=require(_0x082e('0x0'));var rimraf=require(_0x082e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x082e('0x2'));var BPromise=require(_0x082e('0x3'));var Mustache=require(_0x082e('0x4'));var util=require(_0x082e('0x5'));var path=require('path');var sox=require(_0x082e('0x6'));var csv=require(_0x082e('0x7'));var ejs=require(_0x082e('0x8'));var fs=require('fs');var fs_extra=require(_0x082e('0x9'));var _=require(_0x082e('0xa'));var squel=require(_0x082e('0xb'));var crypto=require('crypto');var jsforce=require(_0x082e('0xc'));var deskjs=require(_0x082e('0xd'));var toCsv=require(_0x082e('0x7'));var querystring=require(_0x082e('0xe'));var Papa=require('papaparse');var Redis=require(_0x082e('0xf'));var authService=require(_0x082e('0x10'));var qs=require(_0x082e('0x11'));var as=require(_0x082e('0x12'));var hardwareService=require(_0x082e('0x13'));var logger=require(_0x082e('0x14'))('api');var utils=require(_0x082e('0x15'));var config=require(_0x082e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x082e('0x17'))['db'];function respondWithStatusCode(_0x3d5d8d,_0x2e1dbf){_0x2e1dbf=_0x2e1dbf||0xcc;return function(_0x5ac111){if(_0x5ac111){return _0x3d5d8d[_0x082e('0x18')](_0x2e1dbf);}return _0x3d5d8d[_0x082e('0x19')](_0x2e1dbf)[_0x082e('0x1a')]();};}function respondWithResult(_0x3d09c9,_0x182730){_0x182730=_0x182730||0xc8;return function(_0x5ae85c){if(_0x5ae85c){return _0x3d09c9[_0x082e('0x19')](_0x182730)[_0x082e('0x1b')](_0x5ae85c);}};}function respondWithFilteredResult(_0x2a012e,_0x14800d){return function(_0x28b7ee){if(_0x28b7ee){var _0x1a5a50=typeof _0x14800d['offset']===_0x082e('0x1c')&&typeof _0x14800d[_0x082e('0x1d')]===_0x082e('0x1c');var _0x2cb512=_0x28b7ee[_0x082e('0x1e')];var _0x47aa0d=_0x1a5a50?0x0:_0x14800d['offset'];var _0x47d03f=_0x1a5a50?_0x28b7ee['count']:_0x14800d[_0x082e('0x1f')]+_0x14800d['limit'];var _0x264b9e;if(_0x47d03f>=_0x2cb512){_0x47d03f=_0x2cb512;_0x264b9e=0xc8;}else{_0x264b9e=0xce;}_0x2a012e[_0x082e('0x19')](_0x264b9e);return _0x2a012e[_0x082e('0x20')](_0x082e('0x21'),_0x47aa0d+'-'+_0x47d03f+'/'+_0x2cb512)[_0x082e('0x1b')](_0x28b7ee);}return null;};}function patchUpdates(_0x2d3c02){return function(_0x58e01e){try{jsonpatch[_0x082e('0x22')](_0x58e01e,_0x2d3c02,!![]);}catch(_0x4eb3e1){return BPromise[_0x082e('0x23')](_0x4eb3e1);}return _0x58e01e['save']();};}function saveUpdates(_0x3b02af,_0x3c2581){return function(_0x56227b){if(_0x56227b){return _0x56227b[_0x082e('0x24')](_0x3b02af)['then'](function(_0x3dfc8c){return _0x3dfc8c;});}return null;};}function removeEntity(_0x34b11d,_0x1881fd){return function(_0x1a1e4c){if(_0x1a1e4c){return _0x1a1e4c[_0x082e('0x25')]()[_0x082e('0x26')](function(){_0x34b11d[_0x082e('0x19')](0xcc)[_0x082e('0x1a')]();});}};}function handleEntityNotFound(_0x41ef9b,_0x153d4d){return function(_0x3c5c74){if(!_0x3c5c74){_0x41ef9b['sendStatus'](0x194);}return _0x3c5c74;};}function handleError(_0x576ba6,_0x14aff9){_0x14aff9=_0x14aff9||0x1f4;return function(_0x27877c){logger[_0x082e('0x27')](_0x27877c['stack']);if(_0x27877c[_0x082e('0x28')]){delete _0x27877c[_0x082e('0x28')];}_0x576ba6[_0x082e('0x19')](_0x14aff9)[_0x082e('0x29')](_0x27877c);};}exports[_0x082e('0x2a')]=function(_0x314cb3,_0x5850cf){var _0x7ff13e={},_0x2fe7cb={},_0x1ddfd8={'count':0x0,'rows':[]};var _0x1470cc=_[_0x082e('0x2b')](db['UserProfileSection'][_0x082e('0x2c')],function(_0x1bc138){return{'name':_0x1bc138[_0x082e('0x2d')],'type':_0x1bc138[_0x082e('0x2e')]['key']};});_0x2fe7cb['model']=_[_0x082e('0x2b')](_0x1470cc,'name');_0x2fe7cb[_0x082e('0x2f')]=_['keys'](_0x314cb3[_0x082e('0x2f')]);_0x2fe7cb[_0x082e('0x30')]=_[_0x082e('0x31')](_0x2fe7cb[_0x082e('0x32')],_0x2fe7cb[_0x082e('0x2f')]);_0x7ff13e['attributes']=_[_0x082e('0x31')](_0x2fe7cb[_0x082e('0x32')],qs[_0x082e('0x33')](_0x314cb3['query'][_0x082e('0x33')]));_0x7ff13e[_0x082e('0x34')]=_0x7ff13e[_0x082e('0x34')][_0x082e('0x35')]?_0x7ff13e[_0x082e('0x34')]:_0x2fe7cb[_0x082e('0x32')];if(!_0x314cb3[_0x082e('0x2f')][_0x082e('0x36')](_0x082e('0x37'))){_0x7ff13e[_0x082e('0x1d')]=qs[_0x082e('0x1d')](_0x314cb3[_0x082e('0x2f')]['limit']);_0x7ff13e['offset']=qs['offset'](_0x314cb3[_0x082e('0x2f')]['offset']);}_0x7ff13e[_0x082e('0x38')]=qs[_0x082e('0x39')](_0x314cb3[_0x082e('0x2f')][_0x082e('0x39')]);_0x7ff13e[_0x082e('0x3a')]=qs[_0x082e('0x30')](_[_0x082e('0x3b')](_0x314cb3['query'],_0x2fe7cb[_0x082e('0x30')]),_0x1470cc);if(_0x314cb3[_0x082e('0x2f')][_0x082e('0x3c')]){_0x7ff13e[_0x082e('0x3a')]=_[_0x082e('0x3d')](_0x7ff13e['where'],{'$or':_['map'](_0x1470cc,function(_0x1b0f26){if(_0x1b0f26[_0x082e('0x2e')]!==_0x082e('0x3e')){var _0xbfb654={};_0xbfb654[_0x1b0f26[_0x082e('0x28')]]={'$like':'%'+_0x314cb3[_0x082e('0x2f')][_0x082e('0x3c')]+'%'};return _0xbfb654;}})});}_0x7ff13e=_['merge']({},_0x7ff13e,_0x314cb3['options']);var _0x207d52={'where':_0x7ff13e['where']};return db[_0x082e('0x3f')][_0x082e('0x1e')](_0x207d52)[_0x082e('0x26')](function(_0x2354ac){_0x1ddfd8['count']=_0x2354ac;if(_0x314cb3[_0x082e('0x2f')]['includeAll']){_0x7ff13e[_0x082e('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0x082e('0x41')](_0x7ff13e);})['then'](function(_0x476150){_0x1ddfd8[_0x082e('0x42')]=_0x476150;return _0x1ddfd8;})['then'](respondWithFilteredResult(_0x5850cf,_0x7ff13e))[_0x082e('0x43')](handleError(_0x5850cf,null));};exports[_0x082e('0x44')]=function(_0x1a0fa9,_0x148da6){var _0xf8e1c2={'raw':![],'where':{'id':_0x1a0fa9['params']['id']}},_0x621f31={};_0x621f31[_0x082e('0x32')]=_['keys'](db[_0x082e('0x3f')][_0x082e('0x2c')]);_0x621f31[_0x082e('0x2f')]=_[_0x082e('0x45')](_0x1a0fa9[_0x082e('0x2f')]);_0x621f31['filters']=_['intersection'](_0x621f31[_0x082e('0x32')],_0x621f31[_0x082e('0x2f')]);_0xf8e1c2[_0x082e('0x34')]=_[_0x082e('0x31')](_0x621f31[_0x082e('0x32')],qs[_0x082e('0x33')](_0x1a0fa9[_0x082e('0x2f')][_0x082e('0x33')]));_0xf8e1c2['attributes']=_0xf8e1c2[_0x082e('0x34')][_0x082e('0x35')]?_0xf8e1c2[_0x082e('0x34')]:_0x621f31[_0x082e('0x32')];if(_0x1a0fa9[_0x082e('0x2f')][_0x082e('0x46')]){_0xf8e1c2[_0x082e('0x40')]=[{'all':!![]}];}_0xf8e1c2=_[_0x082e('0x3d')]({},_0xf8e1c2,_0x1a0fa9[_0x082e('0x47')]);return db[_0x082e('0x3f')][_0x082e('0x48')](_0xf8e1c2)[_0x082e('0x26')](handleEntityNotFound(_0x148da6,null))[_0x082e('0x26')](respondWithResult(_0x148da6,null))['catch'](handleError(_0x148da6,null));};exports[_0x082e('0x49')]=function(_0x36729a,_0xbf6066){return db['UserProfileSection'][_0x082e('0x49')](_0x36729a['body'],{})[_0x082e('0x26')](respondWithResult(_0xbf6066,0xc9))[_0x082e('0x43')](handleError(_0xbf6066,null));};exports[_0x082e('0x24')]=function(_0x2466d4,_0x5e5257){if(_0x2466d4[_0x082e('0x4a')]['id']){delete _0x2466d4[_0x082e('0x4a')]['id'];}return db['UserProfileSection'][_0x082e('0x48')]({'where':{'id':_0x2466d4[_0x082e('0x4b')]['id']}})[_0x082e('0x26')](handleEntityNotFound(_0x5e5257,null))['then'](saveUpdates(_0x2466d4[_0x082e('0x4a')],null))['then'](respondWithResult(_0x5e5257,null))[_0x082e('0x43')](handleError(_0x5e5257,null));};exports[_0x082e('0x25')]=function(_0x151a53,_0xe14041){return db[_0x082e('0x3f')][_0x082e('0x48')]({'where':{'id':_0x151a53['params']['id']}})[_0x082e('0x26')](handleEntityNotFound(_0xe14041,null))[_0x082e('0x26')](removeEntity(_0xe14041,null))[_0x082e('0x43')](handleError(_0xe14041,null));};exports['describe']=function(_0x3a082f,_0x3a9d85){return db['UserProfileSection'][_0x082e('0x4c')]()[_0x082e('0x26')](respondWithResult(_0x3a9d85,null))[_0x082e('0x43')](handleError(_0x3a9d85,null));}; \ No newline at end of file +var _0x5abb=['name','send','index','map','UserProfileSection','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','options','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','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','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','error'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x5abb,0x1f4));var _0xb5ab=function(_0x2b3ba0,_0x37dc6f){_0x2b3ba0=_0x2b3ba0-0x0;var _0x3e4617=_0x5abb[_0x2b3ba0];return _0x3e4617;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5ab('0x0'));var zipdir=require(_0xb5ab('0x1'));var jsonpatch=require(_0xb5ab('0x2'));var rp=require(_0xb5ab('0x3'));var moment=require(_0xb5ab('0x4'));var BPromise=require(_0xb5ab('0x5'));var Mustache=require(_0xb5ab('0x6'));var util=require(_0xb5ab('0x7'));var path=require('path');var sox=require(_0xb5ab('0x8'));var csv=require('to-csv');var ejs=require(_0xb5ab('0x9'));var fs=require('fs');var fs_extra=require(_0xb5ab('0xa'));var _=require(_0xb5ab('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb5ab('0xc'));var deskjs=require(_0xb5ab('0xd'));var toCsv=require(_0xb5ab('0xe'));var querystring=require(_0xb5ab('0xf'));var Papa=require(_0xb5ab('0x10'));var Redis=require(_0xb5ab('0x11'));var authService=require(_0xb5ab('0x12'));var qs=require(_0xb5ab('0x13'));var as=require(_0xb5ab('0x14'));var hardwareService=require(_0xb5ab('0x15'));var logger=require(_0xb5ab('0x16'))(_0xb5ab('0x17'));var utils=require('../../config/utils');var config=require(_0xb5ab('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1266a7,_0x572695){_0x572695=_0x572695||0xcc;return function(_0x53a8e7){if(_0x53a8e7){return _0x1266a7[_0xb5ab('0x19')](_0x572695);}return _0x1266a7[_0xb5ab('0x1a')](_0x572695)[_0xb5ab('0x1b')]();};}function respondWithResult(_0x2c06cc,_0x506aec){_0x506aec=_0x506aec||0xc8;return function(_0x43b8c3){if(_0x43b8c3){return _0x2c06cc[_0xb5ab('0x1a')](_0x506aec)['json'](_0x43b8c3);}};}function respondWithFilteredResult(_0x5ad5f9,_0x420a74){return function(_0x261b8f){if(_0x261b8f){var _0x5209b8=typeof _0x420a74[_0xb5ab('0x1c')]===_0xb5ab('0x1d')&&typeof _0x420a74[_0xb5ab('0x1e')]===_0xb5ab('0x1d');var _0x22e29a=_0x261b8f[_0xb5ab('0x1f')];var _0x1fd4d1=_0x5209b8?0x0:_0x420a74[_0xb5ab('0x1c')];var _0x46b626=_0x5209b8?_0x261b8f[_0xb5ab('0x1f')]:_0x420a74[_0xb5ab('0x1c')]+_0x420a74[_0xb5ab('0x1e')];var _0x26b3cd;if(_0x46b626>=_0x22e29a){_0x46b626=_0x22e29a;_0x26b3cd=0xc8;}else{_0x26b3cd=0xce;}_0x5ad5f9[_0xb5ab('0x1a')](_0x26b3cd);return _0x5ad5f9['set'](_0xb5ab('0x20'),_0x1fd4d1+'-'+_0x46b626+'/'+_0x22e29a)[_0xb5ab('0x21')](_0x261b8f);}return null;};}function patchUpdates(_0x3fe71b){return function(_0x11d035){try{jsonpatch[_0xb5ab('0x22')](_0x11d035,_0x3fe71b,!![]);}catch(_0x4050d1){return BPromise[_0xb5ab('0x23')](_0x4050d1);}return _0x11d035['save']();};}function saveUpdates(_0x5bad58,_0x554a0f){return function(_0x4d9a5e){if(_0x4d9a5e){return _0x4d9a5e[_0xb5ab('0x24')](_0x5bad58)[_0xb5ab('0x25')](function(_0x578b3e){return _0x578b3e;});}return null;};}function removeEntity(_0x53cbf2,_0x342b34){return function(_0x373b52){if(_0x373b52){return _0x373b52['destroy']()['then'](function(){_0x53cbf2['status'](0xcc)[_0xb5ab('0x1b')]();});}};}function handleEntityNotFound(_0x212fbf,_0x3f446a){return function(_0x50c8ea){if(!_0x50c8ea){_0x212fbf['sendStatus'](0x194);}return _0x50c8ea;};}function handleError(_0x14ba66,_0x515552){_0x515552=_0x515552||0x1f4;return function(_0x3db421){logger[_0xb5ab('0x26')](_0x3db421['stack']);if(_0x3db421[_0xb5ab('0x27')]){delete _0x3db421[_0xb5ab('0x27')];}_0x14ba66[_0xb5ab('0x1a')](_0x515552)[_0xb5ab('0x28')](_0x3db421);};}exports[_0xb5ab('0x29')]=function(_0x1ad1ae,_0x452a49){var _0x54a0cd={},_0x33f0be={},_0x9bc996={'count':0x0,'rows':[]};var _0x26d96c=_[_0xb5ab('0x2a')](db[_0xb5ab('0x2b')]['rawAttributes'],function(_0x4213ed){return{'name':_0x4213ed[_0xb5ab('0x2c')],'type':_0x4213ed[_0xb5ab('0x2d')][_0xb5ab('0x2e')]};});_0x33f0be[_0xb5ab('0x2f')]=_[_0xb5ab('0x2a')](_0x26d96c,_0xb5ab('0x27'));_0x33f0be['query']=_['keys'](_0x1ad1ae[_0xb5ab('0x30')]);_0x33f0be['filters']=_[_0xb5ab('0x31')](_0x33f0be[_0xb5ab('0x2f')],_0x33f0be[_0xb5ab('0x30')]);_0x54a0cd[_0xb5ab('0x32')]=_[_0xb5ab('0x31')](_0x33f0be['model'],qs[_0xb5ab('0x33')](_0x1ad1ae[_0xb5ab('0x30')][_0xb5ab('0x33')]));_0x54a0cd['attributes']=_0x54a0cd['attributes'][_0xb5ab('0x34')]?_0x54a0cd[_0xb5ab('0x32')]:_0x33f0be[_0xb5ab('0x2f')];if(!_0x1ad1ae['query'][_0xb5ab('0x35')]('nolimit')){_0x54a0cd['limit']=qs[_0xb5ab('0x1e')](_0x1ad1ae[_0xb5ab('0x30')][_0xb5ab('0x1e')]);_0x54a0cd[_0xb5ab('0x1c')]=qs[_0xb5ab('0x1c')](_0x1ad1ae[_0xb5ab('0x30')]['offset']);}_0x54a0cd[_0xb5ab('0x36')]=qs['sort'](_0x1ad1ae[_0xb5ab('0x30')][_0xb5ab('0x37')]);_0x54a0cd[_0xb5ab('0x38')]=qs['filters'](_[_0xb5ab('0x39')](_0x1ad1ae[_0xb5ab('0x30')],_0x33f0be[_0xb5ab('0x3a')]),_0x26d96c);if(_0x1ad1ae[_0xb5ab('0x30')][_0xb5ab('0x3b')]){_0x54a0cd['where']=_[_0xb5ab('0x3c')](_0x54a0cd[_0xb5ab('0x38')],{'$or':_['map'](_0x26d96c,function(_0x1afc9e){if(_0x1afc9e['type']!==_0xb5ab('0x3d')){var _0x11a949={};_0x11a949[_0x1afc9e[_0xb5ab('0x27')]]={'$like':'%'+_0x1ad1ae[_0xb5ab('0x30')][_0xb5ab('0x3b')]+'%'};return _0x11a949;}})});}_0x54a0cd=_[_0xb5ab('0x3c')]({},_0x54a0cd,_0x1ad1ae['options']);var _0x7ab1c0={'where':_0x54a0cd['where']};return db[_0xb5ab('0x2b')][_0xb5ab('0x1f')](_0x7ab1c0)[_0xb5ab('0x25')](function(_0x223e27){_0x9bc996[_0xb5ab('0x1f')]=_0x223e27;if(_0x1ad1ae[_0xb5ab('0x30')]['includeAll']){_0x54a0cd[_0xb5ab('0x3e')]=[{'all':!![]}];}return db[_0xb5ab('0x2b')][_0xb5ab('0x3f')](_0x54a0cd);})[_0xb5ab('0x25')](function(_0x6d4ee5){_0x9bc996[_0xb5ab('0x40')]=_0x6d4ee5;return _0x9bc996;})[_0xb5ab('0x25')](respondWithFilteredResult(_0x452a49,_0x54a0cd))[_0xb5ab('0x41')](handleError(_0x452a49,null));};exports[_0xb5ab('0x42')]=function(_0x226111,_0x12abc9){var _0x3517b6={'raw':![],'where':{'id':_0x226111[_0xb5ab('0x43')]['id']}},_0x352d49={};_0x352d49[_0xb5ab('0x2f')]=_['keys'](db[_0xb5ab('0x2b')][_0xb5ab('0x44')]);_0x352d49[_0xb5ab('0x30')]=_[_0xb5ab('0x45')](_0x226111[_0xb5ab('0x30')]);_0x352d49[_0xb5ab('0x3a')]=_[_0xb5ab('0x31')](_0x352d49[_0xb5ab('0x2f')],_0x352d49[_0xb5ab('0x30')]);_0x3517b6['attributes']=_[_0xb5ab('0x31')](_0x352d49[_0xb5ab('0x2f')],qs['fields'](_0x226111[_0xb5ab('0x30')][_0xb5ab('0x33')]));_0x3517b6['attributes']=_0x3517b6[_0xb5ab('0x32')][_0xb5ab('0x34')]?_0x3517b6[_0xb5ab('0x32')]:_0x352d49[_0xb5ab('0x2f')];if(_0x226111[_0xb5ab('0x30')][_0xb5ab('0x46')]){_0x3517b6[_0xb5ab('0x3e')]=[{'all':!![]}];}_0x3517b6=_[_0xb5ab('0x3c')]({},_0x3517b6,_0x226111[_0xb5ab('0x47')]);return db[_0xb5ab('0x2b')][_0xb5ab('0x48')](_0x3517b6)[_0xb5ab('0x25')](handleEntityNotFound(_0x12abc9,null))['then'](respondWithResult(_0x12abc9,null))[_0xb5ab('0x41')](handleError(_0x12abc9,null));};exports[_0xb5ab('0x49')]=function(_0x49c0d7,_0x6cdc04){return db[_0xb5ab('0x2b')][_0xb5ab('0x49')](_0x49c0d7[_0xb5ab('0x4a')],{})[_0xb5ab('0x25')](respondWithResult(_0x6cdc04,0xc9))[_0xb5ab('0x41')](handleError(_0x6cdc04,null));};exports['update']=function(_0x2dd780,_0x2c23da){if(_0x2dd780[_0xb5ab('0x4a')]['id']){delete _0x2dd780[_0xb5ab('0x4a')]['id'];}return db[_0xb5ab('0x2b')][_0xb5ab('0x48')]({'where':{'id':_0x2dd780[_0xb5ab('0x43')]['id']}})[_0xb5ab('0x25')](handleEntityNotFound(_0x2c23da,null))[_0xb5ab('0x25')](saveUpdates(_0x2dd780['body'],null))['then'](respondWithResult(_0x2c23da,null))[_0xb5ab('0x41')](handleError(_0x2c23da,null));};exports[_0xb5ab('0x4b')]=function(_0x10bccc,_0x4eff3a){return db['UserProfileSection']['find']({'where':{'id':_0x10bccc[_0xb5ab('0x43')]['id']}})[_0xb5ab('0x25')](handleEntityNotFound(_0x4eff3a,null))[_0xb5ab('0x25')](removeEntity(_0x4eff3a,null))[_0xb5ab('0x41')](handleError(_0x4eff3a,null));};exports[_0xb5ab('0x4c')]=function(_0x51862e,_0x236c35){return db[_0xb5ab('0x2b')][_0xb5ab('0x4c')]()[_0xb5ab('0x25')](respondWithResult(_0x236c35,null))[_0xb5ab('0x41')](handleError(_0x236c35,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 08f5b99..faef379 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 _0xc568=['sectionId','userProfileId','api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x3d9268,_0x12d933){var _0xc25ae1=function(_0x1d5d5a){while(--_0x1d5d5a){_0x3d9268['push'](_0x3d9268['shift']());}};_0xc25ae1(++_0x12d933);}(_0xc568,0xaa));var _0x8c56=function(_0x56d776,_0x252211){_0x56d776=_0x56d776-0x0;var _0x2be469=_0xc568[_0x56d776];return _0x2be469;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8c56('0x0'));var moment=require(_0x8c56('0x1'));var BPromise=require(_0x8c56('0x2'));var rp=require(_0x8c56('0x3'));var fs=require('fs');var path=require(_0x8c56('0x4'));var rimraf=require(_0x8c56('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c56('0x6'));module[_0x8c56('0x7')]=function(_0x2bbf44,_0x1b4f9f){return _0x2bbf44[_0x8c56('0x8')](_0x8c56('0x9'),attributes,{'tableName':_0x8c56('0xa'),'paranoid':![],'indexes':[{'name':_0x8c56('0xb'),'fields':[_0x8c56('0xc'),_0x8c56('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8e8=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','util'];(function(_0x49b61d,_0x2f9675){var _0x1a8eda=function(_0x5ade3b){while(--_0x5ade3b){_0x49b61d['push'](_0x49b61d['shift']());}};_0x1a8eda(++_0x2f9675);}(_0xc8e8,0x1ed));var _0x8c8e=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xc8e8[_0x272638];return _0x19d027;};'use strict';var _=require('lodash');var util=require(_0x8c8e('0x0'));var logger=require(_0x8c8e('0x1'))(_0x8c8e('0x2'));var moment=require(_0x8c8e('0x3'));var BPromise=require(_0x8c8e('0x4'));var rp=require(_0x8c8e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c8e('0x6'));var attributes=require(_0x8c8e('0x7'));module[_0x8c8e('0x8')]=function(_0x812a44,_0x3e7a01){return _0x812a44[_0x8c8e('0x9')](_0x8c8e('0xa'),attributes,{'tableName':_0x8c8e('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x8c8e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 963decd..d816dba 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 _0x0b09=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f9d13,_0x56905e){var _0x28aabe=function(_0xfdc4d5){while(--_0xfdc4d5){_0x4f9d13['push'](_0x4f9d13['shift']());}};_0x28aabe(++_0x56905e);}(_0x0b09,0x69));var _0x90b0=function(_0x27ca8c,_0x231aaa){_0x27ca8c=_0x27ca8c-0x0;var _0x4107b7=_0x0b09[_0x27ca8c];return _0x4107b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90b0('0x0'));var BPromise=require('bluebird');var rs=require(_0x90b0('0x1'));var fs=require('fs');var Redis=require(_0x90b0('0x2'));var db=require(_0x90b0('0x3'))['db'];var utils=require(_0x90b0('0x4'));var logger=require(_0x90b0('0x5'))('rpc');var config=require(_0x90b0('0x6'));var jayson=require(_0x90b0('0x7'));var client=jayson[_0x90b0('0x8')][_0x90b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32bf68,_0x4ecd99,_0x4e987f){return new BPromise(function(_0x2a5590,_0x56b76d){return client[_0x90b0('0xa')](_0x32bf68,_0x4e987f)[_0x90b0('0xb')](function(_0x76ec9a){logger[_0x90b0('0xc')](_0x90b0('0xd'),_0x4ecd99,'request\x20sent');logger[_0x90b0('0xe')](_0x90b0('0xf'),_0x4ecd99,_0x90b0('0x10'),JSON[_0x90b0('0x11')](_0x76ec9a));if(_0x76ec9a['error']){if(_0x76ec9a[_0x90b0('0x12')][_0x90b0('0x13')]===0x1f4){logger[_0x90b0('0x12')](_0x90b0('0xd'),_0x4ecd99,_0x76ec9a[_0x90b0('0x12')][_0x90b0('0x14')]);return _0x56b76d(_0x76ec9a[_0x90b0('0x12')][_0x90b0('0x14')]);}logger[_0x90b0('0x12')](_0x90b0('0xd'),_0x4ecd99,_0x76ec9a[_0x90b0('0x12')][_0x90b0('0x14')]);return _0x2a5590(_0x76ec9a[_0x90b0('0x12')][_0x90b0('0x14')]);}else{logger[_0x90b0('0xc')](_0x90b0('0xd'),_0x4ecd99,_0x90b0('0x10'));_0x2a5590(_0x76ec9a[_0x90b0('0x15')][_0x90b0('0x14')]);}})['catch'](function(_0x158565){logger['error'](_0x90b0('0xd'),_0x4ecd99,_0x158565);_0x56b76d(_0x158565);});});} \ No newline at end of file +var _0xbe3b=['request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x8b228f,_0x49891e){var _0x1a6335=function(_0x2168bc){while(--_0x2168bc){_0x8b228f['push'](_0x8b228f['shift']());}};_0x1a6335(++_0x49891e);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0xbe3b[_0x512550];return _0x19f661;};'use strict';var _=require('lodash');var util=require(_0xbbe3('0x0'));var moment=require(_0xbbe3('0x1'));var BPromise=require('bluebird');var rs=require(_0xbbe3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbbe3('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xbbe3('0x4'));var jayson=require(_0xbbe3('0x5'));var client=jayson[_0xbbe3('0x6')][_0xbbe3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c6976,_0x9bd4a9,_0x748756){return new BPromise(function(_0x40199b,_0x3c0c43){return client[_0xbbe3('0x8')](_0x4c6976,_0x748756)['then'](function(_0x1ff205){logger[_0xbbe3('0x9')](_0xbbe3('0xa'),_0x9bd4a9,_0xbbe3('0xb'));logger[_0xbbe3('0xc')](_0xbbe3('0xd'),_0x9bd4a9,_0xbbe3('0xb'),JSON[_0xbbe3('0xe')](_0x1ff205));if(_0x1ff205['error']){if(_0x1ff205[_0xbbe3('0xf')][_0xbbe3('0x10')]===0x1f4){logger[_0xbbe3('0xf')](_0xbbe3('0xa'),_0x9bd4a9,_0x1ff205['error']['message']);return _0x3c0c43(_0x1ff205[_0xbbe3('0xf')][_0xbbe3('0x11')]);}logger[_0xbbe3('0xf')](_0xbbe3('0xa'),_0x9bd4a9,_0x1ff205[_0xbbe3('0xf')][_0xbbe3('0x11')]);return _0x40199b(_0x1ff205['error'][_0xbbe3('0x11')]);}else{logger['info'](_0xbbe3('0xa'),_0x9bd4a9,_0xbbe3('0xb'));_0x40199b(_0x1ff205[_0xbbe3('0x12')][_0xbbe3('0x11')]);}})[_0xbbe3('0x13')](function(_0x2af60d){logger[_0xbbe3('0xf')](_0xbbe3('0xa'),_0x9bd4a9,_0x2af60d);_0x3c0c43(_0x2af60d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 95c158d..44f8ac1 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(_0x179e21,_0x26ada1){var _0x26bedf=function(_0x3af36b){while(--_0x3af36b){_0x179e21['push'](_0x179e21['shift']());}};_0x26bedf(++_0x26ada1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xcb91[_0x2d34d6];return _0x1d3d12;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4411a3,_0x382a0e){var _0x42424f=function(_0x495c4e){while(--_0x495c4e){_0x4411a3['push'](_0x4411a3['shift']());}};_0x42424f(++_0x382a0e);}(_0x70e0,0x17b));var _0x070e=function(_0x5ddcc5,_0x453b54){_0x5ddcc5=_0x5ddcc5-0x0;var _0x3a3843=_0x70e0[_0x5ddcc5];return _0x3a3843;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7e3f8eb..98ed685 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 _0x7063=['INTEGER','exports'];(function(_0x52dd90,_0x132712){var _0x2e16bb=function(_0x176552){while(--_0x176552){_0x52dd90['push'](_0x52dd90['shift']());}};_0x2e16bb(++_0x132712);}(_0x7063,0x157));var _0x3706=function(_0x5a3f48,_0x4166f7){_0x5a3f48=_0x5a3f48-0x0;var _0x27998a=_0x7063[_0x5a3f48];return _0x27998a;};'use strict';var Sequelize=require('sequelize');module[_0x3706('0x0')]={'penalty':{'type':Sequelize[_0x3706('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f14=['sequelize','exports','INTEGER'];(function(_0x4b62c0,_0x1fdac8){var _0x246f5e=function(_0x12e1c6){while(--_0x12e1c6){_0x4b62c0['push'](_0x4b62c0['shift']());}};_0x246f5e(++_0x1fdac8);}(_0x3f14,0x87));var _0x43f1=function(_0x87fb9d,_0x2ba366){_0x87fb9d=_0x87fb9d-0x0;var _0x30dcf6=_0x3f14[_0x87fb9d];return _0x30dcf6;};'use strict';var Sequelize=require(_0x43f1('0x0'));module[_0x43f1('0x1')]={'penalty':{'type':Sequelize[_0x43f1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 6f0169d..cf1f31b 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 _0x1893=['rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3acd21,_0x38a6e7){var _0x50033b=function(_0x466e67){while(--_0x466e67){_0x3acd21['push'](_0x3acd21['shift']());}};_0x50033b(++_0x38a6e7);}(_0x1893,0xa2));var _0x3189=function(_0x58f83c,_0x563967){_0x58f83c=_0x58f83c-0x0;var _0x5d2f70=_0x1893[_0x58f83c];return _0x5d2f70;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define','user_has_sms_queues','lodash'];(function(_0x36a8ca,_0x252ef5){var _0x2944c3=function(_0x14e46e){while(--_0x14e46e){_0x36a8ca['push'](_0x36a8ca['shift']());}};_0x2944c3(++_0x252ef5);}(_0x5496,0x175));var _0x6549=function(_0x21844e,_0x18034e){_0x21844e=_0x21844e-0x0;var _0x2681ed=_0x5496[_0x21844e];return _0x2681ed;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('UserSmsQueue',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index f0230ee..fc0e26a 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 _0x6844=['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','../../config/utils','rpc','jayson/promise','client','http','request','info'];(function(_0x4b64a4,_0x1bdc50){var _0xd19b0e=function(_0x4dfbe0){while(--_0x4dfbe0){_0x4b64a4['push'](_0x4b64a4['shift']());}};_0xd19b0e(++_0x1bdc50);}(_0x6844,0xfc));var _0x4684=function(_0x4f4547,_0x2b7b2f){_0x4f4547=_0x4f4547-0x0;var _0x5541de=_0x6844[_0x4f4547];return _0x5541de;};'use strict';var _=require(_0x4684('0x0'));var util=require(_0x4684('0x1'));var moment=require(_0x4684('0x2'));var BPromise=require(_0x4684('0x3'));var rs=require(_0x4684('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4684('0x5'));var logger=require('../../config/logger')(_0x4684('0x6'));var config=require('../../config/environment');var jayson=require(_0x4684('0x7'));var client=jayson[_0x4684('0x8')][_0x4684('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30f347,_0x187cea,_0x590fa8){return new BPromise(function(_0x2b329b,_0x4860df){return client[_0x4684('0xa')](_0x30f347,_0x590fa8)['then'](function(_0x16c8ac){logger[_0x4684('0xb')](_0x4684('0xc'),_0x187cea,_0x4684('0xd'));logger[_0x4684('0xe')](_0x4684('0xf'),_0x187cea,_0x4684('0xd'),JSON[_0x4684('0x10')](_0x16c8ac));if(_0x16c8ac[_0x4684('0x11')]){if(_0x16c8ac[_0x4684('0x11')][_0x4684('0x12')]===0x1f4){logger[_0x4684('0x11')](_0x4684('0xc'),_0x187cea,_0x16c8ac[_0x4684('0x11')]['message']);return _0x4860df(_0x16c8ac[_0x4684('0x11')][_0x4684('0x13')]);}logger[_0x4684('0x11')](_0x4684('0xc'),_0x187cea,_0x16c8ac[_0x4684('0x11')][_0x4684('0x13')]);return _0x2b329b(_0x16c8ac['error'][_0x4684('0x13')]);}else{logger[_0x4684('0xb')](_0x4684('0xc'),_0x187cea,_0x4684('0xd'));_0x2b329b(_0x16c8ac[_0x4684('0x14')][_0x4684('0x13')]);}})[_0x4684('0x15')](function(_0x305a6d){logger['error'](_0x4684('0xc'),_0x187cea,_0x305a6d);_0x4860df(_0x305a6d);});});} \ No newline at end of file +var _0x01cf=['error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x01cf,0x1a6));var _0xf01c=function(_0x26b1cd,_0x34f80d){_0x26b1cd=_0x26b1cd-0x0;var _0x2319d2=_0x01cf[_0x26b1cd];return _0x2319d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf01c('0x0'));var rs=require(_0xf01c('0x1'));var fs=require('fs');var Redis=require(_0xf01c('0x2'));var db=require(_0xf01c('0x3'))['db'];var utils=require(_0xf01c('0x4'));var logger=require(_0xf01c('0x5'))(_0xf01c('0x6'));var config=require(_0xf01c('0x7'));var jayson=require(_0xf01c('0x8'));var client=jayson[_0xf01c('0x9')][_0xf01c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a2024,_0x4a89ec,_0xb7392f){return new BPromise(function(_0x41b0c6,_0x7ed981){return client[_0xf01c('0xb')](_0x1a2024,_0xb7392f)['then'](function(_0x3035aa){logger[_0xf01c('0xc')](_0xf01c('0xd'),_0x4a89ec,_0xf01c('0xe'));logger[_0xf01c('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4a89ec,'request\x20sent',JSON[_0xf01c('0x10')](_0x3035aa));if(_0x3035aa['error']){if(_0x3035aa['error'][_0xf01c('0x11')]===0x1f4){logger['error'](_0xf01c('0xd'),_0x4a89ec,_0x3035aa[_0xf01c('0x12')][_0xf01c('0x13')]);return _0x7ed981(_0x3035aa[_0xf01c('0x12')]['message']);}logger[_0xf01c('0x12')](_0xf01c('0xd'),_0x4a89ec,_0x3035aa[_0xf01c('0x12')][_0xf01c('0x13')]);return _0x41b0c6(_0x3035aa[_0xf01c('0x12')]['message']);}else{logger[_0xf01c('0xc')](_0xf01c('0xd'),_0x4a89ec,_0xf01c('0xe'));_0x41b0c6(_0x3035aa[_0xf01c('0x14')]['message']);}})[_0xf01c('0x15')](function(_0xd783e9){logger[_0xf01c('0x12')](_0xf01c('0xd'),_0x4a89ec,_0xd783e9);_0x7ed981(_0xd783e9);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 4cb5432..74b1dab 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 _0x27dd=['sequelize','INTEGER'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x27dd,0x17e));var _0xd27d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x27dd[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xd27d('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xd27d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd27d('0x1')]}}; \ No newline at end of file +var _0xd58a=['exports','INTEGER','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd58a,0x15b));var _0xad58=function(_0x315432,_0x1f766f){_0x315432=_0x315432-0x0;var _0x52cef5=_0xd58a[_0x315432];return _0x52cef5;};'use strict';var Sequelize=require(_0xad58('0x0'));module[_0xad58('0x1')]={'UserId':{'type':Sequelize[_0xad58('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xad58('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 06f014e..e7b3014 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(_0xa05aa7,_0x340bb4){var _0x1b7c9c=function(_0x16ddea){while(--_0x16ddea){_0xa05aa7['push'](_0xa05aa7['shift']());}};_0x1b7c9c(++_0x340bb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0xc18e8f,_0x5c7b80){var _0x522694=function(_0x303cd6){while(--_0x303cd6){_0xc18e8f['push'](_0xc18e8f['shift']());}};_0x522694(++_0x5c7b80);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 7c5b9b8..32487e7 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x503ea8,_0x22e391){var _0x427e5d=function(_0x1484e8){while(--_0x1484e8){_0x503ea8['push'](_0x503ea8['shift']());}};_0x427e5d(++_0x22e391);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x25fc8f,_0x503318){var _0x316eba=function(_0x2c5fce){while(--_0x2c5fce){_0x25fc8f['push'](_0x25fc8f['shift']());}};_0x316eba(++_0x503318);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xcb91[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index befdf5a..501aa03 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 _0xf0aa=['sequelize','INTEGER'];(function(_0x18eb69,_0x2a8a32){var _0xeae740=function(_0x5ba09c){while(--_0x5ba09c){_0x18eb69['push'](_0x18eb69['shift']());}};_0xeae740(++_0x2a8a32);}(_0xf0aa,0x16e));var _0xaf0a=function(_0x3c4fab,_0x4efbcb){_0x3c4fab=_0x3c4fab-0x0;var _0x5896d3=_0xf0aa[_0x3c4fab];return _0x5896d3;};'use strict';var Sequelize=require(_0xaf0a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xaf0a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f13=['INTEGER','sequelize','exports'];(function(_0x5c0014,_0x7e9328){var _0x9eb66a=function(_0x1bba13){while(--_0x1bba13){_0x5c0014['push'](_0x5c0014['shift']());}};_0x9eb66a(++_0x7e9328);}(_0x1f13,0x1e7));var _0x31f1=function(_0x2db0cd,_0x54b07d){_0x2db0cd=_0x2db0cd-0x0;var _0x21332d=_0x1f13[_0x2db0cd];return _0x21332d;};'use strict';var Sequelize=require(_0x31f1('0x0'));module[_0x31f1('0x1')]={'penalty':{'type':Sequelize[_0x31f1('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 94b39bb..88a25a2 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 _0xd692=['path','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x548b44,_0x41f1e2){var _0x329ea6=function(_0x51c7b8){while(--_0x51c7b8){_0x548b44['push'](_0x548b44['shift']());}};_0x329ea6(++_0x41f1e2);}(_0xd692,0xf0));var _0x2d69=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd692[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x2d69('0x0'));var util=require(_0x2d69('0x1'));var logger=require(_0x2d69('0x2'))(_0x2d69('0x3'));var moment=require(_0x2d69('0x4'));var BPromise=require(_0x2d69('0x5'));var rp=require(_0x2d69('0x6'));var fs=require('fs');var path=require(_0x2d69('0x7'));var rimraf=require('rimraf');var config=require(_0x2d69('0x8'));var attributes=require(_0x2d69('0x9'));module[_0x2d69('0xa')]=function(_0x40f26a,_0x565584){return _0x40f26a[_0x2d69('0xb')]('UserVoiceQueue',attributes,{'tableName':_0x2d69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e4e=['./userVoiceQueue.attributes','exports','define','user_has_voice_queues','util','api','request-promise','path','rimraf'];(function(_0x492e2e,_0x5ce525){var _0x5344ec=function(_0x12dec9){while(--_0x12dec9){_0x492e2e['push'](_0x492e2e['shift']());}};_0x5344ec(++_0x5ce525);}(_0x2e4e,0x112));var _0xe2e4=function(_0xc1c9bf,_0x2ee118){_0xc1c9bf=_0xc1c9bf-0x0;var _0x53ee1f=_0x2e4e[_0xc1c9bf];return _0x53ee1f;};'use strict';var _=require('lodash');var util=require(_0xe2e4('0x0'));var logger=require('../../config/logger')(_0xe2e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe2e4('0x2'));var fs=require('fs');var path=require(_0xe2e4('0x3'));var rimraf=require(_0xe2e4('0x4'));var config=require('../../config/environment');var attributes=require(_0xe2e4('0x5'));module[_0xe2e4('0x6')]=function(_0x2721d1,_0x1f9463){return _0x2721d1[_0xe2e4('0x7')]('UserVoiceQueue',attributes,{'tableName':_0xe2e4('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 29c6f91..84fc4a0 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 _0xd1d7=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x23a97d,_0x528dfc){var _0x2f8cd4=function(_0x2a5385){while(--_0x2a5385){_0x23a97d['push'](_0x23a97d['shift']());}};_0x2f8cd4(++_0x528dfc);}(_0xd1d7,0xf2));var _0x7d1d=function(_0x420f39,_0x3f0304){_0x420f39=_0x420f39-0x0;var _0x543fdb=_0xd1d7[_0x420f39];return _0x543fdb;};'use strict';var _=require(_0x7d1d('0x0'));var util=require(_0x7d1d('0x1'));var moment=require(_0x7d1d('0x2'));var BPromise=require(_0x7d1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d1d('0x4'));var logger=require('../../config/logger')(_0x7d1d('0x5'));var config=require(_0x7d1d('0x6'));var jayson=require(_0x7d1d('0x7'));var client=jayson[_0x7d1d('0x8')][_0x7d1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35daae,_0xb42dcc,_0x34e342){return new BPromise(function(_0x5a1c16,_0x54c605){return client[_0x7d1d('0xa')](_0x35daae,_0x34e342)[_0x7d1d('0xb')](function(_0x2db42b){logger[_0x7d1d('0xc')](_0x7d1d('0xd'),_0xb42dcc,_0x7d1d('0xe'));logger['debug'](_0x7d1d('0xf'),_0xb42dcc,_0x7d1d('0xe'),JSON['stringify'](_0x2db42b));if(_0x2db42b['error']){if(_0x2db42b[_0x7d1d('0x10')][_0x7d1d('0x11')]===0x1f4){logger[_0x7d1d('0x10')](_0x7d1d('0xd'),_0xb42dcc,_0x2db42b[_0x7d1d('0x10')][_0x7d1d('0x12')]);return _0x54c605(_0x2db42b[_0x7d1d('0x10')][_0x7d1d('0x12')]);}logger[_0x7d1d('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0xb42dcc,_0x2db42b['error']['message']);return _0x5a1c16(_0x2db42b[_0x7d1d('0x10')][_0x7d1d('0x12')]);}else{logger['info'](_0x7d1d('0xd'),_0xb42dcc,_0x7d1d('0xe'));_0x5a1c16(_0x2db42b[_0x7d1d('0x13')][_0x7d1d('0x12')]);}})[_0x7d1d('0x14')](function(_0x1201ca){logger[_0x7d1d('0x10')](_0x7d1d('0xd'),_0xb42dcc,_0x1201ca);_0x54c605(_0x1201ca);});});} \ No newline at end of file +var _0x90b3=['http','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x90b3,0xf1));var _0x390b=function(_0x57961a,_0x5c91dd){_0x57961a=_0x57961a-0x0;var _0x52fccf=_0x90b3[_0x57961a];return _0x52fccf;};'use strict';var _=require(_0x390b('0x0'));var util=require(_0x390b('0x1'));var moment=require(_0x390b('0x2'));var BPromise=require(_0x390b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x390b('0x4'))['db'];var utils=require(_0x390b('0x5'));var logger=require(_0x390b('0x6'))(_0x390b('0x7'));var config=require(_0x390b('0x8'));var jayson=require(_0x390b('0x9'));var client=jayson[_0x390b('0xa')][_0x390b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc9c89,_0x4537b0,_0x350bca){return new BPromise(function(_0x342d1f,_0x8fa854){return client['request'](_0xc9c89,_0x350bca)['then'](function(_0x134805){logger['info'](_0x390b('0xc'),_0x4537b0,'request\x20sent');logger[_0x390b('0xd')](_0x390b('0xe'),_0x4537b0,_0x390b('0xf'),JSON[_0x390b('0x10')](_0x134805));if(_0x134805[_0x390b('0x11')]){if(_0x134805[_0x390b('0x11')]['code']===0x1f4){logger[_0x390b('0x11')](_0x390b('0xc'),_0x4537b0,_0x134805[_0x390b('0x11')][_0x390b('0x12')]);return _0x8fa854(_0x134805[_0x390b('0x11')][_0x390b('0x12')]);}logger[_0x390b('0x11')](_0x390b('0xc'),_0x4537b0,_0x134805[_0x390b('0x11')][_0x390b('0x12')]);return _0x342d1f(_0x134805['error'][_0x390b('0x12')]);}else{logger[_0x390b('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x4537b0,_0x390b('0xf'));_0x342d1f(_0x134805['result']['message']);}})[_0x390b('0x14')](function(_0x335ebc){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4537b0,_0x335ebc);_0x8fa854(_0x335ebc);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d9989cf..03dfca6 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(_0x315316,_0x362653){var _0x2abab1=function(_0x175b6e){while(--_0x175b6e){_0x315316['push'](_0x315316['shift']());}};_0x2abab1(++_0x362653);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x404a11,_0x5d5647){var _0x471865=function(_0x2e3bc8){while(--_0x2e3bc8){_0x404a11['push'](_0x404a11['shift']());}};_0x471865(++_0x5d5647);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 11c236f..0948d40 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 _0x20f7=['queue_interface','sequelize','exports','STRING','Required\x20by\x20Asterisk','INTEGER'];(function(_0x11ba93,_0x412b02){var _0x4a4602=function(_0x36d39d){while(--_0x36d39d){_0x11ba93['push'](_0x11ba93['shift']());}};_0x4a4602(++_0x412b02);}(_0x20f7,0x18d));var _0x720f=function(_0x8055de,_0x2831a8){_0x8055de=_0x8055de-0x0;var _0x14f99f=_0x20f7[_0x8055de];return _0x14f99f;};'use strict';var Sequelize=require(_0x720f('0x0'));module[_0x720f('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x720f('0x2')],'allowNull':![],'comment':_0x720f('0x3')},'UserId':{'type':Sequelize[_0x720f('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x720f('0x2')],'allowNull':![],'unique':_0x720f('0x5'),'comment':_0x720f('0x3')},'VoiceQueueId':{'type':Sequelize[_0x720f('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x720f('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x720f('0x3')},'penalty':{'type':Sequelize[_0x720f('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x720f('0x4')](0xb),'defaultValue':0x0,'comment':_0x720f('0x3')}}; \ No newline at end of file +var _0x25f3=['exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x48e7f9,_0x498542){var _0x10f99e=function(_0x4eb862){while(--_0x4eb862){_0x48e7f9['push'](_0x48e7f9['shift']());}};_0x10f99e(++_0x498542);}(_0x25f3,0xd8));var _0x325f=function(_0x5f2e4a,_0x2ff156){_0x5f2e4a=_0x5f2e4a-0x0;var _0x29dc43=_0x25f3[_0x5f2e4a];return _0x29dc43;};'use strict';var Sequelize=require('sequelize');module[_0x325f('0x0')]={'uniqueid':{'type':Sequelize[_0x325f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x325f('0x2')},'membername':{'type':Sequelize[_0x325f('0x3')],'allowNull':![],'comment':_0x325f('0x2')},'UserId':{'type':Sequelize[_0x325f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x325f('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x325f('0x2')},'VoiceQueueId':{'type':Sequelize[_0x325f('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x325f('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x325f('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x325f('0x2')},'paused':{'type':Sequelize[_0x325f('0x1')](0xb),'defaultValue':0x0,'comment':_0x325f('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d0265b2..2c2e21f 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 _0xd63a=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3cd877,_0x457353){var _0x2ee00e=function(_0xa6c9d){while(--_0xa6c9d){_0x3cd877['push'](_0x3cd877['shift']());}};_0x2ee00e(++_0x457353);}(_0xd63a,0x1d4));var _0xad63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd63a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xad63('0x0'));var UserVoiceQueueRt=require(_0xad63('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xad63('0x2')](0x0);var events={'afterCreate':_0xad63('0x3'),'afterUpdate':_0xad63('0x4'),'afterDestroy':_0xad63('0x5')};function emitEvent(_0x4f78f9){return function(_0x1fc34c,_0x226675,_0x39f70a){UserVoiceQueueRtEvents['emit'](_0x4f78f9+':'+_0x1fc34c['id'],_0x1fc34c);UserVoiceQueueRtEvents[_0xad63('0x6')](_0x4f78f9,_0x1fc34c);_0x39f70a(null);};}for(var e in events){if(events[_0xad63('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xad63('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9ac8=['emit','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xab4a7c,_0x28b640){var _0x4b0bd2=function(_0x254009){while(--_0x254009){_0xab4a7c['push'](_0xab4a7c['shift']());}};_0x4b0bd2(++_0x28b640);}(_0x9ac8,0xea));var _0x89ac=function(_0x3c6f85,_0x46c714){_0x3c6f85=_0x3c6f85-0x0;var _0x48ba4d=_0x9ac8[_0x3c6f85];return _0x48ba4d;};'use strict';var EventEmitter=require(_0x89ac('0x0'));var UserVoiceQueueRt=require(_0x89ac('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x89ac('0x2')](0x0);var events={'afterCreate':_0x89ac('0x3'),'afterUpdate':_0x89ac('0x4'),'afterDestroy':_0x89ac('0x5')};function emitEvent(_0x30f3c8){return function(_0xbeabd,_0x8bc464,_0x25ed22){UserVoiceQueueRtEvents[_0x89ac('0x6')](_0x30f3c8+':'+_0xbeabd['id'],_0xbeabd);UserVoiceQueueRtEvents['emit'](_0x30f3c8,_0xbeabd);_0x25ed22(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x89ac('0x7')](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 7a2bafd..6c10269 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 _0x102f=['define','user_has_voice_queues_rt','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x5ba74f,_0x200bf4){var _0x534d79=function(_0x50521a){while(--_0x50521a){_0x5ba74f['push'](_0x5ba74f['shift']());}};_0x534d79(++_0x200bf4);}(_0x102f,0x12b));var _0xf102=function(_0x2aba17,_0x128a30){_0x2aba17=_0x2aba17-0x0;var _0x5a9599=_0x102f[_0x2aba17];return _0x5a9599;};'use strict';var _=require(_0xf102('0x0'));var util=require(_0xf102('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf102('0x2'));var BPromise=require(_0xf102('0x3'));var rp=require(_0xf102('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf102('0x5'));var config=require(_0xf102('0x6'));var attributes=require(_0xf102('0x7'));module[_0xf102('0x8')]=function(_0x101b4f,_0x185b08){return _0x101b4f[_0xf102('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0xf102('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5940=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','util'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x5940,0x137));var _0x0594=function(_0x26b5fa,_0x1bea6f){_0x26b5fa=_0x26b5fa-0x0;var _0x4568c9=_0x5940[_0x26b5fa];return _0x4568c9;};'use strict';var _=require('lodash');var util=require(_0x0594('0x0'));var logger=require(_0x0594('0x1'))(_0x0594('0x2'));var moment=require('moment');var BPromise=require(_0x0594('0x3'));var rp=require(_0x0594('0x4'));var fs=require('fs');var path=require(_0x0594('0x5'));var rimraf=require(_0x0594('0x6'));var config=require(_0x0594('0x7'));var attributes=require(_0x0594('0x8'));module[_0x0594('0x9')]=function(_0x1662d7,_0x3bcf94){return _0x1662d7[_0x0594('0xa')](_0x0594('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','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 d358bd4..0922037 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 _0xd703=['http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','findAll','options','sequelize','literal','outboundQueuePauses','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x38a653,_0x1a5872){var _0x370492=function(_0x33a556){while(--_0x33a556){_0x38a653['push'](_0x38a653['shift']());}};_0x370492(++_0x1a5872);}(_0xd703,0x198));var _0x3d70=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xd703[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x3d70('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3d70('0x1'));var rs=require(_0x3d70('0x2'));var fs=require('fs');var Redis=require(_0x3d70('0x3'));var db=require(_0x3d70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d70('0x5'))('rpc');var config=require(_0x3d70('0x6'));var jayson=require(_0x3d70('0x7'));var client=jayson['client'][_0x3d70('0x8')]({'port':0x232a});config[_0x3d70('0x9')]=_[_0x3d70('0xa')](config[_0x3d70('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d70('0xb'))(new Redis(config[_0x3d70('0x9')]));require(_0x3d70('0xc'))['register'](socket);function respondWithRpcPromise(_0x5d7166,_0x245595,_0x1da1ae){return new BPromise(function(_0x1c07e5,_0x1eee67){return client[_0x3d70('0xd')](_0x5d7166,_0x1da1ae)[_0x3d70('0xe')](function(_0x6035de){logger[_0x3d70('0xf')](_0x3d70('0x10'),_0x245595,_0x3d70('0x11'));logger[_0x3d70('0x12')](_0x3d70('0x13'),_0x245595,_0x3d70('0x11'),JSON[_0x3d70('0x14')](_0x6035de));if(_0x6035de[_0x3d70('0x15')]){if(_0x6035de[_0x3d70('0x15')][_0x3d70('0x16')]===0x1f4){logger[_0x3d70('0x15')](_0x3d70('0x10'),_0x245595,_0x6035de['error'][_0x3d70('0x17')]);return _0x1eee67(_0x6035de[_0x3d70('0x15')]['message']);}logger['error'](_0x3d70('0x10'),_0x245595,_0x6035de['error'][_0x3d70('0x17')]);return _0x1c07e5(_0x6035de[_0x3d70('0x15')]['message']);}else{logger[_0x3d70('0xf')](_0x3d70('0x10'),_0x245595,_0x3d70('0x11'));_0x1c07e5(_0x6035de[_0x3d70('0x18')][_0x3d70('0x17')]);}})['catch'](function(_0x270a9d){logger['error'](_0x3d70('0x10'),_0x245595,_0x270a9d);_0x1eee67(_0x270a9d);});});}exports[_0x3d70('0x19')]=function(_0x6d706f){var _0xb87bb8=this;return new Promise(function(_0x526ebb,_0xe7ad86){return db['UserVoiceQueueRt'][_0x3d70('0x1a')]({'raw':_0x6d706f['options']?_0x6d706f[_0x3d70('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x6d706f[_0x3d70('0x1b')]?_0x6d706f['options']['where']||null:null,'attributes':[[db[_0x3d70('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3d70('0x1c')][_0x3d70('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0x3d70('0x1e')]]})['then'](function(_0x439bab){logger[_0x3d70('0xf')]('GetVoiceQueueRtPauses',_0x6d706f);logger[_0x3d70('0x12')](_0x3d70('0x19'),_0x6d706f,JSON[_0x3d70('0x14')](_0x439bab));_0x526ebb(_0x439bab);})[_0x3d70('0x1f')](function(_0x3343a8){logger['error'](_0x3d70('0x19'),_0x3343a8[_0x3d70('0x17')],_0x6d706f);_0xe7ad86(_0xb87bb8[_0x3d70('0x15')](0x1f4,_0x3343a8['message']));});});}; \ No newline at end of file +var _0x6c79=['util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0x2db458,_0x462095){var _0xa8724a=function(_0x46800a){while(--_0x46800a){_0x2db458['push'](_0x2db458['shift']());}};_0xa8724a(++_0x462095);}(_0x6c79,0xd9));var _0x96c7=function(_0x1fa022,_0x5a1b71){_0x1fa022=_0x1fa022-0x0;var _0x1098d7=_0x6c79[_0x1fa022];return _0x1098d7;};'use strict';var _=require('lodash');var util=require(_0x96c7('0x0'));var moment=require('moment');var BPromise=require(_0x96c7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96c7('0x2'));var db=require(_0x96c7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x96c7('0x4'))(_0x96c7('0x5'));var config=require(_0x96c7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x96c7('0x7')]({'port':0x232a});config[_0x96c7('0x8')]=_[_0x96c7('0x9')](config[_0x96c7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x96c7('0xa'))(new Redis(config['redis']));require(_0x96c7('0xb'))['register'](socket);function respondWithRpcPromise(_0x574653,_0x46894a,_0x518f92){return new BPromise(function(_0x32145f,_0x1ea355){return client[_0x96c7('0xc')](_0x574653,_0x518f92)[_0x96c7('0xd')](function(_0x265ad7){logger[_0x96c7('0xe')](_0x96c7('0xf'),_0x46894a,_0x96c7('0x10'));logger[_0x96c7('0x11')](_0x96c7('0x12'),_0x46894a,_0x96c7('0x10'),JSON[_0x96c7('0x13')](_0x265ad7));if(_0x265ad7[_0x96c7('0x14')]){if(_0x265ad7['error']['code']===0x1f4){logger['error'](_0x96c7('0xf'),_0x46894a,_0x265ad7['error'][_0x96c7('0x15')]);return _0x1ea355(_0x265ad7[_0x96c7('0x14')][_0x96c7('0x15')]);}logger[_0x96c7('0x14')](_0x96c7('0xf'),_0x46894a,_0x265ad7[_0x96c7('0x14')][_0x96c7('0x15')]);return _0x32145f(_0x265ad7[_0x96c7('0x14')][_0x96c7('0x15')]);}else{logger[_0x96c7('0xe')](_0x96c7('0xf'),_0x46894a,_0x96c7('0x10'));_0x32145f(_0x265ad7[_0x96c7('0x16')][_0x96c7('0x15')]);}})[_0x96c7('0x17')](function(_0x119335){logger[_0x96c7('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46894a,_0x119335);_0x1ea355(_0x119335);});});}exports[_0x96c7('0x18')]=function(_0x2beee7){var _0x2e6cc4=this;return new Promise(function(_0x58e2ad,_0x240dae){return db[_0x96c7('0x19')]['findAll']({'raw':_0x2beee7['options']?_0x2beee7[_0x96c7('0x1a')][_0x96c7('0x1b')]===undefined?!![]:![]:!![],'where':_0x2beee7[_0x96c7('0x1a')]?_0x2beee7['options']['where']||null:null,'attributes':[[db[_0x96c7('0x1c')]['fn']('COUNT',db[_0x96c7('0x1c')]['fn']('IF',db['sequelize'][_0x96c7('0x1d')](_0x96c7('0x1e')))),'outboundQueuePauses']]})['then'](function(_0x2e7a36){logger[_0x96c7('0xe')](_0x96c7('0x18'),_0x2beee7);logger[_0x96c7('0x11')]('GetVoiceQueueRtPauses',_0x2beee7,JSON[_0x96c7('0x13')](_0x2e7a36));_0x58e2ad(_0x2e7a36);})[_0x96c7('0x17')](function(_0x490923){logger[_0x96c7('0x14')](_0x96c7('0x18'),_0x490923[_0x96c7('0x15')],_0x2beee7);_0x240dae(_0x2e6cc4[_0x96c7('0x14')](0x1f4,_0x490923[_0x96c7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 35adf20..c234c9e 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 _0x287e=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x1195cd,_0x352748){var _0x38b714=function(_0x199b63){while(--_0x199b63){_0x1195cd['push'](_0x1195cd['shift']());}};_0x38b714(++_0x352748);}(_0x287e,0x1e3));var _0xe287=function(_0x104001,_0x400555){_0x104001=_0x104001-0x0;var _0x413bf6=_0x287e[_0x104001];return _0x413bf6;};'use strict';var UserVoiceQueueRtEvents=require(_0xe287('0x0'));var events=[_0xe287('0x1'),_0xe287('0x2'),_0xe287('0x3')];function createListener(_0x43ac68,_0xf00cd7){return function(_0x33e26a){_0xf00cd7[_0xe287('0x4')](_0x43ac68,_0x33e26a);};}function removeListener(_0x16d2d7,_0x5f34d6){return function(){UserVoiceQueueRtEvents[_0xe287('0x5')](_0x16d2d7,_0x5f34d6);};}exports[_0xe287('0x6')]=function(_0x5af7ce){for(var _0x4b3807=0x0,_0x38bd18=events['length'];_0x4b3807<_0x38bd18;_0x4b3807++){var _0x4f3cf1=events[_0x4b3807];var _0x4cd1f4=createListener(_0xe287('0x7')+_0x4f3cf1,_0x5af7ce);UserVoiceQueueRtEvents['on'](_0x4f3cf1,_0x4cd1f4);}}; \ No newline at end of file +var _0x8917=['emit','removeListener','length','./userVoiceQueueRt.events','remove','update'];(function(_0x1d80dc,_0xd2303e){var _0x243386=function(_0x588c2d){while(--_0x588c2d){_0x1d80dc['push'](_0x1d80dc['shift']());}};_0x243386(++_0xd2303e);}(_0x8917,0x1d7));var _0x7891=function(_0x6bd399,_0x570a95){_0x6bd399=_0x6bd399-0x0;var _0x3c32ec=_0x8917[_0x6bd399];return _0x3c32ec;};'use strict';var UserVoiceQueueRtEvents=require(_0x7891('0x0'));var events=['save',_0x7891('0x1'),_0x7891('0x2')];function createListener(_0xfc1628,_0x129608){return function(_0xdf5de1){_0x129608[_0x7891('0x3')](_0xfc1628,_0xdf5de1);};}function removeListener(_0x2b5570,_0x24234b){return function(){UserVoiceQueueRtEvents[_0x7891('0x4')](_0x2b5570,_0x24234b);};}exports['register']=function(_0x46b52a){for(var _0x43a48e=0x0,_0x442944=events[_0x7891('0x5')];_0x43a48e<_0x442944;_0x43a48e++){var _0x4722b7=events[_0x43a48e];var _0x452a6d=createListener('userVoiceQueueRt:'+_0x4722b7,_0x46b52a);UserVoiceQueueRtEvents['on'](_0x4722b7,_0x452a6d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 842eb2a..d6d106c 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2a4dda,_0x394a1b){var _0xe725e=function(_0x5c005c){while(--_0x5c005c){_0x2a4dda['push'](_0x2a4dda['shift']());}};_0xe725e(++_0x394a1b);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xcb34e2,_0x1640db){var _0x30caef=function(_0x19e447){while(--_0x19e447){_0xcb34e2['push'](_0xcb34e2['shift']());}};_0x30caef(++_0x1640db);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 186ebf3..bf921a5 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 _0x0e93=['exports'];(function(_0x307f15,_0x518c07){var _0x36e4d4=function(_0x133a8b){while(--_0x133a8b){_0x307f15['push'](_0x307f15['shift']());}};_0x36e4d4(++_0x518c07);}(_0x0e93,0x1b6));var _0x30e9=function(_0x27df12,_0x3d193a){_0x27df12=_0x27df12-0x0;var _0xf7f5d4=_0x0e93[_0x27df12];return _0xf7f5d4;};'use strict';var Sequelize=require('sequelize');module[_0x30e9('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9493=['exports','sequelize'];(function(_0x3f1a93,_0x27ee76){var _0x2ca793=function(_0x46234f){while(--_0x46234f){_0x3f1a93['push'](_0x3f1a93['shift']());}};_0x2ca793(++_0x27ee76);}(_0x9493,0x159));var _0x3949=function(_0x1b3894,_0xb39e82){_0x1b3894=_0x1b3894-0x0;var _0x5a5a52=_0x9493[_0x1b3894];return _0x5a5a52;};'use strict';var Sequelize=require(_0x3949('0x0'));module[_0x3949('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 4054db0..230945d 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 _0x42a9=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x47fea3,_0x7be439){var _0x327cc2=function(_0x584a34){while(--_0x584a34){_0x47fea3['push'](_0x47fea3['shift']());}};_0x327cc2(++_0x7be439);}(_0x42a9,0xf2));var _0x942a=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x42a9[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x942a('0x0'));var logger=require(_0x942a('0x1'))(_0x942a('0x2'));var moment=require(_0x942a('0x3'));var BPromise=require('bluebird');var rp=require(_0x942a('0x4'));var fs=require('fs');var path=require(_0x942a('0x5'));var rimraf=require(_0x942a('0x6'));var config=require(_0x942a('0x7'));var attributes=require(_0x942a('0x8'));module[_0x942a('0x9')]=function(_0x5ae0bb,_0x587d7c){return _0x5ae0bb['define'](_0x942a('0xa'),attributes,{'tableName':_0x942a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5786=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird'];(function(_0x5bc888,_0x3d6d3c){var _0x4a2471=function(_0x1e9cc5){while(--_0x1e9cc5){_0x5bc888['push'](_0x5bc888['shift']());}};_0x4a2471(++_0x3d6d3c);}(_0x5786,0x19f));var _0x6578=function(_0x510d72,_0x4cec2a){_0x510d72=_0x510d72-0x0;var _0xd2db38=_0x5786[_0x510d72];return _0xd2db38;};'use strict';var _=require(_0x6578('0x0'));var util=require(_0x6578('0x1'));var logger=require('../../config/logger')(_0x6578('0x2'));var moment=require(_0x6578('0x3'));var BPromise=require(_0x6578('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6578('0x5'));var rimraf=require(_0x6578('0x6'));var config=require(_0x6578('0x7'));var attributes=require(_0x6578('0x8'));module[_0x6578('0x9')]=function(_0x9529d4,_0xaf6539){return _0x9529d4['define'](_0x6578('0xa'),attributes,{'tableName':_0x6578('0xb'),'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 2e72088..f1cf522 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 _0x4d26=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x4d26,0x168));var _0x64d2=function(_0x231fd3,_0x48185b){_0x231fd3=_0x231fd3-0x0;var _0x3b31e5=_0x4d26[_0x231fd3];return _0x3b31e5;};'use strict';var _=require('lodash');var util=require(_0x64d2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x64d2('0x1'));var fs=require('fs');var Redis=require(_0x64d2('0x2'));var db=require(_0x64d2('0x3'))['db'];var utils=require(_0x64d2('0x4'));var logger=require(_0x64d2('0x5'))(_0x64d2('0x6'));var config=require(_0x64d2('0x7'));var jayson=require(_0x64d2('0x8'));var client=jayson['client'][_0x64d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8b433,_0x176843,_0x5a465c){return new BPromise(function(_0x391781,_0x14b023){return client[_0x64d2('0xa')](_0x8b433,_0x5a465c)[_0x64d2('0xb')](function(_0x1c9311){logger[_0x64d2('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x176843,'request\x20sent');logger[_0x64d2('0xd')](_0x64d2('0xe'),_0x176843,_0x64d2('0xf'),JSON[_0x64d2('0x10')](_0x1c9311));if(_0x1c9311[_0x64d2('0x11')]){if(_0x1c9311[_0x64d2('0x11')]['code']===0x1f4){logger[_0x64d2('0x11')](_0x64d2('0x12'),_0x176843,_0x1c9311['error'][_0x64d2('0x13')]);return _0x14b023(_0x1c9311[_0x64d2('0x11')][_0x64d2('0x13')]);}logger[_0x64d2('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x176843,_0x1c9311['error'][_0x64d2('0x13')]);return _0x391781(_0x1c9311[_0x64d2('0x11')][_0x64d2('0x13')]);}else{logger['info'](_0x64d2('0x12'),_0x176843,_0x64d2('0xf'));_0x391781(_0x1c9311[_0x64d2('0x14')][_0x64d2('0x13')]);}})[_0x64d2('0x15')](function(_0x614908){logger['error'](_0x64d2('0x12'),_0x176843,_0x614908);_0x14b023(_0x614908);});});} \ No newline at end of file +var _0x8965=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x62c539,_0x3eb0f0){var _0x89d7f1=function(_0x5f14cf){while(--_0x5f14cf){_0x62c539['push'](_0x62c539['shift']());}};_0x89d7f1(++_0x3eb0f0);}(_0x8965,0x91));var _0x5896=function(_0x9fcefa,_0x56704b){_0x9fcefa=_0x9fcefa-0x0;var _0x304f1a=_0x8965[_0x9fcefa];return _0x304f1a;};'use strict';var _=require(_0x5896('0x0'));var util=require(_0x5896('0x1'));var moment=require('moment');var BPromise=require(_0x5896('0x2'));var rs=require(_0x5896('0x3'));var fs=require('fs');var Redis=require(_0x5896('0x4'));var db=require(_0x5896('0x5'))['db'];var utils=require(_0x5896('0x6'));var logger=require(_0x5896('0x7'))(_0x5896('0x8'));var config=require(_0x5896('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5896('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x121e78,_0x309aff,_0x4c6dd0){return new BPromise(function(_0x3c4796,_0x9cbdf1){return client[_0x5896('0xb')](_0x121e78,_0x4c6dd0)[_0x5896('0xc')](function(_0x3d9463){logger['info'](_0x5896('0xd'),_0x309aff,_0x5896('0xe'));logger[_0x5896('0xf')](_0x5896('0x10'),_0x309aff,'request\x20sent',JSON[_0x5896('0x11')](_0x3d9463));if(_0x3d9463[_0x5896('0x12')]){if(_0x3d9463[_0x5896('0x12')][_0x5896('0x13')]===0x1f4){logger[_0x5896('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x309aff,_0x3d9463['error']['message']);return _0x9cbdf1(_0x3d9463[_0x5896('0x12')][_0x5896('0x14')]);}logger[_0x5896('0x12')](_0x5896('0xd'),_0x309aff,_0x3d9463[_0x5896('0x12')]['message']);return _0x3c4796(_0x3d9463[_0x5896('0x12')][_0x5896('0x14')]);}else{logger[_0x5896('0x15')]('UserWhatsappQueue,\x20%s,\x20%s',_0x309aff,_0x5896('0xe'));_0x3c4796(_0x3d9463[_0x5896('0x16')]['message']);}})[_0x5896('0x17')](function(_0x5d20e8){logger[_0x5896('0x12')](_0x5896('0xd'),_0x309aff,_0x5d20e8);_0x9cbdf1(_0x5d20e8);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 644dd12..c1fb9f7 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 _0x67a2=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','put','/:id','update'];(function(_0x5418e4,_0x3fd396){var _0x59e9f4=function(_0x49de89){while(--_0x49de89){_0x5418e4['push'](_0x5418e4['shift']());}};_0x59e9f4(++_0x3fd396);}(_0x67a2,0xd3));var _0x267a=function(_0x152bae,_0x50978f){_0x152bae=_0x152bae-0x0;var _0x39d773=_0x67a2[_0x152bae];return _0x39d773;};'use strict';var multer=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var path=require('path');var timeout=require(_0x267a('0x2'));var express=require(_0x267a('0x3'));var router=express[_0x267a('0x4')]();var fs_extra=require(_0x267a('0x5'));var auth=require(_0x267a('0x6'));var interaction=require(_0x267a('0x7'));var config=require(_0x267a('0x8'));var controller=require('./variable.controller');router['get']('/',auth[_0x267a('0x9')](),controller[_0x267a('0xa')]);router[_0x267a('0xb')]('/:id',auth[_0x267a('0x9')](),controller['show']);router[_0x267a('0xc')]('/',auth[_0x267a('0x9')](),controller[_0x267a('0xd')]);router[_0x267a('0xe')](_0x267a('0xf'),auth[_0x267a('0x9')](),controller[_0x267a('0x10')]);router['delete'](_0x267a('0xf'),auth[_0x267a('0x9')](),controller[_0x267a('0x11')]);module[_0x267a('0x12')]=router; \ No newline at end of file +var _0x4b1f=['/:id','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x21fd09,_0x4cc84c){var _0xcc02f5=function(_0x138056){while(--_0x138056){_0x21fd09['push'](_0x21fd09['shift']());}};_0xcc02f5(++_0x4cc84c);}(_0x4b1f,0x195));var _0xf4b1=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x4b1f[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var path=require('path');var timeout=require(_0xf4b1('0x2'));var express=require(_0xf4b1('0x3'));var router=express[_0xf4b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf4b1('0x5'));var interaction=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var controller=require('./variable.controller');router['get']('/',auth[_0xf4b1('0x8')](),controller[_0xf4b1('0x9')]);router[_0xf4b1('0xa')](_0xf4b1('0xb'),auth[_0xf4b1('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf4b1('0xc')]);router['put'](_0xf4b1('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf4b1('0xd')](_0xf4b1('0xb'),auth[_0xf4b1('0x8')](),controller[_0xf4b1('0xe')]);module[_0xf4b1('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 b0835b7..776a012 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 _0x8412=['exports','sequelize'];(function(_0x89fffe,_0x1ef3ba){var _0x4a9fad=function(_0x8690eb){while(--_0x8690eb){_0x89fffe['push'](_0x89fffe['shift']());}};_0x4a9fad(++_0x1ef3ba);}(_0x8412,0xdf));var _0x2841=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x8412[_0x1a0600];return _0x734670;};'use strict';var Sequelize=require(_0x2841('0x0'));module[_0x2841('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x45a7=['STRING','name','sequelize','exports'];(function(_0x32a109,_0x3bb88d){var _0x342b60=function(_0x3891d4){while(--_0x3891d4){_0x32a109['push'](_0x32a109['shift']());}};_0x342b60(++_0x3bb88d);}(_0x45a7,0x17e));var _0x745a=function(_0x1062e3,_0x49349e){_0x1062e3=_0x1062e3-0x0;var _0x92e616=_0x45a7[_0x1062e3];return _0x92e616;};'use strict';var Sequelize=require(_0x745a('0x0'));module[_0x745a('0x1')]={'name':{'type':Sequelize[_0x745a('0x2')],'unique':_0x745a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x745a('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3fef400..00831a7 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 _0x9875=['ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','apply','reject','save','update','destroy','then','get','Variables','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv'];(function(_0x34d11d,_0x38bf34){var _0x2da373=function(_0x14923a){while(--_0x14923a){_0x34d11d['push'](_0x34d11d['shift']());}};_0x2da373(++_0x38bf34);}(_0x9875,0x95));var _0x5987=function(_0x276f64,_0x3d446e){_0x276f64=_0x276f64-0x0;var _0x1bc320=_0x9875[_0x276f64];return _0x1bc320;};'use strict';var emlformat=require(_0x5987('0x0'));var rimraf=require(_0x5987('0x1'));var zipdir=require(_0x5987('0x2'));var jsonpatch=require(_0x5987('0x3'));var rp=require('request-promise');var moment=require(_0x5987('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5987('0x5'));var path=require(_0x5987('0x6'));var sox=require(_0x5987('0x7'));var csv=require(_0x5987('0x8'));var ejs=require(_0x5987('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5987('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5987('0xb'));var toCsv=require(_0x5987('0x8'));var querystring=require(_0x5987('0xc'));var Papa=require(_0x5987('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5987('0xe'));var as=require(_0x5987('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5987('0x10'));var utils=require(_0x5987('0x11'));var config=require(_0x5987('0x12'));var licenseUtil=require(_0x5987('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a8a1a,_0x3e7915){_0x3e7915=_0x3e7915||0xcc;return function(_0x3c24e7){if(_0x3c24e7){return _0x1a8a1a[_0x5987('0x14')](_0x3e7915);}return _0x1a8a1a['status'](_0x3e7915)[_0x5987('0x15')]();};}function respondWithResult(_0x2a4fab,_0x39b537){_0x39b537=_0x39b537||0xc8;return function(_0x35ec34){if(_0x35ec34){return _0x2a4fab[_0x5987('0x16')](_0x39b537)[_0x5987('0x17')](_0x35ec34);}};}function respondWithFilteredResult(_0x329ca8,_0x466e4b){return function(_0x231816){if(_0x231816){var _0x1acc76=typeof _0x466e4b['offset']==='undefined'&&typeof _0x466e4b[_0x5987('0x18')]===_0x5987('0x19');var _0x57c13c=_0x231816[_0x5987('0x1a')];var _0x341581=_0x1acc76?0x0:_0x466e4b['offset'];var _0x292477=_0x1acc76?_0x231816['count']:_0x466e4b[_0x5987('0x1b')]+_0x466e4b['limit'];var _0x2b4fb5;if(_0x292477>=_0x57c13c){_0x292477=_0x57c13c;_0x2b4fb5=0xc8;}else{_0x2b4fb5=0xce;}_0x329ca8[_0x5987('0x16')](_0x2b4fb5);return _0x329ca8['set']('Content-Range',_0x341581+'-'+_0x292477+'/'+_0x57c13c)[_0x5987('0x17')](_0x231816);}return null;};}function patchUpdates(_0x47c05d){return function(_0x232f29){try{jsonpatch[_0x5987('0x1c')](_0x232f29,_0x47c05d,!![]);}catch(_0x292da9){return BPromise[_0x5987('0x1d')](_0x292da9);}return _0x232f29[_0x5987('0x1e')]();};}function saveUpdates(_0x1f30e0,_0x3eef7b){return function(_0x22906a){if(_0x22906a){return _0x22906a[_0x5987('0x1f')](_0x1f30e0)['then'](function(_0x5b35da){return _0x5b35da;});}return null;};}function removeEntity(_0x566a95,_0x1f1ee4){return function(_0x219600){if(_0x219600){return _0x219600[_0x5987('0x20')]()[_0x5987('0x21')](function(){var _0x3adfb8=_0x219600[_0x5987('0x22')]({'plain':!![]});var _0x1728aa=_0x5987('0x23');return db['UserProfileResource'][_0x5987('0x20')]({'where':{'type':_0x1728aa,'resourceId':_0x3adfb8['id']}})[_0x5987('0x21')](function(){return _0x219600;});})[_0x5987('0x21')](function(){_0x566a95['status'](0xcc)[_0x5987('0x15')]();});}};}function handleEntityNotFound(_0x583d02,_0x3e16dc){return function(_0x22cb3b){if(!_0x22cb3b){_0x583d02[_0x5987('0x14')](0x194);}return _0x22cb3b;};}function handleError(_0xc7852,_0x3eb775){_0x3eb775=_0x3eb775||0x1f4;return function(_0x576c93){logger[_0x5987('0x24')](_0x576c93[_0x5987('0x25')]);if(_0x576c93[_0x5987('0x26')]){delete _0x576c93[_0x5987('0x26')];}_0xc7852[_0x5987('0x16')](_0x3eb775)[_0x5987('0x27')](_0x576c93);};}exports[_0x5987('0x28')]=function(_0xb627d8,_0x22047e){var _0x5ebcb3={},_0x4117a={},_0x26eef1={'count':0x0,'rows':[]};var _0x14ce15=_[_0x5987('0x29')](db[_0x5987('0x2a')][_0x5987('0x2b')],function(_0x328bcd){return{'name':_0x328bcd[_0x5987('0x2c')],'type':_0x328bcd[_0x5987('0x2d')]['key']};});_0x4117a[_0x5987('0x2e')]=_[_0x5987('0x29')](_0x14ce15,_0x5987('0x26'));_0x4117a[_0x5987('0x2f')]=_[_0x5987('0x30')](_0xb627d8[_0x5987('0x2f')]);_0x4117a[_0x5987('0x31')]=_['intersection'](_0x4117a[_0x5987('0x2e')],_0x4117a[_0x5987('0x2f')]);_0x5ebcb3[_0x5987('0x32')]=_[_0x5987('0x33')](_0x4117a['model'],qs['fields'](_0xb627d8[_0x5987('0x2f')][_0x5987('0x34')]));_0x5ebcb3[_0x5987('0x32')]=_0x5ebcb3['attributes'][_0x5987('0x35')]?_0x5ebcb3[_0x5987('0x32')]:_0x4117a[_0x5987('0x2e')];if(!_0xb627d8[_0x5987('0x2f')][_0x5987('0x36')](_0x5987('0x37'))){_0x5ebcb3['limit']=qs['limit'](_0xb627d8['query'][_0x5987('0x18')]);_0x5ebcb3[_0x5987('0x1b')]=qs[_0x5987('0x1b')](_0xb627d8[_0x5987('0x2f')][_0x5987('0x1b')]);}_0x5ebcb3[_0x5987('0x38')]=qs[_0x5987('0x39')](_0xb627d8['query'][_0x5987('0x39')]);_0x5ebcb3[_0x5987('0x3a')]=qs['filters'](_['pick'](_0xb627d8[_0x5987('0x2f')],_0x4117a['filters']),_0x14ce15);if(_0xb627d8['query'][_0x5987('0x3b')]){_0x5ebcb3['where']=_[_0x5987('0x3c')](_0x5ebcb3['where'],{'$or':_[_0x5987('0x29')](_0x14ce15,function(_0x166c11){if(_0x166c11[_0x5987('0x2d')]!==_0x5987('0x3d')){var _0x213188={};_0x213188[_0x166c11['name']]={'$like':'%'+_0xb627d8[_0x5987('0x2f')][_0x5987('0x3b')]+'%'};return _0x213188;}})});}_0x5ebcb3=_[_0x5987('0x3c')]({},_0x5ebcb3,_0xb627d8[_0x5987('0x3e')]);var _0x2c2133={'where':_0x5ebcb3[_0x5987('0x3a')]};return db[_0x5987('0x2a')]['count'](_0x2c2133)[_0x5987('0x21')](function(_0x8fe542){_0x26eef1['count']=_0x8fe542;if(_0xb627d8[_0x5987('0x2f')]['includeAll']){_0x5ebcb3[_0x5987('0x3f')]=[{'all':!![]}];}return db[_0x5987('0x2a')][_0x5987('0x40')](_0x5ebcb3);})[_0x5987('0x21')](function(_0xa6b867){_0x26eef1[_0x5987('0x41')]=_0xa6b867;return _0x26eef1;})[_0x5987('0x21')](respondWithFilteredResult(_0x22047e,_0x5ebcb3))['catch'](handleError(_0x22047e,null));};exports[_0x5987('0x42')]=function(_0x1fd086,_0x1eff20){var _0x5c4f36={'raw':!![],'where':{'id':_0x1fd086['params']['id']}},_0x53b3f1={};_0x53b3f1[_0x5987('0x2e')]=_[_0x5987('0x30')](db[_0x5987('0x2a')][_0x5987('0x2b')]);_0x53b3f1[_0x5987('0x2f')]=_[_0x5987('0x30')](_0x1fd086[_0x5987('0x2f')]);_0x53b3f1[_0x5987('0x31')]=_[_0x5987('0x33')](_0x53b3f1[_0x5987('0x2e')],_0x53b3f1['query']);_0x5c4f36[_0x5987('0x32')]=_[_0x5987('0x33')](_0x53b3f1['model'],qs[_0x5987('0x34')](_0x1fd086[_0x5987('0x2f')][_0x5987('0x34')]));_0x5c4f36['attributes']=_0x5c4f36[_0x5987('0x32')]['length']?_0x5c4f36[_0x5987('0x32')]:_0x53b3f1[_0x5987('0x2e')];if(_0x1fd086['query'][_0x5987('0x43')]){_0x5c4f36[_0x5987('0x3f')]=[{'all':!![]}];}_0x5c4f36=_['merge']({},_0x5c4f36,_0x1fd086['options']);return db['Variable'][_0x5987('0x44')](_0x5c4f36)['then'](handleEntityNotFound(_0x1eff20,null))['then'](respondWithResult(_0x1eff20,null))[_0x5987('0x45')](handleError(_0x1eff20,null));};exports[_0x5987('0x46')]=function(_0x362f2e,_0x354b06){return db[_0x5987('0x2a')]['create'](_0x362f2e[_0x5987('0x47')],{})[_0x5987('0x21')](function(_0x124382){var _0xc4defe=_0x362f2e[_0x5987('0x48')][_0x5987('0x22')]({'plain':!![]});if(!_0xc4defe)throw new Error(_0x5987('0x49'));if(_0xc4defe['role']==='user'){var _0x7c190c=_0x124382['get']({'plain':!![]});var _0x5975ed=_0x5987('0x23');return db['UserProfileSection'][_0x5987('0x44')]({'where':{'name':_0x5975ed,'userProfileId':_0xc4defe[_0x5987('0x4a')]},'raw':!![]})[_0x5987('0x21')](function(_0x5827c2){if(_0x5827c2&&_0x5827c2[_0x5987('0x4b')]===0x0){return db[_0x5987('0x4c')][_0x5987('0x46')]({'name':_0x7c190c[_0x5987('0x26')],'resourceId':_0x7c190c['id'],'type':_0x5827c2['name'],'sectionId':_0x5827c2['id']},{})[_0x5987('0x21')](function(){return _0x124382;});}else{return _0x124382;}})[_0x5987('0x45')](function(_0x18c936){logger[_0x5987('0x24')](_0x5987('0x4d'),_0x18c936);throw _0x18c936;});}return _0x124382;})[_0x5987('0x21')](respondWithResult(_0x354b06,0xc9))[_0x5987('0x45')](handleError(_0x354b06,null));};exports[_0x5987('0x1f')]=function(_0x5644b0,_0x57801b){if(_0x5644b0['body']['id']){delete _0x5644b0[_0x5987('0x47')]['id'];}return db[_0x5987('0x2a')][_0x5987('0x44')]({'where':{'id':_0x5644b0[_0x5987('0x4e')]['id']}})[_0x5987('0x21')](handleEntityNotFound(_0x57801b,null))[_0x5987('0x21')](saveUpdates(_0x5644b0[_0x5987('0x47')],null))[_0x5987('0x21')](respondWithResult(_0x57801b,null))[_0x5987('0x45')](handleError(_0x57801b,null));};exports[_0x5987('0x20')]=function(_0x321d7c,_0xda7289){return db[_0x5987('0x2a')][_0x5987('0x44')]({'where':{'id':_0x321d7c[_0x5987('0x4e')]['id']}})[_0x5987('0x21')](handleEntityNotFound(_0xda7289,null))[_0x5987('0x21')](removeEntity(_0xda7289,null))[_0x5987('0x45')](handleError(_0xda7289,null));}; \ No newline at end of file +var _0xec5b=['stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','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','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','destroy','get','Variables','UserProfileResource','then','error'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xec5b,0x17b));var _0xbec5=function(_0x28aa9b,_0x45bc9a){_0x28aa9b=_0x28aa9b-0x0;var _0x4f4a0e=_0xec5b[_0x28aa9b];return _0x4f4a0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbec5('0x0'));var zipdir=require(_0xbec5('0x1'));var jsonpatch=require(_0xbec5('0x2'));var rp=require(_0xbec5('0x3'));var moment=require(_0xbec5('0x4'));var BPromise=require(_0xbec5('0x5'));var Mustache=require(_0xbec5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbec5('0x7'));var fs=require('fs');var fs_extra=require(_0xbec5('0x8'));var _=require(_0xbec5('0x9'));var squel=require(_0xbec5('0xa'));var crypto=require(_0xbec5('0xb'));var jsforce=require(_0xbec5('0xc'));var deskjs=require(_0xbec5('0xd'));var toCsv=require(_0xbec5('0xe'));var querystring=require(_0xbec5('0xf'));var Papa=require(_0xbec5('0x10'));var Redis=require(_0xbec5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbec5('0x12'));var as=require(_0xbec5('0x13'));var hardwareService=require(_0xbec5('0x14'));var logger=require(_0xbec5('0x15'))(_0xbec5('0x16'));var utils=require(_0xbec5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x507e31,_0x42a842){_0x42a842=_0x42a842||0xcc;return function(_0x3a857d){if(_0x3a857d){return _0x507e31[_0xbec5('0x18')](_0x42a842);}return _0x507e31[_0xbec5('0x19')](_0x42a842)[_0xbec5('0x1a')]();};}function respondWithResult(_0x13c5a5,_0x25408c){_0x25408c=_0x25408c||0xc8;return function(_0x27091c){if(_0x27091c){return _0x13c5a5[_0xbec5('0x19')](_0x25408c)[_0xbec5('0x1b')](_0x27091c);}};}function respondWithFilteredResult(_0x2099bb,_0x3aab4a){return function(_0x1a88a5){if(_0x1a88a5){var _0x219559=typeof _0x3aab4a[_0xbec5('0x1c')]===_0xbec5('0x1d')&&typeof _0x3aab4a['limit']===_0xbec5('0x1d');var _0x2fda61=_0x1a88a5[_0xbec5('0x1e')];var _0x36ef2b=_0x219559?0x0:_0x3aab4a[_0xbec5('0x1c')];var _0x59c810=_0x219559?_0x1a88a5['count']:_0x3aab4a['offset']+_0x3aab4a['limit'];var _0x3cdd2b;if(_0x59c810>=_0x2fda61){_0x59c810=_0x2fda61;_0x3cdd2b=0xc8;}else{_0x3cdd2b=0xce;}_0x2099bb['status'](_0x3cdd2b);return _0x2099bb[_0xbec5('0x1f')](_0xbec5('0x20'),_0x36ef2b+'-'+_0x59c810+'/'+_0x2fda61)[_0xbec5('0x1b')](_0x1a88a5);}return null;};}function patchUpdates(_0x611d8f){return function(_0x57166b){try{jsonpatch[_0xbec5('0x21')](_0x57166b,_0x611d8f,!![]);}catch(_0x23f425){return BPromise['reject'](_0x23f425);}return _0x57166b[_0xbec5('0x22')]();};}function saveUpdates(_0x3a797c,_0x3b62b0){return function(_0x36faee){if(_0x36faee){return _0x36faee['update'](_0x3a797c)['then'](function(_0x410fd0){return _0x410fd0;});}return null;};}function removeEntity(_0x1a3af2,_0x574164){return function(_0x2a4b82){if(_0x2a4b82){return _0x2a4b82[_0xbec5('0x23')]()['then'](function(){var _0x5f2152=_0x2a4b82[_0xbec5('0x24')]({'plain':!![]});var _0x53ce72=_0xbec5('0x25');return db[_0xbec5('0x26')][_0xbec5('0x23')]({'where':{'type':_0x53ce72,'resourceId':_0x5f2152['id']}})[_0xbec5('0x27')](function(){return _0x2a4b82;});})[_0xbec5('0x27')](function(){_0x1a3af2[_0xbec5('0x19')](0xcc)[_0xbec5('0x1a')]();});}};}function handleEntityNotFound(_0x200a19,_0x578e03){return function(_0x539e97){if(!_0x539e97){_0x200a19[_0xbec5('0x18')](0x194);}return _0x539e97;};}function handleError(_0x4ad11a,_0xa23c9){_0xa23c9=_0xa23c9||0x1f4;return function(_0x12f94f){logger[_0xbec5('0x28')](_0x12f94f[_0xbec5('0x29')]);if(_0x12f94f['name']){delete _0x12f94f[_0xbec5('0x2a')];}_0x4ad11a[_0xbec5('0x19')](_0xa23c9)[_0xbec5('0x2b')](_0x12f94f);};}exports[_0xbec5('0x2c')]=function(_0x27ec0f,_0x24f2f9){var _0x586d47={},_0x32a264={},_0x45957e={'count':0x0,'rows':[]};var _0x570b34=_[_0xbec5('0x2d')](db[_0xbec5('0x2e')][_0xbec5('0x2f')],function(_0x4f1ba7){return{'name':_0x4f1ba7['fieldName'],'type':_0x4f1ba7[_0xbec5('0x30')][_0xbec5('0x31')]};});_0x32a264[_0xbec5('0x32')]=_['map'](_0x570b34,_0xbec5('0x2a'));_0x32a264[_0xbec5('0x33')]=_[_0xbec5('0x34')](_0x27ec0f[_0xbec5('0x33')]);_0x32a264[_0xbec5('0x35')]=_[_0xbec5('0x36')](_0x32a264[_0xbec5('0x32')],_0x32a264['query']);_0x586d47[_0xbec5('0x37')]=_[_0xbec5('0x36')](_0x32a264['model'],qs[_0xbec5('0x38')](_0x27ec0f[_0xbec5('0x33')]['fields']));_0x586d47[_0xbec5('0x37')]=_0x586d47['attributes'][_0xbec5('0x39')]?_0x586d47[_0xbec5('0x37')]:_0x32a264[_0xbec5('0x32')];if(!_0x27ec0f[_0xbec5('0x33')][_0xbec5('0x3a')](_0xbec5('0x3b'))){_0x586d47[_0xbec5('0x3c')]=qs[_0xbec5('0x3c')](_0x27ec0f[_0xbec5('0x33')]['limit']);_0x586d47[_0xbec5('0x1c')]=qs[_0xbec5('0x1c')](_0x27ec0f[_0xbec5('0x33')][_0xbec5('0x1c')]);}_0x586d47[_0xbec5('0x3d')]=qs[_0xbec5('0x3e')](_0x27ec0f[_0xbec5('0x33')][_0xbec5('0x3e')]);_0x586d47[_0xbec5('0x3f')]=qs[_0xbec5('0x35')](_[_0xbec5('0x40')](_0x27ec0f[_0xbec5('0x33')],_0x32a264[_0xbec5('0x35')]),_0x570b34);if(_0x27ec0f[_0xbec5('0x33')][_0xbec5('0x41')]){_0x586d47[_0xbec5('0x3f')]=_[_0xbec5('0x42')](_0x586d47[_0xbec5('0x3f')],{'$or':_[_0xbec5('0x2d')](_0x570b34,function(_0x53b65f){if(_0x53b65f[_0xbec5('0x30')]!=='VIRTUAL'){var _0x211877={};_0x211877[_0x53b65f['name']]={'$like':'%'+_0x27ec0f[_0xbec5('0x33')][_0xbec5('0x41')]+'%'};return _0x211877;}})});}_0x586d47=_[_0xbec5('0x42')]({},_0x586d47,_0x27ec0f['options']);var _0x101136={'where':_0x586d47[_0xbec5('0x3f')]};return db[_0xbec5('0x2e')][_0xbec5('0x1e')](_0x101136)[_0xbec5('0x27')](function(_0x287bd1){_0x45957e[_0xbec5('0x1e')]=_0x287bd1;if(_0x27ec0f[_0xbec5('0x33')][_0xbec5('0x43')]){_0x586d47['include']=[{'all':!![]}];}return db['Variable'][_0xbec5('0x44')](_0x586d47);})['then'](function(_0x46bf56){_0x45957e[_0xbec5('0x45')]=_0x46bf56;return _0x45957e;})[_0xbec5('0x27')](respondWithFilteredResult(_0x24f2f9,_0x586d47))[_0xbec5('0x46')](handleError(_0x24f2f9,null));};exports[_0xbec5('0x47')]=function(_0x2a7b94,_0x1022ad){var _0x5c73c={'raw':!![],'where':{'id':_0x2a7b94[_0xbec5('0x48')]['id']}},_0x28638a={};_0x28638a[_0xbec5('0x32')]=_[_0xbec5('0x34')](db[_0xbec5('0x2e')]['rawAttributes']);_0x28638a[_0xbec5('0x33')]=_[_0xbec5('0x34')](_0x2a7b94[_0xbec5('0x33')]);_0x28638a[_0xbec5('0x35')]=_['intersection'](_0x28638a[_0xbec5('0x32')],_0x28638a[_0xbec5('0x33')]);_0x5c73c[_0xbec5('0x37')]=_[_0xbec5('0x36')](_0x28638a[_0xbec5('0x32')],qs[_0xbec5('0x38')](_0x2a7b94[_0xbec5('0x33')][_0xbec5('0x38')]));_0x5c73c[_0xbec5('0x37')]=_0x5c73c['attributes'][_0xbec5('0x39')]?_0x5c73c['attributes']:_0x28638a[_0xbec5('0x32')];if(_0x2a7b94[_0xbec5('0x33')]['includeAll']){_0x5c73c[_0xbec5('0x49')]=[{'all':!![]}];}_0x5c73c=_['merge']({},_0x5c73c,_0x2a7b94[_0xbec5('0x4a')]);return db[_0xbec5('0x2e')][_0xbec5('0x4b')](_0x5c73c)[_0xbec5('0x27')](handleEntityNotFound(_0x1022ad,null))[_0xbec5('0x27')](respondWithResult(_0x1022ad,null))[_0xbec5('0x46')](handleError(_0x1022ad,null));};exports[_0xbec5('0x4c')]=function(_0x1f96ed,_0x3d6429){return db['Variable'][_0xbec5('0x4c')](_0x1f96ed[_0xbec5('0x4d')],{})[_0xbec5('0x27')](function(_0x246c3b){var _0x254199=_0x1f96ed[_0xbec5('0x4e')][_0xbec5('0x24')]({'plain':!![]});if(!_0x254199)throw new Error(_0xbec5('0x4f'));if(_0x254199[_0xbec5('0x50')]==='user'){var _0x3e6932=_0x246c3b['get']({'plain':!![]});var _0x2b4da7='Variables';return db['UserProfileSection'][_0xbec5('0x4b')]({'where':{'name':_0x2b4da7,'userProfileId':_0x254199[_0xbec5('0x51')]},'raw':!![]})[_0xbec5('0x27')](function(_0x35b878){if(_0x35b878&&_0x35b878['autoAssociation']===0x0){return db[_0xbec5('0x26')][_0xbec5('0x4c')]({'name':_0x3e6932[_0xbec5('0x2a')],'resourceId':_0x3e6932['id'],'type':_0x35b878[_0xbec5('0x2a')],'sectionId':_0x35b878['id']},{})[_0xbec5('0x27')](function(){return _0x246c3b;});}else{return _0x246c3b;}})[_0xbec5('0x46')](function(_0x2d758d){logger[_0xbec5('0x28')](_0xbec5('0x52'),_0x2d758d);throw _0x2d758d;});}return _0x246c3b;})[_0xbec5('0x27')](respondWithResult(_0x3d6429,0xc9))[_0xbec5('0x46')](handleError(_0x3d6429,null));};exports[_0xbec5('0x53')]=function(_0x308ebf,_0x549c8c){if(_0x308ebf[_0xbec5('0x4d')]['id']){delete _0x308ebf[_0xbec5('0x4d')]['id'];}return db[_0xbec5('0x2e')]['find']({'where':{'id':_0x308ebf[_0xbec5('0x48')]['id']}})[_0xbec5('0x27')](handleEntityNotFound(_0x549c8c,null))[_0xbec5('0x27')](saveUpdates(_0x308ebf[_0xbec5('0x4d')],null))[_0xbec5('0x27')](respondWithResult(_0x549c8c,null))[_0xbec5('0x46')](handleError(_0x549c8c,null));};exports[_0xbec5('0x23')]=function(_0x7d1eb9,_0x28c81d){return db[_0xbec5('0x2e')][_0xbec5('0x4b')]({'where':{'id':_0x7d1eb9[_0xbec5('0x48')]['id']}})[_0xbec5('0x27')](handleEntityNotFound(_0x28c81d,null))[_0xbec5('0x27')](removeEntity(_0x28c81d,null))['catch'](handleError(_0x28c81d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 97af579..8f3344e 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 _0x4e29=['api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','define','Variable','lodash','util','../../config/logger'];(function(_0x4ef2ad,_0x248e94){var _0x1a6ea1=function(_0x1ddf94){while(--_0x1ddf94){_0x4ef2ad['push'](_0x4ef2ad['shift']());}};_0x1a6ea1(++_0x248e94);}(_0x4e29,0x189));var _0x94e2=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x4e29[_0x488ca1];return _0x4dd0a4;};'use strict';var _=require(_0x94e2('0x0'));var util=require(_0x94e2('0x1'));var logger=require(_0x94e2('0x2'))(_0x94e2('0x3'));var moment=require(_0x94e2('0x4'));var BPromise=require(_0x94e2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94e2('0x6'));var rimraf=require(_0x94e2('0x7'));var config=require(_0x94e2('0x8'));var attributes=require(_0x94e2('0x9'));module['exports']=function(_0x1eb204,_0xc0472e){return _0x1eb204[_0x94e2('0xa')](_0x94e2('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x184b=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0x184b,0x1b8));var _0xb184=function(_0x2a65f3,_0x2ab326){_0x2a65f3=_0x2a65f3-0x0;var _0x16e328=_0x184b[_0x2a65f3];return _0x16e328;};'use strict';var _=require(_0xb184('0x0'));var util=require(_0xb184('0x1'));var logger=require(_0xb184('0x2'))(_0xb184('0x3'));var moment=require(_0xb184('0x4'));var BPromise=require(_0xb184('0x5'));var rp=require(_0xb184('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb184('0x7'));var config=require(_0xb184('0x8'));var attributes=require(_0xb184('0x9'));module['exports']=function(_0x2b9873,_0x3dec9b){return _0x2b9873[_0xb184('0xa')](_0xb184('0xb'),attributes,{'tableName':_0xb184('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index b69f433..0e74d9b 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0xd4470d,_0x47318d){var _0x5544c5=function(_0x3486cb){while(--_0x3486cb){_0xd4470d['push'](_0xd4470d['shift']());}};_0x5544c5(++_0x47318d);}(_0x3e74,0x175));var _0x43e7=function(_0x431f6e,_0x17d13f){_0x431f6e=_0x431f6e-0x0;var _0x500835=_0x3e74[_0x431f6e];return _0x500835;};'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']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\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')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x1fa7c6,_0x39b651){var _0xd37a61=function(_0x3582ed){while(--_0x3582ed){_0x1fa7c6['push'](_0x1fa7c6['shift']());}};_0xd37a61(++_0x39b651);}(_0x6aa7,0x178));var _0x76aa=function(_0x102bb2,_0x20156e){_0x102bb2=_0x102bb2-0x0;var _0x30c5d8=_0x6aa7[_0x102bb2];return _0x30c5d8;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index dc82278..d16f095 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 _0xff62=['/reset','reset','pull','/restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x415ccd,_0x50e30f){var _0x446fe2=function(_0x351794){while(--_0x351794){_0x415ccd['push'](_0x415ccd['shift']());}};_0x446fe2(++_0x50e30f);}(_0xff62,0x196));var _0x2ff6=function(_0x174586,_0x570c8e){_0x174586=_0x174586-0x0;var _0x2089d1=_0xff62[_0x174586];return _0x2089d1;};'use strict';var express=require(_0x2ff6('0x0'));var router=express[_0x2ff6('0x1')]();var auth=require(_0x2ff6('0x2'));var controller=require(_0x2ff6('0x3'));router[_0x2ff6('0x4')]('/',controller[_0x2ff6('0x5')]);router[_0x2ff6('0x4')](_0x2ff6('0x6'),auth[_0x2ff6('0x7')](),auth[_0x2ff6('0x8')](),controller[_0x2ff6('0x9')]);router[_0x2ff6('0x4')](_0x2ff6('0xa'),auth[_0x2ff6('0x7')](),auth[_0x2ff6('0x8')](),controller[_0x2ff6('0xb')]);router[_0x2ff6('0x4')]('/pull',auth['isAuthenticated'](),auth[_0x2ff6('0x8')](),controller[_0x2ff6('0xc')]);router[_0x2ff6('0x4')](_0x2ff6('0xd'),auth['isAuthenticated'](),controller['restart']);router[_0x2ff6('0x4')]('/migrations',controller[_0x2ff6('0xe')]);module[_0x2ff6('0xf')]=router; \ No newline at end of file +var _0x056e=['/migrations','migrations','express','Router','../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','reset','/restart','restart'];(function(_0x4d18b6,_0x14c208){var _0x191282=function(_0x47af04){while(--_0x47af04){_0x4d18b6['push'](_0x4d18b6['shift']());}};_0x191282(++_0x14c208);}(_0x056e,0x195));var _0xe056=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x056e[_0x531d15];return _0x271a18;};'use strict';var express=require(_0xe056('0x0'));var router=express[_0xe056('0x1')]();var auth=require(_0xe056('0x2'));var controller=require(_0xe056('0x3'));router['get']('/',controller[_0xe056('0x4')]);router[_0xe056('0x5')]('/fetch',auth[_0xe056('0x6')](),auth[_0xe056('0x7')](),controller['fetch']);router[_0xe056('0x5')]('/reset',auth[_0xe056('0x6')](),auth[_0xe056('0x7')](),controller[_0xe056('0x8')]);router[_0xe056('0x5')]('/pull',auth[_0xe056('0x6')](),auth[_0xe056('0x7')](),controller['pull']);router[_0xe056('0x5')](_0xe056('0x9'),auth[_0xe056('0x6')](),controller[_0xe056('0xa')]);router[_0xe056('0x5')](_0xe056('0xb'),controller[_0xe056('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 772af83..f6f7881 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 _0x358a=['origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','.js','push','sort','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','index','exports','query','latest','fetch','tags','status','json'];(function(_0x50132a,_0x449599){var _0x4aa5c7=function(_0x364344){while(--_0x364344){_0x50132a['push'](_0x50132a['shift']());}};_0x4aa5c7(++_0x449599);}(_0x358a,0x1c9));var _0xa358=function(_0x2eb6b5,_0x5a1fc8){_0x2eb6b5=_0x2eb6b5-0x0;var _0x1ab4e3=_0x358a[_0x2eb6b5];return _0x1ab4e3;};'use strict';var Umzug=require(_0xa358('0x0'));var path=require(_0xa358('0x1'));var fs=require('fs');var _=require(_0xa358('0x2'));var pkginfo=require(_0xa358('0x3'))(module,_0xa358('0x4'));var compareVersions=require(_0xa358('0x5'));var exec=require(_0xa358('0x6'))[_0xa358('0x7')];var db=require(_0xa358('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0xa358('0x9'));var logger=require('../../config/logger')(_0xa358('0xa'));var git=require(_0xa358('0xb'))(config['root']);exports[_0xa358('0xc')]=function(_0x263e7c,_0x2a521a){var _0x2a4826={'current':module[_0xa358('0xd')][_0xa358('0x4')],'phonebar':0x2};if(_0x263e7c[_0xa358('0xe')]&&_0x263e7c['query'][_0xa358('0xf')]){return git[_0xa358('0x10')]()[_0xa358('0x11')](function(_0x401b04,_0x146061){_0x2a4826[_0xa358('0xf')]=(_0x401b04?module[_0xa358('0xd')][_0xa358('0x4')]:_0x146061[_0xa358('0xf')])||'2.0.0';return _0x2a521a['status'](0xc8)['json'](_0x2a4826);});}else{return _0x2a521a[_0xa358('0x12')](0xc8)[_0xa358('0x13')](_0x2a4826);}};exports[_0xa358('0x10')]=function(_0x3fcbb2,_0x322466){return git[_0xa358('0x10')]([_0xa358('0x14'),_0xa358('0x15')],function(_0x40c9dc){if(_0x40c9dc){logger[_0xa358('0x16')](_0x40c9dc);return _0x322466[_0xa358('0x12')](0x1f4)[_0xa358('0x13')](_0x40c9dc);}logger[_0xa358('0x17')](_0xa358('0x18'));return _0x322466[_0xa358('0x12')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xa358('0x19')]=function(_0x10fc1b,_0x586a7f){return git[_0xa358('0x19')]([_0xa358('0x1a'),_0xa358('0x1b')],function(_0x411625){if(_0x411625){logger[_0xa358('0x16')](_0x411625);return _0x586a7f['status'](0x1f4)[_0xa358('0x13')](_0x411625);}logger[_0xa358('0x17')](_0xa358('0x1c'));return _0x586a7f[_0xa358('0x12')](0xc8)[_0xa358('0x13')]({'output':_0xa358('0x1d')});});};exports[_0xa358('0x1e')]=function(_0x38b397,_0x5a7834){exec('npm\x20install\x20--production',function(_0x1180c5,_0x4944ba,_0x17b0a6){logger['info'](_0x4944ba);logger[_0xa358('0x17')](_0x17b0a6);if(_0x1180c5){logger['error'](_0x1180c5);return _0x5a7834[_0xa358('0x12')](0x1f4)[_0xa358('0x13')](_0x1180c5);}return _0x5a7834[_0xa358('0x12')](0xc8)[_0xa358('0x13')]({'output':_0x4944ba});});};exports[_0xa358('0x1f')]=function(_0x45d2b0,_0x2c2ca4){return pm2[_0xa358('0x1f')](_0xa358('0x20'))[_0xa358('0x21')](function(_0x2e53c2){logger[_0xa358('0x17')]('pm2\x20restart\x20motion\x20%s',_0x2e53c2);return _0x2c2ca4[_0xa358('0x12')](0xc8)['json']({'output':_0xa358('0x22')});})[_0xa358('0x23')](function(_0x1f8e6b){logger['error'](_0x1f8e6b);return _0x2c2ca4[_0xa358('0x12')](0x1f4)[_0xa358('0x13')](_0x1f8e6b);});};exports[_0xa358('0x24')]=function(_0x1cf50a,_0xe67217){var _0xaafd23=fs[_0xa358('0x25')](path[_0xa358('0x26')](config[_0xa358('0x27')],_0xa358('0x28'),_0xa358('0x24')));var _0x239f4a=[];for(var _0x1eb622=0x0;_0x1eb622<_0xaafd23[_0xa358('0x29')];_0x1eb622++){var _0x3ba215=_0xaafd23[_0x1eb622]['replace'](_0xa358('0x2a'),'');if(compareVersions(module[_0xa358('0xd')]['version'],_0x3ba215)===-0x1){_0x239f4a[_0xa358('0x2b')](_0x3ba215);}}if(_0x239f4a[_0xa358('0x29')]){var _0x52aa9d=_0x239f4a[_0xa358('0x2c')](compareVersions);var _0x4e383b=new Umzug({'storage':_0xa358('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xa358('0x4')},'migrations':{'params':[db['sequelize'][_0xa358('0x2e')](),db[_0xa358('0x2d')][_0xa358('0x2f')],function(){throw new Error(_0xa358('0x30'));}],'path':path[_0xa358('0x26')](config['root'],'server',_0xa358('0x24')),'pattern':/\.js$/}});_0x4e383b['up']({'migrations':_[_0xa358('0x31')](_0x52aa9d,function(_0x19ad68){return _0x19ad68+_0xa358('0x2a');})})[_0xa358('0x21')](function(){return _0xe67217[_0xa358('0x12')](0xc8)['json']({'output':_0xa358('0x32')+module[_0xa358('0xd')][_0xa358('0x4')]+_0xa358('0x33')+_['last'](_0x52aa9d),'migrations':_['join'](_0x52aa9d)});})['catch'](function(_0x565461){if(_0x565461 instanceof db[_0xa358('0x2d')]['UniqueConstraintError']){return _0xe67217[_0xa358('0x12')](0xc8)[_0xa358('0x13')]({'output':_0xa358('0x34')});}else{return _0xe67217[_0xa358('0x12')](0x1f4)[_0xa358('0x13')](_0x565461);}});}else{return _0xe67217[_0xa358('0x12')](0xc8)[_0xa358('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xd7a9=['Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.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.','server','map','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','query','latest','fetch','exports','2.0.0','json','status','origin','master','error','git\x20fetch\x20origin\x20master','reset','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0xd7a9,0x7e));var _0x9d7a=function(_0x4e4d44,_0x3836ed){_0x4e4d44=_0x4e4d44-0x0;var _0x429cf0=_0xd7a9[_0x4e4d44];return _0x429cf0;};'use strict';var Umzug=require(_0x9d7a('0x0'));var path=require(_0x9d7a('0x1'));var fs=require('fs');var _=require(_0x9d7a('0x2'));var pkginfo=require('pkginfo')(module,_0x9d7a('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x9d7a('0x4'))[_0x9d7a('0x5')];var db=require(_0x9d7a('0x6'))['db'];var config=require(_0x9d7a('0x7'));var pm2=require(_0x9d7a('0x8'));var logger=require(_0x9d7a('0x9'))(_0x9d7a('0xa'));var git=require('simple-git')(config[_0x9d7a('0xb')]);exports[_0x9d7a('0xc')]=function(_0x6bc45d,_0x23fe0f){var _0x3fafe5={'current':module['exports'][_0x9d7a('0x3')],'phonebar':0x2};if(_0x6bc45d['query']&&_0x6bc45d[_0x9d7a('0xd')][_0x9d7a('0xe')]){return git[_0x9d7a('0xf')]()['tags'](function(_0x36ed9a,_0x126a7b){_0x3fafe5[_0x9d7a('0xe')]=(_0x36ed9a?module[_0x9d7a('0x10')][_0x9d7a('0x3')]:_0x126a7b[_0x9d7a('0xe')])||_0x9d7a('0x11');return _0x23fe0f['status'](0xc8)[_0x9d7a('0x12')](_0x3fafe5);});}else{return _0x23fe0f[_0x9d7a('0x13')](0xc8)[_0x9d7a('0x12')](_0x3fafe5);}};exports[_0x9d7a('0xf')]=function(_0x4e567f,_0x38a46c){return git[_0x9d7a('0xf')]([_0x9d7a('0x14'),_0x9d7a('0x15')],function(_0x51c21e){if(_0x51c21e){logger[_0x9d7a('0x16')](_0x51c21e);return _0x38a46c[_0x9d7a('0x13')](0x1f4)[_0x9d7a('0x12')](_0x51c21e);}logger['info']('git\x20fetch');return _0x38a46c[_0x9d7a('0x13')](0xc8)[_0x9d7a('0x12')]({'output':_0x9d7a('0x17')});});};exports[_0x9d7a('0x18')]=function(_0x188cfe,_0x1ff377){return git[_0x9d7a('0x18')](['--hard','FETCH_HEAD'],function(_0x57b1d0){if(_0x57b1d0){logger['error'](_0x57b1d0);return _0x1ff377[_0x9d7a('0x13')](0x1f4)[_0x9d7a('0x12')](_0x57b1d0);}logger[_0x9d7a('0x19')](_0x9d7a('0x1a'));return _0x1ff377[_0x9d7a('0x13')](0xc8)[_0x9d7a('0x12')]({'output':_0x9d7a('0x1b')});});};exports['pull']=function(_0x45b966,_0x5136a6){exec(_0x9d7a('0x1c'),function(_0x262257,_0x494099,_0x14e78f){logger[_0x9d7a('0x19')](_0x494099);logger['info'](_0x14e78f);if(_0x262257){logger[_0x9d7a('0x16')](_0x262257);return _0x5136a6[_0x9d7a('0x13')](0x1f4)[_0x9d7a('0x12')](_0x262257);}return _0x5136a6[_0x9d7a('0x13')](0xc8)[_0x9d7a('0x12')]({'output':_0x494099});});};exports[_0x9d7a('0x1d')]=function(_0x13c418,_0x28cb9f){return pm2[_0x9d7a('0x1d')](_0x9d7a('0x1e'))[_0x9d7a('0x1f')](function(_0x4ccd88){logger['info'](_0x9d7a('0x20'),_0x4ccd88);return _0x28cb9f[_0x9d7a('0x13')](0xc8)[_0x9d7a('0x12')]({'output':_0x9d7a('0x21')});})[_0x9d7a('0x22')](function(_0x11ce2d){logger[_0x9d7a('0x16')](_0x11ce2d);return _0x28cb9f['status'](0x1f4)[_0x9d7a('0x12')](_0x11ce2d);});};exports[_0x9d7a('0x23')]=function(_0x1c8e35,_0x310f2c){var _0xe4ab80=fs[_0x9d7a('0x24')](path[_0x9d7a('0x25')](config[_0x9d7a('0xb')],'server',_0x9d7a('0x23')));var _0xc71643=[];for(var _0x1bfc90=0x0;_0x1bfc90<_0xe4ab80['length'];_0x1bfc90++){var _0x41f0ac=_0xe4ab80[_0x1bfc90][_0x9d7a('0x26')](_0x9d7a('0x27'),'');if(compareVersions(module[_0x9d7a('0x10')][_0x9d7a('0x3')],_0x41f0ac)===-0x1){_0xc71643[_0x9d7a('0x28')](_0x41f0ac);}}if(_0xc71643[_0x9d7a('0x29')]){var _0x46e4a4=_0xc71643[_0x9d7a('0x2a')](compareVersions);var _0x4b450e=new Umzug({'storage':_0x9d7a('0x2b'),'storageOptions':{'model':db[_0x9d7a('0x2c')],'modelName':_0x9d7a('0x2c'),'columnName':_0x9d7a('0x3')},'migrations':{'params':[db['sequelize'][_0x9d7a('0x2d')](),db[_0x9d7a('0x2b')][_0x9d7a('0x2e')],function(){throw new Error(_0x9d7a('0x2f'));}],'path':path[_0x9d7a('0x25')](config[_0x9d7a('0xb')],_0x9d7a('0x30'),_0x9d7a('0x23')),'pattern':/\.js$/}});_0x4b450e['up']({'migrations':_[_0x9d7a('0x31')](_0x46e4a4,function(_0x331083){return _0x331083+'.js';})})[_0x9d7a('0x1f')](function(){return _0x310f2c['status'](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x9d7a('0x10')][_0x9d7a('0x3')]+'\x20to\x20'+_[_0x9d7a('0x32')](_0x46e4a4),'migrations':_[_0x9d7a('0x25')](_0x46e4a4)});})[_0x9d7a('0x22')](function(_0x131d58){if(_0x131d58 instanceof db[_0x9d7a('0x2b')][_0x9d7a('0x33')]){return _0x310f2c['status'](0xc8)[_0x9d7a('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x310f2c[_0x9d7a('0x13')](0x1f4)[_0x9d7a('0x12')](_0x131d58);}});}else{return _0x310f2c[_0x9d7a('0x13')](0xc8)[_0x9d7a('0x12')]({'output':_0x9d7a('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 35169aa..8fc8d93 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 _0x5fcd=['get','isAuthenticated','describe','/:id','show','post','put','update','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller'];(function(_0xd826e4,_0x26cbc1){var _0x114d0b=function(_0x1f9283){while(--_0x1f9283){_0xd826e4['push'](_0xd826e4['shift']());}};_0x114d0b(++_0x26cbc1);}(_0x5fcd,0x189));var _0xd5fc=function(_0x109db9,_0x4806e9){_0x109db9=_0x109db9-0x0;var _0x2aedfd=_0x5fcd[_0x109db9];return _0x2aedfd;};'use strict';var multer=require(_0xd5fc('0x0'));var util=require(_0xd5fc('0x1'));var path=require('path');var timeout=require(_0xd5fc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd5fc('0x3'));var auth=require(_0xd5fc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd5fc('0x5'));var controller=require(_0xd5fc('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd5fc('0x7')]('/describe',auth[_0xd5fc('0x8')](),controller[_0xd5fc('0x9')]);router[_0xd5fc('0x7')](_0xd5fc('0xa'),auth[_0xd5fc('0x8')](),controller[_0xd5fc('0xb')]);router[_0xd5fc('0xc')]('/',auth[_0xd5fc('0x8')](),controller['create']);router[_0xd5fc('0xd')](_0xd5fc('0xa'),auth[_0xd5fc('0x8')](),controller[_0xd5fc('0xe')]);router['delete']('/:id',auth[_0xd5fc('0x8')](),controller['destroy']);module[_0xd5fc('0xf')]=router; \ No newline at end of file +var _0x0050=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','multer','util','path'];(function(_0x2f3f72,_0x49057e){var _0x31f206=function(_0x5c80cc){while(--_0x5c80cc){_0x2f3f72['push'](_0x2f3f72['shift']());}};_0x31f206(++_0x49057e);}(_0x0050,0xe1));var _0x0005=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0050[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x0005('0x0'));var util=require(_0x0005('0x1'));var path=require(_0x0005('0x2'));var timeout=require(_0x0005('0x3'));var express=require(_0x0005('0x4'));var router=express[_0x0005('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0005('0x6'));var config=require(_0x0005('0x7'));var controller=require(_0x0005('0x8'));router[_0x0005('0x9')]('/',auth[_0x0005('0xa')](),controller['index']);router[_0x0005('0x9')](_0x0005('0xb'),auth[_0x0005('0xa')](),controller[_0x0005('0xc')]);router['get'](_0x0005('0xd'),auth['isAuthenticated'](),controller[_0x0005('0xe')]);router[_0x0005('0xf')]('/',auth[_0x0005('0xa')](),controller[_0x0005('0x10')]);router[_0x0005('0x11')]('/:id',auth[_0x0005('0xa')](),controller['update']);router[_0x0005('0x12')](_0x0005('0xd'),auth[_0x0005('0xa')](),controller['destroy']);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 8840384..7828db3 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 _0x3c8b=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x45cd85,_0x5f2199){var _0x1dc39a=function(_0x48dac7){while(--_0x48dac7){_0x45cd85['push'](_0x45cd85['shift']());}};_0x1dc39a(++_0x5f2199);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x20a788,_0x1a83db){_0x20a788=_0x20a788-0x0;var _0x36ee51=_0x3c8b[_0x20a788];return _0x36ee51;};'use strict';var Sequelize=require('sequelize');module[_0xb3c8('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb3c8('0x1')]},'calleridnum':{'type':Sequelize[_0xb3c8('0x1')]},'calleridname':{'type':Sequelize[_0xb3c8('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb3c8('0x1')]},'membername':{'type':Sequelize[_0xb3c8('0x1')]},'agentcalledAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentconnectAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xb3c8('0x2')]},'agentdumpAt':{'type':Sequelize[_0xb3c8('0x2')]},'holdtime':{'type':Sequelize[_0xb3c8('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb3c8('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb3c8('0x3')]},'agentacw':{'type':Sequelize[_0xb3c8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb3c8('0x1')]},'channelstate':{'type':Sequelize[_0xb3c8('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb3c8('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb3c8('0x1')]},'language':{'type':Sequelize[_0xb3c8('0x1')]},'accountcode':{'type':Sequelize[_0xb3c8('0x1')]},'context':{'type':Sequelize[_0xb3c8('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb3c8('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb3c8('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb3c8('0x1')]},'destcalleridname':{'type':Sequelize[_0xb3c8('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb3c8('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xb3c8('0x1')]},'destcontext':{'type':Sequelize[_0xb3c8('0x1')]},'destexten':{'type':Sequelize[_0xb3c8('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb3c8('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb3c8('0x1')]},'transfer':{'type':Sequelize[_0xb3c8('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb3c8('0x5')},'transferexten':{'type':Sequelize[_0xb3c8('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb3c8('0x1')]},'agententerreason':{'type':Sequelize[_0xb3c8('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x585e=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x360502,_0x57313e){var _0xebbf3c=function(_0x5daacc){while(--_0x5daacc){_0x360502['push'](_0x360502['shift']());}};_0xebbf3c(++_0x57313e);}(_0x585e,0x1c2));var _0xe585=function(_0x45c44c,_0x1b11e4){_0x45c44c=_0x45c44c-0x0;var _0xde2824=_0x585e[_0x45c44c];return _0xde2824;};'use strict';var Sequelize=require(_0xe585('0x0'));module[_0xe585('0x1')]={'type':{'type':Sequelize[_0xe585('0x2')]},'uniqueid':{'type':Sequelize[_0xe585('0x2')]},'calleridnum':{'type':Sequelize[_0xe585('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe585('0x2')]},'membername':{'type':Sequelize[_0xe585('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xe585('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe585('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe585('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe585('0x3')]},'holdtime':{'type':Sequelize[_0xe585('0x4')]},'agentcomplete':{'type':Sequelize[_0xe585('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe585('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe585('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe585('0x4')]},'agentacw':{'type':Sequelize[_0xe585('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe585('0x4')]},'reason':{'type':Sequelize[_0xe585('0x2')]},'lastevent':{'type':Sequelize[_0xe585('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe585('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe585('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe585('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe585('0x2')]},'context':{'type':Sequelize[_0xe585('0x2')]},'exten':{'type':Sequelize[_0xe585('0x2')]},'priority':{'type':Sequelize[_0xe585('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe585('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xe585('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe585('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe585('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe585('0x2')]},'destlanguage':{'type':Sequelize[_0xe585('0x2')]},'destaccountcode':{'type':Sequelize[_0xe585('0x2')]},'destcontext':{'type':Sequelize[_0xe585('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe585('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xe585('0x2')]},'transfer':{'type':Sequelize[_0xe585('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe585('0x6')},'transferexten':{'type':Sequelize[_0xe585('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xe585('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 4ed6eac..954d0ed 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(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 7bb5c6f..8435bcb 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 _0x7dee=['request-promise','path','../../config/environment','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x49acee,_0x49c7ab){var _0x18a8f8=function(_0x18fb2a){while(--_0x18fb2a){_0x49acee['push'](_0x49acee['shift']());}};_0x18a8f8(++_0x49c7ab);}(_0x7dee,0xb0));var _0xe7de=function(_0x30c470,_0x3db9cb){_0x30c470=_0x30c470-0x0;var _0x48aaac=_0x7dee[_0x30c470];return _0x48aaac;};'use strict';var _=require(_0xe7de('0x0'));var util=require('util');var logger=require(_0xe7de('0x1'))('api');var moment=require(_0xe7de('0x2'));var BPromise=require(_0xe7de('0x3'));var rp=require(_0xe7de('0x4'));var fs=require('fs');var path=require(_0xe7de('0x5'));var rimraf=require('rimraf');var config=require(_0xe7de('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0xe7de('0x7')]=function(_0x19f79d,_0x26a524){return _0x19f79d[_0xe7de('0x8')](_0xe7de('0x9'),attributes,{'tableName':_0xe7de('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xe7de('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49c4=['destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x49c4,0x9b));var _0x449c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x49c4[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x449c('0x0'));var util=require('util');var logger=require(_0x449c('0x1'))(_0x449c('0x2'));var moment=require(_0x449c('0x3'));var BPromise=require(_0x449c('0x4'));var rp=require(_0x449c('0x5'));var fs=require('fs');var path=require(_0x449c('0x6'));var rimraf=require(_0x449c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x449c('0x8')]=function(_0x442e56,_0x12586c){return _0x442e56[_0x449c('0x9')](_0x449c('0xa'),attributes,{'tableName':_0x449c('0xb'),'paranoid':![],'indexes':[{'fields':[_0x449c('0xc'),_0x449c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ad82ea7..7fdaf99 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 _0xd7b7=['limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','update','attributes'];(function(_0x275948,_0x11c6dd){var _0x4564b6=function(_0x1fd28b){while(--_0x1fd28b){_0x275948['push'](_0x275948['shift']());}};_0x4564b6(++_0x11c6dd);}(_0xd7b7,0x194));var _0x7d7b=function(_0x15206d,_0x47a814){_0x15206d=_0x15206d-0x0;var _0x1fa35d=_0xd7b7[_0x15206d];return _0x1fa35d;};'use strict';var _=require(_0x7d7b('0x0'));var util=require(_0x7d7b('0x1'));var moment=require(_0x7d7b('0x2'));var BPromise=require(_0x7d7b('0x3'));var rs=require(_0x7d7b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d7b('0x5'));var logger=require(_0x7d7b('0x6'))('rpc');var config=require(_0x7d7b('0x7'));var jayson=require(_0x7d7b('0x8'));var client=jayson[_0x7d7b('0x9')][_0x7d7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee7d,_0x45c9ac,_0x411ae1){return new BPromise(function(_0x40038b,_0x32e73f){return client[_0x7d7b('0xb')](_0x57ee7d,_0x411ae1)[_0x7d7b('0xc')](function(_0x4cd4a4){logger['info'](_0x7d7b('0xd'),_0x45c9ac,_0x7d7b('0xe'));logger[_0x7d7b('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x45c9ac,_0x7d7b('0xe'),JSON[_0x7d7b('0x10')](_0x4cd4a4));if(_0x4cd4a4[_0x7d7b('0x11')]){if(_0x4cd4a4[_0x7d7b('0x11')]['code']===0x1f4){logger[_0x7d7b('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x45c9ac,_0x4cd4a4[_0x7d7b('0x11')][_0x7d7b('0x12')]);return _0x32e73f(_0x4cd4a4[_0x7d7b('0x11')][_0x7d7b('0x12')]);}logger[_0x7d7b('0x11')](_0x7d7b('0xd'),_0x45c9ac,_0x4cd4a4[_0x7d7b('0x11')][_0x7d7b('0x12')]);return _0x40038b(_0x4cd4a4[_0x7d7b('0x11')][_0x7d7b('0x12')]);}else{logger[_0x7d7b('0x13')](_0x7d7b('0xd'),_0x45c9ac,_0x7d7b('0xe'));_0x40038b(_0x4cd4a4['result']['message']);}})['catch'](function(_0x1cf0c3){logger[_0x7d7b('0x11')](_0x7d7b('0xd'),_0x45c9ac,_0x1cf0c3);_0x32e73f(_0x1cf0c3);});});}exports[_0x7d7b('0x14')]=function(_0x4158ab){var _0x5a7b36=this;return new Promise(function(_0x271ea6,_0x3a80c2){return db[_0x7d7b('0x15')][_0x7d7b('0x16')](_0x4158ab[_0x7d7b('0x17')],{'raw':_0x4158ab[_0x7d7b('0x18')]?_0x4158ab[_0x7d7b('0x18')][_0x7d7b('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x49bf5f){logger[_0x7d7b('0x13')](_0x7d7b('0x14'),_0x4158ab);logger[_0x7d7b('0xf')]('CreateVoiceAgentReport',_0x4158ab,JSON['stringify'](_0x49bf5f));_0x271ea6(_0x49bf5f);})[_0x7d7b('0x1a')](function(_0x177469){logger[_0x7d7b('0x11')](_0x7d7b('0x14'),_0x177469[_0x7d7b('0x12')],_0x4158ab);_0x3a80c2(_0x5a7b36[_0x7d7b('0x11')](0x1f4,_0x177469['message']));});});};exports[_0x7d7b('0x1b')]=function(_0x7bd6af){var _0x3bb6d3=this;return new Promise(function(_0x300f9d,_0x13cf44){return db[_0x7d7b('0x15')][_0x7d7b('0x1c')](_0x7bd6af[_0x7d7b('0x17')],{'raw':_0x7bd6af[_0x7d7b('0x18')]?_0x7bd6af[_0x7d7b('0x18')][_0x7d7b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7bd6af['options']?_0x7bd6af['options']['where']||null:null,'attributes':_0x7bd6af[_0x7d7b('0x18')]?_0x7bd6af[_0x7d7b('0x18')][_0x7d7b('0x1d')]||null:null,'limit':_0x7bd6af[_0x7d7b('0x18')]?_0x7bd6af[_0x7d7b('0x18')][_0x7d7b('0x1e')]||null:null})[_0x7d7b('0xc')](function(_0xf6a367){logger[_0x7d7b('0x13')](_0x7d7b('0x1b'),_0x7bd6af);logger[_0x7d7b('0xf')](_0x7d7b('0x1b'),_0x7bd6af,JSON[_0x7d7b('0x10')](_0xf6a367));_0x300f9d(_0xf6a367);})['catch'](function(_0x3dc303){logger[_0x7d7b('0x11')](_0x7d7b('0x1b'),_0x3dc303[_0x7d7b('0x12')],_0x7bd6af);_0x13cf44(_0x3bb6d3[_0x7d7b('0x11')](0x1f4,_0x3dc303[_0x7d7b('0x12')]));});});}; \ No newline at end of file +var _0xd012=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateVoiceAgentReport','create','body','options','catch','UpdateVoiceAgentReport','VoiceAgentReport','raw','where','lodash','util','moment'];(function(_0x2b4beb,_0x246fb3){var _0x3cc52c=function(_0x5eeda9){while(--_0x5eeda9){_0x2b4beb['push'](_0x2b4beb['shift']());}};_0x3cc52c(++_0x246fb3);}(_0xd012,0x133));var _0x2d01=function(_0x4f1fbe,_0x5b17e5){_0x4f1fbe=_0x4f1fbe-0x0;var _0x40696f=_0xd012[_0x4f1fbe];return _0x40696f;};'use strict';var _=require(_0x2d01('0x0'));var util=require(_0x2d01('0x1'));var moment=require(_0x2d01('0x2'));var BPromise=require(_0x2d01('0x3'));var rs=require(_0x2d01('0x4'));var fs=require('fs');var Redis=require(_0x2d01('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d01('0x6'));var logger=require(_0x2d01('0x7'))(_0x2d01('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d7623,_0x4ca3ad,_0x216998){return new BPromise(function(_0x84925,_0x791b9){return client[_0x2d01('0xa')](_0x3d7623,_0x216998)[_0x2d01('0xb')](function(_0x474a76){logger[_0x2d01('0xc')](_0x2d01('0xd'),_0x4ca3ad,'request\x20sent');logger[_0x2d01('0xe')](_0x2d01('0xf'),_0x4ca3ad,_0x2d01('0x10'),JSON[_0x2d01('0x11')](_0x474a76));if(_0x474a76[_0x2d01('0x12')]){if(_0x474a76['error'][_0x2d01('0x13')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x4ca3ad,_0x474a76['error']['message']);return _0x791b9(_0x474a76[_0x2d01('0x12')][_0x2d01('0x14')]);}logger['error'](_0x2d01('0xd'),_0x4ca3ad,_0x474a76[_0x2d01('0x12')]['message']);return _0x84925(_0x474a76[_0x2d01('0x12')][_0x2d01('0x14')]);}else{logger[_0x2d01('0xc')](_0x2d01('0xd'),_0x4ca3ad,'request\x20sent');_0x84925(_0x474a76[_0x2d01('0x15')][_0x2d01('0x14')]);}})['catch'](function(_0x2e2058){logger[_0x2d01('0x12')](_0x2d01('0xd'),_0x4ca3ad,_0x2e2058);_0x791b9(_0x2e2058);});});}exports[_0x2d01('0x16')]=function(_0x55353c){var _0x5b6c9b=this;return new Promise(function(_0x445870,_0x814d70){return db['VoiceAgentReport'][_0x2d01('0x17')](_0x55353c[_0x2d01('0x18')],{'raw':_0x55353c['options']?_0x55353c[_0x2d01('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2d01('0xb')](function(_0x5a02ef){logger[_0x2d01('0xc')](_0x2d01('0x16'),_0x55353c);logger[_0x2d01('0xe')](_0x2d01('0x16'),_0x55353c,JSON[_0x2d01('0x11')](_0x5a02ef));_0x445870(_0x5a02ef);})[_0x2d01('0x1a')](function(_0x3af6ab){logger[_0x2d01('0x12')](_0x2d01('0x16'),_0x3af6ab[_0x2d01('0x14')],_0x55353c);_0x814d70(_0x5b6c9b[_0x2d01('0x12')](0x1f4,_0x3af6ab[_0x2d01('0x14')]));});});};exports[_0x2d01('0x1b')]=function(_0x2a2494){var _0x27594a=this;return new Promise(function(_0xec421f,_0x40737d){return db[_0x2d01('0x1c')]['update'](_0x2a2494[_0x2d01('0x18')],{'raw':_0x2a2494['options']?_0x2a2494['options'][_0x2d01('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2494['options']?_0x2a2494['options'][_0x2d01('0x1e')]||null:null,'attributes':_0x2a2494[_0x2d01('0x19')]?_0x2a2494['options']['attributes']||null:null,'limit':_0x2a2494['options']?_0x2a2494['options']['limit']||null:null})[_0x2d01('0xb')](function(_0x390bbf){logger['info'](_0x2d01('0x1b'),_0x2a2494);logger['debug']('UpdateVoiceAgentReport',_0x2a2494,JSON['stringify'](_0x390bbf));_0xec421f(_0x390bbf);})[_0x2d01('0x1a')](function(_0x187a43){logger[_0x2d01('0x12')]('UpdateVoiceAgentReport',_0x187a43[_0x2d01('0x14')],_0x2a2494);_0x40737d(_0x27594a[_0x2d01('0x12')](0x1f4,_0x187a43['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 34355e0..c797243 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 _0x5089=['show','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5089,0x1bb));var _0x9508=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0x5089[_0x33ca22];return _0x1790c3;};'use strict';var multer=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var path=require('path');var timeout=require(_0x9508('0x2'));var express=require(_0x9508('0x3'));var router=express[_0x9508('0x4')]();var fs_extra=require(_0x9508('0x5'));var auth=require(_0x9508('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9508('0x7'));var controller=require('./voiceCallReport.controller');router[_0x9508('0x8')]('/',auth[_0x9508('0x9')](),controller[_0x9508('0xa')]);router['get'](_0x9508('0xb'),auth[_0x9508('0x9')](),controller['describe']);router[_0x9508('0x8')](_0x9508('0xc'),auth['isAuthenticated'](),controller[_0x9508('0xd')]);router['post']('/',auth[_0x9508('0x9')](),controller[_0x9508('0xe')]);router[_0x9508('0xf')](_0x9508('0xc'),auth[_0x9508('0x9')](),controller[_0x9508('0x10')]);router['delete'](_0x9508('0xc'),auth['isAuthenticated'](),controller[_0x9508('0x11')]);module[_0x9508('0x12')]=router; \ No newline at end of file +var _0x80d9=['get','/:id','show','post','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','isAuthenticated','describe'];(function(_0x1b7c7b,_0x51b214){var _0x539d94=function(_0x763711){while(--_0x763711){_0x1b7c7b['push'](_0x1b7c7b['shift']());}};_0x539d94(++_0x51b214);}(_0x80d9,0x15c));var _0x980d=function(_0x22988e,_0xa2a206){_0x22988e=_0x22988e-0x0;var _0x226457=_0x80d9[_0x22988e];return _0x226457;};'use strict';var multer=require(_0x980d('0x0'));var util=require('util');var path=require(_0x980d('0x1'));var timeout=require(_0x980d('0x2'));var express=require(_0x980d('0x3'));var router=express['Router']();var fs_extra=require(_0x980d('0x4'));var auth=require(_0x980d('0x5'));var interaction=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var controller=require(_0x980d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x980d('0x9')]);router['get']('/describe',auth[_0x980d('0xa')](),controller[_0x980d('0xb')]);router[_0x980d('0xc')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0xe')]);router[_0x980d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x980d('0xd'),auth[_0x980d('0xa')](),controller['update']);router[_0x980d('0x10')]('/:id',auth[_0x980d('0xa')](),controller['destroy']);module[_0x980d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index eb52c9f..97892c7 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 _0x8aad=['outbound','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','internal'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8aad,0x146));var _0xd8aa=function(_0x142518,_0x1f109a){_0x142518=_0x142518-0x0;var _0x4a846a=_0x8aad[_0x142518];return _0x4a846a;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd8aa('0x2')]('inbound',_0xd8aa('0x3'),_0xd8aa('0x4'),'inbound-fax','outbound-fax',_0xd8aa('0x5'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xd8aa('0x6')]},'destination':{'type':Sequelize[_0xd8aa('0x6')]},'destinationcontext':{'type':Sequelize[_0xd8aa('0x6')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd8aa('0x6')]},'destinationchannel':{'type':Sequelize[_0xd8aa('0x6')]},'lastapplication':{'type':Sequelize[_0xd8aa('0x6')]},'lastdata':{'type':Sequelize[_0xd8aa('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd8aa('0x8')]},'endtime':{'type':Sequelize[_0xd8aa('0x8')]},'duration':{'type':Sequelize[_0xd8aa('0x9')]},'billableseconds':{'type':Sequelize[_0xd8aa('0x9')]},'mohtime':{'type':Sequelize[_0xd8aa('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xd8aa('0x6')]},'userfield':{'type':Sequelize[_0xd8aa('0x6')]},'userDisposition':{'type':Sequelize[_0xd8aa('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xd8aa('0x6')]},'userThirdDisposition':{'type':Sequelize[_0xd8aa('0x6')]},'note':{'type':Sequelize[_0xd8aa('0x6')]},'prefix':{'type':Sequelize[_0xd8aa('0x6')]},'routeid':{'type':Sequelize[_0xd8aa('0x9')]},'sipcallid':{'type':Sequelize[_0xd8aa('0x6')]}}; \ No newline at end of file +var _0xe083=['outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal'];(function(_0x3df5fd,_0x4e0c30){var _0x447f01=function(_0x24569c){while(--_0x24569c){_0x3df5fd['push'](_0x3df5fd['shift']());}};_0x447f01(++_0x4e0c30);}(_0xe083,0x1dc));var _0x3e08=function(_0x52d71c,_0x2c8e29){_0x52d71c=_0x52d71c-0x0;var _0x5bb1f7=_0xe083[_0x52d71c];return _0x5bb1f7;};'use strict';var Sequelize=require(_0x3e08('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3e08('0x1')](_0x3e08('0x2'),_0x3e08('0x3'),_0x3e08('0x4'),_0x3e08('0x5'),_0x3e08('0x6'),_0x3e08('0x7'))},'tag':{'type':Sequelize[_0x3e08('0x8')]},'accountcode':{'type':Sequelize[_0x3e08('0x8')]},'source':{'type':Sequelize[_0x3e08('0x8')]},'destination':{'type':Sequelize[_0x3e08('0x8')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3e08('0x8')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x3e08('0x8')]},'lastdata':{'type':Sequelize[_0x3e08('0x9')]},'starttime':{'type':Sequelize[_0x3e08('0xa')]},'systemanswertime':{'type':Sequelize[_0x3e08('0xa')]},'answertime':{'type':Sequelize[_0x3e08('0xa')]},'endtime':{'type':Sequelize[_0x3e08('0xa')]},'duration':{'type':Sequelize[_0x3e08('0xb')]},'billableseconds':{'type':Sequelize[_0x3e08('0xb')]},'mohtime':{'type':Sequelize[_0x3e08('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x3e08('0x8')]},'note':{'type':Sequelize[_0x3e08('0x8')]},'prefix':{'type':Sequelize[_0x3e08('0x8')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x3e08('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d43c12f..682f05e 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xadb5,0xad));var _0x5adb=function(_0x37faf9,_0x3252be){_0x37faf9=_0x37faf9-0x0;var _0x1788d2=_0xadb5[_0x37faf9];return _0x1788d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32a777,_0x172207){_0x32a777=_0x32a777-0x0;var _0xfd7cd2=_0x5f2f[_0x32a777];return _0xfd7cd2;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 32e6e48..2b237bb 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 _0x029e=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3880f5,_0x51ee2d){var _0xbb0ea=function(_0xe0309d){while(--_0xe0309d){_0x3880f5['push'](_0x3880f5['shift']());}};_0xbb0ea(++_0x51ee2d);}(_0x029e,0x18b));var _0xe029=function(_0x32ef6f,_0x5a7408){_0x32ef6f=_0x32ef6f-0x0;var _0x400796=_0x029e[_0x32ef6f];return _0x400796;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe029('0x0'))(_0xe029('0x1'));var moment=require(_0xe029('0x2'));var BPromise=require(_0xe029('0x3'));var rp=require(_0xe029('0x4'));var fs=require('fs');var path=require(_0xe029('0x5'));var rimraf=require(_0xe029('0x6'));var config=require(_0xe029('0x7'));var attributes=require(_0xe029('0x8'));module[_0xe029('0x9')]=function(_0x406a8f,_0x1a1158){return _0x406a8f[_0xe029('0xa')](_0xe029('0xb'),attributes,{'tableName':_0xe029('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a36=['path','rimraf','../../config/environment','./voiceCallReport.attributes','define','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x2a36,0x95));var _0x62a3=function(_0x56d602,_0x37d793){_0x56d602=_0x56d602-0x0;var _0xb2d67f=_0x2a36[_0x56d602];return _0xb2d67f;};'use strict';var _=require(_0x62a3('0x0'));var util=require(_0x62a3('0x1'));var logger=require(_0x62a3('0x2'))(_0x62a3('0x3'));var moment=require(_0x62a3('0x4'));var BPromise=require(_0x62a3('0x5'));var rp=require(_0x62a3('0x6'));var fs=require('fs');var path=require(_0x62a3('0x7'));var rimraf=require(_0x62a3('0x8'));var config=require(_0x62a3('0x9'));var attributes=require(_0x62a3('0xa'));module['exports']=function(_0x53d54a,_0x48f721){return _0x53d54a[_0x62a3('0xb')]('VoiceCallReport',attributes,{'tableName':_0x62a3('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e5f12aa..f0699db 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 _0xc216=['../../config/utils','rpc','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','limit','map','model','attributes','include','CreateVoiceCallReport','create','body','raw','where','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3d748f,_0x26260e){var _0x32490e=function(_0x2cb569){while(--_0x2cb569){_0x3d748f['push'](_0x3d748f['shift']());}};_0x32490e(++_0x26260e);}(_0xc216,0x89));var _0x6c21=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xc216[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x6c21('0x0'));var util=require(_0x6c21('0x1'));var moment=require(_0x6c21('0x2'));var BPromise=require(_0x6c21('0x3'));var rs=require(_0x6c21('0x4'));var fs=require('fs');var Redis=require(_0x6c21('0x5'));var db=require(_0x6c21('0x6'))['db'];var utils=require(_0x6c21('0x7'));var logger=require('../../config/logger')(_0x6c21('0x8'));var config=require('../../config/environment');var jayson=require(_0x6c21('0x9'));var client=jayson[_0x6c21('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568987,_0x456ca5,_0x506d93){return new BPromise(function(_0x12cf28,_0x3d76b9){return client['request'](_0x568987,_0x506d93)[_0x6c21('0xb')](function(_0x4c1e00){logger[_0x6c21('0xc')](_0x6c21('0xd'),_0x456ca5,_0x6c21('0xe'));logger[_0x6c21('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x456ca5,_0x6c21('0xe'),JSON[_0x6c21('0x10')](_0x4c1e00));if(_0x4c1e00[_0x6c21('0x11')]){if(_0x4c1e00['error'][_0x6c21('0x12')]===0x1f4){logger[_0x6c21('0x11')](_0x6c21('0xd'),_0x456ca5,_0x4c1e00['error']['message']);return _0x3d76b9(_0x4c1e00[_0x6c21('0x11')][_0x6c21('0x13')]);}logger[_0x6c21('0x11')](_0x6c21('0xd'),_0x456ca5,_0x4c1e00['error'][_0x6c21('0x13')]);return _0x12cf28(_0x4c1e00['error']['message']);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x456ca5,_0x6c21('0xe'));_0x12cf28(_0x4c1e00[_0x6c21('0x14')][_0x6c21('0x13')]);}})[_0x6c21('0x15')](function(_0x161e53){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x456ca5,_0x161e53);_0x3d76b9(_0x161e53);});});}exports[_0x6c21('0x16')]=function(_0x32c297){var _0x23e369=this;return new Promise(function(_0x13cd0d,_0x5af287){return db[_0x6c21('0x17')]['findAll']({'raw':_0x32c297['options']?_0x32c297[_0x6c21('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x32c297[_0x6c21('0x18')]?_0x32c297[_0x6c21('0x18')]['where']||null:null,'attributes':_0x32c297['options']?_0x32c297[_0x6c21('0x18')]['attributes']||null:null,'limit':_0x32c297[_0x6c21('0x18')]?_0x32c297[_0x6c21('0x18')][_0x6c21('0x19')]||null:null,'include':_0x32c297[_0x6c21('0x18')]?_0x32c297[_0x6c21('0x18')]['include']?_[_0x6c21('0x1a')](_0x32c297[_0x6c21('0x18')]['include'],function(_0x8c4027){return{'model':db[_0x8c4027[_0x6c21('0x1b')]],'as':_0x8c4027['as'],'attributes':_0x8c4027[_0x6c21('0x1c')],'include':_0x8c4027['include']?_[_0x6c21('0x1a')](_0x8c4027['include'],function(_0x2999f5){return{'model':db[_0x2999f5[_0x6c21('0x1b')]],'as':_0x2999f5['as'],'attributes':_0x2999f5[_0x6c21('0x1c')],'include':_0x2999f5[_0x6c21('0x1d')]?_[_0x6c21('0x1a')](_0x2999f5['include'],function(_0x402417){return{'model':db[_0x402417[_0x6c21('0x1b')]],'as':_0x402417['as'],'attributes':_0x402417[_0x6c21('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6c21('0xb')](function(_0xb51382){logger[_0x6c21('0xc')](_0x6c21('0x16'),_0x32c297);logger['debug'](_0x6c21('0x16'),_0x32c297,JSON[_0x6c21('0x10')](_0xb51382));_0x13cd0d(_0xb51382);})[_0x6c21('0x15')](function(_0x55de6e){logger[_0x6c21('0x11')](_0x6c21('0x16'),_0x55de6e[_0x6c21('0x13')],_0x32c297);_0x5af287(_0x23e369['error'](0x1f4,_0x55de6e[_0x6c21('0x13')]));});});};exports[_0x6c21('0x1e')]=function(_0x340c09){var _0x43a566=this;return new Promise(function(_0x203e0a,_0x34107d){return db['VoiceCallReport'][_0x6c21('0x1f')](_0x340c09[_0x6c21('0x20')],{'raw':_0x340c09[_0x6c21('0x18')]?_0x340c09[_0x6c21('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x16a992){logger[_0x6c21('0xc')](_0x6c21('0x1e'),_0x340c09);logger[_0x6c21('0xf')](_0x6c21('0x1e'),_0x340c09,JSON[_0x6c21('0x10')](_0x16a992));_0x203e0a(_0x16a992);})[_0x6c21('0x15')](function(_0x371f17){logger[_0x6c21('0x11')](_0x6c21('0x1e'),_0x371f17[_0x6c21('0x13')],_0x340c09);_0x34107d(_0x43a566[_0x6c21('0x11')](0x1f4,_0x371f17['message']));});});};exports['UpdateVoiceCallReport']=function(_0x472ef1){var _0x4a6792=this;return new Promise(function(_0x532f09,_0x332492){return db[_0x6c21('0x17')]['update'](_0x472ef1['body'],{'raw':_0x472ef1['options']?_0x472ef1[_0x6c21('0x18')][_0x6c21('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x472ef1['options']?_0x472ef1[_0x6c21('0x18')][_0x6c21('0x22')]||null:null,'attributes':_0x472ef1[_0x6c21('0x18')]?_0x472ef1['options'][_0x6c21('0x1c')]||null:null,'limit':_0x472ef1[_0x6c21('0x18')]?_0x472ef1[_0x6c21('0x18')][_0x6c21('0x19')]||null:null})[_0x6c21('0xb')](function(_0x39896c){logger[_0x6c21('0xc')](_0x6c21('0x23'),_0x472ef1);logger['debug'](_0x6c21('0x23'),_0x472ef1,JSON[_0x6c21('0x10')](_0x39896c));_0x532f09(_0x39896c);})[_0x6c21('0x15')](function(_0x15f840){logger[_0x6c21('0x11')](_0x6c21('0x23'),_0x15f840[_0x6c21('0x13')],_0x472ef1);_0x332492(_0x4a6792['error'](0x1f4,_0x15f840[_0x6c21('0x13')]));});});}; \ No newline at end of file +var _0x67a2=['message','info','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','where','limit','map','model','include','catch','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x67a2,0x142));var _0x267a=function(_0x271f64,_0x18ad21){_0x271f64=_0x271f64-0x0;var _0x4beaaa=_0x67a2[_0x271f64];return _0x4beaaa;};'use strict';var _=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var moment=require(_0x267a('0x2'));var BPromise=require(_0x267a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x267a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x267a('0x5'));var logger=require('../../config/logger')(_0x267a('0x6'));var config=require(_0x267a('0x7'));var jayson=require(_0x267a('0x8'));var client=jayson[_0x267a('0x9')][_0x267a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5269fe,_0x4342ae,_0x56a0aa){return new BPromise(function(_0x27afbe,_0x256008){return client[_0x267a('0xb')](_0x5269fe,_0x56a0aa)[_0x267a('0xc')](function(_0x363cc3){logger['info'](_0x267a('0xd'),_0x4342ae,'request\x20sent');logger[_0x267a('0xe')](_0x267a('0xf'),_0x4342ae,_0x267a('0x10'),JSON[_0x267a('0x11')](_0x363cc3));if(_0x363cc3['error']){if(_0x363cc3[_0x267a('0x12')][_0x267a('0x13')]===0x1f4){logger['error'](_0x267a('0xd'),_0x4342ae,_0x363cc3[_0x267a('0x12')]['message']);return _0x256008(_0x363cc3[_0x267a('0x12')]['message']);}logger[_0x267a('0x12')](_0x267a('0xd'),_0x4342ae,_0x363cc3['error'][_0x267a('0x14')]);return _0x27afbe(_0x363cc3['error']['message']);}else{logger[_0x267a('0x15')](_0x267a('0xd'),_0x4342ae,_0x267a('0x10'));_0x27afbe(_0x363cc3['result'][_0x267a('0x14')]);}})['catch'](function(_0x384ff6){logger['error'](_0x267a('0xd'),_0x4342ae,_0x384ff6);_0x256008(_0x384ff6);});});}exports[_0x267a('0x16')]=function(_0x5c873e){var _0x339577=this;return new Promise(function(_0x135d31,_0x3c9797){return db[_0x267a('0x17')][_0x267a('0x18')]({'raw':_0x5c873e['options']?_0x5c873e['options'][_0x267a('0x19')]===undefined?!![]:![]:!![],'where':_0x5c873e[_0x267a('0x1a')]?_0x5c873e[_0x267a('0x1a')][_0x267a('0x1b')]||null:null,'attributes':_0x5c873e['options']?_0x5c873e[_0x267a('0x1a')]['attributes']||null:null,'limit':_0x5c873e[_0x267a('0x1a')]?_0x5c873e[_0x267a('0x1a')][_0x267a('0x1c')]||null:null,'include':_0x5c873e[_0x267a('0x1a')]?_0x5c873e[_0x267a('0x1a')]['include']?_[_0x267a('0x1d')](_0x5c873e[_0x267a('0x1a')]['include'],function(_0x300021){return{'model':db[_0x300021[_0x267a('0x1e')]],'as':_0x300021['as'],'attributes':_0x300021['attributes'],'include':_0x300021['include']?_[_0x267a('0x1d')](_0x300021[_0x267a('0x1f')],function(_0x5ba0c5){return{'model':db[_0x5ba0c5['model']],'as':_0x5ba0c5['as'],'attributes':_0x5ba0c5['attributes'],'include':_0x5ba0c5[_0x267a('0x1f')]?_[_0x267a('0x1d')](_0x5ba0c5[_0x267a('0x1f')],function(_0x13e517){return{'model':db[_0x13e517[_0x267a('0x1e')]],'as':_0x13e517['as'],'attributes':_0x13e517['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe864cd){logger['info'](_0x267a('0x16'),_0x5c873e);logger['debug'](_0x267a('0x16'),_0x5c873e,JSON[_0x267a('0x11')](_0xe864cd));_0x135d31(_0xe864cd);})[_0x267a('0x20')](function(_0x5f34da){logger[_0x267a('0x12')]('GetVoiceCallReport',_0x5f34da['message'],_0x5c873e);_0x3c9797(_0x339577['error'](0x1f4,_0x5f34da['message']));});});};exports['CreateVoiceCallReport']=function(_0x358916){var _0x45890d=this;return new Promise(function(_0x1acf6b,_0x5e87dd){return db[_0x267a('0x17')][_0x267a('0x21')](_0x358916[_0x267a('0x22')],{'raw':_0x358916['options']?_0x358916[_0x267a('0x1a')][_0x267a('0x19')]===undefined?!![]:![]:!![]})[_0x267a('0xc')](function(_0x412c13){logger['info'](_0x267a('0x23'),_0x358916);logger[_0x267a('0xe')](_0x267a('0x23'),_0x358916,JSON[_0x267a('0x11')](_0x412c13));_0x1acf6b(_0x412c13);})[_0x267a('0x20')](function(_0x1bbc58){logger['error']('CreateVoiceCallReport',_0x1bbc58['message'],_0x358916);_0x5e87dd(_0x45890d[_0x267a('0x12')](0x1f4,_0x1bbc58['message']));});});};exports[_0x267a('0x24')]=function(_0x5b04a9){var _0x4ff316=this;return new Promise(function(_0x4cb072,_0x59dcb8){return db[_0x267a('0x17')]['update'](_0x5b04a9[_0x267a('0x22')],{'raw':_0x5b04a9[_0x267a('0x1a')]?_0x5b04a9[_0x267a('0x1a')][_0x267a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b04a9['options']?_0x5b04a9[_0x267a('0x1a')][_0x267a('0x1b')]||null:null,'attributes':_0x5b04a9[_0x267a('0x1a')]?_0x5b04a9[_0x267a('0x1a')][_0x267a('0x25')]||null:null,'limit':_0x5b04a9[_0x267a('0x1a')]?_0x5b04a9[_0x267a('0x1a')][_0x267a('0x1c')]||null:null})[_0x267a('0xc')](function(_0x403563){logger['info']('UpdateVoiceCallReport',_0x5b04a9);logger[_0x267a('0xe')](_0x267a('0x24'),_0x5b04a9,JSON[_0x267a('0x11')](_0x403563));_0x4cb072(_0x403563);})['catch'](function(_0x27cdf1){logger['error'](_0x267a('0x24'),_0x27cdf1[_0x267a('0x14')],_0x5b04a9);_0x59dcb8(_0x4ff316[_0x267a('0x12')](0x1f4,_0x27cdf1[_0x267a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b6e3ae4..8cc4a7a 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 _0xaeeb=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','create','update','delete'];(function(_0x29e897,_0x126bba){var _0x30f70e=function(_0x4dcb55){while(--_0x4dcb55){_0x29e897['push'](_0x29e897['shift']());}};_0x30f70e(++_0x126bba);}(_0xaeeb,0x1d1));var _0xbaee=function(_0x2e835b,_0x384aae){_0x2e835b=_0x2e835b-0x0;var _0x537288=_0xaeeb[_0x2e835b];return _0x537288;};'use strict';var multer=require(_0xbaee('0x0'));var util=require('util');var path=require(_0xbaee('0x1'));var timeout=require(_0xbaee('0x2'));var express=require(_0xbaee('0x3'));var router=express[_0xbaee('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbaee('0x5'));var config=require(_0xbaee('0x6'));var controller=require(_0xbaee('0x7'));router[_0xbaee('0x8')]('/',auth[_0xbaee('0x9')](),controller['index']);router[_0xbaee('0x8')](_0xbaee('0xa'),auth[_0xbaee('0x9')](),controller[_0xbaee('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbaee('0xc')]);router['put'](_0xbaee('0xa'),auth[_0xbaee('0x9')](),controller[_0xbaee('0xd')]);router[_0xbaee('0xe')](_0xbaee('0xa'),auth[_0xbaee('0x9')](),controller['destroy']);module[_0xbaee('0xf')]=router; \ No newline at end of file +var _0xce4c=['./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xaf1c5f,_0x349e76){var _0x2a3ba6=function(_0x1e329a){while(--_0x1e329a){_0xaf1c5f['push'](_0xaf1c5f['shift']());}};_0x2a3ba6(++_0x349e76);}(_0xce4c,0x162));var _0xcce4=function(_0x46416c,_0x57d97e){_0x46416c=_0x46416c-0x0;var _0x2caeac=_0xce4c[_0x46416c];return _0x2caeac;};'use strict';var multer=require('multer');var util=require(_0xcce4('0x0'));var path=require(_0xcce4('0x1'));var timeout=require(_0xcce4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcce4('0x3'));var auth=require(_0xcce4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcce4('0x5'));var controller=require(_0xcce4('0x6'));router['get']('/',auth[_0xcce4('0x7')](),controller[_0xcce4('0x8')]);router[_0xcce4('0x9')](_0xcce4('0xa'),auth[_0xcce4('0x7')](),controller[_0xcce4('0xb')]);router[_0xcce4('0xc')]('/',auth[_0xcce4('0x7')](),controller[_0xcce4('0xd')]);router[_0xcce4('0xe')](_0xcce4('0xa'),auth[_0xcce4('0x7')](),controller[_0xcce4('0xf')]);router[_0xcce4('0x10')](_0xcce4('0xa'),auth[_0xcce4('0x7')](),controller[_0xcce4('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 e051020..4462470 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 _0xd442=['BOOLEAN','exports','STRING','name','setDataValue','getDataValue','options'];(function(_0x59ed64,_0x27d4e7){var _0x5b0e2e=function(_0x352739){while(--_0x352739){_0x59ed64['push'](_0x59ed64['shift']());}};_0x5b0e2e(++_0x27d4e7);}(_0xd442,0xe8));var _0x2d44=function(_0x39dc95,_0x364b0b){_0x39dc95=_0x39dc95-0x0;var _0xf05bf4=_0xd442[_0x39dc95];return _0xf05bf4;};'use strict';var Sequelize=require('sequelize');module[_0x2d44('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x2d44('0x1')],'unique':_0x2d44('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x2d44('0x1')],'set':function(_0x578041){this[_0x2d44('0x3')]('options',_0x578041?_0x578041['join'](''):[]);},'get':function(){return this[_0x2d44('0x4')](_0x2d44('0x5'))?this[_0x2d44('0x4')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x2d44('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x2d44('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2d44('0x1')]},'description':{'type':Sequelize[_0x2d44('0x1')]}}; \ No newline at end of file +var _0x903a=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x903a,0x195));var _0xa903=function(_0x42944e,_0x1b008d){_0x42944e=_0x42944e-0x0;var _0x4e7a1b=_0x903a[_0x42944e];return _0x4e7a1b;};'use strict';var Sequelize=require(_0xa903('0x0'));module[_0xa903('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xa903('0x2')],'unique':_0xa903('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xa903('0x2')],'set':function(_0x10a9ed){this[_0xa903('0x4')](_0xa903('0x5'),_0x10a9ed?_0x10a9ed[_0xa903('0x6')](''):[]);},'get':function(){return this[_0xa903('0x7')](_0xa903('0x5'))?this[_0xa903('0x7')]('options')[_0xa903('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xa903('0x2')]},'record':{'type':Sequelize[_0xa903('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa903('0x2')]},'description':{'type':Sequelize[_0xa903('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d722f4d..6b77a2e 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 _0x9755=['papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','ChanSpies','then','end','error','name','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x170994,_0x5adc66){var _0x3c89a3=function(_0x53e7e1){while(--_0x53e7e1){_0x170994['push'](_0x170994['shift']());}};_0x3c89a3(++_0x5adc66);}(_0x9755,0x1c6));var _0x5975=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x9755[_0x546aaf];return _0x1cbf6d;};'use strict';var emlformat=require(_0x5975('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5975('0x1'));var jsonpatch=require(_0x5975('0x2'));var rp=require(_0x5975('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5975('0x4'));var path=require(_0x5975('0x5'));var sox=require(_0x5975('0x6'));var csv=require(_0x5975('0x7'));var ejs=require(_0x5975('0x8'));var fs=require('fs');var fs_extra=require(_0x5975('0x9'));var _=require(_0x5975('0xa'));var squel=require('squel');var crypto=require(_0x5975('0xb'));var jsforce=require(_0x5975('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5975('0x7'));var querystring=require(_0x5975('0xd'));var Papa=require(_0x5975('0xe'));var Redis=require('ioredis');var authService=require(_0x5975('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5975('0x10'));var logger=require(_0x5975('0x11'))(_0x5975('0x12'));var utils=require('../../config/utils');var config=require(_0x5975('0x13'));var licenseUtil=require(_0x5975('0x14'));var db=require(_0x5975('0x15'))['db'];function respondWithStatusCode(_0x52bdaa,_0x119571){_0x119571=_0x119571||0xcc;return function(_0x2ad3ed){if(_0x2ad3ed){return _0x52bdaa[_0x5975('0x16')](_0x119571);}return _0x52bdaa[_0x5975('0x17')](_0x119571)['end']();};}function respondWithResult(_0x5e355a,_0x331385){_0x331385=_0x331385||0xc8;return function(_0x1543c5){if(_0x1543c5){return _0x5e355a[_0x5975('0x17')](_0x331385)['json'](_0x1543c5);}};}function respondWithFilteredResult(_0x1a3299,_0x4de825){return function(_0x145f39){if(_0x145f39){var _0x58da02=typeof _0x4de825[_0x5975('0x18')]===_0x5975('0x19')&&typeof _0x4de825[_0x5975('0x1a')]===_0x5975('0x19');var _0x25f2a0=_0x145f39[_0x5975('0x1b')];var _0x203829=_0x58da02?0x0:_0x4de825['offset'];var _0x4e6806=_0x58da02?_0x145f39['count']:_0x4de825['offset']+_0x4de825['limit'];var _0x296185;if(_0x4e6806>=_0x25f2a0){_0x4e6806=_0x25f2a0;_0x296185=0xc8;}else{_0x296185=0xce;}_0x1a3299['status'](_0x296185);return _0x1a3299[_0x5975('0x1c')](_0x5975('0x1d'),_0x203829+'-'+_0x4e6806+'/'+_0x25f2a0)[_0x5975('0x1e')](_0x145f39);}return null;};}function patchUpdates(_0x1977bb){return function(_0x5a9df3){try{jsonpatch[_0x5975('0x1f')](_0x5a9df3,_0x1977bb,!![]);}catch(_0x133e32){return BPromise[_0x5975('0x20')](_0x133e32);}return _0x5a9df3['save']();};}function saveUpdates(_0x34b195,_0xc916a8){return function(_0x1689e2){if(_0x1689e2){return _0x1689e2[_0x5975('0x21')](_0x34b195)['then'](function(_0x48d708){return _0x48d708;});}return null;};}function removeEntity(_0x1cef80,_0x2da6c8){return function(_0x504892){if(_0x504892){return _0x504892[_0x5975('0x22')]()['then'](function(){var _0x43e097=_0x504892['get']({'plain':!![]});var _0x5e8b5a=_0x5975('0x23');return db['UserProfileResource'][_0x5975('0x22')]({'where':{'type':_0x5e8b5a,'resourceId':_0x43e097['id']}})[_0x5975('0x24')](function(){return _0x504892;});})['then'](function(){_0x1cef80['status'](0xcc)[_0x5975('0x25')]();});}};}function handleEntityNotFound(_0x1c1551,_0x2932c1){return function(_0x154e1a){if(!_0x154e1a){_0x1c1551[_0x5975('0x16')](0x194);}return _0x154e1a;};}function handleError(_0x23e5d1,_0x161fe2){_0x161fe2=_0x161fe2||0x1f4;return function(_0x24ee17){logger[_0x5975('0x26')](_0x24ee17['stack']);if(_0x24ee17[_0x5975('0x27')]){delete _0x24ee17[_0x5975('0x27')];}_0x23e5d1[_0x5975('0x17')](_0x161fe2)['send'](_0x24ee17);};}exports[_0x5975('0x28')]=function(_0x5778f7,_0x4bfd10){var _0x2df91e={},_0x191376={},_0x3c6476={'count':0x0,'rows':[]};var _0x344e42=_[_0x5975('0x29')](db['VoiceChanSpy'][_0x5975('0x2a')],function(_0x57de92){return{'name':_0x57de92['fieldName'],'type':_0x57de92['type']['key']};});_0x191376[_0x5975('0x2b')]=_[_0x5975('0x29')](_0x344e42,_0x5975('0x27'));_0x191376[_0x5975('0x2c')]=_[_0x5975('0x2d')](_0x5778f7[_0x5975('0x2c')]);_0x191376[_0x5975('0x2e')]=_[_0x5975('0x2f')](_0x191376[_0x5975('0x2b')],_0x191376[_0x5975('0x2c')]);_0x2df91e[_0x5975('0x30')]=_[_0x5975('0x2f')](_0x191376[_0x5975('0x2b')],qs[_0x5975('0x31')](_0x5778f7[_0x5975('0x2c')][_0x5975('0x31')]));_0x2df91e[_0x5975('0x30')]=_0x2df91e[_0x5975('0x30')][_0x5975('0x32')]?_0x2df91e[_0x5975('0x30')]:_0x191376['model'];if(!_0x5778f7[_0x5975('0x2c')][_0x5975('0x33')]('nolimit')){_0x2df91e[_0x5975('0x1a')]=qs[_0x5975('0x1a')](_0x5778f7[_0x5975('0x2c')]['limit']);_0x2df91e[_0x5975('0x18')]=qs[_0x5975('0x18')](_0x5778f7[_0x5975('0x2c')]['offset']);}_0x2df91e[_0x5975('0x34')]=qs[_0x5975('0x35')](_0x5778f7[_0x5975('0x2c')]['sort']);_0x2df91e['where']=qs[_0x5975('0x2e')](_[_0x5975('0x36')](_0x5778f7['query'],_0x191376['filters']),_0x344e42);if(_0x5778f7['query'][_0x5975('0x37')]){_0x2df91e[_0x5975('0x38')]=_[_0x5975('0x39')](_0x2df91e[_0x5975('0x38')],{'$or':_[_0x5975('0x29')](_0x344e42,function(_0x55850b){if(_0x55850b[_0x5975('0x3a')]!==_0x5975('0x3b')){var _0x16c5c0={};_0x16c5c0[_0x55850b[_0x5975('0x27')]]={'$like':'%'+_0x5778f7[_0x5975('0x2c')]['filter']+'%'};return _0x16c5c0;}})});}_0x2df91e=_['merge']({},_0x2df91e,_0x5778f7['options']);var _0xa8d266={'where':_0x2df91e[_0x5975('0x38')]};return db[_0x5975('0x3c')]['count'](_0xa8d266)[_0x5975('0x24')](function(_0x1cff9f){_0x3c6476[_0x5975('0x1b')]=_0x1cff9f;if(_0x5778f7['query'][_0x5975('0x3d')]){_0x2df91e[_0x5975('0x3e')]=[{'all':!![]}];}return db[_0x5975('0x3c')][_0x5975('0x3f')](_0x2df91e);})['then'](function(_0x3cfb3a){_0x3c6476[_0x5975('0x40')]=_0x3cfb3a;return _0x3c6476;})[_0x5975('0x24')](respondWithFilteredResult(_0x4bfd10,_0x2df91e))[_0x5975('0x41')](handleError(_0x4bfd10,null));};exports[_0x5975('0x42')]=function(_0x468097,_0x2c309e){var _0x50485c={'raw':![],'where':{'id':_0x468097[_0x5975('0x43')]['id']}},_0xaa7afe={};_0xaa7afe['model']=_['keys'](db[_0x5975('0x3c')][_0x5975('0x2a')]);_0xaa7afe[_0x5975('0x2c')]=_['keys'](_0x468097[_0x5975('0x2c')]);_0xaa7afe['filters']=_[_0x5975('0x2f')](_0xaa7afe[_0x5975('0x2b')],_0xaa7afe[_0x5975('0x2c')]);_0x50485c[_0x5975('0x30')]=_[_0x5975('0x2f')](_0xaa7afe[_0x5975('0x2b')],qs[_0x5975('0x31')](_0x468097[_0x5975('0x2c')][_0x5975('0x31')]));_0x50485c[_0x5975('0x30')]=_0x50485c[_0x5975('0x30')][_0x5975('0x32')]?_0x50485c[_0x5975('0x30')]:_0xaa7afe['model'];if(_0x468097[_0x5975('0x2c')][_0x5975('0x3d')]){_0x50485c[_0x5975('0x3e')]=[{'all':!![]}];}_0x50485c=_[_0x5975('0x39')]({},_0x50485c,_0x468097[_0x5975('0x44')]);return db['VoiceChanSpy'][_0x5975('0x45')](_0x50485c)[_0x5975('0x24')](handleEntityNotFound(_0x2c309e,null))['then'](respondWithResult(_0x2c309e,null))[_0x5975('0x41')](handleError(_0x2c309e,null));};exports[_0x5975('0x46')]=function(_0x5045b1,_0x4214e8){return db['VoiceChanSpy'][_0x5975('0x46')](_0x5045b1[_0x5975('0x47')],{})[_0x5975('0x24')](function(_0xcb2f4a){var _0x581105=_0x5045b1[_0x5975('0x48')]['get']({'plain':!![]});if(!_0x581105)throw new Error(_0x5975('0x49'));if(_0x581105['role']===_0x5975('0x48')){var _0x135060=_0xcb2f4a['get']({'plain':!![]});var _0x66c009=_0x5975('0x23');return db[_0x5975('0x4a')][_0x5975('0x45')]({'where':{'name':_0x66c009,'userProfileId':_0x581105[_0x5975('0x4b')]},'raw':!![]})['then'](function(_0x131156){if(_0x131156&&_0x131156['autoAssociation']===0x0){return db[_0x5975('0x4c')]['create']({'name':_0x135060[_0x5975('0x27')],'resourceId':_0x135060['id'],'type':_0x131156['name'],'sectionId':_0x131156['id']},{})[_0x5975('0x24')](function(){return _0xcb2f4a;});}else{return _0xcb2f4a;}})[_0x5975('0x41')](function(_0x5972cc){logger[_0x5975('0x26')](_0x5975('0x4d'),_0x5972cc);throw _0x5972cc;});}return _0xcb2f4a;})[_0x5975('0x24')](respondWithResult(_0x4214e8,0xc9))[_0x5975('0x41')](handleError(_0x4214e8,null));};exports[_0x5975('0x21')]=function(_0x59548e,_0x1ab342){if(_0x59548e[_0x5975('0x47')]['id']){delete _0x59548e[_0x5975('0x47')]['id'];}return db[_0x5975('0x3c')][_0x5975('0x45')]({'where':{'id':_0x59548e[_0x5975('0x43')]['id']}})[_0x5975('0x24')](handleEntityNotFound(_0x1ab342,null))[_0x5975('0x24')](saveUpdates(_0x59548e[_0x5975('0x47')],null))['then'](respondWithResult(_0x1ab342,null))[_0x5975('0x41')](handleError(_0x1ab342,null));};exports['destroy']=function(_0x308853,_0x19fe1c){return db[_0x5975('0x3c')][_0x5975('0x45')]({'where':{'id':_0x308853[_0x5975('0x43')]['id']}})['then'](handleEntityNotFound(_0x19fe1c,null))[_0x5975('0x24')](removeEntity(_0x19fe1c,null))[_0x5975('0x41')](handleError(_0x19fe1c,null));}; \ No newline at end of file +var _0x7dc2=['keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','find','create','body','user','role','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x27dc('0x0'));var jsonpatch=require(_0x27dc('0x1'));var rp=require(_0x27dc('0x2'));var moment=require(_0x27dc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x27dc('0x4'));var util=require(_0x27dc('0x5'));var path=require('path');var sox=require(_0x27dc('0x6'));var csv=require(_0x27dc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27dc('0x8'));var _=require('lodash');var squel=require(_0x27dc('0x9'));var crypto=require(_0x27dc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x27dc('0xb'));var toCsv=require(_0x27dc('0x7'));var querystring=require(_0x27dc('0xc'));var Papa=require(_0x27dc('0xd'));var Redis=require('ioredis');var authService=require(_0x27dc('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x27dc('0xf'));var hardwareService=require(_0x27dc('0x10'));var logger=require(_0x27dc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x27dc('0x12'));var licenseUtil=require(_0x27dc('0x13'));var db=require(_0x27dc('0x14'))['db'];function respondWithStatusCode(_0x1c7a9e,_0x4d8afd){_0x4d8afd=_0x4d8afd||0xcc;return function(_0x2d7799){if(_0x2d7799){return _0x1c7a9e['sendStatus'](_0x4d8afd);}return _0x1c7a9e[_0x27dc('0x15')](_0x4d8afd)['end']();};}function respondWithResult(_0x1282f2,_0x22d9ac){_0x22d9ac=_0x22d9ac||0xc8;return function(_0x7972d8){if(_0x7972d8){return _0x1282f2[_0x27dc('0x15')](_0x22d9ac)['json'](_0x7972d8);}};}function respondWithFilteredResult(_0x110316,_0x1bd473){return function(_0x798f50){if(_0x798f50){var _0x4193f9=typeof _0x1bd473[_0x27dc('0x16')]==='undefined'&&typeof _0x1bd473[_0x27dc('0x17')]===_0x27dc('0x18');var _0x21f537=_0x798f50[_0x27dc('0x19')];var _0x5d308b=_0x4193f9?0x0:_0x1bd473[_0x27dc('0x16')];var _0x1ff9a2=_0x4193f9?_0x798f50[_0x27dc('0x19')]:_0x1bd473[_0x27dc('0x16')]+_0x1bd473[_0x27dc('0x17')];var _0x3dcfca;if(_0x1ff9a2>=_0x21f537){_0x1ff9a2=_0x21f537;_0x3dcfca=0xc8;}else{_0x3dcfca=0xce;}_0x110316[_0x27dc('0x15')](_0x3dcfca);return _0x110316[_0x27dc('0x1a')](_0x27dc('0x1b'),_0x5d308b+'-'+_0x1ff9a2+'/'+_0x21f537)[_0x27dc('0x1c')](_0x798f50);}return null;};}function patchUpdates(_0x5064d5){return function(_0x3b9afc){try{jsonpatch[_0x27dc('0x1d')](_0x3b9afc,_0x5064d5,!![]);}catch(_0x4bb946){return BPromise[_0x27dc('0x1e')](_0x4bb946);}return _0x3b9afc['save']();};}function saveUpdates(_0x5c0fca,_0x2843b1){return function(_0x4eddfe){if(_0x4eddfe){return _0x4eddfe[_0x27dc('0x1f')](_0x5c0fca)['then'](function(_0x4a7d2a){return _0x4a7d2a;});}return null;};}function removeEntity(_0x14fa88,_0x4a9da0){return function(_0x37917e){if(_0x37917e){return _0x37917e['destroy']()[_0x27dc('0x20')](function(){var _0x1eb83d=_0x37917e[_0x27dc('0x21')]({'plain':!![]});var _0x19db16='ChanSpies';return db[_0x27dc('0x22')]['destroy']({'where':{'type':_0x19db16,'resourceId':_0x1eb83d['id']}})['then'](function(){return _0x37917e;});})[_0x27dc('0x20')](function(){_0x14fa88[_0x27dc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x449610,_0xfe5817){return function(_0x2ac84c){if(!_0x2ac84c){_0x449610[_0x27dc('0x23')](0x194);}return _0x2ac84c;};}function handleError(_0x453dea,_0x548c23){_0x548c23=_0x548c23||0x1f4;return function(_0x76d54b){logger[_0x27dc('0x24')](_0x76d54b[_0x27dc('0x25')]);if(_0x76d54b[_0x27dc('0x26')]){delete _0x76d54b[_0x27dc('0x26')];}_0x453dea['status'](_0x548c23)[_0x27dc('0x27')](_0x76d54b);};}exports[_0x27dc('0x28')]=function(_0x4a2fe6,_0x14a8a1){var _0x2e837a={},_0x1ac11a={},_0xc4e71a={'count':0x0,'rows':[]};var _0x545918=_[_0x27dc('0x29')](db[_0x27dc('0x2a')][_0x27dc('0x2b')],function(_0x58fd4c){return{'name':_0x58fd4c[_0x27dc('0x2c')],'type':_0x58fd4c[_0x27dc('0x2d')][_0x27dc('0x2e')]};});_0x1ac11a[_0x27dc('0x2f')]=_['map'](_0x545918,_0x27dc('0x26'));_0x1ac11a[_0x27dc('0x30')]=_[_0x27dc('0x31')](_0x4a2fe6['query']);_0x1ac11a[_0x27dc('0x32')]=_[_0x27dc('0x33')](_0x1ac11a[_0x27dc('0x2f')],_0x1ac11a[_0x27dc('0x30')]);_0x2e837a[_0x27dc('0x34')]=_['intersection'](_0x1ac11a[_0x27dc('0x2f')],qs[_0x27dc('0x35')](_0x4a2fe6[_0x27dc('0x30')][_0x27dc('0x35')]));_0x2e837a[_0x27dc('0x34')]=_0x2e837a['attributes']['length']?_0x2e837a[_0x27dc('0x34')]:_0x1ac11a[_0x27dc('0x2f')];if(!_0x4a2fe6[_0x27dc('0x30')][_0x27dc('0x36')]('nolimit')){_0x2e837a['limit']=qs[_0x27dc('0x17')](_0x4a2fe6[_0x27dc('0x30')][_0x27dc('0x17')]);_0x2e837a['offset']=qs[_0x27dc('0x16')](_0x4a2fe6['query'][_0x27dc('0x16')]);}_0x2e837a['order']=qs[_0x27dc('0x37')](_0x4a2fe6[_0x27dc('0x30')][_0x27dc('0x37')]);_0x2e837a[_0x27dc('0x38')]=qs[_0x27dc('0x32')](_[_0x27dc('0x39')](_0x4a2fe6[_0x27dc('0x30')],_0x1ac11a[_0x27dc('0x32')]),_0x545918);if(_0x4a2fe6['query'][_0x27dc('0x3a')]){_0x2e837a[_0x27dc('0x38')]=_['merge'](_0x2e837a[_0x27dc('0x38')],{'$or':_[_0x27dc('0x29')](_0x545918,function(_0x320044){if(_0x320044['type']!==_0x27dc('0x3b')){var _0x8ad900={};_0x8ad900[_0x320044[_0x27dc('0x26')]]={'$like':'%'+_0x4a2fe6[_0x27dc('0x30')]['filter']+'%'};return _0x8ad900;}})});}_0x2e837a=_[_0x27dc('0x3c')]({},_0x2e837a,_0x4a2fe6[_0x27dc('0x3d')]);var _0x306330={'where':_0x2e837a[_0x27dc('0x38')]};return db[_0x27dc('0x2a')][_0x27dc('0x19')](_0x306330)['then'](function(_0x5066b5){_0xc4e71a['count']=_0x5066b5;if(_0x4a2fe6[_0x27dc('0x30')][_0x27dc('0x3e')]){_0x2e837a[_0x27dc('0x3f')]=[{'all':!![]}];}return db[_0x27dc('0x2a')]['findAll'](_0x2e837a);})['then'](function(_0x725244){_0xc4e71a['rows']=_0x725244;return _0xc4e71a;})[_0x27dc('0x20')](respondWithFilteredResult(_0x14a8a1,_0x2e837a))[_0x27dc('0x40')](handleError(_0x14a8a1,null));};exports[_0x27dc('0x41')]=function(_0x509dc9,_0x322350){var _0x2441c2={'raw':![],'where':{'id':_0x509dc9[_0x27dc('0x42')]['id']}},_0x25cd9e={};_0x25cd9e['model']=_[_0x27dc('0x31')](db[_0x27dc('0x2a')]['rawAttributes']);_0x25cd9e[_0x27dc('0x30')]=_[_0x27dc('0x31')](_0x509dc9[_0x27dc('0x30')]);_0x25cd9e[_0x27dc('0x32')]=_[_0x27dc('0x33')](_0x25cd9e[_0x27dc('0x2f')],_0x25cd9e[_0x27dc('0x30')]);_0x2441c2[_0x27dc('0x34')]=_[_0x27dc('0x33')](_0x25cd9e['model'],qs[_0x27dc('0x35')](_0x509dc9['query'][_0x27dc('0x35')]));_0x2441c2[_0x27dc('0x34')]=_0x2441c2[_0x27dc('0x34')][_0x27dc('0x43')]?_0x2441c2[_0x27dc('0x34')]:_0x25cd9e['model'];if(_0x509dc9[_0x27dc('0x30')][_0x27dc('0x3e')]){_0x2441c2[_0x27dc('0x3f')]=[{'all':!![]}];}_0x2441c2=_[_0x27dc('0x3c')]({},_0x2441c2,_0x509dc9[_0x27dc('0x3d')]);return db[_0x27dc('0x2a')][_0x27dc('0x44')](_0x2441c2)[_0x27dc('0x20')](handleEntityNotFound(_0x322350,null))[_0x27dc('0x20')](respondWithResult(_0x322350,null))['catch'](handleError(_0x322350,null));};exports['create']=function(_0x8db62d,_0x37517d){return db['VoiceChanSpy'][_0x27dc('0x45')](_0x8db62d[_0x27dc('0x46')],{})['then'](function(_0x4a828c){var _0x5bd8b6=_0x8db62d[_0x27dc('0x47')]['get']({'plain':!![]});if(!_0x5bd8b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bd8b6[_0x27dc('0x48')]===_0x27dc('0x47')){var _0x22f3df=_0x4a828c['get']({'plain':!![]});var _0x220ca3=_0x27dc('0x49');return db['UserProfileSection'][_0x27dc('0x44')]({'where':{'name':_0x220ca3,'userProfileId':_0x5bd8b6[_0x27dc('0x4a')]},'raw':!![]})['then'](function(_0x5a9d38){if(_0x5a9d38&&_0x5a9d38[_0x27dc('0x4b')]===0x0){return db[_0x27dc('0x22')][_0x27dc('0x45')]({'name':_0x22f3df[_0x27dc('0x26')],'resourceId':_0x22f3df['id'],'type':_0x5a9d38[_0x27dc('0x26')],'sectionId':_0x5a9d38['id']},{})['then'](function(){return _0x4a828c;});}else{return _0x4a828c;}})[_0x27dc('0x40')](function(_0x32143a){logger['error'](_0x27dc('0x4c'),_0x32143a);throw _0x32143a;});}return _0x4a828c;})[_0x27dc('0x20')](respondWithResult(_0x37517d,0xc9))['catch'](handleError(_0x37517d,null));};exports[_0x27dc('0x1f')]=function(_0x571f23,_0x32ee93){if(_0x571f23[_0x27dc('0x46')]['id']){delete _0x571f23['body']['id'];}return db[_0x27dc('0x2a')][_0x27dc('0x44')]({'where':{'id':_0x571f23[_0x27dc('0x42')]['id']}})[_0x27dc('0x20')](handleEntityNotFound(_0x32ee93,null))['then'](saveUpdates(_0x571f23['body'],null))[_0x27dc('0x20')](respondWithResult(_0x32ee93,null))[_0x27dc('0x40')](handleError(_0x32ee93,null));};exports['destroy']=function(_0x2736d6,_0x4b45ca){return db[_0x27dc('0x2a')][_0x27dc('0x44')]({'where':{'id':_0x2736d6['params']['id']}})[_0x27dc('0x20')](handleEntityNotFound(_0x4b45ca,null))[_0x27dc('0x20')](removeEntity(_0x4b45ca,null))[_0x27dc('0x40')](handleError(_0x4b45ca,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1d6fc8b..f50bea2 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 _0x83cd=['record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','options','StopMixMonitor','concat','internal','name','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','context','from-sip','format','%s%s','prefix','push','Set','chanspy'];(function(_0x2404ab,_0x1008c2){var _0x5edff9=function(_0x1644f6){while(--_0x1644f6){_0x2404ab['push'](_0x2404ab['shift']());}};_0x5edff9(++_0x1008c2);}(_0x83cd,0x1b0));var _0xd83c=function(_0x51968e,_0xbbc71c){_0x51968e=_0x51968e-0x0;var _0x5791bb=_0x83cd[_0x51968e];return _0x5791bb;};'use strict';var _=require(_0xd83c('0x0'));var util=require('util');var BPromise=require(_0xd83c('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x241ddc,_0x2788d9,_0x45cf09){var _0x441c0f=0x1;var _0x335c4e=[];var _0x19397d={'context':_0x2788d9[_0xd83c('0x2')]||_0xd83c('0x3'),'exten':util[_0xd83c('0x4')](_0xd83c('0x5'),_0x241ddc[_0xd83c('0x6')],_0x45cf09),'type':'system','isApp':![],'ChanSpyId':_0x241ddc['id'],'UserId':_0x2788d9['id']};_0x335c4e[_0xd83c('0x7')](_['merge']({'app':_0xd83c('0x8'),'appdata':util['format']('CDR(type)=%s',_0xd83c('0x9')),'priority':_0x441c0f++},_0x19397d));if(_0x241ddc[_0xd83c('0xa')]){_0x335c4e[_0xd83c('0x7')](_['merge']({'app':_0xd83c('0xb'),'appdata':util[_0xd83c('0x4')]('${UNIQUEID}.%s,a',_0x241ddc[_0xd83c('0xc')]),'priority':_0x441c0f++},_0x19397d));}if(_0x241ddc[_0xd83c('0xd')]){_0x335c4e['push'](_['merge']({'app':_0xd83c('0xe'),'appdata':_0x241ddc[_0xd83c('0xf')],'priority':_0x441c0f++},_0x19397d));}_0x335c4e['push'](_['merge']({'app':_0xd83c('0x10'),'appdata':util[_0xd83c('0x4')]('SIP/%s,%s',_0x2788d9['name'],_0x241ddc[_0xd83c('0x11')]?_0x241ddc[_0xd83c('0x11')]['join'](''):''),'priority':_0x441c0f++},_0x19397d));if(_0x241ddc['record']){_0x335c4e['push'](_['merge']({'app':_0xd83c('0x12'),'priority':_0x441c0f++},_0x19397d));}return _0x335c4e;};var getChanSpyApplications=function(_0x51b25b,_0x297de4){var _0x5ee5d2=[];for(var _0x44b42b=0x0,_0x3b53ab=0x1;_0x44b42b<_0x297de4['length'];_0x44b42b++,_0x3b53ab=0x1){_0x5ee5d2=_0x5ee5d2[_0xd83c('0x13')](getUserApplications(_0x51b25b,_0x297de4[_0x44b42b],_0x297de4[_0x44b42b][_0xd83c('0x14')]));if(_0x297de4[_0x44b42b][_0xd83c('0x14')]!=_0x297de4[_0x44b42b]['name']){_0x5ee5d2=_0x5ee5d2[_0xd83c('0x13')](getUserApplications(_0x51b25b,_0x297de4[_0x44b42b],_0x297de4[_0x44b42b][_0xd83c('0x15')]));}}return _0x5ee5d2;};var getChanSpyPromise=function(_0x1c2d9d,_0x5b9d77){return new BPromise(function(_0x3ee2d0,_0x43224e){return _0x1c2d9d[_0xd83c('0x16')][_0xd83c('0x17')]({'attributes':['id',_0xd83c('0x15'),_0xd83c('0x14')],'where':{'role':_0xd83c('0x18'),'chanspy':!![]},'raw':!![]})[_0xd83c('0x19')](function(_0x241b65){if(_0x241b65){return _0x3ee2d0(getChanSpyApplications(_0x5b9d77,_0x241b65));}return _0x3ee2d0([]);})[_0xd83c('0x1a')](function(_0x5c6a81){_0x43224e(_0x5c6a81);});});};module[_0xd83c('0x1b')]=function(_0x3bdd2f,_0x2bb477){var _0x5d935e=_0x3bdd2f[_0xd83c('0x1c')];return _0x3bdd2f['define'](_0xd83c('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x391f64,_0x27b11d,_0x248015){return getChanSpyPromise(_0x5d935e,_0x391f64)[_0xd83c('0x19')](function(_0x50d9cf){if(_0x50d9cf&&_0x50d9cf[_0xd83c('0x1e')]){return _0x5d935e[_0xd83c('0x1f')][_0xd83c('0x20')](_0x50d9cf);}})[_0xd83c('0x19')](function(){_0x248015();})['catch'](function(_0x3ce80){_0x248015(_0x3ce80);});},'afterUpdate':function(_0x1f274c,_0x496435,_0x12eeec){return _0x5d935e['VoiceExtension'][_0xd83c('0x21')]({'where':{'ChanSpyId':_0x1f274c['id']}})['then'](function(){return getChanSpyPromise(_0x5d935e,_0x1f274c);})[_0xd83c('0x19')](function(_0x35167b){if(_0x35167b&&_0x35167b[_0xd83c('0x1e')]){return _0x5d935e['VoiceExtension'][_0xd83c('0x20')](_0x35167b);}})[_0xd83c('0x19')](function(){_0x12eeec();})['catch'](function(_0x187911){_0x12eeec(_0x187911);});},'afterDestroy':function(_0x108fdc,_0x388b0d,_0x50be4b){return _0x5d935e[_0xd83c('0x1f')][_0xd83c('0x21')]({'where':{'ChanSpyId':_0x108fdc['id']}})['then'](function(){_0x50be4b();})[_0xd83c('0x1a')](function(_0x1f5626){_0x50be4b(_0x1f5626);});}}});}; \ No newline at end of file +var _0x0ab7=['internal','agent','then','exports','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','catch','destroy','length','VoiceExtension','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','SIP/%s,%s','name','options','join','StopMixMonitor','concat','User'];(function(_0xbc15d0,_0x392236){var _0x3fd35e=function(_0x481857){while(--_0x481857){_0xbc15d0['push'](_0xbc15d0['shift']());}};_0x3fd35e(++_0x392236);}(_0x0ab7,0xcb));var _0x70ab=function(_0xf13f62,_0x1fa2ec){_0xf13f62=_0xf13f62-0x0;var _0x5905e6=_0x0ab7[_0xf13f62];return _0x5905e6;};'use strict';var _=require(_0x70ab('0x0'));var util=require(_0x70ab('0x1'));var BPromise=require(_0x70ab('0x2'));var attributes=require(_0x70ab('0x3'));var getUserApplications=function(_0x32489d,_0x1dc749,_0x66d1b5){var _0x41ecc0=0x1;var _0xe161e7=[];var _0x5ccb5f={'context':_0x1dc749['context']||_0x70ab('0x4'),'exten':util[_0x70ab('0x5')](_0x70ab('0x6'),_0x32489d[_0x70ab('0x7')],_0x66d1b5),'type':_0x70ab('0x8'),'isApp':![],'ChanSpyId':_0x32489d['id'],'UserId':_0x1dc749['id']};_0xe161e7[_0x70ab('0x9')](_[_0x70ab('0xa')]({'app':_0x70ab('0xb'),'appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x41ecc0++},_0x5ccb5f));if(_0x32489d[_0x70ab('0xc')]){_0xe161e7[_0x70ab('0x9')](_[_0x70ab('0xa')]({'app':_0x70ab('0xd'),'appdata':util[_0x70ab('0x5')](_0x70ab('0xe'),_0x32489d[_0x70ab('0xf')]),'priority':_0x41ecc0++},_0x5ccb5f));}if(_0x32489d[_0x70ab('0x10')]){_0xe161e7[_0x70ab('0x9')](_[_0x70ab('0xa')]({'app':'Authenticate','appdata':_0x32489d[_0x70ab('0x11')],'priority':_0x41ecc0++},_0x5ccb5f));}_0xe161e7[_0x70ab('0x9')](_[_0x70ab('0xa')]({'app':'ChanSpy','appdata':util[_0x70ab('0x5')](_0x70ab('0x12'),_0x1dc749[_0x70ab('0x13')],_0x32489d[_0x70ab('0x14')]?_0x32489d['options'][_0x70ab('0x15')](''):''),'priority':_0x41ecc0++},_0x5ccb5f));if(_0x32489d[_0x70ab('0xc')]){_0xe161e7[_0x70ab('0x9')](_[_0x70ab('0xa')]({'app':_0x70ab('0x16'),'priority':_0x41ecc0++},_0x5ccb5f));}return _0xe161e7;};var getChanSpyApplications=function(_0x31f059,_0x2671d5){var _0x42ae5a=[];for(var _0x15c615=0x0,_0x10e7a7=0x1;_0x15c615<_0x2671d5['length'];_0x15c615++,_0x10e7a7=0x1){_0x42ae5a=_0x42ae5a[_0x70ab('0x17')](getUserApplications(_0x31f059,_0x2671d5[_0x15c615],_0x2671d5[_0x15c615]['internal']));if(_0x2671d5[_0x15c615]['internal']!=_0x2671d5[_0x15c615]['name']){_0x42ae5a=_0x42ae5a[_0x70ab('0x17')](getUserApplications(_0x31f059,_0x2671d5[_0x15c615],_0x2671d5[_0x15c615][_0x70ab('0x13')]));}}return _0x42ae5a;};var getChanSpyPromise=function(_0x277727,_0x2049bb){return new BPromise(function(_0x3167bc,_0x52d5ad){return _0x277727[_0x70ab('0x18')]['findAll']({'attributes':['id',_0x70ab('0x13'),_0x70ab('0x19')],'where':{'role':_0x70ab('0x1a'),'chanspy':!![]},'raw':!![]})[_0x70ab('0x1b')](function(_0x42bd05){if(_0x42bd05){return _0x3167bc(getChanSpyApplications(_0x2049bb,_0x42bd05));}return _0x3167bc([]);})['catch'](function(_0x5ec19c){_0x52d5ad(_0x5ec19c);});});};module[_0x70ab('0x1c')]=function(_0x366754,_0x39ab53){var _0xc65d6a=_0x366754[_0x70ab('0x1d')];return _0x366754[_0x70ab('0x1e')](_0x70ab('0x1f'),attributes,{'tableName':_0x70ab('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x32b42a,_0xc13247,_0x2f8eea){return getChanSpyPromise(_0xc65d6a,_0x32b42a)[_0x70ab('0x1b')](function(_0x21f0d8){if(_0x21f0d8&&_0x21f0d8['length']){return _0xc65d6a['VoiceExtension'][_0x70ab('0x21')](_0x21f0d8);}})[_0x70ab('0x1b')](function(){_0x2f8eea();})[_0x70ab('0x22')](function(_0x342a95){_0x2f8eea(_0x342a95);});},'afterUpdate':function(_0x279604,_0x3ab502,_0x2f6b32){return _0xc65d6a['VoiceExtension'][_0x70ab('0x23')]({'where':{'ChanSpyId':_0x279604['id']}})[_0x70ab('0x1b')](function(){return getChanSpyPromise(_0xc65d6a,_0x279604);})[_0x70ab('0x1b')](function(_0x3b1a78){if(_0x3b1a78&&_0x3b1a78[_0x70ab('0x24')]){return _0xc65d6a['VoiceExtension'][_0x70ab('0x21')](_0x3b1a78);}})[_0x70ab('0x1b')](function(){_0x2f6b32();})[_0x70ab('0x22')](function(_0x222082){_0x2f6b32(_0x222082);});},'afterDestroy':function(_0x496d95,_0x575cd9,_0x1bb66b){return _0xc65d6a[_0x70ab('0x25')][_0x70ab('0x23')]({'where':{'ChanSpyId':_0x496d95['id']}})[_0x70ab('0x1b')](function(){_0x1bb66b();})[_0x70ab('0x22')](function(_0x54e2f1){_0x1bb66b(_0x54e2f1);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 100c9f9..c32e7f1 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 _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x52e5af,_0x55ff9e){var _0x48fd81=function(_0x5123dd){while(--_0x5123dd){_0x52e5af['push'](_0x52e5af['shift']());}};_0x48fd81(++_0x55ff9e);}(_0xb469,0x13b));var _0x9b46=function(_0xe96840,_0x564295){_0xe96840=_0xe96840-0x0;var _0x1c68b3=_0xb469[_0xe96840];return _0x1c68b3;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file +var _0xf109=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x219596,_0x5118b3){var _0x6df62c=function(_0xb9d9b3){while(--_0xb9d9b3){_0x219596['push'](_0x219596['shift']());}};_0x6df62c(++_0x5118b3);}(_0xf109,0xce));var _0x9f10=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xf109[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e0a9195..93c6e4e 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 _0x8033=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xfafac3,_0x3e117){var _0x2f5094=function(_0x26ebb3){while(--_0x26ebb3){_0xfafac3['push'](_0xfafac3['shift']());}};_0x2f5094(++_0x3e117);}(_0x8033,0x1b1));var _0x3803=function(_0xe5b4cc,_0x594bd1){_0xe5b4cc=_0xe5b4cc-0x0;var _0x28b99a=_0x8033[_0xe5b4cc];return _0x28b99a;};'use strict';var multer=require(_0x3803('0x0'));var util=require(_0x3803('0x1'));var path=require(_0x3803('0x2'));var timeout=require(_0x3803('0x3'));var express=require(_0x3803('0x4'));var router=express[_0x3803('0x5')]();var fs_extra=require(_0x3803('0x6'));var auth=require(_0x3803('0x7'));var interaction=require(_0x3803('0x8'));var config=require(_0x3803('0x9'));var controller=require(_0x3803('0xa'));router[_0x3803('0xb')]('/',auth[_0x3803('0xc')](),controller[_0x3803('0xd')]);router[_0x3803('0xb')]('/:id',auth[_0x3803('0xc')](),controller[_0x3803('0xe')]);router[_0x3803('0xf')]('/',auth[_0x3803('0xc')](),controller[_0x3803('0x10')]);router[_0x3803('0x11')](_0x3803('0x12'),auth[_0x3803('0xc')](),controller[_0x3803('0x13')]);router['delete'](_0x3803('0x12'),auth['isAuthenticated'](),controller[_0x3803('0x14')]);module[_0x3803('0x15')]=router; \ No newline at end of file +var _0x015b=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x015b,0x17b));var _0xb015=function(_0x216008,_0x2d1023){_0x216008=_0x216008-0x0;var _0x4d384f=_0x015b[_0x216008];return _0x4d384f;};'use strict';var multer=require('multer');var util=require(_0xb015('0x0'));var path=require(_0xb015('0x1'));var timeout=require(_0xb015('0x2'));var express=require(_0xb015('0x3'));var router=express[_0xb015('0x4')]();var fs_extra=require(_0xb015('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb015('0x6'));var config=require(_0xb015('0x7'));var controller=require(_0xb015('0x8'));router[_0xb015('0x9')]('/',auth[_0xb015('0xa')](),controller[_0xb015('0xb')]);router['get'](_0xb015('0xc'),auth[_0xb015('0xa')](),controller['show']);router[_0xb015('0xd')]('/',auth['isAuthenticated'](),controller[_0xb015('0xe')]);router[_0xb015('0xf')](_0xb015('0xc'),auth[_0xb015('0xa')](),controller[_0xb015('0x10')]);router[_0xb015('0x11')]('/:id',auth[_0xb015('0xa')](),controller[_0xb015('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 27ee7e9..3314f06 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x313b=['STRING','sequelize','exports'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x313b,0x151));var _0xb313=function(_0x1342aa,_0x3ed204){_0x1342aa=_0x1342aa-0x0;var _0x242a80=_0x313b[_0x1342aa];return _0x242a80;};'use strict';var Sequelize=require(_0xb313('0x0'));module[_0xb313('0x1')]={'name':{'type':Sequelize[_0xb313('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index aab742f..cfa1a74 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 _0xe6e2=['writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','render','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','status','end','json','offset','limit','undefined','count','apply','reject','update','destroy','get','UserProfileResource','stack','name','index','VoiceContext','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','find','create','body','readFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Contexts','userProfileId','join','root','server/files/templates/context.ejs','utf8'];(function(_0x5cde52,_0x3934b0){var _0x520c0b=function(_0x5ee423){while(--_0x5ee423){_0x5cde52['push'](_0x5cde52['shift']());}};_0x520c0b(++_0x3934b0);}(_0xe6e2,0x193));var _0x2e6e=function(_0x41adbf,_0x2f2d94){_0x41adbf=_0x41adbf-0x0;var _0x2f4a27=_0xe6e2[_0x41adbf];return _0x2f4a27;};'use strict';var emlformat=require(_0x2e6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e6e('0x1'));var jsonpatch=require(_0x2e6e('0x2'));var rp=require(_0x2e6e('0x3'));var moment=require(_0x2e6e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e6e('0x5'));var path=require(_0x2e6e('0x6'));var sox=require('sox');var csv=require(_0x2e6e('0x7'));var ejs=require(_0x2e6e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2e6e('0x9'));var deskjs=require(_0x2e6e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2e6e('0xb'));var Papa=require(_0x2e6e('0xc'));var Redis=require(_0x2e6e('0xd'));var authService=require(_0x2e6e('0xe'));var qs=require(_0x2e6e('0xf'));var as=require(_0x2e6e('0x10'));var hardwareService=require(_0x2e6e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2e6e('0x12'));var config=require(_0x2e6e('0x13'));var licenseUtil=require(_0x2e6e('0x14'));var db=require(_0x2e6e('0x15'))['db'];var jayson=require(_0x2e6e('0x16'));var client=jayson[_0x2e6e('0x17')][_0x2e6e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2eedca,_0x415560,_0xa83ce1,_0xd51fd8){return new BPromise(function(_0x116240,_0x2214a0){var _0x88ceb5=_0xd51fd8||client;return _0x88ceb5[_0x2e6e('0x19')](_0x2eedca,_0xa83ce1)[_0x2e6e('0x1a')](function(_0x4455b2){logger['info']('VoiceContext,\x20%s,\x20%s',_0x415560,_0x2e6e('0x1b'));logger[_0x2e6e('0x1c')](_0x2e6e('0x1d'),_0x415560,_0x2e6e('0x1b'),JSON[_0x2e6e('0x1e')](_0x4455b2));if(_0x4455b2[_0x2e6e('0x1f')]){if(_0x4455b2[_0x2e6e('0x1f')][_0x2e6e('0x20')]===0x1f4){logger[_0x2e6e('0x1f')](_0x2e6e('0x21'),_0x415560,_0x4455b2[_0x2e6e('0x1f')][_0x2e6e('0x22')]);return _0x2214a0(_0x4455b2[_0x2e6e('0x1f')][_0x2e6e('0x22')]);}logger[_0x2e6e('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x415560,_0x4455b2['error'][_0x2e6e('0x22')]);return _0x116240(_0x4455b2[_0x2e6e('0x1f')][_0x2e6e('0x22')]);}else{logger[_0x2e6e('0x23')]('VoiceContext,\x20%s,\x20%s',_0x415560,_0x2e6e('0x1b'));_0x116240(_0x4455b2[_0x2e6e('0x24')][_0x2e6e('0x22')]);}})[_0x2e6e('0x25')](function(_0x875f49){logger[_0x2e6e('0x1f')](_0x2e6e('0x21'),_0x415560,_0x875f49);_0x2214a0(_0x875f49);});});}function respondWithStatusCode(_0x4c082c,_0x46eeab){_0x46eeab=_0x46eeab||0xcc;return function(_0x3fe9c5){if(_0x3fe9c5){return _0x4c082c['sendStatus'](_0x46eeab);}return _0x4c082c[_0x2e6e('0x26')](_0x46eeab)[_0x2e6e('0x27')]();};}function respondWithResult(_0x369f00,_0x23628c){_0x23628c=_0x23628c||0xc8;return function(_0x54673e){if(_0x54673e){return _0x369f00['status'](_0x23628c)[_0x2e6e('0x28')](_0x54673e);}};}function respondWithFilteredResult(_0x362de8,_0x2262f3){return function(_0x5ea141){if(_0x5ea141){var _0x5e8b32=typeof _0x2262f3[_0x2e6e('0x29')]==='undefined'&&typeof _0x2262f3[_0x2e6e('0x2a')]===_0x2e6e('0x2b');var _0x26fd12=_0x5ea141['count'];var _0x32e306=_0x5e8b32?0x0:_0x2262f3[_0x2e6e('0x29')];var _0x3ebf0d=_0x5e8b32?_0x5ea141[_0x2e6e('0x2c')]:_0x2262f3['offset']+_0x2262f3[_0x2e6e('0x2a')];var _0x585200;if(_0x3ebf0d>=_0x26fd12){_0x3ebf0d=_0x26fd12;_0x585200=0xc8;}else{_0x585200=0xce;}_0x362de8[_0x2e6e('0x26')](_0x585200);return _0x362de8['set']('Content-Range',_0x32e306+'-'+_0x3ebf0d+'/'+_0x26fd12)[_0x2e6e('0x28')](_0x5ea141);}return null;};}function patchUpdates(_0x566867){return function(_0x10ef33){try{jsonpatch[_0x2e6e('0x2d')](_0x10ef33,_0x566867,!![]);}catch(_0x54d831){return BPromise[_0x2e6e('0x2e')](_0x54d831);}return _0x10ef33['save']();};}function saveUpdates(_0x35c4af,_0x13dcd2){return function(_0x45c513){if(_0x45c513){return _0x45c513[_0x2e6e('0x2f')](_0x35c4af)[_0x2e6e('0x1a')](function(_0x4d1b67){return _0x4d1b67;});}return null;};}function removeEntity(_0x3c6cd6,_0x1795eb){return function(_0x49d9e8){if(_0x49d9e8){return _0x49d9e8[_0x2e6e('0x30')]()['then'](function(){var _0x703639=_0x49d9e8[_0x2e6e('0x31')]({'plain':!![]});var _0x14d12c='Contexts';return db[_0x2e6e('0x32')][_0x2e6e('0x30')]({'where':{'type':_0x14d12c,'resourceId':_0x703639['id']}})['then'](function(){return _0x49d9e8;});})[_0x2e6e('0x1a')](function(){_0x3c6cd6[_0x2e6e('0x26')](0xcc)[_0x2e6e('0x27')]();});}};}function handleEntityNotFound(_0x2f4019,_0x5e6aa7){return function(_0x3c185e){if(!_0x3c185e){_0x2f4019['sendStatus'](0x194);}return _0x3c185e;};}function handleError(_0x2da959,_0x46f72c){_0x46f72c=_0x46f72c||0x1f4;return function(_0xcdfc4a){logger[_0x2e6e('0x1f')](_0xcdfc4a[_0x2e6e('0x33')]);if(_0xcdfc4a[_0x2e6e('0x34')]){delete _0xcdfc4a['name'];}_0x2da959['status'](_0x46f72c)['send'](_0xcdfc4a);};}exports[_0x2e6e('0x35')]=function(_0x20a259,_0x2474d2){var _0x50d4ba={},_0x1fd6d2={},_0x1bb27f={'count':0x0,'rows':[]};var _0x8397b6=_['map'](db[_0x2e6e('0x36')][_0x2e6e('0x37')],function(_0x45feca){return{'name':_0x45feca['fieldName'],'type':_0x45feca[_0x2e6e('0x38')][_0x2e6e('0x39')]};});_0x1fd6d2['model']=_[_0x2e6e('0x3a')](_0x8397b6,'name');_0x1fd6d2[_0x2e6e('0x3b')]=_[_0x2e6e('0x3c')](_0x20a259[_0x2e6e('0x3b')]);_0x1fd6d2[_0x2e6e('0x3d')]=_[_0x2e6e('0x3e')](_0x1fd6d2[_0x2e6e('0x3f')],_0x1fd6d2[_0x2e6e('0x3b')]);_0x50d4ba['attributes']=_[_0x2e6e('0x3e')](_0x1fd6d2[_0x2e6e('0x3f')],qs['fields'](_0x20a259[_0x2e6e('0x3b')][_0x2e6e('0x40')]));_0x50d4ba[_0x2e6e('0x41')]=_0x50d4ba['attributes']['length']?_0x50d4ba['attributes']:_0x1fd6d2[_0x2e6e('0x3f')];if(!_0x20a259['query'][_0x2e6e('0x42')](_0x2e6e('0x43'))){_0x50d4ba[_0x2e6e('0x2a')]=qs[_0x2e6e('0x2a')](_0x20a259[_0x2e6e('0x3b')][_0x2e6e('0x2a')]);_0x50d4ba[_0x2e6e('0x29')]=qs[_0x2e6e('0x29')](_0x20a259[_0x2e6e('0x3b')]['offset']);}_0x50d4ba[_0x2e6e('0x44')]=qs['sort'](_0x20a259[_0x2e6e('0x3b')][_0x2e6e('0x45')]);_0x50d4ba[_0x2e6e('0x46')]=qs[_0x2e6e('0x3d')](_[_0x2e6e('0x47')](_0x20a259[_0x2e6e('0x3b')],_0x1fd6d2[_0x2e6e('0x3d')]),_0x8397b6);if(_0x20a259['query'][_0x2e6e('0x48')]){_0x50d4ba[_0x2e6e('0x46')]=_[_0x2e6e('0x49')](_0x50d4ba[_0x2e6e('0x46')],{'$or':_[_0x2e6e('0x3a')](_0x8397b6,function(_0x83a394){if(_0x83a394[_0x2e6e('0x38')]!==_0x2e6e('0x4a')){var _0x1c6fcf={};_0x1c6fcf[_0x83a394[_0x2e6e('0x34')]]={'$like':'%'+_0x20a259[_0x2e6e('0x3b')]['filter']+'%'};return _0x1c6fcf;}})});}_0x50d4ba=_[_0x2e6e('0x49')]({},_0x50d4ba,_0x20a259[_0x2e6e('0x4b')]);var _0x446ab8={'where':_0x50d4ba[_0x2e6e('0x46')]};return db[_0x2e6e('0x36')][_0x2e6e('0x2c')](_0x446ab8)[_0x2e6e('0x1a')](function(_0x5a6001){_0x1bb27f[_0x2e6e('0x2c')]=_0x5a6001;if(_0x20a259[_0x2e6e('0x3b')]['includeAll']){_0x50d4ba[_0x2e6e('0x4c')]=[{'all':!![]}];}return db[_0x2e6e('0x36')][_0x2e6e('0x4d')](_0x50d4ba);})['then'](function(_0x5dbbd1){_0x1bb27f[_0x2e6e('0x4e')]=_0x5dbbd1;return _0x1bb27f;})[_0x2e6e('0x1a')](respondWithFilteredResult(_0x2474d2,_0x50d4ba))[_0x2e6e('0x25')](handleError(_0x2474d2,null));};exports['show']=function(_0x614955,_0x3a5b7d){var _0x31c13f={'raw':![],'where':{'id':_0x614955[_0x2e6e('0x4f')]['id']}},_0x37fc77={};_0x37fc77[_0x2e6e('0x3f')]=_['keys'](db[_0x2e6e('0x36')]['rawAttributes']);_0x37fc77[_0x2e6e('0x3b')]=_[_0x2e6e('0x3c')](_0x614955[_0x2e6e('0x3b')]);_0x37fc77[_0x2e6e('0x3d')]=_['intersection'](_0x37fc77[_0x2e6e('0x3f')],_0x37fc77[_0x2e6e('0x3b')]);_0x31c13f[_0x2e6e('0x41')]=_[_0x2e6e('0x3e')](_0x37fc77[_0x2e6e('0x3f')],qs[_0x2e6e('0x40')](_0x614955[_0x2e6e('0x3b')][_0x2e6e('0x40')]));_0x31c13f[_0x2e6e('0x41')]=_0x31c13f[_0x2e6e('0x41')][_0x2e6e('0x50')]?_0x31c13f['attributes']:_0x37fc77[_0x2e6e('0x3f')];if(_0x614955['query'][_0x2e6e('0x51')]){_0x31c13f[_0x2e6e('0x4c')]=[{'all':!![]}];}_0x31c13f=_[_0x2e6e('0x49')]({},_0x31c13f,_0x614955[_0x2e6e('0x4b')]);return db[_0x2e6e('0x36')][_0x2e6e('0x52')](_0x31c13f)[_0x2e6e('0x1a')](handleEntityNotFound(_0x3a5b7d,null))[_0x2e6e('0x1a')](respondWithResult(_0x3a5b7d,null))['catch'](handleError(_0x3a5b7d,null));};exports[_0x2e6e('0x53')]=function(_0x2f3fb9,_0x56b23f,_0x42c462){var _0x253a1c;return db[_0x2e6e('0x36')]['create'](_0x2f3fb9[_0x2e6e('0x54')],{'raw':!![]})[_0x2e6e('0x1a')](function(_0x306184){_0x253a1c=_0x306184;return db[_0x2e6e('0x36')][_0x2e6e('0x4d')]({'raw':!![]});})[_0x2e6e('0x1a')](function(_0x1002da){var _0x35294b=fs[_0x2e6e('0x55')](path['join'](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x28fe12=ejs['render'](_0x35294b,{'contexts':_0x1002da||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x28fe12);})[_0x2e6e('0x1a')](function(){return respondWithRpcPromise(_0x2e6e('0x56'),_0x2e6e('0x53'),{'module':_0x2e6e('0x57')});})[_0x2e6e('0x1a')](function(){var _0x55840f=_0x2f3fb9[_0x2e6e('0x58')][_0x2e6e('0x31')]({'plain':!![]});if(!_0x55840f)throw new Error(_0x2e6e('0x59'));if(_0x55840f[_0x2e6e('0x5a')]==='user'){var _0x4cce29=_0x253a1c[_0x2e6e('0x31')]({'plain':!![]});return db['UserProfileSection'][_0x2e6e('0x52')]({'where':{'name':_0x2e6e('0x5b'),'userProfileId':_0x55840f[_0x2e6e('0x5c')]},'raw':!![]})['then'](function(_0x85c3af){if(_0x85c3af&&_0x85c3af['autoAssociation']===0x0){return db[_0x2e6e('0x32')][_0x2e6e('0x53')]({'name':_0x4cce29[_0x2e6e('0x34')],'resourceId':_0x4cce29['id'],'type':_0x85c3af[_0x2e6e('0x34')],'sectionId':_0x85c3af['id']},{})['then'](function(){return _0x253a1c;});}else{return _0x253a1c;}})[_0x2e6e('0x25')](function(_0x29650a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29650a);throw _0x29650a;});}return _0x253a1c;})['then'](respondWithResult(_0x56b23f,0xc9))['catch'](handleError(_0x56b23f,null));};exports['update']=function(_0x2a8f84,_0x234650,_0x24201f){var _0x4a23a6;return db['VoiceContext'][_0x2e6e('0x52')]({'where':{'id':_0x2a8f84[_0x2e6e('0x4f')]['id']}})[_0x2e6e('0x1a')](handleEntityNotFound(_0x234650,null))[_0x2e6e('0x1a')](saveUpdates(_0x2a8f84[_0x2e6e('0x54')],null))[_0x2e6e('0x1a')](function(_0x2dd8fc){if(_0x2dd8fc){_0x4a23a6=_0x2dd8fc;return db['VoiceContext'][_0x2e6e('0x4d')]({'raw':!![]});}})[_0x2e6e('0x1a')](function(_0x28c741){var _0x2ad407=fs[_0x2e6e('0x55')](path[_0x2e6e('0x5d')](config[_0x2e6e('0x5e')],_0x2e6e('0x5f')),_0x2e6e('0x60'));var _0x1dce91=ejs['render'](_0x2ad407,{'contexts':_0x28c741||[]});fs[_0x2e6e('0x61')](_0x2e6e('0x62'),_0x1dce91);})[_0x2e6e('0x1a')](function(){return respondWithRpcPromise(_0x2e6e('0x56'),'update',{'module':_0x2e6e('0x57')});})[_0x2e6e('0x1a')](function(){return _0x4a23a6;})[_0x2e6e('0x1a')](respondWithResult(_0x234650,null))[_0x2e6e('0x25')](handleError(_0x234650,null));};exports[_0x2e6e('0x30')]=function(_0x1d1782,_0x566ae2,_0x3e7da6){var _0x3a7416;return db[_0x2e6e('0x36')][_0x2e6e('0x52')]({'where':{'id':_0x1d1782[_0x2e6e('0x4f')]['id']}})[_0x2e6e('0x1a')](handleEntityNotFound(_0x566ae2,null))[_0x2e6e('0x1a')](removeEntity(_0x566ae2,null))[_0x2e6e('0x1a')](function(){return db[_0x2e6e('0x36')][_0x2e6e('0x4d')]({'raw':!![]});})[_0x2e6e('0x1a')](function(_0x5086e3){var _0x7b6b74=fs['readFileSync'](path['join'](config[_0x2e6e('0x5e')],_0x2e6e('0x5f')),_0x2e6e('0x60'));var _0x192e52=ejs[_0x2e6e('0x63')](_0x7b6b74,{'contexts':_0x5086e3});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x192e52);return respondWithRpcPromise('Reload','destroy',{'module':_0x2e6e('0x57')});})['catch'](handleError(_0x566ae2,null));}; \ No newline at end of file +var _0x179c=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','UserProfileResource','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','length','find','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','autoAssociation'];(function(_0x76dcc5,_0x276beb){var _0x587642=function(_0x4a80d2){while(--_0x4a80d2){_0x76dcc5['push'](_0x76dcc5['shift']());}};_0x587642(++_0x276beb);}(_0x179c,0x144));var _0xc179=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x179c[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require(_0xc179('0x0'));var rimraf=require(_0xc179('0x1'));var zipdir=require(_0xc179('0x2'));var jsonpatch=require(_0xc179('0x3'));var rp=require(_0xc179('0x4'));var moment=require(_0xc179('0x5'));var BPromise=require(_0xc179('0x6'));var Mustache=require(_0xc179('0x7'));var util=require(_0xc179('0x8'));var path=require(_0xc179('0x9'));var sox=require(_0xc179('0xa'));var csv=require(_0xc179('0xb'));var ejs=require(_0xc179('0xc'));var fs=require('fs');var fs_extra=require(_0xc179('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc179('0xe'));var jsforce=require(_0xc179('0xf'));var deskjs=require(_0xc179('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc179('0x11'));var Redis=require(_0xc179('0x12'));var authService=require(_0xc179('0x13'));var qs=require(_0xc179('0x14'));var as=require(_0xc179('0x15'));var hardwareService=require(_0xc179('0x16'));var logger=require('../../config/logger')(_0xc179('0x17'));var utils=require(_0xc179('0x18'));var config=require(_0xc179('0x19'));var licenseUtil=require(_0xc179('0x1a'));var db=require(_0xc179('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c071f,_0x577d6e,_0x1c4fe9,_0x4d8985){return new BPromise(function(_0x504d0c,_0xe46cae){var _0x442ce6=_0x4d8985||client;return _0x442ce6[_0xc179('0x1c')](_0x1c071f,_0x1c4fe9)[_0xc179('0x1d')](function(_0x2368e0){logger[_0xc179('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x577d6e,_0xc179('0x1f'));logger[_0xc179('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x577d6e,_0xc179('0x1f'),JSON[_0xc179('0x21')](_0x2368e0));if(_0x2368e0[_0xc179('0x22')]){if(_0x2368e0[_0xc179('0x22')][_0xc179('0x23')]===0x1f4){logger['error'](_0xc179('0x24'),_0x577d6e,_0x2368e0[_0xc179('0x22')][_0xc179('0x25')]);return _0xe46cae(_0x2368e0[_0xc179('0x22')]['message']);}logger[_0xc179('0x22')]('VoiceContext,\x20%s,\x20%s',_0x577d6e,_0x2368e0[_0xc179('0x22')][_0xc179('0x25')]);return _0x504d0c(_0x2368e0[_0xc179('0x22')][_0xc179('0x25')]);}else{logger['info'](_0xc179('0x24'),_0x577d6e,'request\x20sent');_0x504d0c(_0x2368e0[_0xc179('0x26')]['message']);}})['catch'](function(_0x33e333){logger[_0xc179('0x22')](_0xc179('0x24'),_0x577d6e,_0x33e333);_0xe46cae(_0x33e333);});});}function respondWithStatusCode(_0x179798,_0x463eea){_0x463eea=_0x463eea||0xcc;return function(_0x478608){if(_0x478608){return _0x179798[_0xc179('0x27')](_0x463eea);}return _0x179798[_0xc179('0x28')](_0x463eea)[_0xc179('0x29')]();};}function respondWithResult(_0x2f62dc,_0x4aaa31){_0x4aaa31=_0x4aaa31||0xc8;return function(_0xe6157b){if(_0xe6157b){return _0x2f62dc[_0xc179('0x28')](_0x4aaa31)[_0xc179('0x2a')](_0xe6157b);}};}function respondWithFilteredResult(_0x236215,_0x2dbe28){return function(_0x17221e){if(_0x17221e){var _0xa665ca=typeof _0x2dbe28[_0xc179('0x2b')]===_0xc179('0x2c')&&typeof _0x2dbe28[_0xc179('0x2d')]===_0xc179('0x2c');var _0x361387=_0x17221e[_0xc179('0x2e')];var _0x83766f=_0xa665ca?0x0:_0x2dbe28['offset'];var _0x4f8113=_0xa665ca?_0x17221e[_0xc179('0x2e')]:_0x2dbe28['offset']+_0x2dbe28[_0xc179('0x2d')];var _0x3938cf;if(_0x4f8113>=_0x361387){_0x4f8113=_0x361387;_0x3938cf=0xc8;}else{_0x3938cf=0xce;}_0x236215[_0xc179('0x28')](_0x3938cf);return _0x236215['set'](_0xc179('0x2f'),_0x83766f+'-'+_0x4f8113+'/'+_0x361387)[_0xc179('0x2a')](_0x17221e);}return null;};}function patchUpdates(_0x17d692){return function(_0x5ca85d){try{jsonpatch[_0xc179('0x30')](_0x5ca85d,_0x17d692,!![]);}catch(_0x226c7e){return BPromise[_0xc179('0x31')](_0x226c7e);}return _0x5ca85d[_0xc179('0x32')]();};}function saveUpdates(_0x1bdff6,_0xfdd60f){return function(_0x39a853){if(_0x39a853){return _0x39a853['update'](_0x1bdff6)[_0xc179('0x1d')](function(_0x747163){return _0x747163;});}return null;};}function removeEntity(_0x361d6e,_0x1f0160){return function(_0x1a0414){if(_0x1a0414){return _0x1a0414['destroy']()[_0xc179('0x1d')](function(){var _0x27ede4=_0x1a0414['get']({'plain':!![]});var _0x103993='Contexts';return db[_0xc179('0x33')][_0xc179('0x34')]({'where':{'type':_0x103993,'resourceId':_0x27ede4['id']}})['then'](function(){return _0x1a0414;});})['then'](function(){_0x361d6e[_0xc179('0x28')](0xcc)[_0xc179('0x29')]();});}};}function handleEntityNotFound(_0x402dc7,_0x1bba81){return function(_0x2f5f81){if(!_0x2f5f81){_0x402dc7[_0xc179('0x27')](0x194);}return _0x2f5f81;};}function handleError(_0x400390,_0x48a34f){_0x48a34f=_0x48a34f||0x1f4;return function(_0x1d3593){logger[_0xc179('0x22')](_0x1d3593[_0xc179('0x35')]);if(_0x1d3593[_0xc179('0x36')]){delete _0x1d3593[_0xc179('0x36')];}_0x400390['status'](_0x48a34f)[_0xc179('0x37')](_0x1d3593);};}exports[_0xc179('0x38')]=function(_0x5bdcc0,_0x2b9348){var _0x34869e={},_0x4d7ff2={},_0x46d99c={'count':0x0,'rows':[]};var _0x20271f=_[_0xc179('0x39')](db[_0xc179('0x3a')][_0xc179('0x3b')],function(_0x2115db){return{'name':_0x2115db[_0xc179('0x3c')],'type':_0x2115db[_0xc179('0x3d')]['key']};});_0x4d7ff2[_0xc179('0x3e')]=_[_0xc179('0x39')](_0x20271f,'name');_0x4d7ff2['query']=_['keys'](_0x5bdcc0[_0xc179('0x3f')]);_0x4d7ff2['filters']=_[_0xc179('0x40')](_0x4d7ff2[_0xc179('0x3e')],_0x4d7ff2[_0xc179('0x3f')]);_0x34869e[_0xc179('0x41')]=_[_0xc179('0x40')](_0x4d7ff2[_0xc179('0x3e')],qs[_0xc179('0x42')](_0x5bdcc0[_0xc179('0x3f')][_0xc179('0x42')]));_0x34869e[_0xc179('0x41')]=_0x34869e[_0xc179('0x41')]['length']?_0x34869e[_0xc179('0x41')]:_0x4d7ff2[_0xc179('0x3e')];if(!_0x5bdcc0['query']['hasOwnProperty'](_0xc179('0x43'))){_0x34869e[_0xc179('0x2d')]=qs['limit'](_0x5bdcc0[_0xc179('0x3f')]['limit']);_0x34869e[_0xc179('0x2b')]=qs[_0xc179('0x2b')](_0x5bdcc0['query'][_0xc179('0x2b')]);}_0x34869e[_0xc179('0x44')]=qs[_0xc179('0x45')](_0x5bdcc0[_0xc179('0x3f')][_0xc179('0x45')]);_0x34869e[_0xc179('0x46')]=qs[_0xc179('0x47')](_[_0xc179('0x48')](_0x5bdcc0['query'],_0x4d7ff2[_0xc179('0x47')]),_0x20271f);if(_0x5bdcc0['query'][_0xc179('0x49')]){_0x34869e[_0xc179('0x46')]=_['merge'](_0x34869e[_0xc179('0x46')],{'$or':_['map'](_0x20271f,function(_0x1b665f){if(_0x1b665f[_0xc179('0x3d')]!==_0xc179('0x4a')){var _0x113b26={};_0x113b26[_0x1b665f[_0xc179('0x36')]]={'$like':'%'+_0x5bdcc0[_0xc179('0x3f')][_0xc179('0x49')]+'%'};return _0x113b26;}})});}_0x34869e=_[_0xc179('0x4b')]({},_0x34869e,_0x5bdcc0[_0xc179('0x4c')]);var _0x1e79d4={'where':_0x34869e[_0xc179('0x46')]};return db['VoiceContext']['count'](_0x1e79d4)[_0xc179('0x1d')](function(_0x302d86){_0x46d99c['count']=_0x302d86;if(_0x5bdcc0[_0xc179('0x3f')][_0xc179('0x4d')]){_0x34869e['include']=[{'all':!![]}];}return db['VoiceContext'][_0xc179('0x4e')](_0x34869e);})[_0xc179('0x1d')](function(_0x31df59){_0x46d99c[_0xc179('0x4f')]=_0x31df59;return _0x46d99c;})[_0xc179('0x1d')](respondWithFilteredResult(_0x2b9348,_0x34869e))['catch'](handleError(_0x2b9348,null));};exports[_0xc179('0x50')]=function(_0x5681f5,_0x5ebb7e){var _0x331cbf={'raw':![],'where':{'id':_0x5681f5['params']['id']}},_0x46ad6c={};_0x46ad6c[_0xc179('0x3e')]=_[_0xc179('0x51')](db['VoiceContext'][_0xc179('0x3b')]);_0x46ad6c[_0xc179('0x3f')]=_[_0xc179('0x51')](_0x5681f5[_0xc179('0x3f')]);_0x46ad6c[_0xc179('0x47')]=_[_0xc179('0x40')](_0x46ad6c['model'],_0x46ad6c[_0xc179('0x3f')]);_0x331cbf[_0xc179('0x41')]=_[_0xc179('0x40')](_0x46ad6c['model'],qs[_0xc179('0x42')](_0x5681f5[_0xc179('0x3f')][_0xc179('0x42')]));_0x331cbf['attributes']=_0x331cbf['attributes'][_0xc179('0x52')]?_0x331cbf[_0xc179('0x41')]:_0x46ad6c[_0xc179('0x3e')];if(_0x5681f5[_0xc179('0x3f')]['includeAll']){_0x331cbf['include']=[{'all':!![]}];}_0x331cbf=_[_0xc179('0x4b')]({},_0x331cbf,_0x5681f5[_0xc179('0x4c')]);return db['VoiceContext'][_0xc179('0x53')](_0x331cbf)['then'](handleEntityNotFound(_0x5ebb7e,null))[_0xc179('0x1d')](respondWithResult(_0x5ebb7e,null))[_0xc179('0x54')](handleError(_0x5ebb7e,null));};exports['create']=function(_0x51751b,_0x14e699,_0x40d176){var _0x346587;return db[_0xc179('0x3a')][_0xc179('0x55')](_0x51751b[_0xc179('0x56')],{'raw':!![]})[_0xc179('0x1d')](function(_0x57e4c1){_0x346587=_0x57e4c1;return db['VoiceContext'][_0xc179('0x4e')]({'raw':!![]});})[_0xc179('0x1d')](function(_0x123ddb){var _0x5d191e=fs[_0xc179('0x57')](path[_0xc179('0x58')](config[_0xc179('0x59')],_0xc179('0x5a')),_0xc179('0x5b'));var _0x2f3c62=ejs[_0xc179('0x5c')](_0x5d191e,{'contexts':_0x123ddb||[]});fs[_0xc179('0x5d')](_0xc179('0x5e'),_0x2f3c62);})[_0xc179('0x1d')](function(){return respondWithRpcPromise(_0xc179('0x5f'),_0xc179('0x55'),{'module':_0xc179('0x60')});})[_0xc179('0x1d')](function(){var _0x4dc469=_0x51751b[_0xc179('0x61')][_0xc179('0x62')]({'plain':!![]});if(!_0x4dc469)throw new Error(_0xc179('0x63'));if(_0x4dc469[_0xc179('0x64')]==='user'){var _0x25766e=_0x346587['get']({'plain':!![]});return db[_0xc179('0x65')][_0xc179('0x53')]({'where':{'name':_0xc179('0x66'),'userProfileId':_0x4dc469['userProfileId']},'raw':!![]})[_0xc179('0x1d')](function(_0x1af409){if(_0x1af409&&_0x1af409[_0xc179('0x67')]===0x0){return db[_0xc179('0x33')]['create']({'name':_0x25766e[_0xc179('0x36')],'resourceId':_0x25766e['id'],'type':_0x1af409[_0xc179('0x36')],'sectionId':_0x1af409['id']},{})[_0xc179('0x1d')](function(){return _0x346587;});}else{return _0x346587;}})[_0xc179('0x54')](function(_0x5e492a){logger[_0xc179('0x22')](_0xc179('0x68'),_0x5e492a);throw _0x5e492a;});}return _0x346587;})['then'](respondWithResult(_0x14e699,0xc9))[_0xc179('0x54')](handleError(_0x14e699,null));};exports['update']=function(_0x59d345,_0x919f50,_0x4a6a65){var _0x2cb71;return db[_0xc179('0x3a')][_0xc179('0x53')]({'where':{'id':_0x59d345[_0xc179('0x69')]['id']}})[_0xc179('0x1d')](handleEntityNotFound(_0x919f50,null))[_0xc179('0x1d')](saveUpdates(_0x59d345[_0xc179('0x56')],null))['then'](function(_0x2e41d4){if(_0x2e41d4){_0x2cb71=_0x2e41d4;return db['VoiceContext'][_0xc179('0x4e')]({'raw':!![]});}})[_0xc179('0x1d')](function(_0x54ba2f){var _0x4c8163=fs[_0xc179('0x57')](path[_0xc179('0x58')](config[_0xc179('0x59')],_0xc179('0x5a')),_0xc179('0x5b'));var _0x52e697=ejs['render'](_0x4c8163,{'contexts':_0x54ba2f||[]});fs['writeFileSync'](_0xc179('0x5e'),_0x52e697);})[_0xc179('0x1d')](function(){return respondWithRpcPromise(_0xc179('0x5f'),_0xc179('0x6a'),{'module':'chan_sip.so'});})[_0xc179('0x1d')](function(){return _0x2cb71;})[_0xc179('0x1d')](respondWithResult(_0x919f50,null))['catch'](handleError(_0x919f50,null));};exports[_0xc179('0x34')]=function(_0x162434,_0x3200b4,_0x4aa01a){var _0x544205;return db[_0xc179('0x3a')]['find']({'where':{'id':_0x162434[_0xc179('0x69')]['id']}})['then'](handleEntityNotFound(_0x3200b4,null))[_0xc179('0x1d')](removeEntity(_0x3200b4,null))['then'](function(){return db[_0xc179('0x3a')][_0xc179('0x4e')]({'raw':!![]});})[_0xc179('0x1d')](function(_0x1b8ac8){var _0x362959=fs[_0xc179('0x57')](path['join'](config['root'],_0xc179('0x5a')),_0xc179('0x5b'));var _0x47c178=ejs[_0xc179('0x5c')](_0x362959,{'contexts':_0x1b8ac8});fs['writeFileSync'](_0xc179('0x5e'),_0x47c178);return respondWithRpcPromise(_0xc179('0x5f'),_0xc179('0x34'),{'module':'chan_sip.so'});})[_0xc179('0x54')](handleError(_0x3200b4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e90077b..443d5aa 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 _0x1902=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext','lodash'];(function(_0x5bd5d6,_0x3a5891){var _0x2997f1=function(_0x1484be){while(--_0x1484be){_0x5bd5d6['push'](_0x5bd5d6['shift']());}};_0x2997f1(++_0x3a5891);}(_0x1902,0x83));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2190('0x0'));var util=require(_0x2190('0x1'));var logger=require('../../config/logger')(_0x2190('0x2'));var moment=require(_0x2190('0x3'));var BPromise=require(_0x2190('0x4'));var rp=require(_0x2190('0x5'));var fs=require('fs');var path=require(_0x2190('0x6'));var rimraf=require(_0x2190('0x7'));var config=require(_0x2190('0x8'));var attributes=require('./voiceContext.attributes');module[_0x2190('0x9')]=function(_0x28facd,_0x2f6c73){return _0x28facd[_0x2190('0xa')](_0x2190('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x094c=['rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','util','../../config/logger','moment','bluebird','path'];(function(_0x36c25f,_0x55dfad){var _0x57bd3b=function(_0x50033c){while(--_0x50033c){_0x36c25f['push'](_0x36c25f['shift']());}};_0x57bd3b(++_0x55dfad);}(_0x094c,0x131));var _0xc094=function(_0x569b7a,_0x377a61){_0x569b7a=_0x569b7a-0x0;var _0x39d00a=_0x094c[_0x569b7a];return _0x39d00a;};'use strict';var _=require('lodash');var util=require(_0xc094('0x0'));var logger=require(_0xc094('0x1'))('api');var moment=require(_0xc094('0x2'));var BPromise=require(_0xc094('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc094('0x4'));var rimraf=require(_0xc094('0x5'));var config=require(_0xc094('0x6'));var attributes=require(_0xc094('0x7'));module[_0xc094('0x8')]=function(_0x3226a1,_0x1366bf){return _0x3226a1['define'](_0xc094('0x9'),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 4048f21..150d777 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 _0xe6e5=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5f236e,_0x3b017f){var _0x242627=function(_0x1feec2){while(--_0x1feec2){_0x5f236e['push'](_0x5f236e['shift']());}};_0x242627(++_0x3b017f);}(_0xe6e5,0x1e7));var _0x5e6e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe6e5[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x5e6e('0x0'));var util=require(_0x5e6e('0x1'));var moment=require(_0x5e6e('0x2'));var BPromise=require(_0x5e6e('0x3'));var rs=require(_0x5e6e('0x4'));var fs=require('fs');var Redis=require(_0x5e6e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e6e('0x6'));var logger=require(_0x5e6e('0x7'))(_0x5e6e('0x8'));var config=require(_0x5e6e('0x9'));var jayson=require(_0x5e6e('0xa'));var client=jayson['client'][_0x5e6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b12d,_0x28b603,_0x42e7db){return new BPromise(function(_0x211707,_0x2f6f89){return client[_0x5e6e('0xc')](_0x18b12d,_0x42e7db)['then'](function(_0xdbee49){logger[_0x5e6e('0xd')](_0x5e6e('0xe'),_0x28b603,_0x5e6e('0xf'));logger['debug'](_0x5e6e('0x10'),_0x28b603,_0x5e6e('0xf'),JSON[_0x5e6e('0x11')](_0xdbee49));if(_0xdbee49[_0x5e6e('0x12')]){if(_0xdbee49['error'][_0x5e6e('0x13')]===0x1f4){logger['error'](_0x5e6e('0xe'),_0x28b603,_0xdbee49['error']['message']);return _0x2f6f89(_0xdbee49[_0x5e6e('0x12')][_0x5e6e('0x14')]);}logger[_0x5e6e('0x12')]('VoiceContext,\x20%s,\x20%s',_0x28b603,_0xdbee49['error']['message']);return _0x211707(_0xdbee49['error'][_0x5e6e('0x14')]);}else{logger[_0x5e6e('0xd')](_0x5e6e('0xe'),_0x28b603,_0x5e6e('0xf'));_0x211707(_0xdbee49[_0x5e6e('0x15')][_0x5e6e('0x14')]);}})['catch'](function(_0xd07b99){logger[_0x5e6e('0x12')](_0x5e6e('0xe'),_0x28b603,_0xd07b99);_0x2f6f89(_0xd07b99);});});} \ No newline at end of file +var _0xfd7b=['request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xfd7b[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var moment=require(_0xbfd7('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfd7('0x6'))(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfd7('0x9')][_0xbfd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3d61,_0x4210a0,_0x4f25bf){return new BPromise(function(_0x174ff2,_0x51e9cf){return client[_0xbfd7('0xb')](_0x5e3d61,_0x4f25bf)['then'](function(_0x52cc23){logger[_0xbfd7('0xc')](_0xbfd7('0xd'),_0x4210a0,_0xbfd7('0xe'));logger[_0xbfd7('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4210a0,_0xbfd7('0xe'),JSON[_0xbfd7('0x10')](_0x52cc23));if(_0x52cc23[_0xbfd7('0x11')]){if(_0x52cc23['error'][_0xbfd7('0x12')]===0x1f4){logger[_0xbfd7('0x11')]('VoiceContext,\x20%s,\x20%s',_0x4210a0,_0x52cc23[_0xbfd7('0x11')][_0xbfd7('0x13')]);return _0x51e9cf(_0x52cc23['error'][_0xbfd7('0x13')]);}logger[_0xbfd7('0x11')](_0xbfd7('0xd'),_0x4210a0,_0x52cc23[_0xbfd7('0x11')][_0xbfd7('0x13')]);return _0x174ff2(_0x52cc23[_0xbfd7('0x11')][_0xbfd7('0x13')]);}else{logger[_0xbfd7('0xc')](_0xbfd7('0xd'),_0x4210a0,_0xbfd7('0xe'));_0x174ff2(_0x52cc23[_0xbfd7('0x14')][_0xbfd7('0x13')]);}})[_0xbfd7('0x15')](function(_0x19b889){logger[_0xbfd7('0x11')](_0xbfd7('0xd'),_0x4210a0,_0x19b889);_0x51e9cf(_0x19b889);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index aaf34d6..f0ed11c 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 _0x1fda=['post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4b1407,_0x55b8ef){var _0x33bfd4=function(_0x469e3c){while(--_0x469e3c){_0x4b1407['push'](_0x4b1407['shift']());}};_0x33bfd4(++_0x55b8ef);}(_0x1fda,0x103));var _0xa1fd=function(_0x22d7bb,_0x4c158e){_0x22d7bb=_0x22d7bb-0x0;var _0x40a737=_0x1fda[_0x22d7bb];return _0x40a737;};'use strict';var multer=require(_0xa1fd('0x0'));var util=require(_0xa1fd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa1fd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa1fd('0x3'));var interaction=require(_0xa1fd('0x4'));var config=require(_0xa1fd('0x5'));var controller=require(_0xa1fd('0x6'));router[_0xa1fd('0x7')]('/',auth[_0xa1fd('0x8')](),controller[_0xa1fd('0x9')]);router['get'](_0xa1fd('0xa'),auth['isAuthenticated'](),controller[_0xa1fd('0xb')]);router['get'](_0xa1fd('0xc'),auth['isAuthenticated'](),controller[_0xa1fd('0xd')]);router[_0xa1fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1fd('0xf')]);router[_0xa1fd('0x10')](_0xa1fd('0xc'),auth[_0xa1fd('0x8')](),controller[_0xa1fd('0x11')]);router[_0xa1fd('0x12')](_0xa1fd('0xc'),auth[_0xa1fd('0x8')](),controller[_0xa1fd('0x13')]);module[_0xa1fd('0x14')]=router; \ No newline at end of file +var _0xf4eb=['./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','Router','../../components/interaction/service','../../config/environment'];(function(_0x5c701b,_0x58adc6){var _0x9cf7e4=function(_0x360c46){while(--_0x360c46){_0x5c701b['push'](_0x5c701b['shift']());}};_0x9cf7e4(++_0x58adc6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5a66ca,_0x3b0158){_0x5a66ca=_0x5a66ca-0x0;var _0x3a351b=_0xf4eb[_0x5a66ca];return _0x3a351b;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['delete'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a958c38..e38b6d7 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 _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x5468b5,_0x3ed8c5){var _0x582028=function(_0xc6296f){while(--_0xc6296f){_0x5468b5['push'](_0x5468b5['shift']());}};_0x582028(++_0x3ed8c5);}(_0xbec5,0xe5));var _0x5bec=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xbec5[_0x58db4e];return _0x40139a;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x143a9c,_0x1e391e){var _0x23c8e0=function(_0x47603f){while(--_0x47603f){_0x143a9c['push'](_0x143a9c['shift']());}};_0x23c8e0(++_0x1e391e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x14697e,_0x441fda){_0x14697e=_0x14697e-0x0;var _0x5894e7=_0x9bde[_0x14697e];return _0x5894e7;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index d7e68e9..6be225d 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 _0xc7ab=['find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','create','body'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xc7ab,0x1c5));var _0xbc7a=function(_0x1e4aba,_0x353894){_0x1e4aba=_0x1e4aba-0x0;var _0x423960=_0xc7ab[_0x1e4aba];return _0x423960;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc7a('0x0'));var zipdir=require(_0xbc7a('0x1'));var jsonpatch=require(_0xbc7a('0x2'));var rp=require(_0xbc7a('0x3'));var moment=require('moment');var BPromise=require(_0xbc7a('0x4'));var Mustache=require(_0xbc7a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbc7a('0x6'));var csv=require(_0xbc7a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc7a('0x8'));var _=require(_0xbc7a('0x9'));var squel=require('squel');var crypto=require(_0xbc7a('0xa'));var jsforce=require(_0xbc7a('0xb'));var deskjs=require(_0xbc7a('0xc'));var toCsv=require(_0xbc7a('0x7'));var querystring=require(_0xbc7a('0xd'));var Papa=require(_0xbc7a('0xe'));var Redis=require(_0xbc7a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbc7a('0x10'));var as=require(_0xbc7a('0x11'));var hardwareService=require(_0xbc7a('0x12'));var logger=require(_0xbc7a('0x13'))('api');var utils=require(_0xbc7a('0x14'));var config=require(_0xbc7a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23834d,_0x2082cf){_0x2082cf=_0x2082cf||0xcc;return function(_0x440d6b){if(_0x440d6b){return _0x23834d['sendStatus'](_0x2082cf);}return _0x23834d[_0xbc7a('0x16')](_0x2082cf)[_0xbc7a('0x17')]();};}function respondWithResult(_0x52d1a1,_0x5a8816){_0x5a8816=_0x5a8816||0xc8;return function(_0xa702cc){if(_0xa702cc){return _0x52d1a1[_0xbc7a('0x16')](_0x5a8816)[_0xbc7a('0x18')](_0xa702cc);}};}function respondWithFilteredResult(_0x4afb37,_0x29495a){return function(_0x16673d){if(_0x16673d){var _0x36a9f9=typeof _0x29495a[_0xbc7a('0x19')]==='undefined'&&typeof _0x29495a[_0xbc7a('0x1a')]===_0xbc7a('0x1b');var _0x2ea69a=_0x16673d[_0xbc7a('0x1c')];var _0x2107e8=_0x36a9f9?0x0:_0x29495a['offset'];var _0x414b86=_0x36a9f9?_0x16673d['count']:_0x29495a[_0xbc7a('0x19')]+_0x29495a[_0xbc7a('0x1a')];var _0x1f84a3;if(_0x414b86>=_0x2ea69a){_0x414b86=_0x2ea69a;_0x1f84a3=0xc8;}else{_0x1f84a3=0xce;}_0x4afb37[_0xbc7a('0x16')](_0x1f84a3);return _0x4afb37[_0xbc7a('0x1d')]('Content-Range',_0x2107e8+'-'+_0x414b86+'/'+_0x2ea69a)[_0xbc7a('0x18')](_0x16673d);}return null;};}function patchUpdates(_0xf36bc5){return function(_0x1544a4){try{jsonpatch[_0xbc7a('0x1e')](_0x1544a4,_0xf36bc5,!![]);}catch(_0xa24163){return BPromise['reject'](_0xa24163);}return _0x1544a4[_0xbc7a('0x1f')]();};}function saveUpdates(_0x15768e,_0x3e8b3e){return function(_0x385ffb){if(_0x385ffb){return _0x385ffb[_0xbc7a('0x20')](_0x15768e)[_0xbc7a('0x21')](function(_0x3e1154){return _0x3e1154;});}return null;};}function removeEntity(_0x4e3cf8,_0x2b926c){return function(_0x30c4ef){if(_0x30c4ef){return _0x30c4ef['destroy']()[_0xbc7a('0x21')](function(){_0x4e3cf8['status'](0xcc)[_0xbc7a('0x17')]();});}};}function handleEntityNotFound(_0x16c295,_0x44c0d9){return function(_0x2773d5){if(!_0x2773d5){_0x16c295[_0xbc7a('0x22')](0x194);}return _0x2773d5;};}function handleError(_0x3ba88d,_0x2208e2){_0x2208e2=_0x2208e2||0x1f4;return function(_0x32ee13){logger[_0xbc7a('0x23')](_0x32ee13[_0xbc7a('0x24')]);if(_0x32ee13[_0xbc7a('0x25')]){delete _0x32ee13['name'];}_0x3ba88d[_0xbc7a('0x16')](_0x2208e2)[_0xbc7a('0x26')](_0x32ee13);};}exports[_0xbc7a('0x27')]=function(_0x1287c3,_0x449246){var _0x9cb25c={},_0x5ad7f9={},_0x1ab398={'count':0x0,'rows':[]};var _0x144f91=_[_0xbc7a('0x28')](db[_0xbc7a('0x29')][_0xbc7a('0x2a')],function(_0x58c855){return{'name':_0x58c855[_0xbc7a('0x2b')],'type':_0x58c855[_0xbc7a('0x2c')][_0xbc7a('0x2d')]};});_0x5ad7f9[_0xbc7a('0x2e')]=_[_0xbc7a('0x28')](_0x144f91,_0xbc7a('0x25'));_0x5ad7f9['query']=_['keys'](_0x1287c3['query']);_0x5ad7f9[_0xbc7a('0x2f')]=_[_0xbc7a('0x30')](_0x5ad7f9[_0xbc7a('0x2e')],_0x5ad7f9['query']);_0x9cb25c['attributes']=_[_0xbc7a('0x30')](_0x5ad7f9[_0xbc7a('0x2e')],qs['fields'](_0x1287c3[_0xbc7a('0x31')][_0xbc7a('0x32')]));_0x9cb25c[_0xbc7a('0x33')]=_0x9cb25c['attributes'][_0xbc7a('0x34')]?_0x9cb25c[_0xbc7a('0x33')]:_0x5ad7f9[_0xbc7a('0x2e')];if(!_0x1287c3[_0xbc7a('0x31')][_0xbc7a('0x35')](_0xbc7a('0x36'))){_0x9cb25c[_0xbc7a('0x1a')]=qs['limit'](_0x1287c3[_0xbc7a('0x31')]['limit']);_0x9cb25c[_0xbc7a('0x19')]=qs[_0xbc7a('0x19')](_0x1287c3[_0xbc7a('0x31')][_0xbc7a('0x19')]);}_0x9cb25c[_0xbc7a('0x37')]=qs[_0xbc7a('0x38')](_0x1287c3[_0xbc7a('0x31')]['sort']);_0x9cb25c['where']=qs[_0xbc7a('0x2f')](_[_0xbc7a('0x39')](_0x1287c3[_0xbc7a('0x31')],_0x5ad7f9[_0xbc7a('0x2f')]),_0x144f91);if(_0x1287c3[_0xbc7a('0x31')][_0xbc7a('0x3a')]){_0x9cb25c[_0xbc7a('0x3b')]=_[_0xbc7a('0x3c')](_0x9cb25c[_0xbc7a('0x3b')],{'$or':_[_0xbc7a('0x28')](_0x144f91,function(_0x14c0c6){if(_0x14c0c6[_0xbc7a('0x2c')]!==_0xbc7a('0x3d')){var _0x2f5783={};_0x2f5783[_0x14c0c6[_0xbc7a('0x25')]]={'$like':'%'+_0x1287c3[_0xbc7a('0x31')][_0xbc7a('0x3a')]+'%'};return _0x2f5783;}})});}_0x9cb25c=_['merge']({},_0x9cb25c,_0x1287c3['options']);var _0x202aa1={'where':_0x9cb25c[_0xbc7a('0x3b')]};return db['VoiceDialReport']['count'](_0x202aa1)['then'](function(_0x221f40){_0x1ab398[_0xbc7a('0x1c')]=_0x221f40;if(_0x1287c3['query'][_0xbc7a('0x3e')]){_0x9cb25c[_0xbc7a('0x3f')]=[{'all':!![]}];}return db[_0xbc7a('0x29')][_0xbc7a('0x40')](_0x9cb25c);})[_0xbc7a('0x21')](function(_0x48087d){_0x1ab398[_0xbc7a('0x41')]=_0x48087d;return _0x1ab398;})[_0xbc7a('0x21')](respondWithFilteredResult(_0x449246,_0x9cb25c))[_0xbc7a('0x42')](handleError(_0x449246,null));};exports['show']=function(_0x3148b2,_0x4b5f09){var _0x5db368={'raw':!![],'where':{'id':_0x3148b2[_0xbc7a('0x43')]['id']}},_0x10be5c={};_0x10be5c['model']=_['keys'](db[_0xbc7a('0x29')]['rawAttributes']);_0x10be5c[_0xbc7a('0x31')]=_[_0xbc7a('0x44')](_0x3148b2[_0xbc7a('0x31')]);_0x10be5c[_0xbc7a('0x2f')]=_[_0xbc7a('0x30')](_0x10be5c[_0xbc7a('0x2e')],_0x10be5c['query']);_0x5db368[_0xbc7a('0x33')]=_['intersection'](_0x10be5c['model'],qs['fields'](_0x3148b2[_0xbc7a('0x31')][_0xbc7a('0x32')]));_0x5db368['attributes']=_0x5db368[_0xbc7a('0x33')][_0xbc7a('0x34')]?_0x5db368[_0xbc7a('0x33')]:_0x10be5c[_0xbc7a('0x2e')];if(_0x3148b2['query'][_0xbc7a('0x3e')]){_0x5db368[_0xbc7a('0x3f')]=[{'all':!![]}];}_0x5db368=_[_0xbc7a('0x3c')]({},_0x5db368,_0x3148b2[_0xbc7a('0x45')]);return db[_0xbc7a('0x29')]['find'](_0x5db368)[_0xbc7a('0x21')](handleEntityNotFound(_0x4b5f09,null))['then'](respondWithResult(_0x4b5f09,null))[_0xbc7a('0x42')](handleError(_0x4b5f09,null));};exports[_0xbc7a('0x46')]=function(_0x14b823,_0x1cbf56){return db[_0xbc7a('0x29')][_0xbc7a('0x46')](_0x14b823[_0xbc7a('0x47')],{})[_0xbc7a('0x21')](respondWithResult(_0x1cbf56,0xc9))[_0xbc7a('0x42')](handleError(_0x1cbf56,null));};exports['update']=function(_0xa069ab,_0x90ed69){if(_0xa069ab[_0xbc7a('0x47')]['id']){delete _0xa069ab[_0xbc7a('0x47')]['id'];}return db[_0xbc7a('0x29')][_0xbc7a('0x48')]({'where':{'id':_0xa069ab['params']['id']}})[_0xbc7a('0x21')](handleEntityNotFound(_0x90ed69,null))[_0xbc7a('0x21')](saveUpdates(_0xa069ab[_0xbc7a('0x47')],null))['then'](respondWithResult(_0x90ed69,null))[_0xbc7a('0x42')](handleError(_0x90ed69,null));};exports[_0xbc7a('0x49')]=function(_0x491151,_0x4c8437){return db[_0xbc7a('0x29')][_0xbc7a('0x48')]({'where':{'id':_0x491151['params']['id']}})[_0xbc7a('0x21')](handleEntityNotFound(_0x4c8437,null))[_0xbc7a('0x21')](removeEntity(_0x4c8437,null))[_0xbc7a('0x42')](handleError(_0x4c8437,null));};exports[_0xbc7a('0x4a')]=function(_0x1f33a8,_0xdfcc8a){return db['VoiceDialReport'][_0xbc7a('0x4a')]()['then'](respondWithResult(_0xdfcc8a,null))[_0xbc7a('0x42')](handleError(_0xdfcc8a,null));}; \ No newline at end of file +var _0xb3f0=['filter','merge','options','includeAll','include','VoiceDialReport','findAll','rows','catch','params','filters','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','end','error','stack','name','send','map','rawAttributes','fieldName','keys','query','intersection','model','fields','attributes','length','nolimit','sort','where','pick'];(function(_0x795acb,_0x448e0b){var _0x14ad55=function(_0x4d7c50){while(--_0x4d7c50){_0x795acb['push'](_0x795acb['shift']());}};_0x14ad55(++_0x448e0b);}(_0xb3f0,0x168));var _0x0b3f=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xb3f0[_0x37b7b6];return _0x10c4c3;};'use strict';var emlformat=require(_0x0b3f('0x0'));var rimraf=require(_0x0b3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b3f('0x2'));var rp=require(_0x0b3f('0x3'));var moment=require(_0x0b3f('0x4'));var BPromise=require(_0x0b3f('0x5'));var Mustache=require(_0x0b3f('0x6'));var util=require(_0x0b3f('0x7'));var path=require(_0x0b3f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0b3f('0x9'));var fs=require('fs');var fs_extra=require(_0x0b3f('0xa'));var _=require(_0x0b3f('0xb'));var squel=require(_0x0b3f('0xc'));var crypto=require(_0x0b3f('0xd'));var jsforce=require(_0x0b3f('0xe'));var deskjs=require(_0x0b3f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0b3f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0b3f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b3f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0b3f('0x13'));var config=require(_0x0b3f('0x14'));var licenseUtil=require(_0x0b3f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54284e,_0x24902d){_0x24902d=_0x24902d||0xcc;return function(_0x14dd2c){if(_0x14dd2c){return _0x54284e[_0x0b3f('0x16')](_0x24902d);}return _0x54284e[_0x0b3f('0x17')](_0x24902d)['end']();};}function respondWithResult(_0x54f18b,_0x1c1c95){_0x1c1c95=_0x1c1c95||0xc8;return function(_0x406896){if(_0x406896){return _0x54f18b[_0x0b3f('0x17')](_0x1c1c95)['json'](_0x406896);}};}function respondWithFilteredResult(_0x201149,_0x2913f2){return function(_0xffd7c5){if(_0xffd7c5){var _0x12e709=typeof _0x2913f2[_0x0b3f('0x18')]===_0x0b3f('0x19')&&typeof _0x2913f2[_0x0b3f('0x1a')]===_0x0b3f('0x19');var _0x59f55a=_0xffd7c5[_0x0b3f('0x1b')];var _0x5962c0=_0x12e709?0x0:_0x2913f2[_0x0b3f('0x18')];var _0x5b50c3=_0x12e709?_0xffd7c5[_0x0b3f('0x1b')]:_0x2913f2[_0x0b3f('0x18')]+_0x2913f2[_0x0b3f('0x1a')];var _0x541c4c;if(_0x5b50c3>=_0x59f55a){_0x5b50c3=_0x59f55a;_0x541c4c=0xc8;}else{_0x541c4c=0xce;}_0x201149[_0x0b3f('0x17')](_0x541c4c);return _0x201149[_0x0b3f('0x1c')]('Content-Range',_0x5962c0+'-'+_0x5b50c3+'/'+_0x59f55a)[_0x0b3f('0x1d')](_0xffd7c5);}return null;};}function patchUpdates(_0x4400ca){return function(_0xa120dd){try{jsonpatch[_0x0b3f('0x1e')](_0xa120dd,_0x4400ca,!![]);}catch(_0x309b99){return BPromise['reject'](_0x309b99);}return _0xa120dd[_0x0b3f('0x1f')]();};}function saveUpdates(_0x16858c,_0x3353c0){return function(_0x5f338a){if(_0x5f338a){return _0x5f338a[_0x0b3f('0x20')](_0x16858c)['then'](function(_0x24cb4b){return _0x24cb4b;});}return null;};}function removeEntity(_0x34d19b,_0xa72b9d){return function(_0x106e4e){if(_0x106e4e){return _0x106e4e[_0x0b3f('0x21')]()[_0x0b3f('0x22')](function(){_0x34d19b[_0x0b3f('0x17')](0xcc)[_0x0b3f('0x23')]();});}};}function handleEntityNotFound(_0x1c19a3,_0x1517f1){return function(_0x3c0155){if(!_0x3c0155){_0x1c19a3[_0x0b3f('0x16')](0x194);}return _0x3c0155;};}function handleError(_0x371ba3,_0x3d517a){_0x3d517a=_0x3d517a||0x1f4;return function(_0xca453f){logger[_0x0b3f('0x24')](_0xca453f[_0x0b3f('0x25')]);if(_0xca453f[_0x0b3f('0x26')]){delete _0xca453f[_0x0b3f('0x26')];}_0x371ba3['status'](_0x3d517a)[_0x0b3f('0x27')](_0xca453f);};}exports['index']=function(_0x3a4345,_0x307774){var _0x3dc2db={},_0xddf272={},_0xd623e6={'count':0x0,'rows':[]};var _0x944d39=_[_0x0b3f('0x28')](db['VoiceDialReport'][_0x0b3f('0x29')],function(_0x59ffd2){return{'name':_0x59ffd2[_0x0b3f('0x2a')],'type':_0x59ffd2['type']['key']};});_0xddf272['model']=_[_0x0b3f('0x28')](_0x944d39,_0x0b3f('0x26'));_0xddf272['query']=_[_0x0b3f('0x2b')](_0x3a4345[_0x0b3f('0x2c')]);_0xddf272['filters']=_[_0x0b3f('0x2d')](_0xddf272[_0x0b3f('0x2e')],_0xddf272[_0x0b3f('0x2c')]);_0x3dc2db['attributes']=_[_0x0b3f('0x2d')](_0xddf272[_0x0b3f('0x2e')],qs[_0x0b3f('0x2f')](_0x3a4345[_0x0b3f('0x2c')][_0x0b3f('0x2f')]));_0x3dc2db[_0x0b3f('0x30')]=_0x3dc2db[_0x0b3f('0x30')][_0x0b3f('0x31')]?_0x3dc2db[_0x0b3f('0x30')]:_0xddf272[_0x0b3f('0x2e')];if(!_0x3a4345[_0x0b3f('0x2c')]['hasOwnProperty'](_0x0b3f('0x32'))){_0x3dc2db[_0x0b3f('0x1a')]=qs[_0x0b3f('0x1a')](_0x3a4345[_0x0b3f('0x2c')][_0x0b3f('0x1a')]);_0x3dc2db[_0x0b3f('0x18')]=qs[_0x0b3f('0x18')](_0x3a4345[_0x0b3f('0x2c')][_0x0b3f('0x18')]);}_0x3dc2db['order']=qs[_0x0b3f('0x33')](_0x3a4345[_0x0b3f('0x2c')][_0x0b3f('0x33')]);_0x3dc2db[_0x0b3f('0x34')]=qs['filters'](_[_0x0b3f('0x35')](_0x3a4345[_0x0b3f('0x2c')],_0xddf272['filters']),_0x944d39);if(_0x3a4345['query'][_0x0b3f('0x36')]){_0x3dc2db[_0x0b3f('0x34')]=_['merge'](_0x3dc2db[_0x0b3f('0x34')],{'$or':_['map'](_0x944d39,function(_0x439e56){if(_0x439e56['type']!=='VIRTUAL'){var _0x51fc71={};_0x51fc71[_0x439e56[_0x0b3f('0x26')]]={'$like':'%'+_0x3a4345['query'][_0x0b3f('0x36')]+'%'};return _0x51fc71;}})});}_0x3dc2db=_[_0x0b3f('0x37')]({},_0x3dc2db,_0x3a4345[_0x0b3f('0x38')]);var _0x1b2886={'where':_0x3dc2db[_0x0b3f('0x34')]};return db['VoiceDialReport']['count'](_0x1b2886)[_0x0b3f('0x22')](function(_0x2b9e07){_0xd623e6[_0x0b3f('0x1b')]=_0x2b9e07;if(_0x3a4345[_0x0b3f('0x2c')][_0x0b3f('0x39')]){_0x3dc2db[_0x0b3f('0x3a')]=[{'all':!![]}];}return db[_0x0b3f('0x3b')][_0x0b3f('0x3c')](_0x3dc2db);})[_0x0b3f('0x22')](function(_0x5b6968){_0xd623e6[_0x0b3f('0x3d')]=_0x5b6968;return _0xd623e6;})[_0x0b3f('0x22')](respondWithFilteredResult(_0x307774,_0x3dc2db))[_0x0b3f('0x3e')](handleError(_0x307774,null));};exports['show']=function(_0x1353c4,_0x5cdf35){var _0x4ce5f7={'raw':!![],'where':{'id':_0x1353c4[_0x0b3f('0x3f')]['id']}},_0x21f768={};_0x21f768[_0x0b3f('0x2e')]=_[_0x0b3f('0x2b')](db[_0x0b3f('0x3b')][_0x0b3f('0x29')]);_0x21f768[_0x0b3f('0x2c')]=_[_0x0b3f('0x2b')](_0x1353c4['query']);_0x21f768[_0x0b3f('0x40')]=_['intersection'](_0x21f768['model'],_0x21f768[_0x0b3f('0x2c')]);_0x4ce5f7['attributes']=_[_0x0b3f('0x2d')](_0x21f768[_0x0b3f('0x2e')],qs[_0x0b3f('0x2f')](_0x1353c4[_0x0b3f('0x2c')]['fields']));_0x4ce5f7[_0x0b3f('0x30')]=_0x4ce5f7['attributes'][_0x0b3f('0x31')]?_0x4ce5f7[_0x0b3f('0x30')]:_0x21f768['model'];if(_0x1353c4['query'][_0x0b3f('0x39')]){_0x4ce5f7[_0x0b3f('0x3a')]=[{'all':!![]}];}_0x4ce5f7=_[_0x0b3f('0x37')]({},_0x4ce5f7,_0x1353c4[_0x0b3f('0x38')]);return db[_0x0b3f('0x3b')][_0x0b3f('0x41')](_0x4ce5f7)[_0x0b3f('0x22')](handleEntityNotFound(_0x5cdf35,null))[_0x0b3f('0x22')](respondWithResult(_0x5cdf35,null))[_0x0b3f('0x3e')](handleError(_0x5cdf35,null));};exports[_0x0b3f('0x42')]=function(_0x2b30e4,_0x6d0bba){return db[_0x0b3f('0x3b')][_0x0b3f('0x42')](_0x2b30e4[_0x0b3f('0x43')],{})[_0x0b3f('0x22')](respondWithResult(_0x6d0bba,0xc9))[_0x0b3f('0x3e')](handleError(_0x6d0bba,null));};exports[_0x0b3f('0x20')]=function(_0x2e700a,_0x430c3d){if(_0x2e700a[_0x0b3f('0x43')]['id']){delete _0x2e700a[_0x0b3f('0x43')]['id'];}return db[_0x0b3f('0x3b')]['find']({'where':{'id':_0x2e700a[_0x0b3f('0x3f')]['id']}})[_0x0b3f('0x22')](handleEntityNotFound(_0x430c3d,null))[_0x0b3f('0x22')](saveUpdates(_0x2e700a[_0x0b3f('0x43')],null))['then'](respondWithResult(_0x430c3d,null))[_0x0b3f('0x3e')](handleError(_0x430c3d,null));};exports[_0x0b3f('0x21')]=function(_0x140726,_0x4d854f){return db['VoiceDialReport'][_0x0b3f('0x41')]({'where':{'id':_0x140726['params']['id']}})[_0x0b3f('0x22')](handleEntityNotFound(_0x4d854f,null))[_0x0b3f('0x22')](removeEntity(_0x4d854f,null))['catch'](handleError(_0x4d854f,null));};exports['describe']=function(_0x528044,_0x17b28c){return db[_0x0b3f('0x3b')][_0x0b3f('0x44')]()[_0x0b3f('0x22')](respondWithResult(_0x17b28c,null))[_0x0b3f('0x3e')](handleError(_0x17b28c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a9c703f..554f3c0 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 _0xfabe=['path','rimraf','exports','report_dial','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x2b37aa,_0x1d40dc){var _0x52b73d=function(_0x5eb623){while(--_0x5eb623){_0x2b37aa['push'](_0x2b37aa['shift']());}};_0x52b73d(++_0x1d40dc);}(_0xfabe,0x9b));var _0xefab=function(_0x946381,_0x53f110){_0x946381=_0x946381-0x0;var _0x5ba6ff=_0xfabe[_0x946381];return _0x5ba6ff;};'use strict';var _=require(_0xefab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rp=require(_0xefab('0x4'));var fs=require('fs');var path=require(_0xefab('0x5'));var rimraf=require(_0xefab('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xefab('0x7')]=function(_0x2cf433,_0x260585){return _0x2cf433['define']('VoiceDialReport',attributes,{'tableName':_0xefab('0x8'),'paranoid':![],'indexes':[{'fields':[_0xefab('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4502=['define','VoiceDialReport','uniqueid','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x124eba,_0x22cb6b){var _0x2c8e35=function(_0x4c1cd4){while(--_0x4c1cd4){_0x124eba['push'](_0x124eba['shift']());}};_0x2c8e35(++_0x22cb6b);}(_0x4502,0x157));var _0x2450=function(_0x47a434,_0xc781e8){_0x47a434=_0x47a434-0x0;var _0x978e2f=_0x4502[_0x47a434];return _0x978e2f;};'use strict';var _=require(_0x2450('0x0'));var util=require('util');var logger=require(_0x2450('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2450('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2450('0x3'));var rimraf=require(_0x2450('0x4'));var config=require(_0x2450('0x5'));var attributes=require(_0x2450('0x6'));module['exports']=function(_0x4fcf06,_0x56dcc3){return _0x4fcf06[_0x2450('0x7')](_0x2450('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x2450('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 5cd5d49..ba33be2 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 _0x8880=['debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','VoiceDialReport','update','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x5f521c,_0x407d59){var _0x4b7582=function(_0x129a1d){while(--_0x129a1d){_0x5f521c['push'](_0x5f521c['shift']());}};_0x4b7582(++_0x407d59);}(_0x8880,0x173));var _0x0888=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x8880[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0x0888('0x0'));var util=require(_0x0888('0x1'));var moment=require('moment');var BPromise=require(_0x0888('0x2'));var rs=require(_0x0888('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0888('0x4'))['db'];var utils=require(_0x0888('0x5'));var logger=require('../../config/logger')(_0x0888('0x6'));var config=require(_0x0888('0x7'));var jayson=require(_0x0888('0x8'));var client=jayson['client'][_0x0888('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbd61d5,_0x24683d,_0x1a9f62){return new BPromise(function(_0x37f1cf,_0x2e14b1){return client[_0x0888('0xa')](_0xbd61d5,_0x1a9f62)['then'](function(_0x519715){logger[_0x0888('0xb')](_0x0888('0xc'),_0x24683d,'request\x20sent');logger[_0x0888('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x24683d,_0x0888('0xe'),JSON[_0x0888('0xf')](_0x519715));if(_0x519715[_0x0888('0x10')]){if(_0x519715[_0x0888('0x10')][_0x0888('0x11')]===0x1f4){logger[_0x0888('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x24683d,_0x519715[_0x0888('0x10')][_0x0888('0x12')]);return _0x2e14b1(_0x519715[_0x0888('0x10')]['message']);}logger['error'](_0x0888('0xc'),_0x24683d,_0x519715['error'][_0x0888('0x12')]);return _0x37f1cf(_0x519715[_0x0888('0x10')][_0x0888('0x12')]);}else{logger['info'](_0x0888('0xc'),_0x24683d,_0x0888('0xe'));_0x37f1cf(_0x519715[_0x0888('0x13')][_0x0888('0x12')]);}})[_0x0888('0x14')](function(_0x2f1131){logger[_0x0888('0x10')](_0x0888('0xc'),_0x24683d,_0x2f1131);_0x2e14b1(_0x2f1131);});});}exports[_0x0888('0x15')]=function(_0x42b811){var _0x91b9b9=this;return new Promise(function(_0x2ea9a2,_0x655965){return db['VoiceDialReport'][_0x0888('0x16')](_0x42b811[_0x0888('0x17')],{'raw':_0x42b811['options']?_0x42b811[_0x0888('0x18')][_0x0888('0x19')]===undefined?!![]:![]:!![]})[_0x0888('0x1a')](function(_0x1bcc1c){logger[_0x0888('0xb')](_0x0888('0x15'),_0x42b811);logger[_0x0888('0xd')]('CreateVoiceDialReport',_0x42b811,JSON[_0x0888('0xf')](_0x1bcc1c));_0x2ea9a2(_0x1bcc1c);})[_0x0888('0x14')](function(_0x388607){logger['error'](_0x0888('0x15'),_0x388607[_0x0888('0x12')],_0x42b811);_0x655965(_0x91b9b9['error'](0x1f4,_0x388607[_0x0888('0x12')]));});});};exports[_0x0888('0x1b')]=function(_0x261b14){var _0x2a2494=this;return new Promise(function(_0x2ef45b,_0x19dedc){return db[_0x0888('0x1c')][_0x0888('0x1d')](_0x261b14[_0x0888('0x17')],{'raw':_0x261b14[_0x0888('0x18')]?_0x261b14['options'][_0x0888('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x261b14['options']?_0x261b14[_0x0888('0x18')]['where']||null:null,'attributes':_0x261b14['options']?_0x261b14['options'][_0x0888('0x1e')]||null:null,'limit':_0x261b14[_0x0888('0x18')]?_0x261b14[_0x0888('0x18')][_0x0888('0x1f')]||null:null})['then'](function(_0x3ce0a7){logger[_0x0888('0xb')](_0x0888('0x1b'),_0x261b14);logger[_0x0888('0xd')](_0x0888('0x1b'),_0x261b14,JSON['stringify'](_0x3ce0a7));_0x2ef45b(_0x3ce0a7);})[_0x0888('0x14')](function(_0x26df67){logger[_0x0888('0x10')](_0x0888('0x1b'),_0x26df67[_0x0888('0x12')],_0x261b14);_0x19dedc(_0x2a2494[_0x0888('0x10')](0x1f4,_0x26df67['message']));});});}; \ No newline at end of file +var _0x2a32=['stringify','code','error','message','result','CreateVoiceDialReport','VoiceDialReport','body','options','catch','UpdateVoiceDialReport','update','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d9a80,_0x151f07){var _0x557870=function(_0x38f3a7){while(--_0x38f3a7){_0x5d9a80['push'](_0x5d9a80['shift']());}};_0x557870(++_0x151f07);}(_0x2a32,0x130));var _0x22a3=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0x2a32[_0xf20b6];return _0x4ff567;};'use strict';var _=require(_0x22a3('0x0'));var util=require(_0x22a3('0x1'));var moment=require('moment');var BPromise=require(_0x22a3('0x2'));var rs=require(_0x22a3('0x3'));var fs=require('fs');var Redis=require(_0x22a3('0x4'));var db=require(_0x22a3('0x5'))['db'];var utils=require(_0x22a3('0x6'));var logger=require(_0x22a3('0x7'))(_0x22a3('0x8'));var config=require('../../config/environment');var jayson=require(_0x22a3('0x9'));var client=jayson[_0x22a3('0xa')][_0x22a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dc33f,_0x4bd743,_0x42bdd4){return new BPromise(function(_0x59c102,_0x333651){return client['request'](_0x1dc33f,_0x42bdd4)['then'](function(_0x1603b2){logger[_0x22a3('0xc')](_0x22a3('0xd'),_0x4bd743,_0x22a3('0xe'));logger[_0x22a3('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4bd743,_0x22a3('0xe'),JSON[_0x22a3('0x10')](_0x1603b2));if(_0x1603b2['error']){if(_0x1603b2['error'][_0x22a3('0x11')]===0x1f4){logger[_0x22a3('0x12')](_0x22a3('0xd'),_0x4bd743,_0x1603b2[_0x22a3('0x12')]['message']);return _0x333651(_0x1603b2[_0x22a3('0x12')][_0x22a3('0x13')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x4bd743,_0x1603b2[_0x22a3('0x12')]['message']);return _0x59c102(_0x1603b2[_0x22a3('0x12')][_0x22a3('0x13')]);}else{logger[_0x22a3('0xc')](_0x22a3('0xd'),_0x4bd743,_0x22a3('0xe'));_0x59c102(_0x1603b2[_0x22a3('0x14')][_0x22a3('0x13')]);}})['catch'](function(_0x46418a){logger[_0x22a3('0x12')](_0x22a3('0xd'),_0x4bd743,_0x46418a);_0x333651(_0x46418a);});});}exports[_0x22a3('0x15')]=function(_0x47cefb){var _0x6cfd4b=this;return new Promise(function(_0x4d1ec0,_0x2202c0){return db[_0x22a3('0x16')]['create'](_0x47cefb[_0x22a3('0x17')],{'raw':_0x47cefb[_0x22a3('0x18')]?_0x47cefb[_0x22a3('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x282c77){logger[_0x22a3('0xc')](_0x22a3('0x15'),_0x47cefb);logger[_0x22a3('0xf')](_0x22a3('0x15'),_0x47cefb,JSON[_0x22a3('0x10')](_0x282c77));_0x4d1ec0(_0x282c77);})[_0x22a3('0x19')](function(_0x2bf387){logger[_0x22a3('0x12')](_0x22a3('0x15'),_0x2bf387[_0x22a3('0x13')],_0x47cefb);_0x2202c0(_0x6cfd4b['error'](0x1f4,_0x2bf387[_0x22a3('0x13')]));});});};exports[_0x22a3('0x1a')]=function(_0x5043ec){var _0x2fd5b8=this;return new Promise(function(_0x258557,_0x394016){return db[_0x22a3('0x16')][_0x22a3('0x1b')](_0x5043ec['body'],{'raw':_0x5043ec[_0x22a3('0x18')]?_0x5043ec['options'][_0x22a3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5043ec[_0x22a3('0x18')]?_0x5043ec[_0x22a3('0x18')][_0x22a3('0x1d')]||null:null,'attributes':_0x5043ec[_0x22a3('0x18')]?_0x5043ec[_0x22a3('0x18')][_0x22a3('0x1e')]||null:null,'limit':_0x5043ec[_0x22a3('0x18')]?_0x5043ec[_0x22a3('0x18')][_0x22a3('0x1f')]||null:null})['then'](function(_0x54ba32){logger[_0x22a3('0xc')](_0x22a3('0x1a'),_0x5043ec);logger[_0x22a3('0xf')](_0x22a3('0x1a'),_0x5043ec,JSON['stringify'](_0x54ba32));_0x258557(_0x54ba32);})[_0x22a3('0x19')](function(_0x45335f){logger[_0x22a3('0x12')](_0x22a3('0x1a'),_0x45335f[_0x22a3('0x13')],_0x5043ec);_0x394016(_0x2fd5b8[_0x22a3('0x12')](0x1f4,_0x45335f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ac0f471..e026ad9 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 _0xd35b=['post','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x5da1f4,_0x1b1f67){var _0x358bda=function(_0x27d1a2){while(--_0x27d1a2){_0x5da1f4['push'](_0x5da1f4['shift']());}};_0x358bda(++_0x1b1f67);}(_0xd35b,0x111));var _0xbd35=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xd35b[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xbd35('0x0'));var util=require(_0xbd35('0x1'));var path=require(_0xbd35('0x2'));var timeout=require(_0xbd35('0x3'));var express=require(_0xbd35('0x4'));var router=express['Router']();var fs_extra=require(_0xbd35('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd35('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xbd35('0x7')]('/',auth[_0xbd35('0x8')](),controller[_0xbd35('0x9')]);router[_0xbd35('0x7')](_0xbd35('0xa'),auth[_0xbd35('0x8')](),controller[_0xbd35('0xb')]);router[_0xbd35('0xc')]('/',auth[_0xbd35('0x8')](),controller['create']);router[_0xbd35('0xc')](_0xbd35('0xd'),auth[_0xbd35('0x8')](),controller[_0xbd35('0xe')]);router[_0xbd35('0xf')](_0xbd35('0xa'),auth[_0xbd35('0x8')](),controller['update']);router[_0xbd35('0x10')](_0xbd35('0xa'),auth[_0xbd35('0x8')](),controller[_0xbd35('0x11')]);module[_0xbd35('0x12')]=router; \ No newline at end of file +var _0xaaee=['../../config/environment','get','isAuthenticated','/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a59af,_0x18d558){var _0x3af243=function(_0x5480d6){while(--_0x5480d6){_0x2a59af['push'](_0x2a59af['shift']());}};_0x3af243(++_0x18d558);}(_0xaaee,0x1b1));var _0xeaae=function(_0x109d94,_0x368562){_0x109d94=_0x109d94-0x0;var _0xcbd14b=_0xaaee[_0x109d94];return _0xcbd14b;};'use strict';var multer=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var path=require(_0xeaae('0x2'));var timeout=require(_0xeaae('0x3'));var express=require(_0xeaae('0x4'));var router=express['Router']();var fs_extra=require(_0xeaae('0x5'));var auth=require(_0xeaae('0x6'));var interaction=require(_0xeaae('0x7'));var config=require(_0xeaae('0x8'));var controller=require('./voiceExtension.controller');router[_0xeaae('0x9')]('/',auth[_0xeaae('0xa')](),controller['index']);router[_0xeaae('0x9')](_0xeaae('0xb'),auth['isAuthenticated'](),controller[_0xeaae('0xc')]);router[_0xeaae('0xd')]('/',auth[_0xeaae('0xa')](),controller['create']);router[_0xeaae('0xd')](_0xeaae('0xe'),auth[_0xeaae('0xa')](),controller[_0xeaae('0xf')]);router[_0xeaae('0x10')](_0xeaae('0xb'),auth[_0xeaae('0xa')](),controller[_0xeaae('0x11')]);router[_0xeaae('0x12')]('/:id',auth[_0xeaae('0xa')](),controller[_0xeaae('0x13')]);module[_0xeaae('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 0130199..f0741b2 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 _0x386e=['wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','outbound-fax','INTEGER','BOOLEAN'];(function(_0x4eca4c,_0x249e4b){var _0xaaa67b=function(_0x4a828a){while(--_0x4a828a){_0x4eca4c['push'](_0x4eca4c['shift']());}};_0xaaa67b(++_0x249e4b);}(_0x386e,0xc7));var _0xe386=function(_0x236912,_0x4167cd){_0x236912=_0x236912-0x0;var _0x582904=_0x386e[_0x236912];return _0x582904;};'use strict';var Sequelize=require(_0xe386('0x0'));module[_0xe386('0x1')]={'context':{'type':Sequelize[_0xe386('0x2')],'allowNull':![],'unique':_0xe386('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe386('0x2')],'allowNull':![],'unique':_0xe386('0x3')},'priority':{'type':Sequelize[_0xe386('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xe386('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe386('0x2')],'allowNull':![],'defaultValue':_0xe386('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe386('0x5')]('inbound',_0xe386('0x6'),_0xe386('0x7'),'inbound-fax',_0xe386('0x8'),'system','any'),'allowNull':![]},'description':{'type':Sequelize[_0xe386('0x2')]},'interval':{'type':Sequelize[_0xe386('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xe386('0x9')]},'isApp':{'type':Sequelize[_0xe386('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe386('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe386('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe386('0x9')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xe386('0xb')},'answer':{'type':Sequelize[_0xe386('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe386('0xc')],'get':function(_0x1d9cbd){return this[_0xe386('0xd')](_0xe386('0xe'));}},'alias':{'type':Sequelize[_0xe386('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc2d9=['STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exports'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0xc2d9,0x1ef));var _0x9c2d=function(_0x54eff8,_0x4ff003){_0x54eff8=_0x54eff8-0x0;var _0x52c59e=_0xc2d9[_0x54eff8];return _0x52c59e;};'use strict';var Sequelize=require('sequelize');module[_0x9c2d('0x0')]={'context':{'type':Sequelize[_0x9c2d('0x1')],'allowNull':![],'unique':_0x9c2d('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x9c2d('0x1')],'allowNull':![],'unique':_0x9c2d('0x2')},'priority':{'type':Sequelize[_0x9c2d('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x9c2d('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x9c2d('0x1')],'allowNull':![],'defaultValue':_0x9c2d('0x3')},'appdata':{'type':Sequelize[_0x9c2d('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x9c2d('0x4')](_0x9c2d('0x5'),_0x9c2d('0x6'),_0x9c2d('0x7'),'inbound-fax',_0x9c2d('0x8'),'system',_0x9c2d('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9c2d('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x9c2d('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x9c2d('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x9c2d('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x9c2d('0xc')]},'recordingFormat':{'type':Sequelize[_0x9c2d('0x1')],'defaultValue':_0x9c2d('0xd')},'answer':{'type':Sequelize[_0x9c2d('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x9c2d('0xe')],'get':function(_0x52db32){return this[_0x9c2d('0xf')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0242e8a..06f115f 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 _0xdb21=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','VoiceExtensionId','isApp','createRouting','log','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','then','get','InboundRoutes','outbound','InternalRoutes','internal','map','value','includes','type','find','error','stack','name','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','show','rawAttributes','intersection','catch','params','exten','concat','create'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdb21,0xcd));var _0x1db2=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0xdb21[_0xd158dc];return _0x12d25f;};'use strict';var _=require(_0x1db2('0x0'));var Redis=require(_0x1db2('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1db2('0x2'))(_0x1db2('0x3'));var config=require(_0x1db2('0x4'));var db=require(_0x1db2('0x5'))['db'];config['redis']=_[_0x1db2('0x6')](config[_0x1db2('0x7')],{'host':_0x1db2('0x8'),'port':0x18eb});var socket=require(_0x1db2('0x9'))(new Redis(config[_0x1db2('0x7')]));require(_0x1db2('0xa'))[_0x1db2('0xb')](socket);function respondWithStatusCode(_0x1d210b,_0x6285ab){_0x6285ab=_0x6285ab||0xcc;return function(_0x55af3a){if(_0x55af3a){return _0x1d210b[_0x1db2('0xc')](_0x6285ab);}return _0x1d210b[_0x1db2('0xd')](_0x6285ab)[_0x1db2('0xe')]();};}function respondWithResult(_0x4c4834,_0x12c163){_0x12c163=_0x12c163||0xc8;return function(_0x11eaad){if(_0x11eaad){return _0x4c4834[_0x1db2('0xd')](_0x12c163)[_0x1db2('0xf')](_0x11eaad);}};}function respondWithFilteredResult(_0x4696cf,_0x3e51fa){return function(_0x16a7f7){if(_0x16a7f7){var _0x38fd85=typeof _0x3e51fa['offset']===_0x1db2('0x10')&&typeof _0x3e51fa[_0x1db2('0x11')]===_0x1db2('0x10');var _0x2df1b2=_0x16a7f7[_0x1db2('0x12')];var _0x150cd6=_0x38fd85?0x0:_0x3e51fa[_0x1db2('0x13')];var _0x4ac32d=_0x38fd85?_0x16a7f7[_0x1db2('0x12')]:_0x3e51fa[_0x1db2('0x13')]+_0x3e51fa[_0x1db2('0x11')];var _0x29d1ea;if(_0x4ac32d>=_0x2df1b2){_0x4ac32d=_0x2df1b2;_0x29d1ea=0xc8;}else{_0x29d1ea=0xce;}_0x4696cf[_0x1db2('0xd')](_0x29d1ea);return _0x4696cf[_0x1db2('0x14')](_0x1db2('0x15'),_0x150cd6+'-'+_0x4ac32d+'/'+_0x2df1b2)[_0x1db2('0xf')](_0x16a7f7);}return null;};}function removeEntity(_0x32fb69){return function(_0x231ad2){if(_0x231ad2){return _0x231ad2[_0x1db2('0x16')]()[_0x1db2('0x17')](function(){var _0x50ef76=_0x231ad2[_0x1db2('0x18')]({'plain':!![]});var _0x5564d8=[{'name':_0x1db2('0x19'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x1db2('0x1a'),'ignore':![]},{'name':_0x1db2('0x1b'),'value':_0x1db2('0x1c'),'ignore':![]}];var _0x5de6e9=_(_0x5564d8)['filter']('ignore')[_0x1db2('0x1d')](_0x1db2('0x1e'))['value']();if(_[_0x1db2('0x1f')](_0x5de6e9,_0x50ef76[_0x1db2('0x20')])){return;}var _0x4163e5=_[_0x1db2('0x21')](_0x5564d8,[_0x1db2('0x1e'),_0x50ef76[_0x1db2('0x20')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x4163e5,'resourceId':_0x50ef76['id']}})[_0x1db2('0x17')](function(){return _0x231ad2;});})[_0x1db2('0x17')](function(){_0x32fb69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2490db){return function(_0x3cb053){if(!_0x3cb053){_0x2490db[_0x1db2('0xc')](0x194);}return _0x3cb053;};}function handleError(_0x22ed73,_0x540b56){_0x540b56=_0x540b56||0x1f4;return function(_0x5b0433){logger[_0x1db2('0x22')](_0x5b0433[_0x1db2('0x23')]);if(_0x5b0433['name']){delete _0x5b0433[_0x1db2('0x24')];}_0x22ed73[_0x1db2('0xd')](_0x540b56)[_0x1db2('0x25')](_0x5b0433);};}exports[_0x1db2('0x26')]=function(_0x31414d,_0x217d39){var _0x7a2b47={},_0xaa7e69={},_0x24a94a={'count':0x0,'rows':[]};var _0x52fa25=_[_0x1db2('0x1d')](db[_0x1db2('0x27')]['rawAttributes'],function(_0x2c6f9b){return{'name':_0x2c6f9b[_0x1db2('0x28')],'type':_0x2c6f9b['type'][_0x1db2('0x29')]};});_0xaa7e69[_0x1db2('0x2a')]=_[_0x1db2('0x1d')](_0x52fa25,_0x1db2('0x24'));_0xaa7e69[_0x1db2('0x2b')]=_[_0x1db2('0x2c')](_0x31414d['query']);_0xaa7e69[_0x1db2('0x2d')]=_['intersection'](_0xaa7e69[_0x1db2('0x2a')],_0xaa7e69[_0x1db2('0x2b')]);_0x7a2b47[_0x1db2('0x2e')]=_['intersection'](_0xaa7e69[_0x1db2('0x2a')],qs[_0x1db2('0x2f')](_0x31414d['query']['fields']));_0x7a2b47[_0x1db2('0x2e')]=_0x7a2b47['attributes'][_0x1db2('0x30')]?_0x7a2b47[_0x1db2('0x2e')]:_0xaa7e69[_0x1db2('0x2a')];if(!_0x31414d['query'][_0x1db2('0x31')](_0x1db2('0x32'))){_0x7a2b47[_0x1db2('0x11')]=qs[_0x1db2('0x11')](_0x31414d[_0x1db2('0x2b')][_0x1db2('0x11')]);_0x7a2b47[_0x1db2('0x13')]=qs[_0x1db2('0x13')](_0x31414d['query']['offset']);}_0x7a2b47[_0x1db2('0x33')]=qs[_0x1db2('0x34')](_0x31414d[_0x1db2('0x2b')][_0x1db2('0x34')]);_0x7a2b47[_0x1db2('0x35')]=qs[_0x1db2('0x2d')](_[_0x1db2('0x36')](_0x31414d[_0x1db2('0x2b')],_0xaa7e69[_0x1db2('0x2d')]),_0x52fa25);if(_0x31414d[_0x1db2('0x2b')]['filter']){_0x7a2b47['where']=_[_0x1db2('0x37')](_0x7a2b47[_0x1db2('0x35')],{'$or':_[_0x1db2('0x1d')](_0x52fa25,function(_0x484e9f){if(_0x484e9f[_0x1db2('0x20')]!=='VIRTUAL'){var _0x121a59={};_0x121a59[_0x484e9f[_0x1db2('0x24')]]={'$like':'%'+_0x31414d['query']['filter']+'%'};return _0x121a59;}})});}_0x7a2b47=_[_0x1db2('0x37')]({},_0x7a2b47,_0x31414d[_0x1db2('0x38')]);var _0x16f7b6={'where':_0x7a2b47[_0x1db2('0x35')]};return db['VoiceExtension'][_0x1db2('0x12')](_0x16f7b6)[_0x1db2('0x17')](function(_0x11cf4d){_0x24a94a[_0x1db2('0x12')]=_0x11cf4d;if(_0x31414d[_0x1db2('0x2b')][_0x1db2('0x39')]){_0x7a2b47[_0x1db2('0x3a')]=[{'all':!![]}];}return db[_0x1db2('0x27')][_0x1db2('0x3b')](_0x7a2b47);})[_0x1db2('0x17')](function(_0x3e25b5){_0x24a94a['rows']=_0x3e25b5;return _0x24a94a;})[_0x1db2('0x17')](respondWithFilteredResult(_0x217d39,_0x7a2b47))['catch'](handleError(_0x217d39,null));};exports[_0x1db2('0x3c')]=function(_0x3a3ab3,_0x1de3d8){var _0x5425b4={'raw':![],'where':{'id':_0x3a3ab3['params']['id']}},_0x2f0c74={};_0x2f0c74['model']=_[_0x1db2('0x2c')](db['VoiceExtension'][_0x1db2('0x3d')]);_0x2f0c74[_0x1db2('0x2b')]=_[_0x1db2('0x2c')](_0x3a3ab3[_0x1db2('0x2b')]);_0x2f0c74[_0x1db2('0x2d')]=_[_0x1db2('0x3e')](_0x2f0c74[_0x1db2('0x2a')],_0x2f0c74['query']);_0x5425b4['attributes']=_[_0x1db2('0x3e')](_0x2f0c74[_0x1db2('0x2a')],qs['fields'](_0x3a3ab3[_0x1db2('0x2b')][_0x1db2('0x2f')]));_0x5425b4['attributes']=_0x5425b4[_0x1db2('0x2e')][_0x1db2('0x30')]?_0x5425b4['attributes']:_0x2f0c74[_0x1db2('0x2a')];if(_0x3a3ab3[_0x1db2('0x2b')][_0x1db2('0x39')]){_0x5425b4[_0x1db2('0x3a')]=[{'all':!![]}];}_0x5425b4=_['merge']({},_0x5425b4,_0x3a3ab3['options']);return db[_0x1db2('0x27')][_0x1db2('0x21')](_0x5425b4)[_0x1db2('0x17')](handleEntityNotFound(_0x1de3d8,null))[_0x1db2('0x17')](respondWithResult(_0x1de3d8,null))[_0x1db2('0x3f')](handleError(_0x1de3d8,null));};exports['destroy']=function(_0x47c3f4,_0xe522f8){return db[_0x1db2('0x27')][_0x1db2('0x21')]({'where':{'id':_0x47c3f4[_0x1db2('0x40')]['id']}})[_0x1db2('0x17')](handleEntityNotFound(_0xe522f8,null))['then'](removeEntity(_0xe522f8,null))[_0x1db2('0x3f')](handleError(_0xe522f8,null));};exports['create']=function(_0x5aead2,_0xfd3816){if(_0x5aead2['body']['type']===_0x1db2('0x1a')&&!_['startsWith'](_0x5aead2['body'][_0x1db2('0x41')],'_')){_0x5aead2['body'][_0x1db2('0x41')]='_'[_0x1db2('0x42')](_0x5aead2['body']['exten']);}return db[_0x1db2('0x27')][_0x1db2('0x43')](_0x5aead2[_0x1db2('0x44')],{'raw':![]})[_0x1db2('0x17')](function(_0x1b7fb8){var _0x147cc3=_0x5aead2[_0x1db2('0x45')][_0x1db2('0x18')]({'plain':!![]});if(!_0x147cc3)throw new Error(_0x1db2('0x46'));if(_0x147cc3['role']===_0x1db2('0x45')){var _0x48477a=_0x1b7fb8[_0x1db2('0x18')]({'plain':!![]});var _0x47a847=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x1db2('0x1b'),'value':'internal'}];var _0x2ba111=_[_0x1db2('0x21')](_0x47a847,[_0x1db2('0x1e'),_0x48477a['type']])['name'];return db[_0x1db2('0x47')]['find']({'where':{'name':_0x2ba111,'userProfileId':_0x147cc3[_0x1db2('0x48')]},'raw':!![]})[_0x1db2('0x17')](function(_0x49fd0b){if(_0x49fd0b&&_0x49fd0b['autoAssociation']===0x0){return db[_0x1db2('0x49')][_0x1db2('0x43')]({'name':_0x48477a[_0x1db2('0x24')],'resourceId':_0x48477a['id'],'type':_0x49fd0b['name'],'sectionId':_0x49fd0b['id']},{})[_0x1db2('0x17')](function(){return _0x1b7fb8;});}else{return _0x1b7fb8;}})[_0x1db2('0x3f')](function(_0x1a477e){logger[_0x1db2('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a477e);throw _0x1a477e;});}return _0x1b7fb8;})['then'](respondWithResult(_0xfd3816,0xc9))[_0x1db2('0x3f')](handleError(_0xfd3816,null));};exports[_0x1db2('0x4a')]=function(_0x45e82d,_0x507b2a){if(_0x45e82d[_0x1db2('0x44')]['id']){delete _0x45e82d[_0x1db2('0x44')]['id'];}return db[_0x1db2('0x27')][_0x1db2('0x21')]({'where':{'id':_0x45e82d['params']['id']}})['then'](handleEntityNotFound(_0x507b2a,null))['then'](function(_0x44f5de){if(_0x44f5de){return db[_0x1db2('0x27')]['update'](_['pick'](_0x45e82d[_0x1db2('0x44')],['exten',_0x1db2('0x4b'),_0x1db2('0x4c'),_0x1db2('0x4d'),_0x1db2('0x4e'),_0x1db2('0x4f'),_0x1db2('0x50')]),{'where':{'context':_0x44f5de[_0x1db2('0x4b')],'exten':_0x44f5de[_0x1db2('0x41')]},'individualHooks':!![]})[_0x1db2('0x17')](function(_0x4fff2f){return _0x4fff2f;});}return null;})[_0x1db2('0x17')](respondWithStatusCode(_0x507b2a,null))['catch'](handleError(_0x507b2a,null));};exports[_0x1db2('0x51')]=function(_0x300400,_0x481724){return db['VoiceExtension'][_0x1db2('0x52')]({'where':{'id':_0x300400[_0x1db2('0x40')]['id']}})[_0x1db2('0x17')](function(_0x5c40b6){if(_0x5c40b6){return db[_0x1db2('0x53')]['transaction'](function(_0x292dbb){return db[_0x1db2('0x27')][_0x1db2('0x16')]({'where':{'VoiceExtensionId':_0x300400['params']['id']},'transaction':_0x292dbb})['then'](function(){var _0x2aaed1=_['map'](_0x300400[_0x1db2('0x44')],function(_0x262377){_0x262377[_0x1db2('0x54')]=_0x300400[_0x1db2('0x40')]['id'];_0x262377[_0x1db2('0x55')]=!![];return _0x262377;});return _0x5c40b6[_0x1db2('0x56')](_0x2aaed1);})['then'](function(_0x55feb8){console[_0x1db2('0x57')]('LOG\x20~\x20.then\x20~\x20routing',_0x55feb8);return db[_0x1db2('0x27')][_0x1db2('0x58')](_0x55feb8,{'transaction':_0x292dbb});});})[_0x1db2('0x17')](function(){return db[_0x1db2('0x27')][_0x1db2('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x300400[_0x1db2('0x40')]['id']},'order':_0x1db2('0x5a')});});}})[_0x1db2('0x17')](respondWithResult(_0x481724,null))[_0x1db2('0x3f')](handleError(_0x481724,null));}; \ No newline at end of file +var _0xb433=['query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','show','params','catch','body','outbound','startsWith','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','InboundRoutes','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','findOne','sequelize','transaction','isApp','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','destroy','then','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','value','type','find','name','UserProfileResource','end','error','stack','index','map','rawAttributes','fieldName'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb433,0x19b));var _0x3b43=function(_0x35eaac,_0x470cdd){_0x35eaac=_0x35eaac-0x0;var _0x44ff21=_0xb433[_0x35eaac];return _0x44ff21;};'use strict';var _=require(_0x3b43('0x0'));var Redis=require(_0x3b43('0x1'));var qs=require(_0x3b43('0x2'));var logger=require(_0x3b43('0x3'))(_0x3b43('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3b43('0x5')]=_[_0x3b43('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3b43('0x7'))(new Redis(config[_0x3b43('0x5')]));require(_0x3b43('0x8'))[_0x3b43('0x9')](socket);function respondWithStatusCode(_0x4b695c,_0x4fa1ab){_0x4fa1ab=_0x4fa1ab||0xcc;return function(_0x1fea4d){if(_0x1fea4d){return _0x4b695c[_0x3b43('0xa')](_0x4fa1ab);}return _0x4b695c[_0x3b43('0xb')](_0x4fa1ab)['end']();};}function respondWithResult(_0x5deead,_0x43a6c7){_0x43a6c7=_0x43a6c7||0xc8;return function(_0x245936){if(_0x245936){return _0x5deead[_0x3b43('0xb')](_0x43a6c7)[_0x3b43('0xc')](_0x245936);}};}function respondWithFilteredResult(_0x41a331,_0x45bd94){return function(_0x628797){if(_0x628797){var _0x1e7053=typeof _0x45bd94['offset']===_0x3b43('0xd')&&typeof _0x45bd94[_0x3b43('0xe')]===_0x3b43('0xd');var _0x431b29=_0x628797['count'];var _0x4deb97=_0x1e7053?0x0:_0x45bd94[_0x3b43('0xf')];var _0x55468f=_0x1e7053?_0x628797[_0x3b43('0x10')]:_0x45bd94[_0x3b43('0xf')]+_0x45bd94[_0x3b43('0xe')];var _0x23bc20;if(_0x55468f>=_0x431b29){_0x55468f=_0x431b29;_0x23bc20=0xc8;}else{_0x23bc20=0xce;}_0x41a331[_0x3b43('0xb')](_0x23bc20);return _0x41a331[_0x3b43('0x11')](_0x3b43('0x12'),_0x4deb97+'-'+_0x55468f+'/'+_0x431b29)[_0x3b43('0xc')](_0x628797);}return null;};}function removeEntity(_0x4018c4){return function(_0x488774){if(_0x488774){return _0x488774[_0x3b43('0x13')]()[_0x3b43('0x14')](function(){var _0x2d076b=_0x488774['get']({'plain':!![]});var _0x4a4bdc=[{'name':'InboundRoutes','value':_0x3b43('0x15'),'ignore':![]},{'name':_0x3b43('0x16'),'value':'outbound','ignore':![]},{'name':_0x3b43('0x17'),'value':_0x3b43('0x18'),'ignore':![]}];var _0x361898=_(_0x4a4bdc)[_0x3b43('0x19')](_0x3b43('0x1a'))['map'](_0x3b43('0x1b'))[_0x3b43('0x1b')]();if(_['includes'](_0x361898,_0x2d076b[_0x3b43('0x1c')])){return;}var _0x33122c=_[_0x3b43('0x1d')](_0x4a4bdc,[_0x3b43('0x1b'),_0x2d076b['type']])[_0x3b43('0x1e')];return db[_0x3b43('0x1f')][_0x3b43('0x13')]({'where':{'type':_0x33122c,'resourceId':_0x2d076b['id']}})['then'](function(){return _0x488774;});})['then'](function(){_0x4018c4[_0x3b43('0xb')](0xcc)[_0x3b43('0x20')]();});}};}function handleEntityNotFound(_0x454015){return function(_0x421cd8){if(!_0x421cd8){_0x454015[_0x3b43('0xa')](0x194);}return _0x421cd8;};}function handleError(_0x17eb85,_0x4f49fc){_0x4f49fc=_0x4f49fc||0x1f4;return function(_0x2f9b1b){logger[_0x3b43('0x21')](_0x2f9b1b[_0x3b43('0x22')]);if(_0x2f9b1b[_0x3b43('0x1e')]){delete _0x2f9b1b[_0x3b43('0x1e')];}_0x17eb85[_0x3b43('0xb')](_0x4f49fc)['send'](_0x2f9b1b);};}exports[_0x3b43('0x23')]=function(_0x3aca03,_0x49641f){var _0x23ab5f={},_0x1e7d13={},_0x5f5ea4={'count':0x0,'rows':[]};var _0x1af65b=_[_0x3b43('0x24')](db['VoiceExtension'][_0x3b43('0x25')],function(_0x8178c1){return{'name':_0x8178c1[_0x3b43('0x26')],'type':_0x8178c1[_0x3b43('0x1c')]['key']};});_0x1e7d13['model']=_['map'](_0x1af65b,_0x3b43('0x1e'));_0x1e7d13[_0x3b43('0x27')]=_[_0x3b43('0x28')](_0x3aca03['query']);_0x1e7d13['filters']=_[_0x3b43('0x29')](_0x1e7d13['model'],_0x1e7d13['query']);_0x23ab5f['attributes']=_[_0x3b43('0x29')](_0x1e7d13[_0x3b43('0x2a')],qs[_0x3b43('0x2b')](_0x3aca03[_0x3b43('0x27')]['fields']));_0x23ab5f[_0x3b43('0x2c')]=_0x23ab5f[_0x3b43('0x2c')][_0x3b43('0x2d')]?_0x23ab5f['attributes']:_0x1e7d13[_0x3b43('0x2a')];if(!_0x3aca03[_0x3b43('0x27')][_0x3b43('0x2e')](_0x3b43('0x2f'))){_0x23ab5f[_0x3b43('0xe')]=qs['limit'](_0x3aca03[_0x3b43('0x27')][_0x3b43('0xe')]);_0x23ab5f[_0x3b43('0xf')]=qs[_0x3b43('0xf')](_0x3aca03[_0x3b43('0x27')][_0x3b43('0xf')]);}_0x23ab5f['order']=qs[_0x3b43('0x30')](_0x3aca03[_0x3b43('0x27')][_0x3b43('0x30')]);_0x23ab5f[_0x3b43('0x31')]=qs[_0x3b43('0x32')](_[_0x3b43('0x33')](_0x3aca03['query'],_0x1e7d13[_0x3b43('0x32')]),_0x1af65b);if(_0x3aca03['query'][_0x3b43('0x19')]){_0x23ab5f[_0x3b43('0x31')]=_[_0x3b43('0x34')](_0x23ab5f[_0x3b43('0x31')],{'$or':_[_0x3b43('0x24')](_0x1af65b,function(_0x3f3f09){if(_0x3f3f09[_0x3b43('0x1c')]!==_0x3b43('0x35')){var _0x152b86={};_0x152b86[_0x3f3f09['name']]={'$like':'%'+_0x3aca03[_0x3b43('0x27')][_0x3b43('0x19')]+'%'};return _0x152b86;}})});}_0x23ab5f=_[_0x3b43('0x34')]({},_0x23ab5f,_0x3aca03[_0x3b43('0x36')]);var _0x219573={'where':_0x23ab5f[_0x3b43('0x31')]};return db[_0x3b43('0x37')][_0x3b43('0x10')](_0x219573)[_0x3b43('0x14')](function(_0xaa0c92){_0x5f5ea4[_0x3b43('0x10')]=_0xaa0c92;if(_0x3aca03[_0x3b43('0x27')][_0x3b43('0x38')]){_0x23ab5f[_0x3b43('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x3b43('0x3a')](_0x23ab5f);})[_0x3b43('0x14')](function(_0x83cfad){_0x5f5ea4[_0x3b43('0x3b')]=_0x83cfad;return _0x5f5ea4;})[_0x3b43('0x14')](respondWithFilteredResult(_0x49641f,_0x23ab5f))['catch'](handleError(_0x49641f,null));};exports[_0x3b43('0x3c')]=function(_0x7a84c4,_0x190d81){var _0x31373c={'raw':![],'where':{'id':_0x7a84c4[_0x3b43('0x3d')]['id']}},_0x3dc2e9={};_0x3dc2e9[_0x3b43('0x2a')]=_[_0x3b43('0x28')](db[_0x3b43('0x37')][_0x3b43('0x25')]);_0x3dc2e9['query']=_[_0x3b43('0x28')](_0x7a84c4[_0x3b43('0x27')]);_0x3dc2e9[_0x3b43('0x32')]=_[_0x3b43('0x29')](_0x3dc2e9[_0x3b43('0x2a')],_0x3dc2e9[_0x3b43('0x27')]);_0x31373c['attributes']=_['intersection'](_0x3dc2e9[_0x3b43('0x2a')],qs[_0x3b43('0x2b')](_0x7a84c4[_0x3b43('0x27')][_0x3b43('0x2b')]));_0x31373c[_0x3b43('0x2c')]=_0x31373c['attributes'][_0x3b43('0x2d')]?_0x31373c[_0x3b43('0x2c')]:_0x3dc2e9[_0x3b43('0x2a')];if(_0x7a84c4[_0x3b43('0x27')]['includeAll']){_0x31373c[_0x3b43('0x39')]=[{'all':!![]}];}_0x31373c=_['merge']({},_0x31373c,_0x7a84c4[_0x3b43('0x36')]);return db[_0x3b43('0x37')][_0x3b43('0x1d')](_0x31373c)['then'](handleEntityNotFound(_0x190d81,null))[_0x3b43('0x14')](respondWithResult(_0x190d81,null))[_0x3b43('0x3e')](handleError(_0x190d81,null));};exports[_0x3b43('0x13')]=function(_0x5348e3,_0x19a856){return db[_0x3b43('0x37')][_0x3b43('0x1d')]({'where':{'id':_0x5348e3[_0x3b43('0x3d')]['id']}})[_0x3b43('0x14')](handleEntityNotFound(_0x19a856,null))[_0x3b43('0x14')](removeEntity(_0x19a856,null))[_0x3b43('0x3e')](handleError(_0x19a856,null));};exports['create']=function(_0x5e6914,_0x17fbf4){if(_0x5e6914[_0x3b43('0x3f')][_0x3b43('0x1c')]===_0x3b43('0x40')&&!_[_0x3b43('0x41')](_0x5e6914[_0x3b43('0x3f')][_0x3b43('0x42')],'_')){_0x5e6914[_0x3b43('0x3f')][_0x3b43('0x42')]='_'['concat'](_0x5e6914[_0x3b43('0x3f')][_0x3b43('0x42')]);}return db[_0x3b43('0x37')][_0x3b43('0x43')](_0x5e6914[_0x3b43('0x3f')],{'raw':![]})[_0x3b43('0x14')](function(_0x21d4de){var _0x38dee9=_0x5e6914[_0x3b43('0x44')]['get']({'plain':!![]});if(!_0x38dee9)throw new Error(_0x3b43('0x45'));if(_0x38dee9[_0x3b43('0x46')]===_0x3b43('0x44')){var _0x53e138=_0x21d4de[_0x3b43('0x47')]({'plain':!![]});var _0xe2de9d=[{'name':_0x3b43('0x48'),'value':_0x3b43('0x15')},{'name':_0x3b43('0x16'),'value':_0x3b43('0x40')},{'name':'InternalRoutes','value':_0x3b43('0x18')}];var _0x35e0eb=_[_0x3b43('0x1d')](_0xe2de9d,[_0x3b43('0x1b'),_0x53e138['type']])[_0x3b43('0x1e')];return db[_0x3b43('0x49')][_0x3b43('0x1d')]({'where':{'name':_0x35e0eb,'userProfileId':_0x38dee9['userProfileId']},'raw':!![]})[_0x3b43('0x14')](function(_0x35d082){if(_0x35d082&&_0x35d082['autoAssociation']===0x0){return db[_0x3b43('0x1f')]['create']({'name':_0x53e138[_0x3b43('0x1e')],'resourceId':_0x53e138['id'],'type':_0x35d082['name'],'sectionId':_0x35d082['id']},{})[_0x3b43('0x14')](function(){return _0x21d4de;});}else{return _0x21d4de;}})['catch'](function(_0x1bc321){logger[_0x3b43('0x21')](_0x3b43('0x4a'),_0x1bc321);throw _0x1bc321;});}return _0x21d4de;})[_0x3b43('0x14')](respondWithResult(_0x17fbf4,0xc9))[_0x3b43('0x3e')](handleError(_0x17fbf4,null));};exports[_0x3b43('0x4b')]=function(_0x1f202a,_0xb68708){if(_0x1f202a['body']['id']){delete _0x1f202a[_0x3b43('0x3f')]['id'];}return db[_0x3b43('0x37')][_0x3b43('0x1d')]({'where':{'id':_0x1f202a[_0x3b43('0x3d')]['id']}})[_0x3b43('0x14')](handleEntityNotFound(_0xb68708,null))[_0x3b43('0x14')](function(_0x3f542e){if(_0x3f542e){return db[_0x3b43('0x37')][_0x3b43('0x4b')](_[_0x3b43('0x33')](_0x1f202a[_0x3b43('0x3f')],[_0x3b43('0x42'),'context','description',_0x3b43('0x4c'),_0x3b43('0x4d'),_0x3b43('0x4e'),_0x3b43('0x4f')]),{'where':{'context':_0x3f542e[_0x3b43('0x50')],'exten':_0x3f542e[_0x3b43('0x42')]},'individualHooks':!![]})[_0x3b43('0x14')](function(_0x158ecf){return _0x158ecf;});}return null;})[_0x3b43('0x14')](respondWithStatusCode(_0xb68708,null))[_0x3b43('0x3e')](handleError(_0xb68708,null));};exports[_0x3b43('0x51')]=function(_0x17124f,_0x42bccc){return db[_0x3b43('0x37')][_0x3b43('0x52')]({'where':{'id':_0x17124f['params']['id']}})[_0x3b43('0x14')](function(_0x22d8df){if(_0x22d8df){return db[_0x3b43('0x53')][_0x3b43('0x54')](function(_0x190a89){return db[_0x3b43('0x37')][_0x3b43('0x13')]({'where':{'VoiceExtensionId':_0x17124f[_0x3b43('0x3d')]['id']},'transaction':_0x190a89})[_0x3b43('0x14')](function(){var _0x50ea98=_['map'](_0x17124f[_0x3b43('0x3f')],function(_0x32d699){_0x32d699['VoiceExtensionId']=_0x17124f[_0x3b43('0x3d')]['id'];_0x32d699[_0x3b43('0x55')]=!![];return _0x32d699;});return _0x22d8df['createRouting'](_0x50ea98);})[_0x3b43('0x14')](function(_0x9c428f){console['log'](_0x3b43('0x56'),_0x9c428f);return db[_0x3b43('0x37')][_0x3b43('0x57')](_0x9c428f,{'transaction':_0x190a89});});})[_0x3b43('0x14')](function(){return db['VoiceExtension'][_0x3b43('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x17124f[_0x3b43('0x3d')]['id']},'order':_0x3b43('0x59')});});}})['then'](respondWithResult(_0x42bccc,null))[_0x3b43('0x3e')](handleError(_0x42bccc,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 378ed36..0c76184 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 _0x0c2b=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x0c2b,0x159));var _0xb0c2=function(_0x201179,_0x42a191){_0x201179=_0x201179-0x0;var _0x2c88f5=_0x0c2b[_0x201179];return _0x2c88f5;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xb0c2('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb0c2('0x1')](0x0);var events={'afterCreate':_0xb0c2('0x2'),'afterUpdate':_0xb0c2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x290c52){return function(_0x1ea682,_0x53131e,_0x118565){VoiceExtensionEvents[_0xb0c2('0x4')](_0x290c52+':'+_0x1ea682['id'],_0x1ea682);VoiceExtensionEvents[_0xb0c2('0x4')](_0x290c52,_0x1ea682);_0x118565(null);};}for(var e in events){if(events[_0xb0c2('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xb0c2('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6a7a=['update','remove','emit','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x56b987,_0x116c8a){var _0x1347c7=function(_0x1c6b3b){while(--_0x1c6b3b){_0x56b987['push'](_0x56b987['shift']());}};_0x1347c7(++_0x116c8a);}(_0x6a7a,0x7a));var _0xa6a7=function(_0x1e0bb9,_0x24088b){_0x1e0bb9=_0x1e0bb9-0x0;var _0x24901d=_0x6a7a[_0x1e0bb9];return _0x24901d;};'use strict';var EventEmitter=require(_0xa6a7('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xa6a7('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa6a7('0x2')](0x0);var events={'afterCreate':_0xa6a7('0x3'),'afterUpdate':_0xa6a7('0x4'),'afterDestroy':_0xa6a7('0x5')};function emitEvent(_0x2faf44){return function(_0x4f0caf,_0x188886,_0x38f152){VoiceExtensionEvents[_0xa6a7('0x6')](_0x2faf44+':'+_0x4f0caf['id'],_0x4f0caf);VoiceExtensionEvents[_0xa6a7('0x6')](_0x2faf44,_0x4f0caf);_0x38f152(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xa6a7('0x7')](e,emitEvent(event));}}module[_0xa6a7('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d4a6465..af0b01f 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 _0x433a=['Set','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','phone','prefix','${EXTEN:','param','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten'];(function(_0x542bd2,_0x31ed37){var _0x456443=function(_0x5646e5){while(--_0x5646e5){_0x542bd2['push'](_0x542bd2['shift']());}};_0x456443(++_0x31ed37);}(_0x433a,0x14c));var _0xa433=function(_0x37a1c1,_0x955566){_0x37a1c1=_0x37a1c1-0x0;var _0x483e51=_0x433a[_0x37a1c1];return _0x483e51;};'use strict';var _=require(_0xa433('0x0'));var attributes=require(_0xa433('0x1'));module[_0xa433('0x2')]=function(_0x57aaa9){var _0x29307f=_0x57aaa9[_0xa433('0x3')];function _0x22ac7b(_0x1fcf09){var _0x4a4d5c=0x2;var _0x22f282=[{'type':_0x1fcf09[_0xa433('0x4')],'app':'Set','appdata':_0xa433('0x5')+_0x1fcf09[_0xa433('0x4')],'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09[_0xa433('0x4')],'app':_0x1fcf09['alias']?_0xa433('0x8'):_0xa433('0x9'),'appdata':_0x1fcf09['alias']?_0xa433('0xa')+_0x1fcf09[_0xa433('0xb')]:_0xa433('0xc'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']}];if(_0x1fcf09[_0xa433('0x4')]===_0xa433('0xd')){_0x22f282[_0xa433('0xe')]({'type':_0xa433('0xd'),'app':_0xa433('0x8'),'appdata':'CDR(routeid)='+_0x1fcf09['id'],'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']});}_0x22f282[_0xa433('0xe')]({'type':_0x1fcf09[_0xa433('0x4')],'app':'Set','appdata':_0xa433('0xf'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09[_0xa433('0x4')],'app':_0xa433('0x8'),'appdata':_0xa433('0x10'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09['type'],'app':_0xa433('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']});return _0x22f282;}function _0x3b8323(_0x3a580e){var _0x3c5db6=0x2;var _0x1bc01f=[{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x12'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0x3a580e[_0xa433('0xb')]?_0xa433('0x8'):'NoOp','appdata':_0x3a580e['alias']?_0xa433('0xa')+_0x3a580e[_0xa433('0xb')]:_0xa433('0xc'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x13')+(_0x3a580e[_0xa433('0x14')]?'${EXTEN:'+_0x3a580e[_0xa433('0x14')]+'}':_0xa433('0x15')),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x16')+_0x3a580e['id'],'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e['exten'],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':'outbound','app':_0xa433('0x17'),'appdata':_0xa433('0x18')+(_0x3c5db6+0x2)+_0xa433('0x19')+(_0x3c5db6+0x1)+')','context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0x3a580e[_0xa433('0x14')]?_0xa433('0x1a')+_0x3a580e[_0xa433('0x14')]+'}':_0xa433('0x1b'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0xf'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x10'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':'outbound','app':_0xa433('0x8'),'appdata':_0xa433('0x1c'),'context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':'outboundrouteid='+_0x3a580e['id'],'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']}];if(_0x3a580e[_0xa433('0x1d')](_0xa433('0x1e'))&&_0x3a580e[_0xa433('0x1e')]!==_0xa433('0x1f')){_0x1bc01f[_0xa433('0xe')]({'type':_0xa433('0x11'),'app':'Set','appdata':_0xa433('0x20'),'context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x21')+_0x3a580e[_0xa433('0x1e')]||_0xa433('0x22'),'context':_0x3a580e['context'],'exten':_0x3a580e['exten'],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']});}return _0x1bc01f;}function _0x115f84(_0x560281,_0x32b9fb){var _0x138b60=[{'name':_0xa433('0x23'),'param':0x0},{'name':_0xa433('0x24'),'param':0x1},{'name':_0xa433('0x25'),'param':0x2},{'name':'url','param':0x3}];var _0x126223={};var _0x5a829c=_0x32b9fb[_0xa433('0x26')](',');var _0x48f571=[];for(var _0x47ce7d=0x0;_0x47ce7d<_0x138b60[_0xa433('0x27')];_0x47ce7d++){switch(_0x138b60[_0x47ce7d][_0xa433('0x28')]){case _0xa433('0x23'):_0x126223[_0xa433('0x23')]=_0x5a829c[_0x138b60[_0x47ce7d]['param']][_0xa433('0x26')]('/')[0x1];_0x126223[_0xa433('0x29')]=_0x5a829c[_0x138b60[_0x47ce7d]['param']]['split']('/')[0x2];_0x126223[_0xa433('0x2a')]=_0x126223[_0xa433('0x29')]?_0x126223['phone'][_0xa433('0x26')]('$')[0x0]:undefined;_0x126223[_0xa433('0x29')]=_0x560281[_0xa433('0x14')]?(_0x126223[_0xa433('0x2a')]||'')+_0xa433('0x2b')+_0x560281['cutdigits']+'}':(_0x126223[_0xa433('0x2a')]||'')+'${EXTEN}';_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=[_0xa433('0x2d'),_0x126223[_0xa433('0x23')],_0x126223[_0xa433('0x29')]][_0xa433('0x2e')]('/');break;case _0xa433('0x25'):_0x126223[_0xa433('0x25')]=_0x5a829c[_0x138b60[_0x47ce7d][_0xa433('0x2c')]];if(_0x560281[_0xa433('0x1e')]!==_0xa433('0x1f')){if(_0x126223[_0xa433('0x25')][_0xa433('0x2f')](_0xa433('0x30'))<0x0){_0x126223[_0xa433('0x25')]+=_0xa433('0x30');}}else{_0x126223['options']=_0x126223[_0xa433('0x25')][_0xa433('0x31')](_0xa433('0x30'),'');}_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=_0x126223['options'];break;default:_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=_0x5a829c[_0x138b60[_0x47ce7d][_0xa433('0x2c')]];}}return _0x48f571[_0xa433('0x2e')](',');}function _0x38aafe(_0x420c74,_0x1462b7,_0x35555c){return new Promise(function(_0x584506,_0x96c81c){var _0x45ff00=[];if(_[_0xa433('0x32')](_0x1462b7))return _0x584506(_0x45ff00);_0x29307f['Interval'][_0xa433('0x33')]({'attributes':['id',_0xa433('0x34'),_0xa433('0x35')],'raw':!![]})[_0xa433('0x36')](function(_0x2dba36){for(var _0x5ce562=0x0,_0xab35cc=0x0;_0x5ce562<_0x1462b7[_0xa433('0x27')];_0x5ce562++,_0xab35cc=0x0){var _0x3dbf4d=_0x1462b7[_0x5ce562];var _0x566815=[];var _0x5b2d04=[];delete _0x3dbf4d['id'];if(_0x3dbf4d[_0xa433('0x34')]!==_0xa433('0x37')){_0x3dbf4d[_0xa433('0x38')]=[_0x3dbf4d['interval']];}else{_0x3dbf4d['intervals']=_0x3dbf4d[_0xa433('0x35')]?_[_0xa433('0x39')](_[_0xa433('0x3a')](_0x2dba36,{'IntervalId':_0x3dbf4d['IntervalId']}),_0xa433('0x34')):[];}_0x3dbf4d['context']=_0x420c74[_0xa433('0x6')];_0x3dbf4d[_0xa433('0x7')]=_0x420c74[_0xa433('0x7')];if(_0x3dbf4d[_0xa433('0x4')])_0x3dbf4d[_0xa433('0x4')]=_0x3dbf4d[_0xa433('0x4')]['toLowerCase']();if(_0x420c74[_0xa433('0x4')]==='outbound'){if(_0x3dbf4d[_0xa433('0x1d')](_0xa433('0x3b'))&&_0x3dbf4d[_0xa433('0x3b')]&&_0x3dbf4d[_0xa433('0x3b')]!=='--'){_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d['type']['toLowerCase'](),'app':_0xa433('0x8'),'appdata':_0xa433('0x3c')+_0x3dbf4d[_0xa433('0x3b')],'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x17'),'appdata':_0xa433('0x3e')+(_0x3dbf4d['callerID']?_0xa433('0x3f')+_0x3dbf4d['callerID']+')':_0xa433('0x40')),'context':_0x420c74['context'],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}else{if(_0x3dbf4d[_0xa433('0x1d')](_0xa433('0x41'))){if([_0xa433('0x42'),'playback'][_0xa433('0x43')](_0x3dbf4d[_0xa433('0x44')][_0xa433('0x3d')]())&&_0x3dbf4d[_0xa433('0x45')]!==_0xa433('0x46')){if(_0x3dbf4d[_0xa433('0x41')]){_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74['exten'],'priority':_0x3dbf4d['intervals']['length']+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x8'),'appdata':_0xa433('0x47'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d['intervals'][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}else{_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d['type'][_0xa433('0x3d')](),'app':'ExecIf','appdata':_0xa433('0x48'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')]['toLowerCase'](),'app':_0xa433('0x8'),'appdata':_0xa433('0x49'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74['exten'],'priority':_0x3dbf4d['intervals'][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}}}}for(var _0x3cbcdb=0x0;_0x3cbcdb<_0x3dbf4d['intervals'][_0xa433('0x27')];_0x3cbcdb++){var _0x5e5e89=_0x35555c+_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')];var _0x378b78=_0x3cbcdb===_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]-0x1?_0x35555c+_0x566815[_0xa433('0x27')]+_0x5b2d04[_0xa433('0x27')]+0x2:_0x35555c+_0x3cbcdb+0x1;_0x566815[_0xa433('0x4a')](_0x3cbcdb,0x0,{'type':_0x420c74[_0xa433('0x4')],'app':'GotoIfTime','appdata':_0x3dbf4d[_0xa433('0x38')][_0x3cbcdb]+'?'+_0x420c74[_0xa433('0x6')]+_0xa433('0x4b')+_0x5e5e89+':'+_0x420c74[_0xa433('0x6')]+_0xa433('0x4b')+_0x378b78,'exten':_0x420c74[_0xa433('0x7')],'context':_0x420c74[_0xa433('0x6')],'priority':_0x35555c+_0x3cbcdb,'VoiceExtensionId':_0x420c74['id']});}if(_0x3dbf4d[_0xa433('0x45')]===_0xa433('0x4c'))_0x3dbf4d[_0xa433('0x4d')]=_0x115f84(_0x420c74,_0x3dbf4d[_0xa433('0x4d')]);_0x3dbf4d['priority']=_0x566815[_0xa433('0x27')]?_[_0xa433('0x4e')](_0x566815)[_0xa433('0x4f')]+0x1:_0x35555c;_0x45ff00=_[_0xa433('0x50')](_0x45ff00,_0x566815,[_0x3dbf4d],_0x5b2d04);_0x35555c=_[_0xa433('0x4e')](_0x45ff00)[_0xa433('0x4f')]+0x1;}return _0x584506(_0x45ff00);})[_0xa433('0x51')](function(_0x27f74a){_0x96c81c(_0x27f74a);});});}return _0x57aaa9[_0xa433('0x52')](_0xa433('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x41ee8a){var _0x2dedf2=this['get']({'plain':!![]});var _0xa4aeec=_0x2dedf2[_0xa433('0x4')]===_0xa433('0x11')?_0x3b8323(_0x2dedf2):_0x22ac7b(_0x2dedf2);return _0x38aafe(_0x2dedf2,_0x41ee8a,_[_0xa433('0x4e')](_0xa4aeec)[_0xa433('0x4f')]+0x1)[_0xa433('0x36')](function(_0x132df4){var _0x1e29c4=_[_0xa433('0x50')](_0xa4aeec,_0x132df4);_0x1e29c4[_0xa433('0xe')]({'type':_0x2dedf2[_0xa433('0x4')],'app':_0xa433('0x54'),'exten':_0x2dedf2['exten'],'context':_0x2dedf2[_0xa433('0x6')],'priority':_[_0xa433('0x4e')](_0x1e29c4)[_0xa433('0x4f')]+0x1,'VoiceExtensionId':_0x2dedf2['id']});return _0x1e29c4;});}}});}; \ No newline at end of file +var _0xf50b=['indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','then','length','interval','intervals','map','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','appdata','priority','concat','define','VoiceExtension','voice_extensions','get','last','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','NoOp','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','trunk','param','split','prefix','phone','join'];(function(_0x4a30de,_0x5556f1){var _0x342ee3=function(_0x41e8ac){while(--_0x41e8ac){_0x4a30de['push'](_0x4a30de['shift']());}};_0x342ee3(++_0x5556f1);}(_0xf50b,0xc8));var _0xbf50=function(_0xde0929,_0x56047e){_0xde0929=_0xde0929-0x0;var _0x4d336b=_0xf50b[_0xde0929];return _0x4d336b;};'use strict';var _=require(_0xbf50('0x0'));var attributes=require(_0xbf50('0x1'));module['exports']=function(_0x389fbd){var _0x18c2f1=_0x389fbd[_0xbf50('0x2')];function _0x443bf8(_0x5f0c1a){var _0x32217d=0x2;var _0x4f5ba8=[{'type':_0x5f0c1a[_0xbf50('0x3')],'app':_0xbf50('0x4'),'appdata':_0xbf50('0x5')+_0x5f0c1a[_0xbf50('0x3')],'context':_0x5f0c1a[_0xbf50('0x6')],'exten':_0x5f0c1a[_0xbf50('0x7')],'priority':_0x32217d++,'VoiceExtensionId':_0x5f0c1a['id']},{'type':_0x5f0c1a[_0xbf50('0x3')],'app':_0x5f0c1a['alias']?_0xbf50('0x4'):_0xbf50('0x8'),'appdata':_0x5f0c1a[_0xbf50('0x9')]?'CDR(routeAlias)='+_0x5f0c1a['alias']:_0xbf50('0xa'),'context':_0x5f0c1a[_0xbf50('0x6')],'exten':_0x5f0c1a[_0xbf50('0x7')],'priority':_0x32217d++,'VoiceExtensionId':_0x5f0c1a['id']}];if(_0x5f0c1a['type']===_0xbf50('0xb')){_0x4f5ba8[_0xbf50('0xc')]({'type':_0xbf50('0xb'),'app':_0xbf50('0x4'),'appdata':_0xbf50('0xd')+_0x5f0c1a['id'],'context':_0x5f0c1a[_0xbf50('0x6')],'exten':_0x5f0c1a[_0xbf50('0x7')],'priority':_0x32217d++,'VoiceExtensionId':_0x5f0c1a['id']});}_0x4f5ba8['push']({'type':_0x5f0c1a[_0xbf50('0x3')],'app':_0xbf50('0x4'),'appdata':_0xbf50('0xe'),'context':_0x5f0c1a[_0xbf50('0x6')],'exten':_0x5f0c1a[_0xbf50('0x7')],'priority':_0x32217d++,'VoiceExtensionId':_0x5f0c1a['id']},{'type':_0x5f0c1a['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5f0c1a[_0xbf50('0x6')],'exten':_0x5f0c1a['exten'],'priority':_0x32217d++,'VoiceExtensionId':_0x5f0c1a['id']},{'type':_0x5f0c1a[_0xbf50('0x3')],'app':_0xbf50('0x4'),'appdata':_0xbf50('0xf'),'context':_0x5f0c1a['context'],'exten':_0x5f0c1a[_0xbf50('0x7')],'priority':_0x32217d++,'VoiceExtensionId':_0x5f0c1a['id']});return _0x4f5ba8;}function _0x5be8ae(_0x13a5c9){var _0x2264a0=0x2;var _0x33495f=[{'type':'outbound','app':_0xbf50('0x4'),'appdata':_0xbf50('0x10'),'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':_0x13a5c9['alias']?_0xbf50('0x4'):_0xbf50('0x8'),'appdata':_0x13a5c9[_0xbf50('0x9')]?_0xbf50('0x12')+_0x13a5c9[_0xbf50('0x9')]:'No\x20alias\x20set','context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':_0xbf50('0x4'),'appdata':_0xbf50('0x13')+(_0x13a5c9[_0xbf50('0x14')]?_0xbf50('0x15')+_0x13a5c9['cutdigits']+'}':_0xbf50('0x16')),'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':'Set','appdata':_0xbf50('0xd')+_0x13a5c9['id'],'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':_0xbf50('0x17'),'appdata':_0xbf50('0x18')+(_0x2264a0+0x2)+'):Goto('+(_0x2264a0+0x1)+')','context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':'Set','appdata':_0x13a5c9['cutdigits']?_0xbf50('0x19')+_0x13a5c9['cutdigits']+'}':_0xbf50('0x1a'),'context':_0x13a5c9['context'],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':'outbound','app':_0xbf50('0x4'),'appdata':_0xbf50('0xe'),'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':_0xbf50('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':_0xbf50('0x4'),'appdata':_0xbf50('0xf'),'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':'Set','appdata':_0xbf50('0x1b')+_0x13a5c9['id'],'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']}];if(_0x13a5c9[_0xbf50('0x1c')]('recordingFormat')&&_0x13a5c9[_0xbf50('0x1d')]!==_0xbf50('0x1e')){_0x33495f[_0xbf50('0xc')]({'type':_0xbf50('0x11'),'app':_0xbf50('0x4'),'appdata':_0xbf50('0x1f'),'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9[_0xbf50('0x7')],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']},{'type':_0xbf50('0x11'),'app':_0xbf50('0x4'),'appdata':_0xbf50('0x20')+_0x13a5c9['recordingFormat']||_0xbf50('0x21'),'context':_0x13a5c9[_0xbf50('0x6')],'exten':_0x13a5c9['exten'],'priority':_0x2264a0++,'VoiceExtensionId':_0x13a5c9['id']});}return _0x33495f;}function _0x37a0bf(_0x2becfc,_0x1d3740){var _0x2268c3=[{'name':'trunk','param':0x0},{'name':_0xbf50('0x22'),'param':0x1},{'name':_0xbf50('0x23'),'param':0x2},{'name':_0xbf50('0x24'),'param':0x3}];var _0x6ff880={};var _0x16ef05=_0x1d3740['split'](',');var _0x44f8b1=[];for(var _0x410d5f=0x0;_0x410d5f<_0x2268c3['length'];_0x410d5f++){switch(_0x2268c3[_0x410d5f]['name']){case _0xbf50('0x25'):_0x6ff880[_0xbf50('0x25')]=_0x16ef05[_0x2268c3[_0x410d5f][_0xbf50('0x26')]][_0xbf50('0x27')]('/')[0x1];_0x6ff880['phone']=_0x16ef05[_0x2268c3[_0x410d5f][_0xbf50('0x26')]]['split']('/')[0x2];_0x6ff880[_0xbf50('0x28')]=_0x6ff880[_0xbf50('0x29')]?_0x6ff880[_0xbf50('0x29')][_0xbf50('0x27')]('$')[0x0]:undefined;_0x6ff880[_0xbf50('0x29')]=_0x2becfc[_0xbf50('0x14')]?(_0x6ff880[_0xbf50('0x28')]||'')+_0xbf50('0x15')+_0x2becfc[_0xbf50('0x14')]+'}':(_0x6ff880[_0xbf50('0x28')]||'')+'${EXTEN}';_0x44f8b1[_0x2268c3[_0x410d5f]['param']]=['SIP',_0x6ff880[_0xbf50('0x25')],_0x6ff880['phone']][_0xbf50('0x2a')]('/');break;case'options':_0x6ff880[_0xbf50('0x23')]=_0x16ef05[_0x2268c3[_0x410d5f][_0xbf50('0x26')]];if(_0x2becfc[_0xbf50('0x1d')]!=='none'){if(_0x6ff880[_0xbf50('0x23')][_0xbf50('0x2b')](_0xbf50('0x2c'))<0x0){_0x6ff880[_0xbf50('0x23')]+='U(xcally-mixmonitor-context)';}}else{_0x6ff880[_0xbf50('0x23')]=_0x6ff880[_0xbf50('0x23')][_0xbf50('0x2d')](_0xbf50('0x2c'),'');}_0x44f8b1[_0x2268c3[_0x410d5f][_0xbf50('0x26')]]=_0x6ff880[_0xbf50('0x23')];break;default:_0x44f8b1[_0x2268c3[_0x410d5f][_0xbf50('0x26')]]=_0x16ef05[_0x2268c3[_0x410d5f][_0xbf50('0x26')]];}}return _0x44f8b1[_0xbf50('0x2a')](',');}function _0x1bf881(_0x2d2a7c,_0x3fe267,_0x275b93){return new Promise(function(_0x2fd9dc,_0x151d17){var _0x50f8ee=[];if(_[_0xbf50('0x2e')](_0x3fe267))return _0x2fd9dc(_0x50f8ee);_0x18c2f1[_0xbf50('0x2f')]['findAll']({'attributes':['id','interval',_0xbf50('0x30')],'raw':!![]})[_0xbf50('0x31')](function(_0x5cb9d8){for(var _0x398290=0x0,_0x78ce0a=0x0;_0x398290<_0x3fe267[_0xbf50('0x32')];_0x398290++,_0x78ce0a=0x0){var _0x35cb82=_0x3fe267[_0x398290];var _0x78ebbd=[];var _0x478944=[];delete _0x35cb82['id'];if(_0x35cb82[_0xbf50('0x33')]!=='*,*,*,*'){_0x35cb82[_0xbf50('0x34')]=[_0x35cb82['interval']];}else{_0x35cb82['intervals']=_0x35cb82['IntervalId']?_[_0xbf50('0x35')](_['filter'](_0x5cb9d8,{'IntervalId':_0x35cb82[_0xbf50('0x30')]}),'interval'):[];}_0x35cb82[_0xbf50('0x6')]=_0x2d2a7c[_0xbf50('0x6')];_0x35cb82[_0xbf50('0x7')]=_0x2d2a7c[_0xbf50('0x7')];if(_0x35cb82['type'])_0x35cb82[_0xbf50('0x3')]=_0x35cb82[_0xbf50('0x3')]['toLowerCase']();if(_0x2d2a7c[_0xbf50('0x3')]===_0xbf50('0x11')){if(_0x35cb82[_0xbf50('0x1c')](_0xbf50('0x36'))&&_0x35cb82[_0xbf50('0x36')]&&_0x35cb82[_0xbf50('0x36')]!=='--'){_0x78ebbd['push']({'type':_0x35cb82['type'][_0xbf50('0x37')](),'app':_0xbf50('0x4'),'appdata':'CDR(tag)='+_0x35cb82['tag'],'context':_0x2d2a7c['context'],'exten':_0x2d2a7c['exten'],'priority':_0x35cb82[_0xbf50('0x34')][_0xbf50('0x32')]+_0x275b93+_0x78ce0a++,'VoiceExtensionId':_0x2d2a7c['id']});}_0x78ebbd['push']({'type':_0x35cb82[_0xbf50('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0xbf50('0x38')+(_0x35cb82[_0xbf50('0x39')]?_0xbf50('0x3a')+_0x35cb82['callerID']+')':_0xbf50('0x3b')),'context':_0x2d2a7c['context'],'exten':_0x2d2a7c[_0xbf50('0x7')],'priority':_0x35cb82[_0xbf50('0x34')][_0xbf50('0x32')]+_0x275b93+_0x78ce0a++,'VoiceExtensionId':_0x2d2a7c['id']});}else{if(_0x35cb82[_0xbf50('0x1c')](_0xbf50('0x3c'))){if([_0xbf50('0x3d'),_0xbf50('0x3e')]['includes'](_0x35cb82[_0xbf50('0x3f')][_0xbf50('0x37')]())&&_0x35cb82['appType']!==_0xbf50('0x40')){if(_0x35cb82[_0xbf50('0x3c')]){_0x78ebbd[_0xbf50('0xc')]({'type':_0x35cb82[_0xbf50('0x3')][_0xbf50('0x37')](),'app':'ExecIf','appdata':_0xbf50('0x41'),'context':_0x2d2a7c[_0xbf50('0x6')],'exten':_0x2d2a7c[_0xbf50('0x7')],'priority':_0x35cb82[_0xbf50('0x34')][_0xbf50('0x32')]+_0x275b93+_0x78ce0a++,'VoiceExtensionId':_0x2d2a7c['id']});_0x78ebbd[_0xbf50('0xc')]({'type':_0x35cb82[_0xbf50('0x3')][_0xbf50('0x37')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2d2a7c[_0xbf50('0x6')],'exten':_0x2d2a7c[_0xbf50('0x7')],'priority':_0x35cb82[_0xbf50('0x34')][_0xbf50('0x32')]+_0x275b93+_0x78ce0a++,'VoiceExtensionId':_0x2d2a7c['id']});}else{_0x78ebbd[_0xbf50('0xc')]({'type':_0x35cb82[_0xbf50('0x3')][_0xbf50('0x37')](),'app':_0xbf50('0x17'),'appdata':_0xbf50('0x42'),'context':_0x2d2a7c['context'],'exten':_0x2d2a7c[_0xbf50('0x7')],'priority':_0x35cb82[_0xbf50('0x34')][_0xbf50('0x32')]+_0x275b93+_0x78ce0a++,'VoiceExtensionId':_0x2d2a7c['id']});_0x78ebbd[_0xbf50('0xc')]({'type':_0x35cb82[_0xbf50('0x3')]['toLowerCase'](),'app':_0xbf50('0x4'),'appdata':_0xbf50('0x43'),'context':_0x2d2a7c[_0xbf50('0x6')],'exten':_0x2d2a7c[_0xbf50('0x7')],'priority':_0x35cb82[_0xbf50('0x34')][_0xbf50('0x32')]+_0x275b93+_0x78ce0a++,'VoiceExtensionId':_0x2d2a7c['id']});}}}}for(var _0x21301b=0x0;_0x21301b<_0x35cb82['intervals']['length'];_0x21301b++){var _0x2c9851=_0x275b93+_0x35cb82[_0xbf50('0x34')]['length'];var _0x30b47a=_0x21301b===_0x35cb82['intervals']['length']-0x1?_0x275b93+_0x78ebbd[_0xbf50('0x32')]+_0x478944[_0xbf50('0x32')]+0x2:_0x275b93+_0x21301b+0x1;_0x78ebbd[_0xbf50('0x44')](_0x21301b,0x0,{'type':_0x2d2a7c[_0xbf50('0x3')],'app':_0xbf50('0x45'),'appdata':_0x35cb82[_0xbf50('0x34')][_0x21301b]+'?'+_0x2d2a7c[_0xbf50('0x6')]+',${EXTEN},'+_0x2c9851+':'+_0x2d2a7c[_0xbf50('0x6')]+_0xbf50('0x46')+_0x30b47a,'exten':_0x2d2a7c[_0xbf50('0x7')],'context':_0x2d2a7c[_0xbf50('0x6')],'priority':_0x275b93+_0x21301b,'VoiceExtensionId':_0x2d2a7c['id']});}if(_0x35cb82[_0xbf50('0x47')]==='outboundDial')_0x35cb82[_0xbf50('0x48')]=_0x37a0bf(_0x2d2a7c,_0x35cb82[_0xbf50('0x48')]);_0x35cb82[_0xbf50('0x49')]=_0x78ebbd[_0xbf50('0x32')]?_['last'](_0x78ebbd)[_0xbf50('0x49')]+0x1:_0x275b93;_0x50f8ee=_[_0xbf50('0x4a')](_0x50f8ee,_0x78ebbd,[_0x35cb82],_0x478944);_0x275b93=_['last'](_0x50f8ee)[_0xbf50('0x49')]+0x1;}return _0x2fd9dc(_0x50f8ee);})['catch'](function(_0x2cb4f8){_0x151d17(_0x2cb4f8);});});}return _0x389fbd[_0xbf50('0x4b')](_0xbf50('0x4c'),attributes,{'tableName':_0xbf50('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x465a27){var _0x576916=this[_0xbf50('0x4e')]({'plain':!![]});var _0x2460da=_0x576916[_0xbf50('0x3')]===_0xbf50('0x11')?_0x5be8ae(_0x576916):_0x443bf8(_0x576916);return _0x1bf881(_0x576916,_0x465a27,_[_0xbf50('0x4f')](_0x2460da)[_0xbf50('0x49')]+0x1)[_0xbf50('0x31')](function(_0x1eef49){var _0x47f63f=_['concat'](_0x2460da,_0x1eef49);_0x47f63f[_0xbf50('0xc')]({'type':_0x576916['type'],'app':_0xbf50('0x50'),'exten':_0x576916[_0xbf50('0x7')],'context':_0x576916[_0xbf50('0x6')],'priority':_[_0xbf50('0x4f')](_0x47f63f)['priority']+0x1,'VoiceExtensionId':_0x576916['id']});return _0x47f63f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 1083ef4..39a4e56 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 _0x2eb2=['./voiceExtension.socket','register','request','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x93e2f8,_0x3e7f1d){var _0x11119d=function(_0x40a92f){while(--_0x40a92f){_0x93e2f8['push'](_0x93e2f8['shift']());}};_0x11119d(++_0x3e7f1d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2eb2[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});config[_0x22eb('0xa')]=_[_0x22eb('0xb')](config[_0x22eb('0xa')],{'host':_0x22eb('0xc'),'port':0x18eb});var socket=require(_0x22eb('0xd'))(new Redis(config[_0x22eb('0xa')]));require(_0x22eb('0xe'))[_0x22eb('0xf')](socket);function respondWithRpcPromise(_0x3008e0,_0x489260,_0x46c197){return new BPromise(function(_0x54342e,_0x4ce9fb){return client[_0x22eb('0x10')](_0x3008e0,_0x46c197)['then'](function(_0x17b668){logger[_0x22eb('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x489260,'request\x20sent');logger[_0x22eb('0x12')](_0x22eb('0x13'),_0x489260,_0x22eb('0x14'),JSON[_0x22eb('0x15')](_0x17b668));if(_0x17b668[_0x22eb('0x16')]){if(_0x17b668['error'][_0x22eb('0x17')]===0x1f4){logger['error'](_0x22eb('0x18'),_0x489260,_0x17b668['error'][_0x22eb('0x19')]);return _0x4ce9fb(_0x17b668[_0x22eb('0x16')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x489260,_0x17b668[_0x22eb('0x16')]['message']);return _0x54342e(_0x17b668['error'][_0x22eb('0x19')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x489260,_0x22eb('0x14'));_0x54342e(_0x17b668[_0x22eb('0x1a')][_0x22eb('0x19')]);}})[_0x22eb('0x1b')](function(_0x3b0940){logger['error'](_0x22eb('0x18'),_0x489260,_0x3b0940);_0x4ce9fb(_0x3b0940);});});}exports[_0x22eb('0x1c')]=function(_0x10d182){var _0x410c25=this;return new Promise(function(_0x36be50,_0x517313){return db[_0x22eb('0x1d')][_0x22eb('0x1e')]({'raw':_0x10d182[_0x22eb('0x1f')]?_0x10d182['options']['raw']===undefined?!![]:![]:!![],'where':_0x10d182[_0x22eb('0x1f')]?_0x10d182[_0x22eb('0x1f')][_0x22eb('0x20')]||null:null,'attributes':_0x10d182[_0x22eb('0x1f')]?_0x10d182[_0x22eb('0x1f')][_0x22eb('0x21')]||null:null,'limit':_0x10d182[_0x22eb('0x1f')]?_0x10d182['options'][_0x22eb('0x22')]||null:null,'include':_0x10d182[_0x22eb('0x1f')]?_0x10d182[_0x22eb('0x1f')][_0x22eb('0x23')]?_[_0x22eb('0x24')](_0x10d182['options'][_0x22eb('0x23')],function(_0x6f8ff3){return{'model':db[_0x6f8ff3[_0x22eb('0x25')]],'as':_0x6f8ff3['as'],'attributes':_0x6f8ff3['attributes'],'include':_0x6f8ff3[_0x22eb('0x23')]?_[_0x22eb('0x24')](_0x6f8ff3['include'],function(_0x32a4b6){return{'model':db[_0x32a4b6[_0x22eb('0x25')]],'as':_0x32a4b6['as'],'attributes':_0x32a4b6[_0x22eb('0x21')],'include':_0x32a4b6[_0x22eb('0x23')]?_[_0x22eb('0x24')](_0x32a4b6['include'],function(_0x49dd59){return{'model':db[_0x49dd59[_0x22eb('0x25')]],'as':_0x49dd59['as'],'attributes':_0x49dd59[_0x22eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x22eb('0x26')](function(_0x7c0119){logger[_0x22eb('0x11')](_0x22eb('0x1c'),_0x10d182);logger[_0x22eb('0x12')](_0x22eb('0x1c'),_0x10d182,JSON[_0x22eb('0x15')](_0x7c0119));_0x36be50(_0x7c0119);})[_0x22eb('0x1b')](function(_0x24e9dc){logger[_0x22eb('0x16')]('GetVoiceExtension',_0x24e9dc[_0x22eb('0x19')],_0x10d182);_0x517313(_0x410c25['error'](0x1f4,_0x24e9dc[_0x22eb('0x19')]));});});}; \ No newline at end of file +var _0x56a4=['model','stringify','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','raw','options','limit','include','map','attributes'];(function(_0x1c7d93,_0x3c5644){var _0x2b51aa=function(_0x5c0d10){while(--_0x5c0d10){_0x1c7d93['push'](_0x1c7d93['shift']());}};_0x2b51aa(++_0x3c5644);}(_0x56a4,0x11b));var _0x456a=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0x56a4[_0x2338fa];return _0x42df9b;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x456a('0xa')],{'host':_0x456a('0xb'),'port':0x18eb});var socket=require(_0x456a('0xc'))(new Redis(config['redis']));require(_0x456a('0xd'))['register'](socket);function respondWithRpcPromise(_0xb56df,_0x29073f,_0x3bb712){return new BPromise(function(_0x3b57ac,_0x2706a7){return client[_0x456a('0xe')](_0xb56df,_0x3bb712)[_0x456a('0xf')](function(_0xe60506){logger[_0x456a('0x10')](_0x456a('0x11'),_0x29073f,_0x456a('0x12'));logger['debug'](_0x456a('0x13'),_0x29073f,'request\x20sent',JSON['stringify'](_0xe60506));if(_0xe60506[_0x456a('0x14')]){if(_0xe60506[_0x456a('0x14')][_0x456a('0x15')]===0x1f4){logger[_0x456a('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);return _0x2706a7(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}logger[_0x456a('0x14')](_0x456a('0x11'),_0x29073f,_0xe60506['error'][_0x456a('0x16')]);return _0x3b57ac(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}else{logger[_0x456a('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0x456a('0x12'));_0x3b57ac(_0xe60506[_0x456a('0x17')][_0x456a('0x16')]);}})['catch'](function(_0x3d06b4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0x3d06b4);_0x2706a7(_0x3d06b4);});});}exports[_0x456a('0x18')]=function(_0x562cfa){var _0x44d79a=this;return new Promise(function(_0x4b48bf,_0x962b6d){return db[_0x456a('0x19')]['findAll']({'raw':_0x562cfa['options']?_0x562cfa['options'][_0x456a('0x1a')]===undefined?!![]:![]:!![],'where':_0x562cfa[_0x456a('0x1b')]?_0x562cfa[_0x456a('0x1b')]['where']||null:null,'attributes':_0x562cfa[_0x456a('0x1b')]?_0x562cfa['options']['attributes']||null:null,'limit':_0x562cfa['options']?_0x562cfa[_0x456a('0x1b')][_0x456a('0x1c')]||null:null,'include':_0x562cfa[_0x456a('0x1b')]?_0x562cfa['options'][_0x456a('0x1d')]?_[_0x456a('0x1e')](_0x562cfa['options'][_0x456a('0x1d')],function(_0x561097){return{'model':db[_0x561097['model']],'as':_0x561097['as'],'attributes':_0x561097[_0x456a('0x1f')],'include':_0x561097['include']?_[_0x456a('0x1e')](_0x561097['include'],function(_0x1ee212){return{'model':db[_0x1ee212[_0x456a('0x20')]],'as':_0x1ee212['as'],'attributes':_0x1ee212[_0x456a('0x1f')],'include':_0x1ee212[_0x456a('0x1d')]?_[_0x456a('0x1e')](_0x1ee212[_0x456a('0x1d')],function(_0x46f3b3){return{'model':db[_0x46f3b3[_0x456a('0x20')]],'as':_0x46f3b3['as'],'attributes':_0x46f3b3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48205d){logger[_0x456a('0x10')](_0x456a('0x18'),_0x562cfa);logger['debug'](_0x456a('0x18'),_0x562cfa,JSON[_0x456a('0x21')](_0x48205d));_0x4b48bf(_0x48205d);})[_0x456a('0x22')](function(_0x336993){logger[_0x456a('0x14')]('GetVoiceExtension',_0x336993[_0x456a('0x16')],_0x562cfa);_0x962b6d(_0x44d79a[_0x456a('0x14')](0x1f4,_0x336993[_0x456a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index cb757c8..17d8259 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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x5a0aa3,_0x27af00){var _0x5d44d3=function(_0x21c071){while(--_0x21c071){_0x5a0aa3['push'](_0x5a0aa3['shift']());}};_0x5d44d3(++_0x27af00);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x5fc3[_0x1694f5];return _0x5b4321;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x13c241,_0x1aa643){var _0x12ab87=function(_0x212037){while(--_0x212037){_0x13c241['push'](_0x13c241['shift']());}};_0x12ab87(++_0x1aa643);}(_0x326f,0xd1));var _0xf326=function(_0x3032fd,_0x5944e7){_0x3032fd=_0x3032fd-0x0;var _0x7a0d4e=_0x326f[_0x3032fd];return _0x7a0d4e;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 28049f4..f243e30 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 _0x2a07=['getMessages','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0x2a07,0x74));var _0x72a0=function(_0x4051be,_0x4e30dc){_0x4051be=_0x4051be-0x0;var _0x10d8e5=_0x2a07[_0x4051be];return _0x10d8e5;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['post']('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x11')]);router['put'](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);router[_0x72a0('0x13')](_0x72a0('0xd'),auth['isAuthenticated'](),controller[_0x72a0('0x14')]);module[_0x72a0('0x15')]=router; \ No newline at end of file +var _0x323f=['show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id'];(function(_0x544093,_0x2386d4){var _0x5c6cbe=function(_0x1fc84d){while(--_0x1fc84d){_0x544093['push'](_0x544093['shift']());}};_0x5c6cbe(++_0x2386d4);}(_0x323f,0x1ee));var _0xf323=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x323f[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x13')](_0xf323('0xb'),auth['isAuthenticated'](),controller[_0xf323('0x14')]);module[_0xf323('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 388d933..3d61c3f 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 _0x351f=['email','string','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x351f,0x14e));var _0xf351=function(_0x2fdc9a,_0x183955){_0x2fdc9a=_0x2fdc9a-0x0;var _0x404d54=_0x351f[_0x2fdc9a];return _0x404d54;};'use strict';var Sequelize=require(_0xf351('0x0'));module[_0xf351('0x1')]={'customer_id':{'type':Sequelize[_0xf351('0x2')]},'context':{'type':Sequelize[_0xf351('0x2')],'defaultValue':_0xf351('0x3'),'unique':_0xf351('0x4')},'mailbox':{'type':Sequelize[_0xf351('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf351('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4bcda6){this[_0xf351('0x5')](_0xf351('0x6'),typeof _0x4bcda6===_0xf351('0x7')&&_0x4bcda6['trim']()?_0x4bcda6['trim']():null);}},'pager':{'type':Sequelize[_0xf351('0x2')]},'tz':{'type':Sequelize[_0xf351('0x2')],'defaultValue':_0xf351('0x8')},'attach':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':_0xf351('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':_0xf351('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf351('0x2')]},'callback':{'type':Sequelize[_0xf351('0x2')]},'review':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf351('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':_0xf351('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf351('0x9')](_0xf351('0xa'),'no'),'defaultValue':_0xf351('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xf351('0x2')]},'maxsecs':{'type':Sequelize[_0xf351('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf351('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf351('0xd')],'get':function(){return this[_0xf351('0xe')](_0xf351('0xf'))+_0xf351('0x10')+this[_0xf351('0xe')]('mailbox');}}}; \ No newline at end of file +var _0x5f21=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','STRING','from-voicemail','contest_mailbox'];(function(_0x51304a,_0x59885b){var _0x528982=function(_0x58ec7b){while(--_0x58ec7b){_0x51304a['push'](_0x51304a['shift']());}};_0x528982(++_0x59885b);}(_0x5f21,0x96));var _0x15f2=function(_0x46fc6c,_0x297637){_0x46fc6c=_0x46fc6c-0x0;var _0x18694f=_0x5f21[_0x46fc6c];return _0x18694f;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x15f2('0x0')],'defaultValue':_0x15f2('0x1'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x15f2('0x0')],'defaultValue':'','allowNull':![],'unique':_0x15f2('0x2')},'password':{'type':Sequelize[_0x15f2('0x0')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x15f2('0x0')],'validate':{'isEmail':!![]},'set':function(_0x1939b3){this[_0x15f2('0x3')](_0x15f2('0x4'),typeof _0x1939b3===_0x15f2('0x5')&&_0x1939b3['trim']()?_0x1939b3[_0x15f2('0x6')]():null);}},'pager':{'type':Sequelize[_0x15f2('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x15f2('0x7')},'attach':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':_0x15f2('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':_0x15f2('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x15f2('0x0')]},'callback':{'type':Sequelize[_0x15f2('0x0')]},'review':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x15f2('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x15f2('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x15f2('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x15f2('0x8')](_0x15f2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x15f2('0x9'),'no'),'defaultValue':_0x15f2('0x9'),'allowNull':![]},'stamp':{'type':_0x15f2('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x15f2('0x0')]},'maxsecs':{'type':Sequelize[_0x15f2('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x15f2('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x15f2('0xd')],'get':function(){return this['getDataValue'](_0x15f2('0xe'))+'\x20-\x20'+this[_0x15f2('0xf')](_0x15f2('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0c04094..4b244c2 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 _0x63a5=['index','map','VoiceMail','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','getMessages','VoiceMailMessage','sort','pick','mailbox','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','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','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0x21a51f,_0x445fbc){var _0x22ddd8=function(_0x932ab5){while(--_0x932ab5){_0x21a51f['push'](_0x21a51f['shift']());}};_0x22ddd8(++_0x445fbc);}(_0x63a5,0x18e));var _0x563a=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x63a5[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['VoiceMail'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));};exports[_0x563a('0x54')]=function(_0x16aa03,_0x3919a3,_0x1e275c){return db[_0x563a('0x31')]['findOne']({'where':{'id':_0x16aa03[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3919a3,null))['then'](function(_0x503896){var _0x402bdd;var _0x709bfd={},_0x579d61={};_0x579d61[_0x563a('0x35')]=_['keys'](db[_0x563a('0x55')][_0x563a('0x49')]);_0x579d61[_0x563a('0x36')]=_[_0x563a('0x48')](_0x16aa03[_0x563a('0x36')]);_0x579d61['filters']=_['intersection'](_0x579d61['model'],_0x579d61['query']);_0x709bfd[_0x563a('0x39')]=_['intersection'](_0x579d61[_0x563a('0x35')],qs['fields'](_0x16aa03[_0x563a('0x36')][_0x563a('0x3a')]));_0x709bfd[_0x563a('0x39')]=_0x709bfd[_0x563a('0x39')][_0x563a('0x3b')]?_0x709bfd['attributes']:_0x579d61[_0x563a('0x35')];if(!_0x16aa03['query']['hasOwnProperty'](_0x563a('0x3d'))){_0x709bfd[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1e')]);_0x709bfd['offset']=qs[_0x563a('0x1f')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1f')]);}_0x709bfd[_0x563a('0x3e')]=qs[_0x563a('0x56')](_0x16aa03['query'][_0x563a('0x56')]);_0x709bfd['where']=qs[_0x563a('0x37')](_[_0x563a('0x57')](_0x16aa03['query'],_0x579d61[_0x563a('0x37')]));if(_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]){_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'$or':_[_0x563a('0x30')](_0x709bfd[_0x563a('0x39')],function(_0x4cfa73){var _0x103c59={};_0x103c59[_0x4cfa73]={'$like':'%'+_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x103c59;})});}_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'mailboxuser':_0x503896[_0x563a('0x58')]});_0x709bfd=_['merge']({},_0x709bfd,_0x16aa03[_0x563a('0x42')]);return db['VoiceMailMessage']['findAndCountAll'](_0x709bfd)['then'](respondWithFilteredResult(_0x3919a3,_0x709bfd));})[_0x563a('0x45')](handleError(_0x3919a3,null));}; \ No newline at end of file +var _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x18f751,_0x3a52c6){var _0x2002ff=function(_0x4bbf65){while(--_0x4bbf65){_0x18f751['push'](_0x18f751['shift']());}};_0x2002ff(++_0x3a52c6);}(_0x9c00,0x1a0));var _0x09c0=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x9c00[_0x28509b];return _0x1e0b6;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 194f95a..b4e2f75 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 _0x9c23=['voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail'];(function(_0x205e8d,_0x2b0a2f){var _0x57b404=function(_0x46f846){while(--_0x46f846){_0x205e8d['push'](_0x205e8d['shift']());}};_0x57b404(++_0x2b0a2f);}(_0x9c23,0x1a7));var _0x39c2=function(_0x4e15f4,_0x5a72f2){_0x4e15f4=_0x4e15f4-0x0;var _0x5a9643=_0x9c23[_0x4e15f4];return _0x5a9643;};'use strict';var _=require(_0x39c2('0x0'));var util=require(_0x39c2('0x1'));var logger=require(_0x39c2('0x2'))('api');var moment=require(_0x39c2('0x3'));var BPromise=require(_0x39c2('0x4'));var rp=require(_0x39c2('0x5'));var fs=require('fs');var path=require(_0x39c2('0x6'));var rimraf=require(_0x39c2('0x7'));var config=require(_0x39c2('0x8'));var attributes=require(_0x39c2('0x9'));module['exports']=function(_0x5ad3e1,_0x431b17){return _0x5ad3e1['define'](_0x39c2('0xa'),attributes,{'tableName':_0x39c2('0xb'),'paranoid':![],'indexes':[{'name':_0x39c2('0xc'),'fields':['mailbox',_0x39c2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f1f=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0xc20f22,_0x49698f){var _0x1535d5=function(_0x5ce3f3){while(--_0x5ce3f3){_0xc20f22['push'](_0xc20f22['shift']());}};_0x1535d5(++_0x49698f);}(_0x9f1f,0x105));var _0xf9f1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x9f1f[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xf9f1('0x0'));var util=require(_0xf9f1('0x1'));var logger=require(_0xf9f1('0x2'))(_0xf9f1('0x3'));var moment=require('moment');var BPromise=require(_0xf9f1('0x4'));var rp=require(_0xf9f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9f1('0x6'));var config=require(_0xf9f1('0x7'));var attributes=require(_0xf9f1('0x8'));module[_0xf9f1('0x9')]=function(_0x5ac570,_0x3a3644){return _0x5ac570[_0xf9f1('0xa')](_0xf9f1('0xb'),attributes,{'tableName':_0xf9f1('0xc'),'paranoid':![],'indexes':[{'name':_0xf9f1('0xd'),'fields':[_0xf9f1('0xe'),_0xf9f1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a6636cb..832143f 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 _0xc4a1=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','VoiceMail,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x554651,_0x43f4e3){var _0x36499a=function(_0x402feb){while(--_0x402feb){_0x554651['push'](_0x554651['shift']());}};_0x36499a(++_0x43f4e3);}(_0xc4a1,0xe2));var _0x1c4a=function(_0x49fdc6,_0x2f58b6){_0x49fdc6=_0x49fdc6-0x0;var _0x339ee7=_0xc4a1[_0x49fdc6];return _0x339ee7;};'use strict';var _=require(_0x1c4a('0x0'));var util=require(_0x1c4a('0x1'));var moment=require(_0x1c4a('0x2'));var BPromise=require(_0x1c4a('0x3'));var rs=require(_0x1c4a('0x4'));var fs=require('fs');var Redis=require(_0x1c4a('0x5'));var db=require(_0x1c4a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c4a('0x7'))(_0x1c4a('0x8'));var config=require(_0x1c4a('0x9'));var jayson=require(_0x1c4a('0xa'));var client=jayson['client'][_0x1c4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22cb14,_0xe26ed1,_0x46cbb7){return new BPromise(function(_0x36da2d,_0x808fac){return client[_0x1c4a('0xc')](_0x22cb14,_0x46cbb7)['then'](function(_0x1b30e8){logger[_0x1c4a('0xd')]('VoiceMail,\x20%s,\x20%s',_0xe26ed1,_0x1c4a('0xe'));logger[_0x1c4a('0xf')](_0x1c4a('0x10'),_0xe26ed1,_0x1c4a('0xe'),JSON['stringify'](_0x1b30e8));if(_0x1b30e8[_0x1c4a('0x11')]){if(_0x1b30e8['error']['code']===0x1f4){logger['error'](_0x1c4a('0x12'),_0xe26ed1,_0x1b30e8['error']['message']);return _0x808fac(_0x1b30e8[_0x1c4a('0x11')][_0x1c4a('0x13')]);}logger['error'](_0x1c4a('0x12'),_0xe26ed1,_0x1b30e8[_0x1c4a('0x11')][_0x1c4a('0x13')]);return _0x36da2d(_0x1b30e8[_0x1c4a('0x11')][_0x1c4a('0x13')]);}else{logger[_0x1c4a('0xd')]('VoiceMail,\x20%s,\x20%s',_0xe26ed1,'request\x20sent');_0x36da2d(_0x1b30e8['result'][_0x1c4a('0x13')]);}})[_0x1c4a('0x14')](function(_0xe6a9fd){logger[_0x1c4a('0x11')](_0x1c4a('0x12'),_0xe26ed1,_0xe6a9fd);_0x808fac(_0xe6a9fd);});});} \ No newline at end of file +var _0xf44e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','bluebird','randomstring'];(function(_0x17cf3c,_0x1bc2d1){var _0x404606=function(_0x2dcb27){while(--_0x2dcb27){_0x17cf3c['push'](_0x17cf3c['shift']());}};_0x404606(++_0x1bc2d1);}(_0xf44e,0x16c));var _0xef44=function(_0x3a00b3,_0x4b735a){_0x3a00b3=_0x3a00b3-0x0;var _0x4f87b6=_0xf44e[_0x3a00b3];return _0x4f87b6;};'use strict';var _=require(_0xef44('0x0'));var util=require(_0xef44('0x1'));var moment=require('moment');var BPromise=require(_0xef44('0x2'));var rs=require(_0xef44('0x3'));var fs=require('fs');var Redis=require(_0xef44('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef44('0x5'));var logger=require(_0xef44('0x6'))(_0xef44('0x7'));var config=require(_0xef44('0x8'));var jayson=require(_0xef44('0x9'));var client=jayson[_0xef44('0xa')][_0xef44('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35286e,_0x461c96,_0x5b77e2){return new BPromise(function(_0x556627,_0x545a12){return client[_0xef44('0xc')](_0x35286e,_0x5b77e2)[_0xef44('0xd')](function(_0x189eeb){logger['info'](_0xef44('0xe'),_0x461c96,'request\x20sent');logger[_0xef44('0xf')](_0xef44('0x10'),_0x461c96,_0xef44('0x11'),JSON[_0xef44('0x12')](_0x189eeb));if(_0x189eeb[_0xef44('0x13')]){if(_0x189eeb['error'][_0xef44('0x14')]===0x1f4){logger[_0xef44('0x13')](_0xef44('0xe'),_0x461c96,_0x189eeb['error'][_0xef44('0x15')]);return _0x545a12(_0x189eeb['error']['message']);}logger[_0xef44('0x13')]('VoiceMail,\x20%s,\x20%s',_0x461c96,_0x189eeb['error'][_0xef44('0x15')]);return _0x556627(_0x189eeb[_0xef44('0x13')]['message']);}else{logger[_0xef44('0x16')]('VoiceMail,\x20%s,\x20%s',_0x461c96,_0xef44('0x11'));_0x556627(_0x189eeb['result'][_0xef44('0x15')]);}})['catch'](function(_0x1e986f){logger[_0xef44('0x13')](_0xef44('0xe'),_0x461c96,_0x1e986f);_0x545a12(_0x1e986f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 933eaed..b7095c7 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 _0x8da9=['/:id/download','isAuthenticated','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','index','get','/:id','show'];(function(_0xfeb954,_0xd99ee9){var _0x4e0ebf=function(_0x54d90b){while(--_0x54d90b){_0xfeb954['push'](_0xfeb954['shift']());}};_0x4e0ebf(++_0xd99ee9);}(_0x8da9,0x181));var _0x98da=function(_0x52713c,_0x5eee67){_0x52713c=_0x52713c-0x0;var _0x54d575=_0x8da9[_0x52713c];return _0x54d575;};'use strict';var multer=require(_0x98da('0x0'));var util=require(_0x98da('0x1'));var path=require(_0x98da('0x2'));var timeout=require(_0x98da('0x3'));var express=require(_0x98da('0x4'));var router=express[_0x98da('0x5')]();var fs_extra=require(_0x98da('0x6'));var auth=require(_0x98da('0x7'));var interaction=require(_0x98da('0x8'));var config=require(_0x98da('0x9'));var controller=require(_0x98da('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x98da('0xb')]);router[_0x98da('0xc')](_0x98da('0xd'),auth['isAuthenticated'](),controller[_0x98da('0xe')]);router['get'](_0x98da('0xf'),auth[_0x98da('0x10')](),controller[_0x98da('0x11')]);router[_0x98da('0x12')]('/',auth[_0x98da('0x10')](),controller[_0x98da('0x13')]);router[_0x98da('0x14')](_0x98da('0xd'),auth['isAuthenticated'](),controller[_0x98da('0x15')]);router[_0x98da('0x16')](_0x98da('0xd'),auth[_0x98da('0x10')](),controller[_0x98da('0x17')]);module[_0x98da('0x18')]=router; \ No newline at end of file +var _0xb9b6=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id/download','create','update','delete','destroy'];(function(_0x447ad8,_0x410b9d){var _0x545ef2=function(_0x2cbca6){while(--_0x2cbca6){_0x447ad8['push'](_0x447ad8['shift']());}};_0x545ef2(++_0x410b9d);}(_0xb9b6,0x121));var _0x6b9b=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0xb9b6[_0x3c6b7d];return _0x1d3ed2;};'use strict';var multer=require('multer');var util=require(_0x6b9b('0x0'));var path=require(_0x6b9b('0x1'));var timeout=require(_0x6b9b('0x2'));var express=require(_0x6b9b('0x3'));var router=express['Router']();var fs_extra=require(_0x6b9b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6b9b('0x5'));var config=require('../../config/environment');var controller=require(_0x6b9b('0x6'));router['get']('/',auth[_0x6b9b('0x7')](),controller[_0x6b9b('0x8')]);router[_0x6b9b('0x9')]('/:id',auth[_0x6b9b('0x7')](),controller['show']);router[_0x6b9b('0x9')](_0x6b9b('0xa'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x6b9b('0x7')](),controller[_0x6b9b('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6b9b('0xc')]);router[_0x6b9b('0xd')]('/:id',auth[_0x6b9b('0x7')](),controller[_0x6b9b('0xe')]);module[_0x6b9b('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 258e77c..7e23585 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 _0x6a95=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x47c75a,_0x447086){var _0x1e6f62=function(_0x1a2907){while(--_0x1a2907){_0x47c75a['push'](_0x47c75a['shift']());}};_0x1e6f62(++_0x447086);}(_0x6a95,0x192));var _0x56a9=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x6a95[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4f58ee){return this[_0x56a9('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x56a9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x56a9('0x5')](_0x56a9('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x56a9('0x7'),'defaultValue':Sequelize[_0x56a9('0x8')](_0x56a9('0x9'))}}; \ No newline at end of file +var _0x89da=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x30cdf0,_0x30cdeb){var _0x593dcc=function(_0x4c2a80){while(--_0x4c2a80){_0x30cdf0['push'](_0x30cdf0['shift']());}};_0x593dcc(++_0x30cdeb);}(_0x89da,0xf4));var _0xa89d=function(_0x30b907,_0x17460f){_0x30b907=_0x30b907-0x0;var _0x47f26a=_0x89da[_0x30b907];return _0x47f26a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa89d('0x0')],'get':function(_0x65419b){return this[_0xa89d('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xa89d('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa89d('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa89d('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xa89d('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa89d('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa89d('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xa89d('0x4')](_0xa89d('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xa89d('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa89d('0x3')],'defaultValue':''},'stamp':{'type':_0xa89d('0x6'),'defaultValue':Sequelize[_0xa89d('0x7')](_0xa89d('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ccc75cc..d6746bc 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 _0xb9ce=['name','send','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','VoiceMailMessage','includeAll','include','rows','catch','show','params','merge','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x179177,_0x5da1a3){var _0x4cead7=function(_0x4dc6b7){while(--_0x4dc6b7){_0x179177['push'](_0x179177['shift']());}};_0x4cead7(++_0x5da1a3);}(_0xb9ce,0x1e0));var _0xeb9c=function(_0x490291,_0x44769a){_0x490291=_0x490291-0x0;var _0x23a2e4=_0xb9ce[_0x490291];return _0x23a2e4;};'use strict';var emlformat=require(_0xeb9c('0x0'));var rimraf=require(_0xeb9c('0x1'));var zipdir=require(_0xeb9c('0x2'));var jsonpatch=require(_0xeb9c('0x3'));var rp=require('request-promise');var moment=require(_0xeb9c('0x4'));var BPromise=require(_0xeb9c('0x5'));var Mustache=require(_0xeb9c('0x6'));var util=require(_0xeb9c('0x7'));var path=require(_0xeb9c('0x8'));var sox=require(_0xeb9c('0x9'));var csv=require(_0xeb9c('0xa'));var ejs=require(_0xeb9c('0xb'));var fs=require('fs');var fs_extra=require(_0xeb9c('0xc'));var _=require(_0xeb9c('0xd'));var squel=require(_0xeb9c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb9c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb9c('0x10'));var Papa=require(_0xeb9c('0x11'));var Redis=require(_0xeb9c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xeb9c('0x13'));var as=require(_0xeb9c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb9c('0x15'))(_0xeb9c('0x16'));var utils=require(_0xeb9c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9c('0x18'));var db=require(_0xeb9c('0x19'))['db'];function respondWithStatusCode(_0x50a23e,_0x546b83){_0x546b83=_0x546b83||0xcc;return function(_0x3ba9f3){if(_0x3ba9f3){return _0x50a23e['sendStatus'](_0x546b83);}return _0x50a23e[_0xeb9c('0x1a')](_0x546b83)[_0xeb9c('0x1b')]();};}function respondWithResult(_0x394e84,_0x1249f8){_0x1249f8=_0x1249f8||0xc8;return function(_0x5162b5){if(_0x5162b5){return _0x394e84[_0xeb9c('0x1a')](_0x1249f8)[_0xeb9c('0x1c')](_0x5162b5);}};}function respondWithFilteredResult(_0x34655e,_0x2c7143){return function(_0x5aa1b2){if(_0x5aa1b2){var _0x223f8f=typeof _0x2c7143[_0xeb9c('0x1d')]===_0xeb9c('0x1e')&&typeof _0x2c7143[_0xeb9c('0x1f')]===_0xeb9c('0x1e');var _0x229e54=_0x5aa1b2[_0xeb9c('0x20')];var _0x3be09f=_0x223f8f?0x0:_0x2c7143[_0xeb9c('0x1d')];var _0x1a5c9f=_0x223f8f?_0x5aa1b2[_0xeb9c('0x20')]:_0x2c7143['offset']+_0x2c7143[_0xeb9c('0x1f')];var _0x3881c7;if(_0x1a5c9f>=_0x229e54){_0x1a5c9f=_0x229e54;_0x3881c7=0xc8;}else{_0x3881c7=0xce;}_0x34655e[_0xeb9c('0x1a')](_0x3881c7);return _0x34655e[_0xeb9c('0x21')](_0xeb9c('0x22'),_0x3be09f+'-'+_0x1a5c9f+'/'+_0x229e54)['json'](_0x5aa1b2);}return null;};}function patchUpdates(_0xf2a997){return function(_0x5a5b9b){try{jsonpatch[_0xeb9c('0x23')](_0x5a5b9b,_0xf2a997,!![]);}catch(_0x4553de){return BPromise[_0xeb9c('0x24')](_0x4553de);}return _0x5a5b9b[_0xeb9c('0x25')]();};}function saveUpdates(_0x36d4e1,_0xf05f0f){return function(_0x127d22){if(_0x127d22){return _0x127d22[_0xeb9c('0x26')](_0x36d4e1)[_0xeb9c('0x27')](function(_0x40eae0){return _0x40eae0;});}return null;};}function removeEntity(_0x39ba98,_0x31129a){return function(_0x109e6c){if(_0x109e6c){return _0x109e6c[_0xeb9c('0x28')]()[_0xeb9c('0x27')](function(){_0x39ba98[_0xeb9c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3638c1,_0x29dc63){return function(_0x326ef2){if(!_0x326ef2){_0x3638c1[_0xeb9c('0x29')](0x194);}return _0x326ef2;};}function handleError(_0x1a6615,_0x4e46f9){_0x4e46f9=_0x4e46f9||0x1f4;return function(_0x1ed618){logger['error'](_0x1ed618['stack']);if(_0x1ed618[_0xeb9c('0x2a')]){delete _0x1ed618['name'];}_0x1a6615[_0xeb9c('0x1a')](_0x4e46f9)[_0xeb9c('0x2b')](_0x1ed618);};}exports['index']=function(_0x5e3cf5,_0x45c15c){var _0x105eb8={},_0x3812ab={},_0x1a689f={'count':0x0,'rows':[]};var _0x31c23c=_[_0xeb9c('0x2c')](db['VoiceMailMessage'][_0xeb9c('0x2d')],function(_0x192f25){return{'name':_0x192f25[_0xeb9c('0x2e')],'type':_0x192f25[_0xeb9c('0x2f')][_0xeb9c('0x30')]};});_0x3812ab['model']=_[_0xeb9c('0x31')](_['map'](_0x31c23c,_0xeb9c('0x2a')),[_0xeb9c('0x2a')]);_0x3812ab[_0xeb9c('0x32')]=_[_0xeb9c('0x33')](_0x5e3cf5['query']);_0x3812ab['filters']=_[_0xeb9c('0x34')](_0x3812ab[_0xeb9c('0x35')],_0x3812ab['query']);_0x105eb8[_0xeb9c('0x36')]=_['intersection'](_0x3812ab[_0xeb9c('0x35')],qs[_0xeb9c('0x37')](_0x5e3cf5[_0xeb9c('0x32')]['fields']));_0x105eb8[_0xeb9c('0x36')]=_0x105eb8[_0xeb9c('0x36')][_0xeb9c('0x38')]?_0x105eb8[_0xeb9c('0x36')]:_0x3812ab[_0xeb9c('0x35')];if(!_0x5e3cf5[_0xeb9c('0x32')][_0xeb9c('0x39')]('nolimit')){_0x105eb8[_0xeb9c('0x1f')]=qs['limit'](_0x5e3cf5[_0xeb9c('0x32')][_0xeb9c('0x1f')]);_0x105eb8[_0xeb9c('0x1d')]=qs[_0xeb9c('0x1d')](_0x5e3cf5[_0xeb9c('0x32')][_0xeb9c('0x1d')]);}_0x105eb8[_0xeb9c('0x3a')]=qs['sort'](_0x5e3cf5['query'][_0xeb9c('0x3b')]);_0x105eb8[_0xeb9c('0x3c')]=qs[_0xeb9c('0x3d')](_[_0xeb9c('0x3e')](_0x5e3cf5[_0xeb9c('0x32')],_0x3812ab[_0xeb9c('0x3d')]),_0x31c23c);if(_0x5e3cf5[_0xeb9c('0x32')][_0xeb9c('0x3f')]){_0x105eb8['where']=_['merge'](_0x105eb8[_0xeb9c('0x3c')],{'$or':_[_0xeb9c('0x2c')](_0x31c23c,function(_0x27a0a4){if(_0x27a0a4[_0xeb9c('0x2f')]!==_0xeb9c('0x40')){var _0x1f66b6={};_0x1f66b6[_0x27a0a4['name']]={'$like':'%'+_0x5e3cf5[_0xeb9c('0x32')][_0xeb9c('0x3f')]+'%'};return _0x1f66b6;}})});}_0x105eb8=_['merge']({},_0x105eb8,_0x5e3cf5['options']);var _0x168600={'where':_0x105eb8['where']};return db[_0xeb9c('0x41')][_0xeb9c('0x20')](_0x168600)[_0xeb9c('0x27')](function(_0x5a1004){_0x1a689f[_0xeb9c('0x20')]=_0x5a1004;if(_0x5e3cf5[_0xeb9c('0x32')][_0xeb9c('0x42')]){_0x105eb8[_0xeb9c('0x43')]=[{'all':!![]}];}return db[_0xeb9c('0x41')]['findAll'](_0x105eb8);})[_0xeb9c('0x27')](function(_0x431725){_0x1a689f[_0xeb9c('0x44')]=_0x431725;return _0x1a689f;})['then'](respondWithFilteredResult(_0x45c15c,_0x105eb8))[_0xeb9c('0x45')](handleError(_0x45c15c,null));};exports[_0xeb9c('0x46')]=function(_0x1d26ea,_0x189f1f){var _0x31e814={'raw':!![],'where':{'id':_0x1d26ea[_0xeb9c('0x47')]['id']}},_0x53d2e9={};_0x53d2e9[_0xeb9c('0x35')]=_[_0xeb9c('0x33')](db[_0xeb9c('0x41')]['rawAttributes']);_0x53d2e9['query']=_[_0xeb9c('0x33')](_0x1d26ea[_0xeb9c('0x32')]);_0x53d2e9[_0xeb9c('0x3d')]=_['intersection'](_0x53d2e9[_0xeb9c('0x35')],_0x53d2e9[_0xeb9c('0x32')]);_0x31e814[_0xeb9c('0x36')]=_['intersection'](_0x53d2e9[_0xeb9c('0x35')],qs['fields'](_0x1d26ea[_0xeb9c('0x32')]['fields']));_0x31e814[_0xeb9c('0x36')]=_0x31e814[_0xeb9c('0x36')][_0xeb9c('0x38')]?_0x31e814['attributes']:_0x53d2e9[_0xeb9c('0x35')];if(_0x1d26ea[_0xeb9c('0x32')][_0xeb9c('0x42')]){_0x31e814[_0xeb9c('0x43')]=[{'all':!![]}];}_0x31e814=_[_0xeb9c('0x48')]({},_0x31e814,_0x1d26ea[_0xeb9c('0x49')]);return db[_0xeb9c('0x41')][_0xeb9c('0x4a')](_0x31e814)['then'](handleEntityNotFound(_0x189f1f,null))[_0xeb9c('0x27')](respondWithResult(_0x189f1f,null))[_0xeb9c('0x45')](handleError(_0x189f1f,null));};exports[_0xeb9c('0x4b')]=function(_0x41dedc,_0x3f9b1b){return db['VoiceMailMessage'][_0xeb9c('0x4b')](_0x41dedc[_0xeb9c('0x4c')],{})[_0xeb9c('0x27')](respondWithResult(_0x3f9b1b,0xc9))['catch'](handleError(_0x3f9b1b,null));};exports[_0xeb9c('0x26')]=function(_0x4571ce,_0x474d87){if(_0x4571ce['body']['id']){delete _0x4571ce['body']['id'];}return db['VoiceMailMessage'][_0xeb9c('0x4a')]({'where':{'id':_0x4571ce[_0xeb9c('0x47')]['id']}})[_0xeb9c('0x27')](handleEntityNotFound(_0x474d87,null))[_0xeb9c('0x27')](saveUpdates(_0x4571ce[_0xeb9c('0x4c')],null))[_0xeb9c('0x27')](respondWithResult(_0x474d87,null))[_0xeb9c('0x45')](handleError(_0x474d87,null));};exports[_0xeb9c('0x28')]=function(_0x184f3d,_0x4e5b79){return db['VoiceMailMessage'][_0xeb9c('0x4a')]({'where':{'id':_0x184f3d[_0xeb9c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e5b79,null))[_0xeb9c('0x27')](removeEntity(_0x4e5b79,null))[_0xeb9c('0x45')](handleError(_0x4e5b79,null));};exports[_0xeb9c('0x4d')]=function(_0x13850b,_0x207060,_0x2b9245){return db[_0xeb9c('0x41')][_0xeb9c('0x4a')]({'where':{'id':_0x13850b[_0xeb9c('0x47')]['id']},'attributes':['id',_0xeb9c('0x4e'),_0xeb9c('0x4f')]})['then'](handleEntityNotFound(_0x207060,null))[_0xeb9c('0x27')](function(_0x257c45){if(_0x257c45){if(!_0x257c45[_0xeb9c('0x4e')]){throw new db[(_0xeb9c('0x50'))][(_0xeb9c('0x51'))](_0xeb9c('0x52'));}var _0x1d68e8={'Content-Type':_0xeb9c('0x53'),'Content-Disposition':'attachment'};if(_0x257c45[_0xeb9c('0x4f')]){_0x1d68e8[_0xeb9c('0x54')]=_0xeb9c('0x55')+_0x257c45['msg_id']+_0xeb9c('0x56');}_0x207060['set'](_0x1d68e8);return _0x207060['send'](new Buffer(_0x257c45['recording']));}})['catch'](handleError(_0x207060,null));}; \ No newline at end of file +var _0xb81f=['sort','where','pick','filter','merge','options','count','includeAll','include','VoiceMailMessage','show','params','length','find','catch','create','body','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3c2e6b,_0x12f686){var _0x4ddeb7=function(_0x5d8a22){while(--_0x5d8a22){_0x3c2e6b['push'](_0x3c2e6b['shift']());}};_0x4ddeb7(++_0x12f686);}(_0xb81f,0xb8));var _0xfb81=function(_0x2d58e6,_0x55cb14){_0x2d58e6=_0x2d58e6-0x0;var _0x5bcd81=_0xb81f[_0x2d58e6];return _0x5bcd81;};'use strict';var emlformat=require(_0xfb81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb81('0x1'));var jsonpatch=require(_0xfb81('0x2'));var rp=require(_0xfb81('0x3'));var moment=require(_0xfb81('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb81('0x5'));var path=require(_0xfb81('0x6'));var sox=require('sox');var csv=require(_0xfb81('0x7'));var ejs=require(_0xfb81('0x8'));var fs=require('fs');var fs_extra=require(_0xfb81('0x9'));var _=require(_0xfb81('0xa'));var squel=require(_0xfb81('0xb'));var crypto=require(_0xfb81('0xc'));var jsforce=require(_0xfb81('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfb81('0x7'));var querystring=require(_0xfb81('0xe'));var Papa=require(_0xfb81('0xf'));var Redis=require(_0xfb81('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfb81('0x11'));var as=require(_0xfb81('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfb81('0x13'));var config=require(_0xfb81('0x14'));var licenseUtil=require(_0xfb81('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21d292,_0x1ec0c1){_0x1ec0c1=_0x1ec0c1||0xcc;return function(_0x731edf){if(_0x731edf){return _0x21d292[_0xfb81('0x16')](_0x1ec0c1);}return _0x21d292[_0xfb81('0x17')](_0x1ec0c1)['end']();};}function respondWithResult(_0x5bbfb0,_0x54c92b){_0x54c92b=_0x54c92b||0xc8;return function(_0x1ce700){if(_0x1ce700){return _0x5bbfb0['status'](_0x54c92b)[_0xfb81('0x18')](_0x1ce700);}};}function respondWithFilteredResult(_0x52838b,_0x594f48){return function(_0x1f29aa){if(_0x1f29aa){var _0x2e2eb5=typeof _0x594f48[_0xfb81('0x19')]===_0xfb81('0x1a')&&typeof _0x594f48['limit']==='undefined';var _0x239a9a=_0x1f29aa['count'];var _0x174ece=_0x2e2eb5?0x0:_0x594f48[_0xfb81('0x19')];var _0x1078ab=_0x2e2eb5?_0x1f29aa['count']:_0x594f48[_0xfb81('0x19')]+_0x594f48[_0xfb81('0x1b')];var _0x4f744c;if(_0x1078ab>=_0x239a9a){_0x1078ab=_0x239a9a;_0x4f744c=0xc8;}else{_0x4f744c=0xce;}_0x52838b[_0xfb81('0x17')](_0x4f744c);return _0x52838b[_0xfb81('0x1c')](_0xfb81('0x1d'),_0x174ece+'-'+_0x1078ab+'/'+_0x239a9a)[_0xfb81('0x18')](_0x1f29aa);}return null;};}function patchUpdates(_0x1a0599){return function(_0x2698db){try{jsonpatch[_0xfb81('0x1e')](_0x2698db,_0x1a0599,!![]);}catch(_0x3e4218){return BPromise[_0xfb81('0x1f')](_0x3e4218);}return _0x2698db[_0xfb81('0x20')]();};}function saveUpdates(_0x3f8bc4,_0x277ecd){return function(_0x36b894){if(_0x36b894){return _0x36b894[_0xfb81('0x21')](_0x3f8bc4)[_0xfb81('0x22')](function(_0x62e0fa){return _0x62e0fa;});}return null;};}function removeEntity(_0x4e8099,_0x2a5e07){return function(_0x163859){if(_0x163859){return _0x163859[_0xfb81('0x23')]()[_0xfb81('0x22')](function(){_0x4e8099[_0xfb81('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc883be,_0x56a846){return function(_0x209d5e){if(!_0x209d5e){_0xc883be['sendStatus'](0x194);}return _0x209d5e;};}function handleError(_0x5f2fa4,_0x3a346c){_0x3a346c=_0x3a346c||0x1f4;return function(_0xefcf4c){logger[_0xfb81('0x24')](_0xefcf4c[_0xfb81('0x25')]);if(_0xefcf4c['name']){delete _0xefcf4c[_0xfb81('0x26')];}_0x5f2fa4[_0xfb81('0x17')](_0x3a346c)[_0xfb81('0x27')](_0xefcf4c);};}exports[_0xfb81('0x28')]=function(_0x522f46,_0x4452b4){var _0x45e9d7={},_0x3cf9de={},_0x4a36c6={'count':0x0,'rows':[]};var _0x23e77a=_['map'](db['VoiceMailMessage'][_0xfb81('0x29')],function(_0x24cff6){return{'name':_0x24cff6[_0xfb81('0x2a')],'type':_0x24cff6[_0xfb81('0x2b')][_0xfb81('0x2c')]};});_0x3cf9de[_0xfb81('0x2d')]=_[_0xfb81('0x2e')](_[_0xfb81('0x2f')](_0x23e77a,_0xfb81('0x26')),['name']);_0x3cf9de[_0xfb81('0x30')]=_[_0xfb81('0x31')](_0x522f46[_0xfb81('0x30')]);_0x3cf9de[_0xfb81('0x32')]=_[_0xfb81('0x33')](_0x3cf9de[_0xfb81('0x2d')],_0x3cf9de[_0xfb81('0x30')]);_0x45e9d7[_0xfb81('0x34')]=_[_0xfb81('0x33')](_0x3cf9de[_0xfb81('0x2d')],qs[_0xfb81('0x35')](_0x522f46[_0xfb81('0x30')]['fields']));_0x45e9d7[_0xfb81('0x34')]=_0x45e9d7[_0xfb81('0x34')]['length']?_0x45e9d7[_0xfb81('0x34')]:_0x3cf9de[_0xfb81('0x2d')];if(!_0x522f46[_0xfb81('0x30')][_0xfb81('0x36')](_0xfb81('0x37'))){_0x45e9d7['limit']=qs['limit'](_0x522f46[_0xfb81('0x30')][_0xfb81('0x1b')]);_0x45e9d7['offset']=qs[_0xfb81('0x19')](_0x522f46[_0xfb81('0x30')]['offset']);}_0x45e9d7['order']=qs['sort'](_0x522f46[_0xfb81('0x30')][_0xfb81('0x38')]);_0x45e9d7[_0xfb81('0x39')]=qs[_0xfb81('0x32')](_[_0xfb81('0x3a')](_0x522f46[_0xfb81('0x30')],_0x3cf9de[_0xfb81('0x32')]),_0x23e77a);if(_0x522f46[_0xfb81('0x30')][_0xfb81('0x3b')]){_0x45e9d7[_0xfb81('0x39')]=_[_0xfb81('0x3c')](_0x45e9d7[_0xfb81('0x39')],{'$or':_[_0xfb81('0x2f')](_0x23e77a,function(_0x2ccfbb){if(_0x2ccfbb[_0xfb81('0x2b')]!=='VIRTUAL'){var _0x11f8f7={};_0x11f8f7[_0x2ccfbb[_0xfb81('0x26')]]={'$like':'%'+_0x522f46[_0xfb81('0x30')]['filter']+'%'};return _0x11f8f7;}})});}_0x45e9d7=_[_0xfb81('0x3c')]({},_0x45e9d7,_0x522f46[_0xfb81('0x3d')]);var _0x58d97e={'where':_0x45e9d7[_0xfb81('0x39')]};return db['VoiceMailMessage']['count'](_0x58d97e)[_0xfb81('0x22')](function(_0x28ff30){_0x4a36c6[_0xfb81('0x3e')]=_0x28ff30;if(_0x522f46['query'][_0xfb81('0x3f')]){_0x45e9d7[_0xfb81('0x40')]=[{'all':!![]}];}return db[_0xfb81('0x41')]['findAll'](_0x45e9d7);})[_0xfb81('0x22')](function(_0x55ceb8){_0x4a36c6['rows']=_0x55ceb8;return _0x4a36c6;})[_0xfb81('0x22')](respondWithFilteredResult(_0x4452b4,_0x45e9d7))['catch'](handleError(_0x4452b4,null));};exports[_0xfb81('0x42')]=function(_0x19c500,_0x83ff1b){var _0x4d0d6d={'raw':!![],'where':{'id':_0x19c500[_0xfb81('0x43')]['id']}},_0x18cdea={};_0x18cdea['model']=_[_0xfb81('0x31')](db[_0xfb81('0x41')][_0xfb81('0x29')]);_0x18cdea[_0xfb81('0x30')]=_['keys'](_0x19c500[_0xfb81('0x30')]);_0x18cdea['filters']=_[_0xfb81('0x33')](_0x18cdea[_0xfb81('0x2d')],_0x18cdea[_0xfb81('0x30')]);_0x4d0d6d['attributes']=_[_0xfb81('0x33')](_0x18cdea[_0xfb81('0x2d')],qs[_0xfb81('0x35')](_0x19c500[_0xfb81('0x30')][_0xfb81('0x35')]));_0x4d0d6d[_0xfb81('0x34')]=_0x4d0d6d[_0xfb81('0x34')][_0xfb81('0x44')]?_0x4d0d6d['attributes']:_0x18cdea[_0xfb81('0x2d')];if(_0x19c500['query'][_0xfb81('0x3f')]){_0x4d0d6d[_0xfb81('0x40')]=[{'all':!![]}];}_0x4d0d6d=_['merge']({},_0x4d0d6d,_0x19c500['options']);return db[_0xfb81('0x41')][_0xfb81('0x45')](_0x4d0d6d)[_0xfb81('0x22')](handleEntityNotFound(_0x83ff1b,null))[_0xfb81('0x22')](respondWithResult(_0x83ff1b,null))[_0xfb81('0x46')](handleError(_0x83ff1b,null));};exports[_0xfb81('0x47')]=function(_0x2202c1,_0x4e04c6){return db[_0xfb81('0x41')][_0xfb81('0x47')](_0x2202c1['body'],{})['then'](respondWithResult(_0x4e04c6,0xc9))[_0xfb81('0x46')](handleError(_0x4e04c6,null));};exports['update']=function(_0x4bc863,_0x588451){if(_0x4bc863[_0xfb81('0x48')]['id']){delete _0x4bc863['body']['id'];}return db[_0xfb81('0x41')][_0xfb81('0x45')]({'where':{'id':_0x4bc863['params']['id']}})[_0xfb81('0x22')](handleEntityNotFound(_0x588451,null))[_0xfb81('0x22')](saveUpdates(_0x4bc863[_0xfb81('0x48')],null))[_0xfb81('0x22')](respondWithResult(_0x588451,null))[_0xfb81('0x46')](handleError(_0x588451,null));};exports[_0xfb81('0x23')]=function(_0x4cba88,_0x30acff){return db['VoiceMailMessage'][_0xfb81('0x45')]({'where':{'id':_0x4cba88['params']['id']}})[_0xfb81('0x22')](handleEntityNotFound(_0x30acff,null))[_0xfb81('0x22')](removeEntity(_0x30acff,null))['catch'](handleError(_0x30acff,null));};exports['download']=function(_0x17c1a3,_0x25ad74,_0x1796f9){return db[_0xfb81('0x41')][_0xfb81('0x45')]({'where':{'id':_0x17c1a3[_0xfb81('0x43')]['id']},'attributes':['id',_0xfb81('0x49'),_0xfb81('0x4a')]})['then'](handleEntityNotFound(_0x25ad74,null))[_0xfb81('0x22')](function(_0x47980e){if(_0x47980e){if(!_0x47980e['recording']){throw new db[(_0xfb81('0x4b'))]['ValidationError'](_0xfb81('0x4c'));}var _0x1e5f70={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x47980e[_0xfb81('0x4a')]){_0x1e5f70[_0xfb81('0x4d')]=_0xfb81('0x4e')+_0x47980e[_0xfb81('0x4a')]+_0xfb81('0x4f');}_0x25ad74[_0xfb81('0x1c')](_0x1e5f70);return _0x25ad74['send'](new Buffer(_0x47980e['recording']));}})[_0xfb81('0x46')](handleError(_0x25ad74,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f30f34d..6f4064a 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 _0xe0ac=['dir','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages'];(function(_0x1a76f1,_0x25a5d6){var _0x3c78f6=function(_0xbe0689){while(--_0xbe0689){_0x1a76f1['push'](_0x1a76f1['shift']());}};_0x3c78f6(++_0x25a5d6);}(_0xe0ac,0x139));var _0xce0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0ac[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xce0a('0x0'));var util=require('util');var logger=require(_0xce0a('0x1'))(_0xce0a('0x2'));var moment=require(_0xce0a('0x3'));var BPromise=require(_0xce0a('0x4'));var rp=require(_0xce0a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce0a('0x6'));var config=require(_0xce0a('0x7'));var attributes=require(_0xce0a('0x8'));module['exports']=function(_0x414ac4,_0x3f94cf){return _0x414ac4['define'](_0xce0a('0x9'),attributes,{'tableName':_0xce0a('0xa'),'paranoid':![],'indexes':[{'name':_0xce0a('0xb'),'fields':[_0xce0a('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x424f=['api','moment','bluebird','request-promise','rimraf','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x424f,0x1c1));var _0xf424=function(_0xfdf726,_0x13eb73){_0xfdf726=_0xfdf726-0x0;var _0xb7eb05=_0x424f[_0xfdf726];return _0xb7eb05;};'use strict';var _=require('lodash');var util=require(_0xf424('0x0'));var logger=require('../../config/logger')(_0xf424('0x1'));var moment=require(_0xf424('0x2'));var BPromise=require(_0xf424('0x3'));var rp=require(_0xf424('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf424('0x5'));var config=require('../../config/environment');var attributes=require(_0xf424('0x6'));module[_0xf424('0x7')]=function(_0x2dfedf,_0x4e8518){return _0x2dfedf['define']('VoiceMailMessage',attributes,{'tableName':_0xf424('0x8'),'paranoid':![],'indexes':[{'name':_0xf424('0x9'),'fields':[_0xf424('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f6c46db..e72baa2 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 _0x7af2=['info','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x45c81e,_0x3e9068){var _0x2a99c7=function(_0x5c3bb1){while(--_0x5c3bb1){_0x45c81e['push'](_0x45c81e['shift']());}};_0x2a99c7(++_0x3e9068);}(_0x7af2,0xc0));var _0x27af=function(_0x61890d,_0x33c705){_0x61890d=_0x61890d-0x0;var _0x53b448=_0x7af2[_0x61890d];return _0x53b448;};'use strict';var _=require(_0x27af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x27af('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x2'))['db'];var utils=require(_0x27af('0x3'));var logger=require('../../config/logger')(_0x27af('0x4'));var config=require(_0x27af('0x5'));var jayson=require(_0x27af('0x6'));var client=jayson[_0x27af('0x7')][_0x27af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e1ae0,_0x1daf16,_0x928651){return new BPromise(function(_0x37ca3d,_0x2d0efa){return client['request'](_0x5e1ae0,_0x928651)[_0x27af('0x9')](function(_0x57e77a){logger['info'](_0x27af('0xa'),_0x1daf16,_0x27af('0xb'));logger[_0x27af('0xc')](_0x27af('0xd'),_0x1daf16,_0x27af('0xb'),JSON[_0x27af('0xe')](_0x57e77a));if(_0x57e77a['error']){if(_0x57e77a[_0x27af('0xf')][_0x27af('0x10')]===0x1f4){logger['error'](_0x27af('0xa'),_0x1daf16,_0x57e77a['error'][_0x27af('0x11')]);return _0x2d0efa(_0x57e77a['error'][_0x27af('0x11')]);}logger[_0x27af('0xf')](_0x27af('0xa'),_0x1daf16,_0x57e77a[_0x27af('0xf')]['message']);return _0x37ca3d(_0x57e77a[_0x27af('0xf')][_0x27af('0x11')]);}else{logger[_0x27af('0x12')](_0x27af('0xa'),_0x1daf16,_0x27af('0xb'));_0x37ca3d(_0x57e77a[_0x27af('0x13')][_0x27af('0x11')]);}})[_0x27af('0x14')](function(_0x1d1570){logger[_0x27af('0xf')](_0x27af('0xa'),_0x1daf16,_0x1d1570);_0x2d0efa(_0x1d1570);});});} \ No newline at end of file +var _0x0524=['../../config/environment','jayson/promise','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0524,0x8c));var _0x4052=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0x0524[_0x2ef8c1];return _0x288305;};'use strict';var _=require(_0x4052('0x0'));var util=require('util');var moment=require(_0x4052('0x1'));var BPromise=require(_0x4052('0x2'));var rs=require(_0x4052('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4052('0x4'));var logger=require(_0x4052('0x5'))(_0x4052('0x6'));var config=require(_0x4052('0x7'));var jayson=require(_0x4052('0x8'));var client=jayson['client'][_0x4052('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe9f634,_0x3989fc,_0x8887f6){return new BPromise(function(_0x4cdd9c,_0x253a5){return client[_0x4052('0xa')](_0xe9f634,_0x8887f6)['then'](function(_0x3f2075){logger[_0x4052('0xb')](_0x4052('0xc'),_0x3989fc,_0x4052('0xd'));logger[_0x4052('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3989fc,_0x4052('0xd'),JSON[_0x4052('0xf')](_0x3f2075));if(_0x3f2075[_0x4052('0x10')]){if(_0x3f2075[_0x4052('0x10')][_0x4052('0x11')]===0x1f4){logger[_0x4052('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x3989fc,_0x3f2075[_0x4052('0x10')][_0x4052('0x12')]);return _0x253a5(_0x3f2075['error']['message']);}logger[_0x4052('0x10')](_0x4052('0xc'),_0x3989fc,_0x3f2075['error']['message']);return _0x4cdd9c(_0x3f2075['error'][_0x4052('0x12')]);}else{logger[_0x4052('0xb')](_0x4052('0xc'),_0x3989fc,_0x4052('0xd'));_0x4cdd9c(_0x3f2075[_0x4052('0x13')]['message']);}})[_0x4052('0x14')](function(_0x3980e6){logger[_0x4052('0x10')](_0x4052('0xc'),_0x3989fc,_0x3980e6);_0x253a5(_0x3980e6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f0dd7b1..85be523 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 _0x8386=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','/:id/sounds','create','post','put','delete','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x153597,_0x492f6f){var _0x27d9de=function(_0x42f31f){while(--_0x42f31f){_0x153597['push'](_0x153597['shift']());}};_0x27d9de(++_0x492f6f);}(_0x8386,0x7d));var _0x6838=function(_0x495fb2,_0x5b3b84){_0x495fb2=_0x495fb2-0x0;var _0x481da3=_0x8386[_0x495fb2];return _0x481da3;};'use strict';var multer=require(_0x6838('0x0'));var util=require(_0x6838('0x1'));var path=require(_0x6838('0x2'));var timeout=require(_0x6838('0x3'));var express=require(_0x6838('0x4'));var router=express[_0x6838('0x5')]();var fs_extra=require(_0x6838('0x6'));var auth=require(_0x6838('0x7'));var interaction=require(_0x6838('0x8'));var config=require('../../config/environment');var controller=require(_0x6838('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6838('0xa')](_0x6838('0xb'),auth[_0x6838('0xc')](),controller['show']);router[_0x6838('0xa')](_0x6838('0xd'),auth['isAuthenticated'](),controller['getSounds']);router['post']('/',auth['isAuthenticated'](),controller[_0x6838('0xe')]);router[_0x6838('0xf')]('/:id/sounds',auth[_0x6838('0xc')](),controller['addSound']);router[_0x6838('0x10')](_0x6838('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6838('0x11')](_0x6838('0xb'),auth[_0x6838('0xc')](),controller['destroy']);router[_0x6838('0x11')](_0x6838('0x12'),auth['isAuthenticated'](),controller[_0x6838('0x13')]);module[_0x6838('0x14')]=router; \ No newline at end of file +var _0x880e=['delete','destroy','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','getSounds','post','create','/:id/sounds'];(function(_0x1968ab,_0x1a70dd){var _0x46be3d=function(_0x34a272){while(--_0x34a272){_0x1968ab['push'](_0x1968ab['shift']());}};_0x46be3d(++_0x1a70dd);}(_0x880e,0xb4));var _0xe880=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x880e[_0x1aeda2];return _0x32dc6d;};'use strict';var multer=require(_0xe880('0x0'));var util=require(_0xe880('0x1'));var path=require(_0xe880('0x2'));var timeout=require(_0xe880('0x3'));var express=require('express');var router=express[_0xe880('0x4')]();var fs_extra=require(_0xe880('0x5'));var auth=require(_0xe880('0x6'));var interaction=require(_0xe880('0x7'));var config=require(_0xe880('0x8'));var controller=require(_0xe880('0x9'));router[_0xe880('0xa')]('/',auth[_0xe880('0xb')](),controller['index']);router['get'](_0xe880('0xc'),auth[_0xe880('0xb')](),controller[_0xe880('0xd')]);router[_0xe880('0xa')]('/:id/sounds',auth[_0xe880('0xb')](),controller[_0xe880('0xe')]);router[_0xe880('0xf')]('/',auth[_0xe880('0xb')](),controller[_0xe880('0x10')]);router['post'](_0xe880('0x11'),auth[_0xe880('0xb')](),controller['addSound']);router['put'](_0xe880('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe880('0x12')](_0xe880('0xc'),auth[_0xe880('0xb')](),controller[_0xe880('0x13')]);router[_0xe880('0x12')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xe880('0x14')]);module[_0xe880('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 0b433b4..0485e84 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 _0xbc09=['STRING','ENUM','mp3nb','quietmp3nb','quietmp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x536d74,_0x10b767){var _0x2418e3=function(_0x309a0b){while(--_0x309a0b){_0x536d74['push'](_0x536d74['shift']());}};_0x2418e3(++_0x10b767);}(_0xbc09,0x18a));var _0x9bc0=function(_0x4b48ed,_0x6f1f86){_0x4b48ed=_0x4b48ed-0x0;var _0x5ef49d=_0xbc09[_0x4b48ed];return _0x5ef49d;};'use strict';var Sequelize=require(_0x9bc0('0x0'));module[_0x9bc0('0x1')]={'name':{'type':Sequelize[_0x9bc0('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9bc0('0x3')]('custom','files',_0x9bc0('0x4'),_0x9bc0('0x5'),_0x9bc0('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x9bc0('0x7')},'directory':{'type':Sequelize[_0x9bc0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9bc0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9bc0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9bc0('0x2')],'allowNull':!![],'defaultValue':_0x9bc0('0x8')},'format':{'type':Sequelize[_0x9bc0('0x2')],'allowNull':!![]},'stamp':{'type':_0x9bc0('0x9')},'defaultEntry':{'type':Sequelize[_0x9bc0('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xde2c=['quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','mp3nb'];(function(_0xa676e6,_0x67b51d){var _0x51aa54=function(_0x1fe1e7){while(--_0x1fe1e7){_0xa676e6['push'](_0xa676e6['shift']());}};_0x51aa54(++_0x67b51d);}(_0xde2c,0x13f));var _0xcde2=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xde2c[_0x31a576];return _0x30b1d3;};'use strict';var Sequelize=require(_0xcde2('0x0'));module[_0xcde2('0x1')]={'name':{'type':Sequelize[_0xcde2('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xcde2('0x3')](_0xcde2('0x4'),'files',_0xcde2('0x5'),_0xcde2('0x6'),_0xcde2('0x7'),_0xcde2('0x8')),'allowNull':!![],'defaultValue':_0xcde2('0x9')},'directory':{'type':Sequelize[_0xcde2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xcde2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xcde2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xcde2('0x2')],'allowNull':!![],'defaultValue':_0xcde2('0xa')},'format':{'type':Sequelize[_0xcde2('0x2')],'allowNull':!![]},'stamp':{'type':_0xcde2('0xb')},'defaultEntry':{'type':Sequelize[_0xcde2('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 3a033ad..d73b848 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 _0xc9a8=['index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','Sound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','save_name','message','removeSound','findOne','id2','unlinkSync','getSounds','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','error','name','send'];(function(_0x46af51,_0x41a1bc){var _0x1d79d2=function(_0x201424){while(--_0x201424){_0x46af51['push'](_0x46af51['shift']());}};_0x1d79d2(++_0x41a1bc);}(_0xc9a8,0x134));var _0x8c9a=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xc9a8[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0x8c9a('0x0'));var rimraf=require(_0x8c9a('0x1'));var zipdir=require(_0x8c9a('0x2'));var jsonpatch=require(_0x8c9a('0x3'));var rp=require(_0x8c9a('0x4'));var moment=require(_0x8c9a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8c9a('0x6'));var util=require(_0x8c9a('0x7'));var path=require(_0x8c9a('0x8'));var sox=require(_0x8c9a('0x9'));var csv=require('to-csv');var ejs=require(_0x8c9a('0xa'));var fs=require('fs');var fs_extra=require(_0x8c9a('0xb'));var _=require(_0x8c9a('0xc'));var squel=require(_0x8c9a('0xd'));var crypto=require(_0x8c9a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8c9a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8c9a('0x10'));var Papa=require('papaparse');var Redis=require(_0x8c9a('0x11'));var authService=require(_0x8c9a('0x12'));var qs=require(_0x8c9a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c9a('0x14'));var logger=require(_0x8c9a('0x15'))(_0x8c9a('0x16'));var utils=require(_0x8c9a('0x17'));var config=require(_0x8c9a('0x18'));var licenseUtil=require(_0x8c9a('0x19'));var db=require(_0x8c9a('0x1a'))['db'];function respondWithStatusCode(_0x4f5b81,_0x39cdd4){_0x39cdd4=_0x39cdd4||0xcc;return function(_0x5334d8){if(_0x5334d8){return _0x4f5b81[_0x8c9a('0x1b')](_0x39cdd4);}return _0x4f5b81[_0x8c9a('0x1c')](_0x39cdd4)['end']();};}function respondWithResult(_0x197553,_0x1b7a89){_0x1b7a89=_0x1b7a89||0xc8;return function(_0x27e01b){if(_0x27e01b){return _0x197553[_0x8c9a('0x1c')](_0x1b7a89)[_0x8c9a('0x1d')](_0x27e01b);}};}function respondWithFilteredResult(_0x32fa75,_0x9845bf){return function(_0x4fda90){if(_0x4fda90){var _0x2e2bd8=typeof _0x9845bf[_0x8c9a('0x1e')]===_0x8c9a('0x1f')&&typeof _0x9845bf[_0x8c9a('0x20')]===_0x8c9a('0x1f');var _0xd197a6=_0x4fda90['count'];var _0x44bd24=_0x2e2bd8?0x0:_0x9845bf['offset'];var _0x3ca7ed=_0x2e2bd8?_0x4fda90[_0x8c9a('0x21')]:_0x9845bf['offset']+_0x9845bf[_0x8c9a('0x20')];var _0x552919;if(_0x3ca7ed>=_0xd197a6){_0x3ca7ed=_0xd197a6;_0x552919=0xc8;}else{_0x552919=0xce;}_0x32fa75[_0x8c9a('0x1c')](_0x552919);return _0x32fa75[_0x8c9a('0x22')](_0x8c9a('0x23'),_0x44bd24+'-'+_0x3ca7ed+'/'+_0xd197a6)['json'](_0x4fda90);}return null;};}function patchUpdates(_0x1cee04){return function(_0x56e2e3){try{jsonpatch[_0x8c9a('0x24')](_0x56e2e3,_0x1cee04,!![]);}catch(_0x2948a5){return BPromise[_0x8c9a('0x25')](_0x2948a5);}return _0x56e2e3[_0x8c9a('0x26')]();};}function saveUpdates(_0x4cc3a0,_0x4ea9be){return function(_0x2ec1ce){if(_0x2ec1ce){return _0x2ec1ce['update'](_0x4cc3a0)[_0x8c9a('0x27')](function(_0x22fe33){return _0x22fe33;});}return null;};}function removeEntity(_0x2528ea,_0x5d1ca0){return function(_0x244582){if(_0x244582){return _0x244582[_0x8c9a('0x28')]()['then'](function(){var _0xd393e2=_0x244582['get']({'plain':!![]});var _0x4f9887='MusicOnHolds';return db[_0x8c9a('0x29')][_0x8c9a('0x28')]({'where':{'type':_0x4f9887,'resourceId':_0xd393e2['id']}})['then'](function(){return _0x244582;});})['then'](function(){_0x2528ea[_0x8c9a('0x1c')](0xcc)[_0x8c9a('0x2a')]();});}};}function handleEntityNotFound(_0x579ad8,_0x23a7fc){return function(_0x546bb4){if(!_0x546bb4){_0x579ad8[_0x8c9a('0x1b')](0x194);}return _0x546bb4;};}function handleError(_0x561d52,_0x3b810c){_0x3b810c=_0x3b810c||0x1f4;return function(_0x150b32){logger[_0x8c9a('0x2b')](_0x150b32['stack']);if(_0x150b32[_0x8c9a('0x2c')]){delete _0x150b32[_0x8c9a('0x2c')];}_0x561d52[_0x8c9a('0x1c')](_0x3b810c)[_0x8c9a('0x2d')](_0x150b32);};}exports[_0x8c9a('0x2e')]=function(_0x2eac9a,_0x4cef35){var _0x503b69={},_0x42d382={},_0x5ef6c3={'count':0x0,'rows':[]};var _0x25b4d1=_['map'](db[_0x8c9a('0x2f')][_0x8c9a('0x30')],function(_0x1f10b3){return{'name':_0x1f10b3[_0x8c9a('0x31')],'type':_0x1f10b3[_0x8c9a('0x32')][_0x8c9a('0x33')]};});_0x42d382[_0x8c9a('0x34')]=_[_0x8c9a('0x35')](_0x25b4d1,'name');_0x42d382[_0x8c9a('0x36')]=_[_0x8c9a('0x37')](_0x2eac9a[_0x8c9a('0x36')]);_0x42d382[_0x8c9a('0x38')]=_[_0x8c9a('0x39')](_0x42d382[_0x8c9a('0x34')],_0x42d382['query']);_0x503b69[_0x8c9a('0x3a')]=_['intersection'](_0x42d382['model'],qs[_0x8c9a('0x3b')](_0x2eac9a[_0x8c9a('0x36')][_0x8c9a('0x3b')]));_0x503b69[_0x8c9a('0x3a')]=_0x503b69[_0x8c9a('0x3a')][_0x8c9a('0x3c')]?_0x503b69[_0x8c9a('0x3a')]:_0x42d382[_0x8c9a('0x34')];if(!_0x2eac9a[_0x8c9a('0x36')][_0x8c9a('0x3d')](_0x8c9a('0x3e'))){_0x503b69[_0x8c9a('0x20')]=qs[_0x8c9a('0x20')](_0x2eac9a[_0x8c9a('0x36')][_0x8c9a('0x20')]);_0x503b69[_0x8c9a('0x1e')]=qs[_0x8c9a('0x1e')](_0x2eac9a['query']['offset']);}_0x503b69[_0x8c9a('0x3f')]=qs['sort'](_0x2eac9a['query']['sort']);delete _0x2eac9a['query']['sort'];_0x503b69[_0x8c9a('0x40')]=qs[_0x8c9a('0x38')](_[_0x8c9a('0x41')](_0x2eac9a[_0x8c9a('0x36')],_0x42d382[_0x8c9a('0x38')]),_0x25b4d1);if(_0x2eac9a[_0x8c9a('0x36')][_0x8c9a('0x42')]){_0x503b69[_0x8c9a('0x40')]=_[_0x8c9a('0x43')](_0x503b69[_0x8c9a('0x40')],{'$or':_['map'](_0x25b4d1,function(_0xdddd58){if(_0xdddd58['type']!==_0x8c9a('0x44')){var _0x30f1c0={};_0x30f1c0[_0xdddd58[_0x8c9a('0x2c')]]={'$like':'%'+_0x2eac9a[_0x8c9a('0x36')]['filter']+'%'};return _0x30f1c0;}})});}_0x503b69=_['merge']({},_0x503b69,_0x2eac9a[_0x8c9a('0x45')]);var _0x4e0ef2={'where':_0x503b69[_0x8c9a('0x40')]};return db[_0x8c9a('0x2f')]['count'](_0x4e0ef2)[_0x8c9a('0x27')](function(_0x33cef4){_0x5ef6c3[_0x8c9a('0x21')]=_0x33cef4;if(_0x2eac9a[_0x8c9a('0x36')]['includeAll']){_0x503b69[_0x8c9a('0x46')]=[{'all':!![]}];}return db[_0x8c9a('0x2f')][_0x8c9a('0x47')](_0x503b69);})['then'](function(_0x4a66b1){_0x5ef6c3[_0x8c9a('0x48')]=_0x4a66b1;return _0x5ef6c3;})[_0x8c9a('0x27')](respondWithFilteredResult(_0x4cef35,_0x503b69))[_0x8c9a('0x49')](handleError(_0x4cef35,null));};exports[_0x8c9a('0x4a')]=function(_0x328b42,_0x498080){var _0x4dbde9={'raw':![],'where':{'id':_0x328b42[_0x8c9a('0x4b')]['id']}},_0x1294d6={};_0x1294d6[_0x8c9a('0x34')]=_[_0x8c9a('0x37')](db[_0x8c9a('0x2f')][_0x8c9a('0x30')]);_0x1294d6['query']=_['keys'](_0x328b42[_0x8c9a('0x36')]);_0x1294d6[_0x8c9a('0x38')]=_['intersection'](_0x1294d6['model'],_0x1294d6[_0x8c9a('0x36')]);_0x4dbde9[_0x8c9a('0x3a')]=_[_0x8c9a('0x39')](_0x1294d6[_0x8c9a('0x34')],qs[_0x8c9a('0x3b')](_0x328b42[_0x8c9a('0x36')][_0x8c9a('0x3b')]));_0x4dbde9['attributes']=_0x4dbde9[_0x8c9a('0x3a')][_0x8c9a('0x3c')]?_0x4dbde9[_0x8c9a('0x3a')]:_0x1294d6[_0x8c9a('0x34')];if(_0x328b42[_0x8c9a('0x36')]['includeAll']){_0x4dbde9['include']=[{'all':!![]}];}_0x4dbde9=_[_0x8c9a('0x43')]({},_0x4dbde9,_0x328b42[_0x8c9a('0x45')]);return db[_0x8c9a('0x2f')][_0x8c9a('0x4c')](_0x4dbde9)['then'](handleEntityNotFound(_0x498080,null))[_0x8c9a('0x27')](respondWithResult(_0x498080,null))['catch'](handleError(_0x498080,null));};exports['update']=function(_0x20545a,_0x3edb80){if(_0x20545a[_0x8c9a('0x4d')]['id']){delete _0x20545a[_0x8c9a('0x4d')]['id'];}return db[_0x8c9a('0x2f')][_0x8c9a('0x4c')]({'where':{'id':_0x20545a[_0x8c9a('0x4b')]['id']}})[_0x8c9a('0x27')](handleEntityNotFound(_0x3edb80,null))['then'](saveUpdates(_0x20545a['body'],null))[_0x8c9a('0x27')](respondWithResult(_0x3edb80,null))[_0x8c9a('0x49')](handleError(_0x3edb80,null));};exports[_0x8c9a('0x4e')]=function(_0x18e1bf,_0x49de01,_0x14c468){return db[_0x8c9a('0x4f')][_0x8c9a('0x50')](function(_0x38ab92){if(_0x18e1bf[_0x8c9a('0x4d')][_0x8c9a('0x51')]==='files'){_0x18e1bf[_0x8c9a('0x4d')][_0x8c9a('0x52')]=path[_0x8c9a('0x53')](config[_0x8c9a('0x54')],_0x8c9a('0x55'),_0x18e1bf[_0x8c9a('0x4d')][_0x8c9a('0x2c')]);}return db[_0x8c9a('0x2f')]['create'](_0x18e1bf[_0x8c9a('0x4d')],{'transaction':_0x38ab92})[_0x8c9a('0x27')](function(_0x35b709){if(_0x18e1bf['body'][_0x8c9a('0x51')]===_0x8c9a('0x56')){fs[_0x8c9a('0x57')](_0x35b709[_0x8c9a('0x52')],parseInt('0777',0x8));}var _0x227a32=_0x18e1bf[_0x8c9a('0x58')][_0x8c9a('0x59')]({'plain':!![]});if(!_0x227a32)throw new Error(_0x8c9a('0x5a'));if(_0x227a32[_0x8c9a('0x5b')]===_0x8c9a('0x58')){var _0xcde7cf=_0x35b709[_0x8c9a('0x59')]({'plain':!![]});return db[_0x8c9a('0x5c')][_0x8c9a('0x4c')]({'where':{'name':_0x8c9a('0x5d'),'userProfileId':_0x227a32[_0x8c9a('0x5e')]},'raw':!![]})[_0x8c9a('0x27')](function(_0x4e1235){if(_0x4e1235&&_0x4e1235[_0x8c9a('0x5f')]===0x0){return db[_0x8c9a('0x29')][_0x8c9a('0x4e')]({'name':_0xcde7cf[_0x8c9a('0x2c')],'resourceId':_0xcde7cf['id'],'type':_0x4e1235[_0x8c9a('0x2c')],'sectionId':_0x4e1235['id']},{})[_0x8c9a('0x27')](function(){return _0x35b709;});}else{return _0x35b709;}})['catch'](function(_0x3e40bc){logger[_0x8c9a('0x2b')](_0x8c9a('0x60'),_0x3e40bc);});}return _0x35b709;});})[_0x8c9a('0x27')](respondWithResult(_0x49de01,0xc9))[_0x8c9a('0x49')](handleError(_0x49de01,null));};exports['destroy']=function(_0x2d94eb,_0x435c14,_0x3ec8cd){var _0x122f17;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2d94eb['params']['id']}})[_0x8c9a('0x27')](function(_0x312496){if(_0x312496){return db[_0x8c9a('0x4f')]['transaction'](function(_0x2e93e8){return _0x312496[_0x8c9a('0x28')]({'transaction':_0x2e93e8,'raw':!![]})['then'](function(_0x1301ed){if(_0x1301ed[_0x8c9a('0x52')]){fs[_0x8c9a('0x61')](_0x1301ed[_0x8c9a('0x52')])[_0x8c9a('0x62')](function(_0x58b406){fs['unlinkSync'](path[_0x8c9a('0x53')](_0x1301ed[_0x8c9a('0x52')],_0x58b406));});fs[_0x8c9a('0x63')](_0x1301ed['directory']);}return _0x1301ed;});})[_0x8c9a('0x49')](function(_0xba7431){throw new db[(_0x8c9a('0x64'))][(_0x8c9a('0x65'))](_0xba7431['message']);});}})[_0x8c9a('0x27')](handleEntityNotFound(_0x435c14,null))[_0x8c9a('0x27')](removeEntity(_0x435c14,null))[_0x8c9a('0x49')](handleError(_0x435c14,null));};exports['addSound']=function(_0x5346a4,_0x3eebe8,_0x43772a){return db[_0x8c9a('0x4f')][_0x8c9a('0x50')](function(_0x49f63f){var _0x128728;return db[_0x8c9a('0x2f')][_0x8c9a('0x4c')]({'where':{'id':_0x5346a4[_0x8c9a('0x4b')]['id']}})[_0x8c9a('0x27')](function(_0x422d44){if(_0x422d44){_0x128728=_0x422d44;return _0x422d44['addSound'](_0x5346a4[_0x8c9a('0x4d')]['id'],{'transaction':_0x49f63f});}})['then'](function(_0x5924cc){if(_0x5924cc){return db[_0x8c9a('0x66')]['findOne']({'where':{'id':_0x5346a4['body']['id']},'attributes':['id',_0x8c9a('0x2c'),'save_name',_0x8c9a('0x67'),_0x8c9a('0x68')],'raw':!![]});}})['then'](function(_0x47fe11){if(_0x47fe11){var _0x474237=path[_0x8c9a('0x53')](config[_0x8c9a('0x54')],_0x8c9a('0x69'),util[_0x8c9a('0x6a')](_0x8c9a('0x6b'),path[_0x8c9a('0x6c')](_0x47fe11['save_name'],path[_0x8c9a('0x6d')](_0x47fe11[_0x8c9a('0x6e')])),_0x47fe11[_0x8c9a('0x67')]));var _0xbccdc8=path[_0x8c9a('0x53')](config[_0x8c9a('0x54')],_0x8c9a('0x55'),_0x128728[_0x8c9a('0x2c')],util['format']('%s.%s',_0x47fe11[_0x8c9a('0x2c')],_0x47fe11[_0x8c9a('0x67')]));fs['symlinkSync'](_0x474237,_0xbccdc8);return _0x47fe11;}})['catch'](function(_0x1a89a3){throw new db['Sequelize']['ValidationError'](_0x1a89a3[_0x8c9a('0x6f')]);});})[_0x8c9a('0x27')](handleEntityNotFound(_0x3eebe8,null))[_0x8c9a('0x27')](respondWithResult(_0x3eebe8,0xc9))['catch'](handleError(_0x3eebe8,null));};exports[_0x8c9a('0x70')]=function(_0x51f578,_0x20bf8d,_0x15691b){return db['sequelize'][_0x8c9a('0x50')](function(_0x33f0dd){var _0x527409;return db[_0x8c9a('0x2f')]['findOne']({'where':{'id':_0x51f578[_0x8c9a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x20bf8d,null))[_0x8c9a('0x27')](function(_0x3313b7){if(_0x3313b7){_0x527409=_0x3313b7;return _0x3313b7[_0x8c9a('0x70')](_0x51f578[_0x8c9a('0x4b')]['id2']);}})[_0x8c9a('0x27')](function(_0x104933){if(_0x104933){return db[_0x8c9a('0x66')][_0x8c9a('0x71')]({'where':{'id':_0x51f578[_0x8c9a('0x4b')][_0x8c9a('0x72')]},'attributes':['id',_0x8c9a('0x2c'),_0x8c9a('0x6e'),_0x8c9a('0x67'),_0x8c9a('0x68')],'raw':!![]});}})[_0x8c9a('0x27')](function(_0x475af3){if(_0x475af3){fs[_0x8c9a('0x73')](path['join'](_0x527409[_0x8c9a('0x52')],util[_0x8c9a('0x6a')]('%s.%s',_0x475af3[_0x8c9a('0x2c')],_0x475af3['converted_format'])));return _0x475af3;}})[_0x8c9a('0x49')](function(_0x9e7532){throw new db[(_0x8c9a('0x64'))][(_0x8c9a('0x65'))](_0x9e7532['message']);});})[_0x8c9a('0x27')](handleEntityNotFound(_0x20bf8d,null))[_0x8c9a('0x27')](respondWithStatusCode(_0x20bf8d,0xcc))[_0x8c9a('0x49')](handleError(_0x20bf8d,null));};exports[_0x8c9a('0x74')]=function(_0x18ebda,_0x24ccda,_0x4e528b){var _0x518b12={};var _0x57fb19={};var _0x31b541;var _0xcaaf3c;return db[_0x8c9a('0x2f')][_0x8c9a('0x71')]({'where':{'id':_0x18ebda['params']['id']}})[_0x8c9a('0x27')](handleEntityNotFound(_0x24ccda,null))['then'](function(_0x1e73a1){if(_0x1e73a1){_0x31b541=_0x1e73a1;_0x57fb19[_0x8c9a('0x34')]=_[_0x8c9a('0x37')](db[_0x8c9a('0x66')][_0x8c9a('0x30')]);_0x57fb19[_0x8c9a('0x36')]=_['keys'](_0x18ebda[_0x8c9a('0x36')]);_0x57fb19[_0x8c9a('0x38')]=_[_0x8c9a('0x39')](_0x57fb19[_0x8c9a('0x34')],_0x57fb19[_0x8c9a('0x36')]);_0x518b12[_0x8c9a('0x3a')]=_[_0x8c9a('0x39')](_0x57fb19['model'],qs[_0x8c9a('0x3b')](_0x18ebda[_0x8c9a('0x36')][_0x8c9a('0x3b')]));_0x518b12[_0x8c9a('0x3a')]=_0x518b12['attributes'][_0x8c9a('0x3c')]?_0x518b12[_0x8c9a('0x3a')]:_0x57fb19[_0x8c9a('0x34')];_0x518b12['order']=qs[_0x8c9a('0x75')](_0x18ebda['query'][_0x8c9a('0x75')]);_0x518b12['where']=qs[_0x8c9a('0x38')](_['pick'](_0x18ebda[_0x8c9a('0x36')],_0x57fb19[_0x8c9a('0x38')]));if(_0x18ebda[_0x8c9a('0x36')][_0x8c9a('0x42')]){_0x518b12[_0x8c9a('0x40')]=_[_0x8c9a('0x43')](_0x518b12['where'],{'$or':_[_0x8c9a('0x35')](_0x518b12[_0x8c9a('0x3a')],function(_0x342eb9){var _0xc8767e={};_0xc8767e[_0x342eb9]={'$like':'%'+_0x18ebda[_0x8c9a('0x36')][_0x8c9a('0x42')]+'%'};return _0xc8767e;})});}_0x518b12=_[_0x8c9a('0x43')]({},_0x518b12,_0x18ebda[_0x8c9a('0x45')]);return _0x31b541[_0x8c9a('0x74')](_0x518b12);}})[_0x8c9a('0x27')](function(_0x428fdc){if(_0x428fdc){_0xcaaf3c=_0x428fdc[_0x8c9a('0x3c')];if(!_0x18ebda[_0x8c9a('0x36')][_0x8c9a('0x3d')]('nolimit')){_0x518b12[_0x8c9a('0x20')]=qs['limit'](_0x18ebda[_0x8c9a('0x36')]['limit']);_0x518b12['offset']=qs[_0x8c9a('0x1e')](_0x18ebda[_0x8c9a('0x36')]['offset']);}return _0x31b541['getSounds'](_0x518b12);}})[_0x8c9a('0x27')](function(_0x1a08bb){if(_0x1a08bb){return _0x1a08bb?{'count':_0xcaaf3c,'rows':_0x1a08bb}:null;}})['then'](respondWithResult(_0x24ccda,null))[_0x8c9a('0x49')](handleError(_0x24ccda,null));}; \ No newline at end of file +var _0x8cfb=['find','body','sequelize','transaction','mode','files','directory','join','root','create','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','message','removeSound','getSounds','map','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','update','then','destroy','MusicOnHolds','sendStatus','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x51065f,_0xd93aa8){var _0x42bed3=function(_0x2063d5){while(--_0x2063d5){_0x51065f['push'](_0x51065f['shift']());}};_0x42bed3(++_0xd93aa8);}(_0x8cfb,0xfa));var _0xb8cf=function(_0x5ebd8d,_0x498ea2){_0x5ebd8d=_0x5ebd8d-0x0;var _0x43eaf8=_0x8cfb[_0x5ebd8d];return _0x43eaf8;};'use strict';var emlformat=require(_0xb8cf('0x0'));var rimraf=require(_0xb8cf('0x1'));var zipdir=require(_0xb8cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8cf('0x4'));var util=require(_0xb8cf('0x5'));var path=require(_0xb8cf('0x6'));var sox=require('sox');var csv=require(_0xb8cf('0x7'));var ejs=require(_0xb8cf('0x8'));var fs=require('fs');var fs_extra=require(_0xb8cf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8cf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb8cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb8cf('0xc'));var Papa=require(_0xb8cf('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(_0xb8cf('0xe'));var logger=require(_0xb8cf('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xb8cf('0x10'));var licenseUtil=require(_0xb8cf('0x11'));var db=require(_0xb8cf('0x12'))['db'];function respondWithStatusCode(_0x5b8339,_0x163ba5){_0x163ba5=_0x163ba5||0xcc;return function(_0x161c00){if(_0x161c00){return _0x5b8339['sendStatus'](_0x163ba5);}return _0x5b8339[_0xb8cf('0x13')](_0x163ba5)[_0xb8cf('0x14')]();};}function respondWithResult(_0x5e9462,_0x557e98){_0x557e98=_0x557e98||0xc8;return function(_0x2879a7){if(_0x2879a7){return _0x5e9462[_0xb8cf('0x13')](_0x557e98)['json'](_0x2879a7);}};}function respondWithFilteredResult(_0x3607bf,_0x36b53f){return function(_0x44bf12){if(_0x44bf12){var _0x1f844e=typeof _0x36b53f['offset']===_0xb8cf('0x15')&&typeof _0x36b53f[_0xb8cf('0x16')]===_0xb8cf('0x15');var _0x460311=_0x44bf12[_0xb8cf('0x17')];var _0x217425=_0x1f844e?0x0:_0x36b53f[_0xb8cf('0x18')];var _0x5733a7=_0x1f844e?_0x44bf12[_0xb8cf('0x17')]:_0x36b53f['offset']+_0x36b53f[_0xb8cf('0x16')];var _0x3331e2;if(_0x5733a7>=_0x460311){_0x5733a7=_0x460311;_0x3331e2=0xc8;}else{_0x3331e2=0xce;}_0x3607bf['status'](_0x3331e2);return _0x3607bf[_0xb8cf('0x19')]('Content-Range',_0x217425+'-'+_0x5733a7+'/'+_0x460311)[_0xb8cf('0x1a')](_0x44bf12);}return null;};}function patchUpdates(_0x3613d9){return function(_0x2aed4a){try{jsonpatch[_0xb8cf('0x1b')](_0x2aed4a,_0x3613d9,!![]);}catch(_0x584b1c){return BPromise['reject'](_0x584b1c);}return _0x2aed4a['save']();};}function saveUpdates(_0x120521,_0x1bd65d){return function(_0x40072f){if(_0x40072f){return _0x40072f[_0xb8cf('0x1c')](_0x120521)[_0xb8cf('0x1d')](function(_0x34397d){return _0x34397d;});}return null;};}function removeEntity(_0x2d54f5,_0x3e2ada){return function(_0x42f3af){if(_0x42f3af){return _0x42f3af[_0xb8cf('0x1e')]()[_0xb8cf('0x1d')](function(){var _0xd21be9=_0x42f3af['get']({'plain':!![]});var _0x41e390=_0xb8cf('0x1f');return db['UserProfileResource']['destroy']({'where':{'type':_0x41e390,'resourceId':_0xd21be9['id']}})[_0xb8cf('0x1d')](function(){return _0x42f3af;});})['then'](function(){_0x2d54f5[_0xb8cf('0x13')](0xcc)[_0xb8cf('0x14')]();});}};}function handleEntityNotFound(_0x132afd,_0x12789e){return function(_0x3efe04){if(!_0x3efe04){_0x132afd[_0xb8cf('0x20')](0x194);}return _0x3efe04;};}function handleError(_0x3a16f4,_0x1bd926){_0x1bd926=_0x1bd926||0x1f4;return function(_0x333674){logger['error'](_0x333674['stack']);if(_0x333674[_0xb8cf('0x21')]){delete _0x333674[_0xb8cf('0x21')];}_0x3a16f4['status'](_0x1bd926)['send'](_0x333674);};}exports[_0xb8cf('0x22')]=function(_0x466715,_0x2b9681){var _0x226ba6={},_0x4845f2={},_0x42a5af={'count':0x0,'rows':[]};var _0x12f67c=_['map'](db[_0xb8cf('0x23')][_0xb8cf('0x24')],function(_0x35f6cf){return{'name':_0x35f6cf[_0xb8cf('0x25')],'type':_0x35f6cf[_0xb8cf('0x26')][_0xb8cf('0x27')]};});_0x4845f2[_0xb8cf('0x28')]=_['map'](_0x12f67c,_0xb8cf('0x21'));_0x4845f2[_0xb8cf('0x29')]=_[_0xb8cf('0x2a')](_0x466715[_0xb8cf('0x29')]);_0x4845f2[_0xb8cf('0x2b')]=_[_0xb8cf('0x2c')](_0x4845f2['model'],_0x4845f2['query']);_0x226ba6['attributes']=_[_0xb8cf('0x2c')](_0x4845f2[_0xb8cf('0x28')],qs[_0xb8cf('0x2d')](_0x466715[_0xb8cf('0x29')][_0xb8cf('0x2d')]));_0x226ba6[_0xb8cf('0x2e')]=_0x226ba6[_0xb8cf('0x2e')][_0xb8cf('0x2f')]?_0x226ba6[_0xb8cf('0x2e')]:_0x4845f2[_0xb8cf('0x28')];if(!_0x466715[_0xb8cf('0x29')][_0xb8cf('0x30')]('nolimit')){_0x226ba6[_0xb8cf('0x16')]=qs[_0xb8cf('0x16')](_0x466715[_0xb8cf('0x29')][_0xb8cf('0x16')]);_0x226ba6[_0xb8cf('0x18')]=qs[_0xb8cf('0x18')](_0x466715['query'][_0xb8cf('0x18')]);}_0x226ba6[_0xb8cf('0x31')]=qs[_0xb8cf('0x32')](_0x466715[_0xb8cf('0x29')][_0xb8cf('0x32')]);delete _0x466715[_0xb8cf('0x29')][_0xb8cf('0x32')];_0x226ba6['where']=qs[_0xb8cf('0x2b')](_[_0xb8cf('0x33')](_0x466715['query'],_0x4845f2[_0xb8cf('0x2b')]),_0x12f67c);if(_0x466715[_0xb8cf('0x29')][_0xb8cf('0x34')]){_0x226ba6[_0xb8cf('0x35')]=_[_0xb8cf('0x36')](_0x226ba6[_0xb8cf('0x35')],{'$or':_['map'](_0x12f67c,function(_0x28ad6a){if(_0x28ad6a['type']!=='VIRTUAL'){var _0x10e8c0={};_0x10e8c0[_0x28ad6a[_0xb8cf('0x21')]]={'$like':'%'+_0x466715[_0xb8cf('0x29')][_0xb8cf('0x34')]+'%'};return _0x10e8c0;}})});}_0x226ba6=_[_0xb8cf('0x36')]({},_0x226ba6,_0x466715[_0xb8cf('0x37')]);var _0x591d07={'where':_0x226ba6[_0xb8cf('0x35')]};return db[_0xb8cf('0x23')][_0xb8cf('0x17')](_0x591d07)[_0xb8cf('0x1d')](function(_0x297bb9){_0x42a5af['count']=_0x297bb9;if(_0x466715['query'][_0xb8cf('0x38')]){_0x226ba6[_0xb8cf('0x39')]=[{'all':!![]}];}return db[_0xb8cf('0x23')]['findAll'](_0x226ba6);})[_0xb8cf('0x1d')](function(_0x293bbc){_0x42a5af[_0xb8cf('0x3a')]=_0x293bbc;return _0x42a5af;})['then'](respondWithFilteredResult(_0x2b9681,_0x226ba6))[_0xb8cf('0x3b')](handleError(_0x2b9681,null));};exports[_0xb8cf('0x3c')]=function(_0x3b36c0,_0xbdd7a8){var _0x5c524b={'raw':![],'where':{'id':_0x3b36c0[_0xb8cf('0x3d')]['id']}},_0x3f3eb9={};_0x3f3eb9[_0xb8cf('0x28')]=_[_0xb8cf('0x2a')](db['VoiceMusicOnHold'][_0xb8cf('0x24')]);_0x3f3eb9['query']=_[_0xb8cf('0x2a')](_0x3b36c0[_0xb8cf('0x29')]);_0x3f3eb9[_0xb8cf('0x2b')]=_[_0xb8cf('0x2c')](_0x3f3eb9[_0xb8cf('0x28')],_0x3f3eb9[_0xb8cf('0x29')]);_0x5c524b[_0xb8cf('0x2e')]=_[_0xb8cf('0x2c')](_0x3f3eb9[_0xb8cf('0x28')],qs[_0xb8cf('0x2d')](_0x3b36c0['query'][_0xb8cf('0x2d')]));_0x5c524b[_0xb8cf('0x2e')]=_0x5c524b['attributes'][_0xb8cf('0x2f')]?_0x5c524b[_0xb8cf('0x2e')]:_0x3f3eb9[_0xb8cf('0x28')];if(_0x3b36c0['query'][_0xb8cf('0x38')]){_0x5c524b[_0xb8cf('0x39')]=[{'all':!![]}];}_0x5c524b=_['merge']({},_0x5c524b,_0x3b36c0[_0xb8cf('0x37')]);return db[_0xb8cf('0x23')][_0xb8cf('0x3e')](_0x5c524b)[_0xb8cf('0x1d')](handleEntityNotFound(_0xbdd7a8,null))[_0xb8cf('0x1d')](respondWithResult(_0xbdd7a8,null))[_0xb8cf('0x3b')](handleError(_0xbdd7a8,null));};exports[_0xb8cf('0x1c')]=function(_0x51693c,_0x1b57b1){if(_0x51693c['body']['id']){delete _0x51693c[_0xb8cf('0x3f')]['id'];}return db[_0xb8cf('0x23')][_0xb8cf('0x3e')]({'where':{'id':_0x51693c[_0xb8cf('0x3d')]['id']}})[_0xb8cf('0x1d')](handleEntityNotFound(_0x1b57b1,null))[_0xb8cf('0x1d')](saveUpdates(_0x51693c[_0xb8cf('0x3f')],null))[_0xb8cf('0x1d')](respondWithResult(_0x1b57b1,null))[_0xb8cf('0x3b')](handleError(_0x1b57b1,null));};exports['create']=function(_0x10043f,_0x19aa5e,_0x1507e1){return db[_0xb8cf('0x40')][_0xb8cf('0x41')](function(_0x1fa138){if(_0x10043f['body'][_0xb8cf('0x42')]===_0xb8cf('0x43')){_0x10043f[_0xb8cf('0x3f')][_0xb8cf('0x44')]=path[_0xb8cf('0x45')](config[_0xb8cf('0x46')],'server/files/moh',_0x10043f[_0xb8cf('0x3f')][_0xb8cf('0x21')]);}return db[_0xb8cf('0x23')][_0xb8cf('0x47')](_0x10043f[_0xb8cf('0x3f')],{'transaction':_0x1fa138})['then'](function(_0x2eca9e){if(_0x10043f[_0xb8cf('0x3f')][_0xb8cf('0x42')]==='files'){fs[_0xb8cf('0x48')](_0x2eca9e[_0xb8cf('0x44')],parseInt(_0xb8cf('0x49'),0x8));}var _0x1e9a46=_0x10043f[_0xb8cf('0x4a')][_0xb8cf('0x4b')]({'plain':!![]});if(!_0x1e9a46)throw new Error(_0xb8cf('0x4c'));if(_0x1e9a46[_0xb8cf('0x4d')]===_0xb8cf('0x4a')){var _0x4df857=_0x2eca9e[_0xb8cf('0x4b')]({'plain':!![]});return db[_0xb8cf('0x4e')]['find']({'where':{'name':_0xb8cf('0x1f'),'userProfileId':_0x1e9a46[_0xb8cf('0x4f')]},'raw':!![]})[_0xb8cf('0x1d')](function(_0x5d3b19){if(_0x5d3b19&&_0x5d3b19[_0xb8cf('0x50')]===0x0){return db['UserProfileResource'][_0xb8cf('0x47')]({'name':_0x4df857['name'],'resourceId':_0x4df857['id'],'type':_0x5d3b19['name'],'sectionId':_0x5d3b19['id']},{})[_0xb8cf('0x1d')](function(){return _0x2eca9e;});}else{return _0x2eca9e;}})[_0xb8cf('0x3b')](function(_0x5a0fca){logger['error'](_0xb8cf('0x51'),_0x5a0fca);});}return _0x2eca9e;});})[_0xb8cf('0x1d')](respondWithResult(_0x19aa5e,0xc9))[_0xb8cf('0x3b')](handleError(_0x19aa5e,null));};exports[_0xb8cf('0x1e')]=function(_0x18cc2d,_0x376ee3,_0x191cb8){var _0x322df5;return db[_0xb8cf('0x23')][_0xb8cf('0x3e')]({'where':{'id':_0x18cc2d[_0xb8cf('0x3d')]['id']}})[_0xb8cf('0x1d')](function(_0x3c0d6a){if(_0x3c0d6a){return db['sequelize']['transaction'](function(_0xb4fd28){return _0x3c0d6a['destroy']({'transaction':_0xb4fd28,'raw':!![]})['then'](function(_0x1431b5){if(_0x1431b5['directory']){fs[_0xb8cf('0x52')](_0x1431b5['directory'])[_0xb8cf('0x53')](function(_0x3163ac){fs[_0xb8cf('0x54')](path['join'](_0x1431b5[_0xb8cf('0x44')],_0x3163ac));});fs[_0xb8cf('0x55')](_0x1431b5[_0xb8cf('0x44')]);}return _0x1431b5;});})[_0xb8cf('0x3b')](function(_0x22f3a5){throw new db[(_0xb8cf('0x56'))][(_0xb8cf('0x57'))](_0x22f3a5['message']);});}})[_0xb8cf('0x1d')](handleEntityNotFound(_0x376ee3,null))['then'](removeEntity(_0x376ee3,null))[_0xb8cf('0x3b')](handleError(_0x376ee3,null));};exports['addSound']=function(_0x3b94cb,_0x426b4d,_0x3f80d6){return db[_0xb8cf('0x40')][_0xb8cf('0x41')](function(_0x5be963){var _0x3cbac7;return db[_0xb8cf('0x23')]['find']({'where':{'id':_0x3b94cb['params']['id']}})[_0xb8cf('0x1d')](function(_0x13b119){if(_0x13b119){_0x3cbac7=_0x13b119;return _0x13b119[_0xb8cf('0x58')](_0x3b94cb[_0xb8cf('0x3f')]['id'],{'transaction':_0x5be963});}})[_0xb8cf('0x1d')](function(_0x39e1c5){if(_0x39e1c5){return db[_0xb8cf('0x59')][_0xb8cf('0x5a')]({'where':{'id':_0x3b94cb[_0xb8cf('0x3f')]['id']},'attributes':['id','name',_0xb8cf('0x5b'),_0xb8cf('0x5c'),_0xb8cf('0x5d')],'raw':!![]});}})[_0xb8cf('0x1d')](function(_0x2acb47){if(_0x2acb47){var _0x5221a1=path[_0xb8cf('0x45')](config['root'],_0xb8cf('0x5e'),util[_0xb8cf('0x5f')](_0xb8cf('0x60'),path['basename'](_0x2acb47[_0xb8cf('0x5b')],path[_0xb8cf('0x61')](_0x2acb47[_0xb8cf('0x5b')])),_0x2acb47[_0xb8cf('0x5c')]));var _0x3544b4=path['join'](config[_0xb8cf('0x46')],'server/files/moh',_0x3cbac7['name'],util[_0xb8cf('0x5f')](_0xb8cf('0x60'),_0x2acb47[_0xb8cf('0x21')],_0x2acb47[_0xb8cf('0x5c')]));fs[_0xb8cf('0x62')](_0x5221a1,_0x3544b4);return _0x2acb47;}})[_0xb8cf('0x3b')](function(_0x50446d){throw new db[(_0xb8cf('0x56'))][(_0xb8cf('0x57'))](_0x50446d[_0xb8cf('0x63')]);});})[_0xb8cf('0x1d')](handleEntityNotFound(_0x426b4d,null))[_0xb8cf('0x1d')](respondWithResult(_0x426b4d,0xc9))[_0xb8cf('0x3b')](handleError(_0x426b4d,null));};exports[_0xb8cf('0x64')]=function(_0xe3d4dc,_0x204079,_0xf8c1fa){return db[_0xb8cf('0x40')][_0xb8cf('0x41')](function(_0x34943d){var _0x9e57a6;return db[_0xb8cf('0x23')]['findOne']({'where':{'id':_0xe3d4dc['params']['id']}})['then'](handleEntityNotFound(_0x204079,null))[_0xb8cf('0x1d')](function(_0x23d24b){if(_0x23d24b){_0x9e57a6=_0x23d24b;return _0x23d24b[_0xb8cf('0x64')](_0xe3d4dc[_0xb8cf('0x3d')]['id2']);}})['then'](function(_0xd47358){if(_0xd47358){return db[_0xb8cf('0x59')][_0xb8cf('0x5a')]({'where':{'id':_0xe3d4dc[_0xb8cf('0x3d')]['id2']},'attributes':['id','name','save_name',_0xb8cf('0x5c'),_0xb8cf('0x5d')],'raw':!![]});}})[_0xb8cf('0x1d')](function(_0x5351b8){if(_0x5351b8){fs[_0xb8cf('0x54')](path['join'](_0x9e57a6['directory'],util[_0xb8cf('0x5f')](_0xb8cf('0x60'),_0x5351b8[_0xb8cf('0x21')],_0x5351b8[_0xb8cf('0x5c')])));return _0x5351b8;}})[_0xb8cf('0x3b')](function(_0x2e9dfb){throw new db[(_0xb8cf('0x56'))][(_0xb8cf('0x57'))](_0x2e9dfb['message']);});})[_0xb8cf('0x1d')](handleEntityNotFound(_0x204079,null))[_0xb8cf('0x1d')](respondWithStatusCode(_0x204079,0xcc))[_0xb8cf('0x3b')](handleError(_0x204079,null));};exports[_0xb8cf('0x65')]=function(_0x3a2ff2,_0x2ecd1f,_0x49eddd){var _0x28a4b6={};var _0x350d27={};var _0x20dbbb;var _0x259bff;return db[_0xb8cf('0x23')][_0xb8cf('0x5a')]({'where':{'id':_0x3a2ff2[_0xb8cf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ecd1f,null))[_0xb8cf('0x1d')](function(_0x2f7d08){if(_0x2f7d08){_0x20dbbb=_0x2f7d08;_0x350d27[_0xb8cf('0x28')]=_[_0xb8cf('0x2a')](db['Sound']['rawAttributes']);_0x350d27[_0xb8cf('0x29')]=_['keys'](_0x3a2ff2[_0xb8cf('0x29')]);_0x350d27[_0xb8cf('0x2b')]=_[_0xb8cf('0x2c')](_0x350d27[_0xb8cf('0x28')],_0x350d27['query']);_0x28a4b6[_0xb8cf('0x2e')]=_[_0xb8cf('0x2c')](_0x350d27['model'],qs[_0xb8cf('0x2d')](_0x3a2ff2[_0xb8cf('0x29')]['fields']));_0x28a4b6[_0xb8cf('0x2e')]=_0x28a4b6['attributes'][_0xb8cf('0x2f')]?_0x28a4b6[_0xb8cf('0x2e')]:_0x350d27[_0xb8cf('0x28')];_0x28a4b6[_0xb8cf('0x31')]=qs['sort'](_0x3a2ff2[_0xb8cf('0x29')][_0xb8cf('0x32')]);_0x28a4b6['where']=qs['filters'](_['pick'](_0x3a2ff2[_0xb8cf('0x29')],_0x350d27['filters']));if(_0x3a2ff2[_0xb8cf('0x29')][_0xb8cf('0x34')]){_0x28a4b6[_0xb8cf('0x35')]=_[_0xb8cf('0x36')](_0x28a4b6[_0xb8cf('0x35')],{'$or':_[_0xb8cf('0x66')](_0x28a4b6[_0xb8cf('0x2e')],function(_0x32b79d){var _0xcea108={};_0xcea108[_0x32b79d]={'$like':'%'+_0x3a2ff2[_0xb8cf('0x29')][_0xb8cf('0x34')]+'%'};return _0xcea108;})});}_0x28a4b6=_['merge']({},_0x28a4b6,_0x3a2ff2[_0xb8cf('0x37')]);return _0x20dbbb[_0xb8cf('0x65')](_0x28a4b6);}})[_0xb8cf('0x1d')](function(_0x38a1fb){if(_0x38a1fb){_0x259bff=_0x38a1fb['length'];if(!_0x3a2ff2['query'][_0xb8cf('0x30')](_0xb8cf('0x67'))){_0x28a4b6['limit']=qs[_0xb8cf('0x16')](_0x3a2ff2['query'][_0xb8cf('0x16')]);_0x28a4b6[_0xb8cf('0x18')]=qs[_0xb8cf('0x18')](_0x3a2ff2['query'][_0xb8cf('0x18')]);}return _0x20dbbb[_0xb8cf('0x65')](_0x28a4b6);}})[_0xb8cf('0x1d')](function(_0x4f2ae1){if(_0x4f2ae1){return _0x4f2ae1?{'count':_0x259bff,'rows':_0x4f2ae1}:null;}})[_0xb8cf('0x1d')](respondWithResult(_0x2ecd1f,null))[_0xb8cf('0x3b')](handleError(_0x2ecd1f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3201995..3a989fb 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 _0x7154=['util','moment','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash'];(function(_0x49915a,_0xbff3dd){var _0x1db109=function(_0xc45153){while(--_0xc45153){_0x49915a['push'](_0x49915a['shift']());}};_0x1db109(++_0xbff3dd);}(_0x7154,0x135));var _0x4715=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x7154[_0x3c51d4];return _0x53c45f;};'use strict';var _=require(_0x4715('0x0'));var util=require(_0x4715('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4715('0x2'));var BPromise=require(_0x4715('0x3'));var rp=require(_0x4715('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4715('0x5'));var attributes=require(_0x4715('0x6'));module[_0x4715('0x7')]=function(_0x183f35,_0x510b72){return _0x183f35[_0x4715('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x4715('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89bb=['bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment'];(function(_0x587b3b,_0x40bca0){var _0x1493e2=function(_0x43305b){while(--_0x43305b){_0x587b3b['push'](_0x587b3b['shift']());}};_0x1493e2(++_0x40bca0);}(_0x89bb,0xb2));var _0xb89b=function(_0x2c6b1a,_0x530f39){_0x2c6b1a=_0x2c6b1a-0x0;var _0x4eab12=_0x89bb[_0x2c6b1a];return _0x4eab12;};'use strict';var _=require('lodash');var util=require(_0xb89b('0x0'));var logger=require(_0xb89b('0x1'))(_0xb89b('0x2'));var moment=require(_0xb89b('0x3'));var BPromise=require(_0xb89b('0x4'));var rp=require(_0xb89b('0x5'));var fs=require('fs');var path=require(_0xb89b('0x6'));var rimraf=require('rimraf');var config=require(_0xb89b('0x7'));var attributes=require(_0xb89b('0x8'));module[_0xb89b('0x9')]=function(_0x2a711f,_0x268854){return _0x2a711f[_0xb89b('0xa')](_0xb89b('0xb'),attributes,{'tableName':_0xb89b('0xc'),'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 2bf10b7..a6d5066 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 _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(_0x112f7c,_0x26601e){var _0xfff2f3=function(_0x51ffcf){while(--_0x51ffcf){_0x112f7c['push'](_0x112f7c['shift']());}};_0xfff2f3(++_0x26601e);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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 +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x100d4c,_0x47d49e){var _0x51c17b=function(_0x149376){while(--_0x149376){_0x100d4c['push'](_0x100d4c['shift']());}};_0x51c17b(++_0x47d49e);}(_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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 45decd2..121136b 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 _0x3468=['../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','/:id/teams','addTeams','put','delete','removeAgents','removeTeams','exports','multer','connect-timeout','fs-extra'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x3468,0x8d));var _0x8346=function(_0x184093,_0x11206d){_0x184093=_0x184093-0x0;var _0x537afc=_0x3468[_0x184093];return _0x537afc;};'use strict';var multer=require(_0x8346('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8346('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8346('0x2'));var auth=require(_0x8346('0x3'));var interaction=require(_0x8346('0x4'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x8346('0x5')](),controller['index']);router[_0x8346('0x6')](_0x8346('0x7'),auth[_0x8346('0x5')](),controller[_0x8346('0x8')]);router[_0x8346('0x6')](_0x8346('0x9'),auth[_0x8346('0x5')](),controller[_0x8346('0xa')]);router[_0x8346('0x6')](_0x8346('0xb'),auth[_0x8346('0x5')](),controller[_0x8346('0xc')]);router[_0x8346('0x6')]('/:id/teams',auth[_0x8346('0x5')](),controller[_0x8346('0xd')]);router[_0x8346('0xe')]('/',auth[_0x8346('0x5')](),controller[_0x8346('0xf')]);router[_0x8346('0xe')]('/:id/users',auth[_0x8346('0x5')](),controller[_0x8346('0x10')]);router[_0x8346('0xe')](_0x8346('0x11'),auth[_0x8346('0x5')](),controller[_0x8346('0x12')]);router[_0x8346('0x13')]('/:id',auth[_0x8346('0x5')](),controller['update']);router[_0x8346('0x14')]('/:id',auth[_0x8346('0x5')](),controller['destroy']);router[_0x8346('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x8346('0x15')]);router[_0x8346('0x14')]('/:id/teams',auth[_0x8346('0x5')](),controller[_0x8346('0x16')]);module[_0x8346('0x17')]=router; \ No newline at end of file +var _0x0689=['destroy','delete','removeAgents','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update'];(function(_0x2e3970,_0x3a80a6){var _0x605962=function(_0x34f9a6){while(--_0x34f9a6){_0x2e3970['push'](_0x2e3970['shift']());}};_0x605962(++_0x3a80a6);}(_0x0689,0x161));var _0x9068=function(_0x257ada,_0x117063){_0x257ada=_0x257ada-0x0;var _0x38bbfd=_0x0689[_0x257ada];return _0x38bbfd;};'use strict';var multer=require('multer');var util=require(_0x9068('0x0'));var path=require('path');var timeout=require(_0x9068('0x1'));var express=require(_0x9068('0x2'));var router=express[_0x9068('0x3')]();var fs_extra=require(_0x9068('0x4'));var auth=require(_0x9068('0x5'));var interaction=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var controller=require(_0x9068('0x8'));router[_0x9068('0x9')]('/',auth[_0x9068('0xa')](),controller['index']);router[_0x9068('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9068('0xb')]);router[_0x9068('0x9')](_0x9068('0xc'),auth[_0x9068('0xa')](),controller[_0x9068('0xd')]);router[_0x9068('0x9')](_0x9068('0xe'),auth[_0x9068('0xa')](),controller[_0x9068('0xf')]);router['get'](_0x9068('0x10'),auth[_0x9068('0xa')](),controller[_0x9068('0x11')]);router[_0x9068('0x12')]('/',auth['isAuthenticated'](),controller[_0x9068('0x13')]);router[_0x9068('0x12')](_0x9068('0xe'),auth['isAuthenticated'](),controller[_0x9068('0x14')]);router[_0x9068('0x12')](_0x9068('0x10'),auth['isAuthenticated'](),controller[_0x9068('0x15')]);router[_0x9068('0x16')]('/:id',auth[_0x9068('0xa')](),controller[_0x9068('0x17')]);router['delete'](_0x9068('0xc'),auth[_0x9068('0xa')](),controller[_0x9068('0x18')]);router[_0x9068('0x19')]('/:id/users',auth[_0x9068('0xa')](),controller[_0x9068('0x1a')]);router[_0x9068('0x19')](_0x9068('0x10'),auth[_0x9068('0xa')](),controller[_0x9068('0x1b')]);module[_0x9068('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 20fefc3..51af9b4 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 _0x6c00=['STRING','name','VIRTUAL','INTEGER','exports'];(function(_0x3ad241,_0x3cd1f1){var _0x56e51b=function(_0x20c46c){while(--_0x20c46c){_0x3ad241['push'](_0x3ad241['shift']());}};_0x56e51b(++_0x3cd1f1);}(_0x6c00,0x135));var _0x06c0=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x6c00[_0x22bdd3];return _0x44d9d9;};'use strict';var Sequelize=require('sequelize');module[_0x06c0('0x0')]={'name':{'type':Sequelize[_0x06c0('0x1')],'allowNull':![],'unique':_0x06c0('0x2')},'prefix':{'type':Sequelize[_0x06c0('0x3')],'get':function(_0x29fb15){return'system-'+this['getDataValue'](_0x06c0('0x2'))+'-';}},'description':{'type':Sequelize[_0x06c0('0x1')]},'callerIdAll':{'type':Sequelize[_0x06c0('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x06c0('0x4')]}}; \ No newline at end of file +var _0x1f90=['STRING','name','system-','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f90,0x172));var _0x01f9=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x1f90[_0xffa198];return _0x1e4b50;};'use strict';var Sequelize=require(_0x01f9('0x0'));module[_0x01f9('0x1')]={'name':{'type':Sequelize[_0x01f9('0x2')],'allowNull':![],'unique':_0x01f9('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5145ed){return _0x01f9('0x4')+this['getDataValue'](_0x01f9('0x3'))+'-';}},'description':{'type':Sequelize[_0x01f9('0x2')]},'callerIdAll':{'type':Sequelize[_0x01f9('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x01f9('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6bb8f40..e5ec632 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 _0x5464=['findById','addAgents','omit','spread','ids','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','order','options','nolimit','getTeams','Team','addTeams','online','interface','flatMap','each','TeamVoicePrefix','upsert','forEach','removeTeams','Agents','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','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','redis','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','includeAll','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','type','description','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x5464,0x15d));var _0x4546=function(_0x945643,_0x468399){_0x945643=_0x945643-0x0;var _0x449dd1=_0x5464[_0x945643];return _0x449dd1;};'use strict';var emlformat=require(_0x4546('0x0'));var rimraf=require(_0x4546('0x1'));var zipdir=require(_0x4546('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4546('0x3'));var moment=require('moment');var BPromise=require(_0x4546('0x4'));var Mustache=require('mustache');var util=require(_0x4546('0x5'));var path=require(_0x4546('0x6'));var sox=require(_0x4546('0x7'));var csv=require(_0x4546('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0x8'));var querystring=require(_0x4546('0xd'));var Papa=require(_0x4546('0xe'));var Redis=require(_0x4546('0xf'));var authService=require(_0x4546('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x11'));var hardwareService=require(_0x4546('0x12'));var logger=require(_0x4546('0x13'))('api');var utils=require(_0x4546('0x14'));var config=require(_0x4546('0x15'));var licenseUtil=require(_0x4546('0x16'));var db=require(_0x4546('0x17'))['db'];config['redis']=_['defaults'](config[_0x4546('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x4f5571,_0x102180){_0x102180=_0x102180||0xcc;return function(_0x51e279){if(_0x51e279){return _0x4f5571[_0x4546('0x19')](_0x102180);}return _0x4f5571['status'](_0x102180)[_0x4546('0x1a')]();};}function respondWithResult(_0x564f3e,_0x3741f2){_0x3741f2=_0x3741f2||0xc8;return function(_0x18bc09){if(_0x18bc09){return _0x564f3e[_0x4546('0x1b')](_0x3741f2)[_0x4546('0x1c')](_0x18bc09);}};}function respondWithFilteredResult(_0x2a294b,_0x15e09e){return function(_0x57d8de){if(_0x57d8de){var _0x4ffd6b=typeof _0x15e09e['offset']===_0x4546('0x1d')&&typeof _0x15e09e[_0x4546('0x1e')]===_0x4546('0x1d');var _0x3d95c2=_0x57d8de[_0x4546('0x1f')];var _0x337a44=_0x4ffd6b?0x0:_0x15e09e[_0x4546('0x20')];var _0x2f6329=_0x4ffd6b?_0x57d8de[_0x4546('0x1f')]:_0x15e09e[_0x4546('0x20')]+_0x15e09e['limit'];var _0x2d689f;if(_0x2f6329>=_0x3d95c2){_0x2f6329=_0x3d95c2;_0x2d689f=0xc8;}else{_0x2d689f=0xce;}_0x2a294b[_0x4546('0x1b')](_0x2d689f);return _0x2a294b['set'](_0x4546('0x21'),_0x337a44+'-'+_0x2f6329+'/'+_0x3d95c2)[_0x4546('0x1c')](_0x57d8de);}return null;};}function patchUpdates(_0x1a1984){return function(_0x2f065d){try{jsonpatch[_0x4546('0x22')](_0x2f065d,_0x1a1984,!![]);}catch(_0x15b013){return BPromise['reject'](_0x15b013);}return _0x2f065d[_0x4546('0x23')]();};}function saveUpdates(_0x2cca8b,_0x4f9fcf){return function(_0x824698){if(_0x824698){return _0x824698[_0x4546('0x24')](_0x2cca8b)[_0x4546('0x25')](function(_0x4467ee){return _0x4467ee;});}return null;};}function removeEntity(_0x23084b,_0x53ae5e){return function(_0x49dc98){if(_0x49dc98){return _0x49dc98[_0x4546('0x26')]()[_0x4546('0x25')](function(){var _0x48fc36=_0x49dc98['get']({'plain':!![]});var _0x43740e=_0x4546('0x27');return db[_0x4546('0x28')][_0x4546('0x26')]({'where':{'type':_0x43740e,'resourceId':_0x48fc36['id']}})[_0x4546('0x25')](function(){return _0x49dc98;});})[_0x4546('0x25')](function(){_0x23084b[_0x4546('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x367b23,_0x52c546){return function(_0x3a2d12){if(!_0x3a2d12){_0x367b23[_0x4546('0x19')](0x194);}return _0x3a2d12;};}function handleError(_0x5396c5,_0x539f74){_0x539f74=_0x539f74||0x1f4;return function(_0xf7a95b){logger['error'](_0xf7a95b[_0x4546('0x29')]);if(_0xf7a95b[_0x4546('0x2a')]){delete _0xf7a95b['name'];}_0x5396c5['status'](_0x539f74)[_0x4546('0x2b')](_0xf7a95b);};}exports[_0x4546('0x2c')]=function(_0x258d26,_0x5716dc){var _0x10db2e={},_0x2c8e44={},_0x540983={'count':0x0,'rows':[]};var _0xad1b9c=_['map'](db[_0x4546('0x2d')][_0x4546('0x2e')],function(_0xe89b7c){return{'name':_0xe89b7c[_0x4546('0x2f')],'type':_0xe89b7c['type'][_0x4546('0x30')]};});_0x2c8e44[_0x4546('0x31')]=_[_0x4546('0x32')](_0xad1b9c,_0x4546('0x2a'));_0x2c8e44[_0x4546('0x33')]=_[_0x4546('0x34')](_0x258d26['query']);_0x2c8e44[_0x4546('0x35')]=_[_0x4546('0x36')](_0x2c8e44['model'],_0x2c8e44['query']);_0x10db2e[_0x4546('0x37')]=_[_0x4546('0x36')](_0x2c8e44['model'],qs[_0x4546('0x38')](_0x258d26[_0x4546('0x33')]['fields']));_0x10db2e['attributes']=_0x10db2e[_0x4546('0x37')][_0x4546('0x39')]?_0x10db2e[_0x4546('0x37')]:_0x2c8e44[_0x4546('0x31')];if(!_0x258d26[_0x4546('0x33')][_0x4546('0x3a')]('nolimit')){_0x10db2e[_0x4546('0x1e')]=qs[_0x4546('0x1e')](_0x258d26['query'][_0x4546('0x1e')]);_0x10db2e['offset']=qs[_0x4546('0x20')](_0x258d26[_0x4546('0x33')]['offset']);}_0x10db2e['order']=qs[_0x4546('0x3b')](_0x258d26[_0x4546('0x33')][_0x4546('0x3b')]);_0x10db2e['where']=qs[_0x4546('0x35')](_[_0x4546('0x3c')](_0x258d26[_0x4546('0x33')],_0x2c8e44[_0x4546('0x35')]),_0xad1b9c);if(_0x258d26[_0x4546('0x33')][_0x4546('0x3d')]){_0x10db2e[_0x4546('0x3e')]=_[_0x4546('0x3f')](_0x10db2e['where'],{'$or':_[_0x4546('0x32')](_0xad1b9c,function(_0x9bedd7){if(_0x9bedd7['type']!=='VIRTUAL'){var _0x3bafee={};_0x3bafee[_0x9bedd7[_0x4546('0x2a')]]={'$like':'%'+_0x258d26[_0x4546('0x33')][_0x4546('0x3d')]+'%'};return _0x3bafee;}})});}_0x10db2e=_[_0x4546('0x3f')]({},_0x10db2e,_0x258d26['options']);var _0x977146={'where':_0x10db2e[_0x4546('0x3e')]};return db[_0x4546('0x2d')][_0x4546('0x1f')](_0x977146)[_0x4546('0x25')](function(_0x3fabf0){_0x540983[_0x4546('0x1f')]=_0x3fabf0;if(_0x258d26[_0x4546('0x33')][_0x4546('0x40')]){_0x10db2e['include']=[{'all':!![]}];}return db[_0x4546('0x2d')][_0x4546('0x41')](_0x10db2e);})[_0x4546('0x25')](function(_0x35b51e){_0x540983[_0x4546('0x42')]=_0x35b51e;return _0x540983;})[_0x4546('0x25')](respondWithFilteredResult(_0x5716dc,_0x10db2e))[_0x4546('0x43')](handleError(_0x5716dc,null));};exports[_0x4546('0x44')]=function(_0x426eb9,_0x44752d){var _0x19cdad={'raw':![],'where':{'id':_0x426eb9[_0x4546('0x45')]['id']}},_0x524702={};_0x524702[_0x4546('0x31')]=_['keys'](db[_0x4546('0x2d')][_0x4546('0x2e')]);_0x524702[_0x4546('0x33')]=_['keys'](_0x426eb9[_0x4546('0x33')]);_0x524702[_0x4546('0x35')]=_[_0x4546('0x36')](_0x524702[_0x4546('0x31')],_0x524702[_0x4546('0x33')]);_0x19cdad[_0x4546('0x37')]=_[_0x4546('0x36')](_0x524702[_0x4546('0x31')],qs[_0x4546('0x38')](_0x426eb9[_0x4546('0x33')]['fields']));_0x19cdad[_0x4546('0x37')]=_0x19cdad[_0x4546('0x37')]['length']?_0x19cdad[_0x4546('0x37')]:_0x524702[_0x4546('0x31')];if(_0x426eb9[_0x4546('0x33')][_0x4546('0x40')]){_0x19cdad['include']=[{'all':!![]}];}_0x19cdad=_[_0x4546('0x3f')]({},_0x19cdad,_0x426eb9['options']);return db[_0x4546('0x2d')][_0x4546('0x46')](_0x19cdad)[_0x4546('0x25')](handleEntityNotFound(_0x44752d,null))['then'](respondWithResult(_0x44752d,null))[_0x4546('0x43')](handleError(_0x44752d,null));};exports[_0x4546('0x26')]=function(_0x13f705,_0xc8a1f3){return db[_0x4546('0x2d')][_0x4546('0x46')]({'where':{'id':_0x13f705[_0x4546('0x45')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0xc8a1f3,null))[_0x4546('0x25')](removeEntity(_0xc8a1f3,null))[_0x4546('0x43')](handleError(_0xc8a1f3,null));};exports[_0x4546('0x47')]=function(_0x49b0d8,_0x2778f2){return db[_0x4546('0x2d')]['describe']()[_0x4546('0x25')](respondWithResult(_0x2778f2,null))[_0x4546('0x43')](handleError(_0x2778f2,null));};exports[_0x4546('0x48')]=function(_0x4ca3a6,_0x422ebc){var _0x31dc1e;return db[_0x4546('0x49')][_0x4546('0x4a')](function(_0x10dfd6){return db[_0x4546('0x2d')][_0x4546('0x48')](_0x4ca3a6[_0x4546('0x4b')],{'transaction':_0x10dfd6})[_0x4546('0x25')](function(_0x15365d){_0x31dc1e=_0x15365d[_0x4546('0x4c')]({'plain':!![]});return db[_0x4546('0x4d')][_0x4546('0x46')]({'where':{'id':_0x31dc1e[_0x4546('0x4e')]},'raw':!![]})[_0x4546('0x25')](function(_0x456ebe){return createVoicePrefixExtensions(_0x31dc1e,_0x456ebe,_0x10dfd6);});});})['then'](function(){var _0x3e13ab=_0x4ca3a6[_0x4546('0x4f')]['get']({'plain':!![]});if(!_0x3e13ab)throw new Error(_0x4546('0x50'));if(_0x3e13ab[_0x4546('0x51')]===_0x4546('0x4f')){var _0x30e748=_0x31dc1e;return db['UserProfileSection'][_0x4546('0x46')]({'where':{'name':_0x4546('0x27'),'userProfileId':_0x3e13ab[_0x4546('0x52')]},'raw':!![]})[_0x4546('0x25')](function(_0x49a106){if(_0x49a106&&_0x49a106[_0x4546('0x53')]===0x0){return db[_0x4546('0x28')][_0x4546('0x48')]({'name':_0x30e748[_0x4546('0x2a')],'resourceId':_0x30e748['id'],'type':_0x49a106[_0x4546('0x2a')],'sectionId':_0x49a106['id']},{})[_0x4546('0x25')](function(){return _0x31dc1e;});}else{return _0x31dc1e;}})['catch'](function(_0x2ece0a){logger[_0x4546('0x54')](_0x4546('0x55'),_0x2ece0a);throw _0x2ece0a;});}return _0x31dc1e;})[_0x4546('0x25')](respondWithResult(_0x422ebc,null))['catch'](handleError(_0x422ebc,null));};function Extension(_0x37d128,_0x4a1a00,_0x28238f,_0x24e66c){this[_0x4546('0x56')]=_0x4546('0x57');this[_0x4546('0x58')]=_0x37d128;this['app']=_0x28238f;this[_0x4546('0x59')]='system';this[_0x4546('0x5a')]='Voice\x20Prefix\x20Extension';this['priority']=_0x4a1a00;this['appdata']=_0x24e66c;}function createVoicePrefixExtensions(_0xbf2eab,_0x5e35bf,_0x29f980){return new BPromise(function(_0x466f19,_0x1e4914){var _0x2a1a21=new Extension(formatPrefixName(_0xbf2eab['prefix']),0x1,_0x4546('0x5b'),_0x4546('0x5c'));_0x2a1a21[_0x4546('0x5d')]=_0xbf2eab['id'];return db[_0x4546('0x4d')][_0x4546('0x48')](_0x2a1a21,{'transaction':_0x29f980})['then'](function(_0xc4be35){var _0x4b3340=_0xc4be35[_0x4546('0x4c')]({'plain':!![]});var _0x4c21d6=_[_0x4546('0x32')](addVoicePrefixExtensions(_0xbf2eab,_0x5e35bf),function(_0x423330){_0x423330[_0x4546('0x4e')]=_0x4b3340['id'];_0x423330['VoicePrefixId']=_0xbf2eab['id'];return _0x423330;});return db[_0x4546('0x4d')][_0x4546('0x5e')](_0x4c21d6,{'transaction':_0x29f980})[_0x4546('0x25')](function(_0x220259){if(!_0x220259){return _0x1e4914(_0x4546('0x5f'));}else{return _0x466f19(_0x220259);}})[_0x4546('0x43')](function(_0x310661){return _0x1e4914(_0x310661);});});;});};function addVoicePrefixExtensions(_0x332ed4,_0x55ecd9){var _0x2b231f=[];var _0x2c0ee3=formatPrefixName(_0x332ed4[_0x4546('0x60')]);_0x2b231f[_0x4546('0x61')](new Extension(_0x2c0ee3,0x2,_0x4546('0x62'),_0x4546('0x63')+_0x332ed4[_0x4546('0x2a')]));if(_0x332ed4[_0x4546('0x64')]){_0x2b231f[_0x4546('0x61')](new Extension(_0x2c0ee3,0x3,_0x4546('0x62'),_0x4546('0x65')+_0x332ed4[_0x4546('0x64')]));}else{_0x2b231f[_0x4546('0x61')](new Extension(_0x2c0ee3,0x3,_0x4546('0x5b'),_0x4546('0x66')));}_0x2b231f['push'](new Extension(_0x2c0ee3,0x4,_0x4546('0x67'),_0x55ecd9['context']+','+_0x4546('0x68')+(0x8+_0x332ed4[_0x4546('0x2a')]['length'])+'}'+','+0x1));return _0x2b231f;}function formatPrefixName(_0x314afc){var _0x335881='_';for(var _0x27680b=0x0;_0x27680b<_0x314afc[_0x4546('0x39')];_0x27680b++){if(_0x314afc[_0x4546('0x69')](_0x27680b)=='-'){_0x335881+=_0x314afc[_0x4546('0x69')](_0x27680b);}else{_0x335881+='['+_0x314afc[_0x4546('0x69')](_0x27680b)+']';}}_0x335881+='.';return _0x335881;}exports[_0x4546('0x24')]=function(_0x275c76,_0x3f3f99,_0x1aa678){var _0x194667=_0x275c76[_0x4546('0x4b')];_0x194667['prefix']=_0x4546('0x6a')+_0x194667[_0x4546('0x2a')]+'-';return db[_0x4546('0x49')]['transaction'](function(_0xb6e936){return db[_0x4546('0x2d')][_0x4546('0x24')](_0x194667,{'where':{'id':_0x194667['id']},'transaction':_0xb6e936})[_0x4546('0x25')](function(){return db[_0x4546('0x4d')][_0x4546('0x26')]({'where':{'VoicePrefixId':_0x194667['id']},'transaction':_0xb6e936})[_0x4546('0x25')](function(){return db['VoiceExtension'][_0x4546('0x46')]({'where':{'id':_0x194667[_0x4546('0x4e')]},'raw':!![]})[_0x4546('0x25')](function(_0x5d14f1){return createVoicePrefixExtensions(_0x194667,_0x5d14f1,_0xb6e936);});});});})['then'](function(){return db[_0x4546('0x2d')][_0x4546('0x6b')](_0x194667['id']);})['then'](respondWithResult(_0x3f3f99,null))[_0x4546('0x43')](handleError(_0x3f3f99,null));};exports[_0x4546('0x6c')]=function(_0x121e51,_0x11e2e4,_0x5e17a2){return db[_0x4546('0x2d')][_0x4546('0x46')]({'where':{'id':_0x121e51[_0x4546('0x45')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0x11e2e4,null))[_0x4546('0x25')](function(_0x45f510){if(_0x45f510){return _0x45f510[_0x4546('0x6c')](_0x121e51[_0x4546('0x4b')]['ids'],_[_0x4546('0x6d')](_0x121e51[_0x4546('0x4b')],['ids','id'])||{})[_0x4546('0x6e')](function(_0x5a0de1){for(var _0x52419e=0x0;_0x52419e<_0x121e51[_0x4546('0x4b')][_0x4546('0x6f')][_0x4546('0x39')];_0x52419e+=0x1){socket['emit'](_0x4546('0x70'),{'UserId':Number(_0x121e51[_0x4546('0x4b')][_0x4546('0x6f')][_0x52419e]),'VoicePrefixId':Number(_0x121e51[_0x4546('0x45')]['id'])});}return _0x5a0de1;});}})[_0x4546('0x25')](respondWithResult(_0x11e2e4,null))[_0x4546('0x43')](handleError(_0x11e2e4,null));};exports[_0x4546('0x71')]=function(_0x50078a,_0x4cd517,_0x40897f){return db[_0x4546('0x2d')][_0x4546('0x46')]({'where':{'id':_0x50078a[_0x4546('0x45')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0x4cd517,null))[_0x4546('0x25')](function(_0x4c1a64){if(_0x4c1a64){return _0x4c1a64['removeAgents'](_0x50078a[_0x4546('0x33')][_0x4546('0x6f')])[_0x4546('0x25')](function(){if(_[_0x4546('0x72')](_0x50078a[_0x4546('0x33')][_0x4546('0x6f')])){for(var _0x3e38bd=0x0;_0x3e38bd<_0x50078a[_0x4546('0x33')]['ids'][_0x4546('0x39')];_0x3e38bd+=0x1){socket['emit'](_0x4546('0x73'),{'UserId':Number(_0x50078a[_0x4546('0x33')][_0x4546('0x6f')][_0x3e38bd]),'VoicePrefixId':Number(_0x50078a['params']['id'])});}}else{socket[_0x4546('0x74')](_0x4546('0x73'),{'UserId':Number(_0x50078a[_0x4546('0x33')][_0x4546('0x6f')]),'VoicePrefixId':Number(_0x50078a[_0x4546('0x45')]['id'])});}});}})[_0x4546('0x25')](respondWithStatusCode(_0x4cd517,null))[_0x4546('0x43')](handleError(_0x4cd517,null));};exports[_0x4546('0x75')]=function(_0x3ff208,_0xc35517,_0x5f29c6){var _0x41cb1f={};var _0x454663={};var _0x59021a;var _0x36f8b5;return db[_0x4546('0x2d')][_0x4546('0x76')]({'where':{'id':_0x3ff208[_0x4546('0x45')]['id']}})['then'](handleEntityNotFound(_0xc35517,null))['then'](function(_0x3842fd){if(_0x3842fd){_0x59021a=_0x3842fd;_0x454663[_0x4546('0x31')]=_[_0x4546('0x34')](db[_0x4546('0x77')][_0x4546('0x2e')]);_0x454663['query']=_[_0x4546('0x34')](_0x3ff208[_0x4546('0x33')]);_0x454663[_0x4546('0x35')]=_[_0x4546('0x36')](_0x454663[_0x4546('0x31')],_0x454663['query']);_0x41cb1f[_0x4546('0x37')]=_['intersection'](_0x454663[_0x4546('0x31')],qs[_0x4546('0x38')](_0x3ff208[_0x4546('0x33')][_0x4546('0x38')]));_0x41cb1f[_0x4546('0x37')]=_0x41cb1f[_0x4546('0x37')][_0x4546('0x39')]?_0x41cb1f[_0x4546('0x37')]:_0x454663['model'];_0x41cb1f[_0x4546('0x78')]=qs[_0x4546('0x3b')](_0x3ff208[_0x4546('0x33')][_0x4546('0x3b')]);_0x41cb1f[_0x4546('0x3e')]=qs['filters'](_[_0x4546('0x3c')](_0x3ff208['query'],_0x454663['filters']));if(_0x3ff208['query'][_0x4546('0x3d')]){_0x41cb1f[_0x4546('0x3e')]=_[_0x4546('0x3f')](_0x41cb1f[_0x4546('0x3e')],{'$or':_[_0x4546('0x32')](_0x41cb1f[_0x4546('0x37')],function(_0x180a07){var _0x327ae2={};_0x327ae2[_0x180a07]={'$like':'%'+_0x3ff208[_0x4546('0x33')][_0x4546('0x3d')]+'%'};return _0x327ae2;})});}_0x41cb1f=_['merge']({},_0x41cb1f,_0x3ff208[_0x4546('0x79')]);return _0x59021a['getAgents'](_0x41cb1f);}})[_0x4546('0x25')](function(_0x278e43){if(_0x278e43){_0x36f8b5=_0x278e43[_0x4546('0x39')];if(!_0x3ff208[_0x4546('0x33')][_0x4546('0x3a')](_0x4546('0x7a'))){_0x41cb1f[_0x4546('0x1e')]=qs['limit'](_0x3ff208[_0x4546('0x33')][_0x4546('0x1e')]);_0x41cb1f['offset']=qs[_0x4546('0x20')](_0x3ff208[_0x4546('0x33')][_0x4546('0x20')]);}return _0x59021a[_0x4546('0x75')](_0x41cb1f);}})[_0x4546('0x25')](function(_0x2a9010){if(_0x2a9010){return _0x2a9010?{'count':_0x36f8b5,'rows':_0x2a9010}:null;}})[_0x4546('0x25')](respondWithResult(_0xc35517,null))[_0x4546('0x43')](handleError(_0xc35517,null));};exports[_0x4546('0x7b')]=function(_0x3cbef4,_0x264c12,_0x2ba11b){var _0x59b252={};var _0x37d871={};var _0xf3a8dc;var _0x4247db;return db[_0x4546('0x2d')][_0x4546('0x76')]({'where':{'id':_0x3cbef4[_0x4546('0x45')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0x264c12,null))[_0x4546('0x25')](function(_0x3855e9){if(_0x3855e9){_0xf3a8dc=_0x3855e9;_0x37d871[_0x4546('0x31')]=_[_0x4546('0x34')](db[_0x4546('0x7c')][_0x4546('0x2e')]);_0x37d871[_0x4546('0x33')]=_[_0x4546('0x34')](_0x3cbef4[_0x4546('0x33')]);_0x37d871[_0x4546('0x35')]=_[_0x4546('0x36')](_0x37d871[_0x4546('0x31')],_0x37d871[_0x4546('0x33')]);_0x59b252[_0x4546('0x37')]=_[_0x4546('0x36')](_0x37d871[_0x4546('0x31')],qs['fields'](_0x3cbef4['query'][_0x4546('0x38')]));_0x59b252['attributes']=_0x59b252[_0x4546('0x37')][_0x4546('0x39')]?_0x59b252[_0x4546('0x37')]:_0x37d871['model'];_0x59b252[_0x4546('0x78')]=qs['sort'](_0x3cbef4['query'][_0x4546('0x3b')]);_0x59b252[_0x4546('0x3e')]=qs[_0x4546('0x35')](_['pick'](_0x3cbef4['query'],_0x37d871[_0x4546('0x35')]));if(_0x3cbef4[_0x4546('0x33')]['filter']){_0x59b252[_0x4546('0x3e')]=_[_0x4546('0x3f')](_0x59b252[_0x4546('0x3e')],{'$or':_[_0x4546('0x32')](_0x59b252[_0x4546('0x37')],function(_0x65a6a4){var _0x417e49={};_0x417e49[_0x65a6a4]={'$like':'%'+_0x3cbef4['query'][_0x4546('0x3d')]+'%'};return _0x417e49;})});}_0x59b252=_['merge']({},_0x59b252,_0x3cbef4[_0x4546('0x79')]);return _0xf3a8dc['getTeams'](_0x59b252);}})['then'](function(_0x3d95e5){if(_0x3d95e5){_0x4247db=_0x3d95e5['length'];if(!_0x3cbef4['query'][_0x4546('0x3a')](_0x4546('0x7a'))){_0x59b252[_0x4546('0x1e')]=qs[_0x4546('0x1e')](_0x3cbef4[_0x4546('0x33')][_0x4546('0x1e')]);_0x59b252[_0x4546('0x20')]=qs['offset'](_0x3cbef4[_0x4546('0x33')]['offset']);}return _0xf3a8dc[_0x4546('0x7b')](_0x59b252);}})[_0x4546('0x25')](function(_0x24798b){if(_0x24798b){return _0x24798b?{'count':_0x4247db,'rows':_0x24798b}:null;}})[_0x4546('0x25')](respondWithResult(_0x264c12,null))[_0x4546('0x43')](handleError(_0x264c12,null));};exports[_0x4546('0x7d')]=function(_0x597648,_0x19aeab,_0x22a956){var _0x12eea5=_0x597648[_0x4546('0x4b')]['ids'];var _0x33f125;return db[_0x4546('0x7c')][_0x4546('0x41')]({'where':{'id':_0x12eea5},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x4546('0x7e'),'voicePause',_0x4546('0x7f')],'raw':!![]}]})['then'](function(_0x3fc0b8){if(_0x3fc0b8){_0x33f125=_0x3fc0b8;var _0x55ec89=_[_0x4546('0x80')](_0x3fc0b8,function(_0x645df3){var _0x54bd82=_0x645df3[_0x4546('0x4c')]({'plain':!![]});return _0x54bd82['Agents'];});return db[_0x4546('0x2d')][_0x4546('0x46')]({'where':{'id':_0x597648[_0x4546('0x45')]['id']}})[_0x4546('0x25')](function(_0x7f3cf0){return db['sequelize'][_0x4546('0x4a')](function(_0x3ab4f4){return _0x7f3cf0[_0x4546('0x7d')](_0x12eea5,{'transaction':_0x3ab4f4})[_0x4546('0x25')](function(){return BPromise[_0x4546('0x81')](_0x33f125,function(_0x4dae4a){return db[_0x4546('0x82')][_0x4546('0x83')]({'TeamId':_0x4dae4a['id'],'VoicePrefixId':_0x597648[_0x4546('0x45')]['id']},{'transaction':_0x3ab4f4});});})[_0x4546('0x25')](function(){return BPromise[_0x4546('0x81')](_0x55ec89,function(_0x14d671){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x14d671['id'],'VoicePrefixId':_0x597648[_0x4546('0x45')]['id']},'transaction':_0x3ab4f4});});})[_0x4546('0x25')](function(){_0x55ec89[_0x4546('0x84')](function(_0x150027){socket[_0x4546('0x74')]('userVoicePrefix:save',{'UserId':_0x150027['id'],'VoicePrefixId':_0x7f3cf0['id']});});});});});}})['then'](respondWithStatusCode(_0x19aeab,null))[_0x4546('0x43')](handleError(_0x19aeab,null));};exports[_0x4546('0x85')]=function(_0x697259,_0x228e87,_0x1470c2){return db[_0x4546('0x7c')][_0x4546('0x41')]({'where':{'id':_0x697259[_0x4546('0x33')][_0x4546('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x4546('0x77')],'as':_0x4546('0x86'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x228e87,null))['then'](function(_0x15a005){var _0x4ba4aa=_[_0x4546('0x32')](_0x15a005,'id');var _0x57dac4=[];var _0x5523f9=[];var _0x55b583=squel[_0x4546('0x87')]();_0x55b583[_0x4546('0x88')](_0x4546('0x89'))[_0x4546('0x8a')](_0x4546('0x8b'),'tq')['join'](_0x4546('0x8c'),'ut',_0x4546('0x8d'))[_0x4546('0x3e')](_0x4546('0x8e'),_0x697259[_0x4546('0x45')]['id']);for(var _0x12ef28=0x0;_0x12ef28<_0x15a005[_0x4546('0x39')];_0x12ef28+=0x1){let _0x12eb2b=_0x15a005[_0x12ef28];for(var _0xc06b87=0x0;_0xc06b87<_0x12eb2b[_0x4546('0x86')]['length'];_0xc06b87+=0x1){let _0x412111=_0x12eb2b[_0x4546('0x86')][_0xc06b87];var _0x5cb58c=_0x55b583['clone']();_0x5cb58c[_0x4546('0x3e')](_0x4546('0x8f'),_0x412111['id']);_0x5523f9['push'](db[_0x4546('0x49')]['query'](_0x5cb58c['toString'](),{'type':db['sequelize'][_0x4546('0x90')][_0x4546('0x91')]})['then'](function(_0x572e86){if(_0x572e86[_0x4546('0x39')]===0x1){return _0x412111['id'];}else{var _0x1bb34e=_[_0x4546('0x92')](_['map'](_0x572e86,_0x4546('0x93')),function(_0x3a9f01){return _[_0x4546('0x94')](_0x4ba4aa,_0x3a9f01);});if(_0x1bb34e){return _0x412111['id'];}}}));}}return BPromise[_0x4546('0x95')](_0x5523f9)[_0x4546('0x25')](function(_0xe806bc){_0x57dac4=_(_0x57dac4)['union'](_0xe806bc)[_0x4546('0x96')]()['value']();return db['VoicePrefix'][_0x4546('0x46')]({'where':{'id':_0x697259['params']['id']}})[_0x4546('0x25')](function(_0x42feda){return db[_0x4546('0x49')][_0x4546('0x4a')](function(_0x305a9a){return _0x42feda['removeTeams'](_0x697259[_0x4546('0x33')][_0x4546('0x6f')],{'transaction':_0x305a9a})['then'](function(){if(!_[_0x4546('0x97')](_0x57dac4)){return _0x42feda['removeAgents'](_0x57dac4,{'transaction':_0x305a9a});}})[_0x4546('0x25')](function(){_0x57dac4['forEach'](function(_0x35eb62){socket[_0x4546('0x74')](_0x4546('0x73'),{'UserId':_0x35eb62,'VoicePrefixId':_0x42feda['id']});});});});});});})[_0x4546('0x25')](respondWithStatusCode(_0x228e87,null))[_0x4546('0x43')](handleError(_0x228e87,null));}; \ No newline at end of file +var _0xfff0=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','includeAll','options','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0xfff0,0x139));var _0x0fff=function(_0x40b21f,_0x2d614d){_0x40b21f=_0x40b21f-0x0;var _0x52297e=_0xfff0[_0x40b21f];return _0x52297e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=typeof _0x528071[_0x0fff('0x1f')]===_0x0fff('0x20')&&typeof _0x528071[_0x0fff('0x21')]===_0x0fff('0x20');var _0xe89b4a=_0x48f36d['count'];var _0x44a54a=_0x2337f?0x0:_0x528071[_0x0fff('0x1f')];var _0x48e6f9=_0x2337f?_0x48f36d['count']:_0x528071['offset']+_0x528071[_0x0fff('0x21')];var _0x330e29;if(_0x48e6f9>=_0xe89b4a){_0x48e6f9=_0xe89b4a;_0x330e29=0xc8;}else{_0x330e29=0xce;}_0x540a67[_0x0fff('0x1d')](_0x330e29);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x44a54a+'-'+_0x48e6f9+'/'+_0xe89b4a)[_0x0fff('0x1e')](_0x48f36d);}return null;};}function patchUpdates(_0x2f8665){return function(_0x29d703){try{jsonpatch[_0x0fff('0x23')](_0x29d703,_0x2f8665,!![]);}catch(_0x16e7f4){return BPromise[_0x0fff('0x24')](_0x16e7f4);}return _0x29d703['save']();};}function saveUpdates(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x25')](_0x6a116c)[_0x0fff('0x26')](function(_0x23d9f8){return _0x23d9f8;});}return null;};}function removeEntity(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(_0x87b3a6){return _0x87b3a6[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x36d268=_0x87b3a6[_0x0fff('0x28')]({'plain':!![]});var _0x27bd76=_0x0fff('0x29');return db[_0x0fff('0x2a')][_0x0fff('0x27')]({'where':{'type':_0x27bd76,'resourceId':_0x36d268['id']}})[_0x0fff('0x26')](function(){return _0x87b3a6;});})[_0x0fff('0x26')](function(){_0x482e1e['status'](0xcc)[_0x0fff('0x2b')]();});}};}function handleEntityNotFound(_0x2d1800,_0x17ab6f){return function(_0x42441e){if(!_0x42441e){_0x2d1800[_0x0fff('0x2c')](0x194);}return _0x42441e;};}function handleError(_0x125844,_0x47dde0){_0x47dde0=_0x47dde0||0x1f4;return function(_0x31f9a4){logger[_0x0fff('0x2d')](_0x31f9a4[_0x0fff('0x2e')]);if(_0x31f9a4['name']){delete _0x31f9a4[_0x0fff('0x2f')];}_0x125844[_0x0fff('0x1d')](_0x47dde0)['send'](_0x31f9a4);};}exports[_0x0fff('0x30')]=function(_0x433de6,_0x15bb46){var _0x15ae24={},_0x25ab2a={},_0x263e9e={'count':0x0,'rows':[]};var _0x1da352=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x58469b){return{'name':_0x58469b[_0x0fff('0x34')],'type':_0x58469b[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x25ab2a[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x1da352,'name');_0x25ab2a['query']=_[_0x0fff('0x38')](_0x433de6[_0x0fff('0x39')]);_0x25ab2a[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x25ab2a['model'],_0x25ab2a[_0x0fff('0x39')]);_0x15ae24[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x25ab2a[_0x0fff('0x37')],qs['fields'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x15ae24[_0x0fff('0x3c')]=_0x15ae24[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x15ae24[_0x0fff('0x3c')]:_0x25ab2a[_0x0fff('0x37')];if(!_0x433de6[_0x0fff('0x39')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x15ae24[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x433de6['query'][_0x0fff('0x21')]);_0x15ae24[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x433de6[_0x0fff('0x39')][_0x0fff('0x1f')]);}_0x15ae24[_0x0fff('0x41')]=qs['sort'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x42')]);_0x15ae24[_0x0fff('0x43')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x433de6[_0x0fff('0x39')],_0x25ab2a[_0x0fff('0x3a')]),_0x1da352);if(_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]){_0x15ae24['where']=_[_0x0fff('0x46')](_0x15ae24['where'],{'$or':_[_0x0fff('0x31')](_0x1da352,function(_0x30f329){if(_0x30f329[_0x0fff('0x35')]!=='VIRTUAL'){var _0x5d4c24={};_0x5d4c24[_0x30f329[_0x0fff('0x2f')]]={'$like':'%'+_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]+'%'};return _0x5d4c24;}})});}_0x15ae24=_['merge']({},_0x15ae24,_0x433de6['options']);var _0x4668b3={'where':_0x15ae24['where']};return db[_0x0fff('0x32')][_0x0fff('0x47')](_0x4668b3)[_0x0fff('0x26')](function(_0x309d75){_0x263e9e[_0x0fff('0x47')]=_0x309d75;if(_0x433de6[_0x0fff('0x39')]['includeAll']){_0x15ae24[_0x0fff('0x48')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x49')](_0x15ae24);})[_0x0fff('0x26')](function(_0x7157e5){_0x263e9e[_0x0fff('0x4a')]=_0x7157e5;return _0x263e9e;})[_0x0fff('0x26')](respondWithFilteredResult(_0x15bb46,_0x15ae24))['catch'](handleError(_0x15bb46,null));};exports[_0x0fff('0x4b')]=function(_0x244a27,_0x101b3a){var _0x56a121={'raw':![],'where':{'id':_0x244a27[_0x0fff('0x4c')]['id']}},_0x2de540={};_0x2de540[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x32')][_0x0fff('0x33')]);_0x2de540[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x244a27[_0x0fff('0x39')]);_0x2de540[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x2de540['model'],_0x2de540[_0x0fff('0x39')]);_0x56a121[_0x0fff('0x3c')]=_['intersection'](_0x2de540[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x244a27[_0x0fff('0x39')]['fields']));_0x56a121['attributes']=_0x56a121[_0x0fff('0x3c')]['length']?_0x56a121['attributes']:_0x2de540[_0x0fff('0x37')];if(_0x244a27[_0x0fff('0x39')][_0x0fff('0x4d')]){_0x56a121[_0x0fff('0x48')]=[{'all':!![]}];}_0x56a121=_[_0x0fff('0x46')]({},_0x56a121,_0x244a27[_0x0fff('0x4e')]);return db['VoicePrefix'][_0x0fff('0x4f')](_0x56a121)[_0x0fff('0x26')](handleEntityNotFound(_0x101b3a,null))[_0x0fff('0x26')](respondWithResult(_0x101b3a,null))[_0x0fff('0x50')](handleError(_0x101b3a,null));};exports[_0x0fff('0x27')]=function(_0x2c725c,_0x5d1739){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x2c725c['params']['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5d1739,null))['then'](removeEntity(_0x5d1739,null))['catch'](handleError(_0x5d1739,null));};exports['describe']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x32')][_0x0fff('0x51')]()[_0x0fff('0x26')](respondWithResult(_0x30967c,null))['catch'](handleError(_0x30967c,null));};exports[_0x0fff('0x52')]=function(_0x2c765f,_0x2cbe43){var _0x3b6c98;return db[_0x0fff('0x53')]['transaction'](function(_0x3b401c){return db[_0x0fff('0x32')][_0x0fff('0x52')](_0x2c765f[_0x0fff('0x54')],{'transaction':_0x3b401c})[_0x0fff('0x26')](function(_0x2e8242){_0x3b6c98=_0x2e8242[_0x0fff('0x28')]({'plain':!![]});return db[_0x0fff('0x55')][_0x0fff('0x4f')]({'where':{'id':_0x3b6c98[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x38168e){return createVoicePrefixExtensions(_0x3b6c98,_0x38168e,_0x3b401c);});});})[_0x0fff('0x26')](function(){var _0x2608be=_0x2c765f[_0x0fff('0x57')][_0x0fff('0x28')]({'plain':!![]});if(!_0x2608be)throw new Error(_0x0fff('0x58'));if(_0x2608be[_0x0fff('0x59')]===_0x0fff('0x57')){var _0x398513=_0x3b6c98;return db[_0x0fff('0x5a')]['find']({'where':{'name':_0x0fff('0x29'),'userProfileId':_0x2608be[_0x0fff('0x5b')]},'raw':!![]})[_0x0fff('0x26')](function(_0x2744b4){if(_0x2744b4&&_0x2744b4['autoAssociation']===0x0){return db[_0x0fff('0x2a')]['create']({'name':_0x398513[_0x0fff('0x2f')],'resourceId':_0x398513['id'],'type':_0x2744b4[_0x0fff('0x2f')],'sectionId':_0x2744b4['id']},{})[_0x0fff('0x26')](function(){return _0x3b6c98;});}else{return _0x3b6c98;}})[_0x0fff('0x50')](function(_0x4bf865){logger[_0x0fff('0x2d')](_0x0fff('0x5c'),_0x4bf865);throw _0x4bf865;});}return _0x3b6c98;})[_0x0fff('0x26')](respondWithResult(_0x2cbe43,null))[_0x0fff('0x50')](handleError(_0x2cbe43,null));};function Extension(_0x4cf619,_0x5ba7e7,_0x449da4,_0x40b8f0){this[_0x0fff('0x5d')]=_0x0fff('0x5e');this[_0x0fff('0x5f')]=_0x4cf619;this[_0x0fff('0x60')]=_0x449da4;this['type']='system';this[_0x0fff('0x61')]=_0x0fff('0x62');this[_0x0fff('0x63')]=_0x5ba7e7;this[_0x0fff('0x64')]=_0x40b8f0;}function createVoicePrefixExtensions(_0x28403f,_0x6a37c9,_0x33eb07){return new BPromise(function(_0x40e5ec,_0x5f2fcc){var _0x12fe95=new Extension(formatPrefixName(_0x28403f['prefix']),0x1,_0x0fff('0x65'),_0x0fff('0x66'));_0x12fe95[_0x0fff('0x67')]=_0x28403f['id'];return db['VoiceExtension']['create'](_0x12fe95,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x504212){var _0x140a35=_0x504212[_0x0fff('0x28')]({'plain':!![]});var _0x452160=_[_0x0fff('0x31')](addVoicePrefixExtensions(_0x28403f,_0x6a37c9),function(_0x4e3a31){_0x4e3a31[_0x0fff('0x56')]=_0x140a35['id'];_0x4e3a31[_0x0fff('0x67')]=_0x28403f['id'];return _0x4e3a31;});return db['VoiceExtension'][_0x0fff('0x68')](_0x452160,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x1111c8){if(!_0x1111c8){return _0x5f2fcc('Extensions\x20creation\x20failed');}else{return _0x40e5ec(_0x1111c8);}})[_0x0fff('0x50')](function(_0x1dc3d6){return _0x5f2fcc(_0x1dc3d6);});});;});};function addVoicePrefixExtensions(_0x1414af,_0x383d78){var _0x3bb183=[];var _0xf4fb1e=formatPrefixName(_0x1414af[_0x0fff('0x69')]);_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x2,_0x0fff('0x6b'),_0x0fff('0x6c')+_0x1414af[_0x0fff('0x2f')]));if(_0x1414af[_0x0fff('0x6d')]){_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,'Set',_0x0fff('0x6e')+_0x1414af['callerIdAll']));}else{_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,_0x0fff('0x65'),_0x0fff('0x6f')));}_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x4,'goto',_0x383d78['context']+','+_0x0fff('0x70')+(0x8+_0x1414af[_0x0fff('0x2f')][_0x0fff('0x3e')])+'}'+','+0x1));return _0x3bb183;}function formatPrefixName(_0x2586c6){var _0x5af278='_';for(var _0x2f865a=0x0;_0x2f865a<_0x2586c6[_0x0fff('0x3e')];_0x2f865a++){if(_0x2586c6[_0x0fff('0x71')](_0x2f865a)=='-'){_0x5af278+=_0x2586c6[_0x0fff('0x71')](_0x2f865a);}else{_0x5af278+='['+_0x2586c6['charAt'](_0x2f865a)+']';}}_0x5af278+='.';return _0x5af278;}exports[_0x0fff('0x25')]=function(_0x1858fb,_0x4c08c3,_0x51fbf5){var _0x33ed23=_0x1858fb[_0x0fff('0x54')];_0x33ed23[_0x0fff('0x69')]=_0x0fff('0x72')+_0x33ed23[_0x0fff('0x2f')]+'-';return db['sequelize'][_0x0fff('0x73')](function(_0x7b040){return db[_0x0fff('0x32')][_0x0fff('0x25')](_0x33ed23,{'where':{'id':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension'][_0x0fff('0x4f')]({'where':{'id':_0x33ed23[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x712db4){return createVoicePrefixExtensions(_0x33ed23,_0x712db4,_0x7b040);});});});})[_0x0fff('0x26')](function(){return db['VoicePrefix'][_0x0fff('0x74')](_0x33ed23['id']);})[_0x0fff('0x26')](respondWithResult(_0x4c08c3,null))[_0x0fff('0x50')](handleError(_0x4c08c3,null));};exports[_0x0fff('0x75')]=function(_0x31ff4e,_0x15ab8e,_0x38e2e9){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x31ff4e[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x15ab8e,null))['then'](function(_0x134012){if(_0x134012){return _0x134012[_0x0fff('0x75')](_0x31ff4e['body'][_0x0fff('0x76')],_['omit'](_0x31ff4e[_0x0fff('0x54')],[_0x0fff('0x76'),'id'])||{})[_0x0fff('0x77')](function(_0x8799c2){for(var _0x13d90e=0x0;_0x13d90e<_0x31ff4e['body'][_0x0fff('0x76')][_0x0fff('0x3e')];_0x13d90e+=0x1){socket['emit'](_0x0fff('0x78'),{'UserId':Number(_0x31ff4e[_0x0fff('0x54')][_0x0fff('0x76')][_0x13d90e]),'VoicePrefixId':Number(_0x31ff4e['params']['id'])});}return _0x8799c2;});}})[_0x0fff('0x26')](respondWithResult(_0x15ab8e,null))[_0x0fff('0x50')](handleError(_0x15ab8e,null));};exports['removeAgents']=function(_0x567544,_0x404b97,_0x49711a){return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x567544[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x404b97,null))['then'](function(_0x4f7282){if(_0x4f7282){return _0x4f7282[_0x0fff('0x79')](_0x567544['query'][_0x0fff('0x76')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x7a')](_0x567544[_0x0fff('0x39')][_0x0fff('0x76')])){for(var _0x1e940c=0x0;_0x1e940c<_0x567544[_0x0fff('0x39')]['ids'][_0x0fff('0x3e')];_0x1e940c+=0x1){socket[_0x0fff('0x7b')](_0x0fff('0x7c'),{'UserId':Number(_0x567544[_0x0fff('0x39')][_0x0fff('0x76')][_0x1e940c]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}}else{socket['emit'](_0x0fff('0x7c'),{'UserId':Number(_0x567544['query'][_0x0fff('0x76')]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x404b97,null))[_0x0fff('0x50')](handleError(_0x404b97,null));};exports['getAgents']=function(_0x4fc7c7,_0x34dd99,_0x5baf7f){var _0x3d820e={};var _0x125b12={};var _0x5093fc;var _0x5b04f2;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x4fc7c7[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x34dd99,null))['then'](function(_0x407f0a){if(_0x407f0a){_0x5093fc=_0x407f0a;_0x125b12['model']=_[_0x0fff('0x38')](db[_0x0fff('0x7e')][_0x0fff('0x33')]);_0x125b12['query']=_['keys'](_0x4fc7c7['query']);_0x125b12[_0x0fff('0x3a')]=_['intersection'](_0x125b12[_0x0fff('0x37')],_0x125b12[_0x0fff('0x39')]);_0x3d820e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x125b12[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x3d820e[_0x0fff('0x3c')]=_0x3d820e[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x3d820e['attributes']:_0x125b12[_0x0fff('0x37')];_0x3d820e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x42')]);_0x3d820e['where']=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x4fc7c7['query'],_0x125b12[_0x0fff('0x3a')]));if(_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x45')]){_0x3d820e[_0x0fff('0x43')]=_[_0x0fff('0x46')](_0x3d820e[_0x0fff('0x43')],{'$or':_[_0x0fff('0x31')](_0x3d820e[_0x0fff('0x3c')],function(_0x40c4f3){var _0x1c059b={};_0x1c059b[_0x40c4f3]={'$like':'%'+_0x4fc7c7['query'][_0x0fff('0x45')]+'%'};return _0x1c059b;})});}_0x3d820e=_[_0x0fff('0x46')]({},_0x3d820e,_0x4fc7c7[_0x0fff('0x4e')]);return _0x5093fc[_0x0fff('0x7f')](_0x3d820e);}})[_0x0fff('0x26')](function(_0x2fdf96){if(_0x2fdf96){_0x5b04f2=_0x2fdf96[_0x0fff('0x3e')];if(!_0x4fc7c7['query'][_0x0fff('0x3f')]('nolimit')){_0x3d820e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x21')]);_0x3d820e[_0x0fff('0x1f')]=qs['offset'](_0x4fc7c7[_0x0fff('0x39')]['offset']);}return _0x5093fc['getAgents'](_0x3d820e);}})[_0x0fff('0x26')](function(_0x173b44){if(_0x173b44){return _0x173b44?{'count':_0x5b04f2,'rows':_0x173b44}:null;}})[_0x0fff('0x26')](respondWithResult(_0x34dd99,null))[_0x0fff('0x50')](handleError(_0x34dd99,null));};exports[_0x0fff('0x80')]=function(_0x3995b9,_0x5bc4e1,_0x50f95c){var _0x5b637e={};var _0x1bd02a={};var _0x41b755;var _0x4012aa;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x3995b9[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5bc4e1,null))[_0x0fff('0x26')](function(_0xed7e93){if(_0xed7e93){_0x41b755=_0xed7e93;_0x1bd02a[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x81')][_0x0fff('0x33')]);_0x1bd02a[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x3995b9[_0x0fff('0x39')]);_0x1bd02a[_0x0fff('0x3a')]=_['intersection'](_0x1bd02a[_0x0fff('0x37')],_0x1bd02a[_0x0fff('0x39')]);_0x5b637e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x1bd02a[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x3995b9[_0x0fff('0x39')]['fields']));_0x5b637e[_0x0fff('0x3c')]=_0x5b637e[_0x0fff('0x3c')]['length']?_0x5b637e[_0x0fff('0x3c')]:_0x1bd02a['model'];_0x5b637e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x3995b9['query']['sort']);_0x5b637e['where']=qs[_0x0fff('0x3a')](_['pick'](_0x3995b9['query'],_0x1bd02a['filters']));if(_0x3995b9['query'][_0x0fff('0x45')]){_0x5b637e['where']=_[_0x0fff('0x46')](_0x5b637e['where'],{'$or':_[_0x0fff('0x31')](_0x5b637e['attributes'],function(_0x465dde){var _0x9ca531={};_0x9ca531[_0x465dde]={'$like':'%'+_0x3995b9['query']['filter']+'%'};return _0x9ca531;})});}_0x5b637e=_[_0x0fff('0x46')]({},_0x5b637e,_0x3995b9[_0x0fff('0x4e')]);return _0x41b755[_0x0fff('0x80')](_0x5b637e);}})[_0x0fff('0x26')](function(_0x675250){if(_0x675250){_0x4012aa=_0x675250[_0x0fff('0x3e')];if(!_0x3995b9[_0x0fff('0x39')]['hasOwnProperty'](_0x0fff('0x40'))){_0x5b637e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x3995b9[_0x0fff('0x39')]['limit']);_0x5b637e[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x3995b9[_0x0fff('0x39')]['offset']);}return _0x41b755['getTeams'](_0x5b637e);}})[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4?{'count':_0x4012aa,'rows':_0x37b5b4}:null;}})['then'](respondWithResult(_0x5bc4e1,null))[_0x0fff('0x50')](handleError(_0x5bc4e1,null));};exports[_0x0fff('0x82')]=function(_0x4ab665,_0x2ab827,_0x2a2af9){var _0x2ca40b=_0x4ab665['body']['ids'];var _0x2eeee9;return db[_0x0fff('0x81')]['findAll']({'where':{'id':_0x2ca40b},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7e')],'as':_0x0fff('0x83'),'attributes':['id',_0x0fff('0x2f'),_0x0fff('0x84'),_0x0fff('0x85'),_0x0fff('0x86')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x1b500a){if(_0x1b500a){_0x2eeee9=_0x1b500a;var _0x327b5=_[_0x0fff('0x87')](_0x1b500a,function(_0x10aa61){var _0xc99224=_0x10aa61['get']({'plain':!![]});return _0xc99224[_0x0fff('0x83')];});return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x4ab665['params']['id']}})[_0x0fff('0x26')](function(_0x5336){return db[_0x0fff('0x53')][_0x0fff('0x73')](function(_0x42fbff){return _0x5336[_0x0fff('0x82')](_0x2ca40b,{'transaction':_0x42fbff})['then'](function(){return BPromise[_0x0fff('0x88')](_0x2eeee9,function(_0x39565f){return db['TeamVoicePrefix'][_0x0fff('0x89')]({'TeamId':_0x39565f['id'],'VoicePrefixId':_0x4ab665['params']['id']},{'transaction':_0x42fbff});});})['then'](function(){return BPromise[_0x0fff('0x88')](_0x327b5,function(_0x2e38c3){return db[_0x0fff('0x8a')][_0x0fff('0x8b')]({'where':{'UserId':_0x2e38c3['id'],'VoicePrefixId':_0x4ab665[_0x0fff('0x4c')]['id']},'transaction':_0x42fbff});});})[_0x0fff('0x26')](function(){_0x327b5['forEach'](function(_0xe02ca6){socket[_0x0fff('0x7b')](_0x0fff('0x78'),{'UserId':_0xe02ca6['id'],'VoicePrefixId':_0x5336['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x2ab827,null))[_0x0fff('0x50')](handleError(_0x2ab827,null));};exports['removeTeams']=function(_0x25e9f2,_0xf73eb6,_0x87df03){return db[_0x0fff('0x81')][_0x0fff('0x49')]({'where':{'id':_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x26')](handleEntityNotFound(_0xf73eb6,null))['then'](function(_0x2d206c){var _0x5ed120=_['map'](_0x2d206c,'id');var _0x592341=[];var _0x2e1625=[];var _0x128fe1=squel[_0x0fff('0x8c')]();_0x128fe1[_0x0fff('0x8d')](_0x0fff('0x8e'))['from'](_0x0fff('0x8f'),'tq')[_0x0fff('0x90')](_0x0fff('0x91'),'ut',_0x0fff('0x92'))[_0x0fff('0x43')](_0x0fff('0x93'),_0x25e9f2[_0x0fff('0x4c')]['id']);for(var _0x115445=0x0;_0x115445<_0x2d206c['length'];_0x115445+=0x1){let _0x596074=_0x2d206c[_0x115445];for(var _0x1f1946=0x0;_0x1f1946<_0x596074[_0x0fff('0x83')][_0x0fff('0x3e')];_0x1f1946+=0x1){let _0x47ff09=_0x596074[_0x0fff('0x83')][_0x1f1946];var _0x2ae986=_0x128fe1[_0x0fff('0x94')]();_0x2ae986['where'](_0x0fff('0x95'),_0x47ff09['id']);_0x2e1625[_0x0fff('0x6a')](db[_0x0fff('0x53')][_0x0fff('0x39')](_0x2ae986[_0x0fff('0x96')](),{'type':db[_0x0fff('0x53')][_0x0fff('0x97')]['SELECT']})['then'](function(_0x4a70ee){if(_0x4a70ee[_0x0fff('0x3e')]===0x1){return _0x47ff09['id'];}else{var _0x425412=_[_0x0fff('0x98')](_[_0x0fff('0x31')](_0x4a70ee,_0x0fff('0x99')),function(_0x41afce){return _['includes'](_0x5ed120,_0x41afce);});if(_0x425412){return _0x47ff09['id'];}}}));}}return BPromise[_0x0fff('0x9a')](_0x2e1625)[_0x0fff('0x26')](function(_0x7928f7){_0x592341=_(_0x592341)['union'](_0x7928f7)['compact']()[_0x0fff('0x9b')]();return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x25e9f2[_0x0fff('0x4c')]['id']}})['then'](function(_0x1bf39f){return db[_0x0fff('0x53')]['transaction'](function(_0xb6faf){return _0x1bf39f[_0x0fff('0x9c')](_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')],{'transaction':_0xb6faf})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x9d')](_0x592341)){return _0x1bf39f['removeAgents'](_0x592341,{'transaction':_0xb6faf});}})[_0x0fff('0x26')](function(){_0x592341['forEach'](function(_0xf72b2b){socket['emit'](_0x0fff('0x7c'),{'UserId':_0xf72b2b,'VoicePrefixId':_0x1bf39f['id']});});});});});});})['then'](respondWithStatusCode(_0xf73eb6,null))[_0x0fff('0x50')](handleError(_0xf73eb6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 4334792..cbcd605 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 _0x2286=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x17f1bd,_0x5f5005){var _0x16bfaa=function(_0x58ce92){while(--_0x58ce92){_0x17f1bd['push'](_0x17f1bd['shift']());}};_0x16bfaa(++_0x5f5005);}(_0x2286,0x13a));var _0x6228=function(_0x577c3c,_0x44d531){_0x577c3c=_0x577c3c-0x0;var _0x4f14ec=_0x2286[_0x577c3c];return _0x4f14ec;};'use strict';var EventEmitter=require(_0x6228('0x0'));var VoicePrefix=require(_0x6228('0x1'))['db'][_0x6228('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6228('0x3')](0x0);var events={'afterCreate':_0x6228('0x4'),'afterUpdate':_0x6228('0x5'),'afterDestroy':_0x6228('0x6')};function emitEvent(_0x3c8a5d){return function(_0x113ea8,_0x47fc2d,_0x5b9ab4){VoicePrefixEvents[_0x6228('0x7')](_0x3c8a5d+':'+_0x113ea8['id'],_0x113ea8);VoicePrefixEvents[_0x6228('0x7')](_0x3c8a5d,_0x113ea8);_0x5b9ab4(null);};}for(var e in events){if(events[_0x6228('0x8')](e)){var event=events[e];VoicePrefix[_0x6228('0x9')](e,emitEvent(event));}}module[_0x6228('0xa')]=VoicePrefixEvents; \ No newline at end of file +var _0x320b=['emit','hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x4759f9,_0x4da9f0){var _0xc3ac06=function(_0x58f657){while(--_0x58f657){_0x4759f9['push'](_0x4759f9['shift']());}};_0xc3ac06(++_0x4da9f0);}(_0x320b,0x103));var _0xb320=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x320b[_0xd39959];return _0x1ff69c;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xb320('0x0'))['db'][_0xb320('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb320('0x2')](0x0);var events={'afterCreate':_0xb320('0x3'),'afterUpdate':_0xb320('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb762eb){return function(_0x49f0cc,_0x4da065,_0x374c30){VoicePrefixEvents[_0xb320('0x5')](_0xb762eb+':'+_0x49f0cc['id'],_0x49f0cc);VoicePrefixEvents[_0xb320('0x5')](_0xb762eb,_0x49f0cc);_0x374c30(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xb320('0x6')](e,emitEvent(event));}}module[_0xb320('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index b8ba6fa..117773b 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 _0x2f31=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0x2f31,0xd1));var _0x12f3=function(_0x379be8,_0x4f2d5d){_0x379be8=_0x379be8-0x0;var _0x4061ac=_0x2f31[_0x379be8];return _0x4061ac;};'use strict';var _=require(_0x12f3('0x0'));var util=require(_0x12f3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x12f3('0x2'));var BPromise=require(_0x12f3('0x3'));var rp=require(_0x12f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12f3('0x5'));var config=require(_0x12f3('0x6'));var attributes=require(_0x12f3('0x7'));module[_0x12f3('0x8')]=function(_0x2593c3,_0x51c156){return _0x2593c3['define'](_0x12f3('0x9'),attributes,{'tableName':_0x12f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd133=['request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','bluebird'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xd133,0x1d6));var _0x3d13=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0xd133[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0x3d13('0x0'));var util=require('util');var logger=require(_0x3d13('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3d13('0x2'));var rp=require(_0x3d13('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d13('0x4'));var config=require(_0x3d13('0x5'));var attributes=require(_0x3d13('0x6'));module[_0x3d13('0x7')]=function(_0xb0cc89,_0x1406a4){return _0xb0cc89[_0x3d13('0x8')](_0x3d13('0x9'),attributes,{'tableName':_0x3d13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 3424293..232eeb4 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 _0xe056=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0xe056,0xdb));var _0x6e05=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xe056[_0x456032];return _0x1a53cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});config[_0x6e05('0x7')]=_[_0x6e05('0x8')](config['redis'],{'host':_0x6e05('0x9'),'port':0x18eb});var socket=require(_0x6e05('0xa'))(new Redis(config[_0x6e05('0x7')]));require(_0x6e05('0xb'))[_0x6e05('0xc')](socket);function respondWithRpcPromise(_0x52b72b,_0x330e12,_0x110d8e){return new BPromise(function(_0x321ee5,_0x178c9f){return client[_0x6e05('0xd')](_0x52b72b,_0x110d8e)[_0x6e05('0xe')](function(_0x4ff533){logger[_0x6e05('0xf')](_0x6e05('0x10'),_0x330e12,_0x6e05('0x11'));logger['debug'](_0x6e05('0x12'),_0x330e12,_0x6e05('0x11'),JSON[_0x6e05('0x13')](_0x4ff533));if(_0x4ff533[_0x6e05('0x14')]){if(_0x4ff533[_0x6e05('0x14')]['code']===0x1f4){logger[_0x6e05('0x14')](_0x6e05('0x10'),_0x330e12,_0x4ff533['error']['message']);return _0x178c9f(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}logger[_0x6e05('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x330e12,_0x4ff533[_0x6e05('0x14')]['message']);return _0x321ee5(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x330e12,_0x6e05('0x11'));_0x321ee5(_0x4ff533[_0x6e05('0x16')][_0x6e05('0x15')]);}})[_0x6e05('0x17')](function(_0x41d22c){logger['error'](_0x6e05('0x10'),_0x330e12,_0x41d22c);_0x178c9f(_0x41d22c);});});} \ No newline at end of file +var _0x103f=['register','info','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x3d5a86,_0x1843c4){var _0x4e0cff=function(_0x2222a5){while(--_0x2222a5){_0x3d5a86['push'](_0x3d5a86['shift']());}};_0x4e0cff(++_0x1843c4);}(_0x103f,0x13e));var _0xf103=function(_0x27c25e,_0x3ed8bd){_0x27c25e=_0x27c25e-0x0;var _0xc201f3=_0x103f[_0x27c25e];return _0xc201f3;};'use strict';var _=require(_0xf103('0x0'));var util=require(_0xf103('0x1'));var moment=require(_0xf103('0x2'));var BPromise=require(_0xf103('0x3'));var rs=require(_0xf103('0x4'));var fs=require('fs');var Redis=require(_0xf103('0x5'));var db=require(_0xf103('0x6'))['db'];var utils=require(_0xf103('0x7'));var logger=require(_0xf103('0x8'))(_0xf103('0x9'));var config=require('../../config/environment');var jayson=require(_0xf103('0xa'));var client=jayson[_0xf103('0xb')][_0xf103('0xc')]({'port':0x232a});config[_0xf103('0xd')]=_[_0xf103('0xe')](config[_0xf103('0xd')],{'host':_0xf103('0xf'),'port':0x18eb});var socket=require(_0xf103('0x10'))(new Redis(config[_0xf103('0xd')]));require(_0xf103('0x11'))[_0xf103('0x12')](socket);function respondWithRpcPromise(_0x267ec4,_0x47b71b,_0x228805){return new BPromise(function(_0x532559,_0x2aa8fd){return client['request'](_0x267ec4,_0x228805)['then'](function(_0xb3a849){logger[_0xf103('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x47b71b,_0xf103('0x14'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x47b71b,'request\x20sent',JSON[_0xf103('0x15')](_0xb3a849));if(_0xb3a849['error']){if(_0xb3a849[_0xf103('0x16')][_0xf103('0x17')]===0x1f4){logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849[_0xf103('0x16')]['message']);return _0x2aa8fd(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849['error']['message']);return _0x532559(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}else{logger[_0xf103('0x13')](_0xf103('0x18'),_0x47b71b,_0xf103('0x14'));_0x532559(_0xb3a849[_0xf103('0x1a')]['message']);}})[_0xf103('0x1b')](function(_0x338a44){logger['error'](_0xf103('0x18'),_0x47b71b,_0x338a44);_0x2aa8fd(_0x338a44);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c36c9de..887f92e 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 _0x4198=['voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0xdcc715,_0x36bef7){var _0x21e73a=function(_0x5627b0){while(--_0x5627b0){_0xdcc715['push'](_0xdcc715['shift']());}};_0x21e73a(++_0x36bef7);}(_0x4198,0x69));var _0x8419=function(_0x167e4d,_0x1edd8a){_0x167e4d=_0x167e4d-0x0;var _0x47eafe=_0x4198[_0x167e4d];return _0x47eafe;};'use strict';var VoicePrefixEvents=require(_0x8419('0x0'));var events=['save',_0x8419('0x1'),_0x8419('0x2')];function createListener(_0x29612a,_0x1e7a2f){return function(_0x182359){_0x1e7a2f[_0x8419('0x3')](_0x29612a,_0x182359);};}function removeListener(_0x1eaff0,_0xc19396){return function(){VoicePrefixEvents[_0x8419('0x4')](_0x1eaff0,_0xc19396);};}exports[_0x8419('0x5')]=function(_0x502e00){for(var _0x1f5bfe=0x0,_0x839abf=events[_0x8419('0x6')];_0x1f5bfe<_0x839abf;_0x1f5bfe++){var _0x2043cd=events[_0x1f5bfe];var _0x45c2b5=createListener(_0x8419('0x7')+_0x2043cd,_0x502e00);VoicePrefixEvents['on'](_0x2043cd,_0x45c2b5);}}; \ No newline at end of file +var _0x96cc=['./voicePrefix.events','remove','emit','removeListener','register','length','voicePrefix:'];(function(_0x5100ef,_0x2d3ae3){var _0x47a5d=function(_0x3dd6ef){while(--_0x3dd6ef){_0x5100ef['push'](_0x5100ef['shift']());}};_0x47a5d(++_0x2d3ae3);}(_0x96cc,0x16c));var _0xc96c=function(_0x15ad95,_0x566009){_0x15ad95=_0x15ad95-0x0;var _0x439717=_0x96cc[_0x15ad95];return _0x439717;};'use strict';var VoicePrefixEvents=require(_0xc96c('0x0'));var events=['save',_0xc96c('0x1'),'update'];function createListener(_0x30bf8a,_0x3e7a95){return function(_0x107043){_0x3e7a95[_0xc96c('0x2')](_0x30bf8a,_0x107043);};}function removeListener(_0x71140d,_0x29b6f1){return function(){VoicePrefixEvents[_0xc96c('0x3')](_0x71140d,_0x29b6f1);};}exports[_0xc96c('0x4')]=function(_0x3b7f45){for(var _0x5142cd=0x0,_0x10b411=events[_0xc96c('0x5')];_0x5142cd<_0x10b411;_0x5142cd++){var _0x408afb=events[_0x5142cd];var _0x86c1a8=createListener(_0xc96c('0x6')+_0x408afb,_0x3b7f45);VoicePrefixEvents['on'](_0x408afb,_0x86c1a8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 776d2bb..3bd118c 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 _0xe346=['./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','post','/:id/clone','clone','addTeams','/:id/lists','addLists','addBlackLists','put','destroy','delete','removeTeams','removeAgents','removeBlackLists','exports','multer','util','path','Router','fs-extra','../../config/environment'];(function(_0x41bff6,_0x5ed3dd){var _0x34f6b9=function(_0x423d19){while(--_0x423d19){_0x41bff6['push'](_0x41bff6['shift']());}};_0x34f6b9(++_0x5ed3dd);}(_0xe346,0x1c2));var _0x6e34=function(_0x22f7b9,_0x254684){_0x22f7b9=_0x22f7b9-0x0;var _0x36bdca=_0xe346[_0x22f7b9];return _0x36bdca;};'use strict';var multer=require(_0x6e34('0x0'));var util=require(_0x6e34('0x1'));var path=require(_0x6e34('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6e34('0x3')]();var fs_extra=require(_0x6e34('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6e34('0x5'));var controller=require(_0x6e34('0x6'));router[_0x6e34('0x7')]('/',auth[_0x6e34('0x8')](),controller['index']);router[_0x6e34('0x7')](_0x6e34('0x9'),auth[_0x6e34('0x8')](),controller[_0x6e34('0xa')]);router[_0x6e34('0x7')](_0x6e34('0xb'),auth['isAuthenticated'](),controller[_0x6e34('0xc')]);router[_0x6e34('0x7')]('/:id/hopper_histories',auth[_0x6e34('0x8')](),controller[_0x6e34('0xd')]);router[_0x6e34('0x7')](_0x6e34('0xe'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x6e34('0x7')]('/:id/hopper_black',auth[_0x6e34('0x8')](),controller[_0x6e34('0xf')]);router[_0x6e34('0x7')](_0x6e34('0x10'),auth['isAuthenticated'](),controller[_0x6e34('0x11')]);router['get'](_0x6e34('0x12'),auth[_0x6e34('0x8')](),controller[_0x6e34('0x13')]);router[_0x6e34('0x7')](_0x6e34('0x14'),auth['isAuthenticated'](),controller[_0x6e34('0x15')]);router[_0x6e34('0x7')]('/:id/lists',auth[_0x6e34('0x8')](),controller[_0x6e34('0x16')]);router[_0x6e34('0x7')](_0x6e34('0x17'),auth[_0x6e34('0x8')](),controller['getBlackLists']);router['post']('/',auth[_0x6e34('0x8')](),controller['create']);router[_0x6e34('0x18')](_0x6e34('0x19'),auth['isAuthenticated'](),controller[_0x6e34('0x1a')]);router[_0x6e34('0x18')](_0x6e34('0x10'),auth[_0x6e34('0x8')](),controller[_0x6e34('0x1b')]);router[_0x6e34('0x18')](_0x6e34('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x6e34('0x1c'),auth['isAuthenticated'](),controller[_0x6e34('0x1d')]);router['post'](_0x6e34('0x17'),auth[_0x6e34('0x8')](),controller[_0x6e34('0x1e')]);router[_0x6e34('0x1f')](_0x6e34('0x9'),auth[_0x6e34('0x8')](),controller['update']);router['delete'](_0x6e34('0x9'),auth['isAuthenticated'](),controller[_0x6e34('0x20')]);router[_0x6e34('0x21')](_0x6e34('0x10'),auth[_0x6e34('0x8')](),controller[_0x6e34('0x22')]);router[_0x6e34('0x21')](_0x6e34('0x12'),auth[_0x6e34('0x8')](),controller[_0x6e34('0x23')]);router[_0x6e34('0x21')](_0x6e34('0x1c'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x6e34('0x17'),auth[_0x6e34('0x8')](),controller[_0x6e34('0x24')]);module[_0x6e34('0x25')]=router; \ No newline at end of file +var _0x378b=['destroy','removeTeams','removeAgents','removeLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','show','/:id/hoppers','isAuthenticated','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','getAgents','/:id/lists','/:id/blacklists','post','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','/:id','update','delete'];(function(_0x2ae6ee,_0x16805a){var _0x17653b=function(_0x299fc8){while(--_0x299fc8){_0x2ae6ee['push'](_0x2ae6ee['shift']());}};_0x17653b(++_0x16805a);}(_0x378b,0xef));var _0xb378=function(_0x1f459b,_0x23fde0){_0x1f459b=_0x1f459b-0x0;var _0x41b601=_0x378b[_0x1f459b];return _0x41b601;};'use strict';var multer=require(_0xb378('0x0'));var util=require(_0xb378('0x1'));var path=require(_0xb378('0x2'));var timeout=require(_0xb378('0x3'));var express=require('express');var router=express[_0xb378('0x4')]();var fs_extra=require(_0xb378('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb378('0x6'));var config=require(_0xb378('0x7'));var controller=require(_0xb378('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb378('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb378('0xa')]);router[_0xb378('0x9')](_0xb378('0xb'),auth[_0xb378('0xc')](),controller['getHoppers']);router[_0xb378('0x9')]('/:id/hopper_histories',auth[_0xb378('0xc')](),controller[_0xb378('0xd')]);router[_0xb378('0x9')](_0xb378('0xe'),auth[_0xb378('0xc')](),controller[_0xb378('0xf')]);router[_0xb378('0x9')](_0xb378('0x10'),auth[_0xb378('0xc')](),controller['getHopperBlacks']);router[_0xb378('0x9')](_0xb378('0x11'),auth[_0xb378('0xc')](),controller[_0xb378('0x12')]);router[_0xb378('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xb378('0x13')]);router[_0xb378('0x9')]('/:id/members',auth[_0xb378('0xc')](),controller['getMembers']);router['get'](_0xb378('0x14'),auth[_0xb378('0xc')](),controller['getLists']);router['get'](_0xb378('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xb378('0x16')]('/',auth[_0xb378('0xc')](),controller['create']);router[_0xb378('0x16')](_0xb378('0x17'),auth['isAuthenticated'](),controller[_0xb378('0x18')]);router[_0xb378('0x16')](_0xb378('0x11'),auth[_0xb378('0xc')](),controller[_0xb378('0x19')]);router[_0xb378('0x16')](_0xb378('0x1a'),auth[_0xb378('0xc')](),controller[_0xb378('0x1b')]);router[_0xb378('0x16')](_0xb378('0x14'),auth[_0xb378('0xc')](),controller[_0xb378('0x1c')]);router[_0xb378('0x16')](_0xb378('0x15'),auth[_0xb378('0xc')](),controller[_0xb378('0x1d')]);router[_0xb378('0x1e')](_0xb378('0x1f'),auth[_0xb378('0xc')](),controller[_0xb378('0x20')]);router[_0xb378('0x21')](_0xb378('0x1f'),auth[_0xb378('0xc')](),controller[_0xb378('0x22')]);router[_0xb378('0x21')](_0xb378('0x11'),auth[_0xb378('0xc')](),controller[_0xb378('0x23')]);router[_0xb378('0x21')](_0xb378('0x1a'),auth['isAuthenticated'](),controller[_0xb378('0x24')]);router[_0xb378('0x21')](_0xb378('0x14'),auth[_0xb378('0xc')](),controller[_0xb378('0x25')]);router[_0xb378('0x21')](_0xb378('0x15'),auth[_0xb378('0xc')](),controller['removeBlackLists']);module[_0xb378('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9e14da6..fc38128 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 _0x351d=['random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','Active/Disactive\x20Campaign','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','fewestcalls'];(function(_0x442901,_0x3641ec){var _0x21520c=function(_0x2fec73){while(--_0x2fec73){_0x442901['push'](_0x442901['shift']());}};_0x21520c(++_0x3641ec);}(_0x351d,0x137));var _0xd351=function(_0x182a69,_0x3b84c0){_0x182a69=_0x182a69-0x0;var _0x36388c=_0x351d[_0x182a69];return _0x36388c;};'use strict';var Sequelize=require(_0xd351('0x0'));module[_0xd351('0x1')]={'name':{'type':Sequelize[_0xd351('0x2')],'allowNull':![],'unique':_0xd351('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x5'),_0xd351('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xd351('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xd351('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xd351('0x7'),'leastrecent',_0xd351('0x8'),_0xd351('0x9'),_0xd351('0xa'),_0xd351('0xb'),_0xd351('0xc'),_0xd351('0xd')),'allowNull':![],'defaultValue':_0xd351('0x7'),'set':function(_0x15f758){this[_0xd351('0xe')](_0xd351('0xf'),_0x15f758?_0x15f758:'rrmemory');},'get':function(){var _0x146ff4=this[_0xd351('0x10')](_0xd351('0x11'));var _0x34fbdb=this[_0xd351('0x10')](_0xd351('0x12'));var _0x7303fd=this[_0xd351('0x10')](_0xd351('0xf'));if(_0x146ff4===_0xd351('0x5')){return _0x7303fd;}if(_0x34fbdb===_0xd351('0x13')&&_0x7303fd===_0xd351('0xa')||_0x34fbdb===_0xd351('0x13')&&_0x7303fd==='roundrobin'){return _0x7303fd;}if(_0x34fbdb===_0xd351('0x14')||_0x34fbdb===_0xd351('0x15')||_0x34fbdb===_0xd351('0x16')){return _0x7303fd;}return null;}},'servicelevel':{'type':Sequelize[_0xd351('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd351('0x17')](0xb)},'timeout':{'type':Sequelize[_0xd351('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd351('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd351('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xd351('0x18'),'no'),'defaultValue':_0xd351('0x18')},'autopause':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no',_0xd351('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd351('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xd351('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd351('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xd351('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd351('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd351('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd351('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no'),'defaultValue':_0xd351('0x18')},'announce_holdtime':{'type':Sequelize[_0xd351('0x4')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd351('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xd351('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd351('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xd351('0x2')]},'queue_youarenext':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xd351('0x2')]},'queue_quantity2':{'type':Sequelize[_0xd351('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xd351('0x1a')],'set':function(_0x3b0809){this[_0xd351('0xe')](_0xd351('0x1b'),_0x3b0809?_0x3b0809[_0xd351('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0xd351('0x1b'))?this[_0xd351('0x10')]('periodic_announce')[_0xd351('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xd351('0x2')],'defaultValue':_0xd351('0x18'),'set':function(_0x475010){this[_0xd351('0xe')](_0xd351('0x1e'),_0x475010?_0x475010[_0xd351('0x1c')](','):undefined);},'get':function(){return this[_0xd351('0x10')](_0xd351('0x1e'))?this[_0xd351('0x10')]('joinempty')[_0xd351('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd351('0x2')],'defaultValue':'no','set':function(_0x2e96a6){this['setDataValue'](_0xd351('0x1f'),_0x2e96a6?_0x2e96a6['join'](','):undefined);},'get':function(){return this[_0xd351('0x10')](_0xd351('0x1f'))?this[_0xd351('0x10')](_0xd351('0x1f'))[_0xd351('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd351('0x4')](_0xd351('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd351('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd351('0x2')]},'description':{'type':Sequelize[_0xd351('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3bf1bd){this[_0xd351('0xe')]('acw',_0x3bf1bd);if(_0x3bf1bd){if(this['getDataValue']('wrapuptime')<0x2){this['setDataValue'](_0xd351('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd351('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd351('0x21')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xd351('0x14'),_0xd351('0x16'),_0xd351('0x15'),_0xd351('0x13')),'defaultValue':_0xd351('0x14'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xd351('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd351('0x22')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xd351('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd351('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xd351('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd351('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xd351('0x4')]('agentBusyFactor',_0xd351('0x26')),'defaultValue':'dropRate','comment':_0xd351('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xd351('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd351('0x29')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd351('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd351('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd351('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xd351('0x2')],'defaultValue':_0xd351('0x2b'),'comment':_0xd351('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd351('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd351('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd351('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd351('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd351('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd351('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd351('0x32')},'dialTimezone':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd351('0x33')},'dialPrefix':{'type':Sequelize[_0xd351('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xd351('0x4')]('always',_0xd351('0x34'),'onlyIfOpen'),'defaultValue':_0xd351('0x35')},'dialAMDActive':{'type':Sequelize[_0xd351('0x36')],'defaultValue':0x0,'comment':_0xd351('0x37')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd351('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd351('0x38')},'dialAMDGreeting':{'type':Sequelize[_0xd351('0x17')](0x9)[_0xd351('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd351('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd351('0x17')](0x9)[_0xd351('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd351('0x17')](0x9)[_0xd351('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xd351('0x17')](0x9)[_0xd351('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd351('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd351('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xd351('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd351('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd351('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd351('0x17')](0x9)[_0xd351('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd351('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xd351('0x36')],'defaultValue':0x0,'comment':_0xd351('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xd351('0x3f'),_0xd351('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xd351('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd351('0x36')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd351('0x36')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd351('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd351('0x42')},'dialCutDigit':{'type':Sequelize[_0xd351('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd351('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd351('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd351('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd351('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd351('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd351('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd351('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd351('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd351('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd351('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd351('0x17')](0x5)[_0xd351('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd351('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd351('0x17')],'allowNull':!![],'comment':_0xd351('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0xd351('0x36')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5aac83){if(!_0x5aac83)this['setDataValue'](_0xd351('0x4e'),null);this[_0xd351('0xe')](_0xd351('0x4f'),_0x5aac83);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd351('0x17')](0x3)[_0xd351('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xd351('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x41f2=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','linear','wrandom','setDataValue','rrmemory','getDataValue','dialMethod','booked','progressive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x31d8af,_0x47e7d9){var _0x2b4617=function(_0x943db3){while(--_0x943db3){_0x31d8af['push'](_0x31d8af['shift']());}};_0x2b4617(++_0x47e7d9);}(_0x41f2,0x14f));var _0x241f=function(_0x3f5027,_0x5d4ece){_0x3f5027=_0x3f5027-0x0;var _0x2b30b9=_0x41f2[_0x3f5027];return _0x2b30b9;};'use strict';var Sequelize=require(_0x241f('0x0'));module[_0x241f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x241f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x241f('0x3')](_0x241f('0x4'),_0x241f('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x241f('0x6')],'defaultValue':_0x241f('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x241f('0x3')]('rr',_0x241f('0x8'),_0x241f('0x9'),_0x241f('0xa'),_0x241f('0xb'),'rrmemory',_0x241f('0xc'),_0x241f('0xd'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x5eaaf6){this[_0x241f('0xe')]('strategy',_0x5eaaf6?_0x5eaaf6:_0x241f('0xf'));},'get':function(){var _0x497212=this[_0x241f('0x10')]('type');var _0x1cbc55=this['getDataValue'](_0x241f('0x11'));var _0x38d668=this[_0x241f('0x10')]('strategy');if(_0x497212===_0x241f('0x4')){return _0x38d668;}if(_0x1cbc55===_0x241f('0x12')&&_0x38d668===_0x241f('0xf')||_0x1cbc55===_0x241f('0x12')&&_0x38d668==='roundrobin'){return _0x38d668;}if(_0x1cbc55===_0x241f('0x13')||_0x1cbc55==='predictive'||_0x1cbc55===_0x241f('0x14')){return _0x38d668;}return null;}},'servicelevel':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x241f('0x15')](0xb)},'timeout':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x241f('0x6')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x241f('0x3')]('yes','no'),'defaultValue':_0x241f('0x16')},'autopause':{'type':Sequelize['ENUM'](_0x241f('0x16'),'no',_0x241f('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x241f('0x3')](_0x241f('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x241f('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x241f('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x241f('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x241f('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x241f('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x241f('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x241f('0x3')](_0x241f('0x16'),'no'),'defaultValue':_0x241f('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x241f('0x16'),'no',_0x241f('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x241f('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x241f('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x241f('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x241f('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x241f('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x241f('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x241f('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x241f('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x241f('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x241f('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x241f('0x6')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x241f('0x19')],'set':function(_0x587256){this[_0x241f('0xe')](_0x241f('0x1a'),_0x587256?_0x587256[_0x241f('0x1b')](','):[]);},'get':function(){return this[_0x241f('0x10')](_0x241f('0x1a'))?this[_0x241f('0x10')](_0x241f('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x241f('0x6')],'defaultValue':_0x241f('0x16'),'set':function(_0x272dcb){this[_0x241f('0xe')](_0x241f('0x1c'),_0x272dcb?_0x272dcb[_0x241f('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x241f('0x1c'))?this[_0x241f('0x10')](_0x241f('0x1c'))[_0x241f('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x241f('0x6')],'defaultValue':'no','set':function(_0x22401a){this['setDataValue']('leavewhenempty',_0x22401a?_0x22401a['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x241f('0x1e'))?this[_0x241f('0x10')](_0x241f('0x1e'))[_0x241f('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x241f('0x3')](_0x241f('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x241f('0x3')](_0x241f('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x241f('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x241f('0x6')]},'description':{'type':Sequelize[_0x241f('0x6')]},'acw':{'type':Sequelize[_0x241f('0x1f')],'defaultValue':0x0,'set':function(_0x13129f){this[_0x241f('0xe')](_0x241f('0x20'),_0x13129f);if(_0x13129f){if(this[_0x241f('0x10')](_0x241f('0x21'))<0x2){this[_0x241f('0xe')](_0x241f('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x241f('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x241f('0x1f')],'defaultValue':0x0,'comment':_0x241f('0x22')},'dialMethod':{'type':Sequelize[_0x241f('0x3')](_0x241f('0x23'),'progressive',_0x241f('0x14'),_0x241f('0x24'),'booked'),'defaultValue':'progressive','comment':_0x241f('0x25')},'dialLimitChannel':{'type':Sequelize[_0x241f('0x15')](0x4)[_0x241f('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x241f('0x27')},'dialLimitQueue':{'type':Sequelize[_0x241f('0x15')](0x4)[_0x241f('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x241f('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x241f('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x241f('0x3')](_0x241f('0x2a'),_0x241f('0x2b')),'defaultValue':_0x241f('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x241f('0x28')](0x2)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x241f('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x241f('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x241f('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x241f('0x6')],'comment':_0x241f('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x241f('0x15')](0x5)[_0x241f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x241f('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x241f('0x15')](0x5)[_0x241f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x241f('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x241f('0x26')],'defaultValue':0x3,'comment':_0x241f('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x241f('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x241f('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x241f('0x35')},'dialTimezone':{'type':Sequelize[_0x241f('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x241f('0x36')},'dialPrefix':{'type':Sequelize[_0x241f('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x241f('0x37')),'defaultValue':_0x241f('0x38')},'dialAMDActive':{'type':Sequelize[_0x241f('0x1f')],'defaultValue':0x0,'comment':_0x241f('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x241f('0x15')](0x9)[_0x241f('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x241f('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x241f('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x241f('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x241f('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x241f('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x241f('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x241f('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x241f('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x241f('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x241f('0x15')](0x9)[_0x241f('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x241f('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x241f('0x15')](0x9)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x241f('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x241f('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x241f('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x241f('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x241f('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x241f('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x241f('0x43')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x241f('0x6')],'comment':_0x241f('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x241f('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x241f('0x44')},'dialCutDigit':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x241f('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x241f('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x241f('0x15')](0x5)[_0x241f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x241f('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x241f('0x15')](0x5)[_0x241f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x241f('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x241f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x241f('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x241f('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x241f('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x241f('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x241f('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x241f('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x19305b){if(!_0x19305b)this[_0x241f('0xe')]('mandatoryDispositionPauseId',null);this[_0x241f('0xe')](_0x241f('0x4f'),_0x19305b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x241f('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x241f('0x15')](0x3)[_0x241f('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 036fe93..a636a24 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 _0xd809=['rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','includeAll','omit','createdAt','updatedAt','role','inbound','update','getHoppers','CmHopper','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','userVoiceQueue:save','ids','select','field','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','removeTeams','isEmpty','removeAgents','emit','addAgents','spread','SIP/%s','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','destroy','then','get','VoiceQueues','QueueCampaigns','map','find','value','type','error','name','VoiceQueue','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll'];(function(_0x25de09,_0x96ed5a){var _0x3eda1e=function(_0x5e879c){while(--_0x5e879c){_0x25de09['push'](_0x25de09['shift']());}};_0x3eda1e(++_0x96ed5a);}(_0xd809,0x6b));var _0x9d80=function(_0x5d8487,_0x2e3e21){_0x5d8487=_0x5d8487-0x0;var _0x5b7736=_0xd809[_0x5d8487];return _0x5b7736;};'use strict';var emlformat=require(_0x9d80('0x0'));var rimraf=require(_0x9d80('0x1'));var zipdir=require(_0x9d80('0x2'));var jsonpatch=require(_0x9d80('0x3'));var rp=require(_0x9d80('0x4'));var moment=require(_0x9d80('0x5'));var BPromise=require(_0x9d80('0x6'));var Mustache=require(_0x9d80('0x7'));var util=require('util');var path=require(_0x9d80('0x8'));var sox=require(_0x9d80('0x9'));var csv=require(_0x9d80('0xa'));var ejs=require(_0x9d80('0xb'));var fs=require('fs');var fs_extra=require(_0x9d80('0xc'));var _=require('lodash');var squel=require(_0x9d80('0xd'));var crypto=require(_0x9d80('0xe'));var jsforce=require(_0x9d80('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9d80('0xa'));var querystring=require(_0x9d80('0x10'));var Papa=require(_0x9d80('0x11'));var Redis=require('ioredis');var authService=require(_0x9d80('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d80('0x13'));var logger=require(_0x9d80('0x14'))(_0x9d80('0x15'));var utils=require(_0x9d80('0x16'));var config=require(_0x9d80('0x17'));var licenseUtil=require(_0x9d80('0x18'));var db=require(_0x9d80('0x19'))['db'];config['redis']=_[_0x9d80('0x1a')](config['redis'],{'host':_0x9d80('0x1b'),'port':0x18eb});var socket=require(_0x9d80('0x1c'))(new Redis(config[_0x9d80('0x1d')]));require(_0x9d80('0x1e'))[_0x9d80('0x1f')](socket);function respondWithStatusCode(_0xd11b6a,_0x3bb24f){_0x3bb24f=_0x3bb24f||0xcc;return function(_0x1e2189){if(_0x1e2189){return _0xd11b6a[_0x9d80('0x20')](_0x3bb24f);}return _0xd11b6a['status'](_0x3bb24f)[_0x9d80('0x21')]();};}function respondWithResult(_0x19a18e,_0xcade48){_0xcade48=_0xcade48||0xc8;return function(_0x382781){if(_0x382781){return _0x19a18e['status'](_0xcade48)[_0x9d80('0x22')](_0x382781);}};}function respondWithFilteredResult(_0x2fff11,_0x5d2819){return function(_0x55af94){if(_0x55af94){var _0x1cd961=typeof _0x5d2819[_0x9d80('0x23')]===_0x9d80('0x24')&&typeof _0x5d2819['limit']===_0x9d80('0x24');var _0xfd4862=_0x55af94[_0x9d80('0x25')];var _0x386027=_0x1cd961?0x0:_0x5d2819[_0x9d80('0x23')];var _0x34e1bc=_0x1cd961?_0x55af94[_0x9d80('0x25')]:_0x5d2819[_0x9d80('0x23')]+_0x5d2819[_0x9d80('0x26')];var _0x2ad69c;if(_0x34e1bc>=_0xfd4862){_0x34e1bc=_0xfd4862;_0x2ad69c=0xc8;}else{_0x2ad69c=0xce;}_0x2fff11[_0x9d80('0x27')](_0x2ad69c);return _0x2fff11['set'](_0x9d80('0x28'),_0x386027+'-'+_0x34e1bc+'/'+_0xfd4862)[_0x9d80('0x22')](_0x55af94);}return null;};}function patchUpdates(_0x237f0a){return function(_0x66c020){try{jsonpatch[_0x9d80('0x29')](_0x66c020,_0x237f0a,!![]);}catch(_0x1808c2){return BPromise[_0x9d80('0x2a')](_0x1808c2);}return _0x66c020[_0x9d80('0x2b')]();};}function saveUpdates(_0xce3cac,_0x31d088){return function(_0x2f85c8){if(_0x2f85c8){return _0x2f85c8['update'](_0xce3cac)['then'](function(_0x508340){return _0x508340;});}return null;};}function removeEntity(_0x5c126d,_0x417957){return function(_0x3bedbd){if(_0x3bedbd){return _0x3bedbd[_0x9d80('0x2c')]()[_0x9d80('0x2d')](function(){var _0x3a2bac=_0x3bedbd[_0x9d80('0x2e')]({'plain':!![]});var _0x6865f9=[{'name':_0x9d80('0x2f'),'value':'inbound','ignore':![]},{'name':_0x9d80('0x30'),'value':'outbound','ignore':![]}];var _0x2db914=_(_0x6865f9)['filter']('ignore')[_0x9d80('0x31')]('value')['value']();if(_['includes'](_0x2db914,_0x3a2bac['type'])){return;}var _0x33fa84=_[_0x9d80('0x32')](_0x6865f9,[_0x9d80('0x33'),_0x3a2bac[_0x9d80('0x34')]])['name'];return db['UserProfileResource'][_0x9d80('0x2c')]({'where':{'type':_0x33fa84,'resourceId':_0x3a2bac['id']}})[_0x9d80('0x2d')](function(){return _0x3bedbd;});})[_0x9d80('0x2d')](function(){_0x5c126d[_0x9d80('0x27')](0xcc)[_0x9d80('0x21')]();});}};}function handleEntityNotFound(_0x3a2728,_0x33d773){return function(_0x54e640){if(!_0x54e640){_0x3a2728['sendStatus'](0x194);}return _0x54e640;};}function handleError(_0x549d94,_0x26fd4c){_0x26fd4c=_0x26fd4c||0x1f4;return function(_0x266003){logger[_0x9d80('0x35')](_0x266003['stack']);if(_0x266003[_0x9d80('0x36')]){delete _0x266003[_0x9d80('0x36')];}_0x549d94[_0x9d80('0x27')](_0x26fd4c)['send'](_0x266003);};}exports['index']=function(_0x27ecf3,_0x1f8338){var _0x16cdb3={},_0xc22ac5={},_0x96f6b0={'count':0x0,'rows':[]};var _0x547f85=_[_0x9d80('0x31')](db[_0x9d80('0x37')]['rawAttributes'],function(_0x2bd972){return{'name':_0x2bd972[_0x9d80('0x38')],'type':_0x2bd972[_0x9d80('0x34')][_0x9d80('0x39')]};});_0xc22ac5[_0x9d80('0x3a')]=_[_0x9d80('0x31')](_0x547f85,'name');_0xc22ac5[_0x9d80('0x3b')]=_[_0x9d80('0x3c')](_0x27ecf3[_0x9d80('0x3b')]);_0xc22ac5['filters']=_[_0x9d80('0x3d')](_0xc22ac5[_0x9d80('0x3a')],_0xc22ac5[_0x9d80('0x3b')]);_0x16cdb3[_0x9d80('0x3e')]=_['intersection'](_0xc22ac5[_0x9d80('0x3a')],qs['fields'](_0x27ecf3[_0x9d80('0x3b')][_0x9d80('0x3f')]));_0x16cdb3[_0x9d80('0x3e')]=_0x16cdb3[_0x9d80('0x3e')]['length']?_0x16cdb3[_0x9d80('0x3e')]:_0xc22ac5[_0x9d80('0x3a')];if(!_0x27ecf3[_0x9d80('0x3b')][_0x9d80('0x40')](_0x9d80('0x41'))){_0x16cdb3[_0x9d80('0x26')]=qs[_0x9d80('0x26')](_0x27ecf3[_0x9d80('0x3b')][_0x9d80('0x26')]);_0x16cdb3['offset']=qs[_0x9d80('0x23')](_0x27ecf3[_0x9d80('0x3b')][_0x9d80('0x23')]);}_0x16cdb3[_0x9d80('0x42')]=qs[_0x9d80('0x43')](_0x27ecf3['query'][_0x9d80('0x43')]);_0x16cdb3[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_[_0x9d80('0x46')](_0x27ecf3[_0x9d80('0x3b')],_0xc22ac5[_0x9d80('0x45')]),_0x547f85);if(_0x27ecf3[_0x9d80('0x3b')]['filter']){_0x16cdb3[_0x9d80('0x44')]=_['merge'](_0x16cdb3[_0x9d80('0x44')],{'$or':_[_0x9d80('0x31')](_0x547f85,function(_0x520053){if(_0x520053[_0x9d80('0x34')]!==_0x9d80('0x47')){var _0x2ea27c={};_0x2ea27c[_0x520053['name']]={'$like':'%'+_0x27ecf3[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x2ea27c;}})});}_0x16cdb3=_[_0x9d80('0x49')]({},_0x16cdb3,_0x27ecf3[_0x9d80('0x4a')]);var _0x57b867={'where':_0x16cdb3[_0x9d80('0x44')]};return db['VoiceQueue'][_0x9d80('0x25')](_0x57b867)[_0x9d80('0x2d')](function(_0x264ad2){_0x96f6b0[_0x9d80('0x25')]=_0x264ad2;if(_0x27ecf3[_0x9d80('0x3b')]['includeAll']){_0x16cdb3[_0x9d80('0x4b')]=[{'all':!![]}];}return db['VoiceQueue'][_0x9d80('0x4c')](_0x16cdb3);})[_0x9d80('0x2d')](function(_0x25eb1d){_0x96f6b0[_0x9d80('0x4d')]=_0x25eb1d;return _0x96f6b0;})[_0x9d80('0x2d')](respondWithFilteredResult(_0x1f8338,_0x16cdb3))[_0x9d80('0x4e')](handleError(_0x1f8338,null));};exports['show']=function(_0xf5246d,_0x97acbf){var _0x17dd56={'raw':![],'where':{'id':_0xf5246d[_0x9d80('0x4f')]['id']}},_0x9a4f={};_0x9a4f[_0x9d80('0x3a')]=_[_0x9d80('0x3c')](db[_0x9d80('0x37')][_0x9d80('0x50')]);_0x9a4f[_0x9d80('0x3b')]=_[_0x9d80('0x3c')](_0xf5246d[_0x9d80('0x3b')]);_0x9a4f['filters']=_[_0x9d80('0x3d')](_0x9a4f[_0x9d80('0x3a')],_0x9a4f['query']);_0x17dd56[_0x9d80('0x3e')]=_[_0x9d80('0x3d')](_0x9a4f[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0xf5246d[_0x9d80('0x3b')][_0x9d80('0x3f')]));_0x17dd56[_0x9d80('0x3e')]=_0x17dd56['attributes']['length']?_0x17dd56[_0x9d80('0x3e')]:_0x9a4f[_0x9d80('0x3a')];if(_0xf5246d[_0x9d80('0x3b')]['includeAll']){_0x17dd56['include']=[{'all':!![]}];}_0x17dd56=_['merge']({},_0x17dd56,_0xf5246d['options']);return db['VoiceQueue'][_0x9d80('0x32')](_0x17dd56)['then'](handleEntityNotFound(_0x97acbf,null))[_0x9d80('0x2d')](respondWithResult(_0x97acbf,null))[_0x9d80('0x4e')](handleError(_0x97acbf,null));};exports[_0x9d80('0x51')]=function(_0x59e556,_0x5a3b01){return db[_0x9d80('0x37')][_0x9d80('0x51')](_0x59e556[_0x9d80('0x52')],{})[_0x9d80('0x2d')](function(_0x36bcc0){var _0xa196b8=_0x59e556[_0x9d80('0x53')][_0x9d80('0x2e')]({'plain':!![]});if(!_0xa196b8)throw new Error(_0x9d80('0x54'));if(_0xa196b8['role']===_0x9d80('0x53')){var _0x1fc432=_0x36bcc0['get']({'plain':!![]});var _0x4d9c93=[{'name':_0x9d80('0x2f'),'value':'inbound'},{'name':_0x9d80('0x30'),'value':_0x9d80('0x55')}];var _0x56743f=_[_0x9d80('0x32')](_0x4d9c93,[_0x9d80('0x33'),_0x1fc432[_0x9d80('0x34')]])['name'];return db[_0x9d80('0x56')][_0x9d80('0x32')]({'where':{'name':_0x56743f,'userProfileId':_0xa196b8['userProfileId']},'raw':!![]})[_0x9d80('0x2d')](function(_0x182d9a){if(_0x182d9a&&_0x182d9a[_0x9d80('0x57')]===0x0){return db[_0x9d80('0x58')]['create']({'name':_0x1fc432[_0x9d80('0x36')],'resourceId':_0x1fc432['id'],'type':_0x182d9a[_0x9d80('0x36')],'sectionId':_0x182d9a['id']},{})[_0x9d80('0x2d')](function(){return _0x36bcc0;});}else{return _0x36bcc0;}})[_0x9d80('0x4e')](function(_0x5b0536){logger[_0x9d80('0x35')](_0x9d80('0x59'),_0x5b0536);throw _0x5b0536;});}return _0x36bcc0;})[_0x9d80('0x2d')](respondWithResult(_0x5a3b01,0xc9))['catch'](handleError(_0x5a3b01,null));};exports[_0x9d80('0x5a')]=function(_0x379615,_0x4acf7a){var _0x5b0be5={'where':{'id':_0x379615['params']['id']}},_0x18af21={};_0x18af21[_0x9d80('0x3a')]=_[_0x9d80('0x3c')](db[_0x9d80('0x37')][_0x9d80('0x50')]);_0x5b0be5['attributes']=_[_0x9d80('0x3d')](_0x18af21[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x379615[_0x9d80('0x3b')]['fields']));_0x5b0be5['attributes']=_0x5b0be5[_0x9d80('0x3e')][_0x9d80('0x5b')]?_0x5b0be5[_0x9d80('0x3e')]:_0x18af21[_0x9d80('0x3a')];if(_0x379615[_0x9d80('0x3b')][_0x9d80('0x5c')]){_0x5b0be5[_0x9d80('0x4b')]=[{'all':!![]}];}_0x5b0be5=_[_0x9d80('0x49')]({},_0x5b0be5,_0x379615['options']);return db['VoiceQueue'][_0x9d80('0x32')](_0x5b0be5)[_0x9d80('0x2d')](handleEntityNotFound(_0x4acf7a,null))['then'](function(_0x39b865){if(_0x39b865){var _0x3e8540=_0x39b865['get']({'plain':!![]});_0x3e8540=qs[_0x9d80('0x5d')](_0x3e8540,['id',_0x9d80('0x5e'),_0x9d80('0x5f')]);_0x379615[_0x9d80('0x52')]=_[_0x9d80('0x5d')](_0x379615[_0x9d80('0x52')],['id',_0x9d80('0x5e'),_0x9d80('0x5f')]);return db[_0x9d80('0x37')][_0x9d80('0x51')](_[_0x9d80('0x49')](_0x3e8540,_0x379615[_0x9d80('0x52')]),{'include':_0x379615[_0x9d80('0x3b')][_0x9d80('0x5c')]?[{'all':!![]}]:undefined})[_0x9d80('0x2d')](function(_0x53214e){var _0x2f66eb=_0x379615[_0x9d80('0x53')]['get']({'plain':!![]});if(!_0x2f66eb)throw new Error(_0x9d80('0x54'));if(_0x2f66eb[_0x9d80('0x60')]==='user'){var _0x21d120=_0x53214e[_0x9d80('0x2e')]({'plain':!![]});var _0x48624c=[{'name':_0x9d80('0x2f'),'value':_0x9d80('0x61')},{'name':'QueueCampaigns','value':_0x9d80('0x55')}];var _0xba3ad0=_[_0x9d80('0x32')](_0x48624c,[_0x9d80('0x33'),_0x21d120['type']])['name'];return db[_0x9d80('0x56')][_0x9d80('0x32')]({'where':{'name':_0xba3ad0,'userProfileId':_0x2f66eb['userProfileId']},'raw':!![]})[_0x9d80('0x2d')](function(_0x2011b1){if(_0x2011b1&&_0x2011b1['autoAssociation']===0x0){return db[_0x9d80('0x58')]['create']({'name':_0x21d120[_0x9d80('0x36')],'resourceId':_0x21d120['id'],'type':_0x2011b1[_0x9d80('0x36')],'sectionId':_0x2011b1['id']},{})['then'](function(){return _0x53214e;});}else{return _0x53214e;}})[_0x9d80('0x4e')](function(_0x3df7a8){logger[_0x9d80('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3df7a8);throw _0x3df7a8;});}return _0x53214e;});}})[_0x9d80('0x2d')](respondWithResult(_0x4acf7a,0xc9))[_0x9d80('0x4e')](handleError(_0x4acf7a,null));};exports[_0x9d80('0x62')]=function(_0x22e240,_0x4f79a5){if(_0x22e240[_0x9d80('0x52')]['id']){delete _0x22e240['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x22e240[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x4f79a5,null))['then'](saveUpdates(_0x22e240['body'],null))[_0x9d80('0x2d')](respondWithResult(_0x4f79a5,null))[_0x9d80('0x4e')](handleError(_0x4f79a5,null));};exports[_0x9d80('0x2c')]=function(_0x2a1cd9,_0x324732){return db[_0x9d80('0x37')][_0x9d80('0x32')]({'where':{'id':_0x2a1cd9[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x324732,null))[_0x9d80('0x2d')](removeEntity(_0x324732,null))[_0x9d80('0x4e')](handleError(_0x324732,null));};exports[_0x9d80('0x63')]=function(_0x5348f2,_0x3748b0,_0x1b057d){var _0x3a4de7={'raw':![],'where':{}};var _0x2e8478={};var _0x522f76={'count':0x0,'rows':[]};return db[_0x9d80('0x37')]['findOne']({'where':{'id':_0x5348f2[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x3748b0,null))['then'](function(_0x55becc){if(_0x55becc){_0x2e8478['model']=_['keys'](db[_0x9d80('0x64')][_0x9d80('0x50')]);_0x2e8478[_0x9d80('0x3b')]=_['keys'](_0x5348f2[_0x9d80('0x3b')]);_0x2e8478[_0x9d80('0x45')]=_[_0x9d80('0x3d')](_0x2e8478[_0x9d80('0x3a')],_0x2e8478[_0x9d80('0x3b')]);_0x3a4de7[_0x9d80('0x3e')]=_[_0x9d80('0x3d')](_0x2e8478[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x5348f2[_0x9d80('0x3b')][_0x9d80('0x3f')]));_0x3a4de7['attributes']=_0x3a4de7[_0x9d80('0x3e')][_0x9d80('0x5b')]?_0x3a4de7[_0x9d80('0x3e')]:_0x2e8478['model'];if(!_0x5348f2['query'][_0x9d80('0x40')]('nolimit')){_0x3a4de7[_0x9d80('0x26')]=qs[_0x9d80('0x26')](_0x5348f2['query']['limit']);_0x3a4de7[_0x9d80('0x23')]=qs['offset'](_0x5348f2[_0x9d80('0x3b')]['offset']);}_0x3a4de7[_0x9d80('0x42')]=qs['sort'](_0x5348f2[_0x9d80('0x3b')][_0x9d80('0x43')]);_0x3a4de7[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_[_0x9d80('0x46')](_0x5348f2['query'],_0x2e8478[_0x9d80('0x45')]));_0x3a4de7[_0x9d80('0x44')]['VoiceQueueId']=_0x55becc['id'];if(_0x5348f2['query'][_0x9d80('0x48')]){_0x3a4de7[_0x9d80('0x44')]=_[_0x9d80('0x49')](_0x3a4de7[_0x9d80('0x44')],{'$or':_[_0x9d80('0x31')](_0x3a4de7['attributes'],function(_0x38da16){var _0x1f0903={};_0x1f0903[_0x38da16]={'$like':'%'+_0x5348f2[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x1f0903;})});}_0x3a4de7=_[_0x9d80('0x49')]({},_0x3a4de7,_0x5348f2[_0x9d80('0x4a')]);return db['CmHopper'][_0x9d80('0x25')]({'where':_0x3a4de7[_0x9d80('0x44')]})['then'](function(_0x3bf03b){_0x522f76[_0x9d80('0x25')]=_0x3bf03b;if(_0x5348f2['query']['includeAll']){_0x3a4de7[_0x9d80('0x4b')]=[{'all':!![]}];}return db[_0x9d80('0x64')][_0x9d80('0x4c')](_0x3a4de7);})[_0x9d80('0x2d')](function(_0xe6f9bb){_0x522f76['rows']=_0xe6f9bb;return _0x522f76;});}})['then'](respondWithFilteredResult(_0x3748b0,_0x3a4de7))[_0x9d80('0x4e')](handleError(_0x3748b0,null));};exports[_0x9d80('0x65')]=function(_0x1d7315,_0x520577,_0x4b6423){var _0x3b78d5={'raw':!![],'where':{}};var _0xaa580e={};var _0x3c4594={'count':0x0,'rows':[]};return db[_0x9d80('0x37')][_0x9d80('0x66')]({'where':{'id':_0x1d7315[_0x9d80('0x4f')]['id']}})['then'](handleEntityNotFound(_0x520577,null))[_0x9d80('0x2d')](function(_0x4fe01d){if(_0x4fe01d){_0xaa580e[_0x9d80('0x3a')]=_['keys'](db[_0x9d80('0x67')][_0x9d80('0x50')]);_0xaa580e[_0x9d80('0x3b')]=_[_0x9d80('0x3c')](_0x1d7315[_0x9d80('0x3b')]);_0xaa580e[_0x9d80('0x45')]=_[_0x9d80('0x3d')](_0xaa580e['model'],_0xaa580e[_0x9d80('0x3b')]);_0x3b78d5['attributes']=_[_0x9d80('0x3d')](_0xaa580e[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x1d7315[_0x9d80('0x3b')]['fields']));_0x3b78d5[_0x9d80('0x3e')]=_0x3b78d5[_0x9d80('0x3e')]['length']?_0x3b78d5['attributes']:_0xaa580e[_0x9d80('0x3a')];if(!_0x1d7315[_0x9d80('0x3b')][_0x9d80('0x40')](_0x9d80('0x41'))){_0x3b78d5[_0x9d80('0x26')]=qs['limit'](_0x1d7315[_0x9d80('0x3b')]['limit']);_0x3b78d5[_0x9d80('0x23')]=qs[_0x9d80('0x23')](_0x1d7315[_0x9d80('0x3b')][_0x9d80('0x23')]);}_0x3b78d5[_0x9d80('0x42')]=qs[_0x9d80('0x43')](_0x1d7315['query'][_0x9d80('0x43')]);_0x3b78d5[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_[_0x9d80('0x46')](_0x1d7315[_0x9d80('0x3b')],_0xaa580e['filters']));_0x3b78d5[_0x9d80('0x44')][_0x9d80('0x68')]=_0x4fe01d['id'];if(_0x1d7315[_0x9d80('0x3b')][_0x9d80('0x48')]){_0x3b78d5['where']=_[_0x9d80('0x49')](_0x3b78d5[_0x9d80('0x44')],{'$or':_['map'](_0x3b78d5['attributes'],function(_0xb5ebb8){var _0x152a89={};_0x152a89[_0xb5ebb8]={'$like':'%'+_0x1d7315[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x152a89;})});}_0x3b78d5=_[_0x9d80('0x49')]({},_0x3b78d5,_0x1d7315[_0x9d80('0x4a')]);return db['CmHopperHistory']['count']({'where':_0x3b78d5['where']})[_0x9d80('0x2d')](function(_0xa76422){_0x3c4594['count']=_0xa76422;if(_0x1d7315[_0x9d80('0x3b')][_0x9d80('0x5c')]){_0x3b78d5[_0x9d80('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x9d80('0x4c')](_0x3b78d5);})['then'](function(_0x271d51){_0x3c4594[_0x9d80('0x4d')]=_0x271d51;return _0x3c4594;});}})[_0x9d80('0x2d')](respondWithFilteredResult(_0x520577,_0x3b78d5))[_0x9d80('0x4e')](handleError(_0x520577,null));};exports[_0x9d80('0x69')]=function(_0x225baa,_0x4ee4bc,_0x47647e){var _0x1d67c3={'raw':!![],'where':{}};var _0x954bbe={};var _0x5715c3={'count':0x0,'rows':[]};return db[_0x9d80('0x37')][_0x9d80('0x66')]({'where':{'id':_0x225baa[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x4ee4bc,null))['then'](function(_0x5636ff){if(_0x5636ff){_0x954bbe[_0x9d80('0x3a')]=_['keys'](db[_0x9d80('0x6a')][_0x9d80('0x50')]);_0x954bbe[_0x9d80('0x3b')]=_[_0x9d80('0x3c')](_0x225baa['query']);_0x954bbe['filters']=_['intersection'](_0x954bbe[_0x9d80('0x3a')],_0x954bbe[_0x9d80('0x3b')]);_0x1d67c3[_0x9d80('0x3e')]=_[_0x9d80('0x3d')](_0x954bbe['model'],qs['fields'](_0x225baa[_0x9d80('0x3b')][_0x9d80('0x3f')]));_0x1d67c3['attributes']=_0x1d67c3[_0x9d80('0x3e')][_0x9d80('0x5b')]?_0x1d67c3['attributes']:_0x954bbe[_0x9d80('0x3a')];if(!_0x225baa['query']['hasOwnProperty'](_0x9d80('0x41'))){_0x1d67c3[_0x9d80('0x26')]=qs[_0x9d80('0x26')](_0x225baa[_0x9d80('0x3b')][_0x9d80('0x26')]);_0x1d67c3[_0x9d80('0x23')]=qs[_0x9d80('0x23')](_0x225baa[_0x9d80('0x3b')][_0x9d80('0x23')]);}_0x1d67c3[_0x9d80('0x42')]=qs['sort'](_0x225baa[_0x9d80('0x3b')][_0x9d80('0x43')]);_0x1d67c3[_0x9d80('0x44')]=qs['filters'](_[_0x9d80('0x46')](_0x225baa['query'],_0x954bbe[_0x9d80('0x45')]));_0x1d67c3[_0x9d80('0x44')][_0x9d80('0x68')]=_0x5636ff['id'];if(_0x225baa[_0x9d80('0x3b')][_0x9d80('0x48')]){_0x1d67c3['where']=_['merge'](_0x1d67c3[_0x9d80('0x44')],{'$or':_['map'](_0x1d67c3[_0x9d80('0x3e')],function(_0x3f93d8){var _0x292a91={};_0x292a91[_0x3f93d8]={'$like':'%'+_0x225baa[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x292a91;})});}_0x1d67c3=_[_0x9d80('0x49')]({},_0x1d67c3,_0x225baa[_0x9d80('0x4a')]);return db[_0x9d80('0x6a')]['count']({'where':_0x1d67c3[_0x9d80('0x44')]})['then'](function(_0x10eb94){_0x5715c3[_0x9d80('0x25')]=_0x10eb94;if(_0x225baa['query'][_0x9d80('0x5c')]){_0x1d67c3[_0x9d80('0x4b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9d80('0x4c')](_0x1d67c3);})[_0x9d80('0x2d')](function(_0x4c90b8){_0x5715c3['rows']=_0x4c90b8;return _0x5715c3;});}})[_0x9d80('0x2d')](respondWithFilteredResult(_0x4ee4bc,_0x1d67c3))[_0x9d80('0x4e')](handleError(_0x4ee4bc,null));};exports[_0x9d80('0x6b')]=function(_0x42d93d,_0x273742,_0x1d613a){var _0x51423a={'raw':!![],'where':{}};var _0x18c0af={};var _0x3be4c5={'count':0x0,'rows':[]};return db[_0x9d80('0x37')][_0x9d80('0x66')]({'where':{'id':_0x42d93d[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x273742,null))[_0x9d80('0x2d')](function(_0x3a610f){if(_0x3a610f){_0x18c0af[_0x9d80('0x3a')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x18c0af[_0x9d80('0x3b')]=_[_0x9d80('0x3c')](_0x42d93d[_0x9d80('0x3b')]);_0x18c0af[_0x9d80('0x45')]=_[_0x9d80('0x3d')](_0x18c0af[_0x9d80('0x3a')],_0x18c0af['query']);_0x51423a[_0x9d80('0x3e')]=_[_0x9d80('0x3d')](_0x18c0af[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x42d93d[_0x9d80('0x3b')][_0x9d80('0x3f')]));_0x51423a[_0x9d80('0x3e')]=_0x51423a[_0x9d80('0x3e')]['length']?_0x51423a['attributes']:_0x18c0af['model'];if(!_0x42d93d[_0x9d80('0x3b')][_0x9d80('0x40')]('nolimit')){_0x51423a[_0x9d80('0x26')]=qs[_0x9d80('0x26')](_0x42d93d[_0x9d80('0x3b')][_0x9d80('0x26')]);_0x51423a[_0x9d80('0x23')]=qs[_0x9d80('0x23')](_0x42d93d[_0x9d80('0x3b')][_0x9d80('0x23')]);}_0x51423a[_0x9d80('0x42')]=qs[_0x9d80('0x43')](_0x42d93d['query'][_0x9d80('0x43')]);_0x51423a[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_[_0x9d80('0x46')](_0x42d93d[_0x9d80('0x3b')],_0x18c0af[_0x9d80('0x45')]));_0x51423a[_0x9d80('0x44')]['VoiceQueueId']=_0x3a610f['id'];if(_0x42d93d[_0x9d80('0x3b')][_0x9d80('0x48')]){_0x51423a[_0x9d80('0x44')]=_[_0x9d80('0x49')](_0x51423a['where'],{'$or':_[_0x9d80('0x31')](_0x51423a['attributes'],function(_0x1f4009){var _0x1ad57d={};_0x1ad57d[_0x1f4009]={'$like':'%'+_0x42d93d[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x1ad57d;})});}_0x51423a=_['merge']({},_0x51423a,_0x42d93d[_0x9d80('0x4a')]);return db['CmHopperBlack']['count']({'where':_0x51423a[_0x9d80('0x44')]})[_0x9d80('0x2d')](function(_0x4927a0){_0x3be4c5[_0x9d80('0x25')]=_0x4927a0;if(_0x42d93d[_0x9d80('0x3b')]['includeAll']){_0x51423a[_0x9d80('0x4b')]=[{'all':!![]}];}return db[_0x9d80('0x6c')][_0x9d80('0x4c')](_0x51423a);})['then'](function(_0x3a8bd9){_0x3be4c5[_0x9d80('0x4d')]=_0x3a8bd9;return _0x3be4c5;});}})[_0x9d80('0x2d')](respondWithFilteredResult(_0x273742,_0x51423a))['catch'](handleError(_0x273742,null));};exports[_0x9d80('0x6d')]=function(_0x21b8a6,_0x70e237,_0x485ba0){var _0x11f25a={};var _0x440daf={};var _0x17f155;var _0x28e917;return db[_0x9d80('0x37')]['findOne']({'where':{'id':_0x21b8a6[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x70e237,null))['then'](function(_0x2d5745){if(_0x2d5745){_0x17f155=_0x2d5745;_0x440daf[_0x9d80('0x3a')]=_[_0x9d80('0x3c')](db['Team'][_0x9d80('0x50')]);_0x440daf['query']=_[_0x9d80('0x3c')](_0x21b8a6[_0x9d80('0x3b')]);_0x440daf['filters']=_['intersection'](_0x440daf[_0x9d80('0x3a')],_0x440daf[_0x9d80('0x3b')]);_0x11f25a[_0x9d80('0x3e')]=_['intersection'](_0x440daf['model'],qs[_0x9d80('0x3f')](_0x21b8a6['query']['fields']));_0x11f25a['attributes']=_0x11f25a[_0x9d80('0x3e')][_0x9d80('0x5b')]?_0x11f25a[_0x9d80('0x3e')]:_0x440daf[_0x9d80('0x3a')];_0x11f25a[_0x9d80('0x42')]=qs['sort'](_0x21b8a6[_0x9d80('0x3b')][_0x9d80('0x43')]);_0x11f25a[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_['pick'](_0x21b8a6['query'],_0x440daf['filters']));if(_0x21b8a6[_0x9d80('0x3b')]['filter']){_0x11f25a[_0x9d80('0x44')]=_[_0x9d80('0x49')](_0x11f25a[_0x9d80('0x44')],{'$or':_[_0x9d80('0x31')](_0x11f25a[_0x9d80('0x3e')],function(_0xd561ec){var _0x3a17a4={};_0x3a17a4[_0xd561ec]={'$like':'%'+_0x21b8a6[_0x9d80('0x3b')]['filter']+'%'};return _0x3a17a4;})});}_0x11f25a=_[_0x9d80('0x49')]({},_0x11f25a,_0x21b8a6['options']);return _0x17f155[_0x9d80('0x6d')](_0x11f25a);}})[_0x9d80('0x2d')](function(_0x20e20c){if(_0x20e20c){_0x28e917=_0x20e20c[_0x9d80('0x5b')];if(!_0x21b8a6[_0x9d80('0x3b')]['hasOwnProperty'](_0x9d80('0x41'))){_0x11f25a[_0x9d80('0x26')]=qs['limit'](_0x21b8a6[_0x9d80('0x3b')][_0x9d80('0x26')]);_0x11f25a['offset']=qs[_0x9d80('0x23')](_0x21b8a6[_0x9d80('0x3b')][_0x9d80('0x23')]);}return _0x17f155[_0x9d80('0x6d')](_0x11f25a);}})[_0x9d80('0x2d')](function(_0x334af7){if(_0x334af7){return _0x334af7?{'count':_0x28e917,'rows':_0x334af7}:null;}})[_0x9d80('0x2d')](respondWithResult(_0x70e237,null))['catch'](handleError(_0x70e237,null));};exports[_0x9d80('0x6e')]=function(_0x18c812,_0x2b2730,_0x51c07b){var _0x16ca3e=_0x18c812['body'][_0x9d80('0x6f')];var _0x12d7cc=_[_0x9d80('0x31')](_0x16ca3e,'id');return db[_0x9d80('0x70')][_0x9d80('0x4c')]({'where':{'id':_0x12d7cc},'attributes':['id'],'include':[{'model':db[_0x9d80('0x71')],'as':_0x9d80('0x72'),'attributes':['id',_0x9d80('0x36'),_0x9d80('0x73'),_0x9d80('0x74'),_0x9d80('0x75')],'raw':!![]}]})[_0x9d80('0x2d')](function(_0x45587a){if(_0x45587a){var _0x8ba549=_[_0x9d80('0x76')](_0x45587a,function(_0x2861c4){var _0x51f8d3=_0x2861c4[_0x9d80('0x2e')]({'plain':!![]});_0x51f8d3[_0x9d80('0x72')][_0x9d80('0x77')](function(_0x15ebff){_0x15ebff[_0x9d80('0x78')]=_[_0x9d80('0x32')](_0x16ca3e,{'id':_0x51f8d3['id']})['penalty'];});return _0x51f8d3[_0x9d80('0x72')];});return db[_0x9d80('0x37')][_0x9d80('0x32')]({'where':{'id':_0x18c812['params']['id']}})[_0x9d80('0x2d')](function(_0x9c007a){return db[_0x9d80('0x79')][_0x9d80('0x7a')](function(_0x330a36){return _0x9c007a['addTeams'](_0x12d7cc,{'transaction':_0x330a36})[_0x9d80('0x2d')](function(){return BPromise[_0x9d80('0x7b')](_0x16ca3e,function(_0x22a290){return db[_0x9d80('0x7c')][_0x9d80('0x7d')]({'TeamId':_0x22a290['id'],'VoiceQueueId':_0x18c812['params']['id'],'penalty':_0x22a290['penalty']},{'transaction':_0x330a36});});})[_0x9d80('0x2d')](function(){return BPromise[_0x9d80('0x7b')](_0x8ba549,function(_0x170f80){return db['UserVoiceQueue'][_0x9d80('0x7e')]({'where':{'UserId':_0x170f80['id'],'VoiceQueueId':_0x18c812[_0x9d80('0x4f')]['id']},'defaults':{'penalty':_0x170f80[_0x9d80('0x78')]},'transaction':_0x330a36});});})['then'](function(){return BPromise[_0x9d80('0x7b')](_[_0x9d80('0x48')](_0x8ba549,{'online':!![]}),function(_0x37939d){return db[_0x9d80('0x7f')]['upsert']({'membername':_0x37939d[_0x9d80('0x36')],'UserId':_0x37939d['id'],'queue_name':_0x9c007a['name'],'VoiceQueueId':_0x9c007a['id'],'interface':_[_0x9d80('0x80')](_0x37939d[_0x9d80('0x75')])?util[_0x9d80('0x81')]('SIP/%s',_0x37939d[_0x9d80('0x36')]):_0x37939d[_0x9d80('0x75')],'paused':_0x37939d[_0x9d80('0x74')]||![],'penalty':_0x37939d['penalty']},{'transaction':_0x330a36});});})['then'](function(){_0x8ba549[_0x9d80('0x77')](function(_0x5d954a){socket['emit'](_0x9d80('0x82'),{'UserId':_0x5d954a['id'],'VoiceQueueId':_0x9c007a['id']});});});});});}})['then'](respondWithStatusCode(_0x2b2730,null))['catch'](handleError(_0x2b2730,null));};exports['removeTeams']=function(_0x550099,_0x256079,_0x4b3069){return db[_0x9d80('0x70')]['findAll']({'where':{'id':_0x550099[_0x9d80('0x3b')][_0x9d80('0x83')]},'attributes':['id'],'include':[{'model':db[_0x9d80('0x71')],'as':_0x9d80('0x72'),'attributes':['id'],'raw':!![]}]})[_0x9d80('0x2d')](handleEntityNotFound(_0x256079,null))[_0x9d80('0x2d')](function(_0x31fb9b){var _0x58eb95=_[_0x9d80('0x31')](_0x31fb9b,'id');var _0x42a05b=[];var _0x2120d8=[];var _0x45b04e=squel[_0x9d80('0x84')]();_0x45b04e[_0x9d80('0x85')]('tq.TeamId')['from']('team_has_voice_queues','tq')[_0x9d80('0x86')]('user_has_teams','ut',_0x9d80('0x87'))['where'](_0x9d80('0x88'),_0x550099[_0x9d80('0x4f')]['id']);for(var _0xeda606=0x0;_0xeda606<_0x31fb9b[_0x9d80('0x5b')];_0xeda606+=0x1){let _0x36eb9a=_0x31fb9b[_0xeda606];for(var _0x5c6f9a=0x0;_0x5c6f9a<_0x36eb9a[_0x9d80('0x72')][_0x9d80('0x5b')];_0x5c6f9a+=0x1){let _0x58b54d=_0x36eb9a['Agents'][_0x5c6f9a];var _0x145d25=_0x45b04e[_0x9d80('0x5a')]();_0x145d25[_0x9d80('0x44')](_0x9d80('0x89'),_0x58b54d['id']);_0x2120d8[_0x9d80('0x8a')](db[_0x9d80('0x79')][_0x9d80('0x3b')](_0x145d25[_0x9d80('0x8b')](),{'type':db[_0x9d80('0x79')][_0x9d80('0x8c')]['SELECT']})[_0x9d80('0x2d')](function(_0x47342c){if(_0x47342c[_0x9d80('0x5b')]===0x1){return _0x58b54d['id'];}else{var _0x544844=_[_0x9d80('0x8d')](_[_0x9d80('0x31')](_0x47342c,_0x9d80('0x8e')),function(_0x3c583c){return _[_0x9d80('0x8f')](_0x58eb95,_0x3c583c);});if(_0x544844){return _0x58b54d['id'];}}}));}}return BPromise['all'](_0x2120d8)[_0x9d80('0x2d')](function(_0x348d90){_0x42a05b=_(_0x42a05b)[_0x9d80('0x90')](_0x348d90)['compact']()['value']();return db[_0x9d80('0x37')][_0x9d80('0x32')]({'where':{'id':_0x550099[_0x9d80('0x4f')]['id']}})['then'](function(_0x57cc89){return db[_0x9d80('0x79')][_0x9d80('0x7a')](function(_0x1612dc){return _0x57cc89[_0x9d80('0x91')](_0x550099[_0x9d80('0x3b')][_0x9d80('0x83')],{'transaction':_0x1612dc})[_0x9d80('0x2d')](function(){if(!_[_0x9d80('0x92')](_0x42a05b)){return _0x57cc89[_0x9d80('0x93')](_0x42a05b,{'transaction':_0x1612dc})[_0x9d80('0x2d')](function(){return db['UserVoiceQueueRt'][_0x9d80('0x2c')]({'where':{'VoiceQueueId':_0x550099[_0x9d80('0x4f')]['id'],'UserId':_0x42a05b},'transaction':_0x1612dc});});}})['then'](function(){_0x42a05b[_0x9d80('0x77')](function(_0x492c8e){socket[_0x9d80('0x94')]('userVoiceQueue:remove',{'UserId':_0x492c8e,'VoiceQueueId':_0x57cc89['id']});});});});});});})[_0x9d80('0x2d')](respondWithStatusCode(_0x256079,null))[_0x9d80('0x4e')](handleError(_0x256079,null));};exports['addAgents']=function(_0x312011,_0x3ef28d,_0x4e8290){var _0x20068e,_0x4ef64f;return db['VoiceQueue'][_0x9d80('0x32')]({'where':{'id':_0x312011[_0x9d80('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3ef28d,null))[_0x9d80('0x2d')](function(_0x428659){if(_0x428659){_0x4ef64f=_0x428659;return _0x428659[_0x9d80('0x95')](_0x312011['body'][_0x9d80('0x83')],_[_0x9d80('0x5d')](_0x312011[_0x9d80('0x52')],[_0x9d80('0x83'),'id'])||{})[_0x9d80('0x96')](function(_0x48a4c3){for(var _0x54eb39=0x0;_0x54eb39<_0x312011['body'][_0x9d80('0x83')][_0x9d80('0x5b')];_0x54eb39+=0x1){socket['emit'](_0x9d80('0x82'),{'UserId':Number(_0x312011[_0x9d80('0x52')][_0x9d80('0x83')][_0x54eb39]),'VoiceQueueId':Number(_0x312011[_0x9d80('0x4f')]['id'])});}return _0x48a4c3;});}})[_0x9d80('0x2d')](function(_0x15d0cd){_0x20068e=_0x15d0cd||[];if(_0x4ef64f){return db['User'][_0x9d80('0x4c')]({'where':{'id':_0x312011['body']['ids']},'attributes':['id',_0x9d80('0x36'),_0x9d80('0x73'),_0x9d80('0x74'),_0x9d80('0x75')],'raw':!![]});}})[_0x9d80('0x2d')](function(_0x500986){if(!_[_0x9d80('0x92')](_0x500986)){var _0x28777c=[];for(var _0x3cff7d=0x0;_0x3cff7d<_0x500986[_0x9d80('0x5b')];_0x3cff7d++){if(_0x500986[_0x3cff7d][_0x9d80('0x73')]){_0x28777c[_0x9d80('0x8a')](db[_0x9d80('0x7f')][_0x9d80('0x7d')]({'membername':_0x500986[_0x3cff7d]['name'],'UserId':_0x500986[_0x3cff7d]['id'],'queue_name':_0x4ef64f['name'],'VoiceQueueId':_0x4ef64f['id'],'interface':_[_0x9d80('0x80')](_0x500986[_0x3cff7d][_0x9d80('0x75')])?util[_0x9d80('0x81')](_0x9d80('0x97'),_0x500986[_0x3cff7d][_0x9d80('0x36')]):_0x500986[_0x3cff7d]['interface'],'paused':_0x500986[_0x3cff7d][_0x9d80('0x74')]||![],'penalty':_0x312011[_0x9d80('0x52')][_0x9d80('0x78')]||0x0}));}}return BPromise[_0x9d80('0x98')](_0x28777c);}})[_0x9d80('0x2d')](function(){return _0x20068e;})[_0x9d80('0x2d')](respondWithResult(_0x3ef28d,null))['catch'](handleError(_0x3ef28d,null));};exports['removeAgents']=function(_0x325e37,_0x37727e,_0x5a335d){return db[_0x9d80('0x37')][_0x9d80('0x32')]({'where':{'id':_0x325e37['params']['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x37727e,null))['then'](function(_0x270301){if(_0x270301){return _0x270301[_0x9d80('0x93')](_0x325e37[_0x9d80('0x3b')][_0x9d80('0x83')])['then'](function(){if(_[_0x9d80('0x99')](_0x325e37[_0x9d80('0x3b')]['ids'])){for(var _0x31a172=0x0;_0x31a172<_0x325e37[_0x9d80('0x3b')][_0x9d80('0x83')][_0x9d80('0x5b')];_0x31a172+=0x1){socket[_0x9d80('0x94')](_0x9d80('0x9a'),{'UserId':Number(_0x325e37['query'][_0x9d80('0x83')][_0x31a172]),'VoiceQueueId':Number(_0x325e37[_0x9d80('0x4f')]['id'])});}}else{socket[_0x9d80('0x94')](_0x9d80('0x9a'),{'UserId':Number(_0x325e37['query'][_0x9d80('0x83')]),'VoiceQueueId':Number(_0x325e37[_0x9d80('0x4f')]['id'])});}});}})[_0x9d80('0x2d')](function(_0x5500c1){return db['UserVoiceQueueRt'][_0x9d80('0x2c')]({'where':{'VoiceQueueId':_0x325e37[_0x9d80('0x4f')]['id'],'UserId':_0x325e37[_0x9d80('0x3b')]['ids']}})[_0x9d80('0x2d')](function(){return _0x5500c1;});})[_0x9d80('0x2d')](respondWithStatusCode(_0x37727e,null))[_0x9d80('0x4e')](handleError(_0x37727e,null));};exports[_0x9d80('0x9b')]=function(_0x2e640f,_0x1521fb,_0x540069){var _0x4d70cf={};var _0x2f25ff={};var _0x5d58a5;var _0xaa3a4d;return db[_0x9d80('0x37')][_0x9d80('0x66')]({'where':{'id':_0x2e640f[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x1521fb,null))[_0x9d80('0x2d')](function(_0x2adc2b){if(_0x2adc2b){_0x5d58a5=_0x2adc2b;_0x2f25ff[_0x9d80('0x3a')]=_[_0x9d80('0x3c')](db[_0x9d80('0x71')]['rawAttributes']);_0x2f25ff[_0x9d80('0x3b')]=_[_0x9d80('0x3c')](_0x2e640f['query']);_0x2f25ff[_0x9d80('0x45')]=_[_0x9d80('0x3d')](_0x2f25ff[_0x9d80('0x3a')],_0x2f25ff[_0x9d80('0x3b')]);_0x4d70cf['attributes']=_[_0x9d80('0x3d')](_0x2f25ff[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x2e640f[_0x9d80('0x3b')][_0x9d80('0x3f')]));_0x4d70cf[_0x9d80('0x3e')]=_0x4d70cf[_0x9d80('0x3e')][_0x9d80('0x5b')]?_0x4d70cf[_0x9d80('0x3e')]:_0x2f25ff[_0x9d80('0x3a')];_0x4d70cf[_0x9d80('0x42')]=qs[_0x9d80('0x43')](_0x2e640f[_0x9d80('0x3b')][_0x9d80('0x43')]);_0x4d70cf[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_['pick'](_0x2e640f['query'],_0x2f25ff[_0x9d80('0x45')]));if(_0x2e640f[_0x9d80('0x3b')][_0x9d80('0x48')]){_0x4d70cf[_0x9d80('0x44')]=_[_0x9d80('0x49')](_0x4d70cf['where'],{'$or':_[_0x9d80('0x31')](_0x4d70cf['attributes'],function(_0x1da5f8){var _0x460ca2={};_0x460ca2[_0x1da5f8]={'$like':'%'+_0x2e640f[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x460ca2;})});}_0x4d70cf=_[_0x9d80('0x49')]({},_0x4d70cf,_0x2e640f[_0x9d80('0x4a')]);return _0x5d58a5[_0x9d80('0x9b')](_0x4d70cf);}})[_0x9d80('0x2d')](function(_0x1b7bc8){if(_0x1b7bc8){_0xaa3a4d=_0x1b7bc8[_0x9d80('0x5b')];if(!_0x2e640f['query'][_0x9d80('0x40')](_0x9d80('0x41'))){_0x4d70cf[_0x9d80('0x26')]=qs[_0x9d80('0x26')](_0x2e640f[_0x9d80('0x3b')][_0x9d80('0x26')]);_0x4d70cf[_0x9d80('0x23')]=qs[_0x9d80('0x23')](_0x2e640f[_0x9d80('0x3b')]['offset']);}return _0x5d58a5[_0x9d80('0x9b')](_0x4d70cf);}})[_0x9d80('0x2d')](function(_0xf3e6bd){if(_0xf3e6bd){return _0xf3e6bd?{'count':_0xaa3a4d,'rows':_0xf3e6bd}:null;}})[_0x9d80('0x2d')](respondWithResult(_0x1521fb,null))[_0x9d80('0x4e')](handleError(_0x1521fb,null));};exports[_0x9d80('0x9c')]=function(_0x5c26c5,_0x1b1042,_0x10b2f9){var _0x4f56f9={};var _0x34f804={};var _0x21d7bc;var _0x150fda;return db[_0x9d80('0x37')][_0x9d80('0x66')]({'where':{'id':_0x5c26c5[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x1b1042,null))[_0x9d80('0x2d')](function(_0x32e872){if(_0x32e872){_0x21d7bc=_0x32e872;_0x34f804[_0x9d80('0x3a')]=_[_0x9d80('0x3c')](db[_0x9d80('0x7f')]['rawAttributes']);_0x34f804['query']=_[_0x9d80('0x3c')](_0x5c26c5[_0x9d80('0x3b')]);_0x34f804[_0x9d80('0x45')]=_['intersection'](_0x34f804[_0x9d80('0x3a')],_0x34f804['query']);_0x4f56f9['attributes']=_['intersection'](_0x34f804[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x5c26c5[_0x9d80('0x3b')]['fields']));_0x4f56f9[_0x9d80('0x3e')]=_0x4f56f9[_0x9d80('0x3e')][_0x9d80('0x5b')]?_0x4f56f9[_0x9d80('0x3e')]:_0x34f804[_0x9d80('0x3a')];_0x4f56f9[_0x9d80('0x42')]=qs['sort'](_0x5c26c5[_0x9d80('0x3b')][_0x9d80('0x43')]);_0x4f56f9[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_['pick'](_0x5c26c5[_0x9d80('0x3b')],_0x34f804[_0x9d80('0x45')]));if(_0x5c26c5[_0x9d80('0x3b')][_0x9d80('0x48')]){_0x4f56f9[_0x9d80('0x44')]=_[_0x9d80('0x49')](_0x4f56f9[_0x9d80('0x44')],{'$or':_[_0x9d80('0x31')](_0x4f56f9[_0x9d80('0x3e')],function(_0x18c0f7){var _0x317e2d={};_0x317e2d[_0x18c0f7]={'$like':'%'+_0x5c26c5[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x317e2d;})});}_0x4f56f9=_[_0x9d80('0x49')]({},_0x4f56f9,_0x5c26c5[_0x9d80('0x4a')]);return _0x21d7bc['getMembers'](_0x4f56f9);}})[_0x9d80('0x2d')](function(_0x41892b){if(_0x41892b){_0x150fda=_0x41892b[_0x9d80('0x5b')];if(!_0x5c26c5[_0x9d80('0x3b')][_0x9d80('0x40')](_0x9d80('0x41'))){_0x4f56f9[_0x9d80('0x26')]=qs[_0x9d80('0x26')](_0x5c26c5[_0x9d80('0x3b')][_0x9d80('0x26')]);_0x4f56f9[_0x9d80('0x23')]=qs[_0x9d80('0x23')](_0x5c26c5[_0x9d80('0x3b')][_0x9d80('0x23')]);}return _0x21d7bc[_0x9d80('0x9c')](_0x4f56f9);}})[_0x9d80('0x2d')](function(_0x104246){return _0x104246?{'count':_0x150fda,'rows':_0x104246}:null;})[_0x9d80('0x2d')](respondWithResult(_0x1b1042,null))[_0x9d80('0x4e')](handleError(_0x1b1042,null));};exports[_0x9d80('0x9d')]=function(_0x5b01d1,_0x7614de,_0x96356e){var _0x289fa6={};var _0x76c6a7={};var _0x1ab453;var _0x4f5a97;return db[_0x9d80('0x37')][_0x9d80('0x66')]({'where':{'id':_0x5b01d1[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x7614de,null))[_0x9d80('0x2d')](function(_0x32a151){if(_0x32a151){_0x1ab453=_0x32a151;_0x76c6a7[_0x9d80('0x3a')]=_[_0x9d80('0x3c')](db[_0x9d80('0x9e')][_0x9d80('0x50')]);_0x76c6a7['query']=_[_0x9d80('0x3c')](_0x5b01d1[_0x9d80('0x3b')]);_0x76c6a7['filters']=_['intersection'](_0x76c6a7['model'],_0x76c6a7[_0x9d80('0x3b')]);_0x289fa6[_0x9d80('0x3e')]=_['intersection'](_0x76c6a7[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x5b01d1[_0x9d80('0x3b')]['fields']));_0x289fa6['attributes']=_0x289fa6[_0x9d80('0x3e')][_0x9d80('0x5b')]?_0x289fa6[_0x9d80('0x3e')]:_0x76c6a7['model'];_0x289fa6[_0x9d80('0x42')]=qs[_0x9d80('0x43')](_0x5b01d1[_0x9d80('0x3b')][_0x9d80('0x43')]);_0x289fa6[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_[_0x9d80('0x46')](_0x5b01d1['query'],_0x76c6a7[_0x9d80('0x45')]));if(_0x5b01d1[_0x9d80('0x3b')][_0x9d80('0x48')]){_0x289fa6['where']=_[_0x9d80('0x49')](_0x289fa6['where'],{'$or':_['map'](_0x289fa6['attributes'],function(_0x58ac7d){var _0x50b379={};_0x50b379[_0x58ac7d]={'$like':'%'+_0x5b01d1[_0x9d80('0x3b')][_0x9d80('0x48')]+'%'};return _0x50b379;})});}_0x289fa6=_['merge']({},_0x289fa6,_0x5b01d1['options']);return _0x1ab453[_0x9d80('0x9d')](_0x289fa6);}})[_0x9d80('0x2d')](function(_0xfe5b64){if(_0xfe5b64){_0x4f5a97=_0xfe5b64['length'];if(!_0x5b01d1[_0x9d80('0x3b')]['hasOwnProperty']('nolimit')){_0x289fa6['limit']=qs[_0x9d80('0x26')](_0x5b01d1['query'][_0x9d80('0x26')]);_0x289fa6[_0x9d80('0x23')]=qs[_0x9d80('0x23')](_0x5b01d1[_0x9d80('0x3b')][_0x9d80('0x23')]);}return _0x1ab453[_0x9d80('0x9d')](_0x289fa6);}})['then'](function(_0x3da3b4){if(_0x3da3b4){return _0x3da3b4?{'count':_0x4f5a97,'rows':_0x3da3b4}:null;}})[_0x9d80('0x2d')](respondWithResult(_0x7614de,null))[_0x9d80('0x4e')](handleError(_0x7614de,null));};exports[_0x9d80('0x9f')]=function(_0x573e1a,_0x5ee336,_0x983bd5){var _0x13e09b,_0x4ec024;return db[_0x9d80('0x37')][_0x9d80('0x32')]({'where':{'id':_0x573e1a[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x5ee336,null))[_0x9d80('0x2d')](function(_0x5c8bf5){if(_0x5c8bf5){_0x4ec024=_0x5c8bf5;return _0x5c8bf5[_0x9d80('0x9f')](_0x573e1a[_0x9d80('0x52')][_0x9d80('0x83')],_[_0x9d80('0x5d')](_0x573e1a[_0x9d80('0x52')],[_0x9d80('0x83'),'id'])||{});}return null;})[_0x9d80('0x96')](function(_0x23491f){var _0x50264b;_0x13e09b=_0x23491f||[];var _0xc66d9f=[];if(_0x23491f){for(var _0x45228e=0x0;_0x45228e<_0x23491f[_0x9d80('0x5b')];_0x45228e+=0x1){var _0x6f93fe=_0x23491f[_0x45228e][_0x9d80('0x2e')]({'plain':!![]});_0x4ec024[_0x9d80('0xa0')]=_0x573e1a[_0x9d80('0x52')][_0x9d80('0xa0')]?_0x573e1a['body'][_0x9d80('0xa0')]:_0x4ec024['dialCheckDuplicateType'];switch(_0x4ec024[_0x9d80('0xa0')]){case'always':_0x50264b=squel[_0x9d80('0xa1')]()[_0x9d80('0xa2')](_0x9d80('0xa3'))[_0x9d80('0xa4')]([_0x9d80('0xa5'),_0x9d80('0xa6'),_0x9d80('0xa7'),'ListId','VoiceQueueId',_0x9d80('0x5e'),'updatedAt'],squel[_0x9d80('0x84')]()[_0x9d80('0x85')](_0x9d80('0xa5'),'phone')['field'](_0x9d80('0xa8'),'scheduledAt')[_0x9d80('0x85')]('id',_0x9d80('0xa7'))[_0x9d80('0x85')](_0x6f93fe[_0x9d80('0xa9')]['toString'](),_0x9d80('0xaa'))[_0x9d80('0x85')](_0x573e1a[_0x9d80('0x4f')]['id'][_0x9d80('0x8b')](),'VoiceQueueId')[_0x9d80('0x85')](_0x9d80('0xa8'),_0x9d80('0x5e'))['field']('NOW()',_0x9d80('0x5f'))['from'](_0x9d80('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0x9d80('0x44')](_0x9d80('0xac'),_0x6f93fe[_0x9d80('0xa9')]['toString']())[_0x9d80('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x9d80('0x44')](_0x9d80('0xad'),squel[_0x9d80('0x84')]()['field'](_0x9d80('0xae'))[_0x9d80('0xaf')](_0x9d80('0xb0'))['where'](_0x9d80('0x88'),_0x573e1a[_0x9d80('0x4f')]['id'][_0x9d80('0x8b')]()))['where'](_0x9d80('0xad'),squel[_0x9d80('0x84')]()[_0x9d80('0x85')]('COALESCE(phone,\x27\x27)')[_0x9d80('0xaf')](_0x9d80('0xa3'))[_0x9d80('0x44')](_0x9d80('0x88'),_0x573e1a[_0x9d80('0x4f')]['id'][_0x9d80('0x8b')]())))[_0x9d80('0x8b')]();break;case'onlyIfOpen':_0x50264b=squel[_0x9d80('0xa1')]()[_0x9d80('0xa2')](_0x9d80('0xa3'))[_0x9d80('0xa4')]([_0x9d80('0xa5'),'scheduledAt','ContactId',_0x9d80('0xaa'),_0x9d80('0x68'),_0x9d80('0x5e'),_0x9d80('0x5f')],squel[_0x9d80('0x84')]()[_0x9d80('0x85')](_0x9d80('0xa5'),_0x9d80('0xa5'))['field'](_0x9d80('0xa8'),_0x9d80('0xa6'))[_0x9d80('0x85')]('id','ContactId')[_0x9d80('0x85')](_0x6f93fe['CmListId']['toString'](),_0x9d80('0xaa'))[_0x9d80('0x85')](_0x573e1a['params']['id'][_0x9d80('0x8b')](),_0x9d80('0x68'))[_0x9d80('0x85')]('NOW()',_0x9d80('0x5e'))[_0x9d80('0x85')]('NOW()',_0x9d80('0x5f'))[_0x9d80('0xaf')](_0x9d80('0xab'))[_0x9d80('0x44')](_0x9d80('0xb1'))['where'](_0x9d80('0xac'),_0x6f93fe['CmListId'][_0x9d80('0x8b')]())[_0x9d80('0x44')](_0x9d80('0xb2'))[_0x9d80('0x44')](_0x9d80('0xad'),squel[_0x9d80('0x84')]()[_0x9d80('0x85')]('COALESCE(phone,\x27\x27)')[_0x9d80('0xaf')](_0x9d80('0xa3'))[_0x9d80('0x44')]('VoiceQueueId\x20=\x20?',_0x573e1a[_0x9d80('0x4f')]['id'][_0x9d80('0x8b')]())))['toString']();break;default:_0x50264b=squel[_0x9d80('0xa1')]()[_0x9d80('0xa2')](_0x9d80('0xa3'))[_0x9d80('0xa4')]([_0x9d80('0xa5'),_0x9d80('0xa6'),'ContactId',_0x9d80('0xaa'),_0x9d80('0x68'),_0x9d80('0x5e'),_0x9d80('0x5f')],squel[_0x9d80('0x84')]()[_0x9d80('0x85')]('phone','phone')[_0x9d80('0x85')]('NOW()',_0x9d80('0xa6'))[_0x9d80('0x85')]('id',_0x9d80('0xa7'))[_0x9d80('0x85')](_0x6f93fe[_0x9d80('0xa9')]['toString'](),_0x9d80('0xaa'))[_0x9d80('0x85')](_0x573e1a['params']['id']['toString'](),_0x9d80('0x68'))[_0x9d80('0x85')](_0x9d80('0xa8'),_0x9d80('0x5e'))[_0x9d80('0x85')](_0x9d80('0xa8'),'updatedAt')['from']('cm_contacts')[_0x9d80('0x44')](_0x9d80('0xb1'))[_0x9d80('0x44')](_0x9d80('0xac'),_0x6f93fe[_0x9d80('0xa9')][_0x9d80('0x8b')]())[_0x9d80('0x44')](_0x9d80('0xb2')))[_0x9d80('0x8b')]();}_0xc66d9f[_0x9d80('0x8a')](db[_0x9d80('0x79')][_0x9d80('0x3b')](_0x50264b));}return BPromise[_0x9d80('0x98')](_0xc66d9f);}})[_0x9d80('0x2d')](function(){return _0x13e09b;})[_0x9d80('0x2d')](respondWithResult(_0x5ee336,null))[_0x9d80('0x4e')](handleError(_0x5ee336,null));};exports[_0x9d80('0xb3')]=function(_0x30efe8,_0x888e33,_0x59aea2){return db[_0x9d80('0x37')]['find']({'where':{'id':_0x30efe8[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x888e33,null))[_0x9d80('0x2d')](function(_0x168276){if(_0x168276){return _0x168276[_0x9d80('0xb3')](_0x30efe8['query'][_0x9d80('0x83')]);}})[_0x9d80('0x2d')](function(_0x4d8d24){if(_0x4d8d24){return db[_0x9d80('0x64')][_0x9d80('0x2c')]({'where':{'ListId':_0x30efe8[_0x9d80('0x3b')]['ids'],'VoiceQueueId':_0x30efe8[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](function(){return _0x4d8d24;});}})[_0x9d80('0x2d')](respondWithStatusCode(_0x888e33,null))[_0x9d80('0x4e')](handleError(_0x888e33,null));};exports[_0x9d80('0xb4')]=function(_0x520523,_0x4eb897,_0x637f09){var _0x44dfdf={};var _0x358fbe={};var _0x16383d;var _0x5827e4;return db[_0x9d80('0x37')]['findOne']({'where':{'id':_0x520523[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x4eb897,null))[_0x9d80('0x2d')](function(_0x32dfdd){if(_0x32dfdd){_0x16383d=_0x32dfdd;_0x358fbe['model']=_[_0x9d80('0x3c')](db[_0x9d80('0x9e')]['rawAttributes']);_0x358fbe['query']=_['keys'](_0x520523[_0x9d80('0x3b')]);_0x358fbe[_0x9d80('0x45')]=_[_0x9d80('0x3d')](_0x358fbe[_0x9d80('0x3a')],_0x358fbe['query']);_0x44dfdf[_0x9d80('0x3e')]=_[_0x9d80('0x3d')](_0x358fbe[_0x9d80('0x3a')],qs[_0x9d80('0x3f')](_0x520523[_0x9d80('0x3b')][_0x9d80('0x3f')]));_0x44dfdf[_0x9d80('0x3e')]=_0x44dfdf['attributes'][_0x9d80('0x5b')]?_0x44dfdf[_0x9d80('0x3e')]:_0x358fbe['model'];_0x44dfdf[_0x9d80('0x42')]=qs[_0x9d80('0x43')](_0x520523[_0x9d80('0x3b')][_0x9d80('0x43')]);_0x44dfdf[_0x9d80('0x44')]=qs[_0x9d80('0x45')](_[_0x9d80('0x46')](_0x520523['query'],_0x358fbe[_0x9d80('0x45')]));if(_0x520523['query'][_0x9d80('0x48')]){_0x44dfdf[_0x9d80('0x44')]=_[_0x9d80('0x49')](_0x44dfdf['where'],{'$or':_[_0x9d80('0x31')](_0x44dfdf[_0x9d80('0x3e')],function(_0x52a184){var _0x4058c9={};_0x4058c9[_0x52a184]={'$like':'%'+_0x520523['query'][_0x9d80('0x48')]+'%'};return _0x4058c9;})});}_0x44dfdf=_[_0x9d80('0x49')]({},_0x44dfdf,_0x520523[_0x9d80('0x4a')]);return _0x16383d[_0x9d80('0xb4')](_0x44dfdf);}})[_0x9d80('0x2d')](function(_0x4dcc81){if(_0x4dcc81){_0x5827e4=_0x4dcc81['length'];if(!_0x520523['query']['hasOwnProperty'](_0x9d80('0x41'))){_0x44dfdf[_0x9d80('0x26')]=qs['limit'](_0x520523[_0x9d80('0x3b')][_0x9d80('0x26')]);_0x44dfdf[_0x9d80('0x23')]=qs['offset'](_0x520523['query']['offset']);}return _0x16383d['getBlackLists'](_0x44dfdf);}})[_0x9d80('0x2d')](function(_0x329f3d){if(_0x329f3d){return _0x329f3d?{'count':_0x5827e4,'rows':_0x329f3d}:null;}})[_0x9d80('0x2d')](respondWithResult(_0x4eb897,null))['catch'](handleError(_0x4eb897,null));};exports[_0x9d80('0xb5')]=function(_0x49b049,_0x2a355f,_0xd9ab71){var _0xc30936,_0x543585;return db[_0x9d80('0x37')][_0x9d80('0x32')]({'where':{'id':_0x49b049[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x2a355f,null))['then'](function(_0x9b741f){if(_0x9b741f){_0x543585=_0x9b741f;return _0x9b741f['addBlackLists'](_0x49b049[_0x9d80('0x52')][_0x9d80('0x83')],_[_0x9d80('0x5d')](_0x49b049[_0x9d80('0x52')],['ids','id'])||{});}return null;})[_0x9d80('0x96')](function(_0xc2dd18){var _0x25b84f;_0xc30936=_0xc2dd18||[];var _0x5209f2=[];if(_0xc2dd18){for(var _0x401605=0x0;_0x401605<_0xc2dd18[_0x9d80('0x5b')];_0x401605+=0x1){var _0x106cc5=_0xc2dd18[_0x401605]['get']({'plain':!![]});_0x25b84f=squel[_0x9d80('0xa1')]()[_0x9d80('0xa2')](_0x9d80('0xb6'))[_0x9d80('0xa4')](['phone','ContactId',_0x9d80('0xaa'),'VoiceQueueId',_0x9d80('0x5e'),'updatedAt'],squel[_0x9d80('0x84')]()[_0x9d80('0x85')](_0x9d80('0xa5'),_0x9d80('0xa5'))[_0x9d80('0x85')]('id',_0x9d80('0xa7'))[_0x9d80('0x85')](_0x106cc5[_0x9d80('0xa9')][_0x9d80('0x8b')](),_0x9d80('0xaa'))[_0x9d80('0x85')](_0x49b049[_0x9d80('0x4f')]['id']['toString'](),_0x9d80('0x68'))[_0x9d80('0x85')]('NOW()',_0x9d80('0x5e'))[_0x9d80('0x85')](_0x9d80('0xa8'),_0x9d80('0x5f'))[_0x9d80('0xaf')](_0x9d80('0xab'))[_0x9d80('0x44')](_0x9d80('0xb1'))[_0x9d80('0x44')]('ListId\x20=\x20?',_0x106cc5[_0x9d80('0xa9')][_0x9d80('0x8b')]())[_0x9d80('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x9d80('0x8b')]();_0x5209f2[_0x9d80('0x8a')](db[_0x9d80('0x79')]['query'](_0x25b84f));}return BPromise[_0x9d80('0x98')](_0x5209f2);}})[_0x9d80('0x2d')](function(){return _0xc30936;})[_0x9d80('0x2d')](respondWithResult(_0x2a355f,null))[_0x9d80('0x4e')](handleError(_0x2a355f,null));};exports[_0x9d80('0xb7')]=function(_0x52fddc,_0x4a18b4,_0x479ae0){return db[_0x9d80('0x37')]['find']({'where':{'id':_0x52fddc[_0x9d80('0x4f')]['id']}})[_0x9d80('0x2d')](handleEntityNotFound(_0x4a18b4,null))['then'](function(_0x3b00b7){if(_0x3b00b7){return _0x3b00b7[_0x9d80('0xb7')](_0x52fddc[_0x9d80('0x3b')][_0x9d80('0x83')]);}})[_0x9d80('0x2d')](function(_0x59975a){if(_0x59975a){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x52fddc[_0x9d80('0x3b')][_0x9d80('0x83')],'VoiceQueueId':_0x52fddc[_0x9d80('0x4f')]['id']}})['then'](function(){return _0x59975a;});}})[_0x9d80('0x2d')](respondWithStatusCode(_0x4a18b4,null))[_0x9d80('0x4e')](handleError(_0x4a18b4,null));}; \ No newline at end of file +var _0xb1b6=['CmHopper','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','cm_contacts','removeLists','getBlackLists','addBlackLists','removeBlackLists','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','VoiceQueues','outbound','ignore','map','value','type','find','name','UserProfileResource','destroy','stack','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','include','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','QueueCampaigns','update','params','getHoppers','findOne'];(function(_0xffe020,_0x29b465){var _0x1ee35a=function(_0xf9581d){while(--_0xf9581d){_0xffe020['push'](_0xffe020['shift']());}};_0x1ee35a(++_0x29b465);}(_0xb1b6,0x111));var _0x6b1b=function(_0x1dbdc2,_0x190d3c){_0x1dbdc2=_0x1dbdc2-0x0;var _0xc320d3=_0xb1b6[_0x1dbdc2];return _0xc320d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b1b('0x0'));var jsonpatch=require(_0x6b1b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b1b('0x2'));var Mustache=require('mustache');var util=require(_0x6b1b('0x3'));var path=require(_0x6b1b('0x4'));var sox=require(_0x6b1b('0x5'));var csv=require('to-csv');var ejs=require(_0x6b1b('0x6'));var fs=require('fs');var fs_extra=require(_0x6b1b('0x7'));var _=require('lodash');var squel=require(_0x6b1b('0x8'));var crypto=require(_0x6b1b('0x9'));var jsforce=require(_0x6b1b('0xa'));var deskjs=require(_0x6b1b('0xb'));var toCsv=require(_0x6b1b('0xc'));var querystring=require(_0x6b1b('0xd'));var Papa=require(_0x6b1b('0xe'));var Redis=require(_0x6b1b('0xf'));var authService=require(_0x6b1b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6b1b('0x11'));var hardwareService=require(_0x6b1b('0x12'));var logger=require(_0x6b1b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6b1b('0x14'));var licenseUtil=require(_0x6b1b('0x15'));var db=require(_0x6b1b('0x16'))['db'];config['redis']=_[_0x6b1b('0x17')](config[_0x6b1b('0x18')],{'host':_0x6b1b('0x19'),'port':0x18eb});var socket=require(_0x6b1b('0x1a'))(new Redis(config[_0x6b1b('0x18')]));require(_0x6b1b('0x1b'))[_0x6b1b('0x1c')](socket);function respondWithStatusCode(_0x509bc7,_0x63b4c1){_0x63b4c1=_0x63b4c1||0xcc;return function(_0x5f2213){if(_0x5f2213){return _0x509bc7[_0x6b1b('0x1d')](_0x63b4c1);}return _0x509bc7['status'](_0x63b4c1)[_0x6b1b('0x1e')]();};}function respondWithResult(_0x49a9fe,_0x36b547){_0x36b547=_0x36b547||0xc8;return function(_0x2f8df0){if(_0x2f8df0){return _0x49a9fe['status'](_0x36b547)[_0x6b1b('0x1f')](_0x2f8df0);}};}function respondWithFilteredResult(_0x53d11c,_0x47f92f){return function(_0x129985){if(_0x129985){var _0x9d8c06=typeof _0x47f92f[_0x6b1b('0x20')]===_0x6b1b('0x21')&&typeof _0x47f92f[_0x6b1b('0x22')]===_0x6b1b('0x21');var _0x558f41=_0x129985[_0x6b1b('0x23')];var _0xde1d5=_0x9d8c06?0x0:_0x47f92f[_0x6b1b('0x20')];var _0x13d399=_0x9d8c06?_0x129985[_0x6b1b('0x23')]:_0x47f92f[_0x6b1b('0x20')]+_0x47f92f[_0x6b1b('0x22')];var _0x8ad481;if(_0x13d399>=_0x558f41){_0x13d399=_0x558f41;_0x8ad481=0xc8;}else{_0x8ad481=0xce;}_0x53d11c[_0x6b1b('0x24')](_0x8ad481);return _0x53d11c[_0x6b1b('0x25')](_0x6b1b('0x26'),_0xde1d5+'-'+_0x13d399+'/'+_0x558f41)[_0x6b1b('0x1f')](_0x129985);}return null;};}function patchUpdates(_0x45eee7){return function(_0x25c0c2){try{jsonpatch[_0x6b1b('0x27')](_0x25c0c2,_0x45eee7,!![]);}catch(_0x2c27d3){return BPromise[_0x6b1b('0x28')](_0x2c27d3);}return _0x25c0c2['save']();};}function saveUpdates(_0x2e27df,_0x443950){return function(_0x4330b2){if(_0x4330b2){return _0x4330b2['update'](_0x2e27df)[_0x6b1b('0x29')](function(_0x2f4e33){return _0x2f4e33;});}return null;};}function removeEntity(_0x1140a1,_0x3bbb1d){return function(_0x19e202){if(_0x19e202){return _0x19e202['destroy']()['then'](function(){var _0x452869=_0x19e202['get']({'plain':!![]});var _0x205e6d=[{'name':_0x6b1b('0x2a'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x6b1b('0x2b'),'ignore':![]}];var _0x55022a=_(_0x205e6d)['filter'](_0x6b1b('0x2c'))[_0x6b1b('0x2d')](_0x6b1b('0x2e'))[_0x6b1b('0x2e')]();if(_['includes'](_0x55022a,_0x452869[_0x6b1b('0x2f')])){return;}var _0x1f9ac0=_[_0x6b1b('0x30')](_0x205e6d,[_0x6b1b('0x2e'),_0x452869['type']])[_0x6b1b('0x31')];return db[_0x6b1b('0x32')][_0x6b1b('0x33')]({'where':{'type':_0x1f9ac0,'resourceId':_0x452869['id']}})[_0x6b1b('0x29')](function(){return _0x19e202;});})['then'](function(){_0x1140a1[_0x6b1b('0x24')](0xcc)[_0x6b1b('0x1e')]();});}};}function handleEntityNotFound(_0x280a3b,_0x1aecfe){return function(_0x2f4a72){if(!_0x2f4a72){_0x280a3b[_0x6b1b('0x1d')](0x194);}return _0x2f4a72;};}function handleError(_0x262fa3,_0x19fd89){_0x19fd89=_0x19fd89||0x1f4;return function(_0x1ea915){logger['error'](_0x1ea915[_0x6b1b('0x34')]);if(_0x1ea915[_0x6b1b('0x31')]){delete _0x1ea915['name'];}_0x262fa3[_0x6b1b('0x24')](_0x19fd89)['send'](_0x1ea915);};}exports[_0x6b1b('0x35')]=function(_0x26ca10,_0x35d8c5){var _0x1fab79={},_0x19cc57={},_0x59816d={'count':0x0,'rows':[]};var _0x1226c6=_[_0x6b1b('0x2d')](db[_0x6b1b('0x36')][_0x6b1b('0x37')],function(_0x3e04e5){return{'name':_0x3e04e5[_0x6b1b('0x38')],'type':_0x3e04e5[_0x6b1b('0x2f')][_0x6b1b('0x39')]};});_0x19cc57[_0x6b1b('0x3a')]=_[_0x6b1b('0x2d')](_0x1226c6,_0x6b1b('0x31'));_0x19cc57['query']=_[_0x6b1b('0x3b')](_0x26ca10[_0x6b1b('0x3c')]);_0x19cc57[_0x6b1b('0x3d')]=_[_0x6b1b('0x3e')](_0x19cc57[_0x6b1b('0x3a')],_0x19cc57['query']);_0x1fab79[_0x6b1b('0x3f')]=_[_0x6b1b('0x3e')](_0x19cc57[_0x6b1b('0x3a')],qs[_0x6b1b('0x40')](_0x26ca10[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0x1fab79['attributes']=_0x1fab79[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x1fab79['attributes']:_0x19cc57[_0x6b1b('0x3a')];if(!_0x26ca10['query'][_0x6b1b('0x42')](_0x6b1b('0x43'))){_0x1fab79['limit']=qs[_0x6b1b('0x22')](_0x26ca10[_0x6b1b('0x3c')][_0x6b1b('0x22')]);_0x1fab79[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x26ca10[_0x6b1b('0x3c')][_0x6b1b('0x20')]);}_0x1fab79[_0x6b1b('0x44')]=qs[_0x6b1b('0x45')](_0x26ca10['query'][_0x6b1b('0x45')]);_0x1fab79[_0x6b1b('0x46')]=qs['filters'](_[_0x6b1b('0x47')](_0x26ca10[_0x6b1b('0x3c')],_0x19cc57[_0x6b1b('0x3d')]),_0x1226c6);if(_0x26ca10['query'][_0x6b1b('0x48')]){_0x1fab79[_0x6b1b('0x46')]=_[_0x6b1b('0x49')](_0x1fab79[_0x6b1b('0x46')],{'$or':_['map'](_0x1226c6,function(_0x1db786){if(_0x1db786['type']!==_0x6b1b('0x4a')){var _0x102df3={};_0x102df3[_0x1db786['name']]={'$like':'%'+_0x26ca10[_0x6b1b('0x3c')][_0x6b1b('0x48')]+'%'};return _0x102df3;}})});}_0x1fab79=_[_0x6b1b('0x49')]({},_0x1fab79,_0x26ca10['options']);var _0x33cfb9={'where':_0x1fab79[_0x6b1b('0x46')]};return db[_0x6b1b('0x36')]['count'](_0x33cfb9)['then'](function(_0x591dc4){_0x59816d[_0x6b1b('0x23')]=_0x591dc4;if(_0x26ca10[_0x6b1b('0x3c')][_0x6b1b('0x4b')]){_0x1fab79['include']=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x1fab79);})[_0x6b1b('0x29')](function(_0x20ea9a){_0x59816d[_0x6b1b('0x4c')]=_0x20ea9a;return _0x59816d;})[_0x6b1b('0x29')](respondWithFilteredResult(_0x35d8c5,_0x1fab79))[_0x6b1b('0x4d')](handleError(_0x35d8c5,null));};exports['show']=function(_0x42a8d2,_0x77ca02){var _0x67bf6d={'raw':![],'where':{'id':_0x42a8d2['params']['id']}},_0x56c235={};_0x56c235[_0x6b1b('0x3a')]=_['keys'](db['VoiceQueue'][_0x6b1b('0x37')]);_0x56c235[_0x6b1b('0x3c')]=_['keys'](_0x42a8d2[_0x6b1b('0x3c')]);_0x56c235[_0x6b1b('0x3d')]=_[_0x6b1b('0x3e')](_0x56c235[_0x6b1b('0x3a')],_0x56c235[_0x6b1b('0x3c')]);_0x67bf6d[_0x6b1b('0x3f')]=_['intersection'](_0x56c235[_0x6b1b('0x3a')],qs[_0x6b1b('0x40')](_0x42a8d2[_0x6b1b('0x3c')]['fields']));_0x67bf6d[_0x6b1b('0x3f')]=_0x67bf6d[_0x6b1b('0x3f')]['length']?_0x67bf6d['attributes']:_0x56c235[_0x6b1b('0x3a')];if(_0x42a8d2[_0x6b1b('0x3c')][_0x6b1b('0x4b')]){_0x67bf6d[_0x6b1b('0x4e')]=[{'all':!![]}];}_0x67bf6d=_[_0x6b1b('0x49')]({},_0x67bf6d,_0x42a8d2[_0x6b1b('0x4f')]);return db[_0x6b1b('0x36')][_0x6b1b('0x30')](_0x67bf6d)[_0x6b1b('0x29')](handleEntityNotFound(_0x77ca02,null))['then'](respondWithResult(_0x77ca02,null))['catch'](handleError(_0x77ca02,null));};exports[_0x6b1b('0x50')]=function(_0x24912c,_0x482649){return db['VoiceQueue'][_0x6b1b('0x50')](_0x24912c['body'],{})[_0x6b1b('0x29')](function(_0x5de133){var _0x4b733d=_0x24912c[_0x6b1b('0x51')][_0x6b1b('0x52')]({'plain':!![]});if(!_0x4b733d)throw new Error(_0x6b1b('0x53'));if(_0x4b733d[_0x6b1b('0x54')]===_0x6b1b('0x51')){var _0x54e7e7=_0x5de133[_0x6b1b('0x52')]({'plain':!![]});var _0x198c6b=[{'name':_0x6b1b('0x2a'),'value':_0x6b1b('0x55')},{'name':'QueueCampaigns','value':_0x6b1b('0x2b')}];var _0x240185=_[_0x6b1b('0x30')](_0x198c6b,[_0x6b1b('0x2e'),_0x54e7e7[_0x6b1b('0x2f')]])[_0x6b1b('0x31')];return db[_0x6b1b('0x56')][_0x6b1b('0x30')]({'where':{'name':_0x240185,'userProfileId':_0x4b733d[_0x6b1b('0x57')]},'raw':!![]})[_0x6b1b('0x29')](function(_0x544be1){if(_0x544be1&&_0x544be1[_0x6b1b('0x58')]===0x0){return db[_0x6b1b('0x32')][_0x6b1b('0x50')]({'name':_0x54e7e7[_0x6b1b('0x31')],'resourceId':_0x54e7e7['id'],'type':_0x544be1[_0x6b1b('0x31')],'sectionId':_0x544be1['id']},{})[_0x6b1b('0x29')](function(){return _0x5de133;});}else{return _0x5de133;}})[_0x6b1b('0x4d')](function(_0x746d8e){logger[_0x6b1b('0x59')](_0x6b1b('0x5a'),_0x746d8e);throw _0x746d8e;});}return _0x5de133;})[_0x6b1b('0x29')](respondWithResult(_0x482649,0xc9))[_0x6b1b('0x4d')](handleError(_0x482649,null));};exports[_0x6b1b('0x5b')]=function(_0x14dce5,_0xf70784){var _0x3e9df3={'where':{'id':_0x14dce5['params']['id']}},_0x5d561c={};_0x5d561c[_0x6b1b('0x3a')]=_[_0x6b1b('0x3b')](db[_0x6b1b('0x36')][_0x6b1b('0x37')]);_0x3e9df3[_0x6b1b('0x3f')]=_['intersection'](_0x5d561c['model'],qs[_0x6b1b('0x40')](_0x14dce5[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0x3e9df3[_0x6b1b('0x3f')]=_0x3e9df3['attributes'][_0x6b1b('0x41')]?_0x3e9df3[_0x6b1b('0x3f')]:_0x5d561c[_0x6b1b('0x3a')];if(_0x14dce5['query'][_0x6b1b('0x4b')]){_0x3e9df3[_0x6b1b('0x4e')]=[{'all':!![]}];}_0x3e9df3=_['merge']({},_0x3e9df3,_0x14dce5[_0x6b1b('0x4f')]);return db[_0x6b1b('0x36')]['find'](_0x3e9df3)[_0x6b1b('0x29')](handleEntityNotFound(_0xf70784,null))[_0x6b1b('0x29')](function(_0x53b971){if(_0x53b971){var _0x3594ee=_0x53b971['get']({'plain':!![]});_0x3594ee=qs[_0x6b1b('0x5c')](_0x3594ee,['id','createdAt',_0x6b1b('0x5d')]);_0x14dce5['body']=_[_0x6b1b('0x5c')](_0x14dce5[_0x6b1b('0x5e')],['id',_0x6b1b('0x5f'),'updatedAt']);return db[_0x6b1b('0x36')][_0x6b1b('0x50')](_['merge'](_0x3594ee,_0x14dce5[_0x6b1b('0x5e')]),{'include':_0x14dce5['query'][_0x6b1b('0x4b')]?[{'all':!![]}]:undefined})[_0x6b1b('0x29')](function(_0x172cd6){var _0x432e87=_0x14dce5[_0x6b1b('0x51')][_0x6b1b('0x52')]({'plain':!![]});if(!_0x432e87)throw new Error(_0x6b1b('0x53'));if(_0x432e87[_0x6b1b('0x54')]===_0x6b1b('0x51')){var _0x2770a2=_0x172cd6[_0x6b1b('0x52')]({'plain':!![]});var _0x54b94e=[{'name':_0x6b1b('0x2a'),'value':'inbound'},{'name':_0x6b1b('0x60'),'value':'outbound'}];var _0x42a15c=_['find'](_0x54b94e,[_0x6b1b('0x2e'),_0x2770a2[_0x6b1b('0x2f')]])['name'];return db[_0x6b1b('0x56')][_0x6b1b('0x30')]({'where':{'name':_0x42a15c,'userProfileId':_0x432e87[_0x6b1b('0x57')]},'raw':!![]})['then'](function(_0x2b8589){if(_0x2b8589&&_0x2b8589[_0x6b1b('0x58')]===0x0){return db['UserProfileResource'][_0x6b1b('0x50')]({'name':_0x2770a2[_0x6b1b('0x31')],'resourceId':_0x2770a2['id'],'type':_0x2b8589[_0x6b1b('0x31')],'sectionId':_0x2b8589['id']},{})[_0x6b1b('0x29')](function(){return _0x172cd6;});}else{return _0x172cd6;}})[_0x6b1b('0x4d')](function(_0x49784a){logger['error'](_0x6b1b('0x5a'),_0x49784a);throw _0x49784a;});}return _0x172cd6;});}})[_0x6b1b('0x29')](respondWithResult(_0xf70784,0xc9))[_0x6b1b('0x4d')](handleError(_0xf70784,null));};exports[_0x6b1b('0x61')]=function(_0x45653e,_0xed4607){if(_0x45653e[_0x6b1b('0x5e')]['id']){delete _0x45653e[_0x6b1b('0x5e')]['id'];}return db[_0x6b1b('0x36')][_0x6b1b('0x30')]({'where':{'id':_0x45653e[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0xed4607,null))[_0x6b1b('0x29')](saveUpdates(_0x45653e['body'],null))['then'](respondWithResult(_0xed4607,null))['catch'](handleError(_0xed4607,null));};exports[_0x6b1b('0x33')]=function(_0x34edbb,_0x128a82){return db[_0x6b1b('0x36')]['find']({'where':{'id':_0x34edbb['params']['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x128a82,null))['then'](removeEntity(_0x128a82,null))[_0x6b1b('0x4d')](handleError(_0x128a82,null));};exports[_0x6b1b('0x63')]=function(_0x3b39c8,_0x4d7fd6,_0x383be9){var _0x2c74e4={'raw':![],'where':{}};var _0x12374f={};var _0x4c9b45={'count':0x0,'rows':[]};return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x3b39c8[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x4d7fd6,null))['then'](function(_0x3db678){if(_0x3db678){_0x12374f['model']=_[_0x6b1b('0x3b')](db[_0x6b1b('0x65')][_0x6b1b('0x37')]);_0x12374f[_0x6b1b('0x3c')]=_['keys'](_0x3b39c8[_0x6b1b('0x3c')]);_0x12374f[_0x6b1b('0x3d')]=_[_0x6b1b('0x3e')](_0x12374f['model'],_0x12374f['query']);_0x2c74e4[_0x6b1b('0x3f')]=_[_0x6b1b('0x3e')](_0x12374f[_0x6b1b('0x3a')],qs[_0x6b1b('0x40')](_0x3b39c8['query']['fields']));_0x2c74e4['attributes']=_0x2c74e4[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x2c74e4['attributes']:_0x12374f[_0x6b1b('0x3a')];if(!_0x3b39c8[_0x6b1b('0x3c')]['hasOwnProperty'](_0x6b1b('0x43'))){_0x2c74e4[_0x6b1b('0x22')]=qs[_0x6b1b('0x22')](_0x3b39c8[_0x6b1b('0x3c')][_0x6b1b('0x22')]);_0x2c74e4[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x3b39c8[_0x6b1b('0x3c')][_0x6b1b('0x20')]);}_0x2c74e4['order']=qs[_0x6b1b('0x45')](_0x3b39c8[_0x6b1b('0x3c')][_0x6b1b('0x45')]);_0x2c74e4['where']=qs['filters'](_[_0x6b1b('0x47')](_0x3b39c8[_0x6b1b('0x3c')],_0x12374f[_0x6b1b('0x3d')]));_0x2c74e4[_0x6b1b('0x46')][_0x6b1b('0x66')]=_0x3db678['id'];if(_0x3b39c8[_0x6b1b('0x3c')][_0x6b1b('0x48')]){_0x2c74e4[_0x6b1b('0x46')]=_[_0x6b1b('0x49')](_0x2c74e4[_0x6b1b('0x46')],{'$or':_[_0x6b1b('0x2d')](_0x2c74e4[_0x6b1b('0x3f')],function(_0x1c6254){var _0x3694c7={};_0x3694c7[_0x1c6254]={'$like':'%'+_0x3b39c8['query'][_0x6b1b('0x48')]+'%'};return _0x3694c7;})});}_0x2c74e4=_[_0x6b1b('0x49')]({},_0x2c74e4,_0x3b39c8[_0x6b1b('0x4f')]);return db[_0x6b1b('0x65')][_0x6b1b('0x23')]({'where':_0x2c74e4['where']})['then'](function(_0x4c49da){_0x4c9b45[_0x6b1b('0x23')]=_0x4c49da;if(_0x3b39c8[_0x6b1b('0x3c')]['includeAll']){_0x2c74e4[_0x6b1b('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x6b1b('0x67')](_0x2c74e4);})[_0x6b1b('0x29')](function(_0x1567a2){_0x4c9b45['rows']=_0x1567a2;return _0x4c9b45;});}})[_0x6b1b('0x29')](respondWithFilteredResult(_0x4d7fd6,_0x2c74e4))[_0x6b1b('0x4d')](handleError(_0x4d7fd6,null));};exports[_0x6b1b('0x68')]=function(_0x155449,_0x180108,_0x43dab5){var _0x47a0f3={'raw':!![],'where':{}};var _0x1938bb={};var _0x2bc7c7={'count':0x0,'rows':[]};return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x155449[_0x6b1b('0x62')]['id']}})['then'](handleEntityNotFound(_0x180108,null))['then'](function(_0x20096e){if(_0x20096e){_0x1938bb[_0x6b1b('0x3a')]=_[_0x6b1b('0x3b')](db[_0x6b1b('0x69')]['rawAttributes']);_0x1938bb[_0x6b1b('0x3c')]=_['keys'](_0x155449[_0x6b1b('0x3c')]);_0x1938bb['filters']=_['intersection'](_0x1938bb[_0x6b1b('0x3a')],_0x1938bb[_0x6b1b('0x3c')]);_0x47a0f3[_0x6b1b('0x3f')]=_['intersection'](_0x1938bb['model'],qs[_0x6b1b('0x40')](_0x155449[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0x47a0f3[_0x6b1b('0x3f')]=_0x47a0f3[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x47a0f3[_0x6b1b('0x3f')]:_0x1938bb[_0x6b1b('0x3a')];if(!_0x155449[_0x6b1b('0x3c')][_0x6b1b('0x42')](_0x6b1b('0x43'))){_0x47a0f3[_0x6b1b('0x22')]=qs['limit'](_0x155449[_0x6b1b('0x3c')][_0x6b1b('0x22')]);_0x47a0f3['offset']=qs[_0x6b1b('0x20')](_0x155449[_0x6b1b('0x3c')][_0x6b1b('0x20')]);}_0x47a0f3[_0x6b1b('0x44')]=qs[_0x6b1b('0x45')](_0x155449[_0x6b1b('0x3c')][_0x6b1b('0x45')]);_0x47a0f3[_0x6b1b('0x46')]=qs[_0x6b1b('0x3d')](_[_0x6b1b('0x47')](_0x155449[_0x6b1b('0x3c')],_0x1938bb[_0x6b1b('0x3d')]));_0x47a0f3[_0x6b1b('0x46')][_0x6b1b('0x66')]=_0x20096e['id'];if(_0x155449[_0x6b1b('0x3c')][_0x6b1b('0x48')]){_0x47a0f3[_0x6b1b('0x46')]=_[_0x6b1b('0x49')](_0x47a0f3[_0x6b1b('0x46')],{'$or':_['map'](_0x47a0f3[_0x6b1b('0x3f')],function(_0x59282b){var _0x3f192b={};_0x3f192b[_0x59282b]={'$like':'%'+_0x155449[_0x6b1b('0x3c')]['filter']+'%'};return _0x3f192b;})});}_0x47a0f3=_[_0x6b1b('0x49')]({},_0x47a0f3,_0x155449[_0x6b1b('0x4f')]);return db[_0x6b1b('0x69')]['count']({'where':_0x47a0f3[_0x6b1b('0x46')]})['then'](function(_0x35028e){_0x2bc7c7['count']=_0x35028e;if(_0x155449[_0x6b1b('0x3c')][_0x6b1b('0x4b')]){_0x47a0f3[_0x6b1b('0x4e')]=[{'all':!![]}];}return db[_0x6b1b('0x69')][_0x6b1b('0x67')](_0x47a0f3);})[_0x6b1b('0x29')](function(_0x478ea8){_0x2bc7c7[_0x6b1b('0x4c')]=_0x478ea8;return _0x2bc7c7;});}})['then'](respondWithFilteredResult(_0x180108,_0x47a0f3))['catch'](handleError(_0x180108,null));};exports[_0x6b1b('0x6a')]=function(_0x471710,_0x173e9c,_0x1f6b93){var _0x125137={'raw':!![],'where':{}};var _0x23ff78={};var _0x33788d={'count':0x0,'rows':[]};return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x471710['params']['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x173e9c,null))['then'](function(_0x3f0cf2){if(_0x3f0cf2){_0x23ff78[_0x6b1b('0x3a')]=_['keys'](db[_0x6b1b('0x6b')][_0x6b1b('0x37')]);_0x23ff78['query']=_[_0x6b1b('0x3b')](_0x471710['query']);_0x23ff78['filters']=_[_0x6b1b('0x3e')](_0x23ff78[_0x6b1b('0x3a')],_0x23ff78[_0x6b1b('0x3c')]);_0x125137[_0x6b1b('0x3f')]=_[_0x6b1b('0x3e')](_0x23ff78[_0x6b1b('0x3a')],qs['fields'](_0x471710[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0x125137[_0x6b1b('0x3f')]=_0x125137[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x125137['attributes']:_0x23ff78[_0x6b1b('0x3a')];if(!_0x471710['query'][_0x6b1b('0x42')](_0x6b1b('0x43'))){_0x125137[_0x6b1b('0x22')]=qs[_0x6b1b('0x22')](_0x471710[_0x6b1b('0x3c')]['limit']);_0x125137[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x471710['query'][_0x6b1b('0x20')]);}_0x125137[_0x6b1b('0x44')]=qs[_0x6b1b('0x45')](_0x471710[_0x6b1b('0x3c')]['sort']);_0x125137[_0x6b1b('0x46')]=qs[_0x6b1b('0x3d')](_[_0x6b1b('0x47')](_0x471710[_0x6b1b('0x3c')],_0x23ff78[_0x6b1b('0x3d')]));_0x125137[_0x6b1b('0x46')]['VoiceQueueId']=_0x3f0cf2['id'];if(_0x471710[_0x6b1b('0x3c')][_0x6b1b('0x48')]){_0x125137[_0x6b1b('0x46')]=_[_0x6b1b('0x49')](_0x125137[_0x6b1b('0x46')],{'$or':_[_0x6b1b('0x2d')](_0x125137[_0x6b1b('0x3f')],function(_0x39656d){var _0x24285c={};_0x24285c[_0x39656d]={'$like':'%'+_0x471710['query'][_0x6b1b('0x48')]+'%'};return _0x24285c;})});}_0x125137=_['merge']({},_0x125137,_0x471710[_0x6b1b('0x4f')]);return db['CmHopperFinal'][_0x6b1b('0x23')]({'where':_0x125137[_0x6b1b('0x46')]})[_0x6b1b('0x29')](function(_0xeabc20){_0x33788d[_0x6b1b('0x23')]=_0xeabc20;if(_0x471710[_0x6b1b('0x3c')][_0x6b1b('0x4b')]){_0x125137[_0x6b1b('0x4e')]=[{'all':!![]}];}return db[_0x6b1b('0x6b')][_0x6b1b('0x67')](_0x125137);})[_0x6b1b('0x29')](function(_0x26dbf0){_0x33788d[_0x6b1b('0x4c')]=_0x26dbf0;return _0x33788d;});}})[_0x6b1b('0x29')](respondWithFilteredResult(_0x173e9c,_0x125137))[_0x6b1b('0x4d')](handleError(_0x173e9c,null));};exports[_0x6b1b('0x6c')]=function(_0x14da56,_0xf3f152,_0x452f8a){var _0x5d4a64={'raw':!![],'where':{}};var _0xb0ee2={};var _0x471e60={'count':0x0,'rows':[]};return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x14da56[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0xf3f152,null))[_0x6b1b('0x29')](function(_0x2a2fbe){if(_0x2a2fbe){_0xb0ee2['model']=_[_0x6b1b('0x3b')](db[_0x6b1b('0x6d')]['rawAttributes']);_0xb0ee2[_0x6b1b('0x3c')]=_[_0x6b1b('0x3b')](_0x14da56[_0x6b1b('0x3c')]);_0xb0ee2[_0x6b1b('0x3d')]=_[_0x6b1b('0x3e')](_0xb0ee2[_0x6b1b('0x3a')],_0xb0ee2[_0x6b1b('0x3c')]);_0x5d4a64[_0x6b1b('0x3f')]=_[_0x6b1b('0x3e')](_0xb0ee2[_0x6b1b('0x3a')],qs['fields'](_0x14da56['query'][_0x6b1b('0x40')]));_0x5d4a64[_0x6b1b('0x3f')]=_0x5d4a64['attributes'][_0x6b1b('0x41')]?_0x5d4a64[_0x6b1b('0x3f')]:_0xb0ee2[_0x6b1b('0x3a')];if(!_0x14da56['query'][_0x6b1b('0x42')](_0x6b1b('0x43'))){_0x5d4a64[_0x6b1b('0x22')]=qs['limit'](_0x14da56[_0x6b1b('0x3c')][_0x6b1b('0x22')]);_0x5d4a64[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x14da56[_0x6b1b('0x3c')][_0x6b1b('0x20')]);}_0x5d4a64[_0x6b1b('0x44')]=qs[_0x6b1b('0x45')](_0x14da56[_0x6b1b('0x3c')]['sort']);_0x5d4a64[_0x6b1b('0x46')]=qs[_0x6b1b('0x3d')](_[_0x6b1b('0x47')](_0x14da56[_0x6b1b('0x3c')],_0xb0ee2['filters']));_0x5d4a64[_0x6b1b('0x46')]['VoiceQueueId']=_0x2a2fbe['id'];if(_0x14da56[_0x6b1b('0x3c')]['filter']){_0x5d4a64['where']=_[_0x6b1b('0x49')](_0x5d4a64[_0x6b1b('0x46')],{'$or':_[_0x6b1b('0x2d')](_0x5d4a64[_0x6b1b('0x3f')],function(_0xdd7863){var _0x34926b={};_0x34926b[_0xdd7863]={'$like':'%'+_0x14da56[_0x6b1b('0x3c')][_0x6b1b('0x48')]+'%'};return _0x34926b;})});}_0x5d4a64=_[_0x6b1b('0x49')]({},_0x5d4a64,_0x14da56[_0x6b1b('0x4f')]);return db[_0x6b1b('0x6d')][_0x6b1b('0x23')]({'where':_0x5d4a64[_0x6b1b('0x46')]})['then'](function(_0x959102){_0x471e60[_0x6b1b('0x23')]=_0x959102;if(_0x14da56[_0x6b1b('0x3c')][_0x6b1b('0x4b')]){_0x5d4a64['include']=[{'all':!![]}];}return db[_0x6b1b('0x6d')][_0x6b1b('0x67')](_0x5d4a64);})[_0x6b1b('0x29')](function(_0x20458d){_0x471e60['rows']=_0x20458d;return _0x471e60;});}})[_0x6b1b('0x29')](respondWithFilteredResult(_0xf3f152,_0x5d4a64))[_0x6b1b('0x4d')](handleError(_0xf3f152,null));};exports[_0x6b1b('0x6e')]=function(_0x5537c0,_0x4529a6,_0x59056a){var _0xa1b1ea={};var _0x456659={};var _0x5b1c5c;var _0x1cec55;return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x5537c0['params']['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x4529a6,null))[_0x6b1b('0x29')](function(_0x5229e8){if(_0x5229e8){_0x5b1c5c=_0x5229e8;_0x456659[_0x6b1b('0x3a')]=_[_0x6b1b('0x3b')](db[_0x6b1b('0x6f')][_0x6b1b('0x37')]);_0x456659['query']=_[_0x6b1b('0x3b')](_0x5537c0[_0x6b1b('0x3c')]);_0x456659['filters']=_[_0x6b1b('0x3e')](_0x456659[_0x6b1b('0x3a')],_0x456659[_0x6b1b('0x3c')]);_0xa1b1ea['attributes']=_[_0x6b1b('0x3e')](_0x456659['model'],qs[_0x6b1b('0x40')](_0x5537c0[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0xa1b1ea[_0x6b1b('0x3f')]=_0xa1b1ea[_0x6b1b('0x3f')]['length']?_0xa1b1ea[_0x6b1b('0x3f')]:_0x456659[_0x6b1b('0x3a')];_0xa1b1ea[_0x6b1b('0x44')]=qs['sort'](_0x5537c0[_0x6b1b('0x3c')][_0x6b1b('0x45')]);_0xa1b1ea[_0x6b1b('0x46')]=qs[_0x6b1b('0x3d')](_[_0x6b1b('0x47')](_0x5537c0[_0x6b1b('0x3c')],_0x456659[_0x6b1b('0x3d')]));if(_0x5537c0[_0x6b1b('0x3c')][_0x6b1b('0x48')]){_0xa1b1ea['where']=_[_0x6b1b('0x49')](_0xa1b1ea[_0x6b1b('0x46')],{'$or':_['map'](_0xa1b1ea[_0x6b1b('0x3f')],function(_0x507022){var _0x175fb8={};_0x175fb8[_0x507022]={'$like':'%'+_0x5537c0[_0x6b1b('0x3c')]['filter']+'%'};return _0x175fb8;})});}_0xa1b1ea=_[_0x6b1b('0x49')]({},_0xa1b1ea,_0x5537c0[_0x6b1b('0x4f')]);return _0x5b1c5c[_0x6b1b('0x6e')](_0xa1b1ea);}})['then'](function(_0x2ee724){if(_0x2ee724){_0x1cec55=_0x2ee724['length'];if(!_0x5537c0[_0x6b1b('0x3c')][_0x6b1b('0x42')](_0x6b1b('0x43'))){_0xa1b1ea[_0x6b1b('0x22')]=qs[_0x6b1b('0x22')](_0x5537c0[_0x6b1b('0x3c')]['limit']);_0xa1b1ea[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x5537c0['query']['offset']);}return _0x5b1c5c['getTeams'](_0xa1b1ea);}})['then'](function(_0x2a5626){if(_0x2a5626){return _0x2a5626?{'count':_0x1cec55,'rows':_0x2a5626}:null;}})['then'](respondWithResult(_0x4529a6,null))[_0x6b1b('0x4d')](handleError(_0x4529a6,null));};exports[_0x6b1b('0x70')]=function(_0x1e1cec,_0x4112fe,_0x5bcc41){var _0xdaa04c=_0x1e1cec[_0x6b1b('0x5e')][_0x6b1b('0x71')];var _0x485d49=_[_0x6b1b('0x2d')](_0xdaa04c,'id');return db[_0x6b1b('0x6f')][_0x6b1b('0x67')]({'where':{'id':_0x485d49},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6b1b('0x72'),'attributes':['id',_0x6b1b('0x31'),_0x6b1b('0x73'),_0x6b1b('0x74'),'interface'],'raw':!![]}]})[_0x6b1b('0x29')](function(_0x35d0e4){if(_0x35d0e4){var _0x1b203b=_[_0x6b1b('0x75')](_0x35d0e4,function(_0x18b319){var _0x490d52=_0x18b319[_0x6b1b('0x52')]({'plain':!![]});_0x490d52[_0x6b1b('0x72')][_0x6b1b('0x76')](function(_0x54a330){_0x54a330[_0x6b1b('0x77')]=_[_0x6b1b('0x30')](_0xdaa04c,{'id':_0x490d52['id']})['penalty'];});return _0x490d52[_0x6b1b('0x72')];});return db[_0x6b1b('0x36')][_0x6b1b('0x30')]({'where':{'id':_0x1e1cec['params']['id']}})['then'](function(_0x40dd28){return db['sequelize'][_0x6b1b('0x78')](function(_0x48e77b){return _0x40dd28[_0x6b1b('0x70')](_0x485d49,{'transaction':_0x48e77b})[_0x6b1b('0x29')](function(){return BPromise[_0x6b1b('0x79')](_0xdaa04c,function(_0x14f644){return db[_0x6b1b('0x7a')][_0x6b1b('0x7b')]({'TeamId':_0x14f644['id'],'VoiceQueueId':_0x1e1cec[_0x6b1b('0x62')]['id'],'penalty':_0x14f644[_0x6b1b('0x77')]},{'transaction':_0x48e77b});});})[_0x6b1b('0x29')](function(){return BPromise[_0x6b1b('0x79')](_0x1b203b,function(_0x35b382){return db[_0x6b1b('0x7c')]['findOrCreate']({'where':{'UserId':_0x35b382['id'],'VoiceQueueId':_0x1e1cec[_0x6b1b('0x62')]['id']},'defaults':{'penalty':_0x35b382[_0x6b1b('0x77')]},'transaction':_0x48e77b});});})[_0x6b1b('0x29')](function(){return BPromise[_0x6b1b('0x79')](_['filter'](_0x1b203b,{'online':!![]}),function(_0x3f7c63){return db[_0x6b1b('0x7d')][_0x6b1b('0x7b')]({'membername':_0x3f7c63[_0x6b1b('0x31')],'UserId':_0x3f7c63['id'],'queue_name':_0x40dd28['name'],'VoiceQueueId':_0x40dd28['id'],'interface':_['isNil'](_0x3f7c63[_0x6b1b('0x7e')])?util[_0x6b1b('0x7f')](_0x6b1b('0x80'),_0x3f7c63['name']):_0x3f7c63['interface'],'paused':_0x3f7c63['voicePause']||![],'penalty':_0x3f7c63['penalty']},{'transaction':_0x48e77b});});})[_0x6b1b('0x29')](function(){_0x1b203b[_0x6b1b('0x76')](function(_0x2bdd17){socket['emit'](_0x6b1b('0x81'),{'UserId':_0x2bdd17['id'],'VoiceQueueId':_0x40dd28['id']});});});});});}})['then'](respondWithStatusCode(_0x4112fe,null))[_0x6b1b('0x4d')](handleError(_0x4112fe,null));};exports[_0x6b1b('0x82')]=function(_0x17144d,_0x1042a4,_0x56bd93){return db[_0x6b1b('0x6f')]['findAll']({'where':{'id':_0x17144d[_0x6b1b('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6b1b('0x83')],'as':_0x6b1b('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1042a4,null))['then'](function(_0x1ea20b){var _0x6f30c=_[_0x6b1b('0x2d')](_0x1ea20b,'id');var _0x3a26d4=[];var _0x1a7804=[];var _0x16e98f=squel[_0x6b1b('0x84')]();_0x16e98f[_0x6b1b('0x85')](_0x6b1b('0x86'))[_0x6b1b('0x87')](_0x6b1b('0x88'),'tq')['join'](_0x6b1b('0x89'),'ut',_0x6b1b('0x8a'))[_0x6b1b('0x46')](_0x6b1b('0x8b'),_0x17144d[_0x6b1b('0x62')]['id']);for(var _0x3d8339=0x0;_0x3d8339<_0x1ea20b['length'];_0x3d8339+=0x1){let _0x531a7f=_0x1ea20b[_0x3d8339];for(var _0x22edfc=0x0;_0x22edfc<_0x531a7f[_0x6b1b('0x72')][_0x6b1b('0x41')];_0x22edfc+=0x1){let _0x20aa9a=_0x531a7f[_0x6b1b('0x72')][_0x22edfc];var _0x48e6d3=_0x16e98f[_0x6b1b('0x5b')]();_0x48e6d3['where'](_0x6b1b('0x8c'),_0x20aa9a['id']);_0x1a7804[_0x6b1b('0x8d')](db['sequelize']['query'](_0x48e6d3[_0x6b1b('0x8e')](),{'type':db[_0x6b1b('0x8f')][_0x6b1b('0x90')][_0x6b1b('0x91')]})[_0x6b1b('0x29')](function(_0x356ede){if(_0x356ede['length']===0x1){return _0x20aa9a['id'];}else{var _0xadf32e=_[_0x6b1b('0x92')](_[_0x6b1b('0x2d')](_0x356ede,_0x6b1b('0x93')),function(_0x32f26f){return _[_0x6b1b('0x94')](_0x6f30c,_0x32f26f);});if(_0xadf32e){return _0x20aa9a['id'];}}}));}}return BPromise[_0x6b1b('0x95')](_0x1a7804)['then'](function(_0x2a17fc){_0x3a26d4=_(_0x3a26d4)[_0x6b1b('0x96')](_0x2a17fc)[_0x6b1b('0x97')]()[_0x6b1b('0x2e')]();return db[_0x6b1b('0x36')][_0x6b1b('0x30')]({'where':{'id':_0x17144d[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](function(_0x2ed4f9){return db[_0x6b1b('0x8f')][_0x6b1b('0x78')](function(_0x5a57da){return _0x2ed4f9[_0x6b1b('0x82')](_0x17144d[_0x6b1b('0x3c')][_0x6b1b('0x98')],{'transaction':_0x5a57da})[_0x6b1b('0x29')](function(){if(!_[_0x6b1b('0x99')](_0x3a26d4)){return _0x2ed4f9[_0x6b1b('0x9a')](_0x3a26d4,{'transaction':_0x5a57da})[_0x6b1b('0x29')](function(){return db['UserVoiceQueueRt'][_0x6b1b('0x33')]({'where':{'VoiceQueueId':_0x17144d['params']['id'],'UserId':_0x3a26d4},'transaction':_0x5a57da});});}})[_0x6b1b('0x29')](function(){_0x3a26d4[_0x6b1b('0x76')](function(_0xb351e9){socket[_0x6b1b('0x9b')](_0x6b1b('0x9c'),{'UserId':_0xb351e9,'VoiceQueueId':_0x2ed4f9['id']});});});});});});})[_0x6b1b('0x29')](respondWithStatusCode(_0x1042a4,null))[_0x6b1b('0x4d')](handleError(_0x1042a4,null));};exports[_0x6b1b('0x9d')]=function(_0x2f9148,_0x3f9698,_0x2950f6){var _0x351b07,_0x59ef19;return db[_0x6b1b('0x36')][_0x6b1b('0x30')]({'where':{'id':_0x2f9148[_0x6b1b('0x62')]['id']}})['then'](handleEntityNotFound(_0x3f9698,null))[_0x6b1b('0x29')](function(_0x5978dc){if(_0x5978dc){_0x59ef19=_0x5978dc;return _0x5978dc[_0x6b1b('0x9d')](_0x2f9148[_0x6b1b('0x5e')][_0x6b1b('0x98')],_['omit'](_0x2f9148[_0x6b1b('0x5e')],[_0x6b1b('0x98'),'id'])||{})[_0x6b1b('0x9e')](function(_0x43aafc){for(var _0x581f06=0x0;_0x581f06<_0x2f9148['body']['ids']['length'];_0x581f06+=0x1){socket[_0x6b1b('0x9b')]('userVoiceQueue:save',{'UserId':Number(_0x2f9148['body']['ids'][_0x581f06]),'VoiceQueueId':Number(_0x2f9148[_0x6b1b('0x62')]['id'])});}return _0x43aafc;});}})[_0x6b1b('0x29')](function(_0x3cdacf){_0x351b07=_0x3cdacf||[];if(_0x59ef19){return db['User'][_0x6b1b('0x67')]({'where':{'id':_0x2f9148['body'][_0x6b1b('0x98')]},'attributes':['id',_0x6b1b('0x31'),'online',_0x6b1b('0x74'),'interface'],'raw':!![]});}})[_0x6b1b('0x29')](function(_0x44439b){if(!_[_0x6b1b('0x99')](_0x44439b)){var _0x462be6=[];for(var _0x1a0a0b=0x0;_0x1a0a0b<_0x44439b[_0x6b1b('0x41')];_0x1a0a0b++){if(_0x44439b[_0x1a0a0b][_0x6b1b('0x73')]){_0x462be6['push'](db['UserVoiceQueueRt'][_0x6b1b('0x7b')]({'membername':_0x44439b[_0x1a0a0b][_0x6b1b('0x31')],'UserId':_0x44439b[_0x1a0a0b]['id'],'queue_name':_0x59ef19[_0x6b1b('0x31')],'VoiceQueueId':_0x59ef19['id'],'interface':_['isNil'](_0x44439b[_0x1a0a0b][_0x6b1b('0x7e')])?util['format'](_0x6b1b('0x80'),_0x44439b[_0x1a0a0b][_0x6b1b('0x31')]):_0x44439b[_0x1a0a0b]['interface'],'paused':_0x44439b[_0x1a0a0b]['voicePause']||![],'penalty':_0x2f9148[_0x6b1b('0x5e')]['penalty']||0x0}));}}return BPromise[_0x6b1b('0x95')](_0x462be6);}})['then'](function(){return _0x351b07;})['then'](respondWithResult(_0x3f9698,null))[_0x6b1b('0x4d')](handleError(_0x3f9698,null));};exports['removeAgents']=function(_0x3bd3ca,_0x40b5b3,_0x10ddd1){return db[_0x6b1b('0x36')][_0x6b1b('0x30')]({'where':{'id':_0x3bd3ca[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x40b5b3,null))[_0x6b1b('0x29')](function(_0x494301){if(_0x494301){return _0x494301[_0x6b1b('0x9a')](_0x3bd3ca[_0x6b1b('0x3c')]['ids'])[_0x6b1b('0x29')](function(){if(_['isArray'](_0x3bd3ca['query'][_0x6b1b('0x98')])){for(var _0x59d4a9=0x0;_0x59d4a9<_0x3bd3ca[_0x6b1b('0x3c')][_0x6b1b('0x98')][_0x6b1b('0x41')];_0x59d4a9+=0x1){socket[_0x6b1b('0x9b')](_0x6b1b('0x9c'),{'UserId':Number(_0x3bd3ca['query'][_0x6b1b('0x98')][_0x59d4a9]),'VoiceQueueId':Number(_0x3bd3ca[_0x6b1b('0x62')]['id'])});}}else{socket['emit'](_0x6b1b('0x9c'),{'UserId':Number(_0x3bd3ca['query'][_0x6b1b('0x98')]),'VoiceQueueId':Number(_0x3bd3ca[_0x6b1b('0x62')]['id'])});}});}})[_0x6b1b('0x29')](function(_0x5dddd6){return db[_0x6b1b('0x7d')][_0x6b1b('0x33')]({'where':{'VoiceQueueId':_0x3bd3ca[_0x6b1b('0x62')]['id'],'UserId':_0x3bd3ca['query'][_0x6b1b('0x98')]}})['then'](function(){return _0x5dddd6;});})[_0x6b1b('0x29')](respondWithStatusCode(_0x40b5b3,null))[_0x6b1b('0x4d')](handleError(_0x40b5b3,null));};exports[_0x6b1b('0x9f')]=function(_0x4f966b,_0x413219,_0x220a99){var _0x474a19={};var _0x51a318={};var _0x47641a;var _0x278f6a;return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x4f966b[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x413219,null))[_0x6b1b('0x29')](function(_0x2f91e2){if(_0x2f91e2){_0x47641a=_0x2f91e2;_0x51a318['model']=_[_0x6b1b('0x3b')](db[_0x6b1b('0x83')][_0x6b1b('0x37')]);_0x51a318[_0x6b1b('0x3c')]=_[_0x6b1b('0x3b')](_0x4f966b['query']);_0x51a318[_0x6b1b('0x3d')]=_[_0x6b1b('0x3e')](_0x51a318[_0x6b1b('0x3a')],_0x51a318[_0x6b1b('0x3c')]);_0x474a19['attributes']=_['intersection'](_0x51a318[_0x6b1b('0x3a')],qs[_0x6b1b('0x40')](_0x4f966b[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0x474a19['attributes']=_0x474a19[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x474a19['attributes']:_0x51a318['model'];_0x474a19['order']=qs['sort'](_0x4f966b['query'][_0x6b1b('0x45')]);_0x474a19[_0x6b1b('0x46')]=qs['filters'](_[_0x6b1b('0x47')](_0x4f966b[_0x6b1b('0x3c')],_0x51a318[_0x6b1b('0x3d')]));if(_0x4f966b[_0x6b1b('0x3c')]['filter']){_0x474a19[_0x6b1b('0x46')]=_[_0x6b1b('0x49')](_0x474a19[_0x6b1b('0x46')],{'$or':_['map'](_0x474a19[_0x6b1b('0x3f')],function(_0x3b7d97){var _0x2fa882={};_0x2fa882[_0x3b7d97]={'$like':'%'+_0x4f966b[_0x6b1b('0x3c')][_0x6b1b('0x48')]+'%'};return _0x2fa882;})});}_0x474a19=_[_0x6b1b('0x49')]({},_0x474a19,_0x4f966b[_0x6b1b('0x4f')]);return _0x47641a[_0x6b1b('0x9f')](_0x474a19);}})['then'](function(_0x1be6df){if(_0x1be6df){_0x278f6a=_0x1be6df[_0x6b1b('0x41')];if(!_0x4f966b[_0x6b1b('0x3c')]['hasOwnProperty'](_0x6b1b('0x43'))){_0x474a19[_0x6b1b('0x22')]=qs[_0x6b1b('0x22')](_0x4f966b[_0x6b1b('0x3c')][_0x6b1b('0x22')]);_0x474a19[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x4f966b[_0x6b1b('0x3c')][_0x6b1b('0x20')]);}return _0x47641a[_0x6b1b('0x9f')](_0x474a19);}})[_0x6b1b('0x29')](function(_0xf2c1a1){if(_0xf2c1a1){return _0xf2c1a1?{'count':_0x278f6a,'rows':_0xf2c1a1}:null;}})[_0x6b1b('0x29')](respondWithResult(_0x413219,null))[_0x6b1b('0x4d')](handleError(_0x413219,null));};exports['getMembers']=function(_0x28937a,_0x17548c,_0x5922ab){var _0x3ecbe8={};var _0x254bb3={};var _0x23906;var _0x563d22;return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x28937a[_0x6b1b('0x62')]['id']}})['then'](handleEntityNotFound(_0x17548c,null))['then'](function(_0x18e866){if(_0x18e866){_0x23906=_0x18e866;_0x254bb3[_0x6b1b('0x3a')]=_[_0x6b1b('0x3b')](db['UserVoiceQueueRt'][_0x6b1b('0x37')]);_0x254bb3[_0x6b1b('0x3c')]=_[_0x6b1b('0x3b')](_0x28937a[_0x6b1b('0x3c')]);_0x254bb3[_0x6b1b('0x3d')]=_['intersection'](_0x254bb3[_0x6b1b('0x3a')],_0x254bb3['query']);_0x3ecbe8[_0x6b1b('0x3f')]=_[_0x6b1b('0x3e')](_0x254bb3[_0x6b1b('0x3a')],qs[_0x6b1b('0x40')](_0x28937a[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0x3ecbe8[_0x6b1b('0x3f')]=_0x3ecbe8[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x3ecbe8[_0x6b1b('0x3f')]:_0x254bb3[_0x6b1b('0x3a')];_0x3ecbe8[_0x6b1b('0x44')]=qs[_0x6b1b('0x45')](_0x28937a[_0x6b1b('0x3c')][_0x6b1b('0x45')]);_0x3ecbe8[_0x6b1b('0x46')]=qs[_0x6b1b('0x3d')](_[_0x6b1b('0x47')](_0x28937a[_0x6b1b('0x3c')],_0x254bb3[_0x6b1b('0x3d')]));if(_0x28937a[_0x6b1b('0x3c')][_0x6b1b('0x48')]){_0x3ecbe8[_0x6b1b('0x46')]=_[_0x6b1b('0x49')](_0x3ecbe8['where'],{'$or':_[_0x6b1b('0x2d')](_0x3ecbe8['attributes'],function(_0x33065c){var _0x4b5c0d={};_0x4b5c0d[_0x33065c]={'$like':'%'+_0x28937a[_0x6b1b('0x3c')]['filter']+'%'};return _0x4b5c0d;})});}_0x3ecbe8=_[_0x6b1b('0x49')]({},_0x3ecbe8,_0x28937a['options']);return _0x23906[_0x6b1b('0xa0')](_0x3ecbe8);}})[_0x6b1b('0x29')](function(_0x36a154){if(_0x36a154){_0x563d22=_0x36a154[_0x6b1b('0x41')];if(!_0x28937a[_0x6b1b('0x3c')]['hasOwnProperty']('nolimit')){_0x3ecbe8[_0x6b1b('0x22')]=qs[_0x6b1b('0x22')](_0x28937a['query'][_0x6b1b('0x22')]);_0x3ecbe8[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x28937a[_0x6b1b('0x3c')]['offset']);}return _0x23906['getMembers'](_0x3ecbe8);}})[_0x6b1b('0x29')](function(_0x15f33d){return _0x15f33d?{'count':_0x563d22,'rows':_0x15f33d}:null;})[_0x6b1b('0x29')](respondWithResult(_0x17548c,null))[_0x6b1b('0x4d')](handleError(_0x17548c,null));};exports['getLists']=function(_0x18a620,_0x545a0d,_0xbf1321){var _0x4a0708={};var _0x1a223c={};var _0x5d944d;var _0x35f61b;return db[_0x6b1b('0x36')]['findOne']({'where':{'id':_0x18a620[_0x6b1b('0x62')]['id']}})['then'](handleEntityNotFound(_0x545a0d,null))[_0x6b1b('0x29')](function(_0x378674){if(_0x378674){_0x5d944d=_0x378674;_0x1a223c[_0x6b1b('0x3a')]=_[_0x6b1b('0x3b')](db[_0x6b1b('0xa1')][_0x6b1b('0x37')]);_0x1a223c[_0x6b1b('0x3c')]=_[_0x6b1b('0x3b')](_0x18a620['query']);_0x1a223c[_0x6b1b('0x3d')]=_[_0x6b1b('0x3e')](_0x1a223c['model'],_0x1a223c[_0x6b1b('0x3c')]);_0x4a0708['attributes']=_['intersection'](_0x1a223c[_0x6b1b('0x3a')],qs['fields'](_0x18a620[_0x6b1b('0x3c')][_0x6b1b('0x40')]));_0x4a0708['attributes']=_0x4a0708[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x4a0708[_0x6b1b('0x3f')]:_0x1a223c['model'];_0x4a0708[_0x6b1b('0x44')]=qs[_0x6b1b('0x45')](_0x18a620[_0x6b1b('0x3c')][_0x6b1b('0x45')]);_0x4a0708[_0x6b1b('0x46')]=qs[_0x6b1b('0x3d')](_[_0x6b1b('0x47')](_0x18a620[_0x6b1b('0x3c')],_0x1a223c[_0x6b1b('0x3d')]));if(_0x18a620['query'][_0x6b1b('0x48')]){_0x4a0708[_0x6b1b('0x46')]=_['merge'](_0x4a0708[_0x6b1b('0x46')],{'$or':_[_0x6b1b('0x2d')](_0x4a0708[_0x6b1b('0x3f')],function(_0x5defc7){var _0x237655={};_0x237655[_0x5defc7]={'$like':'%'+_0x18a620[_0x6b1b('0x3c')][_0x6b1b('0x48')]+'%'};return _0x237655;})});}_0x4a0708=_[_0x6b1b('0x49')]({},_0x4a0708,_0x18a620['options']);return _0x5d944d['getLists'](_0x4a0708);}})[_0x6b1b('0x29')](function(_0xbda2a7){if(_0xbda2a7){_0x35f61b=_0xbda2a7[_0x6b1b('0x41')];if(!_0x18a620[_0x6b1b('0x3c')]['hasOwnProperty'](_0x6b1b('0x43'))){_0x4a0708[_0x6b1b('0x22')]=qs[_0x6b1b('0x22')](_0x18a620[_0x6b1b('0x3c')][_0x6b1b('0x22')]);_0x4a0708[_0x6b1b('0x20')]=qs['offset'](_0x18a620['query'][_0x6b1b('0x20')]);}return _0x5d944d[_0x6b1b('0xa2')](_0x4a0708);}})[_0x6b1b('0x29')](function(_0x50330d){if(_0x50330d){return _0x50330d?{'count':_0x35f61b,'rows':_0x50330d}:null;}})[_0x6b1b('0x29')](respondWithResult(_0x545a0d,null))[_0x6b1b('0x4d')](handleError(_0x545a0d,null));};exports['addLists']=function(_0xa39a9e,_0x1eb407,_0x10fd90){var _0x43037c,_0x4a5918;return db[_0x6b1b('0x36')]['find']({'where':{'id':_0xa39a9e[_0x6b1b('0x62')]['id']}})['then'](handleEntityNotFound(_0x1eb407,null))[_0x6b1b('0x29')](function(_0x2c631a){if(_0x2c631a){_0x4a5918=_0x2c631a;return _0x2c631a[_0x6b1b('0xa3')](_0xa39a9e[_0x6b1b('0x5e')][_0x6b1b('0x98')],_[_0x6b1b('0x5c')](_0xa39a9e[_0x6b1b('0x5e')],['ids','id'])||{});}return null;})['spread'](function(_0x4f6c08){var _0x4871ff;_0x43037c=_0x4f6c08||[];var _0x909306=[];if(_0x4f6c08){for(var _0x20375d=0x0;_0x20375d<_0x4f6c08[_0x6b1b('0x41')];_0x20375d+=0x1){var _0x58bb88=_0x4f6c08[_0x20375d][_0x6b1b('0x52')]({'plain':!![]});_0x4a5918['dialCheckDuplicateType']=_0xa39a9e[_0x6b1b('0x5e')][_0x6b1b('0xa4')]?_0xa39a9e[_0x6b1b('0x5e')]['dialCheckDuplicateType']:_0x4a5918[_0x6b1b('0xa4')];switch(_0x4a5918[_0x6b1b('0xa4')]){case'always':_0x4871ff=squel['insert']()['into'](_0x6b1b('0xa5'))[_0x6b1b('0xa6')]([_0x6b1b('0xa7'),_0x6b1b('0xa8'),'ContactId',_0x6b1b('0xa9'),_0x6b1b('0x66'),_0x6b1b('0x5f'),_0x6b1b('0x5d')],squel[_0x6b1b('0x84')]()['field'](_0x6b1b('0xa7'),'phone')[_0x6b1b('0x85')](_0x6b1b('0xaa'),_0x6b1b('0xa8'))[_0x6b1b('0x85')]('id',_0x6b1b('0xab'))['field'](_0x58bb88[_0x6b1b('0xac')][_0x6b1b('0x8e')](),'ListId')['field'](_0xa39a9e[_0x6b1b('0x62')]['id'][_0x6b1b('0x8e')](),_0x6b1b('0x66'))[_0x6b1b('0x85')]('NOW()',_0x6b1b('0x5f'))['field'](_0x6b1b('0xaa'),_0x6b1b('0x5d'))[_0x6b1b('0x87')]('cm_contacts')['where'](_0x6b1b('0xad'))['where'](_0x6b1b('0xae'),_0x58bb88['CmListId'][_0x6b1b('0x8e')]())[_0x6b1b('0x46')](_0x6b1b('0xaf'))[_0x6b1b('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6b1b('0x84')]()[_0x6b1b('0x85')](_0x6b1b('0xb0'))[_0x6b1b('0x87')]('cm_hopper_final')[_0x6b1b('0x46')](_0x6b1b('0x8b'),_0xa39a9e[_0x6b1b('0x62')]['id'][_0x6b1b('0x8e')]()))[_0x6b1b('0x46')](_0x6b1b('0xb1'),squel[_0x6b1b('0x84')]()[_0x6b1b('0x85')](_0x6b1b('0xb2'))[_0x6b1b('0x87')](_0x6b1b('0xa5'))[_0x6b1b('0x46')](_0x6b1b('0x8b'),_0xa39a9e[_0x6b1b('0x62')]['id'][_0x6b1b('0x8e')]())))['toString']();break;case _0x6b1b('0xb3'):_0x4871ff=squel[_0x6b1b('0xb4')]()[_0x6b1b('0xb5')](_0x6b1b('0xa5'))['fromQuery']([_0x6b1b('0xa7'),_0x6b1b('0xa8'),_0x6b1b('0xab'),'ListId',_0x6b1b('0x66'),'createdAt','updatedAt'],squel[_0x6b1b('0x84')]()[_0x6b1b('0x85')](_0x6b1b('0xa7'),_0x6b1b('0xa7'))[_0x6b1b('0x85')](_0x6b1b('0xaa'),_0x6b1b('0xa8'))[_0x6b1b('0x85')]('id',_0x6b1b('0xab'))[_0x6b1b('0x85')](_0x58bb88[_0x6b1b('0xac')][_0x6b1b('0x8e')](),_0x6b1b('0xa9'))['field'](_0xa39a9e[_0x6b1b('0x62')]['id'][_0x6b1b('0x8e')](),_0x6b1b('0x66'))[_0x6b1b('0x85')](_0x6b1b('0xaa'),_0x6b1b('0x5f'))['field'](_0x6b1b('0xaa'),_0x6b1b('0x5d'))[_0x6b1b('0x87')]('cm_contacts')[_0x6b1b('0x46')](_0x6b1b('0xad'))[_0x6b1b('0x46')](_0x6b1b('0xae'),_0x58bb88[_0x6b1b('0xac')][_0x6b1b('0x8e')]())['where'](_0x6b1b('0xaf'))[_0x6b1b('0x46')](_0x6b1b('0xb1'),squel[_0x6b1b('0x84')]()[_0x6b1b('0x85')](_0x6b1b('0xb2'))[_0x6b1b('0x87')]('cm_hopper')['where'](_0x6b1b('0x8b'),_0xa39a9e[_0x6b1b('0x62')]['id'][_0x6b1b('0x8e')]())))[_0x6b1b('0x8e')]();break;default:_0x4871ff=squel[_0x6b1b('0xb4')]()[_0x6b1b('0xb5')]('cm_hopper')[_0x6b1b('0xa6')](['phone',_0x6b1b('0xa8'),_0x6b1b('0xab'),'ListId',_0x6b1b('0x66'),_0x6b1b('0x5f'),'updatedAt'],squel['select']()[_0x6b1b('0x85')](_0x6b1b('0xa7'),'phone')['field'](_0x6b1b('0xaa'),_0x6b1b('0xa8'))[_0x6b1b('0x85')]('id',_0x6b1b('0xab'))[_0x6b1b('0x85')](_0x58bb88[_0x6b1b('0xac')][_0x6b1b('0x8e')](),_0x6b1b('0xa9'))[_0x6b1b('0x85')](_0xa39a9e[_0x6b1b('0x62')]['id']['toString'](),_0x6b1b('0x66'))[_0x6b1b('0x85')](_0x6b1b('0xaa'),_0x6b1b('0x5f'))['field'](_0x6b1b('0xaa'),'updatedAt')[_0x6b1b('0x87')](_0x6b1b('0xb6'))[_0x6b1b('0x46')](_0x6b1b('0xad'))[_0x6b1b('0x46')](_0x6b1b('0xae'),_0x58bb88[_0x6b1b('0xac')][_0x6b1b('0x8e')]())[_0x6b1b('0x46')](_0x6b1b('0xaf')))[_0x6b1b('0x8e')]();}_0x909306[_0x6b1b('0x8d')](db[_0x6b1b('0x8f')][_0x6b1b('0x3c')](_0x4871ff));}return BPromise[_0x6b1b('0x95')](_0x909306);}})[_0x6b1b('0x29')](function(){return _0x43037c;})[_0x6b1b('0x29')](respondWithResult(_0x1eb407,null))[_0x6b1b('0x4d')](handleError(_0x1eb407,null));};exports[_0x6b1b('0xb7')]=function(_0x420c80,_0x163920,_0x50eaf2){return db['VoiceQueue'][_0x6b1b('0x30')]({'where':{'id':_0x420c80['params']['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x163920,null))[_0x6b1b('0x29')](function(_0x5b8dc2){if(_0x5b8dc2){return _0x5b8dc2[_0x6b1b('0xb7')](_0x420c80[_0x6b1b('0x3c')][_0x6b1b('0x98')]);}})[_0x6b1b('0x29')](function(_0x432ccf){if(_0x432ccf){return db[_0x6b1b('0x65')][_0x6b1b('0x33')]({'where':{'ListId':_0x420c80[_0x6b1b('0x3c')][_0x6b1b('0x98')],'VoiceQueueId':_0x420c80['params']['id']}})[_0x6b1b('0x29')](function(){return _0x432ccf;});}})[_0x6b1b('0x29')](respondWithStatusCode(_0x163920,null))[_0x6b1b('0x4d')](handleError(_0x163920,null));};exports[_0x6b1b('0xb8')]=function(_0x3f6069,_0x97257f,_0xe92421){var _0x396f04={};var _0x5069a8={};var _0x47c09a;var _0x340de8;return db[_0x6b1b('0x36')][_0x6b1b('0x64')]({'where':{'id':_0x3f6069['params']['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x97257f,null))['then'](function(_0x3c62d8){if(_0x3c62d8){_0x47c09a=_0x3c62d8;_0x5069a8[_0x6b1b('0x3a')]=_[_0x6b1b('0x3b')](db[_0x6b1b('0xa1')][_0x6b1b('0x37')]);_0x5069a8[_0x6b1b('0x3c')]=_[_0x6b1b('0x3b')](_0x3f6069[_0x6b1b('0x3c')]);_0x5069a8[_0x6b1b('0x3d')]=_[_0x6b1b('0x3e')](_0x5069a8[_0x6b1b('0x3a')],_0x5069a8[_0x6b1b('0x3c')]);_0x396f04[_0x6b1b('0x3f')]=_[_0x6b1b('0x3e')](_0x5069a8[_0x6b1b('0x3a')],qs[_0x6b1b('0x40')](_0x3f6069[_0x6b1b('0x3c')]['fields']));_0x396f04[_0x6b1b('0x3f')]=_0x396f04[_0x6b1b('0x3f')][_0x6b1b('0x41')]?_0x396f04[_0x6b1b('0x3f')]:_0x5069a8[_0x6b1b('0x3a')];_0x396f04[_0x6b1b('0x44')]=qs[_0x6b1b('0x45')](_0x3f6069['query'][_0x6b1b('0x45')]);_0x396f04[_0x6b1b('0x46')]=qs[_0x6b1b('0x3d')](_[_0x6b1b('0x47')](_0x3f6069['query'],_0x5069a8[_0x6b1b('0x3d')]));if(_0x3f6069['query']['filter']){_0x396f04['where']=_[_0x6b1b('0x49')](_0x396f04[_0x6b1b('0x46')],{'$or':_[_0x6b1b('0x2d')](_0x396f04[_0x6b1b('0x3f')],function(_0x344822){var _0x4a95bb={};_0x4a95bb[_0x344822]={'$like':'%'+_0x3f6069[_0x6b1b('0x3c')][_0x6b1b('0x48')]+'%'};return _0x4a95bb;})});}_0x396f04=_[_0x6b1b('0x49')]({},_0x396f04,_0x3f6069[_0x6b1b('0x4f')]);return _0x47c09a['getBlackLists'](_0x396f04);}})[_0x6b1b('0x29')](function(_0x8e9317){if(_0x8e9317){_0x340de8=_0x8e9317[_0x6b1b('0x41')];if(!_0x3f6069['query'][_0x6b1b('0x42')]('nolimit')){_0x396f04['limit']=qs[_0x6b1b('0x22')](_0x3f6069[_0x6b1b('0x3c')]['limit']);_0x396f04[_0x6b1b('0x20')]=qs[_0x6b1b('0x20')](_0x3f6069['query'][_0x6b1b('0x20')]);}return _0x47c09a['getBlackLists'](_0x396f04);}})[_0x6b1b('0x29')](function(_0x4c307c){if(_0x4c307c){return _0x4c307c?{'count':_0x340de8,'rows':_0x4c307c}:null;}})[_0x6b1b('0x29')](respondWithResult(_0x97257f,null))[_0x6b1b('0x4d')](handleError(_0x97257f,null));};exports[_0x6b1b('0xb9')]=function(_0x33bcba,_0x36bc21,_0x495c5d){var _0x4df2f2,_0x8aaf74;return db[_0x6b1b('0x36')]['find']({'where':{'id':_0x33bcba[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x36bc21,null))[_0x6b1b('0x29')](function(_0x1a07b5){if(_0x1a07b5){_0x8aaf74=_0x1a07b5;return _0x1a07b5['addBlackLists'](_0x33bcba['body'][_0x6b1b('0x98')],_[_0x6b1b('0x5c')](_0x33bcba[_0x6b1b('0x5e')],[_0x6b1b('0x98'),'id'])||{});}return null;})[_0x6b1b('0x9e')](function(_0x39d593){var _0x193e88;_0x4df2f2=_0x39d593||[];var _0x1b6822=[];if(_0x39d593){for(var _0x42a40c=0x0;_0x42a40c<_0x39d593['length'];_0x42a40c+=0x1){var _0x4611ee=_0x39d593[_0x42a40c][_0x6b1b('0x52')]({'plain':!![]});_0x193e88=squel[_0x6b1b('0xb4')]()[_0x6b1b('0xb5')]('cm_hopper_black')[_0x6b1b('0xa6')]([_0x6b1b('0xa7'),'ContactId','ListId',_0x6b1b('0x66'),_0x6b1b('0x5f'),_0x6b1b('0x5d')],squel[_0x6b1b('0x84')]()[_0x6b1b('0x85')](_0x6b1b('0xa7'),_0x6b1b('0xa7'))['field']('id',_0x6b1b('0xab'))['field'](_0x4611ee['CmListId']['toString'](),_0x6b1b('0xa9'))[_0x6b1b('0x85')](_0x33bcba[_0x6b1b('0x62')]['id'][_0x6b1b('0x8e')](),'VoiceQueueId')[_0x6b1b('0x85')](_0x6b1b('0xaa'),_0x6b1b('0x5f'))[_0x6b1b('0x85')]('NOW()',_0x6b1b('0x5d'))['from'](_0x6b1b('0xb6'))[_0x6b1b('0x46')](_0x6b1b('0xad'))['where'](_0x6b1b('0xae'),_0x4611ee[_0x6b1b('0xac')][_0x6b1b('0x8e')]())[_0x6b1b('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x6b1b('0x8e')]();_0x1b6822[_0x6b1b('0x8d')](db[_0x6b1b('0x8f')][_0x6b1b('0x3c')](_0x193e88));}return BPromise[_0x6b1b('0x95')](_0x1b6822);}})[_0x6b1b('0x29')](function(){return _0x4df2f2;})[_0x6b1b('0x29')](respondWithResult(_0x36bc21,null))[_0x6b1b('0x4d')](handleError(_0x36bc21,null));};exports[_0x6b1b('0xba')]=function(_0xbe2e5d,_0x346103,_0x5d7700){return db[_0x6b1b('0x36')][_0x6b1b('0x30')]({'where':{'id':_0xbe2e5d[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](handleEntityNotFound(_0x346103,null))[_0x6b1b('0x29')](function(_0x2faf7b){if(_0x2faf7b){return _0x2faf7b[_0x6b1b('0xba')](_0xbe2e5d[_0x6b1b('0x3c')]['ids']);}})[_0x6b1b('0x29')](function(_0x168e9b){if(_0x168e9b){return db[_0x6b1b('0x6d')]['destroy']({'where':{'ListId':_0xbe2e5d[_0x6b1b('0x3c')][_0x6b1b('0x98')],'VoiceQueueId':_0xbe2e5d[_0x6b1b('0x62')]['id']}})[_0x6b1b('0x29')](function(){return _0x168e9b;});}})[_0x6b1b('0x29')](respondWithStatusCode(_0x346103,null))[_0x6b1b('0x4d')](handleError(_0x346103,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 208f17a..9010103 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 _0xc57b=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x1972c3,_0x27df4f){var _0x43a646=function(_0xf0176c){while(--_0xf0176c){_0x1972c3['push'](_0x1972c3['shift']());}};_0x43a646(++_0x27df4f);}(_0xc57b,0x16a));var _0xbc57=function(_0x40cc2c,_0x1da84a){_0x40cc2c=_0x40cc2c-0x0;var _0x464985=_0xc57b[_0x40cc2c];return _0x464985;};'use strict';var EventEmitter=require(_0xbc57('0x0'));var VoiceQueue=require(_0xbc57('0x1'))['db'][_0xbc57('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbc57('0x3')](0x0);var events={'afterCreate':_0xbc57('0x4'),'afterUpdate':_0xbc57('0x5'),'afterDestroy':_0xbc57('0x6')};function emitEvent(_0x1ec646){return function(_0x4bafd9,_0x2e1ee4,_0x4a57d9){VoiceQueueEvents[_0xbc57('0x7')](_0x1ec646+':'+_0x4bafd9['id'],_0x4bafd9);VoiceQueueEvents[_0xbc57('0x7')](_0x1ec646,_0x4bafd9);_0x4a57d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xbc57('0x8')](e,emitEvent(event));}}module[_0xbc57('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x8a40=['hasOwnProperty','events','../../mysqldb','VoiceQueue','save','emit'];(function(_0xe828c9,_0x3da4c9){var _0x471922=function(_0x162882){while(--_0x162882){_0xe828c9['push'](_0xe828c9['shift']());}};_0x471922(++_0x3da4c9);}(_0x8a40,0x139));var _0x08a4=function(_0x13dd07,_0x49d670){_0x13dd07=_0x13dd07-0x0;var _0x1a00cb=_0x8a40[_0x13dd07];return _0x1a00cb;};'use strict';var EventEmitter=require(_0x08a4('0x0'));var VoiceQueue=require(_0x08a4('0x1'))['db'][_0x08a4('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x08a4('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xce9bcb){return function(_0x3689dd,_0x34c742,_0x3b5e95){VoiceQueueEvents[_0x08a4('0x4')](_0xce9bcb+':'+_0x3689dd['id'],_0x3689dd);VoiceQueueEvents['emit'](_0xce9bcb,_0x3689dd);_0x3b5e95(null);};}for(var e in events){if(events[_0x08a4('0x5')](e)){var event=events[e];VoiceQueue['hook'](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 7c4a85e..866cfaf 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x10648e,_0x10fd51){var _0x422b91=function(_0x19acca){while(--_0x19acca){_0x10648e['push'](_0x10648e['shift']());}};_0x422b91(++_0x10fd51);}(_0xedd9,0xfc));var _0x9edd=function(_0x1c5d8b,_0x56620b){_0x1c5d8b=_0x1c5d8b-0x0;var _0x3e216d=_0xedd9[_0x1c5d8b];return _0x3e216d;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x25092b,_0x19ea27){var _0xba3486=function(_0x16731a){while(--_0x16731a){_0x25092b['push'](_0x25092b['shift']());}};_0xba3486(++_0x19ea27);}(_0x34e8,0x12c));var _0x834e=function(_0x32c62b,_0xe89203){_0x32c62b=_0x32c62b-0x0;var _0x5ed2fa=_0x34e8[_0x32c62b];return _0x5ed2fa;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a67de9f..d664856 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 _0xe24f=['limit','include','map','model','stringify','ShowVoiceQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','localhost','socket.io-emitter','redis','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xe24f,0x7f));var _0xfe24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe24f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfe24('0x0'));var util=require(_0xfe24('0x1'));var moment=require(_0xfe24('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe24('0x3'));var fs=require('fs');var Redis=require(_0xfe24('0x4'));var db=require(_0xfe24('0x5'))['db'];var utils=require(_0xfe24('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfe24('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe24('0x8')][_0xfe24('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xfe24('0xa'),'port':0x18eb});var socket=require(_0xfe24('0xb'))(new Redis(config[_0xfe24('0xc')]));require(_0xfe24('0xd'))['register'](socket);function respondWithRpcPromise(_0x1c58f2,_0x416c95,_0x1cc4a2){return new BPromise(function(_0x43f55f,_0x355c55){return client[_0xfe24('0xe')](_0x1c58f2,_0x1cc4a2)[_0xfe24('0xf')](function(_0x30eec2){logger[_0xfe24('0x10')](_0xfe24('0x11'),_0x416c95,_0xfe24('0x12'));logger[_0xfe24('0x13')](_0xfe24('0x14'),_0x416c95,_0xfe24('0x12'),JSON['stringify'](_0x30eec2));if(_0x30eec2[_0xfe24('0x15')]){if(_0x30eec2[_0xfe24('0x15')][_0xfe24('0x16')]===0x1f4){logger[_0xfe24('0x15')](_0xfe24('0x11'),_0x416c95,_0x30eec2['error']['message']);return _0x355c55(_0x30eec2['error']['message']);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x416c95,_0x30eec2[_0xfe24('0x15')]['message']);return _0x43f55f(_0x30eec2[_0xfe24('0x15')][_0xfe24('0x17')]);}else{logger[_0xfe24('0x10')](_0xfe24('0x11'),_0x416c95,'request\x20sent');_0x43f55f(_0x30eec2[_0xfe24('0x18')][_0xfe24('0x17')]);}})[_0xfe24('0x19')](function(_0xa06b4c){logger[_0xfe24('0x15')](_0xfe24('0x11'),_0x416c95,_0xa06b4c);_0x355c55(_0xa06b4c);});});}exports[_0xfe24('0x1a')]=function(_0x25fb75){var _0x7a6c4=this;return new Promise(function(_0x125cee,_0x160ad1){return db[_0xfe24('0x1b')][_0xfe24('0x1c')]({'raw':_0x25fb75[_0xfe24('0x1d')]?_0x25fb75[_0xfe24('0x1d')][_0xfe24('0x1e')]===undefined?!![]:![]:!![],'where':_0x25fb75[_0xfe24('0x1d')]?_0x25fb75['options'][_0xfe24('0x1f')]||null:null,'attributes':_0x25fb75[_0xfe24('0x1d')]?_0x25fb75['options'][_0xfe24('0x20')]||null:null,'limit':_0x25fb75[_0xfe24('0x1d')]?_0x25fb75[_0xfe24('0x1d')][_0xfe24('0x21')]||null:null,'include':_0x25fb75[_0xfe24('0x1d')]?_0x25fb75[_0xfe24('0x1d')][_0xfe24('0x22')]?_[_0xfe24('0x23')](_0x25fb75[_0xfe24('0x1d')][_0xfe24('0x22')],function(_0x34a2a0){return{'model':db[_0x34a2a0[_0xfe24('0x24')]],'as':_0x34a2a0['as'],'attributes':_0x34a2a0[_0xfe24('0x20')],'include':_0x34a2a0[_0xfe24('0x22')]?_[_0xfe24('0x23')](_0x34a2a0[_0xfe24('0x22')],function(_0x303fa0){return{'model':db[_0x303fa0[_0xfe24('0x24')]],'as':_0x303fa0['as'],'attributes':_0x303fa0[_0xfe24('0x20')],'include':_0x303fa0[_0xfe24('0x22')]?_[_0xfe24('0x23')](_0x303fa0[_0xfe24('0x22')],function(_0x1485b6){return{'model':db[_0x1485b6[_0xfe24('0x24')]],'as':_0x1485b6['as'],'attributes':_0x1485b6[_0xfe24('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5424b2){logger[_0xfe24('0x10')](_0xfe24('0x1a'),_0x25fb75);logger[_0xfe24('0x13')](_0xfe24('0x1a'),_0x25fb75,JSON[_0xfe24('0x25')](_0x5424b2));_0x125cee(_0x5424b2);})[_0xfe24('0x19')](function(_0x4fabb4){logger['error'](_0xfe24('0x1a'),_0x4fabb4[_0xfe24('0x17')],_0x25fb75);_0x160ad1(_0x7a6c4['error'](0x1f4,_0x4fabb4['message']));});});};exports[_0xfe24('0x26')]=function(_0xb5abed){var _0xa8fb04=this;return new Promise(function(_0x27283e,_0x2cf8fa){return db[_0xfe24('0x1b')][_0xfe24('0x27')]({'raw':_0xb5abed[_0xfe24('0x1d')]?_0xb5abed['options']['raw']===undefined?!![]:![]:!![],'where':_0xb5abed[_0xfe24('0x1d')]?_0xb5abed[_0xfe24('0x1d')][_0xfe24('0x1f')]||null:null,'attributes':_0xb5abed[_0xfe24('0x1d')]?_0xb5abed['options']['attributes']||null:null,'include':_0xb5abed[_0xfe24('0x1d')]?_0xb5abed[_0xfe24('0x1d')][_0xfe24('0x22')]?_['map'](_0xb5abed[_0xfe24('0x1d')]['include'],function(_0x983a46){return{'model':db[_0x983a46[_0xfe24('0x24')]],'as':_0x983a46['as'],'attributes':_0x983a46[_0xfe24('0x20')],'include':_0x983a46[_0xfe24('0x22')]?_['map'](_0x983a46['include'],function(_0x95d3aa){return{'model':db[_0x95d3aa[_0xfe24('0x24')]],'as':_0x95d3aa['as'],'attributes':_0x95d3aa[_0xfe24('0x20')],'include':_0x95d3aa[_0xfe24('0x22')]?_[_0xfe24('0x23')](_0x95d3aa['include'],function(_0xec9dc){return{'model':db[_0xec9dc[_0xfe24('0x24')]],'as':_0xec9dc['as'],'attributes':_0xec9dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e60f4){logger['info']('ShowVoiceQueue',_0xb5abed);logger['debug'](_0xfe24('0x26'),_0xb5abed,JSON[_0xfe24('0x25')](_0x2e60f4));_0x27283e(_0x2e60f4);})['catch'](function(_0x80340f){logger[_0xfe24('0x15')](_0xfe24('0x26'),_0x80340f[_0xfe24('0x17')],_0xb5abed);_0x2cf8fa(_0xa8fb04[_0xfe24('0x15')](0x1f4,_0x80340f[_0xfe24('0x17')]));});});}; \ No newline at end of file +var _0x3bb5=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceQueue','stringify','find','ShowVoiceQueue','lodash','moment','bluebird'];(function(_0x2b42bf,_0x2f1463){var _0x23c423=function(_0x464e69){while(--_0x464e69){_0x2b42bf['push'](_0x2b42bf['shift']());}};_0x23c423(++_0x2f1463);}(_0x3bb5,0x194));var _0x53bb=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x3bb5[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x53bb('0x0'));var util=require('util');var moment=require(_0x53bb('0x1'));var BPromise=require(_0x53bb('0x2'));var rs=require(_0x53bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x53bb('0x5'))(_0x53bb('0x6'));var config=require(_0x53bb('0x7'));var jayson=require(_0x53bb('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x53bb('0x9'),'port':0x18eb});var socket=require(_0x53bb('0xa'))(new Redis(config['redis']));require(_0x53bb('0xb'))[_0x53bb('0xc')](socket);function respondWithRpcPromise(_0x53851f,_0x1473b0,_0x8006d8){return new BPromise(function(_0x4e45a1,_0xf5d9e3){return client[_0x53bb('0xd')](_0x53851f,_0x8006d8)[_0x53bb('0xe')](function(_0xef90e5){logger[_0x53bb('0xf')](_0x53bb('0x10'),_0x1473b0,_0x53bb('0x11'));logger[_0x53bb('0x12')](_0x53bb('0x13'),_0x1473b0,_0x53bb('0x11'),JSON['stringify'](_0xef90e5));if(_0xef90e5[_0x53bb('0x14')]){if(_0xef90e5[_0x53bb('0x14')][_0x53bb('0x15')]===0x1f4){logger['error'](_0x53bb('0x10'),_0x1473b0,_0xef90e5[_0x53bb('0x14')]['message']);return _0xf5d9e3(_0xef90e5[_0x53bb('0x14')][_0x53bb('0x16')]);}logger[_0x53bb('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x1473b0,_0xef90e5['error'][_0x53bb('0x16')]);return _0x4e45a1(_0xef90e5[_0x53bb('0x14')][_0x53bb('0x16')]);}else{logger[_0x53bb('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x1473b0,_0x53bb('0x11'));_0x4e45a1(_0xef90e5['result'][_0x53bb('0x16')]);}})[_0x53bb('0x17')](function(_0x11298c){logger['error'](_0x53bb('0x10'),_0x1473b0,_0x11298c);_0xf5d9e3(_0x11298c);});});}exports['GetVoiceQueue']=function(_0x477352){var _0x5e9afa=this;return new Promise(function(_0xd5ed25,_0x5b7b80){return db['VoiceQueue'][_0x53bb('0x18')]({'raw':_0x477352[_0x53bb('0x19')]?_0x477352[_0x53bb('0x19')][_0x53bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x477352['options']?_0x477352[_0x53bb('0x19')][_0x53bb('0x1b')]||null:null,'attributes':_0x477352[_0x53bb('0x19')]?_0x477352[_0x53bb('0x19')]['attributes']||null:null,'limit':_0x477352[_0x53bb('0x19')]?_0x477352[_0x53bb('0x19')][_0x53bb('0x1c')]||null:null,'include':_0x477352['options']?_0x477352['options'][_0x53bb('0x1d')]?_[_0x53bb('0x1e')](_0x477352[_0x53bb('0x19')][_0x53bb('0x1d')],function(_0x23fe28){return{'model':db[_0x23fe28['model']],'as':_0x23fe28['as'],'attributes':_0x23fe28['attributes'],'include':_0x23fe28['include']?_[_0x53bb('0x1e')](_0x23fe28[_0x53bb('0x1d')],function(_0x4902a9){return{'model':db[_0x4902a9[_0x53bb('0x1f')]],'as':_0x4902a9['as'],'attributes':_0x4902a9[_0x53bb('0x20')],'include':_0x4902a9['include']?_[_0x53bb('0x1e')](_0x4902a9[_0x53bb('0x1d')],function(_0x1d6a33){return{'model':db[_0x1d6a33[_0x53bb('0x1f')]],'as':_0x1d6a33['as'],'attributes':_0x1d6a33[_0x53bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x53bb('0xe')](function(_0x193725){logger[_0x53bb('0xf')](_0x53bb('0x21'),_0x477352);logger['debug'](_0x53bb('0x21'),_0x477352,JSON[_0x53bb('0x22')](_0x193725));_0xd5ed25(_0x193725);})[_0x53bb('0x17')](function(_0x4136f0){logger[_0x53bb('0x14')](_0x53bb('0x21'),_0x4136f0[_0x53bb('0x16')],_0x477352);_0x5b7b80(_0x5e9afa['error'](0x1f4,_0x4136f0[_0x53bb('0x16')]));});});};exports['ShowVoiceQueue']=function(_0xf49d59){var _0x2ac266=this;return new Promise(function(_0x309f9d,_0x1e0bcd){return db['VoiceQueue'][_0x53bb('0x23')]({'raw':_0xf49d59[_0x53bb('0x19')]?_0xf49d59['options'][_0x53bb('0x1a')]===undefined?!![]:![]:!![],'where':_0xf49d59[_0x53bb('0x19')]?_0xf49d59[_0x53bb('0x19')][_0x53bb('0x1b')]||null:null,'attributes':_0xf49d59['options']?_0xf49d59['options']['attributes']||null:null,'include':_0xf49d59['options']?_0xf49d59['options'][_0x53bb('0x1d')]?_['map'](_0xf49d59[_0x53bb('0x19')][_0x53bb('0x1d')],function(_0x498ed1){return{'model':db[_0x498ed1[_0x53bb('0x1f')]],'as':_0x498ed1['as'],'attributes':_0x498ed1[_0x53bb('0x20')],'include':_0x498ed1[_0x53bb('0x1d')]?_[_0x53bb('0x1e')](_0x498ed1[_0x53bb('0x1d')],function(_0x553b7e){return{'model':db[_0x553b7e[_0x53bb('0x1f')]],'as':_0x553b7e['as'],'attributes':_0x553b7e[_0x53bb('0x20')],'include':_0x553b7e[_0x53bb('0x1d')]?_[_0x53bb('0x1e')](_0x553b7e['include'],function(_0x3517d6){return{'model':db[_0x3517d6[_0x53bb('0x1f')]],'as':_0x3517d6['as'],'attributes':_0x3517d6[_0x53bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x53bb('0xe')](function(_0x5175bd){logger[_0x53bb('0xf')](_0x53bb('0x24'),_0xf49d59);logger[_0x53bb('0x12')]('ShowVoiceQueue',_0xf49d59,JSON[_0x53bb('0x22')](_0x5175bd));_0x309f9d(_0x5175bd);})[_0x53bb('0x17')](function(_0x4e2255){logger[_0x53bb('0x14')](_0x53bb('0x24'),_0x4e2255[_0x53bb('0x16')],_0xf49d59);_0x1e0bcd(_0x2ac266[_0x53bb('0x14')](0x1f4,_0x4e2255['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8fc45c5..32a3204 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 _0x8bf7=['remove','update','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2c3cda,_0x296eea){var _0x5f47fa=function(_0x2fc38f){while(--_0x2fc38f){_0x2c3cda['push'](_0x2c3cda['shift']());}};_0x5f47fa(++_0x296eea);}(_0x8bf7,0x146));var _0x78bf=function(_0x33d724,_0x3680e7){_0x33d724=_0x33d724-0x0;var _0x224122=_0x8bf7[_0x33d724];return _0x224122;};'use strict';var VoiceQueueEvents=require(_0x78bf('0x0'));var events=[_0x78bf('0x1'),_0x78bf('0x2'),_0x78bf('0x3')];function createListener(_0x16e6e8,_0x5a9152){return function(_0x410d40){_0x5a9152['emit'](_0x16e6e8,_0x410d40);};}function removeListener(_0x468f67,_0x24a893){return function(){VoiceQueueEvents[_0x78bf('0x4')](_0x468f67,_0x24a893);};}exports[_0x78bf('0x5')]=function(_0x2ec924){for(var _0x3a0a23=0x0,_0x127eed=events[_0x78bf('0x6')];_0x3a0a23<_0x127eed;_0x3a0a23++){var _0x595a97=events[_0x3a0a23];var _0x1213a7=createListener(_0x78bf('0x7')+_0x595a97,_0x2ec924);VoiceQueueEvents['on'](_0x595a97,_0x1213a7);}}; \ No newline at end of file +var _0xd980=['save','update','emit','register','voiceQueue:'];(function(_0x457396,_0xd656b6){var _0x57416a=function(_0x1b4ee0){while(--_0x1b4ee0){_0x457396['push'](_0x457396['shift']());}};_0x57416a(++_0xd656b6);}(_0xd980,0x1e0));var _0x0d98=function(_0xbfbbc9,_0x309058){_0xbfbbc9=_0xbfbbc9-0x0;var _0xd63748=_0xd980[_0xbfbbc9];return _0xd63748;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x0d98('0x0'),'remove',_0x0d98('0x1')];function createListener(_0x302e8c,_0x3e66f5){return function(_0x362f58){_0x3e66f5[_0x0d98('0x2')](_0x302e8c,_0x362f58);};}function removeListener(_0x4d111a,_0x449d10){return function(){VoiceQueueEvents['removeListener'](_0x4d111a,_0x449d10);};}exports[_0x0d98('0x3')]=function(_0x40cb91){for(var _0xb42225=0x0,_0x2abedc=events['length'];_0xb42225<_0x2abedc;_0xb42225++){var _0x3f8d5b=events[_0xb42225];var _0x17d5e3=createListener(_0x0d98('0x4')+_0x3f8d5b,_0x40cb91);VoiceQueueEvents['on'](_0x3f8d5b,_0x17d5e3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0b2308a..7dcc7b0 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 _0x4534=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','getVoiceQueuesReport','/:id','post','create'];(function(_0x40710f,_0x3f145e){var _0x591385=function(_0x1615e4){while(--_0x1615e4){_0x40710f['push'](_0x40710f['shift']());}};_0x591385(++_0x3f145e);}(_0x4534,0x1ca));var _0x4453=function(_0x4773a6,_0x248eae){_0x4773a6=_0x4773a6-0x0;var _0x101e30=_0x4534[_0x4773a6];return _0x101e30;};'use strict';var multer=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var path=require(_0x4453('0x2'));var timeout=require('connect-timeout');var express=require(_0x4453('0x3'));var router=express[_0x4453('0x4')]();var fs_extra=require(_0x4453('0x5'));var auth=require(_0x4453('0x6'));var interaction=require(_0x4453('0x7'));var config=require(_0x4453('0x8'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x4453('0x9')](),controller[_0x4453('0xa')]);router['get'](_0x4453('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4453('0xc')]('/index',auth['isAuthenticated'](),controller[_0x4453('0xd')]);router[_0x4453('0xc')](_0x4453('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x4453('0xf')]('/',auth['isAuthenticated'](),controller[_0x4453('0x10')]);router['put'](_0x4453('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4453('0xe'),auth['isAuthenticated'](),controller[_0x4453('0x11')]);module[_0x4453('0x12')]=router; \ No newline at end of file +var _0x44bb=['./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','/:id','show','post','create','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3213b4,_0x3cddd0){var _0xa97785=function(_0x3c9282){while(--_0x3c9282){_0x3213b4['push'](_0x3213b4['shift']());}};_0xa97785(++_0x3cddd0);}(_0x44bb,0x19b));var _0xb44b=function(_0x30f7d2,_0x462010){_0x30f7d2=_0x30f7d2-0x0;var _0x29fc40=_0x44bb[_0x30f7d2];return _0x29fc40;};'use strict';var multer=require('multer');var util=require(_0xb44b('0x0'));var path=require(_0xb44b('0x1'));var timeout=require(_0xb44b('0x2'));var express=require(_0xb44b('0x3'));var router=express[_0xb44b('0x4')]();var fs_extra=require(_0xb44b('0x5'));var auth=require(_0xb44b('0x6'));var interaction=require(_0xb44b('0x7'));var config=require(_0xb44b('0x8'));var controller=require(_0xb44b('0x9'));router[_0xb44b('0xa')]('/',auth[_0xb44b('0xb')](),controller[_0xb44b('0xc')]);router[_0xb44b('0xa')]('/describe',auth[_0xb44b('0xb')](),controller[_0xb44b('0xd')]);router[_0xb44b('0xa')](_0xb44b('0xe'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xb44b('0xa')](_0xb44b('0xf'),auth[_0xb44b('0xb')](),controller[_0xb44b('0x10')]);router[_0xb44b('0x11')]('/',auth[_0xb44b('0xb')](),controller[_0xb44b('0x12')]);router['put'](_0xb44b('0xf'),auth['isAuthenticated'](),controller[_0xb44b('0x13')]);router['delete'](_0xb44b('0xf'),auth[_0xb44b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index f3df12e..5a984aa 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 _0xb6c7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x1896af,_0x2cf9f3){var _0x2421b0=function(_0x513351){while(--_0x513351){_0x1896af['push'](_0x1896af['shift']());}};_0x2421b0(++_0x2cf9f3);}(_0xb6c7,0x131));var _0x7b6c=function(_0x2830be,_0x38dc39){_0x2830be=_0x2830be-0x0;var _0x4e9ccd=_0xb6c7[_0x2830be];return _0x4e9ccd;};'use strict';var Sequelize=require(_0x7b6c('0x0'));var moment=require(_0x7b6c('0x1'));module[_0x7b6c('0x2')]={'type':{'type':Sequelize[_0x7b6c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7b6c('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7b6c('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x7b6c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b6c('0x4')],'set':function(_0x18c755){var _0x5a568e=moment(_0x18c755);var _0x19351c=moment(this[_0x7b6c('0x5')](_0x7b6c('0x6')))['format'](_0x7b6c('0x7'));var _0x2fe0c1=_0x5a568e['diff'](_0x19351c,_0x7b6c('0x8'));this[_0x7b6c('0x9')](_0x7b6c('0xa'),_0x18c755);this[_0x7b6c('0x9')](_0x7b6c('0xb'),_0x2fe0c1||null);}},'position':{'type':Sequelize[_0x7b6c('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b6c('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b6c('0x4')]},'queuecallerexit':{'type':Sequelize[_0x7b6c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b6c('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x7b6c('0x3')],'comment':_0x7b6c('0xe')},'originalposition':{'type':Sequelize[_0x7b6c('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7b6c('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b6c('0x3')]},'context':{'type':Sequelize[_0x7b6c('0x3')]},'exten':{'type':Sequelize[_0x7b6c('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x7b6c('0xc')]},'mohtime':{'type':Sequelize[_0x7b6c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b6c('0x3')]},'transfer':{'type':Sequelize[_0x7b6c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7b6c('0x3')],'comment':_0x7b6c('0xf')},'transferexten':{'type':Sequelize[_0x7b6c('0x3')]},'transferuniqueid':{'type':Sequelize[_0x7b6c('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7b6c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7b6c('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa565=['STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x18b024,_0xca43be){var _0x20745d=function(_0x29630f){while(--_0x29630f){_0x18b024['push'](_0x18b024['shift']());}};_0x20745d(++_0xca43be);}(_0xa565,0x176));var _0x5a56=function(_0x12e7a4,_0x4b2da3){_0x12e7a4=_0x12e7a4-0x0;var _0x1a9701=_0xa565[_0x12e7a4];return _0x1a9701;};'use strict';var Sequelize=require(_0x5a56('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x5a56('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5a56('0x1')]},'calleridname':{'type':Sequelize[_0x5a56('0x1')]},'queue':{'type':Sequelize[_0x5a56('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x5a56('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x5a56('0x2')],'set':function(_0x4293fb){var _0xb9399e=moment(_0x4293fb);var _0x4cee14=moment(this[_0x5a56('0x3')](_0x5a56('0x4')))[_0x5a56('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2a2deb=_0xb9399e[_0x5a56('0x6')](_0x4cee14,_0x5a56('0x7'));this[_0x5a56('0x8')](_0x5a56('0x9'),_0x4293fb);this[_0x5a56('0x8')](_0x5a56('0xa'),_0x2a2deb||null);}},'position':{'type':Sequelize[_0x5a56('0xb')]},'count':{'type':Sequelize[_0x5a56('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x5a56('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5a56('0x2')]},'queuecallerexit':{'type':Sequelize[_0x5a56('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x5a56('0x1')],'comment':_0x5a56('0xd')},'originalposition':{'type':Sequelize[_0x5a56('0xb')]},'channel':{'type':Sequelize[_0x5a56('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5a56('0x1')]},'connectedlinename':{'type':Sequelize[_0x5a56('0x1')]},'accountcode':{'type':Sequelize[_0x5a56('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5a56('0x1')]},'priority':{'type':Sequelize[_0x5a56('0x1')]},'holdtime':{'type':Sequelize[_0x5a56('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5a56('0x1')]},'transfer':{'type':Sequelize[_0x5a56('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5a56('0x1')],'comment':_0x5a56('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5a56('0x1')]},'secondDisposition':{'type':Sequelize[_0x5a56('0x1')]},'thirdDisposition':{'type':Sequelize[_0x5a56('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x5a56('0xb')],'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 5ded151..6a6644c 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 _0x4846=['name','send','map','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','includeAll','include','VoiceQueueReport','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','getVoiceQueuesReport','filter','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x569037,_0x370934){var _0x38c42d=function(_0x5bb26a){while(--_0x5bb26a){_0x569037['push'](_0x569037['shift']());}};_0x38c42d(++_0x370934);}(_0x4846,0x6b));var _0x6484=function(_0x54941f,_0x4bde75){_0x54941f=_0x54941f-0x0;var _0x3e359e=_0x4846[_0x54941f];return _0x3e359e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6484('0x0'));var zipdir=require(_0x6484('0x1'));var jsonpatch=require(_0x6484('0x2'));var rp=require('request-promise');var moment=require(_0x6484('0x3'));var BPromise=require(_0x6484('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6484('0x5'));var sox=require(_0x6484('0x6'));var csv=require(_0x6484('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6484('0x8'));var _=require('lodash');var squel=require(_0x6484('0x9'));var crypto=require(_0x6484('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6484('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6484('0xc'));var Papa=require(_0x6484('0xd'));var Redis=require('ioredis');var authService=require(_0x6484('0xe'));var qs=require(_0x6484('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6484('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x6484('0x11'));var licenseUtil=require(_0x6484('0x12'));var db=require(_0x6484('0x13'))['db'];config[_0x6484('0x14')]=_[_0x6484('0x15')](config[_0x6484('0x14')],{'host':_0x6484('0x16'),'port':0x18eb});var socket=require(_0x6484('0x17'))(new Redis(config[_0x6484('0x14')]));require(_0x6484('0x18'))['register'](socket);function respondWithStatusCode(_0x28bd92,_0x4a3f14){_0x4a3f14=_0x4a3f14||0xcc;return function(_0x33a89f){if(_0x33a89f){return _0x28bd92[_0x6484('0x19')](_0x4a3f14);}return _0x28bd92[_0x6484('0x1a')](_0x4a3f14)[_0x6484('0x1b')]();};}function respondWithResult(_0x3f8bdd,_0x77b880){_0x77b880=_0x77b880||0xc8;return function(_0x1236f3){if(_0x1236f3){return _0x3f8bdd[_0x6484('0x1a')](_0x77b880)[_0x6484('0x1c')](_0x1236f3);}};}function respondWithFilteredResult(_0x55966f,_0xa0126){return function(_0x23d52a){if(_0x23d52a){var _0x51d070=typeof _0xa0126[_0x6484('0x1d')]==='undefined'&&typeof _0xa0126[_0x6484('0x1e')]===_0x6484('0x1f');var _0x1332c7=_0x23d52a[_0x6484('0x20')];var _0x5eb66c=_0x51d070?0x0:_0xa0126[_0x6484('0x1d')];var _0x35b1a8=_0x51d070?_0x23d52a['count']:_0xa0126['offset']+_0xa0126[_0x6484('0x1e')];var _0x21b063;if(_0x35b1a8>=_0x1332c7){_0x35b1a8=_0x1332c7;_0x21b063=0xc8;}else{_0x21b063=0xce;}_0x55966f[_0x6484('0x1a')](_0x21b063);return _0x55966f[_0x6484('0x21')](_0x6484('0x22'),_0x5eb66c+'-'+_0x35b1a8+'/'+_0x1332c7)[_0x6484('0x1c')](_0x23d52a);}return null;};}function patchUpdates(_0x5253b8){return function(_0x50af62){try{jsonpatch[_0x6484('0x23')](_0x50af62,_0x5253b8,!![]);}catch(_0x2e3925){return BPromise['reject'](_0x2e3925);}return _0x50af62[_0x6484('0x24')]();};}function saveUpdates(_0xccd61a,_0x422f70){return function(_0x133fab){if(_0x133fab){return _0x133fab[_0x6484('0x25')](_0xccd61a)[_0x6484('0x26')](function(_0x3580d5){return _0x3580d5;});}return null;};}function removeEntity(_0x2df1bc,_0x1b099f){return function(_0x145237){if(_0x145237){return _0x145237[_0x6484('0x27')]()[_0x6484('0x26')](function(){_0x2df1bc[_0x6484('0x1a')](0xcc)[_0x6484('0x1b')]();});}};}function handleEntityNotFound(_0x38eda2,_0x5830a6){return function(_0x1edd42){if(!_0x1edd42){_0x38eda2[_0x6484('0x19')](0x194);}return _0x1edd42;};}function handleError(_0x400a76,_0x2a9edc){_0x2a9edc=_0x2a9edc||0x1f4;return function(_0x1ecf40){logger[_0x6484('0x28')](_0x1ecf40['stack']);if(_0x1ecf40[_0x6484('0x29')]){delete _0x1ecf40[_0x6484('0x29')];}_0x400a76[_0x6484('0x1a')](_0x2a9edc)[_0x6484('0x2a')](_0x1ecf40);};}exports['index']=function(_0x781bb7,_0x2d2502){var _0xf45c8f={},_0x334661={},_0x23b2b6={'count':0x0,'rows':[]};var _0x556cf4=_[_0x6484('0x2b')](db['VoiceQueueReport']['rawAttributes'],function(_0x568a9f){return{'name':_0x568a9f['fieldName'],'type':_0x568a9f[_0x6484('0x2c')]['key']};});_0x334661[_0x6484('0x2d')]=_[_0x6484('0x2b')](_0x556cf4,'name');_0x334661[_0x6484('0x2e')]=_[_0x6484('0x2f')](_0x781bb7['query']);_0x334661[_0x6484('0x30')]=_[_0x6484('0x31')](_0x334661[_0x6484('0x2d')],_0x334661['query']);_0xf45c8f[_0x6484('0x32')]=_[_0x6484('0x31')](_0x334661[_0x6484('0x2d')],qs['fields'](_0x781bb7[_0x6484('0x2e')][_0x6484('0x33')]));_0xf45c8f[_0x6484('0x32')]=_0xf45c8f['attributes'][_0x6484('0x34')]?_0xf45c8f[_0x6484('0x32')]:_0x334661[_0x6484('0x2d')];if(!_0x781bb7[_0x6484('0x2e')][_0x6484('0x35')](_0x6484('0x36'))){_0xf45c8f[_0x6484('0x1e')]=qs[_0x6484('0x1e')](_0x781bb7['query']['limit']);_0xf45c8f[_0x6484('0x1d')]=qs['offset'](_0x781bb7[_0x6484('0x2e')]['offset']);}_0xf45c8f['order']=qs[_0x6484('0x37')](_0x781bb7[_0x6484('0x2e')][_0x6484('0x37')]);_0xf45c8f['where']=qs['filters'](_['pick'](_0x781bb7[_0x6484('0x2e')],_0x334661[_0x6484('0x30')]),_0x556cf4);if(_0x781bb7[_0x6484('0x2e')]['filter']){_0xf45c8f[_0x6484('0x38')]=_[_0x6484('0x39')](_0xf45c8f[_0x6484('0x38')],{'$or':_[_0x6484('0x2b')](_0x556cf4,function(_0x27224f){if(_0x27224f[_0x6484('0x2c')]!=='VIRTUAL'){var _0x1ba44a={};_0x1ba44a[_0x27224f[_0x6484('0x29')]]={'$like':'%'+_0x781bb7[_0x6484('0x2e')]['filter']+'%'};return _0x1ba44a;}})});}_0xf45c8f=_['merge']({},_0xf45c8f,_0x781bb7['options']);var _0x226f5f={'where':_0xf45c8f[_0x6484('0x38')]};return db['VoiceQueueReport'][_0x6484('0x20')](_0x226f5f)['then'](function(_0x11b3ee){_0x23b2b6['count']=_0x11b3ee;if(_0x781bb7[_0x6484('0x2e')][_0x6484('0x3a')]){_0xf45c8f[_0x6484('0x3b')]=[{'all':!![]}];}return db[_0x6484('0x3c')][_0x6484('0x3d')](_0xf45c8f);})[_0x6484('0x26')](function(_0xcaa8b9){_0x23b2b6[_0x6484('0x3e')]=_0xcaa8b9;return _0x23b2b6;})[_0x6484('0x26')](respondWithFilteredResult(_0x2d2502,_0xf45c8f))[_0x6484('0x3f')](handleError(_0x2d2502,null));};exports[_0x6484('0x40')]=function(_0x3ca7f5,_0x1cd2ea){var _0x5183dc={'raw':![],'where':{'id':_0x3ca7f5[_0x6484('0x41')]['id']}},_0x42d1e1={};_0x42d1e1[_0x6484('0x2d')]=_['keys'](db[_0x6484('0x3c')][_0x6484('0x42')]);_0x42d1e1[_0x6484('0x2e')]=_['keys'](_0x3ca7f5[_0x6484('0x2e')]);_0x42d1e1[_0x6484('0x30')]=_[_0x6484('0x31')](_0x42d1e1[_0x6484('0x2d')],_0x42d1e1[_0x6484('0x2e')]);_0x5183dc[_0x6484('0x32')]=_[_0x6484('0x31')](_0x42d1e1[_0x6484('0x2d')],qs[_0x6484('0x33')](_0x3ca7f5[_0x6484('0x2e')][_0x6484('0x33')]));_0x5183dc[_0x6484('0x32')]=_0x5183dc[_0x6484('0x32')][_0x6484('0x34')]?_0x5183dc[_0x6484('0x32')]:_0x42d1e1[_0x6484('0x2d')];if(_0x3ca7f5[_0x6484('0x2e')][_0x6484('0x3a')]){_0x5183dc[_0x6484('0x3b')]=[{'all':!![]}];}_0x5183dc=_['merge']({},_0x5183dc,_0x3ca7f5[_0x6484('0x43')]);return db['VoiceQueueReport'][_0x6484('0x44')](_0x5183dc)['then'](handleEntityNotFound(_0x1cd2ea,null))[_0x6484('0x26')](respondWithResult(_0x1cd2ea,null))['catch'](handleError(_0x1cd2ea,null));};exports['create']=function(_0x27ab8c,_0x7f5b){return db[_0x6484('0x3c')][_0x6484('0x45')](_0x27ab8c[_0x6484('0x46')],{})[_0x6484('0x26')](respondWithResult(_0x7f5b,0xc9))[_0x6484('0x3f')](handleError(_0x7f5b,null));};exports[_0x6484('0x25')]=function(_0x430b32,_0xecaf52){if(_0x430b32[_0x6484('0x46')]['id']){delete _0x430b32[_0x6484('0x46')]['id'];}return db[_0x6484('0x3c')]['find']({'where':{'id':_0x430b32['params']['id']}})[_0x6484('0x26')](handleEntityNotFound(_0xecaf52,null))[_0x6484('0x26')](saveUpdates(_0x430b32[_0x6484('0x46')],null))[_0x6484('0x26')](respondWithResult(_0xecaf52,null))['catch'](handleError(_0xecaf52,null));};exports['destroy']=function(_0x5254fe,_0x336a55){return db[_0x6484('0x3c')][_0x6484('0x44')]({'where':{'id':_0x5254fe[_0x6484('0x41')]['id']}})[_0x6484('0x26')](handleEntityNotFound(_0x336a55,null))['then'](removeEntity(_0x336a55,null))[_0x6484('0x3f')](handleError(_0x336a55,null));};exports[_0x6484('0x47')]=function(_0x2c01ad,_0x5f5514){return db['VoiceQueueReport'][_0x6484('0x47')]()['then'](respondWithResult(_0x5f5514,null))['catch'](handleError(_0x5f5514,null));};exports[_0x6484('0x48')]=function(_0xcf58d0,_0x11d611){var _0x34d0fc={},_0x134c7c={},_0x29a2fc={'count':0x0,'rows':[]};_0x134c7c[_0x6484('0x2d')]=_['keys'](db[_0x6484('0x3c')][_0x6484('0x42')]);_0x134c7c[_0x6484('0x2e')]=_['keys'](_0xcf58d0[_0x6484('0x2e')]);_0x134c7c[_0x6484('0x30')]=_[_0x6484('0x31')](_0x134c7c['model'],_0x134c7c[_0x6484('0x2e')]);_0x34d0fc[_0x6484('0x32')]=_[_0x6484('0x31')](_0x134c7c[_0x6484('0x2d')],qs[_0x6484('0x33')](_0xcf58d0[_0x6484('0x2e')][_0x6484('0x33')]));_0x34d0fc[_0x6484('0x32')]=_0x34d0fc[_0x6484('0x32')]['length']?_0x34d0fc[_0x6484('0x32')]:_0x134c7c['model'];if(!_0xcf58d0[_0x6484('0x2e')]['hasOwnProperty'](_0x6484('0x36'))){_0x34d0fc['limit']=qs['limit'](_0xcf58d0[_0x6484('0x2e')]['limit']);_0x34d0fc[_0x6484('0x1d')]=qs[_0x6484('0x1d')](_0xcf58d0[_0x6484('0x2e')][_0x6484('0x1d')]);}_0x34d0fc['order']=qs[_0x6484('0x37')](_0xcf58d0['query'][_0x6484('0x37')]);_0x34d0fc[_0x6484('0x38')]=qs['filters'](_['pick'](_0xcf58d0[_0x6484('0x2e')],_0x134c7c['filters']));if(_0xcf58d0['query'][_0x6484('0x49')]){_0x34d0fc[_0x6484('0x38')]=_[_0x6484('0x39')](_0x34d0fc['where'],{'$or':_['map'](_0x34d0fc['attributes'],function(_0x869ad7){var _0x2dab8f={};_0x2dab8f[_0x869ad7]={'$like':'%'+_0xcf58d0[_0x6484('0x2e')]['filter']+'%'};return _0x2dab8f;})});}_0x34d0fc=_[_0x6484('0x39')]({},_0x34d0fc,_0xcf58d0[_0x6484('0x43')]);var _0x3315d6={'where':_0x34d0fc[_0x6484('0x38')]};return db['VoiceQueueReport'][_0x6484('0x20')](_0x3315d6)[_0x6484('0x26')](function(_0x16e0a9){_0x29a2fc[_0x6484('0x20')]=_0x16e0a9;if(_0xcf58d0[_0x6484('0x2e')][_0x6484('0x3a')]){_0x34d0fc[_0x6484('0x3b')]=[{'all':!![]}];}return db[_0x6484('0x3c')][_0x6484('0x3d')](_0x34d0fc);})[_0x6484('0x26')](function(_0x5e5c76){_0x29a2fc[_0x6484('0x3e')]=_0x5e5c76;return _0x29a2fc;})['then'](respondWithFilteredResult(_0x11d611,_0x34d0fc,_0x6484('0x48')))[_0x6484('0x3f')](handleError(_0x11d611,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xb7a4=['bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./voiceQueueReport.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','sendStatus','error','name','index','map','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','findAll','catch','show','rawAttributes','include','create','body','find','params','describe','getVoiceQueuesReport','eml-format','rimraf','request-promise'];(function(_0x380529,_0x547b03){var _0x450f4b=function(_0x403fcc){while(--_0x403fcc){_0x380529['push'](_0x380529['shift']());}};_0x450f4b(++_0x547b03);}(_0xb7a4,0x9b));var _0x4b7a=function(_0x54d944,_0x49dc36){_0x54d944=_0x54d944-0x0;var _0x260a14=_0xb7a4[_0x54d944];return _0x260a14;};'use strict';var emlformat=require(_0x4b7a('0x0'));var rimraf=require(_0x4b7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4b7a('0x2'));var moment=require('moment');var BPromise=require(_0x4b7a('0x3'));var Mustache=require(_0x4b7a('0x4'));var util=require('util');var path=require(_0x4b7a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b7a('0x6'));var fs=require('fs');var fs_extra=require(_0x4b7a('0x7'));var _=require(_0x4b7a('0x8'));var squel=require(_0x4b7a('0x9'));var crypto=require(_0x4b7a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4b7a('0xb'));var toCsv=require(_0x4b7a('0xc'));var querystring=require(_0x4b7a('0xd'));var Papa=require(_0x4b7a('0xe'));var Redis=require(_0x4b7a('0xf'));var authService=require(_0x4b7a('0x10'));var qs=require(_0x4b7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b7a('0x12'))(_0x4b7a('0x13'));var utils=require(_0x4b7a('0x14'));var config=require(_0x4b7a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b7a('0x16'))['db'];config[_0x4b7a('0x17')]=_[_0x4b7a('0x18')](config[_0x4b7a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b7a('0x17')]));require(_0x4b7a('0x19'))[_0x4b7a('0x1a')](socket);function respondWithStatusCode(_0x445be8,_0x25cd65){_0x25cd65=_0x25cd65||0xcc;return function(_0x14cadb){if(_0x14cadb){return _0x445be8['sendStatus'](_0x25cd65);}return _0x445be8['status'](_0x25cd65)['end']();};}function respondWithResult(_0x377ee7,_0xb883b1){_0xb883b1=_0xb883b1||0xc8;return function(_0x2df0b5){if(_0x2df0b5){return _0x377ee7[_0x4b7a('0x1b')](_0xb883b1)[_0x4b7a('0x1c')](_0x2df0b5);}};}function respondWithFilteredResult(_0x30353a,_0x2f7bd1){return function(_0x387b01){if(_0x387b01){var _0x5b9668=typeof _0x2f7bd1[_0x4b7a('0x1d')]===_0x4b7a('0x1e')&&typeof _0x2f7bd1[_0x4b7a('0x1f')]===_0x4b7a('0x1e');var _0x27068e=_0x387b01[_0x4b7a('0x20')];var _0x328747=_0x5b9668?0x0:_0x2f7bd1[_0x4b7a('0x1d')];var _0x3d4c91=_0x5b9668?_0x387b01['count']:_0x2f7bd1[_0x4b7a('0x1d')]+_0x2f7bd1['limit'];var _0x23c673;if(_0x3d4c91>=_0x27068e){_0x3d4c91=_0x27068e;_0x23c673=0xc8;}else{_0x23c673=0xce;}_0x30353a[_0x4b7a('0x1b')](_0x23c673);return _0x30353a[_0x4b7a('0x21')]('Content-Range',_0x328747+'-'+_0x3d4c91+'/'+_0x27068e)[_0x4b7a('0x1c')](_0x387b01);}return null;};}function patchUpdates(_0x116cdc){return function(_0x5d09aa){try{jsonpatch[_0x4b7a('0x22')](_0x5d09aa,_0x116cdc,!![]);}catch(_0x2b1b77){return BPromise[_0x4b7a('0x23')](_0x2b1b77);}return _0x5d09aa[_0x4b7a('0x24')]();};}function saveUpdates(_0x1b9e3a,_0x482db2){return function(_0x1c40af){if(_0x1c40af){return _0x1c40af[_0x4b7a('0x25')](_0x1b9e3a)['then'](function(_0x424da6){return _0x424da6;});}return null;};}function removeEntity(_0x17d487,_0x42f3a8){return function(_0x1c60d9){if(_0x1c60d9){return _0x1c60d9[_0x4b7a('0x26')]()['then'](function(){_0x17d487['status'](0xcc)[_0x4b7a('0x27')]();});}};}function handleEntityNotFound(_0x490fe,_0x5375b3){return function(_0x44b7f2){if(!_0x44b7f2){_0x490fe[_0x4b7a('0x28')](0x194);}return _0x44b7f2;};}function handleError(_0x4b3bd1,_0x407f6f){_0x407f6f=_0x407f6f||0x1f4;return function(_0x1c6f31){logger[_0x4b7a('0x29')](_0x1c6f31['stack']);if(_0x1c6f31[_0x4b7a('0x2a')]){delete _0x1c6f31[_0x4b7a('0x2a')];}_0x4b3bd1['status'](_0x407f6f)['send'](_0x1c6f31);};}exports[_0x4b7a('0x2b')]=function(_0x2dd875,_0x4f0d17){var _0x515867={},_0x2e5b45={},_0x50de4b={'count':0x0,'rows':[]};var _0x34cd05=_[_0x4b7a('0x2c')](db[_0x4b7a('0x2d')]['rawAttributes'],function(_0x4b475f){return{'name':_0x4b475f[_0x4b7a('0x2e')],'type':_0x4b475f[_0x4b7a('0x2f')][_0x4b7a('0x30')]};});_0x2e5b45[_0x4b7a('0x31')]=_['map'](_0x34cd05,_0x4b7a('0x2a'));_0x2e5b45[_0x4b7a('0x32')]=_[_0x4b7a('0x33')](_0x2dd875['query']);_0x2e5b45[_0x4b7a('0x34')]=_[_0x4b7a('0x35')](_0x2e5b45[_0x4b7a('0x31')],_0x2e5b45[_0x4b7a('0x32')]);_0x515867[_0x4b7a('0x36')]=_[_0x4b7a('0x35')](_0x2e5b45['model'],qs[_0x4b7a('0x37')](_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x37')]));_0x515867['attributes']=_0x515867[_0x4b7a('0x36')][_0x4b7a('0x38')]?_0x515867[_0x4b7a('0x36')]:_0x2e5b45[_0x4b7a('0x31')];if(!_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x39')](_0x4b7a('0x3a'))){_0x515867[_0x4b7a('0x1f')]=qs[_0x4b7a('0x1f')](_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x1f')]);_0x515867[_0x4b7a('0x1d')]=qs[_0x4b7a('0x1d')](_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x1d')]);}_0x515867[_0x4b7a('0x3b')]=qs[_0x4b7a('0x3c')](_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x3c')]);_0x515867[_0x4b7a('0x3d')]=qs[_0x4b7a('0x34')](_[_0x4b7a('0x3e')](_0x2dd875[_0x4b7a('0x32')],_0x2e5b45[_0x4b7a('0x34')]),_0x34cd05);if(_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x3f')]){_0x515867['where']=_[_0x4b7a('0x40')](_0x515867[_0x4b7a('0x3d')],{'$or':_['map'](_0x34cd05,function(_0x1de005){if(_0x1de005[_0x4b7a('0x2f')]!=='VIRTUAL'){var _0x10846f={};_0x10846f[_0x1de005[_0x4b7a('0x2a')]]={'$like':'%'+_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x3f')]+'%'};return _0x10846f;}})});}_0x515867=_['merge']({},_0x515867,_0x2dd875[_0x4b7a('0x41')]);var _0x3910e3={'where':_0x515867[_0x4b7a('0x3d')]};return db['VoiceQueueReport']['count'](_0x3910e3)[_0x4b7a('0x42')](function(_0x54e3d7){_0x50de4b[_0x4b7a('0x20')]=_0x54e3d7;if(_0x2dd875[_0x4b7a('0x32')][_0x4b7a('0x43')]){_0x515867['include']=[{'all':!![]}];}return db[_0x4b7a('0x2d')][_0x4b7a('0x44')](_0x515867);})['then'](function(_0x16339a){_0x50de4b['rows']=_0x16339a;return _0x50de4b;})[_0x4b7a('0x42')](respondWithFilteredResult(_0x4f0d17,_0x515867))[_0x4b7a('0x45')](handleError(_0x4f0d17,null));};exports[_0x4b7a('0x46')]=function(_0x31fa6e,_0x140129){var _0x25a8a5={'raw':![],'where':{'id':_0x31fa6e['params']['id']}},_0x3684dc={};_0x3684dc[_0x4b7a('0x31')]=_[_0x4b7a('0x33')](db[_0x4b7a('0x2d')][_0x4b7a('0x47')]);_0x3684dc['query']=_[_0x4b7a('0x33')](_0x31fa6e[_0x4b7a('0x32')]);_0x3684dc[_0x4b7a('0x34')]=_[_0x4b7a('0x35')](_0x3684dc[_0x4b7a('0x31')],_0x3684dc[_0x4b7a('0x32')]);_0x25a8a5[_0x4b7a('0x36')]=_[_0x4b7a('0x35')](_0x3684dc[_0x4b7a('0x31')],qs[_0x4b7a('0x37')](_0x31fa6e['query'][_0x4b7a('0x37')]));_0x25a8a5[_0x4b7a('0x36')]=_0x25a8a5[_0x4b7a('0x36')]['length']?_0x25a8a5['attributes']:_0x3684dc['model'];if(_0x31fa6e['query']['includeAll']){_0x25a8a5[_0x4b7a('0x48')]=[{'all':!![]}];}_0x25a8a5=_[_0x4b7a('0x40')]({},_0x25a8a5,_0x31fa6e[_0x4b7a('0x41')]);return db[_0x4b7a('0x2d')]['find'](_0x25a8a5)[_0x4b7a('0x42')](handleEntityNotFound(_0x140129,null))[_0x4b7a('0x42')](respondWithResult(_0x140129,null))[_0x4b7a('0x45')](handleError(_0x140129,null));};exports['create']=function(_0x1331a6,_0xd86743){return db[_0x4b7a('0x2d')][_0x4b7a('0x49')](_0x1331a6[_0x4b7a('0x4a')],{})[_0x4b7a('0x42')](respondWithResult(_0xd86743,0xc9))['catch'](handleError(_0xd86743,null));};exports[_0x4b7a('0x25')]=function(_0x18a7b5,_0x5793d6){if(_0x18a7b5['body']['id']){delete _0x18a7b5[_0x4b7a('0x4a')]['id'];}return db[_0x4b7a('0x2d')][_0x4b7a('0x4b')]({'where':{'id':_0x18a7b5[_0x4b7a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5793d6,null))[_0x4b7a('0x42')](saveUpdates(_0x18a7b5[_0x4b7a('0x4a')],null))[_0x4b7a('0x42')](respondWithResult(_0x5793d6,null))[_0x4b7a('0x45')](handleError(_0x5793d6,null));};exports['destroy']=function(_0x1c78c6,_0x453566){return db[_0x4b7a('0x2d')]['find']({'where':{'id':_0x1c78c6[_0x4b7a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x453566,null))['then'](removeEntity(_0x453566,null))['catch'](handleError(_0x453566,null));};exports[_0x4b7a('0x4d')]=function(_0x330a64,_0x5ddfda){return db[_0x4b7a('0x2d')][_0x4b7a('0x4d')]()[_0x4b7a('0x42')](respondWithResult(_0x5ddfda,null))['catch'](handleError(_0x5ddfda,null));};exports[_0x4b7a('0x4e')]=function(_0x45e16d,_0x5137bf){var _0x58fa37={},_0x771ea8={},_0x3b8e89={'count':0x0,'rows':[]};_0x771ea8[_0x4b7a('0x31')]=_['keys'](db['VoiceQueueReport'][_0x4b7a('0x47')]);_0x771ea8['query']=_[_0x4b7a('0x33')](_0x45e16d[_0x4b7a('0x32')]);_0x771ea8[_0x4b7a('0x34')]=_[_0x4b7a('0x35')](_0x771ea8[_0x4b7a('0x31')],_0x771ea8[_0x4b7a('0x32')]);_0x58fa37[_0x4b7a('0x36')]=_[_0x4b7a('0x35')](_0x771ea8[_0x4b7a('0x31')],qs['fields'](_0x45e16d[_0x4b7a('0x32')][_0x4b7a('0x37')]));_0x58fa37[_0x4b7a('0x36')]=_0x58fa37[_0x4b7a('0x36')][_0x4b7a('0x38')]?_0x58fa37[_0x4b7a('0x36')]:_0x771ea8['model'];if(!_0x45e16d[_0x4b7a('0x32')][_0x4b7a('0x39')](_0x4b7a('0x3a'))){_0x58fa37[_0x4b7a('0x1f')]=qs[_0x4b7a('0x1f')](_0x45e16d[_0x4b7a('0x32')][_0x4b7a('0x1f')]);_0x58fa37[_0x4b7a('0x1d')]=qs['offset'](_0x45e16d[_0x4b7a('0x32')][_0x4b7a('0x1d')]);}_0x58fa37[_0x4b7a('0x3b')]=qs[_0x4b7a('0x3c')](_0x45e16d['query'][_0x4b7a('0x3c')]);_0x58fa37[_0x4b7a('0x3d')]=qs[_0x4b7a('0x34')](_[_0x4b7a('0x3e')](_0x45e16d[_0x4b7a('0x32')],_0x771ea8[_0x4b7a('0x34')]));if(_0x45e16d[_0x4b7a('0x32')]['filter']){_0x58fa37['where']=_[_0x4b7a('0x40')](_0x58fa37[_0x4b7a('0x3d')],{'$or':_[_0x4b7a('0x2c')](_0x58fa37[_0x4b7a('0x36')],function(_0x5ed80f){var _0x4244af={};_0x4244af[_0x5ed80f]={'$like':'%'+_0x45e16d[_0x4b7a('0x32')][_0x4b7a('0x3f')]+'%'};return _0x4244af;})});}_0x58fa37=_[_0x4b7a('0x40')]({},_0x58fa37,_0x45e16d['options']);var _0x1f10af={'where':_0x58fa37[_0x4b7a('0x3d')]};return db[_0x4b7a('0x2d')][_0x4b7a('0x20')](_0x1f10af)[_0x4b7a('0x42')](function(_0x572c69){_0x3b8e89[_0x4b7a('0x20')]=_0x572c69;if(_0x45e16d[_0x4b7a('0x32')][_0x4b7a('0x43')]){_0x58fa37[_0x4b7a('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x58fa37);})[_0x4b7a('0x42')](function(_0x562914){_0x3b8e89['rows']=_0x562914;return _0x3b8e89;})[_0x4b7a('0x42')](respondWithFilteredResult(_0x5137bf,_0x58fa37,_0x4b7a('0x4e')))['catch'](handleError(_0x5137bf,null,_0x4b7a('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ec307c9..b812f04 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 _0xe106=['save','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1c4ff0,_0x2c93cb){var _0x392915=function(_0x49d14a){while(--_0x49d14a){_0x1c4ff0['push'](_0x1c4ff0['shift']());}};_0x392915(++_0x2c93cb);}(_0xe106,0xff));var _0x6e10=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xe106[_0xb4cc12];return _0x8593b5;};'use strict';var EventEmitter=require(_0x6e10('0x0'));var VoiceQueueReport=require(_0x6e10('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6e10('0x2')](0x0);var events={'afterCreate':_0x6e10('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x24e20b){return function(_0x4d427b,_0xf174c0,_0x1d49e3){VoiceQueueReportEvents[_0x6e10('0x4')](_0x24e20b+':'+_0x4d427b['id'],_0x4d427b);VoiceQueueReportEvents['emit'](_0x24e20b,_0x4d427b);_0x1d49e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x6e10('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2868=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x454489,_0x2ac2b7){var _0x5e35bd=function(_0x444761){while(--_0x444761){_0x454489['push'](_0x454489['shift']());}};_0x5e35bd(++_0x2ac2b7);}(_0x2868,0xb5));var _0x8286=function(_0x43033d,_0x1084e2){_0x43033d=_0x43033d-0x0;var _0x4f6494=_0x2868[_0x43033d];return _0x4f6494;};'use strict';var EventEmitter=require(_0x8286('0x0'));var VoiceQueueReport=require(_0x8286('0x1'))['db'][_0x8286('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8286('0x3')](0x0);var events={'afterCreate':_0x8286('0x4'),'afterUpdate':_0x8286('0x5'),'afterDestroy':_0x8286('0x6')};function emitEvent(_0x27aada){return function(_0x23388b,_0x3af5ed,_0x57d964){VoiceQueueReportEvents[_0x8286('0x7')](_0x27aada+':'+_0x23388b['id'],_0x23388b);VoiceQueueReportEvents[_0x8286('0x7')](_0x27aada,_0x23388b);_0x57d964(null);};}for(var e in events){if(events[_0x8286('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x8286('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 d83e5a7..8d6d627 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 _0x9040=['util','api','moment','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash'];(function(_0x538991,_0x1de972){var _0x544685=function(_0x4297d2){while(--_0x4297d2){_0x538991['push'](_0x538991['shift']());}};_0x544685(++_0x1de972);}(_0x9040,0x74));var _0x0904=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9040[_0x432682];return _0x463d05;};'use strict';var _=require(_0x0904('0x0'));var util=require(_0x0904('0x1'));var logger=require('../../config/logger')(_0x0904('0x2'));var moment=require(_0x0904('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0904('0x4'));var rimraf=require(_0x0904('0x5'));var config=require(_0x0904('0x6'));var attributes=require(_0x0904('0x7'));module[_0x0904('0x8')]=function(_0x46ef0a,_0x2d3bda){return _0x46ef0a[_0x0904('0x9')](_0x0904('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x0904('0xb')]},{'fields':[_0x0904('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94d0=['request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger','api','moment','bluebird'];(function(_0x38d540,_0x755166){var _0x5cdc97=function(_0x2e6ae4){while(--_0x2e6ae4){_0x38d540['push'](_0x38d540['shift']());}};_0x5cdc97(++_0x755166);}(_0x94d0,0x1a0));var _0x094d=function(_0x54fe03,_0x21394b){_0x54fe03=_0x54fe03-0x0;var _0x3446e2=_0x94d0[_0x54fe03];return _0x3446e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x094d('0x0'))(_0x094d('0x1'));var moment=require(_0x094d('0x2'));var BPromise=require(_0x094d('0x3'));var rp=require(_0x094d('0x4'));var fs=require('fs');var path=require(_0x094d('0x5'));var rimraf=require(_0x094d('0x6'));var config=require(_0x094d('0x7'));var attributes=require(_0x094d('0x8'));module[_0x094d('0x9')]=function(_0x90b930,_0x54dd22){return _0x90b930[_0x094d('0xa')](_0x094d('0xb'),attributes,{'tableName':_0x094d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x094d('0xd')]},{'fields':[_0x094d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 039a5a0..8389733 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 _0xf80d=['request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','attributes','include','model','map','stringify','catch','CreateVoiceQueueReport','VoiceQueueReport','create','body','where','limit','UpdateVoiceQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x16d331,_0xa36435){var _0x11219d=function(_0x5c18ae){while(--_0x5c18ae){_0x16d331['push'](_0x16d331['shift']());}};_0x11219d(++_0xa36435);}(_0xf80d,0x160));var _0xdf80=function(_0x24ae03,_0x334660){_0x24ae03=_0x24ae03-0x0;var _0x38a29e=_0xf80d[_0x24ae03];return _0x38a29e;};'use strict';var _=require(_0xdf80('0x0'));var util=require(_0xdf80('0x1'));var moment=require(_0xdf80('0x2'));var BPromise=require(_0xdf80('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf80('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf80('0x5'))(_0xdf80('0x6'));var config=require(_0xdf80('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdf80('0x8')]({'port':0x232a});config[_0xdf80('0x9')]=_[_0xdf80('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdf80('0xb'))(new Redis(config[_0xdf80('0x9')]));require(_0xdf80('0xc'))[_0xdf80('0xd')](socket);function respondWithRpcPromise(_0xbb2ad2,_0x4a2cdd,_0x4a523b){return new BPromise(function(_0x1586ac,_0x411f70){return client['request'](_0xbb2ad2,_0x4a523b)[_0xdf80('0xe')](function(_0x3f8492){logger[_0xdf80('0xf')](_0xdf80('0x10'),_0x4a2cdd,_0xdf80('0x11'));logger[_0xdf80('0x12')](_0xdf80('0x13'),_0x4a2cdd,_0xdf80('0x11'),JSON['stringify'](_0x3f8492));if(_0x3f8492[_0xdf80('0x14')]){if(_0x3f8492[_0xdf80('0x14')][_0xdf80('0x15')]===0x1f4){logger[_0xdf80('0x14')](_0xdf80('0x10'),_0x4a2cdd,_0x3f8492[_0xdf80('0x14')][_0xdf80('0x16')]);return _0x411f70(_0x3f8492[_0xdf80('0x14')][_0xdf80('0x16')]);}logger[_0xdf80('0x14')](_0xdf80('0x10'),_0x4a2cdd,_0x3f8492[_0xdf80('0x14')][_0xdf80('0x16')]);return _0x1586ac(_0x3f8492[_0xdf80('0x14')]['message']);}else{logger['info'](_0xdf80('0x10'),_0x4a2cdd,_0xdf80('0x11'));_0x1586ac(_0x3f8492[_0xdf80('0x17')][_0xdf80('0x16')]);}})['catch'](function(_0x907726){logger[_0xdf80('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4a2cdd,_0x907726);_0x411f70(_0x907726);});});}exports[_0xdf80('0x18')]=function(_0x8c061){var _0x4a270e=this;return new Promise(function(_0x5550fc,_0x309015){return db['VoiceQueueReport'][_0xdf80('0x19')]({'raw':_0x8c061[_0xdf80('0x1a')]?_0x8c061[_0xdf80('0x1a')][_0xdf80('0x1b')]===undefined?!![]:![]:!![],'where':_0x8c061[_0xdf80('0x1a')]?_0x8c061[_0xdf80('0x1a')]['where']||null:null,'attributes':_0x8c061[_0xdf80('0x1a')]?_0x8c061[_0xdf80('0x1a')][_0xdf80('0x1c')]||null:null,'limit':_0x8c061[_0xdf80('0x1a')]?_0x8c061[_0xdf80('0x1a')]['limit']||null:null,'include':_0x8c061[_0xdf80('0x1a')]?_0x8c061['options'][_0xdf80('0x1d')]?_['map'](_0x8c061[_0xdf80('0x1a')][_0xdf80('0x1d')],function(_0x332404){return{'model':db[_0x332404[_0xdf80('0x1e')]],'as':_0x332404['as'],'attributes':_0x332404['attributes'],'include':_0x332404[_0xdf80('0x1d')]?_[_0xdf80('0x1f')](_0x332404[_0xdf80('0x1d')],function(_0x3d499a){return{'model':db[_0x3d499a[_0xdf80('0x1e')]],'as':_0x3d499a['as'],'attributes':_0x3d499a[_0xdf80('0x1c')],'include':_0x3d499a[_0xdf80('0x1d')]?_[_0xdf80('0x1f')](_0x3d499a[_0xdf80('0x1d')],function(_0x1dc1ae){return{'model':db[_0x1dc1ae[_0xdf80('0x1e')]],'as':_0x1dc1ae['as'],'attributes':_0x1dc1ae[_0xdf80('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49304d){logger[_0xdf80('0xf')](_0xdf80('0x18'),_0x8c061);logger[_0xdf80('0x12')]('GetVoiceQueueReport',_0x8c061,JSON[_0xdf80('0x20')](_0x49304d));_0x5550fc(_0x49304d);})[_0xdf80('0x21')](function(_0x2d345e){logger[_0xdf80('0x14')](_0xdf80('0x18'),_0x2d345e[_0xdf80('0x16')],_0x8c061);_0x309015(_0x4a270e[_0xdf80('0x14')](0x1f4,_0x2d345e[_0xdf80('0x16')]));});});};exports[_0xdf80('0x22')]=function(_0xe93e3){var _0x3c14fc=this;return new Promise(function(_0x576d6e,_0x144425){return db[_0xdf80('0x23')][_0xdf80('0x24')](_0xe93e3[_0xdf80('0x25')],{'raw':_0xe93e3[_0xdf80('0x1a')]?_0xe93e3[_0xdf80('0x1a')][_0xdf80('0x1b')]===undefined?!![]:![]:!![]})[_0xdf80('0xe')](function(_0x8c34b8){logger[_0xdf80('0xf')](_0xdf80('0x22'),_0xe93e3);logger[_0xdf80('0x12')](_0xdf80('0x22'),_0xe93e3,JSON[_0xdf80('0x20')](_0x8c34b8));_0x576d6e(_0x8c34b8);})[_0xdf80('0x21')](function(_0x4bf199){logger[_0xdf80('0x14')]('CreateVoiceQueueReport',_0x4bf199[_0xdf80('0x16')],_0xe93e3);_0x144425(_0x3c14fc[_0xdf80('0x14')](0x1f4,_0x4bf199[_0xdf80('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2616e0){var _0x14fb00=this;return new Promise(function(_0x2ea2f8,_0x276b9e){return db[_0xdf80('0x23')]['update'](_0x2616e0[_0xdf80('0x25')],{'raw':_0x2616e0['options']?_0x2616e0[_0xdf80('0x1a')][_0xdf80('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2616e0[_0xdf80('0x1a')]?_0x2616e0[_0xdf80('0x1a')][_0xdf80('0x26')]||null:null,'attributes':_0x2616e0[_0xdf80('0x1a')]?_0x2616e0[_0xdf80('0x1a')][_0xdf80('0x1c')]||null:null,'limit':_0x2616e0[_0xdf80('0x1a')]?_0x2616e0['options'][_0xdf80('0x27')]||null:null})['then'](function(_0x5ec182){logger[_0xdf80('0xf')](_0xdf80('0x28'),_0x2616e0);logger['debug'](_0xdf80('0x28'),_0x2616e0,JSON[_0xdf80('0x20')](_0x5ec182));_0x2ea2f8(_0x5ec182);})[_0xdf80('0x21')](function(_0x415782){logger[_0xdf80('0x14')](_0xdf80('0x28'),_0x415782[_0xdf80('0x16')],_0x2616e0);_0x276b9e(_0x14fb00[_0xdf80('0x14')](0x1f4,_0x415782[_0xdf80('0x16')]));});});}; \ No newline at end of file +var _0x5c54=['options','raw','where','attributes','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','limit','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll'];(function(_0x2e46bc,_0xb02454){var _0x374191=function(_0x41cac7){while(--_0x41cac7){_0x2e46bc['push'](_0x2e46bc['shift']());}};_0x374191(++_0xb02454);}(_0x5c54,0x1b2));var _0x45c5=function(_0x418906,_0x17b57f){_0x418906=_0x418906-0x0;var _0x4349cf=_0x5c54[_0x418906];return _0x4349cf;};'use strict';var _=require('lodash');var util=require(_0x45c5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45c5('0x1'));var fs=require('fs');var Redis=require(_0x45c5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x45c5('0x3'));var logger=require('../../config/logger')(_0x45c5('0x4'));var config=require(_0x45c5('0x5'));var jayson=require(_0x45c5('0x6'));var client=jayson[_0x45c5('0x7')][_0x45c5('0x8')]({'port':0x232a});config[_0x45c5('0x9')]=_[_0x45c5('0xa')](config[_0x45c5('0x9')],{'host':_0x45c5('0xb'),'port':0x18eb});var socket=require(_0x45c5('0xc'))(new Redis(config[_0x45c5('0x9')]));require(_0x45c5('0xd'))[_0x45c5('0xe')](socket);function respondWithRpcPromise(_0x1507e6,_0x1c0324,_0x51333b){return new BPromise(function(_0x100d9b,_0x237b23){return client[_0x45c5('0xf')](_0x1507e6,_0x51333b)[_0x45c5('0x10')](function(_0x4c53a2){logger[_0x45c5('0x11')](_0x45c5('0x12'),_0x1c0324,_0x45c5('0x13'));logger[_0x45c5('0x14')](_0x45c5('0x15'),_0x1c0324,_0x45c5('0x13'),JSON[_0x45c5('0x16')](_0x4c53a2));if(_0x4c53a2['error']){if(_0x4c53a2[_0x45c5('0x17')][_0x45c5('0x18')]===0x1f4){logger['error'](_0x45c5('0x12'),_0x1c0324,_0x4c53a2[_0x45c5('0x17')][_0x45c5('0x19')]);return _0x237b23(_0x4c53a2[_0x45c5('0x17')][_0x45c5('0x19')]);}logger[_0x45c5('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c0324,_0x4c53a2['error']['message']);return _0x100d9b(_0x4c53a2[_0x45c5('0x17')][_0x45c5('0x19')]);}else{logger[_0x45c5('0x11')](_0x45c5('0x12'),_0x1c0324,_0x45c5('0x13'));_0x100d9b(_0x4c53a2['result'][_0x45c5('0x19')]);}})[_0x45c5('0x1a')](function(_0x17821c){logger[_0x45c5('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c0324,_0x17821c);_0x237b23(_0x17821c);});});}exports['GetVoiceQueueReport']=function(_0x45a3dc){var _0x47234f=this;return new Promise(function(_0x3a606f,_0x12fb04){return db['VoiceQueueReport'][_0x45c5('0x1b')]({'raw':_0x45a3dc[_0x45c5('0x1c')]?_0x45a3dc[_0x45c5('0x1c')][_0x45c5('0x1d')]===undefined?!![]:![]:!![],'where':_0x45a3dc['options']?_0x45a3dc[_0x45c5('0x1c')][_0x45c5('0x1e')]||null:null,'attributes':_0x45a3dc[_0x45c5('0x1c')]?_0x45a3dc[_0x45c5('0x1c')][_0x45c5('0x1f')]||null:null,'limit':_0x45a3dc[_0x45c5('0x1c')]?_0x45a3dc[_0x45c5('0x1c')]['limit']||null:null,'include':_0x45a3dc[_0x45c5('0x1c')]?_0x45a3dc[_0x45c5('0x1c')][_0x45c5('0x20')]?_[_0x45c5('0x21')](_0x45a3dc[_0x45c5('0x1c')][_0x45c5('0x20')],function(_0x54abdd){return{'model':db[_0x54abdd[_0x45c5('0x22')]],'as':_0x54abdd['as'],'attributes':_0x54abdd[_0x45c5('0x1f')],'include':_0x54abdd[_0x45c5('0x20')]?_[_0x45c5('0x21')](_0x54abdd[_0x45c5('0x20')],function(_0x38d8a2){return{'model':db[_0x38d8a2[_0x45c5('0x22')]],'as':_0x38d8a2['as'],'attributes':_0x38d8a2[_0x45c5('0x1f')],'include':_0x38d8a2[_0x45c5('0x20')]?_[_0x45c5('0x21')](_0x38d8a2[_0x45c5('0x20')],function(_0x4e5b64){return{'model':db[_0x4e5b64[_0x45c5('0x22')]],'as':_0x4e5b64['as'],'attributes':_0x4e5b64['attributes']};}):[]};}):[]};}):[]:[]})[_0x45c5('0x10')](function(_0x492075){logger[_0x45c5('0x11')](_0x45c5('0x23'),_0x45a3dc);logger[_0x45c5('0x14')](_0x45c5('0x23'),_0x45a3dc,JSON['stringify'](_0x492075));_0x3a606f(_0x492075);})['catch'](function(_0xea7ec6){logger[_0x45c5('0x17')]('GetVoiceQueueReport',_0xea7ec6['message'],_0x45a3dc);_0x12fb04(_0x47234f['error'](0x1f4,_0xea7ec6[_0x45c5('0x19')]));});});};exports[_0x45c5('0x24')]=function(_0x4cc684){var _0x498e00=this;return new Promise(function(_0x45d1d6,_0x1f97ca){return db[_0x45c5('0x25')][_0x45c5('0x26')](_0x4cc684[_0x45c5('0x27')],{'raw':_0x4cc684[_0x45c5('0x1c')]?_0x4cc684[_0x45c5('0x1c')][_0x45c5('0x1d')]===undefined?!![]:![]:!![]})[_0x45c5('0x10')](function(_0x326288){logger[_0x45c5('0x11')](_0x45c5('0x24'),_0x4cc684);logger[_0x45c5('0x14')](_0x45c5('0x24'),_0x4cc684,JSON[_0x45c5('0x16')](_0x326288));_0x45d1d6(_0x326288);})[_0x45c5('0x1a')](function(_0x58dd1b){logger['error'](_0x45c5('0x24'),_0x58dd1b[_0x45c5('0x19')],_0x4cc684);_0x1f97ca(_0x498e00['error'](0x1f4,_0x58dd1b[_0x45c5('0x19')]));});});};exports[_0x45c5('0x28')]=function(_0x56c2f4){var _0x417f74=this;return new Promise(function(_0x116219,_0x2bc338){return db[_0x45c5('0x25')]['update'](_0x56c2f4[_0x45c5('0x27')],{'raw':_0x56c2f4[_0x45c5('0x1c')]?_0x56c2f4[_0x45c5('0x1c')][_0x45c5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c2f4['options']?_0x56c2f4['options']['where']||null:null,'attributes':_0x56c2f4[_0x45c5('0x1c')]?_0x56c2f4['options'][_0x45c5('0x1f')]||null:null,'limit':_0x56c2f4[_0x45c5('0x1c')]?_0x56c2f4[_0x45c5('0x1c')][_0x45c5('0x29')]||null:null})['then'](function(_0x1368f0){logger[_0x45c5('0x11')](_0x45c5('0x28'),_0x56c2f4);logger[_0x45c5('0x14')](_0x45c5('0x28'),_0x56c2f4,JSON[_0x45c5('0x16')](_0x1368f0));_0x116219(_0x1368f0);})[_0x45c5('0x1a')](function(_0x5be6c7){logger['error'](_0x45c5('0x28'),_0x5be6c7[_0x45c5('0x19')],_0x56c2f4);_0x2bc338(_0x417f74[_0x45c5('0x17')](0x1f4,_0x5be6c7[_0x45c5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f0b440c..cfc6f17 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 _0xb66c=['voiceQueueReport:','./voiceQueueReport.events','remove','removeListener','register','length'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xb66c,0x175));var _0xcb66=function(_0x1708d1,_0x420f46){_0x1708d1=_0x1708d1-0x0;var _0x5c2507=_0xb66c[_0x1708d1];return _0x5c2507;};'use strict';var VoiceQueueReportEvents=require(_0xcb66('0x0'));var events=['save',_0xcb66('0x1'),'update'];function createListener(_0x2afcb8,_0x24ea13){return function(_0xf7ccc5){_0x24ea13['emit'](_0x2afcb8,_0xf7ccc5);};}function removeListener(_0x35d439,_0x386241){return function(){VoiceQueueReportEvents[_0xcb66('0x2')](_0x35d439,_0x386241);};}exports[_0xcb66('0x3')]=function(_0x5d766d){for(var _0x518163=0x0,_0x19adf5=events[_0xcb66('0x4')];_0x518163<_0x19adf5;_0x518163++){var _0xa3993=events[_0x518163];var _0x439f3d=createListener(_0xcb66('0x5')+_0xa3993,_0x5d766d);VoiceQueueReportEvents['on'](_0xa3993,_0x439f3d);}}; \ No newline at end of file +var _0xc6ab=['remove','update','emit','removeListener','register','length','./voiceQueueReport.events','save'];(function(_0x222077,_0x180f7c){var _0x59bf61=function(_0x1f4703){while(--_0x1f4703){_0x222077['push'](_0x222077['shift']());}};_0x59bf61(++_0x180f7c);}(_0xc6ab,0x96));var _0xbc6a=function(_0x257652,_0x3005ad){_0x257652=_0x257652-0x0;var _0xbc5883=_0xc6ab[_0x257652];return _0xbc5883;};'use strict';var VoiceQueueReportEvents=require(_0xbc6a('0x0'));var events=[_0xbc6a('0x1'),_0xbc6a('0x2'),_0xbc6a('0x3')];function createListener(_0x3d445d,_0x4fd8be){return function(_0x59baa9){_0x4fd8be[_0xbc6a('0x4')](_0x3d445d,_0x59baa9);};}function removeListener(_0x1c351c,_0x3808e0){return function(){VoiceQueueReportEvents[_0xbc6a('0x5')](_0x1c351c,_0x3808e0);};}exports[_0xbc6a('0x6')]=function(_0x4ccd07){for(var _0x45ed96=0x0,_0x263f4b=events[_0xbc6a('0x7')];_0x45ed96<_0x263f4b;_0x45ed96++){var _0x1b7a4c=events[_0x45ed96];var _0x2f7f5f=createListener('voiceQueueReport:'+_0x1b7a4c,_0x4ccd07);VoiceQueueReportEvents['on'](_0x1b7a4c,_0x2f7f5f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 60cf659..7e6de67 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 _0xa1a3=['Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','exports','util','express'];(function(_0x5c0e6a,_0xde6371){var _0x61b3d7=function(_0x445dd){while(--_0x445dd){_0x5c0e6a['push'](_0x5c0e6a['shift']());}};_0x61b3d7(++_0xde6371);}(_0xa1a3,0x1d2));var _0x3a1a=function(_0x3e6560,_0x26e7bd){_0x3e6560=_0x3e6560-0x0;var _0x1c3afb=_0xa1a3[_0x3e6560];return _0x1c3afb;};'use strict';var multer=require('multer');var util=require(_0x3a1a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3a1a('0x1'));var router=express[_0x3a1a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3a1a('0x3'));var controller=require('./voiceQueuesLog.controller');router[_0x3a1a('0x4')]('/',auth[_0x3a1a('0x5')](),controller[_0x3a1a('0x6')]);router[_0x3a1a('0x4')](_0x3a1a('0x7'),auth[_0x3a1a('0x5')](),controller[_0x3a1a('0x8')]);router[_0x3a1a('0x9')]('/',auth[_0x3a1a('0x5')](),controller['create']);router[_0x3a1a('0xa')](_0x3a1a('0x7'),auth[_0x3a1a('0x5')](),controller[_0x3a1a('0xb')]);router['delete'](_0x3a1a('0x7'),auth[_0x3a1a('0x5')](),controller['destroy']);module[_0x3a1a('0xc')]=router; \ No newline at end of file +var _0xa33b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util'];(function(_0x177dd2,_0x484644){var _0x3b27c6=function(_0x5736ad){while(--_0x5736ad){_0x177dd2['push'](_0x177dd2['shift']());}};_0x3b27c6(++_0x484644);}(_0xa33b,0xf5));var _0xba33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa33b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xba33('0x0'));var util=require(_0xba33('0x1'));var path=require('path');var timeout=require(_0xba33('0x2'));var express=require(_0xba33('0x3'));var router=express[_0xba33('0x4')]();var fs_extra=require(_0xba33('0x5'));var auth=require(_0xba33('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xba33('0x7'));var controller=require(_0xba33('0x8'));router[_0xba33('0x9')]('/',auth[_0xba33('0xa')](),controller[_0xba33('0xb')]);router['get'](_0xba33('0xc'),auth[_0xba33('0xa')](),controller[_0xba33('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xba33('0xe')]);router['put'](_0xba33('0xc'),auth['isAuthenticated'](),controller[_0xba33('0xf')]);router[_0xba33('0x10')](_0xba33('0xc'),auth['isAuthenticated'](),controller[_0xba33('0x11')]);module[_0xba33('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6f430a3..c17b512 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 _0x233d=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x394303,_0x41dae5){var _0x39abc2=function(_0x2c6c40){while(--_0x2c6c40){_0x394303['push'](_0x394303['shift']());}};_0x39abc2(++_0x41dae5);}(_0x233d,0x1a1));var _0xd233=function(_0x5adfa9,_0x4b835d){_0x5adfa9=_0x5adfa9-0x0;var _0x458f41=_0x233d[_0x5adfa9];return _0x458f41;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd233('0x0'));module[_0xd233('0x1')]={'time':{'type':Sequelize[_0xd233('0x2')]},'callid':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd233('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd233('0x3')],'allowNull':![],'defaultValue':moment()[_0xd233('0x4')](_0xd233('0x5'))}}; \ No newline at end of file +var _0x28e4=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x316031,_0x47b9c7){var _0xc96aec=function(_0x1cdeb5){while(--_0x1cdeb5){_0x316031['push'](_0x316031['shift']());}};_0xc96aec(++_0x47b9c7);}(_0x28e4,0x81));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x428e('0x0'));module[_0x428e('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x428e('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x428e('0x3')],'allowNull':![],'defaultValue':moment()[_0x428e('0x4')](_0x428e('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 5e0e133..ba1a2a0 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 _0x18c2=['jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','intersection','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0x18c2,0xcc));var _0x218c=function(_0x504131,_0xe54dd4){_0x504131=_0x504131-0x0;var _0x475c74=_0x18c2[_0x504131];return _0x475c74;};'use strict';var emlformat=require(_0x218c('0x0'));var rimraf=require(_0x218c('0x1'));var zipdir=require(_0x218c('0x2'));var jsonpatch=require(_0x218c('0x3'));var rp=require(_0x218c('0x4'));var moment=require(_0x218c('0x5'));var BPromise=require(_0x218c('0x6'));var Mustache=require(_0x218c('0x7'));var util=require(_0x218c('0x8'));var path=require(_0x218c('0x9'));var sox=require(_0x218c('0xa'));var csv=require(_0x218c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x218c('0xc'));var _=require('lodash');var squel=require(_0x218c('0xd'));var crypto=require(_0x218c('0xe'));var jsforce=require(_0x218c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x218c('0x10'));var Papa=require('papaparse');var Redis=require(_0x218c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x218c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x218c('0x13'));var logger=require(_0x218c('0x14'))(_0x218c('0x15'));var utils=require(_0x218c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x218c('0x17'));var db=require(_0x218c('0x18'))['db'];function respondWithStatusCode(_0x11f831,_0x5db499){_0x5db499=_0x5db499||0xcc;return function(_0x445173){if(_0x445173){return _0x11f831[_0x218c('0x19')](_0x5db499);}return _0x11f831[_0x218c('0x1a')](_0x5db499)[_0x218c('0x1b')]();};}function respondWithResult(_0x436f45,_0x34170e){_0x34170e=_0x34170e||0xc8;return function(_0x42f7e0){if(_0x42f7e0){return _0x436f45[_0x218c('0x1a')](_0x34170e)['json'](_0x42f7e0);}};}function respondWithFilteredResult(_0x809d8a,_0xbb3a4f){return function(_0x419e1a){if(_0x419e1a){var _0x31be5a=typeof _0xbb3a4f[_0x218c('0x1c')]==='undefined'&&typeof _0xbb3a4f['limit']===_0x218c('0x1d');var _0x20dc62=_0x419e1a['count'];var _0x5bb6a8=_0x31be5a?0x0:_0xbb3a4f[_0x218c('0x1c')];var _0x5e1ca2=_0x31be5a?_0x419e1a[_0x218c('0x1e')]:_0xbb3a4f[_0x218c('0x1c')]+_0xbb3a4f['limit'];var _0x2106bf;if(_0x5e1ca2>=_0x20dc62){_0x5e1ca2=_0x20dc62;_0x2106bf=0xc8;}else{_0x2106bf=0xce;}_0x809d8a[_0x218c('0x1a')](_0x2106bf);return _0x809d8a[_0x218c('0x1f')](_0x218c('0x20'),_0x5bb6a8+'-'+_0x5e1ca2+'/'+_0x20dc62)[_0x218c('0x21')](_0x419e1a);}return null;};}function patchUpdates(_0x23af8c){return function(_0x17c156){try{jsonpatch['apply'](_0x17c156,_0x23af8c,!![]);}catch(_0x3abf64){return BPromise[_0x218c('0x22')](_0x3abf64);}return _0x17c156[_0x218c('0x23')]();};}function saveUpdates(_0x3334a1,_0x42c98e){return function(_0x4c6410){if(_0x4c6410){return _0x4c6410[_0x218c('0x24')](_0x3334a1)[_0x218c('0x25')](function(_0x1fa802){return _0x1fa802;});}return null;};}function removeEntity(_0x466d13,_0x1f289f){return function(_0x282a9e){if(_0x282a9e){return _0x282a9e[_0x218c('0x26')]()['then'](function(){_0x466d13[_0x218c('0x1a')](0xcc)[_0x218c('0x1b')]();});}};}function handleEntityNotFound(_0x33d8a0,_0xb7f261){return function(_0x56821c){if(!_0x56821c){_0x33d8a0[_0x218c('0x19')](0x194);}return _0x56821c;};}function handleError(_0x387900,_0x555440){_0x555440=_0x555440||0x1f4;return function(_0x3eef0f){logger[_0x218c('0x27')](_0x3eef0f[_0x218c('0x28')]);if(_0x3eef0f[_0x218c('0x29')]){delete _0x3eef0f['name'];}_0x387900[_0x218c('0x1a')](_0x555440)[_0x218c('0x2a')](_0x3eef0f);};}exports['index']=function(_0x570686,_0x3ec68f){var _0x3a4b46={},_0x360ec1={},_0x133612={'count':0x0,'rows':[]};var _0x51778f=_[_0x218c('0x2b')](db[_0x218c('0x2c')][_0x218c('0x2d')],function(_0x42f49a){return{'name':_0x42f49a[_0x218c('0x2e')],'type':_0x42f49a[_0x218c('0x2f')][_0x218c('0x30')]};});_0x360ec1[_0x218c('0x31')]=_[_0x218c('0x2b')](_0x51778f,_0x218c('0x29'));_0x360ec1[_0x218c('0x32')]=_[_0x218c('0x33')](_0x570686[_0x218c('0x32')]);_0x360ec1[_0x218c('0x34')]=_['intersection'](_0x360ec1['model'],_0x360ec1['query']);_0x3a4b46[_0x218c('0x35')]=_['intersection'](_0x360ec1[_0x218c('0x31')],qs[_0x218c('0x36')](_0x570686[_0x218c('0x32')]['fields']));_0x3a4b46[_0x218c('0x35')]=_0x3a4b46[_0x218c('0x35')][_0x218c('0x37')]?_0x3a4b46[_0x218c('0x35')]:_0x360ec1['model'];if(!_0x570686[_0x218c('0x32')][_0x218c('0x38')](_0x218c('0x39'))){_0x3a4b46[_0x218c('0x3a')]=qs[_0x218c('0x3a')](_0x570686[_0x218c('0x32')]['limit']);_0x3a4b46[_0x218c('0x1c')]=qs[_0x218c('0x1c')](_0x570686[_0x218c('0x32')][_0x218c('0x1c')]);}_0x3a4b46['order']=qs[_0x218c('0x3b')](_0x570686[_0x218c('0x32')][_0x218c('0x3b')]);_0x3a4b46[_0x218c('0x3c')]=qs[_0x218c('0x34')](_[_0x218c('0x3d')](_0x570686[_0x218c('0x32')],_0x360ec1[_0x218c('0x34')]),_0x51778f);if(_0x570686[_0x218c('0x32')]['filter']){_0x3a4b46[_0x218c('0x3c')]=_[_0x218c('0x3e')](_0x3a4b46[_0x218c('0x3c')],{'$or':_[_0x218c('0x2b')](_0x51778f,function(_0x23cb35){if(_0x23cb35['type']!==_0x218c('0x3f')){var _0x51055d={};_0x51055d[_0x23cb35[_0x218c('0x29')]]={'$like':'%'+_0x570686[_0x218c('0x32')][_0x218c('0x40')]+'%'};return _0x51055d;}})});}_0x3a4b46=_[_0x218c('0x3e')]({},_0x3a4b46,_0x570686['options']);var _0x281b83={'where':_0x3a4b46[_0x218c('0x3c')]};return db[_0x218c('0x2c')]['count'](_0x281b83)[_0x218c('0x25')](function(_0x5fa422){_0x133612['count']=_0x5fa422;if(_0x570686[_0x218c('0x32')][_0x218c('0x41')]){_0x3a4b46['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x218c('0x42')](_0x3a4b46);})['then'](function(_0x555ead){_0x133612['rows']=_0x555ead;return _0x133612;})[_0x218c('0x25')](respondWithFilteredResult(_0x3ec68f,_0x3a4b46))['catch'](handleError(_0x3ec68f,null));};exports['show']=function(_0x303788,_0x231c10){var _0x12e549={'raw':!![],'where':{'id':_0x303788['params']['id']}},_0x406370={};_0x406370[_0x218c('0x31')]=_[_0x218c('0x33')](db['VoiceQueuesLog'][_0x218c('0x2d')]);_0x406370[_0x218c('0x32')]=_['keys'](_0x303788[_0x218c('0x32')]);_0x406370[_0x218c('0x34')]=_['intersection'](_0x406370['model'],_0x406370[_0x218c('0x32')]);_0x12e549['attributes']=_[_0x218c('0x43')](_0x406370[_0x218c('0x31')],qs['fields'](_0x303788['query'][_0x218c('0x36')]));_0x12e549[_0x218c('0x35')]=_0x12e549[_0x218c('0x35')]['length']?_0x12e549['attributes']:_0x406370[_0x218c('0x31')];if(_0x303788['query'][_0x218c('0x41')]){_0x12e549['include']=[{'all':!![]}];}_0x12e549=_[_0x218c('0x3e')]({},_0x12e549,_0x303788['options']);return db[_0x218c('0x2c')][_0x218c('0x44')](_0x12e549)[_0x218c('0x25')](handleEntityNotFound(_0x231c10,null))[_0x218c('0x25')](respondWithResult(_0x231c10,null))[_0x218c('0x45')](handleError(_0x231c10,null));};exports['create']=function(_0x110192,_0x883c13){return db[_0x218c('0x2c')][_0x218c('0x46')](_0x110192[_0x218c('0x47')],{})[_0x218c('0x25')](respondWithResult(_0x883c13,0xc9))['catch'](handleError(_0x883c13,null));};exports['update']=function(_0xe87be2,_0x3c8320){if(_0xe87be2['body']['id']){delete _0xe87be2[_0x218c('0x47')]['id'];}return db[_0x218c('0x2c')]['find']({'where':{'id':_0xe87be2['params']['id']}})[_0x218c('0x25')](handleEntityNotFound(_0x3c8320,null))[_0x218c('0x25')](saveUpdates(_0xe87be2[_0x218c('0x47')],null))['then'](respondWithResult(_0x3c8320,null))[_0x218c('0x45')](handleError(_0x3c8320,null));};exports[_0x218c('0x26')]=function(_0x59e1c6,_0x51ce5c){return db[_0x218c('0x2c')][_0x218c('0x44')]({'where':{'id':_0x59e1c6[_0x218c('0x48')]['id']}})[_0x218c('0x25')](handleEntityNotFound(_0x51ce5c,null))[_0x218c('0x25')](removeEntity(_0x51ce5c,null))['catch'](handleError(_0x51ce5c,null));}; \ No newline at end of file +var _0x9ad9=['end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','keys','fields','find','create','body','params','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x9ad9,0x163));var _0x99ad=function(_0x3aa6ab,_0x3b5f7c){_0x3aa6ab=_0x3aa6ab-0x0;var _0x5789d7=_0x9ad9[_0x3aa6ab];return _0x5789d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ad('0x0'));var zipdir=require(_0x99ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99ad('0x2'));var BPromise=require(_0x99ad('0x3'));var Mustache=require(_0x99ad('0x4'));var util=require(_0x99ad('0x5'));var path=require(_0x99ad('0x6'));var sox=require(_0x99ad('0x7'));var csv=require(_0x99ad('0x8'));var ejs=require(_0x99ad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99ad('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99ad('0xb'));var toCsv=require('to-csv');var querystring=require(_0x99ad('0xc'));var Papa=require(_0x99ad('0xd'));var Redis=require('ioredis');var authService=require(_0x99ad('0xe'));var qs=require(_0x99ad('0xf'));var as=require(_0x99ad('0x10'));var hardwareService=require(_0x99ad('0x11'));var logger=require('../../config/logger')(_0x99ad('0x12'));var utils=require(_0x99ad('0x13'));var config=require(_0x99ad('0x14'));var licenseUtil=require(_0x99ad('0x15'));var db=require(_0x99ad('0x16'))['db'];function respondWithStatusCode(_0xa3c40b,_0x3aa188){_0x3aa188=_0x3aa188||0xcc;return function(_0x548078){if(_0x548078){return _0xa3c40b[_0x99ad('0x17')](_0x3aa188);}return _0xa3c40b[_0x99ad('0x18')](_0x3aa188)[_0x99ad('0x19')]();};}function respondWithResult(_0x3b4067,_0x59aa3a){_0x59aa3a=_0x59aa3a||0xc8;return function(_0x221861){if(_0x221861){return _0x3b4067['status'](_0x59aa3a)['json'](_0x221861);}};}function respondWithFilteredResult(_0x3a505c,_0x1ac276){return function(_0x2db0de){if(_0x2db0de){var _0x3a239a=typeof _0x1ac276[_0x99ad('0x1a')]===_0x99ad('0x1b')&&typeof _0x1ac276['limit']===_0x99ad('0x1b');var _0x448736=_0x2db0de[_0x99ad('0x1c')];var _0x23a05f=_0x3a239a?0x0:_0x1ac276[_0x99ad('0x1a')];var _0x1b7a83=_0x3a239a?_0x2db0de[_0x99ad('0x1c')]:_0x1ac276['offset']+_0x1ac276[_0x99ad('0x1d')];var _0x39a2ff;if(_0x1b7a83>=_0x448736){_0x1b7a83=_0x448736;_0x39a2ff=0xc8;}else{_0x39a2ff=0xce;}_0x3a505c[_0x99ad('0x18')](_0x39a2ff);return _0x3a505c[_0x99ad('0x1e')](_0x99ad('0x1f'),_0x23a05f+'-'+_0x1b7a83+'/'+_0x448736)[_0x99ad('0x20')](_0x2db0de);}return null;};}function patchUpdates(_0x119ab7){return function(_0x52dd7d){try{jsonpatch[_0x99ad('0x21')](_0x52dd7d,_0x119ab7,!![]);}catch(_0x47eb8c){return BPromise[_0x99ad('0x22')](_0x47eb8c);}return _0x52dd7d[_0x99ad('0x23')]();};}function saveUpdates(_0x154ea,_0x29247a){return function(_0x50792d){if(_0x50792d){return _0x50792d[_0x99ad('0x24')](_0x154ea)[_0x99ad('0x25')](function(_0x2f1011){return _0x2f1011;});}return null;};}function removeEntity(_0x53a2b6,_0x33cd05){return function(_0x2f42e1){if(_0x2f42e1){return _0x2f42e1[_0x99ad('0x26')]()[_0x99ad('0x25')](function(){_0x53a2b6[_0x99ad('0x18')](0xcc)[_0x99ad('0x19')]();});}};}function handleEntityNotFound(_0x402b0f,_0x23e2f7){return function(_0x376b38){if(!_0x376b38){_0x402b0f['sendStatus'](0x194);}return _0x376b38;};}function handleError(_0x438953,_0x377475){_0x377475=_0x377475||0x1f4;return function(_0x5803b4){logger[_0x99ad('0x27')](_0x5803b4[_0x99ad('0x28')]);if(_0x5803b4['name']){delete _0x5803b4[_0x99ad('0x29')];}_0x438953['status'](_0x377475)[_0x99ad('0x2a')](_0x5803b4);};}exports['index']=function(_0x236b39,_0x5b0234){var _0x241abe={},_0x55eec0={},_0x4ede0f={'count':0x0,'rows':[]};var _0x41f869=_[_0x99ad('0x2b')](db[_0x99ad('0x2c')][_0x99ad('0x2d')],function(_0x4e94a5){return{'name':_0x4e94a5[_0x99ad('0x2e')],'type':_0x4e94a5['type'][_0x99ad('0x2f')]};});_0x55eec0[_0x99ad('0x30')]=_[_0x99ad('0x2b')](_0x41f869,'name');_0x55eec0[_0x99ad('0x31')]=_['keys'](_0x236b39['query']);_0x55eec0[_0x99ad('0x32')]=_[_0x99ad('0x33')](_0x55eec0[_0x99ad('0x30')],_0x55eec0[_0x99ad('0x31')]);_0x241abe[_0x99ad('0x34')]=_[_0x99ad('0x33')](_0x55eec0[_0x99ad('0x30')],qs['fields'](_0x236b39[_0x99ad('0x31')]['fields']));_0x241abe['attributes']=_0x241abe[_0x99ad('0x34')][_0x99ad('0x35')]?_0x241abe[_0x99ad('0x34')]:_0x55eec0[_0x99ad('0x30')];if(!_0x236b39[_0x99ad('0x31')][_0x99ad('0x36')]('nolimit')){_0x241abe[_0x99ad('0x1d')]=qs[_0x99ad('0x1d')](_0x236b39[_0x99ad('0x31')][_0x99ad('0x1d')]);_0x241abe[_0x99ad('0x1a')]=qs[_0x99ad('0x1a')](_0x236b39[_0x99ad('0x31')][_0x99ad('0x1a')]);}_0x241abe[_0x99ad('0x37')]=qs[_0x99ad('0x38')](_0x236b39[_0x99ad('0x31')][_0x99ad('0x38')]);_0x241abe['where']=qs[_0x99ad('0x32')](_[_0x99ad('0x39')](_0x236b39[_0x99ad('0x31')],_0x55eec0['filters']),_0x41f869);if(_0x236b39[_0x99ad('0x31')][_0x99ad('0x3a')]){_0x241abe['where']=_[_0x99ad('0x3b')](_0x241abe['where'],{'$or':_['map'](_0x41f869,function(_0x54a73a){if(_0x54a73a[_0x99ad('0x3c')]!==_0x99ad('0x3d')){var _0x3e4012={};_0x3e4012[_0x54a73a[_0x99ad('0x29')]]={'$like':'%'+_0x236b39['query'][_0x99ad('0x3a')]+'%'};return _0x3e4012;}})});}_0x241abe=_[_0x99ad('0x3b')]({},_0x241abe,_0x236b39[_0x99ad('0x3e')]);var _0x31065a={'where':_0x241abe[_0x99ad('0x3f')]};return db[_0x99ad('0x2c')][_0x99ad('0x1c')](_0x31065a)[_0x99ad('0x25')](function(_0x69607b){_0x4ede0f[_0x99ad('0x1c')]=_0x69607b;if(_0x236b39[_0x99ad('0x31')][_0x99ad('0x40')]){_0x241abe[_0x99ad('0x41')]=[{'all':!![]}];}return db[_0x99ad('0x2c')][_0x99ad('0x42')](_0x241abe);})[_0x99ad('0x25')](function(_0x2182e8){_0x4ede0f[_0x99ad('0x43')]=_0x2182e8;return _0x4ede0f;})['then'](respondWithFilteredResult(_0x5b0234,_0x241abe))[_0x99ad('0x44')](handleError(_0x5b0234,null));};exports[_0x99ad('0x45')]=function(_0x11a143,_0x7036a9){var _0x25ab59={'raw':!![],'where':{'id':_0x11a143['params']['id']}},_0x55946b={};_0x55946b[_0x99ad('0x30')]=_['keys'](db['VoiceQueuesLog'][_0x99ad('0x2d')]);_0x55946b['query']=_[_0x99ad('0x46')](_0x11a143[_0x99ad('0x31')]);_0x55946b[_0x99ad('0x32')]=_[_0x99ad('0x33')](_0x55946b[_0x99ad('0x30')],_0x55946b[_0x99ad('0x31')]);_0x25ab59[_0x99ad('0x34')]=_[_0x99ad('0x33')](_0x55946b[_0x99ad('0x30')],qs[_0x99ad('0x47')](_0x11a143[_0x99ad('0x31')][_0x99ad('0x47')]));_0x25ab59[_0x99ad('0x34')]=_0x25ab59[_0x99ad('0x34')]['length']?_0x25ab59[_0x99ad('0x34')]:_0x55946b[_0x99ad('0x30')];if(_0x11a143[_0x99ad('0x31')][_0x99ad('0x40')]){_0x25ab59[_0x99ad('0x41')]=[{'all':!![]}];}_0x25ab59=_[_0x99ad('0x3b')]({},_0x25ab59,_0x11a143[_0x99ad('0x3e')]);return db[_0x99ad('0x2c')][_0x99ad('0x48')](_0x25ab59)[_0x99ad('0x25')](handleEntityNotFound(_0x7036a9,null))[_0x99ad('0x25')](respondWithResult(_0x7036a9,null))['catch'](handleError(_0x7036a9,null));};exports[_0x99ad('0x49')]=function(_0x150e5f,_0x505490){return db[_0x99ad('0x2c')]['create'](_0x150e5f[_0x99ad('0x4a')],{})[_0x99ad('0x25')](respondWithResult(_0x505490,0xc9))[_0x99ad('0x44')](handleError(_0x505490,null));};exports[_0x99ad('0x24')]=function(_0x9220,_0x22011e){if(_0x9220[_0x99ad('0x4a')]['id']){delete _0x9220[_0x99ad('0x4a')]['id'];}return db[_0x99ad('0x2c')][_0x99ad('0x48')]({'where':{'id':_0x9220[_0x99ad('0x4b')]['id']}})[_0x99ad('0x25')](handleEntityNotFound(_0x22011e,null))[_0x99ad('0x25')](saveUpdates(_0x9220['body'],null))[_0x99ad('0x25')](respondWithResult(_0x22011e,null))['catch'](handleError(_0x22011e,null));};exports[_0x99ad('0x26')]=function(_0x101724,_0x35cedd){return db[_0x99ad('0x2c')]['find']({'where':{'id':_0x101724[_0x99ad('0x4b')]['id']}})[_0x99ad('0x25')](handleEntityNotFound(_0x35cedd,null))[_0x99ad('0x25')](removeEntity(_0x35cedd,null))[_0x99ad('0x44')](handleError(_0x35cedd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 7a0c807..9430898 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 _0x10a7=['VoiceQueuesLog','event_dtm','dtm','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x465486,_0x4c346b){var _0x354a6f=function(_0x5f0b7e){while(--_0x5f0b7e){_0x465486['push'](_0x465486['shift']());}};_0x354a6f(++_0x4c346b);}(_0x10a7,0xd4));var _0x710a=function(_0x42221e,_0xf6a32e){_0x42221e=_0x42221e-0x0;var _0x436d0f=_0x10a7[_0x42221e];return _0x436d0f;};'use strict';var _=require(_0x710a('0x0'));var util=require(_0x710a('0x1'));var logger=require(_0x710a('0x2'))(_0x710a('0x3'));var moment=require(_0x710a('0x4'));var BPromise=require('bluebird');var rp=require(_0x710a('0x5'));var fs=require('fs');var path=require(_0x710a('0x6'));var rimraf=require(_0x710a('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0xc705ab,_0x1cb690){return _0xc705ab['define'](_0x710a('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x710a('0x9'),'fields':['event',_0x710a('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd64b=['moment','bluebird','request-promise','path','rimraf','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger'];(function(_0x1c3fe2,_0x21ec94){var _0x2409a5=function(_0x3f3109){while(--_0x3f3109){_0x1c3fe2['push'](_0x1c3fe2['shift']());}};_0x2409a5(++_0x21ec94);}(_0xd64b,0xc1));var _0xbd64=function(_0x4c3a36,_0xdba60f){_0x4c3a36=_0x4c3a36-0x0;var _0x40f945=_0xd64b[_0x4c3a36];return _0x40f945;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'paranoid':![],'indexes':[{'name':_0xbd64('0xa'),'fields':[_0xbd64('0xb'),_0xbd64('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5aa2e6c..c41ef50 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 _0xe356=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x23a298,_0x21adb7){var _0x31a410=function(_0x3350b9){while(--_0x3350b9){_0x23a298['push'](_0x23a298['shift']());}};_0x31a410(++_0x21adb7);}(_0xe356,0x1ee));var _0x6e35=function(_0x39da93,_0x56f2dd){_0x39da93=_0x39da93-0x0;var _0x72c814=_0xe356[_0x39da93];return _0x72c814;};'use strict';var _=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var moment=require(_0x6e35('0x2'));var BPromise=require(_0x6e35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e35('0x5'));var logger=require(_0x6e35('0x6'))(_0x6e35('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e35('0x8'));var client=jayson[_0x6e35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389ae2,_0xba948e,_0x114b4c){return new BPromise(function(_0x1da99b,_0x5119fa){return client[_0x6e35('0xa')](_0x389ae2,_0x114b4c)['then'](function(_0x3b3c16){logger['info'](_0x6e35('0xb'),_0xba948e,'request\x20sent');logger['debug'](_0x6e35('0xc'),_0xba948e,_0x6e35('0xd'),JSON['stringify'](_0x3b3c16));if(_0x3b3c16['error']){if(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0xf')]===0x1f4){logger[_0x6e35('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0xba948e,_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);return _0x5119fa(_0x3b3c16[_0x6e35('0xe')]['message']);}logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3b3c16[_0x6e35('0xe')]['message']);return _0x1da99b(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);}else{logger[_0x6e35('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0xba948e,_0x6e35('0xd'));_0x1da99b(_0x3b3c16[_0x6e35('0x12')][_0x6e35('0x10')]);}})['catch'](function(_0x3e7e7a){logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3e7e7a);_0x5119fa(_0x3e7e7a);});});} \ No newline at end of file +var _0xf031=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2098a2,_0x10d739){var _0xbb3a35=function(_0x328d97){while(--_0x328d97){_0x2098a2['push'](_0x2098a2['shift']());}};_0xbb3a35(++_0x10d739);}(_0xf031,0xfc));var _0x1f03=function(_0x4792cd,_0x163ae6){_0x4792cd=_0x4792cd-0x0;var _0x3d255b=_0xf031[_0x4792cd];return _0x3d255b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f03('0x0'));var BPromise=require(_0x1f03('0x1'));var rs=require(_0x1f03('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f03('0x3'));var logger=require(_0x1f03('0x4'))(_0x1f03('0x5'));var config=require('../../config/environment');var jayson=require(_0x1f03('0x6'));var client=jayson[_0x1f03('0x7')][_0x1f03('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23c63b,_0x416bc0,_0x5e37ab){return new BPromise(function(_0x239813,_0x3c6256){return client[_0x1f03('0x9')](_0x23c63b,_0x5e37ab)[_0x1f03('0xa')](function(_0x136c23){logger[_0x1f03('0xb')](_0x1f03('0xc'),_0x416bc0,_0x1f03('0xd'));logger[_0x1f03('0xe')](_0x1f03('0xf'),_0x416bc0,_0x1f03('0xd'),JSON[_0x1f03('0x10')](_0x136c23));if(_0x136c23['error']){if(_0x136c23[_0x1f03('0x11')][_0x1f03('0x12')]===0x1f4){logger[_0x1f03('0x11')](_0x1f03('0xc'),_0x416bc0,_0x136c23[_0x1f03('0x11')][_0x1f03('0x13')]);return _0x3c6256(_0x136c23['error'][_0x1f03('0x13')]);}logger[_0x1f03('0x11')](_0x1f03('0xc'),_0x416bc0,_0x136c23[_0x1f03('0x11')][_0x1f03('0x13')]);return _0x239813(_0x136c23['error'][_0x1f03('0x13')]);}else{logger[_0x1f03('0xb')](_0x1f03('0xc'),_0x416bc0,'request\x20sent');_0x239813(_0x136c23[_0x1f03('0x14')][_0x1f03('0x13')]);}})['catch'](function(_0xd0e971){logger[_0x1f03('0x11')](_0x1f03('0xc'),_0x416bc0,_0xd0e971);_0x3c6256(_0xd0e971);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 597b207..80c011c 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 _0x5a76=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','describe','isAuthenticated','show','/:id/download','download'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5a76,0x168));var _0x65a7=function(_0x51334b,_0x15f186){_0x51334b=_0x51334b-0x0;var _0x5b680a=_0x5a76[_0x51334b];return _0x5b680a;};'use strict';var multer=require(_0x65a7('0x0'));var util=require(_0x65a7('0x1'));var path=require(_0x65a7('0x2'));var timeout=require(_0x65a7('0x3'));var express=require('express');var router=express[_0x65a7('0x4')]();var fs_extra=require(_0x65a7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x65a7('0x6'));var config=require(_0x65a7('0x7'));var controller=require(_0x65a7('0x8'));router[_0x65a7('0x9')]('/',auth['isAuthenticated'](),controller[_0x65a7('0xa')]);router[_0x65a7('0x9')](_0x65a7('0xb'),auth['isAuthenticated'](),controller[_0x65a7('0xc')]);router[_0x65a7('0x9')]('/:id',auth[_0x65a7('0xd')](),controller[_0x65a7('0xe')]);router[_0x65a7('0x9')](_0x65a7('0xf'),auth['isAuthenticated'](),controller[_0x65a7('0x10')]);router[_0x65a7('0x9')](_0x65a7('0x11'),controller[_0x65a7('0x12')]);router[_0x65a7('0x9')](_0x65a7('0x13'),auth[_0x65a7('0xd')](),controller[_0x65a7('0x14')]);router[_0x65a7('0x15')]('/',auth['isAuthenticated'](),controller[_0x65a7('0x16')]);router[_0x65a7('0x15')](_0x65a7('0x13'),auth[_0x65a7('0xd')](),controller[_0x65a7('0x17')]);router[_0x65a7('0x18')](_0x65a7('0x19'),auth['isAuthenticated'](),controller[_0x65a7('0x1a')]);router[_0x65a7('0x1b')](_0x65a7('0x19'),auth['isAuthenticated'](),controller['destroy']);module[_0x65a7('0x1c')]=router; \ No newline at end of file +var _0xefa3=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','destroy'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xefa3,0x88));var _0x3efa=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xefa3[_0x31ced5];return _0x10d9e5;};'use strict';var multer=require(_0x3efa('0x0'));var util=require(_0x3efa('0x1'));var path=require(_0x3efa('0x2'));var timeout=require(_0x3efa('0x3'));var express=require(_0x3efa('0x4'));var router=express['Router']();var fs_extra=require(_0x3efa('0x5'));var auth=require(_0x3efa('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3efa('0x7'));router[_0x3efa('0x8')]('/',auth[_0x3efa('0x9')](),controller[_0x3efa('0xa')]);router[_0x3efa('0x8')](_0x3efa('0xb'),auth[_0x3efa('0x9')](),controller[_0x3efa('0xc')]);router[_0x3efa('0x8')](_0x3efa('0xd'),auth[_0x3efa('0x9')](),controller[_0x3efa('0xe')]);router[_0x3efa('0x8')](_0x3efa('0xf'),auth['isAuthenticated'](),controller[_0x3efa('0x10')]);router['get'](_0x3efa('0x11'),controller[_0x3efa('0x12')]);router[_0x3efa('0x8')](_0x3efa('0x13'),auth[_0x3efa('0x9')](),controller[_0x3efa('0x14')]);router[_0x3efa('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/transcribe',auth[_0x3efa('0x9')](),controller[_0x3efa('0x16')]);router[_0x3efa('0x17')](_0x3efa('0xd'),auth[_0x3efa('0x9')](),controller[_0x3efa('0x18')]);router['delete'](_0x3efa('0xd'),auth[_0x3efa('0x9')](),controller[_0x3efa('0x19')]);module[_0x3efa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 3100b77..acb3f52 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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_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 1157233..3d48ba6 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 _0xae66=['IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','download','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','push','$and','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','unlinkSync','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0xae66,0x130));var _0x6ae6=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xae66[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x6ae6('0x0'));var rimraf=require(_0x6ae6('0x1'));var zipdir=require(_0x6ae6('0x2'));var jsonpatch=require(_0x6ae6('0x3'));var rp=require(_0x6ae6('0x4'));var moment=require(_0x6ae6('0x5'));var BPromise=require(_0x6ae6('0x6'));var Mustache=require('mustache');var util=require(_0x6ae6('0x7'));var path=require(_0x6ae6('0x8'));var sox=require(_0x6ae6('0x9'));var csv=require(_0x6ae6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ae6('0xb'));var _=require(_0x6ae6('0xc'));var squel=require('squel');var crypto=require(_0x6ae6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6ae6('0xe'));var toCsv=require(_0x6ae6('0xa'));var querystring=require(_0x6ae6('0xf'));var Papa=require(_0x6ae6('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x6ae6('0x11'));var Redis=require(_0x6ae6('0x12'));var authService=require(_0x6ae6('0x13'));var qs=require(_0x6ae6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ae6('0x15'));var logger=require(_0x6ae6('0x16'))(_0x6ae6('0x17'));var utils=require(_0x6ae6('0x18'));var config=require(_0x6ae6('0x19'));var licenseUtil=require(_0x6ae6('0x1a'));var db=require(_0x6ae6('0x1b'))['db'];function respondWithStatusCode(_0x47f658,_0x2bea50){_0x2bea50=_0x2bea50||0xcc;return function(_0x32d1c7){if(_0x32d1c7){return _0x47f658[_0x6ae6('0x1c')](_0x2bea50);}return _0x47f658[_0x6ae6('0x1d')](_0x2bea50)[_0x6ae6('0x1e')]();};}function respondWithResult(_0x1427d0,_0x367179){_0x367179=_0x367179||0xc8;return function(_0x1a3139){if(_0x1a3139){return _0x1427d0['status'](_0x367179)['json'](_0x1a3139);}};}function respondWithFilteredResult(_0x5e4103,_0x704100){return function(_0x4b6fbe){if(_0x4b6fbe){var _0x5d849e=typeof _0x704100[_0x6ae6('0x1f')]===_0x6ae6('0x20')&&typeof _0x704100[_0x6ae6('0x21')]==='undefined';var _0x352701=_0x4b6fbe['count'];var _0x266b22=_0x5d849e?0x0:_0x704100[_0x6ae6('0x1f')];var _0x3fd550=_0x5d849e?_0x4b6fbe['count']:_0x704100[_0x6ae6('0x1f')]+_0x704100[_0x6ae6('0x21')];var _0x373ef4;if(_0x3fd550>=_0x352701){_0x3fd550=_0x352701;_0x373ef4=0xc8;}else{_0x373ef4=0xce;}_0x5e4103[_0x6ae6('0x1d')](_0x373ef4);return _0x5e4103['set'](_0x6ae6('0x22'),_0x266b22+'-'+_0x3fd550+'/'+_0x352701)[_0x6ae6('0x23')](_0x4b6fbe);}return null;};}function patchUpdates(_0x2fbe13){return function(_0x196404){try{jsonpatch[_0x6ae6('0x24')](_0x196404,_0x2fbe13,!![]);}catch(_0x1af97d){return BPromise['reject'](_0x1af97d);}return _0x196404['save']();};}function saveUpdates(_0x1026ad,_0x4cba8e){return function(_0x292357){if(_0x292357){return _0x292357[_0x6ae6('0x25')](_0x1026ad)['then'](function(_0x2ed9cd){return _0x2ed9cd;});}return null;};}function removeEntity(_0xb0aa46,_0x5ca9a6){return function(_0x40f446){if(_0x40f446){return _0x40f446[_0x6ae6('0x26')]()[_0x6ae6('0x27')](function(){_0xb0aa46[_0x6ae6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55574d,_0x51671e){return function(_0x335b93){if(!_0x335b93){_0x55574d[_0x6ae6('0x1c')](0x194);}return _0x335b93;};}function handleError(_0x4a5ca8,_0xaa2b9){_0xaa2b9=_0xaa2b9||0x1f4;return function(_0xe78ca5){logger[_0x6ae6('0x28')](_0xe78ca5[_0x6ae6('0x29')]);if(_0xe78ca5[_0x6ae6('0x2a')]){delete _0xe78ca5[_0x6ae6('0x2a')];}_0x4a5ca8['status'](_0xaa2b9)[_0x6ae6('0x2b')](_0xe78ca5);};}exports[_0x6ae6('0x2c')]=function(_0x53ddf6,_0x3be57e){var _0x3c9d5e={},_0x32d782={},_0x275014={'count':0x0,'rows':[]};var _0xcc49e1=_[_0x6ae6('0x2d')](db[_0x6ae6('0x2e')][_0x6ae6('0x2f')],function(_0x2fdd53){return{'name':_0x2fdd53[_0x6ae6('0x30')],'type':_0x2fdd53['type'][_0x6ae6('0x31')]};});_0x32d782[_0x6ae6('0x32')]=_[_0x6ae6('0x33')](_[_0x6ae6('0x2d')](_0xcc49e1,'name'),[_0x6ae6('0x34')]);_0x32d782[_0x6ae6('0x35')]=_[_0x6ae6('0x36')](_0x53ddf6[_0x6ae6('0x35')]);_0x32d782[_0x6ae6('0x37')]=_[_0x6ae6('0x38')](_0x32d782[_0x6ae6('0x32')],_0x32d782['query']);_0x3c9d5e[_0x6ae6('0x39')]=_[_0x6ae6('0x38')](_0x32d782[_0x6ae6('0x32')],qs[_0x6ae6('0x3a')](_0x53ddf6[_0x6ae6('0x35')][_0x6ae6('0x3a')]));_0x3c9d5e[_0x6ae6('0x39')]=_0x3c9d5e['attributes'][_0x6ae6('0x3b')]?_0x3c9d5e[_0x6ae6('0x39')]:_0x32d782[_0x6ae6('0x32')];if(!_0x53ddf6[_0x6ae6('0x35')][_0x6ae6('0x3c')](_0x6ae6('0x3d'))){_0x3c9d5e[_0x6ae6('0x21')]=qs[_0x6ae6('0x21')](_0x53ddf6[_0x6ae6('0x35')][_0x6ae6('0x21')]);_0x3c9d5e['offset']=qs['offset'](_0x53ddf6[_0x6ae6('0x35')]['offset']);}_0x3c9d5e['order']=qs[_0x6ae6('0x3e')](_0x53ddf6[_0x6ae6('0x35')]['sort']);_0x3c9d5e['where']=qs[_0x6ae6('0x37')](_['pick'](_0x53ddf6[_0x6ae6('0x35')],_0x32d782[_0x6ae6('0x37')]),_0xcc49e1);if(_0x53ddf6[_0x6ae6('0x35')][_0x6ae6('0x3f')]){_0x3c9d5e[_0x6ae6('0x40')]=_[_0x6ae6('0x41')](_0x3c9d5e[_0x6ae6('0x40')],{'$or':_[_0x6ae6('0x2d')](_0xcc49e1,function(_0x28d4a6){if(_0x28d4a6[_0x6ae6('0x42')]!==_0x6ae6('0x43')){var _0x1b5872={};_0x1b5872[_0x28d4a6['name']]={'$like':'%'+_0x53ddf6['query']['filter']+'%'};return _0x1b5872;}})});}_0x3c9d5e=_['merge']({},_0x3c9d5e,_0x53ddf6[_0x6ae6('0x44')]);var _0x5e1f87={'where':_0x3c9d5e[_0x6ae6('0x40')]};return db['VoiceRecording'][_0x6ae6('0x45')](_0x5e1f87)['then'](function(_0x244b88){_0x275014[_0x6ae6('0x45')]=_0x244b88;if(_0x53ddf6[_0x6ae6('0x35')][_0x6ae6('0x46')]){_0x3c9d5e[_0x6ae6('0x47')]=[{'all':!![]}];}return db[_0x6ae6('0x2e')]['findAll'](_0x3c9d5e);})[_0x6ae6('0x27')](function(_0x4f6469){_0x275014[_0x6ae6('0x48')]=_0x4f6469;return _0x275014;})[_0x6ae6('0x27')](respondWithFilteredResult(_0x3be57e,_0x3c9d5e))[_0x6ae6('0x49')](handleError(_0x3be57e,null));};exports[_0x6ae6('0x4a')]=function(_0x4021cd,_0x168fd1){var _0x548402={'raw':![],'where':{'id':_0x4021cd[_0x6ae6('0x4b')]['id']}},_0x1c8b2c={};_0x1c8b2c['model']=_['keys'](db['VoiceRecording'][_0x6ae6('0x2f')]);_0x1c8b2c[_0x6ae6('0x35')]=_[_0x6ae6('0x36')](_0x4021cd[_0x6ae6('0x35')]);_0x1c8b2c[_0x6ae6('0x37')]=_[_0x6ae6('0x38')](_0x1c8b2c[_0x6ae6('0x32')],_0x1c8b2c[_0x6ae6('0x35')]);_0x548402[_0x6ae6('0x39')]=_[_0x6ae6('0x38')](_0x1c8b2c[_0x6ae6('0x32')],qs[_0x6ae6('0x3a')](_0x4021cd['query'][_0x6ae6('0x3a')]));_0x548402[_0x6ae6('0x39')]=_0x548402[_0x6ae6('0x39')][_0x6ae6('0x3b')]?_0x548402[_0x6ae6('0x39')]:_0x1c8b2c[_0x6ae6('0x32')];if(_0x4021cd[_0x6ae6('0x35')]['includeAll']){_0x548402[_0x6ae6('0x47')]=[{'all':!![]}];}_0x548402=_[_0x6ae6('0x41')]({},_0x548402,_0x4021cd[_0x6ae6('0x44')]);return db[_0x6ae6('0x2e')]['find'](_0x548402)[_0x6ae6('0x27')](handleEntityNotFound(_0x168fd1,null))['then'](respondWithResult(_0x168fd1,null))[_0x6ae6('0x49')](handleError(_0x168fd1,null));};exports[_0x6ae6('0x4c')]=function(_0x1843c7,_0x5d2757){return db[_0x6ae6('0x2e')][_0x6ae6('0x4c')](_0x1843c7['body'],{})[_0x6ae6('0x27')](respondWithResult(_0x5d2757,0xc9))[_0x6ae6('0x49')](handleError(_0x5d2757,null));};exports['update']=function(_0x1da8cd,_0x54a6db){if(_0x1da8cd[_0x6ae6('0x4d')]['id']){delete _0x1da8cd[_0x6ae6('0x4d')]['id'];}return db['VoiceRecording'][_0x6ae6('0x4e')]({'where':{'id':_0x1da8cd[_0x6ae6('0x4b')]['id']}})[_0x6ae6('0x27')](handleEntityNotFound(_0x54a6db,null))[_0x6ae6('0x27')](saveUpdates(_0x1da8cd[_0x6ae6('0x4d')],null))[_0x6ae6('0x27')](respondWithResult(_0x54a6db,null))[_0x6ae6('0x49')](handleError(_0x54a6db,null));};exports['describe']=function(_0x33f3fe,_0x422c26){return db[_0x6ae6('0x2e')][_0x6ae6('0x4f')]()[_0x6ae6('0x27')](respondWithResult(_0x422c26,null))[_0x6ae6('0x49')](handleError(_0x422c26,null));};exports['download']=function(_0x5ef334,_0xfa403d,_0x238526){var _0x3592eb=require(_0x6ae6('0x50'));var _0x31d6e2=![];var _0xcbd116={};if(_0x5ef334[_0x6ae6('0x35')]['type']&&_0x5ef334[_0x6ae6('0x35')]['type']==='uniqueid'){_0xcbd116[_0x6ae6('0x51')]=_0x5ef334['params']['id'];}else{_0xcbd116['id']=_0x5ef334['params']['id'];}return db[_0x6ae6('0x2e')][_0x6ae6('0x4e')]({'where':_0xcbd116,'attributes':['id',_0x6ae6('0x52')],'raw':!![]})[_0x6ae6('0x27')](handleEntityNotFound(_0xfa403d,null))[_0x6ae6('0x27')](function(_0x5c0fbe){if(_0x5c0fbe){var _0x277b46=_0x5c0fbe['value'];var _0x3f491a=util[_0x6ae6('0x34')](_0x6ae6('0x53'),_0x277b46);if(fs[_0x6ae6('0x54')](_0x3f491a)){_0x31d6e2=!![];return _0x3592eb[_0x6ae6('0x55')](_0x3f491a,_0x277b46,config[_0x6ae6('0x56')][_0x6ae6('0x57')])[_0x6ae6('0x27')](function(){return _0x5c0fbe;});}return _0x5c0fbe;}})[_0x6ae6('0x27')](function(_0x5c6ad9){if(_0x5c6ad9){var _0x3b7f65=_0x5c6ad9[_0x6ae6('0x52')];if(!fs[_0x6ae6('0x54')](_0x3b7f65)){throw new db[(_0x6ae6('0x58'))][(_0x6ae6('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x5c6ad9[_0x6ae6('0x5a')]){return _0xfa403d[_0x6ae6('0x5b')](_0x3b7f65,_0x5c6ad9[_0x6ae6('0x5a')]+path['extname'](_0x3b7f65),function(){if(_0x31d6e2){fs[_0x6ae6('0x5c')](_0x3b7f65);}});}else{return _0xfa403d[_0x6ae6('0x5b')](_0x3b7f65,function(_0x47d61e){if(_0x31d6e2){fs[_0x6ae6('0x5c')](_0x3b7f65);}});}}})['catch'](function(_0xa68906){if(_0xa68906[_0x6ae6('0x5d')]===_0x6ae6('0x5e')){_0xfa403d['status'](0x194)['send'](_0x6ae6('0x5f'));}else{return handleError(_0xfa403d,null);}});};exports[_0x6ae6('0x60')]=function(_0x22d6a6,_0x335a02,_0x5963e8){var _0x2b9767=require(_0x6ae6('0x50'));var _0x2f76c3=![];var _0x22cb5c={'$and':[db[_0x6ae6('0x61')][_0x6ae6('0x40')](db['sequelize']['fn']('MD5',db[_0x6ae6('0x61')]['col'](_0x6ae6('0x51'))),_0x22d6a6[_0x6ae6('0x35')]['token'])]};if(_0x22d6a6[_0x6ae6('0x35')]['type']&&_0x22d6a6[_0x6ae6('0x35')][_0x6ae6('0x42')]===_0x6ae6('0x51')){_0x22cb5c['$and'][_0x6ae6('0x62')]({'uniqueid':_0x22d6a6[_0x6ae6('0x4b')]['id']});}else{_0x22cb5c[_0x6ae6('0x63')][_0x6ae6('0x62')]({'id':_0x22d6a6[_0x6ae6('0x4b')]['id']});}return db[_0x6ae6('0x2e')][_0x6ae6('0x4e')]({'where':_0x22cb5c,'attributes':['id',_0x6ae6('0x52')],'raw':!![]})[_0x6ae6('0x27')](handleEntityNotFound(_0x335a02,null))['then'](function(_0x4c5f0b){if(_0x4c5f0b){var _0x1ed518=util[_0x6ae6('0x34')]('%s.cypher',_0x4c5f0b[_0x6ae6('0x52')]);if(fs[_0x6ae6('0x54')](_0x1ed518)){_0x2f76c3=!![];return _0x2b9767[_0x6ae6('0x55')](_0x1ed518,_0x4c5f0b[_0x6ae6('0x52')],config[_0x6ae6('0x56')]['recording'])['then'](function(){return _0x4c5f0b;});}return _0x4c5f0b;}})[_0x6ae6('0x27')](function(_0x488b2c){if(_0x488b2c){if(!fs[_0x6ae6('0x54')](_0x488b2c[_0x6ae6('0x52')])){throw new db['Sequelize'][(_0x6ae6('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x488b2c[_0x6ae6('0x5a')]){return _0x335a02['download'](_0x488b2c[_0x6ae6('0x52')],_0x488b2c[_0x6ae6('0x5a')]+path['extname'](_0x488b2c[_0x6ae6('0x52')]),function(){if(_0x2f76c3){fs[_0x6ae6('0x5c')](_0x488b2c[_0x6ae6('0x52')]);}});}else{return _0x335a02[_0x6ae6('0x5b')](_0x488b2c[_0x6ae6('0x52')],function(_0x5a3c6b){if(_0x2f76c3){fs['unlink'](_0x488b2c[_0x6ae6('0x52')]);}});}}})[_0x6ae6('0x49')](handleError(_0x335a02,null));};exports[_0x6ae6('0x26')]=function(_0x452e99,_0x3db81f){return db[_0x6ae6('0x2e')]['find']({'where':{'id':_0x452e99[_0x6ae6('0x4b')]['id']}})[_0x6ae6('0x27')](function(_0x5c1a2b){if(_[_0x6ae6('0x64')](_0x5c1a2b)){throw new ReferenceError(_0x6ae6('0x65'));}return _0x5c1a2b;})[_0x6ae6('0x27')](function(_0x5c8244){var _0x4a7335=_0x5c8244[_0x6ae6('0x52')];logger[_0x6ae6('0x66')](_0x6ae6('0x67'),_0x4a7335);if(!_['isNil'](_0x5c8244[_0x6ae6('0x52')])&&fs['existsSync'](_0x4a7335)){logger[_0x6ae6('0x66')](_0x6ae6('0x68')+_0x4a7335+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4a7335);}_0x4a7335=_0x4a7335+_0x6ae6('0x69');if(!_['isNil'](_0x5c8244[_0x6ae6('0x52')])&&fs['existsSync'](_0x4a7335)){logger[_0x6ae6('0x66')](_0x6ae6('0x68')+_0x4a7335+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6ae6('0x6a')](_0x4a7335);}return _0x5c8244;})['then'](function(_0x5d0080){if(!_0x5d0080)throw new InternalError();return _0x5d0080[_0x6ae6('0x26')]();})['then'](function(){_0x3db81f[_0x6ae6('0x1d')](0xcc)[_0x6ae6('0x1e')]();})['catch'](handleError(_0x3db81f,null));};function getBucketslist(_0x3c46b3,_0x12868b,_0x1e68ae){return new Promise(function(_0x174e55,_0x27eebe){var _0x32af5a=new AWS['S3']({'accessKeyId':_0x12868b,'secretAccessKey':_0x3c46b3,'region':_0x1e68ae});_0x32af5a['listBuckets']({},function(_0x558854,_0x28194f){if(_0x558854){return _0x27eebe(_0x558854);}else{return _0x174e55(_0x28194f);}});});}function createBucket(_0x1bc484,_0x5293f2,_0x28b399,_0x3bc529){return new Promise(function(_0x21ed21,_0x3f2c72){var _0x1422df=new AWS['S3']({'accessKeyId':_0x5293f2,'secretAccessKey':_0x1bc484,'region':_0x28b399});_0x1422df[_0x6ae6('0x6b')]({'Bucket':_0x3bc529},function(_0x3d43da,_0x12f78d){if(_0x3d43da){return _0x3f2c72(_0x3d43da);}else{return _0x21ed21(_0x12f78d);}});});}function uploadFile(_0x21bd74,_0x37d2c6,_0x19898c,_0x3cfaa6,_0x192658,_0x312e51){return new Promise(function(_0x5c05c1,_0x344349){var _0x23a689=new AWS['S3']({'accessKeyId':_0x37d2c6,'secretAccessKey':_0x21bd74,'region':_0x19898c});_0x23a689['upload']({'Bucket':_0x3cfaa6,'Key':_0x192658,'Body':_0x312e51},function(_0x22135f,_0x33e597){if(_0x22135f){return _0x344349(_0x22135f);}else{return _0x5c05c1(_0x33e597);}});});}function startTranscribe(_0xedf537,_0x5209f6,_0x4c2603,_0x324a27,_0x2caf32,_0x2b62ea){return new Promise(function(_0x54db56,_0x586c04){var _0xdca998=new AWS['TranscribeService']({'accessKeyId':_0x5209f6,'secretAccessKey':_0xedf537,'region':_0x4c2603});_0xdca998[_0x6ae6('0x6c')]({'TranscriptionJobName':_0x324a27,'LanguageCode':_0x2caf32,'Media':{'MediaFileUri':_0x2b62ea}},function(_0x3964ff,_0x39958e){if(_0x3964ff){return _0x586c04(_0x3964ff);}else{return _0x54db56(_0x39958e);}});});}function transcribe(_0x352812,_0x367310,_0xbed62d,_0x1018d3,_0xd67a16,_0x115648,_0x4651b8){return new Promise(function(_0x3f551e,_0x216930){var _0x588382={};logger[_0x6ae6('0x66')](util[_0x6ae6('0x34')](_0x6ae6('0x6d'),_0x352812,_0xd67a16));return uploadFile(_0x367310,_0xbed62d,_0x1018d3,_0xd67a16,path['basename'](_0x115648),fs['readFileSync'](_0x115648))[_0x6ae6('0x27')](function(_0x4dad88){logger[_0x6ae6('0x66')](util[_0x6ae6('0x34')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x352812,_0xd67a16,_0x4dad88['Location']));_0x588382['bucket']=_0x4dad88[_0x6ae6('0x6e')];_0x588382[_0x6ae6('0x6f')]=_0x4dad88[_0x6ae6('0x70')];logger[_0x6ae6('0x66')](util[_0x6ae6('0x34')](_0x6ae6('0x71'),_0x352812));return startTranscribe(_0x367310,_0xbed62d,_0x1018d3,uuidv4(),_0x4651b8,_0x4dad88['Location']);})[_0x6ae6('0x27')](function(_0x161227){logger[_0x6ae6('0x66')](util['format'](_0x6ae6('0x72'),_0x352812,_0x161227[_0x6ae6('0x73')][_0x6ae6('0x74')]));_0x588382[_0x6ae6('0x75')]=_0x161227[_0x6ae6('0x73')][_0x6ae6('0x74')];_0x588382['transcribeStatus']=_0x161227[_0x6ae6('0x73')][_0x6ae6('0x76')];return _0x3f551e(_0x588382);})['catch'](function(_0x112f81){return _0x216930(_0x112f81);});});}exports['runTranscribe']=function(_0x3b0c7d,_0x6136bb,_0x493f2d){var _0x3bbd8a;var _0x5c36e5;var _0x1e3396;var _0x1f5f27=require(_0x6ae6('0x50'));return db[_0x6ae6('0x2e')][_0x6ae6('0x77')]({'where':{'id':_0x3b0c7d[_0x6ae6('0x4b')]['id']}})[_0x6ae6('0x27')](function(_0x371d79){if(_0x371d79){var _0x156b50=util['format']('%s.cypher',_0x371d79[_0x6ae6('0x52')]);if(fs[_0x6ae6('0x54')](_0x156b50)){cypher=!![];return _0x1f5f27['decryptFile'](_0x156b50,_0x371d79[_0x6ae6('0x52')],config['secrets'][_0x6ae6('0x57')])['then'](function(){return _0x371d79;});}return _0x371d79;}})[_0x6ae6('0x27')](function(_0x5245d4){if(!_0x5245d4){throw new db[(_0x6ae6('0x58'))]['ValidationError'](_0x6ae6('0x78'));}_0x5c36e5=_0x5245d4;return db['Setting'][_0x6ae6('0x77')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x6136bb,null))['then'](function(_0x171421){if(_0x171421){_0x3bbd8a=_0x171421;if(!_0x3bbd8a[_0x6ae6('0x79')]||!_0x3bbd8a['transcribeAccountId']||!_0x3bbd8a[_0x6ae6('0x7a')]||!_0x3bbd8a[_0x6ae6('0x7b')]||!_0x3bbd8a[_0x6ae6('0x7c')]){throw new db[(_0x6ae6('0x58'))][(_0x6ae6('0x59'))](_0x6ae6('0x7d'));}if(_0x3b0c7d['body'][_0x6ae6('0x7e')]&&(!_0x3bbd8a[_0x6ae6('0x7f')]||!_0x3bbd8a[_0x6ae6('0x80')]||!_0x3bbd8a[_0x6ae6('0x81')]||!_0x3bbd8a[_0x6ae6('0x7b')]||!_0x3bbd8a['bucket'])){throw new db[(_0x6ae6('0x58'))][(_0x6ae6('0x59'))](_0x6ae6('0x82'));}return db['CloudProvider'][_0x6ae6('0x77')]({'where':{'id':_0x3bbd8a[_0x6ae6('0x83')]}});}})[_0x6ae6('0x27')](function(_0x2cc671){if(!_0x2cc671){throw new db[(_0x6ae6('0x58'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2cc671[_0x6ae6('0x84')]||!_0x2cc671[_0x6ae6('0x85')]){throw new db[(_0x6ae6('0x58'))][(_0x6ae6('0x59'))](_0x6ae6('0x86'));}_0x1e3396=_0x2cc671;return getBucketslist(_0x1e3396[_0x6ae6('0x84')],_0x1e3396[_0x6ae6('0x85')],_0x3bbd8a[_0x6ae6('0x7a')]);})['then'](function(_0x37812d){if(_0x37812d&&_0x37812d[_0x6ae6('0x87')]){var _0x1f4c0c=_[_0x6ae6('0x4e')](_0x37812d[_0x6ae6('0x87')],function(_0x5e5e3c){return _0x5e5e3c[_0x6ae6('0x88')]===_0x3bbd8a['bucket'];});if(!_0x1f4c0c){logger['info'](util[_0x6ae6('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3b0c7d['params']['id'],_0x3bbd8a[_0x6ae6('0x7c')]));return createBucket(_0x1e3396[_0x6ae6('0x84')],_0x1e3396[_0x6ae6('0x85')],_0x3bbd8a[_0x6ae6('0x7a')],_0x3bbd8a[_0x6ae6('0x7c')]);}logger[_0x6ae6('0x66')](util[_0x6ae6('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x3b0c7d['params']['id'],_0x3bbd8a[_0x6ae6('0x7c')]));return;}})['then'](function(_0x28438f){if(_0x5c36e5[_0x6ae6('0x89')]===_0x6ae6('0x8a')){return transcribe(_0x3b0c7d['params']['id'],_0x1e3396['data1'],_0x1e3396[_0x6ae6('0x85')],_0x3bbd8a[_0x6ae6('0x7a')],_0x3bbd8a[_0x6ae6('0x7c')],_0x5c36e5[_0x6ae6('0x52')],_0x3bbd8a[_0x6ae6('0x7b')]);}else{logger['info'](util[_0x6ae6('0x34')](_0x6ae6('0x8b'),_0x3b0c7d[_0x6ae6('0x4b')]['id']));return{'transcribeStatus':_0x6ae6('0x8c')};}})['then'](function(_0x4d1f7a){if(_0x4d1f7a){_0x4d1f7a[_0x6ae6('0x8d')]=_0x3b0c7d[_0x6ae6('0x4d')]['runSentiment'];return _0x5c36e5[_0x6ae6('0x8e')](_0x4d1f7a);}})[_0x6ae6('0x27')](respondWithResult(_0x6136bb,null))[_0x6ae6('0x49')](handleError(_0x6136bb,null));};function writeFile(_0x14c495,_0x437152){return new Promise(function(_0x14e8c2,_0x11aa75){fs['writeFile'](_0x437152,_0x14c495,function(_0x46a562,_0x4e29cf){if(_0x46a562){return _0x11aa75(_0x46a562);}else{return _0x14e8c2(_0x4e29cf);}});});}exports[_0x6ae6('0x8f')]=function(_0x393f69,_0x1aa007,_0x1ef42f){return db[_0x6ae6('0x2e')][_0x6ae6('0x77')]({'where':{'id':_0x393f69['params']['id']}})[_0x6ae6('0x27')](handleEntityNotFound(_0x1aa007))[_0x6ae6('0x27')](function(_0x594143){if(_0x594143&&_0x594143[_0x6ae6('0x90')]){var _0x27b6e6=_0x594143[_0x6ae6('0x90')];var _0x27a79a=config[_0x6ae6('0x91')]+_0x6ae6('0x92')+_0x594143['id']+'.txt';if(fs[_0x6ae6('0x54')](_0x27a79a)){return _0x27a79a;}return writeFile(_0x27b6e6,_0x27a79a)[_0x6ae6('0x27')](function(){return _0x27a79a;});}else{throw new db[(_0x6ae6('0x58'))][(_0x6ae6('0x59'))](_0x6ae6('0x93'));}})[_0x6ae6('0x27')](function(_0x2ef07f){return _0x1aa007[_0x6ae6('0x5b')](_0x2ef07f);})[_0x6ae6('0x49')](handleError(_0x1aa007));}; \ No newline at end of file +var _0xc48e=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','options','findAll','rows','catch','show','length','includeAll','include','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4da4f8,_0x1742fb){var _0x549574=function(_0x4742c0){while(--_0x4742c0){_0x4da4f8['push'](_0x4da4f8['shift']());}};_0x549574(++_0x1742fb);}(_0xc48e,0x1c1));var _0xec48=function(_0x11c1a1,_0x17ba8c){_0x11c1a1=_0x11c1a1-0x0;var _0x483746=_0xc48e[_0x11c1a1];return _0x483746;};'use strict';var emlformat=require(_0xec48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec48('0x2'));var moment=require(_0xec48('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec48('0x4'));var path=require(_0xec48('0x5'));var sox=require(_0xec48('0x6'));var csv=require(_0xec48('0x7'));var ejs=require(_0xec48('0x8'));var fs=require('fs');var fs_extra=require(_0xec48('0x9'));var _=require(_0xec48('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec48('0xb'));var deskjs=require(_0xec48('0xc'));var toCsv=require('to-csv');var querystring=require(_0xec48('0xd'));var Papa=require(_0xec48('0xe'));var AWS=require(_0xec48('0xf'));var uuidv4=require(_0xec48('0x10'));var Redis=require('ioredis');var authService=require(_0xec48('0x11'));var qs=require(_0xec48('0x12'));var as=require(_0xec48('0x13'));var hardwareService=require(_0xec48('0x14'));var logger=require(_0xec48('0x15'))(_0xec48('0x16'));var utils=require(_0xec48('0x17'));var config=require(_0xec48('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xec48('0x19'))['db'];function respondWithStatusCode(_0x5cc04f,_0x3aee6a){_0x3aee6a=_0x3aee6a||0xcc;return function(_0x2bba52){if(_0x2bba52){return _0x5cc04f[_0xec48('0x1a')](_0x3aee6a);}return _0x5cc04f['status'](_0x3aee6a)[_0xec48('0x1b')]();};}function respondWithResult(_0x2ab503,_0x2e33ee){_0x2e33ee=_0x2e33ee||0xc8;return function(_0xc7e8a5){if(_0xc7e8a5){return _0x2ab503[_0xec48('0x1c')](_0x2e33ee)[_0xec48('0x1d')](_0xc7e8a5);}};}function respondWithFilteredResult(_0x1db858,_0x2d5595){return function(_0x482a6b){if(_0x482a6b){var _0x534c4b=typeof _0x2d5595[_0xec48('0x1e')]===_0xec48('0x1f')&&typeof _0x2d5595[_0xec48('0x20')]===_0xec48('0x1f');var _0x5423ed=_0x482a6b['count'];var _0x28b89d=_0x534c4b?0x0:_0x2d5595[_0xec48('0x1e')];var _0x231f57=_0x534c4b?_0x482a6b[_0xec48('0x21')]:_0x2d5595[_0xec48('0x1e')]+_0x2d5595['limit'];var _0x5478a7;if(_0x231f57>=_0x5423ed){_0x231f57=_0x5423ed;_0x5478a7=0xc8;}else{_0x5478a7=0xce;}_0x1db858['status'](_0x5478a7);return _0x1db858[_0xec48('0x22')]('Content-Range',_0x28b89d+'-'+_0x231f57+'/'+_0x5423ed)[_0xec48('0x1d')](_0x482a6b);}return null;};}function patchUpdates(_0x50aabd){return function(_0x2b2a8a){try{jsonpatch[_0xec48('0x23')](_0x2b2a8a,_0x50aabd,!![]);}catch(_0x436c7d){return BPromise[_0xec48('0x24')](_0x436c7d);}return _0x2b2a8a[_0xec48('0x25')]();};}function saveUpdates(_0x333e87,_0x13cb57){return function(_0x442d38){if(_0x442d38){return _0x442d38[_0xec48('0x26')](_0x333e87)[_0xec48('0x27')](function(_0x4e4a04){return _0x4e4a04;});}return null;};}function removeEntity(_0x208ed7,_0x57d96c){return function(_0x5b8562){if(_0x5b8562){return _0x5b8562[_0xec48('0x28')]()[_0xec48('0x27')](function(){_0x208ed7[_0xec48('0x1c')](0xcc)[_0xec48('0x1b')]();});}};}function handleEntityNotFound(_0x1ba108,_0x52b60d){return function(_0x476330){if(!_0x476330){_0x1ba108[_0xec48('0x1a')](0x194);}return _0x476330;};}function handleError(_0x4de2a2,_0x470424){_0x470424=_0x470424||0x1f4;return function(_0x5c1e6b){logger['error'](_0x5c1e6b[_0xec48('0x29')]);if(_0x5c1e6b[_0xec48('0x2a')]){delete _0x5c1e6b[_0xec48('0x2a')];}_0x4de2a2[_0xec48('0x1c')](_0x470424)[_0xec48('0x2b')](_0x5c1e6b);};}exports['index']=function(_0x13049c,_0x5476c2){var _0x410692={},_0x26bd63={},_0x2284ca={'count':0x0,'rows':[]};var _0x5e1c83=_[_0xec48('0x2c')](db[_0xec48('0x2d')][_0xec48('0x2e')],function(_0x5903a3){return{'name':_0x5903a3['fieldName'],'type':_0x5903a3['type'][_0xec48('0x2f')]};});_0x26bd63[_0xec48('0x30')]=_[_0xec48('0x31')](_[_0xec48('0x2c')](_0x5e1c83,_0xec48('0x2a')),[_0xec48('0x32')]);_0x26bd63[_0xec48('0x33')]=_[_0xec48('0x34')](_0x13049c[_0xec48('0x33')]);_0x26bd63[_0xec48('0x35')]=_[_0xec48('0x36')](_0x26bd63['model'],_0x26bd63[_0xec48('0x33')]);_0x410692[_0xec48('0x37')]=_[_0xec48('0x36')](_0x26bd63[_0xec48('0x30')],qs[_0xec48('0x38')](_0x13049c[_0xec48('0x33')][_0xec48('0x38')]));_0x410692[_0xec48('0x37')]=_0x410692['attributes']['length']?_0x410692['attributes']:_0x26bd63[_0xec48('0x30')];if(!_0x13049c[_0xec48('0x33')][_0xec48('0x39')]('nolimit')){_0x410692[_0xec48('0x20')]=qs['limit'](_0x13049c[_0xec48('0x33')]['limit']);_0x410692[_0xec48('0x1e')]=qs[_0xec48('0x1e')](_0x13049c['query'][_0xec48('0x1e')]);}_0x410692[_0xec48('0x3a')]=qs[_0xec48('0x3b')](_0x13049c[_0xec48('0x33')]['sort']);_0x410692['where']=qs[_0xec48('0x35')](_[_0xec48('0x3c')](_0x13049c['query'],_0x26bd63[_0xec48('0x35')]),_0x5e1c83);if(_0x13049c[_0xec48('0x33')][_0xec48('0x3d')]){_0x410692[_0xec48('0x3e')]=_['merge'](_0x410692[_0xec48('0x3e')],{'$or':_['map'](_0x5e1c83,function(_0x5610ed){if(_0x5610ed[_0xec48('0x3f')]!==_0xec48('0x40')){var _0x32d812={};_0x32d812[_0x5610ed[_0xec48('0x2a')]]={'$like':'%'+_0x13049c[_0xec48('0x33')][_0xec48('0x3d')]+'%'};return _0x32d812;}})});}_0x410692=_['merge']({},_0x410692,_0x13049c[_0xec48('0x41')]);var _0x75830b={'where':_0x410692[_0xec48('0x3e')]};return db[_0xec48('0x2d')][_0xec48('0x21')](_0x75830b)[_0xec48('0x27')](function(_0x19e5ef){_0x2284ca[_0xec48('0x21')]=_0x19e5ef;if(_0x13049c[_0xec48('0x33')]['includeAll']){_0x410692['include']=[{'all':!![]}];}return db[_0xec48('0x2d')][_0xec48('0x42')](_0x410692);})['then'](function(_0x87fad1){_0x2284ca[_0xec48('0x43')]=_0x87fad1;return _0x2284ca;})['then'](respondWithFilteredResult(_0x5476c2,_0x410692))[_0xec48('0x44')](handleError(_0x5476c2,null));};exports[_0xec48('0x45')]=function(_0x4ecc6f,_0x197e87){var _0xc42963={'raw':![],'where':{'id':_0x4ecc6f['params']['id']}},_0x5318ea={};_0x5318ea[_0xec48('0x30')]=_[_0xec48('0x34')](db['VoiceRecording'][_0xec48('0x2e')]);_0x5318ea['query']=_[_0xec48('0x34')](_0x4ecc6f['query']);_0x5318ea[_0xec48('0x35')]=_[_0xec48('0x36')](_0x5318ea['model'],_0x5318ea['query']);_0xc42963[_0xec48('0x37')]=_[_0xec48('0x36')](_0x5318ea['model'],qs[_0xec48('0x38')](_0x4ecc6f[_0xec48('0x33')][_0xec48('0x38')]));_0xc42963[_0xec48('0x37')]=_0xc42963[_0xec48('0x37')][_0xec48('0x46')]?_0xc42963[_0xec48('0x37')]:_0x5318ea[_0xec48('0x30')];if(_0x4ecc6f[_0xec48('0x33')][_0xec48('0x47')]){_0xc42963[_0xec48('0x48')]=[{'all':!![]}];}_0xc42963=_['merge']({},_0xc42963,_0x4ecc6f[_0xec48('0x41')]);return db[_0xec48('0x2d')][_0xec48('0x49')](_0xc42963)[_0xec48('0x27')](handleEntityNotFound(_0x197e87,null))['then'](respondWithResult(_0x197e87,null))[_0xec48('0x44')](handleError(_0x197e87,null));};exports[_0xec48('0x4a')]=function(_0x23d270,_0x2a5cba){return db[_0xec48('0x2d')][_0xec48('0x4a')](_0x23d270[_0xec48('0x4b')],{})['then'](respondWithResult(_0x2a5cba,0xc9))[_0xec48('0x44')](handleError(_0x2a5cba,null));};exports[_0xec48('0x26')]=function(_0x26373a,_0x1beb44){if(_0x26373a[_0xec48('0x4b')]['id']){delete _0x26373a[_0xec48('0x4b')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x26373a['params']['id']}})[_0xec48('0x27')](handleEntityNotFound(_0x1beb44,null))[_0xec48('0x27')](saveUpdates(_0x26373a[_0xec48('0x4b')],null))['then'](respondWithResult(_0x1beb44,null))[_0xec48('0x44')](handleError(_0x1beb44,null));};exports['describe']=function(_0x55772d,_0x49fdf9){return db[_0xec48('0x2d')][_0xec48('0x4c')]()[_0xec48('0x27')](respondWithResult(_0x49fdf9,null))[_0xec48('0x44')](handleError(_0x49fdf9,null));};exports[_0xec48('0x4d')]=function(_0x552676,_0x4d97bd,_0x846989){var _0x25997a=require(_0xec48('0x4e'));var _0x386b13=![];var _0x2d1cb3={};if(_0x552676[_0xec48('0x33')]['type']&&_0x552676[_0xec48('0x33')][_0xec48('0x3f')]===_0xec48('0x4f')){_0x2d1cb3[_0xec48('0x4f')]=_0x552676[_0xec48('0x50')]['id'];}else{_0x2d1cb3['id']=_0x552676[_0xec48('0x50')]['id'];}return db[_0xec48('0x2d')][_0xec48('0x49')]({'where':_0x2d1cb3,'attributes':['id',_0xec48('0x51')],'raw':!![]})[_0xec48('0x27')](handleEntityNotFound(_0x4d97bd,null))[_0xec48('0x27')](function(_0x261535){if(_0x261535){var _0x42cafc=_0x261535[_0xec48('0x51')];var _0x1360eb=util[_0xec48('0x32')](_0xec48('0x52'),_0x42cafc);if(fs[_0xec48('0x53')](_0x1360eb)){_0x386b13=!![];return _0x25997a[_0xec48('0x54')](_0x1360eb,_0x42cafc,config[_0xec48('0x55')][_0xec48('0x56')])[_0xec48('0x27')](function(){return _0x261535;});}return _0x261535;}})[_0xec48('0x27')](function(_0x1bcca4){if(_0x1bcca4){var _0x37202c=_0x1bcca4[_0xec48('0x51')];if(!fs[_0xec48('0x53')](_0x37202c)){throw new db[(_0xec48('0x57'))][(_0xec48('0x58'))](_0xec48('0x59'));}if(_0x1bcca4[_0xec48('0x5a')]){return _0x4d97bd[_0xec48('0x4d')](_0x37202c,_0x1bcca4[_0xec48('0x5a')]+path[_0xec48('0x5b')](_0x37202c),function(){if(_0x386b13){fs['unlink'](_0x37202c);}});}else{return _0x4d97bd['download'](_0x37202c,function(_0x2581dc){if(_0x386b13){fs[_0xec48('0x5c')](_0x37202c);}});}}})[_0xec48('0x44')](function(_0x55228e){if(_0x55228e[_0xec48('0x5d')]==='VoiceRecording\x20not\x20found'){_0x4d97bd[_0xec48('0x1c')](0x194)[_0xec48('0x2b')](_0xec48('0x5e'));}else{return handleError(_0x4d97bd,null);}});};exports[_0xec48('0x5f')]=function(_0x3ae5e0,_0x569969,_0x3bbd15){var _0x37253f=require(_0xec48('0x4e'));var _0x1872e0=![];var _0x1c52e6={'$and':[db[_0xec48('0x60')][_0xec48('0x3e')](db['sequelize']['fn'](_0xec48('0x61'),db['sequelize'][_0xec48('0x62')](_0xec48('0x4f'))),_0x3ae5e0[_0xec48('0x33')]['token'])]};if(_0x3ae5e0[_0xec48('0x33')][_0xec48('0x3f')]&&_0x3ae5e0['query']['type']==='uniqueid'){_0x1c52e6[_0xec48('0x63')][_0xec48('0x64')]({'uniqueid':_0x3ae5e0[_0xec48('0x50')]['id']});}else{_0x1c52e6[_0xec48('0x63')]['push']({'id':_0x3ae5e0[_0xec48('0x50')]['id']});}return db[_0xec48('0x2d')][_0xec48('0x49')]({'where':_0x1c52e6,'attributes':['id',_0xec48('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x569969,null))[_0xec48('0x27')](function(_0xfe7f23){if(_0xfe7f23){var _0x4ada3a=util['format'](_0xec48('0x52'),_0xfe7f23['value']);if(fs[_0xec48('0x53')](_0x4ada3a)){_0x1872e0=!![];return _0x37253f[_0xec48('0x54')](_0x4ada3a,_0xfe7f23[_0xec48('0x51')],config[_0xec48('0x55')]['recording'])['then'](function(){return _0xfe7f23;});}return _0xfe7f23;}})[_0xec48('0x27')](function(_0x273027){if(_0x273027){if(!fs[_0xec48('0x53')](_0x273027['value'])){throw new db['Sequelize']['ValidationError'](_0xec48('0x59'));}if(_0x273027['filename']){return _0x569969[_0xec48('0x4d')](_0x273027[_0xec48('0x51')],_0x273027[_0xec48('0x5a')]+path[_0xec48('0x5b')](_0x273027[_0xec48('0x51')]),function(){if(_0x1872e0){fs['unlink'](_0x273027['value']);}});}else{return _0x569969[_0xec48('0x4d')](_0x273027[_0xec48('0x51')],function(_0x3ec919){if(_0x1872e0){fs[_0xec48('0x5c')](_0x273027['value']);}});}}})['catch'](handleError(_0x569969,null));};exports[_0xec48('0x28')]=function(_0xdd021d,_0x55b7f4){return db[_0xec48('0x2d')][_0xec48('0x49')]({'where':{'id':_0xdd021d[_0xec48('0x50')]['id']}})[_0xec48('0x27')](function(_0x20535d){if(_[_0xec48('0x65')](_0x20535d)){throw new ReferenceError(_0xec48('0x66'));}return _0x20535d;})[_0xec48('0x27')](function(_0x20c3e9){var _0x21bebe=_0x20c3e9[_0xec48('0x51')];logger[_0xec48('0x67')](_0xec48('0x68'),_0x21bebe);if(!_[_0xec48('0x65')](_0x20c3e9[_0xec48('0x51')])&&fs[_0xec48('0x53')](_0x21bebe)){logger['info'](_0xec48('0x69')+_0x21bebe+_0xec48('0x6a'));fs[_0xec48('0x6b')](_0x21bebe);}_0x21bebe=_0x21bebe+_0xec48('0x6c');if(!_[_0xec48('0x65')](_0x20c3e9[_0xec48('0x51')])&&fs[_0xec48('0x53')](_0x21bebe)){logger['info'](_0xec48('0x69')+_0x21bebe+_0xec48('0x6a'));fs[_0xec48('0x6b')](_0x21bebe);}return _0x20c3e9;})['then'](function(_0x481228){if(!_0x481228)throw new InternalError();return _0x481228[_0xec48('0x28')]();})['then'](function(){_0x55b7f4['status'](0xcc)['end']();})['catch'](handleError(_0x55b7f4,null));};function getBucketslist(_0x41c27a,_0xa100f7,_0x384986){return new Promise(function(_0x267872,_0x32d13f){var _0x208d9f=new AWS['S3']({'accessKeyId':_0xa100f7,'secretAccessKey':_0x41c27a,'region':_0x384986});_0x208d9f[_0xec48('0x6d')]({},function(_0x2af33c,_0xe4a294){if(_0x2af33c){return _0x32d13f(_0x2af33c);}else{return _0x267872(_0xe4a294);}});});}function createBucket(_0x350953,_0x3bc238,_0x1ec9a3,_0x554a8e){return new Promise(function(_0x5b21f9,_0x1a70bf){var _0x3e9df8=new AWS['S3']({'accessKeyId':_0x3bc238,'secretAccessKey':_0x350953,'region':_0x1ec9a3});_0x3e9df8['createBucket']({'Bucket':_0x554a8e},function(_0x5c75ba,_0x3b2b2e){if(_0x5c75ba){return _0x1a70bf(_0x5c75ba);}else{return _0x5b21f9(_0x3b2b2e);}});});}function uploadFile(_0x51a923,_0x30d8d0,_0x2a5d02,_0x121662,_0x1b025e,_0x18f979){return new Promise(function(_0x5b5223,_0x38b6d3){var _0x21dff1=new AWS['S3']({'accessKeyId':_0x30d8d0,'secretAccessKey':_0x51a923,'region':_0x2a5d02});_0x21dff1[_0xec48('0x6e')]({'Bucket':_0x121662,'Key':_0x1b025e,'Body':_0x18f979},function(_0x427f50,_0x5c602b){if(_0x427f50){return _0x38b6d3(_0x427f50);}else{return _0x5b5223(_0x5c602b);}});});}function startTranscribe(_0x4b67cc,_0x27fcee,_0x558d79,_0x8db671,_0x58a280,_0x520b3a){return new Promise(function(_0x5973e0,_0x1fe3bf){var _0x304cce=new AWS[(_0xec48('0x6f'))]({'accessKeyId':_0x27fcee,'secretAccessKey':_0x4b67cc,'region':_0x558d79});_0x304cce[_0xec48('0x70')]({'TranscriptionJobName':_0x8db671,'LanguageCode':_0x58a280,'Media':{'MediaFileUri':_0x520b3a}},function(_0x3d5907,_0x42bc11){if(_0x3d5907){return _0x1fe3bf(_0x3d5907);}else{return _0x5973e0(_0x42bc11);}});});}function transcribe(_0x29feb2,_0x571fc2,_0x5e8e7b,_0x540b91,_0x10cb03,_0x64135b,_0x291524){return new Promise(function(_0x35bb89,_0x47f1e0){var _0x573f18={};logger[_0xec48('0x67')](util['format'](_0xec48('0x71'),_0x29feb2,_0x10cb03));return uploadFile(_0x571fc2,_0x5e8e7b,_0x540b91,_0x10cb03,path['basename'](_0x64135b),fs[_0xec48('0x72')](_0x64135b))[_0xec48('0x27')](function(_0x7b80c9){logger[_0xec48('0x67')](util[_0xec48('0x32')](_0xec48('0x73'),_0x29feb2,_0x10cb03,_0x7b80c9[_0xec48('0x74')]));_0x573f18['bucket']=_0x7b80c9[_0xec48('0x75')];_0x573f18[_0xec48('0x76')]=_0x7b80c9['Location'];logger[_0xec48('0x67')](util[_0xec48('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x29feb2));return startTranscribe(_0x571fc2,_0x5e8e7b,_0x540b91,uuidv4(),_0x291524,_0x7b80c9['Location']);})['then'](function(_0x54df1f){logger[_0xec48('0x67')](util['format'](_0xec48('0x77'),_0x29feb2,_0x54df1f['TranscriptionJob'][_0xec48('0x78')]));_0x573f18['transcribeName']=_0x54df1f[_0xec48('0x79')][_0xec48('0x78')];_0x573f18[_0xec48('0x7a')]=_0x54df1f[_0xec48('0x79')][_0xec48('0x7b')];return _0x35bb89(_0x573f18);})[_0xec48('0x44')](function(_0x661f6b){return _0x47f1e0(_0x661f6b);});});}exports[_0xec48('0x7c')]=function(_0x68c357,_0x213822,_0x2e4d0c){var _0x13b466;var _0x5219bf;var _0xa10d3b;var _0x574e05=require(_0xec48('0x4e'));return db[_0xec48('0x2d')]['findOne']({'where':{'id':_0x68c357[_0xec48('0x50')]['id']}})[_0xec48('0x27')](function(_0x488f06){if(_0x488f06){var _0x255423=util[_0xec48('0x32')](_0xec48('0x52'),_0x488f06[_0xec48('0x51')]);if(fs[_0xec48('0x53')](_0x255423)){cypher=!![];return _0x574e05[_0xec48('0x54')](_0x255423,_0x488f06['value'],config[_0xec48('0x55')][_0xec48('0x56')])[_0xec48('0x27')](function(){return _0x488f06;});}return _0x488f06;}})[_0xec48('0x27')](function(_0x3d14c9){if(!_0x3d14c9){throw new db[(_0xec48('0x57'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x5219bf=_0x3d14c9;return db[_0xec48('0x7d')][_0xec48('0x7e')]({'where':{'id':0x1}});})[_0xec48('0x27')](handleEntityNotFound(_0x213822,null))[_0xec48('0x27')](function(_0x37b461){if(_0x37b461){_0x13b466=_0x37b461;if(!_0x13b466[_0xec48('0x7f')]||!_0x13b466[_0xec48('0x80')]||!_0x13b466['transcribeRegion']||!_0x13b466[_0xec48('0x81')]||!_0x13b466['bucket']){throw new db[(_0xec48('0x57'))]['ValidationError'](_0xec48('0x82'));}if(_0x68c357[_0xec48('0x4b')][_0xec48('0x83')]&&(!_0x13b466[_0xec48('0x84')]||!_0x13b466[_0xec48('0x85')]||!_0x13b466[_0xec48('0x86')]||!_0x13b466['language']||!_0x13b466['bucket'])){throw new db[(_0xec48('0x57'))][(_0xec48('0x58'))](_0xec48('0x87'));}return db[_0xec48('0x88')][_0xec48('0x7e')]({'where':{'id':_0x13b466[_0xec48('0x80')]}});}})[_0xec48('0x27')](function(_0x491741){if(!_0x491741){throw new db[(_0xec48('0x57'))][(_0xec48('0x58'))](_0xec48('0x89'));}if(!_0x491741[_0xec48('0x8a')]||!_0x491741[_0xec48('0x8b')]){throw new db['Sequelize'][(_0xec48('0x58'))](_0xec48('0x8c'));}_0xa10d3b=_0x491741;return getBucketslist(_0xa10d3b[_0xec48('0x8a')],_0xa10d3b[_0xec48('0x8b')],_0x13b466['transcribeRegion']);})[_0xec48('0x27')](function(_0xc7bfc3){if(_0xc7bfc3&&_0xc7bfc3[_0xec48('0x8d')]){var _0x4301a9=_[_0xec48('0x49')](_0xc7bfc3[_0xec48('0x8d')],function(_0x21ebcc){return _0x21ebcc[_0xec48('0x8e')]===_0x13b466[_0xec48('0x8f')];});if(!_0x4301a9){logger[_0xec48('0x67')](util[_0xec48('0x32')](_0xec48('0x90'),_0x68c357['params']['id'],_0x13b466['bucket']));return createBucket(_0xa10d3b['data1'],_0xa10d3b[_0xec48('0x8b')],_0x13b466['transcribeRegion'],_0x13b466[_0xec48('0x8f')]);}logger[_0xec48('0x67')](util[_0xec48('0x32')](_0xec48('0x91'),_0x68c357[_0xec48('0x50')]['id'],_0x13b466['bucket']));return;}})[_0xec48('0x27')](function(_0x22f20b){if(_0x5219bf[_0xec48('0x7a')]===_0xec48('0x92')){return transcribe(_0x68c357[_0xec48('0x50')]['id'],_0xa10d3b['data1'],_0xa10d3b[_0xec48('0x8b')],_0x13b466[_0xec48('0x93')],_0x13b466['bucket'],_0x5219bf[_0xec48('0x51')],_0x13b466['language']);}else{logger[_0xec48('0x67')](util[_0xec48('0x32')](_0xec48('0x94'),_0x68c357['params']['id']));return{'transcribeStatus':_0xec48('0x95')};}})[_0xec48('0x27')](function(_0x9783a6){if(_0x9783a6){_0x9783a6[_0xec48('0x96')]=_0x68c357[_0xec48('0x4b')][_0xec48('0x83')];return _0x5219bf[_0xec48('0x97')](_0x9783a6);}})[_0xec48('0x27')](respondWithResult(_0x213822,null))[_0xec48('0x44')](handleError(_0x213822,null));};function writeFile(_0x312226,_0x43f2ae){return new Promise(function(_0x16bf80,_0x4d2291){fs[_0xec48('0x98')](_0x43f2ae,_0x312226,function(_0x3d961c,_0x1a9005){if(_0x3d961c){return _0x4d2291(_0x3d961c);}else{return _0x16bf80(_0x1a9005);}});});}exports[_0xec48('0x99')]=function(_0x2c5ede,_0x56310c,_0x11bafc){return db['VoiceRecording'][_0xec48('0x7e')]({'where':{'id':_0x2c5ede[_0xec48('0x50')]['id']}})[_0xec48('0x27')](handleEntityNotFound(_0x56310c))[_0xec48('0x27')](function(_0x3c8be2){if(_0x3c8be2&&_0x3c8be2[_0xec48('0x9a')]){var _0xa95de7=_0x3c8be2[_0xec48('0x9a')];var _0x34690c=config['root']+_0xec48('0x9b')+_0x3c8be2['id']+_0xec48('0x9c');if(fs[_0xec48('0x53')](_0x34690c)){return _0x34690c;}return writeFile(_0xa95de7,_0x34690c)[_0xec48('0x27')](function(){return _0x34690c;});}else{throw new db[(_0xec48('0x57'))][(_0xec48('0x58'))](_0xec48('0x9d'));}})[_0xec48('0x27')](function(_0x3747a8){return _0x56310c['download'](_0x3747a8);})['catch'](handleError(_0x56310c));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ee10cdd..4277854 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 _0xfe61=['rimraf','../../config/environment','exports','define','voice_recordings','uniqueid','moment','bluebird','request-promise','path'];(function(_0x4f8696,_0xe13e7d){var _0x54e070=function(_0x431b24){while(--_0x431b24){_0x4f8696['push'](_0x4f8696['shift']());}};_0x54e070(++_0xe13e7d);}(_0xfe61,0x1b4));var _0x1fe6=function(_0x4cca4d,_0x2bc903){_0x4cca4d=_0x4cca4d-0x0;var _0x25c15f=_0xfe61[_0x4cca4d];return _0x25c15f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1fe6('0x0'));var BPromise=require(_0x1fe6('0x1'));var rp=require(_0x1fe6('0x2'));var fs=require('fs');var path=require(_0x1fe6('0x3'));var rimraf=require(_0x1fe6('0x4'));var config=require(_0x1fe6('0x5'));var attributes=require('./voiceRecording.attributes');module[_0x1fe6('0x6')]=function(_0x2012f9,_0x24fba9){return _0x2012f9[_0x1fe6('0x7')]('VoiceRecording',attributes,{'tableName':_0x1fe6('0x8'),'paranoid':![],'indexes':[{'name':_0x1fe6('0x9'),'fields':[_0x1fe6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae6=['lodash','util','api','moment','bluebird','request-promise','rimraf','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x6ae6,0x15c));var _0x66ae=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x6ae6[_0x43941d];return _0x27b82a;};'use strict';var _=require(_0x66ae('0x0'));var util=require(_0x66ae('0x1'));var logger=require('../../config/logger')(_0x66ae('0x2'));var moment=require(_0x66ae('0x3'));var BPromise=require(_0x66ae('0x4'));var rp=require(_0x66ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66ae('0x6'));var config=require('../../config/environment');var attributes=require(_0x66ae('0x7'));module[_0x66ae('0x8')]=function(_0x25e7a2,_0x16d34e){return _0x25e7a2['define'](_0x66ae('0x9'),attributes,{'tableName':_0x66ae('0xa'),'paranoid':![],'indexes':[{'name':_0x66ae('0xb'),'fields':[_0x66ae('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index cef7e63..37a40df 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 _0x01d9=['error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','body','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28c89b,_0x2510b3){var _0x176500=function(_0x3dfee2){while(--_0x3dfee2){_0x28c89b['push'](_0x28c89b['shift']());}};_0x176500(++_0x2510b3);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});}exports[_0x901d('0x17')]=function(_0x285353){var _0x403db9=this;return new Promise(function(_0x38f42b,_0x414171){return db[_0x901d('0x18')][_0x901d('0x19')](_0x285353['body'],{'raw':_0x285353[_0x901d('0x1a')]?_0x285353[_0x901d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285353['options']?_0x285353['options']['where']||null:null,'attributes':_0x285353[_0x901d('0x1a')]?_0x285353[_0x901d('0x1a')]['attributes']||null:null,'limit':_0x285353[_0x901d('0x1a')]?_0x285353[_0x901d('0x1a')]['limit']||null:null})[_0x901d('0xd')](function(_0x53ee69){logger[_0x901d('0xe')](_0x901d('0x17'),_0x285353);logger[_0x901d('0x11')](_0x901d('0x17'),_0x285353,JSON[_0x901d('0x1b')](_0x53ee69));_0x38f42b(_0x53ee69);})[_0x901d('0x16')](function(_0x4c1318){logger[_0x901d('0x12')](_0x901d('0x17'),_0x4c1318[_0x901d('0x14')],_0x285353);_0x414171(_0x403db9[_0x901d('0x12')](0x1f4,_0x4c1318['message']));});});};exports[_0x901d('0x1c')]=function(_0x23fd43){var _0x27f4ca=this;return new Promise(function(_0x3cbe43,_0x133bff){var _0x56e4ec=require(_0x901d('0x1d'));var _0xc52d0f;return db[_0x901d('0x1e')][_0x901d('0x1f')]({'attributes':['id',_0x901d('0x20')],'where':{'id':0x1},'raw':!![]})[_0x901d('0xd')](function(_0x48e86e){_0xc52d0f=_0x48e86e;return db[_0x901d('0x18')]['create'](_0x23fd43[_0x901d('0x21')]);})[_0x901d('0xd')](function(_0x20dbc5){if(_0xc52d0f[_0x901d('0x20')]&&fs[_0x901d('0x22')](_0x20dbc5[_0x901d('0x23')])){var _0x4137b7=util[_0x901d('0x24')](_0x901d('0x25'),_0x20dbc5[_0x901d('0x23')]);return _0x56e4ec[_0x901d('0x26')](_0x20dbc5[_0x901d('0x23')],_0x4137b7,config[_0x901d('0x27')][_0x901d('0x28')])[_0x901d('0xd')](function(){fs['unlink'](_0x20dbc5[_0x901d('0x23')]);logger[_0x901d('0xe')](_0x901d('0x29'));return _0x20dbc5;});}return _0x20dbc5;})['then'](function(_0x3f0cea){logger[_0x901d('0xe')](_0x901d('0x1c'),_0x23fd43);logger[_0x901d('0x11')](_0x901d('0x1c'),_0x23fd43,JSON[_0x901d('0x1b')](_0x3f0cea));_0x3cbe43(_0x3f0cea);})[_0x901d('0x16')](function(_0x1b8d3){logger[_0x901d('0x12')](_0x901d('0x1c'),_0x1b8d3['message'],_0x23fd43);_0x133bff(_0x27f4ca['error'](0x1f4,_0x1b8d3[_0x901d('0x14')]));});});}; \ No newline at end of file +var _0x2272=['client','http','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','encryptFile','secrets','recording','unlink','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2d582c,_0x424a15){var _0x37e92a=function(_0x142fb1){while(--_0x142fb1){_0x2d582c['push'](_0x2d582c['shift']());}};_0x37e92a(++_0x424a15);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('VoiceRecording,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')](_0x531f75[_0x2227('0x1b')],{'raw':_0x531f75[_0x2227('0x1c')]?_0x531f75['options'][_0x2227('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531f75['options']?_0x531f75[_0x2227('0x1c')][_0x2227('0x1e')]||null:null,'attributes':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x1f')]||null:null,'limit':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x20')]||null:null})[_0x2227('0xc')](function(_0x34c090){logger[_0x2227('0xd')]('UpdateVoiceRecording',_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x34c090));_0x620012(_0x34c090);})[_0x2227('0x17')](function(_0xbfdce1){logger['error']('UpdateVoiceRecording',_0xbfdce1[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0xbfdce1[_0x2227('0x15')]));});});};exports[_0x2227('0x21')]=function(_0x5be889){var _0x191a3e=this;return new Promise(function(_0x301304,_0x2d8ea0){var _0x1957ee=require('../../components/encryptor');var _0x204def;return db[_0x2227('0x22')][_0x2227('0x23')]({'attributes':['id',_0x2227('0x24')],'where':{'id':0x1},'raw':!![]})[_0x2227('0xc')](function(_0x4789eb){_0x204def=_0x4789eb;return db['VoiceRecording']['create'](_0x5be889[_0x2227('0x1b')]);})['then'](function(_0x2ba581){if(_0x204def[_0x2227('0x24')]&&fs['existsSync'](_0x2ba581['value'])){var _0x1f1ba7=util[_0x2227('0x25')](_0x2227('0x26'),_0x2ba581['value']);return _0x1957ee[_0x2227('0x27')](_0x2ba581['value'],_0x1f1ba7,config[_0x2227('0x28')][_0x2227('0x29')])[_0x2227('0xc')](function(){fs[_0x2227('0x2a')](_0x2ba581[_0x2227('0x2b')]);logger[_0x2227('0xd')](_0x2227('0x2c'));return _0x2ba581;});}return _0x2ba581;})[_0x2227('0xc')](function(_0xd38f59){logger[_0x2227('0xd')](_0x2227('0x21'),_0x5be889);logger['debug'](_0x2227('0x21'),_0x5be889,JSON[_0x2227('0x11')](_0xd38f59));_0x301304(_0xd38f59);})[_0x2227('0x17')](function(_0x6cd5d7){logger['error'](_0x2227('0x21'),_0x6cd5d7[_0x2227('0x15')],_0x5be889);_0x2d8ea0(_0x191a3e[_0x2227('0x12')](0x1f4,_0x6cd5d7[_0x2227('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c56d162..c105c16 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 _0x74bf=['show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','index','get','describe'];(function(_0x1a6635,_0x3add79){var _0x530a00=function(_0x4a4e70){while(--_0x4a4e70){_0x1a6635['push'](_0x1a6635['shift']());}};_0x530a00(++_0x3add79);}(_0x74bf,0x110));var _0xf74b=function(_0x38bed4,_0x4c95a9){_0x38bed4=_0x38bed4-0x0;var _0x42fbe1=_0x74bf[_0x38bed4];return _0x42fbe1;};'use strict';var multer=require(_0xf74b('0x0'));var util=require(_0xf74b('0x1'));var path=require(_0xf74b('0x2'));var timeout=require(_0xf74b('0x3'));var express=require(_0xf74b('0x4'));var router=express[_0xf74b('0x5')]();var fs_extra=require(_0xf74b('0x6'));var auth=require(_0xf74b('0x7'));var interaction=require(_0xf74b('0x8'));var config=require('../../config/environment');var controller=require(_0xf74b('0x9'));router['get']('/',auth[_0xf74b('0xa')](),controller[_0xf74b('0xb')]);router[_0xf74b('0xc')]('/describe',auth[_0xf74b('0xa')](),controller[_0xf74b('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf74b('0xe')]);router[_0xf74b('0xf')]('/',auth[_0xf74b('0xa')](),controller[_0xf74b('0x10')]);router[_0xf74b('0x11')](_0xf74b('0x12'),auth[_0xf74b('0xa')](),controller['update']);router[_0xf74b('0x13')](_0xf74b('0x12'),auth['isAuthenticated'](),controller[_0xf74b('0x14')]);module[_0xf74b('0x15')]=router; \ No newline at end of file +var _0x8ed1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','create','put','delete','destroy','exports','multer'];(function(_0x374473,_0x1c4f4b){var _0x506f8e=function(_0x4953af){while(--_0x4953af){_0x374473['push'](_0x374473['shift']());}};_0x506f8e(++_0x1c4f4b);}(_0x8ed1,0x17b));var _0x18ed=function(_0x2a0d06,_0x14e3d3){_0x2a0d06=_0x2a0d06-0x0;var _0x579a8d=_0x8ed1[_0x2a0d06];return _0x579a8d;};'use strict';var multer=require(_0x18ed('0x0'));var util=require(_0x18ed('0x1'));var path=require(_0x18ed('0x2'));var timeout=require(_0x18ed('0x3'));var express=require(_0x18ed('0x4'));var router=express[_0x18ed('0x5')]();var fs_extra=require(_0x18ed('0x6'));var auth=require(_0x18ed('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x18ed('0x8'));var controller=require(_0x18ed('0x9'));router[_0x18ed('0xa')]('/',auth[_0x18ed('0xb')](),controller[_0x18ed('0xc')]);router[_0x18ed('0xa')](_0x18ed('0xd'),auth[_0x18ed('0xb')](),controller['describe']);router['get'](_0x18ed('0xe'),auth[_0x18ed('0xb')](),controller['show']);router['post']('/',auth[_0x18ed('0xb')](),controller[_0x18ed('0xf')]);router[_0x18ed('0x10')]('/:id',auth[_0x18ed('0xb')](),controller['update']);router[_0x18ed('0x11')]('/:id',auth[_0x18ed('0xb')](),controller[_0x18ed('0x12')]);module[_0x18ed('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 896955a..50fc105 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 _0xbf9f=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x593b07,_0x3b7824){var _0x16a7b0=function(_0x2204c7){while(--_0x2204c7){_0x593b07['push'](_0x593b07['shift']());}};_0x16a7b0(++_0x3b7824);}(_0xbf9f,0x187));var _0xfbf9=function(_0x3fafb0,_0x531933){_0x3fafb0=_0x3fafb0-0x0;var _0x4727bd=_0xbf9f[_0x3fafb0];return _0x4727bd;};'use strict';var Sequelize=require(_0xfbf9('0x0'));var moment=require(_0xfbf9('0x1'));module[_0xfbf9('0x2')]={'type':{'type':Sequelize[_0xfbf9('0x3')](_0xfbf9('0x4'),_0xfbf9('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xfbf9('0x6')]},'transferercalleridname':{'type':Sequelize[_0xfbf9('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfbf9('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xfbf9('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xfbf9('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xfbf9('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfbf9('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfbf9('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xfbf9('0x6')]},'transfereecontext':{'type':Sequelize[_0xfbf9('0x6')]},'transfereeexten':{'type':Sequelize[_0xfbf9('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xfbf9('0x6')]},'isexternal':{'type':Sequelize[_0xfbf9('0x3')](_0xfbf9('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6518=['sequelize','blind','attended','STRING','Yes'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6518,0x177));var _0x8651=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6518[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x8651('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x8651('0x1'),_0x8651('0x2'))},'result':{'type':Sequelize[_0x8651('0x3')]},'transfererchannel':{'type':Sequelize[_0x8651('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8651('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8651('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x8651('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x8651('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x8651('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x8651('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x8651('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x8651('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x8651('0x3')]},'transfereecontext':{'type':Sequelize[_0x8651('0x3')]},'transfereeexten':{'type':Sequelize[_0x8651('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x8651('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x8651('0x4'),'No')},'context':{'type':Sequelize[_0x8651('0x3')]},'extension':{'type':Sequelize[_0x8651('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4b0dc0f..8f9a8f9 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 _0xe541=['length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x633c02,_0x691448){var _0x47d771=function(_0x1b76ad){while(--_0x1b76ad){_0x633c02['push'](_0x633c02['shift']());}};_0x47d771(++_0x691448);}(_0xe541,0x181));var _0x1e54=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0xe541[_0x3388d8];return _0x2bbe73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e54('0x0'));var zipdir=require(_0x1e54('0x1'));var jsonpatch=require(_0x1e54('0x2'));var rp=require(_0x1e54('0x3'));var moment=require('moment');var BPromise=require(_0x1e54('0x4'));var Mustache=require(_0x1e54('0x5'));var util=require(_0x1e54('0x6'));var path=require(_0x1e54('0x7'));var sox=require(_0x1e54('0x8'));var csv=require(_0x1e54('0x9'));var ejs=require(_0x1e54('0xa'));var fs=require('fs');var fs_extra=require(_0x1e54('0xb'));var _=require(_0x1e54('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e54('0xd'));var deskjs=require(_0x1e54('0xe'));var toCsv=require(_0x1e54('0x9'));var querystring=require(_0x1e54('0xf'));var Papa=require(_0x1e54('0x10'));var Redis=require(_0x1e54('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e54('0x12'));var logger=require(_0x1e54('0x13'))(_0x1e54('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e54('0x15'));var db=require(_0x1e54('0x16'))['db'];function respondWithStatusCode(_0x41cf85,_0x5cae9b){_0x5cae9b=_0x5cae9b||0xcc;return function(_0x45a4e6){if(_0x45a4e6){return _0x41cf85[_0x1e54('0x17')](_0x5cae9b);}return _0x41cf85[_0x1e54('0x18')](_0x5cae9b)[_0x1e54('0x19')]();};}function respondWithResult(_0x372cd5,_0x238672){_0x238672=_0x238672||0xc8;return function(_0x9a6aee){if(_0x9a6aee){return _0x372cd5[_0x1e54('0x18')](_0x238672)[_0x1e54('0x1a')](_0x9a6aee);}};}function respondWithFilteredResult(_0x8f33,_0xe2a523){return function(_0x158d3d){if(_0x158d3d){var _0x1be1df=typeof _0xe2a523['offset']===_0x1e54('0x1b')&&typeof _0xe2a523['limit']===_0x1e54('0x1b');var _0x35145a=_0x158d3d[_0x1e54('0x1c')];var _0x58908=_0x1be1df?0x0:_0xe2a523['offset'];var _0x1671a7=_0x1be1df?_0x158d3d[_0x1e54('0x1c')]:_0xe2a523[_0x1e54('0x1d')]+_0xe2a523[_0x1e54('0x1e')];var _0x4f8800;if(_0x1671a7>=_0x35145a){_0x1671a7=_0x35145a;_0x4f8800=0xc8;}else{_0x4f8800=0xce;}_0x8f33[_0x1e54('0x18')](_0x4f8800);return _0x8f33['set']('Content-Range',_0x58908+'-'+_0x1671a7+'/'+_0x35145a)[_0x1e54('0x1a')](_0x158d3d);}return null;};}function patchUpdates(_0x3a01b5){return function(_0x2143b5){try{jsonpatch[_0x1e54('0x1f')](_0x2143b5,_0x3a01b5,!![]);}catch(_0x236475){return BPromise[_0x1e54('0x20')](_0x236475);}return _0x2143b5[_0x1e54('0x21')]();};}function saveUpdates(_0x3ed091,_0x3aaf7d){return function(_0x3cff00){if(_0x3cff00){return _0x3cff00[_0x1e54('0x22')](_0x3ed091)[_0x1e54('0x23')](function(_0x15d475){return _0x15d475;});}return null;};}function removeEntity(_0x572719,_0x359d46){return function(_0x338764){if(_0x338764){return _0x338764[_0x1e54('0x24')]()[_0x1e54('0x23')](function(){_0x572719['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20aaec,_0x2091dc){return function(_0x422e31){if(!_0x422e31){_0x20aaec['sendStatus'](0x194);}return _0x422e31;};}function handleError(_0x3dfed4,_0x37d5f3){_0x37d5f3=_0x37d5f3||0x1f4;return function(_0x4b38b7){logger[_0x1e54('0x25')](_0x4b38b7[_0x1e54('0x26')]);if(_0x4b38b7[_0x1e54('0x27')]){delete _0x4b38b7['name'];}_0x3dfed4[_0x1e54('0x18')](_0x37d5f3)[_0x1e54('0x28')](_0x4b38b7);};}exports['index']=function(_0xb2b9a8,_0x37dc58){var _0x1c60d4={},_0x99c9a0={},_0x3f28d6={'count':0x0,'rows':[]};var _0xe59f04=_[_0x1e54('0x29')](db[_0x1e54('0x2a')][_0x1e54('0x2b')],function(_0x3b94f0){return{'name':_0x3b94f0[_0x1e54('0x2c')],'type':_0x3b94f0['type'][_0x1e54('0x2d')]};});_0x99c9a0[_0x1e54('0x2e')]=_[_0x1e54('0x29')](_0xe59f04,_0x1e54('0x27'));_0x99c9a0['query']=_[_0x1e54('0x2f')](_0xb2b9a8[_0x1e54('0x30')]);_0x99c9a0[_0x1e54('0x31')]=_[_0x1e54('0x32')](_0x99c9a0[_0x1e54('0x2e')],_0x99c9a0[_0x1e54('0x30')]);_0x1c60d4[_0x1e54('0x33')]=_[_0x1e54('0x32')](_0x99c9a0[_0x1e54('0x2e')],qs['fields'](_0xb2b9a8[_0x1e54('0x30')][_0x1e54('0x34')]));_0x1c60d4[_0x1e54('0x33')]=_0x1c60d4[_0x1e54('0x33')][_0x1e54('0x35')]?_0x1c60d4[_0x1e54('0x33')]:_0x99c9a0['model'];if(!_0xb2b9a8['query']['hasOwnProperty'](_0x1e54('0x36'))){_0x1c60d4[_0x1e54('0x1e')]=qs[_0x1e54('0x1e')](_0xb2b9a8['query'][_0x1e54('0x1e')]);_0x1c60d4['offset']=qs[_0x1e54('0x1d')](_0xb2b9a8['query']['offset']);}_0x1c60d4['order']=qs[_0x1e54('0x37')](_0xb2b9a8[_0x1e54('0x30')][_0x1e54('0x37')]);_0x1c60d4[_0x1e54('0x38')]=qs[_0x1e54('0x31')](_[_0x1e54('0x39')](_0xb2b9a8[_0x1e54('0x30')],_0x99c9a0[_0x1e54('0x31')]),_0xe59f04);if(_0xb2b9a8['query'][_0x1e54('0x3a')]){_0x1c60d4[_0x1e54('0x38')]=_['merge'](_0x1c60d4[_0x1e54('0x38')],{'$or':_[_0x1e54('0x29')](_0xe59f04,function(_0x3c9657){if(_0x3c9657[_0x1e54('0x3b')]!==_0x1e54('0x3c')){var _0x254c2e={};_0x254c2e[_0x3c9657[_0x1e54('0x27')]]={'$like':'%'+_0xb2b9a8[_0x1e54('0x30')][_0x1e54('0x3a')]+'%'};return _0x254c2e;}})});}_0x1c60d4=_[_0x1e54('0x3d')]({},_0x1c60d4,_0xb2b9a8[_0x1e54('0x3e')]);var _0x2a21b9={'where':_0x1c60d4[_0x1e54('0x38')]};return db[_0x1e54('0x2a')][_0x1e54('0x1c')](_0x2a21b9)[_0x1e54('0x23')](function(_0x16065c){_0x3f28d6['count']=_0x16065c;if(_0xb2b9a8[_0x1e54('0x30')][_0x1e54('0x3f')]){_0x1c60d4['include']=[{'all':!![]}];}return db[_0x1e54('0x2a')][_0x1e54('0x40')](_0x1c60d4);})['then'](function(_0x2a35f1){_0x3f28d6[_0x1e54('0x41')]=_0x2a35f1;return _0x3f28d6;})[_0x1e54('0x23')](respondWithFilteredResult(_0x37dc58,_0x1c60d4))[_0x1e54('0x42')](handleError(_0x37dc58,null));};exports['show']=function(_0x18fc16,_0x2336a9){var _0x4ac30f={'raw':!![],'where':{'id':_0x18fc16[_0x1e54('0x43')]['id']}},_0x54ce5e={};_0x54ce5e[_0x1e54('0x2e')]=_['keys'](db[_0x1e54('0x2a')][_0x1e54('0x2b')]);_0x54ce5e[_0x1e54('0x30')]=_[_0x1e54('0x2f')](_0x18fc16[_0x1e54('0x30')]);_0x54ce5e[_0x1e54('0x31')]=_[_0x1e54('0x32')](_0x54ce5e['model'],_0x54ce5e[_0x1e54('0x30')]);_0x4ac30f[_0x1e54('0x33')]=_[_0x1e54('0x32')](_0x54ce5e[_0x1e54('0x2e')],qs[_0x1e54('0x34')](_0x18fc16[_0x1e54('0x30')][_0x1e54('0x34')]));_0x4ac30f[_0x1e54('0x33')]=_0x4ac30f[_0x1e54('0x33')][_0x1e54('0x35')]?_0x4ac30f[_0x1e54('0x33')]:_0x54ce5e[_0x1e54('0x2e')];if(_0x18fc16['query'][_0x1e54('0x3f')]){_0x4ac30f[_0x1e54('0x44')]=[{'all':!![]}];}_0x4ac30f=_['merge']({},_0x4ac30f,_0x18fc16[_0x1e54('0x3e')]);return db['VoiceTransferReport']['find'](_0x4ac30f)[_0x1e54('0x23')](handleEntityNotFound(_0x2336a9,null))['then'](respondWithResult(_0x2336a9,null))[_0x1e54('0x42')](handleError(_0x2336a9,null));};exports[_0x1e54('0x45')]=function(_0x20aba4,_0x42e47d){return db[_0x1e54('0x2a')][_0x1e54('0x45')](_0x20aba4['body'],{})[_0x1e54('0x23')](respondWithResult(_0x42e47d,0xc9))[_0x1e54('0x42')](handleError(_0x42e47d,null));};exports[_0x1e54('0x22')]=function(_0x22e613,_0x3c6b94){if(_0x22e613[_0x1e54('0x46')]['id']){delete _0x22e613['body']['id'];}return db[_0x1e54('0x2a')][_0x1e54('0x47')]({'where':{'id':_0x22e613[_0x1e54('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c6b94,null))[_0x1e54('0x23')](saveUpdates(_0x22e613[_0x1e54('0x46')],null))['then'](respondWithResult(_0x3c6b94,null))[_0x1e54('0x42')](handleError(_0x3c6b94,null));};exports[_0x1e54('0x24')]=function(_0x2f9d17,_0x29b63c){return db[_0x1e54('0x2a')]['find']({'where':{'id':_0x2f9d17[_0x1e54('0x43')]['id']}})[_0x1e54('0x23')](handleEntityNotFound(_0x29b63c,null))[_0x1e54('0x23')](removeEntity(_0x29b63c,null))[_0x1e54('0x42')](handleError(_0x29b63c,null));};exports['describe']=function(_0xe94283,_0xd3ece6){return db[_0x1e54('0x2a')][_0x1e54('0x48')]()[_0x1e54('0x23')](respondWithResult(_0xd3ece6,null))[_0x1e54('0x42')](handleError(_0xd3ece6,null));}; \ No newline at end of file +var _0x2467=['merge','VIRTUAL','options','VoiceTransferReport','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','filter'];(function(_0x34d54b,_0x7f385b){var _0x358b89=function(_0x2b1f97){while(--_0x2b1f97){_0x34d54b['push'](_0x34d54b['shift']());}};_0x358b89(++_0x7f385b);}(_0x2467,0xd4));var _0x7246=function(_0x2ee476,_0x2623ee){_0x2ee476=_0x2ee476-0x0;var _0x34e877=_0x2467[_0x2ee476];return _0x34e877;};'use strict';var emlformat=require(_0x7246('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7246('0x1'));var jsonpatch=require(_0x7246('0x2'));var rp=require('request-promise');var moment=require(_0x7246('0x3'));var BPromise=require(_0x7246('0x4'));var Mustache=require(_0x7246('0x5'));var util=require(_0x7246('0x6'));var path=require(_0x7246('0x7'));var sox=require(_0x7246('0x8'));var csv=require(_0x7246('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7246('0xa'));var _=require(_0x7246('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7246('0xc'));var toCsv=require(_0x7246('0x9'));var querystring=require('querystring');var Papa=require(_0x7246('0xd'));var Redis=require(_0x7246('0xe'));var authService=require(_0x7246('0xf'));var qs=require(_0x7246('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7246('0x11'));var logger=require('../../config/logger')(_0x7246('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7246('0x13'));var db=require(_0x7246('0x14'))['db'];function respondWithStatusCode(_0x53a72b,_0x5b5fc2){_0x5b5fc2=_0x5b5fc2||0xcc;return function(_0x3cab55){if(_0x3cab55){return _0x53a72b[_0x7246('0x15')](_0x5b5fc2);}return _0x53a72b[_0x7246('0x16')](_0x5b5fc2)[_0x7246('0x17')]();};}function respondWithResult(_0x5a8324,_0x57b525){_0x57b525=_0x57b525||0xc8;return function(_0x47252b){if(_0x47252b){return _0x5a8324[_0x7246('0x16')](_0x57b525)['json'](_0x47252b);}};}function respondWithFilteredResult(_0x34816a,_0x20254c){return function(_0x1432c4){if(_0x1432c4){var _0x2a27b4=typeof _0x20254c[_0x7246('0x18')]===_0x7246('0x19')&&typeof _0x20254c[_0x7246('0x1a')]===_0x7246('0x19');var _0x34c4aa=_0x1432c4['count'];var _0x1694a5=_0x2a27b4?0x0:_0x20254c[_0x7246('0x18')];var _0x16843d=_0x2a27b4?_0x1432c4[_0x7246('0x1b')]:_0x20254c[_0x7246('0x18')]+_0x20254c['limit'];var _0x49a97f;if(_0x16843d>=_0x34c4aa){_0x16843d=_0x34c4aa;_0x49a97f=0xc8;}else{_0x49a97f=0xce;}_0x34816a['status'](_0x49a97f);return _0x34816a[_0x7246('0x1c')](_0x7246('0x1d'),_0x1694a5+'-'+_0x16843d+'/'+_0x34c4aa)['json'](_0x1432c4);}return null;};}function patchUpdates(_0x2f1e30){return function(_0x3c9518){try{jsonpatch['apply'](_0x3c9518,_0x2f1e30,!![]);}catch(_0x1960b9){return BPromise[_0x7246('0x1e')](_0x1960b9);}return _0x3c9518['save']();};}function saveUpdates(_0x5004c7,_0x48df23){return function(_0x3341a2){if(_0x3341a2){return _0x3341a2['update'](_0x5004c7)[_0x7246('0x1f')](function(_0x276b10){return _0x276b10;});}return null;};}function removeEntity(_0x3920f3,_0x291d91){return function(_0x130b4c){if(_0x130b4c){return _0x130b4c[_0x7246('0x20')]()[_0x7246('0x1f')](function(){_0x3920f3[_0x7246('0x16')](0xcc)[_0x7246('0x17')]();});}};}function handleEntityNotFound(_0x4470b8,_0x1bc9ed){return function(_0xa71bc0){if(!_0xa71bc0){_0x4470b8['sendStatus'](0x194);}return _0xa71bc0;};}function handleError(_0x339680,_0x6abd19){_0x6abd19=_0x6abd19||0x1f4;return function(_0x28f153){logger[_0x7246('0x21')](_0x28f153['stack']);if(_0x28f153['name']){delete _0x28f153[_0x7246('0x22')];}_0x339680['status'](_0x6abd19)[_0x7246('0x23')](_0x28f153);};}exports[_0x7246('0x24')]=function(_0x4af1ef,_0x36e009){var _0x517ce3={},_0x25cb5e={},_0x15331a={'count':0x0,'rows':[]};var _0x2d7fe3=_[_0x7246('0x25')](db['VoiceTransferReport'][_0x7246('0x26')],function(_0x20da09){return{'name':_0x20da09['fieldName'],'type':_0x20da09[_0x7246('0x27')][_0x7246('0x28')]};});_0x25cb5e[_0x7246('0x29')]=_[_0x7246('0x25')](_0x2d7fe3,_0x7246('0x22'));_0x25cb5e['query']=_['keys'](_0x4af1ef['query']);_0x25cb5e[_0x7246('0x2a')]=_[_0x7246('0x2b')](_0x25cb5e[_0x7246('0x29')],_0x25cb5e[_0x7246('0x2c')]);_0x517ce3[_0x7246('0x2d')]=_['intersection'](_0x25cb5e[_0x7246('0x29')],qs[_0x7246('0x2e')](_0x4af1ef['query']['fields']));_0x517ce3[_0x7246('0x2d')]=_0x517ce3[_0x7246('0x2d')][_0x7246('0x2f')]?_0x517ce3['attributes']:_0x25cb5e[_0x7246('0x29')];if(!_0x4af1ef[_0x7246('0x2c')][_0x7246('0x30')]('nolimit')){_0x517ce3[_0x7246('0x1a')]=qs['limit'](_0x4af1ef['query'][_0x7246('0x1a')]);_0x517ce3[_0x7246('0x18')]=qs[_0x7246('0x18')](_0x4af1ef[_0x7246('0x2c')][_0x7246('0x18')]);}_0x517ce3['order']=qs[_0x7246('0x31')](_0x4af1ef[_0x7246('0x2c')][_0x7246('0x31')]);_0x517ce3[_0x7246('0x32')]=qs[_0x7246('0x2a')](_['pick'](_0x4af1ef[_0x7246('0x2c')],_0x25cb5e['filters']),_0x2d7fe3);if(_0x4af1ef[_0x7246('0x2c')][_0x7246('0x33')]){_0x517ce3[_0x7246('0x32')]=_[_0x7246('0x34')](_0x517ce3[_0x7246('0x32')],{'$or':_['map'](_0x2d7fe3,function(_0x2ede3f){if(_0x2ede3f['type']!==_0x7246('0x35')){var _0x101300={};_0x101300[_0x2ede3f[_0x7246('0x22')]]={'$like':'%'+_0x4af1ef[_0x7246('0x2c')][_0x7246('0x33')]+'%'};return _0x101300;}})});}_0x517ce3=_[_0x7246('0x34')]({},_0x517ce3,_0x4af1ef[_0x7246('0x36')]);var _0x59192e={'where':_0x517ce3[_0x7246('0x32')]};return db[_0x7246('0x37')][_0x7246('0x1b')](_0x59192e)['then'](function(_0x525f8d){_0x15331a[_0x7246('0x1b')]=_0x525f8d;if(_0x4af1ef[_0x7246('0x2c')]['includeAll']){_0x517ce3[_0x7246('0x38')]=[{'all':!![]}];}return db[_0x7246('0x37')][_0x7246('0x39')](_0x517ce3);})[_0x7246('0x1f')](function(_0x4433bf){_0x15331a[_0x7246('0x3a')]=_0x4433bf;return _0x15331a;})[_0x7246('0x1f')](respondWithFilteredResult(_0x36e009,_0x517ce3))['catch'](handleError(_0x36e009,null));};exports['show']=function(_0x56f46b,_0x22fc44){var _0x271f99={'raw':!![],'where':{'id':_0x56f46b[_0x7246('0x3b')]['id']}},_0x133600={};_0x133600[_0x7246('0x29')]=_[_0x7246('0x3c')](db[_0x7246('0x37')][_0x7246('0x26')]);_0x133600[_0x7246('0x2c')]=_[_0x7246('0x3c')](_0x56f46b['query']);_0x133600[_0x7246('0x2a')]=_['intersection'](_0x133600[_0x7246('0x29')],_0x133600['query']);_0x271f99[_0x7246('0x2d')]=_[_0x7246('0x2b')](_0x133600[_0x7246('0x29')],qs[_0x7246('0x2e')](_0x56f46b[_0x7246('0x2c')][_0x7246('0x2e')]));_0x271f99[_0x7246('0x2d')]=_0x271f99[_0x7246('0x2d')][_0x7246('0x2f')]?_0x271f99[_0x7246('0x2d')]:_0x133600[_0x7246('0x29')];if(_0x56f46b[_0x7246('0x2c')]['includeAll']){_0x271f99[_0x7246('0x38')]=[{'all':!![]}];}_0x271f99=_[_0x7246('0x34')]({},_0x271f99,_0x56f46b[_0x7246('0x36')]);return db['VoiceTransferReport'][_0x7246('0x3d')](_0x271f99)[_0x7246('0x1f')](handleEntityNotFound(_0x22fc44,null))['then'](respondWithResult(_0x22fc44,null))[_0x7246('0x3e')](handleError(_0x22fc44,null));};exports['create']=function(_0x4d473d,_0xd2e060){return db['VoiceTransferReport'][_0x7246('0x3f')](_0x4d473d[_0x7246('0x40')],{})[_0x7246('0x1f')](respondWithResult(_0xd2e060,0xc9))[_0x7246('0x3e')](handleError(_0xd2e060,null));};exports['update']=function(_0x758fbe,_0xa4bb4f){if(_0x758fbe[_0x7246('0x40')]['id']){delete _0x758fbe[_0x7246('0x40')]['id'];}return db[_0x7246('0x37')][_0x7246('0x3d')]({'where':{'id':_0x758fbe[_0x7246('0x3b')]['id']}})[_0x7246('0x1f')](handleEntityNotFound(_0xa4bb4f,null))['then'](saveUpdates(_0x758fbe['body'],null))[_0x7246('0x1f')](respondWithResult(_0xa4bb4f,null))[_0x7246('0x3e')](handleError(_0xa4bb4f,null));};exports['destroy']=function(_0x44849d,_0x18fdf5){return db[_0x7246('0x37')][_0x7246('0x3d')]({'where':{'id':_0x44849d[_0x7246('0x3b')]['id']}})['then'](handleEntityNotFound(_0x18fdf5,null))[_0x7246('0x1f')](removeEntity(_0x18fdf5,null))[_0x7246('0x3e')](handleError(_0x18fdf5,null));};exports[_0x7246('0x41')]=function(_0xcafbca,_0x11992d){return db[_0x7246('0x37')][_0x7246('0x41')]()[_0x7246('0x1f')](respondWithResult(_0x11992d,null))[_0x7246('0x3e')](handleError(_0x11992d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 31ccff5..7e6248f 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 _0x6d10=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer'];(function(_0x4b7452,_0x57ab1e){var _0x226933=function(_0x50bddf){while(--_0x50bddf){_0x4b7452['push'](_0x4b7452['shift']());}};_0x226933(++_0x57ab1e);}(_0x6d10,0x111));var _0x06d1=function(_0x37833d,_0x582ed5){_0x37833d=_0x37833d-0x0;var _0x2a93b6=_0x6d10[_0x37833d];return _0x2a93b6;};'use strict';var _=require(_0x06d1('0x0'));var util=require(_0x06d1('0x1'));var logger=require(_0x06d1('0x2'))(_0x06d1('0x3'));var moment=require(_0x06d1('0x4'));var BPromise=require(_0x06d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06d1('0x6'));var rimraf=require(_0x06d1('0x7'));var config=require(_0x06d1('0x8'));var attributes=require(_0x06d1('0x9'));module[_0x06d1('0xa')]=function(_0x1f6175,_0x359a3b){return _0x1f6175['define'](_0x06d1('0xb'),attributes,{'tableName':_0x06d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9cf=['../../config/logger','moment','bluebird','request-promise','path','./voiceTransferReport.attributes','exports','report_call_transfer','util'];(function(_0xb510b9,_0x1312dc){var _0x3c5900=function(_0x549204){while(--_0x549204){_0xb510b9['push'](_0xb510b9['shift']());}};_0x3c5900(++_0x1312dc);}(_0xb9cf,0x1b8));var _0xfb9c=function(_0x43024e,_0x1d1ab5){_0x43024e=_0x43024e-0x0;var _0x10c8ef=_0xb9cf[_0x43024e];return _0x10c8ef;};'use strict';var _=require('lodash');var util=require(_0xfb9c('0x0'));var logger=require(_0xfb9c('0x1'))('api');var moment=require(_0xfb9c('0x2'));var BPromise=require(_0xfb9c('0x3'));var rp=require(_0xfb9c('0x4'));var fs=require('fs');var path=require(_0xfb9c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb9c('0x6'));module[_0xfb9c('0x7')]=function(_0x2e7cd1,_0x51df71){return _0x2e7cd1['define']('VoiceTransferReport',attributes,{'tableName':_0xfb9c('0x8'),'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 a14360a..a13a15c 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 _0x8a8b=['code','message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x8a8b,0x106));var _0xb8a8=function(_0x4ac97c,_0x16e8bf){_0x4ac97c=_0x4ac97c-0x0;var _0x1122e6=_0x8a8b[_0x4ac97c];return _0x1122e6;};'use strict';var _=require(_0xb8a8('0x0'));var util=require('util');var moment=require(_0xb8a8('0x1'));var BPromise=require(_0xb8a8('0x2'));var rs=require(_0xb8a8('0x3'));var fs=require('fs');var Redis=require(_0xb8a8('0x4'));var db=require(_0xb8a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8a8('0x6'));var config=require(_0xb8a8('0x7'));var jayson=require(_0xb8a8('0x8'));var client=jayson[_0xb8a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x282e33,_0x4eb41c,_0x589942){return new BPromise(function(_0x2664de,_0x59d04f){return client[_0xb8a8('0xa')](_0x282e33,_0x589942)[_0xb8a8('0xb')](function(_0x77803e){logger[_0xb8a8('0xc')](_0xb8a8('0xd'),_0x4eb41c,_0xb8a8('0xe'));logger[_0xb8a8('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4eb41c,_0xb8a8('0xe'),JSON[_0xb8a8('0x10')](_0x77803e));if(_0x77803e[_0xb8a8('0x11')]){if(_0x77803e[_0xb8a8('0x11')][_0xb8a8('0x12')]===0x1f4){logger[_0xb8a8('0x11')](_0xb8a8('0xd'),_0x4eb41c,_0x77803e['error'][_0xb8a8('0x13')]);return _0x59d04f(_0x77803e[_0xb8a8('0x11')][_0xb8a8('0x13')]);}logger['error'](_0xb8a8('0xd'),_0x4eb41c,_0x77803e[_0xb8a8('0x11')][_0xb8a8('0x13')]);return _0x2664de(_0x77803e['error'][_0xb8a8('0x13')]);}else{logger[_0xb8a8('0xc')](_0xb8a8('0xd'),_0x4eb41c,_0xb8a8('0xe'));_0x2664de(_0x77803e[_0xb8a8('0x14')][_0xb8a8('0x13')]);}})[_0xb8a8('0x15')](function(_0x4c9aa4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4eb41c,_0x4c9aa4);_0x59d04f(_0x4c9aa4);});});}exports['CreateVoiceTransferReport']=function(_0x43be9d){var _0x1192fc=this;return new Promise(function(_0x2233b2,_0x1e5eda){return db[_0xb8a8('0x16')][_0xb8a8('0x17')](_0x43be9d[_0xb8a8('0x18')],{'raw':_0x43be9d[_0xb8a8('0x19')]?_0x43be9d[_0xb8a8('0x19')][_0xb8a8('0x1a')]===undefined?!![]:![]:!![]})[_0xb8a8('0xb')](function(_0x6ba30d){logger['info']('CreateVoiceTransferReport',_0x43be9d);logger[_0xb8a8('0xf')](_0xb8a8('0x1b'),_0x43be9d,JSON[_0xb8a8('0x10')](_0x6ba30d));_0x2233b2(_0x6ba30d);})[_0xb8a8('0x15')](function(_0x42701f){logger[_0xb8a8('0x11')](_0xb8a8('0x1b'),_0x42701f[_0xb8a8('0x13')],_0x43be9d);_0x1e5eda(_0x1192fc[_0xb8a8('0x11')](0x1f4,_0x42701f[_0xb8a8('0x13')]));});});}; \ No newline at end of file +var _0xd0cf=['message','result','catch','VoiceTransferReport','create','body','options','raw','info','CreateVoiceTransferReport','debug','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xd0cf,0x16b));var _0xfd0c=function(_0x3d773f,_0x3462b3){_0x3d773f=_0x3d773f-0x0;var _0x22bf3a=_0xd0cf[_0x3d773f];return _0x22bf3a;};'use strict';var _=require(_0xfd0c('0x0'));var util=require(_0xfd0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd0c('0x2'));var fs=require('fs');var Redis=require(_0xfd0c('0x3'));var db=require(_0xfd0c('0x4'))['db'];var utils=require(_0xfd0c('0x5'));var logger=require(_0xfd0c('0x6'))('rpc');var config=require(_0xfd0c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfd0c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x220e17,_0xf3424b,_0x5cf1b3){return new BPromise(function(_0xb75778,_0x47d94d){return client[_0xfd0c('0x9')](_0x220e17,_0x5cf1b3)[_0xfd0c('0xa')](function(_0x55d00b){logger['info'](_0xfd0c('0xb'),_0xf3424b,_0xfd0c('0xc'));logger['debug'](_0xfd0c('0xd'),_0xf3424b,_0xfd0c('0xc'),JSON['stringify'](_0x55d00b));if(_0x55d00b[_0xfd0c('0xe')]){if(_0x55d00b['error']['code']===0x1f4){logger['error'](_0xfd0c('0xb'),_0xf3424b,_0x55d00b[_0xfd0c('0xe')]['message']);return _0x47d94d(_0x55d00b['error']['message']);}logger[_0xfd0c('0xe')](_0xfd0c('0xb'),_0xf3424b,_0x55d00b[_0xfd0c('0xe')][_0xfd0c('0xf')]);return _0xb75778(_0x55d00b['error'][_0xfd0c('0xf')]);}else{logger['info'](_0xfd0c('0xb'),_0xf3424b,_0xfd0c('0xc'));_0xb75778(_0x55d00b[_0xfd0c('0x10')]['message']);}})[_0xfd0c('0x11')](function(_0x585249){logger['error'](_0xfd0c('0xb'),_0xf3424b,_0x585249);_0x47d94d(_0x585249);});});}exports['CreateVoiceTransferReport']=function(_0x1be97b){var _0x309e58=this;return new Promise(function(_0x277c90,_0x4982e6){return db[_0xfd0c('0x12')][_0xfd0c('0x13')](_0x1be97b[_0xfd0c('0x14')],{'raw':_0x1be97b['options']?_0x1be97b[_0xfd0c('0x15')][_0xfd0c('0x16')]===undefined?!![]:![]:!![]})[_0xfd0c('0xa')](function(_0x28b429){logger[_0xfd0c('0x17')](_0xfd0c('0x18'),_0x1be97b);logger[_0xfd0c('0x19')](_0xfd0c('0x18'),_0x1be97b,JSON[_0xfd0c('0x1a')](_0x28b429));_0x277c90(_0x28b429);})[_0xfd0c('0x11')](function(_0x59327c){logger[_0xfd0c('0xe')]('CreateVoiceTransferReport',_0x59327c[_0xfd0c('0xf')],_0x1be97b);_0x4982e6(_0x309e58['error'](0x1f4,_0x59327c['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e6588cf..243c45a 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 _0x3c88=['express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','/transfer','exports'];(function(_0x4ff206,_0x1b302d){var _0x28fe22=function(_0x46ea47){while(--_0x46ea47){_0x4ff206['push'](_0x4ff206['shift']());}};_0x28fe22(++_0x1b302d);}(_0x3c88,0xd8));var _0x83c8=function(_0x1c176f,_0x923ad2){_0x1c176f=_0x1c176f-0x0;var _0x3d82c7=_0x3c88[_0x1c176f];return _0x3d82c7;};'use strict';var express=require(_0x83c8('0x0'));var router=express[_0x83c8('0x1')]();var auth=require(_0x83c8('0x2'));var controller=require(_0x83c8('0x3'));router[_0x83c8('0x4')](_0x83c8('0x5'),auth[_0x83c8('0x6')](),auth[_0x83c8('0x7')](),controller['originate']);router[_0x83c8('0x4')](_0x83c8('0x8'),auth[_0x83c8('0x6')](),auth[_0x83c8('0x7')](),controller[_0x83c8('0x9')]);router[_0x83c8('0x4')](_0x83c8('0xa'),auth[_0x83c8('0x6')](),auth[_0x83c8('0x7')](),controller[_0x83c8('0xb')]);router[_0x83c8('0x4')](_0x83c8('0xc'),auth[_0x83c8('0x6')](),auth[_0x83c8('0x7')](),controller['hold']);router[_0x83c8('0x4')](_0x83c8('0xd'),auth[_0x83c8('0x6')](),auth['canUpdate'](),controller[_0x83c8('0xe')]);router['post'](_0x83c8('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller['calls']);router['post'](_0x83c8('0x10'),auth[_0x83c8('0x6')](),auth['canUpdate'](),controller['transfer']);module[_0x83c8('0x11')]=router; \ No newline at end of file +var _0x7536=['/calls','calls','exports','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','originate','/hangup','canUpdate','hangup','hold','/unhold'];(function(_0xb61168,_0x4fc7ee){var _0x4b6faf=function(_0x48945e){while(--_0x48945e){_0xb61168['push'](_0xb61168['shift']());}};_0x4b6faf(++_0x4fc7ee);}(_0x7536,0xf3));var _0x6753=function(_0x35e124,_0x1d85e2){_0x35e124=_0x35e124-0x0;var _0x53c482=_0x7536[_0x35e124];return _0x53c482;};'use strict';var express=require(_0x6753('0x0'));var router=express[_0x6753('0x1')]();var auth=require(_0x6753('0x2'));var controller=require(_0x6753('0x3'));router[_0x6753('0x4')]('/originate',auth[_0x6753('0x5')](),auth['canUpdate'](),controller[_0x6753('0x6')]);router[_0x6753('0x4')](_0x6753('0x7'),auth[_0x6753('0x5')](),auth[_0x6753('0x8')](),controller[_0x6753('0x9')]);router[_0x6753('0x4')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller['answer']);router[_0x6753('0x4')]('/hold',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6753('0xa')]);router[_0x6753('0x4')](_0x6753('0xb'),auth[_0x6753('0x5')](),auth[_0x6753('0x8')](),controller['unhold']);router[_0x6753('0x4')](_0x6753('0xc'),auth[_0x6753('0x5')](),auth[_0x6753('0x8')](),controller[_0x6753('0xd')]);router[_0x6753('0x4')]('/transfer',auth[_0x6753('0x5')](),auth[_0x6753('0x8')](),controller['transfer']);module[_0x6753('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a141bd8..cbbfe2f 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 _0x1b32=['emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','length','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','hangup\x20executed!','catch','answer','answer\x20fired:','webbar:answer','hold','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x2e513b,_0x25fbf1){var _0x15b04c=function(_0x376253){while(--_0x376253){_0x2e513b['push'](_0x2e513b['shift']());}};_0x15b04c(++_0x25fbf1);}(_0x1b32,0x85));var _0x21b3=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1b32[_0x4e676e];return _0x336a3c;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x21b3('0x0'));var db=require(_0x21b3('0x1'))['db'];var config=require(_0x21b3('0x2'));var util=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var jayson=require(_0x21b3('0x5'));var amiClient=jayson[_0x21b3('0x6')][_0x21b3('0x7')]({'port':0x232a});var logger=require(_0x21b3('0x8'))(_0x21b3('0x9'));var Redis=require(_0x21b3('0xa'));config[_0x21b3('0xb')]=_[_0x21b3('0xc')](config[_0x21b3('0xb')],{'host':_0x21b3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21b3('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x12')]},'transferNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x15662a,_0xe6b2b7,_0x29f286){logger[_0x21b3('0x14')](_0x15662a,_0xe6b2b7,JSON['stringify'](_0x29f286));io['to'](_0x15662a)[_0x21b3('0x15')](_0xe6b2b7,_0x29f286);}function handleError(_0x47ae6c){return function(_0x408c17){console[_0x21b3('0x16')](_0x21b3('0x17'),_0x408c17,_0x408c17 instanceof RangeError);logger[_0x21b3('0x18')](_0x408c17['stack']);if(_0x408c17 instanceof RangeError){if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x194)['send'](_0x408c17);}else{if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x1f4)[_0x21b3('0x1b')](_0x408c17);}};}function checkError(){return function(_0x360e57){if(!_0x360e57){throw new RangeError(_0x21b3('0x1c'));}return _0x360e57;};}function respondWithRpcPromise(_0x1e5181,_0x4cc8e0){return new BPromise(function(_0xbb78f3,_0x54695b){var _0x139672=amiClient;return _0x139672[_0x21b3('0x1d')](_0x1e5181,_0x4cc8e0)[_0x21b3('0x1e')](function(_0x4fcb87){if(_0x4fcb87[_0x21b3('0x18')]){if(_0x4fcb87['error'][_0x21b3('0x1f')]===0x1f4){return _0x54695b(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}return _0xbb78f3(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}else{_0xbb78f3(_0x4fcb87[_0x21b3('0x21')]);}})['catch'](function(_0x5b752c){_0x54695b(_0x5b752c);});});}function getAgent(_0x49aab8){return db[_0x21b3('0x22')][_0x21b3('0x23')]({'where':{'id':_0x49aab8,'role':_0x21b3('0x24')}})[_0x21b3('0x1e')](checkError());}function getAgentCheckSession(_0x18eba4,_0x58a356){return new BPromise(function(_0x170e78,_0x564313){var _0x16d012=respondWithRpcPromise('VoiceChannels');var _0x469e42=getAgent(_0x18eba4);Promise[_0x21b3('0x25')]([_0x16d012,_0x469e42])[_0x21b3('0x1e')](function(_0x4f6432){var _0x291e52=_0x4f6432[0x0];var _0x300977=_0x4f6432[0x1];var _0x336b1e=_[_0x21b3('0x26')](_0x291e52[_0x21b3('0x27')],function(_0x210c49){return _0x210c49[_0x21b3('0x28')]==_0x300977['id']&&_0x210c49['sessionId']==_0x58a356;});if(_0x336b1e['length']==0x1){_0x170e78(_0x300977);}else{_0x564313(new RangeError(_0x21b3('0x29')+_0x58a356+_0x21b3('0x2a')));}});});}exports['originate']=function(_0x45c753,_0xa04ac7){logger[_0x21b3('0x14')](_0x21b3('0x2b'),_0x45c753[_0x21b3('0x2c')]);var _0x6c56f5=originateValidation[_0x21b3('0x2d')](_0x45c753[_0x21b3('0x2c')]);if(_0x6c56f5[_0x21b3('0x2e')]>0x0){return _0xa04ac7['status'](0x190)['json'](_0x6c56f5);}var _0x18946f=_0x45c753['body'][_0x21b3('0x2f')];var _0x2d8c12=_0x45c753['body'][_0x21b3('0x30')];var _0x403cec=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x31')];var _0x4c4239=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x32')];return getAgent(_0x18946f)[_0x21b3('0x1e')](function(_0x118b9b){logger['info'](_0x21b3('0x33'),_0x118b9b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x118b9b[_0x21b3('0x19')]),_0x21b3('0x36'),{'callNumber':_0x2d8c12,'callerId':_0x403cec,'callbackUrl':_0x4c4239});return _0xa04ac7[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x38')});})['catch'](handleError(_0xa04ac7));};exports['hangup']=function(_0x28641f,_0x86027e){logger[_0x21b3('0x14')](_0x21b3('0x39'),_0x28641f['body']);var _0x1c190e=hangupValidation[_0x21b3('0x2d')](_0x28641f[_0x21b3('0x2c')]);if(_0x1c190e[_0x21b3('0x2e')]>0x0){return _0x86027e[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x1c190e);}var _0xbb93cd=_0x28641f[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x3145b2=_0x28641f[_0x21b3('0x2c')]['sessionId'];return getAgent(_0xbb93cd)[_0x21b3('0x1e')](function(_0x321050){logger['info'](_0x21b3('0x33'),_0x321050['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x321050['name']),'webbar:hangup',{'sessionId':_0x3145b2});return _0x86027e['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x3a')});})[_0x21b3('0x3b')](handleError(_0x86027e));};exports[_0x21b3('0x3c')]=function(_0x548652,_0x5d310c){logger[_0x21b3('0x14')](_0x21b3('0x3d'),_0x548652[_0x21b3('0x2c')]);var _0x28adbc=answerValidation[_0x21b3('0x2d')](_0x548652[_0x21b3('0x2c')]);if(_0x28adbc[_0x21b3('0x2e')]>0x0){return _0x5d310c['status'](0x190)[_0x21b3('0x37')](_0x28adbc);}var _0x44cf7d=_0x548652[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x119b43=_0x548652[_0x21b3('0x2c')]['sessionId'];return getAgent(_0x44cf7d)['then'](function(_0x1e7e1b){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x1e7e1b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x1e7e1b[_0x21b3('0x19')]),_0x21b3('0x3e'),{'sessionId':_0x119b43});return _0x5d310c[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'answer\x20executed!'});})[_0x21b3('0x3b')](handleError(_0x5d310c));};exports[_0x21b3('0x3f')]=function(_0x3bc4ef,_0x4e3d2b){logger['info']('hold\x20fired:',_0x3bc4ef[_0x21b3('0x2c')]);var _0x17b878=holdValidation[_0x21b3('0x2d')](_0x3bc4ef[_0x21b3('0x2c')]);if(_0x17b878[_0x21b3('0x2e')]>0x0){return _0x4e3d2b[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x17b878);}var _0x30d48b=_0x3bc4ef[_0x21b3('0x2c')]['userId'];var _0x542ef4=_0x3bc4ef['body'][_0x21b3('0x40')];return getAgent(_0x30d48b)[_0x21b3('0x1e')](function(_0x4046cd){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x4046cd[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x4046cd[_0x21b3('0x19')]),_0x21b3('0x41'),{'sessionId':_0x542ef4});return _0x4e3d2b['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x42')});})[_0x21b3('0x3b')](handleError(_0x4e3d2b));};exports[_0x21b3('0x43')]=function(_0x34509e,_0x2c7019){logger[_0x21b3('0x14')](_0x21b3('0x44'),_0x34509e[_0x21b3('0x2c')]);var _0x58c568=unholdValidation[_0x21b3('0x2d')](_0x34509e[_0x21b3('0x2c')]);if(_0x58c568[_0x21b3('0x2e')]>0x0){return _0x2c7019[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x58c568);}var _0x5d7ee7=_0x34509e['body'][_0x21b3('0x2f')];var _0x4bd19f=_0x34509e[_0x21b3('0x2c')][_0x21b3('0x40')];return getAgent(_0x5d7ee7)[_0x21b3('0x1e')](function(_0x412536){logger['info']('entityFound:',_0x412536[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x412536[_0x21b3('0x19')]),'webbar:unhold',{'sessionId':_0x4bd19f});return _0x2c7019[_0x21b3('0x1a')](0xc8)['json']({'error':![],'message':_0x21b3('0x45')});})[_0x21b3('0x3b')](handleError(_0x2c7019));};exports['calls']=function(_0x5f55ff,_0x3fd841){logger[_0x21b3('0x14')](_0x21b3('0x46'),_0x3fd841[_0x21b3('0x2c')]);var _0xc612b5=callsValidation[_0x21b3('0x2d')](_0x5f55ff[_0x21b3('0x2c')]);if(_0xc612b5['length']>0x0){return _0x3fd841[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0xc612b5);}var _0x166a31=_0x5f55ff[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x49a40e=respondWithRpcPromise('VoiceChannels');var _0x31c8f8=getAgent(_0x166a31);return Promise[_0x21b3('0x25')]([_0x49a40e,_0x31c8f8])[_0x21b3('0x1e')](function(_0x279b7d){var _0x18582e=_0x279b7d[0x0];var _0x4f728=_0x279b7d[0x1];var _0x5b1611=_[_0x21b3('0x26')](_0x18582e[_0x21b3('0x27')],function(_0x552141){return _0x552141[_0x21b3('0x28')]==_0x4f728['id'];});return _0x3fd841['status'](0xc8)[_0x21b3('0x37')]({'count':_0x5b1611[_0x21b3('0x2e')],'rows':_0x5b1611});})[_0x21b3('0x3b')](handleError(_0x3fd841));};exports[_0x21b3('0x47')]=function(_0x542c4e,_0x193317){logger['info'](_0x21b3('0x48'),_0x542c4e[_0x21b3('0x2c')]);var _0x3d285f=conferenceValidation[_0x21b3('0x2d')](_0x542c4e[_0x21b3('0x2c')]);if(_0x3d285f['length']>0x0){return _0x193317[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3d285f);}var _0x1821bf=_0x542c4e[_0x21b3('0x2c')][_0x21b3('0x2f')];return getAgent(_0x1821bf)[_0x21b3('0x1e')](function(_0xf6eb3){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0xf6eb3[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0xf6eb3[_0x21b3('0x19')]),_0x21b3('0x49'));return _0x193317[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x4a')});})[_0x21b3('0x3b')](handleError(_0x193317));};exports['transfer']=function(_0x412e3b,_0xc0c8f){logger[_0x21b3('0x14')]('transfer\x20fired:',_0x412e3b[_0x21b3('0x2c')]);var _0x3572e1=transferValidation[_0x21b3('0x2d')](_0x412e3b['body']);if(_0x3572e1[_0x21b3('0x2e')]>0x0){return _0xc0c8f[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3572e1);}var _0x1655e4=_0x412e3b[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x2d33a7=_0x412e3b['body']['sessionId'];var _0x31c511=_0x412e3b['body'][_0x21b3('0x4b')];return getAgent(_0x1655e4)[_0x21b3('0x1e')](function(_0x164d9f){logger['info'](_0x21b3('0x33'),_0x164d9f[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x164d9f[_0x21b3('0x19')]),_0x21b3('0x4c'),{'sessionId':_0x2d33a7,'transferNumber':_0x31c511});return _0xc0c8f[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc0c8f));}; \ No newline at end of file +var _0xde2c=['name','send','status','request','error','code','message','result','catch','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','userId','callNumber','callerId','callbackUrl','format','user:%s','json','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','hold','hold\x20fired:','entityFound:','hold\x20executed!','unhold','webbar:unhold','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack'];(function(_0x2474d3,_0x1208ba){var _0x1b7308=function(_0x10bc8a){while(--_0x10bc8a){_0x2474d3['push'](_0x2474d3['shift']());}};_0x1b7308(++_0x1208ba);}(_0xde2c,0x7f));var _0xcde2=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xde2c[_0x38b14f];return _0x22a324;};'use strict';var path=require(_0xcde2('0x0'));var fs=require('fs');var _=require(_0xcde2('0x1'));var db=require(_0xcde2('0x2'))['db'];var config=require(_0xcde2('0x3'));var util=require(_0xcde2('0x4'));var BPromise=require(_0xcde2('0x5'));var jayson=require(_0xcde2('0x6'));var amiClient=jayson[_0xcde2('0x7')]['http']({'port':0x232a});var logger=require(_0xcde2('0x8'))(_0xcde2('0x9'));var Redis=require(_0xcde2('0xa'));config[_0xcde2('0xb')]=_[_0xcde2('0xc')](config['redis'],{'host':_0xcde2('0xd'),'port':0x18eb});var io=require(_0xcde2('0xe'))(new Redis(config[_0xcde2('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcde2('0xf')]},'callNumber':{'type':_0xcde2('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xcde2('0x10')},'callbackUrl':{'type':_0xcde2('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xcde2('0x11'),'required':[!![],_0xcde2('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcde2('0xf')]},'sessionId':{'type':_0xcde2('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xcde2('0x11'),'required':[!![],_0xcde2('0xf')]},'sessionId':{'type':_0xcde2('0x10'),'required':[!![],_0xcde2('0x12')]},'transferNumber':{'type':'string','required':[!![],_0xcde2('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcde2('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcde2('0xf')]},'sessionId':{'type':_0xcde2('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xcde2('0x11'),'required':[!![],_0xcde2('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xcde2('0x11'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x39b023,_0x4c558b,_0x31b4a7){logger[_0xcde2('0x14')](_0x39b023,_0x4c558b,JSON[_0xcde2('0x15')](_0x31b4a7));io['to'](_0x39b023)[_0xcde2('0x16')](_0x4c558b,_0x31b4a7);}function handleError(_0x5223f1){return function(_0x4fd5aa){console['log'](_0xcde2('0x17'),_0x4fd5aa,_0x4fd5aa instanceof RangeError);logger['error'](_0x4fd5aa[_0xcde2('0x18')]);if(_0x4fd5aa instanceof RangeError){if(_0x4fd5aa[_0xcde2('0x19')]){delete _0x4fd5aa[_0xcde2('0x19')];}_0x5223f1['status'](0x194)[_0xcde2('0x1a')](_0x4fd5aa);}else{if(_0x4fd5aa[_0xcde2('0x19')]){delete _0x4fd5aa[_0xcde2('0x19')];}_0x5223f1[_0xcde2('0x1b')](0x1f4)[_0xcde2('0x1a')](_0x4fd5aa);}};}function checkError(){return function(_0x57210d){if(!_0x57210d){throw new RangeError('NotFound');}return _0x57210d;};}function respondWithRpcPromise(_0x5a92b9,_0xb96dc0){return new BPromise(function(_0x3e5170,_0x2c9562){var _0x4063d4=amiClient;return _0x4063d4[_0xcde2('0x1c')](_0x5a92b9,_0xb96dc0)['then'](function(_0x1104b8){if(_0x1104b8['error']){if(_0x1104b8[_0xcde2('0x1d')][_0xcde2('0x1e')]===0x1f4){return _0x2c9562(_0x1104b8[_0xcde2('0x1d')]['message']);}return _0x3e5170(_0x1104b8['error'][_0xcde2('0x1f')]);}else{_0x3e5170(_0x1104b8[_0xcde2('0x20')]);}})[_0xcde2('0x21')](function(_0x217ec9){_0x2c9562(_0x217ec9);});});}function getAgent(_0xcadb2){return db['User'][_0xcde2('0x22')]({'where':{'id':_0xcadb2,'role':_0xcde2('0x23')}})[_0xcde2('0x24')](checkError());}function getAgentCheckSession(_0x513965,_0x2487eb){return new BPromise(function(_0x348ca1,_0x8e1655){var _0x40309d=respondWithRpcPromise(_0xcde2('0x25'));var _0x5b2b7=getAgent(_0x513965);Promise[_0xcde2('0x26')]([_0x40309d,_0x5b2b7])[_0xcde2('0x24')](function(_0x5bf1e6){var _0x3c3c01=_0x5bf1e6[0x0];var _0x4a0826=_0x5bf1e6[0x1];var _0x141072=_[_0xcde2('0x27')](_0x3c3c01[_0xcde2('0x28')],function(_0x49cb58){return _0x49cb58[_0xcde2('0x29')]==_0x4a0826['id']&&_0x49cb58[_0xcde2('0x2a')]==_0x2487eb;});if(_0x141072['length']==0x1){_0x348ca1(_0x4a0826);}else{_0x8e1655(new RangeError(_0xcde2('0x2b')+_0x2487eb+_0xcde2('0x2c')));}});});}exports[_0xcde2('0x2d')]=function(_0x2b2ea1,_0x14f784){logger[_0xcde2('0x14')](_0xcde2('0x2e'),_0x2b2ea1[_0xcde2('0x2f')]);var _0x5c08f0=originateValidation[_0xcde2('0x30')](_0x2b2ea1[_0xcde2('0x2f')]);if(_0x5c08f0[_0xcde2('0x31')]>0x0){return _0x14f784[_0xcde2('0x1b')](0x190)['json'](_0x5c08f0);}var _0x2ae8e0=_0x2b2ea1[_0xcde2('0x2f')][_0xcde2('0x32')];var _0x2fec6e=_0x2b2ea1['body'][_0xcde2('0x33')];var _0x452816=_0x2b2ea1[_0xcde2('0x2f')][_0xcde2('0x34')];var _0x54ae78=_0x2b2ea1[_0xcde2('0x2f')][_0xcde2('0x35')];return getAgent(_0x2ae8e0)[_0xcde2('0x24')](function(_0x3090b6){logger[_0xcde2('0x14')]('entityFound:',_0x3090b6[_0xcde2('0x19')]);emit(util[_0xcde2('0x36')](_0xcde2('0x37'),_0x3090b6[_0xcde2('0x19')]),'webbar:originate',{'callNumber':_0x2fec6e,'callerId':_0x452816,'callbackUrl':_0x54ae78});return _0x14f784['status'](0xc8)[_0xcde2('0x38')]({'error':![],'message':_0xcde2('0x39')});})[_0xcde2('0x21')](handleError(_0x14f784));};exports[_0xcde2('0x3a')]=function(_0x10c494,_0x45af6e){logger[_0xcde2('0x14')](_0xcde2('0x3b'),_0x10c494[_0xcde2('0x2f')]);var _0x5d02b3=hangupValidation[_0xcde2('0x30')](_0x10c494[_0xcde2('0x2f')]);if(_0x5d02b3[_0xcde2('0x31')]>0x0){return _0x45af6e[_0xcde2('0x1b')](0x190)[_0xcde2('0x38')](_0x5d02b3);}var _0x47b6ee=_0x10c494['body'][_0xcde2('0x32')];var _0xc8e8a4=_0x10c494[_0xcde2('0x2f')][_0xcde2('0x2a')];return getAgent(_0x47b6ee)[_0xcde2('0x24')](function(_0x1939a0){logger['info']('entityFound:',_0x1939a0['name']);emit(util[_0xcde2('0x36')](_0xcde2('0x37'),_0x1939a0[_0xcde2('0x19')]),_0xcde2('0x3c'),{'sessionId':_0xc8e8a4});return _0x45af6e[_0xcde2('0x1b')](0xc8)[_0xcde2('0x38')]({'error':![],'message':_0xcde2('0x3d')});})['catch'](handleError(_0x45af6e));};exports['answer']=function(_0x6f60d5,_0x578bf1){logger[_0xcde2('0x14')]('answer\x20fired:',_0x6f60d5[_0xcde2('0x2f')]);var _0x3239a0=answerValidation[_0xcde2('0x30')](_0x6f60d5['body']);if(_0x3239a0[_0xcde2('0x31')]>0x0){return _0x578bf1['status'](0x190)[_0xcde2('0x38')](_0x3239a0);}var _0x24a46a=_0x6f60d5[_0xcde2('0x2f')][_0xcde2('0x32')];var _0xcafd7=_0x6f60d5[_0xcde2('0x2f')]['sessionId'];return getAgent(_0x24a46a)['then'](function(_0x22084e){logger['info']('entityFound:',_0x22084e[_0xcde2('0x19')]);emit(util['format'](_0xcde2('0x37'),_0x22084e[_0xcde2('0x19')]),'webbar:answer',{'sessionId':_0xcafd7});return _0x578bf1[_0xcde2('0x1b')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xcde2('0x21')](handleError(_0x578bf1));};exports[_0xcde2('0x3e')]=function(_0x4fc9d5,_0x1e05a4){logger['info'](_0xcde2('0x3f'),_0x4fc9d5[_0xcde2('0x2f')]);var _0x2d7b55=holdValidation[_0xcde2('0x30')](_0x4fc9d5[_0xcde2('0x2f')]);if(_0x2d7b55['length']>0x0){return _0x1e05a4[_0xcde2('0x1b')](0x190)[_0xcde2('0x38')](_0x2d7b55);}var _0x40d14b=_0x4fc9d5[_0xcde2('0x2f')]['userId'];var _0x58ded4=_0x4fc9d5[_0xcde2('0x2f')]['sessionId'];return getAgent(_0x40d14b)[_0xcde2('0x24')](function(_0x3e9e79){logger[_0xcde2('0x14')](_0xcde2('0x40'),_0x3e9e79[_0xcde2('0x19')]);emit(util[_0xcde2('0x36')]('user:%s',_0x3e9e79[_0xcde2('0x19')]),'webbar:hold',{'sessionId':_0x58ded4});return _0x1e05a4[_0xcde2('0x1b')](0xc8)['json']({'error':![],'message':_0xcde2('0x41')});})[_0xcde2('0x21')](handleError(_0x1e05a4));};exports[_0xcde2('0x42')]=function(_0x16cddb,_0x446cf0){logger[_0xcde2('0x14')]('unhold\x20fired:',_0x16cddb[_0xcde2('0x2f')]);var _0x5aa54f=unholdValidation[_0xcde2('0x30')](_0x16cddb[_0xcde2('0x2f')]);if(_0x5aa54f[_0xcde2('0x31')]>0x0){return _0x446cf0[_0xcde2('0x1b')](0x190)[_0xcde2('0x38')](_0x5aa54f);}var _0x9067c8=_0x16cddb[_0xcde2('0x2f')][_0xcde2('0x32')];var _0x373cdc=_0x16cddb[_0xcde2('0x2f')][_0xcde2('0x2a')];return getAgent(_0x9067c8)[_0xcde2('0x24')](function(_0x5d777d){logger['info']('entityFound:',_0x5d777d[_0xcde2('0x19')]);emit(util['format'](_0xcde2('0x37'),_0x5d777d[_0xcde2('0x19')]),_0xcde2('0x43'),{'sessionId':_0x373cdc});return _0x446cf0['status'](0xc8)[_0xcde2('0x38')]({'error':![],'message':'unhold\x20executed!'});})[_0xcde2('0x21')](handleError(_0x446cf0));};exports['calls']=function(_0x1085d2,_0x10d6ab){logger['info'](_0xcde2('0x44'),_0x10d6ab['body']);var _0x5e6fd3=callsValidation[_0xcde2('0x30')](_0x1085d2[_0xcde2('0x2f')]);if(_0x5e6fd3[_0xcde2('0x31')]>0x0){return _0x10d6ab[_0xcde2('0x1b')](0x190)[_0xcde2('0x38')](_0x5e6fd3);}var _0x3787b5=_0x1085d2['body'][_0xcde2('0x32')];var _0x44b3fb=respondWithRpcPromise(_0xcde2('0x25'));var _0x145b4a=getAgent(_0x3787b5);return Promise[_0xcde2('0x26')]([_0x44b3fb,_0x145b4a])[_0xcde2('0x24')](function(_0x50892c){var _0x5775bb=_0x50892c[0x0];var _0x30dee3=_0x50892c[0x1];var _0x35c6e5=_[_0xcde2('0x27')](_0x5775bb[_0xcde2('0x28')],function(_0x4c298b){return _0x4c298b[_0xcde2('0x29')]==_0x30dee3['id'];});return _0x10d6ab[_0xcde2('0x1b')](0xc8)[_0xcde2('0x38')]({'count':_0x35c6e5[_0xcde2('0x31')],'rows':_0x35c6e5});})[_0xcde2('0x21')](handleError(_0x10d6ab));};exports[_0xcde2('0x45')]=function(_0x50a1db,_0x1bea12){logger[_0xcde2('0x14')]('conference\x20fired:',_0x50a1db[_0xcde2('0x2f')]);var _0x4544bd=conferenceValidation[_0xcde2('0x30')](_0x50a1db[_0xcde2('0x2f')]);if(_0x4544bd[_0xcde2('0x31')]>0x0){return _0x1bea12[_0xcde2('0x1b')](0x190)[_0xcde2('0x38')](_0x4544bd);}var _0x2541e0=_0x50a1db[_0xcde2('0x2f')][_0xcde2('0x32')];return getAgent(_0x2541e0)['then'](function(_0x223cb0){logger[_0xcde2('0x14')]('entityFound:',_0x223cb0[_0xcde2('0x19')]);emit(util[_0xcde2('0x36')](_0xcde2('0x37'),_0x223cb0['name']),_0xcde2('0x46'));return _0x1bea12[_0xcde2('0x1b')](0xc8)[_0xcde2('0x38')]({'error':![],'message':_0xcde2('0x47')});})[_0xcde2('0x21')](handleError(_0x1bea12));};exports[_0xcde2('0x48')]=function(_0x21cd07,_0x45bd76){logger[_0xcde2('0x14')](_0xcde2('0x49'),_0x21cd07[_0xcde2('0x2f')]);var _0x5d42f8=transferValidation['validate'](_0x21cd07[_0xcde2('0x2f')]);if(_0x5d42f8[_0xcde2('0x31')]>0x0){return _0x45bd76[_0xcde2('0x1b')](0x190)['json'](_0x5d42f8);}var _0x485a79=_0x21cd07['body'][_0xcde2('0x32')];var _0x367bad=_0x21cd07[_0xcde2('0x2f')][_0xcde2('0x2a')];var _0x325b51=_0x21cd07[_0xcde2('0x2f')]['transferNumber'];return getAgent(_0x485a79)['then'](function(_0x165ec4){logger[_0xcde2('0x14')](_0xcde2('0x40'),_0x165ec4[_0xcde2('0x19')]);emit(util[_0xcde2('0x36')](_0xcde2('0x37'),_0x165ec4[_0xcde2('0x19')]),_0xcde2('0x4a'),{'sessionId':_0x367bad,'transferNumber':_0x325b51});return _0x45bd76[_0xcde2('0x1b')](0xc8)[_0xcde2('0x38')]({'error':![],'message':_0xcde2('0x4b')});})[_0xcde2('0x21')](handleError(_0x45bd76));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index cc04f90..fd69416 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 _0x1a37=['get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x1a37[_0x266618];return _0x54dbf5;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./whatsappAccount.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0xa')](_0x71a3('0x13'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0x15')]('/',auth[_0x71a3('0xd')](),controller[_0x71a3('0x16')]);router[_0x71a3('0x15')](_0x71a3('0xf'),auth['isAuthenticated'](),controller[_0x71a3('0x17')]);router[_0x71a3('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x71a3('0x18')]);router[_0x71a3('0x15')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1a')]);router[_0x71a3('0x15')]('/:id/applications',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1b')]);router['post']('/:id/notify',controller[_0x71a3('0x1c')]);router[_0x71a3('0x15')](_0x71a3('0x1d'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1e')]);router['put'](_0x71a3('0x1f'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x20')]);router[_0x71a3('0x21')](_0x71a3('0x1f'),auth['isAuthenticated'](),controller[_0x71a3('0x22')]);router['delete'](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x23')]);router[_0x71a3('0x21')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['removeAnswers']);router[_0x71a3('0x21')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x24')]);module[_0x71a3('0x25')]=router; \ No newline at end of file +var _0x4137=['get','index','/describe','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','create','/:id/dispositions','post','addAnswer','addAgents','addApplications','notify','/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller'];(function(_0x40e250,_0x4de18e){var _0x26119c=function(_0x2319d4){while(--_0x2319d4){_0x40e250['push'](_0x40e250['shift']());}};_0x26119c(++_0x4de18e);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0xb')]('/:id/dispositions',auth[_0x7413('0xe')](),controller[_0x7413('0x11')]);router[_0x7413('0xb')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller['getAnswers']);router[_0x7413('0xb')](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x14')]);router[_0x7413('0xb')](_0x7413('0x15'),auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0x7413('0xe')](),controller[_0x7413('0x16')]);router['post'](_0x7413('0x17'),auth[_0x7413('0xe')](),controller['addDisposition']);router[_0x7413('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7413('0x19')]);router['post'](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x1a')]);router[_0x7413('0x18')](_0x7413('0x15'),auth[_0x7413('0xe')](),controller[_0x7413('0x1b')]);router[_0x7413('0x18')]('/:id/notify',controller[_0x7413('0x1c')]);router[_0x7413('0x18')](_0x7413('0x1d'),auth[_0x7413('0xe')](),controller['send']);router[_0x7413('0x1e')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x1f')]);router[_0x7413('0x20')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x21')]);router['delete']('/:id/dispositions',auth[_0x7413('0xe')](),controller['removeDispositions']);router[_0x7413('0x20')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller[_0x7413('0x22')]);router[_0x7413('0x20')](_0x7413('0x13'),auth[_0x7413('0xe')](),controller[_0x7413('0x23')]);module[_0x7413('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 3c53a9d..de9a769 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 _0x9d34=['name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x1fd827,_0x50981b){var _0x5684e4=function(_0x4722ad){while(--_0x4722ad){_0x1fd827['push'](_0x1fd827['shift']());}};_0x5684e4(++_0x50981b);}(_0x9d34,0xf9));var _0x49d3=function(_0x32f91b,_0x460016){_0x32f91b=_0x32f91b-0x0;var _0x3ee8f3=_0x9d34[_0x32f91b];return _0x3ee8f3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x49d3('0x0'));module[_0x49d3('0x1')]={'name':{'type':Sequelize[_0x49d3('0x2')],'unique':_0x49d3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x49d3('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x49d3('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x49d3('0x2')],'defaultValue':function(){return rs[_0x49d3('0x4')]();}},'phone':{'type':Sequelize[_0x49d3('0x2')]},'type':{'type':Sequelize[_0x49d3('0x5')](_0x49d3('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x49d3('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x49d3('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x49d3('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49d3('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x49d3('0x8')],'defaultValue':![],'comment':_0x49d3('0xa'),'set':function(_0x319614){if(!_0x319614){this[_0x49d3('0xb')](_0x49d3('0xc'),null);}this['setDataValue'](_0x49d3('0xd'),_0x319614);}},'description':{'type':Sequelize[_0x49d3('0x2')]}}; \ No newline at end of file +var _0x7d51=['generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','randomstring','exports','STRING','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7d51,0x14c));var _0x17d5=function(_0x2f3f5a,_0x5064e5){_0x2f3f5a=_0x2f3f5a-0x0;var _0x6a788e=_0x7d51[_0x2f3f5a];return _0x6a788e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x17d5('0x0'));module[_0x17d5('0x1')]={'name':{'type':Sequelize[_0x17d5('0x2')],'unique':_0x17d5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x17d5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x17d5('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x17d5('0x4')]();}},'phone':{'type':Sequelize[_0x17d5('0x2')]},'type':{'type':Sequelize[_0x17d5('0x5')](_0x17d5('0x6'))},'accountSid':{'type':Sequelize[_0x17d5('0x2')]},'authToken':{'type':Sequelize[_0x17d5('0x2')]},'notificationTemplate':{'type':Sequelize[_0x17d5('0x7')],'defaultValue':function(){return _0x17d5('0x8');}},'notificationSound':{'type':Sequelize[_0x17d5('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x17d5('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x17d5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x17d5('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x17d5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x17d5('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x29c347){if(!_0x29c347){this[_0x17d5('0xb')]('mandatoryDispositionPauseId',null);}this[_0x17d5('0xb')]('mandatoryDisposition',_0x29c347);}},'description':{'type':Sequelize[_0x17d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 1a859ac..6f7d718 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 _0x3796=['intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','user','get','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','priority','getApplications','notify','Applications','account','orderBy','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','replace','whatsapp:','messageId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','interaction','created','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','message','info','WhatsappAccount,\x20%s,\x20%s','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','save','update','destroy','UserProfileResource','stack','name','send','Pause','map','rawAttributes','type','key','model','query','keys'];(function(_0x49bd3e,_0x45be30){var _0x5ae802=function(_0x1a53dd){while(--_0x1a53dd){_0x49bd3e['push'](_0x49bd3e['shift']());}};_0x5ae802(++_0x45be30);}(_0x3796,0x129));var _0x6379=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x3796[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require(_0x6379('0x0'));var rimraf=require(_0x6379('0x1'));var zipdir=require(_0x6379('0x2'));var jsonpatch=require(_0x6379('0x3'));var rp=require(_0x6379('0x4'));var moment=require('moment');var BPromise=require(_0x6379('0x5'));var Mustache=require(_0x6379('0x6'));var util=require(_0x6379('0x7'));var path=require(_0x6379('0x8'));var sox=require('sox');var csv=require(_0x6379('0x9'));var ejs=require(_0x6379('0xa'));var fs=require('fs');var fs_extra=require(_0x6379('0xb'));var _=require(_0x6379('0xc'));var squel=require(_0x6379('0xd'));var crypto=require(_0x6379('0xe'));var jsforce=require(_0x6379('0xf'));var deskjs=require(_0x6379('0x10'));var toCsv=require(_0x6379('0x9'));var querystring=require(_0x6379('0x11'));var Papa=require(_0x6379('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6379('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6379('0x14'));var logger=require(_0x6379('0x15'))('api');var utils=require(_0x6379('0x16'));var config=require(_0x6379('0x17'));var licenseUtil=require(_0x6379('0x18'));var db=require(_0x6379('0x19'))['db'];config[_0x6379('0x1a')]=_[_0x6379('0x1b')](config['redis'],{'host':_0x6379('0x1c'),'port':0x18eb});var socket=require(_0x6379('0x1d'))(new Redis(config[_0x6379('0x1a')]));require(_0x6379('0x1e'))[_0x6379('0x1f')](socket);var jayson=require(_0x6379('0x20'));var client=jayson[_0x6379('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3b2bac,_0x10e491,_0x23baf2,_0x4b5003){return new BPromise(function(_0x5b70f4,_0x46a5a8){var _0x349ea9=_0x4b5003||client;return _0x349ea9[_0x6379('0x22')](_0x3b2bac,_0x23baf2)[_0x6379('0x23')](function(_0x57bfea){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x10e491,_0x6379('0x24'));logger[_0x6379('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x10e491,_0x6379('0x24'),JSON[_0x6379('0x26')](_0x57bfea));if(_0x57bfea[_0x6379('0x27')]){if(_0x57bfea[_0x6379('0x27')][_0x6379('0x28')]===0x1f4){logger[_0x6379('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x10e491,_0x57bfea[_0x6379('0x27')][_0x6379('0x29')]);return _0x46a5a8(_0x57bfea[_0x6379('0x27')][_0x6379('0x29')]);}logger[_0x6379('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x10e491,_0x57bfea[_0x6379('0x27')]['message']);return _0x5b70f4(_0x57bfea[_0x6379('0x27')][_0x6379('0x29')]);}else{logger[_0x6379('0x2a')](_0x6379('0x2b'),_0x10e491,_0x6379('0x24'));_0x5b70f4(_0x57bfea['result'][_0x6379('0x29')]);}})[_0x6379('0x2c')](function(_0x24737a){logger[_0x6379('0x27')](_0x6379('0x2b'),_0x10e491,_0x24737a);_0x46a5a8(_0x24737a);});});}function respondWithStatusCode(_0x512fdd,_0x368c1e){_0x368c1e=_0x368c1e||0xcc;return function(_0x49a638){if(_0x49a638){return _0x512fdd[_0x6379('0x2d')](_0x368c1e);}return _0x512fdd['status'](_0x368c1e)[_0x6379('0x2e')]();};}function respondWithResult(_0x5f3a84,_0x449edf){_0x449edf=_0x449edf||0xc8;return function(_0x1ec32a){if(_0x1ec32a){return _0x5f3a84['status'](_0x449edf)[_0x6379('0x2f')](_0x1ec32a);}};}function respondWithFilteredResult(_0x41e688,_0x4a87a3){return function(_0xdaf8ed){if(_0xdaf8ed){var _0x43e976=typeof _0x4a87a3[_0x6379('0x30')]===_0x6379('0x31')&&typeof _0x4a87a3[_0x6379('0x32')]===_0x6379('0x31');var _0x359617=_0xdaf8ed['count'];var _0x4ff6fc=_0x43e976?0x0:_0x4a87a3[_0x6379('0x30')];var _0x5764e9=_0x43e976?_0xdaf8ed[_0x6379('0x33')]:_0x4a87a3[_0x6379('0x30')]+_0x4a87a3[_0x6379('0x32')];var _0x3d39b0;if(_0x5764e9>=_0x359617){_0x5764e9=_0x359617;_0x3d39b0=0xc8;}else{_0x3d39b0=0xce;}_0x41e688[_0x6379('0x34')](_0x3d39b0);return _0x41e688[_0x6379('0x35')]('Content-Range',_0x4ff6fc+'-'+_0x5764e9+'/'+_0x359617)[_0x6379('0x2f')](_0xdaf8ed);}return null;};}function patchUpdates(_0x69a8f5){return function(_0x2b84e2){try{jsonpatch['apply'](_0x2b84e2,_0x69a8f5,!![]);}catch(_0x4a559c){return BPromise['reject'](_0x4a559c);}return _0x2b84e2[_0x6379('0x36')]();};}function saveUpdates(_0x2508f1,_0x2e0b19){return function(_0x2bc2d4){if(_0x2bc2d4){return _0x2bc2d4[_0x6379('0x37')](_0x2508f1)['then'](function(_0x27dc46){return _0x27dc46;});}return null;};}function removeEntity(_0x19ba23,_0x4c3d36){return function(_0x2d4c3c){if(_0x2d4c3c){return _0x2d4c3c[_0x6379('0x38')]()[_0x6379('0x23')](function(){var _0x543b76=_0x2d4c3c['get']({'plain':!![]});var _0x4af4d4='WhatsappAccounts';return db[_0x6379('0x39')][_0x6379('0x38')]({'where':{'type':_0x4af4d4,'resourceId':_0x543b76['id']}})['then'](function(){return _0x2d4c3c;});})[_0x6379('0x23')](function(){_0x19ba23['status'](0xcc)[_0x6379('0x2e')]();});}};}function handleEntityNotFound(_0x396b7a,_0x4e9c5e){return function(_0x220a32){if(!_0x220a32){_0x396b7a['sendStatus'](0x194);}return _0x220a32;};}function handleError(_0x2f7fb7,_0x106d8d){_0x106d8d=_0x106d8d||0x1f4;return function(_0x5d9e59){logger[_0x6379('0x27')](_0x5d9e59[_0x6379('0x3a')]);if(_0x5d9e59[_0x6379('0x3b')]){delete _0x5d9e59['name'];}_0x2f7fb7['status'](_0x106d8d)[_0x6379('0x3c')](_0x5d9e59);};}exports['index']=function(_0x22ca9b,_0x1e1068){var _0xd3e7b0={'include':[{'model':db[_0x6379('0x3d')],'as':'mandatoryDispositionPause'}]},_0x349677={},_0x4af9e6={'count':0x0,'rows':[]};var _0x2921ae=_[_0x6379('0x3e')](db['WhatsappAccount'][_0x6379('0x3f')],function(_0x5a3d46){return{'name':_0x5a3d46['fieldName'],'type':_0x5a3d46[_0x6379('0x40')][_0x6379('0x41')]};});_0x349677[_0x6379('0x42')]=_['map'](_0x2921ae,_0x6379('0x3b'));_0x349677[_0x6379('0x43')]=_[_0x6379('0x44')](_0x22ca9b[_0x6379('0x43')]);_0x349677['filters']=_[_0x6379('0x45')](_0x349677['model'],_0x349677[_0x6379('0x43')]);_0xd3e7b0[_0x6379('0x46')]=_[_0x6379('0x45')](_0x349677[_0x6379('0x42')],qs[_0x6379('0x47')](_0x22ca9b[_0x6379('0x43')][_0x6379('0x47')]));_0xd3e7b0[_0x6379('0x46')]=_0xd3e7b0[_0x6379('0x46')][_0x6379('0x48')]?_0xd3e7b0[_0x6379('0x46')]:_0x349677['model'];if(!_0x22ca9b[_0x6379('0x43')][_0x6379('0x49')]('nolimit')){_0xd3e7b0['limit']=qs[_0x6379('0x32')](_0x22ca9b[_0x6379('0x43')]['limit']);_0xd3e7b0['offset']=qs[_0x6379('0x30')](_0x22ca9b[_0x6379('0x43')][_0x6379('0x30')]);}_0xd3e7b0['order']=qs['sort'](_0x22ca9b[_0x6379('0x43')][_0x6379('0x4a')]);_0xd3e7b0['where']=qs[_0x6379('0x4b')](_[_0x6379('0x4c')](_0x22ca9b[_0x6379('0x43')],_0x349677[_0x6379('0x4b')]),_0x2921ae);if(_0x22ca9b[_0x6379('0x43')]['filter']){_0xd3e7b0[_0x6379('0x4d')]=_[_0x6379('0x4e')](_0xd3e7b0[_0x6379('0x4d')],{'$or':_['map'](_0x2921ae,function(_0x33fdf8){if(_0x33fdf8[_0x6379('0x40')]!==_0x6379('0x4f')){var _0x522a4d={};_0x522a4d[_0x33fdf8['name']]={'$like':'%'+_0x22ca9b[_0x6379('0x43')]['filter']+'%'};return _0x522a4d;}})});}_0xd3e7b0=_[_0x6379('0x4e')]({},_0xd3e7b0,_0x22ca9b[_0x6379('0x50')]);var _0x571855={'where':_0xd3e7b0[_0x6379('0x4d')]};return db[_0x6379('0x51')][_0x6379('0x33')](_0x571855)['then'](function(_0x51b412){_0x4af9e6[_0x6379('0x33')]=_0x51b412;if(_0x22ca9b[_0x6379('0x43')][_0x6379('0x52')]){_0xd3e7b0[_0x6379('0x53')]=[{'all':!![]}];}return db[_0x6379('0x51')][_0x6379('0x54')](_0xd3e7b0);})[_0x6379('0x23')](function(_0x22509d){_0x4af9e6['rows']=_0x22509d;return _0x4af9e6;})['then'](respondWithFilteredResult(_0x1e1068,_0xd3e7b0))['catch'](handleError(_0x1e1068,null));};exports[_0x6379('0x55')]=function(_0xd6d43e,_0xf51ff){var _0x110cb0={'raw':![],'where':{'id':_0xd6d43e[_0x6379('0x56')]['id']},'include':[{'model':db[_0x6379('0x3d')],'as':_0x6379('0x57')}]},_0x4aad26={};_0x4aad26['model']=_['keys'](db[_0x6379('0x51')][_0x6379('0x3f')]);_0x4aad26[_0x6379('0x43')]=_[_0x6379('0x44')](_0xd6d43e[_0x6379('0x43')]);_0x4aad26[_0x6379('0x4b')]=_['intersection'](_0x4aad26[_0x6379('0x42')],_0x4aad26[_0x6379('0x43')]);_0x110cb0[_0x6379('0x46')]=_[_0x6379('0x45')](_0x4aad26[_0x6379('0x42')],qs['fields'](_0xd6d43e[_0x6379('0x43')][_0x6379('0x47')]));_0x110cb0['attributes']=_0x110cb0['attributes'][_0x6379('0x48')]?_0x110cb0[_0x6379('0x46')]:_0x4aad26[_0x6379('0x42')];if(_0xd6d43e[_0x6379('0x43')]['includeAll']){_0x110cb0['include']=[{'all':!![]}];}_0x110cb0=_[_0x6379('0x4e')]({},_0x110cb0,_0xd6d43e[_0x6379('0x50')]);return db[_0x6379('0x51')][_0x6379('0x58')](_0x110cb0)[_0x6379('0x23')](handleEntityNotFound(_0xf51ff,null))[_0x6379('0x23')](respondWithResult(_0xf51ff,null))['catch'](handleError(_0xf51ff,null));};exports['create']=function(_0x537173,_0x8118e8){return db['WhatsappAccount'][_0x6379('0x59')](_0x537173['body'],{})[_0x6379('0x23')](function(_0x32e90e){var _0x4474db=_0x537173[_0x6379('0x5a')][_0x6379('0x5b')]({'plain':!![]});if(!_0x4474db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4474db[_0x6379('0x5c')]===_0x6379('0x5a')){var _0x3ef00d=_0x32e90e[_0x6379('0x5b')]({'plain':!![]});var _0x37cf9d=_0x6379('0x5d');return db[_0x6379('0x5e')][_0x6379('0x58')]({'where':{'name':_0x37cf9d,'userProfileId':_0x4474db[_0x6379('0x5f')]},'raw':!![]})[_0x6379('0x23')](function(_0x44df3f){if(_0x44df3f&&_0x44df3f[_0x6379('0x60')]===0x0){return db[_0x6379('0x39')][_0x6379('0x59')]({'name':_0x3ef00d[_0x6379('0x3b')],'resourceId':_0x3ef00d['id'],'type':_0x44df3f[_0x6379('0x3b')],'sectionId':_0x44df3f['id']},{})[_0x6379('0x23')](function(){return _0x32e90e;});}else{return _0x32e90e;}})[_0x6379('0x2c')](function(_0x11f17){logger[_0x6379('0x27')](_0x6379('0x61'),_0x11f17);throw _0x11f17;});}return _0x32e90e;})[_0x6379('0x23')](respondWithResult(_0x8118e8,0xc9))[_0x6379('0x2c')](handleError(_0x8118e8,null));};exports[_0x6379('0x37')]=function(_0x51cdfa,_0x3a7ed2){if(_0x51cdfa[_0x6379('0x62')]['id']){delete _0x51cdfa['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x51cdfa[_0x6379('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x6379('0x57')}]})['then'](handleEntityNotFound(_0x3a7ed2,null))[_0x6379('0x23')](saveUpdates(_0x51cdfa[_0x6379('0x62')],null))[_0x6379('0x23')](respondWithResult(_0x3a7ed2,null))[_0x6379('0x2c')](handleError(_0x3a7ed2,null));};exports['destroy']=function(_0x414154,_0x50c274){return db[_0x6379('0x51')][_0x6379('0x58')]({'where':{'id':_0x414154['params']['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x50c274,null))[_0x6379('0x23')](removeEntity(_0x50c274,null))['catch'](handleError(_0x50c274,null));};exports[_0x6379('0x63')]=function(_0x38dc44,_0x5e7ab7){return db['WhatsappAccount'][_0x6379('0x63')]()[_0x6379('0x23')](respondWithResult(_0x5e7ab7,null))[_0x6379('0x2c')](handleError(_0x5e7ab7,null));};exports['addDisposition']=function(_0x1dff6a,_0x4e7078,_0x292cff){if(_0x1dff6a[_0x6379('0x62')]['id']){delete _0x1dff6a[_0x6379('0x62')]['id'];}return db[_0x6379('0x51')][_0x6379('0x58')]({'where':{'id':_0x1dff6a[_0x6379('0x56')]['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x4e7078,null))['then'](function(_0x2e0060){if(_0x2e0060){_0x1dff6a[_0x6379('0x62')][_0x6379('0x64')]=_0x2e0060['id'];return db[_0x6379('0x65')][_0x6379('0x59')](_0x1dff6a[_0x6379('0x62')]);}})[_0x6379('0x23')](respondWithResult(_0x4e7078,null))[_0x6379('0x2c')](handleError(_0x4e7078,null));};exports[_0x6379('0x66')]=function(_0xc3357c,_0x5483b5,_0x4dc93b){var _0x1971f0={'raw':![],'where':{}};var _0x1df30f={};var _0x544e4b={'count':0x0,'rows':[]};return db[_0x6379('0x51')][_0x6379('0x67')]({'where':{'id':_0xc3357c[_0x6379('0x56')]['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x5483b5,null))[_0x6379('0x23')](function(_0x1dbf79){if(_0x1dbf79){_0x1df30f['model']=_[_0x6379('0x44')](db[_0x6379('0x65')][_0x6379('0x3f')]);_0x1df30f[_0x6379('0x43')]=_[_0x6379('0x44')](_0xc3357c[_0x6379('0x43')]);_0x1df30f[_0x6379('0x4b')]=_[_0x6379('0x45')](_0x1df30f[_0x6379('0x42')],_0x1df30f[_0x6379('0x43')]);_0x1971f0[_0x6379('0x46')]=_[_0x6379('0x45')](_0x1df30f[_0x6379('0x42')],qs[_0x6379('0x47')](_0xc3357c['query'][_0x6379('0x47')]));_0x1971f0[_0x6379('0x46')]=_0x1971f0[_0x6379('0x46')][_0x6379('0x48')]?_0x1971f0['attributes']:_0x1df30f[_0x6379('0x42')];if(!_0xc3357c[_0x6379('0x43')][_0x6379('0x49')](_0x6379('0x68'))){_0x1971f0['limit']=qs[_0x6379('0x32')](_0xc3357c[_0x6379('0x43')][_0x6379('0x32')]);_0x1971f0[_0x6379('0x30')]=qs['offset'](_0xc3357c['query'][_0x6379('0x30')]);}_0x1971f0[_0x6379('0x69')]=qs[_0x6379('0x4a')](_0xc3357c[_0x6379('0x43')][_0x6379('0x4a')]);_0x1971f0['where']=qs[_0x6379('0x4b')](_[_0x6379('0x4c')](_0xc3357c['query'],_0x1df30f[_0x6379('0x4b')]));_0x1971f0[_0x6379('0x4d')]['WhatsappAccountId']=_0x1dbf79['id'];if(_0xc3357c[_0x6379('0x43')]['filter']){_0x1971f0[_0x6379('0x4d')]=_[_0x6379('0x4e')](_0x1971f0[_0x6379('0x4d')],{'$or':_[_0x6379('0x3e')](_0x1971f0[_0x6379('0x46')],function(_0xa53650){var _0x3c56b2={};_0x3c56b2[_0xa53650]={'$like':'%'+_0xc3357c[_0x6379('0x43')][_0x6379('0x6a')]+'%'};return _0x3c56b2;})});}_0x1971f0=_[_0x6379('0x4e')]({},_0x1971f0,_0xc3357c[_0x6379('0x50')]);return db['Disposition'][_0x6379('0x33')]({'where':_0x1971f0[_0x6379('0x4d')]})[_0x6379('0x23')](function(_0x1d47e8){_0x544e4b[_0x6379('0x33')]=_0x1d47e8;if(_0xc3357c[_0x6379('0x43')][_0x6379('0x52')]){_0x1971f0[_0x6379('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1971f0);})[_0x6379('0x23')](function(_0x152c5c){_0x544e4b[_0x6379('0x6b')]=_0x152c5c;return _0x544e4b;});}})[_0x6379('0x23')](respondWithFilteredResult(_0x5483b5,_0x1971f0))[_0x6379('0x2c')](handleError(_0x5483b5,null));};exports[_0x6379('0x6c')]=function(_0x3f821,_0x4a086d,_0x22bec4){return db['WhatsappAccount'][_0x6379('0x58')]({'where':{'id':_0x3f821[_0x6379('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a086d,null))[_0x6379('0x23')](function(_0x2bb96b){if(_0x2bb96b){return _0x2bb96b[_0x6379('0x6c')](_0x3f821[_0x6379('0x43')][_0x6379('0x6d')]);}})[_0x6379('0x23')](respondWithStatusCode(_0x4a086d,null))[_0x6379('0x2c')](handleError(_0x4a086d,null));};exports[_0x6379('0x6e')]=function(_0x1f350e,_0x1eda02,_0x28dc45){if(_0x1f350e[_0x6379('0x62')]['id']){delete _0x1f350e[_0x6379('0x62')]['id'];}return db[_0x6379('0x51')][_0x6379('0x58')]({'where':{'id':_0x1f350e[_0x6379('0x56')]['id']}})['then'](handleEntityNotFound(_0x1eda02,null))[_0x6379('0x23')](function(_0x5ba002){if(_0x5ba002){_0x1f350e[_0x6379('0x62')][_0x6379('0x64')]=_0x5ba002['id'];return db['CannedAnswer']['create'](_0x1f350e[_0x6379('0x62')]);}})[_0x6379('0x23')](respondWithResult(_0x1eda02,null))['catch'](handleError(_0x1eda02,null));};exports['getAnswers']=function(_0x520f7d,_0x149265,_0x549aee){var _0x39d980={'raw':![],'where':{}};var _0x543941={};var _0x4a0fb4={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x6379('0x67')]({'where':{'id':_0x520f7d[_0x6379('0x56')]['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x149265,null))[_0x6379('0x23')](function(_0x694dc5){if(_0x694dc5){_0x543941['model']=_[_0x6379('0x44')](db[_0x6379('0x6f')][_0x6379('0x3f')]);_0x543941[_0x6379('0x43')]=_[_0x6379('0x44')](_0x520f7d[_0x6379('0x43')]);_0x543941['filters']=_['intersection'](_0x543941[_0x6379('0x42')],_0x543941['query']);_0x39d980['attributes']=_[_0x6379('0x45')](_0x543941[_0x6379('0x42')],qs[_0x6379('0x47')](_0x520f7d[_0x6379('0x43')]['fields']));_0x39d980[_0x6379('0x46')]=_0x39d980[_0x6379('0x46')][_0x6379('0x48')]?_0x39d980[_0x6379('0x46')]:_0x543941[_0x6379('0x42')];if(!_0x520f7d['query'][_0x6379('0x49')]('nolimit')){_0x39d980['limit']=qs['limit'](_0x520f7d[_0x6379('0x43')][_0x6379('0x32')]);_0x39d980[_0x6379('0x30')]=qs[_0x6379('0x30')](_0x520f7d[_0x6379('0x43')]['offset']);}_0x39d980[_0x6379('0x69')]=qs[_0x6379('0x4a')](_0x520f7d[_0x6379('0x43')][_0x6379('0x4a')]);_0x39d980[_0x6379('0x4d')]=qs['filters'](_[_0x6379('0x4c')](_0x520f7d[_0x6379('0x43')],_0x543941[_0x6379('0x4b')]));_0x39d980[_0x6379('0x4d')][_0x6379('0x64')]=_0x694dc5['id'];if(_0x520f7d[_0x6379('0x43')][_0x6379('0x6a')]){_0x39d980['where']=_[_0x6379('0x4e')](_0x39d980[_0x6379('0x4d')],{'$or':_['map'](_0x39d980['attributes'],function(_0x1bf6c8){var _0x43c075={};_0x43c075[_0x1bf6c8]={'$like':'%'+_0x520f7d[_0x6379('0x43')][_0x6379('0x6a')]+'%'};return _0x43c075;})});}_0x39d980=_[_0x6379('0x4e')]({},_0x39d980,_0x520f7d[_0x6379('0x50')]);return db[_0x6379('0x6f')][_0x6379('0x33')]({'where':_0x39d980['where']})[_0x6379('0x23')](function(_0x38812a){_0x4a0fb4[_0x6379('0x33')]=_0x38812a;if(_0x520f7d[_0x6379('0x43')][_0x6379('0x52')]){_0x39d980[_0x6379('0x53')]=[{'all':!![]}];}return db[_0x6379('0x6f')]['findAll'](_0x39d980);})['then'](function(_0xb27dc4){_0x4a0fb4[_0x6379('0x6b')]=_0xb27dc4;return _0x4a0fb4;});}})[_0x6379('0x23')](respondWithFilteredResult(_0x149265,_0x39d980))[_0x6379('0x2c')](handleError(_0x149265,null));};exports['removeAnswers']=function(_0x3c9d34,_0x2135fc,_0x201b45){return db[_0x6379('0x51')][_0x6379('0x58')]({'where':{'id':_0x3c9d34['params']['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x2135fc,null))[_0x6379('0x23')](function(_0x592fbf){if(_0x592fbf){return _0x592fbf[_0x6379('0x70')](_0x3c9d34['query']['ids']);}})[_0x6379('0x23')](respondWithStatusCode(_0x2135fc,null))[_0x6379('0x2c')](handleError(_0x2135fc,null));};exports[_0x6379('0x71')]=function(_0x5a627e,_0x10d95a,_0xcd7426){return db[_0x6379('0x51')]['find']({'where':{'id':_0x5a627e[_0x6379('0x56')]['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x10d95a,null))[_0x6379('0x23')](function(_0x36d0b9){if(_0x36d0b9){return _0x36d0b9[_0x6379('0x71')](_0x5a627e[_0x6379('0x62')][_0x6379('0x6d')],_['omit'](_0x5a627e[_0x6379('0x62')],[_0x6379('0x6d'),'id'])||{})[_0x6379('0x72')](function(_0x4dec5c){for(var _0x2c3fd4=0x0;_0x2c3fd4<_0x5a627e['body'][_0x6379('0x6d')]['length'];_0x2c3fd4+=0x1){socket[_0x6379('0x73')](_0x6379('0x74'),{'UserId':Number(_0x5a627e['body'][_0x6379('0x6d')][_0x2c3fd4]),'WhatsappAccountId':Number(_0x5a627e[_0x6379('0x56')]['id'])});}return _0x4dec5c;});}})[_0x6379('0x23')](respondWithResult(_0x10d95a,null))[_0x6379('0x2c')](handleError(_0x10d95a,null));};exports[_0x6379('0x75')]=function(_0x512c63,_0x2d9123,_0xde4bd){return db[_0x6379('0x51')][_0x6379('0x58')]({'where':{'id':_0x512c63['params']['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x2d9123,null))[_0x6379('0x23')](function(_0x4afb2e){if(_0x4afb2e){return _0x4afb2e[_0x6379('0x75')](_0x512c63[_0x6379('0x43')][_0x6379('0x6d')])['then'](function(){if(_[_0x6379('0x76')](_0x512c63['query'][_0x6379('0x6d')])){for(var _0x326b65=0x0;_0x326b65<_0x512c63['query'][_0x6379('0x6d')]['length'];_0x326b65+=0x1){socket[_0x6379('0x73')](_0x6379('0x77'),{'UserId':Number(_0x512c63[_0x6379('0x43')][_0x6379('0x6d')][_0x326b65]),'WhatsappAccountId':Number(_0x512c63[_0x6379('0x56')]['id'])});}}else{socket['emit'](_0x6379('0x77'),{'UserId':Number(_0x512c63[_0x6379('0x43')][_0x6379('0x6d')]),'WhatsappAccountId':Number(_0x512c63[_0x6379('0x56')]['id'])});}});}})[_0x6379('0x23')](respondWithStatusCode(_0x2d9123,null))[_0x6379('0x2c')](handleError(_0x2d9123,null));};exports['getAgents']=function(_0x21248a,_0x42fca1,_0x2a5387){var _0x5542cb={};var _0x573799={};var _0x28775;var _0x55e5ae;return db['WhatsappAccount'][_0x6379('0x67')]({'where':{'id':_0x21248a[_0x6379('0x56')]['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x42fca1,null))[_0x6379('0x23')](function(_0x11201d){if(_0x11201d){_0x28775=_0x11201d;_0x573799[_0x6379('0x42')]=_['keys'](db[_0x6379('0x78')][_0x6379('0x3f')]);_0x573799[_0x6379('0x43')]=_[_0x6379('0x44')](_0x21248a[_0x6379('0x43')]);_0x573799[_0x6379('0x4b')]=_[_0x6379('0x45')](_0x573799[_0x6379('0x42')],_0x573799[_0x6379('0x43')]);_0x5542cb[_0x6379('0x46')]=_[_0x6379('0x45')](_0x573799[_0x6379('0x42')],qs[_0x6379('0x47')](_0x21248a[_0x6379('0x43')][_0x6379('0x47')]));_0x5542cb[_0x6379('0x46')]=_0x5542cb[_0x6379('0x46')][_0x6379('0x48')]?_0x5542cb['attributes']:_0x573799['model'];_0x5542cb['order']=qs[_0x6379('0x4a')](_0x21248a[_0x6379('0x43')][_0x6379('0x4a')]);_0x5542cb['where']=qs[_0x6379('0x4b')](_[_0x6379('0x4c')](_0x21248a['query'],_0x573799[_0x6379('0x4b')]));if(_0x21248a[_0x6379('0x43')][_0x6379('0x6a')]){_0x5542cb[_0x6379('0x4d')]=_['merge'](_0x5542cb[_0x6379('0x4d')],{'$or':_[_0x6379('0x3e')](_0x5542cb['attributes'],function(_0x13a239){var _0x45db66={};_0x45db66[_0x13a239]={'$like':'%'+_0x21248a['query'][_0x6379('0x6a')]+'%'};return _0x45db66;})});}_0x5542cb=_[_0x6379('0x4e')]({},_0x5542cb,_0x21248a[_0x6379('0x50')]);return _0x28775[_0x6379('0x79')](_0x5542cb);}})[_0x6379('0x23')](function(_0x4e3806){if(_0x4e3806){_0x55e5ae=_0x4e3806[_0x6379('0x48')];if(!_0x21248a[_0x6379('0x43')][_0x6379('0x49')](_0x6379('0x68'))){_0x5542cb[_0x6379('0x32')]=qs[_0x6379('0x32')](_0x21248a[_0x6379('0x43')][_0x6379('0x32')]);_0x5542cb[_0x6379('0x30')]=qs[_0x6379('0x30')](_0x21248a['query']['offset']);}return _0x28775[_0x6379('0x79')](_0x5542cb);}})['then'](function(_0x4bf0dd){if(_0x4bf0dd){return _0x4bf0dd?{'count':_0x55e5ae,'rows':_0x4bf0dd}:null;}})[_0x6379('0x23')](respondWithResult(_0x42fca1,null))[_0x6379('0x2c')](handleError(_0x42fca1,null));};exports[_0x6379('0x7a')]=function(_0x3fb39d,_0x5525f2,_0x39a4ff){return db[_0x6379('0x51')]['findOne']({'where':{'id':_0x3fb39d[_0x6379('0x56')]['id']}})[_0x6379('0x23')](handleEntityNotFound(_0x5525f2,null))['then'](function(_0x38f304){if(_0x38f304){return db[_0x6379('0x7b')][_0x6379('0x7c')](function(_0x4dc93a){return db[_0x6379('0x7d')][_0x6379('0x38')]({'where':{'WhatsappAccountId':_0x3fb39d[_0x6379('0x56')]['id']},'transaction':_0x4dc93a})[_0x6379('0x23')](function(_0x4bcf1c){var _0x264e43=_[_0x6379('0x3e')](_0x3fb39d[_0x6379('0x62')],function(_0x28dda3){_0x28dda3[_0x6379('0x64')]=_0x3fb39d[_0x6379('0x56')]['id'];return _0x28dda3;});return db[_0x6379('0x7d')]['bulkCreate'](_0x264e43,{'transaction':_0x4dc93a});});})[_0x6379('0x23')](function(){return db[_0x6379('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3fb39d[_0x6379('0x56')]['id']},'order':_0x6379('0x7e')});});}})[_0x6379('0x23')](respondWithResult(_0x5525f2,null))[_0x6379('0x2c')](handleError(_0x5525f2,null));};exports[_0x6379('0x7f')]=function(_0xa644fc,_0x36062a,_0x5f070c){var _0x1f27f2={};var _0x3b1273={};var _0x3397;var _0x307d11;return db[_0x6379('0x51')][_0x6379('0x67')]({'where':{'id':_0xa644fc['params']['id']}})['then'](handleEntityNotFound(_0x36062a,null))['then'](function(_0x514782){if(_0x514782){_0x3397=_0x514782;_0x3b1273['model']=_[_0x6379('0x44')](db[_0x6379('0x7d')][_0x6379('0x3f')]);_0x3b1273[_0x6379('0x43')]=_['keys'](_0xa644fc['query']);_0x3b1273[_0x6379('0x4b')]=_['intersection'](_0x3b1273['model'],_0x3b1273[_0x6379('0x43')]);_0x1f27f2[_0x6379('0x46')]=_['intersection'](_0x3b1273[_0x6379('0x42')],qs['fields'](_0xa644fc[_0x6379('0x43')][_0x6379('0x47')]));_0x1f27f2[_0x6379('0x46')]=_0x1f27f2[_0x6379('0x46')]['length']?_0x1f27f2[_0x6379('0x46')]:_0x3b1273['model'];_0x1f27f2[_0x6379('0x69')]=qs['sort'](_0xa644fc['query']['sort']);_0x1f27f2[_0x6379('0x4d')]=qs[_0x6379('0x4b')](_[_0x6379('0x4c')](_0xa644fc[_0x6379('0x43')],_0x3b1273['filters']));if(_0xa644fc[_0x6379('0x43')][_0x6379('0x6a')]){_0x1f27f2[_0x6379('0x4d')]=_['merge'](_0x1f27f2[_0x6379('0x4d')],{'$or':_[_0x6379('0x3e')](_0x1f27f2[_0x6379('0x46')],function(_0x236528){var _0x534ea2={};_0x534ea2[_0x236528]={'$like':'%'+_0xa644fc['query'][_0x6379('0x6a')]+'%'};return _0x534ea2;})});}_0x1f27f2=_[_0x6379('0x4e')]({},_0x1f27f2,_0xa644fc[_0x6379('0x50')]);return _0x3397[_0x6379('0x7f')](_0x1f27f2);}})['then'](function(_0x300e34){if(_0x300e34){_0x307d11=_0x300e34[_0x6379('0x48')];if(!_0xa644fc['query'][_0x6379('0x49')](_0x6379('0x68'))){_0x1f27f2[_0x6379('0x32')]=qs['limit'](_0xa644fc['query'][_0x6379('0x32')]);_0x1f27f2[_0x6379('0x30')]=qs[_0x6379('0x30')](_0xa644fc['query'][_0x6379('0x30')]);}return _0x3397[_0x6379('0x7f')](_0x1f27f2);}})[_0x6379('0x23')](function(_0x5d67bf){if(_0x5d67bf){return _0x5d67bf?{'count':_0x307d11,'rows':_0x5d67bf}:null;}})[_0x6379('0x23')](respondWithResult(_0x36062a,null))[_0x6379('0x2c')](handleError(_0x36062a,null));};exports[_0x6379('0x80')]=function(_0x2625ab,_0x29f6f2,_0x5c2625){var _0x3e8105={'channel':'whatsapp'};var _0x22d440=[];var _0x116f6c=[];var _0x2f3e9c={};return db[_0x6379('0x51')][_0x6379('0x58')]({'where':{'id':_0x2625ab[_0x6379('0x56')]['id']},'include':[{'model':db[_0x6379('0x7d')],'as':_0x6379('0x81')}]})[_0x6379('0x23')](handleEntityNotFound(_0x29f6f2,null))[_0x6379('0x23')](function(_0x324e4a){_0x3e8105[_0x6379('0x82')]=_0x324e4a;_0x3e8105['applications']=_[_0x6379('0x83')](_0x324e4a['Applications'],[_0x6379('0x7e')],['asc']);if(_0x3e8105[_0x6379('0x82')][_0x6379('0x81')]){delete _0x3e8105[_0x6379('0x82')][_0x6379('0x81')];}return db[_0x6379('0x84')][_0x6379('0x63')]();})[_0x6379('0x23')](function(_0x1a7485){if(!_0x1a7485){throw new db[(_0x6379('0x85'))][(_0x6379('0x86'))]('no\x20available\x20attributes');}_0x22d440=_[_0x6379('0x87')](_[_0x6379('0x44')](_0x1a7485),[_0x6379('0x88'),_0x6379('0x89')]);_0x116f6c=_[_0x6379('0x87')](_[_0x6379('0x44')](_0x1a7485),['createdAt',_0x6379('0x89'),_0x6379('0x8a'),_0x6379('0x8b')]);_0x3e8105['body']={'mapKey':'mobile'};if(_0x3e8105[_0x6379('0x82')]['type']&&_0x3e8105[_0x6379('0x82')][_0x6379('0x40')]==='twilio'){_0x3e8105[_0x6379('0x62')]['from']=_0x2625ab[_0x6379('0x62')]['From'][_0x6379('0x8c')](_0x6379('0x8d'),'');_0x3e8105[_0x6379('0x62')][_0x6379('0x62')]=_0x2625ab['body']['Body'];_0x3e8105['body'][_0x6379('0x8e')]=_0x2625ab[_0x6379('0x62')]['MessageSid'];}if(_0x3e8105[_0x6379('0x62')]['id']){delete _0x3e8105[_0x6379('0x62')]['id'];}if(_[_0x6379('0x8f')](_0x3e8105['body'][_0x6379('0x90')])){throw new db[(_0x6379('0x85'))][(_0x6379('0x86'))](_0x6379('0x91'));}if(_[_0x6379('0x8f')](_0x3e8105[_0x6379('0x62')][_0x6379('0x62')])||_0x3e8105[_0x6379('0x62')][_0x6379('0x62')]===''){throw new db[(_0x6379('0x85'))][(_0x6379('0x86'))](_0x6379('0x92'));}if(_[_0x6379('0x8f')](_0x3e8105[_0x6379('0x62')][_0x6379('0x93')])){throw new db[(_0x6379('0x85'))][(_0x6379('0x86'))](_0x6379('0x94')+_0x116f6c);}if(!_[_0x6379('0x95')](_0x116f6c,_0x3e8105['body'][_0x6379('0x93')])){throw new db['Sequelize']['ValidationError'](_0x6379('0x96')+_0x116f6c);}_0x2f3e9c[_0x3e8105[_0x6379('0x62')][_0x6379('0x93')]]=_0x3e8105[_0x6379('0x62')][_0x6379('0x90')];return db[_0x6379('0x97')]['find']({'where':{'id':_0x3e8105[_0x6379('0x82')][_0x6379('0x8b')]},'include':[{'model':db[_0x6379('0x84')],'as':_0x6379('0x98'),'where':_0x2f3e9c,'limit':0x1,'order':[[_0x6379('0x89'),_0x6379('0x99')]]}]});})[_0x6379('0x23')](handleEntityNotFound(_0x29f6f2,null))[_0x6379('0x23')](function(_0x145083){if(_0x145083){_0x3e8105[_0x6379('0x9a')]=_['omit'](_0x145083,['Contacts']);if(_0x145083[_0x6379('0x98')][_0x6379('0x48')]){return _0x145083[_0x6379('0x98')][0x0];}var _0x138775=_[_0x6379('0x1b')](_0x3e8105[_0x6379('0x62')],{'firstName':_0x3e8105[_0x6379('0x62')]['from'],'ListId':_0x145083['id']});_0x138775[_0x3e8105[_0x6379('0x62')][_0x6379('0x93')]]=_0x3e8105[_0x6379('0x62')][_0x6379('0x90')];return db[_0x6379('0x84')][_0x6379('0x59')](_0x138775,{'fields':_0x22d440,'raw':!![]});}})[_0x6379('0x23')](handleEntityNotFound(_0x29f6f2,null))[_0x6379('0x23')](function(_0x89965d){if(_0x89965d){_0x3e8105['contact']=_0x89965d;var _0xa581bd={'ContactId':_0x89965d['id'],'phone':_0x3e8105[_0x6379('0x62')]['from'],'WhatsappAccountId':_0x2625ab[_0x6379('0x56')]['id']};var _0xf38a80={'ContactId':_0x89965d['id'],'WhatsappAccountId':_0x2625ab['params']['id'],'closed':![]};return db[_0x6379('0x9b')][_0x6379('0x58')]({'where':_0xf38a80})[_0x6379('0x23')](function(_0x12cad9){if(_0x12cad9){return[_0x12cad9,![]];}return db[_0x6379('0x9b')][_0x6379('0x59')](_0xa581bd)['then'](function(_0x302754){return[_0x302754,!![]];});});}})['spread'](function(_0x18e10b,_0x57db65){_0x3e8105[_0x6379('0x9c')]=_0x18e10b[_0x6379('0x5b')]({'plain':!![]});_0x3e8105[_0x6379('0x9c')][_0x6379('0x9d')]=![];if(_0x57db65){if(_0x3e8105[_0x6379('0x82')]['autoclose']){_0x3e8105[_0x6379('0x9e')][_0x6379('0x9f')]({'id':0x0,'priority':_0x3e8105[_0x6379('0x9e')][_0x6379('0x48')]+0x1,'app':_0x6379('0xa0'),'appdata':_0x6379('0xa1'),'interval':_0x6379('0xa2')});}_0x3e8105[_0x6379('0x9c')]['created']=!![];}return db[_0x6379('0xa3')][_0x6379('0x59')]({'phone':_0x3e8105[_0x6379('0x62')][_0x6379('0x90')],'messageId':_0x3e8105['body'][_0x6379('0x8e')],'body':_0x3e8105['body'][_0x6379('0x62')],'WhatsappAccountId':_0x2625ab[_0x6379('0x56')]['id'],'WhatsappInteractionId':_0x18e10b['id'],'direction':'in','ContactId':_0x18e10b[_0x6379('0xa4')],'AttachmentId':_0x3e8105[_0x6379('0x62')][_0x6379('0xa5')]});})['then'](function(_0x1f77b3){_0x3e8105[_0x6379('0x29')]=_0x1f77b3;if(_0x3e8105['interaction'][_0x6379('0xa6')]){return db[_0x6379('0x78')][_0x6379('0x58')]({'attributes':['id',_0x6379('0x3b')],'where':{'id':_0x3e8105[_0x6379('0x9c')][_0x6379('0xa6')]}})[_0x6379('0x23')](function(_0x50d4be){if(_0x50d4be){_0x3e8105[_0x6379('0x9e')][_0x6379('0xa7')]({'id':0x0,'priority':0x0,'app':_0x6379('0xa8'),'appdata':_0x50d4be[_0x6379('0x3b')]+','+(_0x3e8105[_0x6379('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x6379('0xa2')});}return respondWithRpcPromise(_0x6379('0xa9'),_0x6379('0xaa'),_0x3e8105);});}return respondWithRpcPromise('Start',_0x6379('0xaa'),_0x3e8105);})[_0x6379('0x23')](function(_0x3bf90c){if(_0x3bf90c){var _0x18b946=0xc8;var _0x336535=_0x6379('0xab');logger[_0x6379('0x2a')](_0x6379('0xac'),_0x336535,_0x18b946,_0x6379('0xad'));logger[_0x6379('0x25')](_0x6379('0xae'),_0x336535,_0x18b946,_0x6379('0xad'),JSON[_0x6379('0x26')](_0x3bf90c));if(_0x3e8105[_0x6379('0x82')][_0x6379('0x40')]===_0x6379('0xaf')){return _0x29f6f2[_0x6379('0x34')](_0x18b946)[_0x6379('0x35')]('Content-Type',_0x6379('0xb0'))['send'](_0x6379('0xb1'));}else{return _0x29f6f2[_0x6379('0x34')](_0x18b946)['json'](_0x3bf90c);}}})[_0x6379('0x2c')](handleError(_0x29f6f2,null));};exports[_0x6379('0x3c')]=function(_0x22e364,_0x4817f1,_0x3c043d){var _0x379a15,_0x5799c7,_0x4a9940;if(_[_0x6379('0x8f')](_0x22e364[_0x6379('0x62')]['body'])||_0x22e364[_0x6379('0x62')][_0x6379('0x62')]===''){throw new db[(_0x6379('0x85'))][(_0x6379('0x86'))](_0x6379('0x92'));}if(_['isNil'](_0x22e364['body']['to'])){throw new db[(_0x6379('0x85'))][(_0x6379('0x86'))](_0x6379('0xb2'));}_0x379a15=_0x22e364[_0x6379('0x62')]['to'];return db[_0x6379('0x51')][_0x6379('0x58')]({'where':{'id':_0x22e364[_0x6379('0x56')]['id']},'include':[{'model':db[_0x6379('0x97')],'as':_0x6379('0xb3'),'include':[{'model':db[_0x6379('0x84')],'as':'Contacts','where':{'mobile':_0x379a15},'limit':0x1,'order':[[_0x6379('0x89'),'DESC']]}]}]})[_0x6379('0x23')](handleEntityNotFound(_0x4817f1,null))['then'](function(_0x5d086f){if(_0x5d086f&&_0x5d086f[_0x6379('0xb3')]){_0x5799c7=_0x5d086f[_0x6379('0x5b')]({'plain':!![]});if(_0x5799c7['List']&&_0x5799c7[_0x6379('0xb3')]['Contacts'][_0x6379('0x48')]){return _0x5799c7[_0x6379('0xb3')][_0x6379('0x98')][0x0];}return db[_0x6379('0x84')][_0x6379('0x59')](_[_0x6379('0x1b')](_0x22e364[_0x6379('0x62')],{'firstName':_0x379a15,'mobile':_0x379a15,'phone':_0x379a15,'ListId':_0x5799c7[_0x6379('0x8b')]}));}})['then'](handleEntityNotFound(_0x4817f1,null))['then'](function(_0x3c17e6){if(_0x3c17e6){_0x4a9940=_0x3c17e6;return db[_0x6379('0x9b')][_0x6379('0x58')]({'where':{'ContactId':_0x4a9940['id'],'closed':![],'WhatsappAccountId':_0x5799c7['id']}})['then'](function(_0xe7583c){if(_0xe7583c){return[_0xe7583c,![]];}return db[_0x6379('0x9b')]['create']({'UserId':_0x22e364['user']['id'],'ContactId':_0x4a9940['id'],'WhatsappAccountId':_0x5799c7['id'],'phone':_0x379a15,'firstMsgDirection':_0x6379('0xb4'),'Messages':[_[_0x6379('0x4e')](_0x22e364[_0x6379('0x62')],{'read':![],'body':_0x22e364[_0x6379('0x62')][_0x6379('0x62')],'phone':_0x379a15,'WhatsappAccountId':_0x5799c7['id'],'UserId':_0x22e364['user']['id'],'ContactId':_0x4a9940['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x6379('0xb5')}]})['then'](function(_0x3d0e44){return[_0x3d0e44,!![]];});});}})[_0x6379('0x72')](function(_0x28df69,_0x3e9639){if(_0x3e9639){return _0x28df69;}return db[_0x6379('0xa3')][_0x6379('0x59')](_[_0x6379('0x4e')](_0x22e364[_0x6379('0x62')],{'read':![],'body':_0x22e364['body'][_0x6379('0x62')],'phone':_0x379a15,'WhatsappAccountId':_0x5799c7['id'],'WhatsappInteractionId':_0x28df69['id'],'UserId':_0x22e364[_0x6379('0x5a')]['id'],'ContactId':_0x4a9940['id']}))[_0x6379('0x23')](function(_0x3dd7aa){_0x28df69[_0x6379('0xb6')][_0x6379('0xb5')]=[];_0x28df69[_0x6379('0xb6')][_0x6379('0xb5')]['push'](_0x3dd7aa[_0x6379('0xb6')]);return _0x28df69;});})[_0x6379('0x23')](respondWithResult(_0x4817f1,null))[_0x6379('0x2c')](handleError(_0x4817f1,null));}; \ No newline at end of file +var _0x4cbf=['path','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','map','WhatsappAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','count','includeAll','rows','show','params','mandatoryDispositionPause','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','WhatsappMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','List','DESC','Messages','dataValues','push','eml-format','rimraf','request-promise','moment','bluebird','util'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0x4cbf,0xb6));var _0xf4cb=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4cbf[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0xf4cb('0x0'));var rimraf=require(_0xf4cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf4cb('0x2'));var moment=require(_0xf4cb('0x3'));var BPromise=require(_0xf4cb('0x4'));var Mustache=require('mustache');var util=require(_0xf4cb('0x5'));var path=require(_0xf4cb('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4cb('0x7'));var _=require(_0xf4cb('0x8'));var squel=require(_0xf4cb('0x9'));var crypto=require(_0xf4cb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf4cb('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf4cb('0xc'));var Papa=require('papaparse');var Redis=require(_0xf4cb('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf4cb('0xe'));var as=require(_0xf4cb('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4cb('0x10'))('api');var utils=require(_0xf4cb('0x11'));var config=require(_0xf4cb('0x12'));var licenseUtil=require(_0xf4cb('0x13'));var db=require(_0xf4cb('0x14'))['db'];config['redis']=_[_0xf4cb('0x15')](config[_0xf4cb('0x16')],{'host':_0xf4cb('0x17'),'port':0x18eb});var socket=require(_0xf4cb('0x18'))(new Redis(config[_0xf4cb('0x16')]));require(_0xf4cb('0x19'))[_0xf4cb('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf4cb('0x1b')][_0xf4cb('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x4e3eb6,_0x33b3da,_0x3bfe4f,_0x3cb598){return new BPromise(function(_0xd5357c,_0x26d723){var _0x5805c2=_0x3cb598||client;return _0x5805c2[_0xf4cb('0x1d')](_0x4e3eb6,_0x3bfe4f)[_0xf4cb('0x1e')](function(_0x249b90){logger[_0xf4cb('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x33b3da,_0xf4cb('0x20'));logger[_0xf4cb('0x21')](_0xf4cb('0x22'),_0x33b3da,'request\x20sent',JSON['stringify'](_0x249b90));if(_0x249b90[_0xf4cb('0x23')]){if(_0x249b90[_0xf4cb('0x23')][_0xf4cb('0x24')]===0x1f4){logger[_0xf4cb('0x23')](_0xf4cb('0x25'),_0x33b3da,_0x249b90['error'][_0xf4cb('0x26')]);return _0x26d723(_0x249b90[_0xf4cb('0x23')][_0xf4cb('0x26')]);}logger[_0xf4cb('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x33b3da,_0x249b90['error'][_0xf4cb('0x26')]);return _0xd5357c(_0x249b90[_0xf4cb('0x23')][_0xf4cb('0x26')]);}else{logger[_0xf4cb('0x1f')](_0xf4cb('0x25'),_0x33b3da,_0xf4cb('0x20'));_0xd5357c(_0x249b90[_0xf4cb('0x27')][_0xf4cb('0x26')]);}})[_0xf4cb('0x28')](function(_0xf55328){logger[_0xf4cb('0x23')](_0xf4cb('0x25'),_0x33b3da,_0xf55328);_0x26d723(_0xf55328);});});}function respondWithStatusCode(_0x3d1122,_0x3e06cb){_0x3e06cb=_0x3e06cb||0xcc;return function(_0xfab133){if(_0xfab133){return _0x3d1122[_0xf4cb('0x29')](_0x3e06cb);}return _0x3d1122[_0xf4cb('0x2a')](_0x3e06cb)[_0xf4cb('0x2b')]();};}function respondWithResult(_0x141c78,_0x3e7cfe){_0x3e7cfe=_0x3e7cfe||0xc8;return function(_0x387f1b){if(_0x387f1b){return _0x141c78[_0xf4cb('0x2a')](_0x3e7cfe)[_0xf4cb('0x2c')](_0x387f1b);}};}function respondWithFilteredResult(_0x5a8c54,_0x226198){return function(_0xcd12c5){if(_0xcd12c5){var _0x52bf8a=typeof _0x226198[_0xf4cb('0x2d')]===_0xf4cb('0x2e')&&typeof _0x226198[_0xf4cb('0x2f')]==='undefined';var _0x37a46f=_0xcd12c5['count'];var _0x58db77=_0x52bf8a?0x0:_0x226198[_0xf4cb('0x2d')];var _0x3a1527=_0x52bf8a?_0xcd12c5['count']:_0x226198[_0xf4cb('0x2d')]+_0x226198['limit'];var _0x1f5998;if(_0x3a1527>=_0x37a46f){_0x3a1527=_0x37a46f;_0x1f5998=0xc8;}else{_0x1f5998=0xce;}_0x5a8c54[_0xf4cb('0x2a')](_0x1f5998);return _0x5a8c54[_0xf4cb('0x30')](_0xf4cb('0x31'),_0x58db77+'-'+_0x3a1527+'/'+_0x37a46f)[_0xf4cb('0x2c')](_0xcd12c5);}return null;};}function patchUpdates(_0x4396aa){return function(_0xc69081){try{jsonpatch[_0xf4cb('0x32')](_0xc69081,_0x4396aa,!![]);}catch(_0x28a9e3){return BPromise['reject'](_0x28a9e3);}return _0xc69081[_0xf4cb('0x33')]();};}function saveUpdates(_0x579df5,_0x20edf9){return function(_0x2f1c87){if(_0x2f1c87){return _0x2f1c87[_0xf4cb('0x34')](_0x579df5)[_0xf4cb('0x1e')](function(_0x264205){return _0x264205;});}return null;};}function removeEntity(_0xf5735d,_0x305f9d){return function(_0x3dcd90){if(_0x3dcd90){return _0x3dcd90[_0xf4cb('0x35')]()[_0xf4cb('0x1e')](function(){var _0x2fdcec=_0x3dcd90['get']({'plain':!![]});var _0x3442ed=_0xf4cb('0x36');return db[_0xf4cb('0x37')][_0xf4cb('0x35')]({'where':{'type':_0x3442ed,'resourceId':_0x2fdcec['id']}})[_0xf4cb('0x1e')](function(){return _0x3dcd90;});})['then'](function(){_0xf5735d[_0xf4cb('0x2a')](0xcc)[_0xf4cb('0x2b')]();});}};}function handleEntityNotFound(_0x545450,_0x20b4ac){return function(_0x3239b8){if(!_0x3239b8){_0x545450['sendStatus'](0x194);}return _0x3239b8;};}function handleError(_0x21a1d9,_0x3ea492){_0x3ea492=_0x3ea492||0x1f4;return function(_0x15902e){logger[_0xf4cb('0x23')](_0x15902e[_0xf4cb('0x38')]);if(_0x15902e['name']){delete _0x15902e[_0xf4cb('0x39')];}_0x21a1d9[_0xf4cb('0x2a')](_0x3ea492)['send'](_0x15902e);};}exports[_0xf4cb('0x3a')]=function(_0x4085cf,_0x16ff1c){var _0x1a6647={'include':[{'model':db[_0xf4cb('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4883d9={},_0x5768fa={'count':0x0,'rows':[]};var _0x4e7b21=_[_0xf4cb('0x3c')](db[_0xf4cb('0x3d')]['rawAttributes'],function(_0x27b4de){return{'name':_0x27b4de[_0xf4cb('0x3e')],'type':_0x27b4de['type']['key']};});_0x4883d9[_0xf4cb('0x3f')]=_['map'](_0x4e7b21,'name');_0x4883d9[_0xf4cb('0x40')]=_[_0xf4cb('0x41')](_0x4085cf['query']);_0x4883d9[_0xf4cb('0x42')]=_[_0xf4cb('0x43')](_0x4883d9['model'],_0x4883d9[_0xf4cb('0x40')]);_0x1a6647[_0xf4cb('0x44')]=_['intersection'](_0x4883d9[_0xf4cb('0x3f')],qs[_0xf4cb('0x45')](_0x4085cf[_0xf4cb('0x40')]['fields']));_0x1a6647['attributes']=_0x1a6647[_0xf4cb('0x44')][_0xf4cb('0x46')]?_0x1a6647[_0xf4cb('0x44')]:_0x4883d9[_0xf4cb('0x3f')];if(!_0x4085cf[_0xf4cb('0x40')][_0xf4cb('0x47')](_0xf4cb('0x48'))){_0x1a6647[_0xf4cb('0x2f')]=qs[_0xf4cb('0x2f')](_0x4085cf[_0xf4cb('0x40')][_0xf4cb('0x2f')]);_0x1a6647[_0xf4cb('0x2d')]=qs['offset'](_0x4085cf[_0xf4cb('0x40')][_0xf4cb('0x2d')]);}_0x1a6647['order']=qs[_0xf4cb('0x49')](_0x4085cf[_0xf4cb('0x40')]['sort']);_0x1a6647['where']=qs['filters'](_['pick'](_0x4085cf[_0xf4cb('0x40')],_0x4883d9[_0xf4cb('0x42')]),_0x4e7b21);if(_0x4085cf[_0xf4cb('0x40')][_0xf4cb('0x4a')]){_0x1a6647[_0xf4cb('0x4b')]=_[_0xf4cb('0x4c')](_0x1a6647['where'],{'$or':_[_0xf4cb('0x3c')](_0x4e7b21,function(_0x3931c7){if(_0x3931c7[_0xf4cb('0x4d')]!==_0xf4cb('0x4e')){var _0x577b04={};_0x577b04[_0x3931c7[_0xf4cb('0x39')]]={'$like':'%'+_0x4085cf['query'][_0xf4cb('0x4a')]+'%'};return _0x577b04;}})});}_0x1a6647=_[_0xf4cb('0x4c')]({},_0x1a6647,_0x4085cf[_0xf4cb('0x4f')]);var _0x51d59b={'where':_0x1a6647[_0xf4cb('0x4b')]};return db['WhatsappAccount']['count'](_0x51d59b)[_0xf4cb('0x1e')](function(_0x46ec6c){_0x5768fa[_0xf4cb('0x50')]=_0x46ec6c;if(_0x4085cf[_0xf4cb('0x40')][_0xf4cb('0x51')]){_0x1a6647['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x1a6647);})[_0xf4cb('0x1e')](function(_0x1a9f64){_0x5768fa[_0xf4cb('0x52')]=_0x1a9f64;return _0x5768fa;})[_0xf4cb('0x1e')](respondWithFilteredResult(_0x16ff1c,_0x1a6647))['catch'](handleError(_0x16ff1c,null));};exports[_0xf4cb('0x53')]=function(_0x2fced7,_0x2cacbe){var _0x370bcb={'raw':![],'where':{'id':_0x2fced7[_0xf4cb('0x54')]['id']},'include':[{'model':db[_0xf4cb('0x3b')],'as':_0xf4cb('0x55')}]},_0x45bcc3={};_0x45bcc3[_0xf4cb('0x3f')]=_[_0xf4cb('0x41')](db[_0xf4cb('0x3d')][_0xf4cb('0x56')]);_0x45bcc3[_0xf4cb('0x40')]=_[_0xf4cb('0x41')](_0x2fced7['query']);_0x45bcc3[_0xf4cb('0x42')]=_[_0xf4cb('0x43')](_0x45bcc3[_0xf4cb('0x3f')],_0x45bcc3[_0xf4cb('0x40')]);_0x370bcb['attributes']=_[_0xf4cb('0x43')](_0x45bcc3[_0xf4cb('0x3f')],qs[_0xf4cb('0x45')](_0x2fced7[_0xf4cb('0x40')][_0xf4cb('0x45')]));_0x370bcb['attributes']=_0x370bcb[_0xf4cb('0x44')]['length']?_0x370bcb[_0xf4cb('0x44')]:_0x45bcc3[_0xf4cb('0x3f')];if(_0x2fced7['query'][_0xf4cb('0x51')]){_0x370bcb[_0xf4cb('0x57')]=[{'all':!![]}];}_0x370bcb=_['merge']({},_0x370bcb,_0x2fced7[_0xf4cb('0x4f')]);return db[_0xf4cb('0x3d')][_0xf4cb('0x58')](_0x370bcb)['then'](handleEntityNotFound(_0x2cacbe,null))[_0xf4cb('0x1e')](respondWithResult(_0x2cacbe,null))[_0xf4cb('0x28')](handleError(_0x2cacbe,null));};exports[_0xf4cb('0x59')]=function(_0x154c8b,_0x325f43){return db[_0xf4cb('0x3d')][_0xf4cb('0x59')](_0x154c8b[_0xf4cb('0x5a')],{})[_0xf4cb('0x1e')](function(_0x3aebc9){var _0x3db265=_0x154c8b[_0xf4cb('0x5b')][_0xf4cb('0x5c')]({'plain':!![]});if(!_0x3db265)throw new Error(_0xf4cb('0x5d'));if(_0x3db265['role']===_0xf4cb('0x5b')){var _0x465703=_0x3aebc9[_0xf4cb('0x5c')]({'plain':!![]});var _0x2e1659=_0xf4cb('0x36');return db[_0xf4cb('0x5e')][_0xf4cb('0x58')]({'where':{'name':_0x2e1659,'userProfileId':_0x3db265[_0xf4cb('0x5f')]},'raw':!![]})[_0xf4cb('0x1e')](function(_0x619877){if(_0x619877&&_0x619877[_0xf4cb('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x465703['name'],'resourceId':_0x465703['id'],'type':_0x619877[_0xf4cb('0x39')],'sectionId':_0x619877['id']},{})[_0xf4cb('0x1e')](function(){return _0x3aebc9;});}else{return _0x3aebc9;}})[_0xf4cb('0x28')](function(_0x26124a){logger[_0xf4cb('0x23')](_0xf4cb('0x61'),_0x26124a);throw _0x26124a;});}return _0x3aebc9;})[_0xf4cb('0x1e')](respondWithResult(_0x325f43,0xc9))[_0xf4cb('0x28')](handleError(_0x325f43,null));};exports[_0xf4cb('0x34')]=function(_0x154474,_0x3298ca){if(_0x154474[_0xf4cb('0x5a')]['id']){delete _0x154474['body']['id'];}return db[_0xf4cb('0x3d')][_0xf4cb('0x58')]({'where':{'id':_0x154474['params']['id']},'include':[{'model':db[_0xf4cb('0x3b')],'as':_0xf4cb('0x55')}]})[_0xf4cb('0x1e')](handleEntityNotFound(_0x3298ca,null))[_0xf4cb('0x1e')](saveUpdates(_0x154474['body'],null))[_0xf4cb('0x1e')](respondWithResult(_0x3298ca,null))[_0xf4cb('0x28')](handleError(_0x3298ca,null));};exports[_0xf4cb('0x35')]=function(_0x209fc6,_0x4d2a18){return db[_0xf4cb('0x3d')]['find']({'where':{'id':_0x209fc6[_0xf4cb('0x54')]['id']}})['then'](handleEntityNotFound(_0x4d2a18,null))['then'](removeEntity(_0x4d2a18,null))[_0xf4cb('0x28')](handleError(_0x4d2a18,null));};exports[_0xf4cb('0x62')]=function(_0x30fac1,_0x31593f){return db[_0xf4cb('0x3d')][_0xf4cb('0x62')]()[_0xf4cb('0x1e')](respondWithResult(_0x31593f,null))[_0xf4cb('0x28')](handleError(_0x31593f,null));};exports[_0xf4cb('0x63')]=function(_0x34870a,_0x238ec1,_0x1685c7){if(_0x34870a[_0xf4cb('0x5a')]['id']){delete _0x34870a[_0xf4cb('0x5a')]['id'];}return db[_0xf4cb('0x3d')][_0xf4cb('0x58')]({'where':{'id':_0x34870a['params']['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x238ec1,null))[_0xf4cb('0x1e')](function(_0x31d0ab){if(_0x31d0ab){_0x34870a[_0xf4cb('0x5a')][_0xf4cb('0x64')]=_0x31d0ab['id'];return db[_0xf4cb('0x65')][_0xf4cb('0x59')](_0x34870a[_0xf4cb('0x5a')]);}})[_0xf4cb('0x1e')](respondWithResult(_0x238ec1,null))[_0xf4cb('0x28')](handleError(_0x238ec1,null));};exports[_0xf4cb('0x66')]=function(_0x5c5fb1,_0x299888,_0xb60cd8){var _0x1e3d8a={'raw':![],'where':{}};var _0x2aad62={};var _0x396135={'count':0x0,'rows':[]};return db[_0xf4cb('0x3d')][_0xf4cb('0x67')]({'where':{'id':_0x5c5fb1[_0xf4cb('0x54')]['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x299888,null))[_0xf4cb('0x1e')](function(_0x1152cc){if(_0x1152cc){_0x2aad62[_0xf4cb('0x3f')]=_[_0xf4cb('0x41')](db[_0xf4cb('0x65')][_0xf4cb('0x56')]);_0x2aad62[_0xf4cb('0x40')]=_[_0xf4cb('0x41')](_0x5c5fb1[_0xf4cb('0x40')]);_0x2aad62[_0xf4cb('0x42')]=_[_0xf4cb('0x43')](_0x2aad62[_0xf4cb('0x3f')],_0x2aad62[_0xf4cb('0x40')]);_0x1e3d8a['attributes']=_[_0xf4cb('0x43')](_0x2aad62[_0xf4cb('0x3f')],qs[_0xf4cb('0x45')](_0x5c5fb1[_0xf4cb('0x40')][_0xf4cb('0x45')]));_0x1e3d8a[_0xf4cb('0x44')]=_0x1e3d8a['attributes'][_0xf4cb('0x46')]?_0x1e3d8a[_0xf4cb('0x44')]:_0x2aad62[_0xf4cb('0x3f')];if(!_0x5c5fb1[_0xf4cb('0x40')][_0xf4cb('0x47')](_0xf4cb('0x48'))){_0x1e3d8a['limit']=qs[_0xf4cb('0x2f')](_0x5c5fb1[_0xf4cb('0x40')][_0xf4cb('0x2f')]);_0x1e3d8a[_0xf4cb('0x2d')]=qs[_0xf4cb('0x2d')](_0x5c5fb1[_0xf4cb('0x40')][_0xf4cb('0x2d')]);}_0x1e3d8a[_0xf4cb('0x68')]=qs['sort'](_0x5c5fb1['query']['sort']);_0x1e3d8a['where']=qs[_0xf4cb('0x42')](_[_0xf4cb('0x69')](_0x5c5fb1[_0xf4cb('0x40')],_0x2aad62['filters']));_0x1e3d8a[_0xf4cb('0x4b')][_0xf4cb('0x64')]=_0x1152cc['id'];if(_0x5c5fb1['query'][_0xf4cb('0x4a')]){_0x1e3d8a[_0xf4cb('0x4b')]=_[_0xf4cb('0x4c')](_0x1e3d8a[_0xf4cb('0x4b')],{'$or':_[_0xf4cb('0x3c')](_0x1e3d8a[_0xf4cb('0x44')],function(_0x25d38b){var _0x472901={};_0x472901[_0x25d38b]={'$like':'%'+_0x5c5fb1[_0xf4cb('0x40')][_0xf4cb('0x4a')]+'%'};return _0x472901;})});}_0x1e3d8a=_[_0xf4cb('0x4c')]({},_0x1e3d8a,_0x5c5fb1[_0xf4cb('0x4f')]);return db['Disposition'][_0xf4cb('0x50')]({'where':_0x1e3d8a['where']})[_0xf4cb('0x1e')](function(_0x3193f9){_0x396135[_0xf4cb('0x50')]=_0x3193f9;if(_0x5c5fb1['query']['includeAll']){_0x1e3d8a[_0xf4cb('0x57')]=[{'all':!![]}];}return db[_0xf4cb('0x65')][_0xf4cb('0x6a')](_0x1e3d8a);})[_0xf4cb('0x1e')](function(_0x123122){_0x396135[_0xf4cb('0x52')]=_0x123122;return _0x396135;});}})[_0xf4cb('0x1e')](respondWithFilteredResult(_0x299888,_0x1e3d8a))[_0xf4cb('0x28')](handleError(_0x299888,null));};exports[_0xf4cb('0x6b')]=function(_0x895ee,_0x142cc5,_0x25dc09){return db[_0xf4cb('0x3d')]['find']({'where':{'id':_0x895ee['params']['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x142cc5,null))['then'](function(_0x2c9483){if(_0x2c9483){return _0x2c9483[_0xf4cb('0x6b')](_0x895ee[_0xf4cb('0x40')][_0xf4cb('0x6c')]);}})[_0xf4cb('0x1e')](respondWithStatusCode(_0x142cc5,null))['catch'](handleError(_0x142cc5,null));};exports[_0xf4cb('0x6d')]=function(_0x2bca00,_0x45c1b2,_0x167f54){if(_0x2bca00[_0xf4cb('0x5a')]['id']){delete _0x2bca00[_0xf4cb('0x5a')]['id'];}return db[_0xf4cb('0x3d')][_0xf4cb('0x58')]({'where':{'id':_0x2bca00[_0xf4cb('0x54')]['id']}})['then'](handleEntityNotFound(_0x45c1b2,null))[_0xf4cb('0x1e')](function(_0x21538a){if(_0x21538a){_0x2bca00[_0xf4cb('0x5a')][_0xf4cb('0x64')]=_0x21538a['id'];return db['CannedAnswer']['create'](_0x2bca00[_0xf4cb('0x5a')]);}})[_0xf4cb('0x1e')](respondWithResult(_0x45c1b2,null))['catch'](handleError(_0x45c1b2,null));};exports['getAnswers']=function(_0x388340,_0x523e67,_0x317839){var _0x28f9fd={'raw':![],'where':{}};var _0x4202ec={};var _0x3d0f48={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xf4cb('0x67')]({'where':{'id':_0x388340[_0xf4cb('0x54')]['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x523e67,null))[_0xf4cb('0x1e')](function(_0x22c3b9){if(_0x22c3b9){_0x4202ec[_0xf4cb('0x3f')]=_[_0xf4cb('0x41')](db[_0xf4cb('0x6e')][_0xf4cb('0x56')]);_0x4202ec['query']=_[_0xf4cb('0x41')](_0x388340[_0xf4cb('0x40')]);_0x4202ec[_0xf4cb('0x42')]=_[_0xf4cb('0x43')](_0x4202ec[_0xf4cb('0x3f')],_0x4202ec[_0xf4cb('0x40')]);_0x28f9fd[_0xf4cb('0x44')]=_[_0xf4cb('0x43')](_0x4202ec[_0xf4cb('0x3f')],qs[_0xf4cb('0x45')](_0x388340[_0xf4cb('0x40')][_0xf4cb('0x45')]));_0x28f9fd[_0xf4cb('0x44')]=_0x28f9fd[_0xf4cb('0x44')]['length']?_0x28f9fd[_0xf4cb('0x44')]:_0x4202ec['model'];if(!_0x388340['query'][_0xf4cb('0x47')]('nolimit')){_0x28f9fd[_0xf4cb('0x2f')]=qs[_0xf4cb('0x2f')](_0x388340[_0xf4cb('0x40')][_0xf4cb('0x2f')]);_0x28f9fd[_0xf4cb('0x2d')]=qs[_0xf4cb('0x2d')](_0x388340['query'][_0xf4cb('0x2d')]);}_0x28f9fd[_0xf4cb('0x68')]=qs[_0xf4cb('0x49')](_0x388340[_0xf4cb('0x40')][_0xf4cb('0x49')]);_0x28f9fd[_0xf4cb('0x4b')]=qs[_0xf4cb('0x42')](_['pick'](_0x388340['query'],_0x4202ec[_0xf4cb('0x42')]));_0x28f9fd[_0xf4cb('0x4b')]['WhatsappAccountId']=_0x22c3b9['id'];if(_0x388340[_0xf4cb('0x40')]['filter']){_0x28f9fd['where']=_[_0xf4cb('0x4c')](_0x28f9fd[_0xf4cb('0x4b')],{'$or':_[_0xf4cb('0x3c')](_0x28f9fd[_0xf4cb('0x44')],function(_0x45b8de){var _0x1442de={};_0x1442de[_0x45b8de]={'$like':'%'+_0x388340[_0xf4cb('0x40')][_0xf4cb('0x4a')]+'%'};return _0x1442de;})});}_0x28f9fd=_['merge']({},_0x28f9fd,_0x388340[_0xf4cb('0x4f')]);return db['CannedAnswer']['count']({'where':_0x28f9fd['where']})[_0xf4cb('0x1e')](function(_0x341300){_0x3d0f48[_0xf4cb('0x50')]=_0x341300;if(_0x388340[_0xf4cb('0x40')][_0xf4cb('0x51')]){_0x28f9fd['include']=[{'all':!![]}];}return db[_0xf4cb('0x6e')][_0xf4cb('0x6a')](_0x28f9fd);})[_0xf4cb('0x1e')](function(_0x4a59cd){_0x3d0f48[_0xf4cb('0x52')]=_0x4a59cd;return _0x3d0f48;});}})[_0xf4cb('0x1e')](respondWithFilteredResult(_0x523e67,_0x28f9fd))[_0xf4cb('0x28')](handleError(_0x523e67,null));};exports[_0xf4cb('0x6f')]=function(_0x76023c,_0x717111,_0x322e2f){return db[_0xf4cb('0x3d')][_0xf4cb('0x58')]({'where':{'id':_0x76023c[_0xf4cb('0x54')]['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x717111,null))['then'](function(_0x260cf7){if(_0x260cf7){return _0x260cf7[_0xf4cb('0x6f')](_0x76023c['query'][_0xf4cb('0x6c')]);}})['then'](respondWithStatusCode(_0x717111,null))[_0xf4cb('0x28')](handleError(_0x717111,null));};exports['addAgents']=function(_0x175377,_0xbe52d0,_0x9c2626){return db[_0xf4cb('0x3d')][_0xf4cb('0x58')]({'where':{'id':_0x175377[_0xf4cb('0x54')]['id']}})['then'](handleEntityNotFound(_0xbe52d0,null))[_0xf4cb('0x1e')](function(_0x562cb0){if(_0x562cb0){return _0x562cb0[_0xf4cb('0x70')](_0x175377[_0xf4cb('0x5a')][_0xf4cb('0x6c')],_['omit'](_0x175377[_0xf4cb('0x5a')],[_0xf4cb('0x6c'),'id'])||{})[_0xf4cb('0x71')](function(_0x1847d5){for(var _0x1d059a=0x0;_0x1d059a<_0x175377[_0xf4cb('0x5a')]['ids'][_0xf4cb('0x46')];_0x1d059a+=0x1){socket[_0xf4cb('0x72')](_0xf4cb('0x73'),{'UserId':Number(_0x175377[_0xf4cb('0x5a')][_0xf4cb('0x6c')][_0x1d059a]),'WhatsappAccountId':Number(_0x175377[_0xf4cb('0x54')]['id'])});}return _0x1847d5;});}})['then'](respondWithResult(_0xbe52d0,null))['catch'](handleError(_0xbe52d0,null));};exports[_0xf4cb('0x74')]=function(_0x1b2e97,_0x3b8d37,_0x1face6){return db['WhatsappAccount'][_0xf4cb('0x58')]({'where':{'id':_0x1b2e97['params']['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x3b8d37,null))['then'](function(_0x1fed5c){if(_0x1fed5c){return _0x1fed5c[_0xf4cb('0x74')](_0x1b2e97[_0xf4cb('0x40')][_0xf4cb('0x6c')])[_0xf4cb('0x1e')](function(){if(_[_0xf4cb('0x75')](_0x1b2e97[_0xf4cb('0x40')][_0xf4cb('0x6c')])){for(var _0x1c1bd1=0x0;_0x1c1bd1<_0x1b2e97[_0xf4cb('0x40')][_0xf4cb('0x6c')][_0xf4cb('0x46')];_0x1c1bd1+=0x1){socket[_0xf4cb('0x72')](_0xf4cb('0x76'),{'UserId':Number(_0x1b2e97[_0xf4cb('0x40')][_0xf4cb('0x6c')][_0x1c1bd1]),'WhatsappAccountId':Number(_0x1b2e97[_0xf4cb('0x54')]['id'])});}}else{socket[_0xf4cb('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x1b2e97['query'][_0xf4cb('0x6c')]),'WhatsappAccountId':Number(_0x1b2e97[_0xf4cb('0x54')]['id'])});}});}})[_0xf4cb('0x1e')](respondWithStatusCode(_0x3b8d37,null))[_0xf4cb('0x28')](handleError(_0x3b8d37,null));};exports[_0xf4cb('0x77')]=function(_0x84b662,_0x1be624,_0x2d568c){var _0x321f93={};var _0x6e4761={};var _0xcff004;var _0x378779;return db[_0xf4cb('0x3d')][_0xf4cb('0x67')]({'where':{'id':_0x84b662['params']['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x1be624,null))[_0xf4cb('0x1e')](function(_0x12b0e0){if(_0x12b0e0){_0xcff004=_0x12b0e0;_0x6e4761[_0xf4cb('0x3f')]=_['keys'](db[_0xf4cb('0x78')]['rawAttributes']);_0x6e4761['query']=_['keys'](_0x84b662[_0xf4cb('0x40')]);_0x6e4761[_0xf4cb('0x42')]=_['intersection'](_0x6e4761[_0xf4cb('0x3f')],_0x6e4761[_0xf4cb('0x40')]);_0x321f93[_0xf4cb('0x44')]=_[_0xf4cb('0x43')](_0x6e4761['model'],qs[_0xf4cb('0x45')](_0x84b662[_0xf4cb('0x40')][_0xf4cb('0x45')]));_0x321f93[_0xf4cb('0x44')]=_0x321f93[_0xf4cb('0x44')]['length']?_0x321f93[_0xf4cb('0x44')]:_0x6e4761[_0xf4cb('0x3f')];_0x321f93[_0xf4cb('0x68')]=qs['sort'](_0x84b662[_0xf4cb('0x40')][_0xf4cb('0x49')]);_0x321f93[_0xf4cb('0x4b')]=qs[_0xf4cb('0x42')](_[_0xf4cb('0x69')](_0x84b662[_0xf4cb('0x40')],_0x6e4761['filters']));if(_0x84b662[_0xf4cb('0x40')][_0xf4cb('0x4a')]){_0x321f93[_0xf4cb('0x4b')]=_[_0xf4cb('0x4c')](_0x321f93['where'],{'$or':_['map'](_0x321f93['attributes'],function(_0x11eb55){var _0x9f2489={};_0x9f2489[_0x11eb55]={'$like':'%'+_0x84b662[_0xf4cb('0x40')][_0xf4cb('0x4a')]+'%'};return _0x9f2489;})});}_0x321f93=_[_0xf4cb('0x4c')]({},_0x321f93,_0x84b662[_0xf4cb('0x4f')]);return _0xcff004[_0xf4cb('0x77')](_0x321f93);}})[_0xf4cb('0x1e')](function(_0x4f1ef2){if(_0x4f1ef2){_0x378779=_0x4f1ef2[_0xf4cb('0x46')];if(!_0x84b662['query'][_0xf4cb('0x47')]('nolimit')){_0x321f93['limit']=qs[_0xf4cb('0x2f')](_0x84b662['query'][_0xf4cb('0x2f')]);_0x321f93[_0xf4cb('0x2d')]=qs['offset'](_0x84b662['query'][_0xf4cb('0x2d')]);}return _0xcff004[_0xf4cb('0x77')](_0x321f93);}})['then'](function(_0x1638c1){if(_0x1638c1){return _0x1638c1?{'count':_0x378779,'rows':_0x1638c1}:null;}})[_0xf4cb('0x1e')](respondWithResult(_0x1be624,null))[_0xf4cb('0x28')](handleError(_0x1be624,null));};exports['addApplications']=function(_0x4fcd16,_0x1d82e5,_0x2c3081){return db[_0xf4cb('0x3d')][_0xf4cb('0x67')]({'where':{'id':_0x4fcd16[_0xf4cb('0x54')]['id']}})[_0xf4cb('0x1e')](handleEntityNotFound(_0x1d82e5,null))[_0xf4cb('0x1e')](function(_0x333287){if(_0x333287){return db[_0xf4cb('0x79')][_0xf4cb('0x7a')](function(_0x2dc3ce){return db[_0xf4cb('0x7b')][_0xf4cb('0x35')]({'where':{'WhatsappAccountId':_0x4fcd16[_0xf4cb('0x54')]['id']},'transaction':_0x2dc3ce})[_0xf4cb('0x1e')](function(_0x482249){var _0x5087ba=_[_0xf4cb('0x3c')](_0x4fcd16['body'],function(_0x3e05e9){_0x3e05e9[_0xf4cb('0x64')]=_0x4fcd16[_0xf4cb('0x54')]['id'];return _0x3e05e9;});return db['WhatsappApplication'][_0xf4cb('0x7c')](_0x5087ba,{'transaction':_0x2dc3ce});});})[_0xf4cb('0x1e')](function(){return db[_0xf4cb('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x4fcd16['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x1d82e5,null))['catch'](handleError(_0x1d82e5,null));};exports[_0xf4cb('0x7d')]=function(_0x407d9c,_0x4b5535,_0x5228ea){var _0x25d8ed={};var _0x3192a3={};var _0x3f7c7a;var _0x3a9880;return db[_0xf4cb('0x3d')][_0xf4cb('0x67')]({'where':{'id':_0x407d9c[_0xf4cb('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b5535,null))['then'](function(_0x35c7e1){if(_0x35c7e1){_0x3f7c7a=_0x35c7e1;_0x3192a3[_0xf4cb('0x3f')]=_['keys'](db[_0xf4cb('0x7b')][_0xf4cb('0x56')]);_0x3192a3[_0xf4cb('0x40')]=_[_0xf4cb('0x41')](_0x407d9c['query']);_0x3192a3[_0xf4cb('0x42')]=_['intersection'](_0x3192a3[_0xf4cb('0x3f')],_0x3192a3[_0xf4cb('0x40')]);_0x25d8ed['attributes']=_['intersection'](_0x3192a3[_0xf4cb('0x3f')],qs[_0xf4cb('0x45')](_0x407d9c[_0xf4cb('0x40')][_0xf4cb('0x45')]));_0x25d8ed[_0xf4cb('0x44')]=_0x25d8ed[_0xf4cb('0x44')][_0xf4cb('0x46')]?_0x25d8ed[_0xf4cb('0x44')]:_0x3192a3['model'];_0x25d8ed[_0xf4cb('0x68')]=qs[_0xf4cb('0x49')](_0x407d9c['query'][_0xf4cb('0x49')]);_0x25d8ed['where']=qs[_0xf4cb('0x42')](_[_0xf4cb('0x69')](_0x407d9c[_0xf4cb('0x40')],_0x3192a3['filters']));if(_0x407d9c[_0xf4cb('0x40')]['filter']){_0x25d8ed[_0xf4cb('0x4b')]=_[_0xf4cb('0x4c')](_0x25d8ed[_0xf4cb('0x4b')],{'$or':_['map'](_0x25d8ed['attributes'],function(_0x5e999a){var _0x3fc7bc={};_0x3fc7bc[_0x5e999a]={'$like':'%'+_0x407d9c[_0xf4cb('0x40')][_0xf4cb('0x4a')]+'%'};return _0x3fc7bc;})});}_0x25d8ed=_['merge']({},_0x25d8ed,_0x407d9c[_0xf4cb('0x4f')]);return _0x3f7c7a[_0xf4cb('0x7d')](_0x25d8ed);}})[_0xf4cb('0x1e')](function(_0x3c4ecb){if(_0x3c4ecb){_0x3a9880=_0x3c4ecb[_0xf4cb('0x46')];if(!_0x407d9c[_0xf4cb('0x40')][_0xf4cb('0x47')](_0xf4cb('0x48'))){_0x25d8ed[_0xf4cb('0x2f')]=qs[_0xf4cb('0x2f')](_0x407d9c[_0xf4cb('0x40')][_0xf4cb('0x2f')]);_0x25d8ed[_0xf4cb('0x2d')]=qs[_0xf4cb('0x2d')](_0x407d9c[_0xf4cb('0x40')][_0xf4cb('0x2d')]);}return _0x3f7c7a[_0xf4cb('0x7d')](_0x25d8ed);}})['then'](function(_0x1e99cb){if(_0x1e99cb){return _0x1e99cb?{'count':_0x3a9880,'rows':_0x1e99cb}:null;}})['then'](respondWithResult(_0x4b5535,null))[_0xf4cb('0x28')](handleError(_0x4b5535,null));};exports[_0xf4cb('0x7e')]=function(_0x1ba375,_0x1b24b6,_0x1af5f1){var _0x778073={'channel':_0xf4cb('0x7f')};var _0x386b15=[];var _0x1ae5c0=[];var _0x410e32={};return db[_0xf4cb('0x3d')][_0xf4cb('0x58')]({'where':{'id':_0x1ba375['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xf4cb('0x1e')](handleEntityNotFound(_0x1b24b6,null))[_0xf4cb('0x1e')](function(_0x37d53d){_0x778073[_0xf4cb('0x80')]=_0x37d53d;_0x778073[_0xf4cb('0x81')]=_[_0xf4cb('0x82')](_0x37d53d[_0xf4cb('0x83')],[_0xf4cb('0x84')],[_0xf4cb('0x85')]);if(_0x778073[_0xf4cb('0x80')][_0xf4cb('0x83')]){delete _0x778073[_0xf4cb('0x80')]['Applications'];}return db[_0xf4cb('0x86')][_0xf4cb('0x62')]();})[_0xf4cb('0x1e')](function(_0x2a5dde){if(!_0x2a5dde){throw new db[(_0xf4cb('0x87'))]['ValidationError'](_0xf4cb('0x88'));}_0x386b15=_[_0xf4cb('0x89')](_[_0xf4cb('0x41')](_0x2a5dde),['createdAt',_0xf4cb('0x8a')]);_0x1ae5c0=_['difference'](_[_0xf4cb('0x41')](_0x2a5dde),['createdAt',_0xf4cb('0x8a'),_0xf4cb('0x8b'),_0xf4cb('0x8c')]);_0x778073[_0xf4cb('0x5a')]={'mapKey':_0xf4cb('0x8d')};if(_0x778073[_0xf4cb('0x80')][_0xf4cb('0x4d')]&&_0x778073[_0xf4cb('0x80')][_0xf4cb('0x4d')]==='twilio'){_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x8e')]=_0x1ba375[_0xf4cb('0x5a')][_0xf4cb('0x8f')][_0xf4cb('0x90')](_0xf4cb('0x91'),'');_0x778073[_0xf4cb('0x5a')]['body']=_0x1ba375[_0xf4cb('0x5a')][_0xf4cb('0x92')];_0x778073['body'][_0xf4cb('0x93')]=_0x1ba375[_0xf4cb('0x5a')][_0xf4cb('0x94')];}if(_0x778073[_0xf4cb('0x5a')]['id']){delete _0x778073[_0xf4cb('0x5a')]['id'];}if(_['isNil'](_0x778073['body'][_0xf4cb('0x8e')])){throw new db[(_0xf4cb('0x87'))][(_0xf4cb('0x95'))](_0xf4cb('0x96'));}if(_['isNil'](_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x5a')])||_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x5a')]===''){throw new db['Sequelize'][(_0xf4cb('0x95'))](_0xf4cb('0x97'));}if(_[_0xf4cb('0x98')](_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x99')])){throw new db[(_0xf4cb('0x87'))][(_0xf4cb('0x95'))](_0xf4cb('0x9a')+_0x1ae5c0);}if(!_['includes'](_0x1ae5c0,_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x99')])){throw new db[(_0xf4cb('0x87'))][(_0xf4cb('0x95'))](_0xf4cb('0x9b')+_0x1ae5c0);}_0x410e32[_0x778073['body'][_0xf4cb('0x99')]]=_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x8e')];return db[_0xf4cb('0x9c')][_0xf4cb('0x58')]({'where':{'id':_0x778073[_0xf4cb('0x80')][_0xf4cb('0x8c')]},'include':[{'model':db[_0xf4cb('0x86')],'as':_0xf4cb('0x9d'),'where':_0x410e32,'limit':0x1,'order':[[_0xf4cb('0x8a'),'DESC']]}]});})[_0xf4cb('0x1e')](handleEntityNotFound(_0x1b24b6,null))[_0xf4cb('0x1e')](function(_0x3091c3){if(_0x3091c3){_0x778073['list']=_['omit'](_0x3091c3,[_0xf4cb('0x9d')]);if(_0x3091c3[_0xf4cb('0x9d')][_0xf4cb('0x46')]){return _0x3091c3[_0xf4cb('0x9d')][0x0];}var _0x52ba40=_[_0xf4cb('0x15')](_0x778073[_0xf4cb('0x5a')],{'firstName':_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x8e')],'ListId':_0x3091c3['id']});_0x52ba40[_0x778073[_0xf4cb('0x5a')]['mapKey']]=_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x8e')];return db[_0xf4cb('0x86')][_0xf4cb('0x59')](_0x52ba40,{'fields':_0x386b15,'raw':!![]});}})['then'](handleEntityNotFound(_0x1b24b6,null))['then'](function(_0x25f001){if(_0x25f001){_0x778073[_0xf4cb('0x9e')]=_0x25f001;var _0x661dfe={'ContactId':_0x25f001['id'],'phone':_0x778073[_0xf4cb('0x5a')]['from'],'WhatsappAccountId':_0x1ba375[_0xf4cb('0x54')]['id']};var _0x36e47a={'ContactId':_0x25f001['id'],'WhatsappAccountId':_0x1ba375[_0xf4cb('0x54')]['id'],'closed':![]};return db[_0xf4cb('0x9f')][_0xf4cb('0x58')]({'where':_0x36e47a})[_0xf4cb('0x1e')](function(_0x34a91e){if(_0x34a91e){return[_0x34a91e,![]];}return db[_0xf4cb('0x9f')][_0xf4cb('0x59')](_0x661dfe)[_0xf4cb('0x1e')](function(_0x20249d){return[_0x20249d,!![]];});});}})[_0xf4cb('0x71')](function(_0x4fbc14,_0x5b02d2){_0x778073['interaction']=_0x4fbc14['get']({'plain':!![]});_0x778073[_0xf4cb('0xa0')][_0xf4cb('0xa1')]=![];if(_0x5b02d2){if(_0x778073[_0xf4cb('0x80')][_0xf4cb('0xa2')]){_0x778073['applications']['push']({'id':0x0,'priority':_0x778073[_0xf4cb('0x81')][_0xf4cb('0x46')]+0x1,'app':_0xf4cb('0xa3'),'appdata':_0xf4cb('0xa4'),'interval':_0xf4cb('0xa5')});}_0x778073[_0xf4cb('0xa0')][_0xf4cb('0xa1')]=!![];}return db[_0xf4cb('0xa6')][_0xf4cb('0x59')]({'phone':_0x778073[_0xf4cb('0x5a')]['from'],'messageId':_0x778073[_0xf4cb('0x5a')]['messageId'],'body':_0x778073[_0xf4cb('0x5a')][_0xf4cb('0x5a')],'WhatsappAccountId':_0x1ba375[_0xf4cb('0x54')]['id'],'WhatsappInteractionId':_0x4fbc14['id'],'direction':'in','ContactId':_0x4fbc14['ContactId'],'AttachmentId':_0x778073[_0xf4cb('0x5a')][_0xf4cb('0xa7')]});})[_0xf4cb('0x1e')](function(_0x158fb0){_0x778073[_0xf4cb('0x26')]=_0x158fb0;if(_0x778073[_0xf4cb('0xa0')][_0xf4cb('0xa8')]){return db[_0xf4cb('0x78')][_0xf4cb('0x58')]({'attributes':['id','name'],'where':{'id':_0x778073[_0xf4cb('0xa0')][_0xf4cb('0xa8')]}})[_0xf4cb('0x1e')](function(_0x20e1bc){if(_0x20e1bc){_0x778073['applications'][_0xf4cb('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x20e1bc['name']+','+(_0x778073[_0xf4cb('0x80')][_0xf4cb('0xaa')]||0xa),'interval':_0xf4cb('0xa5')});}return respondWithRpcPromise('Start',_0xf4cb('0xab'),_0x778073);});}return respondWithRpcPromise(_0xf4cb('0xac'),'startRouting',_0x778073);})['then'](function(_0x114d30){if(_0x114d30){var _0x31d6d9=0xc8;var _0x10994f=_0xf4cb('0xad');logger['info'](_0xf4cb('0x22'),_0x10994f,_0x31d6d9,_0xf4cb('0xae'));logger[_0xf4cb('0x21')](_0xf4cb('0xaf'),_0x10994f,_0x31d6d9,_0xf4cb('0xae'),JSON[_0xf4cb('0xb0')](_0x114d30));if(_0x778073[_0xf4cb('0x80')][_0xf4cb('0x4d')]===_0xf4cb('0xb1')){return _0x1b24b6[_0xf4cb('0x2a')](_0x31d6d9)['set'](_0xf4cb('0xb2'),_0xf4cb('0xb3'))[_0xf4cb('0xb4')](_0xf4cb('0xb5'));}else{return _0x1b24b6['status'](_0x31d6d9)['json'](_0x114d30);}}})['catch'](handleError(_0x1b24b6,null));};exports[_0xf4cb('0xb4')]=function(_0x1c7806,_0xb4d596,_0x3e2508){var _0x5ee419,_0xb171b6,_0x24d97a;if(_[_0xf4cb('0x98')](_0x1c7806[_0xf4cb('0x5a')][_0xf4cb('0x5a')])||_0x1c7806[_0xf4cb('0x5a')][_0xf4cb('0x5a')]===''){throw new db['Sequelize'][(_0xf4cb('0x95'))](_0xf4cb('0x97'));}if(_[_0xf4cb('0x98')](_0x1c7806[_0xf4cb('0x5a')]['to'])){throw new db[(_0xf4cb('0x87'))][(_0xf4cb('0x95'))](_0xf4cb('0xb6'));}_0x5ee419=_0x1c7806['body']['to'];return db[_0xf4cb('0x3d')][_0xf4cb('0x58')]({'where':{'id':_0x1c7806['params']['id']},'include':[{'model':db[_0xf4cb('0x9c')],'as':_0xf4cb('0xb7'),'include':[{'model':db[_0xf4cb('0x86')],'as':_0xf4cb('0x9d'),'where':{'mobile':_0x5ee419},'limit':0x1,'order':[[_0xf4cb('0x8a'),_0xf4cb('0xb8')]]}]}]})['then'](handleEntityNotFound(_0xb4d596,null))[_0xf4cb('0x1e')](function(_0x43b274){if(_0x43b274&&_0x43b274[_0xf4cb('0xb7')]){_0xb171b6=_0x43b274[_0xf4cb('0x5c')]({'plain':!![]});if(_0xb171b6[_0xf4cb('0xb7')]&&_0xb171b6[_0xf4cb('0xb7')][_0xf4cb('0x9d')][_0xf4cb('0x46')]){return _0xb171b6[_0xf4cb('0xb7')][_0xf4cb('0x9d')][0x0];}return db['CmContact'][_0xf4cb('0x59')](_['defaults'](_0x1c7806[_0xf4cb('0x5a')],{'firstName':_0x5ee419,'mobile':_0x5ee419,'phone':_0x5ee419,'ListId':_0xb171b6['ListId']}));}})['then'](handleEntityNotFound(_0xb4d596,null))[_0xf4cb('0x1e')](function(_0x300087){if(_0x300087){_0x24d97a=_0x300087;return db[_0xf4cb('0x9f')][_0xf4cb('0x58')]({'where':{'ContactId':_0x24d97a['id'],'closed':![],'WhatsappAccountId':_0xb171b6['id']}})['then'](function(_0x46bf30){if(_0x46bf30){return[_0x46bf30,![]];}return db[_0xf4cb('0x9f')]['create']({'UserId':_0x1c7806[_0xf4cb('0x5b')]['id'],'ContactId':_0x24d97a['id'],'WhatsappAccountId':_0xb171b6['id'],'phone':_0x5ee419,'firstMsgDirection':'out','Messages':[_[_0xf4cb('0x4c')](_0x1c7806[_0xf4cb('0x5a')],{'read':![],'body':_0x1c7806['body'][_0xf4cb('0x5a')],'phone':_0x5ee419,'WhatsappAccountId':_0xb171b6['id'],'UserId':_0x1c7806[_0xf4cb('0x5b')]['id'],'ContactId':_0x24d97a['id']})]},{'include':[{'model':db[_0xf4cb('0xa6')],'as':_0xf4cb('0xb9')}]})[_0xf4cb('0x1e')](function(_0x49b6e9){return[_0x49b6e9,!![]];});});}})[_0xf4cb('0x71')](function(_0x1fa5d5,_0x3c6eaa){if(_0x3c6eaa){return _0x1fa5d5;}return db[_0xf4cb('0xa6')][_0xf4cb('0x59')](_[_0xf4cb('0x4c')](_0x1c7806[_0xf4cb('0x5a')],{'read':![],'body':_0x1c7806[_0xf4cb('0x5a')]['body'],'phone':_0x5ee419,'WhatsappAccountId':_0xb171b6['id'],'WhatsappInteractionId':_0x1fa5d5['id'],'UserId':_0x1c7806['user']['id'],'ContactId':_0x24d97a['id']}))[_0xf4cb('0x1e')](function(_0x5be823){_0x1fa5d5['dataValues'][_0xf4cb('0xb9')]=[];_0x1fa5d5[_0xf4cb('0xba')][_0xf4cb('0xb9')][_0xf4cb('0xbb')](_0x5be823[_0xf4cb('0xba')]);return _0x1fa5d5;});})['then'](respondWithResult(_0xb4d596,null))[_0xf4cb('0x28')](handleError(_0xb4d596,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index bdffc8e..6cb9491 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 _0x851d=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x851d,0x1f2));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd851('0x0'));var WhatsappAccount=require(_0xd851('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd851('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd851('0x3'),'afterDestroy':_0xd851('0x4')};function emitEvent(_0x288503){return function(_0x194bee,_0x493fb3,_0x2fbf23){WhatsappAccountEvents['emit'](_0x288503+':'+_0x194bee['id'],_0x194bee);WhatsappAccountEvents[_0xd851('0x5')](_0x288503,_0x194bee);_0x2fbf23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xd851('0x6')](e,emitEvent(event));}}module[_0xd851('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x8ab7=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount'];(function(_0xa7e190,_0x4760e8){var _0x171af6=function(_0x4073ed){while(--_0x4073ed){_0xa7e190['push'](_0xa7e190['shift']());}};_0x171af6(++_0x4760e8);}(_0x8ab7,0x76));var _0x78ab=function(_0x31b658,_0x549eb0){_0x31b658=_0x31b658-0x0;var _0x2a4eee=_0x8ab7[_0x31b658];return _0x2a4eee;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x78ab('0x0'))['db'][_0x78ab('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x78ab('0x2'),'afterUpdate':'update','afterDestroy':_0x78ab('0x3')};function emitEvent(_0x81f802){return function(_0x1cad8a,_0xc110b4,_0x55ff80){WhatsappAccountEvents[_0x78ab('0x4')](_0x81f802+':'+_0x1cad8a['id'],_0x1cad8a);WhatsappAccountEvents['emit'](_0x81f802,_0x1cad8a);_0x55ff80(null);};}for(var e in events){if(events[_0x78ab('0x5')](e)){var event=events[e];WhatsappAccount[_0x78ab('0x6')](e,emitEvent(event));}}module[_0x78ab('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 08f6643..aff1dbc 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 _0xa7bf=['api','moment','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa7bf,0xa3));var _0xfa7b=function(_0x33cfb4,_0x20e6e5){_0x33cfb4=_0x33cfb4-0x0;var _0x492910=_0xa7bf[_0x33cfb4];return _0x492910;};'use strict';var _=require(_0xfa7b('0x0'));var util=require('util');var logger=require(_0xfa7b('0x1'))(_0xfa7b('0x2'));var moment=require(_0xfa7b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa7b('0x4'));var rimraf=require('rimraf');var config=require(_0xfa7b('0x5'));var attributes=require(_0xfa7b('0x6'));module[_0xfa7b('0x7')]=function(_0x5565bf,_0x2f86a7){return _0x5565bf[_0xfa7b('0x8')](_0xfa7b('0x9'),attributes,{'tableName':_0xfa7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2412=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2412,0x1a3));var _0x2241=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2412[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2241('0x0'));var util=require(_0x2241('0x1'));var logger=require(_0x2241('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2241('0x3'));var rp=require(_0x2241('0x4'));var fs=require('fs');var path=require(_0x2241('0x5'));var rimraf=require('rimraf');var config=require(_0x2241('0x6'));var attributes=require(_0x2241('0x7'));module[_0x2241('0x8')]=function(_0x2aad7b,_0x11be57){return _0x2aad7b[_0x2241('0x9')](_0x2241('0xa'),attributes,{'tableName':_0x2241('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 09598b9..67ec7bb 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 _0xf2a5=['find','options','raw','attributes','include','model','map','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount'];(function(_0x336dda,_0x1c6eec){var _0x19bf6b=function(_0x1e5363){while(--_0x1e5363){_0x336dda['push'](_0x336dda['shift']());}};_0x19bf6b(++_0x1c6eec);}(_0xf2a5,0x6a));var _0x5f2a=function(_0x14d8d7,_0x23c2c8){_0x14d8d7=_0x14d8d7-0x0;var _0x9fafe9=_0xf2a5[_0x14d8d7];return _0x9fafe9;};'use strict';var _=require(_0x5f2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5f2a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f2a('0x2'));var db=require(_0x5f2a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f2a('0x4'))(_0x5f2a('0x5'));var config=require(_0x5f2a('0x6'));var jayson=require(_0x5f2a('0x7'));var client=jayson[_0x5f2a('0x8')][_0x5f2a('0x9')]({'port':0x232a});config[_0x5f2a('0xa')]=_['defaults'](config['redis'],{'host':_0x5f2a('0xb'),'port':0x18eb});var socket=require(_0x5f2a('0xc'))(new Redis(config[_0x5f2a('0xa')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4b32c0,_0x5fabd5,_0xdf718a){return new BPromise(function(_0x3b1f99,_0x3670c9){return client[_0x5f2a('0xd')](_0x4b32c0,_0xdf718a)[_0x5f2a('0xe')](function(_0x3bf71d){logger['info'](_0x5f2a('0xf'),_0x5fabd5,'request\x20sent');logger[_0x5f2a('0x10')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5fabd5,_0x5f2a('0x11'),JSON[_0x5f2a('0x12')](_0x3bf71d));if(_0x3bf71d['error']){if(_0x3bf71d['error']['code']===0x1f4){logger['error'](_0x5f2a('0xf'),_0x5fabd5,_0x3bf71d[_0x5f2a('0x13')][_0x5f2a('0x14')]);return _0x3670c9(_0x3bf71d[_0x5f2a('0x13')][_0x5f2a('0x14')]);}logger['error'](_0x5f2a('0xf'),_0x5fabd5,_0x3bf71d[_0x5f2a('0x13')][_0x5f2a('0x14')]);return _0x3b1f99(_0x3bf71d[_0x5f2a('0x13')][_0x5f2a('0x14')]);}else{logger[_0x5f2a('0x15')](_0x5f2a('0xf'),_0x5fabd5,_0x5f2a('0x11'));_0x3b1f99(_0x3bf71d[_0x5f2a('0x16')]['message']);}})[_0x5f2a('0x17')](function(_0x178ccb){logger[_0x5f2a('0x13')](_0x5f2a('0xf'),_0x5fabd5,_0x178ccb);_0x3670c9(_0x178ccb);});});}exports[_0x5f2a('0x18')]=function(_0x5c5a56){var _0x3aeb5f=this;return new Promise(function(_0x2dc9c6,_0x595756){return db[_0x5f2a('0x19')][_0x5f2a('0x1a')]({'raw':_0x5c5a56[_0x5f2a('0x1b')]?_0x5c5a56[_0x5f2a('0x1b')][_0x5f2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c5a56[_0x5f2a('0x1b')]?_0x5c5a56['options']['where']||null:null,'attributes':_0x5c5a56[_0x5f2a('0x1b')]?_0x5c5a56[_0x5f2a('0x1b')][_0x5f2a('0x1d')]||null:null,'include':_0x5c5a56[_0x5f2a('0x1b')]?_0x5c5a56['options']['include']?_['map'](_0x5c5a56[_0x5f2a('0x1b')][_0x5f2a('0x1e')],function(_0x4f570d){return{'model':db[_0x4f570d[_0x5f2a('0x1f')]],'as':_0x4f570d['as'],'attributes':_0x4f570d['attributes'],'include':_0x4f570d[_0x5f2a('0x1e')]?_[_0x5f2a('0x20')](_0x4f570d['include'],function(_0x505126){return{'model':db[_0x505126['model']],'as':_0x505126['as'],'attributes':_0x505126[_0x5f2a('0x1d')],'include':_0x505126[_0x5f2a('0x1e')]?_[_0x5f2a('0x20')](_0x505126[_0x5f2a('0x1e')],function(_0x405bc7){return{'model':db[_0x405bc7[_0x5f2a('0x1f')]],'as':_0x405bc7['as'],'attributes':_0x405bc7[_0x5f2a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1982ec){logger[_0x5f2a('0x15')]('ShowWhatsappAccount',_0x5c5a56);logger[_0x5f2a('0x10')]('ShowWhatsappAccount',_0x5c5a56,JSON[_0x5f2a('0x12')](_0x1982ec));_0x2dc9c6(_0x1982ec);})[_0x5f2a('0x17')](function(_0x29ada8){logger['error'](_0x5f2a('0x18'),_0x29ada8[_0x5f2a('0x14')],_0x5c5a56);_0x595756(_0x3aeb5f[_0x5f2a('0x13')](0x1f4,_0x29ada8[_0x5f2a('0x14')]));});});}; \ No newline at end of file +var _0x228d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','./whatsappAccount.socket','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x228d,0x87));var _0xd228=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x228d[_0x1a37e3];return _0x4db78a;};'use strict';var _=require(_0xd228('0x0'));var util=require(_0xd228('0x1'));var moment=require(_0xd228('0x2'));var BPromise=require(_0xd228('0x3'));var rs=require(_0xd228('0x4'));var fs=require('fs');var Redis=require(_0xd228('0x5'));var db=require(_0xd228('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd228('0x7'))(_0xd228('0x8'));var config=require('../../config/environment');var jayson=require(_0xd228('0x9'));var client=jayson['client'][_0xd228('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd228('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd228('0xc'))(new Redis(config['redis']));require(_0xd228('0xd'))['register'](socket);function respondWithRpcPromise(_0x5625ae,_0x57a7fe,_0xb14295){return new BPromise(function(_0x3602b2,_0x34612a){return client['request'](_0x5625ae,_0xb14295)['then'](function(_0x256d87){logger[_0xd228('0xe')](_0xd228('0xf'),_0x57a7fe,_0xd228('0x10'));logger[_0xd228('0x11')](_0xd228('0x12'),_0x57a7fe,_0xd228('0x10'),JSON[_0xd228('0x13')](_0x256d87));if(_0x256d87[_0xd228('0x14')]){if(_0x256d87[_0xd228('0x14')][_0xd228('0x15')]===0x1f4){logger[_0xd228('0x14')](_0xd228('0xf'),_0x57a7fe,_0x256d87[_0xd228('0x14')][_0xd228('0x16')]);return _0x34612a(_0x256d87[_0xd228('0x14')][_0xd228('0x16')]);}logger['error'](_0xd228('0xf'),_0x57a7fe,_0x256d87[_0xd228('0x14')][_0xd228('0x16')]);return _0x3602b2(_0x256d87[_0xd228('0x14')][_0xd228('0x16')]);}else{logger[_0xd228('0xe')](_0xd228('0xf'),_0x57a7fe,_0xd228('0x10'));_0x3602b2(_0x256d87[_0xd228('0x17')]['message']);}})[_0xd228('0x18')](function(_0xd46a4c){logger['error'](_0xd228('0xf'),_0x57a7fe,_0xd46a4c);_0x34612a(_0xd46a4c);});});}exports[_0xd228('0x19')]=function(_0x196026){var _0x47e910=this;return new Promise(function(_0x46181e,_0x1ed766){return db['WhatsappAccount'][_0xd228('0x1a')]({'raw':_0x196026['options']?_0x196026[_0xd228('0x1b')][_0xd228('0x1c')]===undefined?!![]:![]:!![],'where':_0x196026[_0xd228('0x1b')]?_0x196026[_0xd228('0x1b')][_0xd228('0x1d')]||null:null,'attributes':_0x196026[_0xd228('0x1b')]?_0x196026[_0xd228('0x1b')][_0xd228('0x1e')]||null:null,'include':_0x196026['options']?_0x196026[_0xd228('0x1b')][_0xd228('0x1f')]?_[_0xd228('0x20')](_0x196026[_0xd228('0x1b')]['include'],function(_0x52754f){return{'model':db[_0x52754f['model']],'as':_0x52754f['as'],'attributes':_0x52754f[_0xd228('0x1e')],'include':_0x52754f['include']?_['map'](_0x52754f['include'],function(_0x4da2ef){return{'model':db[_0x4da2ef[_0xd228('0x21')]],'as':_0x4da2ef['as'],'attributes':_0x4da2ef[_0xd228('0x1e')],'include':_0x4da2ef[_0xd228('0x1f')]?_[_0xd228('0x20')](_0x4da2ef[_0xd228('0x1f')],function(_0x62a558){return{'model':db[_0x62a558[_0xd228('0x21')]],'as':_0x62a558['as'],'attributes':_0x62a558[_0xd228('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11cbae){logger[_0xd228('0xe')](_0xd228('0x19'),_0x196026);logger[_0xd228('0x11')](_0xd228('0x19'),_0x196026,JSON[_0xd228('0x13')](_0x11cbae));_0x46181e(_0x11cbae);})[_0xd228('0x18')](function(_0x117388){logger[_0xd228('0x14')](_0xd228('0x19'),_0x117388['message'],_0x196026);_0x1ed766(_0x47e910[_0xd228('0x14')](0x1f4,_0x117388[_0xd228('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 15aca58..092c00a 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 _0xe0fa=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener','register'];(function(_0x1326e3,_0x1c6728){var _0x33d5bb=function(_0x15c64a){while(--_0x15c64a){_0x1326e3['push'](_0x1326e3['shift']());}};_0x33d5bb(++_0x1c6728);}(_0xe0fa,0xc2));var _0xae0f=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xe0fa[_0x2e8418];return _0x548fe6;};'use strict';var WhatsappAccountEvents=require(_0xae0f('0x0'));var events=[_0xae0f('0x1'),_0xae0f('0x2'),_0xae0f('0x3')];function createListener(_0x3e0c30,_0x3daacb){return function(_0x277429){_0x3daacb['emit'](_0x3e0c30,_0x277429);};}function removeListener(_0x1980bc,_0x3bcc3c){return function(){WhatsappAccountEvents[_0xae0f('0x4')](_0x1980bc,_0x3bcc3c);};}exports[_0xae0f('0x5')]=function(_0x55cce4){for(var _0x924a71=0x0,_0x54b5f3=events[_0xae0f('0x6')];_0x924a71<_0x54b5f3;_0x924a71++){var _0x567a67=events[_0x924a71];var _0x51c53f=createListener(_0xae0f('0x7')+_0x567a67,_0x55cce4);WhatsappAccountEvents['on'](_0x567a67,_0x51c53f);}}; \ No newline at end of file +var _0xa095=['remove','emit','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x296ca5,_0x207490){var _0x377f87=function(_0x430630){while(--_0x430630){_0x296ca5['push'](_0x296ca5['shift']());}};_0x377f87(++_0x207490);}(_0xa095,0xf3));var _0x5a09=function(_0x26a10d,_0xe5c001){_0x26a10d=_0x26a10d-0x0;var _0xf90201=_0xa095[_0x26a10d];return _0xf90201;};'use strict';var WhatsappAccountEvents=require(_0x5a09('0x0'));var events=[_0x5a09('0x1'),_0x5a09('0x2'),'update'];function createListener(_0x43c9ad,_0x89200e){return function(_0x14e579){_0x89200e[_0x5a09('0x3')](_0x43c9ad,_0x14e579);};}function removeListener(_0x3946e9,_0xdd0bef){return function(){WhatsappAccountEvents['removeListener'](_0x3946e9,_0xdd0bef);};}exports[_0x5a09('0x4')]=function(_0x37e9e8){for(var _0x9a7cb3=0x0,_0x5dcfaa=events[_0x5a09('0x5')];_0x9a7cb3<_0x5dcfaa;_0x9a7cb3++){var _0x12bcba=events[_0x9a7cb3];var _0x501883=createListener(_0x5a09('0x6')+_0x12bcba,_0x37e9e8);WhatsappAccountEvents['on'](_0x12bcba,_0x501883);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 9d0b32f..03792a3 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 _0xfb58=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0xfb58,0x171));var _0x8fb5=function(_0x4d6b8d,_0x57989f){_0x4d6b8d=_0x4d6b8d-0x0;var _0x12c748=_0xfb58[_0x4d6b8d];return _0x12c748;};'use strict';var multer=require(_0x8fb5('0x0'));var util=require(_0x8fb5('0x1'));var path=require(_0x8fb5('0x2'));var timeout=require('connect-timeout');var express=require(_0x8fb5('0x3'));var router=express[_0x8fb5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8fb5('0x5'));var interaction=require(_0x8fb5('0x6'));var config=require(_0x8fb5('0x7'));var controller=require(_0x8fb5('0x8'));router[_0x8fb5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x8fb5('0xa')](),controller['show']);router['post']('/',auth[_0x8fb5('0xa')](),controller[_0x8fb5('0xb')]);router['put'](_0x8fb5('0xc'),auth['isAuthenticated'](),controller[_0x8fb5('0xd')]);router[_0x8fb5('0xe')](_0x8fb5('0xc'),auth[_0x8fb5('0xa')](),controller[_0x8fb5('0xf')]);module[_0x8fb5('0x10')]=router; \ No newline at end of file +var _0xa232=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','post','put','isAuthenticated','update','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xd836a9,_0x2658bf){var _0x1f9d4d=function(_0xeada1e){while(--_0xeada1e){_0xd836a9['push'](_0xd836a9['shift']());}};_0x1f9d4d(++_0x2658bf);}(_0xa232,0xdb));var _0x2a23=function(_0x4da5d1,_0x128317){_0x4da5d1=_0x4da5d1-0x0;var _0xc613a1=_0xa232[_0x4da5d1];return _0xc613a1;};'use strict';var multer=require(_0x2a23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a23('0x1'));var express=require(_0x2a23('0x2'));var router=express['Router']();var fs_extra=require(_0x2a23('0x3'));var auth=require(_0x2a23('0x4'));var interaction=require(_0x2a23('0x5'));var config=require(_0x2a23('0x6'));var controller=require(_0x2a23('0x7'));router[_0x2a23('0x8')]('/',auth['isAuthenticated'](),controller[_0x2a23('0x9')]);router[_0x2a23('0x8')](_0x2a23('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2a23('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2a23('0xc')](_0x2a23('0xa'),auth[_0x2a23('0xd')](),controller[_0x2a23('0xe')]);router['delete'](_0x2a23('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a23('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3987bd5..29c6124 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 _0x721c=['INTEGER','STRING','noop','exports'];(function(_0x344452,_0x14cc7c){var _0x223bc0=function(_0xa71855){while(--_0xa71855){_0x344452['push'](_0x344452['shift']());}};_0x223bc0(++_0x14cc7c);}(_0x721c,0x93));var _0xc721=function(_0x44e6f4,_0x46472c){_0x44e6f4=_0x44e6f4-0x0;var _0x584eeb=_0x721c[_0x44e6f4];return _0x584eeb;};'use strict';var Sequelize=require('sequelize');module[_0xc721('0x0')]={'priority':{'type':Sequelize[_0xc721('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc721('0x2')],'allowNull':![],'defaultValue':_0xc721('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc721('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1a55=['sequelize','STRING','noop','*,*,*,*'];(function(_0x20dd9b,_0x3c0fb8){var _0x2de3b0=function(_0x5673d2){while(--_0x5673d2){_0x20dd9b['push'](_0x20dd9b['shift']());}};_0x2de3b0(++_0x3c0fb8);}(_0x1a55,0x1bc));var _0x51a5=function(_0x4b712c,_0x13c9f2){_0x4b712c=_0x4b712c-0x0;var _0x304110=_0x1a55[_0x4b712c];return _0x304110;};'use strict';var Sequelize=require(_0x51a5('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x51a5('0x1')],'allowNull':![],'defaultValue':_0x51a5('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x51a5('0x1')],'defaultValue':_0x51a5('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 55c2848..82987e1 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 _0x6931=['undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','WhatsappApplication','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','keys','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x12198e,_0x1d0ea2){var _0xb0748b=function(_0x54bed0){while(--_0x54bed0){_0x12198e['push'](_0x12198e['shift']());}};_0xb0748b(++_0x1d0ea2);}(_0x6931,0x1a9));var _0x1693=function(_0x4919c4,_0x5c7003){_0x4919c4=_0x4919c4-0x0;var _0x1b9e1e=_0x6931[_0x4919c4];return _0x1b9e1e;};'use strict';var emlformat=require(_0x1693('0x0'));var rimraf=require(_0x1693('0x1'));var zipdir=require(_0x1693('0x2'));var jsonpatch=require(_0x1693('0x3'));var rp=require(_0x1693('0x4'));var moment=require(_0x1693('0x5'));var BPromise=require(_0x1693('0x6'));var Mustache=require(_0x1693('0x7'));var util=require('util');var path=require(_0x1693('0x8'));var sox=require(_0x1693('0x9'));var csv=require(_0x1693('0xa'));var ejs=require(_0x1693('0xb'));var fs=require('fs');var fs_extra=require(_0x1693('0xc'));var _=require('lodash');var squel=require(_0x1693('0xd'));var crypto=require(_0x1693('0xe'));var jsforce=require(_0x1693('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1693('0xa'));var querystring=require(_0x1693('0x10'));var Papa=require(_0x1693('0x11'));var Redis=require(_0x1693('0x12'));var authService=require(_0x1693('0x13'));var qs=require(_0x1693('0x14'));var as=require(_0x1693('0x15'));var hardwareService=require(_0x1693('0x16'));var logger=require(_0x1693('0x17'))(_0x1693('0x18'));var utils=require(_0x1693('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1693('0x1a'));var db=require(_0x1693('0x1b'))['db'];function respondWithStatusCode(_0x280986,_0x1746b8){_0x1746b8=_0x1746b8||0xcc;return function(_0x10122d){if(_0x10122d){return _0x280986[_0x1693('0x1c')](_0x1746b8);}return _0x280986[_0x1693('0x1d')](_0x1746b8)['end']();};}function respondWithResult(_0x31caad,_0x50f042){_0x50f042=_0x50f042||0xc8;return function(_0x367f9d){if(_0x367f9d){return _0x31caad['status'](_0x50f042)[_0x1693('0x1e')](_0x367f9d);}};}function respondWithFilteredResult(_0x380cf5,_0x4db220){return function(_0x5a4fb3){if(_0x5a4fb3){var _0x3b94df=typeof _0x4db220['offset']==='undefined'&&typeof _0x4db220['limit']===_0x1693('0x1f');var _0x4b8bb2=_0x5a4fb3['count'];var _0x2a3bc2=_0x3b94df?0x0:_0x4db220[_0x1693('0x20')];var _0x7ef2=_0x3b94df?_0x5a4fb3[_0x1693('0x21')]:_0x4db220[_0x1693('0x20')]+_0x4db220[_0x1693('0x22')];var _0x4c3977;if(_0x7ef2>=_0x4b8bb2){_0x7ef2=_0x4b8bb2;_0x4c3977=0xc8;}else{_0x4c3977=0xce;}_0x380cf5['status'](_0x4c3977);return _0x380cf5[_0x1693('0x23')](_0x1693('0x24'),_0x2a3bc2+'-'+_0x7ef2+'/'+_0x4b8bb2)['json'](_0x5a4fb3);}return null;};}function patchUpdates(_0x183183){return function(_0x10cd8d){try{jsonpatch[_0x1693('0x25')](_0x10cd8d,_0x183183,!![]);}catch(_0xd2ff89){return BPromise[_0x1693('0x26')](_0xd2ff89);}return _0x10cd8d['save']();};}function saveUpdates(_0x1f9126,_0x433db6){return function(_0xbe9928){if(_0xbe9928){return _0xbe9928[_0x1693('0x27')](_0x1f9126)[_0x1693('0x28')](function(_0x2fa64c){return _0x2fa64c;});}return null;};}function removeEntity(_0x56655d,_0x45ceea){return function(_0x5a5165){if(_0x5a5165){return _0x5a5165[_0x1693('0x29')]()[_0x1693('0x28')](function(){_0x56655d[_0x1693('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x108ba9,_0x341a72){return function(_0x43cfb6){if(!_0x43cfb6){_0x108ba9[_0x1693('0x1c')](0x194);}return _0x43cfb6;};}function handleError(_0x4612e0,_0x459c39){_0x459c39=_0x459c39||0x1f4;return function(_0x404bf1){logger['error'](_0x404bf1[_0x1693('0x2a')]);if(_0x404bf1['name']){delete _0x404bf1[_0x1693('0x2b')];}_0x4612e0['status'](_0x459c39)[_0x1693('0x2c')](_0x404bf1);};}exports[_0x1693('0x2d')]=function(_0x437eb9,_0x148438){var _0x5888d7={},_0x425361={},_0x1b8a10={'count':0x0,'rows':[]};var _0x5484d4=_['map'](db[_0x1693('0x2e')]['rawAttributes'],function(_0x4ea713){return{'name':_0x4ea713['fieldName'],'type':_0x4ea713[_0x1693('0x2f')][_0x1693('0x30')]};});_0x425361['model']=_[_0x1693('0x31')](_0x5484d4,'name');_0x425361[_0x1693('0x32')]=_['keys'](_0x437eb9[_0x1693('0x32')]);_0x425361[_0x1693('0x33')]=_[_0x1693('0x34')](_0x425361['model'],_0x425361[_0x1693('0x32')]);_0x5888d7[_0x1693('0x35')]=_[_0x1693('0x34')](_0x425361[_0x1693('0x36')],qs[_0x1693('0x37')](_0x437eb9[_0x1693('0x32')][_0x1693('0x37')]));_0x5888d7[_0x1693('0x35')]=_0x5888d7[_0x1693('0x35')][_0x1693('0x38')]?_0x5888d7[_0x1693('0x35')]:_0x425361[_0x1693('0x36')];if(!_0x437eb9['query'][_0x1693('0x39')]('nolimit')){_0x5888d7[_0x1693('0x22')]=qs[_0x1693('0x22')](_0x437eb9[_0x1693('0x32')][_0x1693('0x22')]);_0x5888d7[_0x1693('0x20')]=qs[_0x1693('0x20')](_0x437eb9[_0x1693('0x32')][_0x1693('0x20')]);}_0x5888d7[_0x1693('0x3a')]=qs['sort'](_0x437eb9[_0x1693('0x32')][_0x1693('0x3b')]);_0x5888d7[_0x1693('0x3c')]=qs[_0x1693('0x33')](_[_0x1693('0x3d')](_0x437eb9[_0x1693('0x32')],_0x425361[_0x1693('0x33')]),_0x5484d4);if(_0x437eb9[_0x1693('0x32')][_0x1693('0x3e')]){_0x5888d7[_0x1693('0x3c')]=_['merge'](_0x5888d7['where'],{'$or':_['map'](_0x5484d4,function(_0x3ccf09){if(_0x3ccf09[_0x1693('0x2f')]!==_0x1693('0x3f')){var _0x2eb8da={};_0x2eb8da[_0x3ccf09[_0x1693('0x2b')]]={'$like':'%'+_0x437eb9[_0x1693('0x32')][_0x1693('0x3e')]+'%'};return _0x2eb8da;}})});}_0x5888d7=_[_0x1693('0x40')]({},_0x5888d7,_0x437eb9[_0x1693('0x41')]);var _0x205298={'where':_0x5888d7[_0x1693('0x3c')]};return db[_0x1693('0x2e')]['count'](_0x205298)[_0x1693('0x28')](function(_0xd2929d){_0x1b8a10[_0x1693('0x21')]=_0xd2929d;if(_0x437eb9[_0x1693('0x32')][_0x1693('0x42')]){_0x5888d7[_0x1693('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x1693('0x44')](_0x5888d7);})['then'](function(_0x5c2505){_0x1b8a10['rows']=_0x5c2505;return _0x1b8a10;})['then'](respondWithFilteredResult(_0x148438,_0x5888d7))['catch'](handleError(_0x148438,null));};exports[_0x1693('0x45')]=function(_0x42b2c6,_0x3996aa){var _0x5cd283={'raw':!![],'where':{'id':_0x42b2c6['params']['id']}},_0x57b878={};_0x57b878[_0x1693('0x36')]=_[_0x1693('0x46')](db[_0x1693('0x2e')]['rawAttributes']);_0x57b878[_0x1693('0x32')]=_[_0x1693('0x46')](_0x42b2c6['query']);_0x57b878[_0x1693('0x33')]=_['intersection'](_0x57b878[_0x1693('0x36')],_0x57b878[_0x1693('0x32')]);_0x5cd283[_0x1693('0x35')]=_['intersection'](_0x57b878[_0x1693('0x36')],qs['fields'](_0x42b2c6[_0x1693('0x32')][_0x1693('0x37')]));_0x5cd283[_0x1693('0x35')]=_0x5cd283[_0x1693('0x35')][_0x1693('0x38')]?_0x5cd283['attributes']:_0x57b878['model'];if(_0x42b2c6['query'][_0x1693('0x42')]){_0x5cd283[_0x1693('0x43')]=[{'all':!![]}];}_0x5cd283=_[_0x1693('0x40')]({},_0x5cd283,_0x42b2c6[_0x1693('0x41')]);return db[_0x1693('0x2e')]['find'](_0x5cd283)[_0x1693('0x28')](handleEntityNotFound(_0x3996aa,null))[_0x1693('0x28')](respondWithResult(_0x3996aa,null))[_0x1693('0x47')](handleError(_0x3996aa,null));};exports[_0x1693('0x48')]=function(_0x1e55a5,_0x4ae5d8){return db['WhatsappApplication'][_0x1693('0x48')](_0x1e55a5[_0x1693('0x49')],{})[_0x1693('0x28')](respondWithResult(_0x4ae5d8,0xc9))[_0x1693('0x47')](handleError(_0x4ae5d8,null));};exports[_0x1693('0x27')]=function(_0x5dfef3,_0x4b6ef8){if(_0x5dfef3[_0x1693('0x49')]['id']){delete _0x5dfef3[_0x1693('0x49')]['id'];}return db['WhatsappApplication'][_0x1693('0x4a')]({'where':{'id':_0x5dfef3[_0x1693('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b6ef8,null))[_0x1693('0x28')](saveUpdates(_0x5dfef3[_0x1693('0x49')],null))[_0x1693('0x28')](respondWithResult(_0x4b6ef8,null))[_0x1693('0x47')](handleError(_0x4b6ef8,null));};exports[_0x1693('0x29')]=function(_0x539e6a,_0x21af6a){return db['WhatsappApplication']['find']({'where':{'id':_0x539e6a['params']['id']}})[_0x1693('0x28')](handleEntityNotFound(_0x21af6a,null))['then'](removeEntity(_0x21af6a,null))['catch'](handleError(_0x21af6a,null));}; \ No newline at end of file +var _0x3af5=['name','send','index','WhatsappApplication','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack'];(function(_0x3fc01e,_0x11b861){var _0xed9e53=function(_0xc74f40){while(--_0xc74f40){_0x3fc01e['push'](_0x3fc01e['shift']());}};_0xed9e53(++_0x11b861);}(_0x3af5,0x1d3));var _0x53af=function(_0x290a56,_0x5c540a){_0x290a56=_0x290a56-0x0;var _0x89610=_0x3af5[_0x290a56];return _0x89610;};'use strict';var emlformat=require(_0x53af('0x0'));var rimraf=require(_0x53af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53af('0x2'));var rp=require(_0x53af('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x53af('0x4'));var util=require('util');var path=require('path');var sox=require(_0x53af('0x5'));var csv=require(_0x53af('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53af('0x7'));var _=require('lodash');var squel=require(_0x53af('0x8'));var crypto=require(_0x53af('0x9'));var jsforce=require(_0x53af('0xa'));var deskjs=require(_0x53af('0xb'));var toCsv=require(_0x53af('0x6'));var querystring=require(_0x53af('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53af('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x53af('0xe'));var hardwareService=require(_0x53af('0xf'));var logger=require('../../config/logger')(_0x53af('0x10'));var utils=require(_0x53af('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x53af('0x12'));var db=require(_0x53af('0x13'))['db'];function respondWithStatusCode(_0x3366ea,_0x59285f){_0x59285f=_0x59285f||0xcc;return function(_0x25a7c9){if(_0x25a7c9){return _0x3366ea['sendStatus'](_0x59285f);}return _0x3366ea[_0x53af('0x14')](_0x59285f)[_0x53af('0x15')]();};}function respondWithResult(_0xee9b56,_0xe7cf2){_0xe7cf2=_0xe7cf2||0xc8;return function(_0x1dea0a){if(_0x1dea0a){return _0xee9b56[_0x53af('0x14')](_0xe7cf2)[_0x53af('0x16')](_0x1dea0a);}};}function respondWithFilteredResult(_0x1c8479,_0x1ee76f){return function(_0x3978f9){if(_0x3978f9){var _0x4d601a=typeof _0x1ee76f[_0x53af('0x17')]===_0x53af('0x18')&&typeof _0x1ee76f[_0x53af('0x19')]===_0x53af('0x18');var _0x1d2747=_0x3978f9[_0x53af('0x1a')];var _0x3fb005=_0x4d601a?0x0:_0x1ee76f['offset'];var _0x207f25=_0x4d601a?_0x3978f9[_0x53af('0x1a')]:_0x1ee76f[_0x53af('0x17')]+_0x1ee76f[_0x53af('0x19')];var _0x568d52;if(_0x207f25>=_0x1d2747){_0x207f25=_0x1d2747;_0x568d52=0xc8;}else{_0x568d52=0xce;}_0x1c8479['status'](_0x568d52);return _0x1c8479[_0x53af('0x1b')](_0x53af('0x1c'),_0x3fb005+'-'+_0x207f25+'/'+_0x1d2747)[_0x53af('0x16')](_0x3978f9);}return null;};}function patchUpdates(_0x5a31d6){return function(_0x28e1fb){try{jsonpatch[_0x53af('0x1d')](_0x28e1fb,_0x5a31d6,!![]);}catch(_0x46d0d5){return BPromise[_0x53af('0x1e')](_0x46d0d5);}return _0x28e1fb[_0x53af('0x1f')]();};}function saveUpdates(_0x217426,_0x222d73){return function(_0x3d04c9){if(_0x3d04c9){return _0x3d04c9['update'](_0x217426)[_0x53af('0x20')](function(_0x26e701){return _0x26e701;});}return null;};}function removeEntity(_0x4fea36,_0x3e164e){return function(_0x363646){if(_0x363646){return _0x363646[_0x53af('0x21')]()['then'](function(){_0x4fea36[_0x53af('0x14')](0xcc)[_0x53af('0x15')]();});}};}function handleEntityNotFound(_0x26a0cf,_0x2b232c){return function(_0x480665){if(!_0x480665){_0x26a0cf[_0x53af('0x22')](0x194);}return _0x480665;};}function handleError(_0x17d47d,_0x25b2cd){_0x25b2cd=_0x25b2cd||0x1f4;return function(_0x530e3c){logger[_0x53af('0x23')](_0x530e3c[_0x53af('0x24')]);if(_0x530e3c[_0x53af('0x25')]){delete _0x530e3c[_0x53af('0x25')];}_0x17d47d['status'](_0x25b2cd)[_0x53af('0x26')](_0x530e3c);};}exports[_0x53af('0x27')]=function(_0xc9b0df,_0x2c27ba){var _0x2820df={},_0x264d0d={},_0x154cc2={'count':0x0,'rows':[]};var _0x584a53=_['map'](db[_0x53af('0x28')]['rawAttributes'],function(_0x308819){return{'name':_0x308819[_0x53af('0x29')],'type':_0x308819[_0x53af('0x2a')][_0x53af('0x2b')]};});_0x264d0d['model']=_[_0x53af('0x2c')](_0x584a53,_0x53af('0x25'));_0x264d0d['query']=_['keys'](_0xc9b0df[_0x53af('0x2d')]);_0x264d0d[_0x53af('0x2e')]=_[_0x53af('0x2f')](_0x264d0d[_0x53af('0x30')],_0x264d0d['query']);_0x2820df['attributes']=_[_0x53af('0x2f')](_0x264d0d[_0x53af('0x30')],qs[_0x53af('0x31')](_0xc9b0df['query']['fields']));_0x2820df[_0x53af('0x32')]=_0x2820df[_0x53af('0x32')][_0x53af('0x33')]?_0x2820df[_0x53af('0x32')]:_0x264d0d[_0x53af('0x30')];if(!_0xc9b0df[_0x53af('0x2d')][_0x53af('0x34')]('nolimit')){_0x2820df[_0x53af('0x19')]=qs[_0x53af('0x19')](_0xc9b0df['query'][_0x53af('0x19')]);_0x2820df[_0x53af('0x17')]=qs[_0x53af('0x17')](_0xc9b0df[_0x53af('0x2d')][_0x53af('0x17')]);}_0x2820df['order']=qs[_0x53af('0x35')](_0xc9b0df['query'][_0x53af('0x35')]);_0x2820df[_0x53af('0x36')]=qs[_0x53af('0x2e')](_[_0x53af('0x37')](_0xc9b0df[_0x53af('0x2d')],_0x264d0d['filters']),_0x584a53);if(_0xc9b0df['query']['filter']){_0x2820df[_0x53af('0x36')]=_['merge'](_0x2820df['where'],{'$or':_['map'](_0x584a53,function(_0x17f024){if(_0x17f024[_0x53af('0x2a')]!==_0x53af('0x38')){var _0x78817a={};_0x78817a[_0x17f024[_0x53af('0x25')]]={'$like':'%'+_0xc9b0df[_0x53af('0x2d')][_0x53af('0x39')]+'%'};return _0x78817a;}})});}_0x2820df=_[_0x53af('0x3a')]({},_0x2820df,_0xc9b0df[_0x53af('0x3b')]);var _0x5906a3={'where':_0x2820df[_0x53af('0x36')]};return db[_0x53af('0x28')][_0x53af('0x1a')](_0x5906a3)[_0x53af('0x20')](function(_0x409c75){_0x154cc2[_0x53af('0x1a')]=_0x409c75;if(_0xc9b0df['query'][_0x53af('0x3c')]){_0x2820df[_0x53af('0x3d')]=[{'all':!![]}];}return db[_0x53af('0x28')][_0x53af('0x3e')](_0x2820df);})['then'](function(_0x12fbf6){_0x154cc2[_0x53af('0x3f')]=_0x12fbf6;return _0x154cc2;})[_0x53af('0x20')](respondWithFilteredResult(_0x2c27ba,_0x2820df))[_0x53af('0x40')](handleError(_0x2c27ba,null));};exports[_0x53af('0x41')]=function(_0x5d1b82,_0x274e72){var _0x3490ff={'raw':!![],'where':{'id':_0x5d1b82[_0x53af('0x42')]['id']}},_0x46e4d9={};_0x46e4d9[_0x53af('0x30')]=_[_0x53af('0x43')](db[_0x53af('0x28')]['rawAttributes']);_0x46e4d9[_0x53af('0x2d')]=_[_0x53af('0x43')](_0x5d1b82[_0x53af('0x2d')]);_0x46e4d9['filters']=_[_0x53af('0x2f')](_0x46e4d9['model'],_0x46e4d9[_0x53af('0x2d')]);_0x3490ff[_0x53af('0x32')]=_[_0x53af('0x2f')](_0x46e4d9[_0x53af('0x30')],qs[_0x53af('0x31')](_0x5d1b82[_0x53af('0x2d')][_0x53af('0x31')]));_0x3490ff['attributes']=_0x3490ff[_0x53af('0x32')][_0x53af('0x33')]?_0x3490ff[_0x53af('0x32')]:_0x46e4d9[_0x53af('0x30')];if(_0x5d1b82[_0x53af('0x2d')][_0x53af('0x3c')]){_0x3490ff[_0x53af('0x3d')]=[{'all':!![]}];}_0x3490ff=_[_0x53af('0x3a')]({},_0x3490ff,_0x5d1b82[_0x53af('0x3b')]);return db['WhatsappApplication']['find'](_0x3490ff)[_0x53af('0x20')](handleEntityNotFound(_0x274e72,null))[_0x53af('0x20')](respondWithResult(_0x274e72,null))['catch'](handleError(_0x274e72,null));};exports['create']=function(_0x651bfe,_0x27c961){return db[_0x53af('0x28')][_0x53af('0x44')](_0x651bfe[_0x53af('0x45')],{})[_0x53af('0x20')](respondWithResult(_0x27c961,0xc9))['catch'](handleError(_0x27c961,null));};exports[_0x53af('0x46')]=function(_0x2f3adb,_0x4586aa){if(_0x2f3adb[_0x53af('0x45')]['id']){delete _0x2f3adb[_0x53af('0x45')]['id'];}return db[_0x53af('0x28')][_0x53af('0x47')]({'where':{'id':_0x2f3adb[_0x53af('0x42')]['id']}})['then'](handleEntityNotFound(_0x4586aa,null))['then'](saveUpdates(_0x2f3adb[_0x53af('0x45')],null))['then'](respondWithResult(_0x4586aa,null))[_0x53af('0x40')](handleError(_0x4586aa,null));};exports[_0x53af('0x21')]=function(_0x3f3483,_0x452e9d){return db[_0x53af('0x28')][_0x53af('0x47')]({'where':{'id':_0x3f3483[_0x53af('0x42')]['id']}})['then'](handleEntityNotFound(_0x452e9d,null))['then'](removeEntity(_0x452e9d,null))['catch'](handleError(_0x452e9d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 36288e1..1f2a9a9 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 _0xf53f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x298800,_0xc23b50){var _0x46a41c=function(_0x33fa19){while(--_0x33fa19){_0x298800['push'](_0x298800['shift']());}};_0x46a41c(++_0xc23b50);}(_0xf53f,0x8d));var _0xff53=function(_0x305484,_0x1d47fb){_0x305484=_0x305484-0x0;var _0x18877b=_0xf53f[_0x305484];return _0x18877b;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var logger=require(_0xff53('0x2'))(_0xff53('0x3'));var moment=require(_0xff53('0x4'));var BPromise=require(_0xff53('0x5'));var rp=require(_0xff53('0x6'));var fs=require('fs');var path=require(_0xff53('0x7'));var rimraf=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var attributes=require(_0xff53('0xa'));module[_0xff53('0xb')]=function(_0x54d39c,_0x54e637){return _0x54d39c[_0xff53('0xc')]('WhatsappApplication',attributes,{'tableName':_0xff53('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff53('0xe'),'collate':_0xff53('0xf')});}; \ No newline at end of file +var _0xf2cb=['bluebird','path','rimraf','exports','define','whatsapp_applications','utf8mb4_unicode_ci','util','api'];(function(_0xe7ef95,_0x315861){var _0x379c6b=function(_0x10d985){while(--_0x10d985){_0xe7ef95['push'](_0xe7ef95['shift']());}};_0x379c6b(++_0x315861);}(_0xf2cb,0x130));var _0xbf2c=function(_0x5af002,_0x562cef){_0x5af002=_0x5af002-0x0;var _0xc91699=_0xf2cb[_0x5af002];return _0xc91699;};'use strict';var _=require('lodash');var util=require(_0xbf2c('0x0'));var logger=require('../../config/logger')(_0xbf2c('0x1'));var moment=require('moment');var BPromise=require(_0xbf2c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf2c('0x3'));var rimraf=require(_0xbf2c('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xbf2c('0x5')]=function(_0x46d282,_0x1fc371){return _0x46d282[_0xbf2c('0x6')]('WhatsappApplication',attributes,{'tableName':_0xbf2c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbf2c('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 404f900..fdfa524 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(_0x26054a,_0x1434c8){var _0x594104=function(_0x276789){while(--_0x276789){_0x26054a['push'](_0x26054a['shift']());}};_0x594104(++_0x1434c8);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5151db,_0x3e6090){_0x5151db=_0x5151db-0x0;var _0x1fb8e8=_0x8d0e[_0x5151db];return _0x1fb8e8;};'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 _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x40a535,_0x15b587){var _0x39329e=function(_0x31cb6c){while(--_0x31cb6c){_0x40a535['push'](_0x40a535['shift']());}};_0x39329e(++_0x15b587);}(_0x4c4e,0x152));var _0xe4c4=function(_0x25ad5b,_0x3ad255){_0x25ad5b=_0x25ad5b-0x0;var _0x5afec7=_0x4c4e[_0x25ad5b];return _0x5afec7;};'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')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('WhatsappApplication,\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);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d5576ea..e71d22d 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 _0x4317=['./whatsappInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','removeTags','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15efd2,_0x174e07){var _0x5f19b1=function(_0x3e743c){while(--_0x3e743c){_0x15efd2['push'](_0x15efd2['shift']());}};_0x5f19b1(++_0x174e07);}(_0x4317,0x7c));var _0x7431=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4317[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var fs_extra=require(_0x7431('0x4'));var auth=require(_0x7431('0x5'));var interaction=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var controller=require(_0x7431('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7431('0x9')]);router[_0x7431('0xa')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0xd')]);router[_0x7431('0xa')](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0xf')]);router[_0x7431('0xa')](_0x7431('0x10'),auth[_0x7431('0xc')](),controller[_0x7431('0x11')]);router[_0x7431('0xa')](_0x7431('0x12'),auth[_0x7431('0xc')](),controller[_0x7431('0x13')]);router[_0x7431('0x14')]('/',auth[_0x7431('0xc')](),controller[_0x7431('0x15')]);router[_0x7431('0x14')](_0x7431('0x10'),auth[_0x7431('0xc')](),controller[_0x7431('0x16')]);router['post'](_0x7431('0x17'),auth[_0x7431('0xc')](),interaction[_0x7431('0x18')]('whatsapp',_0x7431('0x19')),controller[_0x7431('0x1a')]);router[_0x7431('0x1b')]('/:id',auth[_0x7431('0xc')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0x7431('0x1c')]);router[_0x7431('0x1d')](_0x7431('0xe'),auth[_0x7431('0xc')](),interaction['tracked']('whatsapp',_0x7431('0x1e')),controller[_0x7431('0x1f')]);router[_0x7431('0x1d')](_0x7431('0x17'),auth[_0x7431('0xc')](),controller[_0x7431('0x20')]);module['exports']=router; \ No newline at end of file +var _0xaa37=['describe','show','/:id/messages','getMessages','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated'];(function(_0x4d603f,_0xbe5814){var _0x3a279a=function(_0x4d4d68){while(--_0x4d4d68){_0x4d603f['push'](_0x4d603f['shift']());}};_0x3a279a(++_0xbe5814);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xaa37[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var path=require(_0x7aa3('0x2'));var timeout=require(_0x7aa3('0x3'));var express=require('express');var router=express[_0x7aa3('0x4')]();var fs_extra=require(_0x7aa3('0x5'));var auth=require(_0x7aa3('0x6'));var interaction=require(_0x7aa3('0x7'));var config=require(_0x7aa3('0x8'));var controller=require(_0x7aa3('0x9'));router[_0x7aa3('0xa')]('/',auth['isAuthenticated'](),controller[_0x7aa3('0xb')]);router[_0x7aa3('0xa')]('/describe',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xd')]);router[_0x7aa3('0xa')]('/:id',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xe')]);router[_0x7aa3('0xa')](_0x7aa3('0xf'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x10')]);router['get']('/:id/download',auth[_0x7aa3('0xc')](),controller['download']);router[_0x7aa3('0x11')]('/',auth[_0x7aa3('0xc')](),controller['create']);router[_0x7aa3('0x11')](_0x7aa3('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x7aa3('0x12'),auth[_0x7aa3('0xc')](),interaction[_0x7aa3('0x13')](_0x7aa3('0x14'),_0x7aa3('0x15')),controller['addTags']);router[_0x7aa3('0x16')](_0x7aa3('0x17'),auth[_0x7aa3('0xc')](),interaction[_0x7aa3('0x13')]('whatsapp','whatsappinteraction:update'),controller[_0x7aa3('0x18')]);router['delete'](_0x7aa3('0x17'),auth[_0x7aa3('0xc')](),interaction['tracked'](_0x7aa3('0x14'),_0x7aa3('0x19')),controller[_0x7aa3('0x1a')]);router[_0x7aa3('0x1b')](_0x7aa3('0x12'),auth['isAuthenticated'](),controller[_0x7aa3('0x1c')]);module[_0x7aa3('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0308eea..80f6655 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 _0xdcf6=['moment','exports','BOOLEAN','DATE','STRING','out'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x408762,_0x1e2f39){_0x408762=_0x408762-0x0;var _0x5e9e3e=_0xdcf6[_0x408762];return _0x5e9e3e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6dcf('0x0'));module[_0x6dcf('0x1')]={'closed':{'type':Sequelize[_0x6dcf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6dcf('0x3')]},'disposition':{'type':Sequelize[_0x6dcf('0x4')]},'secondDisposition':{'type':Sequelize[_0x6dcf('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6dcf('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6dcf('0x4')]},'read1stAt':{'type':Sequelize[_0x6dcf('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6dcf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6dcf('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6c65=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x21475f,_0x30aae3){var _0x178b57=function(_0x5c5c37){while(--_0x5c5c37){_0x21475f['push'](_0x21475f['shift']());}};_0x178b57(++_0x30aae3);}(_0x6c65,0x78));var _0x56c6=function(_0x396310,_0x2e2c0a){_0x396310=_0x396310-0x0;var _0x3dfd1e=_0x6c65[_0x396310];return _0x3dfd1e;};'use strict';var Sequelize=require(_0x56c6('0x0'));var moment=require(_0x56c6('0x1'));module[_0x56c6('0x2')]={'closed':{'type':Sequelize[_0x56c6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x56c6('0x4')]},'disposition':{'type':Sequelize[_0x56c6('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x56c6('0x5')]},'note':{'type':Sequelize[_0x56c6('0x5')]},'phone':{'type':Sequelize[_0x56c6('0x5')]},'read1stAt':{'type':Sequelize[_0x56c6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x56c6('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x56c6('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x56c6('0x6')]('in',_0x56c6('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x56c6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c0cc455..16dfaaa 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 _0x871e=['set','Content-Range','apply','reject','save','update','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','catch','index','key','map','filters','intersection','query','attributes','fields','length','model','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','whatsapp_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','UserId','body','keys','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`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','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','WhatsappInteraction','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','rows','params','includeAll','options','create','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','emit','removeTags','unix','join','server','files','root','attachments','CmContact','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','Whatsapp','Owner','N.A.','closed','disposition','existsSync','createReadStream','pipe','createWriteStream','System','firstName','basename','out','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','err','unlinkSync','sendStatus','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','undefined','limit','count','offset'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x871e,0x1b0));var _0xe871=function(_0x4f544a,_0x36eefa){_0x4f544a=_0x4f544a-0x0;var _0x2eb10f=_0x871e[_0x4f544a];return _0x2eb10f;};'use strict';var emlformat=require(_0xe871('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe871('0x1'));var jsonpatch=require(_0xe871('0x2'));var rp=require(_0xe871('0x3'));var moment=require(_0xe871('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe871('0x5'));var util=require(_0xe871('0x6'));var path=require(_0xe871('0x7'));var sox=require(_0xe871('0x8'));var csv=require(_0xe871('0x9'));var ejs=require(_0xe871('0xa'));var fs=require('fs');var fs_extra=require(_0xe871('0xb'));var _=require(_0xe871('0xc'));var squel=require(_0xe871('0xd'));var crypto=require(_0xe871('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe871('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe871('0x10'));var Redis=require(_0xe871('0x11'));var authService=require(_0xe871('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe871('0x13'));var pdf=require(_0xe871('0x14'));var hardwareService=require(_0xe871('0x15'));var logger=require(_0xe871('0x16'))(_0xe871('0x17'));var utils=require(_0xe871('0x18'));var config=require(_0xe871('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe871('0x1a'))['db'];config[_0xe871('0x1b')]=_[_0xe871('0x1c')](config[_0xe871('0x1b')],{'host':_0xe871('0x1d'),'port':0x18eb});var socket=require(_0xe871('0x1e'))(new Redis(config[_0xe871('0x1b')]));require(_0xe871('0x1f'))[_0xe871('0x20')](socket);function respondWithStatusCode(_0x5e0531,_0x3aaab6){_0x3aaab6=_0x3aaab6||0xcc;return function(_0x48ebad){if(_0x48ebad){return _0x5e0531['sendStatus'](_0x3aaab6);}return _0x5e0531[_0xe871('0x21')](_0x3aaab6)[_0xe871('0x22')]();};}function respondWithResult(_0x271da1,_0x162958){_0x162958=_0x162958||0xc8;return function(_0x2288c8){if(_0x2288c8){return _0x271da1[_0xe871('0x21')](_0x162958)[_0xe871('0x23')](_0x2288c8);}};}function respondWithFilteredResult(_0x2e24be,_0x11ad56){return function(_0x4d7c98){if(_0x4d7c98){var _0x31319f=typeof _0x11ad56['offset']===_0xe871('0x24')&&typeof _0x11ad56[_0xe871('0x25')]==='undefined';var _0x3cf7b4=_0x4d7c98[_0xe871('0x26')];var _0x56408f=_0x31319f?0x0:_0x11ad56[_0xe871('0x27')];var _0x3289af=_0x31319f?_0x4d7c98[_0xe871('0x26')]:_0x11ad56[_0xe871('0x27')]+_0x11ad56[_0xe871('0x25')];var _0xaa8278;if(_0x3289af>=_0x3cf7b4){_0x3289af=_0x3cf7b4;_0xaa8278=0xc8;}else{_0xaa8278=0xce;}_0x2e24be[_0xe871('0x21')](_0xaa8278);return _0x2e24be[_0xe871('0x28')](_0xe871('0x29'),_0x56408f+'-'+_0x3289af+'/'+_0x3cf7b4)[_0xe871('0x23')](_0x4d7c98);}return null;};}function patchUpdates(_0x68bb84){return function(_0x315fc2){try{jsonpatch[_0xe871('0x2a')](_0x315fc2,_0x68bb84,!![]);}catch(_0x2007a7){return BPromise[_0xe871('0x2b')](_0x2007a7);}return _0x315fc2[_0xe871('0x2c')]();};}function saveUpdates(_0x3e00f5,_0x1040ac){return function(_0x3776ae){if(_0x3776ae){return _0x3776ae[_0xe871('0x2d')](_0x3e00f5)[_0xe871('0x2e')](function(_0x18799f){return _0x18799f;});}return null;};}function removeEntity(_0x2b9fc5,_0x4a859a){return function(_0x4e94f3){if(_0x4e94f3){return _0x4e94f3['destroy']()[_0xe871('0x2e')](function(){_0x2b9fc5[_0xe871('0x21')](0xcc)[_0xe871('0x22')]();});}};}function handleEntityNotFound(_0xb53d1a,_0x5dfb27){return function(_0x17e851){if(!_0x17e851){_0xb53d1a['sendStatus'](0x194);}return _0x17e851;};}function handleError(_0x4dc55f,_0x50ac1e){_0x50ac1e=_0x50ac1e||0x1f4;return function(_0x3708f6){logger[_0xe871('0x2f')](_0x3708f6[_0xe871('0x30')]);if(_0x3708f6[_0xe871('0x31')]){delete _0x3708f6[_0xe871('0x31')];}_0x4dc55f[_0xe871('0x21')](_0x50ac1e)[_0xe871('0x32')](_0x3708f6);};}function getInteractionUsers(_0x470b0d,_0x196468){return new BPromise(function(_0xf961f3,_0x304984){try{if(_0x196468[_0x470b0d['id']]){_0x470b0d['Users']=_['map'](_0x196468[_0x470b0d['id']],function(_0x5ddcba){return{'id':_0x5ddcba['id'],'fullname':_0x5ddcba[_0xe871('0x33')]};});}}catch(_0x5b6550){_0x304984(_0x5b6550);}_0xf961f3(_0x470b0d);});}function getInteractionTags(_0x2f56c8,_0x5a8bc2){return new BPromise(function(_0x5ab94f,_0x41a6f8){try{if(_0x2f56c8[_0xe871('0x34')]){_0x2f56c8[_0xe871('0x35')]=[];_0x2f56c8[_0xe871('0x34')][_0xe871('0x36')](',')[_0xe871('0x37')](function(_0x3024b7){_0x2f56c8[_0xe871('0x35')][_0xe871('0x38')](_0x5a8bc2[_0x3024b7]);});}delete _0x2f56c8['TagIds'];}catch(_0x3d9439){_0x41a6f8(_0x3d9439);}_0x5ab94f(_0x2f56c8);});}function updateWhatsappInteraction(_0xf9664d,_0x44b933,_0x13aa7d){return new BPromise(function(_0x352788,_0x6f07b3){return getInteractionUsers(_0xf9664d,_0x13aa7d)[_0xe871('0x2e')](function(_0x5cb141){return getInteractionTags(_0x5cb141,_0x44b933);})[_0xe871('0x2e')](function(_0x2971bc){_0x352788(_0x2971bc);})[_0xe871('0x39')](function(_0xb20916){_0x6f07b3(_0xb20916);});});}exports[_0xe871('0x3a')]=function(_0x1ebd9b,_0x2943b5){var _0x105dd4={},_0x468e12={},_0x505fce={'count':0x0,'rows':[]};var _0x3ed898=_['map'](db['WhatsappInteraction']['rawAttributes'],function(_0x5a1953){return{'name':_0x5a1953['fieldName'],'type':_0x5a1953['type'][_0xe871('0x3b')]};});_0x468e12['model']=_[_0xe871('0x3c')](_0x3ed898,_0xe871('0x31'));_0x468e12['query']=_['keys'](_0x1ebd9b['query']);_0x468e12[_0xe871('0x3d')]=_[_0xe871('0x3e')](_0x468e12['model'],_0x468e12[_0xe871('0x3f')]);_0x105dd4[_0xe871('0x40')]=_[_0xe871('0x3e')](_0x468e12['model'],qs[_0xe871('0x41')](_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x41')]));_0x105dd4[_0xe871('0x40')]=_0x105dd4[_0xe871('0x40')][_0xe871('0x42')]?_0x105dd4['attributes']:_0x468e12[_0xe871('0x43')];if(!_0x1ebd9b['query']['hasOwnProperty'](_0xe871('0x44'))){_0x105dd4['limit']=qs[_0xe871('0x25')](_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x25')]);_0x105dd4[_0xe871('0x27')]=qs[_0xe871('0x27')](_0x1ebd9b['query'][_0xe871('0x27')]);}_0x105dd4[_0xe871('0x45')]=qs[_0xe871('0x46')](_0x1ebd9b[_0xe871('0x3f')]['sort']);_0x105dd4[_0xe871('0x47')]=qs[_0xe871('0x3d')](_[_0xe871('0x48')](_0x1ebd9b[_0xe871('0x3f')],_0x468e12[_0xe871('0x3d')]),_0x3ed898);var _0x4ed342=[];var _0x93ddb3=squel[_0xe871('0x49')]()[_0xe871('0x4a')]('id')[_0xe871('0x4a')](_0xe871('0x31'))[_0xe871('0x4a')](_0xe871('0x4b'))[_0xe871('0x4c')](_0xe871('0x4d'));var _0x2e29c0=squel['select']()[_0xe871('0x4a')](_0xe871('0x4e'))[_0xe871('0x4a')](_0xe871('0x4f'))[_0xe871('0x4a')](_0xe871('0x50'))[_0xe871('0x4c')]('user_has_whatsapp_interactions','ui')['left_join'](_0xe871('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x3b8471=squel[_0xe871('0x49')]()['from'](_0xe871('0x52'),'i')[_0xe871('0x53')](_0xe871('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe871('0x53')]('users','o',_0xe871('0x55'))[_0xe871('0x53')](_0xe871('0x56'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xe871('0x53')](_0xe871('0x57'),'me',_0xe871('0x58'))['left_join'](_0xe871('0x59'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xe871('0x53')](_0xe871('0x4d'),'t',_0xe871('0x5a'));var _0x2a8419=squel[_0xe871('0x5b')]();var _0x2f6dc7=[];var _0x19f458=squel[_0xe871('0x5b')]();var _0x2dce7e;if(_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x5c')]){_0x2dce7e=as[_0xe871('0x5d')](_0x1ebd9b[_0xe871('0x3f')]['search']);var _0x1293db=_0x2dce7e[_0xe871('0x5e')];for(var _0x3641eb=0x0;_0x3641eb<_0x2dce7e[_0xe871('0x5f')][_0xe871('0x42')];_0x3641eb++){var _0x3ff3fa=_0x2dce7e[_0xe871('0x5f')][_0x3641eb];var _0x1081a0='i';var _0x229e04=_['find'](_0x3ed898,['name',_0x3ff3fa[_0xe871('0x4a')]]);if(!_0x229e04){switch(_0x3ff3fa[_0xe871('0x4a')]){case'unreadMessages':if(_0x3ff3fa[_0xe871('0x60')]==0x1){_0x3b8471[_0xe871('0x61')]('`'+_0x3ff3fa['field']+'`\x20=\x200');}else{_0x3b8471['having']('`'+_0x3ff3fa[_0xe871('0x4a')]+_0xe871('0x62'));}break;case'Contact':if(_0x3ff3fa['operator']==='$substring'){if(_0x3ff3fa['value']['split']('\x20')['length']>0x1){_0x2a8419[_0x1293db](_0xe871('0x63'),qs[_0xe871('0x64')](_0x3ff3fa[_0xe871('0x60')]),null);}else{var _0x567db6='%'+_0x3ff3fa['value']+'%';_0x2a8419[_0x1293db](_0xe871('0x65'),_0x567db6,_0x567db6,_0x567db6);}}else{_0x229e04=_[_0xe871('0x66')](_0x3ed898,[_0xe871('0x31'),_0xe871('0x67')]);_0x3ff3fa[_0xe871('0x4a')]=_0xe871('0x67');_0x137554=as[_0xe871('0x68')](_0x1081a0,_0x229e04[_0xe871('0x69')],_0x3ff3fa);_0x2a8419[_0x1293db](_0x137554[_0xe871('0x6a')],_0x137554[_0xe871('0x60')][_0xe871('0x6b')],_0x137554['value'][_0xe871('0x22')]);}break;case _0xe871('0x6c'):var _0xcfa148=_0x3ff3fa['value'][_0xe871('0x36')](',')[_0xe871('0x3c')](function(_0x412dce){return Number(_0x412dce);});_0xcfa148[_0xe871('0x37')](function(_0x56b008){_0x19f458['or'](_0xe871('0x6d'),'%,'+_0x56b008+',%');});_0x2f6dc7=_['union'](_0x2f6dc7,_0xcfa148);break;case _0xe871('0x6e'):if(_0x3ff3fa[_0xe871('0x6f')]==='$substring'){_0x2a8419[_0x1293db]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3ff3fa[_0xe871('0x60')]+'%',null);}else{_0x229e04=_[_0xe871('0x66')](_0x3ed898,[_0xe871('0x31'),_0xe871('0x70')]);_0x3ff3fa[_0xe871('0x4a')]=_0xe871('0x70');_0x137554=as[_0xe871('0x68')](_0x1081a0,_0x229e04['type'],_0x3ff3fa);_0x2a8419[_0x1293db](_0x137554['text'],_0x137554['value']['start'],_0x137554['value']['end']);}break;case _0xe871('0x71'):_0x137554=as['buildExpression']('me',null,_0x3ff3fa);_0x2a8419[_0x1293db](_0x137554[_0xe871('0x6a')],_0x137554[_0xe871('0x60')][_0xe871('0x6b')],_0x137554['value'][_0xe871('0x22')]);break;}}else{var _0x137554=as[_0xe871('0x68')](_0x1081a0,_0x229e04['type'],_0x3ff3fa);_0x2a8419[_0x1293db](_0x137554[_0xe871('0x6a')],_0x137554[_0xe871('0x60')][_0xe871('0x6b')],_0x137554[_0xe871('0x60')][_0xe871('0x22')]);}}}else{var _0x3fc9f0=_(_0x1ebd9b[_0xe871('0x3f')])[_0xe871('0x72')]()[_0xe871('0x3c')](function(_0x26eea7){return _[_0xe871('0x73')](_0x3ed898,[_0xe871('0x31'),_0x26eea7])?_0x26eea7:undefined;})[_0xe871('0x74')]()[_0xe871('0x60')]();if(!_[_0xe871('0x75')](_0x3fc9f0)){_0x3fc9f0['forEach'](function(_0x89fadd){if(_0x89fadd==='WhatsappAccountId'){_0x3b8471[_0xe871('0x47')](_0xe871('0x76'),[]['concat'](_0x1ebd9b[_0xe871('0x3f')][_0x89fadd]));}else if(_0x89fadd===_0xe871('0x77')){var _0x3f96d0=JSON[_0xe871('0x78')](_0x1ebd9b[_0xe871('0x3f')][_0x89fadd])['$gte'];var _0xac5c6c=JSON[_0xe871('0x78')](_0x1ebd9b[_0xe871('0x3f')][_0x89fadd])['$lte'];_0x3b8471[_0xe871('0x47')](_0xe871('0x79'),_0x3f96d0,_0xac5c6c);}else{if(_0x1ebd9b['query'][_0x89fadd]==='null'){_0x3b8471[_0xe871('0x47')]('i.'+_0x89fadd+'\x20IS\x20NULL');}else{_0x3b8471[_0xe871('0x47')]('i.'+_0x89fadd+_0xe871('0x7a'),_0x1ebd9b['query'][_0x89fadd]);}}});}if(_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x7b')]){if(_0x1ebd9b['query'][_0xe871('0x7b')]==0x1){_0x3b8471['having']('`unreadMessages`\x20=\x200');}else{_0x3b8471[_0xe871('0x61')](_0xe871('0x7c'));}}if(_0x1ebd9b['query'][_0xe871('0x7d')]){_0x2f6dc7=_['isArray'](_0x1ebd9b['query'][_0xe871('0x7d')])?_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x7d')]:new Array(_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x7d')]);_0x2f6dc7[_0xe871('0x37')](function(_0x38cd46){_0x19f458['or'](_0xe871('0x6d'),'%,'+_0x38cd46+',%');});}if(_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x7e')]){var _0x489c27=_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x7e')][_0xe871('0x7f')]('\x5c','\x5c\x5c')[_0xe871('0x7f')](/'/g,'\x27\x27');if(qs[_0xe871('0x80')](_0x489c27)){_0x2a8419['or'](_0xe871('0x81'),_0x489c27+'%')['or'](_0xe871('0x82'),_0x489c27+'%');}else{_0x2a8419['or'](_0xe871('0x83'),qs['getFullTextValue'](_0x489c27))['or'](_0xe871('0x84'),_0x489c27+'%');}}}_0x3b8471[_0xe871('0x47')](_0x2a8419);_0x3b8471[_0xe871('0x85')](_0xe871('0x86'));var _0x3c66e={'type':db[_0xe871('0x87')][_0xe871('0x88')][_0xe871('0x89')],'raw':!![]};var _0x5a7422=_0x3b8471[_0xe871('0x8a')]();_0x5a7422['field'](_0xe871('0x86'));_0x5a7422[_0xe871('0x4a')](_0xe871('0x8b'),_0xe871('0x8c'));if(_0x105dd4[_0xe871('0x45')]){_0x105dd4[_0xe871('0x45')][_0xe871('0x37')](function(_0x155408){var _0x4c19ec=_0x155408[0x0]===_0xe871('0x8d')?_0x155408[0x0]:'i.'+_0x155408[0x0];_0x3b8471[_0xe871('0x45')](_0x4c19ec,_0x155408[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe871('0x75')](_0x2f6dc7)){_0x3b8471['having'](_0x19f458);_0x5a7422[_0xe871('0x47')](_0xe871('0x8e'),_0x2f6dc7);}BPromise[_0xe871('0x8f')]()[_0xe871('0x2e')](function(){if(!_0x2dce7e){if(_0x1ebd9b['query'][_0xe871('0x90')])return;_0x5a7422[_0xe871('0x47')](_0xe871('0x91'));_0x3b8471[_0xe871('0x47')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1ebd9b[_0xe871('0x92')][_0xe871('0x93')]!==_0xe871('0x94'))return;return _0x1ebd9b['user'][_0xe871('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x12fb8b){if(_[_0xe871('0x75')](_0x12fb8b)){_0x5a7422[_0xe871('0x47')](_0xe871('0x96'));_0x3b8471[_0xe871('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x5a7422[_0xe871('0x47')](_0xe871('0x76'),_[_0xe871('0x3c')](_0x12fb8b,'id'));_0x3b8471[_0xe871('0x47')](_0xe871('0x76'),_['map'](_0x12fb8b,'id'));}});})['then'](function(){if(_0x1ebd9b[_0xe871('0x92')]['role']===_0xe871('0x94')&&!_0x2dce7e&&!_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x90')])return[];return db[_0xe871('0x97')][_0xe871('0x3f')](_0x5a7422[_0xe871('0x98')](),_0x3c66e);})[_0xe871('0x2e')](function(_0x5dc43d){_0x505fce[_0xe871('0x26')]=_0x5dc43d[_0xe871('0x42')];if(_0x505fce['count']===0x0)return[];return db[_0xe871('0x97')][_0xe871('0x3f')](_0x93ddb3['toString'](),_0x3c66e)[_0xe871('0x2e')](function(_0x387366){_0x4ed342=_[_0xe871('0x99')](_0x387366,'id');_0x3c66e=_[_0xe871('0x9a')](_0x3c66e,{'model':db[_0xe871('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ebd9b[_0xe871('0x3f')][_0xe871('0x41')]){_0x105dd4[_0xe871('0x40')][_0xe871('0x37')](function(_0x1214a4){_0x3b8471[_0xe871('0x4a')]('i.'+_0x1214a4);});}else{_0x3b8471[_0xe871('0x4a')](_0xe871('0x8b'),_0xe871('0x8c'));_0x3b8471[_0xe871('0x4a')](_0xe871('0x9c'),_0xe871('0x9d'));_0x3b8471[_0xe871('0x4a')]('a.mandatoryDisposition',_0xe871('0x9e'));_0x3b8471[_0xe871('0x4a')]('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',_0xe871('0x8d'));_0x3b8471[_0xe871('0x4a')](_0xe871('0x9f'));_0x3b8471['field'](_0xe871('0xa0'),_0xe871('0xa1'));_0x3b8471[_0xe871('0x4a')](_0xe871('0xa2'),_0xe871('0xa3'));_0x3b8471[_0xe871('0x4a')](_0xe871('0xa4'),_0xe871('0xa5'));_0x3b8471[_0xe871('0x4a')](_0xe871('0xa6'),'Contact.phone');_0x3b8471[_0xe871('0x4a')](_0xe871('0xa7'),_0xe871('0xa8'));_0x3b8471['field'](_0xe871('0xa9'),_0xe871('0xaa'));_0x3b8471['field'](_0xe871('0xab'),_0xe871('0xac'));_0x3b8471[_0xe871('0x4a')]('o.internal','Owner.internal');_0x3b8471[_0xe871('0x4a')](_0xe871('0xad'),'TagIds');}if(_0x105dd4[_0xe871('0x25')])_0x3b8471['limit'](_0x105dd4[_0xe871('0x25')]);if(_0x105dd4['offset'])_0x3b8471[_0xe871('0x27')](_0x105dd4['offset']);return db['sequelize'][_0xe871('0x3f')](_0x3b8471[_0xe871('0x98')](),_0x3c66e);})[_0xe871('0x2e')](function(_0x246ed8){if(_0x246ed8[_0xe871('0x42')]>0x0)_0x2e29c0[_0xe871('0x47')](_0xe871('0xae'),_[_0xe871('0x3c')](_0x246ed8,'id'));return db[_0xe871('0x97')]['query'](_0x2e29c0[_0xe871('0x98')](),_0x3c66e)[_0xe871('0x2e')](function(_0xedb11d){var _0x28bbc5=_[_0xe871('0xaf')](_0xedb11d,'WhatsappInteractionId');var _0x574960=[];_0x246ed8['forEach'](function(_0x45ff13){_0x574960[_0xe871('0x38')](updateWhatsappInteraction(_0x45ff13,_0x4ed342,_0x28bbc5));});return BPromise['all'](_0x574960);});});})[_0xe871('0x2e')](function(_0x59b30e){_0x505fce[_0xe871('0xb0')]=_0x59b30e;return _0x505fce;})[_0xe871('0x2e')](respondWithFilteredResult(_0x2943b5,_0x105dd4))[_0xe871('0x39')](handleError(_0x2943b5,null));};exports['show']=function(_0x451394,_0x5ef66b){var _0x2181be={'raw':![],'where':{'id':_0x451394[_0xe871('0xb1')]['id']}},_0x461a61={};_0x461a61[_0xe871('0x43')]=_[_0xe871('0x72')](db[_0xe871('0x9b')]['rawAttributes']);_0x461a61['query']=_[_0xe871('0x72')](_0x451394[_0xe871('0x3f')]);_0x461a61['filters']=_[_0xe871('0x3e')](_0x461a61[_0xe871('0x43')],_0x461a61[_0xe871('0x3f')]);_0x2181be[_0xe871('0x40')]=_[_0xe871('0x3e')](_0x461a61[_0xe871('0x43')],qs[_0xe871('0x41')](_0x451394[_0xe871('0x3f')]['fields']));_0x2181be[_0xe871('0x40')]=_0x2181be['attributes'][_0xe871('0x42')]?_0x2181be[_0xe871('0x40')]:_0x461a61['model'];if(_0x451394[_0xe871('0x3f')][_0xe871('0xb2')]){_0x2181be['include']=[{'all':!![]}];}_0x2181be=_['merge']({},_0x2181be,_0x451394[_0xe871('0xb3')]);return db[_0xe871('0x9b')][_0xe871('0x66')](_0x2181be)[_0xe871('0x2e')](handleEntityNotFound(_0x5ef66b,null))[_0xe871('0x2e')](respondWithResult(_0x5ef66b,null))[_0xe871('0x39')](handleError(_0x5ef66b,null));};exports['create']=function(_0x2039e8,_0x4c3785){return db[_0xe871('0x9b')][_0xe871('0xb4')](_0x2039e8[_0xe871('0x71')],{})[_0xe871('0x2e')](respondWithResult(_0x4c3785,0xc9))[_0xe871('0x39')](handleError(_0x4c3785,null));};exports[_0xe871('0x2d')]=function(_0x4b8196,_0x22e674){if(_0x4b8196[_0xe871('0x71')]['id']){delete _0x4b8196[_0xe871('0x71')]['id'];}return db[_0xe871('0x9b')][_0xe871('0x66')]({'where':{'id':_0x4b8196[_0xe871('0xb1')]['id']}})[_0xe871('0x2e')](handleEntityNotFound(_0x22e674,null))[_0xe871('0x2e')](saveUpdates(_0x4b8196['body'],null))[_0xe871('0x2e')](respondWithResult(_0x22e674,null))[_0xe871('0x39')](handleError(_0x22e674,null));};exports[_0xe871('0xb5')]=function(_0x2fe9ea,_0x26db84){return db[_0xe871('0x9b')][_0xe871('0x66')]({'where':{'id':_0x2fe9ea[_0xe871('0xb1')]['id']}})[_0xe871('0x2e')](handleEntityNotFound(_0x26db84,null))[_0xe871('0x2e')](removeEntity(_0x26db84,null))[_0xe871('0x39')](handleError(_0x26db84,null));};exports[_0xe871('0xb6')]=function(_0x3513cb,_0x1e5ffe){return db['WhatsappInteraction'][_0xe871('0xb6')]()[_0xe871('0x2e')](respondWithResult(_0x1e5ffe,null))[_0xe871('0x39')](handleError(_0x1e5ffe,null));};exports[_0xe871('0xb7')]=function(_0xa05fbf,_0x36ccf3,_0x5d7ec1){return db[_0xe871('0xb8')][_0xe871('0x66')]({'where':{'id':_0xa05fbf[_0xe871('0xb1')]['id']}})[_0xe871('0x2e')](handleEntityNotFound(_0x36ccf3,null))[_0xe871('0x2e')](function(_0x1a350e){if(_0x1a350e){return _0x1a350e[_0xe871('0xb7')](_0xa05fbf['body'][_0xe871('0xb9')],_[_0xe871('0xba')](_0xa05fbf[_0xe871('0x71')],[_0xe871('0xb9'),'id'])||{});}})[_0xe871('0x2e')](respondWithResult(_0x36ccf3,null))[_0xe871('0x39')](handleError(_0x36ccf3,null));};exports[_0xe871('0xbb')]=function(_0x5b5644,_0x2e79ec,_0x2c6229){var _0x5cb87e={'raw':![],'where':{}};var _0x7499e7={};var _0x5d1866={'count':0x0,'rows':[]};return db[_0xe871('0x9b')]['findOne']({'where':{'id':_0x5b5644[_0xe871('0xb1')]['id']}})[_0xe871('0x2e')](handleEntityNotFound(_0x2e79ec,null))[_0xe871('0x2e')](function(_0x28a904){if(_0x28a904){_0x7499e7[_0xe871('0x43')]=_['keys'](db[_0xe871('0xb8')]['rawAttributes']);_0x7499e7[_0xe871('0x3f')]=_['keys'](_0x5b5644[_0xe871('0x3f')]);_0x7499e7['filters']=_[_0xe871('0x3e')](_0x7499e7[_0xe871('0x43')],_0x7499e7[_0xe871('0x3f')]);_0x5cb87e[_0xe871('0x40')]=_[_0xe871('0x3e')](_0x7499e7[_0xe871('0x43')],qs[_0xe871('0x41')](_0x5b5644['query'][_0xe871('0x41')]));_0x5cb87e['attributes']=_0x5cb87e['attributes'][_0xe871('0x42')]?_0x5cb87e[_0xe871('0x40')]:_0x7499e7[_0xe871('0x43')];if(!_0x5b5644['query'][_0xe871('0xbc')](_0xe871('0x44'))){_0x5cb87e[_0xe871('0x25')]=qs[_0xe871('0x25')](_0x5b5644['query'][_0xe871('0x25')]);_0x5cb87e[_0xe871('0x27')]=qs[_0xe871('0x27')](_0x5b5644[_0xe871('0x3f')]['offset']);}_0x5cb87e['order']=qs[_0xe871('0x46')](_0x5b5644['query'][_0xe871('0x46')]);_0x5cb87e[_0xe871('0x47')]=qs[_0xe871('0x3d')](_[_0xe871('0x48')](_0x5b5644[_0xe871('0x3f')],_0x7499e7[_0xe871('0x3d')]));_0x5cb87e['where'][_0xe871('0xbd')]=_0x28a904['id'];if(_0x5b5644['query']['filter']){_0x5cb87e[_0xe871('0x47')]=_[_0xe871('0x9a')](_0x5cb87e['where'],{'$or':_[_0xe871('0x3c')](_0x5cb87e['attributes'],function(_0x3dd8fe){var _0x39bb25={};_0x39bb25[_0x3dd8fe]={'$like':'%'+_0x5b5644[_0xe871('0x3f')][_0xe871('0x7e')]+'%'};return _0x39bb25;})});}if(_0x5b5644[_0xe871('0x3f')][_0xe871('0xbe')]){var _0x4efaf5=_0x5b5644['query']['$gte'][_0xe871('0x36')](',');var _0x34eb65={};_0x34eb65[_0x4efaf5[0x0]]={'$gte':moment(_0x4efaf5[0x1])[_0xe871('0xbf')](_0xe871('0xc0'))};_0x5cb87e[_0xe871('0x47')]=_['merge'](_0x5cb87e['where'],_0x34eb65);}_0x5cb87e=_[_0xe871('0x9a')]({},_0x5cb87e,_0x5b5644[_0xe871('0xb3')]);return db['WhatsappMessage'][_0xe871('0x26')]({'where':_0x5cb87e['where']})[_0xe871('0x2e')](function(_0x331f15){_0x5d1866[_0xe871('0x26')]=_0x331f15;if(_0x5b5644[_0xe871('0x3f')]['includeAll']){_0x5cb87e[_0xe871('0xc1')]=[{'all':!![]}];}return db[_0xe871('0xb8')][_0xe871('0xc2')](_0x5cb87e);})['then'](function(_0x1de875){_0x5d1866[_0xe871('0xb0')]=_0x1de875;return _0x5d1866;});}})[_0xe871('0x2e')](respondWithFilteredResult(_0x2e79ec,_0x5cb87e))[_0xe871('0x39')](handleError(_0x2e79ec,null));};exports['addTags']=function(_0x2297d2,_0x412ca5,_0x4a2442){return db[_0xe871('0x9b')][_0xe871('0x66')]({'where':{'id':_0x2297d2[_0xe871('0xb1')]['id']}})[_0xe871('0x2e')](handleEntityNotFound(_0x412ca5,null))[_0xe871('0x2e')](function(_0x5a728c){if(_0x5a728c){return _0x5a728c[_0xe871('0xc3')](_0x2297d2['body']['ids'],_[_0xe871('0xba')](_0x2297d2[_0xe871('0x71')],[_0xe871('0xb9'),'id'])||{})[_0xe871('0xc4')](function(){return db[_0xe871('0x6c')][_0xe871('0xc2')]({'attributes':['id',_0xe871('0x31'),_0xe871('0x4b')],'where':{'id':_0x2297d2[_0xe871('0x71')][_0xe871('0xb9')]}});})['then'](function(_0x550bd9){socket[_0xe871('0xc5')]('whatsappInteractionTags:save',{'id':Number(_0x2297d2['params']['id']),'tags':_0x550bd9||[]});return{'id':Number(_0x2297d2[_0xe871('0xb1')]['id']),'tags':_0x550bd9||[]};});}})[_0xe871('0x2e')](respondWithResult(_0x412ca5,null))['catch'](handleError(_0x412ca5,null));};exports[_0xe871('0xc6')]=function(_0x319aa1,_0x2797b8,_0x411174){return db['WhatsappInteraction'][_0xe871('0x66')]({'where':{'id':_0x319aa1[_0xe871('0xb1')]['id']}})['then'](handleEntityNotFound(_0x2797b8,null))[_0xe871('0x2e')](function(_0x615d99){if(_0x615d99){return _0x615d99['removeTags'](_0x319aa1['query'][_0xe871('0xb9')]);}})['then'](respondWithStatusCode(_0x2797b8,null))[_0xe871('0x39')](handleError(_0x2797b8,null));};exports['download']=function(_0x5ed2a3,_0x10391b){var _0xa51f8e=moment()[_0xe871('0xc7')]()[_0xe871('0x98')]();var _0x6e0cad=path[_0xe871('0xc8')](config['root'],_0xe871('0xc9'),_0xe871('0xca'),'tmp');var _0xdacc29=path[_0xe871('0xc8')](config[_0xe871('0xcb')],_0xe871('0xc9'),_0xe871('0xca'),_0xe871('0xcc'));var _0x64babc=path[_0xe871('0xc8')](_0x6e0cad,_0xa51f8e);var _0x3d1e28=util[_0xe871('0xbf')]('transcript-%d-%s.zip',_0x5ed2a3['params']['id'],_0xa51f8e);var _0x26bf4e=path[_0xe871('0xc8')](_0x6e0cad,_0x3d1e28);var _0xc982b4=[];_0xc982b4[_0xe871('0x38')]({'model':db[_0xe871('0x6e')],'as':'User','attributes':['id',_0xe871('0x33')],'raw':!![]});_0xc982b4[_0xe871('0x38')]({'model':db[_0xe871('0xcd')],'as':_0xe871('0xce'),'attributes':['id','firstName',_0xe871('0xcf')],'raw':!![]});if(_0x5ed2a3[_0xe871('0x3f')][_0xe871('0xcc')]){_0xc982b4['push']({'model':db[_0xe871('0xd0')],'as':'Attachment','raw':!![]});}var _0x273c3a=[{'model':db[_0xe871('0xb8')],'as':_0xe871('0xd1'),'attributes':['id',_0xe871('0x71'),'createdAt',_0xe871('0xd2'),_0xe871('0xd3'),'read'],'include':_0xc982b4}];_0x273c3a['push']({'model':db[_0xe871('0xd4')],'as':_0xe871('0xd5'),'attributes':['id',_0xe871('0x31')]});_0x273c3a[_0xe871('0x38')]({'model':db[_0xe871('0x6e')],'as':'Owner','attributes':['id',_0xe871('0x33')]});return db[_0xe871('0x9b')]['find']({'where':{'id':_0x5ed2a3[_0xe871('0xb1')]['id']},'include':_0x273c3a})[_0xe871('0x2e')](handleEntityNotFound(_0x10391b,null))['then'](function(_0x3845f2){if(_0x3845f2){var _0x1c5122=_0x3845f2[_0xe871('0xd6')]({'plain':!![]});fs['mkdirSync'](_0x64babc);var _0x492285={'channel':_0xe871('0xd7'),'account':_0x1c5122[_0xe871('0xd5')][_0xe871('0x31')],'agent':_0x1c5122[_0xe871('0xd8')]?_0x1c5122[_0xe871('0xd8')][_0xe871('0x33')]:_0xe871('0xd9'),'createdAt':moment(_0x1c5122[_0xe871('0x77')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe871('0x98')](),'closedAt':_0x1c5122[_0xe871('0xda')]?moment(_0x1c5122['closedAt'])[_0xe871('0xbf')](_0xe871('0xc0'))[_0xe871('0x98')]():'','disposition':_0x1c5122[_0xe871('0xdb')],'messages':_(_0x1c5122[_0xe871('0xd1')])['filter']({'secret':![]})['map'](function(_0x38fe5d){if(_0x38fe5d['Attachment']){var _0x5c8ac7=path['join'](_0xdacc29,_0x38fe5d[_0xe871('0xd0')]['basename']);if(fs[_0xe871('0xdc')](_0x5c8ac7)){fs[_0xe871('0xdd')](_0x5c8ac7)[_0xe871('0xde')](fs[_0xe871('0xdf')](path[_0xe871('0xc8')](_0x64babc,_0x38fe5d['Attachment']['basename'])));}}return{'date':moment(_0x38fe5d[_0xe871('0x77')])['format'](_0xe871('0xc0'))[_0xe871('0x98')](),'sender':_0x38fe5d['direction']==='out'?_0x38fe5d['User']?_0x38fe5d[_0xe871('0x6e')][_0xe871('0x33')]:_0xe871('0xe0'):_0x38fe5d[_0xe871('0xce')][_0xe871('0xe1')]+(_0x38fe5d['Contact']['lastName']?'\x20'+_0x38fe5d[_0xe871('0xce')][_0xe871('0xcf')]:''),'body':_0x38fe5d[_0xe871('0xd0')]?_0x38fe5d[_0xe871('0xd0')][_0xe871('0xe2')]:_0x38fe5d[_0xe871('0x71')],'direction':_0x38fe5d[_0xe871('0xd2')]===_0xe871('0xe3')?'A':'C','secret':_0x38fe5d[_0xe871('0xd3')],'read':_0x38fe5d[_0xe871('0x7b')],'attachment':_0x38fe5d['Attachment']};})[_0xe871('0x60')]()};return ejs['renderFile'](path[_0xe871('0xc8')](config['root'],_0xe871('0xc9'),_0xe871('0xe4'),_0xe871('0xe5')),{'interaction':_0x492285})['then'](function(_0x2f0ee2){var _0x390229=path['join'](_0x64babc,_0xe871('0xe6')+_0x1c5122['id']+'-'+_0xa51f8e+'.pdf');var _0x1a49d1={'path':_0x390229,'channel':_0xe871('0xd7'),'interactionId':_0x1c5122['id']};return pdf[_0xe871('0xe7')](_0x2f0ee2,_0x1a49d1);})[_0xe871('0x2e')](function(){return new BPromise(function(_0xc7fcd2,_0x14a2f8){zipdir(_0x64babc,{'saveTo':_0x26bf4e},function(_0x183af9,_0x264448){if(_0x183af9)return _0x14a2f8(_0x183af9);return _0xc7fcd2(_0x264448);});})[_0xe871('0x2e')](function(){return new BPromise(function(_0x4ac865,_0x1ed5cb){rimraf(_0x64babc,function(_0x98705c){if(_0x98705c)_0x1ed5cb(_0x98705c);return _0x4ac865();});});})[_0xe871('0x2e')](function(){return _0x10391b[_0xe871('0xe8')](_0x26bf4e,_0x3d1e28,function(_0x106a31){if(_0x106a31){console['log'](_0xe871('0xe9'),_0x106a31);}else{fs[_0xe871('0xea')](_0x26bf4e);}});});});}else{return _0x10391b[_0xe871('0xeb')](0xc8);}})['catch'](handleError(_0x10391b,null));}; \ No newline at end of file +var _0xf6c6=['i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.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.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','WhatsappMessage','ids','omit','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','files','server','attachments','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','System','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','fullname','TagIds','split','forEach','push','catch','index','WhatsappInteraction','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','order','sort','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','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?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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)','contactName','DESC','t.id\x20IN\x20?','resolve'];(function(_0x22aca1,_0x50228b){var _0x49b0df=function(_0x2675e0){while(--_0x2675e0){_0x22aca1['push'](_0x22aca1['shift']());}};_0x49b0df(++_0x50228b);}(_0xf6c6,0x154));var _0x6f6c=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xf6c6[_0x36ed3c];return _0x52a2e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f6c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f6c('0x1'));var rp=require(_0x6f6c('0x2'));var moment=require(_0x6f6c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f6c('0x4'));var util=require(_0x6f6c('0x5'));var path=require(_0x6f6c('0x6'));var sox=require('sox');var csv=require(_0x6f6c('0x7'));var ejs=require(_0x6f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x6f6c('0x9'));var _=require(_0x6f6c('0xa'));var squel=require(_0x6f6c('0xb'));var crypto=require(_0x6f6c('0xc'));var jsforce=require(_0x6f6c('0xd'));var deskjs=require(_0x6f6c('0xe'));var toCsv=require(_0x6f6c('0x7'));var querystring=require(_0x6f6c('0xf'));var Papa=require(_0x6f6c('0x10'));var Redis=require(_0x6f6c('0x11'));var authService=require(_0x6f6c('0x12'));var qs=require(_0x6f6c('0x13'));var as=require(_0x6f6c('0x14'));var pdf=require(_0x6f6c('0x15'));var hardwareService=require(_0x6f6c('0x16'));var logger=require(_0x6f6c('0x17'))('api');var utils=require(_0x6f6c('0x18'));var config=require(_0x6f6c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f6c('0x1a'))['db'];config[_0x6f6c('0x1b')]=_['defaults'](config['redis'],{'host':_0x6f6c('0x1c'),'port':0x18eb});var socket=require(_0x6f6c('0x1d'))(new Redis(config[_0x6f6c('0x1b')]));require(_0x6f6c('0x1e'))['register'](socket);function respondWithStatusCode(_0x56e278,_0x16f49e){_0x16f49e=_0x16f49e||0xcc;return function(_0x357dbd){if(_0x357dbd){return _0x56e278[_0x6f6c('0x1f')](_0x16f49e);}return _0x56e278[_0x6f6c('0x20')](_0x16f49e)[_0x6f6c('0x21')]();};}function respondWithResult(_0x105525,_0x2fb74d){_0x2fb74d=_0x2fb74d||0xc8;return function(_0x282b7f){if(_0x282b7f){return _0x105525[_0x6f6c('0x20')](_0x2fb74d)[_0x6f6c('0x22')](_0x282b7f);}};}function respondWithFilteredResult(_0xca6404,_0x57da4e){return function(_0x2d7a4b){if(_0x2d7a4b){var _0x427db3=typeof _0x57da4e['offset']===_0x6f6c('0x23')&&typeof _0x57da4e[_0x6f6c('0x24')]===_0x6f6c('0x23');var _0x251b93=_0x2d7a4b[_0x6f6c('0x25')];var _0x3d98cc=_0x427db3?0x0:_0x57da4e['offset'];var _0x56f536=_0x427db3?_0x2d7a4b[_0x6f6c('0x25')]:_0x57da4e[_0x6f6c('0x26')]+_0x57da4e[_0x6f6c('0x24')];var _0x306f9c;if(_0x56f536>=_0x251b93){_0x56f536=_0x251b93;_0x306f9c=0xc8;}else{_0x306f9c=0xce;}_0xca6404[_0x6f6c('0x20')](_0x306f9c);return _0xca6404[_0x6f6c('0x27')](_0x6f6c('0x28'),_0x3d98cc+'-'+_0x56f536+'/'+_0x251b93)['json'](_0x2d7a4b);}return null;};}function patchUpdates(_0x277821){return function(_0x2f7f14){try{jsonpatch[_0x6f6c('0x29')](_0x2f7f14,_0x277821,!![]);}catch(_0x4e8ce5){return BPromise[_0x6f6c('0x2a')](_0x4e8ce5);}return _0x2f7f14['save']();};}function saveUpdates(_0x4e9258,_0x3828d3){return function(_0x2a1ebe){if(_0x2a1ebe){return _0x2a1ebe[_0x6f6c('0x2b')](_0x4e9258)[_0x6f6c('0x2c')](function(_0x25863f){return _0x25863f;});}return null;};}function removeEntity(_0x5c0adf,_0x4bbf82){return function(_0x3aefbf){if(_0x3aefbf){return _0x3aefbf[_0x6f6c('0x2d')]()[_0x6f6c('0x2c')](function(){_0x5c0adf[_0x6f6c('0x20')](0xcc)[_0x6f6c('0x21')]();});}};}function handleEntityNotFound(_0x348328,_0x2c344f){return function(_0x22ef30){if(!_0x22ef30){_0x348328['sendStatus'](0x194);}return _0x22ef30;};}function handleError(_0x117955,_0x26c6a1){_0x26c6a1=_0x26c6a1||0x1f4;return function(_0x81501d){logger[_0x6f6c('0x2e')](_0x81501d['stack']);if(_0x81501d[_0x6f6c('0x2f')]){delete _0x81501d[_0x6f6c('0x2f')];}_0x117955[_0x6f6c('0x20')](_0x26c6a1)[_0x6f6c('0x30')](_0x81501d);};}function getInteractionUsers(_0x1b34e8,_0xca0504){return new BPromise(function(_0x61795c,_0x490548){try{if(_0xca0504[_0x1b34e8['id']]){_0x1b34e8['Users']=_[_0x6f6c('0x31')](_0xca0504[_0x1b34e8['id']],function(_0x4abfa0){return{'id':_0x4abfa0['id'],'fullname':_0x4abfa0[_0x6f6c('0x32')]};});}}catch(_0x1cc3bd){_0x490548(_0x1cc3bd);}_0x61795c(_0x1b34e8);});}function getInteractionTags(_0x52733a,_0x3e0da6){return new BPromise(function(_0x3c2b41,_0x46e6b4){try{if(_0x52733a['TagIds']){_0x52733a['Tags']=[];_0x52733a[_0x6f6c('0x33')][_0x6f6c('0x34')](',')[_0x6f6c('0x35')](function(_0xf48611){_0x52733a['Tags'][_0x6f6c('0x36')](_0x3e0da6[_0xf48611]);});}delete _0x52733a[_0x6f6c('0x33')];}catch(_0x3e032b){_0x46e6b4(_0x3e032b);}_0x3c2b41(_0x52733a);});}function updateWhatsappInteraction(_0x1ba993,_0x45aebf,_0x239de9){return new BPromise(function(_0x26e51b,_0x30b262){return getInteractionUsers(_0x1ba993,_0x239de9)[_0x6f6c('0x2c')](function(_0x58bb6c){return getInteractionTags(_0x58bb6c,_0x45aebf);})[_0x6f6c('0x2c')](function(_0x5ecea1){_0x26e51b(_0x5ecea1);})[_0x6f6c('0x37')](function(_0x461b18){_0x30b262(_0x461b18);});});}exports[_0x6f6c('0x38')]=function(_0x575ed3,_0x293702){var _0x2453eb={},_0x2b71e7={},_0x3e1424={'count':0x0,'rows':[]};var _0x4a4265=_[_0x6f6c('0x31')](db[_0x6f6c('0x39')]['rawAttributes'],function(_0x25e1f8){return{'name':_0x25e1f8[_0x6f6c('0x3a')],'type':_0x25e1f8[_0x6f6c('0x3b')]['key']};});_0x2b71e7['model']=_[_0x6f6c('0x31')](_0x4a4265,_0x6f6c('0x2f'));_0x2b71e7['query']=_[_0x6f6c('0x3c')](_0x575ed3['query']);_0x2b71e7[_0x6f6c('0x3d')]=_[_0x6f6c('0x3e')](_0x2b71e7[_0x6f6c('0x3f')],_0x2b71e7['query']);_0x2453eb[_0x6f6c('0x40')]=_[_0x6f6c('0x3e')](_0x2b71e7[_0x6f6c('0x3f')],qs[_0x6f6c('0x41')](_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x41')]));_0x2453eb[_0x6f6c('0x40')]=_0x2453eb[_0x6f6c('0x40')][_0x6f6c('0x43')]?_0x2453eb[_0x6f6c('0x40')]:_0x2b71e7['model'];if(!_0x575ed3[_0x6f6c('0x42')]['hasOwnProperty']('nolimit')){_0x2453eb[_0x6f6c('0x24')]=qs[_0x6f6c('0x24')](_0x575ed3['query'][_0x6f6c('0x24')]);_0x2453eb[_0x6f6c('0x26')]=qs[_0x6f6c('0x26')](_0x575ed3[_0x6f6c('0x42')]['offset']);}_0x2453eb[_0x6f6c('0x44')]=qs['sort'](_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x45')]);_0x2453eb['where']=qs[_0x6f6c('0x3d')](_[_0x6f6c('0x46')](_0x575ed3[_0x6f6c('0x42')],_0x2b71e7['filters']),_0x4a4265);var _0x5e3c3a=[];var _0x55f56d=squel[_0x6f6c('0x47')]()[_0x6f6c('0x48')]('id')[_0x6f6c('0x48')](_0x6f6c('0x2f'))[_0x6f6c('0x48')](_0x6f6c('0x49'))['from'](_0x6f6c('0x4a'));var _0x483593=squel['select']()[_0x6f6c('0x48')](_0x6f6c('0x4b'))['field'](_0x6f6c('0x4c'))[_0x6f6c('0x48')]('ui.WhatsappInteractionId')[_0x6f6c('0x4d')](_0x6f6c('0x4e'),'ui')[_0x6f6c('0x4f')](_0x6f6c('0x50'),'u',_0x6f6c('0x51'));var _0x1414f7=squel[_0x6f6c('0x47')]()[_0x6f6c('0x4d')](_0x6f6c('0x52'),'i')[_0x6f6c('0x4f')](_0x6f6c('0x53'),'c',_0x6f6c('0x54'))[_0x6f6c('0x4f')](_0x6f6c('0x50'),'o',_0x6f6c('0x55'))[_0x6f6c('0x4f')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x6f6c('0x4f')](_0x6f6c('0x56'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x6f6c('0x4f')](_0x6f6c('0x57'),'it',_0x6f6c('0x58'))['left_join'](_0x6f6c('0x4a'),'t',_0x6f6c('0x59'));var _0x131b2c=squel[_0x6f6c('0x5a')]();var _0x4b682a=[];var _0x4dee76=squel['expr']();var _0x1cea8d;if(_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x5b')]){_0x1cea8d=as[_0x6f6c('0x5c')](_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x5b')]);var _0x3223fe=_0x1cea8d[_0x6f6c('0x5d')];for(var _0x119fba=0x0;_0x119fba<_0x1cea8d[_0x6f6c('0x5e')][_0x6f6c('0x43')];_0x119fba++){var _0x36782a=_0x1cea8d[_0x6f6c('0x5e')][_0x119fba];var _0x1e5395='i';var _0xa73889=_['find'](_0x4a4265,[_0x6f6c('0x2f'),_0x36782a[_0x6f6c('0x48')]]);if(!_0xa73889){switch(_0x36782a[_0x6f6c('0x48')]){case _0x6f6c('0x5f'):if(_0x36782a[_0x6f6c('0x60')]==0x1){_0x1414f7[_0x6f6c('0x61')]('`'+_0x36782a['field']+_0x6f6c('0x62'));}else{_0x1414f7[_0x6f6c('0x61')]('`'+_0x36782a[_0x6f6c('0x48')]+'`\x20>\x200');}break;case'Contact':if(_0x36782a[_0x6f6c('0x63')]===_0x6f6c('0x64')){if(_0x36782a[_0x6f6c('0x60')]['split']('\x20')[_0x6f6c('0x43')]>0x1){_0x131b2c[_0x3223fe](_0x6f6c('0x65'),qs['getFullTextValue'](_0x36782a[_0x6f6c('0x60')]),null);}else{var _0x34c0b4='%'+_0x36782a[_0x6f6c('0x60')]+'%';_0x131b2c[_0x3223fe](_0x6f6c('0x66'),_0x34c0b4,_0x34c0b4,_0x34c0b4);}}else{_0xa73889=_[_0x6f6c('0x67')](_0x4a4265,[_0x6f6c('0x2f'),_0x6f6c('0x68')]);_0x36782a[_0x6f6c('0x48')]=_0x6f6c('0x68');_0x322239=as[_0x6f6c('0x69')](_0x1e5395,_0xa73889[_0x6f6c('0x3b')],_0x36782a);_0x131b2c[_0x3223fe](_0x322239[_0x6f6c('0x6a')],_0x322239['value'][_0x6f6c('0x6b')],_0x322239[_0x6f6c('0x60')][_0x6f6c('0x21')]);}break;case _0x6f6c('0x6c'):var _0x3f4c1f=_0x36782a[_0x6f6c('0x60')][_0x6f6c('0x34')](',')['map'](function(_0x359a57){return Number(_0x359a57);});_0x3f4c1f[_0x6f6c('0x35')](function(_0x3cfd4d){_0x4dee76['or'](_0x6f6c('0x6d'),'%,'+_0x3cfd4d+',%');});_0x4b682a=_['union'](_0x4b682a,_0x3f4c1f);break;case'User':if(_0x36782a[_0x6f6c('0x63')]===_0x6f6c('0x64')){_0x131b2c[_0x3223fe]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x36782a['value']+'%',null);}else{_0xa73889=_[_0x6f6c('0x67')](_0x4a4265,['name',_0x6f6c('0x6e')]);_0x36782a[_0x6f6c('0x48')]=_0x6f6c('0x6e');_0x322239=as[_0x6f6c('0x69')](_0x1e5395,_0xa73889['type'],_0x36782a);_0x131b2c[_0x3223fe](_0x322239[_0x6f6c('0x6a')],_0x322239[_0x6f6c('0x60')][_0x6f6c('0x6b')],_0x322239['value']['end']);}break;case'body':_0x322239=as[_0x6f6c('0x69')]('me',null,_0x36782a);_0x131b2c[_0x3223fe](_0x322239['text'],_0x322239['value']['start'],_0x322239[_0x6f6c('0x60')][_0x6f6c('0x21')]);break;}}else{var _0x322239=as[_0x6f6c('0x69')](_0x1e5395,_0xa73889[_0x6f6c('0x3b')],_0x36782a);_0x131b2c[_0x3223fe](_0x322239[_0x6f6c('0x6a')],_0x322239[_0x6f6c('0x60')]['start'],_0x322239[_0x6f6c('0x60')][_0x6f6c('0x21')]);}}}else{var _0x35847c=_(_0x575ed3['query'])[_0x6f6c('0x3c')]()[_0x6f6c('0x31')](function(_0x2a845a){return _[_0x6f6c('0x6f')](_0x4a4265,[_0x6f6c('0x2f'),_0x2a845a])?_0x2a845a:undefined;})[_0x6f6c('0x70')]()[_0x6f6c('0x60')]();if(!_[_0x6f6c('0x71')](_0x35847c)){_0x35847c[_0x6f6c('0x35')](function(_0x429b29){if(_0x429b29===_0x6f6c('0x72')){_0x1414f7[_0x6f6c('0x73')](_0x6f6c('0x74'),[][_0x6f6c('0x75')](_0x575ed3['query'][_0x429b29]));}else if(_0x429b29===_0x6f6c('0x76')){var _0x570dc8=JSON[_0x6f6c('0x77')](_0x575ed3['query'][_0x429b29])['$gte'];var _0x3c57f4=JSON[_0x6f6c('0x77')](_0x575ed3[_0x6f6c('0x42')][_0x429b29])['$lte'];_0x1414f7['where'](_0x6f6c('0x78'),_0x570dc8,_0x3c57f4);}else{if(_0x575ed3[_0x6f6c('0x42')][_0x429b29]===_0x6f6c('0x79')){_0x1414f7[_0x6f6c('0x73')]('i.'+_0x429b29+_0x6f6c('0x7a'));}else{_0x1414f7['where']('i.'+_0x429b29+_0x6f6c('0x7b'),_0x575ed3[_0x6f6c('0x42')][_0x429b29]);}}});}if(_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x7c')]){if(_0x575ed3['query']['read']==0x1){_0x1414f7[_0x6f6c('0x61')]('`unreadMessages`\x20=\x200');}else{_0x1414f7[_0x6f6c('0x61')](_0x6f6c('0x7d'));}}if(_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x7e')]){_0x4b682a=_[_0x6f6c('0x7f')](_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x7e')])?_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x7e')]:new Array(_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x7e')]);_0x4b682a['forEach'](function(_0xfc735d){_0x4dee76['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xfc735d+',%');});}if(_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x80')]){var _0x11b270=_0x575ed3[_0x6f6c('0x42')][_0x6f6c('0x80')][_0x6f6c('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x11b270)){_0x131b2c['or'](_0x6f6c('0x82'),_0x11b270+'%')['or'](_0x6f6c('0x83'),_0x11b270+'%');}else{_0x131b2c['or'](_0x6f6c('0x84'),qs[_0x6f6c('0x85')](_0x11b270))['or'](_0x6f6c('0x86'),_0x11b270+'%');}}}_0x1414f7[_0x6f6c('0x73')](_0x131b2c);_0x1414f7[_0x6f6c('0x87')](_0x6f6c('0x88'));var _0x54a321={'type':db[_0x6f6c('0x89')][_0x6f6c('0x8a')][_0x6f6c('0x8b')],'raw':!![]};var _0x36d245=_0x1414f7[_0x6f6c('0x8c')]();_0x36d245[_0x6f6c('0x48')]('i.id');_0x36d245[_0x6f6c('0x48')](_0x6f6c('0x8d'),_0x6f6c('0x5f'));if(_0x2453eb[_0x6f6c('0x44')]){_0x2453eb[_0x6f6c('0x44')][_0x6f6c('0x35')](function(_0x239068){var _0x3a85e9=_0x239068[0x0]===_0x6f6c('0x8e')?_0x239068[0x0]:'i.'+_0x239068[0x0];_0x1414f7['order'](_0x3a85e9,_0x239068[0x1]===_0x6f6c('0x8f')?![]:!![]);});}if(!_[_0x6f6c('0x71')](_0x4b682a)){_0x1414f7[_0x6f6c('0x61')](_0x4dee76);_0x36d245[_0x6f6c('0x73')](_0x6f6c('0x90'),_0x4b682a);}BPromise[_0x6f6c('0x91')]()[_0x6f6c('0x2c')](function(){if(!_0x1cea8d){if(_0x575ed3[_0x6f6c('0x42')]['WhatsappAccountId'])return;_0x36d245[_0x6f6c('0x73')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x1414f7[_0x6f6c('0x73')](_0x6f6c('0x92'));return;}if(_0x575ed3[_0x6f6c('0x93')][_0x6f6c('0x94')]!==_0x6f6c('0x95'))return;return _0x575ed3[_0x6f6c('0x93')][_0x6f6c('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5eb824){if(_[_0x6f6c('0x71')](_0x5eb824)){_0x36d245[_0x6f6c('0x73')](_0x6f6c('0x97'));_0x1414f7[_0x6f6c('0x73')](_0x6f6c('0x97'));}else{_0x36d245['where'](_0x6f6c('0x74'),_[_0x6f6c('0x31')](_0x5eb824,'id'));_0x1414f7['where'](_0x6f6c('0x74'),_[_0x6f6c('0x31')](_0x5eb824,'id'));}});})['then'](function(){if(_0x575ed3[_0x6f6c('0x93')][_0x6f6c('0x94')]==='agent'&&!_0x1cea8d&&!_0x575ed3['query']['WhatsappAccountId'])return[];return db[_0x6f6c('0x98')][_0x6f6c('0x42')](_0x36d245['toString'](),_0x54a321);})[_0x6f6c('0x2c')](function(_0x22bf19){_0x3e1424[_0x6f6c('0x25')]=_0x22bf19[_0x6f6c('0x43')];if(_0x3e1424[_0x6f6c('0x25')]===0x0)return[];return db['sequelize'][_0x6f6c('0x42')](_0x55f56d[_0x6f6c('0x99')](),_0x54a321)[_0x6f6c('0x2c')](function(_0x512e25){_0x5e3c3a=_[_0x6f6c('0x9a')](_0x512e25,'id');_0x54a321=_['merge'](_0x54a321,{'model':db[_0x6f6c('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x575ed3['query']['fields']){_0x2453eb['attributes']['forEach'](function(_0x3e23e5){_0x1414f7[_0x6f6c('0x48')]('i.'+_0x3e23e5);});}else{_0x1414f7[_0x6f6c('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6f6c('0x5f'));_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0x9b'),_0x6f6c('0x9c'));_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0x9d'),_0x6f6c('0x9e'));_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0x9f'),'contactName');_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0xa0'));_0x1414f7['field'](_0x6f6c('0xa1'),'Contact.firstName');_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0xa2'),'Contact.lastName');_0x1414f7['field'](_0x6f6c('0xa3'),_0x6f6c('0xa4'));_0x1414f7['field'](_0x6f6c('0xa5'),_0x6f6c('0xa6'));_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0xa7'),_0x6f6c('0xa8'));_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0xa9'),_0x6f6c('0xaa'));_0x1414f7[_0x6f6c('0x48')]('o.fullname',_0x6f6c('0xab'));_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0xac'),_0x6f6c('0xad'));_0x1414f7[_0x6f6c('0x48')](_0x6f6c('0xae'),_0x6f6c('0x33'));}if(_0x2453eb[_0x6f6c('0x24')])_0x1414f7[_0x6f6c('0x24')](_0x2453eb[_0x6f6c('0x24')]);if(_0x2453eb[_0x6f6c('0x26')])_0x1414f7['offset'](_0x2453eb['offset']);return db['sequelize'][_0x6f6c('0x42')](_0x1414f7[_0x6f6c('0x99')](),_0x54a321);})[_0x6f6c('0x2c')](function(_0x1cfdc2){if(_0x1cfdc2[_0x6f6c('0x43')]>0x0)_0x483593[_0x6f6c('0x73')](_0x6f6c('0xaf'),_[_0x6f6c('0x31')](_0x1cfdc2,'id'));return db[_0x6f6c('0x98')][_0x6f6c('0x42')](_0x483593[_0x6f6c('0x99')](),_0x54a321)[_0x6f6c('0x2c')](function(_0x1c7644){var _0x1c7f06=_[_0x6f6c('0xb0')](_0x1c7644,_0x6f6c('0xb1'));var _0x3a4fe6=[];_0x1cfdc2[_0x6f6c('0x35')](function(_0x53007b){_0x3a4fe6[_0x6f6c('0x36')](updateWhatsappInteraction(_0x53007b,_0x5e3c3a,_0x1c7f06));});return BPromise[_0x6f6c('0xb2')](_0x3a4fe6);});});})['then'](function(_0x406af6){_0x3e1424[_0x6f6c('0xb3')]=_0x406af6;return _0x3e1424;})[_0x6f6c('0x2c')](respondWithFilteredResult(_0x293702,_0x2453eb))[_0x6f6c('0x37')](handleError(_0x293702,null));};exports[_0x6f6c('0xb4')]=function(_0x3b4706,_0xc691c4){var _0x1ae4ad={'raw':![],'where':{'id':_0x3b4706[_0x6f6c('0xb5')]['id']}},_0x2fd4e3={};_0x2fd4e3[_0x6f6c('0x3f')]=_[_0x6f6c('0x3c')](db[_0x6f6c('0x39')][_0x6f6c('0xb6')]);_0x2fd4e3['query']=_['keys'](_0x3b4706[_0x6f6c('0x42')]);_0x2fd4e3[_0x6f6c('0x3d')]=_[_0x6f6c('0x3e')](_0x2fd4e3[_0x6f6c('0x3f')],_0x2fd4e3[_0x6f6c('0x42')]);_0x1ae4ad[_0x6f6c('0x40')]=_[_0x6f6c('0x3e')](_0x2fd4e3[_0x6f6c('0x3f')],qs[_0x6f6c('0x41')](_0x3b4706[_0x6f6c('0x42')][_0x6f6c('0x41')]));_0x1ae4ad[_0x6f6c('0x40')]=_0x1ae4ad[_0x6f6c('0x40')][_0x6f6c('0x43')]?_0x1ae4ad[_0x6f6c('0x40')]:_0x2fd4e3['model'];if(_0x3b4706[_0x6f6c('0x42')][_0x6f6c('0xb7')]){_0x1ae4ad[_0x6f6c('0xb8')]=[{'all':!![]}];}_0x1ae4ad=_[_0x6f6c('0xb9')]({},_0x1ae4ad,_0x3b4706[_0x6f6c('0xba')]);return db[_0x6f6c('0x39')][_0x6f6c('0x67')](_0x1ae4ad)[_0x6f6c('0x2c')](handleEntityNotFound(_0xc691c4,null))['then'](respondWithResult(_0xc691c4,null))['catch'](handleError(_0xc691c4,null));};exports[_0x6f6c('0xbb')]=function(_0x5da23c,_0x8fc481){return db['WhatsappInteraction']['create'](_0x5da23c['body'],{})['then'](respondWithResult(_0x8fc481,0xc9))[_0x6f6c('0x37')](handleError(_0x8fc481,null));};exports[_0x6f6c('0x2b')]=function(_0x41e580,_0x5c7621){if(_0x41e580[_0x6f6c('0xbc')]['id']){delete _0x41e580['body']['id'];}return db['WhatsappInteraction'][_0x6f6c('0x67')]({'where':{'id':_0x41e580['params']['id']}})[_0x6f6c('0x2c')](handleEntityNotFound(_0x5c7621,null))[_0x6f6c('0x2c')](saveUpdates(_0x41e580['body'],null))[_0x6f6c('0x2c')](respondWithResult(_0x5c7621,null))['catch'](handleError(_0x5c7621,null));};exports[_0x6f6c('0x2d')]=function(_0x5c99f4,_0x2a462c){return db[_0x6f6c('0x39')]['find']({'where':{'id':_0x5c99f4['params']['id']}})[_0x6f6c('0x2c')](handleEntityNotFound(_0x2a462c,null))[_0x6f6c('0x2c')](removeEntity(_0x2a462c,null))[_0x6f6c('0x37')](handleError(_0x2a462c,null));};exports['describe']=function(_0x77bcc5,_0x351154){return db['WhatsappInteraction'][_0x6f6c('0xbd')]()[_0x6f6c('0x2c')](respondWithResult(_0x351154,null))[_0x6f6c('0x37')](handleError(_0x351154,null));};exports[_0x6f6c('0xbe')]=function(_0x22f3fe,_0x4a3e54,_0x29e58d){return db[_0x6f6c('0xbf')][_0x6f6c('0x67')]({'where':{'id':_0x22f3fe[_0x6f6c('0xb5')]['id']}})[_0x6f6c('0x2c')](handleEntityNotFound(_0x4a3e54,null))[_0x6f6c('0x2c')](function(_0x519695){if(_0x519695){return _0x519695[_0x6f6c('0xbe')](_0x22f3fe[_0x6f6c('0xbc')][_0x6f6c('0xc0')],_[_0x6f6c('0xc1')](_0x22f3fe['body'],[_0x6f6c('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x4a3e54,null))['catch'](handleError(_0x4a3e54,null));};exports['getMessages']=function(_0x554d97,_0x131193,_0x3081f4){var _0x419c99={'raw':![],'where':{}};var _0x201cbc={};var _0x2f5295={'count':0x0,'rows':[]};return db[_0x6f6c('0x39')]['findOne']({'where':{'id':_0x554d97[_0x6f6c('0xb5')]['id']}})[_0x6f6c('0x2c')](handleEntityNotFound(_0x131193,null))[_0x6f6c('0x2c')](function(_0x3b9737){if(_0x3b9737){_0x201cbc[_0x6f6c('0x3f')]=_[_0x6f6c('0x3c')](db['WhatsappMessage'][_0x6f6c('0xb6')]);_0x201cbc[_0x6f6c('0x42')]=_[_0x6f6c('0x3c')](_0x554d97[_0x6f6c('0x42')]);_0x201cbc[_0x6f6c('0x3d')]=_['intersection'](_0x201cbc[_0x6f6c('0x3f')],_0x201cbc[_0x6f6c('0x42')]);_0x419c99[_0x6f6c('0x40')]=_[_0x6f6c('0x3e')](_0x201cbc[_0x6f6c('0x3f')],qs[_0x6f6c('0x41')](_0x554d97[_0x6f6c('0x42')][_0x6f6c('0x41')]));_0x419c99[_0x6f6c('0x40')]=_0x419c99[_0x6f6c('0x40')][_0x6f6c('0x43')]?_0x419c99[_0x6f6c('0x40')]:_0x201cbc['model'];if(!_0x554d97[_0x6f6c('0x42')][_0x6f6c('0xc2')](_0x6f6c('0xc3'))){_0x419c99['limit']=qs[_0x6f6c('0x24')](_0x554d97[_0x6f6c('0x42')][_0x6f6c('0x24')]);_0x419c99[_0x6f6c('0x26')]=qs[_0x6f6c('0x26')](_0x554d97[_0x6f6c('0x42')][_0x6f6c('0x26')]);}_0x419c99[_0x6f6c('0x44')]=qs['sort'](_0x554d97[_0x6f6c('0x42')][_0x6f6c('0x45')]);_0x419c99[_0x6f6c('0x73')]=qs[_0x6f6c('0x3d')](_[_0x6f6c('0x46')](_0x554d97[_0x6f6c('0x42')],_0x201cbc['filters']));_0x419c99[_0x6f6c('0x73')][_0x6f6c('0xb1')]=_0x3b9737['id'];if(_0x554d97[_0x6f6c('0x42')]['filter']){_0x419c99[_0x6f6c('0x73')]=_[_0x6f6c('0xb9')](_0x419c99[_0x6f6c('0x73')],{'$or':_[_0x6f6c('0x31')](_0x419c99[_0x6f6c('0x40')],function(_0x186df6){var _0x2234c3={};_0x2234c3[_0x186df6]={'$like':'%'+_0x554d97[_0x6f6c('0x42')]['filter']+'%'};return _0x2234c3;})});}if(_0x554d97['query'][_0x6f6c('0xc4')]){var _0x3fc079=_0x554d97[_0x6f6c('0x42')][_0x6f6c('0xc4')][_0x6f6c('0x34')](',');var _0x416e6b={};_0x416e6b[_0x3fc079[0x0]]={'$gte':moment(_0x3fc079[0x1])[_0x6f6c('0xc5')](_0x6f6c('0xc6'))};_0x419c99['where']=_[_0x6f6c('0xb9')](_0x419c99[_0x6f6c('0x73')],_0x416e6b);}_0x419c99=_[_0x6f6c('0xb9')]({},_0x419c99,_0x554d97[_0x6f6c('0xba')]);return db[_0x6f6c('0xbf')]['count']({'where':_0x419c99[_0x6f6c('0x73')]})['then'](function(_0x13dd6a){_0x2f5295['count']=_0x13dd6a;if(_0x554d97[_0x6f6c('0x42')][_0x6f6c('0xb7')]){_0x419c99['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x419c99);})['then'](function(_0x50533d){_0x2f5295[_0x6f6c('0xb3')]=_0x50533d;return _0x2f5295;});}})[_0x6f6c('0x2c')](respondWithFilteredResult(_0x131193,_0x419c99))[_0x6f6c('0x37')](handleError(_0x131193,null));};exports[_0x6f6c('0xc7')]=function(_0x4fcbe4,_0xcd4755,_0x1da394){return db[_0x6f6c('0x39')][_0x6f6c('0x67')]({'where':{'id':_0x4fcbe4[_0x6f6c('0xb5')]['id']}})[_0x6f6c('0x2c')](handleEntityNotFound(_0xcd4755,null))[_0x6f6c('0x2c')](function(_0x320910){if(_0x320910){return _0x320910[_0x6f6c('0xc8')](_0x4fcbe4[_0x6f6c('0xbc')]['ids'],_[_0x6f6c('0xc1')](_0x4fcbe4[_0x6f6c('0xbc')],[_0x6f6c('0xc0'),'id'])||{})[_0x6f6c('0xc9')](function(){return db[_0x6f6c('0x6c')]['findAll']({'attributes':['id',_0x6f6c('0x2f'),_0x6f6c('0x49')],'where':{'id':_0x4fcbe4[_0x6f6c('0xbc')][_0x6f6c('0xc0')]}});})[_0x6f6c('0x2c')](function(_0xf295c6){socket[_0x6f6c('0xca')](_0x6f6c('0xcb'),{'id':Number(_0x4fcbe4[_0x6f6c('0xb5')]['id']),'tags':_0xf295c6||[]});return{'id':Number(_0x4fcbe4[_0x6f6c('0xb5')]['id']),'tags':_0xf295c6||[]};});}})[_0x6f6c('0x2c')](respondWithResult(_0xcd4755,null))[_0x6f6c('0x37')](handleError(_0xcd4755,null));};exports[_0x6f6c('0xcc')]=function(_0x542037,_0x58a342,_0x18a07a){return db[_0x6f6c('0x39')][_0x6f6c('0x67')]({'where':{'id':_0x542037[_0x6f6c('0xb5')]['id']}})[_0x6f6c('0x2c')](handleEntityNotFound(_0x58a342,null))[_0x6f6c('0x2c')](function(_0x45e483){if(_0x45e483){return _0x45e483['removeTags'](_0x542037[_0x6f6c('0x42')]['ids']);}})[_0x6f6c('0x2c')](respondWithStatusCode(_0x58a342,null))['catch'](handleError(_0x58a342,null));};exports[_0x6f6c('0xcd')]=function(_0x564032,_0x9c80b8){var _0x592093=moment()[_0x6f6c('0xce')]()[_0x6f6c('0x99')]();var _0x33b11d=path[_0x6f6c('0xcf')](config[_0x6f6c('0xd0')],'server',_0x6f6c('0xd1'),'tmp');var _0x1f0cdd=path[_0x6f6c('0xcf')](config['root'],_0x6f6c('0xd2'),_0x6f6c('0xd1'),_0x6f6c('0xd3'));var _0x4b70f9=path['join'](_0x33b11d,_0x592093);var _0x2fa7ba=util[_0x6f6c('0xc5')](_0x6f6c('0xd4'),_0x564032[_0x6f6c('0xb5')]['id'],_0x592093);var _0xf4b669=path[_0x6f6c('0xcf')](_0x33b11d,_0x2fa7ba);var _0x1dd405=[];_0x1dd405['push']({'model':db[_0x6f6c('0xd5')],'as':_0x6f6c('0xd5'),'attributes':['id',_0x6f6c('0x32')],'raw':!![]});_0x1dd405[_0x6f6c('0x36')]({'model':db[_0x6f6c('0xd6')],'as':_0x6f6c('0xd7'),'attributes':['id',_0x6f6c('0xd8'),_0x6f6c('0xd9')],'raw':!![]});if(_0x564032[_0x6f6c('0x42')][_0x6f6c('0xd3')]){_0x1dd405[_0x6f6c('0x36')]({'model':db[_0x6f6c('0xda')],'as':_0x6f6c('0xda'),'raw':!![]});}var _0x4263a8=[{'model':db[_0x6f6c('0xbf')],'as':_0x6f6c('0xdb'),'attributes':['id','body',_0x6f6c('0x76'),_0x6f6c('0xdc'),_0x6f6c('0xdd'),_0x6f6c('0x7c')],'include':_0x1dd405}];_0x4263a8[_0x6f6c('0x36')]({'model':db[_0x6f6c('0xde')],'as':'Account','attributes':['id',_0x6f6c('0x2f')]});_0x4263a8[_0x6f6c('0x36')]({'model':db['User'],'as':_0x6f6c('0xdf'),'attributes':['id',_0x6f6c('0x32')]});return db[_0x6f6c('0x39')][_0x6f6c('0x67')]({'where':{'id':_0x564032[_0x6f6c('0xb5')]['id']},'include':_0x4263a8})[_0x6f6c('0x2c')](handleEntityNotFound(_0x9c80b8,null))['then'](function(_0x56f154){if(_0x56f154){var _0x299cba=_0x56f154[_0x6f6c('0xe0')]({'plain':!![]});fs[_0x6f6c('0xe1')](_0x4b70f9);var _0xdfbb66={'channel':_0x6f6c('0xe2'),'account':_0x299cba[_0x6f6c('0xe3')]['name'],'agent':_0x299cba[_0x6f6c('0xdf')]?_0x299cba[_0x6f6c('0xdf')][_0x6f6c('0x32')]:_0x6f6c('0xe4'),'createdAt':moment(_0x299cba[_0x6f6c('0x76')])[_0x6f6c('0xc5')](_0x6f6c('0xc6'))[_0x6f6c('0x99')](),'closedAt':_0x299cba[_0x6f6c('0xe5')]?moment(_0x299cba[_0x6f6c('0xe6')])[_0x6f6c('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f6c('0x99')]():'','disposition':_0x299cba[_0x6f6c('0xe7')],'messages':_(_0x299cba[_0x6f6c('0xdb')])[_0x6f6c('0x80')]({'secret':![]})['map'](function(_0x30c391){if(_0x30c391[_0x6f6c('0xda')]){var _0x504107=path[_0x6f6c('0xcf')](_0x1f0cdd,_0x30c391['Attachment'][_0x6f6c('0xe8')]);if(fs['existsSync'](_0x504107)){fs[_0x6f6c('0xe9')](_0x504107)[_0x6f6c('0xea')](fs[_0x6f6c('0xeb')](path[_0x6f6c('0xcf')](_0x4b70f9,_0x30c391[_0x6f6c('0xda')][_0x6f6c('0xe8')])));}}return{'date':moment(_0x30c391['createdAt'])[_0x6f6c('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f6c('0x99')](),'sender':_0x30c391['direction']==='out'?_0x30c391[_0x6f6c('0xd5')]?_0x30c391[_0x6f6c('0xd5')][_0x6f6c('0x32')]:_0x6f6c('0xec'):_0x30c391[_0x6f6c('0xd7')][_0x6f6c('0xd8')]+(_0x30c391[_0x6f6c('0xd7')][_0x6f6c('0xd9')]?'\x20'+_0x30c391[_0x6f6c('0xd7')][_0x6f6c('0xd9')]:''),'body':_0x30c391[_0x6f6c('0xda')]?_0x30c391[_0x6f6c('0xda')][_0x6f6c('0xe8')]:_0x30c391[_0x6f6c('0xbc')],'direction':_0x30c391[_0x6f6c('0xdc')]==='out'?'A':'C','secret':_0x30c391['secret'],'read':_0x30c391['read'],'attachment':_0x30c391[_0x6f6c('0xda')]};})[_0x6f6c('0x60')]()};return ejs[_0x6f6c('0xed')](path['join'](config['root'],_0x6f6c('0xd2'),'views','downloadInteraction.ejs'),{'interaction':_0xdfbb66})[_0x6f6c('0x2c')](function(_0xbf23d9){var _0x5bdf5b=path[_0x6f6c('0xcf')](_0x4b70f9,_0x6f6c('0xee')+_0x299cba['id']+'-'+_0x592093+_0x6f6c('0xef'));var _0x2036f5={'path':_0x5bdf5b,'channel':_0x6f6c('0xe2'),'interactionId':_0x299cba['id']};return pdf[_0x6f6c('0xf0')](_0xbf23d9,_0x2036f5);})['then'](function(){return new BPromise(function(_0x31d00c,_0x4afa35){zipdir(_0x4b70f9,{'saveTo':_0xf4b669},function(_0x13c4fc,_0x9eac45){if(_0x13c4fc)return _0x4afa35(_0x13c4fc);return _0x31d00c(_0x9eac45);});})['then'](function(){return new BPromise(function(_0x3c77b0,_0xbc6856){rimraf(_0x4b70f9,function(_0x3873fd){if(_0x3873fd)_0xbc6856(_0x3873fd);return _0x3c77b0();});});})[_0x6f6c('0x2c')](function(){return _0x9c80b8[_0x6f6c('0xcd')](_0xf4b669,_0x2fa7ba,function(_0x19174a){if(_0x19174a){console['log'](_0x6f6c('0xf1'),_0x19174a);}else{fs[_0x6f6c('0xf2')](_0xf4b669);}});});});}else{return _0x9c80b8[_0x6f6c('0x1f')](0xc8);}})['catch'](handleError(_0x9c80b8,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 11d2118..5f7046f 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 _0x6e6c=['events','../../mysqldb','WhatsappMessage','update','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var WhatsappInteraction=require(_0xc6e6('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xc6e6('0x1'))['db'][_0xc6e6('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc6e6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40b7e1){return function(_0x4b13f0,_0xe59212,_0x1182c7){_0x4b13f0['getUsers']({'attributes':['id'],'raw':!![]})[_0xc6e6('0x4')](function(_0x30a10b){_0x4b13f0['setDataValue'](_0xc6e6('0x5'),_0x30a10b[_0xc6e6('0x6')](function(_0x5a7ef3){return{'id':_0x5a7ef3['id']};}));return WhatsappMessage[_0xc6e6('0x7')]({'where':{'WhatsappInteractionId':_0x4b13f0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x172aa9){_0x4b13f0[_0xc6e6('0x8')](_0xc6e6('0x9'),_0x172aa9[_0xc6e6('0xa')]);WhatsappInteractionEvents[_0xc6e6('0xb')](_0x40b7e1+':'+_0x4b13f0['id'],_0x4b13f0);WhatsappInteractionEvents[_0xc6e6('0xb')](_0x40b7e1,_0x4b13f0);_0x1182c7(null);})[_0xc6e6('0xc')](_0x1182c7(null));};}for(var e in events){if(events[_0xc6e6('0xd')](e)){var event=events[e];WhatsappInteraction[_0xc6e6('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x0647=['catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','getUsers','then','Users','map','unreadMessages','length','emit'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0647,0xd0));var _0x7064=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x0647[_0x278e3c];return _0x3e2d9b;};'use strict';var EventEmitter=require(_0x7064('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x7064('0x1')];var WhatsappMessage=require(_0x7064('0x2'))['db'][_0x7064('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7064('0x4')](0x0);var events={'afterCreate':_0x7064('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x313dce){return function(_0x34b4d5,_0x31f6a6,_0x44b1bb){_0x34b4d5[_0x7064('0x6')]({'attributes':['id'],'raw':!![]})[_0x7064('0x7')](function(_0x58186b){_0x34b4d5['setDataValue'](_0x7064('0x8'),_0x58186b[_0x7064('0x9')](function(_0x79229e){return{'id':_0x79229e['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x34b4d5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7064('0x7')](function(_0x3f3bdd){_0x34b4d5['setDataValue'](_0x7064('0xa'),_0x3f3bdd[_0x7064('0xb')]);WhatsappInteractionEvents[_0x7064('0xc')](_0x313dce+':'+_0x34b4d5['id'],_0x34b4d5);WhatsappInteractionEvents['emit'](_0x313dce,_0x34b4d5);_0x44b1bb(null);})[_0x7064('0xd')](_0x44b1bb(null));};}for(var e in events){if(events[_0x7064('0xe')](e)){var event=events[e];WhatsappInteraction[_0x7064('0xf')](e,emitEvent(event));}}module[_0x7064('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 60f5119..f0b217a 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 _0x4cfb=['request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment'];(function(_0x3edc93,_0x3bdbf6){var _0x2ad114=function(_0x306d26){while(--_0x306d26){_0x3edc93['push'](_0x3edc93['shift']());}};_0x2ad114(++_0x3bdbf6);}(_0x4cfb,0xf9));var _0xb4cf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4cfb[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb4cf('0x0'));var logger=require(_0xb4cf('0x1'))('api');var moment=require(_0xb4cf('0x2'));var BPromise=require('bluebird');var rp=require(_0xb4cf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4cf('0x4'));var config=require(_0xb4cf('0x5'));var attributes=require(_0xb4cf('0x6'));module[_0xb4cf('0x7')]=function(_0x29ec33,_0x33daad){return _0x29ec33['define'](_0xb4cf('0x8'),attributes,{'tableName':_0xb4cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35b5ba,_0x1c08de,_0x238b60){if(_0x35b5ba['changed'](_0xb4cf('0xa'))){_0x35b5ba[_0xb4cf('0xb')]=moment()[_0xb4cf('0xc')](_0xb4cf('0xd'));}_0x238b60(null,_0x35b5ba);}}});}; \ No newline at end of file +var _0x1e8c=['closed','closedAt','format','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x1c3d8a,_0x1a9ad2){var _0x14e6f4=function(_0x39f69d){while(--_0x39f69d){_0x1c3d8a['push'](_0x1c3d8a['shift']());}};_0x14e6f4(++_0x1a9ad2);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x28f922,_0x1302f8){_0x28f922=_0x28f922-0x0;var _0x4eceac=_0x1e8c[_0x28f922];return _0x4eceac;};'use strict';var _=require('lodash');var util=require(_0xc1e8('0x0'));var logger=require(_0xc1e8('0x1'))(_0xc1e8('0x2'));var moment=require(_0xc1e8('0x3'));var BPromise=require(_0xc1e8('0x4'));var rp=require(_0xc1e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1e8('0x6'));var config=require(_0xc1e8('0x7'));var attributes=require(_0xc1e8('0x8'));module[_0xc1e8('0x9')]=function(_0x2547e3,_0x18613e){return _0x2547e3['define'](_0xc1e8('0xa'),attributes,{'tableName':_0xc1e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b5001,_0x48a012,_0x46c1c7){if(_0x3b5001[_0xc1e8('0xc')](_0xc1e8('0xd'))){_0x3b5001[_0xc1e8('0xe')]=moment()[_0xc1e8('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x46c1c7(null,_0x3b5001);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index be81c07..4feb834 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 _0xce3d=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','util','moment','randomstring','ioredis'];(function(_0x1e7231,_0x298411){var _0x146fc2=function(_0x30c0a){while(--_0x30c0a){_0x1e7231['push'](_0x1e7231['shift']());}};_0x146fc2(++_0x298411);}(_0xce3d,0x71));var _0xdce3=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0xce3d[_0x497948];return _0x39bb36;};'use strict';var _=require('lodash');var util=require(_0xdce3('0x0'));var moment=require(_0xdce3('0x1'));var BPromise=require('bluebird');var rs=require(_0xdce3('0x2'));var fs=require('fs');var Redis=require(_0xdce3('0x3'));var db=require(_0xdce3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdce3('0x5'))(_0xdce3('0x6'));var config=require(_0xdce3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdce3('0x8')]({'port':0x232a});config[_0xdce3('0x9')]=_[_0xdce3('0xa')](config['redis'],{'host':_0xdce3('0xb'),'port':0x18eb});var socket=require(_0xdce3('0xc'))(new Redis(config[_0xdce3('0x9')]));require('./whatsappInteraction.socket')[_0xdce3('0xd')](socket);function respondWithRpcPromise(_0x515dd9,_0x3798ae,_0x4d65bb){return new BPromise(function(_0xe3e1b7,_0x46d741){return client['request'](_0x515dd9,_0x4d65bb)[_0xdce3('0xe')](function(_0x142350){logger[_0xdce3('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x3798ae,_0xdce3('0x10'));logger[_0xdce3('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3798ae,'request\x20sent',JSON[_0xdce3('0x12')](_0x142350));if(_0x142350[_0xdce3('0x13')]){if(_0x142350['error'][_0xdce3('0x14')]===0x1f4){logger[_0xdce3('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x3798ae,_0x142350[_0xdce3('0x13')][_0xdce3('0x15')]);return _0x46d741(_0x142350[_0xdce3('0x13')]['message']);}logger['error'](_0xdce3('0x16'),_0x3798ae,_0x142350[_0xdce3('0x13')][_0xdce3('0x15')]);return _0xe3e1b7(_0x142350[_0xdce3('0x13')][_0xdce3('0x15')]);}else{logger[_0xdce3('0xf')](_0xdce3('0x16'),_0x3798ae,'request\x20sent');_0xe3e1b7(_0x142350[_0xdce3('0x17')][_0xdce3('0x15')]);}})[_0xdce3('0x18')](function(_0x335312){logger['error'](_0xdce3('0x16'),_0x3798ae,_0x335312);_0x46d741(_0x335312);});});}exports[_0xdce3('0x19')]=function(_0x4d5173){var _0xf4ce3e=this;return new Promise(function(_0x4652b6,_0x3805f9){return db[_0xdce3('0x1a')][_0xdce3('0x1b')](_0x4d5173[_0xdce3('0x1c')],{'raw':_0x4d5173[_0xdce3('0x1d')]?_0x4d5173[_0xdce3('0x1d')][_0xdce3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d5173['options']?_0x4d5173[_0xdce3('0x1d')][_0xdce3('0x1f')]||null:null,'attributes':_0x4d5173[_0xdce3('0x1d')]?_0x4d5173[_0xdce3('0x1d')][_0xdce3('0x20')]||null:null,'limit':_0x4d5173[_0xdce3('0x1d')]?_0x4d5173[_0xdce3('0x1d')]['limit']||null:null})['then'](function(_0x4ea881){logger[_0xdce3('0xf')](_0xdce3('0x19'),_0x4d5173);logger['debug'](_0xdce3('0x19'),_0x4d5173,JSON['stringify'](_0x4ea881));_0x4652b6(_0x4ea881);})[_0xdce3('0x18')](function(_0x5ca94c){logger[_0xdce3('0x13')](_0xdce3('0x19'),_0x5ca94c[_0xdce3('0x15')],_0x4d5173);_0x3805f9(_0xf4ce3e[_0xdce3('0x13')](0x1f4,_0x5ca94c[_0xdce3('0x15')]));});});};exports[_0xdce3('0x21')]=function(_0x34eb48){return new Promise(function(_0x31d439,_0x264c0d){return db[_0xdce3('0x1a')][_0xdce3('0x22')]({'where':_0x34eb48['options']?_0x34eb48[_0xdce3('0x1d')][_0xdce3('0x1f')]||null:null})[_0xdce3('0xe')](function(_0x4a50a3){if(_0x4a50a3){return _0x4a50a3[_0xdce3('0x23')](_0x34eb48['body'][_0xdce3('0x24')],_[_0xdce3('0x25')](_0x34eb48[_0xdce3('0x1c')],['ids','id'])||{});}})['spread'](function(_0x18cc63){logger['info'](_0xdce3('0x26'),_0x34eb48);logger[_0xdce3('0x11')]('AddTags',_0x34eb48,JSON[_0xdce3('0x12')](_0x18cc63));_0x31d439(_0x18cc63);})[_0xdce3('0x18')](function(_0x36ee2b){logger[_0xdce3('0x13')]('AddTags',_0x36ee2b[_0xdce3('0x15')],_0x34eb48);_0x264c0d(_this[_0xdce3('0x13')](0x1f4,_0x36ee2b['message']));});});}; \ No newline at end of file +var _0xa5d7=['addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','request','then','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','WhatsappInteraction','update','options','raw','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0xa5d7,0x178));var _0x7a5d=function(_0x258e85,_0x4b77e5){_0x258e85=_0x258e85-0x0;var _0x5dc74a=_0xa5d7[_0x258e85];return _0x5dc74a;};'use strict';var _=require(_0x7a5d('0x0'));var util=require('util');var moment=require(_0x7a5d('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a5d('0x2'));var fs=require('fs');var Redis=require(_0x7a5d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a5d('0x4'));var logger=require(_0x7a5d('0x5'))(_0x7a5d('0x6'));var config=require(_0x7a5d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a5d('0x8')][_0x7a5d('0x9')]({'port':0x232a});config[_0x7a5d('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a5d('0xa')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x34a96e,_0xd31172,_0x34c57a){return new BPromise(function(_0x328b47,_0x15005b){return client[_0x7a5d('0xb')](_0x34a96e,_0x34c57a)[_0x7a5d('0xc')](function(_0xe1939a){logger['info'](_0x7a5d('0xd'),_0xd31172,'request\x20sent');logger[_0x7a5d('0xe')](_0x7a5d('0xf'),_0xd31172,_0x7a5d('0x10'),JSON['stringify'](_0xe1939a));if(_0xe1939a[_0x7a5d('0x11')]){if(_0xe1939a['error'][_0x7a5d('0x12')]===0x1f4){logger[_0x7a5d('0x11')](_0x7a5d('0xd'),_0xd31172,_0xe1939a[_0x7a5d('0x11')][_0x7a5d('0x13')]);return _0x15005b(_0xe1939a[_0x7a5d('0x11')][_0x7a5d('0x13')]);}logger[_0x7a5d('0x11')](_0x7a5d('0xd'),_0xd31172,_0xe1939a[_0x7a5d('0x11')][_0x7a5d('0x13')]);return _0x328b47(_0xe1939a[_0x7a5d('0x11')][_0x7a5d('0x13')]);}else{logger[_0x7a5d('0x14')](_0x7a5d('0xd'),_0xd31172,_0x7a5d('0x10'));_0x328b47(_0xe1939a['result'][_0x7a5d('0x13')]);}})[_0x7a5d('0x15')](function(_0x15154f){logger['error'](_0x7a5d('0xd'),_0xd31172,_0x15154f);_0x15005b(_0x15154f);});});}exports['UpdateWhatsappInteraction']=function(_0x72cd01){var _0xeeda6c=this;return new Promise(function(_0x17afa1,_0x361c88){return db[_0x7a5d('0x16')][_0x7a5d('0x17')](_0x72cd01['body'],{'raw':_0x72cd01[_0x7a5d('0x18')]?_0x72cd01['options'][_0x7a5d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x72cd01[_0x7a5d('0x18')]?_0x72cd01[_0x7a5d('0x18')]['where']||null:null,'attributes':_0x72cd01[_0x7a5d('0x18')]?_0x72cd01[_0x7a5d('0x18')][_0x7a5d('0x1a')]||null:null,'limit':_0x72cd01[_0x7a5d('0x18')]?_0x72cd01['options'][_0x7a5d('0x1b')]||null:null})[_0x7a5d('0xc')](function(_0x45d4e4){logger['info']('UpdateWhatsappInteraction',_0x72cd01);logger[_0x7a5d('0xe')](_0x7a5d('0x1c'),_0x72cd01,JSON[_0x7a5d('0x1d')](_0x45d4e4));_0x17afa1(_0x45d4e4);})[_0x7a5d('0x15')](function(_0x112845){logger[_0x7a5d('0x11')](_0x7a5d('0x1c'),_0x112845[_0x7a5d('0x13')],_0x72cd01);_0x361c88(_0xeeda6c[_0x7a5d('0x11')](0x1f4,_0x112845['message']));});});};exports[_0x7a5d('0x1e')]=function(_0x43e1a9){return new Promise(function(_0x26e403,_0x47465f){return db[_0x7a5d('0x16')]['find']({'where':_0x43e1a9[_0x7a5d('0x18')]?_0x43e1a9[_0x7a5d('0x18')]['where']||null:null})[_0x7a5d('0xc')](function(_0x30f540){if(_0x30f540){return _0x30f540[_0x7a5d('0x1f')](_0x43e1a9[_0x7a5d('0x20')][_0x7a5d('0x21')],_[_0x7a5d('0x22')](_0x43e1a9['body'],[_0x7a5d('0x21'),'id'])||{});}})[_0x7a5d('0x23')](function(_0x328444){logger[_0x7a5d('0x14')]('AddTags',_0x43e1a9);logger['debug'](_0x7a5d('0x24'),_0x43e1a9,JSON['stringify'](_0x328444));_0x26e403(_0x328444);})['catch'](function(_0x3d79bc){logger[_0x7a5d('0x11')](_0x7a5d('0x24'),_0x3d79bc['message'],_0x43e1a9);_0x47465f(_this['error'](0x1f4,_0x3d79bc[_0x7a5d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index efbd1b6..b5f553c 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 _0x23f3=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x4ebf7a,_0x4120b0){var _0x46d6af=function(_0x5a3456){while(--_0x5a3456){_0x4ebf7a['push'](_0x4ebf7a['shift']());}};_0x46d6af(++_0x4120b0);}(_0x23f3,0x169));var _0x323f=function(_0x5747c9,_0xee1a78){_0x5747c9=_0x5747c9-0x0;var _0x26fd17=_0x23f3[_0x5747c9];return _0x26fd17;};'use strict';var WhatsappInteractionEvents=require(_0x323f('0x0'));var events=[_0x323f('0x1'),_0x323f('0x2'),'update'];function createListener(_0x54f10f,_0x4d7b28){return function(_0x25792f){_0x4d7b28[_0x323f('0x3')](_0x54f10f,_0x25792f);};}function removeListener(_0xa5cada,_0x3d4d9f){return function(){WhatsappInteractionEvents[_0x323f('0x4')](_0xa5cada,_0x3d4d9f);};}exports[_0x323f('0x5')]=function(_0x4582e0){for(var _0x342308=0x0,_0x550c96=events['length'];_0x342308<_0x550c96;_0x342308++){var _0xb16ad7=events[_0x342308];var _0x21fe59=createListener(_0x323f('0x6')+_0xb16ad7,_0x4582e0);WhatsappInteractionEvents['on'](_0xb16ad7,_0x21fe59);}}; \ No newline at end of file +var _0x0e15=['register','length','whatsappInteraction:'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0e15,0x11d));var _0x50e1=function(_0xd830e6,_0x447f5c){_0xd830e6=_0xd830e6-0x0;var _0x1efea6=_0x0e15[_0xd830e6];return _0x1efea6;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save','remove','update'];function createListener(_0xf74252,_0x2e8959){return function(_0x536f9a){_0x2e8959['emit'](_0xf74252,_0x536f9a);};}function removeListener(_0x197520,_0x415578){return function(){WhatsappInteractionEvents['removeListener'](_0x197520,_0x415578);};}exports[_0x50e1('0x0')]=function(_0x360b20){for(var _0x2fcb63=0x0,_0x1ce34b=events[_0x50e1('0x1')];_0x2fcb63<_0x1ce34b;_0x2fcb63++){var _0x8e6709=events[_0x2fcb63];var _0x5574b0=createListener(_0x50e1('0x2')+_0x8e6709,_0x360b20);WhatsappInteractionEvents['on'](_0x8e6709,_0x5574b0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4097e64..726aece 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 _0x3687=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','delete','exports','multer'];(function(_0x46643e,_0x2b93f7){var _0x40c228=function(_0x42f560){while(--_0x42f560){_0x46643e['push'](_0x46643e['shift']());}};_0x40c228(++_0x2b93f7);}(_0x3687,0x187));var _0x7368=function(_0x30f496,_0x37c4ea){_0x30f496=_0x30f496-0x0;var _0x63c204=_0x3687[_0x30f496];return _0x63c204;};'use strict';var multer=require(_0x7368('0x0'));var util=require(_0x7368('0x1'));var path=require(_0x7368('0x2'));var timeout=require(_0x7368('0x3'));var express=require(_0x7368('0x4'));var router=express[_0x7368('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7368('0x6'));var interaction=require(_0x7368('0x7'));var config=require(_0x7368('0x8'));var controller=require(_0x7368('0x9'));router[_0x7368('0xa')]('/',auth['isAuthenticated'](),controller[_0x7368('0xb')]);router[_0x7368('0xa')](_0x7368('0xc'),auth[_0x7368('0xd')](),controller[_0x7368('0xe')]);router[_0x7368('0xa')](_0x7368('0xf'),auth[_0x7368('0xd')](),controller[_0x7368('0x10')]);router[_0x7368('0x11')]('/',auth['isAuthenticated'](),interaction[_0x7368('0x12')]('whatsapp','whatsappmessage:create'),controller['create']);router[_0x7368('0x11')](_0x7368('0x13'),controller[_0x7368('0x14')]);router['put']('/:id',auth[_0x7368('0xd')](),controller[_0x7368('0x15')]);router[_0x7368('0x16')](_0x7368('0x17'),auth[_0x7368('0xd')](),controller['accept']);router[_0x7368('0x16')](_0x7368('0x18'),auth[_0x7368('0xd')](),controller[_0x7368('0x19')]);router[_0x7368('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7368('0x1b')]=router; \ No newline at end of file +var _0x6786=['./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x575783,_0x4f66f6){var _0x1aeae0=function(_0x3e05cb){while(--_0x3e05cb){_0x575783['push'](_0x575783['shift']());}};_0x1aeae0(++_0x4f66f6);}(_0x6786,0xdb));var _0x6678=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x6786[_0x5b13c3];return _0x3d6780;};'use strict';var multer=require(_0x6678('0x0'));var util=require(_0x6678('0x1'));var path=require(_0x6678('0x2'));var timeout=require(_0x6678('0x3'));var express=require(_0x6678('0x4'));var router=express['Router']();var fs_extra=require(_0x6678('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6678('0x6'));router[_0x6678('0x7')]('/',auth[_0x6678('0x8')](),controller[_0x6678('0x9')]);router[_0x6678('0x7')](_0x6678('0xa'),auth[_0x6678('0x8')](),controller[_0x6678('0xb')]);router[_0x6678('0x7')]('/:id',auth[_0x6678('0x8')](),controller[_0x6678('0xc')]);router[_0x6678('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x6678('0xe'),_0x6678('0xf')),controller[_0x6678('0x10')]);router['post'](_0x6678('0x11'),controller[_0x6678('0x12')]);router[_0x6678('0x13')](_0x6678('0x14'),auth[_0x6678('0x8')](),controller['update']);router['put']('/:id/accept',auth[_0x6678('0x8')](),controller[_0x6678('0x15')]);router[_0x6678('0x13')](_0x6678('0x16'),auth['isAuthenticated'](),controller[_0x6678('0x17')]);router['delete'](_0x6678('0x14'),auth[_0x6678('0x8')](),controller['destroy']);module[_0x6678('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ac1d31d..5d84077 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 _0x6ea4=['DATE','sequelize','exports','TEXT','ENUM','out','STRING'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x6ea4,0xd3));var _0x46ea=function(_0x262d66,_0x4d38e4){_0x262d66=_0x262d66-0x0;var _0x54172f=_0x6ea4[_0x262d66];return _0x54172f;};'use strict';var Sequelize=require(_0x46ea('0x0'));module[_0x46ea('0x1')]={'body':{'type':Sequelize[_0x46ea('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x46ea('0x3')]('in',_0x46ea('0x4')),'defaultValue':_0x46ea('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x46ea('0x5')](0xbe)},'phone':{'type':Sequelize[_0x46ea('0x5')]},'readAt':{'type':Sequelize[_0x46ea('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x46ea('0x2')]}}; \ No newline at end of file +var _0xe4ce=['sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x5924e7,_0x5349ea){var _0x560ee5=function(_0xd92499){while(--_0xd92499){_0x5924e7['push'](_0x5924e7['shift']());}};_0x560ee5(++_0x5349ea);}(_0xe4ce,0x198));var _0xee4c=function(_0x3839ab,_0x543056){_0x3839ab=_0x3839ab-0x0;var _0x5a9722=_0xe4ce[_0x3839ab];return _0x5a9722;};'use strict';var Sequelize=require(_0xee4c('0x0'));module['exports']={'body':{'type':Sequelize[_0xee4c('0x1')](_0xee4c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xee4c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xee4c('0x4')),'defaultValue':_0xee4c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xee4c('0x5')](0xbe)},'phone':{'type':Sequelize[_0xee4c('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xee4c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xee4c('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index aaaba79..c151a1a 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 _0x760e=['User','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','contact','fullname','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','limit','undefined','count','set','json','apply','reject','save','update','status','stack','name','send','index','map','WhatsappMessage','rawAttributes','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','show','params','merge','options','create','body','find','destroy','../../config/logger','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT'];(function(_0x3a7f42,_0x49737a){var _0x2e9379=function(_0x591327){while(--_0x591327){_0x3a7f42['push'](_0x3a7f42['shift']());}};_0x2e9379(++_0x49737a);}(_0x760e,0x1d4));var _0xe760=function(_0x2a3d84,_0x1ca014){_0x2a3d84=_0x2a3d84-0x0;var _0x420adc=_0x760e[_0x2a3d84];return _0x420adc;};'use strict';var emlformat=require(_0xe760('0x0'));var rimraf=require(_0xe760('0x1'));var zipdir=require(_0xe760('0x2'));var jsonpatch=require(_0xe760('0x3'));var rp=require('request-promise');var moment=require(_0xe760('0x4'));var BPromise=require(_0xe760('0x5'));var Mustache=require(_0xe760('0x6'));var util=require('util');var path=require(_0xe760('0x7'));var sox=require(_0xe760('0x8'));var csv=require(_0xe760('0x9'));var ejs=require(_0xe760('0xa'));var fs=require('fs');var fs_extra=require(_0xe760('0xb'));var _=require(_0xe760('0xc'));var squel=require(_0xe760('0xd'));var crypto=require('crypto');var jsforce=require(_0xe760('0xe'));var deskjs=require(_0xe760('0xf'));var toCsv=require(_0xe760('0x9'));var querystring=require(_0xe760('0x10'));var Papa=require(_0xe760('0x11'));var Redis=require(_0xe760('0x12'));var authService=require(_0xe760('0x13'));var qs=require(_0xe760('0x14'));var as=require(_0xe760('0x15'));var hardwareService=require(_0xe760('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe760('0x17'));var config=require(_0xe760('0x18'));var licenseUtil=require(_0xe760('0x19'));var db=require(_0xe760('0x1a'))['db'];config[_0xe760('0x1b')]=_['defaults'](config['redis'],{'host':_0xe760('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe760('0x1b')]));require(_0xe760('0x1d'))[_0xe760('0x1e')](socket);var jayson=require(_0xe760('0x1f'));var client=jayson[_0xe760('0x20')][_0xe760('0x21')]({'port':0x232c});var client9002=jayson[_0xe760('0x20')][_0xe760('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3b758a,_0x1fa666,_0x532806,_0x19058a){return new BPromise(function(_0x5adcd6,_0x91069f){var _0x3318c6=_0x19058a||client;return _0x3318c6[_0xe760('0x22')](_0x3b758a,_0x532806)[_0xe760('0x23')](function(_0x4b0b0a){logger[_0xe760('0x24')](_0xe760('0x25'),_0x1fa666,_0xe760('0x26'));logger['debug'](_0xe760('0x27'),_0x1fa666,_0xe760('0x26'),JSON[_0xe760('0x28')](_0x4b0b0a));if(_0x4b0b0a[_0xe760('0x29')]){if(_0x4b0b0a['error'][_0xe760('0x2a')]===0x1f4){logger[_0xe760('0x29')](_0xe760('0x25'),_0x1fa666,_0x4b0b0a[_0xe760('0x29')]['message']);return _0x91069f(_0x4b0b0a[_0xe760('0x29')][_0xe760('0x2b')]);}logger['error'](_0xe760('0x25'),_0x1fa666,_0x4b0b0a[_0xe760('0x29')]['message']);return _0x5adcd6(_0x4b0b0a[_0xe760('0x29')][_0xe760('0x2b')]);}else{logger[_0xe760('0x24')](_0xe760('0x25'),_0x1fa666,'request\x20sent');_0x5adcd6(_0x4b0b0a[_0xe760('0x2c')][_0xe760('0x2b')]);}})[_0xe760('0x2d')](function(_0x49c3f1){logger[_0xe760('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x1fa666,_0x49c3f1);_0x91069f(_0x49c3f1);});});}function respondWithStatusCode(_0x2310d7,_0x33cdeb){_0x33cdeb=_0x33cdeb||0xcc;return function(_0x2d3f3f){if(_0x2d3f3f){return _0x2310d7[_0xe760('0x2e')](_0x33cdeb);}return _0x2310d7['status'](_0x33cdeb)[_0xe760('0x2f')]();};}function respondWithResult(_0x54cf28,_0x307987){_0x307987=_0x307987||0xc8;return function(_0xe3dae7){if(_0xe3dae7){return _0x54cf28['status'](_0x307987)['json'](_0xe3dae7);}};}function respondWithFilteredResult(_0x477136,_0x44e92d){return function(_0x8e7d4a){if(_0x8e7d4a){var _0x21fe9a=typeof _0x44e92d[_0xe760('0x30')]==='undefined'&&typeof _0x44e92d[_0xe760('0x31')]===_0xe760('0x32');var _0x4b9a51=_0x8e7d4a[_0xe760('0x33')];var _0x506a96=_0x21fe9a?0x0:_0x44e92d[_0xe760('0x30')];var _0x520521=_0x21fe9a?_0x8e7d4a['count']:_0x44e92d[_0xe760('0x30')]+_0x44e92d[_0xe760('0x31')];var _0x198632;if(_0x520521>=_0x4b9a51){_0x520521=_0x4b9a51;_0x198632=0xc8;}else{_0x198632=0xce;}_0x477136['status'](_0x198632);return _0x477136[_0xe760('0x34')]('Content-Range',_0x506a96+'-'+_0x520521+'/'+_0x4b9a51)[_0xe760('0x35')](_0x8e7d4a);}return null;};}function patchUpdates(_0x3a8b33){return function(_0x3c065b){try{jsonpatch[_0xe760('0x36')](_0x3c065b,_0x3a8b33,!![]);}catch(_0x283ea8){return BPromise[_0xe760('0x37')](_0x283ea8);}return _0x3c065b[_0xe760('0x38')]();};}function saveUpdates(_0x37a5e1,_0x556f78){return function(_0x4c5803){if(_0x4c5803){return _0x4c5803[_0xe760('0x39')](_0x37a5e1)[_0xe760('0x23')](function(_0x25b928){return _0x25b928;});}return null;};}function removeEntity(_0x44ac69,_0x4f524c){return function(_0x356e0b){if(_0x356e0b){return _0x356e0b['destroy']()[_0xe760('0x23')](function(){_0x44ac69[_0xe760('0x3a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40a922,_0x24b8dd){return function(_0x763da6){if(!_0x763da6){_0x40a922[_0xe760('0x2e')](0x194);}return _0x763da6;};}function handleError(_0x58c7a6,_0x43f5d1){_0x43f5d1=_0x43f5d1||0x1f4;return function(_0xd375d7){logger[_0xe760('0x29')](_0xd375d7[_0xe760('0x3b')]);if(_0xd375d7[_0xe760('0x3c')]){delete _0xd375d7[_0xe760('0x3c')];}_0x58c7a6[_0xe760('0x3a')](_0x43f5d1)[_0xe760('0x3d')](_0xd375d7);};}exports[_0xe760('0x3e')]=function(_0x318427,_0x3de2eb){var _0x43b95f={},_0x562b8e={},_0x1ce033={'count':0x0,'rows':[]};var _0x117a21=_[_0xe760('0x3f')](db[_0xe760('0x40')][_0xe760('0x41')],function(_0x163c30){return{'name':_0x163c30['fieldName'],'type':_0x163c30['type']['key']};});_0x562b8e['model']=_[_0xe760('0x3f')](_0x117a21,_0xe760('0x3c'));_0x562b8e[_0xe760('0x42')]=_[_0xe760('0x43')](_0x318427[_0xe760('0x42')]);_0x562b8e['filters']=_[_0xe760('0x44')](_0x562b8e['model'],_0x562b8e[_0xe760('0x42')]);_0x43b95f[_0xe760('0x45')]=_['intersection'](_0x562b8e[_0xe760('0x46')],qs['fields'](_0x318427[_0xe760('0x42')][_0xe760('0x47')]));_0x43b95f[_0xe760('0x45')]=_0x43b95f['attributes'][_0xe760('0x48')]?_0x43b95f[_0xe760('0x45')]:_0x562b8e['model'];if(!_0x318427[_0xe760('0x42')][_0xe760('0x49')](_0xe760('0x4a'))){_0x43b95f[_0xe760('0x31')]=qs[_0xe760('0x31')](_0x318427['query']['limit']);_0x43b95f[_0xe760('0x30')]=qs[_0xe760('0x30')](_0x318427[_0xe760('0x42')][_0xe760('0x30')]);}_0x43b95f['order']=qs[_0xe760('0x4b')](_0x318427['query'][_0xe760('0x4b')]);_0x43b95f[_0xe760('0x4c')]=qs[_0xe760('0x4d')](_[_0xe760('0x4e')](_0x318427[_0xe760('0x42')],_0x562b8e[_0xe760('0x4d')]),_0x117a21);if(_0x318427[_0xe760('0x42')][_0xe760('0x4f')]){_0x43b95f[_0xe760('0x4c')]=_['merge'](_0x43b95f[_0xe760('0x4c')],{'$or':_[_0xe760('0x3f')](_0x117a21,function(_0x7c0775){if(_0x7c0775[_0xe760('0x50')]!==_0xe760('0x51')){var _0x5428fb={};_0x5428fb[_0x7c0775[_0xe760('0x3c')]]={'$like':'%'+_0x318427[_0xe760('0x42')]['filter']+'%'};return _0x5428fb;}})});}_0x43b95f=_['merge']({},_0x43b95f,_0x318427['options']);var _0x4c986c={'where':_0x43b95f['where']};return db[_0xe760('0x40')][_0xe760('0x33')](_0x4c986c)[_0xe760('0x23')](function(_0x3cfab4){_0x1ce033[_0xe760('0x33')]=_0x3cfab4;if(_0x318427[_0xe760('0x42')][_0xe760('0x52')]){_0x43b95f[_0xe760('0x53')]=[{'all':!![]}];}return db[_0xe760('0x40')][_0xe760('0x54')](_0x43b95f);})[_0xe760('0x23')](function(_0x281410){_0x1ce033[_0xe760('0x55')]=_0x281410;return _0x1ce033;})[_0xe760('0x23')](respondWithFilteredResult(_0x3de2eb,_0x43b95f))[_0xe760('0x2d')](handleError(_0x3de2eb,null));};exports[_0xe760('0x56')]=function(_0x3b2ef3,_0x4112ec){var _0x3a5a5a={'raw':!![],'where':{'id':_0x3b2ef3[_0xe760('0x57')]['id']}},_0x3f1b81={};_0x3f1b81[_0xe760('0x46')]=_[_0xe760('0x43')](db['WhatsappMessage'][_0xe760('0x41')]);_0x3f1b81[_0xe760('0x42')]=_[_0xe760('0x43')](_0x3b2ef3[_0xe760('0x42')]);_0x3f1b81[_0xe760('0x4d')]=_[_0xe760('0x44')](_0x3f1b81[_0xe760('0x46')],_0x3f1b81[_0xe760('0x42')]);_0x3a5a5a[_0xe760('0x45')]=_[_0xe760('0x44')](_0x3f1b81['model'],qs['fields'](_0x3b2ef3[_0xe760('0x42')][_0xe760('0x47')]));_0x3a5a5a[_0xe760('0x45')]=_0x3a5a5a[_0xe760('0x45')][_0xe760('0x48')]?_0x3a5a5a[_0xe760('0x45')]:_0x3f1b81['model'];if(_0x3b2ef3[_0xe760('0x42')][_0xe760('0x52')]){_0x3a5a5a[_0xe760('0x53')]=[{'all':!![]}];}_0x3a5a5a=_[_0xe760('0x58')]({},_0x3a5a5a,_0x3b2ef3[_0xe760('0x59')]);return db[_0xe760('0x40')]['find'](_0x3a5a5a)[_0xe760('0x23')](handleEntityNotFound(_0x4112ec,null))[_0xe760('0x23')](respondWithResult(_0x4112ec,null))[_0xe760('0x2d')](handleError(_0x4112ec,null));};exports[_0xe760('0x5a')]=function(_0x4b3d98,_0x423482){return db[_0xe760('0x40')][_0xe760('0x5a')](_0x4b3d98[_0xe760('0x5b')],{})[_0xe760('0x23')](respondWithResult(_0x423482,0xc9))[_0xe760('0x2d')](handleError(_0x423482,null));};exports[_0xe760('0x39')]=function(_0xf96b48,_0x59a863){if(_0xf96b48['body']['id']){delete _0xf96b48[_0xe760('0x5b')]['id'];}return db['WhatsappMessage'][_0xe760('0x5c')]({'where':{'id':_0xf96b48['params']['id']}})[_0xe760('0x23')](handleEntityNotFound(_0x59a863,null))[_0xe760('0x23')](saveUpdates(_0xf96b48[_0xe760('0x5b')],null))['then'](respondWithResult(_0x59a863,null))['catch'](handleError(_0x59a863,null));};exports[_0xe760('0x5d')]=function(_0x4b5851,_0x238623){return db[_0xe760('0x40')][_0xe760('0x5c')]({'where':{'id':_0x4b5851[_0xe760('0x57')]['id']}})[_0xe760('0x23')](handleEntityNotFound(_0x238623,null))[_0xe760('0x23')](removeEntity(_0x238623,null))['catch'](handleError(_0x238623,null));};exports['describe']=function(_0x1f2af1,_0x49502d){return db[_0xe760('0x40')]['describe']()[_0xe760('0x23')](respondWithResult(_0x49502d,null))[_0xe760('0x2d')](handleError(_0x49502d,null));};var interaction_log=require(_0xe760('0x5e'))(_0xe760('0x5f'));exports[_0xe760('0x60')]=function(_0x25d3af,_0x4c0d7b,_0x2467a4){var _0x11f622={'agent':{},'channel':'whatsapp'};if(_0x25d3af[_0xe760('0x5b')]['id']){delete _0x25d3af[_0xe760('0x5b')]['id'];}_0x25d3af[_0xe760('0x5b')][_0xe760('0x61')]=!![];_0x25d3af[_0xe760('0x5b')][_0xe760('0x62')]=moment()[_0xe760('0x63')](_0xe760('0x64'));_0x25d3af['body'][_0xe760('0x65')]=_0x25d3af[_0xe760('0x5b')][_0xe760('0x65')]||_0x25d3af[_0xe760('0x66')]['id'];_0x11f622[_0xe760('0x67')]['id']=_0x25d3af[_0xe760('0x5b')][_0xe760('0x65')];return db[_0xe760('0x40')][_0xe760('0x5c')]({'where':{'id':_0x25d3af[_0xe760('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c0d7b,null))[_0xe760('0x23')](saveUpdates(_0x25d3af[_0xe760('0x5b')],null))['then'](function(_0x2c0067){if(_0x2c0067){_0x11f622[_0xe760('0x2b')]=_0x2c0067['get']({'plain':!![]});return db[_0xe760('0x68')][_0xe760('0x5c')]({'where':{'id':_0x2c0067[_0xe760('0x69')]}});}return null;})[_0xe760('0x23')](handleEntityNotFound(_0x4c0d7b,null))[_0xe760('0x23')](function(_0x49e9b8){if(_0x49e9b8){return _0x49e9b8['update']({'UserId':_0x25d3af[_0xe760('0x5b')][_0xe760('0x65')],'read1stAt':_[_0xe760('0x6a')](_0x49e9b8[_0xe760('0x6b')])?moment()['format'](_0xe760('0x64')):undefined});}return null;})[_0xe760('0x23')](function(_0x39358e){if(_0x39358e){_0x11f622['interaction']=_0x39358e[_0xe760('0x6c')]({'plain':!![]});interaction_log['info'](_0xe760('0x6d'),_0x25d3af[_0xe760('0x66')]['id'],_0x25d3af['user'][_0xe760('0x3c')],_0x25d3af[_0xe760('0x66')][_0xe760('0x6e')],_0x11f622[_0xe760('0x6f')]['id'],_0x25d3af['body']?JSON['stringify'](_0x25d3af[_0xe760('0x5b')]):_0xe760('0x70'));return respondWithRpcPromise(_0xe760('0x71'),_0xe760('0x72'),_0x11f622);}return null;})[_0xe760('0x23')](function(_0x3bc12f){var _0x213b7c=_0xe760('0x73')+_0x3bc12f[_0xe760('0x2b')][_0xe760('0x74')];return db[_0xe760('0x75')]['query'](_0x213b7c,{'type':db[_0xe760('0x76')]['QueryTypes'][_0xe760('0x77')],'raw':!![]})[_0xe760('0x23')](function(_0x490c42){return _0x490c42;});})[_0xe760('0x23')](function(_0x25f778){if(_0x25f778){_0x11f622[_0xe760('0x2b')]['contact']=_0x25f778[0x0];if(!_0x25d3af[_0xe760('0x5b')][_0xe760('0x65')])return;return db[_0xe760('0x78')]['find']({'where':{'id':_0x25d3af[_0xe760('0x5b')]['UserId'],'role':_0xe760('0x67')},'attributes':['id','name','fullname',_0xe760('0x79'),'internal'],'raw':!![]});}return null;})[_0xe760('0x23')](function(_0x73efc2){if(!_0x73efc2)return null;_0x11f622[_0xe760('0x2b')][_0xe760('0x67')]=_0x73efc2;return _0x11f622;})[_0xe760('0x23')](function(_0x490af4){if(_0x490af4){if(_0x25d3af['body'][_0xe760('0x7a')]){_0x11f622[_0xe760('0x2b')][_0xe760('0x7b')]=util[_0xe760('0x63')](_0xe760('0x7c'),_0x25d3af[_0xe760('0x66')][_0xe760('0x3c')]);_0x11f622[_0xe760('0x2b')][_0xe760('0x7d')]=_0x11f622[_0xe760('0x7d')];_0x11f622[_0xe760('0x2b')][_0xe760('0x7e')]=_0x11f622[_0xe760('0x7d')];_0x11f622[_0xe760('0x2b')]['event']=_0xe760('0x60');return respondWithRpcPromise(_0xe760('0x7f'),_0xe760('0x7f'),{'event':_0xe760('0x80'),'message':_0x11f622[_0xe760('0x2b')]},client9002)[_0xe760('0x23')](function(){return _0x11f622;});}return _0x11f622;}return null;})[_0xe760('0x23')](respondWithResult(_0x4c0d7b,null))[_0xe760('0x2d')](handleError(_0x4c0d7b,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xe760('0x37')]=function(_0x4b1e79,_0x1ab391,_0x1b0780){var _0x12f510={'agent':{},'channel':_0xe760('0x81')};if(_0x4b1e79[_0xe760('0x5b')]['id']){delete _0x4b1e79[_0xe760('0x5b')]['id'];}_0x4b1e79[_0xe760('0x5b')]['UserId']=_0x4b1e79[_0xe760('0x5b')][_0xe760('0x65')]||_0x4b1e79[_0xe760('0x66')]['id'];_0x12f510['agent']['id']=_0x4b1e79[_0xe760('0x5b')][_0xe760('0x65')];return db[_0xe760('0x40')][_0xe760('0x5c')]({'where':{'id':_0x4b1e79[_0xe760('0x57')]['id'],'UserId':null}})[_0xe760('0x23')](handleEntityNotFound(_0x1ab391,null))[_0xe760('0x23')](function(_0x861c7a){if(_0x861c7a){_0x12f510[_0xe760('0x2b')]=_0x861c7a[_0xe760('0x6c')]({'plain':!![]});return db[_0xe760('0x68')][_0xe760('0x5c')]({'where':{'id':_0x861c7a[_0xe760('0x69')]}});}return null;})[_0xe760('0x23')](handleEntityNotFound(_0x1ab391,null))['then'](function(_0x2aaa68){if(_0x2aaa68){_0x12f510['interaction']=_0x2aaa68[_0xe760('0x6c')]({'plain':!![]});interaction_log[_0xe760('0x24')](_0xe760('0x82'),_0x4b1e79[_0xe760('0x66')]['id'],_0x4b1e79[_0xe760('0x66')][_0xe760('0x3c')],_0x4b1e79[_0xe760('0x66')][_0xe760('0x6e')],_0x12f510[_0xe760('0x6f')]['id'],_0x4b1e79[_0xe760('0x5b')]?JSON[_0xe760('0x28')](_0x4b1e79[_0xe760('0x5b')]):_0xe760('0x70'));return respondWithRpcPromise(_0xe760('0x83'),_0xe760('0x84'),_0x12f510);}return null;})['then'](function(_0x34ee6d){var _0x2bed0e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x34ee6d['message'][_0xe760('0x74')];return db[_0xe760('0x75')]['query'](_0x2bed0e,{'type':db[_0xe760('0x76')][_0xe760('0x85')][_0xe760('0x77')],'raw':!![]})[_0xe760('0x23')](function(_0x3e6028){return _0x3e6028;});})[_0xe760('0x23')](function(_0x17ce7a){if(_0x17ce7a){_0x12f510['message'][_0xe760('0x86')]=_0x17ce7a[0x0];if(!_0x4b1e79[_0xe760('0x5b')][_0xe760('0x65')])return;return db[_0xe760('0x78')]['find']({'where':{'id':_0x4b1e79['body'][_0xe760('0x65')],'role':'agent'},'attributes':['id','name',_0xe760('0x87'),_0xe760('0x79'),'internal'],'raw':!![]});}return null;})[_0xe760('0x23')](function(_0x2a357d){if(!_0x2a357d)return null;_0x12f510[_0xe760('0x2b')]['agent']=_0x2a357d;return _0x12f510;})[_0xe760('0x23')](function(_0x4cb31a){if(_0x4cb31a){_0x4cb31a['message'][_0xe760('0x7b')]=util[_0xe760('0x63')](_0xe760('0x7c'),_0x4b1e79[_0xe760('0x66')]['name']);_0x4cb31a['message'][_0xe760('0x7d')]=_0x12f510['channel'];_0x4cb31a[_0xe760('0x2b')]['motionChannel']=_0x12f510[_0xe760('0x7d')];_0x4cb31a[_0xe760('0x2b')]['event']=_0xe760('0x37');respondWithRpcPromise(_0xe760('0x7f'),'EventManager',{'event':_0xe760('0x88'),'message':_0x4cb31a[_0xe760('0x2b')]},client9002);return _0x12f510;}return null;})['then'](respondWithResult(_0x1ab391,null))[_0xe760('0x2d')](handleError(_0x1ab391,null));};exports[_0xe760('0x3a')]=function(_0x2887d0,_0x1e8c9f,_0x10b9f1){if(_0x2887d0[_0xe760('0x5b')]['id']){delete _0x2887d0[_0xe760('0x5b')]['id'];}var _0x1deafd;return db[_0xe760('0x40')][_0xe760('0x5c')]({'where':{'id':_0x2887d0['params']['id']}})[_0xe760('0x23')](handleEntityNotFound(_0x1e8c9f,null))[_0xe760('0x23')](function(_0x1e74c8){if(_0x1e74c8){_0x1deafd=_0x1e74c8;return db[_0xe760('0x89')][_0xe760('0x5c')]({'where':{'id':_0x1e74c8[_0xe760('0x8a')]}});}})['then'](handleEntityNotFound(_0x1e8c9f,null))[_0xe760('0x23')](function(_0x20b347){if(_0x20b347){logger[_0xe760('0x8b')](_0xe760('0x8c'),_0xe760('0x3a'),'received\x20delivery\x20report\x20from',_0x20b347[_0xe760('0x50')],util[_0xe760('0x8d')](_0x2887d0[_0xe760('0x5b')],{'showHidden':![],'depth':null}));switch(_0x20b347['type']){case _0xe760('0x8e'):if(_0x2887d0[_0xe760('0x5b')][_0xe760('0x8f')]&&_0x2887d0[_0xe760('0x5b')][_0xe760('0x8f')]===_0x1deafd[_0xe760('0x90')]&&_0x2887d0['body'][_0xe760('0x91')]&&_0x2887d0['body']['MessageStatus']===_0xe760('0x61')){return _0x1deafd[_0xe760('0x39')]({'read':!![]});}else{logger[_0xe760('0x29')](_0xe760('0x92'),_0xe760('0x3a'),_0xe760('0x8e'),util[_0xe760('0x8d')](_0x2887d0[_0xe760('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x1deafd;}})[_0xe760('0x23')](respondWithResult(_0x1e8c9f,null))['catch'](handleError(_0x1e8c9f,null));}; \ No newline at end of file +var _0x73bd=['jayson/promise','client','http','request','then','debug','stringify','error','code','message','info','result','WhatsappMessage,\x20%s,\x20%s','status','end','json','offset','limit','undefined','count','set','apply','update','destroy','sendStatus','name','send','index','map','WhatsappMessage','fieldName','model','query','filters','intersection','fields','attributes','length','order','sort','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','keys','options','find','create','body','params','describe','whatsapp-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','event','accept','EventManager','whatsapp','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','User','SIP/%s','motionChannel','reject','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73bd,0x6b));var _0xd73b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x73bd[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd73b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd73b('0x1'));var jsonpatch=require(_0xd73b('0x2'));var rp=require(_0xd73b('0x3'));var moment=require(_0xd73b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd73b('0x5'));var util=require(_0xd73b('0x6'));var path=require('path');var sox=require(_0xd73b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd73b('0x8'));var _=require(_0xd73b('0x9'));var squel=require(_0xd73b('0xa'));var crypto=require(_0xd73b('0xb'));var jsforce=require(_0xd73b('0xc'));var deskjs=require(_0xd73b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd73b('0xe'));var Papa=require(_0xd73b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd73b('0x10'));var as=require(_0xd73b('0x11'));var hardwareService=require(_0xd73b('0x12'));var logger=require(_0xd73b('0x13'))('api');var utils=require(_0xd73b('0x14'));var config=require(_0xd73b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd73b('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd73b('0x17'),'port':0x18eb});var socket=require(_0xd73b('0x18'))(new Redis(config[_0xd73b('0x19')]));require(_0xd73b('0x1a'))[_0xd73b('0x1b')](socket);var jayson=require(_0xd73b('0x1c'));var client=jayson[_0xd73b('0x1d')][_0xd73b('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xd73b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3cbfa6,_0x3fefaa,_0x3ab9fa,_0x15d491){return new BPromise(function(_0x5b9558,_0x163c64){var _0x45eb23=_0x15d491||client;return _0x45eb23[_0xd73b('0x1f')](_0x3cbfa6,_0x3ab9fa)[_0xd73b('0x20')](function(_0x53a909){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3fefaa,'request\x20sent');logger[_0xd73b('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3fefaa,'request\x20sent',JSON[_0xd73b('0x22')](_0x53a909));if(_0x53a909[_0xd73b('0x23')]){if(_0x53a909[_0xd73b('0x23')][_0xd73b('0x24')]===0x1f4){logger[_0xd73b('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3fefaa,_0x53a909[_0xd73b('0x23')][_0xd73b('0x25')]);return _0x163c64(_0x53a909['error']['message']);}logger[_0xd73b('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3fefaa,_0x53a909[_0xd73b('0x23')][_0xd73b('0x25')]);return _0x5b9558(_0x53a909[_0xd73b('0x23')][_0xd73b('0x25')]);}else{logger[_0xd73b('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x3fefaa,'request\x20sent');_0x5b9558(_0x53a909[_0xd73b('0x27')][_0xd73b('0x25')]);}})['catch'](function(_0x27f071){logger['error'](_0xd73b('0x28'),_0x3fefaa,_0x27f071);_0x163c64(_0x27f071);});});}function respondWithStatusCode(_0x5081c4,_0x41b090){_0x41b090=_0x41b090||0xcc;return function(_0x1b7505){if(_0x1b7505){return _0x5081c4['sendStatus'](_0x41b090);}return _0x5081c4[_0xd73b('0x29')](_0x41b090)[_0xd73b('0x2a')]();};}function respondWithResult(_0x1c5df8,_0x1ea0e6){_0x1ea0e6=_0x1ea0e6||0xc8;return function(_0x25204d){if(_0x25204d){return _0x1c5df8['status'](_0x1ea0e6)[_0xd73b('0x2b')](_0x25204d);}};}function respondWithFilteredResult(_0x3a2837,_0x2e9289){return function(_0xb6a6a2){if(_0xb6a6a2){var _0x2785e4=typeof _0x2e9289[_0xd73b('0x2c')]==='undefined'&&typeof _0x2e9289[_0xd73b('0x2d')]===_0xd73b('0x2e');var _0x19e166=_0xb6a6a2[_0xd73b('0x2f')];var _0x19f676=_0x2785e4?0x0:_0x2e9289[_0xd73b('0x2c')];var _0x576e3c=_0x2785e4?_0xb6a6a2['count']:_0x2e9289['offset']+_0x2e9289[_0xd73b('0x2d')];var _0x3e0e8d;if(_0x576e3c>=_0x19e166){_0x576e3c=_0x19e166;_0x3e0e8d=0xc8;}else{_0x3e0e8d=0xce;}_0x3a2837[_0xd73b('0x29')](_0x3e0e8d);return _0x3a2837[_0xd73b('0x30')]('Content-Range',_0x19f676+'-'+_0x576e3c+'/'+_0x19e166)['json'](_0xb6a6a2);}return null;};}function patchUpdates(_0x5d3f9e){return function(_0x147ad9){try{jsonpatch[_0xd73b('0x31')](_0x147ad9,_0x5d3f9e,!![]);}catch(_0x7a49b8){return BPromise['reject'](_0x7a49b8);}return _0x147ad9['save']();};}function saveUpdates(_0x5a3630,_0x42aeb6){return function(_0xb16eec){if(_0xb16eec){return _0xb16eec[_0xd73b('0x32')](_0x5a3630)[_0xd73b('0x20')](function(_0x5ee628){return _0x5ee628;});}return null;};}function removeEntity(_0x3513fd,_0x378076){return function(_0x147ad5){if(_0x147ad5){return _0x147ad5[_0xd73b('0x33')]()[_0xd73b('0x20')](function(){_0x3513fd['status'](0xcc)[_0xd73b('0x2a')]();});}};}function handleEntityNotFound(_0x192cce,_0xb3563){return function(_0x2852da){if(!_0x2852da){_0x192cce[_0xd73b('0x34')](0x194);}return _0x2852da;};}function handleError(_0x41a188,_0x1d42e3){_0x1d42e3=_0x1d42e3||0x1f4;return function(_0x2bdb4e){logger['error'](_0x2bdb4e['stack']);if(_0x2bdb4e['name']){delete _0x2bdb4e[_0xd73b('0x35')];}_0x41a188['status'](_0x1d42e3)[_0xd73b('0x36')](_0x2bdb4e);};}exports[_0xd73b('0x37')]=function(_0x1d9d08,_0x577e44){var _0x3b69ae={},_0x5886bf={},_0x44bd2e={'count':0x0,'rows':[]};var _0x418608=_[_0xd73b('0x38')](db[_0xd73b('0x39')]['rawAttributes'],function(_0x372147){return{'name':_0x372147[_0xd73b('0x3a')],'type':_0x372147['type']['key']};});_0x5886bf[_0xd73b('0x3b')]=_[_0xd73b('0x38')](_0x418608,_0xd73b('0x35'));_0x5886bf[_0xd73b('0x3c')]=_['keys'](_0x1d9d08[_0xd73b('0x3c')]);_0x5886bf[_0xd73b('0x3d')]=_[_0xd73b('0x3e')](_0x5886bf['model'],_0x5886bf['query']);_0x3b69ae['attributes']=_['intersection'](_0x5886bf[_0xd73b('0x3b')],qs[_0xd73b('0x3f')](_0x1d9d08['query']['fields']));_0x3b69ae[_0xd73b('0x40')]=_0x3b69ae['attributes'][_0xd73b('0x41')]?_0x3b69ae[_0xd73b('0x40')]:_0x5886bf[_0xd73b('0x3b')];if(!_0x1d9d08[_0xd73b('0x3c')]['hasOwnProperty']('nolimit')){_0x3b69ae[_0xd73b('0x2d')]=qs[_0xd73b('0x2d')](_0x1d9d08[_0xd73b('0x3c')][_0xd73b('0x2d')]);_0x3b69ae[_0xd73b('0x2c')]=qs[_0xd73b('0x2c')](_0x1d9d08[_0xd73b('0x3c')]['offset']);}_0x3b69ae[_0xd73b('0x42')]=qs[_0xd73b('0x43')](_0x1d9d08[_0xd73b('0x3c')][_0xd73b('0x43')]);_0x3b69ae['where']=qs[_0xd73b('0x3d')](_['pick'](_0x1d9d08[_0xd73b('0x3c')],_0x5886bf[_0xd73b('0x3d')]),_0x418608);if(_0x1d9d08[_0xd73b('0x3c')][_0xd73b('0x44')]){_0x3b69ae[_0xd73b('0x45')]=_[_0xd73b('0x46')](_0x3b69ae[_0xd73b('0x45')],{'$or':_[_0xd73b('0x38')](_0x418608,function(_0x374d2b){if(_0x374d2b[_0xd73b('0x47')]!==_0xd73b('0x48')){var _0x5b5efe={};_0x5b5efe[_0x374d2b[_0xd73b('0x35')]]={'$like':'%'+_0x1d9d08[_0xd73b('0x3c')][_0xd73b('0x44')]+'%'};return _0x5b5efe;}})});}_0x3b69ae=_[_0xd73b('0x46')]({},_0x3b69ae,_0x1d9d08['options']);var _0x582b35={'where':_0x3b69ae[_0xd73b('0x45')]};return db[_0xd73b('0x39')][_0xd73b('0x2f')](_0x582b35)[_0xd73b('0x20')](function(_0x39bb66){_0x44bd2e[_0xd73b('0x2f')]=_0x39bb66;if(_0x1d9d08['query'][_0xd73b('0x49')]){_0x3b69ae[_0xd73b('0x4a')]=[{'all':!![]}];}return db[_0xd73b('0x39')]['findAll'](_0x3b69ae);})['then'](function(_0x590948){_0x44bd2e[_0xd73b('0x4b')]=_0x590948;return _0x44bd2e;})['then'](respondWithFilteredResult(_0x577e44,_0x3b69ae))[_0xd73b('0x4c')](handleError(_0x577e44,null));};exports[_0xd73b('0x4d')]=function(_0x5c48c0,_0x4add6e){var _0x2c9fbd={'raw':!![],'where':{'id':_0x5c48c0['params']['id']}},_0x1ae6a4={};_0x1ae6a4[_0xd73b('0x3b')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x1ae6a4['query']=_[_0xd73b('0x4e')](_0x5c48c0['query']);_0x1ae6a4['filters']=_[_0xd73b('0x3e')](_0x1ae6a4['model'],_0x1ae6a4[_0xd73b('0x3c')]);_0x2c9fbd['attributes']=_['intersection'](_0x1ae6a4[_0xd73b('0x3b')],qs[_0xd73b('0x3f')](_0x5c48c0[_0xd73b('0x3c')][_0xd73b('0x3f')]));_0x2c9fbd[_0xd73b('0x40')]=_0x2c9fbd[_0xd73b('0x40')][_0xd73b('0x41')]?_0x2c9fbd[_0xd73b('0x40')]:_0x1ae6a4[_0xd73b('0x3b')];if(_0x5c48c0[_0xd73b('0x3c')]['includeAll']){_0x2c9fbd[_0xd73b('0x4a')]=[{'all':!![]}];}_0x2c9fbd=_[_0xd73b('0x46')]({},_0x2c9fbd,_0x5c48c0[_0xd73b('0x4f')]);return db[_0xd73b('0x39')][_0xd73b('0x50')](_0x2c9fbd)['then'](handleEntityNotFound(_0x4add6e,null))[_0xd73b('0x20')](respondWithResult(_0x4add6e,null))[_0xd73b('0x4c')](handleError(_0x4add6e,null));};exports[_0xd73b('0x51')]=function(_0x40c463,_0x59b68d){return db[_0xd73b('0x39')]['create'](_0x40c463[_0xd73b('0x52')],{})[_0xd73b('0x20')](respondWithResult(_0x59b68d,0xc9))[_0xd73b('0x4c')](handleError(_0x59b68d,null));};exports[_0xd73b('0x32')]=function(_0x4847bb,_0x192fcf){if(_0x4847bb[_0xd73b('0x52')]['id']){delete _0x4847bb[_0xd73b('0x52')]['id'];}return db[_0xd73b('0x39')][_0xd73b('0x50')]({'where':{'id':_0x4847bb[_0xd73b('0x53')]['id']}})[_0xd73b('0x20')](handleEntityNotFound(_0x192fcf,null))['then'](saveUpdates(_0x4847bb[_0xd73b('0x52')],null))[_0xd73b('0x20')](respondWithResult(_0x192fcf,null))[_0xd73b('0x4c')](handleError(_0x192fcf,null));};exports['destroy']=function(_0x463ce7,_0x4742d1){return db['WhatsappMessage'][_0xd73b('0x50')]({'where':{'id':_0x463ce7['params']['id']}})[_0xd73b('0x20')](handleEntityNotFound(_0x4742d1,null))['then'](removeEntity(_0x4742d1,null))[_0xd73b('0x4c')](handleError(_0x4742d1,null));};exports[_0xd73b('0x54')]=function(_0xb55c4a,_0x2381c9){return db[_0xd73b('0x39')][_0xd73b('0x54')]()['then'](respondWithResult(_0x2381c9,null))[_0xd73b('0x4c')](handleError(_0x2381c9,null));};var interaction_log=require('../../config/logger')(_0xd73b('0x55'));exports['accept']=function(_0x104d4e,_0x234fc2,_0x5abb86){var _0x45dcc5={'agent':{},'channel':'whatsapp'};if(_0x104d4e['body']['id']){delete _0x104d4e[_0xd73b('0x52')]['id'];}_0x104d4e[_0xd73b('0x52')]['read']=!![];_0x104d4e['body'][_0xd73b('0x56')]=moment()[_0xd73b('0x57')](_0xd73b('0x58'));_0x104d4e[_0xd73b('0x52')]['UserId']=_0x104d4e['body'][_0xd73b('0x59')]||_0x104d4e[_0xd73b('0x5a')]['id'];_0x45dcc5[_0xd73b('0x5b')]['id']=_0x104d4e[_0xd73b('0x52')]['UserId'];return db[_0xd73b('0x39')]['find']({'where':{'id':_0x104d4e['params']['id'],'UserId':null}})[_0xd73b('0x20')](handleEntityNotFound(_0x234fc2,null))[_0xd73b('0x20')](saveUpdates(_0x104d4e[_0xd73b('0x52')],null))[_0xd73b('0x20')](function(_0x251c20){if(_0x251c20){_0x45dcc5[_0xd73b('0x25')]=_0x251c20[_0xd73b('0x5c')]({'plain':!![]});return db[_0xd73b('0x5d')][_0xd73b('0x50')]({'where':{'id':_0x251c20[_0xd73b('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x234fc2,null))[_0xd73b('0x20')](function(_0x48183b){if(_0x48183b){return _0x48183b[_0xd73b('0x32')]({'UserId':_0x104d4e[_0xd73b('0x52')][_0xd73b('0x59')],'read1stAt':_[_0xd73b('0x5f')](_0x48183b[_0xd73b('0x60')])?moment()['format'](_0xd73b('0x58')):undefined});}return null;})[_0xd73b('0x20')](function(_0x365489){if(_0x365489){_0x45dcc5['interaction']=_0x365489[_0xd73b('0x5c')]({'plain':!![]});interaction_log[_0xd73b('0x26')](_0xd73b('0x61'),_0x104d4e['user']['id'],_0x104d4e[_0xd73b('0x5a')][_0xd73b('0x35')],_0x104d4e[_0xd73b('0x5a')][_0xd73b('0x62')],_0x45dcc5['interaction']['id'],_0x104d4e[_0xd73b('0x52')]?JSON[_0xd73b('0x22')](_0x104d4e[_0xd73b('0x52')]):_0xd73b('0x63'));return respondWithRpcPromise(_0xd73b('0x64'),'acceptMessage',_0x45dcc5);}return null;})[_0xd73b('0x20')](function(_0x17362b){var _0x253535='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17362b['message'][_0xd73b('0x65')];return db[_0xd73b('0x66')][_0xd73b('0x3c')](_0x253535,{'type':db['Sequelize'][_0xd73b('0x67')][_0xd73b('0x68')],'raw':!![]})['then'](function(_0x2ac055){return _0x2ac055;});})[_0xd73b('0x20')](function(_0x567a63){if(_0x567a63){_0x45dcc5[_0xd73b('0x25')][_0xd73b('0x69')]=_0x567a63[0x0];if(!_0x104d4e[_0xd73b('0x52')][_0xd73b('0x59')])return;return db['User'][_0xd73b('0x50')]({'where':{'id':_0x104d4e[_0xd73b('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0xd73b('0x35'),_0xd73b('0x6a'),_0xd73b('0x6b'),_0xd73b('0x6c')],'raw':!![]});}return null;})['then'](function(_0x3c6ae9){if(!_0x3c6ae9)return null;_0x45dcc5[_0xd73b('0x25')][_0xd73b('0x5b')]=_0x3c6ae9;return _0x45dcc5;})[_0xd73b('0x20')](function(_0x2c820e){if(_0x2c820e){if(_0x104d4e['body'][_0xd73b('0x6d')]){_0x45dcc5['message'][_0xd73b('0x6e')]=util[_0xd73b('0x57')]('SIP/%s',_0x104d4e[_0xd73b('0x5a')][_0xd73b('0x35')]);_0x45dcc5[_0xd73b('0x25')][_0xd73b('0x6f')]=_0x45dcc5['channel'];_0x45dcc5[_0xd73b('0x25')]['motionChannel']=_0x45dcc5[_0xd73b('0x6f')];_0x45dcc5['message'][_0xd73b('0x70')]=_0xd73b('0x71');return respondWithRpcPromise(_0xd73b('0x72'),_0xd73b('0x72'),{'event':'acceptmessage','message':_0x45dcc5[_0xd73b('0x25')]},client9002)[_0xd73b('0x20')](function(){return _0x45dcc5;});}return _0x45dcc5;}return null;})[_0xd73b('0x20')](respondWithResult(_0x234fc2,null))[_0xd73b('0x4c')](handleError(_0x234fc2,null));};var interaction_log=require(_0xd73b('0x13'))(_0xd73b('0x55'));exports['reject']=function(_0x572709,_0x2fa1a0,_0x5e5ffd){var _0x3786d8={'agent':{},'channel':_0xd73b('0x73')};if(_0x572709[_0xd73b('0x52')]['id']){delete _0x572709[_0xd73b('0x52')]['id'];}_0x572709[_0xd73b('0x52')][_0xd73b('0x59')]=_0x572709[_0xd73b('0x52')][_0xd73b('0x59')]||_0x572709[_0xd73b('0x5a')]['id'];_0x3786d8[_0xd73b('0x5b')]['id']=_0x572709[_0xd73b('0x52')][_0xd73b('0x59')];return db[_0xd73b('0x39')][_0xd73b('0x50')]({'where':{'id':_0x572709[_0xd73b('0x53')]['id'],'UserId':null}})[_0xd73b('0x20')](handleEntityNotFound(_0x2fa1a0,null))[_0xd73b('0x20')](function(_0xccb778){if(_0xccb778){_0x3786d8[_0xd73b('0x25')]=_0xccb778[_0xd73b('0x5c')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0xccb778[_0xd73b('0x5e')]}});}return null;})[_0xd73b('0x20')](handleEntityNotFound(_0x2fa1a0,null))['then'](function(_0x3fb0b3){if(_0x3fb0b3){_0x3786d8[_0xd73b('0x74')]=_0x3fb0b3[_0xd73b('0x5c')]({'plain':!![]});interaction_log[_0xd73b('0x26')](_0xd73b('0x75'),_0x572709[_0xd73b('0x5a')]['id'],_0x572709['user']['name'],_0x572709['user'][_0xd73b('0x62')],_0x3786d8['interaction']['id'],_0x572709[_0xd73b('0x52')]?JSON[_0xd73b('0x22')](_0x572709[_0xd73b('0x52')]):'null');return respondWithRpcPromise(_0xd73b('0x76'),'rejectMessage',_0x3786d8);}return null;})['then'](function(_0x39c0e4){var _0x308d8b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x39c0e4[_0xd73b('0x25')][_0xd73b('0x65')];return db[_0xd73b('0x66')][_0xd73b('0x3c')](_0x308d8b,{'type':db[_0xd73b('0x77')]['QueryTypes'][_0xd73b('0x68')],'raw':!![]})['then'](function(_0x23bfd3){return _0x23bfd3;});})['then'](function(_0x330f61){if(_0x330f61){_0x3786d8[_0xd73b('0x25')]['contact']=_0x330f61[0x0];if(!_0x572709[_0xd73b('0x52')][_0xd73b('0x59')])return;return db[_0xd73b('0x78')][_0xd73b('0x50')]({'where':{'id':_0x572709[_0xd73b('0x52')]['UserId'],'role':_0xd73b('0x5b')},'attributes':['id',_0xd73b('0x35'),'fullname',_0xd73b('0x6b'),_0xd73b('0x6c')],'raw':!![]});}return null;})[_0xd73b('0x20')](function(_0x3f19ef){if(!_0x3f19ef)return null;_0x3786d8['message'][_0xd73b('0x5b')]=_0x3f19ef;return _0x3786d8;})['then'](function(_0x39e1e8){if(_0x39e1e8){_0x39e1e8[_0xd73b('0x25')]['interface']=util[_0xd73b('0x57')](_0xd73b('0x79'),_0x572709['user'][_0xd73b('0x35')]);_0x39e1e8['message'][_0xd73b('0x6f')]=_0x3786d8[_0xd73b('0x6f')];_0x39e1e8['message'][_0xd73b('0x7a')]=_0x3786d8[_0xd73b('0x6f')];_0x39e1e8['message'][_0xd73b('0x70')]=_0xd73b('0x7b');respondWithRpcPromise(_0xd73b('0x72'),_0xd73b('0x72'),{'event':_0xd73b('0x7c'),'message':_0x39e1e8[_0xd73b('0x25')]},client9002);return _0x3786d8;}return null;})[_0xd73b('0x20')](respondWithResult(_0x2fa1a0,null))[_0xd73b('0x4c')](handleError(_0x2fa1a0,null));};exports[_0xd73b('0x29')]=function(_0x2c07c6,_0x28efd0,_0x137ec8){if(_0x2c07c6[_0xd73b('0x52')]['id']){delete _0x2c07c6[_0xd73b('0x52')]['id'];}var _0x1ea584;return db[_0xd73b('0x39')]['find']({'where':{'id':_0x2c07c6[_0xd73b('0x53')]['id']}})['then'](handleEntityNotFound(_0x28efd0,null))[_0xd73b('0x20')](function(_0x4d6d49){if(_0x4d6d49){_0x1ea584=_0x4d6d49;return db[_0xd73b('0x7d')][_0xd73b('0x50')]({'where':{'id':_0x4d6d49[_0xd73b('0x7e')]}});}})[_0xd73b('0x20')](handleEntityNotFound(_0x28efd0,null))[_0xd73b('0x20')](function(_0x4fdca0){if(_0x4fdca0){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xd73b('0x7f'),_0x4fdca0['type'],util['inspect'](_0x2c07c6['body'],{'showHidden':![],'depth':null}));switch(_0x4fdca0['type']){case'twilio':if(_0x2c07c6['body'][_0xd73b('0x80')]&&_0x2c07c6['body']['MessageSid']===_0x1ea584[_0xd73b('0x81')]&&_0x2c07c6[_0xd73b('0x52')][_0xd73b('0x82')]&&_0x2c07c6[_0xd73b('0x52')][_0xd73b('0x82')]===_0xd73b('0x83')){return _0x1ea584[_0xd73b('0x32')]({'read':!![]});}else{logger['error'](_0xd73b('0x84'),'status',_0xd73b('0x85'),util[_0xd73b('0x86')](_0x2c07c6['body'],{'showHidden':![],'depth':null}));}break;}return _0x1ea584;}})['then'](respondWithResult(_0x28efd0,null))['catch'](handleError(_0x28efd0,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9f7f27e..5838eb0 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 _0xd4f4=['update','remove','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x44f446,_0x3784be){_0x44f446=_0x44f446-0x0;var _0xe87c46=_0xd4f4[_0x44f446];return _0xe87c46;};'use strict';var EventEmitter=require(_0x4d4f('0x0'));var WhatsappMessage=require(_0x4d4f('0x1'))['db'][_0x4d4f('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4d4f('0x3')](0x0);var events={'afterCreate':_0x4d4f('0x4'),'afterUpdate':_0x4d4f('0x5'),'afterDestroy':_0x4d4f('0x6')};function emitEvent(_0x2c43da){return function(_0x25087a,_0xa53cb8,_0x15585){WhatsappMessageEvents['emit'](_0x2c43da+':'+_0x25087a['id'],_0x25087a);WhatsappMessageEvents['emit'](_0x2c43da,_0x25087a);_0x15585(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x4d4f('0x7')](e,emitEvent(event));}}module[_0x4d4f('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xf7b4=['hook','exports','events','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4a3f56,_0xcf7839){var _0x31e385=function(_0x5bcaa3){while(--_0x5bcaa3){_0x4a3f56['push'](_0x4a3f56['shift']());}};_0x31e385(++_0xcf7839);}(_0xf7b4,0x152));var _0x4f7b=function(_0x17af33,_0xbd7fd7){_0x17af33=_0x17af33-0x0;var _0xccb817=_0xf7b4[_0x17af33];return _0xccb817;};'use strict';var EventEmitter=require(_0x4f7b('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4f7b('0x1')](0x0);var events={'afterCreate':_0x4f7b('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21b85f){return function(_0x3e18fd,_0x2e0e51,_0x44f991){WhatsappMessageEvents[_0x4f7b('0x3')](_0x21b85f+':'+_0x3e18fd['id'],_0x3e18fd);WhatsappMessageEvents[_0x4f7b('0x3')](_0x21b85f,_0x3e18fd);_0x44f991(null);};}for(var e in events){if(events[_0x4f7b('0x4')](e)){var event=events[e];WhatsappMessage[_0x4f7b('0x5')](e,emitEvent(event));}}module[_0x4f7b('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 693815d..6eef415 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 _0x84c5=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','phone','accountSid','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4'];(function(_0x195b37,_0x4cb059){var _0x1b78b4=function(_0x88296c){while(--_0x88296c){_0x195b37['push'](_0x195b37['shift']());}};_0x1b78b4(++_0x4cb059);}(_0x84c5,0x1de));var _0x584c=function(_0x6b9128,_0x261881){_0x6b9128=_0x6b9128-0x0;var _0x309d9e=_0x84c5[_0x6b9128];return _0x309d9e;};'use strict';var _=require(_0x584c('0x0'));var util=require(_0x584c('0x1'));var logger=require('../../config/logger')(_0x584c('0x2'));var moment=require(_0x584c('0x3'));var BPromise=require(_0x584c('0x4'));var rp=require(_0x584c('0x5'));var fs=require('fs');var path=require(_0x584c('0x6'));var rimraf=require(_0x584c('0x7'));var config=require(_0x584c('0x8'));var attributes=require(_0x584c('0x9'));module[_0x584c('0xa')]=function(_0x44a352,_0x338247){return _0x44a352[_0x584c('0xb')]('WhatsappMessage',attributes,{'tableName':_0x584c('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x584c('0xd')]},{'name':_0x584c('0xe'),'fields':[_0x584c('0xf')],'type':_0x584c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x119c49,_0x2da570,_0x292948){var _0x436163=_0x44a352[_0x584c('0x11')];var _0x1ac6fb=_0x119c49[_0x584c('0x12')]({'plain':!![]});if(_0x1ac6fb['direction'][_0x584c('0x13')]()==='in'||_0x1ac6fb[_0x584c('0x14')]['toLowerCase']()===_0x584c('0x15')&&!_0x1ac6fb[_0x584c('0x16')]&&!_[_0x584c('0x17')](_0x1ac6fb[_0x584c('0x18')])){_0x436163[_0x584c('0x19')][_0x584c('0x1a')]({'where':{'id':_0x1ac6fb[_0x584c('0x1b')]}})[_0x584c('0x1c')](function(_0x4614de){if(_0x4614de){_0x4614de[_0x584c('0x1d')]({'lastMsgAt':_0x1ac6fb['createdAt'],'lastMsgDirection':_0x1ac6fb[_0x584c('0x14')][_0x584c('0x13')]()});}})[_0x584c('0x1e')](function(_0x4e70a7){console[_0x584c('0x1f')](_0x4e70a7);});}if(_0x1ac6fb[_0x584c('0x14')]===_0x584c('0x15')&&!_0x1ac6fb[_0x584c('0x16')]){var _0x47100c;_0x436163[_0x584c('0x20')]['find']({'where':{'id':_0x1ac6fb[_0x584c('0x21')]},'raw':!![]})['then'](function(_0x2b0710){_0x47100c=_0x2b0710;if(_0x47100c&&_0x47100c['type']){switch(_0x47100c[_0x584c('0x22')]){case _0x584c('0x23'):var _0x233a86=require(_0x584c('0x23'));if(_0x47100c['accountSid']&&_0x47100c['authToken']&&_0x47100c[_0x584c('0x24')]){var _0x334a72=new _0x233a86(_0x47100c[_0x584c('0x25')],_0x47100c[_0x584c('0x26')]);_0x334a72[_0x584c('0x27')][_0x584c('0x28')]({'body':_0x1ac6fb[_0x584c('0xf')],'to':_0x584c('0x29')+_0x1ac6fb[_0x584c('0x24')],'from':_0x584c('0x29')+_0x47100c[_0x584c('0x24')],'statusCallback':_0x47100c[_0x584c('0x2a')]+_0x584c('0x2b')+_0x1ac6fb['id']+_0x584c('0x2c')+_0x47100c['token']})[_0x584c('0x1c')](function(_0x524c9b){if(_0x524c9b[_0x584c('0x2d')]){return _0x119c49[_0x584c('0x1d')]({'messageId':_0x524c9b['sid']});}})[_0x584c('0x1e')](function(_0x3910f3){logger[_0x584c('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x584c('0x2e'),_0x584c('0x23'),util[_0x584c('0x2f')](_0x3910f3,{'showHidden':![],'depth':null}));});}else{logger[_0x584c('0x1f')](_0x584c('0x30'),_0x584c('0x2e'),_0x584c('0x23'),_0x584c('0x31'));}break;}}})[_0x584c('0x32')](function(){_0x292948();});}else{_0x292948();}}},'charset':_0x584c('0x33'),'collate':_0x584c('0x34')});}; \ No newline at end of file +var _0xdf4b=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','body','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4'];(function(_0x56b928,_0x3ae2d7){var _0x2c7f45=function(_0x4bc9d2){while(--_0x4bc9d2){_0x56b928['push'](_0x56b928['shift']());}};_0x2c7f45(++_0x3ae2d7);}(_0xdf4b,0x88));var _0xbdf4=function(_0x3a58f1,_0x1610fc){_0x3a58f1=_0x3a58f1-0x0;var _0x2c62f7=_0xdf4b[_0x3a58f1];return _0x2c62f7;};'use strict';var _=require(_0xbdf4('0x0'));var util=require(_0xbdf4('0x1'));var logger=require('../../config/logger')(_0xbdf4('0x2'));var moment=require(_0xbdf4('0x3'));var BPromise=require(_0xbdf4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbdf4('0x5'));var attributes=require(_0xbdf4('0x6'));module[_0xbdf4('0x7')]=function(_0x2df14a,_0x5830c0){return _0x2df14a[_0xbdf4('0x8')](_0xbdf4('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbdf4('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0xbdf4('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x475c5d,_0x5ab27b,_0xe300a){var _0x372bce=_0x2df14a['models'];var _0x58824f=_0x475c5d[_0xbdf4('0xc')]({'plain':!![]});if(_0x58824f[_0xbdf4('0xd')]['toLowerCase']()==='in'||_0x58824f[_0xbdf4('0xd')][_0xbdf4('0xe')]()===_0xbdf4('0xf')&&!_0x58824f[_0xbdf4('0x10')]&&!_[_0xbdf4('0x11')](_0x58824f['UserId'])){_0x372bce[_0xbdf4('0x12')][_0xbdf4('0x13')]({'where':{'id':_0x58824f[_0xbdf4('0x14')]}})[_0xbdf4('0x15')](function(_0x3a2f52){if(_0x3a2f52){_0x3a2f52[_0xbdf4('0x16')]({'lastMsgAt':_0x58824f[_0xbdf4('0x17')],'lastMsgDirection':_0x58824f[_0xbdf4('0xd')][_0xbdf4('0xe')]()});}})[_0xbdf4('0x18')](function(_0x5e1831){console[_0xbdf4('0x19')](_0x5e1831);});}if(_0x58824f[_0xbdf4('0xd')]===_0xbdf4('0xf')&&!_0x58824f[_0xbdf4('0x10')]){var _0x38f37b;_0x372bce['WhatsappAccount'][_0xbdf4('0x1a')]({'where':{'id':_0x58824f['WhatsappAccountId']},'raw':!![]})[_0xbdf4('0x15')](function(_0x24e11e){_0x38f37b=_0x24e11e;if(_0x38f37b&&_0x38f37b[_0xbdf4('0x1b')]){switch(_0x38f37b['type']){case'twilio':var _0x4168e4=require(_0xbdf4('0x1c'));if(_0x38f37b[_0xbdf4('0x1d')]&&_0x38f37b[_0xbdf4('0x1e')]&&_0x38f37b[_0xbdf4('0x1f')]){var _0x4d82f5=new _0x4168e4(_0x38f37b['accountSid'],_0x38f37b['authToken']);_0x4d82f5[_0xbdf4('0x20')][_0xbdf4('0x21')]({'body':_0x58824f[_0xbdf4('0xb')],'to':_0xbdf4('0x22')+_0x58824f['phone'],'from':_0xbdf4('0x22')+_0x38f37b[_0xbdf4('0x1f')],'statusCallback':_0x38f37b[_0xbdf4('0x23')]+_0xbdf4('0x24')+_0x58824f['id']+_0xbdf4('0x25')+_0x38f37b[_0xbdf4('0x26')]})['then'](function(_0x1dd1a7){if(_0x1dd1a7['sid']){return _0x475c5d[_0xbdf4('0x16')]({'messageId':_0x1dd1a7[_0xbdf4('0x27')]});}})[_0xbdf4('0x18')](function(_0xddb92f){logger['error'](_0xbdf4('0x28'),'afterCreate',_0xbdf4('0x1c'),util[_0xbdf4('0x29')](_0xddb92f,{'showHidden':![],'depth':null}));});}else{logger[_0xbdf4('0x19')](_0xbdf4('0x28'),'afterCreate',_0xbdf4('0x1c'),_0xbdf4('0x2a'));}break;}}})['finally'](function(){_0xe300a();});}else{_0xe300a();}}},'charset':_0xbdf4('0x2b'),'collate':_0xbdf4('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 9280130..ff3d9ed 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 _0xbe07=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','info','lodash'];(function(_0x1ffa5a,_0x3bafeb){var _0x5cbfe9=function(_0x5a3bea){while(--_0x5a3bea){_0x1ffa5a['push'](_0x1ffa5a['shift']());}};_0x5cbfe9(++_0x3bafeb);}(_0xbe07,0x13a));var _0x7be0=function(_0x2c4e47,_0x4dfdd3){_0x2c4e47=_0x2c4e47-0x0;var _0xea65a2=_0xbe07[_0x2c4e47];return _0xea65a2;};'use strict';var _=require(_0x7be0('0x0'));var util=require(_0x7be0('0x1'));var moment=require(_0x7be0('0x2'));var BPromise=require(_0x7be0('0x3'));var rs=require(_0x7be0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7be0('0x5'))['db'];var utils=require(_0x7be0('0x6'));var logger=require(_0x7be0('0x7'))(_0x7be0('0x8'));var config=require(_0x7be0('0x9'));var jayson=require(_0x7be0('0xa'));var client=jayson[_0x7be0('0xb')][_0x7be0('0xc')]({'port':0x232a});config[_0x7be0('0xd')]=_['defaults'](config['redis'],{'host':_0x7be0('0xe'),'port':0x18eb});var socket=require(_0x7be0('0xf'))(new Redis(config[_0x7be0('0xd')]));require(_0x7be0('0x10'))[_0x7be0('0x11')](socket);function respondWithRpcPromise(_0x50a026,_0x3be83e,_0xf628d8){return new BPromise(function(_0x1d30bc,_0x2420c9){return client[_0x7be0('0x12')](_0x50a026,_0xf628d8)[_0x7be0('0x13')](function(_0x40bac4){logger['info'](_0x7be0('0x14'),_0x3be83e,'request\x20sent');logger[_0x7be0('0x15')](_0x7be0('0x16'),_0x3be83e,_0x7be0('0x17'),JSON[_0x7be0('0x18')](_0x40bac4));if(_0x40bac4[_0x7be0('0x19')]){if(_0x40bac4['error']['code']===0x1f4){logger[_0x7be0('0x19')](_0x7be0('0x14'),_0x3be83e,_0x40bac4['error'][_0x7be0('0x1a')]);return _0x2420c9(_0x40bac4[_0x7be0('0x19')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3be83e,_0x40bac4[_0x7be0('0x19')][_0x7be0('0x1a')]);return _0x1d30bc(_0x40bac4[_0x7be0('0x19')][_0x7be0('0x1a')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3be83e,_0x7be0('0x17'));_0x1d30bc(_0x40bac4[_0x7be0('0x1b')][_0x7be0('0x1a')]);}})[_0x7be0('0x1c')](function(_0x316c2b){logger[_0x7be0('0x19')](_0x7be0('0x14'),_0x3be83e,_0x316c2b);_0x2420c9(_0x316c2b);});});}exports[_0x7be0('0x1d')]=function(_0x27c03f){var _0x3f5023=this;return new Promise(function(_0x47a4c7,_0x39ba11){return db[_0x7be0('0x1e')][_0x7be0('0x1f')](_0x27c03f['body'],{'raw':_0x27c03f[_0x7be0('0x20')]?_0x27c03f[_0x7be0('0x20')][_0x7be0('0x21')]===undefined?!![]:![]:!![]})[_0x7be0('0x13')](function(_0x1415ab){logger[_0x7be0('0x22')](_0x7be0('0x1d'),_0x27c03f);logger['debug'](_0x7be0('0x1d'),_0x27c03f,JSON[_0x7be0('0x18')](_0x1415ab));_0x47a4c7(_0x1415ab);})['catch'](function(_0x3e313b){logger[_0x7be0('0x19')](_0x7be0('0x1d'),_0x3e313b[_0x7be0('0x1a')],_0x27c03f);_0x39ba11(_0x3f5023['error'](0x1f4,_0x3e313b[_0x7be0('0x1a')]));});});}; \ No newline at end of file +var _0xec67=['code','message','WhatsappMessage,\x20%s,\x20%s','result','WhatsappMessage','body','options','raw','debug','CreateWhatsappMessage','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then','info','request\x20sent','stringify','error'];(function(_0x50bc62,_0x4c1800){var _0x3c11c4=function(_0x59bfd9){while(--_0x59bfd9){_0x50bc62['push'](_0x50bc62['shift']());}};_0x3c11c4(++_0x4c1800);}(_0xec67,0x122));var _0x7ec6=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xec67[_0x337748];return _0x3bb03f;};'use strict';var _=require(_0x7ec6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7ec6('0x1'));var rs=require(_0x7ec6('0x2'));var fs=require('fs');var Redis=require(_0x7ec6('0x3'));var db=require(_0x7ec6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ec6('0x5'));var config=require(_0x7ec6('0x6'));var jayson=require(_0x7ec6('0x7'));var client=jayson[_0x7ec6('0x8')][_0x7ec6('0x9')]({'port':0x232a});config[_0x7ec6('0xa')]=_[_0x7ec6('0xb')](config['redis'],{'host':_0x7ec6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ec6('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x14ecb5,_0x123900,_0x4ff181){return new BPromise(function(_0x80a5b1,_0x19ee4b){return client['request'](_0x14ecb5,_0x4ff181)[_0x7ec6('0xd')](function(_0x46b316){logger[_0x7ec6('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x123900,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x123900,_0x7ec6('0xf'),JSON[_0x7ec6('0x10')](_0x46b316));if(_0x46b316[_0x7ec6('0x11')]){if(_0x46b316[_0x7ec6('0x11')][_0x7ec6('0x12')]===0x1f4){logger[_0x7ec6('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x123900,_0x46b316[_0x7ec6('0x11')][_0x7ec6('0x13')]);return _0x19ee4b(_0x46b316[_0x7ec6('0x11')][_0x7ec6('0x13')]);}logger[_0x7ec6('0x11')](_0x7ec6('0x14'),_0x123900,_0x46b316[_0x7ec6('0x11')]['message']);return _0x80a5b1(_0x46b316[_0x7ec6('0x11')]['message']);}else{logger['info'](_0x7ec6('0x14'),_0x123900,'request\x20sent');_0x80a5b1(_0x46b316[_0x7ec6('0x15')]['message']);}})['catch'](function(_0x5458a3){logger[_0x7ec6('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x123900,_0x5458a3);_0x19ee4b(_0x5458a3);});});}exports['CreateWhatsappMessage']=function(_0x1a1f93){var _0x4439bb=this;return new Promise(function(_0x142fb3,_0xbf7752){return db[_0x7ec6('0x16')]['create'](_0x1a1f93[_0x7ec6('0x17')],{'raw':_0x1a1f93[_0x7ec6('0x18')]?_0x1a1f93[_0x7ec6('0x18')][_0x7ec6('0x19')]===undefined?!![]:![]:!![]})[_0x7ec6('0xd')](function(_0x5b39e8){logger['info']('CreateWhatsappMessage',_0x1a1f93);logger[_0x7ec6('0x1a')]('CreateWhatsappMessage',_0x1a1f93,JSON[_0x7ec6('0x10')](_0x5b39e8));_0x142fb3(_0x5b39e8);})['catch'](function(_0x31138e){logger[_0x7ec6('0x11')](_0x7ec6('0x1b'),_0x31138e['message'],_0x1a1f93);_0xbf7752(_0x4439bb[_0x7ec6('0x11')](0x1f4,_0x31138e[_0x7ec6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 989a14f..f44f739 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 _0x6f2d=['remove','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x16652e,_0x28a210){var _0x31d01e=function(_0x401ad8){while(--_0x401ad8){_0x16652e['push'](_0x16652e['shift']());}};_0x31d01e(++_0x28a210);}(_0x6f2d,0x7c));var _0xd6f2=function(_0x414848,_0x4eed03){_0x414848=_0x414848-0x0;var _0x1f33e1=_0x6f2d[_0x414848];return _0x1f33e1;};'use strict';var WhatsappMessageEvents=require(_0xd6f2('0x0'));var events=[_0xd6f2('0x1'),_0xd6f2('0x2'),'update'];function createListener(_0x2766bf,_0x299eda){return function(_0x47be4d){_0x299eda['emit'](_0x2766bf,_0x47be4d);};}function removeListener(_0x17f1b7,_0x2f6945){return function(){WhatsappMessageEvents['removeListener'](_0x17f1b7,_0x2f6945);};}exports[_0xd6f2('0x3')]=function(_0x12da94){for(var _0x10db75=0x0,_0xc831a1=events[_0xd6f2('0x4')];_0x10db75<_0xc831a1;_0x10db75++){var _0x3c0232=events[_0x10db75];var _0x3fd06c=createListener(_0xd6f2('0x5')+_0x3c0232,_0x12da94);WhatsappMessageEvents['on'](_0x3c0232,_0x3fd06c);}}; \ No newline at end of file +var _0xb2a1=['length','./whatsappMessage.events','save','remove','update','register'];(function(_0x4fb5d9,_0x1d776f){var _0x25ebe8=function(_0x501c13){while(--_0x501c13){_0x4fb5d9['push'](_0x4fb5d9['shift']());}};_0x25ebe8(++_0x1d776f);}(_0xb2a1,0x8b));var _0x1b2a=function(_0x5207da,_0x4a1dcd){_0x5207da=_0x5207da-0x0;var _0x26407c=_0xb2a1[_0x5207da];return _0x26407c;};'use strict';var WhatsappMessageEvents=require(_0x1b2a('0x0'));var events=[_0x1b2a('0x1'),_0x1b2a('0x2'),_0x1b2a('0x3')];function createListener(_0x4b9328,_0x217ac2){return function(_0x57548a){_0x217ac2['emit'](_0x4b9328,_0x57548a);};}function removeListener(_0x386c9e,_0x4d97){return function(){WhatsappMessageEvents['removeListener'](_0x386c9e,_0x4d97);};}exports[_0x1b2a('0x4')]=function(_0x4cccb3){for(var _0x55fa80=0x0,_0x20b884=events[_0x1b2a('0x5')];_0x55fa80<_0x20b884;_0x55fa80++){var _0x20f2ea=events[_0x55fa80];var _0x1448a9=createListener('whatsappMessage:'+_0x20f2ea,_0x4cccb3);WhatsappMessageEvents['on'](_0x20f2ea,_0x1448a9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 91759f6..a19e2f0 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 _0xcf3c=['getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','/:id/teams','/:id/users'];(function(_0x5f3f05,_0x35820d){var _0x198107=function(_0xa32400){while(--_0xa32400){_0x5f3f05['push'](_0x5f3f05['shift']());}};_0x198107(++_0x35820d);}(_0xcf3c,0x168));var _0xccf3=function(_0x4cb297,_0x45953a){_0x4cb297=_0x4cb297-0x0;var _0x6516cc=_0xcf3c[_0x4cb297];return _0x6516cc;};'use strict';var multer=require(_0xccf3('0x0'));var util=require('util');var path=require(_0xccf3('0x1'));var timeout=require('connect-timeout');var express=require(_0xccf3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xccf3('0x3'));var interaction=require(_0xccf3('0x4'));var config=require(_0xccf3('0x5'));var controller=require(_0xccf3('0x6'));router[_0xccf3('0x7')]('/',auth[_0xccf3('0x8')](),controller[_0xccf3('0x9')]);router[_0xccf3('0x7')]('/describe',auth[_0xccf3('0x8')](),controller['describe']);router[_0xccf3('0x7')](_0xccf3('0xa'),auth[_0xccf3('0x8')](),controller[_0xccf3('0xb')]);router[_0xccf3('0x7')](_0xccf3('0xc'),auth[_0xccf3('0x8')](),controller['getMembers']);router[_0xccf3('0x7')](_0xccf3('0xd'),auth['isAuthenticated'](),controller['getTeams']);router[_0xccf3('0x7')](_0xccf3('0xe'),auth[_0xccf3('0x8')](),controller[_0xccf3('0xf')]);router[_0xccf3('0x10')]('/',auth[_0xccf3('0x8')](),controller[_0xccf3('0x11')]);router[_0xccf3('0x10')](_0xccf3('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xccf3('0xe'),auth[_0xccf3('0x8')](),controller[_0xccf3('0x12')]);router[_0xccf3('0x13')](_0xccf3('0xa'),auth[_0xccf3('0x8')](),controller['update']);router[_0xccf3('0x14')](_0xccf3('0xa'),auth[_0xccf3('0x8')](),controller[_0xccf3('0x15')]);router[_0xccf3('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xccf3('0x16')]);router['delete'](_0xccf3('0xe'),auth['isAuthenticated'](),controller[_0xccf3('0x17')]);module[_0xccf3('0x18')]=router; \ No newline at end of file +var _0xd4df=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','path','express'];(function(_0x306f7a,_0x16764d){var _0x1bbe84=function(_0x3c3937){while(--_0x3c3937){_0x306f7a['push'](_0x306f7a['shift']());}};_0x1bbe84(++_0x16764d);}(_0xd4df,0xb2));var _0xfd4d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4df[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd4d('0x0'));var timeout=require('connect-timeout');var express=require(_0xfd4d('0x1'));var router=express[_0xfd4d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfd4d('0x3'));var interaction=require(_0xfd4d('0x4'));var config=require(_0xfd4d('0x5'));var controller=require(_0xfd4d('0x6'));router[_0xfd4d('0x7')]('/',auth['isAuthenticated'](),controller[_0xfd4d('0x8')]);router[_0xfd4d('0x7')](_0xfd4d('0x9'),auth[_0xfd4d('0xa')](),controller[_0xfd4d('0xb')]);router[_0xfd4d('0x7')](_0xfd4d('0xc'),auth[_0xfd4d('0xa')](),controller[_0xfd4d('0xd')]);router[_0xfd4d('0x7')](_0xfd4d('0xe'),auth[_0xfd4d('0xa')](),controller[_0xfd4d('0xf')]);router[_0xfd4d('0x7')](_0xfd4d('0x10'),auth[_0xfd4d('0xa')](),controller[_0xfd4d('0x11')]);router[_0xfd4d('0x7')](_0xfd4d('0x12'),auth[_0xfd4d('0xa')](),controller[_0xfd4d('0x13')]);router[_0xfd4d('0x14')]('/',auth[_0xfd4d('0xa')](),controller[_0xfd4d('0x15')]);router[_0xfd4d('0x14')](_0xfd4d('0x10'),auth['isAuthenticated'](),controller[_0xfd4d('0x16')]);router[_0xfd4d('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xfd4d('0x17')]);router[_0xfd4d('0x18')]('/:id',auth[_0xfd4d('0xa')](),controller[_0xfd4d('0x19')]);router[_0xfd4d('0x1a')](_0xfd4d('0xc'),auth[_0xfd4d('0xa')](),controller[_0xfd4d('0x1b')]);router[_0xfd4d('0x1a')](_0xfd4d('0x10'),auth['isAuthenticated'](),controller[_0xfd4d('0x1c')]);router['delete'](_0xfd4d('0x12'),auth[_0xfd4d('0xa')](),controller['removeAgents']);module[_0xfd4d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 31fd7d5..133146f 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 _0xd404=['beepall','roundrobin','STRING','sequelize','exports','name','INTEGER','rrmemory'];(function(_0x28f0f0,_0x2ffe17){var _0x263598=function(_0x2ada7c){while(--_0x2ada7c){_0x28f0f0['push'](_0x28f0f0['shift']());}};_0x263598(++_0x2ffe17);}(_0xd404,0x15b));var _0x4d40=function(_0x4cb363,_0xf6185a){_0x4cb363=_0x4cb363-0x0;var _0xdc8cd9=_0xd404[_0x4cb363];return _0xdc8cd9;};'use strict';var Sequelize=require(_0x4d40('0x0'));module[_0x4d40('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4d40('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4d40('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4d40('0x4'),_0x4d40('0x5'),_0x4d40('0x6'))},'description':{'type':Sequelize[_0x4d40('0x7')]}}; \ No newline at end of file +var _0x54f3=['exports','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x5617b6,_0x3e74d6){var _0x3f780f=function(_0x4c6e07){while(--_0x4c6e07){_0x5617b6['push'](_0x5617b6['shift']());}};_0x3f780f(++_0x3e74d6);}(_0x54f3,0x120));var _0x354f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x54f3[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'name':{'type':Sequelize[_0x354f('0x1')],'unique':_0x354f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x354f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x354f('0x4')]('rrmemory','beepall',_0x354f('0x5'))},'description':{'type':Sequelize[_0x354f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 96693f6..deadf44 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 _0x201b=['offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','get','WhatsappQueues','sendStatus','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','body','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','value','removeTeams','forEach','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','end','json'];(function(_0x292226,_0x1bdf80){var _0x147199=function(_0x5d94c1){while(--_0x5d94c1){_0x292226['push'](_0x292226['shift']());}};_0x147199(++_0x1bdf80);}(_0x201b,0x69));var _0xb201=function(_0x12f664,_0x4d8274){_0x12f664=_0x12f664-0x0;var _0x28bab2=_0x201b[_0x12f664];return _0x28bab2;};'use strict';var emlformat=require(_0xb201('0x0'));var rimraf=require(_0xb201('0x1'));var zipdir=require(_0xb201('0x2'));var jsonpatch=require(_0xb201('0x3'));var rp=require(_0xb201('0x4'));var moment=require('moment');var BPromise=require(_0xb201('0x5'));var Mustache=require(_0xb201('0x6'));var util=require(_0xb201('0x7'));var path=require(_0xb201('0x8'));var sox=require('sox');var csv=require(_0xb201('0x9'));var ejs=require(_0xb201('0xa'));var fs=require('fs');var fs_extra=require(_0xb201('0xb'));var _=require(_0xb201('0xc'));var squel=require(_0xb201('0xd'));var crypto=require(_0xb201('0xe'));var jsforce=require(_0xb201('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb201('0x10'));var Papa=require('papaparse');var Redis=require(_0xb201('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb201('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb201('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb201('0x14'));var licenseUtil=require(_0xb201('0x15'));var db=require(_0xb201('0x16'))['db'];config[_0xb201('0x17')]=_[_0xb201('0x18')](config[_0xb201('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb201('0x19'))(new Redis(config[_0xb201('0x17')]));require(_0xb201('0x1a'))[_0xb201('0x1b')](socket);function respondWithStatusCode(_0x14161a,_0x2ff778){_0x2ff778=_0x2ff778||0xcc;return function(_0x10cd32){if(_0x10cd32){return _0x14161a['sendStatus'](_0x2ff778);}return _0x14161a['status'](_0x2ff778)[_0xb201('0x1c')]();};}function respondWithResult(_0x2c9dc0,_0x16ecfd){_0x16ecfd=_0x16ecfd||0xc8;return function(_0x42217f){if(_0x42217f){return _0x2c9dc0['status'](_0x16ecfd)[_0xb201('0x1d')](_0x42217f);}};}function respondWithFilteredResult(_0x2738a9,_0x5ade24){return function(_0x44bb13){if(_0x44bb13){var _0x4cd885=typeof _0x5ade24[_0xb201('0x1e')]===_0xb201('0x1f')&&typeof _0x5ade24['limit']==='undefined';var _0x510517=_0x44bb13['count'];var _0x44c9a6=_0x4cd885?0x0:_0x5ade24[_0xb201('0x1e')];var _0x3e8488=_0x4cd885?_0x44bb13[_0xb201('0x20')]:_0x5ade24[_0xb201('0x1e')]+_0x5ade24[_0xb201('0x21')];var _0x46c543;if(_0x3e8488>=_0x510517){_0x3e8488=_0x510517;_0x46c543=0xc8;}else{_0x46c543=0xce;}_0x2738a9[_0xb201('0x22')](_0x46c543);return _0x2738a9[_0xb201('0x23')](_0xb201('0x24'),_0x44c9a6+'-'+_0x3e8488+'/'+_0x510517)[_0xb201('0x1d')](_0x44bb13);}return null;};}function patchUpdates(_0x5f2a57){return function(_0x59973e){try{jsonpatch['apply'](_0x59973e,_0x5f2a57,!![]);}catch(_0x1a6817){return BPromise['reject'](_0x1a6817);}return _0x59973e['save']();};}function saveUpdates(_0x2d9b79,_0x4ad538){return function(_0x5cd18d){if(_0x5cd18d){return _0x5cd18d[_0xb201('0x25')](_0x2d9b79)[_0xb201('0x26')](function(_0x101f77){return _0x101f77;});}return null;};}function removeEntity(_0x4174f0,_0x45824a){return function(_0x1e7d8e){if(_0x1e7d8e){return _0x1e7d8e[_0xb201('0x27')]()[_0xb201('0x26')](function(){var _0x46d309=_0x1e7d8e[_0xb201('0x28')]({'plain':!![]});var _0x269bf4=_0xb201('0x29');return db['UserProfileResource'][_0xb201('0x27')]({'where':{'type':_0x269bf4,'resourceId':_0x46d309['id']}})[_0xb201('0x26')](function(){return _0x1e7d8e;});})[_0xb201('0x26')](function(){_0x4174f0[_0xb201('0x22')](0xcc)[_0xb201('0x1c')]();});}};}function handleEntityNotFound(_0x4fccd5,_0x52980e){return function(_0xaac1fe){if(!_0xaac1fe){_0x4fccd5[_0xb201('0x2a')](0x194);}return _0xaac1fe;};}function handleError(_0x1ef6bc,_0x516367){_0x516367=_0x516367||0x1f4;return function(_0x4fbab9){logger['error'](_0x4fbab9[_0xb201('0x2b')]);if(_0x4fbab9[_0xb201('0x2c')]){delete _0x4fbab9[_0xb201('0x2c')];}_0x1ef6bc[_0xb201('0x22')](_0x516367)[_0xb201('0x2d')](_0x4fbab9);};}exports[_0xb201('0x2e')]=function(_0x49d8d4,_0x884979){var _0x50d4ef={},_0x1a72e0={},_0x10f73f={'count':0x0,'rows':[]};var _0x282d0d=_[_0xb201('0x2f')](db[_0xb201('0x30')][_0xb201('0x31')],function(_0x5a412e){return{'name':_0x5a412e['fieldName'],'type':_0x5a412e[_0xb201('0x32')]['key']};});_0x1a72e0[_0xb201('0x33')]=_[_0xb201('0x2f')](_0x282d0d,_0xb201('0x2c'));_0x1a72e0[_0xb201('0x34')]=_['keys'](_0x49d8d4[_0xb201('0x34')]);_0x1a72e0[_0xb201('0x35')]=_['intersection'](_0x1a72e0[_0xb201('0x33')],_0x1a72e0[_0xb201('0x34')]);_0x50d4ef[_0xb201('0x36')]=_['intersection'](_0x1a72e0[_0xb201('0x33')],qs['fields'](_0x49d8d4[_0xb201('0x34')][_0xb201('0x37')]));_0x50d4ef['attributes']=_0x50d4ef[_0xb201('0x36')][_0xb201('0x38')]?_0x50d4ef[_0xb201('0x36')]:_0x1a72e0[_0xb201('0x33')];if(!_0x49d8d4[_0xb201('0x34')][_0xb201('0x39')](_0xb201('0x3a'))){_0x50d4ef[_0xb201('0x21')]=qs['limit'](_0x49d8d4[_0xb201('0x34')][_0xb201('0x21')]);_0x50d4ef[_0xb201('0x1e')]=qs['offset'](_0x49d8d4[_0xb201('0x34')][_0xb201('0x1e')]);}_0x50d4ef[_0xb201('0x3b')]=qs[_0xb201('0x3c')](_0x49d8d4[_0xb201('0x34')][_0xb201('0x3c')]);_0x50d4ef[_0xb201('0x3d')]=qs[_0xb201('0x35')](_[_0xb201('0x3e')](_0x49d8d4['query'],_0x1a72e0[_0xb201('0x35')]),_0x282d0d);if(_0x49d8d4[_0xb201('0x34')][_0xb201('0x3f')]){_0x50d4ef[_0xb201('0x3d')]=_[_0xb201('0x40')](_0x50d4ef[_0xb201('0x3d')],{'$or':_[_0xb201('0x2f')](_0x282d0d,function(_0x59e35c){if(_0x59e35c[_0xb201('0x32')]!==_0xb201('0x41')){var _0x4e2b57={};_0x4e2b57[_0x59e35c['name']]={'$like':'%'+_0x49d8d4['query'][_0xb201('0x3f')]+'%'};return _0x4e2b57;}})});}_0x50d4ef=_['merge']({},_0x50d4ef,_0x49d8d4[_0xb201('0x42')]);var _0x23f6b4={'where':_0x50d4ef[_0xb201('0x3d')]};return db['WhatsappQueue']['count'](_0x23f6b4)[_0xb201('0x26')](function(_0x4fa557){_0x10f73f[_0xb201('0x20')]=_0x4fa557;if(_0x49d8d4['query'][_0xb201('0x43')]){_0x50d4ef['include']=[{'all':!![]}];}return db[_0xb201('0x30')][_0xb201('0x44')](_0x50d4ef);})[_0xb201('0x26')](function(_0x5002c5){_0x10f73f[_0xb201('0x45')]=_0x5002c5;return _0x10f73f;})['then'](respondWithFilteredResult(_0x884979,_0x50d4ef))[_0xb201('0x46')](handleError(_0x884979,null));};exports['show']=function(_0x5a1d47,_0x1fad10){var _0x3ee574={'raw':!![],'where':{'id':_0x5a1d47[_0xb201('0x47')]['id']}},_0x5cf927={};_0x5cf927[_0xb201('0x33')]=_[_0xb201('0x48')](db[_0xb201('0x30')][_0xb201('0x31')]);_0x5cf927[_0xb201('0x34')]=_[_0xb201('0x48')](_0x5a1d47[_0xb201('0x34')]);_0x5cf927[_0xb201('0x35')]=_[_0xb201('0x49')](_0x5cf927[_0xb201('0x33')],_0x5cf927[_0xb201('0x34')]);_0x3ee574[_0xb201('0x36')]=_[_0xb201('0x49')](_0x5cf927[_0xb201('0x33')],qs[_0xb201('0x37')](_0x5a1d47[_0xb201('0x34')][_0xb201('0x37')]));_0x3ee574[_0xb201('0x36')]=_0x3ee574[_0xb201('0x36')][_0xb201('0x38')]?_0x3ee574[_0xb201('0x36')]:_0x5cf927[_0xb201('0x33')];if(_0x5a1d47[_0xb201('0x34')][_0xb201('0x43')]){_0x3ee574['include']=[{'all':!![]}];}_0x3ee574=_['merge']({},_0x3ee574,_0x5a1d47['options']);return db[_0xb201('0x30')][_0xb201('0x4a')](_0x3ee574)[_0xb201('0x26')](handleEntityNotFound(_0x1fad10,null))[_0xb201('0x26')](respondWithResult(_0x1fad10,null))['catch'](handleError(_0x1fad10,null));};exports['create']=function(_0x4c495b,_0x438587){return db[_0xb201('0x30')][_0xb201('0x4b')](_0x4c495b['body'],{})['then'](function(_0xe79995){var _0x1a94ef=_0x4c495b[_0xb201('0x4c')][_0xb201('0x28')]({'plain':!![]});if(!_0x1a94ef)throw new Error(_0xb201('0x4d'));if(_0x1a94ef[_0xb201('0x4e')]===_0xb201('0x4c')){var _0x48b575=_0xe79995[_0xb201('0x28')]({'plain':!![]});var _0x558365=_0xb201('0x29');return db[_0xb201('0x4f')]['find']({'where':{'name':_0x558365,'userProfileId':_0x1a94ef[_0xb201('0x50')]},'raw':!![]})[_0xb201('0x26')](function(_0x33f38c){if(_0x33f38c&&_0x33f38c['autoAssociation']===0x0){return db[_0xb201('0x51')][_0xb201('0x4b')]({'name':_0x48b575[_0xb201('0x2c')],'resourceId':_0x48b575['id'],'type':_0x33f38c[_0xb201('0x2c')],'sectionId':_0x33f38c['id']},{})[_0xb201('0x26')](function(){return _0xe79995;});}else{return _0xe79995;}})[_0xb201('0x46')](function(_0x4155d7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4155d7);throw _0x4155d7;});}return _0xe79995;})[_0xb201('0x26')](respondWithResult(_0x438587,0xc9))[_0xb201('0x46')](handleError(_0x438587,null));};exports[_0xb201('0x25')]=function(_0x3d9317,_0x538860){if(_0x3d9317[_0xb201('0x52')]['id']){delete _0x3d9317['body']['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x3d9317[_0xb201('0x47')]['id']}})[_0xb201('0x26')](handleEntityNotFound(_0x538860,null))[_0xb201('0x26')](saveUpdates(_0x3d9317[_0xb201('0x52')],null))[_0xb201('0x26')](respondWithResult(_0x538860,null))[_0xb201('0x46')](handleError(_0x538860,null));};exports['destroy']=function(_0x62b28f,_0x1aa8c0){return db[_0xb201('0x30')][_0xb201('0x4a')]({'where':{'id':_0x62b28f[_0xb201('0x47')]['id']}})[_0xb201('0x26')](handleEntityNotFound(_0x1aa8c0,null))[_0xb201('0x26')](removeEntity(_0x1aa8c0,null))[_0xb201('0x46')](handleError(_0x1aa8c0,null));};exports[_0xb201('0x53')]=function(_0x3cc6d9,_0x4d9d9c){return db[_0xb201('0x30')][_0xb201('0x53')]()[_0xb201('0x26')](respondWithResult(_0x4d9d9c,null))['catch'](handleError(_0x4d9d9c,null));};exports[_0xb201('0x54')]=function(_0x18cc66,_0x39c845,_0x5e35b1){var _0x3b64a9={'raw':!![],'where':{}},_0x10537d={},_0x17a8cb;return db[_0xb201('0x30')]['findOne']({'where':{'id':_0x18cc66[_0xb201('0x47')]['id']}})[_0xb201('0x26')](handleEntityNotFound(_0x39c845,null))['then'](function(_0x590099){if(_0x590099){_0x17a8cb=_0x590099[_0xb201('0x28')]({'plain':!![]});_0x10537d[_0xb201('0x33')]=_[_0xb201('0x48')](db[_0xb201('0x55')][_0xb201('0x31')]);_0x10537d[_0xb201('0x34')]=_[_0xb201('0x48')](_0x18cc66[_0xb201('0x34')]);_0x10537d[_0xb201('0x35')]=_['intersection'](_0x10537d[_0xb201('0x33')],_0x10537d[_0xb201('0x34')]);_0x3b64a9[_0xb201('0x36')]=_[_0xb201('0x49')](_0x10537d[_0xb201('0x33')],qs[_0xb201('0x37')](_0x18cc66[_0xb201('0x34')][_0xb201('0x37')]));_0x3b64a9['attributes']=_0x3b64a9[_0xb201('0x36')]['length']?_0x3b64a9['attributes']:_0x10537d['model'];if(!_0x18cc66[_0xb201('0x34')][_0xb201('0x39')](_0xb201('0x3a'))){_0x3b64a9['limit']=qs['limit'](_0x18cc66[_0xb201('0x34')][_0xb201('0x21')]);_0x3b64a9[_0xb201('0x1e')]=qs[_0xb201('0x1e')](_0x18cc66[_0xb201('0x34')]['offset']);}_0x3b64a9[_0xb201('0x3b')]=qs['sort'](_0x18cc66[_0xb201('0x34')]['sort']);_0x3b64a9[_0xb201('0x3d')]=qs['filters'](_[_0xb201('0x3e')](_0x18cc66[_0xb201('0x34')],_0x10537d[_0xb201('0x35')]));_0x3b64a9['where'][_0xb201('0x56')]=_0x590099['id'];if(_0x18cc66[_0xb201('0x34')][_0xb201('0x3f')]){_0x3b64a9['where']=_['merge'](_0x3b64a9[_0xb201('0x3d')],{'$or':_['map'](_0x3b64a9[_0xb201('0x36')],function(_0x342abc){var _0x3d6552={};_0x3d6552[_0x342abc]={'$like':'%'+_0x18cc66[_0xb201('0x34')]['filter']+'%'};return _0x3d6552;})});}_0x3b64a9=_[_0xb201('0x40')]({},_0x3b64a9,_0x18cc66[_0xb201('0x42')]);return db[_0xb201('0x55')][_0xb201('0x44')](_0x3b64a9);}})[_0xb201('0x26')](function(_0xb21cbd){if(_0xb21cbd){return db[_0xb201('0x57')][_0xb201('0x58')]({'where':{'id':_[_0xb201('0x2f')](_0xb21cbd,_0xb201('0x59')),'role':_0xb201('0x5a')},'attributes':['id',_0xb201('0x2c'),_0xb201('0x5b'),'updatedAt',_0xb201('0x5c')]});}})[_0xb201('0x26')](function(_0x5e9958){if(_0x5e9958){return{'count':_0x5e9958[_0xb201('0x20')],'rows':_[_0xb201('0x2f')](_0x5e9958[_0xb201('0x45')],function(_0x418e8b){return{'membername':_0x418e8b[_0xb201('0x2c')],'UserId':_0x418e8b['id'],'queue_name':_0x17a8cb[_0xb201('0x2c')],'WhatsappQueueId':_0x17a8cb['id'],'interface':util[_0xb201('0x5d')](_0xb201('0x5e'),_0xb201('0x5f'),_0x418e8b[_0xb201('0x2c')]),'penalty':0x0,'paused':_0x418e8b[_0xb201('0x5b')],'createdAt':_0x418e8b['createdAt'],'updatedAt':_0x418e8b[_0xb201('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb201('0x26')](respondWithFilteredResult(_0x39c845,_0x3b64a9))[_0xb201('0x46')](handleError(_0x39c845,null));};exports[_0xb201('0x61')]=function(_0x100b33,_0x4d34b3,_0x290cd9){var _0x43c393={};var _0x5874bc={};var _0x5ca544;var _0x16d965;return db[_0xb201('0x30')][_0xb201('0x62')]({'where':{'id':_0x100b33[_0xb201('0x47')]['id']}})[_0xb201('0x26')](handleEntityNotFound(_0x4d34b3,null))['then'](function(_0x1b3e00){if(_0x1b3e00){_0x5ca544=_0x1b3e00;_0x5874bc[_0xb201('0x33')]=_[_0xb201('0x48')](db[_0xb201('0x63')][_0xb201('0x31')]);_0x5874bc[_0xb201('0x34')]=_[_0xb201('0x48')](_0x100b33[_0xb201('0x34')]);_0x5874bc[_0xb201('0x35')]=_[_0xb201('0x49')](_0x5874bc[_0xb201('0x33')],_0x5874bc[_0xb201('0x34')]);_0x43c393['attributes']=_[_0xb201('0x49')](_0x5874bc[_0xb201('0x33')],qs[_0xb201('0x37')](_0x100b33[_0xb201('0x34')][_0xb201('0x37')]));_0x43c393['attributes']=_0x43c393[_0xb201('0x36')]['length']?_0x43c393[_0xb201('0x36')]:_0x5874bc[_0xb201('0x33')];_0x43c393[_0xb201('0x3b')]=qs[_0xb201('0x3c')](_0x100b33['query'][_0xb201('0x3c')]);_0x43c393[_0xb201('0x3d')]=qs[_0xb201('0x35')](_[_0xb201('0x3e')](_0x100b33[_0xb201('0x34')],_0x5874bc[_0xb201('0x35')]));if(_0x100b33['query'][_0xb201('0x3f')]){_0x43c393['where']=_['merge'](_0x43c393[_0xb201('0x3d')],{'$or':_[_0xb201('0x2f')](_0x43c393[_0xb201('0x36')],function(_0x393b43){var _0x3228ec={};_0x3228ec[_0x393b43]={'$like':'%'+_0x100b33['query'][_0xb201('0x3f')]+'%'};return _0x3228ec;})});}_0x43c393=_['merge']({},_0x43c393,_0x100b33[_0xb201('0x42')]);return _0x5ca544['getTeams'](_0x43c393);}})[_0xb201('0x26')](function(_0x5799a7){if(_0x5799a7){_0x16d965=_0x5799a7[_0xb201('0x38')];if(!_0x100b33[_0xb201('0x34')][_0xb201('0x39')]('nolimit')){_0x43c393[_0xb201('0x21')]=qs[_0xb201('0x21')](_0x100b33[_0xb201('0x34')]['limit']);_0x43c393[_0xb201('0x1e')]=qs[_0xb201('0x1e')](_0x100b33[_0xb201('0x34')][_0xb201('0x1e')]);}return _0x5ca544[_0xb201('0x61')](_0x43c393);}})['then'](function(_0x45bef0){if(_0x45bef0){return _0x45bef0?{'count':_0x16d965,'rows':_0x45bef0}:null;}})[_0xb201('0x26')](respondWithResult(_0x4d34b3,null))[_0xb201('0x46')](handleError(_0x4d34b3,null));};exports[_0xb201('0x64')]=function(_0x5a19ea,_0x204299,_0x3833f7){var _0x1ba857=_0x5a19ea[_0xb201('0x52')]['ids'];return db[_0xb201('0x63')]['findAll']({'where':{'id':_0x1ba857},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb201('0x65'),'attributes':['id',_0xb201('0x2c'),_0xb201('0x66'),_0xb201('0x67'),'interface'],'raw':!![]}]})[_0xb201('0x26')](function(_0x3a131f){if(_0x3a131f){var _0x437fae=_[_0xb201('0x68')](_0x3a131f,function(_0x2c11d1){var _0x21c41b=_0x2c11d1['get']({'plain':!![]});return _0x21c41b[_0xb201('0x65')];});return db[_0xb201('0x30')][_0xb201('0x4a')]({'where':{'id':_0x5a19ea[_0xb201('0x47')]['id']}})[_0xb201('0x26')](function(_0x287c59){return db[_0xb201('0x69')][_0xb201('0x6a')](function(_0x16093d){return _0x287c59[_0xb201('0x64')](_0x1ba857,{'transaction':_0x16093d})[_0xb201('0x26')](function(){return BPromise[_0xb201('0x6b')](_0x437fae,function(_0x6bf11){return db[_0xb201('0x55')][_0xb201('0x6c')]({'where':{'UserId':_0x6bf11['id'],'WhatsappQueueId':_0x5a19ea[_0xb201('0x47')]['id']},'transaction':_0x16093d});});})[_0xb201('0x26')](function(){_0x437fae['forEach'](function(_0x50e25a){socket[_0xb201('0x6d')]('userWhatsappQueue:save',{'UserId':_0x50e25a['id'],'WhatsappQueueId':_0x287c59['id']});});});});});}})[_0xb201('0x26')](respondWithStatusCode(_0x204299,null))[_0xb201('0x46')](handleError(_0x204299,null));};exports['removeTeams']=function(_0x5770c9,_0x4b091d,_0x27383e){return db[_0xb201('0x63')][_0xb201('0x44')]({'where':{'id':_0x5770c9['query'][_0xb201('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xb201('0x57')],'as':_0xb201('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b091d,null))[_0xb201('0x26')](function(_0x37f920){var _0x5f0e0b=_[_0xb201('0x2f')](_0x37f920,'id');var _0x2bc682=[];var _0x5966ed=[];var _0x45b974=squel[_0xb201('0x6f')]();_0x45b974[_0xb201('0x70')]('tq.TeamId')[_0xb201('0x71')]('team_has_whatsapp_queues','tq')[_0xb201('0x72')](_0xb201('0x73'),'ut',_0xb201('0x74'))[_0xb201('0x3d')](_0xb201('0x75'),_0x5770c9[_0xb201('0x47')]['id']);for(var _0x123d2a=0x0;_0x123d2a<_0x37f920[_0xb201('0x38')];_0x123d2a+=0x1){let _0x55761d=_0x37f920[_0x123d2a];for(var _0x59e975=0x0;_0x59e975<_0x55761d[_0xb201('0x65')][_0xb201('0x38')];_0x59e975+=0x1){let _0x456ae=_0x55761d[_0xb201('0x65')][_0x59e975];var _0x2ec282=_0x45b974[_0xb201('0x76')]();_0x2ec282[_0xb201('0x3d')](_0xb201('0x77'),_0x456ae['id']);_0x5966ed[_0xb201('0x78')](db['sequelize'][_0xb201('0x34')](_0x2ec282[_0xb201('0x79')](),{'type':db['sequelize'][_0xb201('0x7a')]['SELECT']})[_0xb201('0x26')](function(_0x21fe69){if(_0x21fe69[_0xb201('0x38')]===0x1){return _0x456ae['id'];}else{var _0x53c53c=_['every'](_['map'](_0x21fe69,_0xb201('0x7b')),function(_0x2d442e){return _[_0xb201('0x7c')](_0x5f0e0b,_0x2d442e);});if(_0x53c53c){return _0x456ae['id'];}}}));}}return BPromise['all'](_0x5966ed)[_0xb201('0x26')](function(_0x12d536){_0x2bc682=_(_0x2bc682)['union'](_0x12d536)['compact']()[_0xb201('0x7d')]();return db[_0xb201('0x30')][_0xb201('0x4a')]({'where':{'id':_0x5770c9[_0xb201('0x47')]['id']}})[_0xb201('0x26')](function(_0x5861d7){return db[_0xb201('0x69')][_0xb201('0x6a')](function(_0x247980){return _0x5861d7[_0xb201('0x7e')](_0x5770c9[_0xb201('0x34')]['ids'],{'transaction':_0x247980})[_0xb201('0x26')](function(){if(!_['isEmpty'](_0x2bc682)){return _0x5861d7['removeAgents'](_0x2bc682,{'transaction':_0x247980});}})[_0xb201('0x26')](function(){_0x2bc682[_0xb201('0x7f')](function(_0x320c79){socket[_0xb201('0x6d')](_0xb201('0x80'),{'UserId':_0x320c79,'WhatsappQueueId':_0x5861d7['id']});});});});});});})[_0xb201('0x26')](respondWithStatusCode(_0x4b091d,null))['catch'](handleError(_0x4b091d,null));};exports[_0xb201('0x81')]=function(_0x35e022,_0x583e88,_0x2b828f){return db[_0xb201('0x30')][_0xb201('0x4a')]({'where':{'id':_0x35e022['params']['id']}})[_0xb201('0x26')](handleEntityNotFound(_0x583e88,null))[_0xb201('0x26')](function(_0x5c74a7){if(_0x5c74a7){return _0x5c74a7[_0xb201('0x81')](_0x35e022['body'][_0xb201('0x6e')],_['omit'](_0x35e022['body'],['ids','id'])||{})[_0xb201('0x82')](function(_0x18cb5a){for(var _0x1f58c9=0x0;_0x1f58c9<_0x35e022['body']['ids']['length'];_0x1f58c9+=0x1){socket[_0xb201('0x6d')](_0xb201('0x83'),{'UserId':Number(_0x35e022[_0xb201('0x52')][_0xb201('0x6e')][_0x1f58c9]),'WhatsappQueueId':Number(_0x35e022['params']['id'])});}return _0x18cb5a;});}})[_0xb201('0x26')](respondWithResult(_0x583e88,null))[_0xb201('0x46')](handleError(_0x583e88,null));};exports[_0xb201('0x84')]=function(_0x3efdbe,_0x4cd51d,_0x5cae31){return db[_0xb201('0x30')][_0xb201('0x4a')]({'where':{'id':_0x3efdbe[_0xb201('0x47')]['id']}})[_0xb201('0x26')](handleEntityNotFound(_0x4cd51d,null))[_0xb201('0x26')](function(_0xb1f5dd){if(_0xb1f5dd){return _0xb1f5dd[_0xb201('0x84')](_0x3efdbe[_0xb201('0x34')][_0xb201('0x6e')])[_0xb201('0x26')](function(){if(_[_0xb201('0x85')](_0x3efdbe[_0xb201('0x34')][_0xb201('0x6e')])){for(var _0x469e2b=0x0;_0x469e2b<_0x3efdbe[_0xb201('0x34')]['ids'][_0xb201('0x38')];_0x469e2b+=0x1){socket['emit'](_0xb201('0x80'),{'UserId':Number(_0x3efdbe[_0xb201('0x34')]['ids'][_0x469e2b]),'WhatsappQueueId':Number(_0x3efdbe[_0xb201('0x47')]['id'])});}}else{socket['emit'](_0xb201('0x80'),{'UserId':Number(_0x3efdbe['query']['ids']),'WhatsappQueueId':Number(_0x3efdbe['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4cd51d,null))[_0xb201('0x46')](handleError(_0x4cd51d,null));};exports[_0xb201('0x86')]=function(_0x257841,_0x23ab18,_0x48820){var _0x5c28cd={};var _0x52654d={};var _0x2f0d3d;var _0x35c60a;return db[_0xb201('0x30')][_0xb201('0x62')]({'where':{'id':_0x257841[_0xb201('0x47')]['id']}})[_0xb201('0x26')](handleEntityNotFound(_0x23ab18,null))['then'](function(_0x4af26f){if(_0x4af26f){_0x2f0d3d=_0x4af26f;_0x52654d[_0xb201('0x33')]=_[_0xb201('0x48')](db[_0xb201('0x57')][_0xb201('0x31')]);_0x52654d['query']=_['keys'](_0x257841[_0xb201('0x34')]);_0x52654d[_0xb201('0x35')]=_[_0xb201('0x49')](_0x52654d[_0xb201('0x33')],_0x52654d[_0xb201('0x34')]);_0x5c28cd[_0xb201('0x36')]=_['intersection'](_0x52654d[_0xb201('0x33')],qs[_0xb201('0x37')](_0x257841[_0xb201('0x34')][_0xb201('0x37')]));_0x5c28cd['attributes']=_0x5c28cd[_0xb201('0x36')]['length']?_0x5c28cd[_0xb201('0x36')]:_0x52654d['model'];_0x5c28cd[_0xb201('0x3b')]=qs[_0xb201('0x3c')](_0x257841['query']['sort']);_0x5c28cd[_0xb201('0x3d')]=qs['filters'](_[_0xb201('0x3e')](_0x257841['query'],_0x52654d[_0xb201('0x35')]));if(_0x257841['query'][_0xb201('0x3f')]){_0x5c28cd[_0xb201('0x3d')]=_['merge'](_0x5c28cd[_0xb201('0x3d')],{'$or':_['map'](_0x5c28cd[_0xb201('0x36')],function(_0x30a45b){var _0x3a0c0c={};_0x3a0c0c[_0x30a45b]={'$like':'%'+_0x257841[_0xb201('0x34')][_0xb201('0x3f')]+'%'};return _0x3a0c0c;})});}_0x5c28cd=_[_0xb201('0x40')]({},_0x5c28cd,_0x257841[_0xb201('0x42')]);return _0x2f0d3d[_0xb201('0x86')](_0x5c28cd);}})[_0xb201('0x26')](function(_0x515b4e){if(_0x515b4e){_0x35c60a=_0x515b4e[_0xb201('0x38')];if(!_0x257841[_0xb201('0x34')][_0xb201('0x39')](_0xb201('0x3a'))){_0x5c28cd[_0xb201('0x21')]=qs['limit'](_0x257841[_0xb201('0x34')][_0xb201('0x21')]);_0x5c28cd['offset']=qs[_0xb201('0x1e')](_0x257841['query']['offset']);}return _0x2f0d3d[_0xb201('0x86')](_0x5c28cd);}})[_0xb201('0x26')](function(_0x48f7d8){if(_0x48f7d8){return _0x48f7d8?{'count':_0x35c60a,'rows':_0x48f7d8}:null;}})[_0xb201('0x26')](respondWithResult(_0x23ab18,null))[_0xb201('0x46')](handleError(_0x23ab18,null));}; \ No newline at end of file +var _0xb897=['spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','set','Content-Range','reject','save','update','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents'];(function(_0x52c1ba,_0x15841f){var _0x579d15=function(_0x245f75){while(--_0x245f75){_0x52c1ba['push'](_0x52c1ba['shift']());}};_0x579d15(++_0x15841f);}(_0xb897,0x1b3));var _0x7b89=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb897[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b89('0x0'));var zipdir=require(_0x7b89('0x1'));var jsonpatch=require(_0x7b89('0x2'));var rp=require('request-promise');var moment=require(_0x7b89('0x3'));var BPromise=require(_0x7b89('0x4'));var Mustache=require(_0x7b89('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7b89('0x6'));var ejs=require(_0x7b89('0x7'));var fs=require('fs');var fs_extra=require(_0x7b89('0x8'));var _=require(_0x7b89('0x9'));var squel=require('squel');var crypto=require(_0x7b89('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b89('0x6'));var querystring=require(_0x7b89('0xb'));var Papa=require(_0x7b89('0xc'));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(_0x7b89('0xd'));var logger=require(_0x7b89('0xe'))(_0x7b89('0xf'));var utils=require(_0x7b89('0x10'));var config=require(_0x7b89('0x11'));var licenseUtil=require(_0x7b89('0x12'));var db=require('../../mysqldb')['db'];config[_0x7b89('0x13')]=_[_0x7b89('0x14')](config[_0x7b89('0x13')],{'host':_0x7b89('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b89('0x13')]));require(_0x7b89('0x16'))[_0x7b89('0x17')](socket);function respondWithStatusCode(_0x3ffb39,_0x3ad45a){_0x3ad45a=_0x3ad45a||0xcc;return function(_0x33e79a){if(_0x33e79a){return _0x3ffb39[_0x7b89('0x18')](_0x3ad45a);}return _0x3ffb39[_0x7b89('0x19')](_0x3ad45a)[_0x7b89('0x1a')]();};}function respondWithResult(_0x3f0de0,_0xc55628){_0xc55628=_0xc55628||0xc8;return function(_0x5cba89){if(_0x5cba89){return _0x3f0de0[_0x7b89('0x19')](_0xc55628)[_0x7b89('0x1b')](_0x5cba89);}};}function respondWithFilteredResult(_0x577e2d,_0x279d67){return function(_0x582180){if(_0x582180){var _0x3c75bc=typeof _0x279d67[_0x7b89('0x1c')]==='undefined'&&typeof _0x279d67['limit']===_0x7b89('0x1d');var _0x2bf853=_0x582180['count'];var _0x505e6c=_0x3c75bc?0x0:_0x279d67[_0x7b89('0x1c')];var _0x453495=_0x3c75bc?_0x582180['count']:_0x279d67[_0x7b89('0x1c')]+_0x279d67['limit'];var _0x51841e;if(_0x453495>=_0x2bf853){_0x453495=_0x2bf853;_0x51841e=0xc8;}else{_0x51841e=0xce;}_0x577e2d[_0x7b89('0x19')](_0x51841e);return _0x577e2d[_0x7b89('0x1e')](_0x7b89('0x1f'),_0x505e6c+'-'+_0x453495+'/'+_0x2bf853)[_0x7b89('0x1b')](_0x582180);}return null;};}function patchUpdates(_0x278168){return function(_0x1e24dd){try{jsonpatch['apply'](_0x1e24dd,_0x278168,!![]);}catch(_0x2dc8fe){return BPromise[_0x7b89('0x20')](_0x2dc8fe);}return _0x1e24dd[_0x7b89('0x21')]();};}function saveUpdates(_0x37ddab,_0x51bc4e){return function(_0x5bd792){if(_0x5bd792){return _0x5bd792[_0x7b89('0x22')](_0x37ddab)[_0x7b89('0x23')](function(_0x5af77e){return _0x5af77e;});}return null;};}function removeEntity(_0x30c967,_0x475938){return function(_0x58fd58){if(_0x58fd58){return _0x58fd58['destroy']()[_0x7b89('0x23')](function(){var _0x5a0bf0=_0x58fd58[_0x7b89('0x24')]({'plain':!![]});var _0x4b4a09=_0x7b89('0x25');return db[_0x7b89('0x26')]['destroy']({'where':{'type':_0x4b4a09,'resourceId':_0x5a0bf0['id']}})[_0x7b89('0x23')](function(){return _0x58fd58;});})[_0x7b89('0x23')](function(){_0x30c967[_0x7b89('0x19')](0xcc)[_0x7b89('0x1a')]();});}};}function handleEntityNotFound(_0x401316,_0x2d6f14){return function(_0x4635ea){if(!_0x4635ea){_0x401316[_0x7b89('0x18')](0x194);}return _0x4635ea;};}function handleError(_0x269998,_0x3fbe55){_0x3fbe55=_0x3fbe55||0x1f4;return function(_0x7e25ee){logger[_0x7b89('0x27')](_0x7e25ee[_0x7b89('0x28')]);if(_0x7e25ee[_0x7b89('0x29')]){delete _0x7e25ee[_0x7b89('0x29')];}_0x269998[_0x7b89('0x19')](_0x3fbe55)[_0x7b89('0x2a')](_0x7e25ee);};}exports[_0x7b89('0x2b')]=function(_0x4acb9e,_0x17430a){var _0x26cc9c={},_0x4f5546={},_0x52877f={'count':0x0,'rows':[]};var _0x26412e=_[_0x7b89('0x2c')](db[_0x7b89('0x2d')][_0x7b89('0x2e')],function(_0x486718){return{'name':_0x486718[_0x7b89('0x2f')],'type':_0x486718['type']['key']};});_0x4f5546[_0x7b89('0x30')]=_[_0x7b89('0x2c')](_0x26412e,_0x7b89('0x29'));_0x4f5546['query']=_[_0x7b89('0x31')](_0x4acb9e[_0x7b89('0x32')]);_0x4f5546[_0x7b89('0x33')]=_[_0x7b89('0x34')](_0x4f5546[_0x7b89('0x30')],_0x4f5546[_0x7b89('0x32')]);_0x26cc9c[_0x7b89('0x35')]=_[_0x7b89('0x34')](_0x4f5546[_0x7b89('0x30')],qs[_0x7b89('0x36')](_0x4acb9e[_0x7b89('0x32')][_0x7b89('0x36')]));_0x26cc9c[_0x7b89('0x35')]=_0x26cc9c['attributes']['length']?_0x26cc9c[_0x7b89('0x35')]:_0x4f5546[_0x7b89('0x30')];if(!_0x4acb9e['query'][_0x7b89('0x37')](_0x7b89('0x38'))){_0x26cc9c[_0x7b89('0x39')]=qs[_0x7b89('0x39')](_0x4acb9e[_0x7b89('0x32')][_0x7b89('0x39')]);_0x26cc9c[_0x7b89('0x1c')]=qs[_0x7b89('0x1c')](_0x4acb9e['query'][_0x7b89('0x1c')]);}_0x26cc9c[_0x7b89('0x3a')]=qs[_0x7b89('0x3b')](_0x4acb9e[_0x7b89('0x32')][_0x7b89('0x3b')]);_0x26cc9c[_0x7b89('0x3c')]=qs['filters'](_[_0x7b89('0x3d')](_0x4acb9e[_0x7b89('0x32')],_0x4f5546[_0x7b89('0x33')]),_0x26412e);if(_0x4acb9e[_0x7b89('0x32')][_0x7b89('0x3e')]){_0x26cc9c[_0x7b89('0x3c')]=_[_0x7b89('0x3f')](_0x26cc9c[_0x7b89('0x3c')],{'$or':_['map'](_0x26412e,function(_0xc1f66a){if(_0xc1f66a[_0x7b89('0x40')]!==_0x7b89('0x41')){var _0x41e43c={};_0x41e43c[_0xc1f66a[_0x7b89('0x29')]]={'$like':'%'+_0x4acb9e[_0x7b89('0x32')][_0x7b89('0x3e')]+'%'};return _0x41e43c;}})});}_0x26cc9c=_['merge']({},_0x26cc9c,_0x4acb9e['options']);var _0x5c49b5={'where':_0x26cc9c[_0x7b89('0x3c')]};return db[_0x7b89('0x2d')][_0x7b89('0x42')](_0x5c49b5)[_0x7b89('0x23')](function(_0x23330f){_0x52877f['count']=_0x23330f;if(_0x4acb9e['query'][_0x7b89('0x43')]){_0x26cc9c[_0x7b89('0x44')]=[{'all':!![]}];}return db[_0x7b89('0x2d')][_0x7b89('0x45')](_0x26cc9c);})[_0x7b89('0x23')](function(_0x4f2f68){_0x52877f[_0x7b89('0x46')]=_0x4f2f68;return _0x52877f;})[_0x7b89('0x23')](respondWithFilteredResult(_0x17430a,_0x26cc9c))[_0x7b89('0x47')](handleError(_0x17430a,null));};exports['show']=function(_0x411280,_0x43bbbc){var _0x15d0fd={'raw':!![],'where':{'id':_0x411280[_0x7b89('0x48')]['id']}},_0x1c0a01={};_0x1c0a01[_0x7b89('0x30')]=_[_0x7b89('0x31')](db[_0x7b89('0x2d')][_0x7b89('0x2e')]);_0x1c0a01['query']=_['keys'](_0x411280[_0x7b89('0x32')]);_0x1c0a01['filters']=_['intersection'](_0x1c0a01[_0x7b89('0x30')],_0x1c0a01[_0x7b89('0x32')]);_0x15d0fd[_0x7b89('0x35')]=_['intersection'](_0x1c0a01['model'],qs[_0x7b89('0x36')](_0x411280['query'][_0x7b89('0x36')]));_0x15d0fd[_0x7b89('0x35')]=_0x15d0fd[_0x7b89('0x35')][_0x7b89('0x49')]?_0x15d0fd['attributes']:_0x1c0a01['model'];if(_0x411280[_0x7b89('0x32')][_0x7b89('0x43')]){_0x15d0fd[_0x7b89('0x44')]=[{'all':!![]}];}_0x15d0fd=_[_0x7b89('0x3f')]({},_0x15d0fd,_0x411280[_0x7b89('0x4a')]);return db['WhatsappQueue'][_0x7b89('0x4b')](_0x15d0fd)['then'](handleEntityNotFound(_0x43bbbc,null))[_0x7b89('0x23')](respondWithResult(_0x43bbbc,null))[_0x7b89('0x47')](handleError(_0x43bbbc,null));};exports[_0x7b89('0x4c')]=function(_0x3bce55,_0x24e5fb){return db['WhatsappQueue'][_0x7b89('0x4c')](_0x3bce55[_0x7b89('0x4d')],{})[_0x7b89('0x23')](function(_0x33e289){var _0x5bcd10=_0x3bce55[_0x7b89('0x4e')][_0x7b89('0x24')]({'plain':!![]});if(!_0x5bcd10)throw new Error(_0x7b89('0x4f'));if(_0x5bcd10[_0x7b89('0x50')]===_0x7b89('0x4e')){var _0x1e3a3f=_0x33e289[_0x7b89('0x24')]({'plain':!![]});var _0x4d097f=_0x7b89('0x25');return db[_0x7b89('0x51')]['find']({'where':{'name':_0x4d097f,'userProfileId':_0x5bcd10[_0x7b89('0x52')]},'raw':!![]})[_0x7b89('0x23')](function(_0x4ce7fe){if(_0x4ce7fe&&_0x4ce7fe[_0x7b89('0x53')]===0x0){return db[_0x7b89('0x26')][_0x7b89('0x4c')]({'name':_0x1e3a3f['name'],'resourceId':_0x1e3a3f['id'],'type':_0x4ce7fe[_0x7b89('0x29')],'sectionId':_0x4ce7fe['id']},{})[_0x7b89('0x23')](function(){return _0x33e289;});}else{return _0x33e289;}})[_0x7b89('0x47')](function(_0x44a453){logger[_0x7b89('0x27')](_0x7b89('0x54'),_0x44a453);throw _0x44a453;});}return _0x33e289;})[_0x7b89('0x23')](respondWithResult(_0x24e5fb,0xc9))[_0x7b89('0x47')](handleError(_0x24e5fb,null));};exports['update']=function(_0x9986db,_0x4afe42){if(_0x9986db[_0x7b89('0x4d')]['id']){delete _0x9986db[_0x7b89('0x4d')]['id'];}return db[_0x7b89('0x2d')]['find']({'where':{'id':_0x9986db[_0x7b89('0x48')]['id']}})[_0x7b89('0x23')](handleEntityNotFound(_0x4afe42,null))['then'](saveUpdates(_0x9986db['body'],null))[_0x7b89('0x23')](respondWithResult(_0x4afe42,null))['catch'](handleError(_0x4afe42,null));};exports['destroy']=function(_0x30ee13,_0x3d2b79){return db[_0x7b89('0x2d')][_0x7b89('0x4b')]({'where':{'id':_0x30ee13[_0x7b89('0x48')]['id']}})[_0x7b89('0x23')](handleEntityNotFound(_0x3d2b79,null))[_0x7b89('0x23')](removeEntity(_0x3d2b79,null))[_0x7b89('0x47')](handleError(_0x3d2b79,null));};exports[_0x7b89('0x55')]=function(_0x1ce9a3,_0x21af74){return db[_0x7b89('0x2d')][_0x7b89('0x55')]()[_0x7b89('0x23')](respondWithResult(_0x21af74,null))[_0x7b89('0x47')](handleError(_0x21af74,null));};exports[_0x7b89('0x56')]=function(_0x235f6e,_0x446872,_0x34a0b7){var _0xac22b={'raw':!![],'where':{}},_0x228031={},_0x41ee85;return db[_0x7b89('0x2d')][_0x7b89('0x57')]({'where':{'id':_0x235f6e[_0x7b89('0x48')]['id']}})[_0x7b89('0x23')](handleEntityNotFound(_0x446872,null))[_0x7b89('0x23')](function(_0x324d89){if(_0x324d89){_0x41ee85=_0x324d89[_0x7b89('0x24')]({'plain':!![]});_0x228031[_0x7b89('0x30')]=_[_0x7b89('0x31')](db[_0x7b89('0x58')]['rawAttributes']);_0x228031[_0x7b89('0x32')]=_['keys'](_0x235f6e[_0x7b89('0x32')]);_0x228031[_0x7b89('0x33')]=_[_0x7b89('0x34')](_0x228031[_0x7b89('0x30')],_0x228031[_0x7b89('0x32')]);_0xac22b[_0x7b89('0x35')]=_[_0x7b89('0x34')](_0x228031[_0x7b89('0x30')],qs['fields'](_0x235f6e[_0x7b89('0x32')]['fields']));_0xac22b[_0x7b89('0x35')]=_0xac22b[_0x7b89('0x35')]['length']?_0xac22b['attributes']:_0x228031['model'];if(!_0x235f6e[_0x7b89('0x32')][_0x7b89('0x37')]('nolimit')){_0xac22b[_0x7b89('0x39')]=qs[_0x7b89('0x39')](_0x235f6e[_0x7b89('0x32')][_0x7b89('0x39')]);_0xac22b['offset']=qs[_0x7b89('0x1c')](_0x235f6e[_0x7b89('0x32')][_0x7b89('0x1c')]);}_0xac22b[_0x7b89('0x3a')]=qs[_0x7b89('0x3b')](_0x235f6e['query'][_0x7b89('0x3b')]);_0xac22b[_0x7b89('0x3c')]=qs['filters'](_['pick'](_0x235f6e[_0x7b89('0x32')],_0x228031['filters']));_0xac22b['where']['WhatsappQueueId']=_0x324d89['id'];if(_0x235f6e['query'][_0x7b89('0x3e')]){_0xac22b[_0x7b89('0x3c')]=_[_0x7b89('0x3f')](_0xac22b[_0x7b89('0x3c')],{'$or':_[_0x7b89('0x2c')](_0xac22b[_0x7b89('0x35')],function(_0x563041){var _0x40764c={};_0x40764c[_0x563041]={'$like':'%'+_0x235f6e[_0x7b89('0x32')][_0x7b89('0x3e')]+'%'};return _0x40764c;})});}_0xac22b=_[_0x7b89('0x3f')]({},_0xac22b,_0x235f6e[_0x7b89('0x4a')]);return db[_0x7b89('0x58')][_0x7b89('0x45')](_0xac22b);}})[_0x7b89('0x23')](function(_0x97f608){if(_0x97f608){return db[_0x7b89('0x59')][_0x7b89('0x5a')]({'where':{'id':_[_0x7b89('0x2c')](_0x97f608,_0x7b89('0x5b')),'role':_0x7b89('0x5c')},'attributes':['id',_0x7b89('0x29'),_0x7b89('0x5d'),_0x7b89('0x5e'),_0x7b89('0x5f')]});}})['then'](function(_0x4bb48b){if(_0x4bb48b){return{'count':_0x4bb48b[_0x7b89('0x42')],'rows':_[_0x7b89('0x2c')](_0x4bb48b['rows'],function(_0x3fcbe6){return{'membername':_0x3fcbe6[_0x7b89('0x29')],'UserId':_0x3fcbe6['id'],'queue_name':_0x41ee85[_0x7b89('0x29')],'WhatsappQueueId':_0x41ee85['id'],'interface':util[_0x7b89('0x60')](_0x7b89('0x61'),_0x7b89('0x62'),_0x3fcbe6[_0x7b89('0x29')]),'penalty':0x0,'paused':_0x3fcbe6[_0x7b89('0x5d')],'createdAt':_0x3fcbe6[_0x7b89('0x5f')],'updatedAt':_0x3fcbe6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7b89('0x23')](respondWithFilteredResult(_0x446872,_0xac22b))[_0x7b89('0x47')](handleError(_0x446872,null));};exports[_0x7b89('0x63')]=function(_0x55f7d8,_0x2eb973,_0x2ccf40){var _0x48d27c={};var _0xc953ae={};var _0x341036;var _0x4af741;return db[_0x7b89('0x2d')][_0x7b89('0x57')]({'where':{'id':_0x55f7d8[_0x7b89('0x48')]['id']}})[_0x7b89('0x23')](handleEntityNotFound(_0x2eb973,null))[_0x7b89('0x23')](function(_0x1d7323){if(_0x1d7323){_0x341036=_0x1d7323;_0xc953ae['model']=_[_0x7b89('0x31')](db['Team'][_0x7b89('0x2e')]);_0xc953ae['query']=_['keys'](_0x55f7d8[_0x7b89('0x32')]);_0xc953ae[_0x7b89('0x33')]=_[_0x7b89('0x34')](_0xc953ae['model'],_0xc953ae[_0x7b89('0x32')]);_0x48d27c[_0x7b89('0x35')]=_[_0x7b89('0x34')](_0xc953ae[_0x7b89('0x30')],qs[_0x7b89('0x36')](_0x55f7d8[_0x7b89('0x32')][_0x7b89('0x36')]));_0x48d27c[_0x7b89('0x35')]=_0x48d27c[_0x7b89('0x35')]['length']?_0x48d27c[_0x7b89('0x35')]:_0xc953ae[_0x7b89('0x30')];_0x48d27c[_0x7b89('0x3a')]=qs['sort'](_0x55f7d8['query'][_0x7b89('0x3b')]);_0x48d27c[_0x7b89('0x3c')]=qs[_0x7b89('0x33')](_['pick'](_0x55f7d8['query'],_0xc953ae[_0x7b89('0x33')]));if(_0x55f7d8[_0x7b89('0x32')][_0x7b89('0x3e')]){_0x48d27c[_0x7b89('0x3c')]=_['merge'](_0x48d27c[_0x7b89('0x3c')],{'$or':_['map'](_0x48d27c[_0x7b89('0x35')],function(_0x5d1985){var _0x336681={};_0x336681[_0x5d1985]={'$like':'%'+_0x55f7d8[_0x7b89('0x32')][_0x7b89('0x3e')]+'%'};return _0x336681;})});}_0x48d27c=_['merge']({},_0x48d27c,_0x55f7d8[_0x7b89('0x4a')]);return _0x341036['getTeams'](_0x48d27c);}})[_0x7b89('0x23')](function(_0x237e86){if(_0x237e86){_0x4af741=_0x237e86[_0x7b89('0x49')];if(!_0x55f7d8['query'][_0x7b89('0x37')](_0x7b89('0x38'))){_0x48d27c[_0x7b89('0x39')]=qs[_0x7b89('0x39')](_0x55f7d8[_0x7b89('0x32')][_0x7b89('0x39')]);_0x48d27c[_0x7b89('0x1c')]=qs[_0x7b89('0x1c')](_0x55f7d8['query'][_0x7b89('0x1c')]);}return _0x341036['getTeams'](_0x48d27c);}})['then'](function(_0x434b27){if(_0x434b27){return _0x434b27?{'count':_0x4af741,'rows':_0x434b27}:null;}})[_0x7b89('0x23')](respondWithResult(_0x2eb973,null))[_0x7b89('0x47')](handleError(_0x2eb973,null));};exports[_0x7b89('0x64')]=function(_0x2a20c6,_0x1cd165,_0x500e52){var _0x3d4b33=_0x2a20c6[_0x7b89('0x4d')][_0x7b89('0x65')];return db[_0x7b89('0x66')][_0x7b89('0x45')]({'where':{'id':_0x3d4b33},'attributes':['id'],'include':[{'model':db[_0x7b89('0x59')],'as':_0x7b89('0x67'),'attributes':['id','name',_0x7b89('0x68'),_0x7b89('0x69'),_0x7b89('0x6a')],'raw':!![]}]})[_0x7b89('0x23')](function(_0x3a27bb){if(_0x3a27bb){var _0x51ac80=_[_0x7b89('0x6b')](_0x3a27bb,function(_0x560862){var _0x28ecde=_0x560862['get']({'plain':!![]});return _0x28ecde[_0x7b89('0x67')];});return db[_0x7b89('0x2d')]['find']({'where':{'id':_0x2a20c6['params']['id']}})[_0x7b89('0x23')](function(_0x54c527){return db[_0x7b89('0x6c')][_0x7b89('0x6d')](function(_0x15b28a){return _0x54c527['addTeams'](_0x3d4b33,{'transaction':_0x15b28a})[_0x7b89('0x23')](function(){return BPromise[_0x7b89('0x6e')](_0x51ac80,function(_0x3f6d4f){return db[_0x7b89('0x58')][_0x7b89('0x6f')]({'where':{'UserId':_0x3f6d4f['id'],'WhatsappQueueId':_0x2a20c6[_0x7b89('0x48')]['id']},'transaction':_0x15b28a});});})[_0x7b89('0x23')](function(){_0x51ac80[_0x7b89('0x70')](function(_0x2e3867){socket['emit'](_0x7b89('0x71'),{'UserId':_0x2e3867['id'],'WhatsappQueueId':_0x54c527['id']});});});});});}})[_0x7b89('0x23')](respondWithStatusCode(_0x1cd165,null))['catch'](handleError(_0x1cd165,null));};exports['removeTeams']=function(_0x54e562,_0x3f53e8,_0x4bbfdb){return db['Team']['findAll']({'where':{'id':_0x54e562[_0x7b89('0x32')][_0x7b89('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b89('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7b89('0x23')](handleEntityNotFound(_0x3f53e8,null))[_0x7b89('0x23')](function(_0x58caeb){var _0x53e82e=_[_0x7b89('0x2c')](_0x58caeb,'id');var _0x184ffd=[];var _0x15976c=[];var _0x2dbc96=squel[_0x7b89('0x72')]();_0x2dbc96[_0x7b89('0x73')](_0x7b89('0x74'))[_0x7b89('0x75')](_0x7b89('0x76'),'tq')[_0x7b89('0x77')](_0x7b89('0x78'),'ut',_0x7b89('0x79'))[_0x7b89('0x3c')](_0x7b89('0x7a'),_0x54e562['params']['id']);for(var _0x5787f2=0x0;_0x5787f2<_0x58caeb[_0x7b89('0x49')];_0x5787f2+=0x1){let _0x3b8b8b=_0x58caeb[_0x5787f2];for(var _0x331974=0x0;_0x331974<_0x3b8b8b[_0x7b89('0x67')][_0x7b89('0x49')];_0x331974+=0x1){let _0x26b457=_0x3b8b8b['Agents'][_0x331974];var _0x346f54=_0x2dbc96[_0x7b89('0x7b')]();_0x346f54[_0x7b89('0x3c')](_0x7b89('0x7c'),_0x26b457['id']);_0x15976c[_0x7b89('0x7d')](db[_0x7b89('0x6c')][_0x7b89('0x32')](_0x346f54[_0x7b89('0x7e')](),{'type':db[_0x7b89('0x6c')][_0x7b89('0x7f')][_0x7b89('0x80')]})[_0x7b89('0x23')](function(_0x5286e8){if(_0x5286e8[_0x7b89('0x49')]===0x1){return _0x26b457['id'];}else{var _0x4cc1a7=_[_0x7b89('0x81')](_[_0x7b89('0x2c')](_0x5286e8,_0x7b89('0x82')),function(_0x188798){return _[_0x7b89('0x83')](_0x53e82e,_0x188798);});if(_0x4cc1a7){return _0x26b457['id'];}}}));}}return BPromise[_0x7b89('0x84')](_0x15976c)['then'](function(_0x5c3655){_0x184ffd=_(_0x184ffd)[_0x7b89('0x85')](_0x5c3655)[_0x7b89('0x86')]()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x54e562[_0x7b89('0x48')]['id']}})[_0x7b89('0x23')](function(_0x398dff){return db[_0x7b89('0x6c')][_0x7b89('0x6d')](function(_0x87669c){return _0x398dff[_0x7b89('0x87')](_0x54e562[_0x7b89('0x32')][_0x7b89('0x65')],{'transaction':_0x87669c})[_0x7b89('0x23')](function(){if(!_[_0x7b89('0x88')](_0x184ffd)){return _0x398dff[_0x7b89('0x89')](_0x184ffd,{'transaction':_0x87669c});}})['then'](function(){_0x184ffd[_0x7b89('0x70')](function(_0x512973){socket[_0x7b89('0x8a')](_0x7b89('0x8b'),{'UserId':_0x512973,'WhatsappQueueId':_0x398dff['id']});});});});});});})[_0x7b89('0x23')](respondWithStatusCode(_0x3f53e8,null))[_0x7b89('0x47')](handleError(_0x3f53e8,null));};exports[_0x7b89('0x8c')]=function(_0x23c995,_0x13e461,_0x589b77){return db['WhatsappQueue'][_0x7b89('0x4b')]({'where':{'id':_0x23c995['params']['id']}})[_0x7b89('0x23')](handleEntityNotFound(_0x13e461,null))[_0x7b89('0x23')](function(_0x388427){if(_0x388427){return _0x388427[_0x7b89('0x8c')](_0x23c995['body'][_0x7b89('0x65')],_['omit'](_0x23c995[_0x7b89('0x4d')],['ids','id'])||{})[_0x7b89('0x8d')](function(_0xdb779b){for(var _0x577c74=0x0;_0x577c74<_0x23c995['body'][_0x7b89('0x65')][_0x7b89('0x49')];_0x577c74+=0x1){socket[_0x7b89('0x8a')](_0x7b89('0x71'),{'UserId':Number(_0x23c995[_0x7b89('0x4d')][_0x7b89('0x65')][_0x577c74]),'WhatsappQueueId':Number(_0x23c995[_0x7b89('0x48')]['id'])});}return _0xdb779b;});}})[_0x7b89('0x23')](respondWithResult(_0x13e461,null))[_0x7b89('0x47')](handleError(_0x13e461,null));};exports[_0x7b89('0x89')]=function(_0x1e8e19,_0x1dca80,_0x1cd773){return db[_0x7b89('0x2d')]['find']({'where':{'id':_0x1e8e19[_0x7b89('0x48')]['id']}})['then'](handleEntityNotFound(_0x1dca80,null))[_0x7b89('0x23')](function(_0x5495c3){if(_0x5495c3){return _0x5495c3[_0x7b89('0x89')](_0x1e8e19['query']['ids'])['then'](function(){if(_[_0x7b89('0x8e')](_0x1e8e19[_0x7b89('0x32')]['ids'])){for(var _0x3969fa=0x0;_0x3969fa<_0x1e8e19[_0x7b89('0x32')][_0x7b89('0x65')][_0x7b89('0x49')];_0x3969fa+=0x1){socket[_0x7b89('0x8a')](_0x7b89('0x8b'),{'UserId':Number(_0x1e8e19[_0x7b89('0x32')]['ids'][_0x3969fa]),'WhatsappQueueId':Number(_0x1e8e19[_0x7b89('0x48')]['id'])});}}else{socket[_0x7b89('0x8a')](_0x7b89('0x8b'),{'UserId':Number(_0x1e8e19[_0x7b89('0x32')][_0x7b89('0x65')]),'WhatsappQueueId':Number(_0x1e8e19[_0x7b89('0x48')]['id'])});}});}})[_0x7b89('0x23')](respondWithStatusCode(_0x1dca80,null))[_0x7b89('0x47')](handleError(_0x1dca80,null));};exports['getAgents']=function(_0x6f0354,_0x52eb0d,_0x1ce2d9){var _0x3aeef6={};var _0x53342b={};var _0x545325;var _0x54223d;return db[_0x7b89('0x2d')][_0x7b89('0x57')]({'where':{'id':_0x6f0354[_0x7b89('0x48')]['id']}})[_0x7b89('0x23')](handleEntityNotFound(_0x52eb0d,null))[_0x7b89('0x23')](function(_0x14e05c){if(_0x14e05c){_0x545325=_0x14e05c;_0x53342b[_0x7b89('0x30')]=_[_0x7b89('0x31')](db[_0x7b89('0x59')]['rawAttributes']);_0x53342b[_0x7b89('0x32')]=_[_0x7b89('0x31')](_0x6f0354[_0x7b89('0x32')]);_0x53342b['filters']=_[_0x7b89('0x34')](_0x53342b[_0x7b89('0x30')],_0x53342b[_0x7b89('0x32')]);_0x3aeef6['attributes']=_[_0x7b89('0x34')](_0x53342b[_0x7b89('0x30')],qs['fields'](_0x6f0354[_0x7b89('0x32')][_0x7b89('0x36')]));_0x3aeef6[_0x7b89('0x35')]=_0x3aeef6['attributes']['length']?_0x3aeef6[_0x7b89('0x35')]:_0x53342b[_0x7b89('0x30')];_0x3aeef6[_0x7b89('0x3a')]=qs[_0x7b89('0x3b')](_0x6f0354[_0x7b89('0x32')][_0x7b89('0x3b')]);_0x3aeef6[_0x7b89('0x3c')]=qs[_0x7b89('0x33')](_[_0x7b89('0x3d')](_0x6f0354[_0x7b89('0x32')],_0x53342b[_0x7b89('0x33')]));if(_0x6f0354[_0x7b89('0x32')][_0x7b89('0x3e')]){_0x3aeef6[_0x7b89('0x3c')]=_[_0x7b89('0x3f')](_0x3aeef6[_0x7b89('0x3c')],{'$or':_[_0x7b89('0x2c')](_0x3aeef6[_0x7b89('0x35')],function(_0x222f4f){var _0x224ca8={};_0x224ca8[_0x222f4f]={'$like':'%'+_0x6f0354[_0x7b89('0x32')][_0x7b89('0x3e')]+'%'};return _0x224ca8;})});}_0x3aeef6=_[_0x7b89('0x3f')]({},_0x3aeef6,_0x6f0354[_0x7b89('0x4a')]);return _0x545325['getAgents'](_0x3aeef6);}})[_0x7b89('0x23')](function(_0xb248f2){if(_0xb248f2){_0x54223d=_0xb248f2[_0x7b89('0x49')];if(!_0x6f0354[_0x7b89('0x32')][_0x7b89('0x37')]('nolimit')){_0x3aeef6['limit']=qs[_0x7b89('0x39')](_0x6f0354[_0x7b89('0x32')][_0x7b89('0x39')]);_0x3aeef6[_0x7b89('0x1c')]=qs[_0x7b89('0x1c')](_0x6f0354[_0x7b89('0x32')]['offset']);}return _0x545325[_0x7b89('0x8f')](_0x3aeef6);}})[_0x7b89('0x23')](function(_0x42dc25){if(_0x42dc25){return _0x42dc25?{'count':_0x54223d,'rows':_0x42dc25}:null;}})[_0x7b89('0x23')](respondWithResult(_0x52eb0d,null))[_0x7b89('0x47')](handleError(_0x52eb0d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4b439c9..c2c5328 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 _0x3bf7=['hook','exports','events','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x3bf7,0x14c));var _0x73bf=function(_0x562f64,_0x3ca474){_0x562f64=_0x562f64-0x0;var _0x3d8541=_0x3bf7[_0x562f64];return _0x3d8541;};'use strict';var EventEmitter=require(_0x73bf('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x73bf('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x73bf('0x2')](0x0);var events={'afterCreate':_0x73bf('0x3'),'afterUpdate':_0x73bf('0x4'),'afterDestroy':_0x73bf('0x5')};function emitEvent(_0x4b9e5f){return function(_0x22859c,_0x354908,_0x3e42f8){WhatsappQueueEvents[_0x73bf('0x6')](_0x4b9e5f+':'+_0x22859c['id'],_0x22859c);WhatsappQueueEvents[_0x73bf('0x6')](_0x4b9e5f,_0x22859c);_0x3e42f8(null);};}for(var e in events){if(events[_0x73bf('0x7')](e)){var event=events[e];WhatsappQueue[_0x73bf('0x8')](e,emitEvent(event));}}module[_0x73bf('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2625=['../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x545b4a,_0x1de254){var _0x1e5849=function(_0x160643){while(--_0x160643){_0x545b4a['push'](_0x545b4a['shift']());}};_0x1e5849(++_0x1de254);}(_0x2625,0x19e));var _0x5262=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x2625[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x5262('0x0'))['db'][_0x5262('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5262('0x2')](0x0);var events={'afterCreate':_0x5262('0x3'),'afterUpdate':'update','afterDestroy':_0x5262('0x4')};function emitEvent(_0x159e6f){return function(_0x1873c0,_0x155c5b,_0x5d4646){WhatsappQueueEvents['emit'](_0x159e6f+':'+_0x1873c0['id'],_0x1873c0);WhatsappQueueEvents[_0x5262('0x5')](_0x159e6f,_0x1873c0);_0x5d4646(null);};}for(var e in events){if(events[_0x5262('0x6')](e)){var event=events[e];WhatsappQueue[_0x5262('0x7')](e,emitEvent(event));}}module[_0x5262('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9f8c349..3bb8b27 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 _0x7d54=['rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x25a0b7,_0x5b208f){var _0x1f6baf=function(_0x340675){while(--_0x340675){_0x25a0b7['push'](_0x25a0b7['shift']());}};_0x1f6baf(++_0x5b208f);}(_0x7d54,0xa0));var _0x47d5=function(_0x4d6efb,_0x30d83c){_0x4d6efb=_0x4d6efb-0x0;var _0x35d839=_0x7d54[_0x4d6efb];return _0x35d839;};'use strict';var _=require(_0x47d5('0x0'));var util=require(_0x47d5('0x1'));var logger=require(_0x47d5('0x2'))(_0x47d5('0x3'));var moment=require(_0x47d5('0x4'));var BPromise=require(_0x47d5('0x5'));var rp=require(_0x47d5('0x6'));var fs=require('fs');var path=require(_0x47d5('0x7'));var rimraf=require(_0x47d5('0x8'));var config=require(_0x47d5('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0x47d5('0xa')]=function(_0x2f361f,_0x23dd0c){return _0x2f361f[_0x47d5('0xb')](_0x47d5('0xc'),attributes,{'tableName':_0x47d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf07c=['whatsapp_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0xf07c,0x175));var _0xcf07=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf07c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xcf07('0x0'));var util=require(_0xcf07('0x1'));var logger=require(_0xcf07('0x2'))(_0xcf07('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf07('0x4'));var fs=require('fs');var path=require(_0xcf07('0x5'));var rimraf=require(_0xcf07('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf07('0x7'));module[_0xcf07('0x8')]=function(_0x456721,_0x291377){return _0x456721[_0xcf07('0x9')](_0xcf07('0xa'),attributes,{'tableName':_0xcf07('0xb'),'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 6534220..79a4f51 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 _0x2848=['client','http','redis','defaults','localhost','./whatsappQueue.socket','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','include','map','model','attributes','ShowWhatsappQueue','find','where','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x3f66a9,_0x235b1c){var _0x328e76=function(_0x5ef037){while(--_0x5ef037){_0x3f66a9['push'](_0x3f66a9['shift']());}};_0x328e76(++_0x235b1c);}(_0x2848,0x109));var _0x8284=function(_0x285f79,_0x55b5a0){_0x285f79=_0x285f79-0x0;var _0x3df71b=_0x2848[_0x285f79];return _0x3df71b;};'use strict';var _=require('lodash');var util=require(_0x8284('0x0'));var moment=require(_0x8284('0x1'));var BPromise=require(_0x8284('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8284('0x3'));var db=require(_0x8284('0x4'))['db'];var utils=require(_0x8284('0x5'));var logger=require('../../config/logger')(_0x8284('0x6'));var config=require('../../config/environment');var jayson=require(_0x8284('0x7'));var client=jayson[_0x8284('0x8')][_0x8284('0x9')]({'port':0x232a});config[_0x8284('0xa')]=_[_0x8284('0xb')](config[_0x8284('0xa')],{'host':_0x8284('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8284('0xa')]));require(_0x8284('0xd'))['register'](socket);function respondWithRpcPromise(_0xd2f67a,_0x4c881f,_0x238e6f){return new BPromise(function(_0x3823ac,_0x2ee871){return client[_0x8284('0xe')](_0xd2f67a,_0x238e6f)['then'](function(_0x4ef910){logger[_0x8284('0xf')](_0x8284('0x10'),_0x4c881f,_0x8284('0x11'));logger[_0x8284('0x12')](_0x8284('0x13'),_0x4c881f,_0x8284('0x11'),JSON[_0x8284('0x14')](_0x4ef910));if(_0x4ef910['error']){if(_0x4ef910[_0x8284('0x15')][_0x8284('0x16')]===0x1f4){logger['error'](_0x8284('0x10'),_0x4c881f,_0x4ef910['error'][_0x8284('0x17')]);return _0x2ee871(_0x4ef910[_0x8284('0x15')][_0x8284('0x17')]);}logger['error'](_0x8284('0x10'),_0x4c881f,_0x4ef910[_0x8284('0x15')]['message']);return _0x3823ac(_0x4ef910['error'][_0x8284('0x17')]);}else{logger[_0x8284('0xf')](_0x8284('0x10'),_0x4c881f,_0x8284('0x11'));_0x3823ac(_0x4ef910[_0x8284('0x18')][_0x8284('0x17')]);}})[_0x8284('0x19')](function(_0xe2d5df){logger[_0x8284('0x15')](_0x8284('0x10'),_0x4c881f,_0xe2d5df);_0x2ee871(_0xe2d5df);});});}exports[_0x8284('0x1a')]=function(_0xadc566){var _0x326024=this;return new Promise(function(_0x5cb807,_0x1d7732){return db[_0x8284('0x1b')][_0x8284('0x1c')]({'raw':_0xadc566['options']?_0xadc566[_0x8284('0x1d')][_0x8284('0x1e')]===undefined?!![]:![]:!![],'where':_0xadc566[_0x8284('0x1d')]?_0xadc566[_0x8284('0x1d')]['where']||null:null,'attributes':_0xadc566[_0x8284('0x1d')]?_0xadc566[_0x8284('0x1d')]['attributes']||null:null,'limit':_0xadc566[_0x8284('0x1d')]?_0xadc566[_0x8284('0x1d')]['limit']||null:null,'include':_0xadc566[_0x8284('0x1d')]?_0xadc566[_0x8284('0x1d')][_0x8284('0x1f')]?_[_0x8284('0x20')](_0xadc566['options'][_0x8284('0x1f')],function(_0x30d0ac){return{'model':db[_0x30d0ac[_0x8284('0x21')]],'as':_0x30d0ac['as'],'attributes':_0x30d0ac[_0x8284('0x22')],'include':_0x30d0ac[_0x8284('0x1f')]?_['map'](_0x30d0ac[_0x8284('0x1f')],function(_0x20acb5){return{'model':db[_0x20acb5['model']],'as':_0x20acb5['as'],'attributes':_0x20acb5['attributes'],'include':_0x20acb5[_0x8284('0x1f')]?_['map'](_0x20acb5[_0x8284('0x1f')],function(_0xddcd4b){return{'model':db[_0xddcd4b[_0x8284('0x21')]],'as':_0xddcd4b['as'],'attributes':_0xddcd4b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f9006){logger[_0x8284('0xf')](_0x8284('0x1a'),_0xadc566);logger['debug'](_0x8284('0x1a'),_0xadc566,JSON[_0x8284('0x14')](_0x4f9006));_0x5cb807(_0x4f9006);})['catch'](function(_0x3ac09e){logger[_0x8284('0x15')](_0x8284('0x1a'),_0x3ac09e[_0x8284('0x17')],_0xadc566);_0x1d7732(_0x326024[_0x8284('0x15')](0x1f4,_0x3ac09e[_0x8284('0x17')]));});});};exports[_0x8284('0x23')]=function(_0x7416e4){var _0x473bdf=this;return new Promise(function(_0x3b9198,_0x3b6af7){return db[_0x8284('0x1b')][_0x8284('0x24')]({'raw':_0x7416e4['options']?_0x7416e4[_0x8284('0x1d')][_0x8284('0x1e')]===undefined?!![]:![]:!![],'where':_0x7416e4[_0x8284('0x1d')]?_0x7416e4[_0x8284('0x1d')][_0x8284('0x25')]||null:null,'attributes':_0x7416e4[_0x8284('0x1d')]?_0x7416e4['options'][_0x8284('0x22')]||null:null,'include':_0x7416e4[_0x8284('0x1d')]?_0x7416e4[_0x8284('0x1d')][_0x8284('0x1f')]?_[_0x8284('0x20')](_0x7416e4['options'][_0x8284('0x1f')],function(_0x5429d3){return{'model':db[_0x5429d3[_0x8284('0x21')]],'as':_0x5429d3['as'],'attributes':_0x5429d3['attributes'],'include':_0x5429d3[_0x8284('0x1f')]?_['map'](_0x5429d3[_0x8284('0x1f')],function(_0x192cd0){return{'model':db[_0x192cd0[_0x8284('0x21')]],'as':_0x192cd0['as'],'attributes':_0x192cd0['attributes'],'include':_0x192cd0['include']?_[_0x8284('0x20')](_0x192cd0[_0x8284('0x1f')],function(_0x38324d){return{'model':db[_0x38324d[_0x8284('0x21')]],'as':_0x38324d['as'],'attributes':_0x38324d[_0x8284('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8284('0x26')](function(_0x4a403d){logger['info']('ShowWhatsappQueue',_0x7416e4);logger[_0x8284('0x12')]('ShowWhatsappQueue',_0x7416e4,JSON[_0x8284('0x14')](_0x4a403d));_0x3b9198(_0x4a403d);})[_0x8284('0x19')](function(_0x10d8ac){logger[_0x8284('0x15')]('ShowWhatsappQueue',_0x10d8ac[_0x8284('0x17')],_0x7416e4);_0x3b6af7(_0x473bdf[_0x8284('0x15')](0x1f4,_0x10d8ac[_0x8284('0x17')]));});});}; \ No newline at end of file +var _0x8f56=['GetWhatsappQueue','catch','where','then','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue','options','raw','attributes','limit','include','map','model'];(function(_0x44b346,_0xeb097d){var _0x1c2f2b=function(_0x4e1f23){while(--_0x4e1f23){_0x44b346['push'](_0x44b346['shift']());}};_0x1c2f2b(++_0xeb097d);}(_0x8f56,0x164));var _0x68f5=function(_0x591d50,_0x51d729){_0x591d50=_0x591d50-0x0;var _0x204b72=_0x8f56[_0x591d50];return _0x204b72;};'use strict';var _=require('lodash');var util=require(_0x68f5('0x0'));var moment=require(_0x68f5('0x1'));var BPromise=require(_0x68f5('0x2'));var rs=require(_0x68f5('0x3'));var fs=require('fs');var Redis=require(_0x68f5('0x4'));var db=require(_0x68f5('0x5'))['db'];var utils=require(_0x68f5('0x6'));var logger=require(_0x68f5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x68f5('0x8'));var client=jayson[_0x68f5('0x9')][_0x68f5('0xa')]({'port':0x232a});config[_0x68f5('0xb')]=_[_0x68f5('0xc')](config[_0x68f5('0xb')],{'host':_0x68f5('0xd'),'port':0x18eb});var socket=require(_0x68f5('0xe'))(new Redis(config[_0x68f5('0xb')]));require(_0x68f5('0xf'))['register'](socket);function respondWithRpcPromise(_0x457e0a,_0x1eab6a,_0x414091){return new BPromise(function(_0x54f28d,_0x40ee4e){return client[_0x68f5('0x10')](_0x457e0a,_0x414091)['then'](function(_0x3f4206){logger[_0x68f5('0x11')](_0x68f5('0x12'),_0x1eab6a,_0x68f5('0x13'));logger[_0x68f5('0x14')](_0x68f5('0x15'),_0x1eab6a,_0x68f5('0x13'),JSON[_0x68f5('0x16')](_0x3f4206));if(_0x3f4206[_0x68f5('0x17')]){if(_0x3f4206[_0x68f5('0x17')][_0x68f5('0x18')]===0x1f4){logger[_0x68f5('0x17')](_0x68f5('0x12'),_0x1eab6a,_0x3f4206['error'][_0x68f5('0x19')]);return _0x40ee4e(_0x3f4206['error'][_0x68f5('0x19')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1eab6a,_0x3f4206[_0x68f5('0x17')][_0x68f5('0x19')]);return _0x54f28d(_0x3f4206[_0x68f5('0x17')][_0x68f5('0x19')]);}else{logger[_0x68f5('0x11')](_0x68f5('0x12'),_0x1eab6a,'request\x20sent');_0x54f28d(_0x3f4206['result'][_0x68f5('0x19')]);}})['catch'](function(_0x50d065){logger[_0x68f5('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x1eab6a,_0x50d065);_0x40ee4e(_0x50d065);});});}exports['GetWhatsappQueue']=function(_0xc64b7){var _0x14e403=this;return new Promise(function(_0x5ebd4c,_0x306574){return db[_0x68f5('0x1a')]['findAll']({'raw':_0xc64b7['options']?_0xc64b7[_0x68f5('0x1b')][_0x68f5('0x1c')]===undefined?!![]:![]:!![],'where':_0xc64b7[_0x68f5('0x1b')]?_0xc64b7[_0x68f5('0x1b')]['where']||null:null,'attributes':_0xc64b7['options']?_0xc64b7[_0x68f5('0x1b')][_0x68f5('0x1d')]||null:null,'limit':_0xc64b7[_0x68f5('0x1b')]?_0xc64b7[_0x68f5('0x1b')][_0x68f5('0x1e')]||null:null,'include':_0xc64b7['options']?_0xc64b7[_0x68f5('0x1b')][_0x68f5('0x1f')]?_[_0x68f5('0x20')](_0xc64b7['options']['include'],function(_0x4382fe){return{'model':db[_0x4382fe[_0x68f5('0x21')]],'as':_0x4382fe['as'],'attributes':_0x4382fe[_0x68f5('0x1d')],'include':_0x4382fe[_0x68f5('0x1f')]?_[_0x68f5('0x20')](_0x4382fe['include'],function(_0x30a96c){return{'model':db[_0x30a96c[_0x68f5('0x21')]],'as':_0x30a96c['as'],'attributes':_0x30a96c['attributes'],'include':_0x30a96c['include']?_[_0x68f5('0x20')](_0x30a96c[_0x68f5('0x1f')],function(_0xc91e64){return{'model':db[_0xc91e64[_0x68f5('0x21')]],'as':_0xc91e64['as'],'attributes':_0xc91e64[_0x68f5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a36dc){logger['info'](_0x68f5('0x22'),_0xc64b7);logger[_0x68f5('0x14')](_0x68f5('0x22'),_0xc64b7,JSON[_0x68f5('0x16')](_0x5a36dc));_0x5ebd4c(_0x5a36dc);})[_0x68f5('0x23')](function(_0x4bc7d1){logger[_0x68f5('0x17')](_0x68f5('0x22'),_0x4bc7d1[_0x68f5('0x19')],_0xc64b7);_0x306574(_0x14e403[_0x68f5('0x17')](0x1f4,_0x4bc7d1['message']));});});};exports['ShowWhatsappQueue']=function(_0x261dce){var _0x2f86b6=this;return new Promise(function(_0x26be09,_0xf46c8b){return db[_0x68f5('0x1a')]['find']({'raw':_0x261dce['options']?_0x261dce[_0x68f5('0x1b')][_0x68f5('0x1c')]===undefined?!![]:![]:!![],'where':_0x261dce[_0x68f5('0x1b')]?_0x261dce[_0x68f5('0x1b')][_0x68f5('0x24')]||null:null,'attributes':_0x261dce[_0x68f5('0x1b')]?_0x261dce[_0x68f5('0x1b')]['attributes']||null:null,'include':_0x261dce[_0x68f5('0x1b')]?_0x261dce[_0x68f5('0x1b')]['include']?_[_0x68f5('0x20')](_0x261dce['options'][_0x68f5('0x1f')],function(_0x54ffc5){return{'model':db[_0x54ffc5['model']],'as':_0x54ffc5['as'],'attributes':_0x54ffc5[_0x68f5('0x1d')],'include':_0x54ffc5[_0x68f5('0x1f')]?_[_0x68f5('0x20')](_0x54ffc5['include'],function(_0x4edd12){return{'model':db[_0x4edd12[_0x68f5('0x21')]],'as':_0x4edd12['as'],'attributes':_0x4edd12[_0x68f5('0x1d')],'include':_0x4edd12[_0x68f5('0x1f')]?_['map'](_0x4edd12[_0x68f5('0x1f')],function(_0x5a6428){return{'model':db[_0x5a6428['model']],'as':_0x5a6428['as'],'attributes':_0x5a6428['attributes']};}):[]};}):[]};}):[]:[]})[_0x68f5('0x25')](function(_0xbb9440){logger[_0x68f5('0x11')](_0x68f5('0x26'),_0x261dce);logger['debug'](_0x68f5('0x26'),_0x261dce,JSON[_0x68f5('0x16')](_0xbb9440));_0x26be09(_0xbb9440);})['catch'](function(_0x315fff){logger[_0x68f5('0x17')](_0x68f5('0x26'),_0x315fff[_0x68f5('0x19')],_0x261dce);_0xf46c8b(_0x2f86b6[_0x68f5('0x17')](0x1f4,_0x315fff[_0x68f5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5abb7cf..23fca2a 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 _0x4ccb=['update','emit','length','whatsappQueue:','remove'];(function(_0x49b4ec,_0xbe7da1){var _0x21de59=function(_0x6eca79){while(--_0x6eca79){_0x49b4ec['push'](_0x49b4ec['shift']());}};_0x21de59(++_0xbe7da1);}(_0x4ccb,0x1ee));var _0xb4cc=function(_0x115bf1,_0x3c2b54){_0x115bf1=_0x115bf1-0x0;var _0x26242b=_0x4ccb[_0x115bf1];return _0x26242b;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xb4cc('0x0'),_0xb4cc('0x1')];function createListener(_0x4b7b01,_0x2a5009){return function(_0x3fd823){_0x2a5009[_0xb4cc('0x2')](_0x4b7b01,_0x3fd823);};}function removeListener(_0x36b556,_0x560b46){return function(){WhatsappQueueEvents['removeListener'](_0x36b556,_0x560b46);};}exports['register']=function(_0x3b83ca){for(var _0x49b896=0x0,_0x31e695=events[_0xb4cc('0x3')];_0x49b896<_0x31e695;_0x49b896++){var _0x4a9f22=events[_0x49b896];var _0x55f519=createListener(_0xb4cc('0x4')+_0x4a9f22,_0x3b83ca);WhatsappQueueEvents['on'](_0x4a9f22,_0x55f519);}}; \ No newline at end of file +var _0xa89f=['./whatsappQueue.events','remove','update','emit','removeListener','length','whatsappQueue:'];(function(_0x16472b,_0x557088){var _0x53ea3f=function(_0x33a61e){while(--_0x33a61e){_0x16472b['push'](_0x16472b['shift']());}};_0x53ea3f(++_0x557088);}(_0xa89f,0x16c));var _0xfa89=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0xa89f[_0x5341ff];return _0x53be58;};'use strict';var WhatsappQueueEvents=require(_0xfa89('0x0'));var events=['save',_0xfa89('0x1'),_0xfa89('0x2')];function createListener(_0x5503c5,_0x25bddc){return function(_0x46d7e5){_0x25bddc[_0xfa89('0x3')](_0x5503c5,_0x46d7e5);};}function removeListener(_0xe57fb2,_0x1f2b21){return function(){WhatsappQueueEvents[_0xfa89('0x4')](_0xe57fb2,_0x1f2b21);};}exports['register']=function(_0x1b5ad3){for(var _0x1f8dda=0x0,_0x17d940=events[_0xfa89('0x5')];_0x1f8dda<_0x17d940;_0x1f8dda++){var _0x3e1b5e=events[_0x1f8dda];var _0x15ee0f=createListener(_0xfa89('0x6')+_0x3e1b5e,_0x1b5ad3);WhatsappQueueEvents['on'](_0x3e1b5e,_0x15ee0f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e5bb712..5fff9ad 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 _0x3cac=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x41f171,_0x86382){var _0x26119c=function(_0x413ff9){while(--_0x413ff9){_0x41f171['push'](_0x41f171['shift']());}};_0x26119c(++_0x86382);}(_0x3cac,0x176));var _0xc3ca=function(_0x128d4e,_0x462932){_0x128d4e=_0x128d4e-0x0;var _0x227381=_0x3cac[_0x128d4e];return _0x227381;};'use strict';var multer=require(_0xc3ca('0x0'));var util=require(_0xc3ca('0x1'));var path=require('path');var timeout=require(_0xc3ca('0x2'));var express=require(_0xc3ca('0x3'));var router=express[_0xc3ca('0x4')]();var fs_extra=require(_0xc3ca('0x5'));var auth=require(_0xc3ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc3ca('0x7'));var controller=require(_0xc3ca('0x8'));router['get']('/',auth[_0xc3ca('0x9')](),controller[_0xc3ca('0xa')]);router[_0xc3ca('0xb')](_0xc3ca('0xc'),auth[_0xc3ca('0x9')](),controller[_0xc3ca('0xd')]);router[_0xc3ca('0xb')](_0xc3ca('0xe'),auth['isAuthenticated'](),controller[_0xc3ca('0xf')]);router[_0xc3ca('0x10')]('/',auth[_0xc3ca('0x9')](),controller[_0xc3ca('0x11')]);router[_0xc3ca('0x12')](_0xc3ca('0xe'),auth['isAuthenticated'](),controller[_0xc3ca('0x13')]);router['delete']('/:id',auth[_0xc3ca('0x9')](),controller[_0xc3ca('0x14')]);module[_0xc3ca('0x15')]=router; \ No newline at end of file +var _0x7f52=['isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe'];(function(_0x70cc36,_0x31a71a){var _0x516ad=function(_0x1187fa){while(--_0x1187fa){_0x70cc36['push'](_0x70cc36['shift']());}};_0x516ad(++_0x31a71a);}(_0x7f52,0x6c));var _0x27f5=function(_0x455580,_0x5cd4dd){_0x455580=_0x455580-0x0;var _0x7aabc2=_0x7f52[_0x455580];return _0x7aabc2;};'use strict';var multer=require(_0x27f5('0x0'));var util=require('util');var path=require(_0x27f5('0x1'));var timeout=require('connect-timeout');var express=require(_0x27f5('0x2'));var router=express[_0x27f5('0x3')]();var fs_extra=require(_0x27f5('0x4'));var auth=require(_0x27f5('0x5'));var interaction=require(_0x27f5('0x6'));var config=require(_0x27f5('0x7'));var controller=require(_0x27f5('0x8'));router[_0x27f5('0x9')]('/',auth['isAuthenticated'](),controller[_0x27f5('0xa')]);router['get'](_0x27f5('0xb'),auth[_0x27f5('0xc')](),controller[_0x27f5('0xd')]);router[_0x27f5('0x9')](_0x27f5('0xe'),auth['isAuthenticated'](),controller[_0x27f5('0xf')]);router[_0x27f5('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x27f5('0x11')](_0x27f5('0xe'),auth[_0x27f5('0xc')](),controller['update']);router['delete'](_0x27f5('0xe'),auth[_0x27f5('0xc')](),controller[_0x27f5('0x12')]);module[_0x27f5('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 992a56f..fed88a6 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(_0x5f9f86,_0x5c38f0){var _0x23c195=function(_0x48f15c){while(--_0x48f15c){_0x5f9f86['push'](_0x5f9f86['shift']());}};_0x23c195(++_0x5c38f0);}(_0x7a54,0x106));var _0x47a5=function(_0x456df0,_0x29bf20){_0x456df0=_0x456df0-0x0;var _0x3450a7=_0x7a54[_0x456df0];return _0x3450a7;};'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(_0x1ad558,_0x532ea2){var _0x7637fb=function(_0x24309c){while(--_0x24309c){_0x1ad558['push'](_0x1ad558['shift']());}};_0x7637fb(++_0x532ea2);}(_0x7a54,0x106));var _0x47a5=function(_0x1ff24b,_0x3d4188){_0x1ff24b=_0x1ff24b-0x0;var _0x845fdd=_0x7a54[_0x1ff24b];return _0x845fdd;};'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 a140c72..0e955c0 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 _0x9c00=['fields','length','nolimit','offset','order','sort','pick','type','VIRTUAL','filter','options','where','then','include','findAll','rows','catch','show','params','keys','includeAll','merge','create','body','find','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','key','model','query','filters','intersection','attributes'];(function(_0xa49643,_0x2bbdce){var _0x248fea=function(_0x4caeda){while(--_0x4caeda){_0xa49643['push'](_0xa49643['shift']());}};_0x248fea(++_0x2bbdce);}(_0x9c00,0x1a0));var _0x09c0=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0x9c00[_0x58b6a8];return _0xc566dc;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x56d883,_0x2c7202){return function(_0x163a59){if(!_0x163a59){_0x56d883[_0x09c0('0x1b')](0x194);}return _0x163a59;};}function handleError(_0x30c2a1,_0x1f8131){_0x1f8131=_0x1f8131||0x1f4;return function(_0x1d2d9d){logger[_0x09c0('0x27')](_0x1d2d9d[_0x09c0('0x28')]);if(_0x1d2d9d[_0x09c0('0x29')]){delete _0x1d2d9d[_0x09c0('0x29')];}_0x30c2a1[_0x09c0('0x1c')](_0x1f8131)['send'](_0x1d2d9d);};}exports[_0x09c0('0x2a')]=function(_0x1bdde9,_0x53a7b8){var _0x1d09e0={},_0x5aa0b9={},_0x3f5b10={'count':0x0,'rows':[]};var _0x4d6bdc=_[_0x09c0('0x2b')](db[_0x09c0('0x2c')][_0x09c0('0x2d')],function(_0x4159bc){return{'name':_0x4159bc['fieldName'],'type':_0x4159bc['type'][_0x09c0('0x2e')]};});_0x5aa0b9[_0x09c0('0x2f')]=_[_0x09c0('0x2b')](_0x4d6bdc,'name');_0x5aa0b9[_0x09c0('0x30')]=_['keys'](_0x1bdde9[_0x09c0('0x30')]);_0x5aa0b9[_0x09c0('0x31')]=_[_0x09c0('0x32')](_0x5aa0b9['model'],_0x5aa0b9[_0x09c0('0x30')]);_0x1d09e0[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x5aa0b9[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x34')]));_0x1d09e0['attributes']=_0x1d09e0[_0x09c0('0x33')][_0x09c0('0x35')]?_0x1d09e0[_0x09c0('0x33')]:_0x5aa0b9[_0x09c0('0x2f')];if(!_0x1bdde9[_0x09c0('0x30')]['hasOwnProperty'](_0x09c0('0x36'))){_0x1d09e0[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x20')]);_0x1d09e0['offset']=qs[_0x09c0('0x37')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x37')]);}_0x1d09e0[_0x09c0('0x38')]=qs[_0x09c0('0x39')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x39')]);_0x1d09e0['where']=qs[_0x09c0('0x31')](_[_0x09c0('0x3a')](_0x1bdde9[_0x09c0('0x30')],_0x5aa0b9[_0x09c0('0x31')]),_0x4d6bdc);if(_0x1bdde9[_0x09c0('0x30')]['filter']){_0x1d09e0['where']=_['merge'](_0x1d09e0['where'],{'$or':_[_0x09c0('0x2b')](_0x4d6bdc,function(_0x15c631){if(_0x15c631[_0x09c0('0x3b')]!==_0x09c0('0x3c')){var _0x1a8c0c={};_0x1a8c0c[_0x15c631['name']]={'$like':'%'+_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x3d')]+'%'};return _0x1a8c0c;}})});}_0x1d09e0=_['merge']({},_0x1d09e0,_0x1bdde9[_0x09c0('0x3e')]);var _0x5d50b9={'where':_0x1d09e0[_0x09c0('0x3f')]};return db['WhatsappQueueReport'][_0x09c0('0x21')](_0x5d50b9)[_0x09c0('0x40')](function(_0x56a511){_0x3f5b10[_0x09c0('0x21')]=_0x56a511;if(_0x1bdde9[_0x09c0('0x30')]['includeAll']){_0x1d09e0[_0x09c0('0x41')]=[{'all':!![]}];}return db[_0x09c0('0x2c')][_0x09c0('0x42')](_0x1d09e0);})[_0x09c0('0x40')](function(_0xeb8191){_0x3f5b10[_0x09c0('0x43')]=_0xeb8191;return _0x3f5b10;})['then'](respondWithFilteredResult(_0x53a7b8,_0x1d09e0))[_0x09c0('0x44')](handleError(_0x53a7b8,null));};exports[_0x09c0('0x45')]=function(_0x2d6344,_0x57835c){var _0x193ed2={'raw':!![],'where':{'id':_0x2d6344[_0x09c0('0x46')]['id']}},_0x30c0c5={};_0x30c0c5['model']=_[_0x09c0('0x47')](db[_0x09c0('0x2c')]['rawAttributes']);_0x30c0c5['query']=_[_0x09c0('0x47')](_0x2d6344[_0x09c0('0x30')]);_0x30c0c5['filters']=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],_0x30c0c5['query']);_0x193ed2[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x2d6344[_0x09c0('0x30')]['fields']));_0x193ed2[_0x09c0('0x33')]=_0x193ed2['attributes']['length']?_0x193ed2[_0x09c0('0x33')]:_0x30c0c5[_0x09c0('0x2f')];if(_0x2d6344[_0x09c0('0x30')][_0x09c0('0x48')]){_0x193ed2[_0x09c0('0x41')]=[{'all':!![]}];}_0x193ed2=_[_0x09c0('0x49')]({},_0x193ed2,_0x2d6344['options']);return db['WhatsappQueueReport']['find'](_0x193ed2)[_0x09c0('0x40')](handleEntityNotFound(_0x57835c,null))[_0x09c0('0x40')](respondWithResult(_0x57835c,null))[_0x09c0('0x44')](handleError(_0x57835c,null));};exports['create']=function(_0xdf1553,_0xff9650){return db[_0x09c0('0x2c')][_0x09c0('0x4a')](_0xdf1553[_0x09c0('0x4b')],{})[_0x09c0('0x40')](respondWithResult(_0xff9650,0xc9))[_0x09c0('0x44')](handleError(_0xff9650,null));};exports[_0x09c0('0x25')]=function(_0x3f6d14,_0x38085c){if(_0x3f6d14[_0x09c0('0x4b')]['id']){delete _0x3f6d14[_0x09c0('0x4b')]['id'];}return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x3f6d14[_0x09c0('0x46')]['id']}})[_0x09c0('0x40')](handleEntityNotFound(_0x38085c,null))[_0x09c0('0x40')](saveUpdates(_0x3f6d14[_0x09c0('0x4b')],null))[_0x09c0('0x40')](respondWithResult(_0x38085c,null))[_0x09c0('0x44')](handleError(_0x38085c,null));};exports['destroy']=function(_0x4acf54,_0x44befb){return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x4acf54[_0x09c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x44befb,null))[_0x09c0('0x40')](removeEntity(_0x44befb,null))[_0x09c0('0x44')](handleError(_0x44befb,null));};exports[_0x09c0('0x4d')]=function(_0x4a92c0,_0xe0b82a){return db[_0x09c0('0x2c')][_0x09c0('0x4d')]()[_0x09c0('0x40')](respondWithResult(_0xe0b82a,null))[_0x09c0('0x44')](handleError(_0xe0b82a,null));}; \ No newline at end of file +var _0x2547=['order','where','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2547,0x1cd));var _0x7254=function(_0x75126a,_0x22873d){_0x75126a=_0x75126a-0x0;var _0x25ebea=_0x2547[_0x75126a];return _0x25ebea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['WhatsappQueueReport'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['WhatsappQueueReport']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['WhatsappQueueReport'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['WhatsappQueueReport'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));};exports['describe']=function(_0x5e66c6,_0x24c532){return db[_0x7254('0x40')][_0x7254('0x49')]()[_0x7254('0x25')](respondWithResult(_0x24c532,null))[_0x7254('0x44')](handleError(_0x24c532,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 35f81da..96acb71 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 _0xc1bc=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x5ea6d5,_0xb696d3){var _0xf8c669=function(_0x4a16f8){while(--_0x4a16f8){_0x5ea6d5['push'](_0x5ea6d5['shift']());}};_0xf8c669(++_0xb696d3);}(_0xc1bc,0x181));var _0xcc1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1bc[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xcc1b('0x0'));var logger=require(_0xcc1b('0x1'))(_0xcc1b('0x2'));var moment=require(_0xcc1b('0x3'));var BPromise=require(_0xcc1b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc1b('0x5'));var rimraf=require('rimraf');var config=require(_0xcc1b('0x6'));var attributes=require(_0xcc1b('0x7'));module[_0xcc1b('0x8')]=function(_0x2c7e96,_0x10a0ee){return _0x2c7e96[_0xcc1b('0x9')](_0xcc1b('0xa'),attributes,{'tableName':_0xcc1b('0xb'),'paranoid':![],'indexes':[{'name':_0xcc1b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x85f9=['bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5ed3f4,_0x42d58c){var _0x4a619d=function(_0x1ee01){while(--_0x1ee01){_0x5ed3f4['push'](_0x5ed3f4['shift']());}};_0x4a619d(++_0x42d58c);}(_0x85f9,0x7a));var _0x985f=function(_0x55ac0c,_0x3df355){_0x55ac0c=_0x55ac0c-0x0;var _0x460830=_0x85f9[_0x55ac0c];return _0x460830;};'use strict';var _=require(_0x985f('0x0'));var util=require(_0x985f('0x1'));var logger=require(_0x985f('0x2'))(_0x985f('0x3'));var moment=require('moment');var BPromise=require(_0x985f('0x4'));var rp=require(_0x985f('0x5'));var fs=require('fs');var path=require(_0x985f('0x6'));var rimraf=require('rimraf');var config=require(_0x985f('0x7'));var attributes=require(_0x985f('0x8'));module[_0x985f('0x9')]=function(_0x49eef9,_0x27ec12){return _0x49eef9[_0x985f('0xa')](_0x985f('0xb'),attributes,{'tableName':_0x985f('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x985f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f8f69b0..dce2282 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 _0x0845=['create','body','options','raw','then','update','where','attributes','limit','UpdateWhatsappQueueReport','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport'];(function(_0x56ebf0,_0x4f8a0e){var _0x13e4fd=function(_0x3209c7){while(--_0x3209c7){_0x56ebf0['push'](_0x56ebf0['shift']());}};_0x13e4fd(++_0x4f8a0e);}(_0x0845,0x1ae));var _0x5084=function(_0x31130e,_0x2cd90e){_0x31130e=_0x31130e-0x0;var _0x4a092c=_0x0845[_0x31130e];return _0x4a092c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5084('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5084('0x1'));var logger=require(_0x5084('0x2'))(_0x5084('0x3'));var config=require(_0x5084('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5084('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44b335,_0x582b1a,_0xe689e5){return new BPromise(function(_0x74048c,_0x392bad){return client[_0x5084('0x6')](_0x44b335,_0xe689e5)['then'](function(_0x397af0){logger[_0x5084('0x7')](_0x5084('0x8'),_0x582b1a,_0x5084('0x9'));logger[_0x5084('0xa')](_0x5084('0xb'),_0x582b1a,_0x5084('0x9'),JSON[_0x5084('0xc')](_0x397af0));if(_0x397af0[_0x5084('0xd')]){if(_0x397af0[_0x5084('0xd')][_0x5084('0xe')]===0x1f4){logger[_0x5084('0xd')](_0x5084('0x8'),_0x582b1a,_0x397af0[_0x5084('0xd')][_0x5084('0xf')]);return _0x392bad(_0x397af0[_0x5084('0xd')][_0x5084('0xf')]);}logger[_0x5084('0xd')](_0x5084('0x8'),_0x582b1a,_0x397af0[_0x5084('0xd')][_0x5084('0xf')]);return _0x74048c(_0x397af0[_0x5084('0xd')][_0x5084('0xf')]);}else{logger[_0x5084('0x7')](_0x5084('0x8'),_0x582b1a,_0x5084('0x9'));_0x74048c(_0x397af0[_0x5084('0x10')][_0x5084('0xf')]);}})[_0x5084('0x11')](function(_0x323976){logger[_0x5084('0xd')](_0x5084('0x8'),_0x582b1a,_0x323976);_0x392bad(_0x323976);});});}exports[_0x5084('0x12')]=function(_0x531811){var _0x571b0a=this;return new Promise(function(_0x308f5a,_0x2e0187){return db[_0x5084('0x13')][_0x5084('0x14')](_0x531811[_0x5084('0x15')],{'raw':_0x531811['options']?_0x531811[_0x5084('0x16')][_0x5084('0x17')]===undefined?!![]:![]:!![]})[_0x5084('0x18')](function(_0x2437b8){logger[_0x5084('0x7')](_0x5084('0x12'),_0x531811);logger[_0x5084('0xa')](_0x5084('0x12'),_0x531811,JSON[_0x5084('0xc')](_0x2437b8));_0x308f5a(_0x2437b8);})['catch'](function(_0xc0cc29){logger[_0x5084('0xd')]('CreateWhatsappQueueReport',_0xc0cc29[_0x5084('0xf')],_0x531811);_0x2e0187(_0x571b0a[_0x5084('0xd')](0x1f4,_0xc0cc29[_0x5084('0xf')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x48aed7){var _0x3f52ab=this;return new Promise(function(_0x5e2742,_0x3831cb){return db[_0x5084('0x13')][_0x5084('0x19')](_0x48aed7[_0x5084('0x15')],{'raw':_0x48aed7[_0x5084('0x16')]?_0x48aed7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48aed7[_0x5084('0x16')]?_0x48aed7['options'][_0x5084('0x1a')]||null:null,'attributes':_0x48aed7['options']?_0x48aed7[_0x5084('0x16')][_0x5084('0x1b')]||null:null,'limit':_0x48aed7[_0x5084('0x16')]?_0x48aed7[_0x5084('0x16')][_0x5084('0x1c')]||null:null})[_0x5084('0x18')](function(_0x24611e){logger[_0x5084('0x7')](_0x5084('0x1d'),_0x48aed7);logger[_0x5084('0xa')](_0x5084('0x1d'),_0x48aed7,JSON[_0x5084('0xc')](_0x24611e));_0x5e2742(_0x24611e);})[_0x5084('0x11')](function(_0x5bad8e){logger[_0x5084('0xd')](_0x5084('0x1d'),_0x5bad8e[_0x5084('0xf')],_0x48aed7);_0x3831cb(_0x3f52ab['error'](0x1f4,_0x5bad8e['message']));});});}; \ No newline at end of file +var _0x912d=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','UpdateWhatsappQueueReport','where','attributes','limit','util','moment'];(function(_0x209c61,_0x46f389){var _0x3994c7=function(_0x423ef8){while(--_0x423ef8){_0x209c61['push'](_0x209c61['shift']());}};_0x3994c7(++_0x46f389);}(_0x912d,0x1de));var _0xd912=function(_0x1e9c70,_0x368b6b){_0x1e9c70=_0x1e9c70-0x0;var _0x517ec3=_0x912d[_0x1e9c70];return _0x517ec3;};'use strict';var _=require('lodash');var util=require(_0xd912('0x0'));var moment=require(_0xd912('0x1'));var BPromise=require(_0xd912('0x2'));var rs=require(_0xd912('0x3'));var fs=require('fs');var Redis=require(_0xd912('0x4'));var db=require(_0xd912('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd912('0x6'));var config=require(_0xd912('0x7'));var jayson=require(_0xd912('0x8'));var client=jayson[_0xd912('0x9')][_0xd912('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x246cfd,_0x318704,_0x58765d){return new BPromise(function(_0x5ef44b,_0x194e6e){return client[_0xd912('0xb')](_0x246cfd,_0x58765d)[_0xd912('0xc')](function(_0x38ef58){logger[_0xd912('0xd')](_0xd912('0xe'),_0x318704,_0xd912('0xf'));logger[_0xd912('0x10')](_0xd912('0x11'),_0x318704,_0xd912('0xf'),JSON[_0xd912('0x12')](_0x38ef58));if(_0x38ef58[_0xd912('0x13')]){if(_0x38ef58['error'][_0xd912('0x14')]===0x1f4){logger[_0xd912('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x318704,_0x38ef58['error'][_0xd912('0x15')]);return _0x194e6e(_0x38ef58[_0xd912('0x13')]['message']);}logger[_0xd912('0x13')](_0xd912('0xe'),_0x318704,_0x38ef58[_0xd912('0x13')][_0xd912('0x15')]);return _0x5ef44b(_0x38ef58['error'][_0xd912('0x15')]);}else{logger['info'](_0xd912('0xe'),_0x318704,_0xd912('0xf'));_0x5ef44b(_0x38ef58[_0xd912('0x16')][_0xd912('0x15')]);}})[_0xd912('0x17')](function(_0x29bf91){logger[_0xd912('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x318704,_0x29bf91);_0x194e6e(_0x29bf91);});});}exports[_0xd912('0x18')]=function(_0x5a40cc){var _0x4e1087=this;return new Promise(function(_0x3bf4a9,_0xb79ce9){return db[_0xd912('0x19')]['create'](_0x5a40cc[_0xd912('0x1a')],{'raw':_0x5a40cc[_0xd912('0x1b')]?_0x5a40cc[_0xd912('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xd912('0xc')](function(_0x4690f1){logger[_0xd912('0xd')](_0xd912('0x18'),_0x5a40cc);logger['debug'](_0xd912('0x18'),_0x5a40cc,JSON[_0xd912('0x12')](_0x4690f1));_0x3bf4a9(_0x4690f1);})[_0xd912('0x17')](function(_0x4b2055){logger[_0xd912('0x13')]('CreateWhatsappQueueReport',_0x4b2055['message'],_0x5a40cc);_0xb79ce9(_0x4e1087[_0xd912('0x13')](0x1f4,_0x4b2055[_0xd912('0x15')]));});});};exports[_0xd912('0x1c')]=function(_0x3a22a7){var _0x1e973b=this;return new Promise(function(_0x2d706d,_0x5323fe){return db['WhatsappQueueReport']['update'](_0x3a22a7[_0xd912('0x1a')],{'raw':_0x3a22a7[_0xd912('0x1b')]?_0x3a22a7[_0xd912('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a22a7[_0xd912('0x1b')]?_0x3a22a7['options'][_0xd912('0x1d')]||null:null,'attributes':_0x3a22a7[_0xd912('0x1b')]?_0x3a22a7['options'][_0xd912('0x1e')]||null:null,'limit':_0x3a22a7['options']?_0x3a22a7['options'][_0xd912('0x1f')]||null:null})[_0xd912('0xc')](function(_0x4ea638){logger[_0xd912('0xd')](_0xd912('0x1c'),_0x3a22a7);logger[_0xd912('0x10')](_0xd912('0x1c'),_0x3a22a7,JSON[_0xd912('0x12')](_0x4ea638));_0x2d706d(_0x4ea638);})['catch'](function(_0x5c0f39){logger[_0xd912('0x13')](_0xd912('0x1c'),_0x5c0f39[_0xd912('0x15')],_0x3a22a7);_0x5323fe(_0x1e973b['error'](0x1f4,_0x5c0f39[_0xd912('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 002e138..669fa9d 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 _0xdfe1=['express','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x45cf14,_0x347d26){var _0x61f60b=function(_0x15e170){while(--_0x15e170){_0x45cf14['push'](_0x45cf14['shift']());}};_0x61f60b(++_0x347d26);}(_0xdfe1,0x75));var _0x1dfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfe1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1dfe('0x0'));var util=require('util');var path=require(_0x1dfe('0x1'));var timeout=require(_0x1dfe('0x2'));var express=require(_0x1dfe('0x3'));var router=express['Router']();var fs_extra=require(_0x1dfe('0x4'));var auth=require(_0x1dfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1dfe('0x6'));var controller=require(_0x1dfe('0x7'));router[_0x1dfe('0x8')]('/',auth[_0x1dfe('0x9')](),controller[_0x1dfe('0xa')]);router[_0x1dfe('0x8')](_0x1dfe('0xb'),auth['isAuthenticated'](),controller[_0x1dfe('0xc')]);router[_0x1dfe('0x8')](_0x1dfe('0xd'),auth[_0x1dfe('0x9')](),controller[_0x1dfe('0xe')]);router[_0x1dfe('0xf')]('/',auth[_0x1dfe('0x9')](),controller['create']);router['put']('/:id',auth[_0x1dfe('0x9')](),controller[_0x1dfe('0x10')]);router[_0x1dfe('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1dfe('0x12')]);module[_0x1dfe('0x13')]=router; \ No newline at end of file +var _0xd241=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd241,0x188));var _0x1d24=function(_0x44c4f9,_0x26fdc8){_0x44c4f9=_0x44c4f9-0x0;var _0x2a3d2e=_0xd241[_0x44c4f9];return _0x2a3d2e;};'use strict';var multer=require(_0x1d24('0x0'));var util=require(_0x1d24('0x1'));var path=require('path');var timeout=require(_0x1d24('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1d24('0x3'));var interaction=require(_0x1d24('0x4'));var config=require(_0x1d24('0x5'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x1d24('0x6')](),controller[_0x1d24('0x7')]);router[_0x1d24('0x8')](_0x1d24('0x9'),auth[_0x1d24('0x6')](),controller[_0x1d24('0xa')]);router[_0x1d24('0x8')](_0x1d24('0xb'),auth[_0x1d24('0x6')](),controller[_0x1d24('0xc')]);router[_0x1d24('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d24('0xe')](_0x1d24('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1d24('0xf')](_0x1d24('0xb'),auth['isAuthenticated'](),controller[_0x1d24('0x10')]);module[_0x1d24('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 7d09c78..f550303 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa35e=['sequelize','STRING','ENUM','account','agent','queue','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa35e,0x111));var _0xea35=function(_0x2b62ec,_0x111d13){_0x2b62ec=_0x2b62ec-0x0;var _0x3a8d40=_0xa35e[_0x2b62ec];return _0x3a8d40;};'use strict';var Sequelize=require(_0xea35('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xea35('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xea35('0x2')](_0xea35('0x3'),_0xea35('0x4'),_0xea35('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xea35('0x6')]}}; \ No newline at end of file +var _0x161a=['STRING','ENUM','agent','DATE'];(function(_0x847475,_0x5d0d2a){var _0x36d44a=function(_0x44be7a){while(--_0x44be7a){_0x847475['push'](_0x847475['shift']());}};_0x36d44a(++_0x5d0d2a);}(_0x161a,0x140));var _0xa161=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x161a[_0x53bcc3];return _0x47c959;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xa161('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xa161('0x1')]('account',_0xa161('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa161('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 984c92c..e860cbc 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 _0x09c2=['count','Content-Range','save','then','destroy','stack','name','send','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','WhatsappTransferReport','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x09c2,0x100));var _0x209c=function(_0x27a9cc,_0x3bae61){_0x27a9cc=_0x27a9cc-0x0;var _0x37d740=_0x09c2[_0x27a9cc];return _0x37d740;};'use strict';var emlformat=require(_0x209c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x209c('0x1'));var jsonpatch=require(_0x209c('0x2'));var rp=require(_0x209c('0x3'));var moment=require('moment');var BPromise=require(_0x209c('0x4'));var Mustache=require('mustache');var util=require(_0x209c('0x5'));var path=require(_0x209c('0x6'));var sox=require('sox');var csv=require(_0x209c('0x7'));var ejs=require(_0x209c('0x8'));var fs=require('fs');var fs_extra=require(_0x209c('0x9'));var _=require(_0x209c('0xa'));var squel=require(_0x209c('0xb'));var crypto=require(_0x209c('0xc'));var jsforce=require(_0x209c('0xd'));var deskjs=require(_0x209c('0xe'));var toCsv=require(_0x209c('0x7'));var querystring=require('querystring');var Papa=require(_0x209c('0xf'));var Redis=require(_0x209c('0x10'));var authService=require(_0x209c('0x11'));var qs=require(_0x209c('0x12'));var as=require(_0x209c('0x13'));var hardwareService=require(_0x209c('0x14'));var logger=require(_0x209c('0x15'))(_0x209c('0x16'));var utils=require(_0x209c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x209c('0x18'))['db'];function respondWithStatusCode(_0x60c232,_0x184cf2){_0x184cf2=_0x184cf2||0xcc;return function(_0x4e0fe4){if(_0x4e0fe4){return _0x60c232[_0x209c('0x19')](_0x184cf2);}return _0x60c232[_0x209c('0x1a')](_0x184cf2)[_0x209c('0x1b')]();};}function respondWithResult(_0xebc31a,_0x2414fd){_0x2414fd=_0x2414fd||0xc8;return function(_0x3c2c87){if(_0x3c2c87){return _0xebc31a['status'](_0x2414fd)[_0x209c('0x1c')](_0x3c2c87);}};}function respondWithFilteredResult(_0x872853,_0x576de2){return function(_0x11adc2){if(_0x11adc2){var _0x40ddb0=typeof _0x576de2[_0x209c('0x1d')]===_0x209c('0x1e')&&typeof _0x576de2[_0x209c('0x1f')]===_0x209c('0x1e');var _0x1f8a3a=_0x11adc2[_0x209c('0x20')];var _0x3d3bbd=_0x40ddb0?0x0:_0x576de2[_0x209c('0x1d')];var _0xab3e32=_0x40ddb0?_0x11adc2[_0x209c('0x20')]:_0x576de2[_0x209c('0x1d')]+_0x576de2[_0x209c('0x1f')];var _0xd590c1;if(_0xab3e32>=_0x1f8a3a){_0xab3e32=_0x1f8a3a;_0xd590c1=0xc8;}else{_0xd590c1=0xce;}_0x872853['status'](_0xd590c1);return _0x872853['set'](_0x209c('0x21'),_0x3d3bbd+'-'+_0xab3e32+'/'+_0x1f8a3a)[_0x209c('0x1c')](_0x11adc2);}return null;};}function patchUpdates(_0x130eb4){return function(_0x5d6869){try{jsonpatch['apply'](_0x5d6869,_0x130eb4,!![]);}catch(_0x5c0775){return BPromise['reject'](_0x5c0775);}return _0x5d6869[_0x209c('0x22')]();};}function saveUpdates(_0x16e682,_0x5ccdd5){return function(_0x360ad0){if(_0x360ad0){return _0x360ad0['update'](_0x16e682)[_0x209c('0x23')](function(_0x131e8b){return _0x131e8b;});}return null;};}function removeEntity(_0x46fee1,_0x104313){return function(_0x2539e7){if(_0x2539e7){return _0x2539e7[_0x209c('0x24')]()[_0x209c('0x23')](function(){_0x46fee1[_0x209c('0x1a')](0xcc)[_0x209c('0x1b')]();});}};}function handleEntityNotFound(_0x48b0a1,_0x54cf8f){return function(_0x1ff21f){if(!_0x1ff21f){_0x48b0a1[_0x209c('0x19')](0x194);}return _0x1ff21f;};}function handleError(_0x3e6bfe,_0x2418f8){_0x2418f8=_0x2418f8||0x1f4;return function(_0xe52f27){logger['error'](_0xe52f27[_0x209c('0x25')]);if(_0xe52f27['name']){delete _0xe52f27[_0x209c('0x26')];}_0x3e6bfe['status'](_0x2418f8)[_0x209c('0x27')](_0xe52f27);};}exports['index']=function(_0x3896c3,_0x5b6a7e){var _0xfd99da={},_0xf44114={},_0x34e8f6={'count':0x0,'rows':[]};var _0x1893fb=_[_0x209c('0x28')](db['WhatsappTransferReport']['rawAttributes'],function(_0x5be21e){return{'name':_0x5be21e['fieldName'],'type':_0x5be21e['type'][_0x209c('0x29')]};});_0xf44114[_0x209c('0x2a')]=_[_0x209c('0x28')](_0x1893fb,_0x209c('0x26'));_0xf44114[_0x209c('0x2b')]=_[_0x209c('0x2c')](_0x3896c3['query']);_0xf44114[_0x209c('0x2d')]=_[_0x209c('0x2e')](_0xf44114[_0x209c('0x2a')],_0xf44114['query']);_0xfd99da[_0x209c('0x2f')]=_[_0x209c('0x2e')](_0xf44114[_0x209c('0x2a')],qs[_0x209c('0x30')](_0x3896c3[_0x209c('0x2b')][_0x209c('0x30')]));_0xfd99da[_0x209c('0x2f')]=_0xfd99da[_0x209c('0x2f')][_0x209c('0x31')]?_0xfd99da[_0x209c('0x2f')]:_0xf44114[_0x209c('0x2a')];if(!_0x3896c3[_0x209c('0x2b')][_0x209c('0x32')](_0x209c('0x33'))){_0xfd99da['limit']=qs[_0x209c('0x1f')](_0x3896c3[_0x209c('0x2b')]['limit']);_0xfd99da[_0x209c('0x1d')]=qs[_0x209c('0x1d')](_0x3896c3[_0x209c('0x2b')][_0x209c('0x1d')]);}_0xfd99da[_0x209c('0x34')]=qs[_0x209c('0x35')](_0x3896c3['query'][_0x209c('0x35')]);_0xfd99da['where']=qs[_0x209c('0x2d')](_['pick'](_0x3896c3[_0x209c('0x2b')],_0xf44114[_0x209c('0x2d')]),_0x1893fb);if(_0x3896c3[_0x209c('0x2b')][_0x209c('0x36')]){_0xfd99da['where']=_[_0x209c('0x37')](_0xfd99da[_0x209c('0x38')],{'$or':_[_0x209c('0x28')](_0x1893fb,function(_0x38601a){if(_0x38601a[_0x209c('0x39')]!==_0x209c('0x3a')){var _0x2b2eca={};_0x2b2eca[_0x38601a[_0x209c('0x26')]]={'$like':'%'+_0x3896c3[_0x209c('0x2b')][_0x209c('0x36')]+'%'};return _0x2b2eca;}})});}_0xfd99da=_[_0x209c('0x37')]({},_0xfd99da,_0x3896c3['options']);var _0x4bcefc={'where':_0xfd99da['where']};return db[_0x209c('0x3b')][_0x209c('0x20')](_0x4bcefc)['then'](function(_0x3cdbda){_0x34e8f6[_0x209c('0x20')]=_0x3cdbda;if(_0x3896c3[_0x209c('0x2b')][_0x209c('0x3c')]){_0xfd99da['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x209c('0x3d')](_0xfd99da);})[_0x209c('0x23')](function(_0x2ad7eb){_0x34e8f6[_0x209c('0x3e')]=_0x2ad7eb;return _0x34e8f6;})['then'](respondWithFilteredResult(_0x5b6a7e,_0xfd99da))[_0x209c('0x3f')](handleError(_0x5b6a7e,null));};exports[_0x209c('0x40')]=function(_0x3bc39f,_0x24367c){var _0x3d675c={'raw':!![],'where':{'id':_0x3bc39f[_0x209c('0x41')]['id']}},_0x220b4e={};_0x220b4e[_0x209c('0x2a')]=_['keys'](db[_0x209c('0x3b')]['rawAttributes']);_0x220b4e[_0x209c('0x2b')]=_[_0x209c('0x2c')](_0x3bc39f['query']);_0x220b4e[_0x209c('0x2d')]=_[_0x209c('0x2e')](_0x220b4e['model'],_0x220b4e[_0x209c('0x2b')]);_0x3d675c['attributes']=_[_0x209c('0x2e')](_0x220b4e[_0x209c('0x2a')],qs[_0x209c('0x30')](_0x3bc39f[_0x209c('0x2b')]['fields']));_0x3d675c[_0x209c('0x2f')]=_0x3d675c['attributes'][_0x209c('0x31')]?_0x3d675c[_0x209c('0x2f')]:_0x220b4e[_0x209c('0x2a')];if(_0x3bc39f[_0x209c('0x2b')][_0x209c('0x3c')]){_0x3d675c[_0x209c('0x42')]=[{'all':!![]}];}_0x3d675c=_['merge']({},_0x3d675c,_0x3bc39f[_0x209c('0x43')]);return db[_0x209c('0x3b')][_0x209c('0x44')](_0x3d675c)[_0x209c('0x23')](handleEntityNotFound(_0x24367c,null))[_0x209c('0x23')](respondWithResult(_0x24367c,null))[_0x209c('0x3f')](handleError(_0x24367c,null));};exports[_0x209c('0x45')]=function(_0x2094e1,_0x4a2277){return db['WhatsappTransferReport']['create'](_0x2094e1['body'],{})[_0x209c('0x23')](respondWithResult(_0x4a2277,0xc9))[_0x209c('0x3f')](handleError(_0x4a2277,null));};exports['update']=function(_0x5948e7,_0x11c27c){if(_0x5948e7[_0x209c('0x46')]['id']){delete _0x5948e7[_0x209c('0x46')]['id'];}return db[_0x209c('0x3b')][_0x209c('0x44')]({'where':{'id':_0x5948e7[_0x209c('0x41')]['id']}})[_0x209c('0x23')](handleEntityNotFound(_0x11c27c,null))['then'](saveUpdates(_0x5948e7[_0x209c('0x46')],null))[_0x209c('0x23')](respondWithResult(_0x11c27c,null))[_0x209c('0x3f')](handleError(_0x11c27c,null));};exports['destroy']=function(_0x2cc163,_0x3c3359){return db[_0x209c('0x3b')][_0x209c('0x44')]({'where':{'id':_0x2cc163[_0x209c('0x41')]['id']}})[_0x209c('0x23')](handleEntityNotFound(_0x3c3359,null))[_0x209c('0x23')](removeEntity(_0x3c3359,null))[_0x209c('0x3f')](handleError(_0x3c3359,null));};exports['describe']=function(_0x27df3b,_0x14e6d6){return db['WhatsappTransferReport'][_0x209c('0x47')]()[_0x209c('0x23')](respondWithResult(_0x14e6d6,null))[_0x209c('0x3f')](handleError(_0x14e6d6,null));}; \ No newline at end of file +var _0xbdd4=['includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','map','type','VIRTUAL','filter'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xbdd4,0xe6));var _0x4bdd=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xbdd4[_0x3e112d];return _0x531c31;};'use strict';var emlformat=require(_0x4bdd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bdd('0x1'));var jsonpatch=require(_0x4bdd('0x2'));var rp=require(_0x4bdd('0x3'));var moment=require('moment');var BPromise=require(_0x4bdd('0x4'));var Mustache=require(_0x4bdd('0x5'));var util=require(_0x4bdd('0x6'));var path=require('path');var sox=require(_0x4bdd('0x7'));var csv=require(_0x4bdd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bdd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4bdd('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4bdd('0xb'));var Redis=require(_0x4bdd('0xc'));var authService=require(_0x4bdd('0xd'));var qs=require(_0x4bdd('0xe'));var as=require(_0x4bdd('0xf'));var hardwareService=require(_0x4bdd('0x10'));var logger=require('../../config/logger')(_0x4bdd('0x11'));var utils=require('../../config/utils');var config=require(_0x4bdd('0x12'));var licenseUtil=require(_0x4bdd('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53b9ea,_0x54c166){_0x54c166=_0x54c166||0xcc;return function(_0x186643){if(_0x186643){return _0x53b9ea[_0x4bdd('0x14')](_0x54c166);}return _0x53b9ea[_0x4bdd('0x15')](_0x54c166)[_0x4bdd('0x16')]();};}function respondWithResult(_0x474b45,_0x444ed6){_0x444ed6=_0x444ed6||0xc8;return function(_0xa6c48c){if(_0xa6c48c){return _0x474b45['status'](_0x444ed6)['json'](_0xa6c48c);}};}function respondWithFilteredResult(_0x870db1,_0x3587ee){return function(_0x1c17fa){if(_0x1c17fa){var _0x1d6af4=typeof _0x3587ee['offset']===_0x4bdd('0x17')&&typeof _0x3587ee[_0x4bdd('0x18')]===_0x4bdd('0x17');var _0x22f90d=_0x1c17fa[_0x4bdd('0x19')];var _0x198ffd=_0x1d6af4?0x0:_0x3587ee[_0x4bdd('0x1a')];var _0x46bb96=_0x1d6af4?_0x1c17fa[_0x4bdd('0x19')]:_0x3587ee['offset']+_0x3587ee[_0x4bdd('0x18')];var _0x4da85e;if(_0x46bb96>=_0x22f90d){_0x46bb96=_0x22f90d;_0x4da85e=0xc8;}else{_0x4da85e=0xce;}_0x870db1[_0x4bdd('0x15')](_0x4da85e);return _0x870db1[_0x4bdd('0x1b')](_0x4bdd('0x1c'),_0x198ffd+'-'+_0x46bb96+'/'+_0x22f90d)[_0x4bdd('0x1d')](_0x1c17fa);}return null;};}function patchUpdates(_0x3a842c){return function(_0x4330cb){try{jsonpatch[_0x4bdd('0x1e')](_0x4330cb,_0x3a842c,!![]);}catch(_0x523de){return BPromise['reject'](_0x523de);}return _0x4330cb[_0x4bdd('0x1f')]();};}function saveUpdates(_0x1952cf,_0x2ac0d2){return function(_0x10947b){if(_0x10947b){return _0x10947b[_0x4bdd('0x20')](_0x1952cf)[_0x4bdd('0x21')](function(_0x2f9f53){return _0x2f9f53;});}return null;};}function removeEntity(_0x489a20,_0x14fc3c){return function(_0xec16c1){if(_0xec16c1){return _0xec16c1[_0x4bdd('0x22')]()['then'](function(){_0x489a20[_0x4bdd('0x15')](0xcc)[_0x4bdd('0x16')]();});}};}function handleEntityNotFound(_0x4e7b92,_0x543217){return function(_0x5527bf){if(!_0x5527bf){_0x4e7b92[_0x4bdd('0x14')](0x194);}return _0x5527bf;};}function handleError(_0x26f4aa,_0x3f6782){_0x3f6782=_0x3f6782||0x1f4;return function(_0x34a576){logger[_0x4bdd('0x23')](_0x34a576[_0x4bdd('0x24')]);if(_0x34a576[_0x4bdd('0x25')]){delete _0x34a576[_0x4bdd('0x25')];}_0x26f4aa[_0x4bdd('0x15')](_0x3f6782)[_0x4bdd('0x26')](_0x34a576);};}exports[_0x4bdd('0x27')]=function(_0x5dde50,_0x301225){var _0x5d601b={},_0x452558={},_0x1276ec={'count':0x0,'rows':[]};var _0x4e775d=_['map'](db[_0x4bdd('0x28')][_0x4bdd('0x29')],function(_0x17634c){return{'name':_0x17634c[_0x4bdd('0x2a')],'type':_0x17634c['type'][_0x4bdd('0x2b')]};});_0x452558[_0x4bdd('0x2c')]=_['map'](_0x4e775d,_0x4bdd('0x25'));_0x452558['query']=_[_0x4bdd('0x2d')](_0x5dde50[_0x4bdd('0x2e')]);_0x452558['filters']=_[_0x4bdd('0x2f')](_0x452558[_0x4bdd('0x2c')],_0x452558[_0x4bdd('0x2e')]);_0x5d601b['attributes']=_[_0x4bdd('0x2f')](_0x452558[_0x4bdd('0x2c')],qs[_0x4bdd('0x30')](_0x5dde50['query'][_0x4bdd('0x30')]));_0x5d601b[_0x4bdd('0x31')]=_0x5d601b[_0x4bdd('0x31')]['length']?_0x5d601b[_0x4bdd('0x31')]:_0x452558['model'];if(!_0x5dde50[_0x4bdd('0x2e')][_0x4bdd('0x32')](_0x4bdd('0x33'))){_0x5d601b['limit']=qs[_0x4bdd('0x18')](_0x5dde50[_0x4bdd('0x2e')][_0x4bdd('0x18')]);_0x5d601b[_0x4bdd('0x1a')]=qs[_0x4bdd('0x1a')](_0x5dde50[_0x4bdd('0x2e')][_0x4bdd('0x1a')]);}_0x5d601b[_0x4bdd('0x34')]=qs[_0x4bdd('0x35')](_0x5dde50[_0x4bdd('0x2e')][_0x4bdd('0x35')]);_0x5d601b[_0x4bdd('0x36')]=qs['filters'](_[_0x4bdd('0x37')](_0x5dde50[_0x4bdd('0x2e')],_0x452558[_0x4bdd('0x38')]),_0x4e775d);if(_0x5dde50['query']['filter']){_0x5d601b['where']=_[_0x4bdd('0x39')](_0x5d601b[_0x4bdd('0x36')],{'$or':_[_0x4bdd('0x3a')](_0x4e775d,function(_0x384209){if(_0x384209[_0x4bdd('0x3b')]!==_0x4bdd('0x3c')){var _0x155e49={};_0x155e49[_0x384209[_0x4bdd('0x25')]]={'$like':'%'+_0x5dde50[_0x4bdd('0x2e')][_0x4bdd('0x3d')]+'%'};return _0x155e49;}})});}_0x5d601b=_[_0x4bdd('0x39')]({},_0x5d601b,_0x5dde50['options']);var _0x1c9378={'where':_0x5d601b[_0x4bdd('0x36')]};return db['WhatsappTransferReport'][_0x4bdd('0x19')](_0x1c9378)[_0x4bdd('0x21')](function(_0x312d99){_0x1276ec[_0x4bdd('0x19')]=_0x312d99;if(_0x5dde50[_0x4bdd('0x2e')][_0x4bdd('0x3e')]){_0x5d601b[_0x4bdd('0x3f')]=[{'all':!![]}];}return db[_0x4bdd('0x28')][_0x4bdd('0x40')](_0x5d601b);})[_0x4bdd('0x21')](function(_0xf03c){_0x1276ec[_0x4bdd('0x41')]=_0xf03c;return _0x1276ec;})[_0x4bdd('0x21')](respondWithFilteredResult(_0x301225,_0x5d601b))[_0x4bdd('0x42')](handleError(_0x301225,null));};exports['show']=function(_0x32e8c6,_0x1a2f5b){var _0x43e683={'raw':!![],'where':{'id':_0x32e8c6[_0x4bdd('0x43')]['id']}},_0x24aac9={};_0x24aac9['model']=_[_0x4bdd('0x2d')](db[_0x4bdd('0x28')][_0x4bdd('0x29')]);_0x24aac9[_0x4bdd('0x2e')]=_[_0x4bdd('0x2d')](_0x32e8c6['query']);_0x24aac9['filters']=_[_0x4bdd('0x2f')](_0x24aac9[_0x4bdd('0x2c')],_0x24aac9['query']);_0x43e683[_0x4bdd('0x31')]=_[_0x4bdd('0x2f')](_0x24aac9['model'],qs[_0x4bdd('0x30')](_0x32e8c6[_0x4bdd('0x2e')]['fields']));_0x43e683[_0x4bdd('0x31')]=_0x43e683['attributes']['length']?_0x43e683['attributes']:_0x24aac9[_0x4bdd('0x2c')];if(_0x32e8c6[_0x4bdd('0x2e')]['includeAll']){_0x43e683[_0x4bdd('0x3f')]=[{'all':!![]}];}_0x43e683=_[_0x4bdd('0x39')]({},_0x43e683,_0x32e8c6[_0x4bdd('0x44')]);return db['WhatsappTransferReport'][_0x4bdd('0x45')](_0x43e683)['then'](handleEntityNotFound(_0x1a2f5b,null))[_0x4bdd('0x21')](respondWithResult(_0x1a2f5b,null))[_0x4bdd('0x42')](handleError(_0x1a2f5b,null));};exports['create']=function(_0x34ea8d,_0x102a40){return db['WhatsappTransferReport'][_0x4bdd('0x46')](_0x34ea8d[_0x4bdd('0x47')],{})[_0x4bdd('0x21')](respondWithResult(_0x102a40,0xc9))[_0x4bdd('0x42')](handleError(_0x102a40,null));};exports[_0x4bdd('0x20')]=function(_0x4bb079,_0x34330e){if(_0x4bb079[_0x4bdd('0x47')]['id']){delete _0x4bb079[_0x4bdd('0x47')]['id'];}return db[_0x4bdd('0x28')][_0x4bdd('0x45')]({'where':{'id':_0x4bb079['params']['id']}})[_0x4bdd('0x21')](handleEntityNotFound(_0x34330e,null))[_0x4bdd('0x21')](saveUpdates(_0x4bb079[_0x4bdd('0x47')],null))[_0x4bdd('0x21')](respondWithResult(_0x34330e,null))[_0x4bdd('0x42')](handleError(_0x34330e,null));};exports[_0x4bdd('0x22')]=function(_0x432e47,_0x6b7313){return db['WhatsappTransferReport']['find']({'where':{'id':_0x432e47['params']['id']}})['then'](handleEntityNotFound(_0x6b7313,null))[_0x4bdd('0x21')](removeEntity(_0x6b7313,null))[_0x4bdd('0x42')](handleError(_0x6b7313,null));};exports['describe']=function(_0x2400a6,_0x4691da){return db['WhatsappTransferReport'][_0x4bdd('0x48')]()['then'](respondWithResult(_0x4691da,null))['catch'](handleError(_0x4691da,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a4f1175..f4ad601 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 _0x521a=['path','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x273f88,_0x5d4150){var _0x177ca1=function(_0xf46ec4){while(--_0xf46ec4){_0x273f88['push'](_0x273f88['shift']());}};_0x177ca1(++_0x5d4150);}(_0x521a,0xa1));var _0xa521=function(_0x1996b1,_0x2818d0){_0x1996b1=_0x1996b1-0x0;var _0x5c6fcf=_0x521a[_0x1996b1];return _0x5c6fcf;};'use strict';var _=require(_0xa521('0x0'));var util=require(_0xa521('0x1'));var logger=require(_0xa521('0x2'))(_0xa521('0x3'));var moment=require(_0xa521('0x4'));var BPromise=require(_0xa521('0x5'));var rp=require(_0xa521('0x6'));var fs=require('fs');var path=require(_0xa521('0x7'));var rimraf=require(_0xa521('0x8'));var config=require('../../config/environment');var attributes=require(_0xa521('0x9'));module['exports']=function(_0x3fb791,_0x1edbbe){return _0x3fb791[_0xa521('0xa')](_0xa521('0xb'),attributes,{'tableName':_0xa521('0xc'),'paranoid':![],'indexes':[{'name':_0xa521('0xd'),'fields':[_0xa521('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5537=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','report_whatsapp_transfer','uniqueid'];(function(_0x50e26a,_0x51e93d){var _0x57b84f=function(_0x5bbea1){while(--_0x5bbea1){_0x50e26a['push'](_0x50e26a['shift']());}};_0x57b84f(++_0x51e93d);}(_0x5537,0x176));var _0x7553=function(_0x31d4f1,_0x3b6f3c){_0x31d4f1=_0x31d4f1-0x0;var _0x15a3fc=_0x5537[_0x31d4f1];return _0x15a3fc;};'use strict';var _=require('lodash');var util=require(_0x7553('0x0'));var logger=require('../../config/logger')(_0x7553('0x1'));var moment=require(_0x7553('0x2'));var BPromise=require(_0x7553('0x3'));var rp=require(_0x7553('0x4'));var fs=require('fs');var path=require(_0x7553('0x5'));var rimraf=require(_0x7553('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x7553('0x7')]=function(_0x29283b,_0xf41882){return _0x29283b[_0x7553('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0x7553('0x9'),'paranoid':![],'indexes':[{'name':_0x7553('0xa'),'fields':[_0x7553('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 234ba1f..5da2f4b 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 _0xdd89=['message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xdd89,0x13f));var _0x9dd8=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xdd89[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var moment=require(_0x9dd8('0x2'));var BPromise=require(_0x9dd8('0x3'));var rs=require(_0x9dd8('0x4'));var fs=require('fs');var Redis=require(_0x9dd8('0x5'));var db=require(_0x9dd8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9dd8('0x7'))(_0x9dd8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9dd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x130561,_0x23ef2f,_0x54e91b){return new BPromise(function(_0xf07a57,_0x1405ff){return client['request'](_0x130561,_0x54e91b)[_0x9dd8('0xa')](function(_0x930baa){logger['info'](_0x9dd8('0xb'),_0x23ef2f,'request\x20sent');logger[_0x9dd8('0xc')](_0x9dd8('0xd'),_0x23ef2f,'request\x20sent',JSON[_0x9dd8('0xe')](_0x930baa));if(_0x930baa[_0x9dd8('0xf')]){if(_0x930baa[_0x9dd8('0xf')][_0x9dd8('0x10')]===0x1f4){logger[_0x9dd8('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x23ef2f,_0x930baa['error']['message']);return _0x1405ff(_0x930baa[_0x9dd8('0xf')]['message']);}logger['error'](_0x9dd8('0xb'),_0x23ef2f,_0x930baa[_0x9dd8('0xf')][_0x9dd8('0x11')]);return _0xf07a57(_0x930baa[_0x9dd8('0xf')][_0x9dd8('0x11')]);}else{logger[_0x9dd8('0x12')](_0x9dd8('0xb'),_0x23ef2f,_0x9dd8('0x13'));_0xf07a57(_0x930baa[_0x9dd8('0x14')][_0x9dd8('0x11')]);}})['catch'](function(_0x3961ca){logger['error'](_0x9dd8('0xb'),_0x23ef2f,_0x3961ca);_0x1405ff(_0x3961ca);});});} \ No newline at end of file +var _0x7e07=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4b8a77,_0x405ab3){var _0x3a3991=function(_0x514ecd){while(--_0x514ecd){_0x4b8a77['push'](_0x4b8a77['shift']());}};_0x3a3991(++_0x405ab3);}(_0x7e07,0x15d));var _0x77e0=function(_0x1289dd,_0x50b9fe){_0x1289dd=_0x1289dd-0x0;var _0x2fd69d=_0x7e07[_0x1289dd];return _0x2fd69d;};'use strict';var _=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var moment=require(_0x77e0('0x2'));var BPromise=require(_0x77e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77e0('0x4'));var db=require(_0x77e0('0x5'))['db'];var utils=require(_0x77e0('0x6'));var logger=require('../../config/logger')(_0x77e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x77e0('0x8'));var client=jayson[_0x77e0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a361,_0x326ef6,_0x4a79fd){return new BPromise(function(_0x3605a4,_0xf5baec){return client[_0x77e0('0xa')](_0x22a361,_0x4a79fd)[_0x77e0('0xb')](function(_0x32e76d){logger[_0x77e0('0xc')](_0x77e0('0xd'),_0x326ef6,_0x77e0('0xe'));logger[_0x77e0('0xf')](_0x77e0('0x10'),_0x326ef6,'request\x20sent',JSON[_0x77e0('0x11')](_0x32e76d));if(_0x32e76d[_0x77e0('0x12')]){if(_0x32e76d['error'][_0x77e0('0x13')]===0x1f4){logger['error'](_0x77e0('0xd'),_0x326ef6,_0x32e76d['error'][_0x77e0('0x14')]);return _0xf5baec(_0x32e76d[_0x77e0('0x12')]['message']);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x326ef6,_0x32e76d[_0x77e0('0x12')][_0x77e0('0x14')]);return _0x3605a4(_0x32e76d['error'][_0x77e0('0x14')]);}else{logger[_0x77e0('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x326ef6,_0x77e0('0xe'));_0x3605a4(_0x32e76d[_0x77e0('0x15')][_0x77e0('0x14')]);}})[_0x77e0('0x16')](function(_0x2670bb){logger['error'](_0x77e0('0xd'),_0x326ef6,_0x2670bb);_0xf5baec(_0x2670bb);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e85a5c0..cc93b19 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa04=['listen','info','start','Online\x20apps:','map','name','join','Offline\x20apps:','filter','status','online','None','seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sync','then'];(function(_0x5ed3fb,_0xfee138){var _0x363e99=function(_0x4be072){while(--_0x4be072){_0x5ed3fb['push'](_0x5ed3fb['shift']());}};_0x363e99(++_0xfee138);}(_0xaa04,0x1d5));var _0x4aa0=function(_0x4617a3,_0x356f33){_0x4617a3=_0x4617a3-0x0;var _0x42b49c=_0xaa04[_0x4617a3];return _0x42b49c;};'use strict';var _=require(_0x4aa0('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x4aa0('0x1'));var config=require(_0x4aa0('0x2'));var logger=require(_0x4aa0('0x3'))('app');var pm2=require(_0x4aa0('0x4'));var pm2Config=require(_0x4aa0('0x5'));var schedule=require(_0x4aa0('0x6'));var chat=require(_0x4aa0('0x7'));var whatsapp=require(_0x4aa0('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x4aa0('0x9')]()[_0x4aa0('0xa')](function(){return rpc[_0x4aa0('0xb')]();})['then'](function(_0x5b2d99){logger[_0x4aa0('0xc')](_0x5b2d99);return chat[_0x4aa0('0xd')]();})[_0x4aa0('0xa')](function(){return whatsapp['start']();})[_0x4aa0('0xa')](function(){return schedule[_0x4aa0('0xd')]();})[_0x4aa0('0xa')](function(){return transcribe[_0x4aa0('0xd')]();})['then'](function(_0x5ce9a6){logger['info'](_0x5ce9a6);return pm2['start'](pm2Config);})[_0x4aa0('0xa')](function(_0x415e43){logger[_0x4aa0('0xc')](_0x4aa0('0xe'),_[_0x4aa0('0xf')](_['filter'](_0x415e43,{'status':'online'}),_0x4aa0('0x10'))[_0x4aa0('0x11')]());logger['info'](_0x4aa0('0x12'),_[_0x4aa0('0xf')](_[_0x4aa0('0x13')](_0x415e43,function(_0x2528de){return _0x2528de[_0x4aa0('0x14')]!==_0x4aa0('0x15');}),_0x4aa0('0x10'))['join']()||_0x4aa0('0x16'));config[_0x4aa0('0x17')]&&require(_0x4aa0('0x18'))[_0x4aa0('0x19')]();require(_0x4aa0('0x1a'))[_0x4aa0('0x19')]();})[_0x4aa0('0x1b')](function(_0xb729f5){logger['error'](_0x4aa0('0x1c'),_0xb729f5);process[_0x4aa0('0x1d')](0x1);});}main(); \ No newline at end of file +var _0xb991=['./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','join','Offline\x20apps:','status','online','name','None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp'];(function(_0x40e5ed,_0x4e4c53){var _0x1b6910=function(_0x1bb19b){while(--_0x1bb19b){_0x40e5ed['push'](_0x40e5ed['shift']());}};_0x1b6910(++_0x4e4c53);}(_0xb991,0x1e6));var _0x1b99=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb991[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x1b99('0x0'));var mysqldb=require(_0x1b99('0x1'));var rpc=require(_0x1b99('0x2'));var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0x1b99('0x3'));var pm2Config=require(_0x1b99('0x4'));var schedule=require(_0x1b99('0x5'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x1b99('0x6'));var transcribe=require(_0x1b99('0x7'));function main(){return mysqldb['db'][_0x1b99('0x8')][_0x1b99('0x9')]()[_0x1b99('0xa')](function(){return rpc[_0x1b99('0xb')]();})['then'](function(_0x4252e8){logger[_0x1b99('0xc')](_0x4252e8);return chat['start']();})[_0x1b99('0xa')](function(){return whatsapp['start']();})[_0x1b99('0xa')](function(){return schedule[_0x1b99('0xd')]();})[_0x1b99('0xa')](function(){return transcribe[_0x1b99('0xd')]();})['then'](function(_0x31bcfe){logger[_0x1b99('0xc')](_0x31bcfe);return pm2[_0x1b99('0xd')](pm2Config);})[_0x1b99('0xa')](function(_0x4c6a90){logger[_0x1b99('0xc')](_0x1b99('0xe'),_[_0x1b99('0xf')](_['filter'](_0x4c6a90,{'status':'online'}),'name')[_0x1b99('0x10')]());logger['info'](_0x1b99('0x11'),_['map'](_['filter'](_0x4c6a90,function(_0x122bc3){return _0x122bc3[_0x1b99('0x12')]!==_0x1b99('0x13');}),_0x1b99('0x14'))[_0x1b99('0x10')]()||_0x1b99('0x15'));config[_0x1b99('0x16')]&&require(_0x1b99('0x17'))[_0x1b99('0x18')]();require('./config/license')[_0x1b99('0x18')]();})[_0x1b99('0x19')](function(_0x55cb60){logger[_0x1b99('0x1a')](_0x1b99('0x1b'),_0x55cb60);process[_0x1b99('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index aa3531a..b438ff1 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 _0x349a=['hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','json','unmanaged','Unmanaged.','catch','headers','authorization','startsWith','Basic','name','then','authenticate','pass','Wrong\x20credentials.','Bearer','status','Unknown\x20authorization\x20format','apikey','getUuid','query','User','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','find','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','session','payload','options','verify','randomBytes','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','secrets','role','fullname','internal','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort'];(function(_0x24b2f9,_0x3f5892){var _0x5c3a95=function(_0x41933b){while(--_0x41933b){_0x24b2f9['push'](_0x24b2f9['shift']());}};_0x5c3a95(++_0x3f5892);}(_0x349a,0xdb));var _0xa349=function(_0x2ce6c4,_0x1493e0){_0x2ce6c4=_0x2ce6c4-0x0;var _0x3fa5ef=_0x349a[_0x2ce6c4];return _0x3fa5ef;};'use strict';var db=require(_0xa349('0x0'))['db'];var config=require(_0xa349('0x1'));var hardwareConf=require(_0xa349('0x2'));var licenseUtil=require(_0xa349('0x3'));var encryptor=require(_0xa349('0x4'));var _=require(_0xa349('0x5'));var jwt=require(_0xa349('0x6'));var expressJwt=require(_0xa349('0x7'));var compose=require(_0xa349('0x8'));var basicAuth=require(_0xa349('0x9'));var crypto=require('crypto');var BPromise=require(_0xa349('0xa'));var util=require(_0xa349('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xa349('0xc')]['session']});var userAttributes=['id',_0xa349('0xd'),_0xa349('0xe'),'name',_0xa349('0xf'),'email',_0xa349('0x10'),_0xa349('0x11'),_0xa349('0x12'),_0xa349('0x13'),_0xa349('0x14'),'mailPause',_0xa349('0x15'),_0xa349('0x16'),_0xa349('0x17'),_0xa349('0x18'),'showWebBar',_0xa349('0x19'),'lastPauseAt',_0xa349('0x1a'),_0xa349('0x1b'),'passwordResetAt',_0xa349('0x1c'),_0xa349('0x1d'),_0xa349('0x1e'),_0xa349('0x1f'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xa349('0x20'),'phoneBarExpires',_0xa349('0x21'),'phoneBarRemoteControl',_0xa349('0x22'),_0xa349('0x23'),_0xa349('0x24'),_0xa349('0x25'),_0xa349('0x26'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xa349('0x27')];exports[_0xa349('0x28')]=function(){return this[_0xa349('0x29')](!![])[_0xa349('0x2a')](function(_0x3f57fb,_0x4b334b,_0xb8ac2){if(_0x3f57fb[_0xa349('0x2b')]){_0xb8ac2();}else{return db[_0xa349('0x2c')]['findOne']({'where':{'id':_0x3f57fb[_0xa349('0x2d')]['id']},'attributes':['id',_0xa349('0x2e'),_0xa349('0x2f')],'raw':!![]})['then'](function(_0x5f048c){if(_0x5f048c&&_0x5f048c[_0xa349('0x2e')]){return _0x4b334b['status'](_0x5f048c['disposition']==='unmanaged'?0x195:0x193)[_0xa349('0x30')]({'message':_0x5f048c[_0xa349('0x2f')]===_0xa349('0x31')?_0xa349('0x32'):'Forbidden.'});}else{_0xb8ac2();}})[_0xa349('0x33')](function(_0x2d3357){_0xb8ac2(_0x2d3357);});}});};exports[_0xa349('0x29')]=function isAuthenticated(_0x363584){return compose()['use'](function(_0x4f1070,_0x248874,_0x45fdab){var _0x51db04;if(_0x4f1070[_0xa349('0x34')][_0xa349('0x35')]){if(_[_0xa349('0x36')](_0x4f1070[_0xa349('0x34')][_0xa349('0x35')],_0xa349('0x37'))){var _0x43b405=basicAuth(_0x4f1070);db['User']['find']({'where':{'name':_0x43b405[_0xa349('0x38')]}})[_0xa349('0x39')](function(_0x10b3ab){if(!_0x10b3ab||!_0x10b3ab[_0xa349('0x3a')](_0x43b405[_0xa349('0x3b')])){return _0x248874['status'](0x191)[_0xa349('0x30')]({'message':_0xa349('0x3c')});}_0x4f1070[_0xa349('0x2b')]={'id':_0x10b3ab['id']};_0x45fdab();})[_0xa349('0x33')](function(_0x46244a){_0x45fdab(_0x46244a);});}else if(_[_0xa349('0x36')](_0x4f1070['headers'][_0xa349('0x35')],_0xa349('0x3d'))){validateJwt(_0x4f1070,_0x248874,_0x45fdab);}else{if(_0x363584){_0x45fdab();}else{return _0x248874[_0xa349('0x3e')](0x193)[_0xa349('0x30')]({'message':_0xa349('0x3f')});}}}else if(_0x4f1070['query'][_0xa349('0x40')]){try{var _0x45755f={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa349('0x41')]()};verifyJwt(_0x4f1070[_0xa349('0x42')][_0xa349('0x40')],_0x45755f)['then'](function(_0x202d9e){return db[_0xa349('0x43')]['find']({'where':{'id':_0x202d9e[_0xa349('0x44')]}})[_0xa349('0x39')](function(_0x4f946c){_0x51db04=_0x4f946c;return db[_0xa349('0x45')][_0xa349('0x46')]({'where':{'id':0x1},'attributes':[_0xa349('0x47'),_0xa349('0x48')],'raw':!![]});})[_0xa349('0x39')](function(_0x3dc7c7){if(!_0x51db04||!_[_0xa349('0x49')](_0x51db04[_0xa349('0x4a')],_0x202d9e['nonce'])){return _0x248874[_0xa349('0x3e')](0x191)[_0xa349('0x30')]({'message':_0xa349('0x4b')});}if(_0x51db04[_0xa349('0x4c')]){return _0x248874[_0xa349('0x3e')](0x191)[_0xa349('0x30')]({'message':_0xa349('0x4d')});}if(_0x51db04['blocked']){if(_0x3dc7c7[_0xa349('0x48')]>0x0){if(moment(_0x51db04[_0xa349('0x4e')])[_0xa349('0x4f')](_0x3dc7c7[_0xa349('0x48')],_0xa349('0x50'))>moment()){return _0x248874[_0xa349('0x3e')](0x191)[_0xa349('0x30')]({'message':_0xa349('0x4d')});}}else{return _0x248874[_0xa349('0x3e')](0x191)[_0xa349('0x30')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4f1070[_0xa349('0x2b')]={'id':_0x51db04['id']};_0x45fdab();});})[_0xa349('0x33')](function(){return _0x248874[_0xa349('0x3e')](0x191)[_0xa349('0x30')]({'message':_0xa349('0x4d')});});}catch(_0x111186){_0x45fdab(_0x111186);}}else if(_0x363584){_0x45fdab();}else{return _0x248874['status'](0x193)[_0xa349('0x30')]({'message':'Unknown\x20authorization\x20format'});}})[_0xa349('0x2a')](function(_0x2539ef,_0x20d361,_0x398184){if(_0x2539ef[_0xa349('0x2b')]){db['User'][_0xa349('0x51')]({'where':{'id':_0x2539ef[_0xa349('0x2b')]['id']},'attributes':userAttributes})[_0xa349('0x39')](function(_0x4d39ec){if(!_0x4d39ec){return _0x20d361[_0xa349('0x3e')](0x194)['json']({'message':_0xa349('0x52')});}_0x2539ef[_0xa349('0x2b')]=_0x4d39ec;_0x398184();})[_0xa349('0x33')](function(_0x3bf8c6){_0x398184(_0x3bf8c6);});}else if(_0x363584){_0x398184();}else{return _0x20d361[_0xa349('0x3e')](0x194)[_0xa349('0x30')]({'message':_0xa349('0x53')});}});};exports[_0xa349('0x54')]=function canUpdate(){return compose()[_0xa349('0x2a')](function(_0x2af9a9,_0x543023,_0x30fceb){return licenseUtil[_0xa349('0x55')]()[_0xa349('0x39')](function(_0x86cc8){if(_0x86cc8[_0xa349('0x56')]){_0x30fceb();}else{return _0x543023[_0xa349('0x3e')](0x193)[_0xa349('0x30')]({'message':_0xa349('0x57')});}})['catch'](function(_0x44403f){_0x30fceb(_0x44403f);});});};exports[_0xa349('0x58')]=function(_0x402691,_0x2bb3d3,_0x466739){_0x402691['isMiddleware']=!![];return _0x466739();};exports[_0xa349('0x59')]=function signToken(_0x48899d){return signJwt(_0x48899d);};exports[_0xa349('0x5a')]=function(_0x336e79,_0x12d061){if(!_0x336e79[_0xa349('0x2b')]){return _0x12d061['status'](0x194)['json']({'message':_0xa349('0x5b')});}var _0x58c4f1={'payload':{'id':_0x336e79[_0xa349('0x2b')]['id'],'role':_0x336e79['user'][_0xa349('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x58c4f1)[_0xa349('0x39')](function(_0x3bcc13){_0x12d061[_0xa349('0x5c')]('motion.token',_0x3bcc13);_0x12d061[_0xa349('0x5d')]('/dashboards/general');})[_0xa349('0x33')](function(_0x2dab5b){return _0x12d061[_0xa349('0x3e')](0x1f4)['send'](_0x2dab5b);});};exports[_0xa349('0x5e')]=function(_0x2f7235){if(_[_0xa349('0x5f')](_0x2f7235[_0xa349('0x4a')])||_[_0xa349('0x5f')](_0x2f7235[_0xa349('0x60')])){return null;}else{return createJwt(_0x2f7235);}};exports[_0xa349('0x61')]=function(_0x2fb9eb){_0x2fb9eb['apiKeyNonce']=generateNonce();_0x2fb9eb[_0xa349('0x60')]=generateIssuedAt();return createJwt(_0x2fb9eb);};exports['regenerateApiKey']=function(_0x565ca0,_0x47d18b){var _0x1db12a=_0x565ca0[_0xa349('0x42')][_0xa349('0x40')];if(_0x1db12a){var _0x113b1a={'nonce':_0x47d18b[_0xa349('0x4a')],'iat':_0x47d18b[_0xa349('0x60')],'audience':hardwareConf[_0xa349('0x41')](),'issuer':hardwareConf[_0xa349('0x41')]()};return verifyJwt(_0x1db12a,_0x113b1a)[_0xa349('0x39')](function(){return generateApiKey(_0x47d18b);});}else{throw{'message':_0xa349('0x62')};}};exports[_0xa349('0x63')]=function(_0x2f3393){var _0x2aa9d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2aa9d5[_0xa349('0x64')](_0x2f3393))throw new db['Sequelize'][(_0xa349('0x65'))](_0xa349('0x66'));return;};exports[_0xa349('0x67')]=function(_0x2ad367,_0x111744,_0x1e03c0){var _0x1d9cef=encryptor[_0xa349('0x68')](_0x111744)[_0xa349('0x69')](',');for(var _0x55cc54=0x0;_0x55cc54<_0x1e03c0;_0x55cc54++){if(!_0x1d9cef[_0x55cc54])break;if(_0x2ad367['toLowerCase']()===_0x1d9cef[_0x55cc54][_0xa349('0x6a')]()){var _0x550f8c=util[_0xa349('0x6b')](_0xa349('0x6c'),_0x1e03c0);if(_0x1e03c0===0x1){_0x550f8c=_0xa349('0x6d');}throw new db['Sequelize'][(_0xa349('0x65'))](_0x550f8c);}}return;};exports[_0xa349('0x6e')]=function(_0x1b443e,_0x634fc){var _0x1298d2=_0x634fc?encryptor[_0xa349('0x68')](_0x634fc)[_0xa349('0x69')](','):[];if(_0x1298d2[_0xa349('0x6f')]===0x5){_0x1298d2['splice'](-0x1,0x1);}_0x1298d2[_0xa349('0x70')](_0x1b443e);return encryptor[_0xa349('0x71')](_0x1298d2[_0xa349('0x72')](','));};function signJwt(_0x425ecb){var _0x3e0d92=BPromise[_0xa349('0x73')](jwt[_0xa349('0x74')],{'context':jwt});var _0x518c54=_0x425ecb[_0xa349('0x75')]||config[_0xa349('0xc')][_0xa349('0x76')];return new BPromise(function(_0x496e29,_0x2eec85){_0x3e0d92(_0x425ecb[_0xa349('0x77')],_0x518c54,_0x425ecb[_0xa349('0x78')])[_0xa349('0x39')](function(_0x281f2a){_0x496e29(_0x281f2a);})[_0xa349('0x33')](function(_0x25f987){_0x2eec85(_0x25f987);});});}function verifyJwt(_0x36d855,_0x53bce8,_0x270b82){var _0x714b57=BPromise['promisify'](jwt[_0xa349('0x79')],{'context':jwt});var _0x205b71=_0x270b82||config[_0xa349('0xc')][_0xa349('0x76')];return new BPromise(function(_0x2e7f81,_0xfeb819){_0x714b57(_0x36d855,_0x205b71,_0x53bce8)[_0xa349('0x39')](function(_0x5cbc92){_0x2e7f81(_0x5cbc92);})[_0xa349('0x33')](function(_0x237d3c){_0xfeb819(_0x237d3c);});});}function generateNonce(){return crypto[_0xa349('0x7a')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xa349('0x7b')](Date[_0xa349('0x7c')]()/0x3e8)[_0xa349('0x7d')]();}function createJwt(_0x353209){var _0x22fab9={'payload':{'iat':_0x353209['apiKeyIat'],'nonce':_0x353209['apiKeyNonce']},'options':{'algorithm':_0xa349('0x7e'),'subject':_0x353209['id'][_0xa349('0x7d')](),'issuer':hardwareConf[_0xa349('0x41')](),'audience':hardwareConf[_0xa349('0x41')]()}};return signJwt(_0x22fab9)[_0xa349('0x39')](function(_0x3307f6){return{'iat':_0x353209[_0xa349('0x60')],'nonce':_0x353209[_0xa349('0x4a')],'token':_0x3307f6};});} \ No newline at end of file +var _0x133b=['find','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','promisify','sign','payload','options','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User'];(function(_0x483889,_0x4c80ad){var _0x477f7a=function(_0x574867){while(--_0x574867){_0x483889['push'](_0x483889['shift']());}};_0x477f7a(++_0x4c80ad);}(_0x133b,0x12f));var _0xb133=function(_0x398655,_0x59c439){_0x398655=_0x398655-0x0;var _0x5a6b13=_0x133b[_0x398655];return _0x5a6b13;};'use strict';var db=require(_0xb133('0x0'))['db'];var config=require(_0xb133('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xb133('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0xb133('0x3'));var expressJwt=require(_0xb133('0x4'));var compose=require(_0xb133('0x5'));var basicAuth=require(_0xb133('0x6'));var crypto=require(_0xb133('0x7'));var BPromise=require('bluebird');var util=require(_0xb133('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb133('0x9')][_0xb133('0xa')]});var userAttributes=['id',_0xb133('0xb'),_0xb133('0xc'),_0xb133('0xd'),_0xb133('0xe'),_0xb133('0xf'),_0xb133('0x10'),_0xb133('0x11'),'md5secret',_0xb133('0x12'),_0xb133('0x13'),'mailPause','faxPause','smsPause','openchannelPause',_0xb133('0x14'),_0xb133('0x15'),_0xb133('0x16'),_0xb133('0x17'),_0xb133('0x18'),_0xb133('0x19'),'passwordResetAt',_0xb133('0x1a'),_0xb133('0x1b'),_0xb133('0x1c'),_0xb133('0x1d'),_0xb133('0x1e'),_0xb133('0x1f'),_0xb133('0x20'),_0xb133('0x21'),_0xb133('0x22'),_0xb133('0x23'),'phoneBarRemoteControlPort',_0xb133('0x24'),_0xb133('0x25'),_0xb133('0x26'),_0xb133('0x27'),_0xb133('0x28'),_0xb133('0x29'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0xb133('0x2a')];exports[_0xb133('0x2b')]=function(){return this[_0xb133('0x2c')](!![])[_0xb133('0x2d')](function(_0x3f46da,_0x519e6e,_0x2f04e5){if(_0x3f46da[_0xb133('0x2e')]){_0x2f04e5();}else{return db[_0xb133('0x2f')][_0xb133('0x30')]({'where':{'id':_0x3f46da[_0xb133('0x31')]['id']},'attributes':['id',_0xb133('0x32'),_0xb133('0x33')],'raw':!![]})[_0xb133('0x34')](function(_0x2b6083){if(_0x2b6083&&_0x2b6083['closed']){return _0x519e6e[_0xb133('0x35')](_0x2b6083['disposition']===_0xb133('0x36')?0x195:0x193)['json']({'message':_0x2b6083[_0xb133('0x33')]==='unmanaged'?_0xb133('0x37'):_0xb133('0x38')});}else{_0x2f04e5();}})[_0xb133('0x39')](function(_0x59b52e){_0x2f04e5(_0x59b52e);});}});};exports[_0xb133('0x2c')]=function isAuthenticated(_0x295ef9){return compose()[_0xb133('0x2d')](function(_0x219d98,_0xf227c1,_0x583074){var _0x373f97;if(_0x219d98['headers'][_0xb133('0x3a')]){if(_[_0xb133('0x3b')](_0x219d98[_0xb133('0x3c')][_0xb133('0x3a')],_0xb133('0x3d'))){var _0x153669=basicAuth(_0x219d98);db[_0xb133('0x3e')][_0xb133('0x3f')]({'where':{'name':_0x153669[_0xb133('0xd')]}})[_0xb133('0x34')](function(_0x104193){if(!_0x104193||!_0x104193['authenticate'](_0x153669[_0xb133('0x40')])){return _0xf227c1[_0xb133('0x35')](0x191)[_0xb133('0x41')]({'message':_0xb133('0x42')});}_0x219d98['user']={'id':_0x104193['id']};_0x583074();})[_0xb133('0x39')](function(_0x573793){_0x583074(_0x573793);});}else if(_[_0xb133('0x3b')](_0x219d98[_0xb133('0x3c')][_0xb133('0x3a')],'Bearer')){validateJwt(_0x219d98,_0xf227c1,_0x583074);}else{if(_0x295ef9){_0x583074();}else{return _0xf227c1['status'](0x193)[_0xb133('0x41')]({'message':_0xb133('0x43')});}}}else if(_0x219d98[_0xb133('0x44')]['apikey']){try{var _0x564f7b={'audience':hardwareConf[_0xb133('0x45')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x219d98[_0xb133('0x44')][_0xb133('0x46')],_0x564f7b)[_0xb133('0x34')](function(_0x185d55){return db[_0xb133('0x3e')][_0xb133('0x3f')]({'where':{'id':_0x185d55['sub']}})[_0xb133('0x34')](function(_0x16e416){_0x373f97=_0x16e416;return db[_0xb133('0x47')][_0xb133('0x30')]({'where':{'id':0x1},'attributes':[_0xb133('0x48'),_0xb133('0x49')],'raw':!![]});})['then'](function(_0x287073){if(!_0x373f97||!_[_0xb133('0x4a')](_0x373f97[_0xb133('0x4b')],_0x185d55[_0xb133('0x4c')])){return _0xf227c1['status'](0x191)[_0xb133('0x41')]({'message':_0xb133('0x4d')});}if(_0x373f97['disabled']){return _0xf227c1[_0xb133('0x35')](0x191)['json']({'message':_0xb133('0x4e')});}if(_0x373f97['blocked']){if(_0x287073[_0xb133('0x49')]>0x0){if(moment(_0x373f97['blockedAt'])[_0xb133('0x4f')](_0x287073[_0xb133('0x49')],'minutes')>moment()){return _0xf227c1[_0xb133('0x35')](0x191)[_0xb133('0x41')]({'message':_0xb133('0x4e')});}}else{return _0xf227c1[_0xb133('0x35')](0x191)[_0xb133('0x41')]({'message':_0xb133('0x4e')});}}_0x219d98[_0xb133('0x2e')]={'id':_0x373f97['id']};_0x583074();});})[_0xb133('0x39')](function(){return _0xf227c1[_0xb133('0x35')](0x191)[_0xb133('0x41')]({'message':_0xb133('0x4e')});});}catch(_0x5c1dda){_0x583074(_0x5c1dda);}}else if(_0x295ef9){_0x583074();}else{return _0xf227c1[_0xb133('0x35')](0x193)[_0xb133('0x41')]({'message':_0xb133('0x43')});}})[_0xb133('0x2d')](function(_0x1b0e0b,_0x26caae,_0x1d3abc){if(_0x1b0e0b[_0xb133('0x2e')]){db[_0xb133('0x3e')]['find']({'where':{'id':_0x1b0e0b[_0xb133('0x2e')]['id']},'attributes':userAttributes})['then'](function(_0x5716ec){if(!_0x5716ec){return _0x26caae['status'](0x194)[_0xb133('0x41')]({'message':_0xb133('0x50')});}_0x1b0e0b[_0xb133('0x2e')]=_0x5716ec;_0x1d3abc();})[_0xb133('0x39')](function(_0x5e40f7){_0x1d3abc(_0x5e40f7);});}else if(_0x295ef9){_0x1d3abc();}else{return _0x26caae[_0xb133('0x35')](0x194)[_0xb133('0x41')]({'message':_0xb133('0x51')});}});};exports[_0xb133('0x52')]=function canUpdate(){return compose()[_0xb133('0x2d')](function(_0x2bee75,_0xa2c752,_0x10ec49){return licenseUtil[_0xb133('0x53')]()['then'](function(_0x4dc798){if(_0x4dc798[_0xb133('0x54')]){_0x10ec49();}else{return _0xa2c752[_0xb133('0x35')](0x193)[_0xb133('0x41')]({'message':_0xb133('0x55')});}})[_0xb133('0x39')](function(_0xc89c4f){_0x10ec49(_0xc89c4f);});});};exports[_0xb133('0x56')]=function(_0x7527c6,_0x208e86,_0x3104cb){_0x7527c6['isMiddleware']=!![];return _0x3104cb();};exports['signToken']=function signToken(_0x5a20c7){return signJwt(_0x5a20c7);};exports[_0xb133('0x57')]=function(_0x55c0bf,_0x3c2b19){if(!_0x55c0bf['user']){return _0x3c2b19[_0xb133('0x35')](0x194)[_0xb133('0x41')]({'message':_0xb133('0x58')});}var _0x4dffd0={'payload':{'id':_0x55c0bf[_0xb133('0x2e')]['id'],'role':_0x55c0bf[_0xb133('0x2e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4dffd0)['then'](function(_0x6546fb){_0x3c2b19[_0xb133('0x59')](_0xb133('0x5a'),_0x6546fb);_0x3c2b19[_0xb133('0x5b')](_0xb133('0x5c'));})[_0xb133('0x39')](function(_0x34eb1c){return _0x3c2b19[_0xb133('0x35')](0x1f4)[_0xb133('0x5d')](_0x34eb1c);});};exports[_0xb133('0x5e')]=function(_0x46fb9f){if(_['isNil'](_0x46fb9f['apiKeyNonce'])||_['isNil'](_0x46fb9f[_0xb133('0x5f')])){return null;}else{return createJwt(_0x46fb9f);}};exports[_0xb133('0x60')]=function(_0x273b2c){_0x273b2c[_0xb133('0x4b')]=generateNonce();_0x273b2c[_0xb133('0x5f')]=generateIssuedAt();return createJwt(_0x273b2c);};exports[_0xb133('0x61')]=function(_0x567063,_0x109a03){var _0x316dbb=_0x567063[_0xb133('0x44')][_0xb133('0x46')];if(_0x316dbb){var _0xeafeb0={'nonce':_0x109a03[_0xb133('0x4b')],'iat':_0x109a03[_0xb133('0x5f')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb133('0x45')]()};return verifyJwt(_0x316dbb,_0xeafeb0)[_0xb133('0x34')](function(){return generateApiKey(_0x109a03);});}else{throw{'message':_0xb133('0x62')};}};exports[_0xb133('0x63')]=function(_0x3cd7db){var _0x380cfa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x380cfa['test'](_0x3cd7db))throw new db[(_0xb133('0x64'))][(_0xb133('0x65'))](_0xb133('0x66'));return;};exports['validatePasswordHistory']=function(_0x40522f,_0x18d6aa,_0x16bfd9){var _0x1b6f14=encryptor['decryptString'](_0x18d6aa)[_0xb133('0x67')](',');for(var _0x37467f=0x0;_0x37467f<_0x16bfd9;_0x37467f++){if(!_0x1b6f14[_0x37467f])break;if(_0x40522f[_0xb133('0x68')]()===_0x1b6f14[_0x37467f][_0xb133('0x68')]()){var _0x5caefa=util[_0xb133('0x69')](_0xb133('0x6a'),_0x16bfd9);if(_0x16bfd9===0x1){_0x5caefa='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xb133('0x64'))]['ValidationError'](_0x5caefa);}}return;};exports[_0xb133('0x6b')]=function(_0x21fd14,_0x577feb){var _0x5b9913=_0x577feb?encryptor[_0xb133('0x6c')](_0x577feb)[_0xb133('0x67')](','):[];if(_0x5b9913[_0xb133('0x6d')]===0x5){_0x5b9913[_0xb133('0x6e')](-0x1,0x1);}_0x5b9913[_0xb133('0x6f')](_0x21fd14);return encryptor[_0xb133('0x70')](_0x5b9913['join'](','));};function signJwt(_0x43466d){var _0x3a2ac2=BPromise[_0xb133('0x71')](jwt[_0xb133('0x72')],{'context':jwt});var _0x57b973=_0x43466d['secret']||config[_0xb133('0x9')][_0xb133('0xa')];return new BPromise(function(_0x4817dc,_0x42ea3f){_0x3a2ac2(_0x43466d[_0xb133('0x73')],_0x57b973,_0x43466d[_0xb133('0x74')])[_0xb133('0x34')](function(_0x5c6cdf){_0x4817dc(_0x5c6cdf);})[_0xb133('0x39')](function(_0xdb1cf4){_0x42ea3f(_0xdb1cf4);});});}function verifyJwt(_0x45b7c6,_0x2875c0,_0xcff227){var _0x540323=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x3298d6=_0xcff227||config['secrets'][_0xb133('0xa')];return new BPromise(function(_0x27a1b2,_0x1b07a5){_0x540323(_0x45b7c6,_0x3298d6,_0x2875c0)['then'](function(_0x2ed67d){_0x27a1b2(_0x2ed67d);})[_0xb133('0x39')](function(_0x3cd238){_0x1b07a5(_0x3cd238);});});}function generateNonce(){return crypto[_0xb133('0x75')](0x10)[_0xb133('0x76')](_0xb133('0x77'));}function generateIssuedAt(){return Math['floor'](Date[_0xb133('0x78')]()/0x3e8)[_0xb133('0x76')]();}function createJwt(_0xcbe324){var _0x1ab5dd={'payload':{'iat':_0xcbe324[_0xb133('0x5f')],'nonce':_0xcbe324[_0xb133('0x4b')]},'options':{'algorithm':_0xb133('0x79'),'subject':_0xcbe324['id'][_0xb133('0x76')](),'issuer':hardwareConf[_0xb133('0x45')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1ab5dd)[_0xb133('0x34')](function(_0x3103ef){return{'iat':_0xcbe324['apiKeyIat'],'nonce':_0xcbe324[_0xb133('0x4b')],'token':_0x3103ef};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 348133d..5926a9c 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 _0x4860=['aes192','encrypt','algorithm','error','test','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','final','createDecipher','end','unlink','encryptString','update','utf8','base64','decryptString','crypto','bluebird','../../config/environment','app','secrets','session','aes-256-ctr'];(function(_0x4b9cf7,_0x307d41){var _0x53125d=function(_0x48914a){while(--_0x48914a){_0x4b9cf7['push'](_0x4b9cf7['shift']());}};_0x53125d(++_0x307d41);}(_0x4860,0x1d9));var _0x0486=function(_0x8ec813,_0x5e3e64){_0x8ec813=_0x8ec813-0x0;var _0x345db9=_0x4860[_0x8ec813];return _0x345db9;};'use strict';var crypto=require(_0x0486('0x0'));var fs=require('fs');var BPromise=require(_0x0486('0x1'));var _=require('lodash');var config=require(_0x0486('0x2'));var logger=require('../../config/logger')(_0x0486('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0486('0x4')][_0x0486('0x5')],'algorithm':_0x0486('0x6')};const fileOptions={'algorithm':_0x0486('0x7')};if(config[_0x0486('0x8')]&&config[_0x0486('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x0486('0x9')]=config['encrypt'][_0x0486('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x0486('0xa')](config[_0x0486('0x8')][_0x0486('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x24f3ff){return AES_SUPPORTED_RX[_0x0486('0xb')](_0x24f3ff);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x4f787b){return getSupportedCiphers()[_0x0486('0xc')](_0x4f787b)>-0x1;}function combineOptions(_0x189bb1){var _0x3667c2={};for(var _0x306fc7 in fileOptions){if(fileOptions['hasOwnProperty'](_0x306fc7)){_0x3667c2[_0x306fc7]=fileOptions[_0x306fc7];}}if(_0x189bb1){for(var _0x968615 in _0x189bb1){if(_0x189bb1[_0x0486('0xd')](_0x968615)){_0x3667c2[_0x968615]=_0x189bb1[_0x968615];}}}return _0x3667c2;}exports[_0x0486('0xe')]=function(_0x4c6b1d,_0x2dbde5,_0x3b9e32,_0x5e6cc2){return new BPromise(function(_0x407fc3,_0x29eaf5){_0x5e6cc2=combineOptions(_0x5e6cc2);var _0x22d3be=new Buffer(_0x3b9e32);var _0x4dc605=fs[_0x0486('0xf')](_0x4c6b1d);var _0x167d9c=fs[_0x0486('0x10')](_0x2dbde5);var _0x8dc07d=crypto[_0x0486('0x11')](_0x5e6cc2['algorithm'],_0x22d3be);_0x4dc605['on'](_0x0486('0x12'),function(_0x8d4141){var _0x2a9030=new Buffer(_0x8dc07d['update'](_0x8d4141),_0x0486('0x13'));_0x167d9c[_0x0486('0x14')](_0x2a9030);});_0x4dc605['on']('end',function(){try{var _0x1c3002=new Buffer(_0x8dc07d[_0x0486('0x15')](_0x0486('0x13')),_0x0486('0x13'));_0x167d9c[_0x0486('0x14')](_0x1c3002);_0x167d9c['end']();_0x167d9c['on']('close',function(){return _0x407fc3(_0x2dbde5);});}catch(_0x30d6a9){fs['unlink'](_0x2dbde5);return _0x29eaf5(_0x30d6a9);}});});};exports['decryptFile']=function(_0x23a170,_0x319839,_0x5e78ab,_0x2a26c8){return new BPromise(function(_0x42410a,_0x3b48e0){_0x2a26c8=combineOptions(_0x2a26c8);var _0x27f159=new Buffer(_0x5e78ab);var _0xe359e2=fs[_0x0486('0xf')](_0x23a170);var _0x3fa0bc=fs[_0x0486('0x10')](_0x319839);var _0x1e6bb3=crypto[_0x0486('0x16')](_0x2a26c8[_0x0486('0x9')],_0x27f159);_0xe359e2['on'](_0x0486('0x12'),function(_0x48f348){var _0x27eb4e=new Buffer(_0x1e6bb3['update'](_0x48f348),_0x0486('0x13'));_0x3fa0bc[_0x0486('0x14')](_0x27eb4e);});_0xe359e2['on'](_0x0486('0x17'),function(){try{var _0x3bdea7=new Buffer(_0x1e6bb3[_0x0486('0x15')](_0x0486('0x13')),'binary');_0x3fa0bc[_0x0486('0x14')](_0x3bdea7);_0x3fa0bc[_0x0486('0x17')]();_0x3fa0bc['on']('close',function(){return _0x42410a(_0x319839);});}catch(_0x1d7a21){fs[_0x0486('0x18')](_0x319839);return _0x3b48e0(_0x1d7a21);}});});};exports[_0x0486('0x19')]=function(_0x25ec84,_0x592d81,_0x13119e){var _0x1081ae=_0x13119e||stringOptions[_0x0486('0x9')];var _0x393cf2=_0x592d81||stringOptions['secret'];var _0x4ce18f=crypto['createCipher'](_0x1081ae,_0x393cf2);var _0x57e0a1=_0x4ce18f[_0x0486('0x1a')](_0x25ec84,_0x0486('0x1b'),'base64');_0x57e0a1+=_0x4ce18f['final'](_0x0486('0x1c'));return _0x57e0a1;};exports[_0x0486('0x1d')]=function(_0x533446,_0x526f0e,_0x5e6e8d){var _0xcdb0f4=_0x5e6e8d||stringOptions[_0x0486('0x9')];var _0x1a2fca=_0x526f0e||stringOptions['secret'];var _0x17d7c4=crypto['createDecipher'](_0xcdb0f4,_0x1a2fca);var _0xa23e32=_0x17d7c4['update'](_0x533446,_0x0486('0x1c'),_0x0486('0x1b'));_0xa23e32+=_0x17d7c4[_0x0486('0x15')]('utf8');return _0xa23e32;}; \ No newline at end of file +var _0x9159=['close','unlink','decryptFile','update','encryptString','secret','utf8','base64','decryptString','createDecipher','../../config/environment','../../config/logger','app','secrets','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','final'];(function(_0x2a8c08,_0x3e10e8){var _0x5010c0=function(_0x349144){while(--_0x349144){_0x2a8c08['push'](_0x2a8c08['shift']());}};_0x5010c0(++_0x3e10e8);}(_0x9159,0x86));var _0x9915=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x9159[_0x221b8c];return _0x3fab9f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x9915('0x0'));var logger=require(_0x9915('0x1'))(_0x9915('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x9915('0x3')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x9915('0x4')};if(config[_0x9915('0x5')]&&config['encrypt'][_0x9915('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x9915('0x6')]);if(isSupported){fileOptions['algorithm']=config[_0x9915('0x5')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x9915('0x7')](',\x20');logger['error'](config[_0x9915('0x5')][_0x9915('0x6')],_0x9915('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x61d353){return AES_SUPPORTED_RX[_0x9915('0x9')](_0x61d353);}function getSupportedCiphers(){return crypto[_0x9915('0xa')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x4f91b1){return getSupportedCiphers()[_0x9915('0xb')](_0x4f91b1)>-0x1;}function combineOptions(_0x5b3158){var _0x42194c={};for(var _0x2410d4 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2410d4)){_0x42194c[_0x2410d4]=fileOptions[_0x2410d4];}}if(_0x5b3158){for(var _0x5c2b0b in _0x5b3158){if(_0x5b3158['hasOwnProperty'](_0x5c2b0b)){_0x42194c[_0x5c2b0b]=_0x5b3158[_0x5c2b0b];}}}return _0x42194c;}exports[_0x9915('0xc')]=function(_0x26965a,_0x23efa5,_0x50f96a,_0x48080f){return new BPromise(function(_0x388b24,_0x2115cc){_0x48080f=combineOptions(_0x48080f);var _0x1f6747=new Buffer(_0x50f96a);var _0x5c214e=fs[_0x9915('0xd')](_0x26965a);var _0x1b6eab=fs[_0x9915('0xe')](_0x23efa5);var _0x519f81=crypto[_0x9915('0xf')](_0x48080f[_0x9915('0x6')],_0x1f6747);_0x5c214e['on'](_0x9915('0x10'),function(_0x21fffd){var _0x4e9491=new Buffer(_0x519f81['update'](_0x21fffd),_0x9915('0x11'));_0x1b6eab[_0x9915('0x12')](_0x4e9491);});_0x5c214e['on'](_0x9915('0x13'),function(){try{var _0x3f719e=new Buffer(_0x519f81[_0x9915('0x14')]('binary'),_0x9915('0x11'));_0x1b6eab['write'](_0x3f719e);_0x1b6eab[_0x9915('0x13')]();_0x1b6eab['on'](_0x9915('0x15'),function(){return _0x388b24(_0x23efa5);});}catch(_0x184d02){fs[_0x9915('0x16')](_0x23efa5);return _0x2115cc(_0x184d02);}});});};exports[_0x9915('0x17')]=function(_0x1f115c,_0x521dcc,_0x1c563e,_0x49af51){return new BPromise(function(_0x195f97,_0x44a4b1){_0x49af51=combineOptions(_0x49af51);var _0x419f49=new Buffer(_0x1c563e);var _0x4c4241=fs[_0x9915('0xd')](_0x1f115c);var _0x57f3c6=fs[_0x9915('0xe')](_0x521dcc);var _0x4cfb19=crypto['createDecipher'](_0x49af51[_0x9915('0x6')],_0x419f49);_0x4c4241['on']('data',function(_0x2d575f){var _0x3778bc=new Buffer(_0x4cfb19[_0x9915('0x18')](_0x2d575f),_0x9915('0x11'));_0x57f3c6[_0x9915('0x12')](_0x3778bc);});_0x4c4241['on'](_0x9915('0x13'),function(){try{var _0x509ba4=new Buffer(_0x4cfb19[_0x9915('0x14')](_0x9915('0x11')),_0x9915('0x11'));_0x57f3c6[_0x9915('0x12')](_0x509ba4);_0x57f3c6[_0x9915('0x13')]();_0x57f3c6['on'](_0x9915('0x15'),function(){return _0x195f97(_0x521dcc);});}catch(_0x5e25b7){fs['unlink'](_0x521dcc);return _0x44a4b1(_0x5e25b7);}});});};exports[_0x9915('0x19')]=function(_0x38e257,_0x111a0c,_0x229abf){var _0x4324fe=_0x229abf||stringOptions[_0x9915('0x6')];var _0xae0685=_0x111a0c||stringOptions[_0x9915('0x1a')];var _0x2e71de=crypto['createCipher'](_0x4324fe,_0xae0685);var _0x298641=_0x2e71de['update'](_0x38e257,_0x9915('0x1b'),'base64');_0x298641+=_0x2e71de[_0x9915('0x14')](_0x9915('0x1c'));return _0x298641;};exports[_0x9915('0x1d')]=function(_0x18f9d7,_0x15b7e2,_0x360609){var _0x22775e=_0x360609||stringOptions[_0x9915('0x6')];var _0x3191a0=_0x15b7e2||stringOptions[_0x9915('0x1a')];var _0x55704d=crypto[_0x9915('0x1e')](_0x22775e,_0x3191a0);var _0x3fdfd2=_0x55704d[_0x9915('0x18')](_0x18f9d7,'base64',_0x9915('0x1b'));_0x3fdfd2+=_0x55704d[_0x9915('0x14')](_0x9915('0x1b'));return _0x3fdfd2;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1016ddd..606973f 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 _0xb926=['finally','lodash','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','catch','inspect','Failed'];(function(_0x5da9f6,_0x454e1b){var _0x4d452a=function(_0xd4c3e2){while(--_0xd4c3e2){_0x5da9f6['push'](_0x5da9f6['shift']());}};_0x4d452a(++_0x454e1b);}(_0xb926,0x161));var _0x6b92=function(_0x3bf04b,_0x13577c){_0x3bf04b=_0x3bf04b-0x0;var _0x9eebaf=_0xb926[_0x3bf04b];return _0x9eebaf;};'use strict';var util=require('util');var path=require('path');var _=require(_0x6b92('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6b92('0x1'));var rimraf=require(_0x6b92('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6b92('0x3'))['dbH'];var logger=require(_0x6b92('0x4'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6b92('0x5')][0x2]);var QUERY=process[_0x6b92('0x5')][0x3];var PATH=process[_0x6b92('0x5')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xaa6369,_0x37ec4d){var _0x410d10={'status':_0xaa6369};var _0x16daee={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x37ec4d){_0x410d10[_0x6b92('0x6')]=_0x37ec4d;}return db['AnalyticExtractedReport']['update'](_0x410d10,_0x16daee);}function main(){var _0x218a2a=0x1388;var _0x39ee01;logger[_0x6b92('0x7')](util[_0x6b92('0x8')](_0x6b92('0x9'),EXTRACTED_REPORT_ID,_0x6b92('0xa')));return db[_0x6b92('0xb')][_0x6b92('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6b92('0xd')]})[_0x6b92('0xe')](function(_0x2f1c98){if(_0x2f1c98){_0x39ee01=_0x2f1c98;_0x218a2a=_0x39ee01['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x6b92('0xf')][_0x6b92('0x10')](util[_0x6b92('0x8')](_0x6b92('0x11'),QUERY),{'type':dbH['sequelize'][_0x6b92('0x12')][_0x6b92('0x13')]});})[_0x6b92('0xe')](function(_0x954c91){if(!_0x954c91[0x0][_0x6b92('0x14')]){return analyticExtractedReport(_0x6b92('0x15'));}var _0xd717f8=[];var _0x240a82=0x0;if(_0x39ee01[_0x6b92('0x16')]){if(_0x954c91&&_0x954c91[_0x6b92('0x17')]){var _0x149e10=_['range'](_0x954c91[0x0]['num']/_0x218a2a);var _0x1c44de=Number[_0x6b92('0x18')](_0x954c91[0x0]['num']/_0x218a2a)?_0x954c91[0x0][_0x6b92('0x14')]%_0x218a2a:0x0;_0x149e10['forEach'](function(_0x57d70c){if(_0x57d70c>0x0){_0x240a82+=_0x218a2a;}_0xd717f8[_0x6b92('0x19')](dbH[_0x6b92('0xf')][_0x6b92('0x10')](util[_0x6b92('0x8')](_0x6b92('0x1a'),QUERY,_0x218a2a,_0x240a82),{'type':dbH['sequelize'][_0x6b92('0x12')][_0x6b92('0x13')]}));});if(_0x1c44de>0x0){_0x240a82+=_0x218a2a;_0xd717f8[_0x6b92('0x19')](dbH['sequelize'][_0x6b92('0x10')](util['format'](_0x6b92('0x1a'),QUERY,_0x1c44de,_0x240a82),{'type':dbH[_0x6b92('0xf')][_0x6b92('0x12')][_0x6b92('0x13')]}));}}}else{_0xd717f8[_0x6b92('0x19')](dbH['sequelize'][_0x6b92('0x10')](QUERY,{'type':dbH[_0x6b92('0xf')][_0x6b92('0x12')][_0x6b92('0x13')]}));}var _0x2dc3c8=path[_0x6b92('0x1b')](PATH);var _0xc090ba=path[_0x6b92('0x1c')](PATH,_0x6b92('0x1d'));var _0x1cd442=_0x39ee01[_0x6b92('0x16')]&&_0xd717f8[_0x6b92('0x17')]>0x1;var _0x91b682=[];if(!fs[_0x6b92('0x1e')](path[_0x6b92('0x1f')](_0x2dc3c8,_0xc090ba))&&_0x1cd442){fs[_0x6b92('0x20')](path[_0x6b92('0x1f')](_0x2dc3c8,_0xc090ba));}return BPromise[_0x6b92('0x21')](_0xd717f8,function(_0x58f6d0){_0x91b682[_0x6b92('0x19')](_0x58f6d0);})[_0x6b92('0xe')](function(){for(var _0x119e3e=0x0;_0x119e3e<_0x91b682[_0x6b92('0x17')];_0x119e3e+=0x1){var _0x3ce47e;var _0xa4493e=_0x91b682[_0x119e3e];if(_0x1cd442){_0x3ce47e=path[_0x6b92('0x1f')](_0x2dc3c8,_0xc090ba,util[_0x6b92('0x8')](_0x6b92('0x22'),_0xc090ba,_0x119e3e,_0x6b92('0x23')));}else{_0x3ce47e=path[_0x6b92('0x1f')](_0x2dc3c8,util['format'](_0x6b92('0x24'),_0xc090ba,_0x6b92('0x23')));}fs[_0x6b92('0x25')](_0x3ce47e,csv(_0xa4493e));}})['then'](function(){if(_0x1cd442){return new Promise(function(_0x38065d){zipdir(path[_0x6b92('0x1f')](_0x2dc3c8,_0xc090ba),{'saveTo':path['join'](_0x2dc3c8,util[_0x6b92('0x8')](_0x6b92('0x24'),_0xc090ba,_0x6b92('0x26')))},function(_0xaee98b,_0x2a4de2){rimraf(path[_0x6b92('0x1f')](_0x2dc3c8,_0xc090ba),function(){});_0x38065d(_0x6b92('0x27'));});});}})[_0x6b92('0xe')](function(){logger[_0x6b92('0x7')](util[_0x6b92('0x8')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6b92('0xa')));return analyticExtractedReport('Completed',_0x1cd442?util[_0x6b92('0x8')](_0x6b92('0x24'),_0xc090ba,_0x1cd442?_0x6b92('0x26'):'csv'):null);});})[_0x6b92('0x28')](function(_0x374d14){logger[_0x6b92('0x7')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6b92('0xa')),util[_0x6b92('0x29')](_0x374d14,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6b92('0x2a'));})[_0x6b92('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6cdf=['SELECT','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes'];(function(_0x4addaa,_0x443146){var _0x3eb2eb=function(_0x192442){while(--_0x192442){_0x4addaa['push'](_0x4addaa['shift']());}};_0x3eb2eb(++_0x443146);}(_0x6cdf,0x122));var _0xf6cd=function(_0x22d02c,_0x15300f){_0x22d02c=_0x22d02c-0x0;var _0x5158f1=_0x6cdf[_0x22d02c];return _0x5158f1;};'use strict';var util=require(_0xf6cd('0x0'));var path=require(_0xf6cd('0x1'));var _=require(_0xf6cd('0x2'));var csv=require(_0xf6cd('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xf6cd('0x4'));var rimraf=require(_0xf6cd('0x5'));var db=require(_0xf6cd('0x6'))['db'];var dbH=require(_0xf6cd('0x6'))[_0xf6cd('0x7')];var logger=require(_0xf6cd('0x8'))(_0xf6cd('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xf6cd('0xa')][0x2]);var QUERY=process[_0xf6cd('0xa')][0x3];var PATH=process[_0xf6cd('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c6915,_0x2f6de9){var _0x46e593={'status':_0x1c6915};var _0x4a220e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f6de9){_0x46e593[_0xf6cd('0xb')]=_0x2f6de9;}return db[_0xf6cd('0xc')][_0xf6cd('0xd')](_0x46e593,_0x4a220e);}function main(){var _0x34ca8d=0x1388;var _0x6d9260;logger[_0xf6cd('0xe')](util[_0xf6cd('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf6cd('0x10')));return db[_0xf6cd('0x11')][_0xf6cd('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf6cd('0x13'),'splitSizeCsv']})[_0xf6cd('0x14')](function(_0x444744){if(_0x444744){_0x6d9260=_0x444744;_0x34ca8d=_0x6d9260[_0xf6cd('0x15')]||0x1388;}})[_0xf6cd('0x14')](function(){return dbH[_0xf6cd('0x16')][_0xf6cd('0x17')](util[_0xf6cd('0xf')](_0xf6cd('0x18'),QUERY),{'type':dbH[_0xf6cd('0x16')]['QueryTypes']['SELECT']});})[_0xf6cd('0x14')](function(_0xd35f50){if(!_0xd35f50[0x0][_0xf6cd('0x19')]){return analyticExtractedReport(_0xf6cd('0x1a'));}var _0x547842=[];var _0x40d25a=0x0;if(_0x6d9260[_0xf6cd('0x13')]){if(_0xd35f50&&_0xd35f50[_0xf6cd('0x1b')]){var _0x5ae71b=_[_0xf6cd('0x1c')](_0xd35f50[0x0][_0xf6cd('0x19')]/_0x34ca8d);var _0x266772=Number[_0xf6cd('0x1d')](_0xd35f50[0x0][_0xf6cd('0x19')]/_0x34ca8d)?_0xd35f50[0x0][_0xf6cd('0x19')]%_0x34ca8d:0x0;_0x5ae71b[_0xf6cd('0x1e')](function(_0x5be79e){if(_0x5be79e>0x0){_0x40d25a+=_0x34ca8d;}_0x547842[_0xf6cd('0x1f')](dbH[_0xf6cd('0x16')][_0xf6cd('0x17')](util['format'](_0xf6cd('0x20'),QUERY,_0x34ca8d,_0x40d25a),{'type':dbH[_0xf6cd('0x16')][_0xf6cd('0x21')]['SELECT']}));});if(_0x266772>0x0){_0x40d25a+=_0x34ca8d;_0x547842[_0xf6cd('0x1f')](dbH[_0xf6cd('0x16')][_0xf6cd('0x17')](util[_0xf6cd('0xf')](_0xf6cd('0x20'),QUERY,_0x266772,_0x40d25a),{'type':dbH[_0xf6cd('0x16')][_0xf6cd('0x21')][_0xf6cd('0x22')]}));}}}else{_0x547842[_0xf6cd('0x1f')](dbH[_0xf6cd('0x16')][_0xf6cd('0x17')](QUERY,{'type':dbH[_0xf6cd('0x16')]['QueryTypes'][_0xf6cd('0x22')]}));}var _0x4caabb=path[_0xf6cd('0x23')](PATH);var _0x2c9255=path[_0xf6cd('0x24')](PATH,_0xf6cd('0x25'));var _0x53380c=_0x6d9260['split']&&_0x547842[_0xf6cd('0x1b')]>0x1;var _0x3c779a=[];if(!fs[_0xf6cd('0x26')](path[_0xf6cd('0x27')](_0x4caabb,_0x2c9255))&&_0x53380c){fs['mkdirSync'](path[_0xf6cd('0x27')](_0x4caabb,_0x2c9255));}return BPromise[_0xf6cd('0x28')](_0x547842,function(_0x1acf7b){_0x3c779a['push'](_0x1acf7b);})[_0xf6cd('0x14')](function(){for(var _0x175b7f=0x0;_0x175b7f<_0x3c779a[_0xf6cd('0x1b')];_0x175b7f+=0x1){var _0x2dbe34;var _0x4a5244=_0x3c779a[_0x175b7f];if(_0x53380c){_0x2dbe34=path[_0xf6cd('0x27')](_0x4caabb,_0x2c9255,util[_0xf6cd('0xf')](_0xf6cd('0x29'),_0x2c9255,_0x175b7f,_0xf6cd('0x2a')));}else{_0x2dbe34=path['join'](_0x4caabb,util[_0xf6cd('0xf')](_0xf6cd('0x2b'),_0x2c9255,_0xf6cd('0x2a')));}fs[_0xf6cd('0x2c')](_0x2dbe34,csv(_0x4a5244));}})[_0xf6cd('0x14')](function(){if(_0x53380c){return new Promise(function(_0x3756b9){zipdir(path[_0xf6cd('0x27')](_0x4caabb,_0x2c9255),{'saveTo':path[_0xf6cd('0x27')](_0x4caabb,util[_0xf6cd('0xf')]('%s.%s',_0x2c9255,'zip'))},function(_0x214b8e,_0x3de538){rimraf(path[_0xf6cd('0x27')](_0x4caabb,_0x2c9255),function(){});_0x3756b9(_0xf6cd('0x2d'));});});}})[_0xf6cd('0x14')](function(){logger[_0xf6cd('0xe')](util['format'](_0xf6cd('0x2e'),EXTRACTED_REPORT_ID,_0xf6cd('0x10')));return analyticExtractedReport(_0xf6cd('0x2f'),_0x53380c?util[_0xf6cd('0xf')](_0xf6cd('0x2b'),_0x2c9255,_0x53380c?_0xf6cd('0x30'):_0xf6cd('0x2a')):null);});})['catch'](function(_0x510012){logger[_0xf6cd('0xe')](util['format'](_0xf6cd('0x31'),EXTRACTED_REPORT_ID,_0xf6cd('0x10')),util[_0xf6cd('0x32')](_0x510012,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf6cd('0x33'));})[_0xf6cd('0x34')](function(){process[_0xf6cd('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3eba13d..5fa9c51 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 _0x2f91=['YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','createPdfFromHTML','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','map','tableHeader','toString','fill','length','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','find','split','then','splitSizePdf','range','isInteger','num','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel'];(function(_0x3fe9df,_0x7780a1){var _0x41edb5=function(_0x12a867){while(--_0x12a867){_0x3fe9df['push'](_0x3fe9df['shift']());}};_0x41edb5(++_0x7780a1);}(_0x2f91,0x153));var _0x12f9=function(_0x4f20b3,_0x44f9f6){_0x4f20b3=_0x4f20b3-0x0;var _0x36cf47=_0x2f91[_0x4f20b3];return _0x36cf47;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x12f9('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x12f9('0x1'));var PdfPrinter=require(_0x12f9('0x2'));var zipdir=require(_0x12f9('0x3'));var rimraf=require(_0x12f9('0x4'));var JSDOM=require('jsdom')[_0x12f9('0x5')];var window=new JSDOM('')[_0x12f9('0x6')];var BPromise=require(_0x12f9('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x12f9('0x8'))[_0x12f9('0x9')];var logger=require(_0x12f9('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x12f9('0xb')][0x2]);var QUERY=process[_0x12f9('0xb')][0x3];var PATH=process[_0x12f9('0xb')][0x4];var NAME=process[_0x12f9('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x27ee7c,_0x2f7be4){var _0x1cca6f={'status':_0x27ee7c};var _0x41f031={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f7be4){_0x1cca6f[_0x12f9('0xc')]=_0x2f7be4;}return db[_0x12f9('0xd')][_0x12f9('0xe')](_0x1cca6f,_0x41f031);}function getHeaders(_0x1837c7){return _[_0x12f9('0xf')](_0x1837c7,function(_0x444ad0){return{'text':_0x444ad0,'style':_0x12f9('0x10')};});}function getRows(_0x254204,_0x4341e0){return _[_0x12f9('0xf')](_0x4341e0,function(_0x533e35){return _(_0x533e35)['pick'](_0x254204)[_0x12f9('0xf')](function(_0x354efe){return _0x354efe?_[_0x12f9('0x11')](_0x354efe):'';})['value']();});}function createTable(_0xc80a46,_0x1ed3a3){var _0x22b720={'widths':_[_0x12f9('0x12')](Array(_0xc80a46[_0x12f9('0x13')]),0x91),'heights':function(_0x15ff50){return _0x15ff50===0x0?_0x12f9('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x22283c=getHeaders(_0xc80a46);_0x22b720[_0x12f9('0x15')][_0x12f9('0x16')](_0x22283c);var _0x1f6b03=getRows(_0xc80a46,_0x1ed3a3);_0x22b720[_0x12f9('0x15')]=_0x22b720['body'][_0x12f9('0x17')](_0x1f6b03);return _0x22b720;}function createTables(_0x4cacc3){var _0x41d595=[];var _0x13dbae=_[_0x12f9('0x18')](Object['keys'](_0x4cacc3[0x0]),0x5);_0x13dbae[_0x12f9('0x19')](function(_0x489490){_0x41d595[_0x12f9('0x16')](createTable(_0x489490,_0x4cacc3));});return _0x41d595;}function getPDFDocDefinition(_0x36f700){var _0xdba56f=util[_0x12f9('0x1a')](_0x12f9('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x12f9('0x1a')](FORMAT));var _0x232dd1=[];for(var _0x3e7fa3=0x0;_0x3e7fa3<_0x36f700[_0x12f9('0x13')];_0x3e7fa3++){var _0x1e45bf=[];if(_0x3e7fa3===0x0){_0x1e45bf['push']({'text':_0xdba56f,'style':_0x12f9('0x1c')});}var _0x369c3b={'table':_0x36f700[_0x3e7fa3]};if(_0x3e7fa3>0x0){_0x369c3b[_0x12f9('0x1d')]=_0x12f9('0x1e');_0x369c3b[_0x12f9('0x1f')]=[0x0,0x46,0x0,0x0];}_0x1e45bf['push'](_0x369c3b);_0x232dd1[_0x12f9('0x16')](_0x1e45bf);}return{'pageSize':'A4','pageOrientation':_0x12f9('0x20'),'content':_0x232dd1,'footer':function(_0x2b5ec5,_0x2b65c5){return{'text':_0x2b5ec5['toString']()+_0x12f9('0x21')+_0x2b65c5,'style':'footer'};},'defaultStyle':{'font':_0x12f9('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x12f9('0x23')},'footer':{'alignment':_0x12f9('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3f99bc){var _0x439f6c=0x1388;var _0xf36e64;if(!_0x3f99bc[0x0]['num']){return analyticExtractedReport('Empty');}return db['Setting'][_0x12f9('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x12f9('0x26'),'splitSizePdf']})[_0x12f9('0x27')](function(_0x57e6a3){if(_0x57e6a3){_0xf36e64=_0x57e6a3;_0x439f6c=_0xf36e64[_0x12f9('0x28')]||0x3e8;}})[_0x12f9('0x27')](function(){var _0x37da6c=[];var _0x4fb104=0x0;if(_0xf36e64['split']){if(_0x3f99bc&&_0x3f99bc[_0x12f9('0x13')]){var _0x286b71=_[_0x12f9('0x29')](_0x3f99bc[0x0]['num']/_0x439f6c);var _0x5a2b75=Number[_0x12f9('0x2a')](_0x3f99bc[0x0][_0x12f9('0x2b')]/_0x439f6c)?_0x3f99bc[0x0][_0x12f9('0x2b')]%_0x439f6c:0x0;_0x286b71[_0x12f9('0x19')](function(_0x2ed00a){if(_0x2ed00a>0x0){_0x4fb104+=_0x439f6c;}_0x37da6c[_0x12f9('0x16')](dbH[_0x12f9('0x2c')][_0x12f9('0x2d')](util[_0x12f9('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x439f6c,_0x4fb104),{'type':dbH['sequelize'][_0x12f9('0x2e')][_0x12f9('0x2f')]}));});if(_0x5a2b75>0x0){_0x4fb104+=_0x439f6c;_0x37da6c[_0x12f9('0x16')](dbH[_0x12f9('0x2c')][_0x12f9('0x2d')](util['format'](_0x12f9('0x30'),QUERY,_0x5a2b75,_0x4fb104),{'type':dbH[_0x12f9('0x2c')]['QueryTypes']['SELECT']}));}}}else{_0x37da6c[_0x12f9('0x16')](dbH[_0x12f9('0x2c')][_0x12f9('0x2d')](QUERY,{'type':dbH[_0x12f9('0x2c')]['QueryTypes']['SELECT']}));}var _0x4fd6d6=path[_0x12f9('0x31')](PATH);var _0x362323=path[_0x12f9('0x32')](PATH,_0x12f9('0x33'));var _0x28d04b=_0xf36e64[_0x12f9('0x26')]&&_0x37da6c[_0x12f9('0x13')]>0x1;var _0xa2c59f=[];if(!fs[_0x12f9('0x34')](path[_0x12f9('0x35')](_0x4fd6d6,_0x362323))&&_0x28d04b){fs[_0x12f9('0x36')](path['join'](_0x4fd6d6,_0x362323));}return BPromise['each'](_0x37da6c,function(_0x38e2b7){_0xa2c59f[_0x12f9('0x16')](_0x38e2b7);})[_0x12f9('0x27')](function(){var _0x81a612=[];for(var _0x18daad=0x0;_0x18daad<_0xa2c59f['length'];_0x18daad+=0x1){var _0xb705f8=_0xa2c59f[_0x18daad];var _0x4b943e=createTables(_[_0x12f9('0x37')](_0xb705f8));var _0x9f2bce;var _0x5db749=getPDFDocDefinition(_0x4b943e);var _0x559f81=getPDFPrinter();var _0x4e057e=_0x559f81[_0x12f9('0x38')](_0x5db749);if(_0x28d04b){_0x9f2bce=path[_0x12f9('0x35')](_0x4fd6d6,_0x362323,util[_0x12f9('0x1a')](_0x12f9('0x39'),_0x362323,_0x18daad,_0x12f9('0x3a')));}else{_0x9f2bce=path[_0x12f9('0x35')](_0x4fd6d6,util[_0x12f9('0x1a')](_0x12f9('0x3b'),_0x362323,'pdf'));}_0x81a612[_0x12f9('0x16')](writePDFDocument(_0x4e057e,_0x9f2bce));}return Promise[_0x12f9('0x3c')](_0x81a612);})['then'](function(){if(_0x28d04b){return new Promise(function(_0x5b1340){zipdir(path[_0x12f9('0x35')](_0x4fd6d6,_0x362323),{'saveTo':path['join'](_0x4fd6d6,util[_0x12f9('0x1a')](_0x12f9('0x3b'),_0x362323,_0x12f9('0x3d')))},function(){rimraf(path[_0x12f9('0x35')](_0x4fd6d6,_0x362323),function(){});_0x5b1340(_0x12f9('0x3e'));});});}})[_0x12f9('0x27')](function(){if(!_0x28d04b)return;rimraf(path[_0x12f9('0x35')](_0x4fd6d6,_0x362323),function(){});})['then'](function(){logger[_0x12f9('0x3f')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x28d04b?util['format'](_0x12f9('0x3b'),_0x362323,_0x28d04b?_0x12f9('0x3d'):_0x12f9('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x12f9('0x1a')](_0x12f9('0x40'),EXTRACTED_REPORT_ID,_0x12f9('0x41')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x12f9('0x27')](function(_0x26d32e){EXTRACTED_REPORT=_0x26d32e;return dbH[_0x12f9('0x2c')][_0x12f9('0x2d')](util['format'](_0x12f9('0x42'),QUERY),{'type':dbH['sequelize'][_0x12f9('0x2e')][_0x12f9('0x2f')]});})[_0x12f9('0x27')](extractReport)[_0x12f9('0x43')](function(_0x526475){logger[_0x12f9('0x3f')](util[_0x12f9('0x1a')](_0x12f9('0x44'),EXTRACTED_REPORT_ID,_0x12f9('0x41')),util['inspect'](_0x526475,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x12f9('0x45'));})[_0x12f9('0x46')](function(){process[_0x12f9('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x13e4b0=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x12f9('0x48'),'bolditalics':__dirname+_0x12f9('0x49')}});return _0x13e4b0;}function getPDFDocDefinitionFromHTML(_0x57588e,_0x535851){var _0x859244=util[_0x12f9('0x1a')](_0x12f9('0x4a'),_0x535851[_0x12f9('0x4b')],_0x535851['interactionId']);var _0x5021d6=moment()[_0x12f9('0x1a')](_0x12f9('0x4c'))['toString']();var _0x413374=htmlToPdfmake(_0x57588e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x413374],'defaultStyle':{'font':_0x12f9('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x12f9('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x12f9('0x4d')}},'header':function(){return[{'text':_0x12f9('0x4e'),'style':_0x12f9('0x1c')}];},'footer':function(_0xc35798,_0x593f40){return[{'text':util['format'](_0x12f9('0x4f'),_0x859244,_0xc35798,_0x593f40,_0x5021d6),'style':'footer'}];}};}function writePDFDocument(_0x3f3cbf,_0x5427b1){return new Promise(function(_0x54c218,_0x42c6b0){var _0x3139d5=_0x3f3cbf['pipe'](fs['createWriteStream'](_0x5427b1));_0x3139d5['on'](_0x12f9('0x50'),function(){_0x54c218(_0x12f9('0x50'));});_0x3139d5['on'](_0x12f9('0x51'),function(_0x140144){_0x42c6b0(_0x140144);});_0x3f3cbf['end']();});}exports[_0x12f9('0x52')]=function(_0x291475,_0x5e8f56){var _0x320a4a=getPDFPrinter();var _0x3eccf2=getPDFDocDefinitionFromHTML(_0x291475,_0x5e8f56);var _0xfd0076=_0x320a4a[_0x12f9('0x38')](_0x3eccf2);return writePDFDocument(_0xfd0076,_0x5e8f56['path'])['catch'](function(_0x27469d){throw _0x27469d;});}; \ No newline at end of file +var _0xe7ef=['landscape','toString','\x20/\x20','footer','Arial','num','Setting','find','split','splitSizePdf','then','range','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','sequelize','SELECT','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','path','lodash','util','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','window','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','pick','value','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','before'];(function(_0x3a632b,_0x3606c5){var _0x1a13aa=function(_0x1dec50){while(--_0x1dec50){_0x3a632b['push'](_0x3a632b['shift']());}};_0x1a13aa(++_0x3606c5);}(_0xe7ef,0x130));var _0xfe7e=function(_0x9a7371,_0x18a664){_0x9a7371=_0x9a7371-0x0;var _0x1bcddb=_0xe7ef[_0x9a7371];return _0x1bcddb;};'use strict';var _=require(_0xfe7e('0x0'));var fs=require('fs');var util=require(_0xfe7e('0x1'));var path=require('path');var moment=require(_0xfe7e('0x2'));var htmlToPdfmake=require(_0xfe7e('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xfe7e('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xfe7e('0x5'))[_0xfe7e('0x6')];var window=new JSDOM('')[_0xfe7e('0x7')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xfe7e('0x8'))(_0xfe7e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xfe7e('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xfe7e('0xa')][0x4];var NAME=process[_0xfe7e('0xa')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x49007a,_0x42ea02){var _0x1143bd={'status':_0x49007a};var _0x7763e4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x42ea02){_0x1143bd[_0xfe7e('0xb')]=_0x42ea02;}return db[_0xfe7e('0xc')][_0xfe7e('0xd')](_0x1143bd,_0x7763e4);}function getHeaders(_0xe4ff3c){return _[_0xfe7e('0xe')](_0xe4ff3c,function(_0x2aac3a){return{'text':_0x2aac3a,'style':'tableHeader'};});}function getRows(_0x49ea20,_0x1a28f7){return _[_0xfe7e('0xe')](_0x1a28f7,function(_0x43a6cc){return _(_0x43a6cc)[_0xfe7e('0xf')](_0x49ea20)[_0xfe7e('0xe')](function(_0x4b3509){return _0x4b3509?_['toString'](_0x4b3509):'';})[_0xfe7e('0x10')]();});}function createTable(_0x5deae6,_0x5ed38e){var _0x160f2d={'widths':_['fill'](Array(_0x5deae6[_0xfe7e('0x11')]),0x91),'heights':function(_0x23952b){return _0x23952b===0x0?_0xfe7e('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x482053=getHeaders(_0x5deae6);_0x160f2d[_0xfe7e('0x13')][_0xfe7e('0x14')](_0x482053);var _0x2a4e46=getRows(_0x5deae6,_0x5ed38e);_0x160f2d[_0xfe7e('0x13')]=_0x160f2d[_0xfe7e('0x13')][_0xfe7e('0x15')](_0x2a4e46);return _0x160f2d;}function createTables(_0x472450){var _0x478bee=[];var _0x58e323=_[_0xfe7e('0x16')](Object[_0xfe7e('0x17')](_0x472450[0x0]),0x5);_0x58e323[_0xfe7e('0x18')](function(_0x3c1fa2){_0x478bee[_0xfe7e('0x14')](createTable(_0x3c1fa2,_0x472450));});return _0x478bee;}function getPDFDocDefinition(_0x5da78b){var _0x4963d0=util[_0xfe7e('0x19')](_0xfe7e('0x1a'),NAME,EXTRACTED_REPORT[_0xfe7e('0x1b')],moment(EXTRACTED_REPORT[_0xfe7e('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xfe7e('0x1d')])[_0xfe7e('0x19')](FORMAT));var _0x24011f=[];for(var _0x1cf14d=0x0;_0x1cf14d<_0x5da78b[_0xfe7e('0x11')];_0x1cf14d++){var _0x57ea90=[];if(_0x1cf14d===0x0){_0x57ea90[_0xfe7e('0x14')]({'text':_0x4963d0,'style':_0xfe7e('0x1e')});}var _0x3bdda2={'table':_0x5da78b[_0x1cf14d]};if(_0x1cf14d>0x0){_0x3bdda2['pageBreak']=_0xfe7e('0x1f');_0x3bdda2['margin']=[0x0,0x46,0x0,0x0];}_0x57ea90[_0xfe7e('0x14')](_0x3bdda2);_0x24011f[_0xfe7e('0x14')](_0x57ea90);}return{'pageSize':'A4','pageOrientation':_0xfe7e('0x20'),'content':_0x24011f,'footer':function(_0x1c9a08,_0x19f272){return{'text':_0x1c9a08[_0xfe7e('0x21')]()+_0xfe7e('0x22')+_0x19f272,'style':_0xfe7e('0x23')};},'defaultStyle':{'font':_0xfe7e('0x24')},'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(_0x240fdc){var _0x814f4e=0x1388;var _0x5344de;if(!_0x240fdc[0x0][_0xfe7e('0x25')]){return analyticExtractedReport('Empty');}return db[_0xfe7e('0x26')][_0xfe7e('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfe7e('0x28'),_0xfe7e('0x29')]})[_0xfe7e('0x2a')](function(_0x41c7f8){if(_0x41c7f8){_0x5344de=_0x41c7f8;_0x814f4e=_0x5344de[_0xfe7e('0x29')]||0x3e8;}})['then'](function(){var _0x229db4=[];var _0x11eff1=0x0;if(_0x5344de[_0xfe7e('0x28')]){if(_0x240fdc&&_0x240fdc[_0xfe7e('0x11')]){var _0x46703c=_[_0xfe7e('0x2b')](_0x240fdc[0x0]['num']/_0x814f4e);var _0x3fc70b=Number['isInteger'](_0x240fdc[0x0][_0xfe7e('0x25')]/_0x814f4e)?_0x240fdc[0x0][_0xfe7e('0x25')]%_0x814f4e:0x0;_0x46703c['forEach'](function(_0x18a86d){if(_0x18a86d>0x0){_0x11eff1+=_0x814f4e;}_0x229db4[_0xfe7e('0x14')](dbH['sequelize']['query'](util[_0xfe7e('0x19')](_0xfe7e('0x2c'),QUERY,_0x814f4e,_0x11eff1),{'type':dbH['sequelize'][_0xfe7e('0x2d')]['SELECT']}));});if(_0x3fc70b>0x0){_0x11eff1+=_0x814f4e;_0x229db4[_0xfe7e('0x14')](dbH['sequelize'][_0xfe7e('0x2e')](util[_0xfe7e('0x19')](_0xfe7e('0x2c'),QUERY,_0x3fc70b,_0x11eff1),{'type':dbH[_0xfe7e('0x2f')][_0xfe7e('0x2d')][_0xfe7e('0x30')]}));}}}else{_0x229db4[_0xfe7e('0x14')](dbH[_0xfe7e('0x2f')]['query'](QUERY,{'type':dbH[_0xfe7e('0x2f')]['QueryTypes'][_0xfe7e('0x30')]}));}var _0x182e30=path[_0xfe7e('0x31')](PATH);var _0x598c4b=path['basename'](PATH,_0xfe7e('0x32'));var _0x22da59=_0x5344de[_0xfe7e('0x28')]&&_0x229db4[_0xfe7e('0x11')]>0x1;var _0x2fade6=[];if(!fs[_0xfe7e('0x33')](path[_0xfe7e('0x34')](_0x182e30,_0x598c4b))&&_0x22da59){fs[_0xfe7e('0x35')](path[_0xfe7e('0x34')](_0x182e30,_0x598c4b));}return BPromise[_0xfe7e('0x36')](_0x229db4,function(_0x441b02){_0x2fade6[_0xfe7e('0x14')](_0x441b02);})[_0xfe7e('0x2a')](function(){var _0x4e3264=[];for(var _0x5acc16=0x0;_0x5acc16<_0x2fade6[_0xfe7e('0x11')];_0x5acc16+=0x1){var _0x47e237=_0x2fade6[_0x5acc16];var _0x88af71=createTables(_[_0xfe7e('0x37')](_0x47e237));var _0x3db892;var _0x835a9e=getPDFDocDefinition(_0x88af71);var _0x7a4894=getPDFPrinter();var _0x2a850f=_0x7a4894[_0xfe7e('0x38')](_0x835a9e);if(_0x22da59){_0x3db892=path[_0xfe7e('0x34')](_0x182e30,_0x598c4b,util[_0xfe7e('0x19')](_0xfe7e('0x39'),_0x598c4b,_0x5acc16,_0xfe7e('0x3a')));}else{_0x3db892=path[_0xfe7e('0x34')](_0x182e30,util[_0xfe7e('0x19')](_0xfe7e('0x3b'),_0x598c4b,_0xfe7e('0x3a')));}_0x4e3264[_0xfe7e('0x14')](writePDFDocument(_0x2a850f,_0x3db892));}return Promise[_0xfe7e('0x3c')](_0x4e3264);})['then'](function(){if(_0x22da59){return new Promise(function(_0x19d31e){zipdir(path[_0xfe7e('0x34')](_0x182e30,_0x598c4b),{'saveTo':path[_0xfe7e('0x34')](_0x182e30,util[_0xfe7e('0x19')]('%s.%s',_0x598c4b,'zip'))},function(){rimraf(path[_0xfe7e('0x34')](_0x182e30,_0x598c4b),function(){});_0x19d31e('zip\x20finished');});});}})[_0xfe7e('0x2a')](function(){if(!_0x22da59)return;rimraf(path['join'](_0x182e30,_0x598c4b),function(){});})['then'](function(){logger[_0xfe7e('0x3d')](util['format'](_0xfe7e('0x3e'),EXTRACTED_REPORT_ID,_0xfe7e('0x3f')));return analyticExtractedReport('Completed',_0x22da59?util['format'](_0xfe7e('0x3b'),_0x598c4b,_0x22da59?_0xfe7e('0x40'):_0xfe7e('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfe7e('0x3d')](util[_0xfe7e('0x19')](_0xfe7e('0x41'),EXTRACTED_REPORT_ID,_0xfe7e('0x3f')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x456670){EXTRACTED_REPORT=_0x456670;return dbH[_0xfe7e('0x2f')]['query'](util[_0xfe7e('0x19')](_0xfe7e('0x42'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xfe7e('0x30')]});})['then'](extractReport)['catch'](function(_0xa731e){logger[_0xfe7e('0x3d')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xfe7e('0x3f')),util[_0xfe7e('0x43')](_0xa731e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfe7e('0x44'));})[_0xfe7e('0x45')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3b7ded=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xfe7e('0x46'),'bolditalics':__dirname+_0xfe7e('0x47')}});return _0x3b7ded;}function getPDFDocDefinitionFromHTML(_0x2e3874,_0x438f4a){var _0x2496bc=util[_0xfe7e('0x19')](_0xfe7e('0x48'),_0x438f4a[_0xfe7e('0x49')],_0x438f4a['interactionId']);var _0x430dd7=moment()['format'](_0xfe7e('0x4a'))[_0xfe7e('0x21')]();var _0x33f45f=htmlToPdfmake(_0x2e3874,{'window':window,'tableAutoSize':!![]});return{'content':[_0x33f45f],'defaultStyle':{'font':_0xfe7e('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xfe7e('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xfe7e('0x4c'),'style':_0xfe7e('0x1e')}];},'footer':function(_0x5d86e8,_0x3e3f24){return[{'text':util['format'](_0xfe7e('0x4d'),_0x2496bc,_0x5d86e8,_0x3e3f24,_0x430dd7),'style':_0xfe7e('0x23')}];}};}function writePDFDocument(_0x3949cd,_0x4975e1){return new Promise(function(_0xb73a79,_0x397a82){var _0x16b400=_0x3949cd[_0xfe7e('0x4e')](fs[_0xfe7e('0x4f')](_0x4975e1));_0x16b400['on'](_0xfe7e('0x50'),function(){_0xb73a79(_0xfe7e('0x50'));});_0x16b400['on'](_0xfe7e('0x51'),function(_0x50aec2){_0x397a82(_0x50aec2);});_0x3949cd[_0xfe7e('0x52')]();});}exports['createPdfFromHTML']=function(_0x25f3f9,_0x2d60b4){var _0x1ee07b=getPDFPrinter();var _0x513c65=getPDFDocDefinitionFromHTML(_0x25f3f9,_0x2d60b4);var _0x566f4f=_0x1ee07b[_0xfe7e('0x38')](_0x513c65);return writePDFDocument(_0x566f4f,_0x2d60b4[_0xfe7e('0x53')])['catch'](function(_0x4f51f1){throw _0x4f51f1;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1b6effd..fc27d7e 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 _0x2472=['QueryTypes','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','split','existsSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize'];(function(_0x580b3c,_0x4ee01f){var _0x2740ec=function(_0x5b1bb8){while(--_0x5b1bb8){_0x580b3c['push'](_0x580b3c['shift']());}};_0x2740ec(++_0x4ee01f);}(_0x2472,0xd8));var _0x2247=function(_0x15f974,_0x53b99a){_0x15f974=_0x15f974-0x0;var _0x333559=_0x2472[_0x15f974];return _0x333559;};'use strict';var util=require(_0x2247('0x0'));var path=require(_0x2247('0x1'));var _=require(_0x2247('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x2247('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2247('0x4'))[_0x2247('0x5')];var logger=require(_0x2247('0x6'))(_0x2247('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2247('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2325d9,_0x2881c9){var _0x1c83ae={'status':_0x2325d9};var _0x58f607={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2881c9){_0x1c83ae['savename']=_0x2881c9;}return db[_0x2247('0x9')]['update'](_0x1c83ae,_0x58f607);}function main(){var _0x3af39b=0x1388;var _0x10233b;logger[_0x2247('0xa')](util[_0x2247('0xb')](_0x2247('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x2247('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2247('0xe')]})[_0x2247('0xf')](function(_0x4857c5){if(_0x4857c5){_0x10233b=_0x4857c5;_0x3af39b=_0x10233b['splitSizeXlsx']||0x1388;}})[_0x2247('0xf')](function(){return dbH['sequelize'][_0x2247('0x10')](util['format'](_0x2247('0x11'),QUERY),{'type':dbH[_0x2247('0x12')][_0x2247('0x13')]['SELECT']});})[_0x2247('0xf')](function(_0x41a0ba){if(!_0x41a0ba[0x0][_0x2247('0x14')]){return analyticExtractedReport(_0x2247('0x15'));}var _0xe3b231=[];var _0x17b8ae=0x0;if(_0x10233b['split']){if(_0x41a0ba&&_0x41a0ba[_0x2247('0x16')]){var _0x553f6c=_[_0x2247('0x17')](_0x41a0ba[0x0][_0x2247('0x14')]/_0x3af39b);var _0x107bed=Number[_0x2247('0x18')](_0x41a0ba[0x0][_0x2247('0x14')]/_0x3af39b)?_0x41a0ba[0x0]['num']%_0x3af39b:0x0;_0x553f6c['forEach'](function(_0x7af113){if(_0x7af113>0x0){_0x17b8ae+=_0x3af39b;}_0xe3b231[_0x2247('0x19')](dbH[_0x2247('0x12')][_0x2247('0x10')](util[_0x2247('0xb')](_0x2247('0x1a'),QUERY,_0x3af39b,_0x17b8ae),{'type':dbH[_0x2247('0x12')]['QueryTypes'][_0x2247('0x1b')]}));});if(_0x107bed>0x0){_0x17b8ae+=_0x3af39b;_0xe3b231['push'](dbH[_0x2247('0x12')][_0x2247('0x10')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x107bed,_0x17b8ae),{'type':dbH['sequelize'][_0x2247('0x13')]['SELECT']}));}}}else{_0xe3b231['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x2247('0x12')][_0x2247('0x13')][_0x2247('0x1b')]}));}var _0x51d4e2=path[_0x2247('0x1c')](PATH);var _0x4670f2=path[_0x2247('0x1d')](PATH,_0x2247('0x1e'));var _0x351646=_0x10233b[_0x2247('0x1f')]&&_0xe3b231[_0x2247('0x16')]>0x1;var _0x1125ed=[];if(!fs[_0x2247('0x20')](path['join'](_0x51d4e2,_0x4670f2))&&_0x351646){fs['mkdirSync'](path[_0x2247('0x21')](_0x51d4e2,_0x4670f2));}return BPromise[_0x2247('0x22')](_0xe3b231,function(_0x1a8544){_0x1125ed[_0x2247('0x19')](_0x1a8544);})[_0x2247('0xf')](function(){for(var _0x550b35=0x0;_0x550b35<_0x1125ed['length'];_0x550b35+=0x1){var _0x34a122;var _0x2b01e6=_0x1125ed[_0x550b35];if(_0x351646){_0x34a122=path['join'](_0x51d4e2,_0x4670f2,util[_0x2247('0xb')](_0x2247('0x23'),_0x4670f2,_0x550b35,_0x2247('0x24')));}else{_0x34a122=path['join'](_0x51d4e2,util[_0x2247('0xb')](_0x2247('0x25'),_0x4670f2,_0x2247('0x24')));}fs['writeFileSync'](_0x34a122,json2xls(_0x2b01e6),_0x2247('0x26'));}})[_0x2247('0xf')](function(){if(_0x351646){return new Promise(function(_0x43056e){zipdir(path['join'](_0x51d4e2,_0x4670f2),{'saveTo':path[_0x2247('0x21')](_0x51d4e2,util[_0x2247('0xb')]('%s.%s',_0x4670f2,_0x2247('0x27')))},function(_0x27f8b2,_0x4e8e6a){rimraf(path[_0x2247('0x21')](_0x51d4e2,_0x4670f2),function(){});_0x43056e('zip\x20finished');});});}})[_0x2247('0xf')](function(){logger[_0x2247('0xa')](util[_0x2247('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2247('0x28')));return analyticExtractedReport(_0x2247('0x29'),_0x351646?util[_0x2247('0xb')](_0x2247('0x25'),_0x4670f2,_0x351646?_0x2247('0x27'):_0x2247('0x24')):null);});})[_0x2247('0x2a')](function(_0x1739bd){logger[_0x2247('0xa')](util[_0x2247('0xb')](_0x2247('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x2247('0x2c')](_0x1739bd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2247('0x2d'));})['finally'](function(){process[_0x2247('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xec21=['each','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','QueryTypes','SELECT','range','num','isInteger','forEach','query','push','dirname','basename','.xlsx','length','existsSync','join','mkdirSync'];(function(_0x324811,_0x24f644){var _0x237e85=function(_0x53c171){while(--_0x53c171){_0x324811['push'](_0x324811['shift']());}};_0x237e85(++_0x24f644);}(_0xec21,0x1d9));var _0x1ec2=function(_0x89f772,_0x45088a){_0x89f772=_0x89f772-0x0;var _0x4857a3=_0xec21[_0x89f772];return _0x4857a3;};'use strict';var util=require(_0x1ec2('0x0'));var path=require(_0x1ec2('0x1'));var _=require(_0x1ec2('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x1ec2('0x3'));var zipdir=require(_0x1ec2('0x4'));var rimraf=require(_0x1ec2('0x5'));var db=require(_0x1ec2('0x6'))['db'];var dbH=require('../../mysqldb')[_0x1ec2('0x7')];var logger=require(_0x1ec2('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1ec2('0x9')][0x2]);var QUERY=process[_0x1ec2('0x9')][0x3];var PATH=process[_0x1ec2('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3fea3a,_0x459c30){var _0x55115a={'status':_0x3fea3a};var _0x419300={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x459c30){_0x55115a[_0x1ec2('0xa')]=_0x459c30;}return db[_0x1ec2('0xb')]['update'](_0x55115a,_0x419300);}function main(){var _0x41e276=0x1388;var _0x411d2c;logger[_0x1ec2('0xc')](util[_0x1ec2('0xd')](_0x1ec2('0xe'),EXTRACTED_REPORT_ID,_0x1ec2('0xf')));return db[_0x1ec2('0x10')][_0x1ec2('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1ec2('0x12'),_0x1ec2('0x13')]})[_0x1ec2('0x14')](function(_0x65a0a9){if(_0x65a0a9){_0x411d2c=_0x65a0a9;_0x41e276=_0x411d2c[_0x1ec2('0x13')]||0x1388;}})['then'](function(){return dbH[_0x1ec2('0x15')]['query'](util[_0x1ec2('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1ec2('0x15')][_0x1ec2('0x16')][_0x1ec2('0x17')]});})[_0x1ec2('0x14')](function(_0x34a9b9){if(!_0x34a9b9[0x0]['num']){return analyticExtractedReport('Empty');}var _0xd5666b=[];var _0x1892a1=0x0;if(_0x411d2c['split']){if(_0x34a9b9&&_0x34a9b9['length']){var _0x3d7cb3=_[_0x1ec2('0x18')](_0x34a9b9[0x0][_0x1ec2('0x19')]/_0x41e276);var _0x2859b3=Number[_0x1ec2('0x1a')](_0x34a9b9[0x0][_0x1ec2('0x19')]/_0x41e276)?_0x34a9b9[0x0][_0x1ec2('0x19')]%_0x41e276:0x0;_0x3d7cb3[_0x1ec2('0x1b')](function(_0x2f4673){if(_0x2f4673>0x0){_0x1892a1+=_0x41e276;}_0xd5666b['push'](dbH[_0x1ec2('0x15')][_0x1ec2('0x1c')](util[_0x1ec2('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41e276,_0x1892a1),{'type':dbH[_0x1ec2('0x15')]['QueryTypes'][_0x1ec2('0x17')]}));});if(_0x2859b3>0x0){_0x1892a1+=_0x41e276;_0xd5666b[_0x1ec2('0x1d')](dbH['sequelize'][_0x1ec2('0x1c')](util[_0x1ec2('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2859b3,_0x1892a1),{'type':dbH['sequelize'][_0x1ec2('0x16')][_0x1ec2('0x17')]}));}}}else{_0xd5666b[_0x1ec2('0x1d')](dbH[_0x1ec2('0x15')][_0x1ec2('0x1c')](QUERY,{'type':dbH[_0x1ec2('0x15')]['QueryTypes']['SELECT']}));}var _0x33c0d3=path[_0x1ec2('0x1e')](PATH);var _0x1ff956=path[_0x1ec2('0x1f')](PATH,_0x1ec2('0x20'));var _0x3e5e55=_0x411d2c[_0x1ec2('0x12')]&&_0xd5666b[_0x1ec2('0x21')]>0x1;var _0x14b6c2=[];if(!fs[_0x1ec2('0x22')](path[_0x1ec2('0x23')](_0x33c0d3,_0x1ff956))&&_0x3e5e55){fs[_0x1ec2('0x24')](path['join'](_0x33c0d3,_0x1ff956));}return BPromise[_0x1ec2('0x25')](_0xd5666b,function(_0x1ff8f8){_0x14b6c2[_0x1ec2('0x1d')](_0x1ff8f8);})[_0x1ec2('0x14')](function(){for(var _0x4c2536=0x0;_0x4c2536<_0x14b6c2[_0x1ec2('0x21')];_0x4c2536+=0x1){var _0x51b0bb;var _0x3974e9=_0x14b6c2[_0x4c2536];if(_0x3e5e55){_0x51b0bb=path[_0x1ec2('0x23')](_0x33c0d3,_0x1ff956,util['format']('%s%d.%s',_0x1ff956,_0x4c2536,_0x1ec2('0x26')));}else{_0x51b0bb=path[_0x1ec2('0x23')](_0x33c0d3,util[_0x1ec2('0xd')](_0x1ec2('0x27'),_0x1ff956,'xlsx'));}fs['writeFileSync'](_0x51b0bb,json2xls(_0x3974e9),_0x1ec2('0x28'));}})[_0x1ec2('0x14')](function(){if(_0x3e5e55){return new Promise(function(_0x373bc9){zipdir(path[_0x1ec2('0x23')](_0x33c0d3,_0x1ff956),{'saveTo':path[_0x1ec2('0x23')](_0x33c0d3,util[_0x1ec2('0xd')](_0x1ec2('0x27'),_0x1ff956,_0x1ec2('0x29')))},function(_0x163151,_0xf398ce){rimraf(path[_0x1ec2('0x23')](_0x33c0d3,_0x1ff956),function(){});_0x373bc9(_0x1ec2('0x2a'));});});}})[_0x1ec2('0x14')](function(){logger[_0x1ec2('0xc')](util[_0x1ec2('0xd')](_0x1ec2('0x2b'),EXTRACTED_REPORT_ID,_0x1ec2('0xf')));return analyticExtractedReport(_0x1ec2('0x2c'),_0x3e5e55?util[_0x1ec2('0xd')](_0x1ec2('0x27'),_0x1ff956,_0x3e5e55?_0x1ec2('0x29'):_0x1ec2('0x26')):null);});})[_0x1ec2('0x2d')](function(_0x3803fa){logger['info'](util[_0x1ec2('0xd')](_0x1ec2('0x2e'),EXTRACTED_REPORT_ID,_0x1ec2('0xf')),util[_0x1ec2('0x2f')](_0x3803fa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1ec2('0x30'));})[_0x1ec2('0x31')](function(){process[_0x1ec2('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 60b7dc9..143229d 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 _0x9eb8=['findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','groupBy','playback','hasOwnProperty','priority','extension','extensions','push','type','Set','format','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','destroy','bulkCreate','sortBy','error','lodash','models'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9eb8,0xbb));var _0x89eb=function(_0x343036,_0x5a5c30){_0x343036=_0x343036-0x0;var _0x3de70f=_0x9eb8[_0x343036];return _0x3de70f;};'use strict';var _=require(_0x89eb('0x0'));var util=require('util');function rewrite(_0x29e473,_0x29a762){var _0x354649=this;return _0x29e473[_0x89eb('0x1')]['Interval'][_0x89eb('0x2')]({'raw':!![]})[_0x89eb('0x3')](function(_0x56902d){_0x354649[_0x89eb('0x4')]=_0x56902d;return _0x29e473[_0x89eb('0x1')][_0x89eb('0x5')][_0x89eb('0x2')]({'where':{'IntervalId':_0x29a762[_0x89eb('0x6')]},'raw':!![]});})[_0x89eb('0x3')](function(_0x384e65){return _0x29e473[_0x89eb('0x1')][_0x89eb('0x5')][_0x89eb('0x2')]({'where':{'exten':{'$in':_[_0x89eb('0x7')](_[_0x89eb('0x8')](_0x384e65,_0x89eb('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x89eb('0x3')](function(_0x393f93){var _0x333f0f=_[_0x89eb('0xa')](_0x393f93,{'priority':'1'});var _0x1fcdec=_[_0x89eb('0xa')](_0x393f93,{'isApp':0x1});var _0x3371a9=_[_0x89eb('0xb')](_0x1fcdec,_0x89eb('0x9'));var _0x470a16=['queue',_0x89eb('0xc')];var _0xf85f68=[];var _0x2e5755=[];for(var _0x429711 in _0x3371a9){if(_0x3371a9[_0x89eb('0xd')](_0x429711)){_0x354649[_0x89eb('0xe')]=0x2;_0x354649['extensions']=[];_0x354649[_0x89eb('0xf')]=_['find'](_0x333f0f,{'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')]});_0x354649[_0x89eb('0x10')][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':_0x89eb('0x13'),'appdata':util[_0x89eb('0x14')]('CDR(type)=%s',_0x3371a9[_0x429711][0x0]['type']),'context':_0x3371a9[_0x429711][0x0]['context'],'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'priority':_0x354649[_0x89eb('0xe')]++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});if(_0x3371a9[_0x429711][0x0][_0x89eb('0x12')]===_0x89eb('0x16')){_0x354649[_0x89eb('0x10')]['push']({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':_0x89eb('0x13'),'appdata':_0x89eb('0x17')+_0x3371a9[_0x429711][0x0][_0x89eb('0x15')],'context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0]['exten'],'priority':_0x354649['priority']++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});}else if(_0x3371a9[_0x429711][0x0]['type']===_0x89eb('0x19')){if(_0x354649[_0x89eb('0xf')]){_0x354649[_0x89eb('0x10')][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':_0x89eb('0x13'),'appdata':_0x89eb('0x1a')+(_0x354649[_0x89eb('0xf')][_0x89eb('0x1b')]?_0x89eb('0x1c')+_0x354649['extension'][_0x89eb('0x1b')]+'}':_0x89eb('0x1d')),'context':_0x3371a9[_0x429711][0x0]['context'],'exten':_0x3371a9[_0x429711][0x0]['exten'],'priority':_0x354649[_0x89eb('0xe')]++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});}_0x354649[_0x89eb('0x10')]['push']({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':'Set','appdata':_0x89eb('0x17')+_0x3371a9[_0x429711][0x0][_0x89eb('0x15')],'context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'priority':_0x354649[_0x89eb('0xe')]++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0]['VoiceExtensionId']});var _0x381663=_0x354649[_0x89eb('0xe')]++;_0x354649[_0x89eb('0x10')]['push']({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':_0x89eb('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x381663+0x2)+_0x89eb('0x1f')+(_0x381663+0x1)+')','context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0]['exten'],'priority':_0x381663,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});if(_0x354649[_0x89eb('0xf')]){_0x354649['extensions'][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0]['type'],'app':_0x89eb('0x13'),'appdata':_0x354649['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x354649[_0x89eb('0xf')][_0x89eb('0x1b')]+'}':_0x89eb('0x20'),'context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'priority':_0x354649['priority']++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});}_0x354649[_0x89eb('0x10')]['push']({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':'Set','appdata':_0x89eb('0x21')+_0x3371a9[_0x429711][0x0]['VoiceExtensionId'],'context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'priority':_0x354649['priority']++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0]['VoiceExtensionId']});if(_0x354649[_0x89eb('0xf')]&&_0x354649[_0x89eb('0xf')][_0x89eb('0xd')](_0x89eb('0x22'))&&_0x354649[_0x89eb('0xf')][_0x89eb('0x22')]!==_0x89eb('0x23')){_0x354649[_0x89eb('0x10')][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':_0x89eb('0x13'),'appdata':_0x89eb('0x24'),'context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'priority':_0x354649[_0x89eb('0xe')]++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0]['VoiceExtensionId']});_0x354649[_0x89eb('0x10')]['push']({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x354649['extension'][_0x89eb('0x22')]||_0x89eb('0x25'),'context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0]['exten'],'priority':_0x354649[_0x89eb('0xe')]++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});}}_0x354649['extensions'][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0]['type'],'app':_0x89eb('0x13'),'appdata':_0x89eb('0x26'),'context':_0x3371a9[_0x429711][0x0]['context'],'exten':_0x3371a9[_0x429711][0x0]['exten'],'priority':_0x354649[_0x89eb('0xe')]++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});_0x354649['extensions'][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0]['type'],'app':_0x89eb('0x13'),'appdata':_0x89eb('0x27'),'context':_0x3371a9[_0x429711][0x0]['context'],'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'priority':_0x354649['priority']++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0]['VoiceExtensionId']});_0x354649[_0x89eb('0x10')][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':'Set','appdata':_0x89eb('0x28'),'context':_0x3371a9[_0x429711][0x0][_0x89eb('0x18')],'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'priority':_0x354649[_0x89eb('0xe')]++,'VoiceExtensionId':_0x3371a9[_0x429711][0x0]['VoiceExtensionId']});for(var _0x51add7=0x0,_0x148b05=0x0;_0x51add7<_0x3371a9[_0x429711][_0x89eb('0x29')];_0x51add7+=0x1,_0x148b05=0x0){var _0x1d00e8=_0x3371a9[_0x429711][_0x51add7];if(_0x1d00e8[_0x89eb('0x12')]){_0x1d00e8[_0x89eb('0x12')]=_0x1d00e8[_0x89eb('0x12')][_0x89eb('0x2a')]();}var _0x5b9185=[];var _0x501568=[];delete _0x1d00e8['id'];delete _0x1d00e8[_0x89eb('0x2b')];delete _0x1d00e8['updatedAt'];var _0x307080=_0x1d00e8[_0x89eb('0x2c')]!==_0x89eb('0x2d')?[_0x1d00e8[_0x89eb('0x2c')]]:_0x1d00e8[_0x89eb('0x6')]?_[_0x89eb('0x8')](_[_0x89eb('0xa')](_0x354649[_0x89eb('0x4')],{'IntervalId':_0x1d00e8[_0x89eb('0x6')]}),'interval'):[];if(_0x1d00e8[_0x89eb('0xd')](_0x89eb('0x2e'))){if(_0x1d00e8['tag']&&_0x1d00e8['tag']!=='--'){_0x5b9185[_0x89eb('0x11')]({'type':_0x1d00e8[_0x89eb('0x12')],'app':_0x89eb('0x13'),'appdata':'CDR(tag)='+_0x1d00e8[_0x89eb('0x2e')],'context':_0x1d00e8[_0x89eb('0x18')],'exten':_0x1d00e8['exten'],'priority':_0x307080[_0x89eb('0x29')]+_0x354649[_0x89eb('0xe')]+_0x148b05++,'VoiceExtensionId':_0x1d00e8[_0x89eb('0x15')]});}}if(_0x1d00e8[_0x89eb('0x12')]==='outbound'&&_0x1d00e8[_0x89eb('0xd')](_0x89eb('0x2f'))){if(_0x1d00e8[_0x89eb('0x2f')]){_0x5b9185[_0x89eb('0x11')]({'type':_0x1d00e8['type'],'app':_0x89eb('0x1e'),'appdata':_0x89eb('0x30')+_0x1d00e8['callerID']+')','context':_0x1d00e8[_0x89eb('0x18')],'exten':_0x1d00e8[_0x89eb('0x9')],'priority':_0x307080[_0x89eb('0x29')]+_0x354649[_0x89eb('0xe')]+_0x148b05++,'VoiceExtensionId':_0x1d00e8[_0x89eb('0x15')]});}else{_0x5b9185[_0x89eb('0x11')]({'type':_0x1d00e8['type'],'app':_0x89eb('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x1d00e8[_0x89eb('0x18')],'exten':_0x1d00e8[_0x89eb('0x9')],'priority':_0x307080[_0x89eb('0x29')]+_0x354649['priority']+_0x148b05++,'VoiceExtensionId':_0x1d00e8[_0x89eb('0x15')]});}}if(_0x1d00e8[_0x89eb('0xd')](_0x89eb('0x31'))){if(_0x470a16['indexOf'](_0x1d00e8['app']['toLowerCase']())>=0x0&&_0x1d00e8[_0x89eb('0x32')]!==_0x89eb('0x33')){if(_0x1d00e8[_0x89eb('0x31')]){_0x5b9185[_0x89eb('0x11')]({'type':_0x1d00e8[_0x89eb('0x12')],'app':_0x89eb('0x1e'),'appdata':_0x89eb('0x34'),'context':_0x1d00e8[_0x89eb('0x18')],'exten':_0x1d00e8[_0x89eb('0x9')],'priority':_0x307080[_0x89eb('0x29')]+_0x354649[_0x89eb('0xe')]+_0x148b05++,'VoiceExtensionId':_0x1d00e8[_0x89eb('0x15')]});_0x5b9185[_0x89eb('0x11')]({'type':_0x1d00e8[_0x89eb('0x12')],'app':_0x89eb('0x13'),'appdata':_0x89eb('0x35'),'context':_0x1d00e8[_0x89eb('0x18')],'exten':_0x1d00e8[_0x89eb('0x9')],'priority':_0x307080[_0x89eb('0x29')]+_0x354649['priority']+_0x148b05++,'VoiceExtensionId':_0x1d00e8['VoiceExtensionId']});}else{_0x5b9185['push']({'type':_0x1d00e8[_0x89eb('0x12')],'app':_0x89eb('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1d00e8[_0x89eb('0x18')],'exten':_0x1d00e8[_0x89eb('0x9')],'priority':_0x307080[_0x89eb('0x29')]+_0x354649[_0x89eb('0xe')]+_0x148b05++,'VoiceExtensionId':_0x1d00e8[_0x89eb('0x15')]});_0x5b9185['push']({'type':_0x1d00e8[_0x89eb('0x12')],'app':_0x89eb('0x13'),'appdata':_0x89eb('0x36'),'context':_0x1d00e8[_0x89eb('0x18')],'exten':_0x1d00e8[_0x89eb('0x9')],'priority':_0x307080[_0x89eb('0x29')]+_0x354649[_0x89eb('0xe')]+_0x148b05++,'VoiceExtensionId':_0x1d00e8[_0x89eb('0x15')]});}}}for(var _0x4fbe9b=0x0;_0x4fbe9b<_0x307080[_0x89eb('0x29')];_0x4fbe9b+=0x1){var _0x3a72dc=_0x354649[_0x89eb('0xe')]+_0x307080[_0x89eb('0x29')];var _0x46a64f=_0x4fbe9b===_0x307080['length']-0x1?_0x354649[_0x89eb('0xe')]+_0x5b9185[_0x89eb('0x29')]+_0x501568[_0x89eb('0x29')]+0x2:_0x354649[_0x89eb('0xe')]+_0x4fbe9b+0x1;_0x5b9185['splice'](_0x4fbe9b,0x0,{'type':_0x1d00e8['type'],'app':_0x89eb('0x37'),'appdata':_0x307080[_0x4fbe9b]+'?'+_0x1d00e8['context']+_0x89eb('0x38')+_0x3a72dc+':'+_0x1d00e8[_0x89eb('0x18')]+',${EXTEN},'+_0x46a64f,'exten':_0x1d00e8['exten'],'context':_0x1d00e8[_0x89eb('0x18')],'priority':_0x354649[_0x89eb('0xe')]+_0x4fbe9b,'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});}_0x1d00e8[_0x89eb('0xe')]=_0x5b9185[_0x89eb('0x29')]?_[_0x89eb('0x39')](_0x5b9185)[_0x89eb('0xe')]+0x1:_0x354649[_0x89eb('0xe')];_0x354649[_0x89eb('0xe')]=(_0x501568['length']?_[_0x89eb('0x39')](_0x501568)['priority']:_0x1d00e8[_0x89eb('0xe')])+0x1;_0x354649[_0x89eb('0x10')]=_['concat'](_0x354649[_0x89eb('0x10')],_0x5b9185,[_0x1d00e8],_0x501568);}_0x354649[_0x89eb('0x10')][_0x89eb('0x11')]({'type':_0x3371a9[_0x429711][0x0][_0x89eb('0x12')],'app':_0x89eb('0x3a'),'exten':_0x3371a9[_0x429711][0x0][_0x89eb('0x9')],'context':_0x3371a9[_0x429711][0x0]['context'],'priority':_0x354649[_0x89eb('0xe')],'VoiceExtensionId':_0x3371a9[_0x429711][0x0][_0x89eb('0x15')]});_0xf85f68[_0x89eb('0x11')](_0x3371a9[_0x429711][0x0]['VoiceExtensionId']);_0x2e5755=_['concat'](_0x2e5755,_0x354649[_0x89eb('0x10')]);}}return _0x29e473['transaction'](function(_0x3c9e63){return _0x29e473['models']['VoiceExtension'][_0x89eb('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0xf85f68}},'transaction':_0x3c9e63})['then'](function(_0x4a39b4){return _0x29e473[_0x89eb('0x1')]['VoiceExtension'][_0x89eb('0x3c')](_[_0x89eb('0x3d')](_0x2e5755,_0x89eb('0xe')),{'transaction':_0x3c9e63});});});})['catch'](function(_0x27fb0b){console[_0x89eb('0x3e')](_0x27fb0b);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xc483=['CDR(routeid)=','context','outbound','extension','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','createdAt','updatedAt','interval','*,*,*,*','intervals','IntervalId','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','app','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','VoiceExtension','then','uniq','map','filter','groupBy','exten','queue','playback','priority','extensions','find','type','Set','format','CDR(type)=%s','VoiceExtensionId','push'];(function(_0x38aa1d,_0x4faf18){var _0x2fb75d=function(_0x14ee14){while(--_0x14ee14){_0x38aa1d['push'](_0x38aa1d['shift']());}};_0x2fb75d(++_0x4faf18);}(_0xc483,0xbe));var _0x3c48=function(_0x212a88,_0x9f8de9){_0x212a88=_0x212a88-0x0;var _0x48e43d=_0xc483[_0x212a88];return _0x48e43d;};'use strict';var _=require(_0x3c48('0x0'));var util=require(_0x3c48('0x1'));function rewrite(_0x48ddab,_0x1ca472){var _0x3285b0=this;return _0x48ddab[_0x3c48('0x2')][_0x3c48('0x3')][_0x3c48('0x4')]({'raw':!![]})['then'](function(_0x371328){_0x3285b0['intervals']=_0x371328;return _0x48ddab[_0x3c48('0x2')][_0x3c48('0x5')][_0x3c48('0x4')]({'where':{'IntervalId':_0x1ca472['IntervalId']},'raw':!![]});})[_0x3c48('0x6')](function(_0x2a1765){return _0x48ddab[_0x3c48('0x2')][_0x3c48('0x5')][_0x3c48('0x4')]({'where':{'exten':{'$in':_[_0x3c48('0x7')](_[_0x3c48('0x8')](_0x2a1765,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x3c48('0x6')](function(_0x3e2886){var _0x437611=_[_0x3c48('0x9')](_0x3e2886,{'priority':'1'});var _0x366abd=_['filter'](_0x3e2886,{'isApp':0x1});var _0x449d1c=_[_0x3c48('0xa')](_0x366abd,_0x3c48('0xb'));var _0x409e2f=[_0x3c48('0xc'),_0x3c48('0xd')];var _0x5535fe=[];var _0x1d82d7=[];for(var _0x592f1d in _0x449d1c){if(_0x449d1c['hasOwnProperty'](_0x592f1d)){_0x3285b0[_0x3c48('0xe')]=0x2;_0x3285b0[_0x3c48('0xf')]=[];_0x3285b0['extension']=_[_0x3c48('0x10')](_0x437611,{'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')]});_0x3285b0[_0x3c48('0xf')]['push']({'type':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')],'app':_0x3c48('0x12'),'appdata':util[_0x3c48('0x13')](_0x3c48('0x14'),_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')]),'context':_0x449d1c[_0x592f1d][0x0]['context'],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});if(_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')]==='inbound'){_0x3285b0[_0x3c48('0xf')][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')],'app':_0x3c48('0x12'),'appdata':_0x3c48('0x17')+_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')],'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0]['exten'],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});}else if(_0x449d1c[_0x592f1d][0x0]['type']===_0x3c48('0x19')){if(_0x3285b0[_0x3c48('0x1a')]){_0x3285b0['extensions'][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0]['type'],'app':_0x3c48('0x12'),'appdata':'CDR(destination)='+(_0x3285b0[_0x3c48('0x1a')]['cutdigits']?_0x3c48('0x1b')+_0x3285b0[_0x3c48('0x1a')][_0x3c48('0x1c')]+'}':_0x3c48('0x1d')),'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});}_0x3285b0['extensions'][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')],'app':_0x3c48('0x12'),'appdata':_0x3c48('0x17')+_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')],'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0]['exten'],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0]['VoiceExtensionId']});var _0x4060f1=_0x3285b0['priority']++;_0x3285b0[_0x3c48('0xf')][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0]['type'],'app':'ExecIf','appdata':_0x3c48('0x1e')+(_0x4060f1+0x2)+'):Goto('+(_0x4060f1+0x1)+')','context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x4060f1,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});if(_0x3285b0[_0x3c48('0x1a')]){_0x3285b0['extensions'][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0]['type'],'app':_0x3c48('0x12'),'appdata':_0x3285b0[_0x3c48('0x1a')][_0x3c48('0x1c')]?_0x3c48('0x1f')+_0x3285b0[_0x3c48('0x1a')]['cutdigits']+'}':_0x3c48('0x20'),'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0]['exten'],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});}_0x3285b0[_0x3c48('0xf')][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')],'app':_0x3c48('0x12'),'appdata':'outboundrouteid='+_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')],'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0]['VoiceExtensionId']});if(_0x3285b0[_0x3c48('0x1a')]&&_0x3285b0['extension'][_0x3c48('0x21')](_0x3c48('0x22'))&&_0x3285b0[_0x3c48('0x1a')][_0x3c48('0x22')]!==_0x3c48('0x23')){_0x3285b0[_0x3c48('0xf')][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0]['type'],'app':_0x3c48('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0]['exten'],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});_0x3285b0['extensions'][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')],'app':_0x3c48('0x12'),'appdata':_0x3c48('0x24')+_0x3285b0[_0x3c48('0x1a')]['recordingFormat']||_0x3c48('0x25'),'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0]['VoiceExtensionId']});}}_0x3285b0['extensions'][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0]['type'],'app':_0x3c48('0x12'),'appdata':_0x3c48('0x26'),'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});_0x3285b0[_0x3c48('0xf')][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0]['type'],'app':'Set','appdata':_0x3c48('0x27'),'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});_0x3285b0[_0x3c48('0xf')]['push']({'type':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')],'app':_0x3c48('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'exten':_0x449d1c[_0x592f1d][0x0][_0x3c48('0xb')],'priority':_0x3285b0[_0x3c48('0xe')]++,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0]['VoiceExtensionId']});for(var _0xfdd2d6=0x0,_0x32c649=0x0;_0xfdd2d6<_0x449d1c[_0x592f1d]['length'];_0xfdd2d6+=0x1,_0x32c649=0x0){var _0x17e910=_0x449d1c[_0x592f1d][_0xfdd2d6];if(_0x17e910[_0x3c48('0x11')]){_0x17e910['type']=_0x17e910[_0x3c48('0x11')]['toLowerCase']();}var _0x29e3b8=[];var _0xfee3d6=[];delete _0x17e910['id'];delete _0x17e910[_0x3c48('0x28')];delete _0x17e910[_0x3c48('0x29')];var _0x1900b3=_0x17e910[_0x3c48('0x2a')]!==_0x3c48('0x2b')?[_0x17e910[_0x3c48('0x2a')]]:_0x17e910['IntervalId']?_[_0x3c48('0x8')](_['filter'](_0x3285b0[_0x3c48('0x2c')],{'IntervalId':_0x17e910[_0x3c48('0x2d')]}),_0x3c48('0x2a')):[];if(_0x17e910[_0x3c48('0x21')](_0x3c48('0x2e'))){if(_0x17e910['tag']&&_0x17e910['tag']!=='--'){_0x29e3b8['push']({'type':_0x17e910[_0x3c48('0x11')],'app':_0x3c48('0x12'),'appdata':_0x3c48('0x2f')+_0x17e910['tag'],'context':_0x17e910[_0x3c48('0x18')],'exten':_0x17e910[_0x3c48('0xb')],'priority':_0x1900b3[_0x3c48('0x30')]+_0x3285b0['priority']+_0x32c649++,'VoiceExtensionId':_0x17e910[_0x3c48('0x15')]});}}if(_0x17e910['type']===_0x3c48('0x19')&&_0x17e910['hasOwnProperty'](_0x3c48('0x31'))){if(_0x17e910[_0x3c48('0x31')]){_0x29e3b8[_0x3c48('0x16')]({'type':_0x17e910['type'],'app':_0x3c48('0x32'),'appdata':_0x3c48('0x33')+_0x17e910[_0x3c48('0x31')]+')','context':_0x17e910[_0x3c48('0x18')],'exten':_0x17e910[_0x3c48('0xb')],'priority':_0x1900b3['length']+_0x3285b0[_0x3c48('0xe')]+_0x32c649++,'VoiceExtensionId':_0x17e910[_0x3c48('0x15')]});}else{_0x29e3b8[_0x3c48('0x16')]({'type':_0x17e910[_0x3c48('0x11')],'app':'ExecIf','appdata':_0x3c48('0x34'),'context':_0x17e910['context'],'exten':_0x17e910[_0x3c48('0xb')],'priority':_0x1900b3[_0x3c48('0x30')]+_0x3285b0[_0x3c48('0xe')]+_0x32c649++,'VoiceExtensionId':_0x17e910[_0x3c48('0x15')]});}}if(_0x17e910[_0x3c48('0x21')](_0x3c48('0x35'))){if(_0x409e2f['indexOf'](_0x17e910[_0x3c48('0x36')][_0x3c48('0x37')]())>=0x0&&_0x17e910['appType']!=='custom'){if(_0x17e910[_0x3c48('0x35')]){_0x29e3b8[_0x3c48('0x16')]({'type':_0x17e910[_0x3c48('0x11')],'app':_0x3c48('0x32'),'appdata':_0x3c48('0x38'),'context':_0x17e910[_0x3c48('0x18')],'exten':_0x17e910['exten'],'priority':_0x1900b3[_0x3c48('0x30')]+_0x3285b0[_0x3c48('0xe')]+_0x32c649++,'VoiceExtensionId':_0x17e910[_0x3c48('0x15')]});_0x29e3b8['push']({'type':_0x17e910['type'],'app':_0x3c48('0x12'),'appdata':_0x3c48('0x39'),'context':_0x17e910[_0x3c48('0x18')],'exten':_0x17e910[_0x3c48('0xb')],'priority':_0x1900b3[_0x3c48('0x30')]+_0x3285b0[_0x3c48('0xe')]+_0x32c649++,'VoiceExtensionId':_0x17e910[_0x3c48('0x15')]});}else{_0x29e3b8[_0x3c48('0x16')]({'type':_0x17e910['type'],'app':'ExecIf','appdata':_0x3c48('0x3a'),'context':_0x17e910[_0x3c48('0x18')],'exten':_0x17e910[_0x3c48('0xb')],'priority':_0x1900b3['length']+_0x3285b0['priority']+_0x32c649++,'VoiceExtensionId':_0x17e910['VoiceExtensionId']});_0x29e3b8[_0x3c48('0x16')]({'type':_0x17e910['type'],'app':_0x3c48('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x17e910[_0x3c48('0x18')],'exten':_0x17e910[_0x3c48('0xb')],'priority':_0x1900b3[_0x3c48('0x30')]+_0x3285b0[_0x3c48('0xe')]+_0x32c649++,'VoiceExtensionId':_0x17e910[_0x3c48('0x15')]});}}}for(var _0x2253a2=0x0;_0x2253a2<_0x1900b3[_0x3c48('0x30')];_0x2253a2+=0x1){var _0x44e0e7=_0x3285b0[_0x3c48('0xe')]+_0x1900b3[_0x3c48('0x30')];var _0x1df43b=_0x2253a2===_0x1900b3['length']-0x1?_0x3285b0[_0x3c48('0xe')]+_0x29e3b8[_0x3c48('0x30')]+_0xfee3d6[_0x3c48('0x30')]+0x2:_0x3285b0['priority']+_0x2253a2+0x1;_0x29e3b8[_0x3c48('0x3b')](_0x2253a2,0x0,{'type':_0x17e910[_0x3c48('0x11')],'app':'GotoIfTime','appdata':_0x1900b3[_0x2253a2]+'?'+_0x17e910[_0x3c48('0x18')]+_0x3c48('0x3c')+_0x44e0e7+':'+_0x17e910[_0x3c48('0x18')]+_0x3c48('0x3c')+_0x1df43b,'exten':_0x17e910[_0x3c48('0xb')],'context':_0x17e910[_0x3c48('0x18')],'priority':_0x3285b0[_0x3c48('0xe')]+_0x2253a2,'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0]['VoiceExtensionId']});}_0x17e910[_0x3c48('0xe')]=_0x29e3b8[_0x3c48('0x30')]?_[_0x3c48('0x3d')](_0x29e3b8)[_0x3c48('0xe')]+0x1:_0x3285b0[_0x3c48('0xe')];_0x3285b0['priority']=(_0xfee3d6[_0x3c48('0x30')]?_[_0x3c48('0x3d')](_0xfee3d6)[_0x3c48('0xe')]:_0x17e910[_0x3c48('0xe')])+0x1;_0x3285b0[_0x3c48('0xf')]=_['concat'](_0x3285b0[_0x3c48('0xf')],_0x29e3b8,[_0x17e910],_0xfee3d6);}_0x3285b0[_0x3c48('0xf')][_0x3c48('0x16')]({'type':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x11')],'app':_0x3c48('0x3e'),'exten':_0x449d1c[_0x592f1d][0x0]['exten'],'context':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x18')],'priority':_0x3285b0['priority'],'VoiceExtensionId':_0x449d1c[_0x592f1d][0x0][_0x3c48('0x15')]});_0x5535fe[_0x3c48('0x16')](_0x449d1c[_0x592f1d][0x0]['VoiceExtensionId']);_0x1d82d7=_[_0x3c48('0x3f')](_0x1d82d7,_0x3285b0[_0x3c48('0xf')]);}}return _0x48ddab[_0x3c48('0x40')](function(_0x83230d){return _0x48ddab[_0x3c48('0x2')]['VoiceExtension'][_0x3c48('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x5535fe}},'transaction':_0x83230d})[_0x3c48('0x6')](function(_0x21367f){return _0x48ddab[_0x3c48('0x2')][_0x3c48('0x5')][_0x3c48('0x42')](_[_0x3c48('0x43')](_0x1d82d7,_0x3c48('0xe')),{'transaction':_0x83230d});});});})[_0x3c48('0x44')](function(_0x4c23d0){console[_0x3c48('0x45')](_0x4c23d0);});}exports[_0x3c48('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 6bc6b84..c8bb440 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 _0x8931=['CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','query','VoiceQueueId','catch','onlyIfOpen','sequelize','all','BlackLists','get','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','null','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId'];(function(_0x332776,_0x3a4209){var _0x3e2878=function(_0x19f49d){while(--_0x19f49d){_0x332776['push'](_0x332776['shift']());}};_0x3e2878(++_0x3a4209);}(_0x8931,0x19a));var _0x1893=function(_0x4a52b0,_0x4d1571){_0x4a52b0=_0x4a52b0-0x0;var _0x593b03=_0x8931[_0x4a52b0];return _0x593b03;};'use strict';var BPromise=require(_0x1893('0x0'));var util=require(_0x1893('0x1'));var _=require(_0x1893('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x1893('0x3'));var Redis=require(_0x1893('0x4'));var db=require(_0x1893('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x1893('0x6'))(_0x1893('0x7'));config[_0x1893('0x8')]=_[_0x1893('0x9')](config[_0x1893('0x8')],{'host':_0x1893('0xa'),'port':0x18eb});var socket=require(_0x1893('0xb'))(new Redis(config[_0x1893('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0x1893('0xc')](socket);try{if(!process[_0x1893('0xd')][0x2]||process[_0x1893('0xd')][0x2]===_0x1893('0xe')||process[_0x1893('0xd')][0x2]==='null'){throw new Error(_0x1893('0xf'));}var FILEPATH=process[_0x1893('0xd')][0x2];if(!process[_0x1893('0xd')][0x3]||process[_0x1893('0xd')][0x3]===_0x1893('0xe')||process[_0x1893('0xd')][0x3]===_0x1893('0x10')||!process[_0x1893('0xd')][0x4]||process['argv'][0x4]===_0x1893('0xe')||process[_0x1893('0xd')][0x4]===_0x1893('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x1893('0xd')][0x3][_0x1893('0x11')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x1893('0xd')][0x5]===_0x1893('0xe')||process[_0x1893('0xd')][0x5]===_0x1893('0x10')){throw new Error(_0x1893('0x12'));}var LISTID=process[_0x1893('0xd')][0x5];var COMPANYID=process[_0x1893('0xd')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!==_0x1893('0x10')?process[_0x1893('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x1893('0xd')][0x7]!==_0x1893('0xe')&&process[_0x1893('0xd')][0x7]!==_0x1893('0x10')?process[_0x1893('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x1893('0xd')][0x8]===_0x1893('0xe')||process['argv'][0x8]===_0x1893('0x10')){throw new Error(_0x1893('0x13'));}var SOCKET_TIMESTAMP=process[_0x1893('0xd')][0x8];}catch(_0x5a8195){logger[_0x1893('0x14')](_0x5a8195);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(_0x13c24b,_0x424171,_0x4098ce,_0x72c18){var _0x2ed53d={'message':_0x424171};_0x2ed53d[_0x13c24b]=!![];if(_0x4098ce){_0x2ed53d['contact']=_0x4098ce;}if(_0x72c18){_0x2ed53d[_0x1893('0x15')]=_0x72c18;}return _0x2ed53d;}function isEmail(_0x1f1c4f){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))*$/[_0x1893('0x16')](_0x1f1c4f);}function checkRow(_0x5fdb89,_0x258aa4,_0x1acd79){return new BPromise(function(_0x3a9993,_0x2b1bef){if(_[_0x1893('0x17')](_0x5fdb89)){return _0x2b1bef(handleCheckRowError('error',_0x1893('0x18'),null,_0x1acd79));}if(_0x5fdb89['errors']&&_0x5fdb89[_0x1893('0x19')][_0x1893('0x1a')]){var _0x4fd705=_[_0x1893('0x1b')](_0x5fdb89['errors'],'message')['join'](';');return _0x2b1bef(handleCheckRowError('error',_0x4fd705,null,_0x1acd79));}var _0x486d78={};for(var _0x54159f in FIELDS){if(FIELDS[_0x1893('0x1c')](_0x54159f)&&FIELDS[_0x54159f]){_0x486d78[_0x54159f]=_0x5fdb89['data'][0x0][FIELDS[_0x54159f]]||_0x5fdb89['data'][0x0]['\ufeff'+FIELDS[_0x54159f]];}}if(!_0x486d78[_0x1893('0x1d')]){return _0x2b1bef(handleCheckRowError('error',_0x1893('0x1e'),null,_0x1acd79));}if(!_0x486d78[_0x1893('0x1f')]){return _0x2b1bef(handleCheckRowError(_0x1893('0x14'),_0x1893('0x20'),null,_0x1acd79));}if(_0x486d78[_0x1893('0x21')]){var _0x1c55c2=moment(_0x486d78['birthDate'],_0x1893('0x22'));if(!_0x1c55c2['isValid']()){return _0x2b1bef(handleCheckRowError(_0x1893('0x14'),_0x1893('0x23'),null,_0x1acd79));}}if(_0x486d78['email']){if(!isEmail(_0x486d78['email'])){return _0x2b1bef(handleCheckRowError(_0x1893('0x14'),_0x1893('0x24'),null,_0x1acd79));}}_0x486d78[_0x1893('0x25')]=LISTID;_0x486d78[_0x1893('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1893('0x1a')]&&_0x258aa4){var _0x1acd42={};for(var _0x36a6df=0x0,_0x44defd=DUPLICATES[_0x1893('0x1a')];_0x36a6df<_0x44defd;_0x36a6df+=0x1){_0x1acd42[DUPLICATES[_0x36a6df]]=_0x486d78[DUPLICATES[_0x36a6df]];}var _0x482e51=_[_0x1893('0x27')](_0x258aa4,_0x1acd42);if(_0x482e51){return _0x2b1bef(handleCheckRowError(_0x1893('0x28'),_0x1893('0x29'),_0x482e51,_0x1acd79));}}return db[_0x1893('0x2a')][_0x1893('0x2b')](_0x486d78,{'raw':!![],'hooks':![],'fields':_[_0x1893('0x2c')](_0x486d78)})['then'](function(_0x4fb662){if(DUPLICATES&&DUPLICATES[_0x1893('0x1a')]&&_0x258aa4){_0x258aa4[_0x1893('0x2d')](_[_0x1893('0x2e')](_0x486d78,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4fb662['id'];return _0x3a9993();})['catch'](function(_0x539d67){return _0x2b1bef(handleCheckRowError(_0x1893('0x14'),_0x1893('0x2f')+(_0x539d67[_0x1893('0x30')]||JSON[_0x1893('0x31')](_0x539d67)),null,_0x1acd79));});});}function checkHopper(){function _0x2349b2(){return function(_0x499e71){logger['error'](_0x1893('0x32'),'checkHopper',util['inspect'](_0x499e71,{'showHidden':![],'depth':null}));};}var _0x2a173b=function(_0x1bef1f,_0x299bfe){var _0x23f0e6=squel['insert']()[_0x1893('0x33')](_0x1893('0x34'))[_0x1893('0x35')]([_0x1893('0x1f'),_0x1893('0x36'),_0x1893('0x37'),_0x1893('0x25'),_0x299bfe,_0x1893('0x38'),_0x1893('0x39')],squel[_0x1893('0x3a')]()[_0x1893('0x3b')](_0x1893('0x1f'),_0x1893('0x1f'))[_0x1893('0x3b')](_0x1893('0x3c'),_0x1893('0x36'))[_0x1893('0x3b')]('id',_0x1893('0x37'))[_0x1893('0x3b')](LISTID[_0x1893('0x3d')](),_0x1893('0x25'))['field'](_0x1bef1f['id'][_0x1893('0x3d')](),_0x299bfe)[_0x1893('0x3b')]('NOW()','createdAt')[_0x1893('0x3b')]('NOW()',_0x1893('0x39'))[_0x1893('0x3e')](_0x1893('0x3f'))['where'](_0x1893('0x40'))[_0x1893('0x41')](_0x1893('0x42'),LISTID['toString']())[_0x1893('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x1893('0x41')](_0x1893('0x43'),squel[_0x1893('0x3a')]()[_0x1893('0x3b')](_0x1893('0x1f'))[_0x1893('0x3e')](_0x1893('0x34'))[_0x1893('0x41')](_0x299bfe+_0x1893('0x44'),_0x1bef1f['id'][_0x1893('0x3d')]())))['toString']();return _0x23f0e6;};var _0xb6a474=function(_0x4d6433,_0x165594){var _0x86f749=squel[_0x1893('0x45')]()[_0x1893('0x33')](_0x1893('0x34'))[_0x1893('0x35')]([_0x1893('0x1f'),_0x1893('0x36'),_0x1893('0x37'),_0x1893('0x25'),_0x165594,_0x1893('0x38'),_0x1893('0x39')],squel[_0x1893('0x3a')]()[_0x1893('0x3b')](_0x1893('0x1f'),_0x1893('0x1f'))[_0x1893('0x3b')](_0x1893('0x3c'),_0x1893('0x36'))[_0x1893('0x3b')]('id',_0x1893('0x37'))['field'](LISTID[_0x1893('0x3d')](),_0x1893('0x25'))[_0x1893('0x3b')](_0x4d6433['id'][_0x1893('0x3d')](),_0x165594)[_0x1893('0x3b')](_0x1893('0x3c'),_0x1893('0x38'))[_0x1893('0x3b')](_0x1893('0x3c'),_0x1893('0x39'))[_0x1893('0x3e')](_0x1893('0x3f'))['where'](_0x1893('0x40'))[_0x1893('0x41')](_0x1893('0x42'),LISTID[_0x1893('0x3d')]())['where'](_0x1893('0x46'),squel[_0x1893('0x47')](hopperContacts))[_0x1893('0x41')](_0x1893('0x48'))[_0x1893('0x41')](_0x1893('0x43'),squel[_0x1893('0x3a')]()[_0x1893('0x3b')](_0x1893('0x49'))[_0x1893('0x3e')](_0x1893('0x4a'))[_0x1893('0x41')](_0x165594+_0x1893('0x44'),_0x4d6433['id'][_0x1893('0x3d')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1893('0x3a')]()[_0x1893('0x3b')](_0x1893('0x1f'))[_0x1893('0x3e')]('cm_hopper')[_0x1893('0x41')](_0x165594+_0x1893('0x44'),_0x4d6433['id'][_0x1893('0x3d')]())))[_0x1893('0x3d')]();return _0x86f749;};function _0x1c98c4(_0xf6debd,_0x23a51d){var _0x591a8a=squel[_0x1893('0x45')]()['into']('cm_hopper')['fromQuery']([_0x1893('0x1f'),_0x1893('0x36'),_0x1893('0x37'),_0x1893('0x25'),_0x23a51d,_0x1893('0x38'),_0x1893('0x39')],squel['select']()[_0x1893('0x3b')]('phone',_0x1893('0x1f'))[_0x1893('0x3b')](_0x1893('0x3c'),'scheduledAt')[_0x1893('0x3b')]('id',_0x1893('0x37'))[_0x1893('0x3b')](LISTID[_0x1893('0x3d')](),_0x1893('0x25'))[_0x1893('0x3b')](_0xf6debd['id'][_0x1893('0x3d')](),_0x23a51d)[_0x1893('0x3b')](_0x1893('0x3c'),_0x1893('0x38'))[_0x1893('0x3b')](_0x1893('0x3c'),_0x1893('0x39'))[_0x1893('0x3e')]('cm_contacts')[_0x1893('0x41')]('deletedAt\x20IS\x20NULL')[_0x1893('0x41')](_0x1893('0x42'),LISTID[_0x1893('0x3d')]())[_0x1893('0x41')](_0x1893('0x46'),squel[_0x1893('0x47')](hopperContacts))[_0x1893('0x41')](_0x1893('0x48')))[_0x1893('0x3d')]();return _0x591a8a;}function _0xa63808(_0x694467,_0x29d9cd){var _0x2657e4=squel[_0x1893('0x45')]()[_0x1893('0x33')](_0x1893('0x4b'))['fromQuery'](['phone','ContactId',_0x1893('0x25'),_0x29d9cd,_0x1893('0x38'),_0x1893('0x39')],squel[_0x1893('0x3a')]()[_0x1893('0x3b')](_0x1893('0x1f'),_0x1893('0x1f'))[_0x1893('0x3b')]('id',_0x1893('0x37'))['field'](LISTID['toString'](),_0x1893('0x25'))[_0x1893('0x3b')](_0x694467['id'][_0x1893('0x3d')](),_0x29d9cd)[_0x1893('0x3b')](_0x1893('0x3c'),'createdAt')[_0x1893('0x3b')]('NOW()',_0x1893('0x39'))[_0x1893('0x3e')](_0x1893('0x3f'))['where'](_0x1893('0x40'))[_0x1893('0x41')](_0x1893('0x42'),LISTID[_0x1893('0x3d')]())[_0x1893('0x41')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1893('0x41')](_0x1893('0x48')))[_0x1893('0x3d')]();return _0x2657e4;}return db[_0x1893('0x4c')][_0x1893('0x4d')]({'where':{'type':_0x1893('0x4e')},'attributes':['id',_0x1893('0x4f')],'include':[{'model':db[_0x1893('0x50')],'as':_0x1893('0x51'),'where':{'id':LISTID}}]})[_0x1893('0x52')](function(_0x4356ba){var _0x1ad1c3=[];if(_0x4356ba){var _0x2dbc87;for(var _0xf1a69d=0x0,_0x236992;_0xf1a69d<_0x4356ba[_0x1893('0x1a')];_0xf1a69d+=0x1){_0x236992=_0x4356ba[_0xf1a69d]['get']({'plain':!![]});switch(_0x236992[_0x1893('0x4f')]){case'always':_0x1ad1c3[_0x1893('0x2d')](db['sequelize'][_0x1893('0x53')](_0xb6a474(_0x236992,_0x1893('0x54')))[_0x1893('0x52')](function(){})[_0x1893('0x55')](_0x2349b2()));break;case _0x1893('0x56'):_0x1ad1c3[_0x1893('0x2d')](db[_0x1893('0x57')]['query'](_0x2a173b(_0x236992,_0x1893('0x54')))[_0x1893('0x52')](function(){})[_0x1893('0x55')](_0x2349b2()));break;default:_0x1ad1c3[_0x1893('0x2d')](db[_0x1893('0x57')][_0x1893('0x53')](_0x1c98c4(_0x236992,_0x1893('0x54')))['then'](function(){})[_0x1893('0x55')](_0x2349b2()));}}}return _0x1ad1c3;})[_0x1893('0x58')]()[_0x1893('0x52')](function(){return db[_0x1893('0x4c')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x1893('0x50')],'as':_0x1893('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x5c54a0){var _0x14d237=[];if(_0x5c54a0){var _0x561d41;for(var _0x22715b=0x0,_0x616f7f;_0x22715b<_0x5c54a0[_0x1893('0x1a')];_0x22715b+=0x1){_0x616f7f=_0x5c54a0[_0x22715b][_0x1893('0x5a')]({'plain':!![]});_0x14d237[_0x1893('0x2d')](db['sequelize'][_0x1893('0x53')](_0xa63808(_0x616f7f,_0x1893('0x54')))[_0x1893('0x52')](function(){})[_0x1893('0x55')](_0x2349b2()));}}return _0x14d237;})[_0x1893('0x58')]();})['then'](function(){return db[_0x1893('0x5b')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x1893('0x50')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x47f75c){var _0x107af5=[];if(_0x47f75c){for(var _0x4bd905=0x0,_0x5cc5d4;_0x4bd905<_0x47f75c[_0x1893('0x1a')];_0x4bd905+=0x1){_0x5cc5d4=_0x47f75c[_0x4bd905]['get']({'plain':!![]});switch(_0x5cc5d4['dialCheckDuplicateType']){case _0x1893('0x5c'):_0x107af5[_0x1893('0x2d')](db[_0x1893('0x57')][_0x1893('0x53')](_0xb6a474(_0x5cc5d4,'CampaignId'))[_0x1893('0x52')](function(){})['catch'](_0x2349b2()));break;case _0x1893('0x56'):_0x107af5[_0x1893('0x2d')](db['sequelize'][_0x1893('0x53')](_0x2a173b(_0x5cc5d4,_0x1893('0x5d')))['then'](function(){})[_0x1893('0x55')](_0x2349b2()));break;default:_0x107af5[_0x1893('0x2d')](db[_0x1893('0x57')][_0x1893('0x53')](_0x1c98c4(_0x5cc5d4,_0x1893('0x5d')))[_0x1893('0x52')](function(){})[_0x1893('0x55')](_0x2349b2()));}}}return _0x107af5;})[_0x1893('0x58')]();})[_0x1893('0x52')](function(){return db[_0x1893('0x5b')][_0x1893('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x1893('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x1893('0x52')](function(_0x2e3774){var _0x5c5701=[];if(_0x2e3774){for(var _0x1c451b=0x0,_0x1a731a;_0x1c451b<_0x2e3774['length'];_0x1c451b+=0x1){_0x1a731a=_0x2e3774[_0x1c451b][_0x1893('0x5a')]({'plain':!![]});_0x5c5701['push'](db['sequelize'][_0x1893('0x53')](_0xa63808(_0x1a731a,_0x1893('0x5d')))[_0x1893('0x52')](function(){})[_0x1893('0x55')](_0x2349b2()));}}return _0x5c5701;})['all']();})['catch'](function(_0x12ec5b){logger['error'](_0x1893('0x5e'),_0x1893('0x5f'),_0x12ec5b[_0x1893('0x30')]);});}var processPromises=function(_0x1ec326){return BPromise[_0x1893('0x58')](promises)[_0x1893('0x52')](function(_0x33b74f){})['catch'](function(_0xbfe462){logger['error'](_0x1893('0x60'),JSON[_0x1893('0x31')](_0xbfe462));})[_0x1893('0x61')](function(){socket[_0x1893('0x62')](_0x1893('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1ec326){return _0x1ec326[_0x1893('0x64')]();}});};var endCsv=function(){return BPromise[_0x1893('0x65')]()[_0x1893('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0x1893('0x52')](function(){socket[_0x1893('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1893('0x66')](FILEPATH);}catch(_0x599420){logger[_0x1893('0x14')](_0x1893('0x67'),JSON['stringify'](_0x599420));}finally{process[_0x1893('0x68')](0x0);}});};process['on'](_0x1893('0x69'),function(){logger[_0x1893('0x6a')](_0x1893('0x6b'));endCsv();});function main(){return BPromise[_0x1893('0x65')]()[_0x1893('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1893('0x11')](',');return db[_0x1893('0x2a')][_0x1893('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x435078){var _0x49dc7e=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x49dc7e,{'header':!![],'skipEmptyLines':!![],'step':function(_0xb0bb55,_0x3245e5){total+=0x1;var _0x2713f3=total;promises[_0x1893('0x2d')](checkRow(_0xb0bb55,_0x435078,_0x2713f3)[_0x1893('0x52')](function(){success+=0x1;})['catch'](function(_0x9aa52d){if(_0x9aa52d[_0x1893('0x14')]){errors+=0x1;delete _0x9aa52d['error'];}else if(_0x9aa52d[_0x1893('0x28')]){duplicates+=0x1;delete _0x9aa52d[_0x1893('0x28')];}rows[_0x1893('0x2d')](_0x9aa52d);}));if(total%0xc8===0x0){_0x3245e5[_0x1893('0x6c')]();return processPromises(_0x3245e5);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x1893('0x6d'));endCsv();});},'error':function(_0x852a16,_0x362018){logger['info'](_0x1893('0x6e'),JSON['stringify'](_0x852a16));endCsv();}});})[_0x1893('0x55')](function(_0x475fd0){logger[_0x1893('0x14')](_0x1893('0x6f'),JSON['stringify'](_0x475fd0));});}main(); \ No newline at end of file +var _0xdb5b=['ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','message','stringify','insert','into','fromQuery','phone','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','updatedAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','query','onlyIfOpen','sequelize','VoiceQueueId','catch','all','Campaign','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','bluebird','lodash','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','error','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0xdb5b,0x194));var _0xbdb5=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xdb5b[_0x2b7764];return _0x848dcb;};'use strict';var BPromise=require(_0xbdb5('0x0'));var util=require('util');var _=require(_0xbdb5('0x1'));var fs=require('fs');var squel=require(_0xbdb5('0x2'));var Papa=require(_0xbdb5('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xbdb5('0x4'));var logger=require(_0xbdb5('0x5'))(_0xbdb5('0x6'));config[_0xbdb5('0x7')]=_[_0xbdb5('0x8')](config[_0xbdb5('0x7')],{'host':_0xbdb5('0x9'),'port':0x18eb});var socket=require(_0xbdb5('0xa'))(new Redis(config[_0xbdb5('0x7')]));require(_0xbdb5('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process[_0xbdb5('0xc')][0x2]===_0xbdb5('0xd')||process[_0xbdb5('0xc')][0x2]===_0xbdb5('0xe')){throw new Error(_0xbdb5('0xf'));}var FILEPATH=process[_0xbdb5('0xc')][0x2];if(!process[_0xbdb5('0xc')][0x3]||process[_0xbdb5('0xc')][0x3]===_0xbdb5('0xd')||process['argv'][0x3]===_0xbdb5('0xe')||!process[_0xbdb5('0xc')][0x4]||process[_0xbdb5('0xc')][0x4]===_0xbdb5('0xd')||process[_0xbdb5('0xc')][0x4]===_0xbdb5('0xe')){throw new Error(_0xbdb5('0x10'));}var FIELDS=_[_0xbdb5('0x11')](process[_0xbdb5('0xc')][0x3][_0xbdb5('0x12')](','),process['argv'][0x4]['split'](','));if(!process[_0xbdb5('0xc')][0x5]||process[_0xbdb5('0xc')][0x5]==='undefined'||process['argv'][0x5]===_0xbdb5('0xe')){throw new Error(_0xbdb5('0x13'));}var LISTID=process[_0xbdb5('0xc')][0x5];var COMPANYID=process[_0xbdb5('0xc')][0x6]&&process[_0xbdb5('0xc')][0x6]!==_0xbdb5('0xd')&&process[_0xbdb5('0xc')][0x6]!==_0xbdb5('0xe')?process[_0xbdb5('0xc')][0x6]:null;var DUPLICATES=process[_0xbdb5('0xc')][0x7]&&process['argv'][0x7]!==_0xbdb5('0xd')&&process[_0xbdb5('0xc')][0x7]!==_0xbdb5('0xe')?process['argv'][0x7]:null;if(!process[_0xbdb5('0xc')][0x8]||process[_0xbdb5('0xc')][0x8]===_0xbdb5('0xd')||process[_0xbdb5('0xc')][0x8]===_0xbdb5('0xe')){throw new Error(_0xbdb5('0x14'));}var SOCKET_TIMESTAMP=process[_0xbdb5('0xc')][0x8];}catch(_0x3704e1){logger['error'](_0x3704e1);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(_0x5dc1b0,_0xefb564,_0x3e138a,_0x19f6c9){var _0x559a8c={'message':_0xefb564};_0x559a8c[_0x5dc1b0]=!![];if(_0x3e138a){_0x559a8c['contact']=_0x3e138a;}if(_0x19f6c9){_0x559a8c[_0xbdb5('0x15')]=_0x19f6c9;}return _0x559a8c;}function isEmail(_0x452c7f){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))*$/[_0xbdb5('0x16')](_0x452c7f);}function checkRow(_0x348a8a,_0x4c05df,_0x3c00f6){return new BPromise(function(_0x37ced0,_0x4f6649){if(_[_0xbdb5('0x17')](_0x348a8a)){return _0x4f6649(handleCheckRowError('error',_0xbdb5('0x18'),null,_0x3c00f6));}if(_0x348a8a[_0xbdb5('0x19')]&&_0x348a8a['errors']['length']){var _0x31549f=_[_0xbdb5('0x1a')](_0x348a8a[_0xbdb5('0x19')],'message')[_0xbdb5('0x1b')](';');return _0x4f6649(handleCheckRowError(_0xbdb5('0x1c'),_0x31549f,null,_0x3c00f6));}var _0x55dce6={};for(var _0x2c7c54 in FIELDS){if(FIELDS[_0xbdb5('0x1d')](_0x2c7c54)&&FIELDS[_0x2c7c54]){_0x55dce6[_0x2c7c54]=_0x348a8a[_0xbdb5('0x1e')][0x0][FIELDS[_0x2c7c54]]||_0x348a8a['data'][0x0]['\ufeff'+FIELDS[_0x2c7c54]];}}if(!_0x55dce6[_0xbdb5('0x1f')]){return _0x4f6649(handleCheckRowError('error',_0xbdb5('0x20'),null,_0x3c00f6));}if(!_0x55dce6['phone']){return _0x4f6649(handleCheckRowError(_0xbdb5('0x1c'),'phone\x20not\x20specified!',null,_0x3c00f6));}if(_0x55dce6['birthDate']){var _0x4047b0=moment(_0x55dce6['birthDate'],'YYYY-MM-DD');if(!_0x4047b0['isValid']()){return _0x4f6649(handleCheckRowError(_0xbdb5('0x1c'),_0xbdb5('0x21'),null,_0x3c00f6));}}if(_0x55dce6[_0xbdb5('0x22')]){if(!isEmail(_0x55dce6['email'])){return _0x4f6649(handleCheckRowError(_0xbdb5('0x1c'),_0xbdb5('0x23'),null,_0x3c00f6));}}_0x55dce6[_0xbdb5('0x24')]=LISTID;_0x55dce6['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4c05df){var _0x17a7db={};for(var _0x4a583c=0x0,_0x14b84b=DUPLICATES[_0xbdb5('0x25')];_0x4a583c<_0x14b84b;_0x4a583c+=0x1){_0x17a7db[DUPLICATES[_0x4a583c]]=_0x55dce6[DUPLICATES[_0x4a583c]];}var _0x52e2a9=_[_0xbdb5('0x26')](_0x4c05df,_0x17a7db);if(_0x52e2a9){return _0x4f6649(handleCheckRowError(_0xbdb5('0x27'),_0xbdb5('0x28'),_0x52e2a9,_0x3c00f6));}}return db[_0xbdb5('0x29')][_0xbdb5('0x2a')](_0x55dce6,{'raw':!![],'hooks':![],'fields':_[_0xbdb5('0x2b')](_0x55dce6)})['then'](function(_0x54a96b){if(DUPLICATES&&DUPLICATES['length']&&_0x4c05df){_0x4c05df[_0xbdb5('0x2c')](_[_0xbdb5('0x2d')](_0x55dce6,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x54a96b['id'];return _0x37ced0();})['catch'](function(_0x13fbd7){return _0x4f6649(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x13fbd7[_0xbdb5('0x2e')]||JSON[_0xbdb5('0x2f')](_0x13fbd7)),null,_0x3c00f6));});});}function checkHopper(){function _0x387f09(){return function(_0x86170e){logger[_0xbdb5('0x1c')]('cmContact','checkHopper',util['inspect'](_0x86170e,{'showHidden':![],'depth':null}));};}var _0x29475b=function(_0x5897f7,_0x400ac8){var _0x3c1f39=squel[_0xbdb5('0x30')]()[_0xbdb5('0x31')]('cm_hopper')[_0xbdb5('0x32')]([_0xbdb5('0x33'),_0xbdb5('0x34'),_0xbdb5('0x35'),'ListId',_0x400ac8,_0xbdb5('0x36'),'updatedAt'],squel[_0xbdb5('0x37')]()[_0xbdb5('0x38')](_0xbdb5('0x33'),_0xbdb5('0x33'))['field'](_0xbdb5('0x39'),_0xbdb5('0x34'))[_0xbdb5('0x38')]('id',_0xbdb5('0x35'))[_0xbdb5('0x38')](LISTID[_0xbdb5('0x3a')](),_0xbdb5('0x24'))[_0xbdb5('0x38')](_0x5897f7['id'][_0xbdb5('0x3a')](),_0x400ac8)[_0xbdb5('0x38')]('NOW()',_0xbdb5('0x36'))[_0xbdb5('0x38')](_0xbdb5('0x39'),'updatedAt')[_0xbdb5('0x3b')](_0xbdb5('0x3c'))[_0xbdb5('0x3d')](_0xbdb5('0x3e'))['where'](_0xbdb5('0x3f'),LISTID[_0xbdb5('0x3a')]())[_0xbdb5('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xbdb5('0x3d')](_0xbdb5('0x40'),squel[_0xbdb5('0x37')]()[_0xbdb5('0x38')](_0xbdb5('0x33'))[_0xbdb5('0x3b')](_0xbdb5('0x41'))[_0xbdb5('0x3d')](_0x400ac8+'\x20=\x20?',_0x5897f7['id'][_0xbdb5('0x3a')]())))[_0xbdb5('0x3a')]();return _0x3c1f39;};var _0x42a4b3=function(_0x1dfe24,_0xc5df13){var _0x33a0d=squel[_0xbdb5('0x30')]()[_0xbdb5('0x31')](_0xbdb5('0x41'))[_0xbdb5('0x32')](['phone',_0xbdb5('0x34'),'ContactId',_0xbdb5('0x24'),_0xc5df13,_0xbdb5('0x36'),_0xbdb5('0x42')],squel[_0xbdb5('0x37')]()[_0xbdb5('0x38')](_0xbdb5('0x33'),_0xbdb5('0x33'))[_0xbdb5('0x38')](_0xbdb5('0x39'),'scheduledAt')['field']('id','ContactId')['field'](LISTID[_0xbdb5('0x3a')](),_0xbdb5('0x24'))[_0xbdb5('0x38')](_0x1dfe24['id'][_0xbdb5('0x3a')](),_0xc5df13)['field'](_0xbdb5('0x39'),'createdAt')[_0xbdb5('0x38')](_0xbdb5('0x39'),'updatedAt')['from'](_0xbdb5('0x3c'))[_0xbdb5('0x3d')](_0xbdb5('0x3e'))['where']('ListId\x20=\x20?',LISTID[_0xbdb5('0x3a')]())[_0xbdb5('0x3d')](_0xbdb5('0x43'),squel[_0xbdb5('0x44')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xbdb5('0x3d')](_0xbdb5('0x40'),squel[_0xbdb5('0x37')]()[_0xbdb5('0x38')](_0xbdb5('0x45'))[_0xbdb5('0x3b')](_0xbdb5('0x46'))[_0xbdb5('0x3d')](_0xc5df13+_0xbdb5('0x47'),_0x1dfe24['id'][_0xbdb5('0x3a')]()))[_0xbdb5('0x3d')](_0xbdb5('0x40'),squel[_0xbdb5('0x37')]()['field'](_0xbdb5('0x33'))[_0xbdb5('0x3b')](_0xbdb5('0x41'))['where'](_0xc5df13+'\x20=\x20?',_0x1dfe24['id']['toString']())))['toString']();return _0x33a0d;};function _0x15fd64(_0x4f10f1,_0x13f235){var _0x45aac7=squel['insert']()[_0xbdb5('0x31')](_0xbdb5('0x41'))[_0xbdb5('0x32')](['phone',_0xbdb5('0x34'),_0xbdb5('0x35'),'ListId',_0x13f235,'createdAt',_0xbdb5('0x42')],squel[_0xbdb5('0x37')]()[_0xbdb5('0x38')](_0xbdb5('0x33'),'phone')[_0xbdb5('0x38')](_0xbdb5('0x39'),_0xbdb5('0x34'))[_0xbdb5('0x38')]('id','ContactId')[_0xbdb5('0x38')](LISTID[_0xbdb5('0x3a')](),_0xbdb5('0x24'))[_0xbdb5('0x38')](_0x4f10f1['id'][_0xbdb5('0x3a')](),_0x13f235)[_0xbdb5('0x38')]('NOW()',_0xbdb5('0x36'))[_0xbdb5('0x38')](_0xbdb5('0x39'),_0xbdb5('0x42'))['from']('cm_contacts')[_0xbdb5('0x3d')](_0xbdb5('0x3e'))[_0xbdb5('0x3d')](_0xbdb5('0x3f'),LISTID[_0xbdb5('0x3a')]())[_0xbdb5('0x3d')](_0xbdb5('0x43'),squel[_0xbdb5('0x44')](hopperContacts))[_0xbdb5('0x3d')](_0xbdb5('0x48')))[_0xbdb5('0x3a')]();return _0x45aac7;}function _0x2a2f31(_0x2edd9e,_0x4a7f8c){var _0x41886c=squel['insert']()[_0xbdb5('0x31')](_0xbdb5('0x49'))[_0xbdb5('0x32')]([_0xbdb5('0x33'),_0xbdb5('0x35'),_0xbdb5('0x24'),_0x4a7f8c,_0xbdb5('0x36'),_0xbdb5('0x42')],squel[_0xbdb5('0x37')]()['field'](_0xbdb5('0x33'),'phone')['field']('id',_0xbdb5('0x35'))['field'](LISTID['toString'](),_0xbdb5('0x24'))[_0xbdb5('0x38')](_0x2edd9e['id']['toString'](),_0x4a7f8c)[_0xbdb5('0x38')](_0xbdb5('0x39'),_0xbdb5('0x36'))['field'](_0xbdb5('0x39'),_0xbdb5('0x42'))[_0xbdb5('0x3b')](_0xbdb5('0x3c'))[_0xbdb5('0x3d')](_0xbdb5('0x3e'))[_0xbdb5('0x3d')](_0xbdb5('0x3f'),LISTID[_0xbdb5('0x3a')]())[_0xbdb5('0x3d')]('id\x20IN\x20?',squel[_0xbdb5('0x44')](hopperContacts))[_0xbdb5('0x3d')](_0xbdb5('0x48')))[_0xbdb5('0x3a')]();return _0x41886c;}return db[_0xbdb5('0x4a')][_0xbdb5('0x4b')]({'where':{'type':_0xbdb5('0x4c')},'attributes':['id',_0xbdb5('0x4d')],'include':[{'model':db[_0xbdb5('0x4e')],'as':_0xbdb5('0x4f'),'where':{'id':LISTID}}]})[_0xbdb5('0x50')](function(_0x3f4200){var _0xd25404=[];if(_0x3f4200){var _0x112377;for(var _0x272baa=0x0,_0x45c186;_0x272baa<_0x3f4200[_0xbdb5('0x25')];_0x272baa+=0x1){_0x45c186=_0x3f4200[_0x272baa][_0xbdb5('0x51')]({'plain':!![]});switch(_0x45c186[_0xbdb5('0x4d')]){case _0xbdb5('0x52'):_0xd25404[_0xbdb5('0x2c')](db['sequelize'][_0xbdb5('0x53')](_0x42a4b3(_0x45c186,'VoiceQueueId'))['then'](function(){})['catch'](_0x387f09()));break;case _0xbdb5('0x54'):_0xd25404['push'](db[_0xbdb5('0x55')][_0xbdb5('0x53')](_0x29475b(_0x45c186,_0xbdb5('0x56')))[_0xbdb5('0x50')](function(){})[_0xbdb5('0x57')](_0x387f09()));break;default:_0xd25404[_0xbdb5('0x2c')](db[_0xbdb5('0x55')][_0xbdb5('0x53')](_0x15fd64(_0x45c186,'VoiceQueueId'))[_0xbdb5('0x50')](function(){})[_0xbdb5('0x57')](_0x387f09()));}}}return _0xd25404;})[_0xbdb5('0x58')]()['then'](function(){return db['VoiceQueue'][_0xbdb5('0x4b')]({'where':{'type':_0xbdb5('0x4c')},'attributes':['id'],'include':[{'model':db[_0xbdb5('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x4d0152){var _0x4e9200=[];if(_0x4d0152){var _0x37c6fd;for(var _0x4b9707=0x0,_0x20cb35;_0x4b9707<_0x4d0152[_0xbdb5('0x25')];_0x4b9707+=0x1){_0x20cb35=_0x4d0152[_0x4b9707]['get']({'plain':!![]});_0x4e9200['push'](db[_0xbdb5('0x55')]['query'](_0x2a2f31(_0x20cb35,_0xbdb5('0x56')))['then'](function(){})[_0xbdb5('0x57')](_0x387f09()));}}return _0x4e9200;})['all']();})[_0xbdb5('0x50')](function(){return db[_0xbdb5('0x59')][_0xbdb5('0x4b')]({'attributes':['id',_0xbdb5('0x4d')],'include':[{'model':db['CmList'],'as':_0xbdb5('0x4f'),'where':{'id':LISTID}}]})[_0xbdb5('0x50')](function(_0x31e1c1){var _0x29731e=[];if(_0x31e1c1){for(var _0x5eae89=0x0,_0x1b6b81;_0x5eae89<_0x31e1c1[_0xbdb5('0x25')];_0x5eae89+=0x1){_0x1b6b81=_0x31e1c1[_0x5eae89]['get']({'plain':!![]});switch(_0x1b6b81['dialCheckDuplicateType']){case _0xbdb5('0x52'):_0x29731e['push'](db[_0xbdb5('0x55')][_0xbdb5('0x53')](_0x42a4b3(_0x1b6b81,'CampaignId'))['then'](function(){})[_0xbdb5('0x57')](_0x387f09()));break;case'onlyIfOpen':_0x29731e['push'](db[_0xbdb5('0x55')]['query'](_0x29475b(_0x1b6b81,_0xbdb5('0x5a')))[_0xbdb5('0x50')](function(){})[_0xbdb5('0x57')](_0x387f09()));break;default:_0x29731e[_0xbdb5('0x2c')](db['sequelize'][_0xbdb5('0x53')](_0x15fd64(_0x1b6b81,_0xbdb5('0x5a')))[_0xbdb5('0x50')](function(){})[_0xbdb5('0x57')](_0x387f09()));}}}return _0x29731e;})['all']();})[_0xbdb5('0x50')](function(){return db[_0xbdb5('0x59')][_0xbdb5('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xbdb5('0x4e')],'as':_0xbdb5('0x5b'),'where':{'id':LISTID}}]})[_0xbdb5('0x50')](function(_0x184944){var _0x36dab9=[];if(_0x184944){for(var _0x2d42d9=0x0,_0x17e062;_0x2d42d9<_0x184944[_0xbdb5('0x25')];_0x2d42d9+=0x1){_0x17e062=_0x184944[_0x2d42d9][_0xbdb5('0x51')]({'plain':!![]});_0x36dab9['push'](db['sequelize'][_0xbdb5('0x53')](_0x2a2f31(_0x17e062,_0xbdb5('0x5a')))[_0xbdb5('0x50')](function(){})[_0xbdb5('0x57')](_0x387f09()));}}return _0x36dab9;})[_0xbdb5('0x58')]();})[_0xbdb5('0x57')](function(_0x2bfb14){logger[_0xbdb5('0x1c')]('cmContact,\x20%s,\x20%s',_0xbdb5('0x5c'),_0x2bfb14['message']);});}var processPromises=function(_0x55e6f7){return BPromise[_0xbdb5('0x58')](promises)['then'](function(_0x17e6f7){})[_0xbdb5('0x57')](function(_0x23b970){logger[_0xbdb5('0x1c')](_0xbdb5('0x5d'),JSON[_0xbdb5('0x2f')](_0x23b970));})[_0xbdb5('0x5e')](function(){socket[_0xbdb5('0x5f')](_0xbdb5('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x55e6f7){return _0x55e6f7[_0xbdb5('0x61')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xbdb5('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0xbdb5('0x50')](function(){socket[_0xbdb5('0x5f')](_0xbdb5('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xbdb5('0x62')](FILEPATH);}catch(_0xf1a061){logger[_0xbdb5('0x1c')](_0xbdb5('0x63'),JSON[_0xbdb5('0x2f')](_0xf1a061));}finally{process[_0xbdb5('0x64')](0x0);}});};process['on'](_0xbdb5('0x65'),function(){logger['info'](_0xbdb5('0x66'));endCsv();});function main(){return BPromise[_0xbdb5('0x67')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xbdb5('0x12')](',');return db['CmContact'][_0xbdb5('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbdb5('0x50')](function(_0x39754f){var _0x5906d9=fs[_0xbdb5('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xbdb5('0x69')](_0x5906d9,{'header':!![],'skipEmptyLines':!![],'step':function(_0x430529,_0x567494){total+=0x1;var _0x1c522b=total;promises['push'](checkRow(_0x430529,_0x39754f,_0x1c522b)[_0xbdb5('0x50')](function(){success+=0x1;})[_0xbdb5('0x57')](function(_0x27473a){if(_0x27473a['error']){errors+=0x1;delete _0x27473a[_0xbdb5('0x1c')];}else if(_0x27473a[_0xbdb5('0x27')]){duplicates+=0x1;delete _0x27473a[_0xbdb5('0x27')];}rows[_0xbdb5('0x2c')](_0x27473a);}));if(total%0xc8===0x0){_0x567494[_0xbdb5('0x6a')]();return processPromises(_0x567494);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0xbdb5('0x6b'));endCsv();});},'error':function(_0x3ae41b,_0x4668ef){logger[_0xbdb5('0x6c')](_0xbdb5('0x6d'),JSON['stringify'](_0x3ae41b));endCsv();}});})[_0xbdb5('0x57')](function(_0x1e68fb){logger[_0xbdb5('0x1c')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xbdb5('0x2f')](_0x1e68fb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 108616b..084f622 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 _0xeab3=['id\x20IN\x20?','MIN(id)','min_id','group','info','message','exit','code','sequelize','query','spread','push','catch','error','main','send','start','.csv','writeFileSync','parse','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','length','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','CampaignId','each','then','finish','affectedRows','unlink','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','localhost','socket.io-emitter','format','test','select','field','phone','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','priority','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.updatedAt','into','updatedAt','cm_contacts','.id\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','createdAt',')\x20NOT\x20IN\x20?'];(function(_0xfa73ac,_0x2a7395){var _0x4e8e14=function(_0x9b5698){while(--_0x9b5698){_0xfa73ac['push'](_0xfa73ac['shift']());}};_0x4e8e14(++_0x2a7395);}(_0xeab3,0x143));var _0x3eab=function(_0x5cb634,_0x3fd713){_0x5cb634=_0x5cb634-0x0;var _0x2369f6=_0xeab3[_0x5cb634];return _0x2369f6;};'use strict';var fs=require('fs');var path=require(_0x3eab('0x0'));var _=require(_0x3eab('0x1'));var Papa=require(_0x3eab('0x2'));var util=require(_0x3eab('0x3'));var BPromise=require(_0x3eab('0x4'));var moment=require(_0x3eab('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x3eab('0x6'))['db'];var config=require(_0x3eab('0x7'));var logger=require(_0x3eab('0x8'))('import');config['redis']=_['defaults'](config['redis'],{'host':_0x3eab('0x9'),'port':0x18eb});var socket=require(_0x3eab('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x3eab('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x227a55){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))*$/[_0x3eab('0xc')](_0x227a55);}function selectNotIn(_0x468157,_0x31ae86,_0x5eeda5,_0x47bf7c,_0x3d1dda){return squel[_0x3eab('0xd')]()[_0x3eab('0xe')](_0x3eab('0xf'))['from'](_0x47bf7c)['join'](_0x31ae86,null,_0x31ae86+'.id\x20=\x20'+_0x47bf7c+'.'+_0x5eeda5)[_0x3eab('0x10')](_0x47bf7c+'.'+_0x5eeda5+_0x3eab('0x11')+_0x468157+'.'+_0x5eeda5)[_0x3eab('0x10')](_0x31ae86+_0x3eab('0x12')+_0x3d1dda[_0x3eab('0x13')]()+')');}function insertCmHopper(_0x3cabc3,_0x23cd7b,_0x3549c2,_0x4cfe55,_0x4a019f){var _0x24bf35=[_0x3eab('0x14'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x23cd7b+'.'+_0x4cfe55,_0x3eab('0x15'),'cm_contacts.updatedAt',_0x3eab('0x16'),_0x3eab('0x17'),'\x22'+_0x4a019f+'\x22'];return squel['insert']()['into'](_0x3eab('0x18'))[_0x3eab('0x19')]([_0x3eab('0xf'),_0x3eab('0x1a'),_0x3eab('0x1b'),_0x3eab('0x1c'),_0x4cfe55,'createdAt','updatedAt',_0x3eab('0x1d'),'UserId',_0x3eab('0x1e')],squel[_0x3eab('0xd')]()[_0x3eab('0x1f')](_0x24bf35)[_0x3eab('0x20')](_0x23cd7b)['join']('cm_contacts',null,_0x3eab('0x21')+_0x23cd7b+_0x3eab('0x22'))['join'](_0x3549c2,null,_0x3549c2+'.id\x20=\x20'+_0x23cd7b+'.'+_0x4cfe55)[_0x3eab('0x10')](_0x23cd7b+'.CmListId\x20=\x20?',_0x3cabc3)[_0x3eab('0x10')](_0x3eab('0x23'),NOW)['where'](_0x3eab('0x24'),selectNotIn(_0x23cd7b,_0x3549c2,_0x4cfe55,'cm_hopper',['\x22always\x22',_0x3eab('0x25')]))[_0x3eab('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x23cd7b,_0x3549c2,_0x4cfe55,_0x3eab('0x18'),['\x22always\x22'])))[_0x3eab('0x26')]();}function insertCmHopperBlack(_0xc12ae,_0xa4566d,_0x3e12d7,_0x4e692b){var _0x367b64=[_0x3eab('0x14'),_0x3eab('0x27'),'cm_contacts.ListId',_0xa4566d+'.'+_0x4e692b,_0x3eab('0x15'),_0x3eab('0x28')];return squel['insert']()[_0x3eab('0x29')]('cm_hopper_black')[_0x3eab('0x19')]([_0x3eab('0xf'),'ContactId','ListId',_0x4e692b,'createdAt',_0x3eab('0x2a')],squel[_0x3eab('0xd')]()['fields'](_0x367b64)[_0x3eab('0x20')](_0xa4566d)[_0x3eab('0x13')](_0x3eab('0x2b'),null,_0x3eab('0x21')+_0xa4566d+'.CmListId')[_0x3eab('0x13')](_0x3e12d7,null,_0x3e12d7+_0x3eab('0x2c')+_0xa4566d+'.'+_0x4e692b)[_0x3eab('0x10')](_0xa4566d+_0x3eab('0x2d'),_0xc12ae)[_0x3eab('0x10')](_0x3eab('0x23'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x3eab('0xd')]()[_0x3eab('0xe')]('phone')[_0x3eab('0x20')]('cm_hopper_black')['where'](_0x3eab('0x2e'),_0xc12ae)['where'](_0x4e692b+_0x3eab('0x2f'),_0xa4566d+'.'+_0x4e692b)))[_0x3eab('0x26')]();}function insertCmContact(_0x204b3d,_0x580007,_0x3698a5,_0x5caca2){var _0xe2f747=_['concat'](_[_0x3eab('0x30')](_0x5caca2),[_0x3eab('0x1c'),_0x3eab('0x31'),_0x3eab('0x32'),_0x3eab('0x2a')]);return squel['insert']()[_0x3eab('0x29')](_0x3eab('0x2b'))['fromQuery'](_0xe2f747,squel['select']()['fields'](_0xe2f747)[_0x3eab('0x20')](_0x580007)[_0x3eab('0x10')]('('+_0x3698a5[_0x3eab('0x13')](',')+_0x3eab('0x33'),squel[_0x3eab('0xd')]()[_0x3eab('0x1f')](_0x3698a5)[_0x3eab('0x20')](_0x3eab('0x2b'))[_0x3eab('0x10')](_0x3eab('0x2e'),_0x204b3d)[_0x3eab('0x10')]('deletedAt\x20IS\x20NULL'))[_0x3eab('0x10')](_0x3eab('0x34'),squel[_0x3eab('0xd')]()['field'](_0x3eab('0x35'),_0x3eab('0x36'))['from'](_0x580007)[_0x3eab('0x37')](_0x3698a5[_0x3eab('0x13')](','))))[_0x3eab('0x26')]();}function handleStop(){logger[_0x3eab('0x38')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x440987){logger['error'](_0x440987[_0x3eab('0x39')]);process[_0x3eab('0x3a')](0x1);}function handleError(_0x2db9b5,_0x513ffe){stats['errors']['push']({'name':_0x513ffe[_0x3eab('0x3b')],'message':_0x513ffe[_0x3eab('0x39')],'row':_0x2db9b5});}function handleQuery(_0x39c214){logger[_0x3eab('0x38')](_0x39c214);return db[_0x3eab('0x3c')][_0x3eab('0x3d')](_0x39c214)[_0x3eab('0x3e')](function(_0x428b59){results[_0x3eab('0x3f')](_0x428b59);})[_0x3eab('0x40')](function(_0x5b09bb){logger[_0x3eab('0x41')](_0x5b09bb[_0x3eab('0x39')]);});}function main(_0x2f6bbc,_0x1005e0,_0x4ebb82,_0x44f40d){logger[_0x3eab('0x38')](_0x3eab('0x42'),_0x2f6bbc,JSON['stringify'](_0x1005e0));process[_0x3eab('0x43')](_0x3eab('0x44'));var _0xae51f6=_0x1005e0['binding'];var _0x50992c=_0x1005e0['socket_timestamp'];var _0x17e604=path['join'](config['root'],'server/files/tmp',_0x50992c+_0x3eab('0x45'));var _0xdd1ae6=_[_0x3eab('0x30')](_0xae51f6)[_0x3eab('0x13')]();logger['info']('header',_0xdd1ae6);fs[_0x3eab('0x46')](_0x17e604,_0xdd1ae6+'\x0a');Papa[_0x3eab('0x47')](fs[_0x3eab('0x48')](_0x2f6bbc),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d2553,_0x8854d7){try{for(var _0xb9adf4=0x0,_0xd5c3f8=[];_0xb9adf4<_0x5d2553[_0x3eab('0x49')]['length'];_0xb9adf4++){stats[_0x3eab('0x4a')]+=0x1;if(_0x5d2553[_0x3eab('0x4b')][_0xb9adf4]){handleError(_0x5d2553['data'][_0xb9adf4],_0x5d2553['errors'][_0xb9adf4]);}else{var _0x2e1bd9=[];for(var _0x39e674 in _0xae51f6){if(_0xae51f6[_0x3eab('0x4c')](_0x39e674)){if(_0x5d2553[_0x3eab('0x49')][_0xb9adf4][_0xae51f6[_0x39e674]]){var _0x2181d9=_[_0x3eab('0x4d')](_0x5d2553[_0x3eab('0x49')][_0xb9adf4][_0xae51f6[_0x39e674]][_0x3eab('0x4e')](/"/g,'\x27'));switch(_0x39e674){case _0x3eab('0x1a'):var _0x467e54=moment(_0x2181d9,_0x3eab('0x4f'),!![]);if(_0x467e54['isValid']()){_0xd5c3f8[_0x3eab('0x3f')]('\x22'+_0x2181d9+'\x22');}else{_0x2e1bd9[_0x3eab('0x3f')](_0x3eab('0x50'));}break;case _0x3eab('0x1d'):var _0x270416=parseInt(_0x2181d9);_0x2181d9=_['isNaN'](_0x270416)||_0x270416<0x0||_0x270416>0x4?_0x44f40d?0x3:0x2:_0x270416;_0xd5c3f8[_0x3eab('0x3f')]('\x22'+_0x2181d9+'\x22');break;case _0x3eab('0x51'):var _0x5f0cc8=parseInt(_0x2181d9);if(_[_0x3eab('0x52')](_0x5f0cc8)&&_['includes'](_0x4ebb82,_0x5f0cc8)){_0xd5c3f8[_0x3eab('0x3f')]('\x22'+_0x5f0cc8+'\x22');}else{_0x2e1bd9[_0x3eab('0x3f')]('agent\x20not\x20exists');}break;case _0x3eab('0x53'):if(isEmail(_0x2181d9)){_0xd5c3f8[_0x3eab('0x3f')]('\x22'+_0x2181d9+'\x22');}else{_0x2e1bd9['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2016d4=moment(_0x2181d9,_0x3eab('0x54'),!![]);if(_0x2016d4[_0x3eab('0x55')]()){_0xd5c3f8[_0x3eab('0x3f')]('\x22'+_0x2181d9+'\x22');}else{_0x2e1bd9[_0x3eab('0x3f')](_0x3eab('0x56'));}break;default:_0xd5c3f8[_0x3eab('0x3f')]('\x22'+_0x2181d9+'\x22');}}else{switch(_0x39e674){case _0x3eab('0x57'):case _0x3eab('0xf'):_0x2e1bd9[_0x3eab('0x3f')](_0x39e674+_0x3eab('0x58'));break;default:_0xd5c3f8['push']('\x22\x22');}}}}if(_0x2e1bd9['length']){handleError(_0x5d2553['data'][_0xb9adf4],{'code':_0x3eab('0x59'),'message':_0x2e1bd9[_0x3eab('0x13')]()});}else{fs[_0x3eab('0x5a')](_0x17e604,_0xd5c3f8[_0x3eab('0x13')]()+'\x0a');}_0xd5c3f8=[];}if(!(stats[_0x3eab('0x4a')]%0xc8)){socket[_0x3eab('0x5b')](_0x3eab('0x5c')+_0x50992c,stats);stats[_0x3eab('0x4b')]=[];}}if(stopped){logger[_0x3eab('0x38')](_0x3eab('0x5d'));_0x8854d7[_0x3eab('0x5e')]();}}catch(_0x515959){handleError(_0x5d2553[_0x3eab('0x49')][_0xb9adf4],{'code':_0x3eab('0x5f'),'message':_0x515959[_0x3eab('0x39')]});logger[_0x3eab('0x41')]('step',_0x515959[_0x3eab('0x39')]);}},'complete':function(){try{var _0x3b30de=[];var _0xbbd3a7=_0x3eab('0x2b');if(_0x1005e0[_0x3eab('0x60')]&&_0x1005e0[_0x3eab('0x60')][_0x3eab('0x61')]){_0xbbd3a7=_0x3eab('0x62')+_0x50992c;_0x3b30de[_0x3eab('0x3f')](_0x3eab('0x63')+_0xbbd3a7+_0x3eab('0x64'));}var _0x10c5b0=util[_0x3eab('0xb')](_0x3eab('0x65'),_0x17e604,_0xbbd3a7,_0xdd1ae6,_0x1005e0[_0x3eab('0x1c')],_0x1005e0['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xae51f6[_0x3eab('0x1a')])){_0x10c5b0+=_0x3eab('0x66');}_0x3b30de['push'](_0x10c5b0);if(_0x1005e0[_0x3eab('0x60')]&&_0x1005e0[_0x3eab('0x60')]['length']){_0x3b30de['push'](insertCmContact(_0x1005e0[_0x3eab('0x1c')],_0xbbd3a7,_0x1005e0[_0x3eab('0x60')],_0xae51f6));_0x3b30de[_0x3eab('0x3f')](_0x3eab('0x67')+_0xbbd3a7+';');}_0x3b30de['push'](insertCmHopper(_0x1005e0[_0x3eab('0x1c')],_0x3eab('0x68'),_0x3eab('0x69'),'VoiceQueueId',_0x44f40d));_0x3b30de[_0x3eab('0x3f')](insertCmHopperBlack(_0x1005e0['ListId'],'voice_queues_has_cm_blacklists','voice_queues',_0x3eab('0x6a')));_0x3b30de[_0x3eab('0x3f')](insertCmHopper(_0x1005e0[_0x3eab('0x1c')],'campaigns_has_cm_lists','campaigns',_0x3eab('0x6b'),_0x44f40d));_0x3b30de['push'](insertCmHopperBlack(_0x1005e0[_0x3eab('0x1c')],'campaigns_has_cm_blacklists','campaigns',_0x3eab('0x6b')));BPromise[_0x3eab('0x6c')](_0x3b30de,handleQuery)[_0x3eab('0x6d')](function(_0x1d6309){stats[_0x3eab('0x6e')]=!![];stats[_0x3eab('0x6f')]=_0x1005e0[_0x3eab('0x60')]&&_0x1005e0[_0x3eab('0x60')]['length']?results[0x2][_0x3eab('0x6f')]:results[0x0][_0x3eab('0x6f')];socket[_0x3eab('0x5b')](_0x3eab('0x5c')+_0x50992c,stats);fs[_0x3eab('0x70')](_0x2f6bbc);fs[_0x3eab('0x70')](_0x17e604);process[_0x3eab('0x3a')](0x0);})[_0x3eab('0x40')](function(_0x415ac9){logger[_0x3eab('0x41')](_0x415ac9[_0x3eab('0x39')]);process['exit'](0x1);});}catch(_0x4aba13){logger[_0x3eab('0x41')]('complete',_0x4aba13[_0x3eab('0x39')]);process['exit'](0x1);}},'error':function(_0x235546,_0x3c9926,_0x390da6,_0x5cc93e){throw new Error(_0x5cc93e);}});}function validate(){if(process[_0x3eab('0x71')]&&process[_0x3eab('0x71')][_0x3eab('0x61')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x3c13c7=path[_0x3eab('0x13')](config[_0x3eab('0x72')],'server/files/tmp',process[_0x3eab('0x71')][0x2]);if(!fs[_0x3eab('0x73')](_0x3c13c7)){throw new Error(_0x3eab('0x74'));}var _0x7dbbb0={};try{_0x7dbbb0=JSON[_0x3eab('0x47')](process[_0x3eab('0x71')][0x3]);if(!_0x7dbbb0[_0x3eab('0x75')]){throw new Error(_0x3eab('0x76'));}if(!_0x7dbbb0[_0x3eab('0x75')][_0x3eab('0xf')]){throw new Error(_0x3eab('0x77'));}if(!_0x7dbbb0['binding'][_0x3eab('0x57')]){throw new Error('firstName\x20is\x20mandatory');}var _0x251f82=0x0;if(_0x7dbbb0[_0x3eab('0x75')][_0x3eab('0x51')]){_0x251f82=0x1;}if(!_0x7dbbb0[_0x3eab('0x1c')]){throw new Error(_0x3eab('0x78'));}}catch(_0x346606){throw new Error(_0x3eab('0x79'));}var _0x12041a=[];try{_0x12041a=_[_0x3eab('0x7a')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x551a14){logger['info'](_0x3eab('0x7b'));}main(_0x3c13c7,_0x7dbbb0,_0x12041a,_0x251f82);}validate();process['on']('SIGINT',handleStop);process['on'](_0x3eab('0x7c'),handleUncaughtException); \ No newline at end of file +var _0x164b=['argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ListId','createdAt','updatedAt','priority','UserId','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','cm_contacts.updatedAt','cm_hopper_black','ContactId','from','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','fields','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','catch','stringify','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','length','rows','data','hasOwnProperty','trim','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','unlink','complete'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x164b,0x92));var _0xb164=function(_0x19a5d8,_0x347207){_0x19a5d8=_0x19a5d8-0x0;var _0x30104a=_0x164b[_0x19a5d8];return _0x30104a;};'use strict';var fs=require('fs');var path=require(_0xb164('0x0'));var _=require(_0xb164('0x1'));var Papa=require(_0xb164('0x2'));var util=require('util');var BPromise=require(_0xb164('0x3'));var moment=require(_0xb164('0x4'));var squel=require(_0xb164('0x5'));var Redis=require(_0xb164('0x6'));var db=require(_0xb164('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xb164('0x8'))(_0xb164('0x9'));config[_0xb164('0xa')]=_[_0xb164('0xb')](config[_0xb164('0xa')],{'host':_0xb164('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb164('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xb164('0xd'));function isEmail(_0x409fe7){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))*$/[_0xb164('0xe')](_0x409fe7);}function selectNotIn(_0x3a99dc,_0x32dcfd,_0x399c36,_0x1e405f,_0x9bab2b){return squel['select']()[_0xb164('0xf')](_0xb164('0x10'))['from'](_0x1e405f)[_0xb164('0x11')](_0x32dcfd,null,_0x32dcfd+_0xb164('0x12')+_0x1e405f+'.'+_0x399c36)['where'](_0x1e405f+'.'+_0x399c36+_0xb164('0x13')+_0x3a99dc+'.'+_0x399c36)['where'](_0x32dcfd+_0xb164('0x14')+_0x9bab2b[_0xb164('0x11')]()+')');}function insertCmHopper(_0x13b85f,_0x1f06ce,_0xd7a5ea,_0x4c1c54,_0x33f840){var _0x34a013=[_0xb164('0x15'),'cm_contacts.scheduledat','cm_contacts.id',_0xb164('0x16'),_0x1f06ce+'.'+_0x4c1c54,_0xb164('0x17'),'cm_contacts.updatedAt',_0xb164('0x18'),_0xb164('0x19'),'\x22'+_0x33f840+'\x22'];return squel[_0xb164('0x1a')]()[_0xb164('0x1b')](_0xb164('0x1c'))[_0xb164('0x1d')](['phone','scheduledat','ContactId',_0xb164('0x1e'),_0x4c1c54,_0xb164('0x1f'),_0xb164('0x20'),_0xb164('0x21'),_0xb164('0x22'),_0xb164('0x23')],squel[_0xb164('0x24')]()['fields'](_0x34a013)['from'](_0x1f06ce)[_0xb164('0x11')](_0xb164('0x25'),null,_0xb164('0x26')+_0x1f06ce+'.CmListId')[_0xb164('0x11')](_0xd7a5ea,null,_0xd7a5ea+_0xb164('0x12')+_0x1f06ce+'.'+_0x4c1c54)[_0xb164('0x27')](_0x1f06ce+_0xb164('0x28'),_0x13b85f)[_0xb164('0x27')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xb164('0x29'),selectNotIn(_0x1f06ce,_0xd7a5ea,_0x4c1c54,_0xb164('0x1c'),['\x22always\x22',_0xb164('0x2a')]))['where'](_0xb164('0x29'),selectNotIn(_0x1f06ce,_0xd7a5ea,_0x4c1c54,_0xb164('0x1c'),[_0xb164('0x2b')])))[_0xb164('0x2c')]();}function insertCmHopperBlack(_0x4844df,_0xee761a,_0x4cce66,_0x3afb69){var _0x241c1a=[_0xb164('0x15'),_0xb164('0x2d'),_0xb164('0x16'),_0xee761a+'.'+_0x3afb69,_0xb164('0x17'),_0xb164('0x2e')];return squel[_0xb164('0x1a')]()[_0xb164('0x1b')](_0xb164('0x2f'))['fromQuery'](['phone',_0xb164('0x30'),'ListId',_0x3afb69,_0xb164('0x1f'),_0xb164('0x20')],squel[_0xb164('0x24')]()['fields'](_0x241c1a)[_0xb164('0x31')](_0xee761a)[_0xb164('0x11')](_0xb164('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0xee761a+'.CmListId')[_0xb164('0x11')](_0x4cce66,null,_0x4cce66+_0xb164('0x12')+_0xee761a+'.'+_0x3afb69)[_0xb164('0x27')](_0xee761a+_0xb164('0x28'),_0x4844df)[_0xb164('0x27')](_0xb164('0x32'),NOW)['where'](_0xb164('0x29'),squel['select']()[_0xb164('0xf')](_0xb164('0x10'))['from'](_0xb164('0x2f'))[_0xb164('0x27')](_0xb164('0x33'),_0x4844df)['where'](_0x3afb69+_0xb164('0x34'),_0xee761a+'.'+_0x3afb69)))[_0xb164('0x2c')]();}function insertCmContact(_0x2b570d,_0x4eb2ee,_0x5bcfba,_0xe9feb8){var _0x30ceba=_[_0xb164('0x35')](_[_0xb164('0x36')](_0xe9feb8),[_0xb164('0x1e'),_0xb164('0x37'),_0xb164('0x1f'),_0xb164('0x20')]);return squel['insert']()[_0xb164('0x1b')](_0xb164('0x25'))[_0xb164('0x1d')](_0x30ceba,squel[_0xb164('0x24')]()[_0xb164('0x38')](_0x30ceba)[_0xb164('0x31')](_0x4eb2ee)['where']('('+_0x5bcfba[_0xb164('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0xb164('0x24')]()['fields'](_0x5bcfba)['from'](_0xb164('0x25'))['where'](_0xb164('0x33'),_0x2b570d)[_0xb164('0x27')](_0xb164('0x39')))['where'](_0xb164('0x3a'),squel[_0xb164('0x24')]()['field'](_0xb164('0x3b'),_0xb164('0x3c'))[_0xb164('0x31')](_0x4eb2ee)[_0xb164('0x3d')](_0x5bcfba[_0xb164('0x11')](','))))[_0xb164('0x2c')]();}function handleStop(){logger[_0xb164('0x3e')](_0xb164('0x3f'));stopped=!![];}function handleUncaughtException(_0x3c4b12){logger[_0xb164('0x40')](_0x3c4b12[_0xb164('0x41')]);process[_0xb164('0x42')](0x1);}function handleError(_0x485fca,_0x32e6db){stats[_0xb164('0x43')][_0xb164('0x44')]({'name':_0x32e6db[_0xb164('0x45')],'message':_0x32e6db[_0xb164('0x41')],'row':_0x485fca});}function handleQuery(_0x57a5ca){logger[_0xb164('0x3e')](_0x57a5ca);return db[_0xb164('0x46')]['query'](_0x57a5ca)['spread'](function(_0x49071f){results[_0xb164('0x44')](_0x49071f);})[_0xb164('0x47')](function(_0x37c370){logger[_0xb164('0x40')](_0x37c370[_0xb164('0x41')]);});}function main(_0x4cd23c,_0x528744,_0x3ce966,_0x1d2173){logger['info']('main',_0x4cd23c,JSON[_0xb164('0x48')](_0x528744));process['send'](_0xb164('0x49'));var _0x2c87ad=_0x528744[_0xb164('0x4a')];var _0x43ed28=_0x528744[_0xb164('0x4b')];var _0x34ffe9=path[_0xb164('0x11')](config[_0xb164('0x4c')],_0xb164('0x4d'),_0x43ed28+'.csv');var _0x4b3777=_[_0xb164('0x36')](_0x2c87ad)[_0xb164('0x11')]();logger[_0xb164('0x3e')](_0xb164('0x4e'),_0x4b3777);fs[_0xb164('0x4f')](_0x34ffe9,_0x4b3777+'\x0a');Papa[_0xb164('0x50')](fs[_0xb164('0x51')](_0x4cd23c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1017c2,_0x2b85f8){try{for(var _0x28cca0=0x0,_0x5202e1=[];_0x28cca0<_0x1017c2['data'][_0xb164('0x52')];_0x28cca0++){stats[_0xb164('0x53')]+=0x1;if(_0x1017c2[_0xb164('0x43')][_0x28cca0]){handleError(_0x1017c2[_0xb164('0x54')][_0x28cca0],_0x1017c2[_0xb164('0x43')][_0x28cca0]);}else{var _0x1995fe=[];for(var _0x2039bb in _0x2c87ad){if(_0x2c87ad[_0xb164('0x55')](_0x2039bb)){if(_0x1017c2[_0xb164('0x54')][_0x28cca0][_0x2c87ad[_0x2039bb]]){var _0xdff62a=_[_0xb164('0x56')](_0x1017c2[_0xb164('0x54')][_0x28cca0][_0x2c87ad[_0x2039bb]]['replace'](/"/g,'\x27'));switch(_0x2039bb){case _0xb164('0x57'):var _0x539308=moment(_0xdff62a,_0xb164('0xd'),!![]);if(_0x539308['isValid']()){_0x5202e1[_0xb164('0x44')]('\x22'+_0xdff62a+'\x22');}else{_0x1995fe[_0xb164('0x44')](_0xb164('0x58'));}break;case'priority':var _0x47eebc=parseInt(_0xdff62a);_0xdff62a=_['isNaN'](_0x47eebc)||_0x47eebc<0x0||_0x47eebc>0x4?_0x1d2173?0x3:0x2:_0x47eebc;_0x5202e1[_0xb164('0x44')]('\x22'+_0xdff62a+'\x22');break;case _0xb164('0x22'):var _0x4de442=parseInt(_0xdff62a);if(_[_0xb164('0x59')](_0x4de442)&&_[_0xb164('0x5a')](_0x3ce966,_0x4de442)){_0x5202e1[_0xb164('0x44')]('\x22'+_0x4de442+'\x22');}else{_0x1995fe[_0xb164('0x44')](_0xb164('0x5b'));}break;case _0xb164('0x5c'):if(isEmail(_0xdff62a)){_0x5202e1['push']('\x22'+_0xdff62a+'\x22');}else{_0x1995fe[_0xb164('0x44')](_0xb164('0x5d'));}break;case _0xb164('0x5e'):var _0x47c6b6=moment(_0xdff62a,_0xb164('0x5f'),!![]);if(_0x47c6b6[_0xb164('0x60')]()){_0x5202e1[_0xb164('0x44')]('\x22'+_0xdff62a+'\x22');}else{_0x1995fe[_0xb164('0x44')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5202e1['push']('\x22'+_0xdff62a+'\x22');}}else{switch(_0x2039bb){case'firstName':case _0xb164('0x10'):_0x1995fe[_0xb164('0x44')](_0x2039bb+'\x20not\x20specified');break;default:_0x5202e1[_0xb164('0x44')]('\x22\x22');}}}}if(_0x1995fe[_0xb164('0x52')]){handleError(_0x1017c2[_0xb164('0x54')][_0x28cca0],{'code':_0xb164('0x61'),'message':_0x1995fe['join']()});}else{fs[_0xb164('0x62')](_0x34ffe9,_0x5202e1[_0xb164('0x11')]()+'\x0a');}_0x5202e1=[];}if(!(stats[_0xb164('0x53')]%0xc8)){socket[_0xb164('0x63')](_0xb164('0x64')+_0x43ed28,stats);stats[_0xb164('0x43')]=[];}}if(stopped){logger[_0xb164('0x3e')](_0xb164('0x65'));_0x2b85f8[_0xb164('0x66')]();}}catch(_0x37fca7){handleError(_0x1017c2['data'][_0x28cca0],{'code':'SystemError','message':_0x37fca7['message']});logger['error']('step',_0x37fca7[_0xb164('0x41')]);}},'complete':function(){try{var _0x2c006b=[];var _0x45cfba=_0xb164('0x25');if(_0x528744[_0xb164('0x67')]&&_0x528744[_0xb164('0x67')][_0xb164('0x52')]){_0x45cfba=_0xb164('0x68')+_0x43ed28;_0x2c006b[_0xb164('0x44')](_0xb164('0x69')+_0x45cfba+_0xb164('0x6a'));}var _0x4eaecc=util[_0xb164('0x6b')](_0xb164('0x6c'),_0x34ffe9,_0x45cfba,_0x4b3777,_0x528744['ListId'],_0x528744[_0xb164('0x37')]||null,NOW,NOW);if(_[_0xb164('0x6d')](_0x2c87ad[_0xb164('0x57')])){_0x4eaecc+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c006b['push'](_0x4eaecc);if(_0x528744[_0xb164('0x67')]&&_0x528744[_0xb164('0x67')][_0xb164('0x52')]){_0x2c006b[_0xb164('0x44')](insertCmContact(_0x528744[_0xb164('0x1e')],_0x45cfba,_0x528744[_0xb164('0x67')],_0x2c87ad));_0x2c006b[_0xb164('0x44')]('DROP\x20TABLE\x20'+_0x45cfba+';');}_0x2c006b[_0xb164('0x44')](insertCmHopper(_0x528744[_0xb164('0x1e')],_0xb164('0x6e'),_0xb164('0x6f'),_0xb164('0x70'),_0x1d2173));_0x2c006b[_0xb164('0x44')](insertCmHopperBlack(_0x528744[_0xb164('0x1e')],'voice_queues_has_cm_blacklists',_0xb164('0x6f'),_0xb164('0x70')));_0x2c006b[_0xb164('0x44')](insertCmHopper(_0x528744[_0xb164('0x1e')],_0xb164('0x71'),_0xb164('0x72'),_0xb164('0x73'),_0x1d2173));_0x2c006b[_0xb164('0x44')](insertCmHopperBlack(_0x528744[_0xb164('0x1e')],_0xb164('0x74'),_0xb164('0x72'),_0xb164('0x73')));BPromise[_0xb164('0x75')](_0x2c006b,handleQuery)['then'](function(_0x4a22c2){stats[_0xb164('0x76')]=!![];stats[_0xb164('0x77')]=_0x528744[_0xb164('0x67')]&&_0x528744[_0xb164('0x67')]['length']?results[0x2][_0xb164('0x77')]:results[0x0][_0xb164('0x77')];socket[_0xb164('0x63')](_0xb164('0x64')+_0x43ed28,stats);fs['unlink'](_0x4cd23c);fs[_0xb164('0x78')](_0x34ffe9);process['exit'](0x0);})[_0xb164('0x47')](function(_0x5eebbc){logger[_0xb164('0x40')](_0x5eebbc[_0xb164('0x41')]);process[_0xb164('0x42')](0x1);});}catch(_0x5a68a4){logger['error'](_0xb164('0x79'),_0x5a68a4[_0xb164('0x41')]);process[_0xb164('0x42')](0x1);}},'error':function(_0x20ce3a,_0x2b9823,_0x595e54,_0x30fd0c){throw new Error(_0x30fd0c);}});}function validate(){if(process[_0xb164('0x7a')]&&process['argv'][_0xb164('0x52')]<0x4){throw new Error(_0xb164('0x7b'));}var _0x46bd72=path[_0xb164('0x11')](config['root'],'server/files/tmp',process[_0xb164('0x7a')][0x2]);if(!fs[_0xb164('0x7c')](_0x46bd72)){throw new Error(_0xb164('0x7d'));}var _0x8a0c70={};try{_0x8a0c70=JSON[_0xb164('0x50')](process[_0xb164('0x7a')][0x3]);if(!_0x8a0c70[_0xb164('0x4a')]){throw new Error(_0xb164('0x7e'));}if(!_0x8a0c70[_0xb164('0x4a')][_0xb164('0x10')]){throw new Error(_0xb164('0x7f'));}if(!_0x8a0c70[_0xb164('0x4a')]['firstName']){throw new Error(_0xb164('0x80'));}var _0x1a7b46=0x0;if(_0x8a0c70[_0xb164('0x4a')][_0xb164('0x22')]){_0x1a7b46=0x1;}if(!_0x8a0c70[_0xb164('0x1e')]){throw new Error(_0xb164('0x81'));}}catch(_0x2fcec1){throw new Error(_0xb164('0x82'));}var _0xbcdd45=[];try{_0xbcdd45=_[_0xb164('0x83')](JSON['parse'](process[_0xb164('0x7a')][0x4]),'id');}catch(_0x330a95){logger[_0xb164('0x3e')](_0xb164('0x84'));}main(_0x46bd72,_0x8a0c70,_0xbcdd45,_0x1a7b46);}validate();process['on']('SIGINT',handleStop);process['on'](_0xb164('0x85'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index e8e199e..e41a4ad 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 _0x0d44=['UniqueId','uniqueid','Date','agentcalledAt','string','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','variable','Call\x20To','destexten'];(function(_0x39a99d,_0x36fdec){var _0x229fd5=function(_0x13ea2b){while(--_0x13ea2b){_0x39a99d['push'](_0x39a99d['shift']());}};_0x229fd5(++_0x36fdec);}(_0x0d44,0x140));var _0x40d4=function(_0x549c1d,_0x52c93f){_0x549c1d=_0x549c1d-0x0;var _0x42e9bd=_0x0d44[_0x549c1d];return _0x42e9bd;};'use strict';exports['getSubjects']=function(_0x532639,_0x445991){var _0x1bb702=[{'type':'string','content':_0x40d4('0x0'),'variableName':null}];switch(_0x532639[_0x40d4('0x1')]()){case _0x40d4('0x2'):switch(_0x445991['toLowerCase']()){case _0x40d4('0x3'):_0x1bb702[_0x40d4('0x4')]({'type':'variable','content':'','variableName':_0x40d4('0x5')});_0x1bb702[_0x40d4('0x4')]({'type':'variable','content':'','variableName':_0x40d4('0x6')});break;case'outbound':_0x1bb702[_0x40d4('0x4')]({'type':'string','content':_0x40d4('0x7'),'variableName':null});_0x1bb702[_0x40d4('0x4')]({'type':'variable','content':'','variableName':_0x40d4('0x8')});break;}}return _0x1bb702;};exports[_0x40d4('0x9')]=function(_0x18447e,_0x493f28){var _0x2c57ca=[];switch(_0x18447e['toLowerCase']()){case _0x40d4('0x2'):switch(_0x493f28[_0x40d4('0x1')]()){case _0x40d4('0x3'):_0x2c57ca=[{'type':'string','content':_0x40d4('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x40d4('0xb'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x40d4('0x6')},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0xc'),'keyType':_0x40d4('0xd'),'variableName':'calleridname'},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0xe'),'keyType':'variable','variableName':_0x40d4('0xf')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x40d4('0xd'),'variableName':_0x40d4('0x5')},{'type':'keyValue','content':'','key':_0x40d4('0x10'),'keyType':'variable','variableName':_0x40d4('0x11')},{'type':'keyValue','content':'','key':_0x40d4('0x12'),'keyType':_0x40d4('0xd'),'variableName':_0x40d4('0x13')},{'type':_0x40d4('0x14'),'content':_0x40d4('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x16'),'keyType':'variable','variableName':_0x40d4('0x17')},{'type':_0x40d4('0xb'),'content':'','key':'Agent\x20Number','keyType':_0x40d4('0xd'),'variableName':_0x40d4('0x8')},{'type':_0x40d4('0x14'),'content':_0x40d4('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x19'),'keyType':_0x40d4('0xd'),'variableName':_0x40d4('0x13')},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x1a'),'keyType':'variable','variableName':_0x40d4('0x1b')},{'type':'keyValue','content':'','key':_0x40d4('0x1c'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x1d'),'keyType':_0x40d4('0xd'),'variableName':_0x40d4('0x1e')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x40d4('0xd'),'variableName':'talktime'}];break;case'outbound':_0x2c57ca=[{'type':'string','content':_0x40d4('0xa'),'variableName':null},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x1f'),'keyType':_0x40d4('0xd'),'keyContent':'','variableName':_0x40d4('0x8')},{'type':'keyValue','content':'','key':_0x40d4('0x20'),'keyType':_0x40d4('0xd'),'keyContent':'','variableName':_0x40d4('0x21')},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x10'),'keyType':_0x40d4('0xd'),'keyContent':'','variableName':'uniqueid'},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x12'),'keyType':'variable','keyContent':'','variableName':_0x40d4('0x22')},{'type':_0x40d4('0x14'),'content':_0x40d4('0x18')},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x23'),'keyType':_0x40d4('0xd'),'keyContent':'','variableName':_0x40d4('0x24')},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x25'),'keyType':'variable','keyContent':'','variableName':_0x40d4('0x26')},{'type':_0x40d4('0xb'),'content':'','key':_0x40d4('0x27'),'keyType':_0x40d4('0xd'),'keyContent':'','variableName':_0x40d4('0x28')},{'type':'keyValue','content':'','key':_0x40d4('0x29'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x2c57ca;}; \ No newline at end of file +var _0xff16=['inbound','variable','push','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','voice','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','uniqueid','Date','agentcalledAt','Agent\x20Name','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Member\x20Name','membername','UniqueId','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase'];(function(_0x1012c1,_0x251951){var _0x580111=function(_0x4999){while(--_0x4999){_0x1012c1['push'](_0x1012c1['shift']());}};_0x580111(++_0x251951);}(_0xff16,0xad));var _0x6ff1=function(_0x1b3fb6,_0x1e60d0){_0x1b3fb6=_0x1b3fb6-0x0;var _0x56d137=_0xff16[_0x1b3fb6];return _0x56d137;};'use strict';exports[_0x6ff1('0x0')]=function(_0x2298f4,_0x45f770){var _0x3408c2=[{'type':'string','content':_0x6ff1('0x1'),'variableName':null}];switch(_0x2298f4[_0x6ff1('0x2')]()){case'voice':switch(_0x45f770[_0x6ff1('0x2')]()){case _0x6ff1('0x3'):_0x3408c2['push']({'type':_0x6ff1('0x4'),'content':'','variableName':'queue'});_0x3408c2[_0x6ff1('0x5')]({'type':_0x6ff1('0x4'),'content':'','variableName':_0x6ff1('0x6')});break;case _0x6ff1('0x7'):_0x3408c2[_0x6ff1('0x5')]({'type':_0x6ff1('0x8'),'content':_0x6ff1('0x9'),'variableName':null});_0x3408c2[_0x6ff1('0x5')]({'type':_0x6ff1('0x4'),'content':'','variableName':_0x6ff1('0xa')});break;}}return _0x3408c2;};exports['getDescriptions']=function(_0x41c1d0,_0x544162){var _0x4dcef6=[];switch(_0x41c1d0[_0x6ff1('0x2')]()){case _0x6ff1('0xb'):switch(_0x544162[_0x6ff1('0x2')]()){case _0x6ff1('0x3'):_0x4dcef6=[{'type':_0x6ff1('0x8'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6ff1('0xc'),'keyType':_0x6ff1('0x4'),'variableName':'calleridnum'},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0xe'),'keyType':'variable','variableName':_0x6ff1('0xf')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x10'),'keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x11')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x12'),'keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x13')},{'type':_0x6ff1('0xd'),'content':'','key':'UniqueId','keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x14')},{'type':'keyValue','content':'','key':_0x6ff1('0x15'),'keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x16')},{'type':_0x6ff1('0x8'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6ff1('0x17'),'keyType':_0x6ff1('0x4'),'variableName':'destcalleridname'},{'type':_0x6ff1('0xd'),'content':'','key':'Agent\x20Number','keyType':_0x6ff1('0x4'),'variableName':'destcalleridnum'},{'type':_0x6ff1('0x8'),'content':_0x6ff1('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6ff1('0x19'),'keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x16')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x1a'),'keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x1b')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x1c'),'keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x1d')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x1e'),'keyType':_0x6ff1('0x4'),'variableName':_0x6ff1('0x1f')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x20'),'keyType':_0x6ff1('0x4'),'variableName':'talktime'}];break;case _0x6ff1('0x7'):_0x4dcef6=[{'type':_0x6ff1('0x8'),'content':_0x6ff1('0x21'),'variableName':null},{'type':_0x6ff1('0xd'),'content':'','key':'Called\x20Number','keyType':_0x6ff1('0x4'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x22'),'keyType':'variable','keyContent':'','variableName':_0x6ff1('0x23')},{'type':'keyValue','content':'','key':_0x6ff1('0x24'),'keyType':_0x6ff1('0x4'),'keyContent':'','variableName':_0x6ff1('0x14')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x15'),'keyType':_0x6ff1('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0x6ff1('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x25'),'keyType':_0x6ff1('0x4'),'keyContent':'','variableName':_0x6ff1('0x26')},{'type':'keyValue','content':'','key':_0x6ff1('0x27'),'keyType':_0x6ff1('0x4'),'keyContent':'','variableName':_0x6ff1('0x28')},{'type':_0x6ff1('0xd'),'content':'','key':_0x6ff1('0x29'),'keyType':_0x6ff1('0x4'),'keyContent':'','variableName':_0x6ff1('0x2a')},{'type':_0x6ff1('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x6ff1('0x4'),'keyContent':'','variableName':_0x6ff1('0x2b')}];break;}}return _0x4dcef6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 1ea7506..7a5e113 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 _0x56c8=['lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','then','catch','error','tracked','query','clone','body','html','phone','fax'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x56c8,0x129));var _0x856c=function(_0x2dfad6,_0x55ecca){_0x2dfad6=_0x2dfad6-0x0;var _0x40f7b8=_0x56c8[_0x2dfad6];return _0x40f7b8;};'use strict';var _=require(_0x856c('0x0'));var db=require(_0x856c('0x1'))['db'];var loggers={'openchannel':require(_0x856c('0x2'))(_0x856c('0x3')),'mail':require(_0x856c('0x2'))('mail-interactions'),'fax':require(_0x856c('0x2'))(_0x856c('0x4')),'sms':require(_0x856c('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x856c('0x5')),'whatsapp':require(_0x856c('0x2'))(_0x856c('0x6'))};function getInteractionId(_0x1c8c6f,_0x4f681f,_0x5ee97d){if(_0x1c8c6f&&_0x1c8c6f[_['upperFirst'](_0x5ee97d)+'InteractionId']){return _0x1c8c6f[_[_0x856c('0x7')](_0x5ee97d)+_0x856c('0x8')];}else if(_0x1c8c6f&&_0x1c8c6f['id']){return _0x1c8c6f['id'];}else if(_0x4f681f&&_0x4f681f['id']){return _0x4f681f['id'];}else{return _0x856c('0x9');}}function log(_0x42d938,_0x625d92,_0x66badd,_0x31c7cf,_0x28080e,_0x43a1e2){loggers[_0x28080e[_0x856c('0xa')]()][_0x42d938](_0x856c('0xb'),_0x43a1e2[_0x856c('0xc')](),_0x625d92?_0x625d92['id']:null,_0x625d92?_0x625d92[_0x856c('0xd')]:null,_0x625d92?_0x625d92[_0x856c('0xe')]:null,getInteractionId(_0x66badd,_0x31c7cf,_0x28080e),_0x66badd?JSON[_0x856c('0xf')](_0x66badd):_0x856c('0x10'));}function updateUser(_0x5410a0,_0x157cc7,_0x15d11f,_0x3f4109,_0x4126ce){db[_[_0x856c('0x7')](_0x3f4109)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x157cc7,_0x15d11f,_0x3f4109)}})[_0x856c('0x11')](function(_0x13ef8f){if(_0x13ef8f){return _0x13ef8f['update']({'UserId':_0x5410a0?_0x5410a0['id']:null});}})[_0x856c('0x11')](function(_0x265888){if(_0x265888){log('info',_0x5410a0,_0x157cc7,_0x15d11f,_0x3f4109,_0x4126ce);}})[_0x856c('0x12')](function(){log(_0x856c('0x13'),_0x5410a0,_0x157cc7,_0x15d11f,_0x3f4109,_0x4126ce);});}exports[_0x856c('0x14')]=function(_0x36b8ec,_0x160d24){return function(_0x2cf391,_0x524693,_0x550094){var _0x43771d=_0x2cf391['user'];var _0x14a8fe={};var _0x2f4d4e=_0x2cf391[_0x856c('0x15')];if(_0x14a8fe){_0x14a8fe=_[_0x856c('0x16')](_0x2cf391[_0x856c('0x17')]);_0x14a8fe=_['omit'](_0x14a8fe,[_0x856c('0x17'),_0x856c('0x18'),_0x856c('0x19'),_0x856c('0x1a'),'mobile']);}updateUser(_0x43771d,_0x14a8fe,_0x2f4d4e,_0x36b8ec,_0x160d24);_0x550094(null);};}; \ No newline at end of file +var _0xcd13=['info','tracked','user','query','body','html','phone','fax','../../mysqldb','openchannel-interactions','mail-interactions','../../config/logger','fax-interactions','chat-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then'];(function(_0x5bc678,_0x49b8fc){var _0x3ea263=function(_0x2c5d01){while(--_0x2c5d01){_0x5bc678['push'](_0x5bc678['shift']());}};_0x3ea263(++_0x49b8fc);}(_0xcd13,0xbe));var _0x3cd1=function(_0x58de95,_0x4fc3ea){_0x58de95=_0x58de95-0x0;var _0x540403=_0xcd13[_0x58de95];return _0x540403;};'use strict';var _=require('lodash');var db=require(_0x3cd1('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x3cd1('0x1')),'mail':require('../../config/logger')(_0x3cd1('0x2')),'fax':require(_0x3cd1('0x3'))(_0x3cd1('0x4')),'sms':require(_0x3cd1('0x3'))('sms-interactions'),'chat':require(_0x3cd1('0x3'))(_0x3cd1('0x5')),'whatsapp':require(_0x3cd1('0x3'))('whatsapp-interactions')};function getInteractionId(_0x507bcf,_0x3bb075,_0xe57003){if(_0x507bcf&&_0x507bcf[_['upperFirst'](_0xe57003)+'InteractionId']){return _0x507bcf[_[_0x3cd1('0x6')](_0xe57003)+_0x3cd1('0x7')];}else if(_0x507bcf&&_0x507bcf['id']){return _0x507bcf['id'];}else if(_0x3bb075&&_0x3bb075['id']){return _0x3bb075['id'];}else{return _0x3cd1('0x8');}}function log(_0x26628f,_0x353283,_0x537ce7,_0x386746,_0x2b617f,_0x4e136a){loggers[_0x2b617f['toLowerCase']()][_0x26628f](_0x3cd1('0x9'),_0x4e136a[_0x3cd1('0xa')](),_0x353283?_0x353283['id']:null,_0x353283?_0x353283[_0x3cd1('0xb')]:null,_0x353283?_0x353283[_0x3cd1('0xc')]:null,getInteractionId(_0x537ce7,_0x386746,_0x2b617f),_0x537ce7?JSON[_0x3cd1('0xd')](_0x537ce7):_0x3cd1('0xe'));}function updateUser(_0x5e8d51,_0x1ff7e0,_0x42ba3a,_0xad8524,_0x115e84){db[_[_0x3cd1('0x6')](_0xad8524)+_0x3cd1('0xf')][_0x3cd1('0x10')]({'where':{'id':getInteractionId(_0x1ff7e0,_0x42ba3a,_0xad8524)}})[_0x3cd1('0x11')](function(_0x135bde){if(_0x135bde){return _0x135bde['update']({'UserId':_0x5e8d51?_0x5e8d51['id']:null});}})[_0x3cd1('0x11')](function(_0x18f3ff){if(_0x18f3ff){log(_0x3cd1('0x12'),_0x5e8d51,_0x1ff7e0,_0x42ba3a,_0xad8524,_0x115e84);}})['catch'](function(){log('error',_0x5e8d51,_0x1ff7e0,_0x42ba3a,_0xad8524,_0x115e84);});}exports[_0x3cd1('0x13')]=function(_0x4f4034,_0x10eff4){return function(_0x443559,_0x526182,_0x58ca38){var _0x15ab32=_0x443559[_0x3cd1('0x14')];var _0x3f98b8={};var _0xf4d618=_0x443559[_0x3cd1('0x15')];if(_0x3f98b8){_0x3f98b8=_['clone'](_0x443559[_0x3cd1('0x16')]);_0x3f98b8=_['omit'](_0x3f98b8,[_0x3cd1('0x16'),_0x3cd1('0x17'),_0x3cd1('0x18'),_0x3cd1('0x19'),'mobile']);}updateUser(_0x15ab32,_0x3f98b8,_0xf4d618,_0x4f4034,_0x10eff4);_0x58ca38(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9a41afa..529446f 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 _0x3558=['composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','util'];(function(_0x92721b,_0x2cfb72){var _0x278120=function(_0x1edbf7){while(--_0x1edbf7){_0x92721b['push'](_0x92721b['shift']());}};_0x278120(++_0x2cfb72);}(_0x3558,0x8a));var _0x8355=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x3558[_0x19b3f9];return _0x18c3f6;};'use strict';var crypto=require(_0x8355('0x0'));var util=require(_0x8355('0x1'));var compose=require(_0x8355('0x2'));var db=require(_0x8355('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4f7eae,_0x39ee0e){if(_0x4f7eae&&_0x39ee0e){if(_0x39ee0e[_0x8355('0x4')]&&_0x39ee0e[_0x8355('0x5')]){var _0x1377c2=_0x39ee0e[_0x8355('0x4')];var _0x2d116e=_0x39ee0e[_0x8355('0x5')];var _0x5c24f9=_0x1377c2[_0x8355('0x6')]('-')[0x4];var _0x1fa3bd=_0x1377c2[_0x8355('0x6')]('-')[0x0];var _0x1a6a1a=crypto[_0x8355('0x7')](_0x8355('0x8'),util[_0x8355('0x9')](_0x8355('0xa'),_0x5c24f9,_0x1377c2,_0x1fa3bd));var _0x3c0f50=_0x1a6a1a[_0x8355('0xb')](_0x2d116e,_0x8355('0xc'),_0x8355('0xd'));_0x3c0f50+=_0x1a6a1a[_0x8355('0xe')](_0x8355('0xd'));var _0x4d6a9f=JSON['parse'](_0x3c0f50);return _0x4d6a9f[_0x8355('0xf')](_0x4f7eae)?_0x4d6a9f[_0x4f7eae]:null;}}return null;}function isLimit(_0x3aadfc,_0x4ac4c0,_0x3ba49e,_0x235dc3){var _0x257bb5=_0x4ac4c0;return compose()['use'](function(_0x40f597,_0x5f0758,_0x14cab1){return db[_0x8355('0x10')][_0x8355('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x8355('0x12')](function(_0xc3d535){var _0x344c6f=getValueFromLicense(_0x3aadfc,_0xc3d535);return _0x344c6f?_0x344c6f:_0x257bb5;})['then'](function(_0x53651e){_0x257bb5=_0x53651e;return _0x3ba49e[_0x8355('0x13')](_0x235dc3);})[_0x8355('0x12')](function(_0x5d2454){if(_0x5d2454>=_0x257bb5){return _0x5f0758[_0x8355('0x14')](0x193)[_0x8355('0x15')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3aadfc)});}_0x14cab1();})[_0x8355('0x16')](function(_0x4b01e4){_0x14cab1(_0x4b01e4);});});}function isUserLimit(){return isLimit(_0x8355('0x17'),0x1,db[_0x8355('0x18')],{'where':{'$or':[{'role':_0x8355('0x19')},{'role':_0x8355('0x1a')}]}});}exports[_0x8355('0x1b')]=isUserLimit; \ No newline at end of file +var _0x26ad=['data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','use','License','findOne','then','count','json','users','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x26ad,0x128));var _0xd26a=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x26ad[_0x204eb7];return _0x37e444;};'use strict';var crypto=require('crypto');var util=require(_0xd26a('0x0'));var compose=require(_0xd26a('0x1'));var db=require(_0xd26a('0x2'))['db'];var config=require(_0xd26a('0x3'));function getValueFromLicense(_0x2ce2a8,_0x2a66c8){if(_0x2ce2a8&&_0x2a66c8){if(_0x2a66c8[_0xd26a('0x4')]&&_0x2a66c8['license']){var _0x48ab40=_0x2a66c8[_0xd26a('0x4')];var _0x3a35ba=_0x2a66c8[_0xd26a('0x5')];var _0x1d8bea=_0x48ab40[_0xd26a('0x6')]('-')[0x4];var _0x5e8fdf=_0x48ab40[_0xd26a('0x6')]('-')[0x0];var _0xf9a05d=crypto['createDecipher'](_0xd26a('0x7'),util[_0xd26a('0x8')](_0xd26a('0x9'),_0x1d8bea,_0x48ab40,_0x5e8fdf));var _0xec9ff5=_0xf9a05d[_0xd26a('0xa')](_0x3a35ba,_0xd26a('0xb'),_0xd26a('0xc'));_0xec9ff5+=_0xf9a05d[_0xd26a('0xd')](_0xd26a('0xc'));var _0x421fbc=JSON[_0xd26a('0xe')](_0xec9ff5);return _0x421fbc['hasOwnProperty'](_0x2ce2a8)?_0x421fbc[_0x2ce2a8]:null;}}return null;}function isLimit(_0x31e403,_0x4ef511,_0x4ab668,_0x5c28ea){var _0x565a76=_0x4ef511;return compose()[_0xd26a('0xf')](function(_0xa4fe30,_0x2b1884,_0x4ece87){return db[_0xd26a('0x10')][_0xd26a('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x58c1a8){var _0x519fc9=getValueFromLicense(_0x31e403,_0x58c1a8);return _0x519fc9?_0x519fc9:_0x565a76;})[_0xd26a('0x12')](function(_0x1a099a){_0x565a76=_0x1a099a;return _0x4ab668[_0xd26a('0x13')](_0x5c28ea);})['then'](function(_0x811f2f){if(_0x811f2f>=_0x565a76){return _0x2b1884['status'](0x193)[_0xd26a('0x14')]({'message':util[_0xd26a('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x31e403)});}_0x4ece87();})['catch'](function(_0x231c30){_0x4ece87(_0x231c30);});});}function isUserLimit(){return isLimit(_0xd26a('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xd26a('0x16')},{'role':_0xd26a('0x17')}]}});}exports[_0xd26a('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 09ca7b9..23ee311 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 _0x449b=['YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$substring','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$endsWith','shift','utcOffset','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','and','[$and]','split','length','forEach','match','filter','indexOf','push','buildExpression','DATE','operator','$eq','value','$lte','add','format'];(function(_0x4c9b2a,_0x558a1d){var _0x13cdb9=function(_0xc5eeb6){while(--_0xc5eeb6){_0x4c9b2a['push'](_0x4c9b2a['shift']());}};_0x13cdb9(++_0x558a1d);}(_0x449b,0x17b));var _0xb449=function(_0x18c91a,_0xa4c376){_0x18c91a=_0x18c91a-0x0;var _0x3ae566=_0x449b[_0x18c91a];return _0x3ae566;};'use strict';var _=require(_0xb449('0x0'));var moment=require('moment');exports[_0xb449('0x1')]=function(_0x45ad90){var _0x10dde0={'conditions':[]};_0x10dde0[_0xb449('0x2')]=_[_0xb449('0x3')](_0x45ad90,'[$or]')?'or':_0xb449('0x4');var _0x1a6274=_0x45ad90['replace'](_0xb449('0x5'),'')['replace']('[$or]','')[_0xb449('0x6')]('||');for(var _0x5c2a69=0x0;_0x5c2a69<_0x1a6274[_0xb449('0x7')];_0x5c2a69++){var _0x1b047c=_0x1a6274[_0x5c2a69][_0xb449('0x6')](':=');var _0x50856=_0x1b047c[0x0];var _0x6bb602=_0x1b047c['slice'](0x1);_0x6bb602[_0xb449('0x8')](function(_0x4580bc){var _0x421a3d=_0x4580bc[_0xb449('0x6')]('[')['shift']();var _0x1c496e=_0x4580bc[_0xb449('0x9')](/\[(.*?)\]/g);_0x1c496e[_0xb449('0x8')](function(_0x3a538e){var _0x2f34a3=_0x3a538e['split']('[')[_0xb449('0xa')](function(_0x196117){return _0x196117[_0xb449('0xb')](']')>-0x1;})['map'](function(_0x3447b0){return _0x3447b0['split'](']')[0x0];})[0x0];_0x10dde0['conditions'][_0xb449('0xc')]({'field':_0x50856,'operator':_0x421a3d,'value':_0x2f34a3});});});}return _0x10dde0;};exports[_0xb449('0xd')]=function(_0x5670d2,_0xb1b0e4,_0x290794){var _0x2b0b56={};if(_0xb1b0e4===_0xb449('0xe')){if(_0x290794[_0xb449('0xf')]===_0xb449('0x10')){_0x290794[_0xb449('0xf')]='$between';_0x290794['value']+=','+_0x290794[_0xb449('0x11')];}else if(_['includes'](['$gt',_0xb449('0x12')],_0x290794[_0xb449('0xf')])){_0x290794[_0xb449('0x11')]=moment(_0x290794[_0xb449('0x11')])[_0xb449('0x13')](0x1,'days')[_0xb449('0x14')](_0xb449('0x15'));}}if(_0x290794[_0xb449('0x16')]){_0xb1b0e4=_0x290794[_0xb449('0x16')];_0x2b0b56['text']=_0xb449('0x17')+_0x5670d2+'.'+_0x290794[_0xb449('0x18')]+_0xb449('0x19')+_0x290794[_0xb449('0x16')]+')\x20'+parseOperator(_0x290794['operator']);}else{_0x2b0b56[_0xb449('0x1a')]=_0x5670d2+'.'+_0x290794[_0xb449('0x18')]+'\x20'+parseOperator(_0x290794[_0xb449('0xf')]);}if(_[_0xb449('0x1b')](['$ne',_0xb449('0x1c')],_0x290794[_0xb449('0xf')]))_0x2b0b56[_0xb449('0x1a')]='('+_0x2b0b56[_0xb449('0x1a')]+_0xb449('0x1d')+_0x5670d2+'.'+_0x290794[_0xb449('0x18')]+_0xb449('0x1e');_0x2b0b56[_0xb449('0x11')]=parseValue(_0xb1b0e4,_0x290794[_0xb449('0xf')],_0x290794['value']);return _0x2b0b56;};function parseOperator(_0x17e498){var _0x432c7c;switch(_0x17e498){case _0xb449('0x1f'):_0x432c7c=_0xb449('0x20');break;case'$notIn':_0x432c7c=_0xb449('0x21');break;case'$eq':_0x432c7c='=\x20?';break;case'$ne':_0x432c7c='<>\x20?';break;case _0xb449('0x22'):case'$startsWith':case'$endsWith':_0x432c7c=_0xb449('0x23');break;case _0xb449('0x24'):_0x432c7c=_0xb449('0x25');break;case _0xb449('0x26'):_0x432c7c=_0xb449('0x27');break;case _0xb449('0x12'):_0x432c7c='<=\x20?';break;case _0xb449('0x28'):_0x432c7c='>=\x20?';break;case _0xb449('0x29'):_0x432c7c=_0xb449('0x2a');break;}return _0x432c7c;}function parseValue(_0x22a9c1,_0x51bdd9,_0x5c9f5c){var _0x3ef7d1={'start':undefined,'end':undefined};switch(_0x51bdd9){case _0xb449('0x1f'):case _0xb449('0x1c'):_0x3ef7d1['start']=_0x5c9f5c[_0xb449('0x6')](',');break;case'$substring':_0x3ef7d1[_0xb449('0x2b')]='%'+_0x5c9f5c+'%';break;case _0xb449('0x2c'):_0x3ef7d1[_0xb449('0x2b')]=_0x5c9f5c+'%';break;case _0xb449('0x2d'):_0x3ef7d1[_0xb449('0x2b')]='%'+_0x5c9f5c;break;case'$between':var _0x42b5f3=_0x5c9f5c['split'](',');var _0x5c9f5c=_0x42b5f3[_0xb449('0x2e')]();var _0x120c94=_0x42b5f3['pop']();if(_0x22a9c1===_0xb449('0xe')){_0x5c9f5c=moment(_0x5c9f5c)[_0xb449('0x2f')](0x0,!![])[_0xb449('0x14')]();_0x120c94=moment(_0x120c94)[_0xb449('0x2f')](0x0,!![])[_0xb449('0x13')](0x17,'hours')[_0xb449('0x13')](0x3b,_0xb449('0x30'))[_0xb449('0x13')](0x3b,_0xb449('0x31'))[_0xb449('0x14')]();}_0x3ef7d1={'start':_0x5c9f5c,'end':_0x120c94};break;default:_0x3ef7d1['start']=_0x5c9f5c;break;}return _0x3ef7d1;} \ No newline at end of file +var _0x7cfc=['field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','start','$startsWith','$endsWith','DATE','utcOffset','format','add','minutes','seconds','lodash','moment','parseSearch','startsWith','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','operator','$between','value','includes','$gt','$lte','days','castTo','CAST('];(function(_0x59ec0c,_0x44f64d){var _0x1490ab=function(_0x5bf807){while(--_0x5bf807){_0x59ec0c['push'](_0x59ec0c['shift']());}};_0x1490ab(++_0x44f64d);}(_0x7cfc,0x19e));var _0xc7cf=function(_0x29c1c0,_0x4b9049){_0x29c1c0=_0x29c1c0-0x0;var _0x31f4ac=_0x7cfc[_0x29c1c0];return _0x31f4ac;};'use strict';var _=require(_0xc7cf('0x0'));var moment=require(_0xc7cf('0x1'));exports[_0xc7cf('0x2')]=function(_0x3db963){var _0x1fee08={'conditions':[]};_0x1fee08['sqlOperator']=_[_0xc7cf('0x3')](_0x3db963,'[$or]')?'or':_0xc7cf('0x4');var _0x4859fa=_0x3db963[_0xc7cf('0x5')](_0xc7cf('0x6'),'')[_0xc7cf('0x5')]('[$or]','')[_0xc7cf('0x7')]('||');for(var _0x433ba0=0x0;_0x433ba0<_0x4859fa[_0xc7cf('0x8')];_0x433ba0++){var _0x496970=_0x4859fa[_0x433ba0][_0xc7cf('0x7')](':=');var _0x1eb550=_0x496970[0x0];var _0x5ad727=_0x496970[_0xc7cf('0x9')](0x1);_0x5ad727[_0xc7cf('0xa')](function(_0x52197b){var _0x26df3e=_0x52197b['split']('[')[_0xc7cf('0xb')]();var _0xfe3885=_0x52197b[_0xc7cf('0xc')](/\[(.*?)\]/g);_0xfe3885[_0xc7cf('0xa')](function(_0x36e257){var _0x4a90b4=_0x36e257[_0xc7cf('0x7')]('[')[_0xc7cf('0xd')](function(_0x59b15a){return _0x59b15a[_0xc7cf('0xe')](']')>-0x1;})['map'](function(_0x262100){return _0x262100[_0xc7cf('0x7')](']')[0x0];})[0x0];_0x1fee08[_0xc7cf('0xf')][_0xc7cf('0x10')]({'field':_0x1eb550,'operator':_0x26df3e,'value':_0x4a90b4});});});}return _0x1fee08;};exports['buildExpression']=function(_0x4e8e90,_0x37bc6f,_0x30a508){var _0x374292={};if(_0x37bc6f==='DATE'){if(_0x30a508[_0xc7cf('0x11')]==='$eq'){_0x30a508['operator']=_0xc7cf('0x12');_0x30a508[_0xc7cf('0x13')]+=','+_0x30a508[_0xc7cf('0x13')];}else if(_[_0xc7cf('0x14')]([_0xc7cf('0x15'),_0xc7cf('0x16')],_0x30a508[_0xc7cf('0x11')])){_0x30a508['value']=moment(_0x30a508[_0xc7cf('0x13')])['add'](0x1,_0xc7cf('0x17'))['format']('YYYY-MM-DD');}}if(_0x30a508[_0xc7cf('0x18')]){_0x37bc6f=_0x30a508[_0xc7cf('0x18')];_0x374292['text']=_0xc7cf('0x19')+_0x4e8e90+'.'+_0x30a508[_0xc7cf('0x1a')]+_0xc7cf('0x1b')+_0x30a508['castTo']+')\x20'+parseOperator(_0x30a508['operator']);}else{_0x374292[_0xc7cf('0x1c')]=_0x4e8e90+'.'+_0x30a508[_0xc7cf('0x1a')]+'\x20'+parseOperator(_0x30a508['operator']);}if(_[_0xc7cf('0x14')]([_0xc7cf('0x1d'),_0xc7cf('0x1e')],_0x30a508[_0xc7cf('0x11')]))_0x374292[_0xc7cf('0x1c')]='('+_0x374292[_0xc7cf('0x1c')]+_0xc7cf('0x1f')+_0x4e8e90+'.'+_0x30a508[_0xc7cf('0x1a')]+_0xc7cf('0x20');_0x374292['value']=parseValue(_0x37bc6f,_0x30a508[_0xc7cf('0x11')],_0x30a508[_0xc7cf('0x13')]);return _0x374292;};function parseOperator(_0x45130e){var _0x46ec9d;switch(_0x45130e){case _0xc7cf('0x21'):_0x46ec9d=_0xc7cf('0x22');break;case _0xc7cf('0x1e'):_0x46ec9d=_0xc7cf('0x23');break;case _0xc7cf('0x24'):_0x46ec9d=_0xc7cf('0x25');break;case _0xc7cf('0x1d'):_0x46ec9d=_0xc7cf('0x26');break;case _0xc7cf('0x27'):case'$startsWith':case'$endsWith':_0x46ec9d=_0xc7cf('0x28');break;case _0xc7cf('0x29'):_0x46ec9d=_0xc7cf('0x2a');break;case _0xc7cf('0x15'):_0x46ec9d=_0xc7cf('0x2b');break;case _0xc7cf('0x16'):_0x46ec9d=_0xc7cf('0x2c');break;case'$gte':_0x46ec9d=_0xc7cf('0x2d');break;case _0xc7cf('0x12'):_0x46ec9d='BETWEEN\x20?\x20AND\x20?';break;}return _0x46ec9d;}function parseValue(_0x2ca776,_0x4c39eb,_0x548d87){var _0x42c8db={'start':undefined,'end':undefined};switch(_0x4c39eb){case _0xc7cf('0x21'):case _0xc7cf('0x1e'):_0x42c8db[_0xc7cf('0x2e')]=_0x548d87[_0xc7cf('0x7')](',');break;case _0xc7cf('0x27'):_0x42c8db[_0xc7cf('0x2e')]='%'+_0x548d87+'%';break;case _0xc7cf('0x2f'):_0x42c8db[_0xc7cf('0x2e')]=_0x548d87+'%';break;case _0xc7cf('0x30'):_0x42c8db[_0xc7cf('0x2e')]='%'+_0x548d87;break;case _0xc7cf('0x12'):var _0x5b5a63=_0x548d87[_0xc7cf('0x7')](',');var _0x548d87=_0x5b5a63[_0xc7cf('0xb')]();var _0xa0d74a=_0x5b5a63['pop']();if(_0x2ca776===_0xc7cf('0x31')){_0x548d87=moment(_0x548d87)[_0xc7cf('0x32')](0x0,!![])[_0xc7cf('0x33')]();_0xa0d74a=moment(_0xa0d74a)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0xc7cf('0x34')](0x3b,_0xc7cf('0x35'))[_0xc7cf('0x34')](0x3b,_0xc7cf('0x36'))[_0xc7cf('0x33')]();}_0x42c8db={'start':_0x548d87,'end':_0xa0d74a};break;default:_0x42c8db[_0xc7cf('0x2e')]=_0x548d87;break;}return _0x42c8db;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e5487e3..7cb28d5 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 _0xf4d3=['isEmail','getFullTextValue','forEach','replace','includes','query','$id','model','attributes','intersection','nolimit','offset','order','where','pick','merge','VIRTUAL','lower','filter','options','sequelize','moment','keys','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','$lte','utc','subtract','name','isArray','limit','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$'];(function(_0x16365f,_0x5566b1){var _0xd168c0=function(_0x5d3184){while(--_0x5d3184){_0x16365f['push'](_0x16365f['shift']());}};_0xd168c0(++_0x5566b1);}(_0xf4d3,0x140));var _0x3f4d=function(_0x55493c,_0xe38cd6){_0x55493c=_0x55493c-0x0;var _0x445b25=_0xf4d3[_0x55493c];return _0x445b25;};'use strict';var _=require('lodash');var sequelize=require(_0x3f4d('0x0'));var moment=require(_0x3f4d('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5606ba){var _0x519bcb=['ne'];try{var _0xc7d161=JSON['parse'](_0x5606ba);var _0x3923cc=Object[_0x3f4d('0x2')](_0xc7d161)[0x0];return _0x519bcb['includes'](_0x3923cc);}catch(_0x5ef273){return![];}}function getOperatorValue(_0x238c83){var _0x2d1c4b=JSON['parse'](_0x238c83);var _0x59bf14=Object[_0x3f4d('0x2')](_0x2d1c4b)[0x0];var _0x44f6a4=_0x2d1c4b[_0x59bf14];return{['$'+_0x59bf14]:_0x44f6a4};}exports[_0x3f4d('0x3')]=function(_0x1b7147){var _0x5435f0=null;if(_0x1b7147){_0x5435f0=_0x1b7147[_0x3f4d('0x4')](',');}return _0x5435f0;};exports[_0x3f4d('0x5')]=function(_0x50bcfa,_0x3b5d4e){var _0x13c939={};if(!_[_0x3f4d('0x6')](_0x50bcfa)){_[_0x3f4d('0x7')](_0x50bcfa,function(_0x41cb23,_0x97b71f){try{if(_0x3b5d4e){var _0x11bc17=_[_0x3f4d('0x8')](_0x3b5d4e,{'name':_0x97b71f})||{};if(hasSequelizeOperator(_0x41cb23)){_0x13c939[_0x97b71f]=getOperatorValue(_0x41cb23);}else if(_0x11bc17[_0x3f4d('0x9')]===_0x3f4d('0xa')&&_[_0x3f4d('0xb')](_0x41cb23)){var _0x2f636f=JSON[_0x3f4d('0xc')](_0x41cb23);var _0xd6fccd={'$gte':moment(moment(_0x2f636f['$gte'])[_0x3f4d('0xd')](_0x3f4d('0xe')))['utc']()[_0x3f4d('0xd')](),'$lte':moment(moment(_0x2f636f[_0x3f4d('0xf')])[_0x3f4d('0xd')](_0x3f4d('0xe')))[_0x3f4d('0x10')]()[_0x3f4d('0x11')](0x1,'s')[_0x3f4d('0xd')]()};_0x13c939[_0x97b71f]=_0xd6fccd;}else if(_0x11bc17[_0x3f4d('0x12')]==='uniqueid'){_0x13c939[_0x97b71f]=_0x41cb23;}else{_0x13c939[_0x97b71f]=_[_0x3f4d('0x13')](_0x41cb23)?_0x41cb23:JSON[_0x3f4d('0xc')](_0x41cb23);}}else{_0x13c939[_0x97b71f]=_[_0x3f4d('0x13')](_0x41cb23)?_0x41cb23:JSON[_0x3f4d('0xc')](_0x41cb23);}}catch(_0x114220){_0x13c939[_0x97b71f]=_0x41cb23['split'](',');}});}return _0x13c939;};exports[_0x3f4d('0x14')]=function(_0x481403){_0x481403=parseInt(_0x481403,0xa);if(!_0x481403||_0x481403<0x0){_0x481403=LIMIT_VALUE;}return _0x481403;};exports['offset']=function(_0x7c20eb){_0x7c20eb=parseInt(_0x7c20eb,0xa);if(!_0x7c20eb||_0x7c20eb<0x0){_0x7c20eb=0x0;}return _0x7c20eb;};exports[_0x3f4d('0x15')]=function(_0x1dc292){var _0x2be8e9,_0x459eb4=null;if(_0x1dc292){_0x2be8e9=_0x1dc292[_0x3f4d('0x4')](',');_0x459eb4=_[_0x3f4d('0x16')](_0x2be8e9,function(_0xba4bc1){if(_0xba4bc1[_0x3f4d('0x17')]('-')===0x0){return[_0xba4bc1===_0x3f4d('0x18')?sequelize['cast'](sequelize['col']('priority'),_0x3f4d('0x19')):_0xba4bc1[_0x3f4d('0x1a')](0x1),_0x3f4d('0x1b')];}else{return[_0xba4bc1===_0x3f4d('0x18')?sequelize[_0x3f4d('0x1c')](sequelize[_0x3f4d('0x1d')]('priority'),_0x3f4d('0x19')):_0xba4bc1,_0x3f4d('0x1e')];}});}return _0x459eb4;};exports[_0x3f4d('0x1f')]=function(_0x1c4390,_0x3e091b){if(_[_0x3f4d('0x6')](_0x1c4390)){return _0x1c4390;}if(_[_0x3f4d('0x13')](_0x1c4390)){for(var _0x3beac7=0x0;_0x3beac7<_0x1c4390[_0x3f4d('0x20')];_0x3beac7+=0x1){_0x1c4390[_0x3beac7]=this[_0x3f4d('0x1f')](_0x1c4390[_0x3beac7],_0x3e091b);}return _0x1c4390;}if(!_[_0x3f4d('0x21')](_0x1c4390)){return _0x1c4390;}if(_[_0x3f4d('0x22')](_0x3e091b)){_0x3e091b=[_0x3e091b];}if(!_[_0x3f4d('0x13')](_0x3e091b)){return _0x1c4390;}for(var _0x49d577=0x0;_0x49d577<_0x3e091b['length'];_0x49d577+=0x1){_[_0x3f4d('0x23')](_0x1c4390,_0x3e091b[_0x49d577]);}for(var _0x4fdf75 in _0x1c4390){if(_0x1c4390[_0x3f4d('0x24')](_0x4fdf75)){_0x1c4390[_0x4fdf75]=this[_0x3f4d('0x1f')](_0x1c4390[_0x4fdf75],_0x3e091b);}}return _0x1c4390;};exports[_0x3f4d('0x25')]=function(_0x218262){return _0x218262[_0x3f4d('0x26')](RegExp(_0x3f4d('0x27')))?!![]:![];};exports[_0x3f4d('0x28')]=function(_0x49680a){return _0x49680a[_0x3f4d('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x3f4d('0x29')]=function(_0x59f155){var _0x356572=[];_0x59f155[_0x3f4d('0x4')](/[ ,]+/)[_0x3f4d('0x2a')](function(_0x54256f){_0x54256f=_0x54256f[_0x3f4d('0x2b')](/([^:]")"+/g,'$1');_0x54256f='+'+_0x54256f+'*';if(_0x54256f[_0x3f4d('0x2c')]('@'))_0x54256f='\x22'+_0x54256f+'\x22';_0x356572['push'](_0x54256f);});return _0x356572['join']('\x20');};exports['getOptions']=function(_0x52ab60,_0x4d1681,_0x5cfdfb){var _0x22b073={},_0x1ca45a={};if(_0x4d1681[_0x3f4d('0x2d')][_0x3f4d('0x2e')]){_0x4d1681['query']['id']=_0x4d1681[_0x3f4d('0x2d')][_0x3f4d('0x2e')];delete _0x4d1681['query']['$id'];}_0x22b073['model']=_[_0x3f4d('0x16')](_0x52ab60,_0x3f4d('0x12'));_0x22b073[_0x3f4d('0x2d')]=_[_0x3f4d('0x2')](_0x4d1681[_0x3f4d('0x2d')]);_0x22b073[_0x3f4d('0x5')]=_['intersection'](_0x22b073[_0x3f4d('0x2f')],_0x22b073[_0x3f4d('0x2d')]);_0x1ca45a[_0x3f4d('0x30')]=_[_0x3f4d('0x31')](_0x22b073['model'],this[_0x3f4d('0x3')](_0x4d1681['query']['fields']));_0x1ca45a[_0x3f4d('0x30')]=_0x1ca45a[_0x3f4d('0x30')]['length']?_0x1ca45a[_0x3f4d('0x30')]:_0x22b073['model'];if(!_0x4d1681[_0x3f4d('0x2d')][_0x3f4d('0x24')](_0x3f4d('0x32'))){_0x1ca45a[_0x3f4d('0x14')]=this[_0x3f4d('0x14')](_0x4d1681[_0x3f4d('0x2d')]['limit']);_0x1ca45a[_0x3f4d('0x33')]=this['offset'](_0x4d1681[_0x3f4d('0x2d')]['offset']);}_0x1ca45a[_0x3f4d('0x34')]=this[_0x3f4d('0x15')](_0x4d1681['query'][_0x3f4d('0x15')]);_0x1ca45a[_0x3f4d('0x35')]=this[_0x3f4d('0x5')](_[_0x3f4d('0x36')](_0x4d1681['query'],_0x22b073['filters']),_0x52ab60);if(_0x4d1681[_0x3f4d('0x2d')]['filter']){_0x1ca45a['where']=_[_0x3f4d('0x37')](_0x1ca45a[_0x3f4d('0x35')],{'$or':_[_0x3f4d('0x16')](_0x52ab60,function(_0x53bd47){if(_0x53bd47[_0x3f4d('0x9')]!==_0x3f4d('0x38')){if(_0x5cfdfb){return sequelize['where'](sequelize['fn'](_0x3f4d('0x39'),sequelize[_0x3f4d('0x1d')](_0x53bd47[_0x3f4d('0x12')])),{'$like':sequelize['fn'](_0x3f4d('0x39'),'%'+_0x4d1681[_0x3f4d('0x2d')][_0x3f4d('0x3a')]+'%')});}else{var _0x38014b={};_0x38014b[_0x53bd47[_0x3f4d('0x12')]]={'$like':'%'+_0x4d1681[_0x3f4d('0x2d')][_0x3f4d('0x3a')]+'%'};return _0x38014b;}}})});}_0x1ca45a=_[_0x3f4d('0x37')]({},_0x1ca45a,_0x4d1681[_0x3f4d('0x3b')]);return _0x1ca45a;}; \ No newline at end of file +var _0xe32c=['attributes','limit','order','where','filters','pick','filter','type','lower','merge','options','lodash','sequelize','parse','includes','keys','fields','split','isEmpty','forOwn','find','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','getOptions','query','$id','model','name','intersection'];(function(_0x51b4b0,_0x3ffba9){var _0x2b2e4d=function(_0xd896a2){while(--_0xd896a2){_0x51b4b0['push'](_0x51b4b0['shift']());}};_0x2b2e4d(++_0x3ffba9);}(_0xe32c,0x83));var _0xce32=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0xe32c[_0x3a07c1];return _0x2bbe15;};'use strict';var _=require(_0xce32('0x0'));var sequelize=require(_0xce32('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2de1cc){var _0x3c3eab=['ne'];try{var _0x4ac142=JSON[_0xce32('0x2')](_0x2de1cc);var _0x49d8d8=Object['keys'](_0x4ac142)[0x0];return _0x3c3eab[_0xce32('0x3')](_0x49d8d8);}catch(_0x19b656){return![];}}function getOperatorValue(_0x96347a){var _0x2d0c2a=JSON[_0xce32('0x2')](_0x96347a);var _0x1f7632=Object[_0xce32('0x4')](_0x2d0c2a)[0x0];var _0x5ed36a=_0x2d0c2a[_0x1f7632];return{['$'+_0x1f7632]:_0x5ed36a};}exports[_0xce32('0x5')]=function(_0x192871){var _0x49bba2=null;if(_0x192871){_0x49bba2=_0x192871[_0xce32('0x6')](',');}return _0x49bba2;};exports['filters']=function(_0x1642a2,_0x3686ac){var _0x5a5263={};if(!_[_0xce32('0x7')](_0x1642a2)){_[_0xce32('0x8')](_0x1642a2,function(_0x408559,_0x2c3701){try{if(_0x3686ac){var _0x417003=_[_0xce32('0x9')](_0x3686ac,{'name':_0x2c3701})||{};if(hasSequelizeOperator(_0x408559)){_0x5a5263[_0x2c3701]=getOperatorValue(_0x408559);}else if(_0x417003['type']===_0xce32('0xa')&&_['isPlainObject'](_0x408559)){var _0x2d8af9=JSON['parse'](_0x408559);var _0x3e9d6c={'$gte':moment(moment(_0x2d8af9[_0xce32('0xb')])[_0xce32('0xc')](_0xce32('0xd')))[_0xce32('0xe')]()[_0xce32('0xc')](),'$lte':moment(moment(_0x2d8af9[_0xce32('0xf')])[_0xce32('0xc')](_0xce32('0xd')))['utc']()[_0xce32('0x10')](0x1,'s')['format']()};_0x5a5263[_0x2c3701]=_0x3e9d6c;}else if(_0x417003['name']===_0xce32('0x11')){_0x5a5263[_0x2c3701]=_0x408559;}else{_0x5a5263[_0x2c3701]=_['isArray'](_0x408559)?_0x408559:JSON[_0xce32('0x2')](_0x408559);}}else{_0x5a5263[_0x2c3701]=_[_0xce32('0x12')](_0x408559)?_0x408559:JSON[_0xce32('0x2')](_0x408559);}}catch(_0x4944ec){_0x5a5263[_0x2c3701]=_0x408559[_0xce32('0x6')](',');}});}return _0x5a5263;};exports['limit']=function(_0x4ae0bb){_0x4ae0bb=parseInt(_0x4ae0bb,0xa);if(!_0x4ae0bb||_0x4ae0bb<0x0){_0x4ae0bb=LIMIT_VALUE;}return _0x4ae0bb;};exports[_0xce32('0x13')]=function(_0x5a14a1){_0x5a14a1=parseInt(_0x5a14a1,0xa);if(!_0x5a14a1||_0x5a14a1<0x0){_0x5a14a1=0x0;}return _0x5a14a1;};exports[_0xce32('0x14')]=function(_0x326fa0){var _0x265a3d,_0x5e3be1=null;if(_0x326fa0){_0x265a3d=_0x326fa0[_0xce32('0x6')](',');_0x5e3be1=_[_0xce32('0x15')](_0x265a3d,function(_0x25e01b){if(_0x25e01b[_0xce32('0x16')]('-')===0x0){return[_0x25e01b===_0xce32('0x17')?sequelize['cast'](sequelize[_0xce32('0x18')](_0xce32('0x17')),_0xce32('0x19')):_0x25e01b[_0xce32('0x1a')](0x1),_0xce32('0x1b')];}else{return[_0x25e01b===_0xce32('0x17')?sequelize[_0xce32('0x1c')](sequelize[_0xce32('0x18')](_0xce32('0x17')),'unsigned'):_0x25e01b,'ASC'];}});}return _0x5e3be1;};exports[_0xce32('0x1d')]=function(_0x327dca,_0x50c596){if(_[_0xce32('0x7')](_0x327dca)){return _0x327dca;}if(_[_0xce32('0x12')](_0x327dca)){for(var _0x2cdc51=0x0;_0x2cdc51<_0x327dca[_0xce32('0x1e')];_0x2cdc51+=0x1){_0x327dca[_0x2cdc51]=this[_0xce32('0x1d')](_0x327dca[_0x2cdc51],_0x50c596);}return _0x327dca;}if(!_[_0xce32('0x1f')](_0x327dca)){return _0x327dca;}if(_[_0xce32('0x20')](_0x50c596)){_0x50c596=[_0x50c596];}if(!_[_0xce32('0x12')](_0x50c596)){return _0x327dca;}for(var _0x5f552e=0x0;_0x5f552e<_0x50c596[_0xce32('0x1e')];_0x5f552e+=0x1){_[_0xce32('0x21')](_0x327dca,_0x50c596[_0x5f552e]);}for(var _0x3aa956 in _0x327dca){if(_0x327dca[_0xce32('0x22')](_0x3aa956)){_0x327dca[_0x3aa956]=this[_0xce32('0x1d')](_0x327dca[_0x3aa956],_0x50c596);}}return _0x327dca;};exports[_0xce32('0x23')]=function(_0x3d285f){return _0x3d285f[_0xce32('0x24')](RegExp(_0xce32('0x25')))?!![]:![];};exports[_0xce32('0x26')]=function(_0x765311){return _0x765311[_0xce32('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xce32('0x27')]=function(_0x520224){var _0xb562dd=[];_0x520224['split'](/[ ,]+/)[_0xce32('0x28')](function(_0x196747){_0x196747=_0x196747[_0xce32('0x29')](/([^:]")"+/g,'$1');_0x196747='+'+_0x196747+'*';if(_0x196747[_0xce32('0x3')]('@'))_0x196747='\x22'+_0x196747+'\x22';_0xb562dd[_0xce32('0x2a')](_0x196747);});return _0xb562dd['join']('\x20');};exports[_0xce32('0x2b')]=function(_0x1b7a4b,_0x2e3bda,_0x5f5443){var _0x43e07d={},_0x4c3fb9={};if(_0x2e3bda[_0xce32('0x2c')][_0xce32('0x2d')]){_0x2e3bda['query']['id']=_0x2e3bda[_0xce32('0x2c')][_0xce32('0x2d')];delete _0x2e3bda[_0xce32('0x2c')][_0xce32('0x2d')];}_0x43e07d[_0xce32('0x2e')]=_[_0xce32('0x15')](_0x1b7a4b,_0xce32('0x2f'));_0x43e07d['query']=_['keys'](_0x2e3bda[_0xce32('0x2c')]);_0x43e07d['filters']=_[_0xce32('0x30')](_0x43e07d['model'],_0x43e07d['query']);_0x4c3fb9['attributes']=_[_0xce32('0x30')](_0x43e07d[_0xce32('0x2e')],this[_0xce32('0x5')](_0x2e3bda[_0xce32('0x2c')]['fields']));_0x4c3fb9[_0xce32('0x31')]=_0x4c3fb9['attributes']['length']?_0x4c3fb9[_0xce32('0x31')]:_0x43e07d[_0xce32('0x2e')];if(!_0x2e3bda[_0xce32('0x2c')][_0xce32('0x22')]('nolimit')){_0x4c3fb9[_0xce32('0x32')]=this['limit'](_0x2e3bda['query'][_0xce32('0x32')]);_0x4c3fb9[_0xce32('0x13')]=this[_0xce32('0x13')](_0x2e3bda['query'][_0xce32('0x13')]);}_0x4c3fb9[_0xce32('0x33')]=this['sort'](_0x2e3bda['query'][_0xce32('0x14')]);_0x4c3fb9[_0xce32('0x34')]=this[_0xce32('0x35')](_[_0xce32('0x36')](_0x2e3bda[_0xce32('0x2c')],_0x43e07d[_0xce32('0x35')]),_0x1b7a4b);if(_0x2e3bda[_0xce32('0x2c')][_0xce32('0x37')]){_0x4c3fb9[_0xce32('0x34')]=_['merge'](_0x4c3fb9[_0xce32('0x34')],{'$or':_[_0xce32('0x15')](_0x1b7a4b,function(_0x7fc74d){if(_0x7fc74d[_0xce32('0x38')]!=='VIRTUAL'){if(_0x5f5443){return sequelize[_0xce32('0x34')](sequelize['fn'](_0xce32('0x39'),sequelize[_0xce32('0x18')](_0x7fc74d[_0xce32('0x2f')])),{'$like':sequelize['fn'](_0xce32('0x39'),'%'+_0x2e3bda[_0xce32('0x2c')][_0xce32('0x37')]+'%')});}else{var _0x5e4312={};_0x5e4312[_0x7fc74d[_0xce32('0x2f')]]={'$like':'%'+_0x2e3bda['query'][_0xce32('0x37')]+'%'};return _0x5e4312;}}})});}_0x4c3fb9=_[_0xce32('0x3a')]({},_0x4c3fb9,_0x2e3bda[_0xce32('0x3b')]);return _0x4c3fb9;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a52d1cc..6438744 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7573=['renderFile','urlencoded','50mb','json','initialize','serve-favicon','body-parser','method-override','cookie-parser','passport','cors','moment','get','production','set','join','root','public','test','client','use','json\x20replacer','toISOString','split','appPath','views','/server/views','engine','html','ejs'];(function(_0x3999ac,_0x56f9d4){var _0x4a73e7=function(_0x3a081c){while(--_0x3a081c){_0x3999ac['push'](_0x3999ac['shift']());}};_0x4a73e7(++_0x56f9d4);}(_0x7573,0x7d));var _0x3757=function(_0x20bb65,_0x5046f1){_0x20bb65=_0x20bb65-0x0;var _0x577937=_0x7573[_0x20bb65];return _0x577937;};'use strict';var express=require('express');var favicon=require(_0x3757('0x0'));var bodyParser=require(_0x3757('0x1'));var methodOverride=require(_0x3757('0x2'));var cookieParser=require(_0x3757('0x3'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x3757('0x4'));var cors=require(_0x3757('0x5'));var moment=require(_0x3757('0x6'));var config=require('./environment');var db=require('../mysqldb')['db'];exports['default']=function(_0x24ec2b){var _0x47c66d=_0x24ec2b[_0x3757('0x7')]('env');if(_0x47c66d===_0x3757('0x8')){_0x24ec2b[_0x3757('0x9')]('appPath',path[_0x3757('0xa')](config[_0x3757('0xb')],_0x3757('0xc')));}if(_0x47c66d==='development'||_0x47c66d===_0x3757('0xd')){_0x24ec2b[_0x3757('0x9')]('appPath',path[_0x3757('0xa')](config[_0x3757('0xb')],_0x3757('0xe')));_0x24ec2b[_0x3757('0xf')](errorHandler());}_0x24ec2b['set'](_0x3757('0x10'),function(_0xb157a2,_0x50be85){if(this[_0xb157a2]instanceof Date){_0x50be85=this[_0xb157a2][_0x3757('0x11')]()[_0x3757('0x12')]('.')[0x0]+'Z';}return _0x50be85;});_0x24ec2b['use'](express['static'](_0x24ec2b[_0x3757('0x7')](_0x3757('0x13'))));_0x24ec2b['set'](_0x3757('0x14'),config[_0x3757('0xb')]+_0x3757('0x15'));_0x24ec2b[_0x3757('0x16')](_0x3757('0x17'),require(_0x3757('0x18'))[_0x3757('0x19')]);_0x24ec2b[_0x3757('0x9')]('view\x20engine',_0x3757('0x17'));_0x24ec2b[_0x3757('0xf')](bodyParser[_0x3757('0x1a')]({'limit':_0x3757('0x1b'),'extended':!![]}));_0x24ec2b[_0x3757('0xf')](bodyParser[_0x3757('0x1c')]({'limit':_0x3757('0x1b')}));_0x24ec2b[_0x3757('0xf')](cors());_0x24ec2b[_0x3757('0xf')](methodOverride());_0x24ec2b[_0x3757('0xf')](cookieParser());_0x24ec2b[_0x3757('0xf')](passport[_0x3757('0x1d')]());}; \ No newline at end of file +var _0x2271=['html','ejs','renderFile','view\x20engine','urlencoded','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','path','cors','moment','../mysqldb','default','get','env','production','join','root','public','test','appPath','client','use','set','split','static','views','/server/views','engine'];(function(_0x1abe07,_0x44ec3b){var _0x45336c=function(_0xa5c86c){while(--_0xa5c86c){_0x1abe07['push'](_0x1abe07['shift']());}};_0x45336c(++_0x44ec3b);}(_0x2271,0xac));var _0x1227=function(_0x370fd2,_0x413f1d){_0x370fd2=_0x370fd2-0x0;var _0x2acc0d=_0x2271[_0x370fd2];return _0x2acc0d;};'use strict';var express=require(_0x1227('0x0'));var favicon=require(_0x1227('0x1'));var bodyParser=require(_0x1227('0x2'));var methodOverride=require(_0x1227('0x3'));var cookieParser=require(_0x1227('0x4'));var errorHandler=require('errorhandler');var path=require(_0x1227('0x5'));var passport=require('passport');var cors=require(_0x1227('0x6'));var moment=require(_0x1227('0x7'));var config=require('./environment');var db=require(_0x1227('0x8'))['db'];exports[_0x1227('0x9')]=function(_0x6e8c7a){var _0x533844=_0x6e8c7a[_0x1227('0xa')](_0x1227('0xb'));if(_0x533844===_0x1227('0xc')){_0x6e8c7a['set']('appPath',path[_0x1227('0xd')](config[_0x1227('0xe')],_0x1227('0xf')));}if(_0x533844==='development'||_0x533844===_0x1227('0x10')){_0x6e8c7a['set'](_0x1227('0x11'),path[_0x1227('0xd')](config[_0x1227('0xe')],_0x1227('0x12')));_0x6e8c7a[_0x1227('0x13')](errorHandler());}_0x6e8c7a[_0x1227('0x14')]('json\x20replacer',function(_0x19dcbe,_0x355473){if(this[_0x19dcbe]instanceof Date){_0x355473=this[_0x19dcbe]['toISOString']()[_0x1227('0x15')]('.')[0x0]+'Z';}return _0x355473;});_0x6e8c7a[_0x1227('0x13')](express[_0x1227('0x16')](_0x6e8c7a['get'](_0x1227('0x11'))));_0x6e8c7a['set'](_0x1227('0x17'),config['root']+_0x1227('0x18'));_0x6e8c7a[_0x1227('0x19')](_0x1227('0x1a'),require(_0x1227('0x1b'))[_0x1227('0x1c')]);_0x6e8c7a['set'](_0x1227('0x1d'),_0x1227('0x1a'));_0x6e8c7a[_0x1227('0x13')](bodyParser[_0x1227('0x1e')]({'limit':'50mb','extended':!![]}));_0x6e8c7a[_0x1227('0x13')](bodyParser[_0x1227('0x1f')]({'limit':'50mb'}));_0x6e8c7a[_0x1227('0x13')](cors());_0x6e8c7a[_0x1227('0x13')](methodOverride());_0x6e8c7a[_0x1227('0x13')](cookieParser());_0x6e8c7a[_0x1227('0x13')](passport[_0x1227('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 35f1088..6f10552 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 _0xb037=['address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','lodash','child_process','execSync','../environment','orderBy','keys','length','family','IPv4','internal','mac','00:00:00:00:00:00'];(function(_0x28befa,_0x47e3b0){var _0x141a3a=function(_0x225e62){while(--_0x225e62){_0x28befa['push'](_0x28befa['shift']());}};_0x141a3a(++_0x47e3b0);}(_0xb037,0x180));var _0x7b03=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xb037[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0x7b03('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x7b03('0x1'))[_0x7b03('0x2')];var config=require(_0x7b03('0x3'));function getInterfaces(){var _0x226978=[];var _0x2fa000=os['networkInterfaces']();var _0x266e70=_[_0x7b03('0x4')](_[_0x7b03('0x5')](_0x2fa000));for(var _0x56a847=0x0;_0x56a847<_0x266e70[_0x7b03('0x6')];_0x56a847++){var _0x228dba=_0x2fa000[_0x266e70[_0x56a847]]['filter'](function(_0x356575){return _0x356575[_0x7b03('0x7')]===_0x7b03('0x8')&&_0x356575[_0x7b03('0x9')]===![];});_0x226978=_0x226978['concat'](_0x228dba);}return _0x226978;}function getFirstInterface(){var _0x2e3670=_['head'](getInterfaces());return{'macAddress':_0x2e3670&&_0x2e3670[_0x7b03('0xa')]?_0x2e3670[_0x7b03('0xa')]:_0x7b03('0xb'),'ipAddress':_0x2e3670&&_0x2e3670[_0x7b03('0xc')]?_0x2e3670['address']:_0x7b03('0xd')};}exports[_0x7b03('0xe')]=getFirstInterface;function getCPUhash(){var _0x54ba48=_[_0x7b03('0x4')](os[_0x7b03('0xf')]()['map'](function(_0x29f0ab){return _0x29f0ab[_0x7b03('0x10')];}))[_0x7b03('0x11')](':');return crypto[_0x7b03('0x12')](_0x7b03('0x13'))['update'](_0x54ba48)['digest'](_0x7b03('0x14'));}exports[_0x7b03('0x15')]=function(){var _0x4f9978=os[_0x7b03('0x16')]();var _0x141e1b=/[0-9a-f-]{36}/;if(config[_0x7b03('0x17')]&&_0x141e1b[_0x7b03('0x18')](config[_0x7b03('0x17')])){return config[_0x7b03('0x17')];}else if(_0x4f9978==='win32'){return exec(_0x7b03('0x19'),{'encoding':_0x7b03('0x1a')})[_0x7b03('0x1b')]('\x0d\x0a','');}else{var _0x16cde7=getFirstInterface();var _0x42cd0c=getCPUhash();var _0x15897e=_0x42cd0c+'|'+os[_0x7b03('0x1c')]()+'|'+_0x16cde7[_0x7b03('0x1d')]+'|'+_0x16cde7[_0x7b03('0x1e')];var _0x5cc52f=crypto[_0x7b03('0x12')](_0x7b03('0x13'))['update'](_0x15897e)[_0x7b03('0x1f')](_0x7b03('0x14'));return _0x5cc52f['substring'](0x0,0x8)+'-'+_0x5cc52f['substring'](0x8,0xc)+'-'+_0x5cc52f[_0x7b03('0x20')](0xc,0x10)+'-'+_0x5cc52f[_0x7b03('0x20')](0x10,0x14)+'-'+_0x5cc52f[_0x7b03('0x20')](0x14);}}; \ No newline at end of file +var _0x7f53=['hostname','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','address','127.0.0.1','join','md5','update','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace'];(function(_0x497803,_0x74b769){var _0x5dfc95=function(_0x2bf5fe){while(--_0x2bf5fe){_0x497803['push'](_0x497803['shift']());}};_0x5dfc95(++_0x74b769);}(_0x7f53,0xf2));var _0x37f5=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x7f53[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0x37f5('0x0'));var os=require('os');var crypto=require(_0x37f5('0x1'));var machine=require(_0x37f5('0x2'));var exec=require(_0x37f5('0x3'))[_0x37f5('0x4')];var config=require(_0x37f5('0x5'));function getInterfaces(){var _0x3335a9=[];var _0x22e39a=os[_0x37f5('0x6')]();var _0x2d6d97=_[_0x37f5('0x7')](_[_0x37f5('0x8')](_0x22e39a));for(var _0x1b1ac7=0x0;_0x1b1ac7<_0x2d6d97[_0x37f5('0x9')];_0x1b1ac7++){var _0x497e6e=_0x22e39a[_0x2d6d97[_0x1b1ac7]][_0x37f5('0xa')](function(_0x4ff8fa){return _0x4ff8fa[_0x37f5('0xb')]===_0x37f5('0xc')&&_0x4ff8fa[_0x37f5('0xd')]===![];});_0x3335a9=_0x3335a9[_0x37f5('0xe')](_0x497e6e);}return _0x3335a9;}function getFirstInterface(){var _0x27881c=_['head'](getInterfaces());return{'macAddress':_0x27881c&&_0x27881c[_0x37f5('0xf')]?_0x27881c[_0x37f5('0xf')]:'00:00:00:00:00:00','ipAddress':_0x27881c&&_0x27881c[_0x37f5('0x10')]?_0x27881c['address']:_0x37f5('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x346b99=_[_0x37f5('0x7')](os['cpus']()['map'](function(_0xdda373){return _0xdda373['model'];}))[_0x37f5('0x12')](':');return crypto['createHash'](_0x37f5('0x13'))[_0x37f5('0x14')](_0x346b99)[_0x37f5('0x15')](_0x37f5('0x16'));}exports[_0x37f5('0x17')]=function(){var _0x1de067=os[_0x37f5('0x18')]();var _0x35073f=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x35073f[_0x37f5('0x19')](config[_0x37f5('0x1a')])){return config[_0x37f5('0x1a')];}else if(_0x1de067===_0x37f5('0x1b')){return exec(_0x37f5('0x1c'),{'encoding':'utf8'})[_0x37f5('0x1d')]('\x0d\x0a','');}else{var _0x3dcb7b=getFirstInterface();var _0x31557c=getCPUhash();var _0x5b304a=_0x31557c+'|'+os[_0x37f5('0x1e')]()+'|'+_0x3dcb7b['macAddress']+'|'+_0x3dcb7b[_0x37f5('0x1f')];var _0x461e2=crypto[_0x37f5('0x20')](_0x37f5('0x13'))[_0x37f5('0x14')](_0x5b304a)[_0x37f5('0x15')](_0x37f5('0x16'));return _0x461e2[_0x37f5('0x21')](0x0,0x8)+'-'+_0x461e2[_0x37f5('0x21')](0x8,0xc)+'-'+_0x461e2['substring'](0xc,0x10)+'-'+_0x461e2[_0x37f5('0x21')](0x10,0x14)+'-'+_0x461e2[_0x37f5('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index be03b61..e7efe7e 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 _0xc484=['data1','then','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xc484,0x1f2));var _0x4c48=function(_0x331298,_0x12341a){_0x331298=_0x331298-0x0;var _0x3824bc=_0xc484[_0x331298];return _0x3824bc;};'use strict';var util=require(_0x4c48('0x0'));var moment=require(_0x4c48('0x1'));var rp=require(_0x4c48('0x2'));var BPromise=require(_0x4c48('0x3'));var pkginfo=require(_0x4c48('0x4'))(module,_0x4c48('0x5'));var db=require(_0x4c48('0x6'))['db'];var encryptor=require(_0x4c48('0x7'));var hardware=require(_0x4c48('0x8'));var logger=require(_0x4c48('0x9'))(_0x4c48('0xa'));var HOST=_0x4c48('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x47e276){return new BPromise(function(_0xd32847,_0x843030){var _0x1cac0a=util[_0x4c48('0xc')](_0x4c48('0xd'),HOST,_0x47e276,module[_0x4c48('0xe')][_0x4c48('0x5')]);if(oldToken){_0x1cac0a=util[_0x4c48('0xc')](_0x4c48('0xf'),HOST,_0x47e276,module[_0x4c48('0xe')][_0x4c48('0x5')],oldToken);}var _0x2b5f0f={'uri':_0x1cac0a,'method':_0x4c48('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x2b5f0f)['then'](function(_0x41214e){_0xd32847(_0x41214e);})[_0x4c48('0x11')](function(_0x3f10dd){_0x843030(_0x3f10dd);});});}function manageLicense(_0xb9355d,_0x5b629c){var _0x39cbbd=_0x5b629c['get']({'plain':!![]});if(!isOldTokenSent&&_0x39cbbd['data1']!==_0xb9355d&&!_0x39cbbd['data2']){oldToken=_0x39cbbd[_0x4c48('0x12')];}httpRequest(_0xb9355d)[_0x4c48('0x13')](function(_0x52ac27){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x52ac27[_0x4c48('0x14')]){isOldTokenSent=![];if(!_0x39cbbd['license']&&_0x39cbbd[_0x4c48('0xa')]!=_0x52ac27[_0x4c48('0xa')]||_0x39cbbd[_0x4c48('0xa')]&&_0x39cbbd[_0x4c48('0x15')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x39cbbd['license']&&!_0x39cbbd['data2']&&_0x39cbbd['license']!=_0x52ac27[_0x4c48('0xa')]){logger['info'](_0x4c48('0x16'));}if(_0x39cbbd[_0x4c48('0xa')]&&!_0x39cbbd[_0x4c48('0x15')]&&_0x39cbbd['license']==_0x52ac27[_0x4c48('0xa')]){return _0x5b629c;}return _0x5b629c[_0x4c48('0x17')]({'data1':_0xb9355d,'data2':null,'license':_0x52ac27[_0x4c48('0xa')]});}else{if(_0x52ac27[_0x4c48('0xa')]||_0x39cbbd[_0x4c48('0xa')]){if(!_0x39cbbd[_0x4c48('0x15')]){if(_0x39cbbd[_0x4c48('0x12')]==_0xb9355d){GRAY_PERIOD_REASON=_0x4c48('0x18');logger[_0x4c48('0x19')](_0x4c48('0x1a'));}else{GRAY_PERIOD_REASON=_0x4c48('0x1b');logger[_0x4c48('0x19')](_0x4c48('0x1c'),_0x39cbbd[_0x4c48('0x12')],_0xb9355d);}logger[_0x4c48('0x19')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x4c48('0x1d')](),moment()[_0x4c48('0xc')](_0x4c48('0x1e')));return _0x5b629c[_0x4c48('0x17')]({'data2':encryptor[_0x4c48('0x1f')](moment()[_0x4c48('0xc')](_0x4c48('0x1e')))});}else{if(moment()[_0x4c48('0x20')](encryptor[_0x4c48('0x21')](_0x39cbbd['data2']),_0x4c48('0x22'))>DAYS){logger[_0x4c48('0x19')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x4c48('0x1e')));isOldTokenSent=![];return _0x5b629c[_0x4c48('0x17')]({'data1':_0xb9355d,'data2':null,'license':null});}}}else{if(_0x39cbbd[_0x4c48('0x12')]!=_0xb9355d){logger[_0x4c48('0x19')](_0x4c48('0x1c'),_0x39cbbd[_0x4c48('0x12')],_0xb9355d);return _0x5b629c[_0x4c48('0x17')]({'data1':_0xb9355d,'data2':null,'license':null});}}}return _0x5b629c;})[_0x4c48('0x13')](function(_0x43aca6){_0x5b629c=_0x43aca6;})[_0x4c48('0x11')](function(_0x1d28b4){logger[_0x4c48('0x23')](_0x1d28b4[_0x4c48('0x24')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x4c48('0x25')](),_0x5b629c);},TIME);});}function defaultLicense(){var _0x349dd6=hardware['getUuid']();if(_0x349dd6){return db[_0x4c48('0x26')][_0x4c48('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x349dd6}})[_0x4c48('0x28')](function(_0x56c92a,_0x2cf49f){logger['info'](_0x4c48('0x29'),_0x349dd6);manageLicense(_0x349dd6,_0x56c92a);})[_0x4c48('0x11')](function(_0x515351){logger[_0x4c48('0x23')](_0x515351[_0x4c48('0x24')]);});}}exports[_0x4c48('0x2a')]=defaultLicense; \ No newline at end of file +var _0x5470=['get','data1','data2','active','license','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','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','version','../../mysqldb','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch'];(function(_0x16083b,_0x21dfb4){var _0x582fc2=function(_0x5854d4){while(--_0x5854d4){_0x16083b['push'](_0x16083b['shift']());}};_0x582fc2(++_0x21dfb4);}(_0x5470,0x153));var _0x0547=function(_0x3e23ae,_0x5009f7){_0x3e23ae=_0x3e23ae-0x0;var _0x4690c6=_0x5470[_0x3e23ae];return _0x4690c6;};'use strict';var util=require(_0x0547('0x0'));var moment=require(_0x0547('0x1'));var rp=require(_0x0547('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x0547('0x3'));var db=require(_0x0547('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require('../logger')('license');var HOST=_0x0547('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x43328d){return new BPromise(function(_0x121e51,_0x545021){var _0x1f51ce=util[_0x0547('0x6')]('%s/api/servers/%s/check?version=%s',HOST,_0x43328d,module['exports']['version']);if(oldToken){_0x1f51ce=util[_0x0547('0x6')](_0x0547('0x7'),HOST,_0x43328d,module['exports']['version'],oldToken);}var _0x411625={'uri':_0x1f51ce,'method':_0x0547('0x8'),'timeout':0xea60,'json':!![]};return rp(_0x411625)[_0x0547('0x9')](function(_0x4e04ec){_0x121e51(_0x4e04ec);})[_0x0547('0xa')](function(_0x154261){_0x545021(_0x154261);});});}function manageLicense(_0xdc2973,_0x394c69){var _0x48519a=_0x394c69[_0x0547('0xb')]({'plain':!![]});if(!isOldTokenSent&&_0x48519a[_0x0547('0xc')]!==_0xdc2973&&!_0x48519a[_0x0547('0xd')]){oldToken=_0x48519a['data1'];}httpRequest(_0xdc2973)['then'](function(_0x5239d0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5239d0[_0x0547('0xe')]){isOldTokenSent=![];if(!_0x48519a[_0x0547('0xf')]&&_0x48519a[_0x0547('0xf')]!=_0x5239d0[_0x0547('0xf')]||_0x48519a[_0x0547('0xf')]&&_0x48519a[_0x0547('0xd')]){logger[_0x0547('0x10')](_0x0547('0x11'));}if(_0x48519a[_0x0547('0xf')]&&!_0x48519a[_0x0547('0xd')]&&_0x48519a[_0x0547('0xf')]!=_0x5239d0['license']){logger['info'](_0x0547('0x12'));}if(_0x48519a['license']&&!_0x48519a[_0x0547('0xd')]&&_0x48519a[_0x0547('0xf')]==_0x5239d0[_0x0547('0xf')]){return _0x394c69;}return _0x394c69[_0x0547('0x13')]({'data1':_0xdc2973,'data2':null,'license':_0x5239d0[_0x0547('0xf')]});}else{if(_0x5239d0[_0x0547('0xf')]||_0x48519a['license']){if(!_0x48519a['data2']){if(_0x48519a['data1']==_0xdc2973){GRAY_PERIOD_REASON=_0x0547('0x14');logger['info'](_0x0547('0x15'));}else{GRAY_PERIOD_REASON=_0x0547('0x16');logger['info'](_0x0547('0x17'),_0x48519a[_0x0547('0xc')],_0xdc2973);}logger['info'](_0x0547('0x18'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x0547('0x6')](_0x0547('0x19')));return _0x394c69['update']({'data2':encryptor['encryptString'](moment()[_0x0547('0x6')](_0x0547('0x19')))});}else{if(moment()[_0x0547('0x1a')](encryptor[_0x0547('0x1b')](_0x48519a[_0x0547('0xd')]),_0x0547('0x1c'))>DAYS){logger['info'](_0x0547('0x1d'),moment()[_0x0547('0x6')](_0x0547('0x19')));isOldTokenSent=![];return _0x394c69[_0x0547('0x13')]({'data1':_0xdc2973,'data2':null,'license':null});}}}else{if(_0x48519a[_0x0547('0xc')]!=_0xdc2973){logger['info'](_0x0547('0x17'),_0x48519a['data1'],_0xdc2973);return _0x394c69['update']({'data1':_0xdc2973,'data2':null,'license':null});}}}return _0x394c69;})['then'](function(_0x4cf72f){_0x394c69=_0x4cf72f;})[_0x0547('0xa')](function(_0x2a963e){logger[_0x0547('0x1e')](_0x2a963e[_0x0547('0x1f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x0547('0x20')](),_0x394c69);},TIME);});}function defaultLicense(){var _0x55ec2b=hardware[_0x0547('0x20')]();if(_0x55ec2b){return db[_0x0547('0x21')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x55ec2b}})['spread'](function(_0x3a0c45,_0x114930){logger[_0x0547('0x10')](_0x0547('0x22'),_0x55ec2b);manageLicense(_0x55ec2b,_0x3a0c45);})[_0x0547('0xa')](function(_0x2a1ca0){logger['error'](_0x2a1ca0[_0x0547('0x1f')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index df9e142..56df7f2 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 _0x9f0b=['split','format','%s:%s:%s','parse','demo','decryptString','gray','deadline','add','days','grayReason','uuid','machineUuid','changed','disabled','message','findAll','role','sequelize','COUNT','count','admin','user','telephone','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','catch','data1','license','data2'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x9f0b,0x1b1));var _0xb9f0=function(_0x15bbf1,_0x40ef96){_0x15bbf1=_0x15bbf1-0x0;var _0x5c4b47=_0x9f0b[_0x15bbf1];return _0x5c4b47;};'use strict';var util=require(_0xb9f0('0x0'));var _=require(_0xb9f0('0x1'));var moment=require(_0xb9f0('0x2'));var BPromise=require(_0xb9f0('0x3'));var hardware=require(_0xb9f0('0x4'));var encryptor=require(_0xb9f0('0x5'));var db=require(_0xb9f0('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb9f0('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb9f0('0x8'),'machineUuid':hardware[_0xb9f0('0x9')](),'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(_0xf4dc7a){return new BPromise(function(_0x4cbd20,_0x31c561){return db[_0xb9f0('0xa')][_0xb9f0('0xb')](_['defaults'](_0xf4dc7a,{'raw':!![],'where':{'id':0x1}}))[_0xb9f0('0xc')](function(_0x1b2010){return checkLicense(_0x1b2010,null);})['then'](function(_0x1b8930){_0x4cbd20(_0x1b8930);return;})[_0xb9f0('0xd')](function(_0x3f41eb){_0x31c561(_0x3f41eb);});});}function checkLicense(_0x3faa31,_0x2acb2e){if(!_0x3faa31){demoLicense['uuid']=_0x3faa31[_0xb9f0('0xe')];return demoLicense;}try{var _0x283caa=_0x2acb2e||_0x3faa31[_0xb9f0('0xf')];if(_['isEmpty'](_0x283caa)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x154d04=_0x3faa31[_0xb9f0('0xe')];var _0x1dc610=_0x3faa31[_0xb9f0('0x10')];var _0x4cc2e5=_0x154d04['split']('-')[0x4];var _0x3e72db=_0x154d04[_0xb9f0('0x11')]('-')[0x0];var _0x3c5641=encryptor['decryptString'](_0x283caa,util[_0xb9f0('0x12')](_0xb9f0('0x13'),_0x4cc2e5,_0x154d04,_0x3e72db));var _0x4e6134=JSON[_0xb9f0('0x14')](_0x3c5641);_0x4e6134[_0xb9f0('0x15')]=![];_0x4e6134['uuid']=_0x154d04;_0x4e6134['machineUuid']=hardware[_0xb9f0('0x9')]();if(_0x1dc610){var _0x181300=encryptor[_0xb9f0('0x16')](_0x1dc610);_0x4e6134[_0xb9f0('0x17')]=_0x181300;_0x4e6134[_0xb9f0('0x18')]=moment(_0x181300)[_0xb9f0('0x19')](0x7,_0xb9f0('0x1a'))['format']();_0x4e6134[_0xb9f0('0x1b')]=_0x4e6134[_0xb9f0('0x1c')]!=_0x4e6134[_0xb9f0('0x1d')]?_0xb9f0('0x1e'):_0xb9f0('0x1f');}return _0x4e6134;}catch(_0x43a6f1){breakingLicense[_0xb9f0('0x1c')]=_0x3faa31[_0xb9f0('0xe')];breakingLicense[_0xb9f0('0x20')]=_0x43a6f1[_0xb9f0('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x58453b,_0xf9fb73){getLicense()[_0xb9f0('0xc')](function(_0x1ed924){return db['User'][_0xb9f0('0x21')]({'attributes':[_0xb9f0('0x22'),[db[_0xb9f0('0x23')]['fn'](_0xb9f0('0x24'),db[_0xb9f0('0x23')]['col'](_0xb9f0('0x22'))),_0xb9f0('0x25')]],'group':'role','where':{'role':{'$or':[_0xb9f0('0x26'),_0xb9f0('0x27'),_0xb9f0('0x28')]}},'raw':!![]})[_0xb9f0('0xc')](function(_0x156dc3){var _0x1c0863={'user':_0x1ed924['users']||0x0,'telephone':_0x1ed924[_0xb9f0('0x29')]||0x0};_0x156dc3['forEach'](function(_0x331480){var _0x29a7d1=_0x331480[_0xb9f0('0x22')]===_0xb9f0('0x26')?_0xb9f0('0x27'):_0x331480[_0xb9f0('0x22')];_0x1c0863[_0x29a7d1]-=_0x331480[_0xb9f0('0x25')];if(_0x1c0863[_0x29a7d1]<0x0)_0x1c0863[_0x29a7d1]=0x0;});_0x58453b(_0x1c0863);return;});})[_0xb9f0('0xd')](function(_0x2cf4ca){_0xf9fb73(_0x2cf4ca);});});}function checkUserLimits(_0x298b68){return new BPromise(function(_0x14e508,_0x474024){getLimits()[_0xb9f0('0xc')](function(_0x143890){var _0x3a8181=_[_0xb9f0('0x2a')](_[_0xb9f0('0x2b')](_0x298b68,_0xb9f0('0x22')),[_0xb9f0('0x26'),_0xb9f0('0x27'),_0xb9f0('0x28')]);var _0x295637=(_0x3a8181[_0xb9f0('0x26')]||0x0)+(_0x3a8181[_0xb9f0('0x27')]||0x0);var _0x2852e7=_0x3a8181[_0xb9f0('0x28')]||0x0;if(_0x295637>_0x143890[_0xb9f0('0x27')])return _0x474024(_0xb9f0('0x2c'));if(_0x2852e7>_0x143890['telephone'])return _0x474024('License\x20limit\x20reached\x20for\x20telephones');return _0x14e508();})['catch'](function(_0x9f86ce){_0x474024(_0x9f86ce);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5c35=['telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','changed','message','User','findAll','role','COUNT','sequelize','count','admin','user'];(function(_0x3779ae,_0x563f5c){var _0x550cf8=function(_0x514c1b){while(--_0x514c1b){_0x3779ae['push'](_0x3779ae['shift']());}};_0x550cf8(++_0x563f5c);}(_0x5c35,0x1a5));var _0x55c3=function(_0xaaffc9,_0x1db33d){_0xaaffc9=_0xaaffc9-0x0;var _0xf447d3=_0x5c35[_0xaaffc9];return _0xf447d3;};'use strict';var util=require(_0x55c3('0x0'));var _=require(_0x55c3('0x1'));var moment=require(_0x55c3('0x2'));var BPromise=require('bluebird');var hardware=require(_0x55c3('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x55c3('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x55c3('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x55c3('0x6'),'machineUuid':hardware[_0x55c3('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x55c3('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x55c3('0x8'),'machineUuid':hardware[_0x55c3('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x34bc52){return new BPromise(function(_0x5d5297,_0x3abcbc){return db[_0x55c3('0x9')][_0x55c3('0xa')](_[_0x55c3('0xb')](_0x34bc52,{'raw':!![],'where':{'id':0x1}}))[_0x55c3('0xc')](function(_0x598645){return checkLicense(_0x598645,null);})[_0x55c3('0xc')](function(_0xe59e9c){_0x5d5297(_0xe59e9c);return;})[_0x55c3('0xd')](function(_0x2dcbd9){_0x3abcbc(_0x2dcbd9);});});}function checkLicense(_0x171634,_0x4487cc){if(!_0x171634){demoLicense[_0x55c3('0xe')]=_0x171634[_0x55c3('0xf')];return demoLicense;}try{var _0xa04461=_0x4487cc||_0x171634[_0x55c3('0x10')];if(_['isEmpty'](_0xa04461)){throw new Error(_0x55c3('0x11'));}var _0x3111fc=_0x171634[_0x55c3('0xf')];var _0x3e45ec=_0x171634[_0x55c3('0x12')];var _0x938bf0=_0x3111fc[_0x55c3('0x13')]('-')[0x4];var _0x224ca3=_0x3111fc[_0x55c3('0x13')]('-')[0x0];var _0xd479ec=encryptor[_0x55c3('0x14')](_0xa04461,util[_0x55c3('0x15')](_0x55c3('0x16'),_0x938bf0,_0x3111fc,_0x224ca3));var _0xee6223=JSON[_0x55c3('0x17')](_0xd479ec);_0xee6223[_0x55c3('0x18')]=![];_0xee6223['uuid']=_0x3111fc;_0xee6223[_0x55c3('0x19')]=hardware[_0x55c3('0x7')]();if(_0x3e45ec){var _0x5bd497=encryptor[_0x55c3('0x14')](_0x3e45ec);_0xee6223['gray']=_0x5bd497;_0xee6223[_0x55c3('0x1a')]=moment(_0x5bd497)[_0x55c3('0x1b')](0x7,_0x55c3('0x1c'))['format']();_0xee6223['grayReason']=_0xee6223['uuid']!=_0xee6223[_0x55c3('0x19')]?_0x55c3('0x1d'):'disabled';}return _0xee6223;}catch(_0x16f5c4){breakingLicense['uuid']=_0x171634[_0x55c3('0xf')];breakingLicense[_0x55c3('0x1e')]=_0x16f5c4[_0x55c3('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xffd731,_0x239dd2){getLicense()[_0x55c3('0xc')](function(_0x4741fd){return db[_0x55c3('0x1f')][_0x55c3('0x20')]({'attributes':[_0x55c3('0x21'),[db['sequelize']['fn'](_0x55c3('0x22'),db[_0x55c3('0x23')]['col'](_0x55c3('0x21'))),_0x55c3('0x24')]],'group':_0x55c3('0x21'),'where':{'role':{'$or':[_0x55c3('0x25'),_0x55c3('0x26'),_0x55c3('0x27')]}},'raw':!![]})[_0x55c3('0xc')](function(_0x3cb707){var _0x1a6598={'user':_0x4741fd['users']||0x0,'telephone':_0x4741fd[_0x55c3('0x28')]||0x0};_0x3cb707[_0x55c3('0x29')](function(_0x7ee75e){var _0x51f1be=_0x7ee75e['role']===_0x55c3('0x25')?'user':_0x7ee75e[_0x55c3('0x21')];_0x1a6598[_0x51f1be]-=_0x7ee75e[_0x55c3('0x24')];if(_0x1a6598[_0x51f1be]<0x0)_0x1a6598[_0x51f1be]=0x0;});_0xffd731(_0x1a6598);return;});})[_0x55c3('0xd')](function(_0x1d33cf){_0x239dd2(_0x1d33cf);});});}function checkUserLimits(_0x243b30){return new BPromise(function(_0x2d946c,_0x511603){getLimits()[_0x55c3('0xc')](function(_0x2594d5){var _0x14c72a=_[_0x55c3('0x2a')](_[_0x55c3('0x2b')](_0x243b30,'role'),['admin',_0x55c3('0x26'),_0x55c3('0x27')]);var _0x6bb7f0=(_0x14c72a[_0x55c3('0x25')]||0x0)+(_0x14c72a['user']||0x0);var _0x12f1d4=_0x14c72a[_0x55c3('0x27')]||0x0;if(_0x6bb7f0>_0x2594d5[_0x55c3('0x26')])return _0x511603('License\x20limit\x20reached\x20for\x20users');if(_0x12f1d4>_0x2594d5[_0x55c3('0x27')])return _0x511603(_0x55c3('0x2c'));return _0x2d946c();})[_0x55c3('0xd')](function(_0x363f7f){_0x511603(_0x363f7f);});});}module[_0x55c3('0x2d')]={'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 1bbb833..9013211 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 _0xb62e=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x1ed8ba,_0x1cb625){var _0x163da5=function(_0x22ea83){while(--_0x22ea83){_0x1ed8ba['push'](_0x1ed8ba['shift']());}};_0x163da5(++_0x1cb625);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';module[_0xeb62('0x0')]={'DOMAIN':_0xeb62('0x1'),'SESSION_SECRET':_0xeb62('0x2'),'GOOGLE_ID':_0xeb62('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xaebd=['secret','exports','myappanuglar-secret','app-id'];(function(_0x38a14d,_0x470117){var _0x1ef4ad=function(_0x48b3bf){while(--_0x48b3bf){_0x38a14d['push'](_0x38a14d['shift']());}};_0x1ef4ad(++_0x470117);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x5dc41e,_0x1fe79b){_0x5dc41e=_0x5dc41e-0x0;var _0x4884ed=_0xaebd[_0x5dc41e];return _0x4884ed;};'use strict';module[_0xdaeb('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xdaeb('0x1'),'GOOGLE_ID':_0xdaeb('0x2'),'GOOGLE_SECRET':_0xdaeb('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 72c13ea..c60735b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc594=['message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','%s-%s','error','transports','info','Console','env','debugLevel','moment','util','INFO','log','xcally','%s-%s.log'];(function(_0x151370,_0xdcac59){var _0x2993ac=function(_0x33d896){while(--_0x33d896){_0x151370['push'](_0x151370['shift']());}};_0x2993ac(++_0xdcac59);}(_0xc594,0x1f2));var _0x4c59=function(_0x38d9cd,_0x128298){_0x38d9cd=_0x38d9cd-0x0;var _0x443e4a=_0xc594[_0x38d9cd];return _0x443e4a;};'use strict';var moment=require(_0x4c59('0x0'));var winston=require('winston');var util=require(_0x4c59('0x1'));var path=require('path');var debugLevel=_0x4c59('0x2');function filename(_0x1b1e00,_0xe78bc8){return path['join']('/var',_0x4c59('0x3'),_0x4c59('0x4'),util['format'](_0x4c59('0x5'),_0x1b1e00,_0xe78bc8));}function formatter(_0x1ff2c7,_0x81cd2b){_0x81cd2b[_0x4c59('0x6')]=_0x81cd2b[_0x4c59('0x6')][_0x4c59('0x7')](/@@{/g,'{{{')[_0x4c59('0x7')](/}@@/g,_0x4c59('0x8'))[_0x4c59('0x7')](/@{/g,'{{')[_0x4c59('0x7')](/}@/g,'}}');return util[_0x4c59('0x9')](_0x4c59('0xa'),moment()[_0x4c59('0x9')](_0x4c59('0xb')),_0x81cd2b[_0x4c59('0xc')]['toUpperCase'](),_0x1ff2c7,_0x81cd2b[_0x4c59('0x6')]);}module[_0x4c59('0xd')]=function(_0x558632){return new winston['Logger']({'transports':[new winston['transports']['File']({'name':util[_0x4c59('0x9')](_0x4c59('0xe'),_0x558632,_0x4c59('0xf')),'filename':filename(_0x558632,_0x4c59('0xf')),'level':_0x4c59('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4176ee){return formatter(_0x558632,_0x4176ee);}}),new winston[(_0x4c59('0x10'))]['File']({'name':util[_0x4c59('0x9')](_0x4c59('0xe'),_0x558632,_0x4c59('0x11')),'filename':filename(_0x558632,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x210ffa){return formatter(_0x558632,_0x210ffa);}}),new winston[(_0x4c59('0x10'))][(_0x4c59('0x12'))]({'level':process[_0x4c59('0x13')][_0x4c59('0x14')]||debugLevel,'json':![],'formatter':function(_0x487c9c){return formatter(_0x558632,_0x487c9c);}})]});}; \ No newline at end of file +var _0x36d3=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','error','%s-%s','info','env','debugLevel','moment','winston','util','path','INFO','join','/var','log','format','message','{{{','replace','}}}'];(function(_0x2c4d38,_0x2b6820){var _0x22e5d9=function(_0x87d074){while(--_0x87d074){_0x2c4d38['push'](_0x2c4d38['shift']());}};_0x22e5d9(++_0x2b6820);}(_0x36d3,0x1e1));var _0x336d=function(_0x372938,_0x454f2a){_0x372938=_0x372938-0x0;var _0x39ebc5=_0x36d3[_0x372938];return _0x39ebc5;};'use strict';var moment=require(_0x336d('0x0'));var winston=require(_0x336d('0x1'));var util=require(_0x336d('0x2'));var path=require(_0x336d('0x3'));var debugLevel=_0x336d('0x4');function filename(_0x3b3bc9,_0x236601){return path[_0x336d('0x5')](_0x336d('0x6'),_0x336d('0x7'),'xcally',util[_0x336d('0x8')]('%s-%s.log',_0x3b3bc9,_0x236601));}function formatter(_0x3b7417,_0x21f950){_0x21f950[_0x336d('0x9')]=_0x21f950[_0x336d('0x9')]['replace'](/@@{/g,_0x336d('0xa'))[_0x336d('0xb')](/}@@/g,_0x336d('0xc'))['replace'](/@{/g,'{{')[_0x336d('0xb')](/}@/g,'}}');return util[_0x336d('0x8')](_0x336d('0xd'),moment()[_0x336d('0x8')](_0x336d('0xe')),_0x21f950[_0x336d('0xf')][_0x336d('0x10')](),_0x3b7417,_0x21f950[_0x336d('0x9')]);}module[_0x336d('0x11')]=function(_0x27c7c1){return new winston[(_0x336d('0x12'))]({'transports':[new winston[(_0x336d('0x13'))][(_0x336d('0x14'))]({'name':util[_0x336d('0x8')]('%s-%s',_0x27c7c1,_0x336d('0x15')),'filename':filename(_0x27c7c1,_0x336d('0x15')),'level':_0x336d('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa0c5c2){return formatter(_0x27c7c1,_0xa0c5c2);}}),new winston[(_0x336d('0x13'))][(_0x336d('0x14'))]({'name':util['format'](_0x336d('0x16'),_0x27c7c1,_0x336d('0x17')),'filename':filename(_0x27c7c1,_0x336d('0x17')),'level':_0x336d('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ff225){return formatter(_0x27c7c1,_0x1ff225);}}),new winston['transports']['Console']({'level':process[_0x336d('0x18')][_0x336d('0x19')]||debugLevel,'json':![],'formatter':function(_0x1fbb29){return formatter(_0x27c7c1,_0x1fbb29);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7458361..c51d880 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 _0xdd01=['exports','path','express','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js'];(function(_0x53f37a,_0x34abad){var _0x327a43=function(_0x12dc7e){while(--_0x12dc7e){_0x53f37a['push'](_0x53f37a['shift']());}};_0x327a43(++_0x34abad);}(_0xdd01,0x146));var _0x1dd0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xdd01[_0x12fc8d];return _0x3f9d04;};'use strict';var path=require(_0x1dd0('0x0'));var os=require('os');var config={'apps':[{'name':_0x1dd0('0x1'),'script':path[_0x1dd0('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x1dd0('0x3'),'script':path['join'](__dirname,_0x1dd0('0x4'))},{'name':_0x1dd0('0x5'),'script':path[_0x1dd0('0x2')](__dirname,_0x1dd0('0x6'))},{'name':_0x1dd0('0x7'),'script':path[_0x1dd0('0x2')](__dirname,_0x1dd0('0x8'))},{'name':_0x1dd0('0x9'),'script':path['join'](__dirname,_0x1dd0('0xa'))},{'name':'xdr','script':path[_0x1dd0('0x2')](__dirname,_0x1dd0('0xb'))}]};module[_0x1dd0('0xc')]=config; \ No newline at end of file +var _0x3a94=['../../services/xdr/index.js','path','express','join','agi','../../services/agi/index.js','email','routing','xdr'];(function(_0x5f5641,_0x20bd42){var _0x3090cb=function(_0x2dfbe3){while(--_0x2dfbe3){_0x5f5641['push'](_0x5f5641['shift']());}};_0x3090cb(++_0x20bd42);}(_0x3a94,0xd0));var _0x43a9=function(_0x197058,_0xa42002){_0x197058=_0x197058-0x0;var _0x10df0d=_0x3a94[_0x197058];return _0x10df0d;};'use strict';var path=require(_0x43a9('0x0'));var os=require('os');var config={'apps':[{'name':_0x43a9('0x1'),'script':path[_0x43a9('0x2')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0x43a9('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x43a9('0x3'),'script':path['join'](__dirname,_0x43a9('0x4'))},{'name':_0x43a9('0x5'),'script':path[_0x43a9('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x43a9('0x6'),'script':path[_0x43a9('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x43a9('0x7'),'script':path[_0x43a9('0x2')](__dirname,_0x43a9('0x8'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9e023ac..2e0c69b 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 _0x32aa=['pm2','bluebird','./config','connect','start','disconnect','stop','then','restart','list','describe','delete','dump','saved'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x32aa,0x118));var _0xa32a=function(_0x27d0ad,_0x3f8bef){_0x27d0ad=_0x27d0ad-0x0;var _0x4eec43=_0x32aa[_0x27d0ad];return _0x4eec43;};'use strict';var pm2=require(_0xa32a('0x0'));var BPromise=require(_0xa32a('0x1'));var config=require(_0xa32a('0x2'));function connect(){return new BPromise(function(_0x2eb905,_0x27806d){return pm2[_0xa32a('0x3')](function(_0x1a7b82){if(_0x1a7b82){return _0x27806d(_0x1a7b82);}return _0x2eb905('connected');});});};exports[_0xa32a('0x4')]=function(_0x3363b1){return connect()['then'](function(){return new BPromise(function(_0x31103b,_0x45619a){return pm2[_0xa32a('0x4')](_0x3363b1,function(_0x46124d,_0xe9efaf){if(_0x46124d){return _0x45619a(_0x46124d);}pm2[_0xa32a('0x5')]();return _0x31103b(_0xe9efaf);});});});};exports[_0xa32a('0x6')]=function(_0x5c6907){return connect()[_0xa32a('0x7')](function(){return new BPromise(function(_0x5ecd01,_0x5bd8d2){return pm2[_0xa32a('0x6')](_0x5c6907,function(_0x4d6343,_0x54f491){if(_0x4d6343){return _0x5bd8d2(_0x4d6343);}pm2[_0xa32a('0x5')]();return _0x5ecd01(_0x54f491);});});});};exports[_0xa32a('0x8')]=function(_0x4e0ca8){return connect()[_0xa32a('0x7')](function(){return new BPromise(function(_0x39fbc2,_0x5ab643){return pm2[_0xa32a('0x8')](_0x4e0ca8,function(_0x36c0b7,_0xc8b7d3){if(_0x36c0b7){return _0x5ab643(_0x36c0b7);}pm2[_0xa32a('0x5')]();return _0x39fbc2(_0xc8b7d3);});});});};exports[_0xa32a('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5dafff,_0x4981c9){return pm2[_0xa32a('0x9')](function(_0x178391,_0x13aefd){if(_0x178391){return _0x4981c9(_0x178391);}pm2[_0xa32a('0x5')]();return _0x5dafff(_0x13aefd);});});});};exports['describe']=function(_0x2afdf3){return connect()[_0xa32a('0x7')](function(){return new BPromise(function(_0x45e94a,_0x5d3c0a){return pm2[_0xa32a('0xa')](_0x2afdf3,function(_0x15feae,_0x51f58a){if(_0x15feae){return _0x5d3c0a(_0x15feae);}pm2[_0xa32a('0x5')]();return _0x45e94a(_0x51f58a);});});});};exports[_0xa32a('0xb')]=function(_0x3a5680){return connect()['then'](function(){return new BPromise(function(_0x4212df,_0x465207){return pm2[_0xa32a('0xb')](_0x3a5680,function(_0x5d4803,_0x3f6682){if(_0x5d4803){return _0x465207(_0x5d4803);}pm2[_0xa32a('0x5')]();return _0x4212df(_0x3f6682);});});});};exports[_0xa32a('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1c785e,_0x4c65b9){return pm2['dump'](function(_0x3facc7){if(_0x3facc7){return _0x4c65b9(_0x3facc7);}return _0x1c785e(_0xa32a('0xd'));});});});}; \ No newline at end of file +var _0x691f=['saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x691f,0xc4));var _0xf691=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x691f[_0x2212d1];return _0x15eec5;};'use strict';var pm2=require(_0xf691('0x0'));var BPromise=require(_0xf691('0x1'));var config=require(_0xf691('0x2'));function connect(){return new BPromise(function(_0x5d8893,_0x4515db){return pm2[_0xf691('0x3')](function(_0x519ee9){if(_0x519ee9){return _0x4515db(_0x519ee9);}return _0x5d8893(_0xf691('0x4'));});});};exports[_0xf691('0x5')]=function(_0x54d82d){return connect()[_0xf691('0x6')](function(){return new BPromise(function(_0x329337,_0xee4835){return pm2['start'](_0x54d82d,function(_0x39ab62,_0x5a282f){if(_0x39ab62){return _0xee4835(_0x39ab62);}pm2[_0xf691('0x7')]();return _0x329337(_0x5a282f);});});});};exports[_0xf691('0x8')]=function(_0x442938){return connect()['then'](function(){return new BPromise(function(_0x3f220d,_0x1a1519){return pm2['stop'](_0x442938,function(_0x228c3c,_0x38bf00){if(_0x228c3c){return _0x1a1519(_0x228c3c);}pm2[_0xf691('0x7')]();return _0x3f220d(_0x38bf00);});});});};exports[_0xf691('0x9')]=function(_0x3d2075){return connect()[_0xf691('0x6')](function(){return new BPromise(function(_0x40bfb5,_0x5b4d91){return pm2[_0xf691('0x9')](_0x3d2075,function(_0x5f92c6,_0x55adf2){if(_0x5f92c6){return _0x5b4d91(_0x5f92c6);}pm2['disconnect']();return _0x40bfb5(_0x55adf2);});});});};exports[_0xf691('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x28ed23,_0x3c662b){return pm2[_0xf691('0xa')](function(_0x28c904,_0x3dfa5d){if(_0x28c904){return _0x3c662b(_0x28c904);}pm2[_0xf691('0x7')]();return _0x28ed23(_0x3dfa5d);});});});};exports['describe']=function(_0x423f23){return connect()['then'](function(){return new BPromise(function(_0x2bc592,_0x1a567d){return pm2[_0xf691('0xb')](_0x423f23,function(_0x4823cf,_0x4f5737){if(_0x4823cf){return _0x1a567d(_0x4823cf);}pm2[_0xf691('0x7')]();return _0x2bc592(_0x4f5737);});});});};exports[_0xf691('0xc')]=function(_0x2d2833){return connect()[_0xf691('0x6')](function(){return new BPromise(function(_0x252132,_0x7885e2){return pm2[_0xf691('0xc')](_0x2d2833,function(_0x5b00d8,_0x4ff64f){if(_0x5b00d8){return _0x7885e2(_0x5b00d8);}pm2['disconnect']();return _0x252132(_0x4ff64f);});});});};exports[_0xf691('0xd')]=function(){return connect()[_0xf691('0x6')](function(){return new BPromise(function(_0x581e89,_0x59861d){return pm2[_0xf691('0xd')](function(_0x3978b2){if(_0x3978b2){return _0x59861d(_0x3978b2);}return _0x581e89(_0xf691('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 602dea7..d2e0329 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 _0x0663=['map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','error','start','moment','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length'];(function(_0x1999b8,_0x504366){var _0x5bd155=function(_0xd6ae34){while(--_0xd6ae34){_0x1999b8['push'](_0x1999b8['shift']());}};_0x5bd155(++_0x504366);}(_0x0663,0x12c));var _0x3066=function(_0x507e6b,_0xa06980){_0x507e6b=_0x507e6b-0x0;var _0x5295db=_0x0663[_0x507e6b];return _0x5295db;};'use strict';var _=require('lodash');var moment=require(_0x3066('0x0'));var Redis=require(_0x3066('0x1'));var util=require(_0x3066('0x2'));var config=require('../../config/environment');var db=require(_0x3066('0x3'))['db'];var logger=require(_0x3066('0x4'))(_0x3066('0x5'));config['redis']=_[_0x3066('0x6')](config[_0x3066('0x7')],{'host':_0x3066('0x8'),'port':0x18eb});var io=require(_0x3066('0x9'))(new Redis(config[_0x3066('0x7')]));function closeInteractions(){var _0x561251=0x0;var _0x156c28=[];return db[_0x3066('0xa')][_0x3066('0xb')]({'raw':!![],'attributes':['id',_0x3066('0xc')],'where':{'id':0x1}})['then'](function(_0xacaaa9){_0x561251=_0xacaaa9[_0x3066('0xc')];if(_0x561251){return db[_0x3066('0xd')][_0x3066('0xe')]({'raw':!![],'attributes':['id',_0x3066('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3066('0x10')](_0xacaaa9[_0x3066('0xc')],_0x3066('0x11'))}}});}else{return[];}})[_0x3066('0x12')](function(_0x15559e){if(_0x15559e&&_0x15559e[_0x3066('0x13')]){_0x156c28=_[_0x3066('0x14')](_0x15559e||[],'id');logger[_0x3066('0x15')](_0x3066('0x16'),_0x156c28['join']());return db[_0x3066('0xd')][_0x3066('0x17')]({'closeReason':_0x3066('0x18'),'disposition':_0x3066('0x19'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x156c28}});}})[_0x3066('0x12')](function(){if(_0x156c28&&_0x156c28['length']){logger[_0x3066('0x15')](_0x3066('0x1a'),_0x156c28[_0x3066('0x1b')]());for(var _0x4c0055=0x0;_0x4c0055<_0x156c28['length'];_0x4c0055++){io[_0x3066('0x1c')]('chatInteraction:update',{'id':_0x156c28[_0x4c0055],'closed':!![]});}}})[_0x3066('0x1d')](function(_0x224608){logger[_0x3066('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x224608?util['inspect'](_0x224608,{'showHidden':![],'depth':null}):'');});}exports[_0x3066('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1fb9=['format','YYYY-MM-DD\x20HH:mm:ss','info','emit','chatInteraction:update','catch','error','inspect','start','lodash','moment','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0x5d71fb,_0x5b3f42){var _0x19bac8=function(_0x436c7d){while(--_0x436c7d){_0x5d71fb['push'](_0x5d71fb['shift']());}};_0x19bac8(++_0x5b3f42);}(_0x1fb9,0x91));var _0x91fb=function(_0x276f6d,_0x10a50e){_0x276f6d=_0x276f6d-0x0;var _0xda31b5=_0x1fb9[_0x276f6d];return _0xda31b5;};'use strict';var _=require(_0x91fb('0x0'));var moment=require(_0x91fb('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x91fb('0x2'));var db=require(_0x91fb('0x3'))['db'];var logger=require('../logger')(_0x91fb('0x4'));config[_0x91fb('0x5')]=_[_0x91fb('0x6')](config['redis'],{'host':_0x91fb('0x7'),'port':0x18eb});var io=require(_0x91fb('0x8'))(new Redis(config[_0x91fb('0x5')]));function closeInteractions(){var _0x2c47f7=0x0;var _0x30a268=[];return db[_0x91fb('0x9')][_0x91fb('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x91fb('0xb')](function(_0x54bc59){_0x2c47f7=_0x54bc59[_0x91fb('0xc')];if(_0x2c47f7){return db[_0x91fb('0xd')][_0x91fb('0xe')]({'raw':!![],'attributes':['id',_0x91fb('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x91fb('0x10')](_0x54bc59[_0x91fb('0xc')],_0x91fb('0x11'))}}});}else{return[];}})['then'](function(_0xb0ae12){if(_0xb0ae12&&_0xb0ae12[_0x91fb('0x12')]){_0x30a268=_[_0x91fb('0x13')](_0xb0ae12||[],'id');logger['info'](_0x91fb('0x14'),_0x30a268[_0x91fb('0x15')]());return db[_0x91fb('0xd')][_0x91fb('0x16')]({'closeReason':_0x91fb('0x17'),'disposition':_0x91fb('0x18'),'closed':!![],'closedAt':moment()[_0x91fb('0x19')](_0x91fb('0x1a'))},{'where':{'id':_0x30a268}});}})['then'](function(){if(_0x30a268&&_0x30a268['length']){logger[_0x91fb('0x1b')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x30a268[_0x91fb('0x15')]());for(var _0x50c2e7=0x0;_0x50c2e7<_0x30a268[_0x91fb('0x12')];_0x50c2e7++){io[_0x91fb('0x1c')](_0x91fb('0x1d'),{'id':_0x30a268[_0x50c2e7],'closed':!![]});}}})[_0x91fb('0x1e')](function(_0x1ac7c8){logger[_0x91fb('0x1f')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1ac7c8?util[_0x91fb('0x20')](_0x1ac7c8,{'showHidden':![],'depth':null}):'');});}exports[_0x91fb('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index bef9586..ebca9a2 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 _0x5e08=['start','stop\x20cron','update','update\x20cron','deleteJob','run','util','path','lodash','moment','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','MailAccount','service','host','Smtp','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','email','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','savename','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','request','SendMail','then','error','error\x20mail','info','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','run\x20job','cron','active','isBetween','startAt','endAt','add'];(function(_0x15ab1b,_0x4643a9){var _0x5c1e20=function(_0x3ad266){while(--_0x3ad266){_0x15ab1b['push'](_0x15ab1b['shift']());}};_0x5c1e20(++_0x4643a9);}(_0x5e08,0x166));var _0x85e0=function(_0x22aca4,_0x2f26da){_0x22aca4=_0x22aca4-0x0;var _0x257ccf=_0x5e08[_0x22aca4];return _0x257ccf;};'use strict';var fs=require('fs');var util=require(_0x85e0('0x0'));var path=require(_0x85e0('0x1'));var _=require(_0x85e0('0x2'));var moment=require(_0x85e0('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x85e0('0x4'));var BPromise=require('bluebird');var logger=require(_0x85e0('0x5'))(_0x85e0('0x6'));var db=require(_0x85e0('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x85e0('0x8'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1bb05c,_0x2d9215){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x1bb05c['email']);var _0x32f526=!![];var _0x5105bf={'tls':{'rejectUnauthorized':![]}};if(_0x1bb05c[_0x85e0('0x9')]['Smtp'][_0x85e0('0xa')]){_0x5105bf[_0x85e0('0xa')]=_0x1bb05c[_0x85e0('0x9')]['Smtp'][_0x85e0('0xa')];}else{_0x5105bf[_0x85e0('0xb')]=_0x1bb05c[_0x85e0('0x9')][_0x85e0('0xc')][_0x85e0('0xb')];_0x5105bf['port']=_0x1bb05c['MailAccount'][_0x85e0('0xc')][_0x85e0('0xd')];_0x5105bf[_0x85e0('0xe')]=_0x1bb05c[_0x85e0('0x9')][_0x85e0('0xc')][_0x85e0('0xe')];}if(_0x1bb05c[_0x85e0('0x9')]['Smtp'][_0x85e0('0xf')]){_0x5105bf[_0x85e0('0x10')]={'user':_0x1bb05c[_0x85e0('0x9')][_0x85e0('0xc')][_0x85e0('0x11')],'pass':_0x1bb05c[_0x85e0('0x9')]['Smtp'][_0x85e0('0x12')]};}var _0x344742={'account':_0x5105bf,'message':{'from':util['format'](_0x85e0('0x13'),_0x1bb05c['MailAccount']['name'],_0x1bb05c[_0x85e0('0x9')][_0x85e0('0x14')]||_0x1bb05c[_0x85e0('0x9')][_0x85e0('0xc')][_0x85e0('0x11')]),'to':_0x1bb05c[_0x85e0('0x14')],'cc':_0x1bb05c['cc'],'bcc':_0x1bb05c[_0x85e0('0x15')],'subject':util[_0x85e0('0x16')](_0x85e0('0x17'),_0x2d9215[_0x85e0('0x18')],_0x1bb05c['subtractNumber'],_0x1bb05c[_0x85e0('0x19')])}};var _0x13a8fe=path[_0x85e0('0x1a')](__dirname,'../../files/reports');var _0x49cf10=_0x2d9215[_0x85e0('0x1b')];var _0x214f4c=util[_0x85e0('0x16')](_0x85e0('0x1c'),path[_0x85e0('0x1d')](_0x2d9215[_0x85e0('0x1b')],path[_0x85e0('0x1e')](_0x2d9215[_0x85e0('0x1b')])),'zip');var _0x4bca76=path['join'](_0x13a8fe,_0x49cf10);var _0x2815cc=path['join'](_0x13a8fe,_0x214f4c);if(fs[_0x85e0('0x1f')](_0x4bca76)){_0x2d9215[_0x85e0('0x20')]=_0x85e0('0x21');_0x344742[_0x85e0('0x22')][_0x85e0('0x23')]=[{'filename':_0x49cf10,'path':_0x4bca76}];_0x344742[_0x85e0('0x22')]['text']=util[_0x85e0('0x16')](_0x85e0('0x24'),JSON[_0x85e0('0x25')](_0x2d9215,null,0x2));}else if(fs[_0x85e0('0x1f')](_0x2815cc)){_0x2d9215[_0x85e0('0x20')]=_0x85e0('0x21');_0x344742[_0x85e0('0x22')]['attachments']=[{'filename':_0x214f4c,'path':_0x2815cc}];}else{_0x344742['message'][_0x85e0('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1bb05c[_0x85e0('0x27')]){_0x32f526=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x32f526){return client[_0x85e0('0x28')](_0x85e0('0x29'),_0x344742)[_0x85e0('0x2a')](function(_0x5e5f6f){if(_0x5e5f6f[_0x85e0('0x2b')]){return logger[_0x85e0('0x2b')](_0x85e0('0x2c'),JSON[_0x85e0('0x25')](_0x5e5f6f));}return logger[_0x85e0('0x2d')](_0x85e0('0x2e'));})[_0x85e0('0x2f')](function(_0x3ca5d2){return logger[_0x85e0('0x2b')](_0x85e0('0x2c'),JSON[_0x85e0('0x25')](_0x3ca5d2));});}};}function handleError(){return function(_0xed820a){return logger[_0x85e0('0x2b')](JSON[_0x85e0('0x25')](_0xed820a));};}function handleResult(_0x27e170){return function(_0x3fdb4e){logger[_0x85e0('0x2d')](_0x85e0('0x30'),JSON[_0x85e0('0x25')](_0x3fdb4e));if(_0x27e170[_0x85e0('0x9')]&&_0x27e170['MailAccount']['Smtp']&&!_['isNil'](_0x27e170[_0x85e0('0x14')])){setTimeout(handleSendEmail(_0x27e170,_0x3fdb4e),0x3c*0x3e8);}};}function handleJob(_0x491c64){return function(){try{if(_[_0x85e0('0x31')](_0x491c64[_0x85e0('0x32')])){return logger['info'](_0x85e0('0x33'));}if(_[_0x85e0('0x31')](_0x491c64['subtractUnit'])){return logger[_0x85e0('0x2d')](_0x85e0('0x34'));}var _0x20e039={'startDate':moment()[_0x85e0('0x35')](_0x491c64[_0x85e0('0x32')],_0x491c64[_0x85e0('0x19')])[_0x85e0('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x85e0('0x16')](_0x85e0('0x36')),'type':'scheduled','output':_0x491c64['output'],'name':_0x491c64['name']};if(!_[_0x85e0('0x31')](_0x491c64[_0x85e0('0x37')])){logger['info'](_0x85e0('0x38'),_0x491c64[_0x85e0('0x37')]);return analyticDefaultReportController[_0x85e0('0x39')]({'id':_0x491c64[_0x85e0('0x37')]},_0x20e039)['then'](handleResult(_0x491c64))[_0x85e0('0x2f')](handleError());}if(!_[_0x85e0('0x31')](_0x491c64[_0x85e0('0x3a')])){logger[_0x85e0('0x2d')]('exec\x20custom\x20report\x20id:%s',_0x491c64[_0x85e0('0x3a')]);return analyticCustomReportController[_0x85e0('0x39')]({'id':_0x491c64[_0x85e0('0x3a')]},_0x20e039)[_0x85e0('0x2a')](handleResult(_0x491c64))[_0x85e0('0x2f')](handleError());}}catch(_0x1fb184){logger[_0x85e0('0x2b')](JSON[_0x85e0('0x25')](_0x1fb184));}return logger[_0x85e0('0x2d')](_0x85e0('0x3b'));};}function getJobs(_0xa85feb){var _0x585542={};if(_0xa85feb){_0x585542['id']=_0xa85feb;}return db[_0x85e0('0x3c')][_0x85e0('0x3d')]({'where':_0x585542,'include':[{'model':db[_0x85e0('0x9')],'attributes':['id',_0x85e0('0x18'),_0x85e0('0x14')],'include':[{'model':db[_0x85e0('0x3e')],'as':_0x85e0('0xc')}]}]})[_0x85e0('0x2a')](function(_0x15dc07){var _0x58278e=_['keys'](manager[_0x85e0('0x3f')]);var _0x33898b=_[_0x85e0('0x40')](_0x15dc07,function(_0x1a5c6f){return _0x1a5c6f['id'][_0x85e0('0x41')]();});var _0x5738c6=_[_0x85e0('0x42')](_0x15dc07,function(_0x3880fa){return _0x3880fa['id'][_0x85e0('0x41')]();});var _0xcc5767=_0xa85feb?_0x33898b:_[_0x85e0('0x43')](_0x33898b,_0x58278e);var _0x157f3f=_[_0x85e0('0x44')](_0x33898b,_0x58278e);var _0xfbd997=_[_0x85e0('0x43')](_0x58278e,_0x33898b);var _0x40c463;var _0x3ff158;for(_0x40c463=0x0;_0x40c463<_0xfbd997[_0x85e0('0x45')]&&!_0xa85feb;_0x40c463+=0x1){_0x3ff158=_0xfbd997[_0x40c463][_0x85e0('0x41')]();if(manager[_0x85e0('0x46')](_0x3ff158)){manager[_0x85e0('0x47')](_0x3ff158);manager['deleteJob'](_0x3ff158);logger['info'](_0x85e0('0x48'),_0x3ff158);}}logger['info'](_0x85e0('0x49'),JSON[_0x85e0('0x25')](_0xcc5767));for(_0x40c463=0x0;_0x40c463<_0xcc5767[_0x85e0('0x45')];_0x40c463+=0x1){_0x3ff158=_0xcc5767[_0x40c463][_0x85e0('0x41')]();logger[_0x85e0('0x2d')](_0x85e0('0x4a'),_0x3ff158);if(_0xa85feb){logger[_0x85e0('0x2d')]('my\x20id',_0xa85feb);logger['info'](JSON['stringify'](_0x5738c6[_0x3ff158]));BPromise['resolve']()[_0x85e0('0x2a')](handleJob(_0x5738c6[_0x3ff158]));logger[_0x85e0('0x2d')](_0x85e0('0x4b'),_0x5738c6[_0x3ff158]['name'],_0x5738c6[_0x3ff158][_0x85e0('0x4c')]);}else if(_0x5738c6[_0x3ff158][_0x85e0('0x4c')]&&_0x5738c6[_0x3ff158][_0x85e0('0x4d')]&&moment()[_0x85e0('0x4e')](_0x5738c6[_0x3ff158][_0x85e0('0x4f')],_0x5738c6[_0x3ff158][_0x85e0('0x50')])){manager[_0x85e0('0x51')](_0x3ff158,_0x5738c6[_0x3ff158]['cron'],handleJob(_0x5738c6[_0x3ff158]));manager[_0x85e0('0x52')](_0x3ff158);logger[_0x85e0('0x2d')]('add\x20cron',_0x5738c6[_0x3ff158][_0x85e0('0x18')],_0x5738c6[_0x3ff158][_0x85e0('0x4c')]);}else if(manager[_0x85e0('0x46')](_0x3ff158)){manager['stop'](_0x3ff158);manager['deleteJob'](_0x3ff158);logger[_0x85e0('0x2d')](_0x85e0('0x53'),_0x5738c6[_0x3ff158][_0x85e0('0x18')],_0x5738c6[_0x3ff158][_0x85e0('0x4c')]);}}for(_0x40c463=0x0,_0x3ff158;_0x40c463<_0x157f3f['length']&&!_0xa85feb;_0x40c463+=0x1){_0x3ff158=_0x157f3f[_0x40c463][_0x85e0('0x41')]();if(manager[_0x85e0('0x46')](_0x3ff158)){if(_0x5738c6[_0x3ff158]['cron']&&_0x5738c6[_0x3ff158][_0x85e0('0x4d')]&&moment()[_0x85e0('0x4e')](_0x5738c6[_0x3ff158][_0x85e0('0x4f')],_0x5738c6[_0x3ff158][_0x85e0('0x50')])){manager[_0x85e0('0x54')](_0x3ff158,_0x5738c6[_0x3ff158]['cron'],handleJob(_0x5738c6[_0x3ff158]));logger['info'](_0x85e0('0x55'),_0x5738c6[_0x3ff158]['name'],_0x5738c6[_0x3ff158]['cron']);}else{manager[_0x85e0('0x47')](_0x3ff158);manager[_0x85e0('0x56')](_0x3ff158);logger[_0x85e0('0x2d')](_0x85e0('0x53'),_0x5738c6[_0x3ff158][_0x85e0('0x18')],_0x5738c6[_0x3ff158][_0x85e0('0x4c')]);}}}})['catch'](function(_0xec593){logger[_0x85e0('0x2b')](JSON[_0x85e0('0x25')](_0xec593));});}exports[_0x85e0('0x57')]=function(_0x1bc622){return getJobs(_0x1bc622);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8a5b=['basename','savename','extname','status','Sent','message','attachments','text','stringify','existsSync','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','keys','jobs','map','toString','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','add\x20cron','exists','stop\x20cron','isBetween','update','update\x20cron','run','start','util','path','lodash','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','%s.%s'];(function(_0x3d2a90,_0x2073ae){var _0x33fb5c=function(_0x107138){while(--_0x107138){_0x3d2a90['push'](_0x3d2a90['shift']());}};_0x33fb5c(++_0x2073ae);}(_0x8a5b,0x93));var _0xb8a5=function(_0x4681e7,_0x3ab7f2){_0x4681e7=_0x4681e7-0x0;var _0x4531f6=_0x8a5b[_0x4681e7];return _0x4531f6;};'use strict';var fs=require('fs');var util=require(_0xb8a5('0x0'));var path=require(_0xb8a5('0x1'));var _=require(_0xb8a5('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xb8a5('0x3'));var BPromise=require(_0xb8a5('0x4'));var logger=require(_0xb8a5('0x5'))(_0xb8a5('0x6'));var db=require(_0xb8a5('0x7'))['db'];var analyticCustomReportController=require(_0xb8a5('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb8a5('0x9')][_0xb8a5('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2de14b,_0x3f13ff){return function(){logger[_0xb8a5('0xb')](_0xb8a5('0xc'),_0x2de14b[_0xb8a5('0xd')]);var _0x5b900a=!![];var _0x31212f={'tls':{'rejectUnauthorized':![]}};if(_0x2de14b[_0xb8a5('0xe')]['Smtp'][_0xb8a5('0xf')]){_0x31212f[_0xb8a5('0xf')]=_0x2de14b[_0xb8a5('0xe')][_0xb8a5('0x10')][_0xb8a5('0xf')];}else{_0x31212f[_0xb8a5('0x11')]=_0x2de14b[_0xb8a5('0xe')][_0xb8a5('0x10')][_0xb8a5('0x11')];_0x31212f[_0xb8a5('0x12')]=_0x2de14b['MailAccount'][_0xb8a5('0x10')][_0xb8a5('0x12')];_0x31212f[_0xb8a5('0x13')]=_0x2de14b[_0xb8a5('0xe')][_0xb8a5('0x10')][_0xb8a5('0x13')];}if(_0x2de14b['MailAccount']['Smtp'][_0xb8a5('0x14')]){_0x31212f[_0xb8a5('0x15')]={'user':_0x2de14b[_0xb8a5('0xe')]['Smtp'][_0xb8a5('0x16')],'pass':_0x2de14b[_0xb8a5('0xe')][_0xb8a5('0x10')][_0xb8a5('0x17')]};}var _0x126ee1={'account':_0x31212f,'message':{'from':util[_0xb8a5('0x18')](_0xb8a5('0x19'),_0x2de14b['MailAccount']['name'],_0x2de14b[_0xb8a5('0xe')][_0xb8a5('0xd')]||_0x2de14b['MailAccount'][_0xb8a5('0x10')][_0xb8a5('0x16')]),'to':_0x2de14b[_0xb8a5('0xd')],'cc':_0x2de14b['cc'],'bcc':_0x2de14b[_0xb8a5('0x1a')],'subject':util[_0xb8a5('0x18')](_0xb8a5('0x1b'),_0x3f13ff['name'],_0x2de14b['subtractNumber'],_0x2de14b[_0xb8a5('0x1c')])}};var _0x2969b3=path[_0xb8a5('0x1d')](__dirname,'../../files/reports');var _0x35a868=_0x3f13ff['savename'];var _0x40e161=util[_0xb8a5('0x18')](_0xb8a5('0x1e'),path[_0xb8a5('0x1f')](_0x3f13ff[_0xb8a5('0x20')],path[_0xb8a5('0x21')](_0x3f13ff['savename'])),'zip');var _0x5e93c7=path[_0xb8a5('0x1d')](_0x2969b3,_0x35a868);var _0x4f6da9=path[_0xb8a5('0x1d')](_0x2969b3,_0x40e161);if(fs['existsSync'](_0x5e93c7)){_0x3f13ff[_0xb8a5('0x22')]=_0xb8a5('0x23');_0x126ee1[_0xb8a5('0x24')][_0xb8a5('0x25')]=[{'filename':_0x35a868,'path':_0x5e93c7}];_0x126ee1[_0xb8a5('0x24')][_0xb8a5('0x26')]=util[_0xb8a5('0x18')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xb8a5('0x27')](_0x3f13ff,null,0x2));}else if(fs[_0xb8a5('0x28')](_0x4f6da9)){_0x3f13ff[_0xb8a5('0x22')]=_0xb8a5('0x23');_0x126ee1['message'][_0xb8a5('0x25')]=[{'filename':_0x40e161,'path':_0x4f6da9}];}else{_0x126ee1[_0xb8a5('0x24')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2de14b['sendIfEmpty']){_0x5b900a=![];logger[_0xb8a5('0xb')](_0xb8a5('0x29'));}}if(_0x5b900a){return client[_0xb8a5('0x2a')]('SendMail',_0x126ee1)['then'](function(_0x5ac5b2){if(_0x5ac5b2[_0xb8a5('0x2b')]){return logger[_0xb8a5('0x2b')](_0xb8a5('0x2c'),JSON['stringify'](_0x5ac5b2));}return logger[_0xb8a5('0xb')](_0xb8a5('0x2d'));})[_0xb8a5('0x2e')](function(_0x1bda95){return logger['error'](_0xb8a5('0x2c'),JSON['stringify'](_0x1bda95));});}};}function handleError(){return function(_0x308852){return logger['error'](JSON[_0xb8a5('0x27')](_0x308852));};}function handleResult(_0xef2b1a){return function(_0x2297db){logger[_0xb8a5('0xb')](_0xb8a5('0x2f'),JSON[_0xb8a5('0x27')](_0x2297db));if(_0xef2b1a[_0xb8a5('0xe')]&&_0xef2b1a['MailAccount'][_0xb8a5('0x10')]&&!_[_0xb8a5('0x30')](_0xef2b1a[_0xb8a5('0xd')])){setTimeout(handleSendEmail(_0xef2b1a,_0x2297db),0x3c*0x3e8);}};}function handleJob(_0x403ef6){return function(){try{if(_[_0xb8a5('0x30')](_0x403ef6[_0xb8a5('0x31')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xb8a5('0x30')](_0x403ef6[_0xb8a5('0x1c')])){return logger[_0xb8a5('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5a2c26={'startDate':moment()[_0xb8a5('0x32')](_0x403ef6[_0xb8a5('0x31')],_0x403ef6['subtractUnit'])[_0xb8a5('0x18')](_0xb8a5('0x33')),'endDate':moment()[_0xb8a5('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xb8a5('0x34'),'output':_0x403ef6[_0xb8a5('0x35')],'name':_0x403ef6[_0xb8a5('0x36')]};if(!_['isNil'](_0x403ef6[_0xb8a5('0x37')])){logger[_0xb8a5('0xb')](_0xb8a5('0x38'),_0x403ef6['DefaultReportId']);return analyticDefaultReportController[_0xb8a5('0x39')]({'id':_0x403ef6[_0xb8a5('0x37')]},_0x5a2c26)[_0xb8a5('0x3a')](handleResult(_0x403ef6))[_0xb8a5('0x2e')](handleError());}if(!_[_0xb8a5('0x30')](_0x403ef6[_0xb8a5('0x3b')])){logger['info'](_0xb8a5('0x3c'),_0x403ef6[_0xb8a5('0x3b')]);return analyticCustomReportController[_0xb8a5('0x39')]({'id':_0x403ef6[_0xb8a5('0x3b')]},_0x5a2c26)[_0xb8a5('0x3a')](handleResult(_0x403ef6))[_0xb8a5('0x2e')](handleError());}}catch(_0x587bc5){logger[_0xb8a5('0x2b')](JSON['stringify'](_0x587bc5));}return logger[_0xb8a5('0xb')]('no\x20report\x20id');};}function getJobs(_0x1c6f54){var _0x57ac4e={};if(_0x1c6f54){_0x57ac4e['id']=_0x1c6f54;}return db[_0xb8a5('0x3d')]['findAll']({'where':_0x57ac4e,'include':[{'model':db[_0xb8a5('0xe')],'attributes':['id',_0xb8a5('0x36'),_0xb8a5('0xd')],'include':[{'model':db['MailServerOut'],'as':_0xb8a5('0x10')}]}]})[_0xb8a5('0x3a')](function(_0x5738e5){var _0x35840a=_[_0xb8a5('0x3e')](manager[_0xb8a5('0x3f')]);var _0x4f5d22=_[_0xb8a5('0x40')](_0x5738e5,function(_0x36be5d){return _0x36be5d['id']['toString']();});var _0x43bb59=_['keyBy'](_0x5738e5,function(_0x5813aa){return _0x5813aa['id'][_0xb8a5('0x41')]();});var _0x1a7cd6=_0x1c6f54?_0x4f5d22:_[_0xb8a5('0x42')](_0x4f5d22,_0x35840a);var _0x4c38b2=_[_0xb8a5('0x43')](_0x4f5d22,_0x35840a);var _0x2098e5=_[_0xb8a5('0x42')](_0x35840a,_0x4f5d22);var _0x549152;var _0x136c8d;for(_0x549152=0x0;_0x549152<_0x2098e5['length']&&!_0x1c6f54;_0x549152+=0x1){_0x136c8d=_0x2098e5[_0x549152]['toString']();if(manager['exists'](_0x136c8d)){manager[_0xb8a5('0x44')](_0x136c8d);manager[_0xb8a5('0x45')](_0x136c8d);logger['info'](_0xb8a5('0x46'),_0x136c8d);}}logger[_0xb8a5('0xb')](_0xb8a5('0x47'),JSON[_0xb8a5('0x27')](_0x1a7cd6));for(_0x549152=0x0;_0x549152<_0x1a7cd6[_0xb8a5('0x48')];_0x549152+=0x1){_0x136c8d=_0x1a7cd6[_0x549152][_0xb8a5('0x41')]();logger[_0xb8a5('0xb')]('index',_0x136c8d);if(_0x1c6f54){logger[_0xb8a5('0xb')](_0xb8a5('0x49'),_0x1c6f54);logger[_0xb8a5('0xb')](JSON[_0xb8a5('0x27')](_0x43bb59[_0x136c8d]));BPromise[_0xb8a5('0x4a')]()[_0xb8a5('0x3a')](handleJob(_0x43bb59[_0x136c8d]));logger['info'](_0xb8a5('0x4b'),_0x43bb59[_0x136c8d]['name'],_0x43bb59[_0x136c8d][_0xb8a5('0x4c')]);}else if(_0x43bb59[_0x136c8d][_0xb8a5('0x4c')]&&_0x43bb59[_0x136c8d][_0xb8a5('0x4d')]&&moment()['isBetween'](_0x43bb59[_0x136c8d][_0xb8a5('0x4e')],_0x43bb59[_0x136c8d][_0xb8a5('0x4f')])){manager[_0xb8a5('0x50')](_0x136c8d,_0x43bb59[_0x136c8d]['cron'],handleJob(_0x43bb59[_0x136c8d]));manager['start'](_0x136c8d);logger[_0xb8a5('0xb')](_0xb8a5('0x51'),_0x43bb59[_0x136c8d][_0xb8a5('0x36')],_0x43bb59[_0x136c8d][_0xb8a5('0x4c')]);}else if(manager[_0xb8a5('0x52')](_0x136c8d)){manager[_0xb8a5('0x44')](_0x136c8d);manager['deleteJob'](_0x136c8d);logger[_0xb8a5('0xb')](_0xb8a5('0x53'),_0x43bb59[_0x136c8d][_0xb8a5('0x36')],_0x43bb59[_0x136c8d][_0xb8a5('0x4c')]);}}for(_0x549152=0x0,_0x136c8d;_0x549152<_0x4c38b2[_0xb8a5('0x48')]&&!_0x1c6f54;_0x549152+=0x1){_0x136c8d=_0x4c38b2[_0x549152][_0xb8a5('0x41')]();if(manager['exists'](_0x136c8d)){if(_0x43bb59[_0x136c8d][_0xb8a5('0x4c')]&&_0x43bb59[_0x136c8d]['active']&&moment()[_0xb8a5('0x54')](_0x43bb59[_0x136c8d][_0xb8a5('0x4e')],_0x43bb59[_0x136c8d][_0xb8a5('0x4f')])){manager[_0xb8a5('0x55')](_0x136c8d,_0x43bb59[_0x136c8d]['cron'],handleJob(_0x43bb59[_0x136c8d]));logger[_0xb8a5('0xb')](_0xb8a5('0x56'),_0x43bb59[_0x136c8d]['name'],_0x43bb59[_0x136c8d]['cron']);}else{manager['stop'](_0x136c8d);manager[_0xb8a5('0x45')](_0x136c8d);logger[_0xb8a5('0xb')](_0xb8a5('0x53'),_0x43bb59[_0x136c8d][_0xb8a5('0x36')],_0x43bb59[_0x136c8d][_0xb8a5('0x4c')]);}}}})[_0xb8a5('0x2e')](function(_0x4a5176){logger['error'](JSON[_0xb8a5('0x27')](_0x4a5176));});}exports[_0xb8a5('0x57')]=function(_0x17a8e2){return getJobs(_0x17a8e2);};exports[_0xb8a5('0x58')]=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 717299b..599aaa9 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 _0x0fec=['sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','update','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','Transcript\x20not\x20available','CloudProvider','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','catch','inspect','start','lodash','aws-sdk','request-promise','../../mysqldb','transcribe','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment'];(function(_0x52251d,_0x59e738){var _0xd5f8a8=function(_0x4656d7){while(--_0x4656d7){_0x52251d['push'](_0x52251d['shift']());}};_0xd5f8a8(++_0x59e738);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x4cd58e,_0x1d6065){_0x4cd58e=_0x4cd58e-0x0;var _0xac5fb6=_0x0fec[_0x4cd58e];return _0xac5fb6;};var _=require(_0xc0fe('0x0'));var AWS=require(_0xc0fe('0x1'));var rp=require(_0xc0fe('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xc0fe('0x3'))['db'];var logger=require('../../config/logger')(_0xc0fe('0x4'));function getTranscriptionJob(_0x28af46,_0x4d1088,_0x168055,_0x5abf3b){return new Promise(function(_0x3fce36,_0x1073f0){var _0x4cc359=new AWS['TranscribeService']({'accessKeyId':_0x4d1088,'secretAccessKey':_0x28af46,'region':_0x168055});_0x4cc359['getTranscriptionJob']({'TranscriptionJobName':_0x5abf3b},function(_0x326ab7,_0x2cd914){if(_0x326ab7){return _0x1073f0(_0x326ab7);}else{return _0x3fce36(_0x2cd914);}});});}function sentiment(_0x1e5dd3,_0x4e8d11,_0x5e33c4,_0x545ee7,_0x19d5dd){return new Promise(function(_0x579d5d,_0x3844d8){var _0x5228f4=new AWS[(_0xc0fe('0x5'))]({'accessKeyId':_0x4e8d11,'secretAccessKey':_0x1e5dd3,'region':_0x5e33c4});_0x5228f4[_0xc0fe('0x6')]({'Text':_0x545ee7,'LanguageCode':_0x19d5dd[_0xc0fe('0x7')](0x0,0x2)},function(_0x6931c2,_0x29cdc4){if(_0x6931c2){return _0x3844d8(_0x6931c2);}else{return _0x579d5d(_0x29cdc4);}});});}function checkTranscribeJob(_0x31af60,_0x559ad2,_0x350a6d){var _0x2cd4bb;return new BPromise(function(_0x5b1faa,_0x5add97){logger['info'](util[_0xc0fe('0x8')](_0xc0fe('0x9'),_0x31af60['id'],_0x31af60[_0xc0fe('0xa')]));return getTranscriptionJob(_0x350a6d['data1'],_0x350a6d[_0xc0fe('0xb')],_0x559ad2[_0xc0fe('0xc')],_0x31af60['transcribeName'])['then'](function(_0x1c7b1c){logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')](_0xc0fe('0xe'),_0x31af60['id'],_0x31af60[_0xc0fe('0xa')],_0x1c7b1c[_0xc0fe('0xf')][_0xc0fe('0x10')]));if(!_0x31af60[_0xc0fe('0x11')]){switch(_0x1c7b1c['TranscriptionJob'][_0xc0fe('0x10')]){case _0xc0fe('0x12'):var _0x18f483={'transcribeStatus':_0x1c7b1c[_0xc0fe('0xf')][_0xc0fe('0x10')],'fileUri':_0x1c7b1c[_0xc0fe('0xf')][_0xc0fe('0x13')][_0xc0fe('0x14')]};logger['info'](util[_0xc0fe('0x8')](_0xc0fe('0x15'),_0x31af60['id']));return rp({'uri':_0x1c7b1c[_0xc0fe('0xf')][_0xc0fe('0x13')][_0xc0fe('0x14')],'json':!![]})[_0xc0fe('0x16')](function(_0x44fb50){logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x31af60['id']));if(_0x44fb50&&_0x44fb50['results']&&_0x44fb50[_0xc0fe('0x17')][_0xc0fe('0x18')]&&_0x44fb50[_0xc0fe('0x17')]['transcripts'][_0xc0fe('0x19')]){_0x18f483['fileText']='';for(var _0x29b349=0x0;_0x29b349<_0x44fb50[_0xc0fe('0x17')]['transcripts'][_0xc0fe('0x19')];_0x29b349++){_0x18f483['fileText']+=_0x44fb50[_0xc0fe('0x17')][_0xc0fe('0x18')][_0x29b349][_0xc0fe('0x1a')]+'';}}return _0x31af60['update'](_0x18f483);})[_0xc0fe('0x16')](function(){logger['info'](util[_0xc0fe('0x8')](_0xc0fe('0x1b'),_0x31af60['id']));if(!_0x31af60[_0xc0fe('0x1c')]){throw new db[(_0xc0fe('0x1d'))]['ValidationError'](_0xc0fe('0x1e'));}if(!_0x559ad2[_0xc0fe('0x1f')]||!_0x559ad2[_0xc0fe('0x20')]||!_0x559ad2['sentimentRegion']||!_0x559ad2['language']||!_0x559ad2['bucket']){throw new db[(_0xc0fe('0x1d'))]['ValidationError'](_0xc0fe('0x21'));}if(!_0x18f483[_0xc0fe('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x559ad2[_0xc0fe('0x20')]===_0x350a6d['id']){return _0x350a6d;}else{return db['CloudProvider'][_0xc0fe('0x22')]({'where':{'id':_settings[_0xc0fe('0x20')]}});}})['then'](function(_0x13b856){if(!_0x13b856){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))](_0xc0fe('0x24'));}if(!_0x13b856[_0xc0fe('0x25')]||!_0x13b856[_0xc0fe('0xb')]){throw new db['Sequelize']['ValidationError'](_0xc0fe('0x26'));}_0x2cd4bb=_0x13b856;logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')](_0xc0fe('0x27'),_0x31af60['id']));return sentiment(_0x2cd4bb[_0xc0fe('0x25')],_0x2cd4bb[_0xc0fe('0xb')],_0x559ad2['sentimentRegion'],_0x18f483['fileText'],_0x559ad2[_0xc0fe('0x28')]);})[_0xc0fe('0x16')](function(_0x5db240){logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x31af60['id']));return _0x31af60[_0xc0fe('0x29')]({'sentiment':_0x5db240[_0xc0fe('0x2a')],'sPositive':_0x5db240[_0xc0fe('0x2b')][_0xc0fe('0x2c')],'sNegative':_0x5db240[_0xc0fe('0x2b')][_0xc0fe('0x2d')],'sMixed':_0x5db240[_0xc0fe('0x2b')][_0xc0fe('0x2e')],'sNeutral':_0x5db240[_0xc0fe('0x2b')][_0xc0fe('0x2f')]});})[_0xc0fe('0x16')](function(){logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x31af60['id']));_0x5b1faa();});case _0xc0fe('0x30'):return _0x31af60[_0xc0fe('0x29')]({'transcribeStatus':_0xc0fe('0x30'),'failureReason':_0x1c7b1c['TranscriptionJob'][_0xc0fe('0x31')]})[_0xc0fe('0x16')](function(){logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')](_0xc0fe('0x1b'),_0x31af60['id']));_0x5b1faa();});default:logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')](_0xc0fe('0x32'),_0x31af60['id']));break;}}else{return BPromise[_0xc0fe('0x33')]()[_0xc0fe('0x16')](function(){if(!_0x31af60[_0xc0fe('0x1c')]){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x559ad2['sentiment']||!_0x559ad2['sentimentAccountId']||!_0x559ad2['sentimentRegion']||!_0x559ad2['language']||!_0x559ad2[_0xc0fe('0x34')]){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x31af60[_0xc0fe('0x11')]){throw new Error(_0xc0fe('0x35'));}if(_0x559ad2[_0xc0fe('0x20')]===_0x350a6d['id']){return _0x350a6d;}else{return db[_0xc0fe('0x36')][_0xc0fe('0x22')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc0fe('0x16')](function(_0x2658e2){if(!_0x2658e2){throw new db[(_0xc0fe('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2658e2[_0xc0fe('0x25')]||!_0x2658e2[_0xc0fe('0xb')]){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))](_0xc0fe('0x26'));}_0x2cd4bb=_0x2658e2;logger[_0xc0fe('0xd')](util['format'](_0xc0fe('0x27'),_0x31af60['id']));return sentiment(_0x2cd4bb[_0xc0fe('0x25')],_0x2cd4bb[_0xc0fe('0xb')],_0x559ad2[_0xc0fe('0x37')],_0x31af60[_0xc0fe('0x11')],_0x559ad2[_0xc0fe('0x28')]);})[_0xc0fe('0x16')](function(_0x161f2f){logger[_0xc0fe('0xd')](util[_0xc0fe('0x8')](_0xc0fe('0x38'),_0x31af60['id']));return _0x31af60[_0xc0fe('0x29')]({'sentiment':_0x161f2f[_0xc0fe('0x2a')],'sPositive':_0x161f2f[_0xc0fe('0x2b')]['Positive'],'sNegative':_0x161f2f[_0xc0fe('0x2b')][_0xc0fe('0x2d')],'sMixed':_0x161f2f[_0xc0fe('0x2b')][_0xc0fe('0x2e')],'sNeutral':_0x161f2f['SentimentScore'][_0xc0fe('0x2f')],'transcribeStatus':_0xc0fe('0x12')});})[_0xc0fe('0x16')](function(){logger['info'](util[_0xc0fe('0x8')](_0xc0fe('0x1b'),_0x31af60['id']));_0x5b1faa();});}})['catch'](function(_0x2cdcdd){if(_0x2cdcdd){if(!_0x2cdcdd[_0xc0fe('0x39')]||_0x2cdcdd['name']!==_0xc0fe('0x3a')){logger['error'](util[_0xc0fe('0x8')](_0xc0fe('0x3b'),_0x31af60['id']),util['inspect'](_0x2cdcdd,{'showHidden':![],'depth':null}));}}_0x5b1faa();});});}function checkTranscribe(){var _0x8fe335;var _0x51fb2c;var _0x5f0ff5;return db[_0xc0fe('0x3c')]['findAll']({'where':{'transcribeStatus':_0xc0fe('0x3d')}})['then'](function(_0x2591c5){if(!_0x2591c5||!_0x2591c5[_0xc0fe('0x19')]){throw new db[(_0xc0fe('0x1d'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x8fe335=_0x2591c5;return db['Setting'][_0xc0fe('0x22')]({'where':{'id':0x1}});})[_0xc0fe('0x16')](function(_0x4708e3){if(!_0x4708e3){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))](_0xc0fe('0x3e'));}_0x51fb2c=_0x4708e3;if(!_0x51fb2c[_0xc0fe('0x4')]||!_0x51fb2c['transcribeAccountId']||!_0x51fb2c[_0xc0fe('0xc')]||!_0x51fb2c['language']||!_0x51fb2c[_0xc0fe('0x34')]){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))](_0xc0fe('0x3f'));}return db[_0xc0fe('0x36')][_0xc0fe('0x22')]({'where':{'id':_0x51fb2c[_0xc0fe('0x40')]}});})[_0xc0fe('0x16')](function(_0x5ebbb9){if(!_0x5ebbb9){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5ebbb9[_0xc0fe('0x25')]||!_0x5ebbb9[_0xc0fe('0xb')]){throw new db[(_0xc0fe('0x1d'))][(_0xc0fe('0x23'))](_0xc0fe('0x26'));}_0x5f0ff5=_0x5ebbb9;var _0x323e19=[];_0x8fe335[_0xc0fe('0x41')](function(_0x5bc29e){_0x323e19[_0xc0fe('0x42')](checkTranscribeJob(_0x5bc29e,_0x51fb2c,_0x5f0ff5));});return BPromise['all'](_0x323e19);})[_0xc0fe('0x43')](function(_0x148aec){if(_0x148aec){if(!_0x148aec[_0xc0fe('0x39')]||_0x148aec['name']!=='SequelizeValidationError'){logger['error'](util[_0xc0fe('0x44')](_0x148aec,{'showHidden':![],'depth':null}));}}});}exports[_0xc0fe('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0caf=['SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','resolve','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','error','start','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','info','format','transcribeName','transcribeRegion','then','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','Positive'];(function(_0x3c007e,_0x2e6adc){var _0x851f31=function(_0x12bf84){while(--_0x12bf84){_0x3c007e['push'](_0x3c007e['shift']());}};_0x851f31(++_0x2e6adc);}(_0x0caf,0x9f));var _0xf0ca=function(_0x4cb32b,_0x93a808){_0x4cb32b=_0x4cb32b-0x0;var _0x107356=_0x0caf[_0x4cb32b];return _0x107356;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xf0ca('0x0'));var BPromise=require(_0xf0ca('0x1'));var db=require(_0xf0ca('0x2'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x465754,_0x1f5d08,_0x5166b4,_0x25d49b){return new Promise(function(_0x1053ad,_0xe9a74){var _0x59f602=new AWS[(_0xf0ca('0x3'))]({'accessKeyId':_0x1f5d08,'secretAccessKey':_0x465754,'region':_0x5166b4});_0x59f602[_0xf0ca('0x4')]({'TranscriptionJobName':_0x25d49b},function(_0x10d826,_0x271297){if(_0x10d826){return _0xe9a74(_0x10d826);}else{return _0x1053ad(_0x271297);}});});}function sentiment(_0x46711a,_0x455d0f,_0x36e2aa,_0x5bbec7,_0x11aa70){return new Promise(function(_0x78f205,_0x1542b6){var _0xa3f45=new AWS[(_0xf0ca('0x5'))]({'accessKeyId':_0x455d0f,'secretAccessKey':_0x46711a,'region':_0x36e2aa});_0xa3f45['detectSentiment']({'Text':_0x5bbec7,'LanguageCode':_0x11aa70['substring'](0x0,0x2)},function(_0x37c70c,_0x4bc890){if(_0x37c70c){return _0x1542b6(_0x37c70c);}else{return _0x78f205(_0x4bc890);}});});}function checkTranscribeJob(_0x330946,_0x582e00,_0x3c1332){var _0x38c595;return new BPromise(function(_0x24fd06,_0x3d52ff){logger[_0xf0ca('0x6')](util[_0xf0ca('0x7')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x330946['id'],_0x330946[_0xf0ca('0x8')]));return getTranscriptionJob(_0x3c1332['data1'],_0x3c1332['data2'],_0x582e00[_0xf0ca('0x9')],_0x330946[_0xf0ca('0x8')])[_0xf0ca('0xa')](function(_0x2b074e){logger[_0xf0ca('0x6')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x330946['id'],_0x330946[_0xf0ca('0x8')],_0x2b074e['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x330946[_0xf0ca('0xb')]){switch(_0x2b074e[_0xf0ca('0xc')][_0xf0ca('0xd')]){case _0xf0ca('0xe'):var _0x3a1466={'transcribeStatus':_0x2b074e[_0xf0ca('0xc')]['TranscriptionJobStatus'],'fileUri':_0x2b074e[_0xf0ca('0xc')]['Transcript'][_0xf0ca('0xf')]};logger[_0xf0ca('0x6')](util['format'](_0xf0ca('0x10'),_0x330946['id']));return rp({'uri':_0x2b074e[_0xf0ca('0xc')][_0xf0ca('0x11')][_0xf0ca('0xf')],'json':!![]})[_0xf0ca('0xa')](function(_0x2e54bf){logger[_0xf0ca('0x6')](util['format'](_0xf0ca('0x12'),_0x330946['id']));if(_0x2e54bf&&_0x2e54bf[_0xf0ca('0x13')]&&_0x2e54bf[_0xf0ca('0x13')][_0xf0ca('0x14')]&&_0x2e54bf[_0xf0ca('0x13')][_0xf0ca('0x14')]['length']){_0x3a1466['fileText']='';for(var _0x1eea57=0x0;_0x1eea57<_0x2e54bf[_0xf0ca('0x13')][_0xf0ca('0x14')][_0xf0ca('0x15')];_0x1eea57++){_0x3a1466[_0xf0ca('0xb')]+=_0x2e54bf[_0xf0ca('0x13')][_0xf0ca('0x14')][_0x1eea57][_0xf0ca('0x16')]+'';}}return _0x330946['update'](_0x3a1466);})['then'](function(){logger[_0xf0ca('0x6')](util[_0xf0ca('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x330946['id']));if(!_0x330946[_0xf0ca('0x17')]){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x1a'));}if(!_0x582e00['sentiment']||!_0x582e00[_0xf0ca('0x1b')]||!_0x582e00[_0xf0ca('0x1c')]||!_0x582e00[_0xf0ca('0x1d')]||!_0x582e00[_0xf0ca('0x1e')]){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x1f'));}if(!_0x3a1466['fileText']){throw new Error(_0xf0ca('0x20'));}if(_0x582e00['sentimentAccountId']===_0x3c1332['id']){return _0x3c1332;}else{return db[_0xf0ca('0x21')]['findOne']({'where':{'id':_settings[_0xf0ca('0x1b')]}});}})[_0xf0ca('0xa')](function(_0x29202a){if(!_0x29202a){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x22'));}if(!_0x29202a[_0xf0ca('0x23')]||!_0x29202a[_0xf0ca('0x24')]){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x25'));}_0x38c595=_0x29202a;logger[_0xf0ca('0x6')](util[_0xf0ca('0x7')](_0xf0ca('0x26'),_0x330946['id']));return sentiment(_0x38c595['data1'],_0x38c595[_0xf0ca('0x24')],_0x582e00[_0xf0ca('0x1c')],_0x3a1466[_0xf0ca('0xb')],_0x582e00[_0xf0ca('0x1d')]);})['then'](function(_0x147aeb){logger['info'](util[_0xf0ca('0x7')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x330946['id']));return _0x330946[_0xf0ca('0x27')]({'sentiment':_0x147aeb[_0xf0ca('0x28')],'sPositive':_0x147aeb['SentimentScore'][_0xf0ca('0x29')],'sNegative':_0x147aeb['SentimentScore']['Negative'],'sMixed':_0x147aeb[_0xf0ca('0x2a')][_0xf0ca('0x2b')],'sNeutral':_0x147aeb[_0xf0ca('0x2a')][_0xf0ca('0x2c')]});})[_0xf0ca('0xa')](function(){logger['info'](util[_0xf0ca('0x7')](_0xf0ca('0x2d'),_0x330946['id']));_0x24fd06();});case _0xf0ca('0x2e'):return _0x330946[_0xf0ca('0x27')]({'transcribeStatus':_0xf0ca('0x2e'),'failureReason':_0x2b074e[_0xf0ca('0xc')]['FailureReason']})[_0xf0ca('0xa')](function(){logger[_0xf0ca('0x6')](util[_0xf0ca('0x7')](_0xf0ca('0x2d'),_0x330946['id']));_0x24fd06();});default:logger['info'](util[_0xf0ca('0x7')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x330946['id']));break;}}else{return BPromise[_0xf0ca('0x2f')]()[_0xf0ca('0xa')](function(){if(!_0x330946[_0xf0ca('0x17')]){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x582e00['sentiment']||!_0x582e00[_0xf0ca('0x1b')]||!_0x582e00[_0xf0ca('0x1c')]||!_0x582e00[_0xf0ca('0x1d')]||!_0x582e00[_0xf0ca('0x1e')]){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x1f'));}if(!_0x330946[_0xf0ca('0xb')]){throw new Error(_0xf0ca('0x20'));}if(_0x582e00[_0xf0ca('0x1b')]===_0x3c1332['id']){return _0x3c1332;}else{return db['CloudProvider'][_0xf0ca('0x30')]({'where':{'id':_settings[_0xf0ca('0x1b')]}});}})[_0xf0ca('0xa')](function(_0x23f901){if(!_0x23f901){throw new db['Sequelize']['ValidationError'](_0xf0ca('0x22'));}if(!_0x23f901[_0xf0ca('0x23')]||!_0x23f901[_0xf0ca('0x24')]){throw new db['Sequelize'][(_0xf0ca('0x19'))](_0xf0ca('0x25'));}_0x38c595=_0x23f901;logger[_0xf0ca('0x6')](util[_0xf0ca('0x7')](_0xf0ca('0x26'),_0x330946['id']));return sentiment(_0x38c595[_0xf0ca('0x23')],_0x38c595[_0xf0ca('0x24')],_0x582e00[_0xf0ca('0x1c')],_0x330946[_0xf0ca('0xb')],_0x582e00[_0xf0ca('0x1d')]);})[_0xf0ca('0xa')](function(_0x328a7a){logger[_0xf0ca('0x6')](util[_0xf0ca('0x7')](_0xf0ca('0x31'),_0x330946['id']));return _0x330946[_0xf0ca('0x27')]({'sentiment':_0x328a7a[_0xf0ca('0x28')],'sPositive':_0x328a7a[_0xf0ca('0x2a')][_0xf0ca('0x29')],'sNegative':_0x328a7a[_0xf0ca('0x2a')][_0xf0ca('0x32')],'sMixed':_0x328a7a[_0xf0ca('0x2a')][_0xf0ca('0x2b')],'sNeutral':_0x328a7a[_0xf0ca('0x2a')][_0xf0ca('0x2c')],'transcribeStatus':'COMPLETED'});})[_0xf0ca('0xa')](function(){logger[_0xf0ca('0x6')](util[_0xf0ca('0x7')](_0xf0ca('0x2d'),_0x330946['id']));_0x24fd06();});}})[_0xf0ca('0x33')](function(_0x5e1b71){if(_0x5e1b71){if(!_0x5e1b71[_0xf0ca('0x34')]||_0x5e1b71[_0xf0ca('0x34')]!=='SequelizeValidationError'){logger['error'](util[_0xf0ca('0x7')](_0xf0ca('0x35'),_0x330946['id']),util[_0xf0ca('0x36')](_0x5e1b71,{'showHidden':![],'depth':null}));}}_0x24fd06();});});}function checkTranscribe(){var _0x500cfb;var _0x17b48a;var _0x5dad46;return db['VoiceRecording'][_0xf0ca('0x37')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x10e117){if(!_0x10e117||!_0x10e117['length']){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x38'));}_0x500cfb=_0x10e117;return db[_0xf0ca('0x39')][_0xf0ca('0x30')]({'where':{'id':0x1}});})[_0xf0ca('0xa')](function(_0x5ef4dc){if(!_0x5ef4dc){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x3a'));}_0x17b48a=_0x5ef4dc;if(!_0x17b48a[_0xf0ca('0x3b')]||!_0x17b48a['transcribeAccountId']||!_0x17b48a[_0xf0ca('0x9')]||!_0x17b48a[_0xf0ca('0x1d')]||!_0x17b48a[_0xf0ca('0x1e')]){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x3c'));}return db[_0xf0ca('0x21')][_0xf0ca('0x30')]({'where':{'id':_0x17b48a['transcribeAccountId']}});})['then'](function(_0x2333f5){if(!_0x2333f5){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x22'));}if(!_0x2333f5[_0xf0ca('0x23')]||!_0x2333f5[_0xf0ca('0x24')]){throw new db[(_0xf0ca('0x18'))][(_0xf0ca('0x19'))](_0xf0ca('0x25'));}_0x5dad46=_0x2333f5;var _0x2de7e0=[];_0x500cfb[_0xf0ca('0x3d')](function(_0x9fed6d){_0x2de7e0[_0xf0ca('0x3e')](checkTranscribeJob(_0x9fed6d,_0x17b48a,_0x5dad46));});return BPromise[_0xf0ca('0x3f')](_0x2de7e0);})['catch'](function(_0x1f535e){if(_0x1f535e){if(!_0x1f535e[_0xf0ca('0x34')]||_0x1f535e['name']!==_0xf0ca('0x40')){logger[_0xf0ca('0x41')](util['inspect'](_0x1f535e,{'showHidden':![],'depth':null}));}}});}exports[_0xf0ca('0x42')]=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 0842a79..6354311 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 _0xd60d=['format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','catch','error','inspect','start','lodash','ioredis','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout'];(function(_0x17158c,_0x58cb92){var _0x734f31=function(_0x2a7a84){while(--_0x2a7a84){_0x17158c['push'](_0x17158c['shift']());}};_0x734f31(++_0x58cb92);}(_0xd60d,0xd8));var _0xdd60=function(_0x296eb4,_0x296d7c){_0x296eb4=_0x296eb4-0x0;var _0x3cfcfa=_0xd60d[_0x296eb4];return _0x3cfcfa;};'use strict';var _=require(_0xdd60('0x0'));var moment=require('moment');var Redis=require(_0xdd60('0x1'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xdd60('0x2'));config[_0xdd60('0x3')]=_[_0xdd60('0x4')](config[_0xdd60('0x3')],{'host':_0xdd60('0x5'),'port':0x18eb});var io=require(_0xdd60('0x6'))(new Redis(config[_0xdd60('0x3')]));function closeInteractions(){var _0x3425c6=[];return db['WhatsappInteraction'][_0xdd60('0x7')]({'raw':!![],'attributes':['id',_0xdd60('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xdd60('0x9')](function(_0x45310a){if(_0x45310a&&_0x45310a['length']){_0x3425c6=_[_0xdd60('0xa')](_0x45310a||[],'id');logger[_0xdd60('0xb')](_0xdd60('0xc'),_0x3425c6[_0xdd60('0xd')]());return db[_0xdd60('0xe')][_0xdd60('0xf')]({'closeReason':_0xdd60('0x10'),'disposition':_0xdd60('0x11'),'closed':!![],'closedAt':moment()[_0xdd60('0x12')](_0xdd60('0x13'))},{'where':{'id':_0x3425c6}});}})[_0xdd60('0x9')](function(){if(_0x3425c6&&_0x3425c6['length']){logger['info'](_0xdd60('0x14'),_0x3425c6['join']());for(var _0x403e6e=0x0;_0x403e6e<_0x3425c6[_0xdd60('0x15')];_0x403e6e++){io['emit']('whatsappInteraction:update',{'id':_0x3425c6[_0x403e6e],'closed':!![]});}}})[_0xdd60('0x16')](function(_0x506a66){logger[_0xdd60('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x506a66?util[_0xdd60('0x18')](_0x506a66,{'showHidden':![],'depth':null}):'');});}exports[_0xdd60('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xcff9=['WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','catch','error','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','findAll','subtract','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x246e1a,_0x30ee98){var _0x19a13c=function(_0x3c4cd8){while(--_0x3c4cd8){_0x246e1a['push'](_0x246e1a['shift']());}};_0x19a13c(++_0x30ee98);}(_0xcff9,0x8c));var _0x9cff=function(_0x4e0457,_0x5f3ce9){_0x4e0457=_0x4e0457-0x0;var _0x52defc=_0xcff9[_0x4e0457];return _0x52defc;};'use strict';var _=require(_0x9cff('0x0'));var moment=require(_0x9cff('0x1'));var Redis=require(_0x9cff('0x2'));var util=require(_0x9cff('0x3'));var config=require('../../config/environment');var db=require(_0x9cff('0x4'))['db'];var logger=require(_0x9cff('0x5'))('schedule');config[_0x9cff('0x6')]=_[_0x9cff('0x7')](config[_0x9cff('0x6')],{'host':_0x9cff('0x8'),'port':0x18eb});var io=require(_0x9cff('0x9'))(new Redis(config[_0x9cff('0x6')]));function closeInteractions(){var _0x48e4d8=[];return db['WhatsappInteraction'][_0x9cff('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9cff('0xb')](0x18,'hours')}}})[_0x9cff('0xc')](function(_0x2c9906){if(_0x2c9906&&_0x2c9906['length']){_0x48e4d8=_['map'](_0x2c9906||[],'id');logger[_0x9cff('0xd')](_0x9cff('0xe'),_0x48e4d8[_0x9cff('0xf')]());return db[_0x9cff('0x10')]['update']({'closeReason':_0x9cff('0x11'),'disposition':_0x9cff('0x12'),'closed':!![],'closedAt':moment()[_0x9cff('0x13')](_0x9cff('0x14'))},{'where':{'id':_0x48e4d8}});}})[_0x9cff('0xc')](function(){if(_0x48e4d8&&_0x48e4d8[_0x9cff('0x15')]){logger[_0x9cff('0xd')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x48e4d8[_0x9cff('0xf')]());for(var _0x41953d=0x0;_0x41953d<_0x48e4d8[_0x9cff('0x15')];_0x41953d++){io['emit']('whatsappInteraction:update',{'id':_0x48e4d8[_0x41953d],'closed':!![]});}}})[_0x9cff('0x16')](function(_0x440451){logger[_0x9cff('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x440451?util[_0x9cff('0x18')](_0x440451,{'showHidden':![],'depth':null}):'');});}exports[_0x9cff('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 4a15d9e..f62ed94 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98f1=['push','now','CmContact','then','bulkCreate','log','contacts1','CmHopper','destroy','hopper1','finished\x20populating','contacts2','hopper2','catch','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x129149,_0x41f7e7){var _0x2b52e1=function(_0x3bbf94){while(--_0x3bbf94){_0x129149['push'](_0x129149['shift']());}};_0x2b52e1(++_0x41f7e7);}(_0x98f1,0x19d));var _0x198f=function(_0x3f437d,_0x42343f){_0x3f437d=_0x3f437d-0x0;var _0x49c417=_0x98f1[_0x3f437d];return _0x49c417;};'use strict';var util=require(_0x198f('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x198f('0x1')+i,'lastName':_0x198f('0x2')+i,'phone':0xf879fb460+i,'email':_0x198f('0x3')+i+_0x198f('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x198f('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x198f('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x198f('0x6')](),'updatedAt':Date[_0x198f('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x198f('0x5')]({'id':i,'firstName':_0x198f('0x1')+i,'lastName':_0x198f('0x2')+i,'phone':0xf879fb460+i,'email':_0x198f('0x3')+i+_0x198f('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x198f('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x198f('0x6')](),'updatedAt':Date['now']()});}db[_0x198f('0x7')]['destroy']({'where':{}})[_0x198f('0x8')](function(){return db[_0x198f('0x7')][_0x198f('0x9')](contacts);})[_0x198f('0x8')](function(){console[_0x198f('0xa')]('finished\x20populating',_0x198f('0xb'));return db[_0x198f('0xc')][_0x198f('0xd')]({'where':{}});})[_0x198f('0x8')](function(){return db['CmHopper'][_0x198f('0x9')](hopper);})['then'](function(){console[_0x198f('0xa')]('finished\x20populating',_0x198f('0xe'));return db[_0x198f('0x7')][_0x198f('0x9')](contacts2);})[_0x198f('0x8')](function(){console[_0x198f('0xa')](_0x198f('0xf'),_0x198f('0x10'));return db[_0x198f('0xc')][_0x198f('0x9')](hopper2);})[_0x198f('0x8')](function(){console[_0x198f('0xa')](_0x198f('0xf'),_0x198f('0x11'));})[_0x198f('0x12')](function(_0x197922){console[_0x198f('0xa')](_0x197922);}); \ No newline at end of file +var _0x8005=['catch','util','../mysqldb','Innocenzo','innocenzo.biondo','push','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','contacts2'];(function(_0x2cf062,_0x3c15c6){var _0x376203=function(_0x23ca8e){while(--_0x23ca8e){_0x2cf062['push'](_0x2cf062['shift']());}};_0x376203(++_0x3c15c6);}(_0x8005,0x122));var _0x5800=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0x8005[_0x2ac71a];return _0x3ee904;};'use strict';var util=require(_0x5800('0x0'));var db=require(_0x5800('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x5800('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x5800('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5800('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5800('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5800('0x4')]({'id':i,'firstName':_0x5800('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x5800('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5800('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x5800('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5800('0x5')](),'updatedAt':Date[_0x5800('0x5')]()});}db[_0x5800('0x7')][_0x5800('0x8')]({'where':{}})[_0x5800('0x9')](function(){return db[_0x5800('0x7')][_0x5800('0xa')](contacts);})[_0x5800('0x9')](function(){console[_0x5800('0xb')](_0x5800('0xc'),_0x5800('0xd'));return db[_0x5800('0xe')][_0x5800('0x8')]({'where':{}});})[_0x5800('0x9')](function(){return db[_0x5800('0xe')][_0x5800('0xa')](hopper);})['then'](function(){console[_0x5800('0xb')](_0x5800('0xc'),'hopper1');return db[_0x5800('0x7')]['bulkCreate'](contacts2);})[_0x5800('0x9')](function(){console[_0x5800('0xb')]('finished\x20populating',_0x5800('0xf'));return db['CmHopper'][_0x5800('0xa')](hopper2);})[_0x5800('0x9')](function(){console[_0x5800('0xb')](_0x5800('0xc'),'hopper2');})[_0x5800('0x10')](function(_0x4d78c1){console[_0x5800('0xb')](_0x4d78c1);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 81a567c..df798d5 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb598=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','%s%s@xcally.com','agent','password','friend','udp'];(function(_0x24c1b4,_0x40bcfa){var _0x359d2e=function(_0x1f43cc){while(--_0x1f43cc){_0x24c1b4['push'](_0x24c1b4['shift']());}};_0x359d2e(++_0x40bcfa);}(_0xb598,0x9e));var _0x8b59=function(_0x24ff4a,_0x9e145b){_0x24ff4a=_0x24ff4a-0x0;var _0x27f8b3=_0xb598[_0x24ff4a];return _0x27f8b3;};'use strict';var util=require(_0x8b59('0x0'));var db=require(_0x8b59('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8b59('0x2')]({'name':util[_0x8b59('0x3')](_0x8b59('0x4'),'agent',i),'fullname':util[_0x8b59('0x3')]('%s%s','agent',i),'email':util[_0x8b59('0x3')](_0x8b59('0x5'),'agent',i),'role':_0x8b59('0x6'),'password':_0x8b59('0x7'),'internal':0xfa0+i,'type':_0x8b59('0x8'),'transport':[_0x8b59('0x9'),'ws',_0x8b59('0xa')],'disallow':[_0x8b59('0xb')],'allow':[_0x8b59('0xc')],'defaultuser':util[_0x8b59('0x3')](_0x8b59('0x4'),_0x8b59('0x6'),i),'encryption':_0x8b59('0xd'),'avpf':_0x8b59('0xd'),'force_avp':_0x8b59('0xd'),'icesupport':_0x8b59('0xd'),'dtlsenable':_0x8b59('0xd'),'dtlsverify':'no','dtlscertfile':_0x8b59('0xe'),'dtlsprivatekey':_0x8b59('0xf'),'dtlssetup':_0x8b59('0x10'),'callerid':util['format'](_0x8b59('0x11'),util['format']('%s%s',_0x8b59('0x6'),i),0xfa0+i)});}db[_0x8b59('0x12')][_0x8b59('0x13')](users)[_0x8b59('0x14')](function(){console[_0x8b59('0x15')](_0x8b59('0x16'));})[_0x8b59('0x17')](function(_0x13e86a){console[_0x8b59('0x15')](_0x13e86a);}); \ No newline at end of file +var _0x0009=['actpass','\x22%s\x22\x20<%s>','then','catch','log','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x0009,0x1bd));var _0x9000=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0x0009[_0x32056c];return _0x317313;};'use strict';var util=require(_0x9000('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9000('0x1')]({'name':util[_0x9000('0x2')](_0x9000('0x3'),_0x9000('0x4'),i),'fullname':util['format'](_0x9000('0x3'),_0x9000('0x4'),i),'email':util['format'](_0x9000('0x5'),_0x9000('0x4'),i),'role':_0x9000('0x4'),'password':_0x9000('0x6'),'internal':0xfa0+i,'type':_0x9000('0x7'),'transport':[_0x9000('0x8'),'ws',_0x9000('0x9')],'disallow':[_0x9000('0xa')],'allow':[_0x9000('0xb')],'defaultuser':util['format']('%s%s','agent',i),'encryption':_0x9000('0xc'),'avpf':_0x9000('0xc'),'force_avp':'yes','icesupport':_0x9000('0xc'),'dtlsenable':_0x9000('0xc'),'dtlsverify':'no','dtlscertfile':_0x9000('0xd'),'dtlsprivatekey':_0x9000('0xe'),'dtlssetup':_0x9000('0xf'),'callerid':util[_0x9000('0x2')](_0x9000('0x10'),util[_0x9000('0x2')]('%s%s',_0x9000('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x9000('0x11')](function(){console['log']('add\x20user');})[_0x9000('0x12')](function(_0x2374b6){console[_0x9000('0x13')](_0x2374b6);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 5cd8fff..5dcdb3a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5e2=['user:%s','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:outbound','hasOwnProperty','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','userProfileId','ChatQueue','FaxQueue','WhatsappQueues','Telephones','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','trunk:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','Campaign','format','%s:queue:%s','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf5e2,0xa7));var _0x2f5e=function(_0x3dcd75,_0x4eda1f){_0x3dcd75=_0x3dcd75-0x0;var _0x5db8b7=_0xf5e2[_0x3dcd75];return _0x5db8b7;};'use strict';var _=require(_0x2f5e('0x0'));var util=require(_0x2f5e('0x1'));var BPromise=require(_0x2f5e('0x2'));var db=require(_0x2f5e('0x3'))['db'];var config=require(_0x2f5e('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x2f5e('0x5'),'model':db[_0x2f5e('0x6')],'attributes':['id',_0x2f5e('0x7'),_0x2f5e('0x8')],'raw':!![],'where':{'role':_0x2f5e('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2f5e('0x7')],'where':{'role':_0x2f5e('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2f5e('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x2f5e('0x7')],'where':{'role':_0x2f5e('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2f5e('0x7'),_0x2f5e('0xb')],'where':{'type':_0x2f5e('0xc')}};function getAssociatedResources(_0x310c9e,_0x4b2791,_0x1dd020){return db[_0x2f5e('0xd')][_0x2f5e('0xe')]({'where':{'name':_0x310c9e,'userProfileId':_0x4b2791},'raw':!![]})['then'](function(_0x2cc821){if(_0x2cc821){if(_0x2cc821[_0x2f5e('0xf')]){switch(_0x310c9e){case _0x2f5e('0x10'):case _0x2f5e('0x11'):case _0x2f5e('0x12'):case _0x2f5e('0x13'):case _0x2f5e('0x14'):case _0x2f5e('0x15'):case'WhatsappQueues':return db[_0x1dd020][_0x2f5e('0x16')](queryQueues);case'Telephones':return db[_0x1dd020][_0x2f5e('0x16')](queryTelephones);case _0x2f5e('0x17'):return db[_0x1dd020][_0x2f5e('0x16')](queryTrunks);case _0x2f5e('0x18'):return db[_0x1dd020][_0x2f5e('0x16')](queryCampaigns);}}else{return db[_0x2f5e('0x19')][_0x2f5e('0x16')]({'attributes':[_0x2f5e('0x1a')],'where':{'sectionId':_0x2cc821['id']},'raw':!![]})[_0x2f5e('0x1b')](function(_0x12ca70){if(_0x12ca70){var _0x150512={'where':{'id':_[_0x2f5e('0x1c')](_0x12ca70,_0x2f5e('0x1a'))},'raw':!![]};switch(_0x1dd020){case _0x2f5e('0x6'):_0x150512['where']['role']=_0x2f5e('0xa');break;case _0x2f5e('0x1d'):_0x150512['where'][_0x2f5e('0xb')]='ivr';break;}return db[_0x1dd020]['findAll'](_0x150512);}else{return[];}});}}else{return[];}})[_0x2f5e('0x1b')](function(_0x3efb15){return _0x3efb15;});}function joinOrLeaveQueues(_0x6c330f,_0x2b8e0d,_0x44f737,_0x4ffa9b){_0x6c330f[_0x2b8e0d](util[_0x2f5e('0x1e')](_0x2f5e('0x1f'),_0x44f737,_0x4ffa9b[_0x2f5e('0x7')]));if(_0x4ffa9b[_0x2f5e('0x5')]){for(var _0x56a0da=0x0;_0x56a0da<_0x4ffa9b[_0x2f5e('0x5')][_0x2f5e('0x20')];_0x56a0da+=0x1){_0x6c330f[_0x2b8e0d](util[_0x2f5e('0x1e')](_0x2f5e('0x21'),_0x4ffa9b[_0x2f5e('0x5')][_0x56a0da][_0x2f5e('0x7')]));}}}function joinOrLeave(_0x219e0b,_0x290d3a,_0x14cfea){var _0x5d11e0;if(_0x219e0b[_0x2f5e('0x22')][_0x2f5e('0x23')]['id']){db['User']['find']({'attributes':['id','name','role','userProfileId'],'where':{'id':_0x219e0b['handshake'][_0x2f5e('0x23')]['id']},'include':[{'model':db[_0x2f5e('0x24')],'as':_0x2f5e('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f5e('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x2f5e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f5e('0x28')],'as':_0x2f5e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f5e('0x2a')],'as':_0x2f5e('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f5e('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x2f5e('0x1b')](function(_0xadceb5){if(_0xadceb5){_0x5d11e0=_0xadceb5;_0x219e0b[_0x290d3a](util['format'](_0x2f5e('0x21'),_0xadceb5[_0x2f5e('0x7')]));var _0x311469=[];switch(_0xadceb5[_0x2f5e('0x8')]){case'admin':_0x219e0b[_0x290d3a]('voice:inbound');_0x219e0b[_0x290d3a](_0x2f5e('0x2d'));if(queryQueues[_0x2f5e('0x2e')](_0x2f5e('0x2f'))){delete queryQueues[_0x2f5e('0x2f')];}_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x31')][_0x2f5e('0x16')](queryQueues));_0x311469[_0x2f5e('0x30')](db['ChatQueue'][_0x2f5e('0x16')](queryQueues));_0x311469['push'](db['FaxQueue'][_0x2f5e('0x16')](queryQueues));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x32')][_0x2f5e('0x16')](queryQueues));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x33')][_0x2f5e('0x16')](queryQueues));_0x311469['push'](db['OpenchannelQueue'][_0x2f5e('0x16')](queryQueues));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x34')][_0x2f5e('0x16')](queryQueues));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x6')][_0x2f5e('0x16')](queryTelephones));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x35')]['findAll'](queryTrunks));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x1d')]['findAll'](queryCampaigns));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x6')][_0x2f5e('0x16')](queryAgents));break;case _0x2f5e('0x36'):_0x219e0b[_0x290d3a]('voice:inbound');_0x219e0b[_0x290d3a](_0x2f5e('0x2d'));_0x311469[_0x2f5e('0x30')](getAssociatedResources('VoiceQueues',_0xadceb5[_0x2f5e('0x37')],'VoiceQueue'));_0x311469[_0x2f5e('0x30')](getAssociatedResources(_0x2f5e('0x11'),_0xadceb5[_0x2f5e('0x37')],_0x2f5e('0x38')));_0x311469['push'](getAssociatedResources('FaxQueues',_0xadceb5[_0x2f5e('0x37')],_0x2f5e('0x39')));_0x311469[_0x2f5e('0x30')](getAssociatedResources(_0x2f5e('0x13'),_0xadceb5['userProfileId'],_0x2f5e('0x32')));_0x311469[_0x2f5e('0x30')](getAssociatedResources(_0x2f5e('0x14'),_0xadceb5[_0x2f5e('0x37')],_0x2f5e('0x33')));_0x311469['push'](getAssociatedResources(_0x2f5e('0x15'),_0xadceb5[_0x2f5e('0x37')],'OpenchannelQueue'));_0x311469[_0x2f5e('0x30')](getAssociatedResources(_0x2f5e('0x3a'),_0xadceb5[_0x2f5e('0x37')],_0x2f5e('0x34')));_0x311469['push'](getAssociatedResources(_0x2f5e('0x3b'),_0xadceb5[_0x2f5e('0x37')],'User'));_0x311469[_0x2f5e('0x30')](getAssociatedResources(_0x2f5e('0x17'),_0xadceb5[_0x2f5e('0x37')],_0x2f5e('0x35')));_0x311469[_0x2f5e('0x30')](getAssociatedResources('IvrCampaigns',_0xadceb5[_0x2f5e('0x37')],_0x2f5e('0x1d')));_0x311469[_0x2f5e('0x30')](db[_0x2f5e('0x6')]['findAll'](queryAgents));break;case _0x2f5e('0x9'):_0x219e0b[_0x290d3a](_0x2f5e('0x3c'));_0x219e0b[_0x290d3a](_0x2f5e('0x2d'));_0x311469[_0x2f5e('0x30')](_0xadceb5[_0x2f5e('0x3d')]({'attributes':['id','name']}));_0x311469[_0x2f5e('0x30')](_0xadceb5[_0x2f5e('0x3e')]({'attributes':['id',_0x2f5e('0x7')]}));_0x311469['push'](_0xadceb5[_0x2f5e('0x3f')]({'attributes':['id',_0x2f5e('0x7')]}));_0x311469['push'](_0xadceb5[_0x2f5e('0x40')]({'attributes':['id',_0x2f5e('0x7')]}));_0x311469[_0x2f5e('0x30')](_0xadceb5['getMailQueues']({'attributes':['id',_0x2f5e('0x7')]}));_0x311469[_0x2f5e('0x30')](_0xadceb5['getOpenchannelQueues']({'attributes':['id',_0x2f5e('0x7')]}));_0x311469[_0x2f5e('0x30')](_0xadceb5[_0x2f5e('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0x2f5e('0x42')](_0x311469);}})[_0x2f5e('0x1b')](function(_0x29e1d0){if(_0x29e1d0&&_0x29e1d0[_0x2f5e('0x20')]){for(var _0x2e8034=0x0;_0x2e8034<_0x29e1d0[_0x2f5e('0x20')];_0x2e8034+=0x1){for(var _0x3293b3=0x0;_0x3293b3<_0x29e1d0[_0x2e8034]['length'];_0x3293b3+=0x1){switch(_0x2e8034){case 0x0:joinOrLeaveQueues(_0x219e0b,_0x290d3a,_0x2f5e('0x43'),_0x29e1d0[_0x2e8034][_0x3293b3]);break;case 0x1:joinOrLeaveQueues(_0x219e0b,_0x290d3a,_0x2f5e('0x44'),_0x29e1d0[_0x2e8034][_0x3293b3]);break;case 0x2:joinOrLeaveQueues(_0x219e0b,_0x290d3a,_0x2f5e('0x45'),_0x29e1d0[_0x2e8034][_0x3293b3]);break;case 0x3:joinOrLeaveQueues(_0x219e0b,_0x290d3a,_0x2f5e('0x46'),_0x29e1d0[_0x2e8034][_0x3293b3]);break;case 0x4:joinOrLeaveQueues(_0x219e0b,_0x290d3a,_0x2f5e('0x47'),_0x29e1d0[_0x2e8034][_0x3293b3]);break;case 0x5:joinOrLeaveQueues(_0x219e0b,_0x290d3a,'openchannel',_0x29e1d0[_0x2e8034][_0x3293b3]);break;case 0x6:joinOrLeaveQueues(_0x219e0b,_0x290d3a,'whatsapp',_0x29e1d0[_0x2e8034][_0x3293b3]);break;case 0x7:if(_0x5d11e0[_0x2f5e('0x8')]!==_0x2f5e('0x9'))_0x219e0b[_0x290d3a](util[_0x2f5e('0x1e')]('telephone:%s',_0x29e1d0[_0x2e8034][_0x3293b3]['name']));break;case 0x8:if(_0x5d11e0[_0x2f5e('0x8')]!==_0x2f5e('0x9'))_0x219e0b[_0x290d3a](util[_0x2f5e('0x1e')](_0x2f5e('0x48'),_0x29e1d0[_0x2e8034][_0x3293b3][_0x2f5e('0x7')]));break;case 0x9:if(_0x5d11e0[_0x2f5e('0x8')]!==_0x2f5e('0x9'))_0x219e0b[_0x290d3a](util[_0x2f5e('0x1e')]('campaign:%s:%s',_0x29e1d0[_0x2e8034][_0x3293b3]['type'],_0x29e1d0[_0x2e8034][_0x3293b3][_0x2f5e('0x7')]));break;case 0xa:_0x219e0b[_0x290d3a](util[_0x2f5e('0x1e')](_0x2f5e('0x21'),_0x29e1d0[_0x2e8034][_0x3293b3]['name']));break;}}}}})[_0x2f5e('0x1b')](function(){if(_0x290d3a===_0x2f5e('0x49')){var _0x20e8fd=_['map'](_0x5d11e0['ChatInteractions'],'id');return _0x5d11e0[_0x2f5e('0x4a')](_0x20e8fd)[_0x2f5e('0x1b')](function(){for(var _0x21756f=0x0;_0x21756f<_0x20e8fd['length'];_0x21756f+=0x1){_0x14cfea[_0x2f5e('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x20e8fd[_0x21756f]),'UserId':Number(_0x5d11e0['id'])});}});}})[_0x2f5e('0x1b')](function(){if(_0x290d3a===_0x2f5e('0x49')){var _0x166a31=_['map'](_0x5d11e0[_0x2f5e('0x4c')],'id');return _0x5d11e0[_0x2f5e('0x4d')](_0x166a31)[_0x2f5e('0x1b')](function(){for(var _0x3eaeff=0x0;_0x3eaeff<_0x166a31[_0x2f5e('0x20')];_0x3eaeff+=0x1){_0x14cfea[_0x2f5e('0x4b')](_0x2f5e('0x4e'),{'MailInteractionId':Number(_0x166a31[_0x3eaeff]),'UserId':Number(_0x5d11e0['id'])});}});}})[_0x2f5e('0x1b')](function(){if(_0x290d3a===_0x2f5e('0x49')){var _0x4a79a8=_[_0x2f5e('0x1c')](_0x5d11e0[_0x2f5e('0x27')],'id');return _0x5d11e0[_0x2f5e('0x4f')](_0x4a79a8)[_0x2f5e('0x1b')](function(){for(var _0x28772c=0x0;_0x28772c<_0x4a79a8[_0x2f5e('0x20')];_0x28772c+=0x1){_0x14cfea[_0x2f5e('0x4b')](_0x2f5e('0x50'),{'FaxInteractionId':Number(_0x4a79a8[_0x28772c]),'UserId':Number(_0x5d11e0['id'])});}});}})[_0x2f5e('0x1b')](function(){if(_0x290d3a===_0x2f5e('0x49')){var _0x4415b5=_[_0x2f5e('0x1c')](_0x5d11e0[_0x2f5e('0x29')],'id');return _0x5d11e0[_0x2f5e('0x51')](_0x4415b5)['then'](function(){for(var _0x284617=0x0;_0x284617<_0x4415b5[_0x2f5e('0x20')];_0x284617+=0x1){_0x14cfea[_0x2f5e('0x4b')](_0x2f5e('0x52'),{'SmsInteractionId':Number(_0x4415b5[_0x284617]),'UserId':Number(_0x5d11e0['id'])});}});}})[_0x2f5e('0x1b')](function(){if(_0x290d3a===_0x2f5e('0x49')){var _0x3196c6=_['map'](_0x5d11e0[_0x2f5e('0x2b')],'id');return _0x5d11e0[_0x2f5e('0x53')](_0x3196c6)['then'](function(){for(var _0x3768b1=0x0;_0x3768b1<_0x3196c6[_0x2f5e('0x20')];_0x3768b1+=0x1){_0x14cfea['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3196c6[_0x3768b1]),'UserId':Number(_0x5d11e0['id'])});}});}})['then'](function(){if(_0x290d3a===_0x2f5e('0x49')){var _0x1be608=_[_0x2f5e('0x1c')](_0x5d11e0[_0x2f5e('0x54')],'id');return _0x5d11e0[_0x2f5e('0x55')](_0x1be608)[_0x2f5e('0x1b')](function(){for(var _0xce439e=0x0;_0xce439e<_0x1be608[_0x2f5e('0x20')];_0xce439e+=0x1){_0x14cfea[_0x2f5e('0x4b')](_0x2f5e('0x56'),{'WhatsappInteractionId':Number(_0x1be608[_0xce439e]),'UserId':Number(_0x5d11e0['id'])});}});}})[_0x2f5e('0x57')](function(_0x2bd4b8){_0x219e0b[_0x2f5e('0x58')](_0x2bd4b8);});}}function onDisconnect(_0x1feb40,_0x126053){joinOrLeave(_0x1feb40,'leave',_0x126053);}function onConnect(_0x522b1c){joinOrLeave(_0x522b1c,_0x2f5e('0x59'));}exports[_0x2f5e('0x5a')]=function(_0x4a5df2){_0x4a5df2['on'](_0x2f5e('0x5b'),function(_0xb93abb){_0xb93abb['setMaxListeners'](0x0);_0xb93abb[_0x2f5e('0x5c')]=_0xb93abb[_0x2f5e('0x5d')]['connection'][_0x2f5e('0x5e')]+':'+_0xb93abb[_0x2f5e('0x5d')]['connection']['remotePort'];_0xb93abb[_0x2f5e('0x5f')]=new Date();_0xb93abb[_0x2f5e('0x58')]=function(_0x1db2be){console[_0x2f5e('0x58')](_0x2f5e('0x60')+_0xb93abb[_0x2f5e('0x61')][_0x2f5e('0x7')]+'['+_0xb93abb['address']+']',_0x1db2be);};_0xb93abb['on'](_0x2f5e('0x62'),function(){onDisconnect(_0xb93abb,_0x4a5df2);_0xb93abb[_0x2f5e('0x58')]('DISCONNECTED');});onConnect(_0xb93abb);_0xb93abb['log'](_0x2f5e('0x63'));});}; \ No newline at end of file +var _0xba79=['userProfileId','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueues','WhatsappQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','emit','MailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','User','name','role','agent','type','ivr','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','then','resourceId','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','ChatInteraction','MailInteraction','FaxInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','include','push','VoiceQueue','SmsQueue','MailQueue','Trunk','user','voice:outbound'];(function(_0x4ae8c2,_0x409a64){var _0x252e29=function(_0x4ead37){while(--_0x4ead37){_0x4ae8c2['push'](_0x4ae8c2['shift']());}};_0x252e29(++_0x409a64);}(_0xba79,0x153));var _0x9ba7=function(_0x42b1a2,_0x570b82){_0x42b1a2=_0x42b1a2-0x0;var _0x17af3e=_0xba79[_0x42b1a2];return _0x17af3e;};'use strict';var _=require(_0x9ba7('0x0'));var util=require(_0x9ba7('0x1'));var BPromise=require(_0x9ba7('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x9ba7('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x9ba7('0x4')],'attributes':['id',_0x9ba7('0x5'),_0x9ba7('0x6')],'raw':!![],'where':{'role':_0x9ba7('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x9ba7('0x5')],'where':{'role':_0x9ba7('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x9ba7('0x8')],'where':{'type':_0x9ba7('0x9')}};function getAssociatedResources(_0x3d714c,_0xfec018,_0x15869d){return db['UserProfileSection']['findOne']({'where':{'name':_0x3d714c,'userProfileId':_0xfec018},'raw':!![]})['then'](function(_0x59df53){if(_0x59df53){if(_0x59df53[_0x9ba7('0xa')]){switch(_0x3d714c){case _0x9ba7('0xb'):case _0x9ba7('0xc'):case _0x9ba7('0xd'):case _0x9ba7('0xe'):case _0x9ba7('0xf'):case _0x9ba7('0x10'):case'WhatsappQueues':return db[_0x15869d][_0x9ba7('0x11')](queryQueues);case'Telephones':return db[_0x15869d]['findAll'](queryTelephones);case _0x9ba7('0x12'):return db[_0x15869d]['findAll'](queryTrunks);case _0x9ba7('0x13'):return db[_0x15869d][_0x9ba7('0x11')](queryCampaigns);}}else{return db[_0x9ba7('0x14')][_0x9ba7('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x59df53['id']},'raw':!![]})[_0x9ba7('0x15')](function(_0xeff954){if(_0xeff954){var _0x114f7c={'where':{'id':_['map'](_0xeff954,_0x9ba7('0x16'))},'raw':!![]};switch(_0x15869d){case _0x9ba7('0x4'):_0x114f7c[_0x9ba7('0x17')][_0x9ba7('0x6')]='telephone';break;case _0x9ba7('0x18'):_0x114f7c[_0x9ba7('0x17')][_0x9ba7('0x8')]=_0x9ba7('0x9');break;}return db[_0x15869d]['findAll'](_0x114f7c);}else{return[];}});}}else{return[];}})[_0x9ba7('0x15')](function(_0x4e91c5){return _0x4e91c5;});}function joinOrLeaveQueues(_0x55493b,_0x37bd9f,_0x2f8651,_0x1f5400){_0x55493b[_0x37bd9f](util[_0x9ba7('0x19')](_0x9ba7('0x1a'),_0x2f8651,_0x1f5400[_0x9ba7('0x5')]));if(_0x1f5400[_0x9ba7('0x1b')]){for(var _0x1ccd48=0x0;_0x1ccd48<_0x1f5400[_0x9ba7('0x1b')][_0x9ba7('0x1c')];_0x1ccd48+=0x1){_0x55493b[_0x37bd9f](util[_0x9ba7('0x19')](_0x9ba7('0x1d'),_0x1f5400['Agents'][_0x1ccd48]['name']));}}}function joinOrLeave(_0x4e2c9a,_0x5dcba2,_0x3abecf){var _0x285374;if(_0x4e2c9a[_0x9ba7('0x1e')][_0x9ba7('0x1f')]['id']){db[_0x9ba7('0x4')][_0x9ba7('0x20')]({'attributes':['id',_0x9ba7('0x5'),_0x9ba7('0x6'),'userProfileId'],'where':{'id':_0x4e2c9a[_0x9ba7('0x1e')][_0x9ba7('0x1f')]['id']},'include':[{'model':db[_0x9ba7('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x23')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x24')],'as':_0x9ba7('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x26')],'as':_0x9ba7('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x270da2){if(_0x270da2){_0x285374=_0x270da2;_0x4e2c9a[_0x5dcba2](util[_0x9ba7('0x19')](_0x9ba7('0x1d'),_0x270da2[_0x9ba7('0x5')]));var _0x2695a4=[];switch(_0x270da2['role']){case'admin':_0x4e2c9a[_0x5dcba2](_0x9ba7('0x28'));_0x4e2c9a[_0x5dcba2]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x9ba7('0x29')];}_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x2b')]['findAll'](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db['ChatQueue'][_0x9ba7('0x11')](queryQueues));_0x2695a4['push'](db['FaxQueue']['findAll'](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x2c')][_0x9ba7('0x11')](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x2d')][_0x9ba7('0x11')](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db['OpenchannelQueue']['findAll'](queryQueues));_0x2695a4['push'](db['WhatsappQueue'][_0x9ba7('0x11')](queryQueues));_0x2695a4['push'](db[_0x9ba7('0x4')][_0x9ba7('0x11')](queryTelephones));_0x2695a4['push'](db[_0x9ba7('0x2e')][_0x9ba7('0x11')](queryTrunks));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x18')][_0x9ba7('0x11')](queryCampaigns));_0x2695a4['push'](db[_0x9ba7('0x4')][_0x9ba7('0x11')](queryAgents));break;case _0x9ba7('0x2f'):_0x4e2c9a[_0x5dcba2]('voice:inbound');_0x4e2c9a[_0x5dcba2](_0x9ba7('0x30'));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xb'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x2b')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xc'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x32')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xd'),_0x270da2['userProfileId'],_0x9ba7('0x33')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xe'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x2c')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xf'),_0x270da2[_0x9ba7('0x31')],'MailQueue'));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x10'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x34')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x35'),_0x270da2['userProfileId'],_0x9ba7('0x36')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x37'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x4')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources('Trunks',_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x2e')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x13'),_0x270da2['userProfileId'],'Campaign'));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x4')]['findAll'](queryAgents));break;case _0x9ba7('0x7'):_0x4e2c9a[_0x5dcba2]('voice:inbound');_0x4e2c9a[_0x5dcba2]('voice:outbound');_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x38')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x39')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x3a')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x3b')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2['getMailQueues']({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2['getOpenchannelQueues']({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x3c')]({'attributes':['id',_0x9ba7('0x5')]}));break;}return BPromise['all'](_0x2695a4);}})[_0x9ba7('0x15')](function(_0x196d86){if(_0x196d86&&_0x196d86[_0x9ba7('0x1c')]){for(var _0x3c39bb=0x0;_0x3c39bb<_0x196d86['length'];_0x3c39bb+=0x1){for(var _0x19a571=0x0;_0x19a571<_0x196d86[_0x3c39bb][_0x9ba7('0x1c')];_0x19a571+=0x1){switch(_0x3c39bb){case 0x0:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x3d'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x1:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x3e'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x2:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x3f'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x3:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x40'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x4:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x41'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x5:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x42'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x6:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,'whatsapp',_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x7:if(_0x285374[_0x9ba7('0x6')]!==_0x9ba7('0x7'))_0x4e2c9a[_0x5dcba2](util['format'](_0x9ba7('0x43'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;case 0x8:if(_0x285374[_0x9ba7('0x6')]!=='agent')_0x4e2c9a[_0x5dcba2](util[_0x9ba7('0x19')](_0x9ba7('0x44'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;case 0x9:if(_0x285374['role']!==_0x9ba7('0x7'))_0x4e2c9a[_0x5dcba2](util[_0x9ba7('0x19')](_0x9ba7('0x45'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x8')],_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;case 0xa:_0x4e2c9a[_0x5dcba2](util['format'](_0x9ba7('0x1d'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;}}}}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x746c36=_[_0x9ba7('0x47')](_0x285374[_0x9ba7('0x48')],'id');return _0x285374['removeChatInteractions'](_0x746c36)[_0x9ba7('0x15')](function(){for(var _0x2d97e9=0x0;_0x2d97e9<_0x746c36['length'];_0x2d97e9+=0x1){_0x3abecf[_0x9ba7('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x746c36[_0x2d97e9]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x36da5b=_[_0x9ba7('0x47')](_0x285374[_0x9ba7('0x4a')],'id');return _0x285374['removeMailInteractions'](_0x36da5b)['then'](function(){for(var _0x30c6df=0x0;_0x30c6df<_0x36da5b[_0x9ba7('0x1c')];_0x30c6df+=0x1){_0x3abecf['emit'](_0x9ba7('0x4b'),{'MailInteractionId':Number(_0x36da5b[_0x30c6df]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2==='leave'){var _0x1699d6=_['map'](_0x285374[_0x9ba7('0x4c')],'id');return _0x285374[_0x9ba7('0x4d')](_0x1699d6)['then'](function(){for(var _0x33cada=0x0;_0x33cada<_0x1699d6[_0x9ba7('0x1c')];_0x33cada+=0x1){_0x3abecf['emit'](_0x9ba7('0x4e'),{'FaxInteractionId':Number(_0x1699d6[_0x33cada]),'UserId':Number(_0x285374['id'])});}});}})['then'](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x333eaf=_[_0x9ba7('0x47')](_0x285374[_0x9ba7('0x4f')],'id');return _0x285374[_0x9ba7('0x50')](_0x333eaf)[_0x9ba7('0x15')](function(){for(var _0x141321=0x0;_0x141321<_0x333eaf['length'];_0x141321+=0x1){_0x3abecf[_0x9ba7('0x49')](_0x9ba7('0x51'),{'SmsInteractionId':Number(_0x333eaf[_0x141321]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x69e58=_[_0x9ba7('0x47')](_0x285374['OpenchannelInteractions'],'id');return _0x285374['removeOpenchannelInteractions'](_0x69e58)[_0x9ba7('0x15')](function(){for(var _0x5ae9d3=0x0;_0x5ae9d3<_0x69e58[_0x9ba7('0x1c')];_0x5ae9d3+=0x1){_0x3abecf[_0x9ba7('0x49')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x69e58[_0x5ae9d3]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x2e6887=_['map'](_0x285374[_0x9ba7('0x27')],'id');return _0x285374[_0x9ba7('0x52')](_0x2e6887)['then'](function(){for(var _0x23bcd7=0x0;_0x23bcd7<_0x2e6887['length'];_0x23bcd7+=0x1){_0x3abecf['emit'](_0x9ba7('0x53'),{'WhatsappInteractionId':Number(_0x2e6887[_0x23bcd7]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x54')](function(_0x389b1c){_0x4e2c9a[_0x9ba7('0x55')](_0x389b1c);});}}function onDisconnect(_0x2f4f13,_0xbfb677){joinOrLeave(_0x2f4f13,_0x9ba7('0x46'),_0xbfb677);}function onConnect(_0x57cd03){joinOrLeave(_0x57cd03,'join');}exports[_0x9ba7('0x56')]=function(_0x27fd3c){_0x27fd3c['on'](_0x9ba7('0x57'),function(_0xfdb32){_0xfdb32[_0x9ba7('0x58')](0x0);_0xfdb32[_0x9ba7('0x59')]=_0xfdb32[_0x9ba7('0x5a')][_0x9ba7('0x57')]['remoteAddress']+':'+_0xfdb32['request'][_0x9ba7('0x57')][_0x9ba7('0x5b')];_0xfdb32[_0x9ba7('0x5c')]=new Date();_0xfdb32[_0x9ba7('0x55')]=function(_0x45e5c0){console[_0x9ba7('0x55')](_0x9ba7('0x5d')+_0xfdb32[_0x9ba7('0x5e')]['name']+'['+_0xfdb32[_0x9ba7('0x59')]+']',_0x45e5c0);};_0xfdb32['on']('disconnect',function(){onDisconnect(_0xfdb32,_0x27fd3c);_0xfdb32['log'](_0x9ba7('0x5f'));});onConnect(_0xfdb32);_0xfdb32[_0x9ba7('0x55')](_0x9ba7('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b9918b7..d333283 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 _0x6e47=['length','model','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','lodash','http','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','ChatMessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','newmessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','catch','get','motionChannel','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','User','find','name','internal','interface','format','channel','agent','incomingmessage','outgoingmessage','event','opened','contact','changed','substatus','fullname','email','SIP/%s','default'];(function(_0x4e3d12,_0x320927){var _0x310ef8=function(_0x3bfaef){while(--_0x3bfaef){_0x4e3d12['push'](_0x4e3d12['shift']());}};_0x310ef8(++_0x320927);}(_0x6e47,0x1a8));var _0x76e4=function(_0xd6ea1,_0x36354e){_0xd6ea1=_0xd6ea1-0x0;var _0x14c2b9=_0x6e47[_0xd6ea1];return _0x14c2b9;};'use strict';var util=require(_0x76e4('0x0'));var db=require(_0x76e4('0x1'))['db'];var jayson=require(_0x76e4('0x2'));var logger=require(_0x76e4('0x3'))(_0x76e4('0x4'));var _=require(_0x76e4('0x5'));var client=jayson['client'][_0x76e4('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x76e4('0x7'),'event':_0x76e4('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x76e4('0x9'),'model':_0x76e4('0x7'),'event':_0x76e4('0xa'),'condition':_0x76e4('0xb'),'callback':afterUpdate},{'channel':_0x76e4('0x9'),'model':_0x76e4('0xc'),'event':_0x76e4('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x76e4('0xd'),'model':_0x76e4('0xe'),'event':_0x76e4('0x8'),'condition':_0x76e4('0xf'),'callback':afterCreate},{'channel':_0x76e4('0xd'),'model':'SmsInteraction','event':_0x76e4('0xa'),'condition':_0x76e4('0xb'),'callback':afterUpdate},{'channel':_0x76e4('0xd'),'model':_0x76e4('0x10'),'event':_0x76e4('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x76e4('0x11'),'model':'WhatsappInteraction','event':_0x76e4('0x8'),'condition':_0x76e4('0xf'),'callback':afterCreate},{'channel':_0x76e4('0x11'),'model':_0x76e4('0x12'),'event':_0x76e4('0xa'),'condition':_0x76e4('0xb'),'callback':afterUpdate},{'channel':_0x76e4('0x11'),'model':_0x76e4('0x13'),'event':_0x76e4('0x8'),'condition':_0x76e4('0x14'),'callback':afterCreateMessage},{'channel':_0x76e4('0x15'),'model':'FaxInteraction','event':'afterCreate','condition':_0x76e4('0xf'),'callback':afterCreate},{'channel':_0x76e4('0x15'),'model':_0x76e4('0x16'),'event':_0x76e4('0xa'),'condition':_0x76e4('0xb'),'callback':afterUpdate},{'channel':'Fax','model':_0x76e4('0x17'),'event':'afterCreate','condition':_0x76e4('0x14'),'callback':afterCreateMessage},{'channel':_0x76e4('0x18'),'model':_0x76e4('0x19'),'event':_0x76e4('0x8'),'condition':_0x76e4('0xf'),'callback':afterCreate},{'channel':_0x76e4('0x18'),'model':'MailInteraction','event':_0x76e4('0xa'),'condition':_0x76e4('0xb'),'callback':afterUpdate},{'channel':_0x76e4('0x18'),'model':_0x76e4('0x1a'),'event':_0x76e4('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x76e4('0x1b'),'model':_0x76e4('0x1c'),'event':_0x76e4('0x8'),'condition':_0x76e4('0xf'),'callback':afterCreate},{'channel':_0x76e4('0x1b'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x76e4('0xb'),'callback':afterUpdate},{'channel':_0x76e4('0x1b'),'model':_0x76e4('0x1d'),'event':'afterCreate','condition':_0x76e4('0x14'),'callback':afterCreateMessage}];function request(_0x461289){return client[_0x76e4('0x1e')](_0x76e4('0x1f'),_0x461289)[_0x76e4('0x20')](function(_0x1d25dd){logger['info']('Trigger,\x20%s',_0x76e4('0x1f'),_0x1d25dd);if(_0x1d25dd['error']){if(_0x1d25dd['error']['code']===0x1f4){logger['error'](_0x76e4('0x21'),_0x76e4('0x1f'),_0x1d25dd[_0x76e4('0x22')]);}}})[_0x76e4('0x23')](function(_0x2c9465){logger['error'](_0x76e4('0x21'),'EventManager',_0x2c9465);});}function afterCreateMessage(_0x4facc3,_0x4d8cdb){return function(_0x361d89,_0x365abc){_0x361d89=_0x361d89[_0x76e4('0x24')]({'plain':!![]});_0x361d89['channel']=_0x4facc3;_0x361d89[_0x76e4('0x25')]=_0x4facc3;_0x361d89['event']=_0x361d89[_0x76e4('0x26')];var _0x169cd3=_0x76e4('0x27')+_0x361d89[_0x76e4('0x28')];return db[_0x76e4('0x29')][_0x76e4('0x2a')](_0x169cd3,{'type':db[_0x76e4('0x2b')][_0x76e4('0x2c')][_0x76e4('0x2d')],'raw':!![]})[_0x76e4('0x20')](function(_0x36d1c1){return _0x36d1c1;})[_0x76e4('0x20')](function(_0x44d617){if(_0x44d617){_0x361d89['contact']=_0x44d617[0x0];}if(_0x361d89[_0x76e4('0x2e')]){return db[_0x76e4('0x2f')][_0x76e4('0x30')]({'where':{'id':_0x361d89[_0x76e4('0x2e')]},'attributes':['id',_0x76e4('0x31'),'fullname','email',_0x76e4('0x32')],'raw':!![]})[_0x76e4('0x20')](function(_0xa422e5){_0x361d89[_0x76e4('0x33')]=util[_0x76e4('0x34')]('SIP/%s',_0xa422e5['name']);_0x361d89[_0x76e4('0x35')]=_0x4facc3;_0x361d89[_0x76e4('0x36')]=_0xa422e5;return request({'event':_0x76e4('0x37'),'message':_0x361d89});})[_0x76e4('0x23')](function(_0x379ad8){console[_0x76e4('0x22')](_0x379ad8);});}else{return request({'event':_0x76e4('0x38'),'message':_0x361d89});}});};}function afterCreate(_0x4a5311,_0x1d97a6){return function(_0xa9d757,_0x770656){_0xa9d757=_0xa9d757['get']({'plain':!![]});_0xa9d757[_0x76e4('0x35')]=_0x4a5311;_0xa9d757['motionChannel']=_0x4a5311;_0xa9d757[_0x76e4('0x39')]=_0x76e4('0x3a');var _0x17bc4a=_0x76e4('0x27')+_0xa9d757[_0x76e4('0x28')];return db[_0x76e4('0x29')][_0x76e4('0x2a')](_0x17bc4a,{'type':db[_0x76e4('0x2b')][_0x76e4('0x2c')][_0x76e4('0x2d')],'raw':!![]})[_0x76e4('0x20')](function(_0x2c78e8){return _0x2c78e8;})[_0x76e4('0x20')](function(_0x463949){if(_0x463949){_0xa9d757[_0x76e4('0x3b')]=_0x463949[0x0];}return request({'event':_0x1d97a6,'message':_0xa9d757});});};}function afterUpdate(_0xcd0ccc){return function(_0x2e6640){var _0x305634=_0x2e6640[_0x76e4('0x3c')]('closed')&&_0x2e6640['closed'];var _0xf7a5a0=_0x2e6640[_0x76e4('0x3c')](_0x76e4('0x3d'));if(_0x305634||_0xf7a5a0){var _0x340680=_0x305634?'closedinteraction':_0x76e4('0x3d');var _0x36687f=_0x2e6640['get']({'plain':!![]});_0x36687f[_0x76e4('0x35')]=_0xcd0ccc;_0x36687f[_0x76e4('0x25')]=_0xcd0ccc;_0x36687f[_0x76e4('0x39')]=_0x305634?'closed':_0x76e4('0x3d');var _0xb61e0b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x36687f[_0x76e4('0x28')];return db[_0x76e4('0x29')][_0x76e4('0x2a')](_0xb61e0b,{'type':db[_0x76e4('0x2b')]['QueryTypes'][_0x76e4('0x2d')],'raw':!![]})[_0x76e4('0x20')](function(_0x5cb483){if(_0x5cb483){_0x36687f[_0x76e4('0x3b')]=_0x5cb483[0x0];}if(_0x36687f['UserId']){return db['User']['find']({'where':{'id':_0x36687f[_0x76e4('0x2e')]},'attributes':['id',_0x76e4('0x31'),_0x76e4('0x3e'),_0x76e4('0x3f'),_0x76e4('0x32')],'raw':!![]})[_0x76e4('0x20')](function(_0x5e0fa7){_0x36687f['interface']=util[_0x76e4('0x34')](_0x76e4('0x40'),_0x5e0fa7[_0x76e4('0x31')]);_0x36687f['agent']=_0x5e0fa7;return request({'event':_0x340680,'message':_0x36687f});})[_0x76e4('0x23')](function(_0x1ef0a9){console[_0x76e4('0x22')](_0x1ef0a9);});}else{return request({'event':_0x340680,'message':_0x36687f});}});}};}exports[_0x76e4('0x41')]=function(){for(var _0x5e438f=0x0;_0x5e438f=_0x14ca25[_0x1152('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x23da05(_0x804f13);})[_0x1152('0x12')](function(_0x59ece7){_0x2f8cc2(_0x59ece7);});});}; \ No newline at end of file +var _0x1dfc=['chat','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','getLicense','role','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0x1dfc,0x122));var _0xc1df=function(_0x496670,_0xe885f4){_0x496670=_0x496670-0x0;var _0x46f6c3=_0x1dfc[_0x496670];return _0x46f6c3;};'use strict';var _=require(_0xc1df('0x0'));var BPromise=require('bluebird');var db=require(_0xc1df('0x1'))['db'];var util=require(_0xc1df('0x2'));var channels=[_0xc1df('0x3'),'mail',_0xc1df('0x4'),_0xc1df('0x5'),'sms',_0xc1df('0x6'),_0xc1df('0x7')];exports[_0xc1df('0x8')]=function(){return channels;};exports[_0xc1df('0x9')]=function(_0x3796d3){_0x3796d3=_0x3796d3[_0xc1df('0xa')]();return _['includes'](channels,_0x3796d3);};exports[_0xc1df('0xb')]=function(_0x577002,_0x50c69a,_0x261055,_0x3db559){var _0x4aacfa={'loginAttempts':_0x50c69a,'blocked':_0x261055};if(!_[_0xc1df('0xc')](_0x3db559)){_0x4aacfa[_0xc1df('0xd')]=_0x3db559;}return _0x577002['updateAttributes'](_0x4aacfa);};exports[_0xc1df('0xe')]=function(_0x27c57f){return new BPromise(function(_0x18965b,_0x2d707b){var _0x11c799=0x0;if(_0x27c57f[_0xc1df('0xf')]!=='agent'){_0x18965b(_0x27c57f);}db[_0xc1df('0x10')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x27c57f['id']}}})[_0xc1df('0x11')](function(_0x39301b){_0x11c799=_0x39301b;return util[_0xc1df('0xe')]();})[_0xc1df('0x11')](function(_0x186512){if(_0x186512&&_0x186512[_0xc1df('0x12')]&&_0x11c799>=_0x186512[_0xc1df('0x12')]){throw Error(_0xc1df('0x13'));}_0x18965b(_0x27c57f);})[_0xc1df('0x14')](function(_0x5f2dfa){_0x2d707b(_0x5f2dfa);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 932d579..d6c1440 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27df=['json','send','exports','404','status'];(function(_0x137556,_0x253216){var _0x41dc31=function(_0x11cf86){while(--_0x11cf86){_0x137556['push'](_0x137556['shift']());}};_0x41dc31(++_0x253216);}(_0x27df,0x16a));var _0xf27d=function(_0x2cd151,_0x3042ea){_0x2cd151=_0x2cd151-0x0;var _0x199edd=_0x27df[_0x2cd151];return _0x199edd;};'use strict';module[_0xf27d('0x0')][0x194]=function pageNotFound(_0x8277c1,_0x1cbc01){var _0x1286f2=_0xf27d('0x1');var _0x5b58a4=0x194;var _0x381dbc={'status':_0x5b58a4};_0x1cbc01[_0xf27d('0x2')](_0x381dbc[_0xf27d('0x2')]);_0x1cbc01['render'](_0x1286f2,{},function(_0x3cf8c9,_0x50ef47){if(_0x3cf8c9){return _0x1cbc01[_0xf27d('0x2')](_0x381dbc[_0xf27d('0x2')])[_0xf27d('0x3')](_0x381dbc);}_0x1cbc01[_0xf27d('0x4')](_0x50ef47);});}; \ No newline at end of file +var _0xf2d0=['send','404','status','render','json'];(function(_0x3ba625,_0x25feaa){var _0x53b151=function(_0x3159e7){while(--_0x3159e7){_0x3ba625['push'](_0x3ba625['shift']());}};_0x53b151(++_0x25feaa);}(_0xf2d0,0x137));var _0x0f2d=function(_0x16e772,_0x592d80){_0x16e772=_0x16e772-0x0;var _0x5c9b11=_0xf2d0[_0x16e772];return _0x5c9b11;};'use strict';module['exports'][0x194]=function pageNotFound(_0x118153,_0x28a869){var _0x155898=_0x0f2d('0x0');var _0x19305c=0x194;var _0x444d5a={'status':_0x19305c};_0x28a869[_0x0f2d('0x1')](_0x444d5a[_0x0f2d('0x1')]);_0x28a869[_0x0f2d('0x2')](_0x155898,{},function(_0x57020c,_0x27e73f){if(_0x57020c){return _0x28a869[_0x0f2d('0x1')](_0x444d5a[_0x0f2d('0x1')])[_0x0f2d('0x3')](_0x444d5a);}_0x28a869[_0x0f2d('0x4')](_0x27e73f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 9098434..3dbc35c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2750=['VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','UserVoicePrefix','User','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','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','VoiceQueues','MailQueues','ChatQueues','UserChatQueue','FaxQueues','UserOpenchannelQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Dispositions','Interactions','Applications','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','Users','Attachments','Contact','Interaction','ChatOfflineMessageId','restrict','TagId','List','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','Answers','IntervalId','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelAccount','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','CompanyId','OpenchannelInteractions','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Action','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','DescriptionId','FieldId','Subject','SubjectId','Field','Subjects','Descriptions','Variable','VariableId','Description','ZendeskField','int_freshdesk_configuration_has_tags','FreshsalesConfiguration','FromId','SessionId','SmsQueueReport','ProjectId','JscriptyProject','team_has_chat_queues','team_has_sms_queues','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefixes','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','TeamVoicePrefix','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','options','database','import','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.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','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField'];(function(_0x3e9cca,_0x116e86){var _0x2efe97=function(_0x4e4f07){while(--_0x4e4f07){_0x3e9cca['push'](_0x3e9cca['shift']());}};_0x2efe97(++_0x116e86);}(_0x2750,0x13b));var _0x0275=function(_0xa2ca33,_0xcbbaa8){_0xa2ca33=_0xa2ca33-0x0;var _0x381175=_0x2750[_0xa2ca33];return _0x381175;};'use strict';var config=require(_0x0275('0x0'));var Sequelize=require('sequelize');var _=require(_0x0275('0x1'));var jstz=require(_0x0275('0x2'));var timezone=jstz[_0x0275('0x3')]();config[_0x0275('0x4')]=_[_0x0275('0x5')](config[_0x0275('0x4')],{'database':_0x0275('0x6'),'username':_0x0275('0x7'),'password':_0x0275('0x8'),'options':{'host':_0x0275('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0275('0xa')},'logging':![],'timezone':timezone[_0x0275('0xb')](),'define':{'charset':_0x0275('0xc'),'collate':_0x0275('0xd')}}});config['sequelizeHistory']=_[_0x0275('0x5')](config[_0x0275('0xe')],{'database':_0x0275('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x0275('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0275('0xa')},'logging':![],'timezone':timezone[_0x0275('0xb')](),'define':{'charset':_0x0275('0xc'),'collate':_0x0275('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0275('0x4')]['database'],config[_0x0275('0x4')][_0x0275('0xf')],config[_0x0275('0x4')]['password'],config['sequelize'][_0x0275('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0275('0xe')][_0x0275('0x11')],config[_0x0275('0xe')][_0x0275('0xf')],config[_0x0275('0xe')]['password'],config[_0x0275('0xe')][_0x0275('0x10')])};db['User']=db[_0x0275('0x4')][_0x0275('0x12')]('../api/user/user.model');db[_0x0275('0x13')]=db[_0x0275('0x4')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize']['import'](_0x0275('0x14'));db[_0x0275('0x15')]=db[_0x0275('0x4')]['import'](_0x0275('0x16'));db[_0x0275('0x17')]=db[_0x0275('0x4')]['import'](_0x0275('0x18'));db[_0x0275('0x19')]=db['sequelize']['import'](_0x0275('0x1a'));db[_0x0275('0x1b')]=db[_0x0275('0x4')]['import'](_0x0275('0x1c'));db['ScreenRecording']=db[_0x0275('0x4')]['import'](_0x0275('0x1d'));db[_0x0275('0x1e')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x1f'));db[_0x0275('0x20')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x21'));db[_0x0275('0x22')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x23'));db['VoiceDialReport']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x24'));db[_0x0275('0x25')]=db[_0x0275('0x4')]['import'](_0x0275('0x26'));db[_0x0275('0x27')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x28'));db['MemberReport']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x29'));db['Trunk']=db['sequelize'][_0x0275('0x12')](_0x0275('0x2a'));db['VoiceTransferReport']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x2b'));db[_0x0275('0x2c')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x2d'));db[_0x0275('0x2e')]=db[_0x0275('0x4')]['import'](_0x0275('0x2f'));db['UserChatQueue']=db[_0x0275('0x4')]['import'](_0x0275('0x30'));db[_0x0275('0x31')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x32'));db[_0x0275('0x33')]=db[_0x0275('0x4')]['import'](_0x0275('0x34'));db[_0x0275('0x35')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x36'));db['UserOpenchannelQueue']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x37'));db[_0x0275('0x38')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x39'));db[_0x0275('0x3a')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x3b'));db['MailServerOut']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x3c'));db[_0x0275('0x3d')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x3e'));db[_0x0275('0x3f')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x40'));db[_0x0275('0x41')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x0275('0x42')]=db[_0x0275('0x4')]['import'](_0x0275('0x43'));db[_0x0275('0x44')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x45'));db[_0x0275('0x46')]=db[_0x0275('0x4')]['import'](_0x0275('0x47'));db[_0x0275('0x48')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/mailQueueReport/mailQueueReport.model');db[_0x0275('0x49')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x4a'));db['DashboardItem']=db[_0x0275('0x4')]['import'](_0x0275('0x4b'));db[_0x0275('0x4c')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/faxAccount/faxAccount.model');db[_0x0275('0x4d')]=db[_0x0275('0x4')]['import'](_0x0275('0x4e'));db[_0x0275('0x4f')]=db[_0x0275('0x4')]['import'](_0x0275('0x50'));db[_0x0275('0x51')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x52'));db[_0x0275('0x53')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x54'));db[_0x0275('0x55')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x56'));db[_0x0275('0x57')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x58'));db[_0x0275('0x59')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x5a'));db[_0x0275('0x5b')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x5c'));db[_0x0275('0x5d')]=db['sequelize']['import'](_0x0275('0x5e'));db[_0x0275('0x5f')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x60'));db['OpenchannelAccount']=db[_0x0275('0x4')]['import'](_0x0275('0x61'));db[_0x0275('0x62')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x0275('0x63')]=db['sequelize']['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0275('0x64')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x65'));db[_0x0275('0x66')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x67'));db[_0x0275('0x68')]=db['sequelize'][_0x0275('0x12')]('../api/chatWebsite/chatWebsite.model');db[_0x0275('0x69')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x6a'));db[_0x0275('0x6b')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x6c'));db[_0x0275('0x6d')]=db[_0x0275('0x4')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0275('0x6e')]=db['sequelize']['import'](_0x0275('0x6f'));db[_0x0275('0x70')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x71'));db[_0x0275('0x72')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x73'));db[_0x0275('0x74')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x75'));db['ChatProactiveAction']=db[_0x0275('0x4')][_0x0275('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x0275('0x76')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x77'));db[_0x0275('0x78')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x79'));db[_0x0275('0x7a')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x7b'));db[_0x0275('0x7c')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x7d'));db[_0x0275('0x7e')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x7f'));db['CmHopperHistory']=db[_0x0275('0x4')]['import'](_0x0275('0x80'));db[_0x0275('0x81')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x0275('0x82')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x83'));db['Action']=db[_0x0275('0x4')][_0x0275('0x12')]('../api/action/action.model');db[_0x0275('0x84')]=db[_0x0275('0x4')]['import']('../api/automation/automation.model');db[_0x0275('0x85')]=db[_0x0275('0x4')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x0275('0x86')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x87'));db[_0x0275('0x88')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x89'));db['Interval']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x8a'));db[_0x0275('0x8b')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/pause/pause.model');db[_0x0275('0x8c')]=db['sequelize'][_0x0275('0x12')](_0x0275('0x8d'));db[_0x0275('0x8e')]=db[_0x0275('0x4')]['import'](_0x0275('0x8f'));db[_0x0275('0x90')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x91'));db[_0x0275('0x92')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x93'));db['Tag']=db['sequelize']['import'](_0x0275('0x94'));db[_0x0275('0x95')]=db[_0x0275('0x4')]['import'](_0x0275('0x96'));db[_0x0275('0x97')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x98'));db['Variable']=db[_0x0275('0x4')]['import'](_0x0275('0x99'));db[_0x0275('0x9a')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/integration/integration.model');db[_0x0275('0x9b')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/integrationReport/integrationReport.model');db[_0x0275('0x9c')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x9d'));db[_0x0275('0x9e')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x9f'));db['AnalyticExtractedReport']=db['sequelize']['import'](_0x0275('0xa0'));db[_0x0275('0xa1')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xa2'));db['AnalyticFieldReport']=db[_0x0275('0x4')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x0275('0xa3')]=db['sequelize'][_0x0275('0x12')](_0x0275('0xa4'));db[_0x0275('0xa5')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xa6'));db[_0x0275('0xa7')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xa8'));db[_0x0275('0xa9')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xaa'));db[_0x0275('0xab')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xac'));db[_0x0275('0xad')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x0275('0xae')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xaf'));db[_0x0275('0xb0')]=db[_0x0275('0x4')]['import'](_0x0275('0xb1'));db[_0x0275('0xb2')]=db['sequelize'][_0x0275('0x12')](_0x0275('0xb3'));db[_0x0275('0xb4')]=db[_0x0275('0x4')]['import'](_0x0275('0xb5'));db[_0x0275('0xb6')]=db['sequelize'][_0x0275('0x12')]('../api/intZohoAccount/intZohoAccount.model');db[_0x0275('0xb7')]=db[_0x0275('0x4')]['import'](_0x0275('0xb8'));db[_0x0275('0xb9')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xba'));db[_0x0275('0xbb')]=db[_0x0275('0x4')]['import'](_0x0275('0xbc'));db[_0x0275('0xbd')]=db['sequelize'][_0x0275('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x0275('0x4')]['import'](_0x0275('0xbe'));db[_0x0275('0xbf')]=db['sequelize'][_0x0275('0x12')](_0x0275('0xc0'));db[_0x0275('0xc1')]=db['sequelize'][_0x0275('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x0275('0xc2')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x0275('0xc3')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xc4'));db[_0x0275('0xc5')]=db[_0x0275('0x4')]['import'](_0x0275('0xc6'));db[_0x0275('0xc7')]=db[_0x0275('0x4')]['import'](_0x0275('0xc8'));db[_0x0275('0xc9')]=db[_0x0275('0x4')]['import'](_0x0275('0xca'));db[_0x0275('0xcb')]=db[_0x0275('0x4')]['import'](_0x0275('0xcc'));db[_0x0275('0xcd')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xce'));db[_0x0275('0xcf')]=db[_0x0275('0x4')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0275('0xd0')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xd1'));db[_0x0275('0xd2')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x0275('0xd3')]=db[_0x0275('0x4')]['import'](_0x0275('0xd4'));db['FreshsalesConfiguration']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xd5'));db[_0x0275('0xd6')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x0275('0x9a')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xd7'));db[_0x0275('0xd8')]=db[_0x0275('0x4')]['import'](_0x0275('0xd9'));db[_0x0275('0xda')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xdb'));db['ChatInternalMessage']=db[_0x0275('0x4')]['import'](_0x0275('0xdc'));db[_0x0275('0xdd')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xde'));db[_0x0275('0xdf')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xe0'));db[_0x0275('0xe1')]=db['sequelize'][_0x0275('0x12')](_0x0275('0xe2'));db['SmsQueueReport']=db[_0x0275('0x4')][_0x0275('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x0275('0xe3')]=db['sequelize'][_0x0275('0x12')](_0x0275('0xe4'));db[_0x0275('0xe5')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xe6'));db['JscriptyProject']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xe7'));db['Setting']=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xe8'));db[_0x0275('0xe9')]=db['sequelize'][_0x0275('0x12')](_0x0275('0xea'));db[_0x0275('0xeb')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/squareProject/squareProject.model');db[_0x0275('0xec')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xed'));db[_0x0275('0xee')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xef'));db[_0x0275('0xf0')]=db[_0x0275('0x4')]['import'](_0x0275('0xf1'));db[_0x0275('0xf2')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xf3'));db[_0x0275('0xf4')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xf5'));db[_0x0275('0xf6')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xf7'));db[_0x0275('0xf8')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xf9'));db[_0x0275('0xfa')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xfb'));db[_0x0275('0xfc')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0xfd'));db[_0x0275('0xfe')]=db['sequelize'][_0x0275('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x0275('0xff')]=db[_0x0275('0x4')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x0275('0x100')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x101'));db[_0x0275('0x102')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x103'));db[_0x0275('0x104')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/cmList/cmList.model');db[_0x0275('0x105')]=db[_0x0275('0x4')]['import'](_0x0275('0x106'));db[_0x0275('0x107')]=db['sequelize']['import'](_0x0275('0x108'));db[_0x0275('0x109')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x10a'));db[_0x0275('0x10b')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0275('0x10c')]=db[_0x0275('0x4')][_0x0275('0x12')]('../api/userNotification/userNotification.model');db[_0x0275('0x10d')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x10e'));db[_0x0275('0x10f')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x110'));db['WhatsappInteraction']=db['sequelize'][_0x0275('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x0275('0x111')]=db['sequelize']['import'](_0x0275('0x112'));db[_0x0275('0x113')]=db[_0x0275('0x4')][_0x0275('0x12')](_0x0275('0x114'));db[_0x0275('0x115')]=db['sequelize'][_0x0275('0x12')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x0275('0x116')]=db['sequelize']['import'](_0x0275('0x117'));db[_0x0275('0x118')]=db[_0x0275('0x4')]['import'](_0x0275('0x119'));db[_0x0275('0x11a')]=db[_0x0275('0x4')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db['sequelize'][_0x0275('0x12')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x0275('0x11b')]=db['sequelize'][_0x0275('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x0275('0x11c')][_0x0275('0x11d')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x1b')],{'as':'Recordings','foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db['UserVoiceQueueRt'],{'as':_0x0275('0x121'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x15')],{'as':_0x0275('0x122'),'onDelete':_0x0275('0x11e'),'hooks':!![]});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x7e')],{'as':_0x0275('0x123'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x124')],{'as':_0x0275('0x125'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x63')],{'as':'OpenchannelInteractions','foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x6d')],{'as':_0x0275('0x126'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x5b')],{'as':_0x0275('0x127'),'foreignKey':_0x0275('0x11f')});db['User'][_0x0275('0x120')](db[_0x0275('0x4f')],{'as':_0x0275('0x128'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x11c')][_0x0275('0x120')](db[_0x0275('0x42')],{'as':_0x0275('0x129'),'foreignKey':'UserId'});db['User'][_0x0275('0x120')](db[_0x0275('0x12a')],{'as':_0x0275('0x12b'),'foreignKey':'UserId'});db['User'][_0x0275('0x120')](db[_0x0275('0x10c')],{'as':_0x0275('0x12c'),'foreignKey':_0x0275('0x12d')});db[_0x0275('0x11c')][_0x0275('0x12e')](db[_0x0275('0x107')],{'as':_0x0275('0x107'),'foreignKey':_0x0275('0x12f')});db[_0x0275('0x11c')]['belongsToMany'](db['ChatGroup'],{'as':_0x0275('0x130'),'through':_0x0275('0x131')});db['User'][_0x0275('0x132')](db['CmContact'],{'as':_0x0275('0x133'),'through':'cm_user_has_contacts'});db[_0x0275('0x11c')][_0x0275('0x132')](db['CmList'],{'as':_0x0275('0x134'),'through':_0x0275('0x135')});db[_0x0275('0x11c')][_0x0275('0x132')](db['Team'],{'through':_0x0275('0x136')});db[_0x0275('0x11c')]['belongsToMany'](db['MailInteraction'],{'as':_0x0275('0x129'),'through':_0x0275('0x137')});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x6d')],{'as':_0x0275('0x126'),'through':_0x0275('0x138')});db['User']['belongsToMany'](db['FaxInteraction'],{'as':_0x0275('0x128'),'through':_0x0275('0x139')});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x5b')],{'as':_0x0275('0x127'),'through':_0x0275('0x13a')});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x63')],{'as':'OpenchannelInteractions','through':_0x0275('0x13b')});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x12a')],{'as':_0x0275('0x12b'),'through':_0x0275('0x13c')});db['User']['belongsToMany'](db[_0x0275('0x19')],{'as':_0x0275('0x13d'),'through':_0x0275('0x2e'),'required':![]});db[_0x0275('0x11c')]['belongsToMany'](db[_0x0275('0x105')],{'as':'VoicePrefixes','through':_0x0275('0x11b'),'required':![]});db['User'][_0x0275('0x132')](db[_0x0275('0x3f')],{'as':_0x0275('0x13e'),'through':_0x0275('0x31'),'required':![]});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x72')],{'as':_0x0275('0x13f'),'through':_0x0275('0x140'),'required':![],'hooks':!![]});db['User'][_0x0275('0x132')](db['FaxQueue'],{'as':_0x0275('0x141'),'through':'UserFaxQueue','required':![]});db[_0x0275('0x11c')]['belongsToMany'](db[_0x0275('0x5f')],{'as':'SmsQueues','through':_0x0275('0x35'),'required':![]});db[_0x0275('0x11c')]['belongsToMany'](db[_0x0275('0x66')],{'as':'OpenchannelQueues','through':_0x0275('0x142'),'required':![]});db['User'][_0x0275('0x132')](db[_0x0275('0x116')],{'as':'WhatsappQueues','through':_0x0275('0x38'),'required':![]});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x104')],{'through':_0x0275('0x135')});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x68')],{'as':_0x0275('0x143'),'through':_0x0275('0x144')});db['User'][_0x0275('0x132')](db['FaxAccount'],{'as':_0x0275('0x145'),'through':_0x0275('0x146')});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x3d')],{'as':'MailAccounts','through':_0x0275('0x147')});db['User'][_0x0275('0x132')](db['OpenchannelAccount'],{'as':_0x0275('0x148'),'through':'user_has_openchannel_accounts'});db['User'][_0x0275('0x132')](db[_0x0275('0x57')],{'as':_0x0275('0x149'),'through':_0x0275('0x14a')});db[_0x0275('0x11c')][_0x0275('0x132')](db[_0x0275('0x10d')],{'as':_0x0275('0x14b'),'through':_0x0275('0x14c')});db[_0x0275('0x11c')]['belongsToMany'](db[_0x0275('0xeb')],{'as':_0x0275('0x14d'),'through':_0x0275('0x14e')});db[_0x0275('0x13')][_0x0275('0x120')](db['VoiceExtension'],{'as':_0x0275('0x14f'),'onDelete':'cascade','foreignKey':_0x0275('0x150')});db[_0x0275('0x151')][_0x0275('0x120')](db[_0x0275('0x15')],{'onDelete':_0x0275('0x11e')});db[_0x0275('0x15')]['hasMany'](db[_0x0275('0x15')],{'as':'Applications','onDelete':_0x0275('0x11e')});db['VoiceMusicOnHold'][_0x0275('0x132')](db[_0x0275('0x92')],{'as':_0x0275('0x152'),'through':_0x0275('0x153')});db['VoiceQueue'][_0x0275('0x120')](db[_0x0275('0x2c')],{'as':_0x0275('0x154'),'foreignKey':_0x0275('0x155')});db[_0x0275('0x19')]['hasMany'](db['CmHopper'],{'as':_0x0275('0x156'),'foreignKey':_0x0275('0x155')});db[_0x0275('0x19')]['hasMany'](db[_0x0275('0x7e')],{'as':_0x0275('0x123'),'foreignKey':_0x0275('0x155')});db['VoiceQueue'][_0x0275('0x120')](db[_0x0275('0x124')],{'as':_0x0275('0x157'),'foreignKey':_0x0275('0x155')});db[_0x0275('0x19')][_0x0275('0x120')](db[_0x0275('0x81')],{'as':_0x0275('0x81'),'foreignKey':_0x0275('0x155')});db[_0x0275('0x19')]['hasMany'](db[_0x0275('0x7c')],{'as':'HopperBlacks','foreignKey':_0x0275('0x155')});db[_0x0275('0x19')][_0x0275('0x120')](db['JscriptySessionReport'],{'as':_0x0275('0x158'),'foreignKey':_0x0275('0x155')});db[_0x0275('0x19')]['belongsTo'](db[_0x0275('0x159')],{'as':'Trunk','foreignKey':_0x0275('0x15a')});db[_0x0275('0x19')][_0x0275('0x12e')](db[_0x0275('0x159')],{'as':_0x0275('0x15b'),'foreignKey':_0x0275('0x15c')});db[_0x0275('0x19')]['belongsTo'](db[_0x0275('0x15d')],{'as':_0x0275('0x15d'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x0275('0x12e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0275('0x15e')});db[_0x0275('0x19')][_0x0275('0x132')](db[_0x0275('0x104')],{'as':_0x0275('0x134'),'through':_0x0275('0x15f')});db[_0x0275('0x19')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':_0x0275('0x2e')});db[_0x0275('0x19')][_0x0275('0x132')](db[_0x0275('0xf0')],{'as':_0x0275('0x161'),'through':'TeamVoiceQueue'});db[_0x0275('0x19')][_0x0275('0x132')](db[_0x0275('0x104')],{'as':_0x0275('0x162'),'through':_0x0275('0x163')});db['VoiceRecording']['belongsTo'](db[_0x0275('0x11c')],{'as':_0x0275('0x11c'),'foreignKey':_0x0275('0x11f')});db['ScreenRecording'][_0x0275('0x12e')](db['User'],{'as':_0x0275('0x11c'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x1e')]['hasMany'](db[_0x0275('0x20')],{'as':_0x0275('0x164'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x0275('0x165')});db[_0x0275('0x20')][_0x0275('0x12e')](db['VoiceMail'],{'foreignKey':_0x0275('0x166'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x0275('0x120')](db[_0x0275('0x27')],{'as':_0x0275('0x167'),'foreignKey':_0x0275('0x168'),'constraints':![]});db[_0x0275('0x22')][_0x0275('0x120')](db[_0x0275('0x25')],{'as':_0x0275('0x169'),'foreignKey':'uniqueid','constraints':![]});db[_0x0275('0x22')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x11c'),'foreignKey':'UserId'});db['VoiceCallReport'][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':'Contact','foreignKey':_0x0275('0x16a')});db[_0x0275('0x3a')][_0x0275('0x12e')](db[_0x0275('0x3d')],{'as':_0x0275('0x3d'),'foreignKey':_0x0275('0x16b')});db[_0x0275('0x16c')][_0x0275('0x12e')](db[_0x0275('0x3d')],{'as':_0x0275('0x3d'),'foreignKey':_0x0275('0x16b')});db[_0x0275('0x3d')][_0x0275('0x11d')](db[_0x0275('0x3a')],{'as':_0x0275('0x16d'),'onDelete':_0x0275('0x11e')});db['MailAccount']['hasOne'](db[_0x0275('0x16c')],{'as':_0x0275('0x16e'),'onDelete':'cascade'});db[_0x0275('0x3d')][_0x0275('0x120')](db[_0x0275('0x86')],{'as':_0x0275('0x16f'),'foreignKey':_0x0275('0x16b'),'onDelete':_0x0275('0x11e')});db['MailAccount'][_0x0275('0x120')](db[_0x0275('0x85')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x0275('0x3d')][_0x0275('0x120')](db['MailMessage'],{'as':'Messages','foreignKey':_0x0275('0x16b')});db['MailAccount'][_0x0275('0x120')](db[_0x0275('0x42')],{'as':_0x0275('0x170')});db[_0x0275('0x3d')]['hasMany'](db[_0x0275('0x46')],{'as':_0x0275('0x171')});db[_0x0275('0x3d')]['belongsTo'](db[_0x0275('0x104')],{'as':'List','foreignKey':_0x0275('0x172')});db[_0x0275('0x3d')][_0x0275('0x12e')](db['Template'],{'as':_0x0275('0x95'),'foreignKey':_0x0275('0x173')});db[_0x0275('0x3d')][_0x0275('0x12e')](db[_0x0275('0x8b')],{'as':_0x0275('0x174'),'foreignKey':_0x0275('0x15e')});db[_0x0275('0x3d')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':'user_has_mail_accounts'});db[_0x0275('0x3f')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':'UserMailQueue'});db[_0x0275('0x3f')][_0x0275('0x132')](db[_0x0275('0xf0')],{'through':_0x0275('0x175'),'as':'Teams'});db[_0x0275('0x42')][_0x0275('0x120')](db[_0x0275('0x44')],{'as':'Messages','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x176')});db[_0x0275('0x42')][_0x0275('0x12e')](db[_0x0275('0x3d')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x16b')});db[_0x0275('0x42')][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':'Contact','foreignKey':_0x0275('0x16a')});db[_0x0275('0x42')]['belongsTo'](db[_0x0275('0x11c')],{'as':_0x0275('0x178'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x42')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x17a'),'as':_0x0275('0x17b')});db[_0x0275('0x42')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x0275('0x42')]['belongsToMany'](db[_0x0275('0x11c')],{'as':_0x0275('0x17c'),'through':_0x0275('0x137'),'foreignKey':_0x0275('0x176')});db['MailMessage'][_0x0275('0x120')](db[_0x0275('0xf8')],{'as':_0x0275('0x17d'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x44')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x11c')});db[_0x0275('0x44')][_0x0275('0x12e')](db[_0x0275('0x78')],{'onDelete':'cascade','as':_0x0275('0x17e')});db[_0x0275('0x44')][_0x0275('0x12e')](db['MailInteraction'],{'as':_0x0275('0x17f'),'foreignKey':_0x0275('0x176')});db[_0x0275('0x44')]['belongsTo'](db[_0x0275('0x3d')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x16b')});db['MailMessage'][_0x0275('0x12e')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x0275('0x44')][_0x0275('0x12e')](db['ChatOfflineMessage'],{'as':_0x0275('0x70'),'foreignKey':_0x0275('0x180')});db[_0x0275('0x46')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x181')});db[_0x0275('0x46')][_0x0275('0x12e')](db[_0x0275('0x3f')],{'onDelete':'restrict'});db[_0x0275('0x46')][_0x0275('0x12e')](db[_0x0275('0x3d')],{'onDelete':_0x0275('0x181')});db[_0x0275('0x46')][_0x0275('0x12e')](db[_0x0275('0x15d')],{'onDelete':_0x0275('0x181'),'foreignKey':'IntervalId'});db['MailApplication'][_0x0275('0x12e')](db[_0x0275('0x179')],{'onDelete':_0x0275('0x181'),'foreignKey':_0x0275('0x182')});db[_0x0275('0x48')][_0x0275('0x12e')](db[_0x0275('0x3d')],{});db['MailQueueReport'][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':'ListId'});db[_0x0275('0x48')][_0x0275('0x12e')](db['CmContact'],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db['MailQueueReport'][_0x0275('0x12e')](db[_0x0275('0x42')],{});db[_0x0275('0x48')]['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0x0275('0x12e')](db[_0x0275('0x11c')],{});db[_0x0275('0x48')][_0x0275('0x12e')](db[_0x0275('0x3f')],{});db[_0x0275('0x49')][_0x0275('0x120')](db[_0x0275('0x184')],{'as':_0x0275('0x185'),'onDelete':'cascade'});db[_0x0275('0x4c')]['hasMany'](db[_0x0275('0x86')],{'as':_0x0275('0x16f'),'foreignKey':_0x0275('0x186'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x4c')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x0275('0x186')});db[_0x0275('0x4c')][_0x0275('0x120')](db[_0x0275('0x4f')],{'as':_0x0275('0x170')});db[_0x0275('0x4c')][_0x0275('0x120')](db[_0x0275('0x4d')],{'as':_0x0275('0x171')});db[_0x0275('0x4c')]['hasMany'](db[_0x0275('0x15')],{'as':_0x0275('0x187'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x4c')][_0x0275('0x120')](db[_0x0275('0x51')],{'as':_0x0275('0x164')});db['FaxAccount'][_0x0275('0x12e')](db[_0x0275('0x159')],{'as':_0x0275('0x159')});db[_0x0275('0x4c')][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x4c')][_0x0275('0x12e')](db['Pause'],{'as':_0x0275('0x174'),'foreignKey':_0x0275('0x15e')});db['FaxAccount'][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':_0x0275('0x146')});db[_0x0275('0x4d')][_0x0275('0x12e')](db['User'],{'onDelete':_0x0275('0x181')});db['FaxApplication'][_0x0275('0x12e')](db[_0x0275('0x53')],{'onDelete':_0x0275('0x181')});db[_0x0275('0x4d')][_0x0275('0x12e')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x0275('0x4d')]['belongsTo'](db[_0x0275('0x179')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x0275('0x4f')][_0x0275('0x120')](db[_0x0275('0x51')],{'as':_0x0275('0x164'),'onDelete':_0x0275('0x11e'),'foreignKey':'FaxInteractionId'});db[_0x0275('0x4f')][_0x0275('0x12e')](db[_0x0275('0x4c')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x0275('0x4f')][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x4f')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x178'),'foreignKey':_0x0275('0x11f')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0x0275('0x188'),'as':_0x0275('0x17b')});db[_0x0275('0x4f')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x188'),'as':_0x0275('0x189')});db[_0x0275('0x4f')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':'Users','through':_0x0275('0x139'),'foreignKey':_0x0275('0x18a')});db[_0x0275('0x51')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x11c')});db['FaxMessage']['belongsTo'](db[_0x0275('0x4f')],{'as':_0x0275('0x17f'),'foreignKey':_0x0275('0x18a')});db[_0x0275('0x51')]['belongsTo'](db[_0x0275('0x78')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x17e')});db['FaxMessage'][_0x0275('0x12e')](db[_0x0275('0xf8')],{'as':_0x0275('0xf8'),'foreignKey':_0x0275('0x18b')});db[_0x0275('0x51')][_0x0275('0x12e')](db[_0x0275('0x4c')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x186')});db['FaxQueue'][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':_0x0275('0x33')});db[_0x0275('0x53')]['belongsToMany'](db[_0x0275('0xf0')],{'through':_0x0275('0x18c'),'as':_0x0275('0x161')});db[_0x0275('0x55')][_0x0275('0x12e')](db[_0x0275('0x4c')],{});db[_0x0275('0x55')][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x55')][_0x0275('0x12e')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x0275('0x55')][_0x0275('0x12e')](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db[_0x0275('0x51')],{});db[_0x0275('0x55')][_0x0275('0x12e')](db[_0x0275('0x11c')],{});db[_0x0275('0x55')][_0x0275('0x12e')](db[_0x0275('0x53')],{});db[_0x0275('0x57')][_0x0275('0x120')](db[_0x0275('0x86')],{'as':_0x0275('0x16f'),'foreignKey':_0x0275('0x18d'),'onDelete':'cascade'});db[_0x0275('0x57')][_0x0275('0x120')](db['CannedAnswer'],{'as':_0x0275('0x18e'),'foreignKey':'SmsAccountId'});db[_0x0275('0x57')][_0x0275('0x120')](db[_0x0275('0x5d')],{'as':_0x0275('0x164'),'foreignKey':_0x0275('0x18d')});db[_0x0275('0x57')]['hasMany'](db[_0x0275('0x5b')],{'as':'Interactions'});db[_0x0275('0x57')][_0x0275('0x120')](db[_0x0275('0x59')],{'as':_0x0275('0x171')});db['SmsAccount'][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x57')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0275('0x15e')});db['SmsAccount'][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':_0x0275('0x14a')});db['SmsApplication'][_0x0275('0x12e')](db['User'],{'onDelete':'restrict'});db[_0x0275('0x59')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x0275('0x181')});db[_0x0275('0x59')]['belongsTo'](db['SmsAccount'],{'onDelete':_0x0275('0x181')});db[_0x0275('0x59')][_0x0275('0x12e')](db[_0x0275('0x15d')],{'onDelete':_0x0275('0x181'),'foreignKey':_0x0275('0x18f')});db[_0x0275('0x59')][_0x0275('0x12e')](db[_0x0275('0x179')],{'onDelete':_0x0275('0x181'),'foreignKey':_0x0275('0x182')});db[_0x0275('0x5b')][_0x0275('0x120')](db[_0x0275('0x5d')],{'as':'Messages','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x190')});db['SmsInteraction'][_0x0275('0x12e')](db[_0x0275('0x57')],{'as':'Account','foreignKey':_0x0275('0x18d')});db[_0x0275('0x5b')]['belongsTo'](db['CmContact'],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x5b')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x178'),'foreignKey':_0x0275('0x11f')});db['SmsInteraction'][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x191'),'as':'Tags'});db[_0x0275('0x5b')][_0x0275('0x132')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x0275('0x189')});db['SmsInteraction'][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x17c'),'through':'user_has_sms_interactions','foreignKey':_0x0275('0x190')});db[_0x0275('0x5d')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':'User'});db[_0x0275('0x5d')][_0x0275('0x12e')](db[_0x0275('0x78')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x17e')});db[_0x0275('0x5d')]['belongsTo'](db[_0x0275('0x5b')],{'onDelete':_0x0275('0x11e'),'as':'Interaction','foreignKey':_0x0275('0x190')});db['SmsMessage'][_0x0275('0x12e')](db[_0x0275('0x57')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x18d')});db[_0x0275('0x5f')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x0275('0x5f')][_0x0275('0x132')](db[_0x0275('0xf0')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount'][_0x0275('0x120')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x0275('0x192'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x193')][_0x0275('0x120')](db[_0x0275('0x85')],{'as':_0x0275('0x18e'),'foreignKey':_0x0275('0x192')});db[_0x0275('0x193')]['hasMany'](db[_0x0275('0x63')],{'as':_0x0275('0x170'),'foreignKey':_0x0275('0x192')});db['OpenchannelAccount']['hasMany'](db[_0x0275('0x64')],{'as':_0x0275('0x164'),'foreignKey':_0x0275('0x192')});db[_0x0275('0x193')][_0x0275('0x120')](db['OpenchannelApplication'],{'as':_0x0275('0x171'),'foreignKey':_0x0275('0x192')});db[_0x0275('0x193')][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':'List','foreignKey':'ListId'});db[_0x0275('0x193')][_0x0275('0x12e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0275('0x15e')});db['OpenchannelAccount'][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':'Agents','through':_0x0275('0x194')});db['OpenchannelApplication']['belongsTo'](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x181')});db[_0x0275('0x62')][_0x0275('0x12e')](db['OpenchannelQueue'],{'onDelete':_0x0275('0x181'),'foreignKey':_0x0275('0x195')});db[_0x0275('0x62')][_0x0275('0x12e')](db[_0x0275('0x193')],{'onDelete':_0x0275('0x181'),'foreignKey':'OpenchannelAccountId'});db[_0x0275('0x62')][_0x0275('0x12e')](db[_0x0275('0x15d')],{'onDelete':_0x0275('0x181'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x0275('0x12e')](db[_0x0275('0x179')],{'onDelete':'restrict','foreignKey':_0x0275('0x182')});db[_0x0275('0x63')]['hasMany'](db[_0x0275('0x64')],{'as':_0x0275('0x164'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x196')});db[_0x0275('0x63')][_0x0275('0x12e')](db[_0x0275('0x193')],{'as':'Account','foreignKey':_0x0275('0x192')});db[_0x0275('0x63')][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db['OpenchannelInteraction']['belongsTo'](db[_0x0275('0x11c')],{'as':_0x0275('0x178'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x63')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x197'),'as':_0x0275('0x17b')});db[_0x0275('0x63')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x197'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x17c'),'through':'user_has_openchannel_interactions','foreignKey':_0x0275('0x196')});db[_0x0275('0x64')]['belongsTo'](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x11c')});db[_0x0275('0x64')][_0x0275('0x12e')](db[_0x0275('0x78')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x17e')});db['OpenchannelMessage'][_0x0275('0x12e')](db[_0x0275('0x63')],{'onDelete':_0x0275('0x11e'),'as':'Interaction','foreignKey':_0x0275('0x196')});db[_0x0275('0x64')]['belongsTo'](db[_0x0275('0xf8')],{'as':_0x0275('0xf8'),'foreignKey':_0x0275('0x18b')});db[_0x0275('0x64')][_0x0275('0x12e')](db[_0x0275('0x193')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x192')});db[_0x0275('0x66')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x0275('0x195')});db['OpenchannelQueue'][_0x0275('0x132')](db[_0x0275('0xf0')],{'through':_0x0275('0x198'),'as':_0x0275('0x161')});db[_0x0275('0x68')][_0x0275('0x120')](db[_0x0275('0x86')],{'as':_0x0275('0x16f'),'foreignKey':_0x0275('0x199'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x68')]['hasMany'](db[_0x0275('0x85')],{'as':_0x0275('0x18e'),'foreignKey':_0x0275('0x199')});db[_0x0275('0x68')]['hasMany'](db[_0x0275('0x19a')],{'as':_0x0275('0x19b')});db['ChatWebsite'][_0x0275('0x120')](db[_0x0275('0x6d')],{'as':_0x0275('0x170')});db[_0x0275('0x68')][_0x0275('0x120')](db['ChatApplication'],{'as':'Applications'});db['ChatWebsite']['hasMany'](db['ChatMessage'],{'as':_0x0275('0x164')});db['ChatWebsite'][_0x0275('0x12e')](db['CmList'],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x68')][_0x0275('0x12e')](db[_0x0275('0x15d')],{'as':_0x0275('0x15d'),'foreignKey':'IntervalId'});db[_0x0275('0x68')][_0x0275('0x12e')](db[_0x0275('0x3d')],{'as':'MailAccount','foreignKey':_0x0275('0x16b')});db['ChatWebsite'][_0x0275('0x12e')](db[_0x0275('0x8b')],{'as':_0x0275('0x174'),'foreignKey':_0x0275('0x15e')});db['ChatWebsite'][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':_0x0275('0x144')});db[_0x0275('0x69')][_0x0275('0x12e')](db[_0x0275('0x193')],{});db[_0x0275('0x69')][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db['OpenchannelQueueReport'][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db['OpenchannelQueueReport']['belongsTo'](db[_0x0275('0x63')],{});db[_0x0275('0x69')]['belongsTo'](db[_0x0275('0x64')],{});db[_0x0275('0x69')][_0x0275('0x12e')](db[_0x0275('0x11c')],{});db[_0x0275('0x69')][_0x0275('0x12e')](db[_0x0275('0x66')],{});db[_0x0275('0x6b')][_0x0275('0x12e')](db['User'],{'as':_0x0275('0x19c'),'foreignKey':_0x0275('0x11f'),'onDelete':_0x0275('0x181')});db['ChatApplication'][_0x0275('0x12e')](db['ChatQueue'],{'as':_0x0275('0x19d'),'foreignKey':'ChatQueueId','onDelete':_0x0275('0x181')});db[_0x0275('0x6b')][_0x0275('0x12e')](db['ChatWebsite'],{'as':_0x0275('0x19e'),'foreignKey':_0x0275('0x199'),'onDelete':_0x0275('0x181')});db[_0x0275('0x6b')]['belongsTo'](db['Tag'],{'onDelete':_0x0275('0x181'),'foreignKey':_0x0275('0x182')});db[_0x0275('0x6d')][_0x0275('0x120')](db['ChatMessage'],{'as':'Messages','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x19f')});db[_0x0275('0x6d')][_0x0275('0x12e')](db[_0x0275('0x68')],{'as':_0x0275('0x177'),'foreignKey':'ChatWebsiteId'});db[_0x0275('0x6d')][_0x0275('0x12e')](db['CmContact'],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x6d')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x178'),'foreignKey':_0x0275('0x11f')});db['ChatInteraction'][_0x0275('0x132')](db[_0x0275('0x179')],{'through':'chat_interaction_has_tags','as':_0x0275('0x17b')});db[_0x0275('0x6d')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x1a0'),'as':_0x0275('0x189')});db[_0x0275('0x6d')]['belongsToMany'](db[_0x0275('0x11c')],{'as':_0x0275('0x17c'),'through':_0x0275('0x138'),'foreignKey':'ChatInteractionId'});db[_0x0275('0x6e')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x11c')});db[_0x0275('0x6e')][_0x0275('0x12e')](db[_0x0275('0x78')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x6e')][_0x0275('0x12e')](db[_0x0275('0x6d')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x17f'),'foreignKey':_0x0275('0x19f')});db[_0x0275('0x6e')]['belongsTo'](db['Attachment'],{'as':_0x0275('0xf8'),'foreignKey':_0x0275('0x18b')});db[_0x0275('0x6e')][_0x0275('0x12e')](db['ChatWebsite'],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x199')});db[_0x0275('0x70')][_0x0275('0x120')](db[_0x0275('0xf8')],{'as':_0x0275('0x17d'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x0275('0x11e'),'hooks':!![]});db[_0x0275('0x70')][_0x0275('0x12e')](db[_0x0275('0x78')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x17e'),'foreignKey':'ContactId'});db[_0x0275('0x70')][_0x0275('0x12e')](db[_0x0275('0x68')],{'as':'Account','foreignKey':_0x0275('0x199')});db[_0x0275('0x72')][_0x0275('0x132')](db['User'],{'as':'Agents','through':_0x0275('0x140'),'hooks':!![]});db[_0x0275('0x72')]['belongsToMany'](db[_0x0275('0xf0')],{'through':'team_has_chat_queues','as':_0x0275('0x161')});db[_0x0275('0x74')][_0x0275('0x120')](db[_0x0275('0x1a1')],{'as':'Messages','foreignKey':_0x0275('0x1a2'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x74')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x154'),'through':_0x0275('0x131')});db[_0x0275('0x19a')][_0x0275('0x12e')](db[_0x0275('0x68')],{'as':_0x0275('0x19e'),'foreignKey':_0x0275('0x199')});db[_0x0275('0x76')][_0x0275('0x120')](db[_0x0275('0x78')],{'as':_0x0275('0x133'),'foreignKey':_0x0275('0x1a3')});db[_0x0275('0x78')][_0x0275('0x120')](db[_0x0275('0x7a')],{'as':_0x0275('0x156'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x78')][_0x0275('0x120')](db['CmHopperFinal'],{'as':_0x0275('0x123'),'foreignKey':_0x0275('0x16a')});db['CmContact'][_0x0275('0x120')](db[_0x0275('0x124')],{'as':_0x0275('0x157'),'foreignKey':_0x0275('0x16a')});db['CmContact'][_0x0275('0x120')](db[_0x0275('0x81')],{'as':_0x0275('0x81'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x78')][_0x0275('0x120')](db[_0x0275('0xe1')],{'as':_0x0275('0x158'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x78')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x0275('0x1a4'),'foreignKey':'ContactId','onDelete':_0x0275('0x181')});db[_0x0275('0x78')][_0x0275('0x120')](db[_0x0275('0x6d')],{'as':_0x0275('0x126'),'foreignKey':'ContactId','onDelete':_0x0275('0x181')});db[_0x0275('0x78')][_0x0275('0x120')](db['SmsInteraction'],{'as':_0x0275('0x127'),'foreignKey':_0x0275('0x16a'),'onDelete':_0x0275('0x181')});db[_0x0275('0x78')]['hasMany'](db[_0x0275('0x4f')],{'as':_0x0275('0x128'),'foreignKey':_0x0275('0x16a'),'onDelete':_0x0275('0x181')});db[_0x0275('0x78')]['hasMany'](db[_0x0275('0x42')],{'as':'MailInteractions','foreignKey':_0x0275('0x16a'),'onDelete':_0x0275('0x181')});db['CmContact'][_0x0275('0x12e')](db[_0x0275('0x76')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x78')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x17c'),'through':_0x0275('0x1a5')});db[_0x0275('0x78')]['belongsToMany'](db['Tag'],{'as':_0x0275('0x17b'),'through':_0x0275('0x1a6')});db[_0x0275('0x78')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x1a6'),'as':_0x0275('0x189')});db[_0x0275('0x7a')]['belongsTo'](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a'),'onDelete':'cascade'});db[_0x0275('0x7a')]['belongsTo'](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x7a')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x19c'),'foreignKey':_0x0275('0x11f')});db[_0x0275('0x7a')][_0x0275('0x12e')](db[_0x0275('0x19')],{'as':_0x0275('0x19d'),'foreignKey':_0x0275('0x155'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x7a')]['belongsTo'](db[_0x0275('0xf4')],{'as':'Campaign','foreignKey':_0x0275('0x1a7'),'onDelete':_0x0275('0x11e')});db['CmHopper'][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x178'),'foreignKey':_0x0275('0x1a8')});db[_0x0275('0x7c')][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a'),'onDelete':_0x0275('0x11e')});db['CmHopperBlack'][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopperBlack'][_0x0275('0x12e')](db[_0x0275('0x19')],{'as':_0x0275('0x19d'),'foreignKey':_0x0275('0x155'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x7c')][_0x0275('0x12e')](db[_0x0275('0xf4')],{'as':_0x0275('0xf4'),'foreignKey':_0x0275('0x1a7'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x84')][_0x0275('0x120')](db['Condition'],{'as':{'plural':_0x0275('0x1a9'),'singular':_0x0275('0x1aa')},'foreignKey':'AutomationAllId','onDelete':_0x0275('0x11e'),'hooks':!![]});db[_0x0275('0x84')]['hasMany'](db['Condition'],{'as':{'plural':_0x0275('0x1ab'),'singular':_0x0275('0x1ac')},'foreignKey':_0x0275('0x1ad'),'onDelete':_0x0275('0x11e'),'hooks':!![]});db['Automation'][_0x0275('0x120')](db['Action'],{'as':_0x0275('0x1ae'),'foreignKey':_0x0275('0x1af'),'onDelete':_0x0275('0x11e'),'hooks':!![]});db[_0x0275('0x86')][_0x0275('0x120')](db[_0x0275('0x86')],{'as':_0x0275('0x16f'),'foreignKey':_0x0275('0x1b0'),'onDelete':_0x0275('0x11e')});db['Interval'][_0x0275('0x120')](db[_0x0275('0x15d')],{'as':_0x0275('0x1b1'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x0275('0x15d')][_0x0275('0x120')](db[_0x0275('0x15')],{'as':_0x0275('0x122'),'foreignKey':_0x0275('0x18f'),'onDelete':_0x0275('0x181')});db[_0x0275('0x15d')][_0x0275('0x120')](db[_0x0275('0x46')],{'as':_0x0275('0x1b2'),'foreignKey':'IntervalId'});db[_0x0275('0x15d')][_0x0275('0x120')](db[_0x0275('0x6b')],{'as':_0x0275('0x1b3'),'foreignKey':_0x0275('0x18f')});db[_0x0275('0x15d')][_0x0275('0x120')](db[_0x0275('0x4d')],{'as':_0x0275('0x1b4'),'foreignKey':_0x0275('0x18f')});db[_0x0275('0x15d')]['hasMany'](db[_0x0275('0x59')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x0275('0x90')][_0x0275('0x12e')](db['MailAccount'],{});db[_0x0275('0x90')][_0x0275('0x12e')](db['AnalyticDefaultReport'],{'foreignKey':_0x0275('0x1b5')});db[_0x0275('0x90')]['belongsTo'](db[_0x0275('0x9c')],{'foreignKey':_0x0275('0x1b6')});db[_0x0275('0x92')][_0x0275('0x132')](db[_0x0275('0x17')],{'as':'Mohs','through':_0x0275('0x153'),'onDelete':_0x0275('0x181')});db[_0x0275('0x179')][_0x0275('0x132')](db[_0x0275('0x78')],{'through':_0x0275('0x1a6')});db[_0x0275('0x179')][_0x0275('0x132')](db[_0x0275('0x6d')],{'through':_0x0275('0x1a0')});db[_0x0275('0x179')][_0x0275('0x132')](db['MailInteraction'],{'through':_0x0275('0x17a')});db['Tag'][_0x0275('0x132')](db[_0x0275('0x5b')],{'through':_0x0275('0x191')});db[_0x0275('0x179')][_0x0275('0x132')](db[_0x0275('0x4f')],{'through':_0x0275('0x188')});db[_0x0275('0x179')][_0x0275('0x132')](db[_0x0275('0x63')],{'through':_0x0275('0x197')});db['Tag'][_0x0275('0x132')](db[_0x0275('0x12a')],{'through':_0x0275('0x1b7')});db['Trigger'][_0x0275('0x120')](db[_0x0275('0x88')],{'as':{'plural':_0x0275('0x1b8'),'singular':_0x0275('0x1b9')},'foreignKey':_0x0275('0x1ba'),'onDelete':_0x0275('0x11e'),'hooks':!![]});db['Trigger'][_0x0275('0x120')](db['Condition'],{'as':{'plural':_0x0275('0x1bb'),'singular':_0x0275('0x1bc')},'foreignKey':_0x0275('0x1bd'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x0275('0x120')](db[_0x0275('0x1be')],{'as':_0x0275('0x1ae'),'foreignKey':_0x0275('0x1bf'),'onDelete':_0x0275('0x11e'),'hooks':!![]});db[_0x0275('0x9c')][_0x0275('0x120')](db[_0x0275('0x1c0')],{'as':_0x0275('0x1c1'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1b6'),'hooks':!![]});db[_0x0275('0x9e')][_0x0275('0x120')](db[_0x0275('0x1c0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x0275('0x1b5')});db[_0x0275('0xa1')]['hasMany'](db[_0x0275('0x1c0')],{'as':_0x0275('0x1c1'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c2')});db[_0x0275('0x1c0')][_0x0275('0x12e')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x0275('0x120')](db['SalesforceConfiguration'],{'as':_0x0275('0x1c3'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xa7')]['hasMany'](db['SalesforceField'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0275('0xa7')]['hasMany'](db[_0x0275('0xa9')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x0275('0x1c5')});db[_0x0275('0xa7')]['hasMany'](db['SalesforceField'],{'as':_0x0275('0x1c1'),'onDelete':'cascade','foreignKey':_0x0275('0x1c6')});db[_0x0275('0xa7')]['belongsTo'](db[_0x0275('0xa5')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xa9')][_0x0275('0x120')](db[_0x0275('0xa9')],{'as':_0x0275('0x1c7'),'foreignKey':_0x0275('0x1c8')});db['SalesforceField'][_0x0275('0x120')](db[_0x0275('0xa9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0275('0xa9')][_0x0275('0x120')](db[_0x0275('0xa9')],{'as':_0x0275('0x1c9'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xa9')][_0x0275('0x12e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['SugarcrmAccount']['hasMany'](db[_0x0275('0xad')],{'as':_0x0275('0x1c3'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xad')][_0x0275('0x120')](db[_0x0275('0xae')],{'as':_0x0275('0x1ca'),'onDelete':_0x0275('0x11e'),'foreignKey':'SubjectId'});db[_0x0275('0xad')]['hasMany'](db[_0x0275('0xae')],{'as':_0x0275('0x1cb'),'onDelete':_0x0275('0x11e'),'foreignKey':'DescriptionId'});db[_0x0275('0xad')][_0x0275('0x120')](db['SugarcrmField'],{'as':_0x0275('0x1c1'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xad')][_0x0275('0x12e')](db[_0x0275('0xab')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xae')]['hasMany'](db[_0x0275('0xae')],{'as':'Subject','foreignKey':_0x0275('0x1c8')});db['SugarcrmField'][_0x0275('0x120')](db[_0x0275('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x0275('0x120')](db['SugarcrmField'],{'as':_0x0275('0x1c9'),'foreignKey':'FieldId'});db[_0x0275('0xae')][_0x0275('0x12e')](db[_0x0275('0x1cc')],{'as':_0x0275('0x1cc'),'foreignKey':_0x0275('0x1cd')});db[_0x0275('0xb0')][_0x0275('0x120')](db[_0x0275('0xb2')],{'as':'Configurations','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xb2')][_0x0275('0x120')](db[_0x0275('0xb4')],{'as':'Subjects','onDelete':_0x0275('0x11e'),'foreignKey':'SubjectId'});db[_0x0275('0xb2')][_0x0275('0x120')](db['DeskField'],{'as':_0x0275('0x1cb'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x0275('0xb2')][_0x0275('0x120')](db[_0x0275('0xb4')],{'as':_0x0275('0x1c1'),'onDelete':_0x0275('0x11e'),'foreignKey':'FieldId'});db[_0x0275('0xb2')][_0x0275('0x12e')](db[_0x0275('0xb0')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xb2')][_0x0275('0x132')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x0275('0xb4')][_0x0275('0x120')](db[_0x0275('0xb4')],{'as':_0x0275('0x1c7'),'foreignKey':_0x0275('0x1c8')});db[_0x0275('0xb4')]['hasMany'](db[_0x0275('0xb4')],{'as':_0x0275('0x1ce'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0xb4')][_0x0275('0x120')](db['DeskField'],{'as':_0x0275('0x1c9'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xb4')][_0x0275('0x12e')](db['Variable'],{'as':'Variable','foreignKey':_0x0275('0x1cd')});db[_0x0275('0xb6')][_0x0275('0x120')](db[_0x0275('0xb7')],{'as':'Configurations','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xb7')][_0x0275('0x120')](db[_0x0275('0xb9')],{'as':_0x0275('0x1ca'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c8')});db[_0x0275('0xb7')][_0x0275('0x120')](db[_0x0275('0xb9')],{'as':_0x0275('0x1cb'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0xb7')][_0x0275('0x120')](db[_0x0275('0xb9')],{'as':_0x0275('0x1c1'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xb7')][_0x0275('0x12e')](db[_0x0275('0xb6')],{'as':'Account','foreignKey':_0x0275('0x1c4')});db[_0x0275('0xb9')][_0x0275('0x120')](db[_0x0275('0xb9')],{'as':_0x0275('0x1c7'),'foreignKey':_0x0275('0x1c8')});db['ZohoField'][_0x0275('0x120')](db[_0x0275('0xb9')],{'as':_0x0275('0x1ce'),'foreignKey':_0x0275('0x1c5')});db['ZohoField'][_0x0275('0x120')](db[_0x0275('0xb9')],{'as':_0x0275('0x1c9'),'foreignKey':'FieldId'});db[_0x0275('0xb9')]['belongsTo'](db[_0x0275('0x1cc')],{'as':_0x0275('0x1cc'),'foreignKey':_0x0275('0x1cd')});db[_0x0275('0xbb')]['hasMany'](db[_0x0275('0xbd')],{'as':_0x0275('0x1c3'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xbd')][_0x0275('0x120')](db[_0x0275('0x1cf')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x0275('0xbd')][_0x0275('0x120')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x0275('0x1c5')});db[_0x0275('0xbd')]['hasMany'](db[_0x0275('0x1cf')],{'as':_0x0275('0x1c1'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xbd')][_0x0275('0x12e')](db[_0x0275('0xbb')],{'as':'Account','foreignKey':_0x0275('0x1c4')});db[_0x0275('0xbd')][_0x0275('0x132')](db[_0x0275('0x179')],{'through':'int_zendesk_configuration_has_tags'});db[_0x0275('0x1cf')][_0x0275('0x120')](db['ZendeskField'],{'as':_0x0275('0x1c7'),'foreignKey':_0x0275('0x1c8')});db[_0x0275('0x1cf')][_0x0275('0x120')](db['ZendeskField'],{'as':_0x0275('0x1ce'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0x1cf')]['hasMany'](db['ZendeskField'],{'as':_0x0275('0x1c9'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0x1cf')][_0x0275('0x12e')](db[_0x0275('0x1cc')],{'as':_0x0275('0x1cc'),'foreignKey':_0x0275('0x1cd')});db[_0x0275('0xbf')][_0x0275('0x120')](db[_0x0275('0xc1')],{'as':'Configurations','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xc1')][_0x0275('0x120')](db[_0x0275('0xc2')],{'as':_0x0275('0x1ca'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c8')});db[_0x0275('0xc1')]['hasMany'](db[_0x0275('0xc2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x0275('0x1c5')});db['FreshdeskConfiguration'][_0x0275('0x120')](db[_0x0275('0xc2')],{'as':_0x0275('0x1c1'),'onDelete':'cascade','foreignKey':_0x0275('0x1c6')});db[_0x0275('0xc1')][_0x0275('0x12e')](db['FreshdeskAccount'],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x1c4')});db['FreshdeskConfiguration'][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x1d0')});db[_0x0275('0xc2')][_0x0275('0x120')](db[_0x0275('0xc2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0275('0xc2')][_0x0275('0x120')](db['FreshdeskField'],{'as':_0x0275('0x1ce'),'foreignKey':_0x0275('0x1c5')});db['FreshdeskField'][_0x0275('0x120')](db[_0x0275('0xc2')],{'as':_0x0275('0x1c9'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xc2')][_0x0275('0x12e')](db[_0x0275('0x1cc')],{'as':_0x0275('0x1cc'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x0275('0x120')](db['VtigerConfiguration'],{'as':_0x0275('0x1c3'),'onDelete':'cascade','foreignKey':_0x0275('0x1c4')});db[_0x0275('0xc5')][_0x0275('0x120')](db[_0x0275('0xc7')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x0275('0xc5')][_0x0275('0x120')](db[_0x0275('0xc7')],{'as':_0x0275('0x1cb'),'foreignKey':'DescriptionId'});db[_0x0275('0xc5')][_0x0275('0x120')](db[_0x0275('0xc7')],{'as':'Fields','foreignKey':_0x0275('0x1c6')});db['VtigerConfiguration']['belongsTo'](db[_0x0275('0xc3')],{'as':'Account','foreignKey':'AccountId'});db[_0x0275('0xc7')]['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0x0275('0x1c8')});db['VtigerField'][_0x0275('0x120')](db[_0x0275('0xc7')],{'as':_0x0275('0x1ce'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0xc7')]['hasMany'](db[_0x0275('0xc7')],{'as':_0x0275('0x1c9'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xc7')][_0x0275('0x12e')](db[_0x0275('0x1cc')],{'as':_0x0275('0x1cc'),'foreignKey':_0x0275('0x1cd')});db['ServicenowAccount'][_0x0275('0x120')](db[_0x0275('0xcb')],{'as':_0x0275('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x0275('0xcb')][_0x0275('0x120')](db[_0x0275('0xcd')],{'as':_0x0275('0x1ca'),'foreignKey':_0x0275('0x1c8')});db['ServicenowConfiguration'][_0x0275('0x120')](db[_0x0275('0xcd')],{'as':_0x0275('0x1cb'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0xcb')]['hasMany'](db[_0x0275('0xcd')],{'as':_0x0275('0x1c1'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xcb')]['belongsTo'](db[_0x0275('0xc9')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xcd')][_0x0275('0x120')](db[_0x0275('0xcd')],{'as':_0x0275('0x1c7'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x0275('0x120')](db[_0x0275('0xcd')],{'as':_0x0275('0x1ce'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0xcd')][_0x0275('0x120')](db[_0x0275('0xcd')],{'as':_0x0275('0x1c9'),'foreignKey':_0x0275('0x1c6')});db[_0x0275('0xcd')][_0x0275('0x12e')](db[_0x0275('0x1cc')],{'as':_0x0275('0x1cc'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0x0275('0x120')](db[_0x0275('0xd0')],{'as':_0x0275('0x1c3'),'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0xd0')][_0x0275('0x120')](db[_0x0275('0xd2')],{'as':'Subjects','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c8')});db[_0x0275('0xd0')]['hasMany'](db[_0x0275('0xd2')],{'as':_0x0275('0x1cb'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x0275('0xd0')][_0x0275('0x120')](db[_0x0275('0xd2')],{'as':'Fields','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c6')});db['Dynamics365Configuration'][_0x0275('0x12e')](db[_0x0275('0xcf')],{'as':'Account','foreignKey':_0x0275('0x1c4')});db[_0x0275('0xd2')][_0x0275('0x120')](db[_0x0275('0xd2')],{'as':_0x0275('0x1c7'),'foreignKey':_0x0275('0x1c8')});db[_0x0275('0xd2')][_0x0275('0x120')](db[_0x0275('0xd2')],{'as':_0x0275('0x1ce'),'foreignKey':'DescriptionId'});db[_0x0275('0xd2')][_0x0275('0x120')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x0275('0x1c6')});db['Dynamics365Field'][_0x0275('0x12e')](db[_0x0275('0x1cc')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount'][_0x0275('0x120')](db[_0x0275('0x1d1')],{'as':'Configurations','onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1c4')});db[_0x0275('0x1d1')][_0x0275('0x120')](db['FreshsalesField'],{'as':_0x0275('0x1ca'),'foreignKey':_0x0275('0x1c8')});db[_0x0275('0x1d1')][_0x0275('0x120')](db[_0x0275('0xd6')],{'as':_0x0275('0x1cb'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0x1d1')][_0x0275('0x120')](db[_0x0275('0xd6')],{'as':_0x0275('0x1c1'),'foreignKey':'FieldId'});db[_0x0275('0x1d1')][_0x0275('0x12e')](db[_0x0275('0xd3')],{'as':'Account','foreignKey':_0x0275('0x1c4')});db[_0x0275('0xd6')][_0x0275('0x120')](db['FreshsalesField'],{'as':_0x0275('0x1c7'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x0275('0x120')](db['FreshsalesField'],{'as':_0x0275('0x1ce'),'foreignKey':_0x0275('0x1c5')});db[_0x0275('0xd6')][_0x0275('0x120')](db[_0x0275('0xd6')],{'as':_0x0275('0x1c9'),'foreignKey':'FieldId'});db[_0x0275('0xd6')]['belongsTo'](db[_0x0275('0x1cc')],{'as':_0x0275('0x1cc'),'foreignKey':_0x0275('0x1cd')});db[_0x0275('0xda')][_0x0275('0x12e')](db[_0x0275('0x68')],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db['ChatQueueReport'][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':'Contact','foreignKey':_0x0275('0x16a')});db['ChatQueueReport'][_0x0275('0x12e')](db[_0x0275('0x6d')],{});db[_0x0275('0xda')][_0x0275('0x12e')](db[_0x0275('0x6e')],{});db[_0x0275('0xda')][_0x0275('0x12e')](db[_0x0275('0x11c')],{});db[_0x0275('0xda')]['belongsTo'](db['ChatQueue'],{});db[_0x0275('0x1a1')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x11e'),'foreignKey':_0x0275('0x1d2')});db[_0x0275('0x1a1')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x11e'),'foreignKey':'ToId'});db[_0x0275('0xe1')]['hasMany'](db[_0x0275('0xdf')],{'foreignKey':_0x0275('0x1d3'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x0275('0x120')](db[_0x0275('0xdd')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0275('0x1d4')][_0x0275('0x12e')](db[_0x0275('0x57')],{});db[_0x0275('0x1d4')]['belongsTo'](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x1d4')]['belongsTo'](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db[_0x0275('0x1d4')][_0x0275('0x12e')](db[_0x0275('0x5b')],{});db[_0x0275('0x1d4')][_0x0275('0x12e')](db[_0x0275('0x5d')],{});db['SmsQueueReport'][_0x0275('0x12e')](db[_0x0275('0x11c')],{});db[_0x0275('0x1d4')][_0x0275('0x12e')](db['SmsQueue'],{});db['JscriptyProject'][_0x0275('0x120')](db[_0x0275('0xe1')],{'foreignKey':_0x0275('0x1d5')});db[_0x0275('0x1d6')][_0x0275('0x120')](db[_0x0275('0xdf')],{'foreignKey':_0x0275('0x1d5')});db[_0x0275('0x1d6')]['hasMany'](db[_0x0275('0xdd')],{'foreignKey':'ProjectId'});db[_0x0275('0xeb')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':'Users','through':_0x0275('0x14e')});db[_0x0275('0xf0')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':'Agents','through':_0x0275('0x136')});db[_0x0275('0xf0')][_0x0275('0x132')](db[_0x0275('0x19')],{'through':_0x0275('0x11a'),'as':_0x0275('0x13d')});db['Team']['belongsToMany'](db[_0x0275('0x3f')],{'through':_0x0275('0x175'),'as':_0x0275('0x13e')});db['Team'][_0x0275('0x132')](db['ChatQueue'],{'through':_0x0275('0x1d7'),'as':_0x0275('0x13f')});db['Team'][_0x0275('0x132')](db[_0x0275('0x53')],{'through':_0x0275('0x18c'),'as':_0x0275('0x141')});db[_0x0275('0xf0')][_0x0275('0x132')](db[_0x0275('0x5f')],{'through':_0x0275('0x1d8'),'as':_0x0275('0x1d9')});db[_0x0275('0xf0')]['belongsToMany'](db[_0x0275('0x66')],{'through':'team_has_openchannel_queues','as':_0x0275('0x1da')});db[_0x0275('0xf0')][_0x0275('0x132')](db[_0x0275('0x116')],{'through':_0x0275('0x1db'),'as':_0x0275('0x1dc')});db[_0x0275('0xf0')][_0x0275('0x132')](db[_0x0275('0x105')],{'through':'TeamVoicePrefix','as':_0x0275('0x1dd')});db['Campaign'][_0x0275('0x120')](db[_0x0275('0x7a')],{'as':_0x0275('0x156'),'foreignKey':_0x0275('0x1a7')});db[_0x0275('0xf4')][_0x0275('0x120')](db['CmHopperFinal'],{'as':_0x0275('0x123'),'foreignKey':_0x0275('0x1a7')});db[_0x0275('0xf4')][_0x0275('0x120')](db[_0x0275('0x124')],{'as':_0x0275('0x157'),'foreignKey':'CampaignId'});db[_0x0275('0xf4')][_0x0275('0x120')](db[_0x0275('0x7c')],{'as':_0x0275('0x1de'),'foreignKey':_0x0275('0x1a7')});db[_0x0275('0xf4')]['belongsTo'](db[_0x0275('0x159')],{'as':_0x0275('0x159'),'foreignKey':'TrunkId'});db[_0x0275('0xf4')][_0x0275('0x12e')](db[_0x0275('0x159')],{'as':_0x0275('0x15b'),'foreignKey':_0x0275('0x15c')});db['Campaign'][_0x0275('0x12e')](db[_0x0275('0x15d')],{'as':'Interval','foreignKey':_0x0275('0x18f')});db[_0x0275('0xf4')][_0x0275('0x12e')](db['SquareProject'],{'as':_0x0275('0xeb'),'foreignKey':_0x0275('0x1df')});db[_0x0275('0xf4')][_0x0275('0x132')](db[_0x0275('0x104')],{'as':_0x0275('0x134'),'through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0x0275('0x104')],{'as':_0x0275('0x162'),'through':_0x0275('0x1e0')});db[_0x0275('0xf8')][_0x0275('0x12e')](db[_0x0275('0x70')],{'as':'ChatOfflineMessage','foreignKey':_0x0275('0x180')});db[_0x0275('0xfc')]['belongsTo'](db['MailMessage'],{});db[_0x0275('0xfc')][_0x0275('0x12e')](db[_0x0275('0x42')],{});db['MailTransferReport'][_0x0275('0x12e')](db[_0x0275('0x3d')],{'foreignKey':_0x0275('0x1e1'),'as':_0x0275('0x1e2')});db['MailTransferReport'][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':'FromUserId','as':_0x0275('0x1e3')});db[_0x0275('0xfc')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1e4'),'as':_0x0275('0x1e5')});db[_0x0275('0xfc')][_0x0275('0x12e')](db[_0x0275('0x3f')],{'foreignKey':_0x0275('0x1e6'),'as':_0x0275('0x1e7')});db[_0x0275('0xfc')][_0x0275('0x12e')](db[_0x0275('0x3d')],{'foreignKey':_0x0275('0x1e8'),'as':_0x0275('0x1e9')});db[_0x0275('0xfe')][_0x0275('0x12e')](db[_0x0275('0x6e')],{});db['ChatTransferReport'][_0x0275('0x12e')](db[_0x0275('0x6d')],{});db['ChatTransferReport'][_0x0275('0x12e')](db[_0x0275('0x68')],{'foreignKey':_0x0275('0x1ea'),'as':_0x0275('0x1e2')});db[_0x0275('0xfe')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1eb'),'as':_0x0275('0x1e3')});db[_0x0275('0xfe')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':'ToUserId','as':_0x0275('0x1e5')});db[_0x0275('0xfe')][_0x0275('0x12e')](db[_0x0275('0x72')],{'foreignKey':_0x0275('0x1ec'),'as':_0x0275('0x1e7')});db[_0x0275('0xfe')][_0x0275('0x12e')](db['ChatWebsite'],{'foreignKey':_0x0275('0x1ed'),'as':_0x0275('0x1e9')});db[_0x0275('0xff')][_0x0275('0x12e')](db[_0x0275('0x51')],{});db[_0x0275('0xff')]['belongsTo'](db[_0x0275('0x4f')],{});db[_0x0275('0xff')]['belongsTo'](db[_0x0275('0x4c')],{'foreignKey':_0x0275('0x1ee'),'as':_0x0275('0x1e2')});db[_0x0275('0xff')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1eb'),'as':_0x0275('0x1e3')});db[_0x0275('0xff')]['belongsTo'](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1e4'),'as':_0x0275('0x1e5')});db[_0x0275('0xff')][_0x0275('0x12e')](db[_0x0275('0x53')],{'foreignKey':_0x0275('0x1ef'),'as':_0x0275('0x1e7')});db['FaxTransferReport'][_0x0275('0x12e')](db[_0x0275('0x4c')],{'foreignKey':_0x0275('0x1f0'),'as':_0x0275('0x1e9')});db[_0x0275('0x100')][_0x0275('0x12e')](db[_0x0275('0x64')],{});db['OpenchannelTransferReport'][_0x0275('0x12e')](db['OpenchannelInteraction'],{});db[_0x0275('0x100')]['belongsTo'](db[_0x0275('0x193')],{'foreignKey':_0x0275('0x1f1'),'as':'FromAccount'});db[_0x0275('0x100')]['belongsTo'](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1eb'),'as':_0x0275('0x1e3')});db[_0x0275('0x100')]['belongsTo'](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1e4'),'as':_0x0275('0x1e5')});db[_0x0275('0x100')][_0x0275('0x12e')](db[_0x0275('0x66')],{'foreignKey':'ToOpenchannelQueueId','as':_0x0275('0x1e7')});db[_0x0275('0x100')]['belongsTo'](db[_0x0275('0x193')],{'foreignKey':_0x0275('0x1f2'),'as':_0x0275('0x1e9')});db[_0x0275('0x102')]['belongsTo'](db[_0x0275('0x5d')],{});db['SmsTransferReport'][_0x0275('0x12e')](db[_0x0275('0x5b')],{});db[_0x0275('0x102')][_0x0275('0x12e')](db[_0x0275('0x57')],{'foreignKey':'FromSmsAccountId','as':_0x0275('0x1e2')});db[_0x0275('0x102')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1eb'),'as':_0x0275('0x1e3')});db[_0x0275('0x102')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':_0x0275('0x1e4'),'as':'ToAgent'});db[_0x0275('0x102')][_0x0275('0x12e')](db[_0x0275('0x5f')],{'foreignKey':_0x0275('0x1f3'),'as':_0x0275('0x1e7')});db[_0x0275('0x102')][_0x0275('0x12e')](db[_0x0275('0x57')],{'foreignKey':_0x0275('0x1f4'),'as':_0x0275('0x1e9')});db[_0x0275('0x104')][_0x0275('0x120')](db[_0x0275('0x86')],{'as':'Dispositions','foreignKey':_0x0275('0x172'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x104')]['hasMany'](db[_0x0275('0x82')],{'as':_0x0275('0x1f5'),'foreignKey':'ListId'});db['CmList'][_0x0275('0x120')](db['CmContact'],{'as':_0x0275('0x133'),'onDelete':_0x0275('0x11e'),'foreignKey':'ListId'});db[_0x0275('0x104')][_0x0275('0x120')](db[_0x0275('0x7e')],{'as':_0x0275('0x123'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x104')][_0x0275('0x120')](db[_0x0275('0x124')],{'as':'HopperHistory','foreignKey':_0x0275('0x172')});db[_0x0275('0x104')]['hasMany'](db[_0x0275('0x81')],{'as':_0x0275('0x81'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x104')][_0x0275('0x132')](db[_0x0275('0x19')],{'as':'Queues','through':_0x0275('0x15f')});db[_0x0275('0x104')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':'cm_user_has_lists'});db[_0x0275('0x105')][_0x0275('0x120')](db[_0x0275('0x15')],{'as':_0x0275('0x122'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x105')]['belongsToMany'](db['User'],{'as':_0x0275('0x160'),'through':_0x0275('0x11b')});db[_0x0275('0x105')][_0x0275('0x132')](db[_0x0275('0xf0')],{'through':_0x0275('0x1f6'),'as':_0x0275('0x161')});db[_0x0275('0x107')][_0x0275('0x120')](db[_0x0275('0x11c')],{'as':'Users','foreignKey':_0x0275('0x12f')});db['UserProfile']['hasMany'](db[_0x0275('0x109')],{'as':'UserProfileSections','foreignKey':_0x0275('0x12f'),'onDelete':'cascade'});db[_0x0275('0x109')][_0x0275('0x120')](db[_0x0275('0x10b')],{'as':'Resources','foreignKey':_0x0275('0x1f7'),'onDelete':_0x0275('0x11e')});db[_0x0275('0x10d')][_0x0275('0x120')](db[_0x0275('0x86')],{'as':_0x0275('0x16f'),'foreignKey':'WhatsappAccountId','onDelete':_0x0275('0x11e')});db['WhatsappAccount'][_0x0275('0x120')](db[_0x0275('0x85')],{'as':_0x0275('0x18e'),'foreignKey':'WhatsappAccountId'});db[_0x0275('0x10d')][_0x0275('0x120')](db[_0x0275('0x111')],{'as':'Messages','foreignKey':_0x0275('0x1f8')});db[_0x0275('0x10d')][_0x0275('0x120')](db[_0x0275('0x12a')],{'as':'Interactions'});db['WhatsappAccount'][_0x0275('0x120')](db[_0x0275('0x10f')],{'as':'Applications'});db[_0x0275('0x10d')][_0x0275('0x12e')](db[_0x0275('0x104')],{'as':'List','foreignKey':_0x0275('0x172')});db['WhatsappAccount'][_0x0275('0x12e')](db['Pause'],{'as':_0x0275('0x174'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0275('0x10d')]['belongsToMany'](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':'user_has_whatsapp_accounts'});db[_0x0275('0x10f')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'onDelete':_0x0275('0x181')});db[_0x0275('0x10f')][_0x0275('0x12e')](db[_0x0275('0x116')],{'onDelete':'restrict'});db[_0x0275('0x10f')][_0x0275('0x12e')](db['WhatsappAccount'],{'onDelete':_0x0275('0x181')});db['WhatsappApplication'][_0x0275('0x12e')](db[_0x0275('0x15d')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x0275('0x10f')][_0x0275('0x12e')](db[_0x0275('0x179')],{'onDelete':_0x0275('0x181'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x0275('0x120')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0x0275('0x12a')][_0x0275('0x12e')](db[_0x0275('0x10d')],{'as':_0x0275('0x177'),'foreignKey':_0x0275('0x1f8')});db[_0x0275('0x12a')][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':_0x0275('0x16a')});db['WhatsappInteraction'][_0x0275('0x12e')](db[_0x0275('0x11c')],{'as':_0x0275('0x178'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x0275('0x132')](db[_0x0275('0x179')],{'through':_0x0275('0x1b7'),'as':_0x0275('0x17b')});db[_0x0275('0x12a')][_0x0275('0x132')](db['Tag'],{'through':_0x0275('0x1b7'),'as':_0x0275('0x189')});db[_0x0275('0x12a')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':'Users','through':_0x0275('0x13c'),'foreignKey':_0x0275('0x1f9')});db[_0x0275('0x111')][_0x0275('0x12e')](db['User'],{'as':_0x0275('0x11c')});db[_0x0275('0x111')][_0x0275('0x12e')](db[_0x0275('0x78')],{'onDelete':_0x0275('0x11e'),'as':_0x0275('0x17e')});db['WhatsappMessage']['belongsTo'](db[_0x0275('0x12a')],{'onDelete':'cascade','as':_0x0275('0x17f'),'foreignKey':_0x0275('0x1f9')});db['WhatsappMessage']['belongsTo'](db[_0x0275('0x10d')],{'as':'Account','foreignKey':_0x0275('0x1f8')});db[_0x0275('0x113')]['belongsTo'](db[_0x0275('0x10d')],{});db[_0x0275('0x113')]['belongsTo'](db[_0x0275('0x104')],{'as':_0x0275('0x183'),'foreignKey':_0x0275('0x172')});db[_0x0275('0x113')][_0x0275('0x12e')](db[_0x0275('0x78')],{'as':_0x0275('0x17e'),'foreignKey':'ContactId'});db[_0x0275('0x113')][_0x0275('0x12e')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x0275('0x12e')](db[_0x0275('0x116')],{});db['WhatsappQueueReport'][_0x0275('0x12e')](db[_0x0275('0x111')],{});db[_0x0275('0x113')][_0x0275('0x12e')](db['User'],{});db['WhatsappTransferReport'][_0x0275('0x12e')](db[_0x0275('0x111')],{});db[_0x0275('0x115')][_0x0275('0x12e')](db[_0x0275('0x12a')],{});db[_0x0275('0x115')]['belongsTo'](db[_0x0275('0x10d')],{'foreignKey':_0x0275('0x1fa'),'as':_0x0275('0x1e2')});db[_0x0275('0x115')][_0x0275('0x12e')](db['WhatsappAccount'],{'foreignKey':_0x0275('0x1fb'),'as':_0x0275('0x1e9')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x0275('0x115')][_0x0275('0x12e')](db[_0x0275('0x11c')],{'foreignKey':'FromUserId','as':_0x0275('0x1e3')});db[_0x0275('0x115')][_0x0275('0x12e')](db['User'],{'foreignKey':_0x0275('0x1e4'),'as':'ToAgent'});db[_0x0275('0x116')][_0x0275('0x132')](db[_0x0275('0x11c')],{'as':_0x0275('0x160'),'through':_0x0275('0x38'),'foreignKey':_0x0275('0x1fc')});db['WhatsappQueue']['belongsToMany'](db[_0x0275('0xf0')],{'through':'team_has_whatsapp_queues','as':_0x0275('0x161')});module[_0x0275('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xdace=['user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','JscriptySessionReport','Trunk','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','ListId','TemplateId','team_has_mail_queues','Teams','Messages','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','Items','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','mandatoryDispositionPauseId','SmsInteractionId','Owner','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatGroupId','Company','CompanyId','cm_contact_has_tags','Agent','CampaignId','OwnerId','Automation','Condition','All','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Fields','Subject','DescriptionId','FieldId','Variable','VariableId','SugarcrmField','Description','Field','DeskConfiguration','Descriptions','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','FreshsalesAccount','FreshsalesConfiguration','ChatQueueReport','ToId','SessionId','JscriptyProject','ProjectId','JscriptyQuestionReport','user_has_square_projects','TeamVoiceQueue','team_has_chat_queues','team_has_sms_queues','team_has_whatsapp_queues','TeamVoicePrefix','VoicePrefixes','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappMessage','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','password','options','database','username','User','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','UserId','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','userProfileId','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues'];(function(_0x42a26a,_0xcd612a){var _0x4def88=function(_0x4f2b26){while(--_0x4f2b26){_0x42a26a['push'](_0x42a26a['shift']());}};_0x4def88(++_0xcd612a);}(_0xdace,0xc5));var _0xedac=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xdace[_0x47e549];return _0x251374;};'use strict';var config=require(_0xedac('0x0'));var Sequelize=require('sequelize');var _=require(_0xedac('0x1'));var jstz=require(_0xedac('0x2'));var timezone=jstz[_0xedac('0x3')]();config['sequelize']=_[_0xedac('0x4')](config[_0xedac('0x5')],{'database':_0xedac('0x6'),'username':_0xedac('0x7'),'password':'xC@LL1234','options':{'host':_0xedac('0x8'),'port':0xcea,'dialect':_0xedac('0x9'),'dialectOptions':{'charset':_0xedac('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xedac('0xb'),'collate':_0xedac('0xc')}}});config[_0xedac('0xd')]=_['defaultsDeep'](config[_0xedac('0xd')],{'database':_0xedac('0x6'),'username':_0xedac('0x7'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xedac('0x9'),'dialectOptions':{'charset':_0xedac('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xedac('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xedac('0x5')]['database'],config[_0xedac('0x5')]['username'],config[_0xedac('0x5')][_0xedac('0xe')],config[_0xedac('0x5')][_0xedac('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xedac('0xd')][_0xedac('0x10')],config[_0xedac('0xd')][_0xedac('0x11')],config['sequelizeHistory'][_0xedac('0xe')],config[_0xedac('0xd')][_0xedac('0xf')])};db[_0xedac('0x12')]=db[_0xedac('0x5')]['import'](_0xedac('0x13'));db['VoiceChanSpy']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x15'));db[_0xedac('0x16')]=db['sequelize']['import'](_0xedac('0x17'));db[_0xedac('0x18')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x19'));db[_0xedac('0x1a')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x1b'));db[_0xedac('0x1c')]=db['sequelize'][_0xedac('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xedac('0x1d')]=db[_0xedac('0x5')]['import'](_0xedac('0x1e'));db[_0xedac('0x1f')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x20'));db[_0xedac('0x21')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x22'));db[_0xedac('0x23')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x24'));db[_0xedac('0x25')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x26'));db['VoiceAgentReport']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x27'));db['VoiceQueueReport']=db[_0xedac('0x5')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0xedac('0x28')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x29'));db['Trunk']=db['sequelize'][_0xedac('0x14')](_0xedac('0x2a'));db[_0xedac('0x2b')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x2c'));db[_0xedac('0x2d')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x2e'));db[_0xedac('0x2f')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x30'));db['UserChatQueue']=db[_0xedac('0x5')][_0xedac('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0xedac('0x31')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x32'));db[_0xedac('0x33')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x34'));db[_0xedac('0x35')]=db[_0xedac('0x5')]['import'](_0xedac('0x36'));db[_0xedac('0x37')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x38'));db[_0xedac('0x39')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x3a'));db[_0xedac('0x3b')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x3c'));db[_0xedac('0x3d')]=db[_0xedac('0x5')]['import'](_0xedac('0x3e'));db[_0xedac('0x3f')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/mailAccount/mailAccount.model');db[_0xedac('0x40')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/mailQueue/mailQueue.model');db[_0xedac('0x41')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0xedac('0x42')]=db[_0xedac('0x5')]['import'](_0xedac('0x43'));db[_0xedac('0x44')]=db['sequelize'][_0xedac('0x14')]('../api/mailMessage/mailMessage.model');db[_0xedac('0x45')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x46'));db[_0xedac('0x47')]=db[_0xedac('0x5')]['import'](_0xedac('0x48'));db[_0xedac('0x49')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x4a'));db[_0xedac('0x4b')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x4c'));db[_0xedac('0x4d')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x4e'));db[_0xedac('0x4f')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/faxApplication/faxApplication.model');db[_0xedac('0x50')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db['sequelize'][_0xedac('0x14')](_0xedac('0x51'));db['FaxQueue']=db[_0xedac('0x5')]['import'](_0xedac('0x52'));db['FaxQueueReport']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x53'));db[_0xedac('0x54')]=db[_0xedac('0x5')]['import']('../api/smsAccount/smsAccount.model');db[_0xedac('0x55')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x56'));db[_0xedac('0x57')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x58'));db[_0xedac('0x59')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x5a'));db[_0xedac('0x5b')]=db['sequelize']['import'](_0xedac('0x5c'));db[_0xedac('0x5d')]=db['sequelize']['import'](_0xedac('0x5e'));db[_0xedac('0x5f')]=db['sequelize'][_0xedac('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0xedac('0x60')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x61'));db[_0xedac('0x62')]=db[_0xedac('0x5')]['import'](_0xedac('0x63'));db[_0xedac('0x64')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x65'));db[_0xedac('0x66')]=db['sequelize']['import'](_0xedac('0x67'));db[_0xedac('0x68')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x69'));db[_0xedac('0x6a')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x6b'));db[_0xedac('0x6c')]=db[_0xedac('0x5')]['import']('../api/chatInteraction/chatInteraction.model');db[_0xedac('0x6d')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/chatMessage/chatMessage.model');db[_0xedac('0x6e')]=db[_0xedac('0x5')]['import'](_0xedac('0x6f'));db[_0xedac('0x70')]=db['sequelize']['import']('../api/chatQueue/chatQueue.model');db[_0xedac('0x71')]=db['sequelize'][_0xedac('0x14')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x72'));db[_0xedac('0x73')]=db[_0xedac('0x5')]['import'](_0xedac('0x74'));db['CmContact']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x75'));db[_0xedac('0x76')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x77'));db['CmHopperBlack']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x78'));db[_0xedac('0x79')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x7a'));db[_0xedac('0x7b')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x7c'));db[_0xedac('0x7d')]=db[_0xedac('0x5')]['import'](_0xedac('0x7e'));db['Action']=db[_0xedac('0x5')][_0xedac('0x14')]('../api/action/action.model');db['Automation']=db['sequelize'][_0xedac('0x14')](_0xedac('0x7f'));db[_0xedac('0x80')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x81'));db[_0xedac('0x82')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x83'));db['Condition']=db[_0xedac('0x5')][_0xedac('0x14')]('../api/condition/condition.model');db[_0xedac('0x84')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x85'));db[_0xedac('0x86')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x87'));db[_0xedac('0x88')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x89'));db[_0xedac('0x8a')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x8b'));db[_0xedac('0x8c')]=db[_0xedac('0x5')]['import'](_0xedac('0x8d'));db['Sound']=db[_0xedac('0x5')]['import'](_0xedac('0x8e'));db[_0xedac('0x8f')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x90'));db[_0xedac('0x91')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x92'));db[_0xedac('0x93')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x94'));db['Variable']=db[_0xedac('0x5')]['import'](_0xedac('0x95'));db[_0xedac('0x96')]=db[_0xedac('0x5')]['import'](_0xedac('0x97'));db['IntegrationReport']=db['sequelize'][_0xedac('0x14')](_0xedac('0x98'));db[_0xedac('0x99')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xedac('0x9a')]=db['sequelize'][_0xedac('0x14')](_0xedac('0x9b'));db[_0xedac('0x9c')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x9d'));db['AnalyticMetric']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x9e'));db[_0xedac('0x9f')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xa0'));db[_0xedac('0xa1')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xa2'));db[_0xedac('0xa3')]=db['sequelize'][_0xedac('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xedac('0x5')]['import'](_0xedac('0xa4'));db[_0xedac('0xa5')]=db['sequelize'][_0xedac('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0xedac('0xa6')]=db['sequelize'][_0xedac('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xedac('0xa7')]=db[_0xedac('0x5')]['import'](_0xedac('0xa8'));db['SugarcrmField']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xa9'));db[_0xedac('0xaa')]=db[_0xedac('0x5')]['import'](_0xedac('0xab'));db['DeskConfiguration']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xac'));db[_0xedac('0xad')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/intDeskField/intDeskField.model');db[_0xedac('0xae')]=db[_0xedac('0x5')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xedac('0xaf')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xb0'));db[_0xedac('0xb1')]=db['sequelize'][_0xedac('0x14')](_0xedac('0xb2'));db['ZendeskAccount']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xb3'));db[_0xedac('0xb4')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xb5'));db[_0xedac('0xb6')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0xedac('0xb7')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xb8'));db[_0xedac('0xb9')]=db['sequelize'][_0xedac('0x14')](_0xedac('0xba'));db[_0xedac('0xbb')]=db[_0xedac('0x5')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0xedac('0xbc')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xbd'));db[_0xedac('0xbe')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xbf'));db[_0xedac('0xc0')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xc1'));db['ServicenowAccount']=db[_0xedac('0x5')]['import'](_0xedac('0xc2'));db['ServicenowConfiguration']=db[_0xedac('0x5')][_0xedac('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xedac('0xc3')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0xedac('0xc4')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xedac('0xc5')]=db['sequelize'][_0xedac('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xedac('0xc6')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xc7'));db['FreshsalesAccount']=db['sequelize'][_0xedac('0x14')](_0xedac('0xc8'));db['FreshsalesConfiguration']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xc9'));db[_0xedac('0xca')]=db[_0xedac('0x5')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xedac('0x96')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/integration/integration.model');db[_0xedac('0xcb')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xcc'));db['ChatQueueReport']=db[_0xedac('0x5')][_0xedac('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0xedac('0xcd')]=db['sequelize'][_0xedac('0x14')](_0xedac('0xce'));db[_0xedac('0xcf')]=db[_0xedac('0x5')]['import'](_0xedac('0xd0'));db['JscriptyQuestionReport']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xd1'));db['JscriptySessionReport']=db['sequelize'][_0xedac('0x14')](_0xedac('0xd2'));db[_0xedac('0xd3')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xedac('0xd4')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xd5'));db[_0xedac('0xd6')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xd7'));db['JscriptyProject']=db[_0xedac('0x5')]['import'](_0xedac('0xd8'));db[_0xedac('0xd9')]=db['sequelize'][_0xedac('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xda'));db[_0xedac('0xdb')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xdc'));db['SquareMessage']=db['sequelize'][_0xedac('0x14')](_0xedac('0xdd'));db[_0xedac('0xde')]=db[_0xedac('0x5')]['import'](_0xedac('0xdf'));db[_0xedac('0xe0')]=db['sequelize'][_0xedac('0x14')](_0xedac('0xe1'));db[_0xedac('0xe2')]=db['sequelize']['import'](_0xedac('0xe3'));db[_0xedac('0xe4')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xe5'));db[_0xedac('0xe6')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xe7'));db[_0xedac('0xe8')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/plugin/plugin.model');db[_0xedac('0xe9')]=db['sequelize']['import'](_0xedac('0xea'));db[_0xedac('0xeb')]=db[_0xedac('0x5')]['import'](_0xedac('0xec'));db[_0xedac('0xed')]=db[_0xedac('0x5')][_0xedac('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0xedac('0xee')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xef'));db[_0xedac('0xf0')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xf1'));db[_0xedac('0xf2')]=db['sequelize'][_0xedac('0x14')](_0xedac('0xf3'));db[_0xedac('0xf4')]=db[_0xedac('0x5')]['import']('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xf5'));db[_0xedac('0xf6')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xf7'));db['UserProfileResource']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xf8'));db[_0xedac('0xf9')]=db['sequelize']['import'](_0xedac('0xfa'));db[_0xedac('0xfb')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xfc'));db['WhatsappApplication']=db['sequelize'][_0xedac('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0xedac('0xfd')]=db[_0xedac('0x5')]['import'](_0xedac('0xfe'));db['WhatsappMessage']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0xff'));db[_0xedac('0x100')]=db[_0xedac('0x5')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0xedac('0x5')]['import'](_0xedac('0x101'));db['WhatsappQueue']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x102'));db[_0xedac('0x103')]=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x104'));db['TeamVoiceQueue']=db['sequelize'][_0xedac('0x14')](_0xedac('0x105'));db['TeamVoicePrefix']=db[_0xedac('0x5')][_0xedac('0x14')](_0xedac('0x106'));db[_0xedac('0x107')]=db[_0xedac('0x5')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0xedac('0x12')]['hasOne'](db[_0xedac('0x1f')],{'as':'VoiceMail','onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db[_0xedac('0x1c')],{'as':_0xedac('0x10b'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db[_0xedac('0x2d')],{'as':'VoiceQueuesRt','foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db['VoiceExtension'],{'as':_0xedac('0x10c'),'onDelete':'cascade','hooks':!![]});db[_0xedac('0x12')]['hasMany'](db['CmHopperFinal'],{'as':_0xedac('0x10d'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db[_0xedac('0x7b')],{'as':_0xedac('0x10e'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db[_0xedac('0x10f')],{'as':_0xedac('0x10f'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db['OpenchannelInteraction'],{'as':_0xedac('0x110'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db[_0xedac('0x6c')],{'as':_0xedac('0x111'),'foreignKey':'UserId'});db[_0xedac('0x12')][_0xedac('0x10a')](db['SmsInteraction'],{'as':_0xedac('0x112'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db[_0xedac('0x50')],{'as':_0xedac('0x113'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db['MailInteraction'],{'as':_0xedac('0x114'),'foreignKey':_0xedac('0x109')});db['User'][_0xedac('0x10a')](db[_0xedac('0xfd')],{'as':_0xedac('0x115'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x12')][_0xedac('0x10a')](db[_0xedac('0xf9')],{'as':_0xedac('0x116'),'foreignKey':'SenderId'});db[_0xedac('0x12')][_0xedac('0x117')](db[_0xedac('0x118')],{'as':'UserProfile','foreignKey':_0xedac('0x119')});db['User'][_0xedac('0x11a')](db[_0xedac('0x71')],{'as':'Groups','through':_0xedac('0x11b')});db['User'][_0xedac('0x11a')](db[_0xedac('0x11c')],{'as':_0xedac('0x11d'),'through':_0xedac('0x11e')});db['User'][_0xedac('0x11a')](db[_0xedac('0xf2')],{'as':_0xedac('0x11f'),'through':_0xedac('0x120')});db['User']['belongsToMany'](db[_0xedac('0xde')],{'through':_0xedac('0x121')});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x42')],{'as':_0xedac('0x114'),'through':_0xedac('0x122')});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x6c')],{'as':_0xedac('0x111'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0xedac('0x50')],{'as':_0xedac('0x113'),'through':_0xedac('0x123')});db[_0xedac('0x12')]['belongsToMany'](db[_0xedac('0x57')],{'as':'SmsInteractions','through':_0xedac('0x124')});db[_0xedac('0x12')]['belongsToMany'](db[_0xedac('0x60')],{'as':_0xedac('0x110'),'through':_0xedac('0x125')});db['User'][_0xedac('0x11a')](db[_0xedac('0xfd')],{'as':'WhatsappInteractions','through':_0xedac('0x126')});db['User'][_0xedac('0x11a')](db[_0xedac('0x1a')],{'as':_0xedac('0x127'),'through':_0xedac('0x2f'),'required':![]});db[_0xedac('0x12')]['belongsToMany'](db[_0xedac('0xf4')],{'as':'VoicePrefixes','through':_0xedac('0x107'),'required':![]});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x40')],{'as':_0xedac('0x128'),'through':_0xedac('0x31'),'required':![]});db[_0xedac('0x12')][_0xedac('0x11a')](db['ChatQueue'],{'as':_0xedac('0x129'),'through':_0xedac('0x12a'),'required':![],'hooks':!![]});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x12b')],{'as':_0xedac('0x12c'),'through':'UserFaxQueue','required':![]});db[_0xedac('0x12')]['belongsToMany'](db[_0xedac('0x5b')],{'as':_0xedac('0x12d'),'through':_0xedac('0x35'),'required':![]});db['User'][_0xedac('0x11a')](db[_0xedac('0x64')],{'as':_0xedac('0x12e'),'through':_0xedac('0x37'),'required':![]});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x12f')],{'as':_0xedac('0x130'),'through':_0xedac('0x39'),'required':![]});db['User']['belongsToMany'](db[_0xedac('0xf2')],{'through':_0xedac('0x120')});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x66')],{'as':'ChatWebsites','through':_0xedac('0x131')});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x4d')],{'as':'FaxAccounts','through':_0xedac('0x132')});db[_0xedac('0x12')][_0xedac('0x11a')](db[_0xedac('0x3f')],{'as':_0xedac('0x133'),'through':_0xedac('0x134')});db['User']['belongsToMany'](db[_0xedac('0x5d')],{'as':_0xedac('0x135'),'through':_0xedac('0x136')});db['User'][_0xedac('0x11a')](db[_0xedac('0x54')],{'as':_0xedac('0x137'),'through':'user_has_sms_accounts'});db['User'][_0xedac('0x11a')](db['WhatsappAccount'],{'as':_0xedac('0x138'),'through':_0xedac('0x139')});db['User']['belongsToMany'](db['SquareProject'],{'as':_0xedac('0x13a'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0xedac('0x10a')](db[_0xedac('0x18')],{'as':_0xedac('0x13b'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x13c')});db[_0xedac('0x16')][_0xedac('0x10a')](db[_0xedac('0x18')],{'onDelete':_0xedac('0x108')});db[_0xedac('0x18')][_0xedac('0x10a')](db[_0xedac('0x18')],{'as':_0xedac('0x13d'),'onDelete':'cascade'});db[_0xedac('0x13e')][_0xedac('0x11a')](db[_0xedac('0x13f')],{'as':_0xedac('0x140'),'through':_0xedac('0x141')});db[_0xedac('0x1a')][_0xedac('0x10a')](db['UserVoiceQueueRt'],{'as':_0xedac('0x142'),'foreignKey':_0xedac('0x143')});db[_0xedac('0x1a')][_0xedac('0x10a')](db[_0xedac('0x76')],{'as':_0xedac('0x144'),'foreignKey':'VoiceQueueId'});db[_0xedac('0x1a')][_0xedac('0x10a')](db[_0xedac('0x79')],{'as':_0xedac('0x10d'),'foreignKey':_0xedac('0x143')});db['VoiceQueue'][_0xedac('0x10a')](db[_0xedac('0x7b')],{'as':_0xedac('0x145'),'foreignKey':_0xedac('0x143')});db[_0xedac('0x1a')][_0xedac('0x10a')](db[_0xedac('0x10f')],{'as':_0xedac('0x10f'),'foreignKey':_0xedac('0x143')});db[_0xedac('0x1a')][_0xedac('0x10a')](db[_0xedac('0x146')],{'as':'HopperBlacks','foreignKey':_0xedac('0x143')});db[_0xedac('0x1a')][_0xedac('0x10a')](db[_0xedac('0x147')],{'as':'JscriptySessions','foreignKey':_0xedac('0x143')});db[_0xedac('0x1a')][_0xedac('0x117')](db[_0xedac('0x148')],{'as':'Trunk','foreignKey':_0xedac('0x149')});db[_0xedac('0x1a')]['belongsTo'](db[_0xedac('0x148')],{'as':'TrunkBackup','foreignKey':_0xedac('0x14a')});db[_0xedac('0x1a')][_0xedac('0x117')](db[_0xedac('0x84')],{'as':_0xedac('0x84'),'foreignKey':_0xedac('0x14b')});db[_0xedac('0x1a')]['belongsTo'](db[_0xedac('0x86')],{'as':_0xedac('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xedac('0x11a')](db[_0xedac('0xf2')],{'as':_0xedac('0x11f'),'through':_0xedac('0x14d')});db[_0xedac('0x1a')]['belongsToMany'](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0xedac('0xde')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xedac('0x1a')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0xedac('0x14f')});db[_0xedac('0x1c')]['belongsTo'](db[_0xedac('0x12')],{'as':_0xedac('0x12'),'foreignKey':'UserId'});db[_0xedac('0x1d')][_0xedac('0x117')](db[_0xedac('0x12')],{'as':_0xedac('0x12'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x1f')]['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x150'),'sourceKey':_0xedac('0x151')});db[_0xedac('0x21')]['belongsTo'](db[_0xedac('0x1f')],{'foreignKey':_0xedac('0x150'),'targetKey':'mailbox'});db[_0xedac('0x23')][_0xedac('0x10a')](db[_0xedac('0x152')],{'as':_0xedac('0x153'),'foreignKey':_0xedac('0x154'),'constraints':![]});db[_0xedac('0x23')][_0xedac('0x10a')](db[_0xedac('0x155')],{'as':'AgentReports','foreignKey':_0xedac('0x154'),'constraints':![]});db[_0xedac('0x23')][_0xedac('0x117')](db['User'],{'as':_0xedac('0x12'),'foreignKey':_0xedac('0x109')});db['VoiceCallReport'][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db[_0xedac('0x3b')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xedac('0x158')});db[_0xedac('0x3d')][_0xedac('0x117')](db[_0xedac('0x3f')],{'as':_0xedac('0x3f'),'foreignKey':'MailAccountId'});db[_0xedac('0x3f')]['hasOne'](db[_0xedac('0x3b')],{'as':_0xedac('0x159'),'onDelete':_0xedac('0x108')});db['MailAccount']['hasOne'](db[_0xedac('0x3d')],{'as':_0xedac('0x15a'),'onDelete':_0xedac('0x108')});db['MailAccount'][_0xedac('0x10a')](db[_0xedac('0x82')],{'as':_0xedac('0x15b'),'foreignKey':_0xedac('0x158'),'onDelete':_0xedac('0x108')});db['MailAccount'][_0xedac('0x10a')](db[_0xedac('0x80')],{'as':_0xedac('0x15c'),'foreignKey':'MailAccountId'});db[_0xedac('0x3f')][_0xedac('0x10a')](db[_0xedac('0x44')],{'as':'Messages','foreignKey':_0xedac('0x158')});db[_0xedac('0x3f')][_0xedac('0x10a')](db[_0xedac('0x42')],{'as':'Interactions'});db[_0xedac('0x3f')][_0xedac('0x10a')](db[_0xedac('0x45')],{'as':_0xedac('0x13d')});db[_0xedac('0x3f')]['belongsTo'](db[_0xedac('0xf2')],{'as':'List','foreignKey':_0xedac('0x15d')});db['MailAccount'][_0xedac('0x117')](db[_0xedac('0x91')],{'as':'Template','foreignKey':_0xedac('0x15e')});db[_0xedac('0x3f')]['belongsTo'](db['Pause'],{'as':_0xedac('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':_0xedac('0x134')});db[_0xedac('0x40')][_0xedac('0x11a')](db['User'],{'as':_0xedac('0x14e'),'through':_0xedac('0x31')});db['MailQueue'][_0xedac('0x11a')](db['Team'],{'through':_0xedac('0x15f'),'as':_0xedac('0x160')});db['MailInteraction'][_0xedac('0x10a')](db[_0xedac('0x44')],{'as':_0xedac('0x161'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x162')});db['MailInteraction'][_0xedac('0x117')](db[_0xedac('0x3f')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x158')});db[_0xedac('0x42')][_0xedac('0x117')](db['CmContact'],{'as':_0xedac('0x156'),'foreignKey':'ContactId'});db[_0xedac('0x42')][_0xedac('0x117')](db[_0xedac('0x12')],{'as':'Owner','foreignKey':_0xedac('0x109')});db[_0xedac('0x42')][_0xedac('0x11a')](db[_0xedac('0x8f')],{'through':'mail_interaction_has_tags','as':_0xedac('0x164')});db[_0xedac('0x42')][_0xedac('0x11a')](db[_0xedac('0x8f')],{'through':_0xedac('0x165'),'as':_0xedac('0x166')});db[_0xedac('0x42')][_0xedac('0x11a')](db['User'],{'as':_0xedac('0x167'),'through':_0xedac('0x122'),'foreignKey':'MailInteractionId'});db[_0xedac('0x44')]['hasMany'](db[_0xedac('0xe6')],{'as':_0xedac('0x168'),'onDelete':_0xedac('0x108')});db[_0xedac('0x44')][_0xedac('0x117')](db[_0xedac('0x12')],{'as':'User'});db['MailMessage'][_0xedac('0x117')](db[_0xedac('0x11c')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x156')});db[_0xedac('0x44')][_0xedac('0x117')](db[_0xedac('0x42')],{'as':_0xedac('0x169'),'foreignKey':_0xedac('0x162')});db[_0xedac('0x44')][_0xedac('0x117')](db[_0xedac('0x3f')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x158')});db[_0xedac('0x44')]['belongsTo'](db['ChatWebsite'],{'as':_0xedac('0x66'),'foreignKey':_0xedac('0x16a')});db[_0xedac('0x44')][_0xedac('0x117')](db[_0xedac('0x6e')],{'as':_0xedac('0x6e'),'foreignKey':_0xedac('0x16b')});db[_0xedac('0x45')][_0xedac('0x117')](db[_0xedac('0x12')],{'onDelete':'restrict'});db[_0xedac('0x45')]['belongsTo'](db[_0xedac('0x40')],{'onDelete':'restrict'});db['MailApplication'][_0xedac('0x117')](db[_0xedac('0x3f')],{'onDelete':_0xedac('0x16c')});db[_0xedac('0x45')][_0xedac('0x117')](db[_0xedac('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xedac('0x45')][_0xedac('0x117')](db[_0xedac('0x8f')],{'onDelete':_0xedac('0x16c'),'foreignKey':_0xedac('0x16d')});db[_0xedac('0x47')][_0xedac('0x117')](db['MailAccount'],{});db[_0xedac('0x47')][_0xedac('0x117')](db['CmList'],{'as':_0xedac('0x16e'),'foreignKey':_0xedac('0x15d')});db[_0xedac('0x47')][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db[_0xedac('0x47')][_0xedac('0x117')](db['MailInteraction'],{});db[_0xedac('0x47')][_0xedac('0x117')](db[_0xedac('0x44')],{});db[_0xedac('0x47')][_0xedac('0x117')](db[_0xedac('0x12')],{});db[_0xedac('0x47')][_0xedac('0x117')](db[_0xedac('0x40')],{});db[_0xedac('0x49')][_0xedac('0x10a')](db[_0xedac('0x4b')],{'as':_0xedac('0x16f'),'onDelete':'cascade'});db['FaxAccount'][_0xedac('0x10a')](db[_0xedac('0x82')],{'as':_0xedac('0x15b'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0xedac('0x4d')][_0xedac('0x10a')](db[_0xedac('0x80')],{'as':_0xedac('0x15c'),'foreignKey':_0xedac('0x170')});db['FaxAccount'][_0xedac('0x10a')](db[_0xedac('0x50')],{'as':_0xedac('0x171')});db[_0xedac('0x4d')][_0xedac('0x10a')](db['FaxApplication'],{'as':'Applications'});db[_0xedac('0x4d')]['hasMany'](db[_0xedac('0x18')],{'as':_0xedac('0x172'),'onDelete':_0xedac('0x108')});db['FaxAccount']['hasMany'](db[_0xedac('0x173')],{'as':'Messages'});db[_0xedac('0x4d')][_0xedac('0x117')](db[_0xedac('0x148')],{'as':_0xedac('0x148')});db[_0xedac('0x4d')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':_0xedac('0x16e'),'foreignKey':_0xedac('0x15d')});db['FaxAccount']['belongsTo'](db[_0xedac('0x86')],{'as':_0xedac('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xedac('0x4d')][_0xedac('0x11a')](db['User'],{'as':_0xedac('0x14e'),'through':_0xedac('0x132')});db['FaxApplication'][_0xedac('0x117')](db[_0xedac('0x12')],{'onDelete':_0xedac('0x16c')});db[_0xedac('0x4f')][_0xedac('0x117')](db[_0xedac('0x12b')],{'onDelete':_0xedac('0x16c')});db[_0xedac('0x4f')][_0xedac('0x117')](db['FaxAccount'],{'onDelete':_0xedac('0x16c')});db[_0xedac('0x4f')][_0xedac('0x117')](db[_0xedac('0x8f')],{'onDelete':'restrict','foreignKey':_0xedac('0x16d')});db['FaxInteraction'][_0xedac('0x10a')](db['FaxMessage'],{'as':'Messages','onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x174')});db[_0xedac('0x50')][_0xedac('0x117')](db[_0xedac('0x4d')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xedac('0x50')][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db[_0xedac('0x50')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xedac('0x109')});db[_0xedac('0x50')][_0xedac('0x11a')](db['Tag'],{'through':_0xedac('0x175'),'as':_0xedac('0x164')});db[_0xedac('0x50')][_0xedac('0x11a')](db[_0xedac('0x8f')],{'through':_0xedac('0x175'),'as':_0xedac('0x166')});db[_0xedac('0x50')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':'Users','through':_0xedac('0x123'),'foreignKey':_0xedac('0x174')});db[_0xedac('0x173')][_0xedac('0x117')](db[_0xedac('0x12')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x12')});db[_0xedac('0x173')][_0xedac('0x117')](db[_0xedac('0x50')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xedac('0x173')]['belongsTo'](db['CmContact'],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x156')});db[_0xedac('0x173')][_0xedac('0x117')](db[_0xedac('0xe6')],{'as':_0xedac('0xe6'),'foreignKey':_0xedac('0x176')});db[_0xedac('0x173')][_0xedac('0x117')](db[_0xedac('0x4d')],{'as':'Account','foreignKey':_0xedac('0x170')});db[_0xedac('0x12b')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':'UserFaxQueue'});db[_0xedac('0x12b')][_0xedac('0x11a')](db['Team'],{'through':_0xedac('0x177'),'as':_0xedac('0x160')});db['FaxQueueReport'][_0xedac('0x117')](db[_0xedac('0x4d')],{});db[_0xedac('0x178')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':_0xedac('0x16e'),'foreignKey':'ListId'});db[_0xedac('0x178')]['belongsTo'](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db[_0xedac('0x178')][_0xedac('0x117')](db[_0xedac('0x50')],{});db[_0xedac('0x178')][_0xedac('0x117')](db[_0xedac('0x173')],{});db['FaxQueueReport']['belongsTo'](db[_0xedac('0x12')],{});db[_0xedac('0x178')]['belongsTo'](db['FaxQueue'],{});db[_0xedac('0x54')][_0xedac('0x10a')](db[_0xedac('0x82')],{'as':_0xedac('0x15b'),'foreignKey':_0xedac('0x179'),'onDelete':_0xedac('0x108')});db[_0xedac('0x54')][_0xedac('0x10a')](db[_0xedac('0x80')],{'as':_0xedac('0x15c'),'foreignKey':_0xedac('0x179')});db['SmsAccount'][_0xedac('0x10a')](db[_0xedac('0x59')],{'as':_0xedac('0x161'),'foreignKey':_0xedac('0x179')});db[_0xedac('0x54')]['hasMany'](db[_0xedac('0x57')],{'as':'Interactions'});db['SmsAccount']['hasMany'](db[_0xedac('0x55')],{'as':_0xedac('0x13d')});db[_0xedac('0x54')]['belongsTo'](db[_0xedac('0xf2')],{'as':'List','foreignKey':'ListId'});db[_0xedac('0x54')][_0xedac('0x117')](db[_0xedac('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xedac('0x17a')});db[_0xedac('0x54')]['belongsToMany'](db[_0xedac('0x12')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0xedac('0x55')][_0xedac('0x117')](db[_0xedac('0x12')],{'onDelete':'restrict'});db[_0xedac('0x55')][_0xedac('0x117')](db[_0xedac('0x5b')],{'onDelete':_0xedac('0x16c')});db[_0xedac('0x55')][_0xedac('0x117')](db[_0xedac('0x54')],{'onDelete':_0xedac('0x16c')});db[_0xedac('0x55')][_0xedac('0x117')](db[_0xedac('0x84')],{'onDelete':_0xedac('0x16c'),'foreignKey':'IntervalId'});db[_0xedac('0x55')][_0xedac('0x117')](db[_0xedac('0x8f')],{'onDelete':_0xedac('0x16c'),'foreignKey':_0xedac('0x16d')});db[_0xedac('0x57')][_0xedac('0x10a')](db[_0xedac('0x59')],{'as':_0xedac('0x161'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x17b')});db[_0xedac('0x57')][_0xedac('0x117')](db[_0xedac('0x54')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x179')});db['SmsInteraction'][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db[_0xedac('0x57')][_0xedac('0x117')](db[_0xedac('0x12')],{'as':_0xedac('0x17c'),'foreignKey':'UserId'});db[_0xedac('0x57')][_0xedac('0x11a')](db[_0xedac('0x8f')],{'through':_0xedac('0x17d'),'as':_0xedac('0x164')});db['SmsInteraction']['belongsToMany'](db[_0xedac('0x8f')],{'through':_0xedac('0x17d'),'as':'ThroughTags'});db[_0xedac('0x57')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0xedac('0x17b')});db['SmsMessage'][_0xedac('0x117')](db['User'],{'as':_0xedac('0x12')});db['SmsMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x156')});db[_0xedac('0x59')][_0xedac('0x117')](db[_0xedac('0x57')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x169'),'foreignKey':_0xedac('0x17b')});db[_0xedac('0x59')]['belongsTo'](db[_0xedac('0x54')],{'as':'Account','foreignKey':_0xedac('0x179')});db[_0xedac('0x5b')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':'Agents','through':_0xedac('0x35'),'foreignKey':_0xedac('0x17e')});db['SmsQueue'][_0xedac('0x11a')](db[_0xedac('0xde')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xedac('0x5d')][_0xedac('0x10a')](db[_0xedac('0x82')],{'as':'Dispositions','foreignKey':_0xedac('0x17f'),'onDelete':_0xedac('0x108')});db['OpenchannelAccount']['hasMany'](db[_0xedac('0x80')],{'as':_0xedac('0x15c'),'foreignKey':_0xedac('0x17f')});db['OpenchannelAccount']['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0xedac('0x17f')});db[_0xedac('0x5d')]['hasMany'](db[_0xedac('0x62')],{'as':_0xedac('0x161'),'foreignKey':_0xedac('0x17f')});db[_0xedac('0x5d')][_0xedac('0x10a')](db[_0xedac('0x5f')],{'as':'Applications','foreignKey':_0xedac('0x17f')});db[_0xedac('0x5d')]['belongsTo'](db[_0xedac('0xf2')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0xedac('0x117')](db['Pause'],{'as':_0xedac('0x14c'),'foreignKey':_0xedac('0x17a')});db[_0xedac('0x5d')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':_0xedac('0x136')});db[_0xedac('0x5f')][_0xedac('0x117')](db['User'],{'onDelete':_0xedac('0x16c')});db['OpenchannelApplication'][_0xedac('0x117')](db[_0xedac('0x64')],{'onDelete':_0xedac('0x16c'),'foreignKey':_0xedac('0x180')});db['OpenchannelApplication']['belongsTo'](db[_0xedac('0x5d')],{'onDelete':_0xedac('0x16c'),'foreignKey':_0xedac('0x17f')});db[_0xedac('0x5f')]['belongsTo'](db[_0xedac('0x84')],{'onDelete':_0xedac('0x16c'),'foreignKey':_0xedac('0x14b')});db[_0xedac('0x5f')][_0xedac('0x117')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xedac('0x60')][_0xedac('0x10a')](db[_0xedac('0x62')],{'as':_0xedac('0x161'),'onDelete':'cascade','foreignKey':_0xedac('0x181')});db[_0xedac('0x60')][_0xedac('0x117')](db[_0xedac('0x5d')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x17f')});db[_0xedac('0x60')]['belongsTo'](db['CmContact'],{'as':_0xedac('0x156'),'foreignKey':'ContactId'});db[_0xedac('0x60')][_0xedac('0x117')](db[_0xedac('0x12')],{'as':_0xedac('0x17c'),'foreignKey':_0xedac('0x109')});db['OpenchannelInteraction'][_0xedac('0x11a')](db[_0xedac('0x8f')],{'through':_0xedac('0x182'),'as':_0xedac('0x164')});db[_0xedac('0x60')]['belongsToMany'](db['Tag'],{'through':_0xedac('0x182'),'as':_0xedac('0x166')});db[_0xedac('0x60')][_0xedac('0x11a')](db['User'],{'as':_0xedac('0x167'),'through':'user_has_openchannel_interactions','foreignKey':_0xedac('0x181')});db[_0xedac('0x62')][_0xedac('0x117')](db[_0xedac('0x12')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x12')});db['OpenchannelMessage'][_0xedac('0x117')](db[_0xedac('0x11c')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x156')});db[_0xedac('0x62')][_0xedac('0x117')](db[_0xedac('0x60')],{'onDelete':'cascade','as':_0xedac('0x169'),'foreignKey':_0xedac('0x181')});db['OpenchannelMessage'][_0xedac('0x117')](db[_0xedac('0xe6')],{'as':_0xedac('0xe6'),'foreignKey':_0xedac('0x176')});db['OpenchannelMessage'][_0xedac('0x117')](db[_0xedac('0x5d')],{'as':_0xedac('0x163'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':_0xedac('0x37'),'foreignKey':_0xedac('0x180')});db[_0xedac('0x64')][_0xedac('0x11a')](db[_0xedac('0xde')],{'through':_0xedac('0x183'),'as':_0xedac('0x160')});db[_0xedac('0x66')][_0xedac('0x10a')](db[_0xedac('0x82')],{'as':_0xedac('0x15b'),'foreignKey':_0xedac('0x16a'),'onDelete':_0xedac('0x108')});db[_0xedac('0x66')][_0xedac('0x10a')](db[_0xedac('0x80')],{'as':_0xedac('0x15c'),'foreignKey':_0xedac('0x16a')});db[_0xedac('0x66')][_0xedac('0x10a')](db[_0xedac('0x184')],{'as':_0xedac('0x185')});db[_0xedac('0x66')]['hasMany'](db[_0xedac('0x6c')],{'as':'Interactions'});db[_0xedac('0x66')][_0xedac('0x10a')](db[_0xedac('0x6a')],{'as':'Applications'});db[_0xedac('0x66')][_0xedac('0x10a')](db[_0xedac('0x6d')],{'as':_0xedac('0x161')});db[_0xedac('0x66')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':_0xedac('0x16e'),'foreignKey':'ListId'});db[_0xedac('0x66')][_0xedac('0x117')](db['Interval'],{'as':'Interval','foreignKey':_0xedac('0x14b')});db['ChatWebsite'][_0xedac('0x117')](db['MailAccount'],{'as':_0xedac('0x3f'),'foreignKey':_0xedac('0x158')});db[_0xedac('0x66')]['belongsTo'](db['Pause'],{'as':_0xedac('0x14c'),'foreignKey':_0xedac('0x17a')});db[_0xedac('0x66')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':_0xedac('0x131')});db[_0xedac('0x68')][_0xedac('0x117')](db[_0xedac('0x5d')],{});db[_0xedac('0x68')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':_0xedac('0x16e'),'foreignKey':_0xedac('0x15d')});db['OpenchannelQueueReport'][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':'ContactId'});db[_0xedac('0x68')][_0xedac('0x117')](db[_0xedac('0x60')],{});db[_0xedac('0x68')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xedac('0x68')][_0xedac('0x117')](db[_0xedac('0x12')],{});db[_0xedac('0x68')][_0xedac('0x117')](db[_0xedac('0x64')],{});db[_0xedac('0x6a')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':'UserId','onDelete':_0xedac('0x16c')});db[_0xedac('0x6a')][_0xedac('0x117')](db[_0xedac('0x70')],{'as':_0xedac('0x186'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0xedac('0x117')](db[_0xedac('0x66')],{'as':_0xedac('0x187'),'foreignKey':'ChatWebsiteId','onDelete':_0xedac('0x16c')});db[_0xedac('0x6a')][_0xedac('0x117')](db[_0xedac('0x8f')],{'onDelete':_0xedac('0x16c'),'foreignKey':'TagId'});db[_0xedac('0x6c')][_0xedac('0x10a')](db[_0xedac('0x6d')],{'as':_0xedac('0x161'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x188')});db[_0xedac('0x6c')]['belongsTo'](db[_0xedac('0x66')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x16a')});db['ChatInteraction']['belongsTo'](db['CmContact'],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db['ChatInteraction'][_0xedac('0x117')](db[_0xedac('0x12')],{'as':'Owner','foreignKey':_0xedac('0x109')});db[_0xedac('0x6c')][_0xedac('0x11a')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xedac('0x164')});db[_0xedac('0x6c')][_0xedac('0x11a')](db['Tag'],{'through':_0xedac('0x189'),'as':'ThroughTags'});db[_0xedac('0x6c')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x167'),'through':_0xedac('0x18a'),'foreignKey':'ChatInteractionId'});db[_0xedac('0x6d')][_0xedac('0x117')](db[_0xedac('0x12')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x12')});db[_0xedac('0x6d')][_0xedac('0x117')](db[_0xedac('0x11c')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x156'),'foreignKey':'ContactId'});db[_0xedac('0x6d')][_0xedac('0x117')](db[_0xedac('0x6c')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x169'),'foreignKey':_0xedac('0x188')});db['ChatMessage'][_0xedac('0x117')](db[_0xedac('0xe6')],{'as':_0xedac('0xe6'),'foreignKey':_0xedac('0x176')});db[_0xedac('0x6d')][_0xedac('0x117')](db[_0xedac('0x66')],{'as':_0xedac('0x163'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xedac('0x10a')](db['Attachment'],{'as':_0xedac('0x168'),'foreignKey':_0xedac('0x16b'),'onDelete':_0xedac('0x108'),'hooks':!![]});db['ChatOfflineMessage'][_0xedac('0x117')](db[_0xedac('0x11c')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x156'),'foreignKey':'ContactId'});db[_0xedac('0x6e')][_0xedac('0x117')](db[_0xedac('0x66')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x16a')});db['ChatQueue']['belongsToMany'](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':_0xedac('0x12a'),'hooks':!![]});db[_0xedac('0x70')]['belongsToMany'](db[_0xedac('0xde')],{'through':'team_has_chat_queues','as':_0xedac('0x160')});db['ChatGroup'][_0xedac('0x10a')](db['ChatInternalMessage'],{'as':_0xedac('0x161'),'foreignKey':_0xedac('0x18b'),'onDelete':'cascade'});db[_0xedac('0x71')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':'Members','through':_0xedac('0x11b')});db['ChatProactiveAction'][_0xedac('0x117')](db[_0xedac('0x66')],{'as':_0xedac('0x187'),'foreignKey':_0xedac('0x16a')});db['CmCompany'][_0xedac('0x10a')](db[_0xedac('0x11c')],{'as':_0xedac('0x11d'),'foreignKey':'CompanyId'});db['CmContact'][_0xedac('0x10a')](db[_0xedac('0x76')],{'as':'Hoppers','foreignKey':_0xedac('0x157')});db[_0xedac('0x11c')][_0xedac('0x10a')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xedac('0x157')});db[_0xedac('0x11c')][_0xedac('0x10a')](db[_0xedac('0x7b')],{'as':_0xedac('0x145'),'foreignKey':_0xedac('0x157')});db[_0xedac('0x11c')][_0xedac('0x10a')](db[_0xedac('0x10f')],{'as':_0xedac('0x10f'),'foreignKey':_0xedac('0x157')});db[_0xedac('0x11c')]['hasMany'](db[_0xedac('0x147')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0xedac('0x11c')][_0xedac('0x10a')](db[_0xedac('0x60')],{'as':_0xedac('0x110'),'foreignKey':_0xedac('0x157'),'onDelete':_0xedac('0x16c')});db[_0xedac('0x11c')][_0xedac('0x10a')](db['ChatInteraction'],{'as':_0xedac('0x111'),'foreignKey':_0xedac('0x157'),'onDelete':'restrict'});db['CmContact'][_0xedac('0x10a')](db[_0xedac('0x57')],{'as':_0xedac('0x112'),'foreignKey':_0xedac('0x157'),'onDelete':_0xedac('0x16c')});db[_0xedac('0x11c')]['hasMany'](db['FaxInteraction'],{'as':_0xedac('0x113'),'foreignKey':'ContactId','onDelete':_0xedac('0x16c')});db[_0xedac('0x11c')][_0xedac('0x10a')](db['MailInteraction'],{'as':_0xedac('0x114'),'foreignKey':_0xedac('0x157'),'onDelete':_0xedac('0x16c')});db[_0xedac('0x11c')]['belongsTo'](db['CmCompany'],{'as':_0xedac('0x18c'),'foreignKey':_0xedac('0x18d')});db[_0xedac('0x11c')]['belongsTo'](db['CmList'],{'as':_0xedac('0x16e'),'foreignKey':_0xedac('0x15d'),'onDelete':_0xedac('0x108')});db[_0xedac('0x11c')][_0xedac('0x11a')](db['User'],{'as':_0xedac('0x167'),'through':_0xedac('0x11e')});db[_0xedac('0x11c')]['belongsToMany'](db['Tag'],{'as':_0xedac('0x164'),'through':'cm_contact_has_tags'});db[_0xedac('0x11c')]['belongsToMany'](db['Tag'],{'through':_0xedac('0x18e'),'as':_0xedac('0x166')});db[_0xedac('0x76')][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':'ContactId','onDelete':_0xedac('0x108')});db[_0xedac('0x76')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':_0xedac('0x16e'),'foreignKey':'ListId','onDelete':_0xedac('0x108')});db[_0xedac('0x76')][_0xedac('0x117')](db[_0xedac('0x12')],{'as':_0xedac('0x18f'),'foreignKey':_0xedac('0x109')});db[_0xedac('0x76')][_0xedac('0x117')](db[_0xedac('0x1a')],{'as':_0xedac('0x186'),'foreignKey':_0xedac('0x143'),'onDelete':_0xedac('0x108')});db['CmHopper'][_0xedac('0x117')](db[_0xedac('0xe2')],{'as':_0xedac('0xe2'),'foreignKey':_0xedac('0x190'),'onDelete':_0xedac('0x108')});db['CmHopper'][_0xedac('0x117')](db[_0xedac('0x12')],{'as':'Owner','foreignKey':_0xedac('0x191')});db[_0xedac('0x146')][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':'ContactId','onDelete':_0xedac('0x108')});db[_0xedac('0x146')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':'List','foreignKey':_0xedac('0x15d'),'onDelete':_0xedac('0x108')});db[_0xedac('0x146')][_0xedac('0x117')](db[_0xedac('0x1a')],{'as':_0xedac('0x186'),'foreignKey':_0xedac('0x143'),'onDelete':_0xedac('0x108')});db[_0xedac('0x146')][_0xedac('0x117')](db[_0xedac('0xe2')],{'as':_0xedac('0xe2'),'foreignKey':_0xedac('0x190'),'onDelete':_0xedac('0x108')});db[_0xedac('0x192')][_0xedac('0x10a')](db[_0xedac('0x193')],{'as':{'plural':_0xedac('0x194'),'singular':'OneAll'},'foreignKey':_0xedac('0x195'),'onDelete':_0xedac('0x108'),'hooks':!![]});db[_0xedac('0x192')][_0xedac('0x10a')](db['Condition'],{'as':{'plural':_0xedac('0x196'),'singular':_0xedac('0x197')},'foreignKey':_0xedac('0x198'),'onDelete':_0xedac('0x108'),'hooks':!![]});db[_0xedac('0x192')][_0xedac('0x10a')](db[_0xedac('0x199')],{'as':_0xedac('0x19a'),'foreignKey':_0xedac('0x19b'),'onDelete':_0xedac('0x108'),'hooks':!![]});db['Disposition'][_0xedac('0x10a')](db[_0xedac('0x82')],{'as':_0xedac('0x15b'),'foreignKey':_0xedac('0x19c'),'onDelete':_0xedac('0x108')});db[_0xedac('0x84')][_0xedac('0x10a')](db['Interval'],{'as':'Intervals','foreignKey':_0xedac('0x14b'),'onDelete':_0xedac('0x108'),'hooks':!![],'required':![]});db[_0xedac('0x84')][_0xedac('0x10a')](db[_0xedac('0x18')],{'as':_0xedac('0x10c'),'foreignKey':_0xedac('0x14b'),'onDelete':_0xedac('0x16c')});db[_0xedac('0x84')]['hasMany'](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xedac('0x14b')});db[_0xedac('0x84')][_0xedac('0x10a')](db['ChatApplication'],{'as':_0xedac('0x19d'),'foreignKey':_0xedac('0x14b')});db[_0xedac('0x84')][_0xedac('0x10a')](db[_0xedac('0x4f')],{'as':_0xedac('0x19e'),'foreignKey':_0xedac('0x14b')});db[_0xedac('0x84')][_0xedac('0x10a')](db[_0xedac('0x55')],{'as':_0xedac('0x19f'),'foreignKey':_0xedac('0x14b')});db[_0xedac('0x8c')]['belongsTo'](db[_0xedac('0x3f')],{});db['Schedule'][_0xedac('0x117')](db[_0xedac('0x9a')],{'foreignKey':_0xedac('0x1a0')});db[_0xedac('0x8c')]['belongsTo'](db[_0xedac('0x99')],{'foreignKey':_0xedac('0x1a1')});db[_0xedac('0x13f')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xedac('0x1a2'),'through':_0xedac('0x141'),'onDelete':_0xedac('0x16c')});db[_0xedac('0x8f')][_0xedac('0x11a')](db[_0xedac('0x11c')],{'through':_0xedac('0x18e')});db[_0xedac('0x8f')][_0xedac('0x11a')](db[_0xedac('0x6c')],{'through':_0xedac('0x189')});db[_0xedac('0x8f')][_0xedac('0x11a')](db[_0xedac('0x42')],{'through':_0xedac('0x165')});db[_0xedac('0x8f')]['belongsToMany'](db[_0xedac('0x57')],{'through':_0xedac('0x17d')});db[_0xedac('0x8f')]['belongsToMany'](db[_0xedac('0x50')],{'through':_0xedac('0x175')});db[_0xedac('0x8f')]['belongsToMany'](db[_0xedac('0x60')],{'through':_0xedac('0x182')});db[_0xedac('0x8f')][_0xedac('0x11a')](db[_0xedac('0xfd')],{'through':_0xedac('0x1a3')});db[_0xedac('0x93')][_0xedac('0x10a')](db[_0xedac('0x193')],{'as':{'plural':_0xedac('0x1a4'),'singular':_0xedac('0x1a5')},'foreignKey':_0xedac('0x1a6'),'onDelete':_0xedac('0x108'),'hooks':!![]});db[_0xedac('0x93')]['hasMany'](db[_0xedac('0x193')],{'as':{'plural':_0xedac('0x1a7'),'singular':_0xedac('0x1a8')},'foreignKey':_0xedac('0x1a9'),'onDelete':_0xedac('0x108'),'hooks':!![]});db['Trigger'][_0xedac('0x10a')](db[_0xedac('0x199')],{'as':_0xedac('0x19a'),'foreignKey':_0xedac('0x1aa'),'onDelete':_0xedac('0x108'),'hooks':!![]});db[_0xedac('0x99')][_0xedac('0x10a')](db[_0xedac('0x9f')],{'as':'Fields','onDelete':_0xedac('0x108'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xedac('0x9a')][_0xedac('0x10a')](db[_0xedac('0x9f')],{'as':'Fields','onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xedac('0x1ab')][_0xedac('0x10a')](db[_0xedac('0x9f')],{'as':'Fields','onDelete':_0xedac('0x108'),'foreignKey':'MetricId'});db[_0xedac('0x9f')][_0xedac('0x117')](db[_0xedac('0x1ab')],{'foreignKey':_0xedac('0x1ac')});db['SalesforceAccount'][_0xedac('0x10a')](db[_0xedac('0x1ad')],{'as':_0xedac('0x1ae'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0x1ad')][_0xedac('0x10a')](db[_0xedac('0xa5')],{'as':_0xedac('0x1b0'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b1')});db[_0xedac('0x1ad')][_0xedac('0x10a')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xedac('0x108'),'foreignKey':'DescriptionId'});db[_0xedac('0x1ad')][_0xedac('0x10a')](db['SalesforceField'],{'as':_0xedac('0x1b2'),'onDelete':_0xedac('0x108'),'foreignKey':'FieldId'});db[_0xedac('0x1ad')][_0xedac('0x117')](db[_0xedac('0xa3')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db['SalesforceField'][_0xedac('0x10a')](db[_0xedac('0xa5')],{'as':_0xedac('0x1b3'),'foreignKey':_0xedac('0x1b1')});db[_0xedac('0xa5')][_0xedac('0x10a')](db['SalesforceField'],{'as':'Description','foreignKey':_0xedac('0x1b4')});db[_0xedac('0xa5')][_0xedac('0x10a')](db[_0xedac('0xa5')],{'as':'Field','foreignKey':_0xedac('0x1b5')});db[_0xedac('0xa5')][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':_0xedac('0x1b6'),'foreignKey':_0xedac('0x1b7')});db[_0xedac('0xa6')][_0xedac('0x10a')](db[_0xedac('0xa7')],{'as':'Configurations','onDelete':_0xedac('0x108'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0xedac('0x10a')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b1')});db[_0xedac('0xa7')][_0xedac('0x10a')](db[_0xedac('0x1b8')],{'as':'Descriptions','onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0xa7')][_0xedac('0x10a')](db[_0xedac('0x1b8')],{'as':_0xedac('0x1b2'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xedac('0xa7')][_0xedac('0x117')](db['SugarcrmAccount'],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0x1b8')][_0xedac('0x10a')](db[_0xedac('0x1b8')],{'as':_0xedac('0x1b3'),'foreignKey':'SubjectId'});db[_0xedac('0x1b8')][_0xedac('0x10a')](db['SugarcrmField'],{'as':_0xedac('0x1b9'),'foreignKey':'DescriptionId'});db[_0xedac('0x1b8')][_0xedac('0x10a')](db['SugarcrmField'],{'as':_0xedac('0x1ba'),'foreignKey':_0xedac('0x1b5')});db[_0xedac('0x1b8')][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':'Variable','foreignKey':_0xedac('0x1b7')});db['DeskAccount'][_0xedac('0x10a')](db[_0xedac('0x1bb')],{'as':_0xedac('0x1ae'),'onDelete':'cascade','foreignKey':_0xedac('0x1af')});db[_0xedac('0x1bb')][_0xedac('0x10a')](db[_0xedac('0xad')],{'as':_0xedac('0x1b0'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b1')});db[_0xedac('0x1bb')][_0xedac('0x10a')](db['DeskField'],{'as':_0xedac('0x1bc'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0x1bb')]['hasMany'](db[_0xedac('0xad')],{'as':_0xedac('0x1b2'),'onDelete':'cascade','foreignKey':_0xedac('0x1b5')});db[_0xedac('0x1bb')][_0xedac('0x117')](db[_0xedac('0xaa')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db['DeskConfiguration']['belongsToMany'](db[_0xedac('0x8f')],{'through':'int_desk_configuration_has_tags'});db[_0xedac('0xad')]['hasMany'](db['DeskField'],{'as':'Subject','foreignKey':_0xedac('0x1b1')});db[_0xedac('0xad')][_0xedac('0x10a')](db[_0xedac('0xad')],{'as':_0xedac('0x1b9'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0xad')][_0xedac('0x10a')](db[_0xedac('0xad')],{'as':_0xedac('0x1ba'),'foreignKey':_0xedac('0x1b5')});db[_0xedac('0xad')][_0xedac('0x117')](db['Variable'],{'as':'Variable','foreignKey':_0xedac('0x1b7')});db[_0xedac('0xae')][_0xedac('0x10a')](db['ZohoConfiguration'],{'as':_0xedac('0x1ae'),'onDelete':_0xedac('0x108'),'foreignKey':'AccountId'});db[_0xedac('0xaf')][_0xedac('0x10a')](db[_0xedac('0xb1')],{'as':_0xedac('0x1b0'),'onDelete':'cascade','foreignKey':_0xedac('0x1b1')});db[_0xedac('0xaf')][_0xedac('0x10a')](db[_0xedac('0xb1')],{'as':_0xedac('0x1bc'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0xaf')][_0xedac('0x10a')](db['ZohoField'],{'as':'Fields','onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b5')});db[_0xedac('0xaf')]['belongsTo'](db[_0xedac('0xae')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0xb1')][_0xedac('0x10a')](db[_0xedac('0xb1')],{'as':_0xedac('0x1b3'),'foreignKey':'SubjectId'});db[_0xedac('0xb1')][_0xedac('0x10a')](db[_0xedac('0xb1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xedac('0xb1')][_0xedac('0x10a')](db[_0xedac('0xb1')],{'as':_0xedac('0x1ba'),'foreignKey':'FieldId'});db[_0xedac('0xb1')][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':'Variable','foreignKey':_0xedac('0x1b7')});db[_0xedac('0x1bd')][_0xedac('0x10a')](db[_0xedac('0xb4')],{'as':_0xedac('0x1ae'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xedac('0xb4')]['hasMany'](db[_0xedac('0xb6')],{'as':_0xedac('0x1b0'),'foreignKey':_0xedac('0x1b1')});db[_0xedac('0xb4')][_0xedac('0x10a')](db[_0xedac('0xb6')],{'as':_0xedac('0x1bc'),'foreignKey':'DescriptionId'});db[_0xedac('0xb4')][_0xedac('0x10a')](db[_0xedac('0xb6')],{'as':_0xedac('0x1b2'),'foreignKey':_0xedac('0x1b5')});db['ZendeskConfiguration'][_0xedac('0x117')](db[_0xedac('0x1bd')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0xb4')]['belongsToMany'](db['Tag'],{'through':_0xedac('0x1be')});db[_0xedac('0xb6')][_0xedac('0x10a')](db[_0xedac('0xb6')],{'as':_0xedac('0x1b3'),'foreignKey':'SubjectId'});db[_0xedac('0xb6')]['hasMany'](db[_0xedac('0xb6')],{'as':_0xedac('0x1b9'),'foreignKey':'DescriptionId'});db[_0xedac('0xb6')][_0xedac('0x10a')](db['ZendeskField'],{'as':_0xedac('0x1ba'),'foreignKey':_0xedac('0x1b5')});db[_0xedac('0xb6')][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':_0xedac('0x1b6'),'foreignKey':_0xedac('0x1b7')});db[_0xedac('0xb7')]['hasMany'](db[_0xedac('0xb9')],{'as':_0xedac('0x1ae'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0xb9')]['hasMany'](db[_0xedac('0xbb')],{'as':_0xedac('0x1b0'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b1')});db[_0xedac('0xb9')]['hasMany'](db[_0xedac('0xbb')],{'as':_0xedac('0x1bc'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b4')});db['FreshdeskConfiguration'][_0xedac('0x10a')](db[_0xedac('0xbb')],{'as':_0xedac('0x1b2'),'onDelete':_0xedac('0x108'),'foreignKey':'FieldId'});db[_0xedac('0xb9')][_0xedac('0x117')](db['FreshdeskAccount'],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db['FreshdeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0xedac('0x1bf')});db[_0xedac('0xbb')][_0xedac('0x10a')](db['FreshdeskField'],{'as':_0xedac('0x1b3'),'foreignKey':_0xedac('0x1b1')});db['FreshdeskField']['hasMany'](db[_0xedac('0xbb')],{'as':_0xedac('0x1b9'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0xbb')][_0xedac('0x10a')](db[_0xedac('0xbb')],{'as':_0xedac('0x1ba'),'foreignKey':'FieldId'});db[_0xedac('0xbb')][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':_0xedac('0x1b6'),'foreignKey':_0xedac('0x1b7')});db[_0xedac('0xbc')][_0xedac('0x10a')](db[_0xedac('0xbe')],{'as':'Configurations','onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1af')});db['VtigerConfiguration'][_0xedac('0x10a')](db[_0xedac('0xc0')],{'as':'Subjects','foreignKey':_0xedac('0x1b1')});db[_0xedac('0xbe')][_0xedac('0x10a')](db[_0xedac('0xc0')],{'as':_0xedac('0x1bc'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0xbe')]['hasMany'](db[_0xedac('0xc0')],{'as':'Fields','foreignKey':_0xedac('0x1b5')});db['VtigerConfiguration']['belongsTo'](db[_0xedac('0xbc')],{'as':'Account','foreignKey':_0xedac('0x1af')});db[_0xedac('0xc0')][_0xedac('0x10a')](db[_0xedac('0xc0')],{'as':_0xedac('0x1b3'),'foreignKey':'SubjectId'});db[_0xedac('0xc0')]['hasMany'](db['VtigerField'],{'as':_0xedac('0x1b9'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0xc0')][_0xedac('0x10a')](db[_0xedac('0xc0')],{'as':_0xedac('0x1ba'),'foreignKey':_0xedac('0x1b5')});db['VtigerField'][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':_0xedac('0x1b6'),'foreignKey':'VariableId'});db[_0xedac('0x1c0')]['hasMany'](db[_0xedac('0x1c1')],{'as':_0xedac('0x1ae'),'onDelete':'cascade','foreignKey':_0xedac('0x1af')});db[_0xedac('0x1c1')][_0xedac('0x10a')](db[_0xedac('0xc3')],{'as':_0xedac('0x1b0'),'foreignKey':'SubjectId'});db[_0xedac('0x1c1')][_0xedac('0x10a')](db['ServicenowField'],{'as':_0xedac('0x1bc'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0x1c1')][_0xedac('0x10a')](db[_0xedac('0xc3')],{'as':'Fields','foreignKey':_0xedac('0x1b5')});db[_0xedac('0x1c1')][_0xedac('0x117')](db['ServicenowAccount'],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0xc3')][_0xedac('0x10a')](db[_0xedac('0xc3')],{'as':'Subject','foreignKey':_0xedac('0x1b1')});db[_0xedac('0xc3')]['hasMany'](db[_0xedac('0xc3')],{'as':'Description','foreignKey':'DescriptionId'});db['ServicenowField'][_0xedac('0x10a')](db[_0xedac('0xc3')],{'as':_0xedac('0x1ba'),'foreignKey':_0xedac('0x1b5')});db['ServicenowField'][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':_0xedac('0x1b6'),'foreignKey':_0xedac('0x1b7')});db[_0xedac('0xc4')][_0xedac('0x10a')](db[_0xedac('0xc5')],{'as':_0xedac('0x1ae'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xedac('0xc5')][_0xedac('0x10a')](db[_0xedac('0xc6')],{'as':_0xedac('0x1b0'),'onDelete':_0xedac('0x108'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db[_0xedac('0xc6')],{'as':_0xedac('0x1bc'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1b4')});db['Dynamics365Configuration'][_0xedac('0x10a')](db[_0xedac('0xc6')],{'as':_0xedac('0x1b2'),'onDelete':_0xedac('0x108'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xedac('0x117')](db[_0xedac('0xc4')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':_0xedac('0x1b3'),'foreignKey':'SubjectId'});db[_0xedac('0xc6')][_0xedac('0x10a')](db[_0xedac('0xc6')],{'as':_0xedac('0x1b9'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0xc6')][_0xedac('0x10a')](db[_0xedac('0xc6')],{'as':_0xedac('0x1ba'),'foreignKey':_0xedac('0x1b5')});db['Dynamics365Field'][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':_0xedac('0x1b6'),'foreignKey':'VariableId'});db[_0xedac('0x1c2')][_0xedac('0x10a')](db[_0xedac('0x1c3')],{'as':_0xedac('0x1ae'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1af')});db[_0xedac('0x1c3')][_0xedac('0x10a')](db['FreshsalesField'],{'as':_0xedac('0x1b0'),'foreignKey':_0xedac('0x1b1')});db['FreshsalesConfiguration'][_0xedac('0x10a')](db[_0xedac('0xca')],{'as':_0xedac('0x1bc'),'foreignKey':_0xedac('0x1b4')});db[_0xedac('0x1c3')][_0xedac('0x10a')](db['FreshsalesField'],{'as':_0xedac('0x1b2'),'foreignKey':'FieldId'});db[_0xedac('0x1c3')][_0xedac('0x117')](db['FreshsalesAccount'],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1af')});db['FreshsalesField'][_0xedac('0x10a')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xedac('0x1b1')});db['FreshsalesField'][_0xedac('0x10a')](db[_0xedac('0xca')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xedac('0xca')][_0xedac('0x10a')](db['FreshsalesField'],{'as':_0xedac('0x1ba'),'foreignKey':_0xedac('0x1b5')});db[_0xedac('0xca')][_0xedac('0x117')](db[_0xedac('0x1b6')],{'as':_0xedac('0x1b6'),'foreignKey':'VariableId'});db[_0xedac('0x1c4')][_0xedac('0x117')](db[_0xedac('0x66')],{});db['ChatQueueReport'][_0xedac('0x117')](db['CmList'],{'as':_0xedac('0x16e'),'foreignKey':_0xedac('0x15d')});db['ChatQueueReport'][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':'ContactId'});db[_0xedac('0x1c4')][_0xedac('0x117')](db[_0xedac('0x6c')],{});db[_0xedac('0x1c4')][_0xedac('0x117')](db['ChatMessage'],{});db[_0xedac('0x1c4')][_0xedac('0x117')](db['User'],{});db[_0xedac('0x1c4')]['belongsTo'](db[_0xedac('0x70')],{});db['ChatInternalMessage']['belongsTo'](db[_0xedac('0x12')],{'onDelete':_0xedac('0x108'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0xedac('0x117')](db[_0xedac('0x12')],{'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1c5')});db[_0xedac('0x147')][_0xedac('0x10a')](db['JscriptyQuestionReport'],{'foreignKey':_0xedac('0x1c6'),'onDelete':_0xedac('0x108')});db[_0xedac('0x147')]['hasMany'](db[_0xedac('0xcf')],{'foreignKey':_0xedac('0x1c6'),'onDelete':'cascade'});db[_0xedac('0xd3')]['belongsTo'](db[_0xedac('0x54')],{});db[_0xedac('0xd3')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':_0xedac('0x16e'),'foreignKey':_0xedac('0x15d')});db[_0xedac('0xd3')][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db[_0xedac('0xd3')][_0xedac('0x117')](db[_0xedac('0x57')],{});db[_0xedac('0xd3')][_0xedac('0x117')](db[_0xedac('0x59')],{});db[_0xedac('0xd3')]['belongsTo'](db[_0xedac('0x12')],{});db[_0xedac('0xd3')][_0xedac('0x117')](db['SmsQueue'],{});db[_0xedac('0x1c7')][_0xedac('0x10a')](db[_0xedac('0x147')],{'foreignKey':_0xedac('0x1c8')});db[_0xedac('0x1c7')][_0xedac('0x10a')](db[_0xedac('0x1c9')],{'foreignKey':_0xedac('0x1c8')});db[_0xedac('0x1c7')]['hasMany'](db[_0xedac('0xcf')],{'foreignKey':'ProjectId'});db['SquareProject'][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':'Users','through':_0xedac('0x1ca')});db[_0xedac('0xde')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':_0xedac('0x121')});db[_0xedac('0xde')][_0xedac('0x11a')](db['VoiceQueue'],{'through':_0xedac('0x1cb'),'as':_0xedac('0x127')});db['Team']['belongsToMany'](db[_0xedac('0x40')],{'through':'team_has_mail_queues','as':_0xedac('0x128')});db[_0xedac('0xde')][_0xedac('0x11a')](db[_0xedac('0x70')],{'through':_0xedac('0x1cc'),'as':_0xedac('0x129')});db[_0xedac('0xde')][_0xedac('0x11a')](db[_0xedac('0x12b')],{'through':_0xedac('0x177'),'as':_0xedac('0x12c')});db[_0xedac('0xde')][_0xedac('0x11a')](db[_0xedac('0x5b')],{'through':_0xedac('0x1cd'),'as':_0xedac('0x12d')});db[_0xedac('0xde')][_0xedac('0x11a')](db['OpenchannelQueue'],{'through':_0xedac('0x183'),'as':_0xedac('0x12e')});db[_0xedac('0xde')]['belongsToMany'](db[_0xedac('0x12f')],{'through':_0xedac('0x1ce'),'as':_0xedac('0x130')});db[_0xedac('0xde')][_0xedac('0x11a')](db[_0xedac('0xf4')],{'through':_0xedac('0x1cf'),'as':_0xedac('0x1d0')});db[_0xedac('0xe2')][_0xedac('0x10a')](db[_0xedac('0x76')],{'as':_0xedac('0x144'),'foreignKey':_0xedac('0x190')});db[_0xedac('0xe2')]['hasMany'](db[_0xedac('0x79')],{'as':'HopperFinals','foreignKey':_0xedac('0x190')});db['Campaign'][_0xedac('0x10a')](db[_0xedac('0x7b')],{'as':_0xedac('0x145'),'foreignKey':_0xedac('0x190')});db[_0xedac('0xe2')][_0xedac('0x10a')](db['CmHopperBlack'],{'as':_0xedac('0x1d1'),'foreignKey':_0xedac('0x190')});db[_0xedac('0xe2')][_0xedac('0x117')](db['Trunk'],{'as':_0xedac('0x148'),'foreignKey':_0xedac('0x149')});db[_0xedac('0xe2')][_0xedac('0x117')](db[_0xedac('0x148')],{'as':'TrunkBackup','foreignKey':_0xedac('0x14a')});db['Campaign'][_0xedac('0x117')](db[_0xedac('0x84')],{'as':_0xedac('0x84'),'foreignKey':'IntervalId'});db[_0xedac('0xe2')][_0xedac('0x117')](db[_0xedac('0xdb')],{'as':_0xedac('0xdb'),'foreignKey':_0xedac('0x1d2')});db[_0xedac('0xe2')][_0xedac('0x11a')](db[_0xedac('0xf2')],{'as':_0xedac('0x11f'),'through':_0xedac('0x1d3')});db['Campaign'][_0xedac('0x11a')](db[_0xedac('0xf2')],{'as':_0xedac('0x1d4'),'through':_0xedac('0x1d5')});db[_0xedac('0xe6')][_0xedac('0x117')](db['ChatOfflineMessage'],{'as':_0xedac('0x6e'),'foreignKey':_0xedac('0x16b')});db[_0xedac('0xe9')]['belongsTo'](db[_0xedac('0x44')],{});db['MailTransferReport'][_0xedac('0x117')](db[_0xedac('0x42')],{});db[_0xedac('0xe9')][_0xedac('0x117')](db[_0xedac('0x3f')],{'foreignKey':_0xedac('0x1d6'),'as':_0xedac('0x1d7')});db[_0xedac('0xe9')][_0xedac('0x117')](db[_0xedac('0x12')],{'foreignKey':_0xedac('0x1d8'),'as':_0xedac('0x1d9')});db['MailTransferReport'][_0xedac('0x117')](db[_0xedac('0x12')],{'foreignKey':_0xedac('0x1da'),'as':_0xedac('0x1db')});db[_0xedac('0xe9')][_0xedac('0x117')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xedac('0x1dc')});db['MailTransferReport'][_0xedac('0x117')](db[_0xedac('0x3f')],{'foreignKey':_0xedac('0x1dd'),'as':_0xedac('0x1de')});db[_0xedac('0xeb')][_0xedac('0x117')](db[_0xedac('0x6d')],{});db[_0xedac('0xeb')][_0xedac('0x117')](db[_0xedac('0x6c')],{});db['ChatTransferReport'][_0xedac('0x117')](db[_0xedac('0x66')],{'foreignKey':'FromChatWebsiteId','as':_0xedac('0x1d7')});db[_0xedac('0xeb')][_0xedac('0x117')](db['User'],{'foreignKey':_0xedac('0x1d8'),'as':_0xedac('0x1d9')});db[_0xedac('0xeb')][_0xedac('0x117')](db[_0xedac('0x12')],{'foreignKey':_0xedac('0x1da'),'as':'ToAgent'});db[_0xedac('0xeb')][_0xedac('0x117')](db['ChatQueue'],{'foreignKey':_0xedac('0x1df'),'as':_0xedac('0x1dc')});db[_0xedac('0xeb')][_0xedac('0x117')](db['ChatWebsite'],{'foreignKey':_0xedac('0x1e0'),'as':_0xedac('0x1de')});db[_0xedac('0xed')]['belongsTo'](db[_0xedac('0x173')],{});db[_0xedac('0xed')]['belongsTo'](db[_0xedac('0x50')],{});db[_0xedac('0xed')][_0xedac('0x117')](db['FaxAccount'],{'foreignKey':_0xedac('0x1e1'),'as':_0xedac('0x1d7')});db['FaxTransferReport']['belongsTo'](db[_0xedac('0x12')],{'foreignKey':_0xedac('0x1d8'),'as':'FromAgent'});db[_0xedac('0xed')][_0xedac('0x117')](db[_0xedac('0x12')],{'foreignKey':'ToUserId','as':_0xedac('0x1db')});db[_0xedac('0xed')][_0xedac('0x117')](db[_0xedac('0x12b')],{'foreignKey':_0xedac('0x1e2'),'as':'ToQueue'});db[_0xedac('0xed')][_0xedac('0x117')](db[_0xedac('0x4d')],{'foreignKey':_0xedac('0x1e3'),'as':_0xedac('0x1de')});db[_0xedac('0xee')][_0xedac('0x117')](db[_0xedac('0x62')],{});db[_0xedac('0xee')]['belongsTo'](db[_0xedac('0x60')],{});db[_0xedac('0xee')][_0xedac('0x117')](db[_0xedac('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0xedac('0x1d7')});db['OpenchannelTransferReport'][_0xedac('0x117')](db[_0xedac('0x12')],{'foreignKey':'FromUserId','as':_0xedac('0x1d9')});db[_0xedac('0xee')][_0xedac('0x117')](db[_0xedac('0x12')],{'foreignKey':_0xedac('0x1da'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0xedac('0x117')](db[_0xedac('0x64')],{'foreignKey':_0xedac('0x1e4'),'as':_0xedac('0x1dc')});db[_0xedac('0xee')][_0xedac('0x117')](db[_0xedac('0x5d')],{'foreignKey':_0xedac('0x1e5'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0xedac('0x59')],{});db[_0xedac('0xf0')][_0xedac('0x117')](db[_0xedac('0x57')],{});db['SmsTransferReport']['belongsTo'](db[_0xedac('0x54')],{'foreignKey':_0xedac('0x1e6'),'as':_0xedac('0x1d7')});db['SmsTransferReport'][_0xedac('0x117')](db[_0xedac('0x12')],{'foreignKey':_0xedac('0x1d8'),'as':_0xedac('0x1d9')});db[_0xedac('0xf0')][_0xedac('0x117')](db['User'],{'foreignKey':_0xedac('0x1da'),'as':_0xedac('0x1db')});db[_0xedac('0xf0')][_0xedac('0x117')](db['SmsQueue'],{'foreignKey':_0xedac('0x1e7'),'as':_0xedac('0x1dc')});db[_0xedac('0xf0')][_0xedac('0x117')](db[_0xedac('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xedac('0xf2')][_0xedac('0x10a')](db[_0xedac('0x82')],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0xedac('0x108')});db[_0xedac('0xf2')][_0xedac('0x10a')](db[_0xedac('0x7d')],{'as':_0xedac('0x1e8'),'foreignKey':'ListId'});db[_0xedac('0xf2')]['hasMany'](db[_0xedac('0x11c')],{'as':_0xedac('0x11d'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x15d')});db['CmList'][_0xedac('0x10a')](db[_0xedac('0x79')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0xedac('0xf2')][_0xedac('0x10a')](db[_0xedac('0x7b')],{'as':_0xedac('0x10e'),'foreignKey':_0xedac('0x15d')});db['CmList'][_0xedac('0x10a')](db[_0xedac('0x10f')],{'as':_0xedac('0x10f'),'foreignKey':'ListId'});db[_0xedac('0xf2')][_0xedac('0x11a')](db[_0xedac('0x1a')],{'as':_0xedac('0x1e9'),'through':_0xedac('0x14d')});db[_0xedac('0xf2')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x14e'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0xedac('0x10a')](db[_0xedac('0x18')],{'as':'Extensions','onDelete':'cascade'});db[_0xedac('0xf4')]['belongsToMany'](db[_0xedac('0x12')],{'as':'Agents','through':_0xedac('0x107')});db[_0xedac('0xf4')]['belongsToMany'](db[_0xedac('0xde')],{'through':_0xedac('0x1cf'),'as':_0xedac('0x160')});db[_0xedac('0x118')][_0xedac('0x10a')](db[_0xedac('0x12')],{'as':'Users','foreignKey':_0xedac('0x119')});db[_0xedac('0x118')]['hasMany'](db[_0xedac('0xf6')],{'as':_0xedac('0x1ea'),'foreignKey':_0xedac('0x119'),'onDelete':_0xedac('0x108')});db['UserProfileSection'][_0xedac('0x10a')](db['UserProfileResource'],{'as':_0xedac('0x1eb'),'foreignKey':_0xedac('0x1ec'),'onDelete':_0xedac('0x108')});db[_0xedac('0xfb')][_0xedac('0x10a')](db['Disposition'],{'as':_0xedac('0x15b'),'foreignKey':_0xedac('0x1ed'),'onDelete':_0xedac('0x108')});db[_0xedac('0xfb')]['hasMany'](db[_0xedac('0x80')],{'as':'Answers','foreignKey':_0xedac('0x1ed')});db[_0xedac('0xfb')][_0xedac('0x10a')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0xedac('0x1ed')});db[_0xedac('0xfb')][_0xedac('0x10a')](db[_0xedac('0xfd')],{'as':_0xedac('0x171')});db[_0xedac('0xfb')][_0xedac('0x10a')](db[_0xedac('0x1ee')],{'as':_0xedac('0x13d')});db['WhatsappAccount']['belongsTo'](db[_0xedac('0xf2')],{'as':'List','foreignKey':_0xedac('0x15d')});db['WhatsappAccount']['belongsTo'](db['Pause'],{'as':_0xedac('0x14c'),'foreignKey':_0xedac('0x17a')});db[_0xedac('0xfb')][_0xedac('0x11a')](db['User'],{'as':_0xedac('0x14e'),'through':_0xedac('0x139')});db['WhatsappApplication'][_0xedac('0x117')](db['User'],{'onDelete':_0xedac('0x16c')});db['WhatsappApplication'][_0xedac('0x117')](db['WhatsappQueue'],{'onDelete':_0xedac('0x16c')});db[_0xedac('0x1ee')][_0xedac('0x117')](db[_0xedac('0xfb')],{'onDelete':_0xedac('0x16c')});db['WhatsappApplication'][_0xedac('0x117')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xedac('0x14b')});db['WhatsappApplication'][_0xedac('0x117')](db[_0xedac('0x8f')],{'onDelete':_0xedac('0x16c'),'foreignKey':'TagId'});db[_0xedac('0xfd')][_0xedac('0x10a')](db[_0xedac('0x1ef')],{'as':_0xedac('0x161'),'onDelete':_0xedac('0x108'),'foreignKey':_0xedac('0x1f0')});db[_0xedac('0xfd')][_0xedac('0x117')](db[_0xedac('0xfb')],{'as':_0xedac('0x163'),'foreignKey':_0xedac('0x1ed')});db[_0xedac('0xfd')][_0xedac('0x117')](db[_0xedac('0x11c')],{'as':'Contact','foreignKey':_0xedac('0x157')});db['WhatsappInteraction'][_0xedac('0x117')](db[_0xedac('0x12')],{'as':_0xedac('0x17c'),'foreignKey':_0xedac('0x109')});db[_0xedac('0xfd')][_0xedac('0x11a')](db['Tag'],{'through':_0xedac('0x1a3'),'as':_0xedac('0x164')});db[_0xedac('0xfd')]['belongsToMany'](db[_0xedac('0x8f')],{'through':_0xedac('0x1a3'),'as':_0xedac('0x166')});db[_0xedac('0xfd')][_0xedac('0x11a')](db[_0xedac('0x12')],{'as':_0xedac('0x167'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0xedac('0x1ef')][_0xedac('0x117')](db['User'],{'as':_0xedac('0x12')});db[_0xedac('0x1ef')][_0xedac('0x117')](db[_0xedac('0x11c')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x156')});db['WhatsappMessage'][_0xedac('0x117')](db[_0xedac('0xfd')],{'onDelete':_0xedac('0x108'),'as':_0xedac('0x169'),'foreignKey':_0xedac('0x1f0')});db[_0xedac('0x1ef')][_0xedac('0x117')](db[_0xedac('0xfb')],{'as':'Account','foreignKey':_0xedac('0x1ed')});db['WhatsappQueueReport'][_0xedac('0x117')](db[_0xedac('0xfb')],{});db[_0xedac('0x100')][_0xedac('0x117')](db[_0xedac('0xf2')],{'as':'List','foreignKey':_0xedac('0x15d')});db[_0xedac('0x100')]['belongsTo'](db[_0xedac('0x11c')],{'as':_0xedac('0x156'),'foreignKey':_0xedac('0x157')});db['WhatsappQueueReport'][_0xedac('0x117')](db[_0xedac('0xfd')],{});db[_0xedac('0x100')]['belongsTo'](db[_0xedac('0x12f')],{});db[_0xedac('0x100')][_0xedac('0x117')](db['WhatsappMessage'],{});db[_0xedac('0x100')]['belongsTo'](db['User'],{});db[_0xedac('0x1f1')][_0xedac('0x117')](db[_0xedac('0x1ef')],{});db['WhatsappTransferReport'][_0xedac('0x117')](db['WhatsappInteraction'],{});db[_0xedac('0x1f1')]['belongsTo'](db[_0xedac('0xfb')],{'foreignKey':_0xedac('0x1f2'),'as':_0xedac('0x1d7')});db[_0xedac('0x1f1')]['belongsTo'](db[_0xedac('0xfb')],{'foreignKey':_0xedac('0x1f3'),'as':'ToAccount'});db[_0xedac('0x1f1')][_0xedac('0x117')](db[_0xedac('0x12f')],{'foreignKey':_0xedac('0x1f4'),'as':_0xedac('0x1dc')});db[_0xedac('0x1f1')]['belongsTo'](db['User'],{'foreignKey':_0xedac('0x1d8'),'as':_0xedac('0x1d9')});db[_0xedac('0x1f1')][_0xedac('0x117')](db['User'],{'foreignKey':_0xedac('0x1da'),'as':_0xedac('0x1db')});db[_0xedac('0x12f')][_0xedac('0x11a')](db['User'],{'as':_0xedac('0x14e'),'through':_0xedac('0x39'),'foreignKey':_0xedac('0x1f5')});db[_0xedac('0x12f')][_0xedac('0x11a')](db['Team'],{'through':_0xedac('0x1ce'),'as':_0xedac('0x160')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b9c99f1..aa40ba2 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc07=['/api/variables','./api/variable','/api/integrations','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/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/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','lastName','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','@@{','includes','lodash','path','express','express-winston','./config/environment','./config/logger','api','auth','./safe-template','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','connection','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','headers','remoteAddress','role','device','other','agent_name','test','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','/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/faxAccount','/api/fax/applications','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger'];(function(_0x1d0f9c,_0x1d95d2){var _0x4231ff=function(_0x56be91){while(--_0x56be91){_0x1d0f9c['push'](_0x1d0f9c['shift']());}};_0x4231ff(++_0x1d95d2);}(_0xcc07,0xbb));var _0x7cc0=function(_0xd02def,_0x144f25){_0xd02def=_0xd02def-0x0;var _0x2e8374=_0xcc07[_0xd02def];return _0x2e8374;};'use strict';var _=require(_0x7cc0('0x0'));var path=require(_0x7cc0('0x1'));var express=require(_0x7cc0('0x2'));var ewinston=require(_0x7cc0('0x3'));var util=require('util');var errors=require('./errors');var config=require(_0x7cc0('0x4'));var logger=require(_0x7cc0('0x5'))(_0x7cc0('0x6'));var authLogger=require('./config/logger')(_0x7cc0('0x7'));var safeTemplate=require(_0x7cc0('0x8'))[_0x7cc0('0x9')];exports[_0x7cc0('0xa')]=function(_0x5f4a4b){_0x5f4a4b[_0x7cc0('0xb')](ewinston[_0x7cc0('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x20b1c3,_0x412eba){var _0x2c1f86=_0x7cc0('0xd');if(!_[_0x7cc0('0xe')](_0x20b1c3[_0x7cc0('0xf')])){_0x2c1f86+=_0x7cc0('0x10');var _0xf77b00=_0x20b1c3[_0x7cc0('0xf')];maskSensitiveData(_0xf77b00);}return safeTemplate(util[_0x7cc0('0x11')](_0x2c1f86,_0x20b1c3[_0x7cc0('0x12')],_0x20b1c3['headers'][_0x7cc0('0x13')]?_0x20b1c3['headers']['x-forwarded-for']:_0x20b1c3[_0x7cc0('0x14')]['remoteAddress']||_0x20b1c3['ip'],_0x20b1c3[_0x7cc0('0x15')],_0x412eba[_0x7cc0('0x16')],_0x412eba[_0x7cc0('0x17')],_0x20b1c3['user']?_0x20b1c3[_0x7cc0('0x18')]['id']:null,_0x20b1c3['user']?_0x20b1c3[_0x7cc0('0x18')][_0x7cc0('0x19')]:null,_0x20b1c3[_0x7cc0('0x18')]?_0x20b1c3['user']['role']:null,_0xf77b00?util[_0x7cc0('0x1a')](_0xf77b00,![],null):''));}}));_0x5f4a4b['use'](ewinston[_0x7cc0('0xc')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x561094,_0x49258d){var _0x2e479e=_0x7cc0('0x1b');if(_0x561094[_0x7cc0('0xf')]&&_0x561094[_0x7cc0('0xf')]['device']&&_0x561094[_0x7cc0('0xf')][_0x7cc0('0x1c')]){_0x2e479e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x7cc0('0x11')](_0x2e479e,_0x561094[_0x7cc0('0x12')],_0x561094[_0x7cc0('0x1d')][_0x7cc0('0x13')]?_0x561094[_0x7cc0('0x1d')][_0x7cc0('0x13')]:_0x561094['connection'][_0x7cc0('0x1e')]||_0x561094['ip'],_0x561094['url'],_0x49258d[_0x7cc0('0x16')],_0x49258d['responseTime'],_0x561094[_0x7cc0('0x18')]?_0x561094[_0x7cc0('0x18')]['id']:null,_0x561094[_0x7cc0('0x18')]?_0x561094[_0x7cc0('0x18')][_0x7cc0('0x19')]:null,_0x561094[_0x7cc0('0x18')]?_0x561094['user'][_0x7cc0('0x1f')]:null,_0x561094[_0x7cc0('0xf')]&&_0x561094['body'][_0x7cc0('0x20')]?_0x561094[_0x7cc0('0xf')][_0x7cc0('0x20')]:_0x7cc0('0x21'),_0x561094['body']&&_0x561094['body'][_0x7cc0('0x1c')]?_0x561094['body']['agent_id']:'',_0x561094[_0x7cc0('0xf')]&&_0x561094[_0x7cc0('0xf')]['agent_name']?_0x561094[_0x7cc0('0xf')][_0x7cc0('0x22')]:'');},'ignoreRoute':function(_0x3432f2){var _0x2bab4a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2bab4a[_0x7cc0('0x23')](_0x3432f2['url']);}}));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x24'),require('./api/user'));_0x5f4a4b[_0x7cc0('0xb')]('/api/voice/chanspy',require(_0x7cc0('0x25')));_0x5f4a4b['use'](_0x7cc0('0x26'),require(_0x7cc0('0x27')));_0x5f4a4b['use']('/api/voice/extensions',require(_0x7cc0('0x28')));_0x5f4a4b[_0x7cc0('0xb')]('/api/voice/mohs',require(_0x7cc0('0x29')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x2a'),require('./api/voiceQueue'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x2b'),require('./api/voiceRecording'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x2c'),require('./api/screenRecording'));_0x5f4a4b['use'](_0x7cc0('0x2d'),require(_0x7cc0('0x2e')));_0x5f4a4b['use'](_0x7cc0('0x2f'),require(_0x7cc0('0x30')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x31'),require(_0x7cc0('0x32')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x33'),require(_0x7cc0('0x34')));_0x5f4a4b[_0x7cc0('0xb')]('/api/voice/agents/reports',require(_0x7cc0('0x35')));_0x5f4a4b[_0x7cc0('0xb')]('/api/voice/queues/reports',require(_0x7cc0('0x36')));_0x5f4a4b['use'](_0x7cc0('0x37'),require('./api/memberReport'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x38'),require(_0x7cc0('0x39')));_0x5f4a4b['use'](_0x7cc0('0x3a'),require(_0x7cc0('0x3b')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x3c'),require('./api/mailServerOut'));_0x5f4a4b[_0x7cc0('0xb')]('/api/mail/accounts',require(_0x7cc0('0x3d')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x3e'),require('./api/mailQueue'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x3f'),require('./api/mailSubstatus'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x40'),require(_0x7cc0('0x41')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x42'),require(_0x7cc0('0x43')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x44'),require(_0x7cc0('0x45')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x46'),require(_0x7cc0('0x47')));_0x5f4a4b[_0x7cc0('0xb')]('/api/dashboards',require(_0x7cc0('0x48')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x49'),require(_0x7cc0('0x4a')));_0x5f4a4b[_0x7cc0('0xb')]('/api/fax/accounts',require(_0x7cc0('0x4b')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x4c'),require('./api/faxApplication'));_0x5f4a4b[_0x7cc0('0xb')]('/api/fax/interactions',require(_0x7cc0('0x4d')));_0x5f4a4b['use'](_0x7cc0('0x4e'),require(_0x7cc0('0x4f')));_0x5f4a4b[_0x7cc0('0xb')]('/api/fax/queues',require('./api/faxQueue'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x50'),require(_0x7cc0('0x51')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x52'),require('./api/smsAccount'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x53'),require('./api/smsApplication'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x54'),require(_0x7cc0('0x55')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x56'),require(_0x7cc0('0x57')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x58'),require(_0x7cc0('0x59')));_0x5f4a4b['use'](_0x7cc0('0x5a'),require(_0x7cc0('0x5b')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x5c'),require(_0x7cc0('0x5d')));_0x5f4a4b[_0x7cc0('0xb')]('/api/openchannel/interactions',require(_0x7cc0('0x5e')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x5f'),require(_0x7cc0('0x60')));_0x5f4a4b[_0x7cc0('0xb')]('/api/openchannel/queues',require(_0x7cc0('0x61')));_0x5f4a4b['use'](_0x7cc0('0x62'),require(_0x7cc0('0x63')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x64'),require('./api/openchannelQueueReport'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x65'),require(_0x7cc0('0x66')));_0x5f4a4b['use'](_0x7cc0('0x67'),require(_0x7cc0('0x68')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x69'),require(_0x7cc0('0x6a')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x6b'),require(_0x7cc0('0x6c')));_0x5f4a4b[_0x7cc0('0xb')]('/api/chat/queues',require('./api/chatQueue'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x6d'),require(_0x7cc0('0x6e')));_0x5f4a4b[_0x7cc0('0xb')]('/api/chat/proactive_actions',require(_0x7cc0('0x6f')));_0x5f4a4b[_0x7cc0('0xb')]('/api/cm/companies',require(_0x7cc0('0x70')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x71'),require('./api/cmContact'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x72'),require(_0x7cc0('0x73')));_0x5f4a4b[_0x7cc0('0xb')]('/api/cm/hopper_black',require(_0x7cc0('0x74')));_0x5f4a4b['use']('/api/cm/hopper_final',require(_0x7cc0('0x75')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x76'),require(_0x7cc0('0x77')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x78'),require(_0x7cc0('0x79')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x7a'),require(_0x7cc0('0x7b')));_0x5f4a4b['use'](_0x7cc0('0x7c'),require('./api/automation'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x7d'),require(_0x7cc0('0x7e')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x7f'),require(_0x7cc0('0x80')));_0x5f4a4b[_0x7cc0('0xb')]('/api/conditions',require(_0x7cc0('0x81')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x82'),require(_0x7cc0('0x83')));_0x5f4a4b[_0x7cc0('0xb')]('/api/pauses',require(_0x7cc0('0x84')));_0x5f4a4b['use']('/api/cdr',require('./api/cdr'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x85'),require(_0x7cc0('0x86')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x87'),require(_0x7cc0('0x88')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x89'),require(_0x7cc0('0x8a')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x8b'),require(_0x7cc0('0x8c')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x8d'),require(_0x7cc0('0x8e')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x8f'),require(_0x7cc0('0x90')));_0x5f4a4b['use'](_0x7cc0('0x91'),require(_0x7cc0('0x92')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x93'),require('./api/integration'));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/reports',require('./api/integrationReport'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x94'),require(_0x7cc0('0x95')));_0x5f4a4b['use']('/api/analytics/default_reports',require(_0x7cc0('0x96')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x97'),require(_0x7cc0('0x98')));_0x5f4a4b['use'](_0x7cc0('0x99'),require(_0x7cc0('0x9a')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x9b'),require('./api/analyticFieldReport'));_0x5f4a4b[_0x7cc0('0xb')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x9c'),require('./api/intSalesforceAccount'));_0x5f4a4b['use'](_0x7cc0('0x9d'),require(_0x7cc0('0x9e')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x9f'),require(_0x7cc0('0xa0')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xa1'),require(_0x7cc0('0xa2')));_0x5f4a4b['use'](_0x7cc0('0xa3'),require(_0x7cc0('0xa4')));_0x5f4a4b['use']('/api/integrations/sugarcrm/fields',require(_0x7cc0('0xa5')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xa6'),require(_0x7cc0('0xa7')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xa8'),require(_0x7cc0('0xa9')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xaa'),require(_0x7cc0('0xab')));_0x5f4a4b['use'](_0x7cc0('0xac'),require(_0x7cc0('0xad')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xae'),require(_0x7cc0('0xaf')));_0x5f4a4b['use']('/api/integrations/zoho/fields',require(_0x7cc0('0xb0')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xb1'),require(_0x7cc0('0xb2')));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/zendesk/configurations',require(_0x7cc0('0xb3')));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x5f4a4b['use'](_0x7cc0('0xb4'),require('./api/intFreshdeskAccount'));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/freshdesk/configurations',require(_0x7cc0('0xb5')));_0x5f4a4b['use'](_0x7cc0('0xb6'),require(_0x7cc0('0xb7')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xb8'),require(_0x7cc0('0xb9')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xba'),require('./api/intVtigerConfiguration'));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x5f4a4b['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x5f4a4b['use'](_0x7cc0('0xbb'),require(_0x7cc0('0xbc')));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/servicenow/fields',require(_0x7cc0('0xbd')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xbe'),require(_0x7cc0('0xbf')));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x5f4a4b['use'](_0x7cc0('0xc0'),require(_0x7cc0('0xc1')));_0x5f4a4b['use']('/api/integrations/freshsales/accounts',require(_0x7cc0('0xc2')));_0x5f4a4b[_0x7cc0('0xb')]('/api/integrations/freshsales/configurations',require(_0x7cc0('0xc3')));_0x5f4a4b['use'](_0x7cc0('0xc4'),require(_0x7cc0('0xc5')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xc6'),require('./api/network'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xc7'),require(_0x7cc0('0xc8')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xc9'),require(_0x7cc0('0xca')));_0x5f4a4b['use']('/api/jscripty/answers/reports',require(_0x7cc0('0xcb')));_0x5f4a4b[_0x7cc0('0xb')]('/api/jscripty/questions/reports',require(_0x7cc0('0xcc')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xcd'),require(_0x7cc0('0xce')));_0x5f4a4b[_0x7cc0('0xb')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xcf'),require(_0x7cc0('0xd0')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xd1'),require('./api/squareReportDetail'));_0x5f4a4b['use'](_0x7cc0('0xd2'),require(_0x7cc0('0xd3')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xd4'),require(_0x7cc0('0xd5')));_0x5f4a4b[_0x7cc0('0xb')]('/api/square/odbc',require('./api/squareOdbc'));_0x5f4a4b['use'](_0x7cc0('0xd6'),require('./api/squareProject'));_0x5f4a4b['use'](_0x7cc0('0xd7'),require(_0x7cc0('0xd8')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xd9'),require(_0x7cc0('0xda')));_0x5f4a4b[_0x7cc0('0xb')]('/api/teams',require(_0x7cc0('0xdb')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xdc'),require('./api/license'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xdd'),require(_0x7cc0('0xde')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xdf'),require(_0x7cc0('0xe0')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xe1'),require(_0x7cc0('0xe2')));_0x5f4a4b['use'](_0x7cc0('0xe3'),require(_0x7cc0('0xe4')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xe5'),require(_0x7cc0('0xe6')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xe7'),require(_0x7cc0('0xe8')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xe9'),require(_0x7cc0('0xea')));_0x5f4a4b['use']('/api/openchannel/reports/transfer',require(_0x7cc0('0xeb')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xec'),require(_0x7cc0('0xed')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xee'),require('./api/cmList'));_0x5f4a4b['use']('/api/voice/prefixes',require(_0x7cc0('0xef')));_0x5f4a4b[_0x7cc0('0xb')]('/api/userProfiles',require(_0x7cc0('0xf0')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xf1'),require(_0x7cc0('0xf2')));_0x5f4a4b['use'](_0x7cc0('0xf3'),require(_0x7cc0('0xf4')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xf5'),require(_0x7cc0('0xf6')));_0x5f4a4b[_0x7cc0('0xb')]('/api/whatsapp/accounts',require(_0x7cc0('0xf7')));_0x5f4a4b['use'](_0x7cc0('0xf8'),require(_0x7cc0('0xf9')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xfa'),require('./api/whatsappInteraction'));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xfb'),require('./api/whatsappMessage'));_0x5f4a4b[_0x7cc0('0xb')]('/api/whatsapp/reports/queue',require(_0x7cc0('0xfc')));_0x5f4a4b['use'](_0x7cc0('0xfd'),require(_0x7cc0('0xfe')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0xff'),require(_0x7cc0('0x100')));_0x5f4a4b['use'](_0x7cc0('0x101'),require(_0x7cc0('0x102')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x103'),require(_0x7cc0('0x104')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x105'),require(_0x7cc0('0x106')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x107'),require(_0x7cc0('0x108')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x109'),require(_0x7cc0('0x10a')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x10b'),require('./api/rpc'));_0x5f4a4b[_0x7cc0('0xb')]('/api/version',require(_0x7cc0('0x10c')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x10d'),require(_0x7cc0('0x10e')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x10f'),require(_0x7cc0('0x110')));_0x5f4a4b[_0x7cc0('0xb')]('/api/webbar',require(_0x7cc0('0x111')));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x112'),express[_0x7cc0('0x113')](path[_0x7cc0('0x114')](config[_0x7cc0('0x115')],_0x7cc0('0x112'))));_0x5f4a4b[_0x7cc0('0xb')](_0x7cc0('0x116'),express[_0x7cc0('0x113')](path[_0x7cc0('0x114')](config['root'],_0x7cc0('0x116'))));_0x5f4a4b[_0x7cc0('0xb')]('/demo',express['static'](path[_0x7cc0('0x114')](config[_0x7cc0('0x115')],_0x7cc0('0x117'))));_0x5f4a4b[_0x7cc0('0xb')]('/snippet',express[_0x7cc0('0x113')](path['join'](config[_0x7cc0('0x115')],_0x7cc0('0x118'),_0x7cc0('0x119'))));_0x5f4a4b[_0x7cc0('0xb')]('/plugins',express[_0x7cc0('0x113')](path[_0x7cc0('0x114')](config[_0x7cc0('0x115')],_0x7cc0('0x11a'))));_0x5f4a4b[_0x7cc0('0x11b')](_0x7cc0('0x11c'))[_0x7cc0('0x11d')](errors[0x194]);_0x5f4a4b[_0x7cc0('0x11b')]('/*')[_0x7cc0('0x11d')](function(_0x26eaab,_0x2f3466){_0x2f3466[_0x7cc0('0x11e')](path[_0x7cc0('0x11f')](_0x5f4a4b[_0x7cc0('0x11d')](_0x7cc0('0x120'))+_0x7cc0('0x121')));});};var sensitiveFields=[_0x7cc0('0x122'),_0x7cc0('0x123'),_0x7cc0('0x124'),_0x7cc0('0x125'),'firstName',_0x7cc0('0x126'),'street',_0x7cc0('0x127'),_0x7cc0('0x128'),_0x7cc0('0x129'),'email',_0x7cc0('0x12a'),_0x7cc0('0x12b'),_0x7cc0('0x12c'),_0x7cc0('0x12d'),_0x7cc0('0x12e'),_0x7cc0('0x12f'),_0x7cc0('0x130'),_0x7cc0('0x131'),'accessToken',_0x7cc0('0x132'),_0x7cc0('0x133'),_0x7cc0('0x134'),_0x7cc0('0x135'),_0x7cc0('0x136'),_0x7cc0('0x137'),_0x7cc0('0x138'),_0x7cc0('0x139'),_0x7cc0('0x13a'),_0x7cc0('0x13b'),_0x7cc0('0x13c'),_0x7cc0('0x13d'),_0x7cc0('0x13e'),'key',_0x7cc0('0x18'),_0x7cc0('0x13f'),_0x7cc0('0x140'),_0x7cc0('0x141'),_0x7cc0('0x142'),_0x7cc0('0x143'),_0x7cc0('0x144'),_0x7cc0('0x145')];function maskSensitiveData(_0x284b83){var _0x9c13ef=/(?!^)[\s\S](?!$)/g;if(!_[_0x7cc0('0x146')](_0x284b83))return;for(var _0x576181 in _0x284b83){if(_[_0x7cc0('0x147')](_0x284b83[_0x576181])){for(var _0xd5998a=0x0;_0xd5998a<_0x284b83[_0x576181][_0x7cc0('0x148')];_0xd5998a++){maskSensitiveData(_0x284b83[_0x576181][_0xd5998a]);}}else if(_['isPlainObject'](_0x284b83[_0x576181])){maskSensitiveData(_0x284b83[_0x576181]);}else if(_['isString'](_0x284b83[_0x576181])){_0x284b83[_0x576181]=_0x284b83[_0x576181][_0x7cc0('0x149')](/{{{/g,_0x7cc0('0x14a'))[_0x7cc0('0x149')](/}}}/g,'}@@')[_0x7cc0('0x149')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7cc0('0x14b')](sensitiveFields,_0x576181)){_0x284b83[_0x576181]=_0x284b83[_0x576181]['replace'](_0x9c13ef,'*');}}}} \ No newline at end of file +var _0xd4f0=['./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/messages','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','email','clientId','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','secretaccesskey','key','pass','accountSid','dsn','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','lodash','express','util','./errors','./config/environment','api','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','connection','url','statusCode','responseTime','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','x-forwarded-for','name','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport'];(function(_0x2418bd,_0x1ddd5){var _0x12d19c=function(_0x3fc285){while(--_0x3fc285){_0x2418bd['push'](_0x2418bd['shift']());}};_0x12d19c(++_0x1ddd5);}(_0xd4f0,0xa8));var _0x0d4f=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd4f0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0d4f('0x0'));var path=require('path');var express=require(_0x0d4f('0x1'));var ewinston=require('express-winston');var util=require(_0x0d4f('0x2'));var errors=require(_0x0d4f('0x3'));var config=require(_0x0d4f('0x4'));var logger=require('./config/logger')(_0x0d4f('0x5'));var authLogger=require('./config/logger')('auth');var safeTemplate=require('./safe-template')['safeTemplate'];exports['default']=function(_0x598cba){_0x598cba[_0x0d4f('0x6')](ewinston[_0x0d4f('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x52d2c1,_0x37dce0){var _0x511bc4=_0x0d4f('0x8');if(!_[_0x0d4f('0x9')](_0x52d2c1['body'])){_0x511bc4+=_0x0d4f('0xa');var _0x28c1c9=_0x52d2c1[_0x0d4f('0xb')];maskSensitiveData(_0x28c1c9);}return safeTemplate(util[_0x0d4f('0xc')](_0x511bc4,_0x52d2c1[_0x0d4f('0xd')],_0x52d2c1[_0x0d4f('0xe')]['x-forwarded-for']?_0x52d2c1[_0x0d4f('0xe')]['x-forwarded-for']:_0x52d2c1[_0x0d4f('0xf')]['remoteAddress']||_0x52d2c1['ip'],_0x52d2c1[_0x0d4f('0x10')],_0x37dce0[_0x0d4f('0x11')],_0x37dce0[_0x0d4f('0x12')],_0x52d2c1[_0x0d4f('0x13')]?_0x52d2c1[_0x0d4f('0x13')]['id']:null,_0x52d2c1[_0x0d4f('0x13')]?_0x52d2c1[_0x0d4f('0x13')]['name']:null,_0x52d2c1[_0x0d4f('0x13')]?_0x52d2c1[_0x0d4f('0x13')]['role']:null,_0x28c1c9?util[_0x0d4f('0x14')](_0x28c1c9,![],null):''));}}));_0x598cba[_0x0d4f('0x6')](ewinston[_0x0d4f('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x984c9e,_0x5ec31a){var _0x27e1ad=_0x0d4f('0x15');if(_0x984c9e[_0x0d4f('0xb')]&&_0x984c9e[_0x0d4f('0xb')][_0x0d4f('0x16')]&&_0x984c9e[_0x0d4f('0xb')][_0x0d4f('0x17')]){_0x27e1ad=_0x0d4f('0x18');}return util['format'](_0x27e1ad,_0x984c9e[_0x0d4f('0xd')],_0x984c9e[_0x0d4f('0xe')]['x-forwarded-for']?_0x984c9e[_0x0d4f('0xe')][_0x0d4f('0x19')]:_0x984c9e['connection']['remoteAddress']||_0x984c9e['ip'],_0x984c9e[_0x0d4f('0x10')],_0x5ec31a['statusCode'],_0x5ec31a[_0x0d4f('0x12')],_0x984c9e['user']?_0x984c9e[_0x0d4f('0x13')]['id']:null,_0x984c9e[_0x0d4f('0x13')]?_0x984c9e['user'][_0x0d4f('0x1a')]:null,_0x984c9e['user']?_0x984c9e[_0x0d4f('0x13')]['role']:null,_0x984c9e[_0x0d4f('0xb')]&&_0x984c9e[_0x0d4f('0xb')][_0x0d4f('0x16')]?_0x984c9e[_0x0d4f('0xb')]['device']:_0x0d4f('0x1b'),_0x984c9e['body']&&_0x984c9e[_0x0d4f('0xb')][_0x0d4f('0x17')]?_0x984c9e[_0x0d4f('0xb')][_0x0d4f('0x17')]:'',_0x984c9e[_0x0d4f('0xb')]&&_0x984c9e[_0x0d4f('0xb')][_0x0d4f('0x1c')]?_0x984c9e[_0x0d4f('0xb')][_0x0d4f('0x1c')]:'');},'ignoreRoute':function(_0x76a648){var _0x3a5cc6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3a5cc6[_0x0d4f('0x1d')](_0x76a648[_0x0d4f('0x10')]);}}));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x1e'),require(_0x0d4f('0x1f')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x20'),require(_0x0d4f('0x21')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x22'),require('./api/voiceContext'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x23'),require(_0x0d4f('0x24')));_0x598cba['use'](_0x0d4f('0x25'),require(_0x0d4f('0x26')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x27'),require(_0x0d4f('0x28')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x29'),require(_0x0d4f('0x2a')));_0x598cba['use'](_0x0d4f('0x2b'),require(_0x0d4f('0x2c')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x2d'),require('./api/voiceMail'));_0x598cba[_0x0d4f('0x6')]('/api/voice/mails/messages',require(_0x0d4f('0x2e')));_0x598cba[_0x0d4f('0x6')]('/api/voice/calls/reports',require(_0x0d4f('0x2f')));_0x598cba['use'](_0x0d4f('0x30'),require(_0x0d4f('0x31')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x32'),require('./api/voiceAgentReport'));_0x598cba['use'](_0x0d4f('0x33'),require('./api/voiceQueueReport'));_0x598cba['use'](_0x0d4f('0x34'),require(_0x0d4f('0x35')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x36'),require(_0x0d4f('0x37')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x38'),require(_0x0d4f('0x39')));_0x598cba['use'](_0x0d4f('0x3a'),require('./api/mailServerOut'));_0x598cba[_0x0d4f('0x6')]('/api/mail/accounts',require('./api/mailAccount'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x3b'),require('./api/mailQueue'));_0x598cba['use'](_0x0d4f('0x3c'),require('./api/mailSubstatus'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x3d'),require('./api/mailInteraction'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x3e'),require(_0x0d4f('0x3f')));_0x598cba['use']('/api/mail/applications',require('./api/mailApplication'));_0x598cba['use']('/api/mail/reports/queue',require(_0x0d4f('0x40')));_0x598cba['use'](_0x0d4f('0x41'),require(_0x0d4f('0x42')));_0x598cba['use'](_0x0d4f('0x43'),require(_0x0d4f('0x44')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x45'),require(_0x0d4f('0x46')));_0x598cba[_0x0d4f('0x6')]('/api/fax/applications',require(_0x0d4f('0x47')));_0x598cba['use'](_0x0d4f('0x48'),require(_0x0d4f('0x49')));_0x598cba[_0x0d4f('0x6')]('/api/fax/messages',require(_0x0d4f('0x4a')));_0x598cba[_0x0d4f('0x6')]('/api/fax/queues',require(_0x0d4f('0x4b')));_0x598cba['use'](_0x0d4f('0x4c'),require('./api/faxQueueReport'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x4d'),require(_0x0d4f('0x4e')));_0x598cba['use'](_0x0d4f('0x4f'),require(_0x0d4f('0x50')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x51'),require(_0x0d4f('0x52')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x53'),require(_0x0d4f('0x54')));_0x598cba['use'](_0x0d4f('0x55'),require('./api/smsQueue'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x56'),require(_0x0d4f('0x57')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x58'),require(_0x0d4f('0x59')));_0x598cba[_0x0d4f('0x6')]('/api/openchannel/interactions',require(_0x0d4f('0x5a')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x5b'),require(_0x0d4f('0x5c')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x5d'),require(_0x0d4f('0x5e')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x5f'),require(_0x0d4f('0x60')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x61'),require(_0x0d4f('0x62')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x63'),require(_0x0d4f('0x64')));_0x598cba[_0x0d4f('0x6')]('/api/chat/interactions',require('./api/chatInteraction'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x65'),require(_0x0d4f('0x66')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x67'),require(_0x0d4f('0x68')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x69'),require(_0x0d4f('0x6a')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x6b'),require(_0x0d4f('0x6c')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x6d'),require(_0x0d4f('0x6e')));_0x598cba['use'](_0x0d4f('0x6f'),require('./api/cmCompany'));_0x598cba[_0x0d4f('0x6')]('/api/cm/contacts',require(_0x0d4f('0x70')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x71'),require(_0x0d4f('0x72')));_0x598cba['use']('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x73'),require(_0x0d4f('0x74')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x75'),require(_0x0d4f('0x76')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x77'),require(_0x0d4f('0x78')));_0x598cba[_0x0d4f('0x6')]('/api/actions',require(_0x0d4f('0x79')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x7a'),require(_0x0d4f('0x7b')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x7c'),require(_0x0d4f('0x7d')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x7e'),require(_0x0d4f('0x7f')));_0x598cba['use'](_0x0d4f('0x80'),require('./api/condition'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x81'),require(_0x0d4f('0x82')));_0x598cba[_0x0d4f('0x6')]('/api/pauses',require(_0x0d4f('0x83')));_0x598cba['use'](_0x0d4f('0x84'),require('./api/cdr'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x85'),require('./api/voiceQueuesLog'));_0x598cba[_0x0d4f('0x6')]('/api/schedules',require(_0x0d4f('0x86')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x87'),require(_0x0d4f('0x88')));_0x598cba['use'](_0x0d4f('0x89'),require(_0x0d4f('0x8a')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x8b'),require(_0x0d4f('0x8c')));_0x598cba[_0x0d4f('0x6')]('/api/triggers',require(_0x0d4f('0x8d')));_0x598cba[_0x0d4f('0x6')]('/api/variables',require(_0x0d4f('0x8e')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x8f'),require(_0x0d4f('0x90')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x91'),require(_0x0d4f('0x92')));_0x598cba[_0x0d4f('0x6')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x598cba['use'](_0x0d4f('0x93'),require(_0x0d4f('0x94')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x95'),require(_0x0d4f('0x96')));_0x598cba['use']('/api/analytics/metrics',require('./api/analyticMetric'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x97'),require(_0x0d4f('0x98')));_0x598cba[_0x0d4f('0x6')]('/api/analytics/tree_reports',require(_0x0d4f('0x99')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x9a'),require(_0x0d4f('0x9b')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x9c'),require('./api/intSalesforceConfiguration'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x9d'),require(_0x0d4f('0x9e')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/sugarcrm/accounts',require(_0x0d4f('0x9f')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xa0'),require(_0x0d4f('0xa1')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xa2'),require(_0x0d4f('0xa3')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/desk/accounts',require(_0x0d4f('0xa4')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xa5'),require('./api/intDeskConfiguration'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xa6'),require(_0x0d4f('0xa7')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xa8'),require(_0x0d4f('0xa9')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xaa'),require('./api/intZohoConfiguration'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xab'),require(_0x0d4f('0xac')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xad'),require(_0x0d4f('0xae')));_0x598cba['use']('/api/integrations/zendesk/configurations',require(_0x0d4f('0xaf')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xb0'),require(_0x0d4f('0xb1')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xb2'),require(_0x0d4f('0xb3')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/freshdesk/configurations',require(_0x0d4f('0xb4')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xb5'),require('./api/intFreshdeskField'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xb6'),require(_0x0d4f('0xb7')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x598cba['use'](_0x0d4f('0xb8'),require(_0x0d4f('0xb9')));_0x598cba['use'](_0x0d4f('0xba'),require(_0x0d4f('0xbb')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/servicenow/configurations',require(_0x0d4f('0xbc')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/servicenow/fields',require(_0x0d4f('0xbd')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/dynamics365/accounts',require(_0x0d4f('0xbe')));_0x598cba[_0x0d4f('0x6')]('/api/integrations/dynamics365/configurations',require(_0x0d4f('0xbf')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xc0'),require(_0x0d4f('0xc1')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xc2'),require('./api/intFreshsalesAccount'));_0x598cba['use'](_0x0d4f('0xc3'),require(_0x0d4f('0xc4')));_0x598cba['use'](_0x0d4f('0xc5'),require('./api/intFreshsalesField'));_0x598cba['use'](_0x0d4f('0xc6'),require('./api/network'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xc7'),require('./api/chatQueueReport'));_0x598cba[_0x0d4f('0x6')]('/api/chat/internal/messages',require(_0x0d4f('0xc8')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xc9'),require(_0x0d4f('0xca')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xcb'),require(_0x0d4f('0xcc')));_0x598cba[_0x0d4f('0x6')]('/api/jscripty/sessions/reports',require(_0x0d4f('0xcd')));_0x598cba[_0x0d4f('0x6')]('/api/sms/reports/queue',require(_0x0d4f('0xce')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xcf'),require(_0x0d4f('0xd0')));_0x598cba['use']('/api/square/details/reports',require(_0x0d4f('0xd1')));_0x598cba['use'](_0x0d4f('0xd2'),require(_0x0d4f('0xd3')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xd4'),require(_0x0d4f('0xd5')));_0x598cba[_0x0d4f('0x6')]('/api/square/odbc',require('./api/squareOdbc'));_0x598cba[_0x0d4f('0x6')]('/api/square/projects',require('./api/squareProject'));_0x598cba[_0x0d4f('0x6')]('/api/square/recordings',require('./api/squareRecording'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xd6'),require('./api/squareMessage'));_0x598cba['use'](_0x0d4f('0xd7'),require('./api/team'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xd8'),require(_0x0d4f('0xd9')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xda'),require(_0x0d4f('0xdb')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xdc'),require('./api/migration'));_0x598cba[_0x0d4f('0x6')]('/api/attachments',require(_0x0d4f('0xdd')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xde'),require(_0x0d4f('0xdf')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xe0'),require(_0x0d4f('0xe1')));_0x598cba['use'](_0x0d4f('0xe2'),require(_0x0d4f('0xe3')));_0x598cba['use'](_0x0d4f('0xe4'),require(_0x0d4f('0xe5')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xe6'),require(_0x0d4f('0xe7')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xe8'),require('./api/smsTransferReport'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xe9'),require('./api/cmList'));_0x598cba['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xea'),require(_0x0d4f('0xeb')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xec'),require(_0x0d4f('0xed')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xee'),require(_0x0d4f('0xef')));_0x598cba['use'](_0x0d4f('0xf0'),require(_0x0d4f('0xf1')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xf2'),require(_0x0d4f('0xf3')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xf4'),require(_0x0d4f('0xf5')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xf6'),require('./api/whatsappInteraction'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xf7'),require(_0x0d4f('0xf8')));_0x598cba[_0x0d4f('0x6')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x598cba[_0x0d4f('0x6')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x598cba['use'](_0x0d4f('0xf9'),require(_0x0d4f('0xfa')));_0x598cba[_0x0d4f('0x6')]('/api/cloudProviders',require(_0x0d4f('0xfb')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xfc'),require('./api/realtime'));_0x598cba[_0x0d4f('0x6')]('/api/auth/local',require(_0x0d4f('0xfd')));_0x598cba['use']('/api/auth/google',require(_0x0d4f('0xfe')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0xff'),require(_0x0d4f('0x100')));_0x598cba['use'](_0x0d4f('0x101'),require(_0x0d4f('0x102')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x103'),require('./api/version'));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x104'),require(_0x0d4f('0x105')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x106'),require(_0x0d4f('0x107')));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x108'),require('./api/webbar'));_0x598cba['use']('/apidoc',express[_0x0d4f('0x109')](path['join'](config['root'],'/apidoc')));_0x598cba[_0x0d4f('0x6')]('/www',express['static'](path[_0x0d4f('0x10a')](config[_0x0d4f('0x10b')],_0x0d4f('0x10c'))));_0x598cba['use'](_0x0d4f('0x10d'),express[_0x0d4f('0x109')](path[_0x0d4f('0x10a')](config['root'],_0x0d4f('0x10d'))));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x10e'),express[_0x0d4f('0x109')](path[_0x0d4f('0x10a')](config[_0x0d4f('0x10b')],_0x0d4f('0x10f'),_0x0d4f('0x110'))));_0x598cba[_0x0d4f('0x6')](_0x0d4f('0x111'),express[_0x0d4f('0x109')](path[_0x0d4f('0x10a')](config['root'],_0x0d4f('0x112'))));_0x598cba[_0x0d4f('0x113')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x0d4f('0x114')](errors[0x194]);_0x598cba['route']('/*')[_0x0d4f('0x114')](function(_0x45b5ed,_0x5daf01){_0x5daf01[_0x0d4f('0x115')](path[_0x0d4f('0x116')](_0x598cba[_0x0d4f('0x114')](_0x0d4f('0x117'))+_0x0d4f('0x118')));});};var sensitiveFields=[_0x0d4f('0x119'),_0x0d4f('0x11a'),_0x0d4f('0x11b'),_0x0d4f('0x11c'),_0x0d4f('0x11d'),_0x0d4f('0x11e'),_0x0d4f('0x11f'),_0x0d4f('0x120'),_0x0d4f('0x121'),'fax',_0x0d4f('0x122'),_0x0d4f('0x123'),_0x0d4f('0x124'),_0x0d4f('0x125'),'code',_0x0d4f('0x126'),_0x0d4f('0x127'),_0x0d4f('0x128'),_0x0d4f('0x129'),_0x0d4f('0x12a'),'accessTokenSecret',_0x0d4f('0x12b'),_0x0d4f('0x12c'),'consumerSecret',_0x0d4f('0x12d'),_0x0d4f('0x12e'),_0x0d4f('0x12f'),_0x0d4f('0x130'),_0x0d4f('0x131'),_0x0d4f('0x132'),'privateKey','accesskeyid',_0x0d4f('0x133'),_0x0d4f('0x134'),_0x0d4f('0x13'),_0x0d4f('0x135'),_0x0d4f('0x136'),'localstationid',_0x0d4f('0x137'),'secret','registry',_0x0d4f('0x138')];function maskSensitiveData(_0x271de8){var _0x23db00=/(?!^)[\s\S](?!$)/g;if(!_[_0x0d4f('0x139')](_0x271de8))return;for(var _0x45cabe in _0x271de8){if(_[_0x0d4f('0x13a')](_0x271de8[_0x45cabe])){for(var _0x5d667f=0x0;_0x5d667f<_0x271de8[_0x45cabe][_0x0d4f('0x13b')];_0x5d667f++){maskSensitiveData(_0x271de8[_0x45cabe][_0x5d667f]);}}else if(_[_0x0d4f('0x139')](_0x271de8[_0x45cabe])){maskSensitiveData(_0x271de8[_0x45cabe]);}else if(_[_0x0d4f('0x13c')](_0x271de8[_0x45cabe])){_0x271de8[_0x45cabe]=_0x271de8[_0x45cabe]['replace'](/{{{/g,_0x0d4f('0x13d'))[_0x0d4f('0x13e')](/}}}/g,_0x0d4f('0x13f'))[_0x0d4f('0x13e')](/{{/g,'@{')[_0x0d4f('0x13e')](/}}/g,'}@');if(_[_0x0d4f('0x140')](sensitiveFields,_0x45cabe)){_0x271de8[_0x45cabe]=_0x271de8[_0x45cabe]['replace'](_0x23db00,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 42b8793..0071e15 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb334=['../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/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/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/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc'];(function(_0x5e2d52,_0x5039f0){var _0x573604=function(_0x5861b2){while(--_0x5861b2){_0x5e2d52['push'](_0x5e2d52['shift']());}};_0x573604(++_0x5039f0);}(_0xb334,0x194));var _0x4b33=function(_0xdefc6,_0x372981){_0xdefc6=_0xdefc6-0x0;var _0x33a803=_0xb334[_0xdefc6];return _0x33a803;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x4b33('0x0'));var _=require(_0x4b33('0x1'));var config=require(_0x4b33('0x2'));exports[_0x4b33('0x3')]=function(){return new BPromise(function(_0x4d1ba4,_0x4a92a1){var _0x177954={};_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x5')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x6')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x7')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x8')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x9')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x177954=_['merge'](_0x177954,require(_0x4b33('0xa')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0xb')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0xc')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0xd')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0xe')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0xf')));_0x177954=_['merge'](_0x177954,require('../api/mailAccount/mailAccount.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x10')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x11')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/mailMessage/mailMessage.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x12')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x13')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x14')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x15')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x16')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x17')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x18')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x19')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x1a')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/smsInteraction/smsInteraction.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x1b')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x1c')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x1d')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x1e')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x1f')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x20')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x21')));_0x177954=_['merge'](_0x177954,require('../api/chatInteraction/chatInteraction.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x22')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/chatQueue/chatQueue.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x23')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x24')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x25')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x26')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x27')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x28')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x29')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/pause/pause.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x2a')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x2b')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x2c')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x2d')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x2e')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x2f')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x30')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x31')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x32')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x33')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x34')));_0x177954=_['merge'](_0x177954,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x35')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x36')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x37')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x38')));_0x177954=_['merge'](_0x177954,require('../api/squareOdbc/squareOdbc.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/squareProject/squareProject.rpc'));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x39')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x3a')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x3b')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x3c')));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x3d')));_0x177954=_[_0x4b33('0x4')](_0x177954,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x3e')));_0x177954=_[_0x4b33('0x4')](_0x177954,require(_0x4b33('0x3f')));_0x177954=_['merge'](_0x177954,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x177954=_['merge'](_0x177954,require(_0x4b33('0x40')));var _0x494eb2=jayson[_0x4b33('0x41')](_0x177954)[_0x4b33('0x42')]();var _0x3bb8e8=config['rpc'][_0x4b33('0x43')]||config[_0x4b33('0x43')]+0x1;var _0x19eb9d=config[_0x4b33('0x44')]['ip']||_0x4b33('0x45');_0x494eb2['on'](_0x4b33('0x46'),function(_0x512f27){return _0x4a92a1(_0x512f27);});_0x494eb2[_0x4b33('0x3')](_0x3bb8e8,_0x19eb9d,function(){console[_0x4b33('0x47')](_0x4b33('0x48'),_0x19eb9d,_0x3bb8e8);require(_0x4b33('0x49'))[_0x4b33('0x4a')]();return _0x4d1ba4(_0x4b33('0x4b')+_0x19eb9d+':'+_0x3bb8e8);});});}; \ No newline at end of file +var _0x6b5a=['../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/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.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','server','http','rpc','port','error','listen','log','../config/triggers','jayson/promise','bluebird','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc'];(function(_0x5ab3a8,_0x357688){var _0x4619de=function(_0x321ec2){while(--_0x321ec2){_0x5ab3a8['push'](_0x5ab3a8['shift']());}};_0x4619de(++_0x357688);}(_0x6b5a,0xf8));var _0xa6b5=function(_0x4570fa,_0x2ed425){_0x4570fa=_0x4570fa-0x0;var _0x2c9217=_0x6b5a[_0x4570fa];return _0x2c9217;};'use strict';var jayson=require(_0xa6b5('0x0'));var BPromise=require(_0xa6b5('0x1'));var _=require(_0xa6b5('0x2'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x2dfa3d,_0x50224d){var _0x4bde47={};_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x4')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x5')));_0x4bde47=_['merge'](_0x4bde47,require('../api/voiceQueue/voiceQueue.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/voiceRecording/voiceRecording.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x6')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x7')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x8')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x9')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0xa')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0xb')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0xc')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0xd')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0xe')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/mailInteraction/mailInteraction.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0xf')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x10')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x11')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x12')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x13')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x14')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x15')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x16')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x17')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x18')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x19')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x1a')));_0x4bde47=_['merge'](_0x4bde47,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x1b')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x1c')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x1d')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x1e')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x1f')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x20')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x21')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x22')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x23')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x24')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x25')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x26')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x27')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x28')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x29')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x2a')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x2b')));_0x4bde47=_['merge'](_0x4bde47,require('../api/variable/variable.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x2c')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x2d')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x2e')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4bde47=_['merge'](_0x4bde47,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x2f')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x30')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x31')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x32')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x33')));_0x4bde47=_['merge'](_0x4bde47,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x34')));_0x4bde47=_['merge'](_0x4bde47,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/setting/setting.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x35')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x36')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/squareRecording/squareRecording.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x37')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x38')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x39')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x3a')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x3b')));_0x4bde47=_[_0xa6b5('0x3')](_0x4bde47,require(_0xa6b5('0x3c')));_0x4bde47=_['merge'](_0x4bde47,require(_0xa6b5('0x3d')));var _0x37e62d=jayson[_0xa6b5('0x3e')](_0x4bde47)[_0xa6b5('0x3f')]();var _0xbac5d5=config[_0xa6b5('0x40')][_0xa6b5('0x41')]||config[_0xa6b5('0x41')]+0x1;var _0x34a471=config[_0xa6b5('0x40')]['ip']||'localhost';_0x37e62d['on'](_0xa6b5('0x42'),function(_0x264ea9){return _0x50224d(_0x264ea9);});_0x37e62d[_0xa6b5('0x43')](_0xbac5d5,_0x34a471,function(){console[_0xa6b5('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x34a471,_0xbac5d5);require(_0xa6b5('0x45'))['default']();return _0x2dfa3d('RPC\x20listening\x20on\x20'+_0x34a471+':'+_0xbac5d5);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 0483f1a..56a94e2 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x42880f,_0x4425a5){_0x42880f=_0x42880f-0x0;var _0x14054c=_0xf4f4[_0x42880f];return _0x14054c;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0x8f4c=['map','isPlainObject','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','replace','isArray'];(function(_0x4e231a,_0x378441){var _0x482b1d=function(_0x30b9bf){while(--_0x30b9bf){_0x4e231a['push'](_0x4e231a['shift']());}};_0x482b1d(++_0x378441);}(_0x8f4c,0x113));var _0xc8f4=function(_0xb77dfe,_0x39c4c7){_0xb77dfe=_0xb77dfe-0x0;var _0x5e4f5d=_0x8f4c[_0xb77dfe];return _0x5e4f5d;};var _=require(_0xc8f4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x292fb6){return _0x292fb6==='{{'?_0xc8f4('0x1'):_0xc8f4('0x2');}function safeTemplate(_0x19893b){var _0x134d73=_0x19893b;if(typeof _0x19893b==='string'){_0x134d73=_0x19893b[_0xc8f4('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc8f4('0x4')](_0x19893b)){_0x134d73=_0x19893b[_0xc8f4('0x5')](function(_0x56c9b1){return safeTemplate(_0x56c9b1);});}else if(_[_0xc8f4('0x6')](_0x19893b)){_0x134d73=Object['keys'](_0x19893b)['reduce'](function(_0x520063,_0x373506){_0x520063[_0x373506]=safeTemplate(_0x19893b[_0x373506]);return _0x520063;},{});}return _0x134d73;}module['exports'][_0xc8f4('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5d989db..3fdc019 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 _0x34d2=['ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','./error','call','setTimeout','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','write','prototype','sendRequest','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT'];(function(_0x733d13,_0x3de66f){var _0x403557=function(_0x46cd5b){while(--_0x46cd5b){_0x733d13['push'](_0x733d13['shift']());}};_0x403557(++_0x3de66f);}(_0x34d2,0x12a));var _0x234d=function(_0x24c23a,_0x2079f4){_0x24c23a=_0x24c23a-0x0;var _0x7fb012=_0x34d2[_0x24c23a];return _0x7fb012;};'use strict';var util=require('util');var _=require(_0x234d('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x234d('0x1'));function AGIChannel(_0x4cbb49){var _0x364557=this,_0xcdd59b=new AGIReply(),_0x5530d7=![],_0x4ba374={};EventEmitter[_0x234d('0x2')](_0x364557);_0x4cbb49['setEncoding']('utf8');_0x4cbb49[_0x234d('0x3')](0x8*0x3c*0x3c*0x3e8);_0xcdd59b[_0x234d('0x4')](_0x234d('0x5'));_0xcdd59b['on'](_0x234d('0x6'),function(_0x4e01ff){for(var _0x8d0cf2 in _0x4e01ff){_0x364557[_0x8d0cf2]=_0x4e01ff[_0x8d0cf2];}_0x364557[_0x234d('0x7')](_0x234d('0x8'));});_0xcdd59b['on'](_0x234d('0x9'),function(_0x27c675){if(_0x27c675[_0x234d('0xa')]()==_0x234d('0xb')){_0x364557['emit']('hangup');return;}if(_0x27c675['substring'](0x0,0xb)==_0x234d('0xc')){_0x5530d7=!![];}if(_0x5530d7){_0x4ba374['rx']+=_0x27c675+'\x0a';if(_0x27c675['search'](_0x234d('0xd'))!=-0x1){_0x5530d7=![];}}else{_0x4ba374['rx']=_0x27c675;}if(_0x5530d7){return;}if(typeof _0x4ba374['cb']==_0x234d('0xe')){var _0x2c48bb=_0x4ba374['rx'][_0x234d('0xf')](0x0,0x3),_0x26284e=null,_0x506c78=null;_0x2c48bb=parseInt(_0x2c48bb);if(isNaN(_0x2c48bb)){_0x4ba374['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x234d('0x10')});return;}if(_0x2c48bb!=0xc8){_0x4ba374['cb'](null,{'code':_0x2c48bb,'result':-0x1,'extra':'KO'});return;}_0x26284e=_0x4ba374['rx']['substring'](0x4)[_0x234d('0x11')](_0x234d('0x12'),'');if(_0x26284e[_0x234d('0x13')]('\x20')!=-0x1){_0x26284e=_0x26284e[_0x234d('0x14')](0x0,_0x26284e['indexOf']('\x20'));}if(_['startsWith'](_0x26284e,'-1')){_0x26284e=parseInt(_0x26284e);}_0x506c78=_0x4ba374['rx'][_0x234d('0x15')]('\x20');if(_0x506c78[_0x234d('0x16')]==0x3){_0x506c78=_0x506c78[0x2][_0x234d('0xf')](0x1,_0x506c78[0x2][_0x234d('0x16')]-0x1);}else if(_0x506c78['length']>0x3){var _0x2a487c=/\((.+)\)/;var _0x5e538a=_0x4ba374['rx'][_0x234d('0x17')](_0x2a487c);if(_0x5e538a){_0x506c78=_0x5e538a[0x1];}else{_0x506c78=null;}}else{_0x506c78=null;}_0x4ba374['cb'](null,{'code':_0x2c48bb,'result':_0x26284e,'extra':_0x506c78});}});_0x4cbb49['on'](_0x234d('0x18'),function(_0x25e2a2){_0x364557['emit'](_0x234d('0x18'),new AGIError(_0x234d('0x19'),_0x25e2a2[_0x234d('0x1a')]));});_0x4cbb49['on'](_0x234d('0x1b'),function(){_0x364557[_0x234d('0x7')](_0x234d('0x1b'),new AGIError(_0x234d('0x1c')));});_0x4cbb49['on'](_0x234d('0x1d'),function(){_0x364557[_0x234d('0x7')](_0x234d('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4cbb49[_0x234d('0x1e')]();});_0x4cbb49['pipe'](_0xcdd59b);this['command']=function(_0x16c748,_0x48ae10){var _0x16c748=_0x16c748||'',_0x48ae10=typeof _0x48ae10==_0x234d('0xe')?_0x48ae10:new Function();_0x4ba374={'tx':_0x16c748,'rx':'','cb':_0x48ae10};_0x4cbb49[_0x234d('0x1f')](_0x16c748+'\x0a');},this[_0x234d('0x1b')]=function(){_0x4cbb49[_0x234d('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x234d('0x20')][_0x234d('0x21')]=function(_0x113fdb){return this[_0x234d('0x22')][_0x234d('0x23')](this,_0x113fdb);};AGIChannel[_0x234d('0x20')][_0x234d('0x24')]=function(){return this[_0x234d('0x21')]('ANSWER');};AGIChannel[_0x234d('0x20')][_0x234d('0x25')]=function(_0x2f8e3a,_0x1bb30b,_0x4bcc2d){_0x2f8e3a=_0x2f8e3a===undefined?'beep':_0x2f8e3a;_0x1bb30b=_0x1bb30b===undefined?'5':_0x1bb30b;_0x4bcc2d=_0x4bcc2d===undefined?'1':_0x4bcc2d;return this[_0x234d('0x21')](util[_0x234d('0x26')](_0x234d('0x27'),_0x2f8e3a,_0x1bb30b*0x3e8,_0x4bcc2d));};AGIChannel['prototype']['noop']=function(_0x54b8ac){_0x54b8ac=_0x54b8ac||_0x234d('0x28');return this[_0x234d('0x21')](util[_0x234d('0x26')](_0x234d('0x29'),_0x54b8ac));};AGIChannel[_0x234d('0x20')][_0x234d('0x2a')]=function(_0x542717,_0xdaffb){if(_[_0x234d('0x2b')](_0xdaffb)){return this[_0x234d('0x21')](util[_0x234d('0x26')](_0x234d('0x2c'),_0x542717,_0xdaffb[_0x234d('0x2d')](',')));}return this['sendRequest'](util[_0x234d('0x26')](_0x234d('0x2c'),_0x542717,_0xdaffb));};AGIChannel[_0x234d('0x20')][_0x234d('0x2e')]=function(_0x45a35f){return this['sendRequest'](util[_0x234d('0x26')](_0x234d('0x2f'),_0x45a35f));};AGIChannel[_0x234d('0x20')][_0x234d('0x30')]=function(_0x75e149){return this['sendRequest'](util['format']('SET\x20EXTENSION\x20%s',_0x75e149));};AGIChannel[_0x234d('0x20')]['setPriority']=function(_0x36329c){return this[_0x234d('0x21')](util[_0x234d('0x26')](_0x234d('0x31'),_0x36329c));};AGIChannel['prototype'][_0x234d('0xb')]=function(){return this[_0x234d('0x21')](_0x234d('0x32'));};AGIChannel[_0x234d('0x20')][_0x234d('0x33')]=function(_0x947a4e,_0x20a594){var _0x12961a=_[_0x234d('0x34')](_0x20a594)||_[_0x234d('0x35')](_0x20a594)?_0x20a594['toString']():_0x20a594;return this['sendRequest'](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x947a4e,_0x12961a?_0x12961a[_0x234d('0x36')]()[_0x234d('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x234d('0x20')]['sayNumber']=function(_0x14e4ce,_0x335266){return this[_0x234d('0x21')](util[_0x234d('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x14e4ce,_0x335266));};AGIChannel[_0x234d('0x20')][_0x234d('0x37')]=function(_0x397cad,_0x563a45){return this['sendRequest'](util[_0x234d('0x26')](_0x234d('0x38'),_0x397cad,_0x563a45));};AGIChannel[_0x234d('0x20')][_0x234d('0x39')]=function(_0x1ff9cf,_0x35c2af){return this[_0x234d('0x21')](util[_0x234d('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1ff9cf,_0x35c2af));};AGIChannel[_0x234d('0x20')][_0x234d('0x3a')]=function(_0x23ae2c,_0x3fee2d,_0x23ff5e){_0x3fee2d=_0x3fee2d||this[_0x234d('0x3b')];_0x23ff5e=_0x23ff5e||0x1;this[_0x234d('0x2e')](_0x23ae2c);this[_0x234d('0x30')](_0x3fee2d);this[_0x234d('0x3c')](_0x23ff5e);return this[_0x234d('0x3d')](util[_0x234d('0x26')](_0x234d('0x3e'),_0x23ae2c,_0x3fee2d,_0x23ff5e));};AGIChannel[_0x234d('0x20')][_0x234d('0x3f')]=function(_0x6eac3f){return this[_0x234d('0x21')](util[_0x234d('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x6eac3f));};AGIChannel[_0x234d('0x20')][_0x234d('0x40')]=function(_0x2906ba,_0x34ebc6,_0x196091,_0x464703,_0x398962,_0x5a6bc5){_0x34ebc6=_0x34ebc6||_0x234d('0x41');_0x196091=_0x196091||'';_0x464703=_0x464703===undefined?-0x1:_0x464703==='-1'?-0x1:_0x464703*0x3e8;_0x398962=_0x398962===undefined?'':'s='+_0x398962;_0x5a6bc5=_0x5a6bc5?'BEEP':'';return this[_0x234d('0x21')](util[_0x234d('0x26')](_0x234d('0x42'),_0x2906ba,_0x34ebc6,_0x196091,_0x464703,_0x5a6bc5,_0x398962));};AGIChannel[_0x234d('0x20')][_0x234d('0x43')]=function(_0x27325e,_0x1fae5d){_0x1fae5d=_0x1fae5d||'';return this['sendRequest'](util[_0x234d('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x27325e,_0x1fae5d));};AGIChannel[_0x234d('0x20')][_0x234d('0x44')]=function(_0x20bfe0){return this[_0x234d('0x2a')](_0x234d('0x45'),_0x20bfe0);};AGIChannel['prototype'][_0x234d('0x46')]=function(_0x167fd5){return this['exec'](_0x234d('0x47'),_0x167fd5);};AGIChannel[_0x234d('0x20')][_0x234d('0x18')]=function(_0x2057c7,_0x30922f){this[_0x234d('0x3d')](util[_0x234d('0x26')](_0x234d('0x48'),_0x2057c7['id'],_0x2057c7[_0x234d('0x49')],_0x30922f));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x852c=['label','exports','util','lodash','EventEmitter','./reply','call','setTimeout','setEncoding','emit','ready','line','toLowerCase','hangup','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','inherits','prototype','sendRequest','command','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT'];(function(_0x48a749,_0xf82755){var _0x507a1e=function(_0x34e14d){while(--_0x34e14d){_0x48a749['push'](_0x48a749['shift']());}};_0x507a1e(++_0xf82755);}(_0x852c,0x179));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc852('0x0'));var _=require(_0xc852('0x1'));var EventEmitter=require('events')[_0xc852('0x2')];var AGIReply=require(_0xc852('0x3'));var AGIError=require('./error');function AGIChannel(_0x592b1c){var _0x29ba2a=this,_0x35c0a2=new AGIReply(),_0xd4b975=![],_0x98e8e4={};EventEmitter[_0xc852('0x4')](_0x29ba2a);_0x592b1c['setEncoding']('utf8');_0x592b1c[_0xc852('0x5')](0x8*0x3c*0x3c*0x3e8);_0x35c0a2[_0xc852('0x6')]('utf8');_0x35c0a2['on']('headers',function(_0x3a1139){for(var _0x30d4f0 in _0x3a1139){_0x29ba2a[_0x30d4f0]=_0x3a1139[_0x30d4f0];}_0x29ba2a[_0xc852('0x7')](_0xc852('0x8'));});_0x35c0a2['on'](_0xc852('0x9'),function(_0x26097d){if(_0x26097d[_0xc852('0xa')]()==_0xc852('0xb')){_0x29ba2a['emit'](_0xc852('0xb'));return;}if(_0x26097d['substring'](0x0,0xb)==_0xc852('0xc')){_0xd4b975=!![];}if(_0xd4b975){_0x98e8e4['rx']+=_0x26097d+'\x0a';if(_0x26097d[_0xc852('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0xd4b975=![];}}else{_0x98e8e4['rx']=_0x26097d;}if(_0xd4b975){return;}if(typeof _0x98e8e4['cb']==_0xc852('0xe')){var _0x5dcae3=_0x98e8e4['rx']['substring'](0x0,0x3),_0x1b0e2a=null,_0x2de381=null;_0x5dcae3=parseInt(_0x5dcae3);if(isNaN(_0x5dcae3)){_0x98e8e4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc852('0xf')});return;}if(_0x5dcae3!=0xc8){_0x98e8e4['cb'](null,{'code':_0x5dcae3,'result':-0x1,'extra':'KO'});return;}_0x1b0e2a=_0x98e8e4['rx']['substring'](0x4)[_0xc852('0x10')](_0xc852('0x11'),'');if(_0x1b0e2a[_0xc852('0x12')]('\x20')!=-0x1){_0x1b0e2a=_0x1b0e2a[_0xc852('0x13')](0x0,_0x1b0e2a[_0xc852('0x12')]('\x20'));}if(_[_0xc852('0x14')](_0x1b0e2a,'-1')){_0x1b0e2a=parseInt(_0x1b0e2a);}_0x2de381=_0x98e8e4['rx'][_0xc852('0x15')]('\x20');if(_0x2de381['length']==0x3){_0x2de381=_0x2de381[0x2]['substring'](0x1,_0x2de381[0x2][_0xc852('0x16')]-0x1);}else if(_0x2de381[_0xc852('0x16')]>0x3){var _0x4c38d7=/\((.+)\)/;var _0x4d0e96=_0x98e8e4['rx'][_0xc852('0x17')](_0x4c38d7);if(_0x4d0e96){_0x2de381=_0x4d0e96[0x1];}else{_0x2de381=null;}}else{_0x2de381=null;}_0x98e8e4['cb'](null,{'code':_0x5dcae3,'result':_0x1b0e2a,'extra':_0x2de381});}});_0x592b1c['on']('error',function(_0xb9f57b){_0x29ba2a[_0xc852('0x7')](_0xc852('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0xb9f57b[_0xc852('0x19')]));});_0x592b1c['on'](_0xc852('0x1a'),function(){_0x29ba2a[_0xc852('0x7')](_0xc852('0x1a'),new AGIError(_0xc852('0x1b')));});_0x592b1c['on'](_0xc852('0x1c'),function(){_0x29ba2a[_0xc852('0x7')](_0xc852('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x592b1c[_0xc852('0x1d')]();});_0x592b1c[_0xc852('0x1e')](_0x35c0a2);this['command']=function(_0x493188,_0x1b04b5){var _0x493188=_0x493188||'',_0x1b04b5=typeof _0x1b04b5==_0xc852('0xe')?_0x1b04b5:new Function();_0x98e8e4={'tx':_0x493188,'rx':'','cb':_0x1b04b5};_0x592b1c['write'](_0x493188+'\x0a');},this[_0xc852('0x1a')]=function(){_0x592b1c['destroy']();};}util[_0xc852('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0xc852('0x20')][_0xc852('0x21')]=function(_0xa6f49c){return this[_0xc852('0x22')][_0xc852('0x23')](this,_0xa6f49c);};AGIChannel[_0xc852('0x20')]['answer']=function(){return this[_0xc852('0x21')](_0xc852('0x24'));};AGIChannel[_0xc852('0x20')][_0xc852('0x25')]=function(_0x1a7b45,_0x17a5a6,_0x40f228){_0x1a7b45=_0x1a7b45===undefined?'beep':_0x1a7b45;_0x17a5a6=_0x17a5a6===undefined?'5':_0x17a5a6;_0x40f228=_0x40f228===undefined?'1':_0x40f228;return this[_0xc852('0x21')](util[_0xc852('0x26')](_0xc852('0x27'),_0x1a7b45,_0x17a5a6*0x3e8,_0x40f228));};AGIChannel['prototype'][_0xc852('0x28')]=function(_0x49f65){_0x49f65=_0x49f65||_0xc852('0x29');return this[_0xc852('0x21')](util[_0xc852('0x26')](_0xc852('0x2a'),_0x49f65));};AGIChannel['prototype'][_0xc852('0x2b')]=function(_0x2d6aa7,_0x439fd5){if(_['isArray'](_0x439fd5)){return this[_0xc852('0x21')](util[_0xc852('0x26')]('EXEC\x20%s\x20%s',_0x2d6aa7,_0x439fd5[_0xc852('0x2c')](',')));}return this[_0xc852('0x21')](util[_0xc852('0x26')](_0xc852('0x2d'),_0x2d6aa7,_0x439fd5));};AGIChannel[_0xc852('0x20')]['setContext']=function(_0x2b912a){return this[_0xc852('0x21')](util['format'](_0xc852('0x2e'),_0x2b912a));};AGIChannel[_0xc852('0x20')][_0xc852('0x2f')]=function(_0x124b54){return this['sendRequest'](util['format'](_0xc852('0x30'),_0x124b54));};AGIChannel[_0xc852('0x20')]['setPriority']=function(_0x6ef3f2){return this['sendRequest'](util[_0xc852('0x26')](_0xc852('0x31'),_0x6ef3f2));};AGIChannel[_0xc852('0x20')][_0xc852('0xb')]=function(){return this['sendRequest'](_0xc852('0x32'));};AGIChannel['prototype']['setVariable']=function(_0x23440a,_0x448031){var _0x3acdbe=_['isBoolean'](_0x448031)||_[_0xc852('0x33')](_0x448031)?_0x448031[_0xc852('0x34')]():_0x448031;return this['sendRequest'](util[_0xc852('0x26')](_0xc852('0x35'),_0x23440a,_0x3acdbe?_0x3acdbe[_0xc852('0x34')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc852('0x20')][_0xc852('0x36')]=function(_0x1001db,_0x2cb3e0){return this[_0xc852('0x21')](util[_0xc852('0x26')](_0xc852('0x37'),_0x1001db,_0x2cb3e0));};AGIChannel[_0xc852('0x20')][_0xc852('0x38')]=function(_0x3157be,_0x17c543){return this[_0xc852('0x21')](util[_0xc852('0x26')](_0xc852('0x39'),_0x3157be,_0x17c543));};AGIChannel[_0xc852('0x20')][_0xc852('0x3a')]=function(_0xa03df9,_0x56fa88){return this[_0xc852('0x21')](util['format'](_0xc852('0x3b'),_0xa03df9,_0x56fa88));};AGIChannel[_0xc852('0x20')][_0xc852('0x3c')]=function(_0x310452,_0x1c5626,_0x5e4948){_0x1c5626=_0x1c5626||this[_0xc852('0x3d')];_0x5e4948=_0x5e4948||0x1;this[_0xc852('0x3e')](_0x310452);this['setExtension'](_0x1c5626);this[_0xc852('0x3f')](_0x5e4948);return this[_0xc852('0x28')](util[_0xc852('0x26')](_0xc852('0x40'),_0x310452,_0x1c5626,_0x5e4948));};AGIChannel['prototype'][_0xc852('0x41')]=function(_0x2cb8a5){return this[_0xc852('0x21')](util[_0xc852('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x2cb8a5));};AGIChannel[_0xc852('0x20')][_0xc852('0x42')]=function(_0x371096,_0x2618f3,_0x44f227,_0x208ec0,_0xed13eb,_0x5aa7ba){_0x2618f3=_0x2618f3||'wav';_0x44f227=_0x44f227||'';_0x208ec0=_0x208ec0===undefined?-0x1:_0x208ec0==='-1'?-0x1:_0x208ec0*0x3e8;_0xed13eb=_0xed13eb===undefined?'':'s='+_0xed13eb;_0x5aa7ba=_0x5aa7ba?'BEEP':'';return this[_0xc852('0x21')](util[_0xc852('0x26')](_0xc852('0x43'),_0x371096,_0x2618f3,_0x44f227,_0x208ec0,_0x5aa7ba,_0xed13eb));};AGIChannel[_0xc852('0x20')][_0xc852('0x44')]=function(_0x157800,_0xe33e6d){_0xe33e6d=_0xe33e6d||'';return this[_0xc852('0x21')](util[_0xc852('0x26')](_0xc852('0x45'),_0x157800,_0xe33e6d));};AGIChannel[_0xc852('0x20')]['agi']=function(_0x428286){return this[_0xc852('0x2b')](_0xc852('0x46'),_0x428286);};AGIChannel[_0xc852('0x20')][_0xc852('0x47')]=function(_0xf8405e){return this[_0xc852('0x2b')](_0xc852('0x48'),_0xf8405e);};AGIChannel[_0xc852('0x20')][_0xc852('0x18')]=function(_0x2e9e34,_0x3e259b){this[_0xc852('0x28')](util[_0xc852('0x26')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2e9e34['id'],_0x2e9e34[_0xc852('0x49')],_0x3e259b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc852('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 59c0456..4bdab9c 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 _0x77c5=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x15905f,_0x56572b){var _0x56187c=function(_0x20e5f6){while(--_0x20e5f6){_0x15905f['push'](_0x15905f['shift']());}};_0x56187c(++_0x56572b);}(_0x77c5,0x14e));var _0x577c=function(_0x300d47,_0x275144){_0x300d47=_0x300d47-0x0;var _0x2e67a1=_0x77c5[_0x300d47];return _0x2e67a1;};'use strict';var util=require(_0x577c('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x577c('0x1'),'E_AGI_SERVER_ERROR':_0x577c('0x2'),'E_AGI_SERVER_CLOSE':_0x577c('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x577c('0x4'),'E_AGI_SOCKET_ERROR':_0x577c('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x577c('0x6'),'E_AGI_COMMAND_EMPTY':_0x577c('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x21fd5f){var _0x21fd5f=_0x21fd5f||null,_0x26b198=_0x26b198||[],_0x3dc4b2=0x1,_0x10e083='';if(!error[_0x21fd5f]){_0x21fd5f=_0x577c('0x8');}_0x26b198[_0x577c('0x9')](error[_0x21fd5f]);while(arguments[_0x3dc4b2]){_0x26b198[_0x577c('0x9')](arguments[_0x3dc4b2]);_0x3dc4b2++;}_0x10e083=util[_0x577c('0xa')][_0x577c('0xb')](util,_0x26b198);this[_0x577c('0xc')]=_0x10e083;this['name']=_0x21fd5f;}module[_0x577c('0xd')]=AGIError; \ No newline at end of file +var _0x8538=['E_AGI_UNDEFINED','push','format','apply','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x8538,0x1f4));var _0x8853=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8538[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x8853('0x0'));var error={'E_AGI_UNDEFINED':_0x8853('0x1'),'E_AGI_ARGUMENT_PORT':_0x8853('0x2'),'E_AGI_SERVER_ERROR':_0x8853('0x3'),'E_AGI_SERVER_CLOSE':_0x8853('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x8853('0x5'),'E_AGI_SOCKET_ERROR':_0x8853('0x6'),'E_AGI_SOCKET_CLOSE':_0x8853('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x8853('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x8853('0x9')};function AGIError(_0x39f42b){var _0x39f42b=_0x39f42b||null,_0x36ad36=_0x36ad36||[],_0xb6ca4c=0x1,_0x27f90a='';if(!error[_0x39f42b]){_0x39f42b=_0x8853('0xa');}_0x36ad36[_0x8853('0xb')](error[_0x39f42b]);while(arguments[_0xb6ca4c]){_0x36ad36[_0x8853('0xb')](arguments[_0xb6ca4c]);_0xb6ca4c++;}_0x27f90a=util[_0x8853('0xc')][_0x8853('0xd')](util,_0x36ad36);this['message']=_0x27f90a;this['name']=_0x39f42b;}module[_0x8853('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4d27316..e7af3d0 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 _0xad98=['getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','target','invalid','agicommand','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','vertices','numberOfEdges','prototype','addVertex','edges','push','size','relations'];(function(_0x43da3e,_0x5a5e3c){var _0x4b7be3=function(_0x2c4dfb){while(--_0x2c4dfb){_0x43da3e['push'](_0x43da3e['shift']());}};_0x4b7be3(++_0x5a5e3c);}(_0xad98,0x189));var _0x8ad9=function(_0x526876,_0x2473ec){_0x526876=_0x526876-0x0;var _0x379ab5=_0xad98[_0x526876];return _0x379ab5;};'use strict';var _=require(_0x8ad9('0x0'));var logger=require(_0x8ad9('0x1'))(_0x8ad9('0x2'));var verticesWithRetry=[_0x8ad9('0x3'),_0x8ad9('0x4'),'getsecretdigits'];var Graph=function(){this[_0x8ad9('0x5')]={};this['edges']={};this[_0x8ad9('0x6')]=0x0;};Graph[_0x8ad9('0x7')][_0x8ad9('0x8')]=function(_0xc27705){this[_0x8ad9('0x5')][_0xc27705['id']]=_0xc27705;this[_0x8ad9('0x9')][_0xc27705['id']]=[];};Graph[_0x8ad9('0x7')]['addEdge']=function(_0x109859,_0x291d64,_0x233c7f){this[_0x8ad9('0x9')][_0x109859][_0x8ad9('0xa')]({'target':_0x291d64,'condition':_0x233c7f});this[_0x8ad9('0x6')]+=0x1;};Graph[_0x8ad9('0x7')][_0x8ad9('0xb')]=function(){return _[_0x8ad9('0xb')](this[_0x8ad9('0x5')]);};Graph[_0x8ad9('0x7')][_0x8ad9('0xc')]=function(){return this[_0x8ad9('0x6')];};Graph[_0x8ad9('0x7')][_0x8ad9('0xd')]=function(_0x20b1ea){return this[_0x8ad9('0x5')][_0x20b1ea];};Graph[_0x8ad9('0x7')][_0x8ad9('0xe')]=function(_0x5b4ea6,_0x17978f){if(!this[_0x8ad9('0x5')][_0x5b4ea6]){return logger[_0x8ad9('0xf')](_0x8ad9('0x10'));}var _0x2c8bff=_0x17978f(this['vertices'][_0x5b4ea6]);if(!_0x2c8bff){return logger['info'](_0x8ad9('0x11'));}if(this['edges'][_0x5b4ea6][_0x8ad9('0x12')]===0x0){return logger[_0x8ad9('0xf')]('no\x20edge/s\x20available');}for(var _0x396525=0x0,_0x2b7bdd=[],_0x21809a=![];_0x396525\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','traverseBFS','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','../../config/environment','../../config/logger','agi','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','log','port','info','format','[%s]\x20%s','stack','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','retry','mxCell','isArray','length','addEdge','source','target','getSquareProject','then','catch'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x765e,0x185));var _0xe765=function(_0x1deb60,_0x1046ff){_0x1deb60=_0x1deb60-0x0;var _0x296639=_0x765e[_0x1deb60];return _0x296639;};'use strict';var parser=require(_0xe765('0x0'));var _=require(_0xe765('0x1'));var syncho=require(_0xe765('0x2'));var util=require(_0xe765('0x3'));var moment=require('moment');var config=require(_0xe765('0x4'));var logger=require(_0xe765('0x5'))(_0xe765('0x6'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0xe765('0x7'));var Graph=require(_0xe765('0x8'));var Vertices=require(_0xe765('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xe765('0xa')](config[_0xe765('0x6')],{'ip':_0xe765('0xb'),'port':0x11dd});function connectionHandler(_0x53efb4){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x53efb4);agiHandler(_0x53efb4);}catch(_0x36ffbb){logger[_0xe765('0xc')](_0x36ffbb['stack']);}});});}function listeningHandler(){console[_0xe765('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xe765('0xe')]);logger[_0xe765('0xf')](util[_0xe765('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xe765('0x6')]['ip'],config[_0xe765('0x6')][_0xe765('0xe')]));}function errorHandler(_0x19db4c){if(_0x19db4c&&_0x19db4c['name']&&_0x19db4c['message']){logger[_0xe765('0xc')](util[_0xe765('0x10')](_0xe765('0x11'),_0x19db4c['name'],_0x19db4c['message']));}else{logger[_0xe765('0xc')](util[_0xe765('0x10')]('[ERROR]\x20%s',_0x19db4c[_0xe765('0x12')]));}}function closeHandler(){logger['info'](util[_0xe765('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe765('0x13')],this[_0xe765('0x14')],this[_0xe765('0x15')],this[_0xe765('0x16')],this[_0xe765('0x17')]));try{createSquareReport(this);}catch(_0x40ad02){logger[_0xe765('0xc')](_0x40ad02[_0xe765('0x12')]);}}function timeoutHandler(){logger[_0xe765('0xf')](util[_0xe765('0x10')](_0xe765('0x18'),this['arg_1'],this[_0xe765('0x14')],this['callerid'],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xe765('0xf')](util['format'](_0xe765('0x19'),this[_0xe765('0x13')],this[_0xe765('0x14')],this[_0xe765('0x15')],this[_0xe765('0x16')],this[_0xe765('0x17')]));this[_0xe765('0x1a')]=!![];}function getRoot(_0x5efb3b){return parser['toJson'](_0x5efb3b,{'object':!![]})[_0xe765('0x1b')][_0xe765('0x1c')];}function addVertex(_0x115ede,_0x241129,_0x5b3da5){_0x241129[_0xe765('0x1d')]=_0x5b3da5;if(_0x241129[_0xe765('0x1e')](_0xe765('0x1f'))){_0x241129['maxRetry']=parseInt(_0x241129['retry'],0xa);}_0x115ede['addVertex'](_['omit'](_0x241129,_0xe765('0x20')));}function initGraph(_0x595901,_0x2d4d2e){var _0x4ce72a=new Graph();for(var _0x4940b7 in _0x595901){if(_0x595901[_0xe765('0x1e')](_0x4940b7)){if(_[_0xe765('0x21')](_0x595901[_0x4940b7])){for(var _0x1ece93=0x0;_0x1ece93<_0x595901[_0x4940b7]['length'];_0x1ece93+=0x1){addVertex(_0x4ce72a,_0x595901[_0x4940b7][_0x1ece93],_0x4940b7);}}else{addVertex(_0x4ce72a,_0x595901[_0x4940b7],_0x4940b7);}}}for(var _0x1e3792=0x0;_0x1e3792<_0x2d4d2e[_0xe765('0x22')];_0x1e3792+=0x1){if(_0x2d4d2e[_0x1e3792]['source']&&_0x2d4d2e[_0x1e3792]['target']){_0x4ce72a[_0xe765('0x23')](_0x2d4d2e[_0x1e3792][_0xe765('0x24')],_0x2d4d2e[_0x1e3792][_0xe765('0x25')],_0x2d4d2e[_0x1e3792]['value']);}}return _0x4ce72a;}function getSquareProject(_0x2bb582,_0x433c8c){rpc[_0xe765('0x26')](_0x2bb582)[_0xe765('0x27')](function(_0x37c8e1){_0x433c8c(null,_0x37c8e1);})[_0xe765('0x28')](function(_0x526024){_0x433c8c(null,_0x526024);});}function createSquareReport(_0x14c27d,_0x516a31){rpc['createSquareReport'](_0x14c27d)[_0xe765('0x27')](function(_0x13d126){if(_0x516a31){_0x516a31(null,_0x13d126);}})['catch'](function(_0x12403a){if(_0x516a31){_0x516a31(null,_0x12403a);}});}function setChannelVariables(_0x20d395){for(var _0x37f467 in _0x20d395){if(_0x20d395[_0xe765('0x1e')](_0x37f467)){if(_0x37f467['indexOf'](_0xe765('0x29'))===0x0){_0x20d395[_0x37f467['substring'](0x4)]=_0x20d395[_0x37f467];delete _0x20d395[_0x37f467];}}}}function getLogFromObject(_0x21ddda){return util[_0xe765('0x2a')](_0x21ddda,{'showHidden':![],'depth':null});}function agiHandler(_0x18058f){var _0x11ed4d,_0x3db5d5,_0x178e82,_0x4b3ca8,_0x11638c;logger[_0xe765('0x2b')](_0xe765('0x2c'),JSON[_0xe765('0x2d')](_0x18058f,null,0x2));logger[_0xe765('0xf')](util[_0xe765('0x10')](_0xe765('0x2e'),_0x18058f[_0xe765('0x13')],_0x18058f[_0xe765('0x14')],_0x18058f[_0xe765('0x15')],_0x18058f[_0xe765('0x16')],_0x18058f['uniqueid']));_0x18058f['on'](_0xe765('0xc'),errorHandler);_0x18058f['on'](_0xe765('0x2f'),closeHandler);_0x18058f['on'](_0xe765('0x30'),timeoutHandler);_0x18058f[_0xe765('0x1a')]=![];_0x18058f['on'](_0xe765('0x31'),hangupHandler);var _0x145840=getSquareProject[_0xe765('0x32')](null,_0x18058f[_0xe765('0x13')]);if(_0x145840){if(_0x145840[_0xe765('0x33')]){_0x11ed4d=getRoot(_0x145840[_0xe765('0x33')]);if(_0x11ed4d&&_0x11ed4d[_0xe765('0x34')]){logger['debug'](_0xe765('0x1c'),JSON[_0xe765('0x2d')](_0x11ed4d,null,0x2));_0x18058f[_0xe765('0x35')]=moment()[_0xe765('0x10')](_0xe765('0x36'));_0x3db5d5=initGraph(_[_0xe765('0x37')](_0x11ed4d,_0xe765('0x20')),_0x11ed4d[_0xe765('0x20')]);_0x178e82=new Vertices(_0x18058f,rpc,mailRpc);logger[_0xe765('0xf')](util[_0xe765('0x10')](_0xe765('0x38'),_0x18058f[_0xe765('0x13')],_0x18058f[_0xe765('0x14')],_0x18058f[_0xe765('0x15')],_0x18058f['dnid'],_0x18058f[_0xe765('0x17')]));_0x3db5d5['traverseBFS'](_0x11ed4d[_0xe765('0x34')]['id'],function(_0x3b0b75){try{_0x3b0b75=_0x178e82[_0xe765('0x39')](_0x3b0b75);logger['debug'](_0xe765('0x3a'),JSON[_0xe765('0x2d')](_0x3b0b75,null,0x2));if(_0x3b0b75[_0xe765('0x1d')]===_0xe765('0x3b')){logger['info'](_0xe765('0x3c'));_0x18058f['context']=_0x3b0b75['context']||_0x18058f[_0xe765('0x3d')];_0x18058f[_0xe765('0x3e')]=_0x3b0b75[_0xe765('0x3e')];_0x18058f['priority']=_0x3b0b75[_0xe765('0x3f')]?_0x3b0b75['priority']-0x1:0x1;return null;}else if(_0x3b0b75&&_0x178e82[_0x3b0b75[_0xe765('0x1d')]]){_0x11638c=_0x178e82[_0x3b0b75[_0xe765('0x1d')]](_0x3b0b75);logger[_0xe765('0xf')]('response',JSON['stringify'](_0x11638c,null,0x2));if(_0x11638c&&_0x11638c[_0xe765('0x40')]===AGI_CODE_SUCCESS&&_0x11638c[_0xe765('0x41')]!==AGI_RESULT_ERROR&&!_0x18058f[_0xe765('0x1a')]){logger[_0xe765('0x2b')](_0xe765('0x42'),getLogFromObject(_0x11638c));return _[_0xe765('0x43')](_0x11638c[_0xe765('0x41')])?null:_0x11638c[_0xe765('0x41')][_0xe765('0x44')]();}else{logger[_0xe765('0xc')]('response',getLogFromObject(_0x11638c));return null;}}else{logger[_0xe765('0xc')](_0xe765('0x45'));return null;}}catch(_0x39b705){logger['error'](_0x39b705[_0xe765('0x12')]);return null;}});if(_0x11ed4d['finally']){logger[_0xe765('0xf')](util[_0xe765('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18058f['arg_1'],_0x18058f['calleridname'],_0x18058f['callerid'],_0x18058f['dnid'],_0x18058f[_0xe765('0x17')]));_0x3db5d5[_0xe765('0x46')](_0x11ed4d[_0xe765('0x47')]['id'],function(_0x586a1b){try{_0x586a1b=_0x178e82['clear'](_0x586a1b);logger['debug'](_0xe765('0x3a'),JSON[_0xe765('0x2d')](_0x586a1b,null,0x2));if(_0x586a1b&&_0x178e82[_0x586a1b['agicommand']]){_0x11638c=_0x178e82[_0x586a1b[_0xe765('0x1d')]](_0x586a1b);if(_0x11638c){logger['debug'](_0xe765('0x42'),getLogFromObject(_0x11638c));return _[_0xe765('0x43')](_0x11638c[_0xe765('0x41')])?null:_0x11638c['result'][_0xe765('0x44')]();}else{logger[_0xe765('0xc')]('response',getLogFromObject(_0x11638c));return null;}}else{logger[_0xe765('0xc')](_0xe765('0x45'));return null;}}catch(_0x59b036){logger[_0xe765('0xc')](_0x59b036[_0xe765('0x12')]);return null;}});}logger[_0xe765('0xf')](util['format'](_0xe765('0x48'),_0x18058f[_0xe765('0x13')],_0x18058f['calleridname'],_0x18058f['callerid'],_0x18058f[_0xe765('0x16')],_0x18058f[_0xe765('0x17')]));logger['info'](util[_0xe765('0x10')](_0xe765('0x49'),_0x18058f[_0xe765('0x3d')],_0x18058f['extension'],parseInt(_0x18058f['priority'],0xa)+0x1));_0x18058f[_0xe765('0x4a')](_0x18058f[_0xe765('0x3d')],_0x18058f[_0xe765('0x3e')],parseInt(_0x18058f['priority'],0xa)+0x1);_0x18058f[_0xe765('0x2f')]();}}else{logger[_0xe765('0xc')](util[_0xe765('0x10')](_0xe765('0x4b'),_0x18058f[_0xe765('0x13')]));_0x18058f[_0xe765('0x4a')](_0x18058f['context'],_0x18058f[_0xe765('0x3e')],parseInt(_0x18058f['priority'],0xa)+0x1);_0x18058f[_0xe765('0x2f')]();}}else{logger[_0xe765('0xc')](util[_0xe765('0x10')](_0xe765('0x4c'),_0x18058f['arg_1']));_0x18058f[_0xe765('0x4a')](_0x18058f[_0xe765('0x3d')],_0x18058f[_0xe765('0x3e')],parseInt(_0x18058f[_0xe765('0x3f')],0xa)+0x1);_0x18058f[_0xe765('0x2f')]();}}function main(){var _0x42b0ef;return utilLicense[_0xe765('0x4d')]()[_0xe765('0x27')](function(_0x1ac223){if(_0x1ac223){if(_0x1ac223[_0xe765('0x4e')]){if(_0x1ac223['callysquare']&&_0x1ac223[_0xe765('0x4f')]>0x0){logger[_0xe765('0xf')](util[_0xe765('0x10')](_0xe765('0x50'),_0x1ac223[_0xe765('0x4f')]));_0x42b0ef=_0x1ac223['callysquare'];}else{logger[_0xe765('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe765('0xf')](_0xe765('0x51'));_0x42b0ef=-0x1;}}})[_0xe765('0x28')](function(_0x49520d){logger[_0xe765('0xc')](_0xe765('0x52'),_0x49520d[_0xe765('0x12')]);})[_0xe765('0x47')](function(){var _0x4d87f7=require(_0xe765('0x53'))(config[_0xe765('0x6')][_0xe765('0xe')],config[_0xe765('0x6')]['ip'],_0x42b0ef);_0x4d87f7['on'](_0xe765('0xc'),errorHandler);_0x4d87f7['on'](_0xe765('0x54'),listeningHandler);_0x4d87f7['on'](_0xe765('0x55'),connectionHandler);_0x4d87f7['on'](_0xe765('0x2f'),closeHandler);});}main(); \ No newline at end of file +var _0xe975=['arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','isArray','length','target','addEdge','value','getSquareProject','then','indexOf','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','production','start','root','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','context','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','extension','continueAt','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','./mailRpc','./vertices','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x2969f3,_0x21c69b){var _0x25af83=function(_0x3d33f4){while(--_0x3d33f4){_0x2969f3['push'](_0x2969f3['shift']());}};_0x25af83(++_0x21c69b);}(_0xe975,0x1dc));var _0x5e97=function(_0x5b9e5f,_0x334006){_0x5b9e5f=_0x5b9e5f-0x0;var _0x28ddbb=_0xe975[_0x5b9e5f];return _0x28ddbb;};'use strict';var parser=require('xml2json');var _=require(_0x5e97('0x0'));var syncho=require(_0x5e97('0x1'));var util=require(_0x5e97('0x2'));var moment=require(_0x5e97('0x3'));var config=require(_0x5e97('0x4'));var logger=require(_0x5e97('0x5'))(_0x5e97('0x6'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x5e97('0x7'));var Graph=require('./graph');var Vertices=require(_0x5e97('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x5e97('0x6')]=_['defaults'](config['agi'],{'ip':_0x5e97('0x9'),'port':0x11dd});function connectionHandler(_0x4a00e8){process[_0x5e97('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4a00e8);agiHandler(_0x4a00e8);}catch(_0x5c2c14){logger[_0x5e97('0xb')](_0x5c2c14['stack']);}});});}function listeningHandler(){console[_0x5e97('0xc')](_0x5e97('0xd'),config['agi'][_0x5e97('0xe')]);logger[_0x5e97('0xf')](util[_0x5e97('0x10')](_0x5e97('0x11'),config[_0x5e97('0x6')]['ip'],config[_0x5e97('0x6')]['port']));}function errorHandler(_0x1ece51){if(_0x1ece51&&_0x1ece51[_0x5e97('0x12')]&&_0x1ece51[_0x5e97('0x13')]){logger['error'](util[_0x5e97('0x10')](_0x5e97('0x14'),_0x1ece51[_0x5e97('0x12')],_0x1ece51[_0x5e97('0x13')]));}else{logger[_0x5e97('0xb')](util[_0x5e97('0x10')](_0x5e97('0x15'),_0x1ece51[_0x5e97('0x16')]));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x5e97('0x17')],this[_0x5e97('0x18')],this[_0x5e97('0x19')],this[_0x5e97('0x1a')]));try{createSquareReport(this);}catch(_0x2e4ff3){logger[_0x5e97('0xb')](_0x2e4ff3[_0x5e97('0x16')]);}}function timeoutHandler(){logger[_0x5e97('0xf')](util[_0x5e97('0x10')](_0x5e97('0x1b'),this[_0x5e97('0x1c')],this[_0x5e97('0x17')],this['callerid'],this[_0x5e97('0x19')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x5e97('0x10')](_0x5e97('0x1d'),this[_0x5e97('0x1c')],this[_0x5e97('0x17')],this[_0x5e97('0x18')],this[_0x5e97('0x19')],this[_0x5e97('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x5c40f6){return parser[_0x5e97('0x1e')](_0x5c40f6,{'object':!![]})[_0x5e97('0x1f')]['root'];}function addVertex(_0x50486f,_0x37608e,_0x3c1fc0){_0x37608e[_0x5e97('0x20')]=_0x3c1fc0;if(_0x37608e[_0x5e97('0x21')]('retry')){_0x37608e[_0x5e97('0x22')]=parseInt(_0x37608e[_0x5e97('0x23')],0xa);}_0x50486f[_0x5e97('0x24')](_[_0x5e97('0x25')](_0x37608e,'mxCell'));}function initGraph(_0x3f334d,_0x37cbb1){var _0x2b6dc0=new Graph();for(var _0x605edc in _0x3f334d){if(_0x3f334d['hasOwnProperty'](_0x605edc)){if(_[_0x5e97('0x26')](_0x3f334d[_0x605edc])){for(var _0x28c524=0x0;_0x28c524<_0x3f334d[_0x605edc][_0x5e97('0x27')];_0x28c524+=0x1){addVertex(_0x2b6dc0,_0x3f334d[_0x605edc][_0x28c524],_0x605edc);}}else{addVertex(_0x2b6dc0,_0x3f334d[_0x605edc],_0x605edc);}}}for(var _0x36f601=0x0;_0x36f601<_0x37cbb1[_0x5e97('0x27')];_0x36f601+=0x1){if(_0x37cbb1[_0x36f601]['source']&&_0x37cbb1[_0x36f601][_0x5e97('0x28')]){_0x2b6dc0[_0x5e97('0x29')](_0x37cbb1[_0x36f601]['source'],_0x37cbb1[_0x36f601][_0x5e97('0x28')],_0x37cbb1[_0x36f601][_0x5e97('0x2a')]);}}return _0x2b6dc0;}function getSquareProject(_0x2c784b,_0x44f8eb){rpc[_0x5e97('0x2b')](_0x2c784b)[_0x5e97('0x2c')](function(_0xb643cb){_0x44f8eb(null,_0xb643cb);})['catch'](function(_0x54e4cc){_0x44f8eb(null,_0x54e4cc);});}function createSquareReport(_0x215259,_0x4971bd){rpc['createSquareReport'](_0x215259)[_0x5e97('0x2c')](function(_0xbb5411){if(_0x4971bd){_0x4971bd(null,_0xbb5411);}})['catch'](function(_0x292fa1){if(_0x4971bd){_0x4971bd(null,_0x292fa1);}});}function setChannelVariables(_0x13f328){for(var _0x15f8b4 in _0x13f328){if(_0x13f328[_0x5e97('0x21')](_0x15f8b4)){if(_0x15f8b4[_0x5e97('0x2d')]('agi_')===0x0){_0x13f328[_0x15f8b4['substring'](0x4)]=_0x13f328[_0x15f8b4];delete _0x13f328[_0x15f8b4];}}}}function getLogFromObject(_0x14e380){return util[_0x5e97('0x2e')](_0x14e380,{'showHidden':![],'depth':null});}function agiHandler(_0x2fc944){var _0x23144e,_0x144aba,_0x59f3c2,_0x3bc164,_0x1fdc62;logger[_0x5e97('0x2f')](_0x5e97('0x30'),JSON[_0x5e97('0x31')](_0x2fc944,null,0x2));logger[_0x5e97('0xf')](util['format'](_0x5e97('0x32'),_0x2fc944['arg_1'],_0x2fc944['calleridname'],_0x2fc944['callerid'],_0x2fc944[_0x5e97('0x19')],_0x2fc944[_0x5e97('0x1a')]));_0x2fc944['on'](_0x5e97('0xb'),errorHandler);_0x2fc944['on'](_0x5e97('0x33'),closeHandler);_0x2fc944['on']('timeout',timeoutHandler);_0x2fc944[_0x5e97('0x34')]=![];_0x2fc944['on']('hangup',hangupHandler);var _0x3dcc80=getSquareProject['sync'](null,_0x2fc944[_0x5e97('0x1c')]);if(_0x3dcc80){if(_0x3dcc80[_0x5e97('0x35')]){_0x23144e=getRoot(_0x3dcc80[_0x5e97('0x35')]);if(_0x23144e&&_0x23144e[_0x5e97('0x36')]){logger[_0x5e97('0x2f')](_0x5e97('0x37'),JSON['stringify'](_0x23144e,null,0x2));_0x2fc944[_0x5e97('0x38')]=moment()[_0x5e97('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x144aba=initGraph(_['omit'](_0x23144e,_0x5e97('0x39')),_0x23144e[_0x5e97('0x39')]);_0x59f3c2=new Vertices(_0x2fc944,rpc,mailRpc);logger[_0x5e97('0xf')](util[_0x5e97('0x10')](_0x5e97('0x3a'),_0x2fc944[_0x5e97('0x1c')],_0x2fc944['calleridname'],_0x2fc944[_0x5e97('0x18')],_0x2fc944[_0x5e97('0x19')],_0x2fc944[_0x5e97('0x1a')]));_0x144aba[_0x5e97('0x3b')](_0x23144e[_0x5e97('0x36')]['id'],function(_0x93d8d){try{_0x93d8d=_0x59f3c2[_0x5e97('0x3c')](_0x93d8d);logger[_0x5e97('0x2f')]('vertex',JSON['stringify'](_0x93d8d,null,0x2));if(_0x93d8d[_0x5e97('0x20')]===_0x5e97('0x3d')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2fc944[_0x5e97('0x3e')]=_0x93d8d[_0x5e97('0x3e')]||_0x2fc944['context'];_0x2fc944['extension']=_0x93d8d['extension'];_0x2fc944[_0x5e97('0x3f')]=_0x93d8d[_0x5e97('0x3f')]?_0x93d8d[_0x5e97('0x3f')]-0x1:0x1;return null;}else if(_0x93d8d&&_0x59f3c2[_0x93d8d[_0x5e97('0x20')]]){_0x1fdc62=_0x59f3c2[_0x93d8d[_0x5e97('0x20')]](_0x93d8d);logger[_0x5e97('0xf')](_0x5e97('0x40'),JSON[_0x5e97('0x31')](_0x1fdc62,null,0x2));if(_0x1fdc62&&_0x1fdc62[_0x5e97('0x41')]===AGI_CODE_SUCCESS&&_0x1fdc62[_0x5e97('0x42')]!==AGI_RESULT_ERROR&&!_0x2fc944[_0x5e97('0x34')]){logger[_0x5e97('0x2f')](_0x5e97('0x40'),getLogFromObject(_0x1fdc62));return _[_0x5e97('0x43')](_0x1fdc62[_0x5e97('0x42')])?null:_0x1fdc62['result'][_0x5e97('0x44')]();}else{logger[_0x5e97('0xb')](_0x5e97('0x40'),getLogFromObject(_0x1fdc62));return null;}}else{logger['error'](_0x5e97('0x45'));return null;}}catch(_0x20592b){logger['error'](_0x20592b['stack']);return null;}});if(_0x23144e['finally']){logger[_0x5e97('0xf')](util[_0x5e97('0x10')](_0x5e97('0x46'),_0x2fc944['arg_1'],_0x2fc944[_0x5e97('0x17')],_0x2fc944[_0x5e97('0x18')],_0x2fc944[_0x5e97('0x19')],_0x2fc944[_0x5e97('0x1a')]));_0x144aba[_0x5e97('0x3b')](_0x23144e['finally']['id'],function(_0x30f193){try{_0x30f193=_0x59f3c2[_0x5e97('0x3c')](_0x30f193);logger[_0x5e97('0x2f')](_0x5e97('0x47'),JSON[_0x5e97('0x31')](_0x30f193,null,0x2));if(_0x30f193&&_0x59f3c2[_0x30f193[_0x5e97('0x20')]]){_0x1fdc62=_0x59f3c2[_0x30f193[_0x5e97('0x20')]](_0x30f193);if(_0x1fdc62){logger['debug']('response',getLogFromObject(_0x1fdc62));return _[_0x5e97('0x43')](_0x1fdc62[_0x5e97('0x42')])?null:_0x1fdc62['result']['toString']();}else{logger[_0x5e97('0xb')](_0x5e97('0x40'),getLogFromObject(_0x1fdc62));return null;}}else{logger[_0x5e97('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x19fe80){logger['error'](_0x19fe80['stack']);return null;}});}logger['info'](util[_0x5e97('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2fc944[_0x5e97('0x1c')],_0x2fc944[_0x5e97('0x17')],_0x2fc944['callerid'],_0x2fc944[_0x5e97('0x19')],_0x2fc944[_0x5e97('0x1a')]));logger[_0x5e97('0xf')](util[_0x5e97('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2fc944[_0x5e97('0x3e')],_0x2fc944[_0x5e97('0x48')],parseInt(_0x2fc944[_0x5e97('0x3f')],0xa)+0x1));_0x2fc944['continueAt'](_0x2fc944[_0x5e97('0x3e')],_0x2fc944['extension'],parseInt(_0x2fc944[_0x5e97('0x3f')],0xa)+0x1);_0x2fc944['close']();}}else{logger[_0x5e97('0xb')](util[_0x5e97('0x10')]('Project\x20%s\x20not\x20published',_0x2fc944[_0x5e97('0x1c')]));_0x2fc944['continueAt'](_0x2fc944[_0x5e97('0x3e')],_0x2fc944['extension'],parseInt(_0x2fc944['priority'],0xa)+0x1);_0x2fc944[_0x5e97('0x33')]();}}else{logger[_0x5e97('0xb')](util[_0x5e97('0x10')]('Project\x20%s\x20not\x20found',_0x2fc944[_0x5e97('0x1c')]));_0x2fc944[_0x5e97('0x49')](_0x2fc944['context'],_0x2fc944['extension'],parseInt(_0x2fc944[_0x5e97('0x3f')],0xa)+0x1);_0x2fc944[_0x5e97('0x33')]();}}function main(){var _0x30f7d1;return utilLicense['getLicense']()[_0x5e97('0x2c')](function(_0x86f625){if(_0x86f625){if(_0x86f625[_0x5e97('0x4a')]){if(_0x86f625[_0x5e97('0x4b')]&&_0x86f625[_0x5e97('0x4b')]>0x0){logger['info'](util['format'](_0x5e97('0x4c'),_0x86f625[_0x5e97('0x4b')]));_0x30f7d1=_0x86f625[_0x5e97('0x4b')];}else{logger['info'](_0x5e97('0x4d'));}}else{logger[_0x5e97('0xf')](_0x5e97('0x4e'));_0x30f7d1=-0x1;}}})[_0x5e97('0x4f')](function(_0x26a1ae){logger[_0x5e97('0xb')](_0x5e97('0x50'),_0x26a1ae['stack']);})['finally'](function(){var _0x4ebc31=require(_0x5e97('0x51'))(config[_0x5e97('0x6')][_0x5e97('0xe')],config['agi']['ip'],_0x30f7d1);_0x4ebc31['on']('error',errorHandler);_0x4ebc31['on'](_0x5e97('0x52'),listeningHandler);_0x4ebc31['on'](_0x5e97('0x53'),connectionHandler);_0x4ebc31['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 3b5fe81..836b65d 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 _0x52f2=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x52f2,0xe6));var _0x252f=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x52f2[_0x139a3c];return _0x2b375b;};'use strict';var BPromise=require(_0x252f('0x0'));var jayson=require(_0x252f('0x1'));var client=jayson[_0x252f('0x2')]['http']({'port':0x232b});function request(_0x49cede,_0x49e959){return new BPromise(function(_0x55a622,_0x3bb7be){return client['request'](_0x49cede,_0x49e959)[_0x252f('0x3')](function(_0x1c5fb2){if(_0x1c5fb2[_0x252f('0x4')]){return _0x3bb7be(_0x1c5fb2[_0x252f('0x4')][_0x252f('0x5')]);}else{return _0x55a622(_0x1c5fb2['result']);}})[_0x252f('0x6')](function(_0x396da2){return _0x3bb7be(_0x396da2);});});}exports[_0x252f('0x7')]=function(_0x424032,_0x541961){return request(_0x252f('0x8'),{'account':_0x424032,'message':_0x541961});}; \ No newline at end of file +var _0x309c=['http','request','then','error','result','catch','sendMailMessage','SendMail','jayson/promise','client'];(function(_0x445b7e,_0x3ea85f){var _0x17d997=function(_0x805f31){while(--_0x805f31){_0x445b7e['push'](_0x445b7e['shift']());}};_0x17d997(++_0x3ea85f);}(_0x309c,0x10c));var _0xc309=function(_0x5e220c,_0x120018){_0x5e220c=_0x5e220c-0x0;var _0xbfbd23=_0x309c[_0x5e220c];return _0xbfbd23;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc309('0x0'));var client=jayson[_0xc309('0x1')][_0xc309('0x2')]({'port':0x232b});function request(_0x1e9092,_0x51984f){return new BPromise(function(_0x10a93e,_0x157525){return client[_0xc309('0x3')](_0x1e9092,_0x51984f)[_0xc309('0x4')](function(_0x7ad7fa){if(_0x7ad7fa[_0xc309('0x5')]){return _0x157525(_0x7ad7fa[_0xc309('0x5')]['message']);}else{return _0x10a93e(_0x7ad7fa[_0xc309('0x6')]);}})[_0xc309('0x7')](function(_0x38190b){return _0x157525(_0x38190b);});});}exports[_0xc309('0x8')]=function(_0x735dfe,_0x3086c1){return request(_0xc309('0x9'),{'account':_0x735dfe,'message':_0x3086c1});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 0dccd7f..d0b02bb 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 _0x96cc=['headers','line','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','indexOf','substring','split','slice','trim','length','emit'];(function(_0x591f88,_0x5267a8){var _0x401322=function(_0x373779){while(--_0x373779){_0x591f88['push'](_0x591f88['shift']());}};_0x401322(++_0x5267a8);}(_0x96cc,0x16c));var _0xc96c=function(_0x18b9a8,_0x1770b6){_0x18b9a8=_0x18b9a8-0x0;var _0x4a0a8f=_0x96cc[_0x18b9a8];return _0x4a0a8f;};'use strict';var util=require(_0xc96c('0x0'));var Transform=require('stream')[_0xc96c('0x1')];function AGIReply(_0x5f11f2){Transform[_0xc96c('0x2')](this,_0x5f11f2);this[_0xc96c('0x3')]='';this[_0xc96c('0x4')]=![];}util[_0xc96c('0x5')](AGIReply,Transform);AGIReply[_0xc96c('0x6')][_0xc96c('0x7')]=function(_0x377e6c,_0x7b632c,_0x3b7f45){var _0x5142cd='\x0a',_0x10b411=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x18eb9c=-0x1,_0x408afb=-0x1,_0x86c1a8='',_0x13363d=0x0,_0x4c9f93='',_0x36b2b4='';this[_0xc96c('0x3')]+=_0x377e6c[_0xc96c('0x8')]();_0x4c9f93=this[_0xc96c('0x3')];if(!this['_inBody']){_0x13363d=0x0;while(_0x10b411[_0x13363d]){while((_0x408afb=_0x4c9f93[_0xc96c('0x9')](_0x10b411[_0x13363d]))!=-0x1){_0x86c1a8=_0x10b411[_0x13363d];_0x36b2b4=_0x4c9f93['substring'](0x0,_0x408afb);_0x4c9f93=_0x4c9f93[_0xc96c('0xa')](_0x408afb+_0x86c1a8['length']);var _0x18a1a6=_0x36b2b4[_0xc96c('0xb')](_0x5142cd),_0x32f682=0x0,_0x3ef47a={},_0x246a95='',_0x5f27f3='',_0x3fe3d5=-0x1;while(_0x18a1a6[_0x32f682]){_0x3fe3d5=_0x18a1a6[_0x32f682][_0xc96c('0x9')](':');if(_0x3fe3d5!=-0x1){_0x246a95=_0x18a1a6[_0x32f682][_0xc96c('0xc')](0x0,_0x3fe3d5)['trim']();_0x5f27f3=_0x18a1a6[_0x32f682][_0xc96c('0xc')](_0x3fe3d5+0x1)[_0xc96c('0xd')]();if(_0x246a95[_0xc96c('0xe')]>0x0){_0x3ef47a[_0x246a95]=_0x5f27f3;}}else{}_0x32f682++;}this[_0xc96c('0xf')](_0xc96c('0x10'),_0x3ef47a);this[_0xc96c('0x4')]=!![];}_0x13363d++;}this[_0xc96c('0x3')]=_0x4c9f93;}else{while((_0x18eb9c=_0x4c9f93[_0xc96c('0x9')](_0x5142cd))!=-0x1){_0x36b2b4=_0x4c9f93[_0xc96c('0xa')](0x0,_0x18eb9c);this[_0xc96c('0xf')](_0xc96c('0x11'),_0x36b2b4);_0x4c9f93=_0x4c9f93['substring'](_0x18eb9c+_0x5142cd['length']);}this[_0xc96c('0x3')]=_0x4c9f93;}_0x3b7f45();};module[_0xc96c('0x12')]=AGIReply; \ No newline at end of file +var _0x3dd3=['Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','length','split','indexOf','slice','trim','headers','emit','util','stream'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x3dd3,0x1d2));var _0x33dd=function(_0x23d10c,_0x3a1f58){_0x23d10c=_0x23d10c-0x0;var _0x3cf657=_0x3dd3[_0x23d10c];return _0x3cf657;};'use strict';var util=require(_0x33dd('0x0'));var Transform=require(_0x33dd('0x1'))[_0x33dd('0x2')];function AGIReply(_0x53288a){Transform[_0x33dd('0x3')](this,_0x53288a);this[_0x33dd('0x4')]='';this[_0x33dd('0x5')]=![];}util[_0x33dd('0x6')](AGIReply,Transform);AGIReply[_0x33dd('0x7')][_0x33dd('0x8')]=function(_0x358f1c,_0x18d946,_0x396990){var _0x5d7276='\x0a',_0x57c4fe=['\x0a\x0a',_0x33dd('0x9')],_0x12b2cb=-0x1,_0x1adf78=-0x1,_0x1f4801='',_0x446c36=0x0,_0x3b5a63='',_0x83c115='';this[_0x33dd('0x4')]+=_0x358f1c[_0x33dd('0xa')]();_0x3b5a63=this[_0x33dd('0x4')];if(!this[_0x33dd('0x5')]){_0x446c36=0x0;while(_0x57c4fe[_0x446c36]){while((_0x1adf78=_0x3b5a63['indexOf'](_0x57c4fe[_0x446c36]))!=-0x1){_0x1f4801=_0x57c4fe[_0x446c36];_0x83c115=_0x3b5a63['substring'](0x0,_0x1adf78);_0x3b5a63=_0x3b5a63['substring'](_0x1adf78+_0x1f4801[_0x33dd('0xb')]);var _0x4faab6=_0x83c115[_0x33dd('0xc')](_0x5d7276),_0x4496e0=0x0,_0x5b14b4={},_0x1e6e3d='',_0xb4aeba='',_0x31d23f=-0x1;while(_0x4faab6[_0x4496e0]){_0x31d23f=_0x4faab6[_0x4496e0][_0x33dd('0xd')](':');if(_0x31d23f!=-0x1){_0x1e6e3d=_0x4faab6[_0x4496e0][_0x33dd('0xe')](0x0,_0x31d23f)[_0x33dd('0xf')]();_0xb4aeba=_0x4faab6[_0x4496e0]['slice'](_0x31d23f+0x1)['trim']();if(_0x1e6e3d[_0x33dd('0xb')]>0x0){_0x5b14b4[_0x1e6e3d]=_0xb4aeba;}}else{}_0x4496e0++;}this['emit'](_0x33dd('0x10'),_0x5b14b4);this[_0x33dd('0x5')]=!![];}_0x446c36++;}this['_localBuffer']=_0x3b5a63;}else{while((_0x12b2cb=_0x3b5a63[_0x33dd('0xd')](_0x5d7276))!=-0x1){_0x83c115=_0x3b5a63['substring'](0x0,_0x12b2cb);this[_0x33dd('0x11')]('line',_0x83c115);_0x3b5a63=_0x3b5a63['substring'](_0x12b2cb+_0x5d7276[_0x33dd('0xb')]);}this[_0x33dd('0x4')]=_0x3b5a63;}_0x396990();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7baa711..15fce19 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 _0xf836=['ShowMailAccount','MailServerOut','Smtp','getSquareProjectById','name','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','moment','lodash','util','client','http','then','error','message','catch','ShowSquareProject','production','getMailAccountById'];(function(_0x5a194b,_0x58febf){var _0x1b9993=function(_0x2ea19b){while(--_0x2ea19b){_0x5a194b['push'](_0x5a194b['shift']());}};_0x1b9993(++_0x58febf);}(_0xf836,0x12c));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var moment=require(_0x6f83('0x0'));var _=require(_0x6f83('0x1'));var util=require(_0x6f83('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x6f83('0x3')][_0x6f83('0x4')]({'port':0x2329});function request(_0x36c11f,_0x54d99a){return new BPromise(function(_0x1a8d44,_0x565c19){return client['request'](_0x36c11f,_0x54d99a)[_0x6f83('0x5')](function(_0x461f41){if(_0x461f41['error']){return _0x565c19(_0x461f41[_0x6f83('0x6')][_0x6f83('0x7')]);}else{return _0x1a8d44(_0x461f41['result']);}})[_0x6f83('0x8')](function(_0x568bba){return _0x565c19(_0x568bba);});});}exports['getSquareProject']=function(_0x498ed3){return request(_0x6f83('0x9'),{'options':{'raw':![],'where':{'name':_0x498ed3},'attributes':[_0x6f83('0xa')]}});};exports[_0x6f83('0xb')]=function(_0x40b083){return request(_0x6f83('0xc'),{'options':{'raw':![],'where':{'id':_0x40b083},'include':[{'model':_0x6f83('0xd'),'as':_0x6f83('0xe')}],'attributes':['id','name','email']}});};exports[_0x6f83('0xf')]=function(_0x17037d){return request(_0x6f83('0x9'),{'options':{'where':{'id':_0x17037d},'attributes':[_0x6f83('0x10')]}});};exports['getVoiceQueueById']=function(_0x33c4b5){return request(_0x6f83('0x11'),{'options':{'where':{'id':_0x33c4b5},'attributes':[_0x6f83('0x10')]}});};exports[_0x6f83('0x12')]=function(_0x120459){return request('ShowVariable',{'options':{'where':{'id':_0x120459},'attributes':[_0x6f83('0x10')]}});};exports[_0x6f83('0x13')]=function(_0x28ff46){return request(_0x6f83('0x14'),{'options':{'where':{'id':_0x28ff46},'attributes':[_0x6f83('0x15')]}});};exports['getUserById']=function(_0xc4664b){return request('ShowUser',{'options':{'where':{'id':_0xc4664b},'attributes':[_0x6f83('0x10')]}});};exports[_0x6f83('0x16')]=function(_0x19cb98){return request(_0x6f83('0x17'),{'options':{'where':{'id':_0x19cb98},'attributes':[_0x6f83('0x10')]}});};exports['getSoundById']=function(_0x2c135d){return request(_0x6f83('0x18'),{'options':{'where':{'id':_0x2c135d},'attributes':[_0x6f83('0x19')]}});};exports[_0x6f83('0x1a')]=function(_0x4bd48d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4bd48d},'include':[{'model':_0x6f83('0x1b'),'as':'Intervals'}]}});};exports[_0x6f83('0x1c')]=function(_0x3fd869){return request(_0x6f83('0x1d'),{'options':{'where':{'id':_0x3fd869},'attributes':['id',_0x6f83('0x10')]}});};exports['createSmsMessage']=function(_0x6e236d){return request('CreateSmsMessage',{'body':_0x6e236d});};exports[_0x6f83('0x1e')]=function(_0x4aa8e6){return request(_0x6f83('0x1f'),{'body':_0x4aa8e6});};exports[_0x6f83('0x20')]=function(_0x30c0c4){return request(_0x6f83('0x21'),{'body':_[_0x6f83('0x22')](_0x30c0c4,{'project_name':_0x30c0c4[_0x6f83('0x23')],'prev_project_name':_0x30c0c4[_0x6f83('0x24')]||'','is_subproject':_0x30c0c4[_0x6f83('0x24')]?!![]:![],'leaveAt':moment()[_0x6f83('0x25')](_0x6f83('0x26'))})});};exports[_0x6f83('0x27')]=function(_0x7a177c){return request('CreateSquareRecording',{'body':_0x7a177c});};exports[_0x6f83('0x28')]=function(_0x4021f6){return request(_0x6f83('0x29'),{'body':_0x4021f6});};exports[_0x6f83('0x2a')]=function(_0x26d7fa){return request(_0x6f83('0x2b'),{'options':{'raw':![],'where':{'phone':_0x26d7fa['phone'],'ListId':_0x26d7fa[_0x6f83('0x2c')]}}})['then'](function(_0x4b2930){if(_0x4b2930){return _0x4b2930;}return request('CreateCmContact',{'body':_0x26d7fa});});};exports[_0x6f83('0x2d')]=function(_0x308adc){return request(_0x6f83('0x2e'),{'options':{'where':{'id':_0x308adc},'attributes':[_0x6f83('0x10')]}});};exports[_0x6f83('0x2f')]=function(_0x11b38b,_0x577d09){return request(_0x6f83('0x30'),{'body':{'interface':_0x577d09},'options':{'where':_0x11b38b}});};exports['agentPause']=function(_0x154845,_0x31bee3,_0xddba21){return request(_0x6f83('0x31'),{'body':{'type':_0x31bee3,'uniqueid':_0xddba21},'options':{'where':_0x154845}});};exports[_0x6f83('0x32')]=function(_0x14831d){return request('UnpauseUser',{'body':{},'options':{'where':_0x14831d}});};exports[_0x6f83('0x33')]=function(_0x4935e0){return request('LogoutUser',{'body':{},'options':{'where':_0x4935e0}});}; \ No newline at end of file +var _0x13b6=['arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getMailAccountById','MailServerOut','name','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVariable','getSquareOdbcById','getUserById','getSoundById','save_name','getIntervalById','ShowInterval','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x24d72c,_0x24fe61){var _0x39c9d6=function(_0x265058){while(--_0x265058){_0x24d72c['push'](_0x24d72c['shift']());}};_0x39c9d6(++_0x24fe61);}(_0x13b6,0xaf));var _0x613b=function(_0x231970,_0x5df805){_0x231970=_0x231970-0x0;var _0x1477ac=_0x13b6[_0x231970];return _0x1477ac;};'use strict';var BPromise=require(_0x613b('0x0'));var moment=require(_0x613b('0x1'));var _=require(_0x613b('0x2'));var util=require(_0x613b('0x3'));var jayson=require(_0x613b('0x4'));var client=jayson[_0x613b('0x5')][_0x613b('0x6')]({'port':0x2329});function request(_0x3f5c71,_0x3d3149){return new BPromise(function(_0x167fc5,_0x4ef416){return client[_0x613b('0x7')](_0x3f5c71,_0x3d3149)[_0x613b('0x8')](function(_0x239697){if(_0x239697['error']){return _0x4ef416(_0x239697[_0x613b('0x9')][_0x613b('0xa')]);}else{return _0x167fc5(_0x239697[_0x613b('0xb')]);}})[_0x613b('0xc')](function(_0xa65380){return _0x4ef416(_0xa65380);});});}exports['getSquareProject']=function(_0x4ada35){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x4ada35},'attributes':['production']}});};exports[_0x613b('0xd')]=function(_0x87feb0){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x87feb0},'include':[{'model':_0x613b('0xe'),'as':'Smtp'}],'attributes':['id',_0x613b('0xf'),'email']}});};exports[_0x613b('0x10')]=function(_0xcecf23){return request(_0x613b('0x11'),{'options':{'where':{'id':_0xcecf23},'attributes':[_0x613b('0xf')]}});};exports[_0x613b('0x12')]=function(_0x1934f5){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1934f5},'attributes':[_0x613b('0xf')]}});};exports['getVariableById']=function(_0x5ebace){return request(_0x613b('0x13'),{'options':{'where':{'id':_0x5ebace},'attributes':[_0x613b('0xf')]}});};exports[_0x613b('0x14')]=function(_0x2cabce){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2cabce},'attributes':['dsn']}});};exports[_0x613b('0x15')]=function(_0x4b5256){return request('ShowUser',{'options':{'where':{'id':_0x4b5256},'attributes':[_0x613b('0xf')]}});};exports['getTrunkById']=function(_0x4a07e8){return request('ShowTrunk',{'options':{'where':{'id':_0x4a07e8},'attributes':['name']}});};exports[_0x613b('0x16')]=function(_0x457a1){return request('ShowSound',{'options':{'where':{'id':_0x457a1},'attributes':[_0x613b('0x17')]}});};exports[_0x613b('0x18')]=function(_0x132b89){return request(_0x613b('0x19'),{'options':{'raw':![],'where':{'id':_0x132b89},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x613b('0x1a')]=function(_0x19c5c9){return request('ShowSmsAccount',{'options':{'where':{'id':_0x19c5c9},'attributes':['id',_0x613b('0xf')]}});};exports[_0x613b('0x1b')]=function(_0x393c50){return request(_0x613b('0x1c'),{'body':_0x393c50});};exports['createSquareDetailsReport']=function(_0x229835){return request(_0x613b('0x1d'),{'body':_0x229835});};exports[_0x613b('0x1e')]=function(_0x3f6b80){return request(_0x613b('0x1f'),{'body':_[_0x613b('0x20')](_0x3f6b80,{'project_name':_0x3f6b80[_0x613b('0x21')],'prev_project_name':_0x3f6b80[_0x613b('0x22')]||'','is_subproject':_0x3f6b80[_0x613b('0x22')]?!![]:![],'leaveAt':moment()[_0x613b('0x23')](_0x613b('0x24'))})});};exports['createSquareRecording']=function(_0x1f7ba3){return request(_0x613b('0x25'),{'body':_0x1f7ba3});};exports[_0x613b('0x26')]=function(_0x30b6ed){return request(_0x613b('0x27'),{'body':_0x30b6ed});};exports[_0x613b('0x28')]=function(_0x50a701){return request(_0x613b('0x29'),{'options':{'raw':![],'where':{'phone':_0x50a701[_0x613b('0x2a')],'ListId':_0x50a701['ListId']}}})[_0x613b('0x8')](function(_0x261569){if(_0x261569){return _0x261569;}return request(_0x613b('0x2b'),{'body':_0x50a701});});};exports['getPauseById']=function(_0x4ad21f){return request(_0x613b('0x2c'),{'options':{'where':{'id':_0x4ad21f},'attributes':['name']}});};exports[_0x613b('0x2d')]=function(_0x403390,_0x2131af){return request(_0x613b('0x2e'),{'body':{'interface':_0x2131af},'options':{'where':_0x403390}});};exports[_0x613b('0x2f')]=function(_0x1b02f6,_0x3b2c5e,_0x53e9a2){return request(_0x613b('0x30'),{'body':{'type':_0x3b2c5e,'uniqueid':_0x53e9a2},'options':{'where':_0x1b02f6}});};exports[_0x613b('0x31')]=function(_0x14f705){return request(_0x613b('0x32'),{'body':{},'options':{'where':_0x14f705}});};exports['agentLogout']=function(_0x38b2fe){return request(_0x613b('0x33'),{'body':{},'options':{'where':_0x38b2fe}});}; \ 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 9d7c3fc..220467c 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 _0xa87e=['./polly','./lex','exports'];(function(_0xb5e970,_0x1bbed0){var _0x5d85d8=function(_0x34b028){while(--_0x34b028){_0xb5e970['push'](_0xb5e970['shift']());}};_0x5d85d8(++_0x1bbed0);}(_0xa87e,0x1c2));var _0xea87=function(_0x551b65,_0x1d7d84){_0x551b65=_0x551b65-0x0;var _0x4db52d=_0xa87e[_0x551b65];return _0x4db52d;};var polly=require(_0xea87('0x0'));var lex=require(_0xea87('0x1'));module[_0xea87('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1059=['./polly','./lex'];(function(_0x366162,_0xc606b6){var _0x528966=function(_0x26ae87){while(--_0x26ae87){_0x366162['push'](_0x366162['shift']());}};_0x528966(++_0xc606b6);}(_0x1059,0x176));var _0x9105=function(_0x21bc27,_0x20c9da){_0x21bc27=_0x21bc27-0x0;var _0x56790c=_0x1059[_0x21bc27];return _0x56790c;};var polly=require(_0x9105('0x0'));var lex=require(_0x9105('0x1'));module['exports']={'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 a0263e7..0ddccf5 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 _0x153f=['exports','./lib/api'];(function(_0x298b53,_0x3f830d){var _0x370c14=function(_0x16a8d7){while(--_0x16a8d7){_0x298b53['push'](_0x298b53['shift']());}};_0x370c14(++_0x3f830d);}(_0x153f,0x15b));var _0xf153=function(_0x246a14,_0x3723a3){_0x246a14=_0x246a14-0x0;var _0x3ff683=_0x153f[_0x246a14];return _0x3ff683;};'use strict';var lex=require(_0xf153('0x0'));module[_0xf153('0x1')]=function(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c){return lex(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c);}; \ No newline at end of file +var _0xe706=['exports','./lib/api'];(function(_0x24a145,_0x4fa848){var _0x407a33=function(_0x3842a6){while(--_0x3842a6){_0x24a145['push'](_0x24a145['shift']());}};_0x407a33(++_0x4fa848);}(_0xe706,0xa3));var _0x6e70=function(_0x17a842,_0x1ac67a){_0x17a842=_0x17a842-0x0;var _0x142199=_0xe706[_0x17a842];return _0x142199;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ 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 9c1eb77..a8c259b 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(_0x180152,_0xc4c291){var _0x131436=function(_0x505926){while(--_0x505926){_0x180152['push'](_0x180152['shift']());}};_0x131436(++_0xc4c291);}(_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 +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x46a266,_0x499e9f){var _0x819f86=function(_0x1ffa44){while(--_0x1ffa44){_0x46a266['push'](_0x46a266['shift']());}};_0x819f86(++_0x499e9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 9988bed..6e55ff4 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 _0xeba1=['exports'];(function(_0x2621b8,_0x585026){var _0x20027d=function(_0x25a06f){while(--_0x25a06f){_0x2621b8['push'](_0x2621b8['shift']());}};_0x20027d(++_0x585026);}(_0xeba1,0x9f));var _0x1eba=function(_0x4c84ee,_0x44be8d){_0x4c84ee=_0x4c84ee-0x0;var _0x9e14=_0xeba1[_0x4c84ee];return _0x9e14;};'use strict';var polly=require('./lib/api');module[_0x1eba('0x0')]=function(_0x2762e1,_0x17e6f4,_0x2b3a3c,_0x30aa58,_0x23fed3,_0x5807e8,_0x255283){return polly(_0x2762e1,_0x17e6f4,_0x2b3a3c,_0x30aa58,_0x23fed3,_0x5807e8,_0x255283);}; \ No newline at end of file +var _0x21b6=['./lib/api','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x21b6,0x1ce));var _0x621b=function(_0x244188,_0x5f0b9a){_0x244188=_0x244188-0x0;var _0x2f6270=_0x21b6[_0x244188];return _0x2f6270;};'use strict';var polly=require(_0x621b('0x0'));module[_0x621b('0x1')]=function(_0xd1437a,_0xf24ce0,_0x47f830,_0x110961,_0x5c60b2,_0x4343bf,_0x3f8875){return polly(_0xd1437a,_0xf24ce0,_0x47f830,_0x110961,_0x5c60b2,_0x4343bf,_0x3f8875);}; \ 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 4a0537a..b276037 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 _0x0cff=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x41d1c2,_0x9b667b){var _0x38eacb=function(_0x53a952){while(--_0x53a952){_0x41d1c2['push'](_0x41d1c2['shift']());}};_0x38eacb(++_0x9b667b);}(_0x0cff,0x130));var _0xf0cf=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x0cff[_0x3afe18];return _0x19ed1f;};'use strict';var fs=require('fs');var path=require(_0xf0cf('0x0'));var BPromise=require(_0xf0cf('0x1'));var rs=require('randomstring');var AWS=require(_0xf0cf('0x2'));function pollyResult(_0xf2a527,_0xc76cb3,_0x102230){return new BPromise(function(_0xcc8824,_0x15e27b){_0xf2a527[_0xf0cf('0x3')](_0xc76cb3,function(_0x42ce2a,_0x5af443){if(_0x42ce2a){_0x15e27b(_0x42ce2a);}else if(_0x5af443){if(_0x5af443['AudioStream']instanceof Buffer){fs['writeFile'](_0x102230,_0x5af443[_0xf0cf('0x4')],function(_0x1cb417){if(_0x1cb417){_0x15e27b(_0x1cb417);}else{_0xcc8824();}});}else{_0x15e27b(new Error(_0xf0cf('0x5')));}}else{_0x15e27b(new Error(_0xf0cf('0x6')));}});});}module['exports']=function(_0x44ae4e,_0x3129ce,_0x1e3726,_0x3d402b,_0x3ad824,_0x220c2d,_0x229d27){var _0xfbc0b1=new AWS[(_0xf0cf('0x7'))]({'accessKeyId':_0x44ae4e,'secretAccessKey':_0x3129ce,'region':_0x1e3726});var _0x21e4da={'Text':_0x3ad824,'TextType':_0x220c2d||_0xf0cf('0x8'),'OutputFormat':_0xf0cf('0x9'),'VoiceId':_0x3d402b};return pollyResult(_0xfbc0b1,_0x21e4da,_0x229d27);}; \ No newline at end of file +var _0x8229=['mp3','path','bluebird','randomstring','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x18afdb,_0xa73905){var _0x4f22e5=function(_0xdf86d9){while(--_0xdf86d9){_0x18afdb['push'](_0x18afdb['shift']());}};_0x4f22e5(++_0xa73905);}(_0x8229,0xbc));var _0x9822=function(_0x3fbfc4,_0x33991f){_0x3fbfc4=_0x3fbfc4-0x0;var _0x445130=_0x8229[_0x3fbfc4];return _0x445130;};'use strict';var fs=require('fs');var path=require(_0x9822('0x0'));var BPromise=require(_0x9822('0x1'));var rs=require(_0x9822('0x2'));var AWS=require(_0x9822('0x3'));function pollyResult(_0x5872fb,_0x4722ce,_0x61d1e7){return new BPromise(function(_0x46f91,_0x13265a){_0x5872fb['synthesizeSpeech'](_0x4722ce,function(_0x5e1476,_0x1ce4ff){if(_0x5e1476){_0x13265a(_0x5e1476);}else if(_0x1ce4ff){if(_0x1ce4ff[_0x9822('0x4')]instanceof Buffer){fs['writeFile'](_0x61d1e7,_0x1ce4ff[_0x9822('0x4')],function(_0x28c1ea){if(_0x28c1ea){_0x13265a(_0x28c1ea);}else{_0x46f91();}});}else{_0x13265a(new Error(_0x9822('0x5')));}}else{_0x13265a(new Error(_0x9822('0x6')));}});});}module[_0x9822('0x7')]=function(_0x495d29,_0x3ffbd6,_0x6af6ea,_0x26cf7c,_0xa03aed,_0x39e8bc,_0x43f920){var _0x13c81e=new AWS[(_0x9822('0x8'))]({'accessKeyId':_0x495d29,'secretAccessKey':_0x3ffbd6,'region':_0x6af6ea});var _0xd22a41={'Text':_0xa03aed,'TextType':_0x39e8bc||_0x9822('0x9'),'OutputFormat':_0x9822('0xa'),'VoiceId':_0x26cf7c};return pollyResult(_0x13c81e,_0xd22a41,_0x43f920);}; \ 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 a411242..ce4ee18 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 _0x3bfd=['exports','./lib/api'];(function(_0x334201,_0x39f06f){var _0x134700=function(_0x28d73f){while(--_0x28d73f){_0x334201['push'](_0x334201['shift']());}};_0x134700(++_0x39f06f);}(_0x3bfd,0x151));var _0xd3bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bfd[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xd3bf('0x0'));module[_0xd3bf('0x1')]=function(_0x120ce7,_0x284f40,_0x2add3b,_0x23674e){return asr(_0x120ce7,_0x284f40,_0x2add3b);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x54455f,_0x76d3f2,_0x24edfd,_0x46f0ca){return asr(_0x54455f,_0x76d3f2,_0x24edfd);}; \ 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 1ea6837..280810b 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 _0xd6ce=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','url','bluebird'];(function(_0x1fed13,_0x51ebce){var _0xe35720=function(_0x2c88bc){while(--_0x2c88bc){_0x1fed13['push'](_0x1fed13['shift']());}};_0xe35720(++_0x51ebce);}(_0xd6ce,0x127));var _0xed6c=function(_0x1408f0,_0x46b826){_0x1408f0=_0x1408f0-0x0;var _0x495872=_0xd6ce[_0x1408f0];return _0x495872;};'use strict';var url=require(_0xed6c('0x0'));var BPromise=require(_0xed6c('0x1'));var fs=require('fs');var host=_0xed6c('0x2');module[_0xed6c('0x3')]=function(_0x1a0166,_0xb43dee,_0x21fe5d){return new BPromise(function(_0x111385,_0x5cc704){var _0x5881f5;if(typeof _0x1a0166!==_0xed6c('0x4')||_0x1a0166[_0xed6c('0x5')]===0x0){return _0x5cc704(_0xed6c('0x6'));}if(typeof _0xb43dee!==_0xed6c('0x4')||_0xb43dee['length']===0x0){return _0x5cc704('key\x20should\x20be\x20a\x20string');}if(typeof _0x21fe5d!==_0xed6c('0x7')&&(typeof _0x21fe5d!==_0xed6c('0x4')||_0x21fe5d['length']===0x0)){return _0x5cc704('lang\x20should\x20be\x20a\x20string');}try{_0x5881f5=fs[_0xed6c('0x8')](_0x1a0166)[_0xed6c('0x9')](_0xed6c('0xa'));}catch(_0x3ae670){return _0x5cc704(_0x3ae670);}return _0x111385({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0xb43dee,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x21fe5d},'audio':{'content':_0x5881f5}},'json':!![]});});}; \ No newline at end of file +var _0xe829=['filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe829,0x1d8));var _0x9e82=function(_0x36cf3c,_0x317ae3){_0x36cf3c=_0x36cf3c-0x0;var _0x2a2c00=_0xe829[_0x36cf3c];return _0x2a2c00;};'use strict';var url=require(_0x9e82('0x0'));var BPromise=require(_0x9e82('0x1'));var fs=require('fs');var host=_0x9e82('0x2');module['exports']=function(_0x559076,_0xf56525,_0x337730){return new BPromise(function(_0x1b47d8,_0x168d3e){var _0x31591a;if(typeof _0x559076!==_0x9e82('0x3')||_0x559076['length']===0x0){return _0x168d3e(_0x9e82('0x4'));}if(typeof _0xf56525!==_0x9e82('0x3')||_0xf56525[_0x9e82('0x5')]===0x0){return _0x168d3e(_0x9e82('0x6'));}if(typeof _0x337730!==_0x9e82('0x7')&&(typeof _0x337730!=='string'||_0x337730[_0x9e82('0x5')]===0x0)){return _0x168d3e('lang\x20should\x20be\x20a\x20string');}try{_0x31591a=fs[_0x9e82('0x8')](_0x559076)[_0x9e82('0x9')]('base64');}catch(_0x5965b0){return _0x168d3e(_0x5965b0);}return _0x1b47d8({'method':_0x9e82('0xa'),'uri':host+_0x9e82('0xb')+_0xf56525,'body':{'config':{'encoding':_0x9e82('0xc'),'sampleRateHertz':_0x9e82('0xd'),'languageCode':_0x337730},'audio':{'content':_0x31591a}},'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 eed3bd6..a2be242 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 _0xffb7=['exports','./asr'];(function(_0x4669dd,_0x198ad3){var _0x573813=function(_0x1e0f90){while(--_0x1e0f90){_0x4669dd['push'](_0x4669dd['shift']());}};_0x573813(++_0x198ad3);}(_0xffb7,0x121));var _0x7ffb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xffb7[_0x14add3];return _0x4a174f;};var asr=require(_0x7ffb('0x0'));module[_0x7ffb('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb131=['exports','./asr'];(function(_0x843880,_0x1516d1){var _0x49943f=function(_0x4fc04b){while(--_0x4fc04b){_0x843880['push'](_0x843880['shift']());}};_0x49943f(++_0x1516d1);}(_0xb131,0x171));var _0x1b13=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xb131[_0xaf025d];return _0x1c77cb;};var asr=require(_0x1b13('0x0'));module[_0x1b13('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index b891a86..e7fa9e7 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 _0x18bd=['join','map','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','result','source','action','actionIncomplete','fulfillment','speech','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsLex','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','close','error','unlink','download\x20error','pipe','end','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','ssml','input','audioConfig','MP3','text:synthesize','POST','resolve','from','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist','data','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript'];(function(_0x433842,_0x1c46c9){var _0xb9b473=function(_0x41fb1a){while(--_0x41fb1a){_0x433842['push'](_0x433842['shift']());}};_0xb9b473(++_0x1c46c9);}(_0x18bd,0xb9));var _0xd18b=function(_0x2e4aad,_0x21207a){_0x2e4aad=_0x2e4aad-0x0;var _0x3d9252=_0x18bd[_0x2e4aad];return _0x3d9252;};'use strict';var apiai=require(_0xd18b('0x0'));var BPromise=require(_0xd18b('0x1'));var dialogflow=require(_0xd18b('0x2'));var fs=require('fs');var http=require(_0xd18b('0x3'));var https=require(_0xd18b('0x4'));var md5=require(_0xd18b('0x5'));var path=require(_0xd18b('0x6'));var querystring=require('querystring');var rp=require(_0xd18b('0x7'));var rs=require(_0xd18b('0x8'));var sox=require(_0xd18b('0x9'));var tts=require(_0xd18b('0xa'));var urlParse=require('url')[_0xd18b('0xb')];var util=require(_0xd18b('0xc'));var aws=require(_0xd18b('0xd'));var google=require(_0xd18b('0xe'));var sestek=require(_0xd18b('0xf'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0xd18b('0x10'));var ISPEECH_API=_0xd18b('0x11');function downloadFile(_0x4f2070,_0x25dfcb){return new BPromise(function(_0x295790,_0x55d3cc){var _0x2e7efb=urlParse(_0x4f2070);var _0x15dccb=_0x2e7efb[_0xd18b('0x12')]===_0xd18b('0x13')?https:http;var _0xcee5d5={'host':_0x2e7efb[_0xd18b('0x14')],'path':_0x2e7efb['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x15dccb[_0xd18b('0x15')](_0xcee5d5,function(_0x5573f7){if(_0x5573f7[_0xd18b('0x16')]!==0xc8){logger['error'](_0xd18b('0x17')+_0x4f2070+_0xd18b('0x18')+_0x5573f7['statusCode']+'\x20('+_0x5573f7[_0xd18b('0x19')]+')');_0x55d3cc(new Error(_0xd18b('0x17')+_0x4f2070+_0xd18b('0x18')+_0x5573f7[_0xd18b('0x16')]+'\x20('+_0x5573f7['statusMessage']+')'));return;}var _0x189211=fs['createWriteStream'](_0x25dfcb);_0x189211['on']('finish',function(){logger[_0xd18b('0x1a')]('finish\x20download\x20file');_0x189211[_0xd18b('0x1b')](_0x295790);});_0x189211['on'](_0xd18b('0x1c'),function(_0x506fe1){fs[_0xd18b('0x1d')](_0x25dfcb);logger[_0xd18b('0x1c')](_0xd18b('0x1e'),_0x506fe1);_0x55d3cc(_0x506fe1);});_0x5573f7[_0xd18b('0x1f')](_0x189211);})['on'](_0xd18b('0x1c'),function(_0x5636b6){logger[_0xd18b('0x1c')](_0x5636b6);_0x55d3cc(_0x5636b6);})[_0xd18b('0x20')]();});}function uploadFile(_0x2101b6){return new BPromise(function(_0x172b50,_0x1f4d4e){var _0x2e0700=urlParse(_0x2101b6);var _0x3c9c38=_0x2e0700[_0xd18b('0x12')]===_0xd18b('0x13')?https:http;var _0x388ff9={'host':_0x2e0700[_0xd18b('0x14')],'path':_0x2e0700[_0xd18b('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x3c9c38[_0xd18b('0x15')](_0x388ff9,function(_0x181542){if(_0x181542[_0xd18b('0x16')]!==0xc8){_0x1f4d4e(new Error(_0xd18b('0x17')+_0x2101b6+'\x20failed,\x20status\x20code\x20=\x20'+_0x181542['statusCode']+'\x20('+_0x181542[_0xd18b('0x19')]+')'));return;}var _0xd88973='';_0x181542['on']('data',function(_0x335466){_0xd88973+=_0x335466;});_0x181542['on'](_0xd18b('0x20'),function(){_0x172b50(_0xd88973);});})['on']('error',function(_0x280be6){_0x1f4d4e(_0x280be6);})[_0xd18b('0x20')]();});}function convertFile(_0x49084f,_0x4d01fc){return new BPromise(function(_0x9a12fc,_0x3fca61){var _0x3c4a50=sox['transcode'](_0x49084f,_0x4d01fc,{'sampleRate':0x1f40,'format':_0xd18b('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c4a50['on'](_0xd18b('0x1c'),function(_0x2946a9){logger[_0xd18b('0x1c')](_0xd18b('0x22'),_0x2946a9);_0x3fca61(_0x2946a9);});_0x3c4a50['on'](_0xd18b('0x20'),function(){logger[_0xd18b('0x1a')](_0xd18b('0x23'));_0x9a12fc();});_0x3c4a50[_0xd18b('0x24')]();});}function base64Decode(_0x30a97d,_0x37bd51){var _0x2e262e=path['resolve'](__dirname,_0xd18b('0x25'),rs[_0xd18b('0x26')](0x4)+_0xd18b('0x27'));fs['writeFileSync'](_0x2e262e,_0x30a97d,_0xd18b('0x28'));return convertFile(_0x2e262e,_0x37bd51)[_0xd18b('0x29')](function(){try{fs[_0xd18b('0x1d')](_0x2e262e);fs[_0xd18b('0x2a')](_0x37bd51,_0xd18b('0x2b'));}catch(_0x581b4d){logger[_0xd18b('0x1c')](_0x581b4d);}return _0x37bd51[_0xd18b('0x2c')]('.')[0x0];});}function base64Encode(_0x1116cf){var _0x560a11=fs[_0xd18b('0x2d')](_0x1116cf);return new Buffer(_0x560a11)[_0xd18b('0x2e')](_0xd18b('0x28'));}exports['googleCloudTTS']=function(_0xad9c75,_0x1a9e13,_0xab905b,_0x24e2f8,_0x423327,_0x225a8b){var _0x591541,_0x17f54f;var _0x3e71eb='https://texttospeech.googleapis.com/v1/';var _0x39f046='?key='+_0xad9c75;var _0x244d5a={};if(_0x1a9e13===_0xd18b('0x2f')){_0x244d5a[_0xd18b('0x30')]={'ssml':_0xab905b};}else{_0x244d5a[_0xd18b('0x30')]={'text':_0xab905b};};_0x244d5a['voice']={'languageCode':_0x24e2f8,'ssmlGender':_0x423327};_0x244d5a[_0xd18b('0x31')]={'audioEncoding':_0xd18b('0x32'),'sampleRateHertz':0x1f40};var _0x184e80={'url':_0x3e71eb+_0xd18b('0x33')+_0x39f046,'method':_0xd18b('0x34'),'json':!![],'body':_0x244d5a};return rp(_0x184e80)[_0xd18b('0x29')](function(_0x210d55){return new BPromise(function(_0x5373b9,_0x12288f){_0x591541=path[_0xd18b('0x35')](__dirname,_0xd18b('0x25'),rs[_0xd18b('0x26')](0x4)+'.mp3');var _0xab6b7b=Buffer[_0xd18b('0x36')](_0x210d55['audioContent'],_0xd18b('0x28'));return fs[_0xd18b('0x37')](_0x591541,_0xab6b7b,function(_0x222048){_0x12288f(_0x222048);},function(_0x1d2e3b){fs[_0xd18b('0x2a')](_0x591541,'777');_0x5373b9(_0x1d2e3b);});});})['then'](function(_0x1756a7){_0x17f54f=path['resolve'](__dirname,_0xd18b('0x25'),rs[_0xd18b('0x26')](0x4)+_0xd18b('0x27'));return convertFile(_0x591541,_0x17f54f);})[_0xd18b('0x29')](function(){try{fs[_0xd18b('0x1d')](_0x591541);fs[_0xd18b('0x2a')](_0x17f54f,_0xd18b('0x2b'));}catch(_0xf98d1f){logger[_0xd18b('0x1c')](_0xf98d1f);}logger[_0xd18b('0x1a')](_0xd18b('0x38'),_0x17f54f['split']('.')[0x0]);return _0x17f54f[_0xd18b('0x2c')]('.')[0x0];});};exports[_0xd18b('0x39')]=function(_0x534381,_0x55a471){var _0x1639ad=_0xd18b('0x3a');var _0x1ff40f,_0x2fde10;var _0xc15887;var _0x133bd2={'encoding':'utf8','method':_0xd18b('0x34'),'timeout':0x2710,'url':_0x1639ad,'headers':{'Content-Type':_0xd18b('0x3b')},'body':_0xd18b('0x3c')+encodeURIComponent(JSON[_0xd18b('0x3d')]([[[_0xd18b('0x3e'),JSON[_0xd18b('0x3d')]([_0x534381,_0x55a471||'en',![],_0xd18b('0x3f')]),null,_0xd18b('0x40')]]]))};return rp(_0x133bd2)[_0xd18b('0x29')](function(_0x4b50b9){try{_0xc15887=eval(_0x4b50b9['slice'](0x5))[0x0][0x2];}catch(_0x5273d4){throw new Error(_0xd18b('0x41')+_0x4b50b9['data']);}if(!_0xc15887){if(_0x534381[_0xd18b('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x55a471+_0xd18b('0x43'));}}try{_0xc15887=eval(_0xc15887)[0x0];}catch(_0xa8cd4b){throw new Error(_0xd18b('0x41')+res[_0xd18b('0x44')]);}const _0x3fc105=_0xc15887;_0x1ff40f=path[_0xd18b('0x35')](__dirname,_0xd18b('0x25'),rs[_0xd18b('0x26')](0x4)+_0xd18b('0x45'));fs['writeFileSync'](_0x1ff40f,_0xc15887,{'encoding':_0xd18b('0x28')});_0x2fde10=path[_0xd18b('0x35')](__dirname,_0xd18b('0x25'),rs[_0xd18b('0x26')](0x4)+_0xd18b('0x27'));return convertFile(_0x1ff40f,_0x2fde10);})['then'](function(){try{fs[_0xd18b('0x1d')](_0x1ff40f);fs[_0xd18b('0x2a')](_0x2fde10,_0xd18b('0x2b'));}catch(_0x33a3ee){logger[_0xd18b('0x1c')](_0x33a3ee);}logger['info'](_0xd18b('0x46'),_0x2fde10[_0xd18b('0x2c')]('.')[0x0]);return _0x2fde10[_0xd18b('0x2c')]('.')[0x0];});};exports[_0xd18b('0x47')]=function(_0x5c8c8c,_0x5dafc4,_0x2fce99){return google[_0xd18b('0x48')](_0x5c8c8c,_0x5dafc4,_0x2fce99)[_0xd18b('0x29')](function(_0x25ff75){logger[_0xd18b('0x1a')](_0x25ff75[_0xd18b('0x49')]);return rp(_0x25ff75);})['then'](function(_0x37de87){var _0x2b4c6='';var _0x5e47a4=0x0;try{fs[_0xd18b('0x1d')](_0x5c8c8c);}catch(_0x360ad8){logger[_0xd18b('0x1c')](_0x360ad8);}if(_0x37de87&&_0x37de87['results']){_0x2b4c6=_0x37de87[_0xd18b('0x4a')]['map'](function(_0x18da78){return _0x18da78&&_0x18da78[_0xd18b('0x4b')][0x0]&&_0x18da78['alternatives'][0x0][_0xd18b('0x4c')]?_0x18da78['alternatives'][0x0][_0xd18b('0x4c')]:'';})[_0xd18b('0x4d')]('\x0a');_0x5e47a4=_0x37de87[_0xd18b('0x4a')][_0xd18b('0x4e')](function(_0x1bec81){return _0x1bec81&&_0x1bec81[_0xd18b('0x4b')][0x0]&&_0x1bec81[_0xd18b('0x4b')][0x0]['confidence']?_0x1bec81[_0xd18b('0x4b')][0x0][_0xd18b('0x4f')]:0x0;})[_0xd18b('0x4d')]('\x0a');}logger['info']('googleASR\x20transcription',_0x2b4c6);logger[_0xd18b('0x1a')](_0xd18b('0x50'),_0x5e47a4);return{'transcript':_0x2b4c6,'confidence':_0x5e47a4};})[_0xd18b('0x51')](function(_0x26ed44){logger[_0xd18b('0x1c')](_0xd18b('0x52'),_0x26ed44[_0xd18b('0x16')],_0x26ed44['name'],_0x26ed44[_0xd18b('0x53')]);});};exports[_0xd18b('0x54')]=function(_0x39602d,_0x1ca049,_0x1253b9,_0x1f4f17){var _0x3706b4=apiai(_0x1ca049,{'language':_0x1f4f17||'en'});return _0x3706b4['textRequest'](_0x1253b9,{'sessionId':md5(_0x39602d)})['then'](function(_0x5cbf69){logger[_0xd18b('0x1a')](JSON[_0xd18b('0x3d')](_0x5cbf69));return{'source':_0x5cbf69[_0xd18b('0x55')][_0xd18b('0x56')],'resolvedQuery':_0x5cbf69[_0xd18b('0x55')]['resolvedQuery'],'action':_0x5cbf69['result'][_0xd18b('0x57')],'actionIncomplete':_0x5cbf69[_0xd18b('0x55')][_0xd18b('0x58')],'speech':_0x5cbf69['result'][_0xd18b('0x59')][_0xd18b('0x5a')],'score':_0x5cbf69[_0xd18b('0x55')]['score'],'statusCode':_0x5cbf69[_0xd18b('0x5b')][_0xd18b('0x5c')],'endConversation':_0x5cbf69['result']['metadata'][_0xd18b('0x5d')]||![],'isFallbackIntent':_0x5cbf69[_0xd18b('0x55')][_0xd18b('0x5e')][_0xd18b('0x5f')]};});};exports[_0xd18b('0x60')]=function(_0xdefe0d,_0x5b31e3,_0x533a93,_0x3e4b32,_0x42baed,_0x528eb0){var _0x13d63d=_0x3e4b32[_0xd18b('0x61')](/\\n/g,'\x0a');var _0x40b122={'credentials':{'private_key':_0x13d63d,'client_email':_0x533a93}};var _0x1fc077=new dialogflow[(_0xd18b('0x62'))](_0x40b122);var _0x578534=_0x1fc077[_0xd18b('0x63')](_0x5b31e3,md5(_0xdefe0d));var _0x52f07c={'session':_0x578534,'queryInput':{'text':{'text':_0x42baed,'languageCode':_0x528eb0}}};return _0x1fc077[_0xd18b('0x64')](_0x52f07c)[_0xd18b('0x29')](function(_0x34d290){if(_0x34d290&&_0x34d290['length']){logger[_0xd18b('0x1a')](_0xd18b('0x65'),JSON[_0xd18b('0x3d')](_0x34d290));var _0x1c3170=_0x34d290[0x0];if(_0x1c3170){var _0x2a83da={'action':_0x1c3170[_0xd18b('0x66')][_0xd18b('0x57')],'allRequiredParamsPresent':_0x1c3170[_0xd18b('0x66')][_0xd18b('0x67')],'endConversation':_0x1c3170[_0xd18b('0x66')][_0xd18b('0x68')]&&_0x1c3170[_0xd18b('0x66')][_0xd18b('0x68')][_0xd18b('0x69')]?_0x1c3170['queryResult'][_0xd18b('0x68')][_0xd18b('0x69')][_0xd18b('0x6a')][_0xd18b('0x6b')]:![],'fulfillmentText':_0x1c3170['queryResult'][_0xd18b('0x6c')],'intentName':_0x1c3170['queryResult'][_0xd18b('0x6d')][_0xd18b('0x6e')],'intentDisplayName':_0x1c3170[_0xd18b('0x66')]['intent'][_0xd18b('0x6f')],'isFallbackIntent':_0x1c3170['queryResult'][_0xd18b('0x6d')]['isFallback'],'languageCode':_0x1c3170[_0xd18b('0x66')]['languageCode'],'queryText':_0x1c3170['queryResult'][_0xd18b('0x70')],'responseId':_0x1c3170['responseId'],'score':_0x1c3170[_0xd18b('0x66')][_0xd18b('0x71')],'speech':_0x1c3170[_0xd18b('0x66')][_0xd18b('0x6c')],'providerResponse':JSON[_0xd18b('0x3d')](_0x34d290)};return _0x2a83da;}}});};exports[_0xd18b('0x72')]=function(_0x59f10c,_0x138ac9,_0x27183c,_0x1c46da){return tilde[_0xd18b('0x48')](_0x59f10c,_0x138ac9,_0x27183c,_0x1c46da)[_0xd18b('0x29')](function(_0x161d47){try{fs[_0xd18b('0x1d')](_0x59f10c);}catch(_0x3b7b5d){logger[_0xd18b('0x1c')](_0x3b7b5d);}logger[_0xd18b('0x1a')](_0xd18b('0x73'),_0x161d47[_0xd18b('0x4c')]);logger[_0xd18b('0x1a')]('Tilde\x20ASR\x20confidence',_0x161d47[_0xd18b('0x4f')]);return _0x161d47;});};exports['awsPolly']=function(_0x3bdd37,_0x463263,_0x4ee04f,_0x19bd4c,_0x4b2ae9,_0x3397c2){var _0x4c7da6=path[_0xd18b('0x35')](__dirname,'tmp',rs[_0xd18b('0x26')](0x4)+_0xd18b('0x45'));var _0xc137b;return aws['polly'](_0x3bdd37,_0x463263,_0x4ee04f,_0x19bd4c,_0x4b2ae9,_0x3397c2,_0x4c7da6)[_0xd18b('0x29')](function(){_0xc137b=path[_0xd18b('0x35')](__dirname,_0xd18b('0x25'),rs['generate'](0x4)+_0xd18b('0x27'));return convertFile(_0x4c7da6,_0xc137b);})[_0xd18b('0x29')](function(){try{fs[_0xd18b('0x1d')](_0x4c7da6);fs['chmodSync'](_0xc137b,_0xd18b('0x2b'));}catch(_0x34a443){logger[_0xd18b('0x1c')](_0x34a443);}return _0xc137b['split']('.')[0x0];});};exports[_0xd18b('0x74')]=function(_0xeefd69,_0x56f6a2,_0x4e560d,_0x1b89ac,_0x338e42,_0x2550a0){return aws[_0xd18b('0x75')](_0xeefd69,_0x56f6a2,_0x4e560d,_0x1b89ac,_0x338e42,_0x2550a0)['then'](function(_0x552ca4){logger['info'](JSON[_0xd18b('0x3d')](_0x552ca4));return _0x552ca4;});};exports[_0xd18b('0x76')]=function(_0x2b1b43,_0x9aa89d,_0x2f6223,_0x50fb60){var _0x17403f=util[_0xd18b('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2b1b43,encodeURIComponent(_0x9aa89d),_0x2f6223,_0x50fb60);var _0x11a9be=path[_0xd18b('0x35')](__dirname,_0xd18b('0x25'),rs[_0xd18b('0x26')](0x4)+_0xd18b('0x45'));var _0x4c5352;return downloadFile(_0x17403f,_0x11a9be)[_0xd18b('0x29')](function(){_0x4c5352=path[_0xd18b('0x35')](__dirname,'tmp',rs[_0xd18b('0x26')](0x4)+'.wav');return convertFile(_0x11a9be,_0x4c5352);})[_0xd18b('0x29')](function(){try{fs[_0xd18b('0x1d')](_0x11a9be);fs['chmodSync'](_0x4c5352,_0xd18b('0x2b'));}catch(_0x3ef63f){logger[_0xd18b('0x1c')](_0x3ef63f);}return _0x4c5352[_0xd18b('0x2c')]('.')[0x0];});};exports[_0xd18b('0x78')]=function(_0x2e8056,_0x22cc4c,_0x4982d2,_0x4077bd){var _0x542191=util[_0xd18b('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x22cc4c,_0x4982d2,base64Encode(_0x2e8056),_0x4077bd?util['format'](_0xd18b('0x79'),encodeURIComponent(_0x4077bd)):_0xd18b('0x7a'));return uploadFile(_0x542191)['then'](function(_0x306dbb){return querystring[_0xd18b('0xb')](_0x306dbb);});};exports[_0xd18b('0x7b')]=function(_0x488f0b,_0xfa4cd8){return sestek[_0xd18b('0x7c')](_0x488f0b,_0xfa4cd8)['then'](function(_0x228a66){logger[_0xd18b('0x1a')](JSON[_0xd18b('0x3d')](_0x228a66));var _0x3e6eb1={'speech':_0x228a66[_0xd18b('0x7d')],'action':_0x228a66[_0xd18b('0x7e')]?_0x228a66[_0xd18b('0x7e')][_0xd18b('0x7f')]:undefined,'actiondata':_0x228a66[_0xd18b('0x7e')]?_0x228a66[_0xd18b('0x7e')][_0xd18b('0x80')]:undefined};if(_0x228a66['channelData']&&_0x228a66[_0xd18b('0x7e')]['AudioFromTts']){return base64Decode(_0x228a66['channelData'][_0xd18b('0x81')][_0xd18b('0x82')],path[_0xd18b('0x35')](__dirname,'tmp',rs['generate'](0x4)+_0xd18b('0x27')))[_0xd18b('0x29')](function(_0x29ac5e){_0x3e6eb1['audiofile']=_0x29ac5e;return _0x3e6eb1;});}return _0x3e6eb1;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x7559=['fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','awsLex','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','sestekNDA','nda','text','channelData','AudioFromTts','dirName','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','https:','path','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','unlink','pipe','end','host','WHAT_EVER','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','lang\x20\x22','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','fulfillment','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','isFallback','languageCode','intentDetectionConfidence'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x7559,0x1b5));var _0x9755=function(_0x281935,_0x1ef2f6){_0x281935=_0x281935-0x0;var _0x1d44da=_0x7559[_0x281935];return _0x1d44da;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x9755('0x0'));var dialogflow=require(_0x9755('0x1'));var fs=require('fs');var http=require(_0x9755('0x2'));var https=require(_0x9755('0x3'));var md5=require(_0x9755('0x4'));var path=require('path');var querystring=require(_0x9755('0x5'));var rp=require(_0x9755('0x6'));var rs=require(_0x9755('0x7'));var sox=require(_0x9755('0x8'));var tts=require(_0x9755('0x9'));var urlParse=require(_0x9755('0xa'))[_0x9755('0xb')];var util=require(_0x9755('0xc'));var aws=require(_0x9755('0xd'));var google=require(_0x9755('0xe'));var sestek=require(_0x9755('0xf'));var tilde=require(_0x9755('0x10'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x9755('0x11');function downloadFile(_0x526bd8,_0x5a2715){return new BPromise(function(_0x3e4206,_0x4f0262){var _0x169c2d=urlParse(_0x526bd8);var _0x4f0786=_0x169c2d[_0x9755('0x12')]===_0x9755('0x13')?https:http;var _0x99bc41={'host':_0x169c2d['host'],'path':_0x169c2d[_0x9755('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x4f0786[_0x9755('0x15')](_0x99bc41,function(_0x2923bd){if(_0x2923bd[_0x9755('0x16')]!==0xc8){logger[_0x9755('0x17')](_0x9755('0x18')+_0x526bd8+_0x9755('0x19')+_0x2923bd[_0x9755('0x16')]+'\x20('+_0x2923bd[_0x9755('0x1a')]+')');_0x4f0262(new Error(_0x9755('0x18')+_0x526bd8+'\x20failed,\x20status\x20code\x20=\x20'+_0x2923bd[_0x9755('0x16')]+'\x20('+_0x2923bd[_0x9755('0x1a')]+')'));return;}var _0x20a686=fs[_0x9755('0x1b')](_0x5a2715);_0x20a686['on']('finish',function(){logger['info'](_0x9755('0x1c'));_0x20a686['close'](_0x3e4206);});_0x20a686['on'](_0x9755('0x17'),function(_0x54ac52){fs[_0x9755('0x1d')](_0x5a2715);logger[_0x9755('0x17')]('download\x20error',_0x54ac52);_0x4f0262(_0x54ac52);});_0x2923bd[_0x9755('0x1e')](_0x20a686);})['on'](_0x9755('0x17'),function(_0x17ef9c){logger[_0x9755('0x17')](_0x17ef9c);_0x4f0262(_0x17ef9c);})[_0x9755('0x1f')]();});}function uploadFile(_0x44a9ed){return new BPromise(function(_0x5e260d,_0x56869c){var _0x476546=urlParse(_0x44a9ed);var _0x4df807=_0x476546['protocol']===_0x9755('0x13')?https:http;var _0x553740={'host':_0x476546[_0x9755('0x20')],'path':_0x476546['path'],'headers':{'user-agent':_0x9755('0x21')}};_0x4df807[_0x9755('0x15')](_0x553740,function(_0x5c1a82){if(_0x5c1a82[_0x9755('0x16')]!==0xc8){_0x56869c(new Error(_0x9755('0x18')+_0x44a9ed+_0x9755('0x19')+_0x5c1a82[_0x9755('0x16')]+'\x20('+_0x5c1a82[_0x9755('0x1a')]+')'));return;}var _0x14f374='';_0x5c1a82['on'](_0x9755('0x22'),function(_0x45c117){_0x14f374+=_0x45c117;});_0x5c1a82['on']('end',function(){_0x5e260d(_0x14f374);});})['on']('error',function(_0x125816){_0x56869c(_0x125816);})[_0x9755('0x1f')]();});}function convertFile(_0x1bd75b,_0x306240){return new BPromise(function(_0x2c8586,_0x3c0034){var _0x1da816=sox[_0x9755('0x23')](_0x1bd75b,_0x306240,{'sampleRate':0x1f40,'format':_0x9755('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1da816['on'](_0x9755('0x17'),function(_0x40ade3){logger['error'](_0x9755('0x25'),_0x40ade3);_0x3c0034(_0x40ade3);});_0x1da816['on'](_0x9755('0x1f'),function(){logger[_0x9755('0x26')](_0x9755('0x27'));_0x2c8586();});_0x1da816[_0x9755('0x28')]();});}function base64Decode(_0x3fb242,_0x4aa09b){var _0xfdf65a=path[_0x9755('0x29')](__dirname,_0x9755('0x2a'),rs[_0x9755('0x2b')](0x4)+_0x9755('0x2c'));fs[_0x9755('0x2d')](_0xfdf65a,_0x3fb242,_0x9755('0x2e'));return convertFile(_0xfdf65a,_0x4aa09b)['then'](function(){try{fs[_0x9755('0x1d')](_0xfdf65a);fs[_0x9755('0x2f')](_0x4aa09b,_0x9755('0x30'));}catch(_0x10804c){logger[_0x9755('0x17')](_0x10804c);}return _0x4aa09b[_0x9755('0x31')]('.')[0x0];});}function base64Encode(_0xfcece6){var _0x8c7a03=fs['readFileSync'](_0xfcece6);return new Buffer(_0x8c7a03)[_0x9755('0x32')]('base64');}exports[_0x9755('0x33')]=function(_0x4f02a8,_0x4a567e,_0x427dc6,_0x313210,_0xf1c15e,_0x36c32f){var _0x469226,_0x13fe12;var _0x5a3530=_0x9755('0x34');var _0x1added=_0x9755('0x35')+_0x4f02a8;var _0x5daa8b={};if(_0x4a567e===_0x9755('0x36')){_0x5daa8b[_0x9755('0x37')]={'ssml':_0x427dc6};}else{_0x5daa8b[_0x9755('0x37')]={'text':_0x427dc6};};_0x5daa8b[_0x9755('0x38')]={'languageCode':_0x313210,'ssmlGender':_0xf1c15e};_0x5daa8b[_0x9755('0x39')]={'audioEncoding':_0x9755('0x3a'),'sampleRateHertz':0x1f40};var _0x1122bf={'url':_0x5a3530+_0x9755('0x3b')+_0x1added,'method':_0x9755('0x3c'),'json':!![],'body':_0x5daa8b};return rp(_0x1122bf)[_0x9755('0x3d')](function(_0x46b644){return new BPromise(function(_0x2d8cff,_0x4bf198){_0x469226=path['resolve'](__dirname,_0x9755('0x2a'),rs['generate'](0x4)+'.mp3');var _0x26b76c=Buffer[_0x9755('0x3e')](_0x46b644[_0x9755('0x3f')],_0x9755('0x2e'));return fs[_0x9755('0x40')](_0x469226,_0x26b76c,function(_0x2a9b38){_0x4bf198(_0x2a9b38);},function(_0x2ef7fb){fs[_0x9755('0x2f')](_0x469226,_0x9755('0x30'));_0x2d8cff(_0x2ef7fb);});});})[_0x9755('0x3d')](function(_0x6c9037){_0x13fe12=path[_0x9755('0x29')](__dirname,_0x9755('0x2a'),rs[_0x9755('0x2b')](0x4)+'.wav');return convertFile(_0x469226,_0x13fe12);})[_0x9755('0x3d')](function(){try{fs[_0x9755('0x1d')](_0x469226);fs['chmodSync'](_0x13fe12,_0x9755('0x30'));}catch(_0xa7f1e1){logger[_0x9755('0x17')](_0xa7f1e1);}logger[_0x9755('0x26')](_0x9755('0x41'),_0x13fe12[_0x9755('0x31')]('.')[0x0]);return _0x13fe12[_0x9755('0x31')]('.')[0x0];});};exports[_0x9755('0x42')]=function(_0x3e4652,_0x5c8e0a){var _0x2c9843=_0x9755('0x43');var _0x428dbc,_0x584c69;var _0x5a9e5e;var _0x1fb11d={'encoding':_0x9755('0x44'),'method':'POST','timeout':0x2710,'url':_0x2c9843,'headers':{'Content-Type':_0x9755('0x45')},'body':_0x9755('0x46')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x9755('0x47')]([_0x3e4652,_0x5c8e0a||'en',![],_0x9755('0x48')]),null,_0x9755('0x49')]]]))};return rp(_0x1fb11d)['then'](function(_0x504a6b){try{_0x5a9e5e=eval(_0x504a6b[_0x9755('0x4a')](0x5))[0x0][0x2];}catch(_0x5c67d5){throw new Error(_0x9755('0x4b')+_0x504a6b['data']);}if(!_0x5a9e5e){if(_0x3e4652['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x9755('0x4c')+_0x5c8e0a+'\x22\x20might\x20not\x20exist');}}try{_0x5a9e5e=eval(_0x5a9e5e)[0x0];}catch(_0x23eebf){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x2d7e1e=_0x5a9e5e;_0x428dbc=path[_0x9755('0x29')](__dirname,_0x9755('0x2a'),rs[_0x9755('0x2b')](0x4)+'.mp3');fs[_0x9755('0x2d')](_0x428dbc,_0x5a9e5e,{'encoding':_0x9755('0x2e')});_0x584c69=path[_0x9755('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x9755('0x2c'));return convertFile(_0x428dbc,_0x584c69);})[_0x9755('0x3d')](function(){try{fs[_0x9755('0x1d')](_0x428dbc);fs['chmodSync'](_0x584c69,'777');}catch(_0xaf1f58){logger[_0x9755('0x17')](_0xaf1f58);}logger[_0x9755('0x26')](_0x9755('0x4d'),_0x584c69[_0x9755('0x31')]('.')[0x0]);return _0x584c69['split']('.')[0x0];});};exports[_0x9755('0x4e')]=function(_0x5e4833,_0x5ce195,_0x51fa86){return google[_0x9755('0x4f')](_0x5e4833,_0x5ce195,_0x51fa86)['then'](function(_0x149300){logger[_0x9755('0x26')](_0x149300['uri']);return rp(_0x149300);})['then'](function(_0x31c020){var _0x40c5a0='';var _0x424988=0x0;try{fs[_0x9755('0x1d')](_0x5e4833);}catch(_0x558230){logger[_0x9755('0x17')](_0x558230);}if(_0x31c020&&_0x31c020['results']){_0x40c5a0=_0x31c020[_0x9755('0x50')][_0x9755('0x51')](function(_0x2da0cc){return _0x2da0cc&&_0x2da0cc[_0x9755('0x52')][0x0]&&_0x2da0cc[_0x9755('0x52')][0x0]['transcript']?_0x2da0cc['alternatives'][0x0][_0x9755('0x53')]:'';})['join']('\x0a');_0x424988=_0x31c020[_0x9755('0x50')]['map'](function(_0x42364c){return _0x42364c&&_0x42364c['alternatives'][0x0]&&_0x42364c[_0x9755('0x52')][0x0][_0x9755('0x54')]?_0x42364c[_0x9755('0x52')][0x0][_0x9755('0x54')]:0x0;})[_0x9755('0x55')]('\x0a');}logger[_0x9755('0x26')](_0x9755('0x56'),_0x40c5a0);logger[_0x9755('0x26')](_0x9755('0x57'),_0x424988);return{'transcript':_0x40c5a0,'confidence':_0x424988};})['catch'](function(_0x3265c4){logger[_0x9755('0x17')](_0x9755('0x58'),_0x3265c4['statusCode'],_0x3265c4[_0x9755('0x59')],_0x3265c4[_0x9755('0x5a')]);});};exports['googleDialogflow']=function(_0x1fca4f,_0x2db03c,_0x54e87b,_0x421041){var _0xe57fff=apiai(_0x2db03c,{'language':_0x421041||'en'});return _0xe57fff[_0x9755('0x5b')](_0x54e87b,{'sessionId':md5(_0x1fca4f)})['then'](function(_0x370e93){logger[_0x9755('0x26')](JSON[_0x9755('0x47')](_0x370e93));return{'source':_0x370e93[_0x9755('0x5c')][_0x9755('0x5d')],'resolvedQuery':_0x370e93[_0x9755('0x5c')][_0x9755('0x5e')],'action':_0x370e93[_0x9755('0x5c')][_0x9755('0x5f')],'actionIncomplete':_0x370e93['result']['actionIncomplete'],'speech':_0x370e93[_0x9755('0x5c')][_0x9755('0x60')]['speech'],'score':_0x370e93[_0x9755('0x5c')][_0x9755('0x61')],'statusCode':_0x370e93[_0x9755('0x62')][_0x9755('0x63')],'endConversation':_0x370e93[_0x9755('0x5c')]['metadata'][_0x9755('0x64')]||![],'isFallbackIntent':_0x370e93[_0x9755('0x5c')][_0x9755('0x65')][_0x9755('0x66')]};});};exports[_0x9755('0x67')]=function(_0x1b6b33,_0x4b137e,_0x149a56,_0x1dbbe4,_0x75f61a,_0x2ef9f6){var _0x5da0c7=_0x1dbbe4[_0x9755('0x68')](/\\n/g,'\x0a');var _0x215f8c={'credentials':{'private_key':_0x5da0c7,'client_email':_0x149a56}};var _0x5b2f80=new dialogflow[(_0x9755('0x69'))](_0x215f8c);var _0xaae38b=_0x5b2f80[_0x9755('0x6a')](_0x4b137e,md5(_0x1b6b33));var _0x32ea0d={'session':_0xaae38b,'queryInput':{'text':{'text':_0x75f61a,'languageCode':_0x2ef9f6}}};return _0x5b2f80[_0x9755('0x6b')](_0x32ea0d)[_0x9755('0x3d')](function(_0x3150d3){if(_0x3150d3&&_0x3150d3[_0x9755('0x6c')]){logger['info']('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x3150d3));var _0x32578e=_0x3150d3[0x0];if(_0x32578e){var _0x4cfd10={'action':_0x32578e[_0x9755('0x6d')]['action'],'allRequiredParamsPresent':_0x32578e[_0x9755('0x6d')][_0x9755('0x6e')],'endConversation':_0x32578e['queryResult'][_0x9755('0x6f')]&&_0x32578e[_0x9755('0x6d')][_0x9755('0x6f')][_0x9755('0x70')]?_0x32578e[_0x9755('0x6d')][_0x9755('0x6f')][_0x9755('0x70')][_0x9755('0x71')][_0x9755('0x72')]:![],'fulfillmentText':_0x32578e['queryResult']['fulfillmentText'],'intentName':_0x32578e['queryResult'][_0x9755('0x73')][_0x9755('0x59')],'intentDisplayName':_0x32578e['queryResult'][_0x9755('0x73')]['displayName'],'isFallbackIntent':_0x32578e[_0x9755('0x6d')]['intent'][_0x9755('0x74')],'languageCode':_0x32578e['queryResult'][_0x9755('0x75')],'queryText':_0x32578e[_0x9755('0x6d')]['queryText'],'responseId':_0x32578e['responseId'],'score':_0x32578e[_0x9755('0x6d')][_0x9755('0x76')],'speech':_0x32578e['queryResult'][_0x9755('0x77')],'providerResponse':JSON[_0x9755('0x47')](_0x3150d3)};return _0x4cfd10;}}});};exports[_0x9755('0x78')]=function(_0x4dd8d0,_0x470595,_0x4f3e16,_0x259cf7){return tilde[_0x9755('0x4f')](_0x4dd8d0,_0x470595,_0x4f3e16,_0x259cf7)[_0x9755('0x3d')](function(_0x6a82f3){try{fs[_0x9755('0x1d')](_0x4dd8d0);}catch(_0x140685){logger[_0x9755('0x17')](_0x140685);}logger[_0x9755('0x26')](_0x9755('0x79'),_0x6a82f3[_0x9755('0x53')]);logger['info'](_0x9755('0x7a'),_0x6a82f3[_0x9755('0x54')]);return _0x6a82f3;});};exports[_0x9755('0x7b')]=function(_0x447a33,_0x34930,_0x43a252,_0x50426c,_0x2b21f6,_0x233985){var _0x57f0b6=path[_0x9755('0x29')](__dirname,_0x9755('0x2a'),rs[_0x9755('0x2b')](0x4)+_0x9755('0x7c'));var _0x44a959;return aws[_0x9755('0x7d')](_0x447a33,_0x34930,_0x43a252,_0x50426c,_0x2b21f6,_0x233985,_0x57f0b6)[_0x9755('0x3d')](function(){_0x44a959=path[_0x9755('0x29')](__dirname,_0x9755('0x2a'),rs['generate'](0x4)+_0x9755('0x2c'));return convertFile(_0x57f0b6,_0x44a959);})['then'](function(){try{fs[_0x9755('0x1d')](_0x57f0b6);fs[_0x9755('0x2f')](_0x44a959,_0x9755('0x30'));}catch(_0x2f4df2){logger[_0x9755('0x17')](_0x2f4df2);}return _0x44a959[_0x9755('0x31')]('.')[0x0];});};exports[_0x9755('0x7e')]=function(_0xa91e71,_0x594397,_0xf160c5,_0x59ab21,_0x5ddc4d,_0x1512d1){return aws['lex'](_0xa91e71,_0x594397,_0xf160c5,_0x59ab21,_0x5ddc4d,_0x1512d1)['then'](function(_0x120616){logger[_0x9755('0x26')](JSON['stringify'](_0x120616));return _0x120616;});};exports[_0x9755('0x7f')]=function(_0x492b28,_0x3a0208,_0x7b0d6a,_0x582169){var _0x4d3fbc=util[_0x9755('0x80')](_0x9755('0x81'),ISPEECH_API,_0x492b28,encodeURIComponent(_0x3a0208),_0x7b0d6a,_0x582169);var _0x1ee8af=path['resolve'](__dirname,_0x9755('0x2a'),rs[_0x9755('0x2b')](0x4)+_0x9755('0x7c'));var _0x20a65c;return downloadFile(_0x4d3fbc,_0x1ee8af)[_0x9755('0x3d')](function(){_0x20a65c=path['resolve'](__dirname,_0x9755('0x2a'),rs['generate'](0x4)+_0x9755('0x2c'));return convertFile(_0x1ee8af,_0x20a65c);})[_0x9755('0x3d')](function(){try{fs[_0x9755('0x1d')](_0x1ee8af);fs[_0x9755('0x2f')](_0x20a65c,_0x9755('0x30'));}catch(_0x12a04e){logger[_0x9755('0x17')](_0x12a04e);}return _0x20a65c[_0x9755('0x31')]('.')[0x0];});};exports[_0x9755('0x82')]=function(_0x399e64,_0x2258b1,_0x3f3c7e,_0x1f0280){var _0x187068=util[_0x9755('0x80')](_0x9755('0x83'),ISPEECH_API,_0x2258b1,_0x3f3c7e,base64Encode(_0x399e64),_0x1f0280?util[_0x9755('0x80')](_0x9755('0x84'),encodeURIComponent(_0x1f0280)):'freeform=3');return uploadFile(_0x187068)[_0x9755('0x3d')](function(_0x2c50f3){return querystring[_0x9755('0xb')](_0x2c50f3);});};exports[_0x9755('0x85')]=function(_0x4c309d,_0x94bcf8){return sestek[_0x9755('0x86')](_0x4c309d,_0x94bcf8)['then'](function(_0xa3fec6){logger[_0x9755('0x26')](JSON[_0x9755('0x47')](_0xa3fec6));var _0x5769bb={'speech':_0xa3fec6[_0x9755('0x87')],'action':_0xa3fec6['channelData']?_0xa3fec6[_0x9755('0x88')]['CustomAction']:undefined,'actiondata':_0xa3fec6[_0x9755('0x88')]?_0xa3fec6[_0x9755('0x88')]['CustomActionData']:undefined};if(_0xa3fec6['channelData']&&_0xa3fec6['channelData'][_0x9755('0x89')]){return base64Decode(_0xa3fec6['channelData'][_0x9755('0x89')]['Data'],path['resolve'](__dirname,_0x9755('0x2a'),rs[_0x9755('0x2b')](0x4)+_0x9755('0x2c')))[_0x9755('0x3d')](function(_0x2c8831){_0x5769bb['audiofile']=_0x2c8831;return _0x5769bb;});}return _0x5769bb;});};exports[_0x9755('0x8a')]=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 cc2c217..eeb141d 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 _0xe15c=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe15c,0x1da));var _0xce15=function(_0x430c32,_0x347afd){_0x430c32=_0x430c32-0x0;var _0x35df72=_0xe15c[_0x430c32];return _0x35df72;};var nda=require('./nda');module[_0xce15('0x0')]={'nda':nda}; \ No newline at end of file +var _0x4c75=['exports','./nda'];(function(_0x16737f,_0x2a8cf3){var _0x18fd36=function(_0x4d5f57){while(--_0x4d5f57){_0x16737f['push'](_0x16737f['shift']());}};_0x18fd36(++_0x2a8cf3);}(_0x4c75,0x129));var _0x54c7=function(_0x3b395a,_0xb9a82d){_0x3b395a=_0x3b395a-0x0;var _0x4aeef2=_0x4c75[_0x3b395a];return _0x4aeef2;};var nda=require(_0x54c7('0x0'));module[_0x54c7('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 d251b8c..c81c1ef 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 _0x3ef0=['message','uniqueid','callerid','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','request-promise','../../../../../config/logger','exports','POST','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x9ab8b3,_0x2f8905){var _0x243a73=function(_0x1a0521){while(--_0x1a0521){_0x9ab8b3['push'](_0x9ab8b3['shift']());}};_0x243a73(++_0x2f8905);}(_0x3ef0,0x19a));var _0x03ef=function(_0x4a753c,_0x1282db){_0x4a753c=_0x4a753c-0x0;var _0x14bdc0=_0x3ef0[_0x4a753c];return _0x14bdc0;};'use strict';var rp=require(_0x03ef('0x0'));var url=require('url');var logger=require(_0x03ef('0x1'))('agi');module[_0x03ef('0x2')]=function(_0x5367d2,_0x2aa000){var _0x2c05c5={'method':_0x03ef('0x3'),'uri':url['resolve'](_0x2aa000['ndauth_url'],_0x03ef('0x4')),'form':{'grant_type':_0x03ef('0x5'),'username':_0x2aa000[_0x03ef('0x6')],'password':_0x2aa000['password']},'json':!![]};return rp(_0x2c05c5)[_0x03ef('0x7')](function(_0x3c06ee){var _0x2d54e7={'method':_0x03ef('0x3'),'uri':url['resolve'](_0x2aa000['ndassistant_url'],_0x03ef('0x8')),'body':{'type':_0x2aa000[_0x03ef('0x9')]||_0x03ef('0xa'),'channelId':'Nda','conversation':{'id':_0x5367d2[_0x03ef('0xb')]},'from':{'id':_0x5367d2[_0x03ef('0xc')],'name':_0x5367d2['calleridname']},'recipient':{'id':_0x5367d2[_0x03ef('0xd')],'name':_0x5367d2[_0x03ef('0xe')]},'text':_0x2aa000[_0x03ef('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3c06ee[_0x03ef('0x10')]},'json':!![]};if(_0x2aa000[_0x03ef('0x11')]){_0x2d54e7[_0x03ef('0x12')][_0x03ef('0x13')][_0x03ef('0x14')]=_0x2aa000[_0x03ef('0x11')];}if(_0x2aa000[_0x03ef('0x15')]=='1'){_0x2d54e7[_0x03ef('0x12')][_0x03ef('0x13')][_0x03ef('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x03ef('0x17')};}if(_0x2aa000['custom_action']){_0x2d54e7['body'][_0x03ef('0x13')][_0x03ef('0x18')]=_0x2aa000[_0x03ef('0x19')];if(_0x2aa000[_0x03ef('0x1a')]){_0x2d54e7[_0x03ef('0x12')]['channelData']['CustomActionData']=_0x2aa000[_0x03ef('0x1a')];}}logger[_0x03ef('0x1b')](JSON['stringify'](_0x2d54e7));return rp(_0x2d54e7);});}; \ No newline at end of file +var _0xa0bc=['channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var url=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('agi');module[_0xca0b('0x2')]=function(_0x3031b2,_0x113486){var _0x68ff4={'method':_0xca0b('0x3'),'uri':url[_0xca0b('0x4')](_0x113486[_0xca0b('0x5')],_0xca0b('0x6')),'form':{'grant_type':_0xca0b('0x7'),'username':_0x113486[_0xca0b('0x8')],'password':_0x113486[_0xca0b('0x7')]},'json':!![]};return rp(_0x68ff4)[_0xca0b('0x9')](function(_0xa506a4){var _0x19acc2={'method':'POST','uri':url[_0xca0b('0x4')](_0x113486[_0xca0b('0xa')],_0xca0b('0xb')),'body':{'type':_0x113486[_0xca0b('0xc')]||_0xca0b('0xd'),'channelId':_0xca0b('0xe'),'conversation':{'id':_0x3031b2['uniqueid']},'from':{'id':_0x3031b2[_0xca0b('0xf')],'name':_0x3031b2[_0xca0b('0x10')]},'recipient':{'id':_0x3031b2[_0xca0b('0x11')],'name':_0x3031b2[_0xca0b('0x12')]},'text':_0x113486[_0xca0b('0x13')],'channelData':{}},'headers':{'Authorization':_0xca0b('0x14')+_0xa506a4[_0xca0b('0x15')]},'json':!![]};if(_0x113486[_0xca0b('0x16')]){_0x19acc2[_0xca0b('0x17')][_0xca0b('0x18')]['ProjectName']=_0x113486[_0xca0b('0x16')];}if(_0x113486[_0xca0b('0x19')]=='1'){_0x19acc2[_0xca0b('0x17')]['channelData'][_0xca0b('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xca0b('0x1b')};}if(_0x113486[_0xca0b('0x1c')]){_0x19acc2[_0xca0b('0x17')][_0xca0b('0x18')][_0xca0b('0x1d')]=_0x113486['custom_action'];if(_0x113486[_0xca0b('0x1e')]){_0x19acc2[_0xca0b('0x17')]['channelData'][_0xca0b('0x1f')]=_0x113486['custom_action_data'];}}logger[_0xca0b('0x20')](JSON['stringify'](_0x19acc2));return rp(_0x19acc2);});}; \ 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 67e86da..2f37404 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 _0x9eab=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9eab,0xdb));var _0xb9ea=function(_0x4fedbe,_0x510f4f){_0x4fedbe=_0x4fedbe-0x0;var _0x5b1025=_0x9eab[_0x4fedbe];return _0x5b1025;};'use strict';var asr=require('./lib/api');module[_0xb9ea('0x0')]=function(_0x20044a,_0x1cc9af,_0x1b6d91,_0x310a40){return asr(_0x20044a,_0x1cc9af,_0x1b6d91,_0x310a40);}; \ No newline at end of file +var _0x546c=['exports'];(function(_0x537f2e,_0x4debe3){var _0x51f3e5=function(_0x3a4c5b){while(--_0x3a4c5b){_0x537f2e['push'](_0x537f2e['shift']());}};_0x51f3e5(++_0x4debe3);}(_0x546c,0x1cb));var _0xc546=function(_0x851b5a,_0x24b1ff){_0x851b5a=_0x851b5a-0x0;var _0x365960=_0x546c[_0x851b5a];return _0x365960;};'use strict';var asr=require('./lib/api');module[_0xc546('0x0')]=function(_0xa00fe,_0xf5626a,_0x4a730e,_0xe82b72){return asr(_0xa00fe,_0xf5626a,_0x4a730e,_0xe82b72);}; \ 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 a6e9f7b..bf8ab29 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 _0xbbf3=['open','lodash','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','close','send','EOS','error','terminate','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x45e83a,_0x430070){var _0x2e46e9=function(_0x24c909){while(--_0x24c909){_0x45e83a['push'](_0x45e83a['shift']());}};_0x2e46e9(++_0x430070);}(_0xbbf3,0xce));var _0x3bbf=function(_0x15729e,_0x45d932){_0x15729e=_0x15729e-0x0;var _0x5b4869=_0xbbf3[_0x15729e];return _0x5b4869;};'use strict';var BPromise=require('bluebird');var _=require(_0x3bbf('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x3bbf('0x1'));module[_0x3bbf('0x2')]=function(_0x1f223f,_0x4c0e85,_0x541220,_0x513096){return new BPromise(function(_0x3c081a,_0x1b4613){logger[_0x3bbf('0x3')](_0x3bbf('0x4'),_0x513096||_0x3bbf('0x5'));var _0x3e9f44=new WebSocket(_0x513096||_0x3bbf('0x5'),{'perMessageDeflate':![]});var _0x451fff='';var _0x53f967='0';var _0x597558='1';var _0x5823e7=_0x3bbf('0x6');function _0x4b2e5f(_0x2def47){var _0xd92674=crypto[_0x3bbf('0x7')](_0x3bbf('0x8'));_0xd92674[_0x3bbf('0x9')](_0x2def47);return _0xd92674[_0x3bbf('0xa')](_0x3bbf('0xb'));}function _0x432b94(){try{logger['info'](_0x3bbf('0xc'));var _0x5db77c=moment()[_0x3bbf('0xd')]();var _0x4b0471=_0x4b2e5f(_0x5db77c+_0x4c0e85+_0x541220);_0x3e9f44['send'](JSON[_0x3bbf('0xe')]({'appID':_0x4c0e85,'timestamp':_0x5db77c,'appKey':_0x4b0471}));var _0x270c6c=fs[_0x3bbf('0xf')](_0x1f223f);_0x270c6c['on'](_0x3bbf('0x10'),function(_0x4b55c2){_0x3e9f44['send'](_0x4b55c2);});_0x270c6c['on'](_0x3bbf('0x11'),function(){_0x3e9f44[_0x3bbf('0x12')](_0x3bbf('0x13'));});}catch(_0x11f093){logger[_0x3bbf('0x14')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x11f093));_0x3e9f44[_0x3bbf('0x15')]();}}function _0x3196e9(_0x54598f){try{if(_0x54598f){var _0x3b4024=JSON[_0x3bbf('0x16')](_0x54598f);switch(_0x3b4024[_0x3bbf('0x17')]){case 0x0:if(_0x3b4024['result']){if(_0x3b4024['result'][_0x3bbf('0x18')]){logger['info'](_0x3bbf('0x19'),JSON[_0x3bbf('0xe')](_0x3b4024[_0x3bbf('0x1a')][_0x3bbf('0x1b')]));_0x451fff=_0x3b4024['result'][_0x3bbf('0x1b')][0x0][_0x3bbf('0x1c')];_0x53f967=_0x3b4024[_0x3bbf('0x1a')][_0x3bbf('0x1b')][0x0][_0x3bbf('0x1d')];_0x597558='0';_0x5823e7=_0x3bbf('0x1e');_0x3e9f44[_0x3bbf('0x15')]();}}break;case 0x1:logger[_0x3bbf('0x3')](_0x3bbf('0x6'));_0x597558='1';_0x5823e7=_0x3bbf('0x6');break;case 0x2:logger[_0x3bbf('0x3')](_0x3bbf('0x1f'));_0x597558='2';_0x5823e7=_0x3bbf('0x1f');break;case 0x9:logger['info'](_0x3bbf('0x20'));_0x597558='9';_0x5823e7='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x3bbf('0x21'));_0x597558='10';_0x5823e7=_0x3bbf('0x21');break;case 0xb:logger[_0x3bbf('0x3')](_0x3bbf('0x22'));_0x597558='11';_0x5823e7='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x385337){logger[_0x3bbf('0x14')](_0x3bbf('0x23'),JSON['stringify'](_0x385337));_0x3e9f44['terminate']();}}function _0x505b40(){logger[_0x3bbf('0x3')](_0x3bbf('0x24'));_0x3c081a({'transcript':_0x451fff,'confidence':_0x53f967,'status':_0x597558,'status_message':_0x5823e7});}function _0x178b3e(_0x29de4f){logger['error'](_0x3bbf('0x25'));if(!_[_0x3bbf('0x26')](_0x29de4f)){logger['error'](_[_0x3bbf('0x27')](_0x29de4f)?JSON[_0x3bbf('0xe')](_0x29de4f):_0x29de4f);}}_0x3e9f44['on'](_0x3bbf('0x28'),_0x432b94);_0x3e9f44['on']('message',_0x3196e9);_0x3e9f44['on'](_0x3bbf('0x11'),_0x505b40);_0x3e9f44['on']('error',_0x178b3e);});}; \ No newline at end of file +var _0x0f3a=['Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','send','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x521599,_0x38dcf0){var _0x4441c1=function(_0x1dfd0f){while(--_0x1dfd0f){_0x521599['push'](_0x521599['shift']());}};_0x4441c1(++_0x38dcf0);}(_0x0f3a,0x1d0));var _0xa0f3=function(_0x311c4d,_0xd99948){_0x311c4d=_0x311c4d-0x0;var _0x2677ce=_0x0f3a[_0x311c4d];return _0x2677ce;};'use strict';var BPromise=require('bluebird');var _=require(_0xa0f3('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa0f3('0x1'));var crypto=require(_0xa0f3('0x2'));var logger=require(_0xa0f3('0x3'))(_0xa0f3('0x4'));module[_0xa0f3('0x5')]=function(_0x422c7b,_0x27a3fc,_0x494721,_0x3e5df6){return new BPromise(function(_0x504d41,_0x3a3eda){logger[_0xa0f3('0x6')](_0xa0f3('0x7'),_0x3e5df6||_0xa0f3('0x8'));var _0x219254=new WebSocket(_0x3e5df6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4f07e4='';var _0x558b37='0';var _0x598a78='1';var _0x329ede='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x36e5df(_0x5336ca){var _0x4bd79e=crypto[_0xa0f3('0x9')](_0xa0f3('0xa'));_0x4bd79e[_0xa0f3('0xb')](_0x5336ca);return _0x4bd79e['digest'](_0xa0f3('0xc'));}function _0x1318c4(){try{logger[_0xa0f3('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x4d6578=moment()['unix']();var _0x3ce2c0=_0x36e5df(_0x4d6578+_0x27a3fc+_0x494721);_0x219254[_0xa0f3('0xd')](JSON['stringify']({'appID':_0x27a3fc,'timestamp':_0x4d6578,'appKey':_0x3ce2c0}));var _0x5b79b5=fs[_0xa0f3('0xe')](_0x422c7b);_0x5b79b5['on']('data',function(_0x11f55f){_0x219254[_0xa0f3('0xd')](_0x11f55f);});_0x5b79b5['on'](_0xa0f3('0xf'),function(){_0x219254[_0xa0f3('0xd')](_0xa0f3('0x10'));});}catch(_0x1cf85c){logger[_0xa0f3('0x11')](_0xa0f3('0x12'),JSON[_0xa0f3('0x13')](_0x1cf85c));_0x219254[_0xa0f3('0x14')]();}}function _0x4ebfdc(_0x12b4d8){try{if(_0x12b4d8){var _0x134f9f=JSON[_0xa0f3('0x15')](_0x12b4d8);switch(_0x134f9f[_0xa0f3('0x16')]){case 0x0:if(_0x134f9f[_0xa0f3('0x17')]){if(_0x134f9f[_0xa0f3('0x17')][_0xa0f3('0x18')]){logger[_0xa0f3('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x134f9f[_0xa0f3('0x17')][_0xa0f3('0x19')]));_0x4f07e4=_0x134f9f[_0xa0f3('0x17')]['hypotheses'][0x0][_0xa0f3('0x1a')];_0x558b37=_0x134f9f[_0xa0f3('0x17')][_0xa0f3('0x19')][0x0]['likelihood'];_0x598a78='0';_0x329ede=_0xa0f3('0x1b');_0x219254[_0xa0f3('0x14')]();}}break;case 0x1:logger[_0xa0f3('0x6')](_0xa0f3('0x1c'));_0x598a78='1';_0x329ede=_0xa0f3('0x1c');break;case 0x2:logger[_0xa0f3('0x6')](_0xa0f3('0x1d'));_0x598a78='2';_0x329ede=_0xa0f3('0x1d');break;case 0x9:logger[_0xa0f3('0x6')](_0xa0f3('0x1e'));_0x598a78='9';_0x329ede=_0xa0f3('0x1e');break;case 0xa:logger['info'](_0xa0f3('0x1f'));_0x598a78='10';_0x329ede=_0xa0f3('0x1f');break;case 0xb:logger[_0xa0f3('0x6')](_0xa0f3('0x20'));_0x598a78='11';_0x329ede=_0xa0f3('0x20');}}}catch(_0x1f53e2){logger[_0xa0f3('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x1f53e2));_0x219254[_0xa0f3('0x14')]();}}function _0x9699b(){logger[_0xa0f3('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x504d41({'transcript':_0x4f07e4,'confidence':_0x558b37,'status':_0x598a78,'status_message':_0x329ede});}function _0x291a87(_0x37f7bc){logger[_0xa0f3('0x11')](_0xa0f3('0x21'));if(!_[_0xa0f3('0x22')](_0x37f7bc)){logger[_0xa0f3('0x11')](_[_0xa0f3('0x23')](_0x37f7bc)?JSON[_0xa0f3('0x13')](_0x37f7bc):_0x37f7bc);}}_0x219254['on'](_0xa0f3('0x24'),_0x1318c4);_0x219254['on'](_0xa0f3('0x25'),_0x4ebfdc);_0x219254['on']('close',_0x9699b);_0x219254['on'](_0xa0f3('0x11'),_0x291a87);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 10cb4be..bb59288 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xd1b9=['./asr'];(function(_0x1f075e,_0x4d8fa7){var _0x5a79a4=function(_0x1dbc56){while(--_0x1dbc56){_0x1f075e['push'](_0x1f075e['shift']());}};_0x5a79a4(++_0x4d8fa7);}(_0xd1b9,0x13c));var _0x9d1b=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xd1b9[_0x1b70e3];return _0x1452ab;};var asr=require(_0x9d1b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c56c4d8..1b91b33 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 _0xc861=['exports','util','net','events','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','inherits'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xc861,0x1a3));var _0x1c86=function(_0x3a4f9f,_0xba5996){_0x3a4f9f=_0x3a4f9f-0x0;var _0x1937cf=_0xc861[_0x3a4f9f];return _0x1937cf;};'use strict';var util=require(_0x1c86('0x0'));var net=require(_0x1c86('0x1'));var EventEmitter=require(_0x1c86('0x2'))['EventEmitter'];var AGIError=require(_0x1c86('0x3'));var AGIChannel=require(_0x1c86('0x4'));var AGIServer=function(_0x3779ab,_0x18adc1,_0x390aae){var _0x2a6a59=this,_0x3779ab=_0x3779ab||0x11dd,_0x18adc1=_0x18adc1||_0x1c86('0x5'),_0x595c26=null,_0x50d975=0x0;EventEmitter['call'](_0x2a6a59);function _0x1ac209(){if(!_0x3779ab){_0x2a6a59[_0x1c86('0x6')](_0x1c86('0x7'),new AGIError(_0x1c86('0x8')));return![];}_0x595c26=net[_0x1c86('0x9')]();_0x595c26['listen'](_0x3779ab,_0x18adc1);_0x595c26['on'](_0x1c86('0xa'),function(){_0x2a6a59[_0x1c86('0x6')]('listening');});_0x595c26['on'](_0x1c86('0xb'),function(_0x221405){_0x595c26['getConnections'](function(_0x68f033,_0x13a1df){if(_0x68f033){_0x2a6a59[_0x1c86('0x6')]('error',new AGIError(_0x1c86('0xc'),_0x68f033));}else if(_0x390aae&&_0x390aae<0x0){_0x2a6a59[_0x1c86('0x6')]('error',new AGIError(_0x1c86('0xd')));_0x221405[_0x1c86('0xe')]();}else if(_0x390aae&&_0x390aae>0x0&&_0x390aae<_0x13a1df){_0x50d975+=0x1;_0x2a6a59['emit'](_0x1c86('0x7'),new AGIError(_0x1c86('0xf'),_0x50d975));_0x221405['destroy']();}else{var _0x32bc49=new AGIChannel(_0x221405);_0x32bc49['on'](_0x1c86('0x10'),function(){_0x2a6a59[_0x1c86('0x6')]('connection',_0x32bc49);});}});});_0x595c26['on'](_0x1c86('0x7'),function(_0x47e0a4){_0x2a6a59[_0x1c86('0x6')](_0x1c86('0x7'),new AGIError(_0x1c86('0xc'),_0x47e0a4[_0x1c86('0x11')]));});_0x595c26['on'](_0x1c86('0x12'),function(){_0x2a6a59[_0x1c86('0x6')](_0x1c86('0x12'),new AGIError(_0x1c86('0x13')));});}process['nextTick'](function(){_0x1ac209();});};util[_0x1c86('0x14')](AGIServer,EventEmitter);module[_0x1c86('0x15')]=function(_0x2c2a2b,_0x165bf5,_0x13f924){return new AGIServer(_0x2c2a2b,_0x165bf5,_0x13f924);}; \ No newline at end of file +var _0x98c4=['E_AGI_SERVER_MAXCONNECTION','ready','code','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','EventEmitter','./error','error','E_AGI_ARGUMENT_PORT','createServer','listen','emit','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x98c4,0x180));var _0x498c=function(_0x3f3c24,_0x3d1dd6){_0x3f3c24=_0x3f3c24-0x0;var _0x3c7cf7=_0x98c4[_0x3f3c24];return _0x3c7cf7;};'use strict';var util=require(_0x498c('0x0'));var net=require(_0x498c('0x1'));var EventEmitter=require('events')[_0x498c('0x2')];var AGIError=require(_0x498c('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x55abf5,_0x3d687a,_0x1321f4){var _0x2e75da=this,_0x55abf5=_0x55abf5||0x11dd,_0x3d687a=_0x3d687a||'127.0.0.1',_0x49150d=null,_0x267864=0x0;EventEmitter['call'](_0x2e75da);function _0x29cd85(){if(!_0x55abf5){_0x2e75da['emit'](_0x498c('0x4'),new AGIError(_0x498c('0x5')));return![];}_0x49150d=net[_0x498c('0x6')]();_0x49150d[_0x498c('0x7')](_0x55abf5,_0x3d687a);_0x49150d['on']('listening',function(){_0x2e75da[_0x498c('0x8')](_0x498c('0x9'));});_0x49150d['on'](_0x498c('0xa'),function(_0x52821e){_0x49150d[_0x498c('0xb')](function(_0x34794e,_0x28219c){if(_0x34794e){_0x2e75da['emit']('error',new AGIError(_0x498c('0xc'),_0x34794e));}else if(_0x1321f4&&_0x1321f4<0x0){_0x2e75da[_0x498c('0x8')]('error',new AGIError(_0x498c('0xd')));_0x52821e[_0x498c('0xe')]();}else if(_0x1321f4&&_0x1321f4>0x0&&_0x1321f4<_0x28219c){_0x267864+=0x1;_0x2e75da[_0x498c('0x8')](_0x498c('0x4'),new AGIError(_0x498c('0xf'),_0x267864));_0x52821e[_0x498c('0xe')]();}else{var _0x17f17a=new AGIChannel(_0x52821e);_0x17f17a['on'](_0x498c('0x10'),function(){_0x2e75da[_0x498c('0x8')](_0x498c('0xa'),_0x17f17a);});}});});_0x49150d['on']('error',function(_0x37e642){_0x2e75da[_0x498c('0x8')](_0x498c('0x4'),new AGIError(_0x498c('0xc'),_0x37e642[_0x498c('0x11')]));});_0x49150d['on']('close',function(){_0x2e75da[_0x498c('0x8')]('close',new AGIError(_0x498c('0x12')));});}process[_0x498c('0x13')](function(){_0x29cd85();});};util['inherits'](AGIServer,EventEmitter);module[_0x498c('0x14')]=function(_0x7c97ad,_0x575bf3,_0x17df7d){return new AGIServer(_0x7c97ad,_0x575bf3,_0x17df7d);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 375199e..11d1569 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 _0xa0d1=['speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','hasOwnProperty','isString','recursiveNodeIndex','length','replaceAllVariables','isPlainObject','isEmpty','saveRestApiResult','isArray','setVariable','%s.%s','replaceObjectAllVariables','split','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','label','grammar','noop','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','generate','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','NOBEEP','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','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','extra','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','recordingFormat','%s_%s','%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','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','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','vswitch','replaceAll','exports','lodash','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','callerid','createSquareRecording','priority','accountcode','dnid','arg_1','file','createCmContact','isNil','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','sestekNDA','ispeechTTS','ispeech_tts_language','en-US'];(function(_0x3de565,_0xe300b9){var _0x2fd767=function(_0x124790){while(--_0x124790){_0x3de565['push'](_0x3de565['shift']());}};_0x2fd767(++_0xe300b9);}(_0xa0d1,0x144));var _0x1a0d=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xa0d1[_0x2070da];return _0x4f9fe1;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x1a0d('0x0'));var sh=require('shelljs');var odbc=require(_0x1a0d('0x1'))();var rs=require(_0x1a0d('0x2'));var moment=require(_0x1a0d('0x3'));var Mustache=require(_0x1a0d('0x4'));var rp=require(_0x1a0d('0x5'));var logger=require('../../config/logger')(_0x1a0d('0x6'));var config=require(_0x1a0d('0x7'));var scripts=require(_0x1a0d('0x8'));var FILES_PATH=_0x1a0d('0x9');var recursiveMapAttributes=[_0x1a0d('0xa'),_0x1a0d('0xb')];var verticesWithRetry=[_0x1a0d('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x184e12,_0x32999a,_0x108900){this['channel']=_0x184e12;this[_0x1a0d('0xd')]=_0x32999a;this['mailRpc']=_0x108900;};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0xf')]=function(_0x37990f,_0x229f03){this['rpc'][_0x1a0d('0x10')](_0x37990f)[_0x1a0d('0x11')](function(_0x527636){_0x229f03(null,_0x527636?_0x527636[_0x1a0d('0x12')]:![]);})[_0x1a0d('0x13')](function(_0x5b537a){_0x229f03(_0x5b537a);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x14')]=function(_0x4721cb,_0x5e0c35){this[_0x1a0d('0xd')][_0x1a0d('0x15')](_0x4721cb)[_0x1a0d('0x11')](function(_0xdcd6b9){_0x5e0c35(null,_0xdcd6b9?_0xdcd6b9[_0x1a0d('0x12')]:![]);})['catch'](function(_0x39eb09){_0x5e0c35(_0x39eb09);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x16')]=function(_0x55650c,_0x397c1d){this['rpc'][_0x1a0d('0x17')](_0x55650c)['then'](function(_0xfe6334){_0x397c1d(null,_0xfe6334?_0xfe6334[_0x1a0d('0x12')]:![]);})[_0x1a0d('0x13')](function(_0x387c0d){_0x397c1d(_0x387c0d);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x18')]=function(_0xdf846,_0x1a6ce4){this[_0x1a0d('0xd')][_0x1a0d('0x19')](_0xdf846)[_0x1a0d('0x11')](function(_0x5acc91){_0x1a6ce4(null,_0x5acc91?_0x5acc91[_0x1a0d('0x1a')]:![]);})['catch'](function(_0x200c38){_0x1a6ce4(_0x200c38);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x1b')]=function(_0x44da82,_0x27f6c7){this[_0x1a0d('0xd')][_0x1a0d('0x1c')](_0x44da82)[_0x1a0d('0x11')](function(_0x2546a1){_0x27f6c7(null,_0x2546a1?_0x2546a1[_0x1a0d('0x12')]:![]);})[_0x1a0d('0x13')](function(_0x537c7f){_0x27f6c7(_0x537c7f);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x1d')]=function(_0x3bf091,_0x1f310e){this[_0x1a0d('0xd')][_0x1a0d('0x1e')](_0x3bf091)[_0x1a0d('0x11')](function(_0x4b31dc){_0x1f310e(null,_0x4b31dc?_0x4b31dc[_0x1a0d('0x12')]:![]);})[_0x1a0d('0x13')](function(_0x51b2c0){_0x1f310e(_0x51b2c0);});};AGIVertices[_0x1a0d('0xe')]['getSound']=function(_0x44763b,_0x5df197){var _0x429aae=this;this[_0x1a0d('0xd')][_0x1a0d('0x1f')](_0x44763b)[_0x1a0d('0x11')](function(_0x59612e){_0x5df197(null,_0x59612e?_0x429aae[_0x1a0d('0x20')](_0x59612e[_0x1a0d('0x21')]):![]);})['catch'](function(_0x21863e){_0x5df197(_0x21863e);});};AGIVertices[_0x1a0d('0xe')]['getMailAccount']=function(_0x35f7e7,_0xc8c0fd){this[_0x1a0d('0xd')][_0x1a0d('0x22')](_0x35f7e7)[_0x1a0d('0x11')](function(_0x5cd752){_0xc8c0fd(null,_0x5cd752?_0x5cd752:![]);})[_0x1a0d('0x13')](function(_0x55747f){_0xc8c0fd(_0x55747f);});};AGIVertices[_0x1a0d('0xe')]['sendMailMessage']=function(_0x19ba9c,_0x2be433,_0x819650){this['mailRpc'][_0x1a0d('0x23')](_0x19ba9c,_0x2be433)['then'](function(){_0x819650(null);})[_0x1a0d('0x13')](function(_0x2015cd){_0x819650(_0x2015cd);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x24')]=function(_0x557700,_0x1a1f4b){this['rpc'][_0x1a0d('0x25')](_0x557700)['then'](function(_0xcd3c4f){if(_0xcd3c4f){if(_0xcd3c4f[_0x1a0d('0x26')]){_0x1a1f4b(null,[_0xcd3c4f[_0x1a0d('0x27')]]);}else{_0x1a1f4b(null,_[_0x1a0d('0x28')](_0xcd3c4f[_0x1a0d('0x29')],_0x1a0d('0x27')));}}else{_0x1a1f4b(null,![]);}})['catch'](function(_0x2a57ea){_0x1a1f4b(_0x2a57ea);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x20')]=function(_0x3d45f9){return util[_0x1a0d('0x2a')](_0x1a0d('0x2b'),FILES_PATH,_0x3d45f9);};AGIVertices['prototype'][_0x1a0d('0x2c')]=function(_0x4e7e2c,_0x45abec,_0x24599f){odbc[_0x1a0d('0x2d')](_0x4e7e2c,function(_0x37e3b9){if(_0x37e3b9){logger[_0x1a0d('0x2e')](_0x1a0d('0x2f'),_0x37e3b9);_0x24599f(_0x37e3b9);}else{logger[_0x1a0d('0x30')](_0x1a0d('0x31'));odbc[_0x1a0d('0x32')](_0x45abec,function(_0xeeeb57,_0x13bd8c){if(_0xeeeb57){logger[_0x1a0d('0x30')]('Error\x20executing\x20query\x20%s',_0x45abec);_0x24599f(_0xeeeb57);}else{logger[_0x1a0d('0x30')](_0x1a0d('0x33'),_0x45abec);odbc[_0x1a0d('0x34')](function(_0x56f834){if(_0x56f834){logger[_0x1a0d('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x56f834);}_0x24599f(null,_0x13bd8c);});}});}});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x35')]=function(_0x1c62e2,_0x5e7e53){this[_0x1a0d('0xd')]['getSmsAccountById'](_0x1c62e2)['then'](function(_0x598c16){_0x5e7e53(null,_0x598c16?_0x598c16:![]);})['catch'](function(_0x5d3114){_0x5e7e53(_0x5d3114);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x36')]=function(_0x23a0ad,_0x305467){this[_0x1a0d('0xd')][_0x1a0d('0x36')](_0x23a0ad)['then'](function(_0x4b7669){_0x305467(null,_0x4b7669);})[_0x1a0d('0x13')](function(_0x447914){_0x305467(_0x447914);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x37')]=function(_0x3c4a02,_0x46b368,_0x5af85d){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x1a0d('0x38')][_0x1a0d('0x39')],'node':_0x3c4a02['label'],'application':_0x3c4a02[_0x1a0d('0x3a')],'data':_0x46b368||null,'project_name':this[_0x1a0d('0x38')]['arg_1'],'callerid':this['channel'][_0x1a0d('0x3b')]})[_0x1a0d('0x11')](function(_0xf2e5c3){if(_0x5af85d){_0x5af85d(null,_0xf2e5c3);}})['catch'](function(_0x2e4479){if(_0x5af85d){_0x5af85d(_0x2e4479);}});};AGIVertices['prototype'][_0x1a0d('0x3c')]=function(_0x22deea,_0x1db495,_0x736359,_0x348183){this[_0x1a0d('0xd')][_0x1a0d('0x3c')]({'uniqueid':this[_0x1a0d('0x38')][_0x1a0d('0x39')],'callerid':this[_0x1a0d('0x38')]['callerid'],'calleridname':this[_0x1a0d('0x38')]['calleridname'],'context':this[_0x1a0d('0x38')]['context'],'extension':this[_0x1a0d('0x38')]['extension'],'priority':this[_0x1a0d('0x38')][_0x1a0d('0x3d')],'accountcode':this[_0x1a0d('0x38')][_0x1a0d('0x3e')],'dnid':this[_0x1a0d('0x38')][_0x1a0d('0x3f')],'projectName':this[_0x1a0d('0x38')][_0x1a0d('0x40')],'saveName':_0x1db495,'filename':_0x22deea[_0x1a0d('0x41')]||_0x1db495,'savePath':_0x736359})[_0x1a0d('0x11')](function(_0x42f549){_0x348183(null,_0x42f549);})['catch'](function(_0x3416c8){_0x348183(_0x3416c8);});};AGIVertices[_0x1a0d('0xe')]['createSquareMessage']=function(_0x5d6145,_0x2218cb,_0x2eebd0,_0x1db2cd,_0x220946){this['rpc']['createSquareMessage']({'uniqueid':this[_0x1a0d('0x38')][_0x1a0d('0x39')],'body':_0x5d6145,'direction':_0x2218cb,'providerName':_0x2eebd0,'providerResponse':_0x1db2cd})[_0x1a0d('0x11')](function(_0x37308b){if(_0x220946){_0x220946(null,_0x37308b);}})[_0x1a0d('0x13')](function(_0x5f3694){if(_0x220946){_0x220946(_0x5f3694);}});};AGIVertices[_0x1a0d('0xe')]['createCmContact']=function(_0x410fdf,_0x19af6d){this[_0x1a0d('0xd')][_0x1a0d('0x42')]({'firstName':_['isEmpty'](_0x410fdf[_0x1a0d('0x12')])||_[_0x1a0d('0x43')](_0x410fdf[_0x1a0d('0x12')])?'callback_'+Math['random']():_0x410fdf['name'],'lastName':_['isEmpty'](_0x410fdf[_0x1a0d('0x44')])||_[_0x1a0d('0x43')](_0x410fdf['lastName'])?null:_0x410fdf[_0x1a0d('0x44')],'phone':_0x410fdf['phone'],'ListId':_0x410fdf[_0x1a0d('0x45')],'scheduledat':_0x410fdf[_0x1a0d('0x46')],'callbackUniqueid':this[_0x1a0d('0x38')][_0x1a0d('0x39')],'tags':'callback','description':_0x1a0d('0x47')+_0x410fdf['scheduledAt'][_0x1a0d('0x48')](),'priority':_0x410fdf[_0x1a0d('0x49')]})[_0x1a0d('0x11')](function(_0x312e8c){_0x19af6d(null,_0x312e8c);})['catch'](function(_0x50be33){_0x19af6d(_0x50be33);});};AGIVertices[_0x1a0d('0xe')]['getPause']=function(_0x3fea70,_0x5145e1){this['rpc'][_0x1a0d('0x4a')](_0x3fea70)[_0x1a0d('0x11')](function(_0x3d777b){_0x5145e1(null,_0x3d777b?_0x3d777b[_0x1a0d('0x12')]:![]);})[_0x1a0d('0x13')](function(_0x4bba63){_0x5145e1(_0x4bba63);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x4b')]=function(_0x454a8a,_0x3244f2,_0x49cb04){var _0x3a1c1f={'role':'agent'};_0x3a1c1f[_0x454a8a]=this[_0x1a0d('0x38')]['callerid'];this[_0x1a0d('0xd')][_0x1a0d('0x4b')](_0x3a1c1f,_0x3244f2,this[_0x1a0d('0x38')]['uniqueid'])[_0x1a0d('0x11')](function(_0x29ea1b){_0x49cb04(null,_['isNil'](_0x29ea1b)?![]:!![]);})['catch'](function(_0x316586){logger[_0x1a0d('0x2e')](_0x316586);_0x49cb04(null,![]);});};AGIVertices[_0x1a0d('0xe')]['agentUnpause']=function(_0x5ebe9d,_0x3691c3){var _0x5aeed7={'role':_0x1a0d('0x4c')};_0x5aeed7[_0x5ebe9d]=this[_0x1a0d('0x38')][_0x1a0d('0x3b')];this[_0x1a0d('0xd')][_0x1a0d('0x4d')](_0x5aeed7)['then'](function(_0x442047){_0x3691c3(null,_[_0x1a0d('0x43')](_0x442047)?![]:!![]);})['catch'](function(_0x3865b8){logger[_0x1a0d('0x2e')](_0x3865b8);_0x3691c3(null,![]);});};AGIVertices[_0x1a0d('0xe')]['agentLogout']=function(_0x562975,_0x5498c0){var _0x110a8b={'role':_0x1a0d('0x4c')};_0x110a8b[_0x562975]=this[_0x1a0d('0x38')]['callerid'];this['rpc'][_0x1a0d('0x4e')](_0x110a8b)[_0x1a0d('0x11')](function(_0x23cd3a){_0x5498c0(null,_['isNil'](_0x23cd3a)?![]:!![]);})['catch'](function(_0x187d01){logger['error'](_0x187d01);_0x5498c0(null,![]);});};AGIVertices['prototype'][_0x1a0d('0x4f')]=function(_0xb117b8,_0x112ae7){var _0xfe5616={'role':'agent'};_0xfe5616[_0xb117b8]=this[_0x1a0d('0x38')][_0x1a0d('0x3b')];var _0x1c48e7=_0xb117b8!=_0x1a0d('0x50')?util[_0x1a0d('0x2a')]('%s/%s@from-sip/n',_0x1a0d('0x51'),this['channel'][_0x1a0d('0x3b')]):undefined;this[_0x1a0d('0xd')][_0x1a0d('0x4f')](_0xfe5616,_0x1c48e7)[_0x1a0d('0x11')](function(_0x28f348){_0x112ae7(null,_[_0x1a0d('0x43')](_0x28f348)?![]:!![]);})[_0x1a0d('0x13')](function(_0x2ebbdc){logger[_0x1a0d('0x2e')](_0x2ebbdc);_0x112ae7(null,![]);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x52')]=function(_0x3289a3,_0x483e70){sh[_0x1a0d('0x53')](_[_0x1a0d('0x54')](_0x3289a3),function(_0xec819f,_0x21b2ed){var _0x570333=_0x21b2ed[_0x1a0d('0x55')](/(\r\n|\n|\r)/gm,'');_0x483e70(null,_0x570333);});};AGIVertices[_0x1a0d('0xe')]['googleCloudTTS']=function(_0x1b722d,_0x2b1a9a){scripts[_0x1a0d('0x56')](_0x1b722d[_0x1a0d('0x57')],_0x1b722d[_0x1a0d('0x58')]||_0x1a0d('0x59'),_0x1b722d['text'],_0x1b722d[_0x1a0d('0x5a')]||'en-US',_0x1b722d[_0x1a0d('0x5b')]||_0x1a0d('0x5c'),_0x1b722d['audioEncoding']||_0x1a0d('0x5d'))[_0x1a0d('0x11')](function(_0x4a636f){_0x2b1a9a(null,_0x4a636f);})[_0x1a0d('0x13')](function(_0x1a5cfa){_0x2b1a9a(_0x1a5cfa);});};AGIVertices['prototype'][_0x1a0d('0x5e')]=function(_0x161b0c,_0x2cd070){scripts['googleTTS'](_0x161b0c['text'],_0x161b0c[_0x1a0d('0x5f')]||'en',0x1)[_0x1a0d('0x11')](function(_0x2e739c){_0x2cd070(null,_0x2e739c);})['catch'](function(_0x426702){_0x2cd070(_0x426702);});};AGIVertices['prototype'][_0x1a0d('0x60')]=function(_0x3b03b3,_0xe5d86c){var _0x1f7edf={'uri':_0x3b03b3[_0x1a0d('0x61')],'method':_0x3b03b3[_0x1a0d('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3b03b3[_0x1a0d('0x63')])===_0x1a0d('0x64')&&parseInt(_0x3b03b3[_0x1a0d('0x63')])>=0x1?parseInt(_0x3b03b3[_0x1a0d('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x1a0d('0x65')]([_0x1a0d('0x66'),'PUT'],_0x1f7edf[_0x1a0d('0x62')][_0x1a0d('0x67')]())){try{_0x1f7edf[_0x1a0d('0x68')]=_0x3b03b3['rawBody']?JSON[_0x1a0d('0x69')](_0x3b03b3['rawBody']):{};}catch(_0x4681ab){logger[_0x1a0d('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4681ab);}}try{_0x1f7edf[_0x1a0d('0x6a')]=_0x3b03b3[_0x1a0d('0xa')]?JSON[_0x1a0d('0x69')](_0x3b03b3[_0x1a0d('0xa')]):{};}catch(_0x2c81d3){logger[_0x1a0d('0x2e')](_0x1a0d('0x6b'),_0x2c81d3);}if(_0x3b03b3['computedVariables']){try{var _0x16f20a=require(_0x3b03b3['computedVariables'])[_0x1a0d('0x6c')](this,_0x1f7edf);_0x1f7edf[_0x1a0d('0x6d')]=Mustache[_0x1a0d('0x6e')](_0x3b03b3[_0x1a0d('0x61')],_0x16f20a,{},['$$','$$']);if(_0x1f7edf[_0x1a0d('0x6a')]){_0x1f7edf[_0x1a0d('0x6a')]=JSON[_0x1a0d('0x69')](Mustache[_0x1a0d('0x6e')](JSON['stringify'](_0x1f7edf[_0x1a0d('0x6a')]),_0x16f20a,{},['$$','$$']));}if(_0x1f7edf[_0x1a0d('0x68')]){_0x1f7edf[_0x1a0d('0x68')]=JSON['parse'](Mustache[_0x1a0d('0x6e')](JSON[_0x1a0d('0x6f')](_0x1f7edf[_0x1a0d('0x68')]),_0x16f20a,{},['$$','$$']));}}catch(_0x32101b){logger['error'](_0x1a0d('0x70'),_0x32101b);}}rp(_0x1f7edf)['then'](function(_0x39e38f){var _0x33e641={'statusCode':_0x39e38f[_0x1a0d('0x71')]||0xc8,'statusMessage':_0x39e38f[_0x1a0d('0x72')]||'OK','headers':_0x39e38f[_0x1a0d('0x6a')]||{},'body':_0x39e38f[_0x1a0d('0x68')]||{}};_0xe5d86c(null,_0x33e641);})[_0x1a0d('0x13')](function(_0x285f8e){var _0x59617e={'statusCode':_0x285f8e[_0x1a0d('0x71')]||0x1f4,'statusMessage':_0x285f8e[_0x1a0d('0x73')]||_0x1a0d('0x74'),'headers':_0x285f8e[_0x1a0d('0x75')]['headers']||{},'body':_0x285f8e[_0x1a0d('0x75')][_0x1a0d('0x68')]||{}};_0xe5d86c(null,_0x59617e);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x76')]=function(_0x59ea5d,_0x54ff9c){scripts[_0x1a0d('0x76')](this[_0x1a0d('0x38')][_0x1a0d('0x39')],_0x59ea5d['key'],_0x59ea5d[_0x1a0d('0x59')],_0x59ea5d[_0x1a0d('0x77')]||'en')[_0x1a0d('0x11')](function(_0x304fdd){_0x54ff9c(null,_0x304fdd);})['catch'](function(_0x8a49aa){_0x54ff9c(_0x8a49aa);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x78')]=function(_0x9a3a3c,_0x5dec78){scripts['googleDialogflowV2'](this[_0x1a0d('0x38')][_0x1a0d('0x39')],_0x9a3a3c[_0x1a0d('0x79')],_0x9a3a3c['client_email'],_0x9a3a3c['private_key'],_0x9a3a3c[_0x1a0d('0x59')],_0x9a3a3c['dialogflowV2_language']||'en')['then'](function(_0x44b052){_0x5dec78(null,_0x44b052);})[_0x1a0d('0x13')](function(_0x510b04){_0x5dec78(_0x510b04);});};AGIVertices['prototype'][_0x1a0d('0x7a')]=function(_0x2ab09e,_0xc5312e){scripts[_0x1a0d('0x7a')](this[_0x1a0d('0x38')],_0x2ab09e)[_0x1a0d('0x11')](function(_0x479263){_0xc5312e(null,_0x479263);})[_0x1a0d('0x13')](function(_0xcf83){_0xc5312e(_0xcf83);});};AGIVertices[_0x1a0d('0xe')]['ispeechTTS']=function(_0xa53438,_0xabe4ff){scripts[_0x1a0d('0x7b')](_0xa53438['key'],_0xa53438[_0x1a0d('0x59')],_0xa53438[_0x1a0d('0x7c')]||_0x1a0d('0x7d'),_0xa53438[_0x1a0d('0x7e')])['then'](function(_0xe4128b){_0xabe4ff(null,_0xe4128b);})['catch'](function(_0xa84248){_0xabe4ff(_0xa84248);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x7f')]=function(_0x15c381,_0x4c04a5,_0xe23cbd){scripts[_0x1a0d('0x7f')](_0x4c04a5,_0x15c381[_0x1a0d('0x80')],_0x15c381[_0x1a0d('0x81')]||'en-US',this[_0x1a0d('0x82')](_0x15c381[_0x1a0d('0x83')])?_0x15c381[_0x1a0d('0x83')]:undefined)[_0x1a0d('0x11')](function(_0xad3d8b){_0xe23cbd(null,_0xad3d8b);})[_0x1a0d('0x13')](function(_0x153a5f){_0xe23cbd(_0x153a5f);});};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x84')]=function(_0x5c1b17,_0x1f92d2){scripts['awsPolly'](_0x5c1b17[_0x1a0d('0x85')],_0x5c1b17[_0x1a0d('0x86')],_0x5c1b17['aws_polly_region'],_0x5c1b17[_0x1a0d('0x87')]||_0x1a0d('0x88'),_0x5c1b17[_0x1a0d('0x59')],_0x5c1b17[_0x1a0d('0x89')]||'text')[_0x1a0d('0x11')](function(_0x2c3bd2){_0x1f92d2(null,_0x2c3bd2);})[_0x1a0d('0x13')](function(_0xf1f621){_0x1f92d2(_0xf1f621);});};AGIVertices[_0x1a0d('0xe')]['awsLex']=function(_0x50e03d,_0x4d6f86){scripts[_0x1a0d('0x8a')](this[_0x1a0d('0x38')][_0x1a0d('0x39')],_0x50e03d[_0x1a0d('0x85')],_0x50e03d[_0x1a0d('0x86')],_0x50e03d['aws_lex_region'],_0x50e03d['text'],_0x50e03d[_0x1a0d('0x8b')])['then'](function(_0x4656a2){_0x4d6f86(null,_0x4656a2);})['catch'](function(_0xf87d59){_0x4d6f86(_0xf87d59);});};AGIVertices['prototype']['googleASR']=function(_0x434a5f,_0x3a0e7e,_0x31bcd4){scripts[_0x1a0d('0x8c')](_0x3a0e7e,_0x434a5f[_0x1a0d('0x80')],_0x434a5f[_0x1a0d('0x8d')]||_0x1a0d('0x7d'))[_0x1a0d('0x11')](function(_0x286a2b){_0x31bcd4(null,_0x286a2b);})[_0x1a0d('0x13')](function(_0x30780e){_0x31bcd4(_0x30780e);});};AGIVertices[_0x1a0d('0xe')]['tildeASR']=function(_0x326961,_0x36a330,_0x55be85){scripts[_0x1a0d('0x8e')](_0x36a330,_0x326961['appid'],_0x326961[_0x1a0d('0x8f')],_0x326961[_0x1a0d('0x6d')])[_0x1a0d('0x11')](function(_0x2965c2){_0x55be85(null,_0x2965c2);})['catch'](function(_0xfe0d5a){_0x55be85(_0xfe0d5a);});};AGIVertices[_0x1a0d('0xe')]['clear']=function(_0x191d7a){var _0x3fa88=_[_0x1a0d('0x65')](verticesWithRetry,_0x191d7a['agicommand'])?_0x191d7a:_[_0x1a0d('0x90')](_0x191d7a);for(var _0x3e8405 in _0x3fa88){if(_0x3fa88[_0x1a0d('0x91')](_0x3e8405)){if(_0x3fa88[_0x3e8405]&&_[_0x1a0d('0x92')](_0x3fa88[_0x3e8405])){if(_[_0x1a0d('0x65')](recursiveMapAttributes,_0x3e8405)){_0x3fa88[_0x3e8405]=this['replaceObjectAllVariables'](_0x3fa88[_0x3e8405]);}else{_0x3fa88[_0x3e8405]=this['replaceAllVariables'](_0x3fa88[_0x3e8405]);}}}}return _0x3fa88;};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x93')]=function(_0x27bc60){for(var _0x4cc0cf in _0x27bc60){if(_0x27bc60[_0x1a0d('0x91')](_0x4cc0cf)){if(_['isPlainObject'](_0x27bc60[_0x4cc0cf])){this[_0x1a0d('0x93')](_0x27bc60[_0x4cc0cf]);}else if(_['isArray'](_0x27bc60[_0x4cc0cf])){for(var _0x39620e=0x0;_0x39620e<_0x27bc60[_0x4cc0cf][_0x1a0d('0x94')];_0x39620e++){this[_0x1a0d('0x93')](_0x27bc60[_0x4cc0cf][_0x39620e]);}}else if(_[_0x1a0d('0x92')](_0x27bc60[_0x4cc0cf])){_0x27bc60[_0x4cc0cf]=this[_0x1a0d('0x95')](_0x27bc60[_0x4cc0cf]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x51f4e6,_0x3e67e7){for(var _0x5952cf in _0x51f4e6){if(_0x51f4e6[_0x1a0d('0x91')](_0x5952cf)){if(_[_0x1a0d('0x96')](_0x51f4e6[_0x5952cf])){if(!_[_0x1a0d('0x97')](_0x51f4e6[_0x5952cf])){this[_0x1a0d('0x98')](_0x51f4e6[_0x5952cf],util['format']('%s.%s',_0x3e67e7,_0x5952cf));}}else if(_[_0x1a0d('0x99')](_0x51f4e6[_0x5952cf])){for(var _0xea8083=0x0;_0xea8083<_0x51f4e6[_0x5952cf]['length'];_0xea8083++){this[_0x1a0d('0x98')](_0x51f4e6[_0x5952cf][_0xea8083],util['format']('%s.%s',_0x3e67e7,_0x5952cf+'['+_0xea8083+']'));}}else{if(!_[_0x1a0d('0x43')](_0x51f4e6[_0x5952cf])){this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util['format'](_0x1a0d('0x9b'),_0x3e67e7,_0x5952cf),_0x51f4e6[_0x5952cf]);}}}}};AGIVertices['prototype'][_0x1a0d('0x9c')]=function(_0x2066d4){try{var _0x10904e=JSON[_0x1a0d('0x69')](_0x2066d4);this[_0x1a0d('0x93')](_0x10904e);return JSON[_0x1a0d('0x6f')](_0x10904e);}catch(_0x3fd573){return this['replaceAllVariables'](_0x2066d4);}};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x95')]=function(_0x14de7e){var _0x1dad89=_0x14de7e['split']('{');for(var _0x4d508b=0x1;_0x4d508b<_0x1dad89[_0x1a0d('0x94')];_0x4d508b+=0x1){var _0x2a3c3f=_0x1dad89[_0x4d508b][_0x1a0d('0x9d')]('}');if(_0x2a3c3f[_0x1a0d('0x94')]>0x1){_0x14de7e=_0x14de7e['replaceAll']('{'+_0x2a3c3f[0x0]+'}',this['channel'][_0x1a0d('0xf')](_0x2a3c3f[0x0])['extra']||_0x2a3c3f[0x0]);}}if(_0x1dad89[_0x1a0d('0x94')]===0x1){return _0x14de7e[_0x1a0d('0x48')]();}return this['replaceAllVariables'](_0x14de7e);};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x9e')]=function(_0x10a920,_0x2e84e2){var _0x85e956=this[_0x1a0d('0x38')][_0x1a0d('0xf')](_0x10a920);if(_0x85e956[_0x1a0d('0x9f')]===-0x1){return _0x85e956;}logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0xa0'),_0x2e84e2,_0x85e956['extra']));return this['channel'][_0x1a0d('0x9a')](_0x2e84e2,_0x85e956['extra']);};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x82')]=function(_0x400744){return _0x400744&&_0x400744!=='0'&&_0x400744!=='-1'&&_0x400744!=='';};AGIVertices[_0x1a0d('0xe')]['maxRetry']=function(_0x522aec){this['createSquareDetailsReport']['sync'](this,_0x522aec,'-');_0x522aec[_0x1a0d('0xa1')]=_0x522aec[_0x1a0d('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1a0d('0xe')]['mrcpsynth']=function(_0x2a46a9){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0xa3'),_0x2a46a9['label']));if(!this['isConfigured'](_0x2a46a9[_0x1a0d('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x2dffa6='\x22'+_0x2a46a9[_0x1a0d('0x59')]+'\x22';if(this[_0x1a0d('0x82')](_0x2a46a9[_0x1a0d('0x75')])){_0x2dffa6+=','+_0x2a46a9[_0x1a0d('0x75')];}var _0x40b52b=this['channel'][_0x1a0d('0x53')](_0x1a0d('0xa4'),_0x2dffa6);if(_0x40b52b[_0x1a0d('0x9f')]===-0x1){return _0x40b52b;}return this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0xa5'),_0x2dffa6));};AGIVertices[_0x1a0d('0xe')]['mrcprecog']=function(_0x51c4a9){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x51c4a9[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x51c4a9[_0x1a0d('0xa7')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0xa9'));}var _0x514621=_0x51c4a9[_0x1a0d('0xa7')];if(this[_0x1a0d('0x82')](_0x51c4a9['options'])){_0x514621+=','+_0x51c4a9[_0x1a0d('0x75')];}var _0x5c7941=this['channel']['exec']('MRCPRecog',_0x514621);if(_0x5c7941[_0x1a0d('0x9f')]===-0x1){return _0x5c7941;}var _0x2fe5d7=this[_0x1a0d('0x9e')](_0x1a0d('0xaa'),'MRCP_RECOG_CONFIDENCE');if(_0x2fe5d7[_0x1a0d('0x9f')]===-0x1){return _0x2fe5d7;}var _0x3a66d3=this[_0x1a0d('0x9e')](_0x1a0d('0xab'),_0x1a0d('0xac'));if(_0x3a66d3[_0x1a0d('0x9f')]===-0x1){return _0x3a66d3;}var _0xd21fef=this['getAndSetVariable']('RECOG_INSTANCE()',_0x1a0d('0xad'));if(_0xd21fef[_0x1a0d('0x9f')]===-0x1){return _0xd21fef;}return this[_0x1a0d('0x38')]['noop'](util['format'](_0x1a0d('0xae'),_0x514621));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x6')]=function(_0x48247f){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0xaf'),_0x48247f[_0x1a0d('0xa6')]));return this[_0x1a0d('0x38')][_0x1a0d('0x6')]([_0x48247f[_0x1a0d('0xb0')],_0x48247f[_0x1a0d('0xb1')]]);};AGIVertices['prototype'][_0x1a0d('0xb2')]=function(_0x2dd009){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0xb3'),_0x2dd009[_0x1a0d('0xa6')]));if(this['isConfigured'](_0x2dd009[_0x1a0d('0x63')])){logger[_0x1a0d('0x30')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x2dd009['timeout']));var _0x22993c=this[_0x1a0d('0x38')][_0x1a0d('0xb4')](_0x2dd009['timeout']);if(_0x22993c['result']===-0x1){return _0x22993c;}}return this[_0x1a0d('0x38')]['answer']();};AGIVertices[_0x1a0d('0xe')]['callback']=function(_0x2ca7c5){logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0xb5'),_0x2ca7c5['label']));if(!this[_0x1a0d('0x82')](_0x2ca7c5[_0x1a0d('0x45')])){return this[_0x1a0d('0x38')]['error'](_0x2ca7c5,_0x1a0d('0xb6'));}_0x2ca7c5[_0x1a0d('0x46')]=moment();if(this[_0x1a0d('0x82')](_0x2ca7c5[_0x1a0d('0xb7')])){_0x2ca7c5['scheduledAt']=moment()['add'](_0x2ca7c5[_0x1a0d('0xb7')],_0x1a0d('0xb8'));}if(!this[_0x1a0d('0x82')](_0x2ca7c5[_0x1a0d('0x49')])){_0x2ca7c5['callback_priority']=0x2;}this['createCmContact'][_0x1a0d('0x6c')](this,_0x2ca7c5);return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0xb9'),_0x2ca7c5[_0x1a0d('0xba')],_0x2ca7c5[_0x1a0d('0x45')],_0x2ca7c5['scheduledAt']));};AGIVertices[_0x1a0d('0xe')]['custom_app']=function(_0x445744){logger[_0x1a0d('0x30')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x445744[_0x1a0d('0xa6')]));var _0x4046b6=this[_0x1a0d('0x38')][_0x1a0d('0x53')](_0x445744[_0x1a0d('0xbb')],_0x445744[_0x1a0d('0x75')]);if(_0x4046b6[_0x1a0d('0x9f')]===-0x1){return _0x4046b6;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('Executed\x20command\x20%s\x20%s',_0x445744[_0x1a0d('0xbb')],_0x445744['options']));};AGIVertices[_0x1a0d('0xe')]['lumenvoxtts']=function(_0x1a2659){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0xbc'),_0x1a2659['label']));if(!this[_0x1a0d('0x82')](_0x1a2659[_0x1a0d('0x59')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0xbd'));}var _0x11e794='\x22'+_0x1a2659[_0x1a0d('0x59')]+'\x22';if(this[_0x1a0d('0x82')](_0x1a2659['options'])){_0x11e794+=','+_0x1a2659[_0x1a0d('0x75')];}var _0x1ad507=this[_0x1a0d('0x38')]['exec'](_0x1a0d('0xa4'),_0x11e794);if(_0x1ad507[_0x1a0d('0x9f')]===-0x1){return _0x1ad507;}return this['channel'][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x11e794));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0xbe')]=function(_0xcd0402){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0xbf'),_0xcd0402[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0xcd0402[_0x1a0d('0x59')])){return this[_0x1a0d('0x38')]['noop'](_0x1a0d('0xbd'));}var _0x29c621='\x22'+_0xcd0402[_0x1a0d('0x59')]+'\x22';if(this[_0x1a0d('0x82')](_0xcd0402[_0x1a0d('0x75')])){_0x29c621+=','+_0xcd0402[_0x1a0d('0x75')];}var _0x13d47d=this[_0x1a0d('0x38')][_0x1a0d('0x53')]('MRCPSynth',_0x29c621);if(_0x13d47d[_0x1a0d('0x9f')]===-0x1){return _0x13d47d;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0xa5'),_0x29c621));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0xc0')]=function(_0x36102a){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0xc1'),_0x36102a[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x36102a[_0x1a0d('0xa7')])){return this['channel'][_0x1a0d('0xa8')]('no\x20grammar\x20configured');}var _0x46bf4a=_0x36102a[_0x1a0d('0xa7')];if(this[_0x1a0d('0x82')](_0x36102a[_0x1a0d('0x75')])){_0x46bf4a+=','+_0x36102a[_0x1a0d('0x75')];}var _0xfbd98c=this['channel'][_0x1a0d('0x53')](_0x1a0d('0xc2'),_0x46bf4a);if(_0xfbd98c[_0x1a0d('0x9f')]===-0x1){return _0xfbd98c;}var _0x15ab60=this['getAndSetVariable'](_0x1a0d('0xaa'),_0x1a0d('0xc3'));if(_0x15ab60[_0x1a0d('0x9f')]===-0x1){return _0x15ab60;}var _0xf045e3=this[_0x1a0d('0x9e')]('RECOG_INPUT()',_0x1a0d('0xc4'));if(_0xf045e3[_0x1a0d('0x9f')]===-0x1){return _0xf045e3;}var _0x2ab4b6=this['getAndSetVariable'](_0x1a0d('0xc5'),'LUMENVOX_ASR_INSTANCE');if(_0x2ab4b6[_0x1a0d('0x9f')]===-0x1){return _0x2ab4b6;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x46bf4a));};AGIVertices[_0x1a0d('0xe')]['sestekasr']=function(_0xe2ee21){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0xc6'),_0xe2ee21['label']));if(!this['isConfigured'](_0xe2ee21[_0x1a0d('0xa7')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xa9'));}var _0x519f6c=_0xe2ee21['grammar'];if(this['isConfigured'](_0xe2ee21[_0x1a0d('0x75')])){_0x519f6c+=','+_0xe2ee21['options'];}var _0x4d0728=this[_0x1a0d('0x38')]['exec'](_0x1a0d('0xc2'),_0x519f6c);if(_0x4d0728[_0x1a0d('0x9f')]===-0x1){return _0x4d0728;}var _0xedaa64=this[_0x1a0d('0x9e')]('RECOG_CONFIDENCE()',_0x1a0d('0xc7'));if(_0xedaa64['result']===-0x1){return _0xedaa64;}var _0x5f0d69=this[_0x1a0d('0x9e')](_0x1a0d('0xab'),_0x1a0d('0xc8'));if(_0x5f0d69[_0x1a0d('0x9f')]===-0x1){return _0x5f0d69;}var _0x538d09=this[_0x1a0d('0x9e')](_0x1a0d('0xc5'),_0x1a0d('0xc9'));if(_0x538d09[_0x1a0d('0x9f')]===-0x1){return _0x538d09;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0xae'),_0x519f6c));};AGIVertices['prototype'][_0x1a0d('0xca')]=function(_0x535ffe){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0xcb'),_0x535ffe['label']));if(!this['isConfigured'](_0x535ffe[_0x1a0d('0xcc')])){return this['channel'][_0x1a0d('0x2e')](_0x535ffe,_0x1a0d('0xcd'));}var _0x5711a5=this[_0x1a0d('0x18')][_0x1a0d('0x6c')](this,_0x535ffe[_0x1a0d('0xcc')]);if(!_0x5711a5){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x535ffe,_0x1a0d('0xce'));}if(!this[_0x1a0d('0x82')](_0x535ffe[_0x1a0d('0x32')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x535ffe,'no\x20query\x20configured');}var _0x38cf78=_0x535ffe[_0x1a0d('0x32')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format'](_0x1a0d('0xcf'),_0x38cf78));var _0x251055=this['getQueryOdbc'][_0x1a0d('0x6c')](this,_0x5711a5,_0x38cf78);this[_0x1a0d('0x37')]['sync'](this,_0x535ffe,_0x38cf78);if(!this[_0x1a0d('0x82')](_0x535ffe[_0x1a0d('0xd0')])){return this[_0x1a0d('0x38')]['noop'](_0x1a0d('0xd1'));}var _0x5a8ffc=this[_0x1a0d('0xf')][_0x1a0d('0x6c')](this,_0x535ffe[_0x1a0d('0xd0')]);if(!_0x5a8ffc){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x535ffe,_0x1a0d('0xd2'));}var _0xf34e06=this;_0x251055[_0x1a0d('0xd3')](function(_0x8501d4,_0x3fbdc6){Object['keys'](_0x8501d4)['forEach'](function(_0x47c41f){_0xf34e06['channel'][_0x1a0d('0x9a')](util[_0x1a0d('0x2a')](_0x1a0d('0xd4'),_0x5a8ffc,_0x3fbdc6,_0x47c41f),_0x8501d4[_0x47c41f]);});});this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util['format'](_0x1a0d('0xd5'),_0x5a8ffc),_0x251055[_0x1a0d('0x94')]);return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('variable\x20%s\x20set',_0x5a8ffc));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0xd6')]=function(_0x26841e){logger[_0x1a0d('0xd7')](util[_0x1a0d('0x2a')](_0x1a0d('0xd8'),_0x26841e[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x26841e[_0x1a0d('0xd9')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x26841e,_0x1a0d('0xda'));}var _0x503be1=this[_0x1a0d('0x1b')][_0x1a0d('0x6c')](this,_0x26841e['sip_id']);if(!_0x503be1){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x26841e,'no\x20user\x20found');}var _0x5ed88f=this[_0x1a0d('0x38')][_0x1a0d('0x53')](_0x1a0d('0xdb'),[util[_0x1a0d('0x2a')](_0x1a0d('0xdc'),_0x503be1),_0x26841e[_0x1a0d('0x63')],_0x26841e[_0x1a0d('0xdd')],_0x26841e[_0x1a0d('0x61')]]);if(_0x5ed88f[_0x1a0d('0x9f')]===-0x1){return _0x5ed88f;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0xde'),_0x1a0d('0xdb')));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0xdf')]=function(_0x3a0c93){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0xe0'),_0x3a0c93['label']));if(!this[_0x1a0d('0x82')](_0x3a0c93[_0x1a0d('0x80')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0xe1'));}if(!this['isConfigured'](_0x3a0c93[_0x1a0d('0x59')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0xbd'));}this[_0x1a0d('0x38')][_0x1a0d('0xe2')]=!![];this[_0x1a0d('0x37')](_0x3a0c93);this[_0x1a0d('0xe3')](_0x3a0c93[_0x1a0d('0x59')],'in','','');this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x3a0c93[_0x1a0d('0x59')]));var _0x366a9e=this[_0x1a0d('0x76')][_0x1a0d('0x6c')](this,_0x3a0c93);if(_0x366a9e){for(var _0x3d2f86 in _0x366a9e){if(_0x366a9e[_0x1a0d('0x91')](_0x3d2f86)){this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util[_0x1a0d('0x2a')](_0x1a0d('0xe4'),_0x3d2f86['toUpperCase']()),_0x366a9e[_0x3d2f86]);}}this[_0x1a0d('0xe3')](_0x366a9e['speech'],_0x1a0d('0xe5'),_0x1a0d('0xdf'),'');return this['channel']['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0xe6'),_0x366a9e[_0x1a0d('0xe7')]));}return this[_0x1a0d('0x38')]['error'](_0x3a0c93,_0x1a0d('0xe8'));};AGIVertices['prototype'][_0x1a0d('0xe9')]=function(_0x203c29){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x203c29[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x203c29[_0x1a0d('0x79')])){return this[_0x1a0d('0x38')]['noop'](_0x1a0d('0xea'));}if(!this[_0x1a0d('0x82')](_0x203c29[_0x1a0d('0xeb')])){return this[_0x1a0d('0x38')]['noop'](_0x1a0d('0xec'));}if(!this[_0x1a0d('0x82')](_0x203c29[_0x1a0d('0xed')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xee'));}if(!this[_0x1a0d('0x82')](_0x203c29['dialogflowV2_language'])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0xef'));}if(!this[_0x1a0d('0x82')](_0x203c29[_0x1a0d('0x59')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xbd'));}this['channel']['bot']=!![];this[_0x1a0d('0x37')](_0x203c29);this['createSquareMessage'](_0x203c29[_0x1a0d('0x59')],'in','','');this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x203c29[_0x1a0d('0x59')]));var _0x1e4d12=this['googleDialogflowV2']['sync'](this,_0x203c29);if(_0x1e4d12){for(var _0x585ab3 in _0x1e4d12){if(_0x1e4d12['hasOwnProperty'](_0x585ab3)){if(_0x585ab3!==_0x1a0d('0xf0')){this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util['format'](_0x1a0d('0xe4'),_0x585ab3[_0x1a0d('0x67')]()),_0x1e4d12[_0x585ab3]);}}}this['createSquareMessage'](_0x1e4d12[_0x1a0d('0xe7')],_0x1a0d('0xe5'),_0x1a0d('0xe9'),_0x1e4d12[_0x1a0d('0xf0')]);return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format'](_0x1a0d('0xf1'),_0x1e4d12[_0x1a0d('0xe7')]));}return this['channel'][_0x1a0d('0x2e')](_0x203c29,_0x1a0d('0xf2'));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0xf3')]=function(_0x5705e8){logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0xf4'),_0x5705e8[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x5705e8[_0x1a0d('0xf5')])){return this[_0x1a0d('0x38')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x1a0d('0x82')](_0x5705e8[_0x1a0d('0xf6')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0xf7'));}if(!this['isConfigured'](_0x5705e8['password'])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xf8'));}if(!this[_0x1a0d('0x82')](_0x5705e8['ndassistant_url'])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xbd'));}this[_0x1a0d('0x38')]['bot']=!![];this[_0x1a0d('0x37')](_0x5705e8);this['createSquareMessage'](_0x5705e8[_0x1a0d('0x59')],'in','','');this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0xf9'),_0x5705e8[_0x1a0d('0x59')]));var _0x305d4a=this['sestekNDA'][_0x1a0d('0x6c')](this,_0x5705e8);if(_0x305d4a){for(var _0x5a3993 in _0x305d4a){if(_0x305d4a[_0x1a0d('0x91')](_0x5a3993)){this['channel'][_0x1a0d('0x9a')](util['format']('SESTEK_NDA_%s',_0x5a3993[_0x1a0d('0x67')]()),_0x305d4a[_0x5a3993]);}}this['createSquareMessage'](_0x305d4a[_0x1a0d('0xe7')],_0x1a0d('0xe5'),'sesteknda','');if(_0x305d4a[_0x1a0d('0xfa')]){this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x305d4a[_0x1a0d('0xfa')]));var _0x2d28e9=this[_0x1a0d('0x38')][_0x1a0d('0xfb')](_0x305d4a[_0x1a0d('0xfa')]);try{fs[_0x1a0d('0xfc')](_0x305d4a[_0x1a0d('0xfa')]+_0x1a0d('0xfd'));}catch(_0x2e2cf1){logger[_0x1a0d('0x2e')](_0x2e2cf1);}return _0x2d28e9;}else{return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0xfe'),_0x305d4a[_0x1a0d('0xe7')]));}}return this['channel'][_0x1a0d('0x2e')](_0x5705e8,_0x1a0d('0xff'));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x100')]=function(_0x5aa7ce){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x5aa7ce[_0x1a0d('0xa6')]));return this[_0x1a0d('0x38')]['noop']('end');};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x101')]=function(_0x2c5e9b){logger['info'](util[_0x1a0d('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2c5e9b['label']));var _0x405a36='';if(_0x2c5e9b[_0x1a0d('0x102')]){if(!this['isConfigured'](_0x2c5e9b['trunk_id'])){return this[_0x1a0d('0x38')]['error'](_0x2c5e9b,'no\x20trunk\x20selected');}else{var _0x6e0e25=parseInt(_0x2c5e9b[_0x1a0d('0x102')],0xa);if(isNaN(_0x6e0e25)){_0x405a36=_0x2c5e9b['trunk_id'];}else{_0x405a36=this[_0x1a0d('0x1d')]['sync'](this,_0x2c5e9b[_0x1a0d('0x102')]);if(!_0x405a36){return this['channel'][_0x1a0d('0x2e')](_0x2c5e9b,_0x1a0d('0x103'));}}}}else if(_0x2c5e9b[_0x1a0d('0x104')]){_0x405a36=_0x2c5e9b['trunk_name'];}else{return this[_0x1a0d('0x38')]['error'](_0x2c5e9b,'no\x20trunk\x20selected');}var _0x48aeec=this[_0x1a0d('0x38')][_0x1a0d('0x53')](_0x1a0d('0xdb'),[util['format'](_0x1a0d('0x105'),_0x405a36,_0x2c5e9b[_0x1a0d('0xba')]),_0x2c5e9b[_0x1a0d('0x63')],_0x2c5e9b['opts'],_0x2c5e9b['url']]);if(_0x48aeec['result']===-0x1){return _0x48aeec;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0xde'),_0x1a0d('0xdb')));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x106')]=function(_0x3d77ea){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3d77ea[_0x1a0d('0xa6')]));return this['channel'][_0x1a0d('0xa8')]('finally');};AGIVertices['prototype'][_0x1a0d('0x107')]=function(_0x3dca6b){logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0x108'),_0x3dca6b[_0x1a0d('0xa6')]));if(_0x3dca6b[_0x1a0d('0xa1')]===0x0){return this['maxRetry'](_0x3dca6b);}_0x3dca6b[_0x1a0d('0xa1')]-=0x1;if(!this[_0x1a0d('0x82')](_0x3dca6b[_0x1a0d('0x109')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x3dca6b,_0x1a0d('0x10a'));}var _0x264b9c=this[_0x1a0d('0x10b')][_0x1a0d('0x6c')](this,_0x3dca6b['file_id']);if(!_0x264b9c){return this[_0x1a0d('0x38')]['error'](_0x3dca6b,_0x1a0d('0x10c'));}if(!this[_0x1a0d('0x82')](_0x3dca6b[_0x1a0d('0xd0')])){return this['channel']['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x21923=this['channel'][_0x1a0d('0x10d')](_0x264b9c,_0x3dca6b[_0x1a0d('0x10e')],_0x3dca6b[_0x1a0d('0x10f')]);var _0xe1fc32=_0x21923[_0x1a0d('0x9f')]?_0x21923[_0x1a0d('0x9f')][_0x1a0d('0x48')]():'';logger['info'](_0x1a0d('0x110'),JSON['stringify'](_0x21923));if(_0x21923['result']===-0x1){this[_0x1a0d('0x37')]['sync'](this,_0x3dca6b,_0xe1fc32);return _0x21923;}else if(_0x21923['extra']===_0x1a0d('0x63')){_0x21923['result']=_0xe1fc32[_0x1a0d('0x94')]>=parseInt(_0x3dca6b[_0x1a0d('0x111')])?'x':'i';}else{_0x21923[_0x1a0d('0x9f')]=_0xe1fc32[_0x1a0d('0x94')]>=parseInt(_0x3dca6b[_0x1a0d('0x111')])&&_0xe1fc32[_0x1a0d('0x94')]<=parseInt(_0x3dca6b[_0x1a0d('0x10f')])?'x':'i';}var _0x147fa8=this[_0x1a0d('0xf')][_0x1a0d('0x6c')](this,_0x3dca6b[_0x1a0d('0xd0')]);if(!_0x147fa8){return this[_0x1a0d('0x38')]['error'](_0x3dca6b,_0x1a0d('0xd2'));}this[_0x1a0d('0x38')][_0x1a0d('0x9a')](_0x147fa8,_0xe1fc32);if(this[_0x1a0d('0x82')](_0x3dca6b[_0x1a0d('0x112')])){var _0x5a399e=parseInt(_0x3dca6b[_0x1a0d('0x112')],0xa);var _0x101ffa=rs['generate']({'charset':'*','length':_0x5a399e});var _0x57b2d6=_0xe1fc32[_0x1a0d('0x94')];if(_0x57b2d6>0x0){if(_0x57b2d6>_0x5a399e){this['createSquareDetailsReport'][_0x1a0d('0x6c')](this,_0x3dca6b,_0x3dca6b[_0x1a0d('0x113')]===_0x1a0d('0x114')?_0x101ffa+_0xe1fc32['substr'](_0x5a399e):_0xe1fc32[_0x1a0d('0x115')](0x0,_0x57b2d6-_0x5a399e)+_0x101ffa);}else{this['createSquareDetailsReport']['sync'](this,_0x3dca6b,rs['generate']({'charset':'*','length':_0x57b2d6}));}}else{this['createSquareDetailsReport']['sync'](this,_0x3dca6b,'');}}else{this[_0x1a0d('0x37')][_0x1a0d('0x6c')](this,_0x3dca6b,_0xe1fc32);}return _0x21923;};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x116')]=function(_0x4604cb){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x117'),_0x4604cb[_0x1a0d('0xa6')]));return this[_0x1a0d('0x107')](_0x4604cb);};AGIVertices['prototype']['goal']=function(_0x1bb081){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x118'),_0x1bb081[_0x1a0d('0xa6')]));this[_0x1a0d('0x37')][_0x1a0d('0x6c')](this,_0x1bb081,_0x1bb081['goalname']);return this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0x119'),_0x1bb081['goalname']));};AGIVertices['prototype']['awspolly']=function(_0xc6a7a0){logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0x11a'),_0xc6a7a0[_0x1a0d('0xa6')]));if(!this['isConfigured'](_0xc6a7a0[_0x1a0d('0x85')])||!this[_0x1a0d('0x82')](_0xc6a7a0[_0x1a0d('0x86')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xc6a7a0[_0x1a0d('0x59')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0xbd'));}this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format'](_0x1a0d('0x11b'),_0xc6a7a0['text']));var _0x420791=this[_0x1a0d('0x84')][_0x1a0d('0x6c')](this,_0xc6a7a0);if(_0x420791){this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x11c'),_0x420791));var _0x4572ca=this[_0x1a0d('0x38')][_0x1a0d('0xfb')](_0x420791);try{fs['unlink'](_0x420791+'.wav');}catch(_0x482219){logger[_0x1a0d('0x2e')](_0x482219);}return _0x4572ca;}return this['channel'][_0x1a0d('0x2e')](_0xc6a7a0,_0x1a0d('0x11d'));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x11e')]=function(_0x40d6e2){logger['info'](util[_0x1a0d('0x2a')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x40d6e2[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x40d6e2['aws_access_key_id'])||!this[_0x1a0d('0x82')](_0x40d6e2[_0x1a0d('0x86')])){return this[_0x1a0d('0x38')]['noop'](_0x1a0d('0x11f'));}if(!this[_0x1a0d('0x82')](_0x40d6e2[_0x1a0d('0x8b')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')]('no\x20bot\x20name\x20configured');}if(!this[_0x1a0d('0x82')](_0x40d6e2[_0x1a0d('0x59')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xbd'));}this[_0x1a0d('0x38')][_0x1a0d('0xe2')]=!![];this[_0x1a0d('0x37')](_0x40d6e2);this['createSquareMessage'](_0x40d6e2[_0x1a0d('0x59')],'in','','');this[_0x1a0d('0x38')]['noop'](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x40d6e2['text']));var _0x5ab72e=this[_0x1a0d('0x8a')][_0x1a0d('0x6c')](this,_0x40d6e2);if(_0x5ab72e){for(var _0x42dfcf in _0x5ab72e){if(_0x5ab72e[_0x1a0d('0x91')](_0x42dfcf)&&_['isString'](_0x5ab72e[_0x42dfcf])){this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util[_0x1a0d('0x2a')]('AWS_LEX_%s',_0x42dfcf['toUpperCase']()),_0x5ab72e[_0x42dfcf]);}}if(_[_0x1a0d('0x43')](_0x5ab72e[_0x1a0d('0x73')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0x120'));}else{this[_0x1a0d('0xe3')](_0x5ab72e[_0x1a0d('0x73')],_0x1a0d('0xe5'),_0x1a0d('0x121'),'');return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('Amazon\x20Lex\x20Result\x20%s',_0x5ab72e[_0x1a0d('0x73')]));}}return this[_0x1a0d('0x38')]['error'](_0x40d6e2,_0x1a0d('0x122'));};AGIVertices['prototype']['googleasr']=function(_0x1e1b25){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x123'),_0x1e1b25[_0x1a0d('0xa6')],_0x1e1b25[_0x1a0d('0x63')]));if(!this[_0x1a0d('0x82')](_0x1e1b25[_0x1a0d('0x80')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xe1'));}var _0x19247d=_0x1a0d('0x124');var _0x56f00b=util[_0x1a0d('0x2a')](_0x1a0d('0x125'),FILES_PATH,rs[_0x1a0d('0x126')](0x4));var _0x4a0fe5=util[_0x1a0d('0x2a')]('%s.%s',_0x56f00b,_0x19247d);var _0x132b5f=!![];if(_0x1e1b25[_0x1a0d('0x127')]==='NOBEEP'){_0x132b5f=![];}var _0x1dce6b=this[_0x1a0d('0x38')][_0x1a0d('0x128')](_0x56f00b,_0x19247d,_0x1e1b25['intKey'],_0x1e1b25[_0x1a0d('0x63')],undefined,_0x132b5f);if(_0x1dce6b[_0x1a0d('0x9f')]!==-0x1){this['channel']['noop'](util['format'](_0x1a0d('0x129'),_0x4a0fe5));var _0x128a7a=this[_0x1a0d('0x8c')][_0x1a0d('0x6c')](this,_0x1e1b25,_0x4a0fe5);if(_0x128a7a){for(var _0x5d22a3 in _0x128a7a){if(_0x128a7a[_0x1a0d('0x91')](_0x5d22a3)){this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util[_0x1a0d('0x2a')](_0x1a0d('0x12a'),_0x5d22a3['toUpperCase']()),_0x128a7a[_0x5d22a3]);}}return this['channel'][_0x1a0d('0xa8')](util['format'](_0x1a0d('0x12b'),JSON[_0x1a0d('0x6f')](_0x128a7a)));}}return _0x1dce6b;};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x12c')]=function(_0x2a9182){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x12d'),_0x2a9182[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x2a9182[_0x1a0d('0x12e')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0x12f'));}if(!this['isConfigured'](_0x2a9182['appsecret'])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')]('no\x20appsecret\x20configured');}var _0x1b50bd=_0x1a0d('0x124');var _0xd78041=util[_0x1a0d('0x2a')](_0x1a0d('0x125'),FILES_PATH,rs['generate'](0x4));var _0x219fd6=util[_0x1a0d('0x2a')](_0x1a0d('0x9b'),_0xd78041,_0x1b50bd);var _0x32a804=!![];if(_0x2a9182[_0x1a0d('0x127')]===_0x1a0d('0x130')){_0x32a804=![];}var _0x149793=this[_0x1a0d('0x38')][_0x1a0d('0x128')](_0xd78041,_0x1b50bd,_0x2a9182[_0x1a0d('0x131')],_0x2a9182[_0x1a0d('0x63')],undefined,_0x32a804);if(_0x149793[_0x1a0d('0x9f')]!==-0x1){this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('tilde\x20%s\x20file\x20created',_0x219fd6));var _0x1949ee=this[_0x1a0d('0x8e')][_0x1a0d('0x6c')](this,_0x2a9182,_0x219fd6);if(_0x1949ee){for(var _0x3f673f in _0x1949ee){if(_0x1949ee['hasOwnProperty'](_0x3f673f)){this['channel'][_0x1a0d('0x9a')](util['format'](_0x1a0d('0x132'),_0x3f673f[_0x1a0d('0x67')]()),_0x1949ee[_0x3f673f]);}}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x133'),JSON['stringify'](_0x1949ee)));}}return _0x149793;};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x134')]=function(_0x33f64e){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x135'),_0x33f64e[_0x1a0d('0xa6')]));return this[_0x1a0d('0x38')][_0x1a0d('0x136')](_0x33f64e[_0x1a0d('0x137')],_0x33f64e[_0x1a0d('0x138')],_0x33f64e[_0x1a0d('0x3d')]);};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x139')]=function(_0x66500b){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x13a'),_0x66500b[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x66500b[_0x1a0d('0x13b')])){return this['channel'][_0x1a0d('0x2e')](_0x66500b,'no\x20condition\x20configured');}try{var _0x2e803f=eval(_0x66500b[_0x1a0d('0x13b')])?_0x1a0d('0x13c'):_0x1a0d('0x13d');this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format'](_0x1a0d('0x13e'),_0x66500b[_0x1a0d('0x13b')],_0x2e803f));return{'code':0xc8,'result':_0x2e803f};}catch(_0x5c6121){return{'code':0xc8,'result':_0x1a0d('0x13d')};}};AGIVertices['prototype']['gotoiftime']=function(_0x2e645a){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x13f'),_0x2e645a[_0x1a0d('0xa6')]));if(!this['isConfigured'](_0x2e645a[_0x1a0d('0x140')])){return this['channel'][_0x1a0d('0x2e')](_0x2e645a,_0x1a0d('0x141'));}var _0x5b5c2a=this['getIntervals'][_0x1a0d('0x6c')](this,_0x2e645a['interval_id']);if(!_0x5b5c2a){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x2e645a,_0x1a0d('0x142'));}for(var _0xd4c034=0x0;_0xd4c034<_0x5b5c2a['length'];_0xd4c034+=0x1){var _0x2398ef=this[_0x1a0d('0x38')][_0x1a0d('0xf')](util['format']('IFTIME(%s?true:false)',_0x5b5c2a[_0xd4c034]));if(_0x2398ef[_0x1a0d('0x9f')]===-0x1){return _0x2398ef;}logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x143'),_0x5b5c2a[_0xd4c034],_0x2398ef[_0x1a0d('0x144')]));if(_0x2398ef['extra']===_0x1a0d('0x13c')){logger['info'](util['format'](_0x1a0d('0x143'),_0x5b5c2a[_0xd4c034],'true'));this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x143'),_0x5b5c2a[_0xd4c034],_0x1a0d('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0x1a0d('0x30')](util['format']('IFTIME\x20%s\x20%s',_0x5b5c2a[_0xd4c034],_0x1a0d('0x13d')));this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format'](_0x1a0d('0x143'),_0x5b5c2a[_0xd4c034],_0x1a0d('0x13d')));}}return{'code':0xc8,'result':_0x1a0d('0x13d')};};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x145')]=function(_0x51774f){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x146'),_0x51774f['label']));return this[_0x1a0d('0x38')][_0x1a0d('0x145')]();};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x147')]=function(_0x38ed38){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x148'),_0x38ed38['label']));if(!this[_0x1a0d('0x82')](_0x38ed38[_0x1a0d('0x80')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xe1'));}var _0x565eb9=_0x1a0d('0x124');var _0x446476=util[_0x1a0d('0x2a')](_0x1a0d('0x125'),FILES_PATH,rs['generate'](0x4));var _0x51a69f=util[_0x1a0d('0x2a')](_0x1a0d('0x9b'),_0x446476,_0x565eb9);var _0x112210=!![];if(_0x38ed38[_0x1a0d('0x127')]===_0x1a0d('0x130')){_0x112210=![];}var _0x41100d=this['channel'][_0x1a0d('0x128')](_0x446476,_0x565eb9,_0x38ed38['intKey'],_0x38ed38[_0x1a0d('0x63')],undefined,_0x112210);if(_0x41100d[_0x1a0d('0x9f')]!==-0x1){this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x149'),_0x51a69f));var _0x1bb3da=this['ispeechASR'][_0x1a0d('0x6c')](this,_0x38ed38,_0x51a69f);if(_0x1bb3da){for(var _0x4510c3 in _0x1bb3da){if(_0x1bb3da[_0x1a0d('0x91')](_0x4510c3)){this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util[_0x1a0d('0x2a')](_0x1a0d('0x14a'),_0x4510c3[_0x1a0d('0x67')]()),_0x1bb3da[_0x4510c3]);}}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x14b'),JSON[_0x1a0d('0x6f')](_0x1bb3da)));}}return _0x41100d;};AGIVertices[_0x1a0d('0xe')]['ispeechtts']=function(_0xe4116e){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x14c'),_0xe4116e[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0xe4116e[_0x1a0d('0x80')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xe1'));}if(!this[_0x1a0d('0x82')](_0xe4116e[_0x1a0d('0x59')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xbd'));}this['channel'][_0x1a0d('0xa8')](util['format'](_0x1a0d('0x14d'),_0xe4116e[_0x1a0d('0x59')]));var _0x11db73=this[_0x1a0d('0x7b')][_0x1a0d('0x6c')](this,_0xe4116e);if(_0x11db73){this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0x149'),_0x11db73));var _0x18ccd2=this[_0x1a0d('0x38')][_0x1a0d('0xfb')](_0x11db73,_0xe4116e['intKey']);try{fs[_0x1a0d('0xfc')](_0x11db73+_0x1a0d('0xfd'));}catch(_0x906d47){logger[_0x1a0d('0x2e')](_0x906d47);}return _0x18ccd2;}return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0xe4116e,_0x1a0d('0x14e'));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x14f')]=function(_0x23be56){logger[_0x1a0d('0x30')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x23be56[_0x1a0d('0xa6')]));if(!this['isConfigured'](_0x23be56[_0x1a0d('0x150')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x23be56,_0x1a0d('0x151'));}logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x23be56['findBy']));var _0x480573=this[_0x1a0d('0x4f')][_0x1a0d('0x6c')](this,_0x23be56[_0x1a0d('0x150')]);if(_0x480573){logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0x152'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x23be56[_0x1a0d('0x150')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x23be56[_0x1a0d('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x153'),this['channel'][_0x1a0d('0x3b')],_0x23be56[_0x1a0d('0x150')]));this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0x153'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x23be56[_0x1a0d('0x150')]));return{'code':0xc8,'result':_0x1a0d('0x154')};}};AGIVertices[_0x1a0d('0xe')]['logout']=function(_0x1e0432){logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0x155'),_0x1e0432[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x1e0432['findBy'])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x1e0432,_0x1a0d('0x151'));}logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x156'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x1e0432['findBy']));var _0x5233ab=this[_0x1a0d('0x4e')][_0x1a0d('0x6c')](this,_0x1e0432['findBy']);if(_0x5233ab){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x152'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x1e0432[_0x1a0d('0x150')]));this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x152'),this['channel'][_0x1a0d('0x3b')],_0x1e0432[_0x1a0d('0x150')]));return{'code':0xc8,'result':_0x1a0d('0x157')};}else{logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x153'),this['channel']['callerid'],_0x1e0432[_0x1a0d('0x150')]));this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x153'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x1e0432[_0x1a0d('0x150')]));return{'code':0xc8,'result':_0x1a0d('0x154')};}};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x158')]=function(_0x43c12c){logger['info'](util[_0x1a0d('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x43c12c['label']));if(!this[_0x1a0d('0x82')](_0x43c12c[_0x1a0d('0x159')])){return this['channel'][_0x1a0d('0x2e')](_0x43c12c,_0x1a0d('0x15a'));}this['channel'][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x15b'),_0x43c12c['operation']));var _0x168db3=eval(_0x43c12c[_0x1a0d('0x159')]);if(!this[_0x1a0d('0x82')](_0x43c12c['variable_id'])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0xd1'));}var _0x2b336c=this[_0x1a0d('0xf')][_0x1a0d('0x6c')](this,_0x43c12c['variable_id']);if(!_0x2b336c){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x43c12c,_0x1a0d('0xd2'));}if(_[_0x1a0d('0x99')](_0x168db3)){var _0x42c8fb=this;_0x168db3[_0x1a0d('0xd3')](function(_0x225298,_0x1f7245){_0x42c8fb[_0x1a0d('0x38')][_0x1a0d('0x9a')](util[_0x1a0d('0x2a')](_0x1a0d('0x15c'),_0x2b336c,_0x1f7245),_0x225298);});return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('variable\x20%s[key]\x20set',_0x2b336c));}else{return this[_0x1a0d('0x38')][_0x1a0d('0x9a')](_0x2b336c,_0x168db3);}};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0xc')]=function(_0x60030){logger['info'](util['format'](_0x1a0d('0x15d'),_0x60030[_0x1a0d('0xa6')]));if(_0x60030['retry']===0x0){return this[_0x1a0d('0xa2')](_0x60030);}_0x60030[_0x1a0d('0xa1')]-=0x1;if(!this[_0x1a0d('0x82')](_0x60030[_0x1a0d('0x109')])){return this[_0x1a0d('0x38')]['error'](_0x60030,_0x1a0d('0x10a'));}var _0x2b5dd6=this['getSound'][_0x1a0d('0x6c')](this,_0x60030['file_id']);if(!_0x2b5dd6){return this[_0x1a0d('0x38')]['error'](_0x60030,_0x1a0d('0x10c'));}var _0x158c65=this[_0x1a0d('0x38')][_0x1a0d('0x10d')](_0x2b5dd6,_0x60030[_0x1a0d('0x10e')],_0x60030['digit']);var _0x1f4b58=_0x158c65['result'];if(_0x158c65[_0x1a0d('0x9f')]===-0x1){this[_0x1a0d('0x37')][_0x1a0d('0x6c')](this,_0x60030,'-1');return _0x158c65;}else if(_0x158c65['extra']===_0x1a0d('0x63')){_0x158c65[_0x1a0d('0x9f')]=_0x158c65[_0x1a0d('0x9f')]['length']>0x0?_0x158c65[_0x1a0d('0x9f')]:'t';}else if(_[_0x1a0d('0x97')](_0x158c65[_0x1a0d('0x9f')])){_0x158c65[_0x1a0d('0x9f')]='#';_0x1f4b58='#';}if(!this[_0x1a0d('0x82')](_0x60030[_0x1a0d('0xd0')])){this[_0x1a0d('0x38')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x379a38=this[_0x1a0d('0xf')][_0x1a0d('0x6c')](this,_0x60030[_0x1a0d('0xd0')]);if(!_0x379a38){return this[_0x1a0d('0x38')]['error'](_0x60030,'no\x20variable\x20found');}this[_0x1a0d('0x38')]['setVariable'](_0x379a38,_0x1f4b58);}this[_0x1a0d('0x37')][_0x1a0d('0x6c')](this,_0x60030,_0x1f4b58);return _0x158c65;};AGIVertices['prototype']['noop']=function(_0x37a078){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x15e'),_0x37a078[_0x1a0d('0xa6')]));return this[_0x1a0d('0x38')]['noop'](_0x37a078[_0x1a0d('0x15f')]||_0x37a078[_0x1a0d('0xa6')]);};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x160')]=function(_0x372f4d){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x161'),_0x372f4d[_0x1a0d('0xa6')]));if(!this['isConfigured'](_0x372f4d[_0x1a0d('0x150')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x372f4d,_0x1a0d('0x151'));}logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0x156'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x372f4d[_0x1a0d('0x150')]));var _0x5a1edc=this[_0x1a0d('0x162')][_0x1a0d('0x6c')](this,_0x372f4d[_0x1a0d('0x163')]);var _0x100720=this[_0x1a0d('0x4b')][_0x1a0d('0x6c')](this,_0x372f4d[_0x1a0d('0x150')],_0x5a1edc);if(_0x100720){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x152'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x372f4d['findBy']));this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x372f4d[_0x1a0d('0x150')]));return{'code':0xc8,'result':_0x1a0d('0x157')};}else{logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0x153'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x372f4d['findBy']));this[_0x1a0d('0x38')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x1a0d('0x38')]['callerid'],_0x372f4d[_0x1a0d('0x150')]));return{'code':0xc8,'result':_0x1a0d('0x154')};}};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x164')]=function(_0xa646ad){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x165'),_0xa646ad['label']));if(!this[_0x1a0d('0x82')](_0xa646ad[_0x1a0d('0x109')])){return this['channel'][_0x1a0d('0x2e')](_0xa646ad,'no\x20file\x20audio\x20selected');}var _0x23e663=this[_0x1a0d('0x10b')][_0x1a0d('0x6c')](this,_0xa646ad[_0x1a0d('0x109')]);if(!_0x23e663){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0xa646ad,_0x1a0d('0x10c'));}var _0x8c3ae5=this['channel'][_0x1a0d('0x53')](_0x1a0d('0x166'),[_0x23e663,_0xa646ad[_0x1a0d('0xdd')]]);if(_0x8c3ae5[_0x1a0d('0x9f')]===-0x1){return _0x8c3ae5;}return this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0x167'),'PLAYBACK',_0x23e663));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x168')]=function(_0x4e1c50){logger[_0x1a0d('0x30')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4e1c50[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x4e1c50[_0x1a0d('0x169')])){return this['channel'][_0x1a0d('0x2e')](_0x4e1c50,_0x1a0d('0x16a'));}var _0x511749='';var _0x4a7f85=parseInt(_0x4e1c50[_0x1a0d('0x169')],0xa);if(isNaN(_0x4a7f85)){_0x511749=_0x4e1c50[_0x1a0d('0x169')];}else{_0x511749=this[_0x1a0d('0x14')][_0x1a0d('0x6c')](this,_0x4e1c50[_0x1a0d('0x169')]);if(!_0x511749){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x4e1c50,_0x1a0d('0x16b'));}}var _0x18c92c='';if(this['isConfigured'](_0x4e1c50['file_id'])){var _0x4fd4e4=this[_0x1a0d('0x10b')][_0x1a0d('0x6c')](this,_0x4e1c50[_0x1a0d('0x109')]);if(_0x4fd4e4){_0x18c92c=_0x4fd4e4;}}this[_0x1a0d('0x37')][_0x1a0d('0x6c')](this,_0x4e1c50,_0x511749);if(_0x4e1c50[_0x1a0d('0xdd')][_0x1a0d('0x16c')]('x')<0x0){_0x4e1c50['opts']+='x';}if(_0x4e1c50[_0x1a0d('0xdd')][_0x1a0d('0x16c')]('X')<0x0){_0x4e1c50[_0x1a0d('0xdd')]+='X';}this['channel'][_0x1a0d('0x9a')](_0x1a0d('0x16d'),_0x511749?_0x511749[_0x1a0d('0x16e')]():'');var _0x208c89=this['channel'][_0x1a0d('0x53')]('QUEUE',[_0x511749,_0x4e1c50['opts'],_0x4e1c50[_0x1a0d('0x61')],_0x18c92c,_0x4e1c50[_0x1a0d('0x63')],_0x4e1c50['agi'],_0x4e1c50['macro'],_0x4e1c50[_0x1a0d('0x16f')],'',_0x4e1c50[_0x1a0d('0x170')]]);if(_0x208c89[_0x1a0d('0x9f')]===-0x1){return _0x208c89;}return this['channel']['noop'](util['format'](_0x1a0d('0x167'),_0x1a0d('0x171'),_0x511749));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x172')]=function(_0x3addb2){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3addb2[_0x1a0d('0xa6')]));var _0x1c57ad=_0x3addb2[_0x1a0d('0x173')]||_0x1a0d('0x124');var _0x48c8b6=util[_0x1a0d('0x2a')](_0x1a0d('0x174'),this['channel'][_0x1a0d('0x39')],rs[_0x1a0d('0x126')](0x5));var _0x1b735d=util['format'](_0x1a0d('0x175'),FILES_PATH,_0x48c8b6,_0x1c57ad);var _0x443ceb=util[_0x1a0d('0x2a')](_0x1a0d('0x125'),FILES_PATH,_0x48c8b6);this[_0x1a0d('0x3c')][_0x1a0d('0x6c')](this,_0x3addb2,_0x48c8b6,_0x1b735d);this[_0x1a0d('0x38')][_0x1a0d('0x9a')](_0x1a0d('0x176'),_0x48c8b6);logger[_0x1a0d('0x30')](_0x1a0d('0x177'),_0x443ceb,_0x1c57ad,_0x3addb2[_0x1a0d('0x178')],_0x3addb2['timeout']);return this[_0x1a0d('0x38')]['recordFile'](_0x443ceb,_0x1c57ad,_0x3addb2[_0x1a0d('0x178')],_0x3addb2[_0x1a0d('0x63')],undefined,!![]);};AGIVertices[_0x1a0d('0xe')]['restapi']=function(_0x2913f1){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x179'),_0x2913f1[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x2913f1[_0x1a0d('0x61')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0x17a'));}var _0x45dbe4=this[_0x1a0d('0x60')]['sync'](this,_0x2913f1);logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x17b'),util[_0x1a0d('0x17c')](_0x45dbe4,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2913f1[_0x1a0d('0xd0')])){return this['channel']['noop'](_0x1a0d('0x17d'));}var _0x51febd=this[_0x1a0d('0xf')][_0x1a0d('0x6c')](this,_0x2913f1['variable_id']);if(!_0x51febd){return this[_0x1a0d('0x38')]['error'](_0x2913f1,_0x1a0d('0xd2'));}this[_0x1a0d('0x38')][_0x1a0d('0x9a')](util[_0x1a0d('0x2a')](_0x1a0d('0x17e'),_0x51febd),_0x45dbe4[_0x1a0d('0x71')]?_0x45dbe4[_0x1a0d('0x71')]:_0x1a0d('0x17f'));this[_0x1a0d('0x38')]['setVariable'](util[_0x1a0d('0x2a')]('%s_STATUS_MESSAGE',_0x51febd),_0x45dbe4[_0x1a0d('0x72')]?_0x45dbe4[_0x1a0d('0x72')]:'OK');if(_0x45dbe4[_0x1a0d('0x68')]){try{this[_0x1a0d('0x98')](_0x45dbe4[_0x1a0d('0x68')],_0x51febd);}catch(_0x1c4eb4){logger[_0x1a0d('0x2e')](util[_0x1a0d('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x51febd));}}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('variable\x20%s\x20set',_0x51febd));};AGIVertices['prototype'][_0x1a0d('0x180')]=function(_0x1e11d7){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x181'),_0x1e11d7['label']));return this[_0x1a0d('0x38')]['sayDigits'](_0x1e11d7[_0x1a0d('0x182')]['replace'](/\s+/g,''),_0x1e11d7[_0x1a0d('0x178')]);};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x183')]=function(_0x1873a5){logger[_0x1a0d('0x30')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1873a5[_0x1a0d('0xa6')]));return this[_0x1a0d('0x38')]['sayNumber'](_0x1873a5['number'][_0x1a0d('0x55')](/\s+/g,''),_0x1873a5[_0x1a0d('0x178')]);};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x184')]=function(_0x12b85f){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x12b85f[_0x1a0d('0xa6')]));return this[_0x1a0d('0x38')][_0x1a0d('0x185')](_0x12b85f[_0x1a0d('0x59')],_0x12b85f[_0x1a0d('0x178')]);};AGIVertices[_0x1a0d('0xe')]['sendMail']=function(_0x3f2294){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x186'),_0x3f2294['label']));if(!this[_0x1a0d('0x82')](_0x3f2294[_0x1a0d('0x187')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0x188'));}var _0x1834bc=this[_0x1a0d('0x189')][_0x1a0d('0x6c')](this,_0x3f2294[_0x1a0d('0x187')]);if(!_0x1834bc||!_0x1834bc[_0x1a0d('0x18a')]){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x3f2294,'no\x20mail\x20account\x20found');}var _0xc43b94={'from':util[_0x1a0d('0x2a')]('\x22%s\x22\x20<%s>',_0x1834bc[_0x1a0d('0x12')],_0x1834bc[_0x1a0d('0x18b')]||_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x18c')]),'to':_0x3f2294['to']||'','cc':_0x3f2294['cc']||'','bcc':_0x3f2294['bcc']||'','subject':_0x3f2294[_0x1a0d('0x18d')],'html':_0x3f2294['text'],'text':_0x3f2294[_0x1a0d('0x59')]};var _0x378bd8={'tls':{'rejectUnauthorized':![]}};if(_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x18e')]){_0x378bd8['service']=_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x18e')];}else{_0x378bd8[_0x1a0d('0x18f')]=_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x18f')];_0x378bd8['port']=_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x190')];_0x378bd8['secure']=_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x191')];}if(_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x192')]){_0x378bd8[_0x1a0d('0x193')]={'user':_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x18c')],'pass':_0x1834bc[_0x1a0d('0x18a')][_0x1a0d('0x194')]};}if(this[_0x1a0d('0x82')](_0x3f2294[_0x1a0d('0x195')])){}logger[_0x1a0d('0xd7')](_0x1a0d('0x196'),JSON['stringify'](_0xc43b94));this[_0x1a0d('0x37')]['sync'](this,_0x3f2294,_0x3f2294[_0x1a0d('0x187')]);this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x197'),_0x1834bc[_0x1a0d('0x12')]));this[_0x1a0d('0x23')][_0x1a0d('0x6c')](this,_0x378bd8,_0xc43b94);return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0x198'));};AGIVertices[_0x1a0d('0xe')]['sendFax']=function(_0x1d95b9){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x199'),_0x1d95b9['label']));return this[_0x1a0d('0x38')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x1a0d('0x19a')]=function(_0x1ef073){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x19b'),_0x1ef073[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x1ef073[_0x1a0d('0x19c')])){return this['channel'][_0x1a0d('0xa8')](_0x1a0d('0x19d'));}var _0x345cf2=this['getSmsAccount'][_0x1a0d('0x6c')](this,_0x1ef073[_0x1a0d('0x19c')]);if(!_0x345cf2){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x1ef073,'no\x20sms\x20account\x20found');}var _0x41a7cf={'body':_0x1ef073[_0x1a0d('0x19e')],'phone':_0x1ef073['to']||'','SmsAccountId':_0x345cf2['id']};logger['debug'](_0x1a0d('0x19f'),JSON[_0x1a0d('0x6f')](_0x41a7cf));this[_0x1a0d('0x37')][_0x1a0d('0x6c')](this,_0x1ef073,_0x1ef073['sms_account_id']);this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0x1a0'),_0x345cf2['name']));this[_0x1a0d('0x36')][_0x1a0d('0x6c')](this,_0x41a7cf);return this[_0x1a0d('0x38')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x1a0d('0x1a1')]=function(_0x40458e){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x1a2'),_0x40458e['label']));if(!this['isConfigured'](_0x40458e[_0x1a0d('0xd0')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x40458e,_0x1a0d('0x1a3'));}var _0x2f1ce6=this[_0x1a0d('0xf')]['sync'](this,_0x40458e[_0x1a0d('0xd0')]);if(!_0x2f1ce6){return this['channel'][_0x1a0d('0x2e')](_0x40458e,_0x1a0d('0xd2'));}return this[_0x1a0d('0x38')][_0x1a0d('0x9a')](_0x2f1ce6,_0x40458e[_0x1a0d('0x1a4')]);};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x1a5')]=function(_0x22e13e){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x22e13e[_0x1a0d('0xa6')]));this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0x1a6'));if(_0x22e13e[_0x1a0d('0xb2')]===_0x1a0d('0x1a7')){this[_0x1a0d('0x38')]['noop']('Answer');return this['channel'][_0x1a0d('0xb2')]();}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](_0x1a0d('0x1a8'));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x1a9')]=function(_0x5a794d){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x1aa'),_0x5a794d[_0x1a0d('0xa6')]));if(!this['isConfigured'](_0x5a794d['project_id'])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x5a794d,_0x1a0d('0x1ab'));}var _0xa221b2=this[_0x1a0d('0x16')][_0x1a0d('0x6c')](this,_0x5a794d[_0x1a0d('0x1ac')]);if(!this[_0x1a0d('0x82')](_0xa221b2)){return this[_0x1a0d('0x38')]['error'](_0x5a794d,util[_0x1a0d('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5a794d[_0x1a0d('0x1ac')]));}if(_0xa221b2===this[_0x1a0d('0x38')]['arg_1']){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x5a794d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x1a0d('0x37')]['sync'](this,_0x5a794d,_0xa221b2);var _0x1e3e38=this[_0x1a0d('0x38')][_0x1a0d('0x53')](_0x1a0d('0x1ad'),util['format'](_0x1a0d('0x1ae'),config[_0x1a0d('0x6')]['host']||_0x1a0d('0x1af'),_0xa221b2,this['channel'][_0x1a0d('0x40')]));if(_0x1e3e38[_0x1a0d('0x9f')]===-0x1){return _0x1e3e38;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('Executed\x20command\x20%s\x20%s','AGI',_0xa221b2));};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x1b0')]=function(_0x10a308){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x1b1'),_0x10a308[_0x1a0d('0xa6')]));var _0x17df5c=this['shellCommand'][_0x1a0d('0x6c')](this,_0x10a308[_0x1a0d('0xb0')]);this['createSquareDetailsReport']['sync'](this,_0x10a308,_0x10a308[_0x1a0d('0xb0')]);if(this['isConfigured'](_0x10a308[_0x1a0d('0xd0')])){var _0x433070=this['getVariable']['sync'](this,_0x10a308[_0x1a0d('0xd0')]);if(_0x433070){this[_0x1a0d('0x38')][_0x1a0d('0x9a')](_0x433070,_0x17df5c);return this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x10a308[_0x1a0d('0xb0')],_0x433070));}}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x1b2'),_0x10a308[_0x1a0d('0xb0')]));};AGIVertices[_0x1a0d('0xe')]['google_cloud_tts']=function(_0x12a6eb){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x12a6eb[_0x1a0d('0xa6')]));_0x12a6eb[_0x1a0d('0x59')]=_0x12a6eb[_0x1a0d('0x59')][_0x1a0d('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x12a6eb['apiKey'])){return this['channel']['noop'](_0x1a0d('0x1b3'));}if(!this[_0x1a0d('0x82')](_0x12a6eb['text'])){return this[_0x1a0d('0x38')]['noop']('no\x20text\x20configured');}this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x1b4'),_0x12a6eb[_0x1a0d('0x59')]));var _0x54e0bf=this['googleCloudTTS'][_0x1a0d('0x6c')](this,_0x12a6eb);if(_0x54e0bf){this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x54e0bf));var _0x5cee76=this[_0x1a0d('0x38')][_0x1a0d('0xfb')](_0x54e0bf);try{fs[_0x1a0d('0xfc')](_0x54e0bf+_0x1a0d('0xfd'));}catch(_0x2d4a8b){logger[_0x1a0d('0x2e')](_0x2d4a8b);}return _0x5cee76;}return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x12a6eb,_0x1a0d('0x1b5'));};AGIVertices[_0x1a0d('0xe')]['tts']=function(_0x48fd88){logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x1b6'),_0x48fd88[_0x1a0d('0xa6')]));_0x48fd88[_0x1a0d('0x59')]=_0x48fd88[_0x1a0d('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1a0d('0x82')](_0x48fd88[_0x1a0d('0x59')])){return this[_0x1a0d('0x38')][_0x1a0d('0xa8')]('no\x20text\x20configured');}this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x1b7'),_0x48fd88[_0x1a0d('0x59')]));var _0x295a59=this[_0x1a0d('0x5e')]['sync'](this,_0x48fd88);if(_0x295a59){this['channel']['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0x1b8'),_0x295a59));var _0x51dc51=this['channel'][_0x1a0d('0xfb')](_0x295a59);try{fs[_0x1a0d('0xfc')](_0x295a59+_0x1a0d('0xfd'));}catch(_0x11d0ca){logger['error'](_0x11d0ca);}return _0x51dc51;}return this[_0x1a0d('0x38')]['error'](_0x48fd88,_0x1a0d('0x1b9'));};AGIVertices[_0x1a0d('0xe')]['unpause']=function(_0x464fe5){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x1ba'),_0x464fe5[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x464fe5[_0x1a0d('0x150')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x464fe5,_0x1a0d('0x151'));}logger[_0x1a0d('0x30')](util['format'](_0x1a0d('0x156'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x464fe5['findBy']));var _0x3d890d=this['agentUnpause']['sync'](this,_0x464fe5[_0x1a0d('0x150')]);if(_0x3d890d){logger['info'](util[_0x1a0d('0x2a')](_0x1a0d('0x152'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x464fe5[_0x1a0d('0x150')]));this[_0x1a0d('0x38')]['noop'](util[_0x1a0d('0x2a')](_0x1a0d('0x152'),this[_0x1a0d('0x38')]['callerid'],_0x464fe5[_0x1a0d('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x153'),this[_0x1a0d('0x38')][_0x1a0d('0x3b')],_0x464fe5[_0x1a0d('0x150')]));this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util['format'](_0x1a0d('0x153'),this['channel'][_0x1a0d('0x3b')],_0x464fe5['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1a0d('0xe')][_0x1a0d('0x1bb')]=function(_0x5c5792){logger[_0x1a0d('0x30')](util[_0x1a0d('0x2a')](_0x1a0d('0x1bc'),_0x5c5792['label']));var _0x3f7d81=this[_0x1a0d('0x38')][_0x1a0d('0x53')](_0x1a0d('0x1bd'),[_0x5c5792['mailbox'],_0x5c5792[_0x1a0d('0x75')]]);if(_0x3f7d81[_0x1a0d('0x9f')]===-0x1){return _0x3f7d81;}return this[_0x1a0d('0x38')][_0x1a0d('0xa8')](util[_0x1a0d('0x2a')](_0x1a0d('0x167'),_0x1a0d('0x1bd'),_0x5c5792[_0x1a0d('0x1be')]));};AGIVertices['prototype'][_0x1a0d('0x1bf')]=function(_0x2f6db6){logger['info'](util[_0x1a0d('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2f6db6[_0x1a0d('0xa6')]));if(!this[_0x1a0d('0x82')](_0x2f6db6[_0x1a0d('0xd0')])){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x2f6db6,_0x1a0d('0x1a3'));}var _0x361721=this[_0x1a0d('0xf')][_0x1a0d('0x6c')](this,_0x2f6db6[_0x1a0d('0xd0')]);if(!_0x361721){return this[_0x1a0d('0x38')][_0x1a0d('0x2e')](_0x2f6db6,_0x1a0d('0xd2'));}var _0x31804e=this[_0x1a0d('0x38')][_0x1a0d('0xf')](_0x361721);return{'code':0xc8,'result':_0x31804e[_0x1a0d('0x144')]?_0x31804e[_0x1a0d('0x144')]:'-'};};String[_0x1a0d('0xe')][_0x1a0d('0x1c0')]=function(_0x325329,_0x353a4a){return this['split'](_0x325329)['join'](_0x353a4a);};module[_0x1a0d('0x1c1')]=AGIVertices; \ No newline at end of file +var _0x27d6=['500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','saveRestApiResult','isPlainObject','%s.%s','isArray','length','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','scheduledAt','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','createSquareMessage','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','googleDialogflowV2','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','end','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','getData','response','maxdigit','test','mindigit','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','sendSMS\x20message','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','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','AGI','system','command','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','arg_1','file','createCmContact','isEmpty','isNil','callback_','random','phone','list_id','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','toUpperCase','body','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message'];(function(_0x5abd92,_0x101b1e){var _0x3b4dff=function(_0x54d83b){while(--_0x54d83b){_0x5abd92['push'](_0x5abd92['shift']());}};_0x3b4dff(++_0x101b1e);}(_0x27d6,0x14a));var _0x627d=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x27d6[_0x15bc81];return _0x59440e;};'use strict';var fs=require('fs');var path=require(_0x627d('0x0'));var util=require(_0x627d('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x627d('0x2'))();var rs=require('randomstring');var moment=require(_0x627d('0x3'));var Mustache=require(_0x627d('0x4'));var rp=require(_0x627d('0x5'));var logger=require(_0x627d('0x6'))(_0x627d('0x7'));var config=require(_0x627d('0x8'));var scripts=require(_0x627d('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x627d('0xa'),_0x627d('0xb')];var verticesWithRetry=[_0x627d('0xc'),_0x627d('0xd'),_0x627d('0xe')];var AGIVertices=function(_0x4ac54c,_0x86189a,_0x5ce511){this[_0x627d('0xf')]=_0x4ac54c;this[_0x627d('0x10')]=_0x86189a;this[_0x627d('0x11')]=_0x5ce511;};AGIVertices[_0x627d('0x12')]['getVariable']=function(_0x41a54b,_0x4d910f){this[_0x627d('0x10')][_0x627d('0x13')](_0x41a54b)[_0x627d('0x14')](function(_0x400044){_0x4d910f(null,_0x400044?_0x400044[_0x627d('0x15')]:![]);})[_0x627d('0x16')](function(_0x58b912){_0x4d910f(_0x58b912);});};AGIVertices[_0x627d('0x12')][_0x627d('0x17')]=function(_0x34457e,_0x192481){this[_0x627d('0x10')][_0x627d('0x18')](_0x34457e)[_0x627d('0x14')](function(_0xb56a0b){_0x192481(null,_0xb56a0b?_0xb56a0b[_0x627d('0x15')]:![]);})[_0x627d('0x16')](function(_0x3f6a1d){_0x192481(_0x3f6a1d);});};AGIVertices[_0x627d('0x12')][_0x627d('0x19')]=function(_0x930cba,_0x4b2fc7){this[_0x627d('0x10')][_0x627d('0x1a')](_0x930cba)[_0x627d('0x14')](function(_0x169c96){_0x4b2fc7(null,_0x169c96?_0x169c96[_0x627d('0x15')]:![]);})[_0x627d('0x16')](function(_0x1de41a){_0x4b2fc7(_0x1de41a);});};AGIVertices[_0x627d('0x12')][_0x627d('0x1b')]=function(_0x88303d,_0xb3ea3){this['rpc'][_0x627d('0x1c')](_0x88303d)['then'](function(_0x117a0f){_0xb3ea3(null,_0x117a0f?_0x117a0f[_0x627d('0x1d')]:![]);})['catch'](function(_0x49a931){_0xb3ea3(_0x49a931);});};AGIVertices[_0x627d('0x12')][_0x627d('0x1e')]=function(_0x98e0b2,_0x2d5bb9){this[_0x627d('0x10')][_0x627d('0x1f')](_0x98e0b2)[_0x627d('0x14')](function(_0x369524){_0x2d5bb9(null,_0x369524?_0x369524[_0x627d('0x15')]:![]);})[_0x627d('0x16')](function(_0x5472fd){_0x2d5bb9(_0x5472fd);});};AGIVertices[_0x627d('0x12')][_0x627d('0x20')]=function(_0x2b800e,_0x1ac247){this[_0x627d('0x10')][_0x627d('0x21')](_0x2b800e)[_0x627d('0x14')](function(_0xc9b740){_0x1ac247(null,_0xc9b740?_0xc9b740[_0x627d('0x15')]:![]);})[_0x627d('0x16')](function(_0x4a7d5c){_0x1ac247(_0x4a7d5c);});};AGIVertices[_0x627d('0x12')]['getSound']=function(_0x798362,_0x323d76){var _0x245f7d=this;this[_0x627d('0x10')]['getSoundById'](_0x798362)[_0x627d('0x14')](function(_0xa151bf){_0x323d76(null,_0xa151bf?_0x245f7d[_0x627d('0x22')](_0xa151bf['save_name']):![]);})[_0x627d('0x16')](function(_0x809b){_0x323d76(_0x809b);});};AGIVertices[_0x627d('0x12')][_0x627d('0x23')]=function(_0x451555,_0x4daeb2){this[_0x627d('0x10')][_0x627d('0x24')](_0x451555)[_0x627d('0x14')](function(_0x2bd728){_0x4daeb2(null,_0x2bd728?_0x2bd728:![]);})['catch'](function(_0x5c6221){_0x4daeb2(_0x5c6221);});};AGIVertices[_0x627d('0x12')]['sendMailMessage']=function(_0x9dcaf3,_0x3a5232,_0x4104ab){this[_0x627d('0x11')][_0x627d('0x25')](_0x9dcaf3,_0x3a5232)['then'](function(){_0x4104ab(null);})['catch'](function(_0xff1d35){_0x4104ab(_0xff1d35);});};AGIVertices[_0x627d('0x12')][_0x627d('0x26')]=function(_0x40026d,_0x6a4193){this[_0x627d('0x10')]['getIntervalById'](_0x40026d)[_0x627d('0x14')](function(_0x41fe51){if(_0x41fe51){if(_0x41fe51[_0x627d('0x27')]){_0x6a4193(null,[_0x41fe51[_0x627d('0x28')]]);}else{_0x6a4193(null,_[_0x627d('0x29')](_0x41fe51['Intervals'],_0x627d('0x28')));}}else{_0x6a4193(null,![]);}})[_0x627d('0x16')](function(_0x349605){_0x6a4193(_0x349605);});};AGIVertices['prototype'][_0x627d('0x22')]=function(_0x17ba4f){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x17ba4f);};AGIVertices[_0x627d('0x12')][_0x627d('0x2a')]=function(_0x41c6a4,_0x5f4210,_0x237134){odbc['open'](_0x41c6a4,function(_0x5ee1c4){if(_0x5ee1c4){logger[_0x627d('0x2b')](_0x627d('0x2c'),_0x5ee1c4);_0x237134(_0x5ee1c4);}else{logger['info'](_0x627d('0x2d'));odbc['query'](_0x5f4210,function(_0x55ee26,_0x3ab202){if(_0x55ee26){logger[_0x627d('0x2e')](_0x627d('0x2f'),_0x5f4210);_0x237134(_0x55ee26);}else{logger[_0x627d('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x5f4210);odbc[_0x627d('0x30')](function(_0x1b86f8){if(_0x1b86f8){logger[_0x627d('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1b86f8);}_0x237134(null,_0x3ab202);});}});}});};AGIVertices[_0x627d('0x12')][_0x627d('0x31')]=function(_0x3793ea,_0x26f92c){this['rpc'][_0x627d('0x32')](_0x3793ea)[_0x627d('0x14')](function(_0x2a0f5a){_0x26f92c(null,_0x2a0f5a?_0x2a0f5a:![]);})[_0x627d('0x16')](function(_0x45b952){_0x26f92c(_0x45b952);});};AGIVertices[_0x627d('0x12')][_0x627d('0x33')]=function(_0x41e711,_0x36955c){this[_0x627d('0x10')][_0x627d('0x33')](_0x41e711)[_0x627d('0x14')](function(_0x2b18a2){_0x36955c(null,_0x2b18a2);})[_0x627d('0x16')](function(_0x103dd2){_0x36955c(_0x103dd2);});};AGIVertices['prototype'][_0x627d('0x34')]=function(_0x4b994b,_0x566e48,_0xa8efe8){this[_0x627d('0x10')][_0x627d('0x34')]({'uniqueid':this['channel'][_0x627d('0x35')],'node':_0x4b994b[_0x627d('0x36')],'application':_0x4b994b[_0x627d('0x37')],'data':_0x566e48||null,'project_name':this[_0x627d('0xf')]['arg_1'],'callerid':this[_0x627d('0xf')][_0x627d('0x38')]})[_0x627d('0x14')](function(_0x1abc18){if(_0xa8efe8){_0xa8efe8(null,_0x1abc18);}})[_0x627d('0x16')](function(_0x35b41f){if(_0xa8efe8){_0xa8efe8(_0x35b41f);}});};AGIVertices[_0x627d('0x12')][_0x627d('0x39')]=function(_0x2988cc,_0x4446cf,_0x182bbf,_0x233794){this[_0x627d('0x10')][_0x627d('0x39')]({'uniqueid':this[_0x627d('0xf')][_0x627d('0x35')],'callerid':this['channel'][_0x627d('0x38')],'calleridname':this[_0x627d('0xf')][_0x627d('0x3a')],'context':this[_0x627d('0xf')]['context'],'extension':this[_0x627d('0xf')][_0x627d('0x3b')],'priority':this[_0x627d('0xf')][_0x627d('0x3c')],'accountcode':this['channel'][_0x627d('0x3d')],'dnid':this['channel'][_0x627d('0x3e')],'projectName':this[_0x627d('0xf')][_0x627d('0x3f')],'saveName':_0x4446cf,'filename':_0x2988cc[_0x627d('0x40')]||_0x4446cf,'savePath':_0x182bbf})[_0x627d('0x14')](function(_0x38bcc9){_0x233794(null,_0x38bcc9);})[_0x627d('0x16')](function(_0x2f8676){_0x233794(_0x2f8676);});};AGIVertices[_0x627d('0x12')]['createSquareMessage']=function(_0x2aa737,_0x22586f,_0x3cb804,_0x59764c,_0x2377c4){this[_0x627d('0x10')]['createSquareMessage']({'uniqueid':this[_0x627d('0xf')]['uniqueid'],'body':_0x2aa737,'direction':_0x22586f,'providerName':_0x3cb804,'providerResponse':_0x59764c})[_0x627d('0x14')](function(_0x42dd43){if(_0x2377c4){_0x2377c4(null,_0x42dd43);}})[_0x627d('0x16')](function(_0x3606a0){if(_0x2377c4){_0x2377c4(_0x3606a0);}});};AGIVertices[_0x627d('0x12')][_0x627d('0x41')]=function(_0x29fbc3,_0x267794){this[_0x627d('0x10')][_0x627d('0x41')]({'firstName':_[_0x627d('0x42')](_0x29fbc3[_0x627d('0x15')])||_[_0x627d('0x43')](_0x29fbc3['name'])?_0x627d('0x44')+Math[_0x627d('0x45')]():_0x29fbc3[_0x627d('0x15')],'lastName':_['isEmpty'](_0x29fbc3['lastName'])||_['isNil'](_0x29fbc3['lastName'])?null:_0x29fbc3['lastName'],'phone':_0x29fbc3[_0x627d('0x46')],'ListId':_0x29fbc3[_0x627d('0x47')],'scheduledat':_0x29fbc3['scheduledAt'],'callbackUniqueid':this[_0x627d('0xf')][_0x627d('0x35')],'tags':_0x627d('0x48'),'description':'Callback\x20scheduled\x20at\x20'+_0x29fbc3['scheduledAt'][_0x627d('0x49')](),'priority':_0x29fbc3[_0x627d('0x4a')]})[_0x627d('0x14')](function(_0x13efef){_0x267794(null,_0x13efef);})[_0x627d('0x16')](function(_0x61e009){_0x267794(_0x61e009);});};AGIVertices[_0x627d('0x12')][_0x627d('0x4b')]=function(_0x25a191,_0x4018ab){this[_0x627d('0x10')][_0x627d('0x4c')](_0x25a191)[_0x627d('0x14')](function(_0xf8fc2a){_0x4018ab(null,_0xf8fc2a?_0xf8fc2a[_0x627d('0x15')]:![]);})[_0x627d('0x16')](function(_0xb87e26){_0x4018ab(_0xb87e26);});};AGIVertices[_0x627d('0x12')][_0x627d('0x4d')]=function(_0x495976,_0x591913,_0x318355){var _0x51fc7f={'role':_0x627d('0x4e')};_0x51fc7f[_0x495976]=this[_0x627d('0xf')][_0x627d('0x38')];this[_0x627d('0x10')][_0x627d('0x4d')](_0x51fc7f,_0x591913,this[_0x627d('0xf')][_0x627d('0x35')])[_0x627d('0x14')](function(_0x15b158){_0x318355(null,_[_0x627d('0x43')](_0x15b158)?![]:!![]);})[_0x627d('0x16')](function(_0x34215c){logger['error'](_0x34215c);_0x318355(null,![]);});};AGIVertices[_0x627d('0x12')][_0x627d('0x4f')]=function(_0x3be896,_0x4a0e44){var _0x206099={'role':_0x627d('0x4e')};_0x206099[_0x3be896]=this[_0x627d('0xf')][_0x627d('0x38')];this[_0x627d('0x10')][_0x627d('0x4f')](_0x206099)[_0x627d('0x14')](function(_0x5690a5){_0x4a0e44(null,_[_0x627d('0x43')](_0x5690a5)?![]:!![]);})[_0x627d('0x16')](function(_0x181a4e){logger['error'](_0x181a4e);_0x4a0e44(null,![]);});};AGIVertices[_0x627d('0x12')][_0x627d('0x50')]=function(_0x468dd6,_0x1b6deb){var _0x3900a1={'role':_0x627d('0x4e')};_0x3900a1[_0x468dd6]=this['channel'][_0x627d('0x38')];this[_0x627d('0x10')][_0x627d('0x50')](_0x3900a1)[_0x627d('0x14')](function(_0x4d495d){_0x1b6deb(null,_[_0x627d('0x43')](_0x4d495d)?![]:!![]);})[_0x627d('0x16')](function(_0x18b36a){logger[_0x627d('0x2b')](_0x18b36a);_0x1b6deb(null,![]);});};AGIVertices[_0x627d('0x12')][_0x627d('0x51')]=function(_0xb6796e,_0x3fdc37){var _0x299bb2={'role':_0x627d('0x4e')};_0x299bb2[_0xb6796e]=this['channel']['callerid'];var _0x56b6db=_0xb6796e!=_0x627d('0x52')?util[_0x627d('0x53')]('%s/%s@from-sip/n',_0x627d('0x54'),this['channel'][_0x627d('0x38')]):undefined;this[_0x627d('0x10')][_0x627d('0x51')](_0x299bb2,_0x56b6db)[_0x627d('0x14')](function(_0x34d98f){_0x3fdc37(null,_['isNil'](_0x34d98f)?![]:!![]);})[_0x627d('0x16')](function(_0x350989){logger[_0x627d('0x2b')](_0x350989);_0x3fdc37(null,![]);});};AGIVertices[_0x627d('0x12')][_0x627d('0x55')]=function(_0x6d14a3,_0x5d3b52){sh[_0x627d('0x56')](_[_0x627d('0x57')](_0x6d14a3),function(_0x70dfc8,_0x73c961){var _0x2afbea=_0x73c961[_0x627d('0x58')](/(\r\n|\n|\r)/gm,'');_0x5d3b52(null,_0x2afbea);});};AGIVertices['prototype'][_0x627d('0x59')]=function(_0x355ecf,_0x383d03){scripts['googleCloudTTS'](_0x355ecf[_0x627d('0x5a')],_0x355ecf['google_cloud_tts_text_type']||_0x627d('0x5b'),_0x355ecf[_0x627d('0x5b')],_0x355ecf['languageCode']||_0x627d('0x5c'),_0x355ecf[_0x627d('0x5d')]||_0x627d('0x5e'),_0x355ecf['audioEncoding']||_0x627d('0x5f'))['then'](function(_0x5cc6e6){_0x383d03(null,_0x5cc6e6);})[_0x627d('0x16')](function(_0x1cc482){_0x383d03(_0x1cc482);});};AGIVertices[_0x627d('0x12')][_0x627d('0x60')]=function(_0x206a41,_0x5bfe1c){scripts['googleTTS'](_0x206a41[_0x627d('0x5b')],_0x206a41[_0x627d('0x61')]||'en',0x1)['then'](function(_0x49b912){_0x5bfe1c(null,_0x49b912);})[_0x627d('0x16')](function(_0x378b26){_0x5bfe1c(_0x378b26);});};AGIVertices[_0x627d('0x12')][_0x627d('0x62')]=function(_0x130ad2,_0x6d7f48){var _0x583ac7={'uri':_0x130ad2[_0x627d('0x63')],'method':_0x130ad2['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x130ad2[_0x627d('0x64')])==='number'&&parseInt(_0x130ad2[_0x627d('0x64')])>=0x1?parseInt(_0x130ad2[_0x627d('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x627d('0x65')](['POST','PUT'],_0x583ac7['method'][_0x627d('0x66')]())){try{_0x583ac7[_0x627d('0x67')]=_0x130ad2[_0x627d('0xb')]?JSON['parse'](_0x130ad2[_0x627d('0xb')]):{};}catch(_0x41e474){logger[_0x627d('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x41e474);}}try{_0x583ac7[_0x627d('0x68')]=_0x130ad2[_0x627d('0xa')]?JSON[_0x627d('0x69')](_0x130ad2[_0x627d('0xa')]):{};}catch(_0x117a22){logger['error'](_0x627d('0x6a'),_0x117a22);}if(_0x130ad2[_0x627d('0x6b')]){try{var _0x556bbc=require(_0x130ad2[_0x627d('0x6b')])[_0x627d('0x6c')](this,_0x583ac7);_0x583ac7[_0x627d('0x6d')]=Mustache['render'](_0x130ad2[_0x627d('0x63')],_0x556bbc,{},['$$','$$']);if(_0x583ac7[_0x627d('0x68')]){_0x583ac7[_0x627d('0x68')]=JSON[_0x627d('0x69')](Mustache[_0x627d('0x6e')](JSON['stringify'](_0x583ac7[_0x627d('0x68')]),_0x556bbc,{},['$$','$$']));}if(_0x583ac7[_0x627d('0x67')]){_0x583ac7[_0x627d('0x67')]=JSON[_0x627d('0x69')](Mustache[_0x627d('0x6e')](JSON[_0x627d('0x6f')](_0x583ac7[_0x627d('0x67')]),_0x556bbc,{},['$$','$$']));}}catch(_0x5ae2d4){logger['error'](_0x627d('0x70'),_0x5ae2d4);}}rp(_0x583ac7)[_0x627d('0x14')](function(_0x494bde){var _0x3efdef={'statusCode':_0x494bde['statusCode']||0xc8,'statusMessage':_0x494bde['statusMessage']||'OK','headers':_0x494bde[_0x627d('0x68')]||{},'body':_0x494bde[_0x627d('0x67')]||{}};_0x6d7f48(null,_0x3efdef);})[_0x627d('0x16')](function(_0x1d0500){var _0x3d3354={'statusCode':_0x1d0500[_0x627d('0x71')]||0x1f4,'statusMessage':_0x1d0500[_0x627d('0x72')]||_0x627d('0x73'),'headers':_0x1d0500[_0x627d('0x74')][_0x627d('0x68')]||{},'body':_0x1d0500['options']['body']||{}};_0x6d7f48(null,_0x3d3354);});};AGIVertices[_0x627d('0x12')][_0x627d('0x75')]=function(_0x9682ef,_0x1fdc8c){scripts['googleDialogflow'](this[_0x627d('0xf')][_0x627d('0x35')],_0x9682ef[_0x627d('0x76')],_0x9682ef[_0x627d('0x5b')],_0x9682ef[_0x627d('0x77')]||'en')[_0x627d('0x14')](function(_0x1181c7){_0x1fdc8c(null,_0x1181c7);})[_0x627d('0x16')](function(_0x21abbb){_0x1fdc8c(_0x21abbb);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x144956,_0x46c2b7){scripts['googleDialogflowV2'](this[_0x627d('0xf')][_0x627d('0x35')],_0x144956[_0x627d('0x78')],_0x144956[_0x627d('0x79')],_0x144956['private_key'],_0x144956['text'],_0x144956['dialogflowV2_language']||'en')[_0x627d('0x14')](function(_0xfe8e38){_0x46c2b7(null,_0xfe8e38);})['catch'](function(_0x5c94f2){_0x46c2b7(_0x5c94f2);});};AGIVertices[_0x627d('0x12')]['sestekNDA']=function(_0x5dd1a7,_0x50b277){scripts[_0x627d('0x7a')](this[_0x627d('0xf')],_0x5dd1a7)[_0x627d('0x14')](function(_0x3b8166){_0x50b277(null,_0x3b8166);})[_0x627d('0x16')](function(_0x3a11d2){_0x50b277(_0x3a11d2);});};AGIVertices[_0x627d('0x12')][_0x627d('0x7b')]=function(_0x29dfeb,_0x214073){scripts[_0x627d('0x7b')](_0x29dfeb[_0x627d('0x76')],_0x29dfeb[_0x627d('0x5b')],_0x29dfeb['ispeech_tts_language']||_0x627d('0x5c'),_0x29dfeb[_0x627d('0x7c')])['then'](function(_0x4d2ac6){_0x214073(null,_0x4d2ac6);})['catch'](function(_0x47bac6){_0x214073(_0x47bac6);});};AGIVertices[_0x627d('0x12')][_0x627d('0x7d')]=function(_0x4210b1,_0xcda6b0,_0xcf505d){scripts[_0x627d('0x7d')](_0xcda6b0,_0x4210b1[_0x627d('0x76')],_0x4210b1[_0x627d('0x7e')]||'en-US',this[_0x627d('0x7f')](_0x4210b1[_0x627d('0x80')])?_0x4210b1['model']:undefined)[_0x627d('0x14')](function(_0x4a1550){_0xcf505d(null,_0x4a1550);})[_0x627d('0x16')](function(_0x1a4734){_0xcf505d(_0x1a4734);});};AGIVertices[_0x627d('0x12')][_0x627d('0x81')]=function(_0x5bba22,_0x3ea490){scripts[_0x627d('0x81')](_0x5bba22['aws_access_key_id'],_0x5bba22[_0x627d('0x82')],_0x5bba22[_0x627d('0x83')],_0x5bba22[_0x627d('0x84')]||_0x627d('0x85'),_0x5bba22[_0x627d('0x5b')],_0x5bba22[_0x627d('0x86')]||'text')[_0x627d('0x14')](function(_0x47fbaf){_0x3ea490(null,_0x47fbaf);})[_0x627d('0x16')](function(_0x46e8f4){_0x3ea490(_0x46e8f4);});};AGIVertices[_0x627d('0x12')][_0x627d('0x87')]=function(_0x287736,_0x316cce){scripts[_0x627d('0x87')](this[_0x627d('0xf')]['uniqueid'],_0x287736[_0x627d('0x88')],_0x287736[_0x627d('0x82')],_0x287736[_0x627d('0x89')],_0x287736['text'],_0x287736[_0x627d('0x8a')])[_0x627d('0x14')](function(_0x2d8c42){_0x316cce(null,_0x2d8c42);})[_0x627d('0x16')](function(_0xa4f975){_0x316cce(_0xa4f975);});};AGIVertices[_0x627d('0x12')][_0x627d('0x8b')]=function(_0x4424c0,_0x57e2a7,_0x47df47){scripts[_0x627d('0x8b')](_0x57e2a7,_0x4424c0['key'],_0x4424c0[_0x627d('0x8c')]||_0x627d('0x5c'))[_0x627d('0x14')](function(_0x4c306e){_0x47df47(null,_0x4c306e);})['catch'](function(_0x527535){_0x47df47(_0x527535);});};AGIVertices[_0x627d('0x12')]['tildeASR']=function(_0x521377,_0x44acaa,_0x527330){scripts[_0x627d('0x8d')](_0x44acaa,_0x521377[_0x627d('0x8e')],_0x521377[_0x627d('0x8f')],_0x521377['uri'])['then'](function(_0x3aba93){_0x527330(null,_0x3aba93);})[_0x627d('0x16')](function(_0x531f9c){_0x527330(_0x531f9c);});};AGIVertices[_0x627d('0x12')][_0x627d('0x90')]=function(_0x5e84c5){var _0x423fa6=_[_0x627d('0x65')](verticesWithRetry,_0x5e84c5[_0x627d('0x37')])?_0x5e84c5:_[_0x627d('0x91')](_0x5e84c5);for(var _0x5e9789 in _0x423fa6){if(_0x423fa6[_0x627d('0x92')](_0x5e9789)){if(_0x423fa6[_0x5e9789]&&_[_0x627d('0x93')](_0x423fa6[_0x5e9789])){if(_[_0x627d('0x65')](recursiveMapAttributes,_0x5e9789)){_0x423fa6[_0x5e9789]=this[_0x627d('0x94')](_0x423fa6[_0x5e9789]);}else{_0x423fa6[_0x5e9789]=this[_0x627d('0x95')](_0x423fa6[_0x5e9789]);}}}}return _0x423fa6;};AGIVertices[_0x627d('0x12')][_0x627d('0x96')]=function(_0x57bdeb){for(var _0x37a4d5 in _0x57bdeb){if(_0x57bdeb[_0x627d('0x92')](_0x37a4d5)){if(_['isPlainObject'](_0x57bdeb[_0x37a4d5])){this[_0x627d('0x96')](_0x57bdeb[_0x37a4d5]);}else if(_['isArray'](_0x57bdeb[_0x37a4d5])){for(var _0x367813=0x0;_0x367813<_0x57bdeb[_0x37a4d5]['length'];_0x367813++){this[_0x627d('0x96')](_0x57bdeb[_0x37a4d5][_0x367813]);}}else if(_['isString'](_0x57bdeb[_0x37a4d5])){_0x57bdeb[_0x37a4d5]=this[_0x627d('0x95')](_0x57bdeb[_0x37a4d5]);}}}};AGIVertices[_0x627d('0x12')][_0x627d('0x97')]=function(_0x417d8b,_0xb8a428){for(var _0x1f5910 in _0x417d8b){if(_0x417d8b[_0x627d('0x92')](_0x1f5910)){if(_[_0x627d('0x98')](_0x417d8b[_0x1f5910])){if(!_[_0x627d('0x42')](_0x417d8b[_0x1f5910])){this['saveRestApiResult'](_0x417d8b[_0x1f5910],util[_0x627d('0x53')](_0x627d('0x99'),_0xb8a428,_0x1f5910));}}else if(_[_0x627d('0x9a')](_0x417d8b[_0x1f5910])){for(var _0x3e793b=0x0;_0x3e793b<_0x417d8b[_0x1f5910][_0x627d('0x9b')];_0x3e793b++){this['saveRestApiResult'](_0x417d8b[_0x1f5910][_0x3e793b],util['format']('%s.%s',_0xb8a428,_0x1f5910+'['+_0x3e793b+']'));}}else{if(!_[_0x627d('0x43')](_0x417d8b[_0x1f5910])){this[_0x627d('0xf')][_0x627d('0x9c')](util['format'](_0x627d('0x99'),_0xb8a428,_0x1f5910),_0x417d8b[_0x1f5910]);}}}}};AGIVertices['prototype'][_0x627d('0x94')]=function(_0x35fa7d){try{var _0x272326=JSON[_0x627d('0x69')](_0x35fa7d);this[_0x627d('0x96')](_0x272326);return JSON['stringify'](_0x272326);}catch(_0x48534e){return this[_0x627d('0x95')](_0x35fa7d);}};AGIVertices[_0x627d('0x12')][_0x627d('0x95')]=function(_0x2ff8ce){var _0x400831=_0x2ff8ce[_0x627d('0x9d')]('{');for(var _0x3f9c16=0x1;_0x3f9c16<_0x400831[_0x627d('0x9b')];_0x3f9c16+=0x1){var _0x1e7434=_0x400831[_0x3f9c16][_0x627d('0x9d')]('}');if(_0x1e7434[_0x627d('0x9b')]>0x1){_0x2ff8ce=_0x2ff8ce[_0x627d('0x9e')]('{'+_0x1e7434[0x0]+'}',this[_0x627d('0xf')][_0x627d('0x9f')](_0x1e7434[0x0])[_0x627d('0xa0')]||_0x1e7434[0x0]);}}if(_0x400831[_0x627d('0x9b')]===0x1){return _0x2ff8ce[_0x627d('0x49')]();}return this['replaceAllVariables'](_0x2ff8ce);};AGIVertices['prototype'][_0x627d('0xa1')]=function(_0x1cb302,_0x3e4227){var _0x1f53c1=this[_0x627d('0xf')][_0x627d('0x9f')](_0x1cb302);if(_0x1f53c1['result']===-0x1){return _0x1f53c1;}logger['info'](util[_0x627d('0x53')](_0x627d('0xa2'),_0x3e4227,_0x1f53c1['extra']));return this[_0x627d('0xf')][_0x627d('0x9c')](_0x3e4227,_0x1f53c1[_0x627d('0xa0')]);};AGIVertices['prototype']['isConfigured']=function(_0xc960c0){return _0xc960c0&&_0xc960c0!=='0'&&_0xc960c0!=='-1'&&_0xc960c0!=='';};AGIVertices[_0x627d('0x12')][_0x627d('0xa3')]=function(_0xcb3d7a){this[_0x627d('0x34')][_0x627d('0x6c')](this,_0xcb3d7a,'-');_0xcb3d7a[_0x627d('0xa4')]=_0xcb3d7a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x627d('0x12')]['mrcpsynth']=function(_0x425636){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x425636[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x425636[_0x627d('0x5b')])){return this[_0x627d('0xf')]['noop'](_0x627d('0xa5'));}var _0x39846d='\x22'+_0x425636[_0x627d('0x5b')]+'\x22';if(this['isConfigured'](_0x425636[_0x627d('0x74')])){_0x39846d+=','+_0x425636[_0x627d('0x74')];}var _0x11f0a5=this[_0x627d('0xf')][_0x627d('0x56')](_0x627d('0xa6'),_0x39846d);if(_0x11f0a5['result']===-0x1){return _0x11f0a5;}return this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0xa8'),_0x39846d));};AGIVertices[_0x627d('0x12')][_0x627d('0xa9')]=function(_0x1ab406){logger[_0x627d('0x2e')](util['format'](_0x627d('0xaa'),_0x1ab406[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x1ab406[_0x627d('0xab')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xac'));}var _0xa833b6=_0x1ab406[_0x627d('0xab')];if(this[_0x627d('0x7f')](_0x1ab406['options'])){_0xa833b6+=','+_0x1ab406[_0x627d('0x74')];}var _0x391be9=this[_0x627d('0xf')][_0x627d('0x56')](_0x627d('0xad'),_0xa833b6);if(_0x391be9[_0x627d('0xae')]===-0x1){return _0x391be9;}var _0x545e36=this[_0x627d('0xa1')](_0x627d('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x545e36[_0x627d('0xae')]===-0x1){return _0x545e36;}var _0x3d2795=this[_0x627d('0xa1')](_0x627d('0xb0'),_0x627d('0xb1'));if(_0x3d2795[_0x627d('0xae')]===-0x1){return _0x3d2795;}var _0x302546=this['getAndSetVariable'](_0x627d('0xb2'),_0x627d('0xb3'));if(_0x302546['result']===-0x1){return _0x302546;}return this['channel'][_0x627d('0xa7')](util['format'](_0x627d('0xb4'),_0xa833b6));};AGIVertices[_0x627d('0x12')][_0x627d('0x7')]=function(_0x157b26){logger[_0x627d('0x2e')](util['format'](_0x627d('0xb5'),_0x157b26['label']));return this[_0x627d('0xf')][_0x627d('0x7')]([_0x157b26['command'],_0x157b26[_0x627d('0xb6')]]);};AGIVertices[_0x627d('0x12')]['answer']=function(_0x32205b){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x32205b[_0x627d('0x36')]));if(this['isConfigured'](_0x32205b['timeout'])){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0xb7'),_0x32205b[_0x627d('0x64')]));var _0x247c7c=this[_0x627d('0xf')][_0x627d('0xb8')](_0x32205b['timeout']);if(_0x247c7c[_0x627d('0xae')]===-0x1){return _0x247c7c;}}return this[_0x627d('0xf')][_0x627d('0xb9')]();};AGIVertices[_0x627d('0x12')][_0x627d('0x48')]=function(_0x40ce39){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x40ce39[_0x627d('0x36')]));if(!this['isConfigured'](_0x40ce39['list_id'])){return this['channel']['error'](_0x40ce39,_0x627d('0xba'));}_0x40ce39[_0x627d('0xbb')]=moment();if(this[_0x627d('0x7f')](_0x40ce39['delay'])){_0x40ce39['scheduledAt']=moment()['add'](_0x40ce39[_0x627d('0xbc')],_0x627d('0xbd'));}if(!this[_0x627d('0x7f')](_0x40ce39[_0x627d('0x4a')])){_0x40ce39[_0x627d('0x4a')]=0x2;}this[_0x627d('0x41')][_0x627d('0x6c')](this,_0x40ce39);return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0xbe'),_0x40ce39['phone'],_0x40ce39[_0x627d('0x47')],_0x40ce39[_0x627d('0xbb')]));};AGIVertices[_0x627d('0x12')][_0x627d('0xbf')]=function(_0x16a157){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x16a157['label']));var _0x85bc3c=this['channel']['exec'](_0x16a157[_0x627d('0xc0')],_0x16a157['options']);if(_0x85bc3c[_0x627d('0xae')]===-0x1){return _0x85bc3c;}return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0xc1'),_0x16a157[_0x627d('0xc0')],_0x16a157[_0x627d('0x74')]));};AGIVertices[_0x627d('0x12')][_0x627d('0xc2')]=function(_0x54488b){logger['info'](util['format'](_0x627d('0xc3'),_0x54488b[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x54488b['text'])){return this[_0x627d('0xf')][_0x627d('0xa7')]('no\x20text\x20configured');}var _0x8018d5='\x22'+_0x54488b[_0x627d('0x5b')]+'\x22';if(this[_0x627d('0x7f')](_0x54488b[_0x627d('0x74')])){_0x8018d5+=','+_0x54488b[_0x627d('0x74')];}var _0xfa994e=this[_0x627d('0xf')][_0x627d('0x56')](_0x627d('0xa6'),_0x8018d5);if(_0xfa994e[_0x627d('0xae')]===-0x1){return _0xfa994e;}return this[_0x627d('0xf')][_0x627d('0xa7')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x8018d5));};AGIVertices[_0x627d('0x12')][_0x627d('0xc4')]=function(_0x224d43){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0xc5'),_0x224d43[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x224d43[_0x627d('0x5b')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xa5'));}var _0x5735cd='\x22'+_0x224d43[_0x627d('0x5b')]+'\x22';if(this[_0x627d('0x7f')](_0x224d43[_0x627d('0x74')])){_0x5735cd+=','+_0x224d43[_0x627d('0x74')];}var _0x12e8e7=this['channel'][_0x627d('0x56')](_0x627d('0xa6'),_0x5735cd);if(_0x12e8e7[_0x627d('0xae')]===-0x1){return _0x12e8e7;}return this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0xa8'),_0x5735cd));};AGIVertices['prototype']['lumenvoxasr']=function(_0x233362){logger[_0x627d('0x2e')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x233362[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x233362[_0x627d('0xab')])){return this[_0x627d('0xf')][_0x627d('0xa7')]('no\x20grammar\x20configured');}var _0x46d1d7=_0x233362[_0x627d('0xab')];if(this[_0x627d('0x7f')](_0x233362[_0x627d('0x74')])){_0x46d1d7+=','+_0x233362['options'];}var _0x3cb8f1=this[_0x627d('0xf')]['exec'](_0x627d('0xad'),_0x46d1d7);if(_0x3cb8f1[_0x627d('0xae')]===-0x1){return _0x3cb8f1;}var _0x340bf1=this[_0x627d('0xa1')](_0x627d('0xaf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x340bf1['result']===-0x1){return _0x340bf1;}var _0x131865=this[_0x627d('0xa1')]('RECOG_INPUT()',_0x627d('0xc6'));if(_0x131865[_0x627d('0xae')]===-0x1){return _0x131865;}var _0x4320f1=this[_0x627d('0xa1')]('RECOG_INSTANCE()',_0x627d('0xc7'));if(_0x4320f1['result']===-0x1){return _0x4320f1;}return this['channel']['noop'](util[_0x627d('0x53')](_0x627d('0xb4'),_0x46d1d7));};AGIVertices['prototype'][_0x627d('0xc8')]=function(_0x355b2e){logger['info'](util[_0x627d('0x53')](_0x627d('0xc9'),_0x355b2e[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x355b2e[_0x627d('0xab')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xac'));}var _0x464c5a=_0x355b2e[_0x627d('0xab')];if(this[_0x627d('0x7f')](_0x355b2e[_0x627d('0x74')])){_0x464c5a+=','+_0x355b2e['options'];}var _0x7c0c81=this[_0x627d('0xf')][_0x627d('0x56')]('MRCPRecog',_0x464c5a);if(_0x7c0c81[_0x627d('0xae')]===-0x1){return _0x7c0c81;}var _0x3b0ac9=this[_0x627d('0xa1')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x3b0ac9[_0x627d('0xae')]===-0x1){return _0x3b0ac9;}var _0x267214=this[_0x627d('0xa1')](_0x627d('0xb0'),_0x627d('0xca'));if(_0x267214[_0x627d('0xae')]===-0x1){return _0x267214;}var _0x3164c9=this[_0x627d('0xa1')]('RECOG_INSTANCE()',_0x627d('0xcb'));if(_0x3164c9[_0x627d('0xae')]===-0x1){return _0x3164c9;}return this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0xb4'),_0x464c5a));};AGIVertices[_0x627d('0x12')]['database']=function(_0x1bbfb9){logger[_0x627d('0x2e')](util['format'](_0x627d('0xcc'),_0x1bbfb9[_0x627d('0x36')]));if(!this['isConfigured'](_0x1bbfb9[_0x627d('0xcd')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x1bbfb9,_0x627d('0xce'));}var _0x97a56c=this[_0x627d('0x1b')]['sync'](this,_0x1bbfb9[_0x627d('0xcd')]);if(!_0x97a56c){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x1bbfb9,_0x627d('0xcf'));}if(!this[_0x627d('0x7f')](_0x1bbfb9[_0x627d('0xd0')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x1bbfb9,_0x627d('0xd1'));}var _0x2e5337=_0x1bbfb9['query'][_0x627d('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x627d('0xf')][_0x627d('0xa7')](util['format'](_0x627d('0xd2'),_0x2e5337));var _0x2d6601=this[_0x627d('0x2a')]['sync'](this,_0x97a56c,_0x2e5337);this['createSquareDetailsReport']['sync'](this,_0x1bbfb9,_0x2e5337);if(!this[_0x627d('0x7f')](_0x1bbfb9[_0x627d('0xd3')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xd4'));}var _0x195fd3=this[_0x627d('0x9f')]['sync'](this,_0x1bbfb9[_0x627d('0xd3')]);if(!_0x195fd3){return this['channel'][_0x627d('0x2b')](_0x1bbfb9,_0x627d('0xd5'));}var _0x53cce6=this;_0x2d6601['forEach'](function(_0x475c0b,_0x4153ec){Object[_0x627d('0xd6')](_0x475c0b)[_0x627d('0xd7')](function(_0x548d72){_0x53cce6['channel'][_0x627d('0x9c')](util[_0x627d('0x53')](_0x627d('0xd8'),_0x195fd3,_0x4153ec,_0x548d72),_0x475c0b[_0x548d72]);});});this[_0x627d('0xf')][_0x627d('0x9c')](util[_0x627d('0x53')]('%s_ROWS_COUNT',_0x195fd3),_0x2d6601[_0x627d('0x9b')]);return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0xd9'),_0x195fd3));};AGIVertices['prototype'][_0x627d('0xda')]=function(_0x6d789){logger[_0x627d('0xdb')](util[_0x627d('0x53')](_0x627d('0xdc'),_0x6d789[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x6d789[_0x627d('0xdd')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x6d789,'no\x20user\x20selected');}var _0xbacfc9=this['getUser'][_0x627d('0x6c')](this,_0x6d789['sip_id']);if(!_0xbacfc9){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x6d789,_0x627d('0xde'));}var _0x109f56=this['channel'][_0x627d('0x56')]('DIAL',[util['format'](_0x627d('0xdf'),_0xbacfc9),_0x6d789[_0x627d('0x64')],_0x6d789[_0x627d('0xe0')],_0x6d789[_0x627d('0x63')]]);if(_0x109f56[_0x627d('0xae')]===-0x1){return _0x109f56;}return this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x627d('0xe1')]=function(_0x8b886f){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0xe2'),_0x8b886f[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x8b886f[_0x627d('0x76')])){return this[_0x627d('0xf')][_0x627d('0xa7')]('no\x20key\x20configured');}if(!this[_0x627d('0x7f')](_0x8b886f[_0x627d('0x5b')])){return this[_0x627d('0xf')]['noop'](_0x627d('0xa5'));}this[_0x627d('0xf')][_0x627d('0xe3')]=!![];this[_0x627d('0x34')](_0x8b886f);this[_0x627d('0xe4')](_0x8b886f[_0x627d('0x5b')],'in','','');this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')]('Trying\x20Dialogflow:\x20%s',_0x8b886f['text']));var _0x21c8e7=this['googleDialogflow'][_0x627d('0x6c')](this,_0x8b886f);if(_0x21c8e7){for(var _0x5996b4 in _0x21c8e7){if(_0x21c8e7['hasOwnProperty'](_0x5996b4)){this[_0x627d('0xf')][_0x627d('0x9c')](util['format'](_0x627d('0xe5'),_0x5996b4[_0x627d('0x66')]()),_0x21c8e7[_0x5996b4]);}}this[_0x627d('0xe4')](_0x21c8e7[_0x627d('0xe6')],'out','dialogflow','');return this['channel'][_0x627d('0xa7')](util['format'](_0x627d('0xe7'),_0x21c8e7[_0x627d('0xe6')]));}return this['channel']['error'](_0x8b886f,_0x627d('0xe8'));};AGIVertices[_0x627d('0x12')][_0x627d('0xe9')]=function(_0x1a1669){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0xea'),_0x1a1669[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x1a1669[_0x627d('0x78')])){return this[_0x627d('0xf')][_0x627d('0xa7')]('no\x20project_id\x20configured');}if(!this[_0x627d('0x7f')](_0x1a1669[_0x627d('0x79')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xeb'));}if(!this[_0x627d('0x7f')](_0x1a1669['private_key'])){return this[_0x627d('0xf')]['noop']('no\x20private_key\x20configured');}if(!this[_0x627d('0x7f')](_0x1a1669[_0x627d('0xec')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xed'));}if(!this[_0x627d('0x7f')](_0x1a1669[_0x627d('0x5b')])){return this['channel'][_0x627d('0xa7')](_0x627d('0xa5'));}this[_0x627d('0xf')][_0x627d('0xe3')]=!![];this[_0x627d('0x34')](_0x1a1669);this[_0x627d('0xe4')](_0x1a1669['text'],'in','','');this[_0x627d('0xf')][_0x627d('0xa7')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x1a1669[_0x627d('0x5b')]));var _0x2b754f=this[_0x627d('0xee')][_0x627d('0x6c')](this,_0x1a1669);if(_0x2b754f){for(var _0xc206f6 in _0x2b754f){if(_0x2b754f['hasOwnProperty'](_0xc206f6)){if(_0xc206f6!==_0x627d('0xef')){this[_0x627d('0xf')][_0x627d('0x9c')](util[_0x627d('0x53')](_0x627d('0xe5'),_0xc206f6[_0x627d('0x66')]()),_0x2b754f[_0xc206f6]);}}}this[_0x627d('0xe4')](_0x2b754f[_0x627d('0xe6')],_0x627d('0xf0'),_0x627d('0xe9'),_0x2b754f[_0x627d('0xef')]);return this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0xf1'),_0x2b754f[_0x627d('0xe6')]));}return this[_0x627d('0xf')][_0x627d('0x2b')](_0x1a1669,_0x627d('0xf2'));};AGIVertices[_0x627d('0x12')][_0x627d('0xf3')]=function(_0x52d77a){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x52d77a[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x52d77a['ndauth_url'])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xf4'));}if(!this[_0x627d('0x7f')](_0x52d77a['username'])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xf5'));}if(!this[_0x627d('0x7f')](_0x52d77a[_0x627d('0xf6')])){return this['channel'][_0x627d('0xa7')]('no\x20password\x20configured');}if(!this[_0x627d('0x7f')](_0x52d77a['ndassistant_url'])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xa5'));}this[_0x627d('0xf')]['bot']=!![];this[_0x627d('0x34')](_0x52d77a);this[_0x627d('0xe4')](_0x52d77a['text'],'in','','');this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0xf7'),_0x52d77a['text']));var _0x782d5e=this['sestekNDA'][_0x627d('0x6c')](this,_0x52d77a);if(_0x782d5e){for(var _0x23598a in _0x782d5e){if(_0x782d5e['hasOwnProperty'](_0x23598a)){this[_0x627d('0xf')][_0x627d('0x9c')](util['format'](_0x627d('0xf8'),_0x23598a[_0x627d('0x66')]()),_0x782d5e[_0x23598a]);}}this[_0x627d('0xe4')](_0x782d5e[_0x627d('0xe6')],_0x627d('0xf0'),_0x627d('0xf3'),'');if(_0x782d5e[_0x627d('0xf9')]){this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0xfa'),_0x782d5e[_0x627d('0xf9')]));var _0x13c5db=this[_0x627d('0xf')]['streamFile'](_0x782d5e[_0x627d('0xf9')]);try{fs[_0x627d('0xfb')](_0x782d5e[_0x627d('0xf9')]+_0x627d('0xfc'));}catch(_0x78784e){logger['error'](_0x78784e);}return _0x13c5db;}else{return this[_0x627d('0xf')][_0x627d('0xa7')](util['format']('SestekNDA\x20Result\x20%s',_0x782d5e['speech']));}}return this['channel'][_0x627d('0x2b')](_0x52d77a,_0x627d('0xfd'));};AGIVertices[_0x627d('0x12')][_0x627d('0xfe')]=function(_0x3283e4){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20END\x20(%s)\x20block',_0x3283e4[_0x627d('0x36')]));return this[_0x627d('0xf')][_0x627d('0xa7')]('end');};AGIVertices['prototype']['ext_dial']=function(_0x5d2de3){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5d2de3[_0x627d('0x36')]));var _0x30c5d3='';if(_0x5d2de3[_0x627d('0xff')]){if(!this[_0x627d('0x7f')](_0x5d2de3[_0x627d('0xff')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x5d2de3,_0x627d('0x100'));}else{var _0x52891f=parseInt(_0x5d2de3[_0x627d('0xff')],0xa);if(isNaN(_0x52891f)){_0x30c5d3=_0x5d2de3[_0x627d('0xff')];}else{_0x30c5d3=this[_0x627d('0x20')][_0x627d('0x6c')](this,_0x5d2de3[_0x627d('0xff')]);if(!_0x30c5d3){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x5d2de3,_0x627d('0x101'));}}}}else if(_0x5d2de3[_0x627d('0x102')]){_0x30c5d3=_0x5d2de3[_0x627d('0x102')];}else{return this[_0x627d('0xf')][_0x627d('0x2b')](_0x5d2de3,_0x627d('0x100'));}var _0xa42687=this[_0x627d('0xf')][_0x627d('0x56')](_0x627d('0x103'),[util['format'](_0x627d('0x104'),_0x30c5d3,_0x5d2de3[_0x627d('0x46')]),_0x5d2de3[_0x627d('0x64')],_0x5d2de3[_0x627d('0xe0')],_0x5d2de3['url']]);if(_0xa42687['result']===-0x1){return _0xa42687;}return this[_0x627d('0xf')]['noop'](util['format'](_0x627d('0x105'),_0x627d('0x103')));};AGIVertices['prototype']['finally']=function(_0x52c498){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x106'),_0x52c498['label']));return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x107'));};AGIVertices[_0x627d('0x12')][_0x627d('0xd')]=function(_0x36c094){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x108'),_0x36c094[_0x627d('0x36')]));if(_0x36c094[_0x627d('0xa4')]===0x0){return this[_0x627d('0xa3')](_0x36c094);}_0x36c094['retry']-=0x1;if(!this[_0x627d('0x7f')](_0x36c094[_0x627d('0x109')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x36c094,_0x627d('0x10a'));}var _0x3cbf4b=this[_0x627d('0x10b')][_0x627d('0x6c')](this,_0x36c094[_0x627d('0x109')]);if(!_0x3cbf4b){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x36c094,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x36c094['variable_id'])){return this[_0x627d('0xf')]['error'](_0x627d('0xd4'));}var _0x2116d2=this[_0x627d('0xf')][_0x627d('0x10c')](_0x3cbf4b,_0x36c094[_0x627d('0x10d')],_0x36c094[_0x627d('0x10e')]);var _0x4a5396=_0x2116d2[_0x627d('0xae')]?_0x2116d2['result'][_0x627d('0x49')]():'';logger['info'](_0x627d('0x10f'),JSON['stringify'](_0x2116d2));if(_0x2116d2[_0x627d('0xae')]===-0x1){this[_0x627d('0x34')]['sync'](this,_0x36c094,_0x4a5396);return _0x2116d2;}else if(_0x2116d2[_0x627d('0xa0')]==='timeout'){_0x2116d2[_0x627d('0xae')]=_0x4a5396[_0x627d('0x9b')]>=parseInt(_0x36c094['mindigit'])?'x':'i';}else{_0x2116d2[_0x627d('0xae')]=_0x4a5396['length']>=parseInt(_0x36c094[_0x627d('0x110')])&&_0x4a5396[_0x627d('0x9b')]<=parseInt(_0x36c094[_0x627d('0x10e')])?'x':'i';}var _0x292ed3=this[_0x627d('0x9f')][_0x627d('0x6c')](this,_0x36c094[_0x627d('0xd3')]);if(!_0x292ed3){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x36c094,_0x627d('0xd5'));}this[_0x627d('0xf')][_0x627d('0x9c')](_0x292ed3,_0x4a5396);if(this[_0x627d('0x7f')](_0x36c094[_0x627d('0x111')])){var _0x3d6c43=parseInt(_0x36c094[_0x627d('0x111')],0xa);var _0x3852f7=rs['generate']({'charset':'*','length':_0x3d6c43});var _0x5845d1=_0x4a5396[_0x627d('0x9b')];if(_0x5845d1>0x0){if(_0x5845d1>_0x3d6c43){this[_0x627d('0x34')][_0x627d('0x6c')](this,_0x36c094,_0x36c094['hiddendigitspos']===_0x627d('0x112')?_0x3852f7+_0x4a5396[_0x627d('0x113')](_0x3d6c43):_0x4a5396[_0x627d('0x113')](0x0,_0x5845d1-_0x3d6c43)+_0x3852f7);}else{this[_0x627d('0x34')][_0x627d('0x6c')](this,_0x36c094,rs[_0x627d('0x114')]({'charset':'*','length':_0x5845d1}));}}else{this[_0x627d('0x34')]['sync'](this,_0x36c094,'');}}else{this[_0x627d('0x34')][_0x627d('0x6c')](this,_0x36c094,_0x4a5396);}return _0x2116d2;};AGIVertices[_0x627d('0x12')][_0x627d('0xe')]=function(_0x2f81ce){logger[_0x627d('0x2e')](util['format'](_0x627d('0x115'),_0x2f81ce['label']));return this['getdigits'](_0x2f81ce);};AGIVertices[_0x627d('0x12')][_0x627d('0x116')]=function(_0x3c2393){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x117'),_0x3c2393[_0x627d('0x36')]));this['createSquareDetailsReport'][_0x627d('0x6c')](this,_0x3c2393,_0x3c2393['goalname']);return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x118'),_0x3c2393['goalname']));};AGIVertices[_0x627d('0x12')][_0x627d('0x119')]=function(_0x244fe0){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x244fe0[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x244fe0[_0x627d('0x88')])||!this['isConfigured'](_0x244fe0[_0x627d('0x82')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x11a'));}if(!this[_0x627d('0x7f')](_0x244fe0['text'])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xa5'));}this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0x11b'),_0x244fe0['text']));var _0xc4a70f=this[_0x627d('0x81')][_0x627d('0x6c')](this,_0x244fe0);if(_0xc4a70f){this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')]('aws\x20Polly\x20%s\x20file\x20created',_0xc4a70f));var _0x67c89b=this[_0x627d('0xf')][_0x627d('0x11c')](_0xc4a70f);try{fs[_0x627d('0xfb')](_0xc4a70f+_0x627d('0xfc'));}catch(_0x52d374){logger[_0x627d('0x2b')](_0x52d374);}return _0x67c89b;}return this[_0x627d('0xf')][_0x627d('0x2b')](_0x244fe0,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x627d('0x12')]['awslex']=function(_0x3e94ea){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x11d'),_0x3e94ea[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x3e94ea['aws_access_key_id'])||!this[_0x627d('0x7f')](_0x3e94ea[_0x627d('0x82')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x11a'));}if(!this[_0x627d('0x7f')](_0x3e94ea['aws_bot_name'])){return this[_0x627d('0xf')]['noop']('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x3e94ea[_0x627d('0x5b')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xa5'));}this[_0x627d('0xf')][_0x627d('0xe3')]=!![];this[_0x627d('0x34')](_0x3e94ea);this[_0x627d('0xe4')](_0x3e94ea[_0x627d('0x5b')],'in','','');this['channel']['noop'](util[_0x627d('0x53')](_0x627d('0x11e'),_0x3e94ea[_0x627d('0x5b')]));var _0x3d1778=this['awsLex'][_0x627d('0x6c')](this,_0x3e94ea);if(_0x3d1778){for(var _0x1a011f in _0x3d1778){if(_0x3d1778[_0x627d('0x92')](_0x1a011f)&&_[_0x627d('0x93')](_0x3d1778[_0x1a011f])){this['channel']['setVariable'](util['format'](_0x627d('0x11f'),_0x1a011f['toUpperCase']()),_0x3d1778[_0x1a011f]);}}if(_['isNil'](_0x3d1778['message'])){return this['channel'][_0x627d('0xa7')](_0x627d('0x120'));}else{this[_0x627d('0xe4')](_0x3d1778['message'],_0x627d('0xf0'),'amazonlex','');return this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0x121'),_0x3d1778[_0x627d('0x72')]));}}return this[_0x627d('0xf')][_0x627d('0x2b')](_0x3e94ea,_0x627d('0x122'));};AGIVertices[_0x627d('0x12')][_0x627d('0x123')]=function(_0x4b9b45){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x124'),_0x4b9b45['label'],_0x4b9b45[_0x627d('0x64')]));if(!this[_0x627d('0x7f')](_0x4b9b45[_0x627d('0x76')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x125'));}var _0x253450=_0x627d('0x126');var _0xb93406=util[_0x627d('0x53')](_0x627d('0x127'),FILES_PATH,rs[_0x627d('0x114')](0x4));var _0x5edce0=util[_0x627d('0x53')](_0x627d('0x99'),_0xb93406,_0x253450);var _0x55a3d3=!![];if(_0x4b9b45[_0x627d('0x128')]===_0x627d('0x129')){_0x55a3d3=![];}var _0x136a6e=this[_0x627d('0xf')][_0x627d('0x12a')](_0xb93406,_0x253450,_0x4b9b45['intKey'],_0x4b9b45[_0x627d('0x64')],undefined,_0x55a3d3);if(_0x136a6e[_0x627d('0xae')]!==-0x1){this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')]('google\x20%s\x20file\x20created',_0x5edce0));var _0x525ad2=this[_0x627d('0x8b')][_0x627d('0x6c')](this,_0x4b9b45,_0x5edce0);if(_0x525ad2){for(var _0x1d12f9 in _0x525ad2){if(_0x525ad2[_0x627d('0x92')](_0x1d12f9)){this[_0x627d('0xf')]['setVariable'](util['format'](_0x627d('0x12b'),_0x1d12f9[_0x627d('0x66')]()),_0x525ad2[_0x1d12f9]);}}return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x525ad2)));}}return _0x136a6e;};AGIVertices['prototype'][_0x627d('0x12c')]=function(_0x57a757){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x12d'),_0x57a757[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x57a757['appid'])){return this['channel'][_0x627d('0xa7')](_0x627d('0x12e'));}if(!this[_0x627d('0x7f')](_0x57a757[_0x627d('0x8f')])){return this[_0x627d('0xf')]['noop'](_0x627d('0x12f'));}var _0x358846=_0x627d('0x126');var _0x1cff87=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x3af154=util[_0x627d('0x53')](_0x627d('0x99'),_0x1cff87,_0x358846);var _0x5e84a2=!![];if(_0x57a757[_0x627d('0x128')]===_0x627d('0x129')){_0x5e84a2=![];}var _0x13a626=this['channel'][_0x627d('0x12a')](_0x1cff87,_0x358846,_0x57a757[_0x627d('0x130')],_0x57a757[_0x627d('0x64')],undefined,_0x5e84a2);if(_0x13a626[_0x627d('0xae')]!==-0x1){this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x131'),_0x3af154));var _0x379874=this[_0x627d('0x8d')][_0x627d('0x6c')](this,_0x57a757,_0x3af154);if(_0x379874){for(var _0x2d2062 in _0x379874){if(_0x379874[_0x627d('0x92')](_0x2d2062)){this[_0x627d('0xf')]['setVariable'](util[_0x627d('0x53')](_0x627d('0x132'),_0x2d2062[_0x627d('0x66')]()),_0x379874[_0x2d2062]);}}return this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x133'),JSON['stringify'](_0x379874)));}}return _0x13a626;};AGIVertices['prototype'][_0x627d('0x134')]=function(_0x151369){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x135'),_0x151369[_0x627d('0x36')]));return this['channel'][_0x627d('0x136')](_0x151369[_0x627d('0x137')],_0x151369[_0x627d('0x3b')],_0x151369['priority']);};AGIVertices['prototype'][_0x627d('0x138')]=function(_0x3f828e){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x139'),_0x3f828e[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x3f828e['condition'])){return this['channel'][_0x627d('0x2b')](_0x3f828e,_0x627d('0x13a'));}try{var _0x3f12a1=eval(_0x3f828e['condition'])?_0x627d('0x13b'):_0x627d('0x13c');this['channel'][_0x627d('0xa7')](util['format'](_0x627d('0x13d'),_0x3f828e[_0x627d('0x13e')],_0x3f12a1));return{'code':0xc8,'result':_0x3f12a1};}catch(_0x3f04cb){return{'code':0xc8,'result':_0x627d('0x13c')};}};AGIVertices[_0x627d('0x12')]['gotoiftime']=function(_0xc377fb){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x13f'),_0xc377fb[_0x627d('0x36')]));if(!this['isConfigured'](_0xc377fb[_0x627d('0x140')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0xc377fb,_0x627d('0x141'));}var _0x5aaf51=this[_0x627d('0x26')][_0x627d('0x6c')](this,_0xc377fb[_0x627d('0x140')]);if(!_0x5aaf51){return this['channel']['error'](_0xc377fb,_0x627d('0x142'));}for(var _0x308179=0x0;_0x308179<_0x5aaf51[_0x627d('0x9b')];_0x308179+=0x1){var _0x43519b=this[_0x627d('0xf')][_0x627d('0x9f')](util[_0x627d('0x53')](_0x627d('0x143'),_0x5aaf51[_0x308179]));if(_0x43519b[_0x627d('0xae')]===-0x1){return _0x43519b;}logger[_0x627d('0x2e')](util['format'](_0x627d('0x144'),_0x5aaf51[_0x308179],_0x43519b[_0x627d('0xa0')]));if(_0x43519b[_0x627d('0xa0')]===_0x627d('0x13b')){logger[_0x627d('0x2e')](util['format'](_0x627d('0x144'),_0x5aaf51[_0x308179],_0x627d('0x13b')));this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')]('IFTIME\x20%s\x20%s',_0x5aaf51[_0x308179],_0x627d('0x13b')));return{'code':0xc8,'result':_0x627d('0x13b')};}else{logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x5aaf51[_0x308179],_0x627d('0x13c')));this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0x144'),_0x5aaf51[_0x308179],'false'));}}return{'code':0xc8,'result':_0x627d('0x13c')};};AGIVertices[_0x627d('0x12')]['hangup']=function(_0xf1e5cd){logger[_0x627d('0x2e')](util['format'](_0x627d('0x145'),_0xf1e5cd[_0x627d('0x36')]));return this[_0x627d('0xf')]['hangup']();};AGIVertices[_0x627d('0x12')]['ispeechasr']=function(_0x57f873){logger[_0x627d('0x2e')](util['format'](_0x627d('0x146'),_0x57f873['label']));if(!this[_0x627d('0x7f')](_0x57f873['key'])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x125'));}var _0x2c97b5=_0x627d('0x126');var _0x48e476=util[_0x627d('0x53')](_0x627d('0x127'),FILES_PATH,rs[_0x627d('0x114')](0x4));var _0x6c2fc9=util['format'](_0x627d('0x99'),_0x48e476,_0x2c97b5);var _0x4f9c94=!![];if(_0x57f873['beep']===_0x627d('0x129')){_0x4f9c94=![];}var _0x2f52ff=this[_0x627d('0xf')]['recordFile'](_0x48e476,_0x2c97b5,_0x57f873['intKey'],_0x57f873['timeout'],undefined,_0x4f9c94);if(_0x2f52ff[_0x627d('0xae')]!==-0x1){this[_0x627d('0xf')][_0x627d('0xa7')](util['format'](_0x627d('0x147'),_0x6c2fc9));var _0x1b17a2=this[_0x627d('0x7d')][_0x627d('0x6c')](this,_0x57f873,_0x6c2fc9);if(_0x1b17a2){for(var _0x28453f in _0x1b17a2){if(_0x1b17a2[_0x627d('0x92')](_0x28453f)){this[_0x627d('0xf')][_0x627d('0x9c')](util['format']('ISPEECH_ASR_%s',_0x28453f[_0x627d('0x66')]()),_0x1b17a2[_0x28453f]);}}return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x148'),JSON[_0x627d('0x6f')](_0x1b17a2)));}}return _0x2f52ff;};AGIVertices[_0x627d('0x12')][_0x627d('0x149')]=function(_0x4b833e){logger['info'](util[_0x627d('0x53')](_0x627d('0x14a'),_0x4b833e[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x4b833e[_0x627d('0x76')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x125'));}if(!this['isConfigured'](_0x4b833e['text'])){return this['channel'][_0x627d('0xa7')](_0x627d('0xa5'));}this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')]('Trying\x20ispeech\x20TTS\x20%s',_0x4b833e[_0x627d('0x5b')]));var _0x51bce4=this['ispeechTTS'][_0x627d('0x6c')](this,_0x4b833e);if(_0x51bce4){this['channel']['noop'](util[_0x627d('0x53')](_0x627d('0x147'),_0x51bce4));var _0x383096=this[_0x627d('0xf')][_0x627d('0x11c')](_0x51bce4,_0x4b833e['intKey']);try{fs[_0x627d('0xfb')](_0x51bce4+_0x627d('0xfc'));}catch(_0x16484d){logger['error'](_0x16484d);}return _0x383096;}return this[_0x627d('0xf')][_0x627d('0x2b')](_0x4b833e,_0x627d('0x14b'));};AGIVertices[_0x627d('0x12')]['login']=function(_0x1cafaa){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x14c'),_0x1cafaa[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x1cafaa['findBy'])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x1cafaa,_0x627d('0x14d'));}logger[_0x627d('0x2e')](util[_0x627d('0x53')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x627d('0xf')]['callerid'],_0x1cafaa['findBy']));var _0x4a3764=this['agentLogin'][_0x627d('0x6c')](this,_0x1cafaa['findBy']);if(_0x4a3764){logger['info'](util[_0x627d('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x627d('0xf')][_0x627d('0x38')],_0x1cafaa[_0x627d('0x14e')]));this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0x14f'),this['channel']['callerid'],_0x1cafaa[_0x627d('0x14e')]));return{'code':0xc8,'result':_0x627d('0x150')};}else{logger['info'](util['format'](_0x627d('0x151'),this[_0x627d('0xf')]['callerid'],_0x1cafaa[_0x627d('0x14e')]));this[_0x627d('0xf')][_0x627d('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x627d('0x38')],_0x1cafaa['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x627d('0x152')]=function(_0x3cd2f2){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x153'),_0x3cd2f2[_0x627d('0x36')]));if(!this['isConfigured'](_0x3cd2f2[_0x627d('0x14e')])){return this[_0x627d('0xf')]['error'](_0x3cd2f2,_0x627d('0x14d'));}logger['info'](util[_0x627d('0x53')](_0x627d('0x154'),this[_0x627d('0xf')][_0x627d('0x38')],_0x3cd2f2[_0x627d('0x14e')]));var _0xd46690=this[_0x627d('0x50')]['sync'](this,_0x3cd2f2[_0x627d('0x14e')]);if(_0xd46690){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x14f'),this[_0x627d('0xf')][_0x627d('0x38')],_0x3cd2f2[_0x627d('0x14e')]));this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x14f'),this['channel']['callerid'],_0x3cd2f2[_0x627d('0x14e')]));return{'code':0xc8,'result':_0x627d('0x150')};}else{logger[_0x627d('0x2e')](util['format'](_0x627d('0x151'),this[_0x627d('0xf')]['callerid'],_0x3cd2f2['findBy']));this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0x151'),this[_0x627d('0xf')]['callerid'],_0x3cd2f2[_0x627d('0x14e')]));return{'code':0xc8,'result':_0x627d('0x155')};}};AGIVertices[_0x627d('0x12')][_0x627d('0x156')]=function(_0x22952a){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x157'),_0x22952a[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x22952a['operation'])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x22952a,_0x627d('0x158'));}this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x159'),_0x22952a['operation']));var _0x9fe290=eval(_0x22952a[_0x627d('0x15a')]);if(!this[_0x627d('0x7f')](_0x22952a[_0x627d('0xd3')])){return this['channel'][_0x627d('0xa7')](_0x627d('0xd4'));}var _0x2e2b83=this[_0x627d('0x9f')][_0x627d('0x6c')](this,_0x22952a['variable_id']);if(!_0x2e2b83){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x22952a,_0x627d('0xd5'));}if(_[_0x627d('0x9a')](_0x9fe290)){var _0x1be378=this;_0x9fe290['forEach'](function(_0x498d1,_0x4a6338){_0x1be378['channel']['setVariable'](util[_0x627d('0x53')]('%s[%s]',_0x2e2b83,_0x4a6338),_0x498d1);});return this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')]('variable\x20%s[key]\x20set',_0x2e2b83));}else{return this[_0x627d('0xf')][_0x627d('0x9c')](_0x2e2b83,_0x9fe290);}};AGIVertices[_0x627d('0x12')][_0x627d('0xc')]=function(_0x679e91){logger['info'](util['format'](_0x627d('0x15b'),_0x679e91[_0x627d('0x36')]));if(_0x679e91[_0x627d('0xa4')]===0x0){return this['maxRetry'](_0x679e91);}_0x679e91[_0x627d('0xa4')]-=0x1;if(!this[_0x627d('0x7f')](_0x679e91[_0x627d('0x109')])){return this[_0x627d('0xf')]['error'](_0x679e91,_0x627d('0x10a'));}var _0x3dfbbe=this['getSound'][_0x627d('0x6c')](this,_0x679e91[_0x627d('0x109')]);if(!_0x3dfbbe){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x679e91,_0x627d('0x15c'));}var _0x3dd813=this[_0x627d('0xf')]['getData'](_0x3dfbbe,_0x679e91[_0x627d('0x10d')],_0x679e91[_0x627d('0x15d')]);var _0x3e2cde=_0x3dd813[_0x627d('0xae')];if(_0x3dd813[_0x627d('0xae')]===-0x1){this[_0x627d('0x34')][_0x627d('0x6c')](this,_0x679e91,'-1');return _0x3dd813;}else if(_0x3dd813[_0x627d('0xa0')]==='timeout'){_0x3dd813[_0x627d('0xae')]=_0x3dd813[_0x627d('0xae')][_0x627d('0x9b')]>0x0?_0x3dd813[_0x627d('0xae')]:'t';}else if(_[_0x627d('0x42')](_0x3dd813[_0x627d('0xae')])){_0x3dd813[_0x627d('0xae')]='#';_0x3e2cde='#';}if(!this[_0x627d('0x7f')](_0x679e91[_0x627d('0xd3')])){this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xd4'));}else{var _0x5f3a24=this[_0x627d('0x9f')][_0x627d('0x6c')](this,_0x679e91[_0x627d('0xd3')]);if(!_0x5f3a24){return this[_0x627d('0xf')]['error'](_0x679e91,_0x627d('0xd5'));}this[_0x627d('0xf')]['setVariable'](_0x5f3a24,_0x3e2cde);}this['createSquareDetailsReport'][_0x627d('0x6c')](this,_0x679e91,_0x3e2cde);return _0x3dd813;};AGIVertices[_0x627d('0x12')]['noop']=function(_0x45a452){logger['info'](util['format'](_0x627d('0x15e'),_0x45a452[_0x627d('0x36')]));return this[_0x627d('0xf')][_0x627d('0xa7')](_0x45a452[_0x627d('0x15f')]||_0x45a452[_0x627d('0x36')]);};AGIVertices[_0x627d('0x12')][_0x627d('0x160')]=function(_0x269bdc){logger['info'](util[_0x627d('0x53')](_0x627d('0x161'),_0x269bdc[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x269bdc[_0x627d('0x14e')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x269bdc,_0x627d('0x14d'));}logger[_0x627d('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x627d('0xf')][_0x627d('0x38')],_0x269bdc[_0x627d('0x14e')]));var _0x4ad513=this[_0x627d('0x4b')]['sync'](this,_0x269bdc['pause_id']);var _0xd090aa=this[_0x627d('0x4d')][_0x627d('0x6c')](this,_0x269bdc[_0x627d('0x14e')],_0x4ad513);if(_0xd090aa){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x14f'),this[_0x627d('0xf')][_0x627d('0x38')],_0x269bdc['findBy']));this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x14f'),this['channel']['callerid'],_0x269bdc[_0x627d('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x151'),this[_0x627d('0xf')][_0x627d('0x38')],_0x269bdc[_0x627d('0x14e')]));this[_0x627d('0xf')][_0x627d('0xa7')](util['format'](_0x627d('0x14f'),this[_0x627d('0xf')][_0x627d('0x38')],_0x269bdc[_0x627d('0x14e')]));return{'code':0xc8,'result':_0x627d('0x155')};}};AGIVertices[_0x627d('0x12')][_0x627d('0x162')]=function(_0x33d395){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x33d395[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x33d395[_0x627d('0x109')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x33d395,'no\x20file\x20audio\x20selected');}var _0x125bab=this[_0x627d('0x10b')][_0x627d('0x6c')](this,_0x33d395[_0x627d('0x109')]);if(!_0x125bab){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x33d395,'no\x20file\x20audio\x20found');}var _0x1cf44f=this[_0x627d('0xf')]['exec'](_0x627d('0x163'),[_0x125bab,_0x33d395[_0x627d('0xe0')]]);if(_0x1cf44f[_0x627d('0xae')]===-0x1){return _0x1cf44f;}return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')]('Executed\x20command\x20%s\x20%s',_0x627d('0x163'),_0x125bab));};AGIVertices[_0x627d('0x12')][_0x627d('0x164')]=function(_0x1e8b27){logger[_0x627d('0x2e')](util['format'](_0x627d('0x165'),_0x1e8b27[_0x627d('0x36')]));if(!this['isConfigured'](_0x1e8b27[_0x627d('0x166')])){return this['channel'][_0x627d('0x2b')](_0x1e8b27,_0x627d('0x167'));}var _0x486ef4='';var _0x5e1324=parseInt(_0x1e8b27[_0x627d('0x166')],0xa);if(isNaN(_0x5e1324)){_0x486ef4=_0x1e8b27['queue_id'];}else{_0x486ef4=this[_0x627d('0x17')][_0x627d('0x6c')](this,_0x1e8b27['queue_id']);if(!_0x486ef4){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x1e8b27,_0x627d('0x168'));}}var _0x57343a='';if(this[_0x627d('0x7f')](_0x1e8b27['file_id'])){var _0x3af5bd=this[_0x627d('0x10b')][_0x627d('0x6c')](this,_0x1e8b27[_0x627d('0x109')]);if(_0x3af5bd){_0x57343a=_0x3af5bd;}}this[_0x627d('0x34')][_0x627d('0x6c')](this,_0x1e8b27,_0x486ef4);if(_0x1e8b27[_0x627d('0xe0')][_0x627d('0x169')]('x')<0x0){_0x1e8b27['opts']+='x';}if(_0x1e8b27[_0x627d('0xe0')][_0x627d('0x169')]('X')<0x0){_0x1e8b27[_0x627d('0xe0')]+='X';}this[_0x627d('0xf')][_0x627d('0x9c')](_0x627d('0x16a'),_0x486ef4?_0x486ef4[_0x627d('0x16b')]():'');var _0x5a40d2=this[_0x627d('0xf')][_0x627d('0x56')](_0x627d('0x16c'),[_0x486ef4,_0x1e8b27[_0x627d('0xe0')],_0x1e8b27['url'],_0x57343a,_0x1e8b27[_0x627d('0x64')],_0x1e8b27[_0x627d('0x7')],_0x1e8b27[_0x627d('0x16d')],_0x1e8b27['gosub'],'',_0x1e8b27['position']]);if(_0x5a40d2['result']===-0x1){return _0x5a40d2;}return this['channel']['noop'](util[_0x627d('0x53')](_0x627d('0xc1'),_0x627d('0x16c'),_0x486ef4));};AGIVertices[_0x627d('0x12')][_0x627d('0x16e')]=function(_0xb4c440){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x16f'),_0xb4c440[_0x627d('0x36')]));var _0x24e990=_0xb4c440[_0x627d('0x170')]||_0x627d('0x126');var _0x5d058b=util[_0x627d('0x53')](_0x627d('0x171'),this[_0x627d('0xf')][_0x627d('0x35')],rs['generate'](0x5));var _0xd3e4a9=util['format'](_0x627d('0x172'),FILES_PATH,_0x5d058b,_0x24e990);var _0x594fb0=util['format'](_0x627d('0x127'),FILES_PATH,_0x5d058b);this['createSquareRecording'][_0x627d('0x6c')](this,_0xb4c440,_0x5d058b,_0xd3e4a9);this[_0x627d('0xf')]['setVariable'](_0x627d('0x173'),_0x5d058b);logger[_0x627d('0x2e')](_0x627d('0x174'),_0x594fb0,_0x24e990,_0xb4c440[_0x627d('0x175')],_0xb4c440['timeout']);return this[_0x627d('0xf')]['recordFile'](_0x594fb0,_0x24e990,_0xb4c440[_0x627d('0x175')],_0xb4c440[_0x627d('0x64')],undefined,!![]);};AGIVertices[_0x627d('0x12')]['restapi']=function(_0xc5f33){logger['info'](util[_0x627d('0x53')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xc5f33[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0xc5f33['url'])){return this[_0x627d('0xf')][_0x627d('0xa7')]('no\x20url\x20configured');}var _0x321f20=this[_0x627d('0x62')][_0x627d('0x6c')](this,_0xc5f33);logger['info'](util[_0x627d('0x53')](_0x627d('0x176'),util['inspect'](_0x321f20,{'showHidden':![],'depth':null})));if(!this[_0x627d('0x7f')](_0xc5f33[_0x627d('0xd3')])){return this['channel'][_0x627d('0xa7')](_0x627d('0x177'));}var _0x49585a=this[_0x627d('0x9f')][_0x627d('0x6c')](this,_0xc5f33[_0x627d('0xd3')]);if(!_0x49585a){return this['channel'][_0x627d('0x2b')](_0xc5f33,'no\x20variable\x20found');}this['channel'][_0x627d('0x9c')](util[_0x627d('0x53')](_0x627d('0x178'),_0x49585a),_0x321f20[_0x627d('0x71')]?_0x321f20[_0x627d('0x71')]:'200');this[_0x627d('0xf')]['setVariable'](util[_0x627d('0x53')](_0x627d('0x179'),_0x49585a),_0x321f20[_0x627d('0x17a')]?_0x321f20[_0x627d('0x17a')]:'OK');if(_0x321f20[_0x627d('0x67')]){try{this[_0x627d('0x97')](_0x321f20['body'],_0x49585a);}catch(_0x924d87){logger[_0x627d('0x2b')](util[_0x627d('0x53')](_0x627d('0x17b'),_0x49585a));}}return this[_0x627d('0xf')]['noop'](util[_0x627d('0x53')](_0x627d('0xd9'),_0x49585a));};AGIVertices[_0x627d('0x12')][_0x627d('0x17c')]=function(_0x2341ba){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x17d'),_0x2341ba[_0x627d('0x36')]));return this[_0x627d('0xf')][_0x627d('0x17e')](_0x2341ba[_0x627d('0x17f')][_0x627d('0x58')](/\s+/g,''),_0x2341ba[_0x627d('0x175')]);};AGIVertices[_0x627d('0x12')]['saynumber']=function(_0x47c244){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x180'),_0x47c244['label']));return this[_0x627d('0xf')]['sayNumber'](_0x47c244['number'][_0x627d('0x58')](/\s+/g,''),_0x47c244[_0x627d('0x175')]);};AGIVertices[_0x627d('0x12')][_0x627d('0x181')]=function(_0x4fea22){logger[_0x627d('0x2e')](util['format'](_0x627d('0x182'),_0x4fea22[_0x627d('0x36')]));return this[_0x627d('0xf')]['sayPhonetic'](_0x4fea22[_0x627d('0x5b')],_0x4fea22[_0x627d('0x175')]);};AGIVertices[_0x627d('0x12')]['sendMail']=function(_0x275e99){logger[_0x627d('0x2e')](util['format'](_0x627d('0x183'),_0x275e99[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x275e99['account_id'])){return this[_0x627d('0xf')]['noop'](_0x627d('0x184'));}var _0x33b211=this[_0x627d('0x23')][_0x627d('0x6c')](this,_0x275e99[_0x627d('0x185')]);if(!_0x33b211||!_0x33b211[_0x627d('0x186')]){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x275e99,'no\x20mail\x20account\x20found');}var _0x4d6215={'from':util[_0x627d('0x53')](_0x627d('0x187'),_0x33b211[_0x627d('0x15')],_0x33b211[_0x627d('0x188')]||_0x33b211[_0x627d('0x186')][_0x627d('0x189')]),'to':_0x275e99['to']||'','cc':_0x275e99['cc']||'','bcc':_0x275e99['bcc']||'','subject':_0x275e99[_0x627d('0x18a')],'html':_0x275e99[_0x627d('0x5b')],'text':_0x275e99[_0x627d('0x5b')]};var _0x5e47bb={'tls':{'rejectUnauthorized':![]}};if(_0x33b211[_0x627d('0x186')][_0x627d('0x18b')]){_0x5e47bb[_0x627d('0x18b')]=_0x33b211[_0x627d('0x186')]['service'];}else{_0x5e47bb[_0x627d('0x18c')]=_0x33b211[_0x627d('0x186')][_0x627d('0x18c')];_0x5e47bb[_0x627d('0x18d')]=_0x33b211[_0x627d('0x186')][_0x627d('0x18d')];_0x5e47bb[_0x627d('0x18e')]=_0x33b211[_0x627d('0x186')][_0x627d('0x18e')];}if(_0x33b211[_0x627d('0x186')]['authentication']){_0x5e47bb[_0x627d('0x18f')]={'user':_0x33b211[_0x627d('0x186')][_0x627d('0x189')],'pass':_0x33b211[_0x627d('0x186')][_0x627d('0x190')]};}if(this[_0x627d('0x7f')](_0x275e99['template_id'])){}logger[_0x627d('0xdb')](_0x627d('0x191'),JSON[_0x627d('0x6f')](_0x4d6215));this['createSquareDetailsReport'][_0x627d('0x6c')](this,_0x275e99,_0x275e99[_0x627d('0x185')]);this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x192'),_0x33b211[_0x627d('0x15')]));this['sendMailMessage'][_0x627d('0x6c')](this,_0x5e47bb,_0x4d6215);return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x193'));};AGIVertices[_0x627d('0x12')][_0x627d('0x194')]=function(_0x507c3a){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x195'),_0x507c3a[_0x627d('0x36')]));return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x196'));};AGIVertices[_0x627d('0x12')][_0x627d('0x197')]=function(_0x2e0db3){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x198'),_0x2e0db3['label']));if(!this[_0x627d('0x7f')](_0x2e0db3[_0x627d('0x199')])){return this[_0x627d('0xf')][_0x627d('0xa7')]('no\x20sms\x20account\x20configured');}var _0x581cf4=this['getSmsAccount'][_0x627d('0x6c')](this,_0x2e0db3[_0x627d('0x199')]);if(!_0x581cf4){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x2e0db3,'no\x20sms\x20account\x20found');}var _0x4219b4={'body':_0x2e0db3[_0x627d('0x19a')],'phone':_0x2e0db3['to']||'','SmsAccountId':_0x581cf4['id']};logger[_0x627d('0xdb')](_0x627d('0x19b'),JSON[_0x627d('0x6f')](_0x4219b4));this['createSquareDetailsReport'][_0x627d('0x6c')](this,_0x2e0db3,_0x2e0db3[_0x627d('0x199')]);this[_0x627d('0xf')][_0x627d('0xa7')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x581cf4['name']));this[_0x627d('0x33')][_0x627d('0x6c')](this,_0x4219b4);return this[_0x627d('0xf')][_0x627d('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x627d('0x12')][_0x627d('0x19c')]=function(_0x45bcb1){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x19d'),_0x45bcb1[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x45bcb1[_0x627d('0xd3')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x45bcb1,_0x627d('0x19e'));}var _0x862f82=this['getVariable'][_0x627d('0x6c')](this,_0x45bcb1['variable_id']);if(!_0x862f82){return this['channel'][_0x627d('0x2b')](_0x45bcb1,_0x627d('0xd5'));}return this['channel'][_0x627d('0x9c')](_0x862f82,_0x45bcb1[_0x627d('0x19f')]);};AGIVertices[_0x627d('0x12')]['start']=function(_0x5541fd){logger['info'](util[_0x627d('0x53')](_0x627d('0x1a0'),_0x5541fd['label']));this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x1a1'));if(_0x5541fd[_0x627d('0xb9')]===_0x627d('0x1a2')){this['channel'][_0x627d('0xa7')](_0x627d('0x1a3'));return this[_0x627d('0xf')][_0x627d('0xb9')]();}return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0x1a4'));};AGIVertices[_0x627d('0x12')][_0x627d('0x1a5')]=function(_0x109a38){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x109a38[_0x627d('0x36')]));if(!this[_0x627d('0x7f')](_0x109a38[_0x627d('0x1a6')])){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x109a38,_0x627d('0x1a7'));}var _0x437337=this[_0x627d('0x19')][_0x627d('0x6c')](this,_0x109a38['project_id']);if(!this[_0x627d('0x7f')](_0x437337)){return this[_0x627d('0xf')][_0x627d('0x2b')](_0x109a38,util['format'](_0x627d('0x1a8'),_0x109a38['project_id']));}if(_0x437337===this['channel']['arg_1']){return this[_0x627d('0xf')]['error'](_0x109a38,_0x627d('0x1a9'));}this[_0x627d('0x34')][_0x627d('0x6c')](this,_0x109a38,_0x437337);var _0xd6f715=this['channel']['exec']('AGI',util[_0x627d('0x53')](_0x627d('0x1aa'),config['agi'][_0x627d('0x18c')]||_0x627d('0x1ab'),_0x437337,this[_0x627d('0xf')]['arg_1']));if(_0xd6f715['result']===-0x1){return _0xd6f715;}return this[_0x627d('0xf')][_0x627d('0xa7')](util['format'](_0x627d('0xc1'),_0x627d('0x1ac'),_0x437337));};AGIVertices['prototype'][_0x627d('0x1ad')]=function(_0x2bd2c1){logger[_0x627d('0x2e')](util[_0x627d('0x53')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2bd2c1[_0x627d('0x36')]));var _0x5f1b10=this[_0x627d('0x55')][_0x627d('0x6c')](this,_0x2bd2c1['command']);this['createSquareDetailsReport'][_0x627d('0x6c')](this,_0x2bd2c1,_0x2bd2c1['command']);if(this[_0x627d('0x7f')](_0x2bd2c1[_0x627d('0xd3')])){var _0x303309=this[_0x627d('0x9f')][_0x627d('0x6c')](this,_0x2bd2c1[_0x627d('0xd3')]);if(_0x303309){this['channel']['setVariable'](_0x303309,_0x5f1b10);return this['channel']['noop'](util[_0x627d('0x53')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2bd2c1[_0x627d('0x1ae')],_0x303309));}}return this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x1af'),_0x2bd2c1[_0x627d('0x1ae')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x3eaaab){logger[_0x627d('0x2e')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3eaaab[_0x627d('0x36')]));_0x3eaaab[_0x627d('0x5b')]=_0x3eaaab[_0x627d('0x5b')][_0x627d('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x627d('0x7f')](_0x3eaaab[_0x627d('0x5a')])){return this[_0x627d('0xf')]['noop'](_0x627d('0x1b0'));}if(!this[_0x627d('0x7f')](_0x3eaaab['text'])){return this['channel'][_0x627d('0xa7')](_0x627d('0xa5'));}this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x1b1'),_0x3eaaab[_0x627d('0x5b')]));var _0x3845a7=this[_0x627d('0x59')][_0x627d('0x6c')](this,_0x3eaaab);if(_0x3845a7){this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')](_0x627d('0x1b2'),_0x3845a7));var _0x100120=this['channel']['streamFile'](_0x3845a7);try{fs[_0x627d('0xfb')](_0x3845a7+_0x627d('0xfc'));}catch(_0x3542d6){logger[_0x627d('0x2b')](_0x3542d6);}return _0x100120;}return this['channel']['error'](_0x3eaaab,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x627d('0x12')][_0x627d('0x1b3')]=function(_0x2396de){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x1b4'),_0x2396de[_0x627d('0x36')]));_0x2396de[_0x627d('0x5b')]=_0x2396de[_0x627d('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x627d('0x7f')](_0x2396de[_0x627d('0x5b')])){return this[_0x627d('0xf')][_0x627d('0xa7')](_0x627d('0xa5'));}this[_0x627d('0xf')][_0x627d('0xa7')](util[_0x627d('0x53')]('Trying\x20Google\x20TTS\x20%s',_0x2396de['text']));var _0x109a5a=this[_0x627d('0x60')]['sync'](this,_0x2396de);if(_0x109a5a){this[_0x627d('0xf')][_0x627d('0xa7')](util['format'](_0x627d('0x1b5'),_0x109a5a));var _0x7b1dfc=this[_0x627d('0xf')][_0x627d('0x11c')](_0x109a5a);try{fs[_0x627d('0xfb')](_0x109a5a+_0x627d('0xfc'));}catch(_0x16503d){logger[_0x627d('0x2b')](_0x16503d);}return _0x7b1dfc;}return this['channel'][_0x627d('0x2b')](_0x2396de,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x627d('0x12')][_0x627d('0x1b6')]=function(_0x16adf2){logger['info'](util[_0x627d('0x53')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x16adf2['label']));if(!this[_0x627d('0x7f')](_0x16adf2[_0x627d('0x14e')])){return this[_0x627d('0xf')]['error'](_0x16adf2,'no\x20find\x20by\x20configured');}logger[_0x627d('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x627d('0xf')][_0x627d('0x38')],_0x16adf2['findBy']));var _0x856853=this[_0x627d('0x4f')][_0x627d('0x6c')](this,_0x16adf2[_0x627d('0x14e')]);if(_0x856853){logger[_0x627d('0x2e')](util[_0x627d('0x53')](_0x627d('0x14f'),this['channel'][_0x627d('0x38')],_0x16adf2[_0x627d('0x14e')]));this['channel']['noop'](util[_0x627d('0x53')](_0x627d('0x14f'),this[_0x627d('0xf')][_0x627d('0x38')],_0x16adf2[_0x627d('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x627d('0x2e')](util['format'](_0x627d('0x151'),this[_0x627d('0xf')][_0x627d('0x38')],_0x16adf2[_0x627d('0x14e')]));this[_0x627d('0xf')][_0x627d('0xa7')](util['format'](_0x627d('0x151'),this['channel'][_0x627d('0x38')],_0x16adf2[_0x627d('0x14e')]));return{'code':0xc8,'result':_0x627d('0x155')};}};AGIVertices[_0x627d('0x12')]['voicemail']=function(_0x2d5da4){logger[_0x627d('0x2e')](util['format'](_0x627d('0x1b7'),_0x2d5da4[_0x627d('0x36')]));var _0x339594=this[_0x627d('0xf')][_0x627d('0x56')](_0x627d('0x1b8'),[_0x2d5da4[_0x627d('0x1b9')],_0x2d5da4[_0x627d('0x74')]]);if(_0x339594[_0x627d('0xae')]===-0x1){return _0x339594;}return this['channel'][_0x627d('0xa7')](util[_0x627d('0x53')]('Executed\x20command\x20%s\x20%s',_0x627d('0x1b8'),_0x2d5da4[_0x627d('0x1b9')]));};AGIVertices[_0x627d('0x12')]['vswitch']=function(_0xaec172){logger['info'](util[_0x627d('0x53')](_0x627d('0x1ba'),_0xaec172['label']));if(!this[_0x627d('0x7f')](_0xaec172['variable_id'])){return this[_0x627d('0xf')]['error'](_0xaec172,_0x627d('0x19e'));}var _0x1b981b=this[_0x627d('0x9f')][_0x627d('0x6c')](this,_0xaec172[_0x627d('0xd3')]);if(!_0x1b981b){return this[_0x627d('0xf')][_0x627d('0x2b')](_0xaec172,_0x627d('0xd5'));}var _0x2dab22=this['channel']['getVariable'](_0x1b981b);return{'code':0xc8,'result':_0x2dab22[_0x627d('0xa0')]?_0x2dab22[_0x627d('0xa0')]:'-'};};String[_0x627d('0x12')][_0x627d('0x9e')]=function(_0x23fa6a,_0x314df0){return this['split'](_0x23fa6a)[_0x627d('0x1bb')](_0x314df0);};module[_0x627d('0x1bc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8015a4b..e5be849 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 _0xf17a=['mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','timer','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','destlinkedid','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','startAcw','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','channels','interface','queue','ACW','mandatoryDisposition'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xf17a,0x1aa));var _0xaf17=function(_0x2c90d4,_0x5abd07){_0x2c90d4=_0x2c90d4-0x0;var _0x1cbdfc=_0xf17a[_0x2c90d4];return _0x1cbdfc;};'use strict';var util=require(_0xaf17('0x0'));var _=require(_0xaf17('0x1'));var moment=require(_0xaf17('0x2'));var ami=require(_0xaf17('0x3'));var logger=require(_0xaf17('0x4'))(_0xaf17('0x5'));var RpcUser=require(_0xaf17('0x6'));var RpcVoiceAgentReport=require(_0xaf17('0x7'));function Acw(_0x394100){this[_0xaf17('0x8')]=_0x394100['voiceQueues'];this[_0xaf17('0x9')]=_0x394100[_0xaf17('0x9')];this[_0xaf17('0xa')]=_0x394100[_0xaf17('0xa')];this['channels']={};ami['on'](_0xaf17('0xb'),this[_0xaf17('0xc')][_0xaf17('0xd')](this));ami['on'](_0xaf17('0xe'),this[_0xaf17('0xf')][_0xaf17('0xd')](this));ami['on'](_0xaf17('0x10'),this[_0xaf17('0x11')][_0xaf17('0xd')](this));ami['on'](_0xaf17('0x12'),this[_0xaf17('0x13')][_0xaf17('0xd')](this));ami['on'](_0xaf17('0x14'),this[_0xaf17('0x15')][_0xaf17('0xd')](this));ami['on'](_0xaf17('0x16'),this[_0xaf17('0x17')][_0xaf17('0xd')](this));ami['on'](_0xaf17('0x18'),this[_0xaf17('0x19')]['bind'](this));}function getDiff(_0x1a5588){var _0x53a0b9=moment()[_0xaf17('0x1a')](0x0);var _0x155db5=moment(_0x1a5588)[_0xaf17('0x1a')](0x0);return _0x53a0b9[_0xaf17('0x1b')](_0x155db5,_0xaf17('0x1c'));}Acw['prototype']['startAcw']=function(_0x226051){try{var _0x193884=this;var _0x36598c=this[_0xaf17('0x1d')][_0x226051][_0xaf17('0x1e')];var _0x418695=this[_0xaf17('0x1d')][_0x226051][_0xaf17('0x1f')];var _0x2e44db=this[_0xaf17('0x8')][_0x418695];var _0x582c2b=![];var _0x25410f=_0xaf17('0x20');if(_0x2e44db[_0xaf17('0x21')]){if(_0x2e44db[_0xaf17('0x22')][_0xaf17('0x23')]){_0x582c2b=!![];_0x25410f=_0x2e44db[_0xaf17('0x22')][_0xaf17('0x23')];}}ami[_0xaf17('0x24')]({'action':_0xaf17('0x25'),'interface':_0x36598c,'paused':!![],'reason':_0x25410f})[_0xaf17('0x26')](function(_0x3643eb){if(_0x193884[_0xaf17('0x9')][_0x36598c]){return RpcUser[_0xaf17('0x27')](_0x193884[_0xaf17('0x9')][_0x36598c]['id'])[_0xaf17('0x26')](function(_0x22b2f9){if(_0x22b2f9&&!_0x22b2f9[_0xaf17('0x28')]){logger[_0xaf17('0x29')](_0xaf17('0x2a'),_0x226051,_0x36598c,_0x418695);var _0x492bba=_0x193884[_0xaf17('0x1d')][_0x226051]['attended']&&_0x193884['channels'][_0x226051]['destlinkedid']?_0x193884['channels'][_0x226051]['destlinkedid']:_0x226051;return RpcUser[_0xaf17('0x2b')](_0x193884[_0xaf17('0x9')][_0x36598c],_0x25410f,_0x492bba)[_0xaf17('0x26')](function(_0x1f6287){if(!_0x582c2b){_0x193884[_0xaf17('0xa')][_0x36598c]={};logger[_0xaf17('0x29')](_0xaf17('0x2c'),_0x226051,_0x193884[_0xaf17('0x8')][_0x418695][_0xaf17('0x2d')],_0x36598c,_0x418695);_0x193884['timers'][_0x36598c]['timer']=setTimeout(_0x193884[_0xaf17('0x2e')]['bind'](_0x193884,_0x36598c),_0x193884['voiceQueues'][_0x418695][_0xaf17('0x2d')]*0x3e8);_0x193884[_0xaf17('0xa')][_0x36598c][_0xaf17('0x2f')]=moment()[_0xaf17('0x30')](_0xaf17('0x31'));_0x193884[_0xaf17('0xa')][_0x36598c][_0xaf17('0x32')]=_0x226051;_0x193884[_0xaf17('0xa')][_0x36598c][_0xaf17('0x1f')]=_0x418695;_0x193884[_0xaf17('0xa')][_0x36598c]['updateAcw']=function(){var _0x3dc192=getDiff(_0x193884[_0xaf17('0xa')][_0x36598c]['lastPauseAt']);clearTimeout(_0x193884[_0xaf17('0xa')][_0x36598c]['timer']);_0x193884[_0xaf17('0xa')][_0x36598c][_0xaf17('0x33')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x3dc192},_0x193884[_0xaf17('0xa')][_0x36598c][_0xaf17('0x32')],_0x36598c)[_0xaf17('0x26')](function(_0x4055f9){logger[_0xaf17('0x29')]('[%s][UPDATE][ACWTIME:%s]',_0x226051,_0x3dc192,_0x4055f9);})[_0xaf17('0x34')](function(_0x308741){logger[_0xaf17('0x35')](_0xaf17('0x36'),_0x226051,_0x308741);});delete _0x193884['timers'][_0x36598c];};}});}else{logger[_0xaf17('0x29')](_0xaf17('0x37'),_0x226051,_0x36598c,_0x418695);}});}})[_0xaf17('0x34')](function(_0x446c1f){logger['error'](_0xaf17('0x2c'),_0x226051,_0x193884[_0xaf17('0x8')][_0x418695][_0xaf17('0x2d')],_0x36598c,_0x418695);})['finally'](function(){delete _0x193884[_0xaf17('0x1d')][_0x226051];});}catch(_0x3ded2d){logger[_0xaf17('0x35')](_0xaf17('0x38'),_0x3ded2d['message']);}};Acw[_0xaf17('0x39')][_0xaf17('0x2e')]=function(_0x23c3b4){try{var _0x54864d=this;if(_0x54864d[_0xaf17('0xa')][_0x23c3b4]){_0x54864d[_0xaf17('0xa')][_0x23c3b4][_0xaf17('0x33')]=![];var _0x54915d=_0x54864d[_0xaf17('0xa')][_0x23c3b4][_0xaf17('0x32')];var _0x2e3250=_0x54864d[_0xaf17('0xa')][_0x23c3b4][_0xaf17('0x1f')];var _0x273d5a=_0x54864d[_0xaf17('0x8')][_0x2e3250][_0xaf17('0x2d')];logger['info'](_0xaf17('0x3a'),_0x54915d,_0x23c3b4);RpcUser[_0xaf17('0x3b')](this[_0xaf17('0x9')][_0x23c3b4]);RpcVoiceAgentReport[_0xaf17('0x3c')]({'acwtime':_0x273d5a,'agentacw':!![]},_0x54915d,_0x23c3b4)[_0xaf17('0x26')](function(_0x88e19){logger['info'](_0xaf17('0x3d'),_0x54915d,_0x273d5a,_0x88e19);})[_0xaf17('0x34')](function(_0x4adf18){logger[_0xaf17('0x35')](_0xaf17('0x36'),_0x54915d,_0x4adf18);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x23c3b4);if(_0x54864d[_0xaf17('0xa')]){logger[_0xaf17('0x29')](_0xaf17('0x3e'),JSON[_0xaf17('0x3f')](_0x54864d['timers']));}}}catch(_0x24f7e0){logger[_0xaf17('0x35')](_0xaf17('0x40'),_0x24f7e0[_0xaf17('0x41')]);}};Acw[_0xaf17('0x39')][_0xaf17('0xc')]=function(_0x14e567){try{if(this[_0xaf17('0x8')][_0x14e567[_0xaf17('0x1f')]]&&(this['voiceQueues'][_0x14e567[_0xaf17('0x1f')]][_0xaf17('0x5')]||this['voiceQueues'][_0x14e567[_0xaf17('0x1f')]][_0xaf17('0x21')])){if(this[_0xaf17('0x9')][_0x14e567[_0xaf17('0x1e')]]){this[_0xaf17('0x1d')][_0x14e567[_0xaf17('0x32')]]={'queue':_0x14e567[_0xaf17('0x1f')],'interface':_0x14e567[_0xaf17('0x1e')],'destlinkedid':_0x14e567[_0xaf17('0x42')]};}}}catch(_0x27a387){logger[_0xaf17('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x27a387['message']);}};Acw[_0xaf17('0x39')][_0xaf17('0x19')]=function(_0x16a6b2){try{if(this[_0xaf17('0x8')][_0x16a6b2[_0xaf17('0x1f')]]&&(this[_0xaf17('0x8')][_0x16a6b2[_0xaf17('0x1f')]]['acw']||this[_0xaf17('0x8')][_0x16a6b2['queue']][_0xaf17('0x21')])){if(this['agents'][_0x16a6b2['interface']]){this[_0xaf17('0x1d')][_0x16a6b2[_0xaf17('0x32')]]={'queue':_0x16a6b2[_0xaf17('0x1f')],'interface':_0x16a6b2[_0xaf17('0x1e')]};}}}catch(_0x2b14ad){logger[_0xaf17('0x35')](_0xaf17('0x43'),_0x2b14ad[_0xaf17('0x41')]);}};Acw[_0xaf17('0x39')][_0xaf17('0xf')]=function(_0x3096c9){try{if(this[_0xaf17('0x1d')][_0x3096c9['uniqueid']]&&_['isUndefined'](this['channels'][_0x3096c9[_0xaf17('0x32')]][_0xaf17('0x44')])){logger[_0xaf17('0x29')](_0xaf17('0x45'),_0x3096c9['uniqueid']);this[_0xaf17('0x46')](_0x3096c9[_0xaf17('0x32')]);}else if(this[_0xaf17('0x1d')][_0x3096c9['linkedid']]&&_[_0xaf17('0x47')](this[_0xaf17('0x1d')][_0x3096c9['linkedid']][_0xaf17('0x44')])){logger[_0xaf17('0x29')](_0xaf17('0x48'),_0x3096c9[_0xaf17('0x49')]);this[_0xaf17('0x46')](_0x3096c9[_0xaf17('0x49')]);}}catch(_0x2b7870){logger[_0xaf17('0x35')](_0xaf17('0x4a'),_0x2b7870['message']);}};Acw['prototype']['syncHangup']=function(_0x47f653){try{if(this['channels'][_0x47f653['uniqueid']]&&this[_0xaf17('0x1d')][_0x47f653[_0xaf17('0x32')]][_0xaf17('0x44')]){logger[_0xaf17('0x29')](_0xaf17('0x4b'),_0x47f653[_0xaf17('0x32')]);this['startAcw'](_0x47f653[_0xaf17('0x32')]);}else if(this[_0xaf17('0x1d')][_0x47f653['linkedid']]&&this[_0xaf17('0x1d')][_0x47f653['linkedid']][_0xaf17('0x44')]){logger[_0xaf17('0x29')](_0xaf17('0x4c'),_0x47f653[_0xaf17('0x49')]);this['startAcw'](_0x47f653[_0xaf17('0x49')]);}}catch(_0x64230f){logger['error'](_0xaf17('0x4d'),_0x64230f[_0xaf17('0x41')]);}};Acw[_0xaf17('0x39')]['syncAttendedTransfer']=function(_0x15aa77){try{if(!_[_0xaf17('0x4e')](this[_0xaf17('0x1d')][_0x15aa77[_0xaf17('0x4f')]])){this['startAcw'](_0x15aa77[_0xaf17('0x4f')]);if(this[_0xaf17('0x1d')][_0x15aa77[_0xaf17('0x50')]]){this['channels'][_0x15aa77['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x15aa77['transfertargetuniqueid']]=this[_0xaf17('0x1d')][_0x15aa77['secondtransfereruniqueid']];delete this[_0xaf17('0x1d')][_0x15aa77['secondtransfereruniqueid']];}}else if(!_[_0xaf17('0x4e')](this[_0xaf17('0x1d')][_0x15aa77[_0xaf17('0x51')]])){this['startAcw'](_0x15aa77['transfertargetuniqueid']);if(this[_0xaf17('0x1d')][_0x15aa77[_0xaf17('0x52')]]){this[_0xaf17('0x1d')][_0x15aa77[_0xaf17('0x52')]][_0xaf17('0x44')]=!![];this['channels'][_0x15aa77[_0xaf17('0x4f')]]=this[_0xaf17('0x1d')][_0x15aa77[_0xaf17('0x52')]];delete this[_0xaf17('0x1d')][_0x15aa77[_0xaf17('0x52')]];}}}catch(_0x567e6a){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x567e6a[_0xaf17('0x41')]);}};Acw[_0xaf17('0x39')]['syncBlindTransfer']=function(_0xa37188){try{if(this[_0xaf17('0x1d')][_0xa37188['transfereruniqueid']]){logger[_0xaf17('0x29')](_0xaf17('0x53'),JSON[_0xaf17('0x3f')](_0xa37188[_0xaf17('0x54')]));this[_0xaf17('0x46')](_0xa37188[_0xaf17('0x54')]);}else if(this['channels'][_0xa37188[_0xaf17('0x55')]]){logger[_0xaf17('0x29')](_0xaf17('0x56'),JSON['stringify'](_0xa37188[_0xaf17('0x55')]));this[_0xaf17('0x46')](_0xa37188[_0xaf17('0x55')]);}}catch(_0x16170b){logger[_0xaf17('0x35')](_0xaf17('0x57'),_0x16170b[_0xaf17('0x41')]);}};Acw[_0xaf17('0x39')][_0xaf17('0x13')]=function(_0x38472b){try{if(this[_0xaf17('0x8')][_0x38472b[_0xaf17('0x1f')]]&&this['voiceQueues'][_0x38472b[_0xaf17('0x1f')]][_0xaf17('0x58')]==='all'){if(this[_0xaf17('0x9')][_0x38472b[_0xaf17('0x1e')]]){logger[_0xaf17('0x29')](_0xaf17('0x59'),_0x38472b['uniqueid'],_0x38472b['interface'],_0x38472b['queue']);return RpcUser[_0xaf17('0x2b')](this['agents'][_0x38472b[_0xaf17('0x1e')]],_0xaf17('0x5a'),_0x38472b[_0xaf17('0x32')]);}}}catch(_0xe0f6a){logger[_0xaf17('0x35')](_0xaf17('0x5b'),_0xe0f6a[_0xaf17('0x41')]);}};module['exports']=Acw; \ No newline at end of file +var _0x8826=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','interface','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','ACW','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8826,0x1bd));var _0x6882=function(_0x46b273,_0x4c62a2){_0x46b273=_0x46b273-0x0;var _0x21e654=_0x8826[_0x46b273];return _0x21e654;};'use strict';var util=require(_0x6882('0x0'));var _=require(_0x6882('0x1'));var moment=require(_0x6882('0x2'));var ami=require(_0x6882('0x3'));var logger=require(_0x6882('0x4'))(_0x6882('0x5'));var RpcUser=require(_0x6882('0x6'));var RpcVoiceAgentReport=require(_0x6882('0x7'));function Acw(_0x4d1261){this[_0x6882('0x8')]=_0x4d1261['voiceQueues'];this[_0x6882('0x9')]=_0x4d1261[_0x6882('0x9')];this[_0x6882('0xa')]=_0x4d1261[_0x6882('0xa')];this[_0x6882('0xb')]={};ami['on'](_0x6882('0xc'),this[_0x6882('0xd')][_0x6882('0xe')](this));ami['on'](_0x6882('0xf'),this[_0x6882('0x10')][_0x6882('0xe')](this));ami['on'](_0x6882('0x11'),this['syncHangup'][_0x6882('0xe')](this));ami['on'](_0x6882('0x12'),this[_0x6882('0x13')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x6882('0x14')][_0x6882('0xe')](this));ami['on']('custom:agentConnectPreview',this[_0x6882('0x15')][_0x6882('0xe')](this));}function getDiff(_0x5e92dc){var _0x45464c=moment()['milliseconds'](0x0);var _0x40790d=moment(_0x5e92dc)[_0x6882('0x16')](0x0);return _0x45464c['diff'](_0x40790d,_0x6882('0x17'));}Acw[_0x6882('0x18')][_0x6882('0x19')]=function(_0x28ad20){try{var _0x403663=this;var _0x68397a=this[_0x6882('0xb')][_0x28ad20]['interface'];var _0x12e7dd=this[_0x6882('0xb')][_0x28ad20]['queue'];var _0x3ef867=this[_0x6882('0x8')][_0x12e7dd];var _0x3b1911=![];var _0x322a52=_0x6882('0x1a');if(_0x3ef867['mandatoryDisposition']){if(_0x3ef867['mandatoryDispositionPause'][_0x6882('0x1b')]){_0x3b1911=!![];_0x322a52=_0x3ef867[_0x6882('0x1c')][_0x6882('0x1b')];}}ami[_0x6882('0x1d')]({'action':_0x6882('0x1e'),'interface':_0x68397a,'paused':!![],'reason':_0x322a52})[_0x6882('0x1f')](function(_0x3574b6){if(_0x403663[_0x6882('0x9')][_0x68397a]){return RpcUser[_0x6882('0x20')](_0x403663[_0x6882('0x9')][_0x68397a]['id'])[_0x6882('0x1f')](function(_0x3f10e6){if(_0x3f10e6&&!_0x3f10e6[_0x6882('0x21')]){logger['info'](_0x6882('0x22'),_0x28ad20,_0x68397a,_0x12e7dd);var _0x2ab000=_0x403663[_0x6882('0xb')][_0x28ad20]['attended']&&_0x403663['channels'][_0x28ad20]['destlinkedid']?_0x403663[_0x6882('0xb')][_0x28ad20][_0x6882('0x23')]:_0x28ad20;return RpcUser[_0x6882('0x24')](_0x403663['agents'][_0x68397a],_0x322a52,_0x2ab000)[_0x6882('0x1f')](function(_0x428f74){if(!_0x3b1911){_0x403663[_0x6882('0xa')][_0x68397a]={};logger[_0x6882('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x28ad20,_0x403663[_0x6882('0x8')][_0x12e7dd][_0x6882('0x26')],_0x68397a,_0x12e7dd);_0x403663[_0x6882('0xa')][_0x68397a][_0x6882('0x27')]=setTimeout(_0x403663[_0x6882('0x28')]['bind'](_0x403663,_0x68397a),_0x403663[_0x6882('0x8')][_0x12e7dd][_0x6882('0x26')]*0x3e8);_0x403663['timers'][_0x68397a][_0x6882('0x29')]=moment()[_0x6882('0x2a')](_0x6882('0x2b'));_0x403663[_0x6882('0xa')][_0x68397a]['uniqueid']=_0x28ad20;_0x403663[_0x6882('0xa')][_0x68397a][_0x6882('0x2c')]=_0x12e7dd;_0x403663['timers'][_0x68397a][_0x6882('0x2d')]=function(){var _0x5c42bb=getDiff(_0x403663[_0x6882('0xa')][_0x68397a][_0x6882('0x29')]);clearTimeout(_0x403663[_0x6882('0xa')][_0x68397a]['timer']);_0x403663[_0x6882('0xa')][_0x68397a][_0x6882('0x27')]=![];RpcVoiceAgentReport[_0x6882('0x2e')]({'acwtime':_0x5c42bb},_0x403663[_0x6882('0xa')][_0x68397a][_0x6882('0x2f')],_0x68397a)[_0x6882('0x1f')](function(_0x492791){logger[_0x6882('0x25')](_0x6882('0x30'),_0x28ad20,_0x5c42bb,_0x492791);})[_0x6882('0x31')](function(_0x35d120){logger[_0x6882('0x32')](_0x6882('0x33'),_0x28ad20,_0x35d120);});delete _0x403663['timers'][_0x68397a];};}});}else{logger[_0x6882('0x25')](_0x6882('0x34'),_0x28ad20,_0x68397a,_0x12e7dd);}});}})[_0x6882('0x31')](function(_0x25b58b){logger[_0x6882('0x32')](_0x6882('0x35'),_0x28ad20,_0x403663[_0x6882('0x8')][_0x12e7dd][_0x6882('0x26')],_0x68397a,_0x12e7dd);})[_0x6882('0x36')](function(){delete _0x403663[_0x6882('0xb')][_0x28ad20];});}catch(_0x146a78){logger['error'](_0x6882('0x37'),_0x146a78[_0x6882('0x38')]);}};Acw[_0x6882('0x18')][_0x6882('0x28')]=function(_0x26960d){try{var _0x132cd9=this;if(_0x132cd9[_0x6882('0xa')][_0x26960d]){_0x132cd9[_0x6882('0xa')][_0x26960d][_0x6882('0x27')]=![];var _0x4fe39d=_0x132cd9[_0x6882('0xa')][_0x26960d][_0x6882('0x2f')];var _0x3694a8=_0x132cd9[_0x6882('0xa')][_0x26960d][_0x6882('0x2c')];var _0x1b4110=_0x132cd9[_0x6882('0x8')][_0x3694a8][_0x6882('0x26')];logger['info'](_0x6882('0x39'),_0x4fe39d,_0x26960d);RpcUser[_0x6882('0x3a')](this['agents'][_0x26960d]);RpcVoiceAgentReport[_0x6882('0x2e')]({'acwtime':_0x1b4110,'agentacw':!![]},_0x4fe39d,_0x26960d)[_0x6882('0x1f')](function(_0x35b235){logger[_0x6882('0x25')](_0x6882('0x30'),_0x4fe39d,_0x1b4110,_0x35b235);})['catch'](function(_0x37cc6c){logger[_0x6882('0x32')](_0x6882('0x33'),_0x4fe39d,_0x37cc6c);});}else{logger['error'](_0x6882('0x3b'),_0x26960d);if(_0x132cd9[_0x6882('0xa')]){logger[_0x6882('0x25')](_0x6882('0x3c'),JSON[_0x6882('0x3d')](_0x132cd9['timers']));}}}catch(_0x26bd52){logger[_0x6882('0x32')]('[ACW][STOP]\x20%s',_0x26bd52[_0x6882('0x38')]);}};Acw['prototype'][_0x6882('0xd')]=function(_0x1aa7b9){try{if(this[_0x6882('0x8')][_0x1aa7b9[_0x6882('0x2c')]]&&(this['voiceQueues'][_0x1aa7b9[_0x6882('0x2c')]]['acw']||this[_0x6882('0x8')][_0x1aa7b9[_0x6882('0x2c')]]['mandatoryDisposition'])){if(this[_0x6882('0x9')][_0x1aa7b9[_0x6882('0x3e')]]){this[_0x6882('0xb')][_0x1aa7b9[_0x6882('0x2f')]]={'queue':_0x1aa7b9[_0x6882('0x2c')],'interface':_0x1aa7b9['interface'],'destlinkedid':_0x1aa7b9['destlinkedid']};}}}catch(_0x3977b6){logger[_0x6882('0x32')]('[ACW][syncAgentConnect]\x20%s',_0x3977b6[_0x6882('0x38')]);}};Acw[_0x6882('0x18')]['syncAgentConnectPreview']=function(_0x4f0007){try{if(this[_0x6882('0x8')][_0x4f0007[_0x6882('0x2c')]]&&(this[_0x6882('0x8')][_0x4f0007[_0x6882('0x2c')]][_0x6882('0x5')]||this['voiceQueues'][_0x4f0007[_0x6882('0x2c')]][_0x6882('0x3f')])){if(this[_0x6882('0x9')][_0x4f0007['interface']]){this[_0x6882('0xb')][_0x4f0007[_0x6882('0x2f')]]={'queue':_0x4f0007[_0x6882('0x2c')],'interface':_0x4f0007[_0x6882('0x3e')]};}}}catch(_0x22f26b){logger[_0x6882('0x32')](_0x6882('0x40'),_0x22f26b[_0x6882('0x38')]);}};Acw[_0x6882('0x18')][_0x6882('0x10')]=function(_0xb054bd){try{if(this[_0x6882('0xb')][_0xb054bd[_0x6882('0x2f')]]&&_['isUndefined'](this[_0x6882('0xb')][_0xb054bd['uniqueid']][_0x6882('0x41')])){logger[_0x6882('0x25')](_0x6882('0x42'),_0xb054bd[_0x6882('0x2f')]);this[_0x6882('0x19')](_0xb054bd['uniqueid']);}else if(this[_0x6882('0xb')][_0xb054bd[_0x6882('0x43')]]&&_['isUndefined'](this[_0x6882('0xb')][_0xb054bd['linkedid']]['attended'])){logger[_0x6882('0x25')]('[%s][HANGUP:LINKEDID]',_0xb054bd[_0x6882('0x43')]);this['startAcw'](_0xb054bd['linkedid']);}}catch(_0x4c8423){logger[_0x6882('0x32')](_0x6882('0x44'),_0x4c8423[_0x6882('0x38')]);}};Acw[_0x6882('0x18')]['syncHangup']=function(_0x5df8e7){try{if(this[_0x6882('0xb')][_0x5df8e7[_0x6882('0x2f')]]&&this[_0x6882('0xb')][_0x5df8e7[_0x6882('0x2f')]][_0x6882('0x41')]){logger[_0x6882('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5df8e7[_0x6882('0x2f')]);this[_0x6882('0x19')](_0x5df8e7['uniqueid']);}else if(this[_0x6882('0xb')][_0x5df8e7[_0x6882('0x43')]]&&this[_0x6882('0xb')][_0x5df8e7[_0x6882('0x43')]][_0x6882('0x41')]){logger[_0x6882('0x25')](_0x6882('0x45'),_0x5df8e7['linkedid']);this['startAcw'](_0x5df8e7[_0x6882('0x43')]);}}catch(_0x4239e8){logger[_0x6882('0x32')]('[ACW][syncHangup]\x20%s',_0x4239e8[_0x6882('0x38')]);}};Acw[_0x6882('0x18')][_0x6882('0x46')]=function(_0x2910a9){try{if(!_['isNil'](this['channels'][_0x2910a9[_0x6882('0x47')]])){this[_0x6882('0x19')](_0x2910a9[_0x6882('0x47')]);if(this[_0x6882('0xb')][_0x2910a9[_0x6882('0x48')]]){this[_0x6882('0xb')][_0x2910a9[_0x6882('0x48')]][_0x6882('0x41')]=!![];this[_0x6882('0xb')][_0x2910a9['transfertargetuniqueid']]=this['channels'][_0x2910a9[_0x6882('0x48')]];delete this[_0x6882('0xb')][_0x2910a9[_0x6882('0x48')]];}}else if(!_['isNil'](this[_0x6882('0xb')][_0x2910a9[_0x6882('0x49')]])){this[_0x6882('0x19')](_0x2910a9[_0x6882('0x49')]);if(this['channels'][_0x2910a9[_0x6882('0x4a')]]){this[_0x6882('0xb')][_0x2910a9['origtransfereruniqueid']][_0x6882('0x41')]=!![];this[_0x6882('0xb')][_0x2910a9[_0x6882('0x47')]]=this[_0x6882('0xb')][_0x2910a9[_0x6882('0x4a')]];delete this['channels'][_0x2910a9[_0x6882('0x4a')]];}}}catch(_0x1e6e7e){logger['error'](_0x6882('0x4b'),_0x1e6e7e[_0x6882('0x38')]);}};Acw[_0x6882('0x18')][_0x6882('0x14')]=function(_0x29ba74){try{if(this['channels'][_0x29ba74[_0x6882('0x4c')]]){logger[_0x6882('0x25')](_0x6882('0x4d'),JSON['stringify'](_0x29ba74['transfereruniqueid']));this[_0x6882('0x19')](_0x29ba74[_0x6882('0x4c')]);}else if(this[_0x6882('0xb')][_0x29ba74[_0x6882('0x4e')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x29ba74[_0x6882('0x4e')]));this[_0x6882('0x19')](_0x29ba74[_0x6882('0x4e')]);}}catch(_0x3b945c){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x3b945c['message']);}};Acw[_0x6882('0x18')][_0x6882('0x13')]=function(_0x5625a7){try{if(this[_0x6882('0x8')][_0x5625a7['queue']]&&this[_0x6882('0x8')][_0x5625a7[_0x6882('0x2c')]][_0x6882('0x4f')]==='all'){if(this[_0x6882('0x9')][_0x5625a7['interface']]){logger[_0x6882('0x25')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5625a7[_0x6882('0x2f')],_0x5625a7[_0x6882('0x3e')],_0x5625a7[_0x6882('0x2c')]);return RpcUser['savePause'](this['agents'][_0x5625a7['interface']],_0x6882('0x50'),_0x5625a7[_0x6882('0x2f')]);}}}catch(_0x1fafe0){logger[_0x6882('0x32')](_0x6882('0x51'),_0x1fafe0[_0x6882('0x38')]);}};module[_0x6882('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index efa7d70..a75e27d 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 _0x44ea=['shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionCoreShowChannels','catch','log','exports','util','lodash','../../config/logger','asterisk','username','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','once','close','connect'];(function(_0xb5b6d1,_0x5ce902){var _0x482299=function(_0x315063){while(--_0x315063){_0xb5b6d1['push'](_0xb5b6d1['shift']());}};_0x482299(++_0x5ce902);}(_0x44ea,0x198));var _0xa44e=function(_0x2e5304,_0x4a4b3a){_0x2e5304=_0x2e5304-0x0;var _0x190524=_0x44ea[_0x2e5304];return _0x190524;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xa44e('0x0'));var _=require(_0xa44e('0x1'));var logger=require(_0xa44e('0x2'))('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk']['port'],config['asterisk']['ip'],config[_0xa44e('0x3')][_0xa44e('0x4')],config[_0xa44e('0x3')]['password'],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xa44e('0x5')](ami[_0xa44e('0x6')]);function error(_0x5211ab){logger['error'](util[_0xa44e('0x7')](_0xa44e('0x8'),config['asterisk'][_0xa44e('0x4')],config[_0xa44e('0x3')]['ip'],config[_0xa44e('0x3')][_0xa44e('0x9')],util['inspect'](_0x5211ab,![],null)));}function close(){logger[_0xa44e('0xa')](util[_0xa44e('0x7')](_0xa44e('0xb'),config[_0xa44e('0x3')][_0xa44e('0x4')],config['asterisk']['ip'],config[_0xa44e('0x3')][_0xa44e('0x9')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xa44e('0xc')]({'action':_0xa44e('0xd')});};};ami[_0xa44e('0xe')]=function(){return function(){return ami[_0xa44e('0xc')]({'action':'devicestatelist'});};};ami[_0xa44e('0xf')]=function(){return function(){return ami[_0xa44e('0xc')]({'action':_0xa44e('0x10')});};};ami[_0xa44e('0x11')]=function(){return function(){return ami['Action']({'action':_0xa44e('0x12')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0xa44e('0x13')});};};function connect(_0x265e77){logger[_0xa44e('0x14')](util[_0xa44e('0x7')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa44e('0x3')][_0xa44e('0x4')],config['asterisk']['ip'],config[_0xa44e('0x3')][_0xa44e('0x9')]));ami[_0xa44e('0x15')](_0xa44e('0xa'),error);ami['once'](_0xa44e('0x16'),close);}ami['on'](_0xa44e('0x17'),connect);ami['on'](_0xa44e('0x18'),function(_0x4eca47){logger[_0xa44e('0x14')](util['format'](_0xa44e('0x19'),config[_0xa44e('0x3')]['username'],config['asterisk']['ip'],config[_0xa44e('0x3')]['port'],util[_0xa44e('0x1a')](_0x4eca47,![],null)));});ami['on'](_0xa44e('0x1b'),function(_0x17632d){logger['info'](util[_0xa44e('0x7')](_0xa44e('0x1c'),config[_0xa44e('0x3')]['username'],config['asterisk']['ip'],config[_0xa44e('0x3')][_0xa44e('0x9')]));return BPromise[_0xa44e('0x1d')]()[_0xa44e('0x1e')](ami[_0xa44e('0x1f')]())['then'](ami[_0xa44e('0xe')]())[_0xa44e('0x1e')](ami['actionSipPeerStatus']())[_0xa44e('0x1e')](ami['actionQueueSummary']())[_0xa44e('0x1e')](ami[_0xa44e('0x20')]())[_0xa44e('0x21')](function(_0x3b3fe2){console[_0xa44e('0x22')](_0x3b3fe2);});});ami[_0xa44e('0x15')](_0xa44e('0xa'),error);ami[_0xa44e('0x15')](_0xa44e('0x16'),close);module[_0xa44e('0x23')]=ami; \ No newline at end of file +var _0x2d3c=['lodash','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','username','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionQueueSummary','catch','log','exports','asterisk-manager','util'];(function(_0x3c63f2,_0xbe25b8){var _0x26e984=function(_0x2e0baa){while(--_0x2e0baa){_0x3c63f2['push'](_0x3c63f2['shift']());}};_0x26e984(++_0xbe25b8);}(_0x2d3c,0x79));var _0xc2d3=function(_0x19f2cc,_0x55fc35){_0x19f2cc=_0x19f2cc-0x0;var _0xed6f81=_0x2d3c[_0x19f2cc];return _0xed6f81;};'use strict';var Manager=require(_0xc2d3('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xc2d3('0x1'));var _=require(_0xc2d3('0x2'));var logger=require(_0xc2d3('0x3'))(_0xc2d3('0x4'));var config=require(_0xc2d3('0x5'));var ami=new Manager(config[_0xc2d3('0x6')][_0xc2d3('0x7')],config['asterisk']['ip'],config[_0xc2d3('0x6')]['username'],config[_0xc2d3('0x6')][_0xc2d3('0x8')],!![]);ami[_0xc2d3('0x9')]();ami[_0xc2d3('0xa')]=BPromise[_0xc2d3('0xb')](ami[_0xc2d3('0xc')]);function error(_0x1b734e){logger[_0xc2d3('0xd')](util['format'](_0xc2d3('0xe'),config[_0xc2d3('0x6')]['username'],config['asterisk']['ip'],config[_0xc2d3('0x6')][_0xc2d3('0x7')],util[_0xc2d3('0xf')](_0x1b734e,![],null)));}function close(){logger[_0xc2d3('0xd')](util[_0xc2d3('0x10')](_0xc2d3('0x11'),config['asterisk']['username'],config[_0xc2d3('0x6')]['ip'],config[_0xc2d3('0x6')][_0xc2d3('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0xc2d3('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xc2d3('0xa')]({'action':_0xc2d3('0x13')});};};ami[_0xc2d3('0x14')]=function(){return function(){return ami[_0xc2d3('0xa')]({'action':_0xc2d3('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0xc2d3('0x16')]=function(){return function(){return ami[_0xc2d3('0xa')]({'action':_0xc2d3('0x17')});};};function connect(_0x33df07){logger[_0xc2d3('0x18')](util[_0xc2d3('0x10')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xc2d3('0x6')][_0xc2d3('0x19')],config[_0xc2d3('0x6')]['ip'],config[_0xc2d3('0x6')][_0xc2d3('0x7')]));ami[_0xc2d3('0x1a')](_0xc2d3('0xd'),error);ami[_0xc2d3('0x1a')](_0xc2d3('0x1b'),close);}ami['on'](_0xc2d3('0x1c'),connect);ami['on'](_0xc2d3('0x1d'),function(_0x56947a){logger['info'](util[_0xc2d3('0x10')](_0xc2d3('0x1e'),config[_0xc2d3('0x6')][_0xc2d3('0x19')],config[_0xc2d3('0x6')]['ip'],config['asterisk'][_0xc2d3('0x7')],util['inspect'](_0x56947a,![],null)));});ami['on'](_0xc2d3('0x1f'),function(_0x3b9c87){logger[_0xc2d3('0x18')](util[_0xc2d3('0x10')](_0xc2d3('0x20'),config[_0xc2d3('0x6')][_0xc2d3('0x19')],config[_0xc2d3('0x6')]['ip'],config['asterisk'][_0xc2d3('0x7')]));return BPromise[_0xc2d3('0x21')]()['then'](ami[_0xc2d3('0x22')]())[_0xc2d3('0x23')](ami[_0xc2d3('0x24')]())[_0xc2d3('0x23')](ami[_0xc2d3('0x14')]())[_0xc2d3('0x23')](ami[_0xc2d3('0x25')]())[_0xc2d3('0x23')](ami[_0xc2d3('0x16')]())[_0xc2d3('0x26')](function(_0x41f9af){console[_0xc2d3('0x27')](_0x41f9af);});});ami['once'](_0xc2d3('0xd'),error);ami[_0xc2d3('0x1a')](_0xc2d3('0x1b'),close);module[_0xc2d3('0x28')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1a575be..d76b78b 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x5d9ec4,_0x4c9583){var _0x146b11=function(_0x3c94f4){while(--_0x3c94f4){_0x5d9ec4['push'](_0x5d9ec4['shift']());}};_0x146b11(++_0x4c9583);}(_0xaa88,0x137));var _0x8aa8=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0xaa88[_0x37ae26];return _0x1b1902;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x59c46a,_0x26548b){var _0x4f61d3=function(_0x3a9e01){while(--_0x3a9e01){_0x59c46a['push'](_0x59c46a['shift']());}};_0x4f61d3(++_0x26548b);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xc905bf,_0x3fb45d){_0xc905bf=_0xc905bf-0x0;var _0x3ffd14=_0xbdb7[_0xc905bf];return _0x3ffd14;};'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 diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 38171c1..4725e72 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 _0x9fe5=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','queue','util','moment','isNil','string','uniqueid','name','phone','Contact','lastName','number','active'];(function(_0x335854,_0x371d24){var _0xfe1fee=function(_0x2fd34d){while(--_0x2fd34d){_0x335854['push'](_0x335854['shift']());}};_0xfe1fee(++_0x371d24);}(_0x9fe5,0x1ad));var _0x59fe=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9fe5[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x59fe('0x0'));var _=require('lodash');var moment=require(_0x59fe('0x1'));function checkNameSurname(_0x45db83,_0x833e7e,_0x4d3f4c){var _0x287f79='';if(!_[_0x59fe('0x2')](_0x833e7e)&&_0x59fe('0x3')===typeof _0x833e7e){_0x287f79+=_0x833e7e;}if(!_['isNil'](_0x4d3f4c)&&'string'===typeof _0x4d3f4c){_0x287f79+='\x20'+_0x4d3f4c;}if(_0x287f79!==''){return _0x287f79;}return _0x45db83;}function Action(_0x36bf36,_0x28f5b9,_0x2068e9){this['voiceQueue']=_0x36bf36;this[_0x59fe('0x4')]=_0x2068e9||undefined;this[_0x59fe('0x5')]=checkNameSurname(_0x28f5b9['Contact'][_0x59fe('0x6')],_0x28f5b9[_0x59fe('0x7')]['firstName'],_0x28f5b9[_0x59fe('0x7')][_0x59fe('0x8')]);this[_0x59fe('0x9')]=_0x28f5b9[_0x59fe('0x7')][_0x59fe('0x6')];this['queue']=_0x36bf36[_0x59fe('0x5')];this[_0x59fe('0xa')]=_0x28f5b9[_0x59fe('0xa')]||![];this[_0x59fe('0xb')]=_0x36bf36[_0x59fe('0xb')];this[_0x59fe('0xc')]=_0x36bf36[_0x59fe('0xc')]||0x3;this[_0x59fe('0xd')]=_0x28f5b9[_0x59fe('0xd')];this[_0x59fe('0xe')]=_0x28f5b9[_0x59fe('0xe')];this[_0x59fe('0xf')]=_0x28f5b9['countcongestionretry'];this['countnoanswerretry']=_0x28f5b9['countnoanswerretry'];this['countnosuchnumberretry']=_0x28f5b9[_0x59fe('0x10')];this[_0x59fe('0x11')]=_0x28f5b9[_0x59fe('0x11')];this['countabandonedretry']=_0x28f5b9[_0x59fe('0x12')];this[_0x59fe('0x13')]=_0x28f5b9['countmachineretry'];this[_0x59fe('0x14')]=_0x28f5b9['countagentrejectretry'];this['ContactId']=_0x28f5b9['ContactId'];this['ListId']=_0x28f5b9[_0x59fe('0x15')];this[_0x59fe('0x16')]=_0x28f5b9[_0x59fe('0x16')];this[_0x59fe('0x17')]=_0x28f5b9['VoiceQueueId'];this[_0x59fe('0x18')]=_0x28f5b9['CampaignId'];this[_0x59fe('0x19')]=_0x28f5b9['id'];this[_0x59fe('0x1a')]=_0x28f5b9[_0x59fe('0x7')][_0x59fe('0x1b')]||'';this[_0x59fe('0x1c')]=moment()[_0x59fe('0x1d')](_0x59fe('0x1e'));this['callback']=_0x28f5b9[_0x59fe('0x1f')];this[_0x59fe('0x20')]=_0x28f5b9[_0x59fe('0x20')];this['callbackat']=_0x28f5b9[_0x59fe('0x21')];this[_0x59fe('0x22')]=_0x28f5b9[_0x59fe('0x22')];this[_0x59fe('0x23')]='';this[_0x59fe('0x24')]='';}Action[_0x59fe('0x25')]['getCaller']=function(){return util[_0x59fe('0x1d')](_0x59fe('0x26'),this['name'],this[_0x59fe('0x27')][_0x59fe('0x28')]>0x0?this[_0x59fe('0x9')][_0x59fe('0x29')](this['voiceQueue']['dialCutDigit']):this[_0x59fe('0x9')]);};Action[_0x59fe('0x25')][_0x59fe('0x2a')]=function(){return this[_0x59fe('0x2b')];};module['exports']=Action; \ No newline at end of file +var _0x96f4=['scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','number','queue','active','type','dialQueueTimeout'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x96f4,0xc8));var _0x496f=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x96f4[_0x22ffbf];return _0x360c17;};'use strict';var util=require(_0x496f('0x0'));var _=require(_0x496f('0x1'));var moment=require(_0x496f('0x2'));function checkNameSurname(_0x76f4df,_0x221b29,_0x4c9578){var _0x45cc11='';if(!_[_0x496f('0x3')](_0x221b29)&&'string'===typeof _0x221b29){_0x45cc11+=_0x221b29;}if(!_[_0x496f('0x3')](_0x4c9578)&&_0x496f('0x4')===typeof _0x4c9578){_0x45cc11+='\x20'+_0x4c9578;}if(_0x45cc11!==''){return _0x45cc11;}return _0x76f4df;}function Action(_0x540edc,_0xcd6b10,_0x48e8a8){this[_0x496f('0x5')]=_0x540edc;this[_0x496f('0x6')]=_0x48e8a8||undefined;this[_0x496f('0x7')]=checkNameSurname(_0xcd6b10[_0x496f('0x8')][_0x496f('0x9')],_0xcd6b10['Contact']['firstName'],_0xcd6b10[_0x496f('0x8')]['lastName']);this[_0x496f('0xa')]=_0xcd6b10[_0x496f('0x8')][_0x496f('0x9')];this[_0x496f('0xb')]=_0x540edc[_0x496f('0x7')];this[_0x496f('0xc')]=_0xcd6b10[_0x496f('0xc')]||![];this[_0x496f('0xd')]=_0x540edc[_0x496f('0xd')];this[_0x496f('0xe')]=_0x540edc['dialQueueTimeout']||0x3;this[_0x496f('0xf')]=_0xcd6b10[_0x496f('0xf')];this['countbusyretry']=_0xcd6b10[_0x496f('0x10')];this['countcongestionretry']=_0xcd6b10['countcongestionretry'];this[_0x496f('0x11')]=_0xcd6b10[_0x496f('0x11')];this[_0x496f('0x12')]=_0xcd6b10[_0x496f('0x12')];this[_0x496f('0x13')]=_0xcd6b10[_0x496f('0x13')];this[_0x496f('0x14')]=_0xcd6b10[_0x496f('0x14')];this['countmachineretry']=_0xcd6b10[_0x496f('0x15')];this[_0x496f('0x16')]=_0xcd6b10[_0x496f('0x16')];this['ContactId']=_0xcd6b10['ContactId'];this[_0x496f('0x17')]=_0xcd6b10[_0x496f('0x17')];this[_0x496f('0x18')]=_0xcd6b10[_0x496f('0x18')];this[_0x496f('0x19')]=_0xcd6b10[_0x496f('0x19')];this['CampaignId']=_0xcd6b10[_0x496f('0x1a')];this[_0x496f('0x1b')]=_0xcd6b10['id'];this[_0x496f('0x1c')]=_0xcd6b10['Contact'][_0x496f('0x1d')]||'';this[_0x496f('0x1e')]=moment()['format'](_0x496f('0x1f'));this['callback']=_0xcd6b10[_0x496f('0x20')];this[_0x496f('0x21')]=_0xcd6b10[_0x496f('0x21')];this[_0x496f('0x22')]=_0xcd6b10['callbackat'];this[_0x496f('0x23')]=_0xcd6b10[_0x496f('0x23')];this[_0x496f('0x24')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util['format'](_0x496f('0x25'),this[_0x496f('0x7')],this['voiceQueue'][_0x496f('0x26')]>0x0?this[_0x496f('0xa')][_0x496f('0x27')](this[_0x496f('0x5')]['dialCutDigit']):this[_0x496f('0xa')]);};Action[_0x496f('0x28')][_0x496f('0x29')]=function(){return this['queue'];};module[_0x496f('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index dd91036..7852e3b 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 _0xfc08=['recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x288925,_0x4503a8){var _0x25fb6b=function(_0x551416){while(--_0x551416){_0x288925['push'](_0x288925['shift']());}};_0x25fb6b(++_0x4503a8);}(_0xfc08,0xe3));var _0x8fc0=function(_0x1202a1,_0x1e668b){_0x1202a1=_0x1202a1-0x0;var _0x507edd=_0xfc08[_0x1202a1];return _0x507edd;};'use strict';var util=require(_0x8fc0('0x0'));var _=require(_0x8fc0('0x1'));var moment=require(_0x8fc0('0x2'));function getSeconds(_0x3ac83c,_0x5389bc){var _0x595d5f=moment(_0x3ac83c)[_0x8fc0('0x3')](0x0);var _0xa52233=moment(_0x5389bc)['milliseconds'](0x0);return _0x595d5f['diff'](_0xa52233,_0x8fc0('0x4'));}function AgentComplete(_0x578113,_0x5176bc){this[_0x8fc0('0x5')]=0x4;this['statedesc']=_0x8fc0('0x6');this[_0x8fc0('0x7')]=_0x578113[_0x8fc0('0x7')];this[_0x8fc0('0x8')]=_0x578113[_0x8fc0('0x8')];this[_0x8fc0('0x9')]=_0x578113[_0x8fc0('0x8')]===_0x8fc0('0xa')?_0x8fc0('0xb'):_0x578113[_0x8fc0('0x8')];this['countbusyretry']=_0x578113[_0x8fc0('0xc')];this['countcongestionretry']=_0x578113[_0x8fc0('0xd')];this[_0x8fc0('0xe')]=_0x578113[_0x8fc0('0xe')];this[_0x8fc0('0xf')]=_0x578113[_0x8fc0('0xc')]+_0x578113[_0x8fc0('0xd')]+_0x578113[_0x8fc0('0xe')]+_0x578113[_0x8fc0('0x10')]+_0x578113[_0x8fc0('0x11')]+_0x578113[_0x8fc0('0x12')]+_0x578113['countmachineretry']+_0x578113['countagentrejectretry'];this['countnosuchnumberretry']=_0x578113[_0x8fc0('0x10')];this['countdropretry']=_0x578113[_0x8fc0('0x11')];this[_0x8fc0('0x12')]=_0x578113[_0x8fc0('0x12')];this[_0x8fc0('0x13')]=_0x578113[_0x8fc0('0x13')];this[_0x8fc0('0x14')]=_0x578113[_0x8fc0('0x14')];this[_0x8fc0('0x15')]=_0x5176bc['uniqueid'];this[_0x8fc0('0x16')]=_0x578113[_0x8fc0('0x17')];this[_0x8fc0('0x18')]=_0x578113[_0x8fc0('0x19')];this['starttime']=_0x578113['starttime'];this[_0x8fc0('0x1a')]=_0x578113[_0x8fc0('0x1a')];this[_0x8fc0('0x1b')]=_0x578113['answertime'];this[_0x8fc0('0x1c')]=moment()[_0x8fc0('0x1d')](_0x8fc0('0x1e'));this[_0x8fc0('0x1f')]=getSeconds(_0x578113[_0x8fc0('0x1a')],_0x578113['starttime']);this['holdtime']=getSeconds(_0x578113[_0x8fc0('0x1b')],_0x578113[_0x8fc0('0x1a')]);this['talktime']=getSeconds(this[_0x8fc0('0x1c')],_0x578113[_0x8fc0('0x1b')]);this[_0x8fc0('0xb')]=_0x5176bc['queue'];this['membername']=_0x5176bc[_0x8fc0('0x20')];this['reason']=_0x5176bc[_0x8fc0('0x21')];this['callback']=_0x578113[_0x8fc0('0x22')];this[_0x8fc0('0x23')]=_0x578113['callbackuniqueid'];this[_0x8fc0('0x24')]=_0x578113[_0x8fc0('0x24')];this[_0x8fc0('0x25')]=_0x578113[_0x8fc0('0x25')];this['ContactId']=_0x578113['ContactId'];this[_0x8fc0('0x26')]=_0x578113[_0x8fc0('0x26')];this['UserId']=_0x578113['UserId'];this['VoiceQueueId']=_0x578113[_0x8fc0('0x27')];this[_0x8fc0('0x28')]=_0x578113[_0x8fc0('0x28')];this[_0x8fc0('0x29')]=_0x578113['originatecalleridnum']||'';this[_0x8fc0('0x2a')]=_0x578113['originatecalleridname']||'';}module[_0x8fc0('0x2b')]=AgentComplete; \ No newline at end of file +var _0x2367=['moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x2367,0xb3));var _0x7236=function(_0x29e701,_0x3c5a8e){_0x29e701=_0x29e701-0x0;var _0x22c164=_0x2367[_0x29e701];return _0x22c164;};'use strict';var util=require('util');var _=require(_0x7236('0x0'));var moment=require(_0x7236('0x1'));function getSeconds(_0x18b14c,_0x5ac973){var _0x24fb2e=moment(_0x18b14c)[_0x7236('0x2')](0x0);var _0x39361f=moment(_0x5ac973)[_0x7236('0x2')](0x0);return _0x24fb2e[_0x7236('0x3')](_0x39361f,_0x7236('0x4'));}function AgentComplete(_0x468450,_0x13d301){this['state']=0x4;this[_0x7236('0x5')]=_0x7236('0x6');this['scheduledat']=_0x468450[_0x7236('0x7')];this[_0x7236('0x8')]=_0x468450[_0x7236('0x8')];this[_0x7236('0x9')]=_0x468450[_0x7236('0x8')]==='outbound'?_0x7236('0xa'):_0x468450['type'];this['countbusyretry']=_0x468450['countbusyretry'];this[_0x7236('0xb')]=_0x468450[_0x7236('0xb')];this[_0x7236('0xc')]=_0x468450[_0x7236('0xc')];this[_0x7236('0xd')]=_0x468450[_0x7236('0xe')]+_0x468450['countcongestionretry']+_0x468450[_0x7236('0xc')]+_0x468450[_0x7236('0xf')]+_0x468450[_0x7236('0x10')]+_0x468450[_0x7236('0x11')]+_0x468450[_0x7236('0x12')]+_0x468450[_0x7236('0x13')];this[_0x7236('0xf')]=_0x468450[_0x7236('0xf')];this[_0x7236('0x10')]=_0x468450[_0x7236('0x10')];this[_0x7236('0x11')]=_0x468450[_0x7236('0x11')];this['countmachineretry']=_0x468450[_0x7236('0x12')];this[_0x7236('0x13')]=_0x468450['countagentrejectretry'];this['uniqueid']=_0x13d301['uniqueid'];this[_0x7236('0x14')]=_0x468450[_0x7236('0x15')];this[_0x7236('0x16')]=_0x468450[_0x7236('0x17')];this[_0x7236('0x18')]=_0x468450[_0x7236('0x18')];this[_0x7236('0x19')]=_0x468450[_0x7236('0x19')];this[_0x7236('0x1a')]=_0x468450[_0x7236('0x1a')];this[_0x7236('0x1b')]=moment()['format'](_0x7236('0x1c'));this[_0x7236('0x1d')]=getSeconds(_0x468450[_0x7236('0x19')],_0x468450[_0x7236('0x18')]);this[_0x7236('0x1e')]=getSeconds(_0x468450['answertime'],_0x468450['responsetime']);this[_0x7236('0x1f')]=getSeconds(this[_0x7236('0x1b')],_0x468450['answertime']);this[_0x7236('0xa')]=_0x13d301['queue'];this[_0x7236('0x20')]=_0x13d301[_0x7236('0x20')];this[_0x7236('0x21')]=_0x13d301[_0x7236('0x21')];this[_0x7236('0x22')]=_0x468450[_0x7236('0x22')];this[_0x7236('0x23')]=_0x468450['callbackuniqueid'];this[_0x7236('0x24')]=_0x468450[_0x7236('0x24')];this[_0x7236('0x25')]=_0x468450[_0x7236('0x25')];this['ContactId']=_0x468450[_0x7236('0x26')];this[_0x7236('0x27')]=_0x468450['ListId'];this[_0x7236('0x28')]=_0x468450['UserId'];this[_0x7236('0x29')]=_0x468450[_0x7236('0x29')];this['CampaignId']=_0x468450['CampaignId'];this[_0x7236('0x2a')]=_0x468450[_0x7236('0x2a')]||'';this[_0x7236('0x2b')]=_0x468450[_0x7236('0x2b')]||'';}module[_0x7236('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index c6aa38b..7900cf5 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 _0x99c9=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x3523cb,_0x511b5c){var _0x54efd9=function(_0x48ee79){while(--_0x48ee79){_0x3523cb['push'](_0x3523cb['shift']());}};_0x54efd9(++_0x511b5c);}(_0x99c9,0x13c));var _0x999c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x99c9[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x999c('0x0'));var _=require(_0x999c('0x1'));var moment=require(_0x999c('0x2'));function getSeconds(_0x23d5a4,_0x2bb83d){var _0x16a7a3=moment(_0x23d5a4)[_0x999c('0x3')](0x0);var _0x52dc75=moment(_0x2bb83d)[_0x999c('0x3')](0x0);return _0x16a7a3[_0x999c('0x4')](_0x52dc75,_0x999c('0x5'));}function Final(_0x347ee0){this[_0x999c('0x6')]=_0x347ee0[_0x999c('0x6')];this[_0x999c('0x7')]=_0x347ee0[_0x999c('0x7')];this[_0x999c('0x8')]=_0x347ee0[_0x999c('0x8')];this[_0x999c('0x9')]=_0x347ee0[_0x999c('0x8')]===_0x999c('0xa')?_0x999c('0xb'):_0x347ee0['type'];this[_0x999c('0xc')]=_0x347ee0[_0x999c('0xc')];this['countcongestionretry']=_0x347ee0[_0x999c('0xd')];this[_0x999c('0xe')]=_0x347ee0[_0x999c('0xe')];this[_0x999c('0xf')]=_0x347ee0[_0x999c('0xc')]+_0x347ee0[_0x999c('0xd')]+_0x347ee0[_0x999c('0xe')]+_0x347ee0[_0x999c('0x10')]+_0x347ee0[_0x999c('0x11')]+_0x347ee0[_0x999c('0x12')]+_0x347ee0[_0x999c('0x13')]+_0x347ee0[_0x999c('0x14')];this['countnosuchnumberretry']=_0x347ee0[_0x999c('0x10')];this[_0x999c('0x11')]=_0x347ee0['countdropretry'];this['countabandonedretry']=_0x347ee0['countabandonedretry'];this[_0x999c('0x13')]=_0x347ee0[_0x999c('0x13')];this[_0x999c('0x14')]=_0x347ee0[_0x999c('0x14')];this[_0x999c('0xb')]=_0x347ee0['queue'];this[_0x999c('0x15')]=_0x347ee0[_0x999c('0x15')];this[_0x999c('0x16')]=_0x347ee0[_0x999c('0x16')];this[_0x999c('0x17')]=_0x347ee0['starttime'];this[_0x999c('0x18')]=_0x347ee0[_0x999c('0x18')];this[_0x999c('0x19')]=_0x347ee0[_0x999c('0x18')];this[_0x999c('0x1a')]=_0x347ee0['ringtime']||0x0;this[_0x999c('0x1b')]=_0x347ee0[_0x999c('0x1b')]||0x0;this[_0x999c('0x1c')]=_0x347ee0[_0x999c('0x1c')]||0x0;this[_0x999c('0x1d')]=_0x347ee0[_0x999c('0x1d')];this['callbackuniqueid']=_0x347ee0[_0x999c('0x1e')];this[_0x999c('0x1f')]=_0x347ee0[_0x999c('0x1f')];this[_0x999c('0x20')]=_0x347ee0[_0x999c('0x20')];this[_0x999c('0x21')]=_0x347ee0[_0x999c('0x21')];this[_0x999c('0x22')]=_0x347ee0[_0x999c('0x22')];this[_0x999c('0x23')]=_0x347ee0[_0x999c('0x23')];this['VoiceQueueId']=_0x347ee0[_0x999c('0x24')];this[_0x999c('0x25')]=_0x347ee0[_0x999c('0x25')];this[_0x999c('0x26')]=_0x347ee0[_0x999c('0x26')]||'';this[_0x999c('0x27')]=_0x347ee0['originatecalleridname']||'';}module[_0x999c('0x28')]=Final; \ No newline at end of file +var _0xa990=['starttime','endtime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridnum'];(function(_0x365ca7,_0x48dc76){var _0x882916=function(_0x20451c){while(--_0x20451c){_0x365ca7['push'](_0x365ca7['shift']());}};_0x882916(++_0x48dc76);}(_0xa990,0xc9));var _0x0a99=function(_0x4e3b4a,_0x12c4b5){_0x4e3b4a=_0x4e3b4a-0x0;var _0x1190b9=_0xa990[_0x4e3b4a];return _0x1190b9;};'use strict';var util=require(_0x0a99('0x0'));var _=require(_0x0a99('0x1'));var moment=require(_0x0a99('0x2'));function getSeconds(_0x1270a9,_0x8c0f6){var _0x3d0232=moment(_0x1270a9)[_0x0a99('0x3')](0x0);var _0x394f1c=moment(_0x8c0f6)['milliseconds'](0x0);return _0x3d0232['diff'](_0x394f1c,_0x0a99('0x4'));}function Final(_0x3ed6d0){this[_0x0a99('0x5')]=_0x3ed6d0[_0x0a99('0x5')];this[_0x0a99('0x6')]=_0x3ed6d0[_0x0a99('0x6')];this[_0x0a99('0x7')]=_0x3ed6d0[_0x0a99('0x7')];this[_0x0a99('0x8')]=_0x3ed6d0[_0x0a99('0x7')]===_0x0a99('0x9')?'queue':_0x3ed6d0[_0x0a99('0x7')];this[_0x0a99('0xa')]=_0x3ed6d0['countbusyretry'];this['countcongestionretry']=_0x3ed6d0[_0x0a99('0xb')];this[_0x0a99('0xc')]=_0x3ed6d0[_0x0a99('0xc')];this[_0x0a99('0xd')]=_0x3ed6d0[_0x0a99('0xa')]+_0x3ed6d0['countcongestionretry']+_0x3ed6d0[_0x0a99('0xc')]+_0x3ed6d0[_0x0a99('0xe')]+_0x3ed6d0['countdropretry']+_0x3ed6d0[_0x0a99('0xf')]+_0x3ed6d0[_0x0a99('0x10')]+_0x3ed6d0[_0x0a99('0x11')];this[_0x0a99('0xe')]=_0x3ed6d0[_0x0a99('0xe')];this[_0x0a99('0x12')]=_0x3ed6d0[_0x0a99('0x12')];this[_0x0a99('0xf')]=_0x3ed6d0['countabandonedretry'];this['countmachineretry']=_0x3ed6d0[_0x0a99('0x10')];this[_0x0a99('0x11')]=_0x3ed6d0[_0x0a99('0x11')];this['queue']=_0x3ed6d0[_0x0a99('0x13')];this['calleridname']=_0x3ed6d0['calleridname'];this[_0x0a99('0x14')]=_0x3ed6d0[_0x0a99('0x14')];this[_0x0a99('0x15')]=_0x3ed6d0[_0x0a99('0x15')];this['responsetime']=_0x3ed6d0['responsetime'];this[_0x0a99('0x16')]=_0x3ed6d0[_0x0a99('0x17')];this[_0x0a99('0x18')]=_0x3ed6d0[_0x0a99('0x18')]||0x0;this['holdtime']=_0x3ed6d0['holdtime']||0x0;this[_0x0a99('0x19')]=_0x3ed6d0['talktime']||0x0;this[_0x0a99('0x1a')]=_0x3ed6d0['callback'];this[_0x0a99('0x1b')]=_0x3ed6d0['callbackuniqueid'];this[_0x0a99('0x1c')]=_0x3ed6d0[_0x0a99('0x1c')];this[_0x0a99('0x1d')]=_0x3ed6d0[_0x0a99('0x1d')];this[_0x0a99('0x1e')]=_0x3ed6d0[_0x0a99('0x1e')];this[_0x0a99('0x1f')]=_0x3ed6d0[_0x0a99('0x1f')];this[_0x0a99('0x20')]=_0x3ed6d0['UserId'];this['VoiceQueueId']=_0x3ed6d0[_0x0a99('0x21')];this[_0x0a99('0x22')]=_0x3ed6d0[_0x0a99('0x22')];this['originatecalleridnum']=_0x3ed6d0['originatecalleridnum']||'';this[_0x0a99('0x23')]=_0x3ed6d0[_0x0a99('0x23')]||'';}module[_0x0a99('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 33e6a2a..8883060 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 _0x6bc2=['countagentrejectretry','calleridname','name','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x6bc2,0x1a7));var _0x26bc=function(_0x5a0788,_0x1ccd64){_0x5a0788=_0x5a0788-0x0;var _0x408da5=_0x6bc2[_0x5a0788];return _0x408da5;};'use strict';var util=require(_0x26bc('0x0'));var _=require('lodash');var moment=require(_0x26bc('0x1'));function getSeconds(_0x4bd232,_0x4f0cd4){var _0x2db384=moment(_0x4bd232)[_0x26bc('0x2')](0x0);var _0x2a5b01=moment(_0x4f0cd4)[_0x26bc('0x2')](0x0);return _0x2db384['diff'](_0x2a5b01,'seconds');}function Hangup(_0x5d5775,_0x1aadba){this['state']=0x4;this[_0x26bc('0x3')]=_0x26bc('0x4');this[_0x26bc('0x5')]=_0x5d5775[_0x26bc('0x5')];this[_0x26bc('0x6')]=_0x5d5775[_0x26bc('0x6')];this['campaigntype']=_0x5d5775[_0x26bc('0x6')]===_0x26bc('0x7')?_0x26bc('0x8'):_0x5d5775[_0x26bc('0x6')];this[_0x26bc('0x9')]=_0x5d5775[_0x26bc('0x9')];this[_0x26bc('0xa')]=_0x5d5775[_0x26bc('0xa')];this['countnoanswerretry']=_0x5d5775[_0x26bc('0xb')];this[_0x26bc('0xc')]=_0x5d5775[_0x26bc('0x9')]+_0x5d5775[_0x26bc('0xa')]+_0x5d5775[_0x26bc('0xb')]+_0x5d5775[_0x26bc('0xd')]+_0x5d5775[_0x26bc('0xe')]+_0x5d5775[_0x26bc('0xf')]+_0x5d5775['countmachineretry']+_0x5d5775['countagentrejectretry'];this[_0x26bc('0xd')]=_0x5d5775[_0x26bc('0xd')];this['countdropretry']=_0x5d5775[_0x26bc('0xe')];this[_0x26bc('0xf')]=_0x5d5775[_0x26bc('0xf')];this[_0x26bc('0x10')]=_0x5d5775['countmachineretry'];this[_0x26bc('0x11')]=_0x5d5775['countagentrejectretry'];this['uniqueid']=_0x1aadba['uniqueid'];this[_0x26bc('0x12')]=_0x5d5775[_0x26bc('0x13')];this['calleridnum']=_0x5d5775['number'];this[_0x26bc('0x14')]=_0x5d5775[_0x26bc('0x14')];this[_0x26bc('0x15')]=_0x5d5775[_0x26bc('0x15')];this[_0x26bc('0x16')]=moment()[_0x26bc('0x17')](_0x26bc('0x18'));this['ringtime']=getSeconds(_0x5d5775[_0x26bc('0x15')],_0x5d5775[_0x26bc('0x14')]);this[_0x26bc('0x19')]=0x0;this[_0x26bc('0x1a')]=getSeconds(this[_0x26bc('0x16')],_0x5d5775[_0x26bc('0x15')]);this[_0x26bc('0x8')]=_0x5d5775[_0x26bc('0x8')];this[_0x26bc('0x1b')]='IVR';this[_0x26bc('0x1c')]=_0x1aadba[_0x26bc('0x1d')];this[_0x26bc('0x1e')]=_0x5d5775[_0x26bc('0x1e')];this['callbackuniqueid']=_0x5d5775[_0x26bc('0x1f')];this[_0x26bc('0x20')]=_0x5d5775[_0x26bc('0x20')];this[_0x26bc('0x21')]=_0x5d5775['recallme'];this[_0x26bc('0x22')]=_0x5d5775['ContactId'];this[_0x26bc('0x23')]=_0x5d5775[_0x26bc('0x23')];this[_0x26bc('0x24')]=_0x5d5775[_0x26bc('0x24')];this[_0x26bc('0x25')]=_0x5d5775[_0x26bc('0x25')];this[_0x26bc('0x26')]=_0x5d5775['CampaignId'];}module[_0x26bc('0x27')]=Hangup; \ No newline at end of file +var _0x7487=['VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x17772e,_0x3d4d93){var _0x21e766=function(_0x474f74){while(--_0x474f74){_0x17772e['push'](_0x17772e['shift']());}};_0x21e766(++_0x3d4d93);}(_0x7487,0x14c));var _0x7748=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x7487[_0x42c118];return _0x112ebd;};'use strict';var util=require(_0x7748('0x0'));var _=require(_0x7748('0x1'));var moment=require(_0x7748('0x2'));function getSeconds(_0x562d6c,_0x35ece4){var _0x384a79=moment(_0x562d6c)['milliseconds'](0x0);var _0x218291=moment(_0x35ece4)[_0x7748('0x3')](0x0);return _0x384a79[_0x7748('0x4')](_0x218291,_0x7748('0x5'));}function Hangup(_0xe7a48d,_0x590ee0){this[_0x7748('0x6')]=0x4;this[_0x7748('0x7')]=_0x7748('0x8');this['scheduledat']=_0xe7a48d['scheduledat'];this[_0x7748('0x9')]=_0xe7a48d[_0x7748('0x9')];this[_0x7748('0xa')]=_0xe7a48d[_0x7748('0x9')]===_0x7748('0xb')?_0x7748('0xc'):_0xe7a48d[_0x7748('0x9')];this[_0x7748('0xd')]=_0xe7a48d['countbusyretry'];this[_0x7748('0xe')]=_0xe7a48d['countcongestionretry'];this['countnoanswerretry']=_0xe7a48d[_0x7748('0xf')];this[_0x7748('0x10')]=_0xe7a48d[_0x7748('0xd')]+_0xe7a48d[_0x7748('0xe')]+_0xe7a48d[_0x7748('0xf')]+_0xe7a48d['countnosuchnumberretry']+_0xe7a48d[_0x7748('0x11')]+_0xe7a48d[_0x7748('0x12')]+_0xe7a48d[_0x7748('0x13')]+_0xe7a48d['countagentrejectretry'];this['countnosuchnumberretry']=_0xe7a48d[_0x7748('0x14')];this['countdropretry']=_0xe7a48d['countdropretry'];this[_0x7748('0x12')]=_0xe7a48d[_0x7748('0x12')];this[_0x7748('0x13')]=_0xe7a48d[_0x7748('0x13')];this[_0x7748('0x15')]=_0xe7a48d[_0x7748('0x15')];this[_0x7748('0x16')]=_0x590ee0[_0x7748('0x16')];this[_0x7748('0x17')]=_0xe7a48d[_0x7748('0x18')];this[_0x7748('0x19')]=_0xe7a48d[_0x7748('0x1a')];this['starttime']=_0xe7a48d[_0x7748('0x1b')];this[_0x7748('0x1c')]=_0xe7a48d['responsetime'];this[_0x7748('0x1d')]=moment()[_0x7748('0x1e')](_0x7748('0x1f'));this[_0x7748('0x20')]=getSeconds(_0xe7a48d['responsetime'],_0xe7a48d['starttime']);this[_0x7748('0x21')]=0x0;this[_0x7748('0x22')]=getSeconds(this['endtime'],_0xe7a48d[_0x7748('0x1c')]);this[_0x7748('0xc')]=_0xe7a48d[_0x7748('0xc')];this[_0x7748('0x23')]=_0x7748('0x24');this['reason']=_0x590ee0['cause-txt'];this['callback']=_0xe7a48d[_0x7748('0x25')];this['callbackuniqueid']=_0xe7a48d[_0x7748('0x26')];this['callbackat']=_0xe7a48d[_0x7748('0x27')];this[_0x7748('0x28')]=_0xe7a48d[_0x7748('0x28')];this['ContactId']=_0xe7a48d[_0x7748('0x29')];this[_0x7748('0x2a')]=_0xe7a48d[_0x7748('0x2a')];this[_0x7748('0x2b')]=_0xe7a48d[_0x7748('0x2b')];this[_0x7748('0x2c')]=_0xe7a48d[_0x7748('0x2c')];this[_0x7748('0x2d')]=_0xe7a48d[_0x7748('0x2d')];}module[_0x7748('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8d9502b..336ef53 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 _0x969d=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','queue','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x46c6e4,_0x211abf){var _0x1ad288=function(_0x17826d){while(--_0x17826d){_0x46c6e4['push'](_0x46c6e4['shift']());}};_0x1ad288(++_0x211abf);}(_0x969d,0x117));var _0xd969=function(_0x295250,_0x2855a2){_0x295250=_0x295250-0x0;var _0x2e56fc=_0x969d[_0x295250];return _0x2e56fc;};'use strict';var util=require(_0xd969('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x47f348,_0x12205f){var _0x24da52=moment(_0x47f348)[_0xd969('0x1')](0x0);var _0x3fd01a=moment(_0x12205f)[_0xd969('0x1')](0x0);return _0x24da52[_0xd969('0x2')](_0x3fd01a,_0xd969('0x3'));}function History(_0x1782e8){this[_0xd969('0x4')]=_0x1782e8['uniqueid'];this[_0xd969('0x5')]=_0x1782e8[_0xd969('0x5')]||undefined;this['type']=_0x1782e8[_0xd969('0x6')];this[_0xd969('0x7')]=_0x1782e8[_0xd969('0x6')]===_0xd969('0x8')?'queue':_0x1782e8[_0xd969('0x6')];this[_0xd969('0x9')]=_0x1782e8[_0xd969('0x9')];this['countcongestionretry']=_0x1782e8[_0xd969('0xa')];this['countnoanswerretry']=_0x1782e8[_0xd969('0xb')];this[_0xd969('0xc')]=_0x1782e8[_0xd969('0x9')]+_0x1782e8[_0xd969('0xa')]+_0x1782e8['countnoanswerretry']+_0x1782e8[_0xd969('0xd')]+_0x1782e8['countdropretry']+_0x1782e8['countabandonedretry']+_0x1782e8[_0xd969('0xe')]+_0x1782e8['countagentrejectretry'];this[_0xd969('0xd')]=_0x1782e8['countnosuchnumberretry'];this[_0xd969('0xf')]=_0x1782e8[_0xd969('0xf')];this[_0xd969('0x10')]=_0x1782e8[_0xd969('0x10')];this[_0xd969('0xe')]=_0x1782e8['countmachineretry'];this[_0xd969('0x11')]=_0x1782e8[_0xd969('0x11')];this[_0xd969('0x12')]=_0x1782e8[_0xd969('0x12')];this[_0xd969('0x13')]=_0x1782e8[_0xd969('0x14')];this[_0xd969('0x15')]=_0x1782e8['number'];this[_0xd969('0x16')]=_0x1782e8[_0xd969('0x16')];this[_0xd969('0x17')]=_0x1782e8[_0xd969('0x17')];this[_0xd969('0x18')]=_0x1782e8[_0xd969('0x17')];this[_0xd969('0x19')]=getSeconds(_0x1782e8[_0xd969('0x17')],_0x1782e8[_0xd969('0x16')]);this[_0xd969('0x1a')]=0x0;this['talktime']=0x0;this[_0xd969('0x1b')]=_0x1782e8[_0xd969('0x1b')];this[_0xd969('0x1c')]=_0x1782e8[_0xd969('0x1c')];this[_0xd969('0x1d')]=_0x1782e8[_0xd969('0x1d')];this[_0xd969('0x1e')]=_0x1782e8['recallme'];this[_0xd969('0x1f')]=_0x1782e8[_0xd969('0x1f')];this[_0xd969('0x20')]=_0x1782e8[_0xd969('0x20')];this[_0xd969('0x21')]=_0x1782e8['UserId'];this[_0xd969('0x22')]=_0x1782e8[_0xd969('0x22')];this[_0xd969('0x23')]=_0x1782e8['CampaignId'];this[_0xd969('0x24')]=_0x1782e8[_0xd969('0x24')]||'';this[_0xd969('0x25')]=_0x1782e8[_0xd969('0x25')]||'';}module[_0xd969('0x26')]=History; \ No newline at end of file +var _0x911a=['exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1c1bd,_0x1c6b84){var _0x38ae2f=function(_0x7dcf4a){while(--_0x7dcf4a){_0x1c1bd['push'](_0x1c1bd['shift']());}};_0x38ae2f(++_0x1c6b84);}(_0x911a,0xba));var _0xa911=function(_0x58dd10,_0xbcfbdb){_0x58dd10=_0x58dd10-0x0;var _0x2cbc51=_0x911a[_0x58dd10];return _0x2cbc51;};'use strict';var util=require('util');var _=require(_0xa911('0x0'));var moment=require(_0xa911('0x1'));function getSeconds(_0x4d33b0,_0x1ac851){var _0x329786=moment(_0x4d33b0)[_0xa911('0x2')](0x0);var _0x59ef96=moment(_0x1ac851)[_0xa911('0x2')](0x0);return _0x329786[_0xa911('0x3')](_0x59ef96,_0xa911('0x4'));}function History(_0x2dbbe4){this[_0xa911('0x5')]=_0x2dbbe4['uniqueid'];this[_0xa911('0x6')]=_0x2dbbe4['scheduledat']||undefined;this[_0xa911('0x7')]=_0x2dbbe4[_0xa911('0x7')];this[_0xa911('0x8')]=_0x2dbbe4['type']==='outbound'?_0xa911('0x9'):_0x2dbbe4[_0xa911('0x7')];this[_0xa911('0xa')]=_0x2dbbe4[_0xa911('0xa')];this[_0xa911('0xb')]=_0x2dbbe4[_0xa911('0xb')];this['countnoanswerretry']=_0x2dbbe4[_0xa911('0xc')];this['countglobal']=_0x2dbbe4[_0xa911('0xa')]+_0x2dbbe4['countcongestionretry']+_0x2dbbe4[_0xa911('0xc')]+_0x2dbbe4[_0xa911('0xd')]+_0x2dbbe4[_0xa911('0xe')]+_0x2dbbe4[_0xa911('0xf')]+_0x2dbbe4[_0xa911('0x10')]+_0x2dbbe4[_0xa911('0x11')];this['countnosuchnumberretry']=_0x2dbbe4['countnosuchnumberretry'];this[_0xa911('0xe')]=_0x2dbbe4[_0xa911('0xe')];this[_0xa911('0xf')]=_0x2dbbe4[_0xa911('0xf')];this[_0xa911('0x10')]=_0x2dbbe4['countmachineretry'];this[_0xa911('0x11')]=_0x2dbbe4[_0xa911('0x11')];this[_0xa911('0x9')]=_0x2dbbe4[_0xa911('0x9')];this[_0xa911('0x12')]=_0x2dbbe4[_0xa911('0x13')];this[_0xa911('0x14')]=_0x2dbbe4['number'];this['starttime']=_0x2dbbe4[_0xa911('0x15')];this[_0xa911('0x16')]=_0x2dbbe4[_0xa911('0x16')];this['endtime']=_0x2dbbe4[_0xa911('0x16')];this[_0xa911('0x17')]=getSeconds(_0x2dbbe4[_0xa911('0x16')],_0x2dbbe4[_0xa911('0x15')]);this[_0xa911('0x18')]=0x0;this['talktime']=0x0;this['callback']=_0x2dbbe4[_0xa911('0x19')];this['callbackuniqueid']=_0x2dbbe4[_0xa911('0x1a')];this[_0xa911('0x1b')]=_0x2dbbe4['callbackat'];this[_0xa911('0x1c')]=_0x2dbbe4[_0xa911('0x1c')];this[_0xa911('0x1d')]=_0x2dbbe4[_0xa911('0x1d')];this[_0xa911('0x1e')]=_0x2dbbe4[_0xa911('0x1e')];this['UserId']=_0x2dbbe4[_0xa911('0x1f')];this[_0xa911('0x20')]=_0x2dbbe4[_0xa911('0x20')];this[_0xa911('0x21')]=_0x2dbbe4[_0xa911('0x21')];this[_0xa911('0x22')]=_0x2dbbe4[_0xa911('0x22')]||'';this['originatecalleridname']=_0x2dbbe4[_0xa911('0x23')]||'';}module[_0xa911('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 4759975..73fa424 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 _0x2c54=['exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','AMD','custom:amd','amd','[syncHangupInAMD]','MACHINE','Machine','membername','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnosuchnumberretry','countabandonedretry','stateGlobal','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','starttime','endtime','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','timezones','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','dialGlobalInterval','\x5cw{0,','pow','replace','random','match','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','updatedAt','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','Abandoned','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','Predictive\x20for\x20every\x20interval','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','exports','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','message','Error','stringify','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','startPredictive','Trunk','active','format','voice_queue:save','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','milliseconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','state','statedesc','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','catch','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','[emptyContact][createHistory]','isSuccess','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x2c54,0x136));var _0x42c5=function(_0x51d70b,_0x17c1b1){_0x51d70b=_0x51d70b-0x0;var _0x3f5334=_0x2c54[_0x51d70b];return _0x3f5334;};'use strict';var util=require(_0x42c5('0x0'));var _=require(_0x42c5('0x1'));var BPromise=require(_0x42c5('0x2'));var uuid=require('uuid');var moment=require(_0x42c5('0x3'));var rr=require('rr');var md5=require(_0x42c5('0x4'));var Redis=require(_0x42c5('0x5'));var ut=require(_0x42c5('0x6'));var config=require(_0x42c5('0x7'));var logger=require(_0x42c5('0x8'))('dialer');var loggerBooked=require(_0x42c5('0x8'))('booked');var loggerPredictive=require('../../../config/logger')(_0x42c5('0x9'));var loggerPredictiveCalls=require(_0x42c5('0x8'))(_0x42c5('0xa'));var loggerSyncQueueSummary=require(_0x42c5('0x8'))(_0x42c5('0xb'));var ami=require(_0x42c5('0xc'));config[_0x42c5('0xd')]=_[_0x42c5('0xe')](config[_0x42c5('0xd')],{'host':_0x42c5('0xf'),'port':0x18eb});var io=require(_0x42c5('0x10'))(new Redis(config[_0x42c5('0xd')]));var cmHopper=require(_0x42c5('0x11'));var cmHopperHistory=require(_0x42c5('0x12'));var cmHopperBlack=require(_0x42c5('0x13'));var voiceQueueRt=require(_0x42c5('0x14'));var Action=require(_0x42c5('0x15'));var History=require(_0x42c5('0x16'));var Final=require(_0x42c5('0x17'));var AgentComplete=require(_0x42c5('0x18'));var QueueCallerAbandon=require(_0x42c5('0x19'));var Hangup=require(_0x42c5('0x1a'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x42c5('0x1b');var strategy={'rrmemory':_0x42c5('0x1c'),'roundrobin':_0x42c5('0x1d')};var Sequence=function(){};Sequence[_0x42c5('0x1e')]['enqueue']=function(_0x374218){this[_0x42c5('0x1f')]=this[_0x42c5('0x1f')]?this['tail'][_0x42c5('0x20')](_0x374218):_0x374218();};function Dialer(_0x4967b4,_0x48d227){this[_0x42c5('0x21')]=new Sequence();this['preview']=_0x48d227;this['voiceQueues']=_0x4967b4[_0x42c5('0x22')];this[_0x42c5('0x23')]=_0x4967b4[_0x42c5('0x23')];this[_0x42c5('0x24')]=_0x4967b4[_0x42c5('0x24')];this[_0x42c5('0x25')]=_0x4967b4[_0x42c5('0x25')];this[_0x42c5('0x26')]=config[_0x42c5('0x26')]||0x2;this[_0x42c5('0x27')]={};this[_0x42c5('0x28')]={};this[_0x42c5('0x29')]={};this[_0x42c5('0x2a')]={};this[_0x42c5('0x2b')]={};this['startPredictive']={};this[_0x42c5('0x2c')]={};this[_0x42c5('0x2d')]={};this[_0x42c5('0x2e')]={};this['queueBookedRR']={};ami['on'](_0x42c5('0x2f'),this[_0x42c5('0x30')]['bind'](this));ami['on'](_0x42c5('0x31'),this[_0x42c5('0x32')][_0x42c5('0x33')](this));ami['on'](_0x42c5('0x34'),this[_0x42c5('0x35')][_0x42c5('0x33')](this));ami['on']('agentcomplete',this[_0x42c5('0x36')]['bind'](this));ami['on'](_0x42c5('0x37'),this[_0x42c5('0xb')]['bind'](this));ami['on'](_0x42c5('0x38'),this['syncHangup'][_0x42c5('0x33')](this));ami['on'](_0x42c5('0x39'),this[_0x42c5('0x3a')][_0x42c5('0x33')](this));ami['on'](_0x42c5('0x3b'),this[_0x42c5('0x3c')]['bind'](this));ami['on'](_0x42c5('0x3d'),this['syncQueueMember'][_0x42c5('0x33')](this));ami['on'](_0x42c5('0x3e'),this[_0x42c5('0x3f')][_0x42c5('0x33')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0xc0b1fb){return _0xc0b1fb!==null&&!_[_0x42c5('0x40')](_0xc0b1fb);}function checkIsLoggedIn(_0x55e7dd,_0x13daf0){return function(){if(_0x13daf0<=0x0){_0x55e7dd['message']=_0x42c5('0x41');throw _0x55e7dd['name']+_0x42c5('0x42');}};}function isActive(_0x44e4b6){return _0x44e4b6;}function checkIsActive(_0x8ca711,_0x537004){return function(){if(!isActive(_0x537004)){_0x8ca711['message']=_0x42c5('0x43');throw _0x8ca711[_0x42c5('0x44')]+_0x42c5('0x45');}};}function checkInterval(_0x341b93){return function(){if(!isNotNull(_0x341b93['Interval'])){_0x341b93['message']=_0x42c5('0x46');throw _0x341b93[_0x42c5('0x44')]+_0x42c5('0x47');}if(!isNotNull(_0x341b93[_0x42c5('0x48')][_0x42c5('0x49')])){_0x341b93['message']=_0x42c5('0x46');throw _0x341b93[_0x42c5('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x42c5('0x4a')](_0x341b93['Interval'][_0x42c5('0x49')]))){_0x341b93[_0x42c5('0x4b')]='INTERVAL_IS_NULL';throw _0x341b93['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x541291,_0x320cb1,_0x2bb41e){return{'action':_0x541291,'response':_0x320cb1,'message':_0x2bb41e,'stack':_0x2bb41e};}function myreject(_0x10006e){return function(_0x1d0ca5){return _0x10006e(msgResponse('[ifTime][Action]',_0x42c5('0x4c'),JSON[_0x42c5('0x4d')](_0x1d0ca5)));};}function getSeconds(_0x416198,_0x3d0146){var _0x481202=moment(_0x416198)['milliseconds'](0x0);var _0x2c4c8d=moment(_0x3d0146)['milliseconds'](0x0);return _0x481202['diff'](_0x2c4c8d,'seconds');}function emit(_0x189d0d,_0xb1474f,_0x35e1e7){io['to'](_0x189d0d)[_0x42c5('0x4e')](_0xb1474f,_0x35e1e7);}function emitVoiceQueueSummary(_0xfadd46){if(_0xfadd46[_0x42c5('0x4f')]===_0x42c5('0x50')){var _0x273a09={'id':_0xfadd46['id'],'name':_0xfadd46[_0x42c5('0x44')],'strategy':_0xfadd46[_0x42c5('0x51')],'answered':_0xfadd46['answered'],'available':_0xfadd46[_0x42c5('0x52')],'loggedIn':_0xfadd46[_0x42c5('0x53')],'pTalking':_0xfadd46[_0x42c5('0x54')],'sumBillable':_0xfadd46[_0x42c5('0x55')],'sumDuration':_0xfadd46[_0x42c5('0x56')],'sumHoldTime':_0xfadd46['sumHoldTime']||0x0,'talking':_0xfadd46[_0x42c5('0x57')],'total':_0xfadd46['total'],'type':_0xfadd46[_0x42c5('0x4f')],'unmanaged':_0xfadd46[_0x42c5('0x58')],'abandoned':_0xfadd46[_0x42c5('0x59')],'waiting':_0xfadd46[_0x42c5('0x5a')],'loggedInDb':_0xfadd46[_0x42c5('0x5b')],'dialActive':_0xfadd46[_0x42c5('0x5c')],'dialMethod':_0xfadd46[_0x42c5('0x5d')],'dialOriginateCallerIdName':_0xfadd46[_0x42c5('0x5e')],'dialOriginateCallerIdNumber':_0xfadd46[_0x42c5('0x5f')],'dialOriginateTimeout':_0xfadd46[_0x42c5('0x60')],'dialPrefix':_0xfadd46[_0x42c5('0x61')],'outboundAnswerAgiCallsDay':_0xfadd46[_0x42c5('0x62')],'outboundAnswerCallsDay':_0xfadd46[_0x42c5('0x63')],'outboundBlacklistCallsDay':_0xfadd46[_0x42c5('0x64')],'outboundBusyCallsDay':_0xfadd46[_0x42c5('0x65')],'outboundCongestionCallsDay':_0xfadd46[_0x42c5('0x66')],'outboundDropCallsDayACS':_0xfadd46[_0x42c5('0x67')],'outboundDropCallsDayCallersExit':_0xfadd46[_0x42c5('0x68')],'outboundDropCallsDayTimeout':_0xfadd46[_0x42c5('0x69')],'outboundNoAnswerCallsDay':_0xfadd46[_0x42c5('0x6a')],'outboundNoSuchCallsDay':_0xfadd46[_0x42c5('0x6b')],'outboundOriginateFailureCallsDay':_0xfadd46['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xfadd46[_0x42c5('0x6c')],'outboundRejectCallsDay':_0xfadd46[_0x42c5('0x6d')],'outboundUnknownCallsDay':_0xfadd46['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xfadd46[_0x42c5('0x6e')],'predictiveIntervalAvgHoldtime':_0xfadd46[_0x42c5('0x6f')],'predictiveIntervalAvgTalktime':_0xfadd46['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xfadd46[_0x42c5('0x70')],'predictiveIntervalDroppedCallsTimeout':_0xfadd46[_0x42c5('0x71')],'predictiveIntervalErlangCalls':_0xfadd46[_0x42c5('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0xfadd46[_0x42c5('0x73')],'predictiveIntervalHitRate':_0xfadd46[_0x42c5('0x74')],'predictiveIntervalMultiplicativeFactor':_0xfadd46[_0x42c5('0x75')],'predictiveIntervalPauses':_0xfadd46[_0x42c5('0x76')],'predictiveIntervalAvailable':_0xfadd46['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xfadd46['predictiveIntervalTotalCalls'],'message':_0xfadd46[_0x42c5('0x4b')],'originated':_0xfadd46[_0x42c5('0x77')],'erlangCalls':_0xfadd46[_0x42c5('0x78')],'erlangCallToSecond':_0xfadd46[_0x42c5('0x79')],'erlangAbandonmentRate':_0xfadd46['erlangAbandonmentRate'],'erlangBusyFactor':_0xfadd46['erlangBusyFactor'],'startPredictive':_0xfadd46[_0x42c5('0x7a')],'startProgressive':_0xfadd46[_0x42c5('0x2c')]};if(_0xfadd46[_0x42c5('0x7b')]){_0x273a09[_0x42c5('0x7b')]={'id':_0xfadd46[_0x42c5('0x7b')]['id'],'name':_0xfadd46['Trunk'][_0x42c5('0x44')],'active':_0xfadd46[_0x42c5('0x7b')][_0x42c5('0x7c')],'callerid':_0xfadd46[_0x42c5('0x7b')]['callerid']};}if(_0xfadd46[_0x42c5('0x48')]){_0x273a09[_0x42c5('0x48')]={'id':_0xfadd46[_0x42c5('0x48')]['id'],'name':_0xfadd46[_0x42c5('0x48')][_0x42c5('0x44')]};}var _0x11f594=md5(JSON[_0x42c5('0x4d')](_0x273a09));if(_0xfadd46[_0x42c5('0x4')]!==_0x11f594){_0xfadd46[_0x42c5('0x4')]=_0x11f594;emit(util[_0x42c5('0x7d')]('voice:queue:%s',_0x273a09[_0x42c5('0x44')]),_0x42c5('0x7e'),_0x273a09);}}}function emitCampaignSummary(_0x175323){if(_0x175323['type']===_0x42c5('0x7f')){emit(util[_0x42c5('0x7d')]('campaign:ivr:%s',_0x175323[_0x42c5('0x44')]),_0x42c5('0x80'),_0x175323);}}function checkGetDataPredictive(_0x3f3942){if(isNotNull(_0x3f3942)&&!_[_0x42c5('0x4a')](_0x3f3942)){loggerPredictive['info'](_0x42c5('0x81'));loggerPredictive[_0x42c5('0x82')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f3942['predictiveIntervalTotalCalls']);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x83'),_0x3f3942['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f3942[_0x42c5('0x71')]);loggerPredictive['info'](_0x42c5('0x84'),_0x3f3942[_0x42c5('0x70')]);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x85'),_0x3f3942[_0x42c5('0x6f')]);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x86'),_0x3f3942[_0x42c5('0x87')]);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x88'));if(_0x3f3942[_0x42c5('0x89')]>0x0){if(!_[_0x42c5('0x40')](_0x3f3942[_0x42c5('0x87')])&&_0x3f3942[_0x42c5('0x87')]>0x0){return!![];}loggerPredictive['info'](_0x42c5('0x8a'));if(!_[_0x42c5('0x40')](_0x3f3942[_0x42c5('0x6f')])&&_0x3f3942[_0x42c5('0x6f')]>0x0){return!![];}loggerPredictive[_0x42c5('0x82')](_0x42c5('0x8b'));}else{loggerPredictive[_0x42c5('0x82')](_0x42c5('0x8c'));}}else{loggerPredictive[_0x42c5('0x82')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x35b179){return function(_0x30503c){loggerPredictive[_0x42c5('0x82')](_0x42c5('0x8d'));loggerPredictive[_0x42c5('0x82')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30503c[_0x42c5('0x78')]);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x8e'),_0x30503c[_0x42c5('0x79')]);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x8f'),_0x30503c[_0x42c5('0x90')]);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x91'),_0x30503c['erlangBusyFactor']);loggerPredictive[_0x42c5('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30503c[_0x42c5('0x90')]);loggerPredictive['info']('---------------------------');_[_0x42c5('0x92')](_0x35b179,_0x30503c);};}function getDiff(_0x5e0647){var _0x101c27=moment()['milliseconds'](0x0);var _0x41a33e=moment(_0x5e0647)[_0x42c5('0x93')](0x0);return _0x101c27['diff'](_0x41a33e,'seconds');}function ifInterval(_0x21173c,_0xed290){if(_[_0x42c5('0x40')](_0xed290)){return![];}return getDiff(_0xed290)<_0x21173c*0x3c;}function freeVariablesPredictive(_0x377b95){if(isNotNull(_0x377b95)){if(!_[_0x42c5('0x40')](_0x377b95[_0x42c5('0x2c')])){_0x377b95[_0x42c5('0x2c')]=undefined;loggerPredictive[_0x42c5('0x82')](_0x377b95[_0x42c5('0x44')],_0x42c5('0x94'));}if(!_['isUndefined'](_0x377b95[_0x42c5('0x7a')])){_0x377b95[_0x42c5('0x7a')]=undefined;loggerPredictive[_0x42c5('0x82')](_0x377b95[_0x42c5('0x44')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x42c5('0x40')](_0x377b95[_0x42c5('0x95')])){clearInterval(_0x377b95[_0x42c5('0x95')]);_0x377b95[_0x42c5('0x95')]=undefined;loggerPredictive[_0x42c5('0x82')](_0x377b95[_0x42c5('0x44')],_0x42c5('0x96'));}}}function erlangb(_0x141bb7,_0x2319a8){if(_0x2319a8===0x0){return 0x0;}var _0xd17953=0x1;for(var _0xee8fca=0x1;_0xee8fca<=_0x2319a8;_0xee8fca+=0x1){_0xd17953=0x1+_0xd17953*_0xee8fca/_0x141bb7;}return 0x1/_0xd17953;}function isVoiceQueueOutbound(_0x3c7254){return _0x3c7254===_0x42c5('0x50');}function isNotPreview(_0x131cd6){return _0x131cd6!=='preview';}function isCampaignIvr(_0x586e1b){return _0x586e1b===_0x42c5('0x7f');}function getCallerId(_0x217db6,_0x3973d7,_0x55bde8){if(!_[_0x42c5('0x40')](_0x55bde8)&&typeof _0x55bde8===_0x42c5('0x97')&&!_[_0x42c5('0x4a')](_0x55bde8)){if(!_['isUndefined'](_0x3973d7)&&typeof _0x3973d7===_0x42c5('0x97')&&!_[_0x42c5('0x4a')](_0x3973d7)){return util['format'](_0x42c5('0x98'),_0x3973d7,_0x55bde8);}return util['format'](_0x42c5('0x98'),_0x55bde8,_0x55bde8);}if(!_['isUndefined'](_0x217db6)&&typeof _0x217db6===_0x42c5('0x97')&&!_[_0x42c5('0x4a')](_0x217db6)){return _0x217db6;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x49b39a,_0x1f2122){return function(_0xa3d87b){freeVariablesPredictive(_0x1f2122);emitVoiceQueueSummary(_0x1f2122);emitCampaignSummary(_0x1f2122);loggerSyncQueueSummary[_0x42c5('0x99')](_0x49b39a,util[_0x42c5('0x9a')](_0xa3d87b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x38429e,_0x5df2c3){return function(_0x271cd6){loggerPredictive[_0x42c5('0x99')](_0x5df2c3[_0x42c5('0x44')],_0x38429e);loggerPredictive[_0x42c5('0x99')](_0x271cd6[_0x42c5('0x9b')]);freeVariablesPredictive(_0x5df2c3);};}function loggerCatch(_0x5e3fbc){return function(_0x5900ac){logger['error'](_0x5e3fbc,util['inspect'](_0x5900ac,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x322542){return _0x322542&&!_[_0x42c5('0x40')](_0x322542)&&_0x322542[_0x42c5('0x9c')]>0x0;}function decremetOriginate(_0x4635a4){if(!_[_0x42c5('0x40')](_0x4635a4)&&_0x4635a4!==null){if(typeof _0x4635a4[_0x42c5('0x77')]!==_0x42c5('0x9d')){if(_0x4635a4[_0x42c5('0x77')]>0x0){_0x4635a4['originated']-=0x1;}else{logger[_0x42c5('0x99')](_0x42c5('0x9e'));}}}else{logger[_0x42c5('0x99')](_0x42c5('0x9f'));}}function checkContactLowerLimitOriginate(_0x4c83ec,_0xff327e,_0x33a2d1){if(_0xff327e>_0x33a2d1){for(var _0x14f534=0x0;_0x14f534<_0xff327e-_0x33a2d1;_0x14f534+=0x1){decremetOriginate(_0x4c83ec);}}}function loggerGetContactDialer(_0x184364,_0x340e7,_0x4b23a5){return function(_0x38dd99){checkContactLowerLimitOriginate(_0x340e7,_0x4b23a5,0x0);logger['error'](_0x184364,util[_0x42c5('0x9a')](_0x38dd99,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x187784){return function(_0x1406a5){if(isNotNull(_0x1406a5)&&isNotNull(_0x1406a5[0x0])){if(_0x1406a5[0x0][_0x42c5('0xa0')]>0x0){_0x187784['message']='RESCHEDULED_CONTACTS';logger[_0x42c5('0x82')]('[getContactDialer2][ReScheduled]'+_0x187784[_0x42c5('0x44')],_0x1406a5[0x0]['contactsRescheduled'],_0x42c5('0xa1'));}else{_0x187784[_0x42c5('0x4b')]=_0x42c5('0xa2');logger[_0x42c5('0x82')](_0x42c5('0xa3')+_0x187784['name']);}}};}function notSendMessagesQueue(_0x27ace9){if(_0x27ace9[_0x42c5('0xa4')]){freeVariablesPredictive(_0x27ace9);if(_0x27ace9[_0x42c5('0x77')]===0x0&&_0x27ace9[_0x42c5('0x57')]===0x0&&_0x27ace9[_0x42c5('0x5a')]===0x0&&(_0x27ace9[_0x42c5('0x54')]||0x0)===0x0){_0x27ace9[_0x42c5('0xa4')]=![];_0x27ace9['available']=0x0;_0x27ace9[_0x42c5('0x4b')]=_0x42c5('0x43');loggerSyncQueueSummary[_0x42c5('0x99')](_0x42c5('0xa5'),_0x27ace9['name'],'is\x20not\x20active');}else{_0x27ace9['message']=_0x42c5('0xa6');loggerSyncQueueSummary[_0x42c5('0x99')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x27ace9[_0x42c5('0x44')],'is\x20disactive');}emitVoiceQueueSummary(_0x27ace9);}}function notSendMessagesCampaign(_0x409225){if(_0x409225['sendMessageOneNotActive']){if(_0x409225[_0x42c5('0x77')]===0x0){_0x409225[_0x42c5('0xa4')]=![];_0x409225[_0x42c5('0x4b')]=_0x42c5('0x43');loggerSyncQueueSummary['error'](_0x42c5('0xa7'),_0x409225[_0x42c5('0x44')],_0x42c5('0xa8'));}else{_0x409225[_0x42c5('0x4b')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x42c5('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x409225['name'],_0x42c5('0xa9'));}emitCampaignSummary(_0x409225);}}function createObjHistory(_0x4a097a,_0xbad253,_0xc9ff20,_0x3bdf45,_0x2a2c50){_0x4a097a['message']=_0xc9ff20;var _0x221fc9=new Action(_0x4a097a,_0xbad253);var _0x1fa9e4=new History(_0x221fc9);_0x1fa9e4[_0x42c5('0xaa')]=_0x3bdf45;_0x1fa9e4[_0x42c5('0xab')]=_0x2a2c50;_0x1fa9e4['endtime']=_0x221fc9['starttime'];return _0x1fa9e4;}Dialer[_0x42c5('0x1e')][_0x42c5('0xac')]=function(){var _0xa18694=this;setInterval(function(){_0xa18694[_0x42c5('0xad')](_0xa18694[_0x42c5('0x2a')],_0x42c5('0xae'));_0xa18694[_0x42c5('0xad')](_0xa18694['actions'],_0x42c5('0xaf'));},0x32c8);};Dialer['prototype'][_0x42c5('0xad')]=function(_0x5d392a,_0x1afe8e){var _0x31ca80=this;for(var _0x2353da in _0x5d392a){if(typeof _0x5d392a[_0x2353da]!==_0x42c5('0x9d')){this['sequence']['enqueue'](function(){if(!_[_0x42c5('0xb0')](_0x5d392a[_0x2353da])){return ami[_0x42c5('0xb1')]({'action':_0x42c5('0xb2'),'channel':_0x5d392a[_0x2353da]['channel']})[_0x42c5('0xb3')](function(_0x476ef4){if(_0x476ef4['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5d392a[_0x2353da]&&_0x5d392a[_0x2353da][_0x42c5('0x4f')]!==_0x42c5('0x7f')){_0x31ca80[_0x42c5('0xb4')](_0x31ca80[_0x42c5('0x22')][_0x5d392a[_0x2353da]['queue']]);logger[_0x42c5('0x99')](_0x42c5('0xb5'),_0x1afe8e,_0x2353da,_0x5d392a[_0x2353da][_0x42c5('0xb6')]);delete _0x5d392a[_0x2353da];}if(_0x5d392a[_0x2353da]&&_0x5d392a[_0x2353da][_0x42c5('0x4f')]==='ivr'){_0x31ca80[_0x42c5('0xb4')](_0x31ca80[_0x42c5('0x23')][_0x5d392a[_0x2353da]['queue']]);logger['error'](_0x42c5('0xb7'),_0x1afe8e,_0x2353da,_0x5d392a[_0x2353da]['queue']);delete _0x5d392a[_0x2353da];}},0x2328);}});}});}}};Dialer['prototype'][_0x42c5('0xb8')]=function(_0x3d0e5b){return BPromise[_0x42c5('0xb9')]()[_0x42c5('0xba')](cmHopper[_0x42c5('0xb8')](_0x3d0e5b))['catch'](loggerCatch(_0x42c5('0xbb')));};Dialer[_0x42c5('0x1e')]['checkIsBlackList']=function(_0x42a340){return BPromise[_0x42c5('0xb9')]()[_0x42c5('0xba')](cmHopperBlack['checkIsBlackList'](_0x42a340))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xbc')));};Dialer[_0x42c5('0x1e')]['checkIsBlackListIvr']=function(_0x50ffc3){return BPromise[_0x42c5('0xb9')]()[_0x42c5('0xba')](cmHopperBlack['checkIsBlackListIvr'](_0x50ffc3))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xbd')));};Dialer[_0x42c5('0x1e')]['averageHandleTime']=function(_0x5ea013){return BPromise['resolve']()[_0x42c5('0xba')](cmHopperHistory['avgHandleTime'](_0x5ea013))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xbe')));};Dialer[_0x42c5('0x1e')][_0x42c5('0xbf')]=function(_0x5c4801){return BPromise[_0x42c5('0xb9')]()[_0x42c5('0xba')](cmHopper[_0x42c5('0xbf')](_0x5c4801))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xc0')));};Dialer['prototype'][_0x42c5('0xc1')]=function(_0x3eb896,_0x20a43a,_0x134318){return BPromise[_0x42c5('0xb9')]()['then'](cmHopper[_0x42c5('0xc1')](_0x3eb896,_0x20a43a,_0x134318))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xc2')));};Dialer[_0x42c5('0x1e')]['getContactDialer']=function(_0x1ab396,_0x49841c,_0x36c762,_0x4ba958,_0x4a3f23){return BPromise['resolve']()['then'](cmHopper['getContactDialer'](_0x1ab396,_0x49841c,_0x36c762,_0x4ba958))[_0x42c5('0xb3')](function(_0x5e98bd){_0x4a3f23[_0x42c5('0xc3')]-=_0x36c762;_0x4a3f23[_0x42c5('0xc3')]=_0x4a3f23[_0x42c5('0xc3')]>0x0?_0x4a3f23[_0x42c5('0xc3')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x5e98bd);});};Dialer[_0x42c5('0x1e')]['getContactDialerIvr']=function(_0x75af3e,_0x370744,_0x16b940,_0x1f86c5){return BPromise['resolve']()[_0x42c5('0xba')](cmHopper[_0x42c5('0xc4')](_0x75af3e,_0x370744,_0x16b940))['catch'](function(_0x1c028b){_0x1f86c5['temp']-=_0x370744;_0x1f86c5[_0x42c5('0xc3')]=_0x1f86c5[_0x42c5('0xc3')]>0x0?_0x1f86c5[_0x42c5('0xc3')]:0x0;loggerCatch(_0x42c5('0xc5'))(_0x1c028b);});};Dialer[_0x42c5('0x1e')][_0x42c5('0xc6')]=function(_0x23418a){return BPromise[_0x42c5('0xb9')]()[_0x42c5('0xba')](voiceQueueRt[_0x42c5('0xc6')](_0x23418a))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xc7')));};Dialer[_0x42c5('0x1e')][_0x42c5('0xc8')]=function(_0x25685c){return BPromise[_0x42c5('0xb9')]()[_0x42c5('0xba')](cmHopper[_0x42c5('0xc8')](_0x25685c))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xc9')));};Dialer['prototype'][_0x42c5('0xca')]=function(_0x1a27b6){return BPromise[_0x42c5('0xb9')]()['then'](cmHopperHistory[_0x42c5('0xca')](_0x1a27b6))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xcb')));};Dialer['prototype'][_0x42c5('0xb4')]=function(_0x2b0dee){if(!_[_0x42c5('0x40')](_0x2b0dee)&&_0x2b0dee!==null){if(typeof _0x2b0dee['originated']!==_0x42c5('0x9d')){if(_0x2b0dee['originated']>0x0){_0x2b0dee[_0x42c5('0x77')]-=0x1;}else{logger[_0x42c5('0x99')](_0x42c5('0xcc'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x42c5('0x1e')][_0x42c5('0xcd')]=function(_0x416fd0,_0x28fbf7){var _0x401255=this;return function(_0x5e9a09){_0x401255[_0x42c5('0xb4')](_0x28fbf7);logger[_0x42c5('0x99')](_0x416fd0,util[_0x42c5('0x9a')](_0x5e9a09,{'showHidden':![],'depth':null}));};};Dialer[_0x42c5('0x1e')][_0x42c5('0xce')]=function(_0xc9be07,_0x24aba3,_0x1dfd38){var _0x308252={'state':0x19,'statedesc':_0x42c5('0xcf')};this[_0x42c5('0xb4')](_0x24aba3);this[_0x42c5('0xd0')](_['merge'](_0x308252,_[_0x42c5('0xd1')](_0x1dfd38,[_0x42c5('0xd2'),_0x42c5('0xd3'),_0x42c5('0xd4'),'VoiceQueueId','CampaignId'])),_0x42c5('0xd5'),'[emptyContact]');logger[_0x42c5('0x99')](_0xc9be07);};Dialer['prototype'][_0x42c5('0xd6')]=function(_0x2c02a3){return _0x2c02a3==='Success';};Dialer[_0x42c5('0x1e')][_0x42c5('0xd7')]=function(_0x2b9a39){return!_[_0x42c5('0x40')](_0x2b9a39)&&_0x2b9a39&&!_[_0x42c5('0x40')](_0x2b9a39[_0x42c5('0x44')])&&!_[_0x42c5('0x40')](_0x2b9a39[_0x42c5('0x7c')])&&_0x2b9a39[_0x42c5('0x7c')]&&(this[_0x42c5('0x25')][util[_0x42c5('0x7d')]('SIP/%s',_0x2b9a39[_0x42c5('0x44')])][_0x42c5('0xb2')]===_0x42c5('0xd8')||this[_0x42c5('0x25')][util[_0x42c5('0x7d')](_0x42c5('0xd9'),_0x2b9a39[_0x42c5('0x44')])][_0x42c5('0xb2')]===_0x42c5('0xda'));};Dialer[_0x42c5('0x1e')]['saveInDb']=function(_0x41e4b7,_0x2e85bb,_0x3e1fba){this[_0x42c5('0xca')](_0x41e4b7)[_0x42c5('0xb3')](loggerCatch(_0x2e85bb));this[_0x42c5('0xc8')](_0x41e4b7)['catch'](loggerCatch(_0x3e1fba));};Dialer['prototype'][_0x42c5('0x3c')]=function(_0x51ee32){var _0x3fdf8c=this[_0x42c5('0x2a')][_0x51ee32[_0x42c5('0xdb')]];var _0x3fca2e;if(!_[_0x42c5('0xb0')](_0x51ee32)&&!_[_0x42c5('0xb0')](_0x51ee32[_0x42c5('0xdc')])&&!_[_0x42c5('0xb0')](_0x51ee32['variable'][_0x42c5('0xdd')])&&_0x51ee32[_0x42c5('0xde')]===_0x42c5('0xdf')&&_0x3fdf8c){if(_0x3fdf8c['type']!==_0x42c5('0x7f')&&this['voiceQueues'][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0xe0')]&&_0x51ee32[_0x42c5('0xe1')]===_0x42c5('0xe2')){delete this[_0x42c5('0x2a')][_0x51ee32[_0x42c5('0xdb')]];this[_0x42c5('0xb4')](this[_0x42c5('0x22')][_0x3fdf8c[_0x42c5('0xb6')]]);this[_0x42c5('0x22')][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0x63')]+=0x1;this[_0x42c5('0x22')][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0x62')]+=0x1;_0x3fca2e=new Hangup(_0x3fdf8c,_0x51ee32);_0x3fca2e[_0x42c5('0xaa')]=0x12;_0x3fca2e[_0x42c5('0xab')]='HangupInAMD';_0x3fca2e['membername']=_0x42c5('0xe3');ami['emit'](_0x42c5('0xe4'),ut['buildObj'](_0x3fca2e,_0x42c5('0xe5')));this[_0x42c5('0xd0')](_0x3fca2e,'[syncHangupInAMD][createHistory]',_0x42c5('0xe6'));}if(_0x3fdf8c['type']!==_0x42c5('0x7f')&&this[_0x42c5('0x22')][_0x3fdf8c['queue']]['dialAMDActive']&&_0x51ee32[_0x42c5('0xe1')]===_0x42c5('0xe7')){var _0x414dd9=this;return new BPromise(function(_0x46bf1b,_0x32fd72){delete _0x414dd9[_0x42c5('0x2a')][_0x51ee32[_0x42c5('0xdb')]];_0x414dd9[_0x42c5('0xb4')](_0x414dd9['voiceQueues'][_0x3fdf8c['queue']]);_0x414dd9[_0x42c5('0x22')][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0x63')]+=0x1;_0x414dd9[_0x42c5('0x22')][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0x62')]+=0x1;var _0x53fe17=_0x414dd9[_0x42c5('0x22')][_0x3fdf8c[_0x42c5('0xb6')]];var _0x2d1a1b=new Hangup(_0x3fdf8c,_0x51ee32);_0x2d1a1b[_0x42c5('0xaa')]=0x13;_0x2d1a1b[_0x42c5('0xab')]=_0x42c5('0xe8');_0x2d1a1b[_0x42c5('0xe9')]=_0x42c5('0xe3');_0x2d1a1b['countmachineretry']+=0x1;_0x2d1a1b[_0x42c5('0xea')]+=0x1;_0x2d1a1b['amd']=!![];ami[_0x42c5('0x4e')]('custom:amd',ut[_0x42c5('0xeb')](_0x2d1a1b,_0x42c5('0xe5')));_0x414dd9['createHistory'](_0x2d1a1b)['catch'](loggerCatch(_0x42c5('0xec')));if(_0x2d1a1b[_0x42c5('0xed')]+_0x2d1a1b[_0x42c5('0xee')]+_0x2d1a1b[_0x42c5('0xef')]+_0x2d1a1b['countnosuchnumberretry']+_0x2d1a1b[_0x42c5('0xf0')]+_0x2d1a1b['countabandonedretry']+_0x2d1a1b['countmachineretry']+_0x2d1a1b[_0x42c5('0xf1')]>=_0x53fe17[_0x42c5('0xf2')]){_0x414dd9['stateGlobal'](_0x2d1a1b,_0x46bf1b,_0x32fd72,_0x42c5('0xf3'));}else{if(_0x2d1a1b[_0x42c5('0xf4')]>=_0x53fe17[_0x42c5('0xf5')]){_0x414dd9['createStateFinal'](_0x2d1a1b,_0x46bf1b,_0x32fd72,_0x42c5('0xf6'));}else{_0x414dd9[_0x42c5('0xbf')]({'active':![],'countmachineretry':_0x2d1a1b['countmachineretry'],'scheduledat':moment()[_0x42c5('0xf7')](_0x53fe17[_0x42c5('0xf8')],_0x42c5('0xf9'))[_0x42c5('0x7d')](_0x42c5('0xfa')),'ContactId':_0x2d1a1b['ContactId'],'ListId':_0x2d1a1b[_0x42c5('0xd3')],'VoiceQueueId':_0x2d1a1b[_0x42c5('0xfb')]||undefined,'CampaignId':_0x2d1a1b[_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0xfd')));_0x46bf1b({'reschedule':0x1});}}});}if(_0x3fdf8c[_0x42c5('0x4f')]==='ivr'&&this[_0x42c5('0x23')][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0xe0')]&&_0x51ee32[_0x42c5('0xe1')]==='HANGUP'){delete this[_0x42c5('0x2a')][_0x51ee32[_0x42c5('0xdb')]];this[_0x42c5('0xb4')](this[_0x42c5('0x23')][_0x3fdf8c['queue']]);_0x3fca2e=new Hangup(_0x3fdf8c,_0x51ee32);_0x3fca2e[_0x42c5('0xaa')]=0x12;_0x3fca2e[_0x42c5('0xab')]=_0x42c5('0xfe');_0x3fca2e[_0x42c5('0xe9')]='AMD';ami['emit'](_0x42c5('0xe4'),ut[_0x42c5('0xeb')](_0x3fca2e,_0x42c5('0xe5')));this['saveInDb'](_0x3fca2e,_0x42c5('0xff'),_0x42c5('0x100'));}if(_0x3fdf8c['type']===_0x42c5('0x7f')&&this[_0x42c5('0x23')][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0xe0')]&&_0x51ee32[_0x42c5('0xe1')]===_0x42c5('0xe7')){var _0x414dd9=this;return new BPromise(function(_0x1a4636,_0x65fe4c){delete _0x414dd9[_0x42c5('0x2a')][_0x51ee32[_0x42c5('0xdb')]];_0x414dd9[_0x42c5('0xb4')](_0x414dd9[_0x42c5('0x23')][_0x3fdf8c[_0x42c5('0xb6')]]);_0x414dd9[_0x42c5('0x23')][_0x3fdf8c['queue']]['outboundAnswerCallsDay']+=0x1;_0x414dd9['campaigns'][_0x3fdf8c[_0x42c5('0xb6')]][_0x42c5('0x62')]+=0x1;var _0x265734=_0x414dd9[_0x42c5('0x23')][_0x3fdf8c[_0x42c5('0xb6')]];var _0x2702e6=new Hangup(_0x3fdf8c,_0x51ee32);_0x2702e6[_0x42c5('0xaa')]=0x13;_0x2702e6[_0x42c5('0xab')]=_0x42c5('0xe8');_0x2702e6[_0x42c5('0xe9')]=_0x42c5('0xe3');_0x2702e6[_0x42c5('0xf4')]+=0x1;_0x2702e6[_0x42c5('0xea')]+=0x1;_0x2702e6[_0x42c5('0xe5')]=!![];ami[_0x42c5('0x4e')](_0x42c5('0xe4'),ut[_0x42c5('0xeb')](_0x2702e6,_0x42c5('0xe5')));_0x414dd9[_0x42c5('0xca')](_0x2702e6)['catch'](loggerCatch(_0x42c5('0xec')));if(_0x2702e6[_0x42c5('0xed')]+_0x2702e6['countcongestionretry']+_0x2702e6['countnoanswerretry']+_0x2702e6[_0x42c5('0x101')]+_0x2702e6[_0x42c5('0xf0')]+_0x2702e6[_0x42c5('0x102')]+_0x2702e6[_0x42c5('0xf4')]+_0x2702e6[_0x42c5('0xf1')]>=_0x265734[_0x42c5('0xf2')]){_0x414dd9[_0x42c5('0x103')](_0x2702e6,_0x1a4636,_0x65fe4c,_0x42c5('0xf3'));}else{if(_0x2702e6[_0x42c5('0xf4')]>=_0x265734[_0x42c5('0xf5')]){_0x414dd9['createStateFinal'](_0x2702e6,_0x1a4636,_0x65fe4c,_0x42c5('0xf6'));}else{_0x414dd9[_0x42c5('0xbf')]({'active':![],'countmachineretry':_0x2702e6[_0x42c5('0xf4')],'scheduledat':moment()['add'](_0x265734[_0x42c5('0xf8')],_0x42c5('0xf9'))[_0x42c5('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2702e6[_0x42c5('0xd2')],'ListId':_0x2702e6[_0x42c5('0xd3')],'VoiceQueueId':_0x2702e6[_0x42c5('0xfb')]||undefined,'CampaignId':_0x2702e6[_0x42c5('0xfc')]||undefined})['catch'](loggerCatch(_0x42c5('0xfd')));_0x1a4636({'reschedule':0x1});}}});}}};Dialer[_0x42c5('0x1e')][_0x42c5('0x104')]=function(_0x202037){var _0x3ea3ae=this[_0x42c5('0x2a')][_0x202037[_0x42c5('0xdb')]];var _0x13543e=this;var _0xefb5e4;if(_0x3ea3ae&&_0x3ea3ae[_0x42c5('0x4f')]==='ivr'){delete this['uniqueId'][_0x202037['uniqueid']];this[_0x42c5('0xb4')](this[_0x42c5('0x23')][_0x3ea3ae[_0x42c5('0xb6')]]);this[_0x42c5('0x23')][_0x3ea3ae[_0x42c5('0xb6')]][_0x42c5('0x105')]+=0x1;_0xefb5e4=new Hangup(_0x3ea3ae,_0x202037);this[_0x42c5('0xca')](_0xefb5e4)[_0x42c5('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x42c5('0xc8')](_0xefb5e4)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x106')));}if(_0x3ea3ae&&_0x3ea3ae[_0x42c5('0x4f')]!==_0x42c5('0x7f')&&isNotNull(this[_0x42c5('0x22')][_0x3ea3ae['queue']][_0x42c5('0x107')])){delete this['uniqueId'][_0x202037[_0x42c5('0xdb')]];this[_0x42c5('0xb4')](this[_0x42c5('0x22')][_0x3ea3ae[_0x42c5('0xb6')]]);this['voiceQueues'][_0x3ea3ae[_0x42c5('0xb6')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x3ea3ae[_0x42c5('0xb6')]][_0x42c5('0x62')]+=0x1;_0xefb5e4=new Hangup(_0x3ea3ae,_0x202037);_0xefb5e4[_0x42c5('0xaa')]=0x10;_0xefb5e4[_0x42c5('0xab')]=_0x42c5('0x108');_0xefb5e4[_0x42c5('0xe9')]='AGI';this['createHistory'](_0xefb5e4)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x109')));this['moveContactManagedDialer'](_0xefb5e4)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x106')));}if(_0x3ea3ae&&_0x3ea3ae[_0x42c5('0x4f')]!==_0x42c5('0x7f')&&!isNotNull(this['voiceQueues'][_0x3ea3ae[_0x42c5('0xb6')]]['dialQueueProject'])){delete this[_0x42c5('0x2a')][_0x202037['uniqueid']];this[_0x42c5('0xb4')](this[_0x42c5('0x22')][_0x3ea3ae['queue']]);this['voiceQueues'][_0x3ea3ae[_0x42c5('0xb6')]][_0x42c5('0x10a')]+=0x1;_0xefb5e4=new Hangup(_0x3ea3ae,_0x202037);_0xefb5e4[_0x42c5('0xaa')]=0xc;_0xefb5e4[_0x42c5('0xab')]=_0x202037['cause-txt'];_0xefb5e4[_0x42c5('0xe9')]=_0x42c5('0x10b');this[_0x42c5('0xca')](_0xefb5e4)[_0x42c5('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x42c5('0xc8')](_0xefb5e4)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x106')));}};Dialer['prototype'][_0x42c5('0x36')]=function(_0xffd851){var _0x5430f0=this[_0x42c5('0x2a')][_0xffd851[_0x42c5('0xdb')]];var _0x22c48f=this;if(this['voiceQueues'][_0xffd851[_0x42c5('0xb6')]]){if(_0x5430f0&&_0x5430f0[_0x42c5('0x4f')]!==_0x42c5('0x7f')){delete this[_0x42c5('0x2a')][_0xffd851[_0x42c5('0xdb')]];this['voiceQueues'][_0xffd851['queue']][_0x42c5('0x63')]+=0x1;var _0x4cb81e=new AgentComplete(_0x5430f0,_0xffd851);if(_0xffd851[_0x42c5('0x10c')]===_0x42c5('0x10d')){_0x4cb81e[_0x42c5('0x10e')]=this[_0x42c5('0x22')][_0xffd851[_0x42c5('0xb6')]][_0x42c5('0x10f')]&&this[_0x42c5('0x22')][_0xffd851[_0x42c5('0xb6')]][_0x42c5('0x110')]?moment()[_0x42c5('0x7d')](_0x42c5('0xfa')):undefined;}this[_0x42c5('0xca')](_0x4cb81e)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x111')));this[_0x42c5('0xc8')](_0x4cb81e)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x112')));}}};Dialer['prototype'][_0x42c5('0x30')]=function(_0x40ab04){if(this[_0x42c5('0x22')][_0x40ab04['queue']]){if(this[_0x42c5('0x2a')][_0x40ab04[_0x42c5('0xdb')]]&&this[_0x42c5('0x2a')][_0x40ab04[_0x42c5('0xdb')]]['type']!==_0x42c5('0x7f')){this[_0x42c5('0xb4')](this[_0x42c5('0x22')][_0x40ab04['queue']]);this['uniqueId'][_0x40ab04[_0x42c5('0xdb')]][_0x42c5('0x113')]=moment()['format'](_0x42c5('0xfa'));}}};Dialer[_0x42c5('0x1e')][_0x42c5('0x114')]=function(_0x520607){this[_0x42c5('0xca')](_0x520607)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x111')));this[_0x42c5('0xc8')](_0x520607)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x115')));};Dialer['prototype'][_0x42c5('0x32')]=function(_0xeb44be){var _0x21b396=this[_0x42c5('0x2a')][_0xeb44be[_0x42c5('0xdb')]];var _0x4e21a6=this;if(this['voiceQueues'][_0xeb44be['queue']]){if(_0x21b396&&_0x21b396[_0x42c5('0x4f')]!==_0x42c5('0x7f')){delete this[_0x42c5('0x2a')][_0xeb44be[_0x42c5('0xdb')]];this['updateOriginated'](this[_0x42c5('0x22')][_0xeb44be[_0x42c5('0xb6')]]);_0x21b396[_0x42c5('0x116')]=moment()[_0x42c5('0x7d')](_0x42c5('0xfa'));var _0x4007e2=new QueueCallerAbandon(_0x21b396,_0xeb44be);if(getSeconds(_0x21b396[_0x42c5('0x116')],_0x21b396[_0x42c5('0x117')])>=_0x21b396[_0x42c5('0x118')]){this['voiceQueues'][_0xeb44be[_0x42c5('0xb6')]][_0x42c5('0x71')]+=0x1;this['voiceQueues'][_0xeb44be[_0x42c5('0xb6')]][_0x42c5('0x69')]+=0x1;this[_0x42c5('0x22')][_0xeb44be[_0x42c5('0xb6')]][_0x42c5('0x73')]+=0x1;_0x4007e2[_0x42c5('0xaa')]=0xa;_0x4007e2[_0x42c5('0xab')]='Drop';_0x4007e2[_0x42c5('0x119')]=_0x42c5('0x11a');_0x4007e2[_0x42c5('0x10e')]=this['voiceQueues'][_0xeb44be[_0x42c5('0xb6')]][_0x42c5('0x10f')]?moment()[_0x42c5('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4007e2['countdropretry']+=0x1;_0x4007e2[_0x42c5('0xea')]+=0x1;if(_0x4007e2['countdropretry']>=this[_0x42c5('0x22')][_0xeb44be[_0x42c5('0xb6')]][_0x42c5('0x11b')]){this[_0x42c5('0x114')](_0x4007e2);}else{this[_0x42c5('0xbf')]({'active':![],'countdropretry':_0x4007e2[_0x42c5('0xf0')],'scheduledat':moment()['add'](this[_0x42c5('0x22')][_0xeb44be['queue']][_0x42c5('0x11c')],_0x42c5('0xf9'))[_0x42c5('0x7d')](_0x42c5('0xfa')),'ContactId':_0x21b396['ContactId'],'ListId':_0x21b396['ListId'],'VoiceQueueId':_0x21b396[_0x42c5('0xfb')]||undefined,'CampaignId':_0x21b396['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3293bf=new History(_0x4007e2);_0x3293bf[_0x42c5('0xaa')]=0xa;_0x3293bf[_0x42c5('0xab')]='Drop';_0x3293bf[_0x42c5('0x11d')]=moment()[_0x42c5('0x7d')](_0x42c5('0xfa'));_0x3293bf[_0x42c5('0x11e')]=_0x3293bf['starttime'];_0x3293bf['calleridname']=_0x4007e2['calleridname'];_0x3293bf[_0x42c5('0x11f')]=_0x4007e2[_0x42c5('0x11f')];this[_0x42c5('0xca')](_0x3293bf)['catch'](loggerCatch(_0x42c5('0x120')));}}else{this[_0x42c5('0x22')][_0xeb44be[_0x42c5('0xb6')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x42c5('0x22')][_0xeb44be[_0x42c5('0xb6')]][_0x42c5('0x68')]+=0x1;_0x4007e2[_0x42c5('0xaa')]=0xb;_0x4007e2['statedesc']='Abandoned';_0x4007e2[_0x42c5('0x119')]=_0x42c5('0x121');_0x4007e2[_0x42c5('0x102')]+=0x1;_0x4007e2[_0x42c5('0xea')]+=0x1;if(_0x4007e2[_0x42c5('0x102')]>=this['voiceQueues'][_0xeb44be['queue']]['dialAbandonedMaxRetry']){this[_0x42c5('0x114')](_0x4007e2);}else{this[_0x42c5('0xbf')]({'active':![],'countabandonedretry':_0x4007e2['countabandonedretry'],'scheduledat':moment()[_0x42c5('0xf7')](this[_0x42c5('0x22')][_0xeb44be['queue']][_0x42c5('0x122')],_0x42c5('0xf9'))['format'](_0x42c5('0xfa')),'ContactId':_0x21b396[_0x42c5('0xd2')],'ListId':_0x21b396[_0x42c5('0xd3')],'VoiceQueueId':_0x21b396[_0x42c5('0xfb')]||undefined,'CampaignId':_0x21b396[_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x123')));var _0x3293bf=new History(_0x4007e2);_0x3293bf[_0x42c5('0xaa')]=0xb;_0x3293bf[_0x42c5('0xab')]='Abandoned';_0x3293bf['starttime']=moment()[_0x42c5('0x7d')](_0x42c5('0xfa'));_0x3293bf[_0x42c5('0x11e')]=_0x3293bf[_0x42c5('0x11d')];_0x3293bf[_0x42c5('0x124')]=_0x4007e2[_0x42c5('0x124')];_0x3293bf[_0x42c5('0x11f')]=_0x4007e2['calleridnum'];this['createHistory'](_0x3293bf)['catch'](loggerCatch(_0x42c5('0x125')));}}}}};Dialer[_0x42c5('0x1e')]['syncNewExten']=function(_0x450440){if(this[_0x42c5('0x28')][_0x450440['uniqueid']]){this['actions'][_0x450440[_0x42c5('0xdb')]][_0x42c5('0x126')]=_0x450440[_0x42c5('0x126')];}if(this[_0x42c5('0x2a')][_0x450440[_0x42c5('0xdb')]]){this[_0x42c5('0x2a')][_0x450440['uniqueid']][_0x42c5('0x126')]=_0x450440[_0x42c5('0x126')];}};Dialer[_0x42c5('0x1e')]['syncQueueMember']=function(_0x2a3e0b){if(strategy[this[_0x42c5('0x22')][this[_0x42c5('0x28')][_0x2a3e0b['actionid']]['queue']][_0x42c5('0x51')]]===_0x42c5('0x1d')){if(this[_0x42c5('0x28')][_0x2a3e0b['actionid']]&&_[_0x42c5('0xb0')](this['actions'][_0x2a3e0b[_0x42c5('0x127')]][_0x42c5('0x128')])&&_0x2a3e0b['status']==='1'&&_0x2a3e0b[_0x42c5('0x129')]==='0'){if(this[_0x42c5('0x24')][_0x2a3e0b['stateinterface']]){if(!this['agents'][_0x2a3e0b[_0x42c5('0x12a')]]['locked']){this['agents'][_0x2a3e0b['stateinterface']][_0x42c5('0x128')]=!![];this[_0x42c5('0x28')][_0x2a3e0b[_0x42c5('0x127')]]['locked']=!![];this[_0x42c5('0x28')][_0x2a3e0b[_0x42c5('0x127')]][_0x42c5('0x12a')]=_0x2a3e0b['stateinterface'];}}}}else if((strategy[this[_0x42c5('0x22')][this[_0x42c5('0x28')][_0x2a3e0b[_0x42c5('0x127')]]['queue']][_0x42c5('0x51')]]||_0x42c5('0x1c'))===_0x42c5('0x1c')){if(this[_0x42c5('0x28')][_0x2a3e0b['actionid']]){if(this[_0x42c5('0x24')][_0x2a3e0b[_0x42c5('0x12a')]]){this[_0x42c5('0x28')][_0x2a3e0b[_0x42c5('0x127')]]['stateinterface']=_0x2a3e0b[_0x42c5('0x12a')];if(_['isNil'](this['queueBooked'][this[_0x42c5('0x28')][_0x2a3e0b[_0x42c5('0x127')]]['queue']])){this[_0x42c5('0x2e')][this[_0x42c5('0x28')][_0x2a3e0b[_0x42c5('0x127')]]['queue']]=[];}this['queueBooked'][this[_0x42c5('0x28')][_0x2a3e0b[_0x42c5('0x127')]][_0x42c5('0xb6')]][_0x42c5('0x12b')](_[_0x42c5('0x92')](_[_0x42c5('0xd1')](this['actions'][_0x2a3e0b[_0x42c5('0x127')]],['idHopper',_0x42c5('0x12a')]),{'status':_0x2a3e0b[_0x42c5('0xb2')],'paused':_0x2a3e0b[_0x42c5('0x129')]}));}}}};function unlockQueueStatus(_0x1a716b,_0x15d2ac){setTimeout(function(){if(_[_0x42c5('0x40')](_0x1a716b[_0x42c5('0x12c')])){loggerBooked[_0x42c5('0x99')](_0x42c5('0x12d'),_0x15d2ac);}_0x1a716b[_0x42c5('0x12c')]=!![];loggerBooked[_0x42c5('0x82')](_0x42c5('0x12e'),_0x15d2ac,JSON[_0x42c5('0x4d')](_[_0x42c5('0xd1')](_0x1a716b,[_0x42c5('0x44'),_0x42c5('0x12c')])));},0x1f3);}Dialer['prototype'][_0x42c5('0x3f')]=function(_0x294f75){var _0x3f0b0c=this;var _0x36d9be=_0x3f0b0c['voiceQueues'][_0x3f0b0c[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]];if(strategy[this[_0x42c5('0x22')][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]]['queue']][_0x42c5('0x51')]]===_0x42c5('0x1d')){if(this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]]&&this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0x12a')]){this[_0x42c5('0x12f')][_0x42c5('0x130')](this[_0x42c5('0x28')][_0x294f75['actionid']][_0x42c5('0x131')],this['actions'][_0x294f75['actionid']][_0x42c5('0x12a')])[_0x42c5('0xb3')](function(_0x3c7933){logger[_0x42c5('0x99')](_0x42c5('0x132'),util['inspect'](_0x3c7933,{'showHidden':![],'depth':null}));})[_0x42c5('0x20')](function(){_0x3f0b0c[_0x42c5('0xb4')](_0x3f0b0c[_0x42c5('0x22')][_0x3f0b0c['actions'][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]]);_0x3f0b0c[_0x42c5('0x24')][_0x3f0b0c['actions'][_0x294f75[_0x42c5('0x127')]][_0x42c5('0x12a')]][_0x42c5('0x128')]=![];delete _0x3f0b0c[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]];unlockQueueStatus(_0x36d9be);});}else{this[_0x42c5('0xb4')](this[_0x42c5('0x22')][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]]);this[_0x42c5('0xbf')]({'active':![],'ContactId':this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xd2')],'ListId':this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xd3')],'VoiceQueueId':this['actions'][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xfb')]||undefined,'CampaignId':this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x42c5('0x133')));delete this['actions'][_0x294f75[_0x42c5('0x127')]];unlockQueueStatus(_0x36d9be);}}else if((strategy[this[_0x42c5('0x22')][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]][_0x42c5('0x51')]]||_0x42c5('0x1c'))===_0x42c5('0x1c')){var _0x200983;if(this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]]&&!_[_0x42c5('0x4a')](this['queueBooked'][this['actions'][_0x294f75['actionid']][_0x42c5('0xb6')]])){if(this[_0x42c5('0x134')][_0x3f0b0c[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]]){this[_0x42c5('0x134')][_0x3f0b0c['actions'][_0x294f75['actionid']]['queue']]=this['queueBookedRR'][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]]?this['queueBookedRR'][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]]:this['queueBooked'][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]]['queue']]?this[_0x42c5('0x2e')][this[_0x42c5('0x28')][_0x294f75['actionid']][_0x42c5('0xb6')]][_0x42c5('0x135')]||0x0:0x0;}this['queueBooked'][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]][_0x42c5('0x135')]=this['queueBookedRR'][this[_0x42c5('0x28')][_0x294f75[_0x42c5('0x127')]][_0x42c5('0xb6')]];for(var _0xc67bd5=0x0;_0xc67bd5=0x0;})[_0x42c5('0xb3')](myreject(_0x32dc6b)));}}else{_0x564a56[_0x42c5('0x12b')](ami[_0x42c5('0xb1')]({'action':_0x42c5('0x14b'),'command':util[_0x42c5('0x7d')](_0x42c5('0x14c'),_0xe09dcc,!_['isUndefined'](config[_0x42c5('0x14e')][_0x1d695c])?_0x1d695c:'')})['then'](function(_0x56bc48){return _0x56bc48['content']['indexOf'](_0x42c5('0x150'))>=0x0;})[_0x42c5('0xb3')](myreject(_0x32dc6b)));}BPromise[_0x42c5('0x151')](_0x564a56)[_0x42c5('0xba')](function(_0x56b389){var _0x414672=_[_0x42c5('0x152')](_0x56b389);if(_0x414672){return _0x3a3e57(_0x414672);}else{_0x15b8df['message']=_0x52442c?_0x42c5('0x153'):_0x42c5('0x154');return _0x32dc6b(msgResponse('[ifTime][promiseAll]','Failure',_0x42c5('0x155')+_0x52442c+'\x20'+_0x66af6+'\x20Interval\x20is\x20overtime:\x20'+util[_0x42c5('0x9a')](_0xe09dcc,{'showHidden':![],'depth':null})+_0x42c5('0x156')+_0x1d695c));}})['catch'](function(_0x14d5c9){return _0x32dc6b(msgResponse(_0x42c5('0x144'),'Failure',JSON[_0x42c5('0x4d')](_0x14d5c9)));});});};Dialer[_0x42c5('0x1e')][_0x42c5('0x157')]=function(_0x15de08){var _0x44bebd=this;return function(){switch(_0x15de08[_0x42c5('0x5d')]){case _0x42c5('0x158'):freeVariablesPredictive(_0x15de08);_0x44bebd[_0x42c5('0x159')](_0x15de08,0x1);break;case _0x42c5('0x15a'):freeVariablesPredictive(_0x15de08);_0x44bebd[_0x42c5('0x159')](_0x15de08,_0x15de08[_0x42c5('0x15b')]);break;case _0x42c5('0x9'):_0x44bebd['predictive'](_0x15de08);break;case _0x42c5('0x15c'):freeVariablesPredictive(_0x15de08);_0x44bebd[_0x42c5('0x159')](_0x15de08,0x1);break;default:freeVariablesPredictive(_0x15de08);logger[_0x42c5('0x99')](_0x42c5('0x15d'),_0x15de08[_0x42c5('0x44')],_0x42c5('0x15e'));}};};Dialer[_0x42c5('0x1e')][_0x42c5('0x15f')]=function(_0x35b0a0){var _0x311f37=this;return function(){_0x311f37[_0x42c5('0x160')](_0x35b0a0);};};Dialer['prototype']['syncQueueSummary']=function(_0x58d46b){var _0x59ca96=this;if(isNotPreview(_0x58d46b[_0x42c5('0x5d')])){if(isVoiceQueueOutbound(_0x58d46b[_0x42c5('0x4f')])&&isActive(_0x58d46b[_0x42c5('0x5c')])){_0x58d46b[_0x42c5('0xa4')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x58d46b,_0x58d46b[_0x42c5('0x53')]))[_0x42c5('0xba')](checkIsActive(_0x58d46b,_0x58d46b[_0x42c5('0x5c')]))[_0x42c5('0xba')](checkInterval(_0x58d46b))[_0x42c5('0xba')](_0x59ca96[_0x42c5('0x140')](_0x58d46b))[_0x42c5('0xba')](_0x59ca96[_0x42c5('0x143')](_0x58d46b['dialGlobalInterval'],_0x58d46b[_0x42c5('0x161')],_0x58d46b['name'],_0x58d46b))[_0x42c5('0xba')](_0x59ca96[_0x42c5('0x145')](_0x58d46b[_0x42c5('0x48')],_0x58d46b[_0x42c5('0x161')],_0x58d46b[_0x42c5('0x44')],_0x58d46b))['then'](_0x59ca96[_0x42c5('0x157')](_0x58d46b))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x58d46b));}else{notSendMessagesQueue(_0x58d46b);}}else{freeVariablesPredictive(_0x58d46b);}};Dialer[_0x42c5('0x1e')]['syncCampaigns']=function(){var _0x3c5d98=this;var _0x3a6b1e;for(var _0x5583f9 in this['campaigns']){if(typeof this['campaigns'][_0x5583f9]!==_0x42c5('0x9d')){_0x3a6b1e=this[_0x42c5('0x23')][_0x5583f9];if(isCampaignIvr(_0x3a6b1e[_0x42c5('0x4f')])&&isActive(_0x3a6b1e[_0x42c5('0x7c')])){_0x3a6b1e[_0x42c5('0xa4')]=!![];BPromise['resolve']()[_0x42c5('0xba')](checkIsActive(_0x3a6b1e,_0x3a6b1e[_0x42c5('0x7c')]))[_0x42c5('0xba')](checkInterval(_0x3a6b1e))['then'](_0x3c5d98[_0x42c5('0x140')](_0x3a6b1e))['then'](_0x3c5d98[_0x42c5('0x143')](_0x3a6b1e[_0x42c5('0x162')],_0x3a6b1e['dialTimezone'],_0x3a6b1e[_0x42c5('0x44')],_0x3a6b1e))['then'](_0x3c5d98[_0x42c5('0x145')](_0x3a6b1e[_0x42c5('0x48')],_0x3a6b1e[_0x42c5('0x161')],_0x3a6b1e['name'],_0x3a6b1e))[_0x42c5('0xba')](_0x3c5d98['launchHandleIvr'](_0x3a6b1e))[_0x42c5('0xb3')](loggerCatchQueueSummary('[syncCampaigns]',_0x3a6b1e));}else{notSendMessagesCampaign(_0x3a6b1e);}}}};function getCallerIdRandom(_0x228542,_0x55a1b1){var _0x291170;var _0x5b2899;var _0x587e10;if(_0x55a1b1<=0x0){_0x55a1b1=0x1;}_0x291170=new RegExp(_0x42c5('0x163')+_0x55a1b1+'}$');_0x5b2899=Math[_0x42c5('0x164')](0xa,_0x55a1b1-0x1);_0x587e10=Math[_0x42c5('0x164')](0xa,_0x55a1b1)-0x1;return util[_0x42c5('0x7d')]('%s',_[_0x42c5('0x165')](_0x228542,_0x291170,_[_0x42c5('0x166')](_0x5b2899,_0x587e10)));}function extractCalleridName(_0x2561cf){var _0x32ef75=_0x2561cf[_0x42c5('0x167')](/"(.*?)"/);return _0x32ef75?_0x32ef75[0x1]:_0x2561cf;}function extractCalleridNumber(_0x1cb4bd){var _0x37f355=_0x1cb4bd[_0x42c5('0x167')](/<(.*?)>/);return _0x37f355?_0x37f355[0x1]:_0x1cb4bd;}Dialer[_0x42c5('0x1e')]['actionOriginate']=function(_0x5240f8,_0x4e6ec2){var _0xbc019c=this;var _0x169e54=uuid['v4']();this[_0x42c5('0x28')][_0x169e54]=new Action(_0x5240f8,_0x4e6ec2,_0x169e54);return new BPromise(function(_0x42507e,_0x14dc1a){if(_['isUndefined'](_0x5240f8)&&typeof _0x5240f8!==_0x42c5('0x168')){return _0x14dc1a(msgResponse(_0x42c5('0x169'),_0x42c5('0x147'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x4e6ec2[_0x42c5('0x16a')][_0x42c5('0x16b')])||_0x4e6ec2[_0x42c5('0x16a')][_0x42c5('0x16b')]===null){return _0x14dc1a(msgResponse(_0x42c5('0x169'),_0x42c5('0x147'),_0x42c5('0x16c')));}var _0x4c6264={'XMD-CALLERID':_0xbc019c[_0x42c5('0x28')][_0x169e54][_0x42c5('0x16d')](),'XMD-AGI':_0x5240f8[_0x42c5('0x107')]?util[_0x42c5('0x7d')](_0x42c5('0x16e'),ipAgi,_0x5240f8[_0x42c5('0x107')]):_0x42c5('0x16f'),'XMD-AGIAFTER':_0x5240f8[_0x42c5('0x10f')]?util[_0x42c5('0x7d')](_0x42c5('0x16e'),ipAgi,_0x5240f8[_0x42c5('0x10f')]):_0x42c5('0x16f'),'XMD-QUEUE':_0x5240f8[_0x42c5('0x4f')]===_0x42c5('0x50')?util['format']('\x22%s,%s%s,,,%s\x22',_0x5240f8['name'],_0x5240f8['dialQueueOptions']||'',_0x5240f8['dialAgiAfterHangupAgent']?'c':'',_0x5240f8[_0x42c5('0x118')]||0x3):_0x42c5('0x16f'),'XMD-CONTACTID':_0x4e6ec2[_0x42c5('0xd2')],'XMD-CDRTYPE':_0x42c5('0x170'),'CALLERID(all)':_0xbc019c[_0x42c5('0x28')][_0x169e54][_0x42c5('0x16d')](),'XMD-AMD':_0x5240f8[_0x42c5('0xe0')]?_0x42c5('0x171'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5240f8[_0x42c5('0xe0')]){_0x4c6264[_0x42c5('0x172')]=_0x5240f8[_0x42c5('0x173')]||0x9c4;_0x4c6264['XMD-AMDGREETING']=_0x5240f8[_0x42c5('0x174')]||0x5dc;_0x4c6264[_0x42c5('0x175')]=_0x5240f8['dialAMDAfterGreetingSilence']||0x320;_0x4c6264[_0x42c5('0x176')]=_0x5240f8['dialAMDTotalAnalysisTime']||0x1388;_0x4c6264[_0x42c5('0x177')]=_0x5240f8['dialAMDMinWordLength']||0x64;_0x4c6264['XMD-AMDBETWEENWORDSSILENCE']=_0x5240f8[_0x42c5('0x178')]||0x32;_0x4c6264[_0x42c5('0x179')]=_0x5240f8['dialAMDMaximumNumberOfWords']||0x3;_0x4c6264['XMD-AMDSILENCETHRESHOLD']=_0x5240f8[_0x42c5('0x17a')]||0x100;_0x4c6264[_0x42c5('0x17b')]=_0x5240f8['dialAMDMaximumWordLength']||0x1388;}if(_0x5240f8[_0x42c5('0x4f')]==='outbound'){_0x4c6264['XMD-VOICEQUEUEID']=_0x4e6ec2[_0x42c5('0xfb')];}else{_0x4c6264[_0x42c5('0x17c')]=_0x4e6ec2['CampaignId'];}for(var _0x397b49 in _0x4e6ec2[_0x42c5('0x16a')]){if(typeof _0x4e6ec2['Contact'][_0x397b49]!==_0x42c5('0x9d')){if(isNotNull(_0x4e6ec2[_0x42c5('0x16a')][_0x397b49])&&_0x397b49!=='id'&&_0x397b49!=='tags'&&_0x397b49!=='createdAt'&&_0x397b49!==_0x42c5('0x17d')){_0x4c6264[util['format']('%s%s',_0x42c5('0x17e'),_[_0x42c5('0x17f')](_0x397b49))]=_0x4e6ec2[_0x42c5('0x16a')][_0x397b49];}}}var _0x3fc992=_0xbc019c[_0x42c5('0xd7')](_0x5240f8[_0x42c5('0x7b')])?getCallerId(_0x5240f8[_0x42c5('0x7b')][_0x42c5('0x180')],_0x5240f8[_0x42c5('0x5e')],_0x5240f8[_0x42c5('0x181')]>0x0?getCallerIdRandom(_0x5240f8[_0x42c5('0x5f')],_0x5240f8['dialRandomLastDigitCallerIdNumber']):_0x5240f8['dialOriginateCallerIdNumber']):getCallerId(_[_0x42c5('0xb0')](_0x5240f8['TrunkBackup'])?_0x5240f8[_0x42c5('0x7b')][_0x42c5('0x180')]:_0x5240f8['TrunkBackup']['callerid'],_0x5240f8[_0x42c5('0x5e')],_0x5240f8[_0x42c5('0x181')]>0x0?getCallerIdRandom(_0x5240f8[_0x42c5('0x5f')],_0x5240f8['dialRandomLastDigitCallerIdNumber']):_0x5240f8[_0x42c5('0x5f')]);if(_0x3fc992){_0x4c6264[_0x42c5('0x182')]=_0xbc019c[_0x42c5('0x28')][_0x169e54][_0x42c5('0x183')]=extractCalleridName(_0x3fc992);_0x4c6264[_0x42c5('0x184')]=_0xbc019c['actions'][_0x169e54]['originatecalleridnum']=extractCalleridNumber(_0x3fc992);}return ami[_0x42c5('0xb1')]({'actionid':_0x169e54,'action':'originate','channel':_0xbc019c[_0x42c5('0xd7')](_0x5240f8['Trunk'])?util[_0x42c5('0x7d')](_0x42c5('0x185'),_0x5240f8[_0x42c5('0x7b')]['name'],isNotNull(_0x5240f8['dialPrefix'])?_0x5240f8[_0x42c5('0x61')][_0x42c5('0x186')]()||'':'',_0x5240f8[_0x42c5('0x187')]>0x0?_0x4e6ec2[_0x42c5('0x16a')][_0x42c5('0x16b')][_0x42c5('0x188')](_0x5240f8[_0x42c5('0x187')]):_0x4e6ec2[_0x42c5('0x16a')][_0x42c5('0x16b')]):util[_0x42c5('0x7d')](_0x42c5('0x185'),_['isNil'](_0x5240f8[_0x42c5('0x141')])?_0x5240f8['Trunk'][_0x42c5('0x44')]:_0x5240f8[_0x42c5('0x141')][_0x42c5('0x44')],isNotNull(_0x5240f8[_0x42c5('0x61')])?_0x5240f8[_0x42c5('0x61')]['trim']()||'':'',_0x5240f8[_0x42c5('0x187')]>0x0?_0x4e6ec2[_0x42c5('0x16a')][_0x42c5('0x16b')][_0x42c5('0x188')](_0x5240f8[_0x42c5('0x187')]):_0x4e6ec2[_0x42c5('0x16a')][_0x42c5('0x16b')]),'callerid':_0x3fc992,'Exten':'xcally-motion-dialer','Context':_0x42c5('0x189'),'Priority':'1','variable':_0x4c6264,'timeout':(_0x5240f8[_0x42c5('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x169e54})[_0x42c5('0xba')](function(_0x3f23a3){return _0x42507e(_0x3f23a3);})[_0x42c5('0xb3')](function(_0x427ad9){_0x5240f8['outboundOriginateFailureCallsDay']+=0x1;var _0x28250f=new History(_0xbc019c[_0x42c5('0x28')][_0x169e54]);logger[_0x42c5('0x99')](util[_0x42c5('0x7d')](_0x42c5('0x18a'),JSON[_0x42c5('0x4d')](_0x427ad9)));_0x28250f['state']=0xe;_0x28250f[_0x42c5('0xab')]=_0x42c5('0x18b');_0x28250f[_0x42c5('0x11d')]=moment()[_0x42c5('0x7d')](_0x42c5('0xfa'));_0x28250f['endtime']=_0x28250f['starttime'];_0xbc019c['createHistory'](_0x28250f)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x18c')));_0xbc019c[_0x42c5('0xc8')](_0x28250f)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x18c')))[_0x42c5('0x20')](function(){delete _0xbc019c[_0x42c5('0x28')][_0x169e54];return _0x14dc1a(msgResponse(_0x42c5('0x169'),'Error',_0x42c5('0x18d')));});});});};Dialer['prototype'][_0x42c5('0x35')]=function(_0x3e2f04){var _0x1b86a9=this['actions'][_0x3e2f04['actionid']];if(_0x1b86a9){delete this[_0x42c5('0x28')][_0x3e2f04[_0x42c5('0x127')]];_0x1b86a9[_0x42c5('0x117')]=moment()[_0x42c5('0x7d')](_0x42c5('0xfa'));var _0x318708=_0x1b86a9['type']==='ivr'?this['campaigns'][_0x1b86a9[_0x42c5('0xb6')]]:this[_0x42c5('0x22')][_0x1b86a9[_0x42c5('0x18e')]()];if(!this[_0x42c5('0xd6')](_0x3e2f04[_0x42c5('0x18f')])){this[_0x42c5('0xb4')](_0x318708);return this[_0x42c5('0x190')](_0x1b86a9,_0x318708,_0x3e2f04)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x191')));}this['uniqueId'][_0x3e2f04[_0x42c5('0xdb')]]=_0x1b86a9;}};Dialer[_0x42c5('0x1e')][_0x42c5('0x192')]=function(_0x54e010,_0x3896b7,_0x511e3f){var _0x5b795b=new History(_0x3896b7);if(_0x5b795b[_0x42c5('0xed')]+_0x5b795b[_0x42c5('0xee')]+_0x5b795b[_0x42c5('0xef')]+_0x5b795b['countnosuchnumberretry']+_0x5b795b[_0x42c5('0xf0')]+_0x5b795b['countabandonedretry']+_0x5b795b[_0x42c5('0xf4')]+_0x5b795b[_0x42c5('0xf1')]>=_0x511e3f['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x54e010){case 0x3:if(_0x5b795b[_0x42c5('0xef')]>=_0x511e3f['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x42c5('0xbf')]({'active':![],'countnoanswerretry':_0x5b795b['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x42c5('0xf7')](_0x511e3f[_0x42c5('0x193')],'minutes')[_0x42c5('0x7d')](_0x42c5('0xfa')),'ContactId':_0x5b795b[_0x42c5('0xd2')],'ListId':_0x5b795b[_0x42c5('0xd3')],'VoiceQueueId':_0x5b795b['VoiceQueueId']||undefined,'CampaignId':_0x5b795b[_0x42c5('0xfc')]||undefined})['catch'](loggerCatch(_0x42c5('0x194')));break;case 0x5:if(_0x5b795b[_0x42c5('0xed')]>=_0x511e3f[_0x42c5('0x195')]-0x1){return!![];}this[_0x42c5('0xbf')]({'active':![],'countbusyretry':_0x5b795b['countbusyretry']+=0x1,'scheduledat':moment()[_0x42c5('0xf7')](_0x511e3f[_0x42c5('0x196')],_0x42c5('0xf9'))[_0x42c5('0x7d')](_0x42c5('0xfa')),'ContactId':_0x5b795b[_0x42c5('0xd2')],'ListId':_0x5b795b['ListId'],'VoiceQueueId':_0x5b795b[_0x42c5('0xfb')]||undefined,'CampaignId':_0x5b795b['CampaignId']||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x197')));break;case 0x8:if(_0x5b795b[_0x42c5('0xee')]>=_0x511e3f[_0x42c5('0x198')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x5b795b[_0x42c5('0xee')]+=0x1,'scheduledat':moment()[_0x42c5('0xf7')](_0x511e3f[_0x42c5('0x199')],_0x42c5('0xf9'))[_0x42c5('0x7d')](_0x42c5('0xfa')),'ContactId':_0x5b795b['ContactId'],'ListId':_0x5b795b[_0x42c5('0xd3')],'VoiceQueueId':_0x5b795b[_0x42c5('0xfb')]||undefined,'CampaignId':_0x5b795b[_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5b795b['countnosuchnumberretry']>=_0x511e3f[_0x42c5('0x19a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x5b795b['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x42c5('0xf7')](_0x511e3f[_0x42c5('0x19b')],_0x42c5('0xf9'))['format'](_0x42c5('0xfa')),'ContactId':_0x5b795b[_0x42c5('0xd2')],'ListId':_0x5b795b[_0x42c5('0xd3')],'VoiceQueueId':_0x5b795b[_0x42c5('0xfb')]||undefined,'CampaignId':_0x5b795b[_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x19c')));}break;case 0xa:if(_0x5b795b[_0x42c5('0xf0')]>=_0x511e3f[_0x42c5('0x11b')]-0x1){return!![];}this[_0x42c5('0xbf')]({'active':![],'countdropretry':_0x5b795b[_0x42c5('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x511e3f['dialDropRetryFrequency'],_0x42c5('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b795b['ContactId'],'ListId':_0x5b795b[_0x42c5('0xd3')],'VoiceQueueId':_0x5b795b[_0x42c5('0xfb')]||undefined,'CampaignId':_0x5b795b[_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x19d')));break;case 0xb:if(_0x5b795b['countabandonedretry']>=_0x511e3f['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x42c5('0xbf')]({'active':![],'countabandonedretry':_0x5b795b['countabandonedretry']+=0x1,'scheduledat':moment()[_0x42c5('0xf7')](_0x511e3f[_0x42c5('0x122')],'minutes')['format'](_0x42c5('0xfa')),'ContactId':_0x5b795b['ContactId'],'ListId':_0x5b795b[_0x42c5('0xd3')],'VoiceQueueId':_0x5b795b['VoiceQueueId']||undefined,'CampaignId':_0x5b795b['CampaignId']||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x123')));break;case 0x13:if(_0x5b795b[_0x42c5('0xf4')]>=_0x511e3f[_0x42c5('0xf5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x5b795b['countmachineretry']+=0x1,'scheduledat':moment()[_0x42c5('0xf7')](_0x511e3f[_0x42c5('0xf8')],'minutes')[_0x42c5('0x7d')](_0x42c5('0xfa')),'ContactId':_0x5b795b['ContactId'],'ListId':_0x5b795b[_0x42c5('0xd3')],'VoiceQueueId':_0x5b795b['VoiceQueueId']||undefined,'CampaignId':_0x5b795b[_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x5b795b['countagentrejectretry']>=_0x511e3f[_0x42c5('0x19e')]-0x1){return!![];}this[_0x42c5('0xbf')]({'active':![],'countagentrejectretry':_0x5b795b[_0x42c5('0xf1')]+=0x1,'scheduledat':moment()[_0x42c5('0xf7')](_0x511e3f[_0x42c5('0x19f')],_0x42c5('0xf9'))[_0x42c5('0x7d')](_0x42c5('0xfa')),'ContactId':_0x5b795b[_0x42c5('0xd2')],'ListId':_0x5b795b[_0x42c5('0xd3')],'VoiceQueueId':_0x5b795b[_0x42c5('0xfb')]||undefined,'CampaignId':_0x5b795b['CampaignId']||undefined})['catch'](loggerCatch(_0x42c5('0x1a0')));break;default:return!![];}};Dialer['prototype'][_0x42c5('0x190')]=function(_0x32eae0,_0x46ec41,_0x32e8be){var _0x1512a3=this;var _0x59c316=new History(_0x32eae0);return new BPromise(function(_0x408575,_0x53e78b){if(_[_0x42c5('0x40')](_0x46ec41)&&typeof _0x46ec41!==_0x42c5('0x168')){return _0x53e78b(msgResponse(_0x42c5('0x1a1'),_0x42c5('0x147'),_0x42c5('0x1a2')));}if(_['isUndefined'](_0x32e8be)&&typeof _0x32e8be!==_0x42c5('0x168')){return _0x53e78b(msgResponse('[callProgressDetecting]',_0x42c5('0x147'),'evt\x20is\x20undefine'));}switch(_0x32e8be[_0x42c5('0x10c')]){case'0':_0x46ec41['outboundNoSuchCallsDay']+=0x1;_0x59c316[_0x42c5('0xaa')]=0x0;_0x59c316[_0x42c5('0xab')]='NoSuchNumber';_0x59c316[_0x42c5('0x101')]+=0x1;_0x59c316[_0x42c5('0xea')]+=0x1;ami[_0x42c5('0x4e')]('custom:agentnosuchnumber',ut[_0x42c5('0xeb')](_0x32eae0,_0x42c5('0x1a3')));_0x1512a3[_0x42c5('0xca')](_0x59c316)[_0x42c5('0xb3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1512a3[_0x42c5('0x192')](0x0,_0x32eae0,_0x46ec41)){if(_0x59c316['countnosuchnumberretry']>=_0x46ec41['dialNoSuchNumberMaxRetry']){_0x1512a3[_0x42c5('0x1a4')](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1a5'));}else{_0x1512a3['stateGlobal'](_0x59c316,_0x408575,_0x53e78b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x46ec41[_0x42c5('0x6a')]+=0x1;_0x59c316[_0x42c5('0xaa')]=0x3;_0x59c316[_0x42c5('0xab')]=_0x42c5('0x1a6');_0x59c316['countnoanswerretry']+=0x1;_0x59c316[_0x42c5('0xea')]+=0x1;ami[_0x42c5('0x4e')]('custom:agentnoanswer',ut[_0x42c5('0xeb')](_0x32eae0,_0x42c5('0x1a7')));_0x1512a3['createHistory'](_0x59c316)['catch'](loggerCatch(_0x42c5('0x1a8')));if(_0x1512a3[_0x42c5('0x192')](0x3,_0x32eae0,_0x46ec41)){if(_0x59c316['countnoanswerretry']>=_0x46ec41[_0x42c5('0x1a9')]){_0x1512a3[_0x42c5('0x1a4')](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1aa'));}else{_0x1512a3[_0x42c5('0x103')](_0x59c316,_0x408575,_0x53e78b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x46ec41['outboundBusyCallsDay']+=0x1;_0x59c316[_0x42c5('0xaa')]=0x5;_0x59c316[_0x42c5('0xab')]=_0x42c5('0x1ab');_0x59c316[_0x42c5('0xed')]+=0x1;_0x59c316[_0x42c5('0xea')]+=0x1;ami[_0x42c5('0x4e')](_0x42c5('0x1ac'),ut[_0x42c5('0xeb')](_0x32eae0,_0x42c5('0x1ad')));_0x1512a3[_0x42c5('0xca')](_0x59c316)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x1ae')));if(_0x1512a3[_0x42c5('0x192')](0x5,_0x32eae0,_0x46ec41)){if(_0x59c316[_0x42c5('0xed')]>=_0x46ec41['dialBusyMaxRetry']){_0x1512a3['createStateFinal'](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1af'));}else{_0x1512a3['stateGlobal'](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1af'));}}break;case'8':_0x46ec41[_0x42c5('0x66')]+=0x1;_0x59c316['state']=0x8;_0x59c316[_0x42c5('0xab')]='Congestion';_0x59c316[_0x42c5('0xee')]+=0x1;_0x59c316['countglobal']+=0x1;ami[_0x42c5('0x4e')](_0x42c5('0x1b0'),ut['buildObj'](_0x32eae0,'congestion'));_0x1512a3[_0x42c5('0xca')](_0x59c316)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x1b1')));if(_0x1512a3[_0x42c5('0x192')](0x8,_0x32eae0,_0x46ec41)){if(_0x59c316[_0x42c5('0xee')]>=_0x46ec41[_0x42c5('0x198')]){_0x1512a3[_0x42c5('0x1a4')](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1b2'));}else{_0x1512a3[_0x42c5('0x103')](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1b2'));}}break;case'11':_0x46ec41['outboundAbandonedCallsDay']+=0x1;_0x59c316[_0x42c5('0xaa')]=0xb;_0x59c316[_0x42c5('0xab')]=_0x42c5('0x1b3');_0x59c316['countabandonedretry']+=0x1;_0x59c316['countglobal']+=0x1;_0x1512a3['createHistory'](_0x59c316)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x125')));if(_0x1512a3[_0x42c5('0x192')](0xb,_0x32eae0,_0x46ec41)){if(_0x59c316['countabandonedretry']>=_0x46ec41[_0x42c5('0x1b4')]){_0x1512a3[_0x42c5('0x1a4')](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1b5'));}else{_0x1512a3['stateGlobal'](_0x59c316,_0x408575,_0x53e78b,'reason\x2011\x20abandoned');}}break;case'20':_0x46ec41[_0x42c5('0x6d')]+=0x1;_0x59c316[_0x42c5('0xaa')]=0x14;_0x59c316[_0x42c5('0xab')]=_0x42c5('0x1b6');_0x59c316[_0x42c5('0xf1')]+=0x1;_0x59c316[_0x42c5('0xea')]+=0x1;ami[_0x42c5('0x4e')](_0x42c5('0x1b7'),ut[_0x42c5('0xeb')](_0x32eae0,_0x42c5('0x1b8')));_0x1512a3[_0x42c5('0xca')](_0x59c316)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x1b9')));if(_0x1512a3[_0x42c5('0x192')](0x14,_0x32eae0,_0x46ec41)){if(_0x59c316[_0x42c5('0xf1')]>=_0x46ec41['dialAgentRejectMaxRetry']){_0x1512a3[_0x42c5('0x1a4')](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1ba'));}else{_0x1512a3[_0x42c5('0x103')](_0x59c316,_0x408575,_0x53e78b,_0x42c5('0x1ba'));}}break;default:_0x46ec41['outboundUnknownCallsDay']+=0x1;_0x59c316['state']=0xc;_0x59c316[_0x42c5('0xab')]=_0x32e8be[_0x42c5('0x10c')];_0x1512a3[_0x42c5('0xca')](_0x59c316)[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x1bb')));if(_0x1512a3[_0x42c5('0x192')](_0x32e8be[_0x42c5('0x10c')],_0x32eae0,_0x46ec41)){if(_0x59c316[_0x42c5('0xed')]+_0x59c316['countcongestionretry']+_0x59c316[_0x42c5('0xef')]+_0x59c316[_0x42c5('0x101')]+_0x59c316[_0x42c5('0xf0')]+_0x59c316['countabandonedretry']+_0x59c316[_0x42c5('0xf4')]+_0x59c316[_0x42c5('0xf1')]>=_0x46ec41[_0x42c5('0xf2')]){_0x1512a3[_0x42c5('0x103')](_0x59c316,_0x408575,_0x53e78b,_0x32e8be[_0x42c5('0x10c')]);}else{_0x1512a3[_0x42c5('0x1a4')](_0x59c316,_0x408575,_0x53e78b,_0x32e8be[_0x42c5('0x10c')]);}}}});};Dialer['prototype'][_0x42c5('0x103')]=function(_0x51b436,_0x1417f4,_0x5731c4,_0x46be57){var _0x165a6b=new Final(_0x51b436);_0x165a6b['state']=0xf;_0x165a6b['statedesc']=_0x42c5('0x1bc');this[_0x42c5('0x1a4')](_0x165a6b,_0x1417f4,_0x5731c4,_0x46be57);};Dialer[_0x42c5('0x1e')]['createStateFinal']=function(_0xc3fa65,_0x34aa6c,_0x5e6e1b,_0x22a720){this[_0x42c5('0xc8')](_0xc3fa65)[_0x42c5('0xba')](function(){return _0x34aa6c(msgResponse('[callProgressDetecting]',_0x42c5('0x1bd'),_0x22a720));})[_0x42c5('0xb3')](function(){return _0x5e6e1b(msgResponse(_0x42c5('0x1be'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0x42c5('0x9')]=function(_0x58cde8){var _0x3b2c53=_0x58cde8[_0x42c5('0x1bf')]/0x64;var _0x5523ca=_0x58cde8[_0x42c5('0x69')]/(_0x58cde8[_0x42c5('0x69')]+_0x58cde8[_0x42c5('0x63')]);var _0x16967a=Math[_0x42c5('0x1c0')](_0x58cde8['predictiveIntervalAvailable']*(_0x58cde8[_0x42c5('0x1c1')]/0x64));var _0x5463a8=Math['round'](_0x58cde8['predictiveIntervalAvailable']*(_0x58cde8[_0x42c5('0x1c2')]/0x64));var _0x18ba08=_0x58cde8['available']+_0x58cde8['talking'];var _0x5a5d00=Math['floor'](_0x58cde8[_0x42c5('0x78')]*_0x58cde8[_0x42c5('0x90')]*_0x58cde8[_0x42c5('0x74')]*_0x58cde8[_0x42c5('0x75')]);if(_[_0x42c5('0x40')](_0x58cde8['startProgressive'])){if(!_['isUndefined'](_0x58cde8[_0x42c5('0x7a')])){_0x58cde8[_0x42c5('0x7a')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x42c5('0x1c3'));}if(!_[_0x42c5('0x40')](_0x58cde8[_0x42c5('0x95')])){loggerPredictive[_0x42c5('0x99')](_0x42c5('0x1c4'),_0x42c5('0x1c5'));clearInterval(_0x58cde8[_0x42c5('0x95')]);_0x58cde8[_0x42c5('0x95')]=undefined;}_0x58cde8['startProgressive']=moment()[_0x42c5('0x7d')](_0x42c5('0xfa'));loggerPredictive['info'](_0x58cde8[_0x42c5('0x44')],'collection\x20data\x20in\x20progressive\x20at',_0x58cde8[_0x42c5('0x2c')]);this[_0x42c5('0x159')](_0x58cde8,0x1);}else if(ifInterval(_0x58cde8[_0x42c5('0x1c6')],_0x58cde8[_0x42c5('0x2c')])){this['handlePower'](_0x58cde8,0x1);loggerPredictiveCalls[_0x42c5('0x82')](_0x42c5('0x1c7'),_0x58cde8[_0x42c5('0x2c')],_0x58cde8[_0x42c5('0x44')]);_0x58cde8[_0x42c5('0x78')]=0x0;_0x58cde8[_0x42c5('0x73')]=0x0;}else if(_0x3b2c53<_0x5523ca&&_0x58cde8[_0x42c5('0x1c8')]===_0x42c5('0x1c9')){freeVariablesPredictive(_0x58cde8);loggerPredictive[_0x42c5('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x42c5('0x1ca'),_0x5523ca,_0x42c5('0x2c'),_0x58cde8[_0x42c5('0x44')]);}else if(_0x5a5d00<_0x58cde8[_0x42c5('0x73')]&&_0x58cde8[_0x42c5('0x1c8')]===_0x42c5('0x1c9')){freeVariablesPredictive(_0x58cde8);loggerPredictive[_0x42c5('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x42c5('0x1cb'),_0x5a5d00,_0x42c5('0x1cc'),_0x58cde8['predictiveIntervalErlangCallsDroppedCalls'],_0x42c5('0x2c'),_0x58cde8[_0x42c5('0x44')]);}else if(!ifInterval(_0x58cde8[_0x42c5('0x1c6')],_0x58cde8[_0x42c5('0x2c')])&&_[_0x42c5('0x40')](_0x58cde8[_0x42c5('0x7a')])&&!_[_0x42c5('0x40')](_0x58cde8[_0x42c5('0x2c')])){_0x58cde8[_0x42c5('0x7a')]=moment()[_0x42c5('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x42c5('0x82')](_0x58cde8[_0x42c5('0x44')],_0x42c5('0x1cd'),_0x58cde8[_0x42c5('0x7a')]);this[_0x42c5('0x1ce')](_0x58cde8[_0x42c5('0x1c6')])['then'](this['getDataPredictive'](_0x58cde8))[_0x42c5('0xba')](mergeDataErlangB(_0x58cde8))[_0x42c5('0xba')](this[_0x42c5('0x1cf')](_0x58cde8))['catch'](loggerCatchPredictive(_0x42c5('0x1d0'),_0x58cde8));}else if(!ifInterval(_0x58cde8['dialPredictiveInterval'],_0x58cde8['startPredictive'])){_0x58cde8[_0x42c5('0x73')]=0x0;_0x58cde8[_0x42c5('0x7a')]=moment()['format'](_0x42c5('0xfa'));loggerPredictive[_0x42c5('0x82')](_0x58cde8['name'],'recalculate\x20predictive\x20at',_0x58cde8['startPredictive']);clearInterval(_0x58cde8[_0x42c5('0x95')]);_0x58cde8[_0x42c5('0x95')]=undefined;this['averageHandleTime'](_0x58cde8[_0x42c5('0x1c6')])['then'](this[_0x42c5('0x1d1')](_0x58cde8))[_0x42c5('0xba')](mergeDataErlangB(_0x58cde8))[_0x42c5('0xba')](this['startMethodPredictive'](_0x58cde8))[_0x42c5('0xb3')](loggerCatchPredictive(_0x42c5('0x1d2'),_0x58cde8));}else if(_0x58cde8[_0x42c5('0x1d3')]&&_0x18ba08<_0x58cde8[_0x42c5('0x1d3')]-_0x5463a8){freeVariablesPredictive(_0x58cde8);loggerPredictive[_0x42c5('0x82')](_0x58cde8[_0x42c5('0x44')],_0x42c5('0x1d4'),_0x18ba08,_0x42c5('0x1d5'),_0x58cde8[_0x42c5('0x1d3')],'-',_0x5463a8,'=',_0x58cde8['predictiveIntervalAvailable']-_0x5463a8,')');}else if(_0x58cde8[_0x42c5('0x1d3')]&&_0x18ba08>_0x58cde8[_0x42c5('0x1d3')]+_0x16967a){freeVariablesPredictive(_0x58cde8);loggerPredictive[_0x42c5('0x82')](_0x58cde8[_0x42c5('0x44')],_0x42c5('0x1d4'),_0x18ba08,_0x42c5('0x1d6'),_0x58cde8[_0x42c5('0x1d3')],'+',_0x16967a,'=',_0x58cde8[_0x42c5('0x1d3')]+_0x16967a,')');}};Dialer[_0x42c5('0x1e')]['getDataPredictive']=function(_0x3a2778){var _0x44326d=this;return function(_0x49ae01){return new BPromise(function(_0x41de7e,_0x2c8881){_['merge'](_0x3a2778,_0x49ae01[0x0]);if(checkGetDataPredictive(_0x49ae01[0x0])){var _0x4f8aa0=_0x3a2778[_0x42c5('0x1d3')]=_0x3a2778[_0x42c5('0x57')]+_0x3a2778['available'];var _0x552d26=_0x3a2778[_0x42c5('0x1c6')]*0x3c;var _0x41128d=_0x49ae01[0x0][_0x42c5('0x87')]+_0x49ae01[0x0]['predictiveIntervalAvgHoldtime'];var _0x402373=(_0x49ae01[0x0]['predictiveIntervalAnsweredCalls']+_0x49ae01[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x49ae01[0x0][_0x42c5('0x70')])/_0x49ae01[0x0][_0x42c5('0x89')];_0x3a2778['predictiveIntervalHitRate']=_0x402373>0x0?_0x402373:0x1;switch(_0x3a2778[_0x42c5('0x1c8')]){case _0x42c5('0x1c9'):var _0x467d18=_0x3a2778[_0x42c5('0x1bf')]/0x64;return _0x44326d[_0x42c5('0x1d7')](_0x4f8aa0,_0x552d26,_0x41128d,_0x402373,_0x467d18)[_0x42c5('0xba')](function(_0x1e91f7){return _0x41de7e(_0x1e91f7);});case _0x42c5('0x1d8'):var _0x88a64c=_0x3a2778['dialPredictiveOptimizationPercentage']/0x64;return _0x44326d[_0x42c5('0x1d9')](_0x4f8aa0,_0x552d26,_0x41128d,_0x402373,_0x88a64c)['then'](function(_0x3f1b7f){return _0x41de7e(_0x3f1b7f);});default:return _0x2c8881(msgResponse('[getDataPredictive]','Failure',_0x42c5('0x1da')));}}else{return _0x2c8881(msgResponse(_0x42c5('0x1db'),_0x42c5('0x147'),_0x42c5('0x1dc')));}});};};Dialer[_0x42c5('0x1e')][_0x42c5('0x1dd')]=function(_0x1a995b){var _0x2906b4=this;return function(_0x2c0543){return new BPromise(function(_0x4c4948,_0x204705){_['merge'](_0x1a995b,_0x2c0543[0x0]);if(checkGetDataPredictive(_0x2c0543[0x0])){loggerPredictive[_0x42c5('0x82')](JSON[_0x42c5('0x4d')](_0x2c0543[0x0]));if(_0x1a995b[_0x42c5('0x1c8')]===_0x42c5('0x1c9')){return _0x2906b4[_0x42c5('0xc6')](_0x1a995b['id'])[_0x42c5('0xba')](function(_0x361ff0){var _0xdde29e=_0x1a995b[_0x42c5('0x53')]-_0x361ff0[0x0][_0x42c5('0x1de')];var _0xff2b7f=_0x1a995b[_0x42c5('0x1c6')]*0x3c;var _0x4ff41e=_0x2c0543[0x0][_0x42c5('0x87')]+_0x2c0543[0x0][_0x42c5('0x6f')];var _0x3ae84c=(_0x2c0543[0x0][_0x42c5('0x6e')]+_0x2c0543[0x0][_0x42c5('0x71')]+_0x2c0543[0x0][_0x42c5('0x70')])/_0x2c0543[0x0][_0x42c5('0x89')];var _0xae540a=_0x1a995b[_0x42c5('0x1bf')]/0x64;_0x1a995b[_0x42c5('0x76')]=_0x361ff0[0x0]['outboundQueuePauses']||0x0;_0x1a995b['predictiveIntervalHitRate']=_0x3ae84c>0x0?_0x3ae84c:0x1;return _0x2906b4[_0x42c5('0x1d7')](_0xdde29e,_0xff2b7f,_0x4ff41e,_0x3ae84c,_0xae540a);})[_0x42c5('0xba')](function(_0x5e02f5){return _0x4c4948(_0x5e02f5);})[_0x42c5('0xb3')](function(_0x2ada51){return _0x204705(msgResponse('[CatchErlangB]',_0x42c5('0x147'),JSON[_0x42c5('0x4d')](_0x2ada51)));});}if(_0x1a995b['dialPredictiveOptimization']===_0x42c5('0x1d8')){return _0x2906b4[_0x42c5('0xc6')](_0x1a995b['id'])[_0x42c5('0xba')](function(_0x3c85a4){var _0x35c64f=_0x1a995b[_0x42c5('0x53')]-_0x3c85a4[0x0][_0x42c5('0x1de')];var _0x484e9e=_0x1a995b[_0x42c5('0x1c6')]*0x3c;var _0xd1e8e1=_0x2c0543[0x0][_0x42c5('0x87')]+_0x2c0543[0x0][_0x42c5('0x6f')];var _0x2cfa7d=(_0x2c0543[0x0]['predictiveIntervalAnsweredCalls']+_0x2c0543[0x0][_0x42c5('0x71')]+_0x2c0543[0x0][_0x42c5('0x70')])/_0x2c0543[0x0]['predictiveIntervalTotalCalls'];var _0x2baf55=_0x1a995b['dialPredictiveOptimizationPercentage']/0x64;_0x1a995b[_0x42c5('0x76')]=_0x3c85a4[0x0][_0x42c5('0x1de')]||0x0;_0x1a995b[_0x42c5('0x74')]=_0x2cfa7d>0x0?_0x2cfa7d:0x1;return _0x2906b4[_0x42c5('0x1d9')](_0x35c64f,_0x484e9e,_0xd1e8e1,_0x2cfa7d,_0x2baf55);})['then'](function(_0x1af3a2){return _0x4c4948(_0x1af3a2);})[_0x42c5('0xb3')](function(_0x2a32b7){return _0x204705(msgResponse(_0x42c5('0x1df'),_0x42c5('0x147'),JSON[_0x42c5('0x4d')](_0x2a32b7)));});}}else{return _0x204705(msgResponse('[getDataPredictive]',_0x42c5('0x147'),_0x42c5('0x1dc')));}});};};Dialer[_0x42c5('0x1e')]['startMethodPredictive']=function(_0x5267fc){var _0x59a580=this;return function(){var _0x217050=0x0;var _0x543589=Math['floor'](_0x5267fc['erlangCallToSecond']*0x3e8);if(_0x543589>0x0){_0x543589=_0x543589<0x64?0x64:_0x543589;loggerPredictive[_0x42c5('0x82')](_0x5267fc[_0x42c5('0x44')],'one\x20call\x20every:',_0x543589,_0x42c5('0x93'));_0x5267fc['handlePredictive']=setInterval(function(){_0x59a580[_0x42c5('0x95')](_0x5267fc);loggerPredictiveCalls['info']('[handlePredictive]',_0x217050+=0x1);},_0x543589);}else{loggerPredictive[_0x42c5('0x82')](_0x5267fc[_0x42c5('0x44')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0x3e7852,_0x44ffe2){var _0x164442=this;return function(_0x203592){if(_['isEmpty'](_0x203592)){if(_[_0x42c5('0xb0')](_0x44ffe2[_0x42c5('0xd4')])||!_0x44ffe2[_0x42c5('0x1e0')]){if(_0x3e7852['dialMethod']===_0x42c5('0x15c')){_0x3e7852['queueStatusComplete']=_[_0x42c5('0x40')](_0x3e7852[_0x42c5('0x12c')])?!![]:_0x3e7852[_0x42c5('0x12c')];var _0x4c3db7=uuid['v4']();_0x164442[_0x42c5('0x28')][_0x4c3db7]=new Action(_0x3e7852,_0x44ffe2,_0x4c3db7);loggerBooked['info'](_0x42c5('0x1e1'),_0x4c3db7,_0x42c5('0x1e2'),JSON['stringify'](_0x3e7852[_0x42c5('0x12c')]),_0x42c5('0x1e3'),_0x3e7852[_0x42c5('0x44')]);if(_0x3e7852[_0x42c5('0x12c')]){_0x3e7852['queueStatusComplete']=![];_0x164442[_0x42c5('0x2e')][_0x164442[_0x42c5('0x28')][_0x4c3db7][_0x42c5('0xb6')]]=[];ami['Action']({'actionid':_0x4c3db7,'action':'queuestatus','queue':_0x3e7852[_0x42c5('0x44')]})[_0x42c5('0xb3')](function(){_0x164442[_0x42c5('0xb4')](_0x3e7852);_0x164442[_0x42c5('0xbf')]({'active':![],'ContactId':_0x164442['actions'][_0x4c3db7][_0x42c5('0xd2')],'ListId':_0x164442[_0x42c5('0x28')][_0x4c3db7][_0x42c5('0xd3')],'VoiceQueueId':_0x164442[_0x42c5('0x28')][_0x4c3db7][_0x42c5('0xfb')]||undefined,'CampaignId':_0x164442[_0x42c5('0x28')][_0x4c3db7]['CampaignId']||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x1e4')));delete _0x164442[_0x42c5('0x28')][_0x4c3db7];});}else{loggerBooked[_0x42c5('0x82')](_0x42c5('0x1e5'),JSON[_0x42c5('0x4d')](_0x3e7852[_0x42c5('0x12c')]),'Queue:\x20',_0x3e7852[_0x42c5('0x44')]);_0x164442[_0x42c5('0xb4')](_0x3e7852);_0x164442[_0x42c5('0xbf')]({'active':![],'ContactId':_0x164442[_0x42c5('0x28')][_0x4c3db7]['ContactId'],'ListId':_0x164442[_0x42c5('0x28')][_0x4c3db7][_0x42c5('0xd3')],'VoiceQueueId':_0x164442['actions'][_0x4c3db7][_0x42c5('0xfb')]||undefined,'CampaignId':_0x164442[_0x42c5('0x28')][_0x4c3db7][_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x164442[_0x42c5('0x28')][_0x4c3db7];}}else{return _0x164442['actionOriginate'](_0x3e7852,_0x44ffe2);}}else{if(getDiff(_0x44ffe2[_0x42c5('0x1e6')])<_0x3e7852[_0x42c5('0x1e7')]*0x3c){if(_0x44ffe2[_0x42c5('0x1e8')]&&!_0x44ffe2['Agent'][_0x42c5('0x1e9')]){_0x164442[_0x42c5('0x12f')][_0x42c5('0x130')](_0x44ffe2['id'])['finally'](function(){_0x164442[_0x42c5('0xb4')](_0x3e7852);});}else{_0x164442[_0x42c5('0xc1')]({'active':![]},_0x44ffe2['id'],0x1)[_0x42c5('0x20')](function(){_0x164442[_0x42c5('0xb4')](_0x3e7852);});}}else{_0x3e7852[_0x42c5('0x6c')]+=0x1;_0x164442[_0x42c5('0xb4')](_0x3e7852);if(_0x3e7852[_0x42c5('0x1ea')]){_0x164442[_0x42c5('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x44ffe2['ContactId'],'ListId':_0x44ffe2[_0x42c5('0xd3')],'VoiceQueueId':_0x44ffe2[_0x42c5('0xfb')]||undefined,'CampaignId':_0x44ffe2[_0x42c5('0xfc')]||undefined})[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x1eb')));_0x164442['createHistory'](createObjHistory(_0x3e7852,_0x44ffe2,_0x42c5('0x1ec'),0x17,_0x42c5('0x1ed')))[_0x42c5('0xb3')](loggerCatch(_0x42c5('0x1ee')));}else{_0x164442[_0x42c5('0xd0')](createObjHistory(_0x3e7852,_0x44ffe2,_0x42c5('0x1ef'),0x16,_0x42c5('0x1f0')),_0x42c5('0x1f1'),_0x42c5('0x1f2'));}}}}else{_0x3e7852[_0x42c5('0x64')]+=0x1;_0x164442[_0x42c5('0xd0')](createObjHistory(_0x3e7852,_0x44ffe2,'BLACKLIST',0xd,'Blacklist'),_0x42c5('0x1f3'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x42c5('0x1e')]['handleIvr']=function(_0x5970a0){var _0x186afb=this;var _0x186967=_0x5970a0['limitCalls']-_0x5970a0[_0x42c5('0x77')]-_0x5970a0[_0x42c5('0xc3')];emitCampaignSummary(_0x5970a0);if(_0x186967>0x0){if(_0x186967>this[_0x42c5('0x26')]){_0x186967=this[_0x42c5('0x26')];}_0x5970a0[_0x42c5('0xc3')]+=_0x186967;this[_0x42c5('0xc4')](_0x5970a0['id'],_0x186967,_0x5970a0[_0x42c5('0x1f4')],_0x5970a0)[_0x42c5('0xba')](function(_0x5ba4cb){_0x5970a0[_0x42c5('0xc3')]-=_0x186967;_0x5970a0[_0x42c5('0xc3')]=_0x5970a0['temp']>0x0?_0x5970a0[_0x42c5('0xc3')]:0x0;if(!checkContactEmpty(_0x5ba4cb)){_0x5970a0[_0x42c5('0x4b')]=_0x42c5('0xa2');logger[_0x42c5('0x82')](_0x42c5('0x1f5')+_0x5970a0[_0x42c5('0x44')]);}else{_0x5970a0[_0x42c5('0x77')]+=_0x5ba4cb['length'];_0x5970a0[_0x42c5('0x4b')]=_0x42c5('0x1f6');for(var _0x57b17d=0x0;_0x57b17d<_0x5ba4cb[_0x42c5('0x9c')];_0x57b17d+=0x1){_0x5970a0[_0x42c5('0x1f7')]+=0x1;if(_[_0x42c5('0xb0')](_0x5ba4cb[_0x57b17d])||_['isNil'](_0x5ba4cb[_0x57b17d][_0x42c5('0x16a')])||_[_0x42c5('0xb0')](_0x5ba4cb[_0x57b17d][_0x42c5('0x16a')][_0x42c5('0x16b')])){_0x186afb[_0x42c5('0xce')]('[actionOriginate]\x20',_0x5970a0,_0x5ba4cb[_0x57b17d]);}else{_0x186afb['checkIsBlackListIvr'](_[_0x42c5('0xd1')](_0x5ba4cb[_0x57b17d],[_0x42c5('0xfc'),'Contact.phone']))[_0x42c5('0xba')](_0x186afb[_0x42c5('0x1f8')](_0x5970a0,_0x5ba4cb[_0x57b17d]))[_0x42c5('0xb3')](_0x186afb[_0x42c5('0xcd')](_0x42c5('0x1f9'),_0x5970a0));}}}})['catch'](loggerGetContactDialer(_0x42c5('0x1fa'),_0x5970a0,_0x186967));}};Dialer[_0x42c5('0x1e')][_0x42c5('0x159')]=function(_0x598fca,_0x4e77e2){var _0x38b9b8=this;var _0x53be57=[];var _0xfb66ec=_0x4e77e2>=0x1?_0x4e77e2:0x1;if(_0x598fca['dialMethod']===_0x42c5('0x15c')){_0xfb66ec=0x1;}var _0x3b4c40=Math[_0x42c5('0x1fb')](_0x598fca[_0x42c5('0x52')]*_0xfb66ec)-_0x598fca[_0x42c5('0x77')]-_0x598fca[_0x42c5('0xc3')];emitVoiceQueueSummary(_0x598fca);if(_0x598fca[_0x42c5('0x1fc')]>0x0){var _0x30cfa5=_0x598fca['dialLimitQueue']-_0x598fca[_0x42c5('0x77')]-_0x598fca[_0x42c5('0x57')]-_0x598fca[_0x42c5('0xc3')]-_0x598fca[_0x42c5('0x54')];if(_0x3b4c40>_0x30cfa5){_0x3b4c40=_0x30cfa5;}}if(_0x3b4c40>0x0){if(_0x598fca[_0x42c5('0x5d')]===_0x42c5('0x15c')){_0x3b4c40=0x1;}if(_0x3b4c40>this[_0x42c5('0x26')]){_0x3b4c40=this['maxNumberOriginate'];}_0x598fca[_0x42c5('0xc3')]+=_0x3b4c40;for(var _0x9ae227 in this[_0x42c5('0x24')]){if(typeof this[_0x42c5('0x24')][_0x9ae227]!=='undefined'){if(this['agents'][_0x9ae227][_0x42c5('0xaa')]===_0x42c5('0x1fd')&&this['agents'][_0x9ae227][_0x42c5('0xb2')]==='reachable'){_0x53be57[_0x42c5('0x12b')](this[_0x42c5('0x24')][_0x9ae227]['id']);}}}this['getContactDialer'](_0x598fca['id'],_0x53be57,_0x3b4c40,_0x598fca[_0x42c5('0x1f4')],_0x598fca)[_0x42c5('0xba')](function(_0x39134a){_0x598fca[_0x42c5('0xc3')]-=_0x3b4c40;_0x598fca[_0x42c5('0xc3')]=_0x598fca[_0x42c5('0xc3')]>0x0?_0x598fca[_0x42c5('0xc3')]:0x0;if(!checkContactEmpty(_0x39134a)){_0x38b9b8[_0x42c5('0xb8')](_0x598fca)['then'](sendMessageReschedule(_0x598fca))['catch'](loggerCatch(_0x42c5('0xbb')));}else{_0x598fca[_0x42c5('0x77')]+=_0x39134a[_0x42c5('0x9c')];_0x598fca[_0x42c5('0x4b')]=_0x598fca['dialMethod']===_0x42c5('0x15c')?_0x42c5('0x171'):'RUNNING';for(var _0xec1a53=0x0;_0xec1a53<_0x39134a[_0x42c5('0x9c')];_0xec1a53+=0x1){if(_[_0x42c5('0xb0')](_0x39134a[_0xec1a53])||_[_0x42c5('0xb0')](_0x39134a[_0xec1a53][_0x42c5('0x16a')])||_[_0x42c5('0xb0')](_0x39134a[_0xec1a53][_0x42c5('0x16a')]['phone'])){_0x38b9b8[_0x42c5('0xce')](_0x42c5('0x1fe'),_0x598fca,_0x39134a[_0xec1a53]);}else{_0x38b9b8[_0x42c5('0x1ff')](_[_0x42c5('0xd1')](_0x39134a[_0xec1a53],['VoiceQueueId','Contact.phone']))['then'](_0x38b9b8[_0x42c5('0x1f8')](_0x598fca,_0x39134a[_0xec1a53]))['catch'](_0x38b9b8[_0x42c5('0xcd')](_0x42c5('0x1fe'),_0x598fca));}}}})[_0x42c5('0xb3')](loggerGetContactDialer(_0x42c5('0x200'),_0x598fca,_0x3b4c40));}};Dialer[_0x42c5('0x1e')][_0x42c5('0x95')]=function(_0x297e54){if(_0x297e54['dialLimitQueue']>0x0){var _0x655e35=_0x297e54[_0x42c5('0x1fc')]-_0x297e54[_0x42c5('0x77')]-_0x297e54[_0x42c5('0x57')];if(_0x655e35>0x0){this['tryOriginatePredictive'](_0x297e54);}else{loggerPredictiveCalls['info'](_0x42c5('0x201'));}}else{this['tryOriginatePredictive'](_0x297e54);}};Dialer[_0x42c5('0x1e')][_0x42c5('0x202')]=function(_0x2fe3c5){var _0x148ced=this;var _0x211500=[];_0x2fe3c5['originated']+=0x1;for(var _0x48e9cd in this[_0x42c5('0x24')]){if(typeof this[_0x42c5('0x24')][_0x48e9cd]!==_0x42c5('0x9d')){if(this[_0x42c5('0x24')][_0x48e9cd]['state']===_0x42c5('0x1fd')&&this[_0x42c5('0x24')][_0x48e9cd][_0x42c5('0xb2')]===_0x42c5('0xd8')){_0x211500[_0x42c5('0x12b')](this[_0x42c5('0x24')][_0x48e9cd]['id']);}}}this['getContactDialer'](_0x2fe3c5['id'],_0x211500,0x1,_0x2fe3c5['dialOrderByScheduledAt'],_0x2fe3c5)[_0x42c5('0xba')](function(_0xd4f433){if(!checkContactEmpty(_0xd4f433)){checkContactLowerLimitOriginate(_0x2fe3c5,0x1,0x0);_0x148ced['countReScheduled'](_0x2fe3c5)[_0x42c5('0xba')](sendMessageReschedule(_0x2fe3c5))['catch'](loggerCatch(_0x42c5('0xbb')));}else{_0x2fe3c5[_0x42c5('0x4b')]='RUNNING';if(_[_0x42c5('0xb0')](_0xd4f433[0x0])||_['isNil'](_0xd4f433[0x0][_0x42c5('0x16a')])||_[_0x42c5('0xb0')](_0xd4f433[0x0]['Contact'][_0x42c5('0x16b')])){_0x148ced[_0x42c5('0xce')](_0x42c5('0x1fe'),_0x2fe3c5,_0xd4f433[0x0]);}else{_0x148ced[_0x42c5('0x1ff')](_['pick'](_0xd4f433[0x0],[_0x42c5('0xfb'),'Contact.phone']))[_0x42c5('0xba')](_0x148ced[_0x42c5('0x1f8')](_0x2fe3c5,_0xd4f433[0x0]))['catch'](_0x148ced[_0x42c5('0xcd')](_0x42c5('0x203'),_0x2fe3c5));}}})[_0x42c5('0xb3')](loggerGetContactDialer(_0x42c5('0x204'),_0x2fe3c5,0x1));emitVoiceQueueSummary(_0x2fe3c5);};Dialer['prototype'][_0x42c5('0x1d7')]=function(_0x4be368,_0x324d88,_0x1f11ec,_0x14e323,_0xb947d7,_0x62d033){loggerPredictive[_0x42c5('0x82')](_0x42c5('0x205'));loggerPredictive[_0x42c5('0x82')](_0x42c5('0x206'),_0x4be368);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x207'),_0x324d88);loggerPredictive['info'](_0x42c5('0x208'),_0x1f11ec);loggerPredictive[_0x42c5('0x82')]('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',_0x14e323);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x209'),_0xb947d7);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x88'));return new BPromise(function(_0x32a713,_0x19213b){if(_0x4be368<=0x0||isNaN(_0x4be368)){return _0x19213b(msgResponse(_0x42c5('0x20a'),_0x42c5('0x4c'),'m\x20=\x20'+_0x4be368));}if(_0x1f11ec<=0x0||isNaN(_0x1f11ec)){return _0x19213b(msgResponse(_0x42c5('0x20a'),'Error',_0x42c5('0x20b')+_0x1f11ec));}if(_0x14e323<=0x0||isNaN(_0x14e323)){return _0x19213b(msgResponse('[abandonmentRate]',_0x42c5('0x4c'),_0x42c5('0x20c')+_0x14e323));}if(_0x324d88<=0x0||isNaN(_0x324d88)){return _0x19213b(msgResponse(_0x42c5('0x20a'),_0x42c5('0x4c'),_0x42c5('0x20d')+_0x324d88));}if(_0xb947d7<=0x0||isNaN(_0xb947d7)){return _0x19213b(msgResponse('[abandonmentRate]',_0x42c5('0x4c'),_0x42c5('0x20e')+_0xb947d7));}_0x62d033=_0x62d033||0x0;var _0x4ef6c9=0x1/_0x1f11ec;var _0x57e448=0x0;var _0x344c71=0x0;var _0x2a970f=0x0;var _0x5a789a=0x0;for(var _0xad21df=0x0;_0x2a970f<_0xb947d7;_0xad21df+=0x1){_0x344c71=_0xad21df/_0x324d88;_0x57e448=(_0x14e323*_0x344c71+_0x62d033)/_0x4ef6c9;_0x2a970f=erlangb(_0x57e448,_0x4be368);_0x5a789a=_0x57e448/_0x4be368*(0x1-erlangb(_0x57e448,_0x4be368));}return _0x32a713({'erlangCalls':_0xad21df,'erlangCallToSecond':_0x324d88/_0xad21df,'erlangAbandonmentRate':_0x2a970f,'erlangBusyFactor':_0x5a789a});});};Dialer[_0x42c5('0x1e')][_0x42c5('0x1d9')]=function(_0x4c93ae,_0x4a2022,_0x37111a,_0xde6115,_0x22d4ec,_0x592b0d){loggerPredictive['info'](_0x42c5('0x20f'));loggerPredictive[_0x42c5('0x82')](_0x42c5('0x206'),_0x4c93ae);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x207'),_0x4a2022);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x208'),_0x37111a);loggerPredictive[_0x42c5('0x82')]('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',_0xde6115);loggerPredictive[_0x42c5('0x82')](_0x42c5('0x210'),_0x22d4ec);loggerPredictive[_0x42c5('0x82')]('---------------------------');return new BPromise(function(_0x46ff38,_0x3aec1e){if(_0x4c93ae<=0x0||isNaN(_0x4c93ae)){return _0x3aec1e(msgResponse('[busyFactor]','Error',_0x42c5('0x211')+_0x4c93ae));}if(_0x37111a<=0x0||isNaN(_0x37111a)){return _0x3aec1e(msgResponse(_0x42c5('0x212'),_0x42c5('0x4c'),'Ts\x20=\x20'+_0x37111a));}if(_0xde6115<=0x0||isNaN(_0xde6115)){return _0x3aec1e(msgResponse('[busyFactor]',_0x42c5('0x4c'),_0x42c5('0x20c')+_0xde6115));}if(_0x4a2022<=0x0||isNaN(_0x4a2022)){return _0x3aec1e(msgResponse('[busyFactor]',_0x42c5('0x4c'),_0x42c5('0x20d')+_0x4a2022));}if(_0x22d4ec<=0x0||isNaN(_0x22d4ec)){return _0x3aec1e(msgResponse(_0x42c5('0x212'),_0x42c5('0x4c'),'Umin\x20=\x20'+_0x22d4ec));}_0x592b0d=_0x592b0d||0x0;var _0xdc6fa1=0x1/_0x37111a;var _0x444e44=0x0;var _0x29225b=0x0;var _0x2fd72b=0x0;var _0x374e3e=0x0;for(var _0xd4db21=0x0;_0x374e3e<_0x22d4ec;_0xd4db21+=0x1){_0x29225b=_0xd4db21/_0x4a2022;_0x444e44=(_0xde6115*_0x29225b+_0x592b0d)/_0xdc6fa1;_0x2fd72b=erlangb(_0x444e44,_0x4c93ae);_0x374e3e=_0x444e44/_0x4c93ae*(0x1-erlangb(_0x444e44,_0x4c93ae));}return _0x46ff38({'erlangCalls':_0xd4db21,'erlangCallToSecond':_0x4a2022/_0xd4db21,'erlangAbandonmentRate':_0x2fd72b,'erlangBusyFactor':_0x374e3e});});};module[_0x42c5('0x213')]=Dialer; \ No newline at end of file +var _0x6f0d=['Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr]','Machine','countnoanswerretry','countdropretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','syncAgentComplete','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','dialQueueProject2','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','stateinterface','queueBooked','push','merge','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','paused','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','syncQueueSummary','dialMethod','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','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','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','emptyContact','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Error','milliseconds','diff','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','stringify','md5','format','voice:queue:%s','type','ivr','campaign:ivr:%s','campaign:save','isEmpty','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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','seconds','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','actions','[actions]','isNil'];(function(_0x2488a2,_0x50f57a){var _0x58e303=function(_0x46ddf1){while(--_0x46ddf1){_0x2488a2['push'](_0x2488a2['shift']());}};_0x58e303(++_0x50f57a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x56a429,_0x5b3432){_0x56a429=_0x56a429-0x0;var _0x541a2f=_0x6f0d[_0x56a429];return _0x541a2f;};'use strict';var util=require('util');var _=require(_0xd6f0('0x0'));var BPromise=require(_0xd6f0('0x1'));var uuid=require(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xd6f0('0x4'));var ut=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var logger=require(_0xd6f0('0x7'))(_0xd6f0('0x8'));var loggerBooked=require('../../../config/logger')(_0xd6f0('0x9'));var loggerPredictive=require('../../../config/logger')(_0xd6f0('0xa'));var loggerPredictiveCalls=require(_0xd6f0('0x7'))(_0xd6f0('0xb'));var loggerSyncQueueSummary=require(_0xd6f0('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0xd6f0('0xc')]=_[_0xd6f0('0xd')](config[_0xd6f0('0xc')],{'host':_0xd6f0('0xe'),'port':0x18eb});var io=require(_0xd6f0('0xf'))(new Redis(config['redis']));var cmHopper=require(_0xd6f0('0x10'));var cmHopperHistory=require(_0xd6f0('0x11'));var cmHopperBlack=require(_0xd6f0('0x12'));var voiceQueueRt=require(_0xd6f0('0x13'));var Action=require('./action');var History=require(_0xd6f0('0x14'));var Final=require(_0xd6f0('0x15'));var AgentComplete=require(_0xd6f0('0x16'));var QueueCallerAbandon=require(_0xd6f0('0x17'));var Hangup=require(_0xd6f0('0x18'));var ipAgi=process[_0xd6f0('0x19')][_0xd6f0('0x1a')]||_0xd6f0('0x1b');var strategy={'rrmemory':_0xd6f0('0x1c'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xd6f0('0x1d')][_0xd6f0('0x1e')]=function(_0x4c1559){this[_0xd6f0('0x1f')]=this['tail']?this[_0xd6f0('0x1f')][_0xd6f0('0x20')](_0x4c1559):_0x4c1559();};function Dialer(_0x41bd99,_0x472156){this[_0xd6f0('0x21')]=new Sequence();this[_0xd6f0('0x22')]=_0x472156;this[_0xd6f0('0x23')]=_0x41bd99[_0xd6f0('0x23')];this[_0xd6f0('0x24')]=_0x41bd99[_0xd6f0('0x24')];this[_0xd6f0('0x25')]=_0x41bd99[_0xd6f0('0x25')];this[_0xd6f0('0x26')]=_0x41bd99[_0xd6f0('0x26')];this[_0xd6f0('0x27')]=config[_0xd6f0('0x27')]||0x2;this['channels']={};this['actions']={};this[_0xd6f0('0x28')]={};this[_0xd6f0('0x29')]={};this[_0xd6f0('0x2a')]={};this['startPredictive']={};this[_0xd6f0('0x2b')]={};this[_0xd6f0('0x2c')]={};this['queueBooked']={};this[_0xd6f0('0x2d')]={};ami['on']('agentconnect',this[_0xd6f0('0x2e')][_0xd6f0('0x2f')](this));ami['on']('queuecallerabandon',this[_0xd6f0('0x30')][_0xd6f0('0x2f')](this));ami['on']('originateresponse',this[_0xd6f0('0x31')][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x32'),this['syncAgentComplete'][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x33'),this['syncQueueSummary'][_0xd6f0('0x2f')](this));ami['on']('hangup',this[_0xd6f0('0x34')][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x35'),this[_0xd6f0('0x36')][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x37'),this[_0xd6f0('0x38')][_0xd6f0('0x2f')](this));ami['on']('queuemember',this[_0xd6f0('0x39')][_0xd6f0('0x2f')](this));ami['on']('queuestatuscomplete',this[_0xd6f0('0x3a')][_0xd6f0('0x2f')](this));this[_0xd6f0('0x3b')]();this[_0xd6f0('0x3c')]();}function isNotNull(_0x1a3967){return _0x1a3967!==null&&!_[_0xd6f0('0x3d')](_0x1a3967);}function checkIsLoggedIn(_0x351fda,_0x3151f8){return function(){if(_0x3151f8<=0x0){_0x351fda[_0xd6f0('0x3e')]=_0xd6f0('0x3f');throw _0x351fda[_0xd6f0('0x40')]+_0xd6f0('0x41');}};}function isActive(_0x348529){return _0x348529;}function checkIsActive(_0xa863d9,_0xbdd223){return function(){if(!isActive(_0xbdd223)){_0xa863d9[_0xd6f0('0x3e')]=_0xd6f0('0x42');throw _0xa863d9[_0xd6f0('0x40')]+_0xd6f0('0x43');}};}function checkInterval(_0x180e5f){return function(){if(!isNotNull(_0x180e5f[_0xd6f0('0x44')])){_0x180e5f[_0xd6f0('0x3e')]='INTERVAL_IS_NULL';throw _0x180e5f[_0xd6f0('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x180e5f['Interval'][_0xd6f0('0x45')])){_0x180e5f[_0xd6f0('0x3e')]=_0xd6f0('0x46');throw _0x180e5f[_0xd6f0('0x40')]+_0xd6f0('0x47');}if(!isNotNull(_['isEmpty'](_0x180e5f[_0xd6f0('0x44')]['Intervals']))){_0x180e5f[_0xd6f0('0x3e')]=_0xd6f0('0x46');throw _0x180e5f[_0xd6f0('0x40')]+_0xd6f0('0x47');}};}function msgResponse(_0x518751,_0x5c3132,_0x47b33d){return{'action':_0x518751,'response':_0x5c3132,'message':_0x47b33d,'stack':_0x47b33d};}function myreject(_0x3b6463){return function(_0xe2958d){return _0x3b6463(msgResponse('[ifTime][Action]',_0xd6f0('0x48'),JSON['stringify'](_0xe2958d)));};}function getSeconds(_0x507f66,_0x2fd7b8){var _0x28659e=moment(_0x507f66)[_0xd6f0('0x49')](0x0);var _0x451834=moment(_0x2fd7b8)[_0xd6f0('0x49')](0x0);return _0x28659e[_0xd6f0('0x4a')](_0x451834,'seconds');}function emit(_0x52203d,_0x162537,_0xf879a6){io['to'](_0x52203d)[_0xd6f0('0x4b')](_0x162537,_0xf879a6);}function emitVoiceQueueSummary(_0x5c2d9a){if(_0x5c2d9a['type']===_0xd6f0('0x4c')){var _0x2def01={'id':_0x5c2d9a['id'],'name':_0x5c2d9a[_0xd6f0('0x40')],'strategy':_0x5c2d9a[_0xd6f0('0x4d')],'answered':_0x5c2d9a[_0xd6f0('0x4e')],'available':_0x5c2d9a[_0xd6f0('0x4f')],'loggedIn':_0x5c2d9a[_0xd6f0('0x50')],'pTalking':_0x5c2d9a[_0xd6f0('0x51')],'sumBillable':_0x5c2d9a['sumBillable'],'sumDuration':_0x5c2d9a[_0xd6f0('0x52')],'sumHoldTime':_0x5c2d9a[_0xd6f0('0x53')]||0x0,'talking':_0x5c2d9a[_0xd6f0('0x54')],'total':_0x5c2d9a[_0xd6f0('0x55')],'type':_0x5c2d9a['type'],'unmanaged':_0x5c2d9a[_0xd6f0('0x56')],'abandoned':_0x5c2d9a[_0xd6f0('0x57')],'waiting':_0x5c2d9a[_0xd6f0('0x58')],'loggedInDb':_0x5c2d9a[_0xd6f0('0x59')],'dialActive':_0x5c2d9a[_0xd6f0('0x5a')],'dialMethod':_0x5c2d9a['dialMethod'],'dialOriginateCallerIdName':_0x5c2d9a[_0xd6f0('0x5b')],'dialOriginateCallerIdNumber':_0x5c2d9a[_0xd6f0('0x5c')],'dialOriginateTimeout':_0x5c2d9a[_0xd6f0('0x5d')],'dialPrefix':_0x5c2d9a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5c2d9a[_0xd6f0('0x5e')],'outboundAnswerCallsDay':_0x5c2d9a[_0xd6f0('0x5f')],'outboundBlacklistCallsDay':_0x5c2d9a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5c2d9a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5c2d9a[_0xd6f0('0x60')],'outboundDropCallsDayACS':_0x5c2d9a[_0xd6f0('0x61')],'outboundDropCallsDayCallersExit':_0x5c2d9a[_0xd6f0('0x62')],'outboundDropCallsDayTimeout':_0x5c2d9a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5c2d9a[_0xd6f0('0x63')],'outboundNoSuchCallsDay':_0x5c2d9a[_0xd6f0('0x64')],'outboundOriginateFailureCallsDay':_0x5c2d9a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5c2d9a[_0xd6f0('0x65')],'outboundRejectCallsDay':_0x5c2d9a[_0xd6f0('0x66')],'outboundUnknownCallsDay':_0x5c2d9a[_0xd6f0('0x67')],'predictiveIntervalAnsweredCalls':_0x5c2d9a[_0xd6f0('0x68')],'predictiveIntervalAvgHoldtime':_0x5c2d9a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5c2d9a[_0xd6f0('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x5c2d9a[_0xd6f0('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x5c2d9a[_0xd6f0('0x6b')],'predictiveIntervalErlangCalls':_0x5c2d9a[_0xd6f0('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x5c2d9a[_0xd6f0('0x6d')],'predictiveIntervalHitRate':_0x5c2d9a[_0xd6f0('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x5c2d9a[_0xd6f0('0x6f')],'predictiveIntervalPauses':_0x5c2d9a[_0xd6f0('0x70')],'predictiveIntervalAvailable':_0x5c2d9a['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5c2d9a[_0xd6f0('0x71')],'message':_0x5c2d9a[_0xd6f0('0x3e')],'originated':_0x5c2d9a['originated'],'erlangCalls':_0x5c2d9a[_0xd6f0('0x72')],'erlangCallToSecond':_0x5c2d9a[_0xd6f0('0x73')],'erlangAbandonmentRate':_0x5c2d9a[_0xd6f0('0x74')],'erlangBusyFactor':_0x5c2d9a[_0xd6f0('0x75')],'startPredictive':_0x5c2d9a['startPredictive'],'startProgressive':_0x5c2d9a[_0xd6f0('0x2b')]};if(_0x5c2d9a[_0xd6f0('0x76')]){_0x2def01['Trunk']={'id':_0x5c2d9a['Trunk']['id'],'name':_0x5c2d9a[_0xd6f0('0x76')]['name'],'active':_0x5c2d9a[_0xd6f0('0x76')][_0xd6f0('0x77')],'callerid':_0x5c2d9a[_0xd6f0('0x76')]['callerid']};}if(_0x5c2d9a[_0xd6f0('0x44')]){_0x2def01[_0xd6f0('0x44')]={'id':_0x5c2d9a[_0xd6f0('0x44')]['id'],'name':_0x5c2d9a[_0xd6f0('0x44')][_0xd6f0('0x40')]};}var _0x4c42ce=md5(JSON[_0xd6f0('0x78')](_0x2def01));if(_0x5c2d9a['md5']!==_0x4c42ce){_0x5c2d9a[_0xd6f0('0x79')]=_0x4c42ce;emit(util[_0xd6f0('0x7a')](_0xd6f0('0x7b'),_0x2def01[_0xd6f0('0x40')]),'voice_queue:save',_0x2def01);}}}function emitCampaignSummary(_0x5ceb6b){if(_0x5ceb6b[_0xd6f0('0x7c')]===_0xd6f0('0x7d')){emit(util['format'](_0xd6f0('0x7e'),_0x5ceb6b['name']),_0xd6f0('0x7f'),_0x5ceb6b);}}function checkGetDataPredictive(_0x3cbbbd){if(isNotNull(_0x3cbbbd)&&!_[_0xd6f0('0x80')](_0x3cbbbd)){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x82'));loggerPredictive['info'](_0xd6f0('0x83'),_0x3cbbbd[_0xd6f0('0x71')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x84'),_0x3cbbbd[_0xd6f0('0x68')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x85'),_0x3cbbbd[_0xd6f0('0x6b')]);loggerPredictive['info'](_0xd6f0('0x86'),_0x3cbbbd[_0xd6f0('0x6a')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x87'),_0x3cbbbd[_0xd6f0('0x88')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x89'),_0x3cbbbd[_0xd6f0('0x69')]);loggerPredictive[_0xd6f0('0x81')]('---------------------------');if(_0x3cbbbd[_0xd6f0('0x71')]>0x0){if(!_['isUndefined'](_0x3cbbbd['predictiveIntervalAvgTalktime'])&&_0x3cbbbd[_0xd6f0('0x69')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xd6f0('0x3d')](_0x3cbbbd[_0xd6f0('0x88')])&&_0x3cbbbd[_0xd6f0('0x88')]>0x0){return!![];}loggerPredictive['info'](_0xd6f0('0x8a'));}else{loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x8b'));}}else{loggerPredictive['info'](_0xd6f0('0x8c'));}return![];}function mergeDataErlangB(_0x357193){return function(_0x498ca5){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x8d'));loggerPredictive['info'](_0xd6f0('0x8e'),_0x498ca5[_0xd6f0('0x72')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x8f'),_0x498ca5[_0xd6f0('0x73')]);loggerPredictive['info'](_0xd6f0('0x90'),_0x498ca5[_0xd6f0('0x74')]);loggerPredictive['info'](_0xd6f0('0x91'),_0x498ca5[_0xd6f0('0x75')]);loggerPredictive[_0xd6f0('0x81')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x498ca5[_0xd6f0('0x74')]);loggerPredictive['info']('---------------------------');_['merge'](_0x357193,_0x498ca5);};}function getDiff(_0x5c5aa4){var _0x311140=moment()[_0xd6f0('0x49')](0x0);var _0x1a8984=moment(_0x5c5aa4)[_0xd6f0('0x49')](0x0);return _0x311140['diff'](_0x1a8984,_0xd6f0('0x92'));}function ifInterval(_0x5a6ee0,_0x13c194){if(_[_0xd6f0('0x3d')](_0x13c194)){return![];}return getDiff(_0x13c194)<_0x5a6ee0*0x3c;}function freeVariablesPredictive(_0x2ba889){if(isNotNull(_0x2ba889)){if(!_['isUndefined'](_0x2ba889[_0xd6f0('0x2b')])){_0x2ba889[_0xd6f0('0x2b')]=undefined;loggerPredictive[_0xd6f0('0x81')](_0x2ba889[_0xd6f0('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xd6f0('0x3d')](_0x2ba889[_0xd6f0('0x93')])){_0x2ba889[_0xd6f0('0x93')]=undefined;loggerPredictive['info'](_0x2ba889[_0xd6f0('0x40')],_0xd6f0('0x94'));}if(!_[_0xd6f0('0x3d')](_0x2ba889[_0xd6f0('0x95')])){clearInterval(_0x2ba889['handlePredictive']);_0x2ba889[_0xd6f0('0x95')]=undefined;loggerPredictive[_0xd6f0('0x81')](_0x2ba889[_0xd6f0('0x40')],_0xd6f0('0x96'));}}}function erlangb(_0x49fc4a,_0x535910){if(_0x535910===0x0){return 0x0;}var _0x490bc4=0x1;for(var _0x5ed780=0x1;_0x5ed780<=_0x535910;_0x5ed780+=0x1){_0x490bc4=0x1+_0x490bc4*_0x5ed780/_0x49fc4a;}return 0x1/_0x490bc4;}function isVoiceQueueOutbound(_0x144a77){return _0x144a77===_0xd6f0('0x4c');}function isNotPreview(_0xa1ff68){return _0xa1ff68!==_0xd6f0('0x22');}function isCampaignIvr(_0x318a64){return _0x318a64===_0xd6f0('0x7d');}function getCallerId(_0x39f937,_0x1b298a,_0x1ce601){if(!_['isUndefined'](_0x1ce601)&&typeof _0x1ce601==='string'&&!_[_0xd6f0('0x80')](_0x1ce601)){if(!_['isUndefined'](_0x1b298a)&&typeof _0x1b298a===_0xd6f0('0x97')&&!_[_0xd6f0('0x80')](_0x1b298a)){return util[_0xd6f0('0x7a')](_0xd6f0('0x98'),_0x1b298a,_0x1ce601);}return util[_0xd6f0('0x7a')](_0xd6f0('0x98'),_0x1ce601,_0x1ce601);}if(!_[_0xd6f0('0x3d')](_0x39f937)&&typeof _0x39f937==='string'&&!_[_0xd6f0('0x80')](_0x39f937)){return _0x39f937;}return _0xd6f0('0x99');}function loggerCatchQueueSummary(_0x40cdae,_0x5b687f){return function(_0x20feae){freeVariablesPredictive(_0x5b687f);emitVoiceQueueSummary(_0x5b687f);emitCampaignSummary(_0x5b687f);loggerSyncQueueSummary[_0xd6f0('0x9a')](_0x40cdae,util['inspect'](_0x20feae,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xad50ac,_0x80f21c){return function(_0x1bf313){loggerPredictive[_0xd6f0('0x9a')](_0x80f21c[_0xd6f0('0x40')],_0xad50ac);loggerPredictive[_0xd6f0('0x9a')](_0x1bf313[_0xd6f0('0x9b')]);freeVariablesPredictive(_0x80f21c);};}function loggerCatch(_0x2efbad){return function(_0x3502ea){logger['error'](_0x2efbad,util[_0xd6f0('0x9c')](_0x3502ea,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x205b6a){return _0x205b6a&&!_[_0xd6f0('0x3d')](_0x205b6a)&&_0x205b6a[_0xd6f0('0x9d')]>0x0;}function decremetOriginate(_0x5f1321){if(!_[_0xd6f0('0x3d')](_0x5f1321)&&_0x5f1321!==null){if(typeof _0x5f1321[_0xd6f0('0x9e')]!==_0xd6f0('0x9f')){if(_0x5f1321[_0xd6f0('0x9e')]>0x0){_0x5f1321[_0xd6f0('0x9e')]-=0x1;}else{logger[_0xd6f0('0x9a')](_0xd6f0('0xa0'));}}}else{logger[_0xd6f0('0x9a')](_0xd6f0('0xa1'));}}function checkContactLowerLimitOriginate(_0x1d8221,_0x5df593,_0x440d5c){if(_0x5df593>_0x440d5c){for(var _0x16c255=0x0;_0x16c255<_0x5df593-_0x440d5c;_0x16c255+=0x1){decremetOriginate(_0x1d8221);}}}function loggerGetContactDialer(_0x1dc77c,_0x580c93,_0x12a37c){return function(_0x2b5411){checkContactLowerLimitOriginate(_0x580c93,_0x12a37c,0x0);logger[_0xd6f0('0x9a')](_0x1dc77c,util[_0xd6f0('0x9c')](_0x2b5411,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f6b18){return function(_0xa41e33){if(isNotNull(_0xa41e33)&&isNotNull(_0xa41e33[0x0])){if(_0xa41e33[0x0][_0xd6f0('0xa2')]>0x0){_0x2f6b18[_0xd6f0('0x3e')]=_0xd6f0('0xa3');logger[_0xd6f0('0x81')](_0xd6f0('0xa4')+_0x2f6b18['name'],_0xa41e33[0x0]['contactsRescheduled'],_0xd6f0('0xa5'));}else{_0x2f6b18[_0xd6f0('0x3e')]=_0xd6f0('0xa6');logger[_0xd6f0('0x81')](_0xd6f0('0xa7')+_0x2f6b18['name']);}}};}function notSendMessagesQueue(_0x15143a){if(_0x15143a[_0xd6f0('0xa8')]){freeVariablesPredictive(_0x15143a);if(_0x15143a['originated']===0x0&&_0x15143a[_0xd6f0('0x54')]===0x0&&_0x15143a['waiting']===0x0&&(_0x15143a[_0xd6f0('0x51')]||0x0)===0x0){_0x15143a[_0xd6f0('0xa8')]=![];_0x15143a[_0xd6f0('0x4f')]=0x0;_0x15143a[_0xd6f0('0x3e')]=_0xd6f0('0x42');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x15143a[_0xd6f0('0x40')],_0xd6f0('0xa9'));}else{_0x15143a['message']=_0xd6f0('0xaa');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x15143a[_0xd6f0('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x15143a);}}function notSendMessagesCampaign(_0x5dc1c7){if(_0x5dc1c7['sendMessageOneNotActive']){if(_0x5dc1c7['originated']===0x0){_0x5dc1c7[_0xd6f0('0xa8')]=![];_0x5dc1c7[_0xd6f0('0x3e')]=_0xd6f0('0x42');loggerSyncQueueSummary[_0xd6f0('0x9a')](_0xd6f0('0xab'),_0x5dc1c7[_0xd6f0('0x40')],_0xd6f0('0xa9'));}else{_0x5dc1c7[_0xd6f0('0x3e')]=_0xd6f0('0xaa');loggerSyncQueueSummary['error'](_0xd6f0('0xab'),_0x5dc1c7['name'],'is\x20disactive');}emitCampaignSummary(_0x5dc1c7);}}function createObjHistory(_0x1309d9,_0x83913c,_0x397f2c,_0x54aea7,_0x12e166){_0x1309d9[_0xd6f0('0x3e')]=_0x397f2c;var _0xc0585c=new Action(_0x1309d9,_0x83913c);var _0xf7ade1=new History(_0xc0585c);_0xf7ade1[_0xd6f0('0xac')]=_0x54aea7;_0xf7ade1[_0xd6f0('0xad')]=_0x12e166;_0xf7ade1[_0xd6f0('0xae')]=_0xc0585c[_0xd6f0('0xaf')];return _0xf7ade1;}Dialer['prototype'][_0xd6f0('0x3c')]=function(){var _0x37a29b=this;setInterval(function(){_0x37a29b['clearZombieChannels'](_0x37a29b[_0xd6f0('0x29')],_0xd6f0('0xb0'));_0x37a29b[_0xd6f0('0xb1')](_0x37a29b[_0xd6f0('0xb2')],_0xd6f0('0xb3'));},0x32c8);};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xb1')]=function(_0x51aa88,_0x2de847){var _0x24c31d=this;for(var _0x5c3659 in _0x51aa88){if(typeof _0x51aa88[_0x5c3659]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0xd6f0('0xb4')](_0x51aa88[_0x5c3659])){return ami[_0xd6f0('0xb5')]({'action':_0xd6f0('0xb6'),'channel':_0x51aa88[_0x5c3659][_0xd6f0('0xb7')]})[_0xd6f0('0xb8')](function(_0x48d87d){if(_0x48d87d['message']===_0xd6f0('0xb9')){setTimeout(function(){if(_0x51aa88[_0x5c3659]&&_0x51aa88[_0x5c3659][_0xd6f0('0x7c')]!==_0xd6f0('0x7d')){_0x24c31d[_0xd6f0('0xba')](_0x24c31d['voiceQueues'][_0x51aa88[_0x5c3659][_0xd6f0('0xbb')]]);logger['error'](_0xd6f0('0xbc'),_0x2de847,_0x5c3659,_0x51aa88[_0x5c3659]['queue']);delete _0x51aa88[_0x5c3659];}if(_0x51aa88[_0x5c3659]&&_0x51aa88[_0x5c3659][_0xd6f0('0x7c')]===_0xd6f0('0x7d')){_0x24c31d['updateOriginated'](_0x24c31d[_0xd6f0('0x24')][_0x51aa88[_0x5c3659][_0xd6f0('0xbb')]]);logger[_0xd6f0('0x9a')](_0xd6f0('0xbd'),_0x2de847,_0x5c3659,_0x51aa88[_0x5c3659][_0xd6f0('0xbb')]);delete _0x51aa88[_0x5c3659];}},0x2328);}});}});}}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xbe')]=function(_0xb9ee3a){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopper[_0xd6f0('0xbe')](_0xb9ee3a))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc1')));};Dialer[_0xd6f0('0x1d')]['checkIsBlackList']=function(_0x119865){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopperBlack[_0xd6f0('0xc2')](_0x119865))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc3')));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xc4')]=function(_0x5d0600){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopperBlack[_0xd6f0('0xc4')](_0x5d0600))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc5')));};Dialer['prototype']['averageHandleTime']=function(_0x2638c3){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopperHistory[_0xd6f0('0xc6')](_0x2638c3))[_0xd6f0('0xb8')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xc7')]=function(_0x2d0d8a){return BPromise[_0xd6f0('0xbf')]()['then'](cmHopper[_0xd6f0('0xc7')](_0x2d0d8a))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc8')));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xc9')]=function(_0x229631,_0x50d310,_0x585495){return BPromise[_0xd6f0('0xbf')]()['then'](cmHopper[_0xd6f0('0xc9')](_0x229631,_0x50d310,_0x585495))['catch'](loggerCatch(_0xd6f0('0xca')));};Dialer[_0xd6f0('0x1d')]['getContactDialer']=function(_0x3bf3b9,_0x5cc944,_0x2cec2b,_0x1756c,_0x65b7c){return BPromise[_0xd6f0('0xbf')]()['then'](cmHopper[_0xd6f0('0xcb')](_0x3bf3b9,_0x5cc944,_0x2cec2b,_0x1756c))[_0xd6f0('0xb8')](function(_0x2f64f1){_0x65b7c['temp']-=_0x2cec2b;_0x65b7c[_0xd6f0('0xcc')]=_0x65b7c[_0xd6f0('0xcc')]>0x0?_0x65b7c[_0xd6f0('0xcc')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x2f64f1);});};Dialer['prototype'][_0xd6f0('0xcd')]=function(_0x22c3fa,_0x42b756,_0x4b113a,_0x40d4b3){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopper[_0xd6f0('0xcd')](_0x22c3fa,_0x42b756,_0x4b113a))[_0xd6f0('0xb8')](function(_0x37ad52){_0x40d4b3[_0xd6f0('0xcc')]-=_0x42b756;_0x40d4b3['temp']=_0x40d4b3[_0xd6f0('0xcc')]>0x0?_0x40d4b3['temp']:0x0;loggerCatch(_0xd6f0('0xce'))(_0x37ad52);});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xcf')]=function(_0x4f5f39){return BPromise[_0xd6f0('0xbf')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x4f5f39))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xd0')));};Dialer[_0xd6f0('0x1d')]['moveContactManagedDialer']=function(_0x446896){return BPromise['resolve']()['then'](cmHopper[_0xd6f0('0xd1')](_0x446896))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xd2')));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xd3')]=function(_0x468cf5){return BPromise['resolve']()[_0xd6f0('0xc0')](cmHopperHistory['createHistory'](_0x468cf5))[_0xd6f0('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xba')]=function(_0x58c187){if(!_[_0xd6f0('0x3d')](_0x58c187)&&_0x58c187!==null){if(typeof _0x58c187[_0xd6f0('0x9e')]!==_0xd6f0('0x9f')){if(_0x58c187[_0xd6f0('0x9e')]>0x0){_0x58c187[_0xd6f0('0x9e')]-=0x1;}else{logger[_0xd6f0('0x9a')](_0xd6f0('0xd4'));}}}else{logger[_0xd6f0('0x9a')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xd5')]=function(_0x529c3d,_0x282736){var _0x527e05=this;return function(_0x1f980f){_0x527e05[_0xd6f0('0xba')](_0x282736);logger[_0xd6f0('0x9a')](_0x529c3d,util[_0xd6f0('0x9c')](_0x1f980f,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x3638b7,_0x16160d,_0xe96c8a){var _0xf5b37a={'state':0x19,'statedesc':_0xd6f0('0xd6')};this[_0xd6f0('0xba')](_0x16160d);this[_0xd6f0('0xd7')](_['merge'](_0xf5b37a,_[_0xd6f0('0xd8')](_0xe96c8a,[_0xd6f0('0xd9'),_0xd6f0('0xda'),_0xd6f0('0xdb'),'VoiceQueueId',_0xd6f0('0xdc')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xd6f0('0x9a')](_0x3638b7);};Dialer['prototype'][_0xd6f0('0xdd')]=function(_0x3e799e){return _0x3e799e===_0xd6f0('0xde');};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xdf')]=function(_0x2c25b4){return!_[_0xd6f0('0x3d')](_0x2c25b4)&&_0x2c25b4&&!_['isUndefined'](_0x2c25b4[_0xd6f0('0x40')])&&!_[_0xd6f0('0x3d')](_0x2c25b4[_0xd6f0('0x77')])&&_0x2c25b4['active']&&(this[_0xd6f0('0x26')][util[_0xd6f0('0x7a')](_0xd6f0('0xe0'),_0x2c25b4[_0xd6f0('0x40')])]['status']===_0xd6f0('0xe1')||this['trunks'][util[_0xd6f0('0x7a')]('SIP/%s',_0x2c25b4[_0xd6f0('0x40')])][_0xd6f0('0xb6')]===_0xd6f0('0xe2'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xd7')]=function(_0xb997e1,_0x238663,_0x49c544){this['createHistory'](_0xb997e1)[_0xd6f0('0xb8')](loggerCatch(_0x238663));this['moveContactManagedDialer'](_0xb997e1)[_0xd6f0('0xb8')](loggerCatch(_0x49c544));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x38')]=function(_0x2bae25){var _0x961e4f=this[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];var _0x83b80a;if(!_[_0xd6f0('0xb4')](_0x2bae25)&&!_[_0xd6f0('0xb4')](_0x2bae25[_0xd6f0('0xe4')])&&!_['isNil'](_0x2bae25[_0xd6f0('0xe4')]['amdstatus'])&&_0x2bae25[_0xd6f0('0xe5')]===_0xd6f0('0xe6')&&_0x961e4f){if(_0x961e4f['type']!==_0xd6f0('0x7d')&&this[_0xd6f0('0x23')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0xe7')]&&_0x2bae25[_0xd6f0('0xe8')]===_0xd6f0('0xe9')){delete this[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this['voiceQueues'][_0x961e4f[_0xd6f0('0xbb')]]);this[_0xd6f0('0x23')][_0x961e4f['queue']][_0xd6f0('0x5f')]+=0x1;this['voiceQueues'][_0x961e4f['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x83b80a=new Hangup(_0x961e4f,_0x2bae25);_0x83b80a[_0xd6f0('0xac')]=0x12;_0x83b80a[_0xd6f0('0xad')]='HangupInAMD';_0x83b80a[_0xd6f0('0xea')]=_0xd6f0('0xeb');ami[_0xd6f0('0x4b')](_0xd6f0('0xec'),ut[_0xd6f0('0xed')](_0x83b80a,_0xd6f0('0xee')));this[_0xd6f0('0xd7')](_0x83b80a,_0xd6f0('0xef'),'[syncHangupInAMD]');}if(_0x961e4f[_0xd6f0('0x7c')]!==_0xd6f0('0x7d')&&this['voiceQueues'][_0x961e4f[_0xd6f0('0xbb')]]['dialAMDActive']&&_0x2bae25[_0xd6f0('0xe8')]===_0xd6f0('0xf0')){var _0xa3546a=this;return new BPromise(function(_0x405d56,_0x5a7129){delete _0xa3546a[_0xd6f0('0x29')][_0x2bae25['uniqueid']];_0xa3546a['updateOriginated'](_0xa3546a[_0xd6f0('0x23')][_0x961e4f[_0xd6f0('0xbb')]]);_0xa3546a[_0xd6f0('0x23')][_0x961e4f['queue']][_0xd6f0('0x5f')]+=0x1;_0xa3546a[_0xd6f0('0x23')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0x5e')]+=0x1;var _0x259b01=_0xa3546a['voiceQueues'][_0x961e4f[_0xd6f0('0xbb')]];var _0x265fd4=new Hangup(_0x961e4f,_0x2bae25);_0x265fd4['state']=0x13;_0x265fd4[_0xd6f0('0xad')]='Machine';_0x265fd4[_0xd6f0('0xea')]=_0xd6f0('0xeb');_0x265fd4[_0xd6f0('0xf1')]+=0x1;_0x265fd4[_0xd6f0('0xf2')]+=0x1;_0x265fd4[_0xd6f0('0xee')]=!![];ami[_0xd6f0('0x4b')](_0xd6f0('0xec'),ut['buildObj'](_0x265fd4,'amd'));_0xa3546a[_0xd6f0('0xd3')](_0x265fd4)['catch'](loggerCatch(_0xd6f0('0xf3')));if(_0x265fd4[_0xd6f0('0xf4')]+_0x265fd4[_0xd6f0('0xf5')]+_0x265fd4['countnoanswerretry']+_0x265fd4[_0xd6f0('0xf6')]+_0x265fd4['countdropretry']+_0x265fd4[_0xd6f0('0xf7')]+_0x265fd4[_0xd6f0('0xf1')]+_0x265fd4['countagentrejectretry']>=_0x259b01[_0xd6f0('0xf8')]){_0xa3546a[_0xd6f0('0xf9')](_0x265fd4,_0x405d56,_0x5a7129,'reason19\x20machine....');}else{if(_0x265fd4['countmachineretry']>=_0x259b01['dialMachineMaxRetry']){_0xa3546a[_0xd6f0('0xfa')](_0x265fd4,_0x405d56,_0x5a7129,_0xd6f0('0xfb'));}else{_0xa3546a[_0xd6f0('0xc7')]({'active':![],'countmachineretry':_0x265fd4[_0xd6f0('0xf1')],'scheduledat':moment()[_0xd6f0('0xfc')](_0x259b01['dialMachineRetryFrequency'],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x265fd4[_0xd6f0('0xd9')],'ListId':_0x265fd4[_0xd6f0('0xda')],'VoiceQueueId':_0x265fd4[_0xd6f0('0xff')]||undefined,'CampaignId':_0x265fd4[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x100')));_0x405d56({'reschedule':0x1});}}});}if(_0x961e4f[_0xd6f0('0x7c')]===_0xd6f0('0x7d')&&this[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0xe7')]&&_0x2bae25['value']==='HANGUP'){delete this[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];this['updateOriginated'](this[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]]);_0x83b80a=new Hangup(_0x961e4f,_0x2bae25);_0x83b80a[_0xd6f0('0xac')]=0x12;_0x83b80a[_0xd6f0('0xad')]=_0xd6f0('0x101');_0x83b80a[_0xd6f0('0xea')]=_0xd6f0('0xeb');ami['emit'](_0xd6f0('0xec'),ut[_0xd6f0('0xed')](_0x83b80a,_0xd6f0('0xee')));this[_0xd6f0('0xd7')](_0x83b80a,'[syncHangupInAMDIvr][createHistory]',_0xd6f0('0x102'));}if(_0x961e4f[_0xd6f0('0x7c')]===_0xd6f0('0x7d')&&this['campaigns'][_0x961e4f[_0xd6f0('0xbb')]]['dialAMDActive']&&_0x2bae25[_0xd6f0('0xe8')]===_0xd6f0('0xf0')){var _0xa3546a=this;return new BPromise(function(_0x2aa249,_0x356b9b){delete _0xa3546a[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];_0xa3546a[_0xd6f0('0xba')](_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]]);_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0x5f')]+=0x1;_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0x5e')]+=0x1;var _0x482248=_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]];var _0x31d723=new Hangup(_0x961e4f,_0x2bae25);_0x31d723[_0xd6f0('0xac')]=0x13;_0x31d723['statedesc']=_0xd6f0('0x103');_0x31d723['membername']='AMD';_0x31d723[_0xd6f0('0xf1')]+=0x1;_0x31d723['countglobal']+=0x1;_0x31d723[_0xd6f0('0xee')]=!![];ami[_0xd6f0('0x4b')](_0xd6f0('0xec'),ut['buildObj'](_0x31d723,_0xd6f0('0xee')));_0xa3546a['createHistory'](_0x31d723)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xf3')));if(_0x31d723[_0xd6f0('0xf4')]+_0x31d723['countcongestionretry']+_0x31d723[_0xd6f0('0x104')]+_0x31d723[_0xd6f0('0xf6')]+_0x31d723[_0xd6f0('0x105')]+_0x31d723[_0xd6f0('0xf7')]+_0x31d723[_0xd6f0('0xf1')]+_0x31d723[_0xd6f0('0x106')]>=_0x482248['dialGlobalMaxRetry']){_0xa3546a[_0xd6f0('0xf9')](_0x31d723,_0x2aa249,_0x356b9b,_0xd6f0('0x107'));}else{if(_0x31d723[_0xd6f0('0xf1')]>=_0x482248[_0xd6f0('0x108')]){_0xa3546a['createStateFinal'](_0x31d723,_0x2aa249,_0x356b9b,_0xd6f0('0xfb'));}else{_0xa3546a['rescheduleContact']({'active':![],'countmachineretry':_0x31d723[_0xd6f0('0xf1')],'scheduledat':moment()['add'](_0x482248['dialMachineRetryFrequency'],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x31d723['ContactId'],'ListId':_0x31d723[_0xd6f0('0xda')],'VoiceQueueId':_0x31d723['VoiceQueueId']||undefined,'CampaignId':_0x31d723[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x100')));_0x2aa249({'reschedule':0x1});}}});}}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x34')]=function(_0x33a5c9){var _0x3cdcf1=this[_0xd6f0('0x29')][_0x33a5c9[_0xd6f0('0xe3')]];var _0x148bf3=this;var _0x26a9ef;if(_0x3cdcf1&&_0x3cdcf1[_0xd6f0('0x7c')]==='ivr'){delete this['uniqueId'][_0x33a5c9[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this[_0xd6f0('0x24')][_0x3cdcf1[_0xd6f0('0xbb')]]);this['campaigns'][_0x3cdcf1[_0xd6f0('0xbb')]]['ivrAnswerCallsDay']+=0x1;_0x26a9ef=new Hangup(_0x3cdcf1,_0x33a5c9);this[_0xd6f0('0xd3')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x109')));this[_0xd6f0('0xd1')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0x3cdcf1&&_0x3cdcf1[_0xd6f0('0x7c')]!==_0xd6f0('0x7d')&&isNotNull(this['voiceQueues'][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x10a')])){delete this[_0xd6f0('0x29')][_0x33a5c9[_0xd6f0('0xe3')]];this['updateOriginated'](this['voiceQueues'][_0x3cdcf1[_0xd6f0('0xbb')]]);this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x5f')]+=0x1;this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x5e')]+=0x1;_0x26a9ef=new Hangup(_0x3cdcf1,_0x33a5c9);_0x26a9ef[_0xd6f0('0xac')]=0x10;_0x26a9ef['statedesc']=_0xd6f0('0x10b');_0x26a9ef[_0xd6f0('0xea')]=_0xd6f0('0x10c');this[_0xd6f0('0xd3')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x109')));this[_0xd6f0('0xd1')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x10d')));}if(_0x3cdcf1&&_0x3cdcf1[_0xd6f0('0x7c')]!==_0xd6f0('0x7d')&&!isNotNull(this['voiceQueues'][_0x3cdcf1['queue']][_0xd6f0('0x10a')])){delete this['uniqueId'][_0x33a5c9[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]]);this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x67')]+=0x1;_0x26a9ef=new Hangup(_0x3cdcf1,_0x33a5c9);_0x26a9ef['state']=0xc;_0x26a9ef[_0xd6f0('0xad')]=_0x33a5c9[_0xd6f0('0x10e')];_0x26a9ef[_0xd6f0('0xea')]='Unknow';this['createHistory'](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x109')));this[_0xd6f0('0xd1')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x10f')]=function(_0x5a4203){var _0x2b98f4=this[_0xd6f0('0x29')][_0x5a4203[_0xd6f0('0xe3')]];var _0xb2bce6=this;if(this['voiceQueues'][_0x5a4203[_0xd6f0('0xbb')]]){if(_0x2b98f4&&_0x2b98f4[_0xd6f0('0x7c')]!=='ivr'){delete this['uniqueId'][_0x5a4203[_0xd6f0('0xe3')]];this[_0xd6f0('0x23')][_0x5a4203[_0xd6f0('0xbb')]][_0xd6f0('0x5f')]+=0x1;var _0x1acefc=new AgentComplete(_0x2b98f4,_0x5a4203);if(_0x5a4203[_0xd6f0('0x110')]===_0xd6f0('0x111')){_0x1acefc[_0xd6f0('0x112')]=this[_0xd6f0('0x23')][_0x5a4203[_0xd6f0('0xbb')]]['dialQueueProject2']&&this[_0xd6f0('0x23')][_0x5a4203[_0xd6f0('0xbb')]][_0xd6f0('0x113')]?moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe')):undefined;}this[_0xd6f0('0xd3')](_0x1acefc)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xd6f0('0xd1')](_0x1acefc)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x114')));}}};Dialer[_0xd6f0('0x1d')]['syncAgentConnect']=function(_0x477673){if(this[_0xd6f0('0x23')][_0x477673[_0xd6f0('0xbb')]]){if(this[_0xd6f0('0x29')][_0x477673[_0xd6f0('0xe3')]]&&this['uniqueId'][_0x477673[_0xd6f0('0xe3')]][_0xd6f0('0x7c')]!=='ivr'){this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][_0x477673['queue']]);this[_0xd6f0('0x29')][_0x477673[_0xd6f0('0xe3')]][_0xd6f0('0x115')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));}}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x116')]=function(_0x3c1e84){this[_0xd6f0('0xd3')](_0x3c1e84)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x117')));this['moveContactManagedDialer'](_0x3c1e84)[_0xd6f0('0xb8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x30')]=function(_0x336cba){var _0x585084=this[_0xd6f0('0x29')][_0x336cba[_0xd6f0('0xe3')]];var _0x3ddd4b=this;if(this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]]){if(_0x585084&&_0x585084['type']!=='ivr'){delete this[_0xd6f0('0x29')][_0x336cba[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]]);_0x585084[_0xd6f0('0x118')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));var _0x4a5407=new QueueCallerAbandon(_0x585084,_0x336cba);if(getSeconds(_0x585084['droptime'],_0x585084['responsetime'])>=_0x585084[_0xd6f0('0x119')]){this['voiceQueues'][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x6b')]+=0x1;this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x11a')]+=0x1;this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x6d')]+=0x1;_0x4a5407[_0xd6f0('0xac')]=0xa;_0x4a5407[_0xd6f0('0xad')]='Drop';_0x4a5407[_0xd6f0('0x11b')]='TIMEOUT';_0x4a5407[_0xd6f0('0x112')]=this[_0xd6f0('0x23')][_0x336cba['queue']][_0xd6f0('0x11c')]?moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe')):undefined;_0x4a5407[_0xd6f0('0x105')]+=0x1;_0x4a5407[_0xd6f0('0xf2')]+=0x1;if(_0x4a5407['countdropretry']>=this['voiceQueues'][_0x336cba['queue']]['dialDropMaxRetry']){this[_0xd6f0('0x116')](_0x4a5407);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x4a5407[_0xd6f0('0x105')],'scheduledat':moment()[_0xd6f0('0xfc')](this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x11d')],_0xd6f0('0xfd'))['format'](_0xd6f0('0xfe')),'ContactId':_0x585084[_0xd6f0('0xd9')],'ListId':_0x585084[_0xd6f0('0xda')],'VoiceQueueId':_0x585084[_0xd6f0('0xff')]||undefined,'CampaignId':_0x585084[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch('[rescheduleContact][Drop]'));var _0x1520cc=new History(_0x4a5407);_0x1520cc[_0xd6f0('0xac')]=0xa;_0x1520cc[_0xd6f0('0xad')]='Drop';_0x1520cc[_0xd6f0('0xaf')]=moment()[_0xd6f0('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1520cc[_0xd6f0('0xae')]=_0x1520cc[_0xd6f0('0xaf')];_0x1520cc[_0xd6f0('0x11e')]=_0x4a5407['calleridname'];_0x1520cc[_0xd6f0('0x11f')]=_0x4a5407[_0xd6f0('0x11f')];this[_0xd6f0('0xd3')](_0x1520cc)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x120')));}}else{this['voiceQueues'][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x6a')]+=0x1;this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x62')]+=0x1;_0x4a5407[_0xd6f0('0xac')]=0xb;_0x4a5407[_0xd6f0('0xad')]=_0xd6f0('0x121');_0x4a5407[_0xd6f0('0x11b')]=_0xd6f0('0x122');_0x4a5407[_0xd6f0('0xf7')]+=0x1;_0x4a5407['countglobal']+=0x1;if(_0x4a5407[_0xd6f0('0xf7')]>=this[_0xd6f0('0x23')][_0x336cba['queue']][_0xd6f0('0x123')]){this['queueCallerAbandonCreateState'](_0x4a5407);}else{this[_0xd6f0('0xc7')]({'active':![],'countabandonedretry':_0x4a5407[_0xd6f0('0xf7')],'scheduledat':moment()['add'](this[_0xd6f0('0x23')][_0x336cba['queue']][_0xd6f0('0x124')],'minutes')[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x585084['ContactId'],'ListId':_0x585084['ListId'],'VoiceQueueId':_0x585084[_0xd6f0('0xff')]||undefined,'CampaignId':_0x585084[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x1520cc=new History(_0x4a5407);_0x1520cc[_0xd6f0('0xac')]=0xb;_0x1520cc[_0xd6f0('0xad')]=_0xd6f0('0x121');_0x1520cc[_0xd6f0('0xaf')]=moment()['format'](_0xd6f0('0xfe'));_0x1520cc[_0xd6f0('0xae')]=_0x1520cc[_0xd6f0('0xaf')];_0x1520cc[_0xd6f0('0x11e')]=_0x4a5407[_0xd6f0('0x11e')];_0x1520cc[_0xd6f0('0x11f')]=_0x4a5407[_0xd6f0('0x11f')];this['createHistory'](_0x1520cc)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x125')));}}}}};Dialer['prototype'][_0xd6f0('0x36')]=function(_0x47126a){if(this['actions'][_0x47126a[_0xd6f0('0xe3')]]){this[_0xd6f0('0xb2')][_0x47126a[_0xd6f0('0xe3')]][_0xd6f0('0xb7')]=_0x47126a[_0xd6f0('0xb7')];}if(this[_0xd6f0('0x29')][_0x47126a[_0xd6f0('0xe3')]]){this[_0xd6f0('0x29')][_0x47126a['uniqueid']][_0xd6f0('0xb7')]=_0x47126a[_0xd6f0('0xb7')];}};Dialer['prototype'][_0xd6f0('0x39')]=function(_0x48f192){if(strategy[this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x4d')]]===_0xd6f0('0x127')){if(this[_0xd6f0('0xb2')][_0x48f192['actionid']]&&_[_0xd6f0('0xb4')](this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0x128')])&&_0x48f192[_0xd6f0('0xb6')]==='1'&&_0x48f192['paused']==='0'){if(this[_0xd6f0('0x25')][_0x48f192['stateinterface']]){if(!this[_0xd6f0('0x25')][_0x48f192['stateinterface']][_0xd6f0('0x128')]){this[_0xd6f0('0x25')][_0x48f192['stateinterface']][_0xd6f0('0x128')]=!![];this['actions'][_0x48f192['actionid']][_0xd6f0('0x128')]=!![];this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0x129')]=_0x48f192[_0xd6f0('0x129')];}}}}else if((strategy[this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x4d')]]||_0xd6f0('0x1c'))===_0xd6f0('0x1c')){if(this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]]){if(this[_0xd6f0('0x25')][_0x48f192['stateinterface']]){this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]]['stateinterface']=_0x48f192[_0xd6f0('0x129')];if(_[_0xd6f0('0xb4')](this[_0xd6f0('0x12a')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]])){this[_0xd6f0('0x12a')][this['actions'][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]=[];}this[_0xd6f0('0x12a')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]]['queue']][_0xd6f0('0x12b')](_[_0xd6f0('0x12c')](_[_0xd6f0('0xd8')](this['actions'][_0x48f192[_0xd6f0('0x126')]],[_0xd6f0('0x12d'),_0xd6f0('0x129')]),{'status':_0x48f192[_0xd6f0('0xb6')],'paused':_0x48f192['paused']}));}}}};function unlockQueueStatus(_0xc2bf9d,_0x3a76c6){setTimeout(function(){if(_[_0xd6f0('0x3d')](_0xc2bf9d[_0xd6f0('0x12e')])){loggerBooked[_0xd6f0('0x9a')](_0xd6f0('0x12f'),_0x3a76c6);}_0xc2bf9d[_0xd6f0('0x12e')]=!![];loggerBooked[_0xd6f0('0x81')](_0xd6f0('0x130'),_0x3a76c6,JSON[_0xd6f0('0x78')](_['pick'](_0xc2bf9d,['name',_0xd6f0('0x12e')])));},0x1f3);}Dialer[_0xd6f0('0x1d')][_0xd6f0('0x3a')]=function(_0x3f0b23){var _0x422cd8=this;var _0x40bbd9=_0x422cd8[_0xd6f0('0x23')][_0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]];if(strategy[this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x4d')]]==='roundrobin'){if(this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]&&this['actions'][_0x3f0b23[_0xd6f0('0x126')]]['stateinterface']){this[_0xd6f0('0x22')][_0xd6f0('0x131')](this[_0xd6f0('0xb2')][_0x3f0b23['actionid']][_0xd6f0('0x12d')],this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0x129')])['catch'](function(_0x227a3f){logger[_0xd6f0('0x9a')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xd6f0('0x9c')](_0x227a3f,{'showHidden':![],'depth':null}));})[_0xd6f0('0x20')](function(){_0x422cd8[_0xd6f0('0xba')](_0x422cd8[_0xd6f0('0x23')][_0x422cd8['actions'][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]);_0x422cd8['agents'][_0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]['stateinterface']][_0xd6f0('0x128')]=![];delete _0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]];unlockQueueStatus(_0x40bbd9);});}else{this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]);this[_0xd6f0('0xc7')]({'active':![],'ContactId':this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]['ContactId'],'ListId':this[_0xd6f0('0xb2')][_0x3f0b23['actionid']][_0xd6f0('0xda')],'VoiceQueueId':this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xff')]||undefined,'CampaignId':this['actions'][_0x3f0b23['actionid']][_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x132')));delete this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]];unlockQueueStatus(_0x40bbd9);}}else if((strategy[this['voiceQueues'][this['actions'][_0x3f0b23[_0xd6f0('0x126')]]['queue']][_0xd6f0('0x4d')]]||_0xd6f0('0x1c'))===_0xd6f0('0x1c')){var _0x202805;if(this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]&&!_['isEmpty'](this[_0xd6f0('0x12a')][this[_0xd6f0('0xb2')][_0x3f0b23['actionid']][_0xd6f0('0xbb')]])){if(this[_0xd6f0('0x2d')][_0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]){this['queueBookedRR'][_0x422cd8['actions'][_0x3f0b23[_0xd6f0('0x126')]]['queue']]=this[_0xd6f0('0x2d')][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]['queue']]?this['queueBookedRR'][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]:this[_0xd6f0('0x12a')][this['actions'][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]?this['queueBooked'][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x133')]||0x0:0x0;}this[_0xd6f0('0x12a')][this['actions'][_0x3f0b23['actionid']][_0xd6f0('0xbb')]][_0xd6f0('0x133')]=this['queueBookedRR'][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]];for(var _0x2de951=0x0;_0x2de951=0x0;})[_0xd6f0('0xb8')](myreject(_0x31f41a)));}}else{_0x7d5ab4[_0xd6f0('0x12b')](ami[_0xd6f0('0xb5')]({'action':'command','command':util[_0xd6f0('0x7a')](_0xd6f0('0x14e'),_0x323e20,!_[_0xd6f0('0x3d')](config[_0xd6f0('0x149')][_0x5350a4])?_0x5350a4:'')})['then'](function(_0x1f3b5c){return _0x1f3b5c['content'][_0xd6f0('0x151')]('true')>=0x0;})[_0xd6f0('0xb8')](myreject(_0x31f41a)));}BPromise[_0xd6f0('0x153')](_0x7d5ab4)[_0xd6f0('0xc0')](function(_0xdade07){var _0x50b6a7=_[_0xd6f0('0x154')](_0xdade07);if(_0x50b6a7){return _0x131008(_0x50b6a7);}else{_0x104ce5['message']=_0x44dca4?_0xd6f0('0x155'):_0xd6f0('0x156');return _0x31f41a(msgResponse('[ifTime][promiseAll]',_0xd6f0('0x147'),_0xd6f0('0x157')+_0x44dca4+'\x20'+_0x17ab54+_0xd6f0('0x158')+util[_0xd6f0('0x9c')](_0x323e20,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5350a4));}})[_0xd6f0('0xb8')](function(_0x2e9d29){return _0x31f41a(msgResponse('ifTime',_0xd6f0('0x147'),JSON[_0xd6f0('0x78')](_0x2e9d29)));});});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x159')]=function(_0x143f66){var _0x194cbd=this;return function(){switch(_0x143f66['dialMethod']){case _0xd6f0('0x15a'):freeVariablesPredictive(_0x143f66);_0x194cbd[_0xd6f0('0x15b')](_0x143f66,0x1);break;case _0xd6f0('0x15c'):freeVariablesPredictive(_0x143f66);_0x194cbd[_0xd6f0('0x15b')](_0x143f66,_0x143f66[_0xd6f0('0x15d')]);break;case _0xd6f0('0xa'):_0x194cbd[_0xd6f0('0xa')](_0x143f66);break;case _0xd6f0('0x9'):freeVariablesPredictive(_0x143f66);_0x194cbd[_0xd6f0('0x15b')](_0x143f66,0x1);break;default:freeVariablesPredictive(_0x143f66);logger[_0xd6f0('0x9a')](_0xd6f0('0x15e'),_0x143f66[_0xd6f0('0x40')],_0xd6f0('0x15f'));}};};Dialer[_0xd6f0('0x1d')]['launchHandleIvr']=function(_0x1e2489){var _0x518b14=this;return function(){_0x518b14['handleIvr'](_0x1e2489);};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x160')]=function(_0x1d004a){var _0x5ae610=this;if(isNotPreview(_0x1d004a[_0xd6f0('0x161')])){if(isVoiceQueueOutbound(_0x1d004a[_0xd6f0('0x7c')])&&isActive(_0x1d004a[_0xd6f0('0x5a')])){_0x1d004a['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xd6f0('0xc0')](checkIsLoggedIn(_0x1d004a,_0x1d004a[_0xd6f0('0x50')]))[_0xd6f0('0xc0')](checkIsActive(_0x1d004a,_0x1d004a['dialActive']))[_0xd6f0('0xc0')](checkInterval(_0x1d004a))[_0xd6f0('0xc0')](_0x5ae610['checkIsTrunkReachable'](_0x1d004a))['then'](_0x5ae610[_0xd6f0('0x143')](_0x1d004a[_0xd6f0('0x162')],_0x1d004a['dialTimezone'],_0x1d004a[_0xd6f0('0x40')],_0x1d004a))['then'](_0x5ae610[_0xd6f0('0x163')](_0x1d004a['Interval'],_0x1d004a[_0xd6f0('0x164')],_0x1d004a[_0xd6f0('0x40')],_0x1d004a))[_0xd6f0('0xc0')](_0x5ae610[_0xd6f0('0x159')](_0x1d004a))[_0xd6f0('0xb8')](loggerCatchQueueSummary(_0xd6f0('0x165'),_0x1d004a));}else{notSendMessagesQueue(_0x1d004a);}}else{freeVariablesPredictive(_0x1d004a);}};Dialer['prototype'][_0xd6f0('0x13e')]=function(){var _0x60191a=this;var _0x25d74b;for(var _0x920a62 in this[_0xd6f0('0x24')]){if(typeof this[_0xd6f0('0x24')][_0x920a62]!==_0xd6f0('0x9f')){_0x25d74b=this[_0xd6f0('0x24')][_0x920a62];if(isCampaignIvr(_0x25d74b[_0xd6f0('0x7c')])&&isActive(_0x25d74b[_0xd6f0('0x77')])){_0x25d74b[_0xd6f0('0xa8')]=!![];BPromise['resolve']()[_0xd6f0('0xc0')](checkIsActive(_0x25d74b,_0x25d74b[_0xd6f0('0x77')]))[_0xd6f0('0xc0')](checkInterval(_0x25d74b))[_0xd6f0('0xc0')](_0x60191a[_0xd6f0('0x13f')](_0x25d74b))[_0xd6f0('0xc0')](_0x60191a[_0xd6f0('0x143')](_0x25d74b['dialGlobalInterval'],_0x25d74b[_0xd6f0('0x164')],_0x25d74b['name'],_0x25d74b))[_0xd6f0('0xc0')](_0x60191a[_0xd6f0('0x163')](_0x25d74b[_0xd6f0('0x44')],_0x25d74b['dialTimezone'],_0x25d74b['name'],_0x25d74b))['then'](_0x60191a[_0xd6f0('0x166')](_0x25d74b))[_0xd6f0('0xb8')](loggerCatchQueueSummary(_0xd6f0('0x167'),_0x25d74b));}else{notSendMessagesCampaign(_0x25d74b);}}}};function getCallerIdRandom(_0x27eba0,_0x4ace28){var _0x15d8b1;var _0x1cd834;var _0x5840cd;if(_0x4ace28<=0x0){_0x4ace28=0x1;}_0x15d8b1=new RegExp(_0xd6f0('0x168')+_0x4ace28+'}$');_0x1cd834=Math[_0xd6f0('0x169')](0xa,_0x4ace28-0x1);_0x5840cd=Math[_0xd6f0('0x169')](0xa,_0x4ace28)-0x1;return util[_0xd6f0('0x7a')]('%s',_['replace'](_0x27eba0,_0x15d8b1,_[_0xd6f0('0x16a')](_0x1cd834,_0x5840cd)));}function extractCalleridName(_0x369dcf){var _0x16533b=_0x369dcf[_0xd6f0('0x16b')](/"(.*?)"/);return _0x16533b?_0x16533b[0x1]:_0x369dcf;}function extractCalleridNumber(_0x1ac07c){var _0x4e7cb4=_0x1ac07c[_0xd6f0('0x16b')](/<(.*?)>/);return _0x4e7cb4?_0x4e7cb4[0x1]:_0x1ac07c;}Dialer[_0xd6f0('0x1d')][_0xd6f0('0x16c')]=function(_0x439aca,_0x18085f){var _0x31c40c=this;var _0x945e09=uuid['v4']();this[_0xd6f0('0xb2')][_0x945e09]=new Action(_0x439aca,_0x18085f,_0x945e09);return new BPromise(function(_0x1ee291,_0x100b4d){if(_[_0xd6f0('0x3d')](_0x439aca)&&typeof _0x439aca!==_0xd6f0('0x16d')){return _0x100b4d(msgResponse(_0xd6f0('0x16e'),_0xd6f0('0x147'),'voiceQueue\x20is\x20undefine'));}if(_[_0xd6f0('0x3d')](_0x18085f[_0xd6f0('0x16f')][_0xd6f0('0x170')])||_0x18085f[_0xd6f0('0x16f')]['phone']===null){return _0x100b4d(msgResponse(_0xd6f0('0x16e'),_0xd6f0('0x147'),_0xd6f0('0x171')));}var _0x33c9a8={'XMD-CALLERID':_0x31c40c[_0xd6f0('0xb2')][_0x945e09][_0xd6f0('0x172')](),'XMD-AGI':_0x439aca[_0xd6f0('0x10a')]?util[_0xd6f0('0x7a')](_0xd6f0('0x173'),ipAgi,_0x439aca['dialQueueProject']):_0xd6f0('0x174'),'XMD-AGIAFTER':_0x439aca[_0xd6f0('0x11c')]?util['format'](_0xd6f0('0x173'),ipAgi,_0x439aca[_0xd6f0('0x11c')]):'NONE','XMD-QUEUE':_0x439aca[_0xd6f0('0x7c')]===_0xd6f0('0x4c')?util['format'](_0xd6f0('0x175'),_0x439aca['name'],_0x439aca[_0xd6f0('0x176')]||'',_0x439aca[_0xd6f0('0x113')]?'c':'',_0x439aca[_0xd6f0('0x119')]||0x3):'NONE','XMD-CONTACTID':_0x18085f[_0xd6f0('0xd9')],'XMD-CDRTYPE':_0xd6f0('0x8'),'CALLERID(all)':_0x31c40c[_0xd6f0('0xb2')][_0x945e09][_0xd6f0('0x172')](),'XMD-AMD':_0x439aca[_0xd6f0('0xe7')]?_0xd6f0('0x177'):_0xd6f0('0x174'),'XMD-DESTINATION':_0xd6f0('0xe6')};if(_0x439aca['dialAMDActive']){_0x33c9a8[_0xd6f0('0x178')]=_0x439aca[_0xd6f0('0x179')]||0x9c4;_0x33c9a8['XMD-AMDGREETING']=_0x439aca[_0xd6f0('0x17a')]||0x5dc;_0x33c9a8[_0xd6f0('0x17b')]=_0x439aca[_0xd6f0('0x17c')]||0x320;_0x33c9a8[_0xd6f0('0x17d')]=_0x439aca[_0xd6f0('0x17e')]||0x1388;_0x33c9a8[_0xd6f0('0x17f')]=_0x439aca[_0xd6f0('0x180')]||0x64;_0x33c9a8[_0xd6f0('0x181')]=_0x439aca[_0xd6f0('0x182')]||0x32;_0x33c9a8[_0xd6f0('0x183')]=_0x439aca[_0xd6f0('0x184')]||0x3;_0x33c9a8[_0xd6f0('0x185')]=_0x439aca['dialAMDSilenceThreshold']||0x100;_0x33c9a8[_0xd6f0('0x186')]=_0x439aca['dialAMDMaximumWordLength']||0x1388;}if(_0x439aca[_0xd6f0('0x7c')]===_0xd6f0('0x4c')){_0x33c9a8[_0xd6f0('0x187')]=_0x18085f[_0xd6f0('0xff')];}else{_0x33c9a8[_0xd6f0('0x188')]=_0x18085f['CampaignId'];}for(var _0x52ce04 in _0x18085f[_0xd6f0('0x16f')]){if(typeof _0x18085f[_0xd6f0('0x16f')][_0x52ce04]!==_0xd6f0('0x9f')){if(isNotNull(_0x18085f[_0xd6f0('0x16f')][_0x52ce04])&&_0x52ce04!=='id'&&_0x52ce04!==_0xd6f0('0x189')&&_0x52ce04!=='createdAt'&&_0x52ce04!==_0xd6f0('0x18a')){_0x33c9a8[util[_0xd6f0('0x7a')](_0xd6f0('0x18b'),'XMD-',_[_0xd6f0('0x18c')](_0x52ce04))]=_0x18085f[_0xd6f0('0x16f')][_0x52ce04];}}}var _0x455f9c=_0x31c40c[_0xd6f0('0xdf')](_0x439aca[_0xd6f0('0x76')])?getCallerId(_0x439aca[_0xd6f0('0x76')]['callerid'],_0x439aca['dialOriginateCallerIdName'],_0x439aca[_0xd6f0('0x18d')]>0x0?getCallerIdRandom(_0x439aca[_0xd6f0('0x5c')],_0x439aca['dialRandomLastDigitCallerIdNumber']):_0x439aca['dialOriginateCallerIdNumber']):getCallerId(_[_0xd6f0('0xb4')](_0x439aca[_0xd6f0('0x140')])?_0x439aca[_0xd6f0('0x76')]['callerid']:_0x439aca[_0xd6f0('0x140')]['callerid'],_0x439aca[_0xd6f0('0x5b')],_0x439aca['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x439aca['dialOriginateCallerIdNumber'],_0x439aca[_0xd6f0('0x18d')]):_0x439aca['dialOriginateCallerIdNumber']);if(_0x455f9c){_0x33c9a8[_0xd6f0('0x18e')]=_0x31c40c[_0xd6f0('0xb2')][_0x945e09][_0xd6f0('0x18f')]=extractCalleridName(_0x455f9c);_0x33c9a8[_0xd6f0('0x190')]=_0x31c40c[_0xd6f0('0xb2')][_0x945e09]['originatecalleridnum']=extractCalleridNumber(_0x455f9c);}return ami['Action']({'actionid':_0x945e09,'action':_0xd6f0('0x16e'),'channel':_0x31c40c[_0xd6f0('0xdf')](_0x439aca[_0xd6f0('0x76')])?util[_0xd6f0('0x7a')]('SIP/%s/%s%s',_0x439aca[_0xd6f0('0x76')]['name'],isNotNull(_0x439aca['dialPrefix'])?_0x439aca[_0xd6f0('0x191')][_0xd6f0('0x192')]()||'':'',_0x439aca[_0xd6f0('0x193')]>0x0?_0x18085f[_0xd6f0('0x16f')]['phone'][_0xd6f0('0x194')](_0x439aca[_0xd6f0('0x193')]):_0x18085f[_0xd6f0('0x16f')][_0xd6f0('0x170')]):util['format'](_0xd6f0('0x195'),_['isNil'](_0x439aca[_0xd6f0('0x140')])?_0x439aca['Trunk']['name']:_0x439aca[_0xd6f0('0x140')][_0xd6f0('0x40')],isNotNull(_0x439aca['dialPrefix'])?_0x439aca[_0xd6f0('0x191')]['trim']()||'':'',_0x439aca['dialCutDigit']>0x0?_0x18085f['Contact']['phone'][_0xd6f0('0x194')](_0x439aca[_0xd6f0('0x193')]):_0x18085f[_0xd6f0('0x16f')][_0xd6f0('0x170')]),'callerid':_0x455f9c,'Exten':_0xd6f0('0xe6'),'Context':_0xd6f0('0x196'),'Priority':'1','variable':_0x33c9a8,'timeout':(_0x439aca[_0xd6f0('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x945e09})[_0xd6f0('0xc0')](function(_0x58b12b){return _0x1ee291(_0x58b12b);})['catch'](function(_0x5af027){_0x439aca['outboundOriginateFailureCallsDay']+=0x1;var _0x58a848=new History(_0x31c40c[_0xd6f0('0xb2')][_0x945e09]);logger[_0xd6f0('0x9a')](util[_0xd6f0('0x7a')]('[originateError]:\x20%s',JSON[_0xd6f0('0x78')](_0x5af027)));_0x58a848[_0xd6f0('0xac')]=0xe;_0x58a848[_0xd6f0('0xad')]='OriginateError';_0x58a848[_0xd6f0('0xaf')]=moment()[_0xd6f0('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x58a848[_0xd6f0('0xae')]=_0x58a848['starttime'];_0x31c40c[_0xd6f0('0xd3')](_0x58a848)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x197')));_0x31c40c[_0xd6f0('0xd1')](_0x58a848)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x197')))[_0xd6f0('0x20')](function(){delete _0x31c40c[_0xd6f0('0xb2')][_0x945e09];return _0x100b4d(msgResponse(_0xd6f0('0x16e'),_0xd6f0('0x48'),_0xd6f0('0x198')));});});});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x31')]=function(_0x55f6b1){var _0x1aa29d=this[_0xd6f0('0xb2')][_0x55f6b1[_0xd6f0('0x126')]];if(_0x1aa29d){delete this[_0xd6f0('0xb2')][_0x55f6b1[_0xd6f0('0x126')]];_0x1aa29d[_0xd6f0('0x199')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));var _0x565bca=_0x1aa29d[_0xd6f0('0x7c')]===_0xd6f0('0x7d')?this[_0xd6f0('0x24')][_0x1aa29d[_0xd6f0('0xbb')]]:this[_0xd6f0('0x23')][_0x1aa29d[_0xd6f0('0x19a')]()];if(!this['isSuccess'](_0x55f6b1[_0xd6f0('0x19b')])){this['updateOriginated'](_0x565bca);return this[_0xd6f0('0x19c')](_0x1aa29d,_0x565bca,_0x55f6b1)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x19d')));}this['uniqueId'][_0x55f6b1[_0xd6f0('0xe3')]]=_0x1aa29d;}};Dialer[_0xd6f0('0x1d')]['checkRetriveMax']=function(_0x129f95,_0x22afa5,_0x56133d){var _0x2e26d8=new History(_0x22afa5);if(_0x2e26d8[_0xd6f0('0xf4')]+_0x2e26d8['countcongestionretry']+_0x2e26d8[_0xd6f0('0x104')]+_0x2e26d8[_0xd6f0('0xf6')]+_0x2e26d8[_0xd6f0('0x105')]+_0x2e26d8[_0xd6f0('0xf7')]+_0x2e26d8[_0xd6f0('0xf1')]+_0x2e26d8[_0xd6f0('0x106')]>=_0x56133d[_0xd6f0('0xf8')]-0x1){return!![];}switch(_0x129f95){case 0x3:if(_0x2e26d8['countnoanswerretry']>=_0x56133d['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x2e26d8[_0xd6f0('0x104')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x19e')],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8['ContactId'],'ListId':_0x2e26d8['ListId'],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x19f')));break;case 0x5:if(_0x2e26d8['countbusyretry']>=_0x56133d[_0xd6f0('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x2e26d8[_0xd6f0('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x56133d['dialBusyRetryFrequency'],_0xd6f0('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e26d8['ContactId'],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x1a1')));break;case 0x8:if(_0x2e26d8[_0xd6f0('0xf5')]>=_0x56133d['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x2e26d8[_0xd6f0('0xf5')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x1a2')],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8['VoiceQueueId']||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1a3')));break;case 0x0:if(_0x2e26d8['countnosuchnumberretry']>=_0x56133d[_0xd6f0('0x1a4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x2e26d8[_0xd6f0('0xf6')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x1a5')],'minutes')[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8['CampaignId']||undefined})['catch'](loggerCatch(_0xd6f0('0x1a6')));}break;case 0xa:if(_0x2e26d8[_0xd6f0('0x105')]>=_0x56133d['dialDropMaxRetry']-0x1){return!![];}this[_0xd6f0('0xc7')]({'active':![],'countdropretry':_0x2e26d8['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x56133d['dialDropRetryFrequency'],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8['CampaignId']||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1a7')));break;case 0xb:if(_0x2e26d8[_0xd6f0('0xf7')]>=_0x56133d[_0xd6f0('0x123')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2e26d8['countabandonedretry']+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x124')],'minutes')[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8['ContactId'],'ListId':_0x2e26d8['ListId'],'VoiceQueueId':_0x2e26d8['VoiceQueueId']||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1a8')));break;case 0x13:if(_0x2e26d8[_0xd6f0('0xf1')]>=_0x56133d['dialMachineMaxRetry']-0x1){return!![];}this[_0xd6f0('0xc7')]({'active':![],'countmachineretry':_0x2e26d8[_0xd6f0('0xf1')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d['dialMachineRetryFrequency'],_0xd6f0('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8['CampaignId']||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x100')));break;case 0x14:if(_0x2e26d8[_0xd6f0('0x106')]>=_0x56133d[_0xd6f0('0x1a9')]-0x1){return!![];}this[_0xd6f0('0xc7')]({'active':![],'countagentrejectretry':_0x2e26d8['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x1aa')],_0xd6f0('0xfd'))['format'](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8['ListId'],'VoiceQueueId':_0x2e26d8['VoiceQueueId']||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1ab')));break;default:return!![];}};Dialer[_0xd6f0('0x1d')]['callProgressDetecting']=function(_0x9bc9c1,_0xd12f50,_0xea0635){var _0x402900=this;var _0x172e8a=new History(_0x9bc9c1);return new BPromise(function(_0x19a51c,_0x31b16d){if(_['isUndefined'](_0xd12f50)&&typeof _0xd12f50!=='object'){return _0x31b16d(msgResponse(_0xd6f0('0x1ac'),'Failure','entity\x20is\x20undefine'));}if(_[_0xd6f0('0x3d')](_0xea0635)&&typeof _0xea0635!=='object'){return _0x31b16d(msgResponse('[callProgressDetecting]',_0xd6f0('0x147'),_0xd6f0('0x1ad')));}switch(_0xea0635[_0xd6f0('0x110')]){case'0':_0xd12f50['outboundNoSuchCallsDay']+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x0;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x1ae');_0x172e8a[_0xd6f0('0xf6')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1af'),ut[_0xd6f0('0xed')](_0x9bc9c1,_0xd6f0('0x1b0')));_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0xf3')));if(_0x402900[_0xd6f0('0x1b1')](0x0,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf6')]>=_0xd12f50[_0xd6f0('0x1a4')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b2'));}else{_0x402900['stateGlobal'](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b2'));}}break;case'3':_0xd12f50[_0xd6f0('0x63')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x3;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x1b3');_0x172e8a[_0xd6f0('0x104')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')]('custom:agentnoanswer',ut['buildObj'](_0x9bc9c1,_0xd6f0('0x1b4')));_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0x1b5')));if(_0x402900[_0xd6f0('0x1b1')](0x3,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0x104')]>=_0xd12f50[_0xd6f0('0x1b6')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b7'));}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b7'));}}break;case'5':_0xd12f50[_0xd6f0('0x1b8')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x5;_0x172e8a['statedesc']=_0xd6f0('0x1b9');_0x172e8a[_0xd6f0('0xf4')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1ba'),ut[_0xd6f0('0xed')](_0x9bc9c1,_0xd6f0('0x1bb')));_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0x1bc')));if(_0x402900[_0xd6f0('0x1b1')](0x5,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf4')]>=_0xd12f50[_0xd6f0('0x1a0')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1bd'));}else{_0x402900['stateGlobal'](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1bd'));}}break;case'8':_0xd12f50[_0xd6f0('0x60')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x8;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x1be');_0x172e8a[_0xd6f0('0xf5')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1bf'),ut['buildObj'](_0x9bc9c1,_0xd6f0('0x1c0')));_0x402900['createHistory'](_0x172e8a)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1c1')));if(_0x402900['checkRetriveMax'](0x8,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf5')]>=_0xd12f50[_0xd6f0('0x1c2')]){_0x402900['createStateFinal'](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c3'));}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c3'));}}break;case'11':_0xd12f50[_0xd6f0('0x1c4')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0xb;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x121');_0x172e8a['countabandonedretry']+=0x1;_0x172e8a['countglobal']+=0x1;_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0x125')));if(_0x402900[_0xd6f0('0x1b1')](0xb,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf7')]>=_0xd12f50[_0xd6f0('0x123')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,'reason\x2011\x20abandoned');}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c5'));}}break;case'20':_0xd12f50[_0xd6f0('0x66')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x14;_0x172e8a['statedesc']='AgentReject';_0x172e8a[_0xd6f0('0x106')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1c6'),ut['buildObj'](_0x9bc9c1,'agentreject'));_0x402900[_0xd6f0('0xd3')](_0x172e8a)[_0xd6f0('0xb8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x402900[_0xd6f0('0x1b1')](0x14,_0x9bc9c1,_0xd12f50)){if(_0x172e8a['countagentrejectretry']>=_0xd12f50[_0xd6f0('0x1a9')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c7'));}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c7'));}}break;default:_0xd12f50[_0xd6f0('0x67')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0xc;_0x172e8a['statedesc']=_0xea0635[_0xd6f0('0x110')];_0x402900[_0xd6f0('0xd3')](_0x172e8a)[_0xd6f0('0xb8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x402900[_0xd6f0('0x1b1')](_0xea0635[_0xd6f0('0x110')],_0x9bc9c1,_0xd12f50)){if(_0x172e8a['countbusyretry']+_0x172e8a[_0xd6f0('0xf5')]+_0x172e8a[_0xd6f0('0x104')]+_0x172e8a[_0xd6f0('0xf6')]+_0x172e8a[_0xd6f0('0x105')]+_0x172e8a[_0xd6f0('0xf7')]+_0x172e8a['countmachineretry']+_0x172e8a[_0xd6f0('0x106')]>=_0xd12f50['dialGlobalMaxRetry']){_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xea0635[_0xd6f0('0x110')]);}else{_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xea0635[_0xd6f0('0x110')]);}}}});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xf9')]=function(_0x2e90ec,_0x4e9df5,_0x510f8d,_0x25e297){var _0x50e1ef=new Final(_0x2e90ec);_0x50e1ef[_0xd6f0('0xac')]=0xf;_0x50e1ef[_0xd6f0('0xad')]=_0xd6f0('0x1c8');this[_0xd6f0('0xfa')](_0x50e1ef,_0x4e9df5,_0x510f8d,_0x25e297);};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xfa')]=function(_0x367791,_0x388dd0,_0x4ee4d1,_0x1679ae){this[_0xd6f0('0xd1')](_0x367791)[_0xd6f0('0xc0')](function(){return _0x388dd0(msgResponse(_0xd6f0('0x1ac'),_0xd6f0('0xde'),_0x1679ae));})[_0xd6f0('0xb8')](function(){return _0x4ee4d1(msgResponse('[moveContactManagedDialer][0]','Failure',_0xd6f0('0x1c9')));});};Dialer['prototype'][_0xd6f0('0xa')]=function(_0x4cd339){var _0x51de1f=_0x4cd339[_0xd6f0('0x1ca')]/0x64;var _0x3c541d=_0x4cd339[_0xd6f0('0x11a')]/(_0x4cd339['outboundDropCallsDayTimeout']+_0x4cd339[_0xd6f0('0x5f')]);var _0x1e59ba=Math['round'](_0x4cd339[_0xd6f0('0x1cb')]*(_0x4cd339[_0xd6f0('0x1cc')]/0x64));var _0x1b9a30=Math[_0xd6f0('0x1cd')](_0x4cd339[_0xd6f0('0x1cb')]*(_0x4cd339[_0xd6f0('0x1ce')]/0x64));var _0x498ac8=_0x4cd339[_0xd6f0('0x4f')]+_0x4cd339[_0xd6f0('0x54')];var _0x212f18=Math[_0xd6f0('0x1cf')](_0x4cd339[_0xd6f0('0x72')]*_0x4cd339[_0xd6f0('0x74')]*_0x4cd339['predictiveIntervalHitRate']*_0x4cd339[_0xd6f0('0x6f')]);if(_[_0xd6f0('0x3d')](_0x4cd339['startProgressive'])){if(!_['isUndefined'](_0x4cd339[_0xd6f0('0x93')])){_0x4cd339[_0xd6f0('0x93')]=undefined;loggerPredictive[_0xd6f0('0x9a')](_0xd6f0('0x1d0'),_0xd6f0('0x1d1'));}if(!_['isUndefined'](_0x4cd339[_0xd6f0('0x95')])){loggerPredictive['error'](_0xd6f0('0x1d0'),_0xd6f0('0x1d2'));clearInterval(_0x4cd339['handlePredictive']);_0x4cd339[_0xd6f0('0x95')]=undefined;}_0x4cd339[_0xd6f0('0x2b')]=moment()[_0xd6f0('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xd6f0('0x81')](_0x4cd339[_0xd6f0('0x40')],_0xd6f0('0x1d3'),_0x4cd339[_0xd6f0('0x2b')]);this[_0xd6f0('0x15b')](_0x4cd339,0x1);}else if(ifInterval(_0x4cd339[_0xd6f0('0x1d4')],_0x4cd339['startProgressive'])){this[_0xd6f0('0x15b')](_0x4cd339,0x1);loggerPredictiveCalls[_0xd6f0('0x81')](_0xd6f0('0x1d5'),_0x4cd339[_0xd6f0('0x2b')],_0x4cd339['name']);_0x4cd339[_0xd6f0('0x72')]=0x0;_0x4cd339['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x51de1f<_0x3c541d&&_0x4cd339[_0xd6f0('0x1d6')]===_0xd6f0('0x1d7')){freeVariablesPredictive(_0x4cd339);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x1d8'),'Dropped\x20calls\x20day',_0x3c541d,'startProgressive',_0x4cd339[_0xd6f0('0x40')]);}else if(_0x212f18<_0x4cd339['predictiveIntervalErlangCallsDroppedCalls']&&_0x4cd339[_0xd6f0('0x1d6')]===_0xd6f0('0x1d7')){freeVariablesPredictive(_0x4cd339);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x1d9'),_0xd6f0('0x1da'),_0x212f18,'Drop\x20in\x20this\x20interval',_0x4cd339[_0xd6f0('0x6d')],_0xd6f0('0x2b'),_0x4cd339[_0xd6f0('0x40')]);}else if(!ifInterval(_0x4cd339[_0xd6f0('0x1d4')],_0x4cd339[_0xd6f0('0x2b')])&&_[_0xd6f0('0x3d')](_0x4cd339[_0xd6f0('0x93')])&&!_[_0xd6f0('0x3d')](_0x4cd339[_0xd6f0('0x2b')])){_0x4cd339[_0xd6f0('0x93')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));loggerPredictive[_0xd6f0('0x81')](_0x4cd339[_0xd6f0('0x40')],_0xd6f0('0x1db'),_0x4cd339[_0xd6f0('0x93')]);this['averageHandleTime'](_0x4cd339[_0xd6f0('0x1d4')])['then'](this[_0xd6f0('0x1dc')](_0x4cd339))['then'](mergeDataErlangB(_0x4cd339))['then'](this[_0xd6f0('0x1dd')](_0x4cd339))[_0xd6f0('0xb8')](loggerCatchPredictive(_0xd6f0('0x1de'),_0x4cd339));}else if(!ifInterval(_0x4cd339[_0xd6f0('0x1d4')],_0x4cd339[_0xd6f0('0x93')])){_0x4cd339[_0xd6f0('0x6d')]=0x0;_0x4cd339[_0xd6f0('0x93')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));loggerPredictive['info'](_0x4cd339['name'],_0xd6f0('0x1df'),_0x4cd339[_0xd6f0('0x93')]);clearInterval(_0x4cd339['handlePredictive']);_0x4cd339[_0xd6f0('0x95')]=undefined;this['averageHandleTime'](_0x4cd339[_0xd6f0('0x1d4')])['then'](this['getDataPredictive'](_0x4cd339))[_0xd6f0('0xc0')](mergeDataErlangB(_0x4cd339))[_0xd6f0('0xc0')](this['startMethodPredictive'](_0x4cd339))[_0xd6f0('0xb8')](loggerCatchPredictive(_0xd6f0('0x1e0'),_0x4cd339));}else if(_0x4cd339['predictiveIntervalAvailable']&&_0x498ac8<_0x4cd339[_0xd6f0('0x1cb')]-_0x1b9a30){freeVariablesPredictive(_0x4cd339);loggerPredictive[_0xd6f0('0x81')](_0x4cd339['name'],_0xd6f0('0x1e1'),_0x498ac8,_0xd6f0('0x1e2'),_0x4cd339[_0xd6f0('0x1cb')],'-',_0x1b9a30,'=',_0x4cd339[_0xd6f0('0x1cb')]-_0x1b9a30,')');}else if(_0x4cd339[_0xd6f0('0x1cb')]&&_0x498ac8>_0x4cd339[_0xd6f0('0x1cb')]+_0x1e59ba){freeVariablesPredictive(_0x4cd339);loggerPredictive['info'](_0x4cd339['name'],_0xd6f0('0x1e1'),_0x498ac8,_0xd6f0('0x1e3'),_0x4cd339[_0xd6f0('0x1cb')],'+',_0x1e59ba,'=',_0x4cd339[_0xd6f0('0x1cb')]+_0x1e59ba,')');}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1dc')]=function(_0x53eb93){var _0x386dc2=this;return function(_0x1f9774){return new BPromise(function(_0x278c16,_0x460bd5){_[_0xd6f0('0x12c')](_0x53eb93,_0x1f9774[0x0]);if(checkGetDataPredictive(_0x1f9774[0x0])){var _0x1ad377=_0x53eb93[_0xd6f0('0x1cb')]=_0x53eb93['talking']+_0x53eb93[_0xd6f0('0x4f')];var _0x14f925=_0x53eb93[_0xd6f0('0x1d4')]*0x3c;var _0x48235b=_0x1f9774[0x0][_0xd6f0('0x69')]+_0x1f9774[0x0]['predictiveIntervalAvgHoldtime'];var _0x54b755=(_0x1f9774[0x0][_0xd6f0('0x68')]+_0x1f9774[0x0][_0xd6f0('0x6b')]+_0x1f9774[0x0][_0xd6f0('0x6a')])/_0x1f9774[0x0][_0xd6f0('0x71')];_0x53eb93['predictiveIntervalHitRate']=_0x54b755>0x0?_0x54b755:0x1;switch(_0x53eb93[_0xd6f0('0x1d6')]){case _0xd6f0('0x1d7'):var _0x515257=_0x53eb93[_0xd6f0('0x1ca')]/0x64;return _0x386dc2[_0xd6f0('0x1e4')](_0x1ad377,_0x14f925,_0x48235b,_0x54b755,_0x515257)['then'](function(_0x2c48a6){return _0x278c16(_0x2c48a6);});case _0xd6f0('0x1e5'):var _0x663471=_0x53eb93[_0xd6f0('0x1ca')]/0x64;return _0x386dc2[_0xd6f0('0x1e6')](_0x1ad377,_0x14f925,_0x48235b,_0x54b755,_0x663471)[_0xd6f0('0xc0')](function(_0x2e0294){return _0x278c16(_0x2e0294);});default:return _0x460bd5(msgResponse(_0xd6f0('0x1e7'),_0xd6f0('0x147'),'Unknown\x20Predictive'));}}else{return _0x460bd5(msgResponse(_0xd6f0('0x1e7'),_0xd6f0('0x147'),_0xd6f0('0x1e8')));}});};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1e9')]=function(_0x8a4988){var _0x454dd5=this;return function(_0x245549){return new BPromise(function(_0x41ec2d,_0x7d0081){_[_0xd6f0('0x12c')](_0x8a4988,_0x245549[0x0]);if(checkGetDataPredictive(_0x245549[0x0])){loggerPredictive[_0xd6f0('0x81')](JSON[_0xd6f0('0x78')](_0x245549[0x0]));if(_0x8a4988[_0xd6f0('0x1d6')]===_0xd6f0('0x1d7')){return _0x454dd5[_0xd6f0('0xcf')](_0x8a4988['id'])[_0xd6f0('0xc0')](function(_0x1c743c){var _0x670494=_0x8a4988[_0xd6f0('0x50')]-_0x1c743c[0x0][_0xd6f0('0x1ea')];var _0x4d9328=_0x8a4988[_0xd6f0('0x1d4')]*0x3c;var _0x2aafb4=_0x245549[0x0][_0xd6f0('0x69')]+_0x245549[0x0][_0xd6f0('0x88')];var _0x1846e9=(_0x245549[0x0][_0xd6f0('0x68')]+_0x245549[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x245549[0x0][_0xd6f0('0x6a')])/_0x245549[0x0]['predictiveIntervalTotalCalls'];var _0x12db26=_0x8a4988[_0xd6f0('0x1ca')]/0x64;_0x8a4988['predictiveIntervalPauses']=_0x1c743c[0x0][_0xd6f0('0x1ea')]||0x0;_0x8a4988[_0xd6f0('0x6e')]=_0x1846e9>0x0?_0x1846e9:0x1;return _0x454dd5['abandonmentRate'](_0x670494,_0x4d9328,_0x2aafb4,_0x1846e9,_0x12db26);})[_0xd6f0('0xc0')](function(_0x14beff){return _0x41ec2d(_0x14beff);})[_0xd6f0('0xb8')](function(_0x53afb0){return _0x7d0081(msgResponse(_0xd6f0('0x1eb'),_0xd6f0('0x147'),JSON[_0xd6f0('0x78')](_0x53afb0)));});}if(_0x8a4988['dialPredictiveOptimization']==='agentBusyFactor'){return _0x454dd5[_0xd6f0('0xcf')](_0x8a4988['id'])[_0xd6f0('0xc0')](function(_0x3a8562){var _0x332117=_0x8a4988[_0xd6f0('0x50')]-_0x3a8562[0x0][_0xd6f0('0x1ea')];var _0x33ca87=_0x8a4988['dialPredictiveInterval']*0x3c;var _0x44329e=_0x245549[0x0][_0xd6f0('0x69')]+_0x245549[0x0][_0xd6f0('0x88')];var _0x558955=(_0x245549[0x0][_0xd6f0('0x68')]+_0x245549[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x245549[0x0][_0xd6f0('0x6a')])/_0x245549[0x0][_0xd6f0('0x71')];var _0x2bf94b=_0x8a4988[_0xd6f0('0x1ca')]/0x64;_0x8a4988[_0xd6f0('0x70')]=_0x3a8562[0x0][_0xd6f0('0x1ea')]||0x0;_0x8a4988[_0xd6f0('0x6e')]=_0x558955>0x0?_0x558955:0x1;return _0x454dd5[_0xd6f0('0x1e6')](_0x332117,_0x33ca87,_0x44329e,_0x558955,_0x2bf94b);})[_0xd6f0('0xc0')](function(_0x8941e2){return _0x41ec2d(_0x8941e2);})[_0xd6f0('0xb8')](function(_0x50fd01){return _0x7d0081(msgResponse('[CatchErlangB]',_0xd6f0('0x147'),JSON[_0xd6f0('0x78')](_0x50fd01)));});}}else{return _0x7d0081(msgResponse(_0xd6f0('0x1e7'),_0xd6f0('0x147'),_0xd6f0('0x1e8')));}});};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1dd')]=function(_0x1d0f6c){var _0xcf9328=this;return function(){var _0x437523=0x0;var _0x181e90=Math[_0xd6f0('0x1cf')](_0x1d0f6c[_0xd6f0('0x73')]*0x3e8);if(_0x181e90>0x0){_0x181e90=_0x181e90<0x64?0x64:_0x181e90;loggerPredictive[_0xd6f0('0x81')](_0x1d0f6c[_0xd6f0('0x40')],_0xd6f0('0x1ec'),_0x181e90,_0xd6f0('0x49'));_0x1d0f6c[_0xd6f0('0x95')]=setInterval(function(){_0xcf9328['handlePredictive'](_0x1d0f6c);loggerPredictiveCalls[_0xd6f0('0x81')]('[handlePredictive]',_0x437523+=0x1);},_0x181e90);}else{loggerPredictive[_0xd6f0('0x81')](_0x1d0f6c[_0xd6f0('0x40')],_0xd6f0('0x1ed'));}};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1ee')]=function(_0xcad5a3,_0x55011b){var _0x1fe44d=this;return function(_0x172397){if(_[_0xd6f0('0x80')](_0x172397)){if(_[_0xd6f0('0xb4')](_0x55011b['UserId'])||!_0x55011b[_0xd6f0('0x1ef')]){if(_0xcad5a3[_0xd6f0('0x161')]==='booked'){_0xcad5a3[_0xd6f0('0x12e')]=_['isUndefined'](_0xcad5a3['queueStatusComplete'])?!![]:_0xcad5a3['queueStatusComplete'];var _0x4532e5=uuid['v4']();_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5]=new Action(_0xcad5a3,_0x55011b,_0x4532e5);loggerBooked[_0xd6f0('0x81')](_0xd6f0('0x1f0'),_0x4532e5,_0xd6f0('0x1f1'),JSON[_0xd6f0('0x78')](_0xcad5a3['queueStatusComplete']),'Queue:\x20',_0xcad5a3[_0xd6f0('0x40')]);if(_0xcad5a3['queueStatusComplete']){_0xcad5a3[_0xd6f0('0x12e')]=![];_0x1fe44d[_0xd6f0('0x12a')][_0x1fe44d['actions'][_0x4532e5]['queue']]=[];ami['Action']({'actionid':_0x4532e5,'action':'queuestatus','queue':_0xcad5a3['name']})[_0xd6f0('0xb8')](function(){_0x1fe44d['updateOriginated'](_0xcad5a3);_0x1fe44d[_0xd6f0('0xc7')]({'active':![],'ContactId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5]['ContactId'],'ListId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xda')],'VoiceQueueId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xff')]||undefined,'CampaignId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x1f2')));delete _0x1fe44d[_0xd6f0('0xb2')][_0x4532e5];});}else{loggerBooked['info'](_0xd6f0('0x1f3'),JSON[_0xd6f0('0x78')](_0xcad5a3['queueStatusComplete']),'Queue:\x20',_0xcad5a3[_0xd6f0('0x40')]);_0x1fe44d[_0xd6f0('0xba')](_0xcad5a3);_0x1fe44d[_0xd6f0('0xc7')]({'active':![],'ContactId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5]['ContactId'],'ListId':_0x1fe44d['actions'][_0x4532e5][_0xd6f0('0xda')],'VoiceQueueId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xff')]||undefined,'CampaignId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1f2')));delete _0x1fe44d['actions'][_0x4532e5];}}else{return _0x1fe44d[_0xd6f0('0x16c')](_0xcad5a3,_0x55011b);}}else{if(getDiff(_0x55011b[_0xd6f0('0x1f4')])<_0xcad5a3[_0xd6f0('0x1f5')]*0x3c){if(_0x55011b[_0xd6f0('0x1f6')]&&!_0x55011b[_0xd6f0('0x1f6')][_0xd6f0('0x1f7')]){_0x1fe44d[_0xd6f0('0x22')]['run'](_0x55011b['id'])[_0xd6f0('0x20')](function(){_0x1fe44d['updateOriginated'](_0xcad5a3);});}else{_0x1fe44d['unlockContact']({'active':![]},_0x55011b['id'],0x1)[_0xd6f0('0x20')](function(){_0x1fe44d[_0xd6f0('0xba')](_0xcad5a3);});}}else{_0xcad5a3['outboundReCallsDay']+=0x1;_0x1fe44d['updateOriginated'](_0xcad5a3);if(_0xcad5a3[_0xd6f0('0x1f8')]){_0x1fe44d[_0xd6f0('0xc7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x55011b[_0xd6f0('0xd9')],'ListId':_0x55011b[_0xd6f0('0xda')],'VoiceQueueId':_0x55011b[_0xd6f0('0xff')]||undefined,'CampaignId':_0x55011b['CampaignId']||undefined})[_0xd6f0('0xb8')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1fe44d[_0xd6f0('0xd3')](createObjHistory(_0xcad5a3,_0x55011b,'RECALLINQUEUE',0x17,_0xd6f0('0x1f9')))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1fa')));}else{_0x1fe44d[_0xd6f0('0xd7')](createObjHistory(_0xcad5a3,_0x55011b,'RECALLFAILEDTIMEOUT',0x16,_0xd6f0('0x1fb')),_0xd6f0('0x1fc'),_0xd6f0('0x1fd'));}}}}else{_0xcad5a3['outboundBlacklistCallsDay']+=0x1;_0x1fe44d['saveInDb'](createObjHistory(_0xcad5a3,_0x55011b,'BLACKLIST',0xd,'Blacklist'),_0xd6f0('0x1fe'),_0xd6f0('0x1ff'));throw _0xd6f0('0x200');}};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x201')]=function(_0x430416){var _0x35edfe=this;var _0x1bc35b=_0x430416[_0xd6f0('0x202')]-_0x430416[_0xd6f0('0x9e')]-_0x430416[_0xd6f0('0xcc')];emitCampaignSummary(_0x430416);if(_0x1bc35b>0x0){if(_0x1bc35b>this[_0xd6f0('0x27')]){_0x1bc35b=this['maxNumberOriginate'];}_0x430416[_0xd6f0('0xcc')]+=_0x1bc35b;this[_0xd6f0('0xcd')](_0x430416['id'],_0x1bc35b,_0x430416[_0xd6f0('0x203')],_0x430416)[_0xd6f0('0xc0')](function(_0x54d973){_0x430416[_0xd6f0('0xcc')]-=_0x1bc35b;_0x430416[_0xd6f0('0xcc')]=_0x430416[_0xd6f0('0xcc')]>0x0?_0x430416['temp']:0x0;if(!checkContactEmpty(_0x54d973)){_0x430416[_0xd6f0('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xd6f0('0x81')]('[getContactCampaign2][Empty]'+_0x430416[_0xd6f0('0x40')]);}else{_0x430416[_0xd6f0('0x9e')]+=_0x54d973[_0xd6f0('0x9d')];_0x430416['message']=_0xd6f0('0x204');for(var _0x55d512=0x0;_0x55d512<_0x54d973[_0xd6f0('0x9d')];_0x55d512+=0x1){_0x430416[_0xd6f0('0x205')]+=0x1;if(_[_0xd6f0('0xb4')](_0x54d973[_0x55d512])||_['isNil'](_0x54d973[_0x55d512][_0xd6f0('0x16f')])||_[_0xd6f0('0xb4')](_0x54d973[_0x55d512][_0xd6f0('0x16f')][_0xd6f0('0x170')])){_0x35edfe['emptyContact'](_0xd6f0('0x206'),_0x430416,_0x54d973[_0x55d512]);}else{_0x35edfe[_0xd6f0('0xc4')](_[_0xd6f0('0xd8')](_0x54d973[_0x55d512],[_0xd6f0('0xdc'),'Contact.phone']))['then'](_0x35edfe[_0xd6f0('0x1ee')](_0x430416,_0x54d973[_0x55d512]))[_0xd6f0('0xb8')](_0x35edfe[_0xd6f0('0xd5')]('[actionOriginateIvr]\x20',_0x430416));}}}})[_0xd6f0('0xb8')](loggerGetContactDialer(_0xd6f0('0x207'),_0x430416,_0x1bc35b));}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x15b')]=function(_0x1e27b9,_0x28de3a){var _0x2d1c6f=this;var _0x4e2992=[];var _0x250cb9=_0x28de3a>=0x1?_0x28de3a:0x1;if(_0x1e27b9[_0xd6f0('0x161')]===_0xd6f0('0x9')){_0x250cb9=0x1;}var _0x3963cb=Math[_0xd6f0('0x1cf')](_0x1e27b9[_0xd6f0('0x4f')]*_0x250cb9)-_0x1e27b9[_0xd6f0('0x9e')]-_0x1e27b9[_0xd6f0('0xcc')];emitVoiceQueueSummary(_0x1e27b9);if(_0x1e27b9[_0xd6f0('0x208')]>0x0){var _0x2bbf7f=_0x1e27b9[_0xd6f0('0x208')]-_0x1e27b9[_0xd6f0('0x9e')]-_0x1e27b9[_0xd6f0('0x54')]-_0x1e27b9[_0xd6f0('0xcc')]-_0x1e27b9[_0xd6f0('0x51')];if(_0x3963cb>_0x2bbf7f){_0x3963cb=_0x2bbf7f;}}if(_0x3963cb>0x0){if(_0x1e27b9[_0xd6f0('0x161')]==='booked'){_0x3963cb=0x1;}if(_0x3963cb>this['maxNumberOriginate']){_0x3963cb=this[_0xd6f0('0x27')];}_0x1e27b9['temp']+=_0x3963cb;for(var _0x501f8c in this[_0xd6f0('0x25')]){if(typeof this[_0xd6f0('0x25')][_0x501f8c]!=='undefined'){if(this['agents'][_0x501f8c][_0xd6f0('0xac')]===_0xd6f0('0x209')&&this[_0xd6f0('0x25')][_0x501f8c][_0xd6f0('0xb6')]===_0xd6f0('0xe1')){_0x4e2992[_0xd6f0('0x12b')](this[_0xd6f0('0x25')][_0x501f8c]['id']);}}}this[_0xd6f0('0xcb')](_0x1e27b9['id'],_0x4e2992,_0x3963cb,_0x1e27b9[_0xd6f0('0x203')],_0x1e27b9)[_0xd6f0('0xc0')](function(_0x37d0a5){_0x1e27b9[_0xd6f0('0xcc')]-=_0x3963cb;_0x1e27b9['temp']=_0x1e27b9[_0xd6f0('0xcc')]>0x0?_0x1e27b9[_0xd6f0('0xcc')]:0x0;if(!checkContactEmpty(_0x37d0a5)){_0x2d1c6f[_0xd6f0('0xbe')](_0x1e27b9)[_0xd6f0('0xc0')](sendMessageReschedule(_0x1e27b9))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc1')));}else{_0x1e27b9[_0xd6f0('0x9e')]+=_0x37d0a5[_0xd6f0('0x9d')];_0x1e27b9[_0xd6f0('0x3e')]=_0x1e27b9[_0xd6f0('0x161')]==='booked'?'ACTIVE':_0xd6f0('0x204');for(var _0x57a646=0x0;_0x57a646<_0x37d0a5[_0xd6f0('0x9d')];_0x57a646+=0x1){if(_['isNil'](_0x37d0a5[_0x57a646])||_[_0xd6f0('0xb4')](_0x37d0a5[_0x57a646][_0xd6f0('0x16f')])||_['isNil'](_0x37d0a5[_0x57a646][_0xd6f0('0x16f')][_0xd6f0('0x170')])){_0x2d1c6f[_0xd6f0('0x20a')](_0xd6f0('0x206'),_0x1e27b9,_0x37d0a5[_0x57a646]);}else{_0x2d1c6f[_0xd6f0('0xc2')](_[_0xd6f0('0xd8')](_0x37d0a5[_0x57a646],[_0xd6f0('0xff'),_0xd6f0('0x20b')]))['then'](_0x2d1c6f[_0xd6f0('0x1ee')](_0x1e27b9,_0x37d0a5[_0x57a646]))[_0xd6f0('0xb8')](_0x2d1c6f[_0xd6f0('0xd5')](_0xd6f0('0x206'),_0x1e27b9));}}}})[_0xd6f0('0xb8')](loggerGetContactDialer('[getContactDialer2]',_0x1e27b9,_0x3963cb));}};Dialer['prototype'][_0xd6f0('0x95')]=function(_0x381dd0){if(_0x381dd0[_0xd6f0('0x208')]>0x0){var _0xb8d8b8=_0x381dd0[_0xd6f0('0x208')]-_0x381dd0[_0xd6f0('0x9e')]-_0x381dd0[_0xd6f0('0x54')];if(_0xb8d8b8>0x0){this[_0xd6f0('0x20c')](_0x381dd0);}else{loggerPredictiveCalls['info'](_0xd6f0('0x20d'));}}else{this[_0xd6f0('0x20c')](_0x381dd0);}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x20c')]=function(_0x5c642a){var _0xd3a7f=this;var _0xa00cef=[];_0x5c642a[_0xd6f0('0x9e')]+=0x1;for(var _0x289b58 in this[_0xd6f0('0x25')]){if(typeof this['agents'][_0x289b58]!==_0xd6f0('0x9f')){if(this[_0xd6f0('0x25')][_0x289b58][_0xd6f0('0xac')]===_0xd6f0('0x209')&&this[_0xd6f0('0x25')][_0x289b58]['status']===_0xd6f0('0xe1')){_0xa00cef[_0xd6f0('0x12b')](this['agents'][_0x289b58]['id']);}}}this[_0xd6f0('0xcb')](_0x5c642a['id'],_0xa00cef,0x1,_0x5c642a[_0xd6f0('0x203')],_0x5c642a)[_0xd6f0('0xc0')](function(_0x59f2f6){if(!checkContactEmpty(_0x59f2f6)){checkContactLowerLimitOriginate(_0x5c642a,0x1,0x0);_0xd3a7f[_0xd6f0('0xbe')](_0x5c642a)[_0xd6f0('0xc0')](sendMessageReschedule(_0x5c642a))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc1')));}else{_0x5c642a[_0xd6f0('0x3e')]=_0xd6f0('0x204');if(_['isNil'](_0x59f2f6[0x0])||_['isNil'](_0x59f2f6[0x0][_0xd6f0('0x16f')])||_[_0xd6f0('0xb4')](_0x59f2f6[0x0]['Contact']['phone'])){_0xd3a7f[_0xd6f0('0x20a')]('[actionOriginate]\x20',_0x5c642a,_0x59f2f6[0x0]);}else{_0xd3a7f[_0xd6f0('0xc2')](_[_0xd6f0('0xd8')](_0x59f2f6[0x0],[_0xd6f0('0xff'),'Contact.phone']))[_0xd6f0('0xc0')](_0xd3a7f['checkContactBlack'](_0x5c642a,_0x59f2f6[0x0]))[_0xd6f0('0xb8')](_0xd3a7f[_0xd6f0('0xd5')](_0xd6f0('0x20e'),_0x5c642a));}}})[_0xd6f0('0xb8')](loggerGetContactDialer(_0xd6f0('0x20f'),_0x5c642a,0x1));emitVoiceQueueSummary(_0x5c642a);};Dialer['prototype'][_0xd6f0('0x1e4')]=function(_0x213025,_0x4cb65f,_0x2d027a,_0x23ceff,_0x49b590,_0xd5f542){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x210'));loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x211'),_0x213025);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x212'),_0x4cb65f);loggerPredictive['info'](_0xd6f0('0x213'),_0x2d027a);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x214'),_0x23ceff);loggerPredictive[_0xd6f0('0x81')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x49b590);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x215'));return new BPromise(function(_0x218d5a,_0x2a824c){if(_0x213025<=0x0||isNaN(_0x213025)){return _0x2a824c(msgResponse(_0xd6f0('0x216'),_0xd6f0('0x48'),_0xd6f0('0x217')+_0x213025));}if(_0x2d027a<=0x0||isNaN(_0x2d027a)){return _0x2a824c(msgResponse(_0xd6f0('0x216'),_0xd6f0('0x48'),_0xd6f0('0x218')+_0x2d027a));}if(_0x23ceff<=0x0||isNaN(_0x23ceff)){return _0x2a824c(msgResponse('[abandonmentRate]','Error',_0xd6f0('0x219')+_0x23ceff));}if(_0x4cb65f<=0x0||isNaN(_0x4cb65f)){return _0x2a824c(msgResponse(_0xd6f0('0x216'),_0xd6f0('0x48'),_0xd6f0('0x21a')+_0x4cb65f));}if(_0x49b590<=0x0||isNaN(_0x49b590)){return _0x2a824c(msgResponse('[abandonmentRate]',_0xd6f0('0x48'),_0xd6f0('0x21b')+_0x49b590));}_0xd5f542=_0xd5f542||0x0;var _0x1e9462=0x1/_0x2d027a;var _0x40b0e3=0x0;var _0x539152=0x0;var _0x5223df=0x0;var _0x1b2cd9=0x0;for(var _0x56596e=0x0;_0x5223df<_0x49b590;_0x56596e+=0x1){_0x539152=_0x56596e/_0x4cb65f;_0x40b0e3=(_0x23ceff*_0x539152+_0xd5f542)/_0x1e9462;_0x5223df=erlangb(_0x40b0e3,_0x213025);_0x1b2cd9=_0x40b0e3/_0x213025*(0x1-erlangb(_0x40b0e3,_0x213025));}return _0x218d5a({'erlangCalls':_0x56596e,'erlangCallToSecond':_0x4cb65f/_0x56596e,'erlangAbandonmentRate':_0x5223df,'erlangBusyFactor':_0x1b2cd9});});};Dialer['prototype']['busyFactor']=function(_0x522199,_0x41e6eb,_0x3f1a60,_0x675918,_0x478ff9,_0x2a8bd5){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x21c'));loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x211'),_0x522199);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x212'),_0x41e6eb);loggerPredictive['info'](_0xd6f0('0x213'),_0x3f1a60);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x214'),_0x675918);loggerPredictive['info'](_0xd6f0('0x21d'),_0x478ff9);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x215'));return new BPromise(function(_0x3b52d8,_0x192c04){if(_0x522199<=0x0||isNaN(_0x522199)){return _0x192c04(msgResponse(_0xd6f0('0x21e'),_0xd6f0('0x48'),_0xd6f0('0x217')+_0x522199));}if(_0x3f1a60<=0x0||isNaN(_0x3f1a60)){return _0x192c04(msgResponse('[busyFactor]',_0xd6f0('0x48'),_0xd6f0('0x218')+_0x3f1a60));}if(_0x675918<=0x0||isNaN(_0x675918)){return _0x192c04(msgResponse('[busyFactor]',_0xd6f0('0x48'),'p\x20=\x20'+_0x675918));}if(_0x41e6eb<=0x0||isNaN(_0x41e6eb)){return _0x192c04(msgResponse(_0xd6f0('0x21e'),'Error','interval\x20=\x20'+_0x41e6eb));}if(_0x478ff9<=0x0||isNaN(_0x478ff9)){return _0x192c04(msgResponse(_0xd6f0('0x21e'),_0xd6f0('0x48'),_0xd6f0('0x21f')+_0x478ff9));}_0x2a8bd5=_0x2a8bd5||0x0;var _0x1cd81c=0x1/_0x3f1a60;var _0x407af9=0x0;var _0x2df05c=0x0;var _0x4fdc47=0x0;var _0x3bd6ee=0x0;for(var _0x137fe4=0x0;_0x3bd6ee<_0x478ff9;_0x137fe4+=0x1){_0x2df05c=_0x137fe4/_0x41e6eb;_0x407af9=(_0x675918*_0x2df05c+_0x2a8bd5)/_0x1cd81c;_0x4fdc47=erlangb(_0x407af9,_0x522199);_0x3bd6ee=_0x407af9/_0x522199*(0x1-erlangb(_0x407af9,_0x522199));}return _0x3b52d8({'erlangCalls':_0x137fe4,'erlangCallToSecond':_0x41e6eb/_0x137fe4,'erlangAbandonmentRate':_0x4fdc47,'erlangBusyFactor':_0x3bd6ee});});};module[_0xd6f0('0x220')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ced5ebd..5660c0f 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 _0x50fb=['moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x50fb,0x1df));var _0xb50f=function(_0x5b4de,_0x4ca7f3){_0x5b4de=_0x5b4de-0x0;var _0x27c54c=_0x50fb[_0x5b4de];return _0x27c54c;};'use strict';var util=require('util');var _=require(_0xb50f('0x0'));var moment=require(_0xb50f('0x1'));function getSeconds(_0x2b898c,_0x355ef8){var _0x235f67=moment(_0x2b898c)[_0xb50f('0x2')](0x0);var _0x2d1804=moment(_0x355ef8)[_0xb50f('0x2')](0x0);return _0x235f67['diff'](_0x2d1804,_0xb50f('0x3'));}function QueueCallerAbandon(_0x2ed396,_0x37757c){this[_0xb50f('0x4')]=_0x2ed396['scheduledat'];this[_0xb50f('0x5')]=_0x2ed396[_0xb50f('0x5')];this[_0xb50f('0x6')]=_0x2ed396[_0xb50f('0x5')]===_0xb50f('0x7')?_0xb50f('0x8'):_0x2ed396[_0xb50f('0x5')];this[_0xb50f('0x9')]=_0x2ed396['countbusyretry'];this[_0xb50f('0xa')]=_0x2ed396[_0xb50f('0xa')];this['countnoanswerretry']=_0x2ed396[_0xb50f('0xb')];this[_0xb50f('0xc')]=_0x2ed396[_0xb50f('0x9')]+_0x2ed396['countcongestionretry']+_0x2ed396['countnoanswerretry']+_0x2ed396['countnosuchnumberretry']+_0x2ed396[_0xb50f('0xd')]+_0x2ed396[_0xb50f('0xe')]+_0x2ed396[_0xb50f('0xf')]+_0x2ed396['countagentrejectretry'];this[_0xb50f('0x10')]=_0x2ed396[_0xb50f('0x10')];this[_0xb50f('0xd')]=_0x2ed396[_0xb50f('0xd')];this['countabandonedretry']=_0x2ed396[_0xb50f('0xe')];this[_0xb50f('0xf')]=_0x2ed396[_0xb50f('0xf')];this[_0xb50f('0x11')]=_0x2ed396[_0xb50f('0x11')];this[_0xb50f('0x12')]=_0x37757c[_0xb50f('0x12')];this[_0xb50f('0x13')]=_0x2ed396[_0xb50f('0x14')];this['calleridnum']=_0x2ed396['number'];this[_0xb50f('0x15')]=_0x2ed396[_0xb50f('0x15')];this[_0xb50f('0x16')]=_0x2ed396[_0xb50f('0x16')];this[_0xb50f('0x17')]=_0x2ed396['droptime'];this[_0xb50f('0x18')]=this[_0xb50f('0x17')];this[_0xb50f('0x19')]=getSeconds(_0x2ed396['responsetime'],_0x2ed396['starttime']);this[_0xb50f('0x1a')]=getSeconds(this[_0xb50f('0x17')],_0x2ed396[_0xb50f('0x16')]);this[_0xb50f('0x1b')]=0x0;this[_0xb50f('0x8')]=_0x37757c[_0xb50f('0x8')];this['membername']=_0x37757c[_0xb50f('0x1c')];this['reason']=_0x37757c['reason'];this[_0xb50f('0x1d')]=_0x2ed396[_0xb50f('0x1d')];this[_0xb50f('0x1e')]=_0x2ed396['callbackuniqueid'];this[_0xb50f('0x1f')]=_0x2ed396[_0xb50f('0x1f')];this[_0xb50f('0x20')]=_0x2ed396['recallme'];this['ContactId']=_0x2ed396['ContactId'];this[_0xb50f('0x21')]=_0x2ed396[_0xb50f('0x21')];this[_0xb50f('0x22')]=_0x2ed396['UserId'];this[_0xb50f('0x23')]=_0x2ed396[_0xb50f('0x23')];this[_0xb50f('0x24')]=_0x2ed396[_0xb50f('0x24')];this[_0xb50f('0x25')]=_0x2ed396[_0xb50f('0x25')]||'';this[_0xb50f('0x26')]=_0x2ed396[_0xb50f('0x26')]||'';}module[_0xb50f('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x6906=['outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','endtime','droptime','ringtime','responsetime','holdtime','talktime','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype'];(function(_0x31d01d,_0x5991a5){var _0x1ff226=function(_0x1bd568){while(--_0x1bd568){_0x31d01d['push'](_0x31d01d['shift']());}};_0x1ff226(++_0x5991a5);}(_0x6906,0x76));var _0x6690=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6906[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x6690('0x0'));var _=require('lodash');var moment=require(_0x6690('0x1'));function getSeconds(_0x42e2da,_0x3c3b51){var _0x5c6f40=moment(_0x42e2da)[_0x6690('0x2')](0x0);var _0x30e195=moment(_0x3c3b51)[_0x6690('0x2')](0x0);return _0x5c6f40[_0x6690('0x3')](_0x30e195,_0x6690('0x4'));}function QueueCallerAbandon(_0x3a33c6,_0x4bb143){this[_0x6690('0x5')]=_0x3a33c6[_0x6690('0x5')];this[_0x6690('0x6')]=_0x3a33c6[_0x6690('0x6')];this[_0x6690('0x7')]=_0x3a33c6[_0x6690('0x6')]===_0x6690('0x8')?_0x6690('0x9'):_0x3a33c6['type'];this[_0x6690('0xa')]=_0x3a33c6['countbusyretry'];this[_0x6690('0xb')]=_0x3a33c6['countcongestionretry'];this['countnoanswerretry']=_0x3a33c6['countnoanswerretry'];this[_0x6690('0xc')]=_0x3a33c6[_0x6690('0xa')]+_0x3a33c6[_0x6690('0xb')]+_0x3a33c6[_0x6690('0xd')]+_0x3a33c6[_0x6690('0xe')]+_0x3a33c6[_0x6690('0xf')]+_0x3a33c6[_0x6690('0x10')]+_0x3a33c6[_0x6690('0x11')]+_0x3a33c6[_0x6690('0x12')];this[_0x6690('0xe')]=_0x3a33c6[_0x6690('0xe')];this['countdropretry']=_0x3a33c6[_0x6690('0xf')];this[_0x6690('0x10')]=_0x3a33c6[_0x6690('0x10')];this[_0x6690('0x11')]=_0x3a33c6[_0x6690('0x11')];this[_0x6690('0x12')]=_0x3a33c6[_0x6690('0x12')];this[_0x6690('0x13')]=_0x4bb143[_0x6690('0x13')];this[_0x6690('0x14')]=_0x3a33c6[_0x6690('0x15')];this[_0x6690('0x16')]=_0x3a33c6['number'];this[_0x6690('0x17')]=_0x3a33c6['starttime'];this['responsetime']=_0x3a33c6['responsetime'];this['droptime']=_0x3a33c6['droptime'];this[_0x6690('0x18')]=this[_0x6690('0x19')];this[_0x6690('0x1a')]=getSeconds(_0x3a33c6[_0x6690('0x1b')],_0x3a33c6[_0x6690('0x17')]);this[_0x6690('0x1c')]=getSeconds(this['droptime'],_0x3a33c6[_0x6690('0x1b')]);this[_0x6690('0x1d')]=0x0;this[_0x6690('0x9')]=_0x4bb143[_0x6690('0x9')];this['membername']=_0x4bb143[_0x6690('0x1e')];this[_0x6690('0x1f')]=_0x4bb143[_0x6690('0x1f')];this[_0x6690('0x20')]=_0x3a33c6[_0x6690('0x20')];this['callbackuniqueid']=_0x3a33c6['callbackuniqueid'];this[_0x6690('0x21')]=_0x3a33c6[_0x6690('0x21')];this[_0x6690('0x22')]=_0x3a33c6[_0x6690('0x22')];this[_0x6690('0x23')]=_0x3a33c6[_0x6690('0x23')];this[_0x6690('0x24')]=_0x3a33c6[_0x6690('0x24')];this[_0x6690('0x25')]=_0x3a33c6[_0x6690('0x25')];this[_0x6690('0x26')]=_0x3a33c6[_0x6690('0x26')];this[_0x6690('0x27')]=_0x3a33c6[_0x6690('0x27')];this[_0x6690('0x28')]=_0x3a33c6[_0x6690('0x28')]||'';this[_0x6690('0x29')]=_0x3a33c6['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 92c28c2..d8b6f15 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(_0x1e1972,_0x4c2ddb){var _0x8546ae=function(_0x1d3027){while(--_0x1d3027){_0x1e1972['push'](_0x1e1972['shift']());}};_0x8546ae(++_0x4c2ddb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x2130d3,_0x3955be){var _0x1992c3=function(_0x50b50a){while(--_0x50b50a){_0x2130d3['push'](_0x2130d3['shift']());}};_0x1992c3(++_0x3955be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 62c7a07..d397996 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 _0xe1f7=['path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','lodash','bluebird','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1f7,0x71));var _0x7e1f=function(_0x3ba537,_0x56b969){_0x3ba537=_0x3ba537-0x0;var _0x585c1a=_0xe1f7[_0x3ba537];return _0x585c1a;};'use strict';var util=require('util');var _=require(_0x7e1f('0x0'));var BPromise=require(_0x7e1f('0x1'));var uuid=require('uuid');var moment=require(_0x7e1f('0x2'));var path=require(_0x7e1f('0x3'));var tiff2pdf=require(_0x7e1f('0x4'));var gs=require(_0x7e1f('0x5'));var logger=require('../../../config/logger')(_0x7e1f('0x6'));var ami=require(_0x7e1f('0x7'));var rpcDb=require(_0x7e1f('0x8'));var Channel=require(_0x7e1f('0x9'));var ut=require(_0x7e1f('0xa'));var Action=require(_0x7e1f('0xb'));var faxAccount=require(_0x7e1f('0xc'));var attachment=require(_0x7e1f('0xd'));var faxMessage=require(_0x7e1f('0xe'));function Fax(_0xa1041c){this['channels']={};this['faxAccounts']=_0xa1041c[_0x7e1f('0xf')];this[_0x7e1f('0x10')]=_0xa1041c[_0x7e1f('0x10')];this[_0x7e1f('0x11')]={};ami['on']('newchannel',this[_0x7e1f('0x12')][_0x7e1f('0x13')](this));ami['on'](_0x7e1f('0x14'),this[_0x7e1f('0x15')][_0x7e1f('0x13')](this));ami['on'](_0x7e1f('0x16'),this[_0x7e1f('0x17')][_0x7e1f('0x13')](this));ami['on']('newexten',this['syncNewExten'][_0x7e1f('0x13')](this));ami['on'](_0x7e1f('0x18'),this[_0x7e1f('0x19')][_0x7e1f('0x13')](this));ami['on'](_0x7e1f('0x1a'),this[_0x7e1f('0x1b')][_0x7e1f('0x13')](this));ami['on']('hangup',this[_0x7e1f('0x1c')][_0x7e1f('0x13')](this));ami['on'](_0x7e1f('0x1d'),this[_0x7e1f('0x1e')][_0x7e1f('0x13')](this));}Fax[_0x7e1f('0x1f')][_0x7e1f('0x12')]=function(_0x4cfd27){if(_0x4cfd27[_0x7e1f('0x20')]===_0x7e1f('0x21')){for(var _0x42397d in this[_0x7e1f('0xf')]){if(this[_0x7e1f('0xf')][_0x7e1f('0x22')](_0x42397d)){if(_0x4cfd27[_0x7e1f('0x23')]===this['faxAccounts'][_0x42397d][_0x7e1f('0x24')]){this[_0x7e1f('0x25')][_0x4cfd27['uniqueid']]={};this['channels'][_0x4cfd27[_0x7e1f('0x26')]]['channel']=_0x4cfd27[_0x7e1f('0x27')];this['channels'][_0x4cfd27[_0x7e1f('0x26')]]['id']=this['faxAccounts'][_0x42397d]['id'];this[_0x7e1f('0x25')][_0x4cfd27[_0x7e1f('0x26')]][_0x7e1f('0x28')]=this[_0x7e1f('0xf')][_0x42397d]['name'];logger[_0x7e1f('0x29')](_0x4cfd27[_0x7e1f('0x26')],'\x20syncNewchannel\x20');}}}}if(this[_0x7e1f('0x11')][_0x4cfd27[_0x7e1f('0x26')]]){this['channels'][_0x4cfd27['uniqueid']]={};this[_0x7e1f('0x25')][_0x4cfd27['uniqueid']][_0x7e1f('0x27')]=_0x4cfd27[_0x7e1f('0x27')];logger[_0x7e1f('0x29')](_0x4cfd27[_0x7e1f('0x26')],'\x20syncNewchannel\x20');}};Fax[_0x7e1f('0x1f')][_0x7e1f('0x15')]=function(_0x3d03aa){if(this[_0x7e1f('0x25')][_0x3d03aa[_0x7e1f('0x26')]]){for(var _0x17b7b1 in _0x3d03aa[_0x7e1f('0x2a')]){if(_0x3d03aa[_0x7e1f('0x2a')]['hasOwnProperty'](_0x17b7b1)){this[_0x7e1f('0x25')][_0x3d03aa['uniqueid']][_0x17b7b1]=_0x3d03aa[_0x7e1f('0x2b')];}}}};Fax['prototype'][_0x7e1f('0x17')]=function(_0x5ef324){if(this[_0x7e1f('0x25')][_0x5ef324['uniqueid']]){this[_0x7e1f('0x25')][_0x5ef324[_0x7e1f('0x26')]][_0x7e1f('0x2c')]=_0x5ef324[_0x7e1f('0x2c')];this['channels'][_0x5ef324[_0x7e1f('0x26')]][_0x7e1f('0x2d')]=_0x5ef324['channelstatedesc'];}};Fax[_0x7e1f('0x1f')][_0x7e1f('0x2e')]=function(_0xb5196b){if(this[_0x7e1f('0x25')][_0xb5196b[_0x7e1f('0x26')]]){for(var _0x3deb29 in _0xb5196b[_0x7e1f('0x2a')]){if(_0xb5196b['variable']['hasOwnProperty'](_0x3deb29)){this[_0x7e1f('0x25')][_0xb5196b[_0x7e1f('0x26')]][_0x3deb29]=_0xb5196b['value'];}}}};Fax[_0x7e1f('0x1f')][_0x7e1f('0x19')]=function(_0x5d0e20){if(this[_0x7e1f('0x25')][_0x5d0e20[_0x7e1f('0x26')]]){this['channels'][_0x5d0e20[_0x7e1f('0x26')]]['operation']=_0x5d0e20[_0x7e1f('0x2f')];this[_0x7e1f('0x25')][_0x5d0e20[_0x7e1f('0x26')]][_0x7e1f('0x30')]=_0x5d0e20[_0x7e1f('0x30')];this[_0x7e1f('0x25')][_0x5d0e20[_0x7e1f('0x26')]][_0x7e1f('0x24')]=_0x5d0e20['localstationid'];this['channels'][_0x5d0e20[_0x7e1f('0x26')]]['filename']=_0x5d0e20['filename'];logger[_0x7e1f('0x29')](_0x5d0e20[_0x7e1f('0x26')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x7e1f('0x1b')]=function(_0x17ede2){var _0x44c4ba=this;if(this[_0x7e1f('0x25')][_0x17ede2['uniqueid']]){var _0x169c34=this[_0x7e1f('0x25')][_0x17ede2['uniqueid']]['id'];this[_0x7e1f('0x25')][_0x17ede2[_0x7e1f('0x26')]][_0x7e1f('0x31')]=_0x17ede2[_0x7e1f('0x31')];this[_0x7e1f('0x25')][_0x17ede2[_0x7e1f('0x26')]][_0x7e1f('0x32')]=_0x17ede2[_0x7e1f('0x32')];this[_0x7e1f('0x25')][_0x17ede2[_0x7e1f('0x26')]]['localstationid']=_0x17ede2[_0x7e1f('0x24')];this[_0x7e1f('0x25')][_0x17ede2[_0x7e1f('0x26')]][_0x7e1f('0x33')]=_0x17ede2[_0x7e1f('0x33')];this['channels'][_0x17ede2[_0x7e1f('0x26')]][_0x7e1f('0x34')]=_0x17ede2[_0x7e1f('0x34')];this[_0x7e1f('0x25')][_0x17ede2['uniqueid']]['filename']=_0x17ede2[_0x7e1f('0x35')];this[_0x7e1f('0x25')][_0x17ede2[_0x7e1f('0x26')]][_0x7e1f('0x36')]=_0x17ede2[_0x7e1f('0x36')];if(this['channels'][_0x17ede2[_0x7e1f('0x26')]][_0x7e1f('0x32')]>0x0){tiff2pdf(_0x17ede2[_0x7e1f('0x35')],_0x7e1f('0x37'),function(_0x1206f2){logger[_0x7e1f('0x29')](_0x17ede2[_0x7e1f('0x26')],_0x7e1f('0x38'),_0x1206f2[_0x7e1f('0x39')]);attachment['create']({'name':path[_0x7e1f('0x3a')](_0x17ede2[_0x7e1f('0x35')])[_0x7e1f('0x28')],'basename':path[_0x7e1f('0x3a')](_0x17ede2[_0x7e1f('0x35')])[_0x7e1f('0x28')]+_0x7e1f('0x3b'),'type':_0x7e1f('0x3c')})[_0x7e1f('0x3d')](function(_0x56966a){faxAccount[_0x7e1f('0x3e')](_0x169c34,{'from':_0x17ede2[_0x7e1f('0x36')],'mapKey':'fax','body':path[_0x7e1f('0x3a')](_0x17ede2[_0x7e1f('0x35')])[_0x7e1f('0x28')]+_0x7e1f('0x3b'),'AttachmentId':_0x56966a['id']})['catch'](function(_0x5ae565){logger[_0x7e1f('0x3f')](_0x17ede2[_0x7e1f('0x26')],_0x7e1f('0x40'),JSON[_0x7e1f('0x41')](_0x5ae565));});})[_0x7e1f('0x42')](function(_0x501dd6){logger['error'](_0x17ede2['uniqueid'],_0x7e1f('0x43'),JSON[_0x7e1f('0x41')](_0x501dd6));});});}logger[_0x7e1f('0x29')](_0x17ede2[_0x7e1f('0x26')],_0x7e1f('0x43'));}};Fax[_0x7e1f('0x1f')][_0x7e1f('0x1e')]=function(_0x4d4e65){if(this['actions'][_0x4d4e65[_0x7e1f('0x26')]]){_[_0x7e1f('0x44')](this[_0x7e1f('0x25')][_0x4d4e65[_0x7e1f('0x26')]],_[_0x7e1f('0x45')](_0x4d4e65,['response',_0x7e1f('0x46')]));}};function updateStatus(_0x25dfba){if(_0x25dfba['AttachmentId']){faxMessage[_0x7e1f('0x47')](_0x25dfba[_0x7e1f('0x48')],{'failMessage':_0x7e1f('0x49')})[_0x7e1f('0x3d')](function(_0x13706d){ut['logger'](_0x7e1f('0x4a'),_0x13706d);})[_0x7e1f('0x42')](function(_0x48fb69){ut[_0x7e1f('0x4b')](_0x7e1f('0x4c'),_0x48fb69);});}else{ut['logger'](_0x7e1f('0x4d'));}}Fax[_0x7e1f('0x1f')][_0x7e1f('0x4e')]=function(_0x44628c,_0xa530d,_0x14e558){var _0x23e601=this;var _0x5567e5={};if(_0xa530d){_0x5567e5={'read':_0xa530d};}else{_0x5567e5={'failMessage':_0x14e558};}if(this[_0x7e1f('0x11')][_0x44628c][_0x7e1f('0x48')]){faxMessage[_0x7e1f('0x47')](this[_0x7e1f('0x11')][_0x44628c][_0x7e1f('0x48')],_0x5567e5)['then'](function(_0x1c179d){ut[_0x7e1f('0x4b')](_0x7e1f('0x4f'),_0x1c179d);})[_0x7e1f('0x42')](function(_0xeffba1){ut['logger'](_0x7e1f('0x50'),_0xeffba1);})[_0x7e1f('0x51')](function(){delete _0x23e601[_0x7e1f('0x25')][_0x44628c];delete _0x23e601[_0x7e1f('0x11')][_0x44628c];});}else{ut[_0x7e1f('0x4b')]('[Fax][Message][NoUpdate2]');delete this[_0x7e1f('0x25')][_0x44628c];delete this[_0x7e1f('0x11')][_0x44628c];}};Fax[_0x7e1f('0x1f')]['syncHangup']=function(_0x39aab3){var _0x2688e0=this;if(this[_0x7e1f('0x25')][_0x39aab3[_0x7e1f('0x26')]]){if(this[_0x7e1f('0x11')][_0x39aab3[_0x7e1f('0x26')]]){this[_0x7e1f('0x25')][_0x39aab3[_0x7e1f('0x26')]]['id']=this[_0x7e1f('0x11')][_0x39aab3['uniqueid']]['id'];this[_0x7e1f('0x25')][_0x39aab3[_0x7e1f('0x26')]][_0x7e1f('0x28')]=this[_0x7e1f('0x11')][_0x39aab3[_0x7e1f('0x26')]]['name'];}logger[_0x7e1f('0x29')](_0x39aab3[_0x7e1f('0x26')],this[_0x7e1f('0x11')][_0x39aab3[_0x7e1f('0x26')]]?'\x20hangup\x20sendFile\x20':_0x7e1f('0x52'),JSON['stringify'](this['channels'][_0x39aab3[_0x7e1f('0x26')]]));if(this[_0x7e1f('0x11')][_0x39aab3[_0x7e1f('0x26')]]){if(this['channels'][_0x39aab3[_0x7e1f('0x26')]][_0x7e1f('0x53')]>0x0&&this['channels'][_0x39aab3[_0x7e1f('0x26')]][_0x7e1f('0x18')]===_0x7e1f('0x54')){this[_0x7e1f('0x4e')](_0x39aab3[_0x7e1f('0x26')],!![]);}else{this[_0x7e1f('0x4e')](_0x39aab3[_0x7e1f('0x26')],![],this[_0x7e1f('0x25')][_0x39aab3[_0x7e1f('0x26')]][_0x7e1f('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x7e1f('0x25')][_0x39aab3[_0x7e1f('0x26')]]['faxstatusstring']:_0x7e1f('0x56'));}}}};Fax[_0x7e1f('0x1f')]['send']=function(_0x13bed8){var _0x3babd8=this;return new BPromise(function(_0x12d58f,_0x2e19ee){_0x3babd8[_0x7e1f('0x57')](_0x13bed8,_0x3babd8['faxAccounts'][_0x13bed8[_0x7e1f('0x58')]])['then'](function(_0x9b5777){ut['logger'](_0x7e1f('0x59'),_0x9b5777);_0x12d58f(ut[_0x7e1f('0x39')](_0x7e1f('0x5a')));})[_0x7e1f('0x42')](function(_0x3bd34b){ut[_0x7e1f('0x4b')](_0x7e1f('0x5b'),_0x3bd34b);updateStatus(_0x13bed8);_0x2e19ee(ut[_0x7e1f('0x39')]('Fax\x20failed'));});});};Fax[_0x7e1f('0x1f')]['checkAfterSend']=function(_0x16bb62){var _0x44821f=this;return new BPromise(function(_0x54d643,_0x19d9f0){var _0xa6b6a6=_0x44821f[_0x7e1f('0x5c')](_0x44821f['faxAccounts'][_0x16bb62[_0x7e1f('0x58')]][_0x7e1f('0x5d')],_0x16bb62);if(_0xa6b6a6['isValid']){_0x54d643(ut[_0x7e1f('0x39')](_0x7e1f('0x5e')));}else{_0x19d9f0(ut[_0x7e1f('0x39')](_0xa6b6a6[_0x7e1f('0x39')]));}});};function originate(_0x33fc8c,_0x4815da,_0x262cb7){return new BPromise(function(_0x5d3454,_0x4fa48c){if(_0x262cb7){var _0x284fbc=util[_0x7e1f('0x5f')](_0x7e1f('0x60'),path[_0x7e1f('0x3a')](_0x33fc8c[_0x7e1f('0x3')])[_0x7e1f('0x28')],_0x33fc8c[_0x7e1f('0x3')]);gs['execute'](_0x284fbc)['then'](function(){_0x33fc8c[_0x7e1f('0x3')]=util[_0x7e1f('0x5f')](_0x7e1f('0x61'),path[_0x7e1f('0x3a')](_0x33fc8c['path'])[_0x7e1f('0x62')],path[_0x7e1f('0x3a')](_0x33fc8c[_0x7e1f('0x3')])[_0x7e1f('0x28')]);_0x4815da[_0x7e1f('0x63')]=_0x33fc8c[_0x7e1f('0x3')];ut[_0x7e1f('0x4b')](_0x7e1f('0x64'),'');ami[_0x7e1f('0x65')](ut[_0x7e1f('0x66')](_0x33fc8c,_0x4815da))[_0x7e1f('0x3d')](function(_0x9cbd92){_0x5d3454(_0x9cbd92);})[_0x7e1f('0x42')](function(_0x52fc75){_0x4fa48c(_0x52fc75);});})[_0x7e1f('0x42')](function(_0x29f5e7){_0x4fa48c(_0x29f5e7);});}else{ami[_0x7e1f('0x65')](ut[_0x7e1f('0x66')](_0x33fc8c,_0x4815da))[_0x7e1f('0x3d')](function(_0x2dc565){_0x5d3454(_0x2dc565);})['catch'](function(_0x3c87d1){_0x4fa48c(_0x3c87d1);});}});}Fax['prototype'][_0x7e1f('0x57')]=function(_0x2dee63,_0x393676){var _0x34ae35=this;return new BPromise(function(_0x4dae3d,_0x14f50e){var _0x30506d=uuid['v4']();var _0x5634c9=ut[_0x7e1f('0x67')](_0x2dee63,_0x393676);_0x34ae35[_0x7e1f('0x11')][_0x30506d]=new Action(_0x30506d,_0x393676,_0x2dee63);var _0x1816ea=_0x34ae35[_0x7e1f('0x11')][_0x30506d];if(path[_0x7e1f('0x3a')](_0x2dee63['path'])[_0x7e1f('0x68')]===_0x7e1f('0x3b')){originate(_0x1816ea,_0x5634c9,!![])[_0x7e1f('0x3d')](function(_0x40e335){_0x4dae3d(_0x40e335);})[_0x7e1f('0x42')](function(_0x1d7106){_0x14f50e(_0x1d7106);});}else{originate(_0x1816ea,_0x5634c9,![])[_0x7e1f('0x3d')](function(_0x47e684){_0x4dae3d(_0x47e684);})['catch'](function(_0x1aef52){_0x14f50e(_0x1aef52);});}});};Fax[_0x7e1f('0x1f')][_0x7e1f('0x69')]=function(_0x46fff3){return!_[_0x7e1f('0x6a')](_0x46fff3)&&!_[_0x7e1f('0x6a')](_0x46fff3[_0x7e1f('0x28')])&&!_[_0x7e1f('0x6a')](_0x46fff3[_0x7e1f('0x6b')])&&_0x46fff3[_0x7e1f('0x6b')]&&!_['isNil'](this[_0x7e1f('0x10')][util[_0x7e1f('0x5f')](_0x7e1f('0x6c'),_0x46fff3['name'])])&&!_[_0x7e1f('0x6a')](this['trunks'][util['format'](_0x7e1f('0x6c'),_0x46fff3[_0x7e1f('0x28')])][_0x7e1f('0x30')])&&(this[_0x7e1f('0x10')][util[_0x7e1f('0x5f')]('SIP/%s',_0x46fff3[_0x7e1f('0x28')])][_0x7e1f('0x30')]===_0x7e1f('0x6d')||this[_0x7e1f('0x10')][util[_0x7e1f('0x5f')]('SIP/%s',_0x46fff3[_0x7e1f('0x28')])][_0x7e1f('0x30')]===_0x7e1f('0x6e'));};Fax[_0x7e1f('0x1f')][_0x7e1f('0x5c')]=function(_0x31da6f,_0x37b20b){if(!this[_0x7e1f('0x69')](_0x31da6f)){ut[_0x7e1f('0x4b')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x7e1f('0x6a')](_0x31da6f)?'':_0x31da6f['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x7e1f('0x6f')};}if(_[_0x7e1f('0x6a')](_0x37b20b['fax'])){ut[_0x7e1f('0x4b')](_0x7e1f('0x70'),JSON['stringify'](_0x37b20b));return{'isValid':![],'message':_0x7e1f('0x71')};}if(_[_0x7e1f('0x6a')](_0x37b20b[_0x7e1f('0x3')])){ut[_0x7e1f('0x4b')](_0x7e1f('0x72'),JSON[_0x7e1f('0x41')](_0x37b20b));return{'isValid':![],'message':_0x7e1f('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0xf0a6=['%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','newexten','syncNewExten','faxstatus','hangup','syncHangup','context','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','name','info','\x20syncNewchannel\x20','channel','prototype','variable','value','syncNewState','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','syncReceiveFax','remotestationid','resolution','transferrate','calleridnum','pagestransferred','\x20result\x20conversion\x20file\x20','message','.pdf','then','notify','catch','\x20notify\x20','error','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','parse','format'];(function(_0x1c7abf,_0x4964f1){var _0x42d357=function(_0x4b179e){while(--_0x4b179e){_0x1c7abf['push'](_0x1c7abf['shift']());}};_0x42d357(++_0x4964f1);}(_0xf0a6,0xf9));var _0x6f0a=function(_0x3abd3d,_0x561589){_0x3abd3d=_0x3abd3d-0x0;var _0x65f93c=_0xf0a6[_0x3abd3d];return _0x65f93c;};'use strict';var util=require(_0x6f0a('0x0'));var _=require('lodash');var BPromise=require(_0x6f0a('0x1'));var uuid=require(_0x6f0a('0x2'));var moment=require(_0x6f0a('0x3'));var path=require(_0x6f0a('0x4'));var tiff2pdf=require(_0x6f0a('0x5'));var gs=require(_0x6f0a('0x6'));var logger=require('../../../config/logger')(_0x6f0a('0x7'));var ami=require(_0x6f0a('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x6f0a('0x9'));var ut=require(_0x6f0a('0xa'));var Action=require('./action');var faxAccount=require(_0x6f0a('0xb'));var attachment=require(_0x6f0a('0xc'));var faxMessage=require(_0x6f0a('0xd'));function Fax(_0x447642){this['channels']={};this['faxAccounts']=_0x447642[_0x6f0a('0xe')];this[_0x6f0a('0xf')]=_0x447642[_0x6f0a('0xf')];this[_0x6f0a('0x10')]={};ami['on'](_0x6f0a('0x11'),this[_0x6f0a('0x12')][_0x6f0a('0x13')](this));ami['on'](_0x6f0a('0x14'),this['syncVarSet'][_0x6f0a('0x13')](this));ami['on'](_0x6f0a('0x15'),this['syncNewState'][_0x6f0a('0x13')](this));ami['on'](_0x6f0a('0x16'),this[_0x6f0a('0x17')][_0x6f0a('0x13')](this));ami['on'](_0x6f0a('0x18'),this['syncFaxStatus'][_0x6f0a('0x13')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x6f0a('0x13')](this));ami['on'](_0x6f0a('0x19'),this[_0x6f0a('0x1a')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x6f0a('0x13')](this));}Fax['prototype'][_0x6f0a('0x12')]=function(_0x46abac){if(_0x46abac[_0x6f0a('0x1b')]===_0x6f0a('0x1c')){for(var _0xac30d0 in this[_0x6f0a('0xe')]){if(this['faxAccounts'][_0x6f0a('0x1d')](_0xac30d0)){if(_0x46abac['exten']===this['faxAccounts'][_0xac30d0][_0x6f0a('0x1e')]){this[_0x6f0a('0x1f')][_0x46abac[_0x6f0a('0x20')]]={};this[_0x6f0a('0x1f')][_0x46abac['uniqueid']]['channel']=_0x46abac['channel'];this[_0x6f0a('0x1f')][_0x46abac[_0x6f0a('0x20')]]['id']=this[_0x6f0a('0xe')][_0xac30d0]['id'];this['channels'][_0x46abac[_0x6f0a('0x20')]]['name']=this['faxAccounts'][_0xac30d0][_0x6f0a('0x21')];logger[_0x6f0a('0x22')](_0x46abac[_0x6f0a('0x20')],_0x6f0a('0x23'));}}}}if(this[_0x6f0a('0x10')][_0x46abac[_0x6f0a('0x20')]]){this[_0x6f0a('0x1f')][_0x46abac[_0x6f0a('0x20')]]={};this['channels'][_0x46abac[_0x6f0a('0x20')]][_0x6f0a('0x24')]=_0x46abac[_0x6f0a('0x24')];logger[_0x6f0a('0x22')](_0x46abac[_0x6f0a('0x20')],_0x6f0a('0x23'));}};Fax[_0x6f0a('0x25')]['syncVarSet']=function(_0x2afd74){if(this['channels'][_0x2afd74[_0x6f0a('0x20')]]){for(var _0x54e654 in _0x2afd74[_0x6f0a('0x26')]){if(_0x2afd74['variable'][_0x6f0a('0x1d')](_0x54e654)){this['channels'][_0x2afd74[_0x6f0a('0x20')]][_0x54e654]=_0x2afd74[_0x6f0a('0x27')];}}}};Fax[_0x6f0a('0x25')][_0x6f0a('0x28')]=function(_0x128459){if(this[_0x6f0a('0x1f')][_0x128459[_0x6f0a('0x20')]]){this['channels'][_0x128459[_0x6f0a('0x20')]][_0x6f0a('0x29')]=_0x128459[_0x6f0a('0x29')];this[_0x6f0a('0x1f')][_0x128459[_0x6f0a('0x20')]][_0x6f0a('0x2a')]=_0x128459[_0x6f0a('0x2a')];}};Fax[_0x6f0a('0x25')][_0x6f0a('0x17')]=function(_0x4c2ffa){if(this[_0x6f0a('0x1f')][_0x4c2ffa[_0x6f0a('0x20')]]){for(var _0x3512fe in _0x4c2ffa[_0x6f0a('0x26')]){if(_0x4c2ffa[_0x6f0a('0x26')][_0x6f0a('0x1d')](_0x3512fe)){this[_0x6f0a('0x1f')][_0x4c2ffa[_0x6f0a('0x20')]][_0x3512fe]=_0x4c2ffa[_0x6f0a('0x27')];}}}};Fax['prototype'][_0x6f0a('0x2b')]=function(_0x49b99f){if(this['channels'][_0x49b99f[_0x6f0a('0x20')]]){this[_0x6f0a('0x1f')][_0x49b99f[_0x6f0a('0x20')]]['operation']=_0x49b99f[_0x6f0a('0x2c')];this[_0x6f0a('0x1f')][_0x49b99f['uniqueid']][_0x6f0a('0x2d')]=_0x49b99f[_0x6f0a('0x2d')];this['channels'][_0x49b99f[_0x6f0a('0x20')]][_0x6f0a('0x1e')]=_0x49b99f[_0x6f0a('0x1e')];this[_0x6f0a('0x1f')][_0x49b99f[_0x6f0a('0x20')]][_0x6f0a('0x2e')]=_0x49b99f[_0x6f0a('0x2e')];logger[_0x6f0a('0x22')](_0x49b99f[_0x6f0a('0x20')],'\x20syncFaxStatus\x20');}};Fax[_0x6f0a('0x25')][_0x6f0a('0x2f')]=function(_0x5a73cd){var _0x4f147d=this;if(this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]]){var _0x4eacf6=this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]]['id'];this['channels'][_0x5a73cd[_0x6f0a('0x20')]][_0x6f0a('0x30')]=_0x5a73cd[_0x6f0a('0x30')];this['channels'][_0x5a73cd[_0x6f0a('0x20')]]['pagestransferred']=_0x5a73cd['pagestransferred'];this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]][_0x6f0a('0x1e')]=_0x5a73cd[_0x6f0a('0x1e')];this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]]['resolution']=_0x5a73cd[_0x6f0a('0x31')];this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]][_0x6f0a('0x32')]=_0x5a73cd['transferrate'];this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]][_0x6f0a('0x2e')]=_0x5a73cd[_0x6f0a('0x2e')];this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]][_0x6f0a('0x33')]=_0x5a73cd[_0x6f0a('0x33')];if(this[_0x6f0a('0x1f')][_0x5a73cd[_0x6f0a('0x20')]][_0x6f0a('0x34')]>0x0){tiff2pdf(_0x5a73cd[_0x6f0a('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x343acf){logger[_0x6f0a('0x22')](_0x5a73cd[_0x6f0a('0x20')],_0x6f0a('0x35'),_0x343acf[_0x6f0a('0x36')]);attachment['create']({'name':path['parse'](_0x5a73cd[_0x6f0a('0x2e')])['name'],'basename':path['parse'](_0x5a73cd['filename'])[_0x6f0a('0x21')]+_0x6f0a('0x37'),'type':'application/pdf'})[_0x6f0a('0x38')](function(_0x173ee5){faxAccount[_0x6f0a('0x39')](_0x4eacf6,{'from':_0x5a73cd[_0x6f0a('0x33')],'mapKey':_0x6f0a('0x7'),'body':path['parse'](_0x5a73cd[_0x6f0a('0x2e')])[_0x6f0a('0x21')]+_0x6f0a('0x37'),'AttachmentId':_0x173ee5['id']})[_0x6f0a('0x3a')](function(_0x3f86d8){logger['error'](_0x5a73cd['uniqueid'],_0x6f0a('0x3b'),JSON['stringify'](_0x3f86d8));});})[_0x6f0a('0x3a')](function(_0x1b6364){logger[_0x6f0a('0x3c')](_0x5a73cd['uniqueid'],'\x20receiveFax\x20',JSON[_0x6f0a('0x3d')](_0x1b6364));});});}logger[_0x6f0a('0x22')](_0x5a73cd['uniqueid'],_0x6f0a('0x3e'));}};Fax['prototype'][_0x6f0a('0x3f')]=function(_0x5a6076){if(this[_0x6f0a('0x10')][_0x5a6076['uniqueid']]){_['merge'](this[_0x6f0a('0x1f')][_0x5a6076['uniqueid']],_[_0x6f0a('0x40')](_0x5a6076,[_0x6f0a('0x41'),_0x6f0a('0x42')]));}};function updateStatus(_0x27d437){if(_0x27d437[_0x6f0a('0x43')]){faxMessage['update'](_0x27d437[_0x6f0a('0x43')],{'failMessage':_0x6f0a('0x44')})[_0x6f0a('0x38')](function(_0xeb40b){ut[_0x6f0a('0x45')](_0x6f0a('0x46'),_0xeb40b);})[_0x6f0a('0x3a')](function(_0x22d3ad){ut[_0x6f0a('0x45')](_0x6f0a('0x47'),_0x22d3ad);});}else{ut[_0x6f0a('0x45')](_0x6f0a('0x48'));}}Fax[_0x6f0a('0x25')][_0x6f0a('0x49')]=function(_0x984389,_0x13d6ae,_0x49233e){var _0xd55de3=this;var _0x35906a={};if(_0x13d6ae){_0x35906a={'read':_0x13d6ae};}else{_0x35906a={'failMessage':_0x49233e};}if(this[_0x6f0a('0x10')][_0x984389]['AttachmentId']){faxMessage[_0x6f0a('0x4a')](this[_0x6f0a('0x10')][_0x984389]['AttachmentId'],_0x35906a)[_0x6f0a('0x38')](function(_0x3a5eca){ut[_0x6f0a('0x45')]('[Fax][Message][Updated]',_0x3a5eca);})[_0x6f0a('0x3a')](function(_0x5af590){ut[_0x6f0a('0x45')](_0x6f0a('0x4b'),_0x5af590);})['finally'](function(){delete _0xd55de3[_0x6f0a('0x1f')][_0x984389];delete _0xd55de3[_0x6f0a('0x10')][_0x984389];});}else{ut[_0x6f0a('0x45')](_0x6f0a('0x4c'));delete this[_0x6f0a('0x1f')][_0x984389];delete this[_0x6f0a('0x10')][_0x984389];}};Fax['prototype'][_0x6f0a('0x1a')]=function(_0x430c68){var _0x26e717=this;if(this[_0x6f0a('0x1f')][_0x430c68[_0x6f0a('0x20')]]){if(this[_0x6f0a('0x10')][_0x430c68[_0x6f0a('0x20')]]){this['channels'][_0x430c68[_0x6f0a('0x20')]]['id']=this[_0x6f0a('0x10')][_0x430c68[_0x6f0a('0x20')]]['id'];this[_0x6f0a('0x1f')][_0x430c68[_0x6f0a('0x20')]]['name']=this[_0x6f0a('0x10')][_0x430c68['uniqueid']]['name'];}logger[_0x6f0a('0x22')](_0x430c68['uniqueid'],this[_0x6f0a('0x10')][_0x430c68['uniqueid']]?_0x6f0a('0x4d'):_0x6f0a('0x4e'),JSON[_0x6f0a('0x3d')](this[_0x6f0a('0x1f')][_0x430c68['uniqueid']]));if(this['actions'][_0x430c68[_0x6f0a('0x20')]]){if(this[_0x6f0a('0x1f')][_0x430c68[_0x6f0a('0x20')]][_0x6f0a('0x4f')]>0x0&&this[_0x6f0a('0x1f')][_0x430c68[_0x6f0a('0x20')]][_0x6f0a('0x18')]==='SUCCESS'){this[_0x6f0a('0x49')](_0x430c68[_0x6f0a('0x20')],!![]);}else{this['updateStatus'](_0x430c68['uniqueid'],![],this[_0x6f0a('0x1f')][_0x430c68[_0x6f0a('0x20')]][_0x6f0a('0x50')]?_0x6f0a('0x51')+this[_0x6f0a('0x1f')][_0x430c68[_0x6f0a('0x20')]][_0x6f0a('0x50')]:_0x6f0a('0x52'));}}}};Fax[_0x6f0a('0x25')][_0x6f0a('0x53')]=function(_0x2e6864){var _0x44608b=this;return new BPromise(function(_0xc30cd0,_0x463899){_0x44608b[_0x6f0a('0x54')](_0x2e6864,_0x44608b[_0x6f0a('0xe')][_0x2e6864[_0x6f0a('0x55')]])[_0x6f0a('0x38')](function(_0x18401f){ut[_0x6f0a('0x45')](_0x6f0a('0x56'),_0x18401f);_0xc30cd0(ut[_0x6f0a('0x36')](_0x6f0a('0x57')));})[_0x6f0a('0x3a')](function(_0x5e901b){ut[_0x6f0a('0x45')](_0x6f0a('0x58'),_0x5e901b);updateStatus(_0x2e6864);_0x463899(ut[_0x6f0a('0x36')](_0x6f0a('0x59')));});});};Fax[_0x6f0a('0x25')][_0x6f0a('0x5a')]=function(_0x2ecb2a){var _0x20f3e4=this;return new BPromise(function(_0x51b665,_0x5e2e9d){var _0x2a779c=_0x20f3e4['checkTrunk'](_0x20f3e4[_0x6f0a('0xe')][_0x2ecb2a[_0x6f0a('0x55')]][_0x6f0a('0x5b')],_0x2ecb2a);if(_0x2a779c[_0x6f0a('0x5c')]){_0x51b665(ut[_0x6f0a('0x36')](_0x6f0a('0x5d')));}else{_0x5e2e9d(ut[_0x6f0a('0x36')](_0x2a779c['message']));}});};function originate(_0x59b9bf,_0x1f8d8b,_0x52e624){return new BPromise(function(_0x4864a9,_0x25cf02){if(_0x52e624){var _0x5a1a6b=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x6f0a('0x5e')](_0x59b9bf[_0x6f0a('0x4')])['name'],_0x59b9bf[_0x6f0a('0x4')]);gs['execute'](_0x5a1a6b)[_0x6f0a('0x38')](function(){_0x59b9bf[_0x6f0a('0x4')]=util[_0x6f0a('0x5f')](_0x6f0a('0x60'),path['parse'](_0x59b9bf[_0x6f0a('0x4')])[_0x6f0a('0x61')],path[_0x6f0a('0x5e')](_0x59b9bf[_0x6f0a('0x4')])[_0x6f0a('0x21')]);_0x1f8d8b[_0x6f0a('0x62')]=_0x59b9bf['path'];ut[_0x6f0a('0x45')](_0x6f0a('0x63'),'');ami[_0x6f0a('0x64')](ut[_0x6f0a('0x65')](_0x59b9bf,_0x1f8d8b))[_0x6f0a('0x38')](function(_0x1853d8){_0x4864a9(_0x1853d8);})[_0x6f0a('0x3a')](function(_0x23bcb6){_0x25cf02(_0x23bcb6);});})[_0x6f0a('0x3a')](function(_0x44a4ad){_0x25cf02(_0x44a4ad);});}else{ami[_0x6f0a('0x64')](ut[_0x6f0a('0x65')](_0x59b9bf,_0x1f8d8b))[_0x6f0a('0x38')](function(_0x490912){_0x4864a9(_0x490912);})[_0x6f0a('0x3a')](function(_0xc55c3d){_0x25cf02(_0xc55c3d);});}});}Fax[_0x6f0a('0x25')][_0x6f0a('0x54')]=function(_0x332787,_0x33a8d5){var _0x8c752a=this;return new BPromise(function(_0x15c87a,_0x2268ea){var _0x58b1c6=uuid['v4']();var _0x563b7d=ut['addVariables'](_0x332787,_0x33a8d5);_0x8c752a[_0x6f0a('0x10')][_0x58b1c6]=new Action(_0x58b1c6,_0x33a8d5,_0x332787);var _0x1e463f=_0x8c752a['actions'][_0x58b1c6];if(path[_0x6f0a('0x5e')](_0x332787[_0x6f0a('0x4')])['ext']==='.pdf'){originate(_0x1e463f,_0x563b7d,!![])['then'](function(_0x1a9846){_0x15c87a(_0x1a9846);})[_0x6f0a('0x3a')](function(_0x3ad55b){_0x2268ea(_0x3ad55b);});}else{originate(_0x1e463f,_0x563b7d,![])['then'](function(_0x3bdd1c){_0x15c87a(_0x3bdd1c);})[_0x6f0a('0x3a')](function(_0x34f1ab){_0x2268ea(_0x34f1ab);});}});};Fax[_0x6f0a('0x25')][_0x6f0a('0x66')]=function(_0x437b13){return!_[_0x6f0a('0x67')](_0x437b13)&&!_[_0x6f0a('0x67')](_0x437b13['name'])&&!_['isNil'](_0x437b13[_0x6f0a('0x68')])&&_0x437b13[_0x6f0a('0x68')]&&!_[_0x6f0a('0x67')](this[_0x6f0a('0xf')][util[_0x6f0a('0x5f')](_0x6f0a('0x69'),_0x437b13[_0x6f0a('0x21')])])&&!_[_0x6f0a('0x67')](this[_0x6f0a('0xf')][util[_0x6f0a('0x5f')](_0x6f0a('0x69'),_0x437b13['name'])][_0x6f0a('0x2d')])&&(this[_0x6f0a('0xf')][util[_0x6f0a('0x5f')](_0x6f0a('0x69'),_0x437b13[_0x6f0a('0x21')])][_0x6f0a('0x2d')]===_0x6f0a('0x6a')||this[_0x6f0a('0xf')][util[_0x6f0a('0x5f')]('SIP/%s',_0x437b13['name'])][_0x6f0a('0x2d')]==='unmonitored');};Fax[_0x6f0a('0x25')][_0x6f0a('0x6b')]=function(_0x113e64,_0x2e7f1e){if(!this[_0x6f0a('0x66')](_0x113e64)){ut[_0x6f0a('0x45')](_0x6f0a('0x6c'),_[_0x6f0a('0x67')](_0x113e64)?'':_0x113e64[_0x6f0a('0x21')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6f0a('0x6d')};}if(_[_0x6f0a('0x67')](_0x2e7f1e[_0x6f0a('0x7')])){ut[_0x6f0a('0x45')](_0x6f0a('0x6e'),JSON[_0x6f0a('0x3d')](_0x2e7f1e));return{'isValid':![],'message':_0x6f0a('0x6f')};}if(_['isNil'](_0x2e7f1e[_0x6f0a('0x4')])){ut['logger'](_0x6f0a('0x70'),JSON[_0x6f0a('0x3d')](_0x2e7f1e));return{'isValid':![],'message':_0x6f0a('0x71')};}return{'isValid':!![],'message':_0x6f0a('0x72')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index c435bd9..6e198ac 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 _0xcefc=['[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch'];(function(_0x3929be,_0x45d2b4){var _0x74df25=function(_0x174aae){while(--_0x174aae){_0x3929be['push'](_0x3929be['shift']());}};_0x74df25(++_0x45d2b4);}(_0xcefc,0x1b9));var _0xccef=function(_0x11e5b3,_0x1f6d38){_0x11e5b3=_0x11e5b3-0x0;var _0x1863f4=_0xcefc[_0x11e5b3];return _0x1863f4;};'use strict';var util=require(_0xccef('0x0'));var BPromise=require(_0xccef('0x1'));var logger=require('../../../config/logger')(_0xccef('0x2'));var _=require(_0xccef('0x3'));var faxAccount=require(_0xccef('0x4'));function loggerCatch(_0x1120ff){return function(_0x361bb4){logger[_0xccef('0x5')](_0x1120ff,util[_0xccef('0x6')](_0x361bb4,{'showHidden':![],'depth':null}));};}exports[_0xccef('0x7')]=function(_0x1c14b2,_0x565ea9){return BPromise['resolve']()[_0xccef('0x8')](faxAccount[_0xccef('0x7')](_0x1c14b2,_0x565ea9))[_0xccef('0x9')](loggerCatch(_0xccef('0xa')));}; \ No newline at end of file +var _0x67f3=['lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x67f3,0xce));var _0x367f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x67f3[_0x46e363];return _0x3fb059;};'use strict';var util=require('util');var BPromise=require(_0x367f('0x0'));var logger=require(_0x367f('0x1'))(_0x367f('0x2'));var _=require(_0x367f('0x3'));var faxAccount=require(_0x367f('0x4'));function loggerCatch(_0x1d5fe9){return function(_0x281b1b){logger[_0x367f('0x5')](_0x1d5fe9,util[_0x367f('0x6')](_0x281b1b,{'showHidden':![],'depth':null}));};}exports[_0x367f('0x7')]=function(_0x25e1e1,_0x17e425){return BPromise['resolve']()[_0x367f('0x8')](faxAccount[_0x367f('0x7')](_0x25e1e1,_0x17e425))[_0x367f('0x9')](loggerCatch(_0x367f('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9b7de66..4590269 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 _0x5686=['bluebird','child_process','exec','Exec\x20gs','info','\x20Error\x20:','util','fax'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x5686,0xb6));var _0x6568=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x5686[_0x347399];return _0x24e7be;};'use strict';var util=require(_0x6568('0x0'));var logger=require('../../../../config/logger')(_0x6568('0x1'));var BPromise=require(_0x6568('0x2'));var exec=require(_0x6568('0x3'))[_0x6568('0x4')];exports['execute']=function(_0x40092b){return new BPromise(function(_0x1a7b19,_0x43fc05){exec(_0x40092b,function(_0x18e833,_0x276310,_0x1d9400){logger['info'](_0x6568('0x5'),_0x276310);if(_0x18e833){logger[_0x6568('0x6')](_0x6568('0x5'),_0x6568('0x7'),util['inspect'](_0x18e833,{'showHidden':![],'depth':null}),_0x276310,_0x1d9400);_0x43fc05(_0x18e833);}_0x1a7b19(_0x276310);});});}; \ No newline at end of file +var _0x2547=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info'];(function(_0x1af25e,_0x35c029){var _0x15318e=function(_0x4d8845){while(--_0x4d8845){_0x1af25e['push'](_0x1af25e['shift']());}};_0x15318e(++_0x35c029);}(_0x2547,0x92));var _0x7254=function(_0x22b257,_0xc85f7e){_0x22b257=_0x22b257-0x0;var _0x11fb1f=_0x2547[_0x22b257];return _0x11fb1f;};'use strict';var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var BPromise=require(_0x7254('0x3'));var exec=require(_0x7254('0x4'))[_0x7254('0x5')];exports[_0x7254('0x6')]=function(_0x1f9aca){return new BPromise(function(_0x36c426,_0x5056da){exec(_0x1f9aca,function(_0x5c26ac,_0x1088bc,_0x576d8c){logger[_0x7254('0x7')](_0x7254('0x8'),_0x1088bc);if(_0x5c26ac){logger[_0x7254('0x7')](_0x7254('0x8'),_0x7254('0x9'),util[_0x7254('0xa')](_0x5c26ac,{'showHidden':![],'depth':null}),_0x1088bc,_0x576d8c);_0x5056da(_0x5c26ac);}_0x36c426(_0x1088bc);});});}; \ 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 d528513..baac970 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 _0x4c62=['minrate','format','modem','gateway','t38timeout','variablesAction','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util','lodash','../../../../config/logger','message','logger','info','inspect','addVariables'];(function(_0x37ab7b,_0x509b5b){var _0x3b871f=function(_0x11c741){while(--_0x11c741){_0x37ab7b['push'](_0x37ab7b['shift']());}};_0x3b871f(++_0x509b5b);}(_0x4c62,0xc0));var _0x24c6=function(_0x2f581a,_0x460911){_0x2f581a=_0x2f581a-0x0;var _0x40ab4a=_0x4c62[_0x2f581a];return _0x40ab4a;};'use strict';var util=require(_0x24c6('0x0'));var _=require(_0x24c6('0x1'));var moment=require('moment');var logger=require(_0x24c6('0x2'))('fax');exports[_0x24c6('0x3')]=function(_0xc94c93){return{'message':_0xc94c93};};exports[_0x24c6('0x4')]=function(_0xa04e9,_0xc51857){logger[_0x24c6('0x5')](_0xa04e9,util[_0x24c6('0x6')](_0xc51857,{'showHidden':![],'depth':null}));};exports[_0x24c6('0x7')]=function(_0x5199bc,_0x483408){var _0x2c8b6f={'XMF-ECM':_0x483408['ecm'],'XMF-HEADERINFO':_0x483408['headerinfo'],'XMF-MINRATE':_0x483408[_0x24c6('0x8')],'XMF-MAXRATE':_0x483408['maxrate'],'XMF-MODEM':util[_0x24c6('0x9')]('\x22%s\x22',_0x483408[_0x24c6('0xa')]),'XMF-GATEWAY':_0x483408[_0x24c6('0xb')],'XMF-FAXDETECT':_0x483408['faxdetect'],'XMF-T38TIMEOUT':_0x483408[_0x24c6('0xc')],'XMF-LOCALSTATIONID':_0x483408['localstationid'],'XMF-PATH':_0x5199bc['path']};return _0x2c8b6f;};exports[_0x24c6('0xd')]=function(_0x5651e0,_0x163b85){return{'actionid':_0x5651e0['uniqueid'],'action':_0x24c6('0xe'),'channel':_0x5651e0[_0x24c6('0xf')],'Exten':_0x24c6('0x10'),'Context':'from-sip','Priority':'1','callerid':util[_0x24c6('0x9')](_0x24c6('0x11'),_0x5651e0[_0x24c6('0x12')]?_0x5651e0[_0x24c6('0x12')]:'',_0x5651e0['localstationid']),'variable':_0x163b85,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5651e0[_0x24c6('0x13')]};}; \ No newline at end of file +var _0x3fe5=['util','moment','../../../../config/logger','fax','logger','inspect','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','uniqueid','originate','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>'];(function(_0x63db7d,_0x33f080){var _0x4576f0=function(_0x1c21a3){while(--_0x1c21a3){_0x63db7d['push'](_0x63db7d['shift']());}};_0x4576f0(++_0x33f080);}(_0x3fe5,0x1b8));var _0x53fe=function(_0x546950,_0x331303){_0x546950=_0x546950-0x0;var _0xd2d140=_0x3fe5[_0x546950];return _0xd2d140;};'use strict';var util=require(_0x53fe('0x0'));var _=require('lodash');var moment=require(_0x53fe('0x1'));var logger=require(_0x53fe('0x2'))(_0x53fe('0x3'));exports['message']=function(_0x397b87){return{'message':_0x397b87};};exports[_0x53fe('0x4')]=function(_0xca90e9,_0x1d88b6){logger['info'](_0xca90e9,util[_0x53fe('0x5')](_0x1d88b6,{'showHidden':![],'depth':null}));};exports[_0x53fe('0x6')]=function(_0x2295ca,_0x2725a9){var _0x550e43={'XMF-ECM':_0x2725a9[_0x53fe('0x7')],'XMF-HEADERINFO':_0x2725a9[_0x53fe('0x8')],'XMF-MINRATE':_0x2725a9['minrate'],'XMF-MAXRATE':_0x2725a9[_0x53fe('0x9')],'XMF-MODEM':util['format'](_0x53fe('0xa'),_0x2725a9[_0x53fe('0xb')]),'XMF-GATEWAY':_0x2725a9[_0x53fe('0xc')],'XMF-FAXDETECT':_0x2725a9[_0x53fe('0xd')],'XMF-T38TIMEOUT':_0x2725a9[_0x53fe('0xe')],'XMF-LOCALSTATIONID':_0x2725a9[_0x53fe('0xf')],'XMF-PATH':_0x2295ca['path']};return _0x550e43;};exports['variablesAction']=function(_0xd3f0cd,_0x50efd7){return{'actionid':_0xd3f0cd[_0x53fe('0x10')],'action':_0x53fe('0x11'),'channel':_0xd3f0cd[_0x53fe('0x12')],'Exten':_0x53fe('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x53fe('0x14')](_0x53fe('0x15'),_0xd3f0cd[_0x53fe('0x8')]?_0xd3f0cd['headerinfo']:'',_0xd3f0cd['localstationid']),'variable':_0x50efd7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xd3f0cd[_0x53fe('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 1dc91bc..dc32ec9 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 _0x3436=['getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts'];(function(_0x1d7599,_0x49929f){var _0x55da12=function(_0x3f7a5f){while(--_0x3f7a5f){_0x1d7599['push'](_0x1d7599['shift']());}};_0x55da12(++_0x49929f);}(_0x3436,0x11e));var _0x6343=function(_0x2916b6,_0x5b439c){_0x2916b6=_0x2916b6-0x0;var _0x2a1bfd=_0x3436[_0x2916b6];return _0x2a1bfd;};'use strict';var BPromise=require('bluebird');var util=require(_0x6343('0x0'));var moment=require(_0x6343('0x1'));var server=require(_0x6343('0x2'));var Realtime=require(_0x6343('0x3'));var Report=require(_0x6343('0x4'));var Acw=require(_0x6343('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x6343('0x6'));var Preview=require(_0x6343('0x7'));var Fax=require(_0x6343('0x8'));var user=require(_0x6343('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x6343('0xa'));var voiceCallReport=require(_0x6343('0xb'));var trunk=require(_0x6343('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x6343('0xd'));var cmHopperHistory=require(_0x6343('0xe'));var campaign=require(_0x6343('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x6343('0x10'));var zendesk=require(_0x6343('0x11'));var salesforce=require(_0x6343('0x12'));var sugarcrm=require(_0x6343('0x13'));var freshdesk=require(_0x6343('0x14'));var desk=require(_0x6343('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x6343('0x16'));var freshsales=require(_0x6343('0x17'));var servicenow=require(_0x6343('0x18'));var dynamics365=require(_0x6343('0x19'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6343('0x1a')](_0x6343('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6343('0x1a')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x6343('0x1c')](user[_0x6343('0x1d')]())['then'](realtime[_0x6343('0x1e')]())[_0x6343('0x1c')](user[_0x6343('0x1f')]())[_0x6343('0x1c')](realtime[_0x6343('0x20')]())['then'](trunk[_0x6343('0x21')]())[_0x6343('0x1c')](realtime[_0x6343('0x22')]())[_0x6343('0x1c')](voiceQueue['getVoiceQueues']())[_0x6343('0x1c')](realtime[_0x6343('0x23')]())[_0x6343('0x1c')](trigger[_0x6343('0x24')]())[_0x6343('0x1c')](realtime[_0x6343('0x25')]())[_0x6343('0x1c')](template[_0x6343('0x26')]())['then'](realtime[_0x6343('0x27')]())['then'](zendesk[_0x6343('0x28')]())[_0x6343('0x1c')](realtime[_0x6343('0x29')]())['then'](salesforce[_0x6343('0x2a')]())[_0x6343('0x1c')](realtime[_0x6343('0x2b')]())[_0x6343('0x1c')](sugarcrm[_0x6343('0x2c')]())[_0x6343('0x1c')](realtime[_0x6343('0x2d')]())['then'](freshdesk[_0x6343('0x2e')]())[_0x6343('0x1c')](realtime[_0x6343('0x2f')]())[_0x6343('0x1c')](desk[_0x6343('0x30')]())[_0x6343('0x1c')](realtime[_0x6343('0x31')]())['then'](zoho[_0x6343('0x32')]())[_0x6343('0x1c')](realtime['initZohoAccounts']())[_0x6343('0x1c')](vtiger[_0x6343('0x33')]())[_0x6343('0x1c')](realtime[_0x6343('0x34')]())['then'](freshsales['getFreshsalesAccounts']())[_0x6343('0x1c')](realtime[_0x6343('0x35')]())[_0x6343('0x1c')](servicenow[_0x6343('0x36')]())[_0x6343('0x1c')](realtime[_0x6343('0x37')]())[_0x6343('0x1c')](dynamics365['getDynamics365Accounts']())[_0x6343('0x1c')](realtime[_0x6343('0x38')]())[_0x6343('0x1c')](campaign['getCampaigns']())['then'](realtime['initCampaigns']())[_0x6343('0x1c')](voiceExtension[_0x6343('0x39')]())['then'](realtime[_0x6343('0x3a')]())[_0x6343('0x1c')](faxAccount[_0x6343('0x3b')]())[_0x6343('0x1c')](realtime[_0x6343('0x3c')]())[_0x6343('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x6343('0x3d')]())[_0x6343('0x1c')](realtime[_0x6343('0x3e')]())[_0x6343('0x1c')](cmHopperHistory[_0x6343('0x3f')]())[_0x6343('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0x6343('0x1c')](cmHopperHistory[_0x6343('0x40')]())[_0x6343('0x1c')](realtime[_0x6343('0x41')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x6343('0x1c')](realtime['initVoiceCallReports']())['then'](function(_0x225984){})[_0x6343('0x42')](function(_0x2f0563){console['log'](_0x2f0563);});}function main(){return server['listen'](realtime,preview,fax)[_0x6343('0x1c')](function(_0x4000ac){return initRealtime();})[_0x6343('0x1c')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6343('0x42')](function(_0x4599ac){console[_0x6343('0x43')](_0x4599ac);});}main(); \ No newline at end of file +var _0xacd1=['getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','listen','sync','bluebird','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x2c0389,_0x2d49e0){var _0x4d70d2=function(_0x4f55fb){while(--_0x4f55fb){_0x2c0389['push'](_0x2c0389['shift']());}};_0x4d70d2(++_0x2d49e0);}(_0xacd1,0x160));var _0x1acd=function(_0x568781,_0x45539f){_0x568781=_0x568781-0x0;var _0x3ca732=_0xacd1[_0x568781];return _0x3ca732;};'use strict';var BPromise=require(_0x1acd('0x0'));var util=require(_0x1acd('0x1'));var moment=require(_0x1acd('0x2'));var server=require('./server');var Realtime=require(_0x1acd('0x3'));var Report=require(_0x1acd('0x4'));var Acw=require(_0x1acd('0x5'));var Trigger=require(_0x1acd('0x6'));var Dialer=require('./dialer');var Preview=require(_0x1acd('0x7'));var Fax=require(_0x1acd('0x8'));var user=require(_0x1acd('0x9'));var voiceQueue=require(_0x1acd('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x1acd('0xb'));var trunk=require(_0x1acd('0xc'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x1acd('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x1acd('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x1acd('0xf'));var sugarcrm=require(_0x1acd('0x10'));var freshdesk=require(_0x1acd('0x11'));var desk=require(_0x1acd('0x12'));var zoho=require(_0x1acd('0x13'));var vtiger=require(_0x1acd('0x14'));var freshsales=require(_0x1acd('0x15'));var servicenow=require(_0x1acd('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1acd('0x17')](_0x1acd('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x1acd('0x19')](user[_0x1acd('0x1a')]())[_0x1acd('0x19')](realtime[_0x1acd('0x1b')]())[_0x1acd('0x19')](user[_0x1acd('0x1c')]())[_0x1acd('0x19')](realtime[_0x1acd('0x1d')]())[_0x1acd('0x19')](trunk[_0x1acd('0x1e')]())[_0x1acd('0x19')](realtime['initTrunks']())[_0x1acd('0x19')](voiceQueue[_0x1acd('0x1f')]())[_0x1acd('0x19')](realtime[_0x1acd('0x20')]())[_0x1acd('0x19')](trigger[_0x1acd('0x21')]())[_0x1acd('0x19')](realtime['initTriggers']())[_0x1acd('0x19')](template[_0x1acd('0x22')]())[_0x1acd('0x19')](realtime[_0x1acd('0x23')]())[_0x1acd('0x19')](zendesk['getZendeskAccounts']())[_0x1acd('0x19')](realtime[_0x1acd('0x24')]())[_0x1acd('0x19')](salesforce[_0x1acd('0x25')]())[_0x1acd('0x19')](realtime[_0x1acd('0x26')]())[_0x1acd('0x19')](sugarcrm[_0x1acd('0x27')]())[_0x1acd('0x19')](realtime[_0x1acd('0x28')]())[_0x1acd('0x19')](freshdesk['getFreshdeskAccounts']())[_0x1acd('0x19')](realtime['initFreshdeskAccounts']())[_0x1acd('0x19')](desk[_0x1acd('0x29')]())[_0x1acd('0x19')](realtime[_0x1acd('0x2a')]())[_0x1acd('0x19')](zoho[_0x1acd('0x2b')]())[_0x1acd('0x19')](realtime[_0x1acd('0x2c')]())['then'](vtiger[_0x1acd('0x2d')]())[_0x1acd('0x19')](realtime[_0x1acd('0x2e')]())[_0x1acd('0x19')](freshsales[_0x1acd('0x2f')]())[_0x1acd('0x19')](realtime[_0x1acd('0x30')]())['then'](servicenow[_0x1acd('0x31')]())['then'](realtime['initServicenowAccounts']())[_0x1acd('0x19')](dynamics365[_0x1acd('0x32')]())['then'](realtime[_0x1acd('0x33')]())[_0x1acd('0x19')](campaign[_0x1acd('0x34')]())[_0x1acd('0x19')](realtime[_0x1acd('0x35')]())[_0x1acd('0x19')](voiceExtension[_0x1acd('0x36')]())[_0x1acd('0x19')](realtime[_0x1acd('0x37')]())['then'](faxAccount[_0x1acd('0x38')]())['then'](realtime[_0x1acd('0x39')]())[_0x1acd('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0x1acd('0x3a')]()[_0x1acd('0x19')](voiceQueueReport[_0x1acd('0x3b')]())['then'](realtime[_0x1acd('0x3c')]())[_0x1acd('0x19')](cmHopperHistory[_0x1acd('0x3d')]())[_0x1acd('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x1acd('0x19')](cmHopperHistory[_0x1acd('0x3e')]())[_0x1acd('0x19')](realtime[_0x1acd('0x3f')]())[_0x1acd('0x19')](voiceCallReport[_0x1acd('0x40')]())[_0x1acd('0x19')](realtime['initVoiceCallReports']())[_0x1acd('0x19')](function(_0x7da7a6){})[_0x1acd('0x41')](function(_0x40c1d2){console['log'](_0x40c1d2);});}function main(){return server[_0x1acd('0x42')](realtime,preview,fax)[_0x1acd('0x19')](function(_0x392a8d){return initRealtime();})[_0x1acd('0x19')](function(){return initParams();})[_0x1acd('0x19')](function(){report[_0x1acd('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x160557){console['log'](_0x160557);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1edcef2..3ff19f6 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 _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0xaea0d0,_0x142b65){var _0x35f933=function(_0x5ed783){while(--_0x5ed783){_0xaea0d0['push'](_0xaea0d0['shift']());}};_0x35f933(++_0x142b65);}(_0x34e8,0x12c));var _0x834e=function(_0x16db0b,_0x77a7dc){_0x16db0b=_0x16db0b-0x0;var _0x56d174=_0x34e8[_0x16db0b];return _0x56d174;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x55acb9,_0x1e7fda){var _0x2e96b3=function(_0xc52ff3){while(--_0xc52ff3){_0x55acb9['push'](_0x55acb9['shift']());}};_0x2e96b3(++_0x1e7fda);}(_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 md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('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 6e1cf51..295b0e0 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 _0x1189=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone'];(function(_0x2b2396,_0x93f664){var _0x2f0bfe=function(_0x570712){while(--_0x570712){_0x2b2396['push'](_0x2b2396['shift']());}};_0x2f0bfe(++_0x93f664);}(_0x1189,0x1af));var _0x9118=function(_0x5b817e,_0x5938ab){_0x5b817e=_0x5b817e-0x0;var _0x1f1e8a=_0x1189[_0x5b817e];return _0x1f1e8a;};'use strict';function Campaign(_0x5e2fd4){this['id']=_0x5e2fd4['id']||0x0;this[_0x9118('0x0')]=_0x5e2fd4['name']||'';this[_0x9118('0x1')]=_0x5e2fd4[_0x9118('0x1')]||'campaign';this[_0x9118('0x2')]=0x0;this[_0x9118('0x3')]=0x0;this[_0x9118('0x4')]=0x0;this[_0x9118('0x5')]=0x0;this[_0x9118('0x6')]='';this[_0x9118('0x7')]=!![];this['active']=_0x5e2fd4['active'];this[_0x9118('0x8')]=_0x5e2fd4[_0x9118('0x8')];this[_0x9118('0x9')]=_0x5e2fd4[_0x9118('0x9')]||null;this[_0x9118('0xa')]=_0x5e2fd4[_0x9118('0xa')]?_0x5e2fd4[_0x9118('0xa')]:null;this[_0x9118('0xb')]=_0x5e2fd4['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5e2fd4['dialOriginateCallerIdNumber'];this[_0x9118('0xc')]=_0x5e2fd4[_0x9118('0xc')]||0x1e;this[_0x9118('0xd')]=_0x5e2fd4[_0x9118('0xd')];this[_0x9118('0xe')]=_0x5e2fd4[_0x9118('0xe')];this[_0x9118('0xf')]=_0x5e2fd4[_0x9118('0xf')];this[_0x9118('0x10')]=_0x5e2fd4['dialBusyRetryFrequency'];this[_0x9118('0x11')]=_0x5e2fd4[_0x9118('0x11')];this[_0x9118('0x12')]=_0x5e2fd4[_0x9118('0x12')];this['dialGlobalMaxRetry']=_0x5e2fd4[_0x9118('0x13')];this[_0x9118('0x14')]=_0x5e2fd4[_0x9118('0x14')]||0x3;this[_0x9118('0x15')]=_0x5e2fd4[_0x9118('0x15')]||0x96;this[_0x9118('0x16')]=_0x5e2fd4['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x5e2fd4['dialDropRetryFrequency']||0x96;this[_0x9118('0x17')]=_0x5e2fd4[_0x9118('0x17')]||0x3;this[_0x9118('0x18')]=_0x5e2fd4[_0x9118('0x18')]||0x96;this[_0x9118('0x19')]=_0x5e2fd4[_0x9118('0x19')]||0x3;this[_0x9118('0x1a')]=_0x5e2fd4[_0x9118('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x5e2fd4[_0x9118('0x1b')]||0x3;this[_0x9118('0x1c')]=_0x5e2fd4[_0x9118('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x5e2fd4['dialOrderByScheduledAt']||_0x9118('0x1d');this[_0x9118('0x1e')]=_0x5e2fd4[_0x9118('0x1e')]||undefined;this[_0x9118('0x1f')]=_0x5e2fd4[_0x9118('0x1f')]||undefined;this[_0x9118('0x20')]=_0x5e2fd4[_0x9118('0x20')]||undefined;this[_0x9118('0x21')]=_0x5e2fd4[_0x9118('0x21')]?_0x5e2fd4[_0x9118('0x21')]:undefined;this['Trunk']=_0x5e2fd4['Trunk']?_0x5e2fd4[_0x9118('0x22')]:undefined;this[_0x9118('0x23')]=_0x5e2fd4[_0x9118('0x23')]?_0x5e2fd4[_0x9118('0x23')]:undefined;this[_0x9118('0x24')]=_0x5e2fd4['SquareProject']?_0x5e2fd4[_0x9118('0x24')]:undefined;this[_0x9118('0x25')]=_0x5e2fd4[_0x9118('0x24')]?_0x5e2fd4[_0x9118('0x24')][_0x9118('0x0')]:undefined;this[_0x9118('0x26')]=_0x5e2fd4[_0x9118('0x26')]||![];this[_0x9118('0x27')]=_0x5e2fd4[_0x9118('0x27')];this[_0x9118('0x28')]=_0x5e2fd4[_0x9118('0x28')];this[_0x9118('0x29')]=_0x5e2fd4[_0x9118('0x29')];this[_0x9118('0x2a')]=_0x5e2fd4[_0x9118('0x2a')];this['dialAMDMinWordLength']=_0x5e2fd4[_0x9118('0x2b')];this[_0x9118('0x2c')]=_0x5e2fd4[_0x9118('0x2c')];this[_0x9118('0x2d')]=_0x5e2fd4['dialAMDMaximumNumberOfWords'];this[_0x9118('0x2e')]=_0x5e2fd4[_0x9118('0x2e')];this[_0x9118('0x2f')]=_0x5e2fd4['dialAMDMaximumWordLength'];}module[_0x9118('0x30')]=Campaign; \ No newline at end of file +var _0x8f16=['ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp'];(function(_0x84c261,_0x2cfcbd){var _0x4d4432=function(_0x4900cf){while(--_0x4900cf){_0x84c261['push'](_0x84c261['shift']());}};_0x4d4432(++_0x2cfcbd);}(_0x8f16,0x88));var _0x68f1=function(_0x39aef8,_0x408b06){_0x39aef8=_0x39aef8-0x0;var _0x43e31c=_0x8f16[_0x39aef8];return _0x43e31c;};'use strict';function Campaign(_0x43e988){this['id']=_0x43e988['id']||0x0;this[_0x68f1('0x0')]=_0x43e988[_0x68f1('0x0')]||'';this[_0x68f1('0x1')]=_0x43e988[_0x68f1('0x1')]||_0x68f1('0x2');this[_0x68f1('0x3')]=0x0;this[_0x68f1('0x4')]=0x0;this[_0x68f1('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x68f1('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x68f1('0x7')]=_0x43e988[_0x68f1('0x7')];this['limitCalls']=_0x43e988[_0x68f1('0x8')];this[_0x68f1('0x9')]=_0x43e988[_0x68f1('0x9')]||null;this[_0x68f1('0xa')]=_0x43e988[_0x68f1('0xa')]?_0x43e988[_0x68f1('0xa')]:null;this['dialOriginateCallerIdName']=_0x43e988['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x43e988[_0x68f1('0xb')];this['dialOriginateTimeout']=_0x43e988[_0x68f1('0xc')]||0x1e;this[_0x68f1('0xd')]=_0x43e988[_0x68f1('0xd')];this[_0x68f1('0xe')]=_0x43e988['dialCongestionRetryFrequency'];this[_0x68f1('0xf')]=_0x43e988[_0x68f1('0xf')];this[_0x68f1('0x10')]=_0x43e988[_0x68f1('0x10')];this[_0x68f1('0x11')]=_0x43e988[_0x68f1('0x11')];this['dialNoAnswerRetryFrequency']=_0x43e988[_0x68f1('0x12')];this[_0x68f1('0x13')]=_0x43e988['dialGlobalMaxRetry'];this[_0x68f1('0x14')]=_0x43e988[_0x68f1('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x43e988[_0x68f1('0x15')]||0x96;this[_0x68f1('0x16')]=_0x43e988[_0x68f1('0x16')]||0x3;this[_0x68f1('0x17')]=_0x43e988[_0x68f1('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x43e988['dialAbandonedMaxRetry']||0x3;this[_0x68f1('0x18')]=_0x43e988[_0x68f1('0x18')]||0x96;this[_0x68f1('0x19')]=_0x43e988['dialMachineMaxRetry']||0x3;this[_0x68f1('0x1a')]=_0x43e988[_0x68f1('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x43e988[_0x68f1('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x43e988['dialAgentRejectRetryFrequency']||0x96;this[_0x68f1('0x1c')]=_0x43e988[_0x68f1('0x1c')]||'DESC';this[_0x68f1('0x1d')]=_0x43e988['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x43e988['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x43e988[_0x68f1('0x1e')]||undefined;this[_0x68f1('0x1f')]=_0x43e988[_0x68f1('0x1f')]?_0x43e988['TrunkBackup']:undefined;this[_0x68f1('0x20')]=_0x43e988['Trunk']?_0x43e988['Trunk']:undefined;this[_0x68f1('0x21')]=_0x43e988[_0x68f1('0x21')]?_0x43e988[_0x68f1('0x21')]:undefined;this['SquareProject']=_0x43e988['SquareProject']?_0x43e988[_0x68f1('0x22')]:undefined;this[_0x68f1('0x23')]=_0x43e988[_0x68f1('0x22')]?_0x43e988[_0x68f1('0x22')][_0x68f1('0x0')]:undefined;this[_0x68f1('0x24')]=_0x43e988[_0x68f1('0x24')]||![];this[_0x68f1('0x25')]=_0x43e988['dialAMDInitialSilence'];this[_0x68f1('0x26')]=_0x43e988[_0x68f1('0x26')];this[_0x68f1('0x27')]=_0x43e988[_0x68f1('0x27')];this[_0x68f1('0x28')]=_0x43e988[_0x68f1('0x28')];this['dialAMDMinWordLength']=_0x43e988[_0x68f1('0x29')];this[_0x68f1('0x2a')]=_0x43e988[_0x68f1('0x2a')];this[_0x68f1('0x2b')]=_0x43e988[_0x68f1('0x2b')];this[_0x68f1('0x2c')]=_0x43e988[_0x68f1('0x2c')];this[_0x68f1('0x2d')]=_0x43e988[_0x68f1('0x2d')];}module[_0x68f1('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 24febbe..caceadc 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 _0x7008=['channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitors','mohtime','exports','starttime'];(function(_0x58bd65,_0x381aaf){var _0x390606=function(_0x3bc106){while(--_0x3bc106){_0x58bd65['push'](_0x58bd65['shift']());}};_0x390606(++_0x381aaf);}(_0x7008,0x185));var _0x8700=function(_0x4f2525,_0x14583a){_0x4f2525=_0x4f2525-0x0;var _0x4cce9a=_0x7008[_0x4f2525];return _0x4cce9a;};'use strict';function Channel(){this[_0x8700('0x0')]=null;this[_0x8700('0x1')]='';this[_0x8700('0x2')]='';this[_0x8700('0x3')]=0x0;this['calleridname']='';this[_0x8700('0x4')]=undefined;this[_0x8700('0x5')]=undefined;this['accountcode']=0x0;this[_0x8700('0x6')]='';this[_0x8700('0x7')]=0x0;this[_0x8700('0x8')]=0x0;this[_0x8700('0x9')]=0x0;this[_0x8700('0xa')]=![];this[_0x8700('0xb')]=null;this[_0x8700('0xc')]=null;this['unmanaged']=![];this[_0x8700('0xd')]=![];this[_0x8700('0xe')]='';this[_0x8700('0xf')]='';this[_0x8700('0x10')]=0x0;this[_0x8700('0x11')]=0x0;this[_0x8700('0x12')]=0x0;this[_0x8700('0x13')]=null;this[_0x8700('0x14')]=null;this[_0x8700('0x15')]=null;this[_0x8700('0x16')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x8700('0x17')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x8700('0x18')]=0x0;}module[_0x8700('0x19')]=Channel; \ No newline at end of file +var _0xcbcd=['tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answertime','endtime','abandoned','lastdata','duration','type'];(function(_0x414935,_0x447c67){var _0x4eed8e=function(_0x56878f){while(--_0x56878f){_0x414935['push'](_0x414935['shift']());}};_0x4eed8e(++_0x447c67);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xcbcd[_0x4d08b8];return _0x70214a;};'use strict';function Channel(){this['starttime']=null;this[_0xdcbc('0x0')]='';this[_0xdcbc('0x1')]='';this[_0xdcbc('0x2')]=0x0;this[_0xdcbc('0x3')]='';this[_0xdcbc('0x4')]=undefined;this[_0xdcbc('0x5')]=undefined;this['accountcode']=0x0;this[_0xdcbc('0x6')]='';this[_0xdcbc('0x7')]=0x0;this[_0xdcbc('0x8')]=0x0;this[_0xdcbc('0x9')]=0x0;this['answered']=![];this[_0xdcbc('0xa')]=null;this[_0xdcbc('0xb')]=null;this['unmanaged']=![];this[_0xdcbc('0xc')]=![];this['lastapplication']='';this[_0xdcbc('0xd')]='';this[_0xdcbc('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xdcbc('0xf')]=null;this[_0xdcbc('0x10')]=null;this[_0xdcbc('0x11')]=null;this[_0xdcbc('0x12')]=![];this[_0xdcbc('0x13')]=null;this[_0xdcbc('0x14')]=null;this[_0xdcbc('0x15')]=[];this[_0xdcbc('0x16')]=undefined;this[_0xdcbc('0x17')]=undefined;this[_0xdcbc('0x18')]=undefined;this[_0xdcbc('0x19')]=0x0;}module[_0xdcbc('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 3282100..effd09d 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 _0x4f3a=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x4f3a,0x98));var _0xa4f3=function(_0x1fd441,_0x2629bf){_0x1fd441=_0x1fd441-0x0;var _0x411a91=_0x4f3a[_0x1fd441];return _0x411a91;};'use strict';function DeskAccount(_0x5e6844){this['id']=_0x5e6844['id']||0x0;this[_0xa4f3('0x0')]=_0x5e6844[_0xa4f3('0x0')]||'';this['username']=_0x5e6844[_0xa4f3('0x1')]||'';this[_0xa4f3('0x2')]=_0x5e6844[_0xa4f3('0x2')]||'';this[_0xa4f3('0x3')]=_0x5e6844['authType']||'';this[_0xa4f3('0x4')]=_0x5e6844['password']||'';this[_0xa4f3('0x5')]=_0x5e6844[_0xa4f3('0x5')]||'';this[_0xa4f3('0x6')]=_0x5e6844[_0xa4f3('0x6')]||'';this[_0xa4f3('0x7')]=_0x5e6844[_0xa4f3('0x7')]||'';this['tokenSecret']=_0x5e6844[_0xa4f3('0x8')]||'';this[_0xa4f3('0x9')]=_0x5e6844['type']||'';this[_0xa4f3('0xa')]=_0x5e6844['serverUrl']||'';this['Configurations']=_0x5e6844[_0xa4f3('0xb')]||{};}module[_0xa4f3('0xc')]=DeskAccount; \ No newline at end of file +var _0xe7e7=['tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','token'];(function(_0x285216,_0x28f4e8){var _0x199c22=function(_0x5a1ff1){while(--_0x5a1ff1){_0x285216['push'](_0x285216['shift']());}};_0x199c22(++_0x28f4e8);}(_0xe7e7,0x191));var _0x7e7e=function(_0x5473c6,_0xe0bc9c){_0x5473c6=_0x5473c6-0x0;var _0x5b1fcf=_0xe7e7[_0x5473c6];return _0x5b1fcf;};'use strict';function DeskAccount(_0x4821ca){this['id']=_0x4821ca['id']||0x0;this['name']=_0x4821ca['name']||'';this[_0x7e7e('0x0')]=_0x4821ca[_0x7e7e('0x0')]||'';this[_0x7e7e('0x1')]=_0x4821ca[_0x7e7e('0x1')]||'';this[_0x7e7e('0x2')]=_0x4821ca['authType']||'';this[_0x7e7e('0x3')]=_0x4821ca['password']||'';this['consumerKey']=_0x4821ca[_0x7e7e('0x4')]||'';this['consumerSecret']=_0x4821ca['consumerSecret']||'';this[_0x7e7e('0x5')]=_0x4821ca[_0x7e7e('0x5')]||'';this[_0x7e7e('0x6')]=_0x4821ca[_0x7e7e('0x6')]||'';this[_0x7e7e('0x7')]=_0x4821ca['type']||'';this[_0x7e7e('0x8')]=_0x4821ca[_0x7e7e('0x8')]||'';this[_0x7e7e('0x9')]=_0x4821ca['Configurations']||{};}module[_0x7e7e('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 78fbeb3..93fe393 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 _0x702d=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x1d2308,_0x1c34f8){var _0x44de61=function(_0x801c20){while(--_0x801c20){_0x1d2308['push'](_0x1d2308['shift']());}};_0x44de61(++_0x1c34f8);}(_0x702d,0x147));var _0xd702=function(_0x318041,_0x11ef9c){_0x318041=_0x318041-0x0;var _0x3f211c=_0x702d[_0x318041];return _0x3f211c;};'use strict';function Dynamics365Account(_0x14de3f){this['id']=_0x14de3f['id']||0x0;this[_0xd702('0x0')]=_0x14de3f[_0xd702('0x0')]||'';this[_0xd702('0x1')]=_0x14de3f[_0xd702('0x1')]||'';this['password']=_0x14de3f[_0xd702('0x2')]||'';this[_0xd702('0x3')]=_0x14de3f[_0xd702('0x3')]||'';this[_0xd702('0x4')]=_0x14de3f['tenantId']||'';this[_0xd702('0x5')]=_0x14de3f['clientId']||'';this[_0xd702('0x6')]=_0x14de3f[_0xd702('0x6')]||{};this[_0xd702('0x7')]=_0x14de3f['serverUrl']||'';this[_0xd702('0x8')]=_0x14de3f['Configurations']||{};}module[_0xd702('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x96cc=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x11ab83,_0x25a955){var _0x59b3c2=function(_0x2f8ec2){while(--_0x2f8ec2){_0x11ab83['push'](_0x11ab83['shift']());}};_0x59b3c2(++_0x25a955);}(_0x96cc,0x16c));var _0xc96c=function(_0x254461,_0x45615a){_0x254461=_0x254461-0x0;var _0x28ee0e=_0x96cc[_0x254461];return _0x28ee0e;};'use strict';function Dynamics365Account(_0x540e05){this['id']=_0x540e05['id']||0x0;this['name']=_0x540e05[_0xc96c('0x0')]||'';this['username']=_0x540e05[_0xc96c('0x1')]||'';this[_0xc96c('0x2')]=_0x540e05[_0xc96c('0x2')]||'';this[_0xc96c('0x3')]=_0x540e05[_0xc96c('0x3')]||'';this[_0xc96c('0x4')]=_0x540e05[_0xc96c('0x4')]||'';this[_0xc96c('0x5')]=_0x540e05[_0xc96c('0x5')]||'';this['clientSecret']=_0x540e05[_0xc96c('0x6')]||{};this[_0xc96c('0x7')]=_0x540e05[_0xc96c('0x7')]||'';this[_0xc96c('0x8')]=_0x540e05[_0xc96c('0x8')]||{};}module[_0xc96c('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 5154733..ad7d10b 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 _0xea9b=['ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x22ac92,_0x5b15e8){var _0x489cde=function(_0xa927cf){while(--_0xa927cf){_0x22ac92['push'](_0x22ac92['shift']());}};_0x489cde(++_0x5b15e8);}(_0xea9b,0x158));var _0xbea9=function(_0x31a180,_0x3924b9){_0x31a180=_0x31a180-0x0;var _0x4b0502=_0xea9b[_0x31a180];return _0x4b0502;};'use strict';function FaxAccount(_0x3a9366){this['id']=_0x3a9366['id']||0x0;this['name']=_0x3a9366[_0xbea9('0x0')]||'';this['description']=_0x3a9366['description'];this[_0xbea9('0x1')]=_0x3a9366[_0xbea9('0x1')];this['headerinfo']=_0x3a9366[_0xbea9('0x2')];this[_0xbea9('0x3')]=_0x3a9366[_0xbea9('0x3')];this[_0xbea9('0x4')]=_0x3a9366[_0xbea9('0x4')]||0x960;this[_0xbea9('0x5')]=_0x3a9366[_0xbea9('0x5')]||0x3840;this[_0xbea9('0x6')]=_0x3a9366[_0xbea9('0x6')]||'v17,v27,v29';this[_0xbea9('0x7')]=_0x3a9366[_0xbea9('0x7')]||'no';this['faxdetect']=_0x3a9366['faxdetect']||'no';this[_0xbea9('0x8')]=_0x3a9366[_0xbea9('0x8')]||0x1388;this[_0xbea9('0x9')]=_0x3a9366[_0xbea9('0x9')]||_0xbea9('0xa');this[_0xbea9('0xb')]=_0x3a9366['Trunk']?_0x3a9366[_0xbea9('0xb')]:undefined;this['ListId']=_0x3a9366[_0xbea9('0xc')];this['key']=_0x3a9366[_0xbea9('0xd')];}module[_0xbea9('0xe')]=FaxAccount; \ No newline at end of file +var _0xbeec=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xbeec,0x11a));var _0xcbee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbeec[_0x14add3];return _0x4a174f;};'use strict';function FaxAccount(_0x46cef3){this['id']=_0x46cef3['id']||0x0;this[_0xcbee('0x0')]=_0x46cef3['name']||'';this['description']=_0x46cef3[_0xcbee('0x1')];this[_0xcbee('0x2')]=_0x46cef3[_0xcbee('0x2')];this[_0xcbee('0x3')]=_0x46cef3[_0xcbee('0x3')];this['localstationid']=_0x46cef3[_0xcbee('0x4')];this[_0xcbee('0x5')]=_0x46cef3[_0xcbee('0x5')]||0x960;this[_0xcbee('0x6')]=_0x46cef3[_0xcbee('0x6')]||0x3840;this[_0xcbee('0x7')]=_0x46cef3['modem']||_0xcbee('0x8');this[_0xcbee('0x9')]=_0x46cef3['gateway']||'no';this[_0xcbee('0xa')]=_0x46cef3[_0xcbee('0xa')]||'no';this['t38timeout']=_0x46cef3[_0xcbee('0xb')]||0x1388;this[_0xcbee('0xc')]=_0x46cef3['tech']||'SIP';this[_0xcbee('0xd')]=_0x46cef3[_0xcbee('0xd')]?_0x46cef3[_0xcbee('0xd')]:undefined;this[_0xcbee('0xe')]=_0x46cef3[_0xcbee('0xe')];this[_0xcbee('0xf')]=_0x46cef3[_0xcbee('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 291112e..55d88c0 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 _0x15a8=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x46151c,_0x3da27c){var _0x4c182c=function(_0x20223e){while(--_0x20223e){_0x46151c['push'](_0x46151c['shift']());}};_0x4c182c(++_0x3da27c);}(_0x15a8,0x8a));var _0x815a=function(_0x34a49c,_0x311bf9){_0x34a49c=_0x34a49c-0x0;var _0x178e9d=_0x15a8[_0x34a49c];return _0x178e9d;};'use strict';function FreshdeskAccount(_0x173939){this['id']=_0x173939['id']||0x0;this[_0x815a('0x0')]=_0x173939[_0x815a('0x0')]||'';this[_0x815a('0x1')]=_0x173939[_0x815a('0x1')]||'';this[_0x815a('0x2')]=_0x173939[_0x815a('0x3')]||'';this[_0x815a('0x4')]=_0x173939[_0x815a('0x4')]||'';this[_0x815a('0x5')]=_0x173939[_0x815a('0x5')]||'';this[_0x815a('0x6')]=_0x173939[_0x815a('0x6')]||{};}module[_0x815a('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x64a9=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1c87a1,_0x536b21){var _0x23e918=function(_0x461234){while(--_0x461234){_0x1c87a1['push'](_0x1c87a1['shift']());}};_0x23e918(++_0x536b21);}(_0x64a9,0x1b5));var _0x964a=function(_0x3c5681,_0x1d4561){_0x3c5681=_0x3c5681-0x0;var _0x4b3ec9=_0x64a9[_0x3c5681];return _0x4b3ec9;};'use strict';function FreshdeskAccount(_0x4cc6a2){this['id']=_0x4cc6a2['id']||0x0;this[_0x964a('0x0')]=_0x4cc6a2[_0x964a('0x0')]||'';this[_0x964a('0x1')]=_0x4cc6a2[_0x964a('0x1')]||'';this[_0x964a('0x2')]=_0x4cc6a2[_0x964a('0x3')]||'';this[_0x964a('0x4')]=_0x4cc6a2['remoteUri']||'';this[_0x964a('0x5')]=_0x4cc6a2[_0x964a('0x5')]||'';this[_0x964a('0x6')]=_0x4cc6a2[_0x964a('0x6')]||{};}module[_0x964a('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index c41261b..632a1a9 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 _0x6dd1=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0xb67326,_0x348813){var _0x347034=function(_0x7be64f){while(--_0x7be64f){_0xb67326['push'](_0xb67326['shift']());}};_0x347034(++_0x348813);}(_0x6dd1,0x111));var _0x16dd=function(_0x4f8d68,_0x483ac2){_0x4f8d68=_0x4f8d68-0x0;var _0x65263c=_0x6dd1[_0x4f8d68];return _0x65263c;};'use strict';function FreshsalesAccount(_0x9c01ae){this['id']=_0x9c01ae['id']||0x0;this['name']=_0x9c01ae[_0x16dd('0x0')]||'';this[_0x16dd('0x1')]=_0x9c01ae['username']||'';this[_0x16dd('0x2')]=_0x9c01ae[_0x16dd('0x3')]||'';this[_0x16dd('0x4')]=_0x9c01ae[_0x16dd('0x4')]||'';this[_0x16dd('0x5')]=_0x9c01ae[_0x16dd('0x5')]||'';this[_0x16dd('0x6')]=_0x9c01ae[_0x16dd('0x6')]||{};}module[_0x16dd('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x4f5d=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x1dc4d4,_0x3f596d){var _0x58d5ea=function(_0x378e91){while(--_0x378e91){_0x1dc4d4['push'](_0x1dc4d4['shift']());}};_0x58d5ea(++_0x3f596d);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4f5d[_0x209941];return _0x1e8729;};'use strict';function FreshsalesAccount(_0x30ec55){this['id']=_0x30ec55['id']||0x0;this[_0xd4f5('0x0')]=_0x30ec55[_0xd4f5('0x0')]||'';this[_0xd4f5('0x1')]=_0x30ec55[_0xd4f5('0x1')]||'';this[_0xd4f5('0x2')]=_0x30ec55['token']||'';this[_0xd4f5('0x3')]=_0x30ec55[_0xd4f5('0x3')]||'';this[_0xd4f5('0x4')]=_0x30ec55[_0xd4f5('0x4')]||'';this[_0xd4f5('0x5')]=_0x30ec55[_0xd4f5('0x5')]||{};}module[_0xd4f5('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index fd1d19e..c6080f7 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 _0x5b3d=['originalposition','channel','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x3aa5cf,_0x4879b3){var _0x22854a=function(_0x3e8a49){while(--_0x3e8a49){_0x3aa5cf['push'](_0x3aa5cf['shift']());}};_0x22854a(++_0x4879b3);}(_0x5b3d,0x137));var _0xd5b3=function(_0x2f66fe,_0x46be8b){_0x2f66fe=_0x2f66fe-0x0;var _0x1a1d22=_0x5b3d[_0x2f66fe];return _0x1a1d22;};'use strict';function QueueReport(){this[_0xd5b3('0x0')]=_0xd5b3('0x1');this[_0xd5b3('0x2')]='';this[_0xd5b3('0x3')]='';this['calleridname']='';this[_0xd5b3('0x4')]='';this[_0xd5b3('0x5')]=null;this[_0xd5b3('0x6')]=null;this[_0xd5b3('0x7')]=0x1;this['count']=0x1;this[_0xd5b3('0x8')]=![];this[_0xd5b3('0x9')]=null;this[_0xd5b3('0xa')]=![];this[_0xd5b3('0xb')]=null;this[_0xd5b3('0xc')]=![];this['queuecallerexitAt']=null;this[_0xd5b3('0xd')]=0x1;this[_0xd5b3('0xe')]='';this['connectedlinenum']='';this[_0xd5b3('0xf')]='';this[_0xd5b3('0x10')]='';this['context']='';this[_0xd5b3('0x11')]='';this[_0xd5b3('0x12')]='';this[_0xd5b3('0x13')]=0x0;this[_0xd5b3('0x14')]=![];this[_0xd5b3('0x15')]='';this[_0xd5b3('0x16')]=_0xd5b3('0x17');this[_0xd5b3('0x18')]=0x0;this[_0xd5b3('0x19')]={};}module[_0xd5b3('0x1a')]=QueueReport; \ No newline at end of file +var _0xce4d=['exports','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode','exten','priority','holdtime','assigned','motionChannel','mohtime','variables'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xce4d,0xd0));var _0xdce4=function(_0x3b50d6,_0x2bd840){_0x3b50d6=_0x3b50d6-0x0;var _0x426402=_0xce4d[_0x3b50d6];return _0x426402;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this[_0xdce4('0x0')]='';this[_0xdce4('0x1')]='';this[_0xdce4('0x2')]='';this[_0xdce4('0x3')]=null;this[_0xdce4('0x4')]=null;this[_0xdce4('0x5')]=0x1;this[_0xdce4('0x6')]=0x1;this[_0xdce4('0x7')]=![];this[_0xdce4('0x8')]=null;this[_0xdce4('0x9')]=![];this['queuecallercompleteAt']=null;this[_0xdce4('0xa')]=![];this[_0xdce4('0xb')]=null;this[_0xdce4('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xdce4('0xd')]='';this[_0xdce4('0xe')]='';this['context']='';this[_0xdce4('0xf')]='';this[_0xdce4('0x10')]='';this[_0xdce4('0x11')]=0x0;this[_0xdce4('0x12')]=![];this['lastAssignedTo']='';this[_0xdce4('0x13')]='voice';this[_0xdce4('0x14')]=0x0;this[_0xdce4('0x15')]={};}module[_0xdce4('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index dcb1363..9efa2d2 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 _0xeae7=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x100c14,_0x3c8171){var _0x4d061e=function(_0x529754){while(--_0x529754){_0x100c14['push'](_0x100c14['shift']());}};_0x4d061e(++_0x3c8171);}(_0xeae7,0x1a1));var _0x7eae=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xeae7[_0xb0f7c3];return _0x28ea68;};'use strict';function SalesforceAccount(_0x481ad3){this['id']=_0x481ad3['id']||0x0;this[_0x7eae('0x0')]=_0x481ad3[_0x7eae('0x0')]||'';this[_0x7eae('0x1')]=_0x481ad3['username']||'';this[_0x7eae('0x2')]=_0x481ad3[_0x7eae('0x2')]||'';this[_0x7eae('0x3')]=_0x481ad3[_0x7eae('0x3')]||'';this[_0x7eae('0x4')]=_0x481ad3[_0x7eae('0x4')]||'';this[_0x7eae('0x5')]=_0x481ad3['clientSecret']||'';this['securityToken']=_0x481ad3[_0x7eae('0x6')]||'';this[_0x7eae('0x7')]=_0x481ad3['type']||_0x7eae('0x8');this['serverUrl']=_0x481ad3[_0x7eae('0x9')]||'';this[_0x7eae('0xa')]=_0x481ad3[_0x7eae('0xa')]||{};}module[_0x7eae('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x6d11=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','Configurations'];(function(_0x33314d,_0x499628){var _0x4ffe8e=function(_0xb1ec35){while(--_0xb1ec35){_0x33314d['push'](_0x33314d['shift']());}};_0x4ffe8e(++_0x499628);}(_0x6d11,0xbf));var _0x16d1=function(_0x4f2930,_0x40ad4b){_0x4f2930=_0x4f2930-0x0;var _0x397db7=_0x6d11[_0x4f2930];return _0x397db7;};'use strict';function SalesforceAccount(_0x5b97e4){this['id']=_0x5b97e4['id']||0x0;this[_0x16d1('0x0')]=_0x5b97e4[_0x16d1('0x0')]||'';this['username']=_0x5b97e4[_0x16d1('0x1')]||'';this['remoteUri']=_0x5b97e4[_0x16d1('0x2')]||'';this[_0x16d1('0x3')]=_0x5b97e4['password']||'';this['clientId']=_0x5b97e4[_0x16d1('0x4')]||'';this[_0x16d1('0x5')]=_0x5b97e4[_0x16d1('0x5')]||'';this[_0x16d1('0x6')]=_0x5b97e4[_0x16d1('0x6')]||'';this[_0x16d1('0x7')]=_0x5b97e4[_0x16d1('0x7')]||'integrationTab';this['serverUrl']=_0x5b97e4['serverUrl']||'';this[_0x16d1('0x8')]=_0x5b97e4[_0x16d1('0x8')]||{};}module[_0x16d1('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7b11b61..a015bf5 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 _0x71b4=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x3fb219,_0x3a1d8d){var _0xd91dec=function(_0x4593ca){while(--_0x4593ca){_0x3fb219['push'](_0x3fb219['shift']());}};_0xd91dec(++_0x3a1d8d);}(_0x71b4,0x1b4));var _0x471b=function(_0x194419,_0x5e80c9){_0x194419=_0x194419-0x0;var _0x128059=_0x71b4[_0x194419];return _0x128059;};'use strict';function ServicenowAccount(_0x27d2b7){this['id']=_0x27d2b7['id']||0x0;this['name']=_0x27d2b7[_0x471b('0x0')]||'';this[_0x471b('0x1')]=_0x27d2b7[_0x471b('0x1')]||'';this[_0x471b('0x2')]=_0x27d2b7[_0x471b('0x2')]||'';this[_0x471b('0x3')]=_0x27d2b7[_0x471b('0x3')]||'';this[_0x471b('0x4')]=_0x27d2b7['serverUrl']||'';this['Configurations']=_0x27d2b7[_0x471b('0x5')]||{};}module[_0x471b('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc001=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x259340,_0x55c405){var _0x36bfbd=function(_0x4b47f6){while(--_0x4b47f6){_0x259340['push'](_0x259340['shift']());}};_0x36bfbd(++_0x55c405);}(_0xc001,0x1d8));var _0x1c00=function(_0x2b08c6,_0x3e604d){_0x2b08c6=_0x2b08c6-0x0;var _0x479c84=_0xc001[_0x2b08c6];return _0x479c84;};'use strict';function ServicenowAccount(_0x146508){this['id']=_0x146508['id']||0x0;this[_0x1c00('0x0')]=_0x146508[_0x1c00('0x0')]||'';this['username']=_0x146508['username']||'';this[_0x1c00('0x1')]=_0x146508[_0x1c00('0x1')]||'';this[_0x1c00('0x2')]=_0x146508[_0x1c00('0x2')]||'';this['serverUrl']=_0x146508[_0x1c00('0x3')]||'';this[_0x1c00('0x4')]=_0x146508[_0x1c00('0x4')]||{};}module[_0x1c00('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 176e0e0..8b66772 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 _0xeb67=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0xeb67,0x13a));var _0x7eb6=function(_0x39d386,_0xb48a1d){_0x39d386=_0x39d386-0x0;var _0x3bcac4=_0xeb67[_0x39d386];return _0x3bcac4;};'use strict';function SugarcrmAccount(_0x2008de){this['id']=_0x2008de['id']||0x0;this['name']=_0x2008de[_0x7eb6('0x0')]||'';this[_0x7eb6('0x1')]=_0x2008de[_0x7eb6('0x1')]||'';this[_0x7eb6('0x2')]=_0x2008de[_0x7eb6('0x2')]||'';this['remoteUri']=_0x2008de[_0x7eb6('0x3')]||'';this[_0x7eb6('0x4')]=_0x2008de[_0x7eb6('0x4')]||'';this[_0x7eb6('0x5')]=_0x2008de['Configurations']||{};}module[_0x7eb6('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x9dc3=['serverUrl','Configurations','exports','name','password','remoteUri'];(function(_0x51f812,_0x36212c){var _0x1ad290=function(_0x1f03b7){while(--_0x1f03b7){_0x51f812['push'](_0x51f812['shift']());}};_0x1ad290(++_0x36212c);}(_0x9dc3,0xa5));var _0x39dc=function(_0x27d11f,_0x2c59a8){_0x27d11f=_0x27d11f-0x0;var _0x36c1a5=_0x9dc3[_0x27d11f];return _0x36c1a5;};'use strict';function SugarcrmAccount(_0x28e1a5){this['id']=_0x28e1a5['id']||0x0;this[_0x39dc('0x0')]=_0x28e1a5[_0x39dc('0x0')]||'';this['username']=_0x28e1a5['username']||'';this[_0x39dc('0x1')]=_0x28e1a5[_0x39dc('0x1')]||'';this[_0x39dc('0x2')]=_0x28e1a5[_0x39dc('0x2')]||'';this[_0x39dc('0x3')]=_0x28e1a5[_0x39dc('0x3')]||'';this['Configurations']=_0x28e1a5[_0x39dc('0x4')]||{};}module[_0x39dc('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4b32309..68ae7c1 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 _0x8d05=['stateTime','status','unknown','address','name','accountcode'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8d05,0xe8));var _0x58d0=function(_0x421a8b,_0x3888a5){_0x421a8b=_0x421a8b-0x0;var _0x4ff042=_0x8d05[_0x421a8b];return _0x4ff042;};'use strict';function Telephone(_0x1dbe06){this['id']=_0x1dbe06['id']||0x0;this[_0x58d0('0x0')]=_0x1dbe06[_0x58d0('0x0')]||'';this[_0x58d0('0x1')]=_0x1dbe06[_0x58d0('0x1')]||'';this['state']='unknown';this[_0x58d0('0x2')]=0x0;this[_0x58d0('0x3')]=_0x58d0('0x4');this[_0x58d0('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x1588=['status','unknown','address','name','accountcode','stateTime'];(function(_0x8a10fb,_0x561ba2){var _0x550732=function(_0x4e5607){while(--_0x4e5607){_0x8a10fb['push'](_0x8a10fb['shift']());}};_0x550732(++_0x561ba2);}(_0x1588,0x195));var _0x8158=function(_0x3b170f,_0x4a01b1){_0x3b170f=_0x3b170f-0x0;var _0xb27e90=_0x1588[_0x3b170f];return _0xb27e90;};'use strict';function Telephone(_0x5a1ee7){this['id']=_0x5a1ee7['id']||0x0;this[_0x8158('0x0')]=_0x5a1ee7[_0x8158('0x0')]||'';this[_0x8158('0x1')]=_0x5a1ee7[_0x8158('0x1')]||'';this['state']='unknown';this[_0x8158('0x2')]=0x0;this[_0x8158('0x3')]=_0x8158('0x4');this[_0x8158('0x5')]='';}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 24124ea..eb3eb4c 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(_0x363fda,_0x39f0f8){var _0x317e39=function(_0x48fe96){while(--_0x48fe96){_0x363fda['push'](_0x363fda['shift']());}};_0x317e39(++_0x39f0f8);}(_0xb10b,0x12a));var _0xbb10=function(_0x13a621,_0x29b45c){_0x13a621=_0x13a621-0x0;var _0x19c55d=_0xb10b[_0x13a621];return _0x19c55d;};'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(_0x344e2d,_0xbd413e){var _0x19c6d4=function(_0x777f37){while(--_0x777f37){_0x344e2d['push'](_0x344e2d['shift']());}};_0x19c6d4(++_0xbd413e);}(_0xb10b,0x12a));var _0xbb10=function(_0x9f9ed5,_0x56f438){_0x9f9ed5=_0x9f9ed5-0x0;var _0xbc71e3=_0xb10b[_0x9f9ed5];return _0xbc71e3;};'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 7c82e3e..d575249 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 _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x3c71bc,_0x4456b2){var _0x3432da=function(_0x51e402){while(--_0x51e402){_0x3c71bc['push'](_0x3c71bc['shift']());}};_0x3432da(++_0x4456b2);}(_0x2032,0xd9));var _0x2203=function(_0x36334e,_0x3f9bf2){_0x36334e=_0x36334e-0x0;var _0x11516f=_0x2032[_0x36334e];return _0x11516f;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xf3221e,_0x371371){var _0x4cfb2d=function(_0x137a07){while(--_0x137a07){_0xf3221e['push'](_0xf3221e['shift']());}};_0x4cfb2d(++_0x371371);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x43ad8d,_0x223ced){_0x43ad8d=_0x43ad8d-0x0;var _0x58f7b5=_0x9ffd[_0x43ad8d];return _0x58f7b5;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 16973b7..22e07eb 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 _0xcc8e=['registrationtime','address','defaultuser','active','name','state','stateTime','status','unknown','registry','port','domainport','refresh'];(function(_0x44223c,_0x407722){var _0x5593de=function(_0x410160){while(--_0x410160){_0x44223c['push'](_0x44223c['shift']());}};_0x5593de(++_0x407722);}(_0xcc8e,0x85));var _0xecc8=function(_0x6cce5,_0x5bf877){_0x6cce5=_0x6cce5-0x0;var _0x5c4a94=_0xcc8e[_0x6cce5];return _0x5c4a94;};'use strict';function Trunk(_0x5dd599){this['id']=_0x5dd599['id']||0x0;this[_0xecc8('0x0')]=_0x5dd599[_0xecc8('0x0')]||![];this[_0xecc8('0x1')]=_0x5dd599[_0xecc8('0x1')]||'';this[_0xecc8('0x2')]='unknown';this[_0xecc8('0x3')]=0x0;this[_0xecc8('0x4')]=_0xecc8('0x5');this[_0xecc8('0x6')]=_0x5dd599[_0xecc8('0x6')]&&_0x5dd599['registry']['indexOf'](':')?_0x5dd599[_0xecc8('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0xecc8('0x7')]='';this['domain']='';this[_0xecc8('0x8')]='';this[_0xecc8('0x9')]='';this['stateRegistry']=_0xecc8('0x5');this[_0xecc8('0xa')]='';this[_0xecc8('0xb')]='';this[_0xecc8('0xc')]=_0x5dd599[_0xecc8('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x21d0=['status','unknown','registry','indexOf','host','port','domainport','stateRegistry','address','defaultuser','exports','active','name','state','stateTime'];(function(_0xdf13c9,_0x5da43f){var _0x302aaa=function(_0x42cc73){while(--_0x42cc73){_0xdf13c9['push'](_0xdf13c9['shift']());}};_0x302aaa(++_0x5da43f);}(_0x21d0,0xa1));var _0x021d=function(_0x1935c8,_0x410d3d){_0x1935c8=_0x1935c8-0x0;var _0x414a06=_0x21d0[_0x1935c8];return _0x414a06;};'use strict';function Trunk(_0x18cbf0){this['id']=_0x18cbf0['id']||0x0;this['active']=_0x18cbf0[_0x021d('0x0')]||![];this['name']=_0x18cbf0[_0x021d('0x1')]||'';this[_0x021d('0x2')]='unknown';this[_0x021d('0x3')]=0x0;this[_0x021d('0x4')]=_0x021d('0x5');this[_0x021d('0x6')]=_0x18cbf0['registry']&&_0x18cbf0[_0x021d('0x6')][_0x021d('0x7')](':')?_0x18cbf0[_0x021d('0x6')]['split'](':')[0x0]:'';this[_0x021d('0x8')]='';this[_0x021d('0x9')]='';this['domain']='';this[_0x021d('0xa')]='';this['refresh']='';this[_0x021d('0xb')]=_0x021d('0x5');this['registrationtime']='';this[_0x021d('0xc')]='';this[_0x021d('0xd')]=_0x18cbf0[_0x021d('0xd')]||'';}module[_0x021d('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index c5105ed..fbb6ab0 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 _0xca12=['recordingFormat','mandatoryDisposition','exports'];(function(_0x37acec,_0x53fc19){var _0x3a2bdc=function(_0x49753e){while(--_0x49753e){_0x37acec['push'](_0x37acec['shift']());}};_0x3a2bdc(++_0x53fc19);}(_0xca12,0x132));var _0x2ca1=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xca12[_0x29d94e];return _0x106237;};'use strict';function voiceExtension(_0x5e80e5){this['id']=_0x5e80e5['id']||0x0;this['exten']=_0x5e80e5['exten']||'';this[_0x2ca1('0x0')]=_0x5e80e5['recordingFormat']||'none';this['mandatoryDisposition']=_0x5e80e5[_0x2ca1('0x1')]||![];}module[_0x2ca1('0x2')]=voiceExtension; \ No newline at end of file +var _0xcbfc=['exports','exten','none','mandatoryDisposition'];(function(_0x5eed03,_0x703be0){var _0x327b45=function(_0x10f1e8){while(--_0x10f1e8){_0x5eed03['push'](_0x5eed03['shift']());}};_0x327b45(++_0x703be0);}(_0xcbfc,0x185));var _0xccbf=function(_0x1c6514,_0x252778){_0x1c6514=_0x1c6514-0x0;var _0x28c571=_0xcbfc[_0x1c6514];return _0x28c571;};'use strict';function voiceExtension(_0x587422){this['id']=_0x587422['id']||0x0;this[_0xccbf('0x0')]=_0x587422[_0xccbf('0x0')]||'';this['recordingFormat']=_0x587422['recordingFormat']||_0xccbf('0x1');this[_0xccbf('0x2')]=_0x587422[_0xccbf('0x2')]||![];}module[_0xccbf('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 1b8f13d..5f3a3d4 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 _0xa596=['onhold','wav49','gsm','rrmemory','roundrobin','name','inbound','waiting','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xa596,0x159));var _0x6a59=function(_0x20e693,_0x29b6d1){_0x20e693=_0x20e693-0x0;var _0x3f6092=_0xa596[_0x20e693];return _0x3f6092;};'use strict';var statusDesc=['unknown',_0x6a59('0x0'),_0x6a59('0x1'),_0x6a59('0x2'),_0x6a59('0x3'),_0x6a59('0x4'),_0x6a59('0x5'),'ringinuse',_0x6a59('0x6')];var monitorFormat={'wav':'wav','wav49':_0x6a59('0x7'),'gsm':_0x6a59('0x8')};var strategy={'rrmemory':_0x6a59('0x9'),'roundrobin':_0x6a59('0xa')};function VoiceQueue(_0x5e91cc){this['id']=_0x5e91cc['id']||0x0;this[_0x6a59('0xb')]=_0x5e91cc[_0x6a59('0xb')]||'';this['monitor_format']=_0x5e91cc['monitor_format']||'';this['type']=_0x5e91cc['type']||_0x6a59('0xc');this[_0x6a59('0xd')]=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0x6a59('0xe')]=0x0;this[_0x6a59('0xf')]=0x0;this[_0x6a59('0x10')]=0x0;this[_0x6a59('0x11')]=0x0;this[_0x6a59('0x12')]=0x0;this[_0x6a59('0x13')]=0x0;this[_0x6a59('0x14')]=0x0;this['acw']=_0x5e91cc[_0x6a59('0x15')]||![];this[_0x6a59('0x16')]=_0x5e91cc['acwTimeout']||0xa;this['autopause']=_0x5e91cc['autopause']||'no';this[_0x6a59('0x17')]=!![];this[_0x6a59('0x18')]='';this[_0x6a59('0x19')]=0x0;this[_0x6a59('0x1a')]=0x0;this[_0x6a59('0x1b')]=_0x5e91cc[_0x6a59('0x1b')]||null;this[_0x6a59('0x1c')]=_0x5e91cc[_0x6a59('0x1c')]?_0x5e91cc[_0x6a59('0x1c')]:null;this[_0x6a59('0x1d')]=_0x5e91cc[_0x6a59('0x1d')];this[_0x6a59('0x1e')]=_0x5e91cc['dialMethod']||'progressive';this[_0x6a59('0x1f')]=_0x5e91cc['dialLimitChannel']||0x0;this[_0x6a59('0x20')]=_0x5e91cc[_0x6a59('0x20')]||0x0;this[_0x6a59('0x21')]=_0x5e91cc[_0x6a59('0x21')]||0x1;this[_0x6a59('0x22')]=_0x5e91cc[_0x6a59('0x22')]||_0x6a59('0x23');this[_0x6a59('0x24')]=_0x5e91cc[_0x6a59('0x24')]||0.03;this['dialPredictiveInterval']=_0x5e91cc[_0x6a59('0x25')]||0x258;this[_0x6a59('0x26')]=_0x5e91cc[_0x6a59('0x26')]||_0x6a59('0x27');this[_0x6a59('0x28')]=_0x5e91cc['dialOriginateCallerIdNumber']||_0x6a59('0x27');this[_0x6a59('0x29')]=_0x5e91cc['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x5e91cc[_0x6a59('0x2a')]||_0x6a59('0x2b');this[_0x6a59('0x2c')]=_0x5e91cc[_0x6a59('0x2c')]||0x3;this[_0x6a59('0x2d')]=_0x5e91cc[_0x6a59('0x2d')]||undefined;this[_0x6a59('0x2e')]=_0x5e91cc[_0x6a59('0x2e')]||0x3;this[_0x6a59('0x2f')]=_0x5e91cc[_0x6a59('0x2f')]||0x96;this[_0x6a59('0x30')]=_0x5e91cc['dialBusyMaxRetry']||0x3;this[_0x6a59('0x31')]=_0x5e91cc[_0x6a59('0x31')]||0x96;this[_0x6a59('0x32')]=_0x5e91cc['dialNoAnswerMaxRetry']||0x3;this[_0x6a59('0x33')]=_0x5e91cc[_0x6a59('0x33')]||0x96;this[_0x6a59('0x34')]=_0x5e91cc[_0x6a59('0x34')]||0x3;this[_0x6a59('0x35')]=_0x5e91cc['dialNoSuchNumberRetryFrequency']||0x96;this[_0x6a59('0x36')]=_0x5e91cc[_0x6a59('0x36')]||0x3;this[_0x6a59('0x37')]=_0x5e91cc[_0x6a59('0x37')]||0x96;this[_0x6a59('0x38')]=_0x5e91cc[_0x6a59('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x5e91cc['dialAbandonedRetryFrequency']||0x96;this[_0x6a59('0x39')]=_0x5e91cc[_0x6a59('0x39')]||0x3;this[_0x6a59('0x3a')]=_0x5e91cc[_0x6a59('0x3a')]||0x96;this[_0x6a59('0x3b')]=_0x5e91cc['dialAgentRejectMaxRetry']||0x3;this[_0x6a59('0x3c')]=_0x5e91cc['dialAgentRejectRetryFrequency']||0x96;this[_0x6a59('0x3d')]=_0x5e91cc[_0x6a59('0x3d')]||0x4;this[_0x6a59('0x3e')]=_0x5e91cc['Trunk']?_0x5e91cc['Trunk']:undefined;this[_0x6a59('0x3f')]=_0x5e91cc[_0x6a59('0x3f')]?_0x5e91cc['TrunkBackup']:undefined;this['dialPrefix']=_0x5e91cc[_0x6a59('0x40')]||undefined;this[_0x6a59('0x41')]=_0x5e91cc[_0x6a59('0x41')]?_0x5e91cc[_0x6a59('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x5e91cc[_0x6a59('0x42')]||_0x6a59('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x5e91cc[_0x6a59('0x44')]||undefined;this[_0x6a59('0x45')]=_0x5e91cc['dialCutDigit']||undefined;this[_0x6a59('0x46')]=strategy[_0x5e91cc[_0x6a59('0x46')]]||'rrmemory';this[_0x6a59('0x47')]=!![];this[_0x6a59('0x48')]=_0x5e91cc['dialAMDActive']||![];this[_0x6a59('0x49')]=_0x5e91cc[_0x6a59('0x49')];this[_0x6a59('0x4a')]=_0x5e91cc[_0x6a59('0x4a')];this[_0x6a59('0x4b')]=_0x5e91cc[_0x6a59('0x4b')];this[_0x6a59('0x4c')]=_0x5e91cc[_0x6a59('0x4c')];this['dialAMDMinWordLength']=_0x5e91cc[_0x6a59('0x4d')];this[_0x6a59('0x4e')]=_0x5e91cc['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x5e91cc['dialAMDMaximumNumberOfWords'];this[_0x6a59('0x4f')]=_0x5e91cc[_0x6a59('0x4f')];this[_0x6a59('0x50')]=_0x5e91cc[_0x6a59('0x50')];this['outboundRejectCallsDay']=0x0;this[_0x6a59('0x51')]=0x0;this['timeout']=_0x5e91cc['timeout'];this[_0x6a59('0x52')]=0x0;this[_0x6a59('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6a59('0x54')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x6a59('0x55')]=0x0;this[_0x6a59('0x56')]=0x0;this[_0x6a59('0x57')]=0x0;this[_0x6a59('0x58')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x6a59('0x59')]=0x0;this[_0x6a59('0x5a')]=0x0;this[_0x6a59('0x5b')]=0x0;this['startProgressive']=undefined;this[_0x6a59('0x5c')]=undefined;this[_0x6a59('0x5d')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x6a59('0x5e')]=0x0;this[_0x6a59('0x5f')]=0x0;this[_0x6a59('0x60')]=0x0;this[_0x6a59('0x61')]=0x0;this[_0x6a59('0x62')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x6a59('0x63')]=0x0;this[_0x6a59('0x64')]=_0x5e91cc['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x5e91cc[_0x6a59('0x65')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x6a59('0x66')]=0x0;this[_0x6a59('0x67')]=0x1;this[_0x6a59('0x68')]=0x0;this[_0x6a59('0x69')]=0x0;this[_0x6a59('0x6a')]=0x0;this[_0x6a59('0x6b')]=0x0;this[_0x6a59('0x6c')]=_0x5e91cc['dialRecallMeTimeout']||0x1e;this[_0x6a59('0x6d')]=_0x5e91cc[_0x6a59('0x6d')]||![];this[_0x6a59('0x6e')]=_0x5e91cc[_0x6a59('0x6e')]||undefined;this[_0x6a59('0x6f')]=_0x5e91cc[_0x6a59('0x6f')]||![];this[_0x6a59('0x70')]=_0x5e91cc[_0x6a59('0x70')]||![];this[_0x6a59('0x71')]=monitorFormat[_0x5e91cc['monitor_format']]?monitorFormat[_0x5e91cc[_0x6a59('0x71')]]:undefined;this[_0x6a59('0x72')]=_0x5e91cc[_0x6a59('0x72')]||![];this[_0x6a59('0x73')]=_0x5e91cc['mandatoryDispositionPause']?_0x5e91cc[_0x6a59('0x73')]:undefined;}module[_0x6a59('0x74')]=VoiceQueue; \ No newline at end of file +var _0x60d7=['sendMessageOneNotActive','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x60d7,0x149));var _0x760d=function(_0x3409a6,_0xe2533d){_0x3409a6=_0x3409a6-0x0;var _0x33c490=_0x60d7[_0x3409a6];return _0x33c490;};'use strict';var statusDesc=[_0x760d('0x0'),_0x760d('0x1'),_0x760d('0x2'),_0x760d('0x3'),_0x760d('0x4'),_0x760d('0x5'),_0x760d('0x6'),_0x760d('0x7'),_0x760d('0x8')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x760d('0x9')};var strategy={'rrmemory':_0x760d('0xa'),'roundrobin':_0x760d('0xb')};function VoiceQueue(_0x4717c2){this['id']=_0x4717c2['id']||0x0;this[_0x760d('0xc')]=_0x4717c2[_0x760d('0xc')]||'';this[_0x760d('0xd')]=_0x4717c2[_0x760d('0xd')]||'';this[_0x760d('0xe')]=_0x4717c2[_0x760d('0xe')]||_0x760d('0xf');this[_0x760d('0x10')]=0x0;this[_0x760d('0x11')]=0x0;this['total']=0x0;this[_0x760d('0x12')]=0x0;this[_0x760d('0x13')]=0x0;this[_0x760d('0x14')]=0x0;this[_0x760d('0x15')]=0x0;this[_0x760d('0x16')]=0x0;this['abandoned']=0x0;this[_0x760d('0x17')]=0x0;this[_0x760d('0x18')]=0x0;this[_0x760d('0x19')]=_0x4717c2[_0x760d('0x19')]||![];this[_0x760d('0x1a')]=_0x4717c2[_0x760d('0x1a')]||0xa;this[_0x760d('0x1b')]=_0x4717c2[_0x760d('0x1b')]||'no';this[_0x760d('0x1c')]=!![];this['message']='';this['originated']=0x0;this[_0x760d('0x1d')]=0x0;this['dialTimezone']=_0x4717c2[_0x760d('0x1e')]||null;this['dialGlobalInterval']=_0x4717c2[_0x760d('0x1f')]?_0x4717c2['dialGlobalInterval']:null;this[_0x760d('0x20')]=_0x4717c2['dialActive'];this[_0x760d('0x21')]=_0x4717c2[_0x760d('0x21')]||_0x760d('0x22');this['dialLimitChannel']=_0x4717c2[_0x760d('0x23')]||0x0;this[_0x760d('0x24')]=_0x4717c2['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x4717c2[_0x760d('0x25')]||0x1;this[_0x760d('0x26')]=_0x4717c2[_0x760d('0x26')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x4717c2['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x4717c2[_0x760d('0x27')]||0x258;this[_0x760d('0x28')]=_0x4717c2[_0x760d('0x28')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x4717c2[_0x760d('0x29')]||_0x760d('0x2a');this['dialOriginateTimeout']=_0x4717c2['dialOriginateTimeout']||0x1e;this[_0x760d('0x2b')]=_0x4717c2[_0x760d('0x2b')]||_0x760d('0x2c');this['dialQueueTimeout']=_0x4717c2[_0x760d('0x2d')]||0x3;this[_0x760d('0x2e')]=_0x4717c2[_0x760d('0x2e')]||undefined;this[_0x760d('0x2f')]=_0x4717c2[_0x760d('0x2f')]||0x3;this[_0x760d('0x30')]=_0x4717c2[_0x760d('0x30')]||0x96;this['dialBusyMaxRetry']=_0x4717c2[_0x760d('0x31')]||0x3;this[_0x760d('0x32')]=_0x4717c2['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x4717c2[_0x760d('0x33')]||0x3;this[_0x760d('0x34')]=_0x4717c2[_0x760d('0x34')]||0x96;this[_0x760d('0x35')]=_0x4717c2['dialNoSuchNumberMaxRetry']||0x3;this[_0x760d('0x36')]=_0x4717c2[_0x760d('0x36')]||0x96;this[_0x760d('0x37')]=_0x4717c2[_0x760d('0x37')]||0x3;this[_0x760d('0x38')]=_0x4717c2[_0x760d('0x38')]||0x96;this[_0x760d('0x39')]=_0x4717c2[_0x760d('0x39')]||0x3;this[_0x760d('0x3a')]=_0x4717c2[_0x760d('0x3a')]||0x96;this[_0x760d('0x3b')]=_0x4717c2[_0x760d('0x3b')]||0x3;this['dialMachineRetryFrequency']=_0x4717c2[_0x760d('0x3c')]||0x96;this[_0x760d('0x3d')]=_0x4717c2[_0x760d('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4717c2[_0x760d('0x3e')]||0x96;this[_0x760d('0x3f')]=_0x4717c2['dialGlobalMaxRetry']||0x4;this[_0x760d('0x40')]=_0x4717c2[_0x760d('0x40')]?_0x4717c2[_0x760d('0x40')]:undefined;this[_0x760d('0x41')]=_0x4717c2[_0x760d('0x41')]?_0x4717c2['TrunkBackup']:undefined;this[_0x760d('0x42')]=_0x4717c2['dialPrefix']||undefined;this['Interval']=_0x4717c2[_0x760d('0x43')]?_0x4717c2[_0x760d('0x43')]:undefined;this[_0x760d('0x44')]=_0x4717c2[_0x760d('0x44')]||'DESC';this[_0x760d('0x45')]=_0x4717c2['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x760d('0x46')]=_0x4717c2['dialCutDigit']||undefined;this[_0x760d('0x47')]=strategy[_0x4717c2['strategy']]||_0x760d('0xa');this[_0x760d('0x48')]=!![];this[_0x760d('0x49')]=_0x4717c2[_0x760d('0x49')]||![];this[_0x760d('0x4a')]=_0x4717c2[_0x760d('0x4a')];this[_0x760d('0x4b')]=_0x4717c2[_0x760d('0x4b')];this[_0x760d('0x4c')]=_0x4717c2[_0x760d('0x4c')];this['dialAMDTotalAnalysisTime']=_0x4717c2['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x4717c2[_0x760d('0x4d')];this[_0x760d('0x4e')]=_0x4717c2[_0x760d('0x4e')];this[_0x760d('0x4f')]=_0x4717c2['dialAMDMaximumNumberOfWords'];this[_0x760d('0x50')]=_0x4717c2[_0x760d('0x50')];this[_0x760d('0x51')]=_0x4717c2[_0x760d('0x51')];this[_0x760d('0x52')]=0x0;this['pTalking']=0x0;this[_0x760d('0x53')]=_0x4717c2['timeout'];this[_0x760d('0x54')]=0x0;this[_0x760d('0x55')]=0x0;this[_0x760d('0x56')]=0x0;this[_0x760d('0x57')]=0x0;this[_0x760d('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x760d('0x59')]=0x0;this[_0x760d('0x5a')]=0x0;this[_0x760d('0x5b')]=0x0;this[_0x760d('0x5c')]=0x0;this[_0x760d('0x5d')]=0x0;this[_0x760d('0x5e')]=0x0;this[_0x760d('0x5f')]=0x0;this[_0x760d('0x60')]=0x0;this[_0x760d('0x61')]=undefined;this[_0x760d('0x62')]=undefined;this[_0x760d('0x63')]=undefined;this[_0x760d('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x760d('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x760d('0x66')]=0x0;this[_0x760d('0x67')]=0x0;this[_0x760d('0x68')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x4717c2[_0x760d('0x69')]||0x14;this['predictiveIntervalMinThreshold']=_0x4717c2[_0x760d('0x69')]||0xa;this[_0x760d('0x6a')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x760d('0x6b')]=0x1;this[_0x760d('0x6c')]=0x0;this[_0x760d('0x6d')]=0x0;this[_0x760d('0x6e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x760d('0x6f')]=_0x4717c2['dialRecallMeTimeout']||0x1e;this[_0x760d('0x70')]=_0x4717c2[_0x760d('0x70')]||![];this['dialQueueProject2']=_0x4717c2[_0x760d('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x4717c2[_0x760d('0x72')]||![];this[_0x760d('0x73')]=_0x4717c2[_0x760d('0x73')]||![];this[_0x760d('0xd')]=monitorFormat[_0x4717c2[_0x760d('0xd')]]?monitorFormat[_0x4717c2[_0x760d('0xd')]]:undefined;this['mandatoryDisposition']=_0x4717c2[_0x760d('0x74')]||![];this['mandatoryDispositionPause']=_0x4717c2[_0x760d('0x75')]?_0x4717c2[_0x760d('0x75')]:undefined;}module[_0x760d('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index dc698c7..a9bfe80 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 _0xf24e=['Configurations','exports','username','accessKey','remoteUri','serverUrl'];(function(_0x4fccfe,_0x308342){var _0x55b85a=function(_0x4067d4){while(--_0x4067d4){_0x4fccfe['push'](_0x4fccfe['shift']());}};_0x55b85a(++_0x308342);}(_0xf24e,0x110));var _0xef24=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0xf24e[_0xfbe06e];return _0x24e5b6;};'use strict';function VtigerAccount(_0x11e862){this['id']=_0x11e862['id']||0x0;this['name']=_0x11e862['name']||'';this[_0xef24('0x0')]=_0x11e862['username']||'';this[_0xef24('0x1')]=_0x11e862[_0xef24('0x1')]||'';this['remoteUri']=_0x11e862[_0xef24('0x2')]||'';this[_0xef24('0x3')]=_0x11e862['serverUrl']||'';this[_0xef24('0x4')]=_0x11e862[_0xef24('0x4')]||{};}module[_0xef24('0x5')]=VtigerAccount; \ No newline at end of file +var _0x1146=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x5e3201,_0x14348a){var _0x502eca=function(_0xe0be5b){while(--_0xe0be5b){_0x5e3201['push'](_0x5e3201['shift']());}};_0x502eca(++_0x14348a);}(_0x1146,0xf9));var _0x6114=function(_0x56191f,_0x1da145){_0x56191f=_0x56191f-0x0;var _0x14ee3c=_0x1146[_0x56191f];return _0x14ee3c;};'use strict';function VtigerAccount(_0x28fe72){this['id']=_0x28fe72['id']||0x0;this['name']=_0x28fe72[_0x6114('0x0')]||'';this[_0x6114('0x1')]=_0x28fe72[_0x6114('0x1')]||'';this[_0x6114('0x2')]=_0x28fe72[_0x6114('0x2')]||'';this[_0x6114('0x3')]=_0x28fe72[_0x6114('0x3')]||'';this[_0x6114('0x4')]=_0x28fe72[_0x6114('0x4')]||'';this[_0x6114('0x5')]=_0x28fe72[_0x6114('0x5')]||{};}module[_0x6114('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a4eace3..119ad43 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 _0x9861=['authType','type','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0xdef580,_0x136060){var _0x3fce09=function(_0x2c8f9c){while(--_0x2c8f9c){_0xdef580['push'](_0xdef580['shift']());}};_0x3fce09(++_0x136060);}(_0x9861,0xc3));var _0x1986=function(_0x589c22,_0x17de47){_0x589c22=_0x589c22-0x0;var _0x30867c=_0x9861[_0x589c22];return _0x30867c;};'use strict';function ZendeskAccount(_0x36e966){this['id']=_0x36e966['id']||0x0;this[_0x1986('0x0')]=_0x36e966[_0x1986('0x0')]||'';this[_0x1986('0x1')]=_0x36e966[_0x1986('0x1')]||'';this[_0x1986('0x2')]=_0x36e966[_0x1986('0x2')]||'';this[_0x1986('0x3')]=_0x36e966[_0x1986('0x3')]||'';this['remoteUri']=_0x36e966[_0x1986('0x4')]||'';this[_0x1986('0x5')]=_0x36e966[_0x1986('0x5')]||'';this[_0x1986('0x6')]=_0x36e966[_0x1986('0x6')]||'integrationTab';this[_0x1986('0x7')]=_0x36e966[_0x1986('0x7')]||'';this['Configurations']=_0x36e966[_0x1986('0x8')]||{};}module[_0x1986('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x8d15=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x18deef,_0x5b8774){var _0x3f4361=function(_0xc61e4d){while(--_0xc61e4d){_0x18deef['push'](_0x18deef['shift']());}};_0x3f4361(++_0x5b8774);}(_0x8d15,0x93));var _0x58d1=function(_0x213547,_0x309820){_0x213547=_0x213547-0x0;var _0x5ce78b=_0x8d15[_0x213547];return _0x5ce78b;};'use strict';function ZendeskAccount(_0x1f1e63){this['id']=_0x1f1e63['id']||0x0;this['name']=_0x1f1e63[_0x58d1('0x0')]||'';this[_0x58d1('0x1')]=_0x1f1e63['username']||'';this[_0x58d1('0x2')]=_0x1f1e63[_0x58d1('0x2')]||'';this['token']=_0x1f1e63[_0x58d1('0x3')]||'';this['remoteUri']=_0x1f1e63[_0x58d1('0x4')]||'';this['authType']=_0x1f1e63[_0x58d1('0x5')]||'';this[_0x58d1('0x6')]=_0x1f1e63['type']||_0x58d1('0x7');this['serverUrl']=_0x1f1e63[_0x58d1('0x8')]||'';this[_0x58d1('0x9')]=_0x1f1e63[_0x58d1('0x9')]||{};}module[_0x58d1('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a8411e0..eff0dde 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 _0x884d=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x4a8ae0,_0x1c4dd9){var _0x8eae63=function(_0x5eed89){while(--_0x5eed89){_0x4a8ae0['push'](_0x4a8ae0['shift']());}};_0x8eae63(++_0x1c4dd9);}(_0x884d,0x180));var _0xd884=function(_0x18c1fc,_0x54e77b){_0x18c1fc=_0x18c1fc-0x0;var _0x1303c7=_0x884d[_0x18c1fc];return _0x1303c7;};'use strict';function ZohoAccount(_0x34c4d1){this['id']=_0x34c4d1['id']||0x0;this[_0xd884('0x0')]=_0x34c4d1[_0xd884('0x0')]||'';this[_0xd884('0x1')]=_0x34c4d1[_0xd884('0x1')]||'';this['host']=_0x34c4d1[_0xd884('0x2')]||'';this[_0xd884('0x3')]=_0x34c4d1['zone']||'';this['clientId']=_0x34c4d1[_0xd884('0x4')]||'';this['clientSecret']=_0x34c4d1[_0xd884('0x5')]||'';this['serverUrl']=_0x34c4d1[_0xd884('0x6')]||'';this[_0xd884('0x7')]=_0x34c4d1[_0xd884('0x7')]||'';this[_0xd884('0x8')]=_0x34c4d1[_0xd884('0x8')]||'';this[_0xd884('0x9')]=_0x34c4d1[_0xd884('0x9')]||{};}module[_0xd884('0xa')]=ZohoAccount; \ No newline at end of file +var _0x1750=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x4561f1,_0x171083){var _0x1ddfb4=function(_0x2ccadc){while(--_0x2ccadc){_0x4561f1['push'](_0x4561f1['shift']());}};_0x1ddfb4(++_0x171083);}(_0x1750,0x65));var _0x0175=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x1750[_0x31e29a];return _0x32d892;};'use strict';function ZohoAccount(_0x8e89fe){this['id']=_0x8e89fe['id']||0x0;this[_0x0175('0x0')]=_0x8e89fe[_0x0175('0x0')]||'';this[_0x0175('0x1')]=_0x8e89fe['description']||'';this[_0x0175('0x2')]=_0x8e89fe[_0x0175('0x2')]||'';this[_0x0175('0x3')]=_0x8e89fe[_0x0175('0x3')]||'';this['clientId']=_0x8e89fe[_0x0175('0x4')]||'';this[_0x0175('0x5')]=_0x8e89fe['clientSecret']||'';this[_0x0175('0x6')]=_0x8e89fe[_0x0175('0x6')]||'';this[_0x0175('0x7')]=_0x8e89fe[_0x0175('0x7')]||'';this[_0x0175('0x8')]=_0x8e89fe['refreshToken']||'';this[_0x0175('0x9')]=_0x8e89fe['Configurations']||{};}module[_0x0175('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 e4cc6cd..580042d 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 _0x0c4c=['countagentrejectretry','countabandonedretry','callback','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','dialAnswer','membername','Agent','name','format','calleridname','phone','Contact','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry'];(function(_0x2b436d,_0x1f07fc){var _0x546141=function(_0x37a734){while(--_0x37a734){_0x2b436d['push'](_0x2b436d['shift']());}};_0x546141(++_0x1f07fc);}(_0x0c4c,0x175));var _0xc0c4=function(_0x5ac290,_0xf90922){_0x5ac290=_0x5ac290-0x0;var _0x413b4a=_0x0c4c[_0x5ac290];return _0x413b4a;};'use strict';var util=require(_0xc0c4('0x0'));var _=require(_0xc0c4('0x1'));var moment=require(_0xc0c4('0x2'));function checkNameSurname(_0x41ae3b,_0x5498e3,_0x5a4953){var _0x182c0d='';if(!_[_0xc0c4('0x3')](_0x5498e3)&&_0xc0c4('0x4')===typeof _0x5498e3){_0x182c0d+=_0x5498e3;}if(!_['isNil'](_0x5a4953)&&_0xc0c4('0x4')===typeof _0x5a4953){_0x182c0d+='\x20'+_0x5a4953;}if(_0x182c0d!==''){return _0x182c0d;}return _0x41ae3b;}function Action(_0x56b062,_0xa33d21,_0x52a4d9,_0x2b0dd4,_0x559858){this[_0xc0c4('0x5')]=_0x52a4d9||undefined;this[_0xc0c4('0x6')]=_0x56b062['id'];this[_0xc0c4('0x7')]=_0xa33d21['name'];this['type']=_0xa33d21[_0xc0c4('0x8')];this['campaigntype']=_0xc0c4('0x7');this[_0xc0c4('0x9')]=![];this[_0xc0c4('0xa')]=_[_0xc0c4('0x3')](_0x56b062[_0xc0c4('0xb')])?undefined:_0x56b062['Agent'][_0xc0c4('0xc')];this['channelAgent']=this[_0xc0c4('0xa')]?util[_0xc0c4('0xd')]('SIP/%s',this[_0xc0c4('0xa')]):_0x2b0dd4||undefined;this[_0xc0c4('0xe')]=checkNameSurname(_0x56b062['Contact'][_0xc0c4('0xf')],_0x56b062[_0xc0c4('0x10')]['firstName'],_0x56b062[_0xc0c4('0x10')][_0xc0c4('0x11')]);this[_0xc0c4('0x12')]=_0x56b062[_0xc0c4('0x12')]||![];this['calleridnum']=_0x56b062[_0xc0c4('0x10')][_0xc0c4('0xf')];this[_0xc0c4('0x13')]=_0x56b062[_0xc0c4('0x13')];this[_0xc0c4('0x14')]=_0x56b062['countbusyretry']||0x0;this[_0xc0c4('0x15')]=_0x56b062[_0xc0c4('0x15')]||0x0;this[_0xc0c4('0x16')]=_0x56b062[_0xc0c4('0x16')]||0x0;this[_0xc0c4('0x17')]=(_0x56b062[_0xc0c4('0x14')]||0x0)+(_0x56b062[_0xc0c4('0x15')]||0x0)+(_0x56b062[_0xc0c4('0x16')]||0x0)+(_0x56b062[_0xc0c4('0x18')]||0x0)+(_0x56b062[_0xc0c4('0x19')]||0x0)+(_0x56b062['countabandonedretry']||0x0)+(_0x56b062[_0xc0c4('0x1a')]||0x0)+(_0x56b062[_0xc0c4('0x1b')]||0x0);this[_0xc0c4('0x18')]=_0x56b062['countnosuchnumberretry']||0x0;this[_0xc0c4('0x19')]=_0x56b062['countdropretry']||0x0;this[_0xc0c4('0x1c')]=_0x56b062[_0xc0c4('0x1c')]||0x0;this[_0xc0c4('0x1a')]=_0x56b062[_0xc0c4('0x1a')]||0x0;this[_0xc0c4('0x1b')]=_0x56b062[_0xc0c4('0x1b')]||0x0;this[_0xc0c4('0x1d')]=_0x56b062[_0xc0c4('0x1d')];this['callbackuniqueid']=_0x56b062['callbackuniqueid'];this['callbackat']=_0x56b062['callbackat'];this[_0xc0c4('0x1e')]=_0x56b062[_0xc0c4('0x1e')];this[_0xc0c4('0x1f')]=_0x56b062[_0xc0c4('0x1f')];this[_0xc0c4('0x20')]=_0x56b062[_0xc0c4('0x20')];this[_0xc0c4('0x21')]=_[_0xc0c4('0x3')](_0x56b062['Agent'])?_0x56b062[_0xc0c4('0x21')]:_0x56b062[_0xc0c4('0xb')]['id'];this[_0xc0c4('0x22')]=_0x56b062[_0xc0c4('0x22')];this[_0xc0c4('0x23')]='';this[_0xc0c4('0x24')]='';}Action[_0xc0c4('0x25')]['getCaller']=function(){return util[_0xc0c4('0xd')](_0xc0c4('0x26'),this['calleridname'],this[_0xc0c4('0x27')]);};module['exports']=Action; \ No newline at end of file +var _0x8213=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','isNil','string','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x8213,0x17c));var _0x3821=function(_0x3ab0cf,_0x32a93f){_0x3ab0cf=_0x3ab0cf-0x0;var _0x4e85e6=_0x8213[_0x3ab0cf];return _0x4e85e6;};'use strict';var util=require('util');var _=require(_0x3821('0x0'));var moment=require('moment');function checkNameSurname(_0x5b5778,_0x3e4482,_0x130808){var _0x3b0cff='';if(!_[_0x3821('0x1')](_0x3e4482)&&_0x3821('0x2')===typeof _0x3e4482){_0x3b0cff+=_0x3e4482;}if(!_[_0x3821('0x1')](_0x130808)&&_0x3821('0x2')===typeof _0x130808){_0x3b0cff+='\x20'+_0x130808;}if(_0x3b0cff!==''){return _0x3b0cff;}return _0x5b5778;}function Action(_0x107a3c,_0x5eed49,_0x5c612e,_0x125d44,_0x4625de){this['uniqueid']=_0x5c612e||undefined;this[_0x3821('0x3')]=_0x107a3c['id'];this[_0x3821('0x4')]=_0x5eed49['name'];this[_0x3821('0x5')]=_0x5eed49[_0x3821('0x5')];this[_0x3821('0x6')]=_0x3821('0x4');this[_0x3821('0x7')]=![];this[_0x3821('0x8')]=_[_0x3821('0x1')](_0x107a3c[_0x3821('0x9')])?undefined:_0x107a3c[_0x3821('0x9')][_0x3821('0xa')];this[_0x3821('0xb')]=this[_0x3821('0x8')]?util[_0x3821('0xc')]('SIP/%s',this[_0x3821('0x8')]):_0x125d44||undefined;this[_0x3821('0xd')]=checkNameSurname(_0x107a3c[_0x3821('0xe')][_0x3821('0xf')],_0x107a3c[_0x3821('0xe')]['firstName'],_0x107a3c[_0x3821('0xe')][_0x3821('0x10')]);this[_0x3821('0x11')]=_0x107a3c[_0x3821('0x11')]||![];this[_0x3821('0x12')]=_0x107a3c['Contact'][_0x3821('0xf')];this[_0x3821('0x13')]=_0x107a3c[_0x3821('0x13')];this[_0x3821('0x14')]=_0x107a3c[_0x3821('0x14')]||0x0;this[_0x3821('0x15')]=_0x107a3c[_0x3821('0x15')]||0x0;this[_0x3821('0x16')]=_0x107a3c[_0x3821('0x16')]||0x0;this['countglobal']=(_0x107a3c[_0x3821('0x14')]||0x0)+(_0x107a3c['countcongestionretry']||0x0)+(_0x107a3c[_0x3821('0x16')]||0x0)+(_0x107a3c[_0x3821('0x17')]||0x0)+(_0x107a3c[_0x3821('0x18')]||0x0)+(_0x107a3c['countabandonedretry']||0x0)+(_0x107a3c[_0x3821('0x19')]||0x0)+(_0x107a3c[_0x3821('0x1a')]||0x0);this[_0x3821('0x17')]=_0x107a3c[_0x3821('0x17')]||0x0;this['countdropretry']=_0x107a3c[_0x3821('0x18')]||0x0;this['countabandonedretry']=_0x107a3c[_0x3821('0x1b')]||0x0;this[_0x3821('0x19')]=_0x107a3c[_0x3821('0x19')]||0x0;this[_0x3821('0x1a')]=_0x107a3c[_0x3821('0x1a')]||0x0;this['callback']=_0x107a3c['callback'];this[_0x3821('0x1c')]=_0x107a3c[_0x3821('0x1c')];this['callbackat']=_0x107a3c[_0x3821('0x1d')];this['recallme']=_0x107a3c[_0x3821('0x1e')];this['ContactId']=_0x107a3c['ContactId'];this[_0x3821('0x1f')]=_0x107a3c['ListId'];this[_0x3821('0x20')]=_[_0x3821('0x1')](_0x107a3c[_0x3821('0x9')])?_0x107a3c['UserId']:_0x107a3c[_0x3821('0x9')]['id'];this[_0x3821('0x21')]=_0x107a3c[_0x3821('0x21')];this[_0x3821('0x22')]='';this['originatecalleridname']='';}Action[_0x3821('0x23')][_0x3821('0x24')]=function(){return util[_0x3821('0xc')](_0x3821('0x25'),this[_0x3821('0xd')],this[_0x3821('0x26')]);};module[_0x3821('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index bcf1fb4..abc3d94 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 _0x0fc0=['./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','voiceQueues','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','outbound','name','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','Interval','stringify','format','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','type','dialActive','recallMe','clearZombieChannel','info','Queue','queue','originated:\x20','dialAnswer','pick','contactId','VoiceQueueId','catch','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','TrunkBackup','ACTIVE','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','connect','acw','custom:agentcomplete','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','cloneAction','scheduledAt','countagentrejectretry','AgentReject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','active','trunks','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','isTrunkReachable','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','addVariables','toLowerVariables','Action','variablesAction','channelAgent','destconnectedlinenum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','callProgressDetectingCustomer','[syncHangup][talking][cause]','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','../ami'];(function(_0x5e3b6b,_0x2ff7d9){var _0x5414a7=function(_0x414fe2){while(--_0x414fe2){_0x5e3b6b['push'](_0x5e3b6b['shift']());}};_0x5414a7(++_0x2ff7d9);}(_0x0fc0,0x148));var _0x00fc=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x0fc0[_0x29d94e];return _0x106237;};'use strict';var util=require('util');var _=require(_0x00fc('0x0'));var BPromise=require(_0x00fc('0x1'));var uuid=require(_0x00fc('0x2'));var moment=require(_0x00fc('0x3'));var md5=require(_0x00fc('0x4'));var Redis=require(_0x00fc('0x5'));var config=require('../../../config/environment');var logger=require(_0x00fc('0x6'))(_0x00fc('0x7'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x00fc('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0x00fc('0x9'));var ut=require(_0x00fc('0xa'));config[_0x00fc('0xb')]=_['defaults'](config['redis'],{'host':_0x00fc('0xc'),'port':0x18eb});var io=require(_0x00fc('0xd'))(new Redis(config[_0x00fc('0xb')]));var Sequence=function(){};Sequence[_0x00fc('0xe')][_0x00fc('0xf')]=function(_0x3f2de8){this['tail']=this[_0x00fc('0x10')]?this[_0x00fc('0x10')]['finally'](_0x3f2de8):_0x3f2de8();};function Preview(_0x404537){this[_0x00fc('0x11')]=new Sequence();this['campaignsPreview']=_0x404537[_0x00fc('0x12')];this['trunks']=_0x404537['trunks'];this[_0x00fc('0x13')]={};this[_0x00fc('0x14')]=_0x404537['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x00fc('0x15')][_0x00fc('0x16')](this));ami['on'](_0x00fc('0x17'),this[_0x00fc('0x18')][_0x00fc('0x16')](this));ami['on'](_0x00fc('0x19'),this[_0x00fc('0x1a')][_0x00fc('0x16')](this));ami['on'](_0x00fc('0x1b'),this[_0x00fc('0x1c')][_0x00fc('0x16')](this));ami['on'](_0x00fc('0x1d'),this[_0x00fc('0x1e')][_0x00fc('0x16')](this));ami['on'](_0x00fc('0x1f'),this[_0x00fc('0x20')][_0x00fc('0x16')](this));ami['on'](_0x00fc('0x21'),this[_0x00fc('0x22')][_0x00fc('0x16')](this));ami['on'](_0x00fc('0x23'),this['syncBlindTransfer']['bind'](this));this[_0x00fc('0x24')](this[_0x00fc('0x25')]);}function emit(_0x1c85d1,_0x131e82,_0x440952){io['to'](_0x1c85d1)[_0x00fc('0x26')](_0x131e82,_0x440952);}function emitCampaignPreview(_0x22a873){if(_0x22a873['type']===_0x00fc('0x27')){var _0x5c670a={'id':_0x22a873['id'],'name':_0x22a873[_0x00fc('0x28')],'strategy':_0x22a873['strategy'],'answered':_0x22a873[_0x00fc('0x29')],'available':_0x22a873[_0x00fc('0x2a')],'loggedIn':_0x22a873['loggedIn'],'pTalking':_0x22a873[_0x00fc('0x2b')],'sumBillable':_0x22a873['sumBillable'],'sumDuration':_0x22a873[_0x00fc('0x2c')],'sumHoldTime':_0x22a873[_0x00fc('0x2d')]||0x0,'talking':_0x22a873[_0x00fc('0x2e')],'total':_0x22a873[_0x00fc('0x2f')],'type':_0x22a873['type'],'unmanaged':_0x22a873[_0x00fc('0x30')],'abandoned':_0x22a873[_0x00fc('0x31')],'waiting':_0x22a873[_0x00fc('0x32')],'loggedInDb':_0x22a873[_0x00fc('0x33')],'dialActive':_0x22a873['dialActive'],'dialMethod':_0x22a873[_0x00fc('0x34')],'dialOriginateCallerIdName':_0x22a873['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x22a873['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x22a873[_0x00fc('0x35')],'dialPrefix':_0x22a873[_0x00fc('0x36')],'outboundAnswerAgiCallsDay':_0x22a873[_0x00fc('0x37')],'outboundAnswerCallsDay':_0x22a873[_0x00fc('0x38')],'outboundBlacklistCallsDay':_0x22a873[_0x00fc('0x39')],'outboundBusyCallsDay':_0x22a873[_0x00fc('0x3a')],'outboundCongestionCallsDay':_0x22a873['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x22a873['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x22a873[_0x00fc('0x3b')],'outboundDropCallsDayTimeout':_0x22a873[_0x00fc('0x3c')],'outboundNoAnswerCallsDay':_0x22a873[_0x00fc('0x3d')],'outboundNoSuchCallsDay':_0x22a873[_0x00fc('0x3e')],'outboundOriginateFailureCallsDay':_0x22a873['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x22a873['outboundReCallsDay'],'outboundRejectCallsDay':_0x22a873[_0x00fc('0x3f')],'outboundUnknownCallsDay':_0x22a873[_0x00fc('0x40')],'outboundAbandonedCallsDay':_0x22a873[_0x00fc('0x41')],'predictiveIntervalAnsweredCalls':_0x22a873[_0x00fc('0x42')],'predictiveIntervalAvgHoldtime':_0x22a873[_0x00fc('0x43')],'predictiveIntervalAvgTalktime':_0x22a873[_0x00fc('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x22a873['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x22a873[_0x00fc('0x45')],'predictiveIntervalErlangCalls':_0x22a873['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x22a873['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x22a873[_0x00fc('0x46')],'predictiveIntervalMultiplicativeFactor':_0x22a873[_0x00fc('0x47')],'predictiveIntervalPauses':_0x22a873['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x22a873[_0x00fc('0x48')],'predictiveIntervalTotalCalls':_0x22a873[_0x00fc('0x49')],'message':_0x22a873[_0x00fc('0x4a')],'originated':_0x22a873['originated'],'erlangCalls':_0x22a873['erlangCalls'],'erlangCallToSecond':_0x22a873['erlangCallToSecond'],'erlangAbandonmentRate':_0x22a873[_0x00fc('0x4b')],'erlangBusyFactor':_0x22a873[_0x00fc('0x4c')],'startPredictive':_0x22a873['startPredictive'],'startProgressive':_0x22a873[_0x00fc('0x4d')]};if(_0x22a873[_0x00fc('0x4e')]){_0x5c670a['Trunk']={'id':_0x22a873[_0x00fc('0x4e')]['id'],'name':_0x22a873[_0x00fc('0x4e')][_0x00fc('0x28')],'active':_0x22a873['Trunk']['active'],'callerid':_0x22a873[_0x00fc('0x4e')][_0x00fc('0x4f')]};}if(_0x22a873[_0x00fc('0x50')]){_0x5c670a[_0x00fc('0x50')]={'id':_0x22a873['Interval']['id'],'name':_0x22a873[_0x00fc('0x50')][_0x00fc('0x28')]};}var _0x4b58b6=md5(JSON[_0x00fc('0x51')](_0x5c670a));if(_0x22a873[_0x00fc('0x4')]!==_0x4b58b6){_0x22a873['md5']=_0x4b58b6;emit(util[_0x00fc('0x52')]('voice:queue:%s',_0x5c670a['name']),_0x00fc('0x53'),_0x5c670a);}}}function emitVoiceQueueChannelRemove(_0x549633){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x00fc('0x51')](_0x549633));emit(util[_0x00fc('0x52')]('voice:queue:%s',_0x549633[_0x00fc('0x28')]),_0x00fc('0x54'),_0x549633);io[_0x00fc('0x26')]('voice_queue_presence:remove',_0x549633);}function notSendMessagesQueue(_0x455769){if(_0x455769[_0x00fc('0x55')]){if(_0x455769[_0x00fc('0x56')]===0x0&&_0x455769[_0x00fc('0x2b')]===0x0){_0x455769['sendMessageOneNotActive']=![];_0x455769[_0x00fc('0x2a')]=0x0;_0x455769[_0x00fc('0x57')]=0x0;_0x455769[_0x00fc('0x4a')]=_0x00fc('0x58');ut[_0x00fc('0x59')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x455769['name']+_0x00fc('0x5a'));}else{_0x455769[_0x00fc('0x4a')]=_0x00fc('0x5b');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x455769[_0x00fc('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0x455769);}}Preview[_0x00fc('0xe')][_0x00fc('0x24')]=function(){var _0x3f8744=this;setInterval(function(){_0x3f8744[_0x00fc('0x5c')]();},0x7cf);};Preview[_0x00fc('0xe')][_0x00fc('0x5c')]=function(){var _0x34f9b2=this[_0x00fc('0x25')];this[_0x00fc('0x5d')]+=0x1;for(var _0xae9211 in _0x34f9b2){if(_0x34f9b2[_0x00fc('0x5e')](_0xae9211)&&(_0x34f9b2[_0xae9211][_0x00fc('0x34')]===_0x00fc('0x7')||_0x34f9b2[_0xae9211][_0x00fc('0x34')]===_0x00fc('0x5f'))&&_0x34f9b2[_0xae9211][_0x00fc('0x60')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x00fc('0x5d')]=0x0;this['clearZombieChannels']();}}if(_0x34f9b2[_0x00fc('0x5e')](_0xae9211)&&_0x34f9b2[_0xae9211]['dialMethod']===_0x00fc('0x7')&&_0x34f9b2[_0xae9211][_0x00fc('0x60')]===_0x00fc('0x27')){if(_0x34f9b2[_0xae9211][_0x00fc('0x61')]){this['setMessage'](_0x34f9b2[_0xae9211]);this[_0x00fc('0x62')](_0x34f9b2[_0xae9211]);}else{notSendMessagesQueue(_0x34f9b2[_0xae9211]);}}}};Preview[_0x00fc('0xe')][_0x00fc('0x63')]=function(_0x2c8f21){var _0x572a2b=this;this[_0x00fc('0x11')][_0x00fc('0xf')](function(){if(!_['isNil'](_0x572a2b[_0x00fc('0x13')][_0x2c8f21])){loggerAction[_0x00fc('0x64')]('[clearZombieChannels][talking]',_0x2c8f21,_0x00fc('0x65'),_0x572a2b[_0x00fc('0x13')][_0x2c8f21][_0x00fc('0x66')],_0x00fc('0x67'),JSON[_0x00fc('0x51')](_0x572a2b[_0x00fc('0x25')][_0x572a2b[_0x00fc('0x13')][_0x2c8f21][_0x00fc('0x66')]][_0x00fc('0x56')]),'pTalking:\x20',JSON[_0x00fc('0x51')](_0x572a2b[_0x00fc('0x25')][_0x572a2b[_0x00fc('0x13')][_0x2c8f21][_0x00fc('0x66')]][_0x00fc('0x2b')]),JSON[_0x00fc('0x51')](_0x572a2b[_0x00fc('0x13')][_0x2c8f21][_0x00fc('0x68')]),JSON['stringify'](_[_0x00fc('0x69')](_0x572a2b[_0x00fc('0x13')][_0x2c8f21],[_0x00fc('0x6a'),'UserId',_0x00fc('0x6b'),'ListId'])));return ami['Action']({'action':'status','channel':_0x572a2b['actions'][_0x2c8f21]['channel']})[_0x00fc('0x6c')](function(_0xfd66c9){if(_0xfd66c9[_0x00fc('0x4a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x572a2b['actions'][_0x2c8f21]){ut[_0x00fc('0x6d')](_0x572a2b[_0x00fc('0x25')][_0x572a2b[_0x00fc('0x13')][_0x2c8f21][_0x00fc('0x66')]],'[clearZombieChannel]');if(_0x572a2b[_0x00fc('0x13')][_0x2c8f21][_0x00fc('0x68')]===!![]){ut['decrementTalkink'](_0x572a2b['campaignsPreview'][_0x572a2b[_0x00fc('0x13')][_0x2c8f21]['queue']],_0x00fc('0x6e'));ut[_0x00fc('0x6f')](_0x00fc('0x70')+_0x2c8f21,_0x572a2b[_0x00fc('0x13')][_0x2c8f21][_0x00fc('0x66')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c8f21,_0x572a2b['actions'][_0x2c8f21][_0x00fc('0x66')]);delete _0x572a2b[_0x00fc('0x13')][_0x2c8f21];}},0x2328);}});}});};Preview[_0x00fc('0xe')][_0x00fc('0x71')]=function(){var _0x59ee28=this;loggerAction[_0x00fc('0x64')](_0x00fc('0x72'),_[_0x00fc('0x73')](this[_0x00fc('0x13')]));for(var _0x1a2771 in this[_0x00fc('0x13')]){if(_0x59ee28['actions'][_0x00fc('0x5e')](_0x1a2771)){_0x59ee28['clearZombieChannel'](_0x1a2771);}}};Preview[_0x00fc('0xe')][_0x00fc('0x62')]=function(_0x1cafdb){var _0x29fd8c=this;rpcDb[_0x00fc('0x74')](_0x1cafdb['id'],ut['agentReadyId'](this[_0x00fc('0x14')]))['then'](function(_0x28fe97){if(!_[_0x00fc('0x75')](_0x28fe97)){for(var _0x1f38ab=0x0;_0x1f38ab<_0x28fe97[_0x00fc('0x76')];_0x1f38ab+=0x1){if(ut[_0x00fc('0x77')](_0x28fe97[_0x1f38ab][_0x00fc('0x78')])<_0x1cafdb[_0x00fc('0x79')]*0x3c){if(_0x28fe97[_0x1f38ab]['Agent']&&!_0x28fe97[_0x1f38ab][_0x00fc('0x7a')]['voicePause']){_0x29fd8c[_0x00fc('0x7b')](_0x28fe97[_0x1f38ab]['id'])[_0x00fc('0x7c')](ut[_0x00fc('0x7d')](_0x00fc('0x7e')))[_0x00fc('0x6c')](ut[_0x00fc('0x7d')](_0x00fc('0x7e')));}else{rpcDb[_0x00fc('0x7f')](_0x28fe97[_0x1f38ab]['id']);}}else{var _0x3eb069=new Action(_0x28fe97[_0x1f38ab],_0x1cafdb);_0x3eb069[_0x00fc('0x80')]=moment()['format'](_0x00fc('0x81'));_0x1cafdb[_0x00fc('0x82')]+=0x1;ut[_0x00fc('0x83')](_0x3eb069,0x17,_0x00fc('0x84'));if(_0x1cafdb['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x00fc('0x85')](_0x28fe97[_0x1f38ab]));rpcDb[_0x00fc('0x86')](_0x3eb069,_0x00fc('0x87'));}else{ut[_0x00fc('0x83')](_0x3eb069,0x16,_0x00fc('0x88'));rpcDb['createCustomerHistory'](_0x3eb069,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x3eb069,_0x00fc('0x89'));}}}}})[_0x00fc('0x6c')](ut[_0x00fc('0x7d')](_0x00fc('0x8a')));};Preview[_0x00fc('0xe')][_0x00fc('0x8b')]=function(_0x3bfb64){_0x3bfb64['sendMessageOneNotActive']=!![];if(ut[_0x00fc('0x8c')](_0x3bfb64['loggedIn'])){_0x3bfb64[_0x00fc('0x4a')]=_0x00fc('0x8d');}else if(!ut['isActive'](_0x3bfb64[_0x00fc('0x61')])){_0x3bfb64[_0x00fc('0x4a')]=_0x00fc('0x58');}else if(!this['isTrunkReachable'](_0x3bfb64[_0x00fc('0x4e')])){if(!this['isTrunkReachable'](_0x3bfb64[_0x00fc('0x8e')])){_0x3bfb64[_0x00fc('0x4a')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3bfb64[_0x00fc('0x4a')]=_0x00fc('0x8f');}}else{_0x3bfb64[_0x00fc('0x4a')]=_0x00fc('0x8f');}emitCampaignPreview(_0x3bfb64);};Preview[_0x00fc('0xe')]['callProgressDetectingCustomer']=function(_0x520ab8,_0x13bcb3,_0x1754e2){var _0x3094d6=this;var _0x377f00=this[_0x00fc('0x13')][_0x13bcb3];var _0xbaf8b0=this[_0x00fc('0x25')][_0x377f00['queue']];var _0x3bc81e;if(_0xbaf8b0){switch(_0x1754e2){case'1':_0xbaf8b0[_0x00fc('0x3e')]+=0x1;_0x377f00['countnosuchnumberretry']+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0x0,_0x00fc('0x92'));ami[_0x00fc('0x26')]('custom:agentnosuchnumber',ut[_0x00fc('0x93')](_0x377f00,_0x00fc('0x94')));rpcDb[_0x00fc('0x86')](_0x377f00,_0x00fc('0x95'));if(ut['totalGlobal'](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut['cloneAction'](_0x377f00,0xf,_0x00fc('0x97'));rpcDb['createCustomerFinal'](_0x3bc81e,_0x00fc('0x98'));}else{if(_0x377f00[_0x00fc('0x99')]>=_0xbaf8b0[_0x00fc('0x9a')]){rpcDb[_0x00fc('0x9b')](_0x377f00,_0x00fc('0x98'));}else{rpcDb[_0x00fc('0x9c')](ut['scheduledAt'](_0x377f00,_0x00fc('0x99'),_0xbaf8b0[_0x00fc('0x9d')]),_0x377f00['unlockAgent'],_0x377f00[_0x00fc('0x9e')]);}}delete this[_0x00fc('0x13')][_0x520ab8['linkedid']];break;case _0x00fc('0x9f'):var _0xf3089c=moment()[_0x00fc('0x52')](_0x00fc('0x81'));_0x377f00['responsetime']=_0xf3089c;_0x377f00[_0x00fc('0xa0')]=_0xf3089c;_0x377f00['dialAnswer']=!![];_0xbaf8b0['pTalking']+=0x1;logger['info'](_0x00fc('0xa1'),_0x377f00[_0x00fc('0xa2')],_0x00fc('0xa3'),_0xbaf8b0[_0x00fc('0x28')],_0x00fc('0xa4'),_0xbaf8b0[_0x00fc('0x2b')]);ami[_0x00fc('0x26')]('custom:agentconnect',ut['buildObj'](_0x377f00,_0x00fc('0xa5'),this[_0x00fc('0x25')][_0x377f00['queue']]));if(_0xbaf8b0[_0x00fc('0xa6')]){ami[_0x00fc('0x26')]('custom:agentConnectPreview',ut['buildAcw'](_0x377f00));}break;case'16':ami['emit'](_0x00fc('0xa7'),ut[_0x00fc('0x93')](_0x377f00,'complete',this[_0x00fc('0x25')][_0x377f00[_0x00fc('0x66')]]));emitVoiceQueueChannelRemove(ut[_0x00fc('0x93')](_0x377f00,_0x00fc('0xa8')));_0xbaf8b0[_0x00fc('0x38')]+=0x1;_0xbaf8b0[_0x00fc('0x2f')]+=0x1;_0xbaf8b0[_0x00fc('0x29')]+=0x1;ut[_0x00fc('0xa9')](_0xbaf8b0,_0x00fc('0xaa'));_0x377f00['countglobal']=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0x4,'Answer');rpcDb['createCustomerHistory'](_0x377f00,_0x00fc('0xab'));rpcDb['createCustomerFinal'](_0x377f00,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x377f00);_0xbaf8b0[_0x00fc('0x2c')]+=_0x377f00[_0x00fc('0xac')];_0xbaf8b0[_0x00fc('0xad')]+=_0x377f00[_0x00fc('0xac')];logger[_0x00fc('0x64')](_0x00fc('0xae'),_0x377f00[_0x00fc('0xa2')],_0x00fc('0xa3'),_0xbaf8b0[_0x00fc('0x28')],_0x00fc('0xa4'),_0xbaf8b0[_0x00fc('0x2b')]);delete this[_0x00fc('0x13')][_0x520ab8[_0x00fc('0xaf')]];break;case _0x00fc('0xb0'):_0xbaf8b0[_0x00fc('0x3a')]+=0x1;_0x377f00[_0x00fc('0xb1')]+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0x5,_0x00fc('0xb2'));ami['emit'](_0x00fc('0xb3'),ut[_0x00fc('0x93')](_0x377f00,_0x00fc('0xb4')));rpcDb[_0x00fc('0x86')](_0x377f00,_0x00fc('0xb5'));if(ut[_0x00fc('0x91')](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut['cloneAction'](_0x377f00,0xf,_0x00fc('0x97'));rpcDb[_0x00fc('0x9b')](_0x3bc81e,_0x00fc('0xb6'));}else{if(_0x377f00[_0x00fc('0xb1')]>=_0xbaf8b0[_0x00fc('0xb7')]){rpcDb[_0x00fc('0x9b')](_0x377f00,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x377f00,'countbusyretry',_0xbaf8b0[_0x00fc('0xb8')]),_0x377f00[_0x00fc('0xb9')],_0x377f00[_0x00fc('0x9e')]);}}break;case _0x00fc('0xba'):_0xbaf8b0[_0x00fc('0x3d')]+=0x1;_0x377f00[_0x00fc('0xbb')]+=0x1;_0x377f00['countglobal']=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0x3,_0x00fc('0xbc'));ami[_0x00fc('0x26')]('custom:agentnoanswer',ut['buildObj'](_0x377f00,'noanswer'));rpcDb['createCustomerHistory'](_0x377f00,_0x00fc('0xbd'));if(ut[_0x00fc('0x91')](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut['cloneAction'](_0x377f00,0xf,_0x00fc('0x97'));rpcDb[_0x00fc('0x9b')](_0x3bc81e,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x377f00[_0x00fc('0xbb')]>=_0xbaf8b0[_0x00fc('0xbe')]){rpcDb[_0x00fc('0x9b')](_0x377f00,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x00fc('0x9c')](ut['scheduledAt'](_0x377f00,_0x00fc('0xbb'),_0xbaf8b0[_0x00fc('0xbf')]),_0x377f00[_0x00fc('0xb9')],_0x377f00[_0x00fc('0x9e')]);}}break;case _0x00fc('0xc0'):_0xbaf8b0[_0x00fc('0xc1')]+=0x1;_0x377f00[_0x00fc('0xc2')]+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0x8,_0x00fc('0xc3'));ami[_0x00fc('0x26')](_0x00fc('0xc4'),ut[_0x00fc('0x93')](_0x377f00,_0x00fc('0xc5')));rpcDb[_0x00fc('0x86')](_0x377f00,_0x00fc('0xc6'));if(ut[_0x00fc('0x91')](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut[_0x00fc('0xc7')](_0x377f00,0xf,_0x00fc('0x97'));rpcDb['createCustomerFinal'](_0x3bc81e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x377f00['countcongestionretry']>=_0xbaf8b0['dialCongestionMaxRetry']){rpcDb[_0x00fc('0x9b')](_0x377f00,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x00fc('0xc8')](_0x377f00,_0x00fc('0xc2'),_0xbaf8b0[_0x00fc('0xb8')]),_0x377f00['unlockAgent'],_0x377f00[_0x00fc('0x9e')]);}}break;case'CANCEL':_0xbaf8b0[_0x00fc('0x3f')]+=0x1;_0x377f00[_0x00fc('0xc9')]+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut['logCustomer'](_0x377f00,0x14,_0x00fc('0xca'));ami[_0x00fc('0x26')]('custom:agentreject',ut['buildObj'](_0x377f00,_0x00fc('0xcb')));rpcDb[_0x00fc('0x86')](_0x377f00,'[syncHangupRequest][logAgentReject]');if(ut[_0x00fc('0x91')](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut[_0x00fc('0xc7')](_0x377f00,0x14,_0x00fc('0xca'));rpcDb[_0x00fc('0x9b')](_0x3bc81e,_0x00fc('0xcc'));}else{if(_0x377f00['countagentrejectretry']>=_0xbaf8b0[_0x00fc('0xcd')]){rpcDb[_0x00fc('0x9b')](_0x377f00,_0x00fc('0xcc'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x377f00,_0x00fc('0xc9'),_0xbaf8b0[_0x00fc('0xce')]),_0x377f00['unlockAgent'],_0x377f00[_0x00fc('0x9e')]);}}break;case _0x00fc('0xcf'):_0xbaf8b0[_0x00fc('0x41')]+=0x1;_0x377f00[_0x00fc('0xd0')]+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0xb,_0x00fc('0xd1'));rpcDb[_0x00fc('0x86')](_0x377f00,_0x00fc('0xd2'));if(ut[_0x00fc('0x91')](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut['cloneAction'](_0x377f00,0xf,_0x00fc('0x97'));rpcDb[_0x00fc('0x9b')](_0x3bc81e,_0x00fc('0xd2'));}else{if(_0x377f00[_0x00fc('0xd3')]>=_0xbaf8b0[_0x00fc('0xd4')]){rpcDb[_0x00fc('0x9b')](_0x377f00,_0x00fc('0xd2'));}else{rpcDb['rescheduleContact'](ut[_0x00fc('0xc8')](_0x377f00,_0x00fc('0xd0'),_0xbaf8b0[_0x00fc('0xd5')]),_0x377f00[_0x00fc('0xb9')],_0x377f00['activeContact']);}}break;case'18':_0xbaf8b0[_0x00fc('0x40')]+=0x1;_0x377f00['countmachineretry']+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0x12,_0x520ab8['cause-txt']||_0x520ab8[_0x00fc('0xd6')]);ami[_0x00fc('0x26')](_0x00fc('0xd7'),ut[_0x00fc('0x93')](_0x377f00,_0x00fc('0xd8')));rpcDb['createCustomerHistory'](_0x377f00,_0x00fc('0xd9'));if(ut[_0x00fc('0x91')](_0x377f00)>=_0xbaf8b0['dialGlobalMaxRetry']){_0x3bc81e=ut[_0x00fc('0xc7')](_0x377f00,0xf,_0x00fc('0x97'));rpcDb[_0x00fc('0x9b')](_0x3bc81e,_0x00fc('0xd9'));}else{rpcDb[_0x00fc('0x9b')](_0x377f00,_0x00fc('0xd9'));}delete this[_0x00fc('0x13')][_0x520ab8[_0x00fc('0xaf')]];break;case'19':_0xbaf8b0[_0x00fc('0x40')]+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0x13,_0x520ab8[_0x00fc('0xda')]||_0x520ab8[_0x00fc('0xd6')]);ami[_0x00fc('0x26')](_0x00fc('0xd7'),ut[_0x00fc('0x93')](_0x377f00,_0x00fc('0xd8')));rpcDb[_0x00fc('0x86')](_0x377f00,_0x00fc('0xdb'));if(ut['totalGlobal'](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut['cloneAction'](_0x377f00,0xf,_0x00fc('0x97'));rpcDb[_0x00fc('0x9b')](_0x3bc81e,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x00fc('0x9b')](_0x377f00,'[callProgressDetectingCustomer][machine]');}delete this[_0x00fc('0x13')][_0x520ab8[_0x00fc('0xaf')]];break;default:if(_0x377f00[_0x00fc('0x68')]){ut[_0x00fc('0xa9')](_0xbaf8b0,_0x00fc('0xdc'));ut[_0x00fc('0x6f')](_0x00fc('0xdd')+_0xbaf8b0['name'],_0x520ab8);}_0xbaf8b0['outboundUnknownCallsDay']+=0x1;_0x377f00[_0x00fc('0x90')]=ut[_0x00fc('0x91')](_0x377f00);ut[_0x00fc('0x83')](_0x377f00,0xc,_0x520ab8['cause-txt']||_0x520ab8[_0x00fc('0xd6')]);rpcDb[_0x00fc('0x86')](_0x377f00,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x00fc('0x91')](_0x377f00)>=_0xbaf8b0[_0x00fc('0x96')]){_0x3bc81e=ut[_0x00fc('0xc7')](_0x377f00,0xf,_0x00fc('0x97'));rpcDb[_0x00fc('0x9b')](_0x3bc81e,_0x00fc('0xde'));}else{rpcDb[_0x00fc('0x9b')](_0x377f00,_0x00fc('0xde'));}delete this['actions'][_0x520ab8[_0x00fc('0xaf')]];}if(!(_0x377f00['dialAnswer']&&_0x1754e2==='16')){ut[_0x00fc('0x6d')](_0xbaf8b0,_0x00fc('0xdf'));logger[_0x00fc('0x64')](_0x00fc('0xe0'),_0x377f00[_0x00fc('0xa2')],_0x00fc('0xa3'),_0xbaf8b0[_0x00fc('0x28')],'originated:\x20',_0xbaf8b0[_0x00fc('0x56')]);}if(_0x1754e2!==_0x00fc('0x9f')){delete this[_0x00fc('0x13')][_0x520ab8[_0x00fc('0xaf')]];delete this[_0x00fc('0x13')][_0x520ab8[_0x00fc('0xe1')]];}}};Preview[_0x00fc('0xe')][_0x00fc('0xe2')]=function(_0xba0f40,_0x2d7091,_0x335954){if(_[_0x00fc('0xe3')](_0x2d7091)&&'object'!==typeof _0x2d7091){return;}if(_[_0x00fc('0xe3')](_0x335954)&&'object'!==typeof _0x335954){return;}switch(_0x335954[_0x00fc('0xe4')]){case'0':ut[_0x00fc('0xe5')](_0xba0f40,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0xba0f40,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x00fc('0xe5')](_0xba0f40,0x3,_0x00fc('0xbc'));rpcDb[_0x00fc('0xe6')](_0xba0f40,_0x00fc('0xe7'));break;case'5':ut[_0x00fc('0xe5')](_0xba0f40,0x5,_0x00fc('0xb2'));rpcDb[_0x00fc('0xe6')](_0xba0f40,_0x00fc('0xe8'));break;case'8':ut[_0x00fc('0xe5')](_0xba0f40,0x8,_0x00fc('0xc3'));rpcDb[_0x00fc('0xe6')](_0xba0f40,_0x00fc('0xe9'));break;case'22':ut[_0x00fc('0xe5')](_0xba0f40,0x16,_0x00fc('0xea'));rpcDb[_0x00fc('0xe6')](_0xba0f40,_0x00fc('0xeb'));break;default:ut['logAgent'](_0xba0f40,0xc,_0x335954[_0x00fc('0xe4')]);rpcDb[_0x00fc('0xe6')](_0xba0f40,_0x00fc('0xe9'));}ut[_0x00fc('0x6d')](_0x2d7091,_0x00fc('0xec'));logger['info'](_0x00fc('0xed'),_0xba0f40[_0x00fc('0xa2')],_0x00fc('0xa3'),_0x2d7091['name'],_0x00fc('0x67'),_0x2d7091[_0x00fc('0x56')]);delete this[_0x00fc('0x13')][_0xba0f40['uniqueid']];};Preview[_0x00fc('0xe')][_0x00fc('0xee')]=function(_0x4f99c2,_0x271396,_0x54793c,_0x4112c3,_0x341636){var _0x5ff8c1=this;return new BPromise(function(_0x5c7d78,_0x45cf44){if(_[_0x00fc('0x75')](_0x271396)||_[_0x00fc('0x75')](_0x271396[_0x00fc('0xef')])||_[_0x00fc('0x75')](_0x271396[_0x00fc('0xef')][_0x00fc('0xf0')])||_[_0x00fc('0x75')](_0x271396[_0x00fc('0x6b')])){_0x45cf44(ut[_0x00fc('0x4a')](_0x00fc('0xf1'),_0x4112c3,_0x341636));return;}var _0x55189b=uuid['v4']();var _0xb88c64=_0x5ff8c1[_0x00fc('0x25')][_0x271396[_0x00fc('0x65')][_0x00fc('0x28')]];var _0x51a465=_0x54793c?_0x5ff8c1[_0x00fc('0x14')][_0x54793c]['id']:undefined;_0x5ff8c1['actions'][_0x55189b]=new Action(_0x271396,_0xb88c64,_0x55189b,_0x54793c,_0x51a465);var _0x4f1d75=_0x5ff8c1[_0x00fc('0x13')][_0x55189b];_0x4f1d75['unlockAgent']=_0x4112c3;_0x4f1d75['activeContact']=_0x341636;_0x4f1d75[_0x00fc('0xf2')]=_0x54793c;if(_['isEmpty'](_0x4f99c2)){_0x5ff8c1['execCall'](_0x4f1d75,_0xb88c64,_0x271396,_0x54793c)[_0x00fc('0x7c')](function(_0xc0401b){logger['info'](_0x00fc('0xf3'),'Queue:\x20'+_0x4f1d75[_0x00fc('0x66')]+_0x00fc('0xf4')+_0x4f1d75[_0x00fc('0xf5')],JSON[_0x00fc('0x51')](_0xc0401b));ami['emit'](_0x00fc('0xf6'),ut[_0x00fc('0x93')](_0x4f1d75,'called',_0x5ff8c1[_0x00fc('0x25')][_0x4f1d75[_0x00fc('0x66')]]));_0x5c7d78(ut[_0x00fc('0x4a')](_0x00fc('0xf7')));})['catch'](function(_0x4144a8){ut[_0x00fc('0x59')](_0x00fc('0xf8'),_0x4144a8);_0x45cf44(ut[_0x00fc('0x4a')](_0x00fc('0xf9'),_0x4112c3,_0x341636));});}else{_0xb88c64['outboundBlacklistCallsDay']+=0x1;ut[_0x00fc('0xfa')](_0x4f1d75);rpcDb[_0x00fc('0xfb')](_0x4f1d75,'[Blacklist][error]');delete _0x5ff8c1[_0x00fc('0x13')][_0x55189b];_0x45cf44(ut[_0x00fc('0x4a')]('Contact\x20in\x20black\x20List',_0x4112c3,_0x341636));}});};Preview[_0x00fc('0xe')]['isTrunkReachable']=function(_0x448b43){return!_['isNil'](_0x448b43)&&!_[_0x00fc('0x75')](_0x448b43[_0x00fc('0x28')])&&!_[_0x00fc('0x75')](_0x448b43['active'])&&_0x448b43[_0x00fc('0xfc')]&&!_[_0x00fc('0x75')](this[_0x00fc('0xfd')][util['format'](_0x00fc('0xfe'),_0x448b43[_0x00fc('0x28')])])&&!_[_0x00fc('0x75')](this[_0x00fc('0xfd')][util[_0x00fc('0x52')](_0x00fc('0xfe'),_0x448b43[_0x00fc('0x28')])][_0x00fc('0xff')])&&(this['trunks'][util[_0x00fc('0x52')](_0x00fc('0xfe'),_0x448b43[_0x00fc('0x28')])]['status']===_0x00fc('0x100')||this[_0x00fc('0xfd')][util[_0x00fc('0x52')]('SIP/%s',_0x448b43[_0x00fc('0x28')])][_0x00fc('0xff')]===_0x00fc('0x101'));};Preview[_0x00fc('0xe')]['run']=function(_0x5983fc,_0x19d946){var _0x50b056=this;return new BPromise(function(_0x1bd459,_0x211503){_0x50b056[_0x00fc('0x102')](_0x5983fc,_0x19d946)[_0x00fc('0x7c')](function(_0x57afb1){_0x1bd459(_['pick'](_0x57afb1,[_0x00fc('0x4a')]));})['catch'](function(_0x327ee8){if(_0x327ee8[_0x00fc('0x103')]){rpcDb[_0x00fc('0x104')](_0x5983fc);}if(_0x327ee8[_0x00fc('0xfc')]){rpcDb[_0x00fc('0x7f')](_0x5983fc);}_0x211503(_[_0x00fc('0x69')](_0x327ee8,[_0x00fc('0x4a')]));});});};Preview[_0x00fc('0xe')][_0x00fc('0x102')]=function(_0x409f0a,_0xf77990){var _0x13e15c=this;return new BPromise(function(_0x5825cf,_0x315c4b){var _0x4d2699,_0x4d86c0;rpcDb['getContactPreview'](_0x409f0a)[_0x00fc('0x7c')](function(_0x4c8617){if(!_[_0x00fc('0x75')](_0x4c8617[0x0])){_0x4d86c0=_0x4c8617[0x0][_0x00fc('0x105')]?![]:!![];_0x4d2699=_0x4c8617[0x0][_0x00fc('0x105')]?!![]:![];_0x4d2699=_0xf77990?!![]:_0x4d2699;}var _0x1e561=_0x13e15c[_0x00fc('0x106')](_0x4c8617);if(_0x1e561[_0x00fc('0x107')]){rpcDb[_0x00fc('0x108')](_[_0x00fc('0x69')](_0x4c8617[0x0],[_0x00fc('0x6b'),_0x00fc('0x109')]))[_0x00fc('0x7c')](function(_0x45ca0a){_0x13e15c[_0x00fc('0xee')](_0x45ca0a,_0x4c8617[0x0],_0xf77990,_0x4d86c0,_0x4d2699)[_0x00fc('0x7c')](function(_0x17fdf9){_0x5825cf(_0x17fdf9);})[_0x00fc('0x6c')](function(_0x2e567e){_0x315c4b(_0x2e567e);});})['catch'](function(_0x234faa){ut[_0x00fc('0x59')](_0x00fc('0x10a'),_0x234faa);_0x315c4b(ut[_0x00fc('0x4a')](_0x00fc('0x10b'),_0x4d86c0,_0x4d2699));});}else{_0x315c4b(ut[_0x00fc('0x4a')](_0x1e561['message'],_0x4d86c0,_0x4d2699));}})[_0x00fc('0x6c')](function(_0x1b7005){ut[_0x00fc('0x59')]('[Preview][getContactPreview]',_0x1b7005);_0x315c4b(ut[_0x00fc('0x4a')](_0x00fc('0x10b'),![],!![]));});});};Preview[_0x00fc('0xe')][_0x00fc('0x106')]=function(_0x3b0b2e){if(_['isNil'](_0x3b0b2e)||_[_0x00fc('0x10c')](_0x3b0b2e)||!_[_0x00fc('0x75')](_0x3b0b2e[0x0][_0x00fc('0x7a')])&&_['isNil'](_0x3b0b2e[0x0][_0x00fc('0x7a')][_0x00fc('0x28')])){ut[_0x00fc('0x59')](_0x00fc('0x10d'),_0x3b0b2e);return{'isValid':![],'message':_0x00fc('0x10e')};}var _0x5e8c26=this[_0x00fc('0x25')][_0x3b0b2e[0x0]['Queue'][_0x00fc('0x28')]];_0x5e8c26['message']=_0x00fc('0x8f');if(_[_0x00fc('0x75')](_0x5e8c26)){ut[_0x00fc('0x59')](_0x00fc('0x10f'),_0x5e8c26);return{'isValid':![],'message':_0x00fc('0x110')};}if(!this['isTrunkReachable'](_0x5e8c26['Trunk'])){ut[_0x00fc('0x59')](_0x00fc('0x111'),_0x00fc('0x112')+_0x5e8c26[_0x00fc('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x00fc('0x113')](_0x5e8c26[_0x00fc('0x8e')])){ut[_0x00fc('0x59')](_0x00fc('0x111'),_0x5e8c26[_0x00fc('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x00fc('0x114')};}}if(!ut[_0x00fc('0x115')](_0x5e8c26['dialActive'])){ut[_0x00fc('0x59')](_0x00fc('0x116'),_0x5e8c26[_0x00fc('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x00fc('0x112')+_0x5e8c26[_0x00fc('0x28')]+_0x00fc('0x117')};}return{'isValid':!![],'message':_0x00fc('0x118')};};Preview[_0x00fc('0xe')][_0x00fc('0x119')]=function(_0x8ae24c,_0x146a43,_0x31c4cb,_0x5b44f0){var _0x5f1420=this;return new BPromise(function(_0x2d1ac6,_0x2a77e1){var _0x1a402c=_0x8ae24c['uniqueid'];var _0x4e7fc0=_0x5f1420[_0x00fc('0x113')](_0x146a43[_0x00fc('0x4e')])?util[_0x00fc('0x52')](_0x00fc('0x11a'),_0x146a43[_0x00fc('0x4e')][_0x00fc('0x28')],_[_0x00fc('0x75')](_0x146a43['dialPrefix'])?'':_0x146a43[_0x00fc('0x36')][_0x00fc('0x11b')]()||'',_0x146a43[_0x00fc('0x11c')]>0x0?_0x31c4cb[_0x00fc('0xef')]['phone']['substring'](_0x146a43['dialCutDigit']):_0x31c4cb['Contact'][_0x00fc('0xf0')]):util[_0x00fc('0x52')]('SIP/%s/%s%s',_['isNil'](_0x146a43['TrunkBackup'])?_0x146a43[_0x00fc('0x4e')][_0x00fc('0x28')]:_0x146a43[_0x00fc('0x8e')][_0x00fc('0x28')],_['isNil'](_0x146a43[_0x00fc('0x36')])?'':_0x146a43[_0x00fc('0x36')][_0x00fc('0x11b')]()||'',_0x146a43[_0x00fc('0x11c')]>0x0?_0x31c4cb[_0x00fc('0xef')]['phone'][_0x00fc('0x11d')](_0x146a43[_0x00fc('0x11c')]):_0x31c4cb[_0x00fc('0xef')][_0x00fc('0xf0')]);var _0x1f0c36=_0x5f1420[_0x00fc('0x113')](_0x146a43[_0x00fc('0x4e')])?ut[_0x00fc('0x11e')](_0x146a43[_0x00fc('0x4e')][_0x00fc('0x4f')],_0x146a43[_0x00fc('0x11f')],_0x146a43[_0x00fc('0x120')]>0x0?ut['getCallerIdRandom'](_0x146a43[_0x00fc('0x121')],_0x146a43['dialRandomLastDigitCallerIdNumber']):_0x146a43[_0x00fc('0x121')]):ut['getCallerId'](_[_0x00fc('0x75')](_0x146a43[_0x00fc('0x8e')])?_0x146a43[_0x00fc('0x4e')][_0x00fc('0x4f')]:_0x146a43['TrunkBackup'][_0x00fc('0x4f')],_0x146a43[_0x00fc('0x11f')],_0x146a43[_0x00fc('0x120')]>0x0?ut[_0x00fc('0x122')](_0x146a43[_0x00fc('0x121')],_0x146a43[_0x00fc('0x120')]):_0x146a43['dialOriginateCallerIdNumber']);if(_0x1f0c36){_0x8ae24c[_0x00fc('0x123')]=ut[_0x00fc('0x124')](_0x1f0c36);_0x8ae24c['originatecalleridnum']=ut['extractCalleridNumber'](_0x1f0c36);}var _0x4779d5=ut[_0x00fc('0x125')](_0x146a43,_0x31c4cb,_0x4e7fc0,_0x1f0c36,_0x1a402c,_0x8ae24c);_['merge'](_0x8ae24c,ut[_0x00fc('0x126')](_0x4779d5));_0x8ae24c[_0x00fc('0x80')]=moment()[_0x00fc('0x52')](_0x00fc('0x81'));ami[_0x00fc('0x127')](ut[_0x00fc('0x128')](_0x8ae24c,_0x146a43,_0x4779d5,_0x8ae24c['activeContact'],_0x5b44f0))['then'](function(_0x52d887){var _0x34126a=_0x8ae24c[_0x00fc('0x129')];if(!_[_0x00fc('0x75')](_0x34126a)){if(!_['isNil'](_0x5f1420[_0x00fc('0x14')][_0x34126a])){_0x5f1420['agents'][_0x34126a][_0x00fc('0x12a')]=_0x8ae24c['calleridnum'];emit(util[_0x00fc('0x52')](_0x00fc('0x12b'),_0x5f1420[_0x00fc('0x14')][_0x34126a]['name']),_0x00fc('0x12c'),{'destaccountcode':_0x5f1420[_0x00fc('0x14')][_0x34126a][_0x00fc('0x12d')],'destconnectedlinenum':_0x8ae24c['calleridnum']});}}_0x146a43[_0x00fc('0x56')]+=0x1;logger['info'](_0x00fc('0x12e'),_0x1a402c,_0x00fc('0xa3'),_0x146a43[_0x00fc('0x28')],_0x00fc('0x67'),_0x146a43[_0x00fc('0x56')]);_0x2d1ac6(_0x52d887);})[_0x00fc('0x6c')](function(_0x107287){ut['logAgent'](_0x8ae24c,0xe,_0x00fc('0x12f'));rpcDb[_0x00fc('0xe6')](_0x8ae24c,_0x00fc('0x130'));_0x2a77e1(_0x107287);});});};Preview['prototype'][_0x00fc('0x1e')]=function(_0x322c47){if(this[_0x00fc('0x13')][_0x322c47['linkedid']]){this['actions'][_0x322c47[_0x00fc('0xaf')]][_0x00fc('0x131')]=_0x322c47[_0x00fc('0x131')];}};Preview[_0x00fc('0xe')][_0x00fc('0x15')]=function(_0x4b227c){var _0xe138de=this;var _0x19ed0a=this[_0x00fc('0x13')][_0x4b227c[_0x00fc('0x132')]];if(_0x19ed0a){if(_0x19ed0a[_0x00fc('0xf2')]&&this[_0x00fc('0x14')][_0x19ed0a[_0x00fc('0xf2')]]){ut[_0x00fc('0x133')](_0x19ed0a,this[_0x00fc('0x14')][_0x19ed0a[_0x00fc('0xf2')]][_0x00fc('0x28')],this[_0x00fc('0x14')][_0x19ed0a['lookAgent']]['id']);}var _0x1b957f=_[_0x00fc('0x134')](_0x19ed0a);_0x1b957f[_0x00fc('0x135')]=moment()[_0x00fc('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37352b=_0xe138de['campaignsPreview'][_0x19ed0a[_0x00fc('0x66')]];if(ut[_0x00fc('0x136')](_0x4b227c[_0x00fc('0x137')])){if(_0x19ed0a[_0x00fc('0xb9')]){rpcDb['unlockContact'](_0x19ed0a[_0x00fc('0xf5')]);}if(_0x19ed0a[_0x00fc('0x9e')]){rpcDb[_0x00fc('0x7f')](_0x19ed0a['idContact']);}ami[_0x00fc('0x26')](_0x00fc('0x138'),ut[_0x00fc('0x93')](_0x19ed0a,_0x00fc('0x139'),this[_0x00fc('0x25')][_0x19ed0a['queue']]));this[_0x00fc('0xe2')](_0x1b957f,_0x37352b,_0x4b227c);}else{_0x19ed0a[_0x00fc('0x80')]=moment()[_0x00fc('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x1b957f,0x4,_0x00fc('0x13a'));rpcDb[_0x00fc('0xe6')](_0x1b957f,_0x00fc('0x13b'));}}};Preview[_0x00fc('0xe')][_0x00fc('0x18')]=function(_0x2df947){var _0x15e021=this;var _0x3730fe=this[_0x00fc('0x13')][_0x2df947['linkedid']];var _0x57969d;if(_0x3730fe){_0x57969d=this[_0x00fc('0x25')][_0x3730fe[_0x00fc('0x66')]];logger[_0x00fc('0x64')](_0x00fc('0x13c'),_0x2df947['linkedid'],'\x20Queue',_0x57969d[_0x00fc('0x28')],'pTalking:\x20',_0x57969d[_0x00fc('0x2b')]);}if(this[_0x00fc('0x13')][_0x2df947[_0x00fc('0xaf')]]&&_0x2df947[_0x00fc('0xaf')]!==_0x2df947['uniqueid']){if(_0x2df947[_0x00fc('0x13d')]==='16'&&this['actions'][_0x2df947['linkedid']][_0x00fc('0x68')]){this['callProgressDetectingCustomer'](_0x2df947,_0x2df947[_0x00fc('0xaf')],_0x2df947[_0x00fc('0x13d')]);}else if(this[_0x00fc('0x13')][_0x2df947[_0x00fc('0xaf')]][_0x00fc('0x68')]){logger['info']('[syncHangup][talking][cause]',_0x2df947[_0x00fc('0xaf')],_0x2df947[_0x00fc('0x13d')],'\x20Queue',_0x57969d['name'],'pTalking:\x20',_0x57969d[_0x00fc('0x2b')]);this['callProgressDetectingCustomer'](_0x2df947,_0x2df947[_0x00fc('0xaf')],_0x2df947[_0x00fc('0x13d')]);}}else if(_0x3730fe&&_[_0x00fc('0x75')](_0x3730fe[_0x00fc('0x13e')])&&_0x57969d[_0x00fc('0x13f')]&&_0x2df947[_0x00fc('0xaf')]===_0x2df947[_0x00fc('0xa2')]&&_[_0x00fc('0x75')](_0x2df947['reason'])&&_0x2df947[_0x00fc('0x13d')]==='16'&&_0x2df947[_0x00fc('0x140')]==='6'&&_[_0x00fc('0xe3')](_0x3730fe[_0x00fc('0x141')])){if(_0x3730fe[_0x00fc('0xb9')]){rpcDb['unlockContact'](_0x3730fe[_0x00fc('0xf5')]);}if(_0x3730fe[_0x00fc('0x9e')]){rpcDb['disableContact'](_0x3730fe[_0x00fc('0xf5')]);}_0x2df947[_0x00fc('0xe4')]='22';this[_0x00fc('0xe2')](_0x3730fe,_0x57969d,_0x2df947);}else if(_0x3730fe&&_0x3730fe[_0x00fc('0x141')]){if(_0x2df947[_0x00fc('0x13d')]==='16'&&this[_0x00fc('0x13')][_0x2df947[_0x00fc('0xaf')]][_0x00fc('0x68')]){logger[_0x00fc('0x64')](_0x00fc('0x142'),_0x2df947[_0x00fc('0xaf')],_0x2df947[_0x00fc('0x13d')],_0x00fc('0xa3'),_0x57969d[_0x00fc('0x28')],_0x00fc('0xa4'),_0x57969d[_0x00fc('0x2b')]);this[_0x00fc('0x143')](_0x2df947,_0x2df947[_0x00fc('0xaf')],_0x2df947[_0x00fc('0x13d')]);}else if(this[_0x00fc('0x13')][_0x2df947[_0x00fc('0xaf')]][_0x00fc('0x68')]){logger['info'](_0x00fc('0x144'),_0x2df947[_0x00fc('0xaf')],_0x2df947[_0x00fc('0x13d')],_0x00fc('0xa3'),_0x57969d[_0x00fc('0x28')],'pTalking:\x20',_0x57969d[_0x00fc('0x2b')]);this['callProgressDetectingCustomer'](_0x2df947,_0x2df947[_0x00fc('0xaf')],_0x2df947[_0x00fc('0x13d')]);}}};Preview[_0x00fc('0xe')][_0x00fc('0x1c')]=function(_0x417343){if(this[_0x00fc('0x13')][_0x417343[_0x00fc('0xe1')]]&&_0x417343[_0x00fc('0xe1')]!==_0x417343['destuniqueid']){this[_0x00fc('0x143')](_0x417343,_0x417343[_0x00fc('0xe1')],_0x417343[_0x00fc('0xd6')]);}};Preview[_0x00fc('0xe')][_0x00fc('0x1a')]=function(_0x46a0be){if(this[_0x00fc('0x13')][_0x46a0be[_0x00fc('0xaf')]]&&_0x46a0be['linkedid']!==_0x46a0be['uniqueid']&&!this[_0x00fc('0x13')][_0x46a0be[_0x00fc('0xaf')]]['dialAnswer']){if(_0x46a0be[_0x00fc('0x13d')]==='1'){this[_0x00fc('0x143')](_0x46a0be,_0x46a0be['linkedid'],_0x46a0be[_0x00fc('0x13d')]);}}};Preview[_0x00fc('0xe')][_0x00fc('0x145')]=function(_0x3b83e6,_0x297a23,_0x551f82){if(this[_0x00fc('0x13')][_0x3b83e6]){if(_[_0x00fc('0x75')](this[_0x00fc('0x13')][_0x3b83e6][_0x00fc('0x146')])){this['actions'][_0x3b83e6][_0x00fc('0x146')]={};}this[_0x00fc('0x13')][_0x3b83e6][_0x00fc('0x146')][_0x297a23]=_0x551f82;}};Preview[_0x00fc('0xe')][_0x00fc('0x20')]=function(_0x101502){try{if(!_[_0x00fc('0x75')](_0x101502)){if(ut[_0x00fc('0x147')](_[_0x00fc('0x148')](_0x101502['variable'])[0x0])){this['addVariable'](_0x101502[_0x00fc('0xa2')],_[_0x00fc('0x148')](_0x101502[_0x00fc('0x149')])[0x0],_0x101502[_0x00fc('0x14a')]);}}}catch(_0x1fe9b0){logger[_0x00fc('0x14b')]('[syncVarSet][Preview]',util[_0x00fc('0x14c')](_0x1fe9b0,{'showHidden':![],'depth':null}));}};Preview[_0x00fc('0xe')][_0x00fc('0x22')]=function(_0x2f98e9){if(_0x2f98e9){if(this['actions'][_0x2f98e9[_0x00fc('0x14d')]]){this[_0x00fc('0x13')][_0x2f98e9['transfertargetlinkedid']][_0x00fc('0x141')]=!![];}}};Preview[_0x00fc('0xe')][_0x00fc('0x14e')]=function(_0x48e784){if(_0x48e784){if(this[_0x00fc('0x13')][_0x48e784[_0x00fc('0x14f')]]){this[_0x00fc('0x13')][_0x48e784['transfererlinkedid']][_0x00fc('0x141')]=!![];}}};module[_0x00fc('0x150')]=Preview; \ No newline at end of file +var _0x7bf1=['dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','YYYY-MM-DD\x20HH:mm:ss','responsetime','uniqueid','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','buildObj','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','\x20Queue','pTalking:\x20','linkedid','BUSY','Busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','custom:agentnoanswer','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','countagentrejectretry','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','execRun','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','TrunkBackup','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','variablesAction','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','clockClearZombieChannels','preview','booked','hasOwnProperty','recallMe','isNil','originated:\x20','queue','dialAnswer','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','scheduledat'];(function(_0x4e53be,_0x25ed6b){var _0x3b5092=function(_0x3c157d){while(--_0x3c157d){_0x4e53be['push'](_0x4e53be['shift']());}};_0x3b5092(++_0x25ed6b);}(_0x7bf1,0xd8));var _0x17bf=function(_0x3c37cd,_0x32a69c){_0x3c37cd=_0x3c37cd-0x0;var _0xbeaa6=_0x7bf1[_0x3c37cd];return _0xbeaa6;};'use strict';var util=require(_0x17bf('0x0'));var _=require(_0x17bf('0x1'));var BPromise=require(_0x17bf('0x2'));var uuid=require(_0x17bf('0x3'));var moment=require(_0x17bf('0x4'));var md5=require('md5');var Redis=require(_0x17bf('0x5'));var config=require(_0x17bf('0x6'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x17bf('0x7'))('actionPreview');var ami=require(_0x17bf('0x8'));var rpcDb=require(_0x17bf('0x9'));var Action=require(_0x17bf('0xa'));var ut=require('./util/util');config[_0x17bf('0xb')]=_[_0x17bf('0xc')](config['redis'],{'host':_0x17bf('0xd'),'port':0x18eb});var io=require(_0x17bf('0xe'))(new Redis(config[_0x17bf('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x17bf('0xf')]=function(_0x1db6c4){this[_0x17bf('0x10')]=this[_0x17bf('0x10')]?this[_0x17bf('0x10')][_0x17bf('0x11')](_0x1db6c4):_0x1db6c4();};function Preview(_0x52fc4c){this[_0x17bf('0x12')]=new Sequence();this[_0x17bf('0x13')]=_0x52fc4c[_0x17bf('0x14')];this['trunks']=_0x52fc4c[_0x17bf('0x15')];this[_0x17bf('0x16')]={};this[_0x17bf('0x17')]=_0x52fc4c[_0x17bf('0x17')];this['clockClearZombieChannels']=0x0;ami['on'](_0x17bf('0x18'),this[_0x17bf('0x19')][_0x17bf('0x1a')](this));ami['on'](_0x17bf('0x1b'),this[_0x17bf('0x1c')][_0x17bf('0x1a')](this));ami['on']('hanguprequest',this[_0x17bf('0x1d')][_0x17bf('0x1a')](this));ami['on'](_0x17bf('0x1e'),this['syncDialEnd'][_0x17bf('0x1a')](this));ami['on'](_0x17bf('0x1f'),this[_0x17bf('0x20')]['bind'](this));ami['on'](_0x17bf('0x21'),this[_0x17bf('0x22')][_0x17bf('0x1a')](this));ami['on'](_0x17bf('0x23'),this[_0x17bf('0x24')][_0x17bf('0x1a')](this));ami['on'](_0x17bf('0x25'),this[_0x17bf('0x26')]['bind'](this));this[_0x17bf('0x27')](this[_0x17bf('0x13')]);}function emit(_0x3d1506,_0x57b796,_0x222595){io['to'](_0x3d1506)['emit'](_0x57b796,_0x222595);}function emitCampaignPreview(_0x44733b){if(_0x44733b[_0x17bf('0x28')]===_0x17bf('0x29')){var _0x374fb6={'id':_0x44733b['id'],'name':_0x44733b[_0x17bf('0x2a')],'strategy':_0x44733b['strategy'],'answered':_0x44733b['answered'],'available':_0x44733b[_0x17bf('0x2b')],'loggedIn':_0x44733b['loggedIn'],'pTalking':_0x44733b[_0x17bf('0x2c')],'sumBillable':_0x44733b[_0x17bf('0x2d')],'sumDuration':_0x44733b[_0x17bf('0x2e')],'sumHoldTime':_0x44733b[_0x17bf('0x2f')]||0x0,'talking':_0x44733b[_0x17bf('0x30')],'total':_0x44733b['total'],'type':_0x44733b[_0x17bf('0x28')],'unmanaged':_0x44733b[_0x17bf('0x31')],'abandoned':_0x44733b[_0x17bf('0x32')],'waiting':_0x44733b['waiting'],'loggedInDb':_0x44733b[_0x17bf('0x33')],'dialActive':_0x44733b[_0x17bf('0x34')],'dialMethod':_0x44733b[_0x17bf('0x35')],'dialOriginateCallerIdName':_0x44733b[_0x17bf('0x36')],'dialOriginateCallerIdNumber':_0x44733b[_0x17bf('0x37')],'dialOriginateTimeout':_0x44733b['dialOriginateTimeout'],'dialPrefix':_0x44733b[_0x17bf('0x38')],'outboundAnswerAgiCallsDay':_0x44733b['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x44733b['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x44733b[_0x17bf('0x39')],'outboundBusyCallsDay':_0x44733b[_0x17bf('0x3a')],'outboundCongestionCallsDay':_0x44733b[_0x17bf('0x3b')],'outboundDropCallsDayACS':_0x44733b[_0x17bf('0x3c')],'outboundDropCallsDayCallersExit':_0x44733b[_0x17bf('0x3d')],'outboundDropCallsDayTimeout':_0x44733b['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x44733b[_0x17bf('0x3e')],'outboundNoSuchCallsDay':_0x44733b[_0x17bf('0x3f')],'outboundOriginateFailureCallsDay':_0x44733b[_0x17bf('0x40')],'outboundReCallsDay':_0x44733b[_0x17bf('0x41')],'outboundRejectCallsDay':_0x44733b[_0x17bf('0x42')],'outboundUnknownCallsDay':_0x44733b[_0x17bf('0x43')],'outboundAbandonedCallsDay':_0x44733b[_0x17bf('0x44')],'predictiveIntervalAnsweredCalls':_0x44733b[_0x17bf('0x45')],'predictiveIntervalAvgHoldtime':_0x44733b[_0x17bf('0x46')],'predictiveIntervalAvgTalktime':_0x44733b[_0x17bf('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x44733b[_0x17bf('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x44733b[_0x17bf('0x49')],'predictiveIntervalErlangCalls':_0x44733b['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x44733b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x44733b[_0x17bf('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x44733b[_0x17bf('0x4b')],'predictiveIntervalPauses':_0x44733b[_0x17bf('0x4c')],'predictiveIntervalAvailable':_0x44733b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x44733b[_0x17bf('0x4d')],'message':_0x44733b[_0x17bf('0x4e')],'originated':_0x44733b[_0x17bf('0x4f')],'erlangCalls':_0x44733b[_0x17bf('0x50')],'erlangCallToSecond':_0x44733b['erlangCallToSecond'],'erlangAbandonmentRate':_0x44733b['erlangAbandonmentRate'],'erlangBusyFactor':_0x44733b['erlangBusyFactor'],'startPredictive':_0x44733b[_0x17bf('0x51')],'startProgressive':_0x44733b[_0x17bf('0x52')]};if(_0x44733b[_0x17bf('0x53')]){_0x374fb6['Trunk']={'id':_0x44733b[_0x17bf('0x53')]['id'],'name':_0x44733b['Trunk'][_0x17bf('0x2a')],'active':_0x44733b[_0x17bf('0x53')][_0x17bf('0x54')],'callerid':_0x44733b[_0x17bf('0x53')][_0x17bf('0x55')]};}if(_0x44733b[_0x17bf('0x56')]){_0x374fb6[_0x17bf('0x56')]={'id':_0x44733b[_0x17bf('0x56')]['id'],'name':_0x44733b['Interval']['name']};}var _0x58efc9=md5(JSON[_0x17bf('0x57')](_0x374fb6));if(_0x44733b['md5']!==_0x58efc9){_0x44733b[_0x17bf('0x58')]=_0x58efc9;emit(util['format'](_0x17bf('0x59'),_0x374fb6[_0x17bf('0x2a')]),'voice_queue:save',_0x374fb6);}}}function emitVoiceQueueChannelRemove(_0xe58e42){logger[_0x17bf('0x5a')](_0x17bf('0x5b'),JSON['stringify'](_0xe58e42));emit(util[_0x17bf('0x5c')](_0x17bf('0x59'),_0xe58e42['name']),_0x17bf('0x5d'),_0xe58e42);io['emit'](_0x17bf('0x5e'),_0xe58e42);}function notSendMessagesQueue(_0x58a93e){if(_0x58a93e[_0x17bf('0x5f')]){if(_0x58a93e[_0x17bf('0x4f')]===0x0&&_0x58a93e[_0x17bf('0x2c')]===0x0){_0x58a93e[_0x17bf('0x5f')]=![];_0x58a93e[_0x17bf('0x2b')]=0x0;_0x58a93e[_0x17bf('0x60')]=0x0;_0x58a93e[_0x17bf('0x4e')]=_0x17bf('0x61');ut[_0x17bf('0x62')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x58a93e[_0x17bf('0x2a')]+_0x17bf('0x63'));}else{_0x58a93e[_0x17bf('0x4e')]=_0x17bf('0x64');ut[_0x17bf('0x62')](_0x17bf('0x65'),_0x58a93e[_0x17bf('0x2a')]+_0x17bf('0x66'));}emitCampaignPreview(_0x58a93e);}}Preview[_0x17bf('0x67')][_0x17bf('0x27')]=function(){var _0x4d9462=this;setInterval(function(){_0x4d9462[_0x17bf('0x68')]();},0x7cf);};Preview[_0x17bf('0x67')]['syncCampaigns']=function(){var _0x4a6254=this[_0x17bf('0x13')];this[_0x17bf('0x69')]+=0x1;for(var _0x5a6c49 in _0x4a6254){if(_0x4a6254['hasOwnProperty'](_0x5a6c49)&&(_0x4a6254[_0x5a6c49][_0x17bf('0x35')]===_0x17bf('0x6a')||_0x4a6254[_0x5a6c49]['dialMethod']===_0x17bf('0x6b'))&&_0x4a6254[_0x5a6c49][_0x17bf('0x28')]===_0x17bf('0x29')){if(this['clockClearZombieChannels']>0x7){this[_0x17bf('0x69')]=0x0;this['clearZombieChannels']();}}if(_0x4a6254[_0x17bf('0x6c')](_0x5a6c49)&&_0x4a6254[_0x5a6c49][_0x17bf('0x35')]===_0x17bf('0x6a')&&_0x4a6254[_0x5a6c49]['type']===_0x17bf('0x29')){if(_0x4a6254[_0x5a6c49][_0x17bf('0x34')]){this['setMessage'](_0x4a6254[_0x5a6c49]);this[_0x17bf('0x6d')](_0x4a6254[_0x5a6c49]);}else{notSendMessagesQueue(_0x4a6254[_0x5a6c49]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x1dc621){var _0x3f593a=this;this[_0x17bf('0x12')][_0x17bf('0xf')](function(){if(!_[_0x17bf('0x6e')](_0x3f593a[_0x17bf('0x16')][_0x1dc621])){loggerAction[_0x17bf('0x5a')]('[clearZombieChannels][talking]',_0x1dc621,'Queue',_0x3f593a['actions'][_0x1dc621]['queue'],_0x17bf('0x6f'),JSON[_0x17bf('0x57')](_0x3f593a[_0x17bf('0x13')][_0x3f593a['actions'][_0x1dc621][_0x17bf('0x70')]][_0x17bf('0x4f')]),'pTalking:\x20',JSON['stringify'](_0x3f593a[_0x17bf('0x13')][_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x70')]]['pTalking']),JSON[_0x17bf('0x57')](_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x71')]),JSON[_0x17bf('0x57')](_['pick'](_0x3f593a['actions'][_0x1dc621],[_0x17bf('0x72'),_0x17bf('0x73'),_0x17bf('0x74'),'ListId'])));return ami[_0x17bf('0x75')]({'action':_0x17bf('0x76'),'channel':_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x77')]})[_0x17bf('0x78')](function(_0x526f4c){if(_0x526f4c[_0x17bf('0x4e')]===_0x17bf('0x79')){setTimeout(function(){if(_0x3f593a[_0x17bf('0x16')][_0x1dc621]){ut[_0x17bf('0x7a')](_0x3f593a[_0x17bf('0x13')][_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x70')]],_0x17bf('0x7b'));if(_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x71')]===!![]){ut[_0x17bf('0x7c')](_0x3f593a[_0x17bf('0x13')][_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x70')]],_0x17bf('0x7b'));ut['loggerError'](_0x17bf('0x7d')+_0x1dc621,_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x70')]);}ut[_0x17bf('0x7e')](_0x17bf('0x7f')+_0x1dc621,_0x3f593a[_0x17bf('0x16')][_0x1dc621][_0x17bf('0x70')]);delete _0x3f593a[_0x17bf('0x16')][_0x1dc621];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0xab7e2c=this;loggerAction[_0x17bf('0x5a')]('[action]',_[_0x17bf('0x80')](this['actions']));for(var _0x2d7385 in this[_0x17bf('0x16')]){if(_0xab7e2c[_0x17bf('0x16')][_0x17bf('0x6c')](_0x2d7385)){_0xab7e2c[_0x17bf('0x81')](_0x2d7385);}}};Preview['prototype'][_0x17bf('0x6d')]=function(_0x91374){var _0x1e6af7=this;rpcDb[_0x17bf('0x82')](_0x91374['id'],ut[_0x17bf('0x83')](this['agents']))[_0x17bf('0x84')](function(_0xf970ea){if(!_[_0x17bf('0x6e')](_0xf970ea)){for(var _0x15baf4=0x0;_0x15baf4<_0xf970ea[_0x17bf('0x85')];_0x15baf4+=0x1){if(ut['getDiff'](_0xf970ea[_0x15baf4][_0x17bf('0x86')])<_0x91374[_0x17bf('0x87')]*0x3c){if(_0xf970ea[_0x15baf4][_0x17bf('0x88')]&&!_0xf970ea[_0x15baf4][_0x17bf('0x88')]['voicePause']){_0x1e6af7['run'](_0xf970ea[_0x15baf4]['id'])[_0x17bf('0x84')](ut[_0x17bf('0x89')](_0x17bf('0x8a')))['catch'](ut['logger2'](_0x17bf('0x8a')));}else{rpcDb[_0x17bf('0x8b')](_0xf970ea[_0x15baf4]['id']);}}else{var _0x4ecca1=new Action(_0xf970ea[_0x15baf4],_0x91374);_0x4ecca1['starttime']=moment()[_0x17bf('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x91374[_0x17bf('0x41')]+=0x1;ut[_0x17bf('0x8c')](_0x4ecca1,0x17,_0x17bf('0x8d'));if(_0x91374['dialRecallInQueue']){rpcDb[_0x17bf('0x8e')](ut[_0x17bf('0x8f')](_0xf970ea[_0x15baf4]));rpcDb[_0x17bf('0x90')](_0x4ecca1,_0x17bf('0x91'));}else{ut[_0x17bf('0x8c')](_0x4ecca1,0x16,_0x17bf('0x92'));rpcDb[_0x17bf('0x90')](_0x4ecca1,_0x17bf('0x93'));rpcDb[_0x17bf('0x94')](_0x4ecca1,_0x17bf('0x93'));}}}}})[_0x17bf('0x78')](ut['logger2'](_0x17bf('0x95')));};Preview[_0x17bf('0x67')][_0x17bf('0x96')]=function(_0x55af1d){_0x55af1d[_0x17bf('0x5f')]=!![];if(ut[_0x17bf('0x97')](_0x55af1d[_0x17bf('0x98')])){_0x55af1d['message']=_0x17bf('0x99');}else if(!ut['isActive'](_0x55af1d[_0x17bf('0x34')])){_0x55af1d[_0x17bf('0x4e')]=_0x17bf('0x61');}else if(!this['isTrunkReachable'](_0x55af1d['Trunk'])){if(!this[_0x17bf('0x9a')](_0x55af1d['TrunkBackup'])){_0x55af1d[_0x17bf('0x4e')]=_0x17bf('0x9b');}else{_0x55af1d[_0x17bf('0x4e')]=_0x17bf('0x9c');}}else{_0x55af1d['message']=_0x17bf('0x9c');}emitCampaignPreview(_0x55af1d);};Preview[_0x17bf('0x67')][_0x17bf('0x9d')]=function(_0x3be492,_0x120d80,_0x2918d6){var _0x5b9a77=this;var _0x3f5d5f=this[_0x17bf('0x16')][_0x120d80];var _0x47fa36=this[_0x17bf('0x13')][_0x3f5d5f[_0x17bf('0x70')]];var _0x343d10;if(_0x47fa36){switch(_0x2918d6){case'1':_0x47fa36[_0x17bf('0x3f')]+=0x1;_0x3f5d5f[_0x17bf('0x9e')]+=0x1;_0x3f5d5f[_0x17bf('0x9f')]=ut[_0x17bf('0xa0')](_0x3f5d5f);ut['logCustomer'](_0x3f5d5f,0x0,_0x17bf('0xa1'));ami[_0x17bf('0xa2')](_0x17bf('0xa3'),ut['buildObj'](_0x3f5d5f,_0x17bf('0xa4')));rpcDb[_0x17bf('0x90')](_0x3f5d5f,_0x17bf('0xa5'));if(ut[_0x17bf('0xa0')](_0x3f5d5f)>=_0x47fa36['dialGlobalMaxRetry']){_0x343d10=ut[_0x17bf('0xa6')](_0x3f5d5f,0xf,_0x17bf('0xa7'));rpcDb['createCustomerFinal'](_0x343d10,_0x17bf('0xa8'));}else{if(_0x3f5d5f['countnosuchnumberretry']>=_0x47fa36[_0x17bf('0xa9')]){rpcDb['createCustomerFinal'](_0x3f5d5f,_0x17bf('0xa8'));}else{rpcDb[_0x17bf('0xaa')](ut[_0x17bf('0xab')](_0x3f5d5f,_0x17bf('0x9e'),_0x47fa36['dialNoSuchNumberRetryFrequency']),_0x3f5d5f['unlockAgent'],_0x3f5d5f[_0x17bf('0xac')]);}}delete this[_0x17bf('0x16')][_0x3be492['linkedid']];break;case'ANSWER':var _0xb10416=moment()[_0x17bf('0x5c')](_0x17bf('0xad'));_0x3f5d5f[_0x17bf('0xae')]=_0xb10416;_0x3f5d5f['answertime']=_0xb10416;_0x3f5d5f[_0x17bf('0x71')]=!![];_0x47fa36['pTalking']+=0x1;logger[_0x17bf('0x5a')]('[syncHangup][talking][increment]',_0x3f5d5f[_0x17bf('0xaf')],'\x20Queue',_0x47fa36[_0x17bf('0x2a')],'pTalking:\x20',_0x47fa36[_0x17bf('0x2c')]);ami[_0x17bf('0xa2')](_0x17bf('0xb0'),ut['buildObj'](_0x3f5d5f,'connect',this[_0x17bf('0x13')][_0x3f5d5f[_0x17bf('0x70')]]));if(_0x47fa36[_0x17bf('0xb1')]){ami[_0x17bf('0xa2')](_0x17bf('0xb2'),ut['buildAcw'](_0x3f5d5f));}break;case'16':ami['emit'](_0x17bf('0xb3'),ut[_0x17bf('0xb4')](_0x3f5d5f,_0x17bf('0xb5'),this[_0x17bf('0x13')][_0x3f5d5f[_0x17bf('0x70')]]));emitVoiceQueueChannelRemove(ut[_0x17bf('0xb4')](_0x3f5d5f,_0x17bf('0xb5')));_0x47fa36[_0x17bf('0xb6')]+=0x1;_0x47fa36[_0x17bf('0xb7')]+=0x1;_0x47fa36[_0x17bf('0xb8')]+=0x1;ut['decrementTalkink'](_0x47fa36,_0x17bf('0xb9'));_0x3f5d5f['countglobal']=ut[_0x17bf('0xa0')](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0x4,_0x17bf('0xba'));rpcDb[_0x17bf('0x90')](_0x3f5d5f,_0x17bf('0xbb'));rpcDb[_0x17bf('0x94')](_0x3f5d5f,_0x17bf('0xbc'));rpcDb['crateCustomerReportQueue'](_0x3f5d5f);_0x47fa36['sumDuration']+=_0x3f5d5f[_0x17bf('0xbd')];_0x47fa36[_0x17bf('0x2d')]+=_0x3f5d5f[_0x17bf('0xbd')];logger[_0x17bf('0x5a')](_0x17bf('0xbe'),_0x3f5d5f[_0x17bf('0xaf')],_0x17bf('0xbf'),_0x47fa36['name'],_0x17bf('0xc0'),_0x47fa36[_0x17bf('0x2c')]);delete this[_0x17bf('0x16')][_0x3be492[_0x17bf('0xc1')]];break;case _0x17bf('0xc2'):_0x47fa36[_0x17bf('0x3a')]+=0x1;_0x3f5d5f['countbusyretry']+=0x1;_0x3f5d5f['countglobal']=ut[_0x17bf('0xa0')](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0x5,_0x17bf('0xc3'));ami['emit']('custom:agentbusy',ut[_0x17bf('0xb4')](_0x3f5d5f,'busy'));rpcDb[_0x17bf('0x90')](_0x3f5d5f,_0x17bf('0xc4'));if(ut['totalGlobal'](_0x3f5d5f)>=_0x47fa36['dialGlobalMaxRetry']){_0x343d10=ut[_0x17bf('0xa6')](_0x3f5d5f,0xf,_0x17bf('0xa7'));rpcDb['createCustomerFinal'](_0x343d10,_0x17bf('0xc5'));}else{if(_0x3f5d5f[_0x17bf('0xc6')]>=_0x47fa36[_0x17bf('0xc7')]){rpcDb[_0x17bf('0x94')](_0x3f5d5f,_0x17bf('0xc4'));}else{rpcDb[_0x17bf('0xaa')](ut[_0x17bf('0xab')](_0x3f5d5f,'countbusyretry',_0x47fa36[_0x17bf('0xc8')]),_0x3f5d5f[_0x17bf('0xc9')],_0x3f5d5f['activeContact']);}}break;case _0x17bf('0xca'):_0x47fa36[_0x17bf('0x3e')]+=0x1;_0x3f5d5f[_0x17bf('0xcb')]+=0x1;_0x3f5d5f[_0x17bf('0x9f')]=ut[_0x17bf('0xa0')](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0x3,'NoAnswer');ami[_0x17bf('0xa2')](_0x17bf('0xcc'),ut['buildObj'](_0x3f5d5f,'noanswer'));rpcDb['createCustomerHistory'](_0x3f5d5f,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x17bf('0xa0')](_0x3f5d5f)>=_0x47fa36[_0x17bf('0xcd')]){_0x343d10=ut[_0x17bf('0xa6')](_0x3f5d5f,0xf,_0x17bf('0xa7'));rpcDb[_0x17bf('0x94')](_0x343d10,_0x17bf('0xce'));}else{if(_0x3f5d5f[_0x17bf('0xcb')]>=_0x47fa36['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x3f5d5f,_0x17bf('0xcf'));}else{rpcDb[_0x17bf('0xaa')](ut['scheduledAt'](_0x3f5d5f,'countnoanswerretry',_0x47fa36['dialNoAnswerRetryFrequency']),_0x3f5d5f[_0x17bf('0xc9')],_0x3f5d5f['activeContact']);}}break;case _0x17bf('0xd0'):_0x47fa36[_0x17bf('0x3b')]+=0x1;_0x3f5d5f['countcongestionretry']+=0x1;_0x3f5d5f[_0x17bf('0x9f')]=ut[_0x17bf('0xa0')](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0x8,_0x17bf('0xd1'));ami[_0x17bf('0xa2')](_0x17bf('0xd2'),ut['buildObj'](_0x3f5d5f,_0x17bf('0xd3')));rpcDb[_0x17bf('0x90')](_0x3f5d5f,_0x17bf('0xd4'));if(ut[_0x17bf('0xa0')](_0x3f5d5f)>=_0x47fa36['dialGlobalMaxRetry']){_0x343d10=ut[_0x17bf('0xa6')](_0x3f5d5f,0xf,_0x17bf('0xa7'));rpcDb[_0x17bf('0x94')](_0x343d10,_0x17bf('0xd5'));}else{if(_0x3f5d5f[_0x17bf('0xd6')]>=_0x47fa36[_0x17bf('0xd7')]){rpcDb[_0x17bf('0x94')](_0x3f5d5f,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x17bf('0xaa')](ut['scheduledAt'](_0x3f5d5f,_0x17bf('0xd6'),_0x47fa36['dialBusyRetryFrequency']),_0x3f5d5f[_0x17bf('0xc9')],_0x3f5d5f[_0x17bf('0xac')]);}}break;case'CANCEL':_0x47fa36['outboundRejectCallsDay']+=0x1;_0x3f5d5f[_0x17bf('0xd8')]+=0x1;_0x3f5d5f[_0x17bf('0x9f')]=ut[_0x17bf('0xa0')](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0x14,'AgentReject');ami[_0x17bf('0xa2')]('custom:agentreject',ut[_0x17bf('0xb4')](_0x3f5d5f,_0x17bf('0xd9')));rpcDb[_0x17bf('0x90')](_0x3f5d5f,_0x17bf('0xda'));if(ut[_0x17bf('0xa0')](_0x3f5d5f)>=_0x47fa36[_0x17bf('0xcd')]){_0x343d10=ut['cloneAction'](_0x3f5d5f,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x343d10,_0x17bf('0xdb'));}else{if(_0x3f5d5f[_0x17bf('0xd8')]>=_0x47fa36[_0x17bf('0xdc')]){rpcDb['createCustomerFinal'](_0x3f5d5f,_0x17bf('0xdb'));}else{rpcDb['rescheduleContact'](ut[_0x17bf('0xab')](_0x3f5d5f,'countagentrejectretry',_0x47fa36[_0x17bf('0xdd')]),_0x3f5d5f[_0x17bf('0xc9')],_0x3f5d5f[_0x17bf('0xac')]);}}break;case _0x17bf('0xde'):_0x47fa36[_0x17bf('0x44')]+=0x1;_0x3f5d5f[_0x17bf('0xdf')]+=0x1;_0x3f5d5f[_0x17bf('0x9f')]=ut[_0x17bf('0xa0')](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0xb,_0x17bf('0xe0'));rpcDb['createCustomerHistory'](_0x3f5d5f,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x3f5d5f)>=_0x47fa36[_0x17bf('0xcd')]){_0x343d10=ut[_0x17bf('0xa6')](_0x3f5d5f,0xf,_0x17bf('0xa7'));rpcDb['createCustomerFinal'](_0x343d10,_0x17bf('0xe1'));}else{if(_0x3f5d5f[_0x17bf('0xe2')]>=_0x47fa36[_0x17bf('0xe3')]){rpcDb[_0x17bf('0x94')](_0x3f5d5f,_0x17bf('0xe1'));}else{rpcDb[_0x17bf('0xaa')](ut[_0x17bf('0xab')](_0x3f5d5f,_0x17bf('0xdf'),_0x47fa36[_0x17bf('0xe4')]),_0x3f5d5f['unlockAgent'],_0x3f5d5f[_0x17bf('0xac')]);}}break;case'18':_0x47fa36['outboundUnknownCallsDay']+=0x1;_0x3f5d5f[_0x17bf('0xe5')]+=0x1;_0x3f5d5f[_0x17bf('0x9f')]=ut['totalGlobal'](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0x12,_0x3be492[_0x17bf('0xe6')]||_0x3be492[_0x17bf('0xe7')]);ami['emit'](_0x17bf('0xe8'),ut['buildObj'](_0x3f5d5f,_0x17bf('0xe9')));rpcDb[_0x17bf('0x90')](_0x3f5d5f,_0x17bf('0xea'));if(ut['totalGlobal'](_0x3f5d5f)>=_0x47fa36[_0x17bf('0xcd')]){_0x343d10=ut[_0x17bf('0xa6')](_0x3f5d5f,0xf,'Global');rpcDb[_0x17bf('0x94')](_0x343d10,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x17bf('0x94')](_0x3f5d5f,_0x17bf('0xea'));}delete this[_0x17bf('0x16')][_0x3be492[_0x17bf('0xc1')]];break;case'19':_0x47fa36[_0x17bf('0x43')]+=0x1;_0x3f5d5f[_0x17bf('0x9f')]=ut[_0x17bf('0xa0')](_0x3f5d5f);ut[_0x17bf('0x8c')](_0x3f5d5f,0x13,_0x3be492['cause-txt']||_0x3be492['dialstatus']);ami[_0x17bf('0xa2')](_0x17bf('0xe8'),ut[_0x17bf('0xb4')](_0x3f5d5f,'amd'));rpcDb[_0x17bf('0x90')](_0x3f5d5f,_0x17bf('0xeb'));if(ut['totalGlobal'](_0x3f5d5f)>=_0x47fa36[_0x17bf('0xcd')]){_0x343d10=ut['cloneAction'](_0x3f5d5f,0xf,_0x17bf('0xa7'));rpcDb[_0x17bf('0x94')](_0x343d10,_0x17bf('0xeb'));}else{rpcDb[_0x17bf('0x94')](_0x3f5d5f,'[callProgressDetectingCustomer][machine]');}delete this[_0x17bf('0x16')][_0x3be492[_0x17bf('0xc1')]];break;default:if(_0x3f5d5f['dialAnswer']){ut['decrementTalkink'](_0x47fa36,'[default]');ut['loggerError'](_0x17bf('0xec')+_0x47fa36[_0x17bf('0x2a')],_0x3be492);}_0x47fa36[_0x17bf('0x43')]+=0x1;_0x3f5d5f['countglobal']=ut['totalGlobal'](_0x3f5d5f);ut['logCustomer'](_0x3f5d5f,0xc,_0x3be492[_0x17bf('0xe6')]||_0x3be492[_0x17bf('0xe7')]);rpcDb['createCustomerHistory'](_0x3f5d5f,_0x17bf('0xed'));if(ut[_0x17bf('0xa0')](_0x3f5d5f)>=_0x47fa36[_0x17bf('0xcd')]){_0x343d10=ut[_0x17bf('0xa6')](_0x3f5d5f,0xf,_0x17bf('0xa7'));rpcDb[_0x17bf('0x94')](_0x343d10,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x17bf('0x94')](_0x3f5d5f,_0x17bf('0xee'));}delete this['actions'][_0x3be492[_0x17bf('0xc1')]];}if(!(_0x3f5d5f['dialAnswer']&&_0x2918d6==='16')){ut[_0x17bf('0x7a')](_0x47fa36,'[callProgressDetectingCustomer]');logger[_0x17bf('0x5a')](_0x17bf('0xef'),_0x3f5d5f[_0x17bf('0xaf')],'\x20Queue',_0x47fa36['name'],_0x17bf('0x6f'),_0x47fa36[_0x17bf('0x4f')]);}if(_0x2918d6!==_0x17bf('0xf0')){delete this[_0x17bf('0x16')][_0x3be492[_0x17bf('0xc1')]];delete this[_0x17bf('0x16')][_0x3be492[_0x17bf('0xf1')]];}}};Preview['prototype'][_0x17bf('0xf2')]=function(_0x47c140,_0x4c3cd8,_0x3aedcd){if(_[_0x17bf('0xf3')](_0x4c3cd8)&&_0x17bf('0xf4')!==typeof _0x4c3cd8){return;}if(_['isUndefined'](_0x3aedcd)&&_0x17bf('0xf4')!==typeof _0x3aedcd){return;}switch(_0x3aedcd[_0x17bf('0xf5')]){case'0':ut['logAgent'](_0x47c140,0x0,_0x17bf('0xa1'));rpcDb[_0x17bf('0xf6')](_0x47c140,_0x17bf('0xf7'));break;case'3':ut[_0x17bf('0xf8')](_0x47c140,0x3,_0x17bf('0xf9'));rpcDb[_0x17bf('0xf6')](_0x47c140,_0x17bf('0xfa'));break;case'5':ut['logAgent'](_0x47c140,0x5,'Busy');rpcDb[_0x17bf('0xf6')](_0x47c140,_0x17bf('0xfb'));break;case'8':ut[_0x17bf('0xf8')](_0x47c140,0x8,'Congestion');rpcDb['createAgentHistory'](_0x47c140,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x17bf('0xf8')](_0x47c140,0x16,_0x17bf('0xfc'));rpcDb[_0x17bf('0xf6')](_0x47c140,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x17bf('0xf8')](_0x47c140,0xc,_0x3aedcd['reason']);rpcDb[_0x17bf('0xf6')](_0x47c140,_0x17bf('0xfd'));}ut['updateOriginated'](_0x4c3cd8,'[callProgressDetectingAgent]');logger[_0x17bf('0x5a')]('[originated][decrement][callProgressDetectingAgent]',_0x47c140[_0x17bf('0xaf')],_0x17bf('0xbf'),_0x4c3cd8['name'],_0x17bf('0x6f'),_0x4c3cd8['originated']);delete this[_0x17bf('0x16')][_0x47c140[_0x17bf('0xaf')]];};Preview['prototype'][_0x17bf('0xfe')]=function(_0x4af96c,_0x2b037f,_0x3b5b0d,_0x2b3212,_0x36f0c5){var _0x5dcbf5=this;return new BPromise(function(_0x413cd8,_0x33f3ff){if(_[_0x17bf('0x6e')](_0x2b037f)||_[_0x17bf('0x6e')](_0x2b037f['Contact'])||_[_0x17bf('0x6e')](_0x2b037f[_0x17bf('0xff')][_0x17bf('0x100')])||_['isNil'](_0x2b037f['VoiceQueueId'])){_0x33f3ff(ut[_0x17bf('0x4e')](_0x17bf('0x101'),_0x2b3212,_0x36f0c5));return;}var _0x10ae09=uuid['v4']();var _0x360bcd=_0x5dcbf5['campaignsPreview'][_0x2b037f[_0x17bf('0x102')][_0x17bf('0x2a')]];var _0x42d376=_0x3b5b0d?_0x5dcbf5[_0x17bf('0x17')][_0x3b5b0d]['id']:undefined;_0x5dcbf5[_0x17bf('0x16')][_0x10ae09]=new Action(_0x2b037f,_0x360bcd,_0x10ae09,_0x3b5b0d,_0x42d376);var _0x59cc88=_0x5dcbf5[_0x17bf('0x16')][_0x10ae09];_0x59cc88[_0x17bf('0xc9')]=_0x2b3212;_0x59cc88[_0x17bf('0xac')]=_0x36f0c5;_0x59cc88[_0x17bf('0x103')]=_0x3b5b0d;if(_[_0x17bf('0x104')](_0x4af96c)){_0x5dcbf5[_0x17bf('0x105')](_0x59cc88,_0x360bcd,_0x2b037f,_0x3b5b0d)[_0x17bf('0x84')](function(_0x2c6ff3){logger[_0x17bf('0x5a')](_0x17bf('0x106'),_0x17bf('0x107')+_0x59cc88[_0x17bf('0x70')]+_0x17bf('0x108')+_0x59cc88[_0x17bf('0x109')],JSON[_0x17bf('0x57')](_0x2c6ff3));ami[_0x17bf('0xa2')](_0x17bf('0x10a'),ut[_0x17bf('0xb4')](_0x59cc88,_0x17bf('0x10b'),_0x5dcbf5['campaignsPreview'][_0x59cc88['queue']]));_0x413cd8(ut[_0x17bf('0x4e')](_0x17bf('0x10c')));})['catch'](function(_0x45d2b5){ut[_0x17bf('0x62')](_0x17bf('0x10d'),_0x45d2b5);_0x33f3ff(ut['message'](_0x17bf('0x10e'),_0x2b3212,_0x36f0c5));});}else{_0x360bcd['outboundBlacklistCallsDay']+=0x1;ut[_0x17bf('0x10f')](_0x59cc88);rpcDb['createHistory'](_0x59cc88,_0x17bf('0x110'));delete _0x5dcbf5[_0x17bf('0x16')][_0x10ae09];_0x33f3ff(ut[_0x17bf('0x4e')](_0x17bf('0x111'),_0x2b3212,_0x36f0c5));}});};Preview[_0x17bf('0x67')][_0x17bf('0x9a')]=function(_0x27b87f){return!_[_0x17bf('0x6e')](_0x27b87f)&&!_[_0x17bf('0x6e')](_0x27b87f[_0x17bf('0x2a')])&&!_['isNil'](_0x27b87f[_0x17bf('0x54')])&&_0x27b87f[_0x17bf('0x54')]&&!_['isNil'](this[_0x17bf('0x15')][util['format'](_0x17bf('0x112'),_0x27b87f[_0x17bf('0x2a')])])&&!_[_0x17bf('0x6e')](this['trunks'][util['format']('SIP/%s',_0x27b87f[_0x17bf('0x2a')])][_0x17bf('0x76')])&&(this['trunks'][util[_0x17bf('0x5c')](_0x17bf('0x112'),_0x27b87f['name'])]['status']===_0x17bf('0x113')||this[_0x17bf('0x15')][util[_0x17bf('0x5c')](_0x17bf('0x112'),_0x27b87f[_0x17bf('0x2a')])][_0x17bf('0x76')]===_0x17bf('0x114'));};Preview[_0x17bf('0x67')][_0x17bf('0x115')]=function(_0x290c0b,_0x18bf8c){var _0x23a5ad=this;return new BPromise(function(_0x39333b,_0x3b7bd9){_0x23a5ad[_0x17bf('0x116')](_0x290c0b,_0x18bf8c)['then'](function(_0x401583){_0x39333b(_[_0x17bf('0x117')](_0x401583,[_0x17bf('0x4e')]));})[_0x17bf('0x78')](function(_0x59922a){if(_0x59922a['unlock']){rpcDb['unlockContact'](_0x290c0b);}if(_0x59922a['active']){rpcDb[_0x17bf('0x8b')](_0x290c0b);}_0x3b7bd9(_[_0x17bf('0x117')](_0x59922a,[_0x17bf('0x4e')]));});});};Preview[_0x17bf('0x67')][_0x17bf('0x116')]=function(_0x4f2357,_0x11163a){var _0x51f41a=this;return new BPromise(function(_0x58185c,_0x5e034f){var _0x3ddcc9,_0x584aee;rpcDb[_0x17bf('0x118')](_0x4f2357)[_0x17bf('0x84')](function(_0x224799){if(!_[_0x17bf('0x6e')](_0x224799[0x0])){_0x584aee=_0x224799[0x0]['recallme']?![]:!![];_0x3ddcc9=_0x224799[0x0][_0x17bf('0x119')]?!![]:![];_0x3ddcc9=_0x11163a?!![]:_0x3ddcc9;}var _0x4ea413=_0x51f41a[_0x17bf('0x11a')](_0x224799);if(_0x4ea413[_0x17bf('0x11b')]){rpcDb[_0x17bf('0x11c')](_[_0x17bf('0x117')](_0x224799[0x0],[_0x17bf('0x74'),'Contact.phone']))[_0x17bf('0x84')](function(_0x1a9a36){_0x51f41a['checkInBlack'](_0x1a9a36,_0x224799[0x0],_0x11163a,_0x584aee,_0x3ddcc9)[_0x17bf('0x84')](function(_0xa5ac2b){_0x58185c(_0xa5ac2b);})[_0x17bf('0x78')](function(_0x38aa52){_0x5e034f(_0x38aa52);});})['catch'](function(_0x180afe){ut['logger']('[Preview][checkIsBlackList]',_0x180afe);_0x5e034f(ut[_0x17bf('0x4e')]('Call\x20unsuccessful',_0x584aee,_0x3ddcc9));});}else{_0x5e034f(ut[_0x17bf('0x4e')](_0x4ea413['message'],_0x584aee,_0x3ddcc9));}})[_0x17bf('0x78')](function(_0x10db06){ut['logger'](_0x17bf('0x11d'),_0x10db06);_0x5e034f(ut['message'](_0x17bf('0x11e'),![],!![]));});});};Preview['prototype'][_0x17bf('0x11a')]=function(_0x12ab20){if(_[_0x17bf('0x6e')](_0x12ab20)||_[_0x17bf('0x104')](_0x12ab20)||!_[_0x17bf('0x6e')](_0x12ab20[0x0][_0x17bf('0x88')])&&_[_0x17bf('0x6e')](_0x12ab20[0x0][_0x17bf('0x88')][_0x17bf('0x2a')])){ut[_0x17bf('0x62')](_0x17bf('0x11f'),_0x12ab20);return{'isValid':![],'message':_0x17bf('0x120')};}var _0x357a8f=this[_0x17bf('0x13')][_0x12ab20[0x0]['Queue'][_0x17bf('0x2a')]];_0x357a8f[_0x17bf('0x4e')]='ACTIVE';if(_[_0x17bf('0x6e')](_0x357a8f)){ut[_0x17bf('0x62')](_0x17bf('0x121'),_0x357a8f);return{'isValid':![],'message':_0x17bf('0x122')};}if(!this[_0x17bf('0x9a')](_0x357a8f[_0x17bf('0x53')])){ut[_0x17bf('0x62')](_0x17bf('0x123'),'campaign\x20Name:\x20'+_0x357a8f[_0x17bf('0x2a')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x17bf('0x9a')](_0x357a8f['TrunkBackup'])){ut[_0x17bf('0x62')](_0x17bf('0x123'),_0x357a8f[_0x17bf('0x2a')]+_0x17bf('0x124'));return{'isValid':![],'message':_0x17bf('0x125')};}}if(!ut[_0x17bf('0x126')](_0x357a8f[_0x17bf('0x34')])){ut[_0x17bf('0x62')](_0x17bf('0x127'),_0x357a8f['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x17bf('0x128')+_0x357a8f['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x17bf('0x129')};};Preview[_0x17bf('0x67')]['execCall']=function(_0x5edcfb,_0x5932cb,_0x26976c,_0xc75f5a){var _0x571111=this;return new BPromise(function(_0xc00b39,_0xc0605a){var _0x1e5d0d=_0x5edcfb[_0x17bf('0xaf')];var _0x1bd304=_0x571111[_0x17bf('0x9a')](_0x5932cb[_0x17bf('0x53')])?util[_0x17bf('0x5c')](_0x17bf('0x12a'),_0x5932cb['Trunk']['name'],_[_0x17bf('0x6e')](_0x5932cb[_0x17bf('0x38')])?'':_0x5932cb['dialPrefix'][_0x17bf('0x12b')]()||'',_0x5932cb[_0x17bf('0x12c')]>0x0?_0x26976c['Contact'][_0x17bf('0x100')][_0x17bf('0x12d')](_0x5932cb[_0x17bf('0x12c')]):_0x26976c[_0x17bf('0xff')]['phone']):util[_0x17bf('0x5c')](_0x17bf('0x12a'),_[_0x17bf('0x6e')](_0x5932cb[_0x17bf('0x12e')])?_0x5932cb[_0x17bf('0x53')][_0x17bf('0x2a')]:_0x5932cb[_0x17bf('0x12e')][_0x17bf('0x2a')],_[_0x17bf('0x6e')](_0x5932cb['dialPrefix'])?'':_0x5932cb[_0x17bf('0x38')]['trim']()||'',_0x5932cb[_0x17bf('0x12c')]>0x0?_0x26976c[_0x17bf('0xff')][_0x17bf('0x100')][_0x17bf('0x12d')](_0x5932cb[_0x17bf('0x12c')]):_0x26976c[_0x17bf('0xff')][_0x17bf('0x100')]);var _0x5f497d=_0x571111['isTrunkReachable'](_0x5932cb[_0x17bf('0x53')])?ut['getCallerId'](_0x5932cb[_0x17bf('0x53')]['callerid'],_0x5932cb[_0x17bf('0x36')],_0x5932cb['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x17bf('0x12f')](_0x5932cb[_0x17bf('0x37')],_0x5932cb[_0x17bf('0x130')]):_0x5932cb['dialOriginateCallerIdNumber']):ut[_0x17bf('0x131')](_['isNil'](_0x5932cb[_0x17bf('0x12e')])?_0x5932cb[_0x17bf('0x53')][_0x17bf('0x55')]:_0x5932cb[_0x17bf('0x12e')][_0x17bf('0x55')],_0x5932cb[_0x17bf('0x36')],_0x5932cb[_0x17bf('0x130')]>0x0?ut[_0x17bf('0x12f')](_0x5932cb['dialOriginateCallerIdNumber'],_0x5932cb['dialRandomLastDigitCallerIdNumber']):_0x5932cb[_0x17bf('0x37')]);if(_0x5f497d){_0x5edcfb[_0x17bf('0x132')]=ut[_0x17bf('0x133')](_0x5f497d);_0x5edcfb[_0x17bf('0x134')]=ut[_0x17bf('0x135')](_0x5f497d);}var _0x5f4653=ut[_0x17bf('0x136')](_0x5932cb,_0x26976c,_0x1bd304,_0x5f497d,_0x1e5d0d,_0x5edcfb);_[_0x17bf('0x137')](_0x5edcfb,ut[_0x17bf('0x138')](_0x5f4653));_0x5edcfb[_0x17bf('0x139')]=moment()[_0x17bf('0x5c')](_0x17bf('0xad'));ami['Action'](ut[_0x17bf('0x13a')](_0x5edcfb,_0x5932cb,_0x5f4653,_0x5edcfb['activeContact'],_0xc75f5a))[_0x17bf('0x84')](function(_0x2a519e){var _0x36cad5=_0x5edcfb['channelAgent'];if(!_[_0x17bf('0x6e')](_0x36cad5)){if(!_[_0x17bf('0x6e')](_0x571111[_0x17bf('0x17')][_0x36cad5])){_0x571111[_0x17bf('0x17')][_0x36cad5][_0x17bf('0x13b')]=_0x5edcfb[_0x17bf('0x13c')];emit(util['format'](_0x17bf('0x13d'),_0x571111[_0x17bf('0x17')][_0x36cad5][_0x17bf('0x2a')]),_0x17bf('0x13e'),{'destaccountcode':_0x571111[_0x17bf('0x17')][_0x36cad5][_0x17bf('0x13f')],'destconnectedlinenum':_0x5edcfb[_0x17bf('0x13c')]});}}_0x5932cb[_0x17bf('0x4f')]+=0x1;logger[_0x17bf('0x5a')](_0x17bf('0x140'),_0x1e5d0d,'\x20Queue',_0x5932cb[_0x17bf('0x2a')],_0x17bf('0x6f'),_0x5932cb['originated']);_0xc00b39(_0x2a519e);})[_0x17bf('0x78')](function(_0x2aa507){ut[_0x17bf('0xf8')](_0x5edcfb,0xe,_0x17bf('0x141'));rpcDb['createAgentHistory'](_0x5edcfb,_0x17bf('0x142'));_0xc0605a(_0x2aa507);});});};Preview[_0x17bf('0x67')]['syncNewExten']=function(_0x189136){if(this[_0x17bf('0x16')][_0x189136[_0x17bf('0xc1')]]){this[_0x17bf('0x16')][_0x189136['linkedid']][_0x17bf('0x77')]=_0x189136['channel'];}};Preview[_0x17bf('0x67')][_0x17bf('0x19')]=function(_0x42893c){var _0x4916a0=this;var _0xe610d7=this[_0x17bf('0x16')][_0x42893c[_0x17bf('0x143')]];if(_0xe610d7){if(_0xe610d7[_0x17bf('0x103')]&&this['agents'][_0xe610d7[_0x17bf('0x103')]]){ut[_0x17bf('0x144')](_0xe610d7,this[_0x17bf('0x17')][_0xe610d7[_0x17bf('0x103')]][_0x17bf('0x2a')],this[_0x17bf('0x17')][_0xe610d7[_0x17bf('0x103')]]['id']);}var _0x3e6f94=_['clone'](_0xe610d7);_0x3e6f94[_0x17bf('0xae')]=moment()[_0x17bf('0x5c')](_0x17bf('0xad'));var _0xb62feb=_0x4916a0['campaignsPreview'][_0xe610d7[_0x17bf('0x70')]];if(ut[_0x17bf('0x145')](_0x42893c[_0x17bf('0x146')])){if(_0xe610d7[_0x17bf('0xc9')]){rpcDb[_0x17bf('0x147')](_0xe610d7[_0x17bf('0x109')]);}if(_0xe610d7[_0x17bf('0xac')]){rpcDb['disableContact'](_0xe610d7[_0x17bf('0x109')]);}ami[_0x17bf('0xa2')](_0x17bf('0x148'),ut['buildObj'](_0xe610d7,'rejected',this['campaignsPreview'][_0xe610d7[_0x17bf('0x70')]]));this[_0x17bf('0xf2')](_0x3e6f94,_0xb62feb,_0x42893c);}else{_0xe610d7[_0x17bf('0x139')]=moment()['format'](_0x17bf('0xad'));ut[_0x17bf('0xf8')](_0x3e6f94,0x4,'Answer');rpcDb[_0x17bf('0xf6')](_0x3e6f94,_0x17bf('0x149'));}}};Preview[_0x17bf('0x67')][_0x17bf('0x1c')]=function(_0x2c9612){var _0xbb1227=this;var _0x33376c=this[_0x17bf('0x16')][_0x2c9612[_0x17bf('0xc1')]];var _0x467407;if(_0x33376c){_0x467407=this['campaignsPreview'][_0x33376c[_0x17bf('0x70')]];logger['info'](_0x17bf('0x14a'),_0x2c9612[_0x17bf('0xc1')],_0x17bf('0xbf'),_0x467407['name'],'pTalking:\x20',_0x467407['pTalking']);}if(this['actions'][_0x2c9612['linkedid']]&&_0x2c9612[_0x17bf('0xc1')]!==_0x2c9612[_0x17bf('0xaf')]){if(_0x2c9612['cause']==='16'&&this[_0x17bf('0x16')][_0x2c9612['linkedid']][_0x17bf('0x71')]){this['callProgressDetectingCustomer'](_0x2c9612,_0x2c9612[_0x17bf('0xc1')],_0x2c9612[_0x17bf('0x14b')]);}else if(this[_0x17bf('0x16')][_0x2c9612['linkedid']][_0x17bf('0x71')]){logger[_0x17bf('0x5a')](_0x17bf('0x14c'),_0x2c9612[_0x17bf('0xc1')],_0x2c9612[_0x17bf('0x14b')],_0x17bf('0xbf'),_0x467407[_0x17bf('0x2a')],_0x17bf('0xc0'),_0x467407[_0x17bf('0x2c')]);this[_0x17bf('0x9d')](_0x2c9612,_0x2c9612[_0x17bf('0xc1')],_0x2c9612[_0x17bf('0x14b')]);}}else if(_0x33376c&&_[_0x17bf('0x6e')](_0x33376c[_0x17bf('0x14d')])&&_0x467407[_0x17bf('0x14e')]&&_0x2c9612['linkedid']===_0x2c9612['uniqueid']&&_[_0x17bf('0x6e')](_0x2c9612['reason'])&&_0x2c9612[_0x17bf('0x14b')]==='16'&&_0x2c9612[_0x17bf('0x14f')]==='6'&&_[_0x17bf('0xf3')](_0x33376c[_0x17bf('0x150')])){if(_0x33376c[_0x17bf('0xc9')]){rpcDb['unlockContact'](_0x33376c[_0x17bf('0x109')]);}if(_0x33376c[_0x17bf('0xac')]){rpcDb[_0x17bf('0x8b')](_0x33376c[_0x17bf('0x109')]);}_0x2c9612[_0x17bf('0xf5')]='22';this[_0x17bf('0xf2')](_0x33376c,_0x467407,_0x2c9612);}else if(_0x33376c&&_0x33376c[_0x17bf('0x150')]){if(_0x2c9612[_0x17bf('0x14b')]==='16'&&this[_0x17bf('0x16')][_0x2c9612['linkedid']][_0x17bf('0x71')]){logger[_0x17bf('0x5a')](_0x17bf('0x151'),_0x2c9612[_0x17bf('0xc1')],_0x2c9612[_0x17bf('0x14b')],_0x17bf('0xbf'),_0x467407['name'],_0x17bf('0xc0'),_0x467407[_0x17bf('0x2c')]);this[_0x17bf('0x9d')](_0x2c9612,_0x2c9612[_0x17bf('0xc1')],_0x2c9612[_0x17bf('0x14b')]);}else if(this[_0x17bf('0x16')][_0x2c9612[_0x17bf('0xc1')]]['dialAnswer']){logger['info'](_0x17bf('0x14c'),_0x2c9612[_0x17bf('0xc1')],_0x2c9612['cause'],_0x17bf('0xbf'),_0x467407['name'],_0x17bf('0xc0'),_0x467407[_0x17bf('0x2c')]);this[_0x17bf('0x9d')](_0x2c9612,_0x2c9612[_0x17bf('0xc1')],_0x2c9612[_0x17bf('0x14b')]);}}};Preview[_0x17bf('0x67')][_0x17bf('0x152')]=function(_0x2edfd3){if(this[_0x17bf('0x16')][_0x2edfd3[_0x17bf('0xf1')]]&&_0x2edfd3[_0x17bf('0xf1')]!==_0x2edfd3[_0x17bf('0x153')]){this[_0x17bf('0x9d')](_0x2edfd3,_0x2edfd3[_0x17bf('0xf1')],_0x2edfd3[_0x17bf('0xe7')]);}};Preview[_0x17bf('0x67')][_0x17bf('0x1d')]=function(_0x49e708){if(this['actions'][_0x49e708[_0x17bf('0xc1')]]&&_0x49e708[_0x17bf('0xc1')]!==_0x49e708[_0x17bf('0xaf')]&&!this['actions'][_0x49e708[_0x17bf('0xc1')]][_0x17bf('0x71')]){if(_0x49e708[_0x17bf('0x14b')]==='1'){this[_0x17bf('0x9d')](_0x49e708,_0x49e708[_0x17bf('0xc1')],_0x49e708[_0x17bf('0x14b')]);}}};Preview[_0x17bf('0x67')][_0x17bf('0x154')]=function(_0x20f701,_0x3535e0,_0x5282c0){if(this[_0x17bf('0x16')][_0x20f701]){if(_[_0x17bf('0x6e')](this[_0x17bf('0x16')][_0x20f701][_0x17bf('0x155')])){this['actions'][_0x20f701][_0x17bf('0x155')]={};}this[_0x17bf('0x16')][_0x20f701][_0x17bf('0x155')][_0x3535e0]=_0x5282c0;}};Preview[_0x17bf('0x67')][_0x17bf('0x22')]=function(_0x282974){try{if(!_[_0x17bf('0x6e')](_0x282974)){if(ut[_0x17bf('0x156')](_[_0x17bf('0x157')](_0x282974[_0x17bf('0x158')])[0x0])){this['addVariable'](_0x282974[_0x17bf('0xaf')],_[_0x17bf('0x157')](_0x282974[_0x17bf('0x158')])[0x0],_0x282974['value']);}}}catch(_0x33bbe6){logger[_0x17bf('0x159')](_0x17bf('0x15a'),util[_0x17bf('0x15b')](_0x33bbe6,{'showHidden':![],'depth':null}));}};Preview[_0x17bf('0x67')]['syncAttendedTransfer']=function(_0x5e91ff){if(_0x5e91ff){if(this[_0x17bf('0x16')][_0x5e91ff[_0x17bf('0x15c')]]){this[_0x17bf('0x16')][_0x5e91ff['transfertargetlinkedid']][_0x17bf('0x150')]=!![];}}};Preview[_0x17bf('0x67')][_0x17bf('0x26')]=function(_0x33abb2){if(_0x33abb2){if(this[_0x17bf('0x16')][_0x33abb2[_0x17bf('0x15d')]]){this[_0x17bf('0x16')][_0x33abb2[_0x17bf('0x15d')]][_0x17bf('0x150')]=!![];}}};module[_0x17bf('0x15e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index acc5c6e..fc0348e 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 _0xb537=['createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb537,0x68));var _0x7b53=function(_0x2cdf7d,_0x11f464){_0x2cdf7d=_0x2cdf7d-0x0;var _0x4b6348=_0xb537[_0x2cdf7d];return _0x4b6348;};'use strict';var util=require(_0x7b53('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b53('0x1'))(_0x7b53('0x2'));var _=require(_0x7b53('0x3'));var cmHopper=require(_0x7b53('0x4'));var cmHopperFinal=require(_0x7b53('0x5'));var cmHopperHistory=require(_0x7b53('0x6'));var cmHopperBlack=require(_0x7b53('0x7'));var voiceQueueRt=require(_0x7b53('0x8'));var agentReportPreview=require(_0x7b53('0x9'));var voiceQueueReport=require(_0x7b53('0xa'));function loggerCatch(_0x5be846){return function(_0x2891ac){logger[_0x7b53('0xb')](_0x5be846,util[_0x7b53('0xc')](_0x2891ac,{'showHidden':![],'depth':null}));};}function create(_0x4a41a7){return BPromise[_0x7b53('0xd')]()['then'](cmHopperHistory[_0x7b53('0xe')](_0x4a41a7))[_0x7b53('0xf')](loggerCatch(_0x7b53('0x10')));}function createAgent(_0x49cff1){return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](agentReportPreview[_0x7b53('0xe')](_0x49cff1))[_0x7b53('0xf')](loggerCatch(_0x7b53('0x10')));}function moveContact(_0x2cff43){return BPromise[_0x7b53('0xd')]()['then'](cmHopper[_0x7b53('0x12')](_0x2cff43,!![]))[_0x7b53('0xf')](loggerCatch(_0x7b53('0x13')));}exports[_0x7b53('0x14')]=function(_0x503b71){return BPromise['resolve']()[_0x7b53('0x11')](cmHopperBlack[_0x7b53('0x14')](_0x503b71))[_0x7b53('0xf')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x7b53('0x15')]=function(_0x317181){return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](cmHopper[_0x7b53('0x15')](_0x317181))['catch'](loggerCatch(_0x7b53('0x16')));};exports['createHistory']=function(_0x4175b1,_0x5283c8){create(_0x4175b1)[_0x7b53('0xf')](loggerCatch(_0x5283c8));moveContact(_0x4175b1)[_0x7b53('0xf')](loggerCatch(_0x5283c8));};exports[_0x7b53('0x17')]=function(_0x166e0f,_0x2e3159){createAgent(_0x166e0f)[_0x7b53('0xf')](loggerCatch(_0x2e3159));};exports[_0x7b53('0x18')]=function(_0x5bea0b,_0x6f8879){create(_0x5bea0b)[_0x7b53('0xf')](loggerCatch(_0x6f8879));};exports[_0x7b53('0x19')]=function(_0x54bfaf,_0x39640d){moveContact(_0x54bfaf)['catch'](loggerCatch(_0x39640d));};exports['rescheduleContact']=function(_0x29d3f6,_0xc504cd,_0x54fe64){if(_0xc504cd){_0x29d3f6[_0x7b53('0x1a')]=null;}if(_0x54fe64){_0x29d3f6[_0x7b53('0x1b')]=![];}return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](cmHopper['rescheduleContact'](_0x29d3f6))[_0x7b53('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0xc17ac9){return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](cmHopper['countReScheduled'](_0xc17ac9))[_0x7b53('0xf')](loggerCatch(_0x7b53('0x1c')));};exports['unlockContact']=function(_0x3bde05){return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](cmHopper['unlockContact']({'UserId':null},_0x3bde05,0x1))[_0x7b53('0xf')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x155e07){return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](cmHopper[_0x7b53('0x1d')]({'active':![]},_0x155e07,0x1))[_0x7b53('0xf')](loggerCatch(_0x7b53('0x1e')));};exports[_0x7b53('0x1f')]=function(_0x295079){var _0x38ffa7={};_0x38ffa7['type']=_0x295079[_0x7b53('0x20')];_0x38ffa7[_0x7b53('0x21')]=_0x295079['uniqueid'];_0x38ffa7[_0x7b53('0x22')]=_0x295079[_0x7b53('0x22')];_0x38ffa7[_0x7b53('0x23')]=_0x295079[_0x7b53('0x23')];_0x38ffa7['queue']=_0x295079[_0x7b53('0x24')];_0x38ffa7[_0x7b53('0x25')]=_0x295079['answertime'];_0x38ffa7[_0x7b53('0x26')]=_0x295079[_0x7b53('0x27')];_0x38ffa7[_0x7b53('0x28')]=0x1;_0x38ffa7[_0x7b53('0x29')]=_0x295079['endtime'];_0x38ffa7[_0x7b53('0x2a')]=_0x295079[_0x7b53('0x2b')];_0x38ffa7[_0x7b53('0x2c')]=_0x7b53('0x2d');_0x38ffa7[_0x7b53('0x2e')]=_0x7b53('0x2f');_0x38ffa7[_0x7b53('0x30')]=0x0;_0x38ffa7[_0x7b53('0x31')]=0x1;_0x38ffa7[_0x7b53('0x32')]=_0x295079[_0x7b53('0x2b')];_0x38ffa7[_0x7b53('0x33')]=_0x7b53('0x34');return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](voiceQueueReport[_0x7b53('0x35')](_0x38ffa7))[_0x7b53('0xf')](loggerCatch(_0x7b53('0x36')));};exports[_0x7b53('0x37')]=function(_0x475058,_0x20399c){return BPromise[_0x7b53('0xd')]()['then'](cmHopper[_0x7b53('0x37')](_0x475058,_0x20399c))[_0x7b53('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7b53('0x38')]=function(_0x13026e){return BPromise[_0x7b53('0xd')]()[_0x7b53('0x11')](cmHopper[_0x7b53('0x39')](_0x13026e,!![],!![]))['catch'](loggerCatch(_0x7b53('0x3a')));}; \ No newline at end of file +var _0x760d=['[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','membername','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact'];(function(_0x1b9bd4,_0x276012){var _0x18dde6=function(_0x59b521){while(--_0x59b521){_0x1b9bd4['push'](_0x1b9bd4['shift']());}};_0x18dde6(++_0x276012);}(_0x760d,0x148));var _0xd760=function(_0x4e0c5a,_0x3f970c){_0x4e0c5a=_0x4e0c5a-0x0;var _0x4daacf=_0x760d[_0x4e0c5a];return _0x4daacf;};'use strict';var util=require(_0xd760('0x0'));var BPromise=require(_0xd760('0x1'));var logger=require(_0xd760('0x2'))(_0xd760('0x3'));var _=require(_0xd760('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd760('0x5'));var voiceQueueRt=require(_0xd760('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xd760('0x7'));function loggerCatch(_0x10ecec){return function(_0x37a608){logger[_0xd760('0x8')](_0x10ecec,util[_0xd760('0x9')](_0x37a608,{'showHidden':![],'depth':null}));};}function create(_0x4a9c59){return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](cmHopperHistory[_0xd760('0xc')](_0x4a9c59))[_0xd760('0xd')](loggerCatch(_0xd760('0xe')));}function createAgent(_0x299d8f){return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](agentReportPreview[_0xd760('0xc')](_0x299d8f))['catch'](loggerCatch(_0xd760('0xe')));}function moveContact(_0x131ba0){return BPromise['resolve']()[_0xd760('0xb')](cmHopper[_0xd760('0xf')](_0x131ba0,!![]))[_0xd760('0xd')](loggerCatch(_0xd760('0x10')));}exports['checkIsBlackList']=function(_0x69d6b4){return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](cmHopperBlack['checkIsBlackList'](_0x69d6b4))['catch'](loggerCatch(_0xd760('0x11')));};exports[_0xd760('0x12')]=function(_0x3663b2){return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](cmHopper['getContactPreview'](_0x3663b2))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xd760('0xc')]=function(_0x3f36da,_0x3d9180){create(_0x3f36da)[_0xd760('0xd')](loggerCatch(_0x3d9180));moveContact(_0x3f36da)[_0xd760('0xd')](loggerCatch(_0x3d9180));};exports[_0xd760('0x13')]=function(_0x1a48fd,_0x10e4e3){createAgent(_0x1a48fd)['catch'](loggerCatch(_0x10e4e3));};exports['createCustomerHistory']=function(_0x71c846,_0x26943d){create(_0x71c846)[_0xd760('0xd')](loggerCatch(_0x26943d));};exports[_0xd760('0x14')]=function(_0x547920,_0x2d3d1b){moveContact(_0x547920)['catch'](loggerCatch(_0x2d3d1b));};exports[_0xd760('0x15')]=function(_0x23a513,_0x35cefd,_0x44c045){if(_0x35cefd){_0x23a513['UserId']=null;}if(_0x44c045){_0x23a513[_0xd760('0x16')]=![];}return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](cmHopper[_0xd760('0x15')](_0x23a513))['catch'](loggerCatch(_0xd760('0x17')));};exports[_0xd760('0x18')]=function(_0x1ed02c){return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](cmHopper[_0xd760('0x18')](_0x1ed02c))[_0xd760('0xd')](loggerCatch(_0xd760('0x19')));};exports[_0xd760('0x1a')]=function(_0x1fe1fd){return BPromise[_0xd760('0xa')]()['then'](cmHopper[_0xd760('0x1a')]({'UserId':null},_0x1fe1fd,0x1))[_0xd760('0xd')](loggerCatch(_0xd760('0x1b')));};exports[_0xd760('0x1c')]=function(_0x2b59d6){return BPromise['resolve']()[_0xd760('0xb')](cmHopper[_0xd760('0x1a')]({'active':![]},_0x2b59d6,0x1))[_0xd760('0xd')](loggerCatch(_0xd760('0x1d')));};exports['crateCustomerReportQueue']=function(_0x46960f){var _0x4d4309={};_0x4d4309[_0xd760('0x1e')]=_0x46960f[_0xd760('0x1e')];_0x4d4309['uniqueid']=_0x46960f[_0xd760('0x1f')];_0x4d4309[_0xd760('0x20')]=_0x46960f[_0xd760('0x20')];_0x4d4309[_0xd760('0x21')]=_0x46960f[_0xd760('0x21')];_0x4d4309[_0xd760('0x22')]=_0x46960f[_0xd760('0x22')];_0x4d4309[_0xd760('0x23')]=_0x46960f[_0xd760('0x24')];_0x4d4309[_0xd760('0x25')]=_0x46960f[_0xd760('0x24')];_0x4d4309['queuecallercomplete']=0x1;_0x4d4309[_0xd760('0x26')]=_0x46960f['endtime'];_0x4d4309['connectedlinename']=_0x46960f[_0xd760('0x27')];_0x4d4309['context']=_0xd760('0x28');_0x4d4309['exten']=_0xd760('0x29');_0x4d4309[_0xd760('0x2a')]=0x0;_0x4d4309[_0xd760('0x2b')]=0x1;_0x4d4309[_0xd760('0x2c')]=_0x46960f[_0xd760('0x27')];_0x4d4309['queuecallerexitreason']=_0xd760('0x2d');return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](voiceQueueReport[_0xd760('0x2e')](_0x4d4309))[_0xd760('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xd760('0x2f')]=function(_0x585798,_0x3ddd49){return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](cmHopper['getContactRecallMe'](_0x585798,_0x3ddd49))[_0xd760('0xd')](loggerCatch(_0xd760('0x30')));};exports[_0xd760('0x31')]=function(_0x39c258){return BPromise[_0xd760('0xa')]()[_0xd760('0xb')](cmHopper['rescheduleContact'](_0x39c258,!![],!![]))[_0xd760('0xd')](loggerCatch(_0xd760('0x32')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 6bec9b9..9467675 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 _0xfa5e=['xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','message','getCallerId','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','toUpper','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','responsetime','logAgent','state','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','BOOKED','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','status','push','getDiff','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter'];(function(_0x5823aa,_0x4a2310){var _0x15b657=function(_0x8df0a6){while(--_0x8df0a6){_0x5823aa['push'](_0x5823aa['shift']());}};_0x15b657(++_0x4a2310);}(_0xfa5e,0x19f));var _0xefa5=function(_0x431800,_0x5e2161){_0x431800=_0x431800-0x0;var _0x43ec5a=_0xfa5e[_0x431800];return _0x43ec5a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xefa5('0x0'));var logger=require(_0xefa5('0x1'))(_0xefa5('0x2'));var ipAgi=process[_0xefa5('0x3')][_0xefa5('0x4')]||_0xefa5('0x5');function getSeconds(_0x21f7f3,_0x592e77){var _0x411585=moment(_0x21f7f3)[_0xefa5('0x6')](0x0);var _0x5cd151=moment(_0x592e77)['milliseconds'](0x0);return _0x411585['diff'](_0x5cd151,_0xefa5('0x7'));}exports[_0xefa5('0x8')]=function(_0x4d3c0b){return function(_0x1fc016){logger[_0xefa5('0x9')](_0x4d3c0b,util[_0xefa5('0xa')](_0x1fc016,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x509149,_0x5e622c){logger[_0xefa5('0xb')](_0x509149,util[_0xefa5('0xa')](_0x5e622c,{'showHidden':![],'depth':null}));};exports[_0xefa5('0xc')]=function(_0x50e2a9,_0x21346f){logger['error'](_0x50e2a9,util[_0xefa5('0xa')](_0x21346f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x117726){return function(_0x5b6642){logger[_0xefa5('0xb')](_0x117726,util[_0xefa5('0xa')](_0x5b6642,{'showHidden':![],'depth':null}));};};exports[_0xefa5('0xd')]=function(_0x10de4d,_0x373a9d,_0x19eafb){return{'message':_0x10de4d,'unlock':_0x373a9d,'active':_0x19eafb};};exports[_0xefa5('0xe')]=function(_0x58dbf7,_0x56fc47,_0x1049a9){if(!_[_0xefa5('0xf')](_0x1049a9)&&'string'===typeof _0x1049a9&&!_[_0xefa5('0x10')](_0x1049a9)){if(!_[_0xefa5('0xf')](_0x56fc47)&&'string'===typeof _0x56fc47&&!_[_0xefa5('0x10')](_0x56fc47)){return util['format'](_0xefa5('0x11'),_0x56fc47,_0x1049a9);}return util[_0xefa5('0x12')](_0xefa5('0x11'),_0x1049a9,_0x1049a9);}if(!_['isUndefined'](_0x58dbf7)&&'string'===typeof _0x58dbf7&&!_[_0xefa5('0x10')](_0x58dbf7)){return _0x58dbf7;}return'\x22\x22\x20<>';};exports[_0xefa5('0x13')]=function(_0x191db0){if(_[_0xefa5('0x14')](_0x191db0)){return![];}return _0x191db0;};exports[_0xefa5('0x15')]=function(_0x3952a6,_0x4196a0,_0x333811,_0x451dd1,_0x4e165d,_0x3e0555){var _0x55f63f={'XMD-QUEUE':_0x4196a0[_0xefa5('0x16')]?_0x4196a0[_0xefa5('0x16')][_0xefa5('0x17')]:'','XMD-CALLERID':_0x451dd1,'XMD-CALLERID-PREVIEW':_0x3e0555?util[_0xefa5('0x12')]('\x22%s\x22\x20<%s>',_0x3e0555[_0xefa5('0x18')],_0x3e0555[_0xefa5('0x19')]):_0x451dd1,'XMD-DIALID':_0x4e165d,'XMD-CONTACTID':_0x4196a0[_0xefa5('0x1a')],'XMD-CDRTYPE':_0xefa5('0x1b'),'CALLERID(all)':_0x451dd1,'XMD-VOICEQUEUEID':_0x4196a0['VoiceQueueId'],'XMD-DIALCHANNEL':_0x333811,'XMD-DIALTIMEOUT':_0x3952a6['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xefa5('0x12')](_0xefa5('0x1c'),_0x3952a6['dialQueueProject2']?'g':'',_[_0xefa5('0x10')](_0x3952a6[_0xefa5('0x1d')])?'':_0xefa5('0x1e')),'XMD-DIALURL':_0x3952a6[_0xefa5('0x1f')]||'','XMD-AGI':_0x3952a6[_0xefa5('0x20')]?util[_0xefa5('0x12')](_0xefa5('0x21'),ipAgi,_0x3952a6['dialQueueProject']):_0xefa5('0x22'),'XMD-AGIAFTER':_0x3952a6['dialQueueProject2']?util[_0xefa5('0x12')](_0xefa5('0x21'),ipAgi,_0x3952a6[_0xefa5('0x23')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3e0555?_0x3e0555[_0xefa5('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x3e0555?_0x3e0555[_0xefa5('0x25')]:'','XMD-DESTINATION':_0xefa5('0x26')};if(!_[_0xefa5('0x10')](_0x3952a6[_0xefa5('0x1d')])){_0x55f63f[util[_0xefa5('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3952a6['monitor_format'];_0x55f63f[util[_0xefa5('0x12')]('%s',_0xefa5('0x27'))]=_0x4e165d;}if(_0x4196a0&&_0x4196a0['Contact']){for(var _0x34bcaf in _0x4196a0[_0xefa5('0x28')]){if(_0x4196a0[_0xefa5('0x28')][_0xefa5('0x29')](_0x34bcaf)){if(!_[_0xefa5('0x14')](_0x4196a0[_0xefa5('0x28')][_0x34bcaf])&&_0x34bcaf!=='id'&&_0x34bcaf!==_0xefa5('0x2a')&&_0x34bcaf!=='createdAt'&&_0x34bcaf!==_0xefa5('0x2b')){_0x55f63f[util[_0xefa5('0x12')](_0xefa5('0x2c'),'XMD-',_[_0xefa5('0x2d')](_0x34bcaf))]=_0x4196a0['Contact'][_0x34bcaf];}}}}return _0x55f63f;};exports['toLowerVariables']=function(_0x447736){var _0x20d399={};for(var _0x2e04e6 in _0x447736){if(_0x447736[_0xefa5('0x29')](_0x2e04e6)){_0x20d399[util[_0xefa5('0x12')]('%s',_['toLower'](_0x2e04e6))]=_0x447736[_0x2e04e6];}}return{'variables':_0x20d399};};exports['updateOriginated']=function(_0x32bfdb,_0x2e84eb){if(!_[_0xefa5('0x14')](_0x32bfdb)){if(_0x32bfdb[_0xefa5('0x29')](_0xefa5('0x2e'))){if(_0x32bfdb[_0xefa5('0x2e')]>0x0){_0x32bfdb[_0xefa5('0x2e')]-=0x1;}else{logger['error'](_0xefa5('0x2f'),_0x2e84eb);}}}else{logger['error'](_0xefa5('0x30'),_0x2e84eb);}};exports[_0xefa5('0x31')]=function(_0x45933b){var _0x509b5d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x45933b['state']=0xd;_0x45933b[_0xefa5('0x32')]=_0xefa5('0x33');_0x45933b['starttime']=_0x509b5d;_0x45933b[_0xefa5('0x34')]=_0x509b5d;_0x45933b['endtime']=_0x509b5d;};exports[_0xefa5('0x35')]=function(_0x252df7,_0x416e4a,_0x3dfc3b){var _0x36610a=moment()[_0xefa5('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x252df7[_0xefa5('0x36')]=_0x416e4a;_0x252df7[_0xefa5('0x32')]=_0x3dfc3b;_0x252df7[_0xefa5('0x34')]=_0x36610a;_0x252df7[_0xefa5('0x37')]=getSeconds(_0x252df7['responsetime'],_0x252df7[_0xefa5('0x38')]);};exports[_0xefa5('0x39')]=function(_0x325831,_0x433de0,_0x515694){_0x325831[_0xefa5('0x3a')]=_0x433de0;_0x325831[_0xefa5('0x3b')]=_0x515694;};exports[_0xefa5('0x3c')]=function(_0x4c3f47,_0x3e477c,_0x3fa1f7){var _0x2f3e1e=moment()[_0xefa5('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c3f47['state']=_0x3e477c;_0x4c3f47[_0xefa5('0x32')]=_0x3fa1f7;_0x4c3f47[_0xefa5('0x34')]=_0x4c3f47[_0xefa5('0x34')]?_0x4c3f47[_0xefa5('0x34')]:_0x2f3e1e;_0x4c3f47[_0xefa5('0x3d')]=_0x4c3f47[_0xefa5('0x3d')]?_0x4c3f47[_0xefa5('0x3d')]:_0x2f3e1e;_0x4c3f47['ringtime']=getSeconds(_0x4c3f47[_0xefa5('0x34')]||0x0,_0x4c3f47[_0xefa5('0x38')]||0x0);_0x4c3f47[_0xefa5('0x3e')]=_0x4c3f47[_0xefa5('0x3f')]?getSeconds(_0x4c3f47['endtime'],_0x4c3f47[_0xefa5('0x3f')]):0x0;};exports[_0xefa5('0x40')]=function(_0x3a2370){return _0x3a2370===_0xefa5('0x41');};exports['variablesAction']=function(_0x583164,_0x3a528b,_0x190e7e,_0x5ee060,_0x4cfc33){var _0x140d93=_0x5ee060?'RECALL':_0x583164[_0xefa5('0x18')];_0x140d93=_0x4cfc33?_0xefa5('0x42'):_0x140d93;return{'actionid':_0x583164[_0xefa5('0x43')],'action':'originate','channel':_0x583164['channelAgent'],'callerid':util[_0xefa5('0x12')](_0xefa5('0x11'),_0x140d93,_0x583164['calleridnum']),'Exten':_0xefa5('0x26'),'Context':'from-sip','Priority':'1','variable':_0x190e7e,'timeout':(_0x3a528b['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x583164[_0xefa5('0x43')]};};exports[_0xefa5('0x44')]=function(_0x49dc42){return _0x49dc42[_0xefa5('0x45')]+_0x49dc42['countcongestionretry']+_0x49dc42[_0xefa5('0x46')]+_0x49dc42['countagentrejectretry']+_0x49dc42[_0xefa5('0x47')];};exports[_0xefa5('0x48')]=function(_0x153509){var _0x30359e=_[_0xefa5('0x49')](_0x153509);_0x30359e['state']=0xf;_0x30359e[_0xefa5('0x32')]='Global';return _0x30359e;};exports[_0xefa5('0x4a')]=function(_0xf98e66,_0x3d6636,_0x3bf18c){var _0x38bfd5={};_0x38bfd5[_0x3d6636]=_0xf98e66[_0x3d6636];_0x38bfd5[_0xefa5('0x4b')]=![];_0x38bfd5[_0xefa5('0x4c')]=moment()['add'](_0x3bf18c,_0xefa5('0x4d'))['format'](_0xefa5('0x4e'));_0x38bfd5['ContactId']=_0xf98e66[_0xefa5('0x1a')];_0x38bfd5[_0xefa5('0x4f')]=_0xf98e66[_0xefa5('0x4f')];_0x38bfd5[_0xefa5('0x50')]=_0xf98e66[_0xefa5('0x50')]||undefined;return _0x38bfd5;};exports[_0xefa5('0x51')]=function(_0x3cec87,_0x46225f){if(!_[_0xefa5('0x14')](_0x3cec87)){if(_0x3cec87[_0xefa5('0x52')]>0x0){_0x3cec87[_0xefa5('0x52')]-=0x1;}else{logger[_0xefa5('0x9')](_0x46225f,_0xefa5('0x53'));}}else{logger[_0xefa5('0x9')](_0x46225f,_0xefa5('0x54'));}};exports[_0xefa5('0x55')]=function(_0x30cdb2){if(_0x30cdb2<=0x0){return!![];}return![];};exports[_0xefa5('0x56')]=function(_0x1b6758,_0xa4a27f,_0xa773f6){_0x1b6758[_0xefa5('0x57')]=_0xa4a27f;_0x1b6758[_0xefa5('0x17')]=_0x1b6758[_0xefa5('0x58')];_0x1b6758[_0xefa5('0x59')]=_0x1b6758[_0xefa5('0x5a')];_0x1b6758[_0xefa5('0x5b')]=_0xefa5('0x5c');if(_0xa773f6){_0x1b6758['mandatoryDisposition']=_0xa773f6[_0xefa5('0x5d')];}return _0x1b6758;};exports[_0xefa5('0x5e')]=function(_0x58a773){var _0x3d9f1b={};_0x3d9f1b[_0xefa5('0x58')]=_0x58a773[_0xefa5('0x58')];_0x3d9f1b[_0xefa5('0x59')]=_0x58a773['channelAgent'];_0x3d9f1b[_0xefa5('0x43')]=_0x58a773[_0xefa5('0x43')];return _0x3d9f1b;};exports[_0xefa5('0x5f')]=function(_0x32b6c8){var _0x3f99b3=[];for(var _0x5ef4f8 in _0x32b6c8){if(_0x32b6c8[_0xefa5('0x29')](_0x5ef4f8)){if(!_[_0xefa5('0x14')](_0x32b6c8[_0x5ef4f8])&&_0x32b6c8[_0x5ef4f8][_0xefa5('0x36')]==='not_inuse'&&_0x32b6c8[_0x5ef4f8][_0xefa5('0x60')]==='reachable'){_0x3f99b3[_0xefa5('0x61')](_0x32b6c8[_0x5ef4f8]['id']);}}}return _0x3f99b3;};exports[_0xefa5('0x62')]=function(_0x36ad66){var _0x1235ce=moment()[_0xefa5('0x6')](0x0);var _0x2018b6=moment(_0x36ad66)[_0xefa5('0x6')](0x0);return _0x1235ce[_0xefa5('0x63')](_0x2018b6,_0xefa5('0x7'));};exports[_0xefa5('0x64')]=function(_0x36aeb7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x36aeb7[_0xefa5('0x1a')],'ListId':_0x36aeb7[_0xefa5('0x4f')],'VoiceQueueId':_0x36aeb7[_0xefa5('0x50')]||undefined,'CampaignId':_0x36aeb7[_0xefa5('0x65')]||undefined};};exports[_0xefa5('0x66')]=function(_0x1be6d5){if(_0x1be6d5===_0xefa5('0x43')||_0x1be6d5==='idContact'||_0x1be6d5===_0xefa5('0x58')||_0x1be6d5===_0xefa5('0x67')||_0x1be6d5===_0xefa5('0x68')||_0x1be6d5===_0xefa5('0x69')||_0x1be6d5===_0xefa5('0x3a')||_0x1be6d5===_0xefa5('0x5a')||_0x1be6d5===_0xefa5('0x18')||_0x1be6d5===_0xefa5('0x4b')||_0x1be6d5===_0xefa5('0x19')||_0x1be6d5===_0xefa5('0x4c')||_0x1be6d5===_0xefa5('0x45')||_0x1be6d5==='countcongestionretry'||_0x1be6d5===_0xefa5('0x46')||_0x1be6d5===_0xefa5('0x6a')||_0x1be6d5===_0xefa5('0x6b')||_0x1be6d5==='callbackuniqueid'||_0x1be6d5===_0xefa5('0x6c')||_0x1be6d5===_0xefa5('0x6d')||_0x1be6d5===_0xefa5('0x1a')||_0x1be6d5==='ListId'||_0x1be6d5===_0xefa5('0x3b')||_0x1be6d5==='VoiceQueueId'||_0x1be6d5===_0xefa5('0x6e')||_0x1be6d5===_0xefa5('0x6f')||_0x1be6d5===_0xefa5('0x70')||_0x1be6d5==='xmd-phone'||_0x1be6d5==='xmd-listid'||_0x1be6d5==='xmd-dialurl'||_0x1be6d5==='xmd-dialtimeout'||_0x1be6d5==='xmd-dialoptions'||_0x1be6d5===_0xefa5('0x71')||_0x1be6d5===_0xefa5('0x72')||_0x1be6d5===_0xefa5('0x73')||_0x1be6d5==='xmd-cdrtype'||_0x1be6d5==='xmd-callerid'||_0x1be6d5===_0xefa5('0x74')||_0x1be6d5===_0xefa5('0x75')||_0x1be6d5===_0xefa5('0x76')||_0x1be6d5===_0xefa5('0x77')||_0x1be6d5===_0xefa5('0x78')||_0x1be6d5===_0xefa5('0x79')||_0x1be6d5===_0xefa5('0x7a')||_0x1be6d5===_0xefa5('0x7b')||_0x1be6d5==='rtpaudioqosrtt'||_0x1be6d5===_0xefa5('0x7c')||_0x1be6d5===_0xefa5('0x76')||_0x1be6d5===_0xefa5('0x77')||_0x1be6d5==='rtpaudioqosjitter'||_0x1be6d5===_0xefa5('0x79')||_0x1be6d5==='rtpaudioqosloss'||_0x1be6d5===_0xefa5('0x7b')||_0x1be6d5===_0xefa5('0x7d')||_0x1be6d5===_0xefa5('0x7c')||_0x1be6d5==='bridgepeer'||_0x1be6d5===_0xefa5('0x7e')||_0x1be6d5===_0xefa5('0x36')||_0x1be6d5===_0xefa5('0x32')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x21b96e,_0x224a38){var _0x1c1b1f,_0x43a8ef,_0x34dee4;if(_0x224a38<=0x0){_0x224a38=0x1;}_0x1c1b1f=new RegExp(_0xefa5('0x7f')+_0x224a38+'}$');_0x43a8ef=Math[_0xefa5('0x80')](0xa,_0x224a38-0x1);_0x34dee4=Math[_0xefa5('0x80')](0xa,_0x224a38)-0x1;return util[_0xefa5('0x12')]('%s',_[_0xefa5('0x81')](_0x21b96e,_0x1c1b1f,_['random'](_0x43a8ef,_0x34dee4)));};exports[_0xefa5('0x82')]=function(_0x47783a){var _0x26e2c3=_0x47783a[_0xefa5('0x83')](/"(.*?)"/);return _0x26e2c3?_0x26e2c3[0x1]:_0x47783a;};exports[_0xefa5('0x84')]=function(_0x5c30f1){var _0xc1f1fe=_0x5c30f1[_0xefa5('0x83')](/<(.*?)>/);return _0xc1f1fe?_0xc1f1fe[0x1]:_0x5c30f1;}; \ No newline at end of file +var _0x642e=['IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','not_inuse','status','reachable','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','calleridname','countbusyretry','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','inspect','logger','error','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x642e,0x14c));var _0xe642=function(_0x17846a,_0xae7151){_0x17846a=_0x17846a-0x0;var _0x2d3ec4=_0x642e[_0x17846a];return _0x2d3ec4;};'use strict';var util=require(_0xe642('0x0'));var _=require('lodash');var moment=require(_0xe642('0x1'));var logger=require(_0xe642('0x2'))(_0xe642('0x3'));var ipAgi=process['env'][_0xe642('0x4')]||_0xe642('0x5');function getSeconds(_0x28c7af,_0x17b03d){var _0x2aef47=moment(_0x28c7af)['milliseconds'](0x0);var _0x3a3a11=moment(_0x17b03d)['milliseconds'](0x0);return _0x2aef47[_0xe642('0x6')](_0x3a3a11,_0xe642('0x7'));}exports[_0xe642('0x8')]=function(_0x537451){return function(_0x4efed9){logger['error'](_0x537451,util[_0xe642('0x9')](_0x4efed9,{'showHidden':![],'depth':null}));};};exports[_0xe642('0xa')]=function(_0x32bb92,_0x53b313){logger['info'](_0x32bb92,util['inspect'](_0x53b313,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x16bd33,_0x447f15){logger[_0xe642('0xb')](_0x16bd33,util[_0xe642('0x9')](_0x447f15,{'showHidden':![],'depth':null}));};exports[_0xe642('0xc')]=function(_0x5ce726){return function(_0x483996){logger['info'](_0x5ce726,util[_0xe642('0x9')](_0x483996,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x395110,_0x7aaf3e,_0x33ad03){return{'message':_0x395110,'unlock':_0x7aaf3e,'active':_0x33ad03};};exports[_0xe642('0xd')]=function(_0x1d5b93,_0x156399,_0x2c6473){if(!_[_0xe642('0xe')](_0x2c6473)&&_0xe642('0xf')===typeof _0x2c6473&&!_[_0xe642('0x10')](_0x2c6473)){if(!_[_0xe642('0xe')](_0x156399)&&_0xe642('0xf')===typeof _0x156399&&!_[_0xe642('0x10')](_0x156399)){return util[_0xe642('0x11')](_0xe642('0x12'),_0x156399,_0x2c6473);}return util[_0xe642('0x11')](_0xe642('0x12'),_0x2c6473,_0x2c6473);}if(!_[_0xe642('0xe')](_0x1d5b93)&&_0xe642('0xf')===typeof _0x1d5b93&&!_['isEmpty'](_0x1d5b93)){return _0x1d5b93;}return _0xe642('0x13');};exports[_0xe642('0x14')]=function(_0x4e314a){if(_['isNil'](_0x4e314a)){return![];}return _0x4e314a;};exports[_0xe642('0x15')]=function(_0x11ba24,_0xd42d2c,_0x342f9c,_0x5140ab,_0x19e3c3,_0x1283d1){var _0x57c54f={'XMD-QUEUE':_0xd42d2c['Queue']?_0xd42d2c[_0xe642('0x16')][_0xe642('0x17')]:'','XMD-CALLERID':_0x5140ab,'XMD-CALLERID-PREVIEW':_0x1283d1?util[_0xe642('0x11')]('\x22%s\x22\x20<%s>',_0x1283d1['calleridname'],_0x1283d1[_0xe642('0x18')]):_0x5140ab,'XMD-DIALID':_0x19e3c3,'XMD-CONTACTID':_0xd42d2c[_0xe642('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5140ab,'XMD-VOICEQUEUEID':_0xd42d2c[_0xe642('0x1a')],'XMD-DIALCHANNEL':_0x342f9c,'XMD-DIALTIMEOUT':_0x11ba24['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xe642('0x11')](_0xe642('0x1b'),_0x11ba24[_0xe642('0x1c')]?'g':'',_['isEmpty'](_0x11ba24['monitor_format'])?'':_0xe642('0x1d')),'XMD-DIALURL':_0x11ba24[_0xe642('0x1e')]||'','XMD-AGI':_0x11ba24[_0xe642('0x1f')]?util[_0xe642('0x11')](_0xe642('0x20'),ipAgi,_0x11ba24['dialQueueProject']):_0xe642('0x21'),'XMD-AGIAFTER':_0x11ba24[_0xe642('0x1c')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x11ba24['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1283d1?_0x1283d1[_0xe642('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x1283d1?_0x1283d1['originatecalleridname']:'','XMD-DESTINATION':_0xe642('0x23')};if(!_[_0xe642('0x10')](_0x11ba24[_0xe642('0x24')])){_0x57c54f[util['format']('%s',_0xe642('0x25'))]=_0x11ba24[_0xe642('0x24')];_0x57c54f[util[_0xe642('0x11')]('%s',_0xe642('0x26'))]=_0x19e3c3;}if(_0xd42d2c&&_0xd42d2c[_0xe642('0x27')]){for(var _0x29518a in _0xd42d2c[_0xe642('0x27')]){if(_0xd42d2c[_0xe642('0x27')][_0xe642('0x28')](_0x29518a)){if(!_[_0xe642('0x29')](_0xd42d2c[_0xe642('0x27')][_0x29518a])&&_0x29518a!=='id'&&_0x29518a!=='tags'&&_0x29518a!==_0xe642('0x2a')&&_0x29518a!=='updatedAt'){_0x57c54f[util['format'](_0xe642('0x2b'),'XMD-',_[_0xe642('0x2c')](_0x29518a))]=_0xd42d2c['Contact'][_0x29518a];}}}}return _0x57c54f;};exports[_0xe642('0x2d')]=function(_0x4852f9){var _0x325003={};for(var _0x37110c in _0x4852f9){if(_0x4852f9['hasOwnProperty'](_0x37110c)){_0x325003[util[_0xe642('0x11')]('%s',_[_0xe642('0x2e')](_0x37110c))]=_0x4852f9[_0x37110c];}}return{'variables':_0x325003};};exports[_0xe642('0x2f')]=function(_0x5f4f0f,_0x587730){if(!_['isNil'](_0x5f4f0f)){if(_0x5f4f0f[_0xe642('0x28')]('originated')){if(_0x5f4f0f[_0xe642('0x30')]>0x0){_0x5f4f0f[_0xe642('0x30')]-=0x1;}else{logger[_0xe642('0xb')](_0xe642('0x31'),_0x587730);}}}else{logger[_0xe642('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x587730);}};exports[_0xe642('0x32')]=function(_0x3ad2c7){var _0xe9a537=moment()[_0xe642('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ad2c7[_0xe642('0x33')]=0xd;_0x3ad2c7[_0xe642('0x34')]=_0xe642('0x35');_0x3ad2c7['starttime']=_0xe9a537;_0x3ad2c7[_0xe642('0x36')]=_0xe9a537;_0x3ad2c7[_0xe642('0x37')]=_0xe9a537;};exports['logAgent']=function(_0x52a1a6,_0x5481d9,_0x150bdf){var _0x283f0e=moment()[_0xe642('0x11')](_0xe642('0x38'));_0x52a1a6[_0xe642('0x33')]=_0x5481d9;_0x52a1a6['statedesc']=_0x150bdf;_0x52a1a6['responsetime']=_0x283f0e;_0x52a1a6[_0xe642('0x39')]=getSeconds(_0x52a1a6[_0xe642('0x36')],_0x52a1a6[_0xe642('0x3a')]);};exports[_0xe642('0x3b')]=function(_0x487d9f,_0x4953e9,_0x2d66e4){_0x487d9f[_0xe642('0x3c')]=_0x4953e9;_0x487d9f[_0xe642('0x3d')]=_0x2d66e4;};exports[_0xe642('0x3e')]=function(_0x5e0ec6,_0x4f727d,_0x446a66){var _0x533361=moment()[_0xe642('0x11')](_0xe642('0x38'));_0x5e0ec6['state']=_0x4f727d;_0x5e0ec6[_0xe642('0x34')]=_0x446a66;_0x5e0ec6['responsetime']=_0x5e0ec6[_0xe642('0x36')]?_0x5e0ec6[_0xe642('0x36')]:_0x533361;_0x5e0ec6[_0xe642('0x37')]=_0x5e0ec6[_0xe642('0x37')]?_0x5e0ec6[_0xe642('0x37')]:_0x533361;_0x5e0ec6[_0xe642('0x39')]=getSeconds(_0x5e0ec6['responsetime']||0x0,_0x5e0ec6[_0xe642('0x3a')]||0x0);_0x5e0ec6[_0xe642('0x3f')]=_0x5e0ec6[_0xe642('0x40')]?getSeconds(_0x5e0ec6[_0xe642('0x37')],_0x5e0ec6[_0xe642('0x40')]):0x0;};exports[_0xe642('0x41')]=function(_0x2fdd75){return _0x2fdd75===_0xe642('0x42');};exports[_0xe642('0x43')]=function(_0x2dd0a6,_0x456f25,_0x243aee,_0x3d7f2a,_0x30b838){var _0x18a925=_0x3d7f2a?_0xe642('0x44'):_0x2dd0a6['calleridname'];_0x18a925=_0x30b838?'BOOKED':_0x18a925;return{'actionid':_0x2dd0a6[_0xe642('0x45')],'action':_0xe642('0x46'),'channel':_0x2dd0a6[_0xe642('0x47')],'callerid':util[_0xe642('0x11')]('\x22%s\x22\x20<%s>',_0x18a925,_0x2dd0a6[_0xe642('0x18')]),'Exten':_0xe642('0x23'),'Context':'from-sip','Priority':'1','variable':_0x243aee,'timeout':(_0x456f25[_0xe642('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2dd0a6[_0xe642('0x45')]};};exports[_0xe642('0x49')]=function(_0x24f4e8){return _0x24f4e8['countbusyretry']+_0x24f4e8['countcongestionretry']+_0x24f4e8[_0xe642('0x4a')]+_0x24f4e8[_0xe642('0x4b')]+_0x24f4e8[_0xe642('0x4c')];};exports['cloneAction']=function(_0x4b1f04){var _0x38acb2=_[_0xe642('0x4d')](_0x4b1f04);_0x38acb2['state']=0xf;_0x38acb2[_0xe642('0x34')]=_0xe642('0x4e');return _0x38acb2;};exports[_0xe642('0x4f')]=function(_0x24c03d,_0x5cbd85,_0x19557d){var _0x3e0ae8={};_0x3e0ae8[_0x5cbd85]=_0x24c03d[_0x5cbd85];_0x3e0ae8[_0xe642('0x50')]=![];_0x3e0ae8['scheduledat']=moment()[_0xe642('0x51')](_0x19557d,_0xe642('0x52'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3e0ae8[_0xe642('0x19')]=_0x24c03d[_0xe642('0x19')];_0x3e0ae8[_0xe642('0x53')]=_0x24c03d[_0xe642('0x53')];_0x3e0ae8[_0xe642('0x1a')]=_0x24c03d[_0xe642('0x1a')]||undefined;return _0x3e0ae8;};exports[_0xe642('0x54')]=function(_0x201916,_0xa62fb7){if(!_['isNil'](_0x201916)){if(_0x201916[_0xe642('0x55')]>0x0){_0x201916[_0xe642('0x55')]-=0x1;}else{logger[_0xe642('0xb')](_0xa62fb7,_0xe642('0x56'));}}else{logger['error'](_0xa62fb7,_0xe642('0x57'));}};exports[_0xe642('0x58')]=function(_0x495aea){if(_0x495aea<=0x0){return!![];}return![];};exports[_0xe642('0x59')]=function(_0x318adb,_0x54444b,_0x1ce437){_0x318adb[_0xe642('0x5a')]=_0x54444b;_0x318adb[_0xe642('0x17')]=_0x318adb[_0xe642('0x5b')];_0x318adb[_0xe642('0x5c')]=_0x318adb['channelAgent'];_0x318adb['motionChannel']=_0xe642('0x5d');if(_0x1ce437){_0x318adb['mandatoryDisposition']=_0x1ce437[_0xe642('0x5e')];}return _0x318adb;};exports[_0xe642('0x5f')]=function(_0x5b6f11){var _0x4b6837={};_0x4b6837[_0xe642('0x5b')]=_0x5b6f11['queue'];_0x4b6837['interface']=_0x5b6f11['channelAgent'];_0x4b6837[_0xe642('0x45')]=_0x5b6f11[_0xe642('0x45')];return _0x4b6837;};exports['agentReadyId']=function(_0xe050de){var _0x4d58d9=[];for(var _0x2fda28 in _0xe050de){if(_0xe050de[_0xe642('0x28')](_0x2fda28)){if(!_[_0xe642('0x29')](_0xe050de[_0x2fda28])&&_0xe050de[_0x2fda28][_0xe642('0x33')]===_0xe642('0x60')&&_0xe050de[_0x2fda28][_0xe642('0x61')]===_0xe642('0x62')){_0x4d58d9['push'](_0xe050de[_0x2fda28]['id']);}}}return _0x4d58d9;};exports[_0xe642('0x63')]=function(_0x349ecf){var _0x29f873=moment()[_0xe642('0x64')](0x0);var _0x5a2de0=moment(_0x349ecf)['milliseconds'](0x0);return _0x29f873['diff'](_0x5a2de0,_0xe642('0x7'));};exports[_0xe642('0x65')]=function(_0xd7fe55){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xd7fe55[_0xe642('0x19')],'ListId':_0xd7fe55[_0xe642('0x53')],'VoiceQueueId':_0xd7fe55[_0xe642('0x1a')]||undefined,'CampaignId':_0xd7fe55[_0xe642('0x66')]||undefined};};exports[_0xe642('0x67')]=function(_0x44d945){if(_0x44d945===_0xe642('0x45')||_0x44d945===_0xe642('0x68')||_0x44d945===_0xe642('0x5b')||_0x44d945===_0xe642('0x69')||_0x44d945===_0xe642('0x6a')||_0x44d945===_0xe642('0x6b')||_0x44d945===_0xe642('0x3c')||_0x44d945===_0xe642('0x47')||_0x44d945===_0xe642('0x6c')||_0x44d945==='active'||_0x44d945===_0xe642('0x18')||_0x44d945==='scheduledat'||_0x44d945===_0xe642('0x6d')||_0x44d945===_0xe642('0x6e')||_0x44d945==='countnoanswerretry'||_0x44d945===_0xe642('0x6f')||_0x44d945===_0xe642('0x70')||_0x44d945===_0xe642('0x71')||_0x44d945===_0xe642('0x72')||_0x44d945===_0xe642('0x73')||_0x44d945===_0xe642('0x19')||_0x44d945===_0xe642('0x53')||_0x44d945==='UserId'||_0x44d945===_0xe642('0x1a')||_0x44d945===_0xe642('0x74')||_0x44d945===_0xe642('0x75')||_0x44d945===_0xe642('0x76')||_0x44d945===_0xe642('0x77')||_0x44d945==='xmd-listid'||_0x44d945==='xmd-dialurl'||_0x44d945===_0xe642('0x78')||_0x44d945===_0xe642('0x79')||_0x44d945===_0xe642('0x7a')||_0x44d945==='xmd-dialchannel'||_0x44d945===_0xe642('0x7b')||_0x44d945==='xmd-cdrtype'||_0x44d945===_0xe642('0x7c')||_0x44d945===_0xe642('0x7d')||_0x44d945==='xmd-agi'||_0x44d945===_0xe642('0x7e')||_0x44d945===_0xe642('0x7f')||_0x44d945===_0xe642('0x80')||_0x44d945==='rtpaudioqosjitterbridged'||_0x44d945===_0xe642('0x81')||_0x44d945==='rtpaudioqoslossbridged'||_0x44d945==='rtpaudioqosrtt'||_0x44d945===_0xe642('0x82')||_0x44d945===_0xe642('0x7e')||_0x44d945==='rtpaudioqosbridged'||_0x44d945==='rtpaudioqosjitter'||_0x44d945===_0xe642('0x83')||_0x44d945==='rtpaudioqosloss'||_0x44d945==='rtpaudioqoslossbridged'||_0x44d945===_0xe642('0x84')||_0x44d945==='rtpaudioqosrttbridged'||_0x44d945==='bridgepeer'||_0x44d945===_0xe642('0x85')||_0x44d945===_0xe642('0x33')||_0x44d945==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4a3469,_0x137c4c){var _0x5e9ff2,_0x1b3f20,_0x581d73;if(_0x137c4c<=0x0){_0x137c4c=0x1;}_0x5e9ff2=new RegExp('\x5cw{0,'+_0x137c4c+'}$');_0x1b3f20=Math[_0xe642('0x86')](0xa,_0x137c4c-0x1);_0x581d73=Math[_0xe642('0x86')](0xa,_0x137c4c)-0x1;return util['format']('%s',_[_0xe642('0x87')](_0x4a3469,_0x5e9ff2,_[_0xe642('0x88')](_0x1b3f20,_0x581d73)));};exports[_0xe642('0x89')]=function(_0x338640){var _0x1a5563=_0x338640[_0xe642('0x8a')](/"(.*?)"/);return _0x1a5563?_0x1a5563[0x1]:_0x338640;};exports[_0xe642('0x8b')]=function(_0x557600){var _0x3b0700=_0x557600['match'](/<(.*?)>/);return _0x3b0700?_0x3b0700[0x1]:_0x557600;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index eae4659..14fadb1 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 _0xc60b=['queueadd','string','number','queueremove','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x578e74,_0x2a4239){var _0x33bc8e=function(_0x207fae){while(--_0x207fae){_0x578e74['push'](_0x578e74['shift']());}};_0x33bc8e(++_0x2a4239);}(_0xc60b,0x168));var _0xbc60=function(_0x35d109,_0x4a532d){_0x35d109=_0x35d109-0x0;var _0x5786af=_0xc60b[_0x35d109];return _0x5786af;};'use strict';exports[_0xbc60('0x0')]={'queue':{'type':_0xbc60('0x1'),'required':!![]},'interface':{'type':_0xbc60('0x1'),'required':!![]},'membername':{'type':_0xbc60('0x1'),'required':!![]},'penalty':{'type':_0xbc60('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbc60('0x3')]={'queue':{'type':_0xbc60('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xbc60('0x1'),'required':!![]},'paused':{'type':_0xbc60('0x4')},'reason':{'type':_0xbc60('0x1'),'required':![]}};exports[_0xbc60('0x5')]={'module':{'type':'string','required':![]}};exports[_0xbc60('0x6')]={'uniqueid':{'type':_0xbc60('0x1'),'required':!![]}};exports[_0xbc60('0x7')]={'uniqueid':{'type':_0xbc60('0x1'),'required':!![]},'filename':{'type':_0xbc60('0x1')},'format':{'type':_0xbc60('0x1')},'mixmonitorid':{'type':_0xbc60('0x1')}};exports[_0xbc60('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xbc60('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xbc60('0x1')}}; \ No newline at end of file +var _0xafcc=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x315610,_0x88b51e){var _0x3ebec0=function(_0x14ef8a){while(--_0x14ef8a){_0x315610['push'](_0x315610['shift']());}};_0x3ebec0(++_0x88b51e);}(_0xafcc,0xa1));var _0xcafc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafcc[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0xcafc('0x0')]={'queue':{'type':_0xcafc('0x1'),'required':!![]},'interface':{'type':_0xcafc('0x1'),'required':!![]},'membername':{'type':_0xcafc('0x1'),'required':!![]},'penalty':{'type':_0xcafc('0x2'),'required':![]},'paused':{'type':_0xcafc('0x3'),'required':![]}};exports[_0xcafc('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xcafc('0x1'),'required':!![]}};exports[_0xcafc('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xcafc('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xcafc('0x6')]={'uniqueid':{'type':_0xcafc('0x1'),'required':!![]}};exports[_0xcafc('0x7')]={'uniqueid':{'type':_0xcafc('0x1'),'required':!![]},'filename':{'type':_0xcafc('0x1')},'format':{'type':_0xcafc('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xcafc('0x8')]={'uniqueid':{'type':_0xcafc('0x1'),'required':!![]}};exports[_0xcafc('0x9')]={'uniqueid':{'type':_0xcafc('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xcafc('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8d58685..7893815 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 _0xbfd5=['initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','sumDuration','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','mapKeys','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','name','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts'];(function(_0x33c9b3,_0xf21430){var _0x22b5ca=function(_0x3a94c4){while(--_0x3a94c4){_0x33c9b3['push'](_0x33c9b3['shift']());}};_0x22b5ca(++_0xf21430);}(_0xbfd5,0xef));var _0x5bfd=function(_0x1ebc5e,_0x5b4678){_0x1ebc5e=_0x1ebc5e-0x0;var _0x397579=_0xbfd5[_0x1ebc5e];return _0x397579;};'use strict';var BPromise=require(_0x5bfd('0x0'));var util=require(_0x5bfd('0x1'));var _=require(_0x5bfd('0x2'));var moment=require(_0x5bfd('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x5bfd('0x4'));var Trunk=require(_0x5bfd('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5bfd('0x6'));var Template=require(_0x5bfd('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x5bfd('0x8'));var ZendeskAccount=require(_0x5bfd('0x9'));var SalesforceAccount=require(_0x5bfd('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x5bfd('0xb'));var ZohoAccount=require(_0x5bfd('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x5bfd('0xd'));var ServicenowAccount=require(_0x5bfd('0xe'));var Dynamics365Account=require(_0x5bfd('0xf'));var FreshsalesAccount=require(_0x5bfd('0x10'));var FaxAccount=require(_0x5bfd('0x11'));var Realtime=function(){this[_0x5bfd('0x12')]={};this[_0x5bfd('0x13')]={};this[_0x5bfd('0x14')]={};this[_0x5bfd('0x15')]={};this[_0x5bfd('0x16')]={};this[_0x5bfd('0x17')]={};this[_0x5bfd('0x18')]={};this[_0x5bfd('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5bfd('0x1a')]={};this[_0x5bfd('0x1b')]={};this['queueChannels']={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x5bfd('0x1c')]={};this[_0x5bfd('0x1d')]={};this['zohoAccounts']={};this[_0x5bfd('0x1e')]={};this[_0x5bfd('0x1f')]={};this[_0x5bfd('0x20')]={};this[_0x5bfd('0x21')]={};this[_0x5bfd('0x22')]={};this[_0x5bfd('0x23')]={};};function freeIsNotKey(_0x3805c7,_0x49fc78,_0x349aea){var _0x4e1d2c=_['mapKeys'](_0x3805c7,function(_0x69c5f3,_0x4757ae){return _0x69c5f3[_0x349aea];});for(var _0x5655e4 in _0x49fc78){if(_0x49fc78[_0x5bfd('0x24')](_0x5655e4)){if(!_0x4e1d2c[_0x5655e4]){delete _0x49fc78[_0x5655e4];}}}}function freeIsNotKeySip(_0x1f1f93,_0x20708a){var _0x24ade5=_['mapKeys'](_0x1f1f93,function(_0x17e3a0,_0x1ea2cf){return util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0x17e3a0['name']);});for(var _0x499a68 in _0x20708a){if(_0x20708a[_0x5bfd('0x24')](_0x499a68)){if(!_0x24ade5[_0x499a68]){delete _0x20708a[_0x499a68];}}}}function freeIsNotKeyAgent(_0x358890,_0x4134c8){var _0xa4249e=_[_0x5bfd('0x27')](_0x358890,function(_0x5e023a,_0x4240df){var _0x38c226=_['isNil'](_0x5e023a[_0x5bfd('0x28')])?util[_0x5bfd('0x25')]('SIP/%s',_0x5e023a['name']):_0x5e023a['interface'];return _0x38c226;});for(var _0x337e48 in _0x4134c8){if(_0x4134c8[_0x5bfd('0x24')](_0x337e48)){if(!_0xa4249e[_0x337e48]){delete _0x4134c8[_0x337e48];}}}}function clearVoiceCallReports(_0x12c783){_0x12c783[_0x5bfd('0x29')]=0x0;_0x12c783[_0x5bfd('0x2a')]=0x0;_0x12c783[_0x5bfd('0x2b')]=0x0;_0x12c783['sumDuration']=0x0;_0x12c783[_0x5bfd('0x2c')]=0x0;}function clearCampaigns(_0x2781ce){if(!_[_0x5bfd('0x2d')](_0x2781ce)){for(var _0x4a66a2 in _0x2781ce){if(_0x2781ce[_0x5bfd('0x24')](_0x4a66a2)){_0x2781ce[_0x4a66a2]['ivrTotalCallsDays']=0x0;_0x2781ce[_0x4a66a2][_0x5bfd('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x4bdf65){if(!_['isEmpty'](_0x4bdf65)){for(var _0x155ddf in _0x4bdf65){if(_0x4bdf65[_0x5bfd('0x24')](_0x155ddf)){_0x4bdf65[_0x155ddf][_0x5bfd('0x29')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x2a')]=0x0;_0x4bdf65[_0x155ddf]['unmanaged']=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x2f')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x2b')]=0x0;_0x4bdf65[_0x155ddf]['sumDuration']=0x0;_0x4bdf65[_0x155ddf]['sumBillable']=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x30')]=0x0;_0x4bdf65[_0x155ddf]['outboundNoAnswerCallsDay']=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x31')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x32')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x33')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x34')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x35')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x36')]=0x0;_0x4bdf65[_0x155ddf]['outboundBlacklistCallsDay']=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x37')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x38')]=0x0;_0x4bdf65[_0x155ddf]['outboundReCallsDay']=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x30')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x39')]=0x0;_0x4bdf65[_0x155ddf][_0x5bfd('0x3a')]=!![];}}}}Realtime['prototype'][_0x5bfd('0x3b')]=function(_0x4878d2,_0x1ecced){for(var _0x1d07c9 in _0x1ecced){if(_0x4878d2[_0x5bfd('0x24')](_0x1d07c9)){_0x4878d2[_0x1d07c9]=_0x1ecced[_0x1d07c9];}}};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x3d')]=function(){var _0x557972=this;return function(_0x184d15){if(_0x184d15){freeIsNotKeyAgent(_0x184d15,_0x557972['agents']);for(var _0x30fa73=0x0,_0x2456ed={},_0x52ba99={};_0x30fa73<_0x184d15[_0x5bfd('0x3e')];_0x30fa73+=0x1){_0x2456ed=_0x184d15[_0x30fa73];var _0xb287a6=_[_0x5bfd('0x3f')](_0x2456ed['interface'])?util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0x2456ed['name']):_0x2456ed[_0x5bfd('0x28')];if(_[_0x5bfd('0x40')](_0x557972[_0x5bfd('0x12')][_0xb287a6])){_0x557972[_0x5bfd('0x12')][_0xb287a6]=new Agent(_0x2456ed);}else{_0x557972[_0x5bfd('0x3b')](_0x557972[_0x5bfd('0x12')][_0xb287a6],_0x2456ed);}}}return _0x557972[_0x5bfd('0x12')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x41')]=function(){var _0x55627e=this;return function(_0x55cdd4){if(_0x55cdd4){freeIsNotKeySip(_0x55cdd4,_0x55627e[_0x5bfd('0x13')]);for(var _0x55ad53=0x0,_0x163461={},_0x4cfa89={};_0x55ad53<_0x55cdd4[_0x5bfd('0x3e')];_0x55ad53+=0x1){_0x163461=_0x55cdd4[_0x55ad53];if(_[_0x5bfd('0x40')](_0x55627e[_0x5bfd('0x13')][util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0x163461[_0x5bfd('0x42')])])){_0x55627e[_0x5bfd('0x13')][util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0x163461[_0x5bfd('0x42')])]=new Telephone(_0x163461);}else{_0x55627e[_0x5bfd('0x3b')](_0x55627e['telephones'][util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0x163461['name'])],_0x163461);}}}return _0x55627e[_0x5bfd('0x13')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x43')]=function(){var _0x3eb78b=this;return function(_0x12ca2b){if(_0x12ca2b){freeIsNotKeySip(_0x12ca2b,_0x3eb78b['trunks']);for(var _0x209aa9=0x0,_0xf2b657={},_0x1b3b6b={};_0x209aa9<_0x12ca2b[_0x5bfd('0x3e')];_0x209aa9+=0x1){_0xf2b657=_0x12ca2b[_0x209aa9];if(_[_0x5bfd('0x40')](_0x3eb78b['trunks'][util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0xf2b657[_0x5bfd('0x42')])])){_0x3eb78b['trunks'][util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0xf2b657[_0x5bfd('0x42')])]=new Trunk(_0xf2b657);}else{_0x3eb78b[_0x5bfd('0x3b')](_0x3eb78b[_0x5bfd('0x14')][util[_0x5bfd('0x25')](_0x5bfd('0x26'),_0xf2b657[_0x5bfd('0x42')])],_0xf2b657);}}}return _0x3eb78b['trunks'];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x44')]=function(){var _0x4ef7da=this;return function(_0x1183ca){if(_0x1183ca){freeIsNotKey(_0x1183ca,_0x4ef7da[_0x5bfd('0x15')],_0x5bfd('0x42'));for(var _0x22cdf6=0x0,_0x753579={},_0x332ae4={};_0x22cdf6<_0x1183ca[_0x5bfd('0x3e')];_0x22cdf6+=0x1){_0x753579=_0x1183ca[_0x22cdf6];if(_[_0x5bfd('0x40')](_0x4ef7da['voiceQueues'][_0x753579[_0x5bfd('0x42')]])){_0x4ef7da[_0x5bfd('0x15')][_0x753579[_0x5bfd('0x42')]]=new VoiceQueue(_0x753579);}else{_0x4ef7da['mergeFromDatabase'](_0x4ef7da[_0x5bfd('0x15')][_0x753579['name']],_0x753579);}}}return _0x4ef7da['voiceQueues'];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x45')]=function(){var _0x3b0a45=this;return function(_0x5c5c88){if(_0x5c5c88){freeIsNotKey(_0x5c5c88,_0x3b0a45[_0x5bfd('0x16')],'id');for(var _0x170707=0x0,_0xdef965={},_0x36ef42={};_0x170707<_0x5c5c88[_0x5bfd('0x3e')];_0x170707+=0x1){_0xdef965=_0x5c5c88[_0x170707];if(_[_0x5bfd('0x40')](_0x3b0a45[_0x5bfd('0x16')][_0xdef965['id']])){_0x3b0a45[_0x5bfd('0x16')][_0xdef965['id']]=new Trigger(_0xdef965);}else{_0x3b0a45[_0x5bfd('0x3b')](_0x3b0a45[_0x5bfd('0x16')][_0xdef965['id']],_0xdef965);}}}return _0x3b0a45[_0x5bfd('0x16')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x46')]=function(){var _0x3db775=this;return function(_0x5e9da5){if(_0x5e9da5){freeIsNotKey(_0x5e9da5,_0x3db775['templates'],'id');for(var _0x943f74=0x0,_0x36636b={},_0x56f393={};_0x943f74<_0x5e9da5['length'];_0x943f74+=0x1){_0x36636b=_0x5e9da5[_0x943f74];if(_[_0x5bfd('0x40')](_0x3db775['templates'][_0x36636b['id']])){_0x3db775[_0x5bfd('0x18')][_0x36636b['id']]=new Template(_0x36636b);}else{_0x3db775[_0x5bfd('0x3b')](_0x3db775[_0x5bfd('0x18')][_0x36636b['id']],_0x36636b);}}}return _0x3db775[_0x5bfd('0x18')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x47')]=function(){var _0x255fc0=this;return function(_0x3e1315){if(_0x3e1315){freeIsNotKey(_0x3e1315,_0x255fc0[_0x5bfd('0x48')],'id');for(var _0x40794b=0x0,_0x23459e={},_0x569dae={};_0x40794b<_0x3e1315['length'];_0x40794b+=0x1){_0x23459e=_0x3e1315[_0x40794b];if(_[_0x5bfd('0x40')](_0x255fc0[_0x5bfd('0x48')][_0x23459e['id']])){_0x255fc0[_0x5bfd('0x48')][_0x23459e['id']]=new ZendeskAccount(_0x23459e);}else{_0x255fc0[_0x5bfd('0x3b')](_0x255fc0[_0x5bfd('0x48')][_0x23459e['id']],_0x23459e);}}}return _0x255fc0[_0x5bfd('0x48')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x49')]=function(){var _0x147f1f=this;return function(_0x733c45){if(_0x733c45){freeIsNotKey(_0x733c45,_0x147f1f[_0x5bfd('0x4a')],'id');for(var _0x575d79=0x0,_0x2c69cc={},_0x2a05f0={};_0x575d79<_0x733c45[_0x5bfd('0x3e')];_0x575d79+=0x1){_0x2c69cc=_0x733c45[_0x575d79];if(_[_0x5bfd('0x40')](_0x147f1f[_0x5bfd('0x4a')][_0x2c69cc['id']])){_0x147f1f[_0x5bfd('0x4a')][_0x2c69cc['id']]=new SalesforceAccount(_0x2c69cc);}else{_0x147f1f[_0x5bfd('0x3b')](_0x147f1f[_0x5bfd('0x4a')][_0x2c69cc['id']],_0x2c69cc);}}}return _0x147f1f[_0x5bfd('0x4a')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x4b')]=function(){var _0x2f82ee=this;return function(_0x539bdd){if(_0x539bdd){freeIsNotKey(_0x539bdd,_0x2f82ee[_0x5bfd('0x1d')],'id');for(var _0x3f2071=0x0,_0x55d2c7={},_0x4666f7={};_0x3f2071<_0x539bdd['length'];_0x3f2071+=0x1){_0x55d2c7=_0x539bdd[_0x3f2071];if(_[_0x5bfd('0x40')](_0x2f82ee[_0x5bfd('0x1d')][_0x55d2c7['id']])){_0x2f82ee[_0x5bfd('0x1d')][_0x55d2c7['id']]=new FreshdeskAccount(_0x55d2c7);}else{_0x2f82ee[_0x5bfd('0x3b')](_0x2f82ee['freshdeskAccounts'][_0x55d2c7['id']],_0x55d2c7);}}}return _0x2f82ee[_0x5bfd('0x1d')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x4c')]=function(){var _0x540efd=this;return function(_0x41847a){if(_0x41847a){freeIsNotKey(_0x41847a,_0x540efd[_0x5bfd('0x4d')],'id');for(var _0x38890e=0x0,_0x24b52a={},_0x5b3cbb={};_0x38890e<_0x41847a['length'];_0x38890e+=0x1){_0x24b52a=_0x41847a[_0x38890e];if(_['isUndefined'](_0x540efd[_0x5bfd('0x4d')][_0x24b52a['id']])){_0x540efd[_0x5bfd('0x4d')][_0x24b52a['id']]=new ZohoAccount(_0x24b52a);}else{_0x540efd[_0x5bfd('0x3b')](_0x540efd['zohoAccounts'][_0x24b52a['id']],_0x24b52a);}}}return _0x540efd[_0x5bfd('0x4d')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x4e')]=function(){var _0x4b0967=this;return function(_0x2384bd){if(_0x2384bd){freeIsNotKey(_0x2384bd,_0x4b0967[_0x5bfd('0x1e')],'id');for(var _0x2be9b3=0x0,_0x387c3c={},_0x1bbf45={};_0x2be9b3<_0x2384bd[_0x5bfd('0x3e')];_0x2be9b3+=0x1){_0x387c3c=_0x2384bd[_0x2be9b3];if(_[_0x5bfd('0x40')](_0x4b0967['deskAccounts'][_0x387c3c['id']])){_0x4b0967[_0x5bfd('0x1e')][_0x387c3c['id']]=new DeskAccount(_0x387c3c);}else{_0x4b0967['mergeFromDatabase'](_0x4b0967['deskAccounts'][_0x387c3c['id']],_0x387c3c);}}}return _0x4b0967[_0x5bfd('0x1e')];};};Realtime[_0x5bfd('0x3c')]['initSugarcrmAccounts']=function(){var _0x4de335=this;return function(_0x3d65d2){if(_0x3d65d2){freeIsNotKey(_0x3d65d2,_0x4de335[_0x5bfd('0x1c')],'id');for(var _0x2e0412=0x0,_0x40cd81={},_0x576eb8={};_0x2e0412<_0x3d65d2[_0x5bfd('0x3e')];_0x2e0412+=0x1){_0x40cd81=_0x3d65d2[_0x2e0412];if(_[_0x5bfd('0x40')](_0x4de335['sugarcrmAccounts'][_0x40cd81['id']])){_0x4de335[_0x5bfd('0x1c')][_0x40cd81['id']]=new SugarcrmAccount(_0x40cd81);}else{_0x4de335['mergeFromDatabase'](_0x4de335[_0x5bfd('0x1c')][_0x40cd81['id']],_0x40cd81);}}}return _0x4de335[_0x5bfd('0x1c')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x4f')]=function(){var _0x6da047=this;return function(_0xc35fbc){if(_0xc35fbc){freeIsNotKey(_0xc35fbc,_0x6da047[_0x5bfd('0x1f')],'id');for(var _0x152d79=0x0,_0x4aa39d={},_0x3eb241={};_0x152d79<_0xc35fbc[_0x5bfd('0x3e')];_0x152d79+=0x1){_0x4aa39d=_0xc35fbc[_0x152d79];if(_['isUndefined'](_0x6da047[_0x5bfd('0x1f')][_0x4aa39d['id']])){_0x6da047['vtigerAccounts'][_0x4aa39d['id']]=new VtigerAccount(_0x4aa39d);}else{_0x6da047['mergeFromDatabase'](_0x6da047[_0x5bfd('0x1f')][_0x4aa39d['id']],_0x4aa39d);}}}return _0x6da047['vtigerAccounts'];};};Realtime['prototype'][_0x5bfd('0x50')]=function(){var _0x486855=this;return function(_0x8973e4){if(_0x8973e4){freeIsNotKey(_0x8973e4,_0x486855[_0x5bfd('0x20')],'id');for(var _0x13265b=0x0,_0x35ecf0={},_0x17f8cc={};_0x13265b<_0x8973e4[_0x5bfd('0x3e')];_0x13265b+=0x1){_0x35ecf0=_0x8973e4[_0x13265b];if(_['isUndefined'](_0x486855[_0x5bfd('0x20')][_0x35ecf0['id']])){_0x486855[_0x5bfd('0x20')][_0x35ecf0['id']]=new ServicenowAccount(_0x35ecf0);}else{_0x486855[_0x5bfd('0x3b')](_0x486855['servicenowAccounts'][_0x35ecf0['id']],_0x35ecf0);}}}return _0x486855[_0x5bfd('0x20')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x46ba56=this;return function(_0x534c06){if(_0x534c06){freeIsNotKey(_0x534c06,_0x46ba56[_0x5bfd('0x21')],'id');for(var _0x2106a5=0x0,_0x2432dc={},_0x74df1e={};_0x2106a5<_0x534c06[_0x5bfd('0x3e')];_0x2106a5+=0x1){_0x2432dc=_0x534c06[_0x2106a5];if(_[_0x5bfd('0x40')](_0x46ba56['dynamics365Accounts'][_0x2432dc['id']])){_0x46ba56[_0x5bfd('0x21')][_0x2432dc['id']]=new Dynamics365Account(_0x2432dc);}else{_0x46ba56[_0x5bfd('0x3b')](_0x46ba56[_0x5bfd('0x21')][_0x2432dc['id']],_0x2432dc);}}}return _0x46ba56['dynamics365Accounts'];};};Realtime['prototype'][_0x5bfd('0x51')]=function(){var _0x3f9790=this;return function(_0x478701){if(_0x478701){freeIsNotKey(_0x478701,_0x3f9790[_0x5bfd('0x22')],'id');for(var _0x321296=0x0,_0x41b7d5={},_0x34e28a={};_0x321296<_0x478701[_0x5bfd('0x3e')];_0x321296+=0x1){_0x41b7d5=_0x478701[_0x321296];if(_[_0x5bfd('0x40')](_0x3f9790[_0x5bfd('0x22')][_0x41b7d5['id']])){_0x3f9790['freshsalesAccounts'][_0x41b7d5['id']]=new FreshsalesAccount(_0x41b7d5);}else{_0x3f9790[_0x5bfd('0x3b')](_0x3f9790['freshsalesAccounts'][_0x41b7d5['id']],_0x41b7d5);}}}return _0x3f9790[_0x5bfd('0x22')];};};Realtime['prototype'][_0x5bfd('0x52')]=function(){var _0x281d2d=this;return function(_0x1a0489){for(var _0x3e09db=0x0;_0x3e09db<_0x1a0489[_0x5bfd('0x3e')];_0x3e09db+=0x1){_['merge'](_0x281d2d[_0x5bfd('0x15')][_0x1a0489[_0x3e09db][_0x5bfd('0x42')]],_0x1a0489[_0x3e09db]);}return _0x281d2d[_0x5bfd('0x15')];};};Realtime['prototype'][_0x5bfd('0x53')]=function(){var _0x203d69=this;return function(_0x1bed92){clearVoiceQueues(_0x203d69[_0x5bfd('0x15')]);if(_0x1bed92){_0x1bed92=_['groupBy'](_0x1bed92,_0x5bfd('0x54'));for(var _0x1e57bf in _0x1bed92){if(_0x1bed92[_0x5bfd('0x24')](_0x1e57bf)){var _0x36650b={};for(var _0x5b10f2=0x0;_0x5b10f2<_0x1bed92[_0x1e57bf][_0x5bfd('0x3e')];_0x5b10f2+=0x1){var _0x5cb5b4=_0x1bed92[_0x1e57bf][_0x5b10f2]['queue'];if(_0x203d69[_0x5bfd('0x15')][_0x5cb5b4]){if(_0x1bed92[_0x1e57bf][_0x5b10f2]['queuecallerexit']){_0x203d69[_0x5bfd('0x15')][_0x5cb5b4][_0x5bfd('0x55')]+=0x1;}if(_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x56')]){_0x203d69[_0x5bfd('0x15')][_0x5cb5b4][_0x5bfd('0x2f')]+=0x1;}_0x203d69[_0x5bfd('0x15')][_0x5cb5b4]['sumHoldTime']+=moment(_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x57')])[_0x5bfd('0x58')](moment(_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x59')]),_0x5bfd('0x5a'))||0x0;if(_0x5b10f2===_0x1bed92[_0x1e57bf][_0x5bfd('0x3e')]-0x1){_0x203d69['voiceQueues'][_0x5cb5b4][_0x5bfd('0x5b')]+=moment(_0x1bed92[_0x1e57bf][_0x5b10f2]['queuecallercompleteAt']||_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x5c')]||_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x5d')])[_0x5bfd('0x58')](moment(_0x1bed92[_0x1e57bf][_0x5b10f2]['queuecallerjoinAt']),_0x5bfd('0x5a'))||0x0;_0x203d69['voiceQueues'][_0x5cb5b4][_0x5bfd('0x29')]+=0x1;if(_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x5e')]){_0x203d69[_0x5bfd('0x15')][_0x5cb5b4][_0x5bfd('0x2a')]+=0x1;_0x203d69[_0x5bfd('0x15')][_0x5cb5b4][_0x5bfd('0x2c')]+=moment(_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x5f')])[_0x5bfd('0x58')](moment(_0x1bed92[_0x1e57bf][_0x5b10f2][_0x5bfd('0x57')]),_0x5bfd('0x5a'))||0x0;}}else{_0x203d69['voiceQueues'][_0x5cb5b4][_0x5bfd('0x5b')]+=_0x203d69[_0x5bfd('0x15')][_0x5cb5b4][_0x5bfd('0x2b')]||0x0;}}}}}}return _0x203d69[_0x5bfd('0x15')];};};Realtime[_0x5bfd('0x3c')]['initVoiceCallReports']=function(){var _0x8b2acc=this;return function(_0x1d43ae){clearVoiceCallReports(_0x8b2acc['outbound']);if(_0x1d43ae){for(var _0x4b99a5=0x0;_0x4b99a5<_0x1d43ae[_0x5bfd('0x3e')];_0x4b99a5+=0x1){_0x8b2acc[_0x5bfd('0x19')]['total']+=0x1;_0x8b2acc[_0x5bfd('0x19')][_0x5bfd('0x5b')]+=_0x1d43ae[_0x4b99a5][_0x5bfd('0x60')];if(_0x1d43ae[_0x4b99a5]['disposition']==='ANSWERED'){_0x8b2acc['outbound'][_0x5bfd('0x2a')]+=0x1;_0x8b2acc[_0x5bfd('0x19')][_0x5bfd('0x2b')]+=_0x1d43ae[_0x4b99a5][_0x5bfd('0x60')]-_0x1d43ae[_0x4b99a5][_0x5bfd('0x61')]||0x0;_0x8b2acc[_0x5bfd('0x19')][_0x5bfd('0x2c')]+=_0x1d43ae[_0x4b99a5]['billableseconds'];}}}return _0x8b2acc[_0x5bfd('0x19')];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x62')]=function(){var _0x5a51c8=this;return function(_0x39851c){if(_0x39851c){freeIsNotKey(_0x39851c,_0x5a51c8[_0x5bfd('0x17')],_0x5bfd('0x42'));for(var _0x3fea85=0x0,_0x2dd953={};_0x3fea85<_0x39851c[_0x5bfd('0x3e')];_0x3fea85+=0x1){_0x2dd953=_0x39851c[_0x3fea85];if(_['isUndefined'](_0x5a51c8['campaigns'][_0x2dd953[_0x5bfd('0x42')]])){_0x5a51c8[_0x5bfd('0x17')][_0x2dd953[_0x5bfd('0x42')]]=new Campaign(_0x2dd953);}else{_0x5a51c8[_0x5bfd('0x3b')](_0x5a51c8[_0x5bfd('0x17')][_0x2dd953[_0x5bfd('0x42')]],_0x2dd953);_0x5a51c8[_0x5bfd('0x17')][_0x2dd953[_0x5bfd('0x42')]][_0x5bfd('0x63')]=_0x2dd953[_0x5bfd('0x64')]?_0x2dd953['SquareProject'][_0x5bfd('0x42')]:undefined;}}}return _0x5a51c8[_0x5bfd('0x17')];};};Realtime['prototype'][_0x5bfd('0x65')]=function(){var _0x4e4986=this;return function(_0x551f7d){if(_0x551f7d){freeIsNotKey(_0x551f7d,_0x4e4986[_0x5bfd('0x1a')],'id');for(var _0x4c0bd1=0x0,_0x426f55={};_0x4c0bd1<_0x551f7d[_0x5bfd('0x3e')];_0x4c0bd1+=0x1){_0x426f55=_0x551f7d[_0x4c0bd1];if(_[_0x5bfd('0x40')](_0x4e4986['voiceExtensions'][_0x426f55['id']])){_0x4e4986[_0x5bfd('0x1a')][_0x426f55['id']]=new VoiceExtension(_0x426f55);}else{_0x4e4986[_0x5bfd('0x3b')](_0x4e4986['voiceExtensions'][_0x426f55['id']],_0x426f55);}}}return _0x4e4986[_0x5bfd('0x1a')];};};Realtime['prototype'][_0x5bfd('0x66')]=function(){var _0x24bf34=this;return function(_0x1dbe74){clearCampaigns(_0x24bf34[_0x5bfd('0x17')]);for(var _0x458027=0x0;_0x458027<_0x1dbe74['length'];_0x458027+=0x1){_[_0x5bfd('0x67')](_0x24bf34[_0x5bfd('0x17')][_0x1dbe74[_0x458027]['name']],_0x1dbe74[_0x458027]);}return _0x24bf34['campaigns'];};};Realtime[_0x5bfd('0x3c')][_0x5bfd('0x68')]=function(){var _0x408764=this;return function(_0x335843){if(_0x335843){freeIsNotKey(_0x335843,_0x408764[_0x5bfd('0x23')],'id');for(var _0x59e7f0=0x0,_0x229a0f={},_0x34aeb2={};_0x59e7f0<_0x335843[_0x5bfd('0x3e')];_0x59e7f0+=0x1){_0x229a0f=_0x335843[_0x59e7f0];if(_[_0x5bfd('0x40')](_0x408764[_0x5bfd('0x23')][_0x229a0f['id']])){_0x408764['faxAccounts'][_0x229a0f['id']]=new FaxAccount(_0x229a0f);}else{_0x408764[_0x5bfd('0x3b')](_0x408764['faxAccounts'][_0x229a0f['id']],_0x229a0f);}}}return _0x408764['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xca87=['voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','mergeFromDatabase','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initVoiceQueueReports','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','merge','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates'];(function(_0x29f1bb,_0x10ca68){var _0x15c0e5=function(_0x570613){while(--_0x570613){_0x29f1bb['push'](_0x29f1bb['shift']());}};_0x15c0e5(++_0x10ca68);}(_0xca87,0x193));var _0x7ca8=function(_0x2de123,_0xc380d0){_0x2de123=_0x2de123-0x0;var _0x2256d3=_0xca87[_0x2de123];return _0x2256d3;};'use strict';var BPromise=require(_0x7ca8('0x0'));var util=require(_0x7ca8('0x1'));var _=require(_0x7ca8('0x2'));var moment=require(_0x7ca8('0x3'));var Agent=require(_0x7ca8('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0x7ca8('0x5'));var VoiceQueue=require(_0x7ca8('0x6'));var Trigger=require(_0x7ca8('0x7'));var Template=require('../model/template');var Campaign=require(_0x7ca8('0x8'));var VoiceExtension=require(_0x7ca8('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x7ca8('0xa'));var FreshdeskAccount=require(_0x7ca8('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x7ca8('0xc'));var DeskAccount=require(_0x7ca8('0xd'));var VtigerAccount=require(_0x7ca8('0xe'));var ServicenowAccount=require(_0x7ca8('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x7ca8('0x10'));var FaxAccount=require(_0x7ca8('0x11'));var Realtime=function(){this[_0x7ca8('0x12')]={};this[_0x7ca8('0x13')]={};this[_0x7ca8('0x14')]={};this[_0x7ca8('0x15')]={};this[_0x7ca8('0x16')]={};this[_0x7ca8('0x17')]={};this[_0x7ca8('0x18')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7ca8('0x19')]={};this[_0x7ca8('0x1a')]={};this[_0x7ca8('0x1b')]={};this[_0x7ca8('0x1c')]={};this[_0x7ca8('0x1d')]={};this[_0x7ca8('0x1e')]={};this[_0x7ca8('0x1f')]={};this[_0x7ca8('0x20')]={};this['sugarcrmAccounts']={};this[_0x7ca8('0x21')]={};this[_0x7ca8('0x22')]={};this[_0x7ca8('0x23')]={};this['vtigerAccounts']={};this[_0x7ca8('0x24')]={};this[_0x7ca8('0x25')]={};this[_0x7ca8('0x26')]={};this[_0x7ca8('0x27')]={};};function freeIsNotKey(_0x507cb1,_0x3a899e,_0x5523d0){var _0x2145ef=_[_0x7ca8('0x28')](_0x507cb1,function(_0x2ecaf6,_0x1767cc){return _0x2ecaf6[_0x5523d0];});for(var _0x50feb4 in _0x3a899e){if(_0x3a899e[_0x7ca8('0x29')](_0x50feb4)){if(!_0x2145ef[_0x50feb4]){delete _0x3a899e[_0x50feb4];}}}}function freeIsNotKeySip(_0x2f5d1b,_0x755b56){var _0x54cb24=_['mapKeys'](_0x2f5d1b,function(_0x55bfca,_0x326880){return util[_0x7ca8('0x2a')](_0x7ca8('0x2b'),_0x55bfca[_0x7ca8('0x2c')]);});for(var _0x1d77b6 in _0x755b56){if(_0x755b56[_0x7ca8('0x29')](_0x1d77b6)){if(!_0x54cb24[_0x1d77b6]){delete _0x755b56[_0x1d77b6];}}}}function freeIsNotKeyAgent(_0x2ad85e,_0x32e8f2){var _0x41c5a5=_[_0x7ca8('0x28')](_0x2ad85e,function(_0x16ad44,_0x3ef2eb){var _0x20ab62=_['isNil'](_0x16ad44['interface'])?util[_0x7ca8('0x2a')](_0x7ca8('0x2b'),_0x16ad44[_0x7ca8('0x2c')]):_0x16ad44['interface'];return _0x20ab62;});for(var _0x345e86 in _0x32e8f2){if(_0x32e8f2[_0x7ca8('0x29')](_0x345e86)){if(!_0x41c5a5[_0x345e86]){delete _0x32e8f2[_0x345e86];}}}}function clearVoiceCallReports(_0x3c2745){_0x3c2745[_0x7ca8('0x2d')]=0x0;_0x3c2745[_0x7ca8('0x2e')]=0x0;_0x3c2745['sumHoldTime']=0x0;_0x3c2745[_0x7ca8('0x2f')]=0x0;_0x3c2745[_0x7ca8('0x30')]=0x0;}function clearCampaigns(_0x268821){if(!_[_0x7ca8('0x31')](_0x268821)){for(var _0x29f080 in _0x268821){if(_0x268821[_0x7ca8('0x29')](_0x29f080)){_0x268821[_0x29f080][_0x7ca8('0x32')]=0x0;_0x268821[_0x29f080][_0x7ca8('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2ceeee){if(!_[_0x7ca8('0x31')](_0x2ceeee)){for(var _0x575ec9 in _0x2ceeee){if(_0x2ceeee[_0x7ca8('0x29')](_0x575ec9)){_0x2ceeee[_0x575ec9][_0x7ca8('0x2d')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x2e')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x34')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x35')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x36')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x2f')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x30')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x37')]=0x0;_0x2ceeee[_0x575ec9]['outboundNoAnswerCallsDay']=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x38')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x39')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x3a')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x3b')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x3c')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x3d')]=0x0;_0x2ceeee[_0x575ec9]['outboundBlacklistCallsDay']=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x3e')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x3f')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x40')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x37')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x41')]=0x0;_0x2ceeee[_0x575ec9][_0x7ca8('0x42')]=!![];}}}}Realtime[_0x7ca8('0x43')]['mergeFromDatabase']=function(_0x112395,_0x592bd2){for(var _0x421ff8 in _0x592bd2){if(_0x112395[_0x7ca8('0x29')](_0x421ff8)){_0x112395[_0x421ff8]=_0x592bd2[_0x421ff8];}}};Realtime[_0x7ca8('0x43')]['initAgents']=function(){var _0x2aec1a=this;return function(_0x24107c){if(_0x24107c){freeIsNotKeyAgent(_0x24107c,_0x2aec1a[_0x7ca8('0x12')]);for(var _0x4fbd90=0x0,_0xcd5d8c={},_0x4511ef={};_0x4fbd90<_0x24107c[_0x7ca8('0x44')];_0x4fbd90+=0x1){_0xcd5d8c=_0x24107c[_0x4fbd90];var _0x414843=_[_0x7ca8('0x45')](_0xcd5d8c['interface'])?util[_0x7ca8('0x2a')](_0x7ca8('0x2b'),_0xcd5d8c[_0x7ca8('0x2c')]):_0xcd5d8c['interface'];if(_[_0x7ca8('0x46')](_0x2aec1a['agents'][_0x414843])){_0x2aec1a[_0x7ca8('0x12')][_0x414843]=new Agent(_0xcd5d8c);}else{_0x2aec1a[_0x7ca8('0x47')](_0x2aec1a[_0x7ca8('0x12')][_0x414843],_0xcd5d8c);}}}return _0x2aec1a[_0x7ca8('0x12')];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x48')]=function(){var _0x2590cf=this;return function(_0x28a0dc){if(_0x28a0dc){freeIsNotKeySip(_0x28a0dc,_0x2590cf['telephones']);for(var _0x1214ee=0x0,_0x43fe7f={},_0x42fef5={};_0x1214ee<_0x28a0dc['length'];_0x1214ee+=0x1){_0x43fe7f=_0x28a0dc[_0x1214ee];if(_[_0x7ca8('0x46')](_0x2590cf[_0x7ca8('0x13')][util[_0x7ca8('0x2a')](_0x7ca8('0x2b'),_0x43fe7f[_0x7ca8('0x2c')])])){_0x2590cf[_0x7ca8('0x13')][util[_0x7ca8('0x2a')](_0x7ca8('0x2b'),_0x43fe7f[_0x7ca8('0x2c')])]=new Telephone(_0x43fe7f);}else{_0x2590cf[_0x7ca8('0x47')](_0x2590cf['telephones'][util[_0x7ca8('0x2a')]('SIP/%s',_0x43fe7f[_0x7ca8('0x2c')])],_0x43fe7f);}}}return _0x2590cf['telephones'];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x49')]=function(){var _0x503d14=this;return function(_0x1f96b4){if(_0x1f96b4){freeIsNotKeySip(_0x1f96b4,_0x503d14[_0x7ca8('0x14')]);for(var _0x4e3265=0x0,_0x309b68={},_0x111e9c={};_0x4e3265<_0x1f96b4[_0x7ca8('0x44')];_0x4e3265+=0x1){_0x309b68=_0x1f96b4[_0x4e3265];if(_[_0x7ca8('0x46')](_0x503d14[_0x7ca8('0x14')][util['format'](_0x7ca8('0x2b'),_0x309b68[_0x7ca8('0x2c')])])){_0x503d14[_0x7ca8('0x14')][util['format']('SIP/%s',_0x309b68[_0x7ca8('0x2c')])]=new Trunk(_0x309b68);}else{_0x503d14[_0x7ca8('0x47')](_0x503d14[_0x7ca8('0x14')][util[_0x7ca8('0x2a')](_0x7ca8('0x2b'),_0x309b68[_0x7ca8('0x2c')])],_0x309b68);}}}return _0x503d14['trunks'];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x4a')]=function(){var _0x1740fd=this;return function(_0x5767b5){if(_0x5767b5){freeIsNotKey(_0x5767b5,_0x1740fd[_0x7ca8('0x15')],_0x7ca8('0x2c'));for(var _0x12398b=0x0,_0xb98374={},_0x20d118={};_0x12398b<_0x5767b5[_0x7ca8('0x44')];_0x12398b+=0x1){_0xb98374=_0x5767b5[_0x12398b];if(_['isUndefined'](_0x1740fd['voiceQueues'][_0xb98374[_0x7ca8('0x2c')]])){_0x1740fd[_0x7ca8('0x15')][_0xb98374['name']]=new VoiceQueue(_0xb98374);}else{_0x1740fd[_0x7ca8('0x47')](_0x1740fd[_0x7ca8('0x15')][_0xb98374[_0x7ca8('0x2c')]],_0xb98374);}}}return _0x1740fd[_0x7ca8('0x15')];};};Realtime['prototype'][_0x7ca8('0x4b')]=function(){var _0x3ae2e2=this;return function(_0x523145){if(_0x523145){freeIsNotKey(_0x523145,_0x3ae2e2[_0x7ca8('0x16')],'id');for(var _0x13f474=0x0,_0x5c2479={},_0x339133={};_0x13f474<_0x523145[_0x7ca8('0x44')];_0x13f474+=0x1){_0x5c2479=_0x523145[_0x13f474];if(_[_0x7ca8('0x46')](_0x3ae2e2[_0x7ca8('0x16')][_0x5c2479['id']])){_0x3ae2e2[_0x7ca8('0x16')][_0x5c2479['id']]=new Trigger(_0x5c2479);}else{_0x3ae2e2[_0x7ca8('0x47')](_0x3ae2e2[_0x7ca8('0x16')][_0x5c2479['id']],_0x5c2479);}}}return _0x3ae2e2['triggers'];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x4c')]=function(){var _0x40c0d9=this;return function(_0x37d2d2){if(_0x37d2d2){freeIsNotKey(_0x37d2d2,_0x40c0d9[_0x7ca8('0x18')],'id');for(var _0x3eea6a=0x0,_0xec6f35={},_0x246666={};_0x3eea6a<_0x37d2d2[_0x7ca8('0x44')];_0x3eea6a+=0x1){_0xec6f35=_0x37d2d2[_0x3eea6a];if(_[_0x7ca8('0x46')](_0x40c0d9[_0x7ca8('0x18')][_0xec6f35['id']])){_0x40c0d9['templates'][_0xec6f35['id']]=new Template(_0xec6f35);}else{_0x40c0d9[_0x7ca8('0x47')](_0x40c0d9[_0x7ca8('0x18')][_0xec6f35['id']],_0xec6f35);}}}return _0x40c0d9[_0x7ca8('0x18')];};};Realtime['prototype'][_0x7ca8('0x4d')]=function(){var _0x1288f3=this;return function(_0x54806a){if(_0x54806a){freeIsNotKey(_0x54806a,_0x1288f3[_0x7ca8('0x1f')],'id');for(var _0x167f65=0x0,_0xb388a4={},_0x1700c5={};_0x167f65<_0x54806a['length'];_0x167f65+=0x1){_0xb388a4=_0x54806a[_0x167f65];if(_[_0x7ca8('0x46')](_0x1288f3[_0x7ca8('0x1f')][_0xb388a4['id']])){_0x1288f3[_0x7ca8('0x1f')][_0xb388a4['id']]=new ZendeskAccount(_0xb388a4);}else{_0x1288f3[_0x7ca8('0x47')](_0x1288f3[_0x7ca8('0x1f')][_0xb388a4['id']],_0xb388a4);}}}return _0x1288f3[_0x7ca8('0x1f')];};};Realtime['prototype'][_0x7ca8('0x4e')]=function(){var _0x35a710=this;return function(_0x445112){if(_0x445112){freeIsNotKey(_0x445112,_0x35a710[_0x7ca8('0x20')],'id');for(var _0x376367=0x0,_0x116e66={},_0x5175ae={};_0x376367<_0x445112['length'];_0x376367+=0x1){_0x116e66=_0x445112[_0x376367];if(_[_0x7ca8('0x46')](_0x35a710[_0x7ca8('0x20')][_0x116e66['id']])){_0x35a710[_0x7ca8('0x20')][_0x116e66['id']]=new SalesforceAccount(_0x116e66);}else{_0x35a710[_0x7ca8('0x47')](_0x35a710[_0x7ca8('0x20')][_0x116e66['id']],_0x116e66);}}}return _0x35a710[_0x7ca8('0x20')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x39affd=this;return function(_0x236580){if(_0x236580){freeIsNotKey(_0x236580,_0x39affd[_0x7ca8('0x21')],'id');for(var _0x758f5a=0x0,_0x1e2d06={},_0x20cb41={};_0x758f5a<_0x236580[_0x7ca8('0x44')];_0x758f5a+=0x1){_0x1e2d06=_0x236580[_0x758f5a];if(_['isUndefined'](_0x39affd[_0x7ca8('0x21')][_0x1e2d06['id']])){_0x39affd['freshdeskAccounts'][_0x1e2d06['id']]=new FreshdeskAccount(_0x1e2d06);}else{_0x39affd[_0x7ca8('0x47')](_0x39affd['freshdeskAccounts'][_0x1e2d06['id']],_0x1e2d06);}}}return _0x39affd[_0x7ca8('0x21')];};};Realtime[_0x7ca8('0x43')]['initZohoAccounts']=function(){var _0x4991c2=this;return function(_0xed946){if(_0xed946){freeIsNotKey(_0xed946,_0x4991c2[_0x7ca8('0x22')],'id');for(var _0x51d046=0x0,_0x4781a1={},_0x308185={};_0x51d046<_0xed946[_0x7ca8('0x44')];_0x51d046+=0x1){_0x4781a1=_0xed946[_0x51d046];if(_[_0x7ca8('0x46')](_0x4991c2[_0x7ca8('0x22')][_0x4781a1['id']])){_0x4991c2['zohoAccounts'][_0x4781a1['id']]=new ZohoAccount(_0x4781a1);}else{_0x4991c2[_0x7ca8('0x47')](_0x4991c2['zohoAccounts'][_0x4781a1['id']],_0x4781a1);}}}return _0x4991c2[_0x7ca8('0x22')];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x4f')]=function(){var _0x59135f=this;return function(_0x1d9bcb){if(_0x1d9bcb){freeIsNotKey(_0x1d9bcb,_0x59135f[_0x7ca8('0x23')],'id');for(var _0x38bf3c=0x0,_0x59401d={},_0x2f7cb2={};_0x38bf3c<_0x1d9bcb[_0x7ca8('0x44')];_0x38bf3c+=0x1){_0x59401d=_0x1d9bcb[_0x38bf3c];if(_[_0x7ca8('0x46')](_0x59135f[_0x7ca8('0x23')][_0x59401d['id']])){_0x59135f[_0x7ca8('0x23')][_0x59401d['id']]=new DeskAccount(_0x59401d);}else{_0x59135f[_0x7ca8('0x47')](_0x59135f[_0x7ca8('0x23')][_0x59401d['id']],_0x59401d);}}}return _0x59135f[_0x7ca8('0x23')];};};Realtime[_0x7ca8('0x43')]['initSugarcrmAccounts']=function(){var _0x66e525=this;return function(_0x1f4548){if(_0x1f4548){freeIsNotKey(_0x1f4548,_0x66e525[_0x7ca8('0x50')],'id');for(var _0x2b9252=0x0,_0x5720ea={},_0x4e9349={};_0x2b9252<_0x1f4548[_0x7ca8('0x44')];_0x2b9252+=0x1){_0x5720ea=_0x1f4548[_0x2b9252];if(_['isUndefined'](_0x66e525[_0x7ca8('0x50')][_0x5720ea['id']])){_0x66e525[_0x7ca8('0x50')][_0x5720ea['id']]=new SugarcrmAccount(_0x5720ea);}else{_0x66e525['mergeFromDatabase'](_0x66e525['sugarcrmAccounts'][_0x5720ea['id']],_0x5720ea);}}}return _0x66e525[_0x7ca8('0x50')];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x51')]=function(){var _0x5830cb=this;return function(_0x21874a){if(_0x21874a){freeIsNotKey(_0x21874a,_0x5830cb[_0x7ca8('0x52')],'id');for(var _0x349e38=0x0,_0x454b86={},_0x5deba6={};_0x349e38<_0x21874a[_0x7ca8('0x44')];_0x349e38+=0x1){_0x454b86=_0x21874a[_0x349e38];if(_[_0x7ca8('0x46')](_0x5830cb['vtigerAccounts'][_0x454b86['id']])){_0x5830cb[_0x7ca8('0x52')][_0x454b86['id']]=new VtigerAccount(_0x454b86);}else{_0x5830cb[_0x7ca8('0x47')](_0x5830cb[_0x7ca8('0x52')][_0x454b86['id']],_0x454b86);}}}return _0x5830cb['vtigerAccounts'];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x53')]=function(){var _0x496746=this;return function(_0x4a21a2){if(_0x4a21a2){freeIsNotKey(_0x4a21a2,_0x496746[_0x7ca8('0x24')],'id');for(var _0x545ab2=0x0,_0x27f3e9={},_0x86af07={};_0x545ab2<_0x4a21a2['length'];_0x545ab2+=0x1){_0x27f3e9=_0x4a21a2[_0x545ab2];if(_[_0x7ca8('0x46')](_0x496746[_0x7ca8('0x24')][_0x27f3e9['id']])){_0x496746['servicenowAccounts'][_0x27f3e9['id']]=new ServicenowAccount(_0x27f3e9);}else{_0x496746[_0x7ca8('0x47')](_0x496746[_0x7ca8('0x24')][_0x27f3e9['id']],_0x27f3e9);}}}return _0x496746[_0x7ca8('0x24')];};};Realtime[_0x7ca8('0x43')]['initDynamics365Accounts']=function(){var _0x3bc862=this;return function(_0x178008){if(_0x178008){freeIsNotKey(_0x178008,_0x3bc862['dynamics365Accounts'],'id');for(var _0x1a16bb=0x0,_0x54afa3={},_0x458cd5={};_0x1a16bb<_0x178008[_0x7ca8('0x44')];_0x1a16bb+=0x1){_0x54afa3=_0x178008[_0x1a16bb];if(_[_0x7ca8('0x46')](_0x3bc862[_0x7ca8('0x25')][_0x54afa3['id']])){_0x3bc862[_0x7ca8('0x25')][_0x54afa3['id']]=new Dynamics365Account(_0x54afa3);}else{_0x3bc862['mergeFromDatabase'](_0x3bc862[_0x7ca8('0x25')][_0x54afa3['id']],_0x54afa3);}}}return _0x3bc862[_0x7ca8('0x25')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x5a5614=this;return function(_0x5edfc1){if(_0x5edfc1){freeIsNotKey(_0x5edfc1,_0x5a5614[_0x7ca8('0x26')],'id');for(var _0x2cb510=0x0,_0x487bd6={},_0xc822ee={};_0x2cb510<_0x5edfc1[_0x7ca8('0x44')];_0x2cb510+=0x1){_0x487bd6=_0x5edfc1[_0x2cb510];if(_['isUndefined'](_0x5a5614['freshsalesAccounts'][_0x487bd6['id']])){_0x5a5614[_0x7ca8('0x26')][_0x487bd6['id']]=new FreshsalesAccount(_0x487bd6);}else{_0x5a5614[_0x7ca8('0x47')](_0x5a5614[_0x7ca8('0x26')][_0x487bd6['id']],_0x487bd6);}}}return _0x5a5614[_0x7ca8('0x26')];};};Realtime[_0x7ca8('0x43')]['initVoiceQueueHopperHistory']=function(){var _0x327b9c=this;return function(_0x3d8b33){for(var _0x57ef1e=0x0;_0x57ef1e<_0x3d8b33['length'];_0x57ef1e+=0x1){_['merge'](_0x327b9c[_0x7ca8('0x15')][_0x3d8b33[_0x57ef1e]['name']],_0x3d8b33[_0x57ef1e]);}return _0x327b9c[_0x7ca8('0x15')];};};Realtime['prototype'][_0x7ca8('0x54')]=function(){var _0x32b97b=this;return function(_0x5121ea){clearVoiceQueues(_0x32b97b[_0x7ca8('0x15')]);if(_0x5121ea){_0x5121ea=_['groupBy'](_0x5121ea,_0x7ca8('0x55'));for(var _0x43b08c in _0x5121ea){if(_0x5121ea[_0x7ca8('0x29')](_0x43b08c)){var _0x56e5ed={};for(var _0x5c90b4=0x0;_0x5c90b4<_0x5121ea[_0x43b08c][_0x7ca8('0x44')];_0x5c90b4+=0x1){var _0x4b68ab=_0x5121ea[_0x43b08c][_0x5c90b4]['queue'];if(_0x32b97b[_0x7ca8('0x15')][_0x4b68ab]){if(_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x56')]){_0x32b97b[_0x7ca8('0x15')][_0x4b68ab][_0x7ca8('0x34')]+=0x1;}if(_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x57')]){_0x32b97b[_0x7ca8('0x15')][_0x4b68ab][_0x7ca8('0x35')]+=0x1;}_0x32b97b['voiceQueues'][_0x4b68ab]['sumHoldTime']+=moment(_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x58')])[_0x7ca8('0x59')](moment(_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x5a')]),_0x7ca8('0x5b'))||0x0;if(_0x5c90b4===_0x5121ea[_0x43b08c][_0x7ca8('0x44')]-0x1){_0x32b97b[_0x7ca8('0x15')][_0x4b68ab][_0x7ca8('0x2f')]+=moment(_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x5c')]||_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x5d')]||_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x5e')])[_0x7ca8('0x59')](moment(_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x5a')]),_0x7ca8('0x5b'))||0x0;_0x32b97b[_0x7ca8('0x15')][_0x4b68ab][_0x7ca8('0x2d')]+=0x1;if(_0x5121ea[_0x43b08c][_0x5c90b4]['queuecallercomplete']){_0x32b97b[_0x7ca8('0x15')][_0x4b68ab][_0x7ca8('0x2e')]+=0x1;_0x32b97b[_0x7ca8('0x15')][_0x4b68ab]['sumBillable']+=moment(_0x5121ea[_0x43b08c][_0x5c90b4][_0x7ca8('0x5c')])[_0x7ca8('0x59')](moment(_0x5121ea[_0x43b08c][_0x5c90b4]['queuecallerleaveAt']),_0x7ca8('0x5b'))||0x0;}}else{_0x32b97b['voiceQueues'][_0x4b68ab][_0x7ca8('0x2f')]+=_0x32b97b['voiceQueues'][_0x4b68ab][_0x7ca8('0x36')]||0x0;}}}}}}return _0x32b97b[_0x7ca8('0x15')];};};Realtime['prototype'][_0x7ca8('0x5f')]=function(){var _0x735360=this;return function(_0x43365c){clearVoiceCallReports(_0x735360[_0x7ca8('0x60')]);if(_0x43365c){for(var _0x50b03c=0x0;_0x50b03c<_0x43365c[_0x7ca8('0x44')];_0x50b03c+=0x1){_0x735360['outbound'][_0x7ca8('0x2d')]+=0x1;_0x735360[_0x7ca8('0x60')][_0x7ca8('0x2f')]+=_0x43365c[_0x50b03c]['duration'];if(_0x43365c[_0x50b03c][_0x7ca8('0x61')]===_0x7ca8('0x62')){_0x735360[_0x7ca8('0x60')][_0x7ca8('0x2e')]+=0x1;_0x735360[_0x7ca8('0x60')][_0x7ca8('0x36')]+=_0x43365c[_0x50b03c][_0x7ca8('0x63')]-_0x43365c[_0x50b03c][_0x7ca8('0x64')]||0x0;_0x735360[_0x7ca8('0x60')][_0x7ca8('0x30')]+=_0x43365c[_0x50b03c]['billableseconds'];}}}return _0x735360[_0x7ca8('0x60')];};};Realtime['prototype'][_0x7ca8('0x65')]=function(){var _0xe9e64c=this;return function(_0x54e07e){if(_0x54e07e){freeIsNotKey(_0x54e07e,_0xe9e64c['campaigns'],_0x7ca8('0x2c'));for(var _0x243aab=0x0,_0x263f23={};_0x243aab<_0x54e07e[_0x7ca8('0x44')];_0x243aab+=0x1){_0x263f23=_0x54e07e[_0x243aab];if(_['isUndefined'](_0xe9e64c[_0x7ca8('0x17')][_0x263f23[_0x7ca8('0x2c')]])){_0xe9e64c['campaigns'][_0x263f23[_0x7ca8('0x2c')]]=new Campaign(_0x263f23);}else{_0xe9e64c[_0x7ca8('0x47')](_0xe9e64c[_0x7ca8('0x17')][_0x263f23[_0x7ca8('0x2c')]],_0x263f23);_0xe9e64c[_0x7ca8('0x17')][_0x263f23[_0x7ca8('0x2c')]][_0x7ca8('0x66')]=_0x263f23[_0x7ca8('0x67')]?_0x263f23[_0x7ca8('0x67')][_0x7ca8('0x2c')]:undefined;}}}return _0xe9e64c[_0x7ca8('0x17')];};};Realtime[_0x7ca8('0x43')][_0x7ca8('0x68')]=function(){var _0x58ffce=this;return function(_0x18a328){if(_0x18a328){freeIsNotKey(_0x18a328,_0x58ffce[_0x7ca8('0x19')],'id');for(var _0x491790=0x0,_0x52b12a={};_0x491790<_0x18a328[_0x7ca8('0x44')];_0x491790+=0x1){_0x52b12a=_0x18a328[_0x491790];if(_[_0x7ca8('0x46')](_0x58ffce['voiceExtensions'][_0x52b12a['id']])){_0x58ffce[_0x7ca8('0x19')][_0x52b12a['id']]=new VoiceExtension(_0x52b12a);}else{_0x58ffce[_0x7ca8('0x47')](_0x58ffce[_0x7ca8('0x19')][_0x52b12a['id']],_0x52b12a);}}}return _0x58ffce['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x3cd960=this;return function(_0x44bb6e){clearCampaigns(_0x3cd960['campaigns']);for(var _0x217762=0x0;_0x217762<_0x44bb6e['length'];_0x217762+=0x1){_[_0x7ca8('0x69')](_0x3cd960[_0x7ca8('0x17')][_0x44bb6e[_0x217762][_0x7ca8('0x2c')]],_0x44bb6e[_0x217762]);}return _0x3cd960[_0x7ca8('0x17')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0xf7d9e0=this;return function(_0x26b2ed){if(_0x26b2ed){freeIsNotKey(_0x26b2ed,_0xf7d9e0['faxAccounts'],'id');for(var _0x326f1f=0x0,_0x724787={},_0x44615e={};_0x326f1f<_0x26b2ed[_0x7ca8('0x44')];_0x326f1f+=0x1){_0x724787=_0x26b2ed[_0x326f1f];if(_['isUndefined'](_0xf7d9e0[_0x7ca8('0x27')][_0x724787['id']])){_0xf7d9e0['faxAccounts'][_0x724787['id']]=new FaxAccount(_0x724787);}else{_0xf7d9e0[_0x7ca8('0x47')](_0xf7d9e0['faxAccounts'][_0x724787['id']],_0x724787);}}}return _0xf7d9e0[_0x7ca8('0x27')];};};module[_0x7ca8('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 92645fe..0f3c1b0 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 _0x7063=['disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','format','SIP/%s','prototype','length','connectedlinenum','lastAssignedTo','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','destination','callerid','from-sip','xcally-motion-preview','calleridnum','destinationchannel','channel','calleridpreview','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitorFilename','filename','createdAt','monitors','connectedlinename','isArray','forEach','Local','indexOf','substring','lastIndexOf','membername','transfererlinkedid','exports','moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','sync','xdr'];(function(_0x1d3366,_0x335df9){var _0x4ed3a0=function(_0x34bb84){while(--_0x34bb84){_0x1d3366['push'](_0x1d3366['shift']());}};_0x4ed3a0(++_0x335df9);}(_0x7063,0x95));var _0x3706=function(_0x4f54a0,_0x164a39){_0x4f54a0=_0x4f54a0-0x0;var _0x27021c=_0x7063[_0x4f54a0];return _0x27021c;};'use strict';var _=require('lodash');var moment=require(_0x3706('0x0'));var util=require('util');var config=require(_0x3706('0x1'));var ami=require(_0x3706('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x3706('0x3'));var RpcVoiceDialReport=require(_0x3706('0x4'));var RpcMemberReport=require(_0x3706('0x5'));var RpcVoiceQueueReport=require(_0x3706('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3706('0x7'));var VoiceQueueReport=require(_0x3706('0x8'));var VoiceCallReport=require(_0x3706('0x9'));var VoiceAgentReport=require(_0x3706('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x3706('0xb'));function Report(_0x130a3c){this[_0x3706('0xc')]=_0x130a3c;this[_0x3706('0xd')]=_0x130a3c[_0x3706('0xd')];this['telephones']=_0x130a3c[_0x3706('0xe')];}Report['prototype'][_0x3706('0xf')]=function(_0x3222dc){var _0x104311=new VoiceQueueReport(this[_0x3706('0xc')]);var _0xbd12b5=new VoiceAgentReport(this[_0x3706('0xc')]);var _0x508384=new VoiceDialReport(this[_0x3706('0xc')]);var _0x582623=new VoiceCallReport(this['realtime']);var _0x1d942f=new UserReport(this['realtime']);if(config[_0x3706('0x10')]&&config[_0x3706('0x10')][_0x3706('0x11')]){ami['on']('custom:voiceQueueReport',this[_0x3706('0x12')][_0x3706('0x13')](this));ami['on'](_0x3706('0x14'),this[_0x3706('0x15')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x3706('0x16')][_0x3706('0x13')](this));ami['on']('custom:voiceDialReport',this[_0x3706('0x17')][_0x3706('0x13')](this));ami['on'](_0x3706('0x18'),this['blindTransfer'][_0x3706('0x13')](this));ami['on'](_0x3706('0x19'),this[_0x3706('0x1a')][_0x3706('0x13')](this));}};Report['prototype'][_0x3706('0x1b')]=function(_0x1602a8){var _0x1bc30c;_0x1bc30c=_[_0x3706('0x1c')](this[_0x3706('0xd')],function(_0x946691){return _0x946691['accountcode']==_0x1602a8||_0x946691[_0x3706('0x1d')]==_0x1602a8;});if(_[_0x3706('0x1e')](_0x1bc30c)){var _0x3b6c11=_[_0x3706('0x1c')](this['telephones'],function(_0x329837){return _0x329837[_0x3706('0x1f')]==_0x1602a8||_0x329837[_0x3706('0x1d')]==_0x1602a8;});if(_0x3b6c11){_0x1bc30c=_[_0x3706('0x1c')](this['agents'],function(_0x58393a){return _0x58393a['interface']==util[_0x3706('0x20')](_0x3706('0x21'),_0x3b6c11[_0x3706('0x1d')]);});}}return _0x1bc30c;};Report[_0x3706('0x22')][_0x3706('0x12')]=function(_0x53938e){for(var _0x3ef9c7=0x0;_0x3ef9c7<_0x53938e[_0x3706('0x23')];_0x3ef9c7+=0x1){var _0x29c1bd=this['findAgent'](_0x53938e[_0x3ef9c7][_0x3706('0x24')]);if(_0x29c1bd){_0x53938e[_0x3ef9c7][_0x3706('0x1f')]=_0x29c1bd['accountcode'];_0x53938e[_0x3ef9c7]['assigned']=!![];_0x53938e[_0x3ef9c7][_0x3706('0x25')]=_0x29c1bd[_0x3706('0x1d')];_0x53938e[_0x3ef9c7]['interface']=_['isNil'](_0x29c1bd[_0x3706('0x26')])?util[_0x3706('0x20')]('SIP/%s',_0x29c1bd[_0x3706('0x1d')]):_0x29c1bd['interface'];if(_0x53938e[_0x3ef9c7]['queuecallercomplete']){_0x53938e[_0x3ef9c7][_0x3706('0x27')]=moment()['format'](_0x3706('0x28'));}if(_0x53938e[_0x3ef9c7][_0x3706('0x29')]){_0x53938e[_0x3ef9c7][_0x3706('0x2a')]=moment()[_0x3706('0x20')](_0x3706('0x28'));}RpcMemberReport[_0x3706('0x12')](_0x53938e[_0x3ef9c7]);}RpcVoiceQueueReport[_0x3706('0x2b')](_0x53938e[_0x3ef9c7]);}};function extractCalleridNumber(_0x2cd60a){var _0x2906d3=_0x2cd60a[_0x3706('0x2c')](/<(.*?)>/);return _0x2906d3?_0x2906d3[0x1]:_0x2cd60a;}Report[_0x3706('0x22')][_0x3706('0x15')]=function(_0x4735eb){_0x4735eb['destination']=_0x4735eb['destination']||_0x4735eb[_0x3706('0x2d')];if(_0x4735eb[_0x3706('0x2e')]=='dialer'){_0x4735eb[_0x3706('0x2f')]=_0x3706('0x30');_0x4735eb[_0x3706('0x31')]=_0x4735eb[_0x3706('0x30')];if(_0x4735eb[_0x3706('0x32')]==_0x3706('0x33')){_0x4735eb['accountcode']='';_0x4735eb[_0x3706('0x34')]=extractCalleridNumber(_0x4735eb[_0x3706('0x35')]);}else if(_0x4735eb[_0x3706('0x32')]==_0x3706('0x36')){if(_0x4735eb[_0x3706('0x34')]==_0x3706('0x37')){_0x4735eb[_0x3706('0x34')]=extractCalleridNumber(_0x4735eb['calleridpreview']);_0x4735eb[_0x3706('0x38')]=_0x4735eb['originatecalleridnum'];_0x4735eb[_0x3706('0x39')]=[_0x4735eb[_0x3706('0x3a')],_0x4735eb[_0x3706('0x3a')]=_0x4735eb[_0x3706('0x39')]][0x0];_0x4735eb[_0x3706('0x35')]=_0x4735eb[_0x3706('0x3b')];}else{_0x4735eb[_0x3706('0x34')]=_0x4735eb[_0x3706('0x38')];_0x4735eb[_0x3706('0x38')]=_0x4735eb[_0x3706('0x3c')];if(_0x4735eb['disposition']==_0x3706('0x3d')){_0x4735eb[_0x3706('0x1f')]=_0x4735eb[_0x3706('0x24')];}else{_0x4735eb[_0x3706('0x1f')]='';}}}}else{_0x4735eb['callerid']=util['format'](_0x3706('0x3e'),_0x4735eb[_0x3706('0x3f')],_0x4735eb[_0x3706('0x38')]);}if(RpcVoiceTransferReport[_0x3706('0x40')][_0x4735eb[_0x3706('0x41')]]){var _0x4c56d9=RpcVoiceTransferReport[_0x3706('0x40')][_0x4735eb[_0x3706('0x41')]];_0x4c56d9[_0x3706('0x42')]=_0x4735eb[_0x3706('0x43')];RpcVoiceTransferReport[_0x3706('0x44')](_0x4c56d9);delete RpcVoiceTransferReport[_0x3706('0x40')][_0x4735eb[_0x3706('0x41')]];}RpcVoiceCallReport[_0x3706('0x2b')](_0x4735eb);if(_0x4735eb['monitor']){for(var _0x32ad02=0x0;_0x32ad02<_0x4735eb['monitors']['length'];_0x32ad02+=0x1){_0x4735eb[_0x3706('0x45')]=_0x4735eb['monitors'][_0x32ad02][_0x3706('0x46')];_0x4735eb[_0x3706('0x47')]=_0x4735eb[_0x3706('0x48')][_0x32ad02][_0x3706('0x47')];if(_0x4735eb['exten']==_0x3706('0x37')){_0x4735eb[_0x3706('0x38')]=_0x4735eb['connectedlinenum'];_0x4735eb[_0x3706('0x3f')]=_0x4735eb[_0x3706('0x49')];_0x4735eb[_0x3706('0x24')]=_0x4735eb['accountcode'];_0x4735eb['connectedlinename']=_0x4735eb['membername'];_0x4735eb[_0x3706('0x2d')]=_0x4735eb[_0x3706('0x3c')];}else if(_0x4735eb[_0x3706('0x2d')]=='xcally-motion-dialer'){_0x4735eb[_0x3706('0x38')]=_0x4735eb[_0x3706('0x34')];_0x4735eb[_0x3706('0x2d')]=_0x4735eb[_0x3706('0x3c')];}RpcVoiceRecording[_0x3706('0x2b')](_0x4735eb);}}};Report[_0x3706('0x22')][_0x3706('0x16')]=function(_0x20f9c5){if(_[_0x3706('0x4a')](_0x20f9c5)){_0x20f9c5[_0x3706('0x4b')](function(_0x54f5f2){RpcVoiceAgentReport[_0x3706('0x2b')](_0x54f5f2);});}else{RpcVoiceAgentReport['create'](_0x20f9c5);}};Report[_0x3706('0x22')]['voiceDialReport']=function(_0xe4446f){RpcVoiceDialReport[_0x3706('0x2b')](_0xe4446f);var _0x2c28fc;var _0x363486;var _0x20ea43=_0xe4446f[_0x3706('0x3a')];if(_['startsWith'](_0x20ea43,_0x3706('0x4c'))){_0x363486=_0x20ea43['substring'](_0x20ea43[_0x3706('0x4d')]('/')+0x1,_0x20ea43['indexOf']('@'));_0x2c28fc=_[_0x3706('0x1c')](this[_0x3706('0xd')],function(_0x470979){return _0x470979['mobile']==_0x363486||_0x470979['phone']==_0x363486||_0x470979[_0x3706('0x1f')]==_0x363486;});}else{_0x363486=_0x20ea43[_0x3706('0x4e')](_0x20ea43[_0x3706('0x4d')]('/')+0x1,_0x20ea43[_0x3706('0x4f')]('-'));_0x2c28fc=this[_0x3706('0x1b')](_0x363486);}if(_0x2c28fc){_0xe4446f[_0x3706('0x26')]=_[_0x3706('0x1e')](_0x2c28fc[_0x3706('0x26')])?util[_0x3706('0x20')](_0x3706('0x21'),_0x2c28fc[_0x3706('0x1d')]):_0x2c28fc[_0x3706('0x26')];_0xe4446f[_0x3706('0x50')]=_0x2c28fc[_0x3706('0x1d')];_0xe4446f[_0x3706('0x1f')]=_0x2c28fc[_0x3706('0x1f')];RpcMemberReport[_0x3706('0x17')](_0xe4446f);}};Report['prototype'][_0x3706('0x44')]=function(_0x16a61b){RpcVoiceTransferReport[_0x3706('0x40')][_0x16a61b[_0x3706('0x51')]]=_0x16a61b;};Report[_0x3706('0x22')][_0x3706('0x1a')]=function(_0xcefa3d){RpcVoiceTransferReport[_0x3706('0x1a')](_0xcefa3d);};module[_0x3706('0x52')]=Report; \ No newline at end of file +var _0x2e81=['\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','create','monitor','monitors','filename','createdAt','connectedlinename','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','voiceDialReport','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedTransfer','findAgent','name','isNil','find','accountcode','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','match','destination','exten','lastdata','queue','context','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','channel','destinationchannel','calleridpreview'];(function(_0x9dd220,_0xacfcf){var _0x55e92d=function(_0x3c16dc){while(--_0x3c16dc){_0x9dd220['push'](_0x9dd220['shift']());}};_0x55e92d(++_0xacfcf);}(_0x2e81,0xc2));var _0x12e8=function(_0x2f02d4,_0x27b24a){_0x2f02d4=_0x2f02d4-0x0;var _0x4b707d=_0x2e81[_0x2f02d4];return _0x4b707d;};'use strict';var _=require(_0x12e8('0x0'));var moment=require(_0x12e8('0x1'));var util=require(_0x12e8('0x2'));var config=require(_0x12e8('0x3'));var ami=require(_0x12e8('0x4'));var RpcVoiceAgentReport=require(_0x12e8('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x12e8('0x6'));var RpcMemberReport=require(_0x12e8('0x7'));var RpcVoiceQueueReport=require(_0x12e8('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x12e8('0x9'));var VoiceCallReport=require(_0x12e8('0xa'));var VoiceAgentReport=require(_0x12e8('0xb'));var VoiceDialReport=require(_0x12e8('0xc'));var UserReport=require(_0x12e8('0xd'));function Report(_0x3da9e4){this[_0x12e8('0xe')]=_0x3da9e4;this[_0x12e8('0xf')]=_0x3da9e4[_0x12e8('0xf')];this['telephones']=_0x3da9e4[_0x12e8('0x10')];}Report[_0x12e8('0x11')][_0x12e8('0x12')]=function(_0x275306){var _0x1af5ba=new VoiceQueueReport(this[_0x12e8('0xe')]);var _0x2d32b1=new VoiceAgentReport(this['realtime']);var _0x488f7e=new VoiceDialReport(this[_0x12e8('0xe')]);var _0x34e566=new VoiceCallReport(this['realtime']);var _0x1ec05c=new UserReport(this['realtime']);if(config['xdr']&&config[_0x12e8('0x13')][_0x12e8('0x14')]){ami['on'](_0x12e8('0x15'),this['voiceQueueReport'][_0x12e8('0x16')](this));ami['on'](_0x12e8('0x17'),this['voiceCallReport'][_0x12e8('0x16')](this));ami['on'](_0x12e8('0x18'),this['voiceAgentReport']['bind'](this));ami['on'](_0x12e8('0x19'),this['voiceDialReport'][_0x12e8('0x16')](this));ami['on'](_0x12e8('0x1a'),this['blindTransfer'][_0x12e8('0x16')](this));ami['on']('attendedtransfer',this[_0x12e8('0x1b')]['bind'](this));}};Report[_0x12e8('0x11')][_0x12e8('0x1c')]=function(_0x2e5f28){var _0x75b8cd;_0x75b8cd=_['find'](this['agents'],function(_0x12f1dc){return _0x12f1dc['accountcode']==_0x2e5f28||_0x12f1dc[_0x12e8('0x1d')]==_0x2e5f28;});if(_[_0x12e8('0x1e')](_0x75b8cd)){var _0x1f7b5e=_[_0x12e8('0x1f')](this['telephones'],function(_0x3f2763){return _0x3f2763[_0x12e8('0x20')]==_0x2e5f28||_0x3f2763['name']==_0x2e5f28;});if(_0x1f7b5e){_0x75b8cd=_[_0x12e8('0x1f')](this[_0x12e8('0xf')],function(_0x50189a){return _0x50189a[_0x12e8('0x21')]==util[_0x12e8('0x22')](_0x12e8('0x23'),_0x1f7b5e[_0x12e8('0x1d')]);});}}return _0x75b8cd;};Report[_0x12e8('0x11')][_0x12e8('0x24')]=function(_0x5c5ffc){for(var _0x9b2a22=0x0;_0x9b2a22<_0x5c5ffc[_0x12e8('0x25')];_0x9b2a22+=0x1){var _0x21d2df=this[_0x12e8('0x1c')](_0x5c5ffc[_0x9b2a22][_0x12e8('0x26')]);if(_0x21d2df){_0x5c5ffc[_0x9b2a22][_0x12e8('0x20')]=_0x21d2df['accountcode'];_0x5c5ffc[_0x9b2a22][_0x12e8('0x27')]=!![];_0x5c5ffc[_0x9b2a22]['lastAssignedTo']=_0x21d2df['name'];_0x5c5ffc[_0x9b2a22][_0x12e8('0x21')]=_[_0x12e8('0x1e')](_0x21d2df[_0x12e8('0x21')])?util[_0x12e8('0x22')](_0x12e8('0x23'),_0x21d2df[_0x12e8('0x1d')]):_0x21d2df[_0x12e8('0x21')];if(_0x5c5ffc[_0x9b2a22][_0x12e8('0x28')]){_0x5c5ffc[_0x9b2a22][_0x12e8('0x29')]=moment()[_0x12e8('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5c5ffc[_0x9b2a22][_0x12e8('0x2a')]){_0x5c5ffc[_0x9b2a22][_0x12e8('0x2b')]=moment()[_0x12e8('0x22')](_0x12e8('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x5c5ffc[_0x9b2a22]);}RpcVoiceQueueReport['create'](_0x5c5ffc[_0x9b2a22]);}};function extractCalleridNumber(_0x54444b){var _0x5b106d=_0x54444b[_0x12e8('0x2d')](/<(.*?)>/);return _0x5b106d?_0x5b106d[0x1]:_0x54444b;}Report[_0x12e8('0x11')]['voiceCallReport']=function(_0x5d5279){_0x5d5279[_0x12e8('0x2e')]=_0x5d5279[_0x12e8('0x2e')]||_0x5d5279[_0x12e8('0x2f')];if(_0x5d5279['type']=='dialer'){_0x5d5279['lastapplication']='queue';_0x5d5279[_0x12e8('0x30')]=_0x5d5279[_0x12e8('0x31')];if(_0x5d5279[_0x12e8('0x32')]=='from-voip-provider'){_0x5d5279['accountcode']='';_0x5d5279[_0x12e8('0x2e')]=extractCalleridNumber(_0x5d5279['callerid']);}else if(_0x5d5279['context']==_0x12e8('0x33')){if(_0x5d5279['destination']==_0x12e8('0x34')){_0x5d5279[_0x12e8('0x2e')]=extractCalleridNumber(_0x5d5279['calleridpreview']);_0x5d5279[_0x12e8('0x35')]=_0x5d5279[_0x12e8('0x36')];_0x5d5279['destinationchannel']=[_0x5d5279['channel'],_0x5d5279[_0x12e8('0x37')]=_0x5d5279[_0x12e8('0x38')]][0x0];_0x5d5279['callerid']=_0x5d5279[_0x12e8('0x39')];}else{_0x5d5279['destination']=_0x5d5279['calleridnum'];_0x5d5279[_0x12e8('0x35')]=_0x5d5279[_0x12e8('0x36')];if(_0x5d5279['disposition']=='ANSWERED'){_0x5d5279[_0x12e8('0x20')]=_0x5d5279[_0x12e8('0x26')];}else{_0x5d5279['accountcode']='';}}}}else{_0x5d5279['callerid']=util[_0x12e8('0x22')](_0x12e8('0x3a'),_0x5d5279[_0x12e8('0x3b')],_0x5d5279[_0x12e8('0x35')]);}if(RpcVoiceTransferReport[_0x12e8('0x3c')][_0x5d5279[_0x12e8('0x3d')]]){var _0x594f8d=RpcVoiceTransferReport[_0x12e8('0x3c')][_0x5d5279[_0x12e8('0x3d')]];_0x594f8d[_0x12e8('0x3e')]=_0x5d5279['uniqueid'];RpcVoiceTransferReport[_0x12e8('0x3f')](_0x594f8d);delete RpcVoiceTransferReport['transfers'][_0x5d5279['linkedid']];}RpcVoiceCallReport[_0x12e8('0x40')](_0x5d5279);if(_0x5d5279[_0x12e8('0x41')]){for(var _0x81900b=0x0;_0x81900b<_0x5d5279[_0x12e8('0x42')][_0x12e8('0x25')];_0x81900b+=0x1){_0x5d5279['monitorFilename']=_0x5d5279[_0x12e8('0x42')][_0x81900b][_0x12e8('0x43')];_0x5d5279['createdAt']=_0x5d5279[_0x12e8('0x42')][_0x81900b][_0x12e8('0x44')];if(_0x5d5279[_0x12e8('0x2f')]==_0x12e8('0x34')){_0x5d5279[_0x12e8('0x35')]=_0x5d5279[_0x12e8('0x26')];_0x5d5279[_0x12e8('0x3b')]=_0x5d5279[_0x12e8('0x45')];_0x5d5279[_0x12e8('0x26')]=_0x5d5279[_0x12e8('0x20')];_0x5d5279[_0x12e8('0x45')]=_0x5d5279['membername'];_0x5d5279[_0x12e8('0x2f')]=_0x5d5279[_0x12e8('0x36')];}else if(_0x5d5279[_0x12e8('0x2f')]=='xcally-motion-dialer'){_0x5d5279[_0x12e8('0x35')]=_0x5d5279[_0x12e8('0x2e')];_0x5d5279['exten']=_0x5d5279['originatecalleridnum'];}RpcVoiceRecording['create'](_0x5d5279);}}};Report[_0x12e8('0x11')][_0x12e8('0x46')]=function(_0x2d6d5d){if(_[_0x12e8('0x47')](_0x2d6d5d)){_0x2d6d5d[_0x12e8('0x48')](function(_0x1b8b6a){RpcVoiceAgentReport[_0x12e8('0x40')](_0x1b8b6a);});}else{RpcVoiceAgentReport[_0x12e8('0x40')](_0x2d6d5d);}};Report[_0x12e8('0x11')]['voiceDialReport']=function(_0x41399e){RpcVoiceDialReport['create'](_0x41399e);var _0x35f045;var _0x302f13;var _0x2269e2=_0x41399e[_0x12e8('0x37')];if(_[_0x12e8('0x49')](_0x2269e2,_0x12e8('0x4a'))){_0x302f13=_0x2269e2[_0x12e8('0x4b')](_0x2269e2[_0x12e8('0x4c')]('/')+0x1,_0x2269e2[_0x12e8('0x4c')]('@'));_0x35f045=_[_0x12e8('0x1f')](this[_0x12e8('0xf')],function(_0x100fc6){return _0x100fc6[_0x12e8('0x4d')]==_0x302f13||_0x100fc6[_0x12e8('0x4e')]==_0x302f13||_0x100fc6['accountcode']==_0x302f13;});}else{_0x302f13=_0x2269e2[_0x12e8('0x4b')](_0x2269e2['indexOf']('/')+0x1,_0x2269e2[_0x12e8('0x4f')]('-'));_0x35f045=this[_0x12e8('0x1c')](_0x302f13);}if(_0x35f045){_0x41399e['interface']=_[_0x12e8('0x1e')](_0x35f045[_0x12e8('0x21')])?util['format'](_0x12e8('0x23'),_0x35f045[_0x12e8('0x1d')]):_0x35f045[_0x12e8('0x21')];_0x41399e[_0x12e8('0x50')]=_0x35f045['name'];_0x41399e[_0x12e8('0x20')]=_0x35f045['accountcode'];RpcMemberReport[_0x12e8('0x51')](_0x41399e);}};Report[_0x12e8('0x11')]['blindTransfer']=function(_0x378978){RpcVoiceTransferReport[_0x12e8('0x3c')][_0x378978[_0x12e8('0x52')]]=_0x378978;};Report[_0x12e8('0x11')][_0x12e8('0x1b')]=function(_0x31979c){RpcVoiceTransferReport[_0x12e8('0x1b')](_0x31979c);};module[_0x12e8('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f342e41..fbe61cd 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f1d=['actionid','debug','format','trunk:%s','name','trunk:save','info','device','[userReport][devicestatechange]','agents','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','catch','error','[userReport][sipshowregistry]','resolve','[userReport][devicestatelist]','inspect','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event'];(function(_0xc86f7c,_0x3a0091){var _0x5932c4=function(_0x45ab41){while(--_0x45ab41){_0xc86f7c['push'](_0xc86f7c['shift']());}};_0x5932c4(++_0x3a0091);}(_0x4f1d,0x1a8));var _0xd4f1=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x4f1d[_0x1c6ef2];return _0x404b8c;};'use strict';var _=require(_0xd4f1('0x0'));var moment=require(_0xd4f1('0x1'));var util=require('util');var Redis=require(_0xd4f1('0x2'));var BPromise=require(_0xd4f1('0x3'));var config=require(_0xd4f1('0x4'));var logger=require(_0xd4f1('0x5'))(_0xd4f1('0x6'));var ami=require(_0xd4f1('0x7'));config[_0xd4f1('0x8')]=_[_0xd4f1('0x9')](config[_0xd4f1('0x8')],{'host':_0xd4f1('0xa'),'port':0x18eb});var io=require(_0xd4f1('0xb'))(new Redis(config[_0xd4f1('0x8')]));function UserReport(_0x42c096){this[_0xd4f1('0xc')]=_0x42c096[_0xd4f1('0xc')];this['agents']=_0x42c096['agents'];this[_0xd4f1('0xd')]=_0x42c096[_0xd4f1('0xd')];ami['on'](_0xd4f1('0xe'),this[_0xd4f1('0xf')]['bind'](this));ami['on'](_0xd4f1('0x10'),this[_0xd4f1('0xf')][_0xd4f1('0x11')](this));ami['on'](_0xd4f1('0x12'),this[_0xd4f1('0x13')][_0xd4f1('0x11')](this));ami['on'](_0xd4f1('0x14'),this[_0xd4f1('0x15')]['bind'](this));return this[_0xd4f1('0x16')]();}function showSipRegistrations(){Promise['resolve']()[_0xd4f1('0x17')](ami['actionSipShowRegistry']())[_0xd4f1('0x18')](function(_0x8dcde1){logger[_0xd4f1('0x19')](_0xd4f1('0x1a'),util['inspect'](_0x8dcde1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd4f1('0x1b')]()['then'](ami['actionDeviceStateList']())[_0xd4f1('0x18')](function(_0x509748){logger[_0xd4f1('0x19')](_0xd4f1('0x1c'),util[_0xd4f1('0x1d')](_0x509748,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd4f1('0x1b')]()['then'](ami['actionSipPeerStatus']())[_0xd4f1('0x18')](function(_0x5871a2){logger[_0xd4f1('0x19')](_0xd4f1('0x1e'),util['inspect'](_0x5871a2,{'showHidden':![],'depth':null}));});}UserReport[_0xd4f1('0x1f')][_0xd4f1('0x16')]=function(){setInterval(function(){BPromise[_0xd4f1('0x1b')]()['then'](showSipRegistrations())[_0xd4f1('0x17')](listDeviceStates())[_0xd4f1('0x17')](showPeersStatus());},0x32c8);};UserReport[_0xd4f1('0x1f')][_0xd4f1('0x20')]=function(_0x263b30){return _0x263b30!==null&&!_[_0xd4f1('0x21')](_0x263b30);};UserReport['prototype']['emit']=function(_0x210478,_0x2f362d,_0x149458){io['to'](_0x210478)[_0xd4f1('0x22')](_0x2f362d,_0x149458);};UserReport[_0xd4f1('0x1f')]['syncRegistry']=function(_0x467daa){try{if(this['isNotNull'](_0x467daa)){logger['info'](_0xd4f1('0x23'),_0x467daa[_0xd4f1('0x24')],_0x467daa[_0xd4f1('0x25')]);logger['debug'](_0xd4f1('0x26'),util['inspect'](_0x467daa,{'showHidden':![],'depth':null}));var _0x3f97d2=_[_0xd4f1('0x27')](this['trunks'],{'defaultuser':_0x467daa[_0xd4f1('0x24')]});if(_0x3f97d2){_0x467daa[_0xd4f1('0x28')]=_0x467daa[_0xd4f1('0x25')];_[_0xd4f1('0x29')](_0x3f97d2,_[_0xd4f1('0x2a')](_0x467daa,[_0xd4f1('0x2b'),_0xd4f1('0x2c'),_0xd4f1('0x24'),_0xd4f1('0x25')]));logger[_0xd4f1('0x2d')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xd4f1('0x1d')](_0x3f97d2,{'showHidden':![],'depth':null}));this[_0xd4f1('0x22')](util[_0xd4f1('0x2e')](_0xd4f1('0x2f'),_0x3f97d2[_0xd4f1('0x30')]),_0xd4f1('0x31'),_0x3f97d2);}}}catch(_0x45086a){logger[_0xd4f1('0x19')](_0xd4f1('0x26'),util[_0xd4f1('0x1d')](_0x45086a,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xd4f1('0x13')]=function(_0x32cdc0){try{if(this[_0xd4f1('0x20')](_0x32cdc0)){logger[_0xd4f1('0x32')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x32cdc0[_0xd4f1('0x33')],_0x32cdc0[_0xd4f1('0x25')]);logger[_0xd4f1('0x2d')](_0xd4f1('0x34'),util[_0xd4f1('0x1d')](_0x32cdc0,{'showHidden':![],'depth':null}));if(this[_0xd4f1('0x35')][_0x32cdc0[_0xd4f1('0x33')]]){if(!this[_0xd4f1('0x35')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x36')]||_0x32cdc0['state'][_0xd4f1('0x37')]()==_0xd4f1('0x38')){this[_0xd4f1('0x35')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x36')]=![];if(this['agents'][_0x32cdc0[_0xd4f1('0x33')]]['state']!==_0x32cdc0[_0xd4f1('0x25')][_0xd4f1('0x37')]()){this[_0xd4f1('0x35')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x39')]=_[_0xd4f1('0x3a')](moment()[_0xd4f1('0x2e')]('x'));}this[_0xd4f1('0x35')][_0x32cdc0['device']][_0xd4f1('0x25')]=_0x32cdc0[_0xd4f1('0x25')][_0xd4f1('0x37')]();this[_0xd4f1('0x35')][_0x32cdc0['device']][_0xd4f1('0x3b')](_0x32cdc0);}}else if(this[_0xd4f1('0xd')][_0x32cdc0[_0xd4f1('0x33')]]){if(this[_0xd4f1('0xd')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x25')]!==_0x32cdc0['state'][_0xd4f1('0x37')]()){this[_0xd4f1('0xd')][_0x32cdc0[_0xd4f1('0x33')]]['stateTime']=_[_0xd4f1('0x3a')](moment()[_0xd4f1('0x2e')]('x'));}this[_0xd4f1('0xd')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x25')]=_0x32cdc0['state'][_0xd4f1('0x37')]();logger[_0xd4f1('0x2d')](_0xd4f1('0x3c'),util[_0xd4f1('0x1d')](this[_0xd4f1('0xd')][_0x32cdc0['device']],{'showHidden':![],'depth':null}));this[_0xd4f1('0x22')](util[_0xd4f1('0x2e')](_0xd4f1('0x3d'),this[_0xd4f1('0xd')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x30')]),_0xd4f1('0x3e'),this[_0xd4f1('0xd')][_0x32cdc0[_0xd4f1('0x33')]]);}else if(this[_0xd4f1('0xc')][_0x32cdc0[_0xd4f1('0x33')]]){if(this['trunks'][_0x32cdc0[_0xd4f1('0x33')]]['state']!==_0x32cdc0[_0xd4f1('0x25')]['toLowerCase']()){this[_0xd4f1('0xc')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x39')]=_[_0xd4f1('0x3a')](moment()['format']('x'));}this[_0xd4f1('0xc')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x25')]=_0x32cdc0[_0xd4f1('0x25')][_0xd4f1('0x37')]();logger[_0xd4f1('0x2d')](_0xd4f1('0x3f'),util[_0xd4f1('0x1d')](this[_0xd4f1('0xc')][_0x32cdc0[_0xd4f1('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xd4f1('0x2e')](_0xd4f1('0x2f'),this[_0xd4f1('0xc')][_0x32cdc0[_0xd4f1('0x33')]][_0xd4f1('0x30')]),_0xd4f1('0x31'),this[_0xd4f1('0xc')][_0x32cdc0[_0xd4f1('0x33')]]);}else if(_[_0xd4f1('0x40')](_0x32cdc0[_0xd4f1('0x33')],_0xd4f1('0x41'))){var _0xec4e9e=_0x32cdc0[_0xd4f1('0x33')];var _0x3bde61=_0xec4e9e[_0xd4f1('0x42')](_0xec4e9e[_0xd4f1('0x43')]('/')+0x1,_0xec4e9e['indexOf']('@'));var _0x5c25d7=_[_0xd4f1('0x27')](this[_0xd4f1('0x35')],function(_0x3db7a2){return _0x3db7a2[_0xd4f1('0x44')]==_0x3bde61||_0x3db7a2[_0xd4f1('0x45')]==_0x3bde61||_0x3db7a2[_0xd4f1('0x46')]==_0x3bde61;});if(_0x5c25d7){if(_0x5c25d7[_0xd4f1('0x25')]!==_0x32cdc0[_0xd4f1('0x25')][_0xd4f1('0x37')]()){_0x5c25d7[_0xd4f1('0x39')]=_[_0xd4f1('0x3a')](moment()[_0xd4f1('0x2e')]('x'));}_0x5c25d7['state']=_0x32cdc0[_0xd4f1('0x25')]['toLowerCase']();_0x5c25d7[_0xd4f1('0x36')]=!![];_0x5c25d7[_0xd4f1('0x3b')](_0x32cdc0);}}}}catch(_0x19c0bc){logger[_0xd4f1('0x19')](_0xd4f1('0x34'),util[_0xd4f1('0x1d')](_0x19c0bc,{'showHidden':![],'depth':null}));}};UserReport[_0xd4f1('0x1f')][_0xd4f1('0x15')]=function(_0x36f38e){try{if(this[_0xd4f1('0x20')](_0x36f38e)&&this[_0xd4f1('0x20')](_0x36f38e['peerstatus'])){logger['info'](_0xd4f1('0x47'),_0x36f38e[_0xd4f1('0x48')],_0x36f38e[_0xd4f1('0x49')],_0x36f38e[_0xd4f1('0x14')]);logger['debug'](_0xd4f1('0x4a'),util[_0xd4f1('0x1d')](_0x36f38e,{'showHidden':![],'depth':null}));if(this['agents'][_0x36f38e[_0xd4f1('0x48')]]){if(!this[_0xd4f1('0x35')][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x36')]||_0x36f38e['peerstatus'][_0xd4f1('0x37')]()=='registered'){this[_0xd4f1('0x35')][_0x36f38e['peer']][_0xd4f1('0x36')]=![];this[_0xd4f1('0x35')][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x4b')]=_0x36f38e[_0xd4f1('0x14')]['toLowerCase']();this[_0xd4f1('0x35')][_0x36f38e['peer']][_0xd4f1('0x49')]=_0x36f38e['address'];this['agents'][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x3b')](_0x36f38e);}}else if(this['telephones'][_0x36f38e['peer']]){this[_0xd4f1('0xd')][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x4b')]=_0x36f38e[_0xd4f1('0x14')]['toLowerCase']();this[_0xd4f1('0xd')][_0x36f38e[_0xd4f1('0x48')]]['address']=_0x36f38e[_0xd4f1('0x49')];logger[_0xd4f1('0x2d')](_0xd4f1('0x4c'),util['inspect'](this[_0xd4f1('0xd')][_0x36f38e[_0xd4f1('0x48')]],{'showHidden':![],'depth':null}));this[_0xd4f1('0x22')](util[_0xd4f1('0x2e')]('telephone:%s',this[_0xd4f1('0xd')][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x30')]),_0xd4f1('0x3e'),this[_0xd4f1('0xd')][_0x36f38e[_0xd4f1('0x48')]]);}else if(this[_0xd4f1('0xc')][_0x36f38e[_0xd4f1('0x48')]]){this[_0xd4f1('0xc')][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x4b')]=_0x36f38e[_0xd4f1('0x14')]['toLowerCase']();this[_0xd4f1('0xc')][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x49')]=_0x36f38e['address'];logger['debug'](_0xd4f1('0x4d'),util[_0xd4f1('0x1d')](this[_0xd4f1('0xc')][_0x36f38e[_0xd4f1('0x48')]],{'showHidden':![],'depth':null}));this[_0xd4f1('0x22')](util['format']('trunk:%s',this[_0xd4f1('0xc')][_0x36f38e[_0xd4f1('0x48')]][_0xd4f1('0x30')]),'trunk:save',this[_0xd4f1('0xc')][_0x36f38e[_0xd4f1('0x48')]]);}}}catch(_0x4ae7b2){logger[_0xd4f1('0x19')](_0xd4f1('0x4a'),util[_0xd4f1('0x1d')](_0x4ae7b2,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x5f64=['bluebird','../../../config/logger','ami','../ami','redis','localhost','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','catch','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','stateRegistry','state','merge','actionid','format','trunk:%s','name','trunk:save','device','[userReport][devicestatechange]','local','inuse','toLowerCase','stateTime','toNumber','telephone:save','startsWith','Local','substring','indexOf','find','phone','updateStatusRealtime','syncPeerStatus','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','exports','lodash','moment','util','ioredis'];(function(_0x3ac1fd,_0x358b96){var _0x20036d=function(_0x4fcc4b){while(--_0x4fcc4b){_0x3ac1fd['push'](_0x3ac1fd['shift']());}};_0x20036d(++_0x358b96);}(_0x5f64,0x1ac));var _0x45f6=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x5f64[_0x235482];return _0x5f5bea;};'use strict';var _=require(_0x45f6('0x0'));var moment=require(_0x45f6('0x1'));var util=require(_0x45f6('0x2'));var Redis=require(_0x45f6('0x3'));var BPromise=require(_0x45f6('0x4'));var config=require('../../../config/environment');var logger=require(_0x45f6('0x5'))(_0x45f6('0x6'));var ami=require(_0x45f6('0x7'));config[_0x45f6('0x8')]=_['defaults'](config[_0x45f6('0x8')],{'host':_0x45f6('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x45f6('0x8')]));function UserReport(_0x292592){this[_0x45f6('0xa')]=_0x292592[_0x45f6('0xa')];this['agents']=_0x292592[_0x45f6('0xb')];this['telephones']=_0x292592[_0x45f6('0xc')];ami['on']('registryentry',this[_0x45f6('0xd')]['bind'](this));ami['on']('registry',this[_0x45f6('0xd')][_0x45f6('0xe')](this));ami['on'](_0x45f6('0xf'),this[_0x45f6('0x10')][_0x45f6('0xe')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x45f6('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0x45f6('0x11')](ami[_0x45f6('0x12')]())['catch'](function(_0x4e5781){logger[_0x45f6('0x13')](_0x45f6('0x14'),util[_0x45f6('0x15')](_0x4e5781,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x45f6('0x16')]()[_0x45f6('0x11')](ami[_0x45f6('0x17')]())[_0x45f6('0x18')](function(_0x429333){logger[_0x45f6('0x13')](_0x45f6('0x19'),util[_0x45f6('0x15')](_0x429333,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x45f6('0x16')]()[_0x45f6('0x11')](ami[_0x45f6('0x1a')]())[_0x45f6('0x18')](function(_0x3523ee){logger['error'](_0x45f6('0x1b'),util[_0x45f6('0x15')](_0x3523ee,{'showHidden':![],'depth':null}));});}UserReport[_0x45f6('0x1c')][_0x45f6('0x1d')]=function(){setInterval(function(){BPromise[_0x45f6('0x16')]()[_0x45f6('0x11')](showSipRegistrations())[_0x45f6('0x11')](listDeviceStates())[_0x45f6('0x11')](showPeersStatus());},0x32c8);};UserReport[_0x45f6('0x1c')][_0x45f6('0x1e')]=function(_0x1cad41){return _0x1cad41!==null&&!_[_0x45f6('0x1f')](_0x1cad41);};UserReport[_0x45f6('0x1c')][_0x45f6('0x20')]=function(_0x1e47f8,_0x5834be,_0x5c8947){io['to'](_0x1e47f8)['emit'](_0x5834be,_0x5c8947);};UserReport[_0x45f6('0x1c')]['syncRegistry']=function(_0x4a2f95){try{if(this['isNotNull'](_0x4a2f95)){logger[_0x45f6('0x21')](_0x45f6('0x22'),_0x4a2f95[_0x45f6('0x23')],_0x4a2f95['state']);logger[_0x45f6('0x24')](_0x45f6('0x25'),util[_0x45f6('0x15')](_0x4a2f95,{'showHidden':![],'depth':null}));var _0x30c681=_['find'](this[_0x45f6('0xa')],{'defaultuser':_0x4a2f95[_0x45f6('0x23')]});if(_0x30c681){_0x4a2f95[_0x45f6('0x26')]=_0x4a2f95[_0x45f6('0x27')];_[_0x45f6('0x28')](_0x30c681,_['omit'](_0x4a2f95,['event',_0x45f6('0x29'),'username',_0x45f6('0x27')]));logger[_0x45f6('0x24')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x45f6('0x15')](_0x30c681,{'showHidden':![],'depth':null}));this[_0x45f6('0x20')](util[_0x45f6('0x2a')](_0x45f6('0x2b'),_0x30c681[_0x45f6('0x2c')]),_0x45f6('0x2d'),_0x30c681);}}}catch(_0x2cfd3d){logger[_0x45f6('0x13')]('[userReport][registry]',util[_0x45f6('0x15')](_0x2cfd3d,{'showHidden':![],'depth':null}));}};UserReport[_0x45f6('0x1c')]['syncDeviceState']=function(_0x2e6e01){try{if(this[_0x45f6('0x1e')](_0x2e6e01)){logger[_0x45f6('0x21')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x2e6e01[_0x45f6('0x2e')],_0x2e6e01[_0x45f6('0x27')]);logger[_0x45f6('0x24')](_0x45f6('0x2f'),util[_0x45f6('0x15')](_0x2e6e01,{'showHidden':![],'depth':null}));if(this['agents'][_0x2e6e01[_0x45f6('0x2e')]]){if(!this[_0x45f6('0xb')][_0x2e6e01[_0x45f6('0x2e')]][_0x45f6('0x30')]||_0x2e6e01['state']['toLowerCase']()==_0x45f6('0x31')){this[_0x45f6('0xb')][_0x2e6e01[_0x45f6('0x2e')]]['local']=![];if(this[_0x45f6('0xb')][_0x2e6e01[_0x45f6('0x2e')]][_0x45f6('0x27')]!==_0x2e6e01[_0x45f6('0x27')][_0x45f6('0x32')]()){this[_0x45f6('0xb')][_0x2e6e01[_0x45f6('0x2e')]][_0x45f6('0x33')]=_[_0x45f6('0x34')](moment()['format']('x'));}this['agents'][_0x2e6e01[_0x45f6('0x2e')]][_0x45f6('0x27')]=_0x2e6e01[_0x45f6('0x27')][_0x45f6('0x32')]();this['agents'][_0x2e6e01['device']]['updateStatusRealtime'](_0x2e6e01);}}else if(this[_0x45f6('0xc')][_0x2e6e01[_0x45f6('0x2e')]]){if(this[_0x45f6('0xc')][_0x2e6e01['device']]['state']!==_0x2e6e01[_0x45f6('0x27')][_0x45f6('0x32')]()){this[_0x45f6('0xc')][_0x2e6e01[_0x45f6('0x2e')]]['stateTime']=_[_0x45f6('0x34')](moment()[_0x45f6('0x2a')]('x'));}this[_0x45f6('0xc')][_0x2e6e01['device']][_0x45f6('0x27')]=_0x2e6e01[_0x45f6('0x27')][_0x45f6('0x32')]();logger[_0x45f6('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x45f6('0xc')][_0x2e6e01[_0x45f6('0x2e')]],{'showHidden':![],'depth':null}));this[_0x45f6('0x20')](util['format']('telephone:%s',this[_0x45f6('0xc')][_0x2e6e01[_0x45f6('0x2e')]][_0x45f6('0x2c')]),_0x45f6('0x35'),this['telephones'][_0x2e6e01[_0x45f6('0x2e')]]);}else if(this[_0x45f6('0xa')][_0x2e6e01[_0x45f6('0x2e')]]){if(this[_0x45f6('0xa')][_0x2e6e01['device']][_0x45f6('0x27')]!==_0x2e6e01[_0x45f6('0x27')][_0x45f6('0x32')]()){this[_0x45f6('0xa')][_0x2e6e01['device']]['stateTime']=_[_0x45f6('0x34')](moment()['format']('x'));}this[_0x45f6('0xa')][_0x2e6e01['device']][_0x45f6('0x27')]=_0x2e6e01[_0x45f6('0x27')]['toLowerCase']();logger[_0x45f6('0x24')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x45f6('0x15')](this[_0x45f6('0xa')][_0x2e6e01[_0x45f6('0x2e')]],{'showHidden':![],'depth':null}));this[_0x45f6('0x20')](util[_0x45f6('0x2a')]('trunk:%s',this['trunks'][_0x2e6e01[_0x45f6('0x2e')]]['name']),_0x45f6('0x2d'),this[_0x45f6('0xa')][_0x2e6e01[_0x45f6('0x2e')]]);}else if(_[_0x45f6('0x36')](_0x2e6e01[_0x45f6('0x2e')],_0x45f6('0x37'))){var _0x4e4487=_0x2e6e01['device'];var _0x52dc25=_0x4e4487[_0x45f6('0x38')](_0x4e4487[_0x45f6('0x39')]('/')+0x1,_0x4e4487[_0x45f6('0x39')]('@'));var _0x541875=_[_0x45f6('0x3a')](this['agents'],function(_0x32d2ec){return _0x32d2ec['mobile']==_0x52dc25||_0x32d2ec[_0x45f6('0x3b')]==_0x52dc25||_0x32d2ec['accountcode']==_0x52dc25;});if(_0x541875){if(_0x541875['state']!==_0x2e6e01[_0x45f6('0x27')][_0x45f6('0x32')]()){_0x541875[_0x45f6('0x33')]=_[_0x45f6('0x34')](moment()[_0x45f6('0x2a')]('x'));}_0x541875[_0x45f6('0x27')]=_0x2e6e01[_0x45f6('0x27')][_0x45f6('0x32')]();_0x541875['local']=!![];_0x541875[_0x45f6('0x3c')](_0x2e6e01);}}}}catch(_0x28fe53){logger[_0x45f6('0x13')]('[userReport][devicestatechange]',util[_0x45f6('0x15')](_0x28fe53,{'showHidden':![],'depth':null}));}};UserReport[_0x45f6('0x1c')][_0x45f6('0x3d')]=function(_0x2c03b1){try{if(this[_0x45f6('0x1e')](_0x2c03b1)&&this[_0x45f6('0x1e')](_0x2c03b1[_0x45f6('0x3e')])){logger[_0x45f6('0x21')](_0x45f6('0x3f'),_0x2c03b1['peer'],_0x2c03b1[_0x45f6('0x40')],_0x2c03b1['peerstatus']);logger[_0x45f6('0x24')](_0x45f6('0x41'),util[_0x45f6('0x15')](_0x2c03b1,{'showHidden':![],'depth':null}));if(this[_0x45f6('0xb')][_0x2c03b1['peer']]){if(!this[_0x45f6('0xb')][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x30')]||_0x2c03b1[_0x45f6('0x3e')]['toLowerCase']()==_0x45f6('0x43')){this[_0x45f6('0xb')][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x30')]=![];this['agents'][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x44')]=_0x2c03b1[_0x45f6('0x3e')][_0x45f6('0x32')]();this[_0x45f6('0xb')][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x40')]=_0x2c03b1[_0x45f6('0x40')];this[_0x45f6('0xb')][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x3c')](_0x2c03b1);}}else if(this[_0x45f6('0xc')][_0x2c03b1['peer']]){this[_0x45f6('0xc')][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x44')]=_0x2c03b1[_0x45f6('0x3e')]['toLowerCase']();this[_0x45f6('0xc')][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x40')]=_0x2c03b1['address'];logger[_0x45f6('0x24')](_0x45f6('0x45'),util['inspect'](this[_0x45f6('0xc')][_0x2c03b1[_0x45f6('0x42')]],{'showHidden':![],'depth':null}));this[_0x45f6('0x20')](util['format'](_0x45f6('0x46'),this[_0x45f6('0xc')][_0x2c03b1[_0x45f6('0x42')]]['name']),_0x45f6('0x35'),this[_0x45f6('0xc')][_0x2c03b1['peer']]);}else if(this['trunks'][_0x2c03b1[_0x45f6('0x42')]]){this[_0x45f6('0xa')][_0x2c03b1['peer']]['status']=_0x2c03b1['peerstatus'][_0x45f6('0x32')]();this[_0x45f6('0xa')][_0x2c03b1['peer']][_0x45f6('0x40')]=_0x2c03b1[_0x45f6('0x40')];logger[_0x45f6('0x24')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x45f6('0x15')](this[_0x45f6('0xa')][_0x2c03b1[_0x45f6('0x42')]],{'showHidden':![],'depth':null}));this[_0x45f6('0x20')](util[_0x45f6('0x2a')](_0x45f6('0x2b'),this['trunks'][_0x2c03b1[_0x45f6('0x42')]][_0x45f6('0x2c')]),'trunk:save',this[_0x45f6('0xa')][_0x2c03b1[_0x45f6('0x42')]]);}}}catch(_0x2abe86){logger[_0x45f6('0x13')](_0x45f6('0x41'),util[_0x45f6('0x15')](_0x2abe86,{'showHidden':![],'depth':null}));}};module[_0x45f6('0x47')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9670412..1f1cb46 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x5ef296,_0x27c9d7){var _0x1bf8c0=function(_0xfc628b){while(--_0xfc628b){_0x5ef296['push'](_0x5ef296['shift']());}};_0x1bf8c0(++_0x27c9d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x394241,_0x50e232){var _0x17b9ac=function(_0x4bbb27){while(--_0x4bbb27){_0x394241['push'](_0x394241['shift']());}};_0x17b9ac(++_0x50e232);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 6ac3399..47ba24a 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ef0=['calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','user:agentcomplete','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transferType','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','syncNewChannel','newstate','varset','syncVarSet','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','keys','from-sip','split','exten','channel','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','pick','context','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','lastdata','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','find','isNil','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview'];(function(_0x3649b1,_0x83b638){var _0x5d5814=function(_0x1fddfa){while(--_0x1fddfa){_0x3649b1['push'](_0x3649b1['shift']());}};_0x5d5814(++_0x83b638);}(_0x3ef0,0x1da));var _0x03ef=function(_0x53baf7,_0x46c98e){_0x53baf7=_0x53baf7-0x0;var _0x383194=_0x3ef0[_0x53baf7];return _0x383194;};'use strict';var _=require(_0x03ef('0x0'));var moment=require(_0x03ef('0x1'));var util=require(_0x03ef('0x2'));var path=require('path');var Redis=require(_0x03ef('0x3'));var config=require(_0x03ef('0x4'));var logger=require(_0x03ef('0x5'))(_0x03ef('0x6'));var ami=require('../ami');var Channel=require(_0x03ef('0x7'));var RpcSetting=require(_0x03ef('0x8'));var applications=[_0x03ef('0x9'),'queue',_0x03ef('0xa'),_0x03ef('0xb'),_0x03ef('0xc'),_0x03ef('0xd')];var dispositions=[_0x03ef('0xe'),_0x03ef('0xf'),'FAILED',_0x03ef('0xe'),_0x03ef('0xe'),'NO\x20ANSWER',_0x03ef('0x10'),'BUSY',_0x03ef('0xf'),_0x03ef('0xf'),_0x03ef('0xf')];config[_0x03ef('0x11')]=_[_0x03ef('0x12')](config['redis'],{'host':_0x03ef('0x13'),'port':0x18eb});var io=require(_0x03ef('0x14'))(new Redis(config['redis']));function VoiceCallReport(_0xf8b1bf){this[_0x03ef('0x15')]=_0xf8b1bf[_0x03ef('0x15')];this[_0x03ef('0x16')]=_0xf8b1bf[_0x03ef('0x16')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0x03ef('0x17')][_0x03ef('0x18')](this));ami['on'](_0x03ef('0x19'),this[_0x03ef('0x17')][_0x03ef('0x18')](this));ami['on']('newchannel',this[_0x03ef('0x1a')][_0x03ef('0x18')](this));ami['on'](_0x03ef('0x1b'),this['syncNewState'][_0x03ef('0x18')](this));ami['on'](_0x03ef('0x1c'),this[_0x03ef('0x1d')][_0x03ef('0x18')](this));ami['on']('hangup',this[_0x03ef('0x1e')][_0x03ef('0x18')](this));ami['on']('newcallerid',this[_0x03ef('0x1f')]['bind'](this));ami['on'](_0x03ef('0x20'),this[_0x03ef('0x21')][_0x03ef('0x18')](this));ami['on'](_0x03ef('0x22'),this[_0x03ef('0x23')][_0x03ef('0x18')](this));ami['on'](_0x03ef('0x24'),this[_0x03ef('0x25')][_0x03ef('0x18')](this));ami['on'](_0x03ef('0x26'),this[_0x03ef('0x27')]['bind'](this));try{logger[_0x03ef('0x28')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x244be8){logger[_0x03ef('0x29')](_0x03ef('0x2a'),util[_0x03ef('0x2b')](_0x244be8,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x03ef('0x2c')][_0x03ef('0x2d')]=function(_0x37425f){return _0x37425f!==null&&!_[_0x03ef('0x2e')](_0x37425f);};VoiceCallReport[_0x03ef('0x2c')][_0x03ef('0x2f')]=function(_0x3115c7,_0x291bcf,_0x436d69){io['to'](_0x3115c7)[_0x03ef('0x2f')](_0x291bcf,_0x436d69);};VoiceCallReport[_0x03ef('0x2c')]['syncNewCallerId']=function(_0x34dbb9){try{if(this[_0x03ef('0x2d')](_0x34dbb9)){logger[_0x03ef('0x28')](_0x03ef('0x30'),_0x34dbb9[_0x03ef('0x31')],_0x34dbb9[_0x03ef('0x32')],_0x34dbb9[_0x03ef('0x33')]);logger[_0x03ef('0x34')](_0x03ef('0x35'),_0x34dbb9[_0x03ef('0x31')],util[_0x03ef('0x2b')](_0x34dbb9,{'showHidden':![],'depth':null}));if(_0x34dbb9['uniqueid']===_0x34dbb9['linkedid']){if(!_[_0x03ef('0x2e')](this[_0x03ef('0x15')][_0x34dbb9[_0x03ef('0x31')]])){_[_0x03ef('0x36')](this[_0x03ef('0x15')][_0x34dbb9[_0x03ef('0x31')]],_['pick'](_0x34dbb9,_[_0x03ef('0x37')](this[_0x03ef('0x15')][_0x34dbb9[_0x03ef('0x31')]])));}}if(_0x34dbb9['context']===_0x03ef('0x38')){if(this[_0x03ef('0x16')][_0x34dbb9['channel'][_0x03ef('0x39')]('-')[0x0]]){if(_0x34dbb9[_0x03ef('0x3a')]=='xcally-motion-preview'){this[_0x03ef('0x16')][_0x34dbb9[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x3c')]=_0x34dbb9[_0x03ef('0x3d')];this['emit'](util[_0x03ef('0x3e')]('user:%s',this['agents'][_0x34dbb9[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x3f')]),_0x03ef('0x40'),{'destaccountcode':this['agents'][_0x34dbb9['channel'][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x41')],'destconnectedlinenum':_0x34dbb9['connectedlinenum']});}}}}}catch(_0x3e8e3f){logger[_0x03ef('0x29')](_0x03ef('0x42'),_0x34dbb9[_0x03ef('0x31')],util['inspect'](_0x3e8e3f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x03ef('0x2c')]['syncNewChannel']=function(_0x5a2f0c){try{if(this[_0x03ef('0x2d')](_0x5a2f0c)){logger[_0x03ef('0x34')](_0x03ef('0x43'),_0x5a2f0c['uniqueid'],util[_0x03ef('0x2b')](_0x5a2f0c,{'showHidden':![],'depth':null}));if(_0x5a2f0c[_0x03ef('0x31')]===_0x5a2f0c[_0x03ef('0x44')]&&_0x5a2f0c['channel']!='OutgoingSpoolFailed'){if(_[_0x03ef('0x2e')](this[_0x03ef('0x15')][_0x5a2f0c['uniqueid']])){logger[_0x03ef('0x28')](_0x03ef('0x45'),_0x5a2f0c[_0x03ef('0x31')],_0x5a2f0c['context'],_0x5a2f0c['exten']);this[_0x03ef('0x15')][_0x5a2f0c['uniqueid']]=new Channel();this[_0x03ef('0x15')][_0x5a2f0c[_0x03ef('0x31')]][_0x03ef('0x46')]=moment()[_0x03ef('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5a2f0c['uniqueid']][_0x03ef('0x47')]=dispositions[_[_0x03ef('0x48')](_0x5a2f0c[_0x03ef('0x49')])];_['merge'](this[_0x03ef('0x15')][_0x5a2f0c[_0x03ef('0x31')]],_[_0x03ef('0x4a')](_0x5a2f0c,_['keys'](this[_0x03ef('0x15')][_0x5a2f0c[_0x03ef('0x31')]])));if(_0x5a2f0c[_0x03ef('0x4b')]===_0x03ef('0x38')){if(this[_0x03ef('0x16')][_0x5a2f0c['channel']['split']('-')[0x0]]){if(_[_0x03ef('0x2e')](this[_0x03ef('0x16')][_0x5a2f0c[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x5a2f0c[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x3c')]=_0x5a2f0c[_0x03ef('0x3a')];logger[_0x03ef('0x34')](_0x03ef('0x4c'),_0x5a2f0c[_0x03ef('0x31')],util[_0x03ef('0x2b')]({'id':this[_0x03ef('0x16')][_0x5a2f0c[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x03ef('0x16')][_0x5a2f0c[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5a2f0c[_0x03ef('0x3a')]},{'showHidden':![],'depth':null}));this[_0x03ef('0x2f')](util[_0x03ef('0x3e')](_0x03ef('0x4d'),this['agents'][_0x5a2f0c['channel'][_0x03ef('0x39')]('-')[0x0]]['name']),_0x03ef('0x40'),{'id':this[_0x03ef('0x16')][_0x5a2f0c['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x03ef('0x16')][_0x5a2f0c[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x41')],'destconnectedlinenum':_0x5a2f0c['exten']});}}}}}}}catch(_0x21e7f1){logger[_0x03ef('0x29')](_0x03ef('0x4e'),_0x5a2f0c[_0x03ef('0x31')],util[_0x03ef('0x2b')](_0x21e7f1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x03ef('0x17')]=function(_0x4b5809){try{if(this[_0x03ef('0x2d')](_0x4b5809)){logger['debug'](_0x03ef('0x4f'),_0x4b5809[_0x03ef('0x31')],util[_0x03ef('0x2b')](_0x4b5809,{'showHidden':![],'depth':null}));if(_0x4b5809[_0x03ef('0x31')]===_0x4b5809[_0x03ef('0x44')]&&_0x4b5809[_0x03ef('0x3a')]!='h'&&_0x4b5809[_0x03ef('0x3b')]!='OutgoingSpoolFailed'){_0x4b5809[_0x03ef('0x50')]=_0x4b5809['application'][_0x03ef('0x51')]();_0x4b5809[_0x03ef('0x52')]=_0x4b5809[_0x03ef('0x53')]&&_0x4b5809['appdata'][_0x03ef('0x54')](_0x03ef('0x55'))?_0x4b5809['appdata']:(_0x4b5809[_0x03ef('0x53')]||_0x4b5809[_0x03ef('0x52')])[_0x03ef('0x51')]();logger[_0x03ef('0x28')](_0x03ef('0x56'),_0x4b5809[_0x03ef('0x31')],_0x4b5809[_0x03ef('0x50')],_0x4b5809[_0x03ef('0x52')]);if(_['isUndefined'](this['channels'][_0x4b5809[_0x03ef('0x31')]])){this['channels'][_0x4b5809[_0x03ef('0x31')]]=new Channel();this[_0x03ef('0x15')][_0x4b5809[_0x03ef('0x31')]]['starttime']=_0x4b5809[_0x03ef('0x57')]?moment()[_0x03ef('0x58')](moment[_0x03ef('0x57')](_0x4b5809[_0x03ef('0x57')])[_0x03ef('0x59')](),_0x03ef('0x59'))['format'](_0x03ef('0x5a')):moment()[_0x03ef('0x3e')](_0x03ef('0x5a'));this[_0x03ef('0x15')][_0x4b5809[_0x03ef('0x31')]][_0x03ef('0x47')]=_0x03ef('0xe');}_[_0x03ef('0x36')](this[_0x03ef('0x15')][_0x4b5809['uniqueid']],_[_0x03ef('0x4a')](_0x4b5809,_['keys'](this['channels'][_0x4b5809[_0x03ef('0x31')]])));if(_['includes'](applications,_0x4b5809[_0x03ef('0x50')])){this[_0x03ef('0x15')][_0x4b5809[_0x03ef('0x31')]][_0x03ef('0x5b')]=_0x4b5809[_0x03ef('0x50')];this[_0x03ef('0x15')][_0x4b5809[_0x03ef('0x31')]][_0x03ef('0x5c')]=_0x4b5809[_0x03ef('0x52')];if(_0x4b5809['application']===_0x03ef('0x9')&&_[_0x03ef('0x54')](_0x4b5809[_0x03ef('0x52')][_0x03ef('0x51')](),'cdr(')){var _0x24effa=_0x4b5809[_0x03ef('0x52')]['split']('=');var _0x1abcc7=_0x24effa[0x0][_0x03ef('0x51')]()[_0x03ef('0x5d')](/cdr\((.*)\)/);if(_0x1abcc7){this[_0x03ef('0x15')][_0x4b5809[_0x03ef('0x31')]][_0x1abcc7[0x1]]=_0x24effa[0x1];}}else if(_0x4b5809[_0x03ef('0x50')]==='queue'){this[_0x03ef('0x15')][_0x4b5809[_0x03ef('0x31')]][_0x03ef('0x5e')]=_0x4b5809[_0x03ef('0x52')][_0x03ef('0x39')](',')[0x0];}}}}}catch(_0x5047e7){logger[_0x03ef('0x29')](_0x03ef('0x5f'),_0x4b5809[_0x03ef('0x31')],util[_0x03ef('0x2b')](_0x5047e7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x56dd94){try{if(this['isNotNull'](_0x56dd94)){logger[_0x03ef('0x28')](_0x03ef('0x60'),_0x56dd94[_0x03ef('0x31')],_0x56dd94[_0x03ef('0x44')],_0x56dd94['calleridname'],_0x56dd94[_0x03ef('0x33')]);logger[_0x03ef('0x34')](_0x03ef('0x61'),_0x56dd94[_0x03ef('0x31')],util[_0x03ef('0x2b')](_0x56dd94,{'showHidden':![],'depth':null}));if(_0x56dd94[_0x03ef('0x31')]!==_0x56dd94[_0x03ef('0x44')]){if(this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]]){if(_0x56dd94['channelstate']==='6'){if(!this[_0x03ef('0x15')][_0x56dd94['linkedid']][_0x03ef('0x62')]){var _0x3549ce=moment();this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x62')]=!![];this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x63')]=_0x3549ce[_0x03ef('0x3e')](_0x03ef('0x5a'));if(this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x46')]){this[_0x03ef('0x15')][_0x56dd94['linkedid']][_0x03ef('0x64')]=_0x3549ce[_0x03ef('0x65')](this[_0x03ef('0x15')][_0x56dd94['linkedid']][_0x03ef('0x46')],_0x03ef('0x59'));}}this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x44')]=_0x56dd94[_0x03ef('0x31')];if(_0x56dd94['calleridnum']!==_0x03ef('0x66')){this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x3d')]=_0x56dd94[_0x03ef('0x33')];}this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x67')]=_0x56dd94[_0x03ef('0x32')];this['channels'][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x68')]=_0x56dd94[_0x03ef('0x3b')];this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]]['disposition']=dispositions[_['toNumber'](_0x56dd94['channelstate'])];if(this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]){this['channels'][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x69')]=this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]['id'];this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x6a')]=this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x3f')];}}}}else{if(this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x31')]]){if(_0x56dd94['channelstate']==='6'){if(this['agents'][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]){this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x31')]][_0x03ef('0x69')]=this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]['id'];this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x31')]][_0x03ef('0x6a')]=this[_0x03ef('0x16')][_0x56dd94['channel']['split']('-')[0x0]][_0x03ef('0x3f')];}}}}if(_0x56dd94[_0x03ef('0x49')]==='6'&&_0x56dd94[_0x03ef('0x4b')]===_0x03ef('0x38')){if(this[_0x03ef('0x16')][_0x56dd94['channel'][_0x03ef('0x39')]('-')[0x0]]){this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')]['split']('-')[0x0]][_0x03ef('0x3c')]=_0x56dd94['exten'];var _0x9b5adf,_0x2a71e;if(this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x31')]]){_0x9b5adf=this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x31')]][_0x03ef('0x6b')];_0x2a71e=this['channels'][_0x56dd94['uniqueid']][_0x03ef('0x5e')];}else if(this[_0x03ef('0x15')][_0x56dd94['linkedid']]){_0x9b5adf=this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x6b')];_0x2a71e=this[_0x03ef('0x15')][_0x56dd94[_0x03ef('0x44')]][_0x03ef('0x5e')];}logger['debug'](_0x03ef('0x6c'),_0x56dd94[_0x03ef('0x31')],util[_0x03ef('0x2b')]({'id':this['agents'][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x41')],'destconnectedlinenum':_0x56dd94[_0x03ef('0x3a')],'routealias':_0x9b5adf,'queue':_0x2a71e||undefined},{'showHidden':![],'depth':null}));this['emit'](util[_0x03ef('0x3e')](_0x03ef('0x4d'),this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x3f')]),_0x03ef('0x40'),{'id':this['agents'][_0x56dd94[_0x03ef('0x3b')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x03ef('0x16')][_0x56dd94[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x56dd94[_0x03ef('0x3a')],'routealias':_0x9b5adf,'queue':_0x2a71e||undefined});}}}}catch(_0x5bb287){logger[_0x03ef('0x29')](_0x03ef('0x6d'),_0x56dd94[_0x03ef('0x31')],util['inspect'](_0x5bb287,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x03ef('0x2c')]['syncMixMonitorFilename']=function(_0x33b37f,_0x2263a5){try{if(this[_0x03ef('0x15')][_0x33b37f]){logger[_0x03ef('0x28')](_0x03ef('0x6e'),_0x33b37f,_0x2263a5);this['channels'][_0x33b37f][_0x03ef('0x6f')]=!![];if(_[_0x03ef('0x70')](_0x2263a5,'.wav49')){_0x2263a5=_0x2263a5[_0x03ef('0x71')]('.wav49',_0x03ef('0x72'));}this[_0x03ef('0x15')][_0x33b37f][_0x03ef('0x73')]=_0x2263a5;var _0x3c2f1a=_[_0x03ef('0x74')](this[_0x03ef('0x15')][_0x33b37f]['monitors'],{'filename':_0x2263a5});if(_[_0x03ef('0x75')](_0x3c2f1a)){this[_0x03ef('0x15')][_0x33b37f][_0x03ef('0x76')]['push']({'filename':_0x2263a5,'createdAt':moment()['format'](_0x03ef('0x5a')),'mixmonitorid':'','status':_0x03ef('0x77')});}}}catch(_0x1910ac){logger[_0x03ef('0x29')](_0x03ef('0x78'),_0x33b37f,util[_0x03ef('0x2b')](_0x1910ac,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x03ef('0x1d')]=function(_0x5c03af){try{if(this['isNotNull'](_0x5c03af)){logger['debug'](_0x03ef('0x79'),_0x5c03af[_0x03ef('0x31')],util[_0x03ef('0x2b')](_0x5c03af,{'showHidden':![],'depth':null}));if(this[_0x03ef('0x15')][_0x5c03af[_0x03ef('0x31')]]&&_0x5c03af['channel']!=_0x03ef('0x7a')){if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')])){if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x7c')])){logger['info'](_0x03ef('0x7d'),_0x5c03af[_0x03ef('0x31')],_0x5c03af[_0x03ef('0x7e')]);this[_0x03ef('0x7f')](_0x5c03af[_0x03ef('0x31')],_0x5c03af[_0x03ef('0x7e')]);}else if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x80')])){logger[_0x03ef('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5c03af[_0x03ef('0x31')],_0x5c03af['value']);this[_0x03ef('0x15')][_0x5c03af[_0x03ef('0x31')]][_0x03ef('0x33')]=_0x5c03af[_0x03ef('0x7e')];}else if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x81')])){logger[_0x03ef('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x5c03af[_0x03ef('0x31')],_0x5c03af[_0x03ef('0x7e')]);this[_0x03ef('0x15')][_0x5c03af['uniqueid']][_0x03ef('0x82')]=_0x5c03af[_0x03ef('0x7e')];}else if(this[_0x03ef('0x2d')](_0x5c03af['variable']['xmd-cdrtype'])){logger[_0x03ef('0x28')](_0x03ef('0x83'),_0x5c03af[_0x03ef('0x31')],_0x5c03af['value']);this['channels'][_0x5c03af[_0x03ef('0x31')]][_0x03ef('0x84')]=_0x5c03af[_0x03ef('0x7e')];}else if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x85')])){logger[_0x03ef('0x28')](_0x03ef('0x86'),_0x5c03af['uniqueid'],_0x5c03af[_0x03ef('0x7e')][_0x03ef('0x39')](',')[0x0]);this[_0x03ef('0x15')][_0x5c03af[_0x03ef('0x31')]]['queue']=_0x5c03af[_0x03ef('0x7e')][_0x03ef('0x39')](',')[0x0];}else if(this[_0x03ef('0x2d')](_0x5c03af['variable'][_0x03ef('0x87')])){logger[_0x03ef('0x28')](_0x03ef('0x88'),_0x5c03af[_0x03ef('0x31')],_0x5c03af[_0x03ef('0x7e')]);this[_0x03ef('0x15')][_0x5c03af['uniqueid']]['originatecalleridnum']=_0x5c03af[_0x03ef('0x7e')];}else if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x89')])){logger[_0x03ef('0x28')](_0x03ef('0x8a'),_0x5c03af[_0x03ef('0x31')],_0x5c03af[_0x03ef('0x7e')]);this['channels'][_0x5c03af[_0x03ef('0x31')]][_0x03ef('0x8b')]=_0x5c03af[_0x03ef('0x7e')];}else if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x8c')])){logger[_0x03ef('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5c03af[_0x03ef('0x31')],_0x5c03af['value']);this[_0x03ef('0x15')][_0x5c03af[_0x03ef('0x31')]][_0x03ef('0x8d')]=_0x5c03af[_0x03ef('0x7e')];}else if(this[_0x03ef('0x2d')](_0x5c03af['variable'][_0x03ef('0x8e')])){logger[_0x03ef('0x28')](_0x03ef('0x8f'),_0x5c03af[_0x03ef('0x31')],_0x5c03af[_0x03ef('0x7e')]);this[_0x03ef('0x15')][_0x5c03af[_0x03ef('0x31')]][_0x03ef('0x5e')]=_0x5c03af[_0x03ef('0x7e')];}else if(this[_0x03ef('0x2d')](_0x5c03af['variable'][_0x03ef('0x90')])){logger[_0x03ef('0x28')](_0x03ef('0x91'),_0x5c03af[_0x03ef('0x31')],_0x5c03af[_0x03ef('0x7e')]);this[_0x03ef('0x15')][_0x5c03af[_0x03ef('0x31')]]['sipcalluniqueid']=_0x5c03af[_0x03ef('0x7e')];}}}else if(this['isNotNull'](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x7c')])){if(_0x5c03af[_0x03ef('0x7e')]){var _0x101cd6=path[_0x03ef('0x92')](_0x5c03af[_0x03ef('0x7e')])[_0x03ef('0x3f')];logger[_0x03ef('0x28')](_0x03ef('0x7d'),_0x101cd6,_0x5c03af[_0x03ef('0x7e')]);this[_0x03ef('0x7f')](_0x101cd6,_0x5c03af[_0x03ef('0x7e')]);}}else if(this['channels'][_0x5c03af[_0x03ef('0x44')]]){if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')])){if(this[_0x03ef('0x2d')](_0x5c03af[_0x03ef('0x7b')][_0x03ef('0x90')])){logger[_0x03ef('0x28')](_0x03ef('0x91'),_0x5c03af[_0x03ef('0x44')],_0x5c03af[_0x03ef('0x7e')]);this[_0x03ef('0x15')][_0x5c03af[_0x03ef('0x44')]][_0x03ef('0x93')]=_0x5c03af[_0x03ef('0x7e')];}}}}}catch(_0x175f25){logger[_0x03ef('0x29')](_0x03ef('0x94'),_0x5c03af['uniqueid'],util[_0x03ef('0x2b')](_0x175f25,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x03ef('0x2c')][_0x03ef('0x1e')]=function(_0x4caa97){try{if(this[_0x03ef('0x2d')](_0x4caa97)){logger['debug'](_0x03ef('0x95'),_0x4caa97[_0x03ef('0x31')],util[_0x03ef('0x2b')](_0x4caa97,{'showHidden':![],'depth':null}));if(this[_0x03ef('0x15')][_0x4caa97['uniqueid']]){logger[_0x03ef('0x28')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x4caa97[_0x03ef('0x31')],_0x4caa97[_0x03ef('0x96')]);var _0xf9420b=moment();this[_0x03ef('0x15')][_0x4caa97[_0x03ef('0x31')]][_0x03ef('0x97')]=_0xf9420b[_0x03ef('0x3e')](_0x03ef('0x5a'));this[_0x03ef('0x15')][_0x4caa97[_0x03ef('0x31')]][_0x03ef('0x57')]=_0xf9420b[_0x03ef('0x65')](this[_0x03ef('0x15')][_0x4caa97[_0x03ef('0x31')]][_0x03ef('0x46')],'seconds');if(this['channels'][_0x4caa97['uniqueid']]['answered']){this[_0x03ef('0x15')][_0x4caa97[_0x03ef('0x31')]][_0x03ef('0x98')]=_0xf9420b[_0x03ef('0x65')](this[_0x03ef('0x15')][_0x4caa97[_0x03ef('0x31')]][_0x03ef('0x63')],_0x03ef('0x59'));this[_0x03ef('0x15')][_0x4caa97['uniqueid']][_0x03ef('0x64')]=this[_0x03ef('0x15')][_0x4caa97[_0x03ef('0x31')]][_0x03ef('0x57')]-this['channels'][_0x4caa97[_0x03ef('0x31')]][_0x03ef('0x98')];}if(_0x4caa97[_0x03ef('0x4b')]===_0x03ef('0x38')){if(this[_0x03ef('0x16')][_0x4caa97[_0x03ef('0x3b')]['split']('-')[0x0]]){this[_0x03ef('0x16')][_0x4caa97[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]]=_['omit'](this['agents'][_0x4caa97['channel'][_0x03ef('0x39')]('-')[0x0]],[_0x03ef('0x3c')]);logger[_0x03ef('0x34')](_0x03ef('0x99'),_0x4caa97[_0x03ef('0x31')],util[_0x03ef('0x2b')]({'id':this[_0x03ef('0x16')][_0x4caa97[_0x03ef('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x03ef('0x16')][_0x4caa97[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x41')]},{'showHidden':![],'depth':null}));this[_0x03ef('0x2f')](util[_0x03ef('0x3e')](_0x03ef('0x4d'),this['agents'][_0x4caa97[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x3f')]),'user:agentcomplete',{'id':this[_0x03ef('0x16')][_0x4caa97['channel'][_0x03ef('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x03ef('0x16')][_0x4caa97[_0x03ef('0x3b')][_0x03ef('0x39')]('-')[0x0]][_0x03ef('0x41')]});for(var _0x1482f7=0x0;_0x1482f70x0?_0x5330b4:0x0;this[_0x5056('0x14')][_0x2df8e8['queue']]['talking']=this[_0x5056('0x14')][_0x2df8e8[_0x5056('0x6e')]][_0x5056('0x32')]>_[_0x5056('0x72')](_0x2df8e8['loggedin'])?_['toNumber'](_0x2df8e8[_0x5056('0x74')]):this[_0x5056('0x14')][_0x2df8e8[_0x5056('0x6e')]]['talking'];this[_0x5056('0x75')](this['voiceQueues'][_0x2df8e8[_0x5056('0x6e')]],_0x5056('0x6b'));}logger[_0x5056('0x49')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x5056('0x40')](this[_0x5056('0x14')][_0x2df8e8[_0x5056('0x6e')]],{'showHidden':![],'depth':null}));ami[_0x5056('0x47')](_0x5056('0x76'),this[_0x5056('0x14')][_0x2df8e8[_0x5056('0x6e')]]);}}}catch(_0x503f09){logger[_0x5056('0x3e')](_0x5056('0x6d'),util[_0x5056('0x40')](_0x503f09,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5056('0x77')]=function(_0x4ea1c5){logger[_0x5056('0x49')](_0x5056('0x78'),util[_0x5056('0x40')](_0x4ea1c5,{'showHidden':![],'depth':null}));this[_0x5056('0x6a')]=!![];};VoiceQueueReport['prototype'][_0x5056('0x1a')]=function(_0x218466){try{if(this['isNotNull'](_0x218466)){logger[_0x5056('0x49')]('[%s][voiceQueueReport][queuecallerjoin]',_0x218466['uniqueid'],util[_0x5056('0x40')](_0x218466,{'showHidden':![],'depth':null}));if(_[_0x5056('0x67')](this[_0x5056('0x41')][_0x218466[_0x5056('0x4c')]]))this[_0x5056('0x41')][_0x218466[_0x5056('0x4c')]]=[];if(_[_0x5056('0x67')](this[_0x5056('0x13')][_0x218466[_0x5056('0x4c')]]))this[_0x5056('0x13')][_0x218466[_0x5056('0x4c')]]={};var _0x153143=new QueueReport();_0x153143['name']=_0x218466[_0x5056('0x6e')];_0x153143['type']=this[_0x5056('0x14')][_0x153143[_0x5056('0x4e')]]&&this['voiceQueues'][_0x153143[_0x5056('0x4e')]][_0x5056('0x55')]?this[_0x5056('0x14')][_0x153143[_0x5056('0x4e')]][_0x5056('0x55')]||_0x5056('0x79'):_0x5056('0x79');_0x153143[_0x5056('0x6e')]=_0x218466['queue'];_0x153143[_0x5056('0x7a')]=moment()[_0x5056('0x64')](_0x5056('0x7b'));_0x153143[_0x5056('0x7c')]=_0x218466[_0x5056('0x7c')];_0x153143['count']=_0x218466[_0x5056('0x7d')];_0x153143['uniqueid']=_0x218466[_0x5056('0x4c')];_0x153143[_0x5056('0x7e')]=this[_0x5056('0x13')][_0x218466[_0x5056('0x4c')]][_0x5056('0x7e')];logger[_0x5056('0x70')](_0x5056('0x7f'),_0x153143['name'],_0x153143[_0x5056('0x55')]);_[_0x5056('0x80')](_0x153143,_[_0x5056('0x81')](_0x218466,_[_0x5056('0x82')](_0x153143)));this[_0x5056('0x41')][_0x218466[_0x5056('0x4c')]][_0x5056('0x83')](_0x153143);this['channels'][_0x218466['uniqueid']]=_0x153143;this['emitVoiceQueueChannelSave'](_0x153143,_0x5056('0x19'));}}catch(_0x5207a0){logger[_0x5056('0x3e')](_0x5056('0x84'),_0x218466[_0x5056('0x4c')],util['inspect'](_0x5207a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5056('0x35')]['syncQueueCallerAbandon']=function(_0x895e06){try{if(this[_0x5056('0x66')](_0x895e06)){logger[_0x5056('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x895e06[_0x5056('0x4c')],util['inspect'](_0x895e06,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x895e06[_0x5056('0x4c')]]){var _0x373106=_['last'](this[_0x5056('0x41')][_0x895e06['uniqueid']]);_0x373106[_0x5056('0x85')]=![];_0x373106[_0x5056('0x86')]=null;_0x373106[_0x5056('0x87')]=_0x895e06[_0x5056('0x87')];_0x373106[_0x5056('0x88')]=_0x895e06[_0x5056('0x88')];_0x373106['queuecallerabandon']=!![];_0x373106[_0x5056('0x89')]=moment()[_0x5056('0x64')](_0x5056('0x7b'));_0x373106[_0x5056('0x8a')]=_0x5056('0x8b');_0x373106[_0x5056('0x8c')]=null;logger['info'](_0x5056('0x8d'),_0x373106['name'],_0x373106[_0x5056('0x55')]);this[_0x5056('0x13')][_0x895e06[_0x5056('0x4c')]]=_0x373106;this[_0x5056('0x51')](_0x373106,_0x5056('0x1b'));}}}catch(_0x577d7f){logger[_0x5056('0x3e')](_0x5056('0x8e'),_0x895e06[_0x5056('0x4c')],util[_0x5056('0x40')](_0x577d7f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5056('0x35')][_0x5056('0x8f')]=function(_0x87010e){try{if(this[_0x5056('0x66')](_0x87010e)){logger[_0x5056('0x49')](_0x5056('0x90'),_0x87010e[_0x5056('0x4c')],util[_0x5056('0x40')](_0x87010e,{'showHidden':![],'depth':null}));if(this[_0x5056('0x41')][_0x87010e[_0x5056('0x4c')]]){var _0x2bfda5=_[_0x5056('0x91')](this[_0x5056('0x41')][_0x87010e[_0x5056('0x4c')]]);_0x2bfda5[_0x5056('0x92')]=moment()[_0x5056('0x64')](_0x5056('0x7b'));_0x2bfda5['connectedlinenum']=_0x87010e[_0x5056('0x93')];_0x2bfda5['connectedlinename']=_0x87010e[_0x5056('0x94')];logger[_0x5056('0x70')](_0x5056('0x95'),_0x2bfda5[_0x5056('0x4e')],_0x2bfda5['type'],_0x87010e[_0x5056('0x93')],_0x87010e[_0x5056('0x94')]);this[_0x5056('0x13')][_0x87010e[_0x5056('0x4c')]]=_0x2bfda5;this[_0x5056('0x48')](_0x2bfda5,'queuecallerleave');}}}catch(_0x1c5dab){logger[_0x5056('0x3e')](_0x5056('0x90'),_0x87010e['uniqueid'],util[_0x5056('0x40')](_0x1c5dab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5056('0x35')][_0x5056('0x96')]=function(_0x30aed2){try{if(this[_0x5056('0x66')](_0x30aed2)){logger[_0x5056('0x49')](_0x5056('0x97'),_0x30aed2[_0x5056('0x4c')],util[_0x5056('0x40')](_0x30aed2,{'showHidden':![],'depth':null}));if(this[_0x5056('0x41')][_0x30aed2[_0x5056('0x4c')]]){var _0x11fc7f=_[_0x5056('0x91')](this[_0x5056('0x41')][_0x30aed2[_0x5056('0x4c')]]);_0x11fc7f[_0x5056('0x85')]=!![];_0x11fc7f['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x5056('0x70')](_0x5056('0x98'),_0x11fc7f[_0x5056('0x4e')],_0x11fc7f[_0x5056('0x55')]);}}}catch(_0x2d635d){logger[_0x5056('0x3e')](_0x5056('0x97'),_0x30aed2[_0x5056('0x4c')],util[_0x5056('0x40')](_0x2d635d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5056('0x1f')]=function(_0x12e696){try{if(this['isNotNull'](_0x12e696)){logger[_0x5056('0x49')]('[%s][voiceQueueReport][agentcomplete]',_0x12e696[_0x5056('0x4c')],util[_0x5056('0x40')](_0x12e696,{'showHidden':![],'depth':null}));if(this[_0x5056('0x41')][_0x12e696['uniqueid']]){var _0x284c76=_[_0x5056('0x91')](this[_0x5056('0x41')][_0x12e696[_0x5056('0x4c')]]);_0x284c76[_0x5056('0x1b')]=![];_0x284c76[_0x5056('0x89')]=null;_0x284c76[_0x5056('0x99')]=!![];_0x284c76[_0x5056('0x8c')]=_0x12e696[_0x5056('0x9a')];_0x284c76[_0x5056('0x87')]=_0x12e696[_0x5056('0x87')];_0x284c76[_0x5056('0x85')]=!![];_0x284c76['queuecallerexit']=![];_0x284c76[_0x5056('0x9b')]=null;if(!_0x284c76['transfer']){if(_0x12e696[_0x5056('0x9c')]=='transfer'){_0x284c76[_0x5056('0x8a')]='COMPLETED';logger[_0x5056('0x70')](_0x5056('0x9d'),_0x284c76[_0x5056('0x4e')],_0x284c76['type']);}else{if(_['startsWith'](_0x12e696[_0x5056('0x3a')][_0x5056('0x9e')](),_0x5056('0x9f'))){if(this[_0x5056('0x41')][_0x12e696[_0x5056('0xa0')]]){var _0x21e51c=_[_0x5056('0x91')](this['queueReports'][_0x12e696['linkedid']]);_0x21e51c[_0x5056('0x85')]=![];_0x21e51c[_0x5056('0xa1')]=!![];_0x21e51c[_0x5056('0x9b')]=moment(_0x284c76[_0x5056('0x7a')])[_0x5056('0xa2')](_0x12e696['holdtime'],_0x5056('0xa3'))[_0x5056('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x21e51c[_0x5056('0x8a')]=_0x5056('0xa4');_0x21e51c[_0x5056('0xa5')]=!![];_0x21e51c[_0x5056('0xa6')]=_0x5056('0xa7');_0x21e51c[_0x5056('0xa8')]=_0x12e696[_0x5056('0xa9')];_0x21e51c[_0x5056('0xaa')]=_0x12e696['uniqueid'];logger[_0x5056('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x21e51c[_0x5056('0x4e')],_0x21e51c[_0x5056('0x55')]);var _0x18c58a=this[_0x5056('0x41')][_0x12e696['linkedid']];this[_0x5056('0x41')][_0x12e696[_0x5056('0xa0')]]=this[_0x5056('0x41')][_0x12e696[_0x5056('0x4c')]];this[_0x5056('0x41')][_0x12e696[_0x5056('0x4c')]]=_0x18c58a;}}else{_0x284c76[_0x5056('0x8a')]=_0x5056('0xab')+_0x12e696['reason'][_0x5056('0xac')]();logger['info'](_0x5056('0xad'),_0x284c76['name'],_0x284c76['type'],_0x284c76[_0x5056('0x8a')]);}}}this[_0x5056('0x13')][_0x12e696[_0x5056('0x4c')]]=_0x284c76;this[_0x5056('0x51')](_0x284c76,_0x5056('0x1e'));}}}catch(_0x5f091d){logger[_0x5056('0x3e')](_0x5056('0xae'),_0x12e696[_0x5056('0x4c')],util[_0x5056('0x40')](_0x5f091d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5056('0xaf')]=function(_0x3103ae){try{if(this['isNotNull'](_0x3103ae)){logger[_0x5056('0x49')]('[%s][voiceQueueReport][varset]',_0x3103ae[_0x5056('0x4c')],util[_0x5056('0x40')](_0x3103ae,{'showHidden':![],'depth':null}));this[_0x5056('0xb0')](_0x3103ae[_0x5056('0x4c')],_[_0x5056('0x82')](_0x3103ae['variable'])[0x0],_0x3103ae[_0x5056('0xb1')]);if(this[_0x5056('0x41')][_0x3103ae[_0x5056('0x4c')]]){var _0x753b09=_[_0x5056('0x91')](this[_0x5056('0x41')][_0x3103ae[_0x5056('0x4c')]]);if(_0x753b09){if(this[_0x5056('0x66')](_0x3103ae[_0x5056('0xb2')])&&this[_0x5056('0x66')](_0x3103ae[_0x5056('0xb2')][_0x5056('0xb3')])){switch(_0x3103ae[_0x5056('0xb1')]){case _0x5056('0xb4'):_0x753b09[_0x5056('0xa1')]=![];_0x753b09[_0x5056('0x9b')]=null;break;case _0x5056('0xb5'):_0x753b09[_0x5056('0xb6')]='timeout';_0x753b09[_0x5056('0xa1')]=!![];_0x753b09['queuecallerexitAt']=moment()[_0x5056('0x64')](_0x5056('0x7b'));_0x753b09[_0x5056('0x92')]=moment()[_0x5056('0x64')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x5056('0x49')](_0x5056('0xb7'),_0x3103ae[_0x5056('0x4c')],util[_0x5056('0x40')](_0x753b09,{'showHidden':![],'depth':null}));ami[_0x5056('0x47')]('custom:timeout',_0x753b09);break;default:_0x753b09['queuecallerexit']=!![];_0x753b09[_0x5056('0x9b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x753b09[_0x5056('0x92')]=moment()[_0x5056('0x64')](_0x5056('0x7b'));}_0x753b09[_0x5056('0x1b')]=![];_0x753b09[_0x5056('0x89')]=null;_0x753b09[_0x5056('0x8a')]=_0x3103ae[_0x5056('0xb1')];this[_0x5056('0x13')][_0x3103ae['uniqueid']]=_0x753b09;this[_0x5056('0x51')](_0x753b09,_0x5056('0x21'));}else if(this[_0x5056('0x66')](_0x3103ae[_0x5056('0xb2')])&&this[_0x5056('0x66')](_0x3103ae[_0x5056('0xb2')][_0x5056('0xb8')])){if(!_0x753b09['queuecallerabandon']){_0x753b09['queuecallerexit']=!![];_0x753b09[_0x5056('0x9b')]=moment()[_0x5056('0x64')](_0x5056('0x7b'));_0x753b09[_0x5056('0x8a')]=_0x5056('0xb9');_0x753b09[_0x5056('0x92')]=moment()['format'](_0x5056('0x7b'));this[_0x5056('0x13')][_0x3103ae[_0x5056('0x4c')]]=_0x753b09;}}logger[_0x5056('0x70')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3103ae[_0x5056('0x4c')],_0x753b09['name'],_0x753b09[_0x5056('0x55')],_[_0x5056('0x82')](_0x3103ae['variable'])[0x0],_0x3103ae['value']);_0x753b09[_0x5056('0x15')]=this[_0x5056('0x15')][_0x3103ae[_0x5056('0x4c')]];}}}}catch(_0xcb984b){logger[_0x5056('0x3e')](_0x5056('0xba'),_0x3103ae[_0x5056('0x4c')],util[_0x5056('0x40')](_0xcb984b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5056('0x35')][_0x5056('0xb0')]=function(_0xf3d134,_0x33fcf6,_0x3db0a3){var _0x3a1138=[_0x5056('0xbb'),_0x5056('0xbc'),_0x5056('0xbd'),_0x5056('0xbe'),'rtpaudioqosloss',_0x5056('0xbf'),_0x5056('0xc0'),_0x5056('0xc1'),_0x5056('0xc2'),_0x5056('0xc3'),_0x5056('0xc4'),_0x5056('0xc5'),'membercalls',_0x5056('0xc6'),'memberinterface',_0x5056('0xc7'),_0x5056('0x9a'),_0x5056('0xc8'),'memberrealtime'];if(!_[_0x5056('0x38')](_0x33fcf6)&&!_[_0x5056('0xc9')](_0x3a1138,_0x33fcf6)){if(_['isUndefined'](this[_0x5056('0x15')][_0xf3d134])){this['variables'][_0xf3d134]={};}this[_0x5056('0x15')][_0xf3d134][_0x33fcf6]=_0x3db0a3;}};VoiceQueueReport['prototype'][_0x5056('0x23')]=function(_0x503213){try{if(this[_0x5056('0x66')](_0x503213)){logger[_0x5056('0x49')](_0x5056('0xca'),_0x503213[_0x5056('0x4c')],util[_0x5056('0x40')](_0x503213,{'showHidden':![],'depth':null}));if(this[_0x5056('0x41')][_0x503213['uniqueid']]){for(var _0x3b90ea=0x0,_0x3fe927={};_0x3b90ea0x0?_0x25f94f:0x0;this[_0xd4a3('0x14')][_0x85c3e2['queue']][_0xd4a3('0x32')]=this[_0xd4a3('0x14')][_0x85c3e2['queue']]['talking']>_['toNumber'](_0x85c3e2[_0xd4a3('0x6f')])?_[_0xd4a3('0x6e')](_0x85c3e2[_0xd4a3('0x6f')]):this[_0xd4a3('0x14')][_0x85c3e2[_0xd4a3('0x68')]][_0xd4a3('0x32')];this['emitVoiceQueueSummary'](this[_0xd4a3('0x14')][_0x85c3e2['queue']],'queuesummary');}logger['debug'](_0xd4a3('0x70'),util[_0xd4a3('0x40')](this[_0xd4a3('0x14')][_0x85c3e2[_0xd4a3('0x68')]],{'showHidden':![],'depth':null}));ami[_0xd4a3('0x45')](_0xd4a3('0x71'),this[_0xd4a3('0x14')][_0x85c3e2['queue']]);}}}catch(_0x3e3f1b){logger[_0xd4a3('0x3e')](_0xd4a3('0x67'),util[_0xd4a3('0x40')](_0x3e3f1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4a3('0x35')][_0xd4a3('0x1c')]=function(_0x2cc696){logger[_0xd4a3('0x47')](_0xd4a3('0x72'),util[_0xd4a3('0x40')](_0x2cc696,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xd4a3('0x35')]['syncQueueCallerJoin']=function(_0xc80536){try{if(this['isNotNull'](_0xc80536)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0xc80536[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0xc80536,{'showHidden':![],'depth':null}));if(_[_0xd4a3('0x63')](this['queueReports'][_0xc80536[_0xd4a3('0x48')]]))this['queueReports'][_0xc80536[_0xd4a3('0x48')]]=[];if(_[_0xd4a3('0x63')](this[_0xd4a3('0x12')][_0xc80536[_0xd4a3('0x48')]]))this['channels'][_0xc80536[_0xd4a3('0x48')]]={};var _0x2d08b2=new QueueReport();_0x2d08b2[_0xd4a3('0x4b')]=_0xc80536[_0xd4a3('0x68')];_0x2d08b2['type']=this['voiceQueues'][_0x2d08b2[_0xd4a3('0x4b')]]&&this[_0xd4a3('0x14')][_0x2d08b2[_0xd4a3('0x4b')]][_0xd4a3('0x5a')]?this['voiceQueues'][_0x2d08b2[_0xd4a3('0x4b')]]['type']||'inbound':_0xd4a3('0x52');_0x2d08b2[_0xd4a3('0x68')]=_0xc80536[_0xd4a3('0x68')];_0x2d08b2[_0xd4a3('0x73')]=moment()[_0xd4a3('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d08b2['position']=_0xc80536['position'];_0x2d08b2[_0xd4a3('0x74')]=_0xc80536[_0xd4a3('0x74')];_0x2d08b2['uniqueid']=_0xc80536[_0xd4a3('0x48')];_0x2d08b2[_0xd4a3('0x75')]=this['channels'][_0xc80536[_0xd4a3('0x48')]][_0xd4a3('0x75')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2d08b2[_0xd4a3('0x4b')],_0x2d08b2[_0xd4a3('0x5a')]);_[_0xd4a3('0x76')](_0x2d08b2,_['pick'](_0xc80536,_[_0xd4a3('0x77')](_0x2d08b2)));this[_0xd4a3('0x10')][_0xc80536[_0xd4a3('0x48')]][_0xd4a3('0x78')](_0x2d08b2);this[_0xd4a3('0x12')][_0xc80536[_0xd4a3('0x48')]]=_0x2d08b2;this[_0xd4a3('0x46')](_0x2d08b2,_0xd4a3('0x1d'));}}catch(_0xa019d4){logger[_0xd4a3('0x3e')](_0xd4a3('0x79'),_0xc80536['uniqueid'],util[_0xd4a3('0x40')](_0xa019d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4a3('0x35')]['syncQueueCallerAbandon']=function(_0x3a3f3c){try{if(this[_0xd4a3('0x62')](_0x3a3f3c)){logger['debug'](_0xd4a3('0x7a'),_0x3a3f3c[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0x3a3f3c,{'showHidden':![],'depth':null}));if(this[_0xd4a3('0x10')][_0x3a3f3c[_0xd4a3('0x48')]]){var _0x529ffb=_[_0xd4a3('0x7b')](this['queueReports'][_0x3a3f3c['uniqueid']]);_0x529ffb[_0xd4a3('0x7c')]=![];_0x529ffb[_0xd4a3('0x7d')]=null;_0x529ffb[_0xd4a3('0x7e')]=_0x3a3f3c['holdtime'];_0x529ffb['originalposition']=_0x3a3f3c[_0xd4a3('0x7f')];_0x529ffb[_0xd4a3('0x1e')]=!![];_0x529ffb[_0xd4a3('0x80')]=moment()[_0xd4a3('0x49')](_0xd4a3('0x81'));_0x529ffb[_0xd4a3('0x82')]=_0xd4a3('0x83');_0x529ffb['lastAssignedTo']=null;logger[_0xd4a3('0x6a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x529ffb[_0xd4a3('0x4b')],_0x529ffb[_0xd4a3('0x5a')]);this[_0xd4a3('0x12')][_0x3a3f3c[_0xd4a3('0x48')]]=_0x529ffb;this[_0xd4a3('0x43')](_0x529ffb,'queuecallerabandon');}}}catch(_0x102c5b){logger[_0xd4a3('0x3e')](_0xd4a3('0x7a'),_0x3a3f3c[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0x102c5b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4a3('0x35')][_0xd4a3('0x21')]=function(_0x5599fc){try{if(this['isNotNull'](_0x5599fc)){logger[_0xd4a3('0x47')](_0xd4a3('0x84'),_0x5599fc['uniqueid'],util[_0xd4a3('0x40')](_0x5599fc,{'showHidden':![],'depth':null}));if(this[_0xd4a3('0x10')][_0x5599fc[_0xd4a3('0x48')]]){var _0x1147fc=_[_0xd4a3('0x7b')](this[_0xd4a3('0x10')][_0x5599fc['uniqueid']]);_0x1147fc[_0xd4a3('0x85')]=moment()[_0xd4a3('0x49')](_0xd4a3('0x81'));_0x1147fc[_0xd4a3('0x86')]=_0x5599fc[_0xd4a3('0x86')];_0x1147fc[_0xd4a3('0x87')]=_0x5599fc[_0xd4a3('0x87')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1147fc['name'],_0x1147fc[_0xd4a3('0x5a')],_0x5599fc[_0xd4a3('0x86')],_0x5599fc[_0xd4a3('0x87')]);this[_0xd4a3('0x12')][_0x5599fc[_0xd4a3('0x48')]]=_0x1147fc;this[_0xd4a3('0x46')](_0x1147fc,'queuecallerleave');}}}catch(_0x143e7d){logger[_0xd4a3('0x3e')](_0xd4a3('0x84'),_0x5599fc[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0x143e7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4a3('0x35')][_0xd4a3('0x88')]=function(_0x582430){try{if(this[_0xd4a3('0x62')](_0x582430)){logger['debug'](_0xd4a3('0x89'),_0x582430['uniqueid'],util['inspect'](_0x582430,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x582430[_0xd4a3('0x48')]]){var _0x100952=_[_0xd4a3('0x7b')](this[_0xd4a3('0x10')][_0x582430[_0xd4a3('0x48')]]);_0x100952[_0xd4a3('0x7c')]=!![];_0x100952[_0xd4a3('0x82')]='COMPLETEDBYAGENT';logger[_0xd4a3('0x6a')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x100952[_0xd4a3('0x4b')],_0x100952[_0xd4a3('0x5a')]);}}}catch(_0x285869){logger[_0xd4a3('0x3e')](_0xd4a3('0x89'),_0x582430[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0x285869,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd4a3('0x22')]=function(_0x1d14b3){try{if(this[_0xd4a3('0x62')](_0x1d14b3)){logger[_0xd4a3('0x47')](_0xd4a3('0x8a'),_0x1d14b3[_0xd4a3('0x48')],util['inspect'](_0x1d14b3,{'showHidden':![],'depth':null}));if(this[_0xd4a3('0x10')][_0x1d14b3[_0xd4a3('0x48')]]){var _0x3652b1=_[_0xd4a3('0x7b')](this['queueReports'][_0x1d14b3[_0xd4a3('0x48')]]);_0x3652b1['queuecallerabandon']=![];_0x3652b1['queuecallerabandonAt']=null;_0x3652b1['assigned']=!![];_0x3652b1[_0xd4a3('0x8b')]=_0x1d14b3[_0xd4a3('0x8c')];_0x3652b1[_0xd4a3('0x7e')]=_0x1d14b3[_0xd4a3('0x7e')];_0x3652b1['queuecallercomplete']=!![];_0x3652b1[_0xd4a3('0x8d')]=![];_0x3652b1['queuecallerexitAt']=null;if(!_0x3652b1['transfer']){if(_0x1d14b3[_0xd4a3('0x8e')]==_0xd4a3('0x8f')){_0x3652b1[_0xd4a3('0x82')]=_0xd4a3('0x90');logger[_0xd4a3('0x6a')](_0xd4a3('0x91'),_0x3652b1[_0xd4a3('0x4b')],_0x3652b1[_0xd4a3('0x5a')]);}else{if(_['startsWith'](_0x1d14b3[_0xd4a3('0x3a')][_0xd4a3('0x92')](),_0xd4a3('0x93'))){if(this[_0xd4a3('0x10')][_0x1d14b3[_0xd4a3('0x94')]]){var _0x1d1b7e=_[_0xd4a3('0x7b')](this['queueReports'][_0x1d14b3['linkedid']]);_0x1d1b7e[_0xd4a3('0x7c')]=![];_0x1d1b7e[_0xd4a3('0x8d')]=!![];_0x1d1b7e[_0xd4a3('0x95')]=moment(_0x3652b1[_0xd4a3('0x73')])[_0xd4a3('0x96')](_0x1d14b3['holdtime'],_0xd4a3('0x97'))[_0xd4a3('0x49')](_0xd4a3('0x81'));_0x1d1b7e[_0xd4a3('0x82')]=_0xd4a3('0x98');_0x1d1b7e[_0xd4a3('0x8f')]=!![];_0x1d1b7e[_0xd4a3('0x99')]=_0xd4a3('0x9a');_0x1d1b7e[_0xd4a3('0x9b')]=_0x1d14b3['destexten'];_0x1d1b7e[_0xd4a3('0x9c')]=_0x1d14b3[_0xd4a3('0x48')];logger['info'](_0xd4a3('0x9d'),_0x1d1b7e['name'],_0x1d1b7e[_0xd4a3('0x5a')]);var _0x9d1431=this[_0xd4a3('0x10')][_0x1d14b3['linkedid']];this[_0xd4a3('0x10')][_0x1d14b3[_0xd4a3('0x94')]]=this[_0xd4a3('0x10')][_0x1d14b3[_0xd4a3('0x48')]];this[_0xd4a3('0x10')][_0x1d14b3[_0xd4a3('0x48')]]=_0x9d1431;}}else{_0x3652b1[_0xd4a3('0x82')]=_0xd4a3('0x9e')+_0x1d14b3[_0xd4a3('0x8e')][_0xd4a3('0x9f')]();logger[_0xd4a3('0x6a')](_0xd4a3('0xa0'),_0x3652b1['name'],_0x3652b1[_0xd4a3('0x5a')],_0x3652b1[_0xd4a3('0x82')]);}}}this[_0xd4a3('0x12')][_0x1d14b3[_0xd4a3('0x48')]]=_0x3652b1;this['emitVoiceQueueChannelRemove'](_0x3652b1,'agentcomplete');}}}catch(_0x416e5d){logger[_0xd4a3('0x3e')]('[%s][voiceQueueReport][agentcomplete]',_0x1d14b3['uniqueid'],util[_0xd4a3('0x40')](_0x416e5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4a3('0x35')][_0xd4a3('0x24')]=function(_0x265490){try{if(this[_0xd4a3('0x62')](_0x265490)){logger[_0xd4a3('0x47')](_0xd4a3('0xa1'),_0x265490[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0x265490,{'showHidden':![],'depth':null}));this[_0xd4a3('0xa2')](_0x265490[_0xd4a3('0x48')],_[_0xd4a3('0x77')](_0x265490[_0xd4a3('0xa3')])[0x0],_0x265490[_0xd4a3('0xa4')]);if(this['queueReports'][_0x265490['uniqueid']]){var _0x2a5bdc=_[_0xd4a3('0x7b')](this[_0xd4a3('0x10')][_0x265490['uniqueid']]);if(_0x2a5bdc){if(this['isNotNull'](_0x265490[_0xd4a3('0xa3')])&&this['isNotNull'](_0x265490[_0xd4a3('0xa3')]['queuestatus'])){switch(_0x265490[_0xd4a3('0xa4')]){case _0xd4a3('0xa5'):_0x2a5bdc['queuecallerexit']=![];_0x2a5bdc[_0xd4a3('0x95')]=null;break;case'TIMEOUT':_0x2a5bdc['lastevent']=_0xd4a3('0xa6');_0x2a5bdc['queuecallerexit']=!![];_0x2a5bdc[_0xd4a3('0x95')]=moment()[_0xd4a3('0x49')](_0xd4a3('0x81'));_0x2a5bdc[_0xd4a3('0x85')]=moment()[_0xd4a3('0x49')](_0xd4a3('0x81'));logger[_0xd4a3('0x47')](_0xd4a3('0xa7'),_0x265490[_0xd4a3('0x48')],util['inspect'](_0x2a5bdc,{'showHidden':![],'depth':null}));ami[_0xd4a3('0x45')](_0xd4a3('0xa8'),_0x2a5bdc);break;default:_0x2a5bdc['queuecallerexit']=!![];_0x2a5bdc[_0xd4a3('0x95')]=moment()[_0xd4a3('0x49')](_0xd4a3('0x81'));_0x2a5bdc['queuecallerleaveAt']=moment()['format'](_0xd4a3('0x81'));}_0x2a5bdc[_0xd4a3('0x1e')]=![];_0x2a5bdc[_0xd4a3('0x80')]=null;_0x2a5bdc[_0xd4a3('0x82')]=_0x265490[_0xd4a3('0xa4')];this[_0xd4a3('0x12')][_0x265490[_0xd4a3('0x48')]]=_0x2a5bdc;this[_0xd4a3('0x43')](_0x2a5bdc,'varset');}else if(this[_0xd4a3('0x62')](_0x265490['variable'])&&this[_0xd4a3('0x62')](_0x265490['variable'][_0xd4a3('0xa9')])){if(!_0x2a5bdc[_0xd4a3('0x1e')]){_0x2a5bdc[_0xd4a3('0x8d')]=!![];_0x2a5bdc[_0xd4a3('0x95')]=moment()[_0xd4a3('0x49')](_0xd4a3('0x81'));_0x2a5bdc['queuecallerexitreason']=_0xd4a3('0xaa');_0x2a5bdc[_0xd4a3('0x85')]=moment()[_0xd4a3('0x49')](_0xd4a3('0x81'));this['channels'][_0x265490[_0xd4a3('0x48')]]=_0x2a5bdc;}}logger[_0xd4a3('0x6a')](_0xd4a3('0xab'),_0x265490[_0xd4a3('0x48')],_0x2a5bdc[_0xd4a3('0x4b')],_0x2a5bdc[_0xd4a3('0x5a')],_[_0xd4a3('0x77')](_0x265490[_0xd4a3('0xa3')])[0x0],_0x265490[_0xd4a3('0xa4')]);_0x2a5bdc[_0xd4a3('0x17')]=this[_0xd4a3('0x17')][_0x265490[_0xd4a3('0x48')]];}}}}catch(_0x3e3b3b){logger[_0xd4a3('0x3e')](_0xd4a3('0xa1'),_0x265490[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0x3e3b3b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4a3('0x35')]['addVariable']=function(_0x4f4d4d,_0x52c023,_0x42d828){var _0x5bb102=[_0xd4a3('0xac'),_0xd4a3('0xad'),_0xd4a3('0xae'),'rtpaudioqosjitterbridged',_0xd4a3('0xaf'),_0xd4a3('0xb0'),_0xd4a3('0xb1'),_0xd4a3('0xb2'),_0xd4a3('0xb3'),'sipuri',_0xd4a3('0xb4'),'bridgepvtcallid',_0xd4a3('0xb5'),_0xd4a3('0xb6'),_0xd4a3('0xb7'),_0xd4a3('0xb8'),_0xd4a3('0x8c'),_0xd4a3('0xb9'),_0xd4a3('0xba')];if(!_['isNil'](_0x52c023)&&!_[_0xd4a3('0xbb')](_0x5bb102,_0x52c023)){if(_[_0xd4a3('0x63')](this['variables'][_0x4f4d4d])){this[_0xd4a3('0x17')][_0x4f4d4d]={};}this[_0xd4a3('0x17')][_0x4f4d4d][_0x52c023]=_0x42d828;}};VoiceQueueReport[_0xd4a3('0x35')][_0xd4a3('0x25')]=function(_0x46f0af){try{if(this[_0xd4a3('0x62')](_0x46f0af)){logger[_0xd4a3('0x47')](_0xd4a3('0xbc'),_0x46f0af[_0xd4a3('0x48')],util[_0xd4a3('0x40')](_0x46f0af,{'showHidden':![],'depth':null}));if(this[_0xd4a3('0x10')][_0x46f0af[_0xd4a3('0x48')]]){for(var _0x22e879=0x0,_0x42ec39={};_0x22e879=0x0?moment(_0x3efdc9[_0x21bf('0x14')])[_0x21bf('0xc')](_0x3efdc9['starttime'],'seconds'):null,'data1':_0x21bf('0x15'),'data2':_0x3efdc9[_0x21bf('0x11')],'data3':_0x3efdc9['exten'],'data4':_0x3efdc9[_0x21bf('0x16')]||null,'role':_0x21bf('0x17'),'internal':_0x3efdc9[_0x21bf('0x11')]?_[_0x21bf('0x10')](_0x3efdc9['accountcode']):undefined,'uniqueid':_0x3efdc9[_0x21bf('0x12')]},'log':_0x21bf('0x13')});}; \ No newline at end of file +var _0x8b03=['diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','outbound','dialstring','accountcode','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','lastAssignedTo','TALKING'];(function(_0xdde30a,_0x3e2df5){var _0x3807d9=function(_0x53d4e9){while(--_0x53d4e9){_0xdde30a['push'](_0xdde30a['shift']());}};_0x3807d9(++_0x3e2df5);}(_0x8b03,0xf1));var _0x38b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b03[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x38b0('0x0'));var _=require(_0x38b0('0x1'));var util=require(_0x38b0('0x2'));var client=require(_0x38b0('0x3'));exports[_0x38b0('0x4')]=function(_0x335ecc){var _0x13772e=_0x335ecc[_0x38b0('0x5')]||_0x335ecc[_0x38b0('0x6')];return client[_0x38b0('0x7')](_0x38b0('0x8'),{'body':{'channel':_0x38b0('0x9'),'membername':_0x335ecc['lastAssignedTo'],'interface':_[_0x38b0('0xa')](_0x335ecc[_0x38b0('0xb')])?util[_0x38b0('0xc')]('SIP/%s',_0x335ecc[_0x38b0('0xd')]):_0x335ecc[_0x38b0('0xb')],'type':_0x38b0('0xe'),'enterAt':_0x335ecc['queuecallerleaveAt'],'exitAt':_0x13772e,'duration':moment(_0x13772e)[_0x38b0('0xf')](_0x335ecc[_0x38b0('0x10')],_0x38b0('0x11')),'data1':_0x38b0('0x12'),'data2':_0x335ecc[_0x38b0('0x13')],'data3':_0x335ecc[_0x38b0('0x14')],'data4':null,'data5':_0x335ecc[_0x38b0('0x15')],'role':_0x38b0('0x16'),'internal':_0x335ecc['accountcode']?_[_0x38b0('0x17')](_0x335ecc['accountcode']):undefined,'uniqueid':_0x335ecc[_0x38b0('0x18')]},'log':_0x38b0('0x8')});};exports[_0x38b0('0x19')]=function(_0x25fda1){return client[_0x38b0('0x7')]('CreateMemberReport',{'body':{'channel':_0x38b0('0x9'),'membername':_0x25fda1[_0x38b0('0x1a')],'interface':_0x25fda1[_0x38b0('0xb')],'type':_0x38b0('0xe'),'enterAt':_0x25fda1['starttime'],'exitAt':_0x25fda1[_0x38b0('0x1b')],'duration':moment(_0x25fda1['endtime'])[_0x38b0('0xf')](_0x25fda1['starttime'],_0x38b0('0x11'))>=0x0?moment(_0x25fda1[_0x38b0('0x1b')])[_0x38b0('0xf')](_0x25fda1[_0x38b0('0x1c')],_0x38b0('0x11')):null,'data1':_0x38b0('0x1d'),'data2':_0x25fda1['accountcode'],'data3':_0x25fda1[_0x38b0('0x14')],'data4':_0x25fda1[_0x38b0('0x1e')]||null,'role':_0x38b0('0x16'),'internal':_0x25fda1[_0x38b0('0x1f')]?_[_0x38b0('0x17')](_0x25fda1[_0x38b0('0x1f')]):undefined,'uniqueid':_0x25fda1['uniqueid']},'log':_0x38b0('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 617a4f0..e2ecb7d 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 _0x5d70=['GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d70,0x8d));var _0x05d7=function(_0x393108,_0x486bf3){_0x393108=_0x393108-0x0;var _0x1b45dc=_0x5d70[_0x393108];return _0x1b45dc;};'use strict';var client=require(_0x05d7('0x0'));exports[_0x05d7('0x1')]=function(){return client['Request'](_0x05d7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x05d7('0x3')]},'log':_0x05d7('0x4')});}; \ No newline at end of file +var _0xebe6=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xebe6,0x13a));var _0x6ebe=function(_0x2cefd2,_0x3eed48){_0x2cefd2=_0x2cefd2-0x0;var _0x528537=_0xebe6[_0x2cefd2];return _0x528537;};'use strict';var client=require(_0x6ebe('0x0'));exports[_0x6ebe('0x1')]=function(){return client[_0x6ebe('0x2')](_0x6ebe('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6ebe('0x4')]},'log':_0x6ebe('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index de9ed85..3666256 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 _0x6725=['GetTemplate','name','html','../client','getTemplates'];(function(_0x33f4ed,_0x199b24){var _0x400542=function(_0x839917){while(--_0x839917){_0x33f4ed['push'](_0x33f4ed['shift']());}};_0x400542(++_0x199b24);}(_0x6725,0x1a2));var _0x5672=function(_0x3a6b24,_0x4e340d){_0x3a6b24=_0x3a6b24-0x0;var _0x9c7800=_0x6725[_0x3a6b24];return _0x9c7800;};'use strict';var client=require(_0x5672('0x0'));exports[_0x5672('0x1')]=function(_0x416254){return function(_0x1a0edf){return client['Request'](_0x5672('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5672('0x3'),_0x5672('0x4')]},'log':_0x5672('0x2')});};}; \ No newline at end of file +var _0x8efb=['name','html','../client','Request','GetTemplate'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x8efb,0xed));var _0xb8ef=function(_0xeae185,_0x395d70){_0xeae185=_0xeae185-0x0;var _0x170ac0=_0x8efb[_0xeae185];return _0x170ac0;};'use strict';var client=require(_0xb8ef('0x0'));exports['getTemplates']=function(_0x97a62b){return function(_0x3c73c7){return client[_0xb8ef('0x1')](_0xb8ef('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb8ef('0x3'),_0xb8ef('0x4')]},'log':_0xb8ef('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 892d858..1a6ac2f 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 _0x0e14=['../client','GetTrigger','name','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2','data4','data7'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x0e14,0xbb));var _0x40e1=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x0e14[_0xae7c2f];return _0x5d7001;};'use strict';var client=require(_0x40e1('0x0'));exports['getTriggers']=function(_0x5d8952){return function(_0x49940e){return client['Request'](_0x40e1('0x1'),{'options':{'raw':![],'attributes':['id',_0x40e1('0x2'),'channel',_0x40e1('0x3')],'include':[{'model':_0x40e1('0x4'),'as':_0x40e1('0x5'),'attributes':['id','field',_0x40e1('0x6'),_0x40e1('0x7')]},{'model':'Condition','as':_0x40e1('0x8'),'attributes':['id',_0x40e1('0x9'),_0x40e1('0x6'),_0x40e1('0x7')]},{'model':_0x40e1('0xa'),'as':_0x40e1('0xb'),'attributes':['id',_0x40e1('0xc'),_0x40e1('0xd'),_0x40e1('0xe'),'data3',_0x40e1('0xf'),'data5','data6',_0x40e1('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x91b0=['status','AllConditions','field','Condition','AnyConditions','Actions','action','data1','data2','data3','data4','data5','data7','GetTrigger','../client','getTriggers','Request','name','channel'];(function(_0x14712a,_0x18735c){var _0x315307=function(_0x199a5e){while(--_0x199a5e){_0x14712a['push'](_0x14712a['shift']());}};_0x315307(++_0x18735c);}(_0x91b0,0x6d));var _0x091b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x91b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x091b('0x0'));exports[_0x091b('0x1')]=function(_0x579255){return function(_0x2aab92){return client[_0x091b('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x091b('0x3'),_0x091b('0x4'),_0x091b('0x5')],'include':[{'model':'Condition','as':_0x091b('0x6'),'attributes':['id',_0x091b('0x7'),'operator','value']},{'model':_0x091b('0x8'),'as':_0x091b('0x9'),'attributes':['id',_0x091b('0x7'),'operator','value']},{'model':'Action','as':_0x091b('0xa'),'attributes':['id',_0x091b('0xb'),_0x091b('0xc'),_0x091b('0xd'),_0x091b('0xe'),_0x091b('0xf'),_0x091b('0x10'),'data6',_0x091b('0x11')]}]},'log':_0x091b('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 12b738b..4fb7840 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 _0xa5ca=['name','registry','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xa5ca[_0x9dfc10];return _0x4f938a;};'use strict';var client=require(_0xaa5c('0x0'));exports[_0xaa5c('0x1')]=function(_0x3d7bfc){return function(_0x50cffe){return client['Request'](_0xaa5c('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xaa5c('0x3'),_0xaa5c('0x4'),_0xaa5c('0x5')]},'log':_0xaa5c('0x2')});};}; \ No newline at end of file +var _0x87f8=['defaultuser','GetTrunk','Request','name'];(function(_0x251429,_0x55f265){var _0x2d5d69=function(_0x5f93c8){while(--_0x5f93c8){_0x251429['push'](_0x251429['shift']());}};_0x2d5d69(++_0x55f265);}(_0x87f8,0x152));var _0x887f=function(_0x3eba87,_0x1a6e26){_0x3eba87=_0x3eba87-0x0;var _0x108b6d=_0x87f8[_0x3eba87];return _0x108b6d;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x52e3a6){return function(_0x379ad6){return client[_0x887f('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x887f('0x1'),'registry',_0x887f('0x2')]},'log':_0x887f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 5e9f27b..5b99c16 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x42e31c,_0x19261e){var _0x2af6de=function(_0x2c4b6b){while(--_0x2c4b6b){_0x42e31c['push'](_0x42e31c['shift']());}};_0x2af6de(++_0x19261e);}(_0x34e8,0x12c));var _0x834e=function(_0x105ee9,_0x5d4d0e){_0x105ee9=_0x105ee9-0x0;var _0x514506=_0x34e8[_0x105ee9];return _0x514506;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x2b330e,_0xda6026){var _0x15228d=function(_0x3d08bb){while(--_0x3d08bb){_0x2b330e['push'](_0x2b330e['shift']());}};_0x15228d(++_0xda6026);}(_0x34e8,0x12c));var _0x834e=function(_0x1666dc,_0x5d0d02){_0x1666dc=_0x1666dc-0x0;var _0x33499b=_0x34e8[_0x1666dc];return _0x33499b;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 8036555..f7b16ec 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 _0x2097=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x52a3b8,_0x407fff){var _0x2cef66=function(_0x4798cd){while(--_0x4798cd){_0x52a3b8['push'](_0x52a3b8['shift']());}};_0x2cef66(++_0x407fff);}(_0x2097,0xc9));var _0x7209=function(_0x20f768,_0x37cb8d){_0x20f768=_0x20f768-0x0;var _0x385a3c=_0x2097[_0x20f768];return _0x385a3c;};'use strict';var client=require(_0x7209('0x0'));exports[_0x7209('0x1')]=function(_0x35c54c){return client[_0x7209('0x2')](_0x7209('0x3'),{'body':_0x35c54c,'log':_0x7209('0x3')});};exports[_0x7209('0x4')]=function(_0x2384d0,_0x1a89f5,_0x48b00d){return client[_0x7209('0x2')](_0x7209('0x5'),{'body':_0x2384d0,'options':{'where':{'uniqueid':_0x1a89f5,'interface':_0x48b00d,'agentcomplete':!![]}},'log':_0x7209('0x5')});}; \ No newline at end of file +var _0xeaaf=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x1c94ee,_0x18819e){var _0x198256=function(_0x33b362){while(--_0x33b362){_0x1c94ee['push'](_0x1c94ee['shift']());}};_0x198256(++_0x18819e);}(_0xeaaf,0xdb));var _0xfeaa=function(_0x47b3cb,_0x3c2026){_0x47b3cb=_0x47b3cb-0x0;var _0xfa8cdb=_0xeaaf[_0x47b3cb];return _0xfa8cdb;};'use strict';var client=require(_0xfeaa('0x0'));exports[_0xfeaa('0x1')]=function(_0x270812){return client[_0xfeaa('0x2')](_0xfeaa('0x3'),{'body':_0x270812,'log':_0xfeaa('0x3')});};exports[_0xfeaa('0x4')]=function(_0x136f62,_0x145134,_0x3306ba){return client['Request'](_0xfeaa('0x5'),{'body':_0x136f62,'options':{'where':{'uniqueid':_0x145134,'interface':_0x3306ba,'agentcomplete':!![]}},'log':_0xfeaa('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d805fe8..e1a791c 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 _0xe0c3=['context','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x3e0c('0x0'));var util=require('util');var _=require(_0x3e0c('0x1'));var client=require(_0x3e0c('0x2'));exports[_0x3e0c('0x3')]=function(_0x41c0bf){return client[_0x3e0c('0x4')](_0x3e0c('0x5'),{'body':_[_0x3e0c('0x6')](_0x41c0bf,{'source':_0x41c0bf[_0x3e0c('0x7')],'destinationcontext':_0x41c0bf[_0x3e0c('0x8')],'callerid':_0x41c0bf['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x3e0c('0x5')});};exports[_0x3e0c('0x9')]=function(){return function(){return client[_0x3e0c('0x4')](_0x3e0c('0xa'),{'options':{'where':{'type':[_0x3e0c('0xb')],'createdAt':{'$between':[moment()[_0x3e0c('0xc')](_0x3e0c('0xd'))[_0x3e0c('0xe')](_0x3e0c('0xf')),moment()[_0x3e0c('0x10')](_0x3e0c('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x3e0c('0x11'),_0x3e0c('0x12'),_0x3e0c('0x13'),_0x3e0c('0x14')]},'log':_0x3e0c('0x15')});};}; \ No newline at end of file +var _0x4efb=['YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','create','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','startOf','day'];(function(_0x521790,_0x4174ed){var _0x168e2a=function(_0x371514){while(--_0x371514){_0x521790['push'](_0x521790['shift']());}};_0x168e2a(++_0x4174ed);}(_0x4efb,0x1c1));var _0xb4ef=function(_0x5a9b57,_0x4dacee){_0x5a9b57=_0x5a9b57-0x0;var _0x11f759=_0x4efb[_0x5a9b57];return _0x11f759;};'use strict';var moment=require('moment');var util=require(_0xb4ef('0x0'));var _=require(_0xb4ef('0x1'));var client=require('../client');exports[_0xb4ef('0x2')]=function(_0x93b4eb){return client['Request'](_0xb4ef('0x3'),{'body':_[_0xb4ef('0x4')](_0x93b4eb,{'source':_0x93b4eb[_0xb4ef('0x5')],'destinationcontext':_0x93b4eb['context'],'callerid':_0x93b4eb[_0xb4ef('0x6')],'amaflags':_0xb4ef('0x7')}),'log':_0xb4ef('0x3')});};exports[_0xb4ef('0x8')]=function(){return function(){return client[_0xb4ef('0x9')](_0xb4ef('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xb4ef('0xb')](_0xb4ef('0xc'))['format'](_0xb4ef('0xd')),moment()[_0xb4ef('0xe')](_0xb4ef('0xc'))[_0xb4ef('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xb4ef('0x10'),_0xb4ef('0x11'),_0xb4ef('0x12'),_0xb4ef('0x13')]},'log':_0xb4ef('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 914a10a..7cac595 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 _0xa213=['create','Request','CreateVoiceDialReport'];(function(_0x2bd1aa,_0x2077aa){var _0x4bf239=function(_0x51f621){while(--_0x51f621){_0x2bd1aa['push'](_0x2bd1aa['shift']());}};_0x4bf239(++_0x2077aa);}(_0xa213,0x66));var _0x3a21=function(_0x2a2ca0,_0x394fa8){_0x2a2ca0=_0x2a2ca0-0x0;var _0x1a62e6=_0xa213[_0x2a2ca0];return _0x1a62e6;};'use strict';var client=require('../client');exports[_0x3a21('0x0')]=function(_0x2f36e2){return client[_0x3a21('0x1')]('CreateVoiceDialReport',{'body':_0x2f36e2,'log':_0x3a21('0x2')});}; \ No newline at end of file +var _0x9693=['../client','create','Request','CreateVoiceDialReport'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0x9693,0xf8));var _0x3969=function(_0x2f7d22,_0xcb0c4b){_0x2f7d22=_0x2f7d22-0x0;var _0x4619fb=_0x9693[_0x2f7d22];return _0x4619fb;};'use strict';var client=require(_0x3969('0x0'));exports[_0x3969('0x1')]=function(_0x5e920c){return client[_0x3969('0x2')](_0x3969('0x3'),{'body':_0x5e920c,'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 700dd2b..1528ae6 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 _0x9f3e=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x4ac40e,_0x14ea27){_0x4ac40e=_0x4ac40e-0x0;var _0x517fea=_0x9f3e[_0x4ac40e];return _0x517fea;};'use strict';var client=require(_0xe9f3('0x0'));exports[_0xe9f3('0x1')]=function(){return function(){return client[_0xe9f3('0x2')](_0xe9f3('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe9f3('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x2904=['getVoiceExtensions','GetVoiceExtension','recordingFormat','../client'];(function(_0x3bbbb3,_0x80f7bb){var _0x1ac27c=function(_0x1db716){while(--_0x1db716){_0x3bbbb3['push'](_0x3bbbb3['shift']());}};_0x1ac27c(++_0x80f7bb);}(_0x2904,0x137));var _0x4290=function(_0x348375,_0x58c372){_0x348375=_0x348375-0x0;var _0x47ed4d=_0x2904[_0x348375];return _0x47ed4d;};'use strict';var client=require(_0x4290('0x0'));exports[_0x4290('0x1')]=function(){return function(){return client['Request'](_0x4290('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x4290('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x4290('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3093419..e00411c 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 _0xc7e5=['autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','../client','Request','GetVoiceQueue','acw','acwTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7e5,0x14a));var _0x5c7e=function(_0x2574ce,_0x4c86d5){_0x2574ce=_0x2574ce-0x0;var _0x5a794f=_0xc7e5[_0x2574ce];return _0x5a794f;};'use strict';var client=require(_0x5c7e('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x5c7e('0x1')](_0x5c7e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5c7e('0x3'),_0x5c7e('0x4'),_0x5c7e('0x5'),_0x5c7e('0x6'),_0x5c7e('0x7'),_0x5c7e('0x8'),_0x5c7e('0x9'),_0x5c7e('0xa'),_0x5c7e('0xb'),_0x5c7e('0xc'),_0x5c7e('0xd'),'dialPredictiveOptimizationPercentage',_0x5c7e('0xe'),_0x5c7e('0xf'),_0x5c7e('0x10'),'dialOriginateTimeout',_0x5c7e('0x11'),_0x5c7e('0x12'),_0x5c7e('0x13'),_0x5c7e('0x14'),'dialCongestionRetryFrequency',_0x5c7e('0x15'),_0x5c7e('0x16'),_0x5c7e('0x17'),_0x5c7e('0x18'),_0x5c7e('0x19'),_0x5c7e('0x1a'),_0x5c7e('0x1b'),_0x5c7e('0x1c'),_0x5c7e('0x1d'),_0x5c7e('0x1e'),_0x5c7e('0x1f'),_0x5c7e('0x20'),_0x5c7e('0x21'),_0x5c7e('0x22'),_0x5c7e('0x23'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x5c7e('0x24'),'timeout',_0x5c7e('0x25'),_0x5c7e('0x26'),_0x5c7e('0x27'),_0x5c7e('0x28'),_0x5c7e('0x29'),_0x5c7e('0x2a'),_0x5c7e('0x6'),_0x5c7e('0x2b'),_0x5c7e('0x2c'),'dialCutDigit',_0x5c7e('0x2d'),_0x5c7e('0x2e'),_0x5c7e('0x2f'),_0x5c7e('0x30'),_0x5c7e('0x31'),_0x5c7e('0x32'),_0x5c7e('0x33'),_0x5c7e('0x34'),_0x5c7e('0x35'),_0x5c7e('0x36'),_0x5c7e('0x37'),_0x5c7e('0x38'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0x5c7e('0x39'),'attributes':['id',_0x5c7e('0x3a'),'callerid',_0x5c7e('0x3b')]},{'model':_0x5c7e('0x3c'),'as':_0x5c7e('0x3d'),'attributes':['id',_0x5c7e('0x3a')]},{'model':_0x5c7e('0x39'),'as':_0x5c7e('0x3e'),'attributes':['id',_0x5c7e('0x3a'),_0x5c7e('0x3f'),_0x5c7e('0x3b')]},{'model':_0x5c7e('0x40'),'as':_0x5c7e('0x40'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0x5c7e('0x41'),'attributes':['id','name',_0x5c7e('0x42')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x0a15=['dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','TrunkBackup','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x31ac3d,_0x111777){var _0x147a09=function(_0x53b81d){while(--_0x53b81d){_0x31ac3d['push'](_0x31ac3d['shift']());}};_0x147a09(++_0x111777);}(_0x0a15,0xa0));var _0x50a1=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x0a15[_0x819464];return _0x49dcc0;};'use strict';var client=require('../client');exports[_0x50a1('0x0')]=function(){return function(){return client[_0x50a1('0x1')](_0x50a1('0x2'),{'options':{'raw':![],'attributes':['id',_0x50a1('0x3'),_0x50a1('0x4'),'acwTimeout',_0x50a1('0x5'),_0x50a1('0x6'),'type',_0x50a1('0x7'),_0x50a1('0x8'),_0x50a1('0x9'),_0x50a1('0xa'),_0x50a1('0xb'),_0x50a1('0xc'),_0x50a1('0xd'),_0x50a1('0xe'),_0x50a1('0xf'),_0x50a1('0x10'),'dialOriginateTimeout',_0x50a1('0x11'),_0x50a1('0x12'),_0x50a1('0x13'),_0x50a1('0x14'),_0x50a1('0x15'),_0x50a1('0x16'),'dialBusyRetryFrequency',_0x50a1('0x17'),_0x50a1('0x18'),_0x50a1('0x19'),'dialTimezone',_0x50a1('0x1a'),_0x50a1('0x1b'),_0x50a1('0x1c'),'dialAMDActive',_0x50a1('0x1d'),_0x50a1('0x1e'),_0x50a1('0x1f'),_0x50a1('0x20'),_0x50a1('0x21'),_0x50a1('0x22'),'dialAMDMaximumNumberOfWords',_0x50a1('0x23'),'dialAMDMaximumWordLength',_0x50a1('0x24'),'dialRecallMeTimeout',_0x50a1('0x25'),_0x50a1('0x26'),_0x50a1('0x27'),_0x50a1('0x28'),_0x50a1('0x29'),'monitor_format',_0x50a1('0x2a'),_0x50a1('0x2b'),_0x50a1('0x2c'),_0x50a1('0x2d'),'dialNoSuchNumberRetryFrequency',_0x50a1('0x2e'),_0x50a1('0x2f'),_0x50a1('0x30'),_0x50a1('0x31'),_0x50a1('0x32'),_0x50a1('0x33'),'dialAgentRejectMaxRetry',_0x50a1('0x34'),_0x50a1('0x35'),_0x50a1('0x36'),_0x50a1('0x37')],'include':[{'model':_0x50a1('0x38'),'as':'Trunk','attributes':['id',_0x50a1('0x3'),'callerid',_0x50a1('0x39')]},{'model':_0x50a1('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0x50a1('0x3')]},{'model':'Trunk','as':_0x50a1('0x3b'),'attributes':['id',_0x50a1('0x3'),'callerid','active']},{'model':_0x50a1('0x3c'),'as':'Interval','attributes':['id',_0x50a1('0x3')],'include':[{'model':_0x50a1('0x3c'),'as':_0x50a1('0x3d'),'attributes':['id',_0x50a1('0x3'),'interval']}]}]},'log':_0x50a1('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4c7f6ac..36561a8 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(_0x53f3f5,_0x49e2c9){var _0x589260=function(_0x5e8dee){while(--_0x5e8dee){_0x53f3f5['push'](_0x53f3f5['shift']());}};_0x589260(++_0x49e2c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x2df311,_0x39efda){var _0x47877f=function(_0x1f4ac5){while(--_0x1f4ac5){_0x2df311['push'](_0x2df311['shift']());}};_0x47877f(++_0x39efda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 b45b3e7..c31f0ca 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 _0xfcd7=['getVoiceQueueRtPauses','Request'];(function(_0x139b17,_0xd1292c){var _0x474926=function(_0xcba90d){while(--_0xcba90d){_0x139b17['push'](_0x139b17['shift']());}};_0x474926(++_0xd1292c);}(_0xfcd7,0x11b));var _0x7fcd=function(_0x42d1ec,_0x536ae0){_0x42d1ec=_0x42d1ec-0x0;var _0x5d52bc=_0xfcd7[_0x42d1ec];return _0x5d52bc;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x1bf8a1){return function(){return client[_0x7fcd('0x0')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1bf8a1,'paused':!![]},'raw':!![]},'log':_0x7fcd('0x1')});};}; \ No newline at end of file +var _0x090f=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x090f,0x152));var _0xf090=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x090f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf090('0x0'));exports[_0xf090('0x1')]=function(_0x2a12fd){return function(){return client[_0xf090('0x2')](_0xf090('0x3'),{'options':{'where':{'VoiceQueueId':_0x2a12fd,'paused':!![]},'raw':!![]},'log':_0xf090('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 5efebdc..a8621b0 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(_0x40f214,_0x26fbf8){var _0x42e4dd=function(_0x598bfe){while(--_0x598bfe){_0x40f214['push'](_0x40f214['shift']());}};_0x42e4dd(++_0x26fbf8);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x525b78,_0x5b7345){var _0x53a75f=function(_0x4fc4df){while(--_0x4fc4df){_0x525b78['push'](_0x525b78['shift']());}};_0x53a75f(++_0x5b7345);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 34950ed..0311700 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 _0x6fc6=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','transfers','blindTransfer','result','transferercalleridnum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x2f302b,_0x14e7a4){var _0x1e3012=function(_0x3eda69){while(--_0x3eda69){_0x2f302b['push'](_0x2f302b['shift']());}};_0x1e3012(++_0x14e7a4);}(_0x6fc6,0xf0));var _0x66fc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6fc6[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x66fc('0x0'));exports[_0x66fc('0x1')]={};exports[_0x66fc('0x2')]=function(_0x39ac81){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x39ac81[_0x66fc('0x3')],'transfererchannel':_0x39ac81['transfererchannel'],'transferercalleridnum':_0x39ac81[_0x66fc('0x4')],'transferercalleridname':_0x39ac81['transferercalleridname'],'transfererconnectedlinenum':_0x39ac81['transfererconnectedlinenum'],'transfererconnectedlinename':_0x39ac81['transfererconnectedlinename'],'transfereraccountcode':_0x39ac81[_0x66fc('0x5')],'transferercontext':_0x39ac81[_0x66fc('0x6')],'transfererexten':_0x39ac81[_0x66fc('0x7')],'transfererlinkedid':_0x39ac81[_0x66fc('0x8')],'transfereechannel':_0x39ac81['transfereechannel'],'transfereecalleridnum':_0x39ac81[_0x66fc('0x9')],'transfereecalleridname':_0x39ac81['transfereecalleridname'],'transfereeconnectedlinenum':_0x39ac81[_0x66fc('0xa')],'transfereeconnectedlinename':_0x39ac81[_0x66fc('0xb')],'transfereeaccountcode':_0x39ac81[_0x66fc('0xc')],'transfereecontext':_0x39ac81['transfereecontext'],'transfereeexten':_0x39ac81[_0x66fc('0xd')],'transfereelinkedid':_0x39ac81[_0x66fc('0xe')],'isexternal':_0x39ac81[_0x66fc('0xf')],'context':_0x39ac81['context'],'extension':_0x39ac81[_0x66fc('0x10')],'type':_0x66fc('0x11')},'log':_0x66fc('0x12')});};exports[_0x66fc('0x13')]=function(_0x538b59){return client[_0x66fc('0x14')](_0x66fc('0x12'),{'body':{'result':_0x538b59[_0x66fc('0x3')],'transfererchannel':_0x538b59[_0x66fc('0x15')],'transferercalleridnum':_0x538b59[_0x66fc('0x16')],'transferercalleridname':_0x538b59[_0x66fc('0x17')],'transfererconnectedlinenum':_0x538b59[_0x66fc('0x18')],'transfererconnectedlinename':_0x538b59[_0x66fc('0x19')],'transfereraccountcode':_0x538b59['origtransfereraccountcode'],'transferercontext':_0x538b59['secondtransferercontext'],'transfererexten':_0x538b59[_0x66fc('0x1a')],'transfererlinkedid':_0x538b59[_0x66fc('0x1b')],'transfereechannel':_0x538b59[_0x66fc('0x1c')],'transfereecalleridnum':_0x538b59[_0x66fc('0x1d')],'transfereecalleridname':_0x538b59[_0x66fc('0x1e')],'transfereeconnectedlinenum':_0x538b59[_0x66fc('0x1f')],'transfereeconnectedlinename':_0x538b59[_0x66fc('0x20')],'transfereeaccountcode':_0x538b59[_0x66fc('0x21')],'transfereecontext':_0x538b59[_0x66fc('0x22')],'transfereeexten':_0x538b59[_0x66fc('0x23')],'transfereelinkedid':_0x538b59[_0x66fc('0x24')],'isexternal':_0x538b59[_0x66fc('0xf')],'context':_0x538b59['origtransferercontext'],'extension':_0x538b59['origtransfererexten'],'type':_0x66fc('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xde78=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','extension','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0xcc220b,_0xd09185){var _0x1f3c65=function(_0x5c7bac){while(--_0x5c7bac){_0xcc220b['push'](_0xcc220b['shift']());}};_0x1f3c65(++_0xd09185);}(_0xde78,0xfd));var _0x8de7=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xde78[_0x5cc8b9];return _0x58892e;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x23ad4a){return client[_0x8de7('0x0')](_0x8de7('0x1'),{'body':{'result':_0x23ad4a[_0x8de7('0x2')],'transfererchannel':_0x23ad4a[_0x8de7('0x3')],'transferercalleridnum':_0x23ad4a[_0x8de7('0x4')],'transferercalleridname':_0x23ad4a[_0x8de7('0x5')],'transfererconnectedlinenum':_0x23ad4a[_0x8de7('0x6')],'transfererconnectedlinename':_0x23ad4a[_0x8de7('0x7')],'transfereraccountcode':_0x23ad4a['transfereraccountcode'],'transferercontext':_0x23ad4a[_0x8de7('0x8')],'transfererexten':_0x23ad4a[_0x8de7('0x9')],'transfererlinkedid':_0x23ad4a[_0x8de7('0xa')],'transfereechannel':_0x23ad4a[_0x8de7('0xb')],'transfereecalleridnum':_0x23ad4a[_0x8de7('0xc')],'transfereecalleridname':_0x23ad4a[_0x8de7('0xd')],'transfereeconnectedlinenum':_0x23ad4a[_0x8de7('0xe')],'transfereeconnectedlinename':_0x23ad4a[_0x8de7('0xf')],'transfereeaccountcode':_0x23ad4a[_0x8de7('0x10')],'transfereecontext':_0x23ad4a[_0x8de7('0x11')],'transfereeexten':_0x23ad4a[_0x8de7('0x12')],'transfereelinkedid':_0x23ad4a['transfereelinkedid'],'isexternal':_0x23ad4a[_0x8de7('0x13')],'context':_0x23ad4a['context'],'extension':_0x23ad4a[_0x8de7('0x14')],'type':_0x8de7('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x8de7('0x16')]=function(_0x1eddb){return client[_0x8de7('0x0')](_0x8de7('0x1'),{'body':{'result':_0x1eddb[_0x8de7('0x2')],'transfererchannel':_0x1eddb['origtransfererchannel'],'transferercalleridnum':_0x1eddb['origtransferercalleridnum'],'transferercalleridname':_0x1eddb[_0x8de7('0x17')],'transfererconnectedlinenum':_0x1eddb[_0x8de7('0x18')],'transfererconnectedlinename':_0x1eddb[_0x8de7('0x19')],'transfereraccountcode':_0x1eddb['origtransfereraccountcode'],'transferercontext':_0x1eddb[_0x8de7('0x1a')],'transfererexten':_0x1eddb[_0x8de7('0x1b')],'transfererlinkedid':_0x1eddb[_0x8de7('0x1c')],'transfereechannel':_0x1eddb[_0x8de7('0x1d')],'transfereecalleridnum':_0x1eddb[_0x8de7('0x1e')],'transfereecalleridname':_0x1eddb[_0x8de7('0x1f')],'transfereeconnectedlinenum':_0x1eddb[_0x8de7('0x20')],'transfereeconnectedlinename':_0x1eddb[_0x8de7('0x21')],'transfereeaccountcode':_0x1eddb[_0x8de7('0x22')],'transfereecontext':_0x1eddb[_0x8de7('0x23')],'transfereeexten':_0x1eddb[_0x8de7('0x24')],'transfereelinkedid':_0x1eddb[_0x8de7('0x25')],'isexternal':_0x1eddb[_0x8de7('0x13')],'context':_0x1eddb['origtransferercontext'],'extension':_0x1eddb[_0x8de7('0x26')],'type':_0x8de7('0x27')},'log':_0x8de7('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d3e2ad3..bd398df 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 _0x5162=['ami\x20disconnected','join','pick','keys','module','action','Action','then','catch','message','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','validate','uniqueid','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','monitors','rec','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','filename','status','stop','StopMixMonitor\x20Success','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','run','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','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5162,0x103));var _0x2516=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x5162[_0x527824];return _0xc8b8ed;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0x2516('0x1'));var config=require(_0x2516('0x2'));var properties=require(_0x2516('0x3'));var ami=require(_0x2516('0x4'));exports[_0x2516('0x5')]=function(_0x25dce6,_0x3a7984,_0x5b71b5){return new BPromise(function(_0x48f411,_0x5beeb3){var _0x20a4a4={'QueuePause':function(_0xba4b36){return new Promise(function(_0xa1557,_0x3a8834){var _0x3abc5d=util[_0x2516('0x6')](_0x2516('0x7'),'SIP',_0xba4b36[_0x2516('0x8')]);if(_0x25dce6[_0x2516('0x9')]&&_0x25dce6[_0x2516('0x9')][_0x3abc5d]&&_0x25dce6['timers'][_0x3abc5d]['timer']){_0x25dce6['timers'][_0x3abc5d]['updateAcw']();}if(_0x25dce6[_0x2516('0xa')][_0x3abc5d]){_0x25dce6[_0x2516('0xa')][_0x3abc5d][_0x2516('0xb')]({'statePause':_0xba4b36[_0x2516('0xc')]?!![]:![]});}_0xa1557({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x33496b){var _0x458aca=this;return new Promise(function(_0x171da2,_0xb28714){if(ami[_0x2516('0xd')]()==![]){return _0xb28714(_0x458aca[_0x2516('0xe')](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}_0x33496b=_[_0x2516('0x13')](_0x33496b,_[_0x2516('0x14')](properties[_0x2516('0x15')]));_0x33496b[_0x2516('0x16')]='Reload';return ami[_0x2516('0x17')](_0x33496b)[_0x2516('0x18')](function(_0x1a1005){_0x171da2({'code':0xc8,'message':_0x1a1005['message']});})[_0x2516('0x19')](function(_0x5e96c7){_0xb28714(_0x458aca['error'](0x1f5,_0x5e96c7[_0x2516('0x1a')]));});});},'Command':function(_0x3583cf){var _0x151168=this;return new Promise(function(_0x618aed,_0x198b93){if(ami[_0x2516('0xd')]()==![]){return _0x198b93(_0x151168[_0x2516('0xe')](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}_0x3583cf=_[_0x2516('0x13')](_0x3583cf,'command');_0x3583cf['action']=_0x2516('0x1b');return ami[_0x2516('0x17')](_0x3583cf)[_0x2516('0x18')](function(_0x2d5b1b){_0x618aed({'code':0xc8,'message':_0x2d5b1b[_0x2516('0x1c')]});})[_0x2516('0x19')](function(_0x3d906d){_0x198b93(_0x151168[_0x2516('0xe')](0x1f5,_0x3d906d['message']));});});},'VoiceQueues':function(_0xa4538d){return new Promise(function(_0x39c63f,_0x774b60){var _0x434d54=[];for(var _0x47f4fb in _0x25dce6[_0x2516('0x1d')]){if(_0x25dce6[_0x2516('0x1d')][_0x2516('0x1e')](_0x47f4fb)){var _0x3d728a=_0x25dce6[_0x2516('0x1d')][_0x47f4fb];var _0x4a3dc8={'id':_0x3d728a['id'],'name':_0x3d728a[_0x2516('0x8')],'strategy':_0x3d728a[_0x2516('0x1f')],'answered':_0x3d728a[_0x2516('0x20')],'available':_0x3d728a[_0x2516('0x21')],'loggedIn':_0x3d728a[_0x2516('0x22')],'pTalking':_0x3d728a[_0x2516('0x23')],'sumBillable':_0x3d728a['sumBillable'],'sumDuration':_0x3d728a[_0x2516('0x24')],'sumHoldTime':_0x3d728a[_0x2516('0x25')]||0x0,'talking':_0x3d728a['talking'],'total':_0x3d728a[_0x2516('0x26')],'type':_0x3d728a[_0x2516('0x27')],'unmanaged':_0x3d728a[_0x2516('0x28')],'abandoned':_0x3d728a[_0x2516('0x29')],'waiting':_0x3d728a[_0x2516('0x2a')],'loggedInDb':_0x3d728a[_0x2516('0x2b')]};if(_0x3d728a[_0x2516('0x27')]===_0x2516('0x2c')){_0x4a3dc8[_0x2516('0x2d')]=_0x3d728a[_0x2516('0x2d')];_0x4a3dc8[_0x2516('0x2e')]=_0x3d728a[_0x2516('0x2e')];_0x4a3dc8[_0x2516('0x2f')]=_0x3d728a[_0x2516('0x2f')];_0x4a3dc8[_0x2516('0x30')]=_0x3d728a['dialOriginateCallerIdNumber'];_0x4a3dc8[_0x2516('0x31')]=_0x3d728a['dialOriginateTimeout'];_0x4a3dc8[_0x2516('0x32')]=_0x3d728a['dialPrefix'];_0x4a3dc8[_0x2516('0x33')]=_0x3d728a['temp'];_0x4a3dc8[_0x2516('0x34')]=_0x3d728a[_0x2516('0x34')];_0x4a3dc8[_0x2516('0x35')]=_0x3d728a[_0x2516('0x35')];_0x4a3dc8[_0x2516('0x36')]=_0x3d728a[_0x2516('0x36')];_0x4a3dc8[_0x2516('0x37')]=_0x3d728a[_0x2516('0x37')];_0x4a3dc8[_0x2516('0x38')]=_0x3d728a['outboundCongestionCallsDay'];_0x4a3dc8[_0x2516('0x39')]=_0x3d728a[_0x2516('0x39')];_0x4a3dc8[_0x2516('0x3a')]=_0x3d728a[_0x2516('0x3a')];_0x4a3dc8['outboundDropCallsDayTimeout']=_0x3d728a['outboundDropCallsDayTimeout'];_0x4a3dc8[_0x2516('0x3b')]=_0x3d728a[_0x2516('0x3b')];_0x4a3dc8[_0x2516('0x3c')]=_0x3d728a[_0x2516('0x3c')];_0x4a3dc8[_0x2516('0x3d')]=_0x3d728a[_0x2516('0x3d')];_0x4a3dc8[_0x2516('0x3e')]=_0x3d728a[_0x2516('0x3e')];_0x4a3dc8[_0x2516('0x3f')]=_0x3d728a[_0x2516('0x3f')];_0x4a3dc8['outboundUnknownCallsDay']=_0x3d728a['outboundUnknownCallsDay'];_0x4a3dc8[_0x2516('0x40')]=_0x3d728a[_0x2516('0x40')];_0x4a3dc8['predictiveIntervalAvgHoldtime']=_0x3d728a['predictiveIntervalAvgHoldtime'];_0x4a3dc8[_0x2516('0x41')]=_0x3d728a[_0x2516('0x41')];_0x4a3dc8['predictiveIntervalDroppedCallsCallersExit']=_0x3d728a[_0x2516('0x42')];_0x4a3dc8['predictiveIntervalDroppedCallsTimeout']=_0x3d728a[_0x2516('0x43')];_0x4a3dc8[_0x2516('0x44')]=_0x3d728a['predictiveIntervalErlangCalls'];_0x4a3dc8[_0x2516('0x45')]=_0x3d728a[_0x2516('0x45')];_0x4a3dc8[_0x2516('0x46')]=_0x3d728a[_0x2516('0x46')];_0x4a3dc8[_0x2516('0x47')]=_0x3d728a[_0x2516('0x47')];_0x4a3dc8[_0x2516('0x48')]=_0x3d728a[_0x2516('0x48')];_0x4a3dc8[_0x2516('0x49')]=_0x3d728a[_0x2516('0x49')];_0x4a3dc8[_0x2516('0x4a')]=_0x3d728a[_0x2516('0x4a')];_0x4a3dc8[_0x2516('0x1a')]=_0x3d728a['message'];_0x4a3dc8[_0x2516('0x4b')]=_0x3d728a[_0x2516('0x4b')];_0x4a3dc8['erlangCalls']=_0x3d728a[_0x2516('0x4c')];_0x4a3dc8[_0x2516('0x4d')]=_0x3d728a[_0x2516('0x4d')];_0x4a3dc8[_0x2516('0x4e')]=_0x3d728a[_0x2516('0x4e')];_0x4a3dc8['erlangBusyFactor']=_0x3d728a[_0x2516('0x4f')];_0x4a3dc8[_0x2516('0x50')]=_0x3d728a[_0x2516('0x50')];_0x4a3dc8[_0x2516('0x51')]=_0x3d728a[_0x2516('0x51')];}if(_0x3d728a[_0x2516('0x52')]){_0x4a3dc8['Trunk']={'id':_0x3d728a[_0x2516('0x52')]['id'],'name':_0x3d728a[_0x2516('0x52')][_0x2516('0x8')],'active':_0x3d728a[_0x2516('0x52')][_0x2516('0x53')],'callerid':_0x3d728a[_0x2516('0x52')][_0x2516('0x54')]};}if(_0x3d728a['Interval']){_0x4a3dc8[_0x2516('0x55')]={'id':_0x3d728a['Interval']['id'],'name':_0x3d728a[_0x2516('0x55')]['name']};}_0x434d54[_0x2516('0x56')](_0x4a3dc8);}}_0x39c63f({'count':_0x434d54[_0x2516('0x57')],'rows':_0x434d54});});},'UpdateVoiceQueue':function(_0x427cf6){return new Promise(function(_0x47f9a0,_0x4a2de3){var _0x2ede9f=_[_0x2516('0x58')](_0x25dce6['voiceQueues'],{'id':parseInt(_0x427cf6['id'])});var _0x5471e5=_[_0x2516('0x59')](_0x427cf6,['id']);if(_0x2ede9f){for(var _0x147e05 in _0x5471e5){if(typeof _0x5471e5[_0x147e05]!==_0x2516('0x5a')&&typeof _0x2ede9f[_0x147e05]!=='undefined'){_0x2ede9f[_0x147e05]=_0x5471e5[_0x147e05];}}_0x47f9a0(_0x2ede9f);}else{_0x4a2de3();}});},'VoiceChannels':function(_0xddc748){return new Promise(function(_0x4899ae,_0x2c7e2d){var _0x39fd32=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x5c')]);_0x4899ae({'count':_0x39fd32['length'],'rows':_0x39fd32});});},'VoiceChannelMixMonitor':function(_0x56d3e5){var _0xa08af4=this;return new Promise(function(_0x16b382,_0x236048){if(ami[_0x2516('0xd')]()==![]){return _0x236048(_0xa08af4['error'](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')]['join']('\x20')));}var _0x45e179=schema(properties[_0x2516('0x5d')])[_0x2516('0x5e')](_0x56d3e5);if(_0x45e179[_0x2516('0x57')]>0x0){return _0x236048(_0xa08af4[_0x2516('0xe')](0x1f4,_['map'](_0x45e179,_0x2516('0x1a'))[_0x2516('0x12')](',\x20')));}var _0x136d5c=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x5c')],{'uniqueid':_0x56d3e5[_0x2516('0x5f')]});if(_0x136d5c&&_0x136d5c['channel']){var _0x4f3eba=util['format'](_0x2516('0x60'),_0x56d3e5['filename']||_0x56d3e5['uniqueid'],_0x56d3e5['format']||_0x2516('0x61'));return ami[_0x2516('0x17')]({'action':_0x2516('0x62'),'channel':_0x136d5c[_0x2516('0x63')],'file':_0x4f3eba,'options':_0x2516('0x64')})['then'](function(_0x1c1e14){var _0x32b432=_[_0x2516('0x58')](_0x136d5c['monitors'],{'filename':_0x2516('0x65')+_0x4f3eba[_0x2516('0x66')]()});if(_['isNil'](_0x32b432)){_0x136d5c[_0x2516('0x67')][_0x2516('0x56')]({'filename':_0x2516('0x65')+_0x4f3eba[_0x2516('0x66')](),'createdAt':moment()[_0x2516('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x1c1e14['mixmonitorid'],'status':_0x2516('0x68')});}else{_0x32b432['mixmonitorid']=_0x1c1e14[_0x2516('0x69')];_0x32b432['status']=_0x2516('0x68');}_0x16b382({'code':0xc8,'message':[_0x56d3e5[_0x2516('0x5f')],_0x2516('0x6a'),_0x1c1e14[_0x2516('0x69')]][_0x2516('0x12')]('\x20'),'mixmonitorid':_0x1c1e14[_0x2516('0x69')]});})[_0x2516('0x19')](function(_0xf9c375){_0x236048(_0xa08af4[_0x2516('0xe')](0x1f5,[_0x56d3e5[_0x2516('0x5f')],_0xf9c375[_0x2516('0x1a')]['toLowerCase']()][_0x2516('0x12')]('\x20')));});}else{return _0x236048(_0xa08af4[_0x2516('0xe')](0x1f5,_0x2516('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x48dc96){var _0x26715c=this;return new Promise(function(_0x58eff3,_0x435450){if(ami[_0x2516('0xd')]()==![]){return _0x435450(_0x26715c[_0x2516('0xe')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}var _0x2c2032=schema(properties[_0x2516('0x5d')])['validate'](_0x48dc96);if(_0x2c2032[_0x2516('0x57')]>0x0){return _0x435450(_0x26715c[_0x2516('0xe')](0x1f4,_[_0x2516('0x6c')](_0x2c2032,'message')[_0x2516('0x12')](',\x20')));}var _0x4300b0=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x5c')],{'uniqueid':_0x48dc96[_0x2516('0x5f')]});if(_0x4300b0){return BPromise[_0x2516('0x6d')]()[_0x2516('0x18')](function(){if(_0x4300b0[_0x2516('0x63')]){return ami[_0x2516('0x17')]({'action':_0x2516('0x6e'),'channel':_0x4300b0[_0x2516('0x63')],'mixmonitorid':_0x48dc96[_0x2516('0x69')]})[_0x2516('0x19')](function(_0x47f211){});}})[_0x2516('0x18')](function(){if(_0x4300b0[_0x2516('0x6f')]){return ami[_0x2516('0x17')]({'action':_0x2516('0x6e'),'channel':_0x4300b0[_0x2516('0x6f')],'mixmonitorid':_0x48dc96[_0x2516('0x69')]})[_0x2516('0x19')](function(_0x496001){});}})[_0x2516('0x18')](function(_0xab7abf){var _0x2ee658=_[_0x2516('0x58')](_0x4300b0[_0x2516('0x67')],{'mixmonitorid':_0x48dc96[_0x2516('0x69')]});if(_0x2ee658){_0x2ee658['status']='stop';}})['then'](function(){var _0x331d78=util[_0x2516('0x6')](_0x2516('0x60'),_0x48dc96[_0x2516('0x70')]||_0x48dc96['uniqueid'],_0x48dc96['format']||_0x2516('0x61'));var _0x56645a=_[_0x2516('0x58')](_0x4300b0[_0x2516('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x331d78[_0x2516('0x66')]()});if(_0x56645a){_0x56645a[_0x2516('0x71')]=_0x2516('0x72');}})[_0x2516('0x18')](function(){_0x58eff3({'code':0xc8,'message':[_0x48dc96[_0x2516('0x5f')],_0x2516('0x73')][_0x2516('0x12')]('\x20')});})[_0x2516('0x19')](function(_0x120f03){_0x435450(_0x26715c['error'](0x1f5,[_0x48dc96['uniqueid'],_0x120f03[_0x2516('0x1a')][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')));});}else{return _0x435450(_0x26715c['error'](0x1f5,_0x2516('0x6b')));}});},'VoiceQueuesChannels':function(_0x556641){return new Promise(function(_0x44bfef,_0x3f6601){var _0x1b8c97=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x74')]);_0x44bfef({'count':_0x1b8c97[_0x2516('0x57')],'rows':_0x1b8c97});});},'VoiceQueuesChannel':function(_0x3d0d99){var _0x3379f8=this;return new Promise(function(_0x6029a3,_0x129987){var _0x4eaddd=schema(properties['voicequeuechannel'])[_0x2516('0x5e')](_0x3d0d99);if(_0x4eaddd['length']>0x0){return _0x129987(_0x3379f8['error'](0x1f4,_[_0x2516('0x6c')](_0x4eaddd,_0x2516('0x1a'))[_0x2516('0x12')](',\x20')));}var _0xa4eeae=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x74')],{'uniqueid':_0x3d0d99[_0x2516('0x5f')]});if(_0xa4eeae){_0x6029a3(_0xa4eeae);}else{return _0x129987(_0x3379f8[_0x2516('0xe')](0x1f5,_0x2516('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x5d481b){var _0xe966c8=this;return new Promise(function(_0x2e1029,_0x350562){if(ami[_0x2516('0xd')]()==![]){return _0x350562(_0xe966c8['error'](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}var _0x3c4f24=schema(properties['voicequeuechannelhangup'])[_0x2516('0x5e')](_0x5d481b);if(_0x3c4f24['length']>0x0){return _0x350562(_0xe966c8['error'](0x1f4,_[_0x2516('0x6c')](_0x3c4f24,_0x2516('0x1a'))[_0x2516('0x12')](',\x20')));}var _0x49a992=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x74')],{'uniqueid':_0x5d481b[_0x2516('0x5f')]});if(_0x49a992&&_0x49a992[_0x2516('0x63')]){return ami['Action']({'action':_0x2516('0x75'),'channel':_0x49a992[_0x2516('0x63')]})[_0x2516('0x18')](function(_0x1d1983){_0x2e1029({'code':0xc8,'message':[_0x5d481b['uniqueid'],_0x1d1983[_0x2516('0x1a')][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')});})['catch'](function(_0x2397ba){_0x350562(_0xe966c8['error'](0x1f5,[_0x5d481b[_0x2516('0x5f')],_0x2397ba[_0x2516('0x1a')][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')));});}else{return _0x350562(_0xe966c8[_0x2516('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x5f0806){var _0x4d671b=this;return new Promise(function(_0x3d8389,_0x444391){if(ami['isConnected']()==![]){return _0x444391(_0x4d671b[_0x2516('0xe')](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}var _0x493c5c=schema(properties[_0x2516('0x76')])[_0x2516('0x5e')](_0x5f0806);if(_0x493c5c[_0x2516('0x57')]>0x0){return _0x444391(_0x4d671b['error'](0x1f4,_['map'](_0x493c5c,'message')[_0x2516('0x12')](',\x20')));}var _0x2dc677=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x74')],{'uniqueid':_0x5f0806['uniqueid']});if(_0x2dc677&&_0x2dc677['channel']){return ami['Action']({'action':_0x2516('0x77'),'channel':_0x2dc677[_0x2516('0x63')],'exten':_0x5f0806[_0x2516('0x78')],'context':_0x5f0806[_0x2516('0x79')]||_0x2dc677[_0x2516('0x79')],'priority':0x1})[_0x2516('0x18')](function(_0x3b8348){_0x3d8389({'code':0xc8,'message':[_0x5f0806[_0x2516('0x5f')],_0x3b8348['message'][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')});})[_0x2516('0x19')](function(_0x320d38){_0x444391(_0x4d671b[_0x2516('0xe')](0x1f5,[_0x5f0806['uniqueid'],_0x320d38[_0x2516('0x1a')][_0x2516('0x66')]()]['join']('\x20')));});}else{return _0x444391(_0x4d671b[_0x2516('0xe')](0x1f5,_0x2516('0x6b')));}});},'Agents':function(_0x1a1297){return new Promise(function(_0x1b517c,_0x9f96cf){var _0x3b1a02=_['values'](_0x25dce6[_0x2516('0xa')]);_0x1b517c({'count':_0x3b1a02[_0x2516('0x57')],'rows':_0x3b1a02});});},'Telephones':function(_0x24f7d7){return new Promise(function(_0x23ef83,_0x4493ab){var _0xe93655=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x7a')]);_0x23ef83({'count':_0xe93655[_0x2516('0x57')],'rows':_0xe93655});});},'Trunks':function(_0x559f5d){return new Promise(function(_0x57b13b,_0x5ba32a){var _0x447786=_[_0x2516('0x5b')](_0x25dce6['trunks']);_0x57b13b({'count':_0x447786['length'],'rows':_0x447786});});},'OutboundChannels':function(_0x40efc6){return new Promise(function(_0x1d2e2f,_0x6e55a6){var _0x158a9a=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x7b')]);_0x1d2e2f({'count':_0x158a9a[_0x2516('0x57')],'rows':_0x158a9a});});},'Outbound':function(_0x4ccd7d){return new Promise(function(_0x3b71a1,_0x36eab7){_0x3b71a1(_0x25dce6[_0x2516('0x2c')]);});},'Campaigns':function(_0x18a9e9){return new Promise(function(_0x7c48ce,_0x7cedc9){var _0x273b11=_['values'](_0x25dce6['campaigns']);_0x7c48ce({'count':_0x273b11[_0x2516('0x57')],'rows':_0x273b11});});},'VoiceQueuesPreview':function(_0x3de1cd){var _0x1cea65=this;return new Promise(function(_0x56aa6c,_0x17548a){_0x3a7984[_0x2516('0x7c')](_0x3de1cd['id'])[_0x2516('0x18')](function(_0x3ebdd5){_0x56aa6c({'code':0xc8,'message':_0x3ebdd5[_0x2516('0x1a')]});})[_0x2516('0x19')](function(_0x581c2c){_0x17548a(_0x1cea65[_0x2516('0xe')](0x1f4,_0x581c2c[_0x2516('0x1a')]));});});},'EventManager':function(_0x2e58b1){var _0x38cf65=this;return new Promise(function(_0x124371,_0x2d9c8e){if(!_0x2e58b1[_0x2516('0x7d')]){return _0x2d9c8e(_0x38cf65[_0x2516('0xe')](0x1f4,_0x2516('0x7e')));}ami[_0x2516('0x7f')](_0x2516('0x80')+_0x2e58b1[_0x2516('0x7d')],_0x2e58b1[_0x2516('0x1a')]);_0x124371({'code':0xc8,'message':_0x2e58b1});});},'FaxAccounts':function(_0x18c309){return new Promise(function(_0xbb1c7d,_0x41cdef){var _0x4d9432=_['values'](_0x25dce6[_0x2516('0x81')]);_0xbb1c7d({'count':_0x4d9432[_0x2516('0x57')],'rows':_0x4d9432});});},'SendFax':function(_0xe66cb3){var _0x4099fc=this;return new Promise(function(_0x33da91,_0x14208b){_0x5b71b5[_0x2516('0x82')](_0xe66cb3)[_0x2516('0x18')](function(_0x5d6926){_0x33da91({'code':0xc8,'message':_0x5d6926[_0x2516('0x1a')]});})[_0x2516('0x19')](function(_0xfd644c){_0x14208b(_0x4099fc['error'](0x1f4,_0xfd644c[_0x2516('0x1a')]));});});},'CheckAfterSend':function(_0x498661){var _0x12caef=this;return new Promise(function(_0x48863e,_0x3ecad0){_0x5b71b5[_0x2516('0x83')](_0x498661)['then'](function(_0xd47496){_0x48863e({'code':0xc8,'message':_0xd47496['message']});})[_0x2516('0x19')](function(_0xd649dc){_0x3ecad0(_0x12caef[_0x2516('0xe')](0x1f4,_0xd649dc[_0x2516('0x1a')]));});});}};var _0x3f9d07=jayson[_0x2516('0x84')](_0x20a4a4)[_0x2516('0x85')]();_0x3f9d07['on'](_0x2516('0xe'),function(_0x1e40f0){return _0x5beeb3(_0x1e40f0);});_0x3f9d07['listen'](0x232a,_0x2516('0x86'),function(){console[_0x2516('0x87')](_0x2516('0x88'),0x232a);return _0x48f411(_0x2516('0x89')+0x232a);});});}; \ No newline at end of file +var _0xfd20=['sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','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','length','find','omit','undefined','values','join','voicechannel','validate','map','channels','uniqueid','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','bluebird','moment','../properties','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','keys','action','Action','message','username','command','then','content','catch','voiceQueues','hasOwnProperty','name','strategy','answered','available','pTalking','sumBillable','sumDuration'];(function(_0x2e44cf,_0x16f684){var _0x361268=function(_0x2a59db){while(--_0x2a59db){_0x2e44cf['push'](_0x2e44cf['shift']());}};_0x361268(++_0x16f684);}(_0xfd20,0x66));var _0x0fd2=function(_0x2ec9a3,_0x4c511d){_0x2ec9a3=_0x2ec9a3-0x0;var _0x245fc0=_0xfd20[_0x2ec9a3];return _0x245fc0;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x0fd2('0x1'));var moment=require(_0x0fd2('0x2'));var config=require('../../../config/environment');var properties=require(_0x0fd2('0x3'));var ami=require('../ami');exports[_0x0fd2('0x4')]=function(_0x24292c,_0x2ef0c3,_0xf25991){return new BPromise(function(_0x247d6e,_0x4d114c){var _0x55467b={'QueuePause':function(_0x32d460){return new Promise(function(_0x15ba86,_0x24d6f4){var _0x946c0c=util[_0x0fd2('0x5')](_0x0fd2('0x6'),_0x0fd2('0x7'),_0x32d460['name']);if(_0x24292c[_0x0fd2('0x8')]&&_0x24292c[_0x0fd2('0x8')][_0x946c0c]&&_0x24292c['timers'][_0x946c0c][_0x0fd2('0x9')]){_0x24292c['timers'][_0x946c0c][_0x0fd2('0xa')]();}if(_0x24292c[_0x0fd2('0xb')][_0x946c0c]){_0x24292c[_0x0fd2('0xb')][_0x946c0c][_0x0fd2('0xc')]({'statePause':_0x32d460[_0x0fd2('0xd')]?!![]:![]});}_0x15ba86({'code':0xc8,'message':_0x0fd2('0xe')});});},'Reload':function(_0x1f7a6e){var _0x7b05c3=this;return new Promise(function(_0x51390c,_0x48c2f1){if(ami[_0x0fd2('0xf')]()==![]){return _0x48c2f1(_0x7b05c3[_0x0fd2('0x10')](0x1f4,[config[_0x0fd2('0x11')]['ip'],config[_0x0fd2('0x11')]['username'],_0x0fd2('0x12')]['join']('\x20')));}_0x1f7a6e=_['pick'](_0x1f7a6e,_[_0x0fd2('0x13')](properties['module']));_0x1f7a6e[_0x0fd2('0x14')]='Reload';return ami[_0x0fd2('0x15')](_0x1f7a6e)['then'](function(_0x267dfb){_0x51390c({'code':0xc8,'message':_0x267dfb[_0x0fd2('0x16')]});})['catch'](function(_0x2b25d2){_0x48c2f1(_0x7b05c3['error'](0x1f5,_0x2b25d2[_0x0fd2('0x16')]));});});},'Command':function(_0x37c7fc){var _0x3fb07e=this;return new Promise(function(_0x11b423,_0x2977ef){if(ami[_0x0fd2('0xf')]()==![]){return _0x2977ef(_0x3fb07e[_0x0fd2('0x10')](0x1f4,[config[_0x0fd2('0x11')]['ip'],config[_0x0fd2('0x11')][_0x0fd2('0x17')],'ami\x20disconnected']['join']('\x20')));}_0x37c7fc=_['pick'](_0x37c7fc,_0x0fd2('0x18'));_0x37c7fc[_0x0fd2('0x14')]='Command';return ami['Action'](_0x37c7fc)[_0x0fd2('0x19')](function(_0x25563c){_0x11b423({'code':0xc8,'message':_0x25563c[_0x0fd2('0x1a')]});})[_0x0fd2('0x1b')](function(_0x25cdd2){_0x2977ef(_0x3fb07e['error'](0x1f5,_0x25cdd2[_0x0fd2('0x16')]));});});},'VoiceQueues':function(_0x42e988){return new Promise(function(_0xd0a2cc,_0x54cce1){var _0x4c77a8=[];for(var _0x11bb10 in _0x24292c[_0x0fd2('0x1c')]){if(_0x24292c['voiceQueues'][_0x0fd2('0x1d')](_0x11bb10)){var _0x429fef=_0x24292c[_0x0fd2('0x1c')][_0x11bb10];var _0x1defb4={'id':_0x429fef['id'],'name':_0x429fef[_0x0fd2('0x1e')],'strategy':_0x429fef[_0x0fd2('0x1f')],'answered':_0x429fef[_0x0fd2('0x20')],'available':_0x429fef[_0x0fd2('0x21')],'loggedIn':_0x429fef['loggedIn'],'pTalking':_0x429fef[_0x0fd2('0x22')],'sumBillable':_0x429fef[_0x0fd2('0x23')],'sumDuration':_0x429fef[_0x0fd2('0x24')],'sumHoldTime':_0x429fef[_0x0fd2('0x25')]||0x0,'talking':_0x429fef[_0x0fd2('0x26')],'total':_0x429fef['total'],'type':_0x429fef[_0x0fd2('0x27')],'unmanaged':_0x429fef[_0x0fd2('0x28')],'abandoned':_0x429fef[_0x0fd2('0x29')],'waiting':_0x429fef[_0x0fd2('0x2a')],'loggedInDb':_0x429fef[_0x0fd2('0x2b')]};if(_0x429fef[_0x0fd2('0x27')]===_0x0fd2('0x2c')){_0x1defb4[_0x0fd2('0x2d')]=_0x429fef['dialActive'];_0x1defb4[_0x0fd2('0x2e')]=_0x429fef['dialMethod'];_0x1defb4['dialOriginateCallerIdName']=_0x429fef[_0x0fd2('0x2f')];_0x1defb4['dialOriginateCallerIdNumber']=_0x429fef[_0x0fd2('0x30')];_0x1defb4['dialOriginateTimeout']=_0x429fef[_0x0fd2('0x31')];_0x1defb4['dialPrefix']=_0x429fef['dialPrefix'];_0x1defb4[_0x0fd2('0x32')]=_0x429fef[_0x0fd2('0x32')];_0x1defb4[_0x0fd2('0x33')]=_0x429fef['outboundAnswerAgiCallsDay'];_0x1defb4['outboundAnswerCallsDay']=_0x429fef[_0x0fd2('0x34')];_0x1defb4['outboundBlacklistCallsDay']=_0x429fef[_0x0fd2('0x35')];_0x1defb4[_0x0fd2('0x36')]=_0x429fef[_0x0fd2('0x36')];_0x1defb4[_0x0fd2('0x37')]=_0x429fef[_0x0fd2('0x37')];_0x1defb4[_0x0fd2('0x38')]=_0x429fef[_0x0fd2('0x38')];_0x1defb4['outboundDropCallsDayCallersExit']=_0x429fef[_0x0fd2('0x39')];_0x1defb4[_0x0fd2('0x3a')]=_0x429fef['outboundDropCallsDayTimeout'];_0x1defb4['outboundNoAnswerCallsDay']=_0x429fef[_0x0fd2('0x3b')];_0x1defb4['outboundNoSuchCallsDay']=_0x429fef['outboundNoSuchCallsDay'];_0x1defb4[_0x0fd2('0x3c')]=_0x429fef[_0x0fd2('0x3c')];_0x1defb4[_0x0fd2('0x3d')]=_0x429fef[_0x0fd2('0x3d')];_0x1defb4[_0x0fd2('0x3e')]=_0x429fef[_0x0fd2('0x3e')];_0x1defb4[_0x0fd2('0x3f')]=_0x429fef[_0x0fd2('0x3f')];_0x1defb4[_0x0fd2('0x40')]=_0x429fef[_0x0fd2('0x40')];_0x1defb4[_0x0fd2('0x41')]=_0x429fef[_0x0fd2('0x41')];_0x1defb4[_0x0fd2('0x42')]=_0x429fef[_0x0fd2('0x42')];_0x1defb4[_0x0fd2('0x43')]=_0x429fef[_0x0fd2('0x43')];_0x1defb4['predictiveIntervalDroppedCallsTimeout']=_0x429fef[_0x0fd2('0x44')];_0x1defb4[_0x0fd2('0x45')]=_0x429fef[_0x0fd2('0x45')];_0x1defb4[_0x0fd2('0x46')]=_0x429fef['predictiveIntervalErlangCallsDroppedCalls'];_0x1defb4[_0x0fd2('0x47')]=_0x429fef['predictiveIntervalHitRate'];_0x1defb4[_0x0fd2('0x48')]=_0x429fef[_0x0fd2('0x48')];_0x1defb4['predictiveIntervalPauses']=_0x429fef[_0x0fd2('0x49')];_0x1defb4[_0x0fd2('0x4a')]=_0x429fef[_0x0fd2('0x4a')];_0x1defb4[_0x0fd2('0x4b')]=_0x429fef[_0x0fd2('0x4b')];_0x1defb4[_0x0fd2('0x16')]=_0x429fef['message'];_0x1defb4[_0x0fd2('0x4c')]=_0x429fef[_0x0fd2('0x4c')];_0x1defb4[_0x0fd2('0x4d')]=_0x429fef[_0x0fd2('0x4d')];_0x1defb4[_0x0fd2('0x4e')]=_0x429fef['erlangCallToSecond'];_0x1defb4[_0x0fd2('0x4f')]=_0x429fef[_0x0fd2('0x4f')];_0x1defb4['erlangBusyFactor']=_0x429fef[_0x0fd2('0x50')];_0x1defb4[_0x0fd2('0x51')]=_0x429fef[_0x0fd2('0x51')];_0x1defb4[_0x0fd2('0x52')]=_0x429fef[_0x0fd2('0x52')];}if(_0x429fef[_0x0fd2('0x53')]){_0x1defb4[_0x0fd2('0x53')]={'id':_0x429fef[_0x0fd2('0x53')]['id'],'name':_0x429fef['Trunk']['name'],'active':_0x429fef[_0x0fd2('0x53')][_0x0fd2('0x54')],'callerid':_0x429fef['Trunk'][_0x0fd2('0x55')]};}if(_0x429fef['Interval']){_0x1defb4[_0x0fd2('0x56')]={'id':_0x429fef[_0x0fd2('0x56')]['id'],'name':_0x429fef[_0x0fd2('0x56')][_0x0fd2('0x1e')]};}_0x4c77a8[_0x0fd2('0x57')](_0x1defb4);}}_0xd0a2cc({'count':_0x4c77a8[_0x0fd2('0x58')],'rows':_0x4c77a8});});},'UpdateVoiceQueue':function(_0x49237b){return new Promise(function(_0x558c5f,_0x1070e5){var _0x5065dc=_[_0x0fd2('0x59')](_0x24292c[_0x0fd2('0x1c')],{'id':parseInt(_0x49237b['id'])});var _0x272c0f=_[_0x0fd2('0x5a')](_0x49237b,['id']);if(_0x5065dc){for(var _0x2f47f9 in _0x272c0f){if(typeof _0x272c0f[_0x2f47f9]!=='undefined'&&typeof _0x5065dc[_0x2f47f9]!==_0x0fd2('0x5b')){_0x5065dc[_0x2f47f9]=_0x272c0f[_0x2f47f9];}}_0x558c5f(_0x5065dc);}else{_0x1070e5();}});},'VoiceChannels':function(_0x49f5c2){return new Promise(function(_0x2f0684,_0x3c3066){var _0x5352cc=_[_0x0fd2('0x5c')](_0x24292c['channels']);_0x2f0684({'count':_0x5352cc['length'],'rows':_0x5352cc});});},'VoiceChannelMixMonitor':function(_0x197b74){var _0x2bb20f=this;return new Promise(function(_0x2f27ed,_0x4e28f3){if(ami[_0x0fd2('0xf')]()==![]){return _0x4e28f3(_0x2bb20f[_0x0fd2('0x10')](0x1f4,[config[_0x0fd2('0x11')]['ip'],config[_0x0fd2('0x11')]['username'],_0x0fd2('0x12')][_0x0fd2('0x5d')]('\x20')));}var _0x28eafe=schema(properties[_0x0fd2('0x5e')])[_0x0fd2('0x5f')](_0x197b74);if(_0x28eafe[_0x0fd2('0x58')]>0x0){return _0x4e28f3(_0x2bb20f[_0x0fd2('0x10')](0x1f4,_[_0x0fd2('0x60')](_0x28eafe,_0x0fd2('0x16'))[_0x0fd2('0x5d')](',\x20')));}var _0x7e86ca=_['find'](_0x24292c[_0x0fd2('0x61')],{'uniqueid':_0x197b74[_0x0fd2('0x62')]});if(_0x7e86ca&&_0x7e86ca['channel']){var _0x4504f7=util['format'](_0x0fd2('0x63'),_0x197b74[_0x0fd2('0x64')]||_0x197b74[_0x0fd2('0x62')],_0x197b74[_0x0fd2('0x5')]||_0x0fd2('0x65'));return ami['Action']({'action':_0x0fd2('0x66'),'channel':_0x7e86ca[_0x0fd2('0x67')],'file':_0x4504f7,'options':_0x0fd2('0x68')})['then'](function(_0x488478){var _0x23a55d=_[_0x0fd2('0x59')](_0x7e86ca[_0x0fd2('0x69')],{'filename':_0x0fd2('0x6a')+_0x4504f7[_0x0fd2('0x6b')]()});if(_[_0x0fd2('0x6c')](_0x23a55d)){_0x7e86ca['monitors'][_0x0fd2('0x57')]({'filename':_0x0fd2('0x6a')+_0x4504f7[_0x0fd2('0x6b')](),'createdAt':moment()[_0x0fd2('0x5')](_0x0fd2('0x6d')),'mixmonitorid':_0x488478[_0x0fd2('0x6e')],'status':_0x0fd2('0x6f')});}else{_0x23a55d[_0x0fd2('0x6e')]=_0x488478[_0x0fd2('0x6e')];_0x23a55d[_0x0fd2('0x70')]=_0x0fd2('0x6f');}_0x2f27ed({'code':0xc8,'message':[_0x197b74[_0x0fd2('0x62')],_0x0fd2('0x71'),_0x488478['mixmonitorid']][_0x0fd2('0x5d')]('\x20'),'mixmonitorid':_0x488478[_0x0fd2('0x6e')]});})['catch'](function(_0x230d69){_0x4e28f3(_0x2bb20f[_0x0fd2('0x10')](0x1f5,[_0x197b74[_0x0fd2('0x62')],_0x230d69[_0x0fd2('0x16')]['toLowerCase']()]['join']('\x20')));});}else{return _0x4e28f3(_0x2bb20f['error'](0x1f5,_0x0fd2('0x72')));}});},'VoiceChannelStopMixMonitor':function(_0x14ff78){var _0x3561ab=this;return new Promise(function(_0x27754d,_0x41dd02){if(ami[_0x0fd2('0xf')]()==![]){return _0x41dd02(_0x3561ab[_0x0fd2('0x10')](0x1f4,[config[_0x0fd2('0x11')]['ip'],config[_0x0fd2('0x11')][_0x0fd2('0x17')],'ami\x20disconnected']['join']('\x20')));}var _0x574ff7=schema(properties['voicechannel'])['validate'](_0x14ff78);if(_0x574ff7[_0x0fd2('0x58')]>0x0){return _0x41dd02(_0x3561ab['error'](0x1f4,_[_0x0fd2('0x60')](_0x574ff7,'message')[_0x0fd2('0x5d')](',\x20')));}var _0x525b8a=_[_0x0fd2('0x59')](_0x24292c[_0x0fd2('0x61')],{'uniqueid':_0x14ff78[_0x0fd2('0x62')]});if(_0x525b8a){return BPromise['resolve']()['then'](function(){if(_0x525b8a[_0x0fd2('0x67')]){return ami[_0x0fd2('0x15')]({'action':_0x0fd2('0x73'),'channel':_0x525b8a[_0x0fd2('0x67')],'mixmonitorid':_0x14ff78[_0x0fd2('0x6e')]})[_0x0fd2('0x1b')](function(_0x359ee2){});}})[_0x0fd2('0x19')](function(){if(_0x525b8a[_0x0fd2('0x74')]){return ami['Action']({'action':_0x0fd2('0x73'),'channel':_0x525b8a[_0x0fd2('0x74')],'mixmonitorid':_0x14ff78[_0x0fd2('0x6e')]})['catch'](function(_0x3ca213){});}})['then'](function(_0x3659b6){var _0x4244cf=_[_0x0fd2('0x59')](_0x525b8a[_0x0fd2('0x69')],{'mixmonitorid':_0x14ff78[_0x0fd2('0x6e')]});if(_0x4244cf){_0x4244cf[_0x0fd2('0x70')]=_0x0fd2('0x75');}})[_0x0fd2('0x19')](function(){var _0x53bb88=util[_0x0fd2('0x5')](_0x0fd2('0x63'),_0x14ff78['filename']||_0x14ff78[_0x0fd2('0x62')],_0x14ff78[_0x0fd2('0x5')]||_0x0fd2('0x65'));var _0x58d2f1=_[_0x0fd2('0x59')](_0x525b8a[_0x0fd2('0x69')],{'filename':_0x0fd2('0x6a')+_0x53bb88[_0x0fd2('0x6b')]()});if(_0x58d2f1){_0x58d2f1[_0x0fd2('0x70')]=_0x0fd2('0x75');}})[_0x0fd2('0x19')](function(){_0x27754d({'code':0xc8,'message':[_0x14ff78[_0x0fd2('0x62')],_0x0fd2('0x76')]['join']('\x20')});})[_0x0fd2('0x1b')](function(_0x10b4ce){_0x41dd02(_0x3561ab[_0x0fd2('0x10')](0x1f5,[_0x14ff78['uniqueid'],_0x10b4ce[_0x0fd2('0x16')][_0x0fd2('0x6b')]()][_0x0fd2('0x5d')]('\x20')));});}else{return _0x41dd02(_0x3561ab[_0x0fd2('0x10')](0x1f5,_0x0fd2('0x72')));}});},'VoiceQueuesChannels':function(_0x4c1039){return new Promise(function(_0x4fa4a8,_0x43533a){var _0x3f606d=_[_0x0fd2('0x5c')](_0x24292c[_0x0fd2('0x77')]);_0x4fa4a8({'count':_0x3f606d[_0x0fd2('0x58')],'rows':_0x3f606d});});},'VoiceQueuesChannel':function(_0x446cf5){var _0x3b4296=this;return new Promise(function(_0x3c65f5,_0x54aadc){var _0x14f6fb=schema(properties[_0x0fd2('0x78')])[_0x0fd2('0x5f')](_0x446cf5);if(_0x14f6fb[_0x0fd2('0x58')]>0x0){return _0x54aadc(_0x3b4296['error'](0x1f4,_[_0x0fd2('0x60')](_0x14f6fb,_0x0fd2('0x16'))[_0x0fd2('0x5d')](',\x20')));}var _0x3209fc=_[_0x0fd2('0x59')](_0x24292c[_0x0fd2('0x77')],{'uniqueid':_0x446cf5[_0x0fd2('0x62')]});if(_0x3209fc){_0x3c65f5(_0x3209fc);}else{return _0x54aadc(_0x3b4296[_0x0fd2('0x10')](0x1f5,_0x0fd2('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x52bf46){var _0x117d48=this;return new Promise(function(_0x28a1e3,_0x16b326){if(ami[_0x0fd2('0xf')]()==![]){return _0x16b326(_0x117d48[_0x0fd2('0x10')](0x1f4,[config[_0x0fd2('0x11')]['ip'],config[_0x0fd2('0x11')][_0x0fd2('0x17')],'ami\x20disconnected'][_0x0fd2('0x5d')]('\x20')));}var _0x3b4bfc=schema(properties[_0x0fd2('0x79')])[_0x0fd2('0x5f')](_0x52bf46);if(_0x3b4bfc[_0x0fd2('0x58')]>0x0){return _0x16b326(_0x117d48['error'](0x1f4,_['map'](_0x3b4bfc,_0x0fd2('0x16'))[_0x0fd2('0x5d')](',\x20')));}var _0x23627c=_['find'](_0x24292c[_0x0fd2('0x77')],{'uniqueid':_0x52bf46[_0x0fd2('0x62')]});if(_0x23627c&&_0x23627c[_0x0fd2('0x67')]){return ami[_0x0fd2('0x15')]({'action':_0x0fd2('0x7a'),'channel':_0x23627c[_0x0fd2('0x67')]})[_0x0fd2('0x19')](function(_0x107720){_0x28a1e3({'code':0xc8,'message':[_0x52bf46[_0x0fd2('0x62')],_0x107720[_0x0fd2('0x16')][_0x0fd2('0x6b')]()][_0x0fd2('0x5d')]('\x20')});})[_0x0fd2('0x1b')](function(_0xdd828a){_0x16b326(_0x117d48['error'](0x1f5,[_0x52bf46[_0x0fd2('0x62')],_0xdd828a[_0x0fd2('0x16')][_0x0fd2('0x6b')]()]['join']('\x20')));});}else{return _0x16b326(_0x117d48[_0x0fd2('0x10')](0x1f5,_0x0fd2('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x812b5b){var _0x208dbb=this;return new Promise(function(_0x9bc301,_0x137dde){if(ami[_0x0fd2('0xf')]()==![]){return _0x137dde(_0x208dbb[_0x0fd2('0x10')](0x1f4,[config[_0x0fd2('0x11')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x0fd2('0x5d')]('\x20')));}var _0x7dd1d4=schema(properties[_0x0fd2('0x7b')])[_0x0fd2('0x5f')](_0x812b5b);if(_0x7dd1d4[_0x0fd2('0x58')]>0x0){return _0x137dde(_0x208dbb[_0x0fd2('0x10')](0x1f4,_['map'](_0x7dd1d4,_0x0fd2('0x16'))['join'](',\x20')));}var _0x144883=_[_0x0fd2('0x59')](_0x24292c['queueChannels'],{'uniqueid':_0x812b5b[_0x0fd2('0x62')]});if(_0x144883&&_0x144883[_0x0fd2('0x67')]){return ami[_0x0fd2('0x15')]({'action':'Redirect','channel':_0x144883[_0x0fd2('0x67')],'exten':_0x812b5b[_0x0fd2('0x7c')],'context':_0x812b5b['context']||_0x144883['context'],'priority':0x1})[_0x0fd2('0x19')](function(_0x399912){_0x9bc301({'code':0xc8,'message':[_0x812b5b[_0x0fd2('0x62')],_0x399912[_0x0fd2('0x16')][_0x0fd2('0x6b')]()]['join']('\x20')});})[_0x0fd2('0x1b')](function(_0x18e41a){_0x137dde(_0x208dbb['error'](0x1f5,[_0x812b5b[_0x0fd2('0x62')],_0x18e41a[_0x0fd2('0x16')][_0x0fd2('0x6b')]()][_0x0fd2('0x5d')]('\x20')));});}else{return _0x137dde(_0x208dbb['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x166caa){return new Promise(function(_0x524528,_0x2d13cf){var _0x4174be=_['values'](_0x24292c['agents']);_0x524528({'count':_0x4174be[_0x0fd2('0x58')],'rows':_0x4174be});});},'Telephones':function(_0x21d371){return new Promise(function(_0x2043f5,_0x552dcd){var _0x22c88a=_[_0x0fd2('0x5c')](_0x24292c[_0x0fd2('0x7d')]);_0x2043f5({'count':_0x22c88a['length'],'rows':_0x22c88a});});},'Trunks':function(_0x2bc09e){return new Promise(function(_0x3d65f,_0x4b634c){var _0x5cc6fe=_[_0x0fd2('0x5c')](_0x24292c[_0x0fd2('0x7e')]);_0x3d65f({'count':_0x5cc6fe[_0x0fd2('0x58')],'rows':_0x5cc6fe});});},'OutboundChannels':function(_0x26e1ef){return new Promise(function(_0x394aba,_0x4b2b12){var _0xa4f2=_[_0x0fd2('0x5c')](_0x24292c[_0x0fd2('0x7f')]);_0x394aba({'count':_0xa4f2[_0x0fd2('0x58')],'rows':_0xa4f2});});},'Outbound':function(_0xcde4ef){return new Promise(function(_0x348e47,_0x5ac703){_0x348e47(_0x24292c[_0x0fd2('0x2c')]);});},'Campaigns':function(_0x55d1b4){return new Promise(function(_0x5e6f0f,_0x284bce){var _0x334fc6=_[_0x0fd2('0x5c')](_0x24292c[_0x0fd2('0x80')]);_0x5e6f0f({'count':_0x334fc6['length'],'rows':_0x334fc6});});},'VoiceQueuesPreview':function(_0x1becbc){var _0x222cd7=this;return new Promise(function(_0x4c8b8e,_0x511bb5){_0x2ef0c3['run'](_0x1becbc['id'])[_0x0fd2('0x19')](function(_0x2abc7e){_0x4c8b8e({'code':0xc8,'message':_0x2abc7e[_0x0fd2('0x16')]});})[_0x0fd2('0x1b')](function(_0x15644a){_0x511bb5(_0x222cd7[_0x0fd2('0x10')](0x1f4,_0x15644a[_0x0fd2('0x16')]));});});},'EventManager':function(_0x3a58cb){var _0x20ff5c=this;return new Promise(function(_0xf3a887,_0x5c3e9f){if(!_0x3a58cb[_0x0fd2('0x81')]){return _0x5c3e9f(_0x20ff5c[_0x0fd2('0x10')](0x1f4,_0x0fd2('0x82')));}ami[_0x0fd2('0x83')](_0x0fd2('0x84')+_0x3a58cb[_0x0fd2('0x81')],_0x3a58cb[_0x0fd2('0x16')]);_0xf3a887({'code':0xc8,'message':_0x3a58cb});});},'FaxAccounts':function(_0x480ff5){return new Promise(function(_0x3d2035,_0x1ceb35){var _0x19bc9a=_[_0x0fd2('0x5c')](_0x24292c[_0x0fd2('0x85')]);_0x3d2035({'count':_0x19bc9a[_0x0fd2('0x58')],'rows':_0x19bc9a});});},'SendFax':function(_0x203979){var _0x4141de=this;return new Promise(function(_0x5f2d08,_0x472399){_0xf25991[_0x0fd2('0x86')](_0x203979)[_0x0fd2('0x19')](function(_0x475249){_0x5f2d08({'code':0xc8,'message':_0x475249[_0x0fd2('0x16')]});})[_0x0fd2('0x1b')](function(_0x51a77f){_0x472399(_0x4141de[_0x0fd2('0x10')](0x1f4,_0x51a77f[_0x0fd2('0x16')]));});});},'CheckAfterSend':function(_0x568518){var _0x26dfe7=this;return new Promise(function(_0x293f51,_0x4f0a35){_0xf25991['checkAfterSend'](_0x568518)[_0x0fd2('0x19')](function(_0x27e6ac){_0x293f51({'code':0xc8,'message':_0x27e6ac[_0x0fd2('0x16')]});})[_0x0fd2('0x1b')](function(_0x548f50){_0x4f0a35(_0x26dfe7['error'](0x1f4,_0x548f50[_0x0fd2('0x16')]));});});}};var _0x46d4f2=jayson[_0x0fd2('0x87')](_0x55467b)['http']();_0x46d4f2['on'](_0x0fd2('0x10'),function(_0x2acc75){return _0x4d114c(_0x2acc75);});_0x46d4f2[_0x0fd2('0x4')](0x232a,_0x0fd2('0x88'),function(){console[_0x0fd2('0x89')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x247d6e(_0x0fd2('0x8a')+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 00ab6db..7a027de 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 _0x34e8=['xmd-contactid','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','fax','ListId','createdAt','scheduledAt','union','then','getContacts','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5'];(function(_0x375f90,_0x52d3ff){var _0x59edac=function(_0x5914e8){while(--_0x5914e8){_0x375f90['push'](_0x375f90['shift']());}};_0x59edac(++_0x52d3ff);}(_0x34e8,0x12c));var _0x834e=function(_0x4a2ec3,_0x1561c4){_0x4a2ec3=_0x4a2ec3-0x0;var _0x519628=_0x34e8[_0x4a2ec3];return _0x519628;};'use strict';var _=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var Redis=require(_0x834e('0x2'));var util=require(_0x834e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x834e('0x4'))(_0x834e('0x5'));var cmContactRpc=require(_0x834e('0x6'));config[_0x834e('0x7')]=_[_0x834e('0x8')](config[_0x834e('0x7')],{'host':_0x834e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x7')]));function emit(_0x52056d,_0x3e16d2,_0x3cc2e3,_0x3a3ef6,_0x2e69e2){logger[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,_0x3e16d2['id'],_0x3cc2e3,_0x3a3ef6,JSON[_0x834e('0xc')](_0x2e69e2));io['to'](_0x3cc2e3)[_0x834e('0xd')](_0x3a3ef6,_0x2e69e2);}exports[_0x834e('0xe')]=function(_0x186b3b,_0x1e41fe,_0x36e124,_0x14038b){var _0x2e1a37,_0x293514;var _0x1e00de={};var _0x2fd95c=Number(_0x36e124['data1']);var _0x5e5b6d=_0x36e124[_0x834e('0xf')]?Boolean(Number(_0x36e124['data2'])):![];var _0x23848e;var _0x2d95f2=![];if(!_[_0x834e('0x10')](_0x36e124[_0x834e('0x11')])){if(_0x36e124['data5']=='1')_0x2d95f2=!![];}if(!_0x2d95f2){if(_0x14038b[_0x834e('0x12')]){_0x1e00de['id']=_0x14038b[_0x834e('0x12')];}}if(!_0x1e00de['id']){_0x1e00de['ListId']=_0x2fd95c;_0x23848e=_0x36e124[_0x834e('0x13')]&&_0x36e124['data3']!=='0'?_0x36e124[_0x834e('0x13')][_0x834e('0x14')](','):['phone'];_0x1e00de[_0x834e('0x15')]=_[_0x834e('0x16')](_0x23848e,function(_0x370fb5){var _0x50b3f6={};_0x50b3f6[_0x370fb5]=_0x14038b[_0x834e('0x17')]?_0x14038b[_0x834e('0x18')]:_0x14038b[_0x834e('0x19')];return _0x50b3f6;});}var _0xb993a1=['id',_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'mobile',_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),'updatedAt'];var _0x45a630=_[_0x834e('0x21')](_0xb993a1,_0x23848e);BPromise['resolve']()[_0x834e('0x22')](cmContactRpc[_0x834e('0x23')]({'attributes':_0x45a630,'where':_0x1e00de}))[_0x834e('0x22')](function(_0x5c55ca){_0x293514=_0x5c55ca;if(!_['isEmpty'](_0x293514)){if(_0x293514[_0x834e('0x24')]===0x1){_0x2e1a37=_0x293514[0x0];logger[_0x834e('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x14038b[_0x834e('0x25')],_0x1e41fe['id'],_0x2e1a37['id']);}else{logger[_0x834e('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x14038b[_0x834e('0x25')],_0x1e41fe['id'],_[_0x834e('0x16')](_0x293514,'id')[_0x834e('0x26')](','));}return;}else{logger['info'](_0x834e('0x27'),_0x14038b[_0x834e('0x25')],_0x1e41fe['id']);var _0x5e1cc5={'ListId':_0x2fd95c};var _0x5bef62=_0x36e124[_0x834e('0x28')]&&_0x36e124['data4']!=='0'?_0x36e124[_0x834e('0x28')]:_0x834e('0x1c');if(_0x5e5b6d){logger[_0x834e('0xa')](_0x834e('0x29'),_0x14038b[_0x834e('0x25')],_0x1e41fe['id']);_0x5e1cc5[_0x5bef62]=_[_0x834e('0x10')](_0x14038b['routeId'])?_0x14038b['calleridnum']:_0x14038b['destcalleridnum'];if(_['isNil'](_0x14038b[_0x834e('0x17')])){_0x5e1cc5[_0x834e('0x1a')]=_0x14038b[_0x834e('0x2a')]&&_0x14038b['calleridname']!==_0x834e('0x2b')?_0x14038b[_0x834e('0x2a')]:_0x834e('0x2c');}else{_0x5e1cc5[_0x834e('0x1a')]=_0x14038b[_0x834e('0x2d')]&&_0x14038b[_0x834e('0x2d')]!==_0x834e('0x2b')?_0x14038b[_0x834e('0x2d')]:_0x834e('0x2c');}return BPromise['resolve']()[_0x834e('0x22')](cmContactRpc['createContact'](_0x5e1cc5))[_0x834e('0x22')](function(_0x3787b0){_0x2e1a37=_0x3787b0;_0x293514[_0x834e('0x2e')](_0x3787b0);if(_0x2e1a37){logger[_0x834e('0xa')](_0x834e('0x2f'),_0x14038b[_0x834e('0x25')],_0x1e41fe['id'],_0x2e1a37['id']);}return;});}else{logger[_0x834e('0xa')](_0x834e('0x30'),_0x14038b[_0x834e('0x25')],_0x1e41fe['id']);_0x5e1cc5[_0x5bef62]=_[_0x834e('0x10')](_0x14038b['routeId'])?_0x14038b[_0x834e('0x19')]:_0x14038b[_0x834e('0x18')];if(_[_0x834e('0x10')](_0x14038b[_0x834e('0x17')])){_0x5e1cc5['firstName']=_0x14038b[_0x834e('0x2a')]&&_0x14038b[_0x834e('0x2a')]!==''?_0x14038b['calleridname']:'Unknown';}else{_0x5e1cc5[_0x834e('0x1a')]=_0x14038b[_0x834e('0x2d')]&&_0x14038b[_0x834e('0x2d')]!==_0x834e('0x2b')?_0x14038b[_0x834e('0x2d')]:_0x834e('0x2c');}_0x2e1a37=_0x5e1cc5;_0x293514['push'](_0x5e1cc5);return;}}})[_0x834e('0x22')](function(){if(_0x186b3b){emit(_0x14038b['uniqueid'],_0x1e41fe,util[_0x834e('0x31')](_0x834e('0x32'),_0x186b3b['name']),util[_0x834e('0x31')](_0x834e('0x33'),_0x36e124['action']['toLowerCase']()),{'evt':_[_0x834e('0x34')](_0x14038b,{'autoCreate':_0x5e5b6d}),'contact':_0x2e1a37===undefined?{}:_0x2e1a37,'contacts':_0x293514[_0x834e('0x24')]===0x0?undefined:_0x293514});}});}; \ No newline at end of file +var _0x5636=['data3','split','phone','$or','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','length','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','destcalleridnum','isNil','routeId','firstName','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','toLowerCase','merge','lodash','bluebird','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','data5','xmd-contactid','ListId'];(function(_0x4b1e84,_0x5063eb){var _0x384546=function(_0x4d0f0f){while(--_0x4d0f0f){_0x4b1e84['push'](_0x4b1e84['shift']());}};_0x384546(++_0x5063eb);}(_0x5636,0x102));var _0x6563=function(_0x55ebe3,_0x49607c){_0x55ebe3=_0x55ebe3-0x0;var _0x1b0991=_0x5636[_0x55ebe3];return _0x1b0991;};'use strict';var _=require(_0x6563('0x0'));var BPromise=require(_0x6563('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x6563('0x2'))(_0x6563('0x3'));var cmContactRpc=require(_0x6563('0x4'));config['redis']=_[_0x6563('0x5')](config[_0x6563('0x6')],{'host':_0x6563('0x7'),'port':0x18eb});var io=require(_0x6563('0x8'))(new Redis(config[_0x6563('0x6')]));function emit(_0x193942,_0x9884a9,_0x2d57d5,_0x2d0d5b,_0x98fcd4){logger[_0x6563('0x9')](_0x6563('0xa'),_0x193942,_0x9884a9['id'],_0x2d57d5,_0x2d0d5b,JSON[_0x6563('0xb')](_0x98fcd4));io['to'](_0x2d57d5)['emit'](_0x2d0d5b,_0x98fcd4);}exports['exec']=function(_0x2946f3,_0x129fa3,_0x490a56,_0x506ee9){var _0x5da960,_0x1ef002;var _0x111d38={};var _0x35936d=Number(_0x490a56[_0x6563('0xc')]);var _0x33816e=_0x490a56[_0x6563('0xd')]?Boolean(Number(_0x490a56[_0x6563('0xd')])):![];var _0xbbae72;var _0x447f9a=![];if(!_['isNil'](_0x490a56[_0x6563('0xe')])){if(_0x490a56['data5']=='1')_0x447f9a=!![];}if(!_0x447f9a){if(_0x506ee9[_0x6563('0xf')]){_0x111d38['id']=_0x506ee9[_0x6563('0xf')];}}if(!_0x111d38['id']){_0x111d38[_0x6563('0x10')]=_0x35936d;_0xbbae72=_0x490a56[_0x6563('0x11')]&&_0x490a56['data3']!=='0'?_0x490a56[_0x6563('0x11')][_0x6563('0x12')](','):[_0x6563('0x13')];_0x111d38[_0x6563('0x14')]=_['map'](_0xbbae72,function(_0x3563fd){var _0x589632={};_0x589632[_0x3563fd]=_0x506ee9['routeId']?_0x506ee9['destcalleridnum']:_0x506ee9[_0x6563('0x15')];return _0x589632;});}var _0x4f5609=['id','firstName',_0x6563('0x16'),_0x6563('0x13'),_0x6563('0x17'),_0x6563('0x18'),_0x6563('0x10'),_0x6563('0x19'),_0x6563('0x1a'),_0x6563('0x1b')];var _0x2a70f0=_['union'](_0x4f5609,_0xbbae72);BPromise[_0x6563('0x1c')]()[_0x6563('0x1d')](cmContactRpc[_0x6563('0x1e')]({'attributes':_0x2a70f0,'where':_0x111d38}))['then'](function(_0x293db2){_0x1ef002=_0x293db2;if(!_['isEmpty'](_0x1ef002)){if(_0x1ef002[_0x6563('0x1f')]===0x1){_0x5da960=_0x1ef002[0x0];logger[_0x6563('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x506ee9['uniqueid'],_0x129fa3['id'],_0x5da960['id']);}else{logger[_0x6563('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x506ee9[_0x6563('0x20')],_0x129fa3['id'],_[_0x6563('0x21')](_0x1ef002,'id')[_0x6563('0x22')](','));}return;}else{logger['info'](_0x6563('0x23'),_0x506ee9['uniqueid'],_0x129fa3['id']);var _0x7ea857={'ListId':_0x35936d};var _0x1590e6=_0x490a56['data4']&&_0x490a56[_0x6563('0x24')]!=='0'?_0x490a56[_0x6563('0x24')]:'phone';if(_0x33816e){logger[_0x6563('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x506ee9[_0x6563('0x20')],_0x129fa3['id']);_0x7ea857[_0x1590e6]=_['isNil'](_0x506ee9['routeId'])?_0x506ee9[_0x6563('0x15')]:_0x506ee9[_0x6563('0x25')];if(_[_0x6563('0x26')](_0x506ee9[_0x6563('0x27')])){_0x7ea857[_0x6563('0x28')]=_0x506ee9['calleridname']&&_0x506ee9[_0x6563('0x29')]!==''?_0x506ee9['calleridname']:_0x6563('0x2a');}else{_0x7ea857[_0x6563('0x28')]=_0x506ee9[_0x6563('0x2b')]&&_0x506ee9[_0x6563('0x2b')]!==_0x6563('0x2c')?_0x506ee9[_0x6563('0x2b')]:_0x6563('0x2a');}return BPromise[_0x6563('0x1c')]()[_0x6563('0x1d')](cmContactRpc[_0x6563('0x2d')](_0x7ea857))['then'](function(_0x9b3d86){_0x5da960=_0x9b3d86;_0x1ef002[_0x6563('0x2e')](_0x9b3d86);if(_0x5da960){logger[_0x6563('0x9')](_0x6563('0x2f'),_0x506ee9[_0x6563('0x20')],_0x129fa3['id'],_0x5da960['id']);}return;});}else{logger[_0x6563('0x9')](_0x6563('0x30'),_0x506ee9['uniqueid'],_0x129fa3['id']);_0x7ea857[_0x1590e6]=_[_0x6563('0x26')](_0x506ee9[_0x6563('0x27')])?_0x506ee9[_0x6563('0x15')]:_0x506ee9[_0x6563('0x25')];if(_[_0x6563('0x26')](_0x506ee9[_0x6563('0x27')])){_0x7ea857['firstName']=_0x506ee9[_0x6563('0x29')]&&_0x506ee9[_0x6563('0x29')]!==_0x6563('0x2c')?_0x506ee9[_0x6563('0x29')]:_0x6563('0x2a');}else{_0x7ea857[_0x6563('0x28')]=_0x506ee9[_0x6563('0x2b')]&&_0x506ee9['destcalleridname']!==_0x6563('0x2c')?_0x506ee9[_0x6563('0x2b')]:'Unknown';}_0x5da960=_0x7ea857;_0x1ef002[_0x6563('0x2e')](_0x7ea857);return;}}})[_0x6563('0x1d')](function(){if(_0x2946f3){emit(_0x506ee9['uniqueid'],_0x129fa3,util['format'](_0x6563('0x31'),_0x2946f3[_0x6563('0x32')]),util[_0x6563('0x33')](_0x6563('0x34'),_0x490a56['action'][_0x6563('0x35')]()),{'evt':_[_0x6563('0x36')](_0x506ee9,{'autoCreate':_0x33816e}),'contact':_0x5da960===undefined?{}:_0x5da960,'contacts':_0x1ef002['length']===0x0?undefined:_0x1ef002});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e39174a..6eae5c7 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 _0x2cbb=['account','chat','ChatWebsiteId','value','upperFirst','AccountId','interaction','message','event','operator','agent','membername','lastevent','util','lodash','ioredis','./urlforward','./script','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','emit','info','motionChannel','undefined','checkTriggers','agents','interface','hasOwnProperty','status','checkTrigger','merge','variables','length','Actions','action','toLowerCase','contactmanager','data1','TemplateId','data2','html','render','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','AllConditions','checkConditions','some','AnyConditions','channel','field'];(function(_0x41dcae,_0x2401d0){var _0x227ff3=function(_0x2c8341){while(--_0x2c8341){_0x41dcae['push'](_0x41dcae['shift']());}};_0x227ff3(++_0x2401d0);}(_0x2cbb,0x178));var _0xb2cb=function(_0x32f3d0,_0x18caa6){_0x32f3d0=_0x32f3d0-0x0;var _0x3cfb65=_0x2cbb[_0x32f3d0];return _0x3cfb65;};'use strict';var util=require(_0xb2cb('0x0'));var _=require(_0xb2cb('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0xb2cb('0x2'));var urlforward=require(_0xb2cb('0x3'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0xb2cb('0x4'));var config=require(_0xb2cb('0x5'));var logger=require('../../../config/logger')('trigger');var ami=require(_0xb2cb('0x6'));config[_0xb2cb('0x7')]=_[_0xb2cb('0x8')](config['redis'],{'host':_0xb2cb('0x9'),'port':0x18eb});var io=require(_0xb2cb('0xa'))(new Redis(config['redis']));var operators={'equals':function(_0x544bdb,_0x371295){return _0x544bdb==_0x371295;},'not_equals':function(_0x127fda,_0x39796f){return _0x127fda!=_0x39796f;}};var barAndWebActions=[_0xb2cb('0xb'),_0xb2cb('0xc'),_0xb2cb('0xd')];function Trigger(_0x18cf7d){this[_0xb2cb('0xe')]=_0x18cf7d[_0xb2cb('0xe')];this['agents']=_0x18cf7d['agents'];this['voiceQueues']=_0x18cf7d[_0xb2cb('0xf')];this['templates']=_0x18cf7d[_0xb2cb('0x10')];this[_0xb2cb('0x11')]=_0x18cf7d[_0xb2cb('0x11')];this[_0xb2cb('0x12')]=_0x18cf7d[_0xb2cb('0x12')];this['freshdeskAccounts']=_0x18cf7d[_0xb2cb('0x13')];this[_0xb2cb('0x14')]=_0x18cf7d[_0xb2cb('0x14')];this[_0xb2cb('0x15')]=_0x18cf7d[_0xb2cb('0x15')];this[_0xb2cb('0x16')]=_0x18cf7d[_0xb2cb('0x16')];this[_0xb2cb('0x17')]=_0x18cf7d[_0xb2cb('0x17')];this[_0xb2cb('0x18')]=_0x18cf7d[_0xb2cb('0x18')];this[_0xb2cb('0x19')]=_0x18cf7d['servicenowAccounts'];this[_0xb2cb('0x1a')]=_0x18cf7d['dynamics365Accounts'];this[_0xb2cb('0x1b')]=_0x18cf7d['freshsalesAccounts'];this[_0xb2cb('0x1c')]={'zendesk':this[_0xb2cb('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xb2cb('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xb2cb('0x16')],'desk':this[_0xb2cb('0x17')],'vtiger':this[_0xb2cb('0x18')],'dynamics365':this[_0xb2cb('0x1a')],'freshsales':this[_0xb2cb('0x1b')],'servicenow':this[_0xb2cb('0x19')]};ami['on'](_0xb2cb('0x1d'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x20'),this['syncCustomEvent'][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x21'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x22'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x23'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x24'),this[_0xb2cb('0x1e')]['bind'](this));ami['on'](_0xb2cb('0x25'),this['syncCustomEvent'][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x26'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x27'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x28'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x29'),this['syncCustomEvent'][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x2a'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x2b'),this[_0xb2cb('0x2c')][_0xb2cb('0x1f')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x2d'),this[_0xb2cb('0x2c')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x2e'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on']('custom:closedinteraction',this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x2f'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x30'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on'](_0xb2cb('0x31'),this[_0xb2cb('0x1e')]['bind'](this));ami['on'](_0xb2cb('0x32'),this[_0xb2cb('0x1e')][_0xb2cb('0x1f')](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0xb2cb('0x1f')](this));}Trigger[_0xb2cb('0x33')][_0xb2cb('0x34')]=function(_0x12c928,_0x2337b3,_0x2a0742){logger[_0xb2cb('0x35')](_0x12c928,_0x2337b3,JSON['stringify'](_0x2a0742));io['to'](_0x12c928)['emit'](_0x2337b3,_0x2a0742);};Trigger[_0xb2cb('0x33')][_0xb2cb('0x1e')]=function(_0x3c4776){var _0x4eebfa=_['clone'](_0x3c4776);if(typeof _0x4eebfa[_0xb2cb('0x36')]===_0xb2cb('0x37')){_0x4eebfa[_0xb2cb('0x36')]='voice';}this[_0xb2cb('0x38')](_0x4eebfa);};Trigger['prototype'][_0xb2cb('0x2c')]=function(_0x321cae){if(this[_0xb2cb('0x39')][_0x321cae[_0xb2cb('0x3a')]]){this[_0xb2cb('0x1e')](_0x321cae);}};Trigger[_0xb2cb('0x33')][_0xb2cb('0x38')]=function(_0x1e04cf){var _0x4d325d;for(var _0x331691 in this[_0xb2cb('0xe')]){if(this[_0xb2cb('0xe')][_0xb2cb('0x3b')](_0x331691)){if(this[_0xb2cb('0xe')][_0x331691][_0xb2cb('0x3c')]){_0x4d325d=this[_0xb2cb('0x3d')](this[_0xb2cb('0xe')][_0x331691],_0x1e04cf);if(_0x4d325d){_[_0xb2cb('0x3e')](_0x1e04cf,_0x1e04cf[_0xb2cb('0x3f')]);for(var _0x229d35=0x0,_0x4e7a3b,_0x1d1308,_0x229968;_0x229d350x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x3c1fdb,_0x42f64a){var _0x2a069f=function(_0x121732){while(--_0x121732){_0x3c1fdb['push'](_0x3c1fdb['shift']());}};_0x2a069f(++_0x42f64a);}(_0x55ca,0x126));var _0xa55c=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x55ca[_0x1b2255];return _0x33e57d;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ 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 6b057fc..7a85a39 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 _0xe956=['4.0','value','isNil','validateEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','internalemailaddress','toLowerCase','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20Created!','forEach','nameField','idField','indexOf','content','ticketType','incidents','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','assign','callDirection','queue','catch','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','POST','clientId','remoteUri','username','password','clientSecret','access_token','error','toUpperCase','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xe956,0x168));var _0x6e95=function(_0x34fa1c,_0x4eca54){_0x34fa1c=_0x34fa1c-0x0;var _0x151617=_0xe956[_0x34fa1c];return _0x151617;};'use strict';var _=require(_0x6e95('0x0'));var BPromise=require(_0x6e95('0x1'));var rp=require(_0x6e95('0x2'));var util=require(_0x6e95('0x3'));var intUtil=require(_0x6e95('0x4'));var md5=require(_0x6e95('0x5'));var Redis=require(_0x6e95('0x6'));var logger=require(_0x6e95('0x7'))(_0x6e95('0x8'));var config=require('../../../../config/environment');config[_0x6e95('0x9')]=_['defaults'](config[_0x6e95('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6e95('0x9')]));function getAuthToken(_0x564934,_0x32425c,_0x23a342){var _0x3bc620={'method':_0x6e95('0xa'),'uri':_0x32425c,'form':{'client_id':_0x564934[_0x6e95('0xb')],'resource':_0x564934[_0x6e95('0xc')],'username':_0x564934[_0x6e95('0xd')],'password':_0x564934[_0x6e95('0xe')],'grant_type':_0x6e95('0xe'),'client_secret':_0x564934[_0x6e95('0xf')]},'json':!![]};return rp(_0x3bc620)['then'](function(_0x7aa60b){return _0x7aa60b[_0x6e95('0x10')];})['catch'](function(_0x1f40fc){logger[_0x6e95('0x11')]('['+[_0x23a342[_0x6e95('0x12')]()]+']\x20Wrong\x20credentials!');return _0x1f40fc[_0x6e95('0x13')];});}function getUser(_0x130fdb,_0x1280da,_0x679063,_0x3f7de9,_0x5b4049,_0x11bfd3){return new BPromise(function(_0x339010,_0x559dbd){return getAuthToken(_0x1280da,_0x3f7de9,_0x11bfd3)[_0x6e95('0x14')](function(_0x2aed10){var _0x2a7727={'method':_0x6e95('0x15'),'uri':_0x5b4049+_0x6e95('0x16'),'headers':{'Authorization':_0x6e95('0x17')+_0x2aed10,'OData-Version':_0x6e95('0x18')},'json':!![]};return rp(_0x2a7727);})[_0x6e95('0x14')](function(_0x3fb3d7){var _0x12b35b=_0x3fb3d7[_0x6e95('0x19')];var _0x2506b8=![];var _0x4aff7c=null;if(!_[_0x6e95('0x1a')](_0x679063)){if(intUtil[_0x6e95('0x1b')](_0x679063[_0x6e95('0x1c')])){_0x130fdb['userEmail']=_0x679063['email'];for(_0x4aff7c=0x0;_0x4aff7c<_0x12b35b[_0x6e95('0x1d')];_0x4aff7c++){if(_0x12b35b[_0x4aff7c]['internalemailaddress']===_0x679063['email']&&!_0x12b35b[_0x4aff7c][_0x6e95('0x1e')]){_0x2506b8=!![];logger[_0x6e95('0x1f')]('['+[_0x11bfd3['toUpperCase']()]+_0x6e95('0x20')+_0x12b35b[_0x4aff7c][_0x6e95('0x21')]+'!');_0x130fdb[_0x6e95('0x22')]=_0x12b35b[_0x4aff7c][_0x6e95('0x21')];}}}}if(!_0x2506b8){logger[_0x6e95('0x1f')]('['+[_0x11bfd3[_0x6e95('0x12')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x130fdb[_0x6e95('0x23')]=_0x1280da['username'];for(_0x4aff7c=0x0;_0x4aff7c<_0x12b35b[_0x6e95('0x1d')];_0x4aff7c++){if(_0x12b35b[_0x4aff7c][_0x6e95('0x24')]===_0x1280da['username']){_0x130fdb[_0x6e95('0x22')]=_0x12b35b[_0x4aff7c][_0x6e95('0x21')];}}}_0x339010(_0x130fdb);})['catch'](function(_0x175c2d){_0x559dbd(_0x175c2d[_0x6e95('0x13')]);});});}function createEndUser(_0xf6a74,_0x24c6a0,_0x9c83d1,_0x4aee44,_0x53b899,_0x2a0888){return new BPromise(function(_0x1446ad,_0x1ab13b){return getAuthToken(_0x24c6a0,_0x9c83d1,_0x2a0888)[_0x6e95('0x14')](function(_0x4506b7){var _0x100549=_0x2a0888[_0x6e95('0x25')]()===_0x6e95('0x26')?_0x53b899['destcalleridnum']:_0x53b899[_0x6e95('0x27')];var _0x4d6396={'method':'POST','uri':_0x4aee44+_0x6e95('0x28'),'body':{'telephone1':_0x100549,'fullname':_0x100549,'firstname':_0x100549,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6e95('0x29')+_0xf6a74[_0x6e95('0x22')]+')'},'headers':{'Authorization':_0x6e95('0x17')+_0x4506b7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4d6396);})[_0x6e95('0x14')](function(_0xc51d19){var _0x9af62c=_0xc51d19[_0x6e95('0x2a')][_0x6e95('0x2b')];var _0x35aa6e=_0x9af62c[_0x6e95('0x2c')](_0x9af62c[_0x6e95('0x2d')]('(')+0x1,_0x9af62c['lastIndexOf'](')'));_0xf6a74[_0x6e95('0x2e')]=_0x35aa6e;_0x1446ad(_0xf6a74);})['catch'](function(_0x19b0a0){_0x1ab13b(_0x19b0a0['message']);});});}function getEndUser(_0x5005b4,_0x36da37,_0x5acd30,_0x38c77b,_0x19ab03,_0x247932){return new BPromise(function(_0x110c53,_0x148695){var _0x429b83=_0x247932[_0x6e95('0x25')]()===_0x6e95('0x26')?_0x19ab03[_0x6e95('0x2f')]:_0x19ab03[_0x6e95('0x27')];return getAuthToken(_0x36da37,_0x5acd30,_0x247932)[_0x6e95('0x14')](function(_0x43175a){var _0x28b217={'method':'GET','uri':_0x38c77b+_0x6e95('0x30')+_0x429b83[_0x6e95('0x31')]('+',_0x6e95('0x32'))+'\x27','headers':{'Authorization':_0x6e95('0x17')+_0x43175a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x28b217);})[_0x6e95('0x14')](function(_0x2e86f1){var _0x1c7613=null;if(_0x2e86f1){var _0x1e55c4=_0x2e86f1['value'];var _0x32dba4=![];for(_0x1c7613=0x0;_0x1c7613<_0x1e55c4[_0x6e95('0x1d')];_0x1c7613++){if(_0x1e55c4[_0x1c7613]['telephone1']===_0x429b83){_0x32dba4=!![];_0x5005b4[_0x6e95('0x2e')]=_0x1e55c4[_0x1c7613][_0x6e95('0x33')];}}if(_0x32dba4){_0x110c53(_0x5005b4);}else{return createEndUser(_0x5005b4,_0x36da37,_0x5acd30,_0x38c77b,_0x19ab03,_0x247932)[_0x6e95('0x14')](function(_0x1ce0c9){logger[_0x6e95('0x1f')]('['+[_0x247932[_0x6e95('0x12')]()]+']\x20Enduser\x20created!',_0x1ce0c9[_0x6e95('0x2e')]);_0x110c53(_0x1ce0c9);});}}else{return createEndUser(_0x5005b4,_0x36da37,_0x5acd30,_0x38c77b,_0x19ab03,_0x247932)[_0x6e95('0x14')](function(_0x48090f){logger[_0x6e95('0x1f')]('['+[_0x247932[_0x6e95('0x12')]()]+_0x6e95('0x34'),_0x48090f['enduserId']);_0x110c53(_0x48090f);});}});});}function getCustomFields(_0xbca319,_0x38f4a0,_0xefbbf){var _0x46d3c0={};if(_0xbca319[_0x6e95('0x1d')]>0x0){_[_0x6e95('0x35')](_0xbca319,function(_0x363884){if(_['includes'](['string','picklist'],_0x363884['type'])&&_0x363884[_0x6e95('0x36')]&&!_0x363884['customField']){var _0x259d4f=_0x363884[_0x6e95('0x37')]['toLowerCase']();var _0x2a1b3a=_0x259d4f[_0x6e95('0x2c')](0x0,_0x259d4f[_0x6e95('0x38')]('_'));var _0x295188=_0x259d4f['substring'](_0x259d4f[_0x6e95('0x38')]('_')+0x1);if(_0x2a1b3a===_0xefbbf){_0x46d3c0[_0x295188]=_0x363884[_0x6e95('0x39')];}}});}return _0x46d3c0;}function getTicket(_0x52f2cf,_0x139b04,_0x1190a7,_0x456a79,_0x33ef4d,_0x531488,_0x5fc9a4){return new BPromise(function(_0x21a641,_0x3e6cf3){var _0x2259e0;return getAuthToken(_0x139b04,_0x1190a7,_0x5fc9a4)['then'](function(_0x91ca79){if(_0x531488[_0x6e95('0x3a')]==='incident'){_0x2259e0={'method':'POST','uri':_0x456a79+_0x6e95('0x3b'),'body':Object['assign']({},{'title':intUtil['getString'](_0x531488[_0x6e95('0x3c')],_0x33ef4d,'\x20'),'description':intUtil[_0x6e95('0x3d')](_0x531488[_0x6e95('0x3e')],_0x33ef4d,'\x0a'),'customerid_contact@odata.bind':_0x6e95('0x3f')+_0x52f2cf[_0x6e95('0x2e')]+')','ownerid@odata.bind':_0x6e95('0x29')+_0x52f2cf[_0x6e95('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x531488[_0x6e95('0x40')],_0x33ef4d,_0x531488['ticketType'])),'headers':{'Authorization':_0x6e95('0x17')+_0x91ca79,'OData-Version':_0x6e95('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x531488['ticketType']===_0x6e95('0x41')){_0x2259e0={'method':_0x6e95('0xa'),'uri':_0x456a79+'phonecalls','body':Object[_0x6e95('0x42')]({},{'subject':intUtil['getString'](_0x531488['Subjects'],_0x33ef4d,'\x20'),'phonenumber':String(_0x33ef4d[_0x6e95('0x27')]),'description':intUtil[_0x6e95('0x3d')](_0x531488[_0x6e95('0x3e')],_0x33ef4d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6e95('0x3f')+_0x52f2cf['enduserId']+')','ownerid@odata.bind':_0x6e95('0x29')+_0x52f2cf['userId']+')','directioncode':_0x52f2cf[_0x6e95('0x43')]===_0x6e95('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x6e95('0x29')+_0x52f2cf[_0x6e95('0x22')]+')','participationtypemask':_0x52f2cf[_0x6e95('0x43')]===_0x6e95('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x6e95('0x3f')+_0x52f2cf[_0x6e95('0x2e')]+')','participationtypemask':_0x52f2cf[_0x6e95('0x43')]===_0x6e95('0x44')?0x1:0x2}]},getCustomFields(_0x531488[_0x6e95('0x40')],_0x33ef4d,_0x531488[_0x6e95('0x3a')])),'headers':{'Authorization':_0x6e95('0x17')+_0x91ca79,'OData-Version':_0x6e95('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2259e0);})['then'](function(_0x26361d){var _0x2326bc=_0x26361d['headers']['odata-entityid'];var _0x16eb33=_0x2326bc[_0x6e95('0x2c')](_0x2326bc[_0x6e95('0x2d')]('(')+0x1,_0x2326bc[_0x6e95('0x2d')](')'));_0x52f2cf['ticketId']=_0x16eb33;_0x21a641(_0x52f2cf);})[_0x6e95('0x45')](function(_0x2bf714){_0x3e6cf3(_0x2bf714[_0x6e95('0x13')]);});});}function emit(_0xa96bf8,_0x227178,_0x3c3bd9,_0x19fbbe){var _0x159a9d={'uri':util['format'](_0x6e95('0x46'),_0xa96bf8,_0x3c3bd9,_0x19fbbe)};io['to'](util[_0x6e95('0x47')](_0x6e95('0x48'),_0x227178))['emit'](_0x6e95('0x49'),_0x159a9d);}exports['cs']=function(_0x1f223a,_0x27d32b,_0x274cc6,_0x3d7ec8,_0x16522a,_0x5c6155,_0xd93849,_0x46ca46){var _0x58f342={};_0x5c6155[_0x6e95('0xc')]=intUtil[_0x6e95('0x4a')](_0x5c6155[_0x6e95('0xc')]);_0x5c6155[_0x6e95('0x4b')]=intUtil[_0x6e95('0x4a')](_0x5c6155[_0x6e95('0x4b')]);_0x58f342[_0x6e95('0x43')]=_0x46ca46===_0x6e95('0x44')||_0x46ca46==='unmanaged'?'queue':'outbound';var _0x4f3c9c=util[_0x6e95('0x47')](_0x6e95('0x4c'),_0x5c6155['remoteUri']);var _0x482087=util[_0x6e95('0x47')](_0x6e95('0x4d'),_0x5c6155[_0x6e95('0x4e')]);var _0x29eebd=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c6155[_0x6e95('0x4b')],_0x27d32b['uniqueid'],md5(_0x27d32b[_0x6e95('0x4f')]));if(_0x16522a&&_0x16522a[_0x6e95('0x50')]){logger[_0x6e95('0x1f')](_0x6e95('0x51'),_0x6e95('0x52'));_0x27d32b[_0x6e95('0x53')]=_0x29eebd;}else if(_0xd93849&&_0xd93849[_0x6e95('0x54')]&&_0xd93849['recordingFormat']!==_0x6e95('0x55')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x27d32b[_0x6e95('0x53')]=_0x29eebd;}else{_0x27d32b[_0x6e95('0x53')]='';}return getUser(_0x58f342,_0x5c6155,_0x3d7ec8,_0x482087,_0x4f3c9c,_0x46ca46)[_0x6e95('0x14')](function(_0x37d41a){logger[_0x6e95('0x1f')]('['+_0x46ca46[_0x6e95('0x12')]()+']\x20The\x20User\x20ID\x20is:',_0x37d41a['userId']);logger['info']('['+_0x46ca46['toUpperCase']()+_0x6e95('0x56'),_0x37d41a[_0x6e95('0x23')]);return getEndUser(_0x37d41a,_0x5c6155,_0x482087,_0x4f3c9c,_0x27d32b,_0x46ca46);})[_0x6e95('0x14')](function(_0x404264){logger[_0x6e95('0x1f')]('['+_0x46ca46['toUpperCase']()+_0x6e95('0x57'),_0x404264[_0x6e95('0x2e')]);logger[_0x6e95('0x1f')]('['+_0x46ca46[_0x6e95('0x12')]()+_0x6e95('0x58'),_0x27d32b[_0x6e95('0x27')]);return getTicket(_0x404264,_0x5c6155,_0x482087,_0x4f3c9c,_0x27d32b,_0x274cc6,_0x46ca46);})[_0x6e95('0x14')](function(_0x4e1ebf){logger[_0x6e95('0x1f')](util['format']('['+_0x46ca46[_0x6e95('0x12')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x274cc6[_0x6e95('0x3a')],_0x4e1ebf[_0x6e95('0x59')]));logger[_0x6e95('0x1f')](util[_0x6e95('0x47')]('['+_0x46ca46[_0x6e95('0x12')]()+_0x6e95('0x5a'),_0x46ca46));if(_0x46ca46!==_0x6e95('0x5b')){logger[_0x6e95('0x1f')]('['+_0x46ca46['toUpperCase']()+']',_0x6e95('0x5c'));emit(_0x5c6155[_0x6e95('0xc')],_0x3d7ec8[_0x6e95('0x5d')],_0x274cc6[_0x6e95('0x3a')],_0x4e1ebf[_0x6e95('0x59')]);}})[_0x6e95('0x45')](function(_0x51df8a){logger[_0x6e95('0x11')]('['+_0x46ca46[_0x6e95('0x12')]()+_0x6e95('0x5e'),util[_0x6e95('0x5f')](_0x51df8a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8af2=['localhost','socket.io-emitter','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','Bearer\x20','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','systemuserid','username','toLowerCase','calleridnum','/systemusers(','userId','4.0','substring','lastIndexOf','enduserId','outbound','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1',']\x20Enduser\x20Created!','includes','picklist','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','phonecalls','Subjects','callDirection','queue','odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20email\x20is:','userEmail',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis'];(function(_0x5bccdc,_0x2e66f0){var _0x133637=function(_0x487c2e){while(--_0x487c2e){_0x5bccdc['push'](_0x5bccdc['shift']());}};_0x133637(++_0x2e66f0);}(_0x8af2,0xb6));var _0x28af=function(_0x3604fd,_0x3c6297){_0x3604fd=_0x3604fd-0x0;var _0x18c989=_0x8af2[_0x3604fd];return _0x18c989;};'use strict';var _=require(_0x28af('0x0'));var BPromise=require(_0x28af('0x1'));var rp=require('request-promise');var util=require(_0x28af('0x2'));var intUtil=require(_0x28af('0x3'));var md5=require(_0x28af('0x4'));var Redis=require(_0x28af('0x5'));var logger=require(_0x28af('0x6'))(_0x28af('0x7'));var config=require(_0x28af('0x8'));config[_0x28af('0x9')]=_['defaults'](config[_0x28af('0x9')],{'host':_0x28af('0xa'),'port':0x18eb});var io=require(_0x28af('0xb'))(new Redis(config[_0x28af('0x9')]));function getAuthToken(_0xd989ea,_0x4d28eb,_0x12cf36){var _0x9ab4a3={'method':_0x28af('0xc'),'uri':_0x4d28eb,'form':{'client_id':_0xd989ea[_0x28af('0xd')],'resource':_0xd989ea['remoteUri'],'username':_0xd989ea['username'],'password':_0xd989ea['password'],'grant_type':_0x28af('0xe'),'client_secret':_0xd989ea[_0x28af('0xf')]},'json':!![]};return rp(_0x9ab4a3)[_0x28af('0x10')](function(_0x39228a){return _0x39228a[_0x28af('0x11')];})[_0x28af('0x12')](function(_0x17f86a){logger[_0x28af('0x13')]('['+[_0x12cf36[_0x28af('0x14')]()]+']\x20Wrong\x20credentials!');return _0x17f86a[_0x28af('0x15')];});}function getUser(_0x2c045e,_0x22f5c8,_0x5499ca,_0x23a973,_0x5a930a,_0x13314b){return new BPromise(function(_0x35420c,_0x3e5159){return getAuthToken(_0x22f5c8,_0x23a973,_0x13314b)['then'](function(_0x3fcb12){var _0x2f621c={'method':_0x28af('0x16'),'uri':_0x5a930a+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x28af('0x17')+_0x3fcb12,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f621c);})[_0x28af('0x10')](function(_0x1dbb09){var _0x152a71=_0x1dbb09[_0x28af('0x18')];var _0x3ca5bf=![];var _0x3bbf09=null;if(!_[_0x28af('0x19')](_0x5499ca)){if(intUtil[_0x28af('0x1a')](_0x5499ca[_0x28af('0x1b')])){_0x2c045e['userEmail']=_0x5499ca[_0x28af('0x1b')];for(_0x3bbf09=0x0;_0x3bbf09<_0x152a71[_0x28af('0x1c')];_0x3bbf09++){if(_0x152a71[_0x3bbf09][_0x28af('0x1d')]===_0x5499ca[_0x28af('0x1b')]&&!_0x152a71[_0x3bbf09][_0x28af('0x1e')]){_0x3ca5bf=!![];logger[_0x28af('0x1f')]('['+[_0x13314b['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x152a71[_0x3bbf09]['systemuserid']+'!');_0x2c045e['userId']=_0x152a71[_0x3bbf09][_0x28af('0x20')];}}}}if(!_0x3ca5bf){logger[_0x28af('0x1f')]('['+[_0x13314b[_0x28af('0x14')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2c045e['userEmail']=_0x22f5c8[_0x28af('0x21')];for(_0x3bbf09=0x0;_0x3bbf09<_0x152a71['length'];_0x3bbf09++){if(_0x152a71[_0x3bbf09][_0x28af('0x1d')]===_0x22f5c8[_0x28af('0x21')]){_0x2c045e['userId']=_0x152a71[_0x3bbf09][_0x28af('0x20')];}}}_0x35420c(_0x2c045e);})[_0x28af('0x12')](function(_0x4e8e2b){_0x3e5159(_0x4e8e2b['message']);});});}function createEndUser(_0x14114c,_0x18c785,_0xc3c1d0,_0x5ced50,_0x45c7f2,_0x1fd846){return new BPromise(function(_0xf3d7d,_0x2d7405){return getAuthToken(_0x18c785,_0xc3c1d0,_0x1fd846)[_0x28af('0x10')](function(_0x2a12d3){var _0x58fc65=_0x1fd846[_0x28af('0x22')]()==='outbound'?_0x45c7f2['destcalleridnum']:_0x45c7f2[_0x28af('0x23')];var _0x246a5e={'method':_0x28af('0xc'),'uri':_0x5ced50+'contacts','body':{'telephone1':_0x58fc65,'fullname':_0x58fc65,'firstname':_0x58fc65,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x28af('0x24')+_0x14114c[_0x28af('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x2a12d3,'OData-Version':_0x28af('0x26')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x246a5e);})['then'](function(_0x2edef9){var _0x185e2c=_0x2edef9['headers']['odata-entityid'];var _0xc9c48e=_0x185e2c[_0x28af('0x27')](_0x185e2c[_0x28af('0x28')]('(')+0x1,_0x185e2c[_0x28af('0x28')](')'));_0x14114c[_0x28af('0x29')]=_0xc9c48e;_0xf3d7d(_0x14114c);})[_0x28af('0x12')](function(_0x13f886){_0x2d7405(_0x13f886[_0x28af('0x15')]);});});}function getEndUser(_0x14c550,_0x1c28e9,_0x2ff40f,_0x49b088,_0x403b52,_0x2dafbe){return new BPromise(function(_0x427916,_0x25eda5){var _0x56bad0=_0x2dafbe['toLowerCase']()===_0x28af('0x2a')?_0x403b52[_0x28af('0x2b')]:_0x403b52[_0x28af('0x23')];return getAuthToken(_0x1c28e9,_0x2ff40f,_0x2dafbe)['then'](function(_0x77e5a0){var _0x431f01={'method':_0x28af('0x16'),'uri':_0x49b088+_0x28af('0x2c')+_0x56bad0[_0x28af('0x2d')]('+',_0x28af('0x2e'))+'\x27','headers':{'Authorization':_0x28af('0x17')+_0x77e5a0,'If-None-Match':null,'OData-Version':_0x28af('0x26')},'json':!![]};return rp(_0x431f01);})['then'](function(_0x4d49e5){var _0xdd3934=null;if(_0x4d49e5){var _0x48c7f6=_0x4d49e5['value'];var _0x8fb521=![];for(_0xdd3934=0x0;_0xdd3934<_0x48c7f6[_0x28af('0x1c')];_0xdd3934++){if(_0x48c7f6[_0xdd3934][_0x28af('0x2f')]===_0x56bad0){_0x8fb521=!![];_0x14c550[_0x28af('0x29')]=_0x48c7f6[_0xdd3934]['contactid'];}}if(_0x8fb521){_0x427916(_0x14c550);}else{return createEndUser(_0x14c550,_0x1c28e9,_0x2ff40f,_0x49b088,_0x403b52,_0x2dafbe)[_0x28af('0x10')](function(_0xde3f3d){logger[_0x28af('0x1f')]('['+[_0x2dafbe[_0x28af('0x14')]()]+']\x20Enduser\x20created!',_0xde3f3d[_0x28af('0x29')]);_0x427916(_0xde3f3d);});}}else{return createEndUser(_0x14c550,_0x1c28e9,_0x2ff40f,_0x49b088,_0x403b52,_0x2dafbe)['then'](function(_0x4eb646){logger[_0x28af('0x1f')]('['+[_0x2dafbe[_0x28af('0x14')]()]+_0x28af('0x30'),_0x4eb646[_0x28af('0x29')]);_0x427916(_0x4eb646);});}});});}function getCustomFields(_0x488b7d,_0x2f30d5,_0xb396f){var _0x454472={};if(_0x488b7d[_0x28af('0x1c')]>0x0){_['forEach'](_0x488b7d,function(_0x2442e4){if(_[_0x28af('0x31')](['string',_0x28af('0x32')],_0x2442e4[_0x28af('0x33')])&&_0x2442e4[_0x28af('0x34')]&&!_0x2442e4[_0x28af('0x35')]){var _0x1fc4c9=_0x2442e4[_0x28af('0x36')]['toLowerCase']();var _0x30f0ee=_0x1fc4c9[_0x28af('0x27')](0x0,_0x1fc4c9['indexOf']('_'));var _0x5652ac=_0x1fc4c9['substring'](_0x1fc4c9[_0x28af('0x37')]('_')+0x1);if(_0x30f0ee===_0xb396f){_0x454472[_0x5652ac]=_0x2442e4[_0x28af('0x38')];}}});}return _0x454472;}function getTicket(_0x3e8d03,_0x38d398,_0x1db219,_0x2f28cd,_0x1d724f,_0x28308f,_0xeb8847){return new BPromise(function(_0x49ef1a,_0x3cc7e5){var _0x4c85b3;return getAuthToken(_0x38d398,_0x1db219,_0xeb8847)['then'](function(_0x1362cc){if(_0x28308f['ticketType']===_0x28af('0x39')){_0x4c85b3={'method':_0x28af('0xc'),'uri':_0x2f28cd+_0x28af('0x3a'),'body':Object[_0x28af('0x3b')]({},{'title':intUtil['getString'](_0x28308f['Subjects'],_0x1d724f,'\x20'),'description':intUtil[_0x28af('0x3c')](_0x28308f[_0x28af('0x3d')],_0x1d724f,'\x0a'),'customerid_contact@odata.bind':_0x28af('0x3e')+_0x3e8d03[_0x28af('0x29')]+')','ownerid@odata.bind':_0x28af('0x24')+_0x3e8d03['userId']+')','caseorigincode':'1'},getCustomFields(_0x28308f[_0x28af('0x3f')],_0x1d724f,_0x28308f[_0x28af('0x40')])),'headers':{'Authorization':_0x28af('0x17')+_0x1362cc,'OData-Version':_0x28af('0x26')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x28308f[_0x28af('0x40')]==='phonecall'){_0x4c85b3={'method':_0x28af('0xc'),'uri':_0x2f28cd+_0x28af('0x41'),'body':Object[_0x28af('0x3b')]({},{'subject':intUtil[_0x28af('0x3c')](_0x28308f[_0x28af('0x42')],_0x1d724f,'\x20'),'phonenumber':String(_0x1d724f[_0x28af('0x23')]),'description':intUtil[_0x28af('0x3c')](_0x28308f[_0x28af('0x3d')],_0x1d724f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x28af('0x3e')+_0x3e8d03[_0x28af('0x29')]+')','ownerid@odata.bind':'/systemusers('+_0x3e8d03[_0x28af('0x25')]+')','directioncode':_0x3e8d03[_0x28af('0x43')]===_0x28af('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3e8d03[_0x28af('0x25')]+')','participationtypemask':_0x3e8d03[_0x28af('0x43')]===_0x28af('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x28af('0x3e')+_0x3e8d03[_0x28af('0x29')]+')','participationtypemask':_0x3e8d03[_0x28af('0x43')]===_0x28af('0x44')?0x1:0x2}]},getCustomFields(_0x28308f[_0x28af('0x3f')],_0x1d724f,_0x28308f['ticketType'])),'headers':{'Authorization':_0x28af('0x17')+_0x1362cc,'OData-Version':_0x28af('0x26')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4c85b3);})[_0x28af('0x10')](function(_0x343ab1){var _0x4aa9a3=_0x343ab1['headers'][_0x28af('0x45')];var _0x45c39f=_0x4aa9a3[_0x28af('0x27')](_0x4aa9a3[_0x28af('0x28')]('(')+0x1,_0x4aa9a3[_0x28af('0x28')](')'));_0x3e8d03['ticketId']=_0x45c39f;_0x49ef1a(_0x3e8d03);})['catch'](function(_0x2ff904){_0x3cc7e5(_0x2ff904[_0x28af('0x15')]);});});}function emit(_0x3acf4f,_0x4fdda7,_0x4db573,_0x30b368){var _0x1547da={'uri':util['format'](_0x28af('0x46'),_0x3acf4f,_0x4db573,_0x30b368)};io['to'](util['format'](_0x28af('0x47'),_0x4fdda7))[_0x28af('0x48')](_0x28af('0x49'),_0x1547da);}exports['cs']=function(_0x1af07d,_0x275a1a,_0x452ef4,_0x540b07,_0x4eeb7a,_0x2fdd4d,_0x26370a,_0x346ca9){var _0x42e759={};_0x2fdd4d[_0x28af('0x4a')]=intUtil[_0x28af('0x4b')](_0x2fdd4d[_0x28af('0x4a')]);_0x2fdd4d[_0x28af('0x4c')]=intUtil[_0x28af('0x4b')](_0x2fdd4d[_0x28af('0x4c')]);_0x42e759[_0x28af('0x43')]=_0x346ca9===_0x28af('0x44')||_0x346ca9===_0x28af('0x4d')?_0x28af('0x44'):'outbound';var _0x40fd68=util[_0x28af('0x4e')](_0x28af('0x4f'),_0x2fdd4d[_0x28af('0x4a')]);var _0x61756c=util['format'](_0x28af('0x50'),_0x2fdd4d[_0x28af('0x51')]);var _0x12898e=util[_0x28af('0x4e')](_0x28af('0x52'),_0x2fdd4d[_0x28af('0x4c')],_0x275a1a[_0x28af('0x53')],md5(_0x275a1a['uniqueid']));if(_0x4eeb7a&&_0x4eeb7a['monitor_format']){logger['info'](_0x28af('0x54'),_0x28af('0x55'));_0x275a1a[_0x28af('0x56')]=_0x12898e;}else if(_0x26370a&&_0x26370a[_0x28af('0x57')]&&_0x26370a[_0x28af('0x57')]!=='none'){logger[_0x28af('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x275a1a[_0x28af('0x56')]=_0x12898e;}else{_0x275a1a['recordingURL']='';}return getUser(_0x42e759,_0x2fdd4d,_0x540b07,_0x61756c,_0x40fd68,_0x346ca9)[_0x28af('0x10')](function(_0x5b004f){logger[_0x28af('0x1f')]('['+_0x346ca9[_0x28af('0x14')]()+']\x20The\x20User\x20ID\x20is:',_0x5b004f[_0x28af('0x25')]);logger[_0x28af('0x1f')]('['+_0x346ca9[_0x28af('0x14')]()+_0x28af('0x58'),_0x5b004f[_0x28af('0x59')]);return getEndUser(_0x5b004f,_0x2fdd4d,_0x61756c,_0x40fd68,_0x275a1a,_0x346ca9);})[_0x28af('0x10')](function(_0x480826){logger[_0x28af('0x1f')]('['+_0x346ca9['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x480826[_0x28af('0x29')]);logger[_0x28af('0x1f')]('['+_0x346ca9[_0x28af('0x14')]()+_0x28af('0x5a'),_0x275a1a[_0x28af('0x23')]);return getTicket(_0x480826,_0x2fdd4d,_0x61756c,_0x40fd68,_0x275a1a,_0x452ef4,_0x346ca9);})[_0x28af('0x10')](function(_0x574847){logger[_0x28af('0x1f')](util[_0x28af('0x4e')]('['+_0x346ca9['toUpperCase']()+_0x28af('0x5b'),_0x452ef4[_0x28af('0x40')],_0x574847[_0x28af('0x5c')]));logger[_0x28af('0x1f')](util[_0x28af('0x4e')]('['+_0x346ca9[_0x28af('0x14')]()+_0x28af('0x5d'),_0x346ca9));if(_0x346ca9!==_0x28af('0x4d')){logger[_0x28af('0x1f')]('['+_0x346ca9[_0x28af('0x14')]()+']',_0x28af('0x5e'));emit(_0x2fdd4d['remoteUri'],_0x540b07['name'],_0x452ef4[_0x28af('0x40')],_0x574847[_0x28af('0x5c')]);}})[_0x28af('0x12')](function(_0x6ef45){logger[_0x28af('0x13')]('['+_0x346ca9[_0x28af('0x14')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x28af('0x5f')](_0x6ef45,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 81bae24..bd06d3b 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 _0x9ca1=['merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','info','find','contact','email','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','defaults','map','includes','string','picklist','nameField','toLowerCase','content','toString','idField','push','variable','customField','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]','user:%s','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','ioredis','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...'];(function(_0x5f3e05,_0x1b6c61){var _0x380bc6=function(_0x5a0ef4){while(--_0x5a0ef4){_0x5f3e05['push'](_0x5f3e05['shift']());}};_0x380bc6(++_0x1b6c61);}(_0x9ca1,0x10b));var _0x19ca=function(_0x3a3d64,_0xb1f869){_0x3a3d64=_0x3a3d64-0x0;var _0x33a045=_0x9ca1[_0x3a3d64];return _0x33a045;};'use strict';var _=require(_0x19ca('0x0'));var rp=require(_0x19ca('0x1'));var md5=require(_0x19ca('0x2'));var util=require('util');var Redis=require(_0x19ca('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x19ca('0x4'))(_0x19ca('0x5'));config[_0x19ca('0x6')]=_['defaults'](config[_0x19ca('0x6')],{'host':_0x19ca('0x7'),'port':0x18eb});var io=require(_0x19ca('0x8'))(new Redis(config[_0x19ca('0x6')]));var headers={'Content-Type':_0x19ca('0x9'),'Accept':_0x19ca('0x9')};function emit(_0x9df117,_0x31799f,_0x33579d){io['to'](_0x9df117)[_0x19ca('0xa')](_0x31799f,_0x33579d);}function getTicket(_0x4c832f,_0x7dca75,_0xee83c3,_0x56f19a,_0x55e459){logger['info'](_0x19ca('0xb'));var _0x5d96ea=_[_0x19ca('0xc')]({'responder_id':_0x7dca75['id'],'requester_id':_0xee83c3['id'],'name':util[_0x19ca('0xd')](_0x19ca('0xe'),_0x55e459[_0x19ca('0xf')]),'phone':_0x55e459['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x19ca('0x10')](_0x56f19a[_0x19ca('0x11')],_0x55e459,'\x20'),'description':intUtil[_0x19ca('0x10')](_0x56f19a[_0x19ca('0x12')],_0x55e459,_0x19ca('0x13')),'tags':getTags(_0x56f19a[_0x19ca('0x14')],_0x19ca('0x15'))},getCustomFields(_0x56f19a[_0x19ca('0x16')],_0x55e459));_0x5d96ea[_0x19ca('0x17')]=_[_0x19ca('0x18')](_['keyBy'](_0x5d96ea[_0x19ca('0x17')],'id'),_0x19ca('0x19'));return request({'uri':util['format'](_0x19ca('0x1a'),_0x4c832f['remoteUri']),'method':_0x19ca('0x1b'),'body':_0x5d96ea})[_0x19ca('0x1c')](function(_0x3f4b56){logger['info'](_0x19ca('0x1d'));return _0x3f4b56;});}function getUser(_0x55f0ca,_0x5187ae){if(intUtil[_0x19ca('0x1e')](_0x5187ae)){return request({'uri':util['format'](_0x19ca('0x1f'),_0x55f0ca['remoteUri']),'qs':{'email':_0x5187ae}})[_0x19ca('0x1c')](function(_0x52c61b){if(_0x52c61b[_0x19ca('0x20')]){logger[_0x19ca('0x21')]('Agent\x20found!');return _[_0x19ca('0x22')](_0x52c61b,function(_0x23ae22){return _0x23ae22[_0x19ca('0x23')][_0x19ca('0x24')]===_0x5187ae;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x55f0ca[_0x19ca('0x25')])})['then'](function(_0x32e2e4){logger[_0x19ca('0x21')]('Admin\x20account\x20selected.');return _0x32e2e4;});}});}else{logger['info'](_0x19ca('0x26'));return request({'uri':util[_0x19ca('0xd')](_0x19ca('0x27'),_0x55f0ca[_0x19ca('0x25')])})[_0x19ca('0x1c')](function(_0x36e43d){logger[_0x19ca('0x21')](_0x19ca('0x28'));return _0x36e43d;});}}function getEndUser(_0x97e559,_0x19f013,_0x39bc05){logger['info'](_0x19ca('0x29'),_0x39bc05);return request({'uri':util[_0x19ca('0xd')](_0x19ca('0x2a'),_0x97e559[_0x19ca('0x25')]),'qs':{'phone':_0x39bc05}})['then'](function(_0x4cbcbe){if(_0x4cbcbe[_0x19ca('0x20')]){logger[_0x19ca('0x21')](_0x19ca('0x2b'));return _[_0x19ca('0x22')](_0x4cbcbe,{'phone':_0x39bc05});}else{logger[_0x19ca('0x21')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x19ca('0xd')](_0x19ca('0x2a'),_0x97e559[_0x19ca('0x25')]),'method':_0x19ca('0x1b'),'body':{'name':_0x19f013,'phone':_0x39bc05}})[_0x19ca('0x1c')](function(_0x235af2){logger[_0x19ca('0x21')](_0x19ca('0x2c'));return _0x235af2;});}});}function getAuth(_0x999de1){return util[_0x19ca('0xd')](_0x19ca('0x2d'),new Buffer(_0x999de1[_0x19ca('0x2e')]+':X')['toString'](_0x19ca('0x2f')));}function request(_0x368b39){logger[_0x19ca('0x30')](_0x19ca('0x31'),JSON[_0x19ca('0x32')](_0x368b39));return rp(_[_0x19ca('0x33')](_0x368b39,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x268964,_0x40e7d6){var _0x7097ae=[];if(_0x268964&&_0x268964[_0x19ca('0x20')]>0x0){_0x7097ae=_[_0x19ca('0x34')](_0x268964,_0x40e7d6);}return _0x7097ae;}function getCustomFields(_0x4cfdcd,_0x9e7c37){var _0x2542c0=[];var _0x553b97={'custom_fields':[]};if(_0x4cfdcd[_0x19ca('0x20')]>0x0){_['forEach'](_0x4cfdcd,function(_0x44568d){if(_[_0x19ca('0x35')]([_0x19ca('0x36'),_0x19ca('0x37')],_0x44568d['type'])&&_0x44568d['nameField']&&!_0x44568d['customField']){_0x553b97[_0x44568d[_0x19ca('0x38')][_0x19ca('0x39')]()]=_0x44568d[_0x19ca('0x3a')][_0x19ca('0x3b')]();}else if(_[_0x19ca('0x35')]([_0x19ca('0x36'),'picklist'],_0x44568d['type'])&&_0x44568d[_0x19ca('0x3c')]&&_0x44568d['customField']){_0x553b97[_0x19ca('0x17')][_0x19ca('0x3d')]({'id':_0x44568d[_0x19ca('0x3c')],'value':_0x44568d[_0x19ca('0x3a')][_0x19ca('0x3b')]()});}else if(_0x44568d['type']===_0x19ca('0x3e')&&_0x44568d['variableName']&&_0x44568d[_0x19ca('0x3c')]&&_0x44568d[_0x19ca('0x3f')]){_0x9e7c37[_0x44568d['variableName']]&&_0x553b97[_0x19ca('0x17')][_0x19ca('0x3d')]({'id':_0x44568d['idField'],'value':_0x9e7c37[_0x44568d[_0x19ca('0x40')]][_0x19ca('0x3b')]()});}else if(_0x44568d['type']===_0x19ca('0x41')&&_0x44568d[_0x19ca('0x42')]&&_0x44568d['Variable'][_0x19ca('0x15')]&&_0x44568d['idField']&&_0x44568d[_0x19ca('0x3f')]){_0x9e7c37[_0x44568d[_0x19ca('0x42')][_0x19ca('0x15')]['toLowerCase']()]&&_0x553b97['custom_fields'][_0x19ca('0x3d')]({'id':_0x44568d[_0x19ca('0x3c')],'value':_0x9e7c37[_0x44568d[_0x19ca('0x42')][_0x19ca('0x15')][_0x19ca('0x39')]()][_0x19ca('0x3b')]()});}});}return _0x553b97;}exports[_0x19ca('0x43')]=function(_0x1d1173,_0x16034f,_0x4b2631,_0x5d5215,_0x2548e6,_0x10e774){var _0x5630c9,_0x575374;_0x10e774[_0x19ca('0x25')]=intUtil['stripTrailingSlash'](_0x10e774[_0x19ca('0x25')]);_0x10e774[_0x19ca('0x44')]=intUtil[_0x19ca('0x45')](_0x10e774['serverUrl']);if(_0x2548e6&&_0x2548e6[_0x19ca('0x46')]){logger[_0x19ca('0x21')]('[QUEUE]',_0x19ca('0x47'));_0x16034f['recordingURL']=util[_0x19ca('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10e774[_0x19ca('0x44')],_0x16034f[_0x19ca('0x48')],md5(_0x16034f['uniqueid']));}else{_0x16034f[_0x19ca('0x49')]='';}headers[_0x19ca('0x4a')]=getAuth(_0x10e774);return getUser(_0x10e774,_0x5d5215['email'])[_0x19ca('0x1c')](function(_0x598968){_0x5630c9=_0x598968;logger[_0x19ca('0x21')]('The\x20User\x20ID\x20is:',_0x5630c9['id']);return getEndUser(_0x10e774,_0x16034f[_0x19ca('0xf')],_0x16034f[_0x19ca('0x4b')]);})['then'](function(_0x2da997){_0x575374=_0x2da997;logger[_0x19ca('0x21')](_0x19ca('0x4c'),_0x575374['id']);return getTicket(_0x10e774,_0x5630c9,_0x575374,_0x4b2631,_0x16034f);})[_0x19ca('0x1c')](function(_0x327780){if(_0x327780&&_0x327780['id']){logger[_0x19ca('0x21')]('Ticket\x20created!');logger[_0x19ca('0x21')](_0x19ca('0x4d'),_0x327780['id']);logger['info'](_0x19ca('0x4e'),_0x19ca('0x4f'));emit(util['format']('user:%s',_0x5d5215[_0x19ca('0x15')]),_0x19ca('0x50'),{'uri':util['format'](_0x19ca('0x51'),_0x10e774[_0x19ca('0x25')],_0x327780['id'])});}})[_0x19ca('0x52')](function(_0x3298fe){logger[_0x19ca('0x53')](_0x19ca('0x4e'),JSON['stringify'](_0x3298fe));});};exports[_0x19ca('0x54')]=function(_0x2573ee,_0x25ba52,_0x2e0925,_0x3b4ce9,_0xe68657,_0x1076fa,_0x62463){var _0x3e9ecd,_0x208773;_0x1076fa[_0x19ca('0x25')]=intUtil[_0x19ca('0x45')](_0x1076fa[_0x19ca('0x25')]);_0x1076fa[_0x19ca('0x44')]=intUtil[_0x19ca('0x45')](_0x1076fa['serverUrl']);if(_0x62463&&_0x62463['recordingFormat']&&_0x62463[_0x19ca('0x55')]!=='none'){logger[_0x19ca('0x21')]('[OUTBOUND]',_0x19ca('0x47'));_0x25ba52['recordingURL']=util[_0x19ca('0xd')](_0x19ca('0x56'),_0x1076fa[_0x19ca('0x44')],_0x25ba52[_0x19ca('0x48')],md5(_0x25ba52['uniqueid']));}headers[_0x19ca('0x4a')]=getAuth(_0x1076fa);return getUser(_0x1076fa,_0x3b4ce9['email'])['then'](function(_0x4c6cdf){_0x3e9ecd=_0x4c6cdf;logger[_0x19ca('0x21')]('The\x20User\x20ID\x20is:',_0x3e9ecd['id']);return getEndUser(_0x1076fa,_0x25ba52['destcalleridname'],_0x25ba52[_0x19ca('0x57')]);})[_0x19ca('0x1c')](function(_0x37abf0){_0x208773=_0x37abf0;logger['info'](_0x19ca('0x4c'),_0x208773['id']);return getTicket(_0x1076fa,_0x3e9ecd,_0x208773,_0x2e0925,_0x25ba52);})[_0x19ca('0x1c')](function(_0x541a0b){if(_0x541a0b&&_0x541a0b['id']){logger[_0x19ca('0x21')](_0x19ca('0x1d'));logger[_0x19ca('0x21')](_0x19ca('0x4d'),_0x541a0b['id']);logger[_0x19ca('0x21')](_0x19ca('0x58'),_0x19ca('0x4f'));emit(util[_0x19ca('0xd')](_0x19ca('0x59'),_0x3b4ce9[_0x19ca('0x15')]),_0x19ca('0x50'),{'uri':util[_0x19ca('0xd')](_0x19ca('0x51'),_0x1076fa[_0x19ca('0x25')],_0x541a0b['id'])});}})['catch'](function(_0x12237f){logger[_0x19ca('0x53')](_0x19ca('0x58'),JSON[_0x19ca('0x32')](_0x12237f));});};exports['unmanaged']=function(_0x17758a,_0x1e9a82,_0x4eabf5,_0x545a84,_0x3ad050,_0x408722){var _0x20a877,_0x27fefe;_0x408722[_0x19ca('0x25')]=intUtil[_0x19ca('0x45')](_0x408722['remoteUri']);_0x408722[_0x19ca('0x44')]=intUtil['stripTrailingSlash'](_0x408722['serverUrl']);if(_0x3ad050&&_0x3ad050[_0x19ca('0x46')]){logger[_0x19ca('0x21')]('['+_0x1e9a82[_0x19ca('0x5a')][_0x19ca('0x5b')]()+']',_0x19ca('0x47'));_0x1e9a82[_0x19ca('0x49')]=util['format'](_0x19ca('0x56'),_0x408722['serverUrl'],_0x1e9a82[_0x19ca('0x48')],md5(_0x1e9a82[_0x19ca('0x48')]));}else{_0x1e9a82[_0x19ca('0x49')]='';}headers[_0x19ca('0x4a')]=getAuth(_0x408722);return getUser(_0x408722,'')[_0x19ca('0x1c')](function(_0x5e9d49){_0x20a877=_0x5e9d49;logger[_0x19ca('0x21')](_0x19ca('0x5c'),_0x20a877['id']);return getEndUser(_0x408722,_0x1e9a82[_0x19ca('0xf')],_0x1e9a82[_0x19ca('0x4b')]);})['then'](function(_0xc817d){_0x27fefe=_0xc817d;logger[_0x19ca('0x21')](_0x19ca('0x4c'),_0x27fefe['id']);return getTicket(_0x408722,_0x20a877,_0x27fefe,_0x4eabf5,_0x1e9a82);})[_0x19ca('0x1c')](function(_0x26cb26){if(_0x26cb26){logger[_0x19ca('0x21')](_0x19ca('0x1d'));logger['info'](_0x19ca('0x4d'),_0x26cb26['id']);}})[_0x19ca('0x52')](function(_0x31dfef){logger[_0x19ca('0x53')]('['+_0x1e9a82[_0x19ca('0x5a')]['toUpperCase']()+']',JSON['stringify'](_0x31dfef));});}; \ No newline at end of file +var _0xea7c=['The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','unmanaged','lastevent','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','calleridname','getString','Subjects','Descriptions','
','Tags','name','mapValues','custom_fields','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','apiKey','toString','base64','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variable','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:'];(function(_0x102a3e,_0x1f75d3){var _0x1e3e8f=function(_0x1505f3){while(--_0x1505f3){_0x102a3e['push'](_0x102a3e['shift']());}};_0x1e3e8f(++_0x1f75d3);}(_0xea7c,0x115));var _0xcea7=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xea7c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xcea7('0x0'));var rp=require(_0xcea7('0x1'));var md5=require(_0xcea7('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xcea7('0x3'));var config=require(_0xcea7('0x4'));var logger=require(_0xcea7('0x5'))(_0xcea7('0x6'));config[_0xcea7('0x7')]=_[_0xcea7('0x8')](config[_0xcea7('0x7')],{'host':_0xcea7('0x9'),'port':0x18eb});var io=require(_0xcea7('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xcea7('0xb'),'Accept':_0xcea7('0xb')};function emit(_0x3f8ddb,_0xc22cc8,_0x33fb6b){io['to'](_0x3f8ddb)[_0xcea7('0xc')](_0xc22cc8,_0x33fb6b);}function getTicket(_0x338b1b,_0x3d338a,_0x9cbeea,_0x4cad83,_0x2d46b6){logger[_0xcea7('0xd')]('Creating\x20new\x20ticket...');var _0xabf56f=_[_0xcea7('0xe')]({'responder_id':_0x3d338a['id'],'requester_id':_0x9cbeea['id'],'name':util[_0xcea7('0xf')]('Caller\x20-\x20%s',_0x2d46b6[_0xcea7('0x10')]),'phone':_0x2d46b6['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcea7('0x11')](_0x4cad83[_0xcea7('0x12')],_0x2d46b6,'\x20'),'description':intUtil[_0xcea7('0x11')](_0x4cad83[_0xcea7('0x13')],_0x2d46b6,_0xcea7('0x14')),'tags':getTags(_0x4cad83[_0xcea7('0x15')],_0xcea7('0x16'))},getCustomFields(_0x4cad83['Fields'],_0x2d46b6));_0xabf56f['custom_fields']=_[_0xcea7('0x17')](_['keyBy'](_0xabf56f[_0xcea7('0x18')],'id'),'value');return request({'uri':util[_0xcea7('0xf')]('%s/api/v2/tickets',_0x338b1b['remoteUri']),'method':'POST','body':_0xabf56f})['then'](function(_0x4d847c){logger[_0xcea7('0xd')](_0xcea7('0x19'));return _0x4d847c;});}function getUser(_0x1e221a,_0x324048){if(intUtil[_0xcea7('0x1a')](_0x324048)){return request({'uri':util[_0xcea7('0xf')](_0xcea7('0x1b'),_0x1e221a[_0xcea7('0x1c')]),'qs':{'email':_0x324048}})[_0xcea7('0x1d')](function(_0x125a68){if(_0x125a68[_0xcea7('0x1e')]){logger[_0xcea7('0xd')](_0xcea7('0x1f'));return _['find'](_0x125a68,function(_0x36bb79){return _0x36bb79[_0xcea7('0x20')][_0xcea7('0x21')]===_0x324048;});}else{logger['info'](_0xcea7('0x22'));return request({'uri':util[_0xcea7('0xf')]('%s/api/v2/agents/me',_0x1e221a[_0xcea7('0x1c')])})[_0xcea7('0x1d')](function(_0x7ec26a){logger[_0xcea7('0xd')](_0xcea7('0x23'));return _0x7ec26a;});}});}else{logger[_0xcea7('0xd')](_0xcea7('0x24'));return request({'uri':util[_0xcea7('0xf')]('%s/api/v2/agents/me',_0x1e221a[_0xcea7('0x1c')])})[_0xcea7('0x1d')](function(_0x178a32){logger[_0xcea7('0xd')]('Admin\x20account\x20selected.');return _0x178a32;});}}function getEndUser(_0x4f17d8,_0x539e5a,_0x150f18){logger['info'](_0xcea7('0x25'),_0x150f18);return request({'uri':util[_0xcea7('0xf')](_0xcea7('0x26'),_0x4f17d8[_0xcea7('0x1c')]),'qs':{'phone':_0x150f18}})[_0xcea7('0x1d')](function(_0x421915){if(_0x421915[_0xcea7('0x1e')]){logger[_0xcea7('0xd')](_0xcea7('0x27'));return _[_0xcea7('0x28')](_0x421915,{'phone':_0x150f18});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xcea7('0x26'),_0x4f17d8[_0xcea7('0x1c')]),'method':'POST','body':{'name':_0x539e5a,'phone':_0x150f18}})[_0xcea7('0x1d')](function(_0x1726a2){logger['info']('Enduser\x20created.');return _0x1726a2;});}});}function getAuth(_0x15af18){return util[_0xcea7('0xf')]('Basic\x20%s',new Buffer(_0x15af18[_0xcea7('0x29')]+':X')[_0xcea7('0x2a')](_0xcea7('0x2b')));}function request(_0x3cb619){logger['debug'](_0xcea7('0x2c'),JSON[_0xcea7('0x2d')](_0x3cb619));return rp(_[_0xcea7('0x8')](_0x3cb619,{'method':_0xcea7('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x37f238,_0x17d25c){var _0x5e32d3=[];if(_0x37f238&&_0x37f238[_0xcea7('0x1e')]>0x0){_0x5e32d3=_['map'](_0x37f238,_0x17d25c);}return _0x5e32d3;}function getCustomFields(_0x23a3ed,_0x442217){var _0x5ed253=[];var _0x4f2045={'custom_fields':[]};if(_0x23a3ed[_0xcea7('0x1e')]>0x0){_[_0xcea7('0x2f')](_0x23a3ed,function(_0x5e5c1f){if(_[_0xcea7('0x30')]([_0xcea7('0x31'),_0xcea7('0x32')],_0x5e5c1f[_0xcea7('0x33')])&&_0x5e5c1f[_0xcea7('0x34')]&&!_0x5e5c1f[_0xcea7('0x35')]){_0x4f2045[_0x5e5c1f['nameField'][_0xcea7('0x36')]()]=_0x5e5c1f[_0xcea7('0x37')][_0xcea7('0x2a')]();}else if(_[_0xcea7('0x30')](['string',_0xcea7('0x32')],_0x5e5c1f[_0xcea7('0x33')])&&_0x5e5c1f['idField']&&_0x5e5c1f[_0xcea7('0x35')]){_0x4f2045['custom_fields'][_0xcea7('0x38')]({'id':_0x5e5c1f[_0xcea7('0x39')],'value':_0x5e5c1f['content'][_0xcea7('0x2a')]()});}else if(_0x5e5c1f[_0xcea7('0x33')]===_0xcea7('0x3a')&&_0x5e5c1f['variableName']&&_0x5e5c1f[_0xcea7('0x39')]&&_0x5e5c1f[_0xcea7('0x35')]){_0x442217[_0x5e5c1f['variableName']]&&_0x4f2045[_0xcea7('0x18')]['push']({'id':_0x5e5c1f[_0xcea7('0x39')],'value':_0x442217[_0x5e5c1f['variableName']][_0xcea7('0x2a')]()});}else if(_0x5e5c1f[_0xcea7('0x33')]===_0xcea7('0x3b')&&_0x5e5c1f[_0xcea7('0x3c')]&&_0x5e5c1f[_0xcea7('0x3c')][_0xcea7('0x16')]&&_0x5e5c1f[_0xcea7('0x39')]&&_0x5e5c1f[_0xcea7('0x35')]){_0x442217[_0x5e5c1f[_0xcea7('0x3c')][_0xcea7('0x16')][_0xcea7('0x36')]()]&&_0x4f2045[_0xcea7('0x18')][_0xcea7('0x38')]({'id':_0x5e5c1f['idField'],'value':_0x442217[_0x5e5c1f[_0xcea7('0x3c')]['name']['toLowerCase']()][_0xcea7('0x2a')]()});}});}return _0x4f2045;}exports[_0xcea7('0x3d')]=function(_0x448d52,_0x52c543,_0x42e26c,_0x55de7c,_0x12d1ca,_0x23ef72){var _0x3da05c,_0x5d971c;_0x23ef72[_0xcea7('0x1c')]=intUtil[_0xcea7('0x3e')](_0x23ef72[_0xcea7('0x1c')]);_0x23ef72[_0xcea7('0x3f')]=intUtil[_0xcea7('0x3e')](_0x23ef72[_0xcea7('0x3f')]);if(_0x12d1ca&&_0x12d1ca[_0xcea7('0x40')]){logger[_0xcea7('0xd')](_0xcea7('0x41'),_0xcea7('0x42'));_0x52c543[_0xcea7('0x43')]=util[_0xcea7('0xf')](_0xcea7('0x44'),_0x23ef72[_0xcea7('0x3f')],_0x52c543[_0xcea7('0x45')],md5(_0x52c543[_0xcea7('0x45')]));}else{_0x52c543[_0xcea7('0x43')]='';}headers['Authorization']=getAuth(_0x23ef72);return getUser(_0x23ef72,_0x55de7c[_0xcea7('0x21')])[_0xcea7('0x1d')](function(_0x2b7efb){_0x3da05c=_0x2b7efb;logger[_0xcea7('0xd')](_0xcea7('0x46'),_0x3da05c['id']);return getEndUser(_0x23ef72,_0x52c543[_0xcea7('0x10')],_0x52c543['calleridnum']);})[_0xcea7('0x1d')](function(_0x4fd62c){_0x5d971c=_0x4fd62c;logger[_0xcea7('0xd')](_0xcea7('0x47'),_0x5d971c['id']);return getTicket(_0x23ef72,_0x3da05c,_0x5d971c,_0x42e26c,_0x52c543);})[_0xcea7('0x1d')](function(_0x97723e){if(_0x97723e&&_0x97723e['id']){logger[_0xcea7('0xd')](_0xcea7('0x19'));logger['info'](_0xcea7('0x48'),_0x97723e['id']);logger[_0xcea7('0xd')]('[QUEUE]',_0xcea7('0x49'));emit(util[_0xcea7('0xf')](_0xcea7('0x4a'),_0x55de7c[_0xcea7('0x16')]),_0xcea7('0x4b'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x23ef72['remoteUri'],_0x97723e['id'])});}})[_0xcea7('0x4c')](function(_0x1d4703){logger[_0xcea7('0x4d')](_0xcea7('0x41'),JSON['stringify'](_0x1d4703));});};exports[_0xcea7('0x4e')]=function(_0x249306,_0x24e105,_0xdaf743,_0x277205,_0xf3105e,_0x153335,_0x1bd6ed){var _0x2a7d31,_0x590099;_0x153335[_0xcea7('0x1c')]=intUtil[_0xcea7('0x3e')](_0x153335[_0xcea7('0x1c')]);_0x153335['serverUrl']=intUtil[_0xcea7('0x3e')](_0x153335['serverUrl']);if(_0x1bd6ed&&_0x1bd6ed[_0xcea7('0x4f')]&&_0x1bd6ed[_0xcea7('0x4f')]!==_0xcea7('0x50')){logger['info'](_0xcea7('0x51'),'Recording\x20is\x20enabled!');_0x24e105[_0xcea7('0x43')]=util[_0xcea7('0xf')](_0xcea7('0x44'),_0x153335[_0xcea7('0x3f')],_0x24e105[_0xcea7('0x45')],md5(_0x24e105[_0xcea7('0x45')]));}headers[_0xcea7('0x52')]=getAuth(_0x153335);return getUser(_0x153335,_0x277205[_0xcea7('0x21')])[_0xcea7('0x1d')](function(_0x15e392){_0x2a7d31=_0x15e392;logger['info'](_0xcea7('0x46'),_0x2a7d31['id']);return getEndUser(_0x153335,_0x24e105[_0xcea7('0x53')],_0x24e105[_0xcea7('0x54')]);})[_0xcea7('0x1d')](function(_0xe93b5a){_0x590099=_0xe93b5a;logger[_0xcea7('0xd')]('The\x20Enduser\x20ID\x20is:',_0x590099['id']);return getTicket(_0x153335,_0x2a7d31,_0x590099,_0xdaf743,_0x24e105);})[_0xcea7('0x1d')](function(_0x2353da){if(_0x2353da&&_0x2353da['id']){logger['info']('Ticket\x20created!');logger[_0xcea7('0xd')](_0xcea7('0x48'),_0x2353da['id']);logger[_0xcea7('0xd')](_0xcea7('0x51'),_0xcea7('0x49'));emit(util[_0xcea7('0xf')](_0xcea7('0x4a'),_0x277205['name']),_0xcea7('0x4b'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x153335[_0xcea7('0x1c')],_0x2353da['id'])});}})[_0xcea7('0x4c')](function(_0x624d6){logger[_0xcea7('0x4d')](_0xcea7('0x51'),JSON[_0xcea7('0x2d')](_0x624d6));});};exports[_0xcea7('0x55')]=function(_0xc9b0c3,_0x462b0f,_0x47e97d,_0x148679,_0x35820e,_0x174160){var _0x1b2b27,_0x339e8;_0x174160[_0xcea7('0x1c')]=intUtil[_0xcea7('0x3e')](_0x174160[_0xcea7('0x1c')]);_0x174160[_0xcea7('0x3f')]=intUtil[_0xcea7('0x3e')](_0x174160[_0xcea7('0x3f')]);if(_0x35820e&&_0x35820e[_0xcea7('0x40')]){logger[_0xcea7('0xd')]('['+_0x462b0f[_0xcea7('0x56')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x462b0f[_0xcea7('0x43')]=util[_0xcea7('0xf')](_0xcea7('0x44'),_0x174160[_0xcea7('0x3f')],_0x462b0f[_0xcea7('0x45')],md5(_0x462b0f['uniqueid']));}else{_0x462b0f['recordingURL']='';}headers[_0xcea7('0x52')]=getAuth(_0x174160);return getUser(_0x174160,'')[_0xcea7('0x1d')](function(_0x390347){_0x1b2b27=_0x390347;logger[_0xcea7('0xd')](_0xcea7('0x46'),_0x1b2b27['id']);return getEndUser(_0x174160,_0x462b0f['calleridname'],_0x462b0f['calleridnum']);})[_0xcea7('0x1d')](function(_0x6d4a48){_0x339e8=_0x6d4a48;logger[_0xcea7('0xd')](_0xcea7('0x47'),_0x339e8['id']);return getTicket(_0x174160,_0x1b2b27,_0x339e8,_0x47e97d,_0x462b0f);})['then'](function(_0x34192b){if(_0x34192b){logger['info'](_0xcea7('0x19'));logger['info'](_0xcea7('0x48'),_0x34192b['id']);}})[_0xcea7('0x4c')](function(_0x38c21b){logger[_0xcea7('0x4d')]('['+_0x462b0f[_0xcea7('0x56')]['toUpperCase']()+']',JSON['stringify'](_0x38c21b));});}; \ 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 8bc8254..1175098 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 _0x0c8f=['YYYY-MM-DDTHH:mm:ss','add','task','Task\x20created:','toUpperCase','user:%s','emit','trigger:browser:url','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','error','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Creating\x20new\x20task','getString','Subjects'];(function(_0x3c4485,_0x14fe16){var _0x1e224c=function(_0x45ac9c){while(--_0x45ac9c){_0x3c4485['push'](_0x3c4485['shift']());}};_0x1e224c(++_0x14fe16);}(_0x0c8f,0x112));var _0xf0c8=function(_0x5cba1c,_0x806c23){_0x5cba1c=_0x5cba1c-0x0;var _0xa07093=_0x0c8f[_0x5cba1c];return _0xa07093;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf0c8('0x0'));var util=require(_0xf0c8('0x1'));var moment=require(_0xf0c8('0x2'));var Promise=require(_0xf0c8('0x3'));var Redis=require(_0xf0c8('0x4'));var intUtil=require(_0xf0c8('0x5'));var config=require(_0xf0c8('0x6'));var logger=require('../../../../config/logger')(_0xf0c8('0x7'));config[_0xf0c8('0x8')]=_[_0xf0c8('0x9')](config[_0xf0c8('0x8')],{'host':_0xf0c8('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x4a71da,_0xc73a5,_0x1ccc9d,_0x31d2c8){return new Promise(function(_0x2c00d0,_0xb27d74){var _0x221f58=![];var _0x36c57b={'method':_0xf0c8('0xb'),'uri':_0x31d2c8+_0xf0c8('0xc'),'json':!![]};_0x36c57b[_0xf0c8('0xd')]=_0x1ccc9d;logger['info'](_0xf0c8('0xe'));return rp(_0x36c57b)[_0xf0c8('0xf')](function(_0x4fd19b){if(_0x4fd19b){var _0x1bfee9=_0x4fd19b['users'];var _0x13e343=null;for(_0x13e343=0x0;_0x13e343<_0x1bfee9[_0xf0c8('0x10')];_0x13e343++){if(_0x1bfee9[_0x13e343][_0xf0c8('0x11')]===_0x4a71da[_0xf0c8('0x12')]){_0x4a71da[_0xf0c8('0x13')]=_0x1bfee9[_0x13e343]['id'];_0x221f58=!![];}}if(_0x221f58){logger[_0xf0c8('0x14')](_0xf0c8('0x15'),_0x4a71da[_0xf0c8('0x13')]);_0x2c00d0(_0x4a71da);}else{_0xb27d74({'statusCode':0x194,'message':_0xf0c8('0x16')});}}else{_0xb27d74({'statusCode':0x194,'message':_0xf0c8('0x16')});}})[_0xf0c8('0x17')](function(_0x27270b){logger['error']('['+[_0xc73a5['toUpperCase']()]+']',_0x27270b[_0xf0c8('0x18')]);_0xb27d74(_0x27270b);});});}function getUser(_0x4c11d2,_0x31b282,_0x294557){return function(_0x5d104e){return new Promise(function(_0x282da5,_0x2c19c8){var _0x5b4e36={'method':_0xf0c8('0xb'),'uri':_0x294557+_0xf0c8('0xc'),'json':!![]};_0x5b4e36[_0xf0c8('0xd')]=_0x31b282;logger['info'](_0xf0c8('0x19'));return rp(_0x5b4e36)[_0xf0c8('0xf')](function(_0x20839d){if(_0x20839d){var _0x32c3a7=_0x20839d[_0xf0c8('0x1a')];var _0x18982b=![];var _0x109976=null;if(_0x5d104e[_0xf0c8('0x1b')]!==null){logger['info'](_0xf0c8('0x1c'),_0x5d104e[_0xf0c8('0x1b')]);_0x5d104e['userEmail']=_0x5d104e['agentEmail'];for(_0x109976=0x0;_0x109976<_0x32c3a7[_0xf0c8('0x10')];_0x109976++){if(_0x32c3a7[_0x109976]['email']===_0x5d104e[_0xf0c8('0x1b')]){_0x18982b=!![];_0x5d104e[_0xf0c8('0x1d')]=_0x32c3a7[_0x109976]['id'];logger[_0xf0c8('0x14')]('User\x20found:',_0x5d104e[_0xf0c8('0x1d')]);}}}if(!_0x18982b){logger[_0xf0c8('0x14')](_0xf0c8('0x1e'));_0x5d104e[_0xf0c8('0x1f')]=_0x5d104e[_0xf0c8('0x12')];_0x5d104e[_0xf0c8('0x1d')]=_0x5d104e[_0xf0c8('0x13')];_0x18982b=!![];}if(_0x18982b){_0x282da5(_0x5d104e);}else{_0x2c19c8({'statusCode':0x194,'message':_0xf0c8('0x16')});}}else{_0x2c19c8({'statusCode':0x194,'message':_0xf0c8('0x16')});}})[_0xf0c8('0x17')](function(_0x2a0b0c){logger[_0xf0c8('0x20')]('['+[_0x4c11d2['toUpperCase']()]+']',_0x2a0b0c[_0xf0c8('0x18')]);_0x2c19c8(_0x2a0b0c);});});};}function searchContact(_0x58cee6,_0x47612d,_0x3b3459,_0x12da1b){return new Promise(function(_0x52b492,_0x10af93){var _0x28390b={'method':'GET','headers':_0x47612d,'uri':_0x58cee6+_0xf0c8('0x21')+_0x12da1b+'&f='+_0x3b3459+_0xf0c8('0x22'),'json':!![]};rp(_0x28390b)['then'](function(_0x1f9353){var _0x1b0d20=_[_0xf0c8('0x23')](_0x1f9353[_0xf0c8('0x24')][_0xf0c8('0x24')],[_0x3b3459,_0x12da1b]);_0x52b492(_0x1b0d20);})['catch'](function(_0x364eb6){_0x10af93(_0x364eb6);});});}function getEndUser(_0x4690d8,_0x340647,_0x58e5a8){return function(_0xc9de4b){return new Promise(function(_0x364edf,_0xdaa8c9){logger['info'](util[_0xf0c8('0x25')](_0xf0c8('0x26'),_0xc9de4b[_0xf0c8('0x27')]));searchContact(_0x58e5a8,_0x340647,'mobile_number',_0xc9de4b['contactNumber'])['then'](function(_0x26c3ba){if(_0x26c3ba){_0xc9de4b[_0xf0c8('0x28')]=_0x26c3ba['id'];logger['info'](_0xf0c8('0x29'),_0xc9de4b['endUserId']);return _0x364edf(_0xc9de4b);}searchContact(_0x58e5a8,_0x340647,_0xf0c8('0x2a'),_0xc9de4b[_0xf0c8('0x27')])[_0xf0c8('0xf')](function(_0x355680){if(_0x355680){_0xc9de4b['endUserId']=_0x355680['id'];logger[_0xf0c8('0x14')](_0xf0c8('0x2b'),_0xc9de4b[_0xf0c8('0x28')]);return _0x364edf(_0xc9de4b);}createEndUser(_0xc9de4b,_0x4690d8,_0x340647,_0x58e5a8)[_0xf0c8('0xf')](function(_0x2c8ced){logger[_0xf0c8('0x14')](_0xf0c8('0x2c'),_0x2c8ced[_0xf0c8('0x28')]);return _0x364edf(_0x2c8ced);});});})[_0xf0c8('0x17')](function(_0x53b15c){_0xdaa8c9(_0x53b15c);});});};}function createEndUser(_0x4a2397,_0x271ab9,_0x5482dc,_0x523e7a){return new Promise(function(_0x56de4f,_0x4e1bf8){var _0x2b9772=moment();var _0x2ae7b5={'method':_0xf0c8('0x2d'),'uri':_0x523e7a+_0xf0c8('0x2e'),'body':{'contact':{'last_name':_0x4a2397['contactNumber'],'work_number':_0x4a2397[_0xf0c8('0x27')],'mobile_number':_0x4a2397[_0xf0c8('0x27')],'owner_id':_0x4a2397[_0xf0c8('0x1d')],'created_at':_0x2b9772[_0xf0c8('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x2ae7b5[_0xf0c8('0xd')]=_0x5482dc;logger[_0xf0c8('0x14')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2ae7b5)[_0xf0c8('0xf')](function(_0x34f899){_0x4a2397['endUserId']=_0x34f899['contact']['id'];_0x56de4f(_0x4a2397);})['catch'](function(_0x514eac){logger[_0xf0c8('0x20')]('['+[_0x271ab9['toUpperCase']()]+']',_0x514eac[_0xf0c8('0x18')]);_0x4e1bf8(_0x514eac[_0xf0c8('0x18')]);});});}function getTicket(_0x7075,_0x59569d,_0x2289a4,_0x4910c5,_0x237ce6){return function(_0x1ed26e){logger[_0xf0c8('0x14')](_0xf0c8('0x2f'));return new Promise(function(_0x8a5c6f,_0x5605a4){var _0x29b834=moment();var _0x446472={'method':_0xf0c8('0x2d'),'uri':_0x2289a4+'/api/tasks','body':{'title':intUtil[_0xf0c8('0x30')](_0x4910c5[_0xf0c8('0x31')],_0x237ce6,'\x20'),'description':intUtil[_0xf0c8('0x30')](_0x4910c5['Descriptions'],_0x237ce6,'\x0a'),'owner_id':_0x1ed26e[_0xf0c8('0x1d')],'creater_id':_0x1ed26e[_0xf0c8('0x13')],'targetable_id':_0x1ed26e[_0xf0c8('0x28')],'targetable_type':'Contact','created_at':_0x29b834['format'](_0xf0c8('0x32')),'due_date':_0x29b834[_0xf0c8('0x33')](0x1e,'m')['format'](_0xf0c8('0x32'))},'json':!![]};_0x446472['headers']=_0x59569d;return rp(_0x446472)[_0xf0c8('0xf')](function(_0x751a){_0x1ed26e['ticketId']=_0x751a[_0xf0c8('0x34')]['id'];logger[_0xf0c8('0x14')](_0xf0c8('0x35'),_0x1ed26e['ticketId']);_0x8a5c6f(_0x1ed26e);})['catch'](function(_0x3157f2){logger[_0xf0c8('0x20')]('['+[_0x7075[_0xf0c8('0x36')]()]+']',_0x3157f2[_0xf0c8('0x18')]);_0x5605a4(_0x3157f2[_0xf0c8('0x18')]);});});};}function emit(_0x2a23c6,_0x4437cc,_0x2e7228){var _0x96ee8e={'uri':_0x2a23c6+'/contacts/'+_0x2e7228};io['to'](util[_0xf0c8('0x25')](_0xf0c8('0x37'),_0x4437cc))[_0xf0c8('0x38')](_0xf0c8('0x39'),_0x96ee8e);}exports['cs']=function(_0x40466d,_0x5ae88d,_0x1e82c2,_0x11cc48,_0x4d1fea,_0x4888ce,_0x48d636,_0x204ec3){var _0x238dc2={};var _0x531723={'Authorization':'Token\x20token='+_0x4888ce[_0xf0c8('0x3a')]};_0x4888ce[_0xf0c8('0x3b')]=intUtil['stripTrailingSlash'](_0x4888ce[_0xf0c8('0x3b')]);_0x4888ce[_0xf0c8('0x3c')]=intUtil[_0xf0c8('0x3d')](_0x4888ce['serverUrl']);var _0x2f13fa=_0x4888ce['remoteUri'];_0x238dc2[_0xf0c8('0x12')]=_0x4888ce[_0xf0c8('0x3e')];_0x238dc2[_0xf0c8('0x27')]=_0x204ec3[_0xf0c8('0x3f')]()==='outbound'?_0x5ae88d[_0xf0c8('0x40')]:_0x5ae88d['calleridnum'];_0x238dc2[_0xf0c8('0x41')]=_0x204ec3===_0xf0c8('0x42')||_0x204ec3===_0xf0c8('0x43')?_0xf0c8('0x42'):_0xf0c8('0x44');if(_0x11cc48){_0x238dc2[_0xf0c8('0x1b')]=_0x11cc48[_0xf0c8('0x11')];}var _0x204208=util[_0xf0c8('0x25')](_0xf0c8('0x45'),_0x4888ce[_0xf0c8('0x3c')],_0x5ae88d[_0xf0c8('0x46')],md5(_0x5ae88d[_0xf0c8('0x46')]));if(_0x4d1fea&&_0x4d1fea[_0xf0c8('0x47')]){logger[_0xf0c8('0x14')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5ae88d[_0xf0c8('0x48')]=_0x204208;}else if(_0x48d636&&_0x48d636[_0xf0c8('0x49')]&&_0x48d636['recordingFormat']!=='none'){logger['info'](_0xf0c8('0x4a'),_0xf0c8('0x4b'));_0x5ae88d[_0xf0c8('0x48')]=_0x204208;}else{_0x5ae88d[_0xf0c8('0x48')]='';}return getAdminId(_0x238dc2,_0x204ec3,_0x531723,_0x2f13fa)['then'](getUser(_0x204ec3,_0x531723,_0x2f13fa))['then'](getEndUser(_0x204ec3,_0x531723,_0x2f13fa))[_0xf0c8('0xf')](getTicket(_0x204ec3,_0x531723,_0x2f13fa,_0x1e82c2,_0x5ae88d))['then'](function(_0xddeea3){logger[_0xf0c8('0x14')](util[_0xf0c8('0x25')](_0xf0c8('0x4c'),_0xddeea3[_0xf0c8('0x4d')]));if(_0x204ec3!==_0xf0c8('0x43')){logger[_0xf0c8('0x14')]('['+[_0x204ec3['toUpperCase']()]+']',_0xf0c8('0x4e'));emit(_0x2f13fa,_0x11cc48[_0xf0c8('0x4f')],_0xddeea3['endUserId']);}})[_0xf0c8('0x17')](function(_0x16d052){logger['error']('['+[_0x204ec3[_0xf0c8('0x36')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xf0c8('0x50')](_0x16d052,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd290=['bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userId','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment'];(function(_0x27ae2d,_0x5850e8){var _0x57cf90=function(_0x4ea833){while(--_0x4ea833){_0x27ae2d['push'](_0x27ae2d['shift']());}};_0x57cf90(++_0x5850e8);}(_0xd290,0x14c));var _0x0d29=function(_0x31336b,_0x3638db){_0x31336b=_0x31336b-0x0;var _0x483308=_0xd290[_0x31336b];return _0x483308;};'use strict';var _=require(_0x0d29('0x0'));var rp=require(_0x0d29('0x1'));var md5=require('md5');var util=require(_0x0d29('0x2'));var moment=require(_0x0d29('0x3'));var Promise=require(_0x0d29('0x4'));var Redis=require(_0x0d29('0x5'));var intUtil=require(_0x0d29('0x6'));var config=require('../../../../config/environment');var logger=require(_0x0d29('0x7'))(_0x0d29('0x8'));config[_0x0d29('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x433e90,_0xd9d1fa,_0x4d0390,_0x10b040){return new Promise(function(_0x45b1b5,_0xf152a8){var _0x663ae5=![];var _0x51a2d2={'method':_0x0d29('0xa'),'uri':_0x10b040+_0x0d29('0xb'),'json':!![]};_0x51a2d2[_0x0d29('0xc')]=_0x4d0390;logger[_0x0d29('0xd')]('Getting\x20admin\x20information');return rp(_0x51a2d2)['then'](function(_0x471568){if(_0x471568){var _0x20a4f2=_0x471568[_0x0d29('0xe')];var _0x2caaeb=null;for(_0x2caaeb=0x0;_0x2caaeb<_0x20a4f2[_0x0d29('0xf')];_0x2caaeb++){if(_0x20a4f2[_0x2caaeb][_0x0d29('0x10')]===_0x433e90[_0x0d29('0x11')]){_0x433e90[_0x0d29('0x12')]=_0x20a4f2[_0x2caaeb]['id'];_0x663ae5=!![];}}if(_0x663ae5){logger[_0x0d29('0xd')](_0x0d29('0x13'),_0x433e90[_0x0d29('0x12')]);_0x45b1b5(_0x433e90);}else{_0xf152a8({'statusCode':0x194,'message':_0x0d29('0x14')});}}else{_0xf152a8({'statusCode':0x194,'message':_0x0d29('0x14')});}})[_0x0d29('0x15')](function(_0x16b0ee){logger[_0x0d29('0x16')]('['+[_0xd9d1fa[_0x0d29('0x17')]()]+']',_0x16b0ee[_0x0d29('0x18')]);_0xf152a8(_0x16b0ee);});});}function getUser(_0x11c3b6,_0x3ff37e,_0x251f8f){return function(_0x5b56f3){return new Promise(function(_0x6af846,_0x3d6b49){var _0xe89885={'method':_0x0d29('0xa'),'uri':_0x251f8f+_0x0d29('0xb'),'json':!![]};_0xe89885['headers']=_0x3ff37e;logger[_0x0d29('0xd')](_0x0d29('0x19'));return rp(_0xe89885)[_0x0d29('0x1a')](function(_0x33765c){if(_0x33765c){var _0x4757ff=_0x33765c[_0x0d29('0xe')];var _0x55bffd=![];var _0xce40f9=null;if(_0x5b56f3[_0x0d29('0x1b')]!==null){logger[_0x0d29('0xd')](_0x0d29('0x1c'),_0x5b56f3[_0x0d29('0x1b')]);_0x5b56f3['userEmail']=_0x5b56f3[_0x0d29('0x1b')];for(_0xce40f9=0x0;_0xce40f9<_0x4757ff['length'];_0xce40f9++){if(_0x4757ff[_0xce40f9]['email']===_0x5b56f3[_0x0d29('0x1b')]){_0x55bffd=!![];_0x5b56f3[_0x0d29('0x1d')]=_0x4757ff[_0xce40f9]['id'];logger[_0x0d29('0xd')]('User\x20found:',_0x5b56f3[_0x0d29('0x1d')]);}}}if(!_0x55bffd){logger[_0x0d29('0xd')]('Admin\x20selected');_0x5b56f3[_0x0d29('0x1e')]=_0x5b56f3[_0x0d29('0x11')];_0x5b56f3[_0x0d29('0x1d')]=_0x5b56f3[_0x0d29('0x12')];_0x55bffd=!![];}if(_0x55bffd){_0x6af846(_0x5b56f3);}else{_0x3d6b49({'statusCode':0x194,'message':_0x0d29('0x14')});}}else{_0x3d6b49({'statusCode':0x194,'message':_0x0d29('0x14')});}})[_0x0d29('0x15')](function(_0x2fd0be){logger['error']('['+[_0x11c3b6[_0x0d29('0x17')]()]+']',_0x2fd0be[_0x0d29('0x18')]);_0x3d6b49(_0x2fd0be);});});};}function searchContact(_0x5e506c,_0xcd930,_0xec3fcb,_0x4109e6){return new Promise(function(_0x3ce9a9,_0x2fca31){var _0x59ef6a={'method':_0x0d29('0xa'),'headers':_0xcd930,'uri':_0x5e506c+_0x0d29('0x1f')+_0x4109e6+_0x0d29('0x20')+_0xec3fcb+_0x0d29('0x21'),'json':!![]};rp(_0x59ef6a)['then'](function(_0x1e466c){var _0x39f175=_[_0x0d29('0x22')](_0x1e466c[_0x0d29('0x23')][_0x0d29('0x23')],[_0xec3fcb,_0x4109e6]);_0x3ce9a9(_0x39f175);})[_0x0d29('0x15')](function(_0x3a2e54){_0x2fca31(_0x3a2e54);});});}function getEndUser(_0x3c4744,_0x3385ec,_0x5e85cc){return function(_0x3e9b63){return new Promise(function(_0xf04d5,_0x2e7412){logger[_0x0d29('0xd')](util[_0x0d29('0x24')](_0x0d29('0x25'),_0x3e9b63['contactNumber']));searchContact(_0x5e85cc,_0x3385ec,'mobile_number',_0x3e9b63[_0x0d29('0x26')])[_0x0d29('0x1a')](function(_0x301635){if(_0x301635){_0x3e9b63['endUserId']=_0x301635['id'];logger[_0x0d29('0xd')](_0x0d29('0x27'),_0x3e9b63[_0x0d29('0x28')]);return _0xf04d5(_0x3e9b63);}searchContact(_0x5e85cc,_0x3385ec,'work_number',_0x3e9b63[_0x0d29('0x26')])['then'](function(_0x4d4f82){if(_0x4d4f82){_0x3e9b63['endUserId']=_0x4d4f82['id'];logger[_0x0d29('0xd')](_0x0d29('0x29'),_0x3e9b63[_0x0d29('0x28')]);return _0xf04d5(_0x3e9b63);}createEndUser(_0x3e9b63,_0x3c4744,_0x3385ec,_0x5e85cc)[_0x0d29('0x1a')](function(_0x3dc797){logger[_0x0d29('0xd')](_0x0d29('0x2a'),_0x3dc797[_0x0d29('0x28')]);return _0xf04d5(_0x3dc797);});});})[_0x0d29('0x15')](function(_0x51c789){_0x2e7412(_0x51c789);});});};}function createEndUser(_0xdb2076,_0x43edf1,_0x32fa27,_0x3fefaa){return new Promise(function(_0x5d698c,_0x4d1115){var _0x1412ab=moment();var _0x5212ff={'method':_0x0d29('0x2b'),'uri':_0x3fefaa+_0x0d29('0x2c'),'body':{'contact':{'last_name':_0xdb2076[_0x0d29('0x26')],'work_number':_0xdb2076[_0x0d29('0x26')],'mobile_number':_0xdb2076[_0x0d29('0x26')],'owner_id':_0xdb2076['userId'],'created_at':_0x1412ab[_0x0d29('0x24')](_0x0d29('0x2d'))}},'json':!![]};_0x5212ff['headers']=_0x32fa27;logger[_0x0d29('0xd')](_0x0d29('0x2e'));return rp(_0x5212ff)[_0x0d29('0x1a')](function(_0x2ce651){_0xdb2076['endUserId']=_0x2ce651['contact']['id'];_0x5d698c(_0xdb2076);})[_0x0d29('0x15')](function(_0x49f7f6){logger[_0x0d29('0x16')]('['+[_0x43edf1['toUpperCase']()]+']',_0x49f7f6[_0x0d29('0x18')]);_0x4d1115(_0x49f7f6[_0x0d29('0x18')]);});});}function getTicket(_0x4875fd,_0x4636fc,_0x6eba4e,_0x477a04,_0x304a63){return function(_0x4be4c4){logger[_0x0d29('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x210b22,_0x39d736){var _0x47a4c5=moment();var _0x13479a={'method':_0x0d29('0x2b'),'uri':_0x6eba4e+_0x0d29('0x2f'),'body':{'title':intUtil['getString'](_0x477a04['Subjects'],_0x304a63,'\x20'),'description':intUtil[_0x0d29('0x30')](_0x477a04[_0x0d29('0x31')],_0x304a63,'\x0a'),'owner_id':_0x4be4c4[_0x0d29('0x1d')],'creater_id':_0x4be4c4[_0x0d29('0x12')],'targetable_id':_0x4be4c4[_0x0d29('0x28')],'targetable_type':_0x0d29('0x32'),'created_at':_0x47a4c5[_0x0d29('0x24')](_0x0d29('0x2d')),'due_date':_0x47a4c5['add'](0x1e,'m')[_0x0d29('0x24')](_0x0d29('0x2d'))},'json':!![]};_0x13479a[_0x0d29('0xc')]=_0x4636fc;return rp(_0x13479a)['then'](function(_0x5e9baa){_0x4be4c4[_0x0d29('0x33')]=_0x5e9baa[_0x0d29('0x34')]['id'];logger[_0x0d29('0xd')](_0x0d29('0x35'),_0x4be4c4['ticketId']);_0x210b22(_0x4be4c4);})['catch'](function(_0x57cc6f){logger[_0x0d29('0x16')]('['+[_0x4875fd[_0x0d29('0x17')]()]+']',_0x57cc6f[_0x0d29('0x18')]);_0x39d736(_0x57cc6f[_0x0d29('0x18')]);});});};}function emit(_0x4f9ef7,_0x5b53bf,_0x2c1cd4){var _0x5b7d29={'uri':_0x4f9ef7+_0x0d29('0x36')+_0x2c1cd4};io['to'](util[_0x0d29('0x24')](_0x0d29('0x37'),_0x5b53bf))[_0x0d29('0x38')](_0x0d29('0x39'),_0x5b7d29);}exports['cs']=function(_0x1381fd,_0x266374,_0x27f853,_0x168730,_0x1c59bc,_0x114d76,_0x467b58,_0x5281b4){var _0x6a15c3={};var _0x3e36f3={'Authorization':_0x0d29('0x3a')+_0x114d76[_0x0d29('0x3b')]};_0x114d76['remoteUri']=intUtil[_0x0d29('0x3c')](_0x114d76[_0x0d29('0x3d')]);_0x114d76[_0x0d29('0x3e')]=intUtil['stripTrailingSlash'](_0x114d76[_0x0d29('0x3e')]);var _0x5aa594=_0x114d76[_0x0d29('0x3d')];_0x6a15c3['adminEmail']=_0x114d76[_0x0d29('0x3f')];_0x6a15c3[_0x0d29('0x26')]=_0x5281b4[_0x0d29('0x40')]()===_0x0d29('0x41')?_0x266374[_0x0d29('0x42')]:_0x266374[_0x0d29('0x43')];_0x6a15c3[_0x0d29('0x44')]=_0x5281b4===_0x0d29('0x45')||_0x5281b4===_0x0d29('0x46')?'queue':_0x0d29('0x41');if(_0x168730){_0x6a15c3[_0x0d29('0x1b')]=_0x168730['email'];}var _0x26964e=util['format'](_0x0d29('0x47'),_0x114d76[_0x0d29('0x3e')],_0x266374[_0x0d29('0x48')],md5(_0x266374[_0x0d29('0x48')]));if(_0x1c59bc&&_0x1c59bc[_0x0d29('0x49')]){logger[_0x0d29('0xd')](_0x0d29('0x4a'),'Recording\x20is\x20enabled!');_0x266374[_0x0d29('0x4b')]=_0x26964e;}else if(_0x467b58&&_0x467b58[_0x0d29('0x4c')]&&_0x467b58[_0x0d29('0x4c')]!==_0x0d29('0x4d')){logger[_0x0d29('0xd')](_0x0d29('0x4e'),_0x0d29('0x4f'));_0x266374['recordingURL']=_0x26964e;}else{_0x266374[_0x0d29('0x4b')]='';}return getAdminId(_0x6a15c3,_0x5281b4,_0x3e36f3,_0x5aa594)[_0x0d29('0x1a')](getUser(_0x5281b4,_0x3e36f3,_0x5aa594))[_0x0d29('0x1a')](getEndUser(_0x5281b4,_0x3e36f3,_0x5aa594))[_0x0d29('0x1a')](getTicket(_0x5281b4,_0x3e36f3,_0x5aa594,_0x27f853,_0x266374))[_0x0d29('0x1a')](function(_0x18c97a){logger['info'](util[_0x0d29('0x24')](_0x0d29('0x50'),_0x18c97a[_0x0d29('0x33')]));if(_0x5281b4!==_0x0d29('0x46')){logger[_0x0d29('0xd')]('['+[_0x5281b4['toUpperCase']()]+']',_0x0d29('0x51'));emit(_0x5aa594,_0x168730['name'],_0x18c97a['endUserId']);}})[_0x0d29('0x15')](function(_0x219857){logger[_0x0d29('0x16')]('['+[_0x5281b4['toUpperCase']()]+_0x0d29('0x52'),util[_0x0d29('0x53')](_0x219857,{'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 f6d000b..edf536a 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 _0x6344=['./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','exec','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x6344,0x153));var _0x4634=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x6344[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x4634('0x0'));var util=require(_0x4634('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4634('0x2'));var sugarcrm=require(_0x4634('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x4634('0x4'));var desk=require(_0x4634('0x5'));var vtiger=require(_0x4634('0x6'));var servicenow=require(_0x4634('0x7'));var dynamics365=require(_0x4634('0x8'));var freshsales=require(_0x4634('0x9'));var integrations=[_0x4634('0xa'),'salesforce',_0x4634('0xb'),'freshdesk',_0x4634('0xc'),_0x4634('0xd'),_0x4634('0xe'),_0x4634('0xf'),_0x4634('0x10'),'servicenow'];exports[_0x4634('0x11')]=function(_0x73cc0d,_0x4ef7b7,_0x44649d,_0x261dd7,_0x43edf6,_0x110cb2){if(_0x44649d){if(_['includes'](integrations,_0x73cc0d[_0x4634('0x12')][_0x4634('0x13')]())){try{var _0x4a8a54=null;var _0xa9c9d3='';var _0x3e5aeb=_0x44649d[_0x73cc0d['data1'][_0x4634('0x13')]()];if(_0x3e5aeb){var _0x43c6e0=_0x3e5aeb[_0x73cc0d[_0x4634('0x14')]];if(_0x43c6e0){var _0x3f5071=_[_0x4634('0x15')](_0x43c6e0[_0x4634('0x16')],{'id':parseInt(_0x73cc0d['data3'],0xa)});if(_0x3f5071){if(_0x261dd7){if(_0x43edf6&&_0x4ef7b7[_0x4634('0x17')]){_0xa9c9d3='queue';}else if(_0x4ef7b7[_0x4634('0x18')]){_0xa9c9d3=_0x4634('0x19');}else{console[_0x4634('0x1a')](_0x4634('0x1b'),_0x4ef7b7);}}else{_0xa9c9d3=_0x4634('0x1c');}switch(_0x73cc0d[_0x4634('0x12')][_0x4634('0x13')]()){case _0x4634('0xa'):zendesk[_0xa9c9d3](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2);break;case'salesforce':salesforce[_0xa9c9d3](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2);break;case _0x4634('0xb'):sugarcrm[_0xa9c9d3](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2);break;case _0x4634('0x1d'):freshdesk[_0xa9c9d3](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2);break;case'zoho':zoho[_0xa9c9d3](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2);break;case _0x4634('0xd'):desk[_0xa9c9d3](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2);break;case _0x4634('0xe'):vtiger[_0xa9c9d3](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2);break;case _0x4634('0x10'):freshsales['cs'](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2,_0xa9c9d3);break;case _0x4634('0x1e'):servicenow['cs'](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2,_0xa9c9d3);break;case _0x4634('0xf'):dynamics365['cs'](_0x73cc0d,_0x4ef7b7,_0x3f5071,_0x261dd7,_0x43edf6,_0x43c6e0,_0x110cb2,_0xa9c9d3);break;default:console[_0x4634('0x1a')](_0x4634('0x1f'));}}else{_0x4a8a54=require(_0x4634('0x20'))(_0x73cc0d[_0x4634('0x12')][_0x4634('0x13')]());_0x4a8a54[_0x4634('0x21')](_0x4634('0x22'),util['format'](_0x4634('0x23'),_0x73cc0d[_0x4634('0x12')]['toLowerCase'](),_0x73cc0d['data3']));}}else{_0x4a8a54=require(_0x4634('0x20'))(_0x73cc0d['data1'][_0x4634('0x13')]());_0x4a8a54[_0x4634('0x21')](_0x4634('0x22'),util[_0x4634('0x24')](_0x4634('0x25'),_0x73cc0d['data1']['toLowerCase'](),_0x73cc0d[_0x4634('0x14')]));}}else{}}catch(_0x4072a4){console[_0x4634('0x21')](_0x4072a4);}}}}; \ No newline at end of file +var _0xeede=['%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error'];(function(_0x2f4ad9,_0x14ba33){var _0x3c7827=function(_0x20abd7){while(--_0x20abd7){_0x2f4ad9['push'](_0x2f4ad9['shift']());}};_0x3c7827(++_0x14ba33);}(_0xeede,0x131));var _0xeeed=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0xeede[_0x44afa4];return _0xcad289;};'use strict';var _=require('lodash');var util=require(_0xeeed('0x0'));var zendesk=require(_0xeeed('0x1'));var salesforce=require(_0xeeed('0x2'));var sugarcrm=require(_0xeeed('0x3'));var freshdesk=require(_0xeeed('0x4'));var zoho=require(_0xeeed('0x5'));var desk=require(_0xeeed('0x6'));var vtiger=require(_0xeeed('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xeeed('0x8'));var freshsales=require(_0xeeed('0x9'));var integrations=[_0xeeed('0xa'),_0xeeed('0xb'),_0xeeed('0xc'),_0xeeed('0xd'),_0xeeed('0xe'),_0xeeed('0xf'),_0xeeed('0x10'),_0xeeed('0x11'),_0xeeed('0x12'),_0xeeed('0x13')];exports[_0xeeed('0x14')]=function(_0x2c5c66,_0x427b8d,_0x5e7b18,_0x273976,_0x5815f3,_0x3f6622){if(_0x5e7b18){if(_['includes'](integrations,_0x2c5c66[_0xeeed('0x15')]['toLowerCase']())){try{var _0x2e247f=null;var _0x37ca5b='';var _0xa2f8de=_0x5e7b18[_0x2c5c66[_0xeeed('0x15')][_0xeeed('0x16')]()];if(_0xa2f8de){var _0x59aa8a=_0xa2f8de[_0x2c5c66[_0xeeed('0x17')]];if(_0x59aa8a){var _0x222fcf=_[_0xeeed('0x18')](_0x59aa8a[_0xeeed('0x19')],{'id':parseInt(_0x2c5c66[_0xeeed('0x1a')],0xa)});if(_0x222fcf){if(_0x273976){if(_0x5815f3&&_0x427b8d[_0xeeed('0x1b')]){_0x37ca5b=_0xeeed('0x1b');}else if(_0x427b8d['routeId']){_0x37ca5b=_0xeeed('0x1c');}else{console[_0xeeed('0x1d')](_0xeeed('0x1e'),_0x427b8d);}}else{_0x37ca5b='unmanaged';}switch(_0x2c5c66[_0xeeed('0x15')][_0xeeed('0x16')]()){case _0xeeed('0xa'):zendesk[_0x37ca5b](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622);break;case _0xeeed('0xb'):salesforce[_0x37ca5b](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622);break;case _0xeeed('0xc'):sugarcrm[_0x37ca5b](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622);break;case _0xeeed('0xd'):freshdesk[_0x37ca5b](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622);break;case _0xeeed('0xe'):zoho[_0x37ca5b](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622);break;case _0xeeed('0xf'):desk[_0x37ca5b](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622);break;case _0xeeed('0x10'):vtiger[_0x37ca5b](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622);break;case _0xeeed('0x12'):freshsales['cs'](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622,_0x37ca5b);break;case'servicenow':servicenow['cs'](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622,_0x37ca5b);break;case _0xeeed('0x11'):dynamics365['cs'](_0x2c5c66,_0x427b8d,_0x222fcf,_0x273976,_0x5815f3,_0x59aa8a,_0x3f6622,_0x37ca5b);break;default:console[_0xeeed('0x1d')](_0xeeed('0x1f'));}}else{_0x2e247f=require(_0xeeed('0x20'))(_0x2c5c66[_0xeeed('0x15')][_0xeeed('0x16')]());_0x2e247f['error'](_0xeeed('0x21'),util[_0xeeed('0x22')](_0xeeed('0x23'),_0x2c5c66[_0xeeed('0x15')]['toLowerCase'](),_0x2c5c66['data3']));}}else{_0x2e247f=require(_0xeeed('0x20'))(_0x2c5c66[_0xeeed('0x15')]['toLowerCase']());_0x2e247f[_0xeeed('0x24')](_0xeeed('0x21'),util[_0xeeed('0x22')](_0xeeed('0x25'),_0x2c5c66[_0xeeed('0x15')][_0xeeed('0x16')](),_0x2c5c66['data2']));}}else{}}catch(_0x3c4a87){console[_0xeeed('0x24')](_0x3c4a87);}}}}; \ 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 732266e..91d6c4d 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 _0xd0c6=['Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','Lead','account_contact_lead','Account','additionalSearchAccount','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','forEach','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','email','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','endUserType','lead','account','WhatId','Case','contact','ContactId','AccountId','leadId','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd0c6,0xe1));var _0x6d0c=function(_0x56ebd7,_0x1fdcd3){_0x56ebd7=_0x56ebd7-0x0;var _0x35f1bd=_0xd0c6[_0x56ebd7];return _0x35f1bd;};'use strict';var _=require(_0x6d0c('0x0'));var rp=require(_0x6d0c('0x1'));var moment=require(_0x6d0c('0x2'));var BPromise=require(_0x6d0c('0x3'));var md5=require('md5');var jsforce=require(_0x6d0c('0x4'));var util=require(_0x6d0c('0x5'));var Redis=require(_0x6d0c('0x6'));var intUtil=require(_0x6d0c('0x7'));var config=require(_0x6d0c('0x8'));var logger=require(_0x6d0c('0x9'))(_0x6d0c('0xa'));config[_0x6d0c('0xb')]=_[_0x6d0c('0xc')](config[_0x6d0c('0xb')],{'host':_0x6d0c('0xd'),'port':0x18eb});var io=require(_0x6d0c('0xe'))(new Redis(config[_0x6d0c('0xb')]));function emit(_0x2776bd,_0x242785,_0x2fbc63){io['to'](_0x2776bd)['emit'](_0x242785,_0x2fbc63);}function getTicket(_0x18b2cf,_0x301ac9,_0x438d1c,_0x23a1cb,_0x5d359e,_0x2c1744,_0x3ccd2f,_0x16f900){var _0x47ae85=Object['assign']({},{'OwnerId':_0x301ac9['id'],'Subject':intUtil[_0x6d0c('0xf')](_0x23a1cb[_0x6d0c('0x10')],_0x5d359e,'\x20'),'Description':intUtil[_0x6d0c('0xf')](_0x23a1cb[_0x6d0c('0x11')],_0x5d359e,'\x0a')},getCustomFields(_0x2c1744,_0x5d359e));if(_0x438d1c){if(_0x23a1cb[_0x6d0c('0x12')]==='Task'){_0x47ae85[_0x6d0c('0x13')]=moment[_0x6d0c('0x14')]();_0x47ae85['IsReminderSet']=![];_0x47ae85['IsRecurrence']=![];if(_0x438d1c[_0x6d0c('0x15')]==='contact'||_0x438d1c['endUserType']===_0x6d0c('0x16')){_0x47ae85['WhoId']=_0x438d1c['id'];}else if(_0x438d1c['endUserType']===_0x6d0c('0x17')){_0x47ae85[_0x6d0c('0x18')]=_0x438d1c['id'];}}else if(_0x23a1cb[_0x6d0c('0x12')]===_0x6d0c('0x19')){if(_0x438d1c[_0x6d0c('0x15')]===_0x6d0c('0x1a')){_0x47ae85[_0x6d0c('0x1b')]=_0x438d1c['id'];}else if(_0x438d1c[_0x6d0c('0x15')]===_0x6d0c('0x17')){_0x47ae85[_0x6d0c('0x1c')]=_0x438d1c['id'];}else if(_0x438d1c[_0x6d0c('0x15')]===_0x6d0c('0x16')&&_0x23a1cb[_0x6d0c('0x1d')]){_0x47ae85[_0x23a1cb[_0x6d0c('0x1d')]]=_0x438d1c['id'];}else{logger[_0x6d0c('0x1e')](_0x6d0c('0x1f'));}}}return _0x3ccd2f[_0x6d0c('0x20')](_0x23a1cb['ticketType'])[_0x6d0c('0x21')](_0x47ae85);}function getUser(_0x4c6e7f,_0x38ea7a,_0x9a1c74){if(!_[_0x6d0c('0x22')](_0x38ea7a)&&intUtil[_0x6d0c('0x23')](_0x38ea7a)){var _0x4a49c1={'Email':_0x38ea7a};var _0x522037={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x9a1c74[_0x6d0c('0x20')](_0x6d0c('0x24'))[_0x6d0c('0x25')](_0x4a49c1,_0x522037)[_0x6d0c('0x26')]()[_0x6d0c('0x27')](function(_0x19ba54){if(_0x19ba54[_0x6d0c('0x28')]){var _0x52a1b8=_[_0x6d0c('0x25')](_0x19ba54,function(_0x34cfd4){return _0x34cfd4['Email']===_0x38ea7a;});if(_0x52a1b8){logger[_0x6d0c('0x1e')]('Agent\x20%s\x20found.',_0x38ea7a);return BPromise[_0x6d0c('0x29')]({'id':_0x52a1b8['Id'],'name':_0x52a1b8['Name']});}}else{logger['info'](_0x6d0c('0x2a'),_0x38ea7a);return _0x9a1c74['identity']()['then'](function(_0xffcbf){return BPromise[_0x6d0c('0x29')]({'id':_0xffcbf[_0x6d0c('0x2b')],'name':_0xffcbf[_0x6d0c('0x2c')]});});}});}else{logger['info'](_0x6d0c('0x2a'),_0x38ea7a);return _0x9a1c74['identity']()[_0x6d0c('0x27')](function(_0x13e41b){return BPromise[_0x6d0c('0x29')]({'id':_0x13e41b[_0x6d0c('0x2b')],'name':_0x13e41b[_0x6d0c('0x2c')]});});}}function getEndUser(_0x365830,_0x547838,_0x28fcc4,_0x2c46e8,_0x2f1fcf){var _0xea4f34={'$or':{'Phone':_0x2c46e8}};var _0x23f8ff={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x6d0c('0x27')](function(){logger[_0x6d0c('0x1e')](_0x6d0c('0x2d'),_0x2c46e8,_0x547838['moduleSearch']);switch(_0x547838[_0x6d0c('0x2e')]){case _0x6d0c('0x2f'):var _0x1e5bd6=_[_0x6d0c('0x30')](_0xea4f34);if(_0x547838[_0x6d0c('0x31')]){var _0x5ba5a6={};_0x5ba5a6[_0x547838['additionalSearchContact']]=_0x2c46e8;_['merge'](_0x1e5bd6['$or'],_0x5ba5a6);}return _0x2f1fcf[_0x6d0c('0x20')](_0x6d0c('0x32'))['find'](_0x1e5bd6,_0x23f8ff)[_0x6d0c('0x26')]()[_0x6d0c('0x27')](function(_0x4f043c){if(_0x4f043c&&_0x4f043c[_0x6d0c('0x28')]){return _0x4f043c;}else{var _0x34d4d9=_['cloneDeep'](_0xea4f34);if(_0x547838[_0x6d0c('0x33')]){var _0x183b25={};_0x183b25[_0x547838['additionalSearchLead']]=_0x2c46e8;_[_0x6d0c('0x34')](_0x34d4d9[_0x6d0c('0x35')],_0x183b25);}return _0x2f1fcf[_0x6d0c('0x20')](_0x6d0c('0x36'))[_0x6d0c('0x25')](_0x34d4d9,_0x23f8ff);}});case _0x6d0c('0x37'):var _0x4f6994=_['cloneDeep'](_0xea4f34);if(_0x547838['additionalSearchAccount']){var _0x5ba5a6={};_0x5ba5a6[_0x547838['additionalSearchAccount']]=_0x2c46e8;_[_0x6d0c('0x34')](_0x4f6994[_0x6d0c('0x35')],_0x5ba5a6);}return _0x2f1fcf['sobject'](_0x6d0c('0x38'))['find'](_0x4f6994,_0x23f8ff)[_0x6d0c('0x26')]()[_0x6d0c('0x27')](function(_0x5c1326){if(_0x5c1326&&_0x5c1326[_0x6d0c('0x28')]){return _0x5c1326;}else{var _0x2a1589=_[_0x6d0c('0x30')](_0xea4f34);if(_0x547838[_0x6d0c('0x31')]){var _0x564829={};_0x564829[_0x547838['additionalSearchContact']]=_0x2c46e8;_[_0x6d0c('0x34')](_0x2a1589[_0x6d0c('0x35')],_0x564829);}return _0x2f1fcf['sobject'](_0x6d0c('0x32'))[_0x6d0c('0x25')](_0x2a1589,_0x23f8ff)[_0x6d0c('0x27')](function(_0x40268d){if(_0x40268d&&_0x40268d[_0x6d0c('0x28')]){return _0x40268d;}else{var _0x2a744d=_[_0x6d0c('0x30')](_0xea4f34);if(_0x547838[_0x6d0c('0x33')]){var _0x51bf52={};_0x51bf52[_0x547838[_0x6d0c('0x33')]]=_0x2c46e8;_['merge'](_0x2a744d[_0x6d0c('0x35')],_0x51bf52);}return _0x2f1fcf['sobject']('Lead')[_0x6d0c('0x25')](_0x2a744d,_0x23f8ff);}});}});case _0x6d0c('0x1a'):var _0x1e5bd6=_[_0x6d0c('0x30')](_0xea4f34);if(_0x547838['additionalSearchContact']){var _0x5ba5a6={};_0x5ba5a6[_0x547838[_0x6d0c('0x31')]]=_0x2c46e8;_[_0x6d0c('0x34')](_0x1e5bd6[_0x6d0c('0x35')],_0x5ba5a6);}return _0x2f1fcf[_0x6d0c('0x20')]('Contact')['find'](_0x1e5bd6,_0x23f8ff)['execute']();case'lead':var _0x28b0d6=_[_0x6d0c('0x30')](_0xea4f34);if(_0x547838['additionalSearchLead']){var _0x5ba5a6={};_0x5ba5a6[_0x547838[_0x6d0c('0x33')]]=_0x2c46e8;_[_0x6d0c('0x34')](_0x28b0d6['$or'],_0x5ba5a6);}return _0x2f1fcf[_0x6d0c('0x20')](_0x6d0c('0x36'))[_0x6d0c('0x25')](_0x28b0d6,_0x23f8ff);case _0x6d0c('0x17'):var _0x4f6994=_[_0x6d0c('0x30')](_0xea4f34);if(_0x547838[_0x6d0c('0x39')]){var _0x5ba5a6={};_0x5ba5a6[_0x547838[_0x6d0c('0x39')]]=_0x2c46e8;_[_0x6d0c('0x34')](_0x4f6994[_0x6d0c('0x35')],_0x5ba5a6);}return _0x2f1fcf[_0x6d0c('0x20')](_0x6d0c('0x38'))['find'](_0x4f6994,_0x23f8ff);default:return null;}})[_0x6d0c('0x27')](function(_0x3f57fa){if(_0x3f57fa&&_0x3f57fa[_0x6d0c('0x28')]){var _0x537f81=_[_0x6d0c('0x3a')](_0x3f57fa);if(_0x537f81){return BPromise[_0x6d0c('0x29')]({'id':_0x537f81['Id'],'name':_0x537f81[_0x6d0c('0x3b')],'phone':_0x537f81[_0x6d0c('0x3c')],'endUserType':_0x537f81[_0x6d0c('0x3d')][_0x6d0c('0x3e')][_0x6d0c('0x3f')]()});}}})[_0x6d0c('0x27')](function(_0x4ded85){if(_0x4ded85){logger[_0x6d0c('0x1e')](_0x6d0c('0x40'),_0x4ded85[_0x6d0c('0x15')],_0x2c46e8);return BPromise['resolve'](_0x4ded85);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2c46e8);var _0x4556de={'Phone':_0x2c46e8};if(_0x547838['moduleCreate']){if(_0x547838[_0x6d0c('0x41')]==='contact'){logger['info'](_0x6d0c('0x42'),_0x2c46e8,_0x547838[_0x6d0c('0x41')]);_0x4556de['LastName']=_0x28fcc4!==_0x6d0c('0x43')?_0x28fcc4:util[_0x6d0c('0x44')](_0x6d0c('0x45'),_0x2c46e8);}else if(_0x547838[_0x6d0c('0x41')]===_0x6d0c('0x16')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2c46e8,_0x547838[_0x6d0c('0x41')]);_0x4556de['LastName']=_0x28fcc4!==_0x6d0c('0x43')?_0x28fcc4:util[_0x6d0c('0x44')](_0x6d0c('0x45'),_0x2c46e8);_0x4556de[_0x6d0c('0x46')]='No\x20Company';}else if(_0x547838[_0x6d0c('0x41')]===_0x6d0c('0x17')){logger[_0x6d0c('0x1e')](_0x6d0c('0x42'),_0x2c46e8,_0x547838[_0x6d0c('0x41')]);_0x4556de[_0x6d0c('0x3b')]=_0x28fcc4!==_0x6d0c('0x43')?_0x28fcc4:util['format'](_0x6d0c('0x45'),_0x2c46e8);}else{return null;}}return _0x2f1fcf['sobject'](_['upperFirst'](_0x547838[_0x6d0c('0x41')]))['create'](_0x4556de)[_0x6d0c('0x27')](function(_0x244aa0){return BPromise[_0x6d0c('0x29')]({'id':_0x244aa0['id'],'endUserType':_0x547838[_0x6d0c('0x41')]});});}});}function getCustomFields(_0x2c6c53,_0x3f0454){var _0x4cf614={};if(_0x2c6c53[_0x6d0c('0x28')]>0x0){_[_0x6d0c('0x47')](_0x2c6c53,function(_0x4aa136){if(_['includes']([_0x6d0c('0x48'),_0x6d0c('0x49')],_0x4aa136[_0x6d0c('0x3e')])&&_0x4aa136[_0x6d0c('0x4a')]){_0x4cf614[_0x4aa136[_0x6d0c('0x4a')]]=_0x4aa136[_0x6d0c('0x4b')]['toString']();}else if(_0x4aa136[_0x6d0c('0x3e')]===_0x6d0c('0x4c')&&_0x4aa136[_0x6d0c('0x4d')]&&_0x4aa136[_0x6d0c('0x4a')]){_0x3f0454[_0x4aa136['variableName']]&&(_0x4cf614[_0x4aa136['idField']]=_0x3f0454[_0x4aa136[_0x6d0c('0x4d')]][_0x6d0c('0x4e')]());}else if(_0x4aa136[_0x6d0c('0x3e')]===_0x6d0c('0x4f')&&_0x4aa136[_0x6d0c('0x50')]&&_0x4aa136[_0x6d0c('0x50')][_0x6d0c('0x51')]&&_0x4aa136['idField']){_0x3f0454[_0x4aa136[_0x6d0c('0x50')][_0x6d0c('0x51')][_0x6d0c('0x3f')]()]&&(_0x4cf614[_0x4aa136[_0x6d0c('0x4a')]]=_0x3f0454[_0x4aa136[_0x6d0c('0x50')][_0x6d0c('0x51')][_0x6d0c('0x3f')]()]['toString']());}});}return _0x4cf614;}function getConnection(_0x276a88){var _0x29e8d4=_0x276a88['password'][_0x6d0c('0x52')](_0x276a88[_0x6d0c('0x53')]);var _0x43870f=new jsforce[(_0x6d0c('0x54'))]({'oauth2':{'loginUrl':_0x276a88['remoteUri']||_0x6d0c('0x55'),'clientId':_0x276a88[_0x6d0c('0x56')],'clientSecret':_0x276a88[_0x6d0c('0x57')]}});return _0x43870f[_0x6d0c('0x58')](_0x276a88[_0x6d0c('0x59')],_0x29e8d4)['then'](function(){logger[_0x6d0c('0x1e')](_0x6d0c('0x5a'));return _0x43870f;});}exports[_0x6d0c('0x5b')]=function(_0x29d302,_0x3270da,_0xe5ad50,_0x103129,_0x46a2ef,_0x20f57a){var _0x74cbd1,_0xcc844e,_0x157a9a,_0x2eed07;_0x20f57a[_0x6d0c('0x5c')]=intUtil['stripTrailingSlash'](_0x20f57a[_0x6d0c('0x5c')]);_0x20f57a[_0x6d0c('0x5d')]=intUtil['stripTrailingSlash'](_0x20f57a[_0x6d0c('0x5d')]);if(_0x46a2ef&&_0x46a2ef[_0x6d0c('0x5e')]){logger[_0x6d0c('0x1e')](_0x6d0c('0x5f'),_0x6d0c('0x60'));_0x3270da[_0x6d0c('0x61')]=util[_0x6d0c('0x44')](_0x6d0c('0x62'),_0x20f57a['serverUrl'],_0x3270da[_0x6d0c('0x63')],md5(_0x3270da['uniqueid']));}else{_0x3270da['recordingURL']='';}return getConnection(_0x20f57a)['then'](function(_0x293d73){_0x2eed07=_0x293d73;return getUser(_0x20f57a,_0x103129['email'],_0x2eed07);})[_0x6d0c('0x27')](function(_0x2f249c){_0x74cbd1=_0x2f249c;return getEndUser(_0x20f57a,_0xe5ad50,_0x3270da['calleridname'],_0x3270da[_0x6d0c('0x64')],_0x2eed07);})[_0x6d0c('0x27')](function(_0x4a36cb){_0xcc844e=_0x4a36cb;return getTicket(_0x20f57a,_0x74cbd1,_0xcc844e,_0xe5ad50,_0x3270da,_0xe5ad50[_0x6d0c('0x65')],_0x2eed07,_0x6d0c('0x5b'));})[_0x6d0c('0x27')](function(_0x3ead88){_0x157a9a=_0x3ead88;logger[_0x6d0c('0x1e')](_0x6d0c('0x66'),_0x157a9a['id']);logger[_0x6d0c('0x1e')](_0x6d0c('0x67'),_0x157a9a['id'],_0x103129[_0x6d0c('0x51')],_0x20f57a[_0x6d0c('0x3e')]);switch(_0x20f57a[_0x6d0c('0x3e')]){case _0x6d0c('0x68'):emit(util['format'](_0x6d0c('0x69'),_0x103129[_0x6d0c('0x51')]),'trigger:salesforce:display',{'recordId':_0x157a9a['id']});break;case _0x6d0c('0x6a'):emit(util[_0x6d0c('0x44')](_0x6d0c('0x69'),_0x103129[_0x6d0c('0x51')]),'trigger:browser:url',{'uri':util[_0x6d0c('0x44')](_0x6d0c('0x6b'),_0x2eed07[_0x6d0c('0x6c')],_0x157a9a['id'])});break;default:logger[_0x6d0c('0x6d')](_0x6d0c('0x6e'));}})[_0x6d0c('0x6f')](function(_0x25b9cc){logger[_0x6d0c('0x6d')](_0x6d0c('0x5f'),_0x25b9cc);});};exports[_0x6d0c('0x70')]=function(_0x5679d2,_0x40a752,_0x19f5bc,_0x1f1479,_0x4ee1c4,_0xb1537a,_0x215d2b){var _0x24ce6b,_0xac4e6,_0x5218ed,_0x425afd;_0xb1537a[_0x6d0c('0x5c')]=intUtil[_0x6d0c('0x71')](_0xb1537a['serverUrl']);_0xb1537a['remoteUri']=intUtil['stripTrailingSlash'](_0xb1537a[_0x6d0c('0x5d')]);if(_0x215d2b&&_0x215d2b[_0x6d0c('0x72')]&&_0x215d2b[_0x6d0c('0x72')]!=='none'){logger[_0x6d0c('0x1e')](_0x6d0c('0x73'),'Recording\x20is\x20enabled!');_0x40a752[_0x6d0c('0x61')]=util[_0x6d0c('0x44')](_0x6d0c('0x62'),_0xb1537a[_0x6d0c('0x5c')],_0x40a752[_0x6d0c('0x63')],md5(_0x40a752[_0x6d0c('0x63')]));}return getConnection(_0xb1537a)[_0x6d0c('0x27')](function(_0xcaa776){_0x425afd=_0xcaa776;return getUser(_0xb1537a,_0x1f1479[_0x6d0c('0x74')],_0x425afd);})[_0x6d0c('0x27')](function(_0x47c189){_0x24ce6b=_0x47c189;return getEndUser(_0xb1537a,_0x19f5bc,_0x40a752['destcalleridname'],_0x40a752[_0x6d0c('0x75')],_0x425afd);})['then'](function(_0x5bc17b){_0xac4e6=_0x5bc17b;return getTicket(_0xb1537a,_0x24ce6b,_0xac4e6,_0x19f5bc,_0x40a752,_0x19f5bc[_0x6d0c('0x65')],_0x425afd,_0x6d0c('0x70'));})[_0x6d0c('0x27')](function(_0x5e197c){_0x5218ed=_0x5e197c;logger[_0x6d0c('0x1e')](_0x6d0c('0x76'),_0x5218ed['id']);logger['info'](_0x6d0c('0x77'),_0x5218ed['id'],_0x1f1479[_0x6d0c('0x51')],_0xb1537a['type']);switch(_0xb1537a[_0x6d0c('0x3e')]){case _0x6d0c('0x68'):emit(util[_0x6d0c('0x44')]('user:%s',_0x1f1479[_0x6d0c('0x51')]),_0x6d0c('0x78'),{'recordId':_0x5218ed['id']});break;case _0x6d0c('0x6a'):emit(util[_0x6d0c('0x44')]('user:%s',_0x1f1479[_0x6d0c('0x51')]),_0x6d0c('0x79'),{'uri':util[_0x6d0c('0x44')](_0x6d0c('0x6b'),_0x425afd[_0x6d0c('0x6c')],_0x5218ed['id'])});break;default:logger[_0x6d0c('0x6d')](_0x6d0c('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x6d0c('0x6f')](function(_0x12c415){logger[_0x6d0c('0x6d')](_0x6d0c('0x73'),_0x12c415);});};exports[_0x6d0c('0x7a')]=function(_0x316e4c,_0x56cb42,_0x34275a,_0x55a00b,_0x357251,_0x4af0b0){var _0x513739,_0x3977af,_0x53e2d7,_0x25bfdf;_0x4af0b0[_0x6d0c('0x5c')]=intUtil[_0x6d0c('0x71')](_0x4af0b0['serverUrl']);_0x4af0b0[_0x6d0c('0x5d')]=intUtil[_0x6d0c('0x71')](_0x4af0b0[_0x6d0c('0x5d')]);if(_0x357251&&_0x357251[_0x6d0c('0x5e')]){logger[_0x6d0c('0x1e')]('['+_0x56cb42[_0x6d0c('0x7b')][_0x6d0c('0x7c')]()+']',_0x6d0c('0x60'));_0x56cb42['recordingURL']=util['format'](_0x6d0c('0x62'),_0x4af0b0[_0x6d0c('0x5c')],_0x56cb42['uniqueid'],md5(_0x56cb42[_0x6d0c('0x63')]));}else{_0x56cb42['recordingURL']='';}return getConnection(_0x4af0b0)[_0x6d0c('0x27')](function(_0x3f4702){_0x25bfdf=_0x3f4702;if(!_[_0x6d0c('0x22')](_0x55a00b)){return getUser(_0x4af0b0,_0x55a00b[_0x6d0c('0x51')],_0x25bfdf);}else{return getUser(_0x4af0b0,null,_0x25bfdf);}})[_0x6d0c('0x27')](function(_0x4ac6e7){_0x513739=_0x4ac6e7;return getEndUser(_0x4af0b0,_0x34275a,_0x56cb42[_0x6d0c('0x7d')],_0x56cb42[_0x6d0c('0x64')],_0x25bfdf);})['then'](function(_0x438a84){_0x3977af=_0x438a84;return getTicket(_0x4af0b0,_0x513739,_0x3977af,_0x34275a,_0x56cb42,_0x34275a[_0x6d0c('0x65')],_0x25bfdf);})[_0x6d0c('0x27')](function(_0x959089){_0x53e2d7=_0x959089;logger[_0x6d0c('0x1e')]('['+_0x56cb42['lastevent'][_0x6d0c('0x7c')]()+_0x6d0c('0x7e'),_0x53e2d7['id']);logger[_0x6d0c('0x1e')]('['+_0x56cb42[_0x6d0c('0x7b')][_0x6d0c('0x7c')]()+_0x6d0c('0x7f'),_0x4af0b0[_0x6d0c('0x3e')]);})['catch'](function(_0x341d96){logger[_0x6d0c('0x6d')]('['+_0x56cb42[_0x6d0c('0x7b')][_0x6d0c('0x7c')]()+']',_0x341d96);});}; \ No newline at end of file +var _0xd016=['defaults','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','length','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','contact','first','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','picklist','type','content','toString','variable','variableName','idField','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','redis'];(function(_0x50a448,_0x3d1a4d){var _0x5da8c6=function(_0x3310a6){while(--_0x3310a6){_0x50a448['push'](_0x50a448['shift']());}};_0x5da8c6(++_0x3d1a4d);}(_0xd016,0x1ef));var _0x6d01=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0xd016[_0x2b0875];return _0xedb8d7;};'use strict';var _=require('lodash');var rp=require(_0x6d01('0x0'));var moment=require(_0x6d01('0x1'));var BPromise=require(_0x6d01('0x2'));var md5=require(_0x6d01('0x3'));var jsforce=require(_0x6d01('0x4'));var util=require('util');var Redis=require(_0x6d01('0x5'));var intUtil=require(_0x6d01('0x6'));var config=require(_0x6d01('0x7'));var logger=require('../../../../config/logger')('salesforce');config[_0x6d01('0x8')]=_[_0x6d01('0x9')](config[_0x6d01('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6d01('0xa'))(new Redis(config['redis']));function emit(_0x184c5b,_0x2cc09a,_0x188cd4){io['to'](_0x184c5b)[_0x6d01('0xb')](_0x2cc09a,_0x188cd4);}function getTicket(_0x477bbc,_0x6f20a8,_0x172699,_0x3ff6e9,_0x2ffca6,_0x3f6736,_0x2e08aa,_0xc0795){var _0x269234=Object[_0x6d01('0xc')]({},{'OwnerId':_0x6f20a8['id'],'Subject':intUtil['getString'](_0x3ff6e9[_0x6d01('0xd')],_0x2ffca6,'\x20'),'Description':intUtil[_0x6d01('0xe')](_0x3ff6e9[_0x6d01('0xf')],_0x2ffca6,'\x0a')},getCustomFields(_0x3f6736,_0x2ffca6));if(_0x172699){if(_0x3ff6e9[_0x6d01('0x10')]==='Task'){_0x269234[_0x6d01('0x11')]=moment[_0x6d01('0x12')]();_0x269234[_0x6d01('0x13')]=![];_0x269234[_0x6d01('0x14')]=![];if(_0x172699['endUserType']==='contact'||_0x172699[_0x6d01('0x15')]===_0x6d01('0x16')){_0x269234['WhoId']=_0x172699['id'];}else if(_0x172699['endUserType']===_0x6d01('0x17')){_0x269234['WhatId']=_0x172699['id'];}}else if(_0x3ff6e9[_0x6d01('0x10')]===_0x6d01('0x18')){if(_0x172699['endUserType']==='contact'){_0x269234[_0x6d01('0x19')]=_0x172699['id'];}else if(_0x172699[_0x6d01('0x15')]===_0x6d01('0x17')){_0x269234[_0x6d01('0x1a')]=_0x172699['id'];}else if(_0x172699[_0x6d01('0x15')]===_0x6d01('0x16')&&_0x3ff6e9[_0x6d01('0x1b')]){_0x269234[_0x3ff6e9['leadId']]=_0x172699['id'];}else{logger[_0x6d01('0x1c')](_0x6d01('0x1d'));}}}return _0x2e08aa[_0x6d01('0x1e')](_0x3ff6e9['ticketType'])[_0x6d01('0x1f')](_0x269234);}function getUser(_0x1cc0c2,_0x1da881,_0x4faf1c){if(!_[_0x6d01('0x20')](_0x1da881)&&intUtil['validateEmail'](_0x1da881)){var _0x2ff306={'Email':_0x1da881};var _0x15dfd6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4faf1c[_0x6d01('0x1e')](_0x6d01('0x21'))['find'](_0x2ff306,_0x15dfd6)['execute']()['then'](function(_0x3498c){if(_0x3498c[_0x6d01('0x22')]){var _0x39af05=_[_0x6d01('0x23')](_0x3498c,function(_0xaa460b){return _0xaa460b[_0x6d01('0x24')]===_0x1da881;});if(_0x39af05){logger[_0x6d01('0x1c')](_0x6d01('0x25'),_0x1da881);return BPromise[_0x6d01('0x26')]({'id':_0x39af05['Id'],'name':_0x39af05[_0x6d01('0x27')]});}}else{logger[_0x6d01('0x1c')](_0x6d01('0x28'),_0x1da881);return _0x4faf1c[_0x6d01('0x29')]()[_0x6d01('0x2a')](function(_0x5b014d){return BPromise[_0x6d01('0x26')]({'id':_0x5b014d[_0x6d01('0x2b')],'name':_0x5b014d[_0x6d01('0x2c')]});});}});}else{logger[_0x6d01('0x1c')](_0x6d01('0x28'),_0x1da881);return _0x4faf1c[_0x6d01('0x29')]()[_0x6d01('0x2a')](function(_0x1862d1){return BPromise[_0x6d01('0x26')]({'id':_0x1862d1[_0x6d01('0x2b')],'name':_0x1862d1['display_name']});});}}function getEndUser(_0x422e86,_0x5889b8,_0x5de94d,_0x521862,_0x229557){var _0x299a7a={'$or':{'Phone':_0x521862}};var _0x54cf82={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6d01('0x26')]()[_0x6d01('0x2a')](function(){logger[_0x6d01('0x1c')](_0x6d01('0x2d'),_0x521862,_0x5889b8[_0x6d01('0x2e')]);switch(_0x5889b8['moduleSearch']){case'contact_lead':var _0x2b5293=_[_0x6d01('0x2f')](_0x299a7a);if(_0x5889b8[_0x6d01('0x30')]){var _0x9a7a1a={};_0x9a7a1a[_0x5889b8[_0x6d01('0x30')]]=_0x521862;_['merge'](_0x2b5293[_0x6d01('0x31')],_0x9a7a1a);}return _0x229557[_0x6d01('0x1e')](_0x6d01('0x32'))['find'](_0x2b5293,_0x54cf82)[_0x6d01('0x33')]()[_0x6d01('0x2a')](function(_0x21e47a){if(_0x21e47a&&_0x21e47a[_0x6d01('0x22')]){return _0x21e47a;}else{var _0x3104f4=_[_0x6d01('0x2f')](_0x299a7a);if(_0x5889b8[_0x6d01('0x34')]){var _0x1840ca={};_0x1840ca[_0x5889b8[_0x6d01('0x34')]]=_0x521862;_[_0x6d01('0x35')](_0x3104f4[_0x6d01('0x31')],_0x1840ca);}return _0x229557[_0x6d01('0x1e')](_0x6d01('0x36'))['find'](_0x3104f4,_0x54cf82);}});case'account_contact_lead':var _0x218e1a=_['cloneDeep'](_0x299a7a);if(_0x5889b8[_0x6d01('0x37')]){var _0x9a7a1a={};_0x9a7a1a[_0x5889b8[_0x6d01('0x37')]]=_0x521862;_[_0x6d01('0x35')](_0x218e1a[_0x6d01('0x31')],_0x9a7a1a);}return _0x229557[_0x6d01('0x1e')](_0x6d01('0x38'))[_0x6d01('0x23')](_0x218e1a,_0x54cf82)[_0x6d01('0x33')]()[_0x6d01('0x2a')](function(_0x34953e){if(_0x34953e&&_0x34953e[_0x6d01('0x22')]){return _0x34953e;}else{var _0x108b0d=_[_0x6d01('0x2f')](_0x299a7a);if(_0x5889b8[_0x6d01('0x30')]){var _0xe136cd={};_0xe136cd[_0x5889b8['additionalSearchContact']]=_0x521862;_['merge'](_0x108b0d['$or'],_0xe136cd);}return _0x229557[_0x6d01('0x1e')](_0x6d01('0x32'))['find'](_0x108b0d,_0x54cf82)[_0x6d01('0x2a')](function(_0x1dcce1){if(_0x1dcce1&&_0x1dcce1['length']){return _0x1dcce1;}else{var _0x1d85e7=_[_0x6d01('0x2f')](_0x299a7a);if(_0x5889b8['additionalSearchLead']){var _0x3a2e88={};_0x3a2e88[_0x5889b8['additionalSearchLead']]=_0x521862;_[_0x6d01('0x35')](_0x1d85e7[_0x6d01('0x31')],_0x3a2e88);}return _0x229557[_0x6d01('0x1e')](_0x6d01('0x36'))[_0x6d01('0x23')](_0x1d85e7,_0x54cf82);}});}});case _0x6d01('0x39'):var _0x2b5293=_[_0x6d01('0x2f')](_0x299a7a);if(_0x5889b8[_0x6d01('0x30')]){var _0x9a7a1a={};_0x9a7a1a[_0x5889b8['additionalSearchContact']]=_0x521862;_[_0x6d01('0x35')](_0x2b5293[_0x6d01('0x31')],_0x9a7a1a);}return _0x229557['sobject']('Contact')[_0x6d01('0x23')](_0x2b5293,_0x54cf82)[_0x6d01('0x33')]();case _0x6d01('0x16'):var _0x40c6ae=_['cloneDeep'](_0x299a7a);if(_0x5889b8[_0x6d01('0x34')]){var _0x9a7a1a={};_0x9a7a1a[_0x5889b8[_0x6d01('0x34')]]=_0x521862;_[_0x6d01('0x35')](_0x40c6ae[_0x6d01('0x31')],_0x9a7a1a);}return _0x229557[_0x6d01('0x1e')](_0x6d01('0x36'))[_0x6d01('0x23')](_0x40c6ae,_0x54cf82);case _0x6d01('0x17'):var _0x218e1a=_['cloneDeep'](_0x299a7a);if(_0x5889b8[_0x6d01('0x37')]){var _0x9a7a1a={};_0x9a7a1a[_0x5889b8[_0x6d01('0x37')]]=_0x521862;_[_0x6d01('0x35')](_0x218e1a[_0x6d01('0x31')],_0x9a7a1a);}return _0x229557[_0x6d01('0x1e')](_0x6d01('0x38'))[_0x6d01('0x23')](_0x218e1a,_0x54cf82);default:return null;}})[_0x6d01('0x2a')](function(_0x13ea76){if(_0x13ea76&&_0x13ea76[_0x6d01('0x22')]){var _0x1830d6=_[_0x6d01('0x3a')](_0x13ea76);if(_0x1830d6){return BPromise[_0x6d01('0x26')]({'id':_0x1830d6['Id'],'name':_0x1830d6['Name'],'phone':_0x1830d6['Phone'],'endUserType':_0x1830d6['attributes']['type'][_0x6d01('0x3b')]()});}}})[_0x6d01('0x2a')](function(_0x312a61){if(_0x312a61){logger[_0x6d01('0x1c')](_0x6d01('0x3c'),_0x312a61[_0x6d01('0x15')],_0x521862);return BPromise[_0x6d01('0x26')](_0x312a61);}else{logger[_0x6d01('0x1c')](_0x6d01('0x3d'),_0x521862);var _0x37141a={'Phone':_0x521862};if(_0x5889b8[_0x6d01('0x3e')]){if(_0x5889b8[_0x6d01('0x3e')]===_0x6d01('0x39')){logger[_0x6d01('0x1c')](_0x6d01('0x3f'),_0x521862,_0x5889b8[_0x6d01('0x3e')]);_0x37141a[_0x6d01('0x40')]=_0x5de94d!==_0x6d01('0x41')?_0x5de94d:util[_0x6d01('0x42')]('Caller\x20-\x20%s',_0x521862);}else if(_0x5889b8[_0x6d01('0x3e')]===_0x6d01('0x16')){logger[_0x6d01('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x521862,_0x5889b8[_0x6d01('0x3e')]);_0x37141a[_0x6d01('0x40')]=_0x5de94d!==''?_0x5de94d:util[_0x6d01('0x42')](_0x6d01('0x43'),_0x521862);_0x37141a[_0x6d01('0x44')]=_0x6d01('0x45');}else if(_0x5889b8[_0x6d01('0x3e')]===_0x6d01('0x17')){logger[_0x6d01('0x1c')](_0x6d01('0x3f'),_0x521862,_0x5889b8[_0x6d01('0x3e')]);_0x37141a['Name']=_0x5de94d!==_0x6d01('0x41')?_0x5de94d:util[_0x6d01('0x42')](_0x6d01('0x43'),_0x521862);}else{return null;}}return _0x229557['sobject'](_[_0x6d01('0x46')](_0x5889b8[_0x6d01('0x3e')]))[_0x6d01('0x1f')](_0x37141a)[_0x6d01('0x2a')](function(_0x3f5d1c){return BPromise[_0x6d01('0x26')]({'id':_0x3f5d1c['id'],'endUserType':_0x5889b8[_0x6d01('0x3e')]});});}});}function getCustomFields(_0x559098,_0x222ac9){var _0x38e9d2={};if(_0x559098[_0x6d01('0x22')]>0x0){_[_0x6d01('0x47')](_0x559098,function(_0x538bee){if(_['includes'](['string',_0x6d01('0x48')],_0x538bee[_0x6d01('0x49')])&&_0x538bee['idField']){_0x38e9d2[_0x538bee['idField']]=_0x538bee[_0x6d01('0x4a')][_0x6d01('0x4b')]();}else if(_0x538bee['type']===_0x6d01('0x4c')&&_0x538bee[_0x6d01('0x4d')]&&_0x538bee[_0x6d01('0x4e')]){_0x222ac9[_0x538bee[_0x6d01('0x4d')]]&&(_0x38e9d2[_0x538bee[_0x6d01('0x4e')]]=_0x222ac9[_0x538bee[_0x6d01('0x4d')]][_0x6d01('0x4b')]());}else if(_0x538bee[_0x6d01('0x49')]===_0x6d01('0x4f')&&_0x538bee[_0x6d01('0x50')]&&_0x538bee[_0x6d01('0x50')]['name']&&_0x538bee[_0x6d01('0x4e')]){_0x222ac9[_0x538bee[_0x6d01('0x50')][_0x6d01('0x51')][_0x6d01('0x3b')]()]&&(_0x38e9d2[_0x538bee[_0x6d01('0x4e')]]=_0x222ac9[_0x538bee[_0x6d01('0x50')]['name'][_0x6d01('0x3b')]()][_0x6d01('0x4b')]());}});}return _0x38e9d2;}function getConnection(_0x4812fd){var _0xd3fa5=_0x4812fd[_0x6d01('0x52')][_0x6d01('0x53')](_0x4812fd[_0x6d01('0x54')]);var _0xeec161=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4812fd[_0x6d01('0x55')]||_0x6d01('0x56'),'clientId':_0x4812fd['clientId'],'clientSecret':_0x4812fd[_0x6d01('0x57')]}});return _0xeec161[_0x6d01('0x58')](_0x4812fd[_0x6d01('0x59')],_0xd3fa5)[_0x6d01('0x2a')](function(){logger['info'](_0x6d01('0x5a'));return _0xeec161;});}exports['queue']=function(_0xaef17d,_0xa5d978,_0x1cc51f,_0x12e3e6,_0xc083c7,_0x3217a9){var _0x4f9b49,_0x501b03,_0x342f0c,_0x4dbdf1;_0x3217a9[_0x6d01('0x5b')]=intUtil[_0x6d01('0x5c')](_0x3217a9['serverUrl']);_0x3217a9['remoteUri']=intUtil['stripTrailingSlash'](_0x3217a9[_0x6d01('0x55')]);if(_0xc083c7&&_0xc083c7[_0x6d01('0x5d')]){logger[_0x6d01('0x1c')](_0x6d01('0x5e'),'Recording\x20is\x20enabled!');_0xa5d978[_0x6d01('0x5f')]=util[_0x6d01('0x42')](_0x6d01('0x60'),_0x3217a9[_0x6d01('0x5b')],_0xa5d978['uniqueid'],md5(_0xa5d978['uniqueid']));}else{_0xa5d978[_0x6d01('0x5f')]='';}return getConnection(_0x3217a9)[_0x6d01('0x2a')](function(_0x491666){_0x4dbdf1=_0x491666;return getUser(_0x3217a9,_0x12e3e6[_0x6d01('0x61')],_0x4dbdf1);})['then'](function(_0x383fe4){_0x4f9b49=_0x383fe4;return getEndUser(_0x3217a9,_0x1cc51f,_0xa5d978[_0x6d01('0x62')],_0xa5d978[_0x6d01('0x63')],_0x4dbdf1);})[_0x6d01('0x2a')](function(_0x572d8f){_0x501b03=_0x572d8f;return getTicket(_0x3217a9,_0x4f9b49,_0x501b03,_0x1cc51f,_0xa5d978,_0x1cc51f[_0x6d01('0x64')],_0x4dbdf1,'queue');})['then'](function(_0x5e2d9a){_0x342f0c=_0x5e2d9a;logger[_0x6d01('0x1c')](_0x6d01('0x65'),_0x342f0c['id']);logger[_0x6d01('0x1c')](_0x6d01('0x66'),_0x342f0c['id'],_0x12e3e6[_0x6d01('0x51')],_0x3217a9[_0x6d01('0x49')]);switch(_0x3217a9[_0x6d01('0x49')]){case _0x6d01('0x67'):emit(util[_0x6d01('0x42')]('user:%s',_0x12e3e6[_0x6d01('0x51')]),_0x6d01('0x68'),{'recordId':_0x342f0c['id']});break;case _0x6d01('0x69'):emit(util[_0x6d01('0x42')](_0x6d01('0x6a'),_0x12e3e6['name']),'trigger:browser:url',{'uri':util[_0x6d01('0x42')]('%s/%s/e',_0x4dbdf1[_0x6d01('0x6b')],_0x342f0c['id'])});break;default:logger[_0x6d01('0x6c')](_0x6d01('0x6d'));}})['catch'](function(_0x523fa8){logger['error'](_0x6d01('0x5e'),_0x523fa8);});};exports[_0x6d01('0x6e')]=function(_0x1e401b,_0x489b89,_0x1a8e5e,_0x4a4caf,_0x49db24,_0x4fbfb9,_0x58f296){var _0x3f21e2,_0x2b4dc8,_0x355932,_0x21f2aa;_0x4fbfb9[_0x6d01('0x5b')]=intUtil['stripTrailingSlash'](_0x4fbfb9['serverUrl']);_0x4fbfb9[_0x6d01('0x55')]=intUtil[_0x6d01('0x5c')](_0x4fbfb9[_0x6d01('0x55')]);if(_0x58f296&&_0x58f296['recordingFormat']&&_0x58f296[_0x6d01('0x6f')]!==_0x6d01('0x70')){logger[_0x6d01('0x1c')](_0x6d01('0x71'),_0x6d01('0x72'));_0x489b89[_0x6d01('0x5f')]=util['format'](_0x6d01('0x60'),_0x4fbfb9[_0x6d01('0x5b')],_0x489b89[_0x6d01('0x73')],md5(_0x489b89[_0x6d01('0x73')]));}return getConnection(_0x4fbfb9)[_0x6d01('0x2a')](function(_0x4cc9ef){_0x21f2aa=_0x4cc9ef;return getUser(_0x4fbfb9,_0x4a4caf['email'],_0x21f2aa);})[_0x6d01('0x2a')](function(_0x485362){_0x3f21e2=_0x485362;return getEndUser(_0x4fbfb9,_0x1a8e5e,_0x489b89[_0x6d01('0x74')],_0x489b89[_0x6d01('0x75')],_0x21f2aa);})[_0x6d01('0x2a')](function(_0x242679){_0x2b4dc8=_0x242679;return getTicket(_0x4fbfb9,_0x3f21e2,_0x2b4dc8,_0x1a8e5e,_0x489b89,_0x1a8e5e[_0x6d01('0x64')],_0x21f2aa,_0x6d01('0x6e'));})[_0x6d01('0x2a')](function(_0x2d14f2){_0x355932=_0x2d14f2;logger['info'](_0x6d01('0x76'),_0x355932['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x355932['id'],_0x4a4caf['name'],_0x4fbfb9[_0x6d01('0x49')]);switch(_0x4fbfb9[_0x6d01('0x49')]){case'integrationTab':emit(util[_0x6d01('0x42')](_0x6d01('0x6a'),_0x4a4caf[_0x6d01('0x51')]),'trigger:salesforce:display',{'recordId':_0x355932['id']});break;case'newTab':emit(util[_0x6d01('0x42')](_0x6d01('0x6a'),_0x4a4caf['name']),_0x6d01('0x77'),{'uri':util['format'](_0x6d01('0x78'),_0x21f2aa[_0x6d01('0x6b')],_0x355932['id'])});break;default:logger[_0x6d01('0x6c')](_0x6d01('0x71'),_0x6d01('0x79'));}})[_0x6d01('0x7a')](function(_0x53a7ca){logger[_0x6d01('0x6c')](_0x6d01('0x71'),_0x53a7ca);});};exports['unmanaged']=function(_0x40eb1e,_0x550dd7,_0x3d0d89,_0x102997,_0x52d3d9,_0x599dd7){var _0x59a05b,_0x19b4bc,_0x25b933,_0x1a2452;_0x599dd7['serverUrl']=intUtil[_0x6d01('0x5c')](_0x599dd7[_0x6d01('0x5b')]);_0x599dd7[_0x6d01('0x55')]=intUtil[_0x6d01('0x5c')](_0x599dd7[_0x6d01('0x55')]);if(_0x52d3d9&&_0x52d3d9['monitor_format']){logger[_0x6d01('0x1c')]('['+_0x550dd7[_0x6d01('0x7b')][_0x6d01('0x7c')]()+']',_0x6d01('0x72'));_0x550dd7['recordingURL']=util[_0x6d01('0x42')](_0x6d01('0x60'),_0x599dd7['serverUrl'],_0x550dd7[_0x6d01('0x73')],md5(_0x550dd7['uniqueid']));}else{_0x550dd7['recordingURL']='';}return getConnection(_0x599dd7)[_0x6d01('0x2a')](function(_0x2d1bf7){_0x1a2452=_0x2d1bf7;if(!_[_0x6d01('0x20')](_0x102997)){return getUser(_0x599dd7,_0x102997[_0x6d01('0x51')],_0x1a2452);}else{return getUser(_0x599dd7,null,_0x1a2452);}})[_0x6d01('0x2a')](function(_0x32e606){_0x59a05b=_0x32e606;return getEndUser(_0x599dd7,_0x3d0d89,_0x550dd7[_0x6d01('0x62')],_0x550dd7[_0x6d01('0x63')],_0x1a2452);})[_0x6d01('0x2a')](function(_0x325b0d){_0x19b4bc=_0x325b0d;return getTicket(_0x599dd7,_0x59a05b,_0x19b4bc,_0x3d0d89,_0x550dd7,_0x3d0d89[_0x6d01('0x64')],_0x1a2452);})[_0x6d01('0x2a')](function(_0x168a85){_0x25b933=_0x168a85;logger[_0x6d01('0x1c')]('['+_0x550dd7[_0x6d01('0x7b')][_0x6d01('0x7c')]()+_0x6d01('0x7d'),_0x25b933['id']);logger[_0x6d01('0x1c')]('['+_0x550dd7[_0x6d01('0x7b')][_0x6d01('0x7c')]()+']\x20Integration\x20account\x20type\x20%s.',_0x599dd7[_0x6d01('0x49')]);})[_0x6d01('0x7a')](function(_0x937f18){logger[_0x6d01('0x6c')]('['+_0x550dd7[_0x6d01('0x7b')][_0x6d01('0x7c')]()+']',_0x937f18);});}; \ 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 bd3e7d9..47bbce7 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 _0x50f1=['push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','adminEmail','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','../../../../config/environment','servicenow','redis','defaults','GET','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','userId','userEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','string','type','nameField','content','toString','includes','picklist','customField','toLowerCase','variable','variableName','idField','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','label_entry','Incident','Incident\x20-\x20','forEach'];(function(_0x3e7fe2,_0x4d4c2b){var _0x45e3f1=function(_0x11824e){while(--_0x11824e){_0x3e7fe2['push'](_0x3e7fe2['shift']());}};_0x45e3f1(++_0x4d4c2b);}(_0x50f1,0x164));var _0x150f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x50f1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var Promise=require(_0x150f('0x0'));var rp=require(_0x150f('0x1'));var util=require(_0x150f('0x2'));var md5=require(_0x150f('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x150f('0x4'));var logger=require('../../../../config/logger')(_0x150f('0x5'));config[_0x150f('0x6')]=_[_0x150f('0x7')](config[_0x150f('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x150f('0x6')]));function getAdminUser(_0x24e1bc,_0x2f4168,_0x19631c,_0x4671ad,_0xe4224a,_0x5ea111){return new Promise(function(_0x359165,_0x11c62f){var _0x47be87={'method':_0x150f('0x8'),'uri':_0x4671ad+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xe4224a+'&'+_0x5ea111,'auth':_0x2f4168,'json':!![]};return rp(_0x47be87)[_0x150f('0x9')](function(_0x257f5b){if(_0x257f5b[_0x150f('0xa')][_0x150f('0xb')]>0x0){_0x19631c[_0x150f('0xc')]=_0x257f5b['result'][0x0]['sys_id'];}logger[_0x150f('0xd')]('['+[_0x24e1bc[_0x150f('0xe')]()]+_0x150f('0xf'),_0x19631c);_0x359165(_0x19631c);})[_0x150f('0x10')](function(_0x23c28a){logger[_0x150f('0x11')]('['+[_0x24e1bc['toUpperCase']()]+']',_0x23c28a[_0x150f('0x12')]);_0x11c62f(_0x23c28a[_0x150f('0x12')]);});});}function getUser(_0x15d7dd,_0x46b857,_0x5b3a4e,_0x4bd0ea,_0x3d1c51){return function(_0x489e8a){logger['info']('['+[_0x15d7dd['toUpperCase']()]+_0x150f('0x13'),_0x489e8a);return new Promise(function(_0x20c3e3,_0x946bc2){if(intUtil[_0x150f('0x14')](_0x489e8a['userEmail'])){var _0x3d10f9={'method':_0x150f('0x8'),'uri':_0x5b3a4e+_0x150f('0x15')+_0x489e8a['userEmail']+'&'+_0x4bd0ea+'&'+_0x3d1c51,'auth':_0x46b857,'json':!![]};logger[_0x150f('0xd')]('['+[_0x15d7dd[_0x150f('0xe')]()]+_0x150f('0x16'),_0x3d10f9);return rp(_0x3d10f9)[_0x150f('0x9')](function(_0x3e3e88){logger[_0x150f('0xd')]('['+[_0x15d7dd[_0x150f('0xe')]()]+_0x150f('0x17'),_0x3e3e88);if(_0x3e3e88[_0x150f('0xa')]['length']>0x0&&String(_0x3e3e88['result'][0x0]['active'])===_0x150f('0x18')){_0x489e8a['userId']=_0x3e3e88['result'][0x0][_0x150f('0x19')];}else{_0x489e8a[_0x150f('0x1a')]=_0x489e8a[_0x150f('0xc')];_0x489e8a[_0x150f('0x1b')]=_0x489e8a['adminEmail'];}logger[_0x150f('0xd')]('['+[_0x15d7dd[_0x150f('0xe')]()]+_0x150f('0x1c'),_0x489e8a);_0x20c3e3(_0x489e8a);})[_0x150f('0x10')](function(_0xf13334){logger[_0x150f('0x11')]('['+[_0x15d7dd[_0x150f('0xe')]()]+']',_0xf13334['message']);_0x946bc2(_0xf13334[_0x150f('0x12')]);});}else{logger[_0x150f('0xd')]('['+[_0x15d7dd['toUpperCase']()]+_0x150f('0x1d'));_0x489e8a[_0x150f('0x1a')]=_0x489e8a['adminId'];_0x489e8a['userEmail']=_0x489e8a['adminEmail'];_0x20c3e3(_0x489e8a);}});};}function createEndUser(_0x1fd381,_0x2af300,_0x39304a,_0x301ea5,_0x5c1dba){logger[_0x150f('0xd')]('['+[_0x1fd381[_0x150f('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x39304a);return new Promise(function(_0x4be8a2,_0x2865b0){var _0x4ffa0b={'method':'POST','uri':_0x301ea5+_0x150f('0x1e')+_0x5c1dba,'body':{'user_name':_0x39304a[_0x150f('0x1f')],'roles':_0x150f('0x20'),'first_name':_0x39304a['endUserNumber'],'active':_0x150f('0x18'),'date_format':'System','phone':_0x39304a['endUserNumber']},'auth':_0x2af300,'json':!![]};return rp(_0x4ffa0b)['then'](function(_0x1b923d){logger[_0x150f('0xd')]('['+[_0x1fd381[_0x150f('0xe')]()]+_0x150f('0x21'),_0x1b923d['result']);_0x39304a[_0x150f('0x22')]=_0x1b923d[_0x150f('0xa')][_0x150f('0x19')];_0x4be8a2(_0x39304a);})[_0x150f('0x10')](function(_0x272de2){logger[_0x150f('0x11')]('['+[_0x1fd381[_0x150f('0xe')]()]+']',_0x272de2['message']);_0x2865b0(_0x272de2[_0x150f('0x12')]);});});}function getEndUser(_0x261345,_0x193057,_0x3edd4c,_0x21d63b,_0x49ddaf){return function(_0x1bd0af){logger['info']('['+[_0x261345[_0x150f('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x1bd0af);return new Promise(function(_0x2b2284,_0x4f3ec7){var _0x1102c7={'method':_0x150f('0x8'),'uri':_0x3edd4c+_0x150f('0x23')+_0x1bd0af[_0x150f('0x1f')]+'&'+_0x21d63b+'&'+_0x49ddaf,'auth':_0x193057,'json':!![]};return rp(_0x1102c7)['then'](function(_0x5f1319){if(_0x5f1319[_0x150f('0xa')][_0x150f('0xb')]>0x0){_0x1bd0af[_0x150f('0x22')]=_0x5f1319[_0x150f('0xa')][0x0][_0x150f('0x19')];logger[_0x150f('0xd')]('['+[_0x261345['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x1bd0af);_0x2b2284(_0x1bd0af);}else{return createEndUser(_0x261345,_0x193057,_0x1bd0af,_0x3edd4c,_0x21d63b)[_0x150f('0x9')](function(_0x38f0c6){logger[_0x150f('0xd')]('['+[_0x261345[_0x150f('0xe')]()]+_0x150f('0x24'),_0x38f0c6);_0x2b2284(_0x38f0c6);});}})['catch'](function(_0x10a062){logger[_0x150f('0x11')]('['+[_0x261345[_0x150f('0xe')]()]+']',_0x10a062[_0x150f('0x12')]);_0x4f3ec7(_0x10a062['message']);});});};}function getCustomFields(_0x22e065,_0x3acc55){var _0x281656={};if(_0x22e065[_0x150f('0xb')]>0x0){_['forEach'](_0x22e065,function(_0x3e3dcf){if(_['includes']([_0x150f('0x25'),'picklist'],_0x3e3dcf[_0x150f('0x26')])&&_0x3e3dcf[_0x150f('0x27')]&&!_0x3e3dcf['customField']){_0x281656[_0x3e3dcf[_0x150f('0x27')]['toLowerCase']()]=_0x3e3dcf[_0x150f('0x28')][_0x150f('0x29')]();}else if(_[_0x150f('0x2a')](['string',_0x150f('0x2b')],_0x3e3dcf['type'])&&_0x3e3dcf['idField']&&_0x3e3dcf[_0x150f('0x2c')]){_0x281656[_0x3e3dcf['idField'][_0x150f('0x2d')]()]=_0x3e3dcf[_0x150f('0x28')][_0x150f('0x29')]();}else if(_0x3e3dcf[_0x150f('0x26')]===_0x150f('0x2e')&&_0x3e3dcf[_0x150f('0x2f')]&&_0x3e3dcf[_0x150f('0x30')]&&_0x3e3dcf[_0x150f('0x2c')]){_0x281656[_0x3e3dcf[_0x150f('0x30')]['toLowerCase']()]=_0x3acc55[_0x3e3dcf['variableName']][_0x150f('0x29')]();}else if(_0x3e3dcf['type']===_0x150f('0x31')&&_0x3e3dcf[_0x150f('0x32')]&&_0x3e3dcf[_0x150f('0x32')]['name']&&_0x3e3dcf[_0x150f('0x30')]&&_0x3e3dcf[_0x150f('0x2c')]){_0x281656[_0x3e3dcf[_0x150f('0x30')][_0x150f('0x2d')]()]=_0x3acc55[_0x3e3dcf[_0x150f('0x32')]['name'][_0x150f('0x2d')]()][_0x150f('0x29')]();}});}return _0x281656;}function getTicket(_0x188060,_0x3cf4be,_0x319934,_0x2f1f4e,_0x5a4423,_0x5cdde9){return function(_0x56c076){logger['info']('['+[_0x188060[_0x150f('0xe')]()]+_0x150f('0x33'),_0x56c076);return new Promise(function(_0x414ced,_0x5ed40f){var _0x101346=_0x188060[_0x150f('0x2d')]()===_0x150f('0x34')?_0x56c076[_0x150f('0x1a')]:_0x56c076['endUserId'];var _0x340122={'method':'POST','uri':_0x319934+_0x150f('0x35')+'?'+_0x5cdde9,'body':Object['assign']({},{'active':'true','caller_id':_0x101346,'assigned_to':_0x56c076[_0x150f('0x1a')],'short_description':intUtil[_0x150f('0x36')](_0x2f1f4e[_0x150f('0x37')],_0x5a4423,'\x20'),'description':intUtil[_0x150f('0x36')](_0x2f1f4e[_0x150f('0x38')],_0x5a4423,'\x0a')},getCustomFields(_0x2f1f4e[_0x150f('0x39')],_0x5a4423)),'auth':_0x3cf4be,'json':!![]};return rp(_0x340122)['then'](function(_0x5596c3){logger['info']('['+[_0x188060[_0x150f('0xe')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x5596c3[_0x150f('0xa')]);_0x56c076[_0x150f('0x3a')]=_0x5596c3[_0x150f('0xa')][_0x150f('0x19')];_0x56c076[_0x150f('0x3b')]=_0x5596c3['result'][_0x150f('0x3c')];logger[_0x150f('0xd')]('['+[_0x188060[_0x150f('0xe')]()]+_0x150f('0x3d'),_0x56c076);_0x414ced(_0x56c076);})['catch'](function(_0x313fa9){logger[_0x150f('0x11')]('['+[_0x188060[_0x150f('0xe')]()]+']',_0x313fa9['message']);_0x5ed40f(_0x313fa9[_0x150f('0x12')]);});});};}function createRemoteTag(_0x3ff753,_0x561289,_0x21b28a,_0x810041){return new Promise(function(_0x44fb13,_0x45334b){var _0x519b28={'method':_0x150f('0x3e'),'uri':_0x21b28a+_0x150f('0x3f')+'?'+_0x810041,'body':{'short_description':_0x3ff753,'global':!![],'active':!![],'name':_0x3ff753},'auth':_0x561289,'json':!![]};return rp(_0x519b28)[_0x150f('0x9')](function(_0x5010e7){var _0x5c6a52=_0x5010e7[_0x150f('0xa')][_0x150f('0x19')];_0x44fb13(_0x5c6a52);});});}function getRemoteTag(_0x1c3d6a,_0x4a71b2,_0x4fb536,_0x4f1dbe,_0x52fde3){return new Promise(function(_0x8ca1c,_0x22b3ec){var _0x5b0a27={'method':_0x150f('0x8'),'uri':_0x4fb536+_0x150f('0x3f')+'?sysparm_query=name%3D'+_0x1c3d6a+'&'+_0x4f1dbe,'auth':_0x4a71b2,'json':!![]};return rp(_0x5b0a27)[_0x150f('0x9')](function(_0x123915){if(_0x123915['result']['length']>0x0){var _0x29a9b8=_0x123915['result'][0x0]['sys_id'];_0x8ca1c(_0x29a9b8);}else{return createRemoteTag(_0x1c3d6a,_0x4a71b2,_0x4fb536,_0x4f1dbe)[_0x150f('0x9')](function(_0x2022ab){_0x8ca1c(_0x2022ab);});}});});}function assignTagToIncident(_0x230cad,_0x450d79,_0x393d1d,_0x109a44,_0x5509b9){return new Promise(function(_0x1a7b33,_0x10c9a4){var _0x1bbe88={'method':'POST','uri':_0x393d1d+_0x150f('0x40')+'?'+_0x5509b9,'body':{'label':_0x230cad,'table':_0x150f('0x35'),'id_type':_0x150f('0x41'),'table_key':_0x109a44[_0x150f('0x3a')],'title':_0x150f('0x42')+_0x109a44[_0x150f('0x3b')],'id_display':_0x109a44[_0x150f('0x3b')]},'auth':_0x450d79,'json':!![]};return rp(_0x1bbe88)['then'](function(_0x4a5f70){_0x1a7b33();})['catch'](function(){_0x1a7b33();});});}function manageTags(_0x4d01bf,_0x23370f,_0x3309ed,_0x412e54,_0x2df046,_0x3142c4,_0x3bff82){return new Promise(function(_0x3d7e93,_0x46277e){var _0x5a553d=[];_0x23370f[_0x150f('0x43')](function(_0x23d6ce){_0x5a553d[_0x150f('0x44')](getRemoteTag(_0x23d6ce,_0x3309ed,_0x412e54,_0x3142c4,_0x3bff82));});return Promise[_0x150f('0x45')](_0x5a553d)[_0x150f('0x9')](function(_0x5590b8){if(_0x5590b8[_0x150f('0xb')]){logger[_0x150f('0xd')]('['+[_0x4d01bf[_0x150f('0xe')]()]+_0x150f('0x46'),_0x5590b8);var _0x3c0580=[];_0x5590b8[_0x150f('0x43')](function(_0x282a13){_0x3c0580['push'](assignTagToIncident(_0x282a13,_0x3309ed,_0x412e54,_0x2df046,_0x3142c4));});return Promise[_0x150f('0x45')](_0x3c0580)['then'](function(){_0x3d7e93();})['catch'](function(){_0x3d7e93();});}else{_0x3d7e93();}});});}function getTags(_0x33336e,_0x11db17,_0x3a323f,_0x4684ca,_0x5436ab,_0x355484){return function(_0x13ddfc){return new Promise(function(_0x404db7,_0x4b2c3a){var _0x4fd58b=[];var _0x6cffd9=_0x4684ca[_0x150f('0x47')];if(_0x6cffd9&&_0x6cffd9[_0x150f('0xb')]>0x0){_0x4fd58b=_[_0x150f('0x48')](_0x6cffd9,'name');}if(_0x4fd58b[_0x150f('0xb')]>0x0){return manageTags(_0x33336e,_0x4fd58b,_0x11db17,_0x3a323f,_0x13ddfc,_0x5436ab,_0x355484)[_0x150f('0x9')](function(){_0x404db7(_0x13ddfc);});}else{_0x404db7(_0x13ddfc);}});};}function emit(_0x20f164,_0x2b7e79,_0x56bbdf){var _0x221142='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x150f('0x49')+_0x150f('0x4a');var _0x9c6ea5={'uri':_0x20f164+_0x150f('0x4b')+_0x56bbdf+_0x221142};io['to'](util[_0x150f('0x4c')]('user:%s',_0x2b7e79))[_0x150f('0x4d')](_0x150f('0x4e'),_0x9c6ea5);}exports['cs']=function(_0x588059,_0x24b3f1,_0xe893b7,_0x515497,_0x59edbc,_0x51bc0f,_0x210ff9,_0x5a0154){var _0x428ddb={};var _0x382fe0={'user':_0x51bc0f[_0x150f('0x4f')],'pass':_0x51bc0f[_0x150f('0x50')]};var _0x44427b=_0x150f('0x51');var _0x4ddaac=_0x150f('0x52');_0x51bc0f[_0x150f('0x53')]=intUtil[_0x150f('0x54')](_0x51bc0f[_0x150f('0x53')]);_0x51bc0f[_0x150f('0x55')]=intUtil[_0x150f('0x54')](_0x51bc0f[_0x150f('0x55')]);var _0x3df513=util[_0x150f('0x4c')](_0x150f('0x56'),_0x51bc0f[_0x150f('0x53')]);_0x428ddb['userEmail']=!_['isNil'](_0x515497)?_0x515497['email']:null;_0x428ddb[_0x150f('0x57')]=_0x51bc0f['email'];_0x428ddb[_0x150f('0x1f')]=_0x5a0154[_0x150f('0x2d')]()===_0x150f('0x34')?_0x24b3f1[_0x150f('0x58')]:_0x24b3f1[_0x150f('0x59')];_0x428ddb[_0x150f('0x5a')]=_0x5a0154==='queue'||_0x5a0154===_0x150f('0x5b')?_0x150f('0x5c'):'outbound';var _0x59422b=util['format'](_0x150f('0x5d'),_0x51bc0f[_0x150f('0x55')],_0x24b3f1[_0x150f('0x5e')],md5(_0x24b3f1['uniqueid']));if(_0x59edbc&&_0x59edbc[_0x150f('0x5f')]){logger[_0x150f('0xd')](_0x150f('0x60'),_0x150f('0x61'));_0x24b3f1['recordingURL']=_0x59422b;}else if(_0x210ff9&&_0x210ff9[_0x150f('0x62')]&&_0x210ff9['recordingFormat']!=='none'){logger[_0x150f('0xd')](_0x150f('0x63'),_0x150f('0x61'));_0x24b3f1['recordingURL']=_0x59422b;}else{_0x24b3f1[_0x150f('0x64')]='';}return getAdminUser(_0x5a0154,_0x382fe0,_0x428ddb,_0x3df513,_0x4ddaac,_0x44427b)[_0x150f('0x9')](getUser(_0x5a0154,_0x382fe0,_0x3df513,_0x4ddaac,_0x44427b))[_0x150f('0x9')](getEndUser(_0x5a0154,_0x382fe0,_0x3df513,_0x4ddaac,_0x44427b))[_0x150f('0x9')](getTicket(_0x5a0154,_0x382fe0,_0x3df513,_0xe893b7,_0x24b3f1,_0x4ddaac))[_0x150f('0x9')](function(_0x193176){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x193176[_0x150f('0x3a')]));logger[_0x150f('0xd')](util['format'](_0x150f('0x65'),_0x5a0154));if(_0x5a0154!=='unmanaged'){logger[_0x150f('0xd')]('['+[_0x5a0154[_0x150f('0xe')]()]+']',_0x150f('0x66'));emit(_0x51bc0f['remoteUri'],_0x515497[_0x150f('0x67')],_0x193176[_0x150f('0x3a')]);}})[_0x150f('0x10')](function(_0x56e028){logger[_0x150f('0x11')]('['+[_0x5a0154[_0x150f('0xe')]()]+_0x150f('0x68'),util[_0x150f('0x69')](_0x56e028,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6a88=['recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!'];(function(_0x3513c7,_0x23a696){var _0x5afebf=function(_0x112d09){while(--_0x112d09){_0x3513c7['push'](_0x3513c7['shift']());}};_0x5afebf(++_0x23a696);}(_0x6a88,0xef));var _0x86a8=function(_0x4855a7,_0x133b87){_0x4855a7=_0x4855a7-0x0;var _0x2d3855=_0x6a88[_0x4855a7];return _0x2d3855;};'use strict';var _=require(_0x86a8('0x0'));var Promise=require('bluebird');var rp=require(_0x86a8('0x1'));var util=require('util');var md5=require(_0x86a8('0x2'));var Redis=require('ioredis');var intUtil=require(_0x86a8('0x3'));var config=require(_0x86a8('0x4'));var logger=require(_0x86a8('0x5'))(_0x86a8('0x6'));config[_0x86a8('0x7')]=_[_0x86a8('0x8')](config[_0x86a8('0x7')],{'host':_0x86a8('0x9'),'port':0x18eb});var io=require(_0x86a8('0xa'))(new Redis(config[_0x86a8('0x7')]));function getAdminUser(_0x560966,_0xf15eb8,_0x28195c,_0x4a1137,_0x1d94ae,_0x4095a2){return new Promise(function(_0x17eb0a,_0x143b3d){var _0x2e83cb={'method':_0x86a8('0xb'),'uri':_0x4a1137+_0x86a8('0xc')+'&'+_0x1d94ae+'&'+_0x4095a2,'auth':_0xf15eb8,'json':!![]};return rp(_0x2e83cb)[_0x86a8('0xd')](function(_0x2e2d99){if(_0x2e2d99['result'][_0x86a8('0xe')]>0x0){_0x28195c[_0x86a8('0xf')]=_0x2e2d99[_0x86a8('0x10')][0x0][_0x86a8('0x11')];}logger[_0x86a8('0x12')]('['+[_0x560966['toUpperCase']()]+_0x86a8('0x13'),_0x28195c);_0x17eb0a(_0x28195c);})[_0x86a8('0x14')](function(_0x1faabd){logger[_0x86a8('0x15')]('['+[_0x560966[_0x86a8('0x16')]()]+']',_0x1faabd[_0x86a8('0x17')]);_0x143b3d(_0x1faabd[_0x86a8('0x17')]);});});}function getUser(_0x564ab6,_0x5e12ae,_0x3e69e8,_0x20eb7d,_0x5397c9){return function(_0x442c86){logger[_0x86a8('0x12')]('['+[_0x564ab6['toUpperCase']()]+_0x86a8('0x18'),_0x442c86);return new Promise(function(_0x447fd5,_0xebe34b){if(intUtil[_0x86a8('0x19')](_0x442c86[_0x86a8('0x1a')])){var _0xd7911c={'method':_0x86a8('0xb'),'uri':_0x3e69e8+_0x86a8('0x1b')+_0x442c86[_0x86a8('0x1a')]+'&'+_0x20eb7d+'&'+_0x5397c9,'auth':_0x5e12ae,'json':!![]};logger[_0x86a8('0x12')]('['+[_0x564ab6['toUpperCase']()]+_0x86a8('0x1c'),_0xd7911c);return rp(_0xd7911c)[_0x86a8('0xd')](function(_0x50fef4){logger[_0x86a8('0x12')]('['+[_0x564ab6[_0x86a8('0x16')]()]+'],\x20getUser\x20entity',_0x50fef4);if(_0x50fef4['result']['length']>0x0&&String(_0x50fef4[_0x86a8('0x10')][0x0][_0x86a8('0x1d')])===_0x86a8('0x1e')){_0x442c86['userId']=_0x50fef4[_0x86a8('0x10')][0x0][_0x86a8('0x11')];}else{_0x442c86[_0x86a8('0x1f')]=_0x442c86[_0x86a8('0xf')];_0x442c86[_0x86a8('0x1a')]=_0x442c86[_0x86a8('0x20')];}logger[_0x86a8('0x12')]('['+[_0x564ab6[_0x86a8('0x16')]()]+_0x86a8('0x21'),_0x442c86);_0x447fd5(_0x442c86);})[_0x86a8('0x14')](function(_0x296b46){logger[_0x86a8('0x15')]('['+[_0x564ab6[_0x86a8('0x16')]()]+']',_0x296b46[_0x86a8('0x17')]);_0xebe34b(_0x296b46[_0x86a8('0x17')]);});}else{logger[_0x86a8('0x12')]('['+[_0x564ab6['toUpperCase']()]+_0x86a8('0x22'));_0x442c86['userId']=_0x442c86[_0x86a8('0xf')];_0x442c86[_0x86a8('0x1a')]=_0x442c86['adminEmail'];_0x447fd5(_0x442c86);}});};}function createEndUser(_0x5a976b,_0x116399,_0x1a3e50,_0x26737a,_0x569ca6){logger[_0x86a8('0x12')]('['+[_0x5a976b[_0x86a8('0x16')]()]+'],\x20createEndUser\x20input\x20crm',_0x1a3e50);return new Promise(function(_0x468864,_0x434982){var _0x57d5f6={'method':'POST','uri':_0x26737a+_0x86a8('0x23')+_0x569ca6,'body':{'user_name':_0x1a3e50[_0x86a8('0x24')],'roles':'user','first_name':_0x1a3e50[_0x86a8('0x24')],'active':_0x86a8('0x1e'),'date_format':_0x86a8('0x25'),'phone':_0x1a3e50['endUserNumber']},'auth':_0x116399,'json':!![]};return rp(_0x57d5f6)[_0x86a8('0xd')](function(_0x162107){logger[_0x86a8('0x12')]('['+[_0x5a976b[_0x86a8('0x16')]()]+_0x86a8('0x26'),_0x162107[_0x86a8('0x10')]);_0x1a3e50['endUserId']=_0x162107[_0x86a8('0x10')][_0x86a8('0x11')];_0x468864(_0x1a3e50);})['catch'](function(_0x297b1b){logger[_0x86a8('0x15')]('['+[_0x5a976b[_0x86a8('0x16')]()]+']',_0x297b1b[_0x86a8('0x17')]);_0x434982(_0x297b1b[_0x86a8('0x17')]);});});}function getEndUser(_0x2eb152,_0x2b7e1d,_0x1a3fc7,_0x43d20f,_0x10f734){return function(_0x1a2a48){logger[_0x86a8('0x12')]('['+[_0x2eb152['toUpperCase']()]+_0x86a8('0x27'),_0x1a2a48);return new Promise(function(_0x3f90fe,_0x2b0fb1){var _0x25846f={'method':'GET','uri':_0x1a3fc7+_0x86a8('0x28')+_0x1a2a48[_0x86a8('0x24')]+'&'+_0x43d20f+'&'+_0x10f734,'auth':_0x2b7e1d,'json':!![]};return rp(_0x25846f)[_0x86a8('0xd')](function(_0x1d5213){if(_0x1d5213['result'][_0x86a8('0xe')]>0x0){_0x1a2a48[_0x86a8('0x29')]=_0x1d5213[_0x86a8('0x10')][0x0]['sys_id'];logger[_0x86a8('0x12')]('['+[_0x2eb152[_0x86a8('0x16')]()]+_0x86a8('0x2a'),_0x1a2a48);_0x3f90fe(_0x1a2a48);}else{return createEndUser(_0x2eb152,_0x2b7e1d,_0x1a2a48,_0x1a3fc7,_0x43d20f)[_0x86a8('0xd')](function(_0xac6a8c){logger[_0x86a8('0x12')]('['+[_0x2eb152[_0x86a8('0x16')]()]+_0x86a8('0x2b'),_0xac6a8c);_0x3f90fe(_0xac6a8c);});}})[_0x86a8('0x14')](function(_0x55d748){logger[_0x86a8('0x15')]('['+[_0x2eb152[_0x86a8('0x16')]()]+']',_0x55d748[_0x86a8('0x17')]);_0x2b0fb1(_0x55d748['message']);});});};}function getCustomFields(_0x480477,_0x5f4800){var _0x587eb7={};if(_0x480477['length']>0x0){_['forEach'](_0x480477,function(_0x27fd15){if(_[_0x86a8('0x2c')]([_0x86a8('0x2d'),'picklist'],_0x27fd15[_0x86a8('0x2e')])&&_0x27fd15[_0x86a8('0x2f')]&&!_0x27fd15[_0x86a8('0x30')]){_0x587eb7[_0x27fd15['nameField'][_0x86a8('0x31')]()]=_0x27fd15[_0x86a8('0x32')][_0x86a8('0x33')]();}else if(_[_0x86a8('0x2c')]([_0x86a8('0x2d'),'picklist'],_0x27fd15[_0x86a8('0x2e')])&&_0x27fd15[_0x86a8('0x34')]&&_0x27fd15[_0x86a8('0x30')]){_0x587eb7[_0x27fd15['idField'][_0x86a8('0x31')]()]=_0x27fd15['content'][_0x86a8('0x33')]();}else if(_0x27fd15['type']===_0x86a8('0x35')&&_0x27fd15[_0x86a8('0x36')]&&_0x27fd15['idField']&&_0x27fd15[_0x86a8('0x30')]){_0x587eb7[_0x27fd15[_0x86a8('0x34')][_0x86a8('0x31')]()]=_0x5f4800[_0x27fd15[_0x86a8('0x36')]]['toString']();}else if(_0x27fd15['type']===_0x86a8('0x37')&&_0x27fd15[_0x86a8('0x38')]&&_0x27fd15[_0x86a8('0x38')][_0x86a8('0x39')]&&_0x27fd15[_0x86a8('0x34')]&&_0x27fd15[_0x86a8('0x30')]){_0x587eb7[_0x27fd15[_0x86a8('0x34')][_0x86a8('0x31')]()]=_0x5f4800[_0x27fd15[_0x86a8('0x38')]['name'][_0x86a8('0x31')]()][_0x86a8('0x33')]();}});}return _0x587eb7;}function getTicket(_0x3bd489,_0x5d423a,_0x3993f0,_0x183cff,_0x4e81e2,_0x6144b3){return function(_0x355dba){logger[_0x86a8('0x12')]('['+[_0x3bd489[_0x86a8('0x16')]()]+_0x86a8('0x3a'),_0x355dba);return new Promise(function(_0x29f5ea,_0x233738){var _0x1c691f=_0x3bd489['toLowerCase']()===_0x86a8('0x3b')?_0x355dba[_0x86a8('0x1f')]:_0x355dba[_0x86a8('0x29')];var _0x47cbee={'method':'POST','uri':_0x3993f0+_0x86a8('0x3c')+'?'+_0x6144b3,'body':Object[_0x86a8('0x3d')]({},{'active':_0x86a8('0x1e'),'caller_id':_0x1c691f,'assigned_to':_0x355dba[_0x86a8('0x1f')],'short_description':intUtil[_0x86a8('0x3e')](_0x183cff[_0x86a8('0x3f')],_0x4e81e2,'\x20'),'description':intUtil['getString'](_0x183cff['Descriptions'],_0x4e81e2,'\x0a')},getCustomFields(_0x183cff['Fields'],_0x4e81e2)),'auth':_0x5d423a,'json':!![]};return rp(_0x47cbee)[_0x86a8('0xd')](function(_0xd4b5d9){logger[_0x86a8('0x12')]('['+[_0x3bd489['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0xd4b5d9[_0x86a8('0x10')]);_0x355dba[_0x86a8('0x40')]=_0xd4b5d9[_0x86a8('0x10')][_0x86a8('0x11')];_0x355dba[_0x86a8('0x41')]=_0xd4b5d9[_0x86a8('0x10')][_0x86a8('0x42')];logger[_0x86a8('0x12')]('['+[_0x3bd489[_0x86a8('0x16')]()]+_0x86a8('0x43'),_0x355dba);_0x29f5ea(_0x355dba);})[_0x86a8('0x14')](function(_0x58dd39){logger[_0x86a8('0x15')]('['+[_0x3bd489['toUpperCase']()]+']',_0x58dd39['message']);_0x233738(_0x58dd39['message']);});});};}function createRemoteTag(_0x4f8fd7,_0x1627c9,_0x4064ee,_0x3d3d00){return new Promise(function(_0x24d8ed,_0x2825d8){var _0x33cf7b={'method':_0x86a8('0x44'),'uri':_0x4064ee+_0x86a8('0x45')+'?'+_0x3d3d00,'body':{'short_description':_0x4f8fd7,'global':!![],'active':!![],'name':_0x4f8fd7},'auth':_0x1627c9,'json':!![]};return rp(_0x33cf7b)['then'](function(_0x4c698e){var _0x1d9f12=_0x4c698e[_0x86a8('0x10')]['sys_id'];_0x24d8ed(_0x1d9f12);});});}function getRemoteTag(_0x22ea91,_0x9d8d3d,_0xd57966,_0x1e2380,_0x392bd6){return new Promise(function(_0x36e722,_0x3b7c1b){var _0x53de9c={'method':_0x86a8('0xb'),'uri':_0xd57966+_0x86a8('0x45')+_0x86a8('0x46')+_0x22ea91+'&'+_0x1e2380,'auth':_0x9d8d3d,'json':!![]};return rp(_0x53de9c)['then'](function(_0x242b58){if(_0x242b58['result']['length']>0x0){var _0x1796c3=_0x242b58[_0x86a8('0x10')][0x0]['sys_id'];_0x36e722(_0x1796c3);}else{return createRemoteTag(_0x22ea91,_0x9d8d3d,_0xd57966,_0x1e2380)['then'](function(_0x2b9e98){_0x36e722(_0x2b9e98);});}});});}function assignTagToIncident(_0x36c998,_0x5fcbe5,_0x114a3a,_0x6d3e9e,_0x54bcf3){return new Promise(function(_0x5a543c,_0x4de48f){var _0x17d6f7={'method':'POST','uri':_0x114a3a+_0x86a8('0x47')+'?'+_0x54bcf3,'body':{'label':_0x36c998,'table':_0x86a8('0x3c'),'id_type':_0x86a8('0x48'),'table_key':_0x6d3e9e[_0x86a8('0x40')],'title':'Incident\x20-\x20'+_0x6d3e9e[_0x86a8('0x41')],'id_display':_0x6d3e9e[_0x86a8('0x41')]},'auth':_0x5fcbe5,'json':!![]};return rp(_0x17d6f7)[_0x86a8('0xd')](function(_0xfd0ee7){_0x5a543c();})['catch'](function(){_0x5a543c();});});}function manageTags(_0x56f57b,_0x1a57ba,_0x1345f3,_0x59d67a,_0x2794e4,_0x37cab8,_0x43726b){return new Promise(function(_0x12c16c,_0x403df9){var _0x1c64db=[];_0x1a57ba['forEach'](function(_0x14e652){_0x1c64db[_0x86a8('0x49')](getRemoteTag(_0x14e652,_0x1345f3,_0x59d67a,_0x37cab8,_0x43726b));});return Promise[_0x86a8('0x4a')](_0x1c64db)[_0x86a8('0xd')](function(_0x368d6a){if(_0x368d6a[_0x86a8('0xe')]){logger['info']('['+[_0x56f57b['toUpperCase']()]+_0x86a8('0x4b'),_0x368d6a);var _0x1255ed=[];_0x368d6a[_0x86a8('0x4c')](function(_0x3e0709){_0x1255ed['push'](assignTagToIncident(_0x3e0709,_0x1345f3,_0x59d67a,_0x2794e4,_0x37cab8));});return Promise[_0x86a8('0x4a')](_0x1255ed)[_0x86a8('0xd')](function(){_0x12c16c();})['catch'](function(){_0x12c16c();});}else{_0x12c16c();}});});}function getTags(_0x4f6fa8,_0x5e86a2,_0x133f00,_0x2abe61,_0x466a1b,_0xec7f7){return function(_0x561f81){return new Promise(function(_0x3512ec,_0xf5d577){var _0x57d1eb=[];var _0x23f0e6=_0x2abe61[_0x86a8('0x4d')];if(_0x23f0e6&&_0x23f0e6[_0x86a8('0xe')]>0x0){_0x57d1eb=_[_0x86a8('0x4e')](_0x23f0e6,'name');}if(_0x57d1eb[_0x86a8('0xe')]>0x0){return manageTags(_0x4f6fa8,_0x57d1eb,_0x5e86a2,_0x133f00,_0x561f81,_0x466a1b,_0xec7f7)[_0x86a8('0xd')](function(){_0x3512ec(_0x561f81);});}else{_0x3512ec(_0x561f81);}});};}function emit(_0x534c22,_0x3b1e09,_0x2cdf70){var _0x281dd7=_0x86a8('0x4f')+_0x86a8('0x50')+_0x86a8('0x51')+_0x86a8('0x52');var _0xaaed65={'uri':_0x534c22+_0x86a8('0x53')+_0x2cdf70+_0x281dd7};io['to'](util[_0x86a8('0x54')](_0x86a8('0x55'),_0x3b1e09))[_0x86a8('0x56')](_0x86a8('0x57'),_0xaaed65);}exports['cs']=function(_0x25112a,_0x583d55,_0x200049,_0x2bb3d1,_0x49f7c3,_0x5ba071,_0x5b5cca,_0x21437f){var _0x54d2e3={};var _0x2de475={'user':_0x5ba071[_0x86a8('0x58')],'pass':_0x5ba071[_0x86a8('0x59')]};var _0x5e733b=_0x86a8('0x5a');var _0x5b0eb1=_0x86a8('0x5b');_0x5ba071[_0x86a8('0x5c')]=intUtil[_0x86a8('0x5d')](_0x5ba071[_0x86a8('0x5c')]);_0x5ba071[_0x86a8('0x5e')]=intUtil[_0x86a8('0x5d')](_0x5ba071[_0x86a8('0x5e')]);var _0x4dc630=util[_0x86a8('0x54')](_0x86a8('0x5f'),_0x5ba071['remoteUri']);_0x54d2e3['userEmail']=!_[_0x86a8('0x60')](_0x2bb3d1)?_0x2bb3d1[_0x86a8('0x61')]:null;_0x54d2e3[_0x86a8('0x20')]=_0x5ba071[_0x86a8('0x61')];_0x54d2e3[_0x86a8('0x24')]=_0x21437f[_0x86a8('0x31')]()===_0x86a8('0x3b')?_0x583d55[_0x86a8('0x62')]:_0x583d55[_0x86a8('0x63')];_0x54d2e3[_0x86a8('0x64')]=_0x21437f===_0x86a8('0x65')||_0x21437f===_0x86a8('0x66')?_0x86a8('0x65'):_0x86a8('0x3b');var _0x3dc345=util['format'](_0x86a8('0x67'),_0x5ba071[_0x86a8('0x5e')],_0x583d55[_0x86a8('0x68')],md5(_0x583d55[_0x86a8('0x68')]));if(_0x49f7c3&&_0x49f7c3['monitor_format']){logger['info']('[QUEUE]',_0x86a8('0x69'));_0x583d55['recordingURL']=_0x3dc345;}else if(_0x5b5cca&&_0x5b5cca[_0x86a8('0x6a')]&&_0x5b5cca['recordingFormat']!==_0x86a8('0x6b')){logger[_0x86a8('0x12')](_0x86a8('0x6c'),'Recording\x20is\x20enabled!');_0x583d55['recordingURL']=_0x3dc345;}else{_0x583d55[_0x86a8('0x6d')]='';}return getAdminUser(_0x21437f,_0x2de475,_0x54d2e3,_0x4dc630,_0x5b0eb1,_0x5e733b)[_0x86a8('0xd')](getUser(_0x21437f,_0x2de475,_0x4dc630,_0x5b0eb1,_0x5e733b))['then'](getEndUser(_0x21437f,_0x2de475,_0x4dc630,_0x5b0eb1,_0x5e733b))[_0x86a8('0xd')](getTicket(_0x21437f,_0x2de475,_0x4dc630,_0x200049,_0x583d55,_0x5b0eb1))[_0x86a8('0xd')](function(_0x5aad6b){logger['info'](util[_0x86a8('0x54')](_0x86a8('0x6e'),_0x5aad6b[_0x86a8('0x40')]));logger[_0x86a8('0x12')](util[_0x86a8('0x54')](_0x86a8('0x6f'),_0x21437f));if(_0x21437f!==_0x86a8('0x66')){logger[_0x86a8('0x12')]('['+[_0x21437f[_0x86a8('0x16')]()]+']',_0x86a8('0x70'));emit(_0x5ba071[_0x86a8('0x5c')],_0x2bb3d1[_0x86a8('0x39')],_0x5aad6b[_0x86a8('0x40')]);}})[_0x86a8('0x14')](function(_0x2aa7e4){logger['error']('['+[_0x21437f['toUpperCase']()]+_0x86a8('0x71'),util[_0x86a8('0x72')](_0x2aa7e4,{'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 39c8a81..705e461 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 _0x7a56=['The\x20User\x20ID\x20is:','destcalleridnum','Outbound','contacts','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','lastevent','toUpperCase','calleridname','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','toISOString','slice','replace','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','content','toString','custom_fields','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','outbound','uri','%s/service/v4_1/rest.php','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x46501a,_0x3f0081){var _0x13cb18=function(_0x195f87){while(--_0x195f87){_0x46501a['push'](_0x46501a['shift']());}};_0x13cb18(++_0x3f0081);}(_0x7a56,0x1e3));var _0x67a5=function(_0x153a80,_0xda1694){_0x153a80=_0x153a80-0x0;var _0x58ca85=_0x7a56[_0x153a80];return _0x58ca85;};'use strict';var _=require(_0x67a5('0x0'));var rp=require('request-promise');var BPromise=require(_0x67a5('0x1'));var md5=require(_0x67a5('0x2'));var util=require(_0x67a5('0x3'));var Redis=require(_0x67a5('0x4'));var intUtil=require(_0x67a5('0x5'));var config=require(_0x67a5('0x6'));var logger=require(_0x67a5('0x7'))('sugarcrm');config[_0x67a5('0x8')]=_[_0x67a5('0x9')](config[_0x67a5('0x8')],{'host':_0x67a5('0xa'),'port':0x18eb});var io=require(_0x67a5('0xb'))(new Redis(config['redis']));var def={'method':_0x67a5('0xc'),'json':!![]};function emit(_0x2bdd49,_0xae4efb,_0x51799a){io['to'](_0x2bdd49)['emit'](_0xae4efb,_0x51799a);}function getTicket(_0x340fe0,_0x275c93,_0x6c5907,_0x2b73d2,_0x56033c,_0x2e49e1,_0x5a0bb3,_0x58ad9c){logger['info']('Creating\x20new\x20ticket...');var _0x232d88=new Date();var _0x1b74b4=[{'name':_0x67a5('0xd'),'value':intUtil['getString'](_0x2b73d2[_0x67a5('0xe')],_0x56033c,'\x20')},{'name':_0x67a5('0xf'),'value':_0x275c93['id']},{'name':_0x67a5('0x10'),'value':_0x275c93['id']},{'name':'description','value':intUtil[_0x67a5('0x11')](_0x2b73d2[_0x67a5('0x12')],_0x56033c,'\x0a')},{'name':_0x67a5('0x13'),'value':_0x232d88[_0x67a5('0x14')]()[_0x67a5('0x15')](0x0,0x13)[_0x67a5('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x67a5('0x17'),'value':'15'},{'name':'parent_id','value':_0x6c5907['id']},{'name':'parent_type','value':_0x67a5('0x18')},{'name':_0x67a5('0x19'),'value':_0x6c5907[_0x67a5('0xd')]},{'name':_0x67a5('0x1a'),'value':_0x58ad9c}];if(_0x2e49e1[_0x67a5('0x1b')]){_[_0x67a5('0x1c')](_0x2e49e1,function(_0xbf3e37){if(_0x56033c[_0xbf3e37[_0x67a5('0x1d')]]){_0x1b74b4[_0x67a5('0x1e')]({'name':_0xbf3e37[_0x67a5('0x1f')],'value':_0x56033c[_0xbf3e37[_0x67a5('0x1d')]]});}});}return request({'form':{'method':_0x67a5('0x20'),'input_type':_0x67a5('0x21'),'response_type':'JSON','rest_data':JSON[_0x67a5('0x22')]({'session':_0x5a0bb3['id'],'module_name':'Calls','name_value_list':_0x1b74b4})}});}function getAuth(_0x4851c1){return util[_0x67a5('0x23')](_0x67a5('0x24'),new Buffer(_0x4851c1[_0x67a5('0x25')]+':X')['toString']('base64'));}function getServerInfo(_0x238cd4){return request({'form':{'method':_0x67a5('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x238cd4['id']})}});}function getUser(_0x3a7aec,_0x566079,_0x176a66){if(!_[_0x67a5('0x27')](_0x566079)){logger[_0x67a5('0x28')](_0x67a5('0x29'),_0x566079);return request({'form':{'method':_0x67a5('0x2a'),'input_type':_0x67a5('0x21'),'response_type':_0x67a5('0x21'),'rest_data':JSON[_0x67a5('0x22')]({'session':_0x176a66['id'],'module_name':_0x67a5('0x2b'),'query':util[_0x67a5('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x566079),'order_by':'','offset':'0','select_fields':['id',_0x67a5('0xd'),_0x67a5('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x67a5('0x2d')](function(_0x5c3c9c){if(_0x5c3c9c[_0x67a5('0x2e')][_0x67a5('0x1b')]){var _0x4b7051=_['find'](_0x5c3c9c[_0x67a5('0x2e')],function(_0x51ffd1){return _0x51ffd1[_0x67a5('0x2f')]['user_name'][_0x67a5('0x30')]===_0x566079;});if(_0x4b7051){logger[_0x67a5('0x28')](_0x67a5('0x31'));return BPromise[_0x67a5('0x32')]({'id':_0x4b7051[_0x67a5('0x2f')]['id'][_0x67a5('0x30')],'name':_0x4b7051[_0x67a5('0x2f')][_0x67a5('0xd')]['value']});}}logger[_0x67a5('0x28')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x67a5('0x32')]({'id':_0x176a66['name_value_list'][_0x67a5('0x33')][_0x67a5('0x30')],'name':_0x176a66[_0x67a5('0x2f')][_0x67a5('0x2c')][_0x67a5('0x30')]});});}else{logger[_0x67a5('0x28')](_0x67a5('0x34'));return BPromise[_0x67a5('0x32')]({'id':_0x176a66[_0x67a5('0x2f')][_0x67a5('0x33')][_0x67a5('0x30')],'name':_0x176a66[_0x67a5('0x2f')][_0x67a5('0x2c')][_0x67a5('0x30')]});}}function getEndUser(_0x56b8fe,_0x40dad3,_0x297416,_0x3a3803){logger[_0x67a5('0x28')](_0x67a5('0x35'),_0x297416);return request({'form':{'method':_0x67a5('0x2a'),'input_type':_0x67a5('0x21'),'response_type':_0x67a5('0x21'),'rest_data':JSON['stringify']({'session':_0x3a3803['id'],'module_name':'Contacts','query':util[_0x67a5('0x23')](_0x67a5('0x36'),_0x297416),'order_by':'','offset':'0','select_fields':['id',_0x67a5('0xd'),_0x67a5('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x67a5('0x2d')](function(_0x2acd7b){if(_0x2acd7b[_0x67a5('0x2e')][_0x67a5('0x1b')]){var _0x301b77=_['find'](_0x2acd7b[_0x67a5('0x2e')],function(_0x428c0e){return _0x428c0e[_0x67a5('0x2f')]['phone_home']['value']===_0x297416;});if(_0x301b77){logger[_0x67a5('0x28')](_0x67a5('0x38'));return BPromise[_0x67a5('0x32')]({'id':_0x301b77[_0x67a5('0x2f')]['id'][_0x67a5('0x30')],'name':_0x301b77[_0x67a5('0x2f')]['name'][_0x67a5('0x30')],'phone':_0x301b77[_0x67a5('0x2f')][_0x67a5('0x37')][_0x67a5('0x30')]});}}else{logger[_0x67a5('0x28')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x67a5('0x20'),'input_type':_0x67a5('0x21'),'response_type':_0x67a5('0x21'),'rest_data':JSON[_0x67a5('0x22')]({'session':_0x3a3803['id'],'module_name':'Contacts','name_value_list':[{'name':_0x67a5('0x39'),'value':_0x40dad3!==_0x67a5('0x3a')?_0x40dad3:util[_0x67a5('0x23')](_0x67a5('0x3b'),_0x297416)},{'name':'phone_home','value':_0x297416}]})}})['then'](function(_0x49e17c){logger[_0x67a5('0x28')](_0x67a5('0x3c'));return BPromise[_0x67a5('0x32')]({'id':_0x49e17c['id'],'name':_0x49e17c['entry_list']['first_name'][_0x67a5('0x30')],'phone':_0x49e17c[_0x67a5('0x2e')][_0x67a5('0x37')][_0x67a5('0x30')]});});}});}function request(_0x4eafb4){logger[_0x67a5('0x3d')](_0x67a5('0x3e'),JSON[_0x67a5('0x22')](_0x4eafb4));return rp(_[_0x67a5('0x3f')](def,_0x4eafb4));}function getTags(_0x579673,_0x34227e){var _0x4ef059=[];if(_0x579673&&_0x579673[_0x67a5('0x1b')]>0x0){_0x4ef059=_[_0x67a5('0x40')](_0x579673,_0x34227e);}return _0x4ef059;}function getCustomFields(_0x54dbdc,_0x3511a8){var _0x307f9e=[];var _0x4e8f01={'custom_fields':[]};if(_0x54dbdc[_0x67a5('0x1b')]>0x0){_[_0x67a5('0x1c')](_0x54dbdc,function(_0x5cac0d){if(_0x5cac0d[_0x67a5('0x41')]===_0x67a5('0x42')&&_0x5cac0d[_0x67a5('0x43')]&&!_0x5cac0d[_0x67a5('0x44')]){_0x4e8f01[_0x5cac0d[_0x67a5('0x43')]['toLowerCase']()]=_0x5cac0d[_0x67a5('0x45')][_0x67a5('0x46')]();}else if(_0x5cac0d[_0x67a5('0x41')]===_0x67a5('0x42')&&_0x5cac0d[_0x67a5('0x1f')]&&_0x5cac0d[_0x67a5('0x44')]){_0x4e8f01['custom_fields'][_0x67a5('0x1e')]({'id':_0x5cac0d[_0x67a5('0x1f')],'value':_0x5cac0d[_0x67a5('0x45')][_0x67a5('0x46')]()});}else if(_0x5cac0d[_0x67a5('0x41')]==='variable'&&_0x5cac0d[_0x67a5('0x1d')]&&_0x5cac0d[_0x67a5('0x1f')]&&_0x5cac0d[_0x67a5('0x44')]){_0x3511a8[_0x5cac0d[_0x67a5('0x1d')]]&&_0x4e8f01[_0x67a5('0x47')]['push']({'id':_0x5cac0d[_0x67a5('0x1f')],'value':_0x3511a8[_0x5cac0d['variableName']][_0x67a5('0x46')]()});}else if(_0x5cac0d[_0x67a5('0x41')]===_0x67a5('0x48')&&_0x5cac0d['Variable']&&_0x5cac0d[_0x67a5('0x49')]['name']&&_0x5cac0d[_0x67a5('0x1f')]&&_0x5cac0d[_0x67a5('0x44')]){_0x3511a8[_0x5cac0d[_0x67a5('0x49')][_0x67a5('0xd')][_0x67a5('0x4a')]()]&&_0x4e8f01[_0x67a5('0x47')][_0x67a5('0x1e')]({'id':_0x5cac0d[_0x67a5('0x1f')],'value':_0x3511a8[_0x5cac0d['Variable'][_0x67a5('0xd')][_0x67a5('0x4a')]()][_0x67a5('0x46')]()});}});}return _0x4e8f01;}function getConnection(_0x3de78f){return request({'method':_0x67a5('0xc'),'form':{'method':_0x67a5('0x4b'),'input_type':_0x67a5('0x21'),'response_type':_0x67a5('0x21'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3de78f[_0x67a5('0x4c')],'password':_0x3de78f[_0x67a5('0x4d')],'encryption':_0x67a5('0x4e')},'application':_0x67a5('0x4f')})}})[_0x67a5('0x2d')](function(_0x43b939){var _0x479911=_0x43b939;if(_0x479911['id']){def['sessionID']=_0x479911['id'];return BPromise[_0x67a5('0x32')](_0x479911);}else{throw new Error(util[_0x67a5('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x3de78f['id']));}});}function setRelationship(_0x578aa0,_0x33c7e9,_0x2a69cd,_0x495d6d){return request({'form':{'method':'set_relationship','input_type':_0x67a5('0x21'),'response_type':_0x67a5('0x21'),'rest_data':JSON[_0x67a5('0x22')]({'session':_0x578aa0['id'],'module_name':_0x67a5('0x50'),'module_id':_0x2a69cd['id'],'link_field_name':_0x495d6d,'related_ids':[_0x33c7e9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x67a5('0x51')]=function(_0x30e389,_0x4b10e0,_0x4dca63,_0x5ee66b,_0x25457a,_0x245116){var _0x578747,_0x3b09b2,_0x4e5911,_0x4f2c3f;_0x245116[_0x67a5('0x52')]=intUtil[_0x67a5('0x53')](_0x245116['remoteUri']);_0x245116[_0x67a5('0x54')]=intUtil['stripTrailingSlash'](_0x245116[_0x67a5('0x54')]);def['uri']=util[_0x67a5('0x23')]('%s/service/v4_1/rest.php',_0x245116['remoteUri']);if(_0x25457a&&_0x25457a['monitor_format']){logger[_0x67a5('0x28')](_0x67a5('0x55'),_0x67a5('0x56'));_0x4b10e0['recordingURL']=util[_0x67a5('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x245116['serverUrl'],_0x4b10e0[_0x67a5('0x57')],md5(_0x4b10e0[_0x67a5('0x57')]));}else{_0x4b10e0[_0x67a5('0x58')]='';}return getConnection(_0x245116)[_0x67a5('0x2d')](function(_0x3356c0){_0x4f2c3f=_0x3356c0;return getUser(_0x245116,_0x5ee66b[_0x67a5('0xd')],_0x4f2c3f);})[_0x67a5('0x2d')](function(_0x51e7df){_0x578747=_0x51e7df;logger[_0x67a5('0x28')]('The\x20User\x20ID\x20is:',_0x578747['id']);return getEndUser(_0x245116,_0x4b10e0['calleridname'],_0x4b10e0[_0x67a5('0x59')],_0x4f2c3f);})[_0x67a5('0x2d')](function(_0x1deb7b){_0x3b09b2=_0x1deb7b;logger[_0x67a5('0x28')](_0x67a5('0x5a'),_0x3b09b2['id']);return getTicket(_0x245116,_0x578747,_0x3b09b2,_0x4dca63,_0x4b10e0,_0x4dca63[_0x67a5('0x5b')],_0x4f2c3f,_0x67a5('0x5c'));})['then'](function(_0x4d5101){_0x4e5911=_0x4d5101;logger[_0x67a5('0x28')](_0x67a5('0x5d'));logger[_0x67a5('0x28')](_0x67a5('0x5e'),_0x4e5911['id']);return setRelationship(_0x4f2c3f,_0x578747,_0x4e5911,_0x67a5('0x5f'));})[_0x67a5('0x2d')](function(){return setRelationship(_0x4f2c3f,_0x3b09b2,_0x4e5911,'contacts');})[_0x67a5('0x2d')](function(){return getServerInfo(_0x4f2c3f);})[_0x67a5('0x2d')](function(_0x3773e0){var _0x189bb3=parseInt(_0x3773e0[_0x67a5('0x60')][_0x67a5('0x61')](0x0));var _0x5e2ff9=util[_0x67a5('0x23')](_0x67a5('0x62'),_0x245116[_0x67a5('0x52')],_0x4e5911['id']);if(_0x189bb3>0x6){_0x5e2ff9=util[_0x67a5('0x23')](_0x67a5('0x63'),_0x245116[_0x67a5('0x52')],_0x4e5911['id']);}logger[_0x67a5('0x28')](_0x67a5('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x67a5('0x23')]('user:%s',_0x5ee66b[_0x67a5('0xd')]),_0x67a5('0x64'),{'uri':_0x5e2ff9});})[_0x67a5('0x65')](function(_0x41dccb){logger['error'](_0x67a5('0x55'),JSON[_0x67a5('0x22')](_0x41dccb));});};exports[_0x67a5('0x66')]=function(_0xd74054,_0x2ed218,_0x29c6f9,_0x2cfab8,_0x494189,_0x563ba2,_0x216a01){var _0xaf350,_0x3ad795,_0x2ea53e,_0x809788;_0x563ba2[_0x67a5('0x52')]=intUtil[_0x67a5('0x53')](_0x563ba2[_0x67a5('0x52')]);_0x563ba2[_0x67a5('0x54')]=intUtil[_0x67a5('0x53')](_0x563ba2[_0x67a5('0x54')]);def[_0x67a5('0x67')]=util[_0x67a5('0x23')](_0x67a5('0x68'),_0x563ba2[_0x67a5('0x52')]);if(_0x216a01&&_0x216a01[_0x67a5('0x69')]&&_0x216a01[_0x67a5('0x69')]!=='none'){logger[_0x67a5('0x28')]('[OUTBOUND]',_0x67a5('0x56'));_0x2ed218[_0x67a5('0x58')]=util[_0x67a5('0x23')](_0x67a5('0x6a'),_0x563ba2[_0x67a5('0x54')],_0x2ed218['uniqueid'],md5(_0x2ed218[_0x67a5('0x57')]));}return getConnection(_0x563ba2)[_0x67a5('0x2d')](function(_0x33f634){_0x809788=_0x33f634;return getUser(_0x563ba2,_0x2cfab8[_0x67a5('0xd')],_0x809788);})['then'](function(_0xb7a0cc){_0xaf350=_0xb7a0cc;logger[_0x67a5('0x28')](_0x67a5('0x6b'),_0xaf350['id']);return getEndUser(_0x563ba2,_0x2ed218['destcalleridname'],_0x2ed218[_0x67a5('0x6c')],_0x809788);})[_0x67a5('0x2d')](function(_0x44aed8){_0x3ad795=_0x44aed8;logger[_0x67a5('0x28')](_0x67a5('0x5a'),_0x3ad795['id']);return getTicket(_0x563ba2,_0xaf350,_0x3ad795,_0x29c6f9,_0x2ed218,_0x29c6f9[_0x67a5('0x5b')],_0x809788,_0x67a5('0x6d'));})[_0x67a5('0x2d')](function(_0xc4fc89){_0x2ea53e=_0xc4fc89;logger[_0x67a5('0x28')]('Ticket\x20created!');logger[_0x67a5('0x28')](_0x67a5('0x5e'),_0x2ea53e['id']);return setRelationship(_0x809788,_0xaf350,_0x2ea53e,_0x67a5('0x5f'));})[_0x67a5('0x2d')](function(){return setRelationship(_0x809788,_0x3ad795,_0x2ea53e,_0x67a5('0x6e'));})['then'](function(){return getServerInfo(_0x809788);})['then'](function(_0x1b7a4a){var _0xf40285=parseInt(_0x1b7a4a['version'][_0x67a5('0x61')](0x0));var _0x2894df=util[_0x67a5('0x23')](_0x67a5('0x62'),_0x563ba2[_0x67a5('0x52')],_0x2ea53e['id']);if(_0xf40285>0x6){_0x2894df=util[_0x67a5('0x23')](_0x67a5('0x63'),_0x563ba2[_0x67a5('0x52')],_0x2ea53e['id']);}logger[_0x67a5('0x28')](_0x67a5('0x6f'),_0x67a5('0x70'));emit(util[_0x67a5('0x23')](_0x67a5('0x71'),_0x2cfab8['name']),_0x67a5('0x64'),{'uri':_0x2894df});})[_0x67a5('0x65')](function(_0x1438f2){logger[_0x67a5('0x72')](_0x67a5('0x6f'),JSON['stringify'](_0x1438f2));});};exports['unmanaged']=function(_0x565be6,_0x59d95b,_0x2f80a0,_0x17124b,_0x2e7ba7,_0xbcb519){var _0x2b89d7,_0x886d25,_0x2f85d5,_0x23ccda;_0xbcb519[_0x67a5('0x52')]=intUtil[_0x67a5('0x53')](_0xbcb519[_0x67a5('0x52')]);_0xbcb519['serverUrl']=intUtil['stripTrailingSlash'](_0xbcb519[_0x67a5('0x54')]);def['uri']=util[_0x67a5('0x23')](_0x67a5('0x68'),_0xbcb519[_0x67a5('0x52')]);if(_0x2e7ba7&&_0x2e7ba7['monitor_format']){logger['info']('['+_0x59d95b[_0x67a5('0x73')][_0x67a5('0x74')]()+']','Recording\x20is\x20enabled!');_0x59d95b[_0x67a5('0x58')]=util[_0x67a5('0x23')](_0x67a5('0x6a'),_0xbcb519[_0x67a5('0x54')],_0x59d95b[_0x67a5('0x57')],md5(_0x59d95b[_0x67a5('0x57')]));}else{_0x59d95b[_0x67a5('0x58')]='';}return getConnection(_0xbcb519)[_0x67a5('0x2d')](function(_0x34ecde){_0x23ccda=_0x34ecde;if(!_[_0x67a5('0x27')](_0x17124b)){return getUser(_0xbcb519,_0x17124b[_0x67a5('0xd')],_0x23ccda);}else{return getUser(_0xbcb519,null,_0x23ccda);}})['then'](function(_0x2af488){_0x2b89d7=_0x2af488;logger[_0x67a5('0x28')](_0x67a5('0x6b'),_0x2b89d7['id']);return getEndUser(_0xbcb519,_0x59d95b[_0x67a5('0x75')],_0x59d95b['calleridnum'],_0x23ccda);})[_0x67a5('0x2d')](function(_0x49c46a){_0x886d25=_0x49c46a;logger[_0x67a5('0x28')](_0x67a5('0x5a'),_0x886d25['id']);return getTicket(_0xbcb519,_0x2b89d7,_0x886d25,_0x2f80a0,_0x59d95b,_0x2f80a0['Fields'],_0x23ccda,_0x67a5('0x5c'));})['then'](function(_0x1ca1c3){_0x2f85d5=_0x1ca1c3;logger[_0x67a5('0x28')](_0x67a5('0x5d'));logger[_0x67a5('0x28')](_0x67a5('0x5e'),_0x2f85d5['id']);return setRelationship(_0x23ccda,_0x2b89d7,_0x2f85d5,_0x67a5('0x5f'));})[_0x67a5('0x2d')](function(){return setRelationship(_0x23ccda,_0x886d25,_0x2f85d5,_0x67a5('0x6e'));})[_0x67a5('0x2d')](function(){return getServerInfo(_0x23ccda);})[_0x67a5('0x65')](function(_0x3c1017){logger[_0x67a5('0x72')]('['+_0x59d95b[_0x67a5('0x73')][_0x67a5('0x74')]()+']',JSON['stringify'](_0x3c1017));});}; \ No newline at end of file +var _0x7fcf=['Contacts','parent_name','name','length','forEach','variableName','JSON','format','Basic\x20%s','apiKey','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','value','info','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','customField','nameField','toLowerCase','content','string','idField','custom_fields','push','toString','customVariable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','Outbound','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','lastevent','toUpperCase','Inbound','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','replace','parent_type'];(function(_0x3f4c63,_0xfcbd51){var _0x3c4ef7=function(_0x305a81){while(--_0x305a81){_0x3f4c63['push'](_0x3f4c63['shift']());}};_0x3c4ef7(++_0xfcbd51);}(_0x7fcf,0x159));var _0xf7fc=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7fcf[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xf7fc('0x0'));var rp=require(_0xf7fc('0x1'));var BPromise=require(_0xf7fc('0x2'));var md5=require(_0xf7fc('0x3'));var util=require(_0xf7fc('0x4'));var Redis=require(_0xf7fc('0x5'));var intUtil=require(_0xf7fc('0x6'));var config=require(_0xf7fc('0x7'));var logger=require(_0xf7fc('0x8'))('sugarcrm');config[_0xf7fc('0x9')]=_['defaults'](config[_0xf7fc('0x9')],{'host':_0xf7fc('0xa'),'port':0x18eb});var io=require(_0xf7fc('0xb'))(new Redis(config[_0xf7fc('0x9')]));var def={'method':_0xf7fc('0xc'),'json':!![]};function emit(_0x800b36,_0x259249,_0x667aec){io['to'](_0x800b36)[_0xf7fc('0xd')](_0x259249,_0x667aec);}function getTicket(_0x5a7df7,_0x5c6edc,_0x1602a3,_0x5a53c4,_0x91c95a,_0x394a6d,_0x373ab8,_0xc2ee89){logger['info'](_0xf7fc('0xe'));var _0x2c4b22=new Date();var _0x1e8de0=[{'name':'name','value':intUtil[_0xf7fc('0xf')](_0x5a53c4[_0xf7fc('0x10')],_0x91c95a,'\x20')},{'name':_0xf7fc('0x11'),'value':_0x5c6edc['id']},{'name':_0xf7fc('0x12'),'value':_0x5c6edc['id']},{'name':_0xf7fc('0x13'),'value':intUtil[_0xf7fc('0xf')](_0x5a53c4[_0xf7fc('0x14')],_0x91c95a,'\x0a')},{'name':_0xf7fc('0x15'),'value':_0x2c4b22['toISOString']()['slice'](0x0,0x13)[_0xf7fc('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x1602a3['id']},{'name':_0xf7fc('0x17'),'value':_0xf7fc('0x18')},{'name':_0xf7fc('0x19'),'value':_0x1602a3[_0xf7fc('0x1a')]},{'name':'direction','value':_0xc2ee89}];if(_0x394a6d[_0xf7fc('0x1b')]){_[_0xf7fc('0x1c')](_0x394a6d,function(_0x236e22){if(_0x91c95a[_0x236e22[_0xf7fc('0x1d')]]){_0x1e8de0['push']({'name':_0x236e22['idField'],'value':_0x91c95a[_0x236e22[_0xf7fc('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xf7fc('0x1e'),'response_type':_0xf7fc('0x1e'),'rest_data':JSON['stringify']({'session':_0x373ab8['id'],'module_name':'Calls','name_value_list':_0x1e8de0})}});}function getAuth(_0x279a93){return util[_0xf7fc('0x1f')](_0xf7fc('0x20'),new Buffer(_0x279a93[_0xf7fc('0x21')]+':X')['toString']('base64'));}function getServerInfo(_0x3f3374){return request({'form':{'method':_0xf7fc('0x22'),'input_type':_0xf7fc('0x1e'),'response_type':_0xf7fc('0x1e'),'rest_data':JSON[_0xf7fc('0x23')]({'session':_0x3f3374['id']})}});}function getUser(_0x41d2e,_0x5a96b0,_0x45b9fa){if(!_[_0xf7fc('0x24')](_0x5a96b0)){logger['info']('Getting\x20agent\x20with\x20name',_0x5a96b0);return request({'form':{'method':_0xf7fc('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf7fc('0x23')]({'session':_0x45b9fa['id'],'module_name':_0xf7fc('0x26'),'query':util['format'](_0xf7fc('0x27'),_0x5a96b0),'order_by':'','offset':'0','select_fields':['id',_0xf7fc('0x1a'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x421877){if(_0x421877[_0xf7fc('0x28')][_0xf7fc('0x1b')]){var _0x3d1436=_[_0xf7fc('0x29')](_0x421877['entry_list'],function(_0x3d3a86){return _0x3d3a86[_0xf7fc('0x2a')]['user_name'][_0xf7fc('0x2b')]===_0x5a96b0;});if(_0x3d1436){logger[_0xf7fc('0x2c')](_0xf7fc('0x2d'));return BPromise[_0xf7fc('0x2e')]({'id':_0x3d1436[_0xf7fc('0x2a')]['id'][_0xf7fc('0x2b')],'name':_0x3d1436[_0xf7fc('0x2a')][_0xf7fc('0x1a')][_0xf7fc('0x2b')]});}}logger[_0xf7fc('0x2c')](_0xf7fc('0x2f'));return BPromise['resolve']({'id':_0x45b9fa['name_value_list'][_0xf7fc('0x30')]['value'],'name':_0x45b9fa['name_value_list'][_0xf7fc('0x31')][_0xf7fc('0x2b')]});});}else{logger[_0xf7fc('0x2c')](_0xf7fc('0x32'));return BPromise[_0xf7fc('0x2e')]({'id':_0x45b9fa[_0xf7fc('0x2a')][_0xf7fc('0x30')]['value'],'name':_0x45b9fa[_0xf7fc('0x2a')][_0xf7fc('0x31')]['value']});}}function getEndUser(_0x380a5f,_0x2fe3c3,_0x39530a,_0x44b540){logger[_0xf7fc('0x2c')](_0xf7fc('0x33'),_0x39530a);return request({'form':{'method':_0xf7fc('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf7fc('0x23')]({'session':_0x44b540['id'],'module_name':_0xf7fc('0x18'),'query':util[_0xf7fc('0x1f')](_0xf7fc('0x34'),_0x39530a),'order_by':'','offset':'0','select_fields':['id',_0xf7fc('0x1a'),_0xf7fc('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf7fc('0x36')](function(_0x5ae3f4){if(_0x5ae3f4['entry_list']['length']){var _0x313b4a=_[_0xf7fc('0x29')](_0x5ae3f4['entry_list'],function(_0xc629eb){return _0xc629eb[_0xf7fc('0x2a')]['phone_home'][_0xf7fc('0x2b')]===_0x39530a;});if(_0x313b4a){logger[_0xf7fc('0x2c')](_0xf7fc('0x37'));return BPromise[_0xf7fc('0x2e')]({'id':_0x313b4a[_0xf7fc('0x2a')]['id'][_0xf7fc('0x2b')],'name':_0x313b4a[_0xf7fc('0x2a')][_0xf7fc('0x1a')][_0xf7fc('0x2b')],'phone':_0x313b4a[_0xf7fc('0x2a')]['phone_home'][_0xf7fc('0x2b')]});}}else{logger[_0xf7fc('0x2c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xf7fc('0x38'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf7fc('0x23')]({'session':_0x44b540['id'],'module_name':_0xf7fc('0x18'),'name_value_list':[{'name':_0xf7fc('0x39'),'value':_0x2fe3c3!==_0xf7fc('0x3a')?_0x2fe3c3:util[_0xf7fc('0x1f')](_0xf7fc('0x3b'),_0x39530a)},{'name':_0xf7fc('0x35'),'value':_0x39530a}]})}})['then'](function(_0x3d95a3){logger[_0xf7fc('0x2c')]('Enduser\x20created.');return BPromise[_0xf7fc('0x2e')]({'id':_0x3d95a3['id'],'name':_0x3d95a3[_0xf7fc('0x28')][_0xf7fc('0x39')][_0xf7fc('0x2b')],'phone':_0x3d95a3[_0xf7fc('0x28')][_0xf7fc('0x35')][_0xf7fc('0x2b')]});});}});}function request(_0x28f5b5){logger[_0xf7fc('0x3c')](_0xf7fc('0x3d'),JSON['stringify'](_0x28f5b5));return rp(_[_0xf7fc('0x3e')](def,_0x28f5b5));}function getTags(_0x5766c2,_0x849978){var _0x3b315b=[];if(_0x5766c2&&_0x5766c2['length']>0x0){_0x3b315b=_[_0xf7fc('0x3f')](_0x5766c2,_0x849978);}return _0x3b315b;}function getCustomFields(_0x50bd19,_0x5e40c0){var _0x5829eb=[];var _0x1607af={'custom_fields':[]};if(_0x50bd19[_0xf7fc('0x1b')]>0x0){_[_0xf7fc('0x1c')](_0x50bd19,function(_0x4a9bbf){if(_0x4a9bbf[_0xf7fc('0x40')]==='string'&&_0x4a9bbf['nameField']&&!_0x4a9bbf[_0xf7fc('0x41')]){_0x1607af[_0x4a9bbf[_0xf7fc('0x42')][_0xf7fc('0x43')]()]=_0x4a9bbf[_0xf7fc('0x44')]['toString']();}else if(_0x4a9bbf[_0xf7fc('0x40')]===_0xf7fc('0x45')&&_0x4a9bbf[_0xf7fc('0x46')]&&_0x4a9bbf[_0xf7fc('0x41')]){_0x1607af[_0xf7fc('0x47')][_0xf7fc('0x48')]({'id':_0x4a9bbf['idField'],'value':_0x4a9bbf['content'][_0xf7fc('0x49')]()});}else if(_0x4a9bbf['type']==='variable'&&_0x4a9bbf[_0xf7fc('0x1d')]&&_0x4a9bbf[_0xf7fc('0x46')]&&_0x4a9bbf[_0xf7fc('0x41')]){_0x5e40c0[_0x4a9bbf['variableName']]&&_0x1607af['custom_fields'][_0xf7fc('0x48')]({'id':_0x4a9bbf['idField'],'value':_0x5e40c0[_0x4a9bbf[_0xf7fc('0x1d')]][_0xf7fc('0x49')]()});}else if(_0x4a9bbf['type']===_0xf7fc('0x4a')&&_0x4a9bbf[_0xf7fc('0x4b')]&&_0x4a9bbf[_0xf7fc('0x4b')][_0xf7fc('0x1a')]&&_0x4a9bbf['idField']&&_0x4a9bbf[_0xf7fc('0x41')]){_0x5e40c0[_0x4a9bbf['Variable'][_0xf7fc('0x1a')]['toLowerCase']()]&&_0x1607af[_0xf7fc('0x47')][_0xf7fc('0x48')]({'id':_0x4a9bbf[_0xf7fc('0x46')],'value':_0x5e40c0[_0x4a9bbf['Variable'][_0xf7fc('0x1a')][_0xf7fc('0x43')]()]['toString']()});}});}return _0x1607af;}function getConnection(_0x4edf14){return request({'method':_0xf7fc('0xc'),'form':{'method':_0xf7fc('0x4c'),'input_type':'JSON','response_type':_0xf7fc('0x1e'),'rest_data':JSON[_0xf7fc('0x23')]({'user_auth':{'user_name':_0x4edf14['username'],'password':_0x4edf14['password'],'encryption':_0xf7fc('0x4d')},'application':_0xf7fc('0x4e')})}})[_0xf7fc('0x36')](function(_0x26cc1d){var _0x2709a5=_0x26cc1d;if(_0x2709a5['id']){def[_0xf7fc('0x4f')]=_0x2709a5['id'];return BPromise[_0xf7fc('0x2e')](_0x2709a5);}else{throw new Error(util[_0xf7fc('0x1f')](_0xf7fc('0x50'),_0x4edf14['id']));}});}function setRelationship(_0x42463e,_0x166f53,_0x55cc8b,_0x182fb5){return request({'form':{'method':_0xf7fc('0x51'),'input_type':_0xf7fc('0x1e'),'response_type':_0xf7fc('0x1e'),'rest_data':JSON[_0xf7fc('0x23')]({'session':_0x42463e['id'],'module_name':_0xf7fc('0x52'),'module_id':_0x55cc8b['id'],'link_field_name':_0x182fb5,'related_ids':[_0x166f53['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf7fc('0x53')]=function(_0x848cfe,_0x22c221,_0x47d184,_0x20ae0c,_0xf8d7d8,_0x16ca43){var _0x5bfe37,_0x1abb56,_0x3b4979,_0x3497cd;_0x16ca43[_0xf7fc('0x54')]=intUtil[_0xf7fc('0x55')](_0x16ca43[_0xf7fc('0x54')]);_0x16ca43['serverUrl']=intUtil[_0xf7fc('0x55')](_0x16ca43['serverUrl']);def['uri']=util['format'](_0xf7fc('0x56'),_0x16ca43[_0xf7fc('0x54')]);if(_0xf8d7d8&&_0xf8d7d8[_0xf7fc('0x57')]){logger['info'](_0xf7fc('0x58'),_0xf7fc('0x59'));_0x22c221[_0xf7fc('0x5a')]=util['format'](_0xf7fc('0x5b'),_0x16ca43[_0xf7fc('0x5c')],_0x22c221['uniqueid'],md5(_0x22c221[_0xf7fc('0x5d')]));}else{_0x22c221[_0xf7fc('0x5a')]='';}return getConnection(_0x16ca43)['then'](function(_0x3451f8){_0x3497cd=_0x3451f8;return getUser(_0x16ca43,_0x20ae0c[_0xf7fc('0x1a')],_0x3497cd);})[_0xf7fc('0x36')](function(_0x1c5d8a){_0x5bfe37=_0x1c5d8a;logger[_0xf7fc('0x2c')](_0xf7fc('0x5e'),_0x5bfe37['id']);return getEndUser(_0x16ca43,_0x22c221[_0xf7fc('0x5f')],_0x22c221[_0xf7fc('0x60')],_0x3497cd);})[_0xf7fc('0x36')](function(_0x50d757){_0x1abb56=_0x50d757;logger['info'](_0xf7fc('0x61'),_0x1abb56['id']);return getTicket(_0x16ca43,_0x5bfe37,_0x1abb56,_0x47d184,_0x22c221,_0x47d184['Fields'],_0x3497cd,'Inbound');})[_0xf7fc('0x36')](function(_0x157aa6){_0x3b4979=_0x157aa6;logger[_0xf7fc('0x2c')](_0xf7fc('0x62'));logger['info'](_0xf7fc('0x63'),_0x3b4979['id']);return setRelationship(_0x3497cd,_0x5bfe37,_0x3b4979,_0xf7fc('0x64'));})[_0xf7fc('0x36')](function(){return setRelationship(_0x3497cd,_0x1abb56,_0x3b4979,'contacts');})[_0xf7fc('0x36')](function(){return getServerInfo(_0x3497cd);})[_0xf7fc('0x36')](function(_0x2bd97c){var _0x1110b8=parseInt(_0x2bd97c[_0xf7fc('0x65')][_0xf7fc('0x66')](0x0));var _0x26a8ec=util[_0xf7fc('0x1f')](_0xf7fc('0x67'),_0x16ca43[_0xf7fc('0x54')],_0x3b4979['id']);if(_0x1110b8>0x6){_0x26a8ec=util[_0xf7fc('0x1f')](_0xf7fc('0x68'),_0x16ca43[_0xf7fc('0x54')],_0x3b4979['id']);}logger[_0xf7fc('0x2c')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf7fc('0x1f')](_0xf7fc('0x69'),_0x20ae0c[_0xf7fc('0x1a')]),'trigger:browser:url',{'uri':_0x26a8ec});})[_0xf7fc('0x6a')](function(_0x411262){logger[_0xf7fc('0x6b')](_0xf7fc('0x58'),JSON[_0xf7fc('0x23')](_0x411262));});};exports[_0xf7fc('0x6c')]=function(_0x47d368,_0x4e7ddc,_0x2d8d23,_0x4b140e,_0x35e6b4,_0x5a1c07,_0x458ee7){var _0x1b9f1e,_0x1c0326,_0x47e77f,_0x2369bc;_0x5a1c07['remoteUri']=intUtil[_0xf7fc('0x55')](_0x5a1c07[_0xf7fc('0x54')]);_0x5a1c07['serverUrl']=intUtil['stripTrailingSlash'](_0x5a1c07[_0xf7fc('0x5c')]);def[_0xf7fc('0x6d')]=util[_0xf7fc('0x1f')](_0xf7fc('0x56'),_0x5a1c07[_0xf7fc('0x54')]);if(_0x458ee7&&_0x458ee7[_0xf7fc('0x6e')]&&_0x458ee7[_0xf7fc('0x6e')]!==_0xf7fc('0x6f')){logger[_0xf7fc('0x2c')](_0xf7fc('0x70'),'Recording\x20is\x20enabled!');_0x4e7ddc['recordingURL']=util[_0xf7fc('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a1c07[_0xf7fc('0x5c')],_0x4e7ddc[_0xf7fc('0x5d')],md5(_0x4e7ddc['uniqueid']));}return getConnection(_0x5a1c07)[_0xf7fc('0x36')](function(_0x24ee73){_0x2369bc=_0x24ee73;return getUser(_0x5a1c07,_0x4b140e[_0xf7fc('0x1a')],_0x2369bc);})[_0xf7fc('0x36')](function(_0x4ec6cf){_0x1b9f1e=_0x4ec6cf;logger[_0xf7fc('0x2c')]('The\x20User\x20ID\x20is:',_0x1b9f1e['id']);return getEndUser(_0x5a1c07,_0x4e7ddc[_0xf7fc('0x71')],_0x4e7ddc['destcalleridnum'],_0x2369bc);})[_0xf7fc('0x36')](function(_0x3366eb){_0x1c0326=_0x3366eb;logger[_0xf7fc('0x2c')]('The\x20Enduser\x20ID\x20is:',_0x1c0326['id']);return getTicket(_0x5a1c07,_0x1b9f1e,_0x1c0326,_0x2d8d23,_0x4e7ddc,_0x2d8d23[_0xf7fc('0x72')],_0x2369bc,_0xf7fc('0x73'));})['then'](function(_0x5ab513){_0x47e77f=_0x5ab513;logger[_0xf7fc('0x2c')](_0xf7fc('0x62'));logger['info'](_0xf7fc('0x63'),_0x47e77f['id']);return setRelationship(_0x2369bc,_0x1b9f1e,_0x47e77f,_0xf7fc('0x64'));})[_0xf7fc('0x36')](function(){return setRelationship(_0x2369bc,_0x1c0326,_0x47e77f,_0xf7fc('0x74'));})[_0xf7fc('0x36')](function(){return getServerInfo(_0x2369bc);})[_0xf7fc('0x36')](function(_0x3a8270){var _0x1da282=parseInt(_0x3a8270[_0xf7fc('0x65')]['charAt'](0x0));var _0x5cbb1e=util[_0xf7fc('0x1f')](_0xf7fc('0x67'),_0x5a1c07[_0xf7fc('0x54')],_0x47e77f['id']);if(_0x1da282>0x6){_0x5cbb1e=util[_0xf7fc('0x1f')](_0xf7fc('0x68'),_0x5a1c07[_0xf7fc('0x54')],_0x47e77f['id']);}logger[_0xf7fc('0x2c')]('[OUTBOUND]',_0xf7fc('0x75'));emit(util[_0xf7fc('0x1f')]('user:%s',_0x4b140e[_0xf7fc('0x1a')]),_0xf7fc('0x76'),{'uri':_0x5cbb1e});})[_0xf7fc('0x6a')](function(_0x2e1d12){logger[_0xf7fc('0x6b')]('[OUTBOUND]',JSON['stringify'](_0x2e1d12));});};exports[_0xf7fc('0x77')]=function(_0x5b6bcb,_0x2aae74,_0x1a266d,_0x39b7f6,_0x885504,_0x5427d5){var _0x5d49ec,_0x32ef63,_0x117268,_0x191c52;_0x5427d5[_0xf7fc('0x54')]=intUtil['stripTrailingSlash'](_0x5427d5[_0xf7fc('0x54')]);_0x5427d5[_0xf7fc('0x5c')]=intUtil[_0xf7fc('0x55')](_0x5427d5[_0xf7fc('0x5c')]);def[_0xf7fc('0x6d')]=util[_0xf7fc('0x1f')](_0xf7fc('0x56'),_0x5427d5[_0xf7fc('0x54')]);if(_0x885504&&_0x885504[_0xf7fc('0x57')]){logger[_0xf7fc('0x2c')]('['+_0x2aae74[_0xf7fc('0x78')][_0xf7fc('0x79')]()+']',_0xf7fc('0x59'));_0x2aae74[_0xf7fc('0x5a')]=util['format'](_0xf7fc('0x5b'),_0x5427d5[_0xf7fc('0x5c')],_0x2aae74[_0xf7fc('0x5d')],md5(_0x2aae74['uniqueid']));}else{_0x2aae74[_0xf7fc('0x5a')]='';}return getConnection(_0x5427d5)[_0xf7fc('0x36')](function(_0xa97f19){_0x191c52=_0xa97f19;if(!_[_0xf7fc('0x24')](_0x39b7f6)){return getUser(_0x5427d5,_0x39b7f6['name'],_0x191c52);}else{return getUser(_0x5427d5,null,_0x191c52);}})[_0xf7fc('0x36')](function(_0x4577d0){_0x5d49ec=_0x4577d0;logger['info'](_0xf7fc('0x5e'),_0x5d49ec['id']);return getEndUser(_0x5427d5,_0x2aae74[_0xf7fc('0x5f')],_0x2aae74[_0xf7fc('0x60')],_0x191c52);})[_0xf7fc('0x36')](function(_0x108675){_0x32ef63=_0x108675;logger[_0xf7fc('0x2c')]('The\x20Enduser\x20ID\x20is:',_0x32ef63['id']);return getTicket(_0x5427d5,_0x5d49ec,_0x32ef63,_0x1a266d,_0x2aae74,_0x1a266d['Fields'],_0x191c52,_0xf7fc('0x7a'));})[_0xf7fc('0x36')](function(_0x57c20c){_0x117268=_0x57c20c;logger['info'](_0xf7fc('0x62'));logger[_0xf7fc('0x2c')](_0xf7fc('0x63'),_0x117268['id']);return setRelationship(_0x191c52,_0x5d49ec,_0x117268,_0xf7fc('0x64'));})[_0xf7fc('0x36')](function(){return setRelationship(_0x191c52,_0x32ef63,_0x117268,_0xf7fc('0x74'));})['then'](function(){return getServerInfo(_0x191c52);})[_0xf7fc('0x6a')](function(_0x584db8){logger[_0xf7fc('0x6b')]('['+_0x2aae74[_0xf7fc('0x78')]['toUpperCase']()+']',JSON[_0xf7fc('0x23')](_0x584db8));});}; \ 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 a97578d..d7cfa5b 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 _0x0322=['format','%s:\x20%s','keyContent','keyType','variable','stripTrailingSlash','substring','validateEmail','isNil','test','getString','sortBy','length','type','push','content','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','string','key'];(function(_0x3522ed,_0x3d237c){var _0x48ca2a=function(_0x561020){while(--_0x561020){_0x3522ed['push'](_0x3522ed['shift']());}};_0x48ca2a(++_0x3d237c);}(_0x0322,0x87));var _0x2032=function(_0x40b50c,_0x1c1f08){_0x40b50c=_0x40b50c-0x0;var _0x135895=_0x0322[_0x40b50c];return _0x135895;};'use strict';var _=require('lodash');var util=require('util');exports[_0x2032('0x0')]=function(_0x21f02a,_0x4de9bc,_0x440d37){var _0x5ca65b=[];if(_0x21f02a['length']>0x0){var _0x51ffc6=_[_0x2032('0x1')](_0x21f02a,['id']);for(var _0x1db032=0x0;_0x1db032<_0x51ffc6[_0x2032('0x2')];_0x1db032++){var _0xfbcde3=_0x51ffc6[_0x1db032];if(_0xfbcde3[_0x2032('0x3')]==='string'){_0x5ca65b[_0x2032('0x4')](_0xfbcde3[_0x2032('0x5')]);}else if(_0xfbcde3[_0x2032('0x3')]==='variable'&&_0xfbcde3[_0x2032('0x6')]){_0x4de9bc[_0xfbcde3[_0x2032('0x6')]]&&_0x5ca65b[_0x2032('0x4')](_0x4de9bc[_0xfbcde3['variableName']][_0x2032('0x7')]());}else if(_0xfbcde3[_0x2032('0x3')]===_0x2032('0x8')&&_0xfbcde3['Variable']&&_0xfbcde3['Variable'][_0x2032('0x9')]){_0x4de9bc[_0xfbcde3[_0x2032('0xa')][_0x2032('0x9')][_0x2032('0xb')]()]&&_0x5ca65b[_0x2032('0x4')](_0x4de9bc[_0xfbcde3[_0x2032('0xa')][_0x2032('0x9')][_0x2032('0xb')]()][_0x2032('0x7')]());}else if(_0xfbcde3[_0x2032('0x3')]===_0x2032('0xc')){if(_0xfbcde3['keyType']===_0x2032('0xd')&&_0xfbcde3[_0x2032('0xe')]){_0x5ca65b[_0x2032('0x4')](util[_0x2032('0xf')](_0x2032('0x10'),_0xfbcde3[_0x2032('0xe')],_0xfbcde3[_0x2032('0x11')]));}else if(_0xfbcde3[_0x2032('0x12')]===_0x2032('0x13')&&_0xfbcde3[_0x2032('0x6')]&&_0xfbcde3[_0x2032('0xe')]){_0x4de9bc[_0xfbcde3[_0x2032('0x6')]]&&_0x5ca65b[_0x2032('0x4')](util[_0x2032('0xf')](_0x2032('0x10'),_0xfbcde3[_0x2032('0xe')],_0x4de9bc[_0xfbcde3[_0x2032('0x6')]]));}else if(_0xfbcde3[_0x2032('0x12')]===_0x2032('0x8')&&_0xfbcde3[_0x2032('0xa')]&&_0xfbcde3[_0x2032('0xa')][_0x2032('0x9')]&&_0xfbcde3[_0x2032('0xe')]){_0x4de9bc[_0xfbcde3['Variable'][_0x2032('0x9')][_0x2032('0xb')]()]&&_0x5ca65b[_0x2032('0x4')](util[_0x2032('0xf')](_0x2032('0x10'),_0xfbcde3[_0x2032('0xe')],_0x4de9bc[_0xfbcde3[_0x2032('0xa')][_0x2032('0x9')][_0x2032('0xb')]()]));}}}}return _0x5ca65b['join'](_0x440d37);};exports[_0x2032('0x14')]=function(_0x25714a){var _0x44c9e9=_0x25714a['slice'](-0x1);if(_0x44c9e9==='/'){_0x25714a=_0x25714a[_0x2032('0x15')](0x0,_0x25714a['lastIndexOf'](_0x44c9e9));}return _0x25714a;};exports[_0x2032('0x16')]=function(_0xe3fa63){if(!_[_0x2032('0x17')](_0xe3fa63)&&_0xe3fa63!==''){var _0x5a9b65=/^(([^<>()\[\]\\.,;:\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 _0x5a9b65[_0x2032('0x18')](String(_0xe3fa63)[_0x2032('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xad21=['keyType','key','format','keyContent','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','lodash','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x4d8d8b,_0x40c3b0){var _0x672730=function(_0x398b7b){while(--_0x398b7b){_0x4d8d8b['push'](_0x4d8d8b['shift']());}};_0x672730(++_0x40c3b0);}(_0xad21,0x1d6));var _0x1ad2=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0xad21[_0x2bd88d];return _0x5516d4;};'use strict';var _=require(_0x1ad2('0x0'));var util=require(_0x1ad2('0x1'));exports[_0x1ad2('0x2')]=function(_0x27f571,_0xde99f3,_0x131a77){var _0x21aa4f=[];if(_0x27f571[_0x1ad2('0x3')]>0x0){var _0x4f6413=_['sortBy'](_0x27f571,['id']);for(var _0x290ae8=0x0;_0x290ae8<_0x4f6413[_0x1ad2('0x3')];_0x290ae8++){var _0x1de749=_0x4f6413[_0x290ae8];if(_0x1de749[_0x1ad2('0x4')]===_0x1ad2('0x5')){_0x21aa4f[_0x1ad2('0x6')](_0x1de749[_0x1ad2('0x7')]);}else if(_0x1de749['type']===_0x1ad2('0x8')&&_0x1de749['variableName']){_0xde99f3[_0x1de749[_0x1ad2('0x9')]]&&_0x21aa4f[_0x1ad2('0x6')](_0xde99f3[_0x1de749[_0x1ad2('0x9')]][_0x1ad2('0xa')]());}else if(_0x1de749[_0x1ad2('0x4')]===_0x1ad2('0xb')&&_0x1de749[_0x1ad2('0xc')]&&_0x1de749[_0x1ad2('0xc')][_0x1ad2('0xd')]){_0xde99f3[_0x1de749['Variable'][_0x1ad2('0xd')][_0x1ad2('0xe')]()]&&_0x21aa4f[_0x1ad2('0x6')](_0xde99f3[_0x1de749[_0x1ad2('0xc')][_0x1ad2('0xd')][_0x1ad2('0xe')]()][_0x1ad2('0xa')]());}else if(_0x1de749[_0x1ad2('0x4')]===_0x1ad2('0xf')){if(_0x1de749[_0x1ad2('0x10')]===_0x1ad2('0x5')&&_0x1de749[_0x1ad2('0x11')]){_0x21aa4f[_0x1ad2('0x6')](util[_0x1ad2('0x12')]('%s:\x20%s',_0x1de749['key'],_0x1de749[_0x1ad2('0x13')]));}else if(_0x1de749[_0x1ad2('0x10')]===_0x1ad2('0x8')&&_0x1de749[_0x1ad2('0x9')]&&_0x1de749[_0x1ad2('0x11')]){_0xde99f3[_0x1de749[_0x1ad2('0x9')]]&&_0x21aa4f[_0x1ad2('0x6')](util[_0x1ad2('0x12')](_0x1ad2('0x14'),_0x1de749[_0x1ad2('0x11')],_0xde99f3[_0x1de749['variableName']]));}else if(_0x1de749[_0x1ad2('0x10')]==='customVariable'&&_0x1de749[_0x1ad2('0xc')]&&_0x1de749[_0x1ad2('0xc')][_0x1ad2('0xd')]&&_0x1de749['key']){_0xde99f3[_0x1de749[_0x1ad2('0xc')][_0x1ad2('0xd')]['toLowerCase']()]&&_0x21aa4f[_0x1ad2('0x6')](util[_0x1ad2('0x12')](_0x1ad2('0x14'),_0x1de749[_0x1ad2('0x11')],_0xde99f3[_0x1de749['Variable'][_0x1ad2('0xd')][_0x1ad2('0xe')]()]));}}}}return _0x21aa4f['join'](_0x131a77);};exports[_0x1ad2('0x15')]=function(_0x535857){var _0x5dc770=_0x535857[_0x1ad2('0x16')](-0x1);if(_0x5dc770==='/'){_0x535857=_0x535857[_0x1ad2('0x17')](0x0,_0x535857[_0x1ad2('0x18')](_0x5dc770));}return _0x535857;};exports['validateEmail']=function(_0x16c7c1){if(!_[_0x1ad2('0x19')](_0x16c7c1)&&_0x16c7c1!==''){var _0x3e7579=/^(([^<>()\[\]\\.,;:\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 _0x3e7579[_0x1ad2('0x1a')](String(_0x16c7c1)['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 e9b435f..e5d73d3 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _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(_0x310482,_0x51c144){var _0x4320b0=function(_0x12d875){while(--_0x12d875){_0x310482['push'](_0x310482['shift']());}};_0x4320b0(++_0x51c144);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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 58e261d..64c3afb 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 _0xdb7d=['authType','password','%s:%s','username','token','%s/token:%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','nameField','content','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','customField','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','inspect','outbound','recordingFormat','none','email','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','catch','unmanaged','monitor_format','toUpperCase','md5','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','%s/users.json','Enduser\x20created.'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdb7d,0x113));var _0xddb7=function(_0x30eebc,_0x56e79e){_0x30eebc=_0x30eebc-0x0;var _0x727f06=_0xdb7d[_0x30eebc];return _0x727f06;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xddb7('0x0'));var util=require('util');var Redis=require(_0xddb7('0x1'));var intUtil=require('./util');var config=require(_0xddb7('0x2'));var logger=require('../../../../config/logger')('zendesk');config[_0xddb7('0x3')]=_[_0xddb7('0x4')](config['redis'],{'host':_0xddb7('0x5'),'port':0x18eb});var io=require(_0xddb7('0x6'))(new Redis(config['redis']));function emit(_0x40ad27,_0x4b5373,_0x15fa63){io['to'](_0x40ad27)['emit'](_0x4b5373,_0x15fa63);}var headers={'Content-Type':_0xddb7('0x7'),'Accept':_0xddb7('0x7')};function getTicket(_0x433468,_0x12b281,_0x42dc8b,_0x32932c,_0xcf7f5b){logger[_0xddb7('0x8')](_0xddb7('0x9'));return request({'uri':util[_0xddb7('0xa')](_0xddb7('0xb'),_0x433468[_0xddb7('0xc')]),'method':_0xddb7('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x42dc8b['id'],'submitter_id':_0x12b281?_0x12b281['id']:undefined,'assignee_id':_0x12b281?_0x12b281['id']:undefined,'tags':getTags(_0x32932c[_0xddb7('0xe')],'name'),'subject':intUtil[_0xddb7('0xf')](_0x32932c[_0xddb7('0x10')],_0xcf7f5b,'\x20'),'description':intUtil[_0xddb7('0xf')](_0x32932c[_0xddb7('0x11')],_0xcf7f5b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xddb7('0xf')](_0x32932c[_0xddb7('0x11')],_0xcf7f5b,'\x0a')}},getCustomFields(_0x32932c[_0xddb7('0x12')],_0xcf7f5b))}})[_0xddb7('0x13')](function(_0x47e436){logger[_0xddb7('0x8')](_0xddb7('0x14'));return _0x47e436['ticket'];});}function getUser(_0x4a0423,_0x505c96){if(intUtil[_0xddb7('0x15')](_0x505c96)){logger[_0xddb7('0x8')](_0xddb7('0x16'),_0x505c96);return request({'uri':util[_0xddb7('0xa')](_0xddb7('0x17'),_0x4a0423[_0xddb7('0xc')]),'qs':{'query':util[_0xddb7('0xa')](_0xddb7('0x18'),_0x505c96)}})['then'](function(_0x2302d3){if(_0x2302d3[_0xddb7('0x19')]){logger[_0xddb7('0x8')](_0xddb7('0x1a'));return _[_0xddb7('0x1b')](_0x2302d3[_0xddb7('0x1c')],{'email':_0x505c96,'role':'agent'});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xddb7('0xa')](_0xddb7('0x1d'),_0x4a0423[_0xddb7('0xc')])})[_0xddb7('0x13')](function(_0xbb5a76){logger[_0xddb7('0x8')](_0xddb7('0x1e'));return _0xbb5a76[_0xddb7('0x1f')];});}});}else{logger[_0xddb7('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xddb7('0xa')]('%s/users/me.json',_0x4a0423[_0xddb7('0xc')])})[_0xddb7('0x13')](function(_0x580257){logger[_0xddb7('0x8')](_0xddb7('0x1e'));return _0x580257[_0xddb7('0x1f')];});}}function getEndUser(_0x331cc9,_0x597e0a,_0x140722){logger[_0xddb7('0x8')](_0xddb7('0x20'),_0x140722);return request({'uri':util['format'](_0xddb7('0x17'),_0x331cc9[_0xddb7('0xc')]),'qs':{'query':util['format'](_0xddb7('0x21'),_0x140722)}})[_0xddb7('0x13')](function(_0x13a7d5){var _0x1ca5b5;if(_0x13a7d5[_0xddb7('0x1c')][_0xddb7('0x22')]){_0x13a7d5[_0xddb7('0x1c')]=_['filter'](_0x13a7d5[_0xddb7('0x1c')],{'suspended':![],'role':_0xddb7('0x23')});if(_0x13a7d5[_0xddb7('0x1c')]['length']){_0x1ca5b5=_[_0xddb7('0x24')](_0x13a7d5['results']);}}if(_0x1ca5b5){logger['info'](_0xddb7('0x25'));return _0x1ca5b5;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xddb7('0xa')](_0xddb7('0x26'),_0x331cc9['remoteUri']),'method':_0xddb7('0xd'),'body':{'user':{'role':_0xddb7('0x23'),'name':util[_0xddb7('0xa')]('Caller\x20-\x20%s',_0x597e0a||_0x140722),'phone':_0x140722}}})['then'](function(_0x18d02d){logger[_0xddb7('0x8')](_0xddb7('0x27'));return _0x18d02d[_0xddb7('0x1f')];});}});}function getAuth(_0x39c9cd){var _0x475fe8;if(_0x39c9cd[_0xddb7('0x28')]===_0xddb7('0x29')){_0x475fe8=util[_0xddb7('0xa')](_0xddb7('0x2a'),_0x39c9cd[_0xddb7('0x2b')],_0x39c9cd['password']);}else if(_0x39c9cd[_0xddb7('0x28')]===_0xddb7('0x2c')){_0x475fe8=util['format'](_0xddb7('0x2d'),_0x39c9cd[_0xddb7('0x2b')],_0x39c9cd[_0xddb7('0x2c')]);}return util[_0xddb7('0xa')]('Basic\x20%s',new Buffer(_0x475fe8)[_0xddb7('0x2e')]('base64'));}function request(_0x232ce2){logger[_0xddb7('0x2f')](_0xddb7('0x30'),JSON[_0xddb7('0x31')](_0x232ce2));return rp(_['defaults'](_0x232ce2,{'method':_0xddb7('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x389c4f,_0x8c0a56){var _0x18aa36=[];if(_0x389c4f&&_0x389c4f[_0xddb7('0x22')]>0x0){_0x18aa36=_[_0xddb7('0x33')](_0x389c4f,_0x8c0a56);}return _0x18aa36;}function getCustomFields(_0x211561,_0x10a8d4){var _0x408842=[];var _0xc3cc27={'custom_fields':[]};if(_0x211561['length']>0x0){_[_0xddb7('0x34')](_0x211561,function(_0x264222){if(_[_0xddb7('0x35')](['string',_0xddb7('0x36')],_0x264222[_0xddb7('0x37')])&&_0x264222[_0xddb7('0x38')]&&!_0x264222['customField']){_0xc3cc27[_0x264222[_0xddb7('0x38')]['toLowerCase']()]=_0x264222[_0xddb7('0x39')][_0xddb7('0x2e')]();}else if(_[_0xddb7('0x35')]([_0xddb7('0x3a'),'picklist'],_0x264222[_0xddb7('0x37')])&&_0x264222[_0xddb7('0x3b')]&&_0x264222['customField']){_0xc3cc27[_0xddb7('0x3c')][_0xddb7('0x3d')]({'id':_0x264222[_0xddb7('0x3b')],'value':_0x264222[_0xddb7('0x39')][_0xddb7('0x2e')]()});}else if(_0x264222['type']===_0xddb7('0x3e')&&_0x264222[_0xddb7('0x3f')]&&_0x264222[_0xddb7('0x3b')]&&_0x264222['customField']){_0x10a8d4[_0x264222[_0xddb7('0x3f')]]&&_0xc3cc27['custom_fields'][_0xddb7('0x3d')]({'id':_0x264222[_0xddb7('0x3b')],'value':_0x10a8d4[_0x264222['variableName']][_0xddb7('0x2e')]()});}else if(_0x264222[_0xddb7('0x37')]===_0xddb7('0x40')&&_0x264222[_0xddb7('0x41')]&&_0x264222[_0xddb7('0x41')][_0xddb7('0x42')]&&_0x264222['idField']&&_0x264222[_0xddb7('0x43')]){_0x10a8d4[_0x264222[_0xddb7('0x41')][_0xddb7('0x42')][_0xddb7('0x44')]()]&&_0xc3cc27['custom_fields'][_0xddb7('0x3d')]({'id':_0x264222[_0xddb7('0x3b')],'value':_0x10a8d4[_0x264222['Variable'][_0xddb7('0x42')]['toLowerCase']()][_0xddb7('0x2e')]()});}});}return _0xc3cc27;}exports[_0xddb7('0x45')]=function(_0x61327,_0x52560c,_0x338197,_0x168aa9,_0x153690,_0x2ad237){var _0x2d3c5e,_0x12b576;_0x2ad237[_0xddb7('0xc')]=intUtil[_0xddb7('0x46')](_0x2ad237[_0xddb7('0xc')]);_0x2ad237[_0xddb7('0x47')]=intUtil[_0xddb7('0x46')](_0x2ad237['serverUrl']);if(_0x153690&&_0x153690['monitor_format']){logger[_0xddb7('0x8')]('[QUEUE]',_0xddb7('0x48'));_0x52560c[_0xddb7('0x49')]=util[_0xddb7('0xa')](_0xddb7('0x4a'),_0x2ad237[_0xddb7('0x47')],_0x52560c[_0xddb7('0x4b')],md5(_0x52560c['uniqueid']));}else{_0x52560c[_0xddb7('0x49')]='';}headers[_0xddb7('0x4c')]=getAuth(_0x2ad237);return getUser(_0x2ad237,_0x168aa9['email'])[_0xddb7('0x13')](function(_0x14531b){_0x2d3c5e=_0x14531b;logger[_0xddb7('0x8')](_0xddb7('0x4d'),_0x2d3c5e['id']);return getEndUser(_0x2ad237,_0x52560c[_0xddb7('0x4e')],_0x52560c[_0xddb7('0x4f')]);})[_0xddb7('0x13')](function(_0x56a4da){_0x12b576=_0x56a4da;logger['info'](_0xddb7('0x50'),_0x12b576['id']);return getTicket(_0x2ad237,_0x2d3c5e,_0x12b576,_0x338197,_0x52560c);})[_0xddb7('0x13')](function(_0x2aed24){if(_0x2aed24){logger[_0xddb7('0x8')]('The\x20Ticket\x20ID\x20is:',_0x2aed24['id']);switch(_0x2ad237[_0xddb7('0x37')]){case _0xddb7('0x51'):logger[_0xddb7('0x8')](_0xddb7('0x52'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xddb7('0xa')](_0xddb7('0x53'),_0x2ad237[_0xddb7('0xc')],_0x2d3c5e['id'],_0x2aed24['id']),'method':'POST'});case _0xddb7('0x54'):logger[_0xddb7('0x8')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xddb7('0xa')](_0xddb7('0x55'),_0x168aa9[_0xddb7('0x42')]),_0xddb7('0x56'),{'uri':util[_0xddb7('0xa')](_0xddb7('0x57'),_0x2ad237['remoteUri']['replace'](_0xddb7('0x58'),''),_0x2aed24['id'])});break;default:logger['error']('[QUEUE]',_0xddb7('0x59'));}}})['catch'](function(_0x49f5c4){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xddb7('0x5a')](_0x49f5c4,{'showHidden':!![],'depth':null}));});};exports[_0xddb7('0x5b')]=function(_0x5e1a3e,_0x7f704,_0x18e204,_0x18ece0,_0x5c1bc8,_0xec013,_0x3f0840){var _0x3059c3,_0x4d6a67;_0xec013[_0xddb7('0xc')]=intUtil[_0xddb7('0x46')](_0xec013['remoteUri']);_0xec013[_0xddb7('0x47')]=intUtil[_0xddb7('0x46')](_0xec013[_0xddb7('0x47')]);if(_0x3f0840&&_0x3f0840[_0xddb7('0x5c')]&&_0x3f0840['recordingFormat']!==_0xddb7('0x5d')){logger[_0xddb7('0x8')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x7f704[_0xddb7('0x49')]=util[_0xddb7('0xa')](_0xddb7('0x4a'),_0xec013['serverUrl'],_0x7f704['uniqueid'],md5(_0x7f704[_0xddb7('0x4b')]));}headers[_0xddb7('0x4c')]=getAuth(_0xec013);return getUser(_0xec013,_0x18ece0[_0xddb7('0x5e')])['then'](function(_0x1bbd35){_0x3059c3=_0x1bbd35;logger[_0xddb7('0x8')](_0xddb7('0x4d'),_0x3059c3['id']);return getEndUser(_0xec013,_0x7f704['destcalleridname'],_0x7f704[_0xddb7('0x5f')]);})['then'](function(_0x4ada2b){_0x4d6a67=_0x4ada2b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4d6a67['id']);return getTicket(_0xec013,_0x3059c3,_0x4d6a67,_0x18e204,_0x7f704);})['then'](function(_0x5a7e66){if(_0x5a7e66){logger['info'](_0xddb7('0x60'),_0x5a7e66['id']);switch(_0xec013[_0xddb7('0x37')]){case _0xddb7('0x51'):logger[_0xddb7('0x8')](_0xddb7('0x61'),_0xddb7('0x62'));return request({'uri':util[_0xddb7('0xa')](_0xddb7('0x53'),_0xec013[_0xddb7('0xc')],_0x3059c3['id'],_0x5a7e66['id']),'method':'POST'});case'newTab':logger['info'](_0xddb7('0x61'),_0xddb7('0x63'));emit(util[_0xddb7('0xa')](_0xddb7('0x55'),_0x18ece0[_0xddb7('0x42')]),_0xddb7('0x56'),{'uri':util[_0xddb7('0xa')](_0xddb7('0x57'),_0xec013['remoteUri']['replace'](_0xddb7('0x58'),''),_0x5a7e66['id'])});break;default:logger[_0xddb7('0x64')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xddb7('0x65')](function(_0x3ba5b2){logger[_0xddb7('0x64')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3ba5b2,{'showHidden':!![],'depth':null}));});};exports[_0xddb7('0x66')]=function(_0x3ab8c0,_0x5964da,_0xb6ff00,_0x3ecd7f,_0x3f470b,_0x19f0ff){var _0x5785ce,_0x3a61c5;_0x19f0ff['remoteUri']=intUtil[_0xddb7('0x46')](_0x19f0ff['remoteUri']);_0x19f0ff[_0xddb7('0x47')]=intUtil[_0xddb7('0x46')](_0x19f0ff[_0xddb7('0x47')]);if(_0x3f470b&&_0x3f470b[_0xddb7('0x67')]){logger[_0xddb7('0x8')]('['+_0x5964da['lastevent'][_0xddb7('0x68')]()+']',_0xddb7('0x48'));_0x5964da['recordingURL']=util[_0xddb7('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19f0ff[_0xddb7('0x47')],_0x5964da['uniqueid'],md5(_0x5964da[_0xddb7('0x4b')]));}else{_0x5964da[_0xddb7('0x49')]='';}headers[_0xddb7('0x4c')]=getAuth(_0x19f0ff);return getUser(_0x19f0ff)[_0xddb7('0x13')](function(_0x36f2b9){_0x5785ce=_0x36f2b9;logger[_0xddb7('0x8')]('The\x20User\x20ID\x20is:',_0x5785ce['id']);return getEndUser(_0x19f0ff,_0x5964da[_0xddb7('0x4e')],_0x5964da[_0xddb7('0x4f')]);})['then'](function(_0x136e5e){_0x3a61c5=_0x136e5e;logger[_0xddb7('0x8')](_0xddb7('0x50'),_0x3a61c5['id']);return getTicket(_0x19f0ff,_0x5785ce,_0x3a61c5,_0xb6ff00,_0x5964da);})[_0xddb7('0x13')](function(_0x119521){if(_0x119521){logger[_0xddb7('0x8')](_0xddb7('0x60'),_0x119521['id']);}})[_0xddb7('0x65')](function(_0x3ab245){logger[_0xddb7('0x64')]('['+_0x5964da['lastevent'][_0xddb7('0x68')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3ab245,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0516=['request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','emit','application/json','info','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','format','type:user\x20role:agent\x20email:%s','count','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','authType','token','%s/token:%s','username','Basic\x20%s','toString','[HTTP]','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','catch','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','destcalleridname','destcalleridnum','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','lastevent','lodash'];(function(_0x452456,_0xfd55fa){var _0x41bac5=function(_0x53dd45){while(--_0x53dd45){_0x452456['push'](_0x452456['shift']());}};_0x41bac5(++_0xfd55fa);}(_0x0516,0x146));var _0x6051=function(_0x47cd62,_0x19bbf3){_0x47cd62=_0x47cd62-0x0;var _0x7923b9=_0x0516[_0x47cd62];return _0x7923b9;};'use strict';var _=require(_0x6051('0x0'));var rp=require(_0x6051('0x1'));var md5=require(_0x6051('0x2'));var util=require(_0x6051('0x3'));var Redis=require(_0x6051('0x4'));var intUtil=require(_0x6051('0x5'));var config=require(_0x6051('0x6'));var logger=require(_0x6051('0x7'))('zendesk');config[_0x6051('0x8')]=_['defaults'](config[_0x6051('0x8')],{'host':_0x6051('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6051('0x8')]));function emit(_0x1caa49,_0x438099,_0x3c2cf6){io['to'](_0x1caa49)[_0x6051('0xa')](_0x438099,_0x3c2cf6);}var headers={'Content-Type':_0x6051('0xb'),'Accept':_0x6051('0xb')};function getTicket(_0x2f8c6e,_0x375077,_0x11390d,_0x2a4401,_0x1f284c){logger[_0x6051('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format']('%s/tickets.json',_0x2f8c6e[_0x6051('0xd')]),'method':_0x6051('0xe'),'body':{'ticket':_[_0x6051('0xf')]({'requester_id':_0x11390d['id'],'submitter_id':_0x375077?_0x375077['id']:undefined,'assignee_id':_0x375077?_0x375077['id']:undefined,'tags':getTags(_0x2a4401[_0x6051('0x10')],'name'),'subject':intUtil[_0x6051('0x11')](_0x2a4401[_0x6051('0x12')],_0x1f284c,'\x20'),'description':intUtil[_0x6051('0x11')](_0x2a4401[_0x6051('0x13')],_0x1f284c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2a4401[_0x6051('0x13')],_0x1f284c,'\x0a')}},getCustomFields(_0x2a4401[_0x6051('0x14')],_0x1f284c))}})[_0x6051('0x15')](function(_0x509e17){logger[_0x6051('0xc')](_0x6051('0x16'));return _0x509e17[_0x6051('0x17')];});}function getUser(_0x4dd2a1,_0x4bc326){if(intUtil['validateEmail'](_0x4bc326)){logger[_0x6051('0xc')]('Getting\x20agent\x20with\x20email',_0x4bc326);return request({'uri':util['format']('%s/search.json',_0x4dd2a1[_0x6051('0xd')]),'qs':{'query':util[_0x6051('0x18')](_0x6051('0x19'),_0x4bc326)}})[_0x6051('0x15')](function(_0x31c2ad){if(_0x31c2ad[_0x6051('0x1a')]){logger['info']('Agent\x20found!');return _['find'](_0x31c2ad[_0x6051('0x1b')],{'email':_0x4bc326,'role':_0x6051('0x1c')});}else{logger[_0x6051('0xc')](_0x6051('0x1d'));return request({'uri':util[_0x6051('0x18')](_0x6051('0x1e'),_0x4dd2a1['remoteUri'])})[_0x6051('0x15')](function(_0xcabda8){logger[_0x6051('0xc')](_0x6051('0x1f'));return _0xcabda8[_0x6051('0x20')];});}});}else{logger[_0x6051('0xc')](_0x6051('0x1d'));return request({'uri':util[_0x6051('0x18')](_0x6051('0x1e'),_0x4dd2a1['remoteUri'])})[_0x6051('0x15')](function(_0x3a188a){logger['info'](_0x6051('0x1f'));return _0x3a188a[_0x6051('0x20')];});}}function getEndUser(_0x482c27,_0x43adfe,_0x2daf15){logger['info'](_0x6051('0x21'),_0x2daf15);return request({'uri':util[_0x6051('0x18')](_0x6051('0x22'),_0x482c27['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2daf15)}})['then'](function(_0x5c9b3c){var _0x4820a7;if(_0x5c9b3c['results'][_0x6051('0x23')]){_0x5c9b3c['results']=_[_0x6051('0x24')](_0x5c9b3c[_0x6051('0x1b')],{'suspended':![],'role':'end-user'});if(_0x5c9b3c[_0x6051('0x1b')]['length']){_0x4820a7=_['first'](_0x5c9b3c[_0x6051('0x1b')]);}}if(_0x4820a7){logger[_0x6051('0xc')](_0x6051('0x25'));return _0x4820a7;}else{logger['info'](_0x6051('0x26'));return request({'uri':util[_0x6051('0x18')](_0x6051('0x27'),_0x482c27[_0x6051('0xd')]),'method':_0x6051('0xe'),'body':{'user':{'role':_0x6051('0x28'),'name':util[_0x6051('0x18')](_0x6051('0x29'),_0x43adfe||_0x2daf15),'phone':_0x2daf15}}})[_0x6051('0x15')](function(_0xd6e1c2){logger['info'](_0x6051('0x2a'));return _0xd6e1c2[_0x6051('0x20')];});}});}function getAuth(_0x1910d7){var _0x1e3fbd;if(_0x1910d7['authType']===_0x6051('0x2b')){_0x1e3fbd=util[_0x6051('0x18')]('%s:%s',_0x1910d7['username'],_0x1910d7[_0x6051('0x2b')]);}else if(_0x1910d7[_0x6051('0x2c')]===_0x6051('0x2d')){_0x1e3fbd=util[_0x6051('0x18')](_0x6051('0x2e'),_0x1910d7[_0x6051('0x2f')],_0x1910d7[_0x6051('0x2d')]);}return util[_0x6051('0x18')](_0x6051('0x30'),new Buffer(_0x1e3fbd)[_0x6051('0x31')]('base64'));}function request(_0x137d51){logger['debug'](_0x6051('0x32'),JSON['stringify'](_0x137d51));return rp(_[_0x6051('0x33')](_0x137d51,{'method':_0x6051('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4f0976,_0x5f85f4){var _0x21e72b=[];if(_0x4f0976&&_0x4f0976['length']>0x0){_0x21e72b=_[_0x6051('0x35')](_0x4f0976,_0x5f85f4);}return _0x21e72b;}function getCustomFields(_0x4f6f8a,_0x154346){var _0x163dd1=[];var _0x568dfb={'custom_fields':[]};if(_0x4f6f8a[_0x6051('0x23')]>0x0){_[_0x6051('0x36')](_0x4f6f8a,function(_0x7b179e){if(_[_0x6051('0x37')]([_0x6051('0x38'),_0x6051('0x39')],_0x7b179e[_0x6051('0x3a')])&&_0x7b179e[_0x6051('0x3b')]&&!_0x7b179e[_0x6051('0x3c')]){_0x568dfb[_0x7b179e[_0x6051('0x3b')][_0x6051('0x3d')]()]=_0x7b179e[_0x6051('0x3e')]['toString']();}else if(_[_0x6051('0x37')]([_0x6051('0x38'),_0x6051('0x39')],_0x7b179e[_0x6051('0x3a')])&&_0x7b179e['idField']&&_0x7b179e[_0x6051('0x3c')]){_0x568dfb[_0x6051('0x3f')][_0x6051('0x40')]({'id':_0x7b179e[_0x6051('0x41')],'value':_0x7b179e[_0x6051('0x3e')][_0x6051('0x31')]()});}else if(_0x7b179e['type']===_0x6051('0x42')&&_0x7b179e['variableName']&&_0x7b179e[_0x6051('0x41')]&&_0x7b179e[_0x6051('0x3c')]){_0x154346[_0x7b179e[_0x6051('0x43')]]&&_0x568dfb[_0x6051('0x3f')]['push']({'id':_0x7b179e[_0x6051('0x41')],'value':_0x154346[_0x7b179e['variableName']][_0x6051('0x31')]()});}else if(_0x7b179e[_0x6051('0x3a')]===_0x6051('0x44')&&_0x7b179e['Variable']&&_0x7b179e[_0x6051('0x45')][_0x6051('0x46')]&&_0x7b179e[_0x6051('0x41')]&&_0x7b179e[_0x6051('0x3c')]){_0x154346[_0x7b179e[_0x6051('0x45')]['name']['toLowerCase']()]&&_0x568dfb[_0x6051('0x3f')][_0x6051('0x40')]({'id':_0x7b179e['idField'],'value':_0x154346[_0x7b179e[_0x6051('0x45')]['name'][_0x6051('0x3d')]()][_0x6051('0x31')]()});}});}return _0x568dfb;}exports[_0x6051('0x47')]=function(_0x310043,_0x484b8b,_0x4a8c1,_0x3fa328,_0x6cc2e3,_0x2f768){var _0x4389e4,_0x53b0dc;_0x2f768[_0x6051('0xd')]=intUtil['stripTrailingSlash'](_0x2f768[_0x6051('0xd')]);_0x2f768[_0x6051('0x48')]=intUtil[_0x6051('0x49')](_0x2f768[_0x6051('0x48')]);if(_0x6cc2e3&&_0x6cc2e3[_0x6051('0x4a')]){logger[_0x6051('0xc')](_0x6051('0x4b'),_0x6051('0x4c'));_0x484b8b[_0x6051('0x4d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f768['serverUrl'],_0x484b8b['uniqueid'],md5(_0x484b8b['uniqueid']));}else{_0x484b8b[_0x6051('0x4d')]='';}headers['Authorization']=getAuth(_0x2f768);return getUser(_0x2f768,_0x3fa328[_0x6051('0x4e')])[_0x6051('0x15')](function(_0x132f00){_0x4389e4=_0x132f00;logger[_0x6051('0xc')](_0x6051('0x4f'),_0x4389e4['id']);return getEndUser(_0x2f768,_0x484b8b[_0x6051('0x50')],_0x484b8b['calleridnum']);})['then'](function(_0x26dedc){_0x53b0dc=_0x26dedc;logger[_0x6051('0xc')]('The\x20Enduser\x20ID\x20is:',_0x53b0dc['id']);return getTicket(_0x2f768,_0x4389e4,_0x53b0dc,_0x4a8c1,_0x484b8b);})[_0x6051('0x15')](function(_0x3d0231){if(_0x3d0231){logger['info'](_0x6051('0x51'),_0x3d0231['id']);switch(_0x2f768['type']){case _0x6051('0x52'):logger[_0x6051('0xc')]('[QUEUE]',_0x6051('0x53'));return request({'uri':util[_0x6051('0x18')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2f768[_0x6051('0xd')],_0x4389e4['id'],_0x3d0231['id']),'method':_0x6051('0xe')});case _0x6051('0x54'):logger[_0x6051('0xc')](_0x6051('0x4b'),_0x6051('0x55'));emit(util[_0x6051('0x18')](_0x6051('0x56'),_0x3fa328[_0x6051('0x46')]),_0x6051('0x57'),{'uri':util['format'](_0x6051('0x58'),_0x2f768[_0x6051('0xd')][_0x6051('0x59')](_0x6051('0x5a'),''),_0x3d0231['id'])});break;default:logger['error'](_0x6051('0x4b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x6051('0x5b')](function(_0x378d83){logger[_0x6051('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x6051('0x5d')](_0x378d83,{'showHidden':!![],'depth':null}));});};exports[_0x6051('0x5e')]=function(_0x27e035,_0x5f07f1,_0x528816,_0x43ba68,_0x1a38cb,_0x5b8b57,_0x1a0420){var _0x188642,_0x5e9998;_0x5b8b57[_0x6051('0xd')]=intUtil['stripTrailingSlash'](_0x5b8b57[_0x6051('0xd')]);_0x5b8b57[_0x6051('0x48')]=intUtil[_0x6051('0x49')](_0x5b8b57[_0x6051('0x48')]);if(_0x1a0420&&_0x1a0420['recordingFormat']&&_0x1a0420[_0x6051('0x5f')]!==_0x6051('0x60')){logger['info'](_0x6051('0x61'),_0x6051('0x4c'));_0x5f07f1[_0x6051('0x4d')]=util['format'](_0x6051('0x62'),_0x5b8b57[_0x6051('0x48')],_0x5f07f1[_0x6051('0x63')],md5(_0x5f07f1[_0x6051('0x63')]));}headers[_0x6051('0x64')]=getAuth(_0x5b8b57);return getUser(_0x5b8b57,_0x43ba68[_0x6051('0x4e')])[_0x6051('0x15')](function(_0x539fab){_0x188642=_0x539fab;logger[_0x6051('0xc')](_0x6051('0x4f'),_0x188642['id']);return getEndUser(_0x5b8b57,_0x5f07f1[_0x6051('0x65')],_0x5f07f1[_0x6051('0x66')]);})[_0x6051('0x15')](function(_0x19324c){_0x5e9998=_0x19324c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5e9998['id']);return getTicket(_0x5b8b57,_0x188642,_0x5e9998,_0x528816,_0x5f07f1);})['then'](function(_0x2b8463){if(_0x2b8463){logger[_0x6051('0xc')](_0x6051('0x51'),_0x2b8463['id']);switch(_0x5b8b57[_0x6051('0x3a')]){case _0x6051('0x52'):logger[_0x6051('0xc')](_0x6051('0x61'),_0x6051('0x53'));return request({'uri':util[_0x6051('0x18')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5b8b57[_0x6051('0xd')],_0x188642['id'],_0x2b8463['id']),'method':_0x6051('0xe')});case _0x6051('0x54'):logger['info']('[OUTBOUND]',_0x6051('0x55'));emit(util[_0x6051('0x18')]('user:%s',_0x43ba68[_0x6051('0x46')]),_0x6051('0x57'),{'uri':util[_0x6051('0x18')](_0x6051('0x58'),_0x5b8b57['remoteUri'][_0x6051('0x59')](_0x6051('0x5a'),''),_0x2b8463['id'])});break;default:logger['error'](_0x6051('0x61'),_0x6051('0x67'));}}})[_0x6051('0x5b')](function(_0x136f57){logger[_0x6051('0x5c')](_0x6051('0x68'),util[_0x6051('0x5d')](_0x136f57,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x209ee0,_0x5f4aa3,_0x5c33d1,_0x1ed8d6,_0x2f4165,_0x4a3ea4){var _0x4bc68c,_0x223aeb;_0x4a3ea4[_0x6051('0xd')]=intUtil[_0x6051('0x49')](_0x4a3ea4[_0x6051('0xd')]);_0x4a3ea4['serverUrl']=intUtil[_0x6051('0x49')](_0x4a3ea4[_0x6051('0x48')]);if(_0x2f4165&&_0x2f4165[_0x6051('0x4a')]){logger['info']('['+_0x5f4aa3['lastevent'][_0x6051('0x69')]()+']',_0x6051('0x4c'));_0x5f4aa3[_0x6051('0x4d')]=util['format'](_0x6051('0x62'),_0x4a3ea4[_0x6051('0x48')],_0x5f4aa3[_0x6051('0x63')],md5(_0x5f4aa3[_0x6051('0x63')]));}else{_0x5f4aa3[_0x6051('0x4d')]='';}headers[_0x6051('0x64')]=getAuth(_0x4a3ea4);return getUser(_0x4a3ea4)['then'](function(_0x1fd935){_0x4bc68c=_0x1fd935;logger['info'](_0x6051('0x4f'),_0x4bc68c['id']);return getEndUser(_0x4a3ea4,_0x5f4aa3['calleridname'],_0x5f4aa3[_0x6051('0x6a')]);})[_0x6051('0x15')](function(_0x5ddebe){_0x223aeb=_0x5ddebe;logger['info'](_0x6051('0x6b'),_0x223aeb['id']);return getTicket(_0x4a3ea4,_0x4bc68c,_0x223aeb,_0x5c33d1,_0x5f4aa3);})[_0x6051('0x15')](function(_0x52d60b){if(_0x52d60b){logger[_0x6051('0xc')](_0x6051('0x51'),_0x52d60b['id']);}})[_0x6051('0x5b')](function(_0x44af29){logger['error']('['+_0x5f4aa3[_0x6051('0x6c')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x6051('0x5d')](_0x44af29,{'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 8806a88..1ede4ba 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 _0xccbe=['trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridnum','user:%s','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','enduserType','https://www.zohoapis.','role','first_name','last_name','data','SUCCESS','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','startCase','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','rejected','Rejected','Abandoned','timeout','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','details','log','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x2ff80f,_0x24c5dd){var _0x364954=function(_0x124f1e){while(--_0x124f1e){_0x2ff80f['push'](_0x2ff80f['shift']());}};_0x364954(++_0x24c5dd);}(_0xccbe,0xa4));var _0xeccb=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xccbe[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xeccb('0x0'));var util=require(_0xeccb('0x1'));var intUtil=require('./util');var moment=require(_0xeccb('0x2'));var Redis=require(_0xeccb('0x3'));var BPromise=require('bluebird');var config=require(_0xeccb('0x4'));var logger=require(_0xeccb('0x5'))('zoho');config[_0xeccb('0x6')]=_[_0xeccb('0x7')](config[_0xeccb('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeccb('0x6')]));function emit(_0x51596a,_0x36dacc,_0x58f973){io['to'](_0x51596a)[_0xeccb('0x8')](_0x36dacc,_0x58f973);}function request(_0xaed93b){logger[_0xeccb('0x9')](_0xeccb('0xa'),JSON['stringify'](_0xaed93b));return rp(_0xaed93b);}function getCustomFields(_0x5654e1,_0x24d3bc){var _0x2c062f={};if(_0x5654e1[_0xeccb('0xb')]>0x0){_[_0xeccb('0xc')](_0x5654e1,function(_0x436ab1){if(_[_0xeccb('0xd')]([_0xeccb('0xe'),_0xeccb('0xf')],_0x436ab1[_0xeccb('0x10')])&&_0x436ab1[_0xeccb('0x11')]){_0x2c062f[_0x436ab1[_0xeccb('0x11')]]=_0x436ab1[_0xeccb('0x12')][_0xeccb('0x13')]();}else if(_0x436ab1[_0xeccb('0x10')]===_0xeccb('0x14')&&_0x436ab1[_0xeccb('0x15')]&&_0x436ab1[_0xeccb('0x11')]&&_0x24d3bc[_0x436ab1[_0xeccb('0x15')]]){_0x2c062f[_0x436ab1['idField']]=_0x24d3bc[_0x436ab1['variableName']][_0xeccb('0x13')]();}else if(_0x436ab1['type']===_0xeccb('0x16')&&_0x436ab1[_0xeccb('0x17')]&&_0x436ab1[_0xeccb('0x17')]['name']&&_0x436ab1[_0xeccb('0x11')]&&_0x24d3bc[_0x436ab1[_0xeccb('0x17')][_0xeccb('0x18')][_0xeccb('0x19')]()]){_0x2c062f[_0x436ab1['idField']]=_0x24d3bc[_0x436ab1[_0xeccb('0x17')][_0xeccb('0x18')][_0xeccb('0x19')]()][_0xeccb('0x13')]();}});}return _0x2c062f;}function getName(_0x312f42){if(_0x312f42[_0xeccb('0x1a')]('\x20')>0x0){var _0x21d7ef=_0x312f42[_0xeccb('0x1b')](/ (.+)/);if(_0x21d7ef[0x1]){return _0x21d7ef;}}return[_0x312f42,_0x312f42];}var accountsTokens={};function getAccessToken(_0x59e93c){return new Promise(function(_0x21664f,_0x469ea0){if(!_['isNil'](accountsTokens[_0x59e93c['id']])&&!_['isNil'](accountsTokens[_0x59e93c['id']][_0xeccb('0x1c')])){if(moment()[_0xeccb('0x1d')](accountsTokens[_0x59e93c['id']][_0xeccb('0x1e')])){_0x21664f(accountsTokens[_0x59e93c['id']][_0xeccb('0x1c')]);}}var _0x2e6abc;switch(_0x59e93c[_0xeccb('0x1f')]){case'US':_0x2e6abc=_0xeccb('0x20');break;case'AU':_0x2e6abc=_0xeccb('0x21');break;case'EU':_0x2e6abc=_0xeccb('0x22');break;case'IN':_0x2e6abc=_0xeccb('0x23');break;case'CN':_0x2e6abc=_0xeccb('0x24');break;default:_0x2e6abc=_0xeccb('0x22');break;}var _0x4db0b3={'method':_0xeccb('0x25'),'uri':_0x2e6abc+_0xeccb('0x26'),'qs':{'refresh_token':_0x59e93c[_0xeccb('0x27')],'client_id':_0x59e93c['clientId'],'client_secret':_0x59e93c['clientSecret'],'grant_type':_0xeccb('0x28')},'json':!![]};return rp(_0x4db0b3)[_0xeccb('0x29')](function(_0x1cb4b7){accountsTokens[_0x59e93c['id']]={'access_token':_0x1cb4b7['access_token'],'expires_in':moment()['add'](_0x1cb4b7[_0xeccb('0x1e')],_0xeccb('0x2a'))};_0x21664f(_0x1cb4b7['access_token']);})['catch'](function(_0x32acd8){logger[_0xeccb('0x2b')](_0xeccb('0x2c'),_0x32acd8[_0xeccb('0x2d')]);_0x469ea0(_0x32acd8);});});}function getUser(_0x5dd9f2,_0xaa02b,_0x5bf282,_0x2752e3){logger[_0xeccb('0x2e')]('Search\x20user');return request({'method':_0xeccb('0x2f'),'uri':util[_0xeccb('0x30')](_0xeccb('0x31'),_0xaa02b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xeccb('0x32')+_0x5dd9f2},'json':!![]})[_0xeccb('0x29')](function(_0x4ce061){if(_0x4ce061[_0xeccb('0x33')]){var _0xd10085=-0x1;if(_[_0xeccb('0x34')](_0x4ce061[_0xeccb('0x33')])){if(!_[_0xeccb('0x35')](_0x2752e3)){_0xd10085=_[_0xeccb('0x36')](_0x4ce061[_0xeccb('0x33')],function(_0x452804){return _0x452804[_0xeccb('0x37')]===_0x2752e3;});}if(_0xd10085>=0x0){logger['info'](_0xeccb('0x38'));}else{logger[_0xeccb('0x2e')](_0xeccb('0x39'));_0xd10085=_[_0xeccb('0x36')](_0x4ce061[_0xeccb('0x33')],function(_0x554bc2){return _0x554bc2[_0xeccb('0x3a')][_0xeccb('0x18')]===_0xeccb('0x3b');});}return _0x4ce061[_0xeccb('0x33')][_0xd10085];}else{if(_0x4ce061[_0xeccb('0x3c')][_0xeccb('0x3a')][_0xeccb('0x18')]==='Administrator'){logger[_0xeccb('0x2e')]('Using\x20the\x20admin\x20account!');user=_0x4ce061[_0xeccb('0x3c')];return user;}else{logger[_0xeccb('0x2b')]('The\x20failing\x20result\x20is',JSON[_0xeccb('0x3d')](_0x4ce061));throw new Error(_0xeccb('0x3e')+JSON[_0xeccb('0x3d')](_0x4ce061));}}}else{logger[_0xeccb('0x2b')](_0xeccb('0x3f'),JSON[_0xeccb('0x3d')](_0x4ce061));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xeccb('0x3d')](_0x4ce061));}})[_0xeccb('0x40')](function(_0x336690){console[_0xeccb('0x2b')](_0x336690);});}function getZohoUser(_0x51fd0d,_0x5c1698){return new BPromise(function(_0x2313f6,_0x335c9c){request(_0x51fd0d)['then'](function(_0x51430c){var _0x47f16b=null;if(_0x51430c){_0x47f16b=_0x51430c['data'][0x0];_0x47f16b[_0xeccb('0x41')]=_0x5c1698;}_0x2313f6(_0x47f16b);})[_0xeccb('0x40')](function(_0xe9e625){_0x335c9c(_0xe9e625);});});}function createEndUser(_0x54c57c,_0x567b08,_0x52f7fe,_0x711485,_0x3f219e,_0x226c92){var _0x52f7fe=getName(_0x52f7fe);return request({'method':_0xeccb('0x25'),'uri':_0xeccb('0x42')+_0x567b08+'/crm/v2/'+_['startCase'](_0x226c92['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x52f7fe[0x1],'First_Name':_0x52f7fe[0x0],'Phone':_0x711485,'Owner':{'name':!_[_0xeccb('0x35')](_0x3f219e[_0xeccb('0x43')][_0xeccb('0x18')])?_0x3f219e[_0xeccb('0x43')][_0xeccb('0x18')]:!_[_0xeccb('0x35')](_0x3f219e[_0xeccb('0x44')])?_0x3f219e[_0xeccb('0x44')]+'\x20'+_0x3f219e[_0xeccb('0x45')]:_0x3f219e['last_name'],'id':_0x3f219e['id']}}]},'headers':{'Authorization':_0xeccb('0x32')+_0x54c57c},'json':!![]})[_0xeccb('0x29')](function(_0x1f4af6){if(_0x1f4af6&&_0x1f4af6[_0xeccb('0x46')][0x0]['code']===_0xeccb('0x47')){var _0x54089e=_0x1f4af6[_0xeccb('0x46')][0x0]['details'];_0x54089e[_0xeccb('0x41')]=_['startCase'](_0x226c92[_0xeccb('0x48')])+'s';return _0x54089e;}logger[_0xeccb('0x2b')](_0xeccb('0x3f'),JSON[_0xeccb('0x3d')](data));throw new Error(_0xeccb('0x49')+JSON[_0xeccb('0x3d')](data));})[_0xeccb('0x40')](function(_0x2f11fe){console['log'](_0xeccb('0x4a'),_0x2f11fe);});}function getEndUser(_0x511fba,_0x2c70c9,_0x1aeadf,_0x5e452f,_0x2b80ab,_0x10d225,_0x42680a){var _0xb23457={'method':'GET','uri':'','headers':{'Authorization':_0xeccb('0x32')+_0x511fba},'json':!![]};switch(_0x42680a[_0xeccb('0x4b')]){case _0xeccb('0x4c'):_0xb23457[_0xeccb('0x4d')]=_0xeccb('0x42')+_0x2c70c9+_0xeccb('0x4e')+_0x2b80ab+'))';return getZohoUser(_0xb23457,_0xeccb('0x4f'))['then'](function(_0x8e14ef){if(_0x8e14ef)return _0x8e14ef;_0xb23457[_0xeccb('0x4d')]=_0xeccb('0x42')+_0x2c70c9+_0xeccb('0x50')+_0x2b80ab+'))';return getZohoUser(_0xb23457,'Leads')[_0xeccb('0x29')](function(_0x551451){if(_0x551451)return _0x551451;if(_0x42680a[_0xeccb('0x48')]!=_0xeccb('0x51')){return createEndUser(_0x511fba,_0x2c70c9,_0x5e452f,_0x2b80ab,_0x10d225,_0x42680a);}else{return{};}});});break;case _0xeccb('0x52'):_0xb23457[_0xeccb('0x4d')]='https://www.zohoapis.'+_0x2c70c9+_0xeccb('0x4e')+_0x2b80ab+'))';return getZohoUser(_0xb23457,_0xeccb('0x4f'))[_0xeccb('0x29')](function(_0xb12ed9){if(_0xb12ed9)return _0xb12ed9;if(_0x42680a[_0xeccb('0x48')]!=_0xeccb('0x51')){return createEndUser(_0x511fba,_0x2c70c9,_0x5e452f,_0x2b80ab,_0x10d225,_0x42680a);}else{return{};}});break;case'lead':_0xb23457[_0xeccb('0x4d')]='https://www.zohoapis.'+_0x2c70c9+_0xeccb('0x50')+_0x2b80ab+'))';return getZohoUser(_0xb23457,_0xeccb('0x53'))[_0xeccb('0x29')](function(_0x113ba3){if(_0x113ba3)return _0x113ba3;if(_0x42680a['moduleCreate']!='nothing'){return createEndUser(_0x511fba,_0x2c70c9,_0x5e452f,_0x2b80ab,_0x10d225,_0x42680a);}else{return{};}});break;}}function getCall(_0x283be8,_0x4c7246,_0x3e114c,_0x557b1d,_0x32bb6c,_0x3768e9,_0xa9d1f4,_0x10664d){logger[_0xeccb('0x2e')](_0xeccb('0x54'));var _0x4385fb={};_0x4385fb[_0xeccb('0x55')]={'name':!_[_0xeccb('0x35')](_0x557b1d[_0xeccb('0x43')][_0xeccb('0x18')])&&!_[_0xeccb('0x35')](_0x557b1d[_0xeccb('0x3a')][_0xeccb('0x18')])&&_0x557b1d[_0xeccb('0x3a')][_0xeccb('0x18')]===_0xeccb('0x56')?_0x557b1d[_0xeccb('0x43')][_0xeccb('0x18')]:!_[_0xeccb('0x35')](_0x557b1d[_0xeccb('0x44')])?_0x557b1d[_0xeccb('0x44')]+'\x20'+_0x557b1d[_0xeccb('0x45')]:_0x557b1d['last_name'],'id':_0x557b1d['id']};_0x4385fb['Subject']=intUtil[_0xeccb('0x57')](_0x3768e9[_0xeccb('0x58')],_0xa9d1f4,'\x20');_0x4385fb[_0xeccb('0x59')]=intUtil[_0xeccb('0x57')](_0x3768e9[_0xeccb('0x5a')],_0xa9d1f4,'\x0a');if(_0x32bb6c[_0xeccb('0x41')]===_0xeccb('0x4f')){_0x4385fb['Who_Id']={'name':!_[_0xeccb('0x35')](_0x32bb6c[_0xeccb('0x5b')])?_0x32bb6c[_0xeccb('0x5b')]:!_[_0xeccb('0x35')](_0x32bb6c[_0xeccb('0x5c')])?_0x32bb6c[_0xeccb('0x5c')]+'\x20'+_0x32bb6c[_0xeccb('0x5d')]:_0x32bb6c[_0xeccb('0x5d')],'id':_0x32bb6c['id']};}if(_0x32bb6c['enduserType']===_0xeccb('0x53')){_0x4385fb[_0xeccb('0x5e')]={'name':!_[_0xeccb('0x35')](_0x32bb6c[_0xeccb('0x5b')])?_0x32bb6c[_0xeccb('0x5b')]:!_[_0xeccb('0x35')](_0x32bb6c[_0xeccb('0x5c')])?_0x32bb6c[_0xeccb('0x5c')]+'\x20'+_0x32bb6c[_0xeccb('0x5d')]:_0x32bb6c['Last_Name'],'id':_0x32bb6c['id']};_0x4385fb['$se_module']=_[_0xeccb('0x5f')](_0x32bb6c['enduserType']);}if(_0xa9d1f4[_0xeccb('0x60')]){_0x4385fb[_0xeccb('0x61')]=moment['utc'](parseInt(_0xa9d1f4[_0xeccb('0x60')])*0x3e8)[_0xeccb('0x30')](_0xeccb('0x62'));}else if(_0xa9d1f4[_0xeccb('0x63')]&&_0xa9d1f4[_0xeccb('0x64')]){_0x4385fb[_0xeccb('0x61')]=moment[_0xeccb('0x65')](moment(_0xa9d1f4['endtime'],_0xeccb('0x66'))[_0xeccb('0x67')](moment(_0xa9d1f4[_0xeccb('0x68')],_0xeccb('0x66'))))['format']('mm:ss');}switch(_0xa9d1f4[_0xeccb('0x69')]){case _0xeccb('0x6a'):_0x4385fb[_0xeccb('0x6b')]='Called';break;case _0xeccb('0x6c'):case _0xeccb('0x6d'):_0x4385fb[_0xeccb('0x6b')]='Answered';break;case _0xeccb('0x6e'):_0x4385fb[_0xeccb('0x6b')]=_0xeccb('0x6f');break;case'abandoned':_0x4385fb[_0xeccb('0x6b')]=_0xeccb('0x70');break;case _0xeccb('0x71'):_0x4385fb[_0xeccb('0x6b')]='Timeout';default:}_0x4385fb['Call_Start_Time']=(_0x10664d===_0xeccb('0x72')?moment(_0xa9d1f4[_0xeccb('0x68')])[_0xeccb('0x30')]('YYYY-MM-DDTHH:mm:ss'):moment(_0xa9d1f4[_0xeccb('0x73')])[_0xeccb('0x30')](_0xeccb('0x66')))||moment()[_0xeccb('0x30')](_0xeccb('0x66'));_0x4385fb['Call_Type']=_0x10664d||_0xeccb('0x74');_0x4385fb=_[_0xeccb('0x75')](_0x4385fb,getCustomFields(_0x3768e9[_0xeccb('0x76')],_0xa9d1f4));return request({'method':_0xeccb('0x25'),'uri':_0xeccb('0x42')+_0x4c7246+_0xeccb('0x77'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x283be8},'body':{'data':[_0x4385fb]},'json':!![]})[_0xeccb('0x29')](function(_0x3aa3ed){if(_0x3aa3ed&&_0x3aa3ed[_0xeccb('0x46')][0x0][_0xeccb('0x78')]===_0xeccb('0x47')){logger[_0xeccb('0x2e')](_0xeccb('0x79'));return{'id':_0x3aa3ed['data'][0x0][_0xeccb('0x7a')]['id']};}})[_0xeccb('0x40')](function(_0x3cca41){logger[_0xeccb('0x2e')]('err',_0x3cca41['stack']);console[_0xeccb('0x7b')](_0xeccb('0x7c'),_0x3cca41);});}exports[_0xeccb('0x7d')]=function(_0x386a85,_0x530e7f,_0xba803d,_0x1ff8d9,_0x53efd1,_0xdf6e89){var _0x1a964d,_0x2078cf,_0x4b6df5;_0xdf6e89[_0xeccb('0x7e')]=intUtil[_0xeccb('0x7f')](_0xdf6e89[_0xeccb('0x7e')]);_0xdf6e89[_0xeccb('0x80')]=intUtil[_0xeccb('0x7f')](_0xdf6e89[_0xeccb('0x80')]);if(_0x53efd1&&_0x53efd1[_0xeccb('0x81')]){logger[_0xeccb('0x2e')](_0xeccb('0x82'),_0xeccb('0x83'));_0x530e7f[_0xeccb('0x84')]=_0xdf6e89[_0xeccb('0x80')]+'/api/voice/recordings/'+_0x530e7f['uniqueid']+_0xeccb('0x85')+md5(_0x530e7f[_0xeccb('0x86')]);}else{_0x530e7f[_0xeccb('0x84')]='';}var _0x35e194=_0xdf6e89[_0xeccb('0x7e')]===_0xeccb('0x87')?'eu':_0xeccb('0x88');return getAccessToken(_0xdf6e89)['then'](function(_0x44a42b){_0x4b6df5=_0x44a42b;return getUser(_0x4b6df5,_0x35e194,_0xdf6e89,_0x1ff8d9[_0xeccb('0x37')]);})[_0xeccb('0x29')](function(_0x2728c2){_0x1a964d=_0x2728c2;logger['info'](_0xeccb('0x89'),_0x1a964d['id']);return getEndUser(_0x4b6df5,_0x35e194,_0xdf6e89,_0x530e7f[_0xeccb('0x8a')],_0x530e7f[_0xeccb('0x8b')],_0x1a964d,_0xba803d);})[_0xeccb('0x29')](function(_0x482ed9){_0x2078cf=_0x482ed9;return getCall(_0x4b6df5,_0x35e194,_0xdf6e89,_0x1a964d,_0x2078cf,_0xba803d,_0x530e7f,_0xeccb('0x74'));})[_0xeccb('0x29')](function(_0x20de06){if(_0x20de06){logger[_0xeccb('0x2e')](_0xeccb('0x8c'),_0x20de06['id']);logger[_0xeccb('0x2e')](_0xeccb('0x82'),_0xeccb('0x8d'));emit(util[_0xeccb('0x30')]('user:%s',_0x1ff8d9[_0xeccb('0x18')]),_0xeccb('0x8e'),{'uri':_0xeccb('0x8f')+_0xdf6e89['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x20de06['id']});}})[_0xeccb('0x40')](function(_0x50aad0){logger[_0xeccb('0x2b')](_0xeccb('0x82'),JSON[_0xeccb('0x3d')](_0x50aad0));});};exports[_0xeccb('0x72')]=function(_0x1882d5,_0x4b96dc,_0x2bd13c,_0xfeaeb4,_0x342e35,_0x554706,_0x424fad){var _0x369dcd,_0x38fbbd,_0x42fb4f;_0x554706[_0xeccb('0x7e')]=intUtil[_0xeccb('0x7f')](_0x554706['host']);_0x554706['serverUrl']=intUtil[_0xeccb('0x7f')](_0x554706[_0xeccb('0x80')]);if(_0x424fad&&_0x424fad['recordingFormat']&&_0x424fad[_0xeccb('0x90')]!==_0xeccb('0x91')){logger[_0xeccb('0x2e')](_0xeccb('0x92'),_0xeccb('0x83'));_0x4b96dc[_0xeccb('0x84')]=_0x554706[_0xeccb('0x80')]+_0xeccb('0x93')+_0x4b96dc['uniqueid']+_0xeccb('0x85')+md5(_0x4b96dc['uniqueid']);}var _0x64f2e9=_0x554706['host']===_0xeccb('0x87')?'eu':_0xeccb('0x88');return getAccessToken(_0x554706)[_0xeccb('0x29')](function(_0x299b28){_0x42fb4f=_0x299b28;return getUser(_0x42fb4f,_0x64f2e9,_0x554706,_0xfeaeb4[_0xeccb('0x37')]);})[_0xeccb('0x29')](function(_0xbc3562){_0x369dcd=_0xbc3562;logger[_0xeccb('0x2e')]('The\x20User\x20ID\x20is:',_0x369dcd['id']);return getEndUser(_0x42fb4f,_0x64f2e9,_0x554706,_0x4b96dc['destcalleridname'],_0x4b96dc[_0xeccb('0x94')],_0x369dcd,_0x2bd13c);})[_0xeccb('0x29')](function(_0x30ba93){_0x38fbbd=_0x30ba93;return getCall(_0x42fb4f,_0x64f2e9,_0x554706,_0x369dcd,_0x38fbbd,_0x2bd13c,_0x4b96dc,'Outbound');})['then'](function(_0x583893){if(_0x583893){logger[_0xeccb('0x2e')](_0xeccb('0x8c'),_0x583893['id']);logger[_0xeccb('0x2e')](_0xeccb('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xeccb('0x30')](_0xeccb('0x95'),_0xfeaeb4[_0xeccb('0x18')]),'trigger:browser:url',{'uri':_0xeccb('0x8f')+_0x554706[_0xeccb('0x7e')]+_0xeccb('0x96')+_0x583893['id']});}})[_0xeccb('0x40')](function(_0x147308){logger[_0xeccb('0x2b')](_0xeccb('0x92'),JSON[_0xeccb('0x3d')](_0x147308));});};exports[_0xeccb('0x97')]=function(_0x3a9dd1,_0x23a8bb,_0x8b4c71,_0x4ce90e,_0x23d79f,_0x1d6050){var _0x2779b0,_0x40bc01,_0x606802;_0x1d6050['host']=intUtil[_0xeccb('0x7f')](_0x1d6050['host']);_0x1d6050[_0xeccb('0x80')]=intUtil[_0xeccb('0x7f')](_0x1d6050[_0xeccb('0x80')]);if(_0x23d79f&&_0x23d79f[_0xeccb('0x81')]){logger['info']('['+_0x23a8bb[_0xeccb('0x69')][_0xeccb('0x98')]()+']',_0xeccb('0x83'));_0x23a8bb[_0xeccb('0x84')]=_0x1d6050[_0xeccb('0x80')]+_0xeccb('0x93')+_0x23a8bb[_0xeccb('0x86')]+_0xeccb('0x85')+md5(_0x23a8bb[_0xeccb('0x86')]);}else{_0x23a8bb[_0xeccb('0x84')]='';}var _0x584548=_0x1d6050[_0xeccb('0x7e')]===_0xeccb('0x87')?'eu':_0xeccb('0x88');return getAccessToken(_0x1d6050)[_0xeccb('0x29')](function(_0x540e3d){_0x606802=_0x540e3d;return getUser(_0x606802,_0x584548,_0x1d6050);})[_0xeccb('0x29')](function(_0x5a5c2e){_0x2779b0=_0x5a5c2e;logger[_0xeccb('0x2e')]('The\x20User\x20ID\x20is:',_0x2779b0['id']);return getEndUser(_0x606802,_0x584548,_0x1d6050,_0x23a8bb[_0xeccb('0x8a')],_0x23a8bb[_0xeccb('0x8b')],_0x2779b0,_0x8b4c71);})['then'](function(_0x2d253f){_0x40bc01=_0x2d253f;return getCall(_0x606802,_0x584548,_0x1d6050,_0x2779b0,_0x40bc01,_0x8b4c71,_0x23a8bb,'Inbound');})[_0xeccb('0x29')](function(_0x26d3e4){if(_0x26d3e4){logger[_0xeccb('0x2e')](_0xeccb('0x8c'),_0x26d3e4['id']);}})['catch'](function(_0x579183){logger[_0xeccb('0x2b')]('['+_0x23a8bb[_0xeccb('0x69')][_0xeccb('0x98')]()+']',JSON['stringify'](_0x579183));});}; \ No newline at end of file +var _0x3cbd=['variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','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','then','add','expires_in','seconds','catch','error','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','data','details','enduserType','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','contact','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','code','stack','err','queue','host','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','monitor_format','toUpperCase','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable'];(function(_0x31b4db,_0x2385e2){var _0x3fe8f0=function(_0x51117f){while(--_0x51117f){_0x31b4db['push'](_0x31b4db['shift']());}};_0x3fe8f0(++_0x2385e2);}(_0x3cbd,0x1c0));var _0xd3cb=function(_0x4b5787,_0x2c5aa2){_0x4b5787=_0x4b5787-0x0;var _0x827b80=_0x3cbd[_0x4b5787];return _0x827b80;};'use strict';var _=require('lodash');var rp=require(_0xd3cb('0x0'));var md5=require(_0xd3cb('0x1'));var util=require('util');var intUtil=require(_0xd3cb('0x2'));var moment=require(_0xd3cb('0x3'));var Redis=require(_0xd3cb('0x4'));var BPromise=require(_0xd3cb('0x5'));var config=require(_0xd3cb('0x6'));var logger=require(_0xd3cb('0x7'))(_0xd3cb('0x8'));config[_0xd3cb('0x9')]=_[_0xd3cb('0xa')](config[_0xd3cb('0x9')],{'host':_0xd3cb('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd3cb('0x9')]));function emit(_0x43e0f7,_0x2bff1c,_0x3334e3){io['to'](_0x43e0f7)[_0xd3cb('0xc')](_0x2bff1c,_0x3334e3);}function request(_0x5ab271){logger[_0xd3cb('0xd')](_0xd3cb('0xe'),JSON[_0xd3cb('0xf')](_0x5ab271));return rp(_0x5ab271);}function getCustomFields(_0x2b6114,_0x2078a6){var _0x5c149f={};if(_0x2b6114[_0xd3cb('0x10')]>0x0){_[_0xd3cb('0x11')](_0x2b6114,function(_0x38a256){if(_[_0xd3cb('0x12')]([_0xd3cb('0x13'),_0xd3cb('0x14')],_0x38a256[_0xd3cb('0x15')])&&_0x38a256[_0xd3cb('0x16')]){_0x5c149f[_0x38a256[_0xd3cb('0x16')]]=_0x38a256[_0xd3cb('0x17')][_0xd3cb('0x18')]();}else if(_0x38a256[_0xd3cb('0x15')]===_0xd3cb('0x19')&&_0x38a256[_0xd3cb('0x1a')]&&_0x38a256[_0xd3cb('0x16')]&&_0x2078a6[_0x38a256['variableName']]){_0x5c149f[_0x38a256['idField']]=_0x2078a6[_0x38a256[_0xd3cb('0x1a')]][_0xd3cb('0x18')]();}else if(_0x38a256[_0xd3cb('0x15')]==='customVariable'&&_0x38a256[_0xd3cb('0x1b')]&&_0x38a256['Variable'][_0xd3cb('0x1c')]&&_0x38a256[_0xd3cb('0x16')]&&_0x2078a6[_0x38a256['Variable'][_0xd3cb('0x1c')][_0xd3cb('0x1d')]()]){_0x5c149f[_0x38a256[_0xd3cb('0x16')]]=_0x2078a6[_0x38a256[_0xd3cb('0x1b')][_0xd3cb('0x1c')][_0xd3cb('0x1d')]()][_0xd3cb('0x18')]();}});}return _0x5c149f;}function getName(_0x43e701){if(_0x43e701[_0xd3cb('0x1e')]('\x20')>0x0){var _0x443b6f=_0x43e701[_0xd3cb('0x1f')](/ (.+)/);if(_0x443b6f[0x1]){return _0x443b6f;}}return[_0x43e701,_0x43e701];}var accountsTokens={};function getAccessToken(_0x5c495a){return new Promise(function(_0x13d017,_0x414300){if(!_[_0xd3cb('0x20')](accountsTokens[_0x5c495a['id']])&&!_['isNil'](accountsTokens[_0x5c495a['id']][_0xd3cb('0x21')])){if(moment()[_0xd3cb('0x22')](accountsTokens[_0x5c495a['id']]['expires_in'])){_0x13d017(accountsTokens[_0x5c495a['id']][_0xd3cb('0x21')]);}}var _0xa2eed7;switch(_0x5c495a[_0xd3cb('0x23')]){case'US':_0xa2eed7=_0xd3cb('0x24');break;case'AU':_0xa2eed7=_0xd3cb('0x25');break;case'EU':_0xa2eed7=_0xd3cb('0x26');break;case'IN':_0xa2eed7='https://accounts.zoho.in';break;case'CN':_0xa2eed7=_0xd3cb('0x27');break;default:_0xa2eed7=_0xd3cb('0x26');break;}var _0x152a5b={'method':_0xd3cb('0x28'),'uri':_0xa2eed7+_0xd3cb('0x29'),'qs':{'refresh_token':_0x5c495a[_0xd3cb('0x2a')],'client_id':_0x5c495a[_0xd3cb('0x2b')],'client_secret':_0x5c495a[_0xd3cb('0x2c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x152a5b)[_0xd3cb('0x2d')](function(_0x1b87e2){accountsTokens[_0x5c495a['id']]={'access_token':_0x1b87e2[_0xd3cb('0x21')],'expires_in':moment()[_0xd3cb('0x2e')](_0x1b87e2[_0xd3cb('0x2f')],_0xd3cb('0x30'))};_0x13d017(_0x1b87e2[_0xd3cb('0x21')]);})[_0xd3cb('0x31')](function(_0xf27541){logger[_0xd3cb('0x32')]('Failing\x20creating\x20the\x20access_token',_0xf27541['stack']);_0x414300(_0xf27541);});});}function getUser(_0x339448,_0x42bcea,_0x51e84c,_0x17b98e){logger['info']('Search\x20user');return request({'method':_0xd3cb('0x33'),'uri':util[_0xd3cb('0x34')](_0xd3cb('0x35'),_0x42bcea),'qs':{'type':_0xd3cb('0x36')},'headers':{'Authorization':_0xd3cb('0x37')+_0x339448},'json':!![]})[_0xd3cb('0x2d')](function(_0x5d8bef){if(_0x5d8bef[_0xd3cb('0x38')]){var _0x5b8ba7=-0x1;if(_[_0xd3cb('0x39')](_0x5d8bef[_0xd3cb('0x38')])){if(!_[_0xd3cb('0x20')](_0x17b98e)){_0x5b8ba7=_[_0xd3cb('0x3a')](_0x5d8bef['users'],function(_0x308859){return _0x308859[_0xd3cb('0x3b')]===_0x17b98e;});}if(_0x5b8ba7>=0x0){logger[_0xd3cb('0x3c')](_0xd3cb('0x3d'));}else{logger[_0xd3cb('0x3c')](_0xd3cb('0x3e'));_0x5b8ba7=_[_0xd3cb('0x3a')](_0x5d8bef[_0xd3cb('0x38')],function(_0x227f48){return _0x227f48['profile'][_0xd3cb('0x1c')]===_0xd3cb('0x3f');});}return _0x5d8bef[_0xd3cb('0x38')][_0x5b8ba7];}else{if(_0x5d8bef[_0xd3cb('0x40')][_0xd3cb('0x41')][_0xd3cb('0x1c')]===_0xd3cb('0x3f')){logger[_0xd3cb('0x3c')]('Using\x20the\x20admin\x20account!');user=_0x5d8bef['user'];return user;}else{logger[_0xd3cb('0x32')](_0xd3cb('0x42'),JSON[_0xd3cb('0xf')](_0x5d8bef));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd3cb('0xf')](_0x5d8bef));}}}else{logger[_0xd3cb('0x32')](_0xd3cb('0x42'),JSON[_0xd3cb('0xf')](_0x5d8bef));throw new Error(_0xd3cb('0x43')+JSON['stringify'](_0x5d8bef));}})[_0xd3cb('0x31')](function(_0x2b0104){console[_0xd3cb('0x32')](_0x2b0104);});}function getZohoUser(_0x137dd7,_0x4be02e){return new BPromise(function(_0x52bf0a,_0x3c5d3c){request(_0x137dd7)['then'](function(_0x125f39){var _0x2db0db=null;if(_0x125f39){_0x2db0db=_0x125f39['data'][0x0];_0x2db0db['enduserType']=_0x4be02e;}_0x52bf0a(_0x2db0db);})[_0xd3cb('0x31')](function(_0x28de3b){_0x3c5d3c(_0x28de3b);});});}function createEndUser(_0x278d14,_0x36b784,_0x25712b,_0x36bdcc,_0x230faf,_0x387cd0){var _0x25712b=getName(_0x25712b);return request({'method':_0xd3cb('0x28'),'uri':_0xd3cb('0x44')+_0x36b784+_0xd3cb('0x45')+_[_0xd3cb('0x46')](_0x387cd0[_0xd3cb('0x47')])+'s','body':{'data':[{'Last_Name':_0x25712b[0x1],'First_Name':_0x25712b[0x0],'Phone':_0x36bdcc,'Owner':{'name':!_['isNil'](_0x230faf[_0xd3cb('0x48')][_0xd3cb('0x1c')])?_0x230faf[_0xd3cb('0x48')][_0xd3cb('0x1c')]:!_[_0xd3cb('0x20')](_0x230faf['first_name'])?_0x230faf[_0xd3cb('0x49')]+'\x20'+_0x230faf[_0xd3cb('0x4a')]:_0x230faf[_0xd3cb('0x4a')],'id':_0x230faf['id']}}]},'headers':{'Authorization':_0xd3cb('0x37')+_0x278d14},'json':!![]})[_0xd3cb('0x2d')](function(_0xc568a7){if(_0xc568a7&&_0xc568a7['data'][0x0]['code']===_0xd3cb('0x4b')){var _0x2353b8=_0xc568a7[_0xd3cb('0x4c')][0x0][_0xd3cb('0x4d')];_0x2353b8[_0xd3cb('0x4e')]=_['startCase'](_0x387cd0[_0xd3cb('0x47')])+'s';return _0x2353b8;}logger['error'](_0xd3cb('0x42'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xd3cb('0xf')](data));})[_0xd3cb('0x31')](function(_0x3a3b26){console[_0xd3cb('0x4f')]('CREATE\x20ERROR',_0x3a3b26);});}function getEndUser(_0x29ceb6,_0x560951,_0x38b3e5,_0x19e2c2,_0x5c2e36,_0x36132d,_0x5bf93c){var _0x4f1784={'method':_0xd3cb('0x33'),'uri':'','headers':{'Authorization':_0xd3cb('0x37')+_0x29ceb6},'json':!![]};switch(_0x5bf93c[_0xd3cb('0x50')]){case _0xd3cb('0x51'):_0x4f1784[_0xd3cb('0x52')]=_0xd3cb('0x44')+_0x560951+_0xd3cb('0x53')+_0x5c2e36+'))';return getZohoUser(_0x4f1784,'Contacts')[_0xd3cb('0x2d')](function(_0x5981db){if(_0x5981db)return _0x5981db;_0x4f1784[_0xd3cb('0x52')]=_0xd3cb('0x44')+_0x560951+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5c2e36+'))';return getZohoUser(_0x4f1784,'Leads')[_0xd3cb('0x2d')](function(_0x177d24){if(_0x177d24)return _0x177d24;if(_0x5bf93c['moduleCreate']!=_0xd3cb('0x54')){return createEndUser(_0x29ceb6,_0x560951,_0x19e2c2,_0x5c2e36,_0x36132d,_0x5bf93c);}else{return{};}});});break;case _0xd3cb('0x55'):_0x4f1784[_0xd3cb('0x52')]='https://www.zohoapis.'+_0x560951+_0xd3cb('0x53')+_0x5c2e36+'))';return getZohoUser(_0x4f1784,_0xd3cb('0x56'))[_0xd3cb('0x2d')](function(_0x2128cd){if(_0x2128cd)return _0x2128cd;if(_0x5bf93c[_0xd3cb('0x47')]!=_0xd3cb('0x54')){return createEndUser(_0x29ceb6,_0x560951,_0x19e2c2,_0x5c2e36,_0x36132d,_0x5bf93c);}else{return{};}});break;case'lead':_0x4f1784['uri']=_0xd3cb('0x44')+_0x560951+_0xd3cb('0x57')+_0x5c2e36+'))';return getZohoUser(_0x4f1784,_0xd3cb('0x58'))[_0xd3cb('0x2d')](function(_0x18b18c){if(_0x18b18c)return _0x18b18c;if(_0x5bf93c[_0xd3cb('0x47')]!=_0xd3cb('0x54')){return createEndUser(_0x29ceb6,_0x560951,_0x19e2c2,_0x5c2e36,_0x36132d,_0x5bf93c);}else{return{};}});break;}}function getCall(_0x1dd0a0,_0x5d6717,_0x289531,_0x47b90e,_0x1dffda,_0x25c05b,_0x573939,_0x2ee8a3){logger[_0xd3cb('0x3c')]('Creating\x20new\x20call...');var _0x3af505={};_0x3af505['Owner']={'name':!_['isNil'](_0x47b90e[_0xd3cb('0x48')][_0xd3cb('0x1c')])&&!_['isNil'](_0x47b90e[_0xd3cb('0x41')][_0xd3cb('0x1c')])&&_0x47b90e[_0xd3cb('0x41')][_0xd3cb('0x1c')]===_0xd3cb('0x59')?_0x47b90e['role'][_0xd3cb('0x1c')]:!_[_0xd3cb('0x20')](_0x47b90e['first_name'])?_0x47b90e[_0xd3cb('0x49')]+'\x20'+_0x47b90e[_0xd3cb('0x4a')]:_0x47b90e['last_name'],'id':_0x47b90e['id']};_0x3af505[_0xd3cb('0x5a')]=intUtil['getString'](_0x25c05b['Subjects'],_0x573939,'\x20');_0x3af505['Description']=intUtil[_0xd3cb('0x5b')](_0x25c05b[_0xd3cb('0x5c')],_0x573939,'\x0a');if(_0x1dffda[_0xd3cb('0x4e')]===_0xd3cb('0x56')){_0x3af505[_0xd3cb('0x5d')]={'name':!_[_0xd3cb('0x20')](_0x1dffda[_0xd3cb('0x5e')])?_0x1dffda[_0xd3cb('0x5e')]:!_[_0xd3cb('0x20')](_0x1dffda[_0xd3cb('0x5f')])?_0x1dffda[_0xd3cb('0x5f')]+'\x20'+_0x1dffda[_0xd3cb('0x60')]:_0x1dffda[_0xd3cb('0x60')],'id':_0x1dffda['id']};}if(_0x1dffda[_0xd3cb('0x4e')]===_0xd3cb('0x58')){_0x3af505['What_Id']={'name':!_[_0xd3cb('0x20')](_0x1dffda['Full_Name'])?_0x1dffda[_0xd3cb('0x5e')]:!_[_0xd3cb('0x20')](_0x1dffda[_0xd3cb('0x5f')])?_0x1dffda['First_Name']+'\x20'+_0x1dffda[_0xd3cb('0x60')]:_0x1dffda[_0xd3cb('0x60')],'id':_0x1dffda['id']};_0x3af505[_0xd3cb('0x61')]=_[_0xd3cb('0x46')](_0x1dffda[_0xd3cb('0x4e')]);}if(_0x573939[_0xd3cb('0x62')]){_0x3af505[_0xd3cb('0x63')]=moment[_0xd3cb('0x64')](parseInt(_0x573939[_0xd3cb('0x62')])*0x3e8)[_0xd3cb('0x34')](_0xd3cb('0x65'));}else if(_0x573939[_0xd3cb('0x66')]&&_0x573939[_0xd3cb('0x67')]){_0x3af505[_0xd3cb('0x63')]=moment[_0xd3cb('0x64')](moment(_0x573939[_0xd3cb('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0xd3cb('0x68')](moment(_0x573939[_0xd3cb('0x69')],_0xd3cb('0x6a'))))[_0xd3cb('0x34')](_0xd3cb('0x65'));}switch(_0x573939[_0xd3cb('0x6b')]){case _0xd3cb('0x6c'):_0x3af505['Call_Result']=_0xd3cb('0x6d');break;case _0xd3cb('0x6e'):case'connect':_0x3af505[_0xd3cb('0x6f')]=_0xd3cb('0x70');break;case _0xd3cb('0x71'):_0x3af505[_0xd3cb('0x6f')]=_0xd3cb('0x72');break;case _0xd3cb('0x73'):_0x3af505[_0xd3cb('0x6f')]=_0xd3cb('0x74');break;case _0xd3cb('0x75'):_0x3af505['Call_Result']=_0xd3cb('0x76');default:}_0x3af505[_0xd3cb('0x77')]=(_0x2ee8a3===_0xd3cb('0x78')?moment(_0x573939[_0xd3cb('0x69')])[_0xd3cb('0x34')](_0xd3cb('0x6a')):moment(_0x573939[_0xd3cb('0x79')])[_0xd3cb('0x34')](_0xd3cb('0x6a')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x3af505[_0xd3cb('0x7a')]=_0x2ee8a3||'Inbound';_0x3af505=_['merge'](_0x3af505,getCustomFields(_0x25c05b[_0xd3cb('0x7b')],_0x573939));return request({'method':_0xd3cb('0x28'),'uri':'https://www.zohoapis.'+_0x5d6717+_0xd3cb('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1dd0a0},'body':{'data':[_0x3af505]},'json':!![]})['then'](function(_0x270e9f){if(_0x270e9f&&_0x270e9f['data'][0x0][_0xd3cb('0x7d')]==='SUCCESS'){logger[_0xd3cb('0x3c')]('Call\x20created!');return{'id':_0x270e9f['data'][0x0][_0xd3cb('0x4d')]['id']};}})[_0xd3cb('0x31')](function(_0x268a24){logger[_0xd3cb('0x3c')]('err',_0x268a24[_0xd3cb('0x7e')]);console[_0xd3cb('0x4f')](_0xd3cb('0x7f'),_0x268a24);});}exports[_0xd3cb('0x80')]=function(_0x227f59,_0x2f82d7,_0x22128a,_0x4a4bcd,_0x4b254d,_0x30d6c0){var _0x2851f2,_0x30d7b0,_0x234ed8;_0x30d6c0[_0xd3cb('0x81')]=intUtil['stripTrailingSlash'](_0x30d6c0[_0xd3cb('0x81')]);_0x30d6c0[_0xd3cb('0x82')]=intUtil[_0xd3cb('0x83')](_0x30d6c0[_0xd3cb('0x82')]);if(_0x4b254d&&_0x4b254d['monitor_format']){logger[_0xd3cb('0x3c')]('[QUEUE]',_0xd3cb('0x84'));_0x2f82d7['recordingURL']=_0x30d6c0[_0xd3cb('0x82')]+_0xd3cb('0x85')+_0x2f82d7[_0xd3cb('0x86')]+_0xd3cb('0x87')+md5(_0x2f82d7[_0xd3cb('0x86')]);}else{_0x2f82d7['recordingURL']='';}var _0x331487=_0x30d6c0[_0xd3cb('0x81')]===_0xd3cb('0x88')?'eu':_0xd3cb('0x89');return getAccessToken(_0x30d6c0)['then'](function(_0x4a4d01){_0x234ed8=_0x4a4d01;return getUser(_0x234ed8,_0x331487,_0x30d6c0,_0x4a4bcd[_0xd3cb('0x3b')]);})[_0xd3cb('0x2d')](function(_0x150719){_0x2851f2=_0x150719;logger['info'](_0xd3cb('0x8a'),_0x2851f2['id']);return getEndUser(_0x234ed8,_0x331487,_0x30d6c0,_0x2f82d7[_0xd3cb('0x8b')],_0x2f82d7[_0xd3cb('0x8c')],_0x2851f2,_0x22128a);})[_0xd3cb('0x2d')](function(_0x4f2173){_0x30d7b0=_0x4f2173;return getCall(_0x234ed8,_0x331487,_0x30d6c0,_0x2851f2,_0x30d7b0,_0x22128a,_0x2f82d7,_0xd3cb('0x8d'));})[_0xd3cb('0x2d')](function(_0x1748d0){if(_0x1748d0){logger[_0xd3cb('0x3c')](_0xd3cb('0x8e'),_0x1748d0['id']);logger['info'](_0xd3cb('0x8f'),_0xd3cb('0x90'));emit(util[_0xd3cb('0x34')](_0xd3cb('0x91'),_0x4a4bcd[_0xd3cb('0x1c')]),_0xd3cb('0x92'),{'uri':_0xd3cb('0x93')+_0x30d6c0[_0xd3cb('0x81')]+_0xd3cb('0x94')+_0x1748d0['id']});}})['catch'](function(_0x35496c){logger[_0xd3cb('0x32')](_0xd3cb('0x8f'),JSON[_0xd3cb('0xf')](_0x35496c));});};exports[_0xd3cb('0x78')]=function(_0x3cf67a,_0x322346,_0x30a38a,_0x27b976,_0x477387,_0x436685,_0x1f8eab){var _0x4e34f8,_0x35e653,_0x30787b;_0x436685['host']=intUtil[_0xd3cb('0x83')](_0x436685['host']);_0x436685[_0xd3cb('0x82')]=intUtil['stripTrailingSlash'](_0x436685['serverUrl']);if(_0x1f8eab&&_0x1f8eab['recordingFormat']&&_0x1f8eab[_0xd3cb('0x95')]!==_0xd3cb('0x96')){logger[_0xd3cb('0x3c')]('[OUTBOUND]',_0xd3cb('0x84'));_0x322346[_0xd3cb('0x97')]=_0x436685[_0xd3cb('0x82')]+_0xd3cb('0x85')+_0x322346[_0xd3cb('0x86')]+_0xd3cb('0x87')+md5(_0x322346['uniqueid']);}var _0x19dec4=_0x436685[_0xd3cb('0x81')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x436685)[_0xd3cb('0x2d')](function(_0x1513f2){_0x30787b=_0x1513f2;return getUser(_0x30787b,_0x19dec4,_0x436685,_0x27b976[_0xd3cb('0x3b')]);})['then'](function(_0xd296e1){_0x4e34f8=_0xd296e1;logger[_0xd3cb('0x3c')]('The\x20User\x20ID\x20is:',_0x4e34f8['id']);return getEndUser(_0x30787b,_0x19dec4,_0x436685,_0x322346[_0xd3cb('0x98')],_0x322346[_0xd3cb('0x99')],_0x4e34f8,_0x30a38a);})['then'](function(_0x23abe4){_0x35e653=_0x23abe4;return getCall(_0x30787b,_0x19dec4,_0x436685,_0x4e34f8,_0x35e653,_0x30a38a,_0x322346,_0xd3cb('0x9a'));})['then'](function(_0x21d234){if(_0x21d234){logger[_0xd3cb('0x3c')](_0xd3cb('0x8e'),_0x21d234['id']);logger[_0xd3cb('0x3c')](_0xd3cb('0x9b'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd3cb('0x34')](_0xd3cb('0x91'),_0x27b976['name']),_0xd3cb('0x92'),{'uri':_0xd3cb('0x93')+_0x436685[_0xd3cb('0x81')]+_0xd3cb('0x94')+_0x21d234['id']});}})[_0xd3cb('0x31')](function(_0x19e78f){logger[_0xd3cb('0x32')]('[OUTBOUND]',JSON[_0xd3cb('0xf')](_0x19e78f));});};exports['unmanaged']=function(_0x70141b,_0x28edb6,_0x1a38c0,_0xe5c61e,_0x1ea675,_0x612a44){var _0x5ab199,_0x4ae22a,_0x2a5c5b;_0x612a44[_0xd3cb('0x81')]=intUtil[_0xd3cb('0x83')](_0x612a44[_0xd3cb('0x81')]);_0x612a44[_0xd3cb('0x82')]=intUtil[_0xd3cb('0x83')](_0x612a44[_0xd3cb('0x82')]);if(_0x1ea675&&_0x1ea675[_0xd3cb('0x9c')]){logger['info']('['+_0x28edb6[_0xd3cb('0x6b')][_0xd3cb('0x9d')]()+']',_0xd3cb('0x84'));_0x28edb6['recordingURL']=_0x612a44[_0xd3cb('0x82')]+_0xd3cb('0x85')+_0x28edb6[_0xd3cb('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x28edb6[_0xd3cb('0x86')]);}else{_0x28edb6['recordingURL']='';}var _0x52b2cb=_0x612a44[_0xd3cb('0x81')]===_0xd3cb('0x88')?'eu':'com';return getAccessToken(_0x612a44)[_0xd3cb('0x2d')](function(_0x5050f5){_0x2a5c5b=_0x5050f5;return getUser(_0x2a5c5b,_0x52b2cb,_0x612a44);})[_0xd3cb('0x2d')](function(_0x258251){_0x5ab199=_0x258251;logger[_0xd3cb('0x3c')]('The\x20User\x20ID\x20is:',_0x5ab199['id']);return getEndUser(_0x2a5c5b,_0x52b2cb,_0x612a44,_0x28edb6['calleridname'],_0x28edb6['calleridnum'],_0x5ab199,_0x1a38c0);})[_0xd3cb('0x2d')](function(_0x198304){_0x4ae22a=_0x198304;return getCall(_0x2a5c5b,_0x52b2cb,_0x612a44,_0x5ab199,_0x4ae22a,_0x1a38c0,_0x28edb6,'Inbound');})[_0xd3cb('0x2d')](function(_0x36c5ee){if(_0x36c5ee){logger[_0xd3cb('0x3c')]('The\x20Call\x20ID\x20is:',_0x36c5ee['id']);}})[_0xd3cb('0x31')](function(_0x28824b){logger[_0xd3cb('0x32')]('['+_0x28edb6[_0xd3cb('0x6b')][_0xd3cb('0x9d')]()+']',JSON[_0xd3cb('0xf')](_0x28824b));});}; \ 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 6a0e276..c929130 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 _0xe503=['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','mustache','../../../../config/logger','trigger','exec','data2','Script','render'];(function(_0x4c4cec,_0x53b896){var _0x37021b=function(_0x564bed){while(--_0x564bed){_0x4c4cec['push'](_0x4c4cec['shift']());}};_0x37021b(++_0x53b896);}(_0xe503,0x1b2));var _0x3e50=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xe503[_0xb1cf84];return _0x4bad2e;};'use strict';var util=require(_0x3e50('0x0'));var sh=require('shelljs');var Mustache=require(_0x3e50('0x1'));var logger=require(_0x3e50('0x2'))(_0x3e50('0x3'));exports[_0x3e50('0x4')]=function(_0x1a9c5c,_0x5ca49b){var _0x4e87c3=_0x1a9c5c[_0x3e50('0x5')]?_0x1a9c5c[_0x3e50('0x5')]:_0x3e50('0x6');var _0x1f17cd=_0x1a9c5c['data3']?Mustache[_0x3e50('0x7')](_0x1a9c5c['data3'],_0x5ca49b):_0x5ca49b;sh[_0x3e50('0x4')](_0x1f17cd,function(_0x2cf608,_0x4024ab,_0x402255){if(_0x2cf608!==0x0){logger[_0x3e50('0x8')](util[_0x3e50('0x9')](_0x3e50('0xa'),_0x4e87c3,_0x1f17cd,_0x2cf608,_0x402255));}else{logger[_0x3e50('0xb')](util[_0x3e50('0x9')](_0x3e50('0xc'),_0x4e87c3,_0x1f17cd,_0x4024ab));}});}; \ No newline at end of file +var _0x04bd=['../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache'];(function(_0x1655c6,_0xaac21e){var _0x50df2f=function(_0x8cd0ad){while(--_0x8cd0ad){_0x1655c6['push'](_0x1655c6['shift']());}};_0x50df2f(++_0xaac21e);}(_0x04bd,0x169));var _0xd04b=function(_0xe1c86b,_0x5ee94b){_0xe1c86b=_0xe1c86b-0x0;var _0x5c4faf=_0x04bd[_0xe1c86b];return _0x5c4faf;};'use strict';var util=require(_0xd04b('0x0'));var sh=require(_0xd04b('0x1'));var Mustache=require(_0xd04b('0x2'));var logger=require(_0xd04b('0x3'))(_0xd04b('0x4'));exports[_0xd04b('0x5')]=function(_0x4aea0d,_0x5afd0e){var _0x2a3320=_0x4aea0d[_0xd04b('0x6')]?_0x4aea0d[_0xd04b('0x6')]:_0xd04b('0x7');var _0x5bc853=_0x4aea0d[_0xd04b('0x8')]?Mustache['render'](_0x4aea0d[_0xd04b('0x8')],_0x5afd0e):_0x5afd0e;sh['exec'](_0x5bc853,function(_0x37a57c,_0x979a73,_0x4c8867){if(_0x37a57c!==0x0){logger[_0xd04b('0x9')](util[_0xd04b('0xa')](_0xd04b('0xb'),_0x2a3320,_0x5bc853,_0x37a57c,_0x4c8867));}else{logger[_0xd04b('0xc')](util[_0xd04b('0xa')](_0xd04b('0xd'),_0x2a3320,_0x5bc853,_0x979a73));}});}; \ 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 d7faca4..86a9571 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 _0x6889=['exec','toUpperCase','render','data5','number','headers','data6','parse','error','stack','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','data2','stringify','then','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','mustache','trigger'];(function(_0x59d9da,_0x305d45){var _0xbfac50=function(_0x1cd244){while(--_0x1cd244){_0x59d9da['push'](_0x59d9da['shift']());}};_0xbfac50(++_0x305d45);}(_0x6889,0x1dc));var _0x9688=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x6889[_0x1fdb40];return _0x281f93;};'use strict';var rp=require('request-promise');var util=require(_0x9688('0x0'));var _=require(_0x9688('0x1'));var Mustache=require(_0x9688('0x2'));var logger=require('../../../../config/logger')(_0x9688('0x3'));exports[_0x9688('0x4')]=function(_0x294a1f,_0x36abcc){var _0x3a46a6,_0x192a49;var _0x1d850e={'method':_0x294a1f['data1'][_0x9688('0x5')](),'uri':Mustache[_0x9688('0x6')](_0x294a1f['data2'],_0x36abcc),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x294a1f[_0x9688('0x7')])===_0x9688('0x8')&&parseInt(_0x294a1f[_0x9688('0x7')])>=0x1&&parseInt(_0x294a1f[_0x9688('0x7')])<=0xa?parseInt(_0x294a1f[_0x9688('0x7')])*0x3e8:0x5*0x3e8};try{_0x1d850e[_0x9688('0x9')]=_0x294a1f[_0x9688('0xa')]?JSON[_0x9688('0xb')](Mustache['render'](_0x294a1f[_0x9688('0xa')],_0x36abcc)):{};}catch(_0x1b960a){logger[_0x9688('0xc')](_0x1b960a[_0x9688('0xd')]);}switch(_0x294a1f['data1']['toUpperCase']()){case'GET':case'DELETE':_0x3a46a6=null;_0x1d850e['qs']=_0x36abcc;break;case _0x9688('0xe'):case _0x9688('0xf'):if(_0x294a1f[_0x9688('0x10')]){try{_0x3a46a6=JSON[_0x9688('0xb')](Mustache[_0x9688('0x6')](_0x294a1f['data7'],_0x36abcc));_0x1d850e[_0x9688('0x11')]=_0x3a46a6;}catch(_0x39540d){logger['error'](_0x39540d[_0x9688('0xd')]);logger[_0x9688('0xc')](_0x9688('0x12'));}}else{_0x3a46a6=_0x36abcc;_0x1d850e[_0x9688('0x11')]=_0x3a46a6;}break;}logger['info'](util[_0x9688('0x13')](_0x9688('0x14'),_0x294a1f[_0x9688('0x15')],_0x294a1f[_0x9688('0x16')],JSON[_0x9688('0x17')](_0x1d850e)));rp(_0x1d850e)[_0x9688('0x18')](function(_0x2dd10c){_0x3a46a6=!_[_0x9688('0x19')](_0x3a46a6)?_0x9688('0x1a')+_0x3a46a6:'';_0x192a49=typeof _0x2dd10c[_0x9688('0x11')]==='object'?JSON[_0x9688('0x17')](_0x2dd10c['body']):_0x2dd10c[_0x9688('0x11')];logger[_0x9688('0x1b')](util[_0x9688('0x13')](_0x9688('0x1c'),_0x294a1f['data1'],_0x294a1f['data2'],_0x2dd10c['statusCode'],_0x192a49));})['catch'](function(_0x544731){logger[_0x9688('0xc')](util[_0x9688('0x13')](_0x9688('0x1d'),_0x294a1f['data1'],_0x294a1f['data2'],_0x544731['statusCode'],_0x544731[_0x9688('0x1e')],_0x544731[_0x9688('0x1f')]));});}; \ No newline at end of file +var _0x6cc6=['data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','util','lodash','mustache','trigger','exec','render','data2','data5','number','headers','data6','parse','stack','data1','GET','DELETE','PUT'];(function(_0x7ecf62,_0x1da8e9){var _0x5e9451=function(_0xa5e280){while(--_0xa5e280){_0x7ecf62['push'](_0x7ecf62['shift']());}};_0x5e9451(++_0x1da8e9);}(_0x6cc6,0x1a0));var _0x66cc=function(_0x554acd,_0x350d2a){_0x554acd=_0x554acd-0x0;var _0x1d2a22=_0x6cc6[_0x554acd];return _0x1d2a22;};'use strict';var rp=require(_0x66cc('0x0'));var util=require(_0x66cc('0x1'));var _=require(_0x66cc('0x2'));var Mustache=require(_0x66cc('0x3'));var logger=require('../../../../config/logger')(_0x66cc('0x4'));exports[_0x66cc('0x5')]=function(_0xe6a422,_0x517e77){var _0x320674,_0x2babaa;var _0x5041cf={'method':_0xe6a422['data1']['toUpperCase'](),'uri':Mustache[_0x66cc('0x6')](_0xe6a422[_0x66cc('0x7')],_0x517e77),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xe6a422[_0x66cc('0x8')])===_0x66cc('0x9')&&parseInt(_0xe6a422[_0x66cc('0x8')])>=0x1&&parseInt(_0xe6a422[_0x66cc('0x8')])<=0xa?parseInt(_0xe6a422['data5'])*0x3e8:0x5*0x3e8};try{_0x5041cf[_0x66cc('0xa')]=_0xe6a422[_0x66cc('0xb')]?JSON[_0x66cc('0xc')](Mustache[_0x66cc('0x6')](_0xe6a422['data6'],_0x517e77)):{};}catch(_0x34c62b){logger['error'](_0x34c62b[_0x66cc('0xd')]);}switch(_0xe6a422[_0x66cc('0xe')]['toUpperCase']()){case _0x66cc('0xf'):case _0x66cc('0x10'):_0x320674=null;_0x5041cf['qs']=_0x517e77;break;case'POST':case _0x66cc('0x11'):if(_0xe6a422[_0x66cc('0x12')]){try{_0x320674=JSON[_0x66cc('0xc')](Mustache[_0x66cc('0x6')](_0xe6a422[_0x66cc('0x12')],_0x517e77));_0x5041cf[_0x66cc('0x13')]=_0x320674;}catch(_0x12d572){logger['error'](_0x12d572['stack']);logger[_0x66cc('0x14')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x320674=_0x517e77;_0x5041cf[_0x66cc('0x13')]=_0x320674;}break;}logger[_0x66cc('0x15')](util[_0x66cc('0x16')](_0x66cc('0x17'),_0xe6a422['data1'],_0xe6a422[_0x66cc('0x7')],JSON['stringify'](_0x5041cf)));rp(_0x5041cf)[_0x66cc('0x18')](function(_0x320ac2){_0x320674=!_['isNil'](_0x320674)?',\x20request\x20body:\x20'+_0x320674:'';_0x2babaa=typeof _0x320ac2['body']===_0x66cc('0x19')?JSON['stringify'](_0x320ac2[_0x66cc('0x13')]):_0x320ac2[_0x66cc('0x13')];logger[_0x66cc('0x15')](util[_0x66cc('0x16')](_0x66cc('0x1a'),_0xe6a422[_0x66cc('0xe')],_0xe6a422[_0x66cc('0x7')],_0x320ac2['statusCode'],_0x2babaa));})[_0x66cc('0x1b')](function(_0x490ab2){logger[_0x66cc('0x14')](util[_0x66cc('0x16')](_0x66cc('0x1c'),_0xe6a422[_0x66cc('0xe')],_0xe6a422[_0x66cc('0x7')],_0x490ab2[_0x66cc('0x1d')],_0x490ab2[_0x66cc('0x1e')],_0x490ab2['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1a123a9..7437232 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 _0x4c59=['message','catch','bluebird','routing','client','request','debug','rpc','error'];(function(_0xb867a8,_0x926a63){var _0x1e5dcd=function(_0x1f3c72){while(--_0x1f3c72){_0xb867a8['push'](_0xb867a8['shift']());}};_0x1e5dcd(++_0x926a63);}(_0x4c59,0x77));var _0x94c5=function(_0x3bf6bb,_0x4b85c7){_0x3bf6bb=_0x3bf6bb-0x0;var _0x4f9809=_0x4c59[_0x3bf6bb];return _0x4f9809;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x94c5('0x0'));var logger=require('../../config/logger')(_0x94c5('0x1'));var client=jayson[_0x94c5('0x2')]['http']({'port':0x2329});client['Request']=function(_0x26afd6,_0x5665e8){return new BPromise(function(_0x2cbe83,_0x170474){return client[_0x94c5('0x3')](_0x26afd6,_0x5665e8)['then'](function(_0x2cf8c2){logger[_0x94c5('0x4')](_0x94c5('0x5'),'routing',_0x26afd6,_0x5665e8,_0x2cf8c2);if(_0x2cf8c2[_0x94c5('0x6')]){logger[_0x94c5('0x6')](_0x94c5('0x5'),_0x94c5('0x1'),_0x26afd6,_0x2cf8c2['error'][_0x94c5('0x7')],_0x5665e8);return _0x170474(_0x2cf8c2[_0x94c5('0x6')][_0x94c5('0x7')]);}else{return _0x2cbe83(_0x2cf8c2['result']);}})[_0x94c5('0x8')](function(_0x12bcc5){logger[_0x94c5('0x6')](_0x94c5('0x5'),_0x94c5('0x1'),_0x26afd6,_0x12bcc5,_0x5665e8);return _0x170474(_0x12bcc5);});});};module['exports']=client; \ No newline at end of file +var _0xf437=['routing','client','Request','request','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x548483,_0x5e53ab){var _0x53afbd=function(_0x4c9f9c){while(--_0x4c9f9c){_0x548483['push'](_0x548483['shift']());}};_0x53afbd(++_0x5e53ab);}(_0xf437,0x196));var _0x7f43=function(_0x42835a,_0x5259a7){_0x42835a=_0x42835a-0x0;var _0xa4f23b=_0xf437[_0x42835a];return _0xa4f23b;};'use strict';var jayson=require(_0x7f43('0x0'));var BPromise=require(_0x7f43('0x1'));var logger=require('../../config/logger')(_0x7f43('0x2'));var client=jayson[_0x7f43('0x3')]['http']({'port':0x2329});client[_0x7f43('0x4')]=function(_0x484ae7,_0x5b1ed2){return new BPromise(function(_0x3b3d51,_0x24b325){return client[_0x7f43('0x5')](_0x484ae7,_0x5b1ed2)['then'](function(_0x336cbb){logger['debug'](_0x7f43('0x6'),'routing',_0x484ae7,_0x5b1ed2,_0x336cbb);if(_0x336cbb[_0x7f43('0x7')]){logger[_0x7f43('0x7')](_0x7f43('0x6'),_0x7f43('0x2'),_0x484ae7,_0x336cbb[_0x7f43('0x7')]['message'],_0x5b1ed2);return _0x24b325(_0x336cbb[_0x7f43('0x7')][_0x7f43('0x8')]);}else{return _0x3b3d51(_0x336cbb[_0x7f43('0x9')]);}})[_0x7f43('0xa')](function(_0x336d02){logger[_0x7f43('0x7')](_0x7f43('0x6'),_0x7f43('0x2'),_0x484ae7,_0x336d02,_0x5b1ed2);return _0x24b325(_0x336d02);});});};module[_0x7f43('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4eec7c7..7350dbf 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 _0x5f60=['then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','log','./server','./lib/email','./rpc/setting','resolve'];(function(_0x397b8d,_0x19e714){var _0x166eaf=function(_0x4d093d){while(--_0x4d093d){_0x397b8d['push'](_0x397b8d['shift']());}};_0x166eaf(++_0x19e714);}(_0x5f60,0x134));var _0x05f6=function(_0x82a071,_0x252266){_0x82a071=_0x82a071-0x0;var _0x15dda9=_0x5f60[_0x82a071];return _0x15dda9;};'use strict';var BPromise=require('bluebird');var server=require(_0x05f6('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x05f6('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x05f6('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x05f6('0x3')]()[_0x05f6('0x4')](mailAccount['getMailAccounts']())[_0x05f6('0x4')](realtime[_0x05f6('0x5')]())[_0x05f6('0x4')](function(){email[_0x05f6('0x6')](realtime[_0x05f6('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x05f6('0x4')](function(){return setting[_0x05f6('0x8')]();})[_0x05f6('0x4')](function(_0x2e2455){return setInterval(initRealtime,_0x2e2455[_0x05f6('0x9')]*0x3e8);})[_0x05f6('0xa')](function(_0x4ed4a7){console[_0x05f6('0xb')](_0x4ed4a7);});}main(); \ No newline at end of file +var _0xc2d3=['catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x13d52d,_0xd2e31d){var _0x59eddf=function(_0x38ecdd){while(--_0x38ecdd){_0x13d52d['push'](_0x13d52d['shift']());}};_0x59eddf(++_0xd2e31d);}(_0xc2d3,0xfe));var _0x3c2d=function(_0x2902e2,_0x5033a1){_0x2902e2=_0x2902e2-0x0;var _0x5d3589=_0xc2d3[_0x2902e2];return _0x5d3589;};'use strict';var BPromise=require(_0x3c2d('0x0'));var server=require(_0x3c2d('0x1'));var Realtime=require(_0x3c2d('0x2'));var EmailChannel=require(_0x3c2d('0x3'));var mailAccount=require(_0x3c2d('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x3c2d('0x5')]()[_0x3c2d('0x6')](mailAccount['getMailAccounts']())[_0x3c2d('0x6')](realtime[_0x3c2d('0x7')]())[_0x3c2d('0x6')](function(){email['refresh'](realtime[_0x3c2d('0x8')]);return realtime;});}function main(){return server[_0x3c2d('0x9')](realtime,email)[_0x3c2d('0x6')](function(){return initRealtime();})[_0x3c2d('0x6')](function(){return setting[_0x3c2d('0xa')]();})['then'](function(_0x74547c){return setInterval(initRealtime,_0x74547c[_0x3c2d('0xb')]*0x3e8);})[_0x3c2d('0xc')](function(_0x285d3a){console[_0x3c2d('0xd')](_0x285d3a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ad3173d..d4ff9f5 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 _0xb8d0=['refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','verified','catch','verify','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb8d0,0x19b));var _0x0b8d=function(_0x46f58a,_0x3a7d17){_0x46f58a=_0x46f58a-0x0;var _0x5e56ec=_0xb8d0[_0x46f58a];return _0x5e56ec;};'use strict';var _=require(_0x0b8d('0x0'));var moment=require(_0x0b8d('0x1'));var BPromise=require(_0x0b8d('0x2'));var md5=require(_0x0b8d('0x3'));var Redis=require('ioredis');var config=require(_0x0b8d('0x4'));var logger=require(_0x0b8d('0x5'))(_0x0b8d('0x6'));config[_0x0b8d('0x7')]=_[_0x0b8d('0x8')](config[_0x0b8d('0x7')],{'host':_0x0b8d('0x9'),'port':0x18eb});var io=require(_0x0b8d('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x0b8d('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x115875){logger[_0x0b8d('0xc')](_0x0b8d('0xd'));this[_0x0b8d('0xe')]=_0x115875[_0x0b8d('0xe')];this[_0x0b8d('0xf')]={};this[_0x0b8d('0x10')]=new EmailSmtp();}EmailChannel[_0x0b8d('0x11')][_0x0b8d('0x12')]=function(_0x2b4abf){var _0x50729e=this[_0x0b8d('0xe')][_0x2b4abf];var _0xb6bcc2={'id':_0x50729e['id'],'name':_0x50729e[_0x0b8d('0x13')],'key':_0x50729e[_0x0b8d('0x14')],'active':_0x50729e[_0x0b8d('0x15')],'Imap':{'status':_0x50729e[_0x0b8d('0x16')][_0x0b8d('0x17')],'messageStatus':_0x50729e['Imap'][_0x0b8d('0x18')],'total':_0x50729e[_0x0b8d('0x16')][_0x0b8d('0x19')]}};if(_[_0x0b8d('0x1a')](md5Accounts[_0x2b4abf])){md5Accounts[_0x2b4abf]={};}var _0x26d422=md5(JSON[_0x0b8d('0x1b')](_0xb6bcc2));if(md5Accounts[_0x2b4abf][_0x0b8d('0x3')]!==_0x26d422){md5Accounts[_0x2b4abf]['md5']=_0x26d422;io[_0x0b8d('0x12')](_0x0b8d('0x1c'),_0xb6bcc2);}};EmailChannel['prototype'][_0x0b8d('0x1d')]=function(_0x280a39){for(var _0x525fdc in _0x280a39){if(_0x280a39[_0x0b8d('0x1e')](_0x525fdc)){if(_0x280a39[_0x525fdc][_0x0b8d('0x16')]&&_0x280a39[_0x525fdc][_0x0b8d('0x15')]){var _0x4ca95a=_0x280a39[_0x525fdc]['Imap'];if(!this[_0x0b8d('0xf')][_0x0b8d('0x1e')](_0x4ca95a['id'])){this['imapAccounts'][_0x4ca95a['id']]=new EmailImap(_0x4ca95a,_0x280a39[_0x525fdc]['email']);this[_0x0b8d('0xf')][_0x4ca95a['id']]['on'](_0x0b8d('0x1f'),this[_0x0b8d('0x20')][_0x0b8d('0x21')](this,_0x525fdc));this[_0x0b8d('0xf')][_0x4ca95a['id']]['on'](_0x0b8d('0x6'),this[_0x0b8d('0x22')][_0x0b8d('0x21')](this,_0x525fdc));this[_0x0b8d('0xf')][_0x4ca95a['id']]['on'](_0x0b8d('0x23'),this[_0x0b8d('0x24')]['bind'](this,_0x525fdc));this[_0x0b8d('0xf')][_0x4ca95a['id']]['on']('error',this[_0x0b8d('0x25')][_0x0b8d('0x21')](this,_0x525fdc));}}else{if(_['isNil'](this[_0x0b8d('0xe')][_0x525fdc][_0x0b8d('0x16')])){this[_0x0b8d('0xe')][_0x525fdc]['Imap']={};}this['mailAccounts'][_0x525fdc][_0x0b8d('0x16')][_0x0b8d('0x17')]=_0x0b8d('0x26');this[_0x0b8d('0xe')][_0x525fdc][_0x0b8d('0x16')]['messageStatus']='';this[_0x0b8d('0x12')](_0x525fdc);}}}};EmailChannel[_0x0b8d('0x11')][_0x0b8d('0x20')]=function(_0x243eed,_0x48b56){if(this[_0x0b8d('0xe')][_0x243eed]){this[_0x0b8d('0xe')][_0x243eed]['Imap']['status']=_0x0b8d('0x27');this['mailAccounts'][_0x243eed]['Imap'][_0x0b8d('0x18')]=_0x48b56['name'];if(_0x48b56[_0x0b8d('0x28')]){this[_0x0b8d('0xe')][_0x243eed][_0x0b8d('0x16')]['total']=_0x48b56[_0x0b8d('0x28')]['total'];}return this[_0x0b8d('0x12')](_0x243eed);}};EmailChannel['prototype'][_0x0b8d('0x22')]=function(_0xe2672f,_0x3a0cb9){logger[_0x0b8d('0xc')](_0x0b8d('0x29'),_0x3a0cb9[_0x0b8d('0x2a')],_0x3a0cb9['lastName'],_0x3a0cb9[_0x0b8d('0x2b')],_0xe2672f);if(this['mailAccounts'][_0xe2672f]){return mailAccount['notify'](_0xe2672f,_0x3a0cb9)[_0x0b8d('0x2c')](function(_0x473191){if(_0x473191){logger[_0x0b8d('0xc')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x36300a){logger[_0x0b8d('0x2d')](_0x0b8d('0x2e'),JSON['stringify'](_0x36300a));});}};EmailChannel[_0x0b8d('0x11')][_0x0b8d('0x24')]=function(_0x2b9b85){if(this[_0x0b8d('0xe')][_0x2b9b85]&&this[_0x0b8d('0xe')][_0x2b9b85][_0x0b8d('0x16')]){if(this['imapAccounts'][this[_0x0b8d('0xe')][_0x2b9b85][_0x0b8d('0x16')]['id']]){delete this['imapAccounts'][this[_0x0b8d('0xe')][_0x2b9b85][_0x0b8d('0x16')]['id']];}this[_0x0b8d('0xe')][_0x2b9b85][_0x0b8d('0x16')]['lastSync']=moment();this[_0x0b8d('0x12')](_0x2b9b85);}};EmailChannel[_0x0b8d('0x11')]['handleImapError']=function(_0x4de680,_0x21481d){if(this[_0x0b8d('0xe')][_0x4de680]){this[_0x0b8d('0xe')][_0x4de680]['Imap'][_0x0b8d('0x17')]=_0x0b8d('0x2d');this[_0x0b8d('0xe')][_0x4de680][_0x0b8d('0x16')][_0x0b8d('0x18')]=_0x21481d;return this['emit'](_0x4de680);}};EmailChannel[_0x0b8d('0x11')][_0x0b8d('0x2f')]=function(_0x39b1e3,_0x29df25){return this[_0x0b8d('0x10')][_0x0b8d('0x30')](_0x39b1e3,_0x29df25);};EmailChannel[_0x0b8d('0x11')][_0x0b8d('0x31')]=function(_0x37169b){var _0x528589=this;if(this[_0x0b8d('0xe')][_0x37169b['id']]){if(_[_0x0b8d('0x1a')](this[_0x0b8d('0xe')][_0x37169b['id']][_0x0b8d('0x32')])){this[_0x0b8d('0xe')][_0x37169b['id']][_0x0b8d('0x32')]={};}this[_0x0b8d('0xe')][_0x37169b['id']][_0x0b8d('0x32')]['lastSync']=moment();return new BPromise(function(_0x2a5c99,_0x5ceca0){return _0x528589['smtp']['verify'](_0x37169b)[_0x0b8d('0x2c')](function(_0x4eca26){_0x528589[_0x0b8d('0xe')][_0x37169b['id']][_0x0b8d('0x32')][_0x0b8d('0x17')]=_0x0b8d('0x33');_0x528589[_0x0b8d('0xe')][_0x37169b['id']]['Smtp'][_0x0b8d('0x18')]='';_0x528589['emit'](_0x37169b['id']);_0x2a5c99(_0x4eca26);})[_0x0b8d('0x34')](function(_0x1ce402){_0x528589[_0x0b8d('0xe')][_0x37169b['id']][_0x0b8d('0x32')][_0x0b8d('0x17')]=_0x0b8d('0x2d');_0x528589[_0x0b8d('0xe')][_0x37169b['id']][_0x0b8d('0x32')][_0x0b8d('0x18')]=_0x1ce402;_0x528589[_0x0b8d('0x12')](_0x37169b['id']);_0x5ceca0(_0x1ce402);});});}return this[_0x0b8d('0x10')][_0x0b8d('0x35')](_0x37169b);};module[_0x0b8d('0x36')]=EmailChannel; \ No newline at end of file +var _0x4381=['messageStatus','isNil','stringify','refresh','hasOwnProperty','box','bind','handleImapEmail','end','error','handleImapError','disabled','handleImapBox','connected','total','messages','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status'];(function(_0xfca14d,_0x90643e){var _0x270063=function(_0x5aae85){while(--_0x5aae85){_0xfca14d['push'](_0xfca14d['shift']());}};_0x270063(++_0x90643e);}(_0x4381,0x1bf));var _0x1438=function(_0x16710a,_0x512193){_0x16710a=_0x16710a-0x0;var _0x25fcb5=_0x4381[_0x16710a];return _0x25fcb5;};'use strict';var _=require(_0x1438('0x0'));var moment=require(_0x1438('0x1'));var BPromise=require('bluebird');var md5=require(_0x1438('0x2'));var Redis=require('ioredis');var config=require(_0x1438('0x3'));var logger=require(_0x1438('0x4'))(_0x1438('0x5'));config[_0x1438('0x6')]=_[_0x1438('0x7')](config[_0x1438('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1438('0x8'))(new Redis(config[_0x1438('0x6')]));var EmailImap=require(_0x1438('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x1438('0xa'));var md5Accounts={};function EmailChannel(_0x433762){logger[_0x1438('0xb')]('start\x20email\x20channel');this[_0x1438('0xc')]=_0x433762[_0x1438('0xc')];this[_0x1438('0xd')]={};this[_0x1438('0xe')]=new EmailSmtp();}EmailChannel[_0x1438('0xf')][_0x1438('0x10')]=function(_0xa4da55){var _0x33caeb=this[_0x1438('0xc')][_0xa4da55];var _0x1efb21={'id':_0x33caeb['id'],'name':_0x33caeb[_0x1438('0x11')],'key':_0x33caeb['key'],'active':_0x33caeb[_0x1438('0x12')],'Imap':{'status':_0x33caeb[_0x1438('0x13')][_0x1438('0x14')],'messageStatus':_0x33caeb[_0x1438('0x13')][_0x1438('0x15')],'total':_0x33caeb[_0x1438('0x13')]['total']}};if(_[_0x1438('0x16')](md5Accounts[_0xa4da55])){md5Accounts[_0xa4da55]={};}var _0x273f87=md5(JSON[_0x1438('0x17')](_0x1efb21));if(md5Accounts[_0xa4da55][_0x1438('0x2')]!==_0x273f87){md5Accounts[_0xa4da55]['md5']=_0x273f87;io[_0x1438('0x10')]('mailAccount:update',_0x1efb21);}};EmailChannel['prototype'][_0x1438('0x18')]=function(_0x1344ee){for(var _0xf433d4 in _0x1344ee){if(_0x1344ee[_0x1438('0x19')](_0xf433d4)){if(_0x1344ee[_0xf433d4][_0x1438('0x13')]&&_0x1344ee[_0xf433d4]['active']){var _0x5d1b6c=_0x1344ee[_0xf433d4][_0x1438('0x13')];if(!this[_0x1438('0xd')]['hasOwnProperty'](_0x5d1b6c['id'])){this[_0x1438('0xd')][_0x5d1b6c['id']]=new EmailImap(_0x5d1b6c,_0x1344ee[_0xf433d4][_0x1438('0x5')]);this['imapAccounts'][_0x5d1b6c['id']]['on'](_0x1438('0x1a'),this['handleImapBox'][_0x1438('0x1b')](this,_0xf433d4));this['imapAccounts'][_0x5d1b6c['id']]['on'](_0x1438('0x5'),this[_0x1438('0x1c')][_0x1438('0x1b')](this,_0xf433d4));this[_0x1438('0xd')][_0x5d1b6c['id']]['on'](_0x1438('0x1d'),this['handleImapEnd']['bind'](this,_0xf433d4));this['imapAccounts'][_0x5d1b6c['id']]['on'](_0x1438('0x1e'),this[_0x1438('0x1f')][_0x1438('0x1b')](this,_0xf433d4));}}else{if(_['isNil'](this[_0x1438('0xc')][_0xf433d4][_0x1438('0x13')])){this[_0x1438('0xc')][_0xf433d4][_0x1438('0x13')]={};}this[_0x1438('0xc')][_0xf433d4][_0x1438('0x13')]['status']=_0x1438('0x20');this[_0x1438('0xc')][_0xf433d4]['Imap']['messageStatus']='';this[_0x1438('0x10')](_0xf433d4);}}}};EmailChannel[_0x1438('0xf')][_0x1438('0x21')]=function(_0x2b96ea,_0x991aaf){if(this[_0x1438('0xc')][_0x2b96ea]){this[_0x1438('0xc')][_0x2b96ea][_0x1438('0x13')][_0x1438('0x14')]=_0x1438('0x22');this[_0x1438('0xc')][_0x2b96ea]['Imap']['messageStatus']=_0x991aaf[_0x1438('0x11')];if(_0x991aaf['messages']){this['mailAccounts'][_0x2b96ea][_0x1438('0x13')][_0x1438('0x23')]=_0x991aaf[_0x1438('0x24')][_0x1438('0x23')];}return this[_0x1438('0x10')](_0x2b96ea);}};EmailChannel['prototype'][_0x1438('0x1c')]=function(_0x1d6bfd,_0x555a8c){logger[_0x1438('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x555a8c[_0x1438('0x25')],_0x555a8c[_0x1438('0x26')],_0x555a8c['from'],_0x1d6bfd);if(this[_0x1438('0xc')][_0x1d6bfd]){return mailAccount[_0x1438('0x27')](_0x1d6bfd,_0x555a8c)[_0x1438('0x28')](function(_0x5557a5){if(_0x5557a5){logger[_0x1438('0xb')](_0x1438('0x29'));}})[_0x1438('0x2a')](function(_0x4a0f83){logger[_0x1438('0x1e')](_0x1438('0x2b'),JSON[_0x1438('0x17')](_0x4a0f83));});}};EmailChannel[_0x1438('0xf')][_0x1438('0x2c')]=function(_0x590647){if(this[_0x1438('0xc')][_0x590647]&&this[_0x1438('0xc')][_0x590647][_0x1438('0x13')]){if(this[_0x1438('0xd')][this[_0x1438('0xc')][_0x590647][_0x1438('0x13')]['id']]){delete this[_0x1438('0xd')][this[_0x1438('0xc')][_0x590647][_0x1438('0x13')]['id']];}this['mailAccounts'][_0x590647]['Imap'][_0x1438('0x2d')]=moment();this['emit'](_0x590647);}};EmailChannel[_0x1438('0xf')][_0x1438('0x1f')]=function(_0x364faa,_0x118cf6){if(this[_0x1438('0xc')][_0x364faa]){this[_0x1438('0xc')][_0x364faa][_0x1438('0x13')][_0x1438('0x14')]=_0x1438('0x1e');this[_0x1438('0xc')][_0x364faa][_0x1438('0x13')][_0x1438('0x15')]=_0x118cf6;return this[_0x1438('0x10')](_0x364faa);}};EmailChannel[_0x1438('0xf')][_0x1438('0x2e')]=function(_0x2341a2,_0x344667){return this[_0x1438('0xe')]['send'](_0x2341a2,_0x344667);};EmailChannel[_0x1438('0xf')][_0x1438('0x2f')]=function(_0x30bf67){var _0x4e8bc6=this;if(this[_0x1438('0xc')][_0x30bf67['id']]){if(_['isNil'](this[_0x1438('0xc')][_0x30bf67['id']][_0x1438('0x30')])){this['mailAccounts'][_0x30bf67['id']]['Smtp']={};}this['mailAccounts'][_0x30bf67['id']][_0x1438('0x30')][_0x1438('0x2d')]=moment();return new BPromise(function(_0x3ad961,_0x36bd88){return _0x4e8bc6['smtp'][_0x1438('0x31')](_0x30bf67)['then'](function(_0x80795f){_0x4e8bc6[_0x1438('0xc')][_0x30bf67['id']]['Smtp'][_0x1438('0x14')]=_0x1438('0x32');_0x4e8bc6[_0x1438('0xc')][_0x30bf67['id']][_0x1438('0x30')][_0x1438('0x15')]='';_0x4e8bc6['emit'](_0x30bf67['id']);_0x3ad961(_0x80795f);})[_0x1438('0x2a')](function(_0x4163c7){_0x4e8bc6['mailAccounts'][_0x30bf67['id']]['Smtp'][_0x1438('0x14')]='error';_0x4e8bc6[_0x1438('0xc')][_0x30bf67['id']][_0x1438('0x30')]['messageStatus']=_0x4163c7;_0x4e8bc6[_0x1438('0x10')](_0x30bf67['id']);_0x36bd88(_0x4163c7);});});}return this[_0x1438('0xe')]['verify'](_0x30bf67);};module[_0x1438('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 71710e2..3280439 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 _0x6ae0=['bind','end','handleEnd','inherits','prototype','connTimeout','authTimeout','isNil','user','password','host','port','required','getHost','handleReady','handleOpenBox','handleError','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','error','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','closeBox','emit','hasOwnProperty','upperFirst','path','util','imap','lodash','simpleParser','Iconv','EventEmitter','./utils','email','mailbox','account','getAccount','once','ready'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x6ae0,0x192));var _0x06ae=function(_0x47856a,_0x1ad7a0){_0x47856a=_0x47856a-0x0;var _0x1edd96=_0x6ae0[_0x47856a];return _0x1edd96;};'use strict';var fs=require('fs');var path=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var Imap=require(_0x06ae('0x2'));var _=require(_0x06ae('0x3'));var rs=require('randomstring');var simpleParser=require('mailparser')[_0x06ae('0x4')];var Iconv=require('iconv')[_0x06ae('0x5')];var EventEmitter=require('events')[_0x06ae('0x6')];var utils=require(_0x06ae('0x7'));var logger=require('../../../config/logger')(_0x06ae('0x8'));function EmailImap(_0x51bac4,_0x26167c){this[_0x06ae('0x9')]='INBOX';this[_0x06ae('0xa')]=this[_0x06ae('0xb')](_0x51bac4,_0x26167c);this[_0x06ae('0x2')]=new Imap(this[_0x06ae('0xa')]);this[_0x06ae('0x2')][_0x06ae('0xc')](_0x06ae('0xd'),this['handleReady'][_0x06ae('0xe')](this));this[_0x06ae('0x2')][_0x06ae('0xc')](_0x06ae('0xf'),this[_0x06ae('0x10')][_0x06ae('0xe')](this));this[_0x06ae('0x2')]['on']('error',this['handleError']['bind'](this));this[_0x06ae('0x2')]['connect']();}util[_0x06ae('0x11')](EmailImap,EventEmitter);EmailImap[_0x06ae('0x12')][_0x06ae('0xb')]=function(_0x279e03,_0x516fd4){var _0x4bba79={'connTimeout':_0x279e03[_0x06ae('0x13')]?_0x279e03['connTimeout']*0x3e8:0x2710,'authTimeout':_0x279e03[_0x06ae('0x14')]?_0x279e03[_0x06ae('0x14')]*0x3e8:0x1388};if(_[_0x06ae('0x15')](_0x279e03['service'])){if(_0x279e03['authentication']){_0x4bba79['user']=_0x279e03[_0x06ae('0x16')];_0x4bba79[_0x06ae('0x17')]=_0x279e03[_0x06ae('0x17')];}_0x4bba79[_0x06ae('0x18')]=_0x279e03[_0x06ae('0x18')];_0x4bba79[_0x06ae('0x19')]=_0x279e03[_0x06ae('0x19')]||0x3e1;if(_0x279e03['tls']){_0x4bba79['tls']=!![];}else{_0x4bba79['tls']=![];_0x4bba79['autotls']=_0x06ae('0x1a');}}else{_0x4bba79[_0x06ae('0x16')]=_0x279e03['user'];_0x4bba79[_0x06ae('0x17')]=_0x279e03[_0x06ae('0x17')];_0x4bba79[_0x06ae('0x18')]=utils[_0x06ae('0x1b')](_0x279e03['service']);_0x4bba79[_0x06ae('0x19')]=0x3e1;_0x4bba79['tls']=!![];}_0x4bba79[_0x06ae('0x8')]=_0x516fd4||_0x279e03[_0x06ae('0x16')]||'anonymous@xcally.com';return _0x4bba79;};EmailImap[_0x06ae('0x12')][_0x06ae('0x1c')]=function(){this[_0x06ae('0x2')]['openBox'](this[_0x06ae('0x9')],![],this[_0x06ae('0x1d')]['bind'](this));};EmailImap[_0x06ae('0x12')][_0x06ae('0x1d')]=function(_0x40f522,_0x4f69f2){if(_0x40f522){this[_0x06ae('0x1e')](_0x40f522,!![]);}else{this['emit'](_0x06ae('0x1f'),_0x4f69f2);this[_0x06ae('0x20')]();}};EmailImap[_0x06ae('0x12')][_0x06ae('0x21')]=function(_0x5dce44){if(_0x5dce44){this[_0x06ae('0x1e')](_0x5dce44,!![]);}else{this[_0x06ae('0x2')][_0x06ae('0xf')]();}};EmailImap[_0x06ae('0x12')]['readUnseen']=function(){this[_0x06ae('0x2')]['search']([_0x06ae('0x22')],this[_0x06ae('0x23')][_0x06ae('0xe')](this));};EmailImap[_0x06ae('0x12')][_0x06ae('0x23')]=function(_0x4a6336,_0x2a1d3a){if(_0x4a6336){this[_0x06ae('0x1e')](_0x4a6336,!![]);}else{if(_0x2a1d3a['length']){try{var _0x3b8011=this['imap'][_0x06ae('0x24')](_0x2a1d3a,{'bodies':'','markSeen':!![]});_0x3b8011['on']('message',this[_0x06ae('0x25')][_0x06ae('0xe')](this));_0x3b8011[_0x06ae('0xc')]('error',this[_0x06ae('0x26')]['bind'](this));_0x3b8011['once']('end',this[_0x06ae('0x27')][_0x06ae('0xe')](this));}catch(_0x526975){logger[_0x06ae('0x28')](_0x526975);}}else{this[_0x06ae('0x2')]['closeBox'](!![],this[_0x06ae('0x21')][_0x06ae('0xe')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x5b707c,_0x28fdb6){_0x5b707c['on'](_0x06ae('0x29'),this[_0x06ae('0x2a')]['bind'](this));_0x5b707c['once'](_0x06ae('0x2b'),this['handleMessageAttributes']['bind'](this));_0x5b707c[_0x06ae('0xc')](_0x06ae('0xf'),this[_0x06ae('0x2c')][_0x06ae('0xe')](this));};EmailImap['prototype'][_0x06ae('0x2a')]=function(_0x31b11b,_0x417ce6){simpleParser(_0x31b11b,{'Iconv':Iconv},this[_0x06ae('0x2d')][_0x06ae('0xe')](this));};EmailImap[_0x06ae('0x12')][_0x06ae('0x2e')]=function(_0x1e4531){};EmailImap[_0x06ae('0x12')][_0x06ae('0x2c')]=function(){};EmailImap[_0x06ae('0x12')][_0x06ae('0x2d')]=function(_0xa2e675,_0x4c9ef9){if(_0xa2e675){logger[_0x06ae('0x28')](_0xa2e675);}else{var _0x1fa92a=this;utils[_0x06ae('0x2f')](this[_0x06ae('0xa')],_0x4c9ef9,function(_0xd7eb8e){_0x1fa92a['emit'](_0x06ae('0x8'),_0xd7eb8e);});}};EmailImap['prototype'][_0x06ae('0x27')]=function(){this[_0x06ae('0x2')][_0x06ae('0x30')](!![],this[_0x06ae('0x21')][_0x06ae('0xe')](this));};EmailImap['prototype'][_0x06ae('0x26')]=function(_0x431dde){this[_0x06ae('0x1e')](_0x431dde);this[_0x06ae('0x2')][_0x06ae('0x30')](!![],this['handleCloseBox'][_0x06ae('0xe')](this));};EmailImap['prototype'][_0x06ae('0x10')]=function(){this[_0x06ae('0x31')](_0x06ae('0xf'));};EmailImap[_0x06ae('0x12')][_0x06ae('0x1e')]=function(_0x4e9c3e,_0x3d982a){logger[_0x06ae('0x28')]('handleError',this[_0x06ae('0xa')][_0x06ae('0x8')],JSON['stringify'](_0x4e9c3e));var _0x2b3ea6='';if(_0x4e9c3e){if(_0x4e9c3e['textCode']){_0x2b3ea6=_0x4e9c3e['textCode'];}else{for(var _0x59a272 in _0x4e9c3e){if(_0x4e9c3e[_0x06ae('0x32')](_0x59a272)){_0x2b3ea6+=_[_0x06ae('0x33')](_0x59a272)+':\x20'+_0x4e9c3e[_0x59a272]+'\x0a';}}}}if(_0x3d982a){this[_0x06ae('0x2')][_0x06ae('0xf')]();}else{this[_0x06ae('0x31')](_0x06ae('0x28'),_0x2b3ea6);this[_0x06ae('0x31')](_0x06ae('0xf'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xd0d5=['handleCloseBox','handleReadUnseen','length','fetch','message','error','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','handleEnd','stringify','textCode','exports','mailparser','simpleParser','iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','imap','end','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','getHost','service','openBox','handleOpenBox','handleError','emit','box','readUnseen'];(function(_0x5a4e5a,_0x5eea47){var _0x3685f5=function(_0x1a5c5d){while(--_0x1a5c5d){_0x5a4e5a['push'](_0x5a4e5a['shift']());}};_0x3685f5(++_0x5eea47);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x139ed9,_0x18cb87){_0x139ed9=_0x139ed9-0x0;var _0x46fd60=_0xd0d5[_0x139ed9];return _0x46fd60;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require('imap');var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x5d0d('0x0'))[_0x5d0d('0x1')];var Iconv=require(_0x5d0d('0x2'))['Iconv'];var EventEmitter=require('events')[_0x5d0d('0x3')];var utils=require(_0x5d0d('0x4'));var logger=require(_0x5d0d('0x5'))(_0x5d0d('0x6'));function EmailImap(_0x5ace89,_0x36598d){this[_0x5d0d('0x7')]=_0x5d0d('0x8');this[_0x5d0d('0x9')]=this[_0x5d0d('0xa')](_0x5ace89,_0x36598d);this['imap']=new Imap(this[_0x5d0d('0x9')]);this['imap'][_0x5d0d('0xb')](_0x5d0d('0xc'),this[_0x5d0d('0xd')][_0x5d0d('0xe')](this));this[_0x5d0d('0xf')][_0x5d0d('0xb')](_0x5d0d('0x10'),this['handleEnd'][_0x5d0d('0xe')](this));this[_0x5d0d('0xf')]['on']('error',this['handleError'][_0x5d0d('0xe')](this));this[_0x5d0d('0xf')][_0x5d0d('0x11')]();}util[_0x5d0d('0x12')](EmailImap,EventEmitter);EmailImap[_0x5d0d('0x13')][_0x5d0d('0xa')]=function(_0x352f7e,_0x36e7a2){var _0x409d77={'connTimeout':_0x352f7e[_0x5d0d('0x14')]?_0x352f7e[_0x5d0d('0x14')]*0x3e8:0x2710,'authTimeout':_0x352f7e[_0x5d0d('0x15')]?_0x352f7e[_0x5d0d('0x15')]*0x3e8:0x1388};if(_[_0x5d0d('0x16')](_0x352f7e['service'])){if(_0x352f7e[_0x5d0d('0x17')]){_0x409d77[_0x5d0d('0x18')]=_0x352f7e['user'];_0x409d77[_0x5d0d('0x19')]=_0x352f7e[_0x5d0d('0x19')];}_0x409d77[_0x5d0d('0x1a')]=_0x352f7e[_0x5d0d('0x1a')];_0x409d77[_0x5d0d('0x1b')]=_0x352f7e[_0x5d0d('0x1b')]||0x3e1;if(_0x352f7e[_0x5d0d('0x1c')]){_0x409d77[_0x5d0d('0x1c')]=!![];}else{_0x409d77[_0x5d0d('0x1c')]=![];_0x409d77['autotls']=_0x5d0d('0x1d');}}else{_0x409d77[_0x5d0d('0x18')]=_0x352f7e[_0x5d0d('0x18')];_0x409d77['password']=_0x352f7e[_0x5d0d('0x19')];_0x409d77[_0x5d0d('0x1a')]=utils[_0x5d0d('0x1e')](_0x352f7e[_0x5d0d('0x1f')]);_0x409d77['port']=0x3e1;_0x409d77['tls']=!![];}_0x409d77[_0x5d0d('0x6')]=_0x36e7a2||_0x352f7e[_0x5d0d('0x18')]||'anonymous@xcally.com';return _0x409d77;};EmailImap[_0x5d0d('0x13')][_0x5d0d('0xd')]=function(){this[_0x5d0d('0xf')][_0x5d0d('0x20')](this[_0x5d0d('0x7')],![],this[_0x5d0d('0x21')][_0x5d0d('0xe')](this));};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x21')]=function(_0x5008de,_0x3df4f0){if(_0x5008de){this[_0x5d0d('0x22')](_0x5008de,!![]);}else{this[_0x5d0d('0x23')](_0x5d0d('0x24'),_0x3df4f0);this[_0x5d0d('0x25')]();}};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x26')]=function(_0x1e94a2){if(_0x1e94a2){this[_0x5d0d('0x22')](_0x1e94a2,!![]);}else{this[_0x5d0d('0xf')][_0x5d0d('0x10')]();}};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x25')]=function(){this['imap']['search'](['UNSEEN'],this[_0x5d0d('0x27')][_0x5d0d('0xe')](this));};EmailImap[_0x5d0d('0x13')]['handleReadUnseen']=function(_0x132242,_0x39d2a2){if(_0x132242){this[_0x5d0d('0x22')](_0x132242,!![]);}else{if(_0x39d2a2[_0x5d0d('0x28')]){try{var _0x32c570=this[_0x5d0d('0xf')][_0x5d0d('0x29')](_0x39d2a2,{'bodies':'','markSeen':!![]});_0x32c570['on'](_0x5d0d('0x2a'),this['handleFetchMessage'][_0x5d0d('0xe')](this));_0x32c570[_0x5d0d('0xb')](_0x5d0d('0x2b'),this['handleFetchError'][_0x5d0d('0xe')](this));_0x32c570[_0x5d0d('0xb')](_0x5d0d('0x10'),this[_0x5d0d('0x2c')][_0x5d0d('0xe')](this));}catch(_0x5a15e6){logger[_0x5d0d('0x2b')](_0x5a15e6);}}else{this[_0x5d0d('0xf')][_0x5d0d('0x2d')](!![],this[_0x5d0d('0x26')][_0x5d0d('0xe')](this));}}};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x2e')]=function(_0x2564dd,_0xe81e76){_0x2564dd['on'](_0x5d0d('0x2f'),this[_0x5d0d('0x30')][_0x5d0d('0xe')](this));_0x2564dd[_0x5d0d('0xb')](_0x5d0d('0x31'),this[_0x5d0d('0x32')][_0x5d0d('0xe')](this));_0x2564dd['once'](_0x5d0d('0x10'),this[_0x5d0d('0x33')][_0x5d0d('0xe')](this));};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x30')]=function(_0x13fc1e,_0x185279){simpleParser(_0x13fc1e,{'Iconv':Iconv},this[_0x5d0d('0x34')][_0x5d0d('0xe')](this));};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x32')]=function(_0x28f1d7){};EmailImap[_0x5d0d('0x13')]['handleMessageEnd']=function(){};EmailImap[_0x5d0d('0x13')]['handleSimpleParser']=function(_0x266f85,_0x4e794e){if(_0x266f85){logger['error'](_0x266f85);}else{var _0x1274c2=this;utils[_0x5d0d('0x35')](this['account'],_0x4e794e,function(_0x1decfe){_0x1274c2[_0x5d0d('0x23')](_0x5d0d('0x6'),_0x1decfe);});}};EmailImap['prototype'][_0x5d0d('0x2c')]=function(){this[_0x5d0d('0xf')]['closeBox'](!![],this['handleCloseBox'][_0x5d0d('0xe')](this));};EmailImap['prototype'][_0x5d0d('0x36')]=function(_0x5a2c5f){this[_0x5d0d('0x22')](_0x5a2c5f);this[_0x5d0d('0xf')][_0x5d0d('0x2d')](!![],this[_0x5d0d('0x26')][_0x5d0d('0xe')](this));};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x37')]=function(){this[_0x5d0d('0x23')]('end');};EmailImap[_0x5d0d('0x13')][_0x5d0d('0x22')]=function(_0xed3cd0,_0x24f363){logger[_0x5d0d('0x2b')](_0x5d0d('0x22'),this[_0x5d0d('0x9')][_0x5d0d('0x6')],JSON[_0x5d0d('0x38')](_0xed3cd0));var _0xbee16='';if(_0xed3cd0){if(_0xed3cd0['textCode']){_0xbee16=_0xed3cd0[_0x5d0d('0x39')];}else{for(var _0x50f006 in _0xed3cd0){if(_0xed3cd0['hasOwnProperty'](_0x50f006)){_0xbee16+=_['upperFirst'](_0x50f006)+':\x20'+_0xed3cd0[_0x50f006]+'\x0a';}}}}if(_0x24f363){this[_0x5d0d('0xf')][_0x5d0d('0x10')]();}else{this[_0x5d0d('0x23')]('error',_0xbee16);this[_0x5d0d('0x23')](_0x5d0d('0x10'));}};module[_0x5d0d('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 22a8676..88999a4 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 _0x3e59=['prototype','verify','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x3e59,0xdd));var _0x93e5=function(_0x21e034,_0x59fc14){_0x21e034=_0x21e034-0x0;var _0x1faab3=_0x3e59[_0x21e034];return _0x1faab3;};'use strict';var nodemailer=require(_0x93e5('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x93e5('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x93e5('0x2')]=function(_0x43f148,_0x44ccf0){return new BPromise(function(_0x47becd,_0x2c2788){var _0x14b5b5=nodemailer[_0x93e5('0x3')](_0x43f148);_0x14b5b5[_0x93e5('0x4')](_0x93e5('0x5'),inlineBase64());_0x14b5b5[_0x93e5('0x6')](_0x44ccf0,function(_0x51ade2,_0x520bb7){if(_0x51ade2){_0x2c2788(_0x51ade2['toString']());}else{_0x47becd(_0x520bb7);}});});};EmailSmtp[_0x93e5('0x7')][_0x93e5('0x8')]=function(_0x59d1ed){return new BPromise(function(_0x5abc6f,_0x333342){var _0x37b848=nodemailer[_0x93e5('0x3')](_0x59d1ed);_0x37b848[_0x93e5('0x8')](function(_0x48d7c6,_0x33c2ea){if(_0x48d7c6){_0x333342(_0x48d7c6[_0x93e5('0x9')]());}else{if(_0x33c2ea){_0x5abc6f(_0x33c2ea);}else{_0x333342(_0x93e5('0xa'));}}});});};module[_0x93e5('0xb')]=EmailSmtp; \ No newline at end of file +var _0xbcdf=['bluebird','prototype','send','use','compile','toString','verify','exports','nodemailer'];(function(_0x16cb34,_0x36ddf1){var _0x565707=function(_0x326d43){while(--_0x326d43){_0x16cb34['push'](_0x16cb34['shift']());}};_0x565707(++_0x36ddf1);}(_0xbcdf,0x1af));var _0xfbcd=function(_0x112112,_0x5dd2e8){_0x112112=_0x112112-0x0;var _0x3fb2a0=_0xbcdf[_0x112112];return _0x3fb2a0;};'use strict';var nodemailer=require(_0xfbcd('0x0'));var BPromise=require(_0xfbcd('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xfbcd('0x2')][_0xfbcd('0x3')]=function(_0x1b9fc3,_0x1b6c0b){return new BPromise(function(_0x81e9cc,_0xd4d256){var _0x4e1e64=nodemailer['createTransport'](_0x1b9fc3);_0x4e1e64[_0xfbcd('0x4')](_0xfbcd('0x5'),inlineBase64());_0x4e1e64['sendMail'](_0x1b6c0b,function(_0x9877c2,_0x4bf83e){if(_0x9877c2){_0xd4d256(_0x9877c2[_0xfbcd('0x6')]());}else{_0x81e9cc(_0x4bf83e);}});});};EmailSmtp['prototype'][_0xfbcd('0x7')]=function(_0x170de4){return new BPromise(function(_0x2e26f4,_0x310b1b){var _0x58e19f=nodemailer['createTransport'](_0x170de4);_0x58e19f[_0xfbcd('0x7')](function(_0x398b3a,_0x2e5cfb){if(_0x398b3a){_0x310b1b(_0x398b3a[_0xfbcd('0x6')]());}else{if(_0x2e5cfb){_0x2e26f4(_0x2e5cfb);}else{_0x310b1b('Not\x20verifired');}}});});};module[_0xfbcd('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 989ae84..aa247df 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 _0x160f=['

Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','generate','head','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','@xcally.com','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attachments','type','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','subject','messageId','inReplyTo','date','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','BodyHTML','Attachments','Title','Data'];(function(_0x12398a,_0x3d5985){var _0x541809=function(_0x31e86a){while(--_0x31e86a){_0x12398a['push'](_0x12398a['shift']());}};_0x541809(++_0x3d5985);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var moment=require(_0xf160('0x1'));var random=require(_0xf160('0x2'));var fs=require('fs');var path=require(_0xf160('0x3'));var util=require('util');var tnef=require(_0xf160('0x4'));var logger=require(_0xf160('0x5'))(_0xf160('0x6'));var config=require(_0xf160('0x7'));function getAddress(_0x194331){var _0xfdbd72=_['head'](_0x194331[_0xf160('0x8')]);return _0xfdbd72&&_0xfdbd72[_0xf160('0x9')]?_0xfdbd72['address']:'anonymous'+random[_0xf160('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x4bf890){var _0x496014=_[_0xf160('0xb')](_0x4bf890[_0xf160('0x8')]);if(_0x496014&&_0x496014[_0xf160('0xc')]){if(_0x496014[_0xf160('0xc')]==_0x496014['address']){return _0x496014['name'][_0xf160('0xd')](0x0,_0x496014[_0xf160('0xc')][_0xf160('0xe')]('@'));}var _0x56072f=_0x496014[_0xf160('0xc')][_0xf160('0xf')](/\s+/);return _0x56072f[_0xf160('0x10')]>0x1?_0x56072f[_0xf160('0x11')](0x0,-0x1)[_0xf160('0x12')]('\x20'):_0x496014['name'];}return _0xf160('0x13');}function getLastName(_0x4f7cfe){var _0x1496b6=_[_0xf160('0xb')](_0x4f7cfe[_0xf160('0x8')]);if(_0x1496b6&&_0x1496b6[_0xf160('0xc')]){var _0x3a4faa=_0x1496b6[_0xf160('0xc')][_0xf160('0xf')](/\s+/);return _0x3a4faa[_0xf160('0x10')]>0x1?_0x3a4faa[_0xf160('0x14')]():'';}return'';}function getMails(_0x59ac02,_0x477e4d){var _0x400bda='';for(var _0x8699a0=0x0;_0x8699a0<_0x477e4d[_0xf160('0x8')]['length'];_0x8699a0+=0x1){if(_0x477e4d[_0xf160('0x8')][_0x8699a0]['address']!==_0x59ac02){if(!_[_0xf160('0x15')](_0x400bda)){_0x400bda+=',';}_0x400bda+=_0x477e4d[_0xf160('0x8')][_0x8699a0][_0xf160('0xc')]||_0x477e4d[_0xf160('0x8')][_0x8699a0][_0xf160('0x9')]||'';_0x400bda+='\x20<';_0x400bda+=_0x477e4d[_0xf160('0x8')][_0x8699a0][_0xf160('0x9')]?_0x477e4d[_0xf160('0x8')][_0x8699a0][_0xf160('0x9')]:'anonymous'+random[_0xf160('0xa')](0x6)+_0xf160('0x16');_0x400bda+='>';}}return _0x400bda;}function parseEmail(_0x103767,_0x5ad173,_0x435572){if(_0x5ad173[_0xf160('0x17')]){var _0x454e63=/)<[^<]*)*<\/script>/gi;while(_0x454e63[_0xf160('0x18')](_0x5ad173[_0xf160('0x17')])){_0x5ad173[_0xf160('0x17')]=_0x5ad173[_0xf160('0x17')]['replace'](_0x454e63,'');}if(_0x5ad173[_0xf160('0x17')][_0xf160('0x19')](_0xf160('0x1a'))){var _0x49bb5c=[];_0x5ad173['attachments'][_0xf160('0x1b')](_0x46d45a=>{_0x49bb5c['push'](_0x46d45a['filename']);});var _0x168a09=/]+>/g;var _0x1cc04c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x39c0e3=_0x5ad173['html'][_0xf160('0x1c')](_0x1cc04c,_0xf160('0x1d'));var _0x2851e8=_0x39c0e3[_0xf160('0x1c')](_0x168a09,_0xf160('0x1e'));for(let _0x193e1e=0x0;_0x193e1e<_0x49bb5c['length'];_0x193e1e++){var _0x4d7165=_0x2851e8['replace'](_0xf160('0x1e'),_0xf160('0x1f')+_0x49bb5c[_0x193e1e]+_0xf160('0x20'));_0x2851e8=_0x4d7165;}_0x5ad173[_0xf160('0x17')]=_0x2851e8;}_0x435572[_0xf160('0x21')]=_0x5ad173['html'];}else{_0x435572['body']=_0x5ad173[_0xf160('0x22')];}if(_0x435572['body']){_0x435572['body']=_0x435572[_0xf160('0x21')][_0xf160('0x1c')](/0x0){var _0x1bdc44=['Auto-Submitted:\x20auto-replied',_0xf160('0x36'),_0xf160('0x37')];for(var _0x2cfec0=0x0;_0x2cfec0<_0x5ad173[_0xf160('0x35')][_0xf160('0x10')];_0x2cfec0++){var _0xed8784=_[_0xf160('0xe')](_0x1bdc44,_0x5ad173['headerLines'][_0x2cfec0][_0xf160('0x38')]);if(_0xed8784>=0x0){_0x435572['isAutoreply']=!![];}}}return _0x435572;}exports[_0xf160('0x39')]=function(_0x477ded,_0x530fc5,_0x23f441){var _0x2d3348={'from':getAddress(_0x530fc5[_0xf160('0x3a')]),'firstName':getFirstName(_0x530fc5[_0xf160('0x3a')]),'lastName':getLastName(_0x530fc5[_0xf160('0x3a')]),'mapKey':_0xf160('0x6'),'message':{'from':getMails(_0x477ded[_0xf160('0x6')],_0x530fc5['from']),'to':_0x477ded[_0xf160('0x6')],'cc':'','subject':_0x530fc5[_0xf160('0x3b')]||'','messageId':_0x530fc5[_0xf160('0x3c')],'inReplyTo':_0x530fc5[_0xf160('0x3d')],'sentAt':moment(_0x530fc5[_0xf160('0x3e')])[_0xf160('0x2c')](_0xf160('0x3f')),'attach':![],'attachments':[]}};if(!_0x530fc5[_0xf160('0x17')]&&!_0x530fc5[_0xf160('0x22')]){var _0x1cb75e=_[_0xf160('0x40')](_0x530fc5['attachments'],{'contentType':'application/ms-tnef'});if(_0x1cb75e[_0xf160('0x10')]){logger[_0xf160('0x41')](util[_0xf160('0x2c')](_0xf160('0x42'),_0x530fc5[_0xf160('0x3c')]));tnef[_0xf160('0x43')](_['first'](_0x1cb75e)[_0xf160('0x32')],function(_0x5abc6a,_0x55ab52){if(_0x55ab52){_0x530fc5[_0xf160('0x17')]=_0x55ab52[_0xf160('0x44')]||'

Empty\x20message

';if(_0x55ab52['Attachments']){for(var _0x2f1648=0x0;_0x2f1648<_0x55ab52[_0xf160('0x45')][_0xf160('0x10')];_0x2f1648++){var _0x1cc336=_0x55ab52['Attachments'][_0x2f1648];_0x2d3348['message']['attachments']['push']({'filename':_0x1cc336[_0xf160('0x46')],'content':Buffer['from'](_0x1cc336[_0xf160('0x47')])});}}}_0x23f441(parseEmail(_0x477ded,_0x530fc5,_0x2d3348));});}else{_0x530fc5[_0xf160('0x17')]=_0xf160('0x48');_0x23f441(parseEmail(_0x477ded,_0x530fc5,_0x2d3348));}}else{_0x23f441(parseEmail(_0x477ded,_0x530fc5,_0x2d3348));}};exports[_0xf160('0x49')]=function(_0x4f2e23){switch(_0x4f2e23){case _0xf160('0x4a'):return _0xf160('0x4b');case _0xf160('0x4c'):return'imap.mail.yahoo.com';case _0xf160('0x4d'):return _0xf160('0x4e');case _0xf160('0x4f'):return'outlook.office365.com';}return _0xf160('0x50');}; \ No newline at end of file +var _0xad40=['imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','split','length','slice','join','Anonymous','pop','html','test','replace','includes','','body','Empty\x20message

','Attachments','Title','Data'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xad40,0xfa));var _0x0ad4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xad40[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0ad4('0x0'));var moment=require(_0x0ad4('0x1'));var random=require(_0x0ad4('0x2'));var fs=require('fs');var path=require(_0x0ad4('0x3'));var util=require('util');var tnef=require(_0x0ad4('0x4'));var logger=require(_0x0ad4('0x5'))(_0x0ad4('0x6'));var config=require(_0x0ad4('0x7'));function getAddress(_0x85c3b9){var _0x34f7cb=_[_0x0ad4('0x8')](_0x85c3b9['value']);return _0x34f7cb&&_0x34f7cb[_0x0ad4('0x9')]?_0x34f7cb[_0x0ad4('0x9')]:_0x0ad4('0xa')+random[_0x0ad4('0xb')](0x6)+_0x0ad4('0xc');}function getFirstName(_0x29f1ee){var _0x239e92=_['head'](_0x29f1ee[_0x0ad4('0xd')]);if(_0x239e92&&_0x239e92[_0x0ad4('0xe')]){if(_0x239e92[_0x0ad4('0xe')]==_0x239e92[_0x0ad4('0x9')]){return _0x239e92[_0x0ad4('0xe')][_0x0ad4('0xf')](0x0,_0x239e92[_0x0ad4('0xe')]['indexOf']('@'));}var _0x1b9921=_0x239e92[_0x0ad4('0xe')][_0x0ad4('0x10')](/\s+/);return _0x1b9921[_0x0ad4('0x11')]>0x1?_0x1b9921[_0x0ad4('0x12')](0x0,-0x1)[_0x0ad4('0x13')]('\x20'):_0x239e92[_0x0ad4('0xe')];}return _0x0ad4('0x14');}function getLastName(_0xd8cad3){var _0x3808c2=_['head'](_0xd8cad3[_0x0ad4('0xd')]);if(_0x3808c2&&_0x3808c2['name']){var _0x2286e6=_0x3808c2['name'][_0x0ad4('0x10')](/\s+/);return _0x2286e6['length']>0x1?_0x2286e6[_0x0ad4('0x15')]():'';}return'';}function getMails(_0x58397f,_0x26190d){var _0x5a611f='';for(var _0x244474=0x0;_0x244474<_0x26190d[_0x0ad4('0xd')]['length'];_0x244474+=0x1){if(_0x26190d[_0x0ad4('0xd')][_0x244474][_0x0ad4('0x9')]!==_0x58397f){if(!_['isEmpty'](_0x5a611f)){_0x5a611f+=',';}_0x5a611f+=_0x26190d[_0x0ad4('0xd')][_0x244474][_0x0ad4('0xe')]||_0x26190d[_0x0ad4('0xd')][_0x244474][_0x0ad4('0x9')]||'';_0x5a611f+='\x20<';_0x5a611f+=_0x26190d[_0x0ad4('0xd')][_0x244474]['address']?_0x26190d['value'][_0x244474][_0x0ad4('0x9')]:'anonymous'+random['generate'](0x6)+_0x0ad4('0xc');_0x5a611f+='>';}}return _0x5a611f;}function parseEmail(_0x5e3c56,_0x411acc,_0x1bb68b){if(_0x411acc[_0x0ad4('0x16')]){var _0x147361=/)<[^<]*)*<\/script>/gi;while(_0x147361[_0x0ad4('0x17')](_0x411acc[_0x0ad4('0x16')])){_0x411acc[_0x0ad4('0x16')]=_0x411acc[_0x0ad4('0x16')][_0x0ad4('0x18')](_0x147361,'');}if(_0x411acc[_0x0ad4('0x16')][_0x0ad4('0x19')](_0x0ad4('0x1a'))){var _0x428bb9=[];_0x411acc[_0x0ad4('0x1b')]['forEach'](_0x1f7515=>{_0x428bb9['push'](_0x1f7515['filename']);});var _0xa3a218=/]+>/g;var _0x595431=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x567c73=_0x411acc[_0x0ad4('0x16')][_0x0ad4('0x18')](_0x595431,_0x0ad4('0x1c'));var _0x193a8a=_0x567c73['replace'](_0xa3a218,_0x0ad4('0x1d'));for(let _0x34847b=0x0;_0x34847b<_0x428bb9[_0x0ad4('0x11')];_0x34847b++){var _0xcbf86e=_0x193a8a[_0x0ad4('0x18')](_0x0ad4('0x1d'),'\x20[Attachment:\x20'+_0x428bb9[_0x34847b]+_0x0ad4('0x1e'));_0x193a8a=_0xcbf86e;}_0x411acc[_0x0ad4('0x16')]=_0x193a8a;}_0x1bb68b['body']=_0x411acc['html'];}else{_0x1bb68b[_0x0ad4('0x1f')]=_0x411acc['textAsHtml'];}if(_0x1bb68b['body']){_0x1bb68b[_0x0ad4('0x1f')]=_0x1bb68b['body'][_0x0ad4('0x18')](/0x0){var _0x35df9b=[_0x0ad4('0x33'),_0x0ad4('0x34'),_0x0ad4('0x35')];for(var _0x18bf38=0x0;_0x18bf38<_0x411acc[_0x0ad4('0x32')][_0x0ad4('0x11')];_0x18bf38++){var _0x441a7b=_[_0x0ad4('0x36')](_0x35df9b,_0x411acc[_0x0ad4('0x32')][_0x18bf38][_0x0ad4('0x37')]);if(_0x441a7b>=0x0){_0x1bb68b['isAutoreply']=!![];}}}return _0x1bb68b;}exports['parser']=function(_0x3e755f,_0xc69b7f,_0x2224de){var _0x4b8634={'from':getAddress(_0xc69b7f[_0x0ad4('0x38')]),'firstName':getFirstName(_0xc69b7f[_0x0ad4('0x38')]),'lastName':getLastName(_0xc69b7f['from']),'mapKey':_0x0ad4('0x6'),'message':{'from':getMails(_0x3e755f[_0x0ad4('0x6')],_0xc69b7f['from']),'to':_0x3e755f[_0x0ad4('0x6')],'cc':'','subject':_0xc69b7f[_0x0ad4('0x39')]||'','messageId':_0xc69b7f[_0x0ad4('0x3a')],'inReplyTo':_0xc69b7f[_0x0ad4('0x3b')],'sentAt':moment(_0xc69b7f[_0x0ad4('0x3c')])['format'](_0x0ad4('0x3d')),'attach':![],'attachments':[]}};if(!_0xc69b7f[_0x0ad4('0x16')]&&!_0xc69b7f[_0x0ad4('0x3e')]){var _0x1699fb=_[_0x0ad4('0x3f')](_0xc69b7f[_0x0ad4('0x1b')],{'contentType':_0x0ad4('0x40')});if(_0x1699fb[_0x0ad4('0x11')]){logger[_0x0ad4('0x41')](util['format'](_0x0ad4('0x42'),_0xc69b7f[_0x0ad4('0x3a')]));tnef[_0x0ad4('0x43')](_[_0x0ad4('0x44')](_0x1699fb)[_0x0ad4('0x2f')],function(_0x2c0bec,_0x5f1eb9){if(_0x5f1eb9){_0xc69b7f[_0x0ad4('0x16')]=_0x5f1eb9[_0x0ad4('0x45')]||_0x0ad4('0x46');if(_0x5f1eb9[_0x0ad4('0x47')]){for(var _0x2cc8f8=0x0;_0x2cc8f8<_0x5f1eb9[_0x0ad4('0x47')][_0x0ad4('0x11')];_0x2cc8f8++){var _0x1af2d9=_0x5f1eb9[_0x0ad4('0x47')][_0x2cc8f8];_0x4b8634[_0x0ad4('0x21')][_0x0ad4('0x1b')]['push']({'filename':_0x1af2d9[_0x0ad4('0x48')],'content':Buffer[_0x0ad4('0x38')](_0x1af2d9[_0x0ad4('0x49')])});}}}_0x2224de(parseEmail(_0x3e755f,_0xc69b7f,_0x4b8634));});}else{_0xc69b7f[_0x0ad4('0x16')]='

Empty\x20message

';_0x2224de(parseEmail(_0x3e755f,_0xc69b7f,_0x4b8634));}}else{_0x2224de(parseEmail(_0x3e755f,_0xc69b7f,_0x4b8634));}};exports['getHost']=function(_0x245b56){switch(_0x245b56){case'gmail':return _0x0ad4('0x4a');case _0x0ad4('0x4b'):return _0x0ad4('0x4c');case'hotmail':return _0x0ad4('0x4d');case _0x0ad4('0x4e'):return _0x0ad4('0x4f');}return _0x0ad4('0x50');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a60cd9a..39730b5 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 _0x8452=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8452,0xa2));var _0x2845=function(_0x5534b7,_0xbe6ba4){_0x5534b7=_0x5534b7-0x0;var _0x34af05=_0x8452[_0x5534b7];return _0x34af05;};'use strict';var _=require(_0x2845('0x0'));function MailAccount(_0x178dfa){this['id']=_0x178dfa['id']||0x0;this['name']=_0x178dfa[_0x2845('0x1')]||_0x2845('0x2');this[_0x2845('0x3')]=_0x178dfa[_0x2845('0x3')]||_0x2845('0x4');this[_0x2845('0x5')]=_0x178dfa['active']||![];this[_0x2845('0x6')]=_0x178dfa[_0x2845('0x6')]||[];this[_0x2845('0x7')]=_0x178dfa[_0x2845('0x7')]||[];}module[_0x2845('0x8')]=MailAccount; \ No newline at end of file +var _0x8325=['active','Imap','Smtp','exports','lodash','name','key','SERV'];(function(_0x1bd163,_0x573f20){var _0x17b20f=function(_0x3e1bf1){while(--_0x3e1bf1){_0x1bd163['push'](_0x1bd163['shift']());}};_0x17b20f(++_0x573f20);}(_0x8325,0x1dc));var _0x5832=function(_0x3e291,_0x4e1425){_0x3e291=_0x3e291-0x0;var _0x48efd7=_0x8325[_0x3e291];return _0x48efd7;};'use strict';var _=require(_0x5832('0x0'));function MailAccount(_0x412770){this['id']=_0x412770['id']||0x0;this[_0x5832('0x1')]=_0x412770[_0x5832('0x1')]||'Service';this[_0x5832('0x2')]=_0x412770['key']||_0x5832('0x3');this[_0x5832('0x4')]=_0x412770[_0x5832('0x4')]||![];this[_0x5832('0x5')]=_0x412770[_0x5832('0x5')]||[];this[_0x5832('0x6')]=_0x412770['Smtp']||[];}module[_0x5832('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3e902d4..824aa36 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 _0x9149=['../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length','isUndefined','merge','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9149,0x1d5));var _0x9914=function(_0x39154d,_0x4b1715){_0x39154d=_0x39154d-0x0;var _0x272ce3=_0x9149[_0x39154d];return _0x272ce3;};'use strict';var _=require(_0x9914('0x0'));var MailAccount=require(_0x9914('0x1'));var Realtime=function(){this[_0x9914('0x2')]={};};function freeIsNotKey(_0xbb66dc,_0x59fa58,_0x908994){var _0x5db00d=_[_0x9914('0x3')](_0xbb66dc,function(_0x862bea,_0x52a65e){return _0x862bea[_0x908994];});for(var _0x476682 in _0x59fa58){if(_0x59fa58['hasOwnProperty'](_0x476682)){if(!_0x5db00d[_0x476682]){delete _0x59fa58[_0x476682];}}}}Realtime[_0x9914('0x4')][_0x9914('0x5')]=function(_0x339297,_0x1fcace){for(var _0x963c9a in _0x1fcace){if(_0x339297[_0x9914('0x6')](_0x963c9a)){_0x339297[_0x963c9a]=_0x1fcace[_0x963c9a];}}};Realtime[_0x9914('0x4')]['initMailAccounts']=function(){var _0x11b062=this;return function(_0x88918a){if(_0x88918a){freeIsNotKey(_0x88918a,_0x11b062[_0x9914('0x2')],'id');for(var _0x330ba8=0x0,_0x334d8b={},_0x559330={};_0x330ba8<_0x88918a[_0x9914('0x7')];_0x330ba8+=0x1){_0x334d8b=_0x88918a[_0x330ba8];if(_[_0x9914('0x8')](_0x11b062[_0x9914('0x2')][_0x334d8b['id']])){_0x11b062['mailAccounts'][_0x334d8b['id']]=new MailAccount(_0x334d8b);}else{_[_0x9914('0x9')](_0x11b062['mailAccounts'][_0x334d8b['id']],_0x334d8b);}}}return _0x11b062[_0x9914('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x75fc=['length','isUndefined','merge','exports','lodash','mailAccounts','hasOwnProperty','mergeFromDatabase','initMailAccounts'];(function(_0x49bb91,_0x86ecf3){var _0x2b4339=function(_0x4fb062){while(--_0x4fb062){_0x49bb91['push'](_0x49bb91['shift']());}};_0x2b4339(++_0x86ecf3);}(_0x75fc,0x199));var _0xc75f=function(_0x3ba68b,_0x13c2d7){_0x3ba68b=_0x3ba68b-0x0;var _0x1d7114=_0x75fc[_0x3ba68b];return _0x1d7114;};'use strict';var _=require(_0xc75f('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xc75f('0x1')]={};};function freeIsNotKey(_0x4d73f7,_0x54f5d5,_0x1fa930){var _0x1c938b=_['mapKeys'](_0x4d73f7,function(_0x3cd51d,_0xd310b9){return _0x3cd51d[_0x1fa930];});for(var _0x108111 in _0x54f5d5){if(_0x54f5d5[_0xc75f('0x2')](_0x108111)){if(!_0x1c938b[_0x108111]){delete _0x54f5d5[_0x108111];}}}}Realtime['prototype'][_0xc75f('0x3')]=function(_0xc17493,_0x84109d){for(var _0xaae6d0 in _0x84109d){if(_0xc17493[_0xc75f('0x2')](_0xaae6d0)){_0xc17493[_0xaae6d0]=_0x84109d[_0xaae6d0];}}};Realtime['prototype'][_0xc75f('0x4')]=function(){var _0x59d983=this;return function(_0x581813){if(_0x581813){freeIsNotKey(_0x581813,_0x59d983['mailAccounts'],'id');for(var _0xa2754d=0x0,_0x20e3b6={},_0x873f3b={};_0xa2754d<_0x581813[_0xc75f('0x5')];_0xa2754d+=0x1){_0x20e3b6=_0x581813[_0xa2754d];if(_[_0xc75f('0x6')](_0x59d983['mailAccounts'][_0x20e3b6['id']])){_0x59d983[_0xc75f('0x1')][_0x20e3b6['id']]=new MailAccount(_0x20e3b6);}else{_[_0xc75f('0x7')](_0x59d983[_0xc75f('0x1')][_0x20e3b6['id']],_0x20e3b6);}}}return _0x59d983[_0xc75f('0x1')];};};module[_0xc75f('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 17b7214..ef419ef 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 _0xc58f=['name','service','email','active','key','ListId','TemplateId','MailServerIn','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xc58f,0xad));var _0xfc58=function(_0x458dd2,_0xb2c6e6){_0x458dd2=_0x458dd2-0x0;var _0x470f65=_0xc58f[_0x458dd2];return _0x470f65;};'use strict';var client=require(_0xfc58('0x0'));exports[_0xfc58('0x1')]=function(){return function(){return client[_0xfc58('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xfc58('0x3'),_0xfc58('0x4'),_0xfc58('0x5'),_0xfc58('0x6'),_0xfc58('0x7'),_0xfc58('0x8'),_0xfc58('0x9')],'raw':![],'include':[{'model':_0xfc58('0xa'),'as':'Imap'},{'model':_0xfc58('0xb'),'as':_0xfc58('0xc')}]},'log':_0xfc58('0xd')});};};exports[_0xfc58('0xe')]=function(_0x940206,_0x36c134){return client[_0xfc58('0x2')](_0xfc58('0xf'),{'account':{'id':_0x940206},'body':_0x36c134,'log':_0xfc58('0xf')});}; \ No newline at end of file +var _0xf7a8=['key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','service','email','active'];(function(_0x57b5ce,_0x3a8cfa){var _0x5c3af4=function(_0x2e2dd2){while(--_0x2e2dd2){_0x57b5ce['push'](_0x57b5ce['shift']());}};_0x5c3af4(++_0x3a8cfa);}(_0xf7a8,0xfa));var _0x8f7a=function(_0x2819fa,_0x512a6c){_0x2819fa=_0x2819fa-0x0;var _0x206382=_0xf7a8[_0x2819fa];return _0x206382;};'use strict';var client=require(_0x8f7a('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x8f7a('0x1')](_0x8f7a('0x2'),{'options':{'attributes':['id','name',_0x8f7a('0x3'),_0x8f7a('0x4'),_0x8f7a('0x5'),_0x8f7a('0x6'),_0x8f7a('0x7'),_0x8f7a('0x8')],'raw':![],'include':[{'model':_0x8f7a('0x9'),'as':_0x8f7a('0xa')},{'model':_0x8f7a('0xb'),'as':_0x8f7a('0xc')}]},'log':_0x8f7a('0xd')});};};exports[_0x8f7a('0xe')]=function(_0x9f3931,_0x4f0dd6){return client['Request'](_0x8f7a('0xf'),{'account':{'id':_0x9f3931},'body':_0x4f0dd6,'log':_0x8f7a('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 33b828c..406e236 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 _0x94aa=['getSettings','ShowSetting','GetSettings','../client'];(function(_0x37a921,_0x2983b9){var _0x219de7=function(_0x51e12f){while(--_0x51e12f){_0x37a921['push'](_0x37a921['shift']());}};_0x219de7(++_0x2983b9);}(_0x94aa,0xef));var _0xa94a=function(_0x2ecfee,_0x321de8){_0x2ecfee=_0x2ecfee-0x0;var _0x3a0b56=_0x94aa[_0x2ecfee];return _0x3a0b56;};'use strict';var client=require(_0xa94a('0x0'));exports[_0xa94a('0x1')]=function(){return client['Request'](_0xa94a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xa94a('0x3')});}; \ No newline at end of file +var _0x2b49=['loginMailFrequency','getSettings','Request','ShowSetting'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x2b49,0xed));var _0x92b4=function(_0x3a3d1a,_0x3cbbb5){_0x3a3d1a=_0x3a3d1a-0x0;var _0x5009fe=_0x2b49[_0x3a3d1a];return _0x5009fe;};'use strict';var client=require('../client');exports[_0x92b4('0x0')]=function(){return client[_0x92b4('0x1')](_0x92b4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x92b4('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 04aac44..8ef85a8 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(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 ca08795..a248e0c 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 _0xc644=['redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','defaults','adapter','socket.io-redis'];(function(_0x1f744b,_0x53213b){var _0x15ef46=function(_0x192264){while(--_0x192264){_0x1f744b['push'](_0x1f744b['shift']());}};_0x15ef46(++_0x53213b);}(_0xc644,0x7b));var _0x4c64=function(_0x482f76,_0x588ec9){_0x482f76=_0x482f76-0x0;var _0x229e38=_0xc644[_0x482f76];return _0x229e38;};'use strict';var _=require(_0x4c64('0x0'));var http=require(_0x4c64('0x1'));var express=require(_0x4c64('0x2'));var sticky=require(_0x4c64('0x3'));var Redis=require(_0x4c64('0x4'));var config=require(_0x4c64('0x5'));var app=express();var server=http[_0x4c64('0x6')](app);server[_0x4c64('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0x4c64('0x8')])){var socketio=require(_0x4c64('0x9'))(server,{'transports':[_0x4c64('0xa'),_0x4c64('0xb')]});config['redis']=_[_0x4c64('0xc')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x4c64('0xd')](require(_0x4c64('0xe'))({'pubClient':new Redis(config[_0x4c64('0xf')]),'subClient':new Redis(config[_0x4c64('0xf')])}));require(_0x4c64('0x10'))['default']();require(_0x4c64('0x11'))[_0x4c64('0x12')](socketio);require(_0x4c64('0x13'))[_0x4c64('0x12')](app);require(_0x4c64('0x14'))[_0x4c64('0x12')](app);}else{server['once'](_0x4c64('0x15'),function(){console['log'](_0x4c64('0x16'),config[_0x4c64('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x57b6=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash'];(function(_0x10a28e,_0x182d8a){var _0x5a627a=function(_0x3c9150){while(--_0x3c9150){_0x10a28e['push'](_0x10a28e['shift']());}};_0x5a627a(++_0x182d8a);}(_0x57b6,0x107));var _0x657b=function(_0xbb0463,_0x5b9cbf){_0xbb0463=_0xbb0463-0x0;var _0x51091d=_0x57b6[_0xbb0463];return _0x51091d;};'use strict';var _=require(_0x657b('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x657b('0x1'));var Redis=require(_0x657b('0x2'));var config=require(_0x657b('0x3'));var app=express();var server=http[_0x657b('0x4')](app);server[_0x657b('0x5')]=0xdbba0;if(sticky[_0x657b('0x6')](server,config[_0x657b('0x7')])){var socketio=require(_0x657b('0x8'))(server,{'transports':[_0x657b('0x9'),'polling']});config['redis']=_[_0x657b('0xa')](config[_0x657b('0xb')],{'host':_0x657b('0xc'),'port':0x18eb});socketio[_0x657b('0xd')](require(_0x657b('0xe'))({'pubClient':new Redis(config[_0x657b('0xb')]),'subClient':new Redis(config['redis'])}));require(_0x657b('0xf'))['default']();require(_0x657b('0x10'))[_0x657b('0x11')](socketio);require('../../config/express')[_0x657b('0x11')](app);require(_0x657b('0x12'))[_0x657b('0x11')](app);}else{server[_0x657b('0x13')](_0x657b('0x14'),function(){console[_0x657b('0x15')](_0x657b('0x16'),config[_0x657b('0x7')]);});}exports=module[_0x657b('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 0e9a150..d46e402 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 _0x2ee5=['result','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','then','debug','error','rpc','message'];(function(_0x328f97,_0x1d5876){var _0x4b27bc=function(_0x38e592){while(--_0x38e592){_0x328f97['push'](_0x328f97['shift']());}};_0x4b27bc(++_0x1d5876);}(_0x2ee5,0x13a));var _0x52ee=function(_0x4d2ecd,_0x25ab5f){_0x4d2ecd=_0x4d2ecd-0x0;var _0x563463=_0x2ee5[_0x4d2ecd];return _0x563463;};'use strict';var jayson=require(_0x52ee('0x0'));var BPromise=require(_0x52ee('0x1'));var logger=require(_0x52ee('0x2'))(_0x52ee('0x3'));var client=jayson['client'][_0x52ee('0x4')]({'port':0x2329});client[_0x52ee('0x5')]=function(_0x347340,_0x4a94b2){return new BPromise(function(_0x55a7f6,_0x4c20a){return client['request'](_0x347340,_0x4a94b2)[_0x52ee('0x6')](function(_0x343b88){logger[_0x52ee('0x7')]('rpc','routing',_0x347340,_0x4a94b2,_0x343b88);if(_0x343b88['error']){logger[_0x52ee('0x8')](_0x52ee('0x9'),_0x52ee('0x3'),_0x347340,_0x343b88[_0x52ee('0x8')]['message'],_0x4a94b2);return _0x4c20a(_0x343b88[_0x52ee('0x8')][_0x52ee('0xa')]);}else{return _0x55a7f6(_0x343b88[_0x52ee('0xb')]);}})['catch'](function(_0x303abe){logger[_0x52ee('0x8')](_0x52ee('0x9'),_0x52ee('0x3'),_0x347340,_0x303abe,_0x4a94b2);return _0x4c20a(_0x303abe);});});};module[_0x52ee('0xc')]=client; \ No newline at end of file +var _0x0620=['client','http','Request','request','then','rpc','routing','error','message','result','jayson/promise','bluebird'];(function(_0x56af8c,_0x584039){var _0x10793a=function(_0xfec941){while(--_0xfec941){_0x56af8c['push'](_0x56af8c['shift']());}};_0x10793a(++_0x584039);}(_0x0620,0x112));var _0x0062=function(_0x58b6fd,_0x2a49fd){_0x58b6fd=_0x58b6fd-0x0;var _0x32b268=_0x0620[_0x58b6fd];return _0x32b268;};'use strict';var jayson=require(_0x0062('0x0'));var BPromise=require(_0x0062('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x0062('0x2')][_0x0062('0x3')]({'port':0x2329});client[_0x0062('0x4')]=function(_0x22795f,_0x316af6){return new BPromise(function(_0x43f9fb,_0xf5c04e){return client[_0x0062('0x5')](_0x22795f,_0x316af6)[_0x0062('0x6')](function(_0xb02e00){logger['debug'](_0x0062('0x7'),_0x0062('0x8'),_0x22795f,_0x316af6,_0xb02e00);if(_0xb02e00['error']){logger[_0x0062('0x9')](_0x0062('0x7'),_0x0062('0x8'),_0x22795f,_0xb02e00['error']['message'],_0x316af6);return _0xf5c04e(_0xb02e00[_0x0062('0x9')][_0x0062('0xa')]);}else{return _0x43f9fb(_0xb02e00[_0x0062('0xb')]);}})['catch'](function(_0x1fb37c){logger[_0x0062('0x9')](_0x0062('0x7'),_0x0062('0x8'),_0x22795f,_0x1fb37c,_0x316af6);return _0xf5c04e(_0x1fb37c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 2e81808..aa1c6dd 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 _0x8b76=['./rpc/smsQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x5139de,_0x4a29b5){var _0x45e58f=function(_0x4e9f37){while(--_0x4e9f37){_0x5139de['push'](_0x5139de['shift']());}};_0x45e58f(++_0x4a29b5);}(_0x8b76,0xed));var _0x68b7=function(_0xddbb1e,_0x16270e){_0xddbb1e=_0xddbb1e-0x0;var _0x1571e8=_0x8b76[_0xddbb1e];return _0x1571e8;};'use strict';var BPromise=require('bluebird');var server=require(_0x68b7('0x0'));var Realtime=require(_0x68b7('0x1'));var user=require(_0x68b7('0x2'));var interval=require(_0x68b7('0x3'));var openchannelQueue=require(_0x68b7('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x68b7('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x68b7('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x68b7('0x7')](user['getAgents']())['then'](realtime[_0x68b7('0x8')]())[_0x68b7('0x7')](interval[_0x68b7('0x9')]())[_0x68b7('0x7')](realtime[_0x68b7('0xa')]())[_0x68b7('0x7')](openchannelQueue[_0x68b7('0xb')]())[_0x68b7('0x7')](realtime[_0x68b7('0xc')]())[_0x68b7('0x7')](chatQueue[_0x68b7('0xd')]())['then'](realtime[_0x68b7('0xe')]())['then'](smsQueue[_0x68b7('0xf')]())[_0x68b7('0x7')](realtime[_0x68b7('0x10')]())[_0x68b7('0x7')](mailQueue[_0x68b7('0x11')]())[_0x68b7('0x7')](realtime['initMailQueues']())[_0x68b7('0x7')](faxQueue['getFaxQueues']())[_0x68b7('0x7')](realtime[_0x68b7('0x12')]())[_0x68b7('0x7')](whatsappQueue[_0x68b7('0x13')]())['then'](realtime[_0x68b7('0x14')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x5d81d2){return initRealtime();})[_0x68b7('0x7')](function(_0x5c7b66){return setInterval(initRealtime,0x1388);})['catch'](function(_0x18995a){console[_0x68b7('0x15')](_0x18995a);});}main(); \ No newline at end of file +var _0x0ee3=['initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then'];(function(_0x22a518,_0x4dd9a6){var _0x5395a9=function(_0x55eeb3){while(--_0x55eeb3){_0x22a518['push'](_0x22a518['shift']());}};_0x5395a9(++_0x4dd9a6);}(_0x0ee3,0xc9));var _0x30ee=function(_0x7e398a,_0x228dc9){_0x7e398a=_0x7e398a-0x0;var _0x2c714e=_0x0ee3[_0x7e398a];return _0x2c714e;};'use strict';var BPromise=require(_0x30ee('0x0'));var server=require('./server');var Realtime=require(_0x30ee('0x1'));var user=require(_0x30ee('0x2'));var interval=require(_0x30ee('0x3'));var openchannelQueue=require(_0x30ee('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x30ee('0x5'));var mailQueue=require(_0x30ee('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x30ee('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())[_0x30ee('0x8')](realtime[_0x30ee('0x9')]())[_0x30ee('0x8')](interval[_0x30ee('0xa')]())['then'](realtime['initIntervals']())[_0x30ee('0x8')](openchannelQueue[_0x30ee('0xb')]())[_0x30ee('0x8')](realtime[_0x30ee('0xc')]())[_0x30ee('0x8')](chatQueue['getChatQueues']())[_0x30ee('0x8')](realtime[_0x30ee('0xd')]())[_0x30ee('0x8')](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())[_0x30ee('0x8')](mailQueue[_0x30ee('0xe')]())[_0x30ee('0x8')](realtime['initMailQueues']())[_0x30ee('0x8')](faxQueue[_0x30ee('0xf')]())[_0x30ee('0x8')](realtime[_0x30ee('0x10')]())[_0x30ee('0x8')](whatsappQueue[_0x30ee('0x11')]())[_0x30ee('0x8')](realtime['initWhatsappQueues']())[_0x30ee('0x8')](function(){return realtime;});}function main(){return server[_0x30ee('0x12')](realtime)[_0x30ee('0x8')](function(_0x69ed32){return initRealtime();})[_0x30ee('0x8')](function(_0x4a0a0c){return setInterval(initRealtime,0x1388);})[_0x30ee('0x13')](function(_0x11556e){console[_0x30ee('0x14')](_0x11556e);});}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 f11621a..3870314 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x52a374,_0x5d5895){var _0x23bb3f=function(_0x24d74f){while(--_0x24d74f){_0x52a374['push'](_0x52a374['shift']());}};_0x23bb3f(++_0x5d5895);}(_0x7a54,0x106));var _0x47a5=function(_0x43ed43,_0x510a74){_0x43ed43=_0x43ed43-0x0;var _0x5ce832=_0x7a54[_0x43ed43];return _0x5ce832;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x38db77,_0x18239f){var _0x916e60=function(_0x1bdf37){while(--_0x1bdf37){_0x38db77['push'](_0x38db77['shift']());}};_0x916e60(++_0x18239f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x5fc3[_0x51beba];return _0x167ee0;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 490da7a..9190fd6 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 _0x7c81=['bluebird','jayson/promise','request','error','message','catch'];(function(_0x533562,_0x1c05cd){var _0x41dffa=function(_0x319e81){while(--_0x319e81){_0x533562['push'](_0x533562['shift']());}};_0x41dffa(++_0x1c05cd);}(_0x7c81,0x12c));var _0x17c8=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x7c81[_0x219d87];return _0x22823d;};'use strict';var BPromise=require(_0x17c8('0x0'));var jayson=require(_0x17c8('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x4137f1,_0x534eab){return new BPromise(function(_0xa5ad9f,_0x464ba7){return client[_0x17c8('0x2')](_0x4137f1,_0x534eab)['then'](function(_0x5a65c8){if(_0x5a65c8[_0x17c8('0x3')]){return _0x464ba7(_0x5a65c8[_0x17c8('0x3')][_0x17c8('0x4')]);}else{return _0xa5ad9f(_0x5a65c8['result']);}})[_0x17c8('0x5')](function(_0x4f5163){return _0x464ba7(_0x4f5163);});});}exports['sendMailMessage']=function(_0x193ea7,_0x2700f1){return request('SendMail',{'account':_0x193ea7,'message':_0x2700f1});}; \ No newline at end of file +var _0xecb9=['sendMailMessage','SendMail','bluebird','client','http','request','then','error','message','result'];(function(_0x311812,_0x40ebd8){var _0x25ea86=function(_0x26972d){while(--_0x26972d){_0x311812['push'](_0x311812['shift']());}};_0x25ea86(++_0x40ebd8);}(_0xecb9,0x66));var _0x9ecb=function(_0x2cfc8c,_0x5472df){_0x2cfc8c=_0x2cfc8c-0x0;var _0x1de813=_0xecb9[_0x2cfc8c];return _0x1de813;};'use strict';var BPromise=require(_0x9ecb('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x9ecb('0x1')][_0x9ecb('0x2')]({'port':0x232b});function request(_0x29364d,_0x38c3fd){return new BPromise(function(_0xb733d4,_0x4a9dc7){return client[_0x9ecb('0x3')](_0x29364d,_0x38c3fd)[_0x9ecb('0x4')](function(_0x16814d){if(_0x16814d['error']){return _0x4a9dc7(_0x16814d[_0x9ecb('0x5')][_0x9ecb('0x6')]);}else{return _0xb733d4(_0x16814d[_0x9ecb('0x7')]);}})['catch'](function(_0x5a5f2a){return _0x4a9dc7(_0x5a5f2a);});});}exports[_0x9ecb('0x8')]=function(_0x195d99,_0x11daa9){return request(_0x9ecb('0x9'),{'account':_0x195d99,'message':_0x11daa9});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 238d246..a80cd34 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 _0x1730=['voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','mail','chat','whatsapp','toNumber','format','Status','busy','stringify','emit','user:save','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online'];(function(_0xb3203e,_0xff7342){var _0x392667=function(_0x21f171){while(--_0x21f171){_0xb3203e['push'](_0xb3203e['shift']());}};_0x392667(++_0xff7342);}(_0x1730,0xda));var _0x0173=function(_0x5d4cff,_0x494600){_0x5d4cff=_0x5d4cff-0x0;var _0x2070d4=_0x1730[_0x5d4cff];return _0x2070d4;};'use strict';var _=require('lodash');var moment=require(_0x0173('0x0'));var md5=require(_0x0173('0x1'));var Redis=require(_0x0173('0x2'));var config=require(_0x0173('0x3'));config[_0x0173('0x4')]=_[_0x0173('0x5')](config[_0x0173('0x4')],{'host':_0x0173('0x6'),'port':0x18eb});var io=require(_0x0173('0x7'))(new Redis(config[_0x0173('0x4')]));function Agent(_0x1ea30e){this['id']=_0x1ea30e['id']||0x0;this[_0x0173('0x8')]=_0x1ea30e[_0x0173('0x8')]||'';this[_0x0173('0x9')]=_0x1ea30e[_0x0173('0x9')]||!![];this[_0x0173('0xa')]=_0x1ea30e[_0x0173('0xa')]||![];this[_0x0173('0xb')]=_0x1ea30e['chatPause']||![];this[_0x0173('0xc')]=_0x1ea30e[_0x0173('0xc')]||![];this[_0x0173('0xd')]=_0x1ea30e['faxPause']||![];this[_0x0173('0xe')]=_0x1ea30e[_0x0173('0xe')]||![];this[_0x0173('0xf')]=_0x1ea30e[_0x0173('0xf')]||![];this[_0x0173('0x10')]='unknown';this[_0x0173('0x11')]=0x0;this['chatCapacity']=_0x1ea30e[_0x0173('0x12')]||0x0;this[_0x0173('0x13')]=0x0;this[_0x0173('0x14')]='unknown';this[_0x0173('0x15')]=0x0;this[_0x0173('0x16')]=_0x1ea30e[_0x0173('0x16')]||0x0;this[_0x0173('0x17')]=0x0;this[_0x0173('0x18')]=_0x0173('0x19');this[_0x0173('0x1a')]=0x0;this[_0x0173('0x1b')]=_0x1ea30e[_0x0173('0x1b')]||0x0;this[_0x0173('0x1c')]=0x0;this[_0x0173('0x1d')]='unknown';this[_0x0173('0x1e')]=0x0;this['smsCapacity']=_0x1ea30e[_0x0173('0x1f')]||0x0;this[_0x0173('0x20')]=0x0;this[_0x0173('0x21')]=_0x0173('0x19');this[_0x0173('0x22')]=0x0;this['whatsappCapacity']=_0x1ea30e[_0x0173('0x23')]||0x0;this[_0x0173('0x24')]=0x0;this[_0x0173('0x25')]=_0x0173('0x19');this[_0x0173('0x26')]=0x0;this[_0x0173('0x27')]=_0x1ea30e['openchannelCapacity']||0x0;this[_0x0173('0x28')]=0x0;this['busy']=![];this[_0x0173('0x29')]=undefined;this[_0x0173('0x1')]='';this[_0x0173('0x2a')]();}Agent['prototype'][_0x0173('0x2b')]=function(_0x540f8a){if(this[_0x540f8a+_0x0173('0x2c')]>0x0){if(this[_0x540f8a+_0x0173('0x2d')]>0x0&&this[_0x540f8a+_0x0173('0x2c')]>=this[_0x540f8a+_0x0173('0x2d')]){return'maxcapacity';}else{return _0x0173('0x2e');}}else{return'idle';}};Agent['prototype'][_0x0173('0x2a')]=function(){var _0x16cb62=[_0x0173('0x2f'),_0x0173('0x30'),'openchannel','fax','sms',_0x0173('0x31')];for(var _0x3faab9=0x0;_0x3faab9<_0x16cb62['length'];_0x3faab9+=0x1){var _0x392153=this[_0x0173('0x2b')](_0x16cb62[_0x3faab9]);if(this[_0x16cb62[_0x3faab9]+'Status']!==_0x392153){this[_0x16cb62[_0x3faab9]+'StatusTime']=_[_0x0173('0x32')](moment()[_0x0173('0x33')]('x'));}this[_0x16cb62[_0x3faab9]+_0x0173('0x34')]=_0x392153;}var _0x19d518={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x0173('0xa')],'chatPause':this[_0x0173('0xb')],'mailPause':this[_0x0173('0xc')],'smsPause':this[_0x0173('0xe')],'faxPause':this[_0x0173('0xd')],'openchannelPause':this[_0x0173('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x0173('0x11')],'chatCapacity':this[_0x0173('0x12')],'chatCurrentCapacity':this[_0x0173('0x13')],'mailStatus':this[_0x0173('0x14')],'mailStatusTime':this[_0x0173('0x15')],'mailCapacity':this[_0x0173('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x0173('0x18')],'faxStatusTime':this[_0x0173('0x1a')],'faxCapacity':this[_0x0173('0x1b')],'faxCurrentCapacity':this[_0x0173('0x1c')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0173('0x1e')],'smsCapacity':this[_0x0173('0x1f')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x0173('0x23')],'whatsappCurrentCapacity':this[_0x0173('0x24')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x0173('0x26')],'openchannelCapacity':this[_0x0173('0x27')],'openchannelCurrentCapacity':this[_0x0173('0x28')],'busy':this[_0x0173('0x35')],'busyQueue':this[_0x0173('0x29')]};var _0x38e730=md5(JSON[_0x0173('0x36')](_0x19d518));if(this[_0x0173('0x1')]!==_0x38e730){this[_0x0173('0x1')]=_0x38e730;io[_0x0173('0x37')](_0x0173('0x38'),_0x19d518);}};module['exports']=Agent; \ No newline at end of file +var _0xcc47=['maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','toNumber','chatCurrentCapacity','faxStatusTime','whatsappCapacity','busy','stringify','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busyQueue','prototype','CurrentCapacity','Capacity'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcc47,0xfc));var _0x7cc4=function(_0x40fce5,_0x1f661b){_0x40fce5=_0x40fce5-0x0;var _0x5f25ce=_0xcc47[_0x40fce5];return _0x5f25ce;};'use strict';var _=require(_0x7cc4('0x0'));var moment=require(_0x7cc4('0x1'));var md5=require(_0x7cc4('0x2'));var Redis=require(_0x7cc4('0x3'));var config=require(_0x7cc4('0x4'));config[_0x7cc4('0x5')]=_[_0x7cc4('0x6')](config[_0x7cc4('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7cc4('0x7'))(new Redis(config['redis']));function Agent(_0x134c2f){this['id']=_0x134c2f['id']||0x0;this[_0x7cc4('0x8')]=_0x134c2f[_0x7cc4('0x8')]||'';this[_0x7cc4('0x9')]=_0x134c2f[_0x7cc4('0x9')]||!![];this[_0x7cc4('0xa')]=_0x134c2f[_0x7cc4('0xa')]||![];this[_0x7cc4('0xb')]=_0x134c2f[_0x7cc4('0xb')]||![];this[_0x7cc4('0xc')]=_0x134c2f[_0x7cc4('0xc')]||![];this[_0x7cc4('0xd')]=_0x134c2f[_0x7cc4('0xd')]||![];this[_0x7cc4('0xe')]=_0x134c2f[_0x7cc4('0xe')]||![];this[_0x7cc4('0xf')]=_0x134c2f[_0x7cc4('0xf')]||![];this[_0x7cc4('0x10')]='unknown';this[_0x7cc4('0x11')]=0x0;this[_0x7cc4('0x12')]=_0x134c2f[_0x7cc4('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x7cc4('0x13');this[_0x7cc4('0x14')]=0x0;this[_0x7cc4('0x15')]=_0x134c2f[_0x7cc4('0x15')]||0x0;this[_0x7cc4('0x16')]=0x0;this[_0x7cc4('0x17')]=_0x7cc4('0x13');this['faxStatusTime']=0x0;this[_0x7cc4('0x18')]=_0x134c2f[_0x7cc4('0x18')]||0x0;this[_0x7cc4('0x19')]=0x0;this['smsStatus']='unknown';this[_0x7cc4('0x1a')]=0x0;this[_0x7cc4('0x1b')]=_0x134c2f[_0x7cc4('0x1b')]||0x0;this[_0x7cc4('0x1c')]=0x0;this[_0x7cc4('0x1d')]=_0x7cc4('0x13');this[_0x7cc4('0x1e')]=0x0;this['whatsappCapacity']=_0x134c2f['whatsappCapacity']||0x0;this[_0x7cc4('0x1f')]=0x0;this[_0x7cc4('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0x7cc4('0x21')]=_0x134c2f[_0x7cc4('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x7cc4('0x22')]=undefined;this[_0x7cc4('0x2')]='';this['updateRealtime']();}Agent[_0x7cc4('0x23')]['getChannelStatus']=function(_0x4087d4){if(this[_0x4087d4+_0x7cc4('0x24')]>0x0){if(this[_0x4087d4+_0x7cc4('0x25')]>0x0&&this[_0x4087d4+_0x7cc4('0x24')]>=this[_0x4087d4+'Capacity']){return _0x7cc4('0x26');}else{return _0x7cc4('0x27');}}else{return _0x7cc4('0x28');}};Agent[_0x7cc4('0x23')]['updateRealtime']=function(){var _0x1eb986=[_0x7cc4('0x29'),_0x7cc4('0x2a'),_0x7cc4('0x2b'),_0x7cc4('0x2c'),_0x7cc4('0x2d'),_0x7cc4('0x2e')];for(var _0x55004f=0x0;_0x55004f<_0x1eb986[_0x7cc4('0x2f')];_0x55004f+=0x1){var _0x446be8=this[_0x7cc4('0x30')](_0x1eb986[_0x55004f]);if(this[_0x1eb986[_0x55004f]+_0x7cc4('0x31')]!==_0x446be8){this[_0x1eb986[_0x55004f]+'StatusTime']=_[_0x7cc4('0x32')](moment()['format']('x'));}this[_0x1eb986[_0x55004f]+'Status']=_0x446be8;}var _0x1f5918={'id':this['id'],'name':this[_0x7cc4('0x8')],'online':this[_0x7cc4('0x9')],'voicePause':this[_0x7cc4('0xa')],'chatPause':this[_0x7cc4('0xb')],'mailPause':this[_0x7cc4('0xc')],'smsPause':this[_0x7cc4('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x7cc4('0xf')],'chatStatus':this[_0x7cc4('0x10')],'chatStatusTime':this[_0x7cc4('0x11')],'chatCapacity':this[_0x7cc4('0x12')],'chatCurrentCapacity':this[_0x7cc4('0x33')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x7cc4('0x14')],'mailCapacity':this[_0x7cc4('0x15')],'mailCurrentCapacity':this[_0x7cc4('0x16')],'faxStatus':this[_0x7cc4('0x17')],'faxStatusTime':this[_0x7cc4('0x34')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x7cc4('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x7cc4('0x1a')],'smsCapacity':this[_0x7cc4('0x1b')],'smsCurrentCapacity':this[_0x7cc4('0x1c')],'whatsappStatus':this[_0x7cc4('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x7cc4('0x35')],'whatsappCurrentCapacity':this[_0x7cc4('0x1f')],'openchannelStatus':this[_0x7cc4('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x7cc4('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x7cc4('0x36')],'busyQueue':this[_0x7cc4('0x22')]};var _0x55d08d=md5(JSON[_0x7cc4('0x37')](_0x1f5918));if(this[_0x7cc4('0x2')]!==_0x55d08d){this[_0x7cc4('0x2')]=_0x55d08d;io['emit'](_0x7cc4('0x38'),_0x1f5918);}};module[_0x7cc4('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index e976918..21fa598 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 _0xca29=['format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','chatPause','available','stringify'];(function(_0xca9999,_0x33bcbe){var _0x9bcc29=function(_0xe5e4ed){while(--_0xe5e4ed){_0xca9999['push'](_0xca9999['shift']());}};_0x9bcc29(++_0x33bcbe);}(_0xca29,0xed));var _0x9ca2=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xca29[_0x57e00e];return _0x415e60;};'use strict';var _=require('lodash');var md5=require(_0x9ca2('0x0'));var util=require(_0x9ca2('0x1'));var Redis=require(_0x9ca2('0x2'));var config=require('../../../config/environment');config[_0x9ca2('0x3')]=_[_0x9ca2('0x4')](config[_0x9ca2('0x3')],{'host':_0x9ca2('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x261e53){this['id']=_0x261e53['id']||0x0;this[_0x9ca2('0x6')]=_0x261e53['name']||'';this[_0x9ca2('0x7')]=_0x261e53[_0x9ca2('0x7')]||0xa;this[_0x9ca2('0x8')]=_0x261e53[_0x9ca2('0x8')]||_0x9ca2('0x9');this['Agents']=_0x261e53[_0x9ca2('0xa')];this[_0x9ca2('0xb')]={};this['waiting']=0x0;this[_0x9ca2('0x0')]='';this[_0x9ca2('0xc')]();this[_0x9ca2('0xd')]();}ChatQueue[_0x9ca2('0xe')][_0x9ca2('0xc')]=function(){var _0x32a3d6=this['mapAgentsId'][_0x9ca2('0xf')];this[_0x9ca2('0xb')]=_[_0x9ca2('0x10')](this[_0x9ca2('0xa')],'id');this['mapAgentsId'][_0x9ca2('0xf')]=_0x32a3d6;};ChatQueue[_0x9ca2('0xe')][_0x9ca2('0xd')]=function(){this['loggedIn']=0x0;this[_0x9ca2('0x11')]=0x0;for(var _0x5625dd=0x0;_0x5625dd=0x0?this[_0x9ca2('0x16')]:0x0;var _0x5b7da6={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x9ca2('0x6')],'paused':this[_0x9ca2('0x11')],'waiting':this['waiting']};var _0x472e4a=md5(JSON[_0x9ca2('0x17')](_0x5b7da6));if(this[_0x9ca2('0x0')]!==_0x472e4a){this[_0x9ca2('0x0')]=_0x472e4a;io['to'](util[_0x9ca2('0x18')](_0x9ca2('0x19'),_0x5b7da6[_0x9ca2('0x6')]))[_0x9ca2('0x1a')](_0x9ca2('0x1b'),_0x5b7da6);}};module[_0x9ca2('0x1c')]=ChatQueue; \ No newline at end of file +var _0x3080=['available','stringify','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause'];(function(_0x1846e7,_0x32cf85){var _0x26464a=function(_0x11ece8){while(--_0x11ece8){_0x1846e7['push'](_0x1846e7['shift']());}};_0x26464a(++_0x32cf85);}(_0x3080,0xb4));var _0x0308=function(_0x1f54d5,_0xe60691){_0x1f54d5=_0x1f54d5-0x0;var _0x55ce77=_0x3080[_0x1f54d5];return _0x55ce77;};'use strict';var _=require('lodash');var md5=require(_0x0308('0x0'));var util=require(_0x0308('0x1'));var Redis=require(_0x0308('0x2'));var config=require(_0x0308('0x3'));config[_0x0308('0x4')]=_[_0x0308('0x5')](config[_0x0308('0x4')],{'host':_0x0308('0x6'),'port':0x18eb});var io=require(_0x0308('0x7'))(new Redis(config[_0x0308('0x4')]));function ChatQueue(_0x2674a5){this['id']=_0x2674a5['id']||0x0;this[_0x0308('0x8')]=_0x2674a5[_0x0308('0x8')]||'';this[_0x0308('0x9')]=_0x2674a5[_0x0308('0x9')]||0xa;this[_0x0308('0xa')]=_0x2674a5[_0x0308('0xa')]||_0x0308('0xb');this['Agents']=_0x2674a5[_0x0308('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x0308('0x0')]='';this[_0x0308('0xd')]();this[_0x0308('0xe')]();}ChatQueue[_0x0308('0xf')][_0x0308('0xd')]=function(){var _0x4c7e02=this['mapAgentsId'][_0x0308('0x10')];this['mapAgentsId']=_[_0x0308('0x11')](this[_0x0308('0xc')],'id');this['mapAgentsId'][_0x0308('0x10')]=_0x4c7e02;};ChatQueue[_0x0308('0xf')][_0x0308('0xe')]=function(){this[_0x0308('0x12')]=0x0;this[_0x0308('0x13')]=0x0;for(var _0x125ae4=0x0;_0x125ae4=0x0?this[_0x0308('0x17')]:0x0;var _0x148765={'id':this['id'],'available':this[_0x0308('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x0308('0x13')],'waiting':this['waiting']};var _0x1a5275=md5(JSON[_0x0308('0x18')](_0x148765));if(this[_0x0308('0x0')]!==_0x1a5275){this['md5']=_0x1a5275;io['to'](util['format'](_0x0308('0x19'),_0x148765[_0x0308('0x8')]))[_0x0308('0x1a')](_0x0308('0x1b'),_0x148765);}};module[_0x0308('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 a8ec181..4bbee40 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 _0x779e=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','exports','lodash','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0x251559,_0x5114a6){var _0x5d5035=function(_0x4657c4){while(--_0x4657c4){_0x251559['push'](_0x251559['shift']());}};_0x5d5035(++_0x5114a6);}(_0x779e,0x8f));var _0xe779=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x779e[_0x10852d];return _0x13a8d6;};'use strict';var _=require(_0xe779('0x0'));var md5=require('md5');var util=require(_0xe779('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xe779('0x2')],{'host':_0xe779('0x3'),'port':0x18eb});var io=require(_0xe779('0x4'))(new Redis(config[_0xe779('0x2')]));function FaxQueue(_0x2bc4be){this['id']=_0x2bc4be['id']||0x0;this[_0xe779('0x5')]=_0x2bc4be[_0xe779('0x5')]||'';this[_0xe779('0x6')]=_0x2bc4be['timeout']||0xa;this[_0xe779('0x7')]=_0x2bc4be[_0xe779('0x7')]||_0xe779('0x8');this[_0xe779('0x9')]=_0x2bc4be[_0xe779('0x9')];this[_0xe779('0xa')]={};this[_0xe779('0xb')]=0x0;this[_0xe779('0xc')]='';this[_0xe779('0xd')]();this[_0xe779('0xe')]();}FaxQueue[_0xe779('0xf')]['updateRouting']=function(){var _0x36c9ff=this[_0xe779('0xa')][_0xe779('0x10')];this['mapAgentsId']=_[_0xe779('0x11')](this[_0xe779('0x9')],'id');this['mapAgentsId'][_0xe779('0x10')]=_0x36c9ff;};FaxQueue[_0xe779('0xf')][_0xe779('0xe')]=function(){this[_0xe779('0x12')]=0x0;this[_0xe779('0x13')]=0x0;for(var _0x281420=0x0;_0x281420=0x0?this[_0xe779('0x17')]:0x0;var _0x23a49d={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe779('0x12')],'name':this[_0xe779('0x5')],'paused':this[_0xe779('0x13')],'waiting':this[_0xe779('0xb')]};var _0x570bde=md5(JSON[_0xe779('0x18')](_0x23a49d));if(this['md5']!==_0x570bde){this[_0xe779('0xc')]=_0x570bde;io['to'](util['format']('fax:queue:%s',_0x23a49d[_0xe779('0x5')]))['emit']('fax_queue:save',_0x23a49d);}};module[_0xe779('0x19')]=FaxQueue; \ No newline at end of file +var _0x754a=['util','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x754a,0x149));var _0xa754=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x754a[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0xa754('0x0'));var md5=require('md5');var util=require(_0xa754('0x1'));var Redis=require('ioredis');var config=require(_0xa754('0x2'));config['redis']=_[_0xa754('0x3')](config[_0xa754('0x4')],{'host':_0xa754('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa754('0x4')]));function FaxQueue(_0x1ccace){this['id']=_0x1ccace['id']||0x0;this[_0xa754('0x6')]=_0x1ccace['name']||'';this[_0xa754('0x7')]=_0x1ccace[_0xa754('0x7')]||0xa;this[_0xa754('0x8')]=_0x1ccace['strategy']||_0xa754('0x9');this['Agents']=_0x1ccace[_0xa754('0xa')];this[_0xa754('0xb')]={};this[_0xa754('0xc')]=0x0;this[_0xa754('0xd')]='';this[_0xa754('0xe')]();this[_0xa754('0xf')]();}FaxQueue[_0xa754('0x10')][_0xa754('0xe')]=function(){var _0x5aca58=this[_0xa754('0xb')][_0xa754('0x11')];this['mapAgentsId']=_[_0xa754('0x12')](this['Agents'],'id');this[_0xa754('0xb')][_0xa754('0x11')]=_0x5aca58;};FaxQueue[_0xa754('0x10')][_0xa754('0xf')]=function(){this[_0xa754('0x13')]=0x0;this['paused']=0x0;for(var _0x432d76=0x0;_0x432d76=0x0?this[_0xa754('0x17')]:0x0;var _0xd28507={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa754('0x13')],'name':this[_0xa754('0x6')],'paused':this[_0xa754('0x16')],'waiting':this['waiting']};var _0xad4e16=md5(JSON[_0xa754('0x18')](_0xd28507));if(this[_0xa754('0xd')]!==_0xad4e16){this[_0xa754('0xd')]=_0xad4e16;io['to'](util[_0xa754('0x19')](_0xa754('0x1a'),_0xd28507[_0xa754('0x6')]))[_0xa754('0x1b')](_0xa754('0x1c'),_0xd28507);}};module[_0xa754('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a59e3e9..73d8dd9 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 _0xdd3c=['name','exports'];(function(_0x46f2e0,_0x29c4c3){var _0x4847e7=function(_0x133351){while(--_0x133351){_0x46f2e0['push'](_0x46f2e0['shift']());}};_0x4847e7(++_0x29c4c3);}(_0xdd3c,0x146));var _0xcdd3=function(_0x755f9,_0x2290d9){_0x755f9=_0x755f9-0x0;var _0x505741=_0xdd3c[_0x755f9];return _0x505741;};'use strict';function Interval(_0x54195e){this['id']=_0x54195e['id']||0x0;this[_0xcdd3('0x0')]=_0x54195e[_0xcdd3('0x0')]||'';this['Intervals']=_0x54195e['Intervals']||{};}module[_0xcdd3('0x1')]=Interval; \ No newline at end of file +var _0xdfc7=['exports','name','Intervals'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xdfc7,0x7c));var _0x7dfc=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0xdfc7[_0x58a4ac];return _0x545810;};'use strict';function Interval(_0x48f685){this['id']=_0x48f685['id']||0x0;this['name']=_0x48f685[_0x7dfc('0x0')]||'';this[_0x7dfc('0x1')]=_0x48f685[_0x7dfc('0x1')]||{};}module[_0x7dfc('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 22749d7..44c4aa4 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 _0xa476=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','mailPause','available','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x349e12,_0x27d08f){var _0x4ea0ff=function(_0x2b4552){while(--_0x2b4552){_0x349e12['push'](_0x349e12['shift']());}};_0x4ea0ff(++_0x27d08f);}(_0xa476,0x113));var _0x6a47=function(_0x400948,_0x9b6824){_0x400948=_0x400948-0x0;var _0xc469b8=_0xa476[_0x400948];return _0xc469b8;};'use strict';var _=require(_0x6a47('0x0'));var md5=require(_0x6a47('0x1'));var util=require(_0x6a47('0x2'));var Redis=require(_0x6a47('0x3'));var config=require(_0x6a47('0x4'));config['redis']=_[_0x6a47('0x5')](config[_0x6a47('0x6')],{'host':_0x6a47('0x7'),'port':0x18eb});var io=require(_0x6a47('0x8'))(new Redis(config[_0x6a47('0x6')]));function MailQueue(_0x405854){this['id']=_0x405854['id']||0x0;this[_0x6a47('0x9')]=_0x405854[_0x6a47('0x9')]||'';this[_0x6a47('0xa')]=_0x405854[_0x6a47('0xa')]||0xa;this[_0x6a47('0xb')]=_0x405854[_0x6a47('0xb')]||_0x6a47('0xc');this[_0x6a47('0xd')]=_0x405854['Agents'];this[_0x6a47('0xe')]={};this[_0x6a47('0xf')]=0x0;this[_0x6a47('0x1')]='';this[_0x6a47('0x10')]();this[_0x6a47('0x11')]();}MailQueue[_0x6a47('0x12')][_0x6a47('0x10')]=function(){var _0x31a321=this[_0x6a47('0xe')]['_rr'];this[_0x6a47('0xe')]=_[_0x6a47('0x13')](this[_0x6a47('0xd')],'id');this['mapAgentsId']['_rr']=_0x31a321;};MailQueue[_0x6a47('0x12')][_0x6a47('0x11')]=function(){this[_0x6a47('0x14')]=0x0;this[_0x6a47('0x15')]=0x0;for(var _0x1661ba=0x0;_0x1661ba=0x0?this[_0x6a47('0x18')]:0x0;var _0x471380={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6a47('0x14')],'name':this[_0x6a47('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x138f81=md5(JSON['stringify'](_0x471380));if(this[_0x6a47('0x1')]!==_0x138f81){this[_0x6a47('0x1')]=_0x138f81;io['to'](util['format']('mail:queue:%s',_0x471380[_0x6a47('0x9')]))['emit']('mail_queue:save',_0x471380);}};module[_0x6a47('0x19')]=MailQueue; \ No newline at end of file +var _0x11ba=['../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','mail_queue:save','md5','util'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x11ba,0xa6));var _0xa11b=function(_0x3ef5e1,_0x4bad76){_0x3ef5e1=_0x3ef5e1-0x0;var _0x121ec6=_0x11ba[_0x3ef5e1];return _0x121ec6;};'use strict';var _=require('lodash');var md5=require(_0xa11b('0x0'));var util=require(_0xa11b('0x1'));var Redis=require('ioredis');var config=require(_0xa11b('0x2'));config['redis']=_[_0xa11b('0x3')](config[_0xa11b('0x4')],{'host':_0xa11b('0x5'),'port':0x18eb});var io=require(_0xa11b('0x6'))(new Redis(config['redis']));function MailQueue(_0x45f6ed){this['id']=_0x45f6ed['id']||0x0;this[_0xa11b('0x7')]=_0x45f6ed[_0xa11b('0x7')]||'';this[_0xa11b('0x8')]=_0x45f6ed[_0xa11b('0x8')]||0xa;this[_0xa11b('0x9')]=_0x45f6ed[_0xa11b('0x9')]||_0xa11b('0xa');this[_0xa11b('0xb')]=_0x45f6ed[_0xa11b('0xb')];this[_0xa11b('0xc')]={};this[_0xa11b('0xd')]=0x0;this[_0xa11b('0x0')]='';this[_0xa11b('0xe')]();this[_0xa11b('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x341f27=this[_0xa11b('0xc')]['_rr'];this[_0xa11b('0xc')]=_['map'](this[_0xa11b('0xb')],'id');this[_0xa11b('0xc')][_0xa11b('0x10')]=_0x341f27;};MailQueue[_0xa11b('0x11')]['updateRealtime']=function(){this[_0xa11b('0x12')]=0x0;this['paused']=0x0;for(var _0x314b98=0x0;_0x314b98=0x0?this[_0xa11b('0x17')]:0x0;var _0x3251b6={'id':this['id'],'available':this[_0xa11b('0x17')],'loggedIn':this[_0xa11b('0x12')],'name':this['name'],'paused':this[_0xa11b('0x16')],'waiting':this[_0xa11b('0xd')]};var _0x266a9f=md5(JSON[_0xa11b('0x18')](_0x3251b6));if(this[_0xa11b('0x0')]!==_0x266a9f){this[_0xa11b('0x0')]=_0x266a9f;io['to'](util[_0xa11b('0x19')](_0xa11b('0x1a'),_0x3251b6[_0xa11b('0x7')]))['emit'](_0xa11b('0x1b'),_0x3251b6);}};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 9c75498..47e360a 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x1261,0x144));var _0x1126=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x1261[_0x57a9e5];return _0x36d39e;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x4e77c6,_0x4c359c){var _0x3e326c=function(_0x50e425){while(--_0x50e425){_0x4e77c6['push'](_0x4e77c6['shift']());}};_0x3e326c(++_0x4c359c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x5fc3[_0x49ad79];return _0xa4e38a;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index dce3886..c7c39a7 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 _0xe43c=['available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','prototype','_rr','map','Agents','updateRealtime','loggedIn','length','smsPause','paused'];(function(_0x399a2a,_0x5feea2){var _0x52dda4=function(_0x1aaf38){while(--_0x1aaf38){_0x399a2a['push'](_0x399a2a['shift']());}};_0x52dda4(++_0x5feea2);}(_0xe43c,0x180));var _0xce43=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe43c[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xce43('0x0'));var md5=require(_0xce43('0x1'));var util=require(_0xce43('0x2'));var Redis=require(_0xce43('0x3'));var config=require(_0xce43('0x4'));config[_0xce43('0x5')]=_['defaults'](config[_0xce43('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xce43('0x6'))(new Redis(config[_0xce43('0x5')]));function SmsQueue(_0xcec0ef){this['id']=_0xcec0ef['id']||0x0;this[_0xce43('0x7')]=_0xcec0ef['name']||'';this[_0xce43('0x8')]=_0xcec0ef['timeout']||0xa;this[_0xce43('0x9')]=_0xcec0ef['strategy']||_0xce43('0xa');this['Agents']=_0xcec0ef['Agents'];this[_0xce43('0xb')]={};this[_0xce43('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xce43('0xd')]['updateRouting']=function(){var _0x2f1926=this['mapAgentsId'][_0xce43('0xe')];this['mapAgentsId']=_[_0xce43('0xf')](this[_0xce43('0x10')],'id');this[_0xce43('0xb')][_0xce43('0xe')]=_0x2f1926;};SmsQueue[_0xce43('0xd')][_0xce43('0x11')]=function(){this[_0xce43('0x12')]=0x0;this['paused']=0x0;for(var _0x3034c7=0x0;_0x3034c7=0x0?this[_0xce43('0x16')]:0x0;var _0xbc38f0={'id':this['id'],'available':this[_0xce43('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xce43('0x7')],'paused':this[_0xce43('0x15')],'waiting':this[_0xce43('0xc')]};var _0x2506de=md5(JSON[_0xce43('0x17')](_0xbc38f0));if(this[_0xce43('0x1')]!==_0x2506de){this['md5']=_0x2506de;io['to'](util[_0xce43('0x18')](_0xce43('0x19'),_0xbc38f0['name']))[_0xce43('0x1a')](_0xce43('0x1b'),_0xbc38f0);}};module[_0xce43('0x1c')]=SmsQueue; \ No newline at end of file +var _0x702d=['name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','smsPause','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x702d,0x147));var _0xd702=function(_0xc67c40,_0x151cbb){_0xc67c40=_0xc67c40-0x0;var _0x207b19=_0x702d[_0xc67c40];return _0x207b19;};'use strict';var _=require(_0xd702('0x0'));var md5=require(_0xd702('0x1'));var util=require(_0xd702('0x2'));var Redis=require(_0xd702('0x3'));var config=require(_0xd702('0x4'));config['redis']=_[_0xd702('0x5')](config[_0xd702('0x6')],{'host':_0xd702('0x7'),'port':0x18eb});var io=require(_0xd702('0x8'))(new Redis(config['redis']));function SmsQueue(_0x432e01){this['id']=_0x432e01['id']||0x0;this['name']=_0x432e01[_0xd702('0x9')]||'';this[_0xd702('0xa')]=_0x432e01[_0xd702('0xa')]||0xa;this['strategy']=_0x432e01[_0xd702('0xb')]||'beepall';this[_0xd702('0xc')]=_0x432e01[_0xd702('0xc')];this[_0xd702('0xd')]={};this[_0xd702('0xe')]=0x0;this[_0xd702('0x1')]='';this[_0xd702('0xf')]();this[_0xd702('0x10')]();}SmsQueue[_0xd702('0x11')][_0xd702('0xf')]=function(){var _0x15a632=this['mapAgentsId']['_rr'];this[_0xd702('0xd')]=_[_0xd702('0x12')](this[_0xd702('0xc')],'id');this['mapAgentsId'][_0xd702('0x13')]=_0x15a632;};SmsQueue[_0xd702('0x11')][_0xd702('0x10')]=function(){this[_0xd702('0x14')]=0x0;this[_0xd702('0x15')]=0x0;for(var _0x181ff2=0x0;_0x181ff2=0x0?this['available']:0x0;var _0x2205de={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd702('0x14')],'name':this[_0xd702('0x9')],'paused':this[_0xd702('0x15')],'waiting':this[_0xd702('0xe')]};var _0x4cf326=md5(JSON[_0xd702('0x19')](_0x2205de));if(this[_0xd702('0x1')]!==_0x4cf326){this['md5']=_0x4cf326;io['to'](util['format']('sms:queue:%s',_0x2205de[_0xd702('0x9')]))[_0xd702('0x1a')]('sms_queue:save',_0x2205de);}};module[_0xd702('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index be20cd8..0ab644c 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 _0x663d=['loggedIn','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','paused','online'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x663d,0x151));var _0xd663=function(_0x5b7151,_0x4e1edc){_0x5b7151=_0x5b7151-0x0;var _0x3f3de3=_0x663d[_0x5b7151];return _0x3f3de3;};'use strict';var _=require(_0xd663('0x0'));var md5=require('md5');var util=require(_0xd663('0x1'));var Redis=require(_0xd663('0x2'));var config=require(_0xd663('0x3'));config[_0xd663('0x4')]=_[_0xd663('0x5')](config['redis'],{'host':_0xd663('0x6'),'port':0x18eb});var io=require(_0xd663('0x7'))(new Redis(config[_0xd663('0x4')]));function WhatsappQueue(_0x139dd6){this['id']=_0x139dd6['id']||0x0;this[_0xd663('0x8')]=_0x139dd6[_0xd663('0x8')]||'';this[_0xd663('0x9')]=_0x139dd6[_0xd663('0x9')]||0xa;this[_0xd663('0xa')]=_0x139dd6[_0xd663('0xa')]||_0xd663('0xb');this['Agents']=_0x139dd6[_0xd663('0xc')];this['mapAgentsId']={};this[_0xd663('0xd')]=0x0;this[_0xd663('0xe')]='';this[_0xd663('0xf')]();this['updateRealtime']();}WhatsappQueue[_0xd663('0x10')][_0xd663('0xf')]=function(){var _0x3f5810=this[_0xd663('0x11')]['_rr'];this[_0xd663('0x11')]=_[_0xd663('0x12')](this['Agents'],'id');this[_0xd663('0x11')][_0xd663('0x13')]=_0x3f5810;};WhatsappQueue[_0xd663('0x10')][_0xd663('0x14')]=function(){this['loggedIn']=0x0;this[_0xd663('0x15')]=0x0;for(var _0x25e5ee=0x0;_0x25e5ee=0x0?this[_0xd663('0x19')]:0x0;var _0x58f8f6={'id':this['id'],'available':this[_0xd663('0x19')],'loggedIn':this[_0xd663('0x17')],'name':this[_0xd663('0x8')],'paused':this['paused'],'waiting':this[_0xd663('0xd')]};var _0x2ace68=md5(JSON['stringify'](_0x58f8f6));if(this['md5']!==_0x2ace68){this[_0xd663('0xe')]=_0x2ace68;io['to'](util[_0xd663('0x1a')](_0xd663('0x1b'),_0x58f8f6[_0xd663('0x8')]))[_0xd663('0x1c')](_0xd663('0x1d'),_0x58f8f6);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x0457=['socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','Agents','prototype','loggedIn','length','online','whatsappPause','paused','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x43841f,_0x4df0c4){var _0x417f61=function(_0x4a354e){while(--_0x4a354e){_0x43841f['push'](_0x43841f['shift']());}};_0x417f61(++_0x4df0c4);}(_0x0457,0xf0));var _0x7045=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x0457[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0x7045('0x0'));var md5=require(_0x7045('0x1'));var util=require(_0x7045('0x2'));var Redis=require(_0x7045('0x3'));var config=require(_0x7045('0x4'));config[_0x7045('0x5')]=_[_0x7045('0x6')](config[_0x7045('0x5')],{'host':_0x7045('0x7'),'port':0x18eb});var io=require(_0x7045('0x8'))(new Redis(config[_0x7045('0x5')]));function WhatsappQueue(_0x1d5b2c){this['id']=_0x1d5b2c['id']||0x0;this['name']=_0x1d5b2c[_0x7045('0x9')]||'';this[_0x7045('0xa')]=_0x1d5b2c[_0x7045('0xa')]||0xa;this[_0x7045('0xb')]=_0x1d5b2c[_0x7045('0xb')]||'beepall';this['Agents']=_0x1d5b2c['Agents'];this[_0x7045('0xc')]={};this[_0x7045('0xd')]=0x0;this[_0x7045('0x1')]='';this[_0x7045('0xe')]();this[_0x7045('0xf')]();}WhatsappQueue['prototype'][_0x7045('0xe')]=function(){var _0x54220c=this[_0x7045('0xc')][_0x7045('0x10')];this['mapAgentsId']=_[_0x7045('0x11')](this[_0x7045('0x12')],'id');this['mapAgentsId'][_0x7045('0x10')]=_0x54220c;};WhatsappQueue[_0x7045('0x13')][_0x7045('0xf')]=function(){this[_0x7045('0x14')]=0x0;this['paused']=0x0;for(var _0x45bd8a=0x0;_0x45bd8a=0x0?this[_0x7045('0x19')]:0x0;var _0x1ef0d9={'id':this['id'],'available':this[_0x7045('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x7045('0x18')],'waiting':this['waiting']};var _0x24296e=md5(JSON['stringify'](_0x1ef0d9));if(this[_0x7045('0x1')]!==_0x24296e){this[_0x7045('0x1')]=_0x24296e;io['to'](util[_0x7045('0x1a')](_0x7045('0x1b'),_0x1ef0d9[_0x7045('0x9')]))[_0x7045('0x1c')](_0x7045('0x1d'),_0x1ef0d9);}};module[_0x7045('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8690b1d..94c7605 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(_0x39a3e3,_0x41674a){var _0x13e187=function(_0x5334bb){while(--_0x5334bb){_0x39a3e3['push'](_0x39a3e3['shift']());}};_0x13e187(++_0x41674a);}(_0xb10b,0x12a));var _0xbb10=function(_0xb1496a,_0x190543){_0xb1496a=_0xb1496a-0x0;var _0x301916=_0xb10b[_0xb1496a];return _0x301916;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7ffca66..196914a 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 _0x4dff=['addTags','addTagsToChatInteraction','update','Request'];(function(_0x5b4e98,_0xc3cfef){var _0x4d377e=function(_0xb69bf9){while(--_0xb69bf9){_0x5b4e98['push'](_0x5b4e98['shift']());}};_0x4d377e(++_0xc3cfef);}(_0x4dff,0xce));var _0xf4df=function(_0x37dc0e,_0x3c5543){_0x37dc0e=_0x37dc0e-0x0;var _0x21474c=_0x4dff[_0x37dc0e];return _0x21474c;};'use strict';var client=require('../client');exports[_0xf4df('0x0')]=function(_0xa3a08,_0x3008a9){return client[_0xf4df('0x1')]('UpdateChatInteraction',{'body':_0x3008a9,'options':{'where':{'id':_0xa3a08}},'log':'updateChatInteraction'});};exports[_0xf4df('0x2')]=function(_0x4bb7c5,_0x173663){return client['Request']('AddTagsToChatInteraction',{'body':_0x173663,'options':{'where':{'id':_0x4bb7c5}},'log':_0xf4df('0x3')});}; \ No newline at end of file +var _0x3d0c=['addTagsToChatInteraction','update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x4506d2,_0x20ae25){var _0x5bc054=function(_0x4099f5){while(--_0x4099f5){_0x4506d2['push'](_0x4506d2['shift']());}};_0x5bc054(++_0x20ae25);}(_0x3d0c,0x67));var _0xc3d0=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0x3d0c[_0x5400a1];return _0x4006c7;};'use strict';var client=require('../client');exports[_0xc3d0('0x0')]=function(_0x39bdc1,_0x4496e7){return client[_0xc3d0('0x1')]('UpdateChatInteraction',{'body':_0x4496e7,'options':{'where':{'id':_0x39bdc1}},'log':_0xc3d0('0x2')});};exports[_0xc3d0('0x3')]=function(_0x110e18,_0x5dfb03){return client[_0xc3d0('0x1')](_0xc3d0('0x4'),{'body':_0x5dfb03,'options':{'where':{'id':_0x110e18}},'log':_0xc3d0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 80be8a5..8482acf 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 _0xd654=['createChatMessage','../client','Request'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0xd654,0x15a));var _0x4d65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd654[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x4d65('0x0'));exports['create']=function(_0x51d656){return client[_0x4d65('0x1')]('CreateChatMessage',{'body':_0x51d656,'log':_0x4d65('0x2')});}; \ No newline at end of file +var _0xb8b8=['CreateChatMessage','Request'];(function(_0x8a6a5,_0x228364){var _0x175f85=function(_0x29dc3a){while(--_0x29dc3a){_0x8a6a5['push'](_0x8a6a5['shift']());}};_0x175f85(++_0x228364);}(_0xb8b8,0x16d));var _0x8b8b=function(_0x45c1c2,_0x302f4f){_0x45c1c2=_0x45c1c2-0x0;var _0x243166=_0xb8b8[_0x45c1c2];return _0x243166;};'use strict';var client=require('../client');exports['create']=function(_0x5d27f4){return client[_0x8b8b('0x0')](_0x8b8b('0x1'),{'body':_0x5d27f4,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f397b24..d1b89b6 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 _0xf1c6=['strategy','chatPause','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x33e3e7,_0x22d1ec){var _0x3659cd=function(_0xf61719){while(--_0xf61719){_0x33e3e7['push'](_0x33e3e7['shift']());}};_0x3659cd(++_0x22d1ec);}(_0xf1c6,0x145));var _0x6f1c=function(_0x1f2fc7,_0x13bd1f){_0x1f2fc7=_0x1f2fc7-0x0;var _0xc38166=_0xf1c6[_0x1f2fc7];return _0xc38166;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x6f1c('0x0')](_0x6f1c('0x1'),{'options':{'raw':![],'attributes':['id',_0x6f1c('0x2'),_0x6f1c('0x3'),_0x6f1c('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x6f1c('0x2'),'online',_0x6f1c('0x5')]}]},'log':_0x6f1c('0x6')});};}; \ No newline at end of file +var _0xe700=['GetChatQueue','name','timeout','strategy','User','Agents','chatPause','../client','getChatQueues','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe700,0x75));var _0x0e70=function(_0x4b5fd3,_0x33ce49){_0x4b5fd3=_0x4b5fd3-0x0;var _0x42d75e=_0xe700[_0x4b5fd3];return _0x42d75e;};'use strict';var client=require(_0x0e70('0x0'));exports[_0x0e70('0x1')]=function(){return function(){return client[_0x0e70('0x2')](_0x0e70('0x3'),{'options':{'raw':![],'attributes':['id',_0x0e70('0x4'),_0x0e70('0x5'),_0x0e70('0x6')],'include':[{'model':_0x0e70('0x7'),'as':_0x0e70('0x8'),'attributes':['id',_0x0e70('0x4'),'online',_0x0e70('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 08289d5..c0bd080 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 _0x195e=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x2b063e,_0x4d3cae){var _0x3971bb=function(_0x43e694){while(--_0x43e694){_0x2b063e['push'](_0x2b063e['shift']());}};_0x3971bb(++_0x4d3cae);}(_0x195e,0xfb));var _0xe195=function(_0xe7b04b,_0x59ea92){_0xe7b04b=_0xe7b04b-0x0;var _0x4f0cf0=_0x195e[_0xe7b04b];return _0x4f0cf0;};'use strict';var client=require(_0xe195('0x0'));exports[_0xe195('0x1')]=function(_0xb89de1){return client[_0xe195('0x2')](_0xe195('0x3'),{'body':_0xb89de1,'log':_0xe195('0x3')});};exports[_0xe195('0x4')]=function(_0x4064fd,_0x2243e9){return client[_0xe195('0x2')](_0xe195('0x5'),{'body':_0x2243e9,'options':{'where':{'uniqueid':_0x4064fd},'order':[['id',_0xe195('0x6')]],'limit':0x1},'log':_0xe195('0x5')});}; \ No newline at end of file +var _0xe148=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0xe148,0x9e));var _0x8e14=function(_0x173dd9,_0x4ecf44){_0x173dd9=_0x173dd9-0x0;var _0x5a0d5a=_0xe148[_0x173dd9];return _0x5a0d5a;};'use strict';var client=require(_0x8e14('0x0'));exports[_0x8e14('0x1')]=function(_0x57ec7c){return client[_0x8e14('0x2')](_0x8e14('0x3'),{'body':_0x57ec7c,'log':'CreateChatQueueReport'});};exports[_0x8e14('0x4')]=function(_0x234870,_0x46a514){return client[_0x8e14('0x2')]('UpdateChatQueueReport',{'body':_0x46a514,'options':{'where':{'uniqueid':_0x234870},'order':[['id','DESC']],'limit':0x1},'log':_0x8e14('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2f57d43..d5b8a53 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7a54,0x106));var _0x47a5=function(_0x272459,_0x152922){_0x272459=_0x272459-0x0;var _0x4c2168=_0x7a54[_0x272459];return _0x4c2168;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1c7e4d,_0x3476dc){var _0x5749fe=function(_0xa21c52){while(--_0xa21c52){_0x1c7e4d['push'](_0x1c7e4d['shift']());}};_0x5749fe(++_0x3476dc);}(_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 diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2795f4f..f618ddc 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 _0x0256=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x32c7cc,_0x331c49){var _0x4b4c99=function(_0x1e8008){while(--_0x1e8008){_0x32c7cc['push'](_0x32c7cc['shift']());}};_0x4b4c99(++_0x331c49);}(_0x0256,0xee));var _0x6025=function(_0xa9db74,_0x45e441){_0xa9db74=_0xa9db74-0x0;var _0x3c8d7a=_0x0256[_0xa9db74];return _0x3c8d7a;};'use strict';var client=require(_0x6025('0x0'));exports[_0x6025('0x1')]=function(_0x75e4e8){return client[_0x6025('0x2')](_0x6025('0x3'),{'body':_0x75e4e8,'log':_0x6025('0x4')});}; \ No newline at end of file +var _0x96cd=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x96cd,0x6d));var _0xd96c=function(_0x2c6d0b,_0x3c3ba4){_0x2c6d0b=_0x2c6d0b-0x0;var _0x334a45=_0x96cd[_0x2c6d0b];return _0x334a45;};'use strict';var client=require(_0xd96c('0x0'));exports[_0xd96c('0x1')]=function(_0x6023ba){return client[_0xd96c('0x2')](_0xd96c('0x3'),{'body':_0x6023ba,'log':_0xd96c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8613049..7ddd087 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 _0x46f4=['Request','name','timeout','Agents','online','getFaxQueues','../client'];(function(_0xfde4c4,_0x25831f){var _0x1f5ee4=function(_0x5f5af5){while(--_0x5f5af5){_0xfde4c4['push'](_0xfde4c4['shift']());}};_0x1f5ee4(++_0x25831f);}(_0x46f4,0x7d));var _0x446f=function(_0x4d322e,_0x475d06){_0x4d322e=_0x4d322e-0x0;var _0x2a3e5f=_0x46f4[_0x4d322e];return _0x2a3e5f;};'use strict';var client=require(_0x446f('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x446f('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x446f('0x2'),_0x446f('0x3'),'strategy'],'include':[{'model':'User','as':_0x446f('0x4'),'attributes':['id','name',_0x446f('0x5'),'faxPause']}]},'log':_0x446f('0x6')});};}; \ No newline at end of file +var _0x6f08=['name','timeout','strategy','online','faxPause','getFaxQueues','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f08,0x1cc));var _0x86f0=function(_0x1c2237,_0x4096be){_0x1c2237=_0x1c2237-0x0;var _0x28ef84=_0x6f08[_0x1c2237];return _0x28ef84;};'use strict';var client=require('../client');exports[_0x86f0('0x0')]=function(){return function(){return client[_0x86f0('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x86f0('0x2'),_0x86f0('0x3'),_0x86f0('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x86f0('0x5'),_0x86f0('0x6')]}]},'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 4fb105a..35d5c9f 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 _0x637b=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0xeadb4,_0x19523a){var _0xe86888=function(_0x46f0c3){while(--_0x46f0c3){_0xeadb4['push'](_0xeadb4['shift']());}};_0xe86888(++_0x19523a);}(_0x637b,0x1cd));var _0xb637=function(_0x51d5bc,_0x13a723){_0x51d5bc=_0x51d5bc-0x0;var _0x4cce5a=_0x637b[_0x51d5bc];return _0x4cce5a;};'use strict';var client=require(_0xb637('0x0'));exports[_0xb637('0x1')]=function(_0x329d05){return client[_0xb637('0x2')](_0xb637('0x3'),{'body':_0x329d05,'log':_0xb637('0x3')});};exports[_0xb637('0x4')]=function(_0x56378a,_0x2ef5d5){return client[_0xb637('0x2')](_0xb637('0x5'),{'body':_0x2ef5d5,'options':{'where':{'uniqueid':_0x56378a},'order':[['id',_0xb637('0x6')]],'limit':0x1},'log':_0xb637('0x5')});}; \ No newline at end of file +var _0x1c4b=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client'];(function(_0x505a10,_0x1355eb){var _0x3d0aef=function(_0x5df0ab){while(--_0x5df0ab){_0x505a10['push'](_0x505a10['shift']());}};_0x3d0aef(++_0x1355eb);}(_0x1c4b,0xa9));var _0xb1c4=function(_0x1e54a8,_0x562cc3){_0x1e54a8=_0x1e54a8-0x0;var _0x3a9b7b=_0x1c4b[_0x1e54a8];return _0x3a9b7b;};'use strict';var client=require(_0xb1c4('0x0'));exports['create']=function(_0x2d879b){return client[_0xb1c4('0x1')](_0xb1c4('0x2'),{'body':_0x2d879b,'log':_0xb1c4('0x2')});};exports[_0xb1c4('0x3')]=function(_0x3d59fc,_0x3430ff){return client['Request']('UpdateFaxQueueReport',{'body':_0x3430ff,'options':{'where':{'uniqueid':_0x3d59fc},'order':[['id','DESC']],'limit':0x1},'log':_0xb1c4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 625156f..bc00667 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 _0xe9bc=['GetInterval','name','../client','getIntervals','Request'];(function(_0x4df96c,_0x491bc3){var _0x2a701f=function(_0x491251){while(--_0x491251){_0x4df96c['push'](_0x4df96c['shift']());}};_0x2a701f(++_0x491bc3);}(_0xe9bc,0x1bf));var _0xce9b=function(_0x201d06,_0xa8c86a){_0x201d06=_0x201d06-0x0;var _0x49036e=_0xe9bc[_0x201d06];return _0x49036e;};'use strict';var client=require(_0xce9b('0x0'));exports[_0xce9b('0x1')]=function(){return function(){return client[_0xce9b('0x2')](_0xce9b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xce9b('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name','interval']}]},'log':_0xce9b('0x1')});};}; \ No newline at end of file +var _0xaa27=['interval','../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x3354eb,_0x2ff1be){var _0x5d9a84=function(_0x152596){while(--_0x152596){_0x3354eb['push'](_0x3354eb['shift']());}};_0x5d9a84(++_0x2ff1be);}(_0xaa27,0x141));var _0x7aa2=function(_0x4d5f0f,_0x52a127){_0x4d5f0f=_0x4d5f0f-0x0;var _0x400eba=_0xaa27[_0x4d5f0f];return _0x400eba;};'use strict';var client=require(_0x7aa2('0x0'));exports[_0x7aa2('0x1')]=function(){return function(){return client[_0x7aa2('0x2')](_0x7aa2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7aa2('0x4')],'include':[{'model':_0x7aa2('0x5'),'as':_0x7aa2('0x6'),'attributes':['id',_0x7aa2('0x4'),_0x7aa2('0x7')]}]},'log':_0x7aa2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 22e72bd..08c432f 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 _0x065e=['UpdateMailInteraction','updateMailInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x065e,0x1a7));var _0xe065=function(_0x4b5ae0,_0x453634){_0x4b5ae0=_0x4b5ae0-0x0;var _0xff55be=_0x065e[_0x4b5ae0];return _0xff55be;};'use strict';var client=require(_0xe065('0x0'));exports['update']=function(_0x549f09,_0x59293c){return client[_0xe065('0x1')](_0xe065('0x2'),{'body':_0x59293c,'options':{'where':{'id':_0x549f09}},'log':_0xe065('0x3')});};exports['addTags']=function(_0x4964fa,_0x4610a3){return client[_0xe065('0x1')]('AddTagsToMailInteraction',{'body':_0x4610a3,'options':{'where':{'id':_0x4964fa}},'log':_0xe065('0x4')});}; \ No newline at end of file +var _0x5f2f=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x46e39d,_0x541925){var _0x4d6f0a=function(_0x5e6b81){while(--_0x5e6b81){_0x46e39d['push'](_0x46e39d['shift']());}};_0x4d6f0a(++_0x541925);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4468ea,_0x3af88a){_0x4468ea=_0x4468ea-0x0;var _0x1e236a=_0x5f2f[_0x4468ea];return _0x1e236a;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(_0x2dcf60,_0x1a7be1){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'body':_0x1a7be1,'options':{'where':{'id':_0x2dcf60}},'log':_0xf5f2('0x4')});};exports[_0xf5f2('0x5')]=function(_0x501fbd,_0x4854b6){return client[_0xf5f2('0x2')](_0xf5f2('0x6'),{'body':_0x4854b6,'options':{'where':{'id':_0x501fbd}},'log':_0xf5f2('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 737c3f2..62cd300 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 _0x1681=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x499fb7,_0x4c698f){var _0x147631=function(_0x189977){while(--_0x189977){_0x499fb7['push'](_0x499fb7['shift']());}};_0x147631(++_0x4c698f);}(_0x1681,0x157));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1168('0x0'));exports[_0x1168('0x1')]=function(_0x101e23){return client[_0x1168('0x2')](_0x1168('0x3'),{'body':_0x101e23,'log':_0x1168('0x4')});}; \ No newline at end of file +var _0xb30e=['create','Request','CreateMailMessage','../client'];(function(_0x540051,_0x4cdc5){var _0x4dd787=function(_0x2beed5){while(--_0x2beed5){_0x540051['push'](_0x540051['shift']());}};_0x4dd787(++_0x4cdc5);}(_0xb30e,0xab));var _0xeb30=function(_0x4b7ae3,_0x5dc0c9){_0x4b7ae3=_0x4b7ae3-0x0;var _0x46d4b0=_0xb30e[_0x4b7ae3];return _0x46d4b0;};'use strict';var client=require(_0xeb30('0x0'));exports[_0xeb30('0x1')]=function(_0x3bd1c9){return client[_0xeb30('0x2')](_0xeb30('0x3'),{'body':_0x3bd1c9,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index db805fd..eb1f9df 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 _0x7785=['online','getMailQueues','Request','GetMailQueue','timeout','strategy'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x7785,0x104));var _0x5778=function(_0xb950bf,_0x79dc36){_0xb950bf=_0xb950bf-0x0;var _0x16d492=_0x7785[_0xb950bf];return _0x16d492;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x5778('0x0')](_0x5778('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x5778('0x2'),_0x5778('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x5778('0x4'),'mailPause']}]},'log':_0x5778('0x5')});};}; \ No newline at end of file +var _0xd065=['mailPause','getMailQueues','../client','timeout','strategy','User','name','online'];(function(_0xf4685d,_0x4c189c){var _0xd319d7=function(_0x3366cc){while(--_0x3366cc){_0xf4685d['push'](_0xf4685d['shift']());}};_0xd319d7(++_0x4c189c);}(_0xd065,0xe2));var _0x5d06=function(_0x1f5d7d,_0xdb1763){_0x1f5d7d=_0x1f5d7d-0x0;var _0x2d3ad1=_0xd065[_0x1f5d7d];return _0x2d3ad1;};'use strict';var client=require(_0x5d06('0x0'));exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x5d06('0x1'),_0x5d06('0x2')],'include':[{'model':_0x5d06('0x3'),'as':'Agents','attributes':['id',_0x5d06('0x4'),_0x5d06('0x5'),_0x5d06('0x6')]}]},'log':_0x5d06('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 375a2c5..614c680 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 _0x3b81=['UpdateMailQueueReport','DESC','../client','CreateMailQueueReport','update','Request'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x3b81,0x12e));var _0x13b8=function(_0x48e0c6,_0x3d6aa6){_0x48e0c6=_0x48e0c6-0x0;var _0x4355fa=_0x3b81[_0x48e0c6];return _0x4355fa;};'use strict';var client=require(_0x13b8('0x0'));exports['create']=function(_0x57438b){return client['Request'](_0x13b8('0x1'),{'body':_0x57438b,'log':_0x13b8('0x1')});};exports[_0x13b8('0x2')]=function(_0x131285,_0x13b31a){return client[_0x13b8('0x3')](_0x13b8('0x4'),{'body':_0x13b31a,'options':{'where':{'uniqueid':_0x131285},'order':[['id',_0x13b8('0x5')]],'limit':0x1},'log':_0x13b8('0x4')});}; \ No newline at end of file +var _0xee2d=['CreateMailQueueReport','DESC','../client','create','Request'];(function(_0x55512d,_0x1e4562){var _0x30b066=function(_0x50e6cb){while(--_0x50e6cb){_0x55512d['push'](_0x55512d['shift']());}};_0x30b066(++_0x1e4562);}(_0xee2d,0x174));var _0xdee2=function(_0x58c89a,_0x4cc002){_0x58c89a=_0x58c89a-0x0;var _0x30b3b7=_0xee2d[_0x58c89a];return _0x30b3b7;};'use strict';var client=require(_0xdee2('0x0'));exports[_0xdee2('0x1')]=function(_0x2b2cf3){return client[_0xdee2('0x2')](_0xdee2('0x3'),{'body':_0x2b2cf3,'log':_0xdee2('0x3')});};exports['update']=function(_0x452ad2,_0x2eedb2){return client[_0xdee2('0x2')]('UpdateMailQueueReport',{'body':_0x2eedb2,'options':{'where':{'uniqueid':_0x452ad2},'order':[['id',_0xdee2('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7b69878..aad1688 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 _0x5a4b=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x541df1,_0xa8abb1){var _0x3a9794=function(_0x577868){while(--_0x577868){_0x541df1['push'](_0x541df1['shift']());}};_0x3a9794(++_0xa8abb1);}(_0x5a4b,0xab));var _0xb5a4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5a4b[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0xb5a4('0x0'));exports['update']=function(_0xf5ba81,_0x2ffb1b){return client[_0xb5a4('0x1')](_0xb5a4('0x2'),{'body':_0x2ffb1b,'options':{'where':{'id':_0xf5ba81}},'log':_0xb5a4('0x3')});};exports[_0xb5a4('0x4')]=function(_0x46994d,_0x468ba0){return client[_0xb5a4('0x1')](_0xb5a4('0x5'),{'body':_0x468ba0,'options':{'where':{'id':_0x46994d}},'log':_0xb5a4('0x6')});}; \ No newline at end of file +var _0x0c88=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x5e3825,_0x4b3288){var _0x1374e7=function(_0x31189d){while(--_0x31189d){_0x5e3825['push'](_0x5e3825['shift']());}};_0x1374e7(++_0x4b3288);}(_0x0c88,0x1c0));var _0x80c8=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x0c88[_0x31a37b];return _0x49ae16;};'use strict';var client=require(_0x80c8('0x0'));exports['update']=function(_0x43dca9,_0x322960){return client[_0x80c8('0x1')](_0x80c8('0x2'),{'body':_0x322960,'options':{'where':{'id':_0x43dca9}},'log':_0x80c8('0x3')});};exports['addTags']=function(_0x3a3ad8,_0x5138c5){return client[_0x80c8('0x1')](_0x80c8('0x4'),{'body':_0x5138c5,'options':{'where':{'id':_0x3a3ad8}},'log':_0x80c8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8369c0e..379cba6 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 _0xa35e=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x210203,_0x223648){var _0x43ed90=function(_0x5759de){while(--_0x5759de){_0x210203['push'](_0x210203['shift']());}};_0x43ed90(++_0x223648);}(_0xa35e,0xb1));var _0xea35=function(_0x24ffba,_0x1bca4d){_0x24ffba=_0x24ffba-0x0;var _0x34c807=_0xa35e[_0x24ffba];return _0x34c807;};'use strict';var client=require('../client');exports[_0xea35('0x0')]=function(_0x3c9cd3){return client[_0xea35('0x1')](_0xea35('0x2'),{'body':_0x3c9cd3,'log':_0xea35('0x3')});}; \ No newline at end of file +var _0x5cb0=['create','createOpenchannelMessage','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5cb0,0x1eb));var _0x05cb=function(_0x291d00,_0x4263d9){_0x291d00=_0x291d00-0x0;var _0x496e20=_0x5cb0[_0x291d00];return _0x496e20;};'use strict';var client=require(_0x05cb('0x0'));exports[_0x05cb('0x1')]=function(_0x1c15fb){return client['Request']('CreateOpenchannelMessage',{'body':_0x1c15fb,'log':_0x05cb('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 41014d3..9c61eee 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 _0x753c=['User','name','online','openchannelPause','../client','getOpenchannelQueues','Request','timeout','strategy'];(function(_0xb25a0d,_0x10112e){var _0x23321a=function(_0xb53442){while(--_0xb53442){_0xb25a0d['push'](_0xb25a0d['shift']());}};_0x23321a(++_0x10112e);}(_0x753c,0x79));var _0xc753=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x753c[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0xc753('0x0'));exports[_0xc753('0x1')]=function(){return function(){return client[_0xc753('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0xc753('0x3'),_0xc753('0x4')],'include':[{'model':_0xc753('0x5'),'as':'Agents','attributes':['id',_0xc753('0x6'),_0xc753('0x7'),_0xc753('0x8')]}]},'log':_0xc753('0x1')});};}; \ No newline at end of file +var _0x8396=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x8396,0x116));var _0x6839=function(_0x51e05d,_0x51cc95){_0x51e05d=_0x51e05d-0x0;var _0x3fa70e=_0x8396[_0x51e05d];return _0x3fa70e;};'use strict';var client=require('../client');exports[_0x6839('0x0')]=function(){return function(){return client[_0x6839('0x1')](_0x6839('0x2'),{'options':{'raw':![],'attributes':['id',_0x6839('0x3'),_0x6839('0x4'),_0x6839('0x5')],'include':[{'model':_0x6839('0x6'),'as':_0x6839('0x7'),'attributes':['id',_0x6839('0x3'),_0x6839('0x8'),_0x6839('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 74210c3..e04f4c9 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 _0xc2da=['update','Request','UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport'];(function(_0x1405c1,_0x532676){var _0x59aabc=function(_0x5c4e0d){while(--_0x5c4e0d){_0x1405c1['push'](_0x1405c1['shift']());}};_0x59aabc(++_0x532676);}(_0xc2da,0x124));var _0xac2d=function(_0x16da8f,_0x4ddb80){_0x16da8f=_0x16da8f-0x0;var _0xd5dca8=_0xc2da[_0x16da8f];return _0xd5dca8;};'use strict';var client=require(_0xac2d('0x0'));exports['create']=function(_0x7f62e1){return client['Request'](_0xac2d('0x1'),{'body':_0x7f62e1,'log':'CreateOpenchannelQueueReport'});};exports[_0xac2d('0x2')]=function(_0xb261fc,_0xff0fff){return client[_0xac2d('0x3')](_0xac2d('0x4'),{'body':_0xff0fff,'options':{'where':{'uniqueid':_0xb261fc},'order':[['id',_0xac2d('0x5')]],'limit':0x1},'log':_0xac2d('0x4')});}; \ No newline at end of file +var _0xdd99=['update','Request','UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport'];(function(_0x25d7a4,_0x2809bd){var _0xa9406b=function(_0x2c7244){while(--_0x2c7244){_0x25d7a4['push'](_0x25d7a4['shift']());}};_0xa9406b(++_0x2809bd);}(_0xdd99,0x146));var _0x9dd9=function(_0x283ca3,_0x2e3d02){_0x283ca3=_0x283ca3-0x0;var _0x4d3bb9=_0xdd99[_0x283ca3];return _0x4d3bb9;};'use strict';var client=require(_0x9dd9('0x0'));exports[_0x9dd9('0x1')]=function(_0x2dbbdd){return client['Request'](_0x9dd9('0x2'),{'body':_0x2dbbdd,'log':'CreateOpenchannelQueueReport'});};exports[_0x9dd9('0x3')]=function(_0x315ac0,_0x5e7d3c){return client[_0x9dd9('0x4')](_0x9dd9('0x5'),{'body':_0x5e7d3c,'options':{'where':{'uniqueid':_0x315ac0},'order':[['id',_0x9dd9('0x6')]],'limit':0x1},'log':_0x9dd9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e12326b..b5cd8f7 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 _0x4006=['Request','addTags','addTagsToSmsInteraction','update'];(function(_0xc02c39,_0x24a0fc){var _0x3068ae=function(_0x51c59){while(--_0x51c59){_0xc02c39['push'](_0xc02c39['shift']());}};_0x3068ae(++_0x24a0fc);}(_0x4006,0x1c7));var _0x6400=function(_0x981602,_0x261528){_0x981602=_0x981602-0x0;var _0x116340=_0x4006[_0x981602];return _0x116340;};'use strict';var client=require('../client');exports[_0x6400('0x0')]=function(_0x8c4e44,_0x100215){return client[_0x6400('0x1')]('UpdateSmsInteraction',{'body':_0x100215,'options':{'where':{'id':_0x8c4e44}},'log':'updateSmsInteraction'});};exports[_0x6400('0x2')]=function(_0x4b0418,_0xd858df){return client['Request']('AddTagsToSmsInteraction',{'body':_0xd858df,'options':{'where':{'id':_0x4b0418}},'log':_0x6400('0x3')});}; \ No newline at end of file +var _0xf2cb=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x54bee3,_0xbde47e){var _0x43c571=function(_0x16280a){while(--_0x16280a){_0x54bee3['push'](_0x54bee3['shift']());}};_0x43c571(++_0xbde47e);}(_0xf2cb,0x130));var _0xbf2c=function(_0x15833e,_0x58a046){_0x15833e=_0x15833e-0x0;var _0x5c4745=_0xf2cb[_0x15833e];return _0x5c4745;};'use strict';var client=require('../client');exports[_0xbf2c('0x0')]=function(_0x5e5c76,_0x15aa19){return client['Request'](_0xbf2c('0x1'),{'body':_0x15aa19,'options':{'where':{'id':_0x5e5c76}},'log':'updateSmsInteraction'});};exports[_0xbf2c('0x2')]=function(_0x41c649,_0x5abeb3){return client['Request'](_0xbf2c('0x3'),{'body':_0x5abeb3,'options':{'where':{'id':_0x41c649}},'log':_0xbf2c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3d9e309..4943732 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 _0xa9ee=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x280a01,_0x5c6d2f){var _0x3d6e53=function(_0x4c3fc2){while(--_0x4c3fc2){_0x280a01['push'](_0x280a01['shift']());}};_0x3d6e53(++_0x5c6d2f);}(_0xa9ee,0x136));var _0xea9e=function(_0x369f14,_0x361799){_0x369f14=_0x369f14-0x0;var _0x59fc6c=_0xa9ee[_0x369f14];return _0x59fc6c;};'use strict';var client=require(_0xea9e('0x0'));exports[_0xea9e('0x1')]=function(_0x9996f2){return client[_0xea9e('0x2')](_0xea9e('0x3'),{'body':_0x9996f2,'log':_0xea9e('0x4')});}; \ No newline at end of file +var _0x075c=['CreateSmsMessage','create','Request'];(function(_0x2e3416,_0x5073f4){var _0x1749ff=function(_0x3322d1){while(--_0x3322d1){_0x2e3416['push'](_0x2e3416['shift']());}};_0x1749ff(++_0x5073f4);}(_0x075c,0x7c));var _0xc075=function(_0x1f5422,_0x133b3f){_0x1f5422=_0x1f5422-0x0;var _0x2e9c5b=_0x075c[_0x1f5422];return _0x2e9c5b;};'use strict';var client=require('../client');exports[_0xc075('0x0')]=function(_0x379e61){return client[_0xc075('0x1')](_0xc075('0x2'),{'body':_0x379e61,'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 3a8f76e..459deb2 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x5ef6a2,_0x19c424){var _0x4aa800=function(_0x494a5d){while(--_0x494a5d){_0x5ef6a2['push'](_0x5ef6a2['shift']());}};_0x4aa800(++_0x19c424);}(_0x70e0,0x17b));var _0x070e=function(_0x4ea6cb,_0x168e09){_0x4ea6cb=_0x4ea6cb-0x0;var _0xc5d865=_0x70e0[_0x4ea6cb];return _0xc5d865;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7aeb807..70931b8 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4470b9,_0x1d8578){var _0x14f405=function(_0x12801b){while(--_0x12801b){_0x4470b9['push'](_0x4470b9['shift']());}};_0x14f405(++_0x1d8578);}(_0x70e0,0x17b));var _0x070e=function(_0x4b955e,_0x4e0f56){_0x4b955e=_0x4b955e-0x0;var _0x930d2=_0x70e0[_0x4b955e];return _0x930d2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x245a00,_0x49b273){var _0x27f418=function(_0x263f15){while(--_0x263f15){_0x245a00['push'](_0x245a00['shift']());}};_0x27f418(++_0x49b273);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5cc2daa..aab6fa7 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(_0x47c521,_0x4de4bf){var _0xd7a34c=function(_0x52e68e){while(--_0x52e68e){_0x47c521['push'](_0x47c521['shift']());}};_0xd7a34c(++_0x4de4bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x311a90,_0x3a7313){var _0x1853b7=function(_0x39ec8a){while(--_0x39ec8a){_0x311a90['push'](_0x311a90['shift']());}};_0x1853b7(++_0x3a7313);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 0ea04e3..b16b8ec 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 _0xb242=['AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5c1449,_0x2af4b4){var _0x270473=function(_0x1461b6){while(--_0x1461b6){_0x5c1449['push'](_0x5c1449['shift']());}};_0x270473(++_0x2af4b4);}(_0xb242,0x1f3));var _0x2b24=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0xb242[_0x555069];return _0x100af7;};'use strict';var client=require('../client');exports[_0x2b24('0x0')]=function(_0x151da4,_0x1b9fbb){return client[_0x2b24('0x1')](_0x2b24('0x2'),{'body':_0x1b9fbb,'options':{'where':{'id':_0x151da4}},'log':_0x2b24('0x3')});};exports[_0x2b24('0x4')]=function(_0x481806,_0x494b43){return client[_0x2b24('0x1')](_0x2b24('0x5'),{'body':_0x494b43,'options':{'where':{'id':_0x481806}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x565e=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','addTags'];(function(_0x345d07,_0x22e202){var _0x39cdb1=function(_0x539cfe){while(--_0x539cfe){_0x345d07['push'](_0x345d07['shift']());}};_0x39cdb1(++_0x22e202);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe565('0x0'));exports['update']=function(_0x19090f,_0x1a2449){return client[_0xe565('0x1')]('UpdateWhatsappInteraction',{'body':_0x1a2449,'options':{'where':{'id':_0x19090f}},'log':'updateWhatsappInteraction'});};exports[_0xe565('0x2')]=function(_0x33fd83,_0x14f472){return client[_0xe565('0x1')](_0xe565('0x3'),{'body':_0x14f472,'options':{'where':{'id':_0x33fd83}},'log':_0xe565('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ea0cfc1..9b3f998 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 _0xdd62=['CreateWhatsappMessage','../client','create'];(function(_0xae4d8b,_0x4fa554){var _0x4006f5=function(_0x561d5c){while(--_0x561d5c){_0xae4d8b['push'](_0xae4d8b['shift']());}};_0x4006f5(++_0x4fa554);}(_0xdd62,0x70));var _0x2dd6=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xdd62[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0x2dd6('0x0'));exports[_0x2dd6('0x1')]=function(_0x221f73){return client['Request'](_0x2dd6('0x2'),{'body':_0x221f73,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x6e5c=['createWhatsappMessage','../client','CreateWhatsappMessage'];(function(_0x1c1555,_0x127b18){var _0x4c8d9d=function(_0x3c96a8){while(--_0x3c96a8){_0x1c1555['push'](_0x1c1555['shift']());}};_0x4c8d9d(++_0x127b18);}(_0x6e5c,0x64));var _0xc6e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e5c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc6e5('0x0'));exports['create']=function(_0x2a3543){return client['Request'](_0xc6e5('0x1'),{'body':_0x2a3543,'log':_0xc6e5('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 729dfb9..b9f22e5 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 _0x140a=['online','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout'];(function(_0x258e10,_0x2a7a7b){var _0x41b865=function(_0x3d0d07){while(--_0x3d0d07){_0x258e10['push'](_0x258e10['shift']());}};_0x41b865(++_0x2a7a7b);}(_0x140a,0x122));var _0xa140=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x140a[_0x59c301];return _0x3866b9;};'use strict';var client=require(_0xa140('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xa140('0x1'),{'options':{'raw':![],'attributes':['id',_0xa140('0x2'),_0xa140('0x3'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xa140('0x4'),_0xa140('0x5')]}]},'log':_0xa140('0x6')});};}; \ No newline at end of file +var _0x2eeb=['timeout','strategy','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x280c4b,_0xfe785d){var _0x2a5e90=function(_0x37db79){while(--_0x37db79){_0x280c4b['push'](_0x280c4b['shift']());}};_0x2a5e90(++_0xfe785d);}(_0x2eeb,0x1a1));var _0xb2ee=function(_0xe742b8,_0xd36da7){_0xe742b8=_0xe742b8-0x0;var _0x211c7a=_0x2eeb[_0xe742b8];return _0x211c7a;};'use strict';var client=require('../client');exports[_0xb2ee('0x0')]=function(){return function(){return client['Request'](_0xb2ee('0x1'),{'options':{'raw':![],'attributes':['id',_0xb2ee('0x2'),_0xb2ee('0x3'),_0xb2ee('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xb2ee('0x2'),_0xb2ee('0x5'),_0xb2ee('0x6')]}]},'log':_0xb2ee('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 19b0ed6..7c6e191 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 _0x8288=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x8288,0xbe));var _0x8828=function(_0x294ad5,_0x35f37d){_0x294ad5=_0x294ad5-0x0;var _0x4bc1a2=_0x8288[_0x294ad5];return _0x4bc1a2;};'use strict';var client=require(_0x8828('0x0'));exports[_0x8828('0x1')]=function(_0x935584){return client[_0x8828('0x2')](_0x8828('0x3'),{'body':_0x935584,'log':'CreateWhatsappQueueReport'});};exports[_0x8828('0x4')]=function(_0x4f2b8b,_0x2c168b){return client[_0x8828('0x2')](_0x8828('0x5'),{'body':_0x2c168b,'options':{'where':{'uniqueid':_0x4f2b8b},'order':[['id',_0x8828('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x9581=['Request','CreateWhatsappQueueReport','update','../client'];(function(_0x54893d,_0x72f441){var _0x3324fb=function(_0x2d744a){while(--_0x2d744a){_0x54893d['push'](_0x54893d['shift']());}};_0x3324fb(++_0x72f441);}(_0x9581,0x19f));var _0x1958=function(_0x3fc1dc,_0x19e1c5){_0x3fc1dc=_0x3fc1dc-0x0;var _0x146a45=_0x9581[_0x3fc1dc];return _0x146a45;};'use strict';var client=require(_0x1958('0x0'));exports['create']=function(_0x2db49b){return client[_0x1958('0x1')](_0x1958('0x2'),{'body':_0x2db49b,'log':_0x1958('0x2')});};exports[_0x1958('0x3')]=function(_0x1c5566,_0x19b53f){return client[_0x1958('0x1')]('UpdateWhatsappQueueReport',{'body':_0x19b53f,'options':{'where':{'uniqueid':_0x1c5566},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index cfd8756..ecb0ddf 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 _0x90c7=['info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','channel','format','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x42334c,_0x379771){var _0x4feed7=function(_0x1a8786){while(--_0x1a8786){_0x42334c['push'](_0x42334c['shift']());}};_0x4feed7(++_0x379771);}(_0x90c7,0x19c));var _0x790c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x90c7[_0x501510];return _0x1e6ee5;};'use strict';var schema=require(_0x790c('0x0'));var _=require(_0x790c('0x1'));var util=require(_0x790c('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x790c('0x3'));var queue=schema({'name':{'type':_0x790c('0x4'),'required':!![],'message':_0x790c('0x5')},'timeout':{'type':_0x790c('0x6'),'message':_0x790c('0x7')}});function writeLog(_0x3b870f,_0x1871a1,_0x302a57){return logger[_0x790c('0x8')](util['format'](_0x790c('0x9'),_0x3b870f,_0x1871a1[_0x790c('0xa')],_0x302a57));}function handleFindAgent(_0xd991ab){return function(_0x36f0fb){return _0x36f0fb['name'][_0x790c('0xb')]()===_0xd991ab[_0x790c('0xb')]();};}exports[_0x790c('0xc')]=function(_0x3c2155,_0x4610b0,_0x24a317,_0x578653){return function(_0x281c48){try{var _0x1b9b1e={'name':_0x4610b0[0x0],'timeout':_0x4610b0[0x1]};var _0x541264=queue[_0x790c('0x0')](_0x1b9b1e,{'typecast':!![]});if(_0x541264[_0x790c('0xd')]){logger[_0x790c('0xe')](_0x790c('0xf'),_0x3c2155,_['map'](_0x541264,_0x790c('0x10'))[_0x790c('0x11')](',\x20'));_0x281c48[_0x790c('0x12')]();}else{var _0x45a0a5=_[_0x790c('0x13')](_0x24a317[_0x790c('0x14')],handleFindAgent(_0x1b9b1e[_0x790c('0xa')]));if(_0x45a0a5){var _0x4c8d58=(_0x1b9b1e[_0x790c('0x15')]||0xa)*0x3e8;var _0x500001,_0x32475a;var _0x3e0828=seqqueue[_0x790c('0x16')](_0x4c8d58);_0x3e0828['id']=_0x3c2155;_0x3e0828['atimeout']=_0x4c8d58;_0x3e0828[_0x790c('0x17')]=_0x578653[_0x790c('0x17')];writeLog(_0x3c2155,_0x45a0a5,util[_0x790c('0x18')]('START:%s',_0x4c8d58));_0x24a317[_0x790c('0x19')][_0x3c2155]['on'](_0x790c('0x1a'),function(){logger[_0x790c('0x8')](_0x790c('0x1b'),_0x3c2155);clearTimeout(_0x32475a);_0x32475a=undefined;_0x3e0828[_0x790c('0x1c')]();if(_0x24a317[_0x790c('0x19')][_0x3c2155]){delete _0x24a317[_0x790c('0x19')][_0x3c2155];}_0x281c48[_0x790c('0x12')]();});_0x24a317[_0x790c('0x19')][_0x3c2155]['on'](_0x790c('0x1d'),function(){if(_0x24a317[_0x790c('0x19')][_0x3c2155]){delete _0x24a317[_0x790c('0x19')][_0x3c2155];}});_0x32475a=setTimeout(function(){logger[_0x790c('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x3c2155);clearTimeout(_0x32475a);_0x3e0828[_0x790c('0x1c')]();_0x281c48[_0x790c('0x1e')]();},_0x4c8d58);strategy[_0x790c('0x1f')](_0x3e0828,_0x45a0a5,_0x24a317,_0x578653);}else{logger[_0x790c('0xe')](_0x790c('0x20'),_0x3c2155,_0x1b9b1e[_0x790c('0xa')]);_0x281c48['stop']();}}}catch(_0x1e9a80){console['log'](_0x1e9a80);logger[_0x790c('0xe')](_0x790c('0x21'),_0x3c2155,_0x1e9a80[_0x790c('0x22')]);_0x281c48['stop']();}};}; \ No newline at end of file +var _0x874b=['channel','START:%s','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','createQueue'];(function(_0x498c78,_0x2eab48){var _0xb7697f=function(_0x1f6da7){while(--_0x1f6da7){_0x498c78['push'](_0x498c78['shift']());}};_0xb7697f(++_0x2eab48);}(_0x874b,0x196));var _0xb874=function(_0x45cccb,_0x180f00){_0x45cccb=_0x45cccb-0x0;var _0x18bc60=_0x874b[_0x45cccb];return _0x18bc60;};'use strict';var schema=require('validate');var _=require(_0xb874('0x0'));var util=require(_0xb874('0x1'));var seqqueue=require(_0xb874('0x2'));var logger=require(_0xb874('0x3'))(_0xb874('0x4'));var strategy=require(_0xb874('0x5'));var queue=schema({'name':{'type':_0xb874('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xb874('0x7')}});function writeLog(_0x539a17,_0x1d980f,_0x4e7c0c){return logger[_0xb874('0x8')](util[_0xb874('0x9')](_0xb874('0xa'),_0x539a17,_0x1d980f[_0xb874('0xb')],_0x4e7c0c));}function handleFindAgent(_0x183426){return function(_0x1efac8){return _0x1efac8['name'][_0xb874('0xc')]()===_0x183426['toLowerCase']();};}exports['consequence']=function(_0x43483e,_0x19d443,_0x1c7a6e,_0x5cc130){return function(_0x57bf8b){try{var _0x1de0a7={'name':_0x19d443[0x0],'timeout':_0x19d443[0x1]};var _0x15a43d=queue[_0xb874('0xd')](_0x1de0a7,{'typecast':!![]});if(_0x15a43d[_0xb874('0xe')]){logger[_0xb874('0xf')](_0xb874('0x10'),_0x43483e,_[_0xb874('0x11')](_0x15a43d,_0xb874('0x12'))[_0xb874('0x13')](',\x20'));_0x57bf8b[_0xb874('0x14')]();}else{var _0x5719d9=_[_0xb874('0x15')](_0x1c7a6e['agents'],handleFindAgent(_0x1de0a7['name']));if(_0x5719d9){var _0x17d1c7=(_0x1de0a7['timeout']||0xa)*0x3e8;var _0x4bc8b0,_0x43f879;var _0x22fcae=seqqueue[_0xb874('0x16')](_0x17d1c7);_0x22fcae['id']=_0x43483e;_0x22fcae['atimeout']=_0x17d1c7;_0x22fcae['channel']=_0x5cc130[_0xb874('0x17')];writeLog(_0x43483e,_0x5719d9,util[_0xb874('0x9')](_0xb874('0x18'),_0x17d1c7));_0x1c7a6e[_0xb874('0x19')][_0x43483e]['on']('end',function(){logger[_0xb874('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x43483e);clearTimeout(_0x43f879);_0x43f879=undefined;_0x22fcae['close']();if(_0x1c7a6e[_0xb874('0x19')][_0x43483e]){delete _0x1c7a6e[_0xb874('0x19')][_0x43483e];}_0x57bf8b[_0xb874('0x14')]();});_0x1c7a6e[_0xb874('0x19')][_0x43483e]['on'](_0xb874('0x1a'),function(){if(_0x1c7a6e['rules'][_0x43483e]){delete _0x1c7a6e['rules'][_0x43483e];}});_0x43f879=setTimeout(function(){logger[_0xb874('0x8')](_0xb874('0x1b'),_0x43483e);clearTimeout(_0x43f879);_0x22fcae['close']();_0x57bf8b[_0xb874('0x1c')]();},_0x17d1c7);strategy[_0xb874('0x1d')](_0x22fcae,_0x5719d9,_0x1c7a6e,_0x5cc130);}else{logger[_0xb874('0xf')](_0xb874('0x1e'),_0x43483e,_0x1de0a7[_0xb874('0xb')]);_0x57bf8b[_0xb874('0x14')]();}}}catch(_0x3658cc){console[_0xb874('0x1f')](_0x3658cc);logger[_0xb874('0xf')]('[%s][QUEUE]\x20%s',_0x43483e,_0x3658cc[_0xb874('0x20')]);_0x57bf8b[_0xb874('0x14')]();}};}; \ 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 ebcb40e..e5cac89 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 _0x6b1f=['next','amazonlex','providerResponse','Failed','catch','error','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','postText','message'];(function(_0x2a06b5,_0x2d8799){var _0x11771b=function(_0x333add){while(--_0x333add){_0x2a06b5['push'](_0x2a06b5['shift']());}};_0x11771b(++_0x2d8799);}(_0x6b1f,0x8a));var _0xf6b1=function(_0x1fb4e5,_0x19f7cb){_0x1fb4e5=_0x1fb4e5-0x0;var _0x190a26=_0x6b1f[_0x1fb4e5];return _0x190a26;};'use strict';var _=require(_0xf6b1('0x0'));var moment=require(_0xf6b1('0x1'));var AWS=require(_0xf6b1('0x2'));var utils=require('./utils');var logger=require(_0xf6b1('0x3'))(_0xf6b1('0x4'));var rpc={'chatMessage':require(_0xf6b1('0x5')),'openchannelMessage':require(_0xf6b1('0x6')),'mailMessage':require(_0xf6b1('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf6b1('0x8')),'whatsappMessage':require(_0xf6b1('0x9'))};exports['consequence']=function(_0x382c82,_0x361921){return function(_0x53cb1f){try{if(!_[_0xf6b1('0xa')](this[_0xf6b1('0xb')]['UserId'])){logger['info'](_0xf6b1('0xc'),_0x382c82,_0xf6b1('0xd'));return _0x53cb1f['next']();}var _0x4e361c={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xf6b1('0xe')),'direction':_0xf6b1('0xf')};if(this[_0xf6b1('0x10')]==='sms'||this['channel']===_0xf6b1('0x11')){_0x4e361c['phone']=this[_0xf6b1('0xb')]['phone'];}var _0x2d0338=this[_0xf6b1('0x10')];if(_0x2d0338===_0xf6b1('0x12')){_0x4e361c[_0xf6b1('0x13')]=this[_0xf6b1('0x14')]['id'];}else{_0x4e361c[_[_0xf6b1('0x15')](_0x2d0338)+_0xf6b1('0x16')]=this['account']['id'];}_0x4e361c[_[_0xf6b1('0x15')](_0x2d0338)+_0xf6b1('0x17')]=this[_0xf6b1('0xb')]['id'];if(this[_0xf6b1('0xb')][_0xf6b1('0x18')]){var _0x345eef=_0x361921[0x4];if(!_[_0xf6b1('0x19')](_0x345eef)){_0x4e361c[_0xf6b1('0x1a')]=utils[_0xf6b1('0x1b')](_0x345eef,this);return rpc[_0x2d0338+_0xf6b1('0x1c')][_0xf6b1('0x1d')](_0x4e361c)[_0xf6b1('0x1e')](function(_0x28917e){logger[_0xf6b1('0x1f')](_0xf6b1('0xc'),_0x382c82,_0x4e361c[_0xf6b1('0x1a')]);})['catch'](function(_0x58f3cd){logger['error'](_0xf6b1('0xc'),_0x382c82,JSON[_0xf6b1('0x20')](_0x58f3cd));})[_0xf6b1('0x21')](function(){logger[_0xf6b1('0x1f')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x382c82);_0x53cb1f[_0xf6b1('0x22')]();});}else{logger[_0xf6b1('0x1f')](_0xf6b1('0x23'),_0x382c82);_0x53cb1f[_0xf6b1('0x22')]();}}else{var _0x30ed05=this;var _0x4322c3=new AWS['LexRuntime']({'accessKeyId':_0x361921[0x0],'secretAccessKey':_0x361921[0x1],'region':_0x361921[0x2]});var _0x3acca1={'botAlias':'$LATEST','botName':_0x361921[0x3],'inputText':this['message'][_0xf6b1('0x1a')],'userId':this[_0xf6b1('0x10')]+':'+this[_0xf6b1('0xb')]['id']['toString']()};_0x4322c3[_0xf6b1('0x24')](_0x3acca1,function(_0x25d241,_0xd7f01e){if(_0x25d241){logger['error'](_0xf6b1('0xc'),_0x382c82,_0x25d241[_0xf6b1('0x25')]);_0x53cb1f[_0xf6b1('0x26')]();}else if(_0xd7f01e&&_0xd7f01e[_0xf6b1('0x25')]){_0x30ed05['body'][_0xf6b1('0x27')]=_0xd7f01e;_0x4e361c[_0xf6b1('0x1a')]=_0xd7f01e['message'];_0x4e361c['providerName']=_0xf6b1('0x27');_0x4e361c[_0xf6b1('0x28')]=JSON['stringify'](_0xd7f01e);return rpc[_0x2d0338+'Message'][_0xf6b1('0x1d')](_0x4e361c)[_0xf6b1('0x1e')](function(_0x1accff){logger['info'](_0xf6b1('0xc'),_0x382c82,_0x4e361c['body']);if(_0xd7f01e['dialogState']==_0xf6b1('0x29')){_0x53cb1f['next']();}else{_0x53cb1f[_0xf6b1('0x22')]();}})[_0xf6b1('0x2a')](function(_0x2e15fb){logger[_0xf6b1('0x2b')]('[%s][AMAZONLEX]\x20%s',_0x382c82,JSON[_0xf6b1('0x20')](_0x2e15fb));_0x53cb1f[_0xf6b1('0x26')]();});}else{_0x53cb1f[_0xf6b1('0x26')]();}});}}catch(_0xba05bb){logger['error'](_0xf6b1('0xc'),_0x382c82,JSON[_0xf6b1('0x20')](_0xba05bb));_0x53cb1f[_0xf6b1('0x22')]();}};}; \ No newline at end of file +var _0x2261=['account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','then','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','next','providerName','amazonlex','providerResponse','dialogState','Failed','catch','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.','contact','format','out','channel','phone','chat','ChatWebsiteId'];(function(_0x16736c,_0x844e4){var _0x7170f3=function(_0x418bdb){while(--_0x418bdb){_0x16736c['push'](_0x16736c['shift']());}};_0x7170f3(++_0x844e4);}(_0x2261,0x124));var _0x1226=function(_0x50fb66,_0x5191a0){_0x50fb66=_0x50fb66-0x0;var _0x561ed4=_0x2261[_0x50fb66];return _0x561ed4;};'use strict';var _=require(_0x1226('0x0'));var moment=require(_0x1226('0x1'));var AWS=require(_0x1226('0x2'));var utils=require(_0x1226('0x3'));var logger=require(_0x1226('0x4'))(_0x1226('0x5'));var rpc={'chatMessage':require(_0x1226('0x6')),'openchannelMessage':require(_0x1226('0x7')),'mailMessage':require(_0x1226('0x8')),'smsMessage':require(_0x1226('0x9')),'faxMessage':require(_0x1226('0xa')),'whatsappMessage':require(_0x1226('0xb'))};exports[_0x1226('0xc')]=function(_0x1e4646,_0x2de5f2){return function(_0x5e9c92){try{if(!_[_0x1226('0xd')](this[_0x1226('0xe')][_0x1226('0xf')])){logger[_0x1226('0x10')](_0x1226('0x11'),_0x1e4646,_0x1226('0x12'));return _0x5e9c92['next']();}var _0x1107d5={'ContactId':this[_0x1226('0x13')]['id'],'sentAt':moment()[_0x1226('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1226('0x15')};if(this[_0x1226('0x16')]==='sms'||this[_0x1226('0x16')]==='whatsapp'){_0x1107d5['phone']=this[_0x1226('0xe')][_0x1226('0x17')];}var _0x264fa0=this[_0x1226('0x16')];if(_0x264fa0===_0x1226('0x18')){_0x1107d5[_0x1226('0x19')]=this[_0x1226('0x1a')]['id'];}else{_0x1107d5[_[_0x1226('0x1b')](_0x264fa0)+_0x1226('0x1c')]=this[_0x1226('0x1a')]['id'];}_0x1107d5[_['upperFirst'](_0x264fa0)+_0x1226('0x1d')]=this[_0x1226('0xe')]['id'];if(this[_0x1226('0xe')][_0x1226('0x1e')]){var _0x5d14b3=_0x2de5f2[0x4];if(!_['isEmpty'](_0x5d14b3)){_0x1107d5['body']=utils[_0x1226('0x1f')](_0x5d14b3,this);return rpc[_0x264fa0+_0x1226('0x20')][_0x1226('0x21')](_0x1107d5)[_0x1226('0x22')](function(_0xbf75d4){logger['info'](_0x1226('0x11'),_0x1e4646,_0x1107d5[_0x1226('0x23')]);})['catch'](function(_0x42624c){logger[_0x1226('0x24')](_0x1226('0x11'),_0x1e4646,JSON[_0x1226('0x25')](_0x42624c));})[_0x1226('0x26')](function(){logger[_0x1226('0x10')](_0x1226('0x27'),_0x1e4646);_0x5e9c92['stop']();});}else{logger[_0x1226('0x10')](_0x1226('0x28'),_0x1e4646);_0x5e9c92[_0x1226('0x29')]();}}else{var _0x59f344=this;var _0x8ea8a6=new AWS[(_0x1226('0x2a'))]({'accessKeyId':_0x2de5f2[0x0],'secretAccessKey':_0x2de5f2[0x1],'region':_0x2de5f2[0x2]});var _0x3573b7={'botAlias':_0x1226('0x2b'),'botName':_0x2de5f2[0x3],'inputText':this[_0x1226('0x2c')][_0x1226('0x23')],'userId':this[_0x1226('0x16')]+':'+this['interaction']['id'][_0x1226('0x2d')]()};_0x8ea8a6['postText'](_0x3573b7,function(_0x2ee591,_0x3b7882){if(_0x2ee591){logger['error'](_0x1226('0x11'),_0x1e4646,_0x2ee591[_0x1226('0x2c')]);_0x5e9c92[_0x1226('0x2e')]();}else if(_0x3b7882&&_0x3b7882[_0x1226('0x2c')]){_0x59f344[_0x1226('0x23')]['amazonlex']=_0x3b7882;_0x1107d5[_0x1226('0x23')]=_0x3b7882['message'];_0x1107d5[_0x1226('0x2f')]=_0x1226('0x30');_0x1107d5[_0x1226('0x31')]=JSON['stringify'](_0x3b7882);return rpc[_0x264fa0+_0x1226('0x20')][_0x1226('0x21')](_0x1107d5)[_0x1226('0x22')](function(_0x3f239e){logger[_0x1226('0x10')]('[%s][AMAZONLEX]\x20%s',_0x1e4646,_0x1107d5[_0x1226('0x23')]);if(_0x3b7882[_0x1226('0x32')]==_0x1226('0x33')){_0x5e9c92[_0x1226('0x2e')]();}else{_0x5e9c92[_0x1226('0x29')]();}})[_0x1226('0x34')](function(_0x58a58d){logger['error'](_0x1226('0x11'),_0x1e4646,JSON['stringify'](_0x58a58d));_0x5e9c92[_0x1226('0x2e')]();});}else{_0x5e9c92[_0x1226('0x2e')]();}});}}catch(_0x26d48a){logger['error'](_0x1226('0x11'),_0x1e4646,JSON['stringify'](_0x26d48a));_0x5e9c92[_0x1226('0x29')]();}};}; \ 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 15396f2..02feb8e 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 _0xf805=['sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','create','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','';_0x1a94a0[_0x5f80('0x3c')]={'Auto-Submitted':_0x5f80('0x3d'),'X-Auto-Response-Suppress':_0x5f80('0x3e'),'Precedence':_0x5f80('0x3f')};return mailRpc[_0x5f80('0x40')](_0x5a7643,_0x1a94a0)[_0x5f80('0x41')](function(_0x1b135f){logger[_0x5f80('0x12')](_0x5f80('0x42'),_0x5a56cd);_0x1a94a0[_0x5f80('0x36')]=_0x1b135f[_0x5f80('0x20')]['messageId'];return rpc[_0x36f4bc+_0x5f80('0x2c')]['create'](_0x1a94a0);})[_0x5f80('0x41')](function(_0x1068b8){logger[_0x5f80('0x12')](_0x5f80('0x13'),_0x5a56cd,JSON['stringify'](_0x1068b8));})[_0x5f80('0x43')](function(_0x17101f){logger[_0x5f80('0x44')](_0x5f80('0x45'),_0x5a56cd,JSON[_0x5f80('0x46')](_0x17101f));})[_0x5f80('0x47')](function(){Promise[_0x5f80('0x48')]()['then'](function(){if(_0x3bbab8[0x0]!=='2'||_0x2fb60d[_0x5f80('0x19')])return;return rpc[_0x36f4bc+_0x5f80('0x49')][_0x5f80('0x4a')](_0x2fb60d['id'],{'autoreplyExecuted':!![]})[_0x5f80('0x41')](function(_0x22ec2f){logger[_0x5f80('0x12')](_0x5f80('0x1a'),_0x5a56cd,JSON['stringify'](_0x22ec2f));})[_0x5f80('0x43')](function(_0x2cd493){logger[_0x5f80('0x44')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5a56cd,JSON['stringify'](_0x2cd493));});})[_0x5f80('0x41')](function(){_0x41ad22['next']();});});}else{return rpc[this['channel']+_0x5f80('0x2c')][_0x5f80('0x4b')](_0x1a94a0)[_0x5f80('0x41')](function(_0x3920ac){logger[_0x5f80('0x12')](_0x5f80('0x13'),_0x5a56cd,_0x1a94a0['body']);})[_0x5f80('0x43')](function(_0x5d969f){logger[_0x5f80('0x44')]('[%s][AUTOREPLY]\x20%s',_0x5a56cd,JSON['stringify'](_0x5d969f));})[_0x5f80('0x47')](function(){Promise[_0x5f80('0x48')]()[_0x5f80('0x41')](function(){if(_0x3bbab8[0x0]!=='2'||_0x2fb60d[_0x5f80('0x19')])return;return rpc[_0x36f4bc+_0x5f80('0x49')][_0x5f80('0x4a')](_0x2fb60d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4203f0){logger['info'](_0x5f80('0x1a'),_0x5a56cd,JSON[_0x5f80('0x46')](_0x4203f0));})[_0x5f80('0x43')](function(_0xc355dc){logger[_0x5f80('0x44')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5a56cd,JSON['stringify'](_0xc355dc));});})[_0x5f80('0x41')](function(){_0x41ad22['next']();});});}}}catch(_0x3e4048){logger[_0x5f80('0x44')]('[%s][AUTOREPLY]\x20%s',_0x5a56cd,JSON[_0x5f80('0x46')](_0x3e4048));_0x41ad22[_0x5f80('0x4c')]();}};}; \ No newline at end of file +var _0xc097=['../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','html','','replace','';_0x3b0a12['headers']={'Auto-Submitted':_0x7c09('0x39'),'X-Auto-Response-Suppress':_0x7c09('0x3a'),'Precedence':'auto_reply'};return mailRpc[_0x7c09('0x3b')](_0x577718,_0x3b0a12)['then'](function(_0x49ff97){logger[_0x7c09('0x12')](_0x7c09('0x3c'),_0x51a34e);_0x3b0a12[_0x7c09('0x3d')]=_0x49ff97[_0x7c09('0x1e')]['messageId'];return rpc[_0x40f8c4+'Message'][_0x7c09('0x3e')](_0x3b0a12);})[_0x7c09('0x3f')](function(_0x4b177c){logger[_0x7c09('0x12')]('[%s][AUTOREPLY]\x20%s',_0x51a34e,JSON['stringify'](_0x4b177c));})[_0x7c09('0x40')](function(_0x1c00f9){logger['error'](_0x7c09('0x41'),_0x51a34e,JSON['stringify'](_0x1c00f9));})[_0x7c09('0x42')](function(){Promise[_0x7c09('0x43')]()[_0x7c09('0x3f')](function(){if(_0x3479af[0x0]!=='2'||_0xb8ec9[_0x7c09('0x44')])return;return rpc[_0x40f8c4+_0x7c09('0x45')]['update'](_0xb8ec9['id'],{'autoreplyExecuted':!![]})[_0x7c09('0x3f')](function(_0x396fbd){logger['info'](_0x7c09('0x46'),_0x51a34e,JSON['stringify'](_0x396fbd));})[_0x7c09('0x40')](function(_0x373746){logger[_0x7c09('0x47')](_0x7c09('0x48'),_0x51a34e,JSON[_0x7c09('0x49')](_0x373746));});})['then'](function(){_0x333fc1[_0x7c09('0x18')]();});});}else{return rpc[this[_0x7c09('0xf')]+'Message'][_0x7c09('0x3e')](_0x3b0a12)[_0x7c09('0x3f')](function(_0x4cae16){logger[_0x7c09('0x12')](_0x7c09('0x16'),_0x51a34e,_0x3b0a12[_0x7c09('0x11')]);})[_0x7c09('0x40')](function(_0x209b97){logger[_0x7c09('0x47')](_0x7c09('0x16'),_0x51a34e,JSON[_0x7c09('0x49')](_0x209b97));})[_0x7c09('0x42')](function(){Promise['resolve']()['then'](function(){if(_0x3479af[0x0]!=='2'||_0xb8ec9[_0x7c09('0x44')])return;return rpc[_0x40f8c4+_0x7c09('0x45')][_0x7c09('0x4a')](_0xb8ec9['id'],{'autoreplyExecuted':!![]})['then'](function(_0xf9ca53){logger['info'](_0x7c09('0x46'),_0x51a34e,JSON[_0x7c09('0x49')](_0xf9ca53));})[_0x7c09('0x40')](function(_0x44943e){logger[_0x7c09('0x47')](_0x7c09('0x48'),_0x51a34e,JSON[_0x7c09('0x49')](_0x44943e));});})[_0x7c09('0x3f')](function(){_0x333fc1['next']();});});}}}catch(_0x4a5d36){logger['error'](_0x7c09('0x16'),_0x51a34e,JSON[_0x7c09('0x49')](_0x4a5d36));_0x333fc1[_0x7c09('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 30a21c5..5e00a7a 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 _0xa987=['moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','stop'];(function(_0x230745,_0x40db08){var _0x100618=function(_0x515b89){while(--_0x515b89){_0x230745['push'](_0x230745['shift']());}};_0x100618(++_0x40db08);}(_0xa987,0xbd));var _0x7a98=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa987[_0x5f3f88];return _0xd08119;};'use strict';var moment=require(_0x7a98('0x0'));var logger=require('../../../../config/logger')(_0x7a98('0x1'));var rpc={'chatInteraction':require(_0x7a98('0x2')),'openchannelInteraction':require(_0x7a98('0x3')),'smsInteraction':require(_0x7a98('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7a98('0x5'))};exports[_0x7a98('0x6')]=function(_0x25102c,_0xba240b,_0x5ac17f,_0xec3b67){return function(_0x1ad0ff){try{logger[_0x7a98('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x25102c,_0xba240b[0x0]);var _0x5add21={'closed':0x1,'closedAt':moment()['format'](_0x7a98('0x8')),'closeReason':_0x7a98('0x9'),'disposition':_0xba240b[0x0]};if(rpc[_0xec3b67[_0x7a98('0xa')]+_0x7a98('0xb')]){rpc[_0xec3b67['channel']+_0x7a98('0xb')][_0x7a98('0xc')](_0xec3b67[_0x7a98('0xd')]['id'],_0x5add21)[_0x7a98('0xe')](function(_0x5b8bfe){logger[_0x7a98('0x7')](_0x7a98('0xf'),_0x25102c,_0xec3b67[_0x7a98('0xd')]['id']);})[_0x7a98('0x10')](function(_0x119e78){logger[_0x7a98('0x11')]('[%s][CLOSE]\x20%s',_0x25102c,JSON[_0x7a98('0x12')](_0x119e78));})[_0x7a98('0x13')](function(){_0x1ad0ff[_0x7a98('0x14')]();});}}catch(_0x34f6fa){logger[_0x7a98('0x11')]('[%s][CLOSE]\x20%s',_0x25102c,JSON['stringify'](_0x34f6fa));_0x1ad0ff[_0x7a98('0x14')]();}};}; \ No newline at end of file +var _0x0f58=['../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x53fbdb,_0x166fd9){var _0x19d504=function(_0x33baa7){while(--_0x33baa7){_0x53fbdb['push'](_0x53fbdb['shift']());}};_0x19d504(++_0x166fd9);}(_0x0f58,0x1de));var _0x80f5=function(_0x4a77e4,_0x556f71){_0x4a77e4=_0x4a77e4-0x0;var _0x1c68d8=_0x0f58[_0x4a77e4];return _0x1c68d8;};'use strict';var moment=require(_0x80f5('0x0'));var logger=require(_0x80f5('0x1'))(_0x80f5('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x80f5('0x3')),'smsInteraction':require(_0x80f5('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x80f5('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x80f5('0x6')]=function(_0x11eccb,_0xa0d52a,_0x452bc2,_0x2f09f4){return function(_0x81830){try{logger[_0x80f5('0x7')](_0x80f5('0x8'),_0x11eccb,_0xa0d52a[0x0]);var _0x29318d={'closed':0x1,'closedAt':moment()[_0x80f5('0x9')](_0x80f5('0xa')),'closeReason':'system','disposition':_0xa0d52a[0x0]};if(rpc[_0x2f09f4[_0x80f5('0xb')]+_0x80f5('0xc')]){rpc[_0x2f09f4['channel']+_0x80f5('0xc')][_0x80f5('0xd')](_0x2f09f4[_0x80f5('0xe')]['id'],_0x29318d)[_0x80f5('0xf')](function(_0x407468){logger[_0x80f5('0x7')](_0x80f5('0x10'),_0x11eccb,_0x2f09f4[_0x80f5('0xe')]['id']);})['catch'](function(_0x3e7232){logger[_0x80f5('0x11')]('[%s][CLOSE]\x20%s',_0x11eccb,JSON['stringify'](_0x3e7232));})[_0x80f5('0x12')](function(){_0x81830[_0x80f5('0x13')]();});}}catch(_0x4fbc5c){logger[_0x80f5('0x11')](_0x80f5('0x14'),_0x11eccb,JSON['stringify'](_0x4fbc5c));_0x81830['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index e536ccb..a8a5251 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 _0xe558=['textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop'];(function(_0x4d9242,_0x385b6e){var _0x59301e=function(_0x54d2ef){while(--_0x54d2ef){_0x4d9242['push'](_0x4d9242['shift']());}};_0x59301e(++_0x385b6e);}(_0xe558,0x70));var _0x8e55=function(_0x35142b,_0x326f02){_0x35142b=_0x35142b-0x0;var _0x1e2777=_0xe558[_0x35142b];return _0x1e2777;};'use strict';var _=require(_0x8e55('0x0'));var moment=require(_0x8e55('0x1'));var apiai=require(_0x8e55('0x2'));var md5=require(_0x8e55('0x3'));var utils=require(_0x8e55('0x4'));var logger=require(_0x8e55('0x5'))(_0x8e55('0x6'));var rpc={'chatMessage':require(_0x8e55('0x7')),'openchannelMessage':require(_0x8e55('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8e55('0x9')),'faxMessage':require(_0x8e55('0xa')),'whatsappMessage':require(_0x8e55('0xb'))};exports[_0x8e55('0xc')]=function(_0x3cef42,_0x13c5db){return function(_0x493307){try{if(!_[_0x8e55('0xd')](this[_0x8e55('0xe')]['UserId'])){logger[_0x8e55('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3cef42,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x493307[_0x8e55('0x10')]();}var _0x531361={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x8e55('0x11')),'direction':_0x8e55('0x12')};if(this[_0x8e55('0x13')]===_0x8e55('0x14')||this['channel']===_0x8e55('0x15')){_0x531361['phone']=this['interaction']['phone'];}var _0x32926b=this['channel'];if(_0x32926b===_0x8e55('0x16')){_0x531361[_0x8e55('0x17')]=this[_0x8e55('0x18')]['id'];}else{_0x531361[_[_0x8e55('0x19')](_0x32926b)+_0x8e55('0x1a')]=this[_0x8e55('0x18')]['id'];}_0x531361[_[_0x8e55('0x19')](_0x32926b)+_0x8e55('0x1b')]=this[_0x8e55('0xe')]['id'];if(this[_0x8e55('0xe')][_0x8e55('0x1c')]){var _0x1d6b69=_0x13c5db[0x2];if(!_[_0x8e55('0x1d')](_0x1d6b69)){_0x531361[_0x8e55('0x1e')]=utils[_0x8e55('0x1f')](_0x1d6b69,this);return rpc[_0x32926b+'Message'][_0x8e55('0x20')](_0x531361)[_0x8e55('0x21')](function(_0x2d69e8){logger[_0x8e55('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3cef42,_0x531361[_0x8e55('0x1e')]);})[_0x8e55('0x22')](function(_0x424460){logger[_0x8e55('0x23')](_0x8e55('0x24'),_0x3cef42,JSON[_0x8e55('0x25')](_0x424460));})[_0x8e55('0x26')](function(){logger[_0x8e55('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3cef42);_0x493307['stop']();});}else{logger[_0x8e55('0xf')](_0x8e55('0x27'),_0x3cef42);_0x493307[_0x8e55('0x28')]();}}else{var _0x50641d=this;var _0x42adae=apiai(_0x13c5db[0x0],{'language':_0x13c5db[0x1]||'en'});return _0x42adae[_0x8e55('0x29')](this[_0x8e55('0x2a')][_0x8e55('0x1e')],{'sessionId':md5(this[_0x8e55('0xe')]['id'])})[_0x8e55('0x21')](function(_0x493308){_0x50641d[_0x8e55('0x1e')][_0x8e55('0x2b')]=_0x493308;_0x531361['body']=_0x493308[_0x8e55('0x2c')][_0x8e55('0x2d')][_0x8e55('0x2e')];_0x531361[_0x8e55('0x2f')]=_0x8e55('0x2b');_0x531361[_0x8e55('0x30')]=JSON[_0x8e55('0x25')](_0x493308);return rpc[_0x32926b+_0x8e55('0x31')][_0x8e55('0x20')](_0x531361)[_0x8e55('0x21')](function(_0x4692c5){logger['info'](_0x8e55('0x24'),_0x3cef42,_0x531361[_0x8e55('0x1e')]);if(_0x493308[_0x8e55('0x2c')][_0x8e55('0x32')]['endConversation']){_0x493307[_0x8e55('0x10')]();}else{_0x493307['stop']();}})[_0x8e55('0x22')](function(_0x6023ea){logger['error'](_0x8e55('0x24'),_0x3cef42,JSON[_0x8e55('0x25')](_0x6023ea));_0x493307[_0x8e55('0x10')]();});})['catch'](function(_0x3a8c4d){logger[_0x8e55('0x23')](_0x8e55('0x24'),_0x3cef42,_0x3a8c4d[_0x8e55('0x2a')]);_0x493307[_0x8e55('0x10')]();});}}catch(_0x418ad9){logger[_0x8e55('0x23')](_0x8e55('0x24'),_0x3cef42,JSON['stringify'](_0x418ad9));_0x493307['stop']();}};}; \ No newline at end of file +var _0x0272=['create','metadata','message','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','interaction','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','body','getMustacheRender','Message','then','info','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','dialogflow','result','fulfillment','speech','providerName','providerResponse'];(function(_0x2872ae,_0x363163){var _0x3e2f99=function(_0x42bacf){while(--_0x42bacf){_0x2872ae['push'](_0x2872ae['shift']());}};_0x3e2f99(++_0x363163);}(_0x0272,0x15a));var _0x2027=function(_0x362bd7,_0x3cc49e){_0x362bd7=_0x362bd7-0x0;var _0x121619=_0x0272[_0x362bd7];return _0x121619;};'use strict';var _=require(_0x2027('0x0'));var moment=require(_0x2027('0x1'));var apiai=require('apiai-promise');var md5=require(_0x2027('0x2'));var utils=require(_0x2027('0x3'));var logger=require(_0x2027('0x4'))(_0x2027('0x5'));var rpc={'chatMessage':require(_0x2027('0x6')),'openchannelMessage':require(_0x2027('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2027('0x8')),'whatsappMessage':require(_0x2027('0x9'))};exports[_0x2027('0xa')]=function(_0x54a8f1,_0x5cd8f3){return function(_0x56c261){try{if(!_[_0x2027('0xb')](this['interaction'][_0x2027('0xc')])){logger['info'](_0x2027('0xd'),_0x54a8f1,_0x2027('0xe'));return _0x56c261[_0x2027('0xf')]();}var _0x16785={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2027('0x10')](_0x2027('0x11')),'direction':_0x2027('0x12')};if(this[_0x2027('0x13')]===_0x2027('0x14')||this[_0x2027('0x13')]==='whatsapp'){_0x16785[_0x2027('0x15')]=this[_0x2027('0x16')]['phone'];}var _0x23f5fc=this[_0x2027('0x13')];if(_0x23f5fc===_0x2027('0x17')){_0x16785[_0x2027('0x18')]=this['account']['id'];}else{_0x16785[_[_0x2027('0x19')](_0x23f5fc)+'AccountId']=this[_0x2027('0x1a')]['id'];}_0x16785[_[_0x2027('0x19')](_0x23f5fc)+_0x2027('0x1b')]=this[_0x2027('0x16')]['id'];if(this[_0x2027('0x16')][_0x2027('0x1c')]){var _0x125d66=_0x5cd8f3[0x2];if(!_['isEmpty'](_0x125d66)){_0x16785[_0x2027('0x1d')]=utils[_0x2027('0x1e')](_0x125d66,this);return rpc[_0x23f5fc+_0x2027('0x1f')]['create'](_0x16785)[_0x2027('0x20')](function(_0x5d47bf){logger[_0x2027('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x54a8f1,_0x16785[_0x2027('0x1d')]);})[_0x2027('0x22')](function(_0x2c9f27){logger[_0x2027('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x54a8f1,JSON[_0x2027('0x24')](_0x2c9f27));})[_0x2027('0x25')](function(){logger[_0x2027('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x54a8f1);_0x56c261[_0x2027('0x26')]();});}else{logger[_0x2027('0x21')](_0x2027('0x27'),_0x54a8f1);_0x56c261[_0x2027('0x26')]();}}else{var _0x5e11ba=this;var _0x3a215a=apiai(_0x5cd8f3[0x0],{'language':_0x5cd8f3[0x1]||'en'});return _0x3a215a['textRequest'](this['message'][_0x2027('0x1d')],{'sessionId':md5(this[_0x2027('0x16')]['id'])})[_0x2027('0x20')](function(_0x5cb8d6){_0x5e11ba['body'][_0x2027('0x28')]=_0x5cb8d6;_0x16785['body']=_0x5cb8d6[_0x2027('0x29')][_0x2027('0x2a')][_0x2027('0x2b')];_0x16785[_0x2027('0x2c')]=_0x2027('0x28');_0x16785[_0x2027('0x2d')]=JSON[_0x2027('0x24')](_0x5cb8d6);return rpc[_0x23f5fc+'Message'][_0x2027('0x2e')](_0x16785)[_0x2027('0x20')](function(_0x13e5a1){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x54a8f1,_0x16785[_0x2027('0x1d')]);if(_0x5cb8d6['result'][_0x2027('0x2f')]['endConversation']){_0x56c261['next']();}else{_0x56c261[_0x2027('0x26')]();}})[_0x2027('0x22')](function(_0x2a9320){logger[_0x2027('0x23')](_0x2027('0xd'),_0x54a8f1,JSON[_0x2027('0x24')](_0x2a9320));_0x56c261[_0x2027('0xf')]();});})[_0x2027('0x22')](function(_0x510fc0){logger[_0x2027('0x23')](_0x2027('0xd'),_0x54a8f1,_0x510fc0[_0x2027('0x30')]);_0x56c261[_0x2027('0xf')]();});}}catch(_0x4ea81e){logger['error'](_0x2027('0xd'),_0x54a8f1,JSON[_0x2027('0x24')](_0x4ea81e));_0x56c261[_0x2027('0x26')]();}};}; \ 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 edcdfa1..0e8dbfb 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 _0x9485=['routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','sessionPath','message','length','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','push','all','lodash','dialogflow','md5','moment','../../../../config/logger'];(function(_0x14dff1,_0x133396){var _0x4bc7d2=function(_0x3ed462){while(--_0x3ed462){_0x14dff1['push'](_0x14dff1['shift']());}};_0x4bc7d2(++_0x133396);}(_0x9485,0x8b));var _0x5948=function(_0x34f58,_0x58d848){_0x34f58=_0x34f58-0x0;var _0x2a87f2=_0x9485[_0x34f58];return _0x2a87f2;};'use strict';var _=require(_0x5948('0x0'));var dialogflow=require(_0x5948('0x1'));var md5=require(_0x5948('0x2'));var moment=require(_0x5948('0x3'));var Promise=require('bluebird');var logger=require(_0x5948('0x4'))(_0x5948('0x5'));var utils=require(_0x5948('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5948('0x7')),'mailMessage':require(_0x5948('0x8')),'smsMessage':require(_0x5948('0x9')),'faxMessage':require(_0x5948('0xa')),'whatsappMessage':require(_0x5948('0xb'))};function createMessage(_0x283a13,_0x5354cf,_0x2cf314,_0x4e7f15){return new Promise(function(_0x10f7ca,_0x1c8e0f){var _0x5cf2d2=_[_0x5948('0xc')](_0x2cf314);_0x5cf2d2[_0x5948('0xd')]=_0x4e7f15;return rpc[_0x5354cf+'Message'][_0x5948('0xe')](_0x5cf2d2)[_0x5948('0xf')](function(){logger[_0x5948('0x10')](_0x5948('0x11'),_0x283a13,_0x5cf2d2[_0x5948('0xd')]);_0x10f7ca();})[_0x5948('0x12')](function(_0x1924b3){logger[_0x5948('0x13')](_0x5948('0x11'),_0x283a13,JSON[_0x5948('0x14')](_0x1924b3));_0x1c8e0f(_0x1924b3);});});}exports[_0x5948('0x15')]=function(_0x5cc3db,_0x2592df){return function(_0x13654a){try{if(!_[_0x5948('0x16')](this[_0x5948('0x17')][_0x5948('0x18')])){logger[_0x5948('0x10')](_0x5948('0x11'),_0x5cc3db,_0x5948('0x19'));return _0x13654a[_0x5948('0x1a')]();}var _0x3565df={'ContactId':this[_0x5948('0x1b')]['id'],'sentAt':moment()[_0x5948('0x1c')](_0x5948('0x1d')),'direction':_0x5948('0x1e')};if(this[_0x5948('0x1f')]==='sms'||this['channel']==='whatsapp'){_0x3565df[_0x5948('0x20')]=this[_0x5948('0x17')][_0x5948('0x20')];}var _0x190b50=this[_0x5948('0x1f')];if(_0x190b50===_0x5948('0x21')){_0x3565df['ChatWebsiteId']=this[_0x5948('0x22')]['id'];}else{_0x3565df[_[_0x5948('0x23')](_0x190b50)+_0x5948('0x24')]=this[_0x5948('0x22')]['id'];}_0x3565df[_['upperFirst'](_0x190b50)+_0x5948('0x25')]=this[_0x5948('0x17')]['id'];if(this[_0x5948('0x17')][_0x5948('0x26')]){var _0x38925e=_0x2592df[0x4];if(!_[_0x5948('0x27')](_0x38925e)){_0x3565df[_0x5948('0xd')]=utils[_0x5948('0x28')](_0x38925e,this);return rpc[_0x190b50+_0x5948('0x29')][_0x5948('0xe')](_0x3565df)['then'](function(_0x1f2571){logger['info'](_0x5948('0x11'),_0x5cc3db,_0x3565df[_0x5948('0xd')]);})[_0x5948('0x12')](function(_0x2cd86e){logger[_0x5948('0x13')](_0x5948('0x11'),_0x5cc3db,JSON[_0x5948('0x14')](_0x2cd86e));})[_0x5948('0x2a')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5cc3db);_0x13654a['stop']();});}else{logger[_0x5948('0x10')](_0x5948('0x2b'),_0x5cc3db);_0x13654a[_0x5948('0x2c')]();}}else{var _0x499c35=this;var _0x4a9630=_0x2592df[0x2][_0x5948('0x2d')](/\\n/g,'\x0a');var _0x47b55e={'credentials':{'private_key':_0x4a9630,'client_email':_0x2592df[0x1]}};var _0xc03d2c=new dialogflow['SessionsClient'](_0x47b55e);var _0x2d0a48=_0xc03d2c[_0x5948('0x2e')](_0x2592df[0x0],md5(_0x499c35[_0x5948('0x17')]['id']));var _0x1ad0af={'session':_0x2d0a48,'queryInput':{'text':{'text':_0x499c35[_0x5948('0x2f')][_0x5948('0xd')],'languageCode':_0x2592df[0x3]||'en'}}};return _0xc03d2c['detectIntent'](_0x1ad0af)['then'](function(_0x2c9219){if(_0x2c9219&&_0x2c9219[_0x5948('0x30')]){_0x499c35['body']['dialogflowV2']=_0x2c9219;var _0x5d9ca0=_0x2c9219[0x0];var _0x7a8012=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x32')]&&_0x5d9ca0[_0x5948('0x31')]['diagnosticInfo']['fields']?_0x5d9ca0[_0x5948('0x31')]['diagnosticInfo'][_0x5948('0x33')]['end_conversation'][_0x5948('0x34')]:![];_0x499c35[_0x5948('0xd')][_0x5948('0x35')]=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x36')];_0x499c35[_0x5948('0xd')][_0x5948('0x37')]=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x38')];_0x499c35[_0x5948('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x32')]&&_0x5d9ca0['queryResult'][_0x5948('0x32')]['fields']?_0x5d9ca0[_0x5948('0x31')][_0x5948('0x32')]['fields'][_0x5948('0x39')]['boolValue']:![];_0x499c35[_0x5948('0xd')][_0x5948('0x3a')]=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x3b')][_0x5948('0x3c')];_0x499c35[_0x5948('0xd')][_0x5948('0x3d')]=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x3b')][_0x5948('0x3e')];_0x499c35[_0x5948('0xd')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x5d9ca0['queryResult']['intent']['isFallback'];_0x499c35['body'][_0x5948('0x3f')]=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x40')];_0x499c35['body'][_0x5948('0x41')]=_0x5d9ca0[_0x5948('0x31')]['queryText'];_0x499c35[_0x5948('0xd')]['DIALOGFLOWV2_SCORE']=_0x5d9ca0[_0x5948('0x31')][_0x5948('0x42')];_0x3565df[_0x5948('0x43')]=_0x5948('0x44');_0x3565df['providerResponse']=JSON[_0x5948('0x14')](_0x2c9219);var _0x4f75f5=[];for(var _0x1490ad=0x0;_0x1490ad<_0x2c9219[_0x5948('0x30')];_0x1490ad++){var _0x713ed1=_0x2c9219[_0x1490ad];if(_0x713ed1&&_0x713ed1[_0x5948('0x31')]&&_0x713ed1[_0x5948('0x31')][_0x5948('0x45')]){_0x4f75f5[_0x5948('0x46')](createMessage(_0x5cc3db,_0x190b50,_0x3565df,_0x713ed1[_0x5948('0x31')][_0x5948('0x45')]));}}return Promise[_0x5948('0x47')](_0x4f75f5)[_0x5948('0xf')](function(){if(_0x7a8012){_0x13654a['next']();}else{_0x13654a[_0x5948('0x2c')]();}})[_0x5948('0x12')](function(_0x14b74e){logger[_0x5948('0x13')](_0x5948('0x11'),_0x5cc3db,JSON[_0x5948('0x14')](_0x14b74e));_0x13654a[_0x5948('0x1a')]();});}})[_0x5948('0x12')](function(_0x369c6d){logger[_0x5948('0x13')](_0x5948('0x11'),_0x5cc3db,_0x369c6d['message']);_0x13654a[_0x5948('0x1a')]();});}}catch(_0x27d43d){logger[_0x5948('0x13')](_0x5948('0x11'),_0x5cc3db,JSON['stringify'](_0x27d43d));_0x13654a['stop']();}};}; \ No newline at end of file +var _0xbceb=['Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','length','dialogflowV2','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','queryResult','diagnosticInfo','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','next','dialogflow','md5','moment','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone'];(function(_0x14f15f,_0x3e08c6){var _0x40e6c1=function(_0x159b31){while(--_0x159b31){_0x14f15f['push'](_0x14f15f['shift']());}};_0x40e6c1(++_0x3e08c6);}(_0xbceb,0x10d));var _0xbbce=function(_0x383bd7,_0x3f6f6d){_0x383bd7=_0x383bd7-0x0;var _0x1b32f2=_0xbceb[_0x383bd7];return _0x1b32f2;};'use strict';var _=require('lodash');var dialogflow=require(_0xbbce('0x0'));var md5=require(_0xbbce('0x1'));var moment=require(_0xbbce('0x2'));var Promise=require(_0xbbce('0x3'));var logger=require(_0xbbce('0x4'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xbbce('0x5')),'openchannelMessage':require(_0xbbce('0x6')),'mailMessage':require(_0xbbce('0x7')),'smsMessage':require(_0xbbce('0x8')),'faxMessage':require(_0xbbce('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x3283da,_0xd4f3fb,_0x4dc031,_0x2be991){return new Promise(function(_0x17d2bc,_0xe6b04f){var _0x2aa489=_[_0xbbce('0xa')](_0x4dc031);_0x2aa489['body']=_0x2be991;return rpc[_0xd4f3fb+_0xbbce('0xb')][_0xbbce('0xc')](_0x2aa489)[_0xbbce('0xd')](function(){logger[_0xbbce('0xe')](_0xbbce('0xf'),_0x3283da,_0x2aa489[_0xbbce('0x10')]);_0x17d2bc();})[_0xbbce('0x11')](function(_0x4bcaed){logger[_0xbbce('0x12')](_0xbbce('0xf'),_0x3283da,JSON[_0xbbce('0x13')](_0x4bcaed));_0xe6b04f(_0x4bcaed);});});}exports['consequence']=function(_0x2b40c5,_0x4fd9cd){return function(_0x214a92){try{if(!_[_0xbbce('0x14')](this[_0xbbce('0x15')]['UserId'])){logger[_0xbbce('0xe')](_0xbbce('0xf'),_0x2b40c5,_0xbbce('0x16'));return _0x214a92['next']();}var _0x4f2eb1={'ContactId':this[_0xbbce('0x17')]['id'],'sentAt':moment()[_0xbbce('0x18')](_0xbbce('0x19')),'direction':_0xbbce('0x1a')};if(this[_0xbbce('0x1b')]===_0xbbce('0x1c')||this[_0xbbce('0x1b')]===_0xbbce('0x1d')){_0x4f2eb1['phone']=this[_0xbbce('0x15')][_0xbbce('0x1e')];}var _0x4a770b=this['channel'];if(_0x4a770b===_0xbbce('0x1f')){_0x4f2eb1[_0xbbce('0x20')]=this[_0xbbce('0x21')]['id'];}else{_0x4f2eb1[_[_0xbbce('0x22')](_0x4a770b)+_0xbbce('0x23')]=this[_0xbbce('0x21')]['id'];}_0x4f2eb1[_[_0xbbce('0x22')](_0x4a770b)+_0xbbce('0x24')]=this[_0xbbce('0x15')]['id'];if(this['interaction'][_0xbbce('0x25')]){var _0x39c2ec=_0x4fd9cd[0x4];if(!_['isEmpty'](_0x39c2ec)){_0x4f2eb1[_0xbbce('0x10')]=utils['getMustacheRender'](_0x39c2ec,this);return rpc[_0x4a770b+_0xbbce('0xb')][_0xbbce('0xc')](_0x4f2eb1)[_0xbbce('0xd')](function(_0x4747dc){logger[_0xbbce('0xe')](_0xbbce('0xf'),_0x2b40c5,_0x4f2eb1[_0xbbce('0x10')]);})['catch'](function(_0x1b39b1){logger[_0xbbce('0x12')](_0xbbce('0xf'),_0x2b40c5,JSON[_0xbbce('0x13')](_0x1b39b1));})['finally'](function(){logger[_0xbbce('0xe')](_0xbbce('0x26'),_0x2b40c5);_0x214a92[_0xbbce('0x27')]();});}else{logger[_0xbbce('0xe')](_0xbbce('0x28'),_0x2b40c5);_0x214a92[_0xbbce('0x27')]();}}else{var _0x1af117=this;var _0x5e1b7e=_0x4fd9cd[0x2][_0xbbce('0x29')](/\\n/g,'\x0a');var _0x28aa5f={'credentials':{'private_key':_0x5e1b7e,'client_email':_0x4fd9cd[0x1]}};var _0x24e5d4=new dialogflow[(_0xbbce('0x2a'))](_0x28aa5f);var _0x36181f=_0x24e5d4['sessionPath'](_0x4fd9cd[0x0],md5(_0x1af117[_0xbbce('0x15')]['id']));var _0xe92234={'session':_0x36181f,'queryInput':{'text':{'text':_0x1af117[_0xbbce('0x2b')][_0xbbce('0x10')],'languageCode':_0x4fd9cd[0x3]||'en'}}};return _0x24e5d4['detectIntent'](_0xe92234)[_0xbbce('0xd')](function(_0x12cdbb){if(_0x12cdbb&&_0x12cdbb[_0xbbce('0x2c')]){_0x1af117['body'][_0xbbce('0x2d')]=_0x12cdbb;var _0x1db5fd=_0x12cdbb[0x0];var _0x4afe7d=_0x1db5fd['queryResult']['diagnosticInfo']&&_0x1db5fd['queryResult']['diagnosticInfo'][_0xbbce('0x2e')]?_0x1db5fd['queryResult']['diagnosticInfo']['fields'][_0xbbce('0x2f')][_0xbbce('0x30')]:![];_0x1af117['body'][_0xbbce('0x31')]=_0x1db5fd['queryResult'][_0xbbce('0x32')];_0x1af117['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1db5fd['queryResult'][_0xbbce('0x33')];_0x1af117['body'][_0xbbce('0x34')]=_0x1db5fd[_0xbbce('0x35')]['diagnosticInfo']&&_0x1db5fd['queryResult'][_0xbbce('0x36')]['fields']?_0x1db5fd[_0xbbce('0x35')][_0xbbce('0x36')][_0xbbce('0x2e')][_0xbbce('0x2f')][_0xbbce('0x30')]:![];_0x1af117['body']['DIALOGFLOWV2_INTENTNAME']=_0x1db5fd[_0xbbce('0x35')]['intent'][_0xbbce('0x37')];_0x1af117['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1db5fd[_0xbbce('0x35')][_0xbbce('0x38')]['displayName'];_0x1af117[_0xbbce('0x10')][_0xbbce('0x39')]=_0x1db5fd[_0xbbce('0x35')][_0xbbce('0x38')][_0xbbce('0x3a')];_0x1af117[_0xbbce('0x10')][_0xbbce('0x3b')]=_0x1db5fd['queryResult'][_0xbbce('0x3c')];_0x1af117[_0xbbce('0x10')][_0xbbce('0x3d')]=_0x1db5fd[_0xbbce('0x35')][_0xbbce('0x3e')];_0x1af117['body'][_0xbbce('0x3f')]=_0x1db5fd[_0xbbce('0x35')][_0xbbce('0x40')];_0x4f2eb1[_0xbbce('0x41')]='dialogflowV2';_0x4f2eb1[_0xbbce('0x42')]=JSON[_0xbbce('0x13')](_0x12cdbb);var _0x4e97d7=[];for(var _0x598d6c=0x0;_0x598d6c<_0x12cdbb[_0xbbce('0x2c')];_0x598d6c++){var _0x1c2e67=_0x12cdbb[_0x598d6c];if(_0x1c2e67&&_0x1c2e67[_0xbbce('0x35')]&&_0x1c2e67['queryResult'][_0xbbce('0x43')]){_0x4e97d7[_0xbbce('0x44')](createMessage(_0x2b40c5,_0x4a770b,_0x4f2eb1,_0x1c2e67[_0xbbce('0x35')][_0xbbce('0x43')]));}}return Promise['all'](_0x4e97d7)[_0xbbce('0xd')](function(){if(_0x4afe7d){_0x214a92[_0xbbce('0x45')]();}else{_0x214a92[_0xbbce('0x27')]();}})[_0xbbce('0x11')](function(_0x1c74d5){logger[_0xbbce('0x12')](_0xbbce('0xf'),_0x2b40c5,JSON['stringify'](_0x1c74d5));_0x214a92[_0xbbce('0x45')]();});}})[_0xbbce('0x11')](function(_0x2a8db3){logger['error'](_0xbbce('0xf'),_0x2b40c5,_0x2a8db3[_0xbbce('0x2b')]);_0x214a92['next']();});}}catch(_0x3fd195){logger['error'](_0xbbce('0xf'),_0x2b40c5,JSON[_0xbbce('0x13')](_0x3fd195));_0x214a92['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 eac9ef8..e26001f 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 _0x3ec7=['[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','validate','length','error'];(function(_0x1b1f9c,_0x43783d){var _0x1ccf2e=function(_0x20baad){while(--_0x20baad){_0x1b1f9c['push'](_0x1b1f9c['shift']());}};_0x1ccf2e(++_0x43783d);}(_0x3ec7,0x153));var _0x73ec=function(_0x10db4f,_0x44916e){_0x10db4f=_0x10db4f-0x0;var _0x29ae72=_0x3ec7[_0x10db4f];return _0x29ae72;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x73ec('0x0'));var utils=require('./utils');var logger=require(_0x73ec('0x1'))(_0x73ec('0x2'));var gotoif=schema({'condition':{'type':_0x73ec('0x3'),'required':!![],'message':_0x73ec('0x4')},'priorityTrue':{'type':_0x73ec('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x73ec('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x73ec('0x6')]=function(_0x29ebc1,_0x280635){return function(_0x4a10e3){try{var _0x4e8e57={'condition':htmlToText[_0x73ec('0x7')](utils[_0x73ec('0x8')](_0x280635[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x280635[0x1],'priorityFalse':_0x280635[0x2]};var _0x4a5ed9=gotoif[_0x73ec('0x9')](_0x4e8e57,{'typecast':!![]});if(_0x4a5ed9[_0x73ec('0xa')]){logger[_0x73ec('0xb')](_0x73ec('0xc'),_0x29ebc1,_[_0x73ec('0xd')](_0x4a5ed9,_0x73ec('0xe'))[_0x73ec('0xf')](',\x20'));_0x4a10e3[_0x73ec('0x10')]();}else{try{var _0x4091e5=eval('('+_0x4e8e57[_0x73ec('0x11')]+')');var _0x1e768c=_0x4091e5?_0x4e8e57[_0x73ec('0x12')]:_0x4e8e57['priorityFalse'];logger[_0x73ec('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x29ebc1,_0x4e8e57[_0x73ec('0x11')],_0x4091e5,_0x1e768c||'next');if(_0x1e768c){var _0x14f3a5=_[_0x73ec('0x14')](_0x4a10e3[_0x73ec('0x15')](),{'p':_0x1e768c});if(_0x14f3a5>=0x0){logger[_0x73ec('0x13')](_0x73ec('0x16'),_0x29ebc1,_0x1e768c||_0x73ec('0x17'),_0x14f3a5);_0x4a10e3['next'](_0x14f3a5);}else{logger[_0x73ec('0x13')](_0x73ec('0x18'),_0x29ebc1,_0x1e768c||_0x73ec('0x17'));_0x4a10e3[_0x73ec('0x10')]();}}else{_0x4a10e3['next']();}}catch(_0x209244){logger[_0x73ec('0xb')](_0x73ec('0x19'),_0x29ebc1,_0x209244[_0x73ec('0xe')]);_0x4a10e3[_0x73ec('0x10')]();}}}catch(_0x329fc2){logger[_0x73ec('0xb')](_0x73ec('0xc'),_0x29ebc1,JSON[_0x73ec('0x1a')](_0x329fc2));_0x4a10e3[_0x73ec('0x10')]();}};}; \ No newline at end of file +var _0xa87a=['routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','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','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa87a,0x72));var _0xaa87=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa87a[_0x49ca18];return _0x145d54;};'use strict';var schema=require(_0xaa87('0x0'));var _=require('lodash');var htmlToText=require(_0xaa87('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xaa87('0x2'));var gotoif=schema({'condition':{'type':_0xaa87('0x3'),'required':!![],'message':_0xaa87('0x4')},'priorityTrue':{'type':_0xaa87('0x5'),'message':_0xaa87('0x6')},'priorityFalse':{'type':_0xaa87('0x5'),'message':_0xaa87('0x7')}});exports[_0xaa87('0x8')]=function(_0x2b2fc8,_0x4293bf){return function(_0x134d97){try{var _0x3bf8ba={'condition':htmlToText[_0xaa87('0x9')](utils[_0xaa87('0xa')](_0x4293bf[0x0],this),{'wordwrap':![]})[_0xaa87('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4293bf[0x1],'priorityFalse':_0x4293bf[0x2]};var _0xa3147c=gotoif[_0xaa87('0x0')](_0x3bf8ba,{'typecast':!![]});if(_0xa3147c['length']){logger[_0xaa87('0xc')](_0xaa87('0xd'),_0x2b2fc8,_[_0xaa87('0xe')](_0xa3147c,_0xaa87('0xf'))[_0xaa87('0x10')](',\x20'));_0x134d97[_0xaa87('0x11')]();}else{try{var _0x1e95e8=eval('('+_0x3bf8ba[_0xaa87('0x12')]+')');var _0x4d4c35=_0x1e95e8?_0x3bf8ba[_0xaa87('0x13')]:_0x3bf8ba[_0xaa87('0x14')];logger[_0xaa87('0x15')](_0xaa87('0x16'),_0x2b2fc8,_0x3bf8ba['condition'],_0x1e95e8,_0x4d4c35||_0xaa87('0x17'));if(_0x4d4c35){var _0x5db25a=_['findIndex'](_0x134d97[_0xaa87('0x18')](),{'p':_0x4d4c35});if(_0x5db25a>=0x0){logger[_0xaa87('0x15')](_0xaa87('0x19'),_0x2b2fc8,_0x4d4c35||_0xaa87('0x17'),_0x5db25a);_0x134d97['next'](_0x5db25a);}else{logger['info'](_0xaa87('0x1a'),_0x2b2fc8,_0x4d4c35||_0xaa87('0x17'));_0x134d97['stop']();}}else{_0x134d97[_0xaa87('0x17')]();}}catch(_0x49e966){logger[_0xaa87('0xc')](_0xaa87('0x1b'),_0x2b2fc8,_0x49e966['message']);_0x134d97[_0xaa87('0x11')]();}}}catch(_0x441e4d){logger[_0xaa87('0xc')]('[%s][GOTOIF]\x20%s',_0x2b2fc8,JSON[_0xaa87('0x1c')](_0x441e4d));_0x134d97[_0xaa87('0x11')]();}};}; \ 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 934de10..c57b51e 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 _0xd18a=['message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0xd18a,0x127));var _0xad18=function(_0x1049b3,_0x428c5d){_0x1049b3=_0x1049b3-0x0;var _0x34bbf7=_0xd18a[_0x1049b3];return _0x34bbf7;};'use strict';var schema=require(_0xad18('0x0'));var _=require(_0xad18('0x1'));var logger=require(_0xad18('0x2'))('routing');var gotop=schema({'priority':{'type':_0xad18('0x3'),'required':!![],'message':_0xad18('0x4')}});exports[_0xad18('0x5')]=function(_0x22f1a8,_0x2308a5){return function(_0x48e653){try{var _0x2e6467={'priority':_0x2308a5[0x0]};var _0x14196a=gotop[_0xad18('0x0')](_0x2e6467,{'typecast':!![]});if(_0x14196a[_0xad18('0x6')]){logger[_0xad18('0x7')](_0xad18('0x8'),_0x22f1a8,_['map'](_0x14196a,_0xad18('0x9'))[_0xad18('0xa')](',\x20'));_0x48e653[_0xad18('0xb')]();}else{logger[_0xad18('0xc')](_0xad18('0xd'),_0x22f1a8,_0x2e6467[_0xad18('0xe')]);if(_0x2e6467['priority']){var _0x10af23=_[_0xad18('0xf')](_0x48e653[_0xad18('0x10')](),{'p':_0x2e6467[_0xad18('0xe')]});if(_0x10af23>=0x0){logger[_0xad18('0xc')](_0xad18('0x11'),_0x22f1a8,_0x2e6467[_0xad18('0xe')]||_0xad18('0x12'),_0x10af23);_0x48e653[_0xad18('0x12')](_0x10af23);}else{logger[_0xad18('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x22f1a8,_0x2e6467[_0xad18('0xe')]||_0xad18('0x12'));_0x48e653['stop']();}}else{_0x48e653[_0xad18('0x12')]();}}}catch(_0x38ff17){logger[_0xad18('0x7')](_0xad18('0x8'),_0x22f1a8,JSON['stringify'](_0x38ff17));_0x48e653['stop']();}};}; \ No newline at end of file +var _0x5852=['validate','lodash','routing','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify'];(function(_0x29f84b,_0x4d41a6){var _0x248820=function(_0x466604){while(--_0x466604){_0x29f84b['push'](_0x29f84b['shift']());}};_0x248820(++_0x4d41a6);}(_0x5852,0xbb));var _0x2585=function(_0x30099e,_0x1ee4b2){_0x30099e=_0x30099e-0x0;var _0x474f63=_0x5852[_0x30099e];return _0x474f63;};'use strict';var schema=require(_0x2585('0x0'));var _=require(_0x2585('0x1'));var logger=require('../../../../config/logger')(_0x2585('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x2585('0x3')]=function(_0x5e1570,_0x3fc1f5){return function(_0x39f9f5){try{var _0x4dd865={'priority':_0x3fc1f5[0x0]};var _0xda7a81=gotop[_0x2585('0x0')](_0x4dd865,{'typecast':!![]});if(_0xda7a81[_0x2585('0x4')]){logger[_0x2585('0x5')](_0x2585('0x6'),_0x5e1570,_['map'](_0xda7a81,_0x2585('0x7'))[_0x2585('0x8')](',\x20'));_0x39f9f5[_0x2585('0x9')]();}else{logger[_0x2585('0xa')](_0x2585('0xb'),_0x5e1570,_0x4dd865['priority']);if(_0x4dd865[_0x2585('0xc')]){var _0x263734=_[_0x2585('0xd')](_0x39f9f5['rules'](),{'p':_0x4dd865[_0x2585('0xc')]});if(_0x263734>=0x0){logger[_0x2585('0xa')](_0x2585('0xe'),_0x5e1570,_0x4dd865['priority']||_0x2585('0xf'),_0x263734);_0x39f9f5[_0x2585('0xf')](_0x263734);}else{logger[_0x2585('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5e1570,_0x4dd865['priority']||_0x2585('0xf'));_0x39f9f5[_0x2585('0x9')]();}}else{_0x39f9f5[_0x2585('0xf')]();}}}catch(_0x4f03f8){logger[_0x2585('0x5')](_0x2585('0x6'),_0x5e1570,JSON[_0x2585('0x10')](_0x4f03f8));_0x39f9f5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 3987b2a..df9ff0b 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 _0xd813=['next','error','stringify','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','InteractionId','create','then','[%s][MESSAGE]\x20%s','body'];(function(_0x2cc304,_0xa916ed){var _0x424fa5=function(_0x27916e){while(--_0x27916e){_0x2cc304['push'](_0x2cc304['shift']());}};_0x424fa5(++_0xa916ed);}(_0xd813,0x19c));var _0x3d81=function(_0x18a246,_0x5e7f4b){_0x18a246=_0x18a246-0x0;var _0x268977=_0xd813[_0x18a246];return _0x268977;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x3d81('0x0'))(_0x3d81('0x1'));var rpc={'chatMessage':require(_0x3d81('0x2')),'openchannelMessage':require(_0x3d81('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3d81('0x4')),'faxMessage':require(_0x3d81('0x5')),'whatsappMessage':require(_0x3d81('0x6'))};exports[_0x3d81('0x7')]=function(_0x513ad5,_0x30330f){return function(_0x13c64b){try{var _0x2a94c6={'body':utils[_0x3d81('0x8')](_0x30330f[0x0],this),'ContactId':this[_0x3d81('0x9')]['id']};if(this['channel']===_0x3d81('0xa')){_0x2a94c6[_0x3d81('0xb')]=this[_0x3d81('0xc')]['id'];}else{_0x2a94c6[_[_0x3d81('0xd')](this[_0x3d81('0xe')])+'AccountId']=this[_0x3d81('0xc')]['id'];}_0x2a94c6[_[_0x3d81('0xd')](this[_0x3d81('0xe')])+_0x3d81('0xf')]=this['interaction']['id'];if(rpc[this[_0x3d81('0xe')]+'Message']){return rpc[this['channel']+'Message'][_0x3d81('0x10')](_0x2a94c6)[_0x3d81('0x11')](function(_0xc4c1a5){logger['info'](_0x3d81('0x12'),_0x513ad5,_0x2a94c6[_0x3d81('0x13')]);_0x13c64b[_0x3d81('0x14')]();})['catch'](function(_0x32ec61){logger[_0x3d81('0x15')]('[%s][MESSAGE]\x20%s',_0x513ad5,JSON[_0x3d81('0x16')](_0x32ec61));_0x13c64b[_0x3d81('0x17')]();});}}catch(_0x5b87f9){logger['error'](_0x3d81('0x12'),_0x513ad5,JSON[_0x3d81('0x16')](_0x5b87f9));_0x13c64b[_0x3d81('0x17')]();}};}; \ No newline at end of file +var _0x6f18=['error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','body','next','catch'];(function(_0x22056f,_0x38a500){var _0x2f3945=function(_0x4e66cb){while(--_0x4e66cb){_0x22056f['push'](_0x22056f['shift']());}};_0x2f3945(++_0x38a500);}(_0x6f18,0x1b4));var _0x86f1=function(_0x318b73,_0x25f054){_0x318b73=_0x318b73-0x0;var _0x19061f=_0x6f18[_0x318b73];return _0x19061f;};'use strict';var _=require(_0x86f1('0x0'));var utils=require('./utils');var logger=require(_0x86f1('0x1'))('routing');var rpc={'chatMessage':require(_0x86f1('0x2')),'openchannelMessage':require(_0x86f1('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x86f1('0x4')),'faxMessage':require(_0x86f1('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x86f1('0x6')]=function(_0x2733f7,_0x3c91dc){return function(_0x15a5e1){try{var _0x403f48={'body':utils['getMustacheRender'](_0x3c91dc[0x0],this),'ContactId':this[_0x86f1('0x7')]['id']};if(this[_0x86f1('0x8')]===_0x86f1('0x9')){_0x403f48[_0x86f1('0xa')]=this[_0x86f1('0xb')]['id'];}else{_0x403f48[_['upperFirst'](this[_0x86f1('0x8')])+_0x86f1('0xc')]=this[_0x86f1('0xb')]['id'];}_0x403f48[_[_0x86f1('0xd')](this[_0x86f1('0x8')])+_0x86f1('0xe')]=this[_0x86f1('0xf')]['id'];if(rpc[this[_0x86f1('0x8')]+'Message']){return rpc[this[_0x86f1('0x8')]+_0x86f1('0x10')][_0x86f1('0x11')](_0x403f48)[_0x86f1('0x12')](function(_0x692342){logger[_0x86f1('0x13')]('[%s][MESSAGE]\x20%s',_0x2733f7,_0x403f48[_0x86f1('0x14')]);_0x15a5e1[_0x86f1('0x15')]();})[_0x86f1('0x16')](function(_0x648502){logger[_0x86f1('0x17')](_0x86f1('0x18'),_0x2733f7,JSON[_0x86f1('0x19')](_0x648502));_0x15a5e1[_0x86f1('0x1a')]();});}}catch(_0x512cde){logger[_0x86f1('0x17')](_0x86f1('0x18'),_0x2733f7,JSON[_0x86f1('0x19')](_0x512cde));_0x15a5e1[_0x86f1('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index ed9149a..c19b5f4 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 _0xbdcf=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0xc6d3cc,_0x27ff31){var _0x1d0954=function(_0x15c739){while(--_0x15c739){_0xc6d3cc['push'](_0xc6d3cc['shift']());}};_0x1d0954(++_0x27ff31);}(_0xbdcf,0x173));var _0xfbdc=function(_0x579b1d,_0x1dffdc){_0x579b1d=_0x579b1d-0x0;var _0x361cf3=_0xbdcf[_0x579b1d];return _0x361cf3;};'use strict';var utils=require(_0xfbdc('0x0'));var logger=require(_0xfbdc('0x1'))(_0xfbdc('0x2'));exports[_0xfbdc('0x3')]=function(_0x326ac1,_0x4922f7){return function(_0xe2c4f7){try{logger[_0xfbdc('0x4')](_0xfbdc('0x5'),_0x326ac1,utils[_0xfbdc('0x6')](_0x4922f7[0x0],this));_0xe2c4f7[_0xfbdc('0x7')]();}catch(_0x2aedac){logger[_0xfbdc('0x8')](_0xfbdc('0x5'),_0x326ac1,JSON[_0xfbdc('0x9')](_0x2aedac));_0xe2c4f7[_0xfbdc('0xa')]();}};}; \ No newline at end of file +var _0x1dab=['stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','error'];(function(_0x1d031e,_0x147ae9){var _0x205c30=function(_0x370d2f){while(--_0x370d2f){_0x1d031e['push'](_0x1d031e['shift']());}};_0x205c30(++_0x147ae9);}(_0x1dab,0x1eb));var _0xb1da=function(_0x17ac2f,_0x522a8d){_0x17ac2f=_0x17ac2f-0x0;var _0x3beeb8=_0x1dab[_0x17ac2f];return _0x3beeb8;};'use strict';var utils=require(_0xb1da('0x0'));var logger=require('../../../../config/logger')(_0xb1da('0x1'));exports[_0xb1da('0x2')]=function(_0x247641,_0x308019){return function(_0xac9834){try{logger[_0xb1da('0x3')](_0xb1da('0x4'),_0x247641,utils['getMustacheRender'](_0x308019[0x0],this));_0xac9834['next']();}catch(_0x5389b0){logger[_0xb1da('0x5')](_0xb1da('0x4'),_0x247641,JSON['stringify'](_0x5389b0));_0xac9834[_0xb1da('0x6')]();}};}; \ 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 658d3a5..c3886b9 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 _0xe6b8=['redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','InteractionId','interaction','MessageId','message','channel','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy'];(function(_0x3bbc37,_0xd7ecea){var _0x53eb30=function(_0x2a7add){while(--_0x2a7add){_0x3bbc37['push'](_0x3bbc37['shift']());}};_0x53eb30(++_0xd7ecea);}(_0xe6b8,0x140));var _0x8e6b=function(_0x33f7e5,_0x1a0d69){_0x33f7e5=_0x33f7e5-0x0;var _0x59e54a=_0xe6b8[_0x33f7e5];return _0x59e54a;};'use strict';var schema=require(_0x8e6b('0x0'));var _=require(_0x8e6b('0x1'));var util=require('util');var seqqueue=require(_0x8e6b('0x2'));var moment=require(_0x8e6b('0x3'));var Redis=require(_0x8e6b('0x4'));var config=require(_0x8e6b('0x5'));var logger=require(_0x8e6b('0x6'))('routing');var strategy=require(_0x8e6b('0x7'));config[_0x8e6b('0x8')]=_[_0x8e6b('0x9')](config[_0x8e6b('0x8')],{'host':_0x8e6b('0xa'),'port':0x18eb});var io=require(_0x8e6b('0xb'))(new Redis(config[_0x8e6b('0x8')]));var attributes=['id',_0x8e6b('0xc'),_0x8e6b('0xd'),_0x8e6b('0xe'),_0x8e6b('0xf'),_0x8e6b('0x10')];function emit(_0x81e809,_0x40f0a3,_0x4ecd99){io['to'](_0x81e809)[_0x8e6b('0x11')](_0x40f0a3,_0x4ecd99);}function emitChannelQueueInteraction(_0x4c591e,_0x53b33d,_0x47634d,_0x245050,_0x5d4f73,_0x5c438e,_0x1e0ea1,_0x3ac36e){var _0x4953b6=_[_0x8e6b('0x12')](_0x47634d);_0x4953b6[_0x8e6b('0xc')]=_0x3ac36e;_0x4953b6[_0x8e6b('0xe')]=_0x53b33d;_0x4953b6[_0x8e6b('0xd')]=_0x245050;_0x4953b6['id']=_0x5d4f73;if(_0x5c438e){_0x1e0ea1[util[_0x8e6b('0x13')](_0x8e6b('0x14'),_0x4c591e)][_0x5d4f73]=_['pick'](_0x4953b6,attributes);}else{delete _0x1e0ea1[util[_0x8e6b('0x13')](_0x8e6b('0x14'),_0x4c591e)][_0x5d4f73];}emit(util[_0x8e6b('0x13')](_0x8e6b('0x15'),_0x4c591e,_0x53b33d),util[_0x8e6b('0x13')]('%s_queue_waiting_interaction:%s',_0x4c591e,_0x5c438e?_0x8e6b('0x16'):_0x8e6b('0x17')),_[_0x8e6b('0x18')](_0x4953b6,attributes));}var rpc={'openchannelQueueReport':require(_0x8e6b('0x19')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x8e6b('0x1a')),'smsQueueReport':require(_0x8e6b('0x1b')),'faxQueueReport':require(_0x8e6b('0x1c')),'whatsappQueueReport':require(_0x8e6b('0x1d'))};var queue=schema({'name':{'type':_0x8e6b('0x1e'),'required':!![],'message':_0x8e6b('0x1f')},'timeout':{'type':_0x8e6b('0x20'),'message':_0x8e6b('0x21')}});function startRouting(_0x341b4d,_0x24c0a8,_0x384af4,_0x4d2f8a){if(_0x341b4d&&_0x24c0a8&&_0x384af4){_0x24c0a8[_0x8e6b('0x22')]+=0x1;var _0x2afb0a={'uniqueid':_0x341b4d,'from':_0x384af4[_0x8e6b('0x23')]?_0x384af4['body'][_0x8e6b('0xf')]:'','joinAt':moment()[_0x8e6b('0x13')](_0x8e6b('0x24')),'ContactId':_0x384af4['contact']?_0x384af4[_0x8e6b('0x25')]['id']:null,'ListId':_0x384af4[_0x8e6b('0x26')]?_0x384af4[_0x8e6b('0x26')]['id']:null};_0x2afb0a[_['upperFirst'](_0x384af4['channel'])+'QueueId']=_0x24c0a8['id']||null;_0x2afb0a[_[_0x8e6b('0x27')](_0x384af4['channel'])+_0x8e6b('0x28')]=_0x384af4[_0x8e6b('0x29')]?_0x384af4[_0x8e6b('0x29')]['id']:null;_0x2afb0a[_['upperFirst'](_0x384af4['channel'])+_0x8e6b('0x2a')]=_0x384af4[_0x8e6b('0x2b')]?_0x384af4[_0x8e6b('0x2b')]['id']:null;_0x2afb0a[_[_0x8e6b('0x27')](_0x384af4[_0x8e6b('0x2c')])+(_0x384af4[_0x8e6b('0x2c')]!==_0x8e6b('0x2d')?_0x8e6b('0x2e'):_0x8e6b('0x2f'))]=_0x384af4['account']?_0x384af4[_0x8e6b('0xd')]['id']:null;logger['info'](util[_0x8e6b('0x13')](_0x8e6b('0x30'),_0x341b4d,_0x24c0a8[_0x8e6b('0x31')]));emitChannelQueueInteraction(_0x384af4[_0x8e6b('0x2c')],_0x24c0a8['name'],_0x2afb0a,_0x384af4[_0x8e6b('0xd')]['name'],_0x384af4[_0x8e6b('0x2b')]['id'],!![],_0x4d2f8a,_0x24c0a8['id']);if(rpc[_0x384af4[_0x8e6b('0x2c')]+'QueueReport']){return rpc[_0x384af4[_0x8e6b('0x2c')]+_0x8e6b('0x32')]['create'](_0x2afb0a)['catch'](function(_0x2a0319){logger[_0x8e6b('0x33')](_0x8e6b('0x34'));});}}}function stopRouting(_0x2cc3ee,_0x21dfdb,_0x426fa9,_0x47f69c){if(_0x2cc3ee&&_0x21dfdb){_0x21dfdb[_0x8e6b('0x22')]-=0x1;var _0x21883b={'leaveAt':moment()[_0x8e6b('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x8e6b('0x24')),'reason':_0x8e6b('0x35')};logger[_0x8e6b('0x36')](util[_0x8e6b('0x13')](_0x8e6b('0x37'),_0x2cc3ee,_0x21dfdb['name']));emitChannelQueueInteraction(_0x426fa9[_0x8e6b('0x2c')],_0x21dfdb['name'],_0x426fa9[_0x8e6b('0x23')],_0x426fa9['account']['name'],_0x426fa9['message']['id'],![],_0x47f69c,_0x21dfdb['id']);if(rpc[_0x426fa9[_0x8e6b('0x2c')]+_0x8e6b('0x32')]){return rpc[_0x426fa9[_0x8e6b('0x2c')]+_0x8e6b('0x32')][_0x8e6b('0x38')](_0x2cc3ee,_0x21883b)[_0x8e6b('0x39')](function(_0x2f423b){logger['error'](_0x8e6b('0x3a'));});}}}function endRouting(_0x5da181,_0x4eefbd,_0x5b43e0,_0x207620){if(_0x5da181&&_0x4eefbd){_0x4eefbd['waiting']-=0x1;var _0x12e8a3={'leaveAt':moment()['format'](_0x8e6b('0x24')),'exitAt':moment()['format'](_0x8e6b('0x24')),'reason':_0x8e6b('0x3b')};logger[_0x8e6b('0x36')](util[_0x8e6b('0x13')](_0x8e6b('0x3c'),_0x5da181,_0x4eefbd[_0x8e6b('0x31')]));emitChannelQueueInteraction(_0x5b43e0[_0x8e6b('0x2c')],_0x4eefbd['name'],_0x5b43e0['body'],_0x5b43e0[_0x8e6b('0xd')][_0x8e6b('0x31')],_0x5b43e0['message']['id'],![],_0x207620);if(rpc[_0x5b43e0['channel']+_0x8e6b('0x32')]){return rpc[_0x5b43e0[_0x8e6b('0x2c')]+_0x8e6b('0x32')][_0x8e6b('0x38')](_0x5da181,_0x12e8a3)[_0x8e6b('0x39')](function(_0x571929){logger[_0x8e6b('0x33')](_0x8e6b('0x3a'));});}}}function handleFindQueue(_0x28951f){return function(_0x249095){return _0x249095[_0x8e6b('0x31')][_0x8e6b('0x3d')]()===_0x28951f['toLowerCase']();};}exports[_0x8e6b('0x3e')]=function(_0x5a0ce2,_0x4a45db,_0x4f4b63,_0x4bc7b9){return function(_0x42d78e){try{var _0x395a3d={'name':_0x4a45db[0x0],'timeout':_0x4a45db[0x1]};var _0x3c6ff0=queue[_0x8e6b('0x0')](_0x395a3d,{'typecast':!![]});if(_0x3c6ff0[_0x8e6b('0x3f')]){logger['error'](_0x8e6b('0x40'),_0x5a0ce2,_[_0x8e6b('0x41')](_0x3c6ff0,_0x8e6b('0x2b'))[_0x8e6b('0x42')](',\x20'));_0x42d78e[_0x8e6b('0x43')]();}else{var _0x153eff=_[_0x8e6b('0x44')](_0x4f4b63[_0x4bc7b9[_0x8e6b('0x2c')]+_0x8e6b('0x45')],handleFindQueue(_0x395a3d[_0x8e6b('0x31')]));if(_0x153eff){startRouting(_0x5a0ce2,_0x153eff,_0x4bc7b9,_0x4f4b63);var _0x4776d2=(_0x153eff[_0x8e6b('0x3b')]||0xa)*0x3e8;var _0x1a36da=(_0x395a3d['timeout']||0x14)*0x3e8;var _0x3af35f,_0x1a4e7d;if(_0x4776d2>_0x1a36da){_0x1a36da=_0x4776d2;}var _0x1896e8=seqqueue['createQueue'](_0x4776d2);_0x1896e8['id']=_0x5a0ce2;_0x1896e8[_0x8e6b('0x46')]=_0x4776d2;_0x1896e8[_0x8e6b('0x47')]=_0x1a36da;_0x1896e8[_0x8e6b('0x2c')]=_0x4bc7b9[_0x8e6b('0x2c')];_0x4f4b63[_0x8e6b('0x48')][_0x5a0ce2]['on'](_0x8e6b('0x49'),function(){logger[_0x8e6b('0x36')](_0x8e6b('0x4a'),_0x5a0ce2);stopRouting(_0x5a0ce2,_0x153eff,_0x4bc7b9,_0x4f4b63);clearTimeout(_0x3af35f);_0x3af35f=undefined;_0x1896e8[_0x8e6b('0x4b')](!![]);if(_0x4f4b63[_0x8e6b('0x48')][_0x5a0ce2]){delete _0x4f4b63['rules'][_0x5a0ce2];}_0x42d78e['stop']();});_0x4f4b63['rules'][_0x5a0ce2]['on']('complete',function(){if(_0x4f4b63[_0x8e6b('0x48')][_0x5a0ce2]){delete _0x4f4b63['rules'][_0x5a0ce2];}});_0x3af35f=setTimeout(function(){logger[_0x8e6b('0x36')](_0x8e6b('0x4c'),_0x5a0ce2);endRouting(_0x5a0ce2,_0x153eff,_0x4bc7b9,_0x4f4b63);clearTimeout(_0x3af35f);_0x1896e8['close'](!![]);_0x42d78e[_0x8e6b('0x4d')]();},_0x1a36da);switch(_0x153eff['strategy']){case _0x8e6b('0x4e'):strategy[_0x8e6b('0x4e')](_0x1896e8,_0x153eff,_0x4f4b63,_0x4bc7b9);break;default:strategy[_0x8e6b('0x4f')](_0x1896e8,_0x153eff,_0x4f4b63,_0x4bc7b9);}}else{logger[_0x8e6b('0x33')](_0x8e6b('0x50'),_0x5a0ce2,_0x395a3d[_0x8e6b('0x31')]);_0x42d78e[_0x8e6b('0x43')]();}}}catch(_0x7230c2){console['log'](_0x7230c2);logger[_0x8e6b('0x33')](_0x8e6b('0x40'),_0x5a0ce2,_0x7230c2[_0x8e6b('0x51')]);_0x42d78e[_0x8e6b('0x43')]();}};}; \ No newline at end of file +var _0x1491=['remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','info','length','[%s][QUEUE]\x20%s','map','stop','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','next','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','save'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x1491,0x1b1));var _0x1149=function(_0x1e1e55,_0xe957f4){_0x1e1e55=_0x1e1e55-0x0;var _0x31cdf5=_0x1491[_0x1e1e55];return _0x31cdf5;};'use strict';var schema=require(_0x1149('0x0'));var _=require(_0x1149('0x1'));var util=require(_0x1149('0x2'));var seqqueue=require(_0x1149('0x3'));var moment=require('moment');var Redis=require(_0x1149('0x4'));var config=require(_0x1149('0x5'));var logger=require(_0x1149('0x6'))(_0x1149('0x7'));var strategy=require(_0x1149('0x8'));config[_0x1149('0x9')]=_[_0x1149('0xa')](config[_0x1149('0x9')],{'host':_0x1149('0xb'),'port':0x18eb});var io=require(_0x1149('0xc'))(new Redis(config[_0x1149('0x9')]));var attributes=['id',_0x1149('0xd'),_0x1149('0xe'),_0x1149('0xf'),_0x1149('0x10'),_0x1149('0x11')];function emit(_0x17a116,_0x449487,_0x82dd3f){io['to'](_0x17a116)['emit'](_0x449487,_0x82dd3f);}function emitChannelQueueInteraction(_0xea86b8,_0x54e748,_0x5150f9,_0x575008,_0x45e302,_0x494aec,_0x5e31ca,_0xd84570){var _0x55ba22=_[_0x1149('0x12')](_0x5150f9);_0x55ba22[_0x1149('0xd')]=_0xd84570;_0x55ba22[_0x1149('0xf')]=_0x54e748;_0x55ba22[_0x1149('0xe')]=_0x575008;_0x55ba22['id']=_0x45e302;if(_0x494aec){_0x5e31ca[util[_0x1149('0x13')](_0x1149('0x14'),_0xea86b8)][_0x45e302]=_['pick'](_0x55ba22,attributes);}else{delete _0x5e31ca[util[_0x1149('0x13')]('%sQueuesWaitingInteractions',_0xea86b8)][_0x45e302];}emit(util['format'](_0x1149('0x15'),_0xea86b8,_0x54e748),util[_0x1149('0x13')]('%s_queue_waiting_interaction:%s',_0xea86b8,_0x494aec?_0x1149('0x16'):_0x1149('0x17')),_[_0x1149('0x18')](_0x55ba22,attributes));}var rpc={'openchannelQueueReport':require(_0x1149('0x19')),'mailQueueReport':require(_0x1149('0x1a')),'chatQueueReport':require(_0x1149('0x1b')),'smsQueueReport':require(_0x1149('0x1c')),'faxQueueReport':require(_0x1149('0x1d')),'whatsappQueueReport':require(_0x1149('0x1e'))};var queue=schema({'name':{'type':_0x1149('0x1f'),'required':!![],'message':_0x1149('0x20')},'timeout':{'type':_0x1149('0x21'),'message':_0x1149('0x22')}});function startRouting(_0x517c77,_0x5e744b,_0x31acc1,_0x2b85f9){if(_0x517c77&&_0x5e744b&&_0x31acc1){_0x5e744b[_0x1149('0x23')]+=0x1;var _0x4781b8={'uniqueid':_0x517c77,'from':_0x31acc1[_0x1149('0x24')]?_0x31acc1['body'][_0x1149('0x10')]:'','joinAt':moment()[_0x1149('0x13')](_0x1149('0x25')),'ContactId':_0x31acc1['contact']?_0x31acc1[_0x1149('0x26')]['id']:null,'ListId':_0x31acc1[_0x1149('0x27')]?_0x31acc1[_0x1149('0x27')]['id']:null};_0x4781b8[_['upperFirst'](_0x31acc1[_0x1149('0x28')])+_0x1149('0x29')]=_0x5e744b['id']||null;_0x4781b8[_[_0x1149('0x2a')](_0x31acc1['channel'])+_0x1149('0x2b')]=_0x31acc1[_0x1149('0x2c')]?_0x31acc1[_0x1149('0x2c')]['id']:null;_0x4781b8[_[_0x1149('0x2a')](_0x31acc1[_0x1149('0x28')])+_0x1149('0x2d')]=_0x31acc1[_0x1149('0x2e')]?_0x31acc1[_0x1149('0x2e')]['id']:null;_0x4781b8[_[_0x1149('0x2a')](_0x31acc1[_0x1149('0x28')])+(_0x31acc1['channel']!==_0x1149('0x2f')?_0x1149('0x30'):'WebsiteId')]=_0x31acc1[_0x1149('0xe')]?_0x31acc1[_0x1149('0xe')]['id']:null;logger['info'](util[_0x1149('0x13')](_0x1149('0x31'),_0x517c77,_0x5e744b[_0x1149('0x32')]));emitChannelQueueInteraction(_0x31acc1['channel'],_0x5e744b[_0x1149('0x32')],_0x4781b8,_0x31acc1[_0x1149('0xe')][_0x1149('0x32')],_0x31acc1[_0x1149('0x2e')]['id'],!![],_0x2b85f9,_0x5e744b['id']);if(rpc[_0x31acc1['channel']+'QueueReport']){return rpc[_0x31acc1['channel']+_0x1149('0x33')][_0x1149('0x34')](_0x4781b8)[_0x1149('0x35')](function(_0x482c8e){logger[_0x1149('0x36')](_0x1149('0x37'));});}}}function stopRouting(_0x123c9e,_0x123317,_0x4bf62b,_0x1aa0b3){if(_0x123c9e&&_0x123317){_0x123317[_0x1149('0x23')]-=0x1;var _0x521909={'leaveAt':moment()['format'](_0x1149('0x25')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util[_0x1149('0x13')](_0x1149('0x38'),_0x123c9e,_0x123317[_0x1149('0x32')]));emitChannelQueueInteraction(_0x4bf62b['channel'],_0x123317[_0x1149('0x32')],_0x4bf62b['body'],_0x4bf62b['account'][_0x1149('0x32')],_0x4bf62b[_0x1149('0x2e')]['id'],![],_0x1aa0b3,_0x123317['id']);if(rpc[_0x4bf62b[_0x1149('0x28')]+_0x1149('0x33')]){return rpc[_0x4bf62b[_0x1149('0x28')]+'QueueReport'][_0x1149('0x39')](_0x123c9e,_0x521909)[_0x1149('0x35')](function(_0x254391){logger[_0x1149('0x36')](_0x1149('0x3a'));});}}}function endRouting(_0x4b630c,_0x2c88cf,_0x3c8314,_0x34b1ac){if(_0x4b630c&&_0x2c88cf){_0x2c88cf[_0x1149('0x23')]-=0x1;var _0x46fd08={'leaveAt':moment()[_0x1149('0x13')](_0x1149('0x25')),'exitAt':moment()[_0x1149('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1149('0x3b')};logger[_0x1149('0x3c')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x4b630c,_0x2c88cf[_0x1149('0x32')]));emitChannelQueueInteraction(_0x3c8314[_0x1149('0x28')],_0x2c88cf[_0x1149('0x32')],_0x3c8314[_0x1149('0x24')],_0x3c8314['account']['name'],_0x3c8314['message']['id'],![],_0x34b1ac);if(rpc[_0x3c8314[_0x1149('0x28')]+_0x1149('0x33')]){return rpc[_0x3c8314[_0x1149('0x28')]+'QueueReport']['update'](_0x4b630c,_0x46fd08)['catch'](function(_0x210895){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x2b4681){return function(_0x47c84d){return _0x47c84d[_0x1149('0x32')]['toLowerCase']()===_0x2b4681['toLowerCase']();};}exports['consequence']=function(_0x37ad54,_0x4bed03,_0x5e8416,_0x43a889){return function(_0x391add){try{var _0x5690ee={'name':_0x4bed03[0x0],'timeout':_0x4bed03[0x1]};var _0x5f4b44=queue[_0x1149('0x0')](_0x5690ee,{'typecast':!![]});if(_0x5f4b44[_0x1149('0x3d')]){logger[_0x1149('0x36')](_0x1149('0x3e'),_0x37ad54,_[_0x1149('0x3f')](_0x5f4b44,'message')['join'](',\x20'));_0x391add[_0x1149('0x40')]();}else{var _0x31df65=_['find'](_0x5e8416[_0x43a889[_0x1149('0x28')]+'Queues'],handleFindQueue(_0x5690ee[_0x1149('0x32')]));if(_0x31df65){startRouting(_0x37ad54,_0x31df65,_0x43a889,_0x5e8416);var _0x53f145=(_0x31df65[_0x1149('0x3b')]||0xa)*0x3e8;var _0x71fb93=(_0x5690ee[_0x1149('0x3b')]||0x14)*0x3e8;var _0x442bbf,_0x291ace;if(_0x53f145>_0x71fb93){_0x71fb93=_0x53f145;}var _0x505481=seqqueue[_0x1149('0x41')](_0x53f145);_0x505481['id']=_0x37ad54;_0x505481[_0x1149('0x42')]=_0x53f145;_0x505481[_0x1149('0x43')]=_0x71fb93;_0x505481[_0x1149('0x28')]=_0x43a889[_0x1149('0x28')];_0x5e8416['rules'][_0x37ad54]['on']('end',function(){logger[_0x1149('0x3c')](_0x1149('0x44'),_0x37ad54);stopRouting(_0x37ad54,_0x31df65,_0x43a889,_0x5e8416);clearTimeout(_0x442bbf);_0x442bbf=undefined;_0x505481[_0x1149('0x45')](!![]);if(_0x5e8416[_0x1149('0x46')][_0x37ad54]){delete _0x5e8416['rules'][_0x37ad54];}_0x391add[_0x1149('0x40')]();});_0x5e8416[_0x1149('0x46')][_0x37ad54]['on']('complete',function(){if(_0x5e8416[_0x1149('0x46')][_0x37ad54]){delete _0x5e8416[_0x1149('0x46')][_0x37ad54];}});_0x442bbf=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x37ad54);endRouting(_0x37ad54,_0x31df65,_0x43a889,_0x5e8416);clearTimeout(_0x442bbf);_0x505481[_0x1149('0x45')](!![]);_0x391add[_0x1149('0x47')]();},_0x71fb93);switch(_0x31df65['strategy']){case _0x1149('0x48'):strategy[_0x1149('0x48')](_0x505481,_0x31df65,_0x5e8416,_0x43a889);break;default:strategy[_0x1149('0x49')](_0x505481,_0x31df65,_0x5e8416,_0x43a889);}}else{logger[_0x1149('0x36')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x37ad54,_0x5690ee[_0x1149('0x32')]);_0x391add[_0x1149('0x40')]();}}}catch(_0x19defb){console[_0x1149('0x4a')](_0x19defb);logger[_0x1149('0x36')](_0x1149('0x3e'),_0x37ad54,_0x19defb[_0x1149('0x4b')]);_0x391add[_0x1149('0x40')]();}};}; \ 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 668a113..4c40664 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 _0x0d96=['agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil'];(function(_0x591250,_0x4efdab){var _0x20cab6=function(_0xc49bb9){while(--_0xc49bb9){_0x591250['push'](_0x591250['shift']());}};_0x20cab6(++_0x4efdab);}(_0x0d96,0x130));var _0x60d9=function(_0x44fb90,_0xdf024f){_0x44fb90=_0x44fb90-0x0;var _0x3e63d7=_0x0d96[_0x44fb90];return _0x3e63d7;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x60d9('0x0'));var logger=require(_0x60d9('0x1'))('routing');var Agent=function(_0x2ae892,_0x223603,_0x41d955,_0x4bab25){this[_0x60d9('0x2')]=uuid['v4']();this[_0x60d9('0x3')]=_0x2ae892;this[_0x60d9('0x4')]=_0x223603;this[_0x60d9('0x5')]=_0x41d955;this[_0x60d9('0x6')]=_0x4bab25;this['squeue'][_0x60d9('0x7')](this[_0x60d9('0x8')][_0x60d9('0x9')](this),this[_0x60d9('0xa')]['bind'](this));this['squeue']['on']('timeout',this['handleTimeout'][_0x60d9('0x9')](this));this[_0x60d9('0x3')]['on'](_0x60d9('0xb'),this['handleDrained'][_0x60d9('0x9')](this));};Agent['prototype']['push']=function(){this['squeue'][_0x60d9('0x7')](this['handleRun'][_0x60d9('0x9')](this),this[_0x60d9('0xa')]['bind'](this));};Agent['prototype'][_0x60d9('0xc')]=function(){this[_0x60d9('0xa')](!![]);};Agent[_0x60d9('0xd')][_0x60d9('0x8')]=function(_0x4cc6df){logger['info'](_0x60d9('0xe'),this[_0x60d9('0x3')]['id'],this[_0x60d9('0x4')]['id']);if(_[_0x60d9('0xf')](this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']])){logger[_0x60d9('0x11')](_0x60d9('0x12'),this['squeue']['id'],this[_0x60d9('0x4')]['id']);setTimeout(this[_0x60d9('0x7')][_0x60d9('0x9')](this),0x3e8);}else{if(this['routing'][_0x60d9('0x13')]||util[_0x60d9('0x14')](this[_0x60d9('0x3')]['id'],this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']],this[_0x60d9('0x3')][_0x60d9('0x15')],![])){this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']][_0x60d9('0x16')]=!![];this['realtime'][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']][_0x60d9('0x17')]=undefined;util['showNotification'](this[_0x60d9('0x2')],this[_0x60d9('0x3')]['id'],this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']],null,this[_0x60d9('0x6')]);util[_0x60d9('0x18')](this[_0x60d9('0x3')]['id'],this['realtime'][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']],_0x60d9('0x19')+(this['routing']['forcedOwnership']?_0x60d9('0x1a'):''));}else{logger[_0x60d9('0x11')](_0x60d9('0x1b'),this[_0x60d9('0x3')]['id'],this[_0x60d9('0x4')]['id']);setTimeout(this[_0x60d9('0x7')][_0x60d9('0x9')](this),0x3e8);}}};Agent[_0x60d9('0xd')][_0x60d9('0xa')]=function(_0x6d7410){if(_[_0x60d9('0xf')](this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']])){return logger[_0x60d9('0x11')](_0x60d9('0x12'),this[_0x60d9('0x3')]['id'],this[_0x60d9('0x4')]['id']);}else{logger[_0x60d9('0x11')](_0x60d9('0x1c'),this['squeue']['id'],this['agent']['id']);util[_0x60d9('0x1d')](this[_0x60d9('0x2')],this['squeue']['id'],this['realtime'][_0x60d9('0x10')][this['agent']['id']],null,this[_0x60d9('0x6')]);this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']][_0x60d9('0x16')]=![];this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']][_0x60d9('0x17')]=undefined;util[_0x60d9('0x18')](this[_0x60d9('0x3')]['id'],this[_0x60d9('0x5')][_0x60d9('0x10')][this[_0x60d9('0x4')]['id']],_0x6d7410?'STOP':_0x60d9('0x1e'));}if(!_0x6d7410){setTimeout(this[_0x60d9('0x7')][_0x60d9('0x9')](this),0x3e8);}};function agent(_0x18b0b7,_0x3de7b7,_0x9cc477,_0x549c91){return new Agent(_0x18b0b7,_0x3de7b7,_0x9cc477,_0x549c91);}module[_0x60d9('0x1f')]=agent; \ No newline at end of file +var _0x1af8=['agents','channel','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','handleTimeout','timeout','prototype','handleRun','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x310693,_0x5eb0bf){var _0x2dd79c=function(_0x17e800){while(--_0x17e800){_0x310693['push'](_0x310693['shift']());}};_0x2dd79c(++_0x5eb0bf);}(_0x1af8,0x13e));var _0x81af=function(_0x5e7be2,_0x1f61be){_0x5e7be2=_0x5e7be2-0x0;var _0x291caa=_0x1af8[_0x5e7be2];return _0x291caa;};'use strict';var _=require(_0x81af('0x0'));var uuid=require(_0x81af('0x1'));var util=require(_0x81af('0x2'));var logger=require(_0x81af('0x3'))(_0x81af('0x4'));var Agent=function(_0x2a7b16,_0x54a785,_0x5573a3,_0x3f1b49){this[_0x81af('0x5')]=uuid['v4']();this[_0x81af('0x6')]=_0x2a7b16;this['agent']=_0x54a785;this[_0x81af('0x7')]=_0x5573a3;this[_0x81af('0x4')]=_0x3f1b49;this['squeue'][_0x81af('0x8')](this['handleRun'][_0x81af('0x9')](this),this[_0x81af('0xa')][_0x81af('0x9')](this));this[_0x81af('0x6')]['on'](_0x81af('0xb'),this[_0x81af('0xa')][_0x81af('0x9')](this));this[_0x81af('0x6')]['on']('drained',this['handleDrained'][_0x81af('0x9')](this));};Agent[_0x81af('0xc')][_0x81af('0x8')]=function(){this[_0x81af('0x6')][_0x81af('0x8')](this[_0x81af('0xd')]['bind'](this),this['handleTimeout'][_0x81af('0x9')](this));};Agent[_0x81af('0xc')][_0x81af('0xe')]=function(){this[_0x81af('0xa')](!![]);};Agent[_0x81af('0xc')][_0x81af('0xd')]=function(_0x38a495){logger[_0x81af('0xf')](_0x81af('0x10'),this[_0x81af('0x6')]['id'],this[_0x81af('0x11')]['id']);if(_[_0x81af('0x12')](this[_0x81af('0x7')]['agents'][this[_0x81af('0x11')]['id']])){logger[_0x81af('0xf')](_0x81af('0x13'),this[_0x81af('0x6')]['id'],this[_0x81af('0x11')]['id']);setTimeout(this['push'][_0x81af('0x9')](this),0x3e8);}else{if(this['routing'][_0x81af('0x14')]||util[_0x81af('0x15')](this['squeue']['id'],this[_0x81af('0x7')][_0x81af('0x16')][this[_0x81af('0x11')]['id']],this[_0x81af('0x6')][_0x81af('0x17')],![])){this[_0x81af('0x7')][_0x81af('0x16')][this[_0x81af('0x11')]['id']]['busy']=!![];this['realtime']['agents'][this[_0x81af('0x11')]['id']][_0x81af('0x18')]=undefined;util[_0x81af('0x19')](this[_0x81af('0x5')],this[_0x81af('0x6')]['id'],this[_0x81af('0x7')]['agents'][this[_0x81af('0x11')]['id']],null,this[_0x81af('0x4')]);util[_0x81af('0x1a')](this[_0x81af('0x6')]['id'],this[_0x81af('0x7')][_0x81af('0x16')][this[_0x81af('0x11')]['id']],'RINGING'+(this[_0x81af('0x4')][_0x81af('0x14')]?_0x81af('0x1b'):''));}else{logger[_0x81af('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x81af('0x6')]['id'],this[_0x81af('0x11')]['id']);setTimeout(this['push'][_0x81af('0x9')](this),0x3e8);}}};Agent['prototype'][_0x81af('0xa')]=function(_0x1ee4e6){if(_['isNil'](this[_0x81af('0x7')][_0x81af('0x16')][this[_0x81af('0x11')]['id']])){return logger[_0x81af('0xf')](_0x81af('0x13'),this[_0x81af('0x6')]['id'],this[_0x81af('0x11')]['id']);}else{logger['info'](_0x81af('0x1c'),this[_0x81af('0x6')]['id'],this[_0x81af('0x11')]['id']);util[_0x81af('0x1d')](this[_0x81af('0x5')],this['squeue']['id'],this[_0x81af('0x7')]['agents'][this[_0x81af('0x11')]['id']],null,this['routing']);this[_0x81af('0x7')][_0x81af('0x16')][this['agent']['id']][_0x81af('0x1e')]=![];this[_0x81af('0x7')][_0x81af('0x16')][this['agent']['id']][_0x81af('0x18')]=undefined;util[_0x81af('0x1a')](this[_0x81af('0x6')]['id'],this[_0x81af('0x7')]['agents'][this['agent']['id']],_0x1ee4e6?_0x81af('0x1f'):_0x81af('0x20'));}if(!_0x1ee4e6){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x5333c8,_0x4279d9,_0x54c54e,_0x34df18){return new Agent(_0x5333c8,_0x4279d9,_0x54c54e,_0x34df18);}module[_0x81af('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index f59d6ed..c53d5f9 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 _0xf483=['isAgentAvailable','channel','writeLog','busy','busyQueue','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','uuid','../../../../../config/logger','routing','realtime','push','handleRun','bind','handleTimeout','squeue','timeout','handleDrained','prototype','queue','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x42f0fd,_0x14e23f){var _0x2ae89f=function(_0x308da8){while(--_0x308da8){_0x42f0fd['push'](_0x42f0fd['shift']());}};_0x2ae89f(++_0x14e23f);}(_0xf483,0xf2));var _0x3f48=function(_0x65a31,_0x2cc2b1){_0x65a31=_0x65a31-0x0;var _0x4f1afe=_0xf483[_0x65a31];return _0x4f1afe;};'use strict';var _=require('lodash');var uuid=require(_0x3f48('0x0'));var util=require('./util');var logger=require(_0x3f48('0x1'))(_0x3f48('0x2'));var Beepall=function(_0x2f4d00,_0x413bf0,_0x169391,_0x312d9c){this['notificationId']=uuid['v4']();this['squeue']=_0x2f4d00;this['queue']=_0x413bf0;this[_0x3f48('0x3')]=_0x169391;this[_0x3f48('0x2')]=_0x312d9c;this['squeue'][_0x3f48('0x4')](this[_0x3f48('0x5')][_0x3f48('0x6')](this),this[_0x3f48('0x7')][_0x3f48('0x6')](this));this[_0x3f48('0x8')]['on'](_0x3f48('0x9'),this['handleTimeout'][_0x3f48('0x6')](this));this[_0x3f48('0x8')]['on']('drained',this[_0x3f48('0xa')]['bind'](this));};Beepall[_0x3f48('0xb')][_0x3f48('0x4')]=function(){this[_0x3f48('0x8')][_0x3f48('0x4')](this[_0x3f48('0x5')][_0x3f48('0x6')](this),this[_0x3f48('0x7')][_0x3f48('0x6')](this));};Beepall[_0x3f48('0xb')][_0x3f48('0xa')]=function(_0x57060f){this[_0x3f48('0x7')](!![]);};Beepall[_0x3f48('0xb')][_0x3f48('0x5')]=function(_0x5f5c5a){var _0x132c13=!![];if(!_['isNil'](this[_0x3f48('0xc')])&&!_[_0x3f48('0xd')](this[_0x3f48('0xc')]['Agents'])&&this[_0x3f48('0xc')][_0x3f48('0xe')][_0x3f48('0xf')]>0x0){for(var _0x6b97bf=0x0,_0x57ef56;_0x6b97bf0x0){for(var _0x2d64b1=0x0,_0x511f74;_0x2d64b10x0&&_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 +var _0xe2fe=['busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','hideNotification','writeLog','lodash','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','user:save','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','format','user:%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_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 utils=require('../utils');var Mustache=require(_0xee2f('0x1'));var Redis=require('ioredis');var config=require(_0xee2f('0x2'));var logger=require(_0xee2f('0x3'))(_0xee2f('0x4'));config[_0xee2f('0x5')]=_[_0xee2f('0x6')](config['redis'],{'host':_0xee2f('0x7'),'port':0x18eb});var io=require(_0xee2f('0x8'))(new Redis(config['redis']));function emit(_0x1533a0,_0x2e1c8c,_0x5a7975){io['to'](_0x1533a0)[_0xee2f('0x9')](_0x2e1c8c,_0x5a7975);}function sendNotification(_0x5ea796,_0x34007e,_0x36920f,_0x53f7dd,_0x3a49bb,_0x43f451){io['to'](util['format']('user:%s',_0x53f7dd['name']))['emit'](_0xee2f('0xa'),_0x53f7dd);var _0x4cb4bf=_0x43f451||{};var _0x481ea7=_0x36920f['split']('.');var _0x25ddf7={'uniqueid':_0x34007e,'channel':_0x481ea7[0x0],'id':_0x481ea7[0x1],'title':_0x481ea7[0x0]+_0xee2f('0xb'),'interactionId':_0x481ea7[0x2],'queue':_0x3a49bb?_0x3a49bb[_0xee2f('0xc')]:null,'sound':_0x4cb4bf[_0xee2f('0xd')][_0xee2f('0xe')],'shake':_0x4cb4bf[_0xee2f('0xd')]['notificationShake']};try{if(!_0x4cb4bf[_0xee2f('0xf')]){_0x4cb4bf['body']={};}if(_0x3a49bb){_0x4cb4bf[_0xee2f('0xf')][_0xee2f('0x10')]=_0x3a49bb;}else if(_0x4cb4bf['body'][_0xee2f('0x10')]){delete _0x4cb4bf[_0xee2f('0xf')][_0xee2f('0x10')];}_0x25ddf7[_0xee2f('0x11')]=utils[_0xee2f('0x12')](_0x4cb4bf['account'][_0xee2f('0x13')],_0x4cb4bf);}catch(_0x4afcd1){_0x25ddf7[_0xee2f('0x11')]=_0xee2f('0x14');logger['error'](util['format'](_0xee2f('0x15'),_0x34007e,_0x4afcd1['message']));}io['to'](util[_0xee2f('0x16')](_0xee2f('0x17'),_0x53f7dd[_0xee2f('0xc')]))['emit'](util[_0xee2f('0x16')](_0xee2f('0x18'),_0x5ea796?_0xee2f('0x19'):_0xee2f('0x1a')),_0x25ddf7);}function writeLog(_0x3d892d,_0x5d36d4,_0x5e73ad){return logger[_0xee2f('0x1b')](util[_0xee2f('0x16')](_0xee2f('0x1c'),_0x3d892d,_0x5d36d4[_0xee2f('0xc')],_0x5e73ad));}exports[_0xee2f('0x1d')]=function(_0xf278cc,_0x39a39c,_0x4d68d3,_0x250399){if(_0x39a39c[_0xee2f('0x1e')]){writeLog(_0xf278cc,_0x39a39c,_0xee2f('0x1f'));return![];}if(!_0x39a39c[_0xee2f('0x20')]){writeLog(_0xf278cc,_0x39a39c,_0xee2f('0x21'));return![];}if(_0x39a39c[_0x4d68d3+_0xee2f('0x22')]){writeLog(_0xf278cc,_0x39a39c,_0xee2f('0x23'));return![];}if(_0x250399&&_0x39a39c[_0xee2f('0x24')](_0x4d68d3+_0xee2f('0x25'))&&_0x39a39c[_0xee2f('0x24')](_0x4d68d3+_0xee2f('0x26'))){if(_0x39a39c[_0x4d68d3+_0xee2f('0x25')]>0x0&&_0x39a39c[_0x4d68d3+_0xee2f('0x26')]>=_0x39a39c[_0x4d68d3+_0xee2f('0x25')]){writeLog(_0xf278cc,_0x39a39c,_0x4d68d3['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x18bdbb,_0x18ff19,_0x2cb0cb,_0xc7f004,_0x892a4e){return sendNotification(!![],_0x18bdbb,_0x18ff19,_0x2cb0cb,_0xc7f004,_0x892a4e);};exports[_0xee2f('0x27')]=function(_0x4d8398,_0x3d3806,_0x52e1fa,_0x235697,_0x180429){return sendNotification(![],_0x4d8398,_0x3d3806,_0x52e1fa,_0x235697,_0x180429);};exports[_0xee2f('0x28')]=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 a78a97a..816b372 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 _0x802c=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x2f64e8,_0x4ec85b){var _0x11613b=function(_0xa03035){while(--_0xa03035){_0x2f64e8['push'](_0x2f64e8['shift']());}};_0x11613b(++_0x4ec85b);}(_0x802c,0xd1));var _0xc802=function(_0x51bb16,_0x477c76){_0x51bb16=_0x51bb16-0x0;var _0xf3a631=_0x802c[_0x51bb16];return _0xf3a631;};'use strict';var schema=require(_0xc802('0x0'));var sh=require(_0xc802('0x1'));var _=require(_0xc802('0x2'));var utils=require(_0xc802('0x3'));var logger=require(_0xc802('0x4'))(_0xc802('0x5'));var system=schema({'command':{'type':_0xc802('0x6'),'required':!![],'message':_0xc802('0x7')}});exports[_0xc802('0x8')]=function(_0x4fc45e,_0x34024a){return function(_0x1367d2){try{var _0x45da20={'command':_0x34024a[0x0]};var _0x450195=system['validate'](_0x45da20,{'typecast':!![]});if(_0x450195[_0xc802('0x9')]){logger[_0xc802('0xa')](_0xc802('0xb'),_0x4fc45e,_[_0xc802('0xc')](_0x450195,_0xc802('0xd'))[_0xc802('0xe')](',\x20'));logger[_0xc802('0xf')](_0xc802('0x10'),_0x4fc45e);_0x1367d2[_0xc802('0x11')]();}else{var _0x38cff7=this;var _0x255a41=utils['getMustacheRender'](_0x34024a[0x0],this);logger[_0xc802('0xf')](_0xc802('0x12'),_0x4fc45e,_0x255a41);sh[_0xc802('0x13')](_['trim'](_0x255a41),function(_0x7a6564,_0x3becd9){logger[_0xc802('0xf')](_0xc802('0x14'),_0x4fc45e,_0x7a6564);if(_0x7a6564==0x0){var _0x4783a9=_0x3becd9[_0xc802('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0xc802('0x16')](_0x34024a[0x1])||_['isEmpty'](_0x34024a[0x1])){logger[_0xc802('0xf')](_0xc802('0x17'),_0x4fc45e);_0x38cff7[_0xc802('0x18')][_0x34024a[0x1]]=_0x4783a9;}else{logger[_0xc802('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4fc45e,_0x34024a[0x1],_0x4783a9);_0x38cff7[_0xc802('0x18')][_0x34024a[0x1]]=_0x4783a9;}}_0x1367d2['next']();});}}catch(_0x1696d7){logger[_0xc802('0xa')](_0xc802('0xb'),_0x4fc45e,_[_0xc802('0x19')](_0x1696d7)?JSON[_0xc802('0x1a')](_0x1696d7):_0x1696d7);logger[_0xc802('0xf')](_0xc802('0x10'),_0x4fc45e);_0x1367d2[_0xc802('0x11')]();}};}; \ No newline at end of file +var _0xe18e=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','../../../../config/logger','routing','string'];(function(_0x2f5cb0,_0x8b40b2){var _0x2afd41=function(_0x5569eb){while(--_0x5569eb){_0x2f5cb0['push'](_0x2f5cb0['shift']());}};_0x2afd41(++_0x8b40b2);}(_0xe18e,0xe5));var _0xee18=function(_0x27650c,_0x231add){_0x27650c=_0x27650c-0x0;var _0x114630=_0xe18e[_0x27650c];return _0x114630;};'use strict';var schema=require(_0xee18('0x0'));var sh=require(_0xee18('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xee18('0x2'))(_0xee18('0x3'));var system=schema({'command':{'type':_0xee18('0x4'),'required':!![],'message':_0xee18('0x5')}});exports[_0xee18('0x6')]=function(_0x5c7b58,_0x1a32a6){return function(_0x41943c){try{var _0x222b86={'command':_0x1a32a6[0x0]};var _0x25fd0f=system[_0xee18('0x0')](_0x222b86,{'typecast':!![]});if(_0x25fd0f[_0xee18('0x7')]){logger[_0xee18('0x8')](_0xee18('0x9'),_0x5c7b58,_[_0xee18('0xa')](_0x25fd0f,_0xee18('0xb'))['join'](',\x20'));logger[_0xee18('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5c7b58);_0x41943c['next']();}else{var _0x475acc=this;var _0x29a18f=utils[_0xee18('0xd')](_0x1a32a6[0x0],this);logger[_0xee18('0xc')](_0xee18('0xe'),_0x5c7b58,_0x29a18f);sh[_0xee18('0xf')](_[_0xee18('0x10')](_0x29a18f),function(_0x44cb27,_0x3bbbb8){logger[_0xee18('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5c7b58,_0x44cb27);if(_0x44cb27==0x0){var _0x51268b=_0x3bbbb8[_0xee18('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xee18('0x12')](_0x1a32a6[0x1])||_[_0xee18('0x13')](_0x1a32a6[0x1])){logger[_0xee18('0xc')](_0xee18('0x14'),_0x5c7b58);_0x475acc['body'][_0x1a32a6[0x1]]=_0x51268b;}else{logger[_0xee18('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5c7b58,_0x1a32a6[0x1],_0x51268b);_0x475acc[_0xee18('0x15')][_0x1a32a6[0x1]]=_0x51268b;}}_0x41943c[_0xee18('0x16')]();});}}catch(_0x5eb9a6){logger[_0xee18('0x8')]('[%s][SYSTEM]\x20%s',_0x5c7b58,_[_0xee18('0x17')](_0x5eb9a6)?JSON[_0xee18('0x18')](_0x5eb9a6):_0x5eb9a6);logger[_0xee18('0xc')](_0xee18('0x19'),_0x5c7b58);_0x41943c[_0xee18('0x16')]();}};}; \ 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 b2491c2..fd9eccd 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 _0x2a83=['next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info'];(function(_0x578956,_0x12dc1b){var _0x40617b=function(_0x30fc1c){while(--_0x30fc1c){_0x578956['push'](_0x578956['shift']());}};_0x40617b(++_0x12dc1b);}(_0x2a83,0x15c));var _0x32a8=function(_0x4b800f,_0x341d87){_0x4b800f=_0x4b800f-0x0;var _0x3d1091=_0x2a83[_0x4b800f];return _0x3d1091;};'use strict';var schema=require(_0x32a8('0x0'));var _=require(_0x32a8('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x32a8('0x2')),'mailInteraction':require(_0x32a8('0x3')),'faxInteraction':require(_0x32a8('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x32a8('0x5'))(_0x32a8('0x6'));var tag=schema({'tag':{'type':_0x32a8('0x7'),'required':!![],'message':_0x32a8('0x8')}});exports[_0x32a8('0x9')]=function(_0x82b308,_0x367afd,_0xad1bbd,_0x3a8de2){return function(_0x3230e2){try{var _0x108aee={'tag':_0x367afd[0x0]};var _0x139461=tag[_0x32a8('0x0')](_0x108aee,{'typecast':!![]});if(_0x139461[_0x32a8('0xa')]){logger[_0x32a8('0xb')](_0x32a8('0xc'),_0x82b308,_[_0x32a8('0xd')](_0x139461,'message')[_0x32a8('0xe')](',\x20'));logger[_0x32a8('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x82b308);_0x3230e2[_0x32a8('0x10')]();}else{var _0x522982={'ids':[_0x367afd[0x0]]};if(rpc[_0x3a8de2[_0x32a8('0x11')]+'Interaction']){rpc[_0x3a8de2['channel']+_0x32a8('0x12')][_0x32a8('0x13')](_0x3a8de2[_0x32a8('0x14')]['id'],_0x522982)['then'](function(_0x5840d8){logger[_0x32a8('0xf')](_0x32a8('0x15'),_0x82b308,_0x367afd[0x1],_0x3a8de2[_0x32a8('0x11')],_0x3a8de2[_0x32a8('0x14')]['id']);})['catch'](function(_0x222430){logger['error'](_0x32a8('0xc'),_0x82b308,JSON[_0x32a8('0x16')](_0x222430));logger[_0x32a8('0xf')](_0x32a8('0x17'),_0x82b308);})[_0x32a8('0x18')](function(){_0x3230e2['next']();});}}}catch(_0x16cf5d){logger['error'](_0x32a8('0xc'),_0x82b308,_[_0x32a8('0x19')](_0x16cf5d)?JSON[_0x32a8('0x16')](_0x16cf5d):_0x16cf5d);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x82b308);_0x3230e2[_0x32a8('0x10')]();}};}; \ No newline at end of file +var _0x90d3=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','catch','[%s][TAG]\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x29bfb4,_0x3eeb34){var _0x5a7632=function(_0x1da22d){while(--_0x1da22d){_0x29bfb4['push'](_0x29bfb4['shift']());}};_0x5a7632(++_0x3eeb34);}(_0x90d3,0xae));var _0x390d=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x90d3[_0x5d8018];return _0x151ac4;};'use strict';var schema=require(_0x390d('0x0'));var _=require(_0x390d('0x1'));var rpc={'chatInteraction':require(_0x390d('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x390d('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x390d('0x4')),'whatsappInteraction':require(_0x390d('0x5'))};var logger=require(_0x390d('0x6'))(_0x390d('0x7'));var tag=schema({'tag':{'type':_0x390d('0x8'),'required':!![],'message':_0x390d('0x9')}});exports['consequence']=function(_0x5d456e,_0x418516,_0x11d092,_0x17a7f2){return function(_0x161db1){try{var _0x101f6d={'tag':_0x418516[0x0]};var _0x415e32=tag[_0x390d('0x0')](_0x101f6d,{'typecast':!![]});if(_0x415e32[_0x390d('0xa')]){logger[_0x390d('0xb')]('[%s][TAG]\x20%s',_0x5d456e,_[_0x390d('0xc')](_0x415e32,'message')[_0x390d('0xd')](',\x20'));logger[_0x390d('0xe')](_0x390d('0xf'),_0x5d456e);_0x161db1[_0x390d('0x10')]();}else{var _0x4731d7={'ids':[_0x418516[0x0]]};if(rpc[_0x17a7f2[_0x390d('0x11')]+_0x390d('0x12')]){rpc[_0x17a7f2['channel']+_0x390d('0x12')][_0x390d('0x13')](_0x17a7f2[_0x390d('0x14')]['id'],_0x4731d7)['then'](function(_0x680c19){logger[_0x390d('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5d456e,_0x418516[0x1],_0x17a7f2[_0x390d('0x11')],_0x17a7f2[_0x390d('0x14')]['id']);})[_0x390d('0x15')](function(_0x2c436a){logger['error'](_0x390d('0x16'),_0x5d456e,JSON[_0x390d('0x17')](_0x2c436a));logger[_0x390d('0xe')](_0x390d('0xf'),_0x5d456e);})[_0x390d('0x18')](function(){_0x161db1[_0x390d('0x10')]();});}}}catch(_0x100466){logger[_0x390d('0xb')](_0x390d('0x16'),_0x5d456e,_[_0x390d('0x19')](_0x100466)?JSON[_0x390d('0x17')](_0x100466):_0x100466);logger[_0x390d('0xe')](_0x390d('0xf'),_0x5d456e);_0x161db1[_0x390d('0x10')]();}};}; \ 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 0daa294..d68594f 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(_0x30aabb,_0x5b299e){var _0x353bfb=function(_0x1fc042){while(--_0x1fc042){_0x30aabb['push'](_0x30aabb['shift']());}};_0x353bfb(++_0x5b299e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x33dd6f,_0x31155a){var _0x26f425=function(_0x497a4f){while(--_0x497a4f){_0x33dd6f['push'](_0x33dd6f['shift']());}};_0x26f425(++_0x31155a);}(_0xe706,0xa3));var _0x6e70=function(_0x3ae4bf,_0x554978){_0x3ae4bf=_0x3ae4bf-0x0;var _0x27f7dd=_0xe706[_0x3ae4bf];return _0x27f7dd;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4e82874..390530e 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 _0x6bdb=['server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','app','.js','toLowerCase','autoreply','mail','push','slice','join','dialogflow','dialogflowv2','appdata','amazonlex','split','tag','%s:%s:%s','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agents','busy','agent','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','end','stack','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','available','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions'];(function(_0x2e11d3,_0x26a29a){var _0x3f7f7f=function(_0x3c43f1){while(--_0x3c43f1){_0x2e11d3['push'](_0x2e11d3['shift']());}};_0x3f7f7f(++_0x26a29a);}(_0x6bdb,0x11f));var _0xb6bd=function(_0x42208a,_0xa32cb4){_0x42208a=_0x42208a-0x0;var _0x26939d=_0x6bdb[_0x42208a];return _0x26939d;};'use strict';var _=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var path=require(_0xb6bd('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb6bd('0x3'));var uuid=require(_0xb6bd('0x4'));var config=require(_0xb6bd('0x5'));var logger=require(_0xb6bd('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xb6bd('0x7')),'mailQueueReport':require(_0xb6bd('0x8')),'chatQueueReport':require(_0xb6bd('0x9')),'smsQueueReport':require(_0xb6bd('0xa')),'faxQueueReport':require(_0xb6bd('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xb6bd('0xc'));function getId(_0x384f5d,_0x135453,_0x4f6859){return util[_0xb6bd('0xd')](_0xb6bd('0xe'),_0x384f5d,_0x135453||0x0,_0x4f6859||0x0);}function getIntervals(_0xfe8c7f,_0x375683){var _0x568ec8=[];if(!_[_0xb6bd('0xf')](_0x375683[_0xb6bd('0x10')])&&!_[_0xb6bd('0xf')](_0xfe8c7f[_0x375683[_0xb6bd('0x10')]])&&!_[_0xb6bd('0xf')](_0xfe8c7f[_0x375683[_0xb6bd('0x10')]][_0xb6bd('0x11')])){_0x568ec8=_[_0xb6bd('0x12')](_0xfe8c7f[_0x375683[_0xb6bd('0x10')]][_0xb6bd('0x11')],_0xb6bd('0x13'));}else if(!_['isNil'](_0x375683[_0xb6bd('0x13')])){_0x568ec8=[_0x375683[_0xb6bd('0x13')]];}return _0x568ec8;}exports[_0xb6bd('0x14')]=function(_0x199ece){_0x199ece[_0xb6bd('0x15')]={};return new BPromise(function(_0x44b932,_0x6e40f4){var _0x1bac02={'Start':function(_0x2b3c60){var _0x216512=this;return new Promise(function(_0x15a3ed,_0x406b3b){if(_0x2b3c60){try{var _0x216c93=[];var _0x3dd902=getId(_0x2b3c60[_0xb6bd('0x16')],_0x2b3c60['message']?_0x2b3c60[_0xb6bd('0x17')]['id']:0x0,_0x2b3c60[_0xb6bd('0x18')]?_0x2b3c60[_0xb6bd('0x18')]['id']:0x0);if(_0x2b3c60[_0xb6bd('0x19')]&&_[_0xb6bd('0x1a')](_0x2b3c60[_0xb6bd('0x19')])&&_0x2b3c60['applications'][_0xb6bd('0x1b')]){for(var _0x111575=0x0;_0x111575<_0x2b3c60[_0xb6bd('0x19')][_0xb6bd('0x1b')];_0x111575+=0x1){var _0x4a8c59=_0x2b3c60['applications'][_0x111575];if(fs['existsSync'](path['join'](__dirname,'applications',_0x4a8c59[_0xb6bd('0x1c')]+_0xb6bd('0x1d')))){var _0x5d2bc0=[];switch(_0x4a8c59[_0xb6bd('0x1c')][_0xb6bd('0x1e')]()){case _0xb6bd('0x1f'):var _0x37ba65=_0x4a8c59['appdata']['split'](',');if(_0x2b3c60['channel']===_0xb6bd('0x20')){_0x5d2bc0[_0xb6bd('0x21')](_0x37ba65[0x0]);_0x5d2bc0[_0xb6bd('0x21')](_0x37ba65[0x1]);_0x5d2bc0[_0xb6bd('0x21')](_0x37ba65[_0xb6bd('0x22')](0x2,_0x37ba65['length'])['join'](','));}else{_0x5d2bc0[_0xb6bd('0x21')](_0x37ba65[0x0]);_0x5d2bc0[_0xb6bd('0x21')](_0x37ba65['slice'](0x1,_0x37ba65[_0xb6bd('0x1b')])[_0xb6bd('0x23')](','));}break;case _0xb6bd('0x24'):var _0x1d16a3=_0x4a8c59['appdata']['split'](',');_0x5d2bc0['push'](_0x1d16a3[0x0]);_0x5d2bc0[_0xb6bd('0x21')](_0x1d16a3[0x1]);_0x5d2bc0['push'](_0x1d16a3[_0xb6bd('0x22')](0x2,_0x1d16a3[_0xb6bd('0x1b')])[_0xb6bd('0x23')](','));break;case _0xb6bd('0x25'):var _0xd689b3=_0x4a8c59[_0xb6bd('0x26')]['split'](',');_0x5d2bc0[_0xb6bd('0x21')](_0xd689b3[0x0]);_0x5d2bc0['push'](_0xd689b3[0x1]);_0x5d2bc0[_0xb6bd('0x21')](_0xd689b3[0x2]);_0x5d2bc0[_0xb6bd('0x21')](_0xd689b3[0x3]);_0x5d2bc0[_0xb6bd('0x21')](_0xd689b3['slice'](0x4,_0xd689b3['length'])[_0xb6bd('0x23')](','));break;case _0xb6bd('0x27'):var _0x392b78=_0x4a8c59[_0xb6bd('0x26')][_0xb6bd('0x28')](',');_0x5d2bc0[_0xb6bd('0x21')](_0x392b78[0x0]);_0x5d2bc0['push'](_0x392b78[0x1]);_0x5d2bc0[_0xb6bd('0x21')](_0x392b78[0x2]);_0x5d2bc0['push'](_0x392b78[0x3]);_0x5d2bc0[_0xb6bd('0x21')](_0x392b78[_0xb6bd('0x22')](0x4,_0x392b78[_0xb6bd('0x1b')])['join'](','));break;case _0xb6bd('0x17'):_0x5d2bc0[_0xb6bd('0x21')](_0x4a8c59[_0xb6bd('0x26')]);break;case _0xb6bd('0x29'):_0x5d2bc0[_0xb6bd('0x21')](_0x4a8c59['TagId']);_0x5d2bc0[_0xb6bd('0x21')](_0x4a8c59['appdata']);break;default:_0x5d2bc0=_[_0xb6bd('0xf')](_0x4a8c59[_0xb6bd('0x26')])?[]:_0x4a8c59['appdata'][_0xb6bd('0x28')](',');}var _0x1e2200={'id':util[_0xb6bd('0xd')](_0xb6bd('0x2a'),_0x3dd902,_0x4a8c59['id'],_0x4a8c59[_0xb6bd('0x1c')]),'condition':require('./interval')[_0xb6bd('0x2b')](_0x3dd902,getIntervals(_0x199ece[_0xb6bd('0x2c')],_0x4a8c59),_0x199ece),'consequence':require(_0xb6bd('0x2d')+_0x4a8c59[_0xb6bd('0x1c')])[_0xb6bd('0x2e')](_0x3dd902,_0x5d2bc0,_0x199ece,_0x2b3c60),'p':_0x4a8c59['priority']||0x0};logger[_0xb6bd('0x2f')](_0xb6bd('0x30'),_0x1e2200['id'],'on\x20interval',getIntervals(_0x199ece['intervals'],_0x4a8c59)['join']('\x20|\x20'));_0x216c93[_0xb6bd('0x21')](_0x1e2200);}else{logger[_0xb6bd('0x31')](_0xb6bd('0x32'),path[_0xb6bd('0x23')](__dirname,_0xb6bd('0x19'),_0x4a8c59['app']+_0xb6bd('0x1d')));}}_0x199ece['rules'][_0x3dd902]=new RuleEngine(_0x216c93);_0x199ece[_0xb6bd('0x15')][_0x3dd902][_0xb6bd('0x33')](_0x2b3c60,function(_0x4faea9){logger[_0xb6bd('0x2f')](_0xb6bd('0x34'),JSON[_0xb6bd('0x35')](_0x4faea9[_0xb6bd('0x36')]));if(_0x199ece[_0xb6bd('0x15')][_0x3dd902]){_0x199ece[_0xb6bd('0x15')][_0x3dd902][_0xb6bd('0x37')](_0xb6bd('0x38'));}});return _0x15a3ed({'code':0xc8,'message':_0x2b3c60});}else{logger[_0xb6bd('0x2f')](_0xb6bd('0x39'));return _0x15a3ed({'code':0xc8,'message':_0x2b3c60});}}catch(_0x76efb0){logger[_0xb6bd('0x31')](_0x76efb0['stack']);return _0x406b3b(_0x216512[_0xb6bd('0x31')](0x1f4,_0x76efb0));}}return _0x406b3b(_0xb6bd('0x3a'));});},'AcceptMessage':function(_0x21541c){var _0x2a2d75=this;return new Promise(function(_0x2770ae,_0x15323f){if(_0x21541c['agent']&&_0x21541c['agent']['id']){if(_0x199ece['agents'][_0x21541c['agent']['id']]){_0x199ece[_0xb6bd('0x3b')][_0x21541c['agent']['id']][_0xb6bd('0x3c')]=![];_0x199ece[_0xb6bd('0x3b')][_0x21541c[_0xb6bd('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x21541c[_0xb6bd('0x17')]&&_0x21541c[_0xb6bd('0x17')]['id']){try{var _0x36eb86=getId(_0x21541c[_0xb6bd('0x16')],_0x21541c[_0xb6bd('0x17')]?_0x21541c[_0xb6bd('0x17')]['id']:0x0,_0x21541c[_0xb6bd('0x18')]?_0x21541c[_0xb6bd('0x18')]['id']:0x0);if(_0x199ece[_0xb6bd('0x15')][_0x36eb86]){_0x199ece[_0xb6bd('0x15')][_0x36eb86][_0xb6bd('0x37')]('end');if(rpc[_0x21541c['channel']+_0xb6bd('0x3e')]){rpc[_0x21541c[_0xb6bd('0x16')]+_0xb6bd('0x3e')][_0xb6bd('0x3f')](_0x36eb86,{'UserId':_0x21541c[_0xb6bd('0x17')][_0xb6bd('0x40')]})['catch'](function(_0x11aac1){logger[_0xb6bd('0x31')](_0xb6bd('0x41'));});}}return _0x2770ae({'code':0xc8,'message':_0x21541c});}catch(_0x56864a){logger[_0xb6bd('0x31')](_0x56864a['stack']);return _0x15323f(_0x2a2d75[_0xb6bd('0x31')](0x1f4,_0x56864a));}}logger[_0xb6bd('0x31')]('message\x20is\x20empty');return _0x15323f(_0x2a2d75[_0xb6bd('0x31')](0x1f4,_0xb6bd('0x42')));});},'RejectMessage':function(_0x317f7d){var _0x5480f8=this;return new Promise(function(_0x336712,_0x5097d0){if(_0x317f7d['agent']&&_0x317f7d[_0xb6bd('0x3d')]['id']){try{if(_0x199ece[_0xb6bd('0x3b')][_0x317f7d['agent']['id']]){_0x199ece[_0xb6bd('0x3b')][_0x317f7d[_0xb6bd('0x3d')]['id']]['busy']=![];_0x199ece[_0xb6bd('0x3b')][_0x317f7d[_0xb6bd('0x3d')]['id']]['busyQueue']=undefined;}return _0x336712({'code':0xc8,'message':_0x317f7d});}catch(_0x44a2d4){logger[_0xb6bd('0x31')](_0x44a2d4['stack']);return _0x5097d0(_0x5480f8[_0xb6bd('0x31')](0x1f4,_0x44a2d4));}}logger[_0xb6bd('0x31')](_0xb6bd('0x42'));return _0x5097d0(_0x5480f8[_0xb6bd('0x31')](0x1f4,_0xb6bd('0x42')));});},'AbandonInteraction':function(_0x3371f8){var _0xa12c2b=this;return new Promise(function(_0x3c37d3,_0x497be1){if(_0x3371f8[_0xb6bd('0x16')]&&_0x3371f8['interaction']&&_0x3371f8[_0xb6bd('0x18')]['id']){try{var _0x134543=getId(_0x3371f8[_0xb6bd('0x16')],_0x3371f8[_0xb6bd('0x17')]?_0x3371f8[_0xb6bd('0x17')]['id']:0x0,_0x3371f8[_0xb6bd('0x18')]?_0x3371f8[_0xb6bd('0x18')]['id']:0x0);if(_0x199ece[_0xb6bd('0x15')][_0x134543]){_0x199ece[_0xb6bd('0x15')][_0x134543]['emit'](_0xb6bd('0x43'));}return _0x3c37d3({'code':0xc8,'message':_0x3371f8});}catch(_0x264497){logger['error'](_0x264497[_0xb6bd('0x44')]);return _0x497be1(_0xa12c2b[_0xb6bd('0x31')](0x1f4,_0x264497));}}logger[_0xb6bd('0x31')](_0xb6bd('0x42'));return _0x497be1(_0xa12c2b['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3064c6){var _0x4c36fb=this;return new Promise(function(_0xc972dc,_0x293d){if(_0x199ece[_0xb6bd('0x3b')]['hasOwnProperty'](_0x3064c6['id'])){for(var _0x33aefd in _0x3064c6[_0xb6bd('0x45')]){if(_0x3064c6['capacity'][_0xb6bd('0x46')](_0x33aefd)){if(_0x199ece[_0xb6bd('0x3b')][_0x3064c6['id']][_0xb6bd('0x46')](_0x33aefd+_0xb6bd('0x47'))){_0x199ece[_0xb6bd('0x3b')][_0x3064c6['id']][_0x33aefd+'CurrentCapacity']=parseInt(_0x3064c6[_0xb6bd('0x45')][_0x33aefd],0xa);}}}_0x199ece[_0xb6bd('0x3b')][_0x3064c6['id']]['updateRealtime']();return _0xc972dc({'code':0xc8,'message':_0x199ece[_0xb6bd('0x3b')][_0x3064c6['id']]});}else{return _0x293d(_0x4c36fb[_0xb6bd('0x31')](0x1f4,_0xb6bd('0x48')));}});},'Agents':function(_0x4b4ded){return new Promise(function(_0x2330a6,_0x240ef7){var _0x9cd6f6=_[_0xb6bd('0x49')](_0x199ece['agents']);_0x2330a6({'count':_0x9cd6f6[_0xb6bd('0x1b')],'rows':_0x9cd6f6});});},'ChatQueues':function(_0x3ea0ae){return new Promise(function(_0x309b4e,_0x679e4d){var _0x5af34f=[];for(var _0xdf9d3 in _0x199ece[_0xb6bd('0x4a')]){if(_0x199ece[_0xb6bd('0x4a')]['hasOwnProperty'](_0xdf9d3)){var _0x41fe96=_0x199ece[_0xb6bd('0x4a')][_0xdf9d3];var _0x16adde={'id':_0x41fe96['id'],'available':_0x41fe96['available'],'loggedIn':_0x41fe96[_0xb6bd('0x4b')],'name':_0x41fe96[_0xb6bd('0x4c')],'paused':_0x41fe96[_0xb6bd('0x4d')],'waiting':_0x41fe96[_0xb6bd('0x4e')]};_0x5af34f[_0xb6bd('0x21')](_0x16adde);}}_0x309b4e({'count':_0x5af34f[_0xb6bd('0x1b')],'rows':_0x5af34f});});},'MailQueues':function(_0x32bb3e){return new Promise(function(_0x2bcbfc,_0x22d2e1){var _0x474171=[];for(var _0x25590c in _0x199ece[_0xb6bd('0x4f')]){if(_0x199ece[_0xb6bd('0x4f')][_0xb6bd('0x46')](_0x25590c)){var _0x1a3af2=_0x199ece[_0xb6bd('0x4f')][_0x25590c];var _0x51f4ee={'id':_0x1a3af2['id'],'available':_0x1a3af2['available'],'loggedIn':_0x1a3af2['loggedIn'],'name':_0x1a3af2[_0xb6bd('0x4c')],'paused':_0x1a3af2['paused'],'waiting':_0x1a3af2[_0xb6bd('0x4e')]};_0x474171[_0xb6bd('0x21')](_0x51f4ee);}}_0x2bcbfc({'count':_0x474171[_0xb6bd('0x1b')],'rows':_0x474171});});},'OpenchannelQueues':function(_0xe4c878){return new Promise(function(_0x39c16f,_0x576f61){var _0x146652=[];for(var _0x3e1a21 in _0x199ece[_0xb6bd('0x50')]){if(_0x199ece[_0xb6bd('0x50')]['hasOwnProperty'](_0x3e1a21)){var _0x523037=_0x199ece['openchannelQueues'][_0x3e1a21];var _0x8646a0={'id':_0x523037['id'],'available':_0x523037['available'],'loggedIn':_0x523037[_0xb6bd('0x4b')],'name':_0x523037[_0xb6bd('0x4c')],'paused':_0x523037[_0xb6bd('0x4d')],'waiting':_0x523037[_0xb6bd('0x4e')]};_0x146652[_0xb6bd('0x21')](_0x8646a0);}}_0x39c16f({'count':_0x146652[_0xb6bd('0x1b')],'rows':_0x146652});});},'SmsQueues':function(_0x1b7656){return new Promise(function(_0x38349c,_0x2e9fc5){var _0x3c61a7=[];for(var _0x54d5d8 in _0x199ece[_0xb6bd('0x51')]){if(_0x199ece[_0xb6bd('0x51')][_0xb6bd('0x46')](_0x54d5d8)){var _0x280248=_0x199ece[_0xb6bd('0x51')][_0x54d5d8];var _0x168305={'id':_0x280248['id'],'available':_0x280248[_0xb6bd('0x52')],'loggedIn':_0x280248[_0xb6bd('0x4b')],'name':_0x280248[_0xb6bd('0x4c')],'paused':_0x280248[_0xb6bd('0x4d')],'waiting':_0x280248[_0xb6bd('0x4e')]};_0x3c61a7['push'](_0x168305);}}_0x38349c({'count':_0x3c61a7[_0xb6bd('0x1b')],'rows':_0x3c61a7});});},'FaxQueues':function(_0x25442b){return new Promise(function(_0x3c4b7d,_0x2864e7){var _0x12cce1=[];for(var _0x2e173b in _0x199ece['faxQueues']){if(_0x199ece[_0xb6bd('0x53')][_0xb6bd('0x46')](_0x2e173b)){var _0x505f75=_0x199ece['faxQueues'][_0x2e173b];var _0x1c2a09={'id':_0x505f75['id'],'available':_0x505f75['available'],'loggedIn':_0x505f75[_0xb6bd('0x4b')],'name':_0x505f75[_0xb6bd('0x4c')],'paused':_0x505f75[_0xb6bd('0x4d')],'waiting':_0x505f75['waiting']};_0x12cce1[_0xb6bd('0x21')](_0x1c2a09);}}_0x3c4b7d({'count':_0x12cce1['length'],'rows':_0x12cce1});});},'WhatsappQueues':function(_0x580dc8){return new Promise(function(_0x2b9f4f,_0x55d6c2){var _0x8acd35=[];for(var _0x2ad853 in _0x199ece[_0xb6bd('0x54')]){if(_0x199ece[_0xb6bd('0x54')]['hasOwnProperty'](_0x2ad853)){var _0x5e0def=_0x199ece[_0xb6bd('0x54')][_0x2ad853];var _0x129786={'id':_0x5e0def['id'],'available':_0x5e0def['available'],'loggedIn':_0x5e0def[_0xb6bd('0x4b')],'name':_0x5e0def[_0xb6bd('0x4c')],'paused':_0x5e0def[_0xb6bd('0x4d')],'waiting':_0x5e0def[_0xb6bd('0x4e')]};_0x8acd35[_0xb6bd('0x21')](_0x129786);}}_0x2b9f4f({'count':_0x8acd35[_0xb6bd('0x1b')],'rows':_0x8acd35});});},'ChatQueuesWaitingInteractions':function(_0x438f7c){return new Promise(function(_0x255863,_0x364a3a){var _0xe07cad=_[_0xb6bd('0x49')](_0x199ece[_0xb6bd('0x55')]);_0x255863({'count':_0xe07cad[_0xb6bd('0x1b')],'rows':_0xe07cad});});},'MailQueuesWaitingInteractions':function(_0xd60641){return new Promise(function(_0x510f4f,_0x3aa11f){var _0x3ab277=_[_0xb6bd('0x49')](_0x199ece[_0xb6bd('0x56')]);_0x510f4f({'count':_0x3ab277[_0xb6bd('0x1b')],'rows':_0x3ab277});});},'OpenchannelQueuesWaitingInteractions':function(_0x571fff){return new Promise(function(_0xf86f58,_0x4b7c73){var _0x4352f8=_[_0xb6bd('0x49')](_0x199ece[_0xb6bd('0x57')]);_0xf86f58({'count':_0x4352f8['length'],'rows':_0x4352f8});});},'SmsQueuesWaitingInteractions':function(_0x4655a1){return new Promise(function(_0x115fac,_0x14e805){var _0x1f851e=_[_0xb6bd('0x49')](_0x199ece['smsQueuesWaitingInteractions']);_0x115fac({'count':_0x1f851e[_0xb6bd('0x1b')],'rows':_0x1f851e});});},'FaxQueuesWaitingInteractions':function(_0x41a714){return new Promise(function(_0x59f8f4,_0x4ef9f6){var _0xbcd9f6=_['values'](_0x199ece['faxQueuesWaitingInteractions']);_0x59f8f4({'count':_0xbcd9f6[_0xb6bd('0x1b')],'rows':_0xbcd9f6});});},'WhatsappQueuesWaitingInteractions':function(_0x211cf0){return new Promise(function(_0x2c7900,_0xa265eb){var _0x5ce046=_[_0xb6bd('0x49')](_0x199ece[_0xb6bd('0x58')]);_0x2c7900({'count':_0x5ce046[_0xb6bd('0x1b')],'rows':_0x5ce046});});}};var _0x29efe5=jayson[_0xb6bd('0x59')](_0x1bac02)[_0xb6bd('0x5a')]();_0x29efe5['on']('error',function(_0x4f1a98){logger['error'](JSON[_0xb6bd('0x35')](_0x4f1a98));return _0x6e40f4(_0x4f1a98);});_0x29efe5[_0xb6bd('0x14')](0x232c,_0xb6bd('0x5b'),function(){console[_0xb6bd('0x5c')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x44b932(_0xb6bd('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x282b=['rules','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','interval','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under'];(function(_0x47efc0,_0x4a798f){var _0x4e31af=function(_0x4ac2f1){while(--_0x4ac2f1){_0x47efc0['push'](_0x47efc0['shift']());}};_0x4e31af(++_0x4a798f);}(_0x282b,0xec));var _0xb282=function(_0x1a2b42,_0x1e57e1){_0x1a2b42=_0x1a2b42-0x0;var _0x61c9b9=_0x282b[_0x1a2b42];return _0x61c9b9;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var fs=require('fs');var jayson=require(_0xb282('0x3'));var BPromise=require(_0xb282('0x4'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0xb282('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xb282('0x6')),'mailQueueReport':require(_0xb282('0x7')),'chatQueueReport':require(_0xb282('0x8')),'smsQueueReport':require(_0xb282('0x9')),'faxQueueReport':require(_0xb282('0xa')),'whatsappQueueReport':require(_0xb282('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x4a0d28,_0x17fba1,_0x436eaa){return util['format'](_0xb282('0xc'),_0x4a0d28,_0x17fba1||0x0,_0x436eaa||0x0);}function getIntervals(_0x20f517,_0x3435fc){var _0x2d86ba=[];if(!_['isNil'](_0x3435fc['IntervalId'])&&!_[_0xb282('0xd')](_0x20f517[_0x3435fc[_0xb282('0xe')]])&&!_[_0xb282('0xd')](_0x20f517[_0x3435fc[_0xb282('0xe')]][_0xb282('0xf')])){_0x2d86ba=_['map'](_0x20f517[_0x3435fc['IntervalId']][_0xb282('0xf')],_0xb282('0x10'));}else if(!_[_0xb282('0xd')](_0x3435fc[_0xb282('0x10')])){_0x2d86ba=[_0x3435fc[_0xb282('0x10')]];}return _0x2d86ba;}exports['listen']=function(_0x34c595){_0x34c595['rules']={};return new BPromise(function(_0xe1d53,_0x211862){var _0x4af892={'Start':function(_0x525cfa){var _0x5bc7c3=this;return new Promise(function(_0x13cea1,_0x350676){if(_0x525cfa){try{var _0x7c20df=[];var _0xbb182=getId(_0x525cfa[_0xb282('0x11')],_0x525cfa['message']?_0x525cfa[_0xb282('0x12')]['id']:0x0,_0x525cfa[_0xb282('0x13')]?_0x525cfa[_0xb282('0x13')]['id']:0x0);if(_0x525cfa[_0xb282('0x14')]&&_[_0xb282('0x15')](_0x525cfa['applications'])&&_0x525cfa['applications'][_0xb282('0x16')]){for(var _0x2cdeb1=0x0;_0x2cdeb1<_0x525cfa['applications'][_0xb282('0x16')];_0x2cdeb1+=0x1){var _0x34b6c7=_0x525cfa[_0xb282('0x14')][_0x2cdeb1];if(fs[_0xb282('0x17')](path[_0xb282('0x18')](__dirname,'applications',_0x34b6c7[_0xb282('0x19')]+_0xb282('0x1a')))){var _0x1f3e12=[];switch(_0x34b6c7['app'][_0xb282('0x1b')]()){case _0xb282('0x1c'):var _0x3c55ad=_0x34b6c7[_0xb282('0x1d')][_0xb282('0x1e')](',');if(_0x525cfa['channel']==='mail'){_0x1f3e12[_0xb282('0x1f')](_0x3c55ad[0x0]);_0x1f3e12[_0xb282('0x1f')](_0x3c55ad[0x1]);_0x1f3e12['push'](_0x3c55ad['slice'](0x2,_0x3c55ad[_0xb282('0x16')])[_0xb282('0x18')](','));}else{_0x1f3e12[_0xb282('0x1f')](_0x3c55ad[0x0]);_0x1f3e12[_0xb282('0x1f')](_0x3c55ad[_0xb282('0x20')](0x1,_0x3c55ad[_0xb282('0x16')])['join'](','));}break;case _0xb282('0x21'):var _0x42015c=_0x34b6c7['appdata'][_0xb282('0x1e')](',');_0x1f3e12[_0xb282('0x1f')](_0x42015c[0x0]);_0x1f3e12[_0xb282('0x1f')](_0x42015c[0x1]);_0x1f3e12[_0xb282('0x1f')](_0x42015c['slice'](0x2,_0x42015c[_0xb282('0x16')])[_0xb282('0x18')](','));break;case _0xb282('0x22'):var _0x433ad5=_0x34b6c7[_0xb282('0x1d')][_0xb282('0x1e')](',');_0x1f3e12[_0xb282('0x1f')](_0x433ad5[0x0]);_0x1f3e12['push'](_0x433ad5[0x1]);_0x1f3e12[_0xb282('0x1f')](_0x433ad5[0x2]);_0x1f3e12[_0xb282('0x1f')](_0x433ad5[0x3]);_0x1f3e12[_0xb282('0x1f')](_0x433ad5[_0xb282('0x20')](0x4,_0x433ad5[_0xb282('0x16')])['join'](','));break;case _0xb282('0x23'):var _0x4acd96=_0x34b6c7[_0xb282('0x1d')][_0xb282('0x1e')](',');_0x1f3e12[_0xb282('0x1f')](_0x4acd96[0x0]);_0x1f3e12['push'](_0x4acd96[0x1]);_0x1f3e12[_0xb282('0x1f')](_0x4acd96[0x2]);_0x1f3e12['push'](_0x4acd96[0x3]);_0x1f3e12[_0xb282('0x1f')](_0x4acd96[_0xb282('0x20')](0x4,_0x4acd96[_0xb282('0x16')])[_0xb282('0x18')](','));break;case _0xb282('0x12'):_0x1f3e12[_0xb282('0x1f')](_0x34b6c7['appdata']);break;case _0xb282('0x24'):_0x1f3e12[_0xb282('0x1f')](_0x34b6c7['TagId']);_0x1f3e12['push'](_0x34b6c7[_0xb282('0x1d')]);break;default:_0x1f3e12=_[_0xb282('0xd')](_0x34b6c7[_0xb282('0x1d')])?[]:_0x34b6c7['appdata']['split'](',');}var _0x4ad54b={'id':util[_0xb282('0x25')](_0xb282('0x26'),_0xbb182,_0x34b6c7['id'],_0x34b6c7[_0xb282('0x19')]),'condition':require(_0xb282('0x27'))[_0xb282('0x28')](_0xbb182,getIntervals(_0x34c595[_0xb282('0x29')],_0x34b6c7),_0x34c595),'consequence':require(_0xb282('0x2a')+_0x34b6c7['app'])[_0xb282('0x2b')](_0xbb182,_0x1f3e12,_0x34c595,_0x525cfa),'p':_0x34b6c7['priority']||0x0};logger[_0xb282('0x2c')](_0xb282('0x2d'),_0x4ad54b['id'],_0xb282('0x2e'),getIntervals(_0x34c595['intervals'],_0x34b6c7)[_0xb282('0x18')]('\x20|\x20'));_0x7c20df[_0xb282('0x1f')](_0x4ad54b);}else{logger[_0xb282('0x2f')](_0xb282('0x30'),path[_0xb282('0x18')](__dirname,'applications',_0x34b6c7['app']+_0xb282('0x1a')));}}_0x34c595[_0xb282('0x31')][_0xbb182]=new RuleEngine(_0x7c20df);_0x34c595[_0xb282('0x31')][_0xbb182][_0xb282('0x32')](_0x525cfa,function(_0x488902){logger[_0xb282('0x2c')]('Applications\x20executed',JSON[_0xb282('0x33')](_0x488902[_0xb282('0x34')]));if(_0x34c595['rules'][_0xbb182]){_0x34c595[_0xb282('0x31')][_0xbb182][_0xb282('0x35')](_0xb282('0x36'));}});return _0x13cea1({'code':0xc8,'message':_0x525cfa});}else{logger[_0xb282('0x2c')](_0xb282('0x37'));return _0x13cea1({'code':0xc8,'message':_0x525cfa});}}catch(_0x23c6b8){logger[_0xb282('0x2f')](_0x23c6b8[_0xb282('0x38')]);return _0x350676(_0x5bc7c3[_0xb282('0x2f')](0x1f4,_0x23c6b8));}}return _0x350676(_0xb282('0x39'));});},'AcceptMessage':function(_0x461e17){var _0x91fe43=this;return new Promise(function(_0x1caff0,_0x138a72){if(_0x461e17[_0xb282('0x3a')]&&_0x461e17[_0xb282('0x3a')]['id']){if(_0x34c595[_0xb282('0x3b')][_0x461e17[_0xb282('0x3a')]['id']]){_0x34c595['agents'][_0x461e17[_0xb282('0x3a')]['id']]['busy']=![];_0x34c595[_0xb282('0x3b')][_0x461e17[_0xb282('0x3a')]['id']][_0xb282('0x3c')]=undefined;}}if(_0x461e17[_0xb282('0x12')]&&_0x461e17[_0xb282('0x12')]['id']){try{var _0x3ddf56=getId(_0x461e17['channel'],_0x461e17['message']?_0x461e17[_0xb282('0x12')]['id']:0x0,_0x461e17['interaction']?_0x461e17[_0xb282('0x13')]['id']:0x0);if(_0x34c595[_0xb282('0x31')][_0x3ddf56]){_0x34c595['rules'][_0x3ddf56][_0xb282('0x35')](_0xb282('0x3d'));if(rpc[_0x461e17[_0xb282('0x11')]+'QueueReport']){rpc[_0x461e17['channel']+_0xb282('0x3e')]['update'](_0x3ddf56,{'UserId':_0x461e17[_0xb282('0x12')][_0xb282('0x3f')]})[_0xb282('0x40')](function(_0x33f8cd){logger[_0xb282('0x2f')](_0xb282('0x41'));});}}return _0x1caff0({'code':0xc8,'message':_0x461e17});}catch(_0x4f7ea5){logger[_0xb282('0x2f')](_0x4f7ea5[_0xb282('0x38')]);return _0x138a72(_0x91fe43[_0xb282('0x2f')](0x1f4,_0x4f7ea5));}}logger['error'](_0xb282('0x42'));return _0x138a72(_0x91fe43['error'](0x1f4,_0xb282('0x42')));});},'RejectMessage':function(_0x4b0822){var _0x1bf51c=this;return new Promise(function(_0x4ac56f,_0x4f92c9){if(_0x4b0822['agent']&&_0x4b0822[_0xb282('0x3a')]['id']){try{if(_0x34c595[_0xb282('0x3b')][_0x4b0822[_0xb282('0x3a')]['id']]){_0x34c595[_0xb282('0x3b')][_0x4b0822['agent']['id']]['busy']=![];_0x34c595['agents'][_0x4b0822[_0xb282('0x3a')]['id']][_0xb282('0x3c')]=undefined;}return _0x4ac56f({'code':0xc8,'message':_0x4b0822});}catch(_0x3bed8d){logger[_0xb282('0x2f')](_0x3bed8d['stack']);return _0x4f92c9(_0x1bf51c[_0xb282('0x2f')](0x1f4,_0x3bed8d));}}logger[_0xb282('0x2f')]('message\x20is\x20empty');return _0x4f92c9(_0x1bf51c[_0xb282('0x2f')](0x1f4,_0xb282('0x42')));});},'AbandonInteraction':function(_0x16f66b){var _0x770c9e=this;return new Promise(function(_0x1d356e,_0x5522be){if(_0x16f66b[_0xb282('0x11')]&&_0x16f66b[_0xb282('0x13')]&&_0x16f66b[_0xb282('0x13')]['id']){try{var _0x22d129=getId(_0x16f66b[_0xb282('0x11')],_0x16f66b[_0xb282('0x12')]?_0x16f66b['message']['id']:0x0,_0x16f66b[_0xb282('0x13')]?_0x16f66b['interaction']['id']:0x0);if(_0x34c595[_0xb282('0x31')][_0x22d129]){_0x34c595[_0xb282('0x31')][_0x22d129]['emit'](_0xb282('0x3d'));}return _0x1d356e({'code':0xc8,'message':_0x16f66b});}catch(_0x3dd8cb){logger[_0xb282('0x2f')](_0x3dd8cb['stack']);return _0x5522be(_0x770c9e['error'](0x1f4,_0x3dd8cb));}}logger[_0xb282('0x2f')](_0xb282('0x42'));return _0x5522be(_0x770c9e[_0xb282('0x2f')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x2d3839){var _0x50944f=this;return new Promise(function(_0x46db52,_0xd6259a){if(_0x34c595['agents'][_0xb282('0x43')](_0x2d3839['id'])){for(var _0x532cd5 in _0x2d3839[_0xb282('0x44')]){if(_0x2d3839[_0xb282('0x44')][_0xb282('0x43')](_0x532cd5)){if(_0x34c595[_0xb282('0x3b')][_0x2d3839['id']][_0xb282('0x43')](_0x532cd5+_0xb282('0x45'))){_0x34c595['agents'][_0x2d3839['id']][_0x532cd5+_0xb282('0x45')]=parseInt(_0x2d3839['capacity'][_0x532cd5],0xa);}}}_0x34c595[_0xb282('0x3b')][_0x2d3839['id']][_0xb282('0x46')]();return _0x46db52({'code':0xc8,'message':_0x34c595['agents'][_0x2d3839['id']]});}else{return _0xd6259a(_0x50944f['error'](0x1f4,_0xb282('0x47')));}});},'Agents':function(_0x20a0b6){return new Promise(function(_0x14b501,_0x5225d7){var _0x593a93=_[_0xb282('0x48')](_0x34c595[_0xb282('0x3b')]);_0x14b501({'count':_0x593a93[_0xb282('0x16')],'rows':_0x593a93});});},'ChatQueues':function(_0x5d6a78){return new Promise(function(_0x3a1414,_0x5d5318){var _0x152e90=[];for(var _0x1de487 in _0x34c595[_0xb282('0x49')]){if(_0x34c595[_0xb282('0x49')][_0xb282('0x43')](_0x1de487)){var _0x2d0bb=_0x34c595[_0xb282('0x49')][_0x1de487];var _0x5c0bf1={'id':_0x2d0bb['id'],'available':_0x2d0bb[_0xb282('0x4a')],'loggedIn':_0x2d0bb[_0xb282('0x4b')],'name':_0x2d0bb[_0xb282('0x4c')],'paused':_0x2d0bb['paused'],'waiting':_0x2d0bb['waiting']};_0x152e90[_0xb282('0x1f')](_0x5c0bf1);}}_0x3a1414({'count':_0x152e90[_0xb282('0x16')],'rows':_0x152e90});});},'MailQueues':function(_0x1d2d00){return new Promise(function(_0x4f6431,_0x4b59b2){var _0x223aa7=[];for(var _0x22e565 in _0x34c595['mailQueues']){if(_0x34c595[_0xb282('0x4d')][_0xb282('0x43')](_0x22e565)){var _0x15c7b7=_0x34c595['mailQueues'][_0x22e565];var _0xaa37ca={'id':_0x15c7b7['id'],'available':_0x15c7b7[_0xb282('0x4a')],'loggedIn':_0x15c7b7['loggedIn'],'name':_0x15c7b7[_0xb282('0x4c')],'paused':_0x15c7b7[_0xb282('0x4e')],'waiting':_0x15c7b7[_0xb282('0x4f')]};_0x223aa7[_0xb282('0x1f')](_0xaa37ca);}}_0x4f6431({'count':_0x223aa7['length'],'rows':_0x223aa7});});},'OpenchannelQueues':function(_0x4a129d){return new Promise(function(_0xfdf710,_0x3c88ff){var _0x54e55c=[];for(var _0x3cdcf5 in _0x34c595[_0xb282('0x50')]){if(_0x34c595[_0xb282('0x50')][_0xb282('0x43')](_0x3cdcf5)){var _0x568e6d=_0x34c595[_0xb282('0x50')][_0x3cdcf5];var _0x1178c4={'id':_0x568e6d['id'],'available':_0x568e6d[_0xb282('0x4a')],'loggedIn':_0x568e6d['loggedIn'],'name':_0x568e6d[_0xb282('0x4c')],'paused':_0x568e6d[_0xb282('0x4e')],'waiting':_0x568e6d[_0xb282('0x4f')]};_0x54e55c['push'](_0x1178c4);}}_0xfdf710({'count':_0x54e55c[_0xb282('0x16')],'rows':_0x54e55c});});},'SmsQueues':function(_0x1208a7){return new Promise(function(_0x599757,_0x5d8532){var _0x1bb9b3=[];for(var _0x1ef276 in _0x34c595[_0xb282('0x51')]){if(_0x34c595[_0xb282('0x51')][_0xb282('0x43')](_0x1ef276)){var _0x456a22=_0x34c595[_0xb282('0x51')][_0x1ef276];var _0xbb4060={'id':_0x456a22['id'],'available':_0x456a22[_0xb282('0x4a')],'loggedIn':_0x456a22[_0xb282('0x4b')],'name':_0x456a22[_0xb282('0x4c')],'paused':_0x456a22[_0xb282('0x4e')],'waiting':_0x456a22[_0xb282('0x4f')]};_0x1bb9b3[_0xb282('0x1f')](_0xbb4060);}}_0x599757({'count':_0x1bb9b3[_0xb282('0x16')],'rows':_0x1bb9b3});});},'FaxQueues':function(_0x3a87ce){return new Promise(function(_0x4ccef5,_0x2cffa2){var _0x2c7986=[];for(var _0x3cf767 in _0x34c595[_0xb282('0x52')]){if(_0x34c595[_0xb282('0x52')][_0xb282('0x43')](_0x3cf767)){var _0x4179e0=_0x34c595[_0xb282('0x52')][_0x3cf767];var _0x2203e7={'id':_0x4179e0['id'],'available':_0x4179e0[_0xb282('0x4a')],'loggedIn':_0x4179e0[_0xb282('0x4b')],'name':_0x4179e0['name'],'paused':_0x4179e0[_0xb282('0x4e')],'waiting':_0x4179e0[_0xb282('0x4f')]};_0x2c7986[_0xb282('0x1f')](_0x2203e7);}}_0x4ccef5({'count':_0x2c7986[_0xb282('0x16')],'rows':_0x2c7986});});},'WhatsappQueues':function(_0x1e5c3a){return new Promise(function(_0x578702,_0x529afa){var _0x37432b=[];for(var _0x21166a in _0x34c595[_0xb282('0x53')]){if(_0x34c595[_0xb282('0x53')][_0xb282('0x43')](_0x21166a)){var _0x7cb26e=_0x34c595[_0xb282('0x53')][_0x21166a];var _0x4df661={'id':_0x7cb26e['id'],'available':_0x7cb26e['available'],'loggedIn':_0x7cb26e[_0xb282('0x4b')],'name':_0x7cb26e[_0xb282('0x4c')],'paused':_0x7cb26e['paused'],'waiting':_0x7cb26e['waiting']};_0x37432b[_0xb282('0x1f')](_0x4df661);}}_0x578702({'count':_0x37432b[_0xb282('0x16')],'rows':_0x37432b});});},'ChatQueuesWaitingInteractions':function(_0x2ff720){return new Promise(function(_0xad8c7d,_0x15d426){var _0x26066c=_[_0xb282('0x48')](_0x34c595['chatQueuesWaitingInteractions']);_0xad8c7d({'count':_0x26066c[_0xb282('0x16')],'rows':_0x26066c});});},'MailQueuesWaitingInteractions':function(_0x41c558){return new Promise(function(_0x2d7518,_0xc9f89a){var _0x257535=_[_0xb282('0x48')](_0x34c595[_0xb282('0x54')]);_0x2d7518({'count':_0x257535[_0xb282('0x16')],'rows':_0x257535});});},'OpenchannelQueuesWaitingInteractions':function(_0xb3d19a){return new Promise(function(_0x222203,_0x525567){var _0x1888c8=_[_0xb282('0x48')](_0x34c595[_0xb282('0x55')]);_0x222203({'count':_0x1888c8[_0xb282('0x16')],'rows':_0x1888c8});});},'SmsQueuesWaitingInteractions':function(_0xc5ed41){return new Promise(function(_0xb1394f,_0xa0f193){var _0x36bea3=_['values'](_0x34c595[_0xb282('0x56')]);_0xb1394f({'count':_0x36bea3[_0xb282('0x16')],'rows':_0x36bea3});});},'FaxQueuesWaitingInteractions':function(_0x458886){return new Promise(function(_0x313018,_0x314183){var _0x2cdceb=_['values'](_0x34c595[_0xb282('0x57')]);_0x313018({'count':_0x2cdceb[_0xb282('0x16')],'rows':_0x2cdceb});});},'WhatsappQueuesWaitingInteractions':function(_0x39c8a8){return new Promise(function(_0x552760,_0xbe0ab4){var _0x28677e=_['values'](_0x34c595[_0xb282('0x58')]);_0x552760({'count':_0x28677e[_0xb282('0x16')],'rows':_0x28677e});});}};var _0xd4fb06=jayson[_0xb282('0x59')](_0x4af892)[_0xb282('0x5a')]();_0xd4fb06['on'](_0xb282('0x2f'),function(_0x6361aa){logger['error'](JSON['stringify'](_0x6361aa));return _0x211862(_0x6361aa);});_0xd4fb06[_0xb282('0x5b')](0x232c,'127.0.0.1',function(){console[_0xb282('0x5c')](_0xb282('0x5d'),0x232c);return _0xe1d53(_0xb282('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 93fdb5c..0d0cb29 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 _0x9515=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','catch','rules','info'];(function(_0xb80efe,_0x27f4c5){var _0x89d6ff=function(_0x8111c3){while(--_0x8111c3){_0xb80efe['push'](_0xb80efe['shift']());}};_0x89d6ff(++_0x27f4c5);}(_0x9515,0x130));var _0x5951=function(_0x136a44,_0x407967){_0x136a44=_0x136a44-0x0;var _0x503b59=_0x9515[_0x136a44];return _0x503b59;};'use strict';var util=require(_0x5951('0x0'));var BPromise=require(_0x5951('0x1'));var jayson=require(_0x5951('0x2'));var _=require('lodash');var logger=require(_0x5951('0x3'))(_0x5951('0x4'));var client=jayson[_0x5951('0x5')][_0x5951('0x6')]({'port':0x232a});function request(_0x5dba28,_0x23b39c){return new BPromise(function(_0x3b075d,_0x344090){return client[_0x5951('0x7')](_0x5dba28,_0x23b39c)[_0x5951('0x8')](function(_0x1ec83d){if(_0x1ec83d[_0x5951('0x9')]){return _0x344090(_0x1ec83d[_0x5951('0x9')][_0x5951('0xa')]);}else{return _0x3b075d(_0x1ec83d[_0x5951('0xb')]);}})[_0x5951('0xc')](function(_0x176b2f){return _0x344090(_0x176b2f);});});}exports['condition']=function(_0x430217,_0x5c90de,_0x4786fe){return function(_0x2190d9){if(_0x4786fe[_0x5951('0xd')]&&!_0x4786fe['rules'][_0x430217]){logger[_0x5951('0xe')](_0x5951('0xf'),_0x430217);return _0x2190d9[_0x5951('0x10')]();}var _0x2805c5=[];for(var _0x1bbad=0x0;_0x1bbad<_0x5c90de['length'];_0x1bbad+=0x1){_0x2805c5[_0x5951('0x11')](request(_0x5951('0x12'),{'command':util['format'](_0x5951('0x13'),_0x5c90de[_0x1bbad])})[_0x5951('0x8')](function(_0x424d1e){return _0x424d1e&&_0x424d1e[_0x5951('0xa')]&&_0x424d1e[_0x5951('0xa')][_0x5951('0x14')](_0x5951('0x15'))>=0x0?!![]:![];})[_0x5951('0xc')](function(_0x2e26c){logger[_0x5951('0x9')](_0x5951('0x16'),_0x430217,_0x5c90de[_0x1bbad]);}));}BPromise['all'](_0x2805c5)[_0x5951('0x8')](function(_0x23f0b7){var _0x18bb32=_[_0x5951('0x17')](_0x23f0b7);logger[_0x5951('0xe')](_0x5951('0x18'),_0x430217,_0x5c90de[_0x5951('0x19')](_0x5951('0x1a')),_0x18bb32);_0x2190d9[_0x5951('0x1b')](_0x18bb32);})[_0x5951('0xc')](function(_0x179904){console['log'](_0x179904);logger[_0x5951('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x430217,_0x5c90de['join']('\x20|\x20'),_0x179904[_0x5951('0x1c')]);_0x2190d9[_0x5951('0x10')]();});};}; \ No newline at end of file +var _0x3673=['client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x3673,0xa9));var _0x3367=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x3673[_0xe896bf];return _0x4c7a8a;};'use strict';var util=require(_0x3367('0x0'));var BPromise=require(_0x3367('0x1'));var jayson=require(_0x3367('0x2'));var _=require(_0x3367('0x3'));var logger=require(_0x3367('0x4'))(_0x3367('0x5'));var client=jayson[_0x3367('0x6')][_0x3367('0x7')]({'port':0x232a});function request(_0x2a19dc,_0x20c918){return new BPromise(function(_0x5d9632,_0x501798){return client[_0x3367('0x8')](_0x2a19dc,_0x20c918)[_0x3367('0x9')](function(_0x488e5a){if(_0x488e5a[_0x3367('0xa')]){return _0x501798(_0x488e5a[_0x3367('0xa')]['message']);}else{return _0x5d9632(_0x488e5a[_0x3367('0xb')]);}})[_0x3367('0xc')](function(_0x5eb0c9){return _0x501798(_0x5eb0c9);});});}exports[_0x3367('0xd')]=function(_0x205f21,_0x4c7621,_0x4e3a5f){return function(_0x476dab){if(_0x4e3a5f[_0x3367('0xe')]&&!_0x4e3a5f[_0x3367('0xe')][_0x205f21]){logger[_0x3367('0xf')](_0x3367('0x10'),_0x205f21);return _0x476dab['stop']();}var _0x1d0acb=[];for(var _0x8335f7=0x0;_0x8335f7<_0x4c7621[_0x3367('0x11')];_0x8335f7+=0x1){_0x1d0acb[_0x3367('0x12')](request(_0x3367('0x13'),{'command':util[_0x3367('0x14')](_0x3367('0x15'),_0x4c7621[_0x8335f7])})[_0x3367('0x9')](function(_0xe90511){return _0xe90511&&_0xe90511[_0x3367('0x16')]&&_0xe90511[_0x3367('0x16')][_0x3367('0x17')](_0x3367('0x18'))>=0x0?!![]:![];})['catch'](function(_0x4691fc){logger[_0x3367('0xa')](_0x3367('0x19'),_0x205f21,_0x4c7621[_0x8335f7]);}));}BPromise[_0x3367('0x1a')](_0x1d0acb)[_0x3367('0x9')](function(_0x1dee6e){var _0x42dee6=_[_0x3367('0x1b')](_0x1dee6e);logger['info'](_0x3367('0x1c'),_0x205f21,_0x4c7621[_0x3367('0x1d')](_0x3367('0x1e')),_0x42dee6);_0x476dab[_0x3367('0x1f')](_0x42dee6);})[_0x3367('0xc')](function(_0x4a3fa9){console[_0x3367('0x20')](_0x4a3fa9);logger['error'](_0x3367('0x1c'),_0x205f21,_0x4c7621[_0x3367('0x1d')](_0x3367('0x1e')),_0x4a3fa9[_0x3367('0x21')]);_0x476dab[_0x3367('0x22')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7144b3a..ec62360 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 _0x4024=['push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','format','uniqueid','channel','interface','calleridnum','connectedlinenum','queue','then','type','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','reason','ringtime','talktime'];(function(_0x3d0293,_0x3d3c80){var _0x5aa8d3=function(_0x1e1a9a){while(--_0x1e1a9a){_0x3d0293['push'](_0x3d0293['shift']());}};_0x5aa8d3(++_0x3d3c80);}(_0x4024,0x89));var _0x4402=function(_0x26ed80,_0x5b73b6){_0x26ed80=_0x26ed80-0x0;var _0x2175c6=_0x4024[_0x26ed80];return _0x2175c6;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x3074ac,_0x2b36c7){utils['info'](util[_0x4402('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3074ac[_0x4402('0x3')],_0x3074ac[_0x4402('0x4')],_0x3074ac['queue'],_0x3074ac['membername'],_0x3074ac[_0x4402('0x5')],_0x3074ac[_0x4402('0x6')],_0x3074ac[_0x4402('0x7')],_0x3074ac['lastevent']));if(_0x3074ac[_0x4402('0x8')]){utils['getVoiceQueueByName'](_0x3074ac['queue'])[_0x4402('0x9')](function(_0x4c6ca4){if(_0x4c6ca4){_0x3074ac['type']=_0x4c6ca4[_0x4402('0xa')];_0x3074ac['agentacw']=_0x3074ac[_0x4402('0xb')]?_0x4c6ca4['acw']:![];_0x3074ac[_0x4402('0xc')]=_0x3074ac['agentacw']?_0x4c6ca4[_0x4402('0xd')]:0x0;}utils[_0x4402('0xe')]('CreateVoiceAgentReport',_0x3074ac);});}else{utils[_0x4402('0xe')](_0x4402('0xf'),_0x3074ac);}if(_0x2b36c7){delete transfers[_0x3074ac[_0x4402('0x3')]];}else{delete agents[_0x3074ac['destuniqueid']];}}exports[_0x4402('0x10')]=function(_0x34d952){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x12'),_0x34d952[_0x4402('0x3')]),_0x34d952);agents[_0x34d952[_0x4402('0x13')]]=_0x34d952;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x16')]=_0x4402('0x17');agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x7')]=null;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x18')]=null;utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x1a'),_0x34d952['uniqueid'],agents[_0x34d952['destuniqueid']][_0x4402('0x1b')],_0x34d952[_0x4402('0x13')]));}catch(_0x5681c5){utils[_0x4402('0x1c')](util[_0x4402('0x2')]('[%s][agents][agentcalled]',_0x34d952[_0x4402('0x3')]),_0x5681c5);}};exports['agentringnoanswer']=function(_0x55cc8c){try{if(!_[_0x4402('0x1d')](agents[_0x55cc8c[_0x4402('0x13')]])){utils[_0x4402('0x11')](util['format'](_0x4402('0x1e'),_0x55cc8c['uniqueid']),_0x55cc8c);utils['info'](util[_0x4402('0x2')](_0x4402('0x1f'),_0x55cc8c[_0x4402('0x3')],agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x1b')],_0x55cc8c[_0x4402('0x13')]));agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x20')]=!![];agents[_0x55cc8c[_0x4402('0x13')]]['agentringnoanswerAt']=utils[_0x4402('0x15')]();agents[_0x55cc8c['destuniqueid']][_0x4402('0x16')]=_0x4402('0x21');agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x22')]='timeout';agents[_0x55cc8c[_0x4402('0x13')]]['holdtime']=_0x55cc8c['ringtime']?parseInt(_0x55cc8c[_0x4402('0x23')])/0x3e8:0x0;agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x24')]=0x0;unanswered[_0x4402('0x25')](_0x55cc8c[_0x4402('0x13')]);}}catch(_0x514e41){utils[_0x4402('0x1c')](util['format'](_0x4402('0x1e'),_0x55cc8c[_0x4402('0x3')]),_0x514e41);}};exports[_0x4402('0x26')]=function(_0x48d20d){try{_[_0x4402('0x27')](agents,function(_0x6c87f6,_0x316239){if(_0x6c87f6[_0x4402('0x3')]==_0x48d20d[_0x4402('0x3')]&&!_[_0x4402('0x28')](unanswered,_0x6c87f6[_0x4402('0x13')])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x48d20d);utils['info'](util[_0x4402('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x48d20d[_0x4402('0x3')],_0x6c87f6['membername'],_0x6c87f6[_0x4402('0x13')]));_0x6c87f6[_0x4402('0x20')]=!![];_0x6c87f6[_0x4402('0x2a')]=utils[_0x4402('0x15')]();_0x6c87f6[_0x4402('0x16')]='abandoned';_0x6c87f6[_0x4402('0x22')]=_0x4402('0x2b');_0x6c87f6[_0x4402('0x2c')]=_0x48d20d['holdtime'];_0x6c87f6[_0x4402('0x24')]=0x0;writeDB(_0x6c87f6);}});}catch(_0x3383e3){utils['error'](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x3383e3);}};exports[_0x4402('0x2d')]=function(_0x170058){try{if(agents[_0x170058[_0x4402('0x13')]]){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058['uniqueid']),_0x170058);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x2f'),_0x170058['uniqueid'],agents[_0x170058[_0x4402('0x13')]][_0x4402('0x1b')],_0x170058['destuniqueid']));agents[_0x170058['destuniqueid']][_0x4402('0x30')]=utils[_0x4402('0x15')]();agents[_0x170058[_0x4402('0x13')]][_0x4402('0x7')]=_0x170058['connectedlinenum'];agents[_0x170058['destuniqueid']]['connectedlinename']=_0x170058[_0x4402('0x18')];agents[_0x170058[_0x4402('0x13')]][_0x4402('0x2c')]=_0x170058[_0x4402('0x23')];agents[_0x170058['destuniqueid']][_0x4402('0x16')]=_0x4402('0x31');_[_0x4402('0x27')](agents,function(_0x57843d,_0x2b92b7){if(_0x57843d['destuniqueid']!=_0x170058[_0x4402('0x13')]&&_0x57843d[_0x4402('0x3')]==_0x170058['uniqueid']){_0x57843d[_0x4402('0x24')]=0x0;_0x57843d['holdtime']=_0x170058[_0x4402('0x23')];_0x57843d[_0x4402('0x20')]=!![];_0x57843d['agentringnoanswerAt']=utils[_0x4402('0x15')]();_0x57843d[_0x4402('0x16')]=_0x4402('0x32');_0x57843d[_0x4402('0x22')]='answered_elsewhere';_0x57843d['answeredelsewheredestinationuniqueid']=_0x170058[_0x4402('0x13')];_0x57843d['answeredelsewheremembername']=_0x170058[_0x4402('0x1b')];writeDB(_0x57843d);}});}}catch(_0x2a6d78){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058[_0x4402('0x3')]),_0x2a6d78);}};exports[_0x4402('0xb')]=function(_0x390169){try{if(!_[_0x4402('0x1d')](agents[_0x390169[_0x4402('0x13')]])){utils['debug'](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169['uniqueid']),_0x390169);utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x390169[_0x4402('0x3')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x1b')],_0x390169[_0x4402('0x13')]));agents[_0x390169[_0x4402('0x13')]]['agentcomplete']=!![];agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')]=utils[_0x4402('0x15')]();agents[_0x390169[_0x4402('0x13')]][_0x4402('0x24')]=utils[_0x4402('0x35')](agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x30')]);agents[_0x390169[_0x4402('0x13')]]['reason']=_0x390169[_0x4402('0x22')];agents[_0x390169['destuniqueid']][_0x4402('0x16')]=_0x4402('0x36');writeDB(agents[_0x390169['destuniqueid']]);}}catch(_0x82f63a){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169[_0x4402('0x3')]),_0x82f63a);}};exports[_0x4402('0x37')]=function(_0x5b094b){try{if(!_[_0x4402('0x1d')](agents[_0x5b094b[_0x4402('0x38')]])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x5b094b);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x3a'),_0x5b094b['uniqueid'],agents[_0x5b094b['transfereruniqueid']]['membername'],agents[_0x5b094b['transfereruniqueid']][_0x4402('0x3')]));agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3b')]=!![];agents[_0x5b094b[_0x4402('0x38')]]['transfertype']=_0x4402('0x3c');agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3d')]=_0x5b094b[_0x4402('0x3e')];agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3f')]=agents[_0x5b094b[_0x4402('0x38')]]['uniqueid'];}}catch(_0x325b20){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x325b20);}};exports[_0x4402('0x40')]=function(_0x5477fd){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x41'),_0x5477fd[_0x4402('0x42')]),_0x5477fd);if(_0x5477fd[_0x4402('0x42')]==_0x5477fd[_0x4402('0x43')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['secondtransfereruniqueid']])){utils['info'](util[_0x4402('0x2')](_0x4402('0x44'),_0x5477fd[_0x4402('0x42')],agents[_0x5477fd['secondtransfereruniqueid']]['membername']));agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x46')]=_0x4402('0x47');agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x48')];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x42')];}if(_0x5477fd[_0x4402('0x49')]&&agents[_0x5477fd[_0x4402('0x49')]]){agents[_0x5477fd['transfereeuniqueid']][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfereeuniqueid']]=_[_0x4402('0x4b')](agents[_0x5477fd['transfereeuniqueid']]);transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x6')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4c')]=agents[_0x5477fd['secondtransfereruniqueid']][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]]['agentconnectAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4a')]=0x2;}}else if(_0x5477fd[_0x4402('0x45')]==_0x5477fd[_0x4402('0x4d')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['origtransfereruniqueid']])){utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5477fd[_0x4402('0x42')],agents[_0x5477fd[_0x4402('0x42')]]['membername']));agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x46')]='ATTENDED';agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x4e')];agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x45')];}if(_0x5477fd[_0x4402('0x4f')]&&agents[_0x5477fd['transfertargetuniqueid']]){agents[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfertargetuniqueid']]=_['clone'](agents[_0x5477fd[_0x4402('0x4f')]]);transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x42')]]['calleridnum'];transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x4c')]=agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x4f')]]['agentcalledAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x30')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x4f')]]['agententerreason']=0x2;}}}catch(_0x333a72){utils[_0x4402('0x1c')](util['format']('[%s][agents][attendedtransfer]',_0x5477fd[_0x4402('0x42')]),_0x333a72);}};exports['hangup']=function(_0x30569e){try{utils['debug'](util[_0x4402('0x2')](_0x4402('0x50'),_0x30569e[_0x4402('0x3')]),_0x30569e);if(agents[_0x30569e[_0x4402('0x3')]]&&agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]===_0x4402('0x21')){if(_0x30569e[_0x4402('0x51')]==='21'){agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x52');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x52');}utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e['uniqueid']][_0x4402('0x22')],agents[_0x30569e['uniqueid']][_0x4402('0x16')]));writeDB(agents[_0x30569e[_0x4402('0x3')]]);var _0x466755=unanswered[_0x4402('0x53')](_0x30569e['uniqueid']);if(_0x466755>-0x1){unanswered[_0x4402('0x54')](_0x466755,0x1);}}if(transfers[_0x30569e['uniqueid']]){transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0xb')]=!![];transfers[_0x30569e[_0x4402('0x3')]]['agentcompleteAt']=utils[_0x4402('0x15')]();transfers[_0x30569e['uniqueid']][_0x4402('0x24')]=utils[_0x4402('0x35')](transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x55');transfers[_0x30569e['uniqueid']][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],transfers[_0x30569e[_0x4402('0x3')]]['reason'],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]));writeDB(transfers[_0x30569e[_0x4402('0x3')]],!![]);}if(agents[_0x30569e['uniqueid']]&&agents[_0x30569e[_0x4402('0x3')]]['agentconnectAt']){agents[_0x30569e[_0x4402('0x3')]]['agentcomplete']=!![];agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')]=utils['now']();agents[_0x30569e[_0x4402('0x3')]]['talktime']=utils[_0x4402('0x35')](agents[_0x30569e[_0x4402('0x3')]]['agentcompleteAt'],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);agents[_0x30569e['uniqueid']][_0x4402('0x22')]=agents[_0x30569e[_0x4402('0x3')]]['transfer']?_0x4402('0x3b'):_0x4402('0x55');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')],agents[_0x30569e[_0x4402('0x3')]]['lastevent']));writeDB(agents[_0x30569e[_0x4402('0x3')]]);}}catch(_0xc3914e){utils['error'](util[_0x4402('0x2')]('[%s][agents][hangup]',_0x30569e[_0x4402('0x3')]),_0xc3914e);}}; \ No newline at end of file +var _0xb469=['agentringnoanswerAt','timeout','holdtime','ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswer','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','splice','diffTime','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout'];(function(_0x502459,_0x51feab){var _0x3db089=function(_0x111202){while(--_0x111202){_0x502459['push'](_0x502459['shift']());}};_0x3db089(++_0x51feab);}(_0xb469,0x13b));var _0x9b46=function(_0x9fd464,_0x6aff82){_0x9fd464=_0x9fd464-0x0;var _0x787442=_0xb469[_0x9fd464];return _0x787442;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var utils=require(_0x9b46('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34f477,_0x1a41e8){utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34f477[_0x9b46('0x5')],_0x34f477[_0x9b46('0x6')],_0x34f477['queue'],_0x34f477[_0x9b46('0x7')],_0x34f477[_0x9b46('0x8')],_0x34f477['calleridnum'],_0x34f477[_0x9b46('0x9')],_0x34f477['lastevent']));if(_0x34f477['queue']){utils[_0x9b46('0xa')](_0x34f477['queue'])[_0x9b46('0xb')](function(_0xb9d1b5){if(_0xb9d1b5){_0x34f477[_0x9b46('0xc')]=_0xb9d1b5['type'];_0x34f477[_0x9b46('0xd')]=_0x34f477['agentcomplete']?_0xb9d1b5[_0x9b46('0xe')]:![];_0x34f477['acwtime']=_0x34f477[_0x9b46('0xd')]?_0xb9d1b5['acwTimeout']:0x0;}utils[_0x9b46('0xf')](_0x9b46('0x10'),_0x34f477);});}else{utils['request'](_0x9b46('0x10'),_0x34f477);}if(_0x1a41e8){delete transfers[_0x34f477[_0x9b46('0x5')]];}else{delete agents[_0x34f477['destuniqueid']];}}exports[_0x9b46('0x11')]=function(_0x2cfb35){try{utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x13'),_0x2cfb35[_0x9b46('0x5')]),_0x2cfb35);agents[_0x2cfb35[_0x9b46('0x14')]]=_0x2cfb35;agents[_0x2cfb35[_0x9b46('0x14')]][_0x9b46('0x15')]=utils[_0x9b46('0x16')]();agents[_0x2cfb35[_0x9b46('0x14')]][_0x9b46('0x17')]=_0x9b46('0x18');agents[_0x2cfb35['destuniqueid']]['connectedlinenum']=null;agents[_0x2cfb35['destuniqueid']][_0x9b46('0x19')]=null;utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2cfb35['uniqueid'],agents[_0x2cfb35[_0x9b46('0x14')]]['membername'],_0x2cfb35['destuniqueid']));}catch(_0xfeb1b9){utils[_0x9b46('0x1a')](util['format'](_0x9b46('0x13'),_0x2cfb35[_0x9b46('0x5')]),_0xfeb1b9);}};exports['agentringnoanswer']=function(_0x55aece){try{if(!_[_0x9b46('0x1b')](agents[_0x55aece[_0x9b46('0x14')]])){utils[_0x9b46('0x12')](util['format']('[%s][agents][agentringnoanswer]',_0x55aece[_0x9b46('0x5')]),_0x55aece);utils['info'](util[_0x9b46('0x4')](_0x9b46('0x1c'),_0x55aece['uniqueid'],agents[_0x55aece[_0x9b46('0x14')]]['membername'],_0x55aece[_0x9b46('0x14')]));agents[_0x55aece[_0x9b46('0x14')]]['agentringnoanswer']=!![];agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x1d')]=utils[_0x9b46('0x16')]();agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x17')]=_0x9b46('0x1e');agents[_0x55aece[_0x9b46('0x14')]]['reason']=_0x9b46('0x1e');agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x1f')]=_0x55aece[_0x9b46('0x20')]?parseInt(_0x55aece[_0x9b46('0x20')])/0x3e8:0x0;agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x21')]=0x0;unanswered['push'](_0x55aece[_0x9b46('0x14')]);}}catch(_0xee519e){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x22'),_0x55aece[_0x9b46('0x5')]),_0xee519e);}};exports[_0x9b46('0x23')]=function(_0x17ba3d){try{_[_0x9b46('0x24')](agents,function(_0x20090a,_0x2e1c51){if(_0x20090a['uniqueid']==_0x17ba3d[_0x9b46('0x5')]&&!_[_0x9b46('0x25')](unanswered,_0x20090a[_0x9b46('0x14')])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x26'),_0x17ba3d[_0x9b46('0x5')]),_0x17ba3d);utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x27'),_0x17ba3d[_0x9b46('0x5')],_0x20090a['membername'],_0x20090a[_0x9b46('0x14')]));_0x20090a['agentringnoanswer']=!![];_0x20090a[_0x9b46('0x1d')]=utils[_0x9b46('0x16')]();_0x20090a[_0x9b46('0x17')]='abandoned';_0x20090a[_0x9b46('0x28')]=_0x9b46('0x29');_0x20090a[_0x9b46('0x1f')]=_0x17ba3d[_0x9b46('0x1f')];_0x20090a[_0x9b46('0x21')]=0x0;writeDB(_0x20090a);}});}catch(_0x5cb73f){utils['error'](util[_0x9b46('0x4')](_0x9b46('0x26'),_0x17ba3d[_0x9b46('0x5')]),_0x5cb73f);}};exports[_0x9b46('0x2a')]=function(_0x4fa731){try{if(agents[_0x4fa731[_0x9b46('0x14')]]){utils['debug'](util[_0x9b46('0x4')](_0x9b46('0x2b'),_0x4fa731[_0x9b46('0x5')]),_0x4fa731);utils[_0x9b46('0x3')](util['format'](_0x9b46('0x2c'),_0x4fa731['uniqueid'],agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x7')],_0x4fa731[_0x9b46('0x14')]));agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x2d')]=utils[_0x9b46('0x16')]();agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x9')]=_0x4fa731[_0x9b46('0x9')];agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x19')]=_0x4fa731['connectedlinename'];agents[_0x4fa731[_0x9b46('0x14')]]['holdtime']=_0x4fa731[_0x9b46('0x20')];agents[_0x4fa731[_0x9b46('0x14')]]['lastevent']=_0x9b46('0x2e');_['forIn'](agents,function(_0x416538,_0x493b0f){if(_0x416538[_0x9b46('0x14')]!=_0x4fa731[_0x9b46('0x14')]&&_0x416538[_0x9b46('0x5')]==_0x4fa731[_0x9b46('0x5')]){_0x416538[_0x9b46('0x21')]=0x0;_0x416538['holdtime']=_0x4fa731['ringtime'];_0x416538[_0x9b46('0x2f')]=!![];_0x416538['agentringnoanswerAt']=utils['now']();_0x416538['lastevent']='answered_elsewhere';_0x416538[_0x9b46('0x28')]='answered_elsewhere';_0x416538[_0x9b46('0x30')]=_0x4fa731['destuniqueid'];_0x416538[_0x9b46('0x31')]=_0x4fa731[_0x9b46('0x7')];writeDB(_0x416538);}});}}catch(_0x2e92aa){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x2b'),_0x4fa731[_0x9b46('0x5')]),_0x2e92aa);}};exports[_0x9b46('0x32')]=function(_0x148d86){try{if(!_['isNil'](agents[_0x148d86[_0x9b46('0x14')]])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x33'),_0x148d86[_0x9b46('0x5')]),_0x148d86);utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x34'),_0x148d86[_0x9b46('0x5')],agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x7')],_0x148d86[_0x9b46('0x14')]));agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x32')]=!![];agents[_0x148d86['destuniqueid']]['agentcompleteAt']=utils[_0x9b46('0x16')]();agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x21')]=utils['diffTime'](agents[_0x148d86['destuniqueid']][_0x9b46('0x35')],agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x2d')]);agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x28')]=_0x148d86[_0x9b46('0x28')];agents[_0x148d86['destuniqueid']][_0x9b46('0x17')]=_0x9b46('0x36');writeDB(agents[_0x148d86[_0x9b46('0x14')]]);}}catch(_0x47a938){utils[_0x9b46('0x1a')](util['format'](_0x9b46('0x33'),_0x148d86[_0x9b46('0x5')]),_0x47a938);}};exports[_0x9b46('0x37')]=function(_0x566bad){try{if(!_[_0x9b46('0x1b')](agents[_0x566bad[_0x9b46('0x38')]])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x39'),_0x566bad[_0x9b46('0x5')]),_0x566bad);utils['info'](util[_0x9b46('0x4')](_0x9b46('0x3a'),_0x566bad[_0x9b46('0x5')],agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x7')],agents[_0x566bad[_0x9b46('0x38')]]['uniqueid']));agents[_0x566bad[_0x9b46('0x38')]]['transfer']=!![];agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3b')]=_0x9b46('0x3c');agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3d')]=_0x566bad['extension'];agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3e')]=agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x5')];}}catch(_0x3f6b2f){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x39'),_0x566bad[_0x9b46('0x5')]),_0x3f6b2f);}};exports[_0x9b46('0x3f')]=function(_0x2f411f){try{utils['debug'](util['format']('[%s][agents][attendedtransfer]',_0x2f411f[_0x9b46('0x40')]),_0x2f411f);if(_0x2f411f['origtransfereruniqueid']==_0x2f411f[_0x9b46('0x41')]){if(!_['isNil'](agents[_0x2f411f[_0x9b46('0x42')]])){utils['info'](util[_0x9b46('0x4')](_0x9b46('0x43'),_0x2f411f[_0x9b46('0x40')],agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x7')]));agents[_0x2f411f['secondtransfereruniqueid']][_0x9b46('0x44')]=!![];agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x3b')]=_0x9b46('0x45');agents[_0x2f411f[_0x9b46('0x42')]]['transferexten']=_0x2f411f['origtransfererexten'];agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x3e')]=_0x2f411f[_0x9b46('0x40')];}if(_0x2f411f[_0x9b46('0x46')]&&agents[_0x2f411f[_0x9b46('0x46')]]){agents[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x47')]=0x1;transfers[_0x2f411f[_0x9b46('0x46')]]=_['clone'](agents[_0x2f411f[_0x9b46('0x46')]]);transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x48')]=agents[_0x2f411f['secondtransfereruniqueid']][_0x9b46('0x48')];transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x49')]=agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x49')];transfers[_0x2f411f[_0x9b46('0x46')]]['agentcalledAt']=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x2d')]=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x1f')]=0x0;transfers[_0x2f411f['transfereeuniqueid']][_0x9b46('0x47')]=0x2;}}else if(_0x2f411f['secondtransfereruniqueid']==_0x2f411f[_0x9b46('0x4a')]){if(!_['isNil'](agents[_0x2f411f[_0x9b46('0x40')]])){utils[_0x9b46('0x3')](util['format'](_0x9b46('0x43'),_0x2f411f[_0x9b46('0x40')],agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x7')]));agents[_0x2f411f[_0x9b46('0x40')]]['transfer']=!![];agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x3b')]='ATTENDED';agents[_0x2f411f['origtransfereruniqueid']][_0x9b46('0x3d')]=_0x2f411f[_0x9b46('0x4b')];agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x3e')]=_0x2f411f[_0x9b46('0x42')];}if(_0x2f411f[_0x9b46('0x4c')]&&agents[_0x2f411f[_0x9b46('0x4c')]]){agents[_0x2f411f[_0x9b46('0x4c')]]['agententerreason']=0x1;transfers[_0x2f411f['transfertargetuniqueid']]=_[_0x9b46('0x4d')](agents[_0x2f411f[_0x9b46('0x4c')]]);transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x48')]=agents[_0x2f411f['origtransfereruniqueid']][_0x9b46('0x48')];transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x49')]=agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x49')];transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x15')]=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x4c')]]['agentconnectAt']=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x4c')]][_0x9b46('0x1f')]=0x0;transfers[_0x2f411f[_0x9b46('0x4c')]][_0x9b46('0x47')]=0x2;}}}catch(_0x4e8756){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x2f411f['origtransfereruniqueid']),_0x4e8756);}};exports[_0x9b46('0x4e')]=function(_0x200607){try{utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x4f'),_0x200607[_0x9b46('0x5')]),_0x200607);if(agents[_0x200607[_0x9b46('0x5')]]&&agents[_0x200607[_0x9b46('0x5')]]['reason']===_0x9b46('0x1e')){if(_0x200607[_0x9b46('0x50')]==='21'){agents[_0x200607['uniqueid']][_0x9b46('0x28')]='rejected';agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x17')]=_0x9b46('0x51');}utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x200607['uniqueid'],agents[_0x200607[_0x9b46('0x5')]]['membername'],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')],agents[_0x200607['uniqueid']]['lastevent']));writeDB(agents[_0x200607['uniqueid']]);var _0x2978aa=unanswered['indexOf'](_0x200607['uniqueid']);if(_0x2978aa>-0x1){unanswered[_0x9b46('0x52')](_0x2978aa,0x1);}}if(transfers[_0x200607[_0x9b46('0x5')]]){transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x32')]=!![];transfers[_0x200607['uniqueid']][_0x9b46('0x35')]=utils[_0x9b46('0x16')]();transfers[_0x200607[_0x9b46('0x5')]]['talktime']=utils['diffTime'](transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x35')],transfers[_0x200607[_0x9b46('0x5')]]['agentconnectAt']);transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')]='agent';transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x17')]=_0x9b46('0x36');utils[_0x9b46('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x200607[_0x9b46('0x5')],transfers[_0x200607['uniqueid']][_0x9b46('0x7')],transfers[_0x200607[_0x9b46('0x5')]]['reason'],transfers[_0x200607['uniqueid']]['lastevent']));writeDB(transfers[_0x200607[_0x9b46('0x5')]],!![]);}if(agents[_0x200607['uniqueid']]&&agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x2d')]){agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x32')]=!![];agents[_0x200607['uniqueid']][_0x9b46('0x35')]=utils[_0x9b46('0x16')]();agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x21')]=utils[_0x9b46('0x53')](agents[_0x200607['uniqueid']][_0x9b46('0x35')],agents[_0x200607['uniqueid']][_0x9b46('0x2d')]);agents[_0x200607[_0x9b46('0x5')]]['reason']=agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x44')]?_0x9b46('0x44'):_0x9b46('0x54');agents[_0x200607['uniqueid']][_0x9b46('0x17')]='complete';utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x55'),_0x200607['uniqueid'],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x7')],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')],agents[_0x200607['uniqueid']][_0x9b46('0x17')]));writeDB(agents[_0x200607['uniqueid']]);}}catch(_0x420d61){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x4f'),_0x200607[_0x9b46('0x5')]),_0x420d61);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 76826b5..87bad5d 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 _0xe352=['CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','hangup','execif','gotoif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','UserId','request'];(function(_0x7c128c,_0x21d07b){var _0x27d7d3=function(_0xb57d8c){while(--_0xb57d8c){_0x7c128c['push'](_0x7c128c['shift']());}};_0x27d7d3(++_0x21d07b);}(_0xe352,0xc1));var _0x2e35=function(_0x3fd625,_0x30b612){_0x3fd625=_0x3fd625-0x0;var _0x2beebe=_0xe352[_0x3fd625];return _0x2beebe;};'use strict';var _=require(_0x2e35('0x0'));var util=require('util');var utils=require(_0x2e35('0x1'));var transfers=require(_0x2e35('0x2'));var dispositions=[_0x2e35('0x3'),'FAILED',_0x2e35('0x4'),_0x2e35('0x3'),_0x2e35('0x3'),_0x2e35('0x3'),_0x2e35('0x5'),_0x2e35('0x6'),'FAILED',_0x2e35('0x4'),_0x2e35('0x4')];var channels={};function writeDB(_0x26e072){var _0x5d6f67;if(transfers[_0x2e35('0x7')][_0x26e072[_0x2e35('0x8')]]){_0x5d6f67=_0x26e072['uniqueid'];_0x26e072['uniqueid']=transfers[_0x2e35('0x7')][_0x26e072[_0x2e35('0x8')]][_0x2e35('0x9')];}utils['info'](util[_0x2e35('0xa')](_0x2e35('0xb'),_0x26e072[_0x2e35('0x8')],_0x26e072[_0x2e35('0xc')],_0x26e072[_0x2e35('0xd')],_0x26e072[_0x2e35('0xe')],_0x26e072['interface'],_0x26e072[_0x2e35('0xf')],_0x26e072[_0x2e35('0x10')],_0x26e072[_0x2e35('0x11')]));if(_0x26e072[_0x2e35('0x12')]){utils['getUserByInternal'](_0x26e072['accountcode'])['then'](function(_0x3c52df){if(_0x3c52df){_0x26e072[_0x2e35('0x13')]=_0x3c52df['id'];}utils[_0x2e35('0x14')](_0x2e35('0x15'),_0x26e072);});}else{utils[_0x2e35('0x14')](_0x2e35('0x15'),_0x26e072);}if(channels[_0x26e072[_0x2e35('0x8')]]){delete channels[_0x26e072[_0x2e35('0x8')]];}else if(_0x5d6f67&&channels[_0x5d6f67]){delete transfers[_0x2e35('0x7')][_0x5d6f67];delete channels[_0x5d6f67];}}exports[_0x2e35('0x16')]=function(_0x164aa1){try{utils[_0x2e35('0x17')](util[_0x2e35('0xa')](_0x2e35('0x18'),_0x164aa1[_0x2e35('0x8')]),_0x164aa1);if(_0x164aa1[_0x2e35('0x8')]==_0x164aa1[_0x2e35('0x19')]&&_0x164aa1[_0x2e35('0xc')]!=_0x2e35('0x1a')){utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x1c'),_0x164aa1[_0x2e35('0x8')],_0x164aa1[_0x2e35('0x1d')],_0x164aa1[_0x2e35('0x1e')]));channels[_0x164aa1['uniqueid']]={'uniqueid':_0x164aa1['uniqueid'],'accountcode':_0x164aa1[_0x2e35('0x12')],'source':_0x164aa1[_0x2e35('0xf')],'destination':_0x164aa1[_0x2e35('0x1e')],'destinationcontext':_0x164aa1[_0x2e35('0x1d')],'channel':_0x164aa1[_0x2e35('0xc')],'starttime':utils[_0x2e35('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2e35('0x3'),'amaflags':_0x2e35('0x20')};}}catch(_0x5b78d1){utils[_0x2e35('0x21')](util['format']('[%s][calls][newchannel]',_0x164aa1[_0x2e35('0x8')]),_0x5b78d1);}};exports[_0x2e35('0x22')]=function(_0x13469f){try{utils[_0x2e35('0x17')](util[_0x2e35('0xa')](_0x2e35('0x23'),_0x13469f['uniqueid']),_0x13469f);if(!_[_0x2e35('0x24')](channels[_0x13469f[_0x2e35('0x8')]])&&_0x13469f['channelstate']==0x6){utils[_0x2e35('0x1b')](util['format'](_0x2e35('0x25'),_0x13469f[_0x2e35('0x8')],_0x13469f[_0x2e35('0x1d')],_0x13469f[_0x2e35('0xc')]));if(_[_0x2e35('0x24')](channels[_0x13469f[_0x2e35('0x8')]][_0x2e35('0x26')])){channels[_0x13469f[_0x2e35('0x8')]][_0x2e35('0x26')]=utils[_0x2e35('0x1f')]();}}else if(!_[_0x2e35('0x24')](channels[_0x13469f[_0x2e35('0x19')]])&&_0x13469f['channelstate']==0x6&&_0x13469f['context']!=_0x2e35('0x27')){utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x28'),_0x13469f[_0x2e35('0x8')],_0x13469f[_0x2e35('0x19')],_0x13469f[_0x2e35('0x1d')],_0x13469f[_0x2e35('0xc')]));channels[_0x13469f[_0x2e35('0x19')]]['accountcode']=_0x13469f[_0x2e35('0x12')];channels[_0x13469f[_0x2e35('0x19')]][_0x2e35('0x29')]=_0x13469f[_0x2e35('0xc')];if(_[_0x2e35('0x24')](channels[_0x13469f[_0x2e35('0x19')]]['answertime'])){channels[_0x13469f[_0x2e35('0x19')]]['answertime']=utils[_0x2e35('0x1f')]();}channels[_0x13469f[_0x2e35('0x19')]][_0x2e35('0x2a')]=dispositions[_[_0x2e35('0x2b')](_0x13469f['channelstate'])]||_0x2e35('0x5');}}catch(_0x24665f){utils[_0x2e35('0x21')](util[_0x2e35('0xa')]('[%s][calls][newstate]',_0x13469f[_0x2e35('0x8')]),_0x24665f);}};exports['hangup']=function(_0x30b5ad){try{if(!_[_0x2e35('0x24')](channels[_0x30b5ad['uniqueid']])){utils[_0x2e35('0x17')](util['format'](_0x2e35('0x2c'),_0x30b5ad[_0x2e35('0x8')]),_0x30b5ad);if(_[_0x2e35('0x24')](channels[_0x30b5ad[_0x2e35('0x8')]][_0x2e35('0x2d')])){channels[_0x30b5ad[_0x2e35('0x8')]]['callerid']=_0x30b5ad['calleridname']+'\x20<'+_0x30b5ad[_0x2e35('0xf')]+'>';}utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x2e'),_0x30b5ad[_0x2e35('0x8')],channels[_0x30b5ad[_0x2e35('0x8')]][_0x2e35('0x2d')],_0x30b5ad[_0x2e35('0x2f')]));channels[_0x30b5ad[_0x2e35('0x8')]][_0x2e35('0x30')]=utils['now']();channels[_0x30b5ad[_0x2e35('0x8')]]['duration']=utils[_0x2e35('0x31')](channels[_0x30b5ad[_0x2e35('0x8')]][_0x2e35('0x30')],channels[_0x30b5ad[_0x2e35('0x8')]][_0x2e35('0x32')]);channels[_0x30b5ad[_0x2e35('0x8')]][_0x2e35('0x33')]=channels[_0x30b5ad[_0x2e35('0x8')]]['answertime']?utils[_0x2e35('0x31')](channels[_0x30b5ad[_0x2e35('0x8')]][_0x2e35('0x30')],channels[_0x30b5ad[_0x2e35('0x8')]]['answertime']):0x0;writeDB(channels[_0x30b5ad[_0x2e35('0x8')]]);}}catch(_0x4b13de){utils['error'](util[_0x2e35('0xa')]('[%s][calls][hangup]',_0x30b5ad[_0x2e35('0x8')]),_0x4b13de);}};exports['attendedtransfer']=function(_0x5b4502){try{if(!_[_0x2e35('0x24')](channels[_0x5b4502['localtwolinkedid']])){utils['debug'](util['format'](_0x2e35('0x34'),_0x5b4502['origtransfereruniqueid']),_0x5b4502);if(channels[_0x5b4502[_0x2e35('0x35')]][_0x2e35('0xc')]==_0x5b4502[_0x2e35('0x36')]){utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x37'),_0x5b4502[_0x2e35('0x38')],_0x5b4502[_0x2e35('0x35')],_0x5b4502[_0x2e35('0x39')]));channels[_0x5b4502['localtwolinkedid']]['destinationchannel']=_0x5b4502[_0x2e35('0x39')];channels[_0x5b4502[_0x2e35('0x35')]][_0x2e35('0x3a')]=_0x2e35('0x3b');}else if(channels[_0x5b4502[_0x2e35('0x35')]]['channel']=_0x5b4502[_0x2e35('0x3c')]){utils[_0x2e35('0x1b')](util['format'](_0x2e35('0x37'),_0x5b4502[_0x2e35('0x38')],_0x5b4502[_0x2e35('0x35')],_0x5b4502[_0x2e35('0x3d')]));channels[_0x5b4502[_0x2e35('0x35')]][_0x2e35('0x29')]=_0x5b4502[_0x2e35('0x3d')];channels[_0x5b4502[_0x2e35('0x35')]][_0x2e35('0x3a')]=_0x2e35('0x3b');}}}catch(_0x5e5691){utils['error'](util[_0x2e35('0xa')](_0x2e35('0x34'),_0x5b4502[_0x2e35('0x38')]),_0x5e5691);}};exports['musiconholdstart']=function(_0x483c09){try{if(!_['isNil'](channels[_0x483c09[_0x2e35('0x8')]])){utils[_0x2e35('0x17')](util[_0x2e35('0xa')](_0x2e35('0x3e'),_0x483c09[_0x2e35('0x8')]),_0x483c09);channels[_0x483c09[_0x2e35('0x8')]][_0x2e35('0x3f')]=utils[_0x2e35('0x1f')]();utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x40'),_0x483c09[_0x2e35('0x8')],channels[_0x483c09[_0x2e35('0x8')]][_0x2e35('0x3f')]));}}catch(_0x4edce9){utils[_0x2e35('0x21')](util[_0x2e35('0xa')]('[%s][calls][musiconholdstart]',_0x483c09[_0x2e35('0x8')]),_0x4edce9);}};exports[_0x2e35('0x41')]=function(_0x32cafe){try{if(!_[_0x2e35('0x24')](channels[_0x32cafe[_0x2e35('0x8')]])){utils[_0x2e35('0x17')](util[_0x2e35('0xa')](_0x2e35('0x42'),_0x32cafe['uniqueid']),_0x32cafe);if(!_['isNil'](channels[_0x32cafe[_0x2e35('0x8')]]['musiconholdstartAt'])){channels[_0x32cafe[_0x2e35('0x8')]][_0x2e35('0x43')]+=utils[_0x2e35('0x31')](utils['now'](),channels[_0x32cafe[_0x2e35('0x8')]][_0x2e35('0x3f')]);utils['info'](util[_0x2e35('0xa')](_0x2e35('0x44'),_0x32cafe[_0x2e35('0x8')],channels[_0x32cafe['uniqueid']][_0x2e35('0x43')]));delete channels[_0x32cafe[_0x2e35('0x8')]]['musiconholdstartAt'];}}}catch(_0x4aee47){utils[_0x2e35('0x21')](util['format']('[%s][calls][musiconholdstop]',_0x32cafe['uniqueid']),_0x4aee47);}};exports['varset']=function(_0x39a95d){try{if(!_[_0x2e35('0x24')](channels[_0x39a95d[_0x2e35('0x8')]])){utils[_0x2e35('0x17')](util[_0x2e35('0xa')](_0x2e35('0x45'),_0x39a95d[_0x2e35('0x8')]),_0x39a95d);if(!_[_0x2e35('0x24')](_0x39a95d[_0x2e35('0x46')]['xmd-originatecalleridnum'])){utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x47'),_0x39a95d[_0x2e35('0x8')],_0x39a95d[_0x2e35('0x48')]));channels[_0x39a95d[_0x2e35('0x8')]][_0x2e35('0x49')]=_0x39a95d['value'];}if(!_[_0x2e35('0x24')](_0x39a95d['variable']['xmd-phone'])){utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x4a'),_0x39a95d[_0x2e35('0x8')],_0x39a95d[_0x2e35('0x48')]));channels[_0x39a95d[_0x2e35('0x8')]][_0x2e35('0x4b')]=_0x39a95d[_0x2e35('0x48')];channels[_0x39a95d['uniqueid']]['callerid']='\x22'+_0x39a95d[_0x2e35('0x48')]+_0x2e35('0x4c')+_0x39a95d[_0x2e35('0x48')]+'>';}if(!_['isNil'](_0x39a95d[_0x2e35('0x46')]['xmd-callerid-preview'])||!_[_0x2e35('0x24')](_0x39a95d['variable']['xmd-callerid'])){utils['info'](util['format'](_0x2e35('0x4d'),_0x39a95d[_0x2e35('0x8')],!_[_0x2e35('0x24')](_0x39a95d['variable'][_0x2e35('0x4e')])?_0x2e35('0x4e'):_0x2e35('0x4f'),_0x39a95d[_0x2e35('0x48')]));channels[_0x39a95d['uniqueid']][_0x2e35('0x2d')]=_0x39a95d['value'];}if(!_[_0x2e35('0x24')](_0x39a95d[_0x2e35('0x46')][_0x2e35('0x50')])||!_[_0x2e35('0x24')](_0x39a95d[_0x2e35('0x46')][_0x2e35('0x51')])){utils[_0x2e35('0x1b')](util[_0x2e35('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x39a95d[_0x2e35('0x8')],!_['isNil'](_0x39a95d['variable']['xmd-queue'])?'xmd-queue':_0x2e35('0x51'),_0x39a95d[_0x2e35('0x48')]));channels[_0x39a95d[_0x2e35('0x8')]][_0x2e35('0x52')]='Queue';channels[_0x39a95d[_0x2e35('0x8')]][_0x2e35('0x53')]=_0x39a95d[_0x2e35('0x48')];channels[_0x39a95d['uniqueid']][_0x2e35('0xd')]=!![];}if(!_[_0x2e35('0x24')](_0x39a95d[_0x2e35('0x46')]['xmd-contactid'])){utils[_0x2e35('0x1b')](util['format'](_0x2e35('0x54'),_0x39a95d['uniqueid'],_0x39a95d[_0x2e35('0x48')]));channels[_0x39a95d[_0x2e35('0x8')]][_0x2e35('0x55')]=_0x39a95d[_0x2e35('0x48')];}if(!_[_0x2e35('0x24')](_0x39a95d[_0x2e35('0x46')][_0x2e35('0x56')])){utils[_0x2e35('0x1b')](util[_0x2e35('0xa')](_0x2e35('0x57'),_0x39a95d[_0x2e35('0x8')],_0x39a95d[_0x2e35('0x48')]));channels[_0x39a95d['uniqueid']][_0x2e35('0x58')]=_0x39a95d[_0x2e35('0x48')];}if(!_[_0x2e35('0x24')](_0x39a95d[_0x2e35('0x46')]['outboundrouteid'])){utils[_0x2e35('0x1b')](util['format'](_0x2e35('0x59'),_0x39a95d[_0x2e35('0x8')],_0x39a95d['value']));channels[_0x39a95d[_0x2e35('0x8')]]['routeid']=_0x39a95d['value'];}if(!_['isNil'](_0x39a95d[_0x2e35('0x46')][_0x2e35('0x5a')])){utils[_0x2e35('0x1b')](util['format'](_0x2e35('0x5b'),_0x39a95d['uniqueid'],_0x39a95d[_0x2e35('0x48')]));channels[_0x39a95d[_0x2e35('0x8')]][_0x2e35('0x5a')]=_0x39a95d[_0x2e35('0x48')];}}}catch(_0x47219d){utils[_0x2e35('0x21')](util[_0x2e35('0xa')](_0x2e35('0x45'),_0x39a95d[_0x2e35('0x8')]),_0x47219d);}};exports[_0x2e35('0x5c')]=function(_0x135fb4){try{if(!_[_0x2e35('0x24')](channels[_0x135fb4[_0x2e35('0x8')]])){utils[_0x2e35('0x17')](util[_0x2e35('0xa')](_0x2e35('0x5d'),_0x135fb4['uniqueid']),_0x135fb4);utils['info'](util[_0x2e35('0xa')](_0x2e35('0x5e'),_0x135fb4[_0x2e35('0x8')],_0x135fb4[_0x2e35('0x5f')],_0x135fb4[_0x2e35('0x60')]));if(_0x135fb4[_0x2e35('0x5f')][_0x2e35('0x61')]()==_0x2e35('0x62')&&_[_0x2e35('0x63')](_0x135fb4[_0x2e35('0x60')][_0x2e35('0x61')](),_0x2e35('0x64'))){var _0x197aa8=_0x135fb4[_0x2e35('0x60')][_0x2e35('0x65')]('=');var _0x3e5849=_0x197aa8[0x0]['substring'](_0x197aa8[0x0][_0x2e35('0x66')]('(')+0x1,_0x197aa8[0x0][_0x2e35('0x66')](')'));var _0x3faf3b=_0x197aa8[0x1];channels[_0x135fb4['uniqueid']][_0x3e5849]=_0x3faf3b;}if(!_[_0x2e35('0x67')]([_0x2e35('0x68'),'noop',_0x2e35('0x69'),_0x2e35('0x62'),_0x2e35('0x6a')],_0x135fb4[_0x2e35('0x5f')]['toLowerCase']())){channels[_0x135fb4['uniqueid']]['lastapplication']=_0x135fb4[_0x2e35('0x5f')];channels[_0x135fb4[_0x2e35('0x8')]][_0x2e35('0x53')]=_0x135fb4[_0x2e35('0x60')];}}}catch(_0x3d37c5){utils['error'](util['format'](_0x2e35('0x5d'),_0x135fb4[_0x2e35('0x8')]),_0x3d37c5);}}; \ No newline at end of file +var _0x6288=['disposition','toNumber','error','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','toLowerCase','lastdata','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','calleridnum','connectedlinenum','accountcode','then','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','channel','answertime'];(function(_0x2b4b73,_0x595be9){var _0x5f1b72=function(_0x4057a2){while(--_0x4057a2){_0x2b4b73['push'](_0x2b4b73['shift']());}};_0x5f1b72(++_0x595be9);}(_0x6288,0x1e0));var _0x8628=function(_0x4a13db,_0x912364){_0x4a13db=_0x4a13db-0x0;var _0x3bdc9e=_0x6288[_0x4a13db];return _0x3bdc9e;};'use strict';var _=require('lodash');var util=require(_0x8628('0x0'));var utils=require(_0x8628('0x1'));var transfers=require(_0x8628('0x2'));var dispositions=[_0x8628('0x3'),_0x8628('0x4'),'FAILED','NO\x20ANSWER',_0x8628('0x3'),_0x8628('0x3'),_0x8628('0x5'),'BUSY','FAILED',_0x8628('0x4'),_0x8628('0x4')];var channels={};function writeDB(_0x4e6f3d){var _0x28cfcb;if(transfers[_0x8628('0x6')][_0x4e6f3d['uniqueid']]){_0x28cfcb=_0x4e6f3d[_0x8628('0x7')];_0x4e6f3d[_0x8628('0x7')]=transfers[_0x8628('0x6')][_0x4e6f3d['uniqueid']][_0x8628('0x8')];}utils[_0x8628('0x9')](util['format'](_0x8628('0xa'),_0x4e6f3d[_0x8628('0x7')],_0x4e6f3d['channel'],_0x4e6f3d[_0x8628('0xb')],_0x4e6f3d[_0x8628('0xc')],_0x4e6f3d['interface'],_0x4e6f3d[_0x8628('0xd')],_0x4e6f3d[_0x8628('0xe')],_0x4e6f3d['lastevent']));if(_0x4e6f3d[_0x8628('0xf')]){utils['getUserByInternal'](_0x4e6f3d[_0x8628('0xf')])[_0x8628('0x10')](function(_0x48da26){if(_0x48da26){_0x4e6f3d['UserId']=_0x48da26['id'];}utils[_0x8628('0x11')](_0x8628('0x12'),_0x4e6f3d);});}else{utils[_0x8628('0x11')](_0x8628('0x12'),_0x4e6f3d);}if(channels[_0x4e6f3d['uniqueid']]){delete channels[_0x4e6f3d['uniqueid']];}else if(_0x28cfcb&&channels[_0x28cfcb]){delete transfers[_0x8628('0x6')][_0x28cfcb];delete channels[_0x28cfcb];}}exports[_0x8628('0x13')]=function(_0x3d702f){try{utils[_0x8628('0x14')](util[_0x8628('0x15')](_0x8628('0x16'),_0x3d702f[_0x8628('0x7')]),_0x3d702f);if(_0x3d702f[_0x8628('0x7')]==_0x3d702f[_0x8628('0x17')]&&_0x3d702f['channel']!=_0x8628('0x18')){utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x19'),_0x3d702f['uniqueid'],_0x3d702f['context'],_0x3d702f['exten']));channels[_0x3d702f[_0x8628('0x7')]]={'uniqueid':_0x3d702f[_0x8628('0x7')],'accountcode':_0x3d702f['accountcode'],'source':_0x3d702f['calleridnum'],'destination':_0x3d702f[_0x8628('0x1a')],'destinationcontext':_0x3d702f[_0x8628('0x1b')],'channel':_0x3d702f['channel'],'starttime':utils[_0x8628('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x8b449){utils['error'](util[_0x8628('0x15')](_0x8628('0x16'),_0x3d702f[_0x8628('0x7')]),_0x8b449);}};exports[_0x8628('0x1d')]=function(_0x338935){try{utils[_0x8628('0x14')](util[_0x8628('0x15')](_0x8628('0x1e'),_0x338935[_0x8628('0x7')]),_0x338935);if(!_[_0x8628('0x1f')](channels[_0x338935[_0x8628('0x7')]])&&_0x338935[_0x8628('0x20')]==0x6){utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x21'),_0x338935[_0x8628('0x7')],_0x338935[_0x8628('0x1b')],_0x338935['channel']));if(_['isNil'](channels[_0x338935['uniqueid']][_0x8628('0x22')])){channels[_0x338935[_0x8628('0x7')]]['systemanswertime']=utils[_0x8628('0x1c')]();}}else if(!_[_0x8628('0x1f')](channels[_0x338935[_0x8628('0x17')]])&&_0x338935[_0x8628('0x20')]==0x6&&_0x338935[_0x8628('0x1b')]!=_0x8628('0x23')){utils['info'](util[_0x8628('0x15')](_0x8628('0x24'),_0x338935['uniqueid'],_0x338935[_0x8628('0x17')],_0x338935['context'],_0x338935['channel']));channels[_0x338935['linkedid']][_0x8628('0xf')]=_0x338935['accountcode'];channels[_0x338935[_0x8628('0x17')]][_0x8628('0x25')]=_0x338935[_0x8628('0x26')];if(_['isNil'](channels[_0x338935[_0x8628('0x17')]][_0x8628('0x27')])){channels[_0x338935['linkedid']][_0x8628('0x27')]=utils[_0x8628('0x1c')]();}channels[_0x338935[_0x8628('0x17')]][_0x8628('0x28')]=dispositions[_[_0x8628('0x29')](_0x338935[_0x8628('0x20')])]||_0x8628('0x5');}}catch(_0x5d5577){utils[_0x8628('0x2a')](util[_0x8628('0x15')](_0x8628('0x1e'),_0x338935[_0x8628('0x7')]),_0x5d5577);}};exports['hangup']=function(_0x17cc7f){try{if(!_[_0x8628('0x1f')](channels[_0x17cc7f[_0x8628('0x7')]])){utils['debug'](util[_0x8628('0x15')](_0x8628('0x2b'),_0x17cc7f['uniqueid']),_0x17cc7f);if(_[_0x8628('0x1f')](channels[_0x17cc7f[_0x8628('0x7')]][_0x8628('0x2c')])){channels[_0x17cc7f['uniqueid']][_0x8628('0x2c')]=_0x17cc7f['calleridname']+'\x20<'+_0x17cc7f[_0x8628('0xd')]+'>';}utils['info'](util['format'](_0x8628('0x2d'),_0x17cc7f['uniqueid'],channels[_0x17cc7f[_0x8628('0x7')]]['callerid'],_0x17cc7f['cause-txt']));channels[_0x17cc7f[_0x8628('0x7')]]['endtime']=utils[_0x8628('0x1c')]();channels[_0x17cc7f[_0x8628('0x7')]][_0x8628('0x2e')]=utils[_0x8628('0x2f')](channels[_0x17cc7f[_0x8628('0x7')]][_0x8628('0x30')],channels[_0x17cc7f[_0x8628('0x7')]][_0x8628('0x31')]);channels[_0x17cc7f[_0x8628('0x7')]]['billableseconds']=channels[_0x17cc7f['uniqueid']][_0x8628('0x27')]?utils[_0x8628('0x2f')](channels[_0x17cc7f[_0x8628('0x7')]][_0x8628('0x30')],channels[_0x17cc7f[_0x8628('0x7')]][_0x8628('0x27')]):0x0;writeDB(channels[_0x17cc7f[_0x8628('0x7')]]);}}catch(_0xdecb5b){utils[_0x8628('0x2a')](util[_0x8628('0x15')](_0x8628('0x2b'),_0x17cc7f[_0x8628('0x7')]),_0xdecb5b);}};exports[_0x8628('0x32')]=function(_0x7939d){try{if(!_[_0x8628('0x1f')](channels[_0x7939d[_0x8628('0x33')]])){utils[_0x8628('0x14')](util[_0x8628('0x15')](_0x8628('0x34'),_0x7939d[_0x8628('0x35')]),_0x7939d);if(channels[_0x7939d[_0x8628('0x33')]][_0x8628('0x26')]==_0x7939d['transfereechannel']){utils['info'](util[_0x8628('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x7939d[_0x8628('0x35')],_0x7939d[_0x8628('0x33')],_0x7939d['secondtransfererchannel']));channels[_0x7939d[_0x8628('0x33')]]['destinationchannel']=_0x7939d[_0x8628('0x36')];channels[_0x7939d[_0x8628('0x33')]]['userfield']=_0x8628('0x37');}else if(channels[_0x7939d[_0x8628('0x33')]][_0x8628('0x26')]=_0x7939d['transfertargetchannel']){utils['info'](util[_0x8628('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x7939d[_0x8628('0x35')],_0x7939d[_0x8628('0x33')],_0x7939d[_0x8628('0x38')]));channels[_0x7939d[_0x8628('0x33')]][_0x8628('0x25')]=_0x7939d[_0x8628('0x38')];channels[_0x7939d['localtwolinkedid']][_0x8628('0x39')]=_0x8628('0x37');}}}catch(_0x5686c6){utils[_0x8628('0x2a')](util['format']('[%s][calls][attendedtransfer]',_0x7939d[_0x8628('0x35')]),_0x5686c6);}};exports[_0x8628('0x3a')]=function(_0x1a0e72){try{if(!_[_0x8628('0x1f')](channels[_0x1a0e72['uniqueid']])){utils['debug'](util[_0x8628('0x15')](_0x8628('0x3b'),_0x1a0e72['uniqueid']),_0x1a0e72);channels[_0x1a0e72[_0x8628('0x7')]][_0x8628('0x3c')]=utils[_0x8628('0x1c')]();utils[_0x8628('0x9')](util[_0x8628('0x15')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1a0e72['uniqueid'],channels[_0x1a0e72[_0x8628('0x7')]][_0x8628('0x3c')]));}}catch(_0x4fa0d1){utils[_0x8628('0x2a')](util['format']('[%s][calls][musiconholdstart]',_0x1a0e72[_0x8628('0x7')]),_0x4fa0d1);}};exports[_0x8628('0x3d')]=function(_0x4fe147){try{if(!_[_0x8628('0x1f')](channels[_0x4fe147[_0x8628('0x7')]])){utils[_0x8628('0x14')](util['format'](_0x8628('0x3e'),_0x4fe147[_0x8628('0x7')]),_0x4fe147);if(!_['isNil'](channels[_0x4fe147[_0x8628('0x7')]][_0x8628('0x3c')])){channels[_0x4fe147[_0x8628('0x7')]][_0x8628('0x3f')]+=utils[_0x8628('0x2f')](utils[_0x8628('0x1c')](),channels[_0x4fe147[_0x8628('0x7')]]['musiconholdstartAt']);utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x40'),_0x4fe147['uniqueid'],channels[_0x4fe147[_0x8628('0x7')]][_0x8628('0x3f')]));delete channels[_0x4fe147[_0x8628('0x7')]]['musiconholdstartAt'];}}}catch(_0x5cfa54){utils[_0x8628('0x2a')](util['format'](_0x8628('0x3e'),_0x4fe147['uniqueid']),_0x5cfa54);}};exports[_0x8628('0x41')]=function(_0x2abe80){try{if(!_[_0x8628('0x1f')](channels[_0x2abe80[_0x8628('0x7')]])){utils[_0x8628('0x14')](util[_0x8628('0x15')](_0x8628('0x42'),_0x2abe80[_0x8628('0x7')]),_0x2abe80);if(!_[_0x8628('0x1f')](_0x2abe80[_0x8628('0x43')][_0x8628('0x44')])){utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x45'),_0x2abe80['uniqueid'],_0x2abe80[_0x8628('0x46')]));channels[_0x2abe80[_0x8628('0x7')]][_0x8628('0x47')]=_0x2abe80['value'];}if(!_[_0x8628('0x1f')](_0x2abe80[_0x8628('0x43')]['xmd-phone'])){utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x48'),_0x2abe80['uniqueid'],_0x2abe80['value']));channels[_0x2abe80[_0x8628('0x7')]][_0x8628('0x49')]=_0x2abe80[_0x8628('0x46')];channels[_0x2abe80['uniqueid']][_0x8628('0x2c')]='\x22'+_0x2abe80[_0x8628('0x46')]+'\x22\x20<'+_0x2abe80[_0x8628('0x46')]+'>';}if(!_[_0x8628('0x1f')](_0x2abe80[_0x8628('0x43')]['xmd-callerid-preview'])||!_[_0x8628('0x1f')](_0x2abe80[_0x8628('0x43')]['xmd-callerid'])){utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x4a'),_0x2abe80[_0x8628('0x7')],!_[_0x8628('0x1f')](_0x2abe80['variable'][_0x8628('0x4b')])?_0x8628('0x4b'):_0x8628('0x4c'),_0x2abe80[_0x8628('0x46')]));channels[_0x2abe80[_0x8628('0x7')]][_0x8628('0x2c')]=_0x2abe80[_0x8628('0x46')];}if(!_[_0x8628('0x1f')](_0x2abe80['variable'][_0x8628('0x4d')])||!_[_0x8628('0x1f')](_0x2abe80['variable']['xmcs-queue'])){utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x4a'),_0x2abe80['uniqueid'],!_['isNil'](_0x2abe80[_0x8628('0x43')][_0x8628('0x4d')])?_0x8628('0x4d'):'xmcs-queue',_0x2abe80[_0x8628('0x46')]));channels[_0x2abe80[_0x8628('0x7')]][_0x8628('0x4e')]=_0x8628('0x4f');channels[_0x2abe80[_0x8628('0x7')]]['lastdata']=_0x2abe80[_0x8628('0x46')];channels[_0x2abe80[_0x8628('0x7')]][_0x8628('0xb')]=!![];}if(!_[_0x8628('0x1f')](_0x2abe80[_0x8628('0x43')]['xmd-contactid'])){utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x50'),_0x2abe80[_0x8628('0x7')],_0x2abe80[_0x8628('0x46')]));channels[_0x2abe80['uniqueid']][_0x8628('0x51')]=_0x2abe80['value'];}if(!_[_0x8628('0x1f')](_0x2abe80[_0x8628('0x43')][_0x8628('0x52')])){utils[_0x8628('0x9')](util[_0x8628('0x15')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2abe80[_0x8628('0x7')],_0x2abe80[_0x8628('0x46')]));channels[_0x2abe80[_0x8628('0x7')]][_0x8628('0x53')]=_0x2abe80[_0x8628('0x46')];}if(!_[_0x8628('0x1f')](_0x2abe80['variable'][_0x8628('0x54')])){utils[_0x8628('0x9')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2abe80[_0x8628('0x7')],_0x2abe80[_0x8628('0x46')]));channels[_0x2abe80['uniqueid']]['routeid']=_0x2abe80[_0x8628('0x46')];}if(!_[_0x8628('0x1f')](_0x2abe80[_0x8628('0x43')][_0x8628('0x55')])){utils['info'](util['format'](_0x8628('0x56'),_0x2abe80[_0x8628('0x7')],_0x2abe80['value']));channels[_0x2abe80[_0x8628('0x7')]][_0x8628('0x55')]=_0x2abe80[_0x8628('0x46')];}}}catch(_0x11681f){utils[_0x8628('0x2a')](util[_0x8628('0x15')](_0x8628('0x42'),_0x2abe80['uniqueid']),_0x11681f);}};exports[_0x8628('0x57')]=function(_0x516c14){try{if(!_['isNil'](channels[_0x516c14['uniqueid']])){utils[_0x8628('0x14')](util[_0x8628('0x15')](_0x8628('0x58'),_0x516c14[_0x8628('0x7')]),_0x516c14);utils[_0x8628('0x9')](util[_0x8628('0x15')](_0x8628('0x59'),_0x516c14[_0x8628('0x7')],_0x516c14['application'],_0x516c14[_0x8628('0x5a')]));if(_0x516c14[_0x8628('0x5b')]['toLowerCase']()==_0x8628('0x5c')&&_[_0x8628('0x5d')](_0x516c14[_0x8628('0x5a')]['toLowerCase'](),_0x8628('0x5e'))){var _0xcf4b79=_0x516c14[_0x8628('0x5a')][_0x8628('0x5f')]('=');var _0x298034=_0xcf4b79[0x0][_0x8628('0x60')](_0xcf4b79[0x0][_0x8628('0x61')]('(')+0x1,_0xcf4b79[0x0][_0x8628('0x61')](')'));var _0x5844ed=_0xcf4b79[0x1];channels[_0x516c14[_0x8628('0x7')]][_0x298034]=_0x5844ed;}if(!_[_0x8628('0x62')]([_0x8628('0x63'),_0x8628('0x64'),_0x8628('0x65'),'set','gotoif'],_0x516c14[_0x8628('0x5b')][_0x8628('0x66')]())){channels[_0x516c14[_0x8628('0x7')]][_0x8628('0x4e')]=_0x516c14[_0x8628('0x5b')];channels[_0x516c14[_0x8628('0x7')]][_0x8628('0x67')]=_0x516c14[_0x8628('0x5a')];}}}catch(_0x3427f4){utils['error'](util[_0x8628('0x15')](_0x8628('0x58'),_0x516c14[_0x8628('0x7')]),_0x3427f4);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 120fd27..ae620aa 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 _0x1aad=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close'];(function(_0x5bb0ff,_0x478a5a){var _0x284b29=function(_0x3824eb){while(--_0x3824eb){_0x5bb0ff['push'](_0x5bb0ff['shift']());}};_0x284b29(++_0x478a5a);}(_0x1aad,0x1ca));var _0xd1aa=function(_0x309991,_0x457e73){_0x309991=_0x309991-0x0;var _0x4ca94d=_0x1aad[_0x309991];return _0x4ca94d;};'use strict';var utils=require(_0xd1aa('0x0'));exports[_0xd1aa('0x1')]=function(){utils[_0xd1aa('0x2')](_0xd1aa('0x3'));};exports[_0xd1aa('0x4')]=function(){utils[_0xd1aa('0x2')](_0xd1aa('0x5'));};exports[_0xd1aa('0x6')]=function(){utils[_0xd1aa('0x2')](_0xd1aa('0x7'));};exports[_0xd1aa('0x8')]=function(_0x4f7963){utils[_0xd1aa('0x8')]('[core]\x20error',_0x4f7963);};exports[_0xd1aa('0x9')]=function(){utils[_0xd1aa('0x2')](_0xd1aa('0xa'));};exports[_0xd1aa('0xb')]=function(_0x1d548a){}; \ No newline at end of file +var _0x178a=['[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x3fad2f,_0x49d647){var _0x4849da=function(_0x4a0c00){while(--_0x4a0c00){_0x3fad2f['push'](_0x3fad2f['shift']());}};_0x4849da(++_0x49d647);}(_0x178a,0xcb));var _0xa178=function(_0x11f5b8,_0x1bb793){_0x11f5b8=_0x11f5b8-0x0;var _0x474820=_0x178a[_0x11f5b8];return _0x474820;};'use strict';var utils=require(_0xa178('0x0'));exports[_0xa178('0x1')]=function(){utils[_0xa178('0x2')]('[core]\x20connected');};exports[_0xa178('0x3')]=function(){utils[_0xa178('0x2')](_0xa178('0x4'));};exports[_0xa178('0x5')]=function(){utils[_0xa178('0x2')](_0xa178('0x6'));};exports[_0xa178('0x7')]=function(_0x406b0b){utils['error'](_0xa178('0x8'),_0x406b0b);};exports[_0xa178('0x9')]=function(){utils[_0xa178('0x2')]('[core]\x20close');};exports[_0xa178('0xa')]=function(_0x296b01){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c95275f..30b335f 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 _0xf015=['[%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','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','info','application','appdata','startsWith','toLowerCase','split','[%s][dials][newexten]','varset','isNil','variable','error','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','starttime','now','called','[%s][dials][dialend]','assign','connect'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xf015,0xf2));var _0x5f01=function(_0x359115,_0x20f863){_0x359115=_0x359115-0x0;var _0x49aaf5=_0xf015[_0x359115];return _0x49aaf5;};'use strict';var _=require(_0x5f01('0x0'));var util=require('util');var utils=require(_0x5f01('0x1'));var dials={};function writeDB(_0x2273b4){utils['info'](util[_0x5f01('0x2')](_0x5f01('0x3'),_0x2273b4[_0x5f01('0x4')],_0x2273b4[_0x5f01('0x5')],_0x2273b4[_0x5f01('0x6')],_0x2273b4[_0x5f01('0x7')],_0x2273b4[_0x5f01('0x8')],_0x2273b4[_0x5f01('0x9')]));utils[_0x5f01('0xa')](_0x5f01('0xb'),_0x2273b4);delete dials[_0x2273b4[_0x5f01('0x4')]];}exports[_0x5f01('0xc')]=function(_0x1e2154){try{utils[_0x5f01('0xd')](util[_0x5f01('0x2')]('[%s][dials][newexten]',_0x1e2154['uniqueid']),_0x1e2154);utils[_0x5f01('0xe')](util[_0x5f01('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1e2154['uniqueid'],_0x1e2154[_0x5f01('0xf')],_0x1e2154[_0x5f01('0x10')]));if(_0x1e2154[_0x5f01('0xf')]['toLowerCase']()=='set'&&_[_0x5f01('0x11')](_0x1e2154[_0x5f01('0x10')][_0x5f01('0x12')](),'cdr(routeid)')){var _0x5af6cf=_0x1e2154[_0x5f01('0x10')][_0x5f01('0x13')]('=');dials[_0x1e2154[_0x5f01('0x4')]]={'routeId':_0x5af6cf[0x1]};}}catch(_0x490250){utils['error'](util[_0x5f01('0x2')](_0x5f01('0x14'),_0x1e2154[_0x5f01('0x4')]),_0x490250);}};exports[_0x5f01('0x15')]=function(_0x36d785){try{utils[_0x5f01('0xd')](util[_0x5f01('0x2')]('[%s][dials][varset]',_0x36d785[_0x5f01('0x4')]),_0x36d785);if(!_[_0x5f01('0x16')](_0x36d785[_0x5f01('0x17')]['outboundrouteid'])){utils[_0x5f01('0xe')](util[_0x5f01('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x36d785[_0x5f01('0x4')],_0x36d785['value']));dials[_0x36d785[_0x5f01('0x4')]]={'routeId':_0x36d785['value']};}}catch(_0x5b920f){utils[_0x5f01('0x18')](util['format'](_0x5f01('0x19'),_0x36d785[_0x5f01('0x4')]),_0x5b920f);}};exports[_0x5f01('0x1a')]=function(_0x98ac0b){try{if(!_[_0x5f01('0x16')](dials[_0x98ac0b['uniqueid']])){utils[_0x5f01('0xd')](util[_0x5f01('0x2')](_0x5f01('0x1b'),_0x98ac0b[_0x5f01('0x4')]),_0x98ac0b);dials[_0x98ac0b[_0x5f01('0x4')]]=_['assign'](dials[_0x98ac0b[_0x5f01('0x4')]],_0x98ac0b);dials[_0x98ac0b[_0x5f01('0x4')]][_0x5f01('0x1c')]=utils[_0x5f01('0x1d')]();dials[_0x98ac0b['uniqueid']]['lastevent']=_0x5f01('0x1e');utils[_0x5f01('0xe')](util[_0x5f01('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x98ac0b[_0x5f01('0x4')],dials[_0x98ac0b['uniqueid']]['starttime']));}}catch(_0x29fb43){utils['error'](util[_0x5f01('0x2')]('[%s][dials][dialbegin]',_0x98ac0b[_0x5f01('0x4')]),_0x29fb43);}};exports['dialend']=function(_0x63637){try{if(!_[_0x5f01('0x16')](dials[_0x63637[_0x5f01('0x4')]])){utils['debug'](util['format'](_0x5f01('0x1f'),_0x63637['uniqueid']),_0x63637);dials[_0x63637[_0x5f01('0x4')]][_0x5f01('0x9')]=_0x63637['dialstatus'];if(_0x63637['dialstatus']=='ANSWER'){dials[_0x63637[_0x5f01('0x4')]]=_[_0x5f01('0x20')](dials[_0x63637[_0x5f01('0x4')]],_0x63637);dials[_0x63637[_0x5f01('0x4')]]['answertime']=utils['now']();dials[_0x63637[_0x5f01('0x4')]]['lastevent']=_0x5f01('0x21');utils[_0x5f01('0xe')](util['format'](_0x5f01('0x22'),_0x63637['uniqueid'],_0x63637[_0x5f01('0x9')],dials[_0x63637[_0x5f01('0x4')]][_0x5f01('0x23')]));}else{utils[_0x5f01('0xe')](util[_0x5f01('0x2')](_0x5f01('0x24'),_0x63637[_0x5f01('0x4')],_0x63637[_0x5f01('0x9')]));}}}catch(_0x163e26){utils[_0x5f01('0x18')](util['format'](_0x5f01('0x1f'),_0x63637[_0x5f01('0x4')]),_0x163e26);}};exports[_0x5f01('0x25')]=function(_0x23fa60){try{if(!_['isNil'](dials[_0x23fa60[_0x5f01('0x4')]])){utils[_0x5f01('0xd')](util[_0x5f01('0x2')](_0x5f01('0x26'),_0x23fa60[_0x5f01('0x4')]),_0x23fa60);utils[_0x5f01('0xe')](util[_0x5f01('0x2')](_0x5f01('0x27'),_0x23fa60['uniqueid'],_0x23fa60[_0x5f01('0x7')],_0x23fa60['calleridname'],_0x23fa60[_0x5f01('0x28')]));dials[_0x23fa60['uniqueid']]=_['assign'](dials[_0x23fa60[_0x5f01('0x4')]],{'endtime':utils[_0x5f01('0x1d')](),'lastevent':_0x5f01('0x29')});dials[_0x23fa60[_0x5f01('0x4')]][_0x5f01('0x2a')]=utils[_0x5f01('0x2b')](dials[_0x23fa60['uniqueid']][_0x5f01('0x2c')],dials[_0x23fa60[_0x5f01('0x4')]][_0x5f01('0x1c')]);dials[_0x23fa60[_0x5f01('0x4')]][_0x5f01('0x2d')]=utils[_0x5f01('0x2b')](dials[_0x23fa60[_0x5f01('0x4')]][_0x5f01('0x23')]||dials[_0x23fa60['uniqueid']]['endtime'],dials[_0x23fa60[_0x5f01('0x4')]][_0x5f01('0x1c')]);dials[_0x23fa60[_0x5f01('0x4')]]['billableseconds']=dials[_0x23fa60[_0x5f01('0x4')]][_0x5f01('0x23')]?utils['diffTime'](dials[_0x23fa60[_0x5f01('0x4')]][_0x5f01('0x2c')],dials[_0x23fa60['uniqueid']][_0x5f01('0x23')]):0x0;writeDB(dials[_0x23fa60[_0x5f01('0x4')]]);}}catch(_0x71bb99){utils[_0x5f01('0x18')](util[_0x5f01('0x2')](_0x5f01('0x26'),_0x23fa60[_0x5f01('0x4')]),_0x71bb99);}}; \ No newline at end of file +var _0xf50f=['startsWith','toLowerCase','cdr(routeid)','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','debug','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','now','duration','diffTime','endtime','[%s][dials][hangup]','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application'];(function(_0x124aa4,_0x26b916){var _0x95fd9e=function(_0x4c4197){while(--_0x4c4197){_0x124aa4['push'](_0x124aa4['shift']());}};_0x95fd9e(++_0x26b916);}(_0xf50f,0xb3));var _0xff50=function(_0x35fc93,_0xd24319){_0x35fc93=_0x35fc93-0x0;var _0x5f5ccb=_0xf50f[_0x35fc93];return _0x5f5ccb;};'use strict';var _=require(_0xff50('0x0'));var util=require(_0xff50('0x1'));var utils=require(_0xff50('0x2'));var dials={};function writeDB(_0x557ccc){utils['info'](util[_0xff50('0x3')](_0xff50('0x4'),_0x557ccc[_0xff50('0x5')],_0x557ccc[_0xff50('0x6')],_0x557ccc[_0xff50('0x7')],_0x557ccc['calleridnum'],_0x557ccc[_0xff50('0x8')],_0x557ccc[_0xff50('0x9')]));utils['request'](_0xff50('0xa'),_0x557ccc);delete dials[_0x557ccc[_0xff50('0x5')]];}exports[_0xff50('0xb')]=function(_0x1c3168){try{utils['debug'](util[_0xff50('0x3')](_0xff50('0xc'),_0x1c3168[_0xff50('0x5')]),_0x1c3168);utils[_0xff50('0xd')](util[_0xff50('0x3')](_0xff50('0xe'),_0x1c3168['uniqueid'],_0x1c3168['application'],_0x1c3168[_0xff50('0xf')]));if(_0x1c3168[_0xff50('0x10')]['toLowerCase']()=='set'&&_[_0xff50('0x11')](_0x1c3168['appdata'][_0xff50('0x12')](),_0xff50('0x13'))){var _0x5e525b=_0x1c3168['appdata']['split']('=');dials[_0x1c3168['uniqueid']]={'routeId':_0x5e525b[0x1]};}}catch(_0x5a41c9){utils['error'](util[_0xff50('0x3')](_0xff50('0xc'),_0x1c3168[_0xff50('0x5')]),_0x5a41c9);}};exports[_0xff50('0x14')]=function(_0x36ee83){try{utils['debug'](util[_0xff50('0x3')](_0xff50('0x15'),_0x36ee83['uniqueid']),_0x36ee83);if(!_[_0xff50('0x16')](_0x36ee83['variable'][_0xff50('0x17')])){utils[_0xff50('0xd')](util[_0xff50('0x3')](_0xff50('0x18'),_0x36ee83[_0xff50('0x5')],_0x36ee83[_0xff50('0x19')]));dials[_0x36ee83[_0xff50('0x5')]]={'routeId':_0x36ee83[_0xff50('0x19')]};}}catch(_0x41e3c3){utils[_0xff50('0x1a')](util['format']('[%s][dials][varset]',_0x36ee83['uniqueid']),_0x41e3c3);}};exports[_0xff50('0x1b')]=function(_0x553688){try{if(!_[_0xff50('0x16')](dials[_0x553688['uniqueid']])){utils[_0xff50('0x1c')](util[_0xff50('0x3')]('[%s][dials][dialbegin]',_0x553688[_0xff50('0x5')]),_0x553688);dials[_0x553688[_0xff50('0x5')]]=_[_0xff50('0x1d')](dials[_0x553688[_0xff50('0x5')]],_0x553688);dials[_0x553688[_0xff50('0x5')]][_0xff50('0x1e')]=utils['now']();dials[_0x553688['uniqueid']][_0xff50('0x1f')]=_0xff50('0x20');utils['info'](util[_0xff50('0x3')](_0xff50('0x21'),_0x553688[_0xff50('0x5')],dials[_0x553688[_0xff50('0x5')]][_0xff50('0x1e')]));}}catch(_0x101965){utils['error'](util[_0xff50('0x3')](_0xff50('0x22'),_0x553688[_0xff50('0x5')]),_0x101965);}};exports['dialend']=function(_0xf4f6f7){try{if(!_['isNil'](dials[_0xf4f6f7[_0xff50('0x5')]])){utils[_0xff50('0x1c')](util[_0xff50('0x3')](_0xff50('0x23'),_0xf4f6f7[_0xff50('0x5')]),_0xf4f6f7);dials[_0xf4f6f7[_0xff50('0x5')]][_0xff50('0x9')]=_0xf4f6f7[_0xff50('0x9')];if(_0xf4f6f7[_0xff50('0x9')]=='ANSWER'){dials[_0xf4f6f7['uniqueid']]=_[_0xff50('0x1d')](dials[_0xf4f6f7[_0xff50('0x5')]],_0xf4f6f7);dials[_0xf4f6f7[_0xff50('0x5')]][_0xff50('0x24')]=utils['now']();dials[_0xf4f6f7[_0xff50('0x5')]][_0xff50('0x1f')]=_0xff50('0x25');utils[_0xff50('0xd')](util[_0xff50('0x3')](_0xff50('0x26'),_0xf4f6f7[_0xff50('0x5')],_0xf4f6f7[_0xff50('0x9')],dials[_0xf4f6f7[_0xff50('0x5')]]['answertime']));}else{utils[_0xff50('0xd')](util[_0xff50('0x3')](_0xff50('0x27'),_0xf4f6f7[_0xff50('0x5')],_0xf4f6f7[_0xff50('0x9')]));}}}catch(_0x5c0a4c){utils['error'](util[_0xff50('0x3')](_0xff50('0x23'),_0xf4f6f7['uniqueid']),_0x5c0a4c);}};exports[_0xff50('0x28')]=function(_0x39410e){try{if(!_['isNil'](dials[_0x39410e[_0xff50('0x5')]])){utils[_0xff50('0x1c')](util['format']('[%s][dials][hangup]',_0x39410e[_0xff50('0x5')]),_0x39410e);utils[_0xff50('0xd')](util['format'](_0xff50('0x29'),_0x39410e[_0xff50('0x5')],_0x39410e['calleridnum'],_0x39410e[_0xff50('0x2a')],_0x39410e[_0xff50('0x2b')]));dials[_0x39410e[_0xff50('0x5')]]=_[_0xff50('0x1d')](dials[_0x39410e[_0xff50('0x5')]],{'endtime':utils[_0xff50('0x2c')](),'lastevent':'complete'});dials[_0x39410e[_0xff50('0x5')]][_0xff50('0x2d')]=utils[_0xff50('0x2e')](dials[_0x39410e[_0xff50('0x5')]][_0xff50('0x2f')],dials[_0x39410e[_0xff50('0x5')]][_0xff50('0x1e')]);dials[_0x39410e[_0xff50('0x5')]]['holdtime']=utils[_0xff50('0x2e')](dials[_0x39410e['uniqueid']]['answertime']||dials[_0x39410e[_0xff50('0x5')]][_0xff50('0x2f')],dials[_0x39410e['uniqueid']][_0xff50('0x1e')]);dials[_0x39410e['uniqueid']]['billableseconds']=dials[_0x39410e[_0xff50('0x5')]][_0xff50('0x24')]?utils[_0xff50('0x2e')](dials[_0x39410e[_0xff50('0x5')]][_0xff50('0x2f')],dials[_0x39410e[_0xff50('0x5')]]['answertime']):0x0;writeDB(dials[_0x39410e[_0xff50('0x5')]]);}}catch(_0x1ad3e1){utils[_0xff50('0x1a')](util[_0xff50('0x3')](_0xff50('0x30'),_0x39410e[_0xff50('0x5')]),_0x1ad3e1);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index be179d8..7dc50c0 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 _0x9b99=['uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','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]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]'];(function(_0x5c1ba5,_0xd499c6){var _0x573e6f=function(_0x46395a){while(--_0x46395a){_0x5c1ba5['push'](_0x5c1ba5['shift']());}};_0x573e6f(++_0xd499c6);}(_0x9b99,0x6c));var _0x99b9=function(_0x178350,_0x22ae5d){_0x178350=_0x178350-0x0;var _0x4cd415=_0x9b99[_0x178350];return _0x4cd415;};var AsteriskManager=require(_0x99b9('0x0'));var config=require(_0x99b9('0x1'));var utils=require(_0x99b9('0x2'));var util=require(_0x99b9('0x3'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x99b9('0x4')]['ip'],config[_0x99b9('0x4')][_0x99b9('0x5')],config[_0x99b9('0x4')][_0x99b9('0x6')],!![]);ami[_0x99b9('0x7')]();if(config['xdr']&&config[_0x99b9('0x8')][_0x99b9('0x9')]){utils['info'](_0x99b9('0xa'));}else{var agents=require(_0x99b9('0xb'));var calls=require(_0x99b9('0xc'));var queues=require('./queues.controller');var recordings=require(_0x99b9('0xd'));var members=require(_0x99b9('0xe'));var dials=require(_0x99b9('0xf'));var transfers=require(_0x99b9('0x10'));var core=require(_0x99b9('0x11'));ami['on'](_0x99b9('0x12'),core[_0x99b9('0x12')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x99b9('0x13'),core[_0x99b9('0x13')]);ami['on'](_0x99b9('0x14'),core[_0x99b9('0x14')]);ami['on']('close',core[_0x99b9('0x15')]);ami['on'](_0x99b9('0x16'),core[_0x99b9('0x16')]);ami['on'](_0x99b9('0x17'),function(_0xbbe247){try{utils[_0x99b9('0x18')](util['format']('[%s][index][devicestatechange]',_0xbbe247[_0x99b9('0x19')]),_0xbbe247);members[_0x99b9('0x17')](_0xbbe247);}catch(_0xeef5e7){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x1b'),_0xbbe247[_0x99b9('0x19')]),_0xeef5e7);}});ami['on'](_0x99b9('0x1c'),function(_0x476de8){try{utils[_0x99b9('0x18')](util['format'](_0x99b9('0x1d'),_0x476de8[_0x99b9('0x1e')]),_0x476de8);agents[_0x99b9('0x1c')](_0x476de8);}catch(_0x9c4c53){utils['error'](util['format']('[%s][index][agentcalled]',_0x476de8[_0x99b9('0x1e')]),_0x9c4c53);}});ami['on'](_0x99b9('0x1f'),function(_0x3aebbc){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x20'),_0x3aebbc['uniqueid']),_0x3aebbc);agents[_0x99b9('0x1f')](_0x3aebbc);}catch(_0xcb8afa){utils['error'](util[_0x99b9('0x1a')](_0x99b9('0x20'),_0x3aebbc[_0x99b9('0x1e')]),_0xcb8afa);}});ami['on'](_0x99b9('0x21'),function(_0x264c47){try{utils['debug'](util[_0x99b9('0x1a')]('[%s][index][agentconnect]',_0x264c47[_0x99b9('0x1e')]),_0x264c47);agents[_0x99b9('0x21')](_0x264c47);queues[_0x99b9('0x21')](_0x264c47);}catch(_0x15fc51){utils[_0x99b9('0x14')](util['format'](_0x99b9('0x22'),_0x264c47['uniqueid']),_0x15fc51);}});ami['on'](_0x99b9('0x23'),function(_0x31ada9){try{utils[_0x99b9('0x18')](util['format'](_0x99b9('0x24'),_0x31ada9[_0x99b9('0x1e')]),_0x31ada9);agents[_0x99b9('0x23')](_0x31ada9);queues[_0x99b9('0x23')](_0x31ada9);members[_0x99b9('0x23')](_0x31ada9);}catch(_0x4d9908){utils[_0x99b9('0x14')](util['format'](_0x99b9('0x24'),_0x31ada9[_0x99b9('0x1e')]),_0x4d9908);}});ami['on'](_0x99b9('0x25'),function(_0x5b74a2){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x26'),_0x5b74a2[_0x99b9('0x1e')]),_0x5b74a2);agents[_0x99b9('0x25')](_0x5b74a2);queues[_0x99b9('0x25')](_0x5b74a2);}catch(_0x3d2213){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x26'),_0x5b74a2[_0x99b9('0x1e')]),_0x3d2213);}});ami['on']('queuecallerjoin',function(_0xde0cf0){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')]('[%s][index][queuecallerjoin]',_0xde0cf0[_0x99b9('0x1e')]),_0xde0cf0);queues[_0x99b9('0x27')](_0xde0cf0);recordings[_0x99b9('0x27')](_0xde0cf0);}catch(_0x52879d){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x28'),_0xde0cf0[_0x99b9('0x1e')]),_0x52879d);}});ami['on'](_0x99b9('0x29'),function(_0x469158){try{utils['debug'](util[_0x99b9('0x1a')](_0x99b9('0x2a'),_0x469158[_0x99b9('0x1e')]),_0x469158);queues['queuecallerleave'](_0x469158);}catch(_0x2f7cda){utils['error'](util[_0x99b9('0x1a')](_0x99b9('0x2a'),_0x469158[_0x99b9('0x1e')]),_0x2f7cda);}});ami['on'](_0x99b9('0x2b'),function(_0x1eafa9){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')]('[%s][index][musiconholdstart]',_0x1eafa9[_0x99b9('0x1e')]),_0x1eafa9);queues['musiconholdstart'](_0x1eafa9);calls['musiconholdstart'](_0x1eafa9);}catch(_0x5054cf){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x2c'),_0x1eafa9[_0x99b9('0x1e')]),_0x5054cf);}});ami['on'](_0x99b9('0x2d'),function(_0xf3a895){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x2e'),_0xf3a895[_0x99b9('0x1e')]),_0xf3a895);queues[_0x99b9('0x2d')](_0xf3a895);calls[_0x99b9('0x2d')](_0xf3a895);}catch(_0x58c603){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x2e'),_0xf3a895[_0x99b9('0x1e')]),_0x58c603);}});ami['on'](_0x99b9('0x2f'),function(_0xd0334b){try{utils[_0x99b9('0x18')](util['format'](_0x99b9('0x30'),_0xd0334b[_0x99b9('0x1e')]),_0xd0334b);calls[_0x99b9('0x2f')](_0xd0334b);recordings[_0x99b9('0x2f')](_0xd0334b);}catch(_0x18bf44){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')]('[%s][index][newstate]',_0xd0334b['uniqueid']),_0x18bf44);}});ami['on'](_0x99b9('0x31'),function(_0x1032bb){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x32'),_0x1032bb[_0x99b9('0x1e')]),_0x1032bb);calls[_0x99b9('0x31')](_0x1032bb);recordings['hangup'](_0x1032bb);dials[_0x99b9('0x31')](_0x1032bb);agents['hangup'](_0x1032bb);queues['hangup'](_0x1032bb);}catch(_0x58e9b0){utils['error'](util[_0x99b9('0x1a')]('[%s][index][hangup]',_0x1032bb[_0x99b9('0x1e')]),_0x58e9b0);}});ami['on'](_0x99b9('0x33'),function(_0x58c68b){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x34'),_0x58c68b[_0x99b9('0x1e')]),_0x58c68b);members[_0x99b9('0x33')](_0x58c68b);}catch(_0x587922){utils['error'](util['format']('[%s][index][cdr]',_0x58c68b[_0x99b9('0x1e')]),_0x587922);}});ami['on'](_0x99b9('0x35'),function(_0x22e38a){try{utils['debug'](util[_0x99b9('0x1a')](_0x99b9('0x36'),_0x22e38a[_0x99b9('0x1e')]),_0x22e38a);queues[_0x99b9('0x35')](_0x22e38a);agents[_0x99b9('0x35')](_0x22e38a);transfers['blindtransfer'](_0x22e38a);}catch(_0x4fd071){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x36'),_0x22e38a['uniqueid']),_0x4fd071);}});ami['on'](_0x99b9('0x37'),function(_0x388fac){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x38'),_0x388fac[_0x99b9('0x39')]),_0x388fac);queues[_0x99b9('0x37')](_0x388fac);transfers[_0x99b9('0x37')](_0x388fac);agents[_0x99b9('0x37')](_0x388fac);calls[_0x99b9('0x37')](_0x388fac);}catch(_0x1965bd){utils[_0x99b9('0x14')](util['format'](_0x99b9('0x38'),_0x388fac[_0x99b9('0x39')]),_0x1965bd);}});ami['on'](_0x99b9('0x3a'),function(_0x15cd44){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x3b'),_0x15cd44['uniqueid']),_0x15cd44);queues[_0x99b9('0x3a')](_0x15cd44);recordings[_0x99b9('0x3a')](_0x15cd44);calls[_0x99b9('0x3a')](_0x15cd44);dials[_0x99b9('0x3a')](_0x15cd44);}catch(_0x2cff79){utils[_0x99b9('0x14')](util['format'](_0x99b9('0x3b'),_0x15cd44[_0x99b9('0x1e')]),_0x2cff79);}});ami['on'](_0x99b9('0x3c'),function(_0x432f23){try{utils['debug'](util['format'](_0x99b9('0x3d'),_0x432f23[_0x99b9('0x1e')]),_0x432f23);calls[_0x99b9('0x3c')](_0x432f23);recordings[_0x99b9('0x3c')](_0x432f23);dials['newexten'](_0x432f23);}catch(_0x5c59bb){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x3d'),_0x432f23[_0x99b9('0x1e')]),_0x5c59bb);}});ami['on'](_0x99b9('0x3e'),function(_0x67c0c1){try{utils['debug'](util[_0x99b9('0x1a')](_0x99b9('0x3f'),_0x67c0c1[_0x99b9('0x1e')]),_0x67c0c1);calls[_0x99b9('0x3e')](_0x67c0c1);recordings[_0x99b9('0x3e')](_0x67c0c1);}catch(_0x885e1b){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x3f'),_0x67c0c1[_0x99b9('0x1e')]),_0x885e1b);}});ami['on'](_0x99b9('0x40'),function(_0x16984e){try{utils[_0x99b9('0x18')](util[_0x99b9('0x1a')](_0x99b9('0x41'),_0x16984e[_0x99b9('0x1e')]),_0x16984e);dials[_0x99b9('0x40')](_0x16984e);}catch(_0x4c7081){utils[_0x99b9('0x14')](util[_0x99b9('0x1a')](_0x99b9('0x42'),_0x16984e[_0x99b9('0x1e')]),_0x4c7081);}});ami['on'](_0x99b9('0x43'),function(_0x1afc7d){try{utils[_0x99b9('0x18')](util['format'](_0x99b9('0x44'),_0x1afc7d[_0x99b9('0x1e')]),_0x1afc7d);dials[_0x99b9('0x43')](_0x1afc7d);}catch(_0x48b6a6){utils['error'](util['format']('[%s][index][dialend]',_0x1afc7d[_0x99b9('0x1e')]),_0x48b6a6);}});} \ No newline at end of file +var _0xe931=['[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','port','asterisk','username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave'];(function(_0x58acac,_0x19d9bf){var _0x23d7db=function(_0x21c957){while(--_0x21c957){_0x58acac['push'](_0x58acac['shift']());}};_0x23d7db(++_0x19d9bf);}(_0xe931,0x127));var _0x1e93=function(_0x610891,_0x559e26){_0x610891=_0x610891-0x0;var _0x56b558=_0xe931[_0x610891];return _0x56b558;};var AsteriskManager=require(_0x1e93('0x0'));var config=require(_0x1e93('0x1'));var utils=require(_0x1e93('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0x1e93('0x3')],config['asterisk']['ip'],config[_0x1e93('0x4')][_0x1e93('0x5')],config[_0x1e93('0x4')][_0x1e93('0x6')],!![]);ami['keepConnected']();if(config['xdr']&&config[_0x1e93('0x7')]['disabled']){utils[_0x1e93('0x8')](_0x1e93('0x9'));}else{var agents=require(_0x1e93('0xa'));var calls=require(_0x1e93('0xb'));var queues=require(_0x1e93('0xc'));var recordings=require(_0x1e93('0xd'));var members=require(_0x1e93('0xe'));var dials=require('./dials.controller');var transfers=require(_0x1e93('0xf'));var core=require(_0x1e93('0x10'));ami['on'](_0x1e93('0x11'),core[_0x1e93('0x11')]);ami['on']('shutdown',core[_0x1e93('0x12')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x1e93('0x13'),core[_0x1e93('0x13')]);ami['on'](_0x1e93('0x14'),core['close']);ami['on'](_0x1e93('0x15'),core[_0x1e93('0x15')]);ami['on']('devicestatechange',function(_0x20d4b1){try{utils['debug'](util[_0x1e93('0x16')]('[%s][index][devicestatechange]',_0x20d4b1['device']),_0x20d4b1);members['devicestatechange'](_0x20d4b1);}catch(_0x9bc66f){utils[_0x1e93('0x13')](util[_0x1e93('0x16')](_0x1e93('0x17'),_0x20d4b1[_0x1e93('0x18')]),_0x9bc66f);}});ami['on'](_0x1e93('0x19'),function(_0x1e5948){try{utils['debug'](util[_0x1e93('0x16')](_0x1e93('0x1a'),_0x1e5948[_0x1e93('0x1b')]),_0x1e5948);agents[_0x1e93('0x19')](_0x1e5948);}catch(_0x3f79b7){utils[_0x1e93('0x13')](util['format']('[%s][index][agentcalled]',_0x1e5948[_0x1e93('0x1b')]),_0x3f79b7);}});ami['on'](_0x1e93('0x1c'),function(_0x44693d){try{utils[_0x1e93('0x1d')](util['format'](_0x1e93('0x1e'),_0x44693d[_0x1e93('0x1b')]),_0x44693d);agents[_0x1e93('0x1c')](_0x44693d);}catch(_0x3bf46f){utils[_0x1e93('0x13')](util[_0x1e93('0x16')](_0x1e93('0x1e'),_0x44693d[_0x1e93('0x1b')]),_0x3bf46f);}});ami['on']('agentconnect',function(_0xb662a7){try{utils['debug'](util[_0x1e93('0x16')](_0x1e93('0x1f'),_0xb662a7[_0x1e93('0x1b')]),_0xb662a7);agents[_0x1e93('0x20')](_0xb662a7);queues[_0x1e93('0x20')](_0xb662a7);}catch(_0x282e8e){utils[_0x1e93('0x13')](util[_0x1e93('0x16')](_0x1e93('0x1f'),_0xb662a7['uniqueid']),_0x282e8e);}});ami['on'](_0x1e93('0x21'),function(_0x5aa8aa){try{utils[_0x1e93('0x1d')](util[_0x1e93('0x16')](_0x1e93('0x22'),_0x5aa8aa[_0x1e93('0x1b')]),_0x5aa8aa);agents[_0x1e93('0x21')](_0x5aa8aa);queues[_0x1e93('0x21')](_0x5aa8aa);members[_0x1e93('0x21')](_0x5aa8aa);}catch(_0x431120){utils[_0x1e93('0x13')](util[_0x1e93('0x16')]('[%s][index][agentcomplete]',_0x5aa8aa[_0x1e93('0x1b')]),_0x431120);}});ami['on'](_0x1e93('0x23'),function(_0x336d5b){try{utils[_0x1e93('0x1d')](util['format'](_0x1e93('0x24'),_0x336d5b[_0x1e93('0x1b')]),_0x336d5b);agents[_0x1e93('0x23')](_0x336d5b);queues[_0x1e93('0x23')](_0x336d5b);}catch(_0x32e260){utils[_0x1e93('0x13')](util['format'](_0x1e93('0x24'),_0x336d5b['uniqueid']),_0x32e260);}});ami['on'](_0x1e93('0x25'),function(_0x42b988){try{utils[_0x1e93('0x1d')](util[_0x1e93('0x16')](_0x1e93('0x26'),_0x42b988[_0x1e93('0x1b')]),_0x42b988);queues[_0x1e93('0x25')](_0x42b988);recordings[_0x1e93('0x25')](_0x42b988);}catch(_0x545876){utils['error'](util[_0x1e93('0x16')](_0x1e93('0x26'),_0x42b988['uniqueid']),_0x545876);}});ami['on'](_0x1e93('0x27'),function(_0x49b3e6){try{utils['debug'](util[_0x1e93('0x16')](_0x1e93('0x28'),_0x49b3e6[_0x1e93('0x1b')]),_0x49b3e6);queues[_0x1e93('0x27')](_0x49b3e6);}catch(_0x565940){utils['error'](util[_0x1e93('0x16')]('[%s][index][queuecallerleave]',_0x49b3e6[_0x1e93('0x1b')]),_0x565940);}});ami['on'](_0x1e93('0x29'),function(_0x5b9fb5){try{utils[_0x1e93('0x1d')](util[_0x1e93('0x16')](_0x1e93('0x2a'),_0x5b9fb5[_0x1e93('0x1b')]),_0x5b9fb5);queues[_0x1e93('0x29')](_0x5b9fb5);calls['musiconholdstart'](_0x5b9fb5);}catch(_0x53dcab){utils[_0x1e93('0x13')](util[_0x1e93('0x16')](_0x1e93('0x2a'),_0x5b9fb5[_0x1e93('0x1b')]),_0x53dcab);}});ami['on'](_0x1e93('0x2b'),function(_0x3d4b2a){try{utils['debug'](util['format'](_0x1e93('0x2c'),_0x3d4b2a['uniqueid']),_0x3d4b2a);queues[_0x1e93('0x2b')](_0x3d4b2a);calls[_0x1e93('0x2b')](_0x3d4b2a);}catch(_0xb4aaf5){utils[_0x1e93('0x13')](util[_0x1e93('0x16')]('[%s][index][musiconholdstop]',_0x3d4b2a[_0x1e93('0x1b')]),_0xb4aaf5);}});ami['on']('newstate',function(_0x12cd6c){try{utils['debug'](util[_0x1e93('0x16')](_0x1e93('0x2d'),_0x12cd6c[_0x1e93('0x1b')]),_0x12cd6c);calls[_0x1e93('0x2e')](_0x12cd6c);recordings[_0x1e93('0x2e')](_0x12cd6c);}catch(_0x2d92de){utils['error'](util[_0x1e93('0x16')](_0x1e93('0x2d'),_0x12cd6c[_0x1e93('0x1b')]),_0x2d92de);}});ami['on']('hangup',function(_0xd9e9db){try{utils[_0x1e93('0x1d')](util['format'](_0x1e93('0x2f'),_0xd9e9db[_0x1e93('0x1b')]),_0xd9e9db);calls[_0x1e93('0x30')](_0xd9e9db);recordings['hangup'](_0xd9e9db);dials[_0x1e93('0x30')](_0xd9e9db);agents[_0x1e93('0x30')](_0xd9e9db);queues[_0x1e93('0x30')](_0xd9e9db);}catch(_0x504c0e){utils[_0x1e93('0x13')](util['format'](_0x1e93('0x2f'),_0xd9e9db[_0x1e93('0x1b')]),_0x504c0e);}});ami['on'](_0x1e93('0x31'),function(_0xedebe6){try{utils[_0x1e93('0x1d')](util[_0x1e93('0x16')](_0x1e93('0x32'),_0xedebe6[_0x1e93('0x1b')]),_0xedebe6);members['cdr'](_0xedebe6);}catch(_0x49f419){utils['error'](util[_0x1e93('0x16')](_0x1e93('0x32'),_0xedebe6[_0x1e93('0x1b')]),_0x49f419);}});ami['on']('blindtransfer',function(_0x587e96){try{utils[_0x1e93('0x1d')](util[_0x1e93('0x16')](_0x1e93('0x33'),_0x587e96[_0x1e93('0x1b')]),_0x587e96);queues[_0x1e93('0x34')](_0x587e96);agents['blindtransfer'](_0x587e96);transfers[_0x1e93('0x34')](_0x587e96);}catch(_0x2f75f1){utils['error'](util['format'](_0x1e93('0x33'),_0x587e96[_0x1e93('0x1b')]),_0x2f75f1);}});ami['on'](_0x1e93('0x35'),function(_0x3778b4){try{utils[_0x1e93('0x1d')](util['format'](_0x1e93('0x36'),_0x3778b4['origtransfereruniqueid']),_0x3778b4);queues[_0x1e93('0x35')](_0x3778b4);transfers[_0x1e93('0x35')](_0x3778b4);agents[_0x1e93('0x35')](_0x3778b4);calls[_0x1e93('0x35')](_0x3778b4);}catch(_0x69f89f){utils[_0x1e93('0x13')](util[_0x1e93('0x16')]('[%s][index][attendedtransfer]',_0x3778b4[_0x1e93('0x37')]),_0x69f89f);}});ami['on'](_0x1e93('0x38'),function(_0x41bc9c){try{utils['debug'](util[_0x1e93('0x16')](_0x1e93('0x39'),_0x41bc9c[_0x1e93('0x1b')]),_0x41bc9c);queues[_0x1e93('0x38')](_0x41bc9c);recordings[_0x1e93('0x38')](_0x41bc9c);calls[_0x1e93('0x38')](_0x41bc9c);dials[_0x1e93('0x38')](_0x41bc9c);}catch(_0x1ccdc3){utils[_0x1e93('0x13')](util[_0x1e93('0x16')](_0x1e93('0x39'),_0x41bc9c[_0x1e93('0x1b')]),_0x1ccdc3);}});ami['on']('newexten',function(_0x3fdf48){try{utils['debug'](util[_0x1e93('0x16')](_0x1e93('0x3a'),_0x3fdf48[_0x1e93('0x1b')]),_0x3fdf48);calls[_0x1e93('0x3b')](_0x3fdf48);recordings[_0x1e93('0x3b')](_0x3fdf48);dials[_0x1e93('0x3b')](_0x3fdf48);}catch(_0xfc495c){utils[_0x1e93('0x13')](util[_0x1e93('0x16')](_0x1e93('0x3a'),_0x3fdf48[_0x1e93('0x1b')]),_0xfc495c);}});ami['on'](_0x1e93('0x3c'),function(_0x540b35){try{utils[_0x1e93('0x1d')](util[_0x1e93('0x16')](_0x1e93('0x3d'),_0x540b35['uniqueid']),_0x540b35);calls[_0x1e93('0x3c')](_0x540b35);recordings[_0x1e93('0x3c')](_0x540b35);}catch(_0x1559ca){utils[_0x1e93('0x13')](util['format'](_0x1e93('0x3d'),_0x540b35['uniqueid']),_0x1559ca);}});ami['on'](_0x1e93('0x3e'),function(_0x1b34ce){try{utils[_0x1e93('0x1d')](util[_0x1e93('0x16')](_0x1e93('0x3f'),_0x1b34ce[_0x1e93('0x1b')]),_0x1b34ce);dials[_0x1e93('0x3e')](_0x1b34ce);}catch(_0x1412ec){utils[_0x1e93('0x13')](util[_0x1e93('0x16')](_0x1e93('0x40'),_0x1b34ce[_0x1e93('0x1b')]),_0x1412ec);}});ami['on'](_0x1e93('0x41'),function(_0x457d3a){try{utils[_0x1e93('0x1d')](util['format'](_0x1e93('0x42'),_0x457d3a[_0x1e93('0x1b')]),_0x457d3a);dials[_0x1e93('0x41')](_0x457d3a);}catch(_0x5c0422){utils[_0x1e93('0x13')](util['format']('[%s][index][dialend]',_0x457d3a['uniqueid']),_0x5c0422);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index de6ba00..13785d5 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 _0x0fa5=['CreateMemberReport','catch','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','split','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','exitAt','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','type','interface','request','getUserByName','then','membername','name','internal'];(function(_0x155b4c,_0x518e93){var _0x4ae3f5=function(_0x145081){while(--_0x145081){_0x155b4c['push'](_0x155b4c['shift']());}};_0x4ae3f5(++_0x518e93);}(_0x0fa5,0x132));var _0x50fa=function(_0x2de753,_0x4a544d){_0x2de753=_0x2de753-0x0;var _0x8e70a5=_0x0fa5[_0x2de753];return _0x8e70a5;};'use strict';var _=require(_0x50fa('0x0'));var util=require(_0x50fa('0x1'));var utils=require(_0x50fa('0x2'));var members={};var exclude=[_0x50fa('0x3'),_0x50fa('0x4')];function writeDB(_0x49636){utils[_0x50fa('0x5')](util[_0x50fa('0x6')](_0x50fa('0x7'),_0x49636['uniqueid'],_0x49636['interface'],_0x49636[_0x50fa('0x8')],_0x49636[_0x50fa('0x9')],_0x49636['membername'],_0x49636[_0x50fa('0xa')]));if(_0x49636['interface']){utils['getUserByInterface'](_0x49636[_0x50fa('0xb')])['then'](function(_0x164a4c){if(_0x164a4c){_0x49636['membername']=_0x164a4c['name'];_0x49636['internal']=_0x164a4c['internal'];utils[_0x50fa('0xc')]('CreateMemberReport',_0x49636);}else{utils[_0x50fa('0xd')](_0x49636[_0x50fa('0xb')]['split']('/')[0x1])[_0x50fa('0xe')](function(_0xad72b){if(_0xad72b){_0x49636[_0x50fa('0xf')]=_0xad72b[_0x50fa('0x10')];_0x49636[_0x50fa('0x11')]=_0xad72b[_0x50fa('0x11')];utils[_0x50fa('0xc')](_0x50fa('0x12'),_0x49636);}});}})[_0x50fa('0x13')](function(_0x491d6f){utils['error'](util[_0x50fa('0x6')](_0x50fa('0x14'),_0x49636[_0x50fa('0x15')]),_0x491d6f);});}delete members[_0x49636[_0x50fa('0xb')]];}function startsWith(_0x3b0492,_0x1f5fa2){return _[_0x50fa('0x16')](_0x3b0492,function(_0xe5bc45){return _[_0x50fa('0x17')](_0x1f5fa2,_0xe5bc45);});}exports[_0x50fa('0x18')]=function(_0x385222){try{utils[_0x50fa('0x19')](util[_0x50fa('0x6')](_0x50fa('0x1a'),members[_0x385222[_0x50fa('0x1b')]]?members[_0x385222['device']][_0x50fa('0x15')]:_0x385222['device']),_0x385222);utils[_0x50fa('0x5')](util['format'](_0x50fa('0x1c'),members[_0x385222[_0x50fa('0x1b')]]?members[_0x385222['device']][_0x50fa('0x15')]:_0x385222[_0x50fa('0x1b')],_0x385222[_0x50fa('0x1d')],_0x385222['device']));switch(_0x385222[_0x50fa('0x1d')]){case _0x50fa('0x1e'):case _0x50fa('0x1f'):if(!startsWith(exclude,_0x385222[_0x50fa('0x1b')])){members[_0x385222[_0x50fa('0x1b')]]={'channel':_0x50fa('0x20'),'interface':_0x385222['device'],'type':_0x50fa('0x21'),'enterAt':utils[_0x50fa('0x22')](),'role':_0x50fa('0x23')};}break;case _0x50fa('0x24'):if(!_[_0x50fa('0x25')](members[_0x385222[_0x50fa('0x1b')]])){members[_0x385222['device']]['exitAt']=utils['now']();members[_0x385222[_0x50fa('0x1b')]][_0x50fa('0x26')]=utils['diffTime'](members[_0x385222[_0x50fa('0x1b')]]['exitAt'],members[_0x385222[_0x50fa('0x1b')]][_0x50fa('0x27')]);if(members[_0x385222[_0x50fa('0x1b')]][_0x50fa('0x15')]){writeDB(members[_0x385222[_0x50fa('0x1b')]]);}}break;default:break;}}catch(_0xa7a824){utils[_0x50fa('0x28')](util[_0x50fa('0x6')](_0x50fa('0x1a'),members[_0x385222['device']]?members[_0x385222[_0x50fa('0x1b')]][_0x50fa('0x15')]:_0x385222[_0x50fa('0x1b')]),_0xa7a824);}};exports[_0x50fa('0x29')]=function(_0xb9d768){try{if(!_[_0x50fa('0x25')](members[_0xb9d768['interface']])){utils[_0x50fa('0x19')](util['format'](_0x50fa('0x2a'),_0xb9d768['uniqueid']),_0xb9d768);utils[_0x50fa('0x5')](util[_0x50fa('0x6')](_0x50fa('0x2b'),_0xb9d768[_0x50fa('0x15')],_0xb9d768[_0x50fa('0xb')],_0xb9d768[_0x50fa('0x2c')]));members[_0xb9d768[_0x50fa('0xb')]]=_[_0x50fa('0x2d')](members[_0xb9d768[_0x50fa('0xb')]],{'data4':_0xb9d768[_0x50fa('0x2c')],'uniqueid':_0xb9d768['uniqueid']});}}catch(_0x45ccad){utils[_0x50fa('0x28')](util[_0x50fa('0x6')](_0x50fa('0x2a'),_0xb9d768['uniqueid']),_0x45ccad);}};exports['cdr']=function(_0x42adda){try{utils[_0x50fa('0x19')](util[_0x50fa('0x6')](_0x50fa('0x2e'),_0x42adda[_0x50fa('0x15')]),_0x42adda);if(_0x42adda[_0x50fa('0x8')]){var _0x5f0068=_0x42adda[_0x50fa('0x8')][_0x50fa('0x2f')]('-')[0x0];if(!_['isNil'](members[_0x5f0068])){members[_0x5f0068]=_[_0x50fa('0x2d')](members[_0x5f0068],{'data1':members[_0x5f0068][_0x50fa('0x30')]||_0x42adda[_0x50fa('0xa')],'data2':members[_0x5f0068][_0x50fa('0x9')]||_0x42adda['source'],'data3':members[_0x5f0068]['data3']||_0x42adda[_0x50fa('0x31')],'uniqueid':members[_0x5f0068][_0x50fa('0x15')]||_0x42adda[_0x50fa('0x15')]});utils[_0x50fa('0x5')](util[_0x50fa('0x6')](_0x50fa('0x32'),_0x42adda['uniqueid'],members[_0x5f0068][_0x50fa('0x30')],members[_0x5f0068]['data2'],members[_0x5f0068][_0x50fa('0x33')]));if(members[_0x5f0068][_0x50fa('0x34')]){writeDB(members[_0x5f0068]);}}}if(_0x42adda[_0x50fa('0x35')]){var _0x2d4c6f=_0x42adda[_0x50fa('0x35')][_0x50fa('0x2f')]('-')[0x0];if(!_['isNil'](members[_0x2d4c6f])){members[_0x2d4c6f]=_[_0x50fa('0x2d')](members[_0x2d4c6f],{'data1':members[_0x2d4c6f][_0x50fa('0x30')]||_0x42adda[_0x50fa('0xa')],'data2':members[_0x2d4c6f][_0x50fa('0x9')]||_0x42adda['source'],'data3':members[_0x2d4c6f]['data3']||_0x42adda[_0x50fa('0x31')],'uniqueid':members[_0x2d4c6f]['uniqueid']||_0x42adda[_0x50fa('0x15')]});utils[_0x50fa('0x5')](util['format'](_0x50fa('0x32'),_0x42adda[_0x50fa('0x15')],members[_0x2d4c6f][_0x50fa('0x30')],members[_0x2d4c6f][_0x50fa('0x9')],members[_0x2d4c6f][_0x50fa('0x33')]));if(members[_0x2d4c6f][_0x50fa('0x34')]){writeDB(members[_0x2d4c6f]);}}}}catch(_0x238717){utils[_0x50fa('0x28')](util['format'](_0x50fa('0x2e'),_0x42adda['uniqueid']),_0x238717);}}; \ No newline at end of file +var _0x8369=['exitAt','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','uniqueid','devicestatechange','debug','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','NOT_INUSE','isNil','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','data1','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0x8369,0x10b));var _0x9836=function(_0x114e9c,_0x9980e0){_0x114e9c=_0x114e9c-0x0;var _0x432532=_0x8369[_0x114e9c];return _0x432532;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var utils=require(_0x9836('0x2'));var members={};var exclude=[_0x9836('0x3'),_0x9836('0x4')];function writeDB(_0x1fe0f3){utils[_0x9836('0x5')](util['format'](_0x9836('0x6'),_0x1fe0f3['uniqueid'],_0x1fe0f3[_0x9836('0x7')],_0x1fe0f3[_0x9836('0x8')],_0x1fe0f3['data2'],_0x1fe0f3[_0x9836('0x9')],_0x1fe0f3[_0x9836('0xa')]));if(_0x1fe0f3['interface']){utils[_0x9836('0xb')](_0x1fe0f3[_0x9836('0x7')])[_0x9836('0xc')](function(_0x2482d8){if(_0x2482d8){_0x1fe0f3['membername']=_0x2482d8[_0x9836('0xd')];_0x1fe0f3[_0x9836('0xe')]=_0x2482d8[_0x9836('0xe')];utils[_0x9836('0xf')]('CreateMemberReport',_0x1fe0f3);}else{utils[_0x9836('0x10')](_0x1fe0f3[_0x9836('0x7')][_0x9836('0x11')]('/')[0x1])[_0x9836('0xc')](function(_0x42de67){if(_0x42de67){_0x1fe0f3['membername']=_0x42de67[_0x9836('0xd')];_0x1fe0f3[_0x9836('0xe')]=_0x42de67[_0x9836('0xe')];utils[_0x9836('0xf')](_0x9836('0x12'),_0x1fe0f3);}});}})[_0x9836('0x13')](function(_0x2f38fb){utils[_0x9836('0x14')](util['format'](_0x9836('0x15'),_0x1fe0f3[_0x9836('0x16')]),_0x2f38fb);});}delete members[_0x1fe0f3[_0x9836('0x7')]];}function startsWith(_0x47d820,_0x978742){return _['some'](_0x47d820,function(_0xa0b1f8){return _['startsWith'](_0x978742,_0xa0b1f8);});}exports[_0x9836('0x17')]=function(_0x22f9b5){try{utils[_0x9836('0x18')](util[_0x9836('0x19')](_0x9836('0x1a'),members[_0x22f9b5[_0x9836('0x1b')]]?members[_0x22f9b5['device']][_0x9836('0x16')]:_0x22f9b5[_0x9836('0x1b')]),_0x22f9b5);utils['info'](util[_0x9836('0x19')](_0x9836('0x1c'),members[_0x22f9b5[_0x9836('0x1b')]]?members[_0x22f9b5['device']][_0x9836('0x16')]:_0x22f9b5['device'],_0x22f9b5[_0x9836('0x1d')],_0x22f9b5[_0x9836('0x1b')]));switch(_0x22f9b5[_0x9836('0x1d')]){case _0x9836('0x1e'):case _0x9836('0x1f'):if(!startsWith(exclude,_0x22f9b5['device'])){members[_0x22f9b5['device']]={'channel':'voice','interface':_0x22f9b5[_0x9836('0x1b')],'type':_0x9836('0x20'),'enterAt':utils[_0x9836('0x21')](),'role':'agent'};}break;case _0x9836('0x22'):if(!_[_0x9836('0x23')](members[_0x22f9b5[_0x9836('0x1b')]])){members[_0x22f9b5[_0x9836('0x1b')]]['exitAt']=utils[_0x9836('0x21')]();members[_0x22f9b5[_0x9836('0x1b')]][_0x9836('0x24')]=utils[_0x9836('0x25')](members[_0x22f9b5[_0x9836('0x1b')]]['exitAt'],members[_0x22f9b5[_0x9836('0x1b')]][_0x9836('0x26')]);if(members[_0x22f9b5['device']][_0x9836('0x16')]){writeDB(members[_0x22f9b5['device']]);}}break;default:break;}}catch(_0xedb9b7){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x22f9b5[_0x9836('0x1b')]]?members[_0x22f9b5[_0x9836('0x1b')]][_0x9836('0x16')]:_0x22f9b5[_0x9836('0x1b')]),_0xedb9b7);}};exports[_0x9836('0x27')]=function(_0x118aac){try{if(!_[_0x9836('0x23')](members[_0x118aac['interface']])){utils[_0x9836('0x18')](util[_0x9836('0x19')](_0x9836('0x28'),_0x118aac[_0x9836('0x16')]),_0x118aac);utils[_0x9836('0x5')](util[_0x9836('0x19')](_0x9836('0x29'),_0x118aac[_0x9836('0x16')],_0x118aac[_0x9836('0x7')],_0x118aac['queue']));members[_0x118aac[_0x9836('0x7')]]=_[_0x9836('0x2a')](members[_0x118aac[_0x9836('0x7')]],{'data4':_0x118aac[_0x9836('0x2b')],'uniqueid':_0x118aac[_0x9836('0x16')]});}}catch(_0x611229){utils[_0x9836('0x14')](util[_0x9836('0x19')]('[%s][members][agentcomplete]',_0x118aac['uniqueid']),_0x611229);}};exports[_0x9836('0x2c')]=function(_0x2d6705){try{utils[_0x9836('0x18')](util['format']('[%s][members][cdr]',_0x2d6705['uniqueid']),_0x2d6705);if(_0x2d6705[_0x9836('0x8')]){var _0x5aaaae=_0x2d6705[_0x9836('0x8')][_0x9836('0x11')]('-')[0x0];if(!_['isNil'](members[_0x5aaaae])){members[_0x5aaaae]=_['assign'](members[_0x5aaaae],{'data1':members[_0x5aaaae][_0x9836('0x2d')]||_0x2d6705[_0x9836('0xa')],'data2':members[_0x5aaaae][_0x9836('0x2e')]||_0x2d6705[_0x9836('0x2f')],'data3':members[_0x5aaaae][_0x9836('0x30')]||_0x2d6705['destination'],'uniqueid':members[_0x5aaaae]['uniqueid']||_0x2d6705[_0x9836('0x16')]});utils[_0x9836('0x5')](util[_0x9836('0x19')](_0x9836('0x31'),_0x2d6705[_0x9836('0x16')],members[_0x5aaaae][_0x9836('0x2d')],members[_0x5aaaae]['data2'],members[_0x5aaaae][_0x9836('0x30')]));if(members[_0x5aaaae]['exitAt']){writeDB(members[_0x5aaaae]);}}}if(_0x2d6705[_0x9836('0x32')]){var _0x2a347b=_0x2d6705[_0x9836('0x32')][_0x9836('0x11')]('-')[0x0];if(!_[_0x9836('0x23')](members[_0x2a347b])){members[_0x2a347b]=_[_0x9836('0x2a')](members[_0x2a347b],{'data1':members[_0x2a347b][_0x9836('0x2d')]||_0x2d6705['type'],'data2':members[_0x2a347b][_0x9836('0x2e')]||_0x2d6705[_0x9836('0x2f')],'data3':members[_0x2a347b][_0x9836('0x30')]||_0x2d6705['destination'],'uniqueid':members[_0x2a347b]['uniqueid']||_0x2d6705['uniqueid']});utils[_0x9836('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2d6705[_0x9836('0x16')],members[_0x2a347b][_0x9836('0x2d')],members[_0x2a347b][_0x9836('0x2e')],members[_0x2a347b][_0x9836('0x30')]));if(members[_0x2a347b][_0x9836('0x33')]){writeDB(members[_0x2a347b]);}}}}catch(_0x3b8943){utils[_0x9836('0x14')](util['format'](_0x9836('0x34'),_0x2d6705[_0x9836('0x16')]),_0x3b8943);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index e3b4fd1..057ecde 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 _0xfefb=['then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','error','[%s][queues][hangup]','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','queueposition','queuecallerexit','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','membername','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfefb,0xc6));var _0xbfef=function(_0x4a6f74,_0x4e9782){_0x4a6f74=_0x4a6f74-0x0;var _0xfb1364=_0xfefb[_0x4a6f74];return _0xfb1364;};'use strict';var _=require(_0xbfef('0x0'));var util=require(_0xbfef('0x1'));var utils=require(_0xbfef('0x2'));var queues={};function writeDB(_0x4798b5){utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x5'),_0x4798b5[_0xbfef('0x6')],_0x4798b5[_0xbfef('0x7')],_0x4798b5[_0xbfef('0x8')],_0x4798b5[_0xbfef('0x9')],_0x4798b5[_0xbfef('0xa')],_0x4798b5[_0xbfef('0xb')],_0x4798b5[_0xbfef('0xc')]));if(_0x4798b5[_0xbfef('0x8')]){utils[_0xbfef('0xd')](_0x4798b5[_0xbfef('0x8')])[_0xbfef('0xe')](function(_0x41dbb8){if(_0x41dbb8){_0x4798b5[_0xbfef('0xf')]=_0x41dbb8[_0xbfef('0xf')];}utils['request'](_0xbfef('0x10'),_0x4798b5);});}else{utils['request'](_0xbfef('0x10'),_0x4798b5);}if(_0x4798b5[_0xbfef('0x11')]){delete queues[_0x4798b5['transfereduniqueid']];}else{delete queues[_0x4798b5[_0xbfef('0x6')]];}}exports[_0xbfef('0x12')]=function(_0x3a5e47){try{utils[_0xbfef('0x13')](util['format']('[%s][queues][queuecallerjoin]',_0x3a5e47[_0xbfef('0x6')]),_0x3a5e47);utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x14'),_0x3a5e47[_0xbfef('0x6')],_0x3a5e47['queue'],_0x3a5e47[_0xbfef('0x15')]));queues[_0x3a5e47[_0xbfef('0x6')]]=_[_0xbfef('0x16')](_0x3a5e47,{'originalposition':_0x3a5e47[_0xbfef('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5f2925){utils['error'](util[_0xbfef('0x4')](_0xbfef('0x17'),_0x3a5e47[_0xbfef('0x6')]),_0x5f2925);}};exports[_0xbfef('0x18')]=function(_0x291ac1){try{if(!_[_0xbfef('0x19')](queues[_0x291ac1[_0xbfef('0x6')]])){utils[_0xbfef('0x13')](util[_0xbfef('0x4')]('[%s][queues][hangup]',_0x291ac1[_0xbfef('0x6')]),_0x291ac1);if(queues[_0x291ac1[_0xbfef('0x6')]]['queuecallerleaveAt']){if(!queues[_0x291ac1['uniqueid']][_0xbfef('0x1a')]&&!queues[_0x291ac1[_0xbfef('0x6')]]['queuecallerexit']){queues[_0x291ac1['uniqueid']][_0xbfef('0x1b')]=!![];queues[_0x291ac1[_0xbfef('0x6')]][_0xbfef('0x1c')]=utils[_0xbfef('0x1d')]();queues[_0x291ac1[_0xbfef('0x6')]][_0xbfef('0xc')]=_0xbfef('0x1e');}utils[_0xbfef('0x3')](util['format'](_0xbfef('0x1f'),_0x291ac1[_0xbfef('0x6')],queues[_0x291ac1[_0xbfef('0x6')]]['name'],queues[_0x291ac1[_0xbfef('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x291ac1['uniqueid']]);}else if(queues[_0x291ac1[_0xbfef('0x6')]][_0xbfef('0x11')]){utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x20'),_0x291ac1['uniqueid'],queues[_0x291ac1[_0xbfef('0x6')]][_0xbfef('0x21')],queues[_0x291ac1[_0xbfef('0x6')]][_0xbfef('0x11')]));queues[queues[_0x291ac1[_0xbfef('0x6')]][_0xbfef('0x11')]]=queues[_0x291ac1[_0xbfef('0x6')]];queues[queues[_0x291ac1[_0xbfef('0x6')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x291ac1[_0xbfef('0x6')]];}}}catch(_0x381180){utils[_0xbfef('0x22')](util[_0xbfef('0x4')](_0xbfef('0x23'),_0x291ac1[_0xbfef('0x6')]),_0x381180);}};exports[_0xbfef('0x24')]=function(_0x3126d9){try{utils[_0xbfef('0x13')](util[_0xbfef('0x4')]('[%s][queues][varset]',_0x3126d9[_0xbfef('0x6')]),_0x3126d9);if(!_[_0xbfef('0x19')](_0x3126d9[_0xbfef('0x25')][_0xbfef('0x26')])&&_0x3126d9[_0xbfef('0x27')][_0xbfef('0x28')]()!=='CONTINUE'){if(!_[_0xbfef('0x19')](queues[_0x3126d9[_0xbfef('0x6')]])){queues[_0x3126d9['uniqueid']]['queuecallerabandon']=![];queues[_0x3126d9['uniqueid']][_0xbfef('0x29')]=null;queues[_0x3126d9[_0xbfef('0x6')]]['queuecallerexit']=!![];queues[_0x3126d9[_0xbfef('0x6')]][_0xbfef('0x2a')]=utils['now']();queues[_0x3126d9['uniqueid']][_0xbfef('0xc')]=_0x3126d9[_0xbfef('0x27')][_0xbfef('0x28')]();utils[_0xbfef('0x3')](util[_0xbfef('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3126d9['uniqueid'],queues[_0x3126d9[_0xbfef('0x6')]][_0xbfef('0x21')],_0x3126d9['value'],queues[_0x3126d9[_0xbfef('0x6')]][_0xbfef('0xc')]));writeDB(queues[_0x3126d9['uniqueid']]);}}else if(!_[_0xbfef('0x19')](_0x3126d9[_0xbfef('0x25')][_0xbfef('0x2b')])){if(!_['isNil'](queues[_0x3126d9[_0xbfef('0x6')]])&&!queues[_0x3126d9['uniqueid']][_0xbfef('0x1a')]){queues[_0x3126d9[_0xbfef('0x6')]][_0xbfef('0x1a')]=![];queues[_0x3126d9['uniqueid']][_0xbfef('0x29')]=null;queues[_0x3126d9['uniqueid']][_0xbfef('0x2c')]=!![];queues[_0x3126d9[_0xbfef('0x6')]][_0xbfef('0x2a')]=utils[_0xbfef('0x1d')]();queues[_0x3126d9['uniqueid']][_0xbfef('0xc')]=_0xbfef('0x2d');utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x2e'),_0x3126d9[_0xbfef('0x6')],queues[_0x3126d9[_0xbfef('0x6')]][_0xbfef('0x21')],_0x3126d9['value'],queues[_0x3126d9[_0xbfef('0x6')]][_0xbfef('0xc')]));}}}catch(_0x4d2e53){utils[_0xbfef('0x22')](util[_0xbfef('0x4')](_0xbfef('0x2f'),_0x3126d9['uniqueid']),_0x4d2e53);}};exports[_0xbfef('0x1a')]=function(_0x1a631a){try{if(!_[_0xbfef('0x19')](queues[_0x1a631a[_0xbfef('0x6')]])){utils[_0xbfef('0x13')](util[_0xbfef('0x4')]('[%s][queues][queuecallerabandon]',_0x1a631a[_0xbfef('0x6')]),_0x1a631a);queues[_0x1a631a[_0xbfef('0x6')]][_0xbfef('0x2c')]=![];queues[_0x1a631a[_0xbfef('0x6')]]['queuecallerexitAt']=null;queues[_0x1a631a[_0xbfef('0x6')]][_0xbfef('0x1a')]=!![];queues[_0x1a631a[_0xbfef('0x6')]][_0xbfef('0x29')]=utils['now']();queues[_0x1a631a[_0xbfef('0x6')]][_0xbfef('0xc')]=_0xbfef('0x30');utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x31'),_0x1a631a[_0xbfef('0x6')],queues[_0x1a631a[_0xbfef('0x6')]][_0xbfef('0x21')],queues[_0x1a631a[_0xbfef('0x6')]]['queuecallerexitreason']));}}catch(_0x35d109){utils['error'](util[_0xbfef('0x4')](_0xbfef('0x32'),_0x1a631a[_0xbfef('0x6')]),_0x35d109);}};exports['queuecallerleave']=function(_0x2a5e9c){try{if(!_[_0xbfef('0x19')](queues[_0x2a5e9c[_0xbfef('0x6')]])){utils[_0xbfef('0x13')](util[_0xbfef('0x4')](_0xbfef('0x33'),_0x2a5e9c[_0xbfef('0x6')]),_0x2a5e9c);utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x34'),_0x2a5e9c[_0xbfef('0x6')],queues[_0x2a5e9c['uniqueid']][_0xbfef('0x21')],_0x2a5e9c[_0xbfef('0x35')],_0x2a5e9c[_0xbfef('0x36')]));queues[_0x2a5e9c[_0xbfef('0x6')]]['queuecallerleave']=!![];queues[_0x2a5e9c[_0xbfef('0x6')]][_0xbfef('0x37')]=utils[_0xbfef('0x1d')]();queues[_0x2a5e9c[_0xbfef('0x6')]][_0xbfef('0x38')]=utils[_0xbfef('0x39')](queues[_0x2a5e9c[_0xbfef('0x6')]][_0xbfef('0x37')],queues[_0x2a5e9c[_0xbfef('0x6')]][_0xbfef('0x3a')]);queues[_0x2a5e9c[_0xbfef('0x6')]]['position']=_0x2a5e9c[_0xbfef('0x15')];queues[_0x2a5e9c[_0xbfef('0x6')]][_0xbfef('0x3b')]=_0x2a5e9c['count'];queues[_0x2a5e9c['uniqueid']][_0xbfef('0x35')]=_0x2a5e9c[_0xbfef('0x35')];queues[_0x2a5e9c['uniqueid']][_0xbfef('0x36')]=_0x2a5e9c[_0xbfef('0x36')];}}catch(_0x441ece){utils[_0xbfef('0x22')](util['format'](_0xbfef('0x33'),_0x2a5e9c[_0xbfef('0x6')]),_0x441ece);}};exports[_0xbfef('0x3c')]=function(_0x1f86bc){try{if(!_[_0xbfef('0x19')](queues[_0x1f86bc[_0xbfef('0x6')]])){utils[_0xbfef('0x13')](util[_0xbfef('0x4')](_0xbfef('0x3d'),_0x1f86bc['uniqueid']),_0x1f86bc);utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x3e'),_0x1f86bc['uniqueid'],queues[_0x1f86bc['uniqueid']][_0xbfef('0x21')],_0x1f86bc['membername'],_0x1f86bc['destaccountcode']));queues[_0x1f86bc[_0xbfef('0x6')]][_0xbfef('0x1a')]=![];queues[_0x1f86bc[_0xbfef('0x6')]]['queuecallerabandon']=![];queues[_0x1f86bc[_0xbfef('0x6')]][_0xbfef('0x29')]=null;queues[_0x1f86bc[_0xbfef('0x6')]]['queuecallerexit']=![];queues[_0x1f86bc['uniqueid']][_0xbfef('0xc')]=null;queues[_0x1f86bc['uniqueid']][_0xbfef('0x2a')]=null;queues[_0x1f86bc[_0xbfef('0x6')]][_0xbfef('0x3f')]=!![];queues[_0x1f86bc[_0xbfef('0x6')]]['accountcode']=_0x1f86bc['destaccountcode'];queues[_0x1f86bc[_0xbfef('0x6')]][_0xbfef('0x9')]=_0x1f86bc[_0xbfef('0x40')];}}catch(_0x4f5246){utils[_0xbfef('0x22')](util[_0xbfef('0x4')](_0xbfef('0x3d'),_0x1f86bc['uniqueid']),_0x4f5246);}};exports['agentcomplete']=function(_0x3b902a){try{if(!_['isNil'](queues[_0x3b902a[_0xbfef('0x6')]])){if(queues[_0x3b902a[_0xbfef('0x6')]]['queuecallerleaveAt']){utils[_0xbfef('0x13')](util[_0xbfef('0x4')]('[%s][queues][agentcomplete]',_0x3b902a[_0xbfef('0x6')]),_0x3b902a);queues[_0x3b902a[_0xbfef('0x6')]]['queuecallerabandon']=![];queues[_0x3b902a['uniqueid']][_0xbfef('0x1a')]=![];queues[_0x3b902a[_0xbfef('0x6')]][_0xbfef('0x29')]=null;queues[_0x3b902a[_0xbfef('0x6')]]['queuecallerexit']=![];queues[_0x3b902a[_0xbfef('0x6')]][_0xbfef('0x2a')]=null;queues[_0x3b902a['uniqueid']][_0xbfef('0x3f')]=!![];queues[_0x3b902a[_0xbfef('0x6')]]['lastAssignedTo']=_0x3b902a[_0xbfef('0x40')];queues[_0x3b902a[_0xbfef('0x6')]]['queuecallercomplete']=!![];queues[_0x3b902a[_0xbfef('0x6')]]['queuecallercompleteAt']=utils[_0xbfef('0x1d')]();if(_0x3b902a[_0xbfef('0x41')]==_0xbfef('0x42')){if(!queues[_0x3b902a[_0xbfef('0x6')]][_0xbfef('0x42')]){queues[_0x3b902a[_0xbfef('0x6')]][_0xbfef('0xc')]='TRANSFER';}}else{queues[_0x3b902a[_0xbfef('0x6')]][_0xbfef('0xc')]=_0xbfef('0x43')+_0x3b902a[_0xbfef('0x41')][_0xbfef('0x28')]();}utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x44'),_0x3b902a[_0xbfef('0x6')],queues[_0x3b902a['uniqueid']][_0xbfef('0x21')],_0x3b902a[_0xbfef('0x40')],queues[_0x3b902a[_0xbfef('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x3b902a['uniqueid']]);}}}catch(_0x154c72){utils[_0xbfef('0x22')](util[_0xbfef('0x4')](_0xbfef('0x45'),_0x3b902a[_0xbfef('0x6')]),_0x154c72);}};exports[_0xbfef('0x46')]=function(_0x10c112){try{if(!_[_0xbfef('0x19')](queues[_0x10c112[_0xbfef('0x47')]])){utils[_0xbfef('0x13')](util[_0xbfef('0x4')](_0xbfef('0x48'),_0x10c112['uniqueid']),_0x10c112);queues[_0x10c112[_0xbfef('0x47')]][_0xbfef('0x42')]=!![];queues[_0x10c112[_0xbfef('0x47')]][_0xbfef('0x49')]=_0xbfef('0x4a');queues[_0x10c112[_0xbfef('0x47')]][_0xbfef('0x4b')]=_0x10c112[_0xbfef('0x4c')];queues[_0x10c112['transfereeuniqueid']]['transferuniqueid']=_0x10c112[_0xbfef('0x47')];queues[_0x10c112[_0xbfef('0x47')]]['queuecallerexitreason']=_0xbfef('0x4d');utils['info'](util['format'](_0xbfef('0x4e'),_0x10c112[_0xbfef('0x6')],queues[_0x10c112[_0xbfef('0x47')]]['name'],_0x10c112[_0xbfef('0x47')],_0x10c112['extension']));}}catch(_0x4c4c2f){utils['error'](util[_0xbfef('0x4')](_0xbfef('0x48'),_0x10c112[_0xbfef('0x6')]),_0x4c4c2f);}};exports['attendedtransfer']=function(_0xd1b633){try{utils['debug'](util[_0xbfef('0x4')](_0xbfef('0x4f'),_0xd1b633[_0xbfef('0x50')]),_0xd1b633);if(_0xd1b633[_0xbfef('0x50')]==_0xd1b633[_0xbfef('0x51')]){if(!_[_0xbfef('0x19')](queues[_0xd1b633[_0xbfef('0x52')]])){utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x53'),_0xd1b633[_0xbfef('0x50')],queues[_0xd1b633[_0xbfef('0x52')]][_0xbfef('0x21')],_0xd1b633[_0xbfef('0x54')]));queues[_0xd1b633[_0xbfef('0x52')]][_0xbfef('0x42')]=!![];queues[_0xd1b633[_0xbfef('0x52')]][_0xbfef('0x49')]=_0xbfef('0x55');queues[_0xd1b633[_0xbfef('0x52')]]['transferexten']=_0xd1b633[_0xbfef('0x54')];queues[_0xd1b633[_0xbfef('0x52')]][_0xbfef('0x56')]=_0xd1b633[_0xbfef('0x50')];queues[_0xd1b633['secondtransfererlinkedid']][_0xbfef('0xc')]=_0xbfef('0x57');}if(!_[_0xbfef('0x19')](queues[_0xd1b633[_0xbfef('0x51')]])){if(_0xd1b633[_0xbfef('0x58')]&&queues[_0xd1b633[_0xbfef('0x58')]]){queues[_0xd1b633[_0xbfef('0x58')]][_0xbfef('0x59')]=0x1;queues[_0xd1b633[_0xbfef('0x47')]]=_[_0xbfef('0x5a')](queues[_0xd1b633[_0xbfef('0x58')]]);queues[_0xd1b633[_0xbfef('0x47')]][_0xbfef('0x11')]=_0xd1b633[_0xbfef('0x5b')];queues[_0xd1b633[_0xbfef('0x47')]][_0xbfef('0x59')]=0x2;queues[_0xd1b633['transfereeuniqueid']][_0xbfef('0xa')]=queues[_0xd1b633[_0xbfef('0x52')]]['calleridnum'];queues[_0xd1b633[_0xbfef('0x47')]][_0xbfef('0x5c')]=queues[_0xd1b633[_0xbfef('0x52')]][_0xbfef('0x5c')];queues[_0xd1b633[_0xbfef('0x47')]]['queuecallerjoinAt']=utils[_0xbfef('0x1d')]();queues[_0xd1b633[_0xbfef('0x47')]][_0xbfef('0x37')]=utils[_0xbfef('0x1d')]();queues[_0xd1b633['transfereeuniqueid']][_0xbfef('0x38')]=0x0;queues[_0xd1b633['transfereeuniqueid']][_0xbfef('0x5d')]=0x0;utils['info'](util[_0xbfef('0x4')](_0xbfef('0x5e'),_0xd1b633[_0xbfef('0x50')],queues[_0xd1b633[_0xbfef('0x47')]][_0xbfef('0x21')],queues[_0xd1b633[_0xbfef('0x47')]][_0xbfef('0xa')],queues[_0xd1b633[_0xbfef('0x47')]][_0xbfef('0x5c')]));}else{utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x5f'),_0xd1b633[_0xbfef('0x50')],queues[_0xd1b633[_0xbfef('0x51')]]['name'],_0xd1b633[_0xbfef('0x52')]));queues[_0xd1b633[_0xbfef('0x51')]]['transfereduniqueid']=_0xd1b633[_0xbfef('0x52')];}}}else if(_0xd1b633[_0xbfef('0x60')]==_0xd1b633[_0xbfef('0x52')]){if(!_[_0xbfef('0x19')](queues[_0xd1b633[_0xbfef('0x51')]])){utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x61'),_0xd1b633[_0xbfef('0x50')],queues[_0xd1b633[_0xbfef('0x51')]]['name'],_0xd1b633['secondtransfereruniqueid'],_0xd1b633[_0xbfef('0x62')]));queues[_0xd1b633[_0xbfef('0x51')]]['transfer']=!![];queues[_0xd1b633['origtransfererlinkedid']]['transfertype']=_0xbfef('0x55');queues[_0xd1b633[_0xbfef('0x51')]][_0xbfef('0x4b')]=_0xd1b633[_0xbfef('0x62')];queues[_0xd1b633[_0xbfef('0x51')]][_0xbfef('0x56')]=_0xd1b633[_0xbfef('0x60')];queues[_0xd1b633[_0xbfef('0x51')]]['queuecallerexitreason']=_0xbfef('0x57');}if(!_[_0xbfef('0x19')](queues[_0xd1b633[_0xbfef('0x52')]])){if(_0xd1b633[_0xbfef('0x63')]&&queues[_0xd1b633[_0xbfef('0x63')]]){queues[_0xd1b633['transfertargetlinkedid']][_0xbfef('0x59')]=0x1;queues[_0xd1b633[_0xbfef('0x5b')]]=_[_0xbfef('0x5a')](queues[_0xd1b633[_0xbfef('0x63')]]);queues[_0xd1b633['transfertargetuniqueid']][_0xbfef('0x11')]=_0xd1b633[_0xbfef('0x5b')];queues[_0xd1b633[_0xbfef('0x5b')]][_0xbfef('0x59')]=0x2;queues[_0xd1b633[_0xbfef('0x5b')]][_0xbfef('0xa')]=queues[_0xd1b633[_0xbfef('0x51')]][_0xbfef('0xa')];queues[_0xd1b633[_0xbfef('0x5b')]][_0xbfef('0x5c')]=queues[_0xd1b633[_0xbfef('0x51')]][_0xbfef('0x5c')];queues[_0xd1b633[_0xbfef('0x5b')]][_0xbfef('0x3a')]=utils['now']();queues[_0xd1b633['transfertargetuniqueid']][_0xbfef('0x37')]=utils['now']();queues[_0xd1b633[_0xbfef('0x5b')]][_0xbfef('0x38')]=0x0;queues[_0xd1b633[_0xbfef('0x5b')]]['mohtime']=0x0;utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x64'),_0xd1b633[_0xbfef('0x50')],queues[_0xd1b633['transfertargetuniqueid']][_0xbfef('0x21')],queues[_0xd1b633[_0xbfef('0x5b')]]['transfereduniqueid'],queues[_0xd1b633[_0xbfef('0x5b')]][_0xbfef('0xa')],queues[_0xd1b633[_0xbfef('0x5b')]][_0xbfef('0x5c')]));}else{utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x5f'),_0xd1b633['origtransfereruniqueid'],queues[_0xd1b633[_0xbfef('0x52')]][_0xbfef('0x21')],_0xd1b633['origtransfererlinkedid']));queues[_0xd1b633['secondtransfererlinkedid']][_0xbfef('0x11')]=_0xd1b633[_0xbfef('0x51')];}}}}catch(_0x37bee5){utils[_0xbfef('0x22')](util['format'](_0xbfef('0x4f'),_0xd1b633[_0xbfef('0x50')]),_0x37bee5);}};exports['musiconholdstart']=function(_0x31723b){try{if(!_['isNil'](queues[_0x31723b['uniqueid']])){utils[_0xbfef('0x13')](util[_0xbfef('0x4')](_0xbfef('0x65'),_0x31723b['uniqueid']),_0x31723b);queues[_0x31723b[_0xbfef('0x6')]][_0xbfef('0x66')]=utils[_0xbfef('0x1d')]();utils['info'](util[_0xbfef('0x4')](_0xbfef('0x67'),_0x31723b['uniqueid'],queues[_0x31723b['uniqueid']][_0xbfef('0x21')],queues[_0x31723b[_0xbfef('0x6')]]['musiconholdstartAt']));}}catch(_0x182444){utils[_0xbfef('0x22')](util[_0xbfef('0x4')](_0xbfef('0x65'),_0x31723b[_0xbfef('0x6')]),_0x182444);}};exports['musiconholdstop']=function(_0x376e44){try{if(!_['isNil'](queues[_0x376e44[_0xbfef('0x6')]])){if(!_['isNil'](queues[_0x376e44['uniqueid']][_0xbfef('0x66')])){utils[_0xbfef('0x13')](util[_0xbfef('0x4')](_0xbfef('0x68'),_0x376e44['uniqueid']),_0x376e44);queues[_0x376e44[_0xbfef('0x6')]]['mohtime']+=utils[_0xbfef('0x39')](utils['now'](),queues[_0x376e44['uniqueid']]['musiconholdstartAt']);utils[_0xbfef('0x3')](util[_0xbfef('0x4')](_0xbfef('0x69'),_0x376e44[_0xbfef('0x6')],queues[_0x376e44['uniqueid']][_0xbfef('0x21')],queues[_0x376e44[_0xbfef('0x6')]][_0xbfef('0x5d')]));delete queues[_0x376e44[_0xbfef('0x6')]][_0xbfef('0x66')];}}}catch(_0x161e31){utils[_0xbfef('0x22')](util[_0xbfef('0x4')](_0xbfef('0x68'),_0x376e44[_0xbfef('0x6')]),_0x161e31);}}; \ No newline at end of file +var _0x1cde=['queuecallerabandonAt','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexitAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','position','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','[%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','transfertargetuniqueid','holdtime','mohtime','[%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]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','getVoiceQueueByName','queue','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','value','toUpperCase'];(function(_0x2899ad,_0x3002c9){var _0x5df677=function(_0x5c3851){while(--_0x5c3851){_0x2899ad['push'](_0x2899ad['shift']());}};_0x5df677(++_0x3002c9);}(_0x1cde,0x16f));var _0xe1cd=function(_0x48f9a6,_0x4ea68d){_0x48f9a6=_0x48f9a6-0x0;var _0x24ad80=_0x1cde[_0x48f9a6];return _0x24ad80;};'use strict';var _=require('lodash');var util=require(_0xe1cd('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x100479){utils[_0xe1cd('0x1')](util['format'](_0xe1cd('0x2'),_0x100479[_0xe1cd('0x3')],_0x100479[_0xe1cd('0x4')],_0x100479['queue'],_0x100479[_0xe1cd('0x5')],_0x100479[_0xe1cd('0x6')],_0x100479['accountcode'],_0x100479['queuecallerexitreason']));if(_0x100479['queue']){utils[_0xe1cd('0x7')](_0x100479[_0xe1cd('0x8')])[_0xe1cd('0x9')](function(_0x10aab9){if(_0x10aab9){_0x100479[_0xe1cd('0xa')]=_0x10aab9['type'];}utils['request'](_0xe1cd('0xb'),_0x100479);});}else{utils[_0xe1cd('0xc')](_0xe1cd('0xb'),_0x100479);}if(_0x100479['transfereduniqueid']){delete queues[_0x100479[_0xe1cd('0xd')]];}else{delete queues[_0x100479[_0xe1cd('0x3')]];}}exports[_0xe1cd('0xe')]=function(_0x3b09fb){try{utils[_0xe1cd('0xf')](util['format']('[%s][queues][queuecallerjoin]',_0x3b09fb[_0xe1cd('0x3')]),_0x3b09fb);utils[_0xe1cd('0x1')](util[_0xe1cd('0x10')](_0xe1cd('0x11'),_0x3b09fb[_0xe1cd('0x3')],_0x3b09fb[_0xe1cd('0x8')],_0x3b09fb['position']));queues[_0x3b09fb[_0xe1cd('0x3')]]=_[_0xe1cd('0x12')](_0x3b09fb,{'originalposition':_0x3b09fb['position'],'queuecallerjoinAt':utils[_0xe1cd('0x13')](),'mohtime':0x0});}catch(_0x5dfa5d){utils['error'](util[_0xe1cd('0x10')]('[%s][queues][queuecallerjoin]',_0x3b09fb[_0xe1cd('0x3')]),_0x5dfa5d);}};exports[_0xe1cd('0x14')]=function(_0x55b1fb){try{if(!_[_0xe1cd('0x15')](queues[_0x55b1fb[_0xe1cd('0x3')]])){utils['debug'](util['format'](_0xe1cd('0x16'),_0x55b1fb['uniqueid']),_0x55b1fb);if(queues[_0x55b1fb[_0xe1cd('0x3')]][_0xe1cd('0x17')]){if(!queues[_0x55b1fb[_0xe1cd('0x3')]][_0xe1cd('0x18')]&&!queues[_0x55b1fb['uniqueid']][_0xe1cd('0x19')]){queues[_0x55b1fb[_0xe1cd('0x3')]][_0xe1cd('0x1a')]=!![];queues[_0x55b1fb[_0xe1cd('0x3')]]['queuecallercompleteAt']=utils[_0xe1cd('0x13')]();queues[_0x55b1fb['uniqueid']][_0xe1cd('0x1b')]='COMPLETEDBYAGENT';}utils['info'](util[_0xe1cd('0x10')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x55b1fb['uniqueid'],queues[_0x55b1fb[_0xe1cd('0x3')]][_0xe1cd('0x1c')],queues[_0x55b1fb[_0xe1cd('0x3')]][_0xe1cd('0x1b')]));writeDB(queues[_0x55b1fb['uniqueid']]);}else if(queues[_0x55b1fb[_0xe1cd('0x3')]][_0xe1cd('0xd')]){utils['info'](util['format'](_0xe1cd('0x1d'),_0x55b1fb[_0xe1cd('0x3')],queues[_0x55b1fb['uniqueid']][_0xe1cd('0x1c')],queues[_0x55b1fb['uniqueid']][_0xe1cd('0xd')]));queues[queues[_0x55b1fb[_0xe1cd('0x3')]][_0xe1cd('0xd')]]=queues[_0x55b1fb[_0xe1cd('0x3')]];queues[queues[_0x55b1fb['uniqueid']][_0xe1cd('0xd')]][_0xe1cd('0x1e')]=0x2;delete queues[_0x55b1fb['uniqueid']];}}}catch(_0x1a0dde){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')](_0xe1cd('0x16'),_0x55b1fb['uniqueid']),_0x1a0dde);}};exports[_0xe1cd('0x20')]=function(_0x12e3ae){try{utils['debug'](util[_0xe1cd('0x10')](_0xe1cd('0x21'),_0x12e3ae[_0xe1cd('0x3')]),_0x12e3ae);if(!_[_0xe1cd('0x15')](_0x12e3ae[_0xe1cd('0x22')]['queuestatus'])&&_0x12e3ae[_0xe1cd('0x23')][_0xe1cd('0x24')]()!=='CONTINUE'){if(!_[_0xe1cd('0x15')](queues[_0x12e3ae[_0xe1cd('0x3')]])){queues[_0x12e3ae[_0xe1cd('0x3')]][_0xe1cd('0x18')]=![];queues[_0x12e3ae[_0xe1cd('0x3')]][_0xe1cd('0x25')]=null;queues[_0x12e3ae['uniqueid']][_0xe1cd('0x19')]=!![];queues[_0x12e3ae[_0xe1cd('0x3')]]['queuecallerexitAt']=utils[_0xe1cd('0x13')]();queues[_0x12e3ae[_0xe1cd('0x3')]][_0xe1cd('0x1b')]=_0x12e3ae[_0xe1cd('0x23')][_0xe1cd('0x24')]();utils['info'](util[_0xe1cd('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x12e3ae[_0xe1cd('0x3')],queues[_0x12e3ae['uniqueid']]['name'],_0x12e3ae[_0xe1cd('0x23')],queues[_0x12e3ae[_0xe1cd('0x3')]][_0xe1cd('0x1b')]));writeDB(queues[_0x12e3ae[_0xe1cd('0x3')]]);}}else if(!_[_0xe1cd('0x15')](_0x12e3ae[_0xe1cd('0x22')][_0xe1cd('0x26')])){if(!_[_0xe1cd('0x15')](queues[_0x12e3ae[_0xe1cd('0x3')]])&&!queues[_0x12e3ae[_0xe1cd('0x3')]]['queuecallerabandon']){queues[_0x12e3ae[_0xe1cd('0x3')]][_0xe1cd('0x18')]=![];queues[_0x12e3ae['uniqueid']][_0xe1cd('0x25')]=null;queues[_0x12e3ae[_0xe1cd('0x3')]][_0xe1cd('0x19')]=!![];queues[_0x12e3ae[_0xe1cd('0x3')]]['queuecallerexitAt']=utils[_0xe1cd('0x13')]();queues[_0x12e3ae['uniqueid']][_0xe1cd('0x1b')]='EXITWITHKEY';utils[_0xe1cd('0x1')](util[_0xe1cd('0x10')](_0xe1cd('0x27'),_0x12e3ae['uniqueid'],queues[_0x12e3ae[_0xe1cd('0x3')]][_0xe1cd('0x1c')],_0x12e3ae['value'],queues[_0x12e3ae['uniqueid']][_0xe1cd('0x1b')]));}}}catch(_0x33acdb){utils['error'](util[_0xe1cd('0x10')](_0xe1cd('0x21'),_0x12e3ae['uniqueid']),_0x33acdb);}};exports[_0xe1cd('0x18')]=function(_0x40140d){try{if(!_[_0xe1cd('0x15')](queues[_0x40140d[_0xe1cd('0x3')]])){utils[_0xe1cd('0xf')](util[_0xe1cd('0x10')](_0xe1cd('0x28'),_0x40140d[_0xe1cd('0x3')]),_0x40140d);queues[_0x40140d[_0xe1cd('0x3')]][_0xe1cd('0x19')]=![];queues[_0x40140d[_0xe1cd('0x3')]][_0xe1cd('0x29')]=null;queues[_0x40140d['uniqueid']]['queuecallerabandon']=!![];queues[_0x40140d[_0xe1cd('0x3')]][_0xe1cd('0x25')]=utils[_0xe1cd('0x13')]();queues[_0x40140d['uniqueid']][_0xe1cd('0x1b')]='ABANDONED';utils[_0xe1cd('0x1')](util[_0xe1cd('0x10')](_0xe1cd('0x2a'),_0x40140d[_0xe1cd('0x3')],queues[_0x40140d[_0xe1cd('0x3')]][_0xe1cd('0x1c')],queues[_0x40140d[_0xe1cd('0x3')]][_0xe1cd('0x1b')]));}}catch(_0x4970f9){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')](_0xe1cd('0x28'),_0x40140d['uniqueid']),_0x4970f9);}};exports[_0xe1cd('0x2b')]=function(_0x2aec5a){try{if(!_[_0xe1cd('0x15')](queues[_0x2aec5a[_0xe1cd('0x3')]])){utils[_0xe1cd('0xf')](util['format'](_0xe1cd('0x2c'),_0x2aec5a[_0xe1cd('0x3')]),_0x2aec5a);utils['info'](util['format'](_0xe1cd('0x2d'),_0x2aec5a['uniqueid'],queues[_0x2aec5a[_0xe1cd('0x3')]]['name'],_0x2aec5a[_0xe1cd('0x2e')],_0x2aec5a['connectedlinename']));queues[_0x2aec5a[_0xe1cd('0x3')]][_0xe1cd('0x2b')]=!![];queues[_0x2aec5a[_0xe1cd('0x3')]][_0xe1cd('0x17')]=utils[_0xe1cd('0x13')]();queues[_0x2aec5a['uniqueid']]['holdtime']=utils[_0xe1cd('0x2f')](queues[_0x2aec5a[_0xe1cd('0x3')]]['queuecallerleaveAt'],queues[_0x2aec5a['uniqueid']][_0xe1cd('0x30')]);queues[_0x2aec5a[_0xe1cd('0x3')]][_0xe1cd('0x31')]=_0x2aec5a[_0xe1cd('0x31')];queues[_0x2aec5a[_0xe1cd('0x3')]]['count']=_0x2aec5a[_0xe1cd('0x32')];queues[_0x2aec5a['uniqueid']][_0xe1cd('0x2e')]=_0x2aec5a[_0xe1cd('0x2e')];queues[_0x2aec5a[_0xe1cd('0x3')]][_0xe1cd('0x33')]=_0x2aec5a[_0xe1cd('0x33')];}}catch(_0x23fd09){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')](_0xe1cd('0x2c'),_0x2aec5a[_0xe1cd('0x3')]),_0x23fd09);}};exports[_0xe1cd('0x34')]=function(_0x2ea384){try{if(!_[_0xe1cd('0x15')](queues[_0x2ea384[_0xe1cd('0x3')]])){utils[_0xe1cd('0xf')](util[_0xe1cd('0x10')](_0xe1cd('0x35'),_0x2ea384['uniqueid']),_0x2ea384);utils[_0xe1cd('0x1')](util['format'](_0xe1cd('0x36'),_0x2ea384[_0xe1cd('0x3')],queues[_0x2ea384['uniqueid']][_0xe1cd('0x1c')],_0x2ea384['membername'],_0x2ea384[_0xe1cd('0x37')]));queues[_0x2ea384['uniqueid']][_0xe1cd('0x18')]=![];queues[_0x2ea384[_0xe1cd('0x3')]][_0xe1cd('0x18')]=![];queues[_0x2ea384['uniqueid']][_0xe1cd('0x25')]=null;queues[_0x2ea384['uniqueid']][_0xe1cd('0x19')]=![];queues[_0x2ea384['uniqueid']]['queuecallerexitreason']=null;queues[_0x2ea384[_0xe1cd('0x3')]][_0xe1cd('0x29')]=null;queues[_0x2ea384[_0xe1cd('0x3')]]['assigned']=!![];queues[_0x2ea384['uniqueid']][_0xe1cd('0x38')]=_0x2ea384['destaccountcode'];queues[_0x2ea384['uniqueid']][_0xe1cd('0x5')]=_0x2ea384[_0xe1cd('0x39')];}}catch(_0x3aa1b4){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')]('[%s][queues][agentconnect]',_0x2ea384['uniqueid']),_0x3aa1b4);}};exports[_0xe1cd('0x3a')]=function(_0x283da6){try{if(!_[_0xe1cd('0x15')](queues[_0x283da6['uniqueid']])){if(queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x17')]){utils[_0xe1cd('0xf')](util['format'](_0xe1cd('0x3b'),_0x283da6[_0xe1cd('0x3')]),_0x283da6);queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x18')]=![];queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x18')]=![];queues[_0x283da6['uniqueid']][_0xe1cd('0x25')]=null;queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x19')]=![];queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x29')]=null;queues[_0x283da6[_0xe1cd('0x3')]]['assigned']=!![];queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x5')]=_0x283da6['membername'];queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x1a')]=!![];queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x3c')]=utils['now']();if(_0x283da6['reason']==_0xe1cd('0x3d')){if(!queues[_0x283da6['uniqueid']]['transfer']){queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x1b')]='TRANSFER';}}else{queues[_0x283da6[_0xe1cd('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x283da6['reason'][_0xe1cd('0x24')]();}utils[_0xe1cd('0x1')](util[_0xe1cd('0x10')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x283da6['uniqueid'],queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x1c')],_0x283da6[_0xe1cd('0x39')],queues[_0x283da6[_0xe1cd('0x3')]][_0xe1cd('0x1b')]));writeDB(queues[_0x283da6[_0xe1cd('0x3')]]);}}}catch(_0x16d42b){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')]('[%s][queues][agentcomplete]',_0x283da6[_0xe1cd('0x3')]),_0x16d42b);}};exports[_0xe1cd('0x3e')]=function(_0x1c8140){try{if(!_['isNil'](queues[_0x1c8140['transfereeuniqueid']])){utils[_0xe1cd('0xf')](util[_0xe1cd('0x10')](_0xe1cd('0x3f'),_0x1c8140[_0xe1cd('0x3')]),_0x1c8140);queues[_0x1c8140[_0xe1cd('0x40')]][_0xe1cd('0x3d')]=!![];queues[_0x1c8140['transfereeuniqueid']]['transfertype']=_0xe1cd('0x41');queues[_0x1c8140[_0xe1cd('0x40')]][_0xe1cd('0x42')]=_0x1c8140[_0xe1cd('0x43')];queues[_0x1c8140[_0xe1cd('0x40')]]['transferuniqueid']=_0x1c8140['transfereeuniqueid'];queues[_0x1c8140['transfereeuniqueid']][_0xe1cd('0x1b')]=_0xe1cd('0x44');utils[_0xe1cd('0x1')](util['format'](_0xe1cd('0x45'),_0x1c8140[_0xe1cd('0x3')],queues[_0x1c8140[_0xe1cd('0x40')]]['name'],_0x1c8140['transfereeuniqueid'],_0x1c8140['extension']));}}catch(_0xd5e170){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')]('[%s][queues][blindtransfer]',_0x1c8140[_0xe1cd('0x3')]),_0xd5e170);}};exports[_0xe1cd('0x46')]=function(_0x55ac2b){try{utils[_0xe1cd('0xf')](util[_0xe1cd('0x10')](_0xe1cd('0x47'),_0x55ac2b[_0xe1cd('0x48')]),_0x55ac2b);if(_0x55ac2b[_0xe1cd('0x48')]==_0x55ac2b[_0xe1cd('0x49')]){if(!_[_0xe1cd('0x15')](queues[_0x55ac2b[_0xe1cd('0x4a')]])){utils[_0xe1cd('0x1')](util['format'](_0xe1cd('0x4b'),_0x55ac2b[_0xe1cd('0x48')],queues[_0x55ac2b[_0xe1cd('0x4a')]][_0xe1cd('0x1c')],_0x55ac2b[_0xe1cd('0x4c')]));queues[_0x55ac2b['secondtransfererlinkedid']][_0xe1cd('0x3d')]=!![];queues[_0x55ac2b[_0xe1cd('0x4a')]][_0xe1cd('0x4d')]=_0xe1cd('0x4e');queues[_0x55ac2b['secondtransfererlinkedid']][_0xe1cd('0x42')]=_0x55ac2b[_0xe1cd('0x4c')];queues[_0x55ac2b[_0xe1cd('0x4a')]][_0xe1cd('0x4f')]=_0x55ac2b[_0xe1cd('0x48')];queues[_0x55ac2b[_0xe1cd('0x4a')]][_0xe1cd('0x1b')]=_0xe1cd('0x50');}if(!_[_0xe1cd('0x15')](queues[_0x55ac2b[_0xe1cd('0x49')]])){if(_0x55ac2b[_0xe1cd('0x51')]&&queues[_0x55ac2b['transfereelinkedid']]){queues[_0x55ac2b[_0xe1cd('0x51')]][_0xe1cd('0x1e')]=0x1;queues[_0x55ac2b[_0xe1cd('0x40')]]=_[_0xe1cd('0x52')](queues[_0x55ac2b[_0xe1cd('0x51')]]);queues[_0x55ac2b[_0xe1cd('0x40')]][_0xe1cd('0xd')]=_0x55ac2b['transfertargetuniqueid'];queues[_0x55ac2b[_0xe1cd('0x40')]]['queuecallerenterreason']=0x2;queues[_0x55ac2b[_0xe1cd('0x40')]]['calleridnum']=queues[_0x55ac2b['secondtransfererlinkedid']][_0xe1cd('0x6')];queues[_0x55ac2b[_0xe1cd('0x40')]][_0xe1cd('0x53')]=queues[_0x55ac2b[_0xe1cd('0x4a')]][_0xe1cd('0x53')];queues[_0x55ac2b[_0xe1cd('0x40')]][_0xe1cd('0x30')]=utils['now']();queues[_0x55ac2b[_0xe1cd('0x40')]]['queuecallerleaveAt']=utils[_0xe1cd('0x13')]();queues[_0x55ac2b[_0xe1cd('0x40')]]['holdtime']=0x0;queues[_0x55ac2b[_0xe1cd('0x40')]]['mohtime']=0x0;utils[_0xe1cd('0x1')](util['format'](_0xe1cd('0x54'),_0x55ac2b[_0xe1cd('0x48')],queues[_0x55ac2b['transfereeuniqueid']][_0xe1cd('0x1c')],queues[_0x55ac2b[_0xe1cd('0x40')]]['calleridnum'],queues[_0x55ac2b['transfereeuniqueid']][_0xe1cd('0x53')]));}else{utils[_0xe1cd('0x1')](util[_0xe1cd('0x10')](_0xe1cd('0x55'),_0x55ac2b[_0xe1cd('0x48')],queues[_0x55ac2b[_0xe1cd('0x49')]][_0xe1cd('0x1c')],_0x55ac2b[_0xe1cd('0x4a')]));queues[_0x55ac2b[_0xe1cd('0x49')]][_0xe1cd('0xd')]=_0x55ac2b['secondtransfererlinkedid'];}}}else if(_0x55ac2b[_0xe1cd('0x56')]==_0x55ac2b[_0xe1cd('0x4a')]){if(!_[_0xe1cd('0x15')](queues[_0x55ac2b['origtransfererlinkedid']])){utils['info'](util['format'](_0xe1cd('0x57'),_0x55ac2b[_0xe1cd('0x48')],queues[_0x55ac2b[_0xe1cd('0x49')]]['name'],_0x55ac2b[_0xe1cd('0x56')],_0x55ac2b[_0xe1cd('0x58')]));queues[_0x55ac2b['origtransfererlinkedid']][_0xe1cd('0x3d')]=!![];queues[_0x55ac2b[_0xe1cd('0x49')]][_0xe1cd('0x4d')]=_0xe1cd('0x4e');queues[_0x55ac2b[_0xe1cd('0x49')]][_0xe1cd('0x42')]=_0x55ac2b[_0xe1cd('0x58')];queues[_0x55ac2b[_0xe1cd('0x49')]][_0xe1cd('0x4f')]=_0x55ac2b['secondtransfereruniqueid'];queues[_0x55ac2b[_0xe1cd('0x49')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xe1cd('0x15')](queues[_0x55ac2b[_0xe1cd('0x4a')]])){if(_0x55ac2b[_0xe1cd('0x59')]&&queues[_0x55ac2b['transfertargetlinkedid']]){queues[_0x55ac2b[_0xe1cd('0x59')]][_0xe1cd('0x1e')]=0x1;queues[_0x55ac2b['transfertargetuniqueid']]=_['clone'](queues[_0x55ac2b[_0xe1cd('0x59')]]);queues[_0x55ac2b[_0xe1cd('0x5a')]]['transfereduniqueid']=_0x55ac2b[_0xe1cd('0x5a')];queues[_0x55ac2b['transfertargetuniqueid']][_0xe1cd('0x1e')]=0x2;queues[_0x55ac2b[_0xe1cd('0x5a')]][_0xe1cd('0x6')]=queues[_0x55ac2b[_0xe1cd('0x49')]]['calleridnum'];queues[_0x55ac2b[_0xe1cd('0x5a')]][_0xe1cd('0x53')]=queues[_0x55ac2b[_0xe1cd('0x49')]][_0xe1cd('0x53')];queues[_0x55ac2b[_0xe1cd('0x5a')]][_0xe1cd('0x30')]=utils[_0xe1cd('0x13')]();queues[_0x55ac2b[_0xe1cd('0x5a')]][_0xe1cd('0x17')]=utils[_0xe1cd('0x13')]();queues[_0x55ac2b[_0xe1cd('0x5a')]][_0xe1cd('0x5b')]=0x0;queues[_0x55ac2b[_0xe1cd('0x5a')]][_0xe1cd('0x5c')]=0x0;utils['info'](util[_0xe1cd('0x10')](_0xe1cd('0x5d'),_0x55ac2b[_0xe1cd('0x48')],queues[_0x55ac2b['transfertargetuniqueid']][_0xe1cd('0x1c')],queues[_0x55ac2b[_0xe1cd('0x5a')]]['transfereduniqueid'],queues[_0x55ac2b[_0xe1cd('0x5a')]]['calleridnum'],queues[_0x55ac2b[_0xe1cd('0x5a')]][_0xe1cd('0x53')]));}else{utils[_0xe1cd('0x1')](util['format'](_0xe1cd('0x55'),_0x55ac2b[_0xe1cd('0x48')],queues[_0x55ac2b[_0xe1cd('0x4a')]][_0xe1cd('0x1c')],_0x55ac2b['origtransfererlinkedid']));queues[_0x55ac2b['secondtransfererlinkedid']]['transfereduniqueid']=_0x55ac2b[_0xe1cd('0x49')];}}}}catch(_0x48094e){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')](_0xe1cd('0x47'),_0x55ac2b['origtransfereruniqueid']),_0x48094e);}};exports[_0xe1cd('0x5e')]=function(_0x214822){try{if(!_['isNil'](queues[_0x214822['uniqueid']])){utils[_0xe1cd('0xf')](util[_0xe1cd('0x10')](_0xe1cd('0x5f'),_0x214822[_0xe1cd('0x3')]),_0x214822);queues[_0x214822[_0xe1cd('0x3')]][_0xe1cd('0x60')]=utils[_0xe1cd('0x13')]();utils[_0xe1cd('0x1')](util['format'](_0xe1cd('0x61'),_0x214822['uniqueid'],queues[_0x214822[_0xe1cd('0x3')]]['name'],queues[_0x214822[_0xe1cd('0x3')]]['musiconholdstartAt']));}}catch(_0x18a5b5){utils[_0xe1cd('0x1f')](util[_0xe1cd('0x10')](_0xe1cd('0x5f'),_0x214822[_0xe1cd('0x3')]),_0x18a5b5);}};exports[_0xe1cd('0x62')]=function(_0x50d52b){try{if(!_[_0xe1cd('0x15')](queues[_0x50d52b[_0xe1cd('0x3')]])){if(!_['isNil'](queues[_0x50d52b['uniqueid']][_0xe1cd('0x60')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x50d52b[_0xe1cd('0x3')]),_0x50d52b);queues[_0x50d52b[_0xe1cd('0x3')]][_0xe1cd('0x5c')]+=utils[_0xe1cd('0x2f')](utils['now'](),queues[_0x50d52b[_0xe1cd('0x3')]][_0xe1cd('0x60')]);utils[_0xe1cd('0x1')](util[_0xe1cd('0x10')](_0xe1cd('0x63'),_0x50d52b[_0xe1cd('0x3')],queues[_0x50d52b[_0xe1cd('0x3')]][_0xe1cd('0x1c')],queues[_0x50d52b[_0xe1cd('0x3')]][_0xe1cd('0x5c')]));delete queues[_0x50d52b['uniqueid']][_0xe1cd('0x60')];}}}catch(_0x2349d0){utils[_0xe1cd('0x1f')](util['format'](_0xe1cd('0x64'),_0x50d52b[_0xe1cd('0x3')]),_0x2349d0);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0a779b7..be02ea3 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 _0x2877=['channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','util','./utils','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2877,0xde));var _0x7287=function(_0x12707e,_0xe85646){_0x12707e=_0x12707e-0x0;var _0x4397d5=_0x2877[_0x12707e];return _0x4397d5;};'use strict';var _=require('lodash');var util=require(_0x7287('0x0'));var utils=require(_0x7287('0x1'));var recordings={};function writeDB(_0x397129){utils['info'](util[_0x7287('0x2')]('[%s][recordings][writeDB]',_0x397129[_0x7287('0x3')]));if(_0x397129[_0x7287('0x4')]){utils[_0x7287('0x5')](_0x397129[_0x7287('0x4')])[_0x7287('0x6')](function(_0xd477db){if(_0xd477db){_0x397129[_0x7287('0x7')]=_0xd477db[_0x7287('0x8')];_0x397129[_0x7287('0x9')]=_0xd477db['id'];}utils[_0x7287('0xa')](_0x7287('0xb'),_0x397129);});}else{utils[_0x7287('0xa')](_0x7287('0xb'),_0x397129);}}exports[_0x7287('0xc')]=function(_0x252ca5){try{utils[_0x7287('0xd')](util[_0x7287('0x2')]('[%s][recordings][newchannel]',_0x252ca5[_0x7287('0x3')]),_0x252ca5);if(_0x252ca5[_0x7287('0x3')]==_0x252ca5['linkedid']){utils[_0x7287('0xe')](util[_0x7287('0x2')](_0x7287('0xf'),_0x252ca5[_0x7287('0x3')],_0x252ca5[_0x7287('0x10')],_0x252ca5[_0x7287('0x11')]));recordings[_0x252ca5['uniqueid']]={'uniqueid':_0x252ca5[_0x7287('0x3')],'accountcode':_0x252ca5[_0x7287('0x4')],'exten':_0x252ca5[_0x7287('0x11')],'context':_0x252ca5[_0x7287('0x10')],'channel':_0x252ca5[_0x7287('0x12')],'monitors':[]};}}catch(_0x3cd8d6){utils[_0x7287('0x13')](util[_0x7287('0x2')]('[%s][recordings][newchannel]',_0x252ca5[_0x7287('0x3')]),_0x3cd8d6);}};exports[_0x7287('0x14')]=function(_0x5507e7){try{utils[_0x7287('0xd')](util[_0x7287('0x2')]('[%s][recordings][newstate]',_0x5507e7[_0x7287('0x3')]),_0x5507e7);if(!_[_0x7287('0x15')](recordings[_0x5507e7[_0x7287('0x3')]])&&_0x5507e7[_0x7287('0x16')]==0x6){utils[_0x7287('0xe')](util['format'](_0x7287('0x17'),_0x5507e7['uniqueid'],_0x5507e7[_0x7287('0x10')],_0x5507e7[_0x7287('0x12')]));}else if(!_[_0x7287('0x15')](recordings[_0x5507e7[_0x7287('0x18')]])&&_0x5507e7[_0x7287('0x16')]==0x6&&_0x5507e7['context']!=_0x7287('0x19')){utils[_0x7287('0xe')](util[_0x7287('0x2')](_0x7287('0x1a'),_0x5507e7[_0x7287('0x3')],_0x5507e7[_0x7287('0x18')],_0x5507e7[_0x7287('0x10')],_0x5507e7[_0x7287('0x12')]));recordings[_0x5507e7[_0x7287('0x18')]][_0x7287('0x4')]=_0x5507e7['accountcode'];}}catch(_0x575795){utils[_0x7287('0x13')](util[_0x7287('0x2')](_0x7287('0x1b'),_0x5507e7[_0x7287('0x3')]),_0x575795);}};exports[_0x7287('0x1c')]=function(_0x1dd5ba){try{if(!_['isNil'](_0x1dd5ba[_0x7287('0x1d')])&&!_[_0x7287('0x15')](_0x1dd5ba[_0x7287('0x1d')][_0x7287('0x1e')])){utils['debug'](util[_0x7287('0x2')]('[%s][recordings][varset]',_0x1dd5ba[_0x7287('0x3')]),_0x1dd5ba);utils[_0x7287('0xe')](util[_0x7287('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1dd5ba['uniqueid'],_0x1dd5ba[_0x7287('0x1d')],_0x1dd5ba[_0x7287('0x1f')]));if(_[_0x7287('0x20')](_0x1dd5ba[_0x7287('0x1f')],_0x7287('0x21'))){_0x1dd5ba[_0x7287('0x1f')]=_0x1dd5ba['value']['replace'](_0x7287('0x21'),_0x7287('0x22'));}if(recordings[_0x1dd5ba[_0x7287('0x18')]]){var _0x46b623=_[_0x7287('0x23')](recordings[_0x1dd5ba[_0x7287('0x18')]][_0x7287('0x24')],{'value':_0x1dd5ba[_0x7287('0x1f')]});if(_[_0x7287('0x15')](_0x46b623)){recordings[_0x1dd5ba[_0x7287('0x18')]][_0x7287('0x24')][_0x7287('0x25')]({'value':_0x1dd5ba[_0x7287('0x1f')]});}}}}catch(_0x359684){utils[_0x7287('0x13')](util['format'](_0x7287('0x26'),_0x1dd5ba[_0x7287('0x3')]),_0x359684);}};exports['hangup']=function(_0x29f2e7){try{if(!_['isNil'](recordings[_0x29f2e7[_0x7287('0x3')]])){utils['debug'](util['format']('[%s][recordings][hangup]',_0x29f2e7['uniqueid']),_0x29f2e7);utils[_0x7287('0xe')](util[_0x7287('0x2')](_0x7287('0x27'),_0x29f2e7['uniqueid'],_0x29f2e7[_0x7287('0x28')],_0x29f2e7[_0x7287('0x29')],_0x29f2e7[_0x7287('0x2a')]));recordings[_0x29f2e7['uniqueid']][_0x7287('0x28')]=_0x29f2e7[_0x7287('0x28')];recordings[_0x29f2e7[_0x7287('0x3')]][_0x7287('0x29')]=_0x29f2e7[_0x7287('0x29')];recordings[_0x29f2e7[_0x7287('0x3')]]['connectedlinenum']=_0x29f2e7[_0x7287('0x2b')];recordings[_0x29f2e7[_0x7287('0x3')]]['connectedlinename']=_0x29f2e7[_0x7287('0x2c')];if(recordings[_0x29f2e7[_0x7287('0x3')]]['type']=='outbound'&&recordings[_0x29f2e7[_0x7287('0x3')]]['accountcode']){recordings[_0x29f2e7[_0x7287('0x3')]][_0x7287('0x2b')]=recordings[_0x29f2e7[_0x7287('0x3')]]['accountcode'];recordings[_0x29f2e7[_0x7287('0x3')]][_0x7287('0x2c')]='';}recordings[_0x29f2e7[_0x7287('0x3')]][_0x7287('0x24')][_0x7287('0x2d')](function(_0x350efc){var _0x225cf4=_[_0x7287('0x2e')](recordings[_0x29f2e7[_0x7287('0x3')]]);_0x225cf4[_0x7287('0x1f')]=_0x350efc[_0x7287('0x1f')];writeDB(_0x225cf4);});delete recordings[_0x29f2e7[_0x7287('0x3')]];}}catch(_0xcbd261){utils['error'](util[_0x7287('0x2')]('[%s][recordings][hangup]',_0x29f2e7['uniqueid']),_0xcbd261);}};exports[_0x7287('0x2f')]=function(_0x5f2866){try{if(!_['isNil'](recordings[_0x5f2866[_0x7287('0x3')]])){utils[_0x7287('0xd')](util['format'](_0x7287('0x30'),_0x5f2866[_0x7287('0x3')]),_0x5f2866);utils['info'](util[_0x7287('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5f2866[_0x7287('0x3')],_0x5f2866[_0x7287('0x31')],_0x5f2866['appdata']));if(_0x5f2866[_0x7287('0x31')][_0x7287('0x32')]()==_0x7287('0x33')&&_[_0x7287('0x34')](_0x5f2866[_0x7287('0x35')][_0x7287('0x32')](),_0x7287('0x36'))){var _0x124558=_0x5f2866['appdata'][_0x7287('0x37')]('=');var _0x1281ca=_0x124558[0x0][_0x7287('0x38')](_0x124558[0x0][_0x7287('0x39')]('(')+0x1,_0x124558[0x0][_0x7287('0x39')](')'));var _0x50bfaa=_0x124558[0x1];recordings[_0x5f2866['uniqueid']][_0x1281ca]=_0x50bfaa;}}}catch(_0xa3a03d){utils[_0x7287('0x13')](util[_0x7287('0x2')](_0x7287('0x30'),_0x5f2866[_0x7287('0x3')]),_0xa3a03d);}};exports[_0x7287('0x3a')]=function(_0x35a4b0){try{if(!_[_0x7287('0x15')](recordings[_0x35a4b0[_0x7287('0x3')]])){utils[_0x7287('0xd')](util[_0x7287('0x2')](_0x7287('0x3b'),_0x35a4b0[_0x7287('0x3')]),_0x35a4b0);utils[_0x7287('0xe')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x35a4b0[_0x7287('0x3')],_0x35a4b0['queue']));recordings[_0x35a4b0[_0x7287('0x3')]][_0x7287('0x3c')]=_0x35a4b0[_0x7287('0x3c')];}}catch(_0x52cacc){utils['error'](util[_0x7287('0x2')](_0x7287('0x3b'),_0x35a4b0['uniqueid']),_0x52cacc);}}; \ No newline at end of file +var _0x0925=['format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils'];(function(_0x32ca5a,_0x3bb076){var _0x1a9c63=function(_0x5518b6){while(--_0x5518b6){_0x32ca5a['push'](_0x32ca5a['shift']());}};_0x1a9c63(++_0x3bb076);}(_0x0925,0x1af));var _0x5092=function(_0xdf5452,_0x19af67){_0xdf5452=_0xdf5452-0x0;var _0xf35e7b=_0x0925[_0xdf5452];return _0xf35e7b;};'use strict';var _=require(_0x5092('0x0'));var util=require(_0x5092('0x1'));var utils=require(_0x5092('0x2'));var recordings={};function writeDB(_0x2877c0){utils['info'](util[_0x5092('0x3')](_0x5092('0x4'),_0x2877c0[_0x5092('0x5')]));if(_0x2877c0[_0x5092('0x6')]){utils[_0x5092('0x7')](_0x2877c0['accountcode'])[_0x5092('0x8')](function(_0x582394){if(_0x582394){_0x2877c0[_0x5092('0x9')]=_0x582394['name'];_0x2877c0[_0x5092('0xa')]=_0x582394['id'];}utils['request'](_0x5092('0xb'),_0x2877c0);});}else{utils[_0x5092('0xc')](_0x5092('0xb'),_0x2877c0);}}exports[_0x5092('0xd')]=function(_0x4ee0ed){try{utils[_0x5092('0xe')](util[_0x5092('0x3')](_0x5092('0xf'),_0x4ee0ed[_0x5092('0x5')]),_0x4ee0ed);if(_0x4ee0ed[_0x5092('0x5')]==_0x4ee0ed[_0x5092('0x10')]){utils[_0x5092('0x11')](util[_0x5092('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4ee0ed['uniqueid'],_0x4ee0ed[_0x5092('0x12')],_0x4ee0ed[_0x5092('0x13')]));recordings[_0x4ee0ed['uniqueid']]={'uniqueid':_0x4ee0ed[_0x5092('0x5')],'accountcode':_0x4ee0ed['accountcode'],'exten':_0x4ee0ed[_0x5092('0x13')],'context':_0x4ee0ed['context'],'channel':_0x4ee0ed[_0x5092('0x14')],'monitors':[]};}}catch(_0xd040b8){utils[_0x5092('0x15')](util['format'](_0x5092('0xf'),_0x4ee0ed[_0x5092('0x5')]),_0xd040b8);}};exports[_0x5092('0x16')]=function(_0x54d988){try{utils['debug'](util['format'](_0x5092('0x17'),_0x54d988['uniqueid']),_0x54d988);if(!_[_0x5092('0x18')](recordings[_0x54d988[_0x5092('0x5')]])&&_0x54d988['channelstate']==0x6){utils[_0x5092('0x11')](util['format'](_0x5092('0x19'),_0x54d988['uniqueid'],_0x54d988['context'],_0x54d988[_0x5092('0x14')]));}else if(!_[_0x5092('0x18')](recordings[_0x54d988['linkedid']])&&_0x54d988['channelstate']==0x6&&_0x54d988[_0x5092('0x12')]!=_0x5092('0x1a')){utils['info'](util['format'](_0x5092('0x1b'),_0x54d988[_0x5092('0x5')],_0x54d988[_0x5092('0x10')],_0x54d988[_0x5092('0x12')],_0x54d988[_0x5092('0x14')]));recordings[_0x54d988[_0x5092('0x10')]][_0x5092('0x6')]=_0x54d988[_0x5092('0x6')];}}catch(_0x4f3c68){utils[_0x5092('0x15')](util['format'](_0x5092('0x17'),_0x54d988['uniqueid']),_0x4f3c68);}};exports[_0x5092('0x1c')]=function(_0x125d39){try{if(!_[_0x5092('0x18')](_0x125d39['variable'])&&!_['isNil'](_0x125d39[_0x5092('0x1d')][_0x5092('0x1e')])){utils[_0x5092('0xe')](util[_0x5092('0x3')]('[%s][recordings][varset]',_0x125d39['uniqueid']),_0x125d39);utils[_0x5092('0x11')](util['format'](_0x5092('0x1f'),_0x125d39[_0x5092('0x5')],_0x125d39['variable'],_0x125d39[_0x5092('0x20')]));if(_[_0x5092('0x21')](_0x125d39[_0x5092('0x20')],_0x5092('0x22'))){_0x125d39[_0x5092('0x20')]=_0x125d39[_0x5092('0x20')]['replace']('.wav49',_0x5092('0x23'));}if(recordings[_0x125d39[_0x5092('0x10')]]){var _0x198d42=_[_0x5092('0x24')](recordings[_0x125d39[_0x5092('0x10')]][_0x5092('0x25')],{'value':_0x125d39[_0x5092('0x20')]});if(_[_0x5092('0x18')](_0x198d42)){recordings[_0x125d39[_0x5092('0x10')]]['monitors']['push']({'value':_0x125d39[_0x5092('0x20')]});}}}}catch(_0x576e43){utils['error'](util[_0x5092('0x3')]('[%s][recordings][varset]',_0x125d39[_0x5092('0x5')]),_0x576e43);}};exports[_0x5092('0x26')]=function(_0x5a3244){try{if(!_[_0x5092('0x18')](recordings[_0x5a3244[_0x5092('0x5')]])){utils[_0x5092('0xe')](util[_0x5092('0x3')]('[%s][recordings][hangup]',_0x5a3244['uniqueid']),_0x5a3244);utils['info'](util[_0x5092('0x3')](_0x5092('0x27'),_0x5a3244[_0x5092('0x5')],_0x5a3244[_0x5092('0x28')],_0x5a3244[_0x5092('0x29')],_0x5a3244[_0x5092('0x2a')]));recordings[_0x5a3244[_0x5092('0x5')]][_0x5092('0x28')]=_0x5a3244[_0x5092('0x28')];recordings[_0x5a3244['uniqueid']][_0x5092('0x29')]=_0x5a3244[_0x5092('0x29')];recordings[_0x5a3244['uniqueid']][_0x5092('0x2b')]=_0x5a3244[_0x5092('0x2b')];recordings[_0x5a3244[_0x5092('0x5')]]['connectedlinename']=_0x5a3244[_0x5092('0x2c')];if(recordings[_0x5a3244['uniqueid']][_0x5092('0x2d')]=='outbound'&&recordings[_0x5a3244[_0x5092('0x5')]][_0x5092('0x6')]){recordings[_0x5a3244['uniqueid']][_0x5092('0x2b')]=recordings[_0x5a3244[_0x5092('0x5')]][_0x5092('0x6')];recordings[_0x5a3244['uniqueid']]['connectedlinename']='';}recordings[_0x5a3244[_0x5092('0x5')]][_0x5092('0x25')]['forEach'](function(_0x50afc0){var _0x33b7b2=_[_0x5092('0x2e')](recordings[_0x5a3244[_0x5092('0x5')]]);_0x33b7b2[_0x5092('0x20')]=_0x50afc0[_0x5092('0x20')];writeDB(_0x33b7b2);});delete recordings[_0x5a3244[_0x5092('0x5')]];}}catch(_0x2260df){utils[_0x5092('0x15')](util[_0x5092('0x3')]('[%s][recordings][hangup]',_0x5a3244[_0x5092('0x5')]),_0x2260df);}};exports[_0x5092('0x2f')]=function(_0x6e1fca){try{if(!_[_0x5092('0x18')](recordings[_0x6e1fca[_0x5092('0x5')]])){utils[_0x5092('0xe')](util[_0x5092('0x3')](_0x5092('0x30'),_0x6e1fca[_0x5092('0x5')]),_0x6e1fca);utils[_0x5092('0x11')](util[_0x5092('0x3')](_0x5092('0x31'),_0x6e1fca[_0x5092('0x5')],_0x6e1fca[_0x5092('0x32')],_0x6e1fca[_0x5092('0x33')]));if(_0x6e1fca[_0x5092('0x32')][_0x5092('0x34')]()==_0x5092('0x35')&&_[_0x5092('0x36')](_0x6e1fca[_0x5092('0x33')][_0x5092('0x34')](),_0x5092('0x37'))){var _0x878a0b=_0x6e1fca[_0x5092('0x33')][_0x5092('0x38')]('=');var _0x122659=_0x878a0b[0x0][_0x5092('0x39')](_0x878a0b[0x0][_0x5092('0x3a')]('(')+0x1,_0x878a0b[0x0][_0x5092('0x3a')](')'));var _0x3055b6=_0x878a0b[0x1];recordings[_0x6e1fca['uniqueid']][_0x122659]=_0x3055b6;}}}catch(_0x3fc3da){utils[_0x5092('0x15')](util[_0x5092('0x3')](_0x5092('0x30'),_0x6e1fca['uniqueid']),_0x3fc3da);}};exports[_0x5092('0x3b')]=function(_0x13e1fe){try{if(!_[_0x5092('0x18')](recordings[_0x13e1fe[_0x5092('0x5')]])){utils[_0x5092('0xe')](util[_0x5092('0x3')](_0x5092('0x3c'),_0x13e1fe[_0x5092('0x5')]),_0x13e1fe);utils['info'](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x13e1fe['uniqueid'],_0x13e1fe[_0x5092('0x3d')]));recordings[_0x13e1fe[_0x5092('0x5')]][_0x5092('0x3d')]=_0x13e1fe[_0x5092('0x3d')];}}catch(_0x5413d5){utils[_0x5092('0x15')](util[_0x5092('0x3')]('[%s][recordings][queuecallerjoin]',_0x13e1fe[_0x5092('0x5')]),_0x5413d5);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c584820..e324814 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 _0xa256=['origtransfereruniqueid','uniqueid','request','blindtransfer','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blinds','error','attendedtransfer','debug','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','[%s][transfers][attendedtransfer]','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended'];(function(_0x243c7b,_0x1e479a){var _0x45b9c1=function(_0xafef9c){while(--_0xafef9c){_0x243c7b['push'](_0x243c7b['shift']());}};_0x45b9c1(++_0x1e479a);}(_0xa256,0xb2));var _0x6a25=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xa256[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x6a25('0x0'));var util=require(_0x6a25('0x1'));var utils=require(_0x6a25('0x2'));function writeDB(_0x4c5614){utils['info'](util[_0x6a25('0x3')](_0x6a25('0x4'),_0x4c5614[_0x6a25('0x5')]===_0x6a25('0x6')?_0x4c5614[_0x6a25('0x7')]:_0x4c5614[_0x6a25('0x8')],_0x4c5614[_0x6a25('0x5')]));utils[_0x6a25('0x9')]('CreateVoiceTransferReport',_0x4c5614);}exports['blinds']={};exports[_0x6a25('0xa')]=function(_0x6b2321){try{utils['debug'](util[_0x6a25('0x3')](_0x6a25('0xb'),_0x6b2321['uniqueid']),_0x6b2321);utils[_0x6a25('0xc')](util['format'](_0x6a25('0xd'),_0x6b2321[_0x6a25('0x8')],_0x6b2321[_0x6a25('0xe')],_0x6b2321['transferercalleridname'],_0x6b2321[_0x6a25('0xf')],_0x6b2321['transfereecalleridname']));_0x6b2321[_0x6a25('0x5')]='blind';exports[_0x6a25('0x10')][_0x6b2321['transfereruniqueid']]=_0x6b2321;writeDB(_0x6b2321);}catch(_0x394f59){utils[_0x6a25('0x11')](util[_0x6a25('0x3')](_0x6a25('0xb'),_0x6b2321['uniqueid']),_0x394f59);}};exports[_0x6a25('0x12')]=function(_0x4cd251){try{utils[_0x6a25('0x13')](util[_0x6a25('0x3')]('[%s][transfers][attendedtransfer]',_0x4cd251[_0x6a25('0x7')]),_0x4cd251);utils[_0x6a25('0xc')](util[_0x6a25('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4cd251[_0x6a25('0x7')],_0x4cd251[_0x6a25('0x14')],_0x4cd251[_0x6a25('0x15')],_0x4cd251[_0x6a25('0x16')],_0x4cd251[_0x6a25('0x17')]));_0x4cd251=_[_0x6a25('0x18')](_0x4cd251,{'transfererchannel':_0x4cd251[_0x6a25('0x19')],'transferercalleridnum':_0x4cd251['origtransferercalleridnum'],'transferercalleridname':_0x4cd251[_0x6a25('0x15')],'transfererconnectedlinenum':_0x4cd251[_0x6a25('0x1a')],'transfererconnectedlinename':_0x4cd251['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4cd251[_0x6a25('0x1b')],'transferercontext':_0x4cd251['secondtransferercontext'],'transfererexten':_0x4cd251[_0x6a25('0x1c')],'transfererlinkedid':_0x4cd251[_0x6a25('0x1d')],'context':_0x4cd251['origtransferercontext'],'extension':_0x4cd251[_0x6a25('0x1e')],'type':'attended'});if(_['isNil'](_0x4cd251[_0x6a25('0x1f')])){_0x4cd251=_['assign'](_0x4cd251,{'transfereechannel':_0x4cd251[_0x6a25('0x20')],'transfereecalleridnum':_0x4cd251['transfertargetcalleridnum'],'transfereecalleridname':_0x4cd251[_0x6a25('0x17')],'transfereeconnectedlinenum':_0x4cd251[_0x6a25('0x21')],'transfereeconnectedlinename':_0x4cd251[_0x6a25('0x22')],'transfereeaccountcode':_0x4cd251['transfertargetaccountcode'],'transfereecontext':_0x4cd251['transfertargetcontext'],'transfereeexten':_0x4cd251[_0x6a25('0x23')],'transfereelinkedid':_0x4cd251['transfertargetlinkedid']});}writeDB(_0x4cd251);}catch(_0x45d0ca){utils[_0x6a25('0x11')](util[_0x6a25('0x3')](_0x6a25('0x24'),_0x4cd251[_0x6a25('0x7')]),_0x45d0ca);}}; \ No newline at end of file +var _0x27d9=['error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfereruniqueid','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blinds'];(function(_0x3d403c,_0x3f7f3c){var _0x54c570=function(_0x230316){while(--_0x230316){_0x3d403c['push'](_0x3d403c['shift']());}};_0x54c570(++_0x3f7f3c);}(_0x27d9,0x129));var _0x927d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x27d9[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x927d('0x0'));function writeDB(_0x388a66){utils['info'](util[_0x927d('0x1')](_0x927d('0x2'),_0x388a66[_0x927d('0x3')]===_0x927d('0x4')?_0x388a66['origtransfereruniqueid']:_0x388a66[_0x927d('0x5')],_0x388a66['type']));utils['request'](_0x927d('0x6'),_0x388a66);}exports['blinds']={};exports[_0x927d('0x7')]=function(_0x4b8123){try{utils['debug'](util[_0x927d('0x1')](_0x927d('0x8'),_0x4b8123['uniqueid']),_0x4b8123);utils[_0x927d('0x9')](util[_0x927d('0x1')](_0x927d('0xa'),_0x4b8123['uniqueid'],_0x4b8123['transferercalleridnum'],_0x4b8123[_0x927d('0xb')],_0x4b8123[_0x927d('0xc')],_0x4b8123[_0x927d('0xd')]));_0x4b8123[_0x927d('0x3')]='blind';exports[_0x927d('0xe')][_0x4b8123['transfereruniqueid']]=_0x4b8123;writeDB(_0x4b8123);}catch(_0x370a5b){utils[_0x927d('0xf')](util[_0x927d('0x1')](_0x927d('0x8'),_0x4b8123[_0x927d('0x5')]),_0x370a5b);}};exports[_0x927d('0x10')]=function(_0x5e7482){try{utils[_0x927d('0x11')](util[_0x927d('0x1')](_0x927d('0x12'),_0x5e7482['origtransfereruniqueid']),_0x5e7482);utils[_0x927d('0x9')](util[_0x927d('0x1')](_0x927d('0x13'),_0x5e7482['origtransfereruniqueid'],_0x5e7482[_0x927d('0x14')],_0x5e7482['origtransferercalleridname'],_0x5e7482[_0x927d('0x15')],_0x5e7482['transfertargetcalleridname']));_0x5e7482=_[_0x927d('0x16')](_0x5e7482,{'transfererchannel':_0x5e7482['origtransfererchannel'],'transferercalleridnum':_0x5e7482[_0x927d('0x14')],'transferercalleridname':_0x5e7482[_0x927d('0x17')],'transfererconnectedlinenum':_0x5e7482['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5e7482[_0x927d('0x18')],'transfereraccountcode':_0x5e7482[_0x927d('0x19')],'transferercontext':_0x5e7482[_0x927d('0x1a')],'transfererexten':_0x5e7482['secondtransfererexten'],'transfererlinkedid':_0x5e7482[_0x927d('0x1b')],'context':_0x5e7482['origtransferercontext'],'extension':_0x5e7482[_0x927d('0x1c')],'type':_0x927d('0x4')});if(_[_0x927d('0x1d')](_0x5e7482[_0x927d('0x1e')])){_0x5e7482=_[_0x927d('0x16')](_0x5e7482,{'transfereechannel':_0x5e7482['transfertargetchannel'],'transfereecalleridnum':_0x5e7482[_0x927d('0x15')],'transfereecalleridname':_0x5e7482[_0x927d('0x1f')],'transfereeconnectedlinenum':_0x5e7482[_0x927d('0x20')],'transfereeconnectedlinename':_0x5e7482[_0x927d('0x21')],'transfereeaccountcode':_0x5e7482[_0x927d('0x22')],'transfereecontext':_0x5e7482[_0x927d('0x23')],'transfereeexten':_0x5e7482[_0x927d('0x24')],'transfereelinkedid':_0x5e7482[_0x927d('0x25')]});}writeDB(_0x5e7482);}catch(_0x428398){utils['error'](util[_0x927d('0x1')](_0x927d('0x12'),_0x5e7482[_0x927d('0x26')]),_0x428398);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 89210c1..a3a357b 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 _0x847d=['info','debug','error','request','then','[utils][request]\x20name:%s','inspect','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x847d,0xf8));var _0xd847=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x847d[_0x231a47];return _0x48d7c9;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xd847('0x0'));var moment=require(_0xd847('0x1'));var util=require(_0xd847('0x2'));var client=jayson[_0xd847('0x3')][_0xd847('0x4')]({'port':0x2329});var logger=require(_0xd847('0x5'))(_0xd847('0x6'));exports['info']=function(_0x20dd94,_0xcac372){logger[_0xd847('0x7')](_0x20dd94,_0xcac372?util['inspect'](_0xcac372,{'showHidden':![],'depth':null}):'');};exports[_0xd847('0x8')]=function(_0x16bcae,_0x4a9556){logger[_0xd847('0x8')](_0x16bcae,_0x4a9556?util['inspect'](_0x4a9556,{'showHidden':![],'depth':null}):'');};exports[_0xd847('0x9')]=function(_0x1496c9,_0x370bd2){logger['error'](_0x1496c9,_0x370bd2?util['inspect'](_0x370bd2,{'showHidden':![],'depth':null}):'');};exports[_0xd847('0xa')]=function(_0x3bbcd2,_0x56a923){return client[_0xd847('0xa')](_0x3bbcd2,{'body':_0x56a923})[_0xd847('0xb')](function(_0x48bddd){logger['debug'](_0xd847('0xc'),_0x3bbcd2,_0x48bddd?util[_0xd847('0xd')](_0x48bddd,{'showHidden':![],'depth':null}):'');})[_0xd847('0xe')](function(_0x3f5935){logger[_0xd847('0x9')]('[utils][request]\x20name:%s',_0x3bbcd2,_0x3f5935?util[_0xd847('0xd')](_0x3f5935,{'showHidden':![],'depth':null}):'');});};function getUser(_0x26ed4e){return client['request'](_0xd847('0xf'),{'options':{'raw':!![],'attributes':['id',_0xd847('0x10'),'name',_0xd847('0x11')],'where':_0x26ed4e,'limit':0x1}})[_0xd847('0xb')](function(_0x1e87ce){logger[_0xd847('0x8')](_0xd847('0x12'),JSON[_0xd847('0x13')](_0x26ed4e),_0x1e87ce?util['inspect'](_0x1e87ce,{'showHidden':![],'depth':null}):'');return _0x1e87ce['result'][_0xd847('0x14')]?_0x1e87ce['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x5eeef7){return new BPromise(function(_0x56fa2d,_0x8f12dc){if(_0x5eeef7){return getUser({'internal':_0x5eeef7})[_0xd847('0xb')](function(_0x443fd1){logger[_0xd847('0x7')](_0xd847('0x15'),_0x5eeef7,_0x443fd1?_0xd847('0x16'):_0xd847('0x17'));return _0x56fa2d(_0x443fd1);})[_0xd847('0xe')](function(_0x2c23df){logger[_0xd847('0x9')](_0xd847('0x18'),_0x2c23df?util['inspect'](_0x2c23df,{'showHidden':![],'depth':null}):'');return _0x56fa2d(null);});}return _0x56fa2d(null);});};exports[_0xd847('0x19')]=function(_0x4c2c6c){return new BPromise(function(_0x1a0f23,_0x253d44){if(_0x4c2c6c){return getUser({'interface':_0x4c2c6c})[_0xd847('0xb')](function(_0x544ec2){logger['info'](_0xd847('0x1a'),_0x4c2c6c,_0x544ec2?_0xd847('0x16'):_0xd847('0x17'));return _0x1a0f23(_0x544ec2);})[_0xd847('0xe')](function(_0x506435){logger[_0xd847('0x9')](_0xd847('0x1b'),_0x506435?util['inspect'](_0x506435,{'showHidden':![],'depth':null}):'');return _0x1a0f23(null);});}return _0x1a0f23(null);});};exports[_0xd847('0x1c')]=function(_0x80b591){return new BPromise(function(_0x3d7a90,_0x58655c){if(_0x80b591){return getUser({'name':_0x80b591})[_0xd847('0xb')](function(_0x2a9402){logger[_0xd847('0x7')](_0xd847('0x1d'),_0x80b591,_0x2a9402?_0xd847('0x16'):'notfound');return _0x3d7a90(_0x2a9402);})[_0xd847('0xe')](function(_0x1b6ac1){logger[_0xd847('0x9')](_0xd847('0x1e'),_0x1b6ac1?util[_0xd847('0xd')](_0x1b6ac1,{'showHidden':![],'depth':null}):'');return _0x3d7a90(null);});}return _0x3d7a90(null);});};exports[_0xd847('0x1f')]=function(_0x2c9297){return new BPromise(function(_0x2df845,_0x1320f9){if(_0x2c9297){return client[_0xd847('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xd847('0x20'),_0xd847('0x21'),_0xd847('0x22'),_0xd847('0x23')],'where':{'name':_0x2c9297},'limit':0x1}})[_0xd847('0xb')](function(_0x2c4a24){logger['debug'](_0xd847('0x24'),_0x2c9297,_0x2c4a24?util['inspect'](_0x2c4a24,{'showHidden':![],'depth':null}):'');logger[_0xd847('0x7')](_0xd847('0x25'),_0x2c9297,_0x2c4a24?_0xd847('0x16'):_0xd847('0x17'));return _0x2df845(_0x2c4a24[_0xd847('0x26')][_0xd847('0x14')]?_0x2c4a24[_0xd847('0x26')][0x0]:null);})['catch'](function(_0x43d878){logger[_0xd847('0x9')]('[utils][getVoiceQueueByName]',_0x43d878?util['inspect'](_0x43d878,{'showHidden':![],'depth':null}):'');return _0x2df845(null);});}return _0x2df845(null);});};exports[_0xd847('0x27')]=function(_0x5090f8,_0x52bd33){return moment(_0x5090f8)[_0xd847('0x28')](_0x52bd33,_0xd847('0x29'))[_0xd847('0x2a')](_0xd847('0x2b'));};exports[_0xd847('0x2c')]=function(_0x3a3c42,_0x2203b3){return moment(_0x3a3c42)[_0xd847('0x2d')](_0x2203b3,_0xd847('0x29'))[_0xd847('0x2a')](_0xd847('0x2b'));};exports[_0xd847('0x2e')]=function(_0x4c7be1,_0xe1a70c){return moment(_0x4c7be1)[_0xd847('0x2f')](moment(_0xe1a70c),_0xd847('0x29'));};exports['sumTime']=function(_0x397433,_0x2289ae){return parseInt(_0x397433,0xa)+parseInt(_0x2289ae,0xa);};exports[_0xd847('0x30')]=function(){return moment()[_0xd847('0x2a')](_0xd847('0x2b'));};exports[_0xd847('0x31')]=function(_0x57c07e,_0x5a5fb0){if(_0x5a5fb0){return moment(_0x57c07e)[_0xd847('0x31')](_0x5a5fb0);}return!![];};exports[_0xd847('0x32')]=function(_0x3d23b3,_0x49c63a){if(_0x49c63a){return moment(_0x3d23b3)[_0xd847('0x32')](_0x49c63a);}else if(_0x3d23b3){return!![];}return![];}; \ No newline at end of file +var _0x33af=['error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','subtractTime','format','diffTime','diff','sumTime','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','jayson/promise','util','client','http','../../config/logger','xdr','info','debug','inspect'];(function(_0x42e88f,_0x305338){var _0x2c4001=function(_0x4d55de){while(--_0x4d55de){_0x42e88f['push'](_0x42e88f['shift']());}};_0x2c4001(++_0x305338);}(_0x33af,0xec));var _0xf33a=function(_0x12187e,_0x3ac0b2){_0x12187e=_0x12187e-0x0;var _0x4e5cf9=_0x33af[_0x12187e];return _0x4e5cf9;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf33a('0x0'));var moment=require('moment');var util=require(_0xf33a('0x1'));var client=jayson[_0xf33a('0x2')][_0xf33a('0x3')]({'port':0x2329});var logger=require(_0xf33a('0x4'))(_0xf33a('0x5'));exports[_0xf33a('0x6')]=function(_0x4c734e,_0x433e25){logger[_0xf33a('0x6')](_0x4c734e,_0x433e25?util['inspect'](_0x433e25,{'showHidden':![],'depth':null}):'');};exports[_0xf33a('0x7')]=function(_0x384b14,_0x1b2b01){logger[_0xf33a('0x7')](_0x384b14,_0x1b2b01?util[_0xf33a('0x8')](_0x1b2b01,{'showHidden':![],'depth':null}):'');};exports[_0xf33a('0x9')]=function(_0x52517f,_0x29bb24){logger[_0xf33a('0x9')](_0x52517f,_0x29bb24?util[_0xf33a('0x8')](_0x29bb24,{'showHidden':![],'depth':null}):'');};exports[_0xf33a('0xa')]=function(_0x44ee7f,_0x27f30a){return client['request'](_0x44ee7f,{'body':_0x27f30a})['then'](function(_0x31ccd8){logger[_0xf33a('0x7')](_0xf33a('0xb'),_0x44ee7f,_0x31ccd8?util[_0xf33a('0x8')](_0x31ccd8,{'showHidden':![],'depth':null}):'');})[_0xf33a('0xc')](function(_0x5959c9){logger[_0xf33a('0x9')](_0xf33a('0xb'),_0x44ee7f,_0x5959c9?util['inspect'](_0x5959c9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x506924){return client[_0xf33a('0xa')](_0xf33a('0xd'),{'options':{'raw':!![],'attributes':['id',_0xf33a('0xe'),_0xf33a('0xf'),_0xf33a('0x10')],'where':_0x506924,'limit':0x1}})[_0xf33a('0x11')](function(_0x45e311){logger[_0xf33a('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xf33a('0x12')](_0x506924),_0x45e311?util['inspect'](_0x45e311,{'showHidden':![],'depth':null}):'');return _0x45e311[_0xf33a('0x13')][_0xf33a('0x14')]?_0x45e311['result'][0x0]:null;});}exports[_0xf33a('0x15')]=function(_0x25c931){return new BPromise(function(_0x524109,_0x2946ef){if(_0x25c931){return getUser({'internal':_0x25c931})[_0xf33a('0x11')](function(_0x38d69a){logger[_0xf33a('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x25c931,_0x38d69a?_0xf33a('0x16'):_0xf33a('0x17'));return _0x524109(_0x38d69a);})[_0xf33a('0xc')](function(_0x30e383){logger[_0xf33a('0x9')](_0xf33a('0x18'),_0x30e383?util[_0xf33a('0x8')](_0x30e383,{'showHidden':![],'depth':null}):'');return _0x524109(null);});}return _0x524109(null);});};exports[_0xf33a('0x19')]=function(_0x19055e){return new BPromise(function(_0x3cf525,_0x520dc4){if(_0x19055e){return getUser({'interface':_0x19055e})[_0xf33a('0x11')](function(_0x272e60){logger[_0xf33a('0x6')](_0xf33a('0x1a'),_0x19055e,_0x272e60?_0xf33a('0x16'):'notfound');return _0x3cf525(_0x272e60);})[_0xf33a('0xc')](function(_0x5882ba){logger[_0xf33a('0x9')](_0xf33a('0x1b'),_0x5882ba?util[_0xf33a('0x8')](_0x5882ba,{'showHidden':![],'depth':null}):'');return _0x3cf525(null);});}return _0x3cf525(null);});};exports[_0xf33a('0x1c')]=function(_0x429b83){return new BPromise(function(_0x4b9801,_0x57cb1d){if(_0x429b83){return getUser({'name':_0x429b83})[_0xf33a('0x11')](function(_0x5edf1a){logger['info'](_0xf33a('0x1d'),_0x429b83,_0x5edf1a?'found':'notfound');return _0x4b9801(_0x5edf1a);})[_0xf33a('0xc')](function(_0x4f60a4){logger[_0xf33a('0x9')]('[utils][getUserByName]',_0x4f60a4?util[_0xf33a('0x8')](_0x4f60a4,{'showHidden':![],'depth':null}):'');return _0x4b9801(null);});}return _0x4b9801(null);});};exports[_0xf33a('0x1e')]=function(_0x469741){return new BPromise(function(_0x729fca,_0x4552c9){if(_0x469741){return client[_0xf33a('0xa')](_0xf33a('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xf33a('0xf'),_0xf33a('0x20'),_0xf33a('0x21'),_0xf33a('0x22')],'where':{'name':_0x469741},'limit':0x1}})[_0xf33a('0x11')](function(_0x22c9f2){logger[_0xf33a('0x7')](_0xf33a('0x23'),_0x469741,_0x22c9f2?util['inspect'](_0x22c9f2,{'showHidden':![],'depth':null}):'');logger[_0xf33a('0x6')](_0xf33a('0x24'),_0x469741,_0x22c9f2?_0xf33a('0x16'):_0xf33a('0x17'));return _0x729fca(_0x22c9f2['result'][_0xf33a('0x14')]?_0x22c9f2[_0xf33a('0x13')][0x0]:null);})[_0xf33a('0xc')](function(_0x31cb7c){logger[_0xf33a('0x9')](_0xf33a('0x25'),_0x31cb7c?util['inspect'](_0x31cb7c,{'showHidden':![],'depth':null}):'');return _0x729fca(null);});}return _0x729fca(null);});};exports[_0xf33a('0x26')]=function(_0x6f5b94,_0x3956aa){return moment(_0x6f5b94)[_0xf33a('0x27')](_0x3956aa,_0xf33a('0x28'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf33a('0x29')]=function(_0x4b25dd,_0x5ee01e){return moment(_0x4b25dd)['subtract'](_0x5ee01e,_0xf33a('0x28'))[_0xf33a('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf33a('0x2b')]=function(_0x55f457,_0x2103b5){return moment(_0x55f457)[_0xf33a('0x2c')](moment(_0x2103b5),_0xf33a('0x28'));};exports[_0xf33a('0x2d')]=function(_0x156731,_0x23c92b){return parseInt(_0x156731,0xa)+parseInt(_0x23c92b,0xa);};exports['now']=function(){return moment()[_0xf33a('0x2a')](_0xf33a('0x2e'));};exports['isAfter']=function(_0x380842,_0x3793b4){if(_0x3793b4){return moment(_0x380842)[_0xf33a('0x2f')](_0x3793b4);}return!![];};exports['isBefore']=function(_0x7a06e1,_0x1650c){if(_0x1650c){return moment(_0x7a06e1)[_0xf33a('0x30')](_0x1650c);}else if(_0x7a06e1){return!![];}return![];}; \ No newline at end of file